Commit e81d372f authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/cooloney/linux-leds

Pull LED subsystem update from Bryan Wu.

* 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/cooloney/linux-leds: (47 commits)
  leds: leds-lp5521: return an error code on error in probe()
  leds: leds-clevo-mail: Use pr_* instead of printks
  leds: leds-rb532: Fix checkpatch errors
  leds: led-triggers: Fix checkpatch warnings
  leds: ledtrig-backlight: Fix checkpatch error
  leds: leds-wrap: Use <linux/io.h> instead of <asm/io.h>
  leds: leds-wm8350: Use dev_err instead of printk
  leds: leds-pwm: Fix checkpatch warning
  leds: leds-pca955x: Use dev_info instead of printk
  leds: leds-net48xx: Use linux/io.h instead of asm/io.h
  leds: leds-lt3593: Fix checkpatch warnings
  leds: leds-gpio: Use dev_info instead of printk
  leds: leds-da903x: Fix checkpatch error and warnings
  leds: leds-bd2802: Fix checkpatch warnings
  leds: leds-adp5520: Fix checkpatch warnings
  leds: led-class: Fix checkpatch warning
  leds: leds-ns2: use devm_gpio_request_one
  leds: leds-lt3593: use devm_gpio_request_one
  leds: leds-gpio: use devm_gpio_request_one
  leds: lp3944: Fix return value
  ...
parents 75e300c8 2f05e1d4
...@@ -211,7 +211,7 @@ int led_classdev_register(struct device *parent, struct led_classdev *led_cdev) ...@@ -211,7 +211,7 @@ int led_classdev_register(struct device *parent, struct led_classdev *led_cdev)
led_trigger_set_default(led_cdev); led_trigger_set_default(led_cdev);
#endif #endif
printk(KERN_DEBUG "Registered led device: %s\n", dev_dbg(parent, "Registered led device: %s\n",
led_cdev->name); led_cdev->name);
return 0; return 0;
......
...@@ -166,6 +166,19 @@ void led_trigger_set_default(struct led_classdev *led_cdev) ...@@ -166,6 +166,19 @@ void led_trigger_set_default(struct led_classdev *led_cdev)
} }
EXPORT_SYMBOL_GPL(led_trigger_set_default); 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 */ /* LED Trigger Interface */
int led_trigger_register(struct led_trigger *trig) int led_trigger_register(struct led_trigger *trig)
...@@ -300,13 +313,13 @@ void led_trigger_register_simple(const char *name, struct led_trigger **tp) ...@@ -300,13 +313,13 @@ void led_trigger_register_simple(const char *name, struct led_trigger **tp)
if (err < 0) { if (err < 0) {
kfree(trig); kfree(trig);
trig = NULL; trig = NULL;
printk(KERN_WARNING "LED trigger %s failed to register" pr_warn("LED trigger %s failed to register (%d)\n",
" (%d)\n", name, err); name, err);
} }
} else } else {
printk(KERN_WARNING "LED trigger %s failed to register" pr_warn("LED trigger %s failed to register (no memory)\n",
" (no memory)\n", name); name);
}
*tp = trig; *tp = trig;
} }
EXPORT_SYMBOL_GPL(led_trigger_register_simple); EXPORT_SYMBOL_GPL(led_trigger_register_simple);
......
...@@ -165,15 +165,13 @@ static int pm860x_led_probe(struct platform_device *pdev) ...@@ -165,15 +165,13 @@ static int pm860x_led_probe(struct platform_device *pdev)
res = platform_get_resource_byname(pdev, IORESOURCE_REG, "control"); res = platform_get_resource_byname(pdev, IORESOURCE_REG, "control");
if (!res) { if (!res) {
dev_err(&pdev->dev, "No REG resource for control\n"); dev_err(&pdev->dev, "No REG resource for control\n");
ret = -ENXIO; return -ENXIO;
goto out;
} }
data->reg_control = res->start; data->reg_control = res->start;
res = platform_get_resource_byname(pdev, IORESOURCE_REG, "blink"); res = platform_get_resource_byname(pdev, IORESOURCE_REG, "blink");
if (!res) { if (!res) {
dev_err(&pdev->dev, "No REG resource for blink\n"); dev_err(&pdev->dev, "No REG resource for blink\n");
ret = -ENXIO; return -ENXIO;
goto out;
} }
data->reg_blink = res->start; data->reg_blink = res->start;
memset(data->name, 0, MFD_NAME_SIZE); memset(data->name, 0, MFD_NAME_SIZE);
...@@ -224,9 +222,6 @@ static int pm860x_led_probe(struct platform_device *pdev) ...@@ -224,9 +222,6 @@ static int pm860x_led_probe(struct platform_device *pdev)
} }
pm860x_led_set(&data->cdev, 0); pm860x_led_set(&data->cdev, 0);
return 0; return 0;
out:
devm_kfree(&pdev->dev, data);
return ret;
} }
static int pm860x_led_remove(struct platform_device *pdev) static int pm860x_led_remove(struct platform_device *pdev)
......
...@@ -5,10 +5,10 @@ ...@@ -5,10 +5,10 @@
* *
* Loosely derived from leds-da903x: * Loosely derived from leds-da903x:
* Copyright (C) 2008 Compulab, Ltd. * Copyright (C) 2008 Compulab, Ltd.
* Mike Rapoport <mike@compulab.co.il> * Mike Rapoport <mike@compulab.co.il>
* *
* Copyright (C) 2006-2008 Marvell International Ltd. * 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. * Licensed under the GPL-2 or later.
*/ */
......
...@@ -26,8 +26,8 @@ ...@@ -26,8 +26,8 @@
#define BD2802_LED_OFFSET 0xa #define BD2802_LED_OFFSET 0xa
#define BD2802_COLOR_OFFSET 0x3 #define BD2802_COLOR_OFFSET 0x3
#define BD2802_REG_CLKSETUP 0x00 #define BD2802_REG_CLKSETUP 0x00
#define BD2802_REG_CONTROL 0x01 #define BD2802_REG_CONTROL 0x01
#define BD2802_REG_HOURSETUP 0x02 #define BD2802_REG_HOURSETUP 0x02
#define BD2802_REG_CURRENT1SETUP 0x03 #define BD2802_REG_CURRENT1SETUP 0x03
#define BD2802_REG_CURRENT2SETUP 0x04 #define BD2802_REG_CURRENT2SETUP 0x04
...@@ -93,7 +93,7 @@ struct bd2802_led { ...@@ -93,7 +93,7 @@ struct bd2802_led {
* In ADF mode, user can set registers of BD2802GU directly, * In ADF mode, user can set registers of BD2802GU directly,
* therefore BD2802GU doesn't enter reset state. * therefore BD2802GU doesn't enter reset state.
*/ */
int adf_on; int adf_on;
enum led_ids led_id; enum led_ids led_id;
enum led_colors color; enum led_colors color;
...@@ -328,7 +328,7 @@ static ssize_t bd2802_store_reg##reg_addr(struct device *dev, \ ...@@ -328,7 +328,7 @@ static ssize_t bd2802_store_reg##reg_addr(struct device *dev, \
int ret; \ int ret; \
if (!count) \ if (!count) \
return -EINVAL; \ return -EINVAL; \
ret = strict_strtoul(buf, 16, &val); \ ret = kstrtoul(buf, 16, &val); \
if (ret) \ if (ret) \
return ret; \ return ret; \
down_write(&led->rwsem); \ down_write(&led->rwsem); \
...@@ -492,7 +492,7 @@ static ssize_t bd2802_store_##attr_name(struct device *dev, \ ...@@ -492,7 +492,7 @@ static ssize_t bd2802_store_##attr_name(struct device *dev, \
int ret; \ int ret; \
if (!count) \ if (!count) \
return -EINVAL; \ return -EINVAL; \
ret = strict_strtoul(buf, 16, &val); \ ret = kstrtoul(buf, 16, &val); \
if (ret) \ if (ret) \
return ret; \ return ret; \
down_write(&led->rwsem); \ down_write(&led->rwsem); \
......
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/module.h> #include <linux/module.h>
...@@ -26,7 +27,7 @@ static struct platform_device *pdev; ...@@ -26,7 +27,7 @@ static struct platform_device *pdev;
static int __init clevo_mail_led_dmi_callback(const struct dmi_system_id *id) 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; return 1;
} }
...@@ -135,8 +136,7 @@ static int clevo_mail_led_blink(struct led_classdev *led_cdev, ...@@ -135,8 +136,7 @@ static int clevo_mail_led_blink(struct led_classdev *led_cdev,
status = 0; status = 0;
} else { } else {
printk(KERN_DEBUG KBUILD_MODNAME pr_debug("clevo_mail_led_blink(..., %lu, %lu),"
": clevo_mail_led_blink(..., %lu, %lu),"
" returning -EINVAL (unsupported)\n", " returning -EINVAL (unsupported)\n",
*delay_on, *delay_off); *delay_on, *delay_off);
} }
...@@ -183,7 +183,7 @@ static int __init clevo_mail_led_init(void) ...@@ -183,7 +183,7 @@ static int __init clevo_mail_led_init(void)
count = dmi_check_system(clevo_mail_led_dmi_table); count = dmi_check_system(clevo_mail_led_dmi_table);
} else { } else {
count = 1; count = 1;
printk(KERN_ERR KBUILD_MODNAME ": Skipping DMI detection. " pr_err("Skipping DMI detection. "
"If the driver works on your hardware please " "If the driver works on your hardware please "
"report model and the output of dmidecode in tracker " "report model and the output of dmidecode in tracker "
"at http://sourceforge.net/projects/clevo-mailled/\n"); "at http://sourceforge.net/projects/clevo-mailled/\n");
...@@ -197,8 +197,7 @@ static int __init clevo_mail_led_init(void) ...@@ -197,8 +197,7 @@ static int __init clevo_mail_led_init(void)
error = platform_driver_probe(&clevo_mail_led_driver, error = platform_driver_probe(&clevo_mail_led_driver,
clevo_mail_led_probe); clevo_mail_led_probe);
if (error) { if (error) {
printk(KERN_ERR KBUILD_MODNAME pr_err("Can't probe platform driver\n");
": Can't probe platform driver\n");
platform_device_unregister(pdev); platform_device_unregister(pdev);
} }
} else } else
......
...@@ -43,7 +43,7 @@ static int cobalt_qube_led_probe(struct platform_device *pdev) ...@@ -43,7 +43,7 @@ static int cobalt_qube_led_probe(struct platform_device *pdev)
if (!res) if (!res)
return -EBUSY; return -EBUSY;
led_port = ioremap(res->start, resource_size(res)); led_port = devm_ioremap(&pdev->dev, res->start, resource_size(res));
if (!led_port) if (!led_port)
return -ENOMEM; return -ENOMEM;
...@@ -52,12 +52,11 @@ static int cobalt_qube_led_probe(struct platform_device *pdev) ...@@ -52,12 +52,11 @@ static int cobalt_qube_led_probe(struct platform_device *pdev)
retval = led_classdev_register(&pdev->dev, &qube_front_led); retval = led_classdev_register(&pdev->dev, &qube_front_led);
if (retval) if (retval)
goto err_iounmap; goto err_null;
return 0; return 0;
err_iounmap: err_null:
iounmap(led_port);
led_port = NULL; led_port = NULL;
return retval; return retval;
...@@ -67,10 +66,8 @@ static int cobalt_qube_led_remove(struct platform_device *pdev) ...@@ -67,10 +66,8 @@ static int cobalt_qube_led_remove(struct platform_device *pdev)
{ {
led_classdev_unregister(&qube_front_led); led_classdev_unregister(&qube_front_led);
if (led_port) { if (led_port)
iounmap(led_port);
led_port = NULL; led_port = NULL;
}
return 0; return 0;
} }
......
...@@ -85,13 +85,13 @@ static int cobalt_raq_led_probe(struct platform_device *pdev) ...@@ -85,13 +85,13 @@ static int cobalt_raq_led_probe(struct platform_device *pdev)
if (!res) if (!res)
return -EBUSY; return -EBUSY;
led_port = ioremap(res->start, resource_size(res)); led_port = devm_ioremap(&pdev->dev, res->start, resource_size(res));
if (!led_port) if (!led_port)
return -ENOMEM; return -ENOMEM;
retval = led_classdev_register(&pdev->dev, &raq_power_off_led); retval = led_classdev_register(&pdev->dev, &raq_power_off_led);
if (retval) if (retval)
goto err_iounmap; goto err_null;
retval = led_classdev_register(&pdev->dev, &raq_web_led); retval = led_classdev_register(&pdev->dev, &raq_web_led);
if (retval) if (retval)
...@@ -102,8 +102,7 @@ static int cobalt_raq_led_probe(struct platform_device *pdev) ...@@ -102,8 +102,7 @@ static int cobalt_raq_led_probe(struct platform_device *pdev)
err_unregister: err_unregister:
led_classdev_unregister(&raq_power_off_led); led_classdev_unregister(&raq_power_off_led);
err_iounmap: err_null:
iounmap(led_port);
led_port = NULL; led_port = NULL;
return retval; return retval;
...@@ -114,10 +113,8 @@ static int cobalt_raq_led_remove(struct platform_device *pdev) ...@@ -114,10 +113,8 @@ static int cobalt_raq_led_remove(struct platform_device *pdev)
led_classdev_unregister(&raq_power_off_led); led_classdev_unregister(&raq_power_off_led);
led_classdev_unregister(&raq_web_led); led_classdev_unregister(&raq_web_led);
if (led_port) { if (led_port)
iounmap(led_port);
led_port = NULL; led_port = NULL;
}
return 0; return 0;
} }
......
...@@ -2,10 +2,10 @@ ...@@ -2,10 +2,10 @@
* LEDs driver for Dialog Semiconductor DA9030/DA9034 * LEDs driver for Dialog Semiconductor DA9030/DA9034
* *
* Copyright (C) 2008 Compulab, Ltd. * Copyright (C) 2008 Compulab, Ltd.
* Mike Rapoport <mike@compulab.co.il> * Mike Rapoport <mike@compulab.co.il>
* *
* Copyright (C) 2006-2008 Marvell International Ltd. * 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 * 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 * it under the terms of the GNU General Public License version 2 as
...@@ -85,7 +85,7 @@ static void da903x_led_set(struct led_classdev *led_cdev, ...@@ -85,7 +85,7 @@ static void da903x_led_set(struct led_classdev *led_cdev,
enum led_brightness value) enum led_brightness value)
{ {
struct da903x_led *led; struct da903x_led *led;
led = container_of(led_cdev, struct da903x_led, cdev); led = container_of(led_cdev, struct da903x_led, cdev);
led->new_brightness = value; led->new_brightness = value;
schedule_work(&led->work); schedule_work(&led->work);
...@@ -156,7 +156,7 @@ static struct platform_driver da903x_led_driver = { ...@@ -156,7 +156,7 @@ static struct platform_driver da903x_led_driver = {
module_platform_driver(da903x_led_driver); module_platform_driver(da903x_led_driver);
MODULE_DESCRIPTION("LEDs driver for Dialog Semiconductor DA9030/DA9034"); MODULE_DESCRIPTION("LEDs driver for Dialog Semiconductor DA9030/DA9034");
MODULE_AUTHOR("Eric Miao <eric.miao@marvell.com>" MODULE_AUTHOR("Eric Miao <eric.miao@marvell.com>");
"Mike Rapoport <mike@compulab.co.il>"); MODULE_AUTHOR("Mike Rapoport <mike@compulab.co.il>");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_ALIAS("platform:da903x-led"); MODULE_ALIAS("platform:da903x-led");
...@@ -20,8 +20,8 @@ ...@@ -20,8 +20,8 @@
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/leds.h> #include <linux/leds.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/io.h>
#include <mach/hardware.h> #include <mach/hardware.h>
#include <asm/io.h>
#define FSG_LED_WLAN_BIT 0 #define FSG_LED_WLAN_BIT 0
#define FSG_LED_WAN_BIT 1 #define FSG_LED_WAN_BIT 1
...@@ -149,11 +149,10 @@ static int fsg_led_probe(struct platform_device *pdev) ...@@ -149,11 +149,10 @@ static int fsg_led_probe(struct platform_device *pdev)
int ret; int ret;
/* Map the LED chip select address space */ /* Map the LED chip select address space */
latch_address = (unsigned short *) ioremap(IXP4XX_EXP_BUS_BASE(2), 512); latch_address = (unsigned short *) devm_ioremap(&pdev->dev,
if (!latch_address) { IXP4XX_EXP_BUS_BASE(2), 512);
ret = -ENOMEM; if (!latch_address)
goto failremap; return -ENOMEM;
}
latch_value = 0xffff; latch_value = 0xffff;
*latch_address = latch_value; *latch_address = latch_value;
...@@ -195,8 +194,6 @@ static int fsg_led_probe(struct platform_device *pdev) ...@@ -195,8 +194,6 @@ static int fsg_led_probe(struct platform_device *pdev)
failwan: failwan:
led_classdev_unregister(&fsg_wlan_led); led_classdev_unregister(&fsg_wlan_led);
failwlan: failwlan:
iounmap(latch_address);
failremap:
return ret; return ret;
} }
...@@ -210,8 +207,6 @@ static int fsg_led_remove(struct platform_device *pdev) ...@@ -210,8 +207,6 @@ static int fsg_led_remove(struct platform_device *pdev)
led_classdev_unregister(&fsg_sync_led); led_classdev_unregister(&fsg_sync_led);
led_classdev_unregister(&fsg_ring_led); led_classdev_unregister(&fsg_ring_led);
iounmap(latch_address);
return 0; return 0;
} }
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include <linux/workqueue.h> #include <linux/workqueue.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/pinctrl/consumer.h> #include <linux/pinctrl/consumer.h>
#include <linux/err.h>
struct gpio_led_data { struct gpio_led_data {
struct led_classdev cdev; struct led_classdev cdev;
...@@ -101,15 +102,11 @@ static int create_gpio_led(const struct gpio_led *template, ...@@ -101,15 +102,11 @@ static int create_gpio_led(const struct gpio_led *template,
/* skip leds that aren't available */ /* skip leds that aren't available */
if (!gpio_is_valid(template->gpio)) { 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); template->gpio, template->name);
return 0; return 0;
} }
ret = gpio_request(template->gpio, template->name);
if (ret < 0)
return ret;
led_dat->cdev.name = template->name; led_dat->cdev.name = template->name;
led_dat->cdev.default_trigger = template->default_trigger; led_dat->cdev.default_trigger = template->default_trigger;
led_dat->gpio = template->gpio; led_dat->gpio = template->gpio;
...@@ -129,20 +126,19 @@ static int create_gpio_led(const struct gpio_led *template, ...@@ -129,20 +126,19 @@ static int create_gpio_led(const struct gpio_led *template,
if (!template->retain_state_suspended) if (!template->retain_state_suspended)
led_dat->cdev.flags |= LED_CORE_SUSPENDRESUME; 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) if (ret < 0)
goto err; return ret;
INIT_WORK(&led_dat->work, gpio_led_work); INIT_WORK(&led_dat->work, gpio_led_work);
ret = led_classdev_register(parent, &led_dat->cdev); ret = led_classdev_register(parent, &led_dat->cdev);
if (ret < 0) if (ret < 0)
goto err; return ret;
return 0; return 0;
err:
gpio_free(led_dat->gpio);
return ret;
} }
static void delete_gpio_led(struct gpio_led_data *led) static void delete_gpio_led(struct gpio_led_data *led)
...@@ -151,7 +147,6 @@ 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; return;
led_classdev_unregister(&led->cdev); led_classdev_unregister(&led->cdev);
cancel_work_sync(&led->work); cancel_work_sync(&led->work);
gpio_free(led->gpio);
} }
struct gpio_leds_priv { struct gpio_leds_priv {
...@@ -176,12 +171,16 @@ static struct gpio_leds_priv *gpio_leds_create_of(struct platform_device *pdev) ...@@ -176,12 +171,16 @@ static struct gpio_leds_priv *gpio_leds_create_of(struct platform_device *pdev)
/* count LEDs in this device, so we know how much to allocate */ /* count LEDs in this device, so we know how much to allocate */
count = of_get_child_count(np); count = of_get_child_count(np);
if (!count) 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), priv = devm_kzalloc(&pdev->dev, sizeof_gpio_leds_priv(count),
GFP_KERNEL); GFP_KERNEL);
if (!priv) if (!priv)
return NULL; return ERR_PTR(-ENOMEM);
for_each_child_of_node(np, child) { for_each_child_of_node(np, child) {
struct gpio_led led = {}; struct gpio_led led = {};
...@@ -216,7 +215,7 @@ static struct gpio_leds_priv *gpio_leds_create_of(struct platform_device *pdev) ...@@ -216,7 +215,7 @@ static struct gpio_leds_priv *gpio_leds_create_of(struct platform_device *pdev)
err: err:
for (count = priv->num_leds - 2; count >= 0; count--) for (count = priv->num_leds - 2; count >= 0; count--)
delete_gpio_led(&priv->leds[count]); delete_gpio_led(&priv->leds[count]);
return NULL; return ERR_PTR(-ENODEV);
} }
static const struct of_device_id of_gpio_leds_match[] = { static const struct of_device_id of_gpio_leds_match[] = {
...@@ -226,7 +225,7 @@ static const struct of_device_id of_gpio_leds_match[] = { ...@@ -226,7 +225,7 @@ static const struct of_device_id of_gpio_leds_match[] = {
#else /* CONFIG_OF_GPIO */ #else /* CONFIG_OF_GPIO */
static struct gpio_leds_priv *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 */ #endif /* CONFIG_OF_GPIO */
...@@ -264,8 +263,8 @@ static int gpio_led_probe(struct platform_device *pdev) ...@@ -264,8 +263,8 @@ static int gpio_led_probe(struct platform_device *pdev)
} }
} else { } else {
priv = gpio_leds_create_of(pdev); priv = gpio_leds_create_of(pdev);
if (!priv) if (IS_ERR(priv))
return -ENODEV; return PTR_ERR(priv);
} }
platform_set_drvdata(pdev, priv); platform_set_drvdata(pdev, priv);
......
...@@ -408,10 +408,10 @@ static ssize_t lm3556_indicator_pattern_store(struct device *dev, ...@@ -408,10 +408,10 @@ static ssize_t lm3556_indicator_pattern_store(struct device *dev,
return size; return size;
out: out:
dev_err(chip->dev, "%s:i2c access fail to register\n", __func__); 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 = { static const struct regmap_config lm355x_regmap = {
.reg_bits = 8, .reg_bits = 8,
......
...@@ -201,13 +201,13 @@ static ssize_t lm3642_torch_pin_store(struct device *dev, ...@@ -201,13 +201,13 @@ static ssize_t lm3642_torch_pin_store(struct device *dev,
return size; return size;
out: out:
dev_err(chip->dev, "%s:i2c access fail to register\n", __func__); dev_err(chip->dev, "%s:i2c access fail to register\n", __func__);
return size; return ret;
out_strtoint: out_strtoint:
dev_err(chip->dev, "%s: fail to change str to int\n", __func__); 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) 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, ...@@ -258,13 +258,13 @@ static ssize_t lm3642_strobe_pin_store(struct device *dev,
return size; return size;
out: out:
dev_err(chip->dev, "%s:i2c access fail to register\n", __func__); dev_err(chip->dev, "%s:i2c access fail to register\n", __func__);
return size; return ret;
out_strtoint: out_strtoint:
dev_err(chip->dev, "%s: fail to change str to int\n", __func__); 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) static void lm3642_deferred_strobe_brightness_set(struct work_struct *work)
{ {
......
...@@ -86,7 +86,7 @@ static int lp3944_reg_read(struct i2c_client *client, u8 reg, u8 *value) ...@@ -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); tmp = i2c_smbus_read_byte_data(client, reg);
if (tmp < 0) if (tmp < 0)
return -EINVAL; return tmp;
*value = tmp; *value = tmp;
......
...@@ -152,7 +152,7 @@ static int lp5521_read(struct i2c_client *client, u8 reg, u8 *buf) ...@@ -152,7 +152,7 @@ static int lp5521_read(struct i2c_client *client, u8 reg, u8 *buf)
ret = i2c_smbus_read_byte_data(client, reg); ret = i2c_smbus_read_byte_data(client, reg);
if (ret < 0) if (ret < 0)
return -EIO; return ret;
*buf = ret; *buf = ret;
return 0; return 0;
...@@ -616,7 +616,7 @@ static ssize_t store_led_pattern(struct device *dev, ...@@ -616,7 +616,7 @@ static ssize_t store_led_pattern(struct device *dev,
unsigned long val; unsigned long val;
int ret; int ret;
ret = strict_strtoul(buf, 16, &val); ret = kstrtoul(buf, 16, &val);
if (ret) if (ret)
return ret; return ret;
...@@ -788,10 +788,17 @@ static int lp5521_probe(struct i2c_client *client, ...@@ -788,10 +788,17 @@ static int lp5521_probe(struct i2c_client *client,
* LP5521_REG_ENABLE register will not have any effect - strange! * LP5521_REG_ENABLE register will not have any effect - strange!
*/ */
ret = lp5521_read(client, LP5521_REG_R_CURRENT, &buf); 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"); dev_err(&client->dev, "error in resetting chip\n");
goto fail2; 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); usleep_range(10000, 20000);
ret = lp5521_detect(client); ret = lp5521_detect(client);
......
...@@ -171,7 +171,7 @@ static int lp5523_read(struct i2c_client *client, u8 reg, u8 *buf) ...@@ -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); s32 ret = i2c_smbus_read_byte_data(client, reg);
if (ret < 0) if (ret < 0)
return -EIO; return ret;
*buf = ret; *buf = ret;
return 0; return 0;
...@@ -248,7 +248,10 @@ static int lp5523_configure(struct i2c_client *client) ...@@ -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 */ /* Let the programs run for couple of ms and check the engine status */
usleep_range(3000, 6000); 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; status &= LP5523_ENG_STATUS_MASK;
if (status == LP5523_ENG_STATUS_MASK) { if (status == LP5523_ENG_STATUS_MASK) {
...@@ -464,10 +467,16 @@ static ssize_t lp5523_selftest(struct device *dev, ...@@ -464,10 +467,16 @@ static ssize_t lp5523_selftest(struct device *dev,
LP5523_EN_LEDTEST | 16); LP5523_EN_LEDTEST | 16);
usleep_range(3000, 6000); /* ADC conversion time is typically 2.7 ms */ usleep_range(3000, 6000); /* ADC conversion time is typically 2.7 ms */
ret = lp5523_read(chip->client, LP5523_REG_STATUS, &status); ret = lp5523_read(chip->client, LP5523_REG_STATUS, &status);
if (ret < 0)
goto fail;
if (!(status & LP5523_LEDTEST_DONE)) if (!(status & LP5523_LEDTEST_DONE))
usleep_range(3000, 6000); /* Was not ready. Wait little bit */ 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 */ vdd--; /* There may be some fluctuation in measurement */
for (i = 0; i < LP5523_LEDS; i++) { for (i = 0; i < LP5523_LEDS; i++) {
...@@ -489,9 +498,14 @@ static ssize_t lp5523_selftest(struct device *dev, ...@@ -489,9 +498,14 @@ static ssize_t lp5523_selftest(struct device *dev,
/* ADC conversion time is 2.7 ms typically */ /* ADC conversion time is 2.7 ms typically */
usleep_range(3000, 6000); usleep_range(3000, 6000);
ret = lp5523_read(chip->client, LP5523_REG_STATUS, &status); ret = lp5523_read(chip->client, LP5523_REG_STATUS, &status);
if (ret < 0)
goto fail;
if (!(status & LP5523_LEDTEST_DONE)) if (!(status & LP5523_LEDTEST_DONE))
usleep_range(3000, 6000);/* Was not ready. Wait. */ 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) if (adc >= vdd || adc < LP5523_ADC_SHORTCIRC_LIM)
pos += sprintf(buf + pos, "LED %d FAIL\n", i); pos += sprintf(buf + pos, "LED %d FAIL\n", i);
...@@ -696,7 +710,7 @@ static ssize_t store_current(struct device *dev, ...@@ -696,7 +710,7 @@ static ssize_t store_current(struct device *dev,
ssize_t ret; ssize_t ret;
unsigned long curr; unsigned long curr;
if (strict_strtoul(buf, 0, &curr)) if (kstrtoul(buf, 0, &curr))
return -EINVAL; return -EINVAL;
if (curr > led->max_current) if (curr > led->max_current)
......
...@@ -89,15 +89,11 @@ static int create_lt3593_led(const struct gpio_led *template, ...@@ -89,15 +89,11 @@ static int create_lt3593_led(const struct gpio_led *template,
/* skip leds on GPIOs that aren't available */ /* skip leds on GPIOs that aren't available */
if (!gpio_is_valid(template->gpio)) { 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); KBUILD_MODNAME, template->gpio, template->name);
return 0; return 0;
} }
ret = gpio_request(template->gpio, template->name);
if (ret < 0)
return ret;
led_dat->cdev.name = template->name; led_dat->cdev.name = template->name;
led_dat->cdev.default_trigger = template->default_trigger; led_dat->cdev.default_trigger = template->default_trigger;
led_dat->gpio = template->gpio; led_dat->gpio = template->gpio;
...@@ -110,24 +106,21 @@ static int create_lt3593_led(const struct gpio_led *template, ...@@ -110,24 +106,21 @@ static int create_lt3593_led(const struct gpio_led *template,
if (!template->retain_state_suspended) if (!template->retain_state_suspended)
led_dat->cdev.flags |= LED_CORE_SUSPENDRESUME; 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) if (ret < 0)
goto err; return ret;
INIT_WORK(&led_dat->work, lt3593_led_work); INIT_WORK(&led_dat->work, lt3593_led_work);
ret = led_classdev_register(parent, &led_dat->cdev); ret = led_classdev_register(parent, &led_dat->cdev);
if (ret < 0) 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); KBUILD_MODNAME, template->name, template->gpio);
return 0; return 0;
err:
gpio_free(led_dat->gpio);
return ret;
} }
static void delete_lt3593_led(struct lt3593_led_data *led) static void delete_lt3593_led(struct lt3593_led_data *led)
...@@ -137,7 +130,6 @@ static void delete_lt3593_led(struct lt3593_led_data *led) ...@@ -137,7 +130,6 @@ static void delete_lt3593_led(struct lt3593_led_data *led)
led_classdev_unregister(&led->cdev); led_classdev_unregister(&led->cdev);
cancel_work_sync(&led->work); cancel_work_sync(&led->work);
gpio_free(led->gpio);
} }
static int lt3593_led_probe(struct platform_device *pdev) static int lt3593_led_probe(struct platform_device *pdev)
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/leds.h> #include <linux/leds.h>
#include <linux/err.h> #include <linux/err.h>
#include <asm/io.h> #include <linux/io.h>
#include <linux/nsc_gpio.h> #include <linux/nsc_gpio.h>
#include <linux/scx200_gpio.h> #include <linux/scx200_gpio.h>
#include <linux/module.h> #include <linux/module.h>
......
...@@ -243,7 +243,7 @@ static ssize_t netxbig_led_sata_store(struct device *dev, ...@@ -243,7 +243,7 @@ static ssize_t netxbig_led_sata_store(struct device *dev,
int mode_val; int mode_val;
int ret; int ret;
ret = strict_strtoul(buff, 10, &enable); ret = kstrtoul(buff, 10, &enable);
if (ret < 0) if (ret < 0)
return ret; return ret;
......
...@@ -150,7 +150,7 @@ static ssize_t ns2_led_sata_store(struct device *dev, ...@@ -150,7 +150,7 @@ static ssize_t ns2_led_sata_store(struct device *dev,
unsigned long enable; unsigned long enable;
enum ns2_led_modes mode; enum ns2_led_modes mode;
ret = strict_strtoul(buff, 10, &enable); ret = kstrtoul(buff, 10, &enable);
if (ret < 0) if (ret < 0)
return ret; return ret;
...@@ -192,29 +192,22 @@ create_ns2_led(struct platform_device *pdev, struct ns2_led_data *led_dat, ...@@ -192,29 +192,22 @@ create_ns2_led(struct platform_device *pdev, struct ns2_led_data *led_dat,
int ret; int ret;
enum ns2_led_modes mode; enum ns2_led_modes mode;
ret = gpio_request(template->cmd, template->name); ret = devm_gpio_request_one(&pdev->dev, template->cmd,
if (ret == 0) { GPIOF_DIR_OUT | gpio_get_value(template->cmd),
ret = gpio_direction_output(template->cmd, template->name);
gpio_get_value(template->cmd));
if (ret)
gpio_free(template->cmd);
}
if (ret) { if (ret) {
dev_err(&pdev->dev, "%s: failed to setup command GPIO\n", dev_err(&pdev->dev, "%s: failed to setup command GPIO\n",
template->name); template->name);
return ret;
} }
ret = gpio_request(template->slow, template->name); ret = devm_gpio_request_one(&pdev->dev, template->slow,
if (ret == 0) { GPIOF_DIR_OUT | gpio_get_value(template->slow),
ret = gpio_direction_output(template->slow, template->name);
gpio_get_value(template->slow));
if (ret)
gpio_free(template->slow);
}
if (ret) { if (ret) {
dev_err(&pdev->dev, "%s: failed to setup slow GPIO\n", dev_err(&pdev->dev, "%s: failed to setup slow GPIO\n",
template->name); template->name);
goto err_free_cmd; return ret;
} }
rwlock_init(&led_dat->rw_lock); rwlock_init(&led_dat->rw_lock);
...@@ -229,7 +222,7 @@ create_ns2_led(struct platform_device *pdev, struct ns2_led_data *led_dat, ...@@ -229,7 +222,7 @@ create_ns2_led(struct platform_device *pdev, struct ns2_led_data *led_dat,
ret = ns2_led_get_mode(led_dat, &mode); ret = ns2_led_get_mode(led_dat, &mode);
if (ret < 0) if (ret < 0)
goto err_free_slow; return ret;
/* Set LED initial state. */ /* Set LED initial state. */
led_dat->sata = (mode == NS_V2_LED_SATA) ? 1 : 0; led_dat->sata = (mode == NS_V2_LED_SATA) ? 1 : 0;
...@@ -238,7 +231,7 @@ create_ns2_led(struct platform_device *pdev, struct ns2_led_data *led_dat, ...@@ -238,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); ret = led_classdev_register(&pdev->dev, &led_dat->cdev);
if (ret < 0) if (ret < 0)
goto err_free_slow; return ret;
ret = device_create_file(led_dat->cdev.dev, &dev_attr_sata); ret = device_create_file(led_dat->cdev.dev, &dev_attr_sata);
if (ret < 0) if (ret < 0)
...@@ -248,11 +241,6 @@ create_ns2_led(struct platform_device *pdev, struct ns2_led_data *led_dat, ...@@ -248,11 +241,6 @@ create_ns2_led(struct platform_device *pdev, struct ns2_led_data *led_dat,
err_free_cdev: err_free_cdev:
led_classdev_unregister(&led_dat->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; return ret;
} }
...@@ -260,8 +248,6 @@ static void delete_ns2_led(struct ns2_led_data *led_dat) ...@@ -260,8 +248,6 @@ static void delete_ns2_led(struct ns2_led_data *led_dat)
{ {
device_remove_file(led_dat->cdev.dev, &dev_attr_sata); device_remove_file(led_dat->cdev.dev, &dev_attr_sata);
led_classdev_unregister(&led_dat->cdev); led_classdev_unregister(&led_dat->cdev);
gpio_free(led_dat->cmd);
gpio_free(led_dat->slow);
} }
#ifdef CONFIG_OF_GPIO #ifdef CONFIG_OF_GPIO
......
...@@ -277,7 +277,7 @@ static int pca955x_probe(struct i2c_client *client, ...@@ -277,7 +277,7 @@ static int pca955x_probe(struct i2c_client *client,
return -ENODEV; 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", "slave address 0x%02x\n",
id->name, chip->bits, client->addr); id->name, chip->bits, client->addr);
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
struct led_pwm_data { struct led_pwm_data {
struct led_classdev cdev; struct led_classdev cdev;
struct pwm_device *pwm; struct pwm_device *pwm;
unsigned int active_low; unsigned int active_low;
unsigned int period; unsigned int period;
}; };
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
#include <asm/mach-rc32434/rb.h> #include <asm/mach-rc32434/rb.h>
static void rb532_led_set(struct led_classdev *cdev, static void rb532_led_set(struct led_classdev *cdev,
enum led_brightness brightness) enum led_brightness brightness)
{ {
if (brightness) if (brightness)
set_latch_u5(LO_ULED, 0); set_latch_u5(LO_ULED, 0);
......
...@@ -204,10 +204,10 @@ static void r_tpu_set_pin(struct r_tpu_priv *p, enum r_tpu_pin new_state, ...@@ -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) if (p->pin_state == R_TPU_PIN_GPIO_FN)
gpio_free(cfg->pin_gpio_fn); gpio_free(cfg->pin_gpio_fn);
if (new_state == R_TPU_PIN_GPIO) { if (new_state == R_TPU_PIN_GPIO)
gpio_request(cfg->pin_gpio, cfg->name); gpio_request_one(cfg->pin_gpio, GPIOF_DIR_OUT | !!brightness,
gpio_direction_output(cfg->pin_gpio, !!brightness); cfg->name);
}
if (new_state == R_TPU_PIN_GPIO_FN) if (new_state == R_TPU_PIN_GPIO_FN)
gpio_request(cfg->pin_gpio_fn, cfg->name); gpio_request(cfg->pin_gpio_fn, cfg->name);
...@@ -263,18 +263,18 @@ static int r_tpu_probe(struct platform_device *pdev) ...@@ -263,18 +263,18 @@ static int r_tpu_probe(struct platform_device *pdev)
} }
/* map memory, let mapbase point to our channel */ /* 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) { if (p->mapbase == NULL) {
dev_err(&pdev->dev, "failed to remap I/O memory\n"); dev_err(&pdev->dev, "failed to remap I/O memory\n");
return -ENXIO; return -ENXIO;
} }
/* get hold of clock */ /* get hold of clock */
p->clk = clk_get(&pdev->dev, NULL); p->clk = devm_clk_get(&pdev->dev, NULL);
if (IS_ERR(p->clk)) { if (IS_ERR(p->clk)) {
dev_err(&pdev->dev, "cannot get clock\n"); dev_err(&pdev->dev, "cannot get clock\n");
ret = PTR_ERR(p->clk); return PTR_ERR(p->clk);
goto err0;
} }
p->pdev = pdev; p->pdev = pdev;
...@@ -293,7 +293,7 @@ static int r_tpu_probe(struct platform_device *pdev) ...@@ -293,7 +293,7 @@ static int r_tpu_probe(struct platform_device *pdev)
p->ldev.flags |= LED_CORE_SUSPENDRESUME; p->ldev.flags |= LED_CORE_SUSPENDRESUME;
ret = led_classdev_register(&pdev->dev, &p->ldev); ret = led_classdev_register(&pdev->dev, &p->ldev);
if (ret < 0) if (ret < 0)
goto err1; goto err0;
/* max_brightness may be updated by the LED core code */ /* max_brightness may be updated by the LED core code */
p->min_rate = p->ldev.max_brightness * p->refresh_rate; p->min_rate = p->ldev.max_brightness * p->refresh_rate;
...@@ -301,11 +301,8 @@ static int r_tpu_probe(struct platform_device *pdev) ...@@ -301,11 +301,8 @@ static int r_tpu_probe(struct platform_device *pdev)
pm_runtime_enable(&pdev->dev); pm_runtime_enable(&pdev->dev);
return 0; return 0;
err1:
r_tpu_set_pin(p, R_TPU_PIN_UNUSED, LED_OFF);
clk_put(p->clk);
err0: err0:
iounmap(p->mapbase); r_tpu_set_pin(p, R_TPU_PIN_UNUSED, LED_OFF);
return ret; return ret;
} }
...@@ -320,9 +317,7 @@ static int r_tpu_remove(struct platform_device *pdev) ...@@ -320,9 +317,7 @@ static int r_tpu_remove(struct platform_device *pdev)
r_tpu_set_pin(p, R_TPU_PIN_UNUSED, LED_OFF); r_tpu_set_pin(p, R_TPU_PIN_UNUSED, LED_OFF);
pm_runtime_disable(&pdev->dev); pm_runtime_disable(&pdev->dev);
clk_put(p->clk);
iounmap(p->mapbase);
return 0; return 0;
} }
......
...@@ -459,7 +459,7 @@ static ssize_t nas_led_blink_store(struct device *dev, ...@@ -459,7 +459,7 @@ static ssize_t nas_led_blink_store(struct device *dev,
struct led_classdev *led = dev_get_drvdata(dev); struct led_classdev *led = dev_get_drvdata(dev);
unsigned long blink_state; unsigned long blink_state;
ret = strict_strtoul(buf, 10, &blink_state); ret = kstrtoul(buf, 10, &blink_state);
if (ret) if (ret)
return ret; return ret;
......
...@@ -216,13 +216,13 @@ static int wm8350_led_probe(struct platform_device *pdev) ...@@ -216,13 +216,13 @@ static int wm8350_led_probe(struct platform_device *pdev)
isink = devm_regulator_get(&pdev->dev, "led_isink"); isink = devm_regulator_get(&pdev->dev, "led_isink");
if (IS_ERR(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); return PTR_ERR(isink);
} }
dcdc = devm_regulator_get(&pdev->dev, "led_vcc"); dcdc = devm_regulator_get(&pdev->dev, "led_vcc");
if (IS_ERR(dcdc)) { 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); return PTR_ERR(dcdc);
} }
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/leds.h> #include <linux/leds.h>
#include <linux/err.h> #include <linux/err.h>
#include <asm/io.h> #include <linux/io.h>
#include <linux/scx200_gpio.h> #include <linux/scx200_gpio.h>
#include <linux/module.h> #include <linux/module.h>
......
...@@ -40,7 +40,7 @@ static int fb_notifier_callback(struct notifier_block *p, ...@@ -40,7 +40,7 @@ static int fb_notifier_callback(struct notifier_block *p,
int new_status = *blank ? BLANK : UNBLANK; int new_status = *blank ? BLANK : UNBLANK;
switch (event) { switch (event) {
case FB_EVENT_BLANK : case FB_EVENT_BLANK:
if (new_status == n->old_status) if (new_status == n->old_status)
break; break;
...@@ -76,7 +76,7 @@ static ssize_t bl_trig_invert_store(struct device *dev, ...@@ -76,7 +76,7 @@ static ssize_t bl_trig_invert_store(struct device *dev,
unsigned long invert; unsigned long invert;
int ret; int ret;
ret = strict_strtoul(buf, 10, &invert); ret = kstrtoul(buf, 10, &invert);
if (ret < 0) if (ret < 0)
return ret; return ret;
......
...@@ -110,7 +110,7 @@ static ssize_t gpio_trig_inverted_store(struct device *dev, ...@@ -110,7 +110,7 @@ static ssize_t gpio_trig_inverted_store(struct device *dev,
unsigned long inverted; unsigned long inverted;
int ret; int ret;
ret = strict_strtoul(buf, 10, &inverted); ret = kstrtoul(buf, 10, &inverted);
if (ret < 0) if (ret < 0)
return ret; return ret;
......
...@@ -179,6 +179,23 @@ extern void led_trigger_blink_oneshot(struct led_trigger *trigger, ...@@ -179,6 +179,23 @@ extern void led_trigger_blink_oneshot(struct led_trigger *trigger,
unsigned long *delay_on, unsigned long *delay_on,
unsigned long *delay_off, unsigned long *delay_off,
int invert); int invert);
/**
* led_trigger_rename_static - rename a trigger
* @name: the new trigger name
* @trig: the LED trigger to rename
*
* Change a LED trigger name by copying the string passed in
* name into current trigger name, which MUST be large
* enough for the new string.
*
* Note that name must NOT point to the same string used
* during LED registration, as that could lead to races.
*
* This is meant to be used on triggers with statically
* allocated name.
*/
extern void led_trigger_rename_static(const char *name,
struct led_trigger *trig);
#else #else
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment