kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 08/11] x86: intel_ips: do not use PCI resources before pci_enable_device()
@ 2010-08-03 15:44 Kulikov Vasiliy
  2010-08-03 15:45 ` [PATCH 08/11] x86: intel_ips: do not use PCI resources before Jesse Barnes
  0 siblings, 1 reply; 2+ messages in thread
From: Kulikov Vasiliy @ 2010-08-03 15:44 UTC (permalink / raw)
  To: kernel-janitors
  Cc: Matthew Garrett, Jesse Barnes, Jiri Slaby, platform-driver-x86,
	linux-kernel

IRQ and resource[] may not have correct values until
after PCI hotplug setup occurs at pci_enable_device() time.

The semantic match that finds this problem is as follows:

// <smpl>
@@
identifier x;
identifier request ~= "pci_request.*|pci_resource.*";
@@

(
* x->irq
|
* x->resource
|
* request(x, ...)
)
 ...
*pci_enable_device(x)
// </smpl>

Signed-off-by: Kulikov Vasiliy <segooon@gmail.com>
---
 drivers/platform/x86/intel_ips.c |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/platform/x86/intel_ips.c b/drivers/platform/x86/intel_ips.c
index 0344822..90c9549 100644
--- a/drivers/platform/x86/intel_ips.c
+++ b/drivers/platform/x86/intel_ips.c
@@ -1432,6 +1432,12 @@ static int ips_probe(struct pci_dev *dev, const struct pci_device_id *id)
 
 	spin_lock_init(&ips->turbo_status_lock);
 
+	ret = pci_enable_device(dev);
+	if (ret) {
+		dev_err(&dev->dev, "can't enable PCI device, aborting\n");
+		goto error_free;
+	}
+
 	if (!pci_resource_start(dev, 0)) {
 		dev_err(&dev->dev, "TBAR not assigned, aborting\n");
 		ret = -ENXIO;
@@ -1444,11 +1450,6 @@ static int ips_probe(struct pci_dev *dev, const struct pci_device_id *id)
 		goto error_free;
 	}
 
-	ret = pci_enable_device(dev);
-	if (ret) {
-		dev_err(&dev->dev, "can't enable PCI device, aborting\n");
-		goto error_free;
-	}
 
 	ips->regmap = ioremap(pci_resource_start(dev, 0),
 			      pci_resource_len(dev, 0));
-- 
1.7.0.4


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

* Re: [PATCH 08/11] x86: intel_ips: do not use PCI resources before
  2010-08-03 15:44 [PATCH 08/11] x86: intel_ips: do not use PCI resources before pci_enable_device() Kulikov Vasiliy
@ 2010-08-03 15:45 ` Jesse Barnes
  0 siblings, 0 replies; 2+ messages in thread
From: Jesse Barnes @ 2010-08-03 15:45 UTC (permalink / raw)
  To: Kulikov Vasiliy
  Cc: kernel-janitors, Matthew Garrett, Jiri Slaby, platform-driver-x86,
	linux-kernel

On Tue,  3 Aug 2010 19:44:16 +0400
Kulikov Vasiliy <segooon@gmail.com> wrote:

> IRQ and resource[] may not have correct values until
> after PCI hotplug setup occurs at pci_enable_device() time.
> 
> The semantic match that finds this problem is as follows:
> 
> // <smpl>
> @@
> identifier x;
> identifier request ~= "pci_request.*|pci_resource.*";
> @@
> 
> (
> * x->irq
> |
> * x->resource
> |
> * request(x, ...)
> )
>  ...
> *pci_enable_device(x)
> // </smpl>
> 
> Signed-off-by: Kulikov Vasiliy <segooon@gmail.com>
> ---
>  drivers/platform/x86/intel_ips.c |   11 ++++++-----
>  1 files changed, 6 insertions(+), 5 deletions(-)

Yep, thanks.

Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>

-- 
Jesse Barnes, Intel Open Source Technology Center

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

end of thread, other threads:[~2010-08-03 15:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-03 15:44 [PATCH 08/11] x86: intel_ips: do not use PCI resources before pci_enable_device() Kulikov Vasiliy
2010-08-03 15:45 ` [PATCH 08/11] x86: intel_ips: do not use PCI resources before Jesse Barnes

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