* [PATCH 1/1] video: exynos: Use devm_* APIs in s6e8ax0.c
@ 2012-12-12 5:23 Sachin Kamat
2012-12-17 0:36 ` Donghwa Lee
2013-01-17 3:15 ` Sachin Kamat
0 siblings, 2 replies; 3+ messages in thread
From: Sachin Kamat @ 2012-12-12 5:23 UTC (permalink / raw)
To: linux-fbdev
devm_* APIs are device managed and make error handling
and code cleanup simpler.
Cc: Donghwa Lee <dh09.lee@samsung.com>
Cc: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
---
Compile tested against linux-next.
---
drivers/video/exynos/s6e8ax0.c | 14 ++++----------
1 files changed, 4 insertions(+), 10 deletions(-)
diff --git a/drivers/video/exynos/s6e8ax0.c b/drivers/video/exynos/s6e8ax0.c
index 05d080b..ca26024 100644
--- a/drivers/video/exynos/s6e8ax0.c
+++ b/drivers/video/exynos/s6e8ax0.c
@@ -776,7 +776,7 @@ static int s6e8ax0_probe(struct mipi_dsim_lcd_device *dsim_dev)
int ret;
u8 mtp_id[3] = {0, };
- lcd = kzalloc(sizeof(struct s6e8ax0), GFP_KERNEL);
+ lcd = devm_kzalloc(&dsim_dev->dev, sizeof(struct s6e8ax0), GFP_KERNEL);
if (!lcd) {
dev_err(&dsim_dev->dev, "failed to allocate s6e8ax0 structure.\n");
return -ENOMEM;
@@ -788,18 +788,17 @@ static int s6e8ax0_probe(struct mipi_dsim_lcd_device *dsim_dev)
mutex_init(&lcd->lock);
- ret = regulator_bulk_get(lcd->dev, ARRAY_SIZE(supplies), supplies);
+ ret = devm_regulator_bulk_get(lcd->dev, ARRAY_SIZE(supplies), supplies);
if (ret) {
dev_err(lcd->dev, "Failed to get regulators: %d\n", ret);
- goto err_lcd_register;
+ return ret;
}
lcd->ld = lcd_device_register("s6e8ax0", lcd->dev, lcd,
&s6e8ax0_lcd_ops);
if (IS_ERR(lcd->ld)) {
dev_err(lcd->dev, "failed to register lcd ops.\n");
- ret = PTR_ERR(lcd->ld);
- goto err_lcd_register;
+ return PTR_ERR(lcd->ld);
}
lcd->bd = backlight_device_register("s6e8ax0-bl", lcd->dev, lcd,
@@ -838,11 +837,6 @@ static int s6e8ax0_probe(struct mipi_dsim_lcd_device *dsim_dev)
err_backlight_register:
lcd_device_unregister(lcd->ld);
-
-err_lcd_register:
- regulator_bulk_free(ARRAY_SIZE(supplies), supplies);
- kfree(lcd);
-
return ret;
}
--
1.7.4.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 1/1] video: exynos: Use devm_* APIs in s6e8ax0.c
2012-12-12 5:23 [PATCH 1/1] video: exynos: Use devm_* APIs in s6e8ax0.c Sachin Kamat
@ 2012-12-17 0:36 ` Donghwa Lee
2013-01-17 3:15 ` Sachin Kamat
1 sibling, 0 replies; 3+ messages in thread
From: Donghwa Lee @ 2012-12-17 0:36 UTC (permalink / raw)
To: linux-fbdev
On Wed, Dec 12, 2012 at 14:11, Sachin Kamat wrote:
> devm_* APIs are device managed and make error handling
> and code cleanup simpler.
>
> Cc: Donghwa Lee <dh09.lee@samsung.com>
> Cc: Inki Dae <inki.dae@samsung.com>
> Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
> ---
> Compile tested against linux-next.
> ---
> drivers/video/exynos/s6e8ax0.c | 14 ++++----------
> 1 files changed, 4 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/video/exynos/s6e8ax0.c b/drivers/video/exynos/s6e8ax0.c
> index 05d080b..ca26024 100644
> --- a/drivers/video/exynos/s6e8ax0.c
> +++ b/drivers/video/exynos/s6e8ax0.c
> @@ -776,7 +776,7 @@ static int s6e8ax0_probe(struct mipi_dsim_lcd_device *dsim_dev)
> int ret;
> u8 mtp_id[3] = {0, };
>
> - lcd = kzalloc(sizeof(struct s6e8ax0), GFP_KERNEL);
> + lcd = devm_kzalloc(&dsim_dev->dev, sizeof(struct s6e8ax0), GFP_KERNEL);
> if (!lcd) {
> dev_err(&dsim_dev->dev, "failed to allocate s6e8ax0 structure.\n");
> return -ENOMEM;
> @@ -788,18 +788,17 @@ static int s6e8ax0_probe(struct mipi_dsim_lcd_device *dsim_dev)
>
> mutex_init(&lcd->lock);
>
> - ret = regulator_bulk_get(lcd->dev, ARRAY_SIZE(supplies), supplies);
> + ret = devm_regulator_bulk_get(lcd->dev, ARRAY_SIZE(supplies), supplies);
> if (ret) {
> dev_err(lcd->dev, "Failed to get regulators: %d\n", ret);
> - goto err_lcd_register;
> + return ret;
> }
>
> lcd->ld = lcd_device_register("s6e8ax0", lcd->dev, lcd,
> &s6e8ax0_lcd_ops);
> if (IS_ERR(lcd->ld)) {
> dev_err(lcd->dev, "failed to register lcd ops.\n");
> - ret = PTR_ERR(lcd->ld);
> - goto err_lcd_register;
> + return PTR_ERR(lcd->ld);
> }
>
> lcd->bd = backlight_device_register("s6e8ax0-bl", lcd->dev, lcd,
> @@ -838,11 +837,6 @@ static int s6e8ax0_probe(struct mipi_dsim_lcd_device *dsim_dev)
>
> err_backlight_register:
> lcd_device_unregister(lcd->ld);
> -
> -err_lcd_register:
> - regulator_bulk_free(ARRAY_SIZE(supplies), supplies);
> - kfree(lcd);
> -
> return ret;
> }
>
It looks good to me.
Acked-by: Donghwa Lee <dh09.lee@samsung.com>
Thank you,
Donghwa Lee
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 1/1] video: exynos: Use devm_* APIs in s6e8ax0.c
2012-12-12 5:23 [PATCH 1/1] video: exynos: Use devm_* APIs in s6e8ax0.c Sachin Kamat
2012-12-17 0:36 ` Donghwa Lee
@ 2013-01-17 3:15 ` Sachin Kamat
1 sibling, 0 replies; 3+ messages in thread
From: Sachin Kamat @ 2013-01-17 3:15 UTC (permalink / raw)
To: linux-fbdev
Hi Florian,
On 17 December 2012 06:06, Donghwa Lee <dh09.lee@samsung.com> wrote:
> On Wed, Dec 12, 2012 at 14:11, Sachin Kamat wrote:
>>
>> devm_* APIs are device managed and make error handling
>> and code cleanup simpler.
>>
>> Cc: Donghwa Lee <dh09.lee@samsung.com>
>> Cc: Inki Dae <inki.dae@samsung.com>
>> Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
>> ---
>> Compile tested against linux-next.
>> ---
>> drivers/video/exynos/s6e8ax0.c | 14 ++++----------
>> 1 files changed, 4 insertions(+), 10 deletions(-)
>>
>
> It looks good to me.
> Acked-by: Donghwa Lee <dh09.lee@samsung.com>
Can you please add this patch to to your tree if it looks OK?
--
With warm regards,
Sachin
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-01-17 3:15 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-12-12 5:23 [PATCH 1/1] video: exynos: Use devm_* APIs in s6e8ax0.c Sachin Kamat
2012-12-17 0:36 ` Donghwa Lee
2013-01-17 3:15 ` Sachin Kamat
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.