From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: linux-sh@vger.kernel.org
Subject: Re: [PATCH/RFC 1/5] sh_eth: Use the platform device for memory allocation
Date: Thu, 20 Mar 2014 13:42:30 +0000 [thread overview]
Message-ID: <1559195.L99rsh2laM@avalon> (raw)
In-Reply-To: <1395185156-6681-2-git-send-email-laurent.pinchart+renesas@ideasonboard.com>
Hi Sergei,
On Wednesday 19 March 2014 20:19:51 Sergei Shtylyov wrote:
> On 03/19/2014 02:25 AM, Laurent Pinchart wrote:
> > Memory allocated for the MDIO bus with the devm_kzalloc() API is
> > associated with the network device. While this will cause memory to be
> > freed at the right time, it doesn't allow allocating memory before the
> > network device is initialized.
> >
> > Replace the network device with the parent platform device for memory
> > allocation to remove that dependency. This also improves consistency
> > with the other devm_* calls in the driver that all use the platform
> > device.
> >
> > Signed-off-by: Laurent Pinchart
> > <laurent.pinchart+renesas@ideasonboard.com>
> > ---
> >
> > drivers/net/ethernet/renesas/sh_eth.c | 7 +++----
> > 1 file changed, 3 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/net/ethernet/renesas/sh_eth.c
> > b/drivers/net/ethernet/renesas/sh_eth.c index be7211d..b80abb6 100644
> > --- a/drivers/net/ethernet/renesas/sh_eth.c
> > +++ b/drivers/net/ethernet/renesas/sh_eth.c
> > @@ -2615,10 +2615,10 @@ static int sh_mdio_init(struct net_device *ndev,
> > int id,>
> > int ret, i;
> > struct bb_info *bitbang;
> > struct sh_eth_private *mdp = netdev_priv(ndev);
>
> I'd suggest to also declare:
>
> struct platform_device *pdev = &mdp->pdev;
>
> so that you could simplify 'mdev->pdev->name' derefs in the sprintf() call
> and to get rid of the 'id' parameter to sh_mdio_init() by using 'pdev->id'
> directly in the same call.
Good idea. I'll do that in patch 2/5 for v2.
--
Regards,
Laurent Pinchart
next prev parent reply other threads:[~2014-03-20 13:42 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-18 23:25 [PATCH/RFC 1/5] sh_eth: Use the platform device for memory allocation Laurent Pinchart
2014-03-19 16:19 ` Sergei Shtylyov
2014-03-20 13:42 ` Laurent Pinchart [this message]
2014-03-20 13:43 ` Laurent Pinchart
2014-03-20 15:28 ` Sergei Shtylyov
2014-03-21 13:02 ` Laurent Pinchart
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1559195.L99rsh2laM@avalon \
--to=laurent.pinchart@ideasonboard.com \
--cc=linux-sh@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).