Add genphy_config_aneg() method to phy::Device, wrapping the C function __genphy_config_aneg(). This is needed by PHY drivers that perform custom BMCR configuration before calling the generic auto-negotiation setup. The wrapper calls __genphy_config_aneg(phydev, false) directly since genphy_config_aneg() is a static inline function not visible to bindgen. Signed-off-by: Artem Lytkin --- rust/kernel/net/phy.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/rust/kernel/net/phy.rs b/rust/kernel/net/phy.rs index 3ca99db5cccf..5ccadc5e2579 100644 --- a/rust/kernel/net/phy.rs +++ b/rust/kernel/net/phy.rs @@ -276,6 +276,15 @@ pub fn genphy_read_abilities(&mut self) -> Result { // So it's just an FFI call. to_result(unsafe { bindings::genphy_read_abilities(phydev) }) } + + /// Configures the advertisement and resets auto-negotiation + /// if auto-negotiation is enabled. + pub fn genphy_config_aneg(&mut self) -> Result { + let phydev = self.0.get(); + // SAFETY: `phydev` is pointing to a valid object by the type invariant of `Self`. + // So it's just an FFI call. + to_result(unsafe { bindings::__genphy_config_aneg(phydev, false) }) + } } impl AsRef for Device { -- 2.43.0 Replace hardcoded -EFAULT returns with dev_err_probe() and PTR_ERR() when devm_clk_get() fails in fsl_mx6_enable(). This ensures the correct error code is propagated (e.g. -EPROBE_DEFER for deferred probing) and avoids log noise during probe deferral. Signed-off-by: Artem Lytkin --- drivers/staging/most/dim2/dim2.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/staging/most/dim2/dim2.c b/drivers/staging/most/dim2/dim2.c index cea1ba99caf7..e4c8b4995c61 100644 --- a/drivers/staging/most/dim2/dim2.c +++ b/drivers/staging/most/dim2/dim2.c @@ -921,10 +921,9 @@ static int fsl_mx6_enable(struct platform_device *pdev) int ret; dev->clk = devm_clk_get(&pdev->dev, "mlb"); - if (IS_ERR(dev->clk)) { - dev_err(&pdev->dev, "unable to get mlb clock\n"); - return -EFAULT; - } + if (IS_ERR(dev->clk)) + return dev_err_probe(&pdev->dev, PTR_ERR(dev->clk), + "unable to get mlb clock\n"); ret = clk_prepare_enable(dev->clk); if (ret) { @@ -936,9 +935,9 @@ static int fsl_mx6_enable(struct platform_device *pdev) /* enable pll */ dev->clk_pll = devm_clk_get(&pdev->dev, "pll8_mlb"); if (IS_ERR(dev->clk_pll)) { - dev_err(&pdev->dev, "unable to get mlb pll clock\n"); clk_disable_unprepare(dev->clk); - return -EFAULT; + return dev_err_probe(&pdev->dev, PTR_ERR(dev->clk_pll), + "unable to get mlb pll clock\n"); } writel(0x888, dev->io_base + 0x38); -- 2.43.0