diff mbox

[v2,03/16] pcmcia: Use common pci_stop_and_remove_bus_device()

Message ID 20120817233600.10973.11841.stgit@bhelgaas.mtv.corp.google.com (mailing list archive)
State New, archived
Delegated to: Bjorn Helgaas
Headers show

Commit Message

Bjorn Helgaas Aug. 17, 2012, 11:36 p.m. UTC
Use pci_stop_and_remove_bus_device() like most other hotplug drivers
rather than the special-purpose "behind_bridge" variant.  This just
means we have to iterate through all the devices downstream of the
bridge ourselves, which is the same thing pci_stop_behind_bridge()
did.

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
---
 drivers/pcmcia/cardbus.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)


--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Yinghai Lu Aug. 18, 2012, 12:58 a.m. UTC | #1
On Fri, Aug 17, 2012 at 4:36 PM, Bjorn Helgaas <bhelgaas@google.com> wrote:
> Use pci_stop_and_remove_bus_device() like most other hotplug drivers
> rather than the special-purpose "behind_bridge" variant.  This just
> means we have to iterate through all the devices downstream of the
> bridge ourselves, which is the same thing pci_stop_behind_bridge()
> did.
>
> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
> ---
>  drivers/pcmcia/cardbus.c |    7 +++++--
>  1 files changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/pcmcia/cardbus.c b/drivers/pcmcia/cardbus.c
> index 24caeaf..94f87b5 100644
> --- a/drivers/pcmcia/cardbus.c
> +++ b/drivers/pcmcia/cardbus.c
> @@ -106,7 +106,10 @@ int __ref cb_alloc(struct pcmcia_socket *s)
>  void cb_free(struct pcmcia_socket *s)
>  {
>         struct pci_dev *bridge = s->cb_dev;
> +       struct pci_bus *bus = bridge->subordinate;
> +       struct pci_dev *dev, *tmp;
>
> -       if (bridge)
> -               pci_stop_and_remove_behind_bridge(bridge);
> +       if (bus)
> +               list_for_each_entry_safe(dev, tmp, &bus->devices, bus_list)
> +                       pci_stop_and_remove_bus_device(dev);
>  }
>

original looks like bridge could be NULL.

Yinghai
--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Bjorn Helgaas Aug. 20, 2012, 2:46 p.m. UTC | #2
On Fri, Aug 17, 2012 at 5:58 PM, Yinghai Lu <yinghai@kernel.org> wrote:
> On Fri, Aug 17, 2012 at 4:36 PM, Bjorn Helgaas <bhelgaas@google.com> wrote:
>> Use pci_stop_and_remove_bus_device() like most other hotplug drivers
>> rather than the special-purpose "behind_bridge" variant.  This just
>> means we have to iterate through all the devices downstream of the
>> bridge ourselves, which is the same thing pci_stop_behind_bridge()
>> did.
>>
>> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
>> ---
>>  drivers/pcmcia/cardbus.c |    7 +++++--
>>  1 files changed, 5 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/pcmcia/cardbus.c b/drivers/pcmcia/cardbus.c
>> index 24caeaf..94f87b5 100644
>> --- a/drivers/pcmcia/cardbus.c
>> +++ b/drivers/pcmcia/cardbus.c
>> @@ -106,7 +106,10 @@ int __ref cb_alloc(struct pcmcia_socket *s)
>>  void cb_free(struct pcmcia_socket *s)
>>  {
>>         struct pci_dev *bridge = s->cb_dev;
>> +       struct pci_bus *bus = bridge->subordinate;
>> +       struct pci_dev *dev, *tmp;
>>
>> -       if (bridge)
>> -               pci_stop_and_remove_behind_bridge(bridge);
>> +       if (bus)
>> +               list_for_each_entry_safe(dev, tmp, &bus->devices, bus_list)
>> +                       pci_stop_and_remove_bus_device(dev);
>>  }
>>
>
> original looks like bridge could be NULL.

You're right, thanks!  I fixed that.
--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/pcmcia/cardbus.c b/drivers/pcmcia/cardbus.c
index 24caeaf..94f87b5 100644
--- a/drivers/pcmcia/cardbus.c
+++ b/drivers/pcmcia/cardbus.c
@@ -106,7 +106,10 @@  int __ref cb_alloc(struct pcmcia_socket *s)
 void cb_free(struct pcmcia_socket *s)
 {
 	struct pci_dev *bridge = s->cb_dev;
+	struct pci_bus *bus = bridge->subordinate;
+	struct pci_dev *dev, *tmp;
 
-	if (bridge)
-		pci_stop_and_remove_behind_bridge(bridge);
+	if (bus)
+		list_for_each_entry_safe(dev, tmp, &bus->devices, bus_list)
+			pci_stop_and_remove_bus_device(dev);
 }