leds-ns2.c (556ef63255f1a6f82910a637c4164dbf7d3d1af2) leds-ns2.c (e5971bbc1caf0ccbab3fea74fe37abb649d1c7cf)
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>

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

136
137 ns2_led_set_mode(led_dat, mode);
138}
139
140static ssize_t ns2_led_sata_store(struct device *dev,
141 struct device_attribute *attr,
142 const char *buff, size_t count)
143{
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>

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

136
137 ns2_led_set_mode(led_dat, mode);
138}
139
140static ssize_t ns2_led_sata_store(struct device *dev,
141 struct device_attribute *attr,
142 const char *buff, size_t count)
143{
144 struct led_classdev *led_cdev = dev_get_drvdata(dev);
145 struct ns2_led_data *led_dat =
146 container_of(led_cdev, struct ns2_led_data, cdev);
144 int ret;
145 unsigned long enable;
146 enum ns2_led_modes mode;
147 int ret;
148 unsigned long enable;
149 enum ns2_led_modes mode;
147 struct ns2_led_data *led_dat = dev_get_drvdata(dev);
148
149 ret = strict_strtoul(buff, 10, &enable);
150 if (ret < 0)
151 return ret;
152
153 enable = !!enable;
154
155 if (led_dat->sata == enable)

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

167 led_dat->sata = enable;
168
169 return count;
170}
171
172static ssize_t ns2_led_sata_show(struct device *dev,
173 struct device_attribute *attr, char *buf)
174{
150
151 ret = strict_strtoul(buff, 10, &enable);
152 if (ret < 0)
153 return ret;
154
155 enable = !!enable;
156
157 if (led_dat->sata == enable)

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

169 led_dat->sata = enable;
170
171 return count;
172}
173
174static ssize_t ns2_led_sata_show(struct device *dev,
175 struct device_attribute *attr, char *buf)
176{
175 struct ns2_led_data *led_dat = dev_get_drvdata(dev);
177 struct led_classdev *led_cdev = dev_get_drvdata(dev);
178 struct ns2_led_data *led_dat =
179 container_of(led_cdev, struct ns2_led_data, cdev);
176
177 return sprintf(buf, "%d\n", led_dat->sata);
178}
179
180static DEVICE_ATTR(sata, 0644, ns2_led_sata_show, ns2_led_sata_store);
181
182static int __devinit
183create_ns2_led(struct platform_device *pdev, struct ns2_led_data *led_dat,

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

229 led_dat->sata = (mode == NS_V2_LED_SATA) ? 1 : 0;
230 led_dat->cdev.brightness =
231 (mode == NS_V2_LED_OFF) ? LED_OFF : LED_FULL;
232
233 ret = led_classdev_register(&pdev->dev, &led_dat->cdev);
234 if (ret < 0)
235 goto err_free_slow;
236
180
181 return sprintf(buf, "%d\n", led_dat->sata);
182}
183
184static DEVICE_ATTR(sata, 0644, ns2_led_sata_show, ns2_led_sata_store);
185
186static int __devinit
187create_ns2_led(struct platform_device *pdev, struct ns2_led_data *led_dat,

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

233 led_dat->sata = (mode == NS_V2_LED_SATA) ? 1 : 0;
234 led_dat->cdev.brightness =
235 (mode == NS_V2_LED_OFF) ? LED_OFF : LED_FULL;
236
237 ret = led_classdev_register(&pdev->dev, &led_dat->cdev);
238 if (ret < 0)
239 goto err_free_slow;
240
237 dev_set_drvdata(led_dat->cdev.dev, led_dat);
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;
243
244err_free_cdev:
245 led_classdev_unregister(&led_dat->cdev);

--- 94 unchanged lines hidden ---
241 ret = device_create_file(led_dat->cdev.dev, &dev_attr_sata);
242 if (ret < 0)
243 goto err_free_cdev;
244
245 return 0;
246
247err_free_cdev:
248 led_classdev_unregister(&led_dat->cdev);

--- 94 unchanged lines hidden ---