linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] I2O: don't disable PCI device if it is enabled before probing
@ 2006-01-23 23:29 Markus Lidel
  2006-01-30 18:17 ` Alan Cox
  0 siblings, 1 reply; 5+ messages in thread
From: Markus Lidel @ 2006-01-23 23:29 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Linux Kernel

[-- Attachment #1: Type: text/plain, Size: 159 bytes --]

Changes:
--------
- If PCI device is enabled before probing, it will not be disabled at
   exit.

Signed-off-by: Markus Lidel <Markus.Lidel@shadowconnect.com>

[-- Attachment #2: i2o-pci-fix-disable-device.patch --]
[-- Type: text/x-patch, Size: 1662 bytes --]

--- a/drivers/message/i2o/pci.c	2006-01-23 23:41:42.031509195 +0100
+++ b/drivers/message/i2o/pci.c	2006-01-23 01:03:51.236440918 +0100
@@ -88,6 +88,11 @@
 	struct device *dev = &pdev->dev;
 	int i;
 
+	if (pci_request_regions(pdev, OSM_DESCRIPTION)) {
+		printk(KERN_ERR "%s: device already claimed\n", c->name);
+		return -ENODEV;
+	}
+
 	for (i = 0; i < 6; i++) {
 		/* Skip I/O spaces */
 		if (!(pci_resource_flags(pdev, i) & IORESOURCE_IO)) {
@@ -298,7 +321,7 @@
 	struct i2o_controller *c;
 	int rc;
 	struct pci_dev *i960 = NULL;
-	int pci_dev_busy = 0;
+	int enabled = pdev->is_enabled;
 
 	printk(KERN_INFO "i2o: Checking for PCI I2O controllers...\n");
 
@@ -308,16 +331,12 @@
 		return -ENODEV;
 	}
 
-	if ((rc = pci_enable_device(pdev))) {
-		printk(KERN_WARNING "i2o: couldn't enable device %s\n",
-		       pci_name(pdev));
-		return rc;
-	}
-
-	if (pci_request_regions(pdev, OSM_DESCRIPTION)) {
-		printk(KERN_ERR "i2o: device already claimed\n");
-		return -ENODEV;
-	}
+	if (!enabled)
+		if ((rc = pci_enable_device(pdev))) {
+			printk(KERN_WARNING "i2o: couldn't enable device %s\n",
+			       pci_name(pdev));
+			return rc;
+		}
 
 	if (pci_set_dma_mask(pdev, DMA_32BIT_MASK)) {
 		printk(KERN_WARNING "i2o: no suitable DMA found for %s\n",
@@ -395,9 +414,7 @@
 
 	if ((rc = i2o_pci_alloc(c))) {
 		printk(KERN_ERR "%s: DMA / IO allocation for I2O controller "
-		       " failed\n", c->name);
-		if (rc == -ENODEV)
-			pci_dev_busy = 1;
+		       "failed\n", c->name);
 		goto free_controller;
 	}
 
@@ -425,7 +442,7 @@
 	i2o_iop_free(c);
 
       disable:
-	if (!pci_dev_busy)
+	if (!enabled)
 		pci_disable_device(pdev);
 
 	return rc;

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

* Re: [PATCH 1/2] I2O: don't disable PCI device if it is enabled before probing
  2006-01-23 23:29 [PATCH 1/2] I2O: don't disable PCI device if it is enabled before probing Markus Lidel
@ 2006-01-30 18:17 ` Alan Cox
  2006-01-30 19:33   ` Markus Lidel
  0 siblings, 1 reply; 5+ messages in thread
From: Alan Cox @ 2006-01-30 18:17 UTC (permalink / raw)
  To: Markus Lidel; +Cc: Andrew Morton, Linux Kernel

On Maw, 2006-01-24 at 00:29 +0100, Markus Lidel wrote:
> Changes:
> --------
> - If PCI device is enabled before probing, it will not be disabled at
>    exit.

Looks ok for this case but be warned that pdev->is_enabled is not a safe
check for many devices as the may be BIOS critical, or video for example
but not in the Linux list of things _it_ enabled.


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

* Re: [PATCH 1/2] I2O: don't disable PCI device if it is enabled before probing
  2006-01-30 18:17 ` Alan Cox
@ 2006-01-30 19:33   ` Markus Lidel
  2006-01-30 23:01     ` PCI layer: Need for enable/disable counting (was disable PCI device if it is enabled before probing) Alan Cox
  0 siblings, 1 reply; 5+ messages in thread
From: Markus Lidel @ 2006-01-30 19:33 UTC (permalink / raw)
  To: Alan Cox; +Cc: Andrew Morton, Linux Kernel

Hello,

Alan Cox wrote:
> On Maw, 2006-01-24 at 00:29 +0100, Markus Lidel wrote:
>> Changes:
>> --------
>> - If PCI device is enabled before probing, it will not be disabled at
>>    exit.
> Looks ok for this case but be warned that pdev->is_enabled is not a safe
> check for many devices as the may be BIOS critical, or video for example
> but not in the Linux list of things _it_ enabled.

I've searched for a function enabled() or so, but didn't find anything. 
Could you tell me the right way to do it normally?

Thanks for the hint!

Best regards,


Markus Lidel
------------------------------------------
Markus Lidel (Senior IT Consultant)

Shadow Connect GmbH
Carl-Reisch-Weg 12
D-86381 Krumbach
Germany

Phone:  +49 82 82/99 51-0
Fax:    +49 82 82/99 51-11

E-Mail: Markus.Lidel@shadowconnect.com
URL:    http://www.shadowconnect.com

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

* PCI layer: Need for enable/disable counting (was  disable PCI device if it is enabled before probing)
  2006-01-30 19:33   ` Markus Lidel
@ 2006-01-30 23:01     ` Alan Cox
  2006-01-31  9:31       ` Markus Lidel
  0 siblings, 1 reply; 5+ messages in thread
From: Alan Cox @ 2006-01-30 23:01 UTC (permalink / raw)
  To: Markus Lidel; +Cc: Andrew Morton, Linux Kernel

On Llu, 2006-01-30 at 20:33 +0100, Markus Lidel wrote:
> I've searched for a function enabled() or so, but didn't find anything. 
> Could you tell me the right way to do it normally?

Right now there isn't one. I've hit this problem with the new libata
layer stuff having successfully disabled my root pci bridge on unload at
least once.

Would be easy to add one but I suspect it should be rcounted so that
enable/disable just stack naturally ?

What do people want from such an interface and should it also start boot
enabled devices at a count of 1 or just the bridges/video class
devices ?

Alan


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

* Re: PCI layer: Need for enable/disable counting (was  disable PCI device if it is enabled before probing)
  2006-01-30 23:01     ` PCI layer: Need for enable/disable counting (was disable PCI device if it is enabled before probing) Alan Cox
@ 2006-01-31  9:31       ` Markus Lidel
  0 siblings, 0 replies; 5+ messages in thread
From: Markus Lidel @ 2006-01-31  9:31 UTC (permalink / raw)
  To: Alan Cox; +Cc: Andrew Morton, Linux Kernel

Hello,

Alan Cox wrote:
> On Llu, 2006-01-30 at 20:33 +0100, Markus Lidel wrote:
>> I've searched for a function enabled() or so, but didn't find anything. 
>> Could you tell me the right way to do it normally?
> Right now there isn't one. I've hit this problem with the new libata

OK, at least i haven't overseen something :-D

> layer stuff having successfully disabled my root pci bridge on unload at
> least once.

Hmmm, think this is something everyone could use...

> Would be easy to add one but I suspect it should be rcounted so that
> enable/disable just stack naturally ?

Sounds great to me... So the verification if the device is enabled before 
could be completely removed from my and probably others code...

> What do people want from such an interface and should it also start boot
> enabled devices at a count of 1 or just the bridges/video class
> devices ?

Hmmm, i don't know what happens if a boot enabled device is disabled, but 
from my point of view i would start at 1 :-D

Probably also the probing function could also enable the device, so the 
subsystems don't have to do it on there own? But because i don't know PCI 
stuff very well i don't know if this makes sense at all...

Thank you very much!


Best regards,


Markus Lidel
------------------------------------------
Markus Lidel (Senior IT Consultant)

Shadow Connect GmbH
Carl-Reisch-Weg 12
D-86381 Krumbach
Germany

Phone:  +49 82 82/99 51-0
Fax:    +49 82 82/99 51-11

E-Mail: Markus.Lidel@shadowconnect.com
URL:    http://www.shadowconnect.com

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

end of thread, other threads:[~2006-01-31  9:31 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-01-23 23:29 [PATCH 1/2] I2O: don't disable PCI device if it is enabled before probing Markus Lidel
2006-01-30 18:17 ` Alan Cox
2006-01-30 19:33   ` Markus Lidel
2006-01-30 23:01     ` PCI layer: Need for enable/disable counting (was disable PCI device if it is enabled before probing) Alan Cox
2006-01-31  9:31       ` Markus Lidel

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