public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Frank Mori Hess <fmhess@speakeasy.net>
To: Herton Ronaldo Krzesinski <herton@mandriva.com.br>
Cc: Ian Abbott <abbotti@mev.co.uk>, Ian Abbott <ian.abbott@mev.co.uk>,
	Greg KH <gregkh@suse.de>, LKML <linux-kernel@vger.kernel.org>,
	Gianluca Palli <gpalli@deis.unibo.it>,
	David Schleef <ds@schleef.org>,
	Frank Mori Hess <fmhess@users.sourceforge.net>
Subject: Re: staging driver s626 clashes with philips SAA7146 media/dvb based cards
Date: Wed, 17 Jun 2009 19:35:13 -0400	[thread overview]
Message-ID: <200906171935.14341.fmhess@speakeasy.net> (raw)
In-Reply-To: <200906172009.50798.herton@mandriva.com.br>

[-- Attachment #1: Type: text/plain, Size: 2802 bytes --]

On Wednesday 17 June 2009, Herton Ronaldo Krzesinski wrote:
> Also s626_attach is modified to use now pci_get_subsys instead of
> pci_get_device as reported by Ian Abbott, additionaly ensuring that
> subvendor or subdevice id is set in pci id table entries.
>
> Reference: http://lkml.org/lkml/2009/6/16/552
> ---
>  drivers/staging/comedi/drivers/s626.c |   35
> ++++++++++++++++++++------------ 1 files changed, 22 insertions(+), 13
> deletions(-)
>
> diff --git a/drivers/staging/comedi/drivers/s626.c
> b/drivers/staging/comedi/drivers/s626.c index 30dec9d..3ec4407 100644
> --- a/drivers/staging/comedi/drivers/s626.c
> +++ b/drivers/staging/comedi/drivers/s626.c
> @@ -110,9 +110,9 @@ static const struct s626_board s626_boards[] = {
>  #define PCI_VENDOR_ID_S626 0x1131
>  #define PCI_DEVICE_ID_S626 0x7146
>
> +/* sub pci id must be specified, see s626_attach for more details */
>  static DEFINE_PCI_DEVICE_TABLE(s626_pci_table) = {
> -	{PCI_VENDOR_ID_S626, PCI_DEVICE_ID_S626, PCI_ANY_ID, PCI_ANY_ID, 0, 0,
> -		0},
> +	{PCI_VENDOR_ID_S626, PCI_DEVICE_ID_S626, 0x6000, 0x0272, 0, 0, 0},
>  	{0}
>  };
>
> @@ -498,24 +498,33 @@ static int s626_attach(struct comedi_device *dev,
> struct comedi_devconfig *it) resource_size_t resourceStart;
>  	dma_addr_t appdma;
>  	struct comedi_subdevice *s;
> -	struct pci_dev *pdev;
> +	const struct pci_device_id *ids;
> +	struct pci_dev *pdev = NULL;
>
>  	if (alloc_private(dev, sizeof(struct s626_private)) < 0)
>  		return -ENOMEM;
>
> -	for (pdev = pci_get_device(PCI_VENDOR_ID_S626, PCI_DEVICE_ID_S626,
> -			NULL); pdev != NULL;
> -		pdev = pci_get_device(PCI_VENDOR_ID_S626,
> -			PCI_DEVICE_ID_S626, pdev)) {
> +	/*
> +	 * Require also one of sub pci ids to be defined (see check below),
> +	 * otherwise there will be a clash with Philips SAA7146 media/dvb
> +	 * based cards (they have same vendor:device == 0x1131:0x7146 pair
> +	 * as main S626 cards)
> +	 */
> +	for (ids = s626_pci_table;
> +	     (ids->vendor && (ids->subvendor || ids->subdevice)) && !pdev;
> +	     ids++) {
> +		pdev = pci_get_subsys(ids->vendor, ids->device, ids->subvendor,
> +				      ids->subdevice, NULL);
> +		if (!pdev)
> +			continue;
> +
>  		if (it->options[0] || it->options[1]) {
> +			/* matches requested bus/slot */
>  			if (pdev->bus->number == it->options[0] &&
> -				PCI_SLOT(pdev->devfn) == it->options[1]) {
> -				/* matches requested bus/slot */
> +			    PCI_SLOT(pdev->devfn) == it->options[1])
>  				break;
> -			}
> -		} else {
> -			/* no bus/slot specified */
> -			break;
> +			pci_dev_put(pdev);
> +			pdev = NULL;
>  		}
>  	}
>  	devpriv->pdev = pdev;


This patch looks buggy.  It's changing the logic beyond just checking for 
subvendor/subdevice ids.


[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

  reply	other threads:[~2009-06-17 23:42 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-16 20:01 staging driver s626 clashes with philips SAA7146 media/dvb based cards Herton Ronaldo Krzesinski
2009-06-16 20:51 ` Greg KH
2009-06-16 21:30   ` Herton Ronaldo Krzesinski
2009-06-17 12:26     ` Ian Abbott
2009-06-17 16:45       ` Herton Ronaldo Krzesinski
2009-06-17 18:21         ` Ian Abbott
2009-06-17 23:09           ` Herton Ronaldo Krzesinski
2009-06-17 23:35             ` Frank Mori Hess [this message]
2009-06-18  0:05               ` Herton Ronaldo Krzesinski
2009-06-18  0:24                 ` Herton Ronaldo Krzesinski
     [not found]                 ` <200906172021.51400.fmhess@speakeasy.net>
2009-06-18  0:37                   ` Herton Ronaldo Krzesinski
2009-06-18  7:28                     ` Frank Mori Hess
2009-06-18 17:23                       ` Herton Ronaldo Krzesinski
2009-06-18 17:32                         ` Ian Abbott
2009-06-18 17:43                           ` Herton Ronaldo Krzesinski
2009-06-18 18:25                             ` Ian Abbott
2009-06-18 17:43                         ` Manu Abraham

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=200906171935.14341.fmhess@speakeasy.net \
    --to=fmhess@speakeasy.net \
    --cc=abbotti@mev.co.uk \
    --cc=ds@schleef.org \
    --cc=fmhess@users.sourceforge.net \
    --cc=gpalli@deis.unibo.it \
    --cc=gregkh@suse.de \
    --cc=herton@mandriva.com.br \
    --cc=ian.abbott@mev.co.uk \
    --cc=linux-kernel@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