From: Bjorn Helgaas <bjorn.helgaas@hp.com>
To: linux-pci@atrey.karlin.mff.cuni.cz, linux-arch@vger.kernel.org
Cc: Russell King <rmk@arm.linux.org.uk>,
linux-arm-kernel@lists.arm.linux.org.uk,
Kyle McMartin <kyle@parisc-linux.org>,
Matthew Wilcox <matthew@wil.cx>,
Grant Grundler <grundler@parisc-linux.org>,
linux-parisc@vger.kernel.org, Paul Mackerras <paulus@samba.org>,
Benjamin Herrenschmidt <benh@kernel.crashing.org>,
linuxppc-dev@ozlabs.org, Chris Zankel <chris@zankel.net>
Subject: [patch 3/4] xtensa: make pcibios_enable_device() use pcibios_enable_resources()
Date: Mon, 18 Feb 2008 21:39:55 -0700 [thread overview]
Message-ID: <20080219044307.679302332@ldl.fc.hp.com> (raw)
In-Reply-To: 20080219043952.845136014@ldl.fc.hp.com
[-- Attachment #1: xtensa-pcibios_enable_resources --]
[-- Type: text/plain, Size: 1622 bytes --]
pcibios_enable_device() has an almost verbatim copy of
pcibios_enable_resources(), (the only difference is that
pcibios_enable_resources() turns on PCI_COMMAND_MEMORY if
there's a ROM resource).
The duplication might be intentional, but I don't see any callers
of pcibios_enable_resources() on xtensa, so I think it's more
likely a historical accident copied from ppc.
This patch removes the duplication, making pcibios_enable_device()
simply call pcibios_enable_resources() as x86 does.
Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
Index: work6/arch/xtensa/kernel/pci.c
===================================================================
--- work6.orig/arch/xtensa/kernel/pci.c 2008-02-18 10:43:50.000000000 -0700
+++ work6/arch/xtensa/kernel/pci.c 2008-02-18 11:32:12.000000000 -0700
@@ -238,31 +238,7 @@
int pcibios_enable_device(struct pci_dev *dev, int mask)
{
- u16 cmd, old_cmd;
- int idx;
- struct resource *r;
-
- pci_read_config_word(dev, PCI_COMMAND, &cmd);
- old_cmd = cmd;
- for (idx=0; idx<6; idx++) {
- r = &dev->resource[idx];
- if (!r->start && r->end) {
- printk(KERN_ERR "PCI: Device %s not available because "
- "of resource collisions\n", pci_name(dev));
- return -EINVAL;
- }
- if (r->flags & IORESOURCE_IO)
- cmd |= PCI_COMMAND_IO;
- if (r->flags & IORESOURCE_MEM)
- cmd |= PCI_COMMAND_MEMORY;
- }
- if (cmd != old_cmd) {
- printk("PCI: Enabling device %s (%04x -> %04x)\n",
- pci_name(dev), old_cmd, cmd);
- pci_write_config_word(dev, PCI_COMMAND, cmd);
- }
-
- return 0;
+ return pcibios_enable_resources(dev, mask);
}
#ifdef CONFIG_PROC_FS
--
WARNING: multiple messages have this Message-ID (diff)
From: Bjorn Helgaas <bjorn.helgaas@hp.com>
To: linux-pci@atrey.karlin.mff.cuni.cz
To: linux-arch@vger.kernel.org
Cc: Chris Zankel <chris@zankel.net>,
Grant Grundler <grundler@parisc-linux.org>,
linux-parisc@vger.kernel.org, Matthew Wilcox <matthew@wil.cx>,
Kyle McMartin <kyle@parisc-linux.org>,
linuxppc-dev@ozlabs.org, Paul Mackerras <paulus@samba.org>,
linux-arm-kernel@lists.arm.linux.org.uk,
Russell King <rmk@arm.linux.org.uk>
Subject: [patch 3/4] xtensa: make pcibios_enable_device() use pcibios_enable_resources()
Date: Mon, 18 Feb 2008 21:39:55 -0700 [thread overview]
Message-ID: <20080219044307.679302332@ldl.fc.hp.com> (raw)
In-Reply-To: 20080219043952.845136014@ldl.fc.hp.com
pcibios_enable_device() has an almost verbatim copy of
pcibios_enable_resources(), (the only difference is that
pcibios_enable_resources() turns on PCI_COMMAND_MEMORY if
there's a ROM resource).
The duplication might be intentional, but I don't see any callers
of pcibios_enable_resources() on xtensa, so I think it's more
likely a historical accident copied from ppc.
This patch removes the duplication, making pcibios_enable_device()
simply call pcibios_enable_resources() as x86 does.
Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
Index: work6/arch/xtensa/kernel/pci.c
===================================================================
--- work6.orig/arch/xtensa/kernel/pci.c 2008-02-18 10:43:50.000000000 -0700
+++ work6/arch/xtensa/kernel/pci.c 2008-02-18 11:32:12.000000000 -0700
@@ -238,31 +238,7 @@
int pcibios_enable_device(struct pci_dev *dev, int mask)
{
- u16 cmd, old_cmd;
- int idx;
- struct resource *r;
-
- pci_read_config_word(dev, PCI_COMMAND, &cmd);
- old_cmd = cmd;
- for (idx=0; idx<6; idx++) {
- r = &dev->resource[idx];
- if (!r->start && r->end) {
- printk(KERN_ERR "PCI: Device %s not available because "
- "of resource collisions\n", pci_name(dev));
- return -EINVAL;
- }
- if (r->flags & IORESOURCE_IO)
- cmd |= PCI_COMMAND_IO;
- if (r->flags & IORESOURCE_MEM)
- cmd |= PCI_COMMAND_MEMORY;
- }
- if (cmd != old_cmd) {
- printk("PCI: Enabling device %s (%04x -> %04x)\n",
- pci_name(dev), old_cmd, cmd);
- pci_write_config_word(dev, PCI_COMMAND, cmd);
- }
-
- return 0;
+ return pcibios_enable_resources(dev, mask);
}
#ifdef CONFIG_PROC_FS
--
next prev parent reply other threads:[~2008-02-19 4:41 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-19 4:39 [patch 0/4] RFC: PCI: consolidate several pcibios_enable_resources() implementations Bjorn Helgaas
2008-02-19 4:39 ` Bjorn Helgaas
2008-02-19 4:39 ` [patch 1/4] PCI: split pcibios_enable_resources() out of pcibios_enable_device() Bjorn Helgaas
2008-02-19 4:39 ` Bjorn Helgaas
2008-02-19 6:27 ` Benjamin Herrenschmidt
2008-02-19 6:27 ` Benjamin Herrenschmidt
2008-02-19 4:39 ` [patch 2/4] ppc: make pcibios_enable_device() use pcibios_enable_resources() Bjorn Helgaas
2008-02-19 4:39 ` Bjorn Helgaas
2008-02-19 6:26 ` Benjamin Herrenschmidt
2008-02-19 6:26 ` Benjamin Herrenschmidt
2008-02-19 4:39 ` Bjorn Helgaas [this message]
2008-02-19 4:39 ` [patch 3/4] xtensa: " Bjorn Helgaas
2008-02-19 4:39 ` [patch 4/4] RFC: PCI: consolidate several pcibios_enable_resources() implementations Bjorn Helgaas
2008-02-19 4:39 ` Bjorn Helgaas
2008-02-19 6:31 ` Benjamin Herrenschmidt
2008-02-19 6:31 ` Benjamin Herrenschmidt
2008-02-19 16:11 ` Bjorn Helgaas
2008-02-19 16:11 ` Bjorn Helgaas
2008-02-19 17:08 ` Ivan Kokshaysky
2008-02-19 17:08 ` Ivan Kokshaysky
2008-02-19 20:21 ` Benjamin Herrenschmidt
2008-02-19 20:21 ` Benjamin Herrenschmidt
2008-02-19 6:33 ` Benjamin Herrenschmidt
2008-02-19 6:33 ` Benjamin Herrenschmidt
2008-02-19 7:03 ` Kyle McMartin
2008-02-19 7:03 ` Kyle McMartin
2008-02-19 6:11 ` [patch 0/4] " Kyle McMartin
2008-02-19 6:11 ` Kyle McMartin
2008-02-19 8:09 ` Russell King
2008-02-19 8:09 ` Russell King
2008-02-19 10:08 ` Benjamin Herrenschmidt
2008-02-19 10:08 ` Benjamin Herrenschmidt
2008-02-19 18:02 ` Bjorn Helgaas
2008-02-19 18:02 ` Bjorn Helgaas
2008-02-20 6:24 ` Grant Grundler
2008-02-20 6:24 ` Grant Grundler
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080219044307.679302332@ldl.fc.hp.com \
--to=bjorn.helgaas@hp.com \
--cc=benh@kernel.crashing.org \
--cc=chris@zankel.net \
--cc=grundler@parisc-linux.org \
--cc=kyle@parisc-linux.org \
--cc=linux-arch@vger.kernel.org \
--cc=linux-arm-kernel@lists.arm.linux.org.uk \
--cc=linux-parisc@vger.kernel.org \
--cc=linux-pci@atrey.karlin.mff.cuni.cz \
--cc=linuxppc-dev@ozlabs.org \
--cc=matthew@wil.cx \
--cc=paulus@samba.org \
--cc=rmk@arm.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.