Re: [PATCH 41/41] net: phy: Only call phy_init() on systems needing manual relocation

2023-04-01 Thread Ramon Fried
On Sun, Mar 19, 2023 at 7:05 PM Marek Vasut
 wrote:
>
> The phy_init() is now used only to perform manual relocation of PHY
> driver callbacks. Wrap it in ifdeffery and only call it on systems
> which still require manual relocation, i.e. m68k .
>
> Signed-off-by: Marek Vasut 
> ---
> Cc: "Ariel D'Alessandro" 
> Cc: "Cédric Le Goater" 
> Cc: "Marek Behún" 
> Cc: Alex Nemirovsky 
> Cc: Haolin Li 
> Cc: Heinrich Schuchardt 
> Cc: Joe Hershberger 
> Cc: Joel Stanley 
> Cc: Josua Mayer 
> Cc: Marek Vasut 
> Cc: Michael Trimarchi 
> Cc: Michal Simek 
> Cc: Nate Drude 
> Cc: Neil Armstrong 
> Cc: Radu Pirea 
> Cc: Ramon Fried 
> Cc: Samuel Mendoza-Jonas 
> Cc: Stefan Roese 
> Cc: T Karthik Reddy 
> Cc: Tim Harvey 
> Cc: Vladimir Oltean 
> Cc: u-boot-amlo...@groups.io
> ---
>  drivers/net/phy/phy.c | 4 ++--
>  net/eth_common.c  | 2 +-
>  2 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
> index 61603f28179..9b0e497f223 100644
> --- a/drivers/net/phy/phy.c
> +++ b/drivers/net/phy/phy.c
> @@ -463,9 +463,9 @@ U_BOOT_PHY_DRIVER(genphy) = {
> .shutdown   = genphy_shutdown,
>  };
>
> +#ifdef CONFIG_NEEDS_MANUAL_RELOC
>  int phy_init(void)
>  {
> -#ifdef CONFIG_NEEDS_MANUAL_RELOC
> const int ll_n_ents = ll_entry_count(struct phy_driver, phy_driver);
> struct phy_driver *drv, *ll_entry;
>
> @@ -489,10 +489,10 @@ int phy_init(void)
> if (drv->write_mmd)
> drv->write_mmd += gd->reloc_off;
> }
> -#endif
>
> return 0;
>  }
> +#endif
>
>  int phy_set_supported(struct phy_device *phydev, u32 max_speed)
>  {
> diff --git a/net/eth_common.c b/net/eth_common.c
> index 82d527abba6..c94a7ba6ae7 100644
> --- a/net/eth_common.c
> +++ b/net/eth_common.c
> @@ -37,7 +37,7 @@ void eth_common_init(void)
> miiphy_init();
>  #endif
>
> -#ifdef CONFIG_PHYLIB
> +#if defined(CONFIG_NEEDS_MANUAL_RELOC) && defined(CONFIG_PHYLIB)
> phy_init();
>  #endif
>  #endif
> --
> 2.39.2
>
Reviewed-by: Ramon Fried 


[PATCH 41/41] net: phy: Only call phy_init() on systems needing manual relocation

2023-03-19 Thread Marek Vasut
The phy_init() is now used only to perform manual relocation of PHY
driver callbacks. Wrap it in ifdeffery and only call it on systems
which still require manual relocation, i.e. m68k .

Signed-off-by: Marek Vasut 
---
Cc: "Ariel D'Alessandro" 
Cc: "Cédric Le Goater" 
Cc: "Marek Behún" 
Cc: Alex Nemirovsky 
Cc: Haolin Li 
Cc: Heinrich Schuchardt 
Cc: Joe Hershberger 
Cc: Joel Stanley 
Cc: Josua Mayer 
Cc: Marek Vasut 
Cc: Michael Trimarchi 
Cc: Michal Simek 
Cc: Nate Drude 
Cc: Neil Armstrong 
Cc: Radu Pirea 
Cc: Ramon Fried 
Cc: Samuel Mendoza-Jonas 
Cc: Stefan Roese 
Cc: T Karthik Reddy 
Cc: Tim Harvey 
Cc: Vladimir Oltean 
Cc: u-boot-amlo...@groups.io
---
 drivers/net/phy/phy.c | 4 ++--
 net/eth_common.c  | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index 61603f28179..9b0e497f223 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -463,9 +463,9 @@ U_BOOT_PHY_DRIVER(genphy) = {
.shutdown   = genphy_shutdown,
 };
 
+#ifdef CONFIG_NEEDS_MANUAL_RELOC
 int phy_init(void)
 {
-#ifdef CONFIG_NEEDS_MANUAL_RELOC
const int ll_n_ents = ll_entry_count(struct phy_driver, phy_driver);
struct phy_driver *drv, *ll_entry;
 
@@ -489,10 +489,10 @@ int phy_init(void)
if (drv->write_mmd)
drv->write_mmd += gd->reloc_off;
}
-#endif
 
return 0;
 }
+#endif
 
 int phy_set_supported(struct phy_device *phydev, u32 max_speed)
 {
diff --git a/net/eth_common.c b/net/eth_common.c
index 82d527abba6..c94a7ba6ae7 100644
--- a/net/eth_common.c
+++ b/net/eth_common.c
@@ -37,7 +37,7 @@ void eth_common_init(void)
miiphy_init();
 #endif
 
-#ifdef CONFIG_PHYLIB
+#if defined(CONFIG_NEEDS_MANUAL_RELOC) && defined(CONFIG_PHYLIB)
phy_init();
 #endif
 #endif
-- 
2.39.2