diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-05-29 21:05:31 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-05-29 21:05:31 -0400 |
commit | 7d36014b972a3833b883a7ef41e6bd3b0d187850 (patch) | |
tree | 5c828b0de1cd357288135cc04461d31386b89c26 /drivers/video/backlight | |
parent | 442a9ffabb21f175027e93e72ea05159818271a6 (diff) | |
parent | ecb41a77411358d385e3fde5b4e98a5f3d9cfdd5 (diff) |
Merge branch 'akpm' (Andrew's patch-bomb)
Merge patches through Andrew Morton:
"180 patches - err 181 - listed below:
- most of MM. I held back the (large) "memcg: add hugetlb extension"
series because a bunfight has recently broken out.
- leds. After this, Bryan Wu will be handling drivers/leds/
- backlight
- lib/
- rtc"
* emailed from Andrew Morton <akpm@linux-foundation.org>: (181 patches)
drivers/rtc/rtc-s3c.c: fix compiler warning
drivers/rtc/rtc-tegra.c: clean up probe/remove routines
drivers/rtc/rtc-pl031.c: remove RTC timer interrupt handling
drivers/rtc/rtc-lpc32xx.c: add device tree support
drivers/rtc/rtc-m41t93.c: don't let get_time() reset M41T93_FLAG_OF
rtc: ds1307: add trickle charger support
rtc: ds1307: remove superfluous initialization
rtc: rename CONFIG_RTC_MXC to CONFIG_RTC_DRV_MXC
drivers/rtc/Kconfig: place RTC_DRV_IMXDI and RTC_MXC under "on-CPU RTC drivers"
drivers/rtc/rtc-pcf8563.c: add RTC_VL_READ/RTC_VL_CLR ioctl feature
rtc: add ioctl to get/clear battery low voltage status
drivers/rtc/rtc-ep93xx.c: convert to use module_platform_driver()
rtc/spear: add Device Tree probing capability
lib/vsprintf.c: "%#o",0 becomes '0' instead of '00'
radix-tree: fix preload vector size
spinlock_debug: print kallsyms name for lock
vsprintf: fix %ps on non symbols when using kallsyms
lib/bitmap.c: fix documentation for scnprintf() functions
lib/string_helpers.c: make arrays static
lib/test-kstrtox.c: mark const init data with __initconst instead of __initdata
...
Diffstat (limited to 'drivers/video/backlight')
29 files changed, 580 insertions, 186 deletions
diff --git a/drivers/video/backlight/Kconfig b/drivers/video/backlight/Kconfig index af16884491ed..fa2b03750316 100644 --- a/drivers/video/backlight/Kconfig +++ b/drivers/video/backlight/Kconfig | |||
@@ -184,6 +184,18 @@ config BACKLIGHT_GENERIC | |||
184 | known as the Corgi backlight driver. If you have a Sharp Zaurus | 184 | known as the Corgi backlight driver. If you have a Sharp Zaurus |
185 | SL-C7xx, SL-Cxx00 or SL-6000x say y. | 185 | SL-C7xx, SL-Cxx00 or SL-6000x say y. |
186 | 186 | ||
187 | config BACKLIGHT_LM3533 | ||
188 | tristate "Backlight Driver for LM3533" | ||
189 | depends on BACKLIGHT_CLASS_DEVICE | ||
190 | depends on MFD_LM3533 | ||
191 | help | ||
192 | Say Y to enable the backlight driver for National Semiconductor / TI | ||
193 | LM3533 Lighting Power chips. | ||
194 | |||
195 | The backlights can be controlled directly, through PWM input, or by | ||
196 | the ambient-light-sensor interface. The chip supports 256 brightness | ||
197 | levels. | ||
198 | |||
187 | config BACKLIGHT_LOCOMO | 199 | config BACKLIGHT_LOCOMO |
188 | tristate "Sharp LOCOMO LCD/Backlight Driver" | 200 | tristate "Sharp LOCOMO LCD/Backlight Driver" |
189 | depends on SHARP_LOCOMO | 201 | depends on SHARP_LOCOMO |
diff --git a/drivers/video/backlight/Makefile b/drivers/video/backlight/Makefile index 36855ae887d6..a2ac9cfbaf6b 100644 --- a/drivers/video/backlight/Makefile +++ b/drivers/video/backlight/Makefile | |||
@@ -21,6 +21,7 @@ obj-$(CONFIG_BACKLIGHT_EP93XX) += ep93xx_bl.o | |||
21 | obj-$(CONFIG_BACKLIGHT_GENERIC) += generic_bl.o | 21 | obj-$(CONFIG_BACKLIGHT_GENERIC) += generic_bl.o |
22 | obj-$(CONFIG_BACKLIGHT_HP700) += jornada720_bl.o | 22 | obj-$(CONFIG_BACKLIGHT_HP700) += jornada720_bl.o |
23 | obj-$(CONFIG_BACKLIGHT_HP680) += hp680_bl.o | 23 | obj-$(CONFIG_BACKLIGHT_HP680) += hp680_bl.o |
24 | obj-$(CONFIG_BACKLIGHT_LM3533) += lm3533_bl.o | ||
24 | obj-$(CONFIG_BACKLIGHT_LOCOMO) += locomolcd.o | 25 | obj-$(CONFIG_BACKLIGHT_LOCOMO) += locomolcd.o |
25 | obj-$(CONFIG_BACKLIGHT_LP855X) += lp855x_bl.o | 26 | obj-$(CONFIG_BACKLIGHT_LP855X) += lp855x_bl.o |
26 | obj-$(CONFIG_BACKLIGHT_OMAP1) += omap1_bl.o | 27 | obj-$(CONFIG_BACKLIGHT_OMAP1) += omap1_bl.o |
diff --git a/drivers/video/backlight/adp5520_bl.c b/drivers/video/backlight/adp5520_bl.c index 4911ea7989c8..df5db99af23d 100644 --- a/drivers/video/backlight/adp5520_bl.c +++ b/drivers/video/backlight/adp5520_bl.c | |||
@@ -160,7 +160,7 @@ static ssize_t adp5520_store(struct device *dev, const char *buf, | |||
160 | unsigned long val; | 160 | unsigned long val; |
161 | int ret; | 161 | int ret; |
162 | 162 | ||
163 | ret = strict_strtoul(buf, 10, &val); | 163 | ret = kstrtoul(buf, 10, &val); |
164 | if (ret) | 164 | if (ret) |
165 | return ret; | 165 | return ret; |
166 | 166 | ||
@@ -214,7 +214,7 @@ static ssize_t adp5520_bl_daylight_max_store(struct device *dev, | |||
214 | struct adp5520_bl *data = dev_get_drvdata(dev); | 214 | struct adp5520_bl *data = dev_get_drvdata(dev); |
215 | int ret; | 215 | int ret; |
216 | 216 | ||
217 | ret = strict_strtoul(buf, 10, &data->cached_daylight_max); | 217 | ret = kstrtoul(buf, 10, &data->cached_daylight_max); |
218 | if (ret < 0) | 218 | if (ret < 0) |
219 | return ret; | 219 | return ret; |
220 | 220 | ||
diff --git a/drivers/video/backlight/adp8860_bl.c b/drivers/video/backlight/adp8860_bl.c index 550dbf0bb896..77d1fdba597f 100644 --- a/drivers/video/backlight/adp8860_bl.c +++ b/drivers/video/backlight/adp8860_bl.c | |||
@@ -222,7 +222,8 @@ static int __devinit adp8860_led_probe(struct i2c_client *client) | |||
222 | struct led_info *cur_led; | 222 | struct led_info *cur_led; |
223 | int ret, i; | 223 | int ret, i; |
224 | 224 | ||
225 | led = kzalloc(sizeof(*led) * pdata->num_leds, GFP_KERNEL); | 225 | led = devm_kzalloc(&client->dev, sizeof(*led) * pdata->num_leds, |
226 | GFP_KERNEL); | ||
226 | if (led == NULL) { | 227 | if (led == NULL) { |
227 | dev_err(&client->dev, "failed to alloc memory\n"); | 228 | dev_err(&client->dev, "failed to alloc memory\n"); |
228 | return -ENOMEM; | 229 | return -ENOMEM; |
@@ -236,7 +237,7 @@ static int __devinit adp8860_led_probe(struct i2c_client *client) | |||
236 | 237 | ||
237 | if (ret) { | 238 | if (ret) { |
238 | dev_err(&client->dev, "failed to write\n"); | 239 | dev_err(&client->dev, "failed to write\n"); |
239 | goto err_free; | 240 | return ret; |
240 | } | 241 | } |
241 | 242 | ||
242 | for (i = 0; i < pdata->num_leds; ++i) { | 243 | for (i = 0; i < pdata->num_leds; ++i) { |
@@ -291,9 +292,6 @@ static int __devinit adp8860_led_probe(struct i2c_client *client) | |||
291 | cancel_work_sync(&led[i].work); | 292 | cancel_work_sync(&led[i].work); |
292 | } | 293 | } |
293 | 294 | ||
294 | err_free: | ||
295 | kfree(led); | ||
296 | |||
297 | return ret; | 295 | return ret; |
298 | } | 296 | } |
299 | 297 | ||
@@ -309,7 +307,6 @@ static int __devexit adp8860_led_remove(struct i2c_client *client) | |||
309 | cancel_work_sync(&data->led[i].work); | 307 | cancel_work_sync(&data->led[i].work); |
310 | } | 308 | } |
311 | 309 | ||
312 | kfree(data->led); | ||
313 | return 0; | 310 | return 0; |
314 | } | 311 | } |
315 | #else | 312 | #else |
@@ -451,7 +448,7 @@ static ssize_t adp8860_store(struct device *dev, const char *buf, | |||
451 | unsigned long val; | 448 | unsigned long val; |
452 | int ret; | 449 | int ret; |
453 | 450 | ||
454 | ret = strict_strtoul(buf, 10, &val); | 451 | ret = kstrtoul(buf, 10, &val); |
455 | if (ret) | 452 | if (ret) |
456 | return ret; | 453 | return ret; |
457 | 454 | ||
@@ -501,7 +498,7 @@ static ssize_t adp8860_bl_l1_daylight_max_store(struct device *dev, | |||
501 | struct device_attribute *attr, const char *buf, size_t count) | 498 | struct device_attribute *attr, const char *buf, size_t count) |
502 | { | 499 | { |
503 | struct adp8860_bl *data = dev_get_drvdata(dev); | 500 | struct adp8860_bl *data = dev_get_drvdata(dev); |
504 | int ret = strict_strtoul(buf, 10, &data->cached_daylight_max); | 501 | int ret = kstrtoul(buf, 10, &data->cached_daylight_max); |
505 | if (ret) | 502 | if (ret) |
506 | return ret; | 503 | return ret; |
507 | 504 | ||
@@ -608,7 +605,7 @@ static ssize_t adp8860_bl_ambient_light_zone_store(struct device *dev, | |||
608 | uint8_t reg_val; | 605 | uint8_t reg_val; |
609 | int ret; | 606 | int ret; |
610 | 607 | ||
611 | ret = strict_strtoul(buf, 10, &val); | 608 | ret = kstrtoul(buf, 10, &val); |
612 | if (ret) | 609 | if (ret) |
613 | return ret; | 610 | return ret; |
614 | 611 | ||
@@ -675,13 +672,13 @@ static int __devinit adp8860_probe(struct i2c_client *client, | |||
675 | return -EINVAL; | 672 | return -EINVAL; |
676 | } | 673 | } |
677 | 674 | ||
678 | data = kzalloc(sizeof(*data), GFP_KERNEL); | 675 | data = devm_kzalloc(&client->dev, sizeof(*data), GFP_KERNEL); |
679 | if (data == NULL) | 676 | if (data == NULL) |
680 | return -ENOMEM; | 677 | return -ENOMEM; |
681 | 678 | ||
682 | ret = adp8860_read(client, ADP8860_MFDVID, ®_val); | 679 | ret = adp8860_read(client, ADP8860_MFDVID, ®_val); |
683 | if (ret < 0) | 680 | if (ret < 0) |
684 | goto out2; | 681 | return ret; |
685 | 682 | ||
686 | switch (ADP8860_MANID(reg_val)) { | 683 | switch (ADP8860_MANID(reg_val)) { |
687 | case ADP8863_MANUFID: | 684 | case ADP8863_MANUFID: |
@@ -694,8 +691,7 @@ static int __devinit adp8860_probe(struct i2c_client *client, | |||
694 | break; | 691 | break; |
695 | default: | 692 | default: |
696 | dev_err(&client->dev, "failed to probe\n"); | 693 | dev_err(&client->dev, "failed to probe\n"); |
697 | ret = -ENODEV; | 694 | return -ENODEV; |
698 | goto out2; | ||
699 | } | 695 | } |
700 | 696 | ||
701 | /* It's confirmed that the DEVID field is actually a REVID */ | 697 | /* It's confirmed that the DEVID field is actually a REVID */ |
@@ -717,8 +713,7 @@ static int __devinit adp8860_probe(struct i2c_client *client, | |||
717 | &client->dev, data, &adp8860_bl_ops, &props); | 713 | &client->dev, data, &adp8860_bl_ops, &props); |
718 | if (IS_ERR(bl)) { | 714 | if (IS_ERR(bl)) { |
719 | dev_err(&client->dev, "failed to register backlight\n"); | 715 | dev_err(&client->dev, "failed to register backlight\n"); |
720 | ret = PTR_ERR(bl); | 716 | return PTR_ERR(bl); |
721 | goto out2; | ||
722 | } | 717 | } |
723 | 718 | ||
724 | bl->props.brightness = ADP8860_MAX_BRIGHTNESS; | 719 | bl->props.brightness = ADP8860_MAX_BRIGHTNESS; |
@@ -756,8 +751,6 @@ out: | |||
756 | &adp8860_bl_attr_group); | 751 | &adp8860_bl_attr_group); |
757 | out1: | 752 | out1: |
758 | backlight_device_unregister(bl); | 753 | backlight_device_unregister(bl); |
759 | out2: | ||
760 | kfree(data); | ||
761 | 754 | ||
762 | return ret; | 755 | return ret; |
763 | } | 756 | } |
@@ -776,7 +769,6 @@ static int __devexit adp8860_remove(struct i2c_client *client) | |||
776 | &adp8860_bl_attr_group); | 769 | &adp8860_bl_attr_group); |
777 | 770 | ||
778 | backlight_device_unregister(data->bl); | 771 | backlight_device_unregister(data->bl); |
779 | kfree(data); | ||
780 | 772 | ||
781 | return 0; | 773 | return 0; |
782 | } | 774 | } |
diff --git a/drivers/video/backlight/adp8870_bl.c b/drivers/video/backlight/adp8870_bl.c index 9be58c6f18f1..edf7f91c8e61 100644 --- a/drivers/video/backlight/adp8870_bl.c +++ b/drivers/video/backlight/adp8870_bl.c | |||
@@ -244,8 +244,8 @@ static int __devinit adp8870_led_probe(struct i2c_client *client) | |||
244 | struct led_info *cur_led; | 244 | struct led_info *cur_led; |
245 | int ret, i; | 245 | int ret, i; |
246 | 246 | ||
247 | 247 | led = devm_kzalloc(&client->dev, pdata->num_leds * sizeof(*led), | |
248 | led = kcalloc(pdata->num_leds, sizeof(*led), GFP_KERNEL); | 248 | GFP_KERNEL); |
249 | if (led == NULL) { | 249 | if (led == NULL) { |
250 | dev_err(&client->dev, "failed to alloc memory\n"); | 250 | dev_err(&client->dev, "failed to alloc memory\n"); |
251 | return -ENOMEM; | 251 | return -ENOMEM; |
@@ -253,17 +253,17 @@ static int __devinit adp8870_led_probe(struct i2c_client *client) | |||
253 | 253 | ||
254 | ret = adp8870_write(client, ADP8870_ISCLAW, pdata->led_fade_law); | 254 | ret = adp8870_write(client, ADP8870_ISCLAW, pdata->led_fade_law); |
255 | if (ret) | 255 | if (ret) |
256 | goto err_free; | 256 | return ret; |
257 | 257 | ||
258 | ret = adp8870_write(client, ADP8870_ISCT1, | 258 | ret = adp8870_write(client, ADP8870_ISCT1, |
259 | (pdata->led_on_time & 0x3) << 6); | 259 | (pdata->led_on_time & 0x3) << 6); |
260 | if (ret) | 260 | if (ret) |
261 | goto err_free; | 261 | return ret; |
262 | 262 | ||
263 | ret = adp8870_write(client, ADP8870_ISCF, | 263 | ret = adp8870_write(client, ADP8870_ISCF, |
264 | FADE_VAL(pdata->led_fade_in, pdata->led_fade_out)); | 264 | FADE_VAL(pdata->led_fade_in, pdata->led_fade_out)); |
265 | if (ret) | 265 | if (ret) |
266 | goto err_free; | 266 | return ret; |
267 | 267 | ||
268 | for (i = 0; i < pdata->num_leds; ++i) { | 268 | for (i = 0; i < pdata->num_leds; ++i) { |
269 | cur_led = &pdata->leds[i]; | 269 | cur_led = &pdata->leds[i]; |
@@ -317,9 +317,6 @@ static int __devinit adp8870_led_probe(struct i2c_client *client) | |||
317 | cancel_work_sync(&led[i].work); | 317 | cancel_work_sync(&led[i].work); |
318 | } | 318 | } |
319 | 319 | ||
320 | err_free: | ||
321 | kfree(led); | ||
322 | |||
323 | return ret; | 320 | return ret; |
324 | } | 321 | } |
325 | 322 | ||
@@ -335,7 +332,6 @@ static int __devexit adp8870_led_remove(struct i2c_client *client) | |||
335 | cancel_work_sync(&data->led[i].work); | 332 | cancel_work_sync(&data->led[i].work); |
336 | } | 333 | } |
337 | 334 | ||
338 | kfree(data->led); | ||
339 | return 0; | 335 | return 0; |
340 | } | 336 | } |
341 | #else | 337 | #else |
@@ -572,7 +568,7 @@ static ssize_t adp8870_store(struct device *dev, const char *buf, | |||
572 | unsigned long val; | 568 | unsigned long val; |
573 | int ret; | 569 | int ret; |
574 | 570 | ||
575 | ret = strict_strtoul(buf, 10, &val); | 571 | ret = kstrtoul(buf, 10, &val); |
576 | if (ret) | 572 | if (ret) |
577 | return ret; | 573 | return ret; |
578 | 574 | ||
@@ -652,7 +648,7 @@ static ssize_t adp8870_bl_l1_daylight_max_store(struct device *dev, | |||
652 | struct device_attribute *attr, const char *buf, size_t count) | 648 | struct device_attribute *attr, const char *buf, size_t count) |
653 | { | 649 | { |
654 | struct adp8870_bl *data = dev_get_drvdata(dev); | 650 | struct adp8870_bl *data = dev_get_drvdata(dev); |
655 | int ret = strict_strtoul(buf, 10, &data->cached_daylight_max); | 651 | int ret = kstrtoul(buf, 10, &data->cached_daylight_max); |
656 | if (ret) | 652 | if (ret) |
657 | return ret; | 653 | return ret; |
658 | 654 | ||
@@ -794,7 +790,7 @@ static ssize_t adp8870_bl_ambient_light_zone_store(struct device *dev, | |||
794 | uint8_t reg_val; | 790 | uint8_t reg_val; |
795 | int ret; | 791 | int ret; |
796 | 792 | ||
797 | ret = strict_strtoul(buf, 10, &val); | 793 | ret = kstrtoul(buf, 10, &val); |
798 | if (ret) | 794 | if (ret) |
799 | return ret; | 795 | return ret; |
800 | 796 | ||
@@ -874,7 +870,7 @@ static int __devinit adp8870_probe(struct i2c_client *client, | |||
874 | return -ENODEV; | 870 | return -ENODEV; |
875 | } | 871 | } |
876 | 872 | ||
877 | data = kzalloc(sizeof(*data), GFP_KERNEL); | 873 | data = devm_kzalloc(&client->dev, sizeof(*data), GFP_KERNEL); |
878 | if (data == NULL) | 874 | if (data == NULL) |
879 | return -ENOMEM; | 875 | return -ENOMEM; |
880 | 876 | ||
@@ -894,8 +890,7 @@ static int __devinit adp8870_probe(struct i2c_client *client, | |||
894 | &client->dev, data, &adp8870_bl_ops, &props); | 890 | &client->dev, data, &adp8870_bl_ops, &props); |
895 | if (IS_ERR(bl)) { | 891 | if (IS_ERR(bl)) { |
896 | dev_err(&client->dev, "failed to register backlight\n"); | 892 | dev_err(&client->dev, "failed to register backlight\n"); |
897 | ret = PTR_ERR(bl); | 893 | return PTR_ERR(bl); |
898 | goto out2; | ||
899 | } | 894 | } |
900 | 895 | ||
901 | data->bl = bl; | 896 | data->bl = bl; |
@@ -930,8 +925,6 @@ out: | |||
930 | &adp8870_bl_attr_group); | 925 | &adp8870_bl_attr_group); |
931 | out1: | 926 | out1: |
932 | backlight_device_unregister(bl); | 927 | backlight_device_unregister(bl); |
933 | out2: | ||
934 | kfree(data); | ||
935 | 928 | ||
936 | return ret; | 929 | return ret; |
937 | } | 930 | } |
@@ -950,7 +943,6 @@ static int __devexit adp8870_remove(struct i2c_client *client) | |||
950 | &adp8870_bl_attr_group); | 943 | &adp8870_bl_attr_group); |
951 | 944 | ||
952 | backlight_device_unregister(data->bl); | 945 | backlight_device_unregister(data->bl); |
953 | kfree(data); | ||
954 | 946 | ||
955 | return 0; | 947 | return 0; |
956 | } | 948 | } |
diff --git a/drivers/video/backlight/ams369fg06.c b/drivers/video/backlight/ams369fg06.c index 7bdadc790117..3729238e7096 100644 --- a/drivers/video/backlight/ams369fg06.c +++ b/drivers/video/backlight/ams369fg06.c | |||
@@ -482,7 +482,7 @@ static int __devinit ams369fg06_probe(struct spi_device *spi) | |||
482 | struct backlight_device *bd = NULL; | 482 | struct backlight_device *bd = NULL; |
483 | struct backlight_properties props; | 483 | struct backlight_properties props; |
484 | 484 | ||
485 | lcd = kzalloc(sizeof(struct ams369fg06), GFP_KERNEL); | 485 | lcd = devm_kzalloc(&spi->dev, sizeof(struct ams369fg06), GFP_KERNEL); |
486 | if (!lcd) | 486 | if (!lcd) |
487 | return -ENOMEM; | 487 | return -ENOMEM; |
488 | 488 | ||
@@ -492,7 +492,7 @@ static int __devinit ams369fg06_probe(struct spi_device *spi) | |||
492 | ret = spi_setup(spi); | 492 | ret = spi_setup(spi); |
493 | if (ret < 0) { | 493 | if (ret < 0) { |
494 | dev_err(&spi->dev, "spi setup failed.\n"); | 494 | dev_err(&spi->dev, "spi setup failed.\n"); |
495 | goto out_free_lcd; | 495 | return ret; |
496 | } | 496 | } |
497 | 497 | ||
498 | lcd->spi = spi; | 498 | lcd->spi = spi; |
@@ -501,15 +501,13 @@ static int __devinit ams369fg06_probe(struct spi_device *spi) | |||
501 | lcd->lcd_pd = spi->dev.platform_data; | 501 | lcd->lcd_pd = spi->dev.platform_data; |
502 | if (!lcd->lcd_pd) { | 502 | if (!lcd->lcd_pd) { |
503 | dev_err(&spi->dev, "platform data is NULL\n"); | 503 | dev_err(&spi->dev, "platform data is NULL\n"); |
504 | goto out_free_lcd; | 504 | return -EFAULT; |
505 | } | 505 | } |
506 | 506 | ||
507 | ld = lcd_device_register("ams369fg06", &spi->dev, lcd, | 507 | ld = lcd_device_register("ams369fg06", &spi->dev, lcd, |
508 | &ams369fg06_lcd_ops); | 508 | &ams369fg06_lcd_ops); |
509 | if (IS_ERR(ld)) { | 509 | if (IS_ERR(ld)) |
510 | ret = PTR_ERR(ld); | 510 | return PTR_ERR(ld); |
511 | goto out_free_lcd; | ||
512 | } | ||
513 | 511 | ||
514 | lcd->ld = ld; | 512 | lcd->ld = ld; |
515 | 513 | ||
@@ -547,8 +545,6 @@ static int __devinit ams369fg06_probe(struct spi_device *spi) | |||
547 | 545 | ||
548 | out_lcd_unregister: | 546 | out_lcd_unregister: |
549 | lcd_device_unregister(ld); | 547 | lcd_device_unregister(ld); |
550 | out_free_lcd: | ||
551 | kfree(lcd); | ||
552 | return ret; | 548 | return ret; |
553 | } | 549 | } |
554 | 550 | ||
@@ -559,7 +555,6 @@ static int __devexit ams369fg06_remove(struct spi_device *spi) | |||
559 | ams369fg06_power(lcd, FB_BLANK_POWERDOWN); | 555 | ams369fg06_power(lcd, FB_BLANK_POWERDOWN); |
560 | backlight_device_unregister(lcd->bd); | 556 | backlight_device_unregister(lcd->bd); |
561 | lcd_device_unregister(lcd->ld); | 557 | lcd_device_unregister(lcd->ld); |
562 | kfree(lcd); | ||
563 | 558 | ||
564 | return 0; | 559 | return 0; |
565 | } | 560 | } |
@@ -619,7 +614,6 @@ static void ams369fg06_shutdown(struct spi_device *spi) | |||
619 | static struct spi_driver ams369fg06_driver = { | 614 | static struct spi_driver ams369fg06_driver = { |
620 | .driver = { | 615 | .driver = { |
621 | .name = "ams369fg06", | 616 | .name = "ams369fg06", |
622 | .bus = &spi_bus_type, | ||
623 | .owner = THIS_MODULE, | 617 | .owner = THIS_MODULE, |
624 | }, | 618 | }, |
625 | .probe = ams369fg06_probe, | 619 | .probe = ams369fg06_probe, |
diff --git a/drivers/video/backlight/apple_bl.c b/drivers/video/backlight/apple_bl.c index a523b255e124..9dc73ac3709a 100644 --- a/drivers/video/backlight/apple_bl.c +++ b/drivers/video/backlight/apple_bl.c | |||
@@ -16,6 +16,8 @@ | |||
16 | * get at the firmware code in order to figure out what it's actually doing. | 16 | * get at the firmware code in order to figure out what it's actually doing. |
17 | */ | 17 | */ |
18 | 18 | ||
19 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
20 | |||
19 | #include <linux/module.h> | 21 | #include <linux/module.h> |
20 | #include <linux/kernel.h> | 22 | #include <linux/kernel.h> |
21 | #include <linux/init.h> | 23 | #include <linux/init.h> |
@@ -25,6 +27,7 @@ | |||
25 | #include <linux/pci.h> | 27 | #include <linux/pci.h> |
26 | #include <linux/acpi.h> | 28 | #include <linux/acpi.h> |
27 | #include <linux/atomic.h> | 29 | #include <linux/atomic.h> |
30 | #include <linux/apple_bl.h> | ||
28 | 31 | ||
29 | static struct backlight_device *apple_backlight_device; | 32 | static struct backlight_device *apple_backlight_device; |
30 | 33 | ||
@@ -39,8 +42,6 @@ struct hw_data { | |||
39 | 42 | ||
40 | static const struct hw_data *hw_data; | 43 | static const struct hw_data *hw_data; |
41 | 44 | ||
42 | #define DRIVER "apple_backlight: " | ||
43 | |||
44 | /* Module parameters. */ | 45 | /* Module parameters. */ |
45 | static int debug; | 46 | static int debug; |
46 | module_param_named(debug, debug, int, 0644); | 47 | module_param_named(debug, debug, int, 0644); |
@@ -60,8 +61,7 @@ static int intel_chipset_send_intensity(struct backlight_device *bd) | |||
60 | int intensity = bd->props.brightness; | 61 | int intensity = bd->props.brightness; |
61 | 62 | ||
62 | if (debug) | 63 | if (debug) |
63 | printk(KERN_DEBUG DRIVER "setting brightness to %d\n", | 64 | pr_debug("setting brightness to %d\n", intensity); |
64 | intensity); | ||
65 | 65 | ||
66 | intel_chipset_set_brightness(intensity); | 66 | intel_chipset_set_brightness(intensity); |
67 | return 0; | 67 | return 0; |
@@ -76,8 +76,7 @@ static int intel_chipset_get_intensity(struct backlight_device *bd) | |||
76 | intensity = inb(0xb3) >> 4; | 76 | intensity = inb(0xb3) >> 4; |
77 | 77 | ||
78 | if (debug) | 78 | if (debug) |
79 | printk(KERN_DEBUG DRIVER "read brightness of %d\n", | 79 | pr_debug("read brightness of %d\n", intensity); |
80 | intensity); | ||
81 | 80 | ||
82 | return intensity; | 81 | return intensity; |
83 | } | 82 | } |
@@ -107,8 +106,7 @@ static int nvidia_chipset_send_intensity(struct backlight_device *bd) | |||
107 | int intensity = bd->props.brightness; | 106 | int intensity = bd->props.brightness; |
108 | 107 | ||
109 | if (debug) | 108 | if (debug) |
110 | printk(KERN_DEBUG DRIVER "setting brightness to %d\n", | 109 | pr_debug("setting brightness to %d\n", intensity); |
111 | intensity); | ||
112 | 110 | ||
113 | nvidia_chipset_set_brightness(intensity); | 111 | nvidia_chipset_set_brightness(intensity); |
114 | return 0; | 112 | return 0; |
@@ -123,8 +121,7 @@ static int nvidia_chipset_get_intensity(struct backlight_device *bd) | |||
123 | intensity = inb(0x52f) >> 4; | 121 | intensity = inb(0x52f) >> 4; |
124 | 122 | ||
125 | if (debug) | 123 | if (debug) |
126 | printk(KERN_DEBUG DRIVER "read brightness of %d\n", | 124 | pr_debug("read brightness of %d\n", intensity); |
127 | intensity); | ||
128 | 125 | ||
129 | return intensity; | 126 | return intensity; |
130 | } | 127 | } |
@@ -149,7 +146,7 @@ static int __devinit apple_bl_add(struct acpi_device *dev) | |||
149 | host = pci_get_bus_and_slot(0, 0); | 146 | host = pci_get_bus_and_slot(0, 0); |
150 | 147 | ||
151 | if (!host) { | 148 | if (!host) { |
152 | printk(KERN_ERR DRIVER "unable to find PCI host\n"); | 149 | pr_err("unable to find PCI host\n"); |
153 | return -ENODEV; | 150 | return -ENODEV; |
154 | } | 151 | } |
155 | 152 | ||
@@ -161,7 +158,7 @@ static int __devinit apple_bl_add(struct acpi_device *dev) | |||
161 | pci_dev_put(host); | 158 | pci_dev_put(host); |
162 | 159 | ||
163 | if (!hw_data) { | 160 | if (!hw_data) { |
164 | printk(KERN_ERR DRIVER "unknown hardware\n"); | 161 | pr_err("unknown hardware\n"); |
165 | return -ENODEV; | 162 | return -ENODEV; |
166 | } | 163 | } |
167 | 164 | ||
diff --git a/drivers/video/backlight/backlight.c b/drivers/video/backlight/backlight.c index bf5b1ece7160..297db2fa91f5 100644 --- a/drivers/video/backlight/backlight.c +++ b/drivers/video/backlight/backlight.c | |||
@@ -5,6 +5,8 @@ | |||
5 | * | 5 | * |
6 | */ | 6 | */ |
7 | 7 | ||
8 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
9 | |||
8 | #include <linux/module.h> | 10 | #include <linux/module.h> |
9 | #include <linux/init.h> | 11 | #include <linux/init.h> |
10 | #include <linux/device.h> | 12 | #include <linux/device.h> |
@@ -123,7 +125,7 @@ static ssize_t backlight_store_power(struct device *dev, | |||
123 | rc = -ENXIO; | 125 | rc = -ENXIO; |
124 | mutex_lock(&bd->ops_lock); | 126 | mutex_lock(&bd->ops_lock); |
125 | if (bd->ops) { | 127 | if (bd->ops) { |
126 | pr_debug("backlight: set power to %lu\n", power); | 128 | pr_debug("set power to %lu\n", power); |
127 | if (bd->props.power != power) { | 129 | if (bd->props.power != power) { |
128 | bd->props.power = power; | 130 | bd->props.power = power; |
129 | backlight_update_status(bd); | 131 | backlight_update_status(bd); |
@@ -161,8 +163,7 @@ static ssize_t backlight_store_brightness(struct device *dev, | |||
161 | if (brightness > bd->props.max_brightness) | 163 | if (brightness > bd->props.max_brightness) |
162 | rc = -EINVAL; | 164 | rc = -EINVAL; |
163 | else { | 165 | else { |
164 | pr_debug("backlight: set brightness to %lu\n", | 166 | pr_debug("set brightness to %lu\n", brightness); |
165 | brightness); | ||
166 | bd->props.brightness = brightness; | 167 | bd->props.brightness = brightness; |
167 | backlight_update_status(bd); | 168 | backlight_update_status(bd); |
168 | rc = count; | 169 | rc = count; |
@@ -378,8 +379,8 @@ static int __init backlight_class_init(void) | |||
378 | { | 379 | { |
379 | backlight_class = class_create(THIS_MODULE, "backlight"); | 380 | backlight_class = class_create(THIS_MODULE, "backlight"); |
380 | if (IS_ERR(backlight_class)) { | 381 | if (IS_ERR(backlight_class)) { |
381 | printk(KERN_WARNING "Unable to create backlight class; errno = %ld\n", | 382 | pr_warn("Unable to create backlight class; errno = %ld\n", |
382 | PTR_ERR(backlight_class)); | 383 | PTR_ERR(backlight_class)); |
383 | return PTR_ERR(backlight_class); | 384 | return PTR_ERR(backlight_class); |
384 | } | 385 | } |
385 | 386 | ||
diff --git a/drivers/video/backlight/corgi_lcd.c b/drivers/video/backlight/corgi_lcd.c index 6dab13fe562e..23d732677ba1 100644 --- a/drivers/video/backlight/corgi_lcd.c +++ b/drivers/video/backlight/corgi_lcd.c | |||
@@ -544,7 +544,7 @@ static int __devinit corgi_lcd_probe(struct spi_device *spi) | |||
544 | return -EINVAL; | 544 | return -EINVAL; |
545 | } | 545 | } |
546 | 546 | ||
547 | lcd = kzalloc(sizeof(struct corgi_lcd), GFP_KERNEL); | 547 | lcd = devm_kzalloc(&spi->dev, sizeof(struct corgi_lcd), GFP_KERNEL); |
548 | if (!lcd) { | 548 | if (!lcd) { |
549 | dev_err(&spi->dev, "failed to allocate memory\n"); | 549 | dev_err(&spi->dev, "failed to allocate memory\n"); |
550 | return -ENOMEM; | 550 | return -ENOMEM; |
@@ -554,10 +554,9 @@ static int __devinit corgi_lcd_probe(struct spi_device *spi) | |||
554 | 554 | ||
555 | lcd->lcd_dev = lcd_device_register("corgi_lcd", &spi->dev, | 555 | lcd->lcd_dev = lcd_device_register("corgi_lcd", &spi->dev, |
556 | lcd, &corgi_lcd_ops); | 556 | lcd, &corgi_lcd_ops); |
557 | if (IS_ERR(lcd->lcd_dev)) { | 557 | if (IS_ERR(lcd->lcd_dev)) |
558 | ret = PTR_ERR(lcd->lcd_dev); | 558 | return PTR_ERR(lcd->lcd_dev); |
559 | goto err_free_lcd; | 559 | |
560 | } | ||
561 | lcd->power = FB_BLANK_POWERDOWN; | 560 | lcd->power = FB_BLANK_POWERDOWN; |
562 | lcd->mode = (pdata) ? pdata->init_mode : CORGI_LCD_MODE_VGA; | 561 | lcd->mode = (pdata) ? pdata->init_mode : CORGI_LCD_MODE_VGA; |
563 | 562 | ||
@@ -591,8 +590,6 @@ err_unregister_bl: | |||
591 | backlight_device_unregister(lcd->bl_dev); | 590 | backlight_device_unregister(lcd->bl_dev); |
592 | err_unregister_lcd: | 591 | err_unregister_lcd: |
593 | lcd_device_unregister(lcd->lcd_dev); | 592 | lcd_device_unregister(lcd->lcd_dev); |
594 | err_free_lcd: | ||
595 | kfree(lcd); | ||
596 | return ret; | 593 | return ret; |
597 | } | 594 | } |
598 | 595 | ||
@@ -613,7 +610,6 @@ static int __devexit corgi_lcd_remove(struct spi_device *spi) | |||
613 | 610 | ||
614 | corgi_lcd_set_power(lcd->lcd_dev, FB_BLANK_POWERDOWN); | 611 | corgi_lcd_set_power(lcd->lcd_dev, FB_BLANK_POWERDOWN); |
615 | lcd_device_unregister(lcd->lcd_dev); | 612 | lcd_device_unregister(lcd->lcd_dev); |
616 | kfree(lcd); | ||
617 | 613 | ||
618 | return 0; | 614 | return 0; |
619 | } | 615 | } |
diff --git a/drivers/video/backlight/cr_bllcd.c b/drivers/video/backlight/cr_bllcd.c index 22489eb5f3e0..37bae801e23b 100644 --- a/drivers/video/backlight/cr_bllcd.c +++ b/drivers/video/backlight/cr_bllcd.c | |||
@@ -27,6 +27,8 @@ | |||
27 | * Alan Hourihane <alanh-at-tungstengraphics-dot-com> | 27 | * Alan Hourihane <alanh-at-tungstengraphics-dot-com> |
28 | */ | 28 | */ |
29 | 29 | ||
30 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
31 | |||
30 | #include <linux/module.h> | 32 | #include <linux/module.h> |
31 | #include <linux/kernel.h> | 33 | #include <linux/kernel.h> |
32 | #include <linux/init.h> | 34 | #include <linux/init.h> |
@@ -180,14 +182,13 @@ static int cr_backlight_probe(struct platform_device *pdev) | |||
180 | lpc_dev = pci_get_device(PCI_VENDOR_ID_INTEL, | 182 | lpc_dev = pci_get_device(PCI_VENDOR_ID_INTEL, |
181 | CRVML_DEVICE_LPC, NULL); | 183 | CRVML_DEVICE_LPC, NULL); |
182 | if (!lpc_dev) { | 184 | if (!lpc_dev) { |
183 | printk("INTEL CARILLO RANCH LPC not found.\n"); | 185 | pr_err("INTEL CARILLO RANCH LPC not found.\n"); |
184 | return -ENODEV; | 186 | return -ENODEV; |
185 | } | 187 | } |
186 | 188 | ||
187 | pci_read_config_byte(lpc_dev, CRVML_REG_GPIOEN, &dev_en); | 189 | pci_read_config_byte(lpc_dev, CRVML_REG_GPIOEN, &dev_en); |
188 | if (!(dev_en & CRVML_GPIOEN_BIT)) { | 190 | if (!(dev_en & CRVML_GPIOEN_BIT)) { |
189 | printk(KERN_ERR | 191 | pr_err("Carillo Ranch GPIO device was not enabled.\n"); |
190 | "Carillo Ranch GPIO device was not enabled.\n"); | ||
191 | pci_dev_put(lpc_dev); | 192 | pci_dev_put(lpc_dev); |
192 | return -ENODEV; | 193 | return -ENODEV; |
193 | } | 194 | } |
@@ -270,7 +271,7 @@ static int __init cr_backlight_init(void) | |||
270 | return PTR_ERR(crp); | 271 | return PTR_ERR(crp); |
271 | } | 272 | } |
272 | 273 | ||
273 | printk("Carillo Ranch Backlight Driver Initialized.\n"); | 274 | pr_info("Carillo Ranch Backlight Driver Initialized.\n"); |
274 | 275 | ||
275 | return 0; | 276 | return 0; |
276 | } | 277 | } |
diff --git a/drivers/video/backlight/da903x_bl.c b/drivers/video/backlight/da903x_bl.c index 30e19681a30b..573c7ece0fde 100644 --- a/drivers/video/backlight/da903x_bl.c +++ b/drivers/video/backlight/da903x_bl.c | |||
@@ -136,6 +136,7 @@ static int da903x_backlight_probe(struct platform_device *pdev) | |||
136 | da903x_write(data->da903x_dev, DA9034_WLED_CONTROL2, | 136 | da903x_write(data->da903x_dev, DA9034_WLED_CONTROL2, |
137 | DA9034_WLED_ISET(pdata->output_current)); | 137 | DA9034_WLED_ISET(pdata->output_current)); |
138 | 138 | ||
139 | memset(&props, 0, sizeof(props)); | ||
139 | props.type = BACKLIGHT_RAW; | 140 | props.type = BACKLIGHT_RAW; |
140 | props.max_brightness = max_brightness; | 141 | props.max_brightness = max_brightness; |
141 | bl = backlight_device_register(pdev->name, data->da903x_dev, data, | 142 | bl = backlight_device_register(pdev->name, data->da903x_dev, data, |
diff --git a/drivers/video/backlight/generic_bl.c b/drivers/video/backlight/generic_bl.c index 9ce6170c1860..8c660fcd250d 100644 --- a/drivers/video/backlight/generic_bl.c +++ b/drivers/video/backlight/generic_bl.c | |||
@@ -9,6 +9,8 @@ | |||
9 | * | 9 | * |
10 | */ | 10 | */ |
11 | 11 | ||
12 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
13 | |||
12 | #include <linux/module.h> | 14 | #include <linux/module.h> |
13 | #include <linux/kernel.h> | 15 | #include <linux/kernel.h> |
14 | #include <linux/init.h> | 16 | #include <linux/init.h> |
@@ -106,7 +108,7 @@ static int genericbl_probe(struct platform_device *pdev) | |||
106 | 108 | ||
107 | generic_backlight_device = bd; | 109 | generic_backlight_device = bd; |
108 | 110 | ||
109 | printk("Generic Backlight Driver Initialized.\n"); | 111 | pr_info("Generic Backlight Driver Initialized.\n"); |
110 | return 0; | 112 | return 0; |
111 | } | 113 | } |
112 | 114 | ||
@@ -120,7 +122,7 @@ static int genericbl_remove(struct platform_device *pdev) | |||
120 | 122 | ||
121 | backlight_device_unregister(bd); | 123 | backlight_device_unregister(bd); |
122 | 124 | ||
123 | printk("Generic Backlight Driver Unloaded\n"); | 125 | pr_info("Generic Backlight Driver Unloaded\n"); |
124 | return 0; | 126 | return 0; |
125 | } | 127 | } |
126 | 128 | ||
diff --git a/drivers/video/backlight/ili9320.c b/drivers/video/backlight/ili9320.c index 5118a9f029ab..6c9399341bcf 100644 --- a/drivers/video/backlight/ili9320.c +++ b/drivers/video/backlight/ili9320.c | |||
@@ -220,7 +220,7 @@ int __devinit ili9320_probe_spi(struct spi_device *spi, | |||
220 | 220 | ||
221 | /* allocate and initialse our state */ | 221 | /* allocate and initialse our state */ |
222 | 222 | ||
223 | ili = kzalloc(sizeof(struct ili9320), GFP_KERNEL); | 223 | ili = devm_kzalloc(&spi->dev, sizeof(struct ili9320), GFP_KERNEL); |
224 | if (ili == NULL) { | 224 | if (ili == NULL) { |
225 | dev_err(dev, "no memory for device\n"); | 225 | dev_err(dev, "no memory for device\n"); |
226 | return -ENOMEM; | 226 | return -ENOMEM; |
@@ -240,8 +240,7 @@ int __devinit ili9320_probe_spi(struct spi_device *spi, | |||
240 | lcd = lcd_device_register("ili9320", dev, ili, &ili9320_ops); | 240 | lcd = lcd_device_register("ili9320", dev, ili, &ili9320_ops); |
241 | if (IS_ERR(lcd)) { | 241 | if (IS_ERR(lcd)) { |
242 | dev_err(dev, "failed to register lcd device\n"); | 242 | dev_err(dev, "failed to register lcd device\n"); |
243 | ret = PTR_ERR(lcd); | 243 | return PTR_ERR(lcd); |
244 | goto err_free; | ||
245 | } | 244 | } |
246 | 245 | ||
247 | ili->lcd = lcd; | 246 | ili->lcd = lcd; |
@@ -259,9 +258,6 @@ int __devinit ili9320_probe_spi(struct spi_device *spi, | |||
259 | err_unregister: | 258 | err_unregister: |
260 | lcd_device_unregister(lcd); | 259 | lcd_device_unregister(lcd); |
261 | 260 | ||
262 | err_free: | ||
263 | kfree(ili); | ||
264 | |||
265 | return ret; | 261 | return ret; |
266 | } | 262 | } |
267 | 263 | ||
@@ -272,7 +268,6 @@ int __devexit ili9320_remove(struct ili9320 *ili) | |||
272 | ili9320_power(ili, FB_BLANK_POWERDOWN); | 268 | ili9320_power(ili, FB_BLANK_POWERDOWN); |
273 | 269 | ||
274 | lcd_device_unregister(ili->lcd); | 270 | lcd_device_unregister(ili->lcd); |
275 | kfree(ili); | ||
276 | 271 | ||
277 | return 0; | 272 | return 0; |
278 | } | 273 | } |
diff --git a/drivers/video/backlight/jornada720_bl.c b/drivers/video/backlight/jornada720_bl.c index 2f8af5d786ab..16f593b64427 100644 --- a/drivers/video/backlight/jornada720_bl.c +++ b/drivers/video/backlight/jornada720_bl.c | |||
@@ -9,6 +9,8 @@ | |||
9 | * | 9 | * |
10 | */ | 10 | */ |
11 | 11 | ||
12 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
13 | |||
12 | #include <linux/backlight.h> | 14 | #include <linux/backlight.h> |
13 | #include <linux/device.h> | 15 | #include <linux/device.h> |
14 | #include <linux/fb.h> | 16 | #include <linux/fb.h> |
@@ -38,7 +40,7 @@ static int jornada_bl_get_brightness(struct backlight_device *bd) | |||
38 | ret = jornada_ssp_byte(GETBRIGHTNESS); | 40 | ret = jornada_ssp_byte(GETBRIGHTNESS); |
39 | 41 | ||
40 | if (jornada_ssp_byte(GETBRIGHTNESS) != TXDUMMY) { | 42 | if (jornada_ssp_byte(GETBRIGHTNESS) != TXDUMMY) { |
41 | printk(KERN_ERR "bl : get brightness timeout\n"); | 43 | pr_err("get brightness timeout\n"); |
42 | jornada_ssp_end(); | 44 | jornada_ssp_end(); |
43 | return -ETIMEDOUT; | 45 | return -ETIMEDOUT; |
44 | } else /* exchange txdummy for value */ | 46 | } else /* exchange txdummy for value */ |
@@ -59,7 +61,7 @@ static int jornada_bl_update_status(struct backlight_device *bd) | |||
59 | if ((bd->props.power != FB_BLANK_UNBLANK) || (bd->props.fb_blank != FB_BLANK_UNBLANK)) { | 61 | if ((bd->props.power != FB_BLANK_UNBLANK) || (bd->props.fb_blank != FB_BLANK_UNBLANK)) { |
60 | ret = jornada_ssp_byte(BRIGHTNESSOFF); | 62 | ret = jornada_ssp_byte(BRIGHTNESSOFF); |
61 | if (ret != TXDUMMY) { | 63 | if (ret != TXDUMMY) { |
62 | printk(KERN_INFO "bl : brightness off timeout\n"); | 64 | pr_info("brightness off timeout\n"); |
63 | /* turn off backlight */ | 65 | /* turn off backlight */ |
64 | PPSR &= ~PPC_LDD1; | 66 | PPSR &= ~PPC_LDD1; |
65 | PPDR |= PPC_LDD1; | 67 | PPDR |= PPC_LDD1; |
@@ -70,7 +72,7 @@ static int jornada_bl_update_status(struct backlight_device *bd) | |||
70 | 72 | ||
71 | /* send command to our mcu */ | 73 | /* send command to our mcu */ |
72 | if (jornada_ssp_byte(SETBRIGHTNESS) != TXDUMMY) { | 74 | if (jornada_ssp_byte(SETBRIGHTNESS) != TXDUMMY) { |
73 | printk(KERN_INFO "bl : failed to set brightness\n"); | 75 | pr_info("failed to set brightness\n"); |
74 | ret = -ETIMEDOUT; | 76 | ret = -ETIMEDOUT; |
75 | goto out; | 77 | goto out; |
76 | } | 78 | } |
@@ -81,7 +83,7 @@ static int jornada_bl_update_status(struct backlight_device *bd) | |||
81 | but due to physical layout it is equal to 0, so we simply | 83 | but due to physical layout it is equal to 0, so we simply |
82 | invert the value (MAX VALUE - NEW VALUE). */ | 84 | invert the value (MAX VALUE - NEW VALUE). */ |
83 | if (jornada_ssp_byte(BL_MAX_BRIGHT - bd->props.brightness) != TXDUMMY) { | 85 | if (jornada_ssp_byte(BL_MAX_BRIGHT - bd->props.brightness) != TXDUMMY) { |
84 | printk(KERN_ERR "bl : set brightness failed\n"); | 86 | pr_err("set brightness failed\n"); |
85 | ret = -ETIMEDOUT; | 87 | ret = -ETIMEDOUT; |
86 | } | 88 | } |
87 | 89 | ||
@@ -113,7 +115,7 @@ static int jornada_bl_probe(struct platform_device *pdev) | |||
113 | 115 | ||
114 | if (IS_ERR(bd)) { | 116 | if (IS_ERR(bd)) { |
115 | ret = PTR_ERR(bd); | 117 | ret = PTR_ERR(bd); |
116 | printk(KERN_ERR "bl : failed to register device, err=%x\n", ret); | 118 | pr_err("failed to register device, err=%x\n", ret); |
117 | return ret; | 119 | return ret; |
118 | } | 120 | } |
119 | 121 | ||
@@ -125,7 +127,7 @@ static int jornada_bl_probe(struct platform_device *pdev) | |||
125 | jornada_bl_update_status(bd); | 127 | jornada_bl_update_status(bd); |
126 | 128 | ||
127 | platform_set_drvdata(pdev, bd); | 129 | platform_set_drvdata(pdev, bd); |
128 | printk(KERN_INFO "HP Jornada 700 series backlight driver\n"); | 130 | pr_info("HP Jornada 700 series backlight driver\n"); |
129 | 131 | ||
130 | return 0; | 132 | return 0; |
131 | } | 133 | } |
diff --git a/drivers/video/backlight/jornada720_lcd.c b/drivers/video/backlight/jornada720_lcd.c index 22d231a17e3c..635b30523fd5 100644 --- a/drivers/video/backlight/jornada720_lcd.c +++ b/drivers/video/backlight/jornada720_lcd.c | |||
@@ -9,6 +9,8 @@ | |||
9 | * | 9 | * |
10 | */ | 10 | */ |
11 | 11 | ||
12 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
13 | |||
12 | #include <linux/device.h> | 14 | #include <linux/device.h> |
13 | #include <linux/fb.h> | 15 | #include <linux/fb.h> |
14 | #include <linux/kernel.h> | 16 | #include <linux/kernel.h> |
@@ -44,7 +46,7 @@ static int jornada_lcd_get_contrast(struct lcd_device *dev) | |||
44 | jornada_ssp_start(); | 46 | jornada_ssp_start(); |
45 | 47 | ||
46 | if (jornada_ssp_byte(GETCONTRAST) != TXDUMMY) { | 48 | if (jornada_ssp_byte(GETCONTRAST) != TXDUMMY) { |
47 | printk(KERN_ERR "lcd: get contrast failed\n"); | 49 | pr_err("get contrast failed\n"); |
48 | jornada_ssp_end(); | 50 | jornada_ssp_end(); |
49 | return -ETIMEDOUT; | 51 | return -ETIMEDOUT; |
50 | } else { | 52 | } else { |
@@ -65,7 +67,7 @@ static int jornada_lcd_set_contrast(struct lcd_device *dev, int value) | |||
65 | 67 | ||
66 | /* push the new value */ | 68 | /* push the new value */ |
67 | if (jornada_ssp_byte(value) != TXDUMMY) { | 69 | if (jornada_ssp_byte(value) != TXDUMMY) { |
68 | printk(KERN_ERR "lcd : set contrast failed\n"); | 70 | pr_err("set contrast failed\n"); |
69 | jornada_ssp_end(); | 71 | jornada_ssp_end(); |
70 | return -ETIMEDOUT; | 72 | return -ETIMEDOUT; |
71 | } | 73 | } |
@@ -103,7 +105,7 @@ static int jornada_lcd_probe(struct platform_device *pdev) | |||
103 | 105 | ||
104 | if (IS_ERR(lcd_device)) { | 106 | if (IS_ERR(lcd_device)) { |
105 | ret = PTR_ERR(lcd_device); | 107 | ret = PTR_ERR(lcd_device); |
106 | printk(KERN_ERR "lcd : failed to register device\n"); | 108 | pr_err("failed to register device\n"); |
107 | return ret; | 109 | return ret; |
108 | } | 110 | } |
109 | 111 | ||
diff --git a/drivers/video/backlight/l4f00242t03.c b/drivers/video/backlight/l4f00242t03.c index 6022b67285ec..40f606a86093 100644 --- a/drivers/video/backlight/l4f00242t03.c +++ b/drivers/video/backlight/l4f00242t03.c | |||
@@ -11,6 +11,8 @@ | |||
11 | * published by the Free Software Foundation. | 11 | * published by the Free Software Foundation. |
12 | */ | 12 | */ |
13 | 13 | ||
14 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
15 | |||
14 | #include <linux/device.h> | 16 | #include <linux/device.h> |
15 | #include <linux/kernel.h> | 17 | #include <linux/kernel.h> |
16 | #include <linux/delay.h> | 18 | #include <linux/delay.h> |
@@ -159,7 +161,8 @@ static int __devinit l4f00242t03_probe(struct spi_device *spi) | |||
159 | return -EINVAL; | 161 | return -EINVAL; |
160 | } | 162 | } |
161 | 163 | ||
162 | priv = kzalloc(sizeof(struct l4f00242t03_priv), GFP_KERNEL); | 164 | priv = devm_kzalloc(&spi->dev, sizeof(struct l4f00242t03_priv), |
165 | GFP_KERNEL); | ||
163 | 166 | ||
164 | if (priv == NULL) { | 167 | if (priv == NULL) { |
165 | dev_err(&spi->dev, "No memory for this device.\n"); | 168 | dev_err(&spi->dev, "No memory for this device.\n"); |
@@ -177,7 +180,7 @@ static int __devinit l4f00242t03_probe(struct spi_device *spi) | |||
177 | if (ret) { | 180 | if (ret) { |
178 | dev_err(&spi->dev, | 181 | dev_err(&spi->dev, |
179 | "Unable to get the lcd l4f00242t03 reset gpio.\n"); | 182 | "Unable to get the lcd l4f00242t03 reset gpio.\n"); |
180 | goto err; | 183 | return ret; |
181 | } | 184 | } |
182 | 185 | ||
183 | ret = gpio_request_one(pdata->data_enable_gpio, GPIOF_OUT_INIT_LOW, | 186 | ret = gpio_request_one(pdata->data_enable_gpio, GPIOF_OUT_INIT_LOW, |
@@ -185,7 +188,7 @@ static int __devinit l4f00242t03_probe(struct spi_device *spi) | |||
185 | if (ret) { | 188 | if (ret) { |
186 | dev_err(&spi->dev, | 189 | dev_err(&spi->dev, |
187 | "Unable to get the lcd l4f00242t03 data en gpio.\n"); | 190 | "Unable to get the lcd l4f00242t03 data en gpio.\n"); |
188 | goto err2; | 191 | goto err; |
189 | } | 192 | } |
190 | 193 | ||
191 | priv->io_reg = regulator_get(&spi->dev, "vdd"); | 194 | priv->io_reg = regulator_get(&spi->dev, "vdd"); |
@@ -193,7 +196,7 @@ static int __devinit l4f00242t03_probe(struct spi_device *spi) | |||
193 | ret = PTR_ERR(priv->io_reg); | 196 | ret = PTR_ERR(priv->io_reg); |
194 | dev_err(&spi->dev, "%s: Unable to get the IO regulator\n", | 197 | dev_err(&spi->dev, "%s: Unable to get the IO regulator\n", |
195 | __func__); | 198 | __func__); |
196 | goto err3; | 199 | goto err2; |
197 | } | 200 | } |
198 | 201 | ||
199 | priv->core_reg = regulator_get(&spi->dev, "vcore"); | 202 | priv->core_reg = regulator_get(&spi->dev, "vcore"); |
@@ -201,14 +204,14 @@ static int __devinit l4f00242t03_probe(struct spi_device *spi) | |||
201 | ret = PTR_ERR(priv->core_reg); | 204 | ret = PTR_ERR(priv->core_reg); |
202 | dev_err(&spi->dev, "%s: Unable to get the core regulator\n", | 205 | dev_err(&spi->dev, "%s: Unable to get the core regulator\n", |
203 | __func__); | 206 | __func__); |
204 | goto err4; | 207 | goto err3; |
205 | } | 208 | } |
206 | 209 | ||
207 | priv->ld = lcd_device_register("l4f00242t03", | 210 | priv->ld = lcd_device_register("l4f00242t03", |
208 | &spi->dev, priv, &l4f_ops); | 211 | &spi->dev, priv, &l4f_ops); |
209 | if (IS_ERR(priv->ld)) { | 212 | if (IS_ERR(priv->ld)) { |
210 | ret = PTR_ERR(priv->ld); | 213 | ret = PTR_ERR(priv->ld); |
211 | goto err5; | 214 | goto err4; |
212 | } | 215 | } |
213 | 216 | ||
214 | /* Init the LCD */ | 217 | /* Init the LCD */ |
@@ -220,16 +223,14 @@ static int __devinit l4f00242t03_probe(struct spi_device *spi) | |||
220 | 223 | ||
221 | return 0; | 224 | return 0; |
222 | 225 | ||
223 | err5: | ||
224 | regulator_put(priv->core_reg); | ||
225 | err4: | 226 | err4: |
226 | regulator_put(priv->io_reg); | 227 | regulator_put(priv->core_reg); |
227 | err3: | 228 | err3: |
228 | gpio_free(pdata->data_enable_gpio); | 229 | regulator_put(priv->io_reg); |
229 | err2: | 230 | err2: |
230 | gpio_free(pdata->reset_gpio); | 231 | gpio_free(pdata->data_enable_gpio); |
231 | err: | 232 | err: |
232 | kfree(priv); | 233 | gpio_free(pdata->reset_gpio); |
233 | 234 | ||
234 | return ret; | 235 | return ret; |
235 | } | 236 | } |
@@ -250,8 +251,6 @@ static int __devexit l4f00242t03_remove(struct spi_device *spi) | |||
250 | regulator_put(priv->io_reg); | 251 | regulator_put(priv->io_reg); |
251 | regulator_put(priv->core_reg); | 252 | regulator_put(priv->core_reg); |
252 | 253 | ||
253 | kfree(priv); | ||
254 | |||
255 | return 0; | 254 | return 0; |
256 | } | 255 | } |
257 | 256 | ||
diff --git a/drivers/video/backlight/lcd.c b/drivers/video/backlight/lcd.c index 79c1b0d609a8..a5d0d024bb92 100644 --- a/drivers/video/backlight/lcd.c +++ b/drivers/video/backlight/lcd.c | |||
@@ -5,6 +5,8 @@ | |||
5 | * | 5 | * |
6 | */ | 6 | */ |
7 | 7 | ||
8 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
9 | |||
8 | #include <linux/module.h> | 10 | #include <linux/module.h> |
9 | #include <linux/init.h> | 11 | #include <linux/init.h> |
10 | #include <linux/device.h> | 12 | #include <linux/device.h> |
@@ -32,6 +34,8 @@ static int fb_notifier_callback(struct notifier_block *self, | |||
32 | case FB_EVENT_BLANK: | 34 | case FB_EVENT_BLANK: |
33 | case FB_EVENT_MODE_CHANGE: | 35 | case FB_EVENT_MODE_CHANGE: |
34 | case FB_EVENT_MODE_CHANGE_ALL: | 36 | case FB_EVENT_MODE_CHANGE_ALL: |
37 | case FB_EARLY_EVENT_BLANK: | ||
38 | case FB_R_EARLY_EVENT_BLANK: | ||
35 | break; | 39 | break; |
36 | default: | 40 | default: |
37 | return 0; | 41 | return 0; |
@@ -46,6 +50,14 @@ static int fb_notifier_callback(struct notifier_block *self, | |||
46 | if (event == FB_EVENT_BLANK) { | 50 | if (event == FB_EVENT_BLANK) { |
47 | if (ld->ops->set_power) | 51 | if (ld->ops->set_power) |
48 | ld->ops->set_power(ld, *(int *)evdata->data); | 52 | ld->ops->set_power(ld, *(int *)evdata->data); |
53 | } else if (event == FB_EARLY_EVENT_BLANK) { | ||
54 | if (ld->ops->early_set_power) | ||
55 | ld->ops->early_set_power(ld, | ||
56 | *(int *)evdata->data); | ||
57 | } else if (event == FB_R_EARLY_EVENT_BLANK) { | ||
58 | if (ld->ops->r_early_set_power) | ||
59 | ld->ops->r_early_set_power(ld, | ||
60 | *(int *)evdata->data); | ||
49 | } else { | 61 | } else { |
50 | if (ld->ops->set_mode) | 62 | if (ld->ops->set_mode) |
51 | ld->ops->set_mode(ld, evdata->data); | 63 | ld->ops->set_mode(ld, evdata->data); |
@@ -106,7 +118,7 @@ static ssize_t lcd_store_power(struct device *dev, | |||
106 | 118 | ||
107 | mutex_lock(&ld->ops_lock); | 119 | mutex_lock(&ld->ops_lock); |
108 | if (ld->ops && ld->ops->set_power) { | 120 | if (ld->ops && ld->ops->set_power) { |
109 | pr_debug("lcd: set power to %lu\n", power); | 121 | pr_debug("set power to %lu\n", power); |
110 | ld->ops->set_power(ld, power); | 122 | ld->ops->set_power(ld, power); |
111 | rc = count; | 123 | rc = count; |
112 | } | 124 | } |
@@ -142,7 +154,7 @@ static ssize_t lcd_store_contrast(struct device *dev, | |||
142 | 154 | ||
143 | mutex_lock(&ld->ops_lock); | 155 | mutex_lock(&ld->ops_lock); |
144 | if (ld->ops && ld->ops->set_contrast) { | 156 | if (ld->ops && ld->ops->set_contrast) { |
145 | pr_debug("lcd: set contrast to %lu\n", contrast); | 157 | pr_debug("set contrast to %lu\n", contrast); |
146 | ld->ops->set_contrast(ld, contrast); | 158 | ld->ops->set_contrast(ld, contrast); |
147 | rc = count; | 159 | rc = count; |
148 | } | 160 | } |
@@ -253,8 +265,8 @@ static int __init lcd_class_init(void) | |||
253 | { | 265 | { |
254 | lcd_class = class_create(THIS_MODULE, "lcd"); | 266 | lcd_class = class_create(THIS_MODULE, "lcd"); |
255 | if (IS_ERR(lcd_class)) { | 267 | if (IS_ERR(lcd_class)) { |
256 | printk(KERN_WARNING "Unable to create backlight class; errno = %ld\n", | 268 | pr_warn("Unable to create backlight class; errno = %ld\n", |
257 | PTR_ERR(lcd_class)); | 269 | PTR_ERR(lcd_class)); |
258 | return PTR_ERR(lcd_class); | 270 | return PTR_ERR(lcd_class); |
259 | } | 271 | } |
260 | 272 | ||
diff --git a/drivers/video/backlight/ld9040.c b/drivers/video/backlight/ld9040.c index efd352be21ae..58f517fb7d40 100644 --- a/drivers/video/backlight/ld9040.c +++ b/drivers/video/backlight/ld9040.c | |||
@@ -707,7 +707,7 @@ static int ld9040_probe(struct spi_device *spi) | |||
707 | struct backlight_device *bd = NULL; | 707 | struct backlight_device *bd = NULL; |
708 | struct backlight_properties props; | 708 | struct backlight_properties props; |
709 | 709 | ||
710 | lcd = kzalloc(sizeof(struct ld9040), GFP_KERNEL); | 710 | lcd = devm_kzalloc(&spi->dev, sizeof(struct ld9040), GFP_KERNEL); |
711 | if (!lcd) | 711 | if (!lcd) |
712 | return -ENOMEM; | 712 | return -ENOMEM; |
713 | 713 | ||
@@ -717,7 +717,7 @@ static int ld9040_probe(struct spi_device *spi) | |||
717 | ret = spi_setup(spi); | 717 | ret = spi_setup(spi); |
718 | if (ret < 0) { | 718 | if (ret < 0) { |
719 | dev_err(&spi->dev, "spi setup failed.\n"); | 719 | dev_err(&spi->dev, "spi setup failed.\n"); |
720 | goto out_free_lcd; | 720 | return ret; |
721 | } | 721 | } |
722 | 722 | ||
723 | lcd->spi = spi; | 723 | lcd->spi = spi; |
@@ -726,7 +726,7 @@ static int ld9040_probe(struct spi_device *spi) | |||
726 | lcd->lcd_pd = spi->dev.platform_data; | 726 | lcd->lcd_pd = spi->dev.platform_data; |
727 | if (!lcd->lcd_pd) { | 727 | if (!lcd->lcd_pd) { |
728 | dev_err(&spi->dev, "platform data is NULL.\n"); | 728 | dev_err(&spi->dev, "platform data is NULL.\n"); |
729 | goto out_free_lcd; | 729 | return -EFAULT; |
730 | } | 730 | } |
731 | 731 | ||
732 | mutex_init(&lcd->lock); | 732 | mutex_init(&lcd->lock); |
@@ -734,13 +734,13 @@ static int ld9040_probe(struct spi_device *spi) | |||
734 | ret = regulator_bulk_get(lcd->dev, ARRAY_SIZE(supplies), supplies); | 734 | ret = regulator_bulk_get(lcd->dev, ARRAY_SIZE(supplies), supplies); |
735 | if (ret) { | 735 | if (ret) { |
736 | dev_err(lcd->dev, "Failed to get regulators: %d\n", ret); | 736 | dev_err(lcd->dev, "Failed to get regulators: %d\n", ret); |
737 | goto out_free_lcd; | 737 | return ret; |
738 | } | 738 | } |
739 | 739 | ||
740 | ld = lcd_device_register("ld9040", &spi->dev, lcd, &ld9040_lcd_ops); | 740 | ld = lcd_device_register("ld9040", &spi->dev, lcd, &ld9040_lcd_ops); |
741 | if (IS_ERR(ld)) { | 741 | if (IS_ERR(ld)) { |
742 | ret = PTR_ERR(ld); | 742 | ret = PTR_ERR(ld); |
743 | goto out_free_lcd; | 743 | goto out_free_regulator; |
744 | } | 744 | } |
745 | 745 | ||
746 | lcd->ld = ld; | 746 | lcd->ld = ld; |
@@ -782,10 +782,9 @@ static int ld9040_probe(struct spi_device *spi) | |||
782 | 782 | ||
783 | out_unregister_lcd: | 783 | out_unregister_lcd: |
784 | lcd_device_unregister(lcd->ld); | 784 | lcd_device_unregister(lcd->ld); |
785 | out_free_lcd: | 785 | out_free_regulator: |
786 | regulator_bulk_free(ARRAY_SIZE(supplies), supplies); | 786 | regulator_bulk_free(ARRAY_SIZE(supplies), supplies); |
787 | 787 | ||
788 | kfree(lcd); | ||
789 | return ret; | 788 | return ret; |
790 | } | 789 | } |
791 | 790 | ||
@@ -797,7 +796,6 @@ static int __devexit ld9040_remove(struct spi_device *spi) | |||
797 | backlight_device_unregister(lcd->bd); | 796 | backlight_device_unregister(lcd->bd); |
798 | lcd_device_unregister(lcd->ld); | 797 | lcd_device_unregister(lcd->ld); |
799 | regulator_bulk_free(ARRAY_SIZE(supplies), supplies); | 798 | regulator_bulk_free(ARRAY_SIZE(supplies), supplies); |
800 | kfree(lcd); | ||
801 | 799 | ||
802 | return 0; | 800 | return 0; |
803 | } | 801 | } |
@@ -846,7 +844,6 @@ static void ld9040_shutdown(struct spi_device *spi) | |||
846 | static struct spi_driver ld9040_driver = { | 844 | static struct spi_driver ld9040_driver = { |
847 | .driver = { | 845 | .driver = { |
848 | .name = "ld9040", | 846 | .name = "ld9040", |
849 | .bus = &spi_bus_type, | ||
850 | .owner = THIS_MODULE, | 847 | .owner = THIS_MODULE, |
851 | }, | 848 | }, |
852 | .probe = ld9040_probe, | 849 | .probe = ld9040_probe, |
diff --git a/drivers/video/backlight/lm3533_bl.c b/drivers/video/backlight/lm3533_bl.c new file mode 100644 index 000000000000..bebeb63607db --- /dev/null +++ b/drivers/video/backlight/lm3533_bl.c | |||
@@ -0,0 +1,423 @@ | |||
1 | /* | ||
2 | * lm3533-bl.c -- LM3533 Backlight driver | ||
3 | * | ||
4 | * Copyright (C) 2011-2012 Texas Instruments | ||
5 | * | ||
6 | * Author: Johan Hovold <jhovold@gmail.com> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify it | ||
9 | * under the terms of the GNU General Public License as published by the | ||
10 | * Free Software Foundation; either version 2 of the License, or (at your | ||
11 | * option) any later version. | ||
12 | */ | ||
13 | |||
14 | #include <linux/module.h> | ||
15 | #include <linux/init.h> | ||
16 | #include <linux/platform_device.h> | ||
17 | #include <linux/backlight.h> | ||
18 | #include <linux/fb.h> | ||
19 | #include <linux/slab.h> | ||
20 | |||
21 | #include <linux/mfd/lm3533.h> | ||
22 | |||
23 | |||
24 | #define LM3533_HVCTRLBANK_COUNT 2 | ||
25 | #define LM3533_BL_MAX_BRIGHTNESS 255 | ||
26 | |||
27 | #define LM3533_REG_CTRLBANK_AB_BCONF 0x1a | ||
28 | |||
29 | |||
30 | struct lm3533_bl { | ||
31 | struct lm3533 *lm3533; | ||
32 | struct lm3533_ctrlbank cb; | ||
33 | struct backlight_device *bd; | ||
34 | int id; | ||
35 | }; | ||
36 | |||
37 | |||
38 | static inline int lm3533_bl_get_ctrlbank_id(struct lm3533_bl *bl) | ||
39 | { | ||
40 | return bl->id; | ||
41 | } | ||
42 | |||
43 | static int lm3533_bl_update_status(struct backlight_device *bd) | ||
44 | { | ||
45 | struct lm3533_bl *bl = bl_get_data(bd); | ||
46 | int brightness = bd->props.brightness; | ||
47 | |||
48 | if (bd->props.power != FB_BLANK_UNBLANK) | ||
49 | brightness = 0; | ||
50 | if (bd->props.fb_blank != FB_BLANK_UNBLANK) | ||
51 | brightness = 0; | ||
52 | |||
53 | return lm3533_ctrlbank_set_brightness(&bl->cb, (u8)brightness); | ||
54 | } | ||
55 | |||
56 | static int lm3533_bl_get_brightness(struct backlight_device *bd) | ||
57 | { | ||
58 | struct lm3533_bl *bl = bl_get_data(bd); | ||
59 | u8 val; | ||
60 | int ret; | ||
61 | |||
62 | ret = lm3533_ctrlbank_get_brightness(&bl->cb, &val); | ||
63 | if (ret) | ||
64 | return ret; | ||
65 | |||
66 | return val; | ||
67 | } | ||
68 | |||
69 | static const struct backlight_ops lm3533_bl_ops = { | ||
70 | .get_brightness = lm3533_bl_get_brightness, | ||
71 | .update_status = lm3533_bl_update_status, | ||
72 | }; | ||
73 | |||
74 | static ssize_t show_id(struct device *dev, | ||
75 | struct device_attribute *attr, char *buf) | ||
76 | { | ||
77 | struct lm3533_bl *bl = dev_get_drvdata(dev); | ||
78 | |||
79 | return scnprintf(buf, PAGE_SIZE, "%d\n", bl->id); | ||
80 | } | ||
81 | |||
82 | static ssize_t show_als_channel(struct device *dev, | ||
83 | struct device_attribute *attr, char *buf) | ||
84 | { | ||
85 | struct lm3533_bl *bl = dev_get_drvdata(dev); | ||
86 | unsigned channel = lm3533_bl_get_ctrlbank_id(bl); | ||
87 | |||
88 | return scnprintf(buf, PAGE_SIZE, "%u\n", channel); | ||
89 | } | ||
90 | |||
91 | static ssize_t show_als_en(struct device *dev, | ||
92 | struct device_attribute *attr, char *buf) | ||
93 | { | ||
94 | struct lm3533_bl *bl = dev_get_drvdata(dev); | ||
95 | int ctrlbank = lm3533_bl_get_ctrlbank_id(bl); | ||
96 | u8 val; | ||
97 | u8 mask; | ||
98 | bool enable; | ||
99 | int ret; | ||
100 | |||
101 | ret = lm3533_read(bl->lm3533, LM3533_REG_CTRLBANK_AB_BCONF, &val); | ||
102 | if (ret) | ||
103 | return ret; | ||
104 | |||
105 | mask = 1 << (2 * ctrlbank); | ||
106 | enable = val & mask; | ||
107 | |||
108 | return scnprintf(buf, PAGE_SIZE, "%d\n", enable); | ||
109 | } | ||
110 | |||
111 | static ssize_t store_als_en(struct device *dev, | ||
112 | struct device_attribute *attr, | ||
113 | const char *buf, size_t len) | ||
114 | { | ||
115 | struct lm3533_bl *bl = dev_get_drvdata(dev); | ||
116 | int ctrlbank = lm3533_bl_get_ctrlbank_id(bl); | ||
117 | int enable; | ||
118 | u8 val; | ||
119 | u8 mask; | ||
120 | int ret; | ||
121 | |||
122 | if (kstrtoint(buf, 0, &enable)) | ||
123 | return -EINVAL; | ||
124 | |||
125 | mask = 1 << (2 * ctrlbank); | ||
126 | |||
127 | if (enable) | ||
128 | val = mask; | ||
129 | else | ||
130 | val = 0; | ||
131 | |||
132 | ret = lm3533_update(bl->lm3533, LM3533_REG_CTRLBANK_AB_BCONF, val, | ||
133 | mask); | ||
134 | if (ret) | ||
135 | return ret; | ||
136 | |||
137 | return len; | ||
138 | } | ||
139 | |||
140 | static ssize_t show_linear(struct device *dev, | ||
141 | struct device_attribute *attr, char *buf) | ||
142 | { | ||
143 | struct lm3533_bl *bl = dev_get_drvdata(dev); | ||
144 | u8 val; | ||
145 | u8 mask; | ||
146 | int linear; | ||
147 | int ret; | ||
148 | |||
149 | ret = lm3533_read(bl->lm3533, LM3533_REG_CTRLBANK_AB_BCONF, &val); | ||
150 | if (ret) | ||
151 | return ret; | ||
152 | |||
153 | mask = 1 << (2 * lm3533_bl_get_ctrlbank_id(bl) + 1); | ||
154 | |||
155 | if (val & mask) | ||
156 | linear = 1; | ||
157 | else | ||
158 | linear = 0; | ||
159 | |||
160 | return scnprintf(buf, PAGE_SIZE, "%x\n", linear); | ||
161 | } | ||
162 | |||
163 | static ssize_t store_linear(struct device *dev, | ||
164 | struct device_attribute *attr, | ||
165 | const char *buf, size_t len) | ||
166 | { | ||
167 | struct lm3533_bl *bl = dev_get_drvdata(dev); | ||
168 | unsigned long linear; | ||
169 | u8 mask; | ||
170 | u8 val; | ||
171 | int ret; | ||
172 | |||
173 | if (kstrtoul(buf, 0, &linear)) | ||
174 | return -EINVAL; | ||
175 | |||
176 | mask = 1 << (2 * lm3533_bl_get_ctrlbank_id(bl) + 1); | ||
177 | |||
178 | if (linear) | ||
179 | val = mask; | ||
180 | else | ||
181 | val = 0; | ||
182 | |||
183 | ret = lm3533_update(bl->lm3533, LM3533_REG_CTRLBANK_AB_BCONF, val, | ||
184 | mask); | ||
185 | if (ret) | ||
186 | return ret; | ||
187 | |||
188 | return len; | ||
189 | } | ||
190 | |||
191 | static ssize_t show_pwm(struct device *dev, | ||
192 | struct device_attribute *attr, | ||
193 | char *buf) | ||
194 | { | ||
195 | struct lm3533_bl *bl = dev_get_drvdata(dev); | ||
196 | u8 val; | ||
197 | int ret; | ||
198 | |||
199 | ret = lm3533_ctrlbank_get_pwm(&bl->cb, &val); | ||
200 | if (ret) | ||
201 | return ret; | ||
202 | |||
203 | return scnprintf(buf, PAGE_SIZE, "%u\n", val); | ||
204 | } | ||
205 | |||
206 | static ssize_t store_pwm(struct device *dev, | ||
207 | struct device_attribute *attr, | ||
208 | const char *buf, size_t len) | ||
209 | { | ||
210 | struct lm3533_bl *bl = dev_get_drvdata(dev); | ||
211 | u8 val; | ||
212 | int ret; | ||
213 | |||
214 | if (kstrtou8(buf, 0, &val)) | ||
215 | return -EINVAL; | ||
216 | |||
217 | ret = lm3533_ctrlbank_set_pwm(&bl->cb, val); | ||
218 | if (ret) | ||
219 | return ret; | ||
220 | |||
221 | return len; | ||
222 | } | ||
223 | |||
224 | static LM3533_ATTR_RO(als_channel); | ||
225 | static LM3533_ATTR_RW(als_en); | ||
226 | static LM3533_ATTR_RO(id); | ||
227 | static LM3533_ATTR_RW(linear); | ||
228 | static LM3533_ATTR_RW(pwm); | ||
229 | |||
230 | static struct attribute *lm3533_bl_attributes[] = { | ||
231 | &dev_attr_als_channel.attr, | ||
232 | &dev_attr_als_en.attr, | ||
233 | &dev_attr_id.attr, | ||
234 | &dev_attr_linear.attr, | ||
235 | &dev_attr_pwm.attr, | ||
236 | NULL, | ||
237 | }; | ||
238 | |||
239 | static umode_t lm3533_bl_attr_is_visible(struct kobject *kobj, | ||
240 | struct attribute *attr, int n) | ||
241 | { | ||
242 | struct device *dev = container_of(kobj, struct device, kobj); | ||
243 | struct lm3533_bl *bl = dev_get_drvdata(dev); | ||
244 | umode_t mode = attr->mode; | ||
245 | |||
246 | if (attr == &dev_attr_als_channel.attr || | ||
247 | attr == &dev_attr_als_en.attr) { | ||
248 | if (!bl->lm3533->have_als) | ||
249 | mode = 0; | ||
250 | } | ||
251 | |||
252 | return mode; | ||
253 | }; | ||
254 | |||
255 | static struct attribute_group lm3533_bl_attribute_group = { | ||
256 | .is_visible = lm3533_bl_attr_is_visible, | ||
257 | .attrs = lm3533_bl_attributes | ||
258 | }; | ||
259 | |||
260 | static int __devinit lm3533_bl_setup(struct lm3533_bl *bl, | ||
261 | struct lm3533_bl_platform_data *pdata) | ||
262 | { | ||
263 | int ret; | ||
264 | |||
265 | ret = lm3533_ctrlbank_set_max_current(&bl->cb, pdata->max_current); | ||
266 | if (ret) | ||
267 | return ret; | ||
268 | |||
269 | return lm3533_ctrlbank_set_pwm(&bl->cb, pdata->pwm); | ||
270 | } | ||
271 | |||
272 | static int __devinit lm3533_bl_probe(struct platform_device *pdev) | ||
273 | { | ||
274 | struct lm3533 *lm3533; | ||
275 | struct lm3533_bl_platform_data *pdata; | ||
276 | struct lm3533_bl *bl; | ||
277 | struct backlight_device *bd; | ||
278 | struct backlight_properties props; | ||
279 | int ret; | ||
280 | |||
281 | dev_dbg(&pdev->dev, "%s\n", __func__); | ||
282 | |||
283 | lm3533 = dev_get_drvdata(pdev->dev.parent); | ||
284 | if (!lm3533) | ||
285 | return -EINVAL; | ||
286 | |||
287 | pdata = pdev->dev.platform_data; | ||
288 | if (!pdata) { | ||
289 | dev_err(&pdev->dev, "no platform data\n"); | ||
290 | return -EINVAL; | ||
291 | } | ||
292 | |||
293 | if (pdev->id < 0 || pdev->id >= LM3533_HVCTRLBANK_COUNT) { | ||
294 | dev_err(&pdev->dev, "illegal backlight id %d\n", pdev->id); | ||
295 | return -EINVAL; | ||
296 | } | ||
297 | |||
298 | bl = kzalloc(sizeof(*bl), GFP_KERNEL); | ||
299 | if (!bl) { | ||
300 | dev_err(&pdev->dev, | ||
301 | "failed to allocate memory for backlight\n"); | ||
302 | return -ENOMEM; | ||
303 | } | ||
304 | |||
305 | bl->lm3533 = lm3533; | ||
306 | bl->id = pdev->id; | ||
307 | |||
308 | bl->cb.lm3533 = lm3533; | ||
309 | bl->cb.id = lm3533_bl_get_ctrlbank_id(bl); | ||
310 | bl->cb.dev = NULL; /* until registered */ | ||
311 | |||
312 | memset(&props, 0, sizeof(props)); | ||
313 | props.type = BACKLIGHT_RAW; | ||
314 | props.max_brightness = LM3533_BL_MAX_BRIGHTNESS; | ||
315 | props.brightness = pdata->default_brightness; | ||
316 | bd = backlight_device_register(pdata->name, pdev->dev.parent, bl, | ||
317 | &lm3533_bl_ops, &props); | ||
318 | if (IS_ERR(bd)) { | ||
319 | dev_err(&pdev->dev, "failed to register backlight device\n"); | ||
320 | ret = PTR_ERR(bd); | ||
321 | goto err_free; | ||
322 | } | ||
323 | |||
324 | bl->bd = bd; | ||
325 | bl->cb.dev = &bl->bd->dev; | ||
326 | |||
327 | platform_set_drvdata(pdev, bl); | ||
328 | |||
329 | ret = sysfs_create_group(&bd->dev.kobj, &lm3533_bl_attribute_group); | ||
330 | if (ret < 0) { | ||
331 | dev_err(&pdev->dev, "failed to create sysfs attributes\n"); | ||
332 | goto err_unregister; | ||
333 | } | ||
334 | |||
335 | backlight_update_status(bd); | ||
336 | |||
337 | ret = lm3533_bl_setup(bl, pdata); | ||
338 | if (ret) | ||
339 | goto err_sysfs_remove; | ||
340 | |||
341 | ret = lm3533_ctrlbank_enable(&bl->cb); | ||
342 | if (ret) | ||
343 | goto err_sysfs_remove; | ||
344 | |||
345 | return 0; | ||
346 | |||
347 | err_sysfs_remove: | ||
348 | sysfs_remove_group(&bd->dev.kobj, &lm3533_bl_attribute_group); | ||
349 | err_unregister: | ||
350 | backlight_device_unregister(bd); | ||
351 | err_free: | ||
352 | kfree(bl); | ||
353 | |||
354 | return ret; | ||
355 | } | ||
356 | |||
357 | static int __devexit lm3533_bl_remove(struct platform_device *pdev) | ||
358 | { | ||
359 | struct lm3533_bl *bl = platform_get_drvdata(pdev); | ||
360 | struct backlight_device *bd = bl->bd; | ||
361 | |||
362 | dev_dbg(&bd->dev, "%s\n", __func__); | ||
363 | |||
364 | bd->props.power = FB_BLANK_POWERDOWN; | ||
365 | bd->props.brightness = 0; | ||
366 | |||
367 | lm3533_ctrlbank_disable(&bl->cb); | ||
368 | sysfs_remove_group(&bd->dev.kobj, &lm3533_bl_attribute_group); | ||
369 | backlight_device_unregister(bd); | ||
370 | kfree(bl); | ||
371 | |||
372 | return 0; | ||
373 | } | ||
374 | |||
375 | #ifdef CONFIG_PM | ||
376 | static int lm3533_bl_suspend(struct platform_device *pdev, pm_message_t state) | ||
377 | { | ||
378 | struct lm3533_bl *bl = platform_get_drvdata(pdev); | ||
379 | |||
380 | dev_dbg(&pdev->dev, "%s\n", __func__); | ||
381 | |||
382 | return lm3533_ctrlbank_disable(&bl->cb); | ||
383 | } | ||
384 | |||
385 | static int lm3533_bl_resume(struct platform_device *pdev) | ||
386 | { | ||
387 | struct lm3533_bl *bl = platform_get_drvdata(pdev); | ||
388 | |||
389 | dev_dbg(&pdev->dev, "%s\n", __func__); | ||
390 | |||
391 | return lm3533_ctrlbank_enable(&bl->cb); | ||
392 | } | ||
393 | #else | ||
394 | #define lm3533_bl_suspend NULL | ||
395 | #define lm3533_bl_resume NULL | ||
396 | #endif | ||
397 | |||
398 | static void lm3533_bl_shutdown(struct platform_device *pdev) | ||
399 | { | ||
400 | struct lm3533_bl *bl = platform_get_drvdata(pdev); | ||
401 | |||
402 | dev_dbg(&pdev->dev, "%s\n", __func__); | ||
403 | |||
404 | lm3533_ctrlbank_disable(&bl->cb); | ||
405 | } | ||
406 | |||
407 | static struct platform_driver lm3533_bl_driver = { | ||
408 | .driver = { | ||
409 | .name = "lm3533-backlight", | ||
410 | .owner = THIS_MODULE, | ||
411 | }, | ||
412 | .probe = lm3533_bl_probe, | ||
413 | .remove = __devexit_p(lm3533_bl_remove), | ||
414 | .shutdown = lm3533_bl_shutdown, | ||
415 | .suspend = lm3533_bl_suspend, | ||
416 | .resume = lm3533_bl_resume, | ||
417 | }; | ||
418 | module_platform_driver(lm3533_bl_driver); | ||
419 | |||
420 | MODULE_AUTHOR("Johan Hovold <jhovold@gmail.com>"); | ||
421 | MODULE_DESCRIPTION("LM3533 Backlight driver"); | ||
422 | MODULE_LICENSE("GPL"); | ||
423 | MODULE_ALIAS("platform:lm3533-backlight"); | ||
diff --git a/drivers/video/backlight/lms283gf05.c b/drivers/video/backlight/lms283gf05.c index 4161f9e3982a..a9f2c36966f1 100644 --- a/drivers/video/backlight/lms283gf05.c +++ b/drivers/video/backlight/lms283gf05.c | |||
@@ -168,7 +168,8 @@ static int __devinit lms283gf05_probe(struct spi_device *spi) | |||
168 | goto err; | 168 | goto err; |
169 | } | 169 | } |
170 | 170 | ||
171 | st = kzalloc(sizeof(struct lms283gf05_state), GFP_KERNEL); | 171 | st = devm_kzalloc(&spi->dev, sizeof(struct lms283gf05_state), |
172 | GFP_KERNEL); | ||
172 | if (st == NULL) { | 173 | if (st == NULL) { |
173 | dev_err(&spi->dev, "No memory for device state\n"); | 174 | dev_err(&spi->dev, "No memory for device state\n"); |
174 | ret = -ENOMEM; | 175 | ret = -ENOMEM; |
@@ -178,7 +179,7 @@ static int __devinit lms283gf05_probe(struct spi_device *spi) | |||
178 | ld = lcd_device_register("lms283gf05", &spi->dev, st, &lms_ops); | 179 | ld = lcd_device_register("lms283gf05", &spi->dev, st, &lms_ops); |
179 | if (IS_ERR(ld)) { | 180 | if (IS_ERR(ld)) { |
180 | ret = PTR_ERR(ld); | 181 | ret = PTR_ERR(ld); |
181 | goto err2; | 182 | goto err; |
182 | } | 183 | } |
183 | 184 | ||
184 | st->spi = spi; | 185 | st->spi = spi; |
@@ -193,8 +194,6 @@ static int __devinit lms283gf05_probe(struct spi_device *spi) | |||
193 | 194 | ||
194 | return 0; | 195 | return 0; |
195 | 196 | ||
196 | err2: | ||
197 | kfree(st); | ||
198 | err: | 197 | err: |
199 | if (pdata != NULL) | 198 | if (pdata != NULL) |
200 | gpio_free(pdata->reset_gpio); | 199 | gpio_free(pdata->reset_gpio); |
@@ -212,8 +211,6 @@ static int __devexit lms283gf05_remove(struct spi_device *spi) | |||
212 | if (pdata != NULL) | 211 | if (pdata != NULL) |
213 | gpio_free(pdata->reset_gpio); | 212 | gpio_free(pdata->reset_gpio); |
214 | 213 | ||
215 | kfree(st); | ||
216 | |||
217 | return 0; | 214 | return 0; |
218 | } | 215 | } |
219 | 216 | ||
diff --git a/drivers/video/backlight/ltv350qv.c b/drivers/video/backlight/ltv350qv.c index 333949ff3265..6c0f1ac0d32a 100644 --- a/drivers/video/backlight/ltv350qv.c +++ b/drivers/video/backlight/ltv350qv.c | |||
@@ -232,23 +232,20 @@ static int __devinit ltv350qv_probe(struct spi_device *spi) | |||
232 | struct lcd_device *ld; | 232 | struct lcd_device *ld; |
233 | int ret; | 233 | int ret; |
234 | 234 | ||
235 | lcd = kzalloc(sizeof(struct ltv350qv), GFP_KERNEL); | 235 | lcd = devm_kzalloc(&spi->dev, sizeof(struct ltv350qv), GFP_KERNEL); |
236 | if (!lcd) | 236 | if (!lcd) |
237 | return -ENOMEM; | 237 | return -ENOMEM; |
238 | 238 | ||
239 | lcd->spi = spi; | 239 | lcd->spi = spi; |
240 | lcd->power = FB_BLANK_POWERDOWN; | 240 | lcd->power = FB_BLANK_POWERDOWN; |
241 | lcd->buffer = kzalloc(8, GFP_KERNEL); | 241 | lcd->buffer = devm_kzalloc(&spi->dev, 8, GFP_KERNEL); |
242 | if (!lcd->buffer) { | 242 | if (!lcd->buffer) |
243 | ret = -ENOMEM; | 243 | return -ENOMEM; |
244 | goto out_free_lcd; | ||
245 | } | ||
246 | 244 | ||
247 | ld = lcd_device_register("ltv350qv", &spi->dev, lcd, <v_ops); | 245 | ld = lcd_device_register("ltv350qv", &spi->dev, lcd, <v_ops); |
248 | if (IS_ERR(ld)) { | 246 | if (IS_ERR(ld)) |
249 | ret = PTR_ERR(ld); | 247 | return PTR_ERR(ld); |
250 | goto out_free_buffer; | 248 | |
251 | } | ||
252 | lcd->ld = ld; | 249 | lcd->ld = ld; |
253 | 250 | ||
254 | ret = ltv350qv_power(lcd, FB_BLANK_UNBLANK); | 251 | ret = ltv350qv_power(lcd, FB_BLANK_UNBLANK); |
@@ -261,10 +258,6 @@ static int __devinit ltv350qv_probe(struct spi_device *spi) | |||
261 | 258 | ||
262 | out_unregister: | 259 | out_unregister: |
263 | lcd_device_unregister(ld); | 260 | lcd_device_unregister(ld); |
264 | out_free_buffer: | ||
265 | kfree(lcd->buffer); | ||
266 | out_free_lcd: | ||
267 | kfree(lcd); | ||
268 | return ret; | 261 | return ret; |
269 | } | 262 | } |
270 | 263 | ||
@@ -274,8 +267,6 @@ static int __devexit ltv350qv_remove(struct spi_device *spi) | |||
274 | 267 | ||
275 | ltv350qv_power(lcd, FB_BLANK_POWERDOWN); | 268 | ltv350qv_power(lcd, FB_BLANK_POWERDOWN); |
276 | lcd_device_unregister(lcd->ld); | 269 | lcd_device_unregister(lcd->ld); |
277 | kfree(lcd->buffer); | ||
278 | kfree(lcd); | ||
279 | 270 | ||
280 | return 0; | 271 | return 0; |
281 | } | 272 | } |
@@ -310,7 +301,6 @@ static void ltv350qv_shutdown(struct spi_device *spi) | |||
310 | static struct spi_driver ltv350qv_driver = { | 301 | static struct spi_driver ltv350qv_driver = { |
311 | .driver = { | 302 | .driver = { |
312 | .name = "ltv350qv", | 303 | .name = "ltv350qv", |
313 | .bus = &spi_bus_type, | ||
314 | .owner = THIS_MODULE, | 304 | .owner = THIS_MODULE, |
315 | }, | 305 | }, |
316 | 306 | ||
diff --git a/drivers/video/backlight/omap1_bl.c b/drivers/video/backlight/omap1_bl.c index 0175bfb08a1c..bfdc5fbeaa11 100644 --- a/drivers/video/backlight/omap1_bl.c +++ b/drivers/video/backlight/omap1_bl.c | |||
@@ -18,6 +18,8 @@ | |||
18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | 18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
22 | |||
21 | #include <linux/module.h> | 23 | #include <linux/module.h> |
22 | #include <linux/kernel.h> | 24 | #include <linux/kernel.h> |
23 | #include <linux/init.h> | 25 | #include <linux/init.h> |
@@ -168,7 +170,7 @@ static int omapbl_probe(struct platform_device *pdev) | |||
168 | dev->props.brightness = pdata->default_intensity; | 170 | dev->props.brightness = pdata->default_intensity; |
169 | omapbl_update_status(dev); | 171 | omapbl_update_status(dev); |
170 | 172 | ||
171 | printk(KERN_INFO "OMAP LCD backlight initialised\n"); | 173 | pr_info("OMAP LCD backlight initialised\n"); |
172 | 174 | ||
173 | return 0; | 175 | return 0; |
174 | } | 176 | } |
diff --git a/drivers/video/backlight/pcf50633-backlight.c b/drivers/video/backlight/pcf50633-backlight.c index c65853cb9740..c092159f4383 100644 --- a/drivers/video/backlight/pcf50633-backlight.c +++ b/drivers/video/backlight/pcf50633-backlight.c | |||
@@ -111,6 +111,7 @@ static int __devinit pcf50633_bl_probe(struct platform_device *pdev) | |||
111 | if (!pcf_bl) | 111 | if (!pcf_bl) |
112 | return -ENOMEM; | 112 | return -ENOMEM; |
113 | 113 | ||
114 | memset(&bl_props, 0, sizeof(bl_props)); | ||
114 | bl_props.type = BACKLIGHT_RAW; | 115 | bl_props.type = BACKLIGHT_RAW; |
115 | bl_props.max_brightness = 0x3f; | 116 | bl_props.max_brightness = 0x3f; |
116 | bl_props.power = FB_BLANK_UNBLANK; | 117 | bl_props.power = FB_BLANK_UNBLANK; |
diff --git a/drivers/video/backlight/progear_bl.c b/drivers/video/backlight/progear_bl.c index 6af183d6465e..69b35f02929e 100644 --- a/drivers/video/backlight/progear_bl.c +++ b/drivers/video/backlight/progear_bl.c | |||
@@ -15,6 +15,8 @@ | |||
15 | * | 15 | * |
16 | */ | 16 | */ |
17 | 17 | ||
18 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
19 | |||
18 | #include <linux/module.h> | 20 | #include <linux/module.h> |
19 | #include <linux/kernel.h> | 21 | #include <linux/kernel.h> |
20 | #include <linux/init.h> | 22 | #include <linux/init.h> |
@@ -68,13 +70,13 @@ static int progearbl_probe(struct platform_device *pdev) | |||
68 | 70 | ||
69 | pmu_dev = pci_get_device(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M7101, NULL); | 71 | pmu_dev = pci_get_device(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M7101, NULL); |
70 | if (!pmu_dev) { | 72 | if (!pmu_dev) { |
71 | printk("ALI M7101 PMU not found.\n"); | 73 | pr_err("ALI M7101 PMU not found.\n"); |
72 | return -ENODEV; | 74 | return -ENODEV; |
73 | } | 75 | } |
74 | 76 | ||
75 | sb_dev = pci_get_device(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M1533, NULL); | 77 | sb_dev = pci_get_device(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M1533, NULL); |
76 | if (!sb_dev) { | 78 | if (!sb_dev) { |
77 | printk("ALI 1533 SB not found.\n"); | 79 | pr_err("ALI 1533 SB not found.\n"); |
78 | ret = -ENODEV; | 80 | ret = -ENODEV; |
79 | goto put_pmu; | 81 | goto put_pmu; |
80 | } | 82 | } |
diff --git a/drivers/video/backlight/s6e63m0.c b/drivers/video/backlight/s6e63m0.c index e264f55b2574..6437ae474cf2 100644 --- a/drivers/video/backlight/s6e63m0.c +++ b/drivers/video/backlight/s6e63m0.c | |||
@@ -741,7 +741,7 @@ static int __devinit s6e63m0_probe(struct spi_device *spi) | |||
741 | struct backlight_device *bd = NULL; | 741 | struct backlight_device *bd = NULL; |
742 | struct backlight_properties props; | 742 | struct backlight_properties props; |
743 | 743 | ||
744 | lcd = kzalloc(sizeof(struct s6e63m0), GFP_KERNEL); | 744 | lcd = devm_kzalloc(&spi->dev, sizeof(struct s6e63m0), GFP_KERNEL); |
745 | if (!lcd) | 745 | if (!lcd) |
746 | return -ENOMEM; | 746 | return -ENOMEM; |
747 | 747 | ||
@@ -751,7 +751,7 @@ static int __devinit s6e63m0_probe(struct spi_device *spi) | |||
751 | ret = spi_setup(spi); | 751 | ret = spi_setup(spi); |
752 | if (ret < 0) { | 752 | if (ret < 0) { |
753 | dev_err(&spi->dev, "spi setup failed.\n"); | 753 | dev_err(&spi->dev, "spi setup failed.\n"); |
754 | goto out_free_lcd; | 754 | return ret; |
755 | } | 755 | } |
756 | 756 | ||
757 | lcd->spi = spi; | 757 | lcd->spi = spi; |
@@ -760,14 +760,12 @@ static int __devinit s6e63m0_probe(struct spi_device *spi) | |||
760 | lcd->lcd_pd = (struct lcd_platform_data *)spi->dev.platform_data; | 760 | lcd->lcd_pd = (struct lcd_platform_data *)spi->dev.platform_data; |
761 | if (!lcd->lcd_pd) { | 761 | if (!lcd->lcd_pd) { |
762 | dev_err(&spi->dev, "platform data is NULL.\n"); | 762 | dev_err(&spi->dev, "platform data is NULL.\n"); |
763 | goto out_free_lcd; | 763 | return -EFAULT; |
764 | } | 764 | } |
765 | 765 | ||
766 | ld = lcd_device_register("s6e63m0", &spi->dev, lcd, &s6e63m0_lcd_ops); | 766 | ld = lcd_device_register("s6e63m0", &spi->dev, lcd, &s6e63m0_lcd_ops); |
767 | if (IS_ERR(ld)) { | 767 | if (IS_ERR(ld)) |
768 | ret = PTR_ERR(ld); | 768 | return PTR_ERR(ld); |
769 | goto out_free_lcd; | ||
770 | } | ||
771 | 769 | ||
772 | lcd->ld = ld; | 770 | lcd->ld = ld; |
773 | 771 | ||
@@ -824,8 +822,6 @@ static int __devinit s6e63m0_probe(struct spi_device *spi) | |||
824 | 822 | ||
825 | out_lcd_unregister: | 823 | out_lcd_unregister: |
826 | lcd_device_unregister(ld); | 824 | lcd_device_unregister(ld); |
827 | out_free_lcd: | ||
828 | kfree(lcd); | ||
829 | return ret; | 825 | return ret; |
830 | } | 826 | } |
831 | 827 | ||
@@ -838,7 +834,6 @@ static int __devexit s6e63m0_remove(struct spi_device *spi) | |||
838 | device_remove_file(&spi->dev, &dev_attr_gamma_mode); | 834 | device_remove_file(&spi->dev, &dev_attr_gamma_mode); |
839 | backlight_device_unregister(lcd->bd); | 835 | backlight_device_unregister(lcd->bd); |
840 | lcd_device_unregister(lcd->ld); | 836 | lcd_device_unregister(lcd->ld); |
841 | kfree(lcd); | ||
842 | 837 | ||
843 | return 0; | 838 | return 0; |
844 | } | 839 | } |
@@ -899,7 +894,6 @@ static void s6e63m0_shutdown(struct spi_device *spi) | |||
899 | static struct spi_driver s6e63m0_driver = { | 894 | static struct spi_driver s6e63m0_driver = { |
900 | .driver = { | 895 | .driver = { |
901 | .name = "s6e63m0", | 896 | .name = "s6e63m0", |
902 | .bus = &spi_bus_type, | ||
903 | .owner = THIS_MODULE, | 897 | .owner = THIS_MODULE, |
904 | }, | 898 | }, |
905 | .probe = s6e63m0_probe, | 899 | .probe = s6e63m0_probe, |
diff --git a/drivers/video/backlight/tdo24m.c b/drivers/video/backlight/tdo24m.c index 2368b8e5f89e..02444d042cd5 100644 --- a/drivers/video/backlight/tdo24m.c +++ b/drivers/video/backlight/tdo24m.c | |||
@@ -349,7 +349,7 @@ static int __devinit tdo24m_probe(struct spi_device *spi) | |||
349 | if (err) | 349 | if (err) |
350 | return err; | 350 | return err; |
351 | 351 | ||
352 | lcd = kzalloc(sizeof(struct tdo24m), GFP_KERNEL); | 352 | lcd = devm_kzalloc(&spi->dev, sizeof(struct tdo24m), GFP_KERNEL); |
353 | if (!lcd) | 353 | if (!lcd) |
354 | return -ENOMEM; | 354 | return -ENOMEM; |
355 | 355 | ||
@@ -357,11 +357,9 @@ static int __devinit tdo24m_probe(struct spi_device *spi) | |||
357 | lcd->power = FB_BLANK_POWERDOWN; | 357 | lcd->power = FB_BLANK_POWERDOWN; |
358 | lcd->mode = MODE_VGA; /* default to VGA */ | 358 | lcd->mode = MODE_VGA; /* default to VGA */ |
359 | 359 | ||
360 | lcd->buf = kmalloc(TDO24M_SPI_BUFF_SIZE, GFP_KERNEL); | 360 | lcd->buf = devm_kzalloc(&spi->dev, TDO24M_SPI_BUFF_SIZE, GFP_KERNEL); |
361 | if (lcd->buf == NULL) { | 361 | if (lcd->buf == NULL) |
362 | kfree(lcd); | ||
363 | return -ENOMEM; | 362 | return -ENOMEM; |
364 | } | ||
365 | 363 | ||
366 | m = &lcd->msg; | 364 | m = &lcd->msg; |
367 | x = &lcd->xfer; | 365 | x = &lcd->xfer; |
@@ -383,15 +381,13 @@ static int __devinit tdo24m_probe(struct spi_device *spi) | |||
383 | break; | 381 | break; |
384 | default: | 382 | default: |
385 | dev_err(&spi->dev, "Unsupported model"); | 383 | dev_err(&spi->dev, "Unsupported model"); |
386 | goto out_free; | 384 | return -EINVAL; |
387 | } | 385 | } |
388 | 386 | ||
389 | lcd->lcd_dev = lcd_device_register("tdo24m", &spi->dev, | 387 | lcd->lcd_dev = lcd_device_register("tdo24m", &spi->dev, |
390 | lcd, &tdo24m_ops); | 388 | lcd, &tdo24m_ops); |
391 | if (IS_ERR(lcd->lcd_dev)) { | 389 | if (IS_ERR(lcd->lcd_dev)) |
392 | err = PTR_ERR(lcd->lcd_dev); | 390 | return PTR_ERR(lcd->lcd_dev); |
393 | goto out_free; | ||
394 | } | ||
395 | 391 | ||
396 | dev_set_drvdata(&spi->dev, lcd); | 392 | dev_set_drvdata(&spi->dev, lcd); |
397 | err = tdo24m_power(lcd, FB_BLANK_UNBLANK); | 393 | err = tdo24m_power(lcd, FB_BLANK_UNBLANK); |
@@ -402,9 +398,6 @@ static int __devinit tdo24m_probe(struct spi_device *spi) | |||
402 | 398 | ||
403 | out_unregister: | 399 | out_unregister: |
404 | lcd_device_unregister(lcd->lcd_dev); | 400 | lcd_device_unregister(lcd->lcd_dev); |
405 | out_free: | ||
406 | kfree(lcd->buf); | ||
407 | kfree(lcd); | ||
408 | return err; | 401 | return err; |
409 | } | 402 | } |
410 | 403 | ||
@@ -414,8 +407,6 @@ static int __devexit tdo24m_remove(struct spi_device *spi) | |||
414 | 407 | ||
415 | tdo24m_power(lcd, FB_BLANK_POWERDOWN); | 408 | tdo24m_power(lcd, FB_BLANK_POWERDOWN); |
416 | lcd_device_unregister(lcd->lcd_dev); | 409 | lcd_device_unregister(lcd->lcd_dev); |
417 | kfree(lcd->buf); | ||
418 | kfree(lcd); | ||
419 | 410 | ||
420 | return 0; | 411 | return 0; |
421 | } | 412 | } |
diff --git a/drivers/video/backlight/tosa_bl.c b/drivers/video/backlight/tosa_bl.c index 2b241abced43..0d54e607e82d 100644 --- a/drivers/video/backlight/tosa_bl.c +++ b/drivers/video/backlight/tosa_bl.c | |||
@@ -82,8 +82,11 @@ static int __devinit tosa_bl_probe(struct i2c_client *client, | |||
82 | const struct i2c_device_id *id) | 82 | const struct i2c_device_id *id) |
83 | { | 83 | { |
84 | struct backlight_properties props; | 84 | struct backlight_properties props; |
85 | struct tosa_bl_data *data = kzalloc(sizeof(struct tosa_bl_data), GFP_KERNEL); | 85 | struct tosa_bl_data *data; |
86 | int ret = 0; | 86 | int ret = 0; |
87 | |||
88 | data = devm_kzalloc(&client->dev, sizeof(struct tosa_bl_data), | ||
89 | GFP_KERNEL); | ||
87 | if (!data) | 90 | if (!data) |
88 | return -ENOMEM; | 91 | return -ENOMEM; |
89 | 92 | ||
@@ -92,7 +95,7 @@ static int __devinit tosa_bl_probe(struct i2c_client *client, | |||
92 | ret = gpio_request(TOSA_GPIO_BL_C20MA, "backlight"); | 95 | ret = gpio_request(TOSA_GPIO_BL_C20MA, "backlight"); |
93 | if (ret) { | 96 | if (ret) { |
94 | dev_dbg(&data->bl->dev, "Unable to request gpio!\n"); | 97 | dev_dbg(&data->bl->dev, "Unable to request gpio!\n"); |
95 | goto err_gpio_bl; | 98 | return ret; |
96 | } | 99 | } |
97 | ret = gpio_direction_output(TOSA_GPIO_BL_C20MA, 0); | 100 | ret = gpio_direction_output(TOSA_GPIO_BL_C20MA, 0); |
98 | if (ret) | 101 | if (ret) |
@@ -122,8 +125,6 @@ err_reg: | |||
122 | data->bl = NULL; | 125 | data->bl = NULL; |
123 | err_gpio_dir: | 126 | err_gpio_dir: |
124 | gpio_free(TOSA_GPIO_BL_C20MA); | 127 | gpio_free(TOSA_GPIO_BL_C20MA); |
125 | err_gpio_bl: | ||
126 | kfree(data); | ||
127 | return ret; | 128 | return ret; |
128 | } | 129 | } |
129 | 130 | ||
@@ -136,8 +137,6 @@ static int __devexit tosa_bl_remove(struct i2c_client *client) | |||
136 | 137 | ||
137 | gpio_free(TOSA_GPIO_BL_C20MA); | 138 | gpio_free(TOSA_GPIO_BL_C20MA); |
138 | 139 | ||
139 | kfree(data); | ||
140 | |||
141 | return 0; | 140 | return 0; |
142 | } | 141 | } |
143 | 142 | ||
diff --git a/drivers/video/backlight/tosa_lcd.c b/drivers/video/backlight/tosa_lcd.c index 2231aec23918..47823b8efff0 100644 --- a/drivers/video/backlight/tosa_lcd.c +++ b/drivers/video/backlight/tosa_lcd.c | |||
@@ -174,7 +174,8 @@ static int __devinit tosa_lcd_probe(struct spi_device *spi) | |||
174 | int ret; | 174 | int ret; |
175 | struct tosa_lcd_data *data; | 175 | struct tosa_lcd_data *data; |
176 | 176 | ||
177 | data = kzalloc(sizeof(struct tosa_lcd_data), GFP_KERNEL); | 177 | data = devm_kzalloc(&spi->dev, sizeof(struct tosa_lcd_data), |
178 | GFP_KERNEL); | ||
178 | if (!data) | 179 | if (!data) |
179 | return -ENOMEM; | 180 | return -ENOMEM; |
180 | 181 | ||
@@ -187,7 +188,7 @@ static int __devinit tosa_lcd_probe(struct spi_device *spi) | |||
187 | 188 | ||
188 | ret = spi_setup(spi); | 189 | ret = spi_setup(spi); |
189 | if (ret < 0) | 190 | if (ret < 0) |
190 | goto err_spi; | 191 | return ret; |
191 | 192 | ||
192 | data->spi = spi; | 193 | data->spi = spi; |
193 | dev_set_drvdata(&spi->dev, data); | 194 | dev_set_drvdata(&spi->dev, data); |
@@ -224,8 +225,6 @@ err_gpio_dir: | |||
224 | gpio_free(TOSA_GPIO_TG_ON); | 225 | gpio_free(TOSA_GPIO_TG_ON); |
225 | err_gpio_tg: | 226 | err_gpio_tg: |
226 | dev_set_drvdata(&spi->dev, NULL); | 227 | dev_set_drvdata(&spi->dev, NULL); |
227 | err_spi: | ||
228 | kfree(data); | ||
229 | return ret; | 228 | return ret; |
230 | } | 229 | } |
231 | 230 | ||
@@ -242,7 +241,6 @@ static int __devexit tosa_lcd_remove(struct spi_device *spi) | |||
242 | 241 | ||
243 | gpio_free(TOSA_GPIO_TG_ON); | 242 | gpio_free(TOSA_GPIO_TG_ON); |
244 | dev_set_drvdata(&spi->dev, NULL); | 243 | dev_set_drvdata(&spi->dev, NULL); |
245 | kfree(data); | ||
246 | 244 | ||
247 | return 0; | 245 | return 0; |
248 | } | 246 | } |
diff --git a/drivers/video/backlight/wm831x_bl.c b/drivers/video/backlight/wm831x_bl.c index 5d365deb5f82..9e5517a3a52b 100644 --- a/drivers/video/backlight/wm831x_bl.c +++ b/drivers/video/backlight/wm831x_bl.c | |||
@@ -194,6 +194,7 @@ static int wm831x_backlight_probe(struct platform_device *pdev) | |||
194 | data->current_brightness = 0; | 194 | data->current_brightness = 0; |
195 | data->isink_reg = isink_reg; | 195 | data->isink_reg = isink_reg; |
196 | 196 | ||
197 | memset(&props, 0, sizeof(props)); | ||
197 | props.type = BACKLIGHT_RAW; | 198 | props.type = BACKLIGHT_RAW; |
198 | props.max_brightness = max_isel; | 199 | props.max_brightness = max_isel; |
199 | bl = backlight_device_register("wm831x", &pdev->dev, data, | 200 | bl = backlight_device_register("wm831x", &pdev->dev, data, |