From b0053aaa23907cb3e10e6d13923b9afd735c7272 Mon Sep 17 00:00:00 2001 From: Jingoo Han Date: Tue, 23 Oct 2012 05:18:47 -0700 Subject: leds: renesas: use gpio_request_one Using gpio_request_one can make the code simpler because it can set the direction and initial value in one shot. Signed-off-by: Jingoo Han Signed-off-by: Bryan Wu --- drivers/leds/leds-renesas-tpu.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'drivers/leds/leds-renesas-tpu.c') diff --git a/drivers/leds/leds-renesas-tpu.c b/drivers/leds/leds-renesas-tpu.c index 771ea067e680..614776a30943 100644 --- a/drivers/leds/leds-renesas-tpu.c +++ b/drivers/leds/leds-renesas-tpu.c @@ -204,10 +204,10 @@ static void r_tpu_set_pin(struct r_tpu_priv *p, enum r_tpu_pin new_state, if (p->pin_state == R_TPU_PIN_GPIO_FN) gpio_free(cfg->pin_gpio_fn); - if (new_state == R_TPU_PIN_GPIO) { - gpio_request(cfg->pin_gpio, cfg->name); - gpio_direction_output(cfg->pin_gpio, !!brightness); - } + if (new_state == R_TPU_PIN_GPIO) + gpio_request_one(cfg->pin_gpio, GPIOF_DIR_OUT | !!brightness, + cfg->name); + if (new_state == R_TPU_PIN_GPIO_FN) gpio_request(cfg->pin_gpio_fn, cfg->name); -- cgit v1.2.3 From f9e007fffd44ba508c0b9c62c8126eb350bcff1e Mon Sep 17 00:00:00 2001 From: Jingoo Han Date: Tue, 23 Oct 2012 05:22:11 -0700 Subject: leds: renesas: use devm_ functions The devm_ functions allocate memory that is released when a driver detaches. This makes the code smaller and a bit simpler. Signed-off-by: Jingoo Han Signed-off-by: Bryan Wu --- drivers/leds/leds-renesas-tpu.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) (limited to 'drivers/leds/leds-renesas-tpu.c') diff --git a/drivers/leds/leds-renesas-tpu.c b/drivers/leds/leds-renesas-tpu.c index 614776a30943..99bec6cf3306 100644 --- a/drivers/leds/leds-renesas-tpu.c +++ b/drivers/leds/leds-renesas-tpu.c @@ -263,18 +263,18 @@ static int __devinit r_tpu_probe(struct platform_device *pdev) } /* map memory, let mapbase point to our channel */ - p->mapbase = ioremap_nocache(res->start, resource_size(res)); + p->mapbase = devm_ioremap_nocache(&pdev->dev, res->start, + resource_size(res)); if (p->mapbase == NULL) { dev_err(&pdev->dev, "failed to remap I/O memory\n"); return -ENXIO; } /* get hold of clock */ - p->clk = clk_get(&pdev->dev, NULL); + p->clk = devm_clk_get(&pdev->dev, NULL); if (IS_ERR(p->clk)) { dev_err(&pdev->dev, "cannot get clock\n"); - ret = PTR_ERR(p->clk); - goto err0; + return PTR_ERR(p->clk); } p->pdev = pdev; @@ -293,7 +293,7 @@ static int __devinit r_tpu_probe(struct platform_device *pdev) p->ldev.flags |= LED_CORE_SUSPENDRESUME; ret = led_classdev_register(&pdev->dev, &p->ldev); if (ret < 0) - goto err1; + goto err0; /* max_brightness may be updated by the LED core code */ p->min_rate = p->ldev.max_brightness * p->refresh_rate; @@ -301,11 +301,8 @@ static int __devinit r_tpu_probe(struct platform_device *pdev) pm_runtime_enable(&pdev->dev); return 0; - err1: - r_tpu_set_pin(p, R_TPU_PIN_UNUSED, LED_OFF); - clk_put(p->clk); err0: - iounmap(p->mapbase); + r_tpu_set_pin(p, R_TPU_PIN_UNUSED, LED_OFF); return ret; } @@ -320,9 +317,7 @@ static int __devexit r_tpu_remove(struct platform_device *pdev) r_tpu_set_pin(p, R_TPU_PIN_UNUSED, LED_OFF); pm_runtime_disable(&pdev->dev); - clk_put(p->clk); - iounmap(p->mapbase); return 0; } -- cgit v1.2.3 From df07cf81268192e42c4cdf91f5f4bf9aaac1b2f0 Mon Sep 17 00:00:00 2001 From: Bill Pemberton Date: Mon, 19 Nov 2012 13:20:20 -0500 Subject: leds: remove use of __devexit_p CONFIG_HOTPLUG is going away as an option so __devexit_p is no longer needed. Signed-off-by: Bill Pemberton Cc: Richard Purdie Cc: Jan-Simon Moeller Acked-by: Bryan Wu Signed-off-by: Greg Kroah-Hartman --- drivers/leds/leds-renesas-tpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/leds/leds-renesas-tpu.c') diff --git a/drivers/leds/leds-renesas-tpu.c b/drivers/leds/leds-renesas-tpu.c index 771ea067e680..71cab56a67aa 100644 --- a/drivers/leds/leds-renesas-tpu.c +++ b/drivers/leds/leds-renesas-tpu.c @@ -328,7 +328,7 @@ static int __devexit r_tpu_remove(struct platform_device *pdev) static struct platform_driver r_tpu_device_driver = { .probe = r_tpu_probe, - .remove = __devexit_p(r_tpu_remove), + .remove = r_tpu_remove, .driver = { .name = "leds-renesas-tpu", } -- cgit v1.2.3 From 98ea1ea20cb7090d5ae2003c23fc8a7f14fca4c7 Mon Sep 17 00:00:00 2001 From: Bill Pemberton Date: Mon, 19 Nov 2012 13:23:02 -0500 Subject: leds: remove use of __devinit CONFIG_HOTPLUG is going away as an option so __devinit is no longer needed. Signed-off-by: Bill Pemberton Cc: Richard Purdie Cc: Jan-Simon Moeller Acked-by: Bryan Wu Signed-off-by: Greg Kroah-Hartman --- drivers/leds/leds-renesas-tpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/leds/leds-renesas-tpu.c') diff --git a/drivers/leds/leds-renesas-tpu.c b/drivers/leds/leds-renesas-tpu.c index 71cab56a67aa..053e45763f3c 100644 --- a/drivers/leds/leds-renesas-tpu.c +++ b/drivers/leds/leds-renesas-tpu.c @@ -238,7 +238,7 @@ static void r_tpu_set_brightness(struct led_classdev *ldev, schedule_work(&p->work); } -static int __devinit r_tpu_probe(struct platform_device *pdev) +static int r_tpu_probe(struct platform_device *pdev) { struct led_renesas_tpu_config *cfg = pdev->dev.platform_data; struct r_tpu_priv *p; -- cgit v1.2.3 From 678e8a6be911dd8684b894687ae88ff3b0ae4659 Mon Sep 17 00:00:00 2001 From: Bill Pemberton Date: Mon, 19 Nov 2012 13:26:00 -0500 Subject: leds: remove use of __devexit CONFIG_HOTPLUG is going away as an option so __devexit is no longer needed. Signed-off-by: Bill Pemberton Cc: Richard Purdie Cc: Jan-Simon Moeller Acked-by: Bryan Wu Signed-off-by: Greg Kroah-Hartman --- drivers/leds/leds-renesas-tpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/leds/leds-renesas-tpu.c') diff --git a/drivers/leds/leds-renesas-tpu.c b/drivers/leds/leds-renesas-tpu.c index 053e45763f3c..bc8984795a3e 100644 --- a/drivers/leds/leds-renesas-tpu.c +++ b/drivers/leds/leds-renesas-tpu.c @@ -309,7 +309,7 @@ static int r_tpu_probe(struct platform_device *pdev) return ret; } -static int __devexit r_tpu_remove(struct platform_device *pdev) +static int r_tpu_remove(struct platform_device *pdev) { struct r_tpu_priv *p = platform_get_drvdata(pdev); -- cgit v1.2.3