mdio: use inline functions for to_mdio_device() etc

Nesting container_of() causes warnings with W=2, and doing this
in a header means we see a lot of them, like:

In file included from drivers/net/mdio/of_mdio.c:11:
drivers/net/mdio/of_mdio.c: In function 'of_phy_find_device':
include/linux/kernel.h:852:8: warning: declaration of '__mptr' shadows a previous local [-Wshadow]
  852 |  void *__mptr = (void *)(ptr);     \
      |        ^~~~~~
include/linux/phy.h:655:26: note: in expansion of macro 'container_of'
  655 | #define to_phy_device(d) container_of(to_mdio_device(d), \
      |                          ^~~~~~~~~~~~
include/linux/mdio.h:52:27: note: in expansion of macro 'container_of'
   52 | #define to_mdio_device(d) container_of(d, struct mdio_device, dev)
      |                           ^~~~~~~~~~~~
include/linux/phy.h:655:39: note: in expansion of macro 'to_mdio_device'
  655 | #define to_phy_device(d) container_of(to_mdio_device(d), \
      |                                       ^~~~~~~~~~~~~~
drivers/net/mdio/of_mdio.c:379:10: note: in expansion of macro 'to_phy_device'
  379 |   return to_phy_device(&mdiodev->dev);
      |          ^~~~~~~~~~~~~
include/linux/kernel.h:852:8: note: shadowed declaration is here
  852 |  void *__mptr = (void *)(ptr);     \
      |        ^~~~~~
include/linux/phy.h:655:26: note: in expansion of macro 'container_of'
  655 | #define to_phy_device(d) container_of(to_mdio_device(d), \
      |                          ^~~~~~~~~~~~
drivers/net/mdio/of_mdio.c:379:10: note: in expansion of macro 'to_phy_device'
  379 |   return to_phy_device(&mdiodev->dev);
      |          ^~~~~~~~~~~~~

Redefine the macros in linux/mdio.h as inline functions to avoid this
problem.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
1 file changed