aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/leds/leds-ns2.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/drivers/leds/leds-ns2.c b/drivers/leds/leds-ns2.c
index efa625883c83..231993d1fe21 100644
--- a/drivers/leds/leds-ns2.c
+++ b/drivers/leds/leds-ns2.c
@@ -185,6 +185,12 @@ static ssize_t ns2_led_sata_show(struct device *dev,
185 185
186static DEVICE_ATTR(sata, 0644, ns2_led_sata_show, ns2_led_sata_store); 186static DEVICE_ATTR(sata, 0644, ns2_led_sata_show, ns2_led_sata_store);
187 187
188static struct attribute *ns2_led_attrs[] = {
189 &dev_attr_sata.attr,
190 NULL
191};
192ATTRIBUTE_GROUPS(ns2_led);
193
188static int 194static int
189create_ns2_led(struct platform_device *pdev, struct ns2_led_data *led_dat, 195create_ns2_led(struct platform_device *pdev, struct ns2_led_data *led_dat,
190 const struct ns2_led *template) 196 const struct ns2_led *template)
@@ -219,6 +225,7 @@ create_ns2_led(struct platform_device *pdev, struct ns2_led_data *led_dat,
219 led_dat->cdev.blink_set = NULL; 225 led_dat->cdev.blink_set = NULL;
220 led_dat->cdev.brightness_set = ns2_led_set; 226 led_dat->cdev.brightness_set = ns2_led_set;
221 led_dat->cdev.flags |= LED_CORE_SUSPENDRESUME; 227 led_dat->cdev.flags |= LED_CORE_SUSPENDRESUME;
228 led_dat->cdev.groups = ns2_led_groups;
222 led_dat->cmd = template->cmd; 229 led_dat->cmd = template->cmd;
223 led_dat->slow = template->slow; 230 led_dat->slow = template->slow;
224 231
@@ -235,20 +242,11 @@ create_ns2_led(struct platform_device *pdev, struct ns2_led_data *led_dat,
235 if (ret < 0) 242 if (ret < 0)
236 return ret; 243 return ret;
237 244
238 ret = device_create_file(led_dat->cdev.dev, &dev_attr_sata);
239 if (ret < 0)
240 goto err_free_cdev;
241
242 return 0; 245 return 0;
243
244err_free_cdev:
245 led_classdev_unregister(&led_dat->cdev);
246 return ret;
247} 246}
248 247
249static void delete_ns2_led(struct ns2_led_data *led_dat) 248static void delete_ns2_led(struct ns2_led_data *led_dat)
250{ 249{
251 device_remove_file(led_dat->cdev.dev, &dev_attr_sata);
252 led_classdev_unregister(&led_dat->cdev); 250 led_classdev_unregister(&led_dat->cdev);
253} 251}
254 252