[kernel] 2.6.26: fix gpio_dev compile error
[openwrt.git] / target / linux / ixp4xx / patches-2.6.24 / 021-ixp4xx_use_leds_gpio.patch
1 From 383256474f2ba043bdb57a657f9d786df88780f1 Mon Sep 17 00:00:00 2001
2 From: Rod Whitby <rod@whitby.id.au>
3 Date: Tue, 29 Jan 2008 17:17:29 +1030
4 Subject: ixp4xx: Use leds-gpio driver instead of IXP4XX-GPIO-LED driver
5
6 These are the only three boards to use the IXP4XX-GPIO-LED driver, and
7 they can all use the new leds-gpio driver instead with no change in
8 functionality.
9
10 Signed-off-by: Rod Whitby <rod@whitby.id.au>
11 --
12 PATCH FOLLOWS
13 KernelVersion: v2.6.24-1915-gc9b12e6
14
15 Index: linux-2.6.24.7/arch/arm/configs/ixp4xx_defconfig
16 ===================================================================
17 --- linux-2.6.24.7.orig/arch/arm/configs/ixp4xx_defconfig
18 +++ linux-2.6.24.7/arch/arm/configs/ixp4xx_defconfig
19 @@ -1330,8 +1330,8 @@ CONFIG_LEDS_CLASS=y
20 #
21 # LED drivers
22 #
23 -CONFIG_LEDS_IXP4XX=y
24 -# CONFIG_LEDS_GPIO is not set
25 +# CONFIG_LEDS_IXP4XX is not set
26 +CONFIG_LEDS_GPIO=y
27
28 #
29 # LED Triggers
30 Index: linux-2.6.24.7/arch/arm/mach-ixp4xx/dsmg600-setup.c
31 ===================================================================
32 --- linux-2.6.24.7.orig/arch/arm/mach-ixp4xx/dsmg600-setup.c
33 +++ linux-2.6.24.7/arch/arm/mach-ixp4xx/dsmg600-setup.c
34 @@ -14,6 +14,7 @@
35 #include <linux/kernel.h>
36 #include <linux/serial.h>
37 #include <linux/serial_8250.h>
38 +#include <linux/leds.h>
39 #include <linux/i2c.h>
40 #include <linux/i2c-gpio.h>
41
42 @@ -58,29 +59,28 @@ static struct i2c_board_info __initdata
43 },
44 };
45
46 -#ifdef CONFIG_LEDS_CLASS
47 -static struct resource dsmg600_led_resources[] = {
48 +static struct gpio_led dsmg600_led_pins[] = {
49 {
50 - .name = "power",
51 - .start = DSMG600_LED_PWR_GPIO,
52 - .end = DSMG600_LED_PWR_GPIO,
53 - .flags = IXP4XX_GPIO_HIGH,
54 + .name = "power",
55 + .gpio = DSMG600_LED_PWR_GPIO,
56 },
57 {
58 - .name = "wlan",
59 - .start = DSMG600_LED_WLAN_GPIO,
60 - .end = DSMG600_LED_WLAN_GPIO,
61 - .flags = IXP4XX_GPIO_LOW,
62 + .name = "wlan",
63 + .gpio = DSMG600_LED_WLAN_GPIO,
64 + .active_low = true,
65 },
66 };
67
68 +static struct gpio_led_platform_data dsmg600_led_data = {
69 + .num_leds = ARRAY_SIZE(dsmg600_led_pins),
70 + .leds = dsmg600_led_pins,
71 +};
72 +
73 static struct platform_device dsmg600_leds = {
74 - .name = "IXP4XX-GPIO-LED",
75 - .id = -1,
76 - .num_resources = ARRAY_SIZE(dsmg600_led_resources),
77 - .resource = dsmg600_led_resources,
78 + .name = "leds-gpio",
79 + .id = -1,
80 + .dev.platform_data = &dsmg600_led_data,
81 };
82 -#endif
83
84 static struct resource dsmg600_uart_resources[] = {
85 {
86 @@ -128,6 +128,7 @@ static struct platform_device dsmg600_ua
87 static struct platform_device *dsmg600_devices[] __initdata = {
88 &dsmg600_i2c_gpio,
89 &dsmg600_flash,
90 + &dsmg600_leds,
91 };
92
93 static void dsmg600_power_off(void)
94 @@ -175,11 +176,6 @@ static void __init dsmg600_init(void)
95 (void)platform_device_register(&dsmg600_uart);
96
97 platform_add_devices(dsmg600_devices, ARRAY_SIZE(dsmg600_devices));
98 -
99 -#ifdef CONFIG_LEDS_CLASS
100 - /* We don't care whether or not this works. */
101 - (void)platform_device_register(&dsmg600_leds);
102 -#endif
103 }
104
105 MACHINE_START(DSMG600, "D-Link DSM-G600 RevA")
106 Index: linux-2.6.24.7/arch/arm/mach-ixp4xx/nas100d-setup.c
107 ===================================================================
108 --- linux-2.6.24.7.orig/arch/arm/mach-ixp4xx/nas100d-setup.c
109 +++ linux-2.6.24.7/arch/arm/mach-ixp4xx/nas100d-setup.c
110 @@ -46,35 +46,34 @@ static struct i2c_board_info __initdata
111 },
112 };
113
114 -#ifdef CONFIG_LEDS_IXP4XX
115 -static struct resource nas100d_led_resources[] = {
116 +static struct gpio_led nas100d_led_pins[] = {
117 {
118 .name = "wlan", /* green led */
119 - .start = NAS100D_LED_WLAN_GPIO,
120 - .end = NAS100D_LED_WLAN_GPIO,
121 - .flags = IXP4XX_GPIO_LOW,
122 + .gpio = NAS100D_LED_WLAN_GPIO,
123 + .active_low = true,
124 },
125 {
126 .name = "power", /* blue power led (off=flashing) */
127 - .start = NAS100D_LED_PWR_GPIO,
128 - .end = NAS100D_LED_PWR_GPIO,
129 - .flags = IXP4XX_GPIO_LOW,
130 + .gpio = NAS100D_LED_PWR_GPIO,
131 + .active_low = true,
132 },
133 {
134 .name = "disk", /* yellow led */
135 - .start = NAS100D_LED_DISK_GPIO,
136 - .end = NAS100D_LED_DISK_GPIO,
137 - .flags = IXP4XX_GPIO_LOW,
138 + .gpio = NAS100D_LED_DISK_GPIO,
139 + .active_low = true,
140 },
141 };
142
143 +static struct gpio_led_platform_data nas100d_led_data = {
144 + .num_leds = ARRAY_SIZE(nas100d_led_pins),
145 + .leds = nas100d_led_pins,
146 +};
147 +
148 static struct platform_device nas100d_leds = {
149 - .name = "IXP4XX-GPIO-LED",
150 + .name = "leds-gpio",
151 .id = -1,
152 - .num_resources = ARRAY_SIZE(nas100d_led_resources),
153 - .resource = nas100d_led_resources,
154 + .dev.platform_data = &nas100d_led_data,
155 };
156 -#endif
157
158 static struct i2c_gpio_platform_data nas100d_i2c_gpio_data = {
159 .sda_pin = NAS100D_SDA_PIN,
160 @@ -135,9 +134,7 @@ static struct platform_device nas100d_ua
161 static struct platform_device *nas100d_devices[] __initdata = {
162 &nas100d_i2c_gpio,
163 &nas100d_flash,
164 -#ifdef CONFIG_LEDS_IXP4XX
165 &nas100d_leds,
166 -#endif
167 };
168
169 static void nas100d_power_off(void)
170 Index: linux-2.6.24.7/arch/arm/mach-ixp4xx/nslu2-setup.c
171 ===================================================================
172 --- linux-2.6.24.7.orig/arch/arm/mach-ixp4xx/nslu2-setup.c
173 +++ linux-2.6.24.7/arch/arm/mach-ixp4xx/nslu2-setup.c
174 @@ -54,41 +54,37 @@ static struct i2c_board_info __initdata
175 },
176 };
177
178 -#ifdef CONFIG_LEDS_IXP4XX
179 -static struct resource nslu2_led_resources[] = {
180 +static struct gpio_led nslu2_led_pins[] = {
181 {
182 .name = "ready", /* green led */
183 - .start = NSLU2_LED_GRN_GPIO,
184 - .end = NSLU2_LED_GRN_GPIO,
185 - .flags = IXP4XX_GPIO_HIGH,
186 + .gpio = NSLU2_LED_GRN_GPIO,
187 },
188 {
189 .name = "status", /* red led */
190 - .start = NSLU2_LED_RED_GPIO,
191 - .end = NSLU2_LED_RED_GPIO,
192 - .flags = IXP4XX_GPIO_HIGH,
193 + .gpio = NSLU2_LED_RED_GPIO,
194 },
195 {
196 .name = "disk-1",
197 - .start = NSLU2_LED_DISK1_GPIO,
198 - .end = NSLU2_LED_DISK1_GPIO,
199 - .flags = IXP4XX_GPIO_LOW,
200 + .gpio = NSLU2_LED_DISK1_GPIO,
201 + .active_low = true,
202 },
203 {
204 .name = "disk-2",
205 - .start = NSLU2_LED_DISK2_GPIO,
206 - .end = NSLU2_LED_DISK2_GPIO,
207 - .flags = IXP4XX_GPIO_LOW,
208 + .gpio = NSLU2_LED_DISK2_GPIO,
209 + .active_low = true,
210 },
211 };
212
213 +static struct gpio_led_platform_data nslu2_led_data = {
214 + .num_leds = ARRAY_SIZE(nslu2_led_pins),
215 + .leds = nslu2_led_pins,
216 +};
217 +
218 static struct platform_device nslu2_leds = {
219 - .name = "IXP4XX-GPIO-LED",
220 + .name = "leds-gpio",
221 .id = -1,
222 - .num_resources = ARRAY_SIZE(nslu2_led_resources),
223 - .resource = nslu2_led_resources,
224 + .dev.platform_data = &nslu2_led_data,
225 };
226 -#endif
227
228 static struct platform_device nslu2_i2c_gpio = {
229 .name = "i2c-gpio",
230 @@ -151,9 +147,7 @@ static struct platform_device *nslu2_dev
231 &nslu2_i2c_gpio,
232 &nslu2_flash,
233 &nslu2_beeper,
234 -#ifdef CONFIG_LEDS_IXP4XX
235 &nslu2_leds,
236 -#endif
237 };
238
239 static void nslu2_power_off(void)
This page took 0.053989 seconds and 5 git commands to generate.