Message ID | 0c2302aceb4739ec846edebbc57e71819a8b8ad3.1674036164.git.geert+renesas@glider.be (mailing list archive) |
---|---|
State | Superseded |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | phy: Add devm_of_phy_optional_get() helper | expand |
Context | Check | Description |
---|---|---|
netdev/tree_selection | success | Guessed tree name to be net-next |
netdev/fixes_present | success | Fixes tag not required for -next series |
netdev/subject_prefix | success | Link |
netdev/cover_letter | success | Series has a cover letter |
netdev/patch_count | success | Link |
netdev/header_inline | success | No static functions without inline keyword in header files |
netdev/build_32bit | success | Errors and warnings before: 0 this patch: 0 |
netdev/cc_maintainers | success | CCed 6 of 6 maintainers |
netdev/build_clang | success | Errors and warnings before: 0 this patch: 0 |
netdev/module_param | success | Was 0 now: 0 |
netdev/verify_signedoff | success | Signed-off-by tag matches author and committer |
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: 0 this patch: 0 |
netdev/checkpatch | success | total: 0 errors, 0 warnings, 0 checks, 16 lines checked |
netdev/kdoc | success | Errors and warnings before: 0 this patch: 0 |
netdev/source_inline | success | Was 0 now: 0 |
On 1/18/23 05:15, Geert Uytterhoeven wrote: > Use the new devm_of_phy_optional_get() helper instead of open-coding the > same operation. > > Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> > --- > drivers/net/ethernet/freescale/fman/fman_memac.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/drivers/net/ethernet/freescale/fman/fman_memac.c b/drivers/net/ethernet/freescale/fman/fman_memac.c > index 9349f841bd0645a0..892277f13048660d 100644 > --- a/drivers/net/ethernet/freescale/fman/fman_memac.c > +++ b/drivers/net/ethernet/freescale/fman/fman_memac.c > @@ -1152,12 +1152,12 @@ int memac_initialization(struct mac_device *mac_dev, > else > memac->sgmii_pcs = pcs; > > - memac->serdes = devm_of_phy_get(mac_dev->dev, mac_node, "serdes"); > - err = PTR_ERR(memac->serdes); > - if (err == -ENODEV || err == -ENOSYS) { > + memac->serdes = devm_of_phy_optional_get(mac_dev->dev, mac_node, > + "serdes"); > + if (!memac->serdes) { > dev_dbg(mac_dev->dev, "could not get (optional) serdes\n"); > - memac->serdes = NULL; > } else if (IS_ERR(memac->serdes)) { > + err = PTR_ERR(memac->serdes); > dev_err_probe(mac_dev->dev, err, "could not get serdes\n"); > goto _return_fm_mac_free; > } Reviewed-by: Sean Anderson <sean.anderson@seco.com>
diff --git a/drivers/net/ethernet/freescale/fman/fman_memac.c b/drivers/net/ethernet/freescale/fman/fman_memac.c index 9349f841bd0645a0..892277f13048660d 100644 --- a/drivers/net/ethernet/freescale/fman/fman_memac.c +++ b/drivers/net/ethernet/freescale/fman/fman_memac.c @@ -1152,12 +1152,12 @@ int memac_initialization(struct mac_device *mac_dev, else memac->sgmii_pcs = pcs; - memac->serdes = devm_of_phy_get(mac_dev->dev, mac_node, "serdes"); - err = PTR_ERR(memac->serdes); - if (err == -ENODEV || err == -ENOSYS) { + memac->serdes = devm_of_phy_optional_get(mac_dev->dev, mac_node, + "serdes"); + if (!memac->serdes) { dev_dbg(mac_dev->dev, "could not get (optional) serdes\n"); - memac->serdes = NULL; } else if (IS_ERR(memac->serdes)) { + err = PTR_ERR(memac->serdes); dev_err_probe(mac_dev->dev, err, "could not get serdes\n"); goto _return_fm_mac_free; }
Use the new devm_of_phy_optional_get() helper instead of open-coding the same operation. Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> --- drivers/net/ethernet/freescale/fman/fman_memac.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)