Thread (1 message) 1 message, 1 author, 2016-08-21

Re: [PATCH v2 3/4] net: stmmac: add a glue driver for the Amlogic Meson 8b / GXBB DWMAC

From: Martin Blumenstingl <hidden>
Date: 2016-08-21 12:00:39
Also in: linux-amlogic, linux-arm-kernel, netdev

Hi Joachim,

On Sat, Aug 20, 2016 at 11:29 PM, Joachim  Eastwood [off-list ref] wrote:
quoted
+       platform_set_drvdata(pdev, dwmac);
This will not work. The main stmmac driver already uses the driver_data field.
See: http://lxr.free-electrons.com/source/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c#L3218

quoted
+       return stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res);
So calling stmmac_dvr_probe here will overwrite the driver_data field.

quoted
+}
+
+static int meson8b_dwmac_remove(struct platform_device *pdev)
+{
+       struct meson8b_dwmac *dwmac = platform_get_drvdata(pdev);
+
+       clk_disable_unprepare(dwmac->m25_div_clk);
Did you test this code? I am pretty sure it will blow up given that
driver_data is not set to what you expect.
I guess I should've taken a closer look at my kernel config:
CONFIG_DWMAC_MESON=y
Thanks for spotting this issue!
To get your meson8b_dwmac struct you must retrieve it from plat_dat->bsp_priv.


I have some code for a helper to retrieve bsp_priv that I have meant
to sent to the ML for a while now.
See: https://github.com/manabian/linux-lpc/commit/c3e155a6e38b9634e4e61aa4eeb4602ede7e44a6

Feel free to add it to your patch set if you want.

Alternatively take a look at the remove function from dwmac-stm32 here:
https://patchwork.ozlabs.org/patch/619816/
excellent, thanks!

I will send a fixed version as soon as possible


Regards,
Martin
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help