Re: [PATCH] net: mdio: force deassert MDIO reset signal

From: Pierluigi Passaro
Date: Mon Jan 16 2023 - 05:32:57 EST


On Mon, Jan 16, 2023 at 9:44 AM kernel test robot <lkp@xxxxxxxxx> wrote:
> Hi Pierluigi,
>
> Thank you for the patch! Yet something to improve:
>
> [auto build test ERROR on net-next/master]
> [also build test ERROR on net/master linus/master v6.2-rc4 next-20230116]
> [If your patch is applied to the wrong git tree, kindly drop us a note.
> And when submitting patch, we suggest to use '--base' as documented in
> https://git-scm.com/docs/git-format-patch#_base_tree_information]
>
> url: https://github.com/intel-lab-lkp/linux/commits/Pierluigi-Passaro/net-mdio-force-deassert-MDIO-reset-signal/20230116-001044
> patch link: https://lore.kernel.org/r/20230115161006.16431-1-pierluigi.p%40variscite.com
> patch subject: [PATCH] net: mdio: force deassert MDIO reset signal
> config: nios2-defconfig
> compiler: nios2-linux-gcc (GCC) 12.1.0
> reproduce (this is a W=1 build):
> wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> chmod +x ~/bin/make.cross
> # https://github.com/intel-lab-lkp/linux/commit/3f08f04af6947d4fce17b11443001c4e386ca66e
> git remote add linux-review https://github.com/intel-lab-lkp/linux
> git fetch --no-tags linux-review Pierluigi-Passaro/net-mdio-force-deassert-MDIO-reset-signal/20230116-001044
> git checkout 3f08f04af6947d4fce17b11443001c4e386ca66e
> # save the config file
> mkdir build_dir && cp config build_dir/.config
> COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=nios2 olddefconfig
> COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=nios2 SHELL=/bin/bash
>
> If you fix the issue, kindly add following tag where applicable
> | Reported-by: kernel test robot <lkp@xxxxxxxxx>
>
The config file used to build this kernel disables CONFIG_GPIOLIB.
Is this intentional ?
If yes, I suppose the patch should fix the code here
https://github.com/intel-lab-lkp/linux/blob/3f08f04af6947d4fce17b11443001c4e386ca66e/include/linux/gpio/driver.h#L761-L798
with something like
#ifdef CONFIG_GPIOLIB
...
struct gpio_desc *gpiochip_request_own_desc(struct gpio_chip *gc,
unsigned int hwnum,
const char *label,
enum gpio_lookup_flags lflags,
enum gpiod_flags dflags);
void gpiochip_free_own_desc(struct gpio_desc *desc);
#else
...
static inline struct gpio_desc *gpiochip_request_own_desc(struct gpio_chip *gc,
unsigned int hwnum,
const char *label,
enum gpio_lookup_flags lflags,
enum gpiod_flags dflags)
{
/* GPIO can never have been requested */
WARN_ON(1);
return ERR_PTR(-ENODEV);
}
static inline void gpiochip_free_own_desc(struct gpio_desc *desc)
{
WARN_ON(1);
}
#endif /* CONFIG_GPIOLIB */
Do you agree ?
>
> All errors (new ones prefixed by >>):
>
> nios2-linux-ld: drivers/net/mdio/fwnode_mdio.o: in function `fwnode_mdiobus_register_phy':
> >> drivers/net/mdio/fwnode_mdio.c:164: undefined reference to `gpiochip_free_own_desc'
> drivers/net/mdio/fwnode_mdio.c:164:(.text+0x230): relocation truncated to fit: R_NIOS2_CALL26 against `gpiochip_free_own_desc'
>
>
> vim +164 drivers/net/mdio/fwnode_mdio.c
>
> 113
> 114 int fwnode_mdiobus_register_phy(struct mii_bus *bus,
> 115 struct fwnode_handle *child, u32 addr)
> 116 {
> 117 struct mii_timestamper *mii_ts = NULL;
> 118 struct pse_control *psec = NULL;
> 119 struct phy_device *phy;
> 120 bool is_c45 = false;
> 121 u32 phy_id;
> 122 int rc;
> 123 int reset_deassert_delay = 0;
> 124 struct gpio_desc *reset_gpio;
> 125
> 126 psec = fwnode_find_pse_control(child);
> 127 if (IS_ERR(psec))
> 128 return PTR_ERR(psec);
> 129
> 130 mii_ts = fwnode_find_mii_timestamper(child);
> 131 if (IS_ERR(mii_ts)) {
> 132 rc = PTR_ERR(mii_ts);
> 133 goto clean_pse;
> 134 }
> 135
> 136 rc = fwnode_property_match_string(child, "compatible",
> 137 "ethernet-phy-ieee802.3-c45");
> 138 if (rc >= 0)
> 139 is_c45 = true;
> 140
> 141 reset_gpio = fwnode_gpiod_get_index(child, "reset", 0, GPIOD_OUT_LOW, "PHY reset");
> 142 if (reset_gpio == ERR_PTR(-EPROBE_DEFER)) {
> 143 dev_dbg(&bus->dev, "reset signal for PHY@%u not ready\n", addr);
> 144 return -EPROBE_DEFER;
> 145 } else if (IS_ERR(reset_gpio)) {
> 146 if (reset_gpio == ERR_PTR(-ENOENT))
> 147 dev_dbg(&bus->dev, "reset signal for PHY@%u not defined\n", addr);
> 148 else
> 149 dev_dbg(&bus->dev, "failed to request reset for PHY@%u, error %ld\n", addr, PTR_ERR(reset_gpio));
> 150 reset_gpio = NULL;
> 151 } else {
> 152 dev_dbg(&bus->dev, "deassert reset signal for PHY@%u\n", addr);
> 153 fwnode_property_read_u32(child, "reset-deassert-us",
> 154 &reset_deassert_delay);
> 155 if (reset_deassert_delay)
> 156 fsleep(reset_deassert_delay);
> 157 }
> 158
> 159 if (is_c45 || fwnode_get_phy_id(child, &phy_id))
> 160 phy = get_phy_device(bus, addr, is_c45);
> 161 else
> 162 phy = phy_device_create(bus, addr, phy_id, 0, NULL);
> 163
> > 164 gpiochip_free_own_desc(reset_gpio);
>
> --
> 0-DAY CI Kernel Test Service
> https://github.com/intel/lkp-tests