From: Russell King - ARM Linux <linux@arm.linux.org.uk>
To: Francois Romieu <romieu@fr.zoreil.com>
Cc: Tony Prisk <linux@prisktech.co.nz>,
vt8500-wm8505-linux-kernel@googlegroups.com,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org, davem@davemloft.net
Subject: Re: [PATCHv3 3/3] net: velocity: Add platform device support to VIA velocity driver
Date: Thu, 2 May 2013 18:19:51 +0100 [thread overview]
Message-ID: <20130502171951.GV14496@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <20130429230450.GA2620@electric-eye.fr.zoreil.com>
On Tue, Apr 30, 2013 at 01:04:50AM +0200, Francois Romieu wrote:
> Tony Prisk <linux@prisktech.co.nz> :
> [...]
> > +static int velocity_remove(void *pdev, enum velocity_bus_type bustype)
> > +{
> > + struct net_device *netdev;
> > + struct velocity_info *vptr;
> > + int pci = (bustype == BUS_PCI) ? 1 : 0;
> > +
> > + if (pci)
> > + netdev = pci_get_drvdata(pdev);
> > + else
> > + netdev = platform_get_drvdata(pdev);
>
> The caller knows how to retrieve the net_device pointer, whence
> the struct velocity_info pointer, whence any bustype dependent
> function pointer to alleviate the "if (pci)" and CONFIG stuff.
>
> If you are not convinced, please consider turning the void *
> into an union *.
The other thing here is that you can just pass a struct device into
these and retrieve the same driver data via:
netdev = dev_get_drvdata(dev);
as:
static inline void *platform_get_drvdata(const struct platform_device *pdev)
{
return dev_get_drvdata(&pdev->dev);
}
static inline void *pci_get_drvdata(struct pci_dev *pdev)
{
return dev_get_drvdata(&pdev->dev);
}
So there's no need for void * or union nonsense.
prev parent reply other threads:[~2013-05-02 17:20 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-29 19:46 [PATCHv3 0/3] Add support for velocity network driver on platform devices Tony Prisk
2013-04-29 19:46 ` [PATCHv3 1/3] net: velocity: Rename vptr->dev to vptr->netdev Tony Prisk
2013-04-29 19:46 ` [PATCHv3 2/3] net: velocity: Convert to generic dma functions Tony Prisk
2013-04-29 19:46 ` [PATCHv3 3/3] net: velocity: Add platform device support to VIA velocity driver Tony Prisk
2013-04-29 23:04 ` Francois Romieu
2013-05-02 17:19 ` Russell King - ARM Linux [this message]
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=20130502171951.GV14496@n2100.arm.linux.org.uk \
--to=linux@arm.linux.org.uk \
--cc=davem@davemloft.net \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@prisktech.co.nz \
--cc=netdev@vger.kernel.org \
--cc=romieu@fr.zoreil.com \
--cc=vt8500-wm8505-linux-kernel@googlegroups.com \
/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).