public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Char: isicom, enable/disable pci device
@ 2008-07-10 14:20 Jiri Slaby
  2008-07-10 23:35 ` Andrew Morton
  0 siblings, 1 reply; 3+ messages in thread
From: Jiri Slaby @ 2008-07-10 14:20 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel, alan, Jiri Slaby

Don't forget to enable and disable PCI devices. The device
might be unusable without that.

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
---
 drivers/char/isicom.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/drivers/char/isicom.c b/drivers/char/isicom.c
index 4f3cefa..a1a67e3 100644
--- a/drivers/char/isicom.c
+++ b/drivers/char/isicom.c
@@ -1736,6 +1736,12 @@ static int __devinit isicom_probe(struct pci_dev *pdev,
 	if (card_count >= BOARD_COUNT)
 		goto err;
 
+	retval = pci_enable_device(pdev);
+	if (retval) {
+		dev_err(&pdev->dev, "failed to enable\n");
+		goto err;
+	}
+
 	dev_info(&pdev->dev, "ISI PCI Card(Device ID 0x%x)\n", ent->device);
 
 	/* allot the first empty slot in the array */
@@ -1790,6 +1796,7 @@ errunrr:
 errdec:
 	board->base = 0;
 	card_count--;
+	pci_disable_device(pdev);
 err:
 	return retval;
 }
@@ -1806,6 +1813,7 @@ static void __devexit isicom_remove(struct pci_dev *pdev)
 	pci_release_region(pdev, 3);
 	board->base = 0;
 	card_count--;
+	pci_disable_device(pdev);
 }
 
 static int __init isicom_init(void)
-- 
1.5.6.1


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

* Re: [PATCH] Char: isicom, enable/disable pci device
  2008-07-10 14:20 [PATCH] Char: isicom, enable/disable pci device Jiri Slaby
@ 2008-07-10 23:35 ` Andrew Morton
  2008-07-11 14:26   ` Jiri Slaby
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Morton @ 2008-07-10 23:35 UTC (permalink / raw)
  To: Jiri Slaby; +Cc: linux-kernel, alan

On Thu, 10 Jul 2008 16:20:12 +0200 Jiri Slaby <jirislaby@gmail.com> wrote:

> Don't forget to enable and disable PCI devices. The device
> might be unusable without that.
> 
> Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
> ---
>  drivers/char/isicom.c |    8 ++++++++
>  1 files changed, 8 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/char/isicom.c b/drivers/char/isicom.c
> index 4f3cefa..a1a67e3 100644
> --- a/drivers/char/isicom.c
> +++ b/drivers/char/isicom.c
> @@ -1736,6 +1736,12 @@ static int __devinit isicom_probe(struct pci_dev *pdev,
>  	if (card_count >= BOARD_COUNT)
>  		goto err;
>  
> +	retval = pci_enable_device(pdev);
> +	if (retval) {
> +		dev_err(&pdev->dev, "failed to enable\n");
> +		goto err;
> +	}
> +
>  	dev_info(&pdev->dev, "ISI PCI Card(Device ID 0x%x)\n", ent->device);
>  
>  	/* allot the first empty slot in the array */
> @@ -1790,6 +1796,7 @@ errunrr:
>  errdec:
>  	board->base = 0;
>  	card_count--;
> +	pci_disable_device(pdev);
>  err:
>  	return retval;
>  }
> @@ -1806,6 +1813,7 @@ static void __devexit isicom_remove(struct pci_dev *pdev)
>  	pci_release_region(pdev, 3);
>  	board->base = 0;
>  	card_count--;
> +	pci_disable_device(pdev);
>  }
>  
>  static int __init isicom_init(void)

hm.  Is this a recently-added problem?

I wonder what the chance is that this will fix something.  Or break
something.

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

* Re: [PATCH] Char: isicom, enable/disable pci device
  2008-07-10 23:35 ` Andrew Morton
@ 2008-07-11 14:26   ` Jiri Slaby
  0 siblings, 0 replies; 3+ messages in thread
From: Jiri Slaby @ 2008-07-11 14:26 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel, alan, Jesse Barnes

On 07/11/2008 01:35 AM, Andrew Morton wrote:
> On Thu, 10 Jul 2008 16:20:12 +0200 Jiri Slaby <jirislaby@gmail.com> wrote:
>> --- a/drivers/char/isicom.c
>> +++ b/drivers/char/isicom.c
>> @@ -1736,6 +1736,12 @@ static int __devinit isicom_probe(struct pci_dev *pdev,
>>  	if (card_count >= BOARD_COUNT)
>>  		goto err;
>>  
>> +	retval = pci_enable_device(pdev);
>> +	if (retval) {
>> +		dev_err(&pdev->dev, "failed to enable\n");
>> +		goto err;
>> +	}
>> +
[...]
> hm.  Is this a recently-added problem?

It disappeared in 2.6.16 (9ac0948): char/isicom: Pci probing added (by me).

> I wonder what the chance is that this will fix something.  Or break
> something.

This is what pci documentation says:
<cite>
3.1 Enable the PCI device
~~~~~~~~~~~~~~~~~~~~~~~~~
Before touching any device registers, the driver needs to enable
the PCI device by calling pci_enable_device(). This will:
         o wake up the device if it was in suspended state,
         o allocate I/O and memory regions of the device (if BIOS did not),
         o allocate an IRQ (if BIOS did not).
</cite>
Maybe Jesse can tell us more on what effect might have device enable omitting?

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

end of thread, other threads:[~2008-07-11 14:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-10 14:20 [PATCH] Char: isicom, enable/disable pci device Jiri Slaby
2008-07-10 23:35 ` Andrew Morton
2008-07-11 14:26   ` Jiri Slaby

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox