]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
leds: renesas-tpu: cleanup a small type issue
authorDan Carpenter <dan.carpenter@oracle.com>
Fri, 31 May 2013 12:55:04 +0000 (05:55 -0700)
committerBryan Wu <cooloney@gmail.com>
Thu, 20 Jun 2013 23:21:33 +0000 (16:21 -0700)
Static checkers complain that, although this is declared as an
unsigned long, we can only use the lower 32 bits.  For anything
higher, we hit bugs widening then bitwise negate or wrapping bugs
doing the left shift.

From looking at the context, this is not a problem because we only
use 16 bits.  I've changed some types to make it more clear.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
drivers/leds/leds-renesas-tpu.c

index 9483f1c1078d406184c4c5c1a113c6d6c75adf58..adebf4931e1e0fdc65a9f199819b6a26fd975059 100644 (file)
@@ -63,7 +63,7 @@ static DEFINE_SPINLOCK(r_tpu_lock);
 #define TGRC 8 /* Timer general register C (+0x20) */
 #define TGRD 9 /* Timer general register D (+0x24) */
 
-static inline unsigned short r_tpu_read(struct r_tpu_priv *p, int reg_nr)
+static inline u16 r_tpu_read(struct r_tpu_priv *p, int reg_nr)
 {
        struct led_renesas_tpu_config *cfg = p->pdev->dev.platform_data;
        void __iomem *base = p->mapbase;
@@ -75,8 +75,7 @@ static inline unsigned short r_tpu_read(struct r_tpu_priv *p, int reg_nr)
        return ioread16(base + offs);
 }
 
-static inline void r_tpu_write(struct r_tpu_priv *p, int reg_nr,
-                              unsigned short value)
+static inline void r_tpu_write(struct r_tpu_priv *p, int reg_nr, u16 value)
 {
        struct led_renesas_tpu_config *cfg = p->pdev->dev.platform_data;
        void __iomem *base = p->mapbase;
@@ -93,7 +92,8 @@ static inline void r_tpu_write(struct r_tpu_priv *p, int reg_nr,
 static void r_tpu_start_stop_ch(struct r_tpu_priv *p, int start)
 {
        struct led_renesas_tpu_config *cfg = p->pdev->dev.platform_data;
-       unsigned long flags, value;
+       unsigned long flags;
+       u16 value;
 
        /* start stop register shared by multiple timer channels */
        spin_lock_irqsave(&r_tpu_lock, flags);