Skip to content

Commit

Permalink
Merge branch 'for-linus' of git://git.o-hand.com/linux-rpurdie-leds
Browse files Browse the repository at this point in the history
* 'for-linus' of git://git.o-hand.com/linux-rpurdie-leds:
  leds/acpi: Fix merge fallout from acpi_driver_data change
  leds: Simplify logic in leds-ams-delta
  leds: Fix trigger registration race
  leds: Fix leds-class.c comment
  leds: Add driver for HP harddisk protection LEDs
  leds: leds-pca955x - Mark pca955x_led_set() static
  leds: Remove uneeded leds-cm-x270 driver
  leds: Remove uneeded strlen calls
  leds: Add leds-wrap default-trigger
  leds: Make default trigger fields const
  leds: Add backlight LED trigger
  leds: da903x: Add support for LEDs found on DA9030/DA9034
  • Loading branch information
torvalds committed Oct 23, 2008
2 parents 0d876c6 + 601a1b9 commit ea54168
Show file tree
Hide file tree
Showing 12 changed files with 488 additions and 157 deletions.
25 changes: 21 additions & 4 deletions drivers/leds/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,12 @@ config LEDS_GPIO
outputs. To be useful the particular board must have LEDs
and they must be connected to the GPIO lines.

config LEDS_CM_X270
tristate "LED Support for the CM-X270 LEDs"
depends on LEDS_CLASS && MACH_ARMCORE
config LEDS_HP_DISK
tristate "LED Support for disk protection LED on HP notebooks"
depends on LEDS_CLASS && ACPI
help
This option enables support for the CM-X270 LEDs.
This option enable support for disk protection LED, found on
newer HP notebooks.

config LEDS_CLEVO_MAIL
tristate "Mail LED on Clevo notebook (EXPERIMENTAL)"
Expand Down Expand Up @@ -157,6 +158,13 @@ config LEDS_PCA955X
LED driver chips accessed via the I2C bus. Supported
devices include PCA9550, PCA9551, PCA9552, and PCA9553.

config LEDS_DA903X
tristate "LED Support for DA9030/DA9034 PMIC"
depends on LEDS_CLASS && PMIC_DA903X
help
This option enables support for on-chip LED drivers found
on Dialog Semiconductor DA9030/DA9034 PMICs.

comment "LED Triggers"

config LEDS_TRIGGERS
Expand Down Expand Up @@ -193,6 +201,15 @@ config LEDS_TRIGGER_HEARTBEAT
load average.
If unsure, say Y.

config LEDS_TRIGGER_BACKLIGHT
tristate "LED backlight Trigger"
depends on LEDS_TRIGGERS
help
This allows LEDs to be controlled as a backlight device: they
turn off and on when the display is blanked and unblanked.

If unsure, say N.

config LEDS_TRIGGER_DEFAULT_ON
tristate "LED Default ON Trigger"
depends on LEDS_TRIGGERS
Expand Down
4 changes: 3 additions & 1 deletion drivers/leds/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,16 @@ obj-$(CONFIG_LEDS_COBALT_RAQ) += leds-cobalt-raq.o
obj-$(CONFIG_LEDS_SUNFIRE) += leds-sunfire.o
obj-$(CONFIG_LEDS_PCA9532) += leds-pca9532.o
obj-$(CONFIG_LEDS_GPIO) += leds-gpio.o
obj-$(CONFIG_LEDS_CM_X270) += leds-cm-x270.o
obj-$(CONFIG_LEDS_CLEVO_MAIL) += leds-clevo-mail.o
obj-$(CONFIG_LEDS_HP6XX) += leds-hp6xx.o
obj-$(CONFIG_LEDS_FSG) += leds-fsg.o
obj-$(CONFIG_LEDS_PCA955X) += leds-pca955x.o
obj-$(CONFIG_LEDS_DA903X) += leds-da903x.o
obj-$(CONFIG_LEDS_HP_DISK) += leds-hp-disk.o

# LED Triggers
obj-$(CONFIG_LEDS_TRIGGER_TIMER) += ledtrig-timer.o
obj-$(CONFIG_LEDS_TRIGGER_IDE_DISK) += ledtrig-ide-disk.o
obj-$(CONFIG_LEDS_TRIGGER_HEARTBEAT) += ledtrig-heartbeat.o
obj-$(CONFIG_LEDS_TRIGGER_BACKLIGHT) += ledtrig-backlight.o
obj-$(CONFIG_LEDS_TRIGGER_DEFAULT_ON) += ledtrig-default-on.o
12 changes: 5 additions & 7 deletions drivers/leds/led-class.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,11 @@ static ssize_t led_brightness_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct led_classdev *led_cdev = dev_get_drvdata(dev);
ssize_t ret = 0;

/* no lock needed for this */
led_update_brightness(led_cdev);
sprintf(buf, "%u\n", led_cdev->brightness);
ret = strlen(buf) + 1;

return ret;
return sprintf(buf, "%u\n", led_cdev->brightness);
}

static ssize_t led_brightness_store(struct device *dev,
Expand Down Expand Up @@ -113,6 +110,9 @@ int led_classdev_register(struct device *parent, struct led_classdev *led_cdev)
if (rc)
goto err_out;

#ifdef CONFIG_LEDS_TRIGGERS
init_rwsem(&led_cdev->trigger_lock);
#endif
/* add to the list of leds */
down_write(&leds_list_lock);
list_add_tail(&led_cdev->node, &leds_list);
Expand All @@ -121,8 +121,6 @@ int led_classdev_register(struct device *parent, struct led_classdev *led_cdev)
led_update_brightness(led_cdev);

#ifdef CONFIG_LEDS_TRIGGERS
init_rwsem(&led_cdev->trigger_lock);

rc = device_create_file(led_cdev->dev, &dev_attr_trigger);
if (rc)
goto err_out_led_list;
Expand All @@ -147,7 +145,7 @@ int led_classdev_register(struct device *parent, struct led_classdev *led_cdev)
EXPORT_SYMBOL_GPL(led_classdev_register);

/**
* __led_classdev_unregister - unregisters a object of led_properties class.
* led_classdev_unregister - unregisters a object of led_properties class.
* @led_cdev: the led device to unregister
*
* Unregisters a previously registered via led_classdev_register object.
Expand Down
20 changes: 10 additions & 10 deletions drivers/leds/leds-ams-delta.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,27 +107,27 @@ static int ams_delta_led_resume(struct platform_device *dev)

static int ams_delta_led_probe(struct platform_device *pdev)
{
int i;
int ret;
int i, ret;

for (i = ret = 0; ret >= 0 && i < ARRAY_SIZE(ams_delta_leds); i++) {
for (i = 0; i < ARRAY_SIZE(ams_delta_leds); i++) {
ret = led_classdev_register(&pdev->dev,
&ams_delta_leds[i].cdev);
if (ret < 0)
goto fail;
}

if (ret < 0 && i > 1) {
for (i = i - 2; i >= 0; i--)
led_classdev_unregister(&ams_delta_leds[i].cdev);
}

return ret;
return 0;
fail:
while (--i >= 0)
led_classdev_unregister(&ams_delta_leds[i].cdev);
return ret;
}

static int ams_delta_led_remove(struct platform_device *pdev)
{
int i;

for (i = ARRAY_SIZE(ams_delta_leds) - 1; i >= 0; i--)
for (i = 0; i < ARRAY_SIZE(ams_delta_leds); i--)
led_classdev_unregister(&ams_delta_leds[i].cdev);

return 0;
Expand Down
124 changes: 0 additions & 124 deletions drivers/leds/leds-cm-x270.c

This file was deleted.

Loading

0 comments on commit ea54168

Please sign in to comment.