diff options
Diffstat (limited to 'drivers/leds')
45 files changed, 335 insertions, 293 deletions
diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig index f508defc0d96..b58bc8a14b9c 100644 --- a/drivers/leds/Kconfig +++ b/drivers/leds/Kconfig @@ -379,7 +379,9 @@ config LEDS_NS2 tristate "LED support for Network Space v2 GPIO LEDs" depends on LEDS_CLASS depends on MACH_NETSPACE_V2 || MACH_INETSPACE_V2 || \ - MACH_NETSPACE_MAX_V2 || MACH_D2NET_V2 + MACH_NETSPACE_MAX_V2 || MACH_D2NET_V2 || \ + MACH_NETSPACE_V2_DT || MACH_INETSPACE_V2_DT || \ + MACH_NETSPACE_MAX_V2_DT || MACH_NETSPACE_MINI_V2_DT default y help This option enable support for the dual-GPIO LED found on the diff --git a/drivers/leds/led-class.c b/drivers/leds/led-class.c index 48cce18e9d6d..a20752f562bc 100644 --- a/drivers/leds/led-class.c +++ b/drivers/leds/led-class.c @@ -211,7 +211,7 @@ int led_classdev_register(struct device *parent, struct led_classdev *led_cdev) led_trigger_set_default(led_cdev); #endif - printk(KERN_DEBUG "Registered led device: %s\n", + dev_dbg(parent, "Registered led device: %s\n", led_cdev->name); return 0; diff --git a/drivers/leds/led-triggers.c b/drivers/leds/led-triggers.c index 262eb4193710..3c972b2f9893 100644 --- a/drivers/leds/led-triggers.c +++ b/drivers/leds/led-triggers.c @@ -166,6 +166,19 @@ void led_trigger_set_default(struct led_classdev *led_cdev) } EXPORT_SYMBOL_GPL(led_trigger_set_default); +void led_trigger_rename_static(const char *name, struct led_trigger *trig) +{ + /* new name must be on a temporary string to prevent races */ + BUG_ON(name == trig->name); + + down_write(&triggers_list_lock); + /* this assumes that trig->name was originaly allocated to + * non constant storage */ + strcpy((char *)trig->name, name); + up_write(&triggers_list_lock); +} +EXPORT_SYMBOL_GPL(led_trigger_rename_static); + /* LED Trigger Interface */ int led_trigger_register(struct led_trigger *trig) @@ -300,13 +313,13 @@ void led_trigger_register_simple(const char *name, struct led_trigger **tp) if (err < 0) { kfree(trig); trig = NULL; - printk(KERN_WARNING "LED trigger %s failed to register" - " (%d)\n", name, err); + pr_warn("LED trigger %s failed to register (%d)\n", + name, err); } - } else - printk(KERN_WARNING "LED trigger %s failed to register" - " (no memory)\n", name); - + } else { + pr_warn("LED trigger %s failed to register (no memory)\n", + name); + } *tp = trig; } EXPORT_SYMBOL_GPL(led_trigger_register_simple); diff --git a/drivers/leds/leds-88pm860x.c b/drivers/leds/leds-88pm860x.c index b7e8cc0957fc..6be2edd41173 100644 --- a/drivers/leds/leds-88pm860x.c +++ b/drivers/leds/leds-88pm860x.c @@ -165,15 +165,13 @@ static int pm860x_led_probe(struct platform_device *pdev) res = platform_get_resource_byname(pdev, IORESOURCE_REG, "control"); if (!res) { dev_err(&pdev->dev, "No REG resource for control\n"); - ret = -ENXIO; - goto out; + return -ENXIO; } data->reg_control = res->start; res = platform_get_resource_byname(pdev, IORESOURCE_REG, "blink"); if (!res) { dev_err(&pdev->dev, "No REG resource for blink\n"); - ret = -ENXIO; - goto out; + return -ENXIO; } data->reg_blink = res->start; memset(data->name, 0, MFD_NAME_SIZE); @@ -224,9 +222,6 @@ static int pm860x_led_probe(struct platform_device *pdev) } pm860x_led_set(&data->cdev, 0); return 0; -out: - devm_kfree(&pdev->dev, data); - return ret; } static int pm860x_led_remove(struct platform_device *pdev) diff --git a/drivers/leds/leds-adp5520.c b/drivers/leds/leds-adp5520.c index aa56a867693a..e8072abe76e5 100644 --- a/drivers/leds/leds-adp5520.c +++ b/drivers/leds/leds-adp5520.c @@ -5,10 +5,10 @@ * * Loosely derived from leds-da903x: * Copyright (C) 2008 Compulab, Ltd. - * Mike Rapoport <mike@compulab.co.il> + * Mike Rapoport <mike@compulab.co.il> * * Copyright (C) 2006-2008 Marvell International Ltd. - * Eric Miao <eric.miao@marvell.com> + * Eric Miao <eric.miao@marvell.com> * * Licensed under the GPL-2 or later. */ @@ -85,7 +85,7 @@ static int adp5520_led_setup(struct adp5520_led *led) return ret; } -static int __devinit adp5520_led_prepare(struct platform_device *pdev) +static int adp5520_led_prepare(struct platform_device *pdev) { struct adp5520_leds_platform_data *pdata = pdev->dev.platform_data; struct device *dev = pdev->dev.parent; @@ -101,7 +101,7 @@ static int __devinit adp5520_led_prepare(struct platform_device *pdev) return ret; } -static int __devinit adp5520_led_probe(struct platform_device *pdev) +static int adp5520_led_probe(struct platform_device *pdev) { struct adp5520_leds_platform_data *pdata = pdev->dev.platform_data; struct adp5520_led *led, *led_dat; @@ -183,7 +183,7 @@ err: return ret; } -static int __devexit adp5520_led_remove(struct platform_device *pdev) +static int adp5520_led_remove(struct platform_device *pdev) { struct adp5520_leds_platform_data *pdata = pdev->dev.platform_data; struct adp5520_led *led; @@ -208,7 +208,7 @@ static struct platform_driver adp5520_led_driver = { .owner = THIS_MODULE, }, .probe = adp5520_led_probe, - .remove = __devexit_p(adp5520_led_remove), + .remove = adp5520_led_remove, }; module_platform_driver(adp5520_led_driver); diff --git a/drivers/leds/leds-asic3.c b/drivers/leds/leds-asic3.c index 5de74ff90dcf..b474745e001b 100644 --- a/drivers/leds/leds-asic3.c +++ b/drivers/leds/leds-asic3.c @@ -92,7 +92,7 @@ static int blink_set(struct led_classdev *cdev, return 0; } -static int __devinit asic3_led_probe(struct platform_device *pdev) +static int asic3_led_probe(struct platform_device *pdev) { struct asic3_led *led = pdev->dev.platform_data; int ret; @@ -125,7 +125,7 @@ out: return ret; } -static int __devexit asic3_led_remove(struct platform_device *pdev) +static int asic3_led_remove(struct platform_device *pdev) { struct asic3_led *led = pdev->dev.platform_data; @@ -167,7 +167,7 @@ static const struct dev_pm_ops asic3_led_pm_ops = { static struct platform_driver asic3_led_driver = { .probe = asic3_led_probe, - .remove = __devexit_p(asic3_led_remove), + .remove = asic3_led_remove, .driver = { .name = "leds-asic3", .owner = THIS_MODULE, diff --git a/drivers/leds/leds-atmel-pwm.c b/drivers/leds/leds-atmel-pwm.c index 45430632faab..386773532d95 100644 --- a/drivers/leds/leds-atmel-pwm.c +++ b/drivers/leds/leds-atmel-pwm.c @@ -35,7 +35,7 @@ static void pwmled_brightness(struct led_classdev *cdev, enum led_brightness b) * NOTE: we reuse the platform_data structure of GPIO leds, * but repurpose its "gpio" number as a PWM channel number. */ -static int __devinit pwmled_probe(struct platform_device *pdev) +static int pwmled_probe(struct platform_device *pdev) { const struct gpio_led_platform_data *pdata; struct pwmled *leds; diff --git a/drivers/leds/leds-bd2802.c b/drivers/leds/leds-bd2802.c index 89ca6a2a19d1..851517030cc1 100644 --- a/drivers/leds/leds-bd2802.c +++ b/drivers/leds/leds-bd2802.c @@ -26,8 +26,8 @@ #define BD2802_LED_OFFSET 0xa #define BD2802_COLOR_OFFSET 0x3 -#define BD2802_REG_CLKSETUP 0x00 -#define BD2802_REG_CONTROL 0x01 +#define BD2802_REG_CLKSETUP 0x00 +#define BD2802_REG_CONTROL 0x01 #define BD2802_REG_HOURSETUP 0x02 #define BD2802_REG_CURRENT1SETUP 0x03 #define BD2802_REG_CURRENT2SETUP 0x04 @@ -93,7 +93,7 @@ struct bd2802_led { * In ADF mode, user can set registers of BD2802GU directly, * therefore BD2802GU doesn't enter reset state. */ - int adf_on; + int adf_on; enum led_ids led_id; enum led_colors color; @@ -328,7 +328,7 @@ static ssize_t bd2802_store_reg##reg_addr(struct device *dev, \ int ret; \ if (!count) \ return -EINVAL; \ - ret = strict_strtoul(buf, 16, &val); \ + ret = kstrtoul(buf, 16, &val); \ if (ret) \ return ret; \ down_write(&led->rwsem); \ @@ -492,7 +492,7 @@ static ssize_t bd2802_store_##attr_name(struct device *dev, \ int ret; \ if (!count) \ return -EINVAL; \ - ret = strict_strtoul(buf, 16, &val); \ + ret = kstrtoul(buf, 16, &val); \ if (ret) \ return ret; \ down_write(&led->rwsem); \ @@ -670,7 +670,7 @@ static void bd2802_unregister_led_classdev(struct bd2802_led *led) led_classdev_unregister(&led->cdev_led1r); } -static int __devinit bd2802_probe(struct i2c_client *client, +static int bd2802_probe(struct i2c_client *client, const struct i2c_device_id *id) { struct bd2802_led *led; diff --git a/drivers/leds/leds-blinkm.c b/drivers/leds/leds-blinkm.c index f7c3d7f1ec52..a502678cc7f5 100644 --- a/drivers/leds/leds-blinkm.c +++ b/drivers/leds/leds-blinkm.c @@ -632,7 +632,7 @@ static int blinkm_detect(struct i2c_client *client, struct i2c_board_info *info) return 0; } -static int __devinit blinkm_probe(struct i2c_client *client, +static int blinkm_probe(struct i2c_client *client, const struct i2c_device_id *id) { struct blinkm_data *data; @@ -743,7 +743,7 @@ exit: return err; } -static int __devexit blinkm_remove(struct i2c_client *client) +static int blinkm_remove(struct i2c_client *client) { struct blinkm_data *data = i2c_get_clientdata(client); int ret = 0; @@ -801,7 +801,7 @@ static struct i2c_driver blinkm_driver = { .name = "blinkm", }, .probe = blinkm_probe, - .remove = __devexit_p(blinkm_remove), + .remove = blinkm_remove, .id_table = blinkm_id, .detect = blinkm_detect, .address_list = normal_i2c, diff --git a/drivers/leds/leds-clevo-mail.c b/drivers/leds/leds-clevo-mail.c index e024b0b1c3b1..6a8405df76a3 100644 --- a/drivers/leds/leds-clevo-mail.c +++ b/drivers/leds/leds-clevo-mail.c @@ -1,3 +1,4 @@ +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt #include <linux/module.h> @@ -26,7 +27,7 @@ static struct platform_device *pdev; static int __init clevo_mail_led_dmi_callback(const struct dmi_system_id *id) { - printk(KERN_INFO KBUILD_MODNAME ": '%s' found\n", id->ident); + pr_info("'%s' found\n", id->ident); return 1; } @@ -135,8 +136,7 @@ static int clevo_mail_led_blink(struct led_classdev *led_cdev, status = 0; } else { - printk(KERN_DEBUG KBUILD_MODNAME - ": clevo_mail_led_blink(..., %lu, %lu)," + pr_debug("clevo_mail_led_blink(..., %lu, %lu)," " returning -EINVAL (unsupported)\n", *delay_on, *delay_off); } @@ -153,7 +153,7 @@ static struct led_classdev clevo_mail_led = { .flags = LED_CORE_SUSPENDRESUME, }; -static int __devinit clevo_mail_led_probe(struct platform_device *pdev) +static int clevo_mail_led_probe(struct platform_device *pdev) { return led_classdev_register(&pdev->dev, &clevo_mail_led); } @@ -183,7 +183,7 @@ static int __init clevo_mail_led_init(void) count = dmi_check_system(clevo_mail_led_dmi_table); } else { count = 1; - printk(KERN_ERR KBUILD_MODNAME ": Skipping DMI detection. " + pr_err("Skipping DMI detection. " "If the driver works on your hardware please " "report model and the output of dmidecode in tracker " "at http://sourceforge.net/projects/clevo-mailled/\n"); @@ -197,8 +197,7 @@ static int __init clevo_mail_led_init(void) error = platform_driver_probe(&clevo_mail_led_driver, clevo_mail_led_probe); if (error) { - printk(KERN_ERR KBUILD_MODNAME - ": Can't probe platform driver\n"); + pr_err("Can't probe platform driver\n"); platform_device_unregister(pdev); } } else diff --git a/drivers/leds/leds-cobalt-qube.c b/drivers/leds/leds-cobalt-qube.c index 6a8725cc7b4d..8abcb66db01c 100644 --- a/drivers/leds/leds-cobalt-qube.c +++ b/drivers/leds/leds-cobalt-qube.c @@ -34,7 +34,7 @@ static struct led_classdev qube_front_led = { .default_trigger = "default-on", }; -static int __devinit cobalt_qube_led_probe(struct platform_device *pdev) +static int cobalt_qube_led_probe(struct platform_device *pdev) { struct resource *res; int retval; @@ -43,7 +43,7 @@ static int __devinit cobalt_qube_led_probe(struct platform_device *pdev) if (!res) return -EBUSY; - led_port = ioremap(res->start, resource_size(res)); + led_port = devm_ioremap(&pdev->dev, res->start, resource_size(res)); if (!led_port) return -ENOMEM; @@ -52,32 +52,29 @@ static int __devinit cobalt_qube_led_probe(struct platform_device *pdev) retval = led_classdev_register(&pdev->dev, &qube_front_led); if (retval) - goto err_iounmap; + goto err_null; return 0; -err_iounmap: - iounmap(led_port); +err_null: led_port = NULL; return retval; } -static int __devexit cobalt_qube_led_remove(struct platform_device *pdev) +static int cobalt_qube_led_remove(struct platform_device *pdev) { led_classdev_unregister(&qube_front_led); - if (led_port) { - iounmap(led_port); + if (led_port) led_port = NULL; - } return 0; } static struct platform_driver cobalt_qube_led_driver = { .probe = cobalt_qube_led_probe, - .remove = __devexit_p(cobalt_qube_led_remove), + .remove = cobalt_qube_led_remove, .driver = { .name = "cobalt-qube-leds", .owner = THIS_MODULE, diff --git a/drivers/leds/leds-cobalt-raq.c b/drivers/leds/leds-cobalt-raq.c index aac1c073fe7b..001088b31373 100644 --- a/drivers/leds/leds-cobalt-raq.c +++ b/drivers/leds/leds-cobalt-raq.c @@ -76,7 +76,7 @@ static struct led_classdev raq_power_off_led = { .default_trigger = "power-off", }; -static int __devinit cobalt_raq_led_probe(struct platform_device *pdev) +static int cobalt_raq_led_probe(struct platform_device *pdev) { struct resource *res; int retval; @@ -85,13 +85,13 @@ static int __devinit cobalt_raq_led_probe(struct platform_device *pdev) if (!res) return -EBUSY; - led_port = ioremap(res->start, resource_size(res)); + led_port = devm_ioremap(&pdev->dev, res->start, resource_size(res)); if (!led_port) return -ENOMEM; retval = led_classdev_register(&pdev->dev, &raq_power_off_led); if (retval) - goto err_iounmap; + goto err_null; retval = led_classdev_register(&pdev->dev, &raq_web_led); if (retval) @@ -102,29 +102,26 @@ static int __devinit cobalt_raq_led_probe(struct platform_device *pdev) err_unregister: led_classdev_unregister(&raq_power_off_led); -err_iounmap: - iounmap(led_port); +err_null: led_port = NULL; return retval; } -static int __devexit cobalt_raq_led_remove(struct platform_device *pdev) +static int cobalt_raq_led_remove(struct platform_device *pdev) { led_classdev_unregister(&raq_power_off_led); led_classdev_unregister(&raq_web_led); - if (led_port) { - iounmap(led_port); + if (led_port) led_port = NULL; - } return 0; } static struct platform_driver cobalt_raq_led_driver = { .probe = cobalt_raq_led_probe, - .remove = __devexit_p(cobalt_raq_led_remove), + .remove = cobalt_raq_led_remove, .driver = { .name = "cobalt-raq-leds", .owner = THIS_MODULE, diff --git a/drivers/leds/leds-da903x.c b/drivers/leds/leds-da903x.c index cc77c9d92615..c263a21db829 100644 --- a/drivers/leds/leds-da903x.c +++ b/drivers/leds/leds-da903x.c @@ -2,10 +2,10 @@ * LEDs driver for Dialog Semiconductor DA9030/DA9034 * * Copyright (C) 2008 Compulab, Ltd. - * Mike Rapoport <mike@compulab.co.il> + * Mike Rapoport <mike@compulab.co.il> * * Copyright (C) 2006-2008 Marvell International Ltd. - * Eric Miao <eric.miao@marvell.com> + * Eric Miao <eric.miao@marvell.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as @@ -85,13 +85,13 @@ static void da903x_led_set(struct led_classdev *led_cdev, enum led_brightness value) { struct da903x_led *led; - + led = container_of(led_cdev, struct da903x_led, cdev); led->new_brightness = value; schedule_work(&led->work); } -static int __devinit da903x_led_probe(struct platform_device *pdev) +static int da903x_led_probe(struct platform_device *pdev) { struct led_info *pdata = pdev->dev.platform_data; struct da903x_led *led; @@ -136,7 +136,7 @@ static int __devinit da903x_led_probe(struct platform_device *pdev) return 0; } -static int __devexit da903x_led_remove(struct platform_device *pdev) +static int da903x_led_remove(struct platform_device *pdev) { struct da903x_led *led = platform_get_drvdata(pdev); @@ -150,13 +150,13 @@ static struct platform_driver da903x_led_driver = { .owner = THIS_MODULE, }, .probe = da903x_led_probe, - .remove = __devexit_p(da903x_led_remove), + .remove = da903x_led_remove, }; module_platform_driver(da903x_led_driver); MODULE_DESCRIPTION("LEDs driver for Dialog Semiconductor DA9030/DA9034"); -MODULE_AUTHOR("Eric Miao <eric.miao@marvell.com>" - "Mike Rapoport <mike@compulab.co.il>"); +MODULE_AUTHOR("Eric Miao <eric.miao@marvell.com>"); +MODULE_AUTHOR("Mike Rapoport <mike@compulab.co.il>"); MODULE_LICENSE("GPL"); MODULE_ALIAS("platform:da903x-led"); diff --git a/drivers/leds/leds-da9052.c b/drivers/leds/leds-da9052.c index 58a5244c437e..efec43344e9f 100644 --- a/drivers/leds/leds-da9052.c +++ b/drivers/leds/leds-da9052.c @@ -102,7 +102,7 @@ static int da9052_configure_leds(struct da9052 *da9052) return error; } -static int __devinit da9052_led_probe(struct platform_device *pdev) +static int da9052_led_probe(struct platform_device *pdev) { struct da9052_pdata *pdata; struct da9052 *da9052; @@ -176,7 +176,7 @@ err: return error; } -static int __devexit da9052_led_remove(struct platform_device *pdev) +static int da9052_led_remove(struct platform_device *pdev) { struct da9052_led *led = platform_get_drvdata(pdev); struct da9052_pdata *pdata; @@ -204,7 +204,7 @@ static struct platform_driver da9052_led_driver = { .owner = THIS_MODULE, }, .probe = da9052_led_probe, - .remove = __devexit_p(da9052_led_remove), + .remove = da9052_led_remove, }; module_platform_driver(da9052_led_driver); diff --git a/drivers/leds/leds-fsg.c b/drivers/leds/leds-fsg.c index b9053fa6e253..b4d5a44cc41b 100644 --- a/drivers/leds/leds-fsg.c +++ b/drivers/leds/leds-fsg.c @@ -20,8 +20,8 @@ #include <linux/platform_device.h> #include <linux/leds.h> #include <linux/module.h> +#include <linux/io.h> #include <mach/hardware.h> -#include <asm/io.h> #define FSG_LED_WLAN_BIT 0 #define FSG_LED_WAN_BIT 1 @@ -149,11 +149,10 @@ static int fsg_led_probe(struct platform_device *pdev) int ret; /* Map the LED chip select address space */ - latch_address = (unsigned short *) ioremap(IXP4XX_EXP_BUS_BASE(2), 512); - if (!latch_address) { - ret = -ENOMEM; - goto failremap; - } + latch_address = (unsigned short *) devm_ioremap(&pdev->dev, + IXP4XX_EXP_BUS_BASE(2), 512); + if (!latch_address) + return -ENOMEM; latch_value = 0xffff; *latch_address = latch_value; @@ -195,8 +194,6 @@ static int fsg_led_probe(struct platform_device *pdev) failwan: led_classdev_unregister(&fsg_wlan_led); failwlan: - iounmap(latch_address); - failremap: return ret; } @@ -210,8 +207,6 @@ static int fsg_led_remove(struct platform_device *pdev) led_classdev_unregister(&fsg_sync_led); led_classdev_unregister(&fsg_ring_led); - iounmap(latch_address); - return 0; } diff --git a/drivers/leds/leds-gpio.c b/drivers/leds/leds-gpio.c index 087d1e66f4f7..1885a26776b1 100644 --- a/drivers/leds/leds-gpio.c +++ b/drivers/leds/leds-gpio.c @@ -21,6 +21,7 @@ #include <linux/workqueue.h> #include <linux/module.h> #include <linux/pinctrl/consumer.h> +#include <linux/err.h> struct gpio_led_data { struct led_classdev cdev; @@ -91,7 +92,7 @@ static int gpio_blink_set(struct led_classdev *led_cdev, delay_on, delay_off); } -static int __devinit create_gpio_led(const struct gpio_led *template, +static int create_gpio_led(const struct gpio_led *template, struct gpio_led_data *led_dat, struct device *parent, int (*blink_set)(unsigned, int, unsigned long *, unsigned long *)) { @@ -101,15 +102,11 @@ static int __devinit create_gpio_led(const struct gpio_led *template, /* skip leds that aren't available */ if (!gpio_is_valid(template->gpio)) { - printk(KERN_INFO "Skipping unavailable LED gpio %d (%s)\n", + dev_info(parent, "Skipping unavailable LED gpio %d (%s)\n", template->gpio, template->name); return 0; } - ret = gpio_request(template->gpio, template->name); - if (ret < 0) - return ret; - led_dat->cdev.name = template->name; led_dat->cdev.default_trigger = template->default_trigger; led_dat->gpio = template->gpio; @@ -129,20 +126,19 @@ static int __devinit create_gpio_led(const struct gpio_led *template, if (!template->retain_state_suspended) led_dat->cdev.flags |= LED_CORE_SUSPENDRESUME; - ret = gpio_direction_output(led_dat->gpio, led_dat->active_low ^ state); + ret = devm_gpio_request_one(parent, template->gpio, + GPIOF_DIR_OUT | (led_dat->active_low ^ state), + template->name); if (ret < 0) - goto err; - + return ret; + INIT_WORK(&led_dat->work, gpio_led_work); ret = led_classdev_register(parent, &led_dat->cdev); if (ret < 0) - goto err; + return ret; return 0; -err: - gpio_free(led_dat->gpio); - return ret; } static void delete_gpio_led(struct gpio_led_data *led) @@ -151,7 +147,6 @@ static void delete_gpio_led(struct gpio_led_data *led) return; led_classdev_unregister(&led->cdev); cancel_work_sync(&led->work); - gpio_free(led->gpio); } struct gpio_leds_priv { @@ -167,7 +162,7 @@ static inline int sizeof_gpio_leds_priv(int num_leds) /* Code to create from OpenFirmware platform devices */ #ifdef CONFIG_OF_GPIO -static struct gpio_leds_priv * __devinit gpio_leds_create_of(struct platform_device *pdev) +static struct gpio_leds_priv *gpio_leds_create_of(struct platform_device *pdev) { struct device_node *np = pdev->dev.of_node, *child; struct gpio_leds_priv *priv; @@ -176,12 +171,16 @@ static struct gpio_leds_priv * __devinit gpio_leds_create_of(struct platform_dev /* count LEDs in this device, so we know how much to allocate */ count = of_get_child_count(np); if (!count) - return NULL; + return ERR_PTR(-ENODEV); + + for_each_child_of_node(np, child) + if (of_get_gpio(child, 0) == -EPROBE_DEFER) + return ERR_PTR(-EPROBE_DEFER); priv = devm_kzalloc(&pdev->dev, sizeof_gpio_leds_priv(count), GFP_KERNEL); if (!priv) - return NULL; + return ERR_PTR(-ENOMEM); for_each_child_of_node(np, child) { struct gpio_led led = {}; @@ -216,7 +215,7 @@ static struct gpio_leds_priv * __devinit gpio_leds_create_of(struct platform_dev err: for (count = priv->num_leds - 2; count >= 0; count--) delete_gpio_led(&priv->leds[count]); - return NULL; + return ERR_PTR(-ENODEV); } static const struct of_device_id of_gpio_leds_match[] = { @@ -224,14 +223,14 @@ static const struct of_device_id of_gpio_leds_match[] = { {}, }; #else /* CONFIG_OF_GPIO */ -static struct gpio_leds_priv * __devinit gpio_leds_create_of(struct platform_device *pdev) +static struct gpio_leds_priv *gpio_leds_create_of(struct platform_device *pdev) { - return NULL; + return ERR_PTR(-ENODEV); } #endif /* CONFIG_OF_GPIO */ -static int __devinit gpio_led_probe(struct platform_device *pdev) +static int gpio_led_probe(struct platform_device *pdev) { struct gpio_led_platform_data *pdata = pdev->dev.platform_data; struct gpio_leds_priv *priv; @@ -264,8 +263,8 @@ static int __devinit gpio_led_probe(struct platform_device *pdev) } } else { priv = gpio_leds_create_of(pdev); - if (!priv) - return -ENODEV; + if (IS_ERR(priv)) + return PTR_ERR(priv); } platform_set_drvdata(pdev, priv); @@ -273,7 +272,7 @@ static int __devinit gpio_led_probe(struct platform_device *pdev) return 0; } -static int __devexit gpio_led_remove(struct platform_device *pdev) +static int gpio_led_remove(struct platform_device *pdev) { struct gpio_leds_priv *priv = platform_get_drvdata(pdev); int i; @@ -288,7 +287,7 @@ static int __devexit gpio_led_remove(struct platform_device *pdev) static struct platform_driver gpio_led_driver = { .probe = gpio_led_probe, - .remove = __devexit_p(gpio_led_remove), + .remove = gpio_led_remove, .driver = { .name = "leds-gpio", .owner = THIS_MODULE, diff --git a/drivers/leds/leds-lm3530.c b/drivers/leds/leds-lm3530.c index b26306f6724d..214145483836 100644 --- a/drivers/leds/leds-lm3530.c +++ b/drivers/leds/leds-lm3530.c @@ -377,7 +377,7 @@ static ssize_t lm3530_mode_set(struct device *dev, struct device_attribute } static DEVICE_ATTR(mode, 0644, lm3530_mode_get, lm3530_mode_set); -static int __devinit lm3530_probe(struct i2c_client *client, +static int lm3530_probe(struct i2c_client *client, const struct i2c_device_id *id) { struct lm3530_platform_data *pdata = client->dev.platform_data; @@ -452,7 +452,7 @@ err_create_file: return err; } -static int __devexit lm3530_remove(struct i2c_client *client) +static int lm3530_remove(struct i2c_client *client) { struct lm3530_data *drvdata = i2c_get_clientdata(client); @@ -472,7 +472,7 @@ MODULE_DEVICE_TABLE(i2c, lm3530_id); static struct i2c_driver lm3530_i2c_driver = { .probe = lm3530_probe, - .remove = __devexit_p(lm3530_remove), + .remove = lm3530_remove, .id_table = lm3530_id, .driver = { .name = LM3530_NAME, diff --git a/drivers/leds/leds-lm3533.c b/drivers/leds/leds-lm3533.c index f6837b99908c..bbf24d038a7f 100644 --- a/drivers/leds/leds-lm3533.c +++ b/drivers/leds/leds-lm3533.c @@ -646,7 +646,7 @@ static struct attribute_group lm3533_led_attribute_group = { .attrs = lm3533_led_attributes }; -static int __devinit lm3533_led_setup(struct lm3533_led *led, +static int lm3533_led_setup(struct lm3533_led *led, struct lm3533_led_platform_data *pdata) { int ret; @@ -658,7 +658,7 @@ static int __devinit lm3533_led_setup(struct lm3533_led *led, return lm3533_ctrlbank_set_pwm(&led->cb, pdata->pwm); } -static int __devinit lm3533_led_probe(struct platform_device *pdev) +static int lm3533_led_probe(struct platform_device *pdev) { struct lm3533 *lm3533; struct lm3533_led_platform_data *pdata; @@ -742,7 +742,7 @@ err_unregister: return ret; } -static int __devexit lm3533_led_remove(struct platform_device *pdev) +static int lm3533_led_remove(struct platform_device *pdev) { struct lm3533_led *led = platform_get_drvdata(pdev); @@ -774,7 +774,7 @@ static struct platform_driver lm3533_led_driver = { .owner = THIS_MODULE, }, .probe = lm3533_led_probe, - .remove = __devexit_p(lm3533_led_remove), + .remove = lm3533_led_remove, .shutdown = lm3533_led_shutdown, }; module_platform_driver(lm3533_led_driver); diff --git a/drivers/leds/leds-lm355x.c b/drivers/leds/leds-lm355x.c index 065ec015d67a..65d79284c488 100644 --- a/drivers/leds/leds-lm355x.c +++ b/drivers/leds/leds-lm355x.c @@ -168,7 +168,7 @@ static char lm355x_name[][I2C_NAME_SIZE] = { }; /* chip initialize */ -static int __devinit lm355x_chip_init(struct lm355x_chip_data *chip) +static int lm355x_chip_init(struct lm355x_chip_data *chip) { int ret; unsigned int reg_val; @@ -408,10 +408,10 @@ static ssize_t lm3556_indicator_pattern_store(struct device *dev, return size; out: dev_err(chip->dev, "%s:i2c access fail to register\n", __func__); - return size; + return ret; } -static DEVICE_ATTR(pattern, 0666, NULL, lm3556_indicator_pattern_store); +static DEVICE_ATTR(pattern, S_IWUSR, NULL, lm3556_indicator_pattern_store); static const struct regmap_config lm355x_regmap = { .reg_bits = 8, @@ -420,7 +420,7 @@ static const struct regmap_config lm355x_regmap = { }; /* module initialize */ -static int __devinit lm355x_probe(struct i2c_client *client, +static int lm355x_probe(struct i2c_client *client, const struct i2c_device_id *id) { struct lm355x_platform_data *pdata = client->dev.platform_data; @@ -526,7 +526,7 @@ err_out: return err; } -static int __devexit lm355x_remove(struct i2c_client *client) +static int lm355x_remove(struct i2c_client *client) { struct lm355x_chip_data *chip = i2c_get_clientdata(client); struct lm355x_reg_data *preg = chip->regs; @@ -560,7 +560,7 @@ static struct i2c_driver lm355x_i2c_driver = { .pm = NULL, }, .probe = lm355x_probe, - .remove = __devexit_p(lm355x_remove), + .remove = lm355x_remove, .id_table = lm355x_id, }; diff --git a/drivers/leds/leds-lm3642.c b/drivers/leds/leds-lm3642.c index 3285006e9888..07b3dde90613 100644 --- a/drivers/leds/leds-lm3642.c +++ b/drivers/leds/leds-lm3642.c @@ -93,7 +93,7 @@ struct lm3642_chip_data { }; /* chip initialize */ -static int __devinit lm3642_chip_init(struct lm3642_chip_data *chip) +static int lm3642_chip_init(struct lm3642_chip_data *chip) { int ret; struct lm3642_platform_data *pdata = chip->pdata; @@ -201,13 +201,13 @@ static ssize_t lm3642_torch_pin_store(struct device *dev, return size; out: dev_err(chip->dev, "%s:i2c access fail to register\n", __func__); - return size; + return ret; out_strtoint: dev_err(chip->dev, "%s: fail to change str to int\n", __func__); - return size; + return ret; } -static DEVICE_ATTR(torch_pin, 0666, NULL, lm3642_torch_pin_store); +static DEVICE_ATTR(torch_pin, S_IWUSR, NULL, lm3642_torch_pin_store); static void lm3642_deferred_torch_brightness_set(struct work_struct *work) { @@ -258,13 +258,13 @@ static ssize_t lm3642_strobe_pin_store(struct device *dev, return size; out: dev_err(chip->dev, "%s:i2c access fail to register\n", __func__); - return size; + return ret; out_strtoint: dev_err(chip->dev, "%s: fail to change str to int\n", __func__); - return size; + return ret; } -static DEVICE_ATTR(strobe_pin, 0666, NULL, lm3642_strobe_pin_store); +static DEVICE_ATTR(strobe_pin, S_IWUSR, NULL, lm3642_strobe_pin_store); static void lm3642_deferred_strobe_brightness_set(struct work_struct *work) { @@ -313,7 +313,7 @@ static const struct regmap_config lm3642_regmap = { .max_register = REG_MAX, }; -static int __devinit lm3642_probe(struct i2c_client *client, +static int lm3642_probe(struct i2c_client *client, const struct i2c_device_id *id) { struct lm3642_platform_data *pdata = client->dev.platform_data; @@ -420,7 +420,7 @@ err_out: return err; } -static int __devexit lm3642_remove(struct i2c_client *client) +static int lm3642_remove(struct i2c_client *client) { struct lm3642_chip_data *chip = i2c_get_clientdata(client); @@ -450,7 +450,7 @@ static struct i2c_driver lm3642_i2c_driver = { .pm = NULL, }, .probe = lm3642_probe, - .remove = __devexit_p(lm3642_remove), + .remove = lm3642_remove, .id_table = lm3642_id, }; diff --git a/drivers/leds/leds-lp3944.c b/drivers/leds/leds-lp3944.c index c298f7d9f535..0c4386e656c1 100644 --- a/drivers/leds/leds-lp3944.c +++ b/drivers/leds/leds-lp3944.c @@ -86,7 +86,7 @@ static int lp3944_reg_read(struct i2c_client *client, u8 reg, u8 *value) tmp = i2c_smbus_read_byte_data(client, reg); if (tmp < 0) - return -EINVAL; + return tmp; *value = tmp; @@ -374,7 +374,7 @@ exit: return err; } -static int __devinit lp3944_probe(struct i2c_client *client, +static int lp3944_probe(struct i2c_client *client, const struct i2c_device_id *id) { struct lp3944_platform_data *lp3944_pdata = client->dev.platform_data; @@ -411,7 +411,7 @@ static int __devinit lp3944_probe(struct i2c_client *client, return 0; } -static int __devexit lp3944_remove(struct i2c_client *client) +static int lp3944_remove(struct i2c_client *client) { struct lp3944_platform_data *pdata = client->dev.platform_data; struct lp3944_data *data = i2c_get_clientdata(client); @@ -446,7 +446,7 @@ static struct i2c_driver lp3944_driver = { .name = "lp3944", }, .probe = lp3944_probe, - .remove = __devexit_p(lp3944_remove), + .remove = lp3944_remove, .id_table = lp3944_id, }; diff --git a/drivers/leds/leds-lp5521.c b/drivers/leds/leds-lp5521.c index 2064aefedc07..cb8a5220200b 100644 --- a/drivers/leds/leds-lp5521.c +++ b/drivers/leds/leds-lp5521.c @@ -152,7 +152,7 @@ static int lp5521_read(struct i2c_client *client, u8 reg, u8 *buf) ret = i2c_smbus_read_byte_data(client, reg); if (ret < 0) - return -EIO; + return ret; *buf = ret; return 0; @@ -616,7 +616,7 @@ static ssize_t store_led_pattern(struct device *dev, unsigned long val; int ret; - ret = strict_strtoul(buf, 16, &val); + ret = kstrtoul(buf, 16, &val); if (ret) return ret; @@ -687,7 +687,7 @@ static void lp5521_unregister_sysfs(struct i2c_client *client) &lp5521_led_attribute_group); } -static int __devinit lp5521_init_led(struct lp5521_led *led, +static int lp5521_init_led(struct lp5521_led *led, struct i2c_client *client, int chan, struct lp5521_platform_data *pdata) { @@ -736,7 +736,7 @@ static int __devinit lp5521_init_led(struct lp5521_led *led, return 0; } -static int __devinit lp5521_probe(struct i2c_client *client, +static int lp5521_probe(struct i2c_client *client, const struct i2c_device_id *id) { struct lp5521_chip *chip; @@ -788,10 +788,17 @@ static int __devinit lp5521_probe(struct i2c_client *client, * LP5521_REG_ENABLE register will not have any effect - strange! */ ret = lp5521_read(client, LP5521_REG_R_CURRENT, &buf); - if (ret || buf != LP5521_REG_R_CURR_DEFAULT) { + if (ret) { dev_err(&client->dev, "error in resetting chip\n"); goto fail2; } + if (buf != LP5521_REG_R_CURR_DEFAULT) { + dev_err(&client->dev, + "unexpected data in register (expected 0x%x got 0x%x)\n", + LP5521_REG_R_CURR_DEFAULT, buf); + ret = -EINVAL; + goto fail2; + } usleep_range(10000, 20000); ret = lp5521_detect(client); @@ -855,7 +862,7 @@ fail1: return ret; } -static int __devexit lp5521_remove(struct i2c_client *client) +static int lp5521_remove(struct i2c_client *client) { struct lp5521_chip *chip = i2c_get_clientdata(client); int i; @@ -886,7 +893,7 @@ static struct i2c_driver lp5521_driver = { .name = "lp5521", }, .probe = lp5521_probe, - .remove = __devexit_p(lp5521_remove), + .remove = lp5521_remove, .id_table = lp5521_id, }; diff --git a/drivers/leds/leds-lp5523.c b/drivers/leds/leds-lp5523.c index 97994ffdc014..7f5be8948cde 100644 --- a/drivers/leds/leds-lp5523.c +++ b/drivers/leds/leds-lp5523.c @@ -171,7 +171,7 @@ static int lp5523_read(struct i2c_client *client, u8 reg, u8 *buf) s32 ret = i2c_smbus_read_byte_data(client, reg); if (ret < 0) - return -EIO; + return ret; *buf = ret; return 0; @@ -248,7 +248,10 @@ static int lp5523_configure(struct i2c_client *client) /* Let the programs run for couple of ms and check the engine status */ usleep_range(3000, 6000); - lp5523_read(client, LP5523_REG_STATUS, &status); + ret = lp5523_read(client, LP5523_REG_STATUS, &status); + if (ret < 0) + return ret; + status &= LP5523_ENG_STATUS_MASK; if (status == LP5523_ENG_STATUS_MASK) { @@ -464,10 +467,16 @@ static ssize_t lp5523_selftest(struct device *dev, LP5523_EN_LEDTEST | 16); usleep_range(3000, 6000); /* ADC conversion time is typically 2.7 ms */ ret = lp5523_read(chip->client, LP5523_REG_STATUS, &status); + if (ret < 0) + goto fail; + if (!(status & LP5523_LEDTEST_DONE)) usleep_range(3000, 6000); /* Was not ready. Wait little bit */ - ret |= lp5523_read(chip->client, LP5523_REG_LED_TEST_ADC, &vdd); + ret = lp5523_read(chip->client, LP5523_REG_LED_TEST_ADC, &vdd); + if (ret < 0) + goto fail; + vdd--; /* There may be some fluctuation in measurement */ for (i = 0; i < LP5523_LEDS; i++) { @@ -489,9 +498,14 @@ static ssize_t lp5523_selftest(struct device *dev, /* ADC conversion time is 2.7 ms typically */ usleep_range(3000, 6000); ret = lp5523_read(chip->client, LP5523_REG_STATUS, &status); + if (ret < 0) + goto fail; + if (!(status & LP5523_LEDTEST_DONE)) usleep_range(3000, 6000);/* Was not ready. Wait. */ - ret |= lp5523_read(chip->client, LP5523_REG_LED_TEST_ADC, &adc); + ret = lp5523_read(chip->client, LP5523_REG_LED_TEST_ADC, &adc); + if (ret < 0) + goto fail; if (adc >= vdd || adc < LP5523_ADC_SHORTCIRC_LIM) pos += sprintf(buf + pos, "LED %d FAIL\n", i); @@ -696,7 +710,7 @@ static ssize_t store_current(struct device *dev, ssize_t ret; unsigned long curr; - if (strict_strtoul(buf, 0, &curr)) + if (kstrtoul(buf, 0, &curr)) return -EINVAL; if (curr > led->max_current) @@ -833,7 +847,7 @@ static int __init lp5523_init_engine(struct lp5523_engine *engine, int id) return 0; } -static int __devinit lp5523_init_led(struct lp5523_led *led, struct device *dev, +static int lp5523_init_led(struct lp5523_led *led, struct device *dev, int chan, struct lp5523_platform_data *pdata, const char *chip_name) { @@ -882,7 +896,7 @@ static int __devinit lp5523_init_led(struct lp5523_led *led, struct device *dev, return 0; } -static int __devinit lp5523_probe(struct i2c_client *client, +static int lp5523_probe(struct i2c_client *client, const struct i2c_device_id *id) { struct lp5523_chip *chip; diff --git a/drivers/leds/leds-lp8788.c b/drivers/leds/leds-lp8788.c index 64009a176651..4353942c5fd1 100644 --- a/drivers/leds/leds-lp8788.c +++ b/drivers/leds/leds-lp8788.c @@ -125,7 +125,7 @@ static void lp8788_brightness_set(struct led_classdev *led_cdev, schedule_work(&led->work); } -static __devinit int lp8788_led_probe(struct platform_device *pdev) +static int lp8788_led_probe(struct platform_device *pdev) { struct lp8788 *lp = dev_get_drvdata(pdev->dev.parent); struct lp8788_led_platform_data *led_pdata; @@ -167,7 +167,7 @@ static __devinit int lp8788_led_probe(struct platform_device *pdev) return 0; } -static int __devexit lp8788_led_remove(struct platform_device *pdev) +static int lp8788_led_remove(struct platform_device *pdev) { struct lp8788_led *led = platform_get_drvdata(pdev); @@ -179,7 +179,7 @@ static int __devexit lp8788_led_remove(struct platform_device *pdev) static struct platform_driver lp8788_led_driver = { .probe = lp8788_led_probe, - .remove = __devexit_p(lp8788_led_remove), + .remove = lp8788_led_remove, .driver = { .name = LP8788_DEV_KEYLED, .owner = THIS_MODULE, diff --git a/drivers/leds/leds-lt3593.c b/drivers/leds/leds-lt3593.c index 09a732217f6d..c9b9e1fec587 100644 --- a/drivers/leds/leds-lt3593.c +++ b/drivers/leds/leds-lt3593.c @@ -82,22 +82,18 @@ static void lt3593_led_set(struct led_classdev *led_cdev, schedule_work(&led_dat->work); } -static int __devinit create_lt3593_led(const struct gpio_led *template, +static int create_lt3593_led(const struct gpio_led *template, struct lt3593_led_data *led_dat, struct device *parent) { int ret, state; /* skip leds on GPIOs that aren't available */ if (!gpio_is_valid(template->gpio)) { - printk(KERN_INFO "%s: skipping unavailable LT3593 LED at gpio %d (%s)\n", + dev_info(parent, "%s: skipping unavailable LT3593 LED at gpio %d (%s)\n", KBUILD_MODNAME, template->gpio, template->name); return 0; } - ret = gpio_request(template->gpio, template->name); - if (ret < 0) - return ret; - led_dat->cdev.name = template->name; led_dat->cdev.default_trigger = template->default_trigger; led_dat->gpio = template->gpio; @@ -110,24 +106,21 @@ static int __devinit create_lt3593_led(const struct gpio_led *template, if (!template->retain_state_suspended) led_dat->cdev.flags |= LED_CORE_SUSPENDRESUME; - ret = gpio_direction_output(led_dat->gpio, state); + ret = devm_gpio_request_one(parent, template->gpio, + GPIOF_DIR_OUT | state, template->name); if (ret < 0) - goto err; + return ret; INIT_WORK(&led_dat->work, lt3593_led_work); ret = led_classdev_register(parent, &led_dat->cdev); if (ret < 0) - goto err; + return ret; - printk(KERN_INFO "%s: registered LT3593 LED '%s' at GPIO %d\n", + dev_info(parent, "%s: registered LT3593 LED '%s' at GPIO %d\n", KBUILD_MODNAME, template->name, template->gpio); return 0; - -err: - gpio_free(led_dat->gpio); - return ret; } static void delete_lt3593_led(struct lt3593_led_data *led) @@ -137,10 +130,9 @@ static void delete_lt3593_led(struct lt3593_led_data *led) led_classdev_unregister(&led->cdev); cancel_work_sync(&led->work); - gpio_free(led->gpio); } -static int __devinit lt3593_led_probe(struct platform_device *pdev) +static int lt3593_led_probe(struct platform_device *pdev) { struct gpio_led_platform_data *pdata = pdev->dev.platform_data; struct lt3593_led_data *leds_data; @@ -173,7 +165,7 @@ err: return ret; } -static int __devexit lt3593_led_remove(struct platform_device *pdev) +static int lt3593_led_remove(struct platform_device *pdev) { int i; struct gpio_led_platform_data *pdata = pdev->dev.platform_data; @@ -189,7 +181,7 @@ static int __devexit lt3593_led_remove(struct platform_device *pdev) static struct platform_driver lt3593_led_driver = { .probe = lt3593_led_probe, - .remove = __devexit_p(lt3593_led_remove), + .remove = lt3593_led_remove, .driver = { .name = "leds-lt3593", .owner = THIS_MODULE, diff --git a/drivers/leds/leds-max8997.c b/drivers/leds/leds-max8997.c index 569e36de37df..f449a8bdddc7 100644 --- a/drivers/leds/leds-max8997.c +++ b/drivers/leds/leds-max8997.c @@ -229,7 +229,7 @@ static ssize_t max8997_led_store_mode(struct device *dev, static DEVICE_ATTR(mode, 0644, max8997_led_show_mode, max8997_led_store_mode); -static int __devinit max8997_led_probe(struct platform_device *pdev) +static int max8997_led_probe(struct platform_device *pdev) { struct max8997_dev *iodev = dev_get_drvdata(pdev->dev.parent); struct max8997_platform_data *pdata = dev_get_platdata(iodev->dev); @@ -292,7 +292,7 @@ static int __devinit max8997_led_probe(struct platform_device *pdev) return 0; } -static int __devexit max8997_led_remove(struct platform_device *pdev) +static int max8997_led_remove(struct platform_device *pdev) { struct max8997_led *led = platform_get_drvdata(pdev); @@ -308,7 +308,7 @@ static struct platform_driver max8997_led_driver = { .owner = THIS_MODULE, }, .probe = max8997_led_probe, - .remove = __devexit_p(max8997_led_remove), + .remove = max8997_led_remove, }; module_platform_driver(max8997_led_driver); diff --git a/drivers/leds/leds-mc13783.c b/drivers/leds/leds-mc13783.c index 2a5d43400677..e942adaa7504 100644 --- a/drivers/leds/leds-mc13783.c +++ b/drivers/leds/leds-mc13783.c @@ -128,7 +128,7 @@ static void mc13783_led_set(struct led_classdev *led_cdev, schedule_work(&led->work); } -static int __devinit mc13783_led_setup(struct mc13783_led *led, int max_current) +static int mc13783_led_setup(struct mc13783_led *led, int max_current) { int shift = 0; int mask = 0; @@ -181,7 +181,7 @@ static int __devinit mc13783_led_setup(struct mc13783_led *led, int max_current) return ret; } -static int __devinit mc13783_leds_prepare(struct platform_device *pdev) +static int mc13783_leds_prepare(struct platform_device *pdev) { struct mc13xxx_leds_platform_data *pdata = dev_get_platdata(&pdev->dev); struct mc13xxx *dev = dev_get_drvdata(pdev->dev.parent); @@ -262,7 +262,7 @@ out: return ret; } -static int __devinit mc13783_led_probe(struct platform_device *pdev) +static int mc13783_led_probe(struct platform_device *pdev) { struct mc13xxx_leds_platform_data *pdata = dev_get_platdata(&pdev->dev); struct mc13xxx_led_platform_data *led_cur; @@ -348,7 +348,7 @@ err_register: return ret; } -static int __devexit mc13783_led_remove(struct platform_device *pdev) +static int mc13783_led_remove(struct platform_device *pdev) { struct mc13xxx_leds_platform_data *pdata = dev_get_platdata(&pdev->dev); struct mc13783_led *led = platform_get_drvdata(pdev); @@ -381,7 +381,7 @@ static struct platform_driver mc13783_led_driver = { .owner = THIS_MODULE, }, .probe = mc13783_led_probe, - .remove = __devexit_p(mc13783_led_remove), + .remove = mc13783_led_remove, }; module_platform_driver(mc13783_led_driver); diff --git a/drivers/leds/leds-net48xx.c b/drivers/leds/leds-net48xx.c index f117f7326c5b..27d06c528246 100644 --- a/drivers/leds/leds-net48xx.c +++ b/drivers/leds/leds-net48xx.c @@ -15,7 +15,7 @@ #include <linux/platform_device.h> #include <linux/leds.h> #include <linux/err.h> -#include <asm/io.h> +#include <linux/io.h> #include <linux/nsc_gpio.h> #include <linux/scx200_gpio.h> #include <linux/module.h> diff --git a/drivers/leds/leds-netxbig.c b/drivers/leds/leds-netxbig.c index 461bbf9b33fa..c61c5ebcc08e 100644 --- a/drivers/leds/leds-netxbig.c +++ b/drivers/leds/leds-netxbig.c @@ -71,7 +71,7 @@ static void gpio_ext_set_value(struct netxbig_gpio_ext *gpio_ext, spin_unlock_irqrestore(&gpio_ext_lock, flags); } -static int __devinit gpio_ext_init(struct netxbig_gpio_ext *gpio_ext) +static int gpio_ext_init(struct netxbig_gpio_ext *gpio_ext) { int err; int i; @@ -243,7 +243,7 @@ static ssize_t netxbig_led_sata_store(struct device *dev, int mode_val; int ret; - ret = strict_strtoul(buff, 10, &enable); + ret = kstrtoul(buff, 10, &enable); if (ret < 0) return ret; @@ -301,7 +301,7 @@ static void delete_netxbig_led(struct netxbig_led_data *led_dat) led_classdev_unregister(&led_dat->cdev); } -static int __devinit +static int create_netxbig_led(struct platform_device *pdev, struct netxbig_led_data *led_dat, const struct netxbig_led *template) @@ -352,7 +352,7 @@ create_netxbig_led(struct platform_device *pdev, return ret; } -static int __devinit netxbig_led_probe(struct platform_device *pdev) +static int netxbig_led_probe(struct platform_device *pdev) { struct netxbig_led_platform_data *pdata = pdev->dev.platform_data; struct netxbig_led_data *leds_data; @@ -389,7 +389,7 @@ err_free_leds: return ret; } -static int __devexit netxbig_led_remove(struct platform_device *pdev) +static int netxbig_led_remove(struct platform_device *pdev) { struct netxbig_led_platform_data *pdata = pdev->dev.platform_data; struct netxbig_led_data *leds_data; @@ -407,7 +407,7 @@ static int __devexit netxbig_led_remove(struct platform_device *pdev) static struct platform_driver netxbig_led_driver = { .probe = netxbig_led_probe, - .remove = __devexit_p(netxbig_led_remove), + .remove = netxbig_led_remove, .driver = { .name = "leds-netxbig", .owner = THIS_MODULE, diff --git a/drivers/leds/leds-ns2.c b/drivers/leds/leds-ns2.c index d176ec83f5d9..d978171c25b4 100644 --- a/drivers/leds/leds-ns2.c +++ b/drivers/leds/leds-ns2.c @@ -30,6 +30,7 @@ #include <linux/leds.h> #include <linux/module.h> #include <linux/platform_data/leds-kirkwood-ns2.h> +#include <linux/of_gpio.h> /* * The Network Space v2 dual-GPIO LED is wired to a CPLD and can blink in @@ -149,7 +150,7 @@ static ssize_t ns2_led_sata_store(struct device *dev, unsigned long enable; enum ns2_led_modes mode; - ret = strict_strtoul(buff, 10, &enable); + ret = kstrtoul(buff, 10, &enable); if (ret < 0) return ret; @@ -184,36 +185,29 @@ static ssize_t ns2_led_sata_show(struct device *dev, static DEVICE_ATTR(sata, 0644, ns2_led_sata_show, ns2_led_sata_store); -static int __devinit +static int create_ns2_led(struct platform_device *pdev, struct ns2_led_data *led_dat, const struct ns2_led *template) { int ret; enum ns2_led_modes mode; - ret = gpio_request(template->cmd, template->name); - if (ret == 0) { - ret = gpio_direction_output(template->cmd, - gpio_get_value(template->cmd)); - if (ret) - gpio_free(template->cmd); - } + ret = devm_gpio_request_one(&pdev->dev, template->cmd, + GPIOF_DIR_OUT | gpio_get_value(template->cmd), + template->name); if (ret) { dev_err(&pdev->dev, "%s: failed to setup command GPIO\n", template->name); + return ret; } - ret = gpio_request(template->slow, template->name); - if (ret == 0) { - ret = gpio_direction_output(template->slow, - gpio_get_value(template->slow)); - if (ret) - gpio_free(template->slow); - } + ret = devm_gpio_request_one(&pdev->dev, template->slow, + GPIOF_DIR_OUT | gpio_get_value(template->slow), + template->name); if (ret) { dev_err(&pdev->dev, "%s: failed to setup slow GPIO\n", template->name); - goto err_free_cmd; + return ret; } rwlock_init(&led_dat->rw_lock); @@ -228,7 +222,7 @@ create_ns2_led(struct platform_device *pdev, struct ns2_led_data *led_dat, ret = ns2_led_get_mode(led_dat, &mode); if (ret < 0) - goto err_free_slow; + return ret; /* Set LED initial state. */ led_dat->sata = (mode == NS_V2_LED_SATA) ? 1 : 0; @@ -237,7 +231,7 @@ create_ns2_led(struct platform_device *pdev, struct ns2_led_data *led_dat, ret = led_classdev_register(&pdev->dev, &led_dat->cdev); if (ret < 0) - goto err_free_slow; + return ret; ret = device_create_file(led_dat->cdev.dev, &dev_attr_sata); if (ret < 0) @@ -247,11 +241,6 @@ create_ns2_led(struct platform_device *pdev, struct ns2_led_data *led_dat, err_free_cdev: led_classdev_unregister(&led_dat->cdev); -err_free_slow: - gpio_free(led_dat->slow); -err_free_cmd: - gpio_free(led_dat->cmd); - return ret; } @@ -259,22 +248,90 @@ static void delete_ns2_led(struct ns2_led_data *led_dat) { device_remove_file(led_dat->cdev.dev, &dev_attr_sata); led_classdev_unregister(&led_dat->cdev); - gpio_free(led_dat->cmd); - gpio_free(led_dat->slow); } -static int __devinit ns2_led_probe(struct platform_device *pdev) +#ifdef CONFIG_OF_GPIO +/* + * Translate OpenFirmware node properties into platform_data. + */ +static int +ns2_leds_get_of_pdata(struct device *dev, struct ns2_led_platform_data *pdata) +{ + struct device_node *np = dev->of_node; + struct device_node *child; + struct ns2_led *leds; + int num_leds = 0; + int i = 0; + + num_leds = of_get_child_count(np); + if (!num_leds) + return -ENODEV; + + leds = devm_kzalloc(dev, num_leds * sizeof(struct ns2_led), + GFP_KERNEL); + if (!leds) + return -ENOMEM; + + for_each_child_of_node(np, child) { + const char *string; + int ret; + + ret = of_get_named_gpio(child, "cmd-gpio", 0); + if (ret < 0) + return ret; + leds[i].cmd = ret; + ret = of_get_named_gpio(child, "slow-gpio", 0); + if (ret < 0) + return ret; + leds[i].slow = ret; + ret = of_property_read_string(child, "label", &string); + leds[i].name = (ret == 0) ? string : child->name; + ret = of_property_read_string(child, "linux,default-trigger", + &string); + if (ret == 0) + leds[i].default_trigger = string; + + i++; + } + + pdata->leds = leds; + pdata->num_leds = num_leds; + + return 0; +} + +static const struct of_device_id of_ns2_leds_match[] = { + { .compatible = "lacie,ns2-leds", }, + {}, +}; +#endif /* CONFIG_OF_GPIO */ + +static int ns2_led_probe(struct platform_device *pdev) { struct ns2_led_platform_data *pdata = pdev->dev.platform_data; struct ns2_led_data *leds_data; int i; int ret; +#ifdef CONFIG_OF_GPIO + if (!pdata) { + pdata = devm_kzalloc(&pdev->dev, + sizeof(struct ns2_led_platform_data), + GFP_KERNEL); + if (!pdata) + return -ENOMEM; + + ret = ns2_leds_get_of_pdata(&pdev->dev, pdata); + if (ret) + return ret; + } +#else if (!pdata) return -EINVAL; +#endif /* CONFIG_OF_GPIO */ leds_data = devm_kzalloc(&pdev->dev, sizeof(struct ns2_led_data) * - pdata->num_leds, GFP_KERNEL); + pdata->num_leds, GFP_KERNEL); if (!leds_data) return -ENOMEM; @@ -292,7 +349,7 @@ static int __devinit ns2_led_probe(struct platform_device *pdev) return 0; } -static int __devexit ns2_led_remove(struct platform_device *pdev) +static int ns2_led_remove(struct platform_device *pdev) { int i; struct ns2_led_platform_data *pdata = pdev->dev.platform_data; @@ -310,10 +367,11 @@ static int __devexit ns2_led_remove(struct platform_device *pdev) static struct platform_driver ns2_led_driver = { .probe = ns2_led_probe, - .remove = __devexit_p(ns2_led_remove), + .remove = ns2_led_remove, .driver = { - .name = "leds-ns2", - .owner = THIS_MODULE, + .name = "leds-ns2", + .owner = THIS_MODULE, + .of_match_table = of_match_ptr(of_ns2_leds_match), }, }; diff --git a/drivers/leds/leds-ot200.c b/drivers/leds/leds-ot200.c index c4646825a620..ee14662ed5ce 100644 --- a/drivers/leds/leds-ot200.c +++ b/drivers/leds/leds-ot200.c @@ -115,7 +115,7 @@ static void ot200_led_brightness_set(struct led_classdev *led_cdev, spin_unlock_irqrestore(&value_lock, flags); } -static int __devinit ot200_led_probe(struct platform_device *pdev) +static int ot200_led_probe(struct platform_device *pdev) { int i; int ret; @@ -144,7 +144,7 @@ err: return ret; } -static int __devexit ot200_led_remove(struct platform_device *pdev) +static int ot200_led_remove(struct platform_device *pdev) { int i; @@ -156,7 +156,7 @@ static int __devexit ot200_led_remove(struct platform_device *pdev) static struct platform_driver ot200_led_driver = { .probe = ot200_led_probe, - .remove = __devexit_p(ot200_led_remove), + .remove = ot200_led_remove, .driver = { .name = "leds-ot200", .owner = THIS_MODULE, diff --git a/drivers/leds/leds-pca955x.c b/drivers/leds/leds-pca955x.c index aef3cf0432fe..edf485b773c8 100644 --- a/drivers/leds/leds-pca955x.c +++ b/drivers/leds/leds-pca955x.c @@ -255,7 +255,7 @@ static void pca955x_led_set(struct led_classdev *led_cdev, enum led_brightness v schedule_work(&pca955x->work); } -static int __devinit pca955x_probe(struct i2c_client *client, +static int pca955x_probe(struct i2c_client *client, const struct i2c_device_id *id) { struct pca955x *pca955x; @@ -277,7 +277,7 @@ static int __devinit pca955x_probe(struct i2c_client *client, return -ENODEV; } - printk(KERN_INFO "leds-pca955x: Using %s %d-bit LED driver at " + dev_info(&client->dev, "leds-pca955x: Using %s %d-bit LED driver at " "slave address 0x%02x\n", id->name, chip->bits, client->addr); @@ -363,7 +363,7 @@ exit: return err; } -static int __devexit pca955x_remove(struct i2c_client *client) +static int pca955x_remove(struct i2c_client *client) { struct pca955x *pca955x = i2c_get_clientdata(client); int i; @@ -382,7 +382,7 @@ static struct i2c_driver pca955x_driver = { .owner = THIS_MODULE, }, .probe = pca955x_probe, - .remove = __devexit_p(pca955x_remove), + .remove = pca955x_remove, .id_table = pca955x_id, }; diff --git a/drivers/leds/leds-pca9633.c b/drivers/leds/leds-pca9633.c index 2f2f9c43535d..9aae5679ffb2 100644 --- a/drivers/leds/leds-pca9633.c +++ b/drivers/leds/leds-pca9633.c @@ -93,7 +93,7 @@ static void pca9633_led_set(struct led_classdev *led_cdev, schedule_work(&pca9633->work); } -static int __devinit pca9633_probe(struct i2c_client *client, +static int pca9633_probe(struct i2c_client *client, const struct i2c_device_id *id) { struct pca9633_led *pca9633; @@ -164,7 +164,7 @@ exit: return err; } -static int __devexit pca9633_remove(struct i2c_client *client) +static int pca9633_remove(struct i2c_client *client) { struct pca9633_led *pca9633 = i2c_get_clientdata(client); int i; @@ -183,7 +183,7 @@ static struct i2c_driver pca9633_driver = { .owner = THIS_MODULE, }, .probe = pca9633_probe, - .remove = __devexit_p(pca9633_remove), + .remove = pca9633_remove, .id_table = pca9633_id, }; diff --git a/drivers/leds/leds-pwm.c b/drivers/leds/leds-pwm.c index f2e44c719437..2157524f277c 100644 --- a/drivers/leds/leds-pwm.c +++ b/drivers/leds/leds-pwm.c @@ -26,7 +26,7 @@ struct led_pwm_data { struct led_classdev cdev; struct pwm_device *pwm; - unsigned int active_low; + unsigned int active_low; unsigned int period; }; @@ -107,7 +107,7 @@ err: return ret; } -static int __devexit led_pwm_remove(struct platform_device *pdev) +static int led_pwm_remove(struct platform_device *pdev) { int i; struct led_pwm_platform_data *pdata = pdev->dev.platform_data; @@ -125,7 +125,7 @@ static int __devexit led_pwm_remove(struct platform_device *pdev) static struct platform_driver led_pwm_driver = { .probe = led_pwm_probe, - .remove = __devexit_p(led_pwm_remove), + .remove = led_pwm_remove, .driver = { .name = "leds_pwm", .owner = THIS_MODULE, diff --git a/drivers/leds/leds-rb532.c b/drivers/leds/leds-rb532.c index a7815b6cd856..2e746d257b02 100644 --- a/drivers/leds/leds-rb532.c +++ b/drivers/leds/leds-rb532.c @@ -16,7 +16,7 @@ #include <asm/mach-rc32434/rb.h> static void rb532_led_set(struct led_classdev *cdev, - enum led_brightness brightness) + enum led_brightness brightness) { if (brightness) set_latch_u5(LO_ULED, 0); @@ -37,12 +37,12 @@ static struct led_classdev rb532_uled = { .default_trigger = "nand-disk", }; -static int __devinit rb532_led_probe(struct platform_device *pdev) +static int rb532_led_probe(struct platform_device *pdev) { return led_classdev_register(&pdev->dev, &rb532_uled); } -static int __devexit rb532_led_remove(struct platform_device *pdev) +static int rb532_led_remove(struct platform_device *pdev) { led_classdev_unregister(&rb532_uled); return 0; @@ -50,7 +50,7 @@ static int __devexit rb532_led_remove(struct platform_device *pdev) static struct platform_driver rb532_led_driver = { .probe = rb532_led_probe, - .remove = __devexit_p(rb532_led_remove), + .remove = rb532_led_remove, .driver = { .name = "rb532-led", .owner = THIS_MODULE, diff --git a/drivers/leds/leds-regulator.c b/drivers/leds/leds-regulator.c index 25d382d60fa9..4253a9b03dbf 100644 --- a/drivers/leds/leds-regulator.c +++ b/drivers/leds/leds-regulator.c @@ -140,7 +140,7 @@ static void regulator_led_brightness_set(struct led_classdev *led_cdev, schedule_work(&led->work); } -static int __devinit regulator_led_probe(struct platform_device *pdev) +static int regulator_led_probe(struct platform_device *pdev) { struct led_regulator_platform_data *pdata = pdev->dev.platform_data; struct regulator_led *led; @@ -206,7 +206,7 @@ err_vcc: return ret; } -static int __devexit regulator_led_remove(struct platform_device *pdev) +static int regulator_led_remove(struct platform_device *pdev) { struct regulator_led *led = platform_get_drvdata(pdev); @@ -223,7 +223,7 @@ static struct platform_driver regulator_led_driver = { .owner = THIS_MODULE, }, .probe = regulator_led_probe, - .remove = __devexit_p(regulator_led_remove), + .remove = regulator_led_remove, }; module_platform_driver(regulator_led_driver); diff --git a/drivers/leds/leds-renesas-tpu.c b/drivers/leds/leds-renesas-tpu.c index 771ea067e680..e0fff1ca5923 100644 --- a/drivers/leds/leds-renesas-tpu.c +++ b/drivers/leds/leds-renesas-tpu.c @@ -204,10 +204,10 @@ static void r_tpu_set_pin(struct r_tpu_priv *p, enum r_tpu_pin new_state, if (p->pin_state == R_TPU_PIN_GPIO_FN) gpio_free(cfg->pin_gpio_fn); - if (new_state == R_TPU_PIN_GPIO) { - gpio_request(cfg->pin_gpio, cfg->name); - gpio_direction_output(cfg->pin_gpio, !!brightness); - } + if (new_state == R_TPU_PIN_GPIO) + gpio_request_one(cfg->pin_gpio, GPIOF_DIR_OUT | !!brightness, + cfg->name); + if (new_state == R_TPU_PIN_GPIO_FN) gpio_request(cfg->pin_gpio_fn, cfg->name); @@ -238,7 +238,7 @@ static void r_tpu_set_brightness(struct led_classdev *ldev, schedule_work(&p->work); } -static int __devinit r_tpu_probe(struct platform_device *pdev) +static int r_tpu_probe(struct platform_device *pdev) { struct led_renesas_tpu_config *cfg = pdev->dev.platform_data; struct r_tpu_priv *p; @@ -263,18 +263,18 @@ static int __devinit r_tpu_probe(struct platform_device *pdev) } /* map memory, let mapbase point to our channel */ - p->mapbase = ioremap_nocache(res->start, resource_size(res)); + p->mapbase = devm_ioremap_nocache(&pdev->dev, res->start, + resource_size(res)); if (p->mapbase == NULL) { dev_err(&pdev->dev, "failed to remap I/O memory\n"); return -ENXIO; } /* get hold of clock */ - p->clk = clk_get(&pdev->dev, NULL); + p->clk = devm_clk_get(&pdev->dev, NULL); if (IS_ERR(p->clk)) { dev_err(&pdev->dev, "cannot get clock\n"); - ret = PTR_ERR(p->clk); - goto err0; + return PTR_ERR(p->clk); } p->pdev = pdev; @@ -293,7 +293,7 @@ static int __devinit r_tpu_probe(struct platform_device *pdev) p->ldev.flags |= LED_CORE_SUSPENDRESUME; ret = led_classdev_register(&pdev->dev, &p->ldev); if (ret < 0) - goto err1; + goto err0; /* max_brightness may be updated by the LED core code */ p->min_rate = p->ldev.max_brightness * p->refresh_rate; @@ -301,15 +301,12 @@ static int __devinit r_tpu_probe(struct platform_device *pdev) pm_runtime_enable(&pdev->dev); return 0; - err1: - r_tpu_set_pin(p, R_TPU_PIN_UNUSED, LED_OFF); - clk_put(p->clk); err0: - iounmap(p->mapbase); + r_tpu_set_pin(p, R_TPU_PIN_UNUSED, LED_OFF); return ret; } -static int __devexit r_tpu_remove(struct platform_device *pdev) +static int r_tpu_remove(struct platform_device *pdev) { struct r_tpu_priv *p = platform_get_drvdata(pdev); @@ -320,15 +317,13 @@ static int __devexit r_tpu_remove(struct platform_device *pdev) r_tpu_set_pin(p, R_TPU_PIN_UNUSED, LED_OFF); pm_runtime_disable(&pdev->dev); - clk_put(p->clk); - iounmap(p->mapbase); return 0; } static struct platform_driver r_tpu_device_driver = { .probe = r_tpu_probe, - .remove = __devexit_p(r_tpu_remove), + .remove = r_tpu_remove, .driver = { .name = "leds-renesas-tpu", } diff --git a/drivers/leds/leds-ss4200.c b/drivers/leds/leds-ss4200.c index 57371e1485ab..ec9b287ecfbf 100644 --- a/drivers/leds/leds-ss4200.c +++ b/drivers/leds/leds-ss4200.c @@ -263,7 +263,7 @@ static int nasgpio_led_set_blink(struct led_classdev *led_cdev, * already taken care of this, but we will do so in a non destructive manner * so that we have what we need whether the BIOS did it or not. */ -static int __devinit ich7_gpio_init(struct device *dev) +static int ich7_gpio_init(struct device *dev) { int i; u32 config_data = 0; @@ -342,7 +342,7 @@ static void ich7_lpc_cleanup(struct device *dev) * so we can retrive the required operational information and prepare the GPIO. */ static struct pci_dev *nas_gpio_pci_dev; -static int __devinit ich7_lpc_probe(struct pci_dev *dev, +static int ich7_lpc_probe(struct pci_dev *dev, const struct pci_device_id *id) { int status; @@ -459,7 +459,7 @@ static ssize_t nas_led_blink_store(struct device *dev, struct led_classdev *led = dev_get_drvdata(dev); unsigned long blink_state; - ret = strict_strtoul(buf, 10, &blink_state); + ret = kstrtoul(buf, 10, &blink_state); if (ret) return ret; diff --git a/drivers/leds/leds-sunfire.c b/drivers/leds/leds-sunfire.c index 134d9a4b34f1..07ff5a3a6cee 100644 --- a/drivers/leds/leds-sunfire.c +++ b/drivers/leds/leds-sunfire.c @@ -123,7 +123,7 @@ struct sunfire_drvdata { struct sunfire_led leds[NUM_LEDS_PER_BOARD]; }; -static int __devinit sunfire_led_generic_probe(struct platform_device *pdev, +static int sunfire_led_generic_probe(struct platform_device *pdev, struct led_type *types) { struct sunfire_drvdata *p; @@ -165,7 +165,7 @@ static int __devinit sunfire_led_generic_probe(struct platform_device *pdev, return 0; } -static int __devexit sunfire_led_generic_remove(struct platform_device *pdev) +static int sunfire_led_generic_remove(struct platform_device *pdev) { struct sunfire_drvdata *p = dev_get_drvdata(&pdev->dev); int i; @@ -192,7 +192,7 @@ static struct led_type clockboard_led_types[NUM_LEDS_PER_BOARD] = { }, }; -static int __devinit sunfire_clockboard_led_probe(struct platform_device *pdev) +static int sunfire_clockboard_led_probe(struct platform_device *pdev) { return sunfire_led_generic_probe(pdev, clockboard_led_types); } @@ -213,7 +213,7 @@ static struct led_type fhc_led_types[NUM_LEDS_PER_BOARD] = { }, }; -static int __devinit sunfire_fhc_led_probe(struct platform_device *pdev) +static int sunfire_fhc_led_probe(struct platform_device *pdev) { return sunfire_led_generic_probe(pdev, fhc_led_types); } @@ -223,7 +223,7 @@ MODULE_ALIAS("platform:sunfire-fhc-leds"); static struct platform_driver sunfire_clockboard_led_driver = { .probe = sunfire_clockboard_led_probe, - .remove = __devexit_p(sunfire_led_generic_remove), + .remove = sunfire_led_generic_remove, .driver = { .name = "sunfire-clockboard-leds", .owner = THIS_MODULE, @@ -232,7 +232,7 @@ static struct platform_driver sunfire_clockboard_led_driver = { static struct platform_driver sunfire_fhc_led_driver = { .probe = sunfire_fhc_led_probe, - .remove = __devexit_p(sunfire_led_generic_remove), + .remove = sunfire_led_generic_remove, .driver = { .name = "sunfire-fhc-leds", .owner = THIS_MODULE, diff --git a/drivers/leds/leds-tca6507.c b/drivers/leds/leds-tca6507.c index dabcf7ae8d0f..b26a63bae16b 100644 --- a/drivers/leds/leds-tca6507.c +++ b/drivers/leds/leds-tca6507.c @@ -667,7 +667,7 @@ static void tca6507_remove_gpio(struct tca6507_chip *tca) } #endif /* CONFIG_GPIOLIB */ -static int __devinit tca6507_probe(struct i2c_client *client, +static int tca6507_probe(struct i2c_client *client, const struct i2c_device_id *id) { struct tca6507_chip *tca; @@ -730,7 +730,7 @@ exit: return err; } -static int __devexit tca6507_remove(struct i2c_client *client) +static int tca6507_remove(struct i2c_client *client) { int i; struct tca6507_chip *tca = i2c_get_clientdata(client); @@ -752,7 +752,7 @@ static struct i2c_driver tca6507_driver = { .owner = THIS_MODULE, }, .probe = tca6507_probe, - .remove = __devexit_p(tca6507_remove), + .remove = tca6507_remove, .id_table = tca6507_id, }; diff --git a/drivers/leds/leds-wm8350.c b/drivers/leds/leds-wm8350.c index 88f23f845595..ed15157c8f6c 100644 --- a/drivers/leds/leds-wm8350.c +++ b/drivers/leds/leds-wm8350.c @@ -216,13 +216,13 @@ static int wm8350_led_probe(struct platform_device *pdev) isink = devm_regulator_get(&pdev->dev, "led_isink"); if (IS_ERR(isink)) { - printk(KERN_ERR "%s: can't get ISINK\n", __func__); + dev_err(&pdev->dev, "%s: can't get ISINK\n", __func__); return PTR_ERR(isink); } dcdc = devm_regulator_get(&pdev->dev, "led_vcc"); if (IS_ERR(dcdc)) { - printk(KERN_ERR "%s: can't get DCDC\n", __func__); + dev_err(&pdev->dev, "%s: can't get DCDC\n", __func__); return PTR_ERR(dcdc); } diff --git a/drivers/leds/leds-wrap.c b/drivers/leds/leds-wrap.c index 6e21e654bb02..b358cc05eff5 100644 --- a/drivers/leds/leds-wrap.c +++ b/drivers/leds/leds-wrap.c @@ -15,7 +15,7 @@ #include <linux/platform_device.h> #include <linux/leds.h> #include <linux/err.h> -#include <asm/io.h> +#include <linux/io.h> #include <linux/scx200_gpio.h> #include <linux/module.h> diff --git a/drivers/leds/ledtrig-backlight.c b/drivers/leds/ledtrig-backlight.c index b941685f2227..027a2b15d7d8 100644 --- a/drivers/leds/ledtrig-backlight.c +++ b/drivers/leds/ledtrig-backlight.c @@ -40,7 +40,7 @@ static int fb_notifier_callback(struct notifier_block *p, int new_status = *blank ? BLANK : UNBLANK; switch (event) { - case FB_EVENT_BLANK : + case FB_EVENT_BLANK: if (new_status == n->old_status) break; @@ -76,7 +76,7 @@ static ssize_t bl_trig_invert_store(struct device *dev, unsigned long invert; int ret; - ret = strict_strtoul(buf, 10, &invert); + ret = kstrtoul(buf, 10, &invert); if (ret < 0) return ret; diff --git a/drivers/leds/ledtrig-cpu.c b/drivers/leds/ledtrig-cpu.c index b312056da14d..4239b3955ff0 100644 --- a/drivers/leds/ledtrig-cpu.c +++ b/drivers/leds/ledtrig-cpu.c @@ -33,8 +33,6 @@ struct led_trigger_cpu { char name[MAX_NAME_LEN]; struct led_trigger *_trig; - struct mutex lock; - int lock_is_inited; }; static DEFINE_PER_CPU(struct led_trigger_cpu, cpu_trig); @@ -50,12 +48,6 @@ void ledtrig_cpu(enum cpu_led_event ledevt) { struct led_trigger_cpu *trig = &__get_cpu_var(cpu_trig); - /* mutex lock should be initialized before calling mutex_call() */ - if (!trig->lock_is_inited) - return; - - mutex_lock(&trig->lock); - /* Locate the correct CPU LED */ switch (ledevt) { case CPU_LED_IDLE_END: @@ -75,8 +67,6 @@ void ledtrig_cpu(enum cpu_led_event ledevt) /* Will leave the LED as it is */ break; } - - mutex_unlock(&trig->lock); } EXPORT_SYMBOL(ledtrig_cpu); @@ -117,14 +107,9 @@ static int __init ledtrig_cpu_init(void) for_each_possible_cpu(cpu) { struct led_trigger_cpu *trig = &per_cpu(cpu_trig, cpu); - mutex_init(&trig->lock); - snprintf(trig->name, MAX_NAME_LEN, "cpu%d", cpu); - mutex_lock(&trig->lock); led_trigger_register_simple(trig->name, &trig->_trig); - trig->lock_is_inited = 1; - mutex_unlock(&trig->lock); } register_syscore_ops(&ledtrig_cpu_syscore_ops); @@ -142,15 +127,9 @@ static void __exit ledtrig_cpu_exit(void) for_each_possible_cpu(cpu) { struct led_trigger_cpu *trig = &per_cpu(cpu_trig, cpu); - mutex_lock(&trig->lock); - led_trigger_unregister_simple(trig->_trig); trig->_trig = NULL; memset(trig->name, 0, MAX_NAME_LEN); - trig->lock_is_inited = 0; - - mutex_unlock(&trig->lock); - mutex_destroy(&trig->lock); } unregister_syscore_ops(&ledtrig_cpu_syscore_ops); diff --git a/drivers/leds/ledtrig-gpio.c b/drivers/leds/ledtrig-gpio.c index ba215dc42f98..72e3ebfc281f 100644 --- a/drivers/leds/ledtrig-gpio.c +++ b/drivers/leds/ledtrig-gpio.c @@ -110,7 +110,7 @@ static ssize_t gpio_trig_inverted_store(struct device *dev, unsigned long inverted; int ret; - ret = strict_strtoul(buf, 10, &inverted); + ret = kstrtoul(buf, 10, &inverted); if (ret < 0) return ret; |