2004-09-29 20:54:41

by Hanna Linder

[permalink] [raw]
Subject: [PATCH 2.6.9-rc2-mm4 bttv-driver.c][4/8] convert pci_find_device to pci_dev_present


As pci_find_device is going away need to replace it. This file did not use the dev returned
from pci_find_device so is replaceable by pci_dev_present. I was not able to test it
as I do not have the hardware.

Hanna Linder
IBM Linux Technology Center

Signed-off-by: Hanna Linder <[email protected]>

diff -Nrup linux-2.6.9-rc2-mm4cln/drivers/media/video/bttv-driver.c linux-2.6.9-rc2-mm4patch/drivers/media/video/bttv-driver.c
--- linux-2.6.9-rc2-mm4cln/drivers/media/video/bttv-driver.c 2004-09-28 14:58:35.000000000 -0700
+++ linux-2.6.9-rc2-mm4patch/drivers/media/video/bttv-driver.c 2004-09-29 13:08:59.369697520 -0700
@@ -4012,6 +4012,10 @@ static int bttv_init_module(void)
{
int rc;
bttv_num = 0;
+ static struct pci_device_id cx2388x[] {
+ { PCI_DEVICE(0x14f1, 0x8800) },
+ { },
+ };

printk(KERN_INFO "bttv: driver version %d.%d.%d loaded\n",
(BTTV_VERSION_CODE >> 16) & 0xff,
@@ -4036,7 +4040,7 @@ static int bttv_init_module(void)
rc = pci_module_init(&bttv_pci_driver);
if (-ENODEV == rc) {
/* plenty of people trying to use bttv for the cx2388x ... */
- if (NULL != pci_find_device(0x14f1, 0x8800, NULL))
+ if (pci_dev_present(cx2388x))
printk("bttv doesn't support your Conexant 2388x card.\n");
}
return rc;


2004-09-29 21:03:54

by Christoph Hellwig

[permalink] [raw]
Subject: Re: [PATCH 2.6.9-rc2-mm4 bttv-driver.c][4/8] convert pci_find_device to pci_dev_present

On Wed, Sep 29, 2004 at 01:55:22PM -0700, Hanna Linder wrote:
>
> As pci_find_device is going away need to replace it. This file did not use the dev returned
> from pci_find_device so is replaceable by pci_dev_present. I was not able to test it
> as I do not have the hardware.

I think this check should just go away completely.

We don't have such silly warnings in any other driver.

2004-09-29 21:12:36

by Greg KH

[permalink] [raw]
Subject: Re: [PATCH 2.6.9-rc2-mm4 bttv-driver.c][4/8] convert pci_find_device to pci_dev_present

On Wed, Sep 29, 2004 at 10:03:44PM +0100, Christoph Hellwig wrote:
> On Wed, Sep 29, 2004 at 01:55:22PM -0700, Hanna Linder wrote:
> >
> > As pci_find_device is going away need to replace it. This file did not use the dev returned
> > from pci_find_device so is replaceable by pci_dev_present. I was not able to test it
> > as I do not have the hardware.
>
> I think this check should just go away completely.

Good point. Especially as pci_module_init() can never return -ENODEV
anymore :)

Hanna, care to respin this patch?

thanks,

greg k-h

2004-09-29 21:43:14

by Hanna Linder

[permalink] [raw]
Subject: Re: [PATCH 2.6.9-rc2-mm4 bttv-driver.c][4/8] convert pci_find_device to pci_dev_present

--On Wednesday, September 29, 2004 02:11:35 PM -0700 Greg KH <[email protected]> wrote:
> On Wed, Sep 29, 2004 at 10:03:44PM +0100, Christoph Hellwig wrote:
>> On Wed, Sep 29, 2004 at 01:55:22PM -0700, Hanna Linder wrote:
>> >
>> > As pci_find_device is going away need to replace it. This file did not use the dev returned
>> > from pci_find_device so is replaceable by pci_dev_present. I was not able to test it
>> > as I do not have the hardware.
>>
>> I think this check should just go away completely.
>
> Good point. Especially as pci_module_init() can never return -ENODEV
> anymore :)
>
> Hanna, care to respin this patch?

Here it is, compile tested this time...

Signed-off-by: Hanna Linder <[email protected]>

diff -Nrup linux-2.6.9-rc2-mm4cln/drivers/media/video/bttv-driver.c linux-2.6.9-rc2-mm4patch2/drivers/media/video/bttv-driver.c
--- linux-2.6.9-rc2-mm4cln/drivers/media/video/bttv-driver.c 2004-09-28 14:58:35.000000000 -0700
+++ linux-2.6.9-rc2-mm4patch2/drivers/media/video/bttv-driver.c 2004-09-29 14:30:38.000000000 -0700
@@ -4010,7 +4010,6 @@ static struct pci_driver bttv_pci_driver

static int bttv_init_module(void)
{
- int rc;
bttv_num = 0;

printk(KERN_INFO "bttv: driver version %d.%d.%d loaded\n",
@@ -4033,13 +4032,7 @@ static int bttv_init_module(void)
bttv_check_chipset();

bus_register(&bttv_sub_bus_type);
- rc = pci_module_init(&bttv_pci_driver);
- if (-ENODEV == rc) {
- /* plenty of people trying to use bttv for the cx2388x ... */
- if (NULL != pci_find_device(0x14f1, 0x8800, NULL))
- printk("bttv doesn't support your Conexant 2388x card.\n");
- }
- return rc;
+ return(pci_module_init(&bttv_pci_driver));
}

static void bttv_cleanup_module(void)


2004-09-29 22:29:45

by Matthew Wilcox

[permalink] [raw]
Subject: Re: [Kernel-janitors] Re: [PATCH 2.6.9-rc2-mm4 bttv-driver.c][4/8] convert pci_find_device to pci_dev_present

On Wed, Sep 29, 2004 at 02:43:38PM -0700, Hanna Linder wrote:
> + return(pci_module_init(&bttv_pci_driver));

Why the extra brackets? I see their use for

return (a == b);

but

return pci_module_init(&bttv_pci_driver);

isn't at all ambiguous.

--
"Next the statesmen will invent cheap lies, putting the blame upon
the nation that is attacked, and every man will be glad of those
conscience-soothing falsities, and will diligently study them, and refuse
to examine any refutations of them; and thus he will by and by convince
himself that the war is just, and will thank God for the better sleep
he enjoys after this process of grotesque self-deception." -- Mark Twain

2004-09-29 22:32:33

by Tonnerre

[permalink] [raw]
Subject: Re: [PATCH 2.6.9-rc2-mm4 bttv-driver.c][4/8] convert pci_find_device to pci_dev_present

Salut,

On Wed, Sep 29, 2004 at 10:03:44PM +0100, Christoph Hellwig wrote:
> I think this check should just go away completely.
>
> We don't have such silly warnings in any other driver.

Kraxel introduced this check because of the confusion with the "old"
and "new" WinTV cards. The older one had a bt848 chip, the newer one a
connexant 878, and only the older one was supported by Linux.

Now that we support both, this printk is rather counterproductive.

Tonnerre


Attachments:
(No filename) (481.00 B)
signature.asc (189.00 B)
Digital signature
Download all attachments

2004-09-29 22:41:40

by Hanna Linder

[permalink] [raw]
Subject: Re: [Kernel-janitors] Re: [PATCH 2.6.9-rc2-mm4 bttv-driver.c][4/8] convert pci_find_device to pci_dev_present

--On Wednesday, September 29, 2004 11:28:25 PM +0100 Matthew Wilcox <[email protected]> wrote:

> On Wed, Sep 29, 2004 at 02:43:38PM -0700, Hanna Linder wrote:
>> + return(pci_module_init(&bttv_pci_driver));
>
> Why the extra brackets? I see their use for

I was already corrected offline. Greg is going to fix this before he applies it.

Thanks.

Hanna

2004-09-30 08:40:44

by Gerd Knorr

[permalink] [raw]
Subject: Re: [PATCH 2.6.9-rc2-mm4 bttv-driver.c][4/8] convert pci_find_device to pci_dev_present

On Thu, Sep 30, 2004 at 12:23:53AM +0200, Tonnerre wrote:
> Salut,
>
> On Wed, Sep 29, 2004 at 10:03:44PM +0100, Christoph Hellwig wrote:
> > I think this check should just go away completely.
> > We don't have such silly warnings in any other driver.
>
> Kraxel introduced this check because of the confusion with the "old"
> and "new" WinTV cards. The older one had a bt848 chip, the newer one a
> connexant 878, and only the older one was supported by Linux.

Yep, that was the reason. It's pretty much obsolete these days through
as we have a working (well, sort of, depending on the tv norm sound may
be a problem ...) driver for these cards in mainline. Just dropping
that now is perfectly fine.

Gerd

--
return -ENOSIG;