Hello,
On Tue, 5 Dec 2017 09:39:35 +0100, Geert Uytterhoeven wrote:
> > Using 'ndev->dev.parent' (as in ravb) also should work... not sure which
> > is better
>
> That was going to be my comment, too. I also haven't checked which
> generates the smallest code.
Using ndev->dev.parent actually generates bigger code (44 bytes larger) :
$ size drivers/net/ethernet/renesas/sh_eth.o.*
text data bss dec hex filename
27803 696 0 28499 6f53
drivers/net/ethernet/renesas/sh_eth.o.new
27759 696 0 28455 6f27
drivers/net/ethernet/renesas/sh_eth.o.orig
.orig is my original proposal, .new is with ndev->dev.parent. I'm using
a gcc 6.4.0 compiler.
Note also that the driver is already using mdp->pdev->dev all over the place:
$ grep -- mdp-\>pdev-\>dev drivers/net/ethernet/renesas/sh_eth.c
pm_wakeup_event(&mdp->pdev->dev, 0);
pm_runtime_get_sync(&mdp->pdev->dev);
pm_runtime_put_sync(&mdp->pdev->dev);
device_set_wakeup_enable(&mdp->pdev->dev, mdp->wol_enabled);
pm_runtime_get_sync(&mdp->pdev->dev);
pm_runtime_put_sync(&mdp->pdev->dev);
pm_runtime_put_sync(&mdp->pdev->dev);
struct device *dev = &mdp->pdev->dev;
Best regards,
Thomas Petazzoni
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com