[PATCH 2/2] Drivers: staging: dgap: checkpatch.pl cleanups

2013-12-01 Thread Aldo Iljazi
A few checkpatch cleanups, particularly:

Lines 26, 60: Removed trailing whitespace.
Lines 36-38, 42-44, 47: Removed spaces at the start of the lines.

Signed-off-by: Aldo Iljazi 
---
 drivers/staging/dgap/dgap_downld.h |   22 +++---
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/dgap/dgap_downld.h 
b/drivers/staging/dgap/dgap_downld.h
index 271ac19..b471284 100644
--- a/drivers/staging/dgap/dgap_downld.h
+++ b/drivers/staging/dgap/dgap_downld.h
@@ -23,7 +23,7 @@
  */
 
 /*
-** downld.h 
+** downld.h
 **  - describes the interface between the user level download process
 **and the concentrator download driver.
 */
@@ -33,18 +33,18 @@
 
 
 struct fepimg {
-int type;  /* board type */
-intlen;/* length of image */
-char fepimage[1];  /* beginning of image */
+   int type;   /* board type */
+   int len;/* length of image */
+   char fepimage[1];   /* beginning of image */
 };
 
 struct downldio {
-unsigned int req_type; /* FEP or concentrator */
-unsigned int bdid; /* opaque board identifier */
-union {
-   struct downld_t dl; /* download structure */
-   struct fepimg   fi; /* fep/bios image structure */
-} image;
+   unsigned int req_type;  /* FEP or concentrator */
+   unsigned int bdid;  /* opaque board identifier */
+   union {
+   struct downld_t dl; /* download structure */
+   struct fepimg   fi; /* fep/bios image structure */
+   } image;
 };
 
 #define DIGI_DLREQ_GET (('d'<<8) | 220)
@@ -57,7 +57,7 @@ struct downldio {
 #define DIGI_NUKE_RESET_ALL (1 << 31)
 #define DIGI_NUKE_INHIBIT_POLLER (1 << 30)
 #define DIGI_NUKE_BRD_NUMB0x0f
-   
+
 
 
 #defineDLREQ_BIOS  0
-- 
1.7.9.5

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 1/2] Drivers: staging: dgap: checkpatch.pl cleanups

2013-12-01 Thread Aldo Iljazi
A few checkpatch cleanups, particularly:

Lines 83, 87, 89, 196: Removed spaces before tabs.
Lines 141, 265.267: Removed trailing whitespace.

Signed-off-by: Aldo Iljazi 
---
 drivers/staging/dgap/dgap_conf.h |   22 +++---
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/dgap/dgap_conf.h b/drivers/staging/dgap/dgap_conf.h
index 8809701..32ac17c 100644
--- a/drivers/staging/dgap/dgap_conf.h
+++ b/drivers/staging/dgap/dgap_conf.h
@@ -80,13 +80,13 @@
 #define MC8E8K  36
 
 #define AVANFS 42  /* start of Avanstar family definitions */
-#define A8P42
+#define A8P42
 #define A16P   43
 #define AVANFE 43  /* end of Avanstar family definitions */
 
 #define DA2000FS   44  /* start of AccelePort 2000 family definitions 
*/
-#define DA22   44 /* AccelePort 2002 */
-#define DA24   45 /* AccelePort 2004 */
+#define DA22   44 /* AccelePort 2002 */
+#define DA24   45 /* AccelePort 2004 */
 #define DA28   46 /* AccelePort 2008 */
 #define DA216  47 /* AccelePort 2016 */
 #define DAR4   48 /* AccelePort RAS 4 port */
@@ -138,11 +138,11 @@
 #defineCU  91
 #definePRINT   92
 #defineXPRINT  93
-#define CMAJOR   94 
-#define ALTPIN  95
-#define STARTO 96
-#define USEINTR  97
-#define PCIINFO  98
+#define CMAJOR 94
+#define ALTPIN 95
+#define STARTO 96
+#define USEINTR97
+#define PCIINFO98
 
 #defineTTSIZ   100
 #defineCHSIZ   101
@@ -193,7 +193,7 @@ struct cnode {
 
union {
struct {
-   char  type; /* Board Type   */
+   char  type; /* Board Type   */
short port; /* I/O Address  */
char  *portstr; /* I/O Address in string */
long  addr; /* Memory Address   */
@@ -262,9 +262,9 @@ struct cnode {
} module;
 
char *ttyname;
-   
+
char *cuname;
-   
+
char *printname;
 
int  majornumber;
-- 
1.7.9.5

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] Staging: TIDSPBRIDGE: Remove UUID helper

2013-12-01 Thread Ivaylo DImitrov
From: Ivaylo Dimitrov 

Custom uuid helper function is needed only in rmgr/dbdcd.c and doesn't
need to be exported. It can also be made way simpler by using sscanf.

Signed-off-by: Ivaylo Dimitrov 
---
 drivers/staging/tidspbridge/Makefile   |2 +-
 drivers/staging/tidspbridge/gen/uuidutil.c |   85 
 .../tidspbridge/include/dspbridge/uuidutil.h   |   18 
 drivers/staging/tidspbridge/rmgr/dbdcd.c   |   42 +-
 4 files changed, 39 insertions(+), 108 deletions(-)
 delete mode 100644 drivers/staging/tidspbridge/gen/uuidutil.c

diff --git a/drivers/staging/tidspbridge/Makefile 
b/drivers/staging/tidspbridge/Makefile
index 230e3e6..2e77734 100644
--- a/drivers/staging/tidspbridge/Makefile
+++ b/drivers/staging/tidspbridge/Makefile
@@ -1,6 +1,6 @@
 obj-$(CONFIG_TIDSPBRIDGE)  += tidspbridge.o
 
-libgen = gen/gh.o gen/uuidutil.o
+libgen = gen/gh.o
 libcore = core/chnl_sm.o core/msg_sm.o core/io_sm.o core/tiomap3430.o \
core/tiomap3430_pwr.o core/tiomap_io.o \
core/ue_deh.o core/wdt.o core/dsp-clock.o core/sync.o
diff --git a/drivers/staging/tidspbridge/gen/uuidutil.c 
b/drivers/staging/tidspbridge/gen/uuidutil.c
deleted file mode 100644
index b7d8313..000
--- a/drivers/staging/tidspbridge/gen/uuidutil.c
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * uuidutil.c
- *
- * DSP-BIOS Bridge driver support functions for TI OMAP processors.
- *
- * This file contains the implementation of UUID helper functions.
- *
- * Copyright (C) 2005-2006 Texas Instruments, Inc.
- *
- * This package is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- */
-#include 
-
-/*  --- Host OS */
-#include 
-
-/*  --- DSP/BIOS Bridge */
-#include 
-
-/*  --- This */
-#include 
-
-static s32 uuid_hex_to_bin(char *buf, s32 len)
-{
-   s32 i;
-   s32 result = 0;
-   int value;
-
-   for (i = 0; i < len; i++) {
-   value = hex_to_bin(*buf++);
-   result *= 16;
-   if (value > 0)
-   result += value;
-   }
-
-   return result;
-}
-
-/*
- *   uuid_uuid_from_string 
- *  Purpose:
- *  Converts a string to a struct dsp_uuid.
- */
-void uuid_uuid_from_string(char *sz_uuid, struct dsp_uuid *uuid_obj)
-{
-   s32 j;
-
-   uuid_obj->data1 = uuid_hex_to_bin(sz_uuid, 8);
-   sz_uuid += 8;
-
-   /* Step over underscore */
-   sz_uuid++;
-
-   uuid_obj->data2 = (u16) uuid_hex_to_bin(sz_uuid, 4);
-   sz_uuid += 4;
-
-   /* Step over underscore */
-   sz_uuid++;
-
-   uuid_obj->data3 = (u16) uuid_hex_to_bin(sz_uuid, 4);
-   sz_uuid += 4;
-
-   /* Step over underscore */
-   sz_uuid++;
-
-   uuid_obj->data4 = (u8) uuid_hex_to_bin(sz_uuid, 2);
-   sz_uuid += 2;
-
-   uuid_obj->data5 = (u8) uuid_hex_to_bin(sz_uuid, 2);
-   sz_uuid += 2;
-
-   /* Step over underscore */
-   sz_uuid++;
-
-   for (j = 0; j < 6; j++) {
-   uuid_obj->data6[j] = (u8) uuid_hex_to_bin(sz_uuid, 2);
-   sz_uuid += 2;
-   }
-}
diff --git a/drivers/staging/tidspbridge/include/dspbridge/uuidutil.h 
b/drivers/staging/tidspbridge/include/dspbridge/uuidutil.h
index 414bf71..b4951a1 100644
--- a/drivers/staging/tidspbridge/include/dspbridge/uuidutil.h
+++ b/drivers/staging/tidspbridge/include/dspbridge/uuidutil.h
@@ -21,22 +21,4 @@
 
 #define MAXUUIDLEN  37
 
-/*
- *   uuid_uuid_from_string 
- *  Purpose:
- *  Converts an ANSI string to a dsp_uuid.
- *  Parameters:
- *  sz_uuid:Pointer to a string that represents a dsp_uuid object.
- *  uuid_obj:  Pointer to a dsp_uuid object.
- *  Returns:
- *  Requires:
- *  uuid_obj & sz_uuid are non-NULL values.
- *  Ensures:
- *  Details:
- *  We assume the string representation of a UUID has the following format:
- *  "12345678_1234_1234_1234_123456789abc".
- */
-extern void uuid_uuid_from_string(char *sz_uuid,
- struct dsp_uuid *uuid_obj);
-
 #endif /* UUIDUTIL_ */
diff --git a/drivers/staging/tidspbridge/rmgr/dbdcd.c 
b/drivers/staging/tidspbridge/rmgr/dbdcd.c
index 3d2a26f..d640794 100644
--- a/drivers/staging/tidspbridge/rmgr/dbdcd.c
+++ b/drivers/staging/tidspbridge/rmgr/dbdcd.c
@@ -74,6 +74,40 @@ static int get_dep_lib_info(struct dcd_manager *hdcd_mgr,
   enum nldr_phase phase);
 
 /*
+ *   dcd_uuid_from_string 
+ *  Purpose:
+ *  Converts an ANSI string to a dsp_uuid.
+ *  Parameters:
+ *  sz_uuid:

Re: [PATCH 1/2] Drivers: staging: dgap: checkpatch.pl cleanups

2013-12-01 Thread Dan Carpenter
On Sun, Dec 01, 2013 at 05:43:08PM +0200, Aldo Iljazi wrote:
> A few checkpatch cleanups, particularly:
> 
> Lines 83, 87, 89, 196: Removed spaces before tabs.
> Lines 141, 265.267: Removed trailing whitespace.
> 

Don't send two patches with the exact same subject.

regards,
dan carpenter

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 2/2] Drivers: staging: dgap: checkpatch.pl cleanups

2013-12-01 Thread Dan Carpenter
On Sun, Dec 01, 2013 at 05:43:09PM +0200, Aldo Iljazi wrote:
>  #define DIGI_DLREQ_GET   (('d'<<8) | 220)
> @@ -57,7 +57,7 @@ struct downldio {
>  #define DIGI_NUKE_RESET_ALL   (1 << 31)
>  #define DIGI_NUKE_INHIBIT_POLLER (1 << 30)
>  #define DIGI_NUKE_BRD_NUMB0x0f
> - 
> +
>  
>  
>  #define  DLREQ_BIOS  0

We shouldn't have two blank lines in a row.

regards,
dan carpenter

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] Staging: TIDSPBRIDGE: Remove UUID helper

2013-12-01 Thread Ivajlo Dimitrov


On 01.12.2013 21:06, Joe Perches wrote:

On Sun, 2013-12-01 at 19:07 +0200, Ivaylo DImitrov wrote:

From: Ivaylo Dimitrov 

Custom uuid helper function is needed only in rmgr/dbdcd.c and doesn't
need to be exported. It can also be made way simpler by using sscanf.

[]

diff --git a/drivers/staging/tidspbridge/rmgr/dbdcd.c 
b/drivers/staging/tidspbridge/rmgr/dbdcd.c

[]

@@ -74,6 +74,40 @@ static int get_dep_lib_info(struct dcd_manager *hdcd_mgr,
   enum nldr_phase phase);
  
  /*

+ *   dcd_uuid_from_string 
+ *  Purpose:
+ *  Converts an ANSI string to a dsp_uuid.
+ *  Parameters:
+ *  sz_uuid:Pointer to a string that represents a dsp_uuid object.
+ *  uuid_obj:  Pointer to a dsp_uuid object.
+ *  Returns:
+ *  Requires:
+ *  uuid_obj & sz_uuid are non-NULL values.
+ *  Ensures:
+ *  Details:
+ *  We assume the string representation of a UUID has the following format:
+ *  "12345678_1234_1234_1234_123456789abc".
+ */
+static void dcd_uuid_from_string(char *sz_uuid, struct dsp_uuid *uuid_obj)
+{
+   char c;
+   u64 t;
+
+   /*
+* sscanf implementation cannot deal with hh format modifier
+* if the converted value doesn't fit in u32. So, convert the
+* last six bytes to u64 and memcpy what is needed
+*/
+   sscanf(sz_uuid, "%8x%c%4hx%c%4hx%c%2hhx%2hhx%c%llx",
+  &uuid_obj->data1, &c, &uuid_obj->data2, &c,
+  &uuid_obj->data3, &c, &uuid_obj->data4,
+  &uuid_obj->data5, &c, &t);
+
+   t = cpu_to_be64(t);
+   memcpy(&uuid_obj->data6[0], ((char*)&t) + 2, 6);
+}

It'd probably be better to return true or false on
successful conversion, use a temporary struct dsp_uuid,
check the sscanf return is 10 and only copy to uuid_obj
on success.

Something like:

static bool dcd_uuid_from_string(char *sz_uuid, struct dsp_uuid *uuid_obj)
{
char c;
u64 t;
struct dsp_uuid tmp;

/*
 * sscanf implementation cannot deal with hh format modifier
 * if the converted value doesn't fit in u32. So, convert the
 * last six bytes to u64 and memcpy what is needed
 */
if (sscanf(sz_uuid, "%8x%c%4hx%c%4hx%c%2hhx%2hhx%c%llx",
   &tmp.data1, &c, &tmp.data2, &c,
   &tmp.data3, &c, &tmp.data4,
   &tmp.data5, &c, &t) != 10)
return false;

t = cpu_to_be64(t);
memcpy(&tmp.data6[0], ((char*)&t) + 2, 6);
*uuid_obj =  tmp;

return true;
}


If there is to be a return value from that function, it is better to be 
int (-EINVAL/0), IMO. And I am not sure that makes much of a sense, as 
(afaik) uuids are read from baseimage.dof and codec nodes, if those are 
broken I suspect wrong uuids will be our least problem.

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel