All of lore.kernel.org
 help / color / mirror / Atom feed
From: Khem Raj <raj.khem@gmail.com>
To: openembedded-devel@lists.openembedded.org
Subject: [meta-oe][PATCH 09/16] gpm: Remove nested functions
Date: Tue, 18 Oct 2016 22:38:27 -0700	[thread overview]
Message-ID: <20161019053834.11523-9-raj.khem@gmail.com> (raw)
In-Reply-To: <20161019053834.11523-1-raj.khem@gmail.com>

Helps compiling with clang which doesnt support
nested functions

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 .../gpm/gpm-1.99.7/remove_nested_functions.patch   | 326 +++++++++++++++++++++
 meta-oe/recipes-support/gpm/gpm_1.99.7.bb          |   1 +
 2 files changed, 327 insertions(+)
 create mode 100644 meta-oe/recipes-support/gpm/gpm-1.99.7/remove_nested_functions.patch

diff --git a/meta-oe/recipes-support/gpm/gpm-1.99.7/remove_nested_functions.patch b/meta-oe/recipes-support/gpm/gpm-1.99.7/remove_nested_functions.patch
new file mode 100644
index 0000000..d2d6cb8
--- /dev/null
+++ b/meta-oe/recipes-support/gpm/gpm-1.99.7/remove_nested_functions.patch
@@ -0,0 +1,326 @@
+Remove nested functions, they are not available in all compilers
+e.g. clang will not support them.
+
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+
+Index: gpm-1.99.7/src/drivers/summa/i.c
+===================================================================
+--- gpm-1.99.7.orig/src/drivers/summa/i.c
++++ gpm-1.99.7/src/drivers/summa/i.c
+@@ -36,6 +36,28 @@ extern int summamaxy;
+ 
+ extern signed char summaid;
+ 
++static void resetsumma(int fd)
++{
++   write(fd, 0, 1);          /* Reset */
++   usleep(400000);           /* wait */
++}
++
++static int waitsumma(int fd)
++{
++   struct timeval timeout;
++
++   fd_set readfds;
++
++   int err;
++
++   FD_ZERO(&readfds);
++   FD_SET(fd, &readfds);
++   timeout.tv_sec = 0;
++   timeout.tv_usec = 200000;
++   err = select(FD_SETSIZE, &readfds, NULL, NULL, &timeout);
++   return (err);
++}
++
+ Gpm_Type *I_summa(int fd, unsigned short flags, struct Gpm_Type *type, int argc,
+                   char **argv)
+ {
+@@ -43,24 +65,6 @@ Gpm_Type *I_summa(int fd, unsigned short
+    flags = argc = 0;            /* FIXME: 1.99.13 */
+    argv = NULL;
+ 
+-   void resetsumma() {
+-      write(fd, 0, 1);          /* Reset */
+-      usleep(400000);           /* wait */
+-   }
+-   int waitsumma() {
+-      struct timeval timeout;
+-
+-      fd_set readfds;
+-
+-      int err;
+-
+-      FD_ZERO(&readfds);
+-      FD_SET(fd, &readfds);
+-      timeout.tv_sec = 0;
+-      timeout.tv_usec = 200000;
+-      err = select(FD_SETSIZE, &readfds, NULL, NULL, &timeout);
+-      return (err);
+-   }
+    int err;
+ 
+    char buffer[255];
+@@ -91,7 +95,7 @@ Gpm_Type *I_summa(int fd, unsigned short
+     */
+    setspeed(fd, 1200, 9600, 1,
+             B9600 | CS8 | CREAD | CLOCAL | HUPCL | PARENB | PARODD);
+-   resetsumma();
++   resetsumma(fd);
+ 
+    write(fd, SS_PROMPT_MODE, strlen(SS_PROMPT_MODE));
+ 
+@@ -103,7 +107,7 @@ Gpm_Type *I_summa(int fd, unsigned short
+        * read the Summa Firm-ID 
+        */
+       write(fd, SS_FIRMID, strlen(SS_FIRMID));
+-      err = waitsumma();
++      err = waitsumma(fd);
+       if(!((err == -1) || (!err))) {
+          summaid = 10;          /* Original Summagraphics */
+          read(fd, buffer, 255); /* Read Firm-ID */
+@@ -111,14 +115,14 @@ Gpm_Type *I_summa(int fd, unsigned short
+    }
+ 
+    if(summaid < 0) {            /* Genius-test */
+-      resetsumma();
++      resetsumma(fd);
+       write(fd, GEN_MMSERIES, 1);
+       write(fd, &GEN_MODELL, 1);        /* Read modell */
+-      err = waitsumma();
++      err = waitsumma(fd);
+       if(!((err == -1) || (!err))) {    /* read Genius-ID */
+-         err = waitsumma();
++         err = waitsumma(fd);
+          if(!((err == -1) || (!err))) {
+-            err = waitsumma();
++            err = waitsumma(fd);
+             if(!((err == -1) || (!err))) {
+                read(fd, &config, 1);
+                summaid = (config[0] & 224) >> 5;        /* genius tablet-id
+@@ -135,14 +139,14 @@ Gpm_Type *I_summa(int fd, unsigned short
+     * unknown tablet ?
+     */
+    if((summaid < 0) || (summaid == 11)) {
+-      resetsumma();
++      resetsumma(fd);
+       write(fd, SS_BINARY_FMT SS_PROMPT_MODE, 3);
+    }
+ 
+    /*
+     * read tablet size 
+     */
+-   err = waitsumma();
++   err = waitsumma(fd);
+    if(!((err == -1) || (!err)))
+       read(fd, buffer, sizeof(buffer));
+    write(fd, SS_READCONFIG, 1);
+Index: gpm-1.99.7/src/drivers/wacom/i.c
+===================================================================
+--- gpm-1.99.7.orig/src/drivers/wacom/i.c
++++ gpm-1.99.7/src/drivers/wacom/i.c
+@@ -30,10 +30,6 @@
+ #include "message.h"            /* gpm_report */
+ #include "wacom.h"              /* wacom */
+ 
+-Gpm_Type *I_wacom(int fd, unsigned short flags, struct Gpm_Type *type, int argc,
+-                  char **argv)
+-{
+-
+ /* wacom graphire tablet */
+ #define UD_RESETBAUD     "\r$"  /* reset baud rate to default (wacom V) */
+    /*
+@@ -45,83 +41,91 @@ Gpm_Type *I_wacom(int fd, unsigned short
+ #define UD_COORD         "~C\r" /* Request max coordinates */
+ #define UD_STOP          "\nSP\r"       /* stop sending coordinates */
+ 
+-   flags = 0;                   /* FIXME: 1.99.13 */
+ 
+-   void reset_wacom() {
+-      /*
+-       * Init Wacom communication; this is modified from xf86Wacom.so module 
+-       */
+-      /*
+-       * Set speed to 19200 
+-       */
+-      setspeed(fd, 1200, 19200, 0, B19200 | CS8 | CREAD | CLOCAL | HUPCL);
+-      /*
+-       * Send Reset Baudrate Command 
+-       */
+-      write(fd, UD_RESETBAUD, strlen(UD_RESETBAUD));
+-      usleep(250000);
+-      /*
+-       * Send Reset Command 
+-       */
+-      write(fd, UD_RESET, strlen(UD_RESET));
+-      usleep(75000);
+-      /*
+-       * Set speed to 9600bps 
+-       */
+-      setspeed(fd, 1200, 9600, 0, B9600 | CS8 | CREAD | CLOCAL | HUPCL);
+-      /*
+-       * Send Reset Command 
+-       */
+-      write(fd, UD_RESET, strlen(UD_RESET));
+-      usleep(250000);
+-      write(fd, UD_STOP, strlen(UD_STOP));
+-      usleep(100000);
+-   }
++static void reset_wacom(int fd)
++{
++   /*
++    * Init Wacom communication; this is modified from xf86Wacom.so module 
++    */
++   /*
++    * Set speed to 19200 
++    */
++   setspeed(fd, 1200, 19200, 0, B19200 | CS8 | CREAD | CLOCAL | HUPCL);
++   /*
++    * Send Reset Baudrate Command 
++    */
++   write(fd, UD_RESETBAUD, strlen(UD_RESETBAUD));
++   usleep(250000);
++   /*
++    * Send Reset Command 
++    */
++   write(fd, UD_RESET, strlen(UD_RESET));
++   usleep(75000);
++   /*
++    * Set speed to 9600bps 
++    */
++   setspeed(fd, 1200, 9600, 0, B9600 | CS8 | CREAD | CLOCAL | HUPCL);
++   /*
++    * Send Reset Command 
++    */
++   write(fd, UD_RESET, strlen(UD_RESET));
++   usleep(250000);
++   write(fd, UD_STOP, strlen(UD_STOP));
++   usleep(100000);
++}
+ 
+-   int wait_wacom() {
+-      /*
+-       *  Wait up to 200 ms for Data from Tablet.
+-       *  Do not read that data.
+-       *  Give back 0 on timeout condition, -1 on error and 1 for DataPresent
+-       */
+-      struct timeval timeout;
+-
+-      fd_set readfds;
+-
+-      int err;
+-
+-      FD_ZERO(&readfds);
+-      FD_SET(fd, &readfds);
+-      timeout.tv_sec = 0;
+-      timeout.tv_usec = 200000;
+-      err = select(FD_SETSIZE, &readfds, NULL, NULL, &timeout);
+-      return ((err > 0) ? 1 : err);
+-   }
++static int wait_wacom(int fd)
++{
++   /*
++    *  Wait up to 200 ms for Data from Tablet.
++    *  Do not read that data.
++    *  Give back 0 on timeout condition, -1 on error and 1 for DataPresent
++    */
++   struct timeval timeout;
+ 
+-   char buffer[50], *p;
++   fd_set readfds;
+ 
+-   int RequestData(char *cmd) {
+-      int err;
++   int err;
+ 
+-      /*
+-       * Send cmd if not null, and get back answer from tablet.
+-       * Get Data to buffer until full or timeout.
+-       * Give back 0 for timeout and !0 for buffer full
+-       */
+-      if(cmd)
+-         write(fd, cmd, strlen(cmd));
+-      memset(buffer, 0, sizeof(buffer));
+-      p = buffer;
+-      err = wait_wacom();
+-      while(err != -1 && err && (p - buffer) < (int) (sizeof(buffer) - 1)) {
+-         p += read(fd, p, (sizeof(buffer) - 1) - (p - buffer));
+-         err = wait_wacom();
+-      }
+-      /*
+-       * return 1 for buffer full 
+-       */
+-      return ((strlen(buffer) >= (sizeof(buffer) - 1)) ? !0 : 0);
++   FD_ZERO(&readfds);
++   FD_SET(fd, &readfds);
++   timeout.tv_sec = 0;
++   timeout.tv_usec = 200000;
++   err = select(FD_SETSIZE, &readfds, NULL, NULL, &timeout);
++   return ((err > 0) ? 1 : err);
++}
++
++static int RequestData(int fd, char *cmd, char *buffer)
++{
++   int err;
++   char *p;
++   /*
++    * Send cmd if not null, and get back answer from tablet.
++    * Get Data to buffer until full or timeout.
++    * Give back 0 for timeout and !0 for buffer full
++    */
++   if(cmd)
++      write(fd, cmd, strlen(cmd));
++   memset(buffer, 0, sizeof(buffer));
++   p = buffer;
++   err = wait_wacom(fd);
++   while(err != -1 && err && (p - buffer) < (int) (sizeof(buffer) - 1)) {
++      p += read(fd, p, (sizeof(buffer) - 1) - (p - buffer));
++      err = wait_wacom(fd);
+    }
++   /*
++    * return 1 for buffer full 
++    */
++   return ((strlen(buffer) >= (sizeof(buffer) - 1)) ? !0 : 0);
++}
++
++Gpm_Type *I_wacom(int fd, unsigned short flags, struct Gpm_Type *type, int argc,
++                  char **argv)
++{
++
++   flags = 0;                   /* FIXME: 1.99.13 */
++
++   char buffer[50];
+ 
+    /*
+     * We do both modes, relative and absolute, with the same function.
+@@ -143,17 +147,17 @@ Gpm_Type *I_wacom(int fd, unsigned short
+    };
+    parse_argv(optioninfo, argc, argv);
+    type->absolute = WacomAbsoluteWanted;
+-   reset_wacom();
++   reset_wacom(fd);
+ 
+    /*
+     * "Flush" input queque 
+     */
+-   while(RequestData(NULL)) ;
++   while(RequestData(fd, NULL, buffer)) ;
+ 
+    /*
+     * read WACOM-ID 
+     */
+-   RequestData(UD_FIRMID);
++   RequestData(fd, UD_FIRMID, buffer);
+ 
+    /*
+     * Search for matching modell 
+@@ -180,7 +184,7 @@ Gpm_Type *I_wacom(int fd, unsigned short
+     * read Wacom max size 
+     */
+    if(WacomModell != (-1) && (!wcmodell[WacomModell].maxX)) {
+-      RequestData(UD_COORD);
++      RequestData(fd, UD_COORD, buffer);
+       sscanf(buffer + 2, "%d,%d", &wmaxx, &wmaxy);
+       wmaxx = (wmaxx - wcmodell[WacomModell].border);
+       wmaxy = (wmaxy - wcmodell[WacomModell].border);
diff --git a/meta-oe/recipes-support/gpm/gpm_1.99.7.bb b/meta-oe/recipes-support/gpm/gpm_1.99.7.bb
index 7022057..bbb8c28 100644
--- a/meta-oe/recipes-support/gpm/gpm_1.99.7.bb
+++ b/meta-oe/recipes-support/gpm/gpm_1.99.7.bb
@@ -13,6 +13,7 @@ SRC_URI = "ftp://arcana.linux.it/pub/gpm/gpm-${PV}.tar.bz2 \
            file://no-docs.patch \
            file://processcreds.patch \
            file://eglibc-2.17.patch \
+           file://remove_nested_functions.patch \
            file://init"
 
 inherit autotools-brokensep update-rc.d
-- 
2.10.0



  parent reply	other threads:[~2016-10-19  5:38 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-19  5:38 [meta-oe][PATCH 01/16] boinc: Add recipe for boinc-client Khem Raj
2016-10-19  5:38 ` [meta-gnome][PATCH 02/16] libbonobo: Fix missing dep on orbit2-native and build with clang Khem Raj
2016-10-19 20:09   ` akuster808
2016-10-20  2:45     ` Khem Raj
2016-10-19  5:38 ` [meta-oe][PATCH 03/16] libmbim: Fix " Khem Raj
2016-10-19  5:38 ` [meta-oe][PATCH 04/16] libplist: Squash warnings found by clang Khem Raj
2016-10-19  5:38 ` [meta-oe][PATCH 05/16] frame: Fix build with clang Khem Raj
2016-10-19  5:38 ` [meta-python][PATCH 06/16] python-greenlet: Rename register from rX to xX for aarch64 Khem Raj
2016-10-19  5:38 ` [meta-multimedia][PATCH 07/16] libdc1394: Upgrade to 2.2.4 Khem Raj
2016-10-19  5:38 ` [meta-networking][PATCH 08/16] lowpan-tools: Fix errors found with clang Khem Raj
2016-10-19  5:38 ` Khem Raj [this message]
2016-10-19  5:38 ` [meta-oe][PATCH 10/16] flashrom: Fix build with clang and aarch64 Khem Raj
2016-10-19  5:38 ` [meta-networking][PATCH 11/16] openl2tp: Fix build with clang Khem Raj
2016-10-19  5:38 ` [meta-oe][PATCH 12/16] glcompbench: Demand c++11 explicitly Khem Raj
2016-10-19  5:38 ` [meta-oe][PATCH 13/16] joe: Fix build with clang Khem Raj
2016-10-19  5:38 ` [meta-oe][PATCH 14/16] fwts: Update to 16.09 release Khem Raj
2016-10-25 13:29   ` Martin Jansa
2016-10-19  5:38 ` [meta-networking][PATCH 15/16] libmnl, nftables: Update versions Khem Raj
2016-10-19  5:38 ` [meta-oe][PATCH 16/16] mg: Update to 20161005 Khem Raj
2016-10-19 20:06 ` [meta-oe][PATCH 01/16] boinc: Add recipe for boinc-client akuster808
2016-10-25 13:32 ` Martin Jansa
2016-10-25 13:49   ` Khem Raj

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161019053834.11523-9-raj.khem@gmail.com \
    --to=raj.khem@gmail.com \
    --cc=openembedded-devel@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.