linux: SIMpad ucb1x00 switches driver code beautification - close #1920
authorBernhard Guillon <Bernhard.Guillon@opensimpad.org>
Sun, 11 Mar 2007 14:06:33 +0000 (14:06 +0000)
committerMarcin Juszkiewicz <hrw@openembedded.org>
Sun, 11 Mar 2007 14:06:33 +0000 (14:06 +0000)
packages/linux/linux/simpad/linux-2.6.20.SIMpad.ucb1x00-switches.patch
packages/linux/linux_2.6.20.bb

index 3f28d9e..7cf2f28 100644 (file)
@@ -1,6 +1,6 @@
 diff -uNr linux-2.6.20.vanilla/drivers/mfd/Kconfig linux-2.6.20/drivers/mfd/Kconfig
 --- linux-2.6.20.vanilla/drivers/mfd/Kconfig   2007-02-10 19:01:56.000000000 +0100
-+++ linux-2.6.20/drivers/mfd/Kconfig   2007-02-14 16:30:15.000000000 +0100
++++ linux-2.6.20/drivers/mfd/Kconfig   2007-02-28 16:36:01.000000000 +0100
 @@ -23,4 +23,7 @@
        tristate "Touchscreen interface support"
        depends on MCP_UCB1200 && INPUT
@@ -11,7 +11,7 @@ diff -uNr linux-2.6.20.vanilla/drivers/mfd/Kconfig linux-2.6.20/drivers/mfd/Kcon
  endmenu
 diff -uNr linux-2.6.20.vanilla/drivers/mfd/Makefile linux-2.6.20/drivers/mfd/Makefile
 --- linux-2.6.20.vanilla/drivers/mfd/Makefile  2007-02-10 19:01:56.000000000 +0100
-+++ linux-2.6.20/drivers/mfd/Makefile  2007-02-14 16:30:15.000000000 +0100
++++ linux-2.6.20/drivers/mfd/Makefile  2007-02-28 16:36:01.000000000 +0100
 @@ -6,7 +6,7 @@
  obj-$(CONFIG_MCP_SA11X0)      += mcp-sa11x0.o
  obj-$(CONFIG_MCP_UCB1200)     += ucb1x00-core.o
@@ -23,8 +23,8 @@ diff -uNr linux-2.6.20.vanilla/drivers/mfd/Makefile linux-2.6.20/drivers/mfd/Mak
  endif
 diff -uNr linux-2.6.20.vanilla/drivers/mfd/ucb1x00-switches.c linux-2.6.20/drivers/mfd/ucb1x00-switches.c
 --- linux-2.6.20.vanilla/drivers/mfd/ucb1x00-switches.c        1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.20/drivers/mfd/ucb1x00-switches.c        2007-02-14 16:32:57.000000000 +0100
-@@ -0,0 +1,204 @@
++++ linux-2.6.20/drivers/mfd/ucb1x00-switches.c        2007-02-28 16:36:43.000000000 +0100
+@@ -0,0 +1,162 @@
 +/*
 + *  linux/drivers/mfd/ucb1x00-switches.c
 + *
@@ -52,6 +52,8 @@ diff -uNr linux-2.6.20.vanilla/drivers/mfd/ucb1x00-switches.c linux-2.6.20/drive
 +
 +#include "ucb1x00.h"
 +
++static int key [6] = { KEY_PROG1,KEY_PROG2,KEY_UP,KEY_DOWN,KEY_LEFT,KEY_RIGHT };
++
 +struct ucb1x00_switches {
 +      struct input_dev        *idev;
 +      struct ucb1x00          *ucb;
@@ -63,6 +65,7 @@ diff -uNr linux-2.6.20.vanilla/drivers/mfd/ucb1x00-switches.c linux-2.6.20/drive
 +      unsigned short int this;        
 +      struct ucb1x00_switches *switches = id;
 +      struct input_dev *idev = switches->idev;
++      
 +      ucb1x00_enable(switches->ucb);
 +      
 +      this=~ucb1x00_io_read(switches->ucb);
@@ -71,61 +74,16 @@ diff -uNr linux-2.6.20.vanilla/drivers/mfd/ucb1x00-switches.c linux-2.6.20/drive
 +      }
 +
 +      last=this;
-+      switch (idx) {
-+
-+      case 0:
-+
-+              if 
-+                      ((this & (1<<0)) != 0) input_report_key(idev, KEY_PROG1, 1);
-+              else 
-+                      input_report_key(idev, KEY_PROG1, 0);
-+              break;
-+
-+      case 1:
-+
-+              if 
-+                      ((this & (1<<1)) != 0) input_report_key(idev, KEY_PROG2, 1);
-+              else 
-+                      input_report_key(idev, KEY_PROG2, 0);
-+              break;
-+
-+      case 2:
-+
-+              if 
-+                      ((this & (1<<2)) != 0) input_report_key(idev, KEY_UP, 1); 
-+              else 
-+                      input_report_key(idev, KEY_UP, 0); 
-+              break;
-+
-+      case 3:
-+
-+              if 
-+                      ((this & (1<<3)) != 0) input_report_key(idev, KEY_DOWN, 1); 
-+              else 
-+                      input_report_key(idev, KEY_DOWN, 0); 
-+              break;
-+
-+      case 4:
-+
-+              if 
-+                      ((this & (1<<4)) != 0) input_report_key(idev, KEY_LEFT, 1);
-+              else 
-+                      input_report_key(idev, KEY_LEFT, 0);
-+              break;
-+
-+      case 5:
-+
-+              if 
-+                      ((this & (1<<5)) != 0) input_report_key(idev, KEY_RIGHT, 1);
-+              else 
-+                      input_report_key(idev, KEY_RIGHT, 0);
-+              break;
-+
-+      default:
-+
++      
++      if ((idx >=0) && (idx <=5)) {
++              if ((this & (1<<idx)) != 0) input_report_key(idev, key[idx], 1);
++                      else input_report_key(idev, key[idx], 0);
++      }
++      else {
 +              printk(KERN_DEBUG "switches-ucb1x00 is BUGGY!!! \n");
-+              
++              return;
 +      }       
++      
 +}
 +
 +static int ucb1x00_switches_add(struct ucb1x00_dev *dev)
index 893856a..af73514 100644 (file)
@@ -1,7 +1,7 @@
 DESCRIPTION = "Linux Kernel"
 SECTION = "kernel"
 LICENSE = "GPL"
-PR = "r2"
+PR = "r3"
 
 SRC_URI = "${KERNELORG_MIRROR}/pub/linux/kernel/v2.6/linux-${PV}.tar.bz2 \
            file://defconfig"