linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg KH <greg@kroah.com>
To: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
Cc: linux-kernel@vger.kernel.org, linux-pci@atrey.karlin.mff.cuni.cz,
	akpm@osdl.org, ak@suse.de, rmk+lkml@arm.linux.org.uk
Subject: Re: [PATCH 3/6] PCI legacy I/O port free driver (take2) - Add device_flags into pci_device_id
Date: Tue, 21 Feb 2006 12:56:40 -0800	[thread overview]
Message-ID: <20060221205640.GA12423@kroah.com> (raw)
In-Reply-To: <43FAB375.2020007@jp.fujitsu.com>

On Tue, Feb 21, 2006 at 03:30:13PM +0900, Kenji Kaneshige wrote:
> This patch adds the device_flags field into struct pci_device_id to
> enables pci device drivers to pass per device ID flags to the
> kernel. This patch also defines the PCI_DEVICE_ID_FLAG_NOIOPOT flag of
> the device_flags field which is used to tell the kernel whether the
> driver need to use I/O port regions to handle the device.
> 
> Signed-off-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
> 
> ---
>  drivers/pci/pci-driver.c        |   14 +++++++++++---
>  include/linux/mod_devicetable.h |    3 +++
>  2 files changed, 14 insertions(+), 3 deletions(-)
> 
> Index: linux-2.6.16-rc4/drivers/pci/pci-driver.c
> ===================================================================
> --- linux-2.6.16-rc4.orig/drivers/pci/pci-driver.c	2006-02-21 14:40:55.000000000 +0900
> +++ linux-2.6.16-rc4/drivers/pci/pci-driver.c	2006-02-21 14:40:55.000000000 +0900
> @@ -43,13 +43,13 @@
>  	struct pci_dynid *dynid;
>  	struct pci_driver *pdrv = to_pci_driver(driver);
>  	__u32 vendor=PCI_ANY_ID, device=PCI_ANY_ID, subvendor=PCI_ANY_ID,
> -		subdevice=PCI_ANY_ID, class=0, class_mask=0;
> +		subdevice=PCI_ANY_ID, class=0, class_mask=0, device_flags=0;
>  	unsigned long driver_data=0;
>  	int fields=0;
>  
> -	fields = sscanf(buf, "%x %x %x %x %x %x %lx",
> +	fields = sscanf(buf, "%x %x %x %x %x %x %lx %x",
>  			&vendor, &device, &subvendor, &subdevice,
> -			&class, &class_mask, &driver_data);
> +			&class, &class_mask, &driver_data, &device_flags);
>  	if (fields < 0)
>  		return -EINVAL;
>  
> @@ -67,6 +67,7 @@
>  	dynid->id.class_mask = class_mask;
>  	dynid->id.driver_data = pdrv->dynids.use_driver_data ?
>  		driver_data : 0UL;
> +	dynid->id.device_flags = device_flags;
>  
>  	spin_lock(&pdrv->dynids.lock);
>  	list_add_tail(&pdrv->dynids.list, &dynid->node);
> @@ -170,6 +171,12 @@
>  	return NULL;
>  }
>  
> +static inline void pci_extract_per_id_flags(struct pci_dev *dev,
> +					    const struct pci_device_id *id)
> +{
> +	dev->no_ioport = !!(id->device_flags & PCI_DEVICE_ID_FLAG_NOIOPORT);
> +}
> +
>  static int pci_call_probe(struct pci_driver *drv, struct pci_dev *dev,
>  			  const struct pci_device_id *id)
>  {
> @@ -189,6 +196,7 @@
>  	current->mempolicy = &default_policy;
>  	mpol_get(current->mempolicy);
>  #endif
> +	pci_extract_per_id_flags(dev, id);
>  	error = drv->probe(dev, id);
>  #ifdef CONFIG_NUMA
>  	set_cpus_allowed(current, oldmask);
> Index: linux-2.6.16-rc4/include/linux/mod_devicetable.h
> ===================================================================
> --- linux-2.6.16-rc4.orig/include/linux/mod_devicetable.h	2006-02-21 14:40:46.000000000 +0900
> +++ linux-2.6.16-rc4/include/linux/mod_devicetable.h	2006-02-21 14:40:55.000000000 +0900
> @@ -19,8 +19,11 @@
>  	__u32 subvendor, subdevice;	/* Subsystem ID's or PCI_ANY_ID */
>  	__u32 class, class_mask;	/* (class,subclass,prog-if) triplet */
>  	kernel_ulong_t driver_data;	/* Data private to the driver */
> +	__u32 device_flags;		/* Per device ID flags (See below) */

I don't think you can add fields here, after the driver_data field.  It
might mess up userspace tools a lot, as you are changing a userspace
api.

Do you _really_ need to pass this information back from userspace to the
driver in this manner?

thanks,

greg k-h

  parent reply	other threads:[~2006-02-21 20:56 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-02-21  6:26 [PATCH 0/6] PCI legacy I/O port free driver (take2) Kenji Kaneshige
2006-02-21  6:28 ` [PATCH 1/6] PCI legacy I/O port free driver (take2) - Add no_ioport flag into pci_dev Kenji Kaneshige
2006-02-21 21:01   ` Greg KH
2006-02-21  6:29 ` [PATCH 2/6] PCI legacy I/O port free driver (take2) - Fix minor bug in store_new_id() Kenji Kaneshige
2006-02-21  6:30 ` [PATCH 3/6] PCI legacy I/O port free driver (take2) - Add device_flags into pci_device_id Kenji Kaneshige
2006-02-21 13:57   ` Andi Kleen
2006-02-21 20:56   ` Greg KH [this message]
2006-02-21 20:59     ` Andi Kleen
2006-02-21 21:10       ` Greg KH
2006-02-21 21:31         ` Andi Kleen
2006-02-21 21:55           ` Jeff Garzik
2006-02-21 22:06             ` Andi Kleen
2006-02-22  0:09               ` Jeff Garzik
2006-02-22  0:11                 ` Greg KH
2006-02-22  2:34                   ` Kenji Kaneshige
2006-02-23  2:37         ` Benjamin Herrenschmidt
2006-02-23  6:33           ` Kenji Kaneshige
2006-02-21  6:31 ` [PATCH 4/6] PCI legacy I/O port free driver (take2) - Update Documentation/pci.txt Kenji Kaneshige
2006-02-21  6:32 ` [PATCH 5/6] PCI legacy I/O port free driver (take2) - Make Intel e1000 driver legacy I/O port free Kenji Kaneshige
2006-02-21  6:33 ` [PATCH 6/6] PCI legacy I/O port free driver (take2) - Make Emulex lpfc " Kenji Kaneshige
2006-02-21 20:56   ` Greg KH
2006-02-23  2:34 ` [PATCH 0/6] PCI legacy I/O port free driver (take2) Benjamin Herrenschmidt
2006-02-23  5:58   ` Kenji Kaneshige

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=20060221205640.GA12423@kroah.com \
    --to=greg@kroah.com \
    --cc=ak@suse.de \
    --cc=akpm@osdl.org \
    --cc=kaneshige.kenji@jp.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@atrey.karlin.mff.cuni.cz \
    --cc=rmk+lkml@arm.linux.org.uk \
    /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).