diff mbox series

[net-next,1/4] net: phy: remove fixup-related definitions from phy.h which are not used outside phylib

Message ID ea6fde13-9183-4c7c-8434-6c0eb64fc72c@gmail.com (mailing list archive)
State Accepted
Commit ea47e70e476ffb3fc8969c842d95609da24266b1
Delegated to: Netdev Maintainers
Headers show
Series net: phy: clean up phy.h | expand

Checks

Context Check Description
netdev/series_format success Posting correctly formatted
netdev/tree_selection success Clearly marked for net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 1 this patch: 1
netdev/build_tools success Errors and warnings before: 26 (+1) this patch: 26 (+1)
netdev/cc_maintainers success CCed 7 of 7 maintainers
netdev/build_clang success Errors and warnings before: 94 this patch: 94
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 362 this patch: 362
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 66 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 69 this patch: 69
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2025-02-14--18-00 (tests: 889)

Commit Message

Heiner Kallweit Feb. 13, 2025, 9:48 p.m. UTC
Certain fixup-related definitions aren't used outside phy_device.c.
So make them private and remove them from phy.h.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
 drivers/net/phy/phy_device.c | 16 +++++++++++++---
 include/linux/phy.h          | 14 --------------
 2 files changed, 13 insertions(+), 17 deletions(-)

Comments

Mateusz Polchlopek Feb. 14, 2025, 10:59 a.m. UTC | #1
On 2/13/2025 10:48 PM, Heiner Kallweit wrote:
> Certain fixup-related definitions aren't used outside phy_device.c.
> So make them private and remove them from phy.h.
> 
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
> ---
>   drivers/net/phy/phy_device.c | 16 +++++++++++++---
>   include/linux/phy.h          | 14 --------------
>   2 files changed, 13 insertions(+), 17 deletions(-)
> 
> diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
> index 9b06ba92f..14c312ad2 100644
> --- a/drivers/net/phy/phy_device.c
> +++ b/drivers/net/phy/phy_device.c
> @@ -45,6 +45,17 @@ MODULE_DESCRIPTION("PHY library");
>   MODULE_AUTHOR("Andy Fleming");
>   MODULE_LICENSE("GPL");
>   
> +#define	PHY_ANY_ID	"MATCH ANY PHY"
> +#define	PHY_ANY_UID	0xffffffff
> +

Overall looks like a nice cleanup but I am not sure about this space
between #define and PHY_ANY_ID or PHY_ANY_UID...

> +struct phy_fixup {
> +	struct list_head list;
> +	char bus_id[MII_BUS_ID_SIZE + 3];
> +	u32 phy_uid;
> +	u32 phy_uid_mask;
> +	int (*run)(struct phy_device *phydev);
> +};
> +
>   __ETHTOOL_DECLARE_LINK_MODE_MASK(phy_basic_features) __ro_after_init;
>   EXPORT_SYMBOL_GPL(phy_basic_features);
>   
> @@ -378,8 +389,8 @@ static SIMPLE_DEV_PM_OPS(mdio_bus_phy_pm_ops, mdio_bus_phy_suspend,
>    *	comparison
>    * @run: The actual code to be run when a matching PHY is found
>    */
> -int phy_register_fixup(const char *bus_id, u32 phy_uid, u32 phy_uid_mask,
> -		       int (*run)(struct phy_device *))
> +static int phy_register_fixup(const char *bus_id, u32 phy_uid, u32 phy_uid_mask,
> +			      int (*run)(struct phy_device *))
>   {
>   	struct phy_fixup *fixup = kzalloc(sizeof(*fixup), GFP_KERNEL);
>   
> @@ -397,7 +408,6 @@ int phy_register_fixup(const char *bus_id, u32 phy_uid, u32 phy_uid_mask,
>   
>   	return 0;
>   }
> -EXPORT_SYMBOL(phy_register_fixup);
>   
>   /* Registers a fixup to be run on any PHY with the UID in phy_uid */
>   int phy_register_fixup_for_uid(u32 phy_uid, u32 phy_uid_mask,
> diff --git a/include/linux/phy.h b/include/linux/phy.h
> index 29df4c602..96e427c2c 100644
> --- a/include/linux/phy.h
> +++ b/include/linux/phy.h
> @@ -1277,9 +1277,6 @@ struct phy_driver {
>   #define to_phy_driver(d) container_of_const(to_mdio_common_driver(d),		\
>   				      struct phy_driver, mdiodrv)
>   
> -#define PHY_ANY_ID "MATCH ANY PHY"
> -#define PHY_ANY_UID 0xffffffff
> -
>   #define PHY_ID_MATCH_EXACT(id) .phy_id = (id), .phy_id_mask = GENMASK(31, 0)
>   #define PHY_ID_MATCH_MODEL(id) .phy_id = (id), .phy_id_mask = GENMASK(31, 4)
>   #define PHY_ID_MATCH_VENDOR(id) .phy_id = (id), .phy_id_mask = GENMASK(31, 10)
> @@ -1312,15 +1309,6 @@ static inline bool phydev_id_compare(struct phy_device *phydev, u32 id)
>   	return phy_id_compare(id, phydev->phy_id, phydev->drv->phy_id_mask);
>   }
>   
> -/* A Structure for boards to register fixups with the PHY Lib */
> -struct phy_fixup {
> -	struct list_head list;
> -	char bus_id[MII_BUS_ID_SIZE + 3];
> -	u32 phy_uid;
> -	u32 phy_uid_mask;
> -	int (*run)(struct phy_device *phydev);
> -};
> -
>   const char *phy_speed_to_str(int speed);
>   const char *phy_duplex_to_str(unsigned int duplex);
>   const char *phy_rate_matching_to_str(int rate_matching);
> @@ -2117,8 +2105,6 @@ s32 phy_get_internal_delay(struct phy_device *phydev, struct device *dev,
>   void phy_resolve_pause(unsigned long *local_adv, unsigned long *partner_adv,
>   		       bool *tx_pause, bool *rx_pause);
>   
> -int phy_register_fixup(const char *bus_id, u32 phy_uid, u32 phy_uid_mask,
> -		       int (*run)(struct phy_device *));
>   int phy_register_fixup_for_id(const char *bus_id,
>   			      int (*run)(struct phy_device *));
>   int phy_register_fixup_for_uid(u32 phy_uid, u32 phy_uid_mask,
Heiner Kallweit Feb. 14, 2025, 11:11 a.m. UTC | #2
On 14.02.2025 11:59, Mateusz Polchlopek wrote:
> 
> 
> On 2/13/2025 10:48 PM, Heiner Kallweit wrote:
>> Certain fixup-related definitions aren't used outside phy_device.c.
>> So make them private and remove them from phy.h.
>>
>> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
>> ---
>>   drivers/net/phy/phy_device.c | 16 +++++++++++++---
>>   include/linux/phy.h          | 14 --------------
>>   2 files changed, 13 insertions(+), 17 deletions(-)
>>
>> diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
>> index 9b06ba92f..14c312ad2 100644
>> --- a/drivers/net/phy/phy_device.c
>> +++ b/drivers/net/phy/phy_device.c
>> @@ -45,6 +45,17 @@ MODULE_DESCRIPTION("PHY library");
>>   MODULE_AUTHOR("Andy Fleming");
>>   MODULE_LICENSE("GPL");
>>   +#define    PHY_ANY_ID    "MATCH ANY PHY"
>> +#define    PHY_ANY_UID    0xffffffff
>> +
> 
> Overall looks like a nice cleanup but I am not sure about this space
> between #define and PHY_ANY_ID or PHY_ANY_UID...
> 
There's a tab, which effectively equals a space. Maybe it's just the
diff which is misleading. At least checkpatch didn't complain.

>> +struct phy_fixup {
>> +    struct list_head list;
>> +    char bus_id[MII_BUS_ID_SIZE + 3];
>> +    u32 phy_uid;
>> +    u32 phy_uid_mask;
>> +    int (*run)(struct phy_device *phydev);
>> +};
>> +
>>   __ETHTOOL_DECLARE_LINK_MODE_MASK(phy_basic_features) __ro_after_init;
>>   EXPORT_SYMBOL_GPL(phy_basic_features);
>>   @@ -378,8 +389,8 @@ static SIMPLE_DEV_PM_OPS(mdio_bus_phy_pm_ops, mdio_bus_phy_suspend,
>>    *    comparison
>>    * @run: The actual code to be run when a matching PHY is found
>>    */
>> -int phy_register_fixup(const char *bus_id, u32 phy_uid, u32 phy_uid_mask,
>> -               int (*run)(struct phy_device *))
>> +static int phy_register_fixup(const char *bus_id, u32 phy_uid, u32 phy_uid_mask,
>> +                  int (*run)(struct phy_device *))
>>   {
>>       struct phy_fixup *fixup = kzalloc(sizeof(*fixup), GFP_KERNEL);
>>   @@ -397,7 +408,6 @@ int phy_register_fixup(const char *bus_id, u32 phy_uid, u32 phy_uid_mask,
>>         return 0;
>>   }
>> -EXPORT_SYMBOL(phy_register_fixup);
>>     /* Registers a fixup to be run on any PHY with the UID in phy_uid */
>>   int phy_register_fixup_for_uid(u32 phy_uid, u32 phy_uid_mask,
>> diff --git a/include/linux/phy.h b/include/linux/phy.h
>> index 29df4c602..96e427c2c 100644
>> --- a/include/linux/phy.h
>> +++ b/include/linux/phy.h
>> @@ -1277,9 +1277,6 @@ struct phy_driver {
>>   #define to_phy_driver(d) container_of_const(to_mdio_common_driver(d),        \
>>                         struct phy_driver, mdiodrv)
>>   -#define PHY_ANY_ID "MATCH ANY PHY"
>> -#define PHY_ANY_UID 0xffffffff
>> -
>>   #define PHY_ID_MATCH_EXACT(id) .phy_id = (id), .phy_id_mask = GENMASK(31, 0)
>>   #define PHY_ID_MATCH_MODEL(id) .phy_id = (id), .phy_id_mask = GENMASK(31, 4)
>>   #define PHY_ID_MATCH_VENDOR(id) .phy_id = (id), .phy_id_mask = GENMASK(31, 10)
>> @@ -1312,15 +1309,6 @@ static inline bool phydev_id_compare(struct phy_device *phydev, u32 id)
>>       return phy_id_compare(id, phydev->phy_id, phydev->drv->phy_id_mask);
>>   }
>>   -/* A Structure for boards to register fixups with the PHY Lib */
>> -struct phy_fixup {
>> -    struct list_head list;
>> -    char bus_id[MII_BUS_ID_SIZE + 3];
>> -    u32 phy_uid;
>> -    u32 phy_uid_mask;
>> -    int (*run)(struct phy_device *phydev);
>> -};
>> -
>>   const char *phy_speed_to_str(int speed);
>>   const char *phy_duplex_to_str(unsigned int duplex);
>>   const char *phy_rate_matching_to_str(int rate_matching);
>> @@ -2117,8 +2105,6 @@ s32 phy_get_internal_delay(struct phy_device *phydev, struct device *dev,
>>   void phy_resolve_pause(unsigned long *local_adv, unsigned long *partner_adv,
>>                  bool *tx_pause, bool *rx_pause);
>>   -int phy_register_fixup(const char *bus_id, u32 phy_uid, u32 phy_uid_mask,
>> -               int (*run)(struct phy_device *));
>>   int phy_register_fixup_for_id(const char *bus_id,
>>                     int (*run)(struct phy_device *));
>>   int phy_register_fixup_for_uid(u32 phy_uid, u32 phy_uid_mask,
>
Russell King (Oracle) Feb. 14, 2025, 2:51 p.m. UTC | #3
On Thu, Feb 13, 2025 at 10:48:11PM +0100, Heiner Kallweit wrote:
> Certain fixup-related definitions aren't used outside phy_device.c.
> So make them private and remove them from phy.h.
> 
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>

Reviewed-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>

Thanks!
Andrew Lunn Feb. 14, 2025, 3:49 p.m. UTC | #4
On Fri, Feb 14, 2025 at 12:11:09PM +0100, Heiner Kallweit wrote:
> On 14.02.2025 11:59, Mateusz Polchlopek wrote:
> > 
> > 
> > On 2/13/2025 10:48 PM, Heiner Kallweit wrote:
> >> Certain fixup-related definitions aren't used outside phy_device.c.
> >> So make them private and remove them from phy.h.
> >>
> >> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
> >> ---
> >>   drivers/net/phy/phy_device.c | 16 +++++++++++++---
> >>   include/linux/phy.h          | 14 --------------
> >>   2 files changed, 13 insertions(+), 17 deletions(-)
> >>
> >> diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
> >> index 9b06ba92f..14c312ad2 100644
> >> --- a/drivers/net/phy/phy_device.c
> >> +++ b/drivers/net/phy/phy_device.c
> >> @@ -45,6 +45,17 @@ MODULE_DESCRIPTION("PHY library");
> >>   MODULE_AUTHOR("Andy Fleming");
> >>   MODULE_LICENSE("GPL");
> >>   +#define    PHY_ANY_ID    "MATCH ANY PHY"
> >> +#define    PHY_ANY_UID    0xffffffff
> >> +
> > 
> > Overall looks like a nice cleanup but I am not sure about this space
> > between #define and PHY_ANY_ID or PHY_ANY_UID...
> > 
> There's a tab, which effectively equals a space. Maybe it's just the
> diff which is misleading. At least checkpatch didn't complain.

So long as it is a straight cut/paste from the old location, this is
fine.

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew
diff mbox series

Patch

diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index 9b06ba92f..14c312ad2 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -45,6 +45,17 @@  MODULE_DESCRIPTION("PHY library");
 MODULE_AUTHOR("Andy Fleming");
 MODULE_LICENSE("GPL");
 
+#define	PHY_ANY_ID	"MATCH ANY PHY"
+#define	PHY_ANY_UID	0xffffffff
+
+struct phy_fixup {
+	struct list_head list;
+	char bus_id[MII_BUS_ID_SIZE + 3];
+	u32 phy_uid;
+	u32 phy_uid_mask;
+	int (*run)(struct phy_device *phydev);
+};
+
 __ETHTOOL_DECLARE_LINK_MODE_MASK(phy_basic_features) __ro_after_init;
 EXPORT_SYMBOL_GPL(phy_basic_features);
 
@@ -378,8 +389,8 @@  static SIMPLE_DEV_PM_OPS(mdio_bus_phy_pm_ops, mdio_bus_phy_suspend,
  *	comparison
  * @run: The actual code to be run when a matching PHY is found
  */
-int phy_register_fixup(const char *bus_id, u32 phy_uid, u32 phy_uid_mask,
-		       int (*run)(struct phy_device *))
+static int phy_register_fixup(const char *bus_id, u32 phy_uid, u32 phy_uid_mask,
+			      int (*run)(struct phy_device *))
 {
 	struct phy_fixup *fixup = kzalloc(sizeof(*fixup), GFP_KERNEL);
 
@@ -397,7 +408,6 @@  int phy_register_fixup(const char *bus_id, u32 phy_uid, u32 phy_uid_mask,
 
 	return 0;
 }
-EXPORT_SYMBOL(phy_register_fixup);
 
 /* Registers a fixup to be run on any PHY with the UID in phy_uid */
 int phy_register_fixup_for_uid(u32 phy_uid, u32 phy_uid_mask,
diff --git a/include/linux/phy.h b/include/linux/phy.h
index 29df4c602..96e427c2c 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -1277,9 +1277,6 @@  struct phy_driver {
 #define to_phy_driver(d) container_of_const(to_mdio_common_driver(d),		\
 				      struct phy_driver, mdiodrv)
 
-#define PHY_ANY_ID "MATCH ANY PHY"
-#define PHY_ANY_UID 0xffffffff
-
 #define PHY_ID_MATCH_EXACT(id) .phy_id = (id), .phy_id_mask = GENMASK(31, 0)
 #define PHY_ID_MATCH_MODEL(id) .phy_id = (id), .phy_id_mask = GENMASK(31, 4)
 #define PHY_ID_MATCH_VENDOR(id) .phy_id = (id), .phy_id_mask = GENMASK(31, 10)
@@ -1312,15 +1309,6 @@  static inline bool phydev_id_compare(struct phy_device *phydev, u32 id)
 	return phy_id_compare(id, phydev->phy_id, phydev->drv->phy_id_mask);
 }
 
-/* A Structure for boards to register fixups with the PHY Lib */
-struct phy_fixup {
-	struct list_head list;
-	char bus_id[MII_BUS_ID_SIZE + 3];
-	u32 phy_uid;
-	u32 phy_uid_mask;
-	int (*run)(struct phy_device *phydev);
-};
-
 const char *phy_speed_to_str(int speed);
 const char *phy_duplex_to_str(unsigned int duplex);
 const char *phy_rate_matching_to_str(int rate_matching);
@@ -2117,8 +2105,6 @@  s32 phy_get_internal_delay(struct phy_device *phydev, struct device *dev,
 void phy_resolve_pause(unsigned long *local_adv, unsigned long *partner_adv,
 		       bool *tx_pause, bool *rx_pause);
 
-int phy_register_fixup(const char *bus_id, u32 phy_uid, u32 phy_uid_mask,
-		       int (*run)(struct phy_device *));
 int phy_register_fixup_for_id(const char *bus_id,
 			      int (*run)(struct phy_device *));
 int phy_register_fixup_for_uid(u32 phy_uid, u32 phy_uid_mask,