From: "John W. Linville" <linville@tuxdriver.com>
To: Lennert Buytenhek <buytenh@wantstofly.org>
Cc: linux-wireless@vger.kernel.org
Subject: Re: [PATCH 15/28] mwl8k: change pci id table driver data to a structure pointer
Date: Fri, 6 Nov 2009 15:57:25 -0500 [thread overview]
Message-ID: <20091106205724.GJ2782@tuxdriver.com> (raw)
In-Reply-To: <20091022182046.GQ1583@mail.wantstofly.org>
On Thu, Oct 22, 2009 at 08:20:47PM +0200, Lennert Buytenhek wrote:
> To prepare for adding support for more device types, introduce a
> new structure, mwl8k_device_info, where per-device information can
> be stored, and change the pci id table driver data from an integer
> indicating only the part number to a pointer to a mwl8k_device_info
> structure.
>
> Signed-off-by: Lennert Buytenhek <buytenh@marvell.com>
> ---
> drivers/net/wireless/mwl8k.c | 47 ++++++++++++++++++++++++++---------------
> 1 files changed, 30 insertions(+), 17 deletions(-)
> @@ -2940,6 +2936,22 @@ static void mwl8k_finalize_join_worker(struct work_struct *work)
> priv->beacon_skb = NULL;
> }
>
> +static struct mwl8k_device_info di_8687 = {
> + .part_num = 8687,
> +};
> +
> +static DEFINE_PCI_DEVICE_TABLE(mwl8k_pci_id_table) = {
> + {
> + PCI_VDEVICE(MARVELL, 0x2a2b),
> + .driver_data = (unsigned long)&di_8687,
> + }, {
> + PCI_VDEVICE(MARVELL, 0x2a30),
> + .driver_data = (unsigned long)&di_8687,
> + }, {
> + },
> +};
> +MODULE_DEVICE_TABLE(pci, mwl8k_pci_id_table);
> +
> static int __devinit mwl8k_probe(struct pci_dev *pdev,
> const struct pci_device_id *id)
> {
My only complaint here is that using a pointer for
driver_data make it difficult and potentially dangerous to use
/sys/bus/pci/drivers/.../new_id to add a PCI ID to the device.
Using an integer instead makes that a bit safer and easier to use.
drivers/net/3c59x.c provides a decent example.
John
--
John W. Linville Someday the world will need a hero, and you
linville@tuxdriver.com might be all we have. Be ready.
next prev parent reply other threads:[~2009-11-06 21:00 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-22 18:20 [PATCH 15/28] mwl8k: change pci id table driver data to a structure pointer Lennert Buytenhek
2009-11-06 20:57 ` John W. Linville [this message]
2009-11-10 10:09 ` Lennert Buytenhek
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=20091106205724.GJ2782@tuxdriver.com \
--to=linville@tuxdriver.com \
--cc=buytenh@wantstofly.org \
--cc=linux-wireless@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).