[PATCH wireless/arlan] Replace logical- by bit-and

2008-01-10 Thread Roel Kluin
Totally untested patch below from linus' git tree. The  is incorrect, right?

from drivers/net/wireless/arlan.h:390:
#define ARLAN_POWER 0x40
#define ARLAN_ACCESS0x80

Replace logical and by bit-and

Signed-off-by: Roel Kluin [EMAIL PROTECTED]
---
diff --git a/drivers/net/wireless/arlan.h b/drivers/net/wireless/arlan.h
index 3ed1df7..7b7498f 100644
--- a/drivers/net/wireless/arlan.h
+++ b/drivers/net/wireless/arlan.h
@@ -485,7 +485,7 @@ struct arlan_private {
 #define clearClearInterrupt(dev){\
writeControlRegister(dev,readControlRegister(dev)  
~ARLAN_CLEAR_INTERRUPT);}
 #define setPowerOff(dev){\
-   writeControlRegister(dev,readControlRegister(dev) | (ARLAN_POWER  
ARLAN_ACCESS));\
+   writeControlRegister(dev, readControlRegister(dev) | (ARLAN_POWER  
ARLAN_ACCESS));\
writeControlRegister(dev,readControlRegister(dev)  ~ARLAN_ACCESS);}
 #define setPowerOn(dev){\
writeControlRegister(dev,readControlRegister(dev)  ~(ARLAN_POWER));   }

--
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] [Coding Style]: fs/ext{3,4}/ext{3,4}_jbd{,2}.c

2008-01-10 Thread Roel Kluin
Al Viro wrote:
 __func__ is C99, but it's not what __FUNCTION__ used to be - it's not a
 string literal.  6.4.2.2(1):
 
   The identifier __func__ shall be implicitly declared by the translator
 as if, immediately following the opening brace of each function definition,
 the declaration
   static const char __func__[] = function-name;
 appeared, where function-name is the name of the lexically-enclosing function.
 
 IOW, it's a phase 7 (parsing and translation of translation units) and not
 phase 4 (preprocessor).  Practical implications are:
   * _way_ fewer kludges
   * it happens after phase 6 (string literal concatenation)
 So __FUNCION__  is called within body of foo() would result in
 foo is called while __func__ is called is a syntax error.
 
 These days old gcc __FUNCTION__ is gone; it's a macro expanding to __func__,
 so behaviour does *not* match the original (see above).

so if I understand correctly, this requires a fix:
--
__FUNCTION__ is a macro expanding to __func__ and translated as if previously
in that function was declared:
static const char __func__[] = function-name;

As is DEBUG() - when active - will produce a syntax error.

Signed-off-by: Roel Kluin [EMAIL PROTECTED]
---
diff --git a/drivers/pcmcia/au1000_xxs1500.c b/drivers/pcmcia/au1000_xxs1500.c
index ce9d5c4..855e1d6 100644
--- a/drivers/pcmcia/au1000_xxs1500.c
+++ b/drivers/pcmcia/au1000_xxs1500.c
@@ -56,7 +56,7 @@
 #define PCMCIA_IRQ AU1000_GPIO_4
 
 #if 0
-#define DEBUG(x,args...)   printk(__FUNCTION__ :  x,##args)
+#define DEBUG(x, args...)  printk(%s: , __func__, x, ##args)
 #else
 #define DEBUG(x,args...)
 #endif

--
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 wireless/arlan] Replace logical- by bit-and

2008-01-10 Thread Roel Kluin
Randy Dunlap wrote:
 On Thu, 10 Jan 2008 20:15:53 +0100 Roel Kluin wrote:
 
 diff --git a/drivers/net/wireless/arlan.h b/drivers/net/wireless/arlan.h
 index 3ed1df7..7b7498f 100644
 --- a/drivers/net/wireless/arlan.h
 +++ b/drivers/net/wireless/arlan.h
 @@ -485,7 +485,7 @@ struct arlan_private {
  #define clearClearInterrupt(dev){\
 writeControlRegister(dev,readControlRegister(dev)  
 ~ARLAN_CLEAR_INTERRUPT);}
  #define setPowerOff(dev){\
 -   writeControlRegister(dev,readControlRegister(dev) | (ARLAN_POWER  
 ARLAN_ACCESS));\
 +   writeControlRegister(dev, readControlRegister(dev) | (ARLAN_POWER  
 ARLAN_ACCESS));\
 
 eh?  How does that help?

Right, sorry, please ignore my patch.

 Maybe it should be (ARLAN_POWER | ARLAN_ACCESS), but some
 arlan developer or someone with specs should help here...

I have CC'd the previous maintainers
--
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] [Coding Style]: fs/ext{3,4}/ext{3,4}_jbd{,2}.c

2008-01-11 Thread Roel Kluin
Paul Mundt wrote:
 On Fri, Jan 11, 2008 at 04:09:45AM +0100, Peter Stuge wrote:
 On Thu, Jan 10, 2008 at 10:03:58PM +0100, Roel Kluin wrote:
 -#define DEBUG(x,args...)   printk(__FUNCTION__ :  x,##args)
 +#define DEBUG(x, args...)  printk(%s: , __func__, x, ##args)
 Can this really be expected to work when x contains conversions?

 How about:

 #define DEBUG(x, args...) printk(%s:  x, __func__, ##args)

 How about throwing out hand-rolled debug printk wrappers for the
 brain-damage they are and using the ones the kernel provides instead?
 
Should it be done like this?
--
Replace printk wrapper - with a syntax error - by pr_debug

Signed-off-by: Roel Kluin [EMAIL PROTECTED]
---
diff --git a/drivers/pcmcia/au1000_xxs1500.c b/drivers/pcmcia/au1000_xxs1500.c
index ce9d5c4..4c32389 100644
--- a/drivers/pcmcia/au1000_xxs1500.c
+++ b/drivers/pcmcia/au1000_xxs1500.c
@@ -25,6 +25,10 @@
  *
  *
  */
+#ifdef CONFIG_MIPS_XXS1500_DEBUG
+#define DEBUG 1
+#endif
+
 #include linux/module.h
 #include linux/init.h
 #include linux/delay.h
@@ -55,11 +59,6 @@
 #define PCMCIA_NUM_SOCKS   (PCMCIA_MAX_SOCK + 1)
 #define PCMCIA_IRQ AU1000_GPIO_4
 
-#if 0
-#define DEBUG(x,args...)   printk(__FUNCTION__ :  x,##args)
-#else
-#define DEBUG(x,args...)
-#endif
 
 static int xxs1500_pcmcia_init(struct pcmcia_init *init)
 {
@@ -143,13 +142,13 @@ xxs1500_pcmcia_configure_socket(const struct 
pcmcia_configure *configure)
 
if(configure-sock  PCMCIA_MAX_SOCK) return -1;
 
-   DEBUG(Vcc %dV Vpp %dV, reset %d\n,
+   pr_debug(Vcc %dV Vpp %dV, reset %d\n,
configure-vcc, configure-vpp, configure-reset);
 
switch(configure-vcc){
case 33: /* Vcc 3.3V */
/* turn on power */
-   DEBUG(turn on power\n);
+   pr_debug(turn on power\n);
au_writel((au_readl(GPIO2_PINSTATE)  ~(114))|(130),
GPIO2_OUTPUT);
au_sync_delay(100);
@@ -166,7 +165,7 @@ xxs1500_pcmcia_configure_socket(const struct 
pcmcia_configure *configure)
}
 
if (!configure-reset) {
-   DEBUG(deassert reset\n);
+   pr_debug(deassert reset\n);
au_writel((au_readl(GPIO2_PINSTATE)  ~(14))|(120),
GPIO2_OUTPUT);
au_sync_delay(100);
@@ -174,7 +173,7 @@ xxs1500_pcmcia_configure_socket(const struct 
pcmcia_configure *configure)
GPIO2_OUTPUT);
}
else {
-   DEBUG(assert reset\n);
+   pr_debug(assert reset\n);
au_writel(au_readl(GPIO2_PINSTATE) | (14)|(120),
GPIO2_OUTPUT);
}

--
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] [Coding Style]: fs/ext{3,4}/ext{3,4}_jbd{,2}.c

2008-01-11 Thread Roel Kluin
Paul Mundt wrote:
 On Fri, Jan 11, 2008 at 10:45:30AM +0100, Roel Kluin wrote:
 Paul Mundt wrote:
 On Fri, Jan 11, 2008 at 04:09:45AM +0100, Peter Stuge wrote:
 On Thu, Jan 10, 2008 at 10:03:58PM +0100, Roel Kluin wrote:
 -#define DEBUG(x,args...) printk(__FUNCTION__ :  x,##args)
 +#define DEBUG(x, args...)printk(%s: , __func__, x, ##args)
 Can this really be expected to work when x contains conversions?

 How about:

 #define DEBUG(x, args...) printk(%s:  x, __func__, ##args)

 How about throwing out hand-rolled debug printk wrappers for the
 brain-damage they are and using the ones the kernel provides instead?

 Should it be done like this?
 --
 Replace printk wrapper - with a syntax error - by pr_debug

 Signed-off-by: Roel Kluin [EMAIL PROTECTED]
 
 Close. But in this case #define DEBUG is already instrumented by the
 subsystem-wide debug option if it's enabled, so it's preferable to use
 that and just drop the special debug Kconfig option completely.
 
 Take a look at how CONFIG_PCMCIA_DEBUG is handled.

In drivers/pcmcia/Makefile, when CONFIG_PCMCIA_DEBUG=y, it  gives
EXTRA_CFLAGS += -DDEBUG
which causes the definition of DEBUG as a macro, with definition 1.

 With DEBUG()-pr_debug() conversion here you've silently dropped the
 __func__ prefixing. Note that dev_dbg() is usually preferred when you can
 get a hold of a struct device pointer, as it takes care of prettifying
 the output with the driver name and so on, rather than the convention of
 adding a prefix. If you can't get at the struct device pointer, you'll
 probably just want to insert the __func__ prefixing manually at the
 callsites.

Ah, ok, then this should be right:
--
Replace printk wrapper - with a syntax error - by pr_debug.
DEBUG is defined 1 when CONFIG_PCMCIA_DEBUG is set.

Signed-off-by: Roel Kluin [EMAIL PROTECTED]
---
diff --git a/drivers/pcmcia/au1000_xxs1500.c b/drivers/pcmcia/au1000_xxs1500.c
index ce9d5c4..8e6426b 100644
--- a/drivers/pcmcia/au1000_xxs1500.c
+++ b/drivers/pcmcia/au1000_xxs1500.c
@@ -55,12 +55,6 @@
 #define PCMCIA_NUM_SOCKS   (PCMCIA_MAX_SOCK + 1)
 #define PCMCIA_IRQ AU1000_GPIO_4
 
-#if 0
-#define DEBUG(x,args...)   printk(__FUNCTION__ :  x,##args)
-#else
-#define DEBUG(x,args...)
-#endif
-
 static int xxs1500_pcmcia_init(struct pcmcia_init *init)
 {
return PCMCIA_NUM_SOCKS;
@@ -143,13 +137,13 @@ xxs1500_pcmcia_configure_socket(const struct 
pcmcia_configure *configure)
 
if(configure-sock  PCMCIA_MAX_SOCK) return -1;
 
-   DEBUG(Vcc %dV Vpp %dV, reset %d\n,
+   pr_debug(Vcc %dV Vpp %dV, reset %d\n,
configure-vcc, configure-vpp, configure-reset);
 
switch(configure-vcc){
case 33: /* Vcc 3.3V */
/* turn on power */
-   DEBUG(turn on power\n);
+   pr_debug(turn on power\n);
au_writel((au_readl(GPIO2_PINSTATE)  ~(114))|(130),
GPIO2_OUTPUT);
au_sync_delay(100);
@@ -166,7 +160,7 @@ xxs1500_pcmcia_configure_socket(const struct 
pcmcia_configure *configure)
}
 
if (!configure-reset) {
-   DEBUG(deassert reset\n);
+   pr_debug(deassert reset\n);
au_writel((au_readl(GPIO2_PINSTATE)  ~(14))|(120),
GPIO2_OUTPUT);
au_sync_delay(100);
@@ -174,7 +168,7 @@ xxs1500_pcmcia_configure_socket(const struct 
pcmcia_configure *configure)
GPIO2_OUTPUT);
}
else {
-   DEBUG(assert reset\n);
+   pr_debug(assert reset\n);
au_writel(au_readl(GPIO2_PINSTATE) | (14)|(120),
GPIO2_OUTPUT);
}
--
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] [Coding Style]: fs/ext{3,4}/ext{3,4}_jbd{,2}.c

2008-01-11 Thread Roel Kluin
Paul Mundt wrote:
 On Fri, Jan 11, 2008 at 12:04:14PM +0100, Roel Kluin wrote:
 Paul Mundt wrote:
 Take a look at how CONFIG_PCMCIA_DEBUG is handled.
 In drivers/pcmcia/Makefile, when CONFIG_PCMCIA_DEBUG=y, it  gives
 EXTRA_CFLAGS += -DDEBUG
 which causes the definition of DEBUG as a macro, with definition 1.

 With DEBUG()-pr_debug() conversion here you've silently dropped the
 __func__ prefixing. Note that dev_dbg() is usually preferred when you can
 get a hold of a struct device pointer, as it takes care of prettifying
 the output with the driver name and so on, rather than the convention of
 adding a prefix. If you can't get at the struct device pointer, you'll
 probably just want to insert the __func__ prefixing manually at the
 callsites.

 You're still changing the semantics here. The DEBUG() does __FUNCTION__
 prefixing, while pr_debug() does not. This should be something like
 pr_debug(%s: , __func__, ...); instead, if you want to maintain
 consistency. Beyond that, this looks fine, yes.

Somehow I overlooked your last point. Well, the original code had no
semantics - it wasn't working - but I get your point.

Below a patch to print the __func__'s. Note that all pr_debugs are in the
same function. Maybe the function name should be printed in the first
pr_debug only? If desired, I'll send another patch.
--
Replace printk wrapper - with a syntax error - by pr_debug; keep printing
the __func__'s. (DEBUG is defined 1 when CONFIG_PCMCIA_DEBUG is set)

Signed-off-by: Roel Kluin [EMAIL PROTECTED]
---
diff --git a/drivers/pcmcia/au1000_xxs1500.c b/drivers/pcmcia/au1000_xxs1500.c
index ce9d5c4..b4bad6e 100644
--- a/drivers/pcmcia/au1000_xxs1500.c
+++ b/drivers/pcmcia/au1000_xxs1500.c
@@ -55,12 +55,6 @@
 #define PCMCIA_NUM_SOCKS   (PCMCIA_MAX_SOCK + 1)
 #define PCMCIA_IRQ AU1000_GPIO_4
 
-#if 0
-#define DEBUG(x,args...)   printk(__FUNCTION__ :  x,##args)
-#else
-#define DEBUG(x,args...)
-#endif
-
 static int xxs1500_pcmcia_init(struct pcmcia_init *init)
 {
return PCMCIA_NUM_SOCKS;
@@ -143,13 +137,13 @@ xxs1500_pcmcia_configure_socket(const struct 
pcmcia_configure *configure)
 
if(configure-sock  PCMCIA_MAX_SOCK) return -1;
 
-   DEBUG(Vcc %dV Vpp %dV, reset %d\n,
+   pr_debug(%s: Vcc %dV Vpp %dV, reset %d\n, __func__,
configure-vcc, configure-vpp, configure-reset);
 
switch(configure-vcc){
case 33: /* Vcc 3.3V */
/* turn on power */
-   DEBUG(turn on power\n);
+   pr_debug(%s: turn on power\n, __func__);
au_writel((au_readl(GPIO2_PINSTATE)  ~(114))|(130),
GPIO2_OUTPUT);
au_sync_delay(100);
@@ -166,7 +160,7 @@ xxs1500_pcmcia_configure_socket(const struct 
pcmcia_configure *configure)
}
 
if (!configure-reset) {
-   DEBUG(deassert reset\n);
+   pr_debug(%s: deassert reset\n, __func__);
au_writel((au_readl(GPIO2_PINSTATE)  ~(14))|(120),
GPIO2_OUTPUT);
au_sync_delay(100);
@@ -174,7 +168,7 @@ xxs1500_pcmcia_configure_socket(const struct 
pcmcia_configure *configure)
GPIO2_OUTPUT);
}
else {
-   DEBUG(assert reset\n);
+   pr_debug(%s: assert reset\n, __func__);
au_writel(au_readl(GPIO2_PINSTATE) | (14)|(120),
GPIO2_OUTPUT);
}



--
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: [rfc-patch 07/11] Text Edit Lock - kprobes architecture independent support

2007-11-17 Thread Roel Kluin
Mathieu Desnoyers wrote:
 Use the mutual exclusion provided by the text edit lock in the kprobes code. 
 It
 allows coherent manipulation of the kernel code by other subsystems.
 
 Signed-off-by: Mathieu Desnoyers [EMAIL PROTECTED]
 Acked-by: Ananth N Mavinakayanahalli [EMAIL PROTECTED]
 CC: [EMAIL PROTECTED]
 CC: [EMAIL PROTECTED]
 CC: [EMAIL PROTECTED]
 CC: [EMAIL PROTECTED]
 ---
  kernel/kprobes.c |   19 +--
  1 file changed, 13 insertions(+), 6 deletions(-)
 
 Index: linux-2.6-lttng/kernel/kprobes.c
 ===
 --- linux-2.6-lttng.orig/kernel/kprobes.c 2007-09-07 10:12:06.0 
 -0400
 +++ linux-2.6-lttng/kernel/kprobes.c  2007-09-07 10:13:09.0 -0400
 @@ -43,6 +43,7 @@
  #include linux/seq_file.h
  #include linux/debugfs.h
  #include linux/kdebug.h
 +#include linux/memory.h
  
  #include asm-generic/sections.h
  #include asm/cacheflush.h
 @@ -568,9 +569,10 @@ static int __kprobes __register_kprobe(s
   goto out;
   }
  
 + kernel_text_lock();
   ret = arch_prepare_kprobe(p);
   if (ret)
 - goto out;
 + goto out_unlock_text;
  
   INIT_HLIST_NODE(p-hlist);
   hlist_add_head_rcu(p-hlist,
 @@ -578,7 +580,8 @@ static int __kprobes __register_kprobe(s
  
   if (kprobe_enabled)
   arch_arm_kprobe(p);
 -
 +out_unlock_text:
 + kernel_text_unlock();
  out:
   mutex_unlock(kprobe_mutex);
  
 @@ -621,8 +624,11 @@ valid_p:
* enabled - otherwise, the breakpoint would already have
* been removed. We save on flushing icache.
*/
 - if (kprobe_enabled)
 + if (kprobe_enabled) {
 + kernel_text_lock();
   arch_disarm_kprobe(p);
 + kernel_text_unlock();
 + }
   hlist_del_rcu(old_p-hlist);
   cleanup_p = 1;
   } else {
 @@ -644,9 +650,7 @@ valid_p:
   list_del_rcu(p-list);
   kfree(old_p);
   }
 - mutex_lock(kprobe_mutex);
   arch_remove_kprobe(p);
 - mutex_unlock(kprobe_mutex);
   } else {
   mutex_lock(kprobe_mutex);
   if (p-break_handler)
 @@ -717,7 +721,6 @@ static int __kprobes pre_handler_kretpro
   ri-rp = rp;
   ri-task = current;
   arch_prepare_kretprobe(ri, regs);
 -
   /* XXX(hch): why is there no hlist_move_head? */
   hlist_del(ri-uflist);
   hlist_add_head(ri-uflist, ri-rp-used_instances);
 @@ -940,8 +943,10 @@ static void __kprobes enable_all_kprobes
  
   for (i = 0; i  KPROBE_TABLE_SIZE; i++) {
   head = kprobe_table[i];
 + kernel_text_lock();
   hlist_for_each_entry_rcu(p, node, head, hlist)
   arch_arm_kprobe(p);
 + kernel_text_unlock();
   }

isn't it better to put the kernel_text_lock around the for loop?

  
   kprobe_enabled = true;
 @@ -969,10 +974,12 @@ static void __kprobes disable_all_kprobe
   printk(KERN_INFO Kprobes globally disabled\n);
   for (i = 0; i  KPROBE_TABLE_SIZE; i++) {
   head = kprobe_table[i];
 + kernel_text_lock();
   hlist_for_each_entry_rcu(p, node, head, hlist) {
   if (!arch_trampoline_kprobe(p))
   arch_disarm_kprobe(p);
   }
 + kernel_text_unlock();
   }

same question here

  
   mutex_unlock(kprobe_mutex);
 

-
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 7/8] UML - add virt_to_pte

2007-11-17 Thread Roel Kluin
Jeff Dike wrote:
 Turn um_virt_to_phys into virt_to_pte, cleaning up a horrid interface.
 
 It's also made non-static and declared in pgtable.h because it'll be
 needed when the stubs get a vma.
 
 Signed-off-by: Jeff Dike [EMAIL PROTECTED]
 ---
  arch/um/kernel/skas/uaccess.c |   56 
 +-
  include/asm-um/pgtable.h  |3 ++
  2 files changed, 26 insertions(+), 33 deletions(-)
 
 Index: linux-2.6.22/arch/um/kernel/skas/uaccess.c
 ===
 --- linux-2.6.22.orig/arch/um/kernel/skas/uaccess.c   2007-11-16 
 15:16:54.0 -0500
 +++ linux-2.6.22/arch/um/kernel/skas/uaccess.c2007-11-16 
 15:40:25.0 -0500
 @@ -13,70 +13,60 @@
  #include kern_util.h
  #include os.h
  
 -static void *um_virt_to_phys(struct task_struct *task, unsigned long addr,
 -  pte_t *pte_out)
 +pte_t *virt_to_pte(struct mm_struct *mm, unsigned long addr)
  {
   pgd_t *pgd;
   pud_t *pud;
   pmd_t *pmd;
 - pte_t *pte;
 - pte_t ptent;
  
 - if (task-mm == NULL)
 - return ERR_PTR(-EINVAL);
 - pgd = pgd_offset(task-mm, addr);
 + if (mm == NULL)
 + return NULL;
 +
 + pgd = pgd_offset(mm, addr);
   if (!pgd_present(*pgd))
 - return ERR_PTR(-EINVAL);
 + return NULL;
  
   pud = pud_offset(pgd, addr);
   if (!pud_present(*pud))
 - return ERR_PTR(-EINVAL);
 + return NULL;
  
   pmd = pmd_offset(pud, addr);
   if (!pmd_present(*pmd))
 - return ERR_PTR(-EINVAL);
 -
 - pte = pte_offset_kernel(pmd, addr);
 - ptent = *pte;
 - if (!pte_present(ptent))
 - return ERR_PTR(-EINVAL);
 + return NULL;
  
 - if (pte_out != NULL)
 - *pte_out = ptent;
 - return (void *) (pte_val(ptent)  PAGE_MASK) + (addr  ~PAGE_MASK);
 + return pte_offset_kernel(pmd, addr);
  }
  
 -static unsigned long maybe_map(unsigned long virt, int is_write)
 +static pte_t *maybe_map(unsigned long virt, int is_write)
  {
 - pte_t pte;
 - int err;
 + pte_t *pte = virt_to_pte(current-mm, virt);
 + int err, dummy_code;
  
 - void *phys = um_virt_to_phys(current, virt, pte);
 - int dummy_code;
 -
 - if (IS_ERR(phys) || (is_write  !pte_write(pte))) {
 + if ((pte == NULL) || !pte_present(*pte) ||
 + (is_write  !pte_write(*pte))) {
   err = handle_page_fault(virt, 0, is_write, 1, dummy_code);
   if (err)
 - return -1UL;
 - phys = um_virt_to_phys(current, virt, NULL);
 + return NULL;
 + pte = virt_to_pte(current-mm, virt);
   }
 - if (IS_ERR(phys))
 - phys = (void *) -1;
 + if (!pte_present(*pte))
 + pte = NULL;

shouldn't you check again for (pte == NULL)?

  
 - return (unsigned long) phys;
 + return pte;
  }
-
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 drivers/isdn/hardware/eicon/message.c] fix 'and' typo in eicons' AddInfo()

2007-12-17 Thread Roel Kluin
I have previously sent this to [EMAIL PROTECTED] and its
maintainer, but the error is still in linus' tree.
--
'!' has a higher priority than '', so as was the bit test masks a binary.

Signed-off-by: Roel Kluin [EMAIL PROTECTED]
---
diff --git a/drivers/isdn/hardware/eicon/message.c 
b/drivers/isdn/hardware/eicon/message.c
index ccd35d0..189b231 100644
--- a/drivers/isdn/hardware/eicon/message.c
+++ b/drivers/isdn/hardware/eicon/message.c
@@ -9027,7 +9027,7 @@ static byte AddInfo(byte   **add_i,
/* facility is a nested structure */
/* FTY can be more than once  */
 
-  if(esc_chi[0]  !(esc_chi[esc_chi[0]])0x7f )
+   if (esc_chi[0]  !(esc_chi[esc_chi[0]]  0x7f))
   {
 add_i[0] = (byte   *)\x02\x02\x00; /* use neither b nor d channel */
   }
--
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] asm-h8300: parentheses around definition CLOCK_TICK_RATE

2007-11-29 Thread Roel Kluin
Some places where CLOCK_TICK_RATE may be used incorrectly:

arch/arm/mach-mx3/time.c:125:   __raw_writel((v / CLOCK_TICK_RATE) - 1, 
MXC_GPT_GPTPR);
drivers/watchdog/davinci_wdt.c:103: timer_margin = (((u64)heartbeat * 
CLOCK_TICK_RATE)  0x);
drivers/watchdog/davinci_wdt.c:105: timer_margin = (((u64)heartbeat * 
CLOCK_TICK_RATE)  32);
drivers/watchdog/ks8695_wdt.c:64:   unsigned long tval = wdt_time * 
CLOCK_TICK_RATE;

I'm not sure whether this definition is used there, but adding parentheses
should be good anyways.
--
Add parentheses to prevent operator precedence errors

Signed-off-by: Roel Kluin [EMAIL PROTECTED]
---
diff --git a/include/asm-h8300/timex.h b/include/asm-h8300/timex.h
index 2041314..23e6701 100644
--- a/include/asm-h8300/timex.h
+++ b/include/asm-h8300/timex.h
@@ -6,7 +6,7 @@
 #ifndef _ASM_H8300_TIMEX_H
 #define _ASM_H8300_TIMEX_H
 
-#define CLOCK_TICK_RATE CONFIG_CPU_CLOCK*1000/8192 /* Timer input freq. */
+#define CLOCK_TICK_RATE (CONFIG_CPU_CLOCK*1000/8192) /* Timer input freq. */
 
 typedef unsigned long cycles_t;
 extern short h8300_timer_count;
-
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?] OSS: fix operator precedence in return of btaudio_dsp_ioctl

2007-11-29 Thread Roel Kluin
First of all, is /sound/oss/* still maintained?

#define HWBASE_AD (448000)
...
with if(bta-analog) evaluating to true bta-decimation may range
from 15 to 5
...
HWBASE_AD*4/bta-decimationbta-sampleshift

which is equivalent to 

((HWBASE_AD * 4)/bta-decimation)  bta-sampleshift

actually may evaluate to something like:

(1792000 / 15 )  bta-sampleshift

Isn't intended (HWBASE_AD * 4)/(bta-decimation  bta-sampleshift)?
Then consider the patch below.
--
Fix operator precedence in return

Signed-off-by: Roel Kluin [EMAIL PROTECTED]
---
diff --git a/sound/oss/btaudio.c b/sound/oss/btaudio.c
index 4d5cf05..2a5cace 100644
--- a/sound/oss/btaudio.c
+++ b/sound/oss/btaudio.c
@@ -661,7 +661,8 @@ static int btaudio_dsp_ioctl(struct inode *inode, struct 
file *file,
/* fall through */
 case SOUND_PCM_READ_RATE:
if (bta-analog) {
-   return 
put_user(HWBASE_AD*4/bta-decimationbta-sampleshift, p);
+   return put_user((HWBASE_AD * 4) /
+   (bta-decimation  bta-sampleshift), p);
} else {
return put_user(bta-rate, p);
}
-
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] asm-arm/{arch-omap,arch-ixp23xx}: parentheses around NR_IRQS definition

2007-11-28 Thread Roel Kluin
in include/asm-arm/arch-omap/board-innovator.h:40
#define NR_IRQSIH_BOARD_BASE + NR_FPGA_IRQS

in include/asm-arm/arch-ixp23xx/irqs.h:156:
#define NR_IRQS  NR_IXP23XX_IRQS + NR_IXP23XX_MACH_IRQS

This could lead to problems when this definition is used in:

arch/ia64/sn/kernel/irq.c:516:
sn_irq_lh = kmalloc(sizeof(struct list_head *) * NR_IRQS, GFP_KERNEL);
arch/x86/kernel/io_apic_32.c:693:
irq_cpu_data[i].irq_delta = kmalloc(sizeof(unsigned long) * NR_IRQS, 
GFP_KERNEL);
694:
irq_cpu_data[i].last_irq = kmalloc(sizeof(unsigned long) * NR_IRQS, GFP_KERNEL);
699:
memset(irq_cpu_data[i].irq_delta,0,sizeof(unsigned long) * NR_IRQS);
700:
memset(irq_cpu_data[i].last_irq,0,sizeof(unsigned long) * NR_IRQS);
fs/proc/proc_misc.c:464:
per_irq_sum = kzalloc(sizeof(unsigned int)*NR_IRQS, GFP_KERNEL);

I am not sure whether this definition actually is used in any of these files.
Am I being paranoya? anyway, adding parentheses should be safe.
--
Add parentheses to prevent operator precedence errors

Signed-off-by: Roel Kluin [EMAIL PROTECTED]
---
diff --git a/include/asm-arm/arch-ixp23xx/irqs.h 
b/include/asm-arm/arch-ixp23xx/irqs.h
index e696395..27c5808 100644
--- a/include/asm-arm/arch-ixp23xx/irqs.h
+++ b/include/asm-arm/arch-ixp23xx/irqs.h
@@ -153,7 +153,7 @@
  */
 #define NR_IXP23XX_MACH_IRQS   32
 
-#define NR_IRQSNR_IXP23XX_IRQS + 
NR_IXP23XX_MACH_IRQS
+#define NR_IRQS(NR_IXP23XX_IRQS + 
NR_IXP23XX_MACH_IRQS)
 
 #define IXP23XX_MACH_IRQ(irq)  (NR_IXP23XX_IRQ + (irq))
 
diff --git a/include/asm-arm/arch-omap/board-innovator.h 
b/include/asm-arm/arch-omap/board-innovator.h
index b3cf334..56d2c98 100644
--- a/include/asm-arm/arch-omap/board-innovator.h
+++ b/include/asm-arm/arch-omap/board-innovator.h
@@ -37,7 +37,7 @@
 #define OMAP1510P1_EMIFF_PRI_VALUE 0x00
 
 #define NR_FPGA_IRQS   24
-#define NR_IRQS IH_BOARD_BASE + NR_FPGA_IRQS
+#define NR_IRQS (IH_BOARD_BASE + NR_FPGA_IRQS)
 
 #ifndef __ASSEMBLY__
 void fpga_write(unsigned char val, int reg);
-
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] asm-arm/{arch-omap,arch-ixp23xx}: parentheses around NR_IRQS definition

2007-11-28 Thread Roel Kluin
Roel Kluin wrote:
 Add parentheses to prevent operator precedence errors
 
 Signed-off-by: Roel Kluin [EMAIL PROTECTED]

For the arch-ixp23xx part I should have added:
Acked-by: Lennert Buytenhek [EMAIL PROTECTED]
-
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] net/e1000: fix memcpy in e1000_get_strings

2007-11-28 Thread Roel Kluin
drivers/net/e1000/e1000_ethtool.c:113:
#define E1000_TEST_LEN sizeof(e1000_gstrings_test) / ETH_GSTRING_LEN

drivers/net/e1000e/ethtool.c:106:
#define E1000_TEST_LEN sizeof(e1000_gstrings_test) / ETH_GSTRING_LEN

E1000_TEST_LEN*ETH_GSTRING_LEN will expand to 
sizeof(e1000_gstrings_test) / (ETH_GSTRING_LEN * ETH_GSTRING_LEN)

Please confirm that the change is as wanted.
--
A lack of parentheses around defines causes unexpected results due to operator
precedences.

Signed-off-by: Roel Kluin [EMAIL PROTECTED]
---
diff --git a/drivers/net/e1000/e1000_ethtool.c 
b/drivers/net/e1000/e1000_ethtool.c
index 667f18b..b83ccce 100644
--- a/drivers/net/e1000/e1000_ethtool.c
+++ b/drivers/net/e1000/e1000_ethtool.c
@@ -1923,7 +1923,7 @@ e1000_get_strings(struct net_device *netdev, uint32_t 
stringset, uint8_t *data)
switch (stringset) {
case ETH_SS_TEST:
memcpy(data, *e1000_gstrings_test,
-   E1000_TEST_LEN*ETH_GSTRING_LEN);
+   sizeof(e1000_gstrings_test));
break;
case ETH_SS_STATS:
for (i = 0; i  E1000_GLOBAL_STATS_LEN; i++) {
diff --git a/drivers/net/e1000e/ethtool.c b/drivers/net/e1000e/ethtool.c
index 6a39784..338c49d 100644
--- a/drivers/net/e1000e/ethtool.c
+++ b/drivers/net/e1000e/ethtool.c
@@ -1739,7 +1739,7 @@ static void e1000_get_strings(struct net_device *netdev, 
u32 stringset,
switch (stringset) {
case ETH_SS_TEST:
memcpy(data, *e1000_gstrings_test,
-   E1000_TEST_LEN*ETH_GSTRING_LEN);
+   sizeof(e1000_gstrings_test));
break;
case ETH_SS_STATS:
for (i = 0; i  E1000_GLOBAL_STATS_LEN; i++) {
-
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] fix 'and' typos in drivers/block/pktcdvd.c

2007-10-27 Thread Roel Kluin
Fix two 'and' typos

Signed-off-by: Roel Kluin [EMAIL PROTECTED]
---
diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c
index a8130a4..9cd6ba2 100644
--- a/drivers/block/pktcdvd.c
+++ b/drivers/block/pktcdvd.c
@@ -2202,11 +2202,11 @@ static int pkt_media_speed(struct pktcdvd_device *pd, 
unsigned *speed)
return ret;
}
 
-   if (!buf[6]  0x40) {
+   if (!(buf[6]  0x40)) {
printk(DRIVER_NAME: Disc type is not CD-RW\n);
return 1;
}
-   if (!buf[6]  0x4) {
+   if (!(buf[6]  0x4)) {
printk(DRIVER_NAME: A1 values on media are not valid, maybe 
not CDRW?\n);
return 1;
}
-
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] fix 'and' typo in drivers/block/paride/pt.c

2007-10-27 Thread Roel Kluin
Fix 'and' typo (PT_WRITE_OK is defined 2)

Signed-off-by: Roel Kluin [EMAIL PROTECTED]
---
diff --git a/drivers/block/paride/pt.c b/drivers/block/paride/pt.c
index 9f4e67e..b91accf 100644
--- a/drivers/block/paride/pt.c
+++ b/drivers/block/paride/pt.c
@@ -664,7 +664,7 @@ static int pt_open(struct inode *inode, struct file *file)
goto out;
 
err = -EROFS;
-   if ((!tape-flags  PT_WRITE_OK)  (file-f_mode  2))
+   if ((!(tape-flags  PT_WRITE_OK))  (file-f_mode  2))
goto out;
 
if (!(iminor(inode)  128))
-
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/


Debugging activated during runtime

2007-10-28 Thread Roel Kluin
Wouldn't it be nice to be able to specify upon loading, or during runtime
to modules whether debug messages should be printed?
- No kernel recompile needed for debugging.
- Less *_DEBUG options required in menuconfig.

How I think this could work:
Add to the module struct a bool to denote debugging state. If set, pr_debug
forwards messages to printk.

Another advantage:
- A module could be loaded after an unexpected conditions (e.g. after a BUG_ON).

Caveats I can see right now:
- For modules often loaded during boot this may not be a good solution.

Alternatively, instead of a bool for the debug state, the module struct could
also get a log-level flag: messages below that level won't be printed.
-
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: Debugging activated during runtime

2007-10-28 Thread Roel Kluin
Jan Engelhardt wrote:
 On Oct 28 2007 16:15, Roel Kluin wrote:
 Wouldn't it be nice to be able to specify upon loading, or during runtime
 to modules whether debug messages should be printed?
 
 modprobe ark3116 debug=1
 
 Nothing new.

Ok, thanks and sorry, I didn't know that.

 - A module could be loaded after an unexpected conditions (e.g. after a 
 BUG_ON).
 
 After a BUG_ON, you are probably next to a panic.

Not always, it appears.
-
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/


build failure, missing libvdeplug.h?

2007-10-29 Thread Roel Kluin
Building uml with an allyesconfig and a few changes in UML only fails with:

...
  CC  arch/um/drivers/vde_user.o
/home/roel/dnld/src/kernel/git/linux-2.6/arch/um/drivers/vde_user.c:8:24: 
error: libvdeplug.h: No such file or directory
/home/roel/dnld/src/kernel/git/linux-2.6/arch/um/drivers/vde_user.c: In 
function 'vde_user_init':
/home/roel/dnld/src/kernel/git/linux-2.6/arch/um/drivers/vde_user.c:18: error: 
'VDECONN' undeclared (first use in this function)
...

the file libvdeplug.h is missing and I can't find it neither in the tree or on
the net. 'git-grep VDECONN' shows that VDECONN isn't defined anywhere.

this code was added in this commit:

--
commit ad43c3565bebada7e5a13288e37542fd940369e8
Author: Jeff Dike [EMAIL PROTECTED]
Date:   Tue Oct 16 01:26:48 2007 -0700

uml: add VDE networking support

Added vde network backend in uml to introduce native Virtual Distributed
Ethernet support (using libvdeplug).

Signed-off-by: Luca Bigliardi [EMAIL PROTECTED]
Signed-off-by: Jeff Dike [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
Signed-off-by: Linus Torvalds [EMAIL PROTECTED]
--

There is a reference to http://wiki.virtualsquare.org/index.php/Main_Page in
the Kconfig (also added by this commit).
After reverting this commit the build continues. possibly the header 
libvdeplug.h was forgotten?

Roel
-
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: build failure, missing libvdeplug.h?

2007-10-29 Thread Roel Kluin
Roel Kluin wrote:
 the file libvdeplug.h is missing

 
 There is a reference to http://wiki.virtualsquare.org/index.php/Main_Page in
 the Kconfig (also added by this commit).
 After reverting this commit the build continues. possibly the header 
 libvdeplug.h was forgotten?

Sorry for answering myself, but apparently it can be found here:

http://vde.sourceforge.net/

I think, however that there is a 'depends on' missing in kconfig - to prevent 
build
failure?
-
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 9/16] CRIS architecture: Correct compile errors

2007-10-30 Thread Roel Kluin
Jesper Nilsson wrote:

  static int
  e100_probe_transceiver(struct net_device* dev)
  {
 +#if !defined(CONFIG_ETRAX_NO_PHY)
   unsigned int phyid_high;
   unsigned int phyid_low;
   unsigned int oui;
   struct transceiver_ops* ops = NULL;
 + struct net_local *np = netdev_priv(dev);
 +
 + spin_lock(np-transceiver_lock);
  
   /* Probe MDIO physical address */
 - for (mdio_phy_addr = 0; mdio_phy_addr = 31; mdio_phy_addr++) {
 - if (e100_get_mdio_reg(dev, mdio_phy_addr, MII_BMSR) != 0x)
 + for (np-mii_if.phy_id = 0; np-mii_if.phy_id = 31; 
 +  np-mii_if.phy_id++) {
 + if (e100_get_mdio_reg(dev, 
 +   np-mii_if.phy_id, MII_BMSR) != 0x)
   break;
   }
 - if (mdio_phy_addr == 32)
 + if (np-mii_if.phy_id == 32)
return -ENODEV;
You need to unlock before this return.
  
   /* Get manufacturer */
 - phyid_high = e100_get_mdio_reg(dev, mdio_phy_addr, MII_PHYSID1);
 - phyid_low = e100_get_mdio_reg(dev, mdio_phy_addr, MII_PHYSID2);
 + phyid_high = e100_get_mdio_reg(dev, np-mii_if.phy_id, MII_PHYSID1);
 + phyid_low = e100_get_mdio_reg(dev, np-mii_if.phy_id, MII_PHYSID2);
   oui = (phyid_high  6) | (phyid_low  10);
  
   for (ops = transceivers[0]; ops-oui; ops++) {
 @@ -998,6 +912,8 @@
   }
   transceiver = ops;
  
 + spin_unlock(np-transceiver_lock);
 +#endif
   return 0;
  }
-
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] several returns before unlocking in lmc_ioctl

2007-10-30 Thread Roel Kluin
Kristof Provost wrote:
 On 2007-10-23 03:47:48 (+0200), Roel Kluin [EMAIL PROTECTED] wrote:
 I think we should keep the lmc_tracing. Use this patch instead.

 --
 Several returns before unlocking in lmc_ioctl
 
 Signed-off-by: Roel Kluin [EMAIL PROTECTED]
 ---
 diff --git a/drivers/net/wan/lmc/lmc_main.c b/drivers/net/wan/lmc/lmc_main.c
 index 5ea8772..64eb578 100644
 snip
 @@ -229,9 +234,10 @@ int lmc_ioctl (struct net_device *dev, struct ifreq 
 *ifr, int cmd) /*fold00*/
  sc-lmc_xinfo.Magic1 = 0xDEADBEEF;
  
  if (copy_to_user(ifr-ifr_data, sc-lmc_xinfo,
 - sizeof (struct lmc_xinfo)))
 -return -EFAULT;
 -ret = 0;
 +sizeof(struct lmc_xinfo))) {
 +ret = -EFAULT;
 +else
 +ret = 0;
 I think you have an extra curly brace there. It breaks compile on my
 system.


You are right. thanks for notifying me and sorry for the trouble.
please revert my patch (b463d40cdc436a12799a60a1d6ff1941a70a5bb6)

and try instead:
--
Several returns before unlocking in lmc_ioctl

Signed-off-by: Roel Kluin [EMAIL PROTECTED]
---
diff --git a/drivers/net/wan/lmc/lmc_main.c b/drivers/net/wan/lmc/lmc_main.c
index 5ea8772..427226d 100644
--- a/drivers/net/wan/lmc/lmc_main.c
+++ b/drivers/net/wan/lmc/lmc_main.c
@@ -142,9 +142,10 @@ int lmc_ioctl (struct net_device *dev, struct ifreq *ifr, 
int cmd) /*fold00*/
  * To date internally, just copy this out to the user.
  */
 case LMCIOCGINFO: /*fold01*/
-if (copy_to_user(ifr-ifr_data, sc-ictl, sizeof (lmc_ctl_t)))
-return -EFAULT;
-ret = 0;
+   if (copy_to_user(ifr-ifr_data, sc-ictl, sizeof(lmc_ctl_t)))
+   ret = -EFAULT;
+   else
+   ret = 0;
 break;
 
 case LMCIOCSINFO: /*fold01*/
@@ -159,8 +160,10 @@ int lmc_ioctl (struct net_device *dev, struct ifreq *ifr, 
int cmd) /*fold00*/
 break;
 }
 
-if (copy_from_user(ctl, ifr-ifr_data, sizeof (lmc_ctl_t)))
-return -EFAULT;
+   if (copy_from_user(ctl, ifr-ifr_data, sizeof(lmc_ctl_t))) {
+   ret = -EFAULT;
+   break;
+   }
 
 sc-lmc_media-set_status (sc, ctl);
 
@@ -190,8 +193,10 @@ int lmc_ioctl (struct net_device *dev, struct ifreq *ifr, 
int cmd) /*fold00*/
break;
}
 
-   if (copy_from_user(new_type, ifr-ifr_data, sizeof(u_int16_t)))
-return -EFAULT;
+   if (copy_from_user(new_type, ifr-ifr_data, sizeof(u_int16_t))) {
+   ret = -EFAULT;
+   break;
+   }
 
 
if (new_type == old_type)
@@ -229,9 +234,10 @@ int lmc_ioctl (struct net_device *dev, struct ifreq *ifr, 
int cmd) /*fold00*/
 sc-lmc_xinfo.Magic1 = 0xDEADBEEF;
 
 if (copy_to_user(ifr-ifr_data, sc-lmc_xinfo,
- sizeof (struct lmc_xinfo)))
-return -EFAULT;
-ret = 0;
+   sizeof(struct lmc_xinfo)))
+   ret = -EFAULT;
+   else
+   ret = 0;
 
 break;
 
@@ -262,9 +268,9 @@ int lmc_ioctl (struct net_device *dev, struct ifreq *ifr, 
int cmd) /*fold00*/
 
 if (copy_to_user(ifr-ifr_data, sc-stats,
  sizeof (struct lmc_statistics)))
-return -EFAULT;
-
-ret = 0;
+   ret = -EFAULT;
+   else
+   ret = 0;
 break;
 
 case LMCIOCCLEARLMCSTATS: /*fold01*/
@@ -292,8 +298,10 @@ int lmc_ioctl (struct net_device *dev, struct ifreq *ifr, 
int cmd) /*fold00*/
 break;
 }
 
-if (copy_from_user(ctl, ifr-ifr_data, sizeof (lmc_ctl_t)))
-return -EFAULT;
+   if (copy_from_user(ctl, ifr-ifr_data, sizeof(lmc_ctl_t))) {
+   ret = -EFAULT;
+   break;
+   }
 sc-lmc_media-set_circuit_type(sc, ctl.circuit_type);
 sc-ictl.circuit_type = ctl.circuit_type;
 ret = 0;
@@ -318,12 +326,15 @@ int lmc_ioctl (struct net_device *dev, struct ifreq *ifr, 
int cmd) /*fold00*/
 
 #ifdef DEBUG
 case LMCIOCDUMPEVENTLOG:
-if (copy_to_user(ifr-ifr_data, lmcEventLogIndex, sizeof (u32)))
-return -EFAULT;
+   if (copy_to_user(ifr-ifr_data, lmcEventLogIndex, sizeof(u32))) {
+   ret = -EFAULT;
+   break;
+   }
 if (copy_to_user(ifr-ifr_data + sizeof (u32), lmcEventLogBuf, sizeof 
(lmcEventLogBuf)))
-return -EFAULT;
+   ret = -EFAULT;
+   else
+   ret = 0;
 
-ret = 0;
 break;
 #endif /* end ifdef _DBG_EVENTLOG */
 case LMCIOCT1CONTROL: /*fold01*/
@@ -346,8 +357,10 @@ int lmc_ioctl (struct net_device *dev, struct ifreq *ifr, 
int cmd) /*fold00*/
  */
 netif_stop_queue(dev);
 
-if (copy_from_user(xc, ifr-ifr_data, sizeof (struct 
lmc_xilinx_control

Re: [2.6 patch] fix drivers/net/wan/lmc/ compilation

2007-10-30 Thread Roel Kluin
Adrian Bunk wrote:
 Documentation/SubmitChecklist, point 1:
 
 --  snip  --
 
 ...
   CC  drivers/net/wan/lmc/lmc_main.o
 /home/bunk/linux/kernel-2.6/git/linux-2.6/drivers/net/wan/lmc/lmc_main.c: In 
 function ‘lmc_ioctl’:
 /home/bunk/linux/kernel-2.6/git/linux-2.6/drivers/net/wan/lmc/lmc_main.c:239: 
 error: expected expression before ‘else’
 ...
 make[5]: *** [drivers/net/wan/lmc/lmc_main.o] Error 1
 
 --  snip  --
 
 Signed-off-by: Adrian Bunk [EMAIL PROTECTED]
 
 ---
 d5e92a30491abf073e0a7f4d46b466c7c97f0f61 
 diff --git a/drivers/net/wan/lmc/lmc_main.c b/drivers/net/wan/lmc/lmc_main.c
 index 64eb578..37c52e1 100644
 --- a/drivers/net/wan/lmc/lmc_main.c
 +++ b/drivers/net/wan/lmc/lmc_main.c
 @@ -234,7 +234,7 @@ int lmc_ioctl (struct net_device *dev, struct ifreq *ifr, 
 int cmd) /*fold00*/
  sc-lmc_xinfo.Magic1 = 0xDEADBEEF;
  
  if (copy_to_user(ifr-ifr_data, sc-lmc_xinfo,
 - sizeof(struct lmc_xinfo))) {
 +  sizeof(struct lmc_xinfo)))
   ret = -EFAULT;
   else
   ret = 0;
 

I am sorry, my patch broke this and Kristov Provost also noticed this.
See http://lkml.org/lkml/2007/10/30/355


-
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 returns] fix not-and/or errors

2007-10-18 Thread Roel Kluin
Thanks for comments, here a second version with previously covered commits 
removed

Signed-off-by: Roel Kluin [EMAIL PROTECTED]
---
diff --git a/arch/arm/mach-pxa/mfp.c b/arch/arm/mach-pxa/mfp.c
index 5cd3cad..7229319 100644
--- a/arch/arm/mach-pxa/mfp.c
+++ b/arch/arm/mach-pxa/mfp.c
@@ -199,7 +199,7 @@ void pxa3xx_mfp_set_edge(int mfp, int edge)
 
mfpr_val = ~MFPR_EDGE_MASK;
mfpr_val |= (edge  0x3u)  MFPR_ERE_OFFSET;
-   mfpr_val |= (!edge  0x1)  MFPR_EC_OFFSET;
+   mfpr_val |= (!(edge  0x1))  MFPR_EC_OFFSET;
 
mfpr_writel(mfpr_off, mfpr_val);
mfpr_sync();
diff --git a/arch/sh/drivers/dma/dma-sh.c b/arch/sh/drivers/dma/dma-sh.c
index 958bac1..e8f9c85 100644
--- a/arch/sh/drivers/dma/dma-sh.c
+++ b/arch/sh/drivers/dma/dma-sh.c
@@ -89,7 +89,7 @@ static irqreturn_t dma_tei(int irq, void *dev_id)
 
 static int sh_dmac_request_dma(struct dma_channel *chan)
 {
-   if (unlikely(!chan-flags  DMA_TEI_CAPABLE))
+   if (unlikely(!(chan-flags  DMA_TEI_CAPABLE)))
return 0;
 
return request_irq(get_dmte_irq(chan-chan), dma_tei,
diff --git a/drivers/acpi/asus_acpi.c b/drivers/acpi/asus_acpi.c
index d915fec..1db2055 100644
--- a/drivers/acpi/asus_acpi.c
+++ b/drivers/acpi/asus_acpi.c
@@ -596,7 +596,7 @@ write_led(const char __user * buffer, unsigned long count,
(led_out) ? (hotk-status | ledmask) : (hotk-status  ~ledmask);
 
if (invert) /* invert target value */
-   led_out = !led_out  0x1;
+   led_out = !led_out;
 
if (!write_acpi_int(hotk-handle, ledname, led_out, NULL))
printk(KERN_WARNING Asus ACPI: LED (%s) write failed\n,
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c
index 9b2c0f7..3762ce2 100644
--- a/drivers/acpi/battery.c
+++ b/drivers/acpi/battery.c
@@ -420,8 +420,7 @@ static int acpi_battery_update(struct acpi_battery *battery,
result = acpi_battery_get_status(battery);
if (result)
goto end;
-   if ((!battery-flags.battery_present_prev  
acpi_battery_present(battery))
-   || (battery-flags.battery_present_prev  
!acpi_battery_present(battery))) {
+   if (battery-flags.battery_present_prev != 
acpi_battery_present(battery)) {
result = acpi_battery_init_update(battery);
if (result)
goto end;
@@ -448,10 +447,7 @@ static void acpi_battery_notify_update(struct acpi_battery 
*battery)
return;
}
 
-   if ((!battery-flags.battery_present_prev 
-acpi_battery_present(battery)) ||
-   (battery-flags.battery_present_prev 
-!acpi_battery_present(battery))) {
+   if (battery-flags.battery_present_prev != 
acpi_battery_present(battery)) {
battery-flags.init_update = 1;
} else {
battery-flags.update[ACPI_BATTERY_INFO] = 1;

-
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/4] fix not-and/or errors

2007-10-18 Thread Roel Kluin
Al Viro wrote:
 On Wed, Oct 17, 2007 at 03:46:43PM +0200, Roel Kluin wrote:
 +++ b/drivers/misc/asus-laptop.c
 @@ -322,7 +322,7 @@ static void write_status(acpi_handle handle, int out, 
 int mask)
  
  switch (mask) {
  case MLED_ON:
 -out = !out  0x1;
 +out = !(out  0x1);
 
 Not sure if that's what had been intended.

It seems to me if I look at the code, that it's intended to make a bool out of 
'out'. That's
nonsense because of the precedence the ! will turn it into a boolean before the 
 0x1.

x = !x  y behaves like x = !x for y != 0. 
for y = 1 the behavior is even the same for x = !(x  y)
so it does not matter in this case, except for clarity. I'll make it out = !out.

 
 @@ -2882,7 +2882,7 @@ static int st_int_ioctl(struct scsi_tape *STp, 
 unsigned int cmd_in, unsigned lon
  !(STp-use_pf  PF_TESTED)) {
  /* Try the other possible state of Page Format 
 if not
 already tried */
 -STp-use_pf = !STp-use_pf | PF_TESTED;
 +STp-use_pf = !(STp-use_pf | PF_TESTED);
 
 Wrong.  This code, ugly as it is, happens to be correct.  Replacement
 isn't.  I would rewrite it as ^= PF_TESTED | USE_PF; /* remove USE_PF, set *
 * PF_TESTED */
 
 The rest is covered by Alexey's patch and one I'd posted as followup.


ok, thanks, I'll correct and omit these in my follow up patch.

Roel
-
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/4] fix not-and/or errors

2007-10-18 Thread Roel Kluin
previously applied changes removed and changed as suggested.

Signed-off-by: Roel Kluin [EMAIL PROTECTED]
---
diff --git a/drivers/misc/asus-laptop.c b/drivers/misc/asus-laptop.c
index 7dce318..752ae26 100644
--- a/drivers/misc/asus-laptop.c
+++ b/drivers/misc/asus-laptop.c
@@ -322,7 +322,7 @@ static void write_status(acpi_handle handle, int out, int 
mask)
 
switch (mask) {
case MLED_ON:
-   out = !out  0x1;
+   out = !out;
break;
case GLED_ON:
out = (out  0x1) + 1;
diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c
index 73c44cb..289165e 100644
--- a/drivers/scsi/st.c
+++ b/drivers/scsi/st.c
@@ -2882,7 +2882,8 @@ static int st_int_ioctl(struct scsi_tape *STp, unsigned 
int cmd_in, unsigned lon
!(STp-use_pf  PF_TESTED)) {
/* Try the other possible state of Page Format 
if not
   already tried */
-   STp-use_pf = !STp-use_pf | PF_TESTED;
+   STp-use_pf ^= PF_TESTED | USE_PF; /* remove 
USE_PF, set *
+   * PF_TESTED 
*/
st_release_request(SRpnt);
SRpnt = NULL;
return st_int_ioctl(STp, cmd_in, arg);

-
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 9/9] RT: Only dirty a cacheline if the priority is actually changing

2007-10-19 Thread Roel Kluin
Gregory Haskins wrote:
 We can avoid dirtying a rq related cacheline with a simple check, so why not.
 
 Signed-off-by: Gregory Haskins [EMAIL PROTECTED]
 ---
 
  0 files changed, 0 insertions(+), 0 deletions(-)

I think you wanted a patch here?
-
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] errors with assignments in if

2007-10-21 Thread Roel Kluin
I am not entirely certain about the third one:

from fs/udf/udf_sb.h:

#define UDF_SB_VAT(X)   ( UDF_SB(X)-s_vat )

if it's the desired behavior then I think this should at least be changed to

UDF_SB_VAT(sb) = udf_iget(sb, ino);
if (!(UDF_SB_VAT(sb)))

---
Errors with assignments in ifs

Signed-off-by: Roel Kluin [EMAIL PROTECTED]
---
diff --git a/arch/arm/mach-omap2/clock.c b/arch/arm/mach-omap2/clock.c
index d9af436..e6e85b7 100644
--- a/arch/arm/mach-omap2/clock.c
+++ b/arch/arm/mach-omap2/clock.c
@@ -651,7 +651,7 @@ static u32 omap2_get_clksel(u32 *div_sel, u32 *field_mask,
break;
case CM_SYSCLKOUT_SEL1:
div_addr = (u32)PRCM_CLKOUT_CTRL;
-   if ((div_off == 3) || (div_off = 11))
+   if ((div_off == 3) || (div_off == 11))
mask= 0x3;
break;
case CM_CORE_SEL1:
diff --git a/drivers/isdn/hisax/elsa.c b/drivers/isdn/hisax/elsa.c
index 948a9b2..ed610ed 100644
--- a/drivers/isdn/hisax/elsa.c
+++ b/drivers/isdn/hisax/elsa.c
@@ -883,7 +883,7 @@ setup_elsa_isa(struct IsdnCard *card)
val += 'A' - 3;
if (val == 'B' || val == 'C')
val ^= 1;
-   if ((cs-subtyp == ELSA_PCFPRO)  (val = 'G'))
+   if ((cs-subtyp == ELSA_PCFPRO)  (val == 'G'))
val = 'C';
printk(KERN_INFO
   Elsa: %s found at %#lx Rev.:%c IRQ %d\n,
diff --git a/fs/udf/super.c b/fs/udf/super.c
index 4360c7a..353c9e8 100644
--- a/fs/udf/super.c
+++ b/fs/udf/super.c
@@ -1308,7 +1308,7 @@ static int udf_load_partition(struct super_block *sb, 
kernel_lb_addr *fileset)
if (j == UDF_SB_NUMPARTS(sb))
return 1;
 
-   if (!(UDF_SB_VAT(sb) = udf_iget(sb, ino)))
+   if (!(UDF_SB_VAT(sb) == udf_iget(sb, ino)))
return 1;
 
if (UDF_SB_PARTTYPE(sb, i) == UDF_VIRTUAL_MAP15) {
-
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] errors with assignments in if

2007-10-21 Thread Roel Kluin
Roel Kluin wrote:
 I am not entirely certain about the third one:
 
 from fs/udf/udf_sb.h:
 
 #define UDF_SB_VAT(X)   ( UDF_SB(X)-s_vat )
 
 if it's the desired behavior then I think this should at least be changed to
 
 UDF_SB_VAT(sb) = udf_iget(sb, ino);
 if (!(UDF_SB_VAT(sb)))

On a second glance, I think it's the desired behavior. Use this patch instead.
---
Errors with assignments in ifs

Signed-off-by: Roel Kluin [EMAIL PROTECTED]

diff --git a/arch/arm/mach-omap2/clock.c b/arch/arm/mach-omap2/clock.c
index d9af436..e6e85b7 100644
--- a/arch/arm/mach-omap2/clock.c
+++ b/arch/arm/mach-omap2/clock.c
@@ -651,7 +651,7 @@ static u32 omap2_get_clksel(u32 *div_sel, u32 *field_mask,
break;
case CM_SYSCLKOUT_SEL1:
div_addr = (u32)PRCM_CLKOUT_CTRL;
-   if ((div_off == 3) || (div_off = 11))
+   if ((div_off == 3) || (div_off == 11))
mask= 0x3;
break;
case CM_CORE_SEL1:
diff --git a/drivers/isdn/hisax/elsa.c b/drivers/isdn/hisax/elsa.c
index 948a9b2..ed610ed 100644
--- a/drivers/isdn/hisax/elsa.c
+++ b/drivers/isdn/hisax/elsa.c
@@ -883,7 +883,7 @@ setup_elsa_isa(struct IsdnCard *card)
val += 'A' - 3;
if (val == 'B' || val == 'C')
val ^= 1;
-   if ((cs-subtyp == ELSA_PCFPRO)  (val = 'G'))
+   if ((cs-subtyp == ELSA_PCFPRO)  (val == 'G'))
val = 'C';
printk(KERN_INFO
   Elsa: %s found at %#lx Rev.:%c IRQ %d\n,

-
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] return hidden bug

2007-10-21 Thread Roel Kluin
return hidden bug

Signed-off-by: Roel Kluin [EMAIL PROTECTED]

diff --git a/arch/alpha/kernel/pci_iommu.c b/arch/alpha/kernel/pci_iommu.c
index e1c4707..6a69425 100644
--- a/arch/alpha/kernel/pci_iommu.c
+++ b/arch/alpha/kernel/pci_iommu.c
@@ -365,8 +365,8 @@ pci_unmap_single(struct pci_dev *pdev, dma_addr_t dma_addr, 
size_t size,
printk(KERN_ERR Bogus pci_unmap_single: dma_addr %lx 
base %lx size %x\n, dma_addr, arena-dma_base,
   arena-size);
-   return;
BUG();
+   return;
}
 
npages = calc_npages((dma_addr  ~PAGE_MASK) + size);
-
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] return hidden bug

2007-10-21 Thread Roel Kluin
Rik van Riel wrote:
 On Mon, 22 Oct 2007 03:05:05 +0200
 Roel Kluin [EMAIL PROTECTED] wrote:
 
 return hidden bug
 
 Signed-off-by: Roel Kluin [EMAIL PROTECTED]

 diff --git a/arch/alpha/kernel/pci_iommu.c
 b/arch/alpha/kernel/pci_iommu.c index e1c4707..6a69425 100644
 --- a/arch/alpha/kernel/pci_iommu.c
 +++ b/arch/alpha/kernel/pci_iommu.c
 @@ -365,8 +365,8 @@ pci_unmap_single(struct pci_dev *pdev, dma_addr_t
 dma_addr, size_t size, printk(KERN_ERR Bogus pci_unmap_single:
 dma_addr %lx   base %lx size %x\n, dma_addr, arena-dma_base,
 arena-size);
 -return;
  BUG();
 +return;
  }
  
  npages = calc_npages((dma_addr  ~PAGE_MASK) + size);
 
 BUG() will terminate the process that runs into it, so you can
 just remove the return alltogether.  If BUG() is hit, the return
 will never be reached.
 
---
hidden bug returns

Signed-off-by: Roel Kluin [EMAIL PROTECTED]
---
diff --git a/arch/alpha/kernel/pci_iommu.c b/arch/alpha/kernel/pci_iommu.c
index e1c4707..ca55c33 100644
--- a/arch/alpha/kernel/pci_iommu.c
+++ b/arch/alpha/kernel/pci_iommu.c
@@ -365,7 +365,6 @@ pci_unmap_single(struct pci_dev *pdev, dma_addr_t dma_addr, 
size_t size,
printk(KERN_ERR Bogus pci_unmap_single: dma_addr %lx 
base %lx size %x\n, dma_addr, arena-dma_base,
   arena-size);
-   return;
BUG();
}
 

-
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] unlock before bug returns

2007-10-21 Thread Roel Kluin
I think the unlock should be before bugging?

--
unlock before bug returns

Signed-off-by: Roel Kluin [EMAIL PROTECTED]
---
diff --git a/arch/arm/mach-omap2/gpmc.c b/arch/arm/mach-omap2/gpmc.c
index 5a4cc20..c910170 100644
--- a/arch/arm/mach-omap2/gpmc.c
+++ b/arch/arm/mach-omap2/gpmc.c
@@ -357,9 +357,8 @@ void gpmc_cs_free(int cs)
spin_lock(gpmc_mem_lock);
if (cs = GPMC_CS_NUM || !gpmc_cs_reserved(cs)) {
printk(KERN_ERR Trying to free non-reserved GPMC CS%d\n, cs);
-   BUG();
spin_unlock(gpmc_mem_lock);
-   return;
+   BUG();
}
gpmc_cs_disable_mem(cs);
release_resource(gpmc_cs_mem[cs]);
-
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] unlock before bug returns

2007-10-21 Thread Roel Kluin
Roel Kluin wrote:

 unlock before bug returns

   if (cs = GPMC_CS_NUM || !gpmc_cs_reserved(cs)) {
   printk(KERN_ERR Trying to free non-reserved GPMC CS%d\n, cs);
 - BUG();
   spin_unlock(gpmc_mem_lock);
 - return;
 + BUG();


should we bother to unlock before panicking, or is the unlock not required 
either?

-
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] unlock before bug returns

2007-10-22 Thread Roel Kluin

 should we bother to unlock before panicking, or is the unlock not
 required either?
 
 BUG() kills the current process, but not the whole system.
 
 Unlocking the lock means that the rest of the system has somewhat
 of a chance of surviving.  Not unlocking means a guaranteed hang
 for the rest of the system, making a BUG() no better than panic.
 
 Please keep the unlock.

In that case I guess the pathc below fixes some more unlockings before
bugging.

in the third patch: maybe BUG before page_cache_release(page)?
I also spotted some cases where it was attempted to free after BUG().
should that occur before BUG() as well?

--

Unlock before BUG()

Signed-off-by: Roel Kluin [EMAIL PROTECTED]
---
diff --git a/drivers/mtd/ubi/vmt.c b/drivers/mtd/ubi/vmt.c
index 88629a3..679c8b4 100644
--- a/drivers/mtd/ubi/vmt.c
+++ b/drivers/mtd/ubi/vmt.c
@@ -100,8 +100,10 @@ static ssize_t vol_attribute_show(struct device *dev,
ret = sprintf(buf, %lld\n, vol-used_bytes);
else if (attr == attr_vol_upd_marker)
ret = sprintf(buf, %d\n, vol-upd_marker);
-   else
+   else{
+   spin_unlock(vol-ubi-volumes_lock);
BUG();
+   }
spin_unlock(vol-ubi-volumes_lock);
return ret;
 }
diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c
index e3c8284..67ed205 100644
--- a/drivers/net/wireless/ipw2200.c
+++ b/drivers/net/wireless/ipw2200.c
@@ -8722,6 +8722,7 @@ static int ipw_wx_get_freq(struct net_device *dev,
break;
 
default:
+   mutex_unlock(priv-mutex);
BUG();
}
} else
diff --git a/fs/buffer.c b/fs/buffer.c
index 76403b1..460c17d 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -1051,9 +1051,9 @@ grow_dev_page(struct block_device *bdev, sector_t block,
return page;
 
 failed:
-   BUG();
unlock_page(page);
page_cache_release(page);
+   BUG();
return NULL;
 }
 
diff --git a/mm/slab.c b/mm/slab.c
index cfa6be4..20c58dc 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -1606,8 +1606,10 @@ void __init kmem_cache_init(void)
struct kmem_cache *cachep;
mutex_lock(cache_chain_mutex);
list_for_each_entry(cachep, cache_chain, next)
-   if (enable_cpucache(cachep))
+   if (enable_cpucache(cachep)) {
+   mutex_unlock(cache_chain_mutex);
BUG();
+   }
mutex_unlock(cache_chain_mutex);
}
 
diff --git a/net/rxrpc/ar-ack.c b/net/rxrpc/ar-ack.c
index 657ee69..c56e773 100644
--- a/net/rxrpc/ar-ack.c
+++ b/net/rxrpc/ar-ack.c
@@ -752,8 +752,10 @@ all_acked:
sp-call = call;
rxrpc_get_call(call);
spin_lock_bh(call-lock);
-   if (rxrpc_queue_rcv_skb(call, skb, true, true)  0)
+   if (rxrpc_queue_rcv_skb(call, skb, true, true)  0) {
+   spin_unlock_bh(call-lock);
BUG();
+   }
spin_unlock_bh(call-lock);
goto process_further;
}
diff --git a/net/rxrpc/ar-call.c b/net/rxrpc/ar-call.c
index 3c04b00..0d30466 100644
--- a/net/rxrpc/ar-call.c
+++ b/net/rxrpc/ar-call.c
@@ -426,8 +426,10 @@ void rxrpc_release_call(struct rxrpc_call *call)
   call-rx_first_oos);
 
spin_lock_bh(call-lock);
-   if (test_and_set_bit(RXRPC_CALL_RELEASED, call-flags))
+   if (test_and_set_bit(RXRPC_CALL_RELEASED, call-flags)) {
+   spin_unlock_bh(call-lock);
BUG();
+   }
spin_unlock_bh(call-lock);
 
/* dissociate from the socket
-
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 retry] return hidden bug and unlock bugs

2007-10-22 Thread Roel Kluin
This patches shouldn't alter behavior when CONFIG_BUG is disabled. It is meant
as a replacement for the previous patches.

Concerning the patch changing fs/buffer.c, I am still wondering whether
page_cache_release(page) should be placed before or after the BUG().
--
Unlock before BUG(), but don't change behavior in the case when
CONFIG_BUG is disabled

Signed-off-by: Roel Kluin [EMAIL PROTECTED]
---
diff --git a/arch/alpha/kernel/pci_iommu.c b/arch/alpha/kernel/pci_iommu.c
index e1c4707..6a69425 100644
--- a/arch/alpha/kernel/pci_iommu.c
+++ b/arch/alpha/kernel/pci_iommu.c
@@ -365,8 +365,8 @@ pci_unmap_single(struct pci_dev *pdev, dma_addr_t dma_addr, 
size_t size,
printk(KERN_ERR Bogus pci_unmap_single: dma_addr %lx 
base %lx size %x\n, dma_addr, arena-dma_base,
   arena-size);
-   return;
BUG();
+   return;
}
 
npages = calc_npages((dma_addr  ~PAGE_MASK) + size);
diff --git a/arch/arm/mach-omap2/gpmc.c b/arch/arm/mach-omap2/gpmc.c
index 5a4cc20..12bd0eb 100644
--- a/arch/arm/mach-omap2/gpmc.c
+++ b/arch/arm/mach-omap2/gpmc.c
@@ -357,8 +357,8 @@ void gpmc_cs_free(int cs)
spin_lock(gpmc_mem_lock);
if (cs = GPMC_CS_NUM || !gpmc_cs_reserved(cs)) {
printk(KERN_ERR Trying to free non-reserved GPMC CS%d\n, cs);
-   BUG();
spin_unlock(gpmc_mem_lock);
+   BUG();
return;
}
gpmc_cs_disable_mem(cs);
diff --git a/drivers/mtd/ubi/vmt.c b/drivers/mtd/ubi/vmt.c
index 88629a3..e72bead 100644
--- a/drivers/mtd/ubi/vmt.c
+++ b/drivers/mtd/ubi/vmt.c
@@ -100,8 +100,11 @@ static ssize_t vol_attribute_show(struct device *dev,
ret = sprintf(buf, %lld\n, vol-used_bytes);
else if (attr == attr_vol_upd_marker)
ret = sprintf(buf, %d\n, vol-upd_marker);
-   else
+   else {
+   spin_unlock(vol-ubi-volumes_lock);
BUG();
+   return -EINVAL;
+   }
spin_unlock(vol-ubi-volumes_lock);
return ret;
 }
diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c
index e3c8284..f337578 100644
--- a/drivers/net/wireless/ipw2200.c
+++ b/drivers/net/wireless/ipw2200.c
@@ -8722,7 +8722,9 @@ static int ipw_wx_get_freq(struct net_device *dev,
break;
 
default:
+   mutex_unlock(priv-mutex);
BUG();
+   return -EINVAL;
}
} else
wrqu-freq.m = 0;
diff --git a/fs/buffer.c b/fs/buffer.c
index 7249e01..90a3785 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -1051,9 +1051,9 @@ grow_dev_page(struct block_device *bdev, sector_t block,
return page;
 
 failed:
-   BUG();
unlock_page(page);
page_cache_release(page);
+   BUG();
return NULL;
 }
 
diff --git a/mm/slab.c b/mm/slab.c
index cfa6be4..2dd48c1 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -1604,11 +1604,16 @@ void __init kmem_cache_init(void)
/* 6) resize the head arrays to their final sizes */
{
struct kmem_cache *cachep;
+   int fail = 0;
mutex_lock(cache_chain_mutex);
list_for_each_entry(cachep, cache_chain, next)
-   if (enable_cpucache(cachep))
+   if (enable_cpucache(cachep)) {
+   fail = 1;
+   mutex_unlock(cache_chain_mutex);
BUG();
-   mutex_unlock(cache_chain_mutex);
+   }
+   if (fail != 1)
+   mutex_unlock(cache_chain_mutex);
}
 
/* Annotate slab for lockdep -- annotate the malloc caches */
diff --git a/net/rxrpc/ar-ack.c b/net/rxrpc/ar-ack.c
index 657ee69..e551b0b 100644
--- a/net/rxrpc/ar-ack.c
+++ b/net/rxrpc/ar-ack.c
@@ -752,8 +752,11 @@ all_acked:
sp-call = call;
rxrpc_get_call(call);
spin_lock_bh(call-lock);
-   if (rxrpc_queue_rcv_skb(call, skb, true, true)  0)
+   if (rxrpc_queue_rcv_skb(call, skb, true, true)  0) {
+   spin_unlock_bh(call-lock);
BUG();
+   goto process_further;
+   }
spin_unlock_bh(call-lock);
goto process_further;
}
diff --git a/net/rxrpc/ar-call.c b/net/rxrpc/ar-call.c
index 3c04b00..48804e1 100644
--- a/net/rxrpc/ar-call.c
+++ b/net/rxrpc/ar-call.c
@@ -426,9 +426,12 @@ void rxrpc_release_call(struct rxrpc_call *call)
   call-rx_first_oos);
 
spin_lock_bh(call-lock);
-   if (test_and_set_bit(RXRPC_CALL_RELEASED, call-flags))
+   if (test_and_set_bit(RXRPC_CALL_RELEASED, call-flags)) {
+   spin_unlock_bh(call-lock);
BUG

Re: [PATCH] return hidden bug

2007-10-22 Thread Roel Kluin
Ray Lee wrote:

 I'm sorry, perhaps I poured myself a cup of stupid this morning, but
 isn't the above patch effectively introducing a BUG where none could
 be reached before? In other words, for the patch to have zero
 behavioral change, wouldn't it have to remove the BUG() altogether?

True, but obviously not intended. I think the intention was to expose this bug.

-
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] return hidden bug

2007-10-22 Thread Roel Kluin
Ray Lee wrote:

 I'm sorry, perhaps I poured myself a cup of stupid this morning, but
 isn't the above patch effectively introducing a BUG where none could
 be reached before? In other words, for the patch to have zero
 behavioral change, wouldn't it have to remove the BUG() altogether?
 True, but obviously not intended. I think the intention was to expose this 
 bug.
 
 Arguing intentions is very dangerous. I've written code like that
 where the intention is to make it simple to turn a printk into a full
 bug and back and forth during development. At the end of the day, the
 fact remains that you're changing behavior.
 
 Let me turn this around. Do you have an alpha and have you tried out
 your patch? If not, then I'd suggest turning it into a WARN_ON(1)
 instead, as in this specific case you're risking turning what was a
 working system into one that doesn't.

No, I haven't and, I will change it, but it's included with my other
changes. see the reply that I'll write shortly for.
[PATCH retry] return hidden bug and unlock bugs.

Roel


-
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 retry] return hidden bug and unlock bugs

2007-10-22 Thread Roel Kluin
Roel Kluin wrote:
 This patches shouldn't alter behavior when CONFIG_BUG is disabled. It is meant
 as a replacement for the previous patches.
 
 Concerning the patch changing fs/buffer.c, I am still wondering whether
 page_cache_release(page) should be placed before or after the BUG().

...

 @@ -365,8 +365,8 @@ pci_unmap_single(struct pci_dev *pdev, dma_addr_t 
 dma_addr, size_t size,
   printk(KERN_ERR Bogus pci_unmap_single: dma_addr %lx 
   base %lx size %x\n, dma_addr, arena-dma_base,
  arena-size);
 - return;
   BUG();
 + return;
   }

As suggested by Ray Lee, BUG() is changed into WARN_ON(1)

--
Unlock before BUG(), but don't change behavior in the case when
CONFIG_BUG is disabled. Also changes a return-hidden BUG() in
a WARN_ON(1)

Signed-off-by: Roel Kluin [EMAIL PROTECTED]

diff --git a/arch/alpha/kernel/pci_iommu.c b/arch/alpha/kernel/pci_iommu.c
index e1c4707..d04f151 100644
--- a/arch/alpha/kernel/pci_iommu.c
+++ b/arch/alpha/kernel/pci_iommu.c
@@ -365,8 +365,8 @@ pci_unmap_single(struct pci_dev *pdev, dma_addr_t dma_addr, 
size_t size,
printk(KERN_ERR Bogus pci_unmap_single: dma_addr %lx 
base %lx size %x\n, dma_addr, arena-dma_base,
   arena-size);
+   WARN_ON(1);
return;
-   BUG();
}
 
npages = calc_npages((dma_addr  ~PAGE_MASK) + size);
diff --git a/arch/arm/mach-omap2/gpmc.c b/arch/arm/mach-omap2/gpmc.c
index 5a4cc20..12bd0eb 100644
--- a/arch/arm/mach-omap2/gpmc.c
+++ b/arch/arm/mach-omap2/gpmc.c
@@ -357,8 +357,8 @@ void gpmc_cs_free(int cs)
spin_lock(gpmc_mem_lock);
if (cs = GPMC_CS_NUM || !gpmc_cs_reserved(cs)) {
printk(KERN_ERR Trying to free non-reserved GPMC CS%d\n, cs);
-   BUG();
spin_unlock(gpmc_mem_lock);
+   BUG();
return;
}
gpmc_cs_disable_mem(cs);
diff --git a/drivers/mtd/ubi/vmt.c b/drivers/mtd/ubi/vmt.c
index 88629a3..e72bead 100644
--- a/drivers/mtd/ubi/vmt.c
+++ b/drivers/mtd/ubi/vmt.c
@@ -100,8 +100,11 @@ static ssize_t vol_attribute_show(struct device *dev,
ret = sprintf(buf, %lld\n, vol-used_bytes);
else if (attr == attr_vol_upd_marker)
ret = sprintf(buf, %d\n, vol-upd_marker);
-   else
+   else {
+   spin_unlock(vol-ubi-volumes_lock);
BUG();
+   return -EINVAL;
+   }
spin_unlock(vol-ubi-volumes_lock);
return ret;
 }
diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c
index e3c8284..f337578 100644
--- a/drivers/net/wireless/ipw2200.c
+++ b/drivers/net/wireless/ipw2200.c
@@ -8722,7 +8722,9 @@ static int ipw_wx_get_freq(struct net_device *dev,
break;
 
default:
+   mutex_unlock(priv-mutex);
BUG();
+   return -EINVAL;
}
} else
wrqu-freq.m = 0;
diff --git a/fs/buffer.c b/fs/buffer.c
index 7249e01..90a3785 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -1051,9 +1051,9 @@ grow_dev_page(struct block_device *bdev, sector_t block,
return page;
 
 failed:
-   BUG();
unlock_page(page);
page_cache_release(page);
+   BUG();
return NULL;
 }
 
diff --git a/mm/slab.c b/mm/slab.c
index cfa6be4..2dd48c1 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -1604,11 +1604,16 @@ void __init kmem_cache_init(void)
/* 6) resize the head arrays to their final sizes */
{
struct kmem_cache *cachep;
+   int fail = 0;
mutex_lock(cache_chain_mutex);
list_for_each_entry(cachep, cache_chain, next)
-   if (enable_cpucache(cachep))
+   if (enable_cpucache(cachep)) {
+   fail = 1;
+   mutex_unlock(cache_chain_mutex);
BUG();
-   mutex_unlock(cache_chain_mutex);
+   }
+   if (fail != 1)
+   mutex_unlock(cache_chain_mutex);
}
 
/* Annotate slab for lockdep -- annotate the malloc caches */
diff --git a/net/rxrpc/ar-ack.c b/net/rxrpc/ar-ack.c
index 657ee69..e551b0b 100644
--- a/net/rxrpc/ar-ack.c
+++ b/net/rxrpc/ar-ack.c
@@ -752,8 +752,11 @@ all_acked:
sp-call = call;
rxrpc_get_call(call);
spin_lock_bh(call-lock);
-   if (rxrpc_queue_rcv_skb(call, skb, true, true)  0)
+   if (rxrpc_queue_rcv_skb(call, skb, true, true)  0) {
+   spin_unlock_bh(call-lock);
BUG();
+   goto process_further;
+   }
spin_unlock_bh(call-lock);
goto

Re: [PATCH] unlock before bug returns

2007-10-22 Thread Roel Kluin
Rene Herman wrote:
 On 10/22/2007 02:40 PM, Pekka Enberg wrote:
 
 NAK. This will cause double-unlock when CONFIG_BUG is disabled. It's
 incorrect to assume that BUG() will always terminate the current
 process.
 
 (which by the way also means that the return; delete from your
 original patch changes behaviour for !CONFIG_BUG, and probably not for
 the better).
 
 Rene.

Thanks for your comments. A patch containing this suggestion is:

[PATCH retry] return hidden bug and unlock bugs.

Roel
-
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] unlock 12c_mutex before return

2007-10-22 Thread Roel Kluin
unlock 12c_mutex before return -EINVAL

Signed-off-by: Roel Kluin [EMAIL PROTECTED]
---
diff --git a/drivers/media/dvb/dvb-usb/au6610.c 
b/drivers/media/dvb/dvb-usb/au6610.c
index 18e0b16..31f47c7 100644
--- a/drivers/media/dvb/dvb-usb/au6610.c
+++ b/drivers/media/dvb/dvb-usb/au6610.c
@@ -82,8 +82,10 @@ static int au6610_i2c_xfer(struct i2c_adapter *adap, struct 
i2c_msg msg[],
if (mutex_lock_interruptible(d-i2c_mutex)  0)
return -EAGAIN;
 
-   if (num  2)
+   if (num  2) {
+mutex_unlock(d-i2c_mutex);
return -EINVAL;
+   }
 
for (i = 0; i  num; i++) {
/* write/read request */
-
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] unlock 12c_mutex before return

2007-10-22 Thread Roel Kluin
And a similar one in drivers/media/dvb/dvb-usb/gl861.c
--
unlock 12c_mutex before return -EINVAL

Signed-off-by: Roel Kluin [EMAIL PROTECTED]
---
diff --git a/drivers/media/dvb/dvb-usb/gl861.c 
b/drivers/media/dvb/dvb-usb/gl861.c
index f01d99c..20c340a 100644
--- a/drivers/media/dvb/dvb-usb/gl861.c
+++ b/drivers/media/dvb/dvb-usb/gl861.c
@@ -59,8 +59,10 @@ static int gl861_i2c_xfer(struct i2c_adapter *adap, struct 
i2c_msg msg[],
if (mutex_lock_interruptible(d-i2c_mutex)  0)
return -EAGAIN;
 
-   if (num  2)
+   if (num  2) {
+   mutex_unlock(d-i2c_mutex);
return -EINVAL;
+   }
 
for (i = 0; i  num; i++) {
/* write/read request */

-
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] several returns before unlocking in lmc_ioctl

2007-10-22 Thread Roel Kluin
Several returns before unlocking in lmc_ioctl

Signed-off-by: Roel Kluin [EMAIL PROTECTED]
---
diff --git a/drivers/net/wan/lmc/lmc_main.c b/drivers/net/wan/lmc/lmc_main.c
index 5ea8772..af7b3e4 100644
--- a/drivers/net/wan/lmc/lmc_main.c
+++ b/drivers/net/wan/lmc/lmc_main.c
@@ -142,9 +142,10 @@ int lmc_ioctl (struct net_device *dev, struct ifreq *ifr, 
int cmd) /*fold00*/
  * To date internally, just copy this out to the user.
  */
 case LMCIOCGINFO: /*fold01*/
-if (copy_to_user(ifr-ifr_data, sc-ictl, sizeof (lmc_ctl_t)))
-return -EFAULT;
-ret = 0;
+   if (copy_to_user(ifr-ifr_data, sc-ictl, sizeof(lmc_ctl_t)))
+   ret = -EFAULT;
+   else
+   ret = 0;
 break;
 
 case LMCIOCSINFO: /*fold01*/
@@ -159,8 +160,10 @@ int lmc_ioctl (struct net_device *dev, struct ifreq *ifr, 
int cmd) /*fold00*/
 break;
 }
 
-if (copy_from_user(ctl, ifr-ifr_data, sizeof (lmc_ctl_t)))
-return -EFAULT;
+   if (copy_from_user(ctl, ifr-ifr_data, sizeof(lmc_ctl_t))) {
+   ret = -EFAULT;
+   break;
+   }
 
 sc-lmc_media-set_status (sc, ctl);
 
@@ -190,8 +193,10 @@ int lmc_ioctl (struct net_device *dev, struct ifreq *ifr, 
int cmd) /*fold00*/
break;
}
 
-   if (copy_from_user(new_type, ifr-ifr_data, sizeof(u_int16_t)))
-return -EFAULT;
+   if (copy_from_user(new_type, ifr-ifr_data, sizeof(u_int16_t))) {
+   ret = -EFAULT;
+   break;
+   }
 
 
if (new_type == old_type)
@@ -229,9 +234,10 @@ int lmc_ioctl (struct net_device *dev, struct ifreq *ifr, 
int cmd) /*fold00*/
 sc-lmc_xinfo.Magic1 = 0xDEADBEEF;
 
 if (copy_to_user(ifr-ifr_data, sc-lmc_xinfo,
- sizeof (struct lmc_xinfo)))
-return -EFAULT;
-ret = 0;
+   sizeof(struct lmc_xinfo))) {
+   ret = -EFAULT;
+   else
+   ret = 0;
 
 break;
 
@@ -262,9 +268,9 @@ int lmc_ioctl (struct net_device *dev, struct ifreq *ifr, 
int cmd) /*fold00*/
 
 if (copy_to_user(ifr-ifr_data, sc-stats,
  sizeof (struct lmc_statistics)))
-return -EFAULT;
-
-ret = 0;
+   ret = -EFAULT;
+   else
+   ret = 0;
 break;
 
 case LMCIOCCLEARLMCSTATS: /*fold01*/
@@ -292,8 +298,10 @@ int lmc_ioctl (struct net_device *dev, struct ifreq *ifr, 
int cmd) /*fold00*/
 break;
 }
 
-if (copy_from_user(ctl, ifr-ifr_data, sizeof (lmc_ctl_t)))
-return -EFAULT;
+   if (copy_from_user(ctl, ifr-ifr_data, sizeof(lmc_ctl_t))) {
+   ret = -EFAULT;
+   break;
+   }
 sc-lmc_media-set_circuit_type(sc, ctl.circuit_type);
 sc-ictl.circuit_type = ctl.circuit_type;
 ret = 0;
@@ -318,12 +326,15 @@ int lmc_ioctl (struct net_device *dev, struct ifreq *ifr, 
int cmd) /*fold00*/
 
 #ifdef DEBUG
 case LMCIOCDUMPEVENTLOG:
-if (copy_to_user(ifr-ifr_data, lmcEventLogIndex, sizeof (u32)))
-return -EFAULT;
+   if (copy_to_user(ifr-ifr_data, lmcEventLogIndex, sizeof(u32))) {
+   ret = -EFAULT;
+   break;
+   }
 if (copy_to_user(ifr-ifr_data + sizeof (u32), lmcEventLogBuf, sizeof 
(lmcEventLogBuf)))
-return -EFAULT;
+   ret = -EFAULT;
+   else
+   ret = 0;
 
-ret = 0;
 break;
 #endif /* end ifdef _DBG_EVENTLOG */
 case LMCIOCT1CONTROL: /*fold01*/
@@ -346,8 +357,10 @@ int lmc_ioctl (struct net_device *dev, struct ifreq *ifr, 
int cmd) /*fold00*/
  */
 netif_stop_queue(dev);
 
-if (copy_from_user(xc, ifr-ifr_data, sizeof (struct 
lmc_xilinx_control)))
-return -EFAULT;
+   if (copy_from_user(xc, ifr-ifr_data, sizeof(struct 
lmc_xilinx_control))) {
+   ret = -EFAULT;
+   break;
+   }
 switch(xc.command){
 case lmc_xilinx_reset: /*fold02*/
 {
@@ -618,8 +631,8 @@ int lmc_ioctl (struct net_device *dev, struct ifreq *ifr, 
int cmd) /*fold00*/
 }
 
 spin_unlock_irqrestore(sc-lmc_lock, flags); /*fold01*/
-
-lmc_trace(dev, lmc_ioctl out);
+if (ret = 0)
+   lmc_trace(dev, lmc_ioctl out);
 
 return ret;
 }
-
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] Unlock in iTCO_wdt_start when reboot is disabled

2007-10-22 Thread Roel Kluin
commit 61c31efe4e9c34531666a6c5857ecd19c8db
Author: Roel Kluin [EMAIL PROTECTED]
Date:   Tue Oct 23 03:08:27 2007 +0200

Unlock in iTCO_wdt_start when reboot is disabled

Signed-off-by: Roel Kluin [EMAIL PROTECTED]

diff --git a/drivers/watchdog/iTCO_wdt.c b/drivers/watchdog/iTCO_wdt.c
index cd5a565..185c093 100644
--- a/drivers/watchdog/iTCO_wdt.c
+++ b/drivers/watchdog/iTCO_wdt.c
@@ -300,6 +300,7 @@ static int iTCO_wdt_start(void)
 
/* disable chipset's NO_REBOOT bit */
if (iTCO_wdt_unset_NO_REBOOT_bit()) {
+   spin_unlock(iTCO_wdt_private.io_lock);
printk(KERN_ERR PFX failed to reset NO_REBOOT flag, reboot 
disabled by hardware\n);
return -EIO;
}
-
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] Unlock before return in p9_mux_poll_start

2007-10-22 Thread Roel Kluin
commit 9f822afc65cc094c905901f9d92bf25042f9ed22
Author: Roel Kluin [EMAIL PROTECTED]
Date:   Tue Oct 23 03:15:55 2007 +0200

Unlock before return in p9_mux_poll_start

Signed-off-by: Roel Kluin [EMAIL PROTECTED]

diff --git a/net/9p/mux.c b/net/9p/mux.c
index f140147..c9f0805 100644
--- a/net/9p/mux.c
+++ b/net/9p/mux.c
@@ -222,8 +222,10 @@ static int p9_mux_poll_start(struct p9_conn *m)
}
 
if (i = ARRAY_SIZE(p9_mux_poll_tasks)) {
-   if (vptlast == NULL)
+   if (vptlast == NULL) {
+   mutex_unlock(p9_mux_task_lock);
return -ENOMEM;
+   }
 
P9_DPRINTK(P9_DEBUG_MUX, put in proc %d\n, i);
list_add(m-mux_list, vptlast-mux_list);

-
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] several returns before unlocking in lmc_ioctl

2007-10-22 Thread Roel Kluin
I think we should keep the lmc_tracing. Use this patch instead.

--
Several returns before unlocking in lmc_ioctl

Signed-off-by: Roel Kluin [EMAIL PROTECTED]
---
diff --git a/drivers/net/wan/lmc/lmc_main.c b/drivers/net/wan/lmc/lmc_main.c
index 5ea8772..64eb578 100644
--- a/drivers/net/wan/lmc/lmc_main.c
+++ b/drivers/net/wan/lmc/lmc_main.c
@@ -142,9 +142,10 @@ int lmc_ioctl (struct net_device *dev, struct ifreq *ifr, 
int cmd) /*fold00*/
  * To date internally, just copy this out to the user.
  */
 case LMCIOCGINFO: /*fold01*/
-if (copy_to_user(ifr-ifr_data, sc-ictl, sizeof (lmc_ctl_t)))
-return -EFAULT;
-ret = 0;
+   if (copy_to_user(ifr-ifr_data, sc-ictl, sizeof(lmc_ctl_t)))
+   ret = -EFAULT;
+   else
+   ret = 0;
 break;
 
 case LMCIOCSINFO: /*fold01*/
@@ -159,8 +160,10 @@ int lmc_ioctl (struct net_device *dev, struct ifreq *ifr, 
int cmd) /*fold00*/
 break;
 }
 
-if (copy_from_user(ctl, ifr-ifr_data, sizeof (lmc_ctl_t)))
-return -EFAULT;
+   if (copy_from_user(ctl, ifr-ifr_data, sizeof(lmc_ctl_t))) {
+   ret = -EFAULT;
+   break;
+   }
 
 sc-lmc_media-set_status (sc, ctl);
 
@@ -190,8 +193,10 @@ int lmc_ioctl (struct net_device *dev, struct ifreq *ifr, 
int cmd) /*fold00*/
break;
}
 
-   if (copy_from_user(new_type, ifr-ifr_data, sizeof(u_int16_t)))
-return -EFAULT;
+   if (copy_from_user(new_type, ifr-ifr_data, sizeof(u_int16_t))) {
+   ret = -EFAULT;
+   break;
+   }
 
 
if (new_type == old_type)
@@ -229,9 +234,10 @@ int lmc_ioctl (struct net_device *dev, struct ifreq *ifr, 
int cmd) /*fold00*/
 sc-lmc_xinfo.Magic1 = 0xDEADBEEF;
 
 if (copy_to_user(ifr-ifr_data, sc-lmc_xinfo,
- sizeof (struct lmc_xinfo)))
-return -EFAULT;
-ret = 0;
+   sizeof(struct lmc_xinfo))) {
+   ret = -EFAULT;
+   else
+   ret = 0;
 
 break;
 
@@ -262,9 +268,9 @@ int lmc_ioctl (struct net_device *dev, struct ifreq *ifr, 
int cmd) /*fold00*/
 
 if (copy_to_user(ifr-ifr_data, sc-stats,
  sizeof (struct lmc_statistics)))
-return -EFAULT;
-
-ret = 0;
+   ret = -EFAULT;
+   else
+   ret = 0;
 break;
 
 case LMCIOCCLEARLMCSTATS: /*fold01*/
@@ -292,8 +298,10 @@ int lmc_ioctl (struct net_device *dev, struct ifreq *ifr, 
int cmd) /*fold00*/
 break;
 }
 
-if (copy_from_user(ctl, ifr-ifr_data, sizeof (lmc_ctl_t)))
-return -EFAULT;
+   if (copy_from_user(ctl, ifr-ifr_data, sizeof(lmc_ctl_t))) {
+   ret = -EFAULT;
+   break;
+   }
 sc-lmc_media-set_circuit_type(sc, ctl.circuit_type);
 sc-ictl.circuit_type = ctl.circuit_type;
 ret = 0;
@@ -318,12 +326,15 @@ int lmc_ioctl (struct net_device *dev, struct ifreq *ifr, 
int cmd) /*fold00*/
 
 #ifdef DEBUG
 case LMCIOCDUMPEVENTLOG:
-if (copy_to_user(ifr-ifr_data, lmcEventLogIndex, sizeof (u32)))
-return -EFAULT;
+   if (copy_to_user(ifr-ifr_data, lmcEventLogIndex, sizeof(u32))) {
+   ret = -EFAULT;
+   break;
+   }
 if (copy_to_user(ifr-ifr_data + sizeof (u32), lmcEventLogBuf, sizeof 
(lmcEventLogBuf)))
-return -EFAULT;
+   ret = -EFAULT;
+   else
+   ret = 0;
 
-ret = 0;
 break;
 #endif /* end ifdef _DBG_EVENTLOG */
 case LMCIOCT1CONTROL: /*fold01*/
@@ -346,8 +357,10 @@ int lmc_ioctl (struct net_device *dev, struct ifreq *ifr, 
int cmd) /*fold00*/
  */
 netif_stop_queue(dev);
 
-if (copy_from_user(xc, ifr-ifr_data, sizeof (struct 
lmc_xilinx_control)))
-return -EFAULT;
+   if (copy_from_user(xc, ifr-ifr_data, sizeof(struct 
lmc_xilinx_control))) {
+   ret = -EFAULT;
+   break;
+   }
 switch(xc.command){
 case lmc_xilinx_reset: /*fold02*/
 {

-
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] unlock 12c_mutex before return

2007-10-23 Thread Roel Kluin
Andreas Schwab wrote:

 -if (num  2)
 +if (num  2) {
 +mutex_unlock(d-i2c_mutex);
  return -EINVAL;
 
 How about moving the check before the lock?

Good suggestion. Patch below covers both previous patches.
--
Move check before lock

Signed-off-by: Roel Kluin [EMAIL PROTECTED]
---
diff --git a/drivers/media/dvb/dvb-usb/au6610.c 
b/drivers/media/dvb/dvb-usb/au6610.c
index 18e0b16..f3ff813 100644
--- a/drivers/media/dvb/dvb-usb/au6610.c
+++ b/drivers/media/dvb/dvb-usb/au6610.c
@@ -79,12 +79,12 @@ static int au6610_i2c_xfer(struct i2c_adapter *adap, struct 
i2c_msg msg[],
struct dvb_usb_device *d = i2c_get_adapdata(adap);
int i;
 
-   if (mutex_lock_interruptible(d-i2c_mutex)  0)
-   return -EAGAIN;
-
if (num  2)
return -EINVAL;
 
+   if (mutex_lock_interruptible(d-i2c_mutex)  0)
+   return -EAGAIN;
+
for (i = 0; i  num; i++) {
/* write/read request */
if (i+1  num  (msg[i+1].flags  I2C_M_RD)) {
diff --git a/drivers/media/dvb/dvb-usb/gl861.c 
b/drivers/media/dvb/dvb-usb/gl861.c
index f01d99c..6b99d9f 100644
--- a/drivers/media/dvb/dvb-usb/gl861.c
+++ b/drivers/media/dvb/dvb-usb/gl861.c
@@ -56,12 +56,12 @@ static int gl861_i2c_xfer(struct i2c_adapter *adap, struct 
i2c_msg msg[],
struct dvb_usb_device *d = i2c_get_adapdata(adap);
int i;
 
-   if (mutex_lock_interruptible(d-i2c_mutex)  0)
-   return -EAGAIN;
-
if (num  2)
return -EINVAL;
 
+   if (mutex_lock_interruptible(d-i2c_mutex)  0)
+   return -EAGAIN;
+
for (i = 0; i  num; i++) {
/* write/read request */
if (i+1  num  (msg[i+1].flags  I2C_M_RD)) {

-
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] Unlock when ssp tries to close an invalid port

2007-10-23 Thread Roel Kluin
Unlock when ssp tries to close an invalid port
Signed-off-by: Roel Kluin [EMAIL PROTECTED]
---
diff --git a/arch/arm/mach-pxa/ssp.c b/arch/arm/mach-pxa/ssp.c
index 71766ac..422afee 100644
--- a/arch/arm/mach-pxa/ssp.c
+++ b/arch/arm/mach-pxa/ssp.c
@@ -309,6 +309,7 @@ void ssp_exit(struct ssp_dev *dev)
 
if (dev-port  PXA_SSP_PORTS || dev-port == 0) {
printk(KERN_WARNING SSP: tried to close invalid port\n);
+   mutex_unlock(mutex);
return;
}
 

-
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] Fix unlocking before return in gpio

2007-10-23 Thread Roel Kluin
Fix unlocking before return in gpio
Signed-off-by: Roel Kluin [EMAIL PROTECTED]
---
diff --git a/arch/cris/arch-v10/drivers/gpio.c 
b/arch/cris/arch-v10/drivers/gpio.c
index f389ed6..0d347a7 100644
--- a/arch/cris/arch-v10/drivers/gpio.c
+++ b/arch/cris/arch-v10/drivers/gpio.c
@@ -297,8 +297,10 @@ gpio_poll(struct file *file,
data = *R_PORT_PB_DATA;
else if (priv-minor == GPIO_MINOR_G)
data = *R_PORT_G_DATA;
-   else
+   else {
+   spin_unlock(gpio_lock);
return 0;
+   }

if ((data  priv-highalarm) ||
(~data  priv-lowalarm)) {
@@ -381,18 +383,21 @@ static ssize_t gpio_write(struct file * file, const char 
* buf, size_t count,
 
ssize_t retval = count;
if (priv-minor !=GPIO_MINOR_A  priv-minor != GPIO_MINOR_B) {
-   return -EFAULT;
+   retval = -EFAULT;
+   goto out;
}
 
if (!access_ok(VERIFY_READ, buf, count)) {
-   return -EFAULT;
+   retval = -EFAULT;
+   goto out;
}
clk_mask = priv-clk_mask;
data_mask = priv-data_mask;
/* It must have been configured using the IO_CFG_WRITE_MODE */
/* Perhaps a better error code? */
if (clk_mask == 0 || data_mask == 0) {
-   return -EPERM;
+   retval = -EPERM;
+   goto out;
}
write_msb = priv-write_msb;
D(printk(gpio_write: %lu to data 0x%02X clk 0x%02X msb: %i\n,count, 
data_mask, clk_mask, write_msb));
@@ -425,6 +430,7 @@ static ssize_t gpio_write(struct file * file, const char * 
buf, size_t count,
}
}
}
+out:
spin_unlock(gpio_lock);
return retval;
 }
@@ -506,6 +512,7 @@ gpio_release(struct inode *inode, struct file *filp)
while (p) {
if (p-highalarm | p-lowalarm) {
gpio_some_alarms = 1;
+   spin_unlock(gpio_lock);
return 0;
}
p = p-next;
-
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/?] Unlock when sn_oemdata can't be extended

2007-10-23 Thread Roel Kluin
Unlock when sn_oemdata can't be extended
Signed-off-by: Roel Kluin [EMAIL PROTECTED]
---
diff --git a/arch/ia64/sn/kernel/mca.c b/arch/ia64/sn/kernel/mca.c
index 3db62f2..868c9aa 100644
--- a/arch/ia64/sn/kernel/mca.c
+++ b/arch/ia64/sn/kernel/mca.c
@@ -98,6 +98,7 @@ sn_platform_plat_specific_err_print(const u8 * sect_header, 
u8 ** oemdata,
while (*sn_oemdata_size  sn_oemdata_bufsize) {
u8 *newbuf = vmalloc(*sn_oemdata_size);
if (!newbuf) {
+   mutex_unlock(sn_oemdata_mutex);
printk(KERN_ERR %s: unable to extend sn_oemdata\n,
   __FUNCTION__);
return 1;
-
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] Fix unlock on error

2007-10-23 Thread Roel Kluin
Fix unlock on error
Signed-off-by: Roel Kluin [EMAIL PROTECTED]
---
diff --git a/arch/mips/kernel/irixsig.c b/arch/mips/kernel/irixsig.c
index a0a9105..a6e6e78 100644
--- a/arch/mips/kernel/irixsig.c
+++ b/arch/mips/kernel/irixsig.c
@@ -426,6 +426,7 @@ asmlinkage int irix_sigprocmask(int how, irix_sigset_t 
__user *new,
break;
 
default:
+   spin_unlock_irq(current-sighand-siglock);
return -EINVAL;
}
recalc_sigpending();
diff --git a/arch/mips/vr41xx/common/icu.c b/arch/mips/vr41xx/common/icu.c
index 1899601..11f5f72 100644
--- a/arch/mips/vr41xx/common/icu.c
+++ b/arch/mips/vr41xx/common/icu.c
@@ -525,6 +525,7 @@ static inline int set_sysint1_assign(unsigned int irq, 
unsigned char assign)
intassign1 |= (uint16_t)assign  9;
break;
default:
+   spin_unlock_irq(desc-lock);
return -EINVAL;
}
 
@@ -592,6 +593,7 @@ static inline int set_sysint2_assign(unsigned int irq, 
unsigned char assign)
intassign3 |= (uint16_t)assign  12;
break;
default:
+spin_unlock_irq(desc-lock);
return -EINVAL;
}
 
-
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/?] Unlock when sn_oemdata can't be extended

2007-10-24 Thread Roel Kluin
 Several unlocking issues
 Signed-off-by: Roel Kluin [EMAIL PROTECTED]
---
diff --git a/net/9p/mux.c b/net/9p/mux.c
index f140147..c9f0805 100644
--- a/net/9p/mux.c
+++ b/net/9p/mux.c
@@ -222,8 +222,10 @@ static int p9_mux_poll_start(struct p9_conn *m)
}
 
if (i = ARRAY_SIZE(p9_mux_poll_tasks)) {
-   if (vptlast == NULL)
+   if (vptlast == NULL) {
+   mutex_unlock(p9_mux_task_lock);
return -ENOMEM;
+   }
 
P9_DPRINTK(P9_DEBUG_MUX, put in proc %d\n, i);
list_add(m-mux_list, vptlast-mux_list);
diff --git a/net/bridge/netfilter/ebtables.c b/net/bridge/netfilter/ebtables.c
index 817169e..b09c499 100644
--- a/net/bridge/netfilter/ebtables.c
+++ b/net/bridge/netfilter/ebtables.c
@@ -282,8 +282,10 @@ find_inlist_lock_noload(struct list_head *head, const char 
*name, int *error,
return NULL;
 
list_for_each_entry(e, head, list) {
-   if (strcmp(e-name, name) == 0)
+   if (strcmp(e-name, name) == 0) {
+   mutex_unlock(mutex);
return e;
+   }
}
*error = -ENOENT;
mutex_unlock(mutex);
diff --git a/net/netfilter/nf_conntrack_netlink.c 
b/net/netfilter/nf_conntrack_netlink.c
index 9be1826..cf18097 100644
--- a/net/netfilter/nf_conntrack_netlink.c
+++ b/net/netfilter/nf_conntrack_netlink.c
@@ -1079,7 +1079,7 @@ ctnetlink_new_conntrack(struct sock *ctnl, struct sk_buff 
*skb,
CTA_TUPLE_MASTER,
u3);
if (err  0)
-   return err;
+   goto out_unlock;
 
master_h = __nf_conntrack_find(master, NULL);
if (master_h == NULL) {
diff --git a/net/rose/af_rose.c b/net/rose/af_rose.c
index 509defe..859fdc0 100644
--- a/net/rose/af_rose.c
+++ b/net/rose/af_rose.c
@@ -750,8 +750,10 @@ static int rose_connect(struct socket *sock, struct 
sockaddr *uaddr, int addr_le
 
rose-neighbour = rose_get_neigh(addr-srose_addr, cause,
 diagnostic);
-   if (!rose-neighbour)
-   return -ENETUNREACH;
+   if (!rose-neighbour) {
+   err = -ENETUNREACH;
+   goto out_release;
+   }
 
rose-lci = rose_new_lci(rose-neighbour);
if (!rose-lci) {
diff --git a/sound/oss/au1550_ac97.c b/sound/oss/au1550_ac97.c
index 23018a7..5b0e9bd 100644
--- a/sound/oss/au1550_ac97.c
+++ b/sound/oss/au1550_ac97.c
@@ -1833,12 +1833,16 @@ au1550_open(struct inode *inode, struct file *file)
}
 
if (file-f_mode  FMODE_READ) {
-   if ((ret = prog_dmabuf_adc(s)))
+   if ((ret = prog_dmabuf_adc(s))) {
+   mutex_unlock(s-open_mutex);
return ret;
+   }
}
if (file-f_mode  FMODE_WRITE) {
-   if ((ret = prog_dmabuf_dac(s)))
+   if ((ret = prog_dmabuf_dac(s))) {
+   mutex_unlock(s-open_mutex);
return ret;
+   }
}
 
s-open_mode |= file-f_mode  (FMODE_READ | FMODE_WRITE);
diff --git a/sound/oss/dmasound/dmasound_atari.c 
b/sound/oss/dmasound/dmasound_atari.c
index 285239d..d23a089 100644
--- a/sound/oss/dmasound/dmasound_atari.c
+++ b/sound/oss/dmasound/dmasound_atari.c
@@ -1276,6 +1276,7 @@ static irqreturn_t AtaInterrupt(int irq, void *dummy)
 * (almost) like on the TT.
 */
write_sq_ignore_int = 0;
+   spin_unlock(dmasound.lock);
return IRQ_HANDLED;
}
 
@@ -1284,6 +1285,7 @@ static irqreturn_t AtaInterrupt(int irq, void *dummy)
 * the sq variables, so better don't do anything here.
 */
WAKE_UP(write_sq.sync_queue);
+   spin_unlock(dmasound.lock);
return IRQ_HANDLED;
}
 
diff --git a/sound/pci/mixart/mixart.c b/sound/pci/mixart/mixart.c
index 880b824..2f62ad6 100644
--- a/sound/pci/mixart/mixart.c
+++ b/sound/pci/mixart/mixart.c
@@ -608,6 +608,7 @@ static int snd_mixart_hw_params(struct snd_pcm_substream 
*subs,
/* set the format to the board */
err = mixart_set_format(stream, format);
if(err  0) {
+   mutex_unlock(mgr-setup_mutex);
return err;
}
 

-
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/?] Unlock when sn_oemdata can't be extended

2007-10-24 Thread Roel Kluin
This includes some that I think I have reported earlier:
in drivers/media/dvb/dvb-usb/au6610.c
and drivers/media/dvb/dvb-usb/gl861.c
--
  Some more unlocking issues
  Signed-off-by: Roel Kluin [EMAIL PROTECTED]
---
diff --git a/drivers/char/drm/sis_mm.c b/drivers/char/drm/sis_mm.c
index 6be1c57..a6b7ccd 100644
--- a/drivers/char/drm/sis_mm.c
+++ b/drivers/char/drm/sis_mm.c
@@ -134,6 +134,7 @@ static int sis_drm_alloc(struct drm_device *dev, struct 
drm_file *file_priv,
  dev_priv-agp_initialized)) {
DRM_ERROR
(Attempt to allocate from uninitialized memory 
manager.\n);
+   mutex_unlock(dev-struct_mutex);
return -EINVAL;
}
 
diff --git a/drivers/hwmon/max6650.c b/drivers/hwmon/max6650.c
index 755570c..d607c9e 100644
--- a/drivers/hwmon/max6650.c
+++ b/drivers/hwmon/max6650.c
@@ -397,6 +397,7 @@ static ssize_t set_div(struct device *dev, struct 
device_attribute *devattr,
default:
dev_err(client-dev,
illegal value for fan divider (%d)\n, div);
+   mutex_unlock(data-update_lock);
return -EINVAL;
}
 
diff --git a/drivers/macintosh/macio-adb.c b/drivers/macintosh/macio-adb.c
index 79119f5..bd6da7a 100644
--- a/drivers/macintosh/macio-adb.c
+++ b/drivers/macintosh/macio-adb.c
@@ -155,6 +155,7 @@ static int macio_adb_reset_bus(void)
while ((in_8(adb-ctrl.r)  ADB_RST) != 0) {
if (--timeout == 0) {
out_8(adb-ctrl.r, in_8(adb-ctrl.r)  ~ADB_RST);
+   spin_unlock_irqrestore(macio_lock, flags);
return -1;
}
}
diff --git a/drivers/media/dvb/dvb-usb/au6610.c 
b/drivers/media/dvb/dvb-usb/au6610.c
index 18e0b16..f3ff813 100644
--- a/drivers/media/dvb/dvb-usb/au6610.c
+++ b/drivers/media/dvb/dvb-usb/au6610.c
@@ -79,12 +79,12 @@ static int au6610_i2c_xfer(struct i2c_adapter *adap, struct 
i2c_msg msg[],
struct dvb_usb_device *d = i2c_get_adapdata(adap);
int i;
 
-   if (mutex_lock_interruptible(d-i2c_mutex)  0)
-   return -EAGAIN;
-
if (num  2)
return -EINVAL;
 
+   if (mutex_lock_interruptible(d-i2c_mutex)  0)
+   return -EAGAIN;
+
for (i = 0; i  num; i++) {
/* write/read request */
if (i+1  num  (msg[i+1].flags  I2C_M_RD)) {
diff --git a/drivers/media/dvb/dvb-usb/gl861.c 
b/drivers/media/dvb/dvb-usb/gl861.c
index f01d99c..6b99d9f 100644
--- a/drivers/media/dvb/dvb-usb/gl861.c
+++ b/drivers/media/dvb/dvb-usb/gl861.c
@@ -56,12 +56,12 @@ static int gl861_i2c_xfer(struct i2c_adapter *adap, struct 
i2c_msg msg[],
struct dvb_usb_device *d = i2c_get_adapdata(adap);
int i;
 
-   if (mutex_lock_interruptible(d-i2c_mutex)  0)
-   return -EAGAIN;
-
if (num  2)
return -EINVAL;
 
+   if (mutex_lock_interruptible(d-i2c_mutex)  0)
+   return -EAGAIN;
+
for (i = 0; i  num; i++) {
/* write/read request */
if (i+1  num  (msg[i+1].flags  I2C_M_RD)) {
diff --git a/drivers/net/cris/eth_v10.c b/drivers/net/cris/eth_v10.c
index edd6828..5478549 100644
--- a/drivers/net/cris/eth_v10.c
+++ b/drivers/net/cris/eth_v10.c
@@ -1476,6 +1476,7 @@ e100_ioctl(struct net_device *dev, struct ifreq *ifr, int 
cmd)
e100_set_duplex(dev, autoneg);
break;
default:
+   spin_unlock(np-lock);
return -EINVAL;
}
spin_unlock(np-lock);
diff --git a/drivers/usb/image/mdc800.c b/drivers/usb/image/mdc800.c
index d1131a8..716f532 100644
--- a/drivers/usb/image/mdc800.c
+++ b/drivers/usb/image/mdc800.c
@@ -496,6 +496,7 @@ static int mdc800_usb_probe (struct usb_interface *intf,
 
retval = usb_register_dev(intf, mdc800_class);
if (retval) {
+   mutex_unlock(mdc800-io_lock);
err (Not able to get a minor for this device.);
return -ENODEV;
}
diff --git a/drivers/watchdog/iTCO_wdt.c b/drivers/watchdog/iTCO_wdt.c
index cd5a565..185c093 100644
--- a/drivers/watchdog/iTCO_wdt.c
+++ b/drivers/watchdog/iTCO_wdt.c
@@ -300,6 +300,7 @@ static int iTCO_wdt_start(void)
 
/* disable chipset's NO_REBOOT bit */
if (iTCO_wdt_unset_NO_REBOOT_bit()) {
+   spin_unlock(iTCO_wdt_private.io_lock);
printk(KERN_ERR PFX failed to reset NO_REBOOT flag, reboot 
disabled by hardware\n);
return -EIO;
}
diff --git a/fs/sysfs/bin.c b/fs/sysfs/bin.c
index 006fc64..37bdef1 100644
--- a/fs/sysfs/bin.c
+++ b/fs/sysfs/bin.c
@@ -153,8 +153,10 @@ static int mmap(struct file *file, struct vm_area_struct 
*vma)
mutex_lock(bb-mutex);
 
/* need attr_sd for attr, its parent for kobj */
-   if (!sysfs_get_active_two(attr_sd

[PATCH] [arch/arm/mach-pnx4008/gpio.c] duplication in if ... else if branches

2008-02-10 Thread Roel Kluin
There is a duplication of code in the following section. Possibly it was
copy-pasted and it was forgotten to edit these lines? otherwise consider
removing the duplicate lines with the patch below.
---
Different if ... else if branches do the same, remove duplication

Signed-off-by: Roel Kluin [EMAIL PROTECTED]
---
diff --git a/arch/arm/mach-pnx4008/gpio.c b/arch/arm/mach-pnx4008/gpio.c
index 1ab84ce..7a3b190 100644
--- a/arch/arm/mach-pnx4008/gpio.c
+++ b/arch/arm/mach-pnx4008/gpio.c
@@ -122,16 +122,11 @@ int pnx4008_gpio_register_pin(unsigned short pin)
unsigned long bit = GPIO_BIT(pin);
int ret = -EBUSY;   /* Already in use */
 
gpio_lock();
 
-   if (GPIO_ISBID(pin)) {
-   if (access_map[GPIO_INDEX]  bit)
-   goto out;
-   access_map[GPIO_INDEX] |= bit;
-
-   } else if (GPIO_ISRAM(pin)) {
+   if (GPIO_ISBID(pin) || GPIO_ISRAM(pin)) {
if (access_map[GPIO_INDEX]  bit)
goto out;
access_map[GPIO_INDEX] |= bit;
 
} else if (GPIO_ISMUX(pin)) {
--
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?][arch/parisc/kernel/pci-dma.c] pcxl_dma_ops.alloc_noncoherent = pa11_dma_alloc_consistent?

2008-02-11 Thread Roel Kluin
James Bottomley wrote:
 On Mon, 2008-02-11 at 17:23 +0100, Roel Kluin wrote:
 duplicate pa11_dma_alloc_consistent; more appropriate appears
 pa11_dma_alloc_noncoherent here. 

 Not tested, please confirm that this fix is correct
 
 No, it looks completely incorrect to me.  What makes you think a pcxl
 box has a problem with coherency?

Ok, please ignore the patch then. It just appeared suspicious to me
that the function did exist, but the names assigned were different.
--
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?][arch/parisc/kernel/pci-dma.c] pcxl_dma_ops.alloc_noncoherent = pa11_dma_alloc_consistent?

2008-02-11 Thread Roel Kluin
duplicate pa11_dma_alloc_consistent; more appropriate appears
pa11_dma_alloc_noncoherent here. 

Not tested, please confirm that this fix is correct
---
fix noncoherent allocation

Signed-off-by: Roel Kluin [EMAIL PROTECTED]
---
diff --git a/arch/parisc/kernel/pci-dma.c b/arch/parisc/kernel/pci-dma.c
index 9448d4e..0e8b71f 100644
--- a/arch/parisc/kernel/pci-dma.c
+++ b/arch/parisc/kernel/pci-dma.c
@@ -549,7 +549,7 @@ static void pa11_dma_sync_sg_for_device(struct device *dev, 
struct scatterlist *
 struct hppa_dma_ops pcxl_dma_ops = {
.dma_supported =pa11_dma_supported,
.alloc_consistent = pa11_dma_alloc_consistent,
-   .alloc_noncoherent =pa11_dma_alloc_consistent,
+   .alloc_noncoherent =pa11_dma_alloc_noncoherent,
.free_consistent =  pa11_dma_free_consistent,
.map_single =   pa11_dma_map_single,
.unmap_single = pa11_dma_unmap_single,
--
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?][arch/parisc/kernel/pci-dma.c] pcxl_dma_ops.alloc_noncoherent

2008-02-11 Thread Roel Kluin
John David Anglin wrote:
 James Bottomley wrote:
 On Mon, 2008-02-11 at 17:23 +0100, Roel Kluin wrote:
 duplicate pa11_dma_alloc_consistent; more appropriate appears
 pa11_dma_alloc_noncoherent here. 

 Not tested, please confirm that this fix is correct
 No, it looks completely incorrect to me.  What makes you think a pcxl
 box has a problem with coherency?
 Ok, please ignore the patch then. It just appeared suspicious to me
 that the function did exist, but the names assigned were different.
 
 How about a comment?

Based on James Bottomley's explanation maybe a comment like this?
---
Explain why dma_alloc_noncoherent is only used for boxes PA7200 and below

Signed-off-by: Roel Kluin [EMAIL PROTECTED]
---
diff --git a/arch/parisc/kernel/pci-dma.c b/arch/parisc/kernel/pci-dma.c
index 9448d4e..fc3325a 100644
--- a/arch/parisc/kernel/pci-dma.c
+++ b/arch/parisc/kernel/pci-dma.c
@@ -567,6 +567,10 @@ static void *fail_alloc_consistent(struct device *dev, 
size_t size,
return NULL;
 }
 
+/*
+ * dma_alloc_noncoherent is a fallback for boxes PA7200 and below which
+ * cannot allocate coherent memory.
+ */
 static void *pa11_dma_alloc_noncoherent(struct device *dev, size_t size,
  dma_addr_t *dma_handle, gfp_t flag)
 {
@@ -586,6 +590,10 @@ static void pa11_dma_free_noncoherent(struct device *dev, 
size_t size,
return;
 }
 
+/*
+ * PCXL allocates coherent memory even for dma_alloc_noncoherent() due to the
+ * uncached trick for coherent memory.
+ */
 struct hppa_dma_ops pcx_dma_ops = {
.dma_supported =pa11_dma_supported,
.alloc_consistent = fail_alloc_consistent,

--
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][fs/cifs/cifsfs.c] Make use of cifs_xquota_get

2008-02-11 Thread Roel Kluin
Functions cifs_xquota_set and cifs_xquota_get at respectively
fs/cifs/cifsfs.c:367 and 392 are entirely similar - except for
whitespace

struct quotactl_ops contains function pointers .set_xquota and
.get_xquota that both get the address of cifs_xquota_set.
cifs_xquota_get isn't called anywhere else in the kernel.

The patch below makes use of the function cifs_xquota_get, As
an alternative the entire function cifs_xquota_get could be 
removed.
---
Make use of cifs_xquota_get

Signed-off-by: Roel Kluin [EMAIL PROTECTED]
---
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c
index fcc4342..339b829 100644
--- a/fs/cifs/cifsfs.c
+++ b/fs/cifs/cifsfs.c
@@ -461,7 +461,7 @@ int cifs_xstate_get(struct super_block *sb, struct 
fs_quota_stat *qstats)
 
 static struct quotactl_ops cifs_quotactl_ops = {
.set_xquota = cifs_xquota_set,
-   .get_xquota = cifs_xquota_set,
+   .get_xquota = cifs_xquota_get,
.set_xstate = cifs_xstate_set,
.get_xstate = cifs_xstate_get,
 };
--
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?][arch/parisc/kernel/pci-dma.c] pcxl_dma_ops.alloc_noncoherent = pa11_dma_alloc_consistent?

2008-02-11 Thread Roel Kluin
Matthew Wilcox wrote:
 On Mon, Feb 11, 2008 at 05:23:33PM +0100, Roel Kluin wrote:
 duplicate pa11_dma_alloc_consistent; more appropriate appears
 pa11_dma_alloc_noncoherent here. 

 Not tested, please confirm that this fix is correct
 
 I don't think it is.  The memories are fading, so I don't recall why it
 is we do it this way, but I'm pretty sure it's correct the way it is.
 
Maybe this helps a bit: later I found that something similar occurs in 
drivers/parisc/{ccio-dma.c, sba_iommu.c}:

1010: .alloc_consistent = ccio_alloc_consistent,
  .alloc_noncoherent =ccio_alloc_consistent,

1036: .alloc_consistent = sba_alloc_consistent,
  .alloc_noncoherent =sba_alloc_consistent,

However in these files the functions {ccio_alloc, sba_alloc}_noncoherent
do not exist.
--
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][drivers/pnp/pnpacpi/core.c] __initdata is not an identifier

2008-02-11 Thread Roel Kluin
sparse complains at drivers/pnp/pnpacpi/core.c:39 with the error:
Trying to use reserved word '__attribute__' as identifier
Expected ) in function declarator, got .init.data

and at drivers/pnp/pnpacpi/core.c:49:38 with the error: 
undefined identifier 'excluded_id_list'

With the patch below these sparse complaints do not occur
---
__initdata is not an identifier

Signed-off-by: Roel Kluin [EMAIL PROTECTED]
---
diff --git a/drivers/pnp/pnpacpi/core.c b/drivers/pnp/pnpacpi/core.c
index 662b4c2..c283a9a 100644
--- a/drivers/pnp/pnpacpi/core.c
+++ b/drivers/pnp/pnpacpi/core.c
@@ -36,7 +36,7 @@ static int num = 0;
  * have irqs (PIC, Timer) because we call acpi_register_gsi.
  * Finally, only devices that have a CRS method need to be in this list.
  */
-static struct __initdata acpi_device_id excluded_id_list[] = {
+static struct acpi_device_id excluded_id_list[] __initdata = {
{PNP0C09, 0}, /* EC */
{PNP0C0F, 0}, /* Link device */
{PNP, 0}, /* PIC */
--
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] crypto: be*_add_cpu conversion

2008-02-13 Thread Roel Kluin
[EMAIL PROTECTED] wrote:
 From: Marcin Slusarz [EMAIL PROTECTED]
 
 replace all:
 big_endian_variable = cpu_to_beX(beX_to_cpu(big_endian_variable) +
   expression_in_cpu_byteorder);
 with:
   beX_add_cpu(big_endian_variable, expression_in_cpu_byteorder);
 generated with semantic patch
 
 Signed-off-by: Marcin Slusarz [EMAIL PROTECTED]
 Cc: Herbert Xu [EMAIL PROTECTED]
 Cc: David S. Miller [EMAIL PROTECTED]
 ---
  crypto/lrw.c |2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)
 
 diff --git a/crypto/lrw.c b/crypto/lrw.c
 index 9d52e58..4d93928 100644
 --- a/crypto/lrw.c
 +++ b/crypto/lrw.c
 @@ -92,7 +92,7 @@ struct sinfo {
  static inline void inc(be128 *iv)
  {
   if (!(iv-b = cpu_to_be64(be64_to_cpu(iv-b) + 1)))

maybe you also want instead of the line above:

be64_add_cpu(iv-b, 1);
if (!iv-b)

 - iv-a = cpu_to_be64(be64_to_cpu(iv-a) + 1);
 + be64_add_cpu(iv-a, 1);
  }
  
  static inline void lrw_round(struct sinfo *s, void *dst, const void *src)

--
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] ufs: [bl]e*_add_cpu conversion

2008-02-13 Thread Roel Kluin
[EMAIL PROTECTED] wrote:
 replace all:
 big/little_endian_variable = 
 cpu_to_[bl]eX([bl]eX_to_cpu(big/little_endian_variable) +
   expression_in_cpu_byteorder);
 with:
   [bl]eX_add_cpu(big/little_endian_variable, 
 expression_in_cpu_byteorder);

you may also want these:
---
[bl]e_add_cpu conversion in return

Signed-off-by: Roel Kluin [EMAIL PROTECTED]
---
diff --git a/fs/ufs/swab.h b/fs/ufs/swab.h
index 1683d2b..a1e3000 100644
--- a/fs/ufs/swab.h
+++ b/fs/ufs/swab.h
@@ -44,18 +44,22 @@ static __inline u32
 fs64_add(struct super_block *sbp, u32 *n, int d)
 {
if (UFS_SB(sbp)-s_bytesex == BYTESEX_LE)
-   return *n = cpu_to_le64(le64_to_cpu(*n)+d);
+   le64_add_cpu(n, d);
else
-   return *n = cpu_to_be64(be64_to_cpu(*n)+d);
+   be64_add_cpu(n, d);
+
+   return *n;
 }
 
 static __inline u32
 fs64_sub(struct super_block *sbp, u32 *n, int d)
 {
if (UFS_SB(sbp)-s_bytesex == BYTESEX_LE)
-   return *n = cpu_to_le64(le64_to_cpu(*n)-d);
+   le64_add_cpu(n, -d);
else
-   return *n = cpu_to_be64(be64_to_cpu(*n)-d);
+   be64_add_cpu(n, -d);
+
+   return *n;
 }
 
 static __inline u32

--
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/


[drivers/video/sis/init301.c] SiS_Pr-ChipType = SIS_661 not evaluated twice

2008-02-13 Thread Roel Kluin
Not sure whether this is important, but in drivers/video/sis/init301.c:1557:

  if((SiS_Pr-ChipType = SIS_661) || (SiS_Pr-SiS_ROMNew)) {
 SiS_Pr-SiS_LCDTypeInfo = (SiS_GetReg(SiS_Pr-SiS_P3d4,0x39)  0x7c)  2;
  } else if((SiS_Pr-ChipType  SIS_315H) || (SiS_Pr-ChipType = SIS_661)) {
 SiS_Pr-SiS_LCDTypeInfo = temp  4;

note the duplicate test for 'SiS_Pr-ChipType = SIS_661'
if it was true in the first test, the second test won't be evaluated.
--
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: Announce: Linux-next (Or Andrew's dream :-))

2008-02-13 Thread Roel Kluin
Linus Torvalds wrote:
 
 On Tue, 12 Feb 2008, Greg KH wrote:
 That's the point.
 Not it isn't.  To quote you a number of years ago:
  Linux is evolution, not intelligent design
 
 Umm. Have you read a lot of books on evolution?
 
 It doesn't sound like you have.
 
 The fact is, evolution often does odd (and suboptimal) things exactly 
 because it does incremental changes that DO NOT BREAK at any point.

This is not entirely true if the pressure for changes are removed. For 
instance in mammals the bones in the ear are what used to be gills in fish.
When fish became amphibians the gills weren't needed as much and evolution
took a side path.

 The examples are legion. The mammalian eye has the retina backwards, 
 with the blind spot appearing because the fundmanetal infrastructure (the 
 optical nerves) actually being in *front* of the light sensor and needing 
 a hole in the retina to get the information (and blood flow) to go to the 
 brain!
 
 In other words, exactly *because* evolution requires bisectability (any 
 non-viable point in between is a dead end by definition) and does things 
 incrementally, it doesn't do big flips. It fixes the problems on an 
 incremental scale both when it comes to the details and when it comes to 
 both details (actual protein-coding genes that code directly for some 
 expression) and infrastructure (homeobox and non-coding genes).

In nature there is a lot of duplication: several copies of genes can exist
and different copies may have a distinct evolution. There is also a lot of
'junk' DNA that doesn't code for anything (although it may have regulating
functions). In there some copies of genes may remain that are inactivated,
as well as parts of virusses, slowly obtaining random mutations because
there is no pressure on the evolution of them. Some may eventually become
active again and have different functions.

The duplication also often ensures there is fallback when random mutations
are acquired and a protein is knocked out. Besides the two chromosomes
several proteins also can have overlapping functions. The result is more
like a balance. 
 
Evolution in nature and changes in code are different because in code junk
and bugs are constantly removed. In biology junk is allowed and may provide
a pool for future development. Linux development is intended and not
survival.
--
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] use array_size macro

2007-09-28 Thread Roel Kluin
Please use this one instead. it also removes an unnecessary #define.

This patch changes code to use the ARRAY_SIZE macro. This patch is the result 
of:
find -name *.[chsS] | xargs sed -i s/sizeof(\(\w*\))[ \t]*\/[ 
\t]*sizeof(\1\[0\])/ARRAY_SIZE(\1)/g

Signed-off-by: Roel Kluin [EMAIL PROTECTED]

 arch/arm/kernel/dma-isa.c   |2 +-
 arch/powerpc/platforms/celleb/scc_sio.c |2 +-
 arch/um/kernel/tt/ptproxy/ptrace.c  |   12 ++--
 drivers/char/synclink_gt.c  |2 +-
 drivers/net/apne.c  |2 +-
 drivers/net/arm/am79c961a.c |2 +-
 drivers/net/atl1/atl1_hw.c  |2 +-
 drivers/net/cs89x0.c|6 +++---
 drivers/net/fec_8xx/fec_mii.c   |4 ++--
 drivers/net/ibm_emac/ibm_emac_debug.c   |8 
 drivers/net/ne-h8300.c  |2 +-
 drivers/net/ne.c|2 +-
 drivers/net/ne2.c   |2 +-
 drivers/net/ne2k-pci.c  |2 +-
 drivers/net/netxen/netxen_nic_hw.c  |2 +-
 drivers/net/pcmcia/axnet_cs.c   |2 +-
 drivers/net/pcmcia/pcnet_cs.c   |2 +-
 drivers/net/sk98lin/skgesirq.c  |2 +-
 drivers/net/zorro8390.c |2 +-
 drivers/serial/68328serial.c|4 ++--
 drivers/serial/mcfserial.c  |7 ++-
 include/asm-parisc/mmzone.h |2 +-
 net/atm/proc.c  |2 +-
 23 files changed, 36 insertions(+), 39 deletions(-)

---
diff --git a/arch/arm/kernel/dma-isa.c b/arch/arm/kernel/dma-isa.c
index 0a3e9ad..2f080a3 100644
--- a/arch/arm/kernel/dma-isa.c
+++ b/arch/arm/kernel/dma-isa.c
@@ -216,7 +216,7 @@ void __init isa_init_dma(dma_t *dma)
 
request_dma(DMA_ISA_CASCADE, cascade);
 
-   for (i = 0; i  sizeof(dma_resources) / 
sizeof(dma_resources[0]); i++)
+   for (i = 0; i  ARRAY_SIZE(dma_resources); i++)
request_resource(ioport_resource, dma_resources + i);
}
 }
diff --git a/arch/powerpc/platforms/celleb/scc_sio.c 
b/arch/powerpc/platforms/celleb/scc_sio.c
index bcd25f5..457651d 100644
--- a/arch/powerpc/platforms/celleb/scc_sio.c
+++ b/arch/powerpc/platforms/celleb/scc_sio.c
@@ -52,7 +52,7 @@ static int txx9_serial_init(void)
if (!node)
return 0;
 
-   for(i = 0; i  sizeof(txx9_scc_tab)/sizeof(txx9_scc_tab[0]); i++) {
+   for(i = 0; i  ARRAY_SIZE(txx9_scc_tab); i++) {
if (!(txx9_serial_bitmap  (1i)))
continue;
 
diff --git a/arch/um/kernel/tt/ptproxy/ptrace.c 
b/arch/um/kernel/tt/ptproxy/ptrace.c
index 4b4f617..5b526c4 100644
--- a/arch/um/kernel/tt/ptproxy/ptrace.c
+++ b/arch/um/kernel/tt/ptproxy/ptrace.c
@@ -77,7 +77,7 @@ long proxy_ptrace(struct debugger *debugger, int arg1, pid_t 
arg2,
result = ptrace(PTRACE_GETFPREGS, child, 0, regs);
if(result == -1) return(-errno);

-   for (i = 0; i  sizeof(regs)/sizeof(regs[0]); i++)
+   for (i = 0; i  ARRAY_SIZE(regs); i++)
ptrace(PTRACE_POKEDATA, debugger-pid, arg4 + 4 * i,
   regs[i]);
return(result);
@@ -93,7 +93,7 @@ long proxy_ptrace(struct debugger *debugger, int arg1, pid_t 
arg2,
result = ptrace(PTRACE_GETFPXREGS, child, 0, regs);
if(result == -1) return(-errno);

-   for (i = 0; i  sizeof(regs)/sizeof(regs[0]); i++)
+   for (i = 0; i  ARRAY_SIZE(regs); i++)
ptrace(PTRACE_POKEDATA, debugger-pid, arg4 + 4 * i,
   regs[i]);
return(result);
@@ -109,7 +109,7 @@ long proxy_ptrace(struct debugger *debugger, int arg1, 
pid_t arg2,
result = ptrace(PTRACE_GETREGS, child, 0, regs);
if(result == -1) return(-errno);
 
-   for (i = 0; i  sizeof(regs)/sizeof(regs[0]); i++)
+   for (i = 0; i  ARRAY_SIZE(regs); i++)
ptrace (PTRACE_POKEDATA, debugger-pid,
arg4 + 4 * i, regs[i]);
return(result);
@@ -155,7 +155,7 @@ long proxy_ptrace(struct debugger *debugger, int arg1, 
pid_t arg2,
long regs[FP_FRAME_SIZE];
int i;
 
-   for (i = 0; i  sizeof(regs)/sizeof(regs[0]); i++)
+   for (i = 0; i  ARRAY_SIZE(regs); i++)
regs[i] = ptrace (PTRACE_PEEKDATA, debugger-pid,
  arg4 + 4 * i, 0);
result = ptrace(PTRACE_SETFPREGS, child, 0, regs);
@@ -171,7 +171,7 @@ long proxy_ptrace(struct debugger *debugger, int arg1, 
pid_t arg2,
long regs[FPX_FRAME_SIZE];
int i;
 
-   for (i = 0; i  sizeof(regs)/sizeof(regs[0]); i++)
+   for (i = 0; i  ARRAY_SIZE

[PATCH] use array_size macro

2007-09-28 Thread Roel Kluin
This patch changes code to use the ARRAY_SIZE macro. This patch is the result 
of:
find -name *.[chsS] | xargs sed -i s/sizeof(\(\w*\))[ \t]*\/[ 
\t]*sizeof(\1\[0\])/ARRAY_SIZE(\1)/g

Signed-off-by: Roel Kluin [EMAIL PROTECTED]
---
diff --git a/arch/arm/kernel/dma-isa.c b/arch/arm/kernel/dma-isa.c
index 0a3e9ad..2f080a3 100644
--- a/arch/arm/kernel/dma-isa.c
+++ b/arch/arm/kernel/dma-isa.c
@@ -216,7 +216,7 @@ void __init isa_init_dma(dma_t *dma)
 
request_dma(DMA_ISA_CASCADE, cascade);
 
-   for (i = 0; i  sizeof(dma_resources) / 
sizeof(dma_resources[0]); i++)
+   for (i = 0; i  ARRAY_SIZE(dma_resources); i++)
request_resource(ioport_resource, dma_resources + i);
}
 }
diff --git a/arch/powerpc/platforms/celleb/scc_sio.c 
b/arch/powerpc/platforms/celleb/scc_sio.c
index bcd25f5..457651d 100644
--- a/arch/powerpc/platforms/celleb/scc_sio.c
+++ b/arch/powerpc/platforms/celleb/scc_sio.c
@@ -52,7 +52,7 @@ static int txx9_serial_init(void)
if (!node)
return 0;
 
-   for(i = 0; i  sizeof(txx9_scc_tab)/sizeof(txx9_scc_tab[0]); i++) {
+   for(i = 0; i  ARRAY_SIZE(txx9_scc_tab); i++) {
if (!(txx9_serial_bitmap  (1i)))
continue;
 
diff --git a/arch/um/kernel/tt/ptproxy/ptrace.c 
b/arch/um/kernel/tt/ptproxy/ptrace.c
index 4b4f617..5b526c4 100644
--- a/arch/um/kernel/tt/ptproxy/ptrace.c
+++ b/arch/um/kernel/tt/ptproxy/ptrace.c
@@ -77,7 +77,7 @@ long proxy_ptrace(struct debugger *debugger, int arg1, pid_t 
arg2,
result = ptrace(PTRACE_GETFPREGS, child, 0, regs);
if(result == -1) return(-errno);

-   for (i = 0; i  sizeof(regs)/sizeof(regs[0]); i++)
+   for (i = 0; i  ARRAY_SIZE(regs); i++)
ptrace(PTRACE_POKEDATA, debugger-pid, arg4 + 4 * i,
   regs[i]);
return(result);
@@ -93,7 +93,7 @@ long proxy_ptrace(struct debugger *debugger, int arg1, pid_t 
arg2,
result = ptrace(PTRACE_GETFPXREGS, child, 0, regs);
if(result == -1) return(-errno);

-   for (i = 0; i  sizeof(regs)/sizeof(regs[0]); i++)
+   for (i = 0; i  ARRAY_SIZE(regs); i++)
ptrace(PTRACE_POKEDATA, debugger-pid, arg4 + 4 * i,
   regs[i]);
return(result);
@@ -109,7 +109,7 @@ long proxy_ptrace(struct debugger *debugger, int arg1, 
pid_t arg2,
result = ptrace(PTRACE_GETREGS, child, 0, regs);
if(result == -1) return(-errno);
 
-   for (i = 0; i  sizeof(regs)/sizeof(regs[0]); i++)
+   for (i = 0; i  ARRAY_SIZE(regs); i++)
ptrace (PTRACE_POKEDATA, debugger-pid,
arg4 + 4 * i, regs[i]);
return(result);
@@ -155,7 +155,7 @@ long proxy_ptrace(struct debugger *debugger, int arg1, 
pid_t arg2,
long regs[FP_FRAME_SIZE];
int i;
 
-   for (i = 0; i  sizeof(regs)/sizeof(regs[0]); i++)
+   for (i = 0; i  ARRAY_SIZE(regs); i++)
regs[i] = ptrace (PTRACE_PEEKDATA, debugger-pid,
  arg4 + 4 * i, 0);
result = ptrace(PTRACE_SETFPREGS, child, 0, regs);
@@ -171,7 +171,7 @@ long proxy_ptrace(struct debugger *debugger, int arg1, 
pid_t arg2,
long regs[FPX_FRAME_SIZE];
int i;
 
-   for (i = 0; i  sizeof(regs)/sizeof(regs[0]); i++)
+   for (i = 0; i  ARRAY_SIZE(regs); i++)
regs[i] = ptrace (PTRACE_PEEKDATA, debugger-pid,
  arg4 + 4 * i, 0);
result = ptrace(PTRACE_SETFPXREGS, child, 0, regs);
@@ -187,7 +187,7 @@ long proxy_ptrace(struct debugger *debugger, int arg1, 
pid_t arg2,
long regs[FRAME_SIZE];
int i;
 
-   for (i = 0; i  sizeof(regs)/sizeof(regs[0]); i++)
+   for (i = 0; i  ARRAY_SIZE(regs); i++)
regs[i] = ptrace(PTRACE_PEEKDATA, debugger-pid,
 arg4 + 4 * i, 0);
result = ptrace(PTRACE_SETREGS, child, 0, regs);
diff --git a/drivers/char/synclink_gt.c b/drivers/char/synclink_gt.c
index 2f97d2f..d27001a 100644
--- a/drivers/char/synclink_gt.c
+++ b/drivers/char/synclink_gt.c
@@ -4717,7 +4717,7 @@ static int register_test(struct slgt_info *info)
 {
static unsigned short patterns[] =
{0x, 0x, 0x, 0x, 0x6969, 0x9696};
-   static unsigned int count = sizeof(patterns)/sizeof(patterns[0]);
+   static unsigned int count = ARRAY_SIZE(patterns);
unsigned int i;
int rc = 0;
 
diff --git a/drivers/net/apne.c b/drivers/net/apne.c
index 9541911..8806151 100644
--- a/drivers/net/apne.c
+++ b

Re: [PATCH] use array_size macro

2007-09-28 Thread Roel Kluin
Jeff Dike wrote:
 On Fri, Sep 28, 2007 at 12:56:31PM +0200, Roel Kluin wrote:
 arch/um/kernel/tt/ptproxy/ptrace.c  |   12 ++--
 
 I don't know what you're diffing against, but this file is history in
  -mm, and will be gone in mainline after 2.6.23.
 
 Jeff
 
Thanks for noting me. I usually pull the masters branch, so my previously 
submitted
patches are against that. Apparently I have to apply the -mm patchset before 
sending
patches. Is there a git branch to pull from for that?

Roel
-
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 08/12] NLM: Fix a circular lock dependency in lockd

2007-10-08 Thread Roel Kluin
Greg KH wrote:

@@ -477,10 +479,15 @@ nlmsvc_testlock(struct svc_rqst *rqstp, 
 
if (block == NULL) {
struct file_lock *conf = kzalloc(sizeof(*conf), GFP_KERNEL);
+   struct nlm_host *host;
 
if (conf == NULL)
return nlm_granted;
-   block = nlmsvc_create_block(rqstp, file, lock, cookie);
+   /* Create host handle for callback */
+   host = nlmsvc_lookup_host(rqstp, lock-caller, lock-len);
+   if (host == NULL)
+   return nlm_lck_denied_nolocks;
+   block = nlmsvc_create_block(rqstp, host, file, lock, cookie);
if (block == NULL) {
kfree(conf);
return nlm_granted;

To be frankly I don't know what this is about, but shouldn't conf be freed if 
host == NULL?
-
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 v4] IBM power meter driver

2007-10-09 Thread Roel Kluin
Mark M. Hoffman wrote:
 +static void ibmpex_register_bmc(int iface, struct device *dev)
 +{
 +struct ibmpex_bmc_data *data;
 +int err;
 +
 +data = kzalloc(sizeof(*data), GFP_KERNEL);
 +if (!data) {
 +printk(KERN_ERR DRVNAME : Insufficient memory for BMC 
 +   interface %d.\n, data-interface);
 +return;
 +}
 +
 +data-address.addr_type = IPMI_SYSTEM_INTERFACE_ADDR_TYPE;
 +data-address.channel = IPMI_BMC_CHANNEL;
 +data-address.data[0] = 0;
 +data-interface = iface;
 +data-bmc_device = dev;
 +
 +/* Create IPMI messaging interface user */
 +err = ipmi_create_user(data-interface, driver_data.ipmi_hndlrs,
 +   data, data-user);
 +if (err  0) {
 +printk(KERN_ERR DRVNAME : Error, unable to register user with 
 +   ipmi interface %d\n,
 +   data-interface);
 +goto out;
 +}
 +
 +mutex_init(data-lock);
 +
 +/* Initialize message */
 +data-tx_msgid = 0;
 +init_completion(data-read_complete);
 +data-tx_message.netfn = PEX_NET_FUNCTION;
 +data-tx_message.cmd = PEX_COMMAND;
 +data-tx_message.data = data-tx_msg_data;
 +
 +/* Does this BMC support PowerExecutive? */
 +err = ibmpex_ver_check(data);
 +if (err)
 +goto out_user;
 +
 +/* Register the BMC as a HWMON class device */
 +data-hwmon_dev = hwmon_device_register(data-bmc_device);
 +
 +if (IS_ERR(data-hwmon_dev)) {
 +printk(KERN_ERR DRVNAME : Error, unable to register hwmon 
 +   class device for interface %d\n,
 +   data-interface);
 +kfree(data);
 +return;

don't you want to goto out_user here instead?

 +}
 +
 +/* finally add the new bmc data to the bmc data list */
 +dev_set_drvdata(dev, data);
 +list_add_tail(data-list, driver_data.bmc_data);
 +
 +/* Now go find all the sensors */
 +err = ibmpex_find_sensors(data);
 +if (err) {
 +printk(KERN_ERR Error %d allocating memory\n, err);
 +goto out_register;
 +}
 +
 +return;
 +
 +out_register:
 +hwmon_device_unregister(data-hwmon_dev);
 +out_user:
 +ipmi_destroy_user(data-user);
 +out:
 +kfree(data);
 +}


-
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 09/31] IGET: Stop BFS from using iget() and read_inode() [try #3]

2007-10-10 Thread Roel Kluin
It is very well possible that I misunderstand the locking order here,
but FWIW:

David Howells wrote:
 diff --git a/fs/bfs/inode.c b/fs/bfs/inode.c
 index f346eb1..76798c9 100644
 --- a/fs/bfs/inode.c
 +++ b/fs/bfs/inode.c
 @@ -32,25 +32,29 @@ MODULE_LICENSE(GPL);
  
  void dump_imap(const char *prefix, struct super_block * s);
  
 -static void bfs_read_inode(struct inode * inode)
 +struct inode *bfs_iget(struct super_block *sb, unsigned long ino)
  {
 - unsigned long ino = inode-i_ino;
   struct bfs_inode * di;
   struct buffer_head * bh;
 + struct inode *inode;
   int block, off;
  
 + inode = iget_locked(sb, ino);

after this

 + if (IS_ERR(inode))
 + return ERR_PTR(-ENOMEM);
 + if (!(inode-i_state  I_NEW))
 + return inode;

Don't you have to unlock_new_inode(inode) before returning?

 +
   if (ino  BFS_ROOT_INO || ino  BFS_SB(inode-i_sb)-si_lasti) {
   printf(Bad inode number %s:%08lx\n, inode-i_sb-s_id, ino);
 - make_bad_inode(inode);
 - return;
 + goto error;
   }
  
   block = (ino - BFS_ROOT_INO)/BFS_INODES_PER_BLOCK + 1;
   bh = sb_bread(inode-i_sb, block);
   if (!bh) {
   printf(Unable to read inode %s:%08lx\n, inode-i_sb-s_id, 
 ino);
 - make_bad_inode(inode);
 - return;
 + goto error;
   }
  
   off = (ino - BFS_ROOT_INO) % BFS_INODES_PER_BLOCK;
 @@ -85,6 +89,12 @@ static void bfs_read_inode(struct inode * inode)
   BFS_I(inode)-i_dsk_ino = le16_to_cpu(di-i_ino); /* can be 0 so we 
 store a copy */
  
   brelse(bh);
 + unlock_new_inode(inode);
 + return inode;
 +
 +error:

and also here?

 + iget_failed(inode);
 + return ERR_PTR(-EIO);
  }
-
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 try #2] Input/Joystick Driver: add support AD7142 joystick driver

2007-10-12 Thread Roel Kluin
Bryan Wu wrote:
 +static int ad7142_i2c_read(struct i2c_client *client, unsigned short offset,
 + unsigned short *data, unsigned int len)
 +{
 + int ret = -1;
 + int i;
 + u8 block_data[32];
 +
 + if (len  1  len  16) {

you want || here

 + printk(KERN_ERR AD7142: read data length error\n);
 + return ret;
 + }
 +
 + /* Do raw I2C, not smbus compatible */
 + block_data[0] = (offset  0xFF00)  8;
 + block_data[1] = (offset  0x00FF);
 +
 + ret = i2c_master_send(client, block_data, 2);
 + if (ret  0) {
 + printk(KERN_ERR AD7142: I2C read error\n);
 + return ret;
 + }
 +
 + ret = i2c_master_recv(client, block_data, len * 2);
 + if (ret  0) {
 + printk(KERN_ERR AD7142: I2C transfer error\n);
 + return ret;
 + }
 +
 + for (i = 0; i  len; i++) {
 + unsigned short temp;
 + temp = block_data[2 * i];
 + temp = (temp  8)  0xFF00;
 + *data++ = temp | block_data[2 * i + 1];
 + }
 +
 + return ret;
 +}


-
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] tty_ioctl: Fix the baud_table check in encode_baud_rate

2007-10-16 Thread Roel Kluin
Since you were sending a fix, possibly I shouldn't comment on this. If so 
please disregard my
suggestion for a trivial cleanup.

Roel

Maciej W. Rozycki wrote:
 +void tty_termios_encode_baud_rate(struct ktermios *termios,
 +   speed_t ibaud, speed_t obaud)
  {
   int i = 0;
   int ifound = -1, ofound = -1;
 @@ -251,12 +252,15 @@ void tty_termios_encode_baud_rate(struct
   termios-c_cflag = ~CBAUD;
  
   do {
 - if (obaud - oclose = baud_table[i]  obaud + oclose = 
 baud_table[i]) {
 + if (obaud - oclose = baud_table[i] 
 + obaud + oclose = baud_table[i]) {

if(a - b = c  a + b = c)
if(a = c + b  a + b = c)
if(c + b = a  a + b = c)
if(b = a - c  b = c - a)
true, if:
b = |a - c|
so
if (oclose = abs(obaud - baud_table[i])) {

should work as well

   termios-c_cflag |= baud_bits[i];
   ofound = i;
   }
 - if (ibaud - iclose = baud_table[i]  ibaud + iclose = 
 baud_table[i]) {
 - /* For the case input == output don't set IBAUD bits if 
 the user didn't do so */
 + if (ibaud - iclose = baud_table[i] 
 + ibaud + iclose = baud_table[i]) {

similarly,
if (iclose = abs(ibaud - baud_table[i])) {

 + /* For the case input == output don't set IBAUD bits
 +if the user didn't do so */
   if (ofound != i || ibinput)
   termios-c_cflag |= (baud_bits[i]  IBSHIFT);
   ifound = i;
-
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] fix not-and/or errors

2007-10-17 Thread Roel Kluin
if(!x  y) should either be if(!(x  y)) or if(!x  y)
I made changes as seemed appropriate, but please review
this is against current git.

Signed-off-by: Roel Kluin [EMAIL PROTECTED]
---
diff --git a/drivers/media/video/pvrusb2/pvrusb2-ctrl.c 
b/drivers/media/video/pvrusb2/pvrusb2-ctrl.c
index f569b00..46f156f 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-ctrl.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-ctrl.c
@@ -410,7 +410,7 @@ static int parse_mtoken(const char *ptr,unsigned int len,
int msk;
*valptr = 0;
for (idx = 0, msk = 1; valid_bits; idx++, msk = 1) {
-   if (!msk  valid_bits) continue;
+   if (!(msk  valid_bits)) continue;
valid_bits = ~msk;
if (!names[idx]) continue;
slen = strlen(names[idx]);
diff --git a/drivers/misc/asus-laptop.c b/drivers/misc/asus-laptop.c
index 7dce318..65c67d1 100644
--- a/drivers/misc/asus-laptop.c
+++ b/drivers/misc/asus-laptop.c
@@ -322,7 +322,7 @@ static void write_status(acpi_handle handle, int out, int 
mask)
 
switch (mask) {
case MLED_ON:
-   out = !out  0x1;
+   out = !(out  0x1);
break;
case GLED_ON:
out = (out  0x1) + 1;
diff --git a/drivers/s390/cio/cmf.c b/drivers/s390/cio/cmf.c
index b960f66..6de9d7e 100644
--- a/drivers/s390/cio/cmf.c
+++ b/drivers/s390/cio/cmf.c
@@ -343,10 +343,10 @@ static int cmf_copy_block(struct ccw_device *cdev)
 
if (sch-schib.scsw.fctl  SCSW_FCTL_START_FUNC) {
/* Don't copy if a start function is in progress. */
-   if ((!sch-schib.scsw.actl  SCSW_ACTL_SUSPENDED) 
+   if ((!(sch-schib.scsw.actl  SCSW_ACTL_SUSPENDED)) 
(sch-schib.scsw.actl 
 (SCSW_ACTL_DEVACT | SCSW_ACTL_SCHACT)) 
-   (!sch-schib.scsw.stctl  SCSW_STCTL_SEC_STATUS))
+   (!(sch-schib.scsw.stctl  SCSW_STCTL_SEC_STATUS)))
return -EBUSY;
}
cmb_data = cdev-private-cmb;
diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c
index 73c44cb..81943ef 100644
--- a/drivers/scsi/st.c
+++ b/drivers/scsi/st.c
@@ -2882,7 +2882,7 @@ static int st_int_ioctl(struct scsi_tape *STp, unsigned 
int cmd_in, unsigned lon
!(STp-use_pf  PF_TESTED)) {
/* Try the other possible state of Page Format 
if not
   already tried */
-   STp-use_pf = !STp-use_pf | PF_TESTED;
+   STp-use_pf = !(STp-use_pf | PF_TESTED);
st_release_request(SRpnt);
SRpnt = NULL;
return st_int_ioctl(STp, cmd_in, arg);
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index 60a8f55..b64309e 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -335,7 +335,7 @@ static void kick_khubd(struct usb_hub *hub)
to_usb_interface(hub-intfdev)-pm_usage_cnt = 1;
 
spin_lock_irqsave(hub_event_lock, flags);
-   if (!hub-disconnected  list_empty(hub-event_list)) {
+   if (!hub-disconnected  list_empty(hub-event_list)) {
list_add_tail(hub-event_list, hub_event_list);
wake_up(khubd_wait);
}
diff --git a/drivers/video/i810/i810_main.c b/drivers/video/i810/i810_main.c
index 1a7d778..1d13dd0 100644
--- a/drivers/video/i810/i810_main.c
+++ b/drivers/video/i810/i810_main.c
@@ -1476,7 +1476,7 @@ static int i810fb_cursor(struct fb_info *info, struct 
fb_cursor *cursor)
struct i810fb_par *par = info-par;
u8 __iomem *mmio = par-mmio_start_virtual;
 
-   if (!par-dev_flags  LOCKUP)
+   if (!(par-dev_flags  LOCKUP))
return -ENXIO;
 
if (cursor-image.width  64 || cursor-image.height  64)
diff --git a/fs/ocfs2/alloc.c b/fs/ocfs2/alloc.c
index 4ba7f0b..ce62c15 100644
--- a/fs/ocfs2/alloc.c
+++ b/fs/ocfs2/alloc.c
@@ -3946,7 +3946,7 @@ static int __ocfs2_mark_extent_written(struct inode 
*inode,
struct ocfs2_merge_ctxt ctxt;
struct ocfs2_extent_list *rightmost_el;
 
-   if (!rec-e_flags  OCFS2_EXT_UNWRITTEN) {
+   if (!(rec-e_flags  OCFS2_EXT_UNWRITTEN)) {
ret = -EIO;
mlog_errno(ret);
goto out;
diff --git a/fs/ocfs2/dlmglue.c b/fs/ocfs2/dlmglue.c
index 41c76ff..ef09fd2 100644
--- a/fs/ocfs2/dlmglue.c
+++ b/fs/ocfs2/dlmglue.c
@@ -670,7 +670,7 @@ static inline void 
ocfs2_generic_handle_attach_action(struct ocfs2_lock_res *loc
 {
mlog_entry_void();
 
-   BUG_ON((!lockres-l_flags  OCFS2_LOCK_BUSY));
+   BUG_ON((!(lockres-l_flags  OCFS2_LOCK_BUSY)));
BUG_ON(lockres-l_flags  OCFS2_LOCK_ATTACHED);
 
if (lockres-l_requested  LKM_NLMODE 
diff --git a/net/ieee80211/ieee80211_wx.c b/net/ieee80211/ieee80211_wx.c
index 9b58dd6..bc67230 100644

Re: [PATCH 2/4] fix not-and/or errors

2007-10-17 Thread Roel Kluin
Roel Kluin wrote:
 if(!x  y) should either be if(!(x  y)) or if(!x  y)
 I made changes as seemed appropriate, but please review
 
 several changes to drivers/net/
 
 Signed-off-by: Roel Kluin [EMAIL PROTECTED]
 
hmmm forgot to place '---' here, should I resend?
 diff --git a/drivers/net/e1000e/82571.c b/drivers/net/e1000e/82571.c
 index cf70522..14141a5 100644
 --- a/drivers/net/e1000e/82571.c
 +++ b/drivers/net/e1000e/82571.c


-
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] fix not-and/or errors

2007-10-17 Thread Roel Kluin
if(!x  y) should either be if(!(x  y)) or if(!x  y)
I made changes as seemed appropriate, but please review

Signed-off-by: Roel Kluin [EMAIL PROTECTED]
---
diff --git a/arch/arm/mach-pxa/mfp.c b/arch/arm/mach-pxa/mfp.c
index 5cd3cad..7229319 100644
--- a/arch/arm/mach-pxa/mfp.c
+++ b/arch/arm/mach-pxa/mfp.c
@@ -199,7 +199,7 @@ void pxa3xx_mfp_set_edge(int mfp, int edge)
 
mfpr_val = ~MFPR_EDGE_MASK;
mfpr_val |= (edge  0x3u)  MFPR_ERE_OFFSET;
-   mfpr_val |= (!edge  0x1)  MFPR_EC_OFFSET;
+   mfpr_val |= (!(edge  0x1))  MFPR_EC_OFFSET;
 
mfpr_writel(mfpr_off, mfpr_val);
mfpr_sync();
diff --git a/arch/ia64/kernel/acpi.c b/arch/ia64/kernel/acpi.c
index 3d45d24..7d78d22 100644
--- a/arch/ia64/kernel/acpi.c
+++ b/arch/ia64/kernel/acpi.c
@@ -858,7 +858,7 @@ int acpi_map_lsapic(acpi_handle handle, int *pcpu)
lsapic = (struct acpi_madt_local_sapic *)obj-buffer.pointer;
 
if ((lsapic-header.type != ACPI_MADT_TYPE_LOCAL_SAPIC) ||
-   (!lsapic-lapic_flags  ACPI_MADT_ENABLED)) {
+   (!(lsapic-lapic_flags  ACPI_MADT_ENABLED))) {
kfree(buffer.pointer);
return -EINVAL;
}
diff --git a/arch/sh/drivers/dma/dma-sh.c b/arch/sh/drivers/dma/dma-sh.c
index 958bac1..e8f9c85 100644
--- a/arch/sh/drivers/dma/dma-sh.c
+++ b/arch/sh/drivers/dma/dma-sh.c
@@ -89,7 +89,7 @@ static irqreturn_t dma_tei(int irq, void *dev_id)
 
 static int sh_dmac_request_dma(struct dma_channel *chan)
 {
-   if (unlikely(!chan-flags  DMA_TEI_CAPABLE))
+   if (unlikely(!(chan-flags  DMA_TEI_CAPABLE)))
return 0;
 
return request_irq(get_dmte_irq(chan-chan), dma_tei,
diff --git a/arch/sparc64/kernel/time.c b/arch/sparc64/kernel/time.c
index cd8c740..a2cf955 100644
--- a/arch/sparc64/kernel/time.c
+++ b/arch/sparc64/kernel/time.c
@@ -1070,7 +1070,7 @@ static int set_rtc_mmss(unsigned long nowtime)
 * Not having a register set can lead to trouble.
 * Also starfire doesn't have a tod clock.
 */
-   if (!mregs  !dregs  !bregs)
+   if (!mregs  !dregs  !bregs)
return -1;
 
if (mregs) {
diff --git a/drivers/acpi/asus_acpi.c b/drivers/acpi/asus_acpi.c
index d915fec..5a67a87 100644
--- a/drivers/acpi/asus_acpi.c
+++ b/drivers/acpi/asus_acpi.c
@@ -596,7 +596,7 @@ write_led(const char __user * buffer, unsigned long count,
(led_out) ? (hotk-status | ledmask) : (hotk-status  ~ledmask);
 
if (invert) /* invert target value */
-   led_out = !led_out  0x1;
+   led_out = !(led_out  0x1);
 
if (!write_acpi_int(hotk-handle, ledname, led_out, NULL))
printk(KERN_WARNING Asus ACPI: LED (%s) write failed\n,
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c
index 9b2c0f7..48fbe9e 100644
--- a/drivers/acpi/battery.c
+++ b/drivers/acpi/battery.c
@@ -420,8 +420,8 @@ static int acpi_battery_update(struct acpi_battery *battery,
result = acpi_battery_get_status(battery);
if (result)
goto end;
-   if ((!battery-flags.battery_present_prev  
acpi_battery_present(battery))
-   || (battery-flags.battery_present_prev  
!acpi_battery_present(battery))) {
+   if ((!battery-flags.battery_present_prev  
acpi_battery_present(battery))
+   || (battery-flags.battery_present_prev  
!acpi_battery_present(battery))) {
result = acpi_battery_init_update(battery);
if (result)
goto end;
diff --git a/drivers/block/paride/pt.c b/drivers/block/paride/pt.c
index 9f4e67e..37079d9 100644
--- a/drivers/block/paride/pt.c
+++ b/drivers/block/paride/pt.c
@@ -660,11 +660,11 @@ static int pt_open(struct inode *inode, struct file *file)
pt_identify(tape);
 
err = -ENODEV;
-   if (!tape-flags  PT_MEDIA)
+   if (!(tape-flags  PT_MEDIA))
goto out;
 
err = -EROFS;
-   if ((!tape-flags  PT_WRITE_OK)  (file-f_mode  2))
+   if ((!(tape-flags  PT_WRITE_OK))  (file-f_mode  2))
goto out;
 
if (!(iminor(inode)  128))

-
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] fix not-and/or errors

2007-10-17 Thread Roel Kluin
if(!x  y) should either be if(!(x  y)) or if(!x  y)
I made changes as seemed appropriate, but please review

several changes to drivers/net/

Signed-off-by: Roel Kluin [EMAIL PROTECTED]

diff --git a/drivers/net/e1000e/82571.c b/drivers/net/e1000e/82571.c
index cf70522..14141a5 100644
--- a/drivers/net/e1000e/82571.c
+++ b/drivers/net/e1000e/82571.c
@@ -283,7 +283,7 @@ static s32 e1000_get_invariants_82571(struct e1000_adapter 
*adapter)
adapter-flags = ~FLAG_HAS_WOL;
/* quad ports only support WoL on port A */
if (adapter-flags  FLAG_IS_QUAD_PORT 
-   (!adapter-flags  FLAG_IS_QUAD_PORT_A))
+   (!(adapter-flags  FLAG_IS_QUAD_PORT_A)))
adapter-flags = ~FLAG_HAS_WOL;
break;
 
diff --git a/drivers/net/wireless/airo.c b/drivers/net/wireless/airo.c
index 074055e..e3eca6d 100644
--- a/drivers/net/wireless/airo.c
+++ b/drivers/net/wireless/airo.c
@@ -6407,7 +6407,7 @@ static int airo_set_encode(struct net_device *dev,
set_wep_key(local, index, NULL, 0, perm, 1);
} else
/* Don't complain if only change the mode */
-   if(!dwrq-flags  IW_ENCODE_MODE) {
+   if(!(dwrq-flags  IW_ENCODE_MODE)) {
return -EINVAL;
}
}
diff --git a/drivers/net/wireless/atmel.c b/drivers/net/wireless/atmel.c
index 059ce3f..57cc7e5 100644
--- a/drivers/net/wireless/atmel.c
+++ b/drivers/net/wireless/atmel.c
@@ -1759,7 +1759,7 @@ static int atmel_set_encode(struct net_device *dev,
priv-default_key = index;
} else
/* Don't complain if only change the mode */
-   if (!dwrq-flags  IW_ENCODE_MODE) {
+   if (!(dwrq-flags  IW_ENCODE_MODE)) {
return -EINVAL;
}
}
diff --git a/drivers/net/wireless/libertas/wext.c 
b/drivers/net/wireless/libertas/wext.c
index c6f5aa3..d93438c 100644
--- a/drivers/net/wireless/libertas/wext.c
+++ b/drivers/net/wireless/libertas/wext.c
@@ -1380,7 +1380,7 @@ static int wlan_get_encodeext(struct net_device *dev,
index = adapter-wep_tx_keyidx;
}
 
-   if (!ext-ext_flags  IW_ENCODE_EXT_GROUP_KEY 
+   if (!(ext-ext_flags  IW_ENCODE_EXT_GROUP_KEY) 
ext-alg != IW_ENCODE_ALG_WEP) {
if (index != 0 || adapter-mode != IW_MODE_INFRA)
goto out;
diff --git a/drivers/net/wireless/p54common.c b/drivers/net/wireless/p54common.c
index 2c63cf0..b67a31e 100644
--- a/drivers/net/wireless/p54common.c
+++ b/drivers/net/wireless/p54common.c
@@ -374,7 +374,7 @@ static void p54_rx_frame_sent(struct ieee80211_hw *dev, 
struct sk_buff *skb)
if ((entry_hdr-magic1  cpu_to_le16(0x4000)) != 0)
pad = entry_data-align[0];
 
-   if (!status.control.flags  IEEE80211_TXCTL_NO_ACK) {
+   if (!(status.control.flags  IEEE80211_TXCTL_NO_ACK)) {
if (!(payload-status  0x01))
status.flags |= IEEE80211_TX_STATUS_ACK;
else
diff --git a/drivers/net/wireless/prism54/isl_ioctl.c 
b/drivers/net/wireless/prism54/isl_ioctl.c
index 6d80ca4..b9d0073 100644
--- a/drivers/net/wireless/prism54/isl_ioctl.c
+++ b/drivers/net/wireless/prism54/isl_ioctl.c
@@ -1118,7 +1118,7 @@ prism54_set_encode(struct net_device *ndev, struct 
iw_request_info *info,
mgt_set_request(priv, DOT11_OID_DEFKEYID, 0,
index);
} else {
-   if (!dwrq-flags  IW_ENCODE_MODE) {
+   if (!(dwrq-flags  IW_ENCODE_MODE)) {
/* we cannot do anything. Complain. */
return -EINVAL;
}
@@ -2610,7 +2610,7 @@ prism2_ioctl_set_encryption(struct net_device *dev,
mgt_set_request(priv, DOT11_OID_DEFKEYID, 0,
index);
} else {
-   if (!param-u.crypt.flags  IW_ENCODE_MODE) {
+   if (!(param-u.crypt.flags  IW_ENCODE_MODE)) {
/* we cannot do anything. Complain. */
return -EINVAL;
}
diff --git a/drivers/net/wireless/zd1211rw/zd_rf_uw2453.c 
b/drivers/net/wireless/zd1211rw/zd_rf_uw2453.c
index 857dcf3..3c1cca4 100644
--- a/drivers/net/wireless/zd1211rw/zd_rf_uw2453.c
+++ b/drivers/net/wireless/zd1211rw/zd_rf_uw2453.c
@@ -403,7 +403,7 @@ static int uw2453_init_hw(struct zd_rf *rf)
if (r)
return r

Re: [PATCH 3/4] fix not-and/or errors

2007-10-17 Thread Roel Kluin
commit 568f9787e58b4d24be50ab2abf1c7dab12a9ef2c
Author: Roel Kluin [EMAIL PROTECTED]
Date:   Wed Oct 17 15:16:44 2007 +0200

if(!x  y) should either be if(!(x  y)) or if(!x  y)
I made changes as seemed appropriate, but please review

several changes to drivers/isdn/

Signed-off-by: Roel Kluin [EMAIL PROTECTED]
---
diff --git a/drivers/isdn/act2000/module.c b/drivers/isdn/act2000/module.c
index ee2b0b9..8325022 100644
--- a/drivers/isdn/act2000/module.c
+++ b/drivers/isdn/act2000/module.c
@@ -310,7 +310,7 @@ act2000_command(act2000_card * card, isdn_ctrl * c)
}
break;
case ISDN_CMD_DIAL:
-   if (!card-flags  ACT2000_FLAGS_RUNNING)
+   if (!(card-flags  ACT2000_FLAGS_RUNNING))
return -ENODEV;
if (!(chan = find_channel(card, c-arg  0x0f)))
break;
@@ -339,7 +339,7 @@ act2000_command(act2000_card * card, isdn_ctrl * c)
}
return ret;
case ISDN_CMD_ACCEPTD:
-   if (!card-flags  ACT2000_FLAGS_RUNNING)
+   if (!(card-flags  ACT2000_FLAGS_RUNNING))
return -ENODEV;
if (!(chan = find_channel(card, c-arg  0x0f)))
break;
@@ -347,11 +347,11 @@ act2000_command(act2000_card * card, isdn_ctrl * c)
actcapi_select_b2_protocol_req(card, chan);
return 0;
case ISDN_CMD_ACCEPTB:
-   if (!card-flags  ACT2000_FLAGS_RUNNING)
+   if (!(card-flags  ACT2000_FLAGS_RUNNING))
return -ENODEV;
return 0;
case ISDN_CMD_HANGUP:
-   if (!card-flags  ACT2000_FLAGS_RUNNING)
+   if (!(card-flags  ACT2000_FLAGS_RUNNING))
return -ENODEV;
if (!(chan = find_channel(card, c-arg  0x0f)))
break;
@@ -366,7 +366,7 @@ act2000_command(act2000_card * card, isdn_ctrl * c)
}
return 0;
case ISDN_CMD_SETEAZ:
-   if (!card-flags  ACT2000_FLAGS_RUNNING)
+   if (!(card-flags  ACT2000_FLAGS_RUNNING))
return -ENODEV;
if (!(chan = find_channel(card, c-arg  0x0f)))
break;
@@ -386,7 +386,7 @@ act2000_command(act2000_card * card, isdn_ctrl * c)
actcapi_listen_req(card);
return 0;
case ISDN_CMD_CLREAZ:
-   if (!card-flags  ACT2000_FLAGS_RUNNING)
+   if (!(card-flags  ACT2000_FLAGS_RUNNING))
return -ENODEV;
if (!(chan = find_channel(card, c-arg  0x0f)))
break;
@@ -394,14 +394,14 @@ act2000_command(act2000_card * card, isdn_ctrl * c)
actcapi_listen_req(card);
return 0;
case ISDN_CMD_SETL2:
-   if (!card-flags  ACT2000_FLAGS_RUNNING)
+   if (!(card-flags  ACT2000_FLAGS_RUNNING))
return -ENODEV;
if (!(chan = find_channel(card, c-arg  0x0f)))
break;
chan-l2prot = (c-arg  8);
return 0;
case ISDN_CMD_SETL3:
-   if (!card-flags  ACT2000_FLAGS_RUNNING)
+   if (!(card-flags  ACT2000_FLAGS_RUNNING))
return -ENODEV;
if ((c-arg  8) != ISDN_PROTO_L3_TRANS) {
printk(KERN_WARNING L3 protocol unknown\n);
@@ -524,7 +524,7 @@ if_writecmd(const u_char __user *buf, int len, int id, int 
channel)
 act2000_card *card = act2000_findcard(id);
 
 if (card) {
-if (!card-flags  ACT2000_FLAGS_RUNNING)
+if (!(card-flags  ACT2000_FLAGS_RUNNING))
 return -ENODEV;
 return (len);
 }
@@ -539,7 +539,7 @@ if_readstatus(u_char __user * buf, int len, int id, int 
channel)
 act2000_card *card = act2000_findcard(id);

 if (card) {
-if (!card-flags  ACT2000_FLAGS_RUNNING)
+if (!(card-flags  ACT2000_FLAGS_RUNNING))
 return -ENODEV;
 return (act2000_readstatus(buf, len, card));
 }
@@ -554,7 +554,7 @@ if_sendbuf(int id, int channel, int ack, struct sk_buff 
*skb)
 act2000_card *card = act2000_findcard(id);

 if (card

Re: Fix bug in end absolute address in drivers/mtd/devices/slram.c

2012-09-22 Thread Roel Kluin
On Thu, Sep 20, 2012 at 5:55 PM, Jiri Kosina jkos...@suse.cz wrote:
 On Thu, 20 Sep 2012, Jiri Engelthaler wrote:

 Hello.
   I found a bug in parsing end absolute address in
 drivers/mtd/devices/slram.c. There is checking for startaddress 
 endaddress and endaddress subtracted by startaddress before check. The
 bug is there from commit 3afd522de8d8ec446efe957b86e4f63e3dd8ce9d Mon,
 19 Jan 2009 01:24:21 +

 Here is the patch

 Signed-off-by: Jiri Engelthaler eng...@gmail.com

 --- linux-3.2.28/drivers/mtd/devices/slram.c  2012-08-19 19:15:38.0 
 +0200
 +++ linux-3.2.28.mod/drivers/mtd/devices/slram.c  2012-09-19
 18:29:28.012740703 +0200
 @@ -266,7 +266,7 @@ static int parse_cmdline(char *devname,

   if (*(szlength) != '+') {
   devlength = simple_strtoul(szlength, buffer, 0);
 - devlength = handle_unit(devlength, buffer) - devstart;
 + devlength = handle_unit(devlength, buffer);
   if (devlength  devstart)
   goto err_out;

 ... adding the suspects to CC so that they are aware of this.

Yes, that's what it should have been. FWIW,

Acked-by: Roel Kluin roel.kl...@gmail.com
--
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/


[drivers/misc/thinkpad_acpi.c] duplicate test if (level TP_EC_FAN_FULLSPEED)

2008-02-04 Thread Roel Kluin
in drivers/misc/thinkpad_acpi.c: 4137-4142 it reads:

/* safety net should the EC not support AUTO
 * or FULLSPEED mode bits and just ignore them */
if (level  TP_EC_FAN_FULLSPEED)
level |= 7; /* safety min speed 7 */
else if (level  TP_EC_FAN_FULLSPEED)
level |= 4; /* safety min speed 4 */

Note the duplicate test 'if (level  TP_EC_FAN_FULLSPEED)'. should
this be replaced by

if (level  TP_EC_FAN_FULLSPEED)
level |= 7; /* safety min speed 7 */
else
level |= 4; /* safety min speed 4 */

or 

if (level  TP_EC_FAN_FULLSPEED)
level |= 7; /* safety min speed 7 */
if (level  TP_EC_FAN_FULLSPEED)
level |= 4; /* safety min speed 4 */

?
--
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/


[drivers/scsi/NCR53C9x.c] remove duplication for family_code == 0x00

2008-02-04 Thread Roel Kluin
in drivers/scsi/NCR53C9x.c:412-422 it reads:

else if(family_code == 0x00) {
if ((version  7) == 2)
esp-erev = fas100a; /* NCR53C9X */
else
esp-erev = espunknown;
} else if(family_code == 0x14) {
if ((version  7) == 2)
esp-erev = fsc;
else
esp-erev = espunknown;
} else if(family_code == 0x00) {
if ((version  7) == 2)
esp-erev = fas100a; /* NCR53C9X */
else
esp-erev = espunknown;

Note the duplication of test 'if(family_code == 0x00)' and lines below

Signed-off-by: Roel Kluin [EMAIL PROTECTED]
---
diff --git a/drivers/scsi/NCR53C9x.c b/drivers/scsi/NCR53C9x.c
index 5b0efc9..b8df3c0 100644
--- a/drivers/scsi/NCR53C9x.c
+++ b/drivers/scsi/NCR53C9x.c
@@ -419,11 +419,6 @@ static void esp_reset_esp(struct NCR_ESP *esp, struct 
ESP_regs *eregs)
esp-erev = fsc;
else
esp-erev = espunknown;
-   } else if(family_code == 0x00) {
-   if ((version  7) == 2)
-   esp-erev = fas100a; /* NCR53C9X */
-   else
-   esp-erev = espunknown;
} else
esp-erev = espunknown;
ESPLOG((esp%d: FAST chip is %s (family=%d, version=%d)\n,
--
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][sound/soc/fsl/mpc8610_hpcd.c] duplicate strcasecmp test for rj-master in mpc8610_hpcd_probe()

2008-02-04 Thread Roel Kluin
In linus' git tree I found this problem. Is it also in the alsa tree?
please confirm it's the right fix. The patch was not yet tested.
--
duplicate test for rj-master

Signed-off-by: Roel Kluin [EMAIL PROTECTED]
---
diff --git a/sound/soc/fsl/mpc8610_hpcd.c b/sound/soc/fsl/mpc8610_hpcd.c
index f26c4b2..a00aac7 100644
--- a/sound/soc/fsl/mpc8610_hpcd.c
+++ b/sound/soc/fsl/mpc8610_hpcd.c
@@ -314,9 +314,9 @@ static int mpc8610_hpcd_probe(struct of_device *ofdev,
} else if (strcasecmp(sprop, lj-master) == 0) {
machine_data-dai_format = SND_SOC_DAIFMT_LEFT_J;
machine_data-codec_clk_direction = SND_SOC_CLOCK_IN;
machine_data-cpu_clk_direction = SND_SOC_CLOCK_OUT;
-   } else if (strcasecmp(sprop, rj-master) == 0) {
+   } else if (strcasecmp(sprop, rj-slave) == 0) {
machine_data-dai_format = SND_SOC_DAIFMT_RIGHT_J;
machine_data-codec_clk_direction = SND_SOC_CLOCK_OUT;
machine_data-cpu_clk_direction = SND_SOC_CLOCK_IN;
} else if (strcasecmp(sprop, rj-master) == 0) {
--
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][drivers/misc/thinkpad_acpi.c] duplicate test 'if (level TP_EC_FAN_FULLSPEED)'

2008-02-04 Thread Roel kluin
in drivers/misc/thinkpad_acpi.c, lines 4137-4142 it reads:

/* safety net should the EC not support AUTO
 * or FULLSPEED mode bits and just ignore them */
if (level  TP_EC_FAN_FULLSPEED)
level |= 7; /* safety min speed 7 */
else if (level  TP_EC_FAN_FULLSPEED)
level |= 4; /* safety min speed 4 */

note the nonsense duplicate test 'if (level  TP_EC_FAN_FULLSPEED)'.
should this be changed to:

if (level  TP_EC_FAN_FULLSPEED)
level |= 7; /* safety min speed 7 */
else
level |= 4; /* safety min speed 4 */

or maybe

if (level  TP_EC_FAN_FULLSPEED)
level |= 7; /* safety min speed 7 */
if (level  TP_EC_FAN_FULLSPEED)
level |= 4; /* safety min speed 4 */

?
--
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][drivers/misc/thinkpad_acpi.c] duplicate test if (level TP_EC_FAN_FULLSPEED)

2008-02-04 Thread Roel Kluin
Roland Dreier wrote:
   /* safety net should the EC not support AUTO
* or FULLSPEED mode bits and just ignore them */
   if (level  TP_EC_FAN_FULLSPEED)
   level |= 7; /* safety min speed 7 */
   else if (level  TP_EC_FAN_FULLSPEED)
   level |= 4; /* safety min speed 4 */
   
   Note the duplicate test 'if (level  TP_EC_FAN_FULLSPEED)'. should
   this be replaced by
 
 Actually I suspect one of the two tests should be against TP_EC_FAN_AUTO
 (based on the comment).
 

Thanks Roland, for your info

based on the comments in commit eaa7571b2d1a08873e4bdd8e6db3431df61cd9ad,
I think this should be modified like below:

ACPI: thinkpad-acpi: add a safety net for TPEC fan control mode
The Linux ThinkPad community is not positive that all ThinkPads that do
HFSP EC fan control do implement full-speed and auto modes, some of the
earlier ones supporting HFSP might not.

If the EC ignores the AUTO or FULL-SPEED bits, it will pay attention to the
lower three bits that set the fan level. And as thinkpad-acpi was leaving
these set to zero, it would stop(!) the fan, which is Not A Good Thing.
So, as a safety net, we now make sure to also set the fan level part of the
HFSP register to speed 7 for full-speed, and a minimum of speed 4 for auto
mode.
--
second TP_EC_FAN_FULLSPEED should be P_EC_FAN_AUTO


Signed-off-by: Roel Kluin [EMAIL PROTECTED]
---
diff --git a/drivers/misc/thinkpad_acpi.c b/drivers/misc/thinkpad_acpi.c
index cf56647..3c323fe 100644
--- a/drivers/misc/thinkpad_acpi.c
+++ b/drivers/misc/thinkpad_acpi.c
@@ -4138,7 +4138,7 @@ static int fan_set_level(int level)
 * or FULLSPEED mode bits and just ignore them */
if (level  TP_EC_FAN_FULLSPEED)
level |= 7; /* safety min speed 7 */
-   else if (level  TP_EC_FAN_FULLSPEED)
+   else if (level  TP_EC_FAN_AUTO)
level |= 4; /* safety min speed 4 */
 
if (!acpi_ec_write(fan_status_offset, level))

--
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][drivers/scsi/u14-34f.c] duplicate test 'SCpnt-sc_data_direction == DMA_FROM_DEVICE'

2008-02-04 Thread Roel Kluin
It should be like this I guess? this patch was not yet tested, please
confirm.
--
Note the duplicate test 'SCpnt-sc_data_direction == DMA_FROM_DEVICE'

from Documentation/DMA-API.txt:
DMA_TO_DEVICE = PCI_DMA_TODEVICE  data is going from the
  memory to the device
DMA_FROM_DEVICE   = PCI_DMA_FROMDEVICEdata is coming from
  the device to the

Signed-off-by: Roel Kluin [EMAIL PROTECTED]
---
diff --git a/drivers/scsi/u14-34f.c b/drivers/scsi/u14-34f.c
index 662c004..1e704f9 100644
--- a/drivers/scsi/u14-34f.c
+++ b/drivers/scsi/u14-34f.c
@@ -1208,15 +1208,15 @@ static void scsi_to_dev_dir(unsigned int i, unsigned 
int j) {
   };
 
struct mscp *cpp;
struct scsi_cmnd *SCpnt;
 
cpp = HD(j)-cp[i]; SCpnt = cpp-SCpnt;
 
-   if (SCpnt-sc_data_direction == DMA_FROM_DEVICE) {
+   if (SCpnt-sc_data_direction == DMA_TO_DEVICE) {
   cpp-xdir = DTD_IN;
   return;
   }
else if (SCpnt-sc_data_direction == DMA_FROM_DEVICE) {
   cpp-xdir = DTD_OUT;
   return;
   }

--
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][drivers/scsi/u14-34f.c] duplicate test 'SCpnt-sc_data_direction == DMA_FROM_DEVICE'

2008-02-05 Thread Roel Kluin
[EMAIL PROTECTED] wrote:
  Good to know that somebody still uses the Ultrastor 14f board :).
 Yes, this typo was introduced by somebody doing massive editing to all
 scsi drivers long ago.
 Cheers,
 --db
Actually, I do not own a Ultrastor 14f board. I found this by searching for
if (test)
...
else if (exactly same test)
...
Thanks,
Roel
--
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][drivers/misc/thinkpad_acpi.c] duplicate test if (level TP_EC_FAN_FULLSPEED)

2008-02-05 Thread Roel Kluin
Henrique de Moraes Holschuh wrote:
 On Tue, 05 Feb 2008, Roel Kluin wrote:
 Roland Dreier wrote:
   /* safety net should the EC not support AUTO
* or FULLSPEED mode bits and just ignore them */
   if (level  TP_EC_FAN_FULLSPEED)
   level |= 7; /* safety min speed 7 */
   else if (level  TP_EC_FAN_FULLSPEED)
   level |= 4; /* safety min speed 4 */
   
   Note the duplicate test 'if (level  TP_EC_FAN_FULLSPEED)'. should
   this be replaced by

 Actually I suspect one of the two tests should be against TP_EC_FAN_AUTO
 (based on the comment).
 Thanks Roland, for your info

 based on the comments in commit eaa7571b2d1a08873e4bdd8e6db3431df61cd9ad,
 I think this should be modified like below:

 ACPI: thinkpad-acpi: add a safety net for TPEC fan control mode
 The Linux ThinkPad community is not positive that all ThinkPads that do
 HFSP EC fan control do implement full-speed and auto modes, some of the
 earlier ones supporting HFSP might not.

 If the EC ignores the AUTO or FULL-SPEED bits, it will pay attention to the
 lower three bits that set the fan level. And as thinkpad-acpi was leaving
 these set to zero, it would stop(!) the fan, which is Not A Good Thing.
 So, as a safety net, we now make sure to also set the fan level part of the
 HFSP register to speed 7 for full-speed, and a minimum of speed 4 for auto
 mode.
 --
 second TP_EC_FAN_FULLSPEED should be P_EC_FAN_AUTO


 Signed-off-by: Roel Kluin [EMAIL PROTECTED]
 ---
 diff --git a/drivers/misc/thinkpad_acpi.c b/drivers/misc/thinkpad_acpi.c
 index cf56647..3c323fe 100644
 --- a/drivers/misc/thinkpad_acpi.c
 +++ b/drivers/misc/thinkpad_acpi.c
 @@ -4138,7 +4138,7 @@ static int fan_set_level(int level)
   * or FULLSPEED mode bits and just ignore them */
  if (level  TP_EC_FAN_FULLSPEED)
  level |= 7; /* safety min speed 7 */
 -else if (level  TP_EC_FAN_FULLSPEED)
 +else if (level  TP_EC_FAN_AUTO)
  level |= 4; /* safety min speed 4 */
  
  if (!acpi_ec_write(fan_status_offset, level))
 
 ACK.  This needs to be sent to stable as well.  I think both 2.6.22 and
 2.6.23 need this patch.
 

CC [EMAIL PROTECTED]
--
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/HP7XX] - Add combined LCD / BL driver for platform HP Jornada 7xx handhelds

2008-02-06 Thread Roel Kluin
Roel Kluin wrote:
 Kristoffer Ericson wrote:
 Greetings,

 Richard I've cleaned up the driver by checking with checkpatch.pl as Russell 
 suggested. I would appreciate it if you could
 look through the patch again and give comments since the patch looks 
 somewhat different.

 I can add patch for Kconfig/Makefile later on but suspect there will be some 
 changes required before that.

 Oh and to answer your question regarding MAX/MIN values of the backlight, 0 
 = max and 255 = min. So we simply turn it around
 by returning 255 - value. Same thing when we need to set value.

 Best wishes
 Kristoffer Ericson

 diff --git a/drivers/video/backlight/jornada720_bllcd.c 
 b/drivers/video/backlight/jornada720_bllcd.c

 +static int jornada_bl_get_brightness(struct backlight_device *dev)
 +{
 +int ret;
 +
 +/* check if backlight is on */
 +if (!(PPSR  PPC_LDD1))
 +return 255;
 return JORNADA_BL_MAX_BRIGHTNESS;
 
 +
 +jornada_ssp_start();
 +if (jornada_ssp_inout(GETBRIGHTNESS) == -ETIMEDOUT) {
 +printk(KERN_ERR jornada720_bl: GetBrightness failed\n);
 +ret = 256;
 ret = JORNADA_BL_MAX_BRIGHTNESS + 1;
 +} else
 +ret = jornada_ssp_inout(TXDUMMY);

forgot to mention missing curly bracket here

 +
 +jornada_ssp_end();
 +
 +/* 0 is max brightness */
 +return (255 - ret);
 return (JORNADA_BL_MAX_BRIGHTNESS - ret);
 +}
--
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/HP7XX] - Add combined LCD / BL driver for platform HP Jornada 7xx handhelds

2008-02-06 Thread Roel Kluin
Kristoffer Ericson wrote:
 Greetings,
 
 Richard I've cleaned up the driver by checking with checkpatch.pl as Russell 
 suggested. I would appreciate it if you could
 look through the patch again and give comments since the patch looks somewhat 
 different.
 
 I can add patch for Kconfig/Makefile later on but suspect there will be some 
 changes required before that.
 
 Oh and to answer your question regarding MAX/MIN values of the backlight, 0 = 
 max and 255 = min. So we simply turn it around
 by returning 255 - value. Same thing when we need to set value.
 
 Best wishes
 Kristoffer Ericson
 
 diff --git a/drivers/video/backlight/jornada720_bllcd.c 
 b/drivers/video/backlight/jornada720_bllcd.c
 new file mode 100644
 index 000..4967b86
 --- /dev/null
 +++ b/drivers/video/backlight/jornada720_bllcd.c
 @@ -0,0 +1,284 @@
 +/*
 + * drivers/video/backlight/jornada720_bllcd.c
 + *
 + * Backlight and LCD Driver for HP Jornada 720
 + * Copyright (C) 2007 Kristoffer Ericson [EMAIL PROTECTED]
 + *
 + * This program is free software; you can redistribute it and/or modify
 + * it under the terms of the GNU General Public License version 2
 + * or any later version as published by the Free Software Foundation.
 + *
 + */
 +#include linux/module.h
 +#include linux/kernel.h
 +#include linux/init.h
 +#include linux/backlight.h
 +#include linux/lcd.h
 +#include linux/delay.h
 +#include linux/platform_device.h
 +#include linux/fb.h
 +#include linux/device.h
 +#include asm/hardware.h
 +#include asm/arch/jornada720.h
 +#include video/s1d13xxxfb.h
 +
 +MODULE_AUTHOR(Kristoffer Ericson [EMAIL PROTECTED]);
 +MODULE_DESCRIPTION(HP Jornada 710/720/728 Backlight/LCD Driver);
 +MODULE_LICENSE(GPL);
 +
 +#define JORNADA_LCD_MAX_CONTRAST 0xff
 +#define JORNADA_LCD_DEFAULT_CONTRAST 0x80
 +#define JORNADA_BL_MAX_BRIGHTNESS0xff
 +#define JORNADA_BL_DEFAULT_BRIGHTNESS0x19
 +
 +struct jornada_bllcd_device {
 + struct backlight_device *jorn_backlight_device;
 + struct lcd_device *jorn_lcd_device;
 +};
 +
 +/*
 + * BACKLIGHT HANDLING ROUTINES
 + */
 +static int jornada_bl_get_brightness(struct backlight_device *dev)
 +{
 + int ret;
 +
 + /* check if backlight is on */
 + if (!(PPSR  PPC_LDD1))
 + return 255;
return JORNADA_BL_MAX_BRIGHTNESS;

 +
 + jornada_ssp_start();
 + if (jornada_ssp_inout(GETBRIGHTNESS) == -ETIMEDOUT) {
 + printk(KERN_ERR jornada720_bl: GetBrightness failed\n);
 + ret = 256;
ret = JORNADA_BL_MAX_BRIGHTNESS + 1;
 + } else
 + ret = jornada_ssp_inout(TXDUMMY);
 +
 + jornada_ssp_end();
 +
 + /* 0 is max brightness */
 + return (255 - ret);
return (JORNADA_BL_MAX_BRIGHTNESS - ret);
 +}
 +
 +static int jornada_bl_update_status(struct backlight_device *dev)
 +{
 + int ret = 0;
 +
 + jornada_ssp_start();
 +
 + if (dev-props.power != FB_BLANK_UNBLANK ||
 + dev-props.fb_blank != FB_BLANK_UNBLANK) {
 + ret = jornada_ssp_inout(BRIGHTNESSOFF);
 + if (ret == -ETIMEDOUT)
 + printk(KERN_ERR jornada720_bl:
 + BrightnessOff timeout\n);
 + else {
 + /* backlight off */
 + PPSR = ~PPC_LDD1;
 + PPDR |= PPC_LDD1;
 + }
 + } else {/* backlight on */
 + PPSR |= PPC_LDD1;

missing curly bracket

 +
 + if ((jornada_ssp_inout(SETBRIGHTNESS)) == TXDUMMY) {
 + /* send brightness value (0 is max, 255 lowest) */
 + if (jornada_ssp_byte(255 - dev-props.brightness) != -ETIMEDOUT)
 + ret = (255 - dev-props.brightness);

similarly JORNADA_BL_MAX_BRIGHTNESS in the three lines above

 + } else
 + printk(KERN_ERR jornada720_bl: SetBrightness timeout\n);
 + }
 +
 + jornada_ssp_end();
 +
 + return ret;
 +}
 +
 +/* LCD HANDLING FUNCTIONS
 +   == */
 +static int jornada_lcd_set_contrast(struct lcd_device *pdev, int contrast)
 +{
 + int ret = 0;
 +
 + jornada_ssp_start();
 +
 + ret = jornada_ssp_inout(SETCONTRAST);
 +
 + if (ret == -ETIMEDOUT)
 + printk(KERN_INFO jornada_lcd: failure to set contrast\n);
 +  else
 + ret = jornada_ssp_byte(contrast);
 +
 + jornada_ssp_end();
 +
 + return ret;
 +}
 +
 +static int jornada_lcd_set_power(struct lcd_device  *pdev, int power)
 +{
 + if (power != FB_BLANK_UNBLANK) {
 + /* turn off LCD */
 + PPSR = ~PPC_LDD2;
 + PPDR |= PPC_LDD2;
 + } else
 + /* turn on LCD */
 + PPSR |= PPC_LDD2;

wrong indent

 +
 + return 0;
 +}
 +
 +static int jornada_lcd_get_power(struct lcd_device *pdev)
 +{
 + if (PPSR  PPC_LDD2)
 + return FB_BLANK_UNBLANK;
 + else
 + return FB_BLANK_POWERDOWN;
 +}
 +
 +static int jornada_lcd_get_contrast(struct lcd_device *pdev)
 +{
 + int ret;
 +
 + /* Don't set 

Re: [PATCH/HP7XX] - Add combined LCD / BL driver for platform HP Jornada 7xx handhelds

2008-02-06 Thread Roel Kluin
Kristoffer Ericson wrote:
 Oki, here is attempt #2 (btw, new mail or just keep thread?)
 
 Tested to build and checkpatch.
 
 diff --git a/drivers/video/backlight/jornada720_bllcd.c 
 b/drivers/video/backlight/jornada720_bllcd.c

 +static int jornada_bl_update_status(struct backlight_device *dev)
 +{
 + int ret = 0;
 +
 + jornada_ssp_start();
 +
 + if (dev-props.power != FB_BLANK_UNBLANK ||
 + dev-props.fb_blank != FB_BLANK_UNBLANK) {
 + ret = jornada_ssp_inout(BRIGHTNESSOFF);
 + if (ret == -ETIMEDOUT)

since there is no curly bracket here...

 + printk(KERN_ERR jornada720_bl: \
 + BrightnessOff timeout\n);

...indentation is wrong in lines below

 + /* backlight off */
 + PPSR = ~PPC_LDD1;
 + PPDR |= PPC_LDD1;
 +
 + } else  {   /* backlight on */

too much indentation in lines below as well

 + PPSR |= PPC_LDD1;
 + if ((jornada_ssp_inout(SETBRIGHTNESS)) == TXDUMMY) {
 + /* send brightness value (0 is max, 255 lowest) */
 + if (jornada_ssp_byte(JORNADA_BL_MAX_BRIGHTNESS -
 +  dev-props.brightness) != -ETIMEDOUT)
 + ret = (JORNADA_BL_MAX_BRIGHTNESS -
 + dev-props.brightness);
 + } else
 + printk(KERN_ERR jornada720_bl: \
 + SetBrightness timeout\n);
 + }
 + jornada_ssp_end();
 +
 + return ret;
 +}

 +static int jornada_lcd_set_contrast(struct lcd_device *pdev, int contrast)
 +{
 + int ret = 0;
 +
 + jornada_ssp_start();
 +
 + ret = jornada_ssp_inout(SETCONTRAST);
 +
 + if (ret == -ETIMEDOUT)
 + printk(KERN_ERR jornada_lcd: failure to set contrast\n);
 +  else

whitespace before else

 + ret = jornada_ssp_byte(contrast);
 +
 + jornada_ssp_end();
 +
 + return ret;
 +}
 +
 +static int jornada_lcd_set_power(struct lcd_device  *pdev, int power)
 +{
 + if (power != FB_BLANK_UNBLANK) {
 + /* turn off LCD */
 + PPSR = ~PPC_LDD2;
 + PPDR |= PPC_LDD2;
 + } else {
 + /* turn on LCD */
 + PPSR |= PPC_LDD2;
 + }

whitespace before curly bracket

 +
 + return 0;
 +}
--
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][drivers/scsi/u14-34f.c] duplicate test 'SCpnt-sc_data_direction == DMA_FROM_DEVICE'

2008-02-06 Thread Roel Kluin
James Bottomley wrote:
 On Mon, 2008-02-04 at 23:36 +0100, Roel Kluin wrote:

 Note the duplicate test 'SCpnt-sc_data_direction == DMA_FROM_DEVICE'

 -   if (SCpnt-sc_data_direction == DMA_FROM_DEVICE) {
 +   if (SCpnt-sc_data_direction == DMA_TO_DEVICE) {
cpp-xdir = DTD_IN;
return;
}
 else if (SCpnt-sc_data_direction == DMA_FROM_DEVICE) {

 
 Well spotted, this is definitely a huge bug in the driver.
 
 However, I think on closer examination that DTD_IN actually means
 transfer from device to host, so DMA_FROM_DEVICE is correct for that
 case.  It should be DMA_TO_DEVICE in the else if() piece.
 
 Could you correct and resend the patch and I'll apply it.

Thanks for your review.
---
Direction of data transfer 'DMA_FROM_DEVICE' was tested twice. DTD_OUT
means  transfer from host to device. This should occur when the
direction of data transfer (sc_data_direction) is 'DMA_TO_DEVICE'.

Signed-off-by: Roel Kluin [EMAIL PROTECTED]
---
diff --git a/drivers/scsi/u14-34f.c b/drivers/scsi/u14-34f.c
index 662c004..58d7eee 100644
--- a/drivers/scsi/u14-34f.c
+++ b/drivers/scsi/u14-34f.c
@@ -1215,9 +1215,9 @@ static void scsi_to_dev_dir(unsigned int i, unsigned int 
j) {
if (SCpnt-sc_data_direction == DMA_FROM_DEVICE) {
   cpp-xdir = DTD_IN;
   return;
   }
-   else if (SCpnt-sc_data_direction == DMA_FROM_DEVICE) {
+   else if (SCpnt-sc_data_direction == DMA_TO_DEVICE) {
   cpp-xdir = DTD_OUT;
   return;
   }
else if (SCpnt-sc_data_direction == DMA_NONE) {

--
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][drivers/misc/thinkpad_acpi.c] duplicate test if (level TP_EC_FAN_FULLSPEED)

2008-02-06 Thread Roel Kluin
Greg KH wrote:
 On Tue, Feb 05, 2008 at 09:34:54AM +0100, Roel Kluin wrote:
 Henrique de Moraes Holschuh wrote:
 On Tue, 05 Feb 2008, Roel Kluin wrote:
 Roland Dreier wrote:

   Note the duplicate test 'if (level  TP_EC_FAN_FULLSPEED)'. should
   this be replaced by

 Actually I suspect one of the two tests should be against TP_EC_FAN_AUTO
 (based on the comment).
 Thanks Roland, for your info

 ACK.  This needs to be sent to stable as well.  I think both 2.6.22 and
 2.6.23 need this patch.

 CC [EMAIL PROTECTED]
 
 Please send us a real copy of the patch, when it goes into Linus's tree,
 so we know what to apply, and that it is safe to do so.

It's a oneliner and the patch is from linus' tree.
---
in commit eaa7571b2d1a08873e4bdd8e6db3431df61cd9ad, a safety net for TPEC
fan control mode was added. Quoting that patch:

The Linux ThinkPad community is not positive that all ThinkPads that do
HFSP EC fan control do implement full-speed and auto modes, some of the
earlier ones supporting HFSP might not.

If the EC ignores the AUTO or FULL-SPEED bits, it will pay attention to the
lower three bits that set the fan level. And as thinkpad-acpi was leaving
these set to zero, it would stop(!) the fan, which is Not A Good Thing.
So, as a safety net, we now make sure to also set the fan level part of the
HFSP register to speed 7 for full-speed, and a minimum of speed 4 for auto
mode.

However, in the section below the test for the FULL-SPEED bits was not added:
the AUTO bits were tested twice. This patch corrects this and ensures that
the fan level part of the  HFSP register is set to a minimum of speed 4 for
auto mode.

Signed-off-by: Roel Kluin [EMAIL PROTECTED]
---
diff --git a/drivers/misc/thinkpad_acpi.c b/drivers/misc/thinkpad_acpi.c
index cf56647..3c323fe 100644
--- a/drivers/misc/thinkpad_acpi.c
+++ b/drivers/misc/thinkpad_acpi.c
@@ -4138,7 +4138,7 @@ static int fan_set_level(int level)
 * or FULLSPEED mode bits and just ignore them */
if (level  TP_EC_FAN_FULLSPEED)
level |= 7; /* safety min speed 7 */
-   else if (level  TP_EC_FAN_FULLSPEED)
+   else if (level  TP_EC_FAN_AUTO)
level |= 4; /* safety min speed 4 */
 
if (!acpi_ec_write(fan_status_offset, level))

--
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][drivers/usb/serial/ftdi_sio.c] add missing '|'

2008-02-06 Thread Roel Kluin
add missing '|'

Signed-off-by: Roel Kluin [EMAIL PROTECTED]
---
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
index 90dcc62..2173561 100644
--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -394,7 +394,7 @@ static const char *ftdi_chip_name[] = {
 /* End TIOCMIWAIT */
 
 #define FTDI_IMPL_ASYNC_FLAGS = ( ASYNC_SPD_HI | ASYNC_SPD_VHI \
- ASYNC_SPD_CUST | ASYNC_SPD_SHI | ASYNC_SPD_WARP )
+ | ASYNC_SPD_CUST | ASYNC_SPD_SHI | ASYNC_SPD_WARP )
 
 /* function prototypes for a FTDI serial converter */
 static int  ftdi_sio_probe (struct usb_serial *serial, const struct 
usb_device_id *id);

--
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 05/18] MMC: OMAP: Introduce new multislot structure and change driver to use it

2008-01-28 Thread Roel Kluin
Carlos Aguiar wrote:
 From: Juha Yrjola [EMAIL PROTECTED]
 
 Introduce new MMC multislot structure and change driver to use it.

 diff --git a/drivers/mmc/host/omap.c b/drivers/mmc/host/omap.c

It could be that I misunderstand, but...

 @@ -897,19 +1037,106 @@ static const struct mmc_host_ops mmc_omap_ops = {
   .get_ro = mmc_omap_get_ro,
  };
  
 -static int __init mmc_omap_probe(struct platform_device *pdev)
 +static int __init mmc_omap_new_slot(struct mmc_omap_host *host, int id)
  {
 - struct omap_mmc_conf *minfo = pdev-dev.platform_data;
 + struct mmc_omap_slot *slot = NULL;
   struct mmc_host *mmc;
 + int r;
 +
 + mmc = mmc_alloc_host(sizeof(struct mmc_omap_slot), host-dev);

since you mmc_alloc_host here...

 + if (mmc == NULL)
 + return -ENOMEM;
 +
 + slot = mmc_priv(mmc);
 + slot-host = host;
 + slot-mmc = mmc;
 + slot-id = id;
 + slot-pdata = host-pdata-slots[id];
 +
 + host-slots[id] = slot;
 +
 + mmc-caps = MMC_CAP_MULTIWRITE | MMC_CAP_MMC_HIGHSPEED |
 + MMC_CAP_SD_HIGHSPEED;
 + if (host-pdata-conf.wire4)
 + mmc-caps |= MMC_CAP_4_BIT_DATA;
 +
 + mmc-ops = mmc_omap_ops;
 + mmc-f_min = 40;
 +
 + if (cpu_class_is_omap2())
 + mmc-f_max = 4800;
 + else
 + mmc-f_max = 2400;
 + if (host-pdata-max_freq)
 + mmc-f_max = min(host-pdata-max_freq, mmc-f_max);
 + mmc-ocr_avail = slot-pdata-ocr_mask;
 +
 + /* Use scatterlist DMA to reduce per-transfer costs.
 +  * NOTE max_seg_size assumption that small blocks aren't
 +  * normally used (except e.g. for reading SD registers).
 +  */
 + mmc-max_phys_segs = 32;
 + mmc-max_hw_segs = 32;
 + mmc-max_blk_size = 2048;   /* BLEN is 11 bits (+1) */
 + mmc-max_blk_count = 2048;  /* NBLK is 11 bits (+1) */
 + mmc-max_req_size = mmc-max_blk_size * mmc-max_blk_count;
 + mmc-max_seg_size = mmc-max_req_size;
 +
 + r = mmc_add_host(mmc);
 + if (r  0)
 + return r;

shouldn't you mmc_free_host(mmc) here?

 +
 + if (slot-pdata-name != NULL) {
 + r = device_create_file(mmc-class_dev,
 + dev_attr_slot_name);
 + if (r  0)
 + goto err_remove_host;
 + }
 +
 + if (slot-pdata-get_ro != NULL) {
 + r = device_create_file(mmc-class_dev,
 + dev_attr_ro);
 + }
 +
 + return 0;
 +
 +err_remove_slot_name:

This label has no goto, so the 2 lines below are dead code...
Ok, now I see It's in the next patch. (maybe better to put these lines
in that patch?)

 + if (slot-pdata-name != NULL)
 + device_remove_file(mmc-class_dev, dev_attr_ro);
 +err_remove_host:
 + mmc_remove_host(mmc);

and maybe mmc_free_host(mmc) here?

 + return r;
 +}

from mmc_omap_probe()

+   for (i = 0; i  pdata-nr_slots; i++) {
+   ret = mmc_omap_new_slot(host, i);
+   if (ret  0) {
+   while (--i = 0)
+   mmc_omap_remove_slot(host-slots[i]);

mmc_omap_remove_slot() does a mmc_free_host(), but note the decrement of i:
the current isn't freed.
--
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][ppc] logical/bitand typo in powerpc/boot/4xx.c

2008-01-29 Thread Roel Kluin
 On Wed, 2008-01-23 at 23:37 +0100, Roel Kluin wrote:
 -  if (val  0x1)
 +  if (val  0x1)

 Joe Perches wrote:
 I think this pattern should be added to checkpatch
 +   if ($line =~ /\\\s*0[xX]/) {

 On Thu, Jan 24, 2008 at 01:18:48AM +0100, Roel Kluin wrote:
 I agree but there will be false positives, i'd propose to change that to
 +if ($line =~ /(?:(?:\(|\\|\|\|)\s*0[xX]\s*(?:|\|\|)|
 +(?:\\|\|\|)\s*0[xX]\s*(?:\)||\|\|))/) {

Andy Whitcroft wrote:
 That one doesn't even match the original example.  Seems to be missing
 some number matching.  The concept seems sound though.  Basically
 looking for numbers which are definatly adjacent to a boolean or a brace
 on both sides.

You are right. here's a version that does work. It works the same as
git-grep -E 
((\(||\|\|)[[:space:]]*(0[xX][0-9a-fA-F]+|[0-9]+)[[:space:]]*(|\|\|)|(|\|\|)[[:space:]]*(0[xX][0-9a-fA-F]+|[0-9]+)[[:space:]]*(\)||\|\|))

---
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 579f50f..62276f7 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -1337,6 +1337,11 @@ sub process {
}
}
 
+# Check for bitwise tests written as boolean
+   if ($line =~ 
/((\(||\|\|)\s*(0[xX][0-9a-fA-F]+|[0-9]+)\s*(|\|\|)|(|\|\|)\s*(0[xX][0-9a-fA-F]+|[0-9]+)\s*(\)||\|\|))/)
 {
+   WARN(boolean test with hexadecimal, perhaps just \'\' 
or \'|\'?\n . $herecurr);
+   }
+
 # if and else should not have general statements after it
if ($line =~ /^.\s*(?:}\s*)?else\b(.*)/ 
$1 !~ /^\s*(?:\sif|{|\\|$)/) {

--
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/


[drivers/net/bnx2.c] ADVERTISE_1000XPSE_ASYM

2008-01-30 Thread Roel Kluin
In drivers/net/bnx2.c:1285: it reads in function bnx2_setup_remote_phy():

if (pause_adv  (ADVERTISE_1000XPSE_ASYM | ADVERTISE_1000XPSE_ASYM))

Note that the two are the same and this is therefore equivalent to

if (pause_adv  ADVERTISE_1000XPSE_ASYM)

This appears to be incorrect, was maybe '| ADVERTISE_1000XPAUSE' intended?
--
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][drivers/net/fec_mpc52xx.c] duplicate NETIF_MSG_IFDOWN in MPC52xx_MESSAGES_DEFAULT

2008-01-30 Thread Roel Kluin
Untested patch below, please confirm it's the right fix.
--
duplicate NETIF_MSG_IFDOWN, 2nd should be NETIF_MSG_IFUP

Signed-off-by: Roel Kluin [EMAIL PROTECTED]
---
diff --git a/drivers/net/fec_mpc52xx.c b/drivers/net/fec_mpc52xx.c
index f91ee70..ca3c3b3 100644
--- a/drivers/net/fec_mpc52xx.c
+++ b/drivers/net/fec_mpc52xx.c
@@ -55,7 +55,7 @@ module_param_array_named(mac, mpc52xx_fec_mac_addr, byte, 
NULL, 0);
 MODULE_PARM_DESC(mac, six hex digits, ie. 0x1,0x2,0xc0,0x01,0xba,0xbe);
 
 #define MPC52xx_MESSAGES_DEFAULT ( NETIF_MSG_DRV | NETIF_MSG_PROBE | \
-   NETIF_MSG_LINK | NETIF_MSG_IFDOWN | NETIF_MSG_IFDOWN )
+   NETIF_MSG_LINK | NETIF_MSG_IFDOWN | NETIF_MSG_IFUP)
 static int debug = -1; /* the above default */
 module_param(debug, int, 0);
 MODULE_PARM_DESC(debug, debugging messages level);
--
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][net/sched/sch_teql.c] duplicate IFF_BROADCAST in FMASK, remove 2nd

2008-01-30 Thread Roel Kluin
Untested patch below, please confirm it's the right fix (should it be some
other IFF_*?)
--
duplicate IFF_BROADCAST, remove 2nd

Signed-off-by: Roel Kluin [EMAIL PROTECTED]
---
diff --git a/net/sched/sch_teql.c b/net/sched/sch_teql.c
index c0ed06d..a53acf4 100644
--- a/net/sched/sch_teql.c
+++ b/net/sched/sch_teql.c
@@ -71,7 +71,7 @@ struct teql_sched_data
 
 #define NEXT_SLAVE(q) (((struct teql_sched_data*)qdisc_priv(q))-next)
 
-#define FMASK (IFF_BROADCAST|IFF_POINTOPOINT|IFF_BROADCAST)
+#define FMASK (IFF_BROADCAST|IFF_POINTOPOINT)
 
 /* teql* qdisc routines */
 
--
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][drivers/pcmcia/ti113x.h] ENE_TEST_C9_PFENABLE duplicate *_F0

2008-01-30 Thread Roel Kluin
Untested patch below, please confirm it's the right fix.
--
duplicate ENE_TEST_C9_PFENABLE_F0, 2nd should be *_F1

Signed-off-by: Roel Kluin [EMAIL PROTECTED]
---
diff --git a/drivers/pcmcia/ti113x.h b/drivers/pcmcia/ti113x.h
index d29657b..87a5fd5 100644
--- a/drivers/pcmcia/ti113x.h
+++ b/drivers/pcmcia/ti113x.h
@@ -155,7 +155,7 @@
 #define ENE_TEST_C9_TLTENABLE  0x02
 #define ENE_TEST_C9_PFENABLE_F00x04
 #define ENE_TEST_C9_PFENABLE_F10x08
-#define ENE_TEST_C9_PFENABLE   (ENE_TEST_C9_PFENABLE_F0 | 
ENE_TEST_C9_PFENABLE_F0)
+#define ENE_TEST_C9_PFENABLE   (ENE_TEST_C9_PFENABLE_F0 | 
ENE_TEST_C9_PFENABLE_F1)
 #define ENE_TEST_C9_WPDISALBLE_F0  0x40
 #define ENE_TEST_C9_WPDISALBLE_F1  0x80
 #define ENE_TEST_C9_WPDISALBLE (ENE_TEST_C9_WPDISALBLE_F0 | 
ENE_TEST_C9_WPDISALBLE_F1)
--
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][drivers/usb/gadget/amd5536udc.c] duplicate use_dma_ppb_du = 2nd use_dma_ppb

2008-01-30 Thread Roel Kluin
Untested patch below, please confirm it's the right fix.
--
duplicate use_dma_ppb_du, 2nd should be use_dma_ppb

Signed-off-by: Roel Kluin [EMAIL PROTECTED]
---
diff --git a/drivers/usb/gadget/amd5536udc.c b/drivers/usb/gadget/amd5536udc.c
index c72e962..fbc10f9 100644
--- a/drivers/usb/gadget/amd5536udc.c
+++ b/drivers/usb/gadget/amd5536udc.c
@@ -205,7 +205,7 @@ static void print_regs(struct udc *dev)
DBG(dev, DMA mode   = PPBNDU (packet per buffer 
WITHOUT desc. update)\n);
dev_info(dev-pdev-dev, DMA mode (%s)\n, PPBNDU);
-   } else if (use_dma  use_dma_ppb_du  use_dma_ppb_du) {
+   } else if (use_dma  use_dma_ppb  use_dma_ppb_du) {
DBG(dev, DMA mode   = PPBDU (packet per buffer 
WITH desc. update)\n);
dev_info(dev-pdev-dev, DMA mode (%s)\n, PPBDU);
--
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] [wireless/iwlwifi/iwl-4965.c] add parentheses

2008-02-02 Thread Roel Kluin
'!' has a higher priority than '': bitanding has no effect.

Signed-off-by: Roel Kluin [EMAIL PROTECTED]
---
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c 
b/drivers/net/wireless/iwlwifi/iwl-4965.c
index 569347f..2439868 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965.c
+++ b/drivers/net/wireless/iwlwifi/iwl-4965.c
@@ -4589,7 +4589,7 @@ static u8 iwl4965_is_fat_tx_allowed(struct iwl4965_priv 
*priv,
 
if (sta_ht_inf) {
if ((!sta_ht_inf-ht_supported) ||
-  (!sta_ht_inf-cap  IEEE80211_HT_CAP_SUP_WIDTH))
+  (!(sta_ht_inf-cap  IEEE80211_HT_CAP_SUP_WIDTH)))
return 0;
}
 
--
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] [drivers/video/i810/i810_main.c] add parentheses

2008-02-02 Thread Roel Kluin
'!' has a higher priority than '': bitanding has no effect.

Signed-off-by: Roel Kluin [EMAIL PROTECTED]
---
diff --git a/drivers/video/i810/i810_main.c b/drivers/video/i810/i810_main.c
index 1a7d778..1d13dd0 100644
--- a/drivers/video/i810/i810_main.c
+++ b/drivers/video/i810/i810_main.c
@@ -1476,7 +1476,7 @@ static int i810fb_cursor(struct fb_info *info, struct 
fb_cursor *cursor)
struct i810fb_par *par = info-par;
u8 __iomem *mmio = par-mmio_start_virtual;
 
-   if (!par-dev_flags  LOCKUP)
+   if (!(par-dev_flags  LOCKUP))
return -ENXIO;
 
if (cursor-image.width  64 || cursor-image.height  64)

--
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   >