Merge branch 'complete-lynx-mdio-device-handling'
authorJakub Kicinski <kuba@kernel.org>
Fri, 9 Jun 2023 02:19:52 +0000 (19:19 -0700)
committerJakub Kicinski <kuba@kernel.org>
Fri, 9 Jun 2023 02:19:52 +0000 (19:19 -0700)
commit68bd67b43fe9e6f8128d1bedf698b5f13ec6a766
treeb5bab0b67e74e1a595f59168827808217c6d2d9f
parentc8cc2ae229ff0aa9b7e67fd38f5d73bece111e71
parent32fc30353f7c4d5370acf6ef8fb3be9363dce3c2
Merge branch 'complete-lynx-mdio-device-handling'

Russell King says:

====================
complete Lynx mdio device handling

This series completes the mdio device lifetime handling for Lynx PCS
users which do not create their own mdio device, but instead fetch
it using a firmware description - namely the DPAA2 and FMAN_MEMAC
drivers.

In a previous patch set, lynx_pcs_create() was modified to increase
the mdio device refcount, and lynx_pcs_destroy() to drop that
refcount.

The first two patches change these two drivers to put the reference
which they hold immediately after lynx_pcs_create(), effectively
handing the responsibility for maintaining the refcount to the Lynx
PCS driver.

A side effect of the first two patches is that lynx_get_mdio_device()
is no longer used, so patch 3 removes it.

Patch 4 adds a new helper - lynx_pcs_create_fwnode(), which creates
a Lynx PCS instance from the fwnode.

Patch 5 and 6 convert the two drivers to make use of this new helper,
which simply has to find the mdio device, and then create the Lynx
PCS from that.

With those conversions done, lynx_pcs_create() is no longer required
outside pcs-lynx.c, so remove it from public view.

Patch 8 we changes lynx_pcs_create() to return an error-pointer rather
than NULL to bring consistency to the return style, and means that we
can remove the NULL-to-error-pointer conversion from both
lynx_pcs_create_fwnode() and lynx_pcs_create_mdiodev().

Patch 9 adds a check for the fwnode being available, and returns an
-ENODEV error pointer if unavailable.

Patch 10 removes this check from DPAA2, detecting the error pointer
value to continue printing the helpful message.

Patch 11 removes this check from fman_memac, and in doing so fixes a
bug where if the node is unavailable, the reference count is not
dropped.
====================

Link: https://lore.kernel.org/r/ZIBwuw+IuGQo5yV8@shell.armlinux.org.uk
Signed-off-by: Jakub Kicinski <kuba@kernel.org>