leds: Standardise LED naming scheme
authorRichard Purdie <rpurdie@rpsys.net>
Wed, 31 Oct 2007 14:00:07 +0000 (15:00 +0100)
committerRichard Purdie <rpurdie@rpsys.net>
Thu, 7 Feb 2008 09:47:00 +0000 (09:47 +0000)
As discussed on LKML some notion of 'function' is needed in
LED naming. This patch adds this to the documentation and
standardises existing LED drivers.

Signed-off-by: Richard Purdie <rpurdie@rpsys.net>
16 files changed:
Documentation/leds-class.txt
arch/arm/mach-ixp4xx/dsmg600-setup.c
arch/arm/mach-ixp4xx/nas100d-setup.c
arch/arm/mach-ixp4xx/nslu2-setup.c
drivers/hwmon/applesmc.c
drivers/input/misc/wistron_btns.c
drivers/leds/leds-ams-delta.c
drivers/leds/leds-clevo-mail.c
drivers/leds/leds-corgi.c
drivers/leds/leds-locomo.c
drivers/leds/leds-net48xx.c
drivers/leds/leds-spitz.c
drivers/leds/leds-tosa.c
drivers/leds/leds-wrap.c
drivers/misc/asus-laptop.c
drivers/net/wireless/b43/leds.c

index 8c35c0426110f149100be9cb2c17921e8e25ae39..877af6efc18b51285eb598824ecc32630ab2e184 100644 (file)
@@ -39,12 +39,13 @@ LED Device Naming
 
 Is currently of the form:
 
-"devicename:colour"
+"devicename:colour:function"
 
 There have been calls for LED properties such as colour to be exported as
 individual led class attributes. As a solution which doesn't incur as much
 overhead, I suggest these become part of the device name. The naming scheme
-above leaves scope for further attributes should they be needed.
+above leaves scope for further attributes should they be needed. If sections
+of the name don't apply, just leave that section blank.
 
 
 Known Issues
index 688659668bdf12156627f7780057ae76c6e9b5fb..8cb07437a807f81d92eed0bbd1a7d82b5118ab5d 100644 (file)
@@ -71,11 +71,11 @@ static struct i2c_board_info __initdata dsmg600_i2c_board_info [] = {
 
 static struct gpio_led dsmg600_led_pins[] = {
        {
-               .name           = "power",
+               .name           = "dsmg600:green:power",
                .gpio           = DSMG600_LED_PWR_GPIO,
        },
        {
-               .name           = "wlan",
+               .name           = "dsmg600:green:wlan",
                .gpio           = DSMG600_LED_WLAN_GPIO,
                .active_low     = true,
        },
index 4cecae84837b37309039280122ed726356d6ab5c..159e1c4f1edaa789deb76336aa1616fd38c02c1c 100644 (file)
@@ -60,17 +60,17 @@ static struct i2c_board_info __initdata nas100d_i2c_board_info [] = {
 
 static struct gpio_led nas100d_led_pins[] = {
        {
-               .name           = "wlan",   /* green led */
+               .name           = "nas100d:green:wlan",
                .gpio           = NAS100D_LED_WLAN_GPIO,
                .active_low     = true,
        },
        {
-               .name           = "power",  /* blue power led (off=flashing) */
+               .name           = "nas100d:blue:power",  /* (off=flashing) */
                .gpio           = NAS100D_LED_PWR_GPIO,
                .active_low     = true,
        },
        {
-               .name           = "disk",   /* yellow led */
+               .name           = "nas100d:yellow:disk",
                .gpio           = NAS100D_LED_DISK_GPIO,
                .active_low     = true,
        },
index acaebcbce53a07319cade57fb80f5bdbb8543ea1..d9a182895a0f998bee850213b0c607dbc13eceb4 100644 (file)
@@ -63,20 +63,20 @@ static struct i2c_board_info __initdata nslu2_i2c_board_info [] = {
 
 static struct gpio_led nslu2_led_pins[] = {
        {
-               .name           = "ready",  /* green led */
+               .name           = "nslu2:green:ready",
                .gpio           = NSLU2_LED_GRN_GPIO,
        },
        {
-               .name           = "status", /* red led */
+               .name           = "nslu2:red:status",
                .gpio           = NSLU2_LED_RED_GPIO,
        },
        {
-               .name           = "disk-1",
+               .name           = "nslu2:green:disk-1",
                .gpio           = NSLU2_LED_DISK1_GPIO,
                .active_low     = true,
        },
        {
-               .name           = "disk-2",
+               .name           = "nslu2:green:disk-2",
                .gpio           = NSLU2_LED_DISK2_GPIO,
                .active_low     = true,
        },
index 86c66c345f8b76f8274272796917c740ba312e26..0c94770b7f83cd5fca272ba22877a9f045121904 100644 (file)
@@ -905,7 +905,7 @@ static ssize_t applesmc_key_at_index_store(struct device *dev,
 }
 
 static struct led_classdev applesmc_backlight = {
-       .name                   = "smc:kbd_backlight",
+       .name                   = "smc::kbd_backlight",
        .default_trigger        = "nand-disk",
        .brightness_set         = applesmc_brightness_set,
 };
index b438d998625c695f3d7f031ecf851f8c2683be18..72176f3d49cb3ad5e0c091c35fdcebff9047a984 100644 (file)
@@ -998,12 +998,12 @@ static void wistron_wifi_led_set(struct led_classdev *led_cdev,
 }
 
 static struct led_classdev wistron_mail_led = {
-       .name                   = "mail:green",
+       .name                   = "wistron:green:mail",
        .brightness_set         = wistron_mail_led_set,
 };
 
 static struct led_classdev wistron_wifi_led = {
-       .name                   = "wifi:red",
+       .name                   = "wistron:red:wifi",
        .brightness_set         = wistron_wifi_led_set,
 };
 
index 599878c8e7146fb65f2799ca6cfba1a13dc652c0..9e3077463d8481944e351b466e3d4e6749751cb9 100644 (file)
@@ -37,42 +37,42 @@ static void ams_delta_led_set(struct led_classdev *led_cdev,
 static struct ams_delta_led ams_delta_leds[] = {
        {
                .cdev           = {
-                       .name           = "ams-delta:camera",
+                       .name           = "ams-delta::camera",
                        .brightness_set = ams_delta_led_set,
                },
                .bitmask        = AMS_DELTA_LATCH1_LED_CAMERA,
        },
        {
                .cdev           = {
-                       .name           = "ams-delta:advert",
+                       .name           = "ams-delta::advert",
                        .brightness_set = ams_delta_led_set,
                },
                .bitmask        = AMS_DELTA_LATCH1_LED_ADVERT,
        },
        {
                .cdev           = {
-                       .name           = "ams-delta:email",
+                       .name           = "ams-delta::email",
                        .brightness_set = ams_delta_led_set,
                },
                .bitmask        = AMS_DELTA_LATCH1_LED_EMAIL,
        },
        {
                .cdev           = {
-                       .name           = "ams-delta:handsfree",
+                       .name           = "ams-delta::handsfree",
                        .brightness_set = ams_delta_led_set,
                },
                .bitmask        = AMS_DELTA_LATCH1_LED_HANDSFREE,
        },
        {
                .cdev           = {
-                       .name           = "ams-delta:voicemail",
+                       .name           = "ams-delta::voicemail",
                        .brightness_set = ams_delta_led_set,
                },
                .bitmask        = AMS_DELTA_LATCH1_LED_VOICEMAIL,
        },
        {
                .cdev           = {
-                       .name           = "ams-delta:voice",
+                       .name           = "ams-delta::voice",
                        .brightness_set = ams_delta_led_set,
                },
                .bitmask        = AMS_DELTA_LATCH1_LED_VOICE,
index 50aaa0b338101782a3b010485e9bfab048b6d4d2..49a7972459c9418cc59271b08010ce0b676bb804 100644 (file)
@@ -93,7 +93,7 @@ static void clevo_mail_led_set(struct led_classdev *led_cdev,
 }
 
 static struct led_classdev clevo_mail_led = {
-       .name                   = "clevo",
+       .name                   = "clevo::mail",
        .brightness_set         = clevo_mail_led_set,
 };
 
index cf1dcd719a282eae18e596e7673807b48ef524c5..e45f6c4b59ba4fd6c57293ba60dd55e49013aada 100644 (file)
@@ -38,13 +38,13 @@ static void corgiled_green_set(struct led_classdev *led_cdev, enum led_brightnes
 }
 
 static struct led_classdev corgi_amber_led = {
-       .name                   = "corgi:amber",
+       .name                   = "corgi:amber:charge",
        .default_trigger        = "sharpsl-charge",
        .brightness_set         = corgiled_amber_set,
 };
 
 static struct led_classdev corgi_green_led = {
-       .name                   = "corgi:green",
+       .name                   = "corgi:green:mail",
        .default_trigger        = "nand-disk",
        .brightness_set         = corgiled_green_set,
 };
index 2207335e9212e97b64a05bdd290819ceee83a89d..7295f7f52185162d68b98f72dc5dc66ee565c9a0 100644 (file)
@@ -43,13 +43,13 @@ static void locomoled_brightness_set1(struct led_classdev *led_cdev,
 }
 
 static struct led_classdev locomo_led0 = {
-       .name                   = "locomo:amber",
+       .name                   = "locomo:amber:charge",
        .default_trigger        = "sharpsl-charge",
        .brightness_set         = locomoled_brightness_set0,
 };
 
 static struct led_classdev locomo_led1 = {
-       .name                   = "locomo:green",
+       .name                   = "locomo:green:mail",
        .default_trigger        = "nand-disk",
        .brightness_set         = locomoled_brightness_set1,
 };
index 45ba3d45bcb8a8387461883ae050aa308213a812..054360473c9490ea6e4251188dcbf4cad92fa310 100644 (file)
@@ -31,7 +31,7 @@ static void net48xx_error_led_set(struct led_classdev *led_cdev,
 }
 
 static struct led_classdev net48xx_error_led = {
-       .name           = "net48xx:error",
+       .name           = "net48xx::error",
        .brightness_set = net48xx_error_led_set,
 };
 
index 126d09cc96ecf97cad158fe47315e73c13e96779..93e1012b17e620c1c85e8ad037180142676d11b4 100644 (file)
@@ -38,13 +38,13 @@ static void spitzled_green_set(struct led_classdev *led_cdev, enum led_brightnes
 }
 
 static struct led_classdev spitz_amber_led = {
-       .name                   = "spitz:amber",
+       .name                   = "spitz:amber:charge",
        .default_trigger        = "sharpsl-charge",
        .brightness_set         = spitzled_amber_set,
 };
 
 static struct led_classdev spitz_green_led = {
-       .name                   = "spitz:green",
+       .name                   = "spitz:green:hddactivity",
        .default_trigger        = "ide-disk",
        .brightness_set         = spitzled_green_set,
 };
@@ -72,8 +72,10 @@ static int spitzled_probe(struct platform_device *pdev)
 {
        int ret;
 
-       if (machine_is_akita())
+       if (machine_is_akita()) {
+               spitz_green_led.name = "spitz:green:mail";
                spitz_green_led.default_trigger = "nand-disk";
+       }
 
        ret = led_classdev_register(&pdev->dev, &spitz_amber_led);
        if (ret < 0)
index fb2416a38303ce87aab0766dac1c9997ecca506a..9e0a188fbb0a224ceb66fc7fe3b22a0bc4668437 100644 (file)
@@ -45,13 +45,13 @@ static void tosaled_green_set(struct led_classdev *led_cdev,
 }
 
 static struct led_classdev tosa_amber_led = {
-       .name                   = "tosa:amber",
+       .name                   = "tosa:amber:charge",
        .default_trigger        = "sharpsl-charge",
        .brightness_set         = tosaled_amber_set,
 };
 
 static struct led_classdev tosa_green_led = {
-       .name                   = "tosa:green",
+       .name                   = "tosa:green:mail",
        .default_trigger        = "nand-disk",
        .brightness_set         = tosaled_green_set,
 };
index 27fb2d8e991fd55343f51021df26887ddffa3f29..5770cc36ec209a49fbf7172ca74b67e003eb739d 100644 (file)
@@ -43,12 +43,12 @@ static void wrap_extra_led_set(struct led_classdev *led_cdev,
 }
 
 static struct led_classdev wrap_error_led = {
-       .name           = "wrap:error",
+       .name           = "wrap::error",
        .brightness_set = wrap_error_led_set,
 };
 
 static struct led_classdev wrap_extra_led = {
-       .name           = "wrap:extra",
+       .name           = "wrap::extra",
        .brightness_set = wrap_extra_led_set,
 };
 
index 0846c33296bc7e1a0da8aabf21a7023667613edb..3a36a294e91b2ce731586950edb4ac5d4e9da8b2 100644 (file)
@@ -239,7 +239,7 @@ static struct workqueue_struct *led_workqueue;
        static int object##_led_wk;                                     \
        static DECLARE_WORK(object##_led_work, object##_led_update);    \
        static struct led_classdev object##_led = {                     \
-               .name           = "asus:" ledname,                      \
+               .name           = "asus::" ledname,                     \
                .brightness_set = object##_led_set,                     \
        }
 
index 0908335892dbba7214fc1d995d7a9af2da7f54e5..0aac1ff511df768a6ea38175e22a270a00ebaf20 100644 (file)
@@ -147,12 +147,12 @@ static void b43_map_led(struct b43_wldev *dev,
        case B43_LED_TRANSFER:
        case B43_LED_APTRANSFER:
                snprintf(name, sizeof(name),
-                        "b43-%s:tx", wiphy_name(hw->wiphy));
+                        "b43-%s::tx", wiphy_name(hw->wiphy));
                b43_register_led(dev, &dev->led_tx, name,
                                 ieee80211_get_tx_led_name(hw),
                                 led_index, activelow);
                snprintf(name, sizeof(name),
-                        "b43-%s:rx", wiphy_name(hw->wiphy));
+                        "b43-%s::rx", wiphy_name(hw->wiphy));
                b43_register_led(dev, &dev->led_rx, name,
                                 ieee80211_get_rx_led_name(hw),
                                 led_index, activelow);
@@ -162,7 +162,7 @@ static void b43_map_led(struct b43_wldev *dev,
        case B43_LED_RADIO_B:
        case B43_LED_MODE_BG:
                snprintf(name, sizeof(name),
-                        "b43-%s:radio", wiphy_name(hw->wiphy));
+                        "b43-%s::radio", wiphy_name(hw->wiphy));
                b43_register_led(dev, &dev->led_radio, name,
                                 b43_rfkill_led_name(dev),
                                 led_index, activelow);
@@ -173,7 +173,7 @@ static void b43_map_led(struct b43_wldev *dev,
        case B43_LED_WEIRD:
        case B43_LED_ASSOC:
                snprintf(name, sizeof(name),
-                        "b43-%s:assoc", wiphy_name(hw->wiphy));
+                        "b43-%s::assoc", wiphy_name(hw->wiphy));
                b43_register_led(dev, &dev->led_assoc, name,
                                 ieee80211_get_assoc_led_name(hw),
                                 led_index, activelow);