linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] PCI,acpiphp: use generic pci_hp_add_bridge()
@ 2013-04-01  9:22 Yijing Wang
  2013-04-01  9:22 ` [PATCH 2/3] PCI: acpiphp: remove unused function acpiphp_max_busnr Yijing Wang
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Yijing Wang @ 2013-04-01  9:22 UTC (permalink / raw)
  To: Bjorn Helgaas, Yinghai Lu
  Cc: Kenji Kaneshige, linux-pci, linux-kernel, Rafael, Hanjun Guo,
	jiang.liu, Yijing Wang

Use pci_hp_add_bridge() like most other hotplug drivers
rather than call pci_scan_bridge() directly.

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 drivers/pci/hotplug/acpiphp_glue.c |   24 ++++++++++--------------
 1 files changed, 10 insertions(+), 14 deletions(-)

diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c
index 270fdba..7d7ed3f 100644
--- a/drivers/pci/hotplug/acpiphp_glue.c
+++ b/drivers/pci/hotplug/acpiphp_glue.c
@@ -811,7 +811,7 @@ static int __ref enable_device(struct acpiphp_slot *slot)
 	struct pci_bus *bus = slot->bridge->pci_bus;
 	struct acpiphp_func *func;
 	int retval = 0;
-	int num, max, pass;
+	int num;
 	acpi_status status;
 
 	if (slot->flags & SLOT_ENABLED)
@@ -827,22 +827,18 @@ static int __ref enable_device(struct acpiphp_slot *slot)
 		goto err_exit;
 	}
 
-	max = acpiphp_max_busnr(bus);
-	for (pass = 0; pass < 2; pass++) {
-		list_for_each_entry(dev, &bus->devices, bus_list) {
-			if (PCI_SLOT(dev->devfn) != slot->device)
+	list_for_each_entry(dev, &bus->devices, bus_list) {
+		if (PCI_SLOT(dev->devfn) != slot->device)
 				continue;
-			if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE ||
-			    dev->hdr_type == PCI_HEADER_TYPE_CARDBUS) {
-				max = pci_scan_bridge(bus, dev, max, pass);
-				if (pass && dev->subordinate) {
-					check_hotplug_bridge(slot, dev);
-					pci_bus_size_bridges(dev->subordinate);
-				}
-			}
+		if ((dev->hdr_type == PCI_HEADER_TYPE_BRIDGE) ||
+				(dev->hdr_type == PCI_HEADER_TYPE_CARDBUS))
+			pci_hp_add_bridge(dev);
+		if (dev->subordinate) {
+			check_hotplug_bridge(slot, dev);
+			pci_bus_size_bridges(dev->subordinate);
 		}
 	}
-
+
 	pci_bus_assign_resources(bus);
 	acpiphp_sanitize_bus(bus);
 	acpiphp_set_hpp_values(bus);
-- 
1.7.1



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/3] PCI: acpiphp: remove unused function acpiphp_max_busnr
  2013-04-01  9:22 [PATCH 1/3] PCI,acpiphp: use generic pci_hp_add_bridge() Yijing Wang
@ 2013-04-01  9:22 ` Yijing Wang
  2013-04-01  9:22 ` [PATCH 3/3] PCI, pciehp: remove check for configure display devices Yijing Wang
  2013-04-16  1:49 ` [PATCH 1/3] PCI,acpiphp: use generic pci_hp_add_bridge() Yijing Wang
  2 siblings, 0 replies; 6+ messages in thread
From: Yijing Wang @ 2013-04-01  9:22 UTC (permalink / raw)
  To: Bjorn Helgaas, Yinghai Lu
  Cc: Kenji Kaneshige, linux-pci, linux-kernel, Rafael, Hanjun Guo,
	jiang.liu, Yijing Wang

Clean up unuse function acpiphp_max_busnr() code.

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 drivers/pci/hotplug/acpiphp_glue.c |   30 ------------------------------
 1 files changed, 0 insertions(+), 30 deletions(-)

diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c
index 7d7ed3f..52e91bb 100644
--- a/drivers/pci/hotplug/acpiphp_glue.c
+++ b/drivers/pci/hotplug/acpiphp_glue.c
@@ -680,36 +680,6 @@ static int power_off_slot(struct acpiphp_slot *slot)
 	return retval;
 }
 
-
-
-/**
- * acpiphp_max_busnr - return the highest reserved bus number under the given bus.
- * @bus: bus to start search with
- */
-static unsigned char acpiphp_max_busnr(struct pci_bus *bus)
-{
-	struct list_head *tmp;
-	unsigned char max, n;
-
-	/*
-	 * pci_bus_max_busnr will return the highest
-	 * reserved busnr for all these children.
-	 * that is equivalent to the bus->subordinate
-	 * value.  We don't want to use the parent's
-	 * bus->subordinate value because it could have
-	 * padding in it.
-	 */
-	max = bus->busn_res.start;
-
-	list_for_each(tmp, &bus->children) {
-		n = pci_bus_max_busnr(pci_bus_b(tmp));
-		if (n > max)
-			max = n;
-	}
-	return max;
-}
-
-
 /**
  * acpiphp_bus_add - add a new bus to acpi subsystem
  * @func: acpiphp_func of the bridge
-- 
1.7.1



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 3/3] PCI, pciehp: remove check for configure display devices
  2013-04-01  9:22 [PATCH 1/3] PCI,acpiphp: use generic pci_hp_add_bridge() Yijing Wang
  2013-04-01  9:22 ` [PATCH 2/3] PCI: acpiphp: remove unused function acpiphp_max_busnr Yijing Wang
@ 2013-04-01  9:22 ` Yijing Wang
  2013-04-16  1:49 ` [PATCH 1/3] PCI,acpiphp: use generic pci_hp_add_bridge() Yijing Wang
  2 siblings, 0 replies; 6+ messages in thread
From: Yijing Wang @ 2013-04-01  9:22 UTC (permalink / raw)
  To: Bjorn Helgaas, Yinghai Lu
  Cc: Kenji Kaneshige, linux-pci, linux-kernel, Rafael, Hanjun Guo,
	jiang.liu, Yijing Wang

Commit ac81860 removed unnecessary check for hotplug of display
device. Currently pciehp is allowd to hotplug display device,
So we also configure display device when hot added.

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 drivers/pci/hotplug/pciehp_pci.c |    6 +-----
 1 files changed, 1 insertions(+), 5 deletions(-)

diff --git a/drivers/pci/hotplug/pciehp_pci.c b/drivers/pci/hotplug/pciehp_pci.c
index aac7a40..c9d2df3 100644
--- a/drivers/pci/hotplug/pciehp_pci.c
+++ b/drivers/pci/hotplug/pciehp_pci.c
@@ -64,12 +64,8 @@ int pciehp_configure_device(struct slot *p_slot)
 
 	pci_assign_unassigned_bridge_resources(bridge);
 
-	list_for_each_entry(dev, &parent->devices, bus_list) {
-		if ((dev->class >> 16) == PCI_BASE_CLASS_DISPLAY)
-			continue;
-
+	list_for_each_entry(dev, &parent->devices, bus_list)
 		pci_configure_slot(dev);
-	}
 
 	pci_bus_add_devices(parent);
 
-- 
1.7.1



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/3] PCI,acpiphp: use generic pci_hp_add_bridge()
  2013-04-01  9:22 [PATCH 1/3] PCI,acpiphp: use generic pci_hp_add_bridge() Yijing Wang
  2013-04-01  9:22 ` [PATCH 2/3] PCI: acpiphp: remove unused function acpiphp_max_busnr Yijing Wang
  2013-04-01  9:22 ` [PATCH 3/3] PCI, pciehp: remove check for configure display devices Yijing Wang
@ 2013-04-16  1:49 ` Yijing Wang
  2013-04-16  3:55   ` Yinghai Lu
  2 siblings, 1 reply; 6+ messages in thread
From: Yijing Wang @ 2013-04-16  1:49 UTC (permalink / raw)
  To: Bjorn Helgaas, Yinghai Lu
  Cc: Yijing Wang, Kenji Kaneshige, linux-pci, linux-kernel, Rafael,
	Hanjun Guo, jiang.liu

Hi Yinghai,
   Any comments about this patch? I searched the code history and found
you introduced pci_hp_add_bridge() function at commit a8e4b9c10. In your
patchset use pci_hp_add_bridge() for all pci hotplug drivers except acpiphp.
So I use pci_hp_add_bridge() in acpiphp instead of using pci_scan_bridge()
directly. I would appreciate if you can give some suggestions.

Thanks!
Yijing.

On 2013/4/1 17:22, Yijing Wang wrote:
> Use pci_hp_add_bridge() like most other hotplug drivers
> rather than call pci_scan_bridge() directly.
> 
> Signed-off-by: Yijing Wang <wangyijing@huawei.com>
> ---
>  drivers/pci/hotplug/acpiphp_glue.c |   24 ++++++++++--------------
>  1 files changed, 10 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c
> index 270fdba..7d7ed3f 100644
> --- a/drivers/pci/hotplug/acpiphp_glue.c
> +++ b/drivers/pci/hotplug/acpiphp_glue.c
> @@ -811,7 +811,7 @@ static int __ref enable_device(struct acpiphp_slot *slot)
>  	struct pci_bus *bus = slot->bridge->pci_bus;
>  	struct acpiphp_func *func;
>  	int retval = 0;
> -	int num, max, pass;
> +	int num;
>  	acpi_status status;
>  
>  	if (slot->flags & SLOT_ENABLED)
> @@ -827,22 +827,18 @@ static int __ref enable_device(struct acpiphp_slot *slot)
>  		goto err_exit;
>  	}
>  
> -	max = acpiphp_max_busnr(bus);
> -	for (pass = 0; pass < 2; pass++) {
> -		list_for_each_entry(dev, &bus->devices, bus_list) {
> -			if (PCI_SLOT(dev->devfn) != slot->device)
> +	list_for_each_entry(dev, &bus->devices, bus_list) {
> +		if (PCI_SLOT(dev->devfn) != slot->device)
>  				continue;
> -			if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE ||
> -			    dev->hdr_type == PCI_HEADER_TYPE_CARDBUS) {
> -				max = pci_scan_bridge(bus, dev, max, pass);
> -				if (pass && dev->subordinate) {
> -					check_hotplug_bridge(slot, dev);
> -					pci_bus_size_bridges(dev->subordinate);
> -				}
> -			}
> +		if ((dev->hdr_type == PCI_HEADER_TYPE_BRIDGE) ||
> +				(dev->hdr_type == PCI_HEADER_TYPE_CARDBUS))
> +			pci_hp_add_bridge(dev);
> +		if (dev->subordinate) {
> +			check_hotplug_bridge(slot, dev);
> +			pci_bus_size_bridges(dev->subordinate);
>  		}
>  	}
> -
> +
>  	pci_bus_assign_resources(bus);
>  	acpiphp_sanitize_bus(bus);
>  	acpiphp_set_hpp_values(bus);
> 


-- 
Thanks!
Yijing


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/3] PCI,acpiphp: use generic pci_hp_add_bridge()
  2013-04-16  1:49 ` [PATCH 1/3] PCI,acpiphp: use generic pci_hp_add_bridge() Yijing Wang
@ 2013-04-16  3:55   ` Yinghai Lu
  2013-04-16  6:43     ` Yijing Wang
  0 siblings, 1 reply; 6+ messages in thread
From: Yinghai Lu @ 2013-04-16  3:55 UTC (permalink / raw)
  To: Yijing Wang
  Cc: Bjorn Helgaas, Kenji Kaneshige, linux-pci@vger.kernel.org,
	Linux Kernel Mailing List, Rafael, Hanjun Guo, Jiang Liu

>
> On 2013/4/1 17:22, Yijing Wang wrote:
>> Use pci_hp_add_bridge() like most other hotplug drivers
>> rather than call pci_scan_bridge() directly.
>>
>> Signed-off-by: Yijing Wang <wangyijing@huawei.com>
>> ---
>>  drivers/pci/hotplug/acpiphp_glue.c |   24 ++++++++++--------------
>>  1 files changed, 10 insertions(+), 14 deletions(-)
>>
>> diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c
>> index 270fdba..7d7ed3f 100644
>> --- a/drivers/pci/hotplug/acpiphp_glue.c
>> +++ b/drivers/pci/hotplug/acpiphp_glue.c
>> @@ -811,7 +811,7 @@ static int __ref enable_device(struct acpiphp_slot *slot)
>>       struct pci_bus *bus = slot->bridge->pci_bus;
>>       struct acpiphp_func *func;
>>       int retval = 0;
>> -     int num, max, pass;
>> +     int num;
>>       acpi_status status;
>>
>>       if (slot->flags & SLOT_ENABLED)
>> @@ -827,22 +827,18 @@ static int __ref enable_device(struct acpiphp_slot *slot)
>>               goto err_exit;
>>       }
>>
>> -     max = acpiphp_max_busnr(bus);
>> -     for (pass = 0; pass < 2; pass++) {
>> -             list_for_each_entry(dev, &bus->devices, bus_list) {
>> -                     if (PCI_SLOT(dev->devfn) != slot->device)
>> +     list_for_each_entry(dev, &bus->devices, bus_list) {
>> +             if (PCI_SLOT(dev->devfn) != slot->device)
>>                               continue;
>> -                     if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE ||
>> -                         dev->hdr_type == PCI_HEADER_TYPE_CARDBUS) {
>> -                             max = pci_scan_bridge(bus, dev, max, pass);
>> -                             if (pass && dev->subordinate) {
>> -                                     check_hotplug_bridge(slot, dev);
>> -                                     pci_bus_size_bridges(dev->subordinate);
>> -                             }
>> -                     }
>> +             if ((dev->hdr_type == PCI_HEADER_TYPE_BRIDGE) ||
>> +                             (dev->hdr_type == PCI_HEADER_TYPE_CARDBUS))
>> +                     pci_hp_add_bridge(dev);
>> +             if (dev->subordinate) {
>> +                     check_hotplug_bridge(slot, dev);
>> +                     pci_bus_size_bridges(dev->subordinate);
>>               }
>>       }

On Mon, Apr 15, 2013 at 6:49 PM, Yijing Wang <wangyijing@huawei.com> wrote:
> Hi Yinghai,
>    Any comments about this patch? I searched the code history and found
> you introduced pci_hp_add_bridge() function at commit a8e4b9c10. In your
> patchset use pci_hp_add_bridge() for all pci hotplug drivers except acpiphp.
> So I use pci_hp_add_bridge() in acpiphp instead of using pci_scan_bridge()
> directly. I would appreciate if you can give some suggestions.

There is one problem in your patch.
max start value get change. before your patch max is the maximum value
of bus all children...
   now it is change bus  start value.

looks like old code try to handle the case that we already some
children on that bus.

Last time i did not change it, because i think it only is ready after
busn_res alloc patchset
is merged.

in pci-mini summit of last year, Bjorn asked Linus about that
patchset, and Linus said it is
risky and it is not worthy to merge it .

so assume we should hold your patch as it could cause some regression.

Thanks

Yinghai

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/3] PCI,acpiphp: use generic pci_hp_add_bridge()
  2013-04-16  3:55   ` Yinghai Lu
@ 2013-04-16  6:43     ` Yijing Wang
  0 siblings, 0 replies; 6+ messages in thread
From: Yijing Wang @ 2013-04-16  6:43 UTC (permalink / raw)
  To: Yinghai Lu
  Cc: Bjorn Helgaas, Kenji Kaneshige, linux-pci@vger.kernel.org,
	Linux Kernel Mailing List, Rafael, Hanjun Guo, Jiang Liu

> On Mon, Apr 15, 2013 at 6:49 PM, Yijing Wang <wangyijing@huawei.com> wrote:
>> Hi Yinghai,
>>    Any comments about this patch? I searched the code history and found
>> you introduced pci_hp_add_bridge() function at commit a8e4b9c10. In your
>> patchset use pci_hp_add_bridge() for all pci hotplug drivers except acpiphp.
>> So I use pci_hp_add_bridge() in acpiphp instead of using pci_scan_bridge()
>> directly. I would appreciate if you can give some suggestions.

Hi Yinghai,
   Thanks for your review and comments very much!

> 
> There is one problem in your patch.
> max start value get change. before your patch max is the maximum value
> of bus all children...
>    now it is change bus  start value.

Thank you for reminding. Now I noticed this detail.(:
I will drop these pathes.

Thanks!
Yijing.

> 
> looks like old code try to handle the case that we already some
> children on that bus.
> 
> Last time i did not change it, because i think it only is ready after
> busn_res alloc patchset
> is merged.
> 
> in pci-mini summit of last year, Bjorn asked Linus about that
> patchset, and Linus said it is
> risky and it is not worthy to merge it .
> 
> so assume we should hold your patch as it could cause some regression.
> 
> Thanks
> 
> Yinghai
> 
> .
> 


-- 
Thanks!
Yijing


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2013-04-16  6:44 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-01  9:22 [PATCH 1/3] PCI,acpiphp: use generic pci_hp_add_bridge() Yijing Wang
2013-04-01  9:22 ` [PATCH 2/3] PCI: acpiphp: remove unused function acpiphp_max_busnr Yijing Wang
2013-04-01  9:22 ` [PATCH 3/3] PCI, pciehp: remove check for configure display devices Yijing Wang
2013-04-16  1:49 ` [PATCH 1/3] PCI,acpiphp: use generic pci_hp_add_bridge() Yijing Wang
2013-04-16  3:55   ` Yinghai Lu
2013-04-16  6:43     ` Yijing Wang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).