2004-10-20 18:56:02

by Hanna Linder

[permalink] [raw]
Subject: [RFT 2.6] generic.c: replace pci_find_device with pci_get_device

As pci_find_device is going away soon I have converted this file to use
pci_get_device instead. I have compile tested it. If anyone has this hardware
and could test it that would be great.

Hanna Linder
IBM Linux Technology Center

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

diff -Nrup linux-2.6.9cln/drivers/char/agp/generic.c linux-2.6.9patch/drivers/char/agp/generic.c
--- linux-2.6.9cln/drivers/char/agp/generic.c 2004-10-18 16:35:52.000000000 -0700
+++ linux-2.6.9patch/drivers/char/agp/generic.c 2004-10-18 17:20:56.000000000 -0700
@@ -507,7 +507,7 @@ u32 agp_collect_device_status(u32 mode,
u32 tmp;
u32 agp3;

- while ((device = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, device)) != NULL) {
+ for_each_pci_dev(device) {
cap_ptr = pci_find_capability(device, PCI_CAP_ID_AGP);
if (!cap_ptr)
continue;
@@ -551,7 +551,7 @@ void agp_device_command(u32 command, int
if (agp_v3)
mode *= 4;

- while ((device = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, device)) != NULL) {
+ for_each_pci_dev(device) {
u8 agp = pci_find_capability(device, PCI_CAP_ID_AGP);
if (!agp)
continue;



2004-10-20 22:13:18

by Matthew Wilcox

[permalink] [raw]
Subject: Re: [KJ] [RFT 2.6] generic.c: replace pci_find_device with pci_get_device

On Wed, Oct 20, 2004 at 11:51:17AM -0700, Hanna Linder wrote:
> As pci_find_device is going away soon I have converted this file to use
> pci_get_device instead. I have compile tested it. If anyone has this hardware
> and could test it that would be great.

Looks to me like this is a broken interface. We almost certainly want to
pass the agp_device to agp_collect_device_status and agp_device_command,
as noted in the comment to agp_collect_device_status. DaveJ?

--
"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-10-20 22:36:20

by Dave Jones

[permalink] [raw]
Subject: Re: [KJ] [RFT 2.6] generic.c: replace pci_find_device with pci_get_device

On Wed, Oct 20, 2004 at 11:02:42PM +0100, Matthew Wilcox wrote:
> On Wed, Oct 20, 2004 at 11:51:17AM -0700, Hanna Linder wrote:
> > As pci_find_device is going away soon I have converted this file to use
> > pci_get_device instead. I have compile tested it. If anyone has this hardware
> > and could test it that would be great.
>
> Looks to me like this is a broken interface. We almost certainly want to
> pass the agp_device to agp_collect_device_status and agp_device_command,
> as noted in the comment to agp_collect_device_status. DaveJ?

It ain't pretty, but I probably won't find time to clean that up
any time soon. This doesn't impact Hanna's patch however.

Dave