Re: [PATCH v1 08/10] kgdb: Remove "weak" from kgdb_arch_pc() declaration

2014-10-15 Thread Harvey Harrison
On Wed, Oct 15, 2014 at 10:06 AM, Bjorn Helgaas  wrote:
>
> kernel/debug/debug_core.c provides a default kgdb_arch_pc() definition
> explicitly marked "weak".  Several architectures provide their own
> definitions intended to override the default, but the "weak" attribute on
> the declaration applied to the arch definitions as well, so the linker
> chose one based on link order (see 10629d711ed7 ("PCI: Remove __weak
> annotation from pcibios_get_phb_of_node decl")).
>
> Remove the "weak" attribute from the declaration so we always prefer a
> non-weak definition over the weak one, independent of link order.
>
> Fixes: 688b744d8bc8 ("kgdb: fix signedness mixmatches, add statics, add 
> declaration to header")
> Signed-off-by: Bjorn Helgaas 
> CC: Harvey Harrison 

Reviewed-by: Harvey Harrison 

This was likely simply an error in my patch, likely just copied the
function definition and didn't even notice the
weak annotation at the time.

Harvey
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v1 08/10] kgdb: Remove weak from kgdb_arch_pc() declaration

2014-10-15 Thread Harvey Harrison
On Wed, Oct 15, 2014 at 10:06 AM, Bjorn Helgaas bhelg...@google.com wrote:

 kernel/debug/debug_core.c provides a default kgdb_arch_pc() definition
 explicitly marked weak.  Several architectures provide their own
 definitions intended to override the default, but the weak attribute on
 the declaration applied to the arch definitions as well, so the linker
 chose one based on link order (see 10629d711ed7 (PCI: Remove __weak
 annotation from pcibios_get_phb_of_node decl)).

 Remove the weak attribute from the declaration so we always prefer a
 non-weak definition over the weak one, independent of link order.

 Fixes: 688b744d8bc8 (kgdb: fix signedness mixmatches, add statics, add 
 declaration to header)
 Signed-off-by: Bjorn Helgaas bhelg...@google.com
 CC: Harvey Harrison harvey.harri...@gmail.com

Reviewed-by: Harvey Harrison harvey.harri...@gmail.com

This was likely simply an error in my patch, likely just copied the
function definition and didn't even notice the
weak annotation at the time.

Harvey
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] staging: Change kzalloc to kcalloc

2014-07-24 Thread Harvey Harrison
On Thu, Jul 24, 2014 at 10:18 AM, Steven Rostedt  wrote:
> On Thu, 24 Jul 2014 12:50:31 -0400
> Nick Krause  wrote:

>
>> I am have this discussion with other kernel developers and just
>> because I send out one patch as a newbie like this doesn't mean I
>> don't known C.
>
> It's not just one patch, and I didn't say you don't know C. I said you
> don't understand C enough for kernel development.

And more importantly, stop guessing things are OK and selfishly asking
others to check
your work for you.

If you have not at least _built_ the kernel with your change, and not
_run_ it, and not made
sure that the changed code is being _run_...you are wasting other people's time.

Harvey
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] staging: Change kzalloc to kcalloc

2014-07-24 Thread Harvey Harrison
On Thu, Jul 24, 2014 at 10:18 AM, Steven Rostedt rost...@goodmis.org wrote:
 On Thu, 24 Jul 2014 12:50:31 -0400
 Nick Krause xerofo...@gmail.com wrote:


 I am have this discussion with other kernel developers and just
 because I send out one patch as a newbie like this doesn't mean I
 don't known C.

 It's not just one patch, and I didn't say you don't know C. I said you
 don't understand C enough for kernel development.

And more importantly, stop guessing things are OK and selfishly asking
others to check
your work for you.

If you have not at least _built_ the kernel with your change, and not
_run_ it, and not made
sure that the changed code is being _run_...you are wasting other people's time.

Harvey
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 7/8] dmaengine: ste_dma40: Use the BIT macro to replace ugly '(1 << x)'s

2013-04-09 Thread Harvey Harrison
On Tue, Apr 9, 2013 at 11:39 AM, Lee Jones  wrote:
>
> The aim is to make the code that little more readable.
>
> Signed-off-by: Lee Jones 
> ---

>
>  #define MAX(a, b) (((a) < (b)) ? (b) : (a))

Not part of your patch, but probably a good idea to switch to the
generic MAX macro, this
one is evaluating its args twice.

Cheers,

Harvey
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 7/8] dmaengine: ste_dma40: Use the BIT macro to replace ugly '(1 x)'s

2013-04-09 Thread Harvey Harrison
On Tue, Apr 9, 2013 at 11:39 AM, Lee Jones lee.jo...@linaro.org wrote:

 The aim is to make the code that little more readable.

 Signed-off-by: Lee Jones lee.jo...@linaro.org
 ---


  #define MAX(a, b) (((a)  (b)) ? (b) : (a))

Not part of your patch, but probably a good idea to switch to the
generic MAX macro, this
one is evaluating its args twice.

Cheers,

Harvey
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] cpufreq: ARM big LITTLE: Add generic cpufreq driver and its DT glue

2013-03-06 Thread Harvey Harrison
On Wed, Mar 6, 2013 at 4:32 PM, Viresh Kumar  wrote:

> clk[cluster] = clk_get_sys(name, NULL);
> -   if (!IS_ERR(clk[cluster])) {
> +   if (!IS_ERR_OR_NULL(clk[cluster])) {
> pr_debug("%s: clk: %p & freq table: %p, cluster: %d\n",
> __func__, clk[cluster], freq_table[cluster],
> cluster);


You seem pretty attached to IS_ERR_OR_NULL here.

Harvey
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] cpufreq: ARM big LITTLE: Add generic cpufreq driver and its DT glue

2013-03-06 Thread Harvey Harrison
On Wed, Mar 6, 2013 at 4:32 PM, Viresh Kumar viresh.ku...@linaro.org wrote:

 clk[cluster] = clk_get_sys(name, NULL);
 -   if (!IS_ERR(clk[cluster])) {
 +   if (!IS_ERR_OR_NULL(clk[cluster])) {
 pr_debug(%s: clk: %p  freq table: %p, cluster: %d\n,
 __func__, clk[cluster], freq_table[cluster],
 cluster);


You seem pretty attached to IS_ERR_OR_NULL here.

Harvey
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] cifs: remove GLOBAL_EXTERN macro

2008-02-25 Thread Harvey Harrison
Global variables should be defined in C files, not in headers.

1) Comment out unused vars
GlobalDnotifyRsp_Q
GlobalUidList

2) Declare vars in cifsfs.c that need it and change to extern in
cifsglob.h

3) Change to extern in cifsglob.h for vars that were already being
declared in cifsfs.c

4) Remove GLOBAL_EXTERN

Signed-off-by: Harvey Harrison <[EMAIL PROTECTED]>
---
Steven, here is a revised patch that has a bit more thought behind it.


 fs/cifs/cifsfs.c   |   31 -
 fs/cifs/cifsglob.h |   76 
 2 files changed, 64 insertions(+), 43 deletions(-)

diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c
index fcc4342..aae6752 100644
--- a/fs/cifs/cifsfs.c
+++ b/fs/cifs/cifsfs.c
@@ -37,7 +37,6 @@
 #include 
 #include "cifsfs.h"
 #include "cifspdu.h"
-#define DECLARE_GLOBALS_HERE
 #include "cifsglob.h"
 #include "cifsproto.h"
 #include "cifs_debug.h"
@@ -85,6 +84,34 @@ module_param(cifs_max_pending, int, 0);
 MODULE_PARM_DESC(cifs_max_pending, "Simultaneous requests to server. "
   "Default: 50 Range: 2 to 256");
 
+struct list_head GlobalSMBSessionList;
+struct list_head GlobalTreeConnectionList;
+rwlock_t GlobalSMBSeslock;
+
+struct list_head GlobalOplock_Q;
+
+struct list_head GlobalDnotifyReqList;
+
+unsigned int GlobalCurrentXid;
+unsigned int GlobalTotalActiveXid;
+unsigned int GlobalMaxActiveXid;
+spinlock_t GlobalMid_Lock;
+char Local_System_Name[15];
+
+atomic_t sesInfoAllocCount;
+atomic_t tconInfoAllocCount;
+atomic_t tcpSesAllocCount;
+atomic_t tcpSesReconnectCount;
+atomic_t tconInfoReconnectCount;
+
+atomic_t bufAllocCount;/* current number allocated  */
+#ifdef CONFIG_CIFS_STATS2
+atomic_t totBufAllocCount; /* total allocated over all time */
+atomic_t totSmBufAllocCount;
+#endif
+atomic_t smBufAllocCount;
+atomic_t midCount;
+
 extern mempool_t *cifs_sm_req_poolp;
 extern mempool_t *cifs_req_poolp;
 extern mempool_t *cifs_mid_poolp;
@@ -1001,7 +1028,7 @@ init_cifs(void)
INIT_LIST_HEAD(_Q);
 #ifdef CONFIG_CIFS_EXPERIMENTAL
INIT_LIST_HEAD();
-   INIT_LIST_HEAD(_Q);
+/* INIT_LIST_HEAD(_Q); */
 #endif
 /*
  *  Initialize Global counters
diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h
index 5d32d8d..c45acfd 100644
--- a/fs/cifs/cifsglob.h
+++ b/fs/cifs/cifsglob.h
@@ -583,79 +583,73 @@ require use of the stronger protocol */
  *
  /
 
-#ifdef DECLARE_GLOBALS_HERE
-#define GLOBAL_EXTERN
-#else
-#define GLOBAL_EXTERN extern
-#endif
-
 /*
  * The list of servers that did not respond with NT LM 0.12.
  * This list helps improve performance and eliminate the messages indicating
  * that we had a communications error talking to the server in this list.
  */
 /* Feature not supported */
-/* GLOBAL_EXTERN struct servers_not_supported *NotSuppList; */
+/* extern struct servers_not_supported *NotSuppList; */
 
 /*
  * The following is a hash table of all the users we know about.
  */
-GLOBAL_EXTERN struct smbUidInfo *GlobalUidList[UID_HASH];
+/* extern struct smbUidInfo *GlobalUidList[UID_HASH]; */
 
-/* GLOBAL_EXTERN struct list_head GlobalServerList; BB not implemented yet */
-GLOBAL_EXTERN struct list_head GlobalSMBSessionList;
-GLOBAL_EXTERN struct list_head GlobalTreeConnectionList;
-GLOBAL_EXTERN rwlock_t GlobalSMBSeslock;  /* protects list inserts on 3 above 
*/
+/* extern struct list_head GlobalServerList; BB not implemented yet */
+extern struct list_head GlobalSMBSessionList;
+extern struct list_head GlobalTreeConnectionList;
+extern rwlock_t GlobalSMBSeslock;  /* protects list inserts on 3 above */
 
-GLOBAL_EXTERN struct list_head GlobalOplock_Q;
+extern struct list_head GlobalOplock_Q;
 
 /* Outstanding dir notify requests */
-GLOBAL_EXTERN struct list_head GlobalDnotifyReqList;
+extern struct list_head GlobalDnotifyReqList;
 /* DirNotify response queue */
-GLOBAL_EXTERN struct list_head GlobalDnotifyRsp_Q;
+/* extern struct list_head GlobalDnotifyRsp_Q; */
 
 /*
  * Global transaction id (XID) information
  */
-GLOBAL_EXTERN unsigned int GlobalCurrentXid;   /* protected by GlobalMid_Sem */
-GLOBAL_EXTERN unsigned int GlobalTotalActiveXid; /* prot by GlobalMid_Sem */
-GLOBAL_EXTERN unsigned int GlobalMaxActiveXid; /* prot by GlobalMid_Sem */
-GLOBAL_EXTERN spinlock_t GlobalMid_Lock;  /* protects above & list operations 
*/
+extern unsigned int GlobalCurrentXid;  /* protected by GlobalMid_Sem */
+extern unsigned int GlobalTotalActiveXid; /* prot by GlobalMid_Sem */
+extern unsigned int GlobalMaxActiveXid;/* prot by GlobalMid_Sem */
+extern spinlock_t GlobalMid_Lock;  /* protects above & list operations */
  /* on midQ entries */
-GLOBAL_EXTERN char Local_System_Name[15];
+extern char Local_System_Name[15];
 
 /*
  *  Global counters, updated atomically
  */
-

[PATCH] fbcon: replace mono_col macro with static inline

2008-02-25 Thread Harvey Harrison
Use __u32 for max_len to match the declaration of length in the
struct fb_bitfield.

Suppresses sparse shadowed variable warnings from the nested max()
macros:
drivers/video/console/fbcon.h:130:8: warning: symbol '_x' shadows an earlier one
drivers/video/console/fbcon.h:130:8: originally declared here
drivers/video/console/fbcon.h:130:8: warning: symbol '_x' shadows an earlier one
drivers/video/console/fbcon.h:130:8: originally declared here
drivers/video/console/fbcon.h:130:8: warning: symbol '_y' shadows an earlier one
drivers/video/console/fbcon.h:130:8: originally declared here

Signed-off-by: Harvey Harrison <[EMAIL PROTECTED]>
---
 drivers/video/console/fbcon.h |   12 
 1 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/video/console/fbcon.h b/drivers/video/console/fbcon.h
index 3706307..51a6bf4 100644
--- a/drivers/video/console/fbcon.h
+++ b/drivers/video/console/fbcon.h
@@ -104,10 +104,14 @@ struct fbcon_ops {
 #define attr_blink(s) \
((s) & 0x8000)

-#define mono_col(info) \
-   (~(0xfff << (max((info)->var.green.length,  \
-max((info)->var.red.length,\
-(info)->var.blue.length & 0xff)
+
+static inline int mono_col(struct fb_info *info)
+{
+   __u32 max_len;
+   max_len = max(info->var.green.length, info->var.red.length);
+   max_len = max(info->var.blue.length, max_len);
+   return ~(0xfff << (max_len & 0xff));
+}
 
 static inline int attr_col_ec(int shift, struct vc_data *vc,
  struct fb_info *info, int is_fg)
-- 
1.5.4.3.328.gcaed



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] fbcon: replace mono_col macro with static inline

2008-02-25 Thread Harvey Harrison
Use __u32 for max_len to match the declaration of length in the
struct fb_bitfield.

Suppresses sparse shadowed variable warnings from the nested max()
macros:
drivers/video/console/fbcon.h:130:8: warning: symbol '_x' shadows an earlier one
drivers/video/console/fbcon.h:130:8: originally declared here
drivers/video/console/fbcon.h:130:8: warning: symbol '_x' shadows an earlier one
drivers/video/console/fbcon.h:130:8: originally declared here
drivers/video/console/fbcon.h:130:8: warning: symbol '_y' shadows an earlier one
drivers/video/console/fbcon.h:130:8: originally declared here

Signed-off-by: Harvey Harrison [EMAIL PROTECTED]
---
 drivers/video/console/fbcon.h |   12 
 1 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/video/console/fbcon.h b/drivers/video/console/fbcon.h
index 3706307..51a6bf4 100644
--- a/drivers/video/console/fbcon.h
+++ b/drivers/video/console/fbcon.h
@@ -104,10 +104,14 @@ struct fbcon_ops {
 #define attr_blink(s) \
((s)  0x8000)

-#define mono_col(info) \
-   (~(0xfff  (max((info)-var.green.length,  \
-max((info)-var.red.length,\
-(info)-var.blue.length  0xff)
+
+static inline int mono_col(struct fb_info *info)
+{
+   __u32 max_len;
+   max_len = max(info-var.green.length, info-var.red.length);
+   max_len = max(info-var.blue.length, max_len);
+   return ~(0xfff  (max_len  0xff));
+}
 
 static inline int attr_col_ec(int shift, struct vc_data *vc,
  struct fb_info *info, int is_fg)
-- 
1.5.4.3.328.gcaed



--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] cifs: remove GLOBAL_EXTERN macro

2008-02-25 Thread Harvey Harrison
Global variables should be defined in C files, not in headers.

1) Comment out unused vars
GlobalDnotifyRsp_Q
GlobalUidList

2) Declare vars in cifsfs.c that need it and change to extern in
cifsglob.h

3) Change to extern in cifsglob.h for vars that were already being
declared in cifsfs.c

4) Remove GLOBAL_EXTERN

Signed-off-by: Harvey Harrison [EMAIL PROTECTED]
---
Steven, here is a revised patch that has a bit more thought behind it.


 fs/cifs/cifsfs.c   |   31 -
 fs/cifs/cifsglob.h |   76 
 2 files changed, 64 insertions(+), 43 deletions(-)

diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c
index fcc4342..aae6752 100644
--- a/fs/cifs/cifsfs.c
+++ b/fs/cifs/cifsfs.c
@@ -37,7 +37,6 @@
 #include linux/freezer.h
 #include cifsfs.h
 #include cifspdu.h
-#define DECLARE_GLOBALS_HERE
 #include cifsglob.h
 #include cifsproto.h
 #include cifs_debug.h
@@ -85,6 +84,34 @@ module_param(cifs_max_pending, int, 0);
 MODULE_PARM_DESC(cifs_max_pending, Simultaneous requests to server. 
   Default: 50 Range: 2 to 256);
 
+struct list_head GlobalSMBSessionList;
+struct list_head GlobalTreeConnectionList;
+rwlock_t GlobalSMBSeslock;
+
+struct list_head GlobalOplock_Q;
+
+struct list_head GlobalDnotifyReqList;
+
+unsigned int GlobalCurrentXid;
+unsigned int GlobalTotalActiveXid;
+unsigned int GlobalMaxActiveXid;
+spinlock_t GlobalMid_Lock;
+char Local_System_Name[15];
+
+atomic_t sesInfoAllocCount;
+atomic_t tconInfoAllocCount;
+atomic_t tcpSesAllocCount;
+atomic_t tcpSesReconnectCount;
+atomic_t tconInfoReconnectCount;
+
+atomic_t bufAllocCount;/* current number allocated  */
+#ifdef CONFIG_CIFS_STATS2
+atomic_t totBufAllocCount; /* total allocated over all time */
+atomic_t totSmBufAllocCount;
+#endif
+atomic_t smBufAllocCount;
+atomic_t midCount;
+
 extern mempool_t *cifs_sm_req_poolp;
 extern mempool_t *cifs_req_poolp;
 extern mempool_t *cifs_mid_poolp;
@@ -1001,7 +1028,7 @@ init_cifs(void)
INIT_LIST_HEAD(GlobalOplock_Q);
 #ifdef CONFIG_CIFS_EXPERIMENTAL
INIT_LIST_HEAD(GlobalDnotifyReqList);
-   INIT_LIST_HEAD(GlobalDnotifyRsp_Q);
+/* INIT_LIST_HEAD(GlobalDnotifyRsp_Q); */
 #endif
 /*
  *  Initialize Global counters
diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h
index 5d32d8d..c45acfd 100644
--- a/fs/cifs/cifsglob.h
+++ b/fs/cifs/cifsglob.h
@@ -583,79 +583,73 @@ require use of the stronger protocol */
  *
  /
 
-#ifdef DECLARE_GLOBALS_HERE
-#define GLOBAL_EXTERN
-#else
-#define GLOBAL_EXTERN extern
-#endif
-
 /*
  * The list of servers that did not respond with NT LM 0.12.
  * This list helps improve performance and eliminate the messages indicating
  * that we had a communications error talking to the server in this list.
  */
 /* Feature not supported */
-/* GLOBAL_EXTERN struct servers_not_supported *NotSuppList; */
+/* extern struct servers_not_supported *NotSuppList; */
 
 /*
  * The following is a hash table of all the users we know about.
  */
-GLOBAL_EXTERN struct smbUidInfo *GlobalUidList[UID_HASH];
+/* extern struct smbUidInfo *GlobalUidList[UID_HASH]; */
 
-/* GLOBAL_EXTERN struct list_head GlobalServerList; BB not implemented yet */
-GLOBAL_EXTERN struct list_head GlobalSMBSessionList;
-GLOBAL_EXTERN struct list_head GlobalTreeConnectionList;
-GLOBAL_EXTERN rwlock_t GlobalSMBSeslock;  /* protects list inserts on 3 above 
*/
+/* extern struct list_head GlobalServerList; BB not implemented yet */
+extern struct list_head GlobalSMBSessionList;
+extern struct list_head GlobalTreeConnectionList;
+extern rwlock_t GlobalSMBSeslock;  /* protects list inserts on 3 above */
 
-GLOBAL_EXTERN struct list_head GlobalOplock_Q;
+extern struct list_head GlobalOplock_Q;
 
 /* Outstanding dir notify requests */
-GLOBAL_EXTERN struct list_head GlobalDnotifyReqList;
+extern struct list_head GlobalDnotifyReqList;
 /* DirNotify response queue */
-GLOBAL_EXTERN struct list_head GlobalDnotifyRsp_Q;
+/* extern struct list_head GlobalDnotifyRsp_Q; */
 
 /*
  * Global transaction id (XID) information
  */
-GLOBAL_EXTERN unsigned int GlobalCurrentXid;   /* protected by GlobalMid_Sem */
-GLOBAL_EXTERN unsigned int GlobalTotalActiveXid; /* prot by GlobalMid_Sem */
-GLOBAL_EXTERN unsigned int GlobalMaxActiveXid; /* prot by GlobalMid_Sem */
-GLOBAL_EXTERN spinlock_t GlobalMid_Lock;  /* protects above  list operations 
*/
+extern unsigned int GlobalCurrentXid;  /* protected by GlobalMid_Sem */
+extern unsigned int GlobalTotalActiveXid; /* prot by GlobalMid_Sem */
+extern unsigned int GlobalMaxActiveXid;/* prot by GlobalMid_Sem */
+extern spinlock_t GlobalMid_Lock;  /* protects above  list operations */
  /* on midQ entries */
-GLOBAL_EXTERN char Local_System_Name[15];
+extern char Local_System_Name[15];
 
 /*
  *  Global counters, updated atomically
  */
-GLOBAL_EXTERN atomic_t

[PATCH] radeon: fix integer as NULL pointer warnings in radeon_mem.c

2008-02-24 Thread Harvey Harrison
drivers/char/drm/radeon_mem.c:91:23: warning: Using plain integer as NULL 
pointer
drivers/char/drm/radeon_mem.c:116:28: warning: Using plain integer as NULL 
pointer
drivers/char/drm/radeon_mem.c:124:28: warning: Using plain integer as NULL 
pointer
drivers/char/drm/radeon_mem.c:177:26: warning: Using plain integer as NULL 
pointer
drivers/char/drm/radeon_mem.c:177:53: warning: Using plain integer as NULL 
pointer

Signed-off-by: Harvey Harrison <[EMAIL PROTECTED]>
---
 drivers/char/drm/radeon_mem.c |8 
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/char/drm/radeon_mem.c b/drivers/char/drm/radeon_mem.c
index 78b34fa..4af5286 100644
--- a/drivers/char/drm/radeon_mem.c
+++ b/drivers/char/drm/radeon_mem.c
@@ -88,7 +88,7 @@ static struct mem_block *alloc_block(struct mem_block *heap, 
int size,
 
list_for_each(p, heap) {
int start = (p->start + mask) & ~mask;
-   if (p->file_priv == 0 && start + size <= p->start + p->size)
+   if (p->file_priv == NULL && start + size <= p->start + p->size)
return split_block(p, start, size, file_priv);
}
 
@@ -113,7 +113,7 @@ static void free_block(struct mem_block *p)
/* Assumes a single contiguous range.  Needs a special file_priv in
 * 'heap' to stop it being subsumed.
 */
-   if (p->next->file_priv == 0) {
+   if (p->next->file_priv == NULL) {
struct mem_block *q = p->next;
p->size += q->size;
p->next = q->next;
@@ -121,7 +121,7 @@ static void free_block(struct mem_block *p)
drm_free(q, sizeof(*q), DRM_MEM_BUFS);
}
 
-   if (p->prev->file_priv == 0) {
+   if (p->prev->file_priv == NULL) {
struct mem_block *q = p->prev;
q->size += p->size;
q->next = p->next;
@@ -174,7 +174,7 @@ void radeon_mem_release(struct drm_file *file_priv, struct 
mem_block *heap)
 * 'heap' to stop it being subsumed.
 */
list_for_each(p, heap) {
-   while (p->file_priv == 0 && p->next->file_priv == 0) {
+   while (p->file_priv == NULL && p->next->file_priv == NULL) {
struct mem_block *q = p->next;
p->size += q->size;
p->next = q->next;
-- 
1.5.4.2.200.g99e75



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] video: add a clamp() macro to kernel.h and replace two existing defs

2008-02-24 Thread Harvey Harrison
Clamps a value to be within a given range with strict typechecking.

Signed-off-by: Harvey Harrison <[EMAIL PROTECTED]>
---
akpm: I've submitted a clamp_t version previously for use in libata.
You may want to just roll this into that one so clamp/clamp_t go in
together.

 drivers/media/video/bt8xx/bttvp.h|2 --
 drivers/media/video/usbvideo/vicam.c |6 --
 include/linux/kernel.h   |   13 +
 3 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/drivers/media/video/bt8xx/bttvp.h 
b/drivers/media/video/bt8xx/bttvp.h
index 1305d31..b38e3a0 100644
--- a/drivers/media/video/bt8xx/bttvp.h
+++ b/drivers/media/video/bt8xx/bttvp.h
@@ -82,8 +82,6 @@
 /* Limits scaled width, which must be a multiple of 4. */
 #define MAX_HACTIVE (0x3FF & -4)
 
-#define clamp(x, low, high) min (max (low, x), high)
-
 #define BTTV_NORMS(\
V4L2_STD_PAL| V4L2_STD_PAL_N | \
V4L2_STD_PAL_Nc | V4L2_STD_SECAM | \
diff --git a/drivers/media/video/usbvideo/vicam.c 
b/drivers/media/video/usbvideo/vicam.c
index da1ba02..938a60d 100644
--- a/drivers/media/video/usbvideo/vicam.c
+++ b/drivers/media/video/usbvideo/vicam.c
@@ -70,12 +70,6 @@
 
 #define VICAM_HEADER_SIZE   64
 
-#define clamp( x, l, h )max_t( __typeof__( x ), \
-  ( l ),   \
-  min_t( __typeof__( x ),  \
- ( h ),\
- ( x ) ) )
-
 /* Not sure what all the bytes in these char
  * arrays do, but they're necessary to make
  * the camera work.
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 47924ce..09ee1e0 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -352,6 +352,19 @@ static inline int __attribute__ ((format (printf, 1, 2))) 
pr_debug(const char *
_x > _y ? _x : _y; })
 
 /*
+ * Clamp a value to within a given range with strict type checking
+ */
+#define clamp(val,min,max) ({ \
+   typeof(val) __val = (val); \
+   typeof(min) __min = (min); \
+   typeof(max) __max = (max); \
+   (void) (&__val == &__min); \
+   (void) (&__val == &__max); \
+   __val = __val < __min ? __min: __val; \
+   __val > __max ? __max: __val; })
+
+
+/*
  * ..and if you can't take the strict
  * types, you can specify one yourself.
  *
-- 
1.5.4.2.200.g99e75



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] md: fix integer as NULL pointer warnings in md.c

2008-02-24 Thread Harvey Harrison
drivers/md/md.c:734:16: warning: Using plain integer as NULL pointer
drivers/md/md.c:1115:16: warning: Using plain integer as NULL pointer

Add some braces to match the else-block as well.

Signed-off-by: Harvey Harrison <[EMAIL PROTECTED]>
---
 drivers/md/md.c |8 
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/md/md.c b/drivers/md/md.c
index 7da6ec2..2879f60 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -731,9 +731,9 @@ static int super_90_load(mdk_rdev_t *rdev, mdk_rdev_t 
*refdev, int minor_version
else
rdev->desc_nr = sb->this_disk.number;
 
-   if (refdev == 0)
+   if (!refdev) {
ret = 1;
-   else {
+   } else {
__u64 ev1, ev2;
mdp_super_t *refsb = 
(mdp_super_t*)page_address(refdev->sb_page);
if (!uuid_equal(refsb, sb)) {
@@ -1112,9 +1112,9 @@ static int super_1_load(mdk_rdev_t *rdev, mdk_rdev_t 
*refdev, int minor_version)
else
rdev->desc_nr = le32_to_cpu(sb->dev_number);
 
-   if (refdev == 0)
+   if (!refdev) {
ret = 1;
-   else {
+   } else {
__u64 ev1, ev2;
struct mdp_superblock_1 *refsb = 
(struct mdp_superblock_1*)page_address(refdev->sb_page);
-- 
1.5.4.2.200.g99e75



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] smack: fix integer as NULL pointer warning in smack_lsm.c

2008-02-24 Thread Harvey Harrison
security/smack/smack_lsm.c:1257:16: warning: Using plain integer as NULL pointer

Signed-off-by: Harvey Harrison <[EMAIL PROTECTED]>
---
 security/smack/smack_lsm.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c
index 770eb06..40010fa 100644
--- a/security/smack/smack_lsm.c
+++ b/security/smack/smack_lsm.c
@@ -1254,7 +1254,7 @@ static void smack_set_catset(char *catset, struct 
netlbl_lsm_secattr *sap)
int rc;
int byte;
 
-   if (catset == 0)
+   if (!catset)
return;
 
sap->flags |= NETLBL_SECATTR_MLS_CAT;
-- 
1.5.4.2.200.g99e75


>From 8c1fd96327f5c99c68b44da78ae8a5ac650f78f2 Mon Sep 17 00:00:00 2001
From: Harvey Harrison <[EMAIL PROTECTED]>
Date: Sun, 24 Feb 2008 17:27:20 -0800
Subject: [PATCH] md: fix integer as NULL pointer warnings in md.c

drivers/md/md.c:734:16: warning: Using plain integer as NULL pointer
drivers/md/md.c:1115:16: warning: Using plain integer as NULL pointer

Add some braces to match the else-block as well.

Signed-off-by: Harvey Harrison <[EMAIL PROTECTED]>
---
 drivers/md/md.c |8 
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/md/md.c b/drivers/md/md.c
index 7da6ec2..2879f60 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -731,9 +731,9 @@ static int super_90_load(mdk_rdev_t *rdev, mdk_rdev_t 
*refdev, int minor_version
else
rdev->desc_nr = sb->this_disk.number;
 
-   if (refdev == 0)
+   if (!refdev) {
ret = 1;
-   else {
+   } else {
__u64 ev1, ev2;
mdp_super_t *refsb = 
(mdp_super_t*)page_address(refdev->sb_page);
if (!uuid_equal(refsb, sb)) {
@@ -1112,9 +1112,9 @@ static int super_1_load(mdk_rdev_t *rdev, mdk_rdev_t 
*refdev, int minor_version)
else
rdev->desc_nr = le32_to_cpu(sb->dev_number);
 
-   if (refdev == 0)
+   if (!refdev) {
ret = 1;
-   else {
+   } else {
__u64 ev1, ev2;
struct mdp_superblock_1 *refsb = 
(struct mdp_superblock_1*)page_address(refdev->sb_page);
-- 
1.5.4.2.200.g99e75



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 6/6] block: fix shadowed variable warning in blk-map.c

2008-02-24 Thread Harvey Harrison
Introduced between 2.6.25-rc2 and -rc3
block/blk-map.c:154:14: warning: symbol 'bio' shadows an earlier one
block/blk-map.c:110:13: originally declared here

Signed-off-by: Harvey Harrison <[EMAIL PROTECTED]>
---
 block/blk-map.c |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/block/blk-map.c b/block/blk-map.c
index 09f7fd0..f443c21 100644
--- a/block/blk-map.c
+++ b/block/blk-map.c
@@ -151,10 +151,10 @@ int blk_rq_map_user(struct request_queue *q, struct 
request *rq,
 */
if (len & queue_dma_alignment(q)) {
unsigned int pad_len = (queue_dma_alignment(q) & ~len) + 1;
-   struct bio *bio = rq->biotail;
+   struct bio *tail = rq->biotail;
 
-   bio->bi_io_vec[bio->bi_vcnt - 1].bv_len += pad_len;
-   bio->bi_size += pad_len;
+   tail->bi_io_vec[tail->bi_vcnt - 1].bv_len += pad_len;
+   tail->bi_size += pad_len;
rq->data_len += pad_len;
}
 
-- 
1.5.4.2.200.g99e75

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 4/6] smack: make functions static

2008-02-24 Thread Harvey Harrison
Introduced between 2.6.25-rc2 and -rc3
security/smack/smackfs.c:374:6: warning: symbol 'smk_unlbl_ambient' was not 
declared. Should it be static?

While here, take care of this one too.
security/smack/smackfs.c:341:6: warning: symbol 'smk_cipso_doi' was not 
declared. Should it be static?

Signed-off-by: Harvey Harrison <[EMAIL PROTECTED]>
---
 security/smack/smackfs.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/security/smack/smackfs.c b/security/smack/smackfs.c
index 358c92c..cb26951 100644
--- a/security/smack/smackfs.c
+++ b/security/smack/smackfs.c
@@ -338,7 +338,7 @@ static const struct file_operations smk_load_ops = {
 /**
  * smk_cipso_doi - initialize the CIPSO domain
  */
-void smk_cipso_doi(void)
+static void smk_cipso_doi(void)
 {
int rc;
struct cipso_v4_doi *doip;
@@ -371,7 +371,7 @@ void smk_cipso_doi(void)
 /**
  * smk_unlbl_ambient - initialize the unlabeled domain
  */
-void smk_unlbl_ambient(char *oldambient)
+static void smk_unlbl_ambient(char *oldambient)
 {
int rc;
struct netlbl_audit audit_info;
-- 
1.5.4.2.200.g99e75


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3/6] agp: fix shadowed variable warning in amd-k7-agp.c

2008-02-24 Thread Harvey Harrison
Introduced between 2.6.25-rc2 and -rc3
drivers/char/agp/amd-k7-agp.c:439:6: warning: symbol 'cap_ptr' shadows an 
earlier one
drivers/char/agp/amd-k7-agp.c:414:5: originally declared here

cap_ptr is never used again in this function, don't bother redeclaring.

Signed-off-by: Harvey Harrison <[EMAIL PROTECTED]>
---
 drivers/char/agp/amd-k7-agp.c |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/char/agp/amd-k7-agp.c b/drivers/char/agp/amd-k7-agp.c
index d286699..96bdb92 100644
--- a/drivers/char/agp/amd-k7-agp.c
+++ b/drivers/char/agp/amd-k7-agp.c
@@ -436,8 +436,9 @@ static int __devinit agp_amdk7_probe(struct pci_dev *pdev,
   system controller may experience noise due to strong drive strengths
 */
if (agp_bridge->dev->device == PCI_DEVICE_ID_AMD_FE_GATE_7006) {
-   u8 cap_ptr=0;
struct pci_dev *gfxcard=NULL;
+
+   cap_ptr = 0;
while (!cap_ptr) {
gfxcard = pci_get_class(PCI_CLASS_DISPLAY_VGA<<8, 
gfxcard);
if (!gfxcard) {
-- 
1.5.4.2.200.g99e75


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 5/6] block: remove extern on function definition

2008-02-24 Thread Harvey Harrison
Intoduced between 2.6.25-rc2 and -rc3
block/blk-settings.c:319:12: warning: function 'blk_queue_dma_drain' with 
external linkage has definition

Signed-off-by: Harvey Harrison <[EMAIL PROTECTED]>
---
 block/blk-settings.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/block/blk-settings.c b/block/blk-settings.c
index 9a8ffdd..6200415 100644
--- a/block/blk-settings.c
+++ b/block/blk-settings.c
@@ -316,7 +316,7 @@ EXPORT_SYMBOL(blk_queue_stack_limits);
  * device can support otherwise there won't be room for the drain
  * buffer.
  */
-extern int blk_queue_dma_drain(struct request_queue *q,
+int blk_queue_dma_drain(struct request_queue *q,
   dma_drain_needed_fn *dma_drain_needed,
   void *buf, unsigned int size)
 {
-- 
1.5.4.2.200.g99e75


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/6] markers: make marker_debug static

2008-02-24 Thread Harvey Harrison
Introduced between 2.6.25-rc2 and -rc3
kernel/marker.c:31:11: warning: symbol 'marker_debug' was not declared. Should 
it be static?

Signed-off-by: Harvey Harrison <[EMAIL PROTECTED]>
---
 kernel/marker.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/kernel/marker.c b/kernel/marker.c
index 50effc0..dc2eb12 100644
--- a/kernel/marker.c
+++ b/kernel/marker.c
@@ -28,7 +28,7 @@ extern struct marker __start___markers[];
 extern struct marker __stop___markers[];
 
 /* Set to 1 to enable marker debug output */
-const int marker_debug;
+static const int marker_debug;
 
 /*
  * markers_mutex nests inside module_mutex. Markers mutex protects the builtin
-- 
1.5.4.2.200.g99e75


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 2/6] xen: make blkif_getgeo static

2008-02-24 Thread Harvey Harrison
Introduced between 2.6.25-rc2 and -rc3
drivers/block/xen-blkfront.c:139:5: warning: symbol 'blkif_getgeo' was not 
declared. Should it be static?

Signed-off-by: Harvey Harrison <[EMAIL PROTECTED]>
---
 drivers/block/xen-blkfront.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c
index 9c6f3f9..ae7ee16 100644
--- a/drivers/block/xen-blkfront.c
+++ b/drivers/block/xen-blkfront.c
@@ -136,7 +136,7 @@ static void blkif_restart_queue_callback(void *arg)
schedule_work(>work);
 }
 
-int blkif_getgeo(struct block_device *bd, struct hd_geometry *hg)
+static int blkif_getgeo(struct block_device *bd, struct hd_geometry *hg)
 {
/* We don't have real geometry info, but let's at least return
   values consistent with the size of the device */
-- 
1.5.4.2.200.g99e75


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/6] markers: make marker_debug static

2008-02-24 Thread Harvey Harrison
Introduced between 2.6.25-rc2 and -rc3
kernel/marker.c:31:11: warning: symbol 'marker_debug' was not declared. Should 
it be static?

Signed-off-by: Harvey Harrison [EMAIL PROTECTED]
---
 kernel/marker.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/kernel/marker.c b/kernel/marker.c
index 50effc0..dc2eb12 100644
--- a/kernel/marker.c
+++ b/kernel/marker.c
@@ -28,7 +28,7 @@ extern struct marker __start___markers[];
 extern struct marker __stop___markers[];
 
 /* Set to 1 to enable marker debug output */
-const int marker_debug;
+static const int marker_debug;
 
 /*
  * markers_mutex nests inside module_mutex. Markers mutex protects the builtin
-- 
1.5.4.2.200.g99e75


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 2/6] xen: make blkif_getgeo static

2008-02-24 Thread Harvey Harrison
Introduced between 2.6.25-rc2 and -rc3
drivers/block/xen-blkfront.c:139:5: warning: symbol 'blkif_getgeo' was not 
declared. Should it be static?

Signed-off-by: Harvey Harrison [EMAIL PROTECTED]
---
 drivers/block/xen-blkfront.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c
index 9c6f3f9..ae7ee16 100644
--- a/drivers/block/xen-blkfront.c
+++ b/drivers/block/xen-blkfront.c
@@ -136,7 +136,7 @@ static void blkif_restart_queue_callback(void *arg)
schedule_work(info-work);
 }
 
-int blkif_getgeo(struct block_device *bd, struct hd_geometry *hg)
+static int blkif_getgeo(struct block_device *bd, struct hd_geometry *hg)
 {
/* We don't have real geometry info, but let's at least return
   values consistent with the size of the device */
-- 
1.5.4.2.200.g99e75


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3/6] agp: fix shadowed variable warning in amd-k7-agp.c

2008-02-24 Thread Harvey Harrison
Introduced between 2.6.25-rc2 and -rc3
drivers/char/agp/amd-k7-agp.c:439:6: warning: symbol 'cap_ptr' shadows an 
earlier one
drivers/char/agp/amd-k7-agp.c:414:5: originally declared here

cap_ptr is never used again in this function, don't bother redeclaring.

Signed-off-by: Harvey Harrison [EMAIL PROTECTED]
---
 drivers/char/agp/amd-k7-agp.c |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/char/agp/amd-k7-agp.c b/drivers/char/agp/amd-k7-agp.c
index d286699..96bdb92 100644
--- a/drivers/char/agp/amd-k7-agp.c
+++ b/drivers/char/agp/amd-k7-agp.c
@@ -436,8 +436,9 @@ static int __devinit agp_amdk7_probe(struct pci_dev *pdev,
   system controller may experience noise due to strong drive strengths
 */
if (agp_bridge-dev-device == PCI_DEVICE_ID_AMD_FE_GATE_7006) {
-   u8 cap_ptr=0;
struct pci_dev *gfxcard=NULL;
+
+   cap_ptr = 0;
while (!cap_ptr) {
gfxcard = pci_get_class(PCI_CLASS_DISPLAY_VGA8, 
gfxcard);
if (!gfxcard) {
-- 
1.5.4.2.200.g99e75


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 5/6] block: remove extern on function definition

2008-02-24 Thread Harvey Harrison
Intoduced between 2.6.25-rc2 and -rc3
block/blk-settings.c:319:12: warning: function 'blk_queue_dma_drain' with 
external linkage has definition

Signed-off-by: Harvey Harrison [EMAIL PROTECTED]
---
 block/blk-settings.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/block/blk-settings.c b/block/blk-settings.c
index 9a8ffdd..6200415 100644
--- a/block/blk-settings.c
+++ b/block/blk-settings.c
@@ -316,7 +316,7 @@ EXPORT_SYMBOL(blk_queue_stack_limits);
  * device can support otherwise there won't be room for the drain
  * buffer.
  */
-extern int blk_queue_dma_drain(struct request_queue *q,
+int blk_queue_dma_drain(struct request_queue *q,
   dma_drain_needed_fn *dma_drain_needed,
   void *buf, unsigned int size)
 {
-- 
1.5.4.2.200.g99e75


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 6/6] block: fix shadowed variable warning in blk-map.c

2008-02-24 Thread Harvey Harrison
Introduced between 2.6.25-rc2 and -rc3
block/blk-map.c:154:14: warning: symbol 'bio' shadows an earlier one
block/blk-map.c:110:13: originally declared here

Signed-off-by: Harvey Harrison [EMAIL PROTECTED]
---
 block/blk-map.c |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/block/blk-map.c b/block/blk-map.c
index 09f7fd0..f443c21 100644
--- a/block/blk-map.c
+++ b/block/blk-map.c
@@ -151,10 +151,10 @@ int blk_rq_map_user(struct request_queue *q, struct 
request *rq,
 */
if (len  queue_dma_alignment(q)) {
unsigned int pad_len = (queue_dma_alignment(q)  ~len) + 1;
-   struct bio *bio = rq-biotail;
+   struct bio *tail = rq-biotail;
 
-   bio-bi_io_vec[bio-bi_vcnt - 1].bv_len += pad_len;
-   bio-bi_size += pad_len;
+   tail-bi_io_vec[tail-bi_vcnt - 1].bv_len += pad_len;
+   tail-bi_size += pad_len;
rq-data_len += pad_len;
}
 
-- 
1.5.4.2.200.g99e75

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 4/6] smack: make functions static

2008-02-24 Thread Harvey Harrison
Introduced between 2.6.25-rc2 and -rc3
security/smack/smackfs.c:374:6: warning: symbol 'smk_unlbl_ambient' was not 
declared. Should it be static?

While here, take care of this one too.
security/smack/smackfs.c:341:6: warning: symbol 'smk_cipso_doi' was not 
declared. Should it be static?

Signed-off-by: Harvey Harrison [EMAIL PROTECTED]
---
 security/smack/smackfs.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/security/smack/smackfs.c b/security/smack/smackfs.c
index 358c92c..cb26951 100644
--- a/security/smack/smackfs.c
+++ b/security/smack/smackfs.c
@@ -338,7 +338,7 @@ static const struct file_operations smk_load_ops = {
 /**
  * smk_cipso_doi - initialize the CIPSO domain
  */
-void smk_cipso_doi(void)
+static void smk_cipso_doi(void)
 {
int rc;
struct cipso_v4_doi *doip;
@@ -371,7 +371,7 @@ void smk_cipso_doi(void)
 /**
  * smk_unlbl_ambient - initialize the unlabeled domain
  */
-void smk_unlbl_ambient(char *oldambient)
+static void smk_unlbl_ambient(char *oldambient)
 {
int rc;
struct netlbl_audit audit_info;
-- 
1.5.4.2.200.g99e75


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] smack: fix integer as NULL pointer warning in smack_lsm.c

2008-02-24 Thread Harvey Harrison
security/smack/smack_lsm.c:1257:16: warning: Using plain integer as NULL pointer

Signed-off-by: Harvey Harrison [EMAIL PROTECTED]
---
 security/smack/smack_lsm.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c
index 770eb06..40010fa 100644
--- a/security/smack/smack_lsm.c
+++ b/security/smack/smack_lsm.c
@@ -1254,7 +1254,7 @@ static void smack_set_catset(char *catset, struct 
netlbl_lsm_secattr *sap)
int rc;
int byte;
 
-   if (catset == 0)
+   if (!catset)
return;
 
sap-flags |= NETLBL_SECATTR_MLS_CAT;
-- 
1.5.4.2.200.g99e75


From 8c1fd96327f5c99c68b44da78ae8a5ac650f78f2 Mon Sep 17 00:00:00 2001
From: Harvey Harrison [EMAIL PROTECTED]
Date: Sun, 24 Feb 2008 17:27:20 -0800
Subject: [PATCH] md: fix integer as NULL pointer warnings in md.c

drivers/md/md.c:734:16: warning: Using plain integer as NULL pointer
drivers/md/md.c:1115:16: warning: Using plain integer as NULL pointer

Add some braces to match the else-block as well.

Signed-off-by: Harvey Harrison [EMAIL PROTECTED]
---
 drivers/md/md.c |8 
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/md/md.c b/drivers/md/md.c
index 7da6ec2..2879f60 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -731,9 +731,9 @@ static int super_90_load(mdk_rdev_t *rdev, mdk_rdev_t 
*refdev, int minor_version
else
rdev-desc_nr = sb-this_disk.number;
 
-   if (refdev == 0)
+   if (!refdev) {
ret = 1;
-   else {
+   } else {
__u64 ev1, ev2;
mdp_super_t *refsb = 
(mdp_super_t*)page_address(refdev-sb_page);
if (!uuid_equal(refsb, sb)) {
@@ -1112,9 +1112,9 @@ static int super_1_load(mdk_rdev_t *rdev, mdk_rdev_t 
*refdev, int minor_version)
else
rdev-desc_nr = le32_to_cpu(sb-dev_number);
 
-   if (refdev == 0)
+   if (!refdev) {
ret = 1;
-   else {
+   } else {
__u64 ev1, ev2;
struct mdp_superblock_1 *refsb = 
(struct mdp_superblock_1*)page_address(refdev-sb_page);
-- 
1.5.4.2.200.g99e75



--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] md: fix integer as NULL pointer warnings in md.c

2008-02-24 Thread Harvey Harrison
drivers/md/md.c:734:16: warning: Using plain integer as NULL pointer
drivers/md/md.c:1115:16: warning: Using plain integer as NULL pointer

Add some braces to match the else-block as well.

Signed-off-by: Harvey Harrison [EMAIL PROTECTED]
---
 drivers/md/md.c |8 
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/md/md.c b/drivers/md/md.c
index 7da6ec2..2879f60 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -731,9 +731,9 @@ static int super_90_load(mdk_rdev_t *rdev, mdk_rdev_t 
*refdev, int minor_version
else
rdev-desc_nr = sb-this_disk.number;
 
-   if (refdev == 0)
+   if (!refdev) {
ret = 1;
-   else {
+   } else {
__u64 ev1, ev2;
mdp_super_t *refsb = 
(mdp_super_t*)page_address(refdev-sb_page);
if (!uuid_equal(refsb, sb)) {
@@ -1112,9 +1112,9 @@ static int super_1_load(mdk_rdev_t *rdev, mdk_rdev_t 
*refdev, int minor_version)
else
rdev-desc_nr = le32_to_cpu(sb-dev_number);
 
-   if (refdev == 0)
+   if (!refdev) {
ret = 1;
-   else {
+   } else {
__u64 ev1, ev2;
struct mdp_superblock_1 *refsb = 
(struct mdp_superblock_1*)page_address(refdev-sb_page);
-- 
1.5.4.2.200.g99e75



--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] video: add a clamp() macro to kernel.h and replace two existing defs

2008-02-24 Thread Harvey Harrison
Clamps a value to be within a given range with strict typechecking.

Signed-off-by: Harvey Harrison [EMAIL PROTECTED]
---
akpm: I've submitted a clamp_t version previously for use in libata.
You may want to just roll this into that one so clamp/clamp_t go in
together.

 drivers/media/video/bt8xx/bttvp.h|2 --
 drivers/media/video/usbvideo/vicam.c |6 --
 include/linux/kernel.h   |   13 +
 3 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/drivers/media/video/bt8xx/bttvp.h 
b/drivers/media/video/bt8xx/bttvp.h
index 1305d31..b38e3a0 100644
--- a/drivers/media/video/bt8xx/bttvp.h
+++ b/drivers/media/video/bt8xx/bttvp.h
@@ -82,8 +82,6 @@
 /* Limits scaled width, which must be a multiple of 4. */
 #define MAX_HACTIVE (0x3FF  -4)
 
-#define clamp(x, low, high) min (max (low, x), high)
-
 #define BTTV_NORMS(\
V4L2_STD_PAL| V4L2_STD_PAL_N | \
V4L2_STD_PAL_Nc | V4L2_STD_SECAM | \
diff --git a/drivers/media/video/usbvideo/vicam.c 
b/drivers/media/video/usbvideo/vicam.c
index da1ba02..938a60d 100644
--- a/drivers/media/video/usbvideo/vicam.c
+++ b/drivers/media/video/usbvideo/vicam.c
@@ -70,12 +70,6 @@
 
 #define VICAM_HEADER_SIZE   64
 
-#define clamp( x, l, h )max_t( __typeof__( x ), \
-  ( l ),   \
-  min_t( __typeof__( x ),  \
- ( h ),\
- ( x ) ) )
-
 /* Not sure what all the bytes in these char
  * arrays do, but they're necessary to make
  * the camera work.
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 47924ce..09ee1e0 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -352,6 +352,19 @@ static inline int __attribute__ ((format (printf, 1, 2))) 
pr_debug(const char *
_x  _y ? _x : _y; })
 
 /*
+ * Clamp a value to within a given range with strict type checking
+ */
+#define clamp(val,min,max) ({ \
+   typeof(val) __val = (val); \
+   typeof(min) __min = (min); \
+   typeof(max) __max = (max); \
+   (void) (__val == __min); \
+   (void) (__val == __max); \
+   __val = __val  __min ? __min: __val; \
+   __val  __max ? __max: __val; })
+
+
+/*
  * ..and if you can't take the strict
  * types, you can specify one yourself.
  *
-- 
1.5.4.2.200.g99e75



--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] radeon: fix integer as NULL pointer warnings in radeon_mem.c

2008-02-24 Thread Harvey Harrison
drivers/char/drm/radeon_mem.c:91:23: warning: Using plain integer as NULL 
pointer
drivers/char/drm/radeon_mem.c:116:28: warning: Using plain integer as NULL 
pointer
drivers/char/drm/radeon_mem.c:124:28: warning: Using plain integer as NULL 
pointer
drivers/char/drm/radeon_mem.c:177:26: warning: Using plain integer as NULL 
pointer
drivers/char/drm/radeon_mem.c:177:53: warning: Using plain integer as NULL 
pointer

Signed-off-by: Harvey Harrison [EMAIL PROTECTED]
---
 drivers/char/drm/radeon_mem.c |8 
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/char/drm/radeon_mem.c b/drivers/char/drm/radeon_mem.c
index 78b34fa..4af5286 100644
--- a/drivers/char/drm/radeon_mem.c
+++ b/drivers/char/drm/radeon_mem.c
@@ -88,7 +88,7 @@ static struct mem_block *alloc_block(struct mem_block *heap, 
int size,
 
list_for_each(p, heap) {
int start = (p-start + mask)  ~mask;
-   if (p-file_priv == 0  start + size = p-start + p-size)
+   if (p-file_priv == NULL  start + size = p-start + p-size)
return split_block(p, start, size, file_priv);
}
 
@@ -113,7 +113,7 @@ static void free_block(struct mem_block *p)
/* Assumes a single contiguous range.  Needs a special file_priv in
 * 'heap' to stop it being subsumed.
 */
-   if (p-next-file_priv == 0) {
+   if (p-next-file_priv == NULL) {
struct mem_block *q = p-next;
p-size += q-size;
p-next = q-next;
@@ -121,7 +121,7 @@ static void free_block(struct mem_block *p)
drm_free(q, sizeof(*q), DRM_MEM_BUFS);
}
 
-   if (p-prev-file_priv == 0) {
+   if (p-prev-file_priv == NULL) {
struct mem_block *q = p-prev;
q-size += p-size;
q-next = p-next;
@@ -174,7 +174,7 @@ void radeon_mem_release(struct drm_file *file_priv, struct 
mem_block *heap)
 * 'heap' to stop it being subsumed.
 */
list_for_each(p, heap) {
-   while (p-file_priv == 0  p-next-file_priv == 0) {
+   while (p-file_priv == NULL  p-next-file_priv == NULL) {
struct mem_block *q = p-next;
p-size += q-size;
p-next = q-next;
-- 
1.5.4.2.200.g99e75



--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCHv2 2/2] char: fix possible double-unlock in esp.c

2008-02-22 Thread Harvey Harrison
Hitting either of the break statements in the while loop would cause
a double-unlock of info->lock.

[Jiri Slaby suggested simply returning is safe here, rather than a goto]

Noticed by sparse:
drivers/char/esp.c:2042:2: warning: context imbalance in 'rs_wait_until_sent' - 
unexpected unlock

Signed-off-by: Harvey Harrison <[EMAIL PROTECTED]>
---
 drivers/char/esp.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/char/esp.c b/drivers/char/esp.c
index 01fbddd..0a33d09 100644
--- a/drivers/char/esp.c
+++ b/drivers/char/esp.c
@@ -2030,10 +2030,10 @@ static void rs_wait_until_sent(struct tty_struct *tty, 
int timeout)
msleep_interruptible(jiffies_to_msecs(char_time));
 
if (signal_pending(current))
-   break;
+   return;
 
if (timeout && time_after(jiffies, orig_jiffies + timeout))
-   break;
+   return;
 
spin_lock_irqsave(>lock, flags);
serial_out(info, UART_ESI_CMD1, ESI_NO_COMMAND);
-- 
1.5.4.2.200.g99e75



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/2] char: hide sparse expensive pointer subtraction warning in specialix.c

2008-02-22 Thread Harvey Harrison
The warnings come from two static inlines so the ugliness in hiding them
is well contained.
drivers/char/specialix.c:238:19: warning: potentially expensive pointer 
subtraction
drivers/char/specialix.c:245:19: warning: potentially expensive pointer 
subtraction

Signed-off-by: Harvey Harrison <[EMAIL PROTECTED]>
---
Bernd noticed that I'm an idiot.  I was only hiding them to see what else
was in the file.  This patch is at least functionally correct.

Brown-paper-bagged-by: Harvey Harrison

 drivers/char/specialix.c |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/char/specialix.c b/drivers/char/specialix.c
index c0e08c7..34c7de6 100644
--- a/drivers/char/specialix.c
+++ b/drivers/char/specialix.c
@@ -228,21 +228,21 @@ static inline int sx_paranoia_check(struct specialix_port 
const * port,
 /* Get board number from pointer */
 static inline int board_No (struct specialix_board * bp)
 {
-   return bp - sx_board;
+   return ((char *)bp - (char *)sx_board) / sizeof(*bp);
 }
 
 
 /* Get port number from pointer */
 static inline int port_No (struct specialix_port const * port)
 {
-   return SX_PORT(port - sx_port);
+   return SX_PORT(((char *)port - (char *)sx_port) / sizeof(*port));
 }
 
 
 /* Get pointer to board from pointer to port */
 static inline struct specialix_board * port_Board(struct specialix_port const 
* port)
 {
-   return _board[SX_BOARD(port - sx_port)];
+   return _board[SX_BOARD(port_No(port))];
 }
 
 
-- 
1.5.4.2.200.g99e75


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 2/2] char: fix possible double-unlock in specialix.c

2008-02-22 Thread Harvey Harrison
Noticed by sparse, trivial to see:
drivers/char/specialix.c:2112:3: warning: context imbalance in 'sx_throttle' - 
unexpected unlock

Signed-off-by: Harvey Harrison <[EMAIL PROTECTED]>
---
And with the torrent of warnings fixed, here we find a double-unlock.

 drivers/char/specialix.c |1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/drivers/char/specialix.c b/drivers/char/specialix.c
index 5487f37..b508e2c 100644
--- a/drivers/char/specialix.c
+++ b/drivers/char/specialix.c
@@ -2109,7 +2109,6 @@ static void sx_throttle(struct tty_struct * tty)
sx_out(bp, CD186x_CAR, port_No(port));
spin_unlock_irqrestore(>lock, flags);
if (I_IXOFF(tty)) {
-   spin_unlock_irqrestore(>lock, flags);
sx_wait_CCR(bp);
spin_lock_irqsave(>lock, flags);
sx_out(bp, CD186x_CCR, CCR_SSCH2);
-- 
1.5.4.2.200.g99e75

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/2] char: hide sparse expensive pointer subtraction warning in specialix.c

2008-02-22 Thread Harvey Harrison
The warnings come from two static inlines so the ugliness in hiding them
is well contained.
drivers/char/specialix.c:238:19: warning: potentially expensive pointer 
subtraction
drivers/char/specialix.c:245:19: warning: potentially expensive pointer 
subtraction

Signed-off-by: Harvey Harrison <[EMAIL PROTECTED]>
---
Andrew, take it or leave it, I just did this to make it easier to look at the 
other
sparse issuesbut without this sparse produces > 100 of these warnings for 
this
file.

 drivers/char/specialix.c |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/char/specialix.c b/drivers/char/specialix.c
index c0e08c7..5487f37 100644
--- a/drivers/char/specialix.c
+++ b/drivers/char/specialix.c
@@ -228,21 +228,21 @@ static inline int sx_paranoia_check(struct specialix_port 
const * port,
 /* Get board number from pointer */
 static inline int board_No (struct specialix_board * bp)
 {
-   return bp - sx_board;
+   return ((char *)bp - (char *)sx_board) * sizeof(*bp);
 }
 

 /* Get port number from pointer */
 static inline int port_No (struct specialix_port const * port)
 {
-   return SX_PORT(port - sx_port);
+   return SX_PORT(((char *)port - (char *)sx_port) * sizeof(*port));
 }
 

 /* Get pointer to board from pointer to port */
 static inline struct specialix_board * port_Board(struct specialix_port const 
* port)
 {
-   return _board[SX_BOARD(port - sx_port)];
+   return _board[SX_BOARD(port_No(port))];
 }
 

-- 
1.5.4.2.200.g99e75


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] char: static functions and integer as NULL pointer fixes in epca.c

2008-02-22 Thread Harvey Harrison
drivers/char/epca.c:926:28: warning: Using plain integer as NULL pointer
drivers/char/epca.c:1841:2: warning: Using plain integer as NULL pointer

Forward declarations were already marked static, mark the definitions too.
drivers/char/epca.c:2493:6: warning: symbol 'digi_send_break' was not declared. 
Should it be static?
drivers/char/epca.c:2881:12: warning: symbol 'init_PCI' was not declared. 
Should it be static?

Signed-off-by: Harvey Harrison <[EMAIL PROTECTED]>
---
 drivers/char/epca.c |8 
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/char/epca.c b/drivers/char/epca.c
index ffd747c..b034b37 100644
--- a/drivers/char/epca.c
+++ b/drivers/char/epca.c
@@ -923,7 +923,7 @@ static int pc_open(struct tty_struct *tty, struct file * 
filp)
return(-ENODEV);
}
 
-   if ((bc = ch->brdchan) == 0) {
+   if ((bc = ch->brdchan) == NULL) {
tty->driver_data = NULL;
return -ENODEV;
}
@@ -1838,7 +1838,7 @@ static void epcaparam(struct tty_struct *tty, struct 
channel *ch)
unsigned mval, hflow, cflag, iflag;
 
bc = ch->brdchan;
-   epcaassert(bc !=0, "bc out of range");
+   epcaassert(bc != NULL, "bc out of range");
 
assertgwinon(ch);
ts = tty->termios;
@@ -2490,7 +2490,7 @@ static void pc_unthrottle(struct tty_struct *tty)
}
 }
 
-void digi_send_break(struct channel *ch, int msec)
+static void digi_send_break(struct channel *ch, int msec)
 {
unsigned long flags;
 
@@ -2878,7 +2878,7 @@ static struct pci_device_id epca_pci_tbl[] = {
 
 MODULE_DEVICE_TABLE(pci, epca_pci_tbl);
 
-int __init init_PCI (void)
+static int __init init_PCI (void)
 {
memset (_driver, 0, sizeof (epca_driver));
epca_driver.name = "epca";
-- 
1.5.4.2.200.g99e75



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] char: fix sparse shadowed variable warnings in cyclades.c

2008-02-22 Thread Harvey Harrison
Nested min() macros.
drivers/char/cyclades.c:2750:7: warning: symbol '_x' shadows an earlier one
drivers/char/cyclades.c:2750:7: originally declared here
drivers/char/cyclades.c:2750:7: warning: symbol '_x' shadows an earlier one
drivers/char/cyclades.c:2750:7: originally declared here
drivers/char/cyclades.c:2750:7: warning: symbol '_y' shadows an earlier one
drivers/char/cyclades.c:2750:7: originally declared here

Signed-off-by: Harvey Harrison <[EMAIL PROTECTED]>
---
 drivers/char/cyclades.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/char/cyclades.c b/drivers/char/cyclades.c
index e4f579c..f8f4d54 100644
--- a/drivers/char/cyclades.c
+++ b/drivers/char/cyclades.c
@@ -2747,8 +2747,8 @@ static int cy_write(struct tty_struct *tty, const 
unsigned char *buf, int count)
 
spin_lock_irqsave(>card->card_lock, flags);
while (1) {
-   c = min(count, min((int)(SERIAL_XMIT_SIZE - info->xmit_cnt - 1),
-  (int)(SERIAL_XMIT_SIZE - info->xmit_head)));
+   c = min(count, (int)(SERIAL_XMIT_SIZE - info->xmit_cnt - 1));
+   c = min(c, (int)(SERIAL_XMIT_SIZE - info->xmit_head));
 
if (c <= 0)
break;
-- 
1.5.4.2.200.g99e75



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] char: fix sparse variable shadowing and int as NULL pointer in rocket.c

2008-02-22 Thread Harvey Harrison
Nested min() macros shadow _x, separate into two lines.
drivers/char/rocket.c:451:7: warning: symbol '_x' shadows an earlier one
drivers/char/rocket.c:451:7: originally declared here
drivers/char/rocket.c:451:7: warning: symbol '_x' shadows an earlier one
drivers/char/rocket.c:451:7: originally declared here
drivers/char/rocket.c:451:7: warning: symbol '_y' shadows an earlier one
drivers/char/rocket.c:451:7: originally declared here
drivers/char/rocket.c:1754:7: warning: symbol '_x' shadows an earlier one
drivers/char/rocket.c:1754:7: originally declared here
drivers/char/rocket.c:1754:7: warning: symbol '_x' shadows an earlier one
drivers/char/rocket.c:1754:7: originally declared here
drivers/char/rocket.c:1754:7: warning: symbol '_y' shadows an earlier one
drivers/char/rocket.c:1754:7: originally declared here
drivers/char/rocket.c:1751:20: warning: Using plain integer as NULL pointer

Signed-off-by: Harvey Harrison <[EMAIL PROTECTED]>
---
 drivers/char/rocket.c |9 +
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/char/rocket.c b/drivers/char/rocket.c
index 72f2892..2778d64 100644
--- a/drivers/char/rocket.c
+++ b/drivers/char/rocket.c
@@ -448,7 +448,8 @@ static void rp_do_transmit(struct r_port *info)
while (1) {
if (tty->stopped || tty->hw_stopped)
break;
-   c = min(info->xmit_fifo_room, min(info->xmit_cnt, XMIT_BUF_SIZE 
- info->xmit_tail));
+   c = min(info->xmit_fifo_room, info->xmit_cnt);
+   c = min(c, XMIT_BUF_SIZE - info->xmit_tail);
if (c <= 0 || info->xmit_fifo_room <= 0)
break;
sOutStrW(sGetTxRxDataIO(cp), (unsigned short *) (info->xmit_buf 
+ info->xmit_tail), c / 2);
@@ -1748,10 +1749,10 @@ static int rp_write(struct tty_struct *tty,
 
/*  Write remaining data into the port's xmit_buf */
while (1) {
-   if (info->tty == 0) /*   Seemingly obligatory check... */
+   if (info->tty == NULL)  /*   Seemingly obligatory check... */
goto end;
-
-   c = min(count, min(XMIT_BUF_SIZE - info->xmit_cnt - 1, 
XMIT_BUF_SIZE - info->xmit_head));
+   c = min(count, XMIT_BUF_SIZE - info->xmit_cnt - 1);
+   c = min(c, XMIT_BUF_SIZE - info->xmit_head);
if (c <= 0)
break;
 
-- 
1.5.4.2.200.g99e75



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 2/2] char: fix possible double-unlock in esp.c

2008-02-22 Thread Harvey Harrison
Hitting either of the break statements in the while loop would cause
a double-unlock of info->lock.  Add an out label and goto instead of
break to skip the unlock in those cases.

Noticed by sparse:
drivers/char/esp.c:2042:2: warning: context imbalance in 'rs_wait_until_sent' - 
unexpected unlock

Signed-off-by: Harvey Harrison <[EMAIL PROTECTED]>
---
 drivers/char/esp.c |5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/char/esp.c b/drivers/char/esp.c
index 01fbddd..2b14814 100644
--- a/drivers/char/esp.c
+++ b/drivers/char/esp.c
@@ -2030,16 +2030,17 @@ static void rs_wait_until_sent(struct tty_struct *tty, 
int timeout)
msleep_interruptible(jiffies_to_msecs(char_time));
 
if (signal_pending(current))
-   break;
+   goto out;
 
if (timeout && time_after(jiffies, orig_jiffies + timeout))
-   break;
+   goto out;
 
spin_lock_irqsave(>lock, flags);
serial_out(info, UART_ESI_CMD1, ESI_NO_COMMAND);
serial_out(info, UART_ESI_CMD1, ESI_GET_TX_AVAIL);
}
spin_unlock_irqrestore(>lock, flags);
+out:
set_current_state(TASK_RUNNING);
 }
 
-- 
1.5.4.2.200.g99e75

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/2] char: fix sparse shadowed variable warnings in esp.c

2008-02-22 Thread Harvey Harrison
flags only use was in spin_lock_irqsave/spin_lock_irgrestore pairs, no
need to redeclare for each one.

drivers/char/esp.c:1599:17: warning: symbol 'flags' shadows an earlier one
drivers/char/esp.c:1517:16: originally declared here
drivers/char/esp.c:1615:17: warning: symbol 'flags' shadows an earlier one
drivers/char/esp.c:1517:16: originally declared here
drivers/char/esp.c:1631:17: warning: symbol 'flags' shadows an earlier one
drivers/char/esp.c:1517:16: originally declared here

Signed-off-by: Harvey Harrison <[EMAIL PROTECTED]>
---
 drivers/char/esp.c |6 --
 1 files changed, 0 insertions(+), 6 deletions(-)

diff --git a/drivers/char/esp.c b/drivers/char/esp.c
index c01e26d..01fbddd 100644
--- a/drivers/char/esp.c
+++ b/drivers/char/esp.c
@@ -1596,8 +1596,6 @@ static int set_esp_config(struct esp_struct * info,
 
if ((new_config.flow_off != info->config.flow_off) ||
(new_config.flow_on != info->config.flow_on)) {
-   unsigned long flags;
-
info->config.flow_off = new_config.flow_off;
info->config.flow_on = new_config.flow_on;
 
@@ -1612,8 +1610,6 @@ static int set_esp_config(struct esp_struct * info,
 
if ((new_config.rx_trigger != info->config.rx_trigger) ||
(new_config.tx_trigger != info->config.tx_trigger)) {
-   unsigned long flags;
-
info->config.rx_trigger = new_config.rx_trigger;
info->config.tx_trigger = new_config.tx_trigger;
spin_lock_irqsave(>lock, flags);
@@ -1628,8 +1624,6 @@ static int set_esp_config(struct esp_struct * info,
}
 
if (new_config.rx_timeout != info->config.rx_timeout) {
-   unsigned long flags;
-
info->config.rx_timeout = new_config.rx_timeout;
spin_lock_irqsave(>lock, flags);
 
-- 
1.5.4.2.200.g99e75


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/2] char: fix sparse shadowed variable warnings in esp.c

2008-02-22 Thread Harvey Harrison
flags only use was in spin_lock_irqsave/spin_lock_irgrestore pairs, no
need to redeclare for each one.

drivers/char/esp.c:1599:17: warning: symbol 'flags' shadows an earlier one
drivers/char/esp.c:1517:16: originally declared here
drivers/char/esp.c:1615:17: warning: symbol 'flags' shadows an earlier one
drivers/char/esp.c:1517:16: originally declared here
drivers/char/esp.c:1631:17: warning: symbol 'flags' shadows an earlier one
drivers/char/esp.c:1517:16: originally declared here

Signed-off-by: Harvey Harrison [EMAIL PROTECTED]
---
 drivers/char/esp.c |6 --
 1 files changed, 0 insertions(+), 6 deletions(-)

diff --git a/drivers/char/esp.c b/drivers/char/esp.c
index c01e26d..01fbddd 100644
--- a/drivers/char/esp.c
+++ b/drivers/char/esp.c
@@ -1596,8 +1596,6 @@ static int set_esp_config(struct esp_struct * info,
 
if ((new_config.flow_off != info-config.flow_off) ||
(new_config.flow_on != info-config.flow_on)) {
-   unsigned long flags;
-
info-config.flow_off = new_config.flow_off;
info-config.flow_on = new_config.flow_on;
 
@@ -1612,8 +1610,6 @@ static int set_esp_config(struct esp_struct * info,
 
if ((new_config.rx_trigger != info-config.rx_trigger) ||
(new_config.tx_trigger != info-config.tx_trigger)) {
-   unsigned long flags;
-
info-config.rx_trigger = new_config.rx_trigger;
info-config.tx_trigger = new_config.tx_trigger;
spin_lock_irqsave(info-lock, flags);
@@ -1628,8 +1624,6 @@ static int set_esp_config(struct esp_struct * info,
}
 
if (new_config.rx_timeout != info-config.rx_timeout) {
-   unsigned long flags;
-
info-config.rx_timeout = new_config.rx_timeout;
spin_lock_irqsave(info-lock, flags);
 
-- 
1.5.4.2.200.g99e75


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 2/2] char: fix possible double-unlock in esp.c

2008-02-22 Thread Harvey Harrison
Hitting either of the break statements in the while loop would cause
a double-unlock of info-lock.  Add an out label and goto instead of
break to skip the unlock in those cases.

Noticed by sparse:
drivers/char/esp.c:2042:2: warning: context imbalance in 'rs_wait_until_sent' - 
unexpected unlock

Signed-off-by: Harvey Harrison [EMAIL PROTECTED]
---
 drivers/char/esp.c |5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/char/esp.c b/drivers/char/esp.c
index 01fbddd..2b14814 100644
--- a/drivers/char/esp.c
+++ b/drivers/char/esp.c
@@ -2030,16 +2030,17 @@ static void rs_wait_until_sent(struct tty_struct *tty, 
int timeout)
msleep_interruptible(jiffies_to_msecs(char_time));
 
if (signal_pending(current))
-   break;
+   goto out;
 
if (timeout  time_after(jiffies, orig_jiffies + timeout))
-   break;
+   goto out;
 
spin_lock_irqsave(info-lock, flags);
serial_out(info, UART_ESI_CMD1, ESI_NO_COMMAND);
serial_out(info, UART_ESI_CMD1, ESI_GET_TX_AVAIL);
}
spin_unlock_irqrestore(info-lock, flags);
+out:
set_current_state(TASK_RUNNING);
 }
 
-- 
1.5.4.2.200.g99e75

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] char: fix sparse variable shadowing and int as NULL pointer in rocket.c

2008-02-22 Thread Harvey Harrison
Nested min() macros shadow _x, separate into two lines.
drivers/char/rocket.c:451:7: warning: symbol '_x' shadows an earlier one
drivers/char/rocket.c:451:7: originally declared here
drivers/char/rocket.c:451:7: warning: symbol '_x' shadows an earlier one
drivers/char/rocket.c:451:7: originally declared here
drivers/char/rocket.c:451:7: warning: symbol '_y' shadows an earlier one
drivers/char/rocket.c:451:7: originally declared here
drivers/char/rocket.c:1754:7: warning: symbol '_x' shadows an earlier one
drivers/char/rocket.c:1754:7: originally declared here
drivers/char/rocket.c:1754:7: warning: symbol '_x' shadows an earlier one
drivers/char/rocket.c:1754:7: originally declared here
drivers/char/rocket.c:1754:7: warning: symbol '_y' shadows an earlier one
drivers/char/rocket.c:1754:7: originally declared here
drivers/char/rocket.c:1751:20: warning: Using plain integer as NULL pointer

Signed-off-by: Harvey Harrison [EMAIL PROTECTED]
---
 drivers/char/rocket.c |9 +
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/char/rocket.c b/drivers/char/rocket.c
index 72f2892..2778d64 100644
--- a/drivers/char/rocket.c
+++ b/drivers/char/rocket.c
@@ -448,7 +448,8 @@ static void rp_do_transmit(struct r_port *info)
while (1) {
if (tty-stopped || tty-hw_stopped)
break;
-   c = min(info-xmit_fifo_room, min(info-xmit_cnt, XMIT_BUF_SIZE 
- info-xmit_tail));
+   c = min(info-xmit_fifo_room, info-xmit_cnt);
+   c = min(c, XMIT_BUF_SIZE - info-xmit_tail);
if (c = 0 || info-xmit_fifo_room = 0)
break;
sOutStrW(sGetTxRxDataIO(cp), (unsigned short *) (info-xmit_buf 
+ info-xmit_tail), c / 2);
@@ -1748,10 +1749,10 @@ static int rp_write(struct tty_struct *tty,
 
/*  Write remaining data into the port's xmit_buf */
while (1) {
-   if (info-tty == 0) /*   Seemingly obligatory check... */
+   if (info-tty == NULL)  /*   Seemingly obligatory check... */
goto end;
-
-   c = min(count, min(XMIT_BUF_SIZE - info-xmit_cnt - 1, 
XMIT_BUF_SIZE - info-xmit_head));
+   c = min(count, XMIT_BUF_SIZE - info-xmit_cnt - 1);
+   c = min(c, XMIT_BUF_SIZE - info-xmit_head);
if (c = 0)
break;
 
-- 
1.5.4.2.200.g99e75



--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] char: fix sparse shadowed variable warnings in cyclades.c

2008-02-22 Thread Harvey Harrison
Nested min() macros.
drivers/char/cyclades.c:2750:7: warning: symbol '_x' shadows an earlier one
drivers/char/cyclades.c:2750:7: originally declared here
drivers/char/cyclades.c:2750:7: warning: symbol '_x' shadows an earlier one
drivers/char/cyclades.c:2750:7: originally declared here
drivers/char/cyclades.c:2750:7: warning: symbol '_y' shadows an earlier one
drivers/char/cyclades.c:2750:7: originally declared here

Signed-off-by: Harvey Harrison [EMAIL PROTECTED]
---
 drivers/char/cyclades.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/char/cyclades.c b/drivers/char/cyclades.c
index e4f579c..f8f4d54 100644
--- a/drivers/char/cyclades.c
+++ b/drivers/char/cyclades.c
@@ -2747,8 +2747,8 @@ static int cy_write(struct tty_struct *tty, const 
unsigned char *buf, int count)
 
spin_lock_irqsave(info-card-card_lock, flags);
while (1) {
-   c = min(count, min((int)(SERIAL_XMIT_SIZE - info-xmit_cnt - 1),
-  (int)(SERIAL_XMIT_SIZE - info-xmit_head)));
+   c = min(count, (int)(SERIAL_XMIT_SIZE - info-xmit_cnt - 1));
+   c = min(c, (int)(SERIAL_XMIT_SIZE - info-xmit_head));
 
if (c = 0)
break;
-- 
1.5.4.2.200.g99e75



--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] char: static functions and integer as NULL pointer fixes in epca.c

2008-02-22 Thread Harvey Harrison
drivers/char/epca.c:926:28: warning: Using plain integer as NULL pointer
drivers/char/epca.c:1841:2: warning: Using plain integer as NULL pointer

Forward declarations were already marked static, mark the definitions too.
drivers/char/epca.c:2493:6: warning: symbol 'digi_send_break' was not declared. 
Should it be static?
drivers/char/epca.c:2881:12: warning: symbol 'init_PCI' was not declared. 
Should it be static?

Signed-off-by: Harvey Harrison [EMAIL PROTECTED]
---
 drivers/char/epca.c |8 
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/char/epca.c b/drivers/char/epca.c
index ffd747c..b034b37 100644
--- a/drivers/char/epca.c
+++ b/drivers/char/epca.c
@@ -923,7 +923,7 @@ static int pc_open(struct tty_struct *tty, struct file * 
filp)
return(-ENODEV);
}
 
-   if ((bc = ch-brdchan) == 0) {
+   if ((bc = ch-brdchan) == NULL) {
tty-driver_data = NULL;
return -ENODEV;
}
@@ -1838,7 +1838,7 @@ static void epcaparam(struct tty_struct *tty, struct 
channel *ch)
unsigned mval, hflow, cflag, iflag;
 
bc = ch-brdchan;
-   epcaassert(bc !=0, bc out of range);
+   epcaassert(bc != NULL, bc out of range);
 
assertgwinon(ch);
ts = tty-termios;
@@ -2490,7 +2490,7 @@ static void pc_unthrottle(struct tty_struct *tty)
}
 }
 
-void digi_send_break(struct channel *ch, int msec)
+static void digi_send_break(struct channel *ch, int msec)
 {
unsigned long flags;
 
@@ -2878,7 +2878,7 @@ static struct pci_device_id epca_pci_tbl[] = {
 
 MODULE_DEVICE_TABLE(pci, epca_pci_tbl);
 
-int __init init_PCI (void)
+static int __init init_PCI (void)
 {
memset (epca_driver, 0, sizeof (epca_driver));
epca_driver.name = epca;
-- 
1.5.4.2.200.g99e75



--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/2] char: hide sparse expensive pointer subtraction warning in specialix.c

2008-02-22 Thread Harvey Harrison
The warnings come from two static inlines so the ugliness in hiding them
is well contained.
drivers/char/specialix.c:238:19: warning: potentially expensive pointer 
subtraction
drivers/char/specialix.c:245:19: warning: potentially expensive pointer 
subtraction

Signed-off-by: Harvey Harrison [EMAIL PROTECTED]
---
Andrew, take it or leave it, I just did this to make it easier to look at the 
other
sparse issuesbut without this sparse produces  100 of these warnings for 
this
file.

 drivers/char/specialix.c |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/char/specialix.c b/drivers/char/specialix.c
index c0e08c7..5487f37 100644
--- a/drivers/char/specialix.c
+++ b/drivers/char/specialix.c
@@ -228,21 +228,21 @@ static inline int sx_paranoia_check(struct specialix_port 
const * port,
 /* Get board number from pointer */
 static inline int board_No (struct specialix_board * bp)
 {
-   return bp - sx_board;
+   return ((char *)bp - (char *)sx_board) * sizeof(*bp);
 }
 

 /* Get port number from pointer */
 static inline int port_No (struct specialix_port const * port)
 {
-   return SX_PORT(port - sx_port);
+   return SX_PORT(((char *)port - (char *)sx_port) * sizeof(*port));
 }
 

 /* Get pointer to board from pointer to port */
 static inline struct specialix_board * port_Board(struct specialix_port const 
* port)
 {
-   return sx_board[SX_BOARD(port - sx_port)];
+   return sx_board[SX_BOARD(port_No(port))];
 }
 

-- 
1.5.4.2.200.g99e75


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 2/2] char: fix possible double-unlock in specialix.c

2008-02-22 Thread Harvey Harrison
Noticed by sparse, trivial to see:
drivers/char/specialix.c:2112:3: warning: context imbalance in 'sx_throttle' - 
unexpected unlock

Signed-off-by: Harvey Harrison [EMAIL PROTECTED]
---
And with the torrent of warnings fixed, here we find a double-unlock.

 drivers/char/specialix.c |1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/drivers/char/specialix.c b/drivers/char/specialix.c
index 5487f37..b508e2c 100644
--- a/drivers/char/specialix.c
+++ b/drivers/char/specialix.c
@@ -2109,7 +2109,6 @@ static void sx_throttle(struct tty_struct * tty)
sx_out(bp, CD186x_CAR, port_No(port));
spin_unlock_irqrestore(bp-lock, flags);
if (I_IXOFF(tty)) {
-   spin_unlock_irqrestore(bp-lock, flags);
sx_wait_CCR(bp);
spin_lock_irqsave(bp-lock, flags);
sx_out(bp, CD186x_CCR, CCR_SSCH2);
-- 
1.5.4.2.200.g99e75

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/2] char: hide sparse expensive pointer subtraction warning in specialix.c

2008-02-22 Thread Harvey Harrison
The warnings come from two static inlines so the ugliness in hiding them
is well contained.
drivers/char/specialix.c:238:19: warning: potentially expensive pointer 
subtraction
drivers/char/specialix.c:245:19: warning: potentially expensive pointer 
subtraction

Signed-off-by: Harvey Harrison [EMAIL PROTECTED]
---
Bernd noticed that I'm an idiot.  I was only hiding them to see what else
was in the file.  This patch is at least functionally correct.

Brown-paper-bagged-by: Harvey Harrison

 drivers/char/specialix.c |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/char/specialix.c b/drivers/char/specialix.c
index c0e08c7..34c7de6 100644
--- a/drivers/char/specialix.c
+++ b/drivers/char/specialix.c
@@ -228,21 +228,21 @@ static inline int sx_paranoia_check(struct specialix_port 
const * port,
 /* Get board number from pointer */
 static inline int board_No (struct specialix_board * bp)
 {
-   return bp - sx_board;
+   return ((char *)bp - (char *)sx_board) / sizeof(*bp);
 }
 
 
 /* Get port number from pointer */
 static inline int port_No (struct specialix_port const * port)
 {
-   return SX_PORT(port - sx_port);
+   return SX_PORT(((char *)port - (char *)sx_port) / sizeof(*port));
 }
 
 
 /* Get pointer to board from pointer to port */
 static inline struct specialix_board * port_Board(struct specialix_port const 
* port)
 {
-   return sx_board[SX_BOARD(port - sx_port)];
+   return sx_board[SX_BOARD(port_No(port))];
 }
 
 
-- 
1.5.4.2.200.g99e75


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCHv2 2/2] char: fix possible double-unlock in esp.c

2008-02-22 Thread Harvey Harrison
Hitting either of the break statements in the while loop would cause
a double-unlock of info-lock.

[Jiri Slaby suggested simply returning is safe here, rather than a goto]

Noticed by sparse:
drivers/char/esp.c:2042:2: warning: context imbalance in 'rs_wait_until_sent' - 
unexpected unlock

Signed-off-by: Harvey Harrison [EMAIL PROTECTED]
---
 drivers/char/esp.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/char/esp.c b/drivers/char/esp.c
index 01fbddd..0a33d09 100644
--- a/drivers/char/esp.c
+++ b/drivers/char/esp.c
@@ -2030,10 +2030,10 @@ static void rs_wait_until_sent(struct tty_struct *tty, 
int timeout)
msleep_interruptible(jiffies_to_msecs(char_time));
 
if (signal_pending(current))
-   break;
+   return;
 
if (timeout  time_after(jiffies, orig_jiffies + timeout))
-   break;
+   return;
 
spin_lock_irqsave(info-lock, flags);
serial_out(info, UART_ESI_CMD1, ESI_NO_COMMAND);
-- 
1.5.4.2.200.g99e75



--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: linux-next: first tree

2008-02-21 Thread Harvey Harrison
On Thu, 2008-02-21 at 16:12 -0800, Randy Dunlap wrote:
> Frank Seidel wrote:
> > Randy Dunlap wrote:
> >> I'd like to see tarballs too, please...
> > 
> > Hi, i'll provide tars of the current linux-next tree reachable
> > via my http://linux-next.f-seidel.de wiki ("Tar Downloads").
> > Is that what you were looking for?
> 
> Looks close.  It needs to be scriptable (not just a dynamically generated
> link) and have predictable names.  As long as those are true, then it
> should be great.
> 



// add the next git repo as a tracked remote
git remote add next 
git://git.kernel.org/pub/scm/linux/kernel/git/sfr/linux-next.git
// fetch any objects you don't have
// run this whenever you want to check for more objects
git remote update
// produce a tarball of the tree tagged next-20080220
git archive --format=tar next-20080220 > next-20080220.tar

Cheers,

Harvey



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] saa7146: fix sparse warnings

2008-02-21 Thread Harvey Harrison
On Thu, 2008-02-21 at 21:19 +, Al Viro wrote:
> On Thu, Feb 21, 2008 at 09:52:36AM -0800, Harvey Harrison wrote:
> 
> Could you please use more descriptive names?  NULL noise removal
> is not the same as shadowing or endianness annotations or endianness
> fixes or __user/__iomem annotations/fixes, etc.

Point taken, will do so going forward.

For now, I'm just doing the trivial ones to make the more interesting
warnings stand out a little better.

Harvey

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] mac80211: check endianness/types in sparse runs

2008-02-21 Thread Harvey Harrison
On Thu, 2008-02-21 at 21:29 +0100, Johannes Berg wrote:
> > Clean, or did you specifically mean bitwise-clean?
> 
> bitwise-clean. But I don't do full-mac drivers so most of what you quote
> I don't compile, and the mac80211-based drivers only have few problems.
> 

This wasn't meant as any sort of slight, actually I completely agree
that the current warning level means real stuff gets missed.

I've knocked off about a thousand lines from an X86_32 allyesconfig
sparse run this week, but the fruit is starting to get harder to reach.

Harvey

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] mac80211: check endianness/types in sparse runs

2008-02-21 Thread Harvey Harrison
On Thu, 2008-02-21 at 21:09 +0100, Johannes Berg wrote:
> > > In any case, I would love to have __CHECK_ENDIAN__ enabled by default at
> > > least on the wireless code (just caught another bug with it...)
> > 
> > I should then add support for something like:
> > 
> > checkflags-y := -D__CHECK_ENDIAN__
> > 
> > to match the style of the rest.
> > 
> > I do not like all the buried in assumption about the
> > global variables.
> 
> That might be good. I retract my patch for now then.
> 
> > But I would prefer that someone would spend a few days looking into the
> > warnings generated with sparse.
> 
> I did spend a bit of time running it on all the tree, but wireless,
> where I do most work, is clean. 

Clean, or did you specifically mean bitwise-clean?

drivers/net/wireless/ipw2100.c:2837:7: warning: symbol 'i' shadows an earlier 
one
drivers/net/wireless/ipw2100.c:2760:9: originally declared here
drivers/net/wireless/ipw2100.c:7873:15: warning: symbol 'mode' shadows an 
earlier one
drivers/net/wireless/ipw2100.c:187:12: originally declared here
drivers/net/wireless/ipw2100.c:7937:11: warning: symbol 'mode' shadows an 
earlier one
drivers/net/wireless/ipw2100.c:187:12: originally declared here
drivers/net/wireless/ipw2100.c:7985:11: warning: symbol 'mode' shadows an 
earlier one
drivers/net/wireless/ipw2100.c:187:12: originally declared here
drivers/net/wireless/ipw2100.c:8253:13: warning: symbol '_x' shadows an earlier 
one
drivers/net/wireless/ipw2100.c:8253:13: originally declared here
drivers/net/wireless/ipw2100.c:8253:13: warning: symbol '_x' shadows an earlier 
one
drivers/net/wireless/ipw2100.c:8253:13: originally declared here
drivers/net/wireless/ipw2100.c:8253:13: warning: symbol '_y' shadows an earlier 
one
drivers/net/wireless/ipw2100.c:8253:13: originally declared here
drivers/net/wireless/ipw2100.c:1929:15: warning: incorrect type in argument 4 
(different signedness)
drivers/net/wireless/ipw2100.c:1929:15:expected unsigned int [usertype] *len
drivers/net/wireless/ipw2100.c:1929:15:got int *
drivers/net/wireless/ipw2100.c:1937:69: warning: incorrect type in argument 4 
(different signedness)
drivers/net/wireless/ipw2100.c:1937:69:expected unsigned int [usertype] *len
drivers/net/wireless/ipw2100.c:1937:69:got int *
drivers/net/wireless/ipw2100.c:1945:60: warning: incorrect type in argument 4 
(different signedness)
drivers/net/wireless/ipw2100.c:1945:60:expected unsigned int [usertype] *len
drivers/net/wireless/ipw2100.c:1945:60:got int *
drivers/net/wireless/ipw2100.c:1952:65: warning: incorrect type in argument 4 
(different signedness)
drivers/net/wireless/ipw2100.c:1952:65:expected unsigned int [usertype] *len
drivers/net/wireless/ipw2100.c:1952:65:got int *
drivers/net/wireless/ipw2100.c:4071:66: warning: incorrect type in argument 4 
(different signedness)
drivers/net/wireless/ipw2100.c:4071:66:expected unsigned int [usertype] *len
drivers/net/wireless/ipw2100.c:4071:66:got int *
drivers/net/wireless/ipw2100.c:4078:15: warning: incorrect type in argument 4 
(different signedness)
drivers/net/wireless/ipw2100.c:4078:15:expected unsigned int [usertype] *len
drivers/net/wireless/ipw2100.c:4078:15:got int *
drivers/net/wireless/ipw2100.c:4084:60: warning: incorrect type in argument 4 
(different signedness)
drivers/net/wireless/ipw2100.c:4084:60:expected unsigned int [usertype] *len
drivers/net/wireless/ipw2100.c:4084:60:got int *
drivers/net/wireless/ipw2100.c:5275:6: warning: symbol 
'ipw2100_queues_initialize' was not declared. Should it be static?
drivers/net/wireless/ipw2100.c:5282:6: warning: symbol 'ipw2100_queues_free' 
was not declared. Should it be static?
drivers/net/wireless/ipw2100.c:5289:5: warning: symbol 
'ipw2100_queues_allocate' was not declared. Should it be static?
drivers/net/wireless/ipw2100.c:7146:66: warning: incorrect type in argument 4 
(different signedness)
drivers/net/wireless/ipw2100.c:7146:66:expected unsigned int [usertype] *len
drivers/net/wireless/ipw2100.c:7146:66:got int *
drivers/net/wireless/ipw2100.c:8322:20: warning: incorrect type in argument 4 
(different signedness)
drivers/net/wireless/ipw2100.c:8322:20:expected unsigned int [usertype] *len
drivers/net/wireless/ipw2100.c:8322:20:got int *
drivers/net/wireless/ipw2200.c:833:6: warning: symbol 'led' shadows an earlier 
one
drivers/net/wireless/ipw2200.c:93:12: originally declared here
drivers/net/wireless/ipw2200.c:877:6: warning: symbol 'led' shadows an earlier 
one
drivers/net/wireless/ipw2200.c:93:12: originally declared here
drivers/net/wireless/ipw2200.c:921:6: warning: symbol 'led' shadows an earlier 
one
drivers/net/wireless/ipw2200.c:93:12: originally declared here
drivers/net/wireless/ipw2200.c:966:6: warning: symbol 'led' shadows an earlier 
one
drivers/net/wireless/ipw2200.c:93:12: originally declared here
drivers/net/wireless/ipw2200.c:1002:6: warning: symbol 'led' shadows an earlier 
one

Re: [PATCH] mac80211: check endianness/types in sparse runs

2008-02-21 Thread Harvey Harrison
On Thu, 2008-02-21 at 13:42 +0100, Johannes Berg wrote:
> >> [patch doing CHECKFLAGS += -D__CHECK_ENDIAN__ in the
> >> net/mac80211/Makefile]
> 
> > I would prefer it to be kernel wide enabled.
> > Tried a defconfig build.
> 
> Hm. I tend to think there was a reason for this, since this is actually
> explicitly disabled by include/linux/types.h:
> 
> #ifdef __CHECKER__
> #define __bitwise__ __attribute__((bitwise))
> #else 
> #define __bitwise__
> #endif
> 
> #ifdef __CHECK_ENDIAN__
> #define __bitwise __bitwise__
> #else
> #define __bitwise
> #endif
> 

This seems somewhat suspect.

> I recently ran sparse on my config and was surprised by the number of
> warnings. Then again, something in mmzone.h or so generated billions of
> them...

Potentially expensive pointer subtraction 640:

Patch in -mm.

> 
> In any case, I would love to have __CHECK_ENDIAN__ enabled by default at
> least on the wireless code (just caught another bug with it...)
> 

I'd love to have it too, but there are so many trivial warnings that
clutter up valid warnings that it is prohibitive.  I'm working on
reducing the noise level a bit for 2.6.26, we'll see about turning
it on then.

Harvey

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] eicon: fix sparse integer as NULL pointer warnings

2008-02-21 Thread Harvey Harrison
drivers/isdn/hardware/eicon/message.c:745:47: warning: Using plain integer as 
NULL pointer
drivers/isdn/hardware/eicon/message.c:761:45: warning: Using plain integer as 
NULL pointer
drivers/isdn/hardware/eicon/message.c:9122:16: warning: Using plain integer as 
NULL pointer
drivers/isdn/hardware/eicon/message.c:9147:16: warning: Using plain integer as 
NULL pointer
drivers/isdn/hardware/eicon/message.c:9173:14: warning: Using plain integer as 
NULL pointer
drivers/isdn/hardware/eicon/divasmain.c:396:23: warning: Using plain integer as 
NULL pointer

Signed-off-by: Harvey Harrison <[EMAIL PROTECTED]>
---
 drivers/isdn/hardware/eicon/divasmain.c |2 +-
 drivers/isdn/hardware/eicon/message.c   |   12 ++--
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/isdn/hardware/eicon/divasmain.c 
b/drivers/isdn/hardware/eicon/divasmain.c
index 6d39f93..5fcbdcc 100644
--- a/drivers/isdn/hardware/eicon/divasmain.c
+++ b/drivers/isdn/hardware/eicon/divasmain.c
@@ -393,7 +393,7 @@ void diva_free_dma_map(void *hdev, struct 
_diva_dma_map_entry *pmap)
dma_addr_t dma_handle;
void *addr_handle;
 
-   for (i = 0; (pmap != 0); i++) {
+   for (i = 0; (pmap != NULL); i++) {
diva_get_dma_map_entry(pmap, i, _addr, _addr);
if (!cpu_addr) {
break;
diff --git a/drivers/isdn/hardware/eicon/message.c 
b/drivers/isdn/hardware/eicon/message.c
index 1ff98e7..599fed8 100644
--- a/drivers/isdn/hardware/eicon/message.c
+++ b/drivers/isdn/hardware/eicon/message.c
@@ -742,7 +742,7 @@ static void start_internal_command (dword Id, PLCI   *plci, 
t_std_internal_comma
   else
   {
 i = 1;
-while (plci->internal_command_queue[i] != 0)
+while (plci->internal_command_queue[i] != NULL)
   i++;
 plci->internal_command_queue[i] = command_function;
   }
@@ -758,7 +758,7 @@ static void next_internal_command (dword Id, PLCI   *plci)
 
   plci->internal_command = 0;
   plci->internal_command_queue[0] = NULL;
-  while (plci->internal_command_queue[1] != 0)
+  while (plci->internal_command_queue[1] != NULL)
   {
 for (i = 0; i < MAX_INTERNAL_COMMAND_LEVELS - 1; i++)
   plci->internal_command_queue[i] = plci->internal_command_queue[i+1];
@@ -9119,7 +9119,7 @@ word AdvCodecSupport(DIVA_CAPI_ADAPTER   *a, PLCI   
*plci, APPL   *appl, byte ho
 dbug(1,dprintf("AdvSigPlci=0x%x",a->AdvSignalPLCI));
 return 0x2001; /* codec in use by another application */
   }
-  if(plci!=0)
+  if(plci!=NULL)
   {
 a->AdvSignalPLCI = plci;
 plci->tel=ADV_VOICE;
@@ -9144,7 +9144,7 @@ word AdvCodecSupport(DIVA_CAPI_ADAPTER   *a, PLCI   
*plci, APPL   *appl, byte ho
 }
/* indicate D-ch connect if  */
   }/* codec is connected OK */
-  if(plci!=0)
+  if(plci!=NULL)
   {
 a->AdvSignalPLCI = plci;
 plci->tel=ADV_VOICE;
@@ -9170,7 +9170,7 @@ word AdvCodecSupport(DIVA_CAPI_ADAPTER   *a, PLCI   
*plci, APPL   *appl, byte ho
   {
 if(hook_listen) return 0x300B;   /* Facility not supported */
  /* no hook with SCOM  */
-if(plci!=0) plci->tel = CODEC;
+if(plci!=NULL) plci->tel = CODEC;
 dbug(1,dprintf("S/SCOM codec"));
 /* first time we use the scom-s codec we must shut down the internal   */
 /* handset application of the card. This can be done by an assign with */
@@ -14604,7 +14604,7 @@ static void channel_xmit_extended_xon (PLCI   * plci) {
   int max_ch = ARRAY_SIZE(a->ch_flow_control);
   int i, one_requested = 0;
 
-  if ((!plci) || (!plci->Id) || ((a = plci->adapter) == 0)) {
+  if ((!plci) || (!plci->Id) || ((a = plci->adapter) == NULL)) {
 return;
   }
 
-- 
1.5.4.2.200.g99e75



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] avm: fix sparse warning using integer as NULL pointer

2008-02-21 Thread Harvey Harrison
drivers/isdn/hardware/avm/b1isa.c:206:37: warning: Using plain integer as NULL 
pointer
drivers/isdn/hardware/avm/b1isa.c:208:33: warning: Using plain integer as NULL 
pointer
drivers/isdn/hardware/avm/b1.c:664:42: warning: Using plain integer as NULL 
pointer
drivers/isdn/hardware/avm/b1.c:666:44: warning: Using plain integer as NULL 
pointer
drivers/isdn/hardware/avm/b1.c:668:42: warning: Using plain integer as NULL 
pointer
drivers/isdn/hardware/avm/b1.c:791:37: warning: Using plain integer as NULL 
pointer
drivers/isdn/hardware/avm/b1.c:793:33: warning: Using plain integer as NULL 
pointer
drivers/isdn/hardware/avm/b1pci.c:385:37: warning: Using plain integer as NULL 
pointer
drivers/isdn/hardware/avm/b1pci.c:387:33: warning: Using plain integer as NULL 
pointer
drivers/isdn/hardware/avm/b1dma.c:886:42: warning: Using plain integer as NULL 
pointer
drivers/isdn/hardware/avm/b1dma.c:888:44: warning: Using plain integer as NULL 
pointer
drivers/isdn/hardware/avm/b1dma.c:890:42: warning: Using plain integer as NULL 
pointer
drivers/isdn/hardware/avm/b1dma.c:973:37: warning: Using plain integer as NULL 
pointer
drivers/isdn/hardware/avm/b1dma.c:975:33: warning: Using plain integer as NULL 
pointer
drivers/isdn/hardware/avm/b1pcmcia.c:204:37: warning: Using plain integer as 
NULL pointer
drivers/isdn/hardware/avm/b1pcmcia.c:206:33: warning: Using plain integer as 
NULL pointer
drivers/isdn/hardware/avm/t1isa.c:554:37: warning: Using plain integer as NULL 
pointer
drivers/isdn/hardware/avm/t1isa.c:556:33: warning: Using plain integer as NULL 
pointer
drivers/isdn/hardware/avm/t1pci.c:236:37: warning: Using plain integer as NULL 
pointer
drivers/isdn/hardware/avm/t1pci.c:238:33: warning: Using plain integer as NULL 
pointer
drivers/isdn/hardware/avm/c4.c:1091:42: warning: Using plain integer as NULL 
pointer
drivers/isdn/hardware/avm/c4.c:1093:44: warning: Using plain integer as NULL 
pointer
drivers/isdn/hardware/avm/c4.c:1095:42: warning: Using plain integer as NULL 
pointer
drivers/isdn/hardware/avm/c4.c:1170:21: warning: Using plain integer as NULL 
pointer
drivers/isdn/hardware/avm/c4.c:1294:37: warning: Using plain integer as NULL 
pointer
drivers/isdn/hardware/avm/c4.c:1296:33: warning: Using plain integer as NULL 
pointer

Signed-off-by: Harvey Harrison <[EMAIL PROTECTED]>
---
 drivers/isdn/hardware/avm/b1.c   |   10 +-
 drivers/isdn/hardware/avm/b1dma.c|   10 +-
 drivers/isdn/hardware/avm/b1isa.c|4 ++--
 drivers/isdn/hardware/avm/b1pci.c|4 ++--
 drivers/isdn/hardware/avm/b1pcmcia.c |4 ++--
 drivers/isdn/hardware/avm/c4.c   |   12 ++--
 drivers/isdn/hardware/avm/t1isa.c|4 ++--
 drivers/isdn/hardware/avm/t1pci.c|4 ++--
 8 files changed, 26 insertions(+), 26 deletions(-)

diff --git a/drivers/isdn/hardware/avm/b1.c b/drivers/isdn/hardware/avm/b1.c
index 4484a64..abf05ec 100644
--- a/drivers/isdn/hardware/avm/b1.c
+++ b/drivers/isdn/hardware/avm/b1.c
@@ -661,11 +661,11 @@ int b1ctl_read_proc(char *page, char **start, off_t off,
len += sprintf(page+len, "%-16s %s\n", "type", s);
if (card->cardtype == avm_t1isa)
   len += sprintf(page+len, "%-16s %d\n", "cardnr", card->cardnr);
-   if ((s = cinfo->version[VER_DRIVER]) != 0)
+   if ((s = cinfo->version[VER_DRIVER]) != NULL)
   len += sprintf(page+len, "%-16s %s\n", "ver_driver", s);
-   if ((s = cinfo->version[VER_CARDTYPE]) != 0)
+   if ((s = cinfo->version[VER_CARDTYPE]) != NULL)
   len += sprintf(page+len, "%-16s %s\n", "ver_cardtype", s);
-   if ((s = cinfo->version[VER_SERIAL]) != 0)
+   if ((s = cinfo->version[VER_SERIAL]) != NULL)
   len += sprintf(page+len, "%-16s %s\n", "ver_serial", s);
 
if (card->cardtype != avm_m1) {
@@ -788,9 +788,9 @@ static int __init b1_init(void)
char *p;
char rev[32];
 
-   if ((p = strchr(revision, ':')) != 0 && p[1]) {
+   if ((p = strchr(revision, ':')) != NULL && p[1]) {
strlcpy(rev, p + 2, 32);
-   if ((p = strchr(rev, '$')) != 0 && p > rev)
+   if ((p = strchr(rev, '$')) != NULL && p > rev)
   *(p-1) = 0;
} else
strcpy(rev, "1.0");
diff --git a/drivers/isdn/hardware/avm/b1dma.c 
b/drivers/isdn/hardware/avm/b1dma.c
index 669f6f6..da34b98 100644
--- a/drivers/isdn/hardware/avm/b1dma.c
+++ b/drivers/isdn/hardware/avm/b1dma.c
@@ -883,11 +883,11 @@ int b1dmactl_read_proc(char *page, char **start, off_t 
off,
default: s = "???"; break;
}
len += sprintf(page+len, "%-16s %s\n", "type", s);
-   if ((s = cinfo->version[VER_DRIVER]) != 0)
+   if ((s = cinfo->version[VER_DRIVER]) != NULL)
   len += sprintf(p

[PATCH] capi: fix sparse warnings using integer as NULL pointer

2008-02-21 Thread Harvey Harrison
drivers/isdn/capi/kcapi.c:829:30: warning: Using plain integer as NULL pointer
drivers/isdn/capi/kcapi.c:838:27: warning: Using plain integer as NULL pointer
drivers/isdn/capi/kcapi.c:954:17: warning: Using plain integer as NULL pointer
drivers/isdn/capi/kcapi.c:1007:37: warning: Using plain integer as NULL pointer
drivers/isdn/capi/kcapi.c:1009:33: warning: Using plain integer as NULL pointer
drivers/isdn/capi/capiutil.c:453:24: warning: Using plain integer as NULL 
pointer
drivers/isdn/capi/capilib.c:47:30: warning: Using plain integer as NULL pointer
drivers/isdn/capi/capi.c:353:29: warning: Using plain integer as NULL pointer
drivers/isdn/capi/capi.c:369:15: warning: Using plain integer as NULL pointer
drivers/isdn/capi/capi.c:486:48: warning: Using plain integer as NULL pointer
drivers/isdn/capi/capi.c:515:46: warning: Using plain integer as NULL pointer
drivers/isdn/capi/capi.c:541:47: warning: Using plain integer as NULL pointer
drivers/isdn/capi/capi.c:692:47: warning: Using plain integer as NULL pointer
drivers/isdn/capi/capi.c:699:49: warning: Using plain integer as NULL pointer
drivers/isdn/capi/capi.c:704:14: warning: Using plain integer as NULL pointer
drivers/isdn/capi/capi.c:943:53: warning: Using plain integer as NULL pointer
drivers/isdn/capi/capi.c:948:32: warning: Using plain integer as NULL pointer
drivers/isdn/capi/capi.c:969:42: warning: Using plain integer as NULL pointer
drivers/isdn/capi/capi.c:989:48: warning: Using plain integer as NULL pointer
drivers/isdn/capi/capi.c:1026:69: warning: Using plain integer as NULL pointer
drivers/isdn/capi/capi.c:1028:19: warning: Using plain integer as NULL pointer
drivers/isdn/capi/capi.c:1061:20: warning: Using plain integer as NULL pointer
drivers/isdn/capi/capi.c:1529:37: warning: Using plain integer as NULL pointer
drivers/isdn/capi/capi.c:1531:33: warning: Using plain integer as NULL pointer
drivers/isdn/capi/capidrv.c:338:15: warning: Using plain integer as NULL pointer
drivers/isdn/capi/capidrv.c:758:32: warning: Using plain integer as NULL pointer
drivers/isdn/capi/capidrv.c:880:40: warning: Using plain integer as NULL pointer
drivers/isdn/capi/capidrv.c:407:15: warning: Using plain integer as NULL pointer
drivers/isdn/capi/capidrv.c:429:49: warning: Using plain integer as NULL pointer
drivers/isdn/capi/capidrv.c:407:15: warning: Using plain integer as NULL pointer
drivers/isdn/capi/capidrv.c:444:49: warning: Using plain integer as NULL pointer
drivers/isdn/capi/capidrv.c:429:49: warning: Using plain integer as NULL pointer
drivers/isdn/capi/capidrv.c:429:49: warning: Using plain integer as NULL pointer
drivers/isdn/capi/capidrv.c:429:49: warning: Using plain integer as NULL pointer
drivers/isdn/capi/capidrv.c:429:49: warning: Using plain integer as NULL pointer
drivers/isdn/capi/capidrv.c:429:49: warning: Using plain integer as NULL pointer
drivers/isdn/capi/capidrv.c:1664:61: warning: Using plain integer as NULL 
pointer
drivers/isdn/capi/capidrv.c:1969:37: warning: Using plain integer as NULL 
pointer
drivers/isdn/capi/capidrv.c:2294:37: warning: Using plain integer as NULL 
pointer
drivers/isdn/capi/capidrv.c:2297:33: warning: Using plain integer as NULL 
pointer
drivers/isdn/capi/capidrv.c:2338:37: warning: Using plain integer as NULL 
pointer
drivers/isdn/capi/capidrv.c:2341:33: warning: Using plain integer as NULL 
pointer
drivers/isdn/capi/capifs.c:192:37: warning: Using plain integer as NULL pointer
drivers/isdn/capi/capifs.c:194:33: warning: Using plain integer as NULL pointer

Signed-off-by: Harvey Harrison <[EMAIL PROTECTED]>
---
 drivers/isdn/capi/capi.c |   34 +-
 drivers/isdn/capi/capidrv.c  |   24 
 drivers/isdn/capi/capifs.c   |4 ++--
 drivers/isdn/capi/capilib.c  |2 +-
 drivers/isdn/capi/capiutil.c |2 +-
 drivers/isdn/capi/kcapi.c|   10 +-
 6 files changed, 38 insertions(+), 38 deletions(-)

diff --git a/drivers/isdn/capi/capi.c b/drivers/isdn/capi/capi.c
index 23ae66c..24c6b7c 100644
--- a/drivers/isdn/capi/capi.c
+++ b/drivers/isdn/capi/capi.c
@@ -350,7 +350,7 @@ static void capincci_free(struct capidev *cdev, u32 ncci)
if (ncci == 0x || np->ncci == ncci) {
*pp = (*pp)->next;
 #ifdef CONFIG_ISDN_CAPI_MIDDLEWARE
-   if ((mp = np->minorp) != 0) {
+   if ((mp = np->minorp) != NULL) {
 #if defined(CONFIG_ISDN_CAPI_CAPIFS) || defined(CONFIG_ISDN_CAPI_CAPIFS_MODULE)
capifs_free_ncci(mp->minor);
 #endif
@@ -366,7 +366,7 @@ static void capincci_free(struct capidev *cdev, u32 ncci)
}
 #endif /* CONFIG_ISDN_CAPI_MIDDLEWARE */
kfree(np);
-   if (*pp == 0) return;
+   if (*pp == NULL) return;
} else {
pp = &(*pp)->next;
}
@@ -483,7 +483,7 @@ static int hand

[PATCH] saa7146: fix sparse warnings

2008-02-21 Thread Harvey Harrison
Went along with the existing file style.
drivers/media/common/saa7146_core.c:309:6: warning: Using plain integer as NULL 
pointer
drivers/media/common/saa7146_core.c:311:8: warning: Using plain integer as NULL 
pointer
drivers/media/common/saa7146_core.c:319:7: warning: Using plain integer as NULL 
pointer
drivers/media/common/saa7146_core.c:319:28: warning: Using plain integer as 
NULL pointer
drivers/media/common/saa7146_core.c:325:7: warning: Using plain integer as NULL 
pointer
drivers/media/common/saa7146_core.c:325:28: warning: Using plain integer as 
NULL pointer
drivers/media/common/saa7146_fops.c:275:12: warning: Using plain integer as 
NULL pointer

Signed-off-by: Harvey Harrison <[EMAIL PROTECTED]>
---
 drivers/media/common/saa7146_core.c |8 
 drivers/media/common/saa7146_fops.c |2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/media/common/saa7146_core.c 
b/drivers/media/common/saa7146_core.c
index 168a8d3..8c755a1 100644
--- a/drivers/media/common/saa7146_core.c
+++ b/drivers/media/common/saa7146_core.c
@@ -306,9 +306,9 @@ static irqreturn_t interrupt_hw(int irq, void *dev_id)
return IRQ_NONE;
}
 
-   if( 0 != (dev->ext)) {
+   if( NULL != (dev->ext)) {
if( 0 != (dev->ext->irq_mask & isr )) {
-   if( 0 != dev->ext->irq_func ) {
+   if( NULL != dev->ext->irq_func ) {
dev->ext->irq_func(dev, );
}
isr &= ~dev->ext->irq_mask;
@@ -316,13 +316,13 @@ static irqreturn_t interrupt_hw(int irq, void *dev_id)
}
if (0 != (isr & (MASK_27))) {
DEB_INT(("irq: RPS0 (0x%08x).\n",isr));
-   if( 0 != dev->vv_data && 0 != dev->vv_callback) {
+   if( NULL != dev->vv_data && NULL != dev->vv_callback) {
dev->vv_callback(dev,isr);
}
isr &= ~MASK_27;
}
if (0 != (isr & (MASK_28))) {
-   if( 0 != dev->vv_data && 0 != dev->vv_callback) {
+   if( NULL != dev->vv_data && NULL != dev->vv_callback) {
dev->vv_callback(dev,isr);
}
isr &= ~MASK_28;
diff --git a/drivers/media/common/saa7146_fops.c 
b/drivers/media/common/saa7146_fops.c
index f0703d8..a73db79 100644
--- a/drivers/media/common/saa7146_fops.c
+++ b/drivers/media/common/saa7146_fops.c
@@ -272,7 +272,7 @@ static int fops_open(struct inode *inode, struct file *file)
 
result = 0;
 out:
-   if( fh != 0 && result != 0 ) {
+   if( fh != NULL && result != 0 ) {
kfree(fh);
file->private_data = NULL;
}
-- 
1.5.4.2.200.g99e75



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] saa7146: fix sparse warnings

2008-02-21 Thread Harvey Harrison
Went along with the existing file style.
drivers/media/common/saa7146_core.c:309:6: warning: Using plain integer as NULL 
pointer
drivers/media/common/saa7146_core.c:311:8: warning: Using plain integer as NULL 
pointer
drivers/media/common/saa7146_core.c:319:7: warning: Using plain integer as NULL 
pointer
drivers/media/common/saa7146_core.c:319:28: warning: Using plain integer as 
NULL pointer
drivers/media/common/saa7146_core.c:325:7: warning: Using plain integer as NULL 
pointer
drivers/media/common/saa7146_core.c:325:28: warning: Using plain integer as 
NULL pointer
drivers/media/common/saa7146_fops.c:275:12: warning: Using plain integer as 
NULL pointer

Signed-off-by: Harvey Harrison [EMAIL PROTECTED]
---
 drivers/media/common/saa7146_core.c |8 
 drivers/media/common/saa7146_fops.c |2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/media/common/saa7146_core.c 
b/drivers/media/common/saa7146_core.c
index 168a8d3..8c755a1 100644
--- a/drivers/media/common/saa7146_core.c
+++ b/drivers/media/common/saa7146_core.c
@@ -306,9 +306,9 @@ static irqreturn_t interrupt_hw(int irq, void *dev_id)
return IRQ_NONE;
}
 
-   if( 0 != (dev-ext)) {
+   if( NULL != (dev-ext)) {
if( 0 != (dev-ext-irq_mask  isr )) {
-   if( 0 != dev-ext-irq_func ) {
+   if( NULL != dev-ext-irq_func ) {
dev-ext-irq_func(dev, isr);
}
isr = ~dev-ext-irq_mask;
@@ -316,13 +316,13 @@ static irqreturn_t interrupt_hw(int irq, void *dev_id)
}
if (0 != (isr  (MASK_27))) {
DEB_INT((irq: RPS0 (0x%08x).\n,isr));
-   if( 0 != dev-vv_data  0 != dev-vv_callback) {
+   if( NULL != dev-vv_data  NULL != dev-vv_callback) {
dev-vv_callback(dev,isr);
}
isr = ~MASK_27;
}
if (0 != (isr  (MASK_28))) {
-   if( 0 != dev-vv_data  0 != dev-vv_callback) {
+   if( NULL != dev-vv_data  NULL != dev-vv_callback) {
dev-vv_callback(dev,isr);
}
isr = ~MASK_28;
diff --git a/drivers/media/common/saa7146_fops.c 
b/drivers/media/common/saa7146_fops.c
index f0703d8..a73db79 100644
--- a/drivers/media/common/saa7146_fops.c
+++ b/drivers/media/common/saa7146_fops.c
@@ -272,7 +272,7 @@ static int fops_open(struct inode *inode, struct file *file)
 
result = 0;
 out:
-   if( fh != 0  result != 0 ) {
+   if( fh != NULL  result != 0 ) {
kfree(fh);
file-private_data = NULL;
}
-- 
1.5.4.2.200.g99e75



--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] capi: fix sparse warnings using integer as NULL pointer

2008-02-21 Thread Harvey Harrison
drivers/isdn/capi/kcapi.c:829:30: warning: Using plain integer as NULL pointer
drivers/isdn/capi/kcapi.c:838:27: warning: Using plain integer as NULL pointer
drivers/isdn/capi/kcapi.c:954:17: warning: Using plain integer as NULL pointer
drivers/isdn/capi/kcapi.c:1007:37: warning: Using plain integer as NULL pointer
drivers/isdn/capi/kcapi.c:1009:33: warning: Using plain integer as NULL pointer
drivers/isdn/capi/capiutil.c:453:24: warning: Using plain integer as NULL 
pointer
drivers/isdn/capi/capilib.c:47:30: warning: Using plain integer as NULL pointer
drivers/isdn/capi/capi.c:353:29: warning: Using plain integer as NULL pointer
drivers/isdn/capi/capi.c:369:15: warning: Using plain integer as NULL pointer
drivers/isdn/capi/capi.c:486:48: warning: Using plain integer as NULL pointer
drivers/isdn/capi/capi.c:515:46: warning: Using plain integer as NULL pointer
drivers/isdn/capi/capi.c:541:47: warning: Using plain integer as NULL pointer
drivers/isdn/capi/capi.c:692:47: warning: Using plain integer as NULL pointer
drivers/isdn/capi/capi.c:699:49: warning: Using plain integer as NULL pointer
drivers/isdn/capi/capi.c:704:14: warning: Using plain integer as NULL pointer
drivers/isdn/capi/capi.c:943:53: warning: Using plain integer as NULL pointer
drivers/isdn/capi/capi.c:948:32: warning: Using plain integer as NULL pointer
drivers/isdn/capi/capi.c:969:42: warning: Using plain integer as NULL pointer
drivers/isdn/capi/capi.c:989:48: warning: Using plain integer as NULL pointer
drivers/isdn/capi/capi.c:1026:69: warning: Using plain integer as NULL pointer
drivers/isdn/capi/capi.c:1028:19: warning: Using plain integer as NULL pointer
drivers/isdn/capi/capi.c:1061:20: warning: Using plain integer as NULL pointer
drivers/isdn/capi/capi.c:1529:37: warning: Using plain integer as NULL pointer
drivers/isdn/capi/capi.c:1531:33: warning: Using plain integer as NULL pointer
drivers/isdn/capi/capidrv.c:338:15: warning: Using plain integer as NULL pointer
drivers/isdn/capi/capidrv.c:758:32: warning: Using plain integer as NULL pointer
drivers/isdn/capi/capidrv.c:880:40: warning: Using plain integer as NULL pointer
drivers/isdn/capi/capidrv.c:407:15: warning: Using plain integer as NULL pointer
drivers/isdn/capi/capidrv.c:429:49: warning: Using plain integer as NULL pointer
drivers/isdn/capi/capidrv.c:407:15: warning: Using plain integer as NULL pointer
drivers/isdn/capi/capidrv.c:444:49: warning: Using plain integer as NULL pointer
drivers/isdn/capi/capidrv.c:429:49: warning: Using plain integer as NULL pointer
drivers/isdn/capi/capidrv.c:429:49: warning: Using plain integer as NULL pointer
drivers/isdn/capi/capidrv.c:429:49: warning: Using plain integer as NULL pointer
drivers/isdn/capi/capidrv.c:429:49: warning: Using plain integer as NULL pointer
drivers/isdn/capi/capidrv.c:429:49: warning: Using plain integer as NULL pointer
drivers/isdn/capi/capidrv.c:1664:61: warning: Using plain integer as NULL 
pointer
drivers/isdn/capi/capidrv.c:1969:37: warning: Using plain integer as NULL 
pointer
drivers/isdn/capi/capidrv.c:2294:37: warning: Using plain integer as NULL 
pointer
drivers/isdn/capi/capidrv.c:2297:33: warning: Using plain integer as NULL 
pointer
drivers/isdn/capi/capidrv.c:2338:37: warning: Using plain integer as NULL 
pointer
drivers/isdn/capi/capidrv.c:2341:33: warning: Using plain integer as NULL 
pointer
drivers/isdn/capi/capifs.c:192:37: warning: Using plain integer as NULL pointer
drivers/isdn/capi/capifs.c:194:33: warning: Using plain integer as NULL pointer

Signed-off-by: Harvey Harrison [EMAIL PROTECTED]
---
 drivers/isdn/capi/capi.c |   34 +-
 drivers/isdn/capi/capidrv.c  |   24 
 drivers/isdn/capi/capifs.c   |4 ++--
 drivers/isdn/capi/capilib.c  |2 +-
 drivers/isdn/capi/capiutil.c |2 +-
 drivers/isdn/capi/kcapi.c|   10 +-
 6 files changed, 38 insertions(+), 38 deletions(-)

diff --git a/drivers/isdn/capi/capi.c b/drivers/isdn/capi/capi.c
index 23ae66c..24c6b7c 100644
--- a/drivers/isdn/capi/capi.c
+++ b/drivers/isdn/capi/capi.c
@@ -350,7 +350,7 @@ static void capincci_free(struct capidev *cdev, u32 ncci)
if (ncci == 0x || np-ncci == ncci) {
*pp = (*pp)-next;
 #ifdef CONFIG_ISDN_CAPI_MIDDLEWARE
-   if ((mp = np-minorp) != 0) {
+   if ((mp = np-minorp) != NULL) {
 #if defined(CONFIG_ISDN_CAPI_CAPIFS) || defined(CONFIG_ISDN_CAPI_CAPIFS_MODULE)
capifs_free_ncci(mp-minor);
 #endif
@@ -366,7 +366,7 @@ static void capincci_free(struct capidev *cdev, u32 ncci)
}
 #endif /* CONFIG_ISDN_CAPI_MIDDLEWARE */
kfree(np);
-   if (*pp == 0) return;
+   if (*pp == NULL) return;
} else {
pp = (*pp)-next;
}
@@ -483,7 +483,7 @@ static int handle_recv_skb(struct capiminor *mp

[PATCH] avm: fix sparse warning using integer as NULL pointer

2008-02-21 Thread Harvey Harrison
drivers/isdn/hardware/avm/b1isa.c:206:37: warning: Using plain integer as NULL 
pointer
drivers/isdn/hardware/avm/b1isa.c:208:33: warning: Using plain integer as NULL 
pointer
drivers/isdn/hardware/avm/b1.c:664:42: warning: Using plain integer as NULL 
pointer
drivers/isdn/hardware/avm/b1.c:666:44: warning: Using plain integer as NULL 
pointer
drivers/isdn/hardware/avm/b1.c:668:42: warning: Using plain integer as NULL 
pointer
drivers/isdn/hardware/avm/b1.c:791:37: warning: Using plain integer as NULL 
pointer
drivers/isdn/hardware/avm/b1.c:793:33: warning: Using plain integer as NULL 
pointer
drivers/isdn/hardware/avm/b1pci.c:385:37: warning: Using plain integer as NULL 
pointer
drivers/isdn/hardware/avm/b1pci.c:387:33: warning: Using plain integer as NULL 
pointer
drivers/isdn/hardware/avm/b1dma.c:886:42: warning: Using plain integer as NULL 
pointer
drivers/isdn/hardware/avm/b1dma.c:888:44: warning: Using plain integer as NULL 
pointer
drivers/isdn/hardware/avm/b1dma.c:890:42: warning: Using plain integer as NULL 
pointer
drivers/isdn/hardware/avm/b1dma.c:973:37: warning: Using plain integer as NULL 
pointer
drivers/isdn/hardware/avm/b1dma.c:975:33: warning: Using plain integer as NULL 
pointer
drivers/isdn/hardware/avm/b1pcmcia.c:204:37: warning: Using plain integer as 
NULL pointer
drivers/isdn/hardware/avm/b1pcmcia.c:206:33: warning: Using plain integer as 
NULL pointer
drivers/isdn/hardware/avm/t1isa.c:554:37: warning: Using plain integer as NULL 
pointer
drivers/isdn/hardware/avm/t1isa.c:556:33: warning: Using plain integer as NULL 
pointer
drivers/isdn/hardware/avm/t1pci.c:236:37: warning: Using plain integer as NULL 
pointer
drivers/isdn/hardware/avm/t1pci.c:238:33: warning: Using plain integer as NULL 
pointer
drivers/isdn/hardware/avm/c4.c:1091:42: warning: Using plain integer as NULL 
pointer
drivers/isdn/hardware/avm/c4.c:1093:44: warning: Using plain integer as NULL 
pointer
drivers/isdn/hardware/avm/c4.c:1095:42: warning: Using plain integer as NULL 
pointer
drivers/isdn/hardware/avm/c4.c:1170:21: warning: Using plain integer as NULL 
pointer
drivers/isdn/hardware/avm/c4.c:1294:37: warning: Using plain integer as NULL 
pointer
drivers/isdn/hardware/avm/c4.c:1296:33: warning: Using plain integer as NULL 
pointer

Signed-off-by: Harvey Harrison [EMAIL PROTECTED]
---
 drivers/isdn/hardware/avm/b1.c   |   10 +-
 drivers/isdn/hardware/avm/b1dma.c|   10 +-
 drivers/isdn/hardware/avm/b1isa.c|4 ++--
 drivers/isdn/hardware/avm/b1pci.c|4 ++--
 drivers/isdn/hardware/avm/b1pcmcia.c |4 ++--
 drivers/isdn/hardware/avm/c4.c   |   12 ++--
 drivers/isdn/hardware/avm/t1isa.c|4 ++--
 drivers/isdn/hardware/avm/t1pci.c|4 ++--
 8 files changed, 26 insertions(+), 26 deletions(-)

diff --git a/drivers/isdn/hardware/avm/b1.c b/drivers/isdn/hardware/avm/b1.c
index 4484a64..abf05ec 100644
--- a/drivers/isdn/hardware/avm/b1.c
+++ b/drivers/isdn/hardware/avm/b1.c
@@ -661,11 +661,11 @@ int b1ctl_read_proc(char *page, char **start, off_t off,
len += sprintf(page+len, %-16s %s\n, type, s);
if (card-cardtype == avm_t1isa)
   len += sprintf(page+len, %-16s %d\n, cardnr, card-cardnr);
-   if ((s = cinfo-version[VER_DRIVER]) != 0)
+   if ((s = cinfo-version[VER_DRIVER]) != NULL)
   len += sprintf(page+len, %-16s %s\n, ver_driver, s);
-   if ((s = cinfo-version[VER_CARDTYPE]) != 0)
+   if ((s = cinfo-version[VER_CARDTYPE]) != NULL)
   len += sprintf(page+len, %-16s %s\n, ver_cardtype, s);
-   if ((s = cinfo-version[VER_SERIAL]) != 0)
+   if ((s = cinfo-version[VER_SERIAL]) != NULL)
   len += sprintf(page+len, %-16s %s\n, ver_serial, s);
 
if (card-cardtype != avm_m1) {
@@ -788,9 +788,9 @@ static int __init b1_init(void)
char *p;
char rev[32];
 
-   if ((p = strchr(revision, ':')) != 0  p[1]) {
+   if ((p = strchr(revision, ':')) != NULL  p[1]) {
strlcpy(rev, p + 2, 32);
-   if ((p = strchr(rev, '$')) != 0  p  rev)
+   if ((p = strchr(rev, '$')) != NULL  p  rev)
   *(p-1) = 0;
} else
strcpy(rev, 1.0);
diff --git a/drivers/isdn/hardware/avm/b1dma.c 
b/drivers/isdn/hardware/avm/b1dma.c
index 669f6f6..da34b98 100644
--- a/drivers/isdn/hardware/avm/b1dma.c
+++ b/drivers/isdn/hardware/avm/b1dma.c
@@ -883,11 +883,11 @@ int b1dmactl_read_proc(char *page, char **start, off_t 
off,
default: s = ???; break;
}
len += sprintf(page+len, %-16s %s\n, type, s);
-   if ((s = cinfo-version[VER_DRIVER]) != 0)
+   if ((s = cinfo-version[VER_DRIVER]) != NULL)
   len += sprintf(page+len, %-16s %s\n, ver_driver, s);
-   if ((s = cinfo-version[VER_CARDTYPE]) != 0)
+   if ((s = cinfo-version[VER_CARDTYPE]) != NULL)
   len += sprintf(page+len, %-16s %s\n, ver_cardtype, s);
-   if ((s = cinfo-version[VER_SERIAL]) != 0)
+   if ((s = cinfo

[PATCH] eicon: fix sparse integer as NULL pointer warnings

2008-02-21 Thread Harvey Harrison
drivers/isdn/hardware/eicon/message.c:745:47: warning: Using plain integer as 
NULL pointer
drivers/isdn/hardware/eicon/message.c:761:45: warning: Using plain integer as 
NULL pointer
drivers/isdn/hardware/eicon/message.c:9122:16: warning: Using plain integer as 
NULL pointer
drivers/isdn/hardware/eicon/message.c:9147:16: warning: Using plain integer as 
NULL pointer
drivers/isdn/hardware/eicon/message.c:9173:14: warning: Using plain integer as 
NULL pointer
drivers/isdn/hardware/eicon/divasmain.c:396:23: warning: Using plain integer as 
NULL pointer

Signed-off-by: Harvey Harrison [EMAIL PROTECTED]
---
 drivers/isdn/hardware/eicon/divasmain.c |2 +-
 drivers/isdn/hardware/eicon/message.c   |   12 ++--
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/isdn/hardware/eicon/divasmain.c 
b/drivers/isdn/hardware/eicon/divasmain.c
index 6d39f93..5fcbdcc 100644
--- a/drivers/isdn/hardware/eicon/divasmain.c
+++ b/drivers/isdn/hardware/eicon/divasmain.c
@@ -393,7 +393,7 @@ void diva_free_dma_map(void *hdev, struct 
_diva_dma_map_entry *pmap)
dma_addr_t dma_handle;
void *addr_handle;
 
-   for (i = 0; (pmap != 0); i++) {
+   for (i = 0; (pmap != NULL); i++) {
diva_get_dma_map_entry(pmap, i, cpu_addr, phys_addr);
if (!cpu_addr) {
break;
diff --git a/drivers/isdn/hardware/eicon/message.c 
b/drivers/isdn/hardware/eicon/message.c
index 1ff98e7..599fed8 100644
--- a/drivers/isdn/hardware/eicon/message.c
+++ b/drivers/isdn/hardware/eicon/message.c
@@ -742,7 +742,7 @@ static void start_internal_command (dword Id, PLCI   *plci, 
t_std_internal_comma
   else
   {
 i = 1;
-while (plci-internal_command_queue[i] != 0)
+while (plci-internal_command_queue[i] != NULL)
   i++;
 plci-internal_command_queue[i] = command_function;
   }
@@ -758,7 +758,7 @@ static void next_internal_command (dword Id, PLCI   *plci)
 
   plci-internal_command = 0;
   plci-internal_command_queue[0] = NULL;
-  while (plci-internal_command_queue[1] != 0)
+  while (plci-internal_command_queue[1] != NULL)
   {
 for (i = 0; i  MAX_INTERNAL_COMMAND_LEVELS - 1; i++)
   plci-internal_command_queue[i] = plci-internal_command_queue[i+1];
@@ -9119,7 +9119,7 @@ word AdvCodecSupport(DIVA_CAPI_ADAPTER   *a, PLCI   
*plci, APPL   *appl, byte ho
 dbug(1,dprintf(AdvSigPlci=0x%x,a-AdvSignalPLCI));
 return 0x2001; /* codec in use by another application */
   }
-  if(plci!=0)
+  if(plci!=NULL)
   {
 a-AdvSignalPLCI = plci;
 plci-tel=ADV_VOICE;
@@ -9144,7 +9144,7 @@ word AdvCodecSupport(DIVA_CAPI_ADAPTER   *a, PLCI   
*plci, APPL   *appl, byte ho
 }
/* indicate D-ch connect if  */
   }/* codec is connected OK */
-  if(plci!=0)
+  if(plci!=NULL)
   {
 a-AdvSignalPLCI = plci;
 plci-tel=ADV_VOICE;
@@ -9170,7 +9170,7 @@ word AdvCodecSupport(DIVA_CAPI_ADAPTER   *a, PLCI   
*plci, APPL   *appl, byte ho
   {
 if(hook_listen) return 0x300B;   /* Facility not supported */
  /* no hook with SCOM  */
-if(plci!=0) plci-tel = CODEC;
+if(plci!=NULL) plci-tel = CODEC;
 dbug(1,dprintf(S/SCOM codec));
 /* first time we use the scom-s codec we must shut down the internal   */
 /* handset application of the card. This can be done by an assign with */
@@ -14604,7 +14604,7 @@ static void channel_xmit_extended_xon (PLCI   * plci) {
   int max_ch = ARRAY_SIZE(a-ch_flow_control);
   int i, one_requested = 0;
 
-  if ((!plci) || (!plci-Id) || ((a = plci-adapter) == 0)) {
+  if ((!plci) || (!plci-Id) || ((a = plci-adapter) == NULL)) {
 return;
   }
 
-- 
1.5.4.2.200.g99e75



--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] mac80211: check endianness/types in sparse runs

2008-02-21 Thread Harvey Harrison
On Thu, 2008-02-21 at 13:42 +0100, Johannes Berg wrote:
  [patch doing CHECKFLAGS += -D__CHECK_ENDIAN__ in the
  net/mac80211/Makefile]
 
  I would prefer it to be kernel wide enabled.
  Tried a defconfig build.
 
 Hm. I tend to think there was a reason for this, since this is actually
 explicitly disabled by include/linux/types.h:
 
 #ifdef __CHECKER__
 #define __bitwise__ __attribute__((bitwise))
 #else 
 #define __bitwise__
 #endif
 
 #ifdef __CHECK_ENDIAN__
 #define __bitwise __bitwise__
 #else
 #define __bitwise
 #endif
 

This seems somewhat suspect.

 I recently ran sparse on my config and was surprised by the number of
 warnings. Then again, something in mmzone.h or so generated billions of
 them...

Potentially expensive pointer subtraction 640:

Patch in -mm.

 
 In any case, I would love to have __CHECK_ENDIAN__ enabled by default at
 least on the wireless code (just caught another bug with it...)
 

I'd love to have it too, but there are so many trivial warnings that
clutter up valid warnings that it is prohibitive.  I'm working on
reducing the noise level a bit for 2.6.26, we'll see about turning
it on then.

Harvey

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] mac80211: check endianness/types in sparse runs

2008-02-21 Thread Harvey Harrison
On Thu, 2008-02-21 at 21:09 +0100, Johannes Berg wrote:
   In any case, I would love to have __CHECK_ENDIAN__ enabled by default at
   least on the wireless code (just caught another bug with it...)
  
  I should then add support for something like:
  
  checkflags-y := -D__CHECK_ENDIAN__
  
  to match the style of the rest.
  
  I do not like all the buried in assumption about the
  global variables.
 
 That might be good. I retract my patch for now then.
 
  But I would prefer that someone would spend a few days looking into the
  warnings generated with sparse.
 
 I did spend a bit of time running it on all the tree, but wireless,
 where I do most work, is clean. 

Clean, or did you specifically mean bitwise-clean?

drivers/net/wireless/ipw2100.c:2837:7: warning: symbol 'i' shadows an earlier 
one
drivers/net/wireless/ipw2100.c:2760:9: originally declared here
drivers/net/wireless/ipw2100.c:7873:15: warning: symbol 'mode' shadows an 
earlier one
drivers/net/wireless/ipw2100.c:187:12: originally declared here
drivers/net/wireless/ipw2100.c:7937:11: warning: symbol 'mode' shadows an 
earlier one
drivers/net/wireless/ipw2100.c:187:12: originally declared here
drivers/net/wireless/ipw2100.c:7985:11: warning: symbol 'mode' shadows an 
earlier one
drivers/net/wireless/ipw2100.c:187:12: originally declared here
drivers/net/wireless/ipw2100.c:8253:13: warning: symbol '_x' shadows an earlier 
one
drivers/net/wireless/ipw2100.c:8253:13: originally declared here
drivers/net/wireless/ipw2100.c:8253:13: warning: symbol '_x' shadows an earlier 
one
drivers/net/wireless/ipw2100.c:8253:13: originally declared here
drivers/net/wireless/ipw2100.c:8253:13: warning: symbol '_y' shadows an earlier 
one
drivers/net/wireless/ipw2100.c:8253:13: originally declared here
drivers/net/wireless/ipw2100.c:1929:15: warning: incorrect type in argument 4 
(different signedness)
drivers/net/wireless/ipw2100.c:1929:15:expected unsigned int [usertype] *len
drivers/net/wireless/ipw2100.c:1929:15:got int *noident
drivers/net/wireless/ipw2100.c:1937:69: warning: incorrect type in argument 4 
(different signedness)
drivers/net/wireless/ipw2100.c:1937:69:expected unsigned int [usertype] *len
drivers/net/wireless/ipw2100.c:1937:69:got int *noident
drivers/net/wireless/ipw2100.c:1945:60: warning: incorrect type in argument 4 
(different signedness)
drivers/net/wireless/ipw2100.c:1945:60:expected unsigned int [usertype] *len
drivers/net/wireless/ipw2100.c:1945:60:got int *noident
drivers/net/wireless/ipw2100.c:1952:65: warning: incorrect type in argument 4 
(different signedness)
drivers/net/wireless/ipw2100.c:1952:65:expected unsigned int [usertype] *len
drivers/net/wireless/ipw2100.c:1952:65:got int *noident
drivers/net/wireless/ipw2100.c:4071:66: warning: incorrect type in argument 4 
(different signedness)
drivers/net/wireless/ipw2100.c:4071:66:expected unsigned int [usertype] *len
drivers/net/wireless/ipw2100.c:4071:66:got int *noident
drivers/net/wireless/ipw2100.c:4078:15: warning: incorrect type in argument 4 
(different signedness)
drivers/net/wireless/ipw2100.c:4078:15:expected unsigned int [usertype] *len
drivers/net/wireless/ipw2100.c:4078:15:got int *noident
drivers/net/wireless/ipw2100.c:4084:60: warning: incorrect type in argument 4 
(different signedness)
drivers/net/wireless/ipw2100.c:4084:60:expected unsigned int [usertype] *len
drivers/net/wireless/ipw2100.c:4084:60:got int *noident
drivers/net/wireless/ipw2100.c:5275:6: warning: symbol 
'ipw2100_queues_initialize' was not declared. Should it be static?
drivers/net/wireless/ipw2100.c:5282:6: warning: symbol 'ipw2100_queues_free' 
was not declared. Should it be static?
drivers/net/wireless/ipw2100.c:5289:5: warning: symbol 
'ipw2100_queues_allocate' was not declared. Should it be static?
drivers/net/wireless/ipw2100.c:7146:66: warning: incorrect type in argument 4 
(different signedness)
drivers/net/wireless/ipw2100.c:7146:66:expected unsigned int [usertype] *len
drivers/net/wireless/ipw2100.c:7146:66:got int *noident
drivers/net/wireless/ipw2100.c:8322:20: warning: incorrect type in argument 4 
(different signedness)
drivers/net/wireless/ipw2100.c:8322:20:expected unsigned int [usertype] *len
drivers/net/wireless/ipw2100.c:8322:20:got int *noident
drivers/net/wireless/ipw2200.c:833:6: warning: symbol 'led' shadows an earlier 
one
drivers/net/wireless/ipw2200.c:93:12: originally declared here
drivers/net/wireless/ipw2200.c:877:6: warning: symbol 'led' shadows an earlier 
one
drivers/net/wireless/ipw2200.c:93:12: originally declared here
drivers/net/wireless/ipw2200.c:921:6: warning: symbol 'led' shadows an earlier 
one
drivers/net/wireless/ipw2200.c:93:12: originally declared here
drivers/net/wireless/ipw2200.c:966:6: warning: symbol 'led' shadows an earlier 
one
drivers/net/wireless/ipw2200.c:93:12: originally declared here
drivers/net/wireless/ipw2200.c:1002:6: warning: symbol 'led' shadows an earlier 

Re: [PATCH] mac80211: check endianness/types in sparse runs

2008-02-21 Thread Harvey Harrison
On Thu, 2008-02-21 at 21:29 +0100, Johannes Berg wrote:
  Clean, or did you specifically mean bitwise-clean?
 
 bitwise-clean. But I don't do full-mac drivers so most of what you quote
 I don't compile, and the mac80211-based drivers only have few problems.
 

This wasn't meant as any sort of slight, actually I completely agree
that the current warning level means real stuff gets missed.

I've knocked off about a thousand lines from an X86_32 allyesconfig
sparse run this week, but the fruit is starting to get harder to reach.

Harvey

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] saa7146: fix sparse warnings

2008-02-21 Thread Harvey Harrison
On Thu, 2008-02-21 at 21:19 +, Al Viro wrote:
 On Thu, Feb 21, 2008 at 09:52:36AM -0800, Harvey Harrison wrote:
 
 Could you please use more descriptive names?  NULL noise removal
 is not the same as shadowing or endianness annotations or endianness
 fixes or __user/__iomem annotations/fixes, etc.

Point taken, will do so going forward.

For now, I'm just doing the trivial ones to make the more interesting
warnings stand out a little better.

Harvey

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: linux-next: first tree

2008-02-21 Thread Harvey Harrison
On Thu, 2008-02-21 at 16:12 -0800, Randy Dunlap wrote:
 Frank Seidel wrote:
  Randy Dunlap wrote:
  I'd like to see tarballs too, please...
  
  Hi, i'll provide tars of the current linux-next tree reachable
  via my http://linux-next.f-seidel.de wiki (Tar Downloads).
  Is that what you were looking for?
 
 Looks close.  It needs to be scriptable (not just a dynamically generated
 link) and have predictable names.  As long as those are true, then it
 should be great.
 



// add the next git repo as a tracked remote
git remote add next 
git://git.kernel.org/pub/scm/linux/kernel/git/sfr/linux-next.git
// fetch any objects you don't have
// run this whenever you want to check for more objects
git remote update
// produce a tarball of the tree tagged next-20080220
git archive --format=tar next-20080220  next-20080220.tar

Cheers,

Harvey



--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


acpi: new sparse warnings in 2.6.25-rc2

2008-02-20 Thread Harvey Harrison
Introduced between 2.6.25-rc1 and -rc2.

drivers/acpi/executer/exregion.c:369:8: warning: incorrect type in argument 3 
(different type sizes)
drivers/acpi/executer/exregion.c:369:8:expected unsigned int [usertype] 
*value
drivers/acpi/executer/exregion.c:369:8:got unsigned long long [usertype] 
*value
drivers/acpi/executer/exregion.c: In function 
‘acpi_ex_pci_config_space_handler’:
drivers/acpi/executer/exregion.c:369: warning: passing argument 3 of 
‘acpi_os_read_pci_configuration’ from incompatible pointer type

Cheers,

Harvey

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] markers: fix sparse warnings in markers.c

2008-02-20 Thread Harvey Harrison
char can be unsigned
kernel/marker.c:64:20: error: dubious one-bit signed bitfield
kernel/marker.c:65:14: error: dubious one-bit signed bitfield

Signed-off-by: Harvey Harrison <[EMAIL PROTECTED]>
---
Introduced between -rc1 and -rc2
 kernel/marker.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/marker.c b/kernel/marker.c
index c4c2cd8..50effc0 100644
--- a/kernel/marker.c
+++ b/kernel/marker.c
@@ -61,8 +61,8 @@ struct marker_entry {
int refcount;   /* Number of times armed. 0 if disarmed. */
struct rcu_head rcu;
void *oldptr;
-   char rcu_pending:1;
-   char ptype:1;
+   unsigned char rcu_pending:1;
+   unsigned char ptype:1;
char name[0];   /* Contains name'\0'format'\0' */
 };
 
-- 
1.5.4.2.200.g99e75



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/2] moxa: make functions static

2008-02-20 Thread Harvey Harrison
On Thu, 2008-02-21 at 00:12 +0100, Jiri Slaby wrote:
> On 02/20/2008 11:14 PM, Harvey Harrison wrote:
> > All were forward declared static already.
> > 
> Thanks, but I have similar fixes for both issues you address in my tree. I'll 
> post it in few days.

Great.

Harvey

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: sparse - make __CHECK_ENDIAN__ default enabled?

2008-02-20 Thread Harvey Harrison
On Wed, 2008-02-20 at 23:03 +0100, Sam Ravnborg wrote:
> Hi Harvey.
> 
> Can I ask you to look into the worst offenders so we
> can make -D__CHECK_ENDIAN__ enabled per default
> in the kernel.
> Or maybe we should do it anyway?

>From a quick test, the same places that spew sparse warnings, spew
lots more sparse warnings, the places that are not so badare not
so bad afterwards either.

There's still so many of the trivial warnings that maybe it's not the
right time for this yet.  Ask me again when we get to the 2.6.26
timeframe, we'll see how many I've gotten rid of by then.

Harvey


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: sparse - make __CHECK_ENDIAN__ default enabled?

2008-02-20 Thread Harvey Harrison
On Wed, 2008-02-20 at 23:03 +0100, Sam Ravnborg wrote:
> Hi Harvey.
> 
> Can I ask you to look into the worst offenders so we
> can make -D__CHECK_ENDIAN__ enabled per default
> in the kernel.
> Or maybe we should do it anyway?

Well, I've got the worst of fs and drivers/ata done so far, still
weeping over the 5500 warnings in drivers. (X86_32 allyesconfig).
People ignore the existing warnings anyway, why not toss a few more
on the pile?

I'll look them over tonight and see how bad it would be.


> I made a quick test-run with a x86 64 bit defconfig.
> My first thought was that this was just really bad
> because the amount of warnings roughly doubled.
> 
> But then inspecting it a little closer I could see
> that 8 files had an increase of > 100 additional
> warnings when we enabled __CHECK_ENDIAN__ and
> that smells like easy targets to bring down the noise.
> 
> I did not dare do it for an allyesconfig run - I 
> am not that brave.

Well, I'm just going through the _trivial_ ones first to try and cut
the noise down a bit.  I think with all the patches I have out there
I've cut a little over 1000 lines off an allyesconfig build on X86_32
so far.


Harvey

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 2/2] moxa: fix sparse warnings

2008-02-20 Thread Harvey Harrison
drivers/char/moxa.c:873:26: warning: Using plain integer as NULL pointer
drivers/char/moxa.c:2037:49: warning: Using plain integer as NULL pointer

Signed-off-by: Harvey Harrison <[EMAIL PROTECTED]>
---
 drivers/char/moxa.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/char/moxa.c b/drivers/char/moxa.c
index 75c957f..d7e4aa7 100644
--- a/drivers/char/moxa.c
+++ b/drivers/char/moxa.c
@@ -870,7 +870,7 @@ static void moxa_poll(unsigned long ignored)
if (!(ch->statusflags & THROTTLE) &&
(MoxaPortRxQueue(ch->port) > 0))
moxa_receive_data(ch);
-   if ((tp = ch->tty) == 0)
+   if ((tp = ch->tty) == NULL)
continue;
if (ch->statusflags & LOWWAIT) {
if (MoxaPortTxQueue(ch->port) <= WAKEUP_CHARS) {
@@ -2034,7 +2034,7 @@ static int MoxaPortSetTermio(int port, struct ktermios 
*termio, speed_t baud)
tcflag_t cflag;
tcflag_t mode = 0;
 
-   if (moxa_ports[port].chkPort == 0 || termio == 0)
+   if (moxa_ports[port].chkPort == 0 || termio == NULL)
return (-1);
ofsAddr = moxa_ports[port].tableAddr;
cflag = termio->c_cflag;/* termio->c_cflag */
-- 
1.5.4.2.200.g99e75

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/2] moxa: make functions static

2008-02-20 Thread Harvey Harrison
All were forward declared static already.

Fixes sparse warnings:
drivers/char/moxa.c:1421:6: warning: symbol 'MoxaDriverInit' was not declared. 
Should it be static?
drivers/char/moxa.c:1464:6: warning: symbol 'MoxaPortFlushData' was not 
declared. Should it be static?
drivers/char/moxa.c:1477:5: warning: symbol 'MoxaDriverIoctl' was not declared. 
Should it be static?
drivers/char/moxa.c:1604:5: warning: symbol 'MoxaDriverPoll' was not declared. 
Should it be static?
drivers/char/moxa.c:1667:5: warning: symbol 'MoxaPortsOfCard' was not declared. 
Should it be static?
drivers/char/moxa.c:1954:5: warning: symbol 'MoxaPortIsValid' was not declared. 
Should it be static?
drivers/char/moxa.c:1964:6: warning: symbol 'MoxaPortEnable' was not declared. 
Should it be static?
drivers/char/moxa.c:1987:6: warning: symbol 'MoxaPortDisable' was not declared. 
Should it be static?
drivers/char/moxa.c:1997:6: warning: symbol 'MoxaPortGetMaxBaud' was not 
declared. Should it be static?
drivers/char/moxa.c:2007:6: warning: symbol 'MoxaPortSetBaud' was not declared. 
Should it be static?
drivers/char/moxa.c:2031:5: warning: symbol 'MoxaPortSetTermio' was not 
declared. Should it be static?
drivers/char/moxa.c:2087:5: warning: symbol 'MoxaPortGetLineOut' was not 
declared. Should it be static?
drivers/char/moxa.c:2107:6: warning: symbol 'MoxaPortLineCtrl' was not 
declared. Should it be static?
drivers/char/moxa.c:2122:6: warning: symbol 'MoxaPortFlowCtrl' was not 
declared. Should it be static?
drivers/char/moxa.c:2142:5: warning: symbol 'MoxaPortLineStatus' was not 
declared. Should it be static?
drivers/char/moxa.c:2168:5: warning: symbol 'MoxaPortDCDChange' was not 
declared. Should it be static?
drivers/char/moxa.c:2180:5: warning: symbol 'MoxaPortDCDON' was not declared. 
Should it be static?
drivers/char/moxa.c:2193:5: warning: symbol 'MoxaPortWriteData' was not 
declared. Should it be static?
drivers/char/moxa.c:2257:5: warning: symbol 'MoxaPortReadData' was not 
declared. Should it be static?
drivers/char/moxa.c:2327:5: warning: symbol 'MoxaPortTxQueue' was not declared. 
Should it be static?
drivers/char/moxa.c:2341:5: warning: symbol 'MoxaPortTxFree' was not declared. 
Should it be static?
drivers/char/moxa.c:2355:5: warning: symbol 'MoxaPortRxQueue' was not declared. 
Should it be static?
drivers/char/moxa.c:2370:6: warning: symbol 'MoxaPortTxDisable' was not 
declared. Should it be static?
drivers/char/moxa.c:2378:6: warning: symbol 'MoxaPortTxEnable' was not 
declared. Should it be static?
drivers/char/moxa.c:2387:5: warning: symbol 'MoxaPortResetBrkCnt' was not 
declared. Should it be static?
drivers/char/moxa.c:2396:6: warning: symbol 'MoxaPortSendBreak' was not 
declared. Should it be static?

Signed-off-by: Harvey Harrison <[EMAIL PROTECTED]>
---
 drivers/char/moxa.c |   52 +-
 1 files changed, 26 insertions(+), 26 deletions(-)

diff --git a/drivers/char/moxa.c b/drivers/char/moxa.c
index 64b7b2b..75c957f 100644
--- a/drivers/char/moxa.c
+++ b/drivers/char/moxa.c
@@ -1418,7 +1418,7 @@ static int moxaloadc320(int, void __iomem *, int, int *);
  * 2. MoxaDriverIoctl(unsigned int cmd, unsigned long arg, int port);   *
  * 3. MoxaDriverPoll(void); *
  */
-void MoxaDriverInit(void)
+static void MoxaDriverInit(void)
 {
struct moxa_port *p;
unsigned int i;
@@ -1461,7 +1461,7 @@ struct dl_str {
 
 static struct dl_str dltmp;
 
-void MoxaPortFlushData(int port, int mode)
+static void MoxaPortFlushData(int port, int mode)
 {
void __iomem *ofsAddr;
if ((mode < 0) || (mode > 2))
@@ -1474,7 +1474,7 @@ void MoxaPortFlushData(int port, int mode)
}
 }
 
-int MoxaDriverIoctl(unsigned int cmd, unsigned long arg, int port)
+static int MoxaDriverIoctl(unsigned int cmd, unsigned long arg, int port)
 {
int i;
int status;
@@ -1601,7 +1601,7 @@ copy:
}
 }
 
-int MoxaDriverPoll(void)
+static int MoxaDriverPoll(void)
 {
struct moxa_board_conf *brd;
register ushort temp;
@@ -1664,7 +1664,7 @@ int MoxaDriverPoll(void)
  * Card level function: *
  * 1. MoxaPortsOfCard(int cardno);  *
  */
-int MoxaPortsOfCard(int cardno)
+static int MoxaPortsOfCard(int cardno)
 {
 
if (moxa_boards[cardno].boardType == 0)
@@ -1951,7 +1951,7 @@ int MoxaPortsOfCard(int cardno)
  *send out a about 250 ms BREAK signal.
  *
  */
-int MoxaPortIsValid(int port)
+static int MoxaPortIsValid(int port)
 {
 
if (moxaCard == 0)
@@ -1961,7 +1961,7 @@ int MoxaPortIsValid(int port)
return (1);
 }
 
-void MoxaPortEnable(int port)
+static void MoxaPortEnable(int port)
 {

[PATCH] char: make functions static in synclinkmp.c

2008-02-20 Thread Harvey Harrison
/synclinkmp.c:5270:5: warning: symbol 'loopback_test' was not 
declared. Should it be static?
drivers/char/synclinkmp.c:5335:5: warning: symbol 'adapter_test' was not 
declared. Should it be static?
drivers/char/synclinkmp.c:5397:5: warning: symbol 'memory_test' was not 
declared. Should it be static?
drivers/char/synclinkmp.c:5449:6: warning: symbol 'load_pci_memory' was not 
declared. Should it be static?
drivers/char/synclinkmp.c:5468:6: warning: symbol 'trace_block' was not 
declared. Should it be static?
drivers/char/synclinkmp.c:5503:6: warning: symbol 'tx_timeout' was not 
declared. Should it be static?
drivers/char/synclinkmp.c:5530:6: warning: symbol 'status_timeout' was not 
declared. Should it be static?
drivers/char/synclinkmp.c:5581:15: warning: symbol 'read_reg' was not declared. 
Should it be static?
drivers/char/synclinkmp.c:5586:6: warning: symbol 'write_reg' was not declared. 
Should it be static?
drivers/char/synclinkmp.c:5592:5: warning: symbol 'read_reg16' was not 
declared. Should it be static?
drivers/char/synclinkmp.c:5598:6: warning: symbol 'write_reg16' was not 
declared. Should it be static?
drivers/char/synclinkmp.c:5604:15: warning: symbol 'read_status_reg' was not 
declared. Should it be static?
drivers/char/synclinkmp.c:5610:6: warning: symbol 'write_control_reg' was not 
declared. Should it be static?

Signed-off-by: Harvey Harrison <[EMAIL PROTECTED]>
---
 drivers/char/synclinkmp.c |  120 ++--
 1 files changed, 60 insertions(+), 60 deletions(-)

diff --git a/drivers/char/synclinkmp.c b/drivers/char/synclinkmp.c
index f3e7807..c662810 100644
--- a/drivers/char/synclinkmp.c
+++ b/drivers/char/synclinkmp.c
@@ -1473,7 +1473,7 @@ static inline int line_info(char *buf, SLMP_INFO *info)
 
 /* Called to print information about devices
  */
-int read_proc(char *page, char **start, off_t off, int count,
+static int read_proc(char *page, char **start, off_t off, int count,
  int *eof, void *data)
 {
int len = 0, l;
@@ -2024,7 +2024,7 @@ static void hdlcdev_exit(SLMP_INFO *info)
 /* Return next bottom half action to perform.
  * Return Value:   BH action code or 0 if nothing to do.
  */
-int bh_action(SLMP_INFO *info)
+static int bh_action(SLMP_INFO *info)
 {
unsigned long flags;
int rc = 0;
@@ -2055,7 +2055,7 @@ int bh_action(SLMP_INFO *info)
 
 /* Perform bottom half processing of work items queued by ISR.
  */
-void bh_handler(struct work_struct *work)
+static void bh_handler(struct work_struct *work)
 {
SLMP_INFO *info = container_of(work, SLMP_INFO, task);
int action;
@@ -2100,7 +2100,7 @@ void bh_handler(struct work_struct *work)
__FILE__,__LINE__,info->device_name);
 }
 
-void bh_receive(SLMP_INFO *info)
+static void bh_receive(SLMP_INFO *info)
 {
if ( debug_level >= DEBUG_LEVEL_BH )
printk( "%s(%d):%s bh_receive()\n",
@@ -2109,7 +2109,7 @@ void bh_receive(SLMP_INFO *info)
while( rx_get_frame(info) );
 }
 
-void bh_transmit(SLMP_INFO *info)
+static void bh_transmit(SLMP_INFO *info)
 {
struct tty_struct *tty = info->tty;
 
@@ -2121,7 +2121,7 @@ void bh_transmit(SLMP_INFO *info)
tty_wakeup(tty);
 }
 
-void bh_status(SLMP_INFO *info)
+static void bh_status(SLMP_INFO *info)
 {
if ( debug_level >= DEBUG_LEVEL_BH )
printk( "%s(%d):%s bh_status() entry\n",
@@ -2133,7 +2133,7 @@ void bh_status(SLMP_INFO *info)
info->cts_chkcount = 0;
 }
 
-void isr_timer(SLMP_INFO * info)
+static void isr_timer(SLMP_INFO * info)
 {
unsigned char timer = (info->port_num & 1) ? TIMER2 : TIMER0;
 
@@ -2159,7 +2159,7 @@ void isr_timer(SLMP_INFO * info)
__FILE__,__LINE__,info->device_name);
 }
 
-void isr_rxint(SLMP_INFO * info)
+static void isr_rxint(SLMP_INFO * info)
 {
struct tty_struct *tty = info->tty;
struct  mgsl_icount *icount = >icount;
@@ -2218,7 +2218,7 @@ void isr_rxint(SLMP_INFO * info)
 /*
  * handle async rx data interrupts
  */
-void isr_rxrdy(SLMP_INFO * info)
+static void isr_rxrdy(SLMP_INFO * info)
 {
u16 status;
unsigned char DataByte;
@@ -2348,7 +2348,7 @@ static void isr_txeom(SLMP_INFO * info, unsigned char 
status)
 /*
  * handle tx status interrupts
  */
-void isr_txint(SLMP_INFO * info)
+static void isr_txint(SLMP_INFO * info)
 {
unsigned char status = read_reg(info, SR1) & info->ie1_value & (UDRN + 
IDLE + CCTS);
 
@@ -2376,7 +2376,7 @@ void isr_txint(SLMP_INFO * info)
 /*
  * handle async tx data interrupts
  */
-void isr_txrdy(SLMP_INFO * info)
+static void isr_txrdy(SLMP_INFO * info)
 {
if ( debug_level >= DEBUG_LEVEL_ISR )
printk("%s(%d):%s isr_txrdy() tx_count=%d\n",
@@ -2407,7 +2407,7 @@ void isr_txrdy(SLMP_INFO * info)
info->pending_bh |= BH_TRANSMIT;
 }
 
-void isr_rxdmaok(SLMP_I

[PATCH] nfs: fix sparse warnings

2008-02-20 Thread Harvey Harrison
fs/nfs/nfs4state.c:788:34: warning: Using plain integer as NULL pointer
fs/nfs/delegation.c:52:34: warning: Using plain integer as NULL pointer
fs/nfs/idmap.c:312:12: warning: Using plain integer as NULL pointer
fs/nfs/callback_xdr.c:257:6: warning: Using plain integer as NULL pointer
fs/nfs/callback_xdr.c:270:6: warning: Using plain integer as NULL pointer
fs/nfs/callback_xdr.c:281:6: warning: Using plain integer as NULL pointer

Signed-off-by: Harvey Harrison <[EMAIL PROTECTED]>
---
Rollup patches 1-4.
 fs/nfs/callback_xdr.c |6 +++---
 fs/nfs/delegation.c   |2 +-
 fs/nfs/idmap.c|2 +-
 fs/nfs/nfs4state.c|2 +-
 4 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/fs/nfs/callback_xdr.c b/fs/nfs/callback_xdr.c
index c63eb72..13619d2 100644
--- a/fs/nfs/callback_xdr.c
+++ b/fs/nfs/callback_xdr.c
@@ -254,7 +254,7 @@ static __be32 encode_attr_change(struct xdr_stream *xdr, 
const uint32_t *bitmap,
if (!(bitmap[0] & FATTR4_WORD0_CHANGE))
return 0;
p = xdr_reserve_space(xdr, 8);
-   if (unlikely(p == 0))
+   if (unlikely(!p))
return htonl(NFS4ERR_RESOURCE);
p = xdr_encode_hyper(p, change);
return 0;
@@ -267,7 +267,7 @@ static __be32 encode_attr_size(struct xdr_stream *xdr, 
const uint32_t *bitmap, u
if (!(bitmap[0] & FATTR4_WORD0_SIZE))
return 0;
p = xdr_reserve_space(xdr, 8);
-   if (unlikely(p == 0))
+   if (unlikely(!p))
return htonl(NFS4ERR_RESOURCE);
p = xdr_encode_hyper(p, size);
return 0;
@@ -278,7 +278,7 @@ static __be32 encode_attr_time(struct xdr_stream *xdr, 
const struct timespec *ti
__be32 *p;
 
p = xdr_reserve_space(xdr, 12);
-   if (unlikely(p == 0))
+   if (unlikely(!p))
return htonl(NFS4ERR_RESOURCE);
p = xdr_encode_hyper(p, time->tv_sec);
*p = htonl(time->tv_nsec);
diff --git a/fs/nfs/delegation.c b/fs/nfs/delegation.c
index b9eadd1..00a5e44 100644
--- a/fs/nfs/delegation.c
+++ b/fs/nfs/delegation.c
@@ -49,7 +49,7 @@ static int nfs_delegation_claim_locks(struct nfs_open_context 
*ctx, struct nfs4_
struct file_lock *fl;
int status;
 
-   for (fl = inode->i_flock; fl != 0; fl = fl->fl_next) {
+   for (fl = inode->i_flock; fl != NULL; fl = fl->fl_next) {
if (!(fl->fl_flags & (FL_POSIX|FL_FLOCK)))
continue;
if (nfs_file_open_context(fl->fl_file) != ctx)
diff --git a/fs/nfs/idmap.c b/fs/nfs/idmap.c
index 8ae5dba..86147b0 100644
--- a/fs/nfs/idmap.c
+++ b/fs/nfs/idmap.c
@@ -309,7 +309,7 @@ nfs_idmap_name(struct idmap *idmap, struct idmap_hashtable 
*h,
mutex_lock(>idmap_im_lock);
 
he = idmap_lookup_id(h, id);
-   if (he != 0) {
+   if (he) {
memcpy(name, he->ih_name, he->ih_namelen);
ret = he->ih_namelen;
goto out;
diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c
index 6233eb5..b962397 100644
--- a/fs/nfs/nfs4state.c
+++ b/fs/nfs/nfs4state.c
@@ -785,7 +785,7 @@ static int nfs4_reclaim_locks(struct 
nfs4_state_recovery_ops *ops, struct nfs4_s
struct file_lock *fl;
int status = 0;
 
-   for (fl = inode->i_flock; fl != 0; fl = fl->fl_next) {
+   for (fl = inode->i_flock; fl != NULL; fl = fl->fl_next) {
if (!(fl->fl_flags & (FL_POSIX|FL_FLOCK)))
continue;
if (nfs_file_open_context(fl->fl_file)->state != state)
-- 
1.5.4.2.200.g99e75



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/2] nfsd: fix sparse warnings

2008-02-20 Thread Harvey Harrison
Add extern to nfsd/nfsd.h
fs/nfsd/nfssvc.c:146:5: warning: symbol 'nfsd_nrthreads' was not declared. 
Should it be static?
fs/nfsd/nfssvc.c:261:5: warning: symbol 'nfsd_nrpools' was not declared. Should 
it be static?
fs/nfsd/nfssvc.c:269:5: warning: symbol 'nfsd_get_nrthreads' was not declared. 
Should it be static?
fs/nfsd/nfssvc.c:281:5: warning: symbol 'nfsd_set_nrthreads' was not declared. 
Should it be static?
fs/nfsd/export.c:1534:23: warning: symbol 'nfs_exports_op' was not declared. 
Should it be static?

Add include of auth.h
fs/nfsd/auth.c:27:5: warning: symbol 'nfsd_setuser' was not declared. Should it 
be static?

Make static, move forward declaration closer to where it's needed.
fs/nfsd/nfs4state.c:1877:1: warning: symbol 'laundromat_main' was not declared. 
Should it be static?

Make static, forward declaration was already marked static.
fs/nfsd/nfs4idmap.c:206:1: warning: symbol 'idtoname_parse' was not declared. 
Should it be static?
fs/nfsd/vfs.c:1156:1: warning: symbol 'nfsd_create_setattr' was not declared. 
Should it be static?

Signed-off-by: Harvey Harrison <[EMAIL PROTECTED]>
---
 fs/nfsd/auth.c|1 +
 fs/nfsd/nfs4idmap.c   |2 +-
 fs/nfsd/nfs4state.c   |   10 +-
 fs/nfsd/nfsctl.c  |7 ---
 fs/nfsd/vfs.c |2 +-
 include/linux/nfsd/nfsd.h |8 
 6 files changed, 16 insertions(+), 14 deletions(-)

diff --git a/fs/nfsd/auth.c b/fs/nfsd/auth.c
index d13403e..294992e 100644
--- a/fs/nfsd/auth.c
+++ b/fs/nfsd/auth.c
@@ -10,6 +10,7 @@
 #include 
 #include 
 #include 
+#include "auth.h"
 
 int nfsexp_flags(struct svc_rqst *rqstp, struct svc_export *exp)
 {
diff --git a/fs/nfsd/nfs4idmap.c b/fs/nfsd/nfs4idmap.c
index 996bd88..5b39842 100644
--- a/fs/nfsd/nfs4idmap.c
+++ b/fs/nfsd/nfs4idmap.c
@@ -202,7 +202,7 @@ static struct cache_detail idtoname_cache = {
.alloc  = ent_alloc,
 };
 
-int
+static int
 idtoname_parse(struct cache_detail *cd, char *buf, int buflen)
 {
struct ent ent, *res;
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index bcb97d8..c7c92ae 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -1762,10 +1762,6 @@ out:
return status;
 }
 
-static struct workqueue_struct *laundry_wq;
-static void laundromat_main(struct work_struct *);
-static DECLARE_DELAYED_WORK(laundromat_work, laundromat_main);
-
 __be32
 nfsd4_renew(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
clientid_t *clid)
@@ -1873,7 +1869,11 @@ nfs4_laundromat(void)
return clientid_val;
 }
 
-void
+static struct workqueue_struct *laundry_wq;
+static void laundromat_main(struct work_struct *);
+static DECLARE_DELAYED_WORK(laundromat_work, laundromat_main);
+
+static void
 laundromat_main(struct work_struct *not_used)
 {
time_t t;
diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c
index 8516137..73d3f28 100644
--- a/fs/nfsd/nfsctl.c
+++ b/fs/nfsd/nfsctl.c
@@ -149,7 +149,6 @@ static const struct file_operations transaction_ops = {
.release= simple_transaction_release,
 };
 
-extern struct seq_operations nfs_exports_op;
 static int exports_open(struct inode *inode, struct file *file)
 {
return seq_open(file, _exports_op);
@@ -347,8 +346,6 @@ static ssize_t write_filehandle(struct file *file, char 
*buf, size_t size)
return mesg - buf;  
 }
 
-extern int nfsd_nrthreads(void);
-
 static ssize_t write_threads(struct file *file, char *buf, size_t size)
 {
/* if size > 0, look for a number of threads and call nfsd_svc
@@ -371,10 +368,6 @@ static ssize_t write_threads(struct file *file, char *buf, 
size_t size)
return strlen(buf);
 }
 
-extern int nfsd_nrpools(void);
-extern int nfsd_get_nrthreads(int n, int *);
-extern int nfsd_set_nrthreads(int n, int *);
-
 static ssize_t write_pool_threads(struct file *file, char *buf, size_t size)
 {
/* if size > 0, look for an array of number of threads per node
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
index 46f59d5..0265310 100644
--- a/fs/nfsd/vfs.c
+++ b/fs/nfsd/vfs.c
@@ -1152,7 +1152,7 @@ nfsd_commit(struct svc_rqst *rqstp, struct svc_fh *fhp,
 }
 #endif /* CONFIG_NFSD_V3 */
 
-__be32
+static __be32
 nfsd_create_setattr(struct svc_rqst *rqstp, struct svc_fh *resfhp,
struct iattr *iap)
 {
diff --git a/include/linux/nfsd/nfsd.h b/include/linux/nfsd/nfsd.h
index 8caf4c4..f4de14d 100644
--- a/include/linux/nfsd/nfsd.h
+++ b/include/linux/nfsd/nfsd.h
@@ -56,12 +56,20 @@ extern struct svc_program   nfsd_program;
 extern struct svc_version  nfsd_version2, nfsd_version3,
nfsd_version4;
 extern struct svc_serv *nfsd_serv;
+
+extern struct seq_operations nfs_exports_op;
+
 /*
  * Function prototypes.
  */
 intnfsd_svc(unsigned short port, int nrservs);
 intnfsd_dispatch(struct svc_rqst *rqstp, __be32 *statp);
 
+intnfsd_nrthreads(void);
+int   

[PATCH 2/2] nfsd: fix sparse warning in vfs.c

2008-02-20 Thread Harvey Harrison
fs/nfsd/vfs.c:991:27: warning: Using plain integer as NULL pointer

Signed-off-by: Harvey Harrison <[EMAIL PROTECTED]>
---
 fs/nfsd/vfs.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
index 0265310..17ac51b 100644
--- a/fs/nfsd/vfs.c
+++ b/fs/nfsd/vfs.c
@@ -988,7 +988,7 @@ nfsd_vfs_write(struct svc_rqst *rqstp, struct svc_fh *fhp, 
struct file *file,
 * flushing the data to disk is handled separately below.
 */
 
-   if (file->f_op->fsync == 0) {/* COMMIT3 cannot work */
+   if (!file->f_op->fsync) {/* COMMIT3 cannot work */
   stable = 2;
   *stablep = 2; /* FILE_SYNC */
}
-- 
1.5.4.2.200.g99e75

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 4/4] nfs: fix sparse warnings in callback_xdr.c

2008-02-20 Thread Harvey Harrison
fs/nfs/callback_xdr.c:257:6: warning: Using plain integer as NULL pointer
fs/nfs/callback_xdr.c:270:6: warning: Using plain integer as NULL pointer
fs/nfs/callback_xdr.c:281:6: warning: Using plain integer as NULL pointer

Signed-off-by: Harvey Harrison <[EMAIL PROTECTED]>
---
 fs/nfs/callback_xdr.c |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/nfs/callback_xdr.c b/fs/nfs/callback_xdr.c
index c63eb72..13619d2 100644
--- a/fs/nfs/callback_xdr.c
+++ b/fs/nfs/callback_xdr.c
@@ -254,7 +254,7 @@ static __be32 encode_attr_change(struct xdr_stream *xdr, 
const uint32_t *bitmap,
if (!(bitmap[0] & FATTR4_WORD0_CHANGE))
return 0;
p = xdr_reserve_space(xdr, 8);
-   if (unlikely(p == 0))
+   if (unlikely(!p))
return htonl(NFS4ERR_RESOURCE);
p = xdr_encode_hyper(p, change);
return 0;
@@ -267,7 +267,7 @@ static __be32 encode_attr_size(struct xdr_stream *xdr, 
const uint32_t *bitmap, u
if (!(bitmap[0] & FATTR4_WORD0_SIZE))
return 0;
p = xdr_reserve_space(xdr, 8);
-   if (unlikely(p == 0))
+   if (unlikely(!p))
return htonl(NFS4ERR_RESOURCE);
p = xdr_encode_hyper(p, size);
return 0;
@@ -278,7 +278,7 @@ static __be32 encode_attr_time(struct xdr_stream *xdr, 
const struct timespec *ti
__be32 *p;
 
p = xdr_reserve_space(xdr, 12);
-   if (unlikely(p == 0))
+   if (unlikely(!p))
return htonl(NFS4ERR_RESOURCE);
p = xdr_encode_hyper(p, time->tv_sec);
*p = htonl(time->tv_nsec);
-- 
1.5.4.2.200.g99e75

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3/4] nfs: fix sparse warning in idmap.c

2008-02-20 Thread Harvey Harrison
fs/nfs/idmap.c:312:12: warning: Using plain integer as NULL pointer

Signed-off-by: Harvey Harrison <[EMAIL PROTECTED]>
---
 fs/nfs/idmap.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/fs/nfs/idmap.c b/fs/nfs/idmap.c
index 8ae5dba..86147b0 100644
--- a/fs/nfs/idmap.c
+++ b/fs/nfs/idmap.c
@@ -309,7 +309,7 @@ nfs_idmap_name(struct idmap *idmap, struct idmap_hashtable 
*h,
mutex_lock(>idmap_im_lock);
 
he = idmap_lookup_id(h, id);
-   if (he != 0) {
+   if (he) {
memcpy(name, he->ih_name, he->ih_namelen);
ret = he->ih_namelen;
goto out;
-- 
1.5.4.2.200.g99e75


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 2/4] nfs: fix sparse warning in delegation.c

2008-02-20 Thread Harvey Harrison
fs/nfs/delegation.c:52:34: warning: Using plain integer as NULL pointer

Signed-off-by: Harvey Harrison <[EMAIL PROTECTED]>
---
 fs/nfs/delegation.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/fs/nfs/delegation.c b/fs/nfs/delegation.c
index b9eadd1..00a5e44 100644
--- a/fs/nfs/delegation.c
+++ b/fs/nfs/delegation.c
@@ -49,7 +49,7 @@ static int nfs_delegation_claim_locks(struct nfs_open_context 
*ctx, struct nfs4_
struct file_lock *fl;
int status;
 
-   for (fl = inode->i_flock; fl != 0; fl = fl->fl_next) {
+   for (fl = inode->i_flock; fl != NULL; fl = fl->fl_next) {
if (!(fl->fl_flags & (FL_POSIX|FL_FLOCK)))
continue;
if (nfs_file_open_context(fl->fl_file) != ctx)
-- 
1.5.4.2.200.g99e75


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/4] nfs: fix sparse warning in nfs4state.c

2008-02-20 Thread Harvey Harrison
fs/nfs/nfs4state.c:788:34: warning: Using plain integer as NULL pointer

Signed-off-by: Harvey Harrison <[EMAIL PROTECTED]>
---
 fs/nfs/nfs4state.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c
index 6233eb5..b962397 100644
--- a/fs/nfs/nfs4state.c
+++ b/fs/nfs/nfs4state.c
@@ -785,7 +785,7 @@ static int nfs4_reclaim_locks(struct 
nfs4_state_recovery_ops *ops, struct nfs4_s
struct file_lock *fl;
int status = 0;
 
-   for (fl = inode->i_flock; fl != 0; fl = fl->fl_next) {
+   for (fl = inode->i_flock; fl != NULL; fl = fl->fl_next) {
if (!(fl->fl_flags & (FL_POSIX|FL_FLOCK)))
continue;
if (nfs_file_open_context(fl->fl_file)->state != state)
-- 
1.5.4.2.200.g99e75


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] ata: use clamp_t macro to avoid sparse warnings

2008-02-20 Thread Harvey Harrison
Nesting min_t/max_t macros produces many shadowed variable warnings
due to use of __x.  Add a clamp_t macro to linux/kernel.h and use
it in the FIT macro.

Signed-off-by: Harvey Harrison <[EMAIL PROTECTED]>
---
 include/linux/kernel.h |9 +
 include/linux/libata.h |2 +-
 2 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 2df44e7..47924ce 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -362,6 +362,15 @@ static inline int __attribute__ ((format (printf, 1, 2))) 
pr_debug(const char *
 #define max_t(type,x,y) \
({ type __x = (x); type __y = (y); __x > __y ? __x: __y; })
 
+/*
+ * Clamp a value to within a given range using comparisons of a specified type.
+ */
+#define clamp_t(type,val,min,max) ({ \
+   type __val = (val); \
+   type __min = (min); \
+   type __max = (max); \
+   __val = __val < __min ? __min: __val; \
+   __val > __max ? __max: __val; })
 
 /**
  * container_of - cast a member of a structure out to the containing structure
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 2e098f9..8adc2a0 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -754,7 +754,7 @@ struct ata_timing {
unsigned short udma;/* t2CYCTYP/2 */
 };
 
-#define FIT(v, vmin, vmax) max_t(short, min_t(short, v, vmax), vmin)
+#define FIT(v, vmin, vmax) clamp_t(short, v, vmin, vmax)
 
 extern const unsigned long sata_deb_timing_normal[];
 extern const unsigned long sata_deb_timing_hotplug[];
-- 
1.5.4.2.200.g99e75



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] ata: use clamp_t macro to avoid sparse warnings

2008-02-20 Thread Harvey Harrison
Nesting min_t/max_t macros produces many shadowed variable warnings
due to use of __x.  Add a clamp_t macro to linux/kernel.h and use
it in the FIT macro.

Signed-off-by: Harvey Harrison [EMAIL PROTECTED]
---
 include/linux/kernel.h |9 +
 include/linux/libata.h |2 +-
 2 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 2df44e7..47924ce 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -362,6 +362,15 @@ static inline int __attribute__ ((format (printf, 1, 2))) 
pr_debug(const char *
 #define max_t(type,x,y) \
({ type __x = (x); type __y = (y); __x  __y ? __x: __y; })
 
+/*
+ * Clamp a value to within a given range using comparisons of a specified type.
+ */
+#define clamp_t(type,val,min,max) ({ \
+   type __val = (val); \
+   type __min = (min); \
+   type __max = (max); \
+   __val = __val  __min ? __min: __val; \
+   __val  __max ? __max: __val; })
 
 /**
  * container_of - cast a member of a structure out to the containing structure
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 2e098f9..8adc2a0 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -754,7 +754,7 @@ struct ata_timing {
unsigned short udma;/* t2CYCTYP/2 */
 };
 
-#define FIT(v, vmin, vmax) max_t(short, min_t(short, v, vmax), vmin)
+#define FIT(v, vmin, vmax) clamp_t(short, v, vmin, vmax)
 
 extern const unsigned long sata_deb_timing_normal[];
 extern const unsigned long sata_deb_timing_hotplug[];
-- 
1.5.4.2.200.g99e75



--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/4] nfs: fix sparse warning in nfs4state.c

2008-02-20 Thread Harvey Harrison
fs/nfs/nfs4state.c:788:34: warning: Using plain integer as NULL pointer

Signed-off-by: Harvey Harrison [EMAIL PROTECTED]
---
 fs/nfs/nfs4state.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c
index 6233eb5..b962397 100644
--- a/fs/nfs/nfs4state.c
+++ b/fs/nfs/nfs4state.c
@@ -785,7 +785,7 @@ static int nfs4_reclaim_locks(struct 
nfs4_state_recovery_ops *ops, struct nfs4_s
struct file_lock *fl;
int status = 0;
 
-   for (fl = inode-i_flock; fl != 0; fl = fl-fl_next) {
+   for (fl = inode-i_flock; fl != NULL; fl = fl-fl_next) {
if (!(fl-fl_flags  (FL_POSIX|FL_FLOCK)))
continue;
if (nfs_file_open_context(fl-fl_file)-state != state)
-- 
1.5.4.2.200.g99e75


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 2/4] nfs: fix sparse warning in delegation.c

2008-02-20 Thread Harvey Harrison
fs/nfs/delegation.c:52:34: warning: Using plain integer as NULL pointer

Signed-off-by: Harvey Harrison [EMAIL PROTECTED]
---
 fs/nfs/delegation.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/fs/nfs/delegation.c b/fs/nfs/delegation.c
index b9eadd1..00a5e44 100644
--- a/fs/nfs/delegation.c
+++ b/fs/nfs/delegation.c
@@ -49,7 +49,7 @@ static int nfs_delegation_claim_locks(struct nfs_open_context 
*ctx, struct nfs4_
struct file_lock *fl;
int status;
 
-   for (fl = inode-i_flock; fl != 0; fl = fl-fl_next) {
+   for (fl = inode-i_flock; fl != NULL; fl = fl-fl_next) {
if (!(fl-fl_flags  (FL_POSIX|FL_FLOCK)))
continue;
if (nfs_file_open_context(fl-fl_file) != ctx)
-- 
1.5.4.2.200.g99e75


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3/4] nfs: fix sparse warning in idmap.c

2008-02-20 Thread Harvey Harrison
fs/nfs/idmap.c:312:12: warning: Using plain integer as NULL pointer

Signed-off-by: Harvey Harrison [EMAIL PROTECTED]
---
 fs/nfs/idmap.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/fs/nfs/idmap.c b/fs/nfs/idmap.c
index 8ae5dba..86147b0 100644
--- a/fs/nfs/idmap.c
+++ b/fs/nfs/idmap.c
@@ -309,7 +309,7 @@ nfs_idmap_name(struct idmap *idmap, struct idmap_hashtable 
*h,
mutex_lock(idmap-idmap_im_lock);
 
he = idmap_lookup_id(h, id);
-   if (he != 0) {
+   if (he) {
memcpy(name, he-ih_name, he-ih_namelen);
ret = he-ih_namelen;
goto out;
-- 
1.5.4.2.200.g99e75


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 4/4] nfs: fix sparse warnings in callback_xdr.c

2008-02-20 Thread Harvey Harrison
fs/nfs/callback_xdr.c:257:6: warning: Using plain integer as NULL pointer
fs/nfs/callback_xdr.c:270:6: warning: Using plain integer as NULL pointer
fs/nfs/callback_xdr.c:281:6: warning: Using plain integer as NULL pointer

Signed-off-by: Harvey Harrison [EMAIL PROTECTED]
---
 fs/nfs/callback_xdr.c |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/nfs/callback_xdr.c b/fs/nfs/callback_xdr.c
index c63eb72..13619d2 100644
--- a/fs/nfs/callback_xdr.c
+++ b/fs/nfs/callback_xdr.c
@@ -254,7 +254,7 @@ static __be32 encode_attr_change(struct xdr_stream *xdr, 
const uint32_t *bitmap,
if (!(bitmap[0]  FATTR4_WORD0_CHANGE))
return 0;
p = xdr_reserve_space(xdr, 8);
-   if (unlikely(p == 0))
+   if (unlikely(!p))
return htonl(NFS4ERR_RESOURCE);
p = xdr_encode_hyper(p, change);
return 0;
@@ -267,7 +267,7 @@ static __be32 encode_attr_size(struct xdr_stream *xdr, 
const uint32_t *bitmap, u
if (!(bitmap[0]  FATTR4_WORD0_SIZE))
return 0;
p = xdr_reserve_space(xdr, 8);
-   if (unlikely(p == 0))
+   if (unlikely(!p))
return htonl(NFS4ERR_RESOURCE);
p = xdr_encode_hyper(p, size);
return 0;
@@ -278,7 +278,7 @@ static __be32 encode_attr_time(struct xdr_stream *xdr, 
const struct timespec *ti
__be32 *p;
 
p = xdr_reserve_space(xdr, 12);
-   if (unlikely(p == 0))
+   if (unlikely(!p))
return htonl(NFS4ERR_RESOURCE);
p = xdr_encode_hyper(p, time-tv_sec);
*p = htonl(time-tv_nsec);
-- 
1.5.4.2.200.g99e75

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/2] nfsd: fix sparse warnings

2008-02-20 Thread Harvey Harrison
Add extern to nfsd/nfsd.h
fs/nfsd/nfssvc.c:146:5: warning: symbol 'nfsd_nrthreads' was not declared. 
Should it be static?
fs/nfsd/nfssvc.c:261:5: warning: symbol 'nfsd_nrpools' was not declared. Should 
it be static?
fs/nfsd/nfssvc.c:269:5: warning: symbol 'nfsd_get_nrthreads' was not declared. 
Should it be static?
fs/nfsd/nfssvc.c:281:5: warning: symbol 'nfsd_set_nrthreads' was not declared. 
Should it be static?
fs/nfsd/export.c:1534:23: warning: symbol 'nfs_exports_op' was not declared. 
Should it be static?

Add include of auth.h
fs/nfsd/auth.c:27:5: warning: symbol 'nfsd_setuser' was not declared. Should it 
be static?

Make static, move forward declaration closer to where it's needed.
fs/nfsd/nfs4state.c:1877:1: warning: symbol 'laundromat_main' was not declared. 
Should it be static?

Make static, forward declaration was already marked static.
fs/nfsd/nfs4idmap.c:206:1: warning: symbol 'idtoname_parse' was not declared. 
Should it be static?
fs/nfsd/vfs.c:1156:1: warning: symbol 'nfsd_create_setattr' was not declared. 
Should it be static?

Signed-off-by: Harvey Harrison [EMAIL PROTECTED]
---
 fs/nfsd/auth.c|1 +
 fs/nfsd/nfs4idmap.c   |2 +-
 fs/nfsd/nfs4state.c   |   10 +-
 fs/nfsd/nfsctl.c  |7 ---
 fs/nfsd/vfs.c |2 +-
 include/linux/nfsd/nfsd.h |8 
 6 files changed, 16 insertions(+), 14 deletions(-)

diff --git a/fs/nfsd/auth.c b/fs/nfsd/auth.c
index d13403e..294992e 100644
--- a/fs/nfsd/auth.c
+++ b/fs/nfsd/auth.c
@@ -10,6 +10,7 @@
 #include linux/sunrpc/svcauth.h
 #include linux/nfsd/nfsd.h
 #include linux/nfsd/export.h
+#include auth.h
 
 int nfsexp_flags(struct svc_rqst *rqstp, struct svc_export *exp)
 {
diff --git a/fs/nfsd/nfs4idmap.c b/fs/nfsd/nfs4idmap.c
index 996bd88..5b39842 100644
--- a/fs/nfsd/nfs4idmap.c
+++ b/fs/nfsd/nfs4idmap.c
@@ -202,7 +202,7 @@ static struct cache_detail idtoname_cache = {
.alloc  = ent_alloc,
 };
 
-int
+static int
 idtoname_parse(struct cache_detail *cd, char *buf, int buflen)
 {
struct ent ent, *res;
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index bcb97d8..c7c92ae 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -1762,10 +1762,6 @@ out:
return status;
 }
 
-static struct workqueue_struct *laundry_wq;
-static void laundromat_main(struct work_struct *);
-static DECLARE_DELAYED_WORK(laundromat_work, laundromat_main);
-
 __be32
 nfsd4_renew(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
clientid_t *clid)
@@ -1873,7 +1869,11 @@ nfs4_laundromat(void)
return clientid_val;
 }
 
-void
+static struct workqueue_struct *laundry_wq;
+static void laundromat_main(struct work_struct *);
+static DECLARE_DELAYED_WORK(laundromat_work, laundromat_main);
+
+static void
 laundromat_main(struct work_struct *not_used)
 {
time_t t;
diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c
index 8516137..73d3f28 100644
--- a/fs/nfsd/nfsctl.c
+++ b/fs/nfsd/nfsctl.c
@@ -149,7 +149,6 @@ static const struct file_operations transaction_ops = {
.release= simple_transaction_release,
 };
 
-extern struct seq_operations nfs_exports_op;
 static int exports_open(struct inode *inode, struct file *file)
 {
return seq_open(file, nfs_exports_op);
@@ -347,8 +346,6 @@ static ssize_t write_filehandle(struct file *file, char 
*buf, size_t size)
return mesg - buf;  
 }
 
-extern int nfsd_nrthreads(void);
-
 static ssize_t write_threads(struct file *file, char *buf, size_t size)
 {
/* if size  0, look for a number of threads and call nfsd_svc
@@ -371,10 +368,6 @@ static ssize_t write_threads(struct file *file, char *buf, 
size_t size)
return strlen(buf);
 }
 
-extern int nfsd_nrpools(void);
-extern int nfsd_get_nrthreads(int n, int *);
-extern int nfsd_set_nrthreads(int n, int *);
-
 static ssize_t write_pool_threads(struct file *file, char *buf, size_t size)
 {
/* if size  0, look for an array of number of threads per node
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
index 46f59d5..0265310 100644
--- a/fs/nfsd/vfs.c
+++ b/fs/nfsd/vfs.c
@@ -1152,7 +1152,7 @@ nfsd_commit(struct svc_rqst *rqstp, struct svc_fh *fhp,
 }
 #endif /* CONFIG_NFSD_V3 */
 
-__be32
+static __be32
 nfsd_create_setattr(struct svc_rqst *rqstp, struct svc_fh *resfhp,
struct iattr *iap)
 {
diff --git a/include/linux/nfsd/nfsd.h b/include/linux/nfsd/nfsd.h
index 8caf4c4..f4de14d 100644
--- a/include/linux/nfsd/nfsd.h
+++ b/include/linux/nfsd/nfsd.h
@@ -56,12 +56,20 @@ extern struct svc_program   nfsd_program;
 extern struct svc_version  nfsd_version2, nfsd_version3,
nfsd_version4;
 extern struct svc_serv *nfsd_serv;
+
+extern struct seq_operations nfs_exports_op;
+
 /*
  * Function prototypes.
  */
 intnfsd_svc(unsigned short port, int nrservs);
 intnfsd_dispatch(struct svc_rqst *rqstp, __be32 *statp);
 
+int

[PATCH 2/2] nfsd: fix sparse warning in vfs.c

2008-02-20 Thread Harvey Harrison
fs/nfsd/vfs.c:991:27: warning: Using plain integer as NULL pointer

Signed-off-by: Harvey Harrison [EMAIL PROTECTED]
---
 fs/nfsd/vfs.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
index 0265310..17ac51b 100644
--- a/fs/nfsd/vfs.c
+++ b/fs/nfsd/vfs.c
@@ -988,7 +988,7 @@ nfsd_vfs_write(struct svc_rqst *rqstp, struct svc_fh *fhp, 
struct file *file,
 * flushing the data to disk is handled separately below.
 */
 
-   if (file-f_op-fsync == 0) {/* COMMIT3 cannot work */
+   if (!file-f_op-fsync) {/* COMMIT3 cannot work */
   stable = 2;
   *stablep = 2; /* FILE_SYNC */
}
-- 
1.5.4.2.200.g99e75

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] nfs: fix sparse warnings

2008-02-20 Thread Harvey Harrison
fs/nfs/nfs4state.c:788:34: warning: Using plain integer as NULL pointer
fs/nfs/delegation.c:52:34: warning: Using plain integer as NULL pointer
fs/nfs/idmap.c:312:12: warning: Using plain integer as NULL pointer
fs/nfs/callback_xdr.c:257:6: warning: Using plain integer as NULL pointer
fs/nfs/callback_xdr.c:270:6: warning: Using plain integer as NULL pointer
fs/nfs/callback_xdr.c:281:6: warning: Using plain integer as NULL pointer

Signed-off-by: Harvey Harrison [EMAIL PROTECTED]
---
Rollup patches 1-4.
 fs/nfs/callback_xdr.c |6 +++---
 fs/nfs/delegation.c   |2 +-
 fs/nfs/idmap.c|2 +-
 fs/nfs/nfs4state.c|2 +-
 4 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/fs/nfs/callback_xdr.c b/fs/nfs/callback_xdr.c
index c63eb72..13619d2 100644
--- a/fs/nfs/callback_xdr.c
+++ b/fs/nfs/callback_xdr.c
@@ -254,7 +254,7 @@ static __be32 encode_attr_change(struct xdr_stream *xdr, 
const uint32_t *bitmap,
if (!(bitmap[0]  FATTR4_WORD0_CHANGE))
return 0;
p = xdr_reserve_space(xdr, 8);
-   if (unlikely(p == 0))
+   if (unlikely(!p))
return htonl(NFS4ERR_RESOURCE);
p = xdr_encode_hyper(p, change);
return 0;
@@ -267,7 +267,7 @@ static __be32 encode_attr_size(struct xdr_stream *xdr, 
const uint32_t *bitmap, u
if (!(bitmap[0]  FATTR4_WORD0_SIZE))
return 0;
p = xdr_reserve_space(xdr, 8);
-   if (unlikely(p == 0))
+   if (unlikely(!p))
return htonl(NFS4ERR_RESOURCE);
p = xdr_encode_hyper(p, size);
return 0;
@@ -278,7 +278,7 @@ static __be32 encode_attr_time(struct xdr_stream *xdr, 
const struct timespec *ti
__be32 *p;
 
p = xdr_reserve_space(xdr, 12);
-   if (unlikely(p == 0))
+   if (unlikely(!p))
return htonl(NFS4ERR_RESOURCE);
p = xdr_encode_hyper(p, time-tv_sec);
*p = htonl(time-tv_nsec);
diff --git a/fs/nfs/delegation.c b/fs/nfs/delegation.c
index b9eadd1..00a5e44 100644
--- a/fs/nfs/delegation.c
+++ b/fs/nfs/delegation.c
@@ -49,7 +49,7 @@ static int nfs_delegation_claim_locks(struct nfs_open_context 
*ctx, struct nfs4_
struct file_lock *fl;
int status;
 
-   for (fl = inode-i_flock; fl != 0; fl = fl-fl_next) {
+   for (fl = inode-i_flock; fl != NULL; fl = fl-fl_next) {
if (!(fl-fl_flags  (FL_POSIX|FL_FLOCK)))
continue;
if (nfs_file_open_context(fl-fl_file) != ctx)
diff --git a/fs/nfs/idmap.c b/fs/nfs/idmap.c
index 8ae5dba..86147b0 100644
--- a/fs/nfs/idmap.c
+++ b/fs/nfs/idmap.c
@@ -309,7 +309,7 @@ nfs_idmap_name(struct idmap *idmap, struct idmap_hashtable 
*h,
mutex_lock(idmap-idmap_im_lock);
 
he = idmap_lookup_id(h, id);
-   if (he != 0) {
+   if (he) {
memcpy(name, he-ih_name, he-ih_namelen);
ret = he-ih_namelen;
goto out;
diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c
index 6233eb5..b962397 100644
--- a/fs/nfs/nfs4state.c
+++ b/fs/nfs/nfs4state.c
@@ -785,7 +785,7 @@ static int nfs4_reclaim_locks(struct 
nfs4_state_recovery_ops *ops, struct nfs4_s
struct file_lock *fl;
int status = 0;
 
-   for (fl = inode-i_flock; fl != 0; fl = fl-fl_next) {
+   for (fl = inode-i_flock; fl != NULL; fl = fl-fl_next) {
if (!(fl-fl_flags  (FL_POSIX|FL_FLOCK)))
continue;
if (nfs_file_open_context(fl-fl_file)-state != state)
-- 
1.5.4.2.200.g99e75



--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] char: make functions static in synclinkmp.c

2008-02-20 Thread Harvey Harrison
/synclinkmp.c:5270:5: warning: symbol 'loopback_test' was not 
declared. Should it be static?
drivers/char/synclinkmp.c:5335:5: warning: symbol 'adapter_test' was not 
declared. Should it be static?
drivers/char/synclinkmp.c:5397:5: warning: symbol 'memory_test' was not 
declared. Should it be static?
drivers/char/synclinkmp.c:5449:6: warning: symbol 'load_pci_memory' was not 
declared. Should it be static?
drivers/char/synclinkmp.c:5468:6: warning: symbol 'trace_block' was not 
declared. Should it be static?
drivers/char/synclinkmp.c:5503:6: warning: symbol 'tx_timeout' was not 
declared. Should it be static?
drivers/char/synclinkmp.c:5530:6: warning: symbol 'status_timeout' was not 
declared. Should it be static?
drivers/char/synclinkmp.c:5581:15: warning: symbol 'read_reg' was not declared. 
Should it be static?
drivers/char/synclinkmp.c:5586:6: warning: symbol 'write_reg' was not declared. 
Should it be static?
drivers/char/synclinkmp.c:5592:5: warning: symbol 'read_reg16' was not 
declared. Should it be static?
drivers/char/synclinkmp.c:5598:6: warning: symbol 'write_reg16' was not 
declared. Should it be static?
drivers/char/synclinkmp.c:5604:15: warning: symbol 'read_status_reg' was not 
declared. Should it be static?
drivers/char/synclinkmp.c:5610:6: warning: symbol 'write_control_reg' was not 
declared. Should it be static?

Signed-off-by: Harvey Harrison [EMAIL PROTECTED]
---
 drivers/char/synclinkmp.c |  120 ++--
 1 files changed, 60 insertions(+), 60 deletions(-)

diff --git a/drivers/char/synclinkmp.c b/drivers/char/synclinkmp.c
index f3e7807..c662810 100644
--- a/drivers/char/synclinkmp.c
+++ b/drivers/char/synclinkmp.c
@@ -1473,7 +1473,7 @@ static inline int line_info(char *buf, SLMP_INFO *info)
 
 /* Called to print information about devices
  */
-int read_proc(char *page, char **start, off_t off, int count,
+static int read_proc(char *page, char **start, off_t off, int count,
  int *eof, void *data)
 {
int len = 0, l;
@@ -2024,7 +2024,7 @@ static void hdlcdev_exit(SLMP_INFO *info)
 /* Return next bottom half action to perform.
  * Return Value:   BH action code or 0 if nothing to do.
  */
-int bh_action(SLMP_INFO *info)
+static int bh_action(SLMP_INFO *info)
 {
unsigned long flags;
int rc = 0;
@@ -2055,7 +2055,7 @@ int bh_action(SLMP_INFO *info)
 
 /* Perform bottom half processing of work items queued by ISR.
  */
-void bh_handler(struct work_struct *work)
+static void bh_handler(struct work_struct *work)
 {
SLMP_INFO *info = container_of(work, SLMP_INFO, task);
int action;
@@ -2100,7 +2100,7 @@ void bh_handler(struct work_struct *work)
__FILE__,__LINE__,info-device_name);
 }
 
-void bh_receive(SLMP_INFO *info)
+static void bh_receive(SLMP_INFO *info)
 {
if ( debug_level = DEBUG_LEVEL_BH )
printk( %s(%d):%s bh_receive()\n,
@@ -2109,7 +2109,7 @@ void bh_receive(SLMP_INFO *info)
while( rx_get_frame(info) );
 }
 
-void bh_transmit(SLMP_INFO *info)
+static void bh_transmit(SLMP_INFO *info)
 {
struct tty_struct *tty = info-tty;
 
@@ -2121,7 +2121,7 @@ void bh_transmit(SLMP_INFO *info)
tty_wakeup(tty);
 }
 
-void bh_status(SLMP_INFO *info)
+static void bh_status(SLMP_INFO *info)
 {
if ( debug_level = DEBUG_LEVEL_BH )
printk( %s(%d):%s bh_status() entry\n,
@@ -2133,7 +2133,7 @@ void bh_status(SLMP_INFO *info)
info-cts_chkcount = 0;
 }
 
-void isr_timer(SLMP_INFO * info)
+static void isr_timer(SLMP_INFO * info)
 {
unsigned char timer = (info-port_num  1) ? TIMER2 : TIMER0;
 
@@ -2159,7 +2159,7 @@ void isr_timer(SLMP_INFO * info)
__FILE__,__LINE__,info-device_name);
 }
 
-void isr_rxint(SLMP_INFO * info)
+static void isr_rxint(SLMP_INFO * info)
 {
struct tty_struct *tty = info-tty;
struct  mgsl_icount *icount = info-icount;
@@ -2218,7 +2218,7 @@ void isr_rxint(SLMP_INFO * info)
 /*
  * handle async rx data interrupts
  */
-void isr_rxrdy(SLMP_INFO * info)
+static void isr_rxrdy(SLMP_INFO * info)
 {
u16 status;
unsigned char DataByte;
@@ -2348,7 +2348,7 @@ static void isr_txeom(SLMP_INFO * info, unsigned char 
status)
 /*
  * handle tx status interrupts
  */
-void isr_txint(SLMP_INFO * info)
+static void isr_txint(SLMP_INFO * info)
 {
unsigned char status = read_reg(info, SR1)  info-ie1_value  (UDRN + 
IDLE + CCTS);
 
@@ -2376,7 +2376,7 @@ void isr_txint(SLMP_INFO * info)
 /*
  * handle async tx data interrupts
  */
-void isr_txrdy(SLMP_INFO * info)
+static void isr_txrdy(SLMP_INFO * info)
 {
if ( debug_level = DEBUG_LEVEL_ISR )
printk(%s(%d):%s isr_txrdy() tx_count=%d\n,
@@ -2407,7 +2407,7 @@ void isr_txrdy(SLMP_INFO * info)
info-pending_bh |= BH_TRANSMIT;
 }
 
-void isr_rxdmaok(SLMP_INFO * info)
+static void isr_rxdmaok(SLMP_INFO * info)
 {
/* BIT7 = EOT (end of transfer

[PATCH 1/2] moxa: make functions static

2008-02-20 Thread Harvey Harrison
All were forward declared static already.

Fixes sparse warnings:
drivers/char/moxa.c:1421:6: warning: symbol 'MoxaDriverInit' was not declared. 
Should it be static?
drivers/char/moxa.c:1464:6: warning: symbol 'MoxaPortFlushData' was not 
declared. Should it be static?
drivers/char/moxa.c:1477:5: warning: symbol 'MoxaDriverIoctl' was not declared. 
Should it be static?
drivers/char/moxa.c:1604:5: warning: symbol 'MoxaDriverPoll' was not declared. 
Should it be static?
drivers/char/moxa.c:1667:5: warning: symbol 'MoxaPortsOfCard' was not declared. 
Should it be static?
drivers/char/moxa.c:1954:5: warning: symbol 'MoxaPortIsValid' was not declared. 
Should it be static?
drivers/char/moxa.c:1964:6: warning: symbol 'MoxaPortEnable' was not declared. 
Should it be static?
drivers/char/moxa.c:1987:6: warning: symbol 'MoxaPortDisable' was not declared. 
Should it be static?
drivers/char/moxa.c:1997:6: warning: symbol 'MoxaPortGetMaxBaud' was not 
declared. Should it be static?
drivers/char/moxa.c:2007:6: warning: symbol 'MoxaPortSetBaud' was not declared. 
Should it be static?
drivers/char/moxa.c:2031:5: warning: symbol 'MoxaPortSetTermio' was not 
declared. Should it be static?
drivers/char/moxa.c:2087:5: warning: symbol 'MoxaPortGetLineOut' was not 
declared. Should it be static?
drivers/char/moxa.c:2107:6: warning: symbol 'MoxaPortLineCtrl' was not 
declared. Should it be static?
drivers/char/moxa.c:2122:6: warning: symbol 'MoxaPortFlowCtrl' was not 
declared. Should it be static?
drivers/char/moxa.c:2142:5: warning: symbol 'MoxaPortLineStatus' was not 
declared. Should it be static?
drivers/char/moxa.c:2168:5: warning: symbol 'MoxaPortDCDChange' was not 
declared. Should it be static?
drivers/char/moxa.c:2180:5: warning: symbol 'MoxaPortDCDON' was not declared. 
Should it be static?
drivers/char/moxa.c:2193:5: warning: symbol 'MoxaPortWriteData' was not 
declared. Should it be static?
drivers/char/moxa.c:2257:5: warning: symbol 'MoxaPortReadData' was not 
declared. Should it be static?
drivers/char/moxa.c:2327:5: warning: symbol 'MoxaPortTxQueue' was not declared. 
Should it be static?
drivers/char/moxa.c:2341:5: warning: symbol 'MoxaPortTxFree' was not declared. 
Should it be static?
drivers/char/moxa.c:2355:5: warning: symbol 'MoxaPortRxQueue' was not declared. 
Should it be static?
drivers/char/moxa.c:2370:6: warning: symbol 'MoxaPortTxDisable' was not 
declared. Should it be static?
drivers/char/moxa.c:2378:6: warning: symbol 'MoxaPortTxEnable' was not 
declared. Should it be static?
drivers/char/moxa.c:2387:5: warning: symbol 'MoxaPortResetBrkCnt' was not 
declared. Should it be static?
drivers/char/moxa.c:2396:6: warning: symbol 'MoxaPortSendBreak' was not 
declared. Should it be static?

Signed-off-by: Harvey Harrison [EMAIL PROTECTED]
---
 drivers/char/moxa.c |   52 +-
 1 files changed, 26 insertions(+), 26 deletions(-)

diff --git a/drivers/char/moxa.c b/drivers/char/moxa.c
index 64b7b2b..75c957f 100644
--- a/drivers/char/moxa.c
+++ b/drivers/char/moxa.c
@@ -1418,7 +1418,7 @@ static int moxaloadc320(int, void __iomem *, int, int *);
  * 2. MoxaDriverIoctl(unsigned int cmd, unsigned long arg, int port);   *
  * 3. MoxaDriverPoll(void); *
  */
-void MoxaDriverInit(void)
+static void MoxaDriverInit(void)
 {
struct moxa_port *p;
unsigned int i;
@@ -1461,7 +1461,7 @@ struct dl_str {
 
 static struct dl_str dltmp;
 
-void MoxaPortFlushData(int port, int mode)
+static void MoxaPortFlushData(int port, int mode)
 {
void __iomem *ofsAddr;
if ((mode  0) || (mode  2))
@@ -1474,7 +1474,7 @@ void MoxaPortFlushData(int port, int mode)
}
 }
 
-int MoxaDriverIoctl(unsigned int cmd, unsigned long arg, int port)
+static int MoxaDriverIoctl(unsigned int cmd, unsigned long arg, int port)
 {
int i;
int status;
@@ -1601,7 +1601,7 @@ copy:
}
 }
 
-int MoxaDriverPoll(void)
+static int MoxaDriverPoll(void)
 {
struct moxa_board_conf *brd;
register ushort temp;
@@ -1664,7 +1664,7 @@ int MoxaDriverPoll(void)
  * Card level function: *
  * 1. MoxaPortsOfCard(int cardno);  *
  */
-int MoxaPortsOfCard(int cardno)
+static int MoxaPortsOfCard(int cardno)
 {
 
if (moxa_boards[cardno].boardType == 0)
@@ -1951,7 +1951,7 @@ int MoxaPortsOfCard(int cardno)
  *send out a about 250 ms BREAK signal.
  *
  */
-int MoxaPortIsValid(int port)
+static int MoxaPortIsValid(int port)
 {
 
if (moxaCard == 0)
@@ -1961,7 +1961,7 @@ int MoxaPortIsValid(int port)
return (1);
 }
 
-void MoxaPortEnable(int port)
+static void MoxaPortEnable(int port)
 {
void __iomem *ofsAddr

[PATCH 2/2] moxa: fix sparse warnings

2008-02-20 Thread Harvey Harrison
drivers/char/moxa.c:873:26: warning: Using plain integer as NULL pointer
drivers/char/moxa.c:2037:49: warning: Using plain integer as NULL pointer

Signed-off-by: Harvey Harrison [EMAIL PROTECTED]
---
 drivers/char/moxa.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/char/moxa.c b/drivers/char/moxa.c
index 75c957f..d7e4aa7 100644
--- a/drivers/char/moxa.c
+++ b/drivers/char/moxa.c
@@ -870,7 +870,7 @@ static void moxa_poll(unsigned long ignored)
if (!(ch-statusflags  THROTTLE) 
(MoxaPortRxQueue(ch-port)  0))
moxa_receive_data(ch);
-   if ((tp = ch-tty) == 0)
+   if ((tp = ch-tty) == NULL)
continue;
if (ch-statusflags  LOWWAIT) {
if (MoxaPortTxQueue(ch-port) = WAKEUP_CHARS) {
@@ -2034,7 +2034,7 @@ static int MoxaPortSetTermio(int port, struct ktermios 
*termio, speed_t baud)
tcflag_t cflag;
tcflag_t mode = 0;
 
-   if (moxa_ports[port].chkPort == 0 || termio == 0)
+   if (moxa_ports[port].chkPort == 0 || termio == NULL)
return (-1);
ofsAddr = moxa_ports[port].tableAddr;
cflag = termio-c_cflag;/* termio-c_cflag */
-- 
1.5.4.2.200.g99e75

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: sparse - make __CHECK_ENDIAN__ default enabled?

2008-02-20 Thread Harvey Harrison
On Wed, 2008-02-20 at 23:03 +0100, Sam Ravnborg wrote:
 Hi Harvey.
 
 Can I ask you to look into the worst offenders so we
 can make -D__CHECK_ENDIAN__ enabled per default
 in the kernel.
 Or maybe we should do it anyway?

Well, I've got the worst of fs and drivers/ata done so far, still
weeping over the 5500 warnings in drivers. (X86_32 allyesconfig).
People ignore the existing warnings anyway, why not toss a few more
on the pile?

I'll look them over tonight and see how bad it would be.


 I made a quick test-run with a x86 64 bit defconfig.
 My first thought was that this was just really bad
 because the amount of warnings roughly doubled.
 
 But then inspecting it a little closer I could see
 that 8 files had an increase of  100 additional
 warnings when we enabled __CHECK_ENDIAN__ and
 that smells like easy targets to bring down the noise.
 
 I did not dare do it for an allyesconfig run - I 
 am not that brave.

Well, I'm just going through the _trivial_ ones first to try and cut
the noise down a bit.  I think with all the patches I have out there
I've cut a little over 1000 lines off an allyesconfig build on X86_32
so far.


Harvey

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: sparse - make __CHECK_ENDIAN__ default enabled?

2008-02-20 Thread Harvey Harrison
On Wed, 2008-02-20 at 23:03 +0100, Sam Ravnborg wrote:
 Hi Harvey.
 
 Can I ask you to look into the worst offenders so we
 can make -D__CHECK_ENDIAN__ enabled per default
 in the kernel.
 Or maybe we should do it anyway?

From a quick test, the same places that spew sparse warnings, spew
lots more sparse warnings, the places that are not so badare not
so bad afterwards either.

There's still so many of the trivial warnings that maybe it's not the
right time for this yet.  Ask me again when we get to the 2.6.26
timeframe, we'll see how many I've gotten rid of by then.

Harvey


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/2] moxa: make functions static

2008-02-20 Thread Harvey Harrison
On Thu, 2008-02-21 at 00:12 +0100, Jiri Slaby wrote:
 On 02/20/2008 11:14 PM, Harvey Harrison wrote:
  All were forward declared static already.
  
 Thanks, but I have similar fixes for both issues you address in my tree. I'll 
 post it in few days.

Great.

Harvey

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


acpi: new sparse warnings in 2.6.25-rc2

2008-02-20 Thread Harvey Harrison
Introduced between 2.6.25-rc1 and -rc2.

drivers/acpi/executer/exregion.c:369:8: warning: incorrect type in argument 3 
(different type sizes)
drivers/acpi/executer/exregion.c:369:8:expected unsigned int [usertype] 
*value
drivers/acpi/executer/exregion.c:369:8:got unsigned long long [usertype] 
*value
drivers/acpi/executer/exregion.c: In function 
‘acpi_ex_pci_config_space_handler’:
drivers/acpi/executer/exregion.c:369: warning: passing argument 3 of 
‘acpi_os_read_pci_configuration’ from incompatible pointer type

Cheers,

Harvey

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] markers: fix sparse warnings in markers.c

2008-02-20 Thread Harvey Harrison
char can be unsigned
kernel/marker.c:64:20: error: dubious one-bit signed bitfield
kernel/marker.c:65:14: error: dubious one-bit signed bitfield

Signed-off-by: Harvey Harrison [EMAIL PROTECTED]
---
Introduced between -rc1 and -rc2
 kernel/marker.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/marker.c b/kernel/marker.c
index c4c2cd8..50effc0 100644
--- a/kernel/marker.c
+++ b/kernel/marker.c
@@ -61,8 +61,8 @@ struct marker_entry {
int refcount;   /* Number of times armed. 0 if disarmed. */
struct rcu_head rcu;
void *oldptr;
-   char rcu_pending:1;
-   char ptype:1;
+   unsigned char rcu_pending:1;
+   unsigned char ptype:1;
char name[0];   /* Contains name'\0'format'\0' */
 };
 
-- 
1.5.4.2.200.g99e75



--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


  1   2   3   4   5   6   7   8   >