diff mbox series

[net-next] net: sfp-bus: constify link_modes to sfp_select_interface()

Message ID E1s15s0-00AHyq-8E@rmk-PC.armlinux.org.uk (mailing list archive)
State Accepted
Commit 5cd9fac3a369edd072e8e72a2b5f5abae57c97ed
Delegated to: Netdev Maintainers
Headers show
Series [net-next] net: sfp-bus: constify link_modes to sfp_select_interface() | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
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: 928 this patch: 928
netdev/build_tools success Errors and warnings before: 0 this patch: 0
netdev/cc_maintainers success CCed 7 of 7 maintainers
netdev/build_clang success Errors and warnings before: 940 this patch: 940
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: 939 this patch: 939
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 24 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 6 this patch: 6
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2024-04-29--15-00 (tests: 994)

Commit Message

Russell King (Oracle) April 28, 2024, 2:51 p.m. UTC
sfp_select_interface() does not modify its link_modes argument, so
make this a const pointer.

Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
 drivers/net/phy/sfp-bus.c | 2 +-
 include/linux/sfp.h       | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

Comments

Daniel Machon April 29, 2024, 8:25 a.m. UTC | #1
> sfp_select_interface() does not modify its link_modes argument, so
> make this a const pointer.
> 
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> ---
>  drivers/net/phy/sfp-bus.c | 2 +-
>  include/linux/sfp.h       | 4 ++--
>  2 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/phy/sfp-bus.c b/drivers/net/phy/sfp-bus.c
> index c6e3baf00f23..37c85f1e6534 100644
> --- a/drivers/net/phy/sfp-bus.c
> +++ b/drivers/net/phy/sfp-bus.c
> @@ -355,7 +355,7 @@ EXPORT_SYMBOL_GPL(sfp_parse_support);
>   * modes mask.
>   */
>  phy_interface_t sfp_select_interface(struct sfp_bus *bus,
> -                                    unsigned long *link_modes)
> +                                    const unsigned long *link_modes)
>  {
>         if (phylink_test(link_modes, 25000baseCR_Full) ||
>             phylink_test(link_modes, 25000baseKR_Full) ||
> diff --git a/include/linux/sfp.h b/include/linux/sfp.h
> index 55c0ab17c9e2..5ebc57f78c95 100644
> --- a/include/linux/sfp.h
> +++ b/include/linux/sfp.h
> @@ -554,7 +554,7 @@ bool sfp_may_have_phy(struct sfp_bus *bus, const struct sfp_eeprom_id *id);
>  void sfp_parse_support(struct sfp_bus *bus, const struct sfp_eeprom_id *id,
>                        unsigned long *support, unsigned long *interfaces);
>  phy_interface_t sfp_select_interface(struct sfp_bus *bus,
> -                                    unsigned long *link_modes);
> +                                    const unsigned long *link_modes);
> 
>  int sfp_get_module_info(struct sfp_bus *bus, struct ethtool_modinfo *modinfo);
>  int sfp_get_module_eeprom(struct sfp_bus *bus, struct ethtool_eeprom *ee,
> @@ -593,7 +593,7 @@ static inline void sfp_parse_support(struct sfp_bus *bus,
>  }
> 
>  static inline phy_interface_t sfp_select_interface(struct sfp_bus *bus,
> -                                                  unsigned long *link_modes)
> +                                               const unsigned long *link_modes)

There seem to be some misalignment on the opening brace - at least in my
editor..

Other than that:

Reviewed-by: Daniel Machon <daniel.machon@microchip.com>


>  {
>         return PHY_INTERFACE_MODE_NA;
>  }
> --
> 2.30.2
> 
>
Russell King (Oracle) April 29, 2024, 8:58 a.m. UTC | #2
On Mon, Apr 29, 2024 at 08:25:11AM +0000, Daniel Machon wrote:
> > @@ -593,7 +593,7 @@ static inline void sfp_parse_support(struct sfp_bus *bus,
> >  }
> > 
> >  static inline phy_interface_t sfp_select_interface(struct sfp_bus *bus,
> > -                                                  unsigned long *link_modes)
> > +                                               const unsigned long *link_modes)
> 
> There seem to be some misalignment on the opening brace - at least in my
> editor..

It's intentional to avoid going over column 80 (I use an 80 column wide
terminal to edit.) It's either that or the thing gets wrapped differently
(which then means one loses the return code when grepping.) From a
readability point of view, this is what I prefer.
patchwork-bot+netdevbpf@kernel.org April 30, 2024, 1:40 p.m. UTC | #3
Hello:

This patch was applied to netdev/net-next.git (main)
by Paolo Abeni <pabeni@redhat.com>:

On Sun, 28 Apr 2024 15:51:12 +0100 you wrote:
> sfp_select_interface() does not modify its link_modes argument, so
> make this a const pointer.
> 
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> ---
>  drivers/net/phy/sfp-bus.c | 2 +-
>  include/linux/sfp.h       | 4 ++--
>  2 files changed, 3 insertions(+), 3 deletions(-)

Here is the summary with links:
  - [net-next] net: sfp-bus: constify link_modes to sfp_select_interface()
    https://git.kernel.org/netdev/net-next/c/5cd9fac3a369

You are awesome, thank you!
diff mbox series

Patch

diff --git a/drivers/net/phy/sfp-bus.c b/drivers/net/phy/sfp-bus.c
index c6e3baf00f23..37c85f1e6534 100644
--- a/drivers/net/phy/sfp-bus.c
+++ b/drivers/net/phy/sfp-bus.c
@@ -355,7 +355,7 @@  EXPORT_SYMBOL_GPL(sfp_parse_support);
  * modes mask.
  */
 phy_interface_t sfp_select_interface(struct sfp_bus *bus,
-				     unsigned long *link_modes)
+				     const unsigned long *link_modes)
 {
 	if (phylink_test(link_modes, 25000baseCR_Full) ||
 	    phylink_test(link_modes, 25000baseKR_Full) ||
diff --git a/include/linux/sfp.h b/include/linux/sfp.h
index 55c0ab17c9e2..5ebc57f78c95 100644
--- a/include/linux/sfp.h
+++ b/include/linux/sfp.h
@@ -554,7 +554,7 @@  bool sfp_may_have_phy(struct sfp_bus *bus, const struct sfp_eeprom_id *id);
 void sfp_parse_support(struct sfp_bus *bus, const struct sfp_eeprom_id *id,
 		       unsigned long *support, unsigned long *interfaces);
 phy_interface_t sfp_select_interface(struct sfp_bus *bus,
-				     unsigned long *link_modes);
+				     const unsigned long *link_modes);
 
 int sfp_get_module_info(struct sfp_bus *bus, struct ethtool_modinfo *modinfo);
 int sfp_get_module_eeprom(struct sfp_bus *bus, struct ethtool_eeprom *ee,
@@ -593,7 +593,7 @@  static inline void sfp_parse_support(struct sfp_bus *bus,
 }
 
 static inline phy_interface_t sfp_select_interface(struct sfp_bus *bus,
-						   unsigned long *link_modes)
+						const unsigned long *link_modes)
 {
 	return PHY_INTERFACE_MODE_NA;
 }