logo       

[patch 06/19] chardev: pc8736x_gpio - put scx200_gpio_dump on a diet: msg#00015

Subject: [patch 06/19] chardev: pc8736x_gpio - put scx200_gpio_dump on a diet
GPIO SUPPORT FOR SCx200 & PC8736x

This patch-set reworks the 2.4 vintage scx200_gpio driver for modern
2.6, and refactors GPIO support to reuse it in a new driver for the
GPIO on PC-8736x chips.

06/19. patch.dump-diet:

Shrink scx200_gpio_dump to a single printk with ternary ops.
- still coddled in its if 0,.
- maybe do pdev_info here too.
- fix the if 0 too ?!?

Signed-off-by:  Jim Cromie <jim.cromie@xxxxxxxxx>

diffstat patch.dump-diet:
scx200.c |   39 +++++++++++----------------------------
1 files changed, 11 insertions(+), 28 deletions(-)

diff -ruNp -X dontdiff -X exclude-diffs k16r-5/arch/i386/kernel/scx200.c 
k16r-6/arch/i386/kernel/scx200.c
--- k16r-5/arch/i386/kernel/scx200.c    2006-05-28 12:20:19.000000000 -0600
+++ k16r-6/arch/i386/kernel/scx200.c    2006-05-28 12:20:37.000000000 -0600
@@ -108,34 +108,17 @@ u32 scx200_gpio_configure(unsigned index
#if 0
void scx200_gpio_dump(unsigned index)
{
-       u32 config = scx200_gpio_configure(index, ~0, 0);
-       printk(KERN_DEBUG "GPIO%02u: 0x%08lx", index, (unsigned long)config);
-       
- if (config & 1) - printk(" OE"); /* output enabled */
-       else
-               printk(" TS"); /* tristate */
- if (config & 2) - printk(" PP"); /* push pull */
-       else
-               printk(" OD"); /* open drain */
- if (config & 4) - printk(" PUE"); /* pull up enabled */
-       else
-               printk(" PUD"); /* pull up disabled */
- if (config & 8) - printk(" LOCKED"); /* locked */ - if (config & 16) - printk(" LEVEL"); /* level input */
-       else
-               printk(" EDGE"); /* edge input */
- if (config & 32) - printk(" HI"); /* trigger on rising edge */
-       else
-               printk(" LO"); /* trigger on falling edge */
- if (config & 64) - printk(" DEBOUNCE"); /* debounce */
-       printk("\n");
+        u32 config = scx200_gpio_configure(index, ~0, 0);
+
+        printk(KERN_INFO NAME ": GPIO-%02u: 0x%08lx %s %s %s %s %s %s %s\n",
+               index, (unsigned long) config,
+               (config & 1) ? "OE"      : "TS",                /* output 
enabled / tristate */
+               (config & 2) ? "PP"      : "OD",                /* push pull / 
open drain */
+               (config & 4) ? "PUE"     : "PUD",       /* pull up 
enabled/disabled */
+               (config & 8) ? "LOCKED"  : "",          /* locked / unlocked */
+               (config & 16) ? "LEVEL"  : "EDGE",      /* level/edge input */
+ (config & 32) ? "HI" : "LO", /* trigger on rising/falling edge */ + (config & 64) ? "DEBOUNCE" : ""); /* debounce */
}
#endif  /*  0  */


<Prev in Thread] Current Thread [Next in Thread>