Skip to contentSkip to conversation

GPIO LED driver for the WGT634U machine

PATCH In review Aurelien Jarno 2 participants 4 messages Aug 15, 2007 MIPS

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 GPIO LED driver for the WGT634U machine

The patch below adds GPIO support to the BCM947xx platform. It uses the new gpio-led driver and a platform driver for the pin definitions.

arch/mips/bcm947xx/Makefile +1 -1
@@ -3,4 +3,4 @@
 # under Linux.
 #
 
-obj-y := irq.o prom.o serial.o setup.o time.o
+obj-y := irq.o prom.o serial.o setup.o time.o wgt634u.o
arch/mips/bcm947xx/wgt634u.c +64 -0

64 lines not on this page · raw message

Signature · 4 lines
  .''`.  Aurelien Jarno	            | GPG: 1024D/F1BCDB73
 : :' :  Debian developer           | Electrical Engineer
 `. `'   [email protected]         | [email protected]
   `-    people.debian.org/~aurel32 | www.aurel32.net
#1 lore raw

arch/mips/bcm947xx/wgt634u.c line 35

Quoted 8 lines · Aurelien Jarno
arch/mips/bcm947xx/wgt634u.c +4 -0
 
+static const struct gpio_led wgt634u_leds[] = {
 
+static const struct gpio_led_platform_data wgt634u_led_data = {
+	.num_leds =     ARRAY_SIZE(wgt634u_leds),
+	.leds =         (void *) wgt634u_leds,
                        ^^^^^^^^

gpio_led_platform_data.leds is of type struct gpio_led *. Should it be const, or should the const be dropped from wgt634u_leds?

arch/mips/bcm947xx/wgt634u.c line 42

Quoted 5 lines
arch/mips/bcm947xx/wgt634u.c +5 -0
+static struct platform_device wgt634u_gpio_leds = {
+	.name =         "leds-gpio",
+	.id =           -1,
+	.dev = {
+		.platform_data = (void *) &wgt634u_led_data,
                                 ^^^^^^^^

device.platform_data is a void *, so you can drop the cast.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

#2 lore raw
Quoted 14 lines · Geert Uytterhoeven

arch/mips/bcm947xx/wgt634u.c line 35

Quoted 8 lines · Aurelien Jarno
arch/mips/bcm947xx/wgt634u.c +4 -0
 
+static const struct gpio_led wgt634u_leds[] = {
 
+static const struct gpio_led_platform_data wgt634u_led_data = {
+	.num_leds =     ARRAY_SIZE(wgt634u_leds),
+	.leds =         (void *) wgt634u_leds,
                        ^^^^^^^^

gpio_led_platform_data.leds is of type struct gpio_led *. Should it be const, or should the const be dropped from wgt634u_leds?

Quoted 7 lines

arch/mips/bcm947xx/wgt634u.c line 42

Quoted 5 lines
arch/mips/bcm947xx/wgt634u.c +5 -0
+static struct platform_device wgt634u_gpio_leds = {
+	.name =         "leds-gpio",
+	.id =           -1,
+	.dev = {
+		.platform_data = (void *) &wgt634u_led_data,
                                 ^^^^^^^^

device.platform_data is a void *, so you can drop the cast.

Hmm, wgt634u_led_data is const too. But casting away constness is usually an indicator that something is wrong.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

#3 lore raw
In reply to Geert Uytterhoeven
Quoted 14 lines · Geert Uytterhoeven

arch/mips/bcm947xx/wgt634u.c

Quoted 8 lines · Aurelien Jarno
arch/mips/bcm947xx/wgt634u.c +4 -0
 
+static const struct gpio_led wgt634u_leds[] = {
 
+static const struct gpio_led_platform_data wgt634u_led_data = {
+	.num_leds =     ARRAY_SIZE(wgt634u_leds),
+	.leds =         (void *) wgt634u_leds,
                        ^^^^^^^^

gpio_led_platform_data.leds is of type struct gpio_led *. Should it be const, or should the const be dropped from wgt634u_leds?

Quoted 8 lines

arch/mips/bcm947xx/wgt634u.c

Quoted 5 lines
arch/mips/bcm947xx/wgt634u.c +5 -0
+static struct platform_device wgt634u_gpio_leds = {
+	.name =         "leds-gpio",
+	.id =           -1,
+	.dev = {
+		.platform_data = (void *) &wgt634u_led_data,
                                 ^^^^^^^^

device.platform_data is a void *, so you can drop the cast.

Thanks for your comments. It looks like I haven't choose the right example file (arch/avr32/boards/atngw100/setup.c). Andrew, please find an updated patch below.

Regards,
Aurelien

The patch below adds GPIO support to the BCM947xx platform. It uses the new gpio-led driver and a platform driver for the pin definitions.

arch/mips/bcm947xx/Makefile +1 -1
@@ -3,4 +3,4 @@
 # under Linux.
 #
 
-obj-y := irq.o prom.o serial.o setup.o time.o
+obj-y := irq.o prom.o serial.o setup.o time.o wgt634u.o
arch/mips/bcm947xx/wgt634u.c +64 -0

64 lines not on this page · raw message

Signature · 4 lines
  .''`.  Aurelien Jarno	            | GPG: 1024D/F1BCDB73
 : :' :  Debian developer           | Electrical Engineer
 `. `'   [email protected]         | [email protected]
   `-    people.debian.org/~aurel32 | www.aurel32.net