715-08-net-sfp-make-sfp_bus_find_fwnode-take-a-const-fwnode.patch 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. From a90ac762d345890b40d88a1385a34a2449c2d75e Mon Sep 17 00:00:00 2001
  2. From: "Russell King (Oracle)" <[email protected]>
  3. Date: Fri, 24 Mar 2023 09:23:42 +0000
  4. Subject: [PATCH] net: sfp: make sfp_bus_find_fwnode() take a const fwnode
  5. sfp_bus_find_fwnode() does not write to the fwnode, so let's make it
  6. const.
  7. Signed-off-by: Russell King (Oracle) <[email protected]>
  8. Reviewed-by: Simon Horman <[email protected]>
  9. Signed-off-by: David S. Miller <[email protected]>
  10. ---
  11. drivers/net/phy/sfp-bus.c | 2 +-
  12. include/linux/sfp.h | 5 +++--
  13. 2 files changed, 4 insertions(+), 3 deletions(-)
  14. --- a/drivers/net/phy/sfp-bus.c
  15. +++ b/drivers/net/phy/sfp-bus.c
  16. @@ -603,7 +603,7 @@ static void sfp_upstream_clear(struct sf
  17. * - %-ENOMEM if we failed to allocate the bus.
  18. * - an error from the upstream's connect_phy() method.
  19. */
  20. -struct sfp_bus *sfp_bus_find_fwnode(struct fwnode_handle *fwnode)
  21. +struct sfp_bus *sfp_bus_find_fwnode(const struct fwnode_handle *fwnode)
  22. {
  23. struct fwnode_reference_args ref;
  24. struct sfp_bus *bus;
  25. --- a/include/linux/sfp.h
  26. +++ b/include/linux/sfp.h
  27. @@ -548,7 +548,7 @@ int sfp_get_module_eeprom_by_page(struct
  28. void sfp_upstream_start(struct sfp_bus *bus);
  29. void sfp_upstream_stop(struct sfp_bus *bus);
  30. void sfp_bus_put(struct sfp_bus *bus);
  31. -struct sfp_bus *sfp_bus_find_fwnode(struct fwnode_handle *fwnode);
  32. +struct sfp_bus *sfp_bus_find_fwnode(const struct fwnode_handle *fwnode);
  33. int sfp_bus_add_upstream(struct sfp_bus *bus, void *upstream,
  34. const struct sfp_upstream_ops *ops);
  35. void sfp_bus_del_upstream(struct sfp_bus *bus);
  36. @@ -610,7 +610,8 @@ static inline void sfp_bus_put(struct sf
  37. {
  38. }
  39. -static inline struct sfp_bus *sfp_bus_find_fwnode(struct fwnode_handle *fwnode)
  40. +static inline struct sfp_bus *
  41. +sfp_bus_find_fwnode(const struct fwnode_handle *fwnode)
  42. {
  43. return NULL;
  44. }