aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/backlight/atmel-pwm-bl.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-07-30 20:25:34 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-07-30 20:25:34 -0400
commit27c1ee3f929555b71fa39ec0d81a7e7185de1b16 (patch)
tree42e40bdfe4efac660d650658019391536ce67a42 /drivers/video/backlight/atmel-pwm-bl.c
parent37cd9600a9e20359b0283983c9e3a55d84347168 (diff)
parent086ff4b3a7fb9cdf41e6a5d0ccd99b86d84633a1 (diff)
Merge branch 'akpm' (Andrew's patch-bomb)
Merge Andrew's first set of patches: "Non-MM patches: - lots of misc bits - tree-wide have_clk() cleanups - quite a lot of printk tweaks. I draw your attention to "printk: convert the format for KERN_<LEVEL> to a 2 byte pattern" which looks a bit scary. But afaict it's solid. - backlight updates - lib/ feature work (notably the addition and use of memweight()) - checkpatch updates - rtc updates - nilfs updates - fatfs updates (partial, still waiting for acks) - kdump, proc, fork, IPC, sysctl, taskstats, pps, etc - new fault-injection feature work" * Merge emailed patches from Andrew Morton <akpm@linux-foundation.org>: (128 commits) drivers/misc/lkdtm.c: fix missing allocation failure check lib/scatterlist: do not re-write gfp_flags in __sg_alloc_table() fault-injection: add tool to run command with failslab or fail_page_alloc fault-injection: add selftests for cpu and memory hotplug powerpc: pSeries reconfig notifier error injection module memory: memory notifier error injection module PM: PM notifier error injection module cpu: rewrite cpu-notifier-error-inject module fault-injection: notifier error injection c/r: fcntl: add F_GETOWNER_UIDS option resource: make sure requested range is included in the root range include/linux/aio.h: cpp->C conversions fs: cachefiles: add support for large files in filesystem caching pps: return PTR_ERR on error in device_create taskstats: check nla_reserve() return sysctl: suppress kmemleak messages ipc: use Kconfig options for __ARCH_WANT_[COMPAT_]IPC_PARSE_VERSION ipc: compat: use signed size_t types for msgsnd and msgrcv ipc: allow compat IPC version field parsing if !ARCH_WANT_OLD_COMPAT_IPC ipc: add COMPAT_SHMLBA support ...
Diffstat (limited to 'drivers/video/backlight/atmel-pwm-bl.c')
-rw-r--r--drivers/video/backlight/atmel-pwm-bl.c19
1 files changed, 7 insertions, 12 deletions
diff --git a/drivers/video/backlight/atmel-pwm-bl.c b/drivers/video/backlight/atmel-pwm-bl.c
index 0443a4f7185..df1cbb7ef6c 100644
--- a/drivers/video/backlight/atmel-pwm-bl.c
+++ b/drivers/video/backlight/atmel-pwm-bl.c
@@ -127,7 +127,8 @@ static int atmel_pwm_bl_probe(struct platform_device *pdev)
127 struct atmel_pwm_bl *pwmbl; 127 struct atmel_pwm_bl *pwmbl;
128 int retval; 128 int retval;
129 129
130 pwmbl = kzalloc(sizeof(struct atmel_pwm_bl), GFP_KERNEL); 130 pwmbl = devm_kzalloc(&pdev->dev, sizeof(struct atmel_pwm_bl),
131 GFP_KERNEL);
131 if (!pwmbl) 132 if (!pwmbl)
132 return -ENOMEM; 133 return -ENOMEM;
133 134
@@ -154,7 +155,8 @@ static int atmel_pwm_bl_probe(struct platform_device *pdev)
154 goto err_free_mem; 155 goto err_free_mem;
155 156
156 if (pwmbl->gpio_on != -1) { 157 if (pwmbl->gpio_on != -1) {
157 retval = gpio_request(pwmbl->gpio_on, "gpio_atmel_pwm_bl"); 158 retval = devm_gpio_request(&pdev->dev, pwmbl->gpio_on,
159 "gpio_atmel_pwm_bl");
158 if (retval) { 160 if (retval) {
159 pwmbl->gpio_on = -1; 161 pwmbl->gpio_on = -1;
160 goto err_free_pwm; 162 goto err_free_pwm;
@@ -164,7 +166,7 @@ static int atmel_pwm_bl_probe(struct platform_device *pdev)
164 retval = gpio_direction_output(pwmbl->gpio_on, 166 retval = gpio_direction_output(pwmbl->gpio_on,
165 0 ^ pdata->on_active_low); 167 0 ^ pdata->on_active_low);
166 if (retval) 168 if (retval)
167 goto err_free_gpio; 169 goto err_free_pwm;
168 } 170 }
169 171
170 memset(&props, 0, sizeof(struct backlight_properties)); 172 memset(&props, 0, sizeof(struct backlight_properties));
@@ -174,7 +176,7 @@ static int atmel_pwm_bl_probe(struct platform_device *pdev)
174 &atmel_pwm_bl_ops, &props); 176 &atmel_pwm_bl_ops, &props);
175 if (IS_ERR(bldev)) { 177 if (IS_ERR(bldev)) {
176 retval = PTR_ERR(bldev); 178 retval = PTR_ERR(bldev);
177 goto err_free_gpio; 179 goto err_free_pwm;
178 } 180 }
179 181
180 pwmbl->bldev = bldev; 182 pwmbl->bldev = bldev;
@@ -196,13 +198,9 @@ static int atmel_pwm_bl_probe(struct platform_device *pdev)
196err_free_bl_dev: 198err_free_bl_dev:
197 platform_set_drvdata(pdev, NULL); 199 platform_set_drvdata(pdev, NULL);
198 backlight_device_unregister(bldev); 200 backlight_device_unregister(bldev);
199err_free_gpio:
200 if (pwmbl->gpio_on != -1)
201 gpio_free(pwmbl->gpio_on);
202err_free_pwm: 201err_free_pwm:
203 pwm_channel_free(&pwmbl->pwmc); 202 pwm_channel_free(&pwmbl->pwmc);
204err_free_mem: 203err_free_mem:
205 kfree(pwmbl);
206 return retval; 204 return retval;
207} 205}
208 206
@@ -210,15 +208,12 @@ static int __exit atmel_pwm_bl_remove(struct platform_device *pdev)
210{ 208{
211 struct atmel_pwm_bl *pwmbl = platform_get_drvdata(pdev); 209 struct atmel_pwm_bl *pwmbl = platform_get_drvdata(pdev);
212 210
213 if (pwmbl->gpio_on != -1) { 211 if (pwmbl->gpio_on != -1)
214 gpio_set_value(pwmbl->gpio_on, 0); 212 gpio_set_value(pwmbl->gpio_on, 0);
215 gpio_free(pwmbl->gpio_on);
216 }
217 pwm_channel_disable(&pwmbl->pwmc); 213 pwm_channel_disable(&pwmbl->pwmc);
218 pwm_channel_free(&pwmbl->pwmc); 214 pwm_channel_free(&pwmbl->pwmc);
219 backlight_device_unregister(pwmbl->bldev); 215 backlight_device_unregister(pwmbl->bldev);
220 platform_set_drvdata(pdev, NULL); 216 platform_set_drvdata(pdev, NULL);
221 kfree(pwmbl);
222 217
223 return 0; 218 return 0;
224} 219}