Patchwork [v3,11/22] PCI, drm: Kill pci_root_buses in alpha hose setting

login
register
mail settings
Submitter Yinghai Lu
Date Jan. 27, 2013, 7:23 p.m.
Message ID <1359314629-18651-12-git-send-email-yinghai@kernel.org>
Download mbox | patch
Permalink /patch/216042/
State Superseded
Headers show

Comments

Yinghai Lu - Jan. 27, 2013, 7:23 p.m.
Replace that with hotplug-safe version.

Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Cc: David Airlie <airlied@linux.ie>
Cc: dri-devel@lists.freedesktop.org
---
 drivers/gpu/drm/drm_fops.c |   10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
Yijing Wang - Jan. 28, 2013, 3:21 a.m.
On 2013/1/28 3:23, Yinghai Lu wrote:
> Replace that with hotplug-safe version.
> 
> Signed-off-by: Yinghai Lu <yinghai@kernel.org>
> Cc: David Airlie <airlied@linux.ie>
> Cc: dri-devel@lists.freedesktop.org
> ---
>  drivers/gpu/drm/drm_fops.c |   10 +++++++---
>  1 file changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_fops.c b/drivers/gpu/drm/drm_fops.c
> index 133b413..b92a9cc 100644
> --- a/drivers/gpu/drm/drm_fops.c
> +++ b/drivers/gpu/drm/drm_fops.c
> @@ -356,9 +356,13 @@ static int drm_open_helper(struct inode *inode, struct file *filp,
>  			pci_dev_put(pci_dev);
>  		}
>  		if (!dev->hose) {
> -			struct pci_bus *b = pci_bus_b(pci_root_buses.next);
> -			if (b)
> -				dev->hose = b->sysdata;
> +			struct pci_host_bridge *host_bridge;
> +
> +			host_bridge = pci_next_host_bridge(NULL);

pci_get_next_host_bridge() ?

> +			if (host_bridge) {
> +				dev->hose = host_bridge->bus->sysdata;
> +				put_device(&host_bridge->dev);
> +			}
>  		}
>  	}
>  #endif
>
Yinghai Lu - Jan. 28, 2013, 3:35 a.m.
On Sun, Jan 27, 2013 at 7:21 PM, Yijing Wang <wangyijing@huawei.com> wrote:
> On 2013/1/28 3:23, Yinghai Lu wrote:
>> Replace that with hotplug-safe version.
>>
>> Signed-off-by: Yinghai Lu <yinghai@kernel.org>
>> Cc: David Airlie <airlied@linux.ie>
>> Cc: dri-devel@lists.freedesktop.org
>> ---
>>  drivers/gpu/drm/drm_fops.c |   10 +++++++---
>>  1 file changed, 7 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/drm_fops.c b/drivers/gpu/drm/drm_fops.c
>> index 133b413..b92a9cc 100644
>> --- a/drivers/gpu/drm/drm_fops.c
>> +++ b/drivers/gpu/drm/drm_fops.c
>> @@ -356,9 +356,13 @@ static int drm_open_helper(struct inode *inode, struct file *filp,
>>                       pci_dev_put(pci_dev);
>>               }
>>               if (!dev->hose) {
>> -                     struct pci_bus *b = pci_bus_b(pci_root_buses.next);
>> -                     if (b)
>> -                             dev->hose = b->sysdata;
>> +                     struct pci_host_bridge *host_bridge;
>> +
>> +                     host_bridge = pci_next_host_bridge(NULL);
>
> pci_get_next_host_bridge() ?
>

Fixed.

Thanks.
--
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

Patch

diff --git a/drivers/gpu/drm/drm_fops.c b/drivers/gpu/drm/drm_fops.c
index 133b413..b92a9cc 100644
--- a/drivers/gpu/drm/drm_fops.c
+++ b/drivers/gpu/drm/drm_fops.c
@@ -356,9 +356,13 @@  static int drm_open_helper(struct inode *inode, struct file *filp,
 			pci_dev_put(pci_dev);
 		}
 		if (!dev->hose) {
-			struct pci_bus *b = pci_bus_b(pci_root_buses.next);
-			if (b)
-				dev->hose = b->sysdata;
+			struct pci_host_bridge *host_bridge;
+
+			host_bridge = pci_next_host_bridge(NULL);
+			if (host_bridge) {
+				dev->hose = host_bridge->bus->sysdata;
+				put_device(&host_bridge->dev);
+			}
 		}
 	}
 #endif