Skip to content

Commit

Permalink
Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/…
Browse files Browse the repository at this point in the history
…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
  ...
  • Loading branch information
torvalds committed Dec 15, 2012
2 parents 75e300c + 2f05e1d commit e81d372
Show file tree
Hide file tree
Showing 30 changed files with 164 additions and 158 deletions.
2 changes: 1 addition & 1 deletion drivers/leds/led-class.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
25 changes: 19 additions & 6 deletions drivers/leds/led-triggers.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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);
Expand Down
9 changes: 2 additions & 7 deletions drivers/leds/leds-88pm860x.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions drivers/leds/leds-adp5520.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down
10 changes: 5 additions & 5 deletions drivers/leds/leds-bd2802.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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); \
Expand Down Expand Up @@ -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); \
Expand Down
11 changes: 5 additions & 6 deletions drivers/leds/leds-clevo-mail.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt

#include <linux/module.h>

Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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");
Expand All @@ -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
Expand Down
11 changes: 4 additions & 7 deletions drivers/leds/leds-cobalt-qube.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ static int 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;

Expand All @@ -52,12 +52,11 @@ static int 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;
Expand All @@ -67,10 +66,8 @@ 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;
}
Expand Down
11 changes: 4 additions & 7 deletions drivers/leds/leds-cobalt-raq.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,13 @@ static int 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)
Expand All @@ -102,8 +102,7 @@ static int 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;
Expand All @@ -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_web_led);

if (led_port) {
iounmap(led_port);
if (led_port)
led_port = NULL;
}

return 0;
}
Expand Down
10 changes: 5 additions & 5 deletions drivers/leds/leds-da903x.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -85,7 +85,7 @@ 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);
Expand Down Expand Up @@ -156,7 +156,7 @@ static struct platform_driver da903x_led_driver = {
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");
15 changes: 5 additions & 10 deletions drivers/leds/leds-fsg.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
Expand All @@ -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;
}

Expand Down
Loading

0 comments on commit e81d372

Please sign in to comment.