LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH 2/5] PCI : Move pci_fixup_device and is_enabled
@ 2006-11-22  8:06 Hidetoshi Seto
  2006-11-22 18:09 ` Grant Grundler
  0 siblings, 1 reply; 4+ messages in thread
From: Hidetoshi Seto @ 2006-11-22  8:06 UTC (permalink / raw)
  To: Linux Kernel list, linux-pci
  Cc: Greg KH, Grant Grundler, Andrew Morton, e1000-devel, linux-scsi,
	Kenji Kaneshige

This patch adds the following changes into generic PCI code especially
for PCI legacy I/O port free drivers.

    - Moved the following two things from pci_enable_device() into
      pci_enable_device_bars(). Already some drivers are using
      pci_enable_device_bars() to enable only the specific regions,
      but they had no chance to be fixup and to up is_enabled flag.

          o Call pci_fixup_device() on the device
          o Checking & Setting dev->is_enabled

    - Trivial cleanup

Signed-off-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
Signed-off-by: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>

---
 drivers/pci/pci.c |   20 ++++++++------------
 1 files changed, 8 insertions(+), 12 deletions(-)

Index: linux-2.6.19-rc6/drivers/pci/pci.c
===================================================================
--- linux-2.6.19-rc6.orig/drivers/pci/pci.c
+++ linux-2.6.19-rc6/drivers/pci/pci.c
@@ -558,12 +558,18 @@
 {
 	int err;

+	if (dev->is_enabled)
+		return 0;
+
 	err = pci_set_power_state(dev, PCI_D0);
 	if (err < 0 && err != -EIO)
 		return err;
 	err = pcibios_enable_device(dev, bars);
 	if (err < 0)
 		return err;
+
+	pci_fixup_device(pci_fixup_enable, dev);
+	dev->is_enabled = 1;
 	return 0;
 }

@@ -578,17 +584,7 @@
 int
 pci_enable_device(struct pci_dev *dev)
 {
-	int err;
-
-	if (dev->is_enabled)
-		return 0;
-
-	err = pci_enable_device_bars(dev, (1 << PCI_NUM_RESOURCES) - 1);
-	if (err)
-		return err;
-	pci_fixup_device(pci_fixup_enable, dev);
-	dev->is_enabled = 1;
-	return 0;
+	return pci_enable_device_bars(dev, (1 << PCI_NUM_RESOURCES) - 1);
 }

 /**
@@ -737,7 +733,7 @@
 {
 	if (pci_resource_len(pdev, bar) == 0)
 		return 0;
-		
+
 	if (pci_resource_flags(pdev, bar) & IORESOURCE_IO) {
 		if (!request_region(pci_resource_start(pdev, bar),
 			    pci_resource_len(pdev, bar), res_name))


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

* Re: [PATCH 2/5] PCI : Move pci_fixup_device and is_enabled
  2006-11-22  8:06 [PATCH 2/5] PCI : Move pci_fixup_device and is_enabled Hidetoshi Seto
@ 2006-11-22 18:09 ` Grant Grundler
  2006-11-23  3:34   ` Greg KH
  2006-12-07  1:16   ` Greg KH
  0 siblings, 2 replies; 4+ messages in thread
From: Grant Grundler @ 2006-11-22 18:09 UTC (permalink / raw)
  To: Hidetoshi Seto
  Cc: Linux Kernel list, linux-pci, Greg KH, Grant Grundler,
	Andrew Morton, e1000-devel, linux-scsi, Kenji Kaneshige

On Wed, Nov 22, 2006 at 05:06:07PM +0900, Hidetoshi Seto wrote:
> --- linux-2.6.19-rc6.orig/drivers/pci/pci.c
> +++ linux-2.6.19-rc6/drivers/pci/pci.c
> @@ -558,12 +558,18 @@
>  {
>  	int err;
> 
> +	if (dev->is_enabled)
> +		return 0;

This is unfortunately going to collide with the previous
patch posted by inaky@linux.intel.com:

    Subject: [patch 0/2] pci: make pci_{enable,disable}_device() be nested

grant

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

* Re: [PATCH 2/5] PCI : Move pci_fixup_device and is_enabled
  2006-11-22 18:09 ` Grant Grundler
@ 2006-11-23  3:34   ` Greg KH
  2006-12-07  1:16   ` Greg KH
  1 sibling, 0 replies; 4+ messages in thread
From: Greg KH @ 2006-11-23  3:34 UTC (permalink / raw)
  To: Grant Grundler
  Cc: Hidetoshi Seto, Linux Kernel list, linux-pci, Andrew Morton,
	e1000-devel, linux-scsi, Kenji Kaneshige

On Wed, Nov 22, 2006 at 11:09:01AM -0700, Grant Grundler wrote:
> On Wed, Nov 22, 2006 at 05:06:07PM +0900, Hidetoshi Seto wrote:
> > --- linux-2.6.19-rc6.orig/drivers/pci/pci.c
> > +++ linux-2.6.19-rc6/drivers/pci/pci.c
> > @@ -558,12 +558,18 @@
> >  {
> >  	int err;
> > 
> > +	if (dev->is_enabled)
> > +		return 0;
> 
> This is unfortunately going to collide with the previous
> patch posted by inaky@linux.intel.com:
> 
>     Subject: [patch 0/2] pci: make pci_{enable,disable}_device() be nested

Not a problem, that's what I'm here for :)

thanks,

greg k-h

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

* Re: [PATCH 2/5] PCI : Move pci_fixup_device and is_enabled
  2006-11-22 18:09 ` Grant Grundler
  2006-11-23  3:34   ` Greg KH
@ 2006-12-07  1:16   ` Greg KH
  1 sibling, 0 replies; 4+ messages in thread
From: Greg KH @ 2006-12-07  1:16 UTC (permalink / raw)
  To: Grant Grundler
  Cc: Hidetoshi Seto, Linux Kernel list, linux-pci, Andrew Morton,
	e1000-devel, linux-scsi, Kenji Kaneshige

On Wed, Nov 22, 2006 at 11:09:01AM -0700, Grant Grundler wrote:
> On Wed, Nov 22, 2006 at 05:06:07PM +0900, Hidetoshi Seto wrote:
> > --- linux-2.6.19-rc6.orig/drivers/pci/pci.c
> > +++ linux-2.6.19-rc6/drivers/pci/pci.c
> > @@ -558,12 +558,18 @@
> >  {
> >  	int err;
> > 
> > +	if (dev->is_enabled)
> > +		return 0;
> 
> This is unfortunately going to collide with the previous
> patch posted by inaky@linux.intel.com:
> 
>     Subject: [patch 0/2] pci: make pci_{enable,disable}_device() be nested

Grant, you were right.  This has changed the logic around this area, and
the pci_enable_device() stuff conflicts with this.

Hidetoshi, I tried to merge things together, but I think I got it wrong,
as the logic is different now.  Can you please respin this patch and
resend all of them?

Sorry for the delay,

thanks,

greg k-h

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

end of thread, other threads:[~2006-12-07  1:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-11-22  8:06 [PATCH 2/5] PCI : Move pci_fixup_device and is_enabled Hidetoshi Seto
2006-11-22 18:09 ` Grant Grundler
2006-11-23  3:34   ` Greg KH
2006-12-07  1:16   ` Greg KH

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