Linux Kernel
3.7.1
Main Page
Related Pages
Modules
Namespaces
Data Structures
Files
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Groups
Pages
drivers
leds
leds-gpio-register.c
Go to the documentation of this file.
1
/*
2
* Copyright (C) 2011 Pengutronix
3
* Uwe Kleine-Koenig <
[email protected]
>
4
*
5
* This program is free software; you can redistribute it and/or modify it under
6
* the terms of the GNU General Public License version 2 as published by the
7
* Free Software Foundation.
8
*/
9
#include <
linux/err.h
>
10
#include <
linux/platform_device.h
>
11
#include <linux/slab.h>
12
#include <
linux/leds.h
>
13
25
struct
platform_device
*
__init
gpio_led_register_device
(
26
int
id
,
const
struct
gpio_led_platform_data
*
pdata
)
27
{
28
struct
platform_device
*
ret
;
29
struct
gpio_led_platform_data
_pdata = *
pdata
;
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
}
Generated on Thu Jan 10 2013 13:42:58 for Linux Kernel by
1.8.2