leds-ns2.c (f01387d2693813eb5271a3448e6a082322c7d75d) leds-ns2.c (475f85482663985550e589496bc3c1e09521838a)
1/*
2 * leds-ns2.c - Driver for the Network Space v2 (and parents) dual-GPIO LED
3 *
4 * Copyright (C) 2010 LaCie
5 *
6 * Author: Simon Guinot <sguinot@lacie.com>
7 *
8 * Based on leds-gpio.c by Raphael Assenat <raph@8d.com>

--- 171 unchanged lines hidden (view full) ---

180 struct ns2_led_data *led_dat =
181 container_of(led_cdev, struct ns2_led_data, cdev);
182
183 return sprintf(buf, "%d\n", led_dat->sata);
184}
185
186static DEVICE_ATTR(sata, 0644, ns2_led_sata_show, ns2_led_sata_store);
187
1/*
2 * leds-ns2.c - Driver for the Network Space v2 (and parents) dual-GPIO LED
3 *
4 * Copyright (C) 2010 LaCie
5 *
6 * Author: Simon Guinot <sguinot@lacie.com>
7 *
8 * Based on leds-gpio.c by Raphael Assenat <raph@8d.com>

--- 171 unchanged lines hidden (view full) ---

180 struct ns2_led_data *led_dat =
181 container_of(led_cdev, struct ns2_led_data, cdev);
182
183 return sprintf(buf, "%d\n", led_dat->sata);
184}
185
186static DEVICE_ATTR(sata, 0644, ns2_led_sata_show, ns2_led_sata_store);
187
188static struct attribute *ns2_led_attrs[] = {
189 &dev_attr_sata.attr,
190 NULL
191};
192ATTRIBUTE_GROUPS(ns2_led);
193
188static int
189create_ns2_led(struct platform_device *pdev, struct ns2_led_data *led_dat,
190 const struct ns2_led *template)
191{
192 int ret;
193 enum ns2_led_modes mode;
194
195 ret = devm_gpio_request_one(&pdev->dev, template->cmd,

--- 18 unchanged lines hidden (view full) ---

214
215 rwlock_init(&led_dat->rw_lock);
216
217 led_dat->cdev.name = template->name;
218 led_dat->cdev.default_trigger = template->default_trigger;
219 led_dat->cdev.blink_set = NULL;
220 led_dat->cdev.brightness_set = ns2_led_set;
221 led_dat->cdev.flags |= LED_CORE_SUSPENDRESUME;
194static int
195create_ns2_led(struct platform_device *pdev, struct ns2_led_data *led_dat,
196 const struct ns2_led *template)
197{
198 int ret;
199 enum ns2_led_modes mode;
200
201 ret = devm_gpio_request_one(&pdev->dev, template->cmd,

--- 18 unchanged lines hidden (view full) ---

220
221 rwlock_init(&led_dat->rw_lock);
222
223 led_dat->cdev.name = template->name;
224 led_dat->cdev.default_trigger = template->default_trigger;
225 led_dat->cdev.blink_set = NULL;
226 led_dat->cdev.brightness_set = ns2_led_set;
227 led_dat->cdev.flags |= LED_CORE_SUSPENDRESUME;
228 led_dat->cdev.groups = ns2_led_groups;
222 led_dat->cmd = template->cmd;
223 led_dat->slow = template->slow;
224
225 ret = ns2_led_get_mode(led_dat, &mode);
226 if (ret < 0)
227 return ret;
228
229 /* Set LED initial state. */
230 led_dat->sata = (mode == NS_V2_LED_SATA) ? 1 : 0;
231 led_dat->cdev.brightness =
232 (mode == NS_V2_LED_OFF) ? LED_OFF : LED_FULL;
233
234 ret = led_classdev_register(&pdev->dev, &led_dat->cdev);
235 if (ret < 0)
236 return ret;
237
229 led_dat->cmd = template->cmd;
230 led_dat->slow = template->slow;
231
232 ret = ns2_led_get_mode(led_dat, &mode);
233 if (ret < 0)
234 return ret;
235
236 /* Set LED initial state. */
237 led_dat->sata = (mode == NS_V2_LED_SATA) ? 1 : 0;
238 led_dat->cdev.brightness =
239 (mode == NS_V2_LED_OFF) ? LED_OFF : LED_FULL;
240
241 ret = led_classdev_register(&pdev->dev, &led_dat->cdev);
242 if (ret < 0)
243 return ret;
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}
248
249static void delete_ns2_led(struct ns2_led_data *led_dat)
250{
246}
247
248static void delete_ns2_led(struct ns2_led_data *led_dat)
249{
251 device_remove_file(led_dat->cdev.dev, &dev_attr_sata);
252 led_classdev_unregister(&led_dat->cdev);
253}
254
255#ifdef CONFIG_OF_GPIO
256/*
257 * Translate OpenFirmware node properties into platform_data.
258 */
259static int

--- 136 unchanged lines hidden ---
250 led_classdev_unregister(&led_dat->cdev);
251}
252
253#ifdef CONFIG_OF_GPIO
254/*
255 * Translate OpenFirmware node properties into platform_data.
256 */
257static int

--- 136 unchanged lines hidden ---