[openwrt/openwrt] ar71xx: fix compiler warnings in mdio-bitbang.c for 4.4

LEDE Commits lede-commits at lists.infradead.org
Sun Jan 7 04:05:48 PST 2018


blogic pushed a commit to openwrt/openwrt.git, branch master:
https://git.lede-project.org/4045f15a219131899a2313b48c5ce01f07354917

commit 4045f15a219131899a2313b48c5ce01f07354917
Author: Gabor Juhos <juhosg at freemail.hu>
AuthorDate: Fri Jan 5 19:13:20 2018 +0100

    ar71xx: fix compiler warnings in mdio-bitbang.c for 4.4
    
    Building Linux 4.4 for ar71xx throws the following warnings in
    drivers/net/phy/mdio-bitbang.c:
    
        CC      drivers/net/phy/mdio-bitbang.o
      In file included from include/linux/irqflags.h:14:0,
                       from drivers/net/phy/mdio-bitbang.c:20:
      drivers/net/phy/mdio-bitbang.c: In function 'mdiobb_read':
      include/linux/typecheck.h:11:18: warning: comparison of distinct pointer types lacks a cast
        (void)(&__dummy == &__dummy2); \
                        ^
      include/linux/irqflags.h:63:3: note: in expansion of macro 'typecheck'
         typecheck(unsigned long, flags); \
         ^
      include/linux/irqflags.h:124:3: note: in expansion of macro 'raw_local_irq_save'
         raw_local_irq_save(flags);   \
         ^
      drivers/net/phy/mdio-bitbang.c:162:2: note: in expansion of macro 'local_irq_save'
        local_irq_save(flags);
        ^
      include/linux/typecheck.h:11:18: warning: comparison of distinct pointer types lacks a cast
        (void)(&__dummy == &__dummy2); \
                        ^
      include/linux/irqflags.h:68:3: note: in expansion of macro 'typecheck'
         typecheck(unsigned long, flags); \
         ^
      include/linux/irqflags.h:126:39: note: in expansion of macro 'raw_local_irq_restore'
       #define local_irq_restore(flags) do { raw_local_irq_restore(flags); } while (0)
                                             ^
      drivers/net/phy/mdio-bitbang.c:175:2: note: in expansion of macro 'local_irq_restore'
        local_irq_restore(flags);
        ^
      drivers/net/phy/mdio-bitbang.c:159:11: warning: unused variable 'i' [-Wunused-variable]
        int ret, i;
                 ^
      In file included from include/linux/irqflags.h:14:0,
                       from drivers/net/phy/mdio-bitbang.c:20:
      drivers/net/phy/mdio-bitbang.c: In function 'mdiobb_write':
      include/linux/typecheck.h:11:18: warning: comparison of distinct pointer types lacks a cast
        (void)(&__dummy == &__dummy2); \
                        ^
      include/linux/irqflags.h:63:3: note: in expansion of macro 'typecheck'
         typecheck(unsigned long, flags); \
         ^
      include/linux/irqflags.h:124:3: note: in expansion of macro 'raw_local_irq_save'
         raw_local_irq_save(flags);   \
         ^
      drivers/net/phy/mdio-bitbang.c:185:2: note: in expansion of macro 'local_irq_save'
        local_irq_save(flags);
        ^
      include/linux/typecheck.h:11:18: warning: comparison of distinct pointer types lacks a cast
        (void)(&__dummy == &__dummy2); \
                        ^
      include/linux/irqflags.h:68:3: note: in expansion of macro 'typecheck'
         typecheck(unsigned long, flags); \
         ^
      include/linux/irqflags.h:126:39: note: in expansion of macro 'raw_local_irq_restore'
       #define local_irq_restore(flags) do { raw_local_irq_restore(flags); } while (0)
                                             ^
      drivers/net/phy/mdio-bitbang.c:200:2: note: in expansion of macro 'local_irq_restore'
        local_irq_restore(flags);
        ^
    
    These are caused by the 900-mdio_bitbang_ignore_ta_value and
    901-phy-mdio-bitbang-prevent-rescheduling-during-command patches.
    
    The first patch removes some code but it does not remove the variable
    which is used by the removed code only.
    
    The second patch adds local_irq_{save,restore} calls. The type of the
    argument of these calls must be 'unsigned long', but the patch defines
    the variable as 'long'.
    
    Fix both patches to silence the warnings.
    
    Signed-off-by: Gabor Juhos <juhosg at freemail.hu>
---
 .../ar71xx/patches-4.4/900-mdio_bitbang_ignore_ta_value.patch    | 9 +++++++++
 ...01-phy-mdio-bitbang-prevent-rescheduling-during-command.patch | 6 +++---
 2 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/target/linux/ar71xx/patches-4.4/900-mdio_bitbang_ignore_ta_value.patch b/target/linux/ar71xx/patches-4.4/900-mdio_bitbang_ignore_ta_value.patch
index 4536d51..8f8f349 100644
--- a/target/linux/ar71xx/patches-4.4/900-mdio_bitbang_ignore_ta_value.patch
+++ b/target/linux/ar71xx/patches-4.4/900-mdio_bitbang_ignore_ta_value.patch
@@ -1,5 +1,14 @@
 --- a/drivers/net/phy/mdio-bitbang.c
 +++ b/drivers/net/phy/mdio-bitbang.c
+@@ -155,7 +155,7 @@ static int mdiobb_cmd_addr(struct mdiobb
+ static int mdiobb_read(struct mii_bus *bus, int phy, int reg)
+ {
+ 	struct mdiobb_ctrl *ctrl = bus->priv;
+-	int ret, i;
++	int ret;
+ 
+ 	if (reg & MII_ADDR_C45) {
+ 		reg = mdiobb_cmd_addr(ctrl, phy, reg);
 @@ -165,19 +165,7 @@ static int mdiobb_read(struct mii_bus *b
  
  	ctrl->ops->set_mdio_dir(ctrl, 0);
diff --git a/target/linux/ar71xx/patches-4.4/901-phy-mdio-bitbang-prevent-rescheduling-during-command.patch b/target/linux/ar71xx/patches-4.4/901-phy-mdio-bitbang-prevent-rescheduling-during-command.patch
index 68f86e0..a830346 100644
--- a/target/linux/ar71xx/patches-4.4/901-phy-mdio-bitbang-prevent-rescheduling-during-command.patch
+++ b/target/linux/ar71xx/patches-4.4/901-phy-mdio-bitbang-prevent-rescheduling-during-command.patch
@@ -25,8 +25,8 @@ Signed-off-by: Jonas Gorski <jogo at openwrt.org>
 @@ -156,7 +157,9 @@ static int mdiobb_read(struct mii_bus *b
  {
  	struct mdiobb_ctrl *ctrl = bus->priv;
- 	int ret, i;
-+	long flags;
+ 	int ret;
++	unsigned long flags;
  
 +	local_irq_save(flags);
  	if (reg & MII_ADDR_C45) {
@@ -44,7 +44,7 @@ Signed-off-by: Jonas Gorski <jogo at openwrt.org>
  static int mdiobb_write(struct mii_bus *bus, int phy, int reg, u16 val)
  {
  	struct mdiobb_ctrl *ctrl = bus->priv;
-+	long flags;
++	unsigned long flags;
  
 +	local_irq_save(flags);
  	if (reg & MII_ADDR_C45) {



More information about the lede-commits mailing list