This source file includes following definitions.
- gpio_led_register_device
1
2
3
4
5
6 #include <linux/err.h>
7 #include <linux/leds.h>
8 #include <linux/platform_device.h>
9 #include <linux/slab.h>
10
11
12
13
14
15
16
17
18
19
20
21
22 struct platform_device *__init gpio_led_register_device(
23 int id, const struct gpio_led_platform_data *pdata)
24 {
25 struct platform_device *ret;
26 struct gpio_led_platform_data _pdata = *pdata;
27
28 if (!pdata->num_leds)
29 return ERR_PTR(-EINVAL);
30
31 _pdata.leds = kmemdup(pdata->leds,
32 pdata->num_leds * sizeof(*pdata->leds), GFP_KERNEL);
33 if (!_pdata.leds)
34 return ERR_PTR(-ENOMEM);
35
36 ret = platform_device_register_resndata(NULL, "leds-gpio", id,
37 NULL, 0, &_pdata, sizeof(_pdata));
38 if (IS_ERR(ret))
39 kfree(_pdata.leds);
40
41 return ret;
42 }