2004-10-07 23:32:11

by Hanna Linder

[permalink] [raw]
Subject: [PATCH 2.6][9/12] pplus.c replace pci_find_device with pci_get_device


As pci_find_device is going away I've replaced it with pci_get_device.
If someone with a PPC system could test it I would appreciate it.

Thanks.

Hanna Linder
IBM Linux Technology Center

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

---

diff -Nrup linux-2.6.9-rc3-mm3cln/arch/ppc/platforms/pplus.c linux-2.6.9-rc3-mm3patch2/arch/ppc/platforms/pplus.c
--- linux-2.6.9-rc3-mm3cln/arch/ppc/platforms/pplus.c 2004-09-29 20:05:41.000000000 -0700
+++ linux-2.6.9-rc3-mm3patch2/arch/ppc/platforms/pplus.c 2004-10-07 16:17:53.406339280 -0700
@@ -359,7 +359,7 @@ void __init pplus_pib_init(void)
* Perform specific configuration for the Via Tech or
* or Winbond PCI-ISA-Bridge part.
*/
- if ((dev = pci_find_device(PCI_VENDOR_ID_VIA,
+ if ((dev = pci_get_device(PCI_VENDOR_ID_VIA,
PCI_DEVICE_ID_VIA_82C586_1, dev))) {
/*
* PPCBUG does not set the enable bits
@@ -371,7 +371,7 @@ void __init pplus_pib_init(void)
pci_write_config_byte(dev, 0x40, reg);
}

- if ((dev = pci_find_device(PCI_VENDOR_ID_VIA,
+ if ((dev = pci_get_device(PCI_VENDOR_ID_VIA,
PCI_DEVICE_ID_VIA_82C586_2,
dev)) && (dev->devfn = 0x5a)) {
/* Force correct USB interrupt */
@@ -379,7 +379,7 @@ void __init pplus_pib_init(void)
pci_write_config_byte(dev, PCI_INTERRUPT_LINE, dev->irq);
}

- if ((dev = pci_find_device(PCI_VENDOR_ID_WINBOND,
+ if ((dev = pci_get_device(PCI_VENDOR_ID_WINBOND,
PCI_DEVICE_ID_WINBOND_83C553, dev))) {
/* Clear PCI Interrupt Routing Control Register. */
short_reg = 0x0000;
@@ -389,7 +389,7 @@ void __init pplus_pib_init(void)
pci_write_config_byte(dev, 0x43, reg);
}

- if ((dev = pci_find_device(PCI_VENDOR_ID_WINBOND,
+ if ((dev = pci_get_device(PCI_VENDOR_ID_WINBOND,
PCI_DEVICE_ID_WINBOND_82C105, dev))) {
/*
* Disable LEGIRQ mode so PCI INTS are routed


2004-10-09 17:02:10

by Scott Feldman

[permalink] [raw]
Subject: Re: [Kernel-janitors] [PATCH 2.6][9/12] pplus.c replace pci_find_device with pci_get_device

On Thu, 2004-10-07 at 16:26, Hanna Linder wrote:
> - if ((dev = pci_find_device(PCI_VENDOR_ID_WINBOND,
> + if ((dev = pci_get_device(PCI_VENDOR_ID_WINBOND,
> PCI_DEVICE_ID_WINBOND_82C105, dev))) {
> /*
> * Disable LEGIRQ mode so PCI INTS are routed

Missing cleanup at the bottom of func?

if(dev)
pci_dev_put(dev);

-scott

2004-10-12 16:38:40

by Hanna Linder

[permalink] [raw]
Subject: Re: [Kernel-janitors] [PATCH 2.6][9/12] pplus.c replace pci_find_device with pci_get_device

--On Saturday, October 09, 2004 10:02:01 AM -0700 Scott Feldman <[email protected]> wrote:

> On Thu, 2004-10-07 at 16:26, Hanna Linder wrote:
>> - if ((dev = pci_find_device(PCI_VENDOR_ID_WINBOND,
>> + if ((dev = pci_get_device(PCI_VENDOR_ID_WINBOND,
>> PCI_DEVICE_ID_WINBOND_82C105, dev))) {
>> /*
>> * Disable LEGIRQ mode so PCI INTS are routed
>
> Missing cleanup at the bottom of func?
>
> if(dev)
> pci_dev_put(dev);
>
> -scott

Hi Scott,

It doesnt need an explicit dev_put because the pci_dev * is used as the *from pointer
in the pci_get_device call which will do the dev_put automaticaly.

Hanna

2004-10-12 16:48:31

by Hanna Linder

[permalink] [raw]
Subject: Re: [Kernel-janitors] [PATCH 2.6][9/12] pplus.c replace pci_find_device with pci_get_device

--On Saturday, October 09, 2004 10:02:01 AM -0700 Scott Feldman <[email protected]> wrote:

> On Thu, 2004-10-07 at 16:26, Hanna Linder wrote:
>> - if ((dev = pci_find_device(PCI_VENDOR_ID_WINBOND,
>> + if ((dev = pci_get_device(PCI_VENDOR_ID_WINBOND,
>> PCI_DEVICE_ID_WINBOND_82C105, dev))) {
>> /*
>> * Disable LEGIRQ mode so PCI INTS are routed
>
> Missing cleanup at the bottom of func?
>
> if(dev)
> pci_dev_put(dev);
>
> -scott
>
>

OK. I see what you mean now.

Will reroll patches today.

Thanks.

Hanna

2004-10-12 21:40:59

by Hanna Linder

[permalink] [raw]
Subject: Re: [Kernel-janitors] [PATCH 2.6][9/12] pplus.c replace pci_find_device with pci_get_device

--On Saturday, October 09, 2004 10:02:01 AM -0700 Scott Feldman <[email protected]> wrote:
>
> Missing cleanup at the bottom of func?

Here is the new patch:

diff -Nrup linux-2.6.9-rc4-mm1cln/arch/ppc/platforms/pplus.c linux-2.6.9-rc4-mm1patch/arch/ppc/platforms/pplus.c
--- linux-2.6.9-rc4-mm1cln/arch/ppc/platforms/pplus.c 2004-10-12 14:15:28.000000000 -0700
+++ linux-2.6.9-rc4-mm1patch/arch/ppc/platforms/pplus.c 2004-10-12 14:24:44.608410992 -0700
@@ -359,7 +359,7 @@ void __init pplus_pib_init(void)
* Perform specific configuration for the Via Tech or
* or Winbond PCI-ISA-Bridge part.
*/
- if ((dev = pci_find_device(PCI_VENDOR_ID_VIA,
+ if ((dev = pci_get_device(PCI_VENDOR_ID_VIA,
PCI_DEVICE_ID_VIA_82C586_1, dev))) {
/*
* PPCBUG does not set the enable bits
@@ -371,7 +371,7 @@ void __init pplus_pib_init(void)
pci_write_config_byte(dev, 0x40, reg);
}

- if ((dev = pci_find_device(PCI_VENDOR_ID_VIA,
+ if ((dev = pci_get_device(PCI_VENDOR_ID_VIA,
PCI_DEVICE_ID_VIA_82C586_2,
dev)) && (dev->devfn = 0x5a)) {
/* Force correct USB interrupt */
@@ -379,7 +379,7 @@ void __init pplus_pib_init(void)
pci_write_config_byte(dev, PCI_INTERRUPT_LINE, dev->irq);
}

- if ((dev = pci_find_device(PCI_VENDOR_ID_WINBOND,
+ if ((dev = pci_get_device(PCI_VENDOR_ID_WINBOND,
PCI_DEVICE_ID_WINBOND_83C553, dev))) {
/* Clear PCI Interrupt Routing Control Register. */
short_reg = 0x0000;
@@ -389,7 +389,7 @@ void __init pplus_pib_init(void)
pci_write_config_byte(dev, 0x43, reg);
}

- if ((dev = pci_find_device(PCI_VENDOR_ID_WINBOND,
+ if ((dev = pci_get_device(PCI_VENDOR_ID_WINBOND,
PCI_DEVICE_ID_WINBOND_82C105, dev))) {
/*
* Disable LEGIRQ mode so PCI INTS are routed
@@ -401,6 +401,7 @@ void __init pplus_pib_init(void)
dev->irq = 14;
pci_write_config_byte(dev, PCI_INTERRUPT_LINE, dev->irq);
}
+ pci_dev_put(dev);
}

void __init pplus_set_VIA_IDE_legacy(void)