From: Sebastian Ott <sebott@linux.vnet.ibm.com>
To: Bjorn Helgaas <bhelgaas@google.com>
Cc: linux-pci@vger.kernel.org, Jan Glauber <jang@linux.vnet.ibm.com>,
Heiko Carstens <heiko.carstens@de.ibm.com>,
linux-kernel@vger.kernel.org,
Martin Schwidefsky <schwidefsky@de.ibm.com>,
linux390@de.ibm.com
Subject: Re: [PATCH 7/7] s390/PCI: Use generic pci_enable_resources()
Date: Mon, 3 Mar 2014 14:35:04 +0100 (CET) [thread overview]
Message-ID: <alpine.LFD.2.11.1403031429080.1476@denkbrett> (raw)
In-Reply-To: <20140226234215.18970.1743.stgit@bhelgaas-glaptop.roam.corp.google.com>
Hello Bjorn,
On Wed, 26 Feb 2014, Bjorn Helgaas wrote:
> The generic pci_enable_resources() does essentially the same thing as the
> code in the s390 version of pcibios_enable_device().
>
> There are differences, but I don't think any of them are a problem. The
> generic code:
>
> - Checks everything up to PCI_NUM_RESOURCES, not PCI_BAR_COUNT (6), so
> we'll now check the ROM resource, IOV resources, and bridge windows.
>
> - Checks for res->flags & IORESOURCE_UNSET. The s390 code never sets
> IORESOURCE_UNSET, so this isn't a problem.
>
> - Checks res->parent. The s390 pcibios_add_device() calls
> pci_claim_resource() on all BARs (except ROM, IOV, and bridge windows)
> so this isn't a problem either.
>
> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
> CC: Martin Schwidefsky <schwidefsky@de.ibm.com>
> CC: Heiko Carstens <heiko.carstens@de.ibm.com>
> CC: Sebastian Ott <sebott@linux.vnet.ibm.com>
> CC: Jan Glauber <jang@linux.vnet.ibm.com>
> CC: linux390@de.ibm.com
> ---
> arch/s390/pci/pci.c | 13 +------------
> 1 file changed, 1 insertion(+), 12 deletions(-)
>
> diff --git a/arch/s390/pci/pci.c b/arch/s390/pci/pci.c
> index 66670ff262a0..7d5fcaed3361 100644
> --- a/arch/s390/pci/pci.c
> +++ b/arch/s390/pci/pci.c
> @@ -695,18 +695,7 @@ int pcibios_enable_device(struct pci_dev *pdev, int mask)
> zpci_fmb_enable_device(zdev);
> zpci_map_resources(zdev);
>
> - pci_read_config_word(pdev, PCI_COMMAND, &cmd);
> - for (i = 0; i < PCI_BAR_COUNT; i++) {
> - res = &pdev->resource[i];
> -
> - if (res->flags & IORESOURCE_IO)
> - return -EINVAL;
> -
> - if (res->flags & IORESOURCE_MEM)
> - cmd |= PCI_COMMAND_MEMORY;
> - }
> - pci_write_config_word(pdev, PCI_COMMAND, cmd);
> - return 0;
> + return pci_enable_resources(pdev, mask);
> }
>
> void pcibios_disable_device(struct pci_dev *pdev)
>
Let's also remove some now unused variables (updated patch below). Other
than that:
Acked-by: Sebastian Ott <sebott@linux.vnet.ibm.com>
Regards,
Sebastian
---
s390/PCI: Use generic pci_enable_resources()
The generic pci_enable_resources() does essentially the same thing as the
code in the s390 version of pcibios_enable_device().
There are differences, but I don't think any of them are a problem. The
generic code:
- Checks everything up to PCI_NUM_RESOURCES, not PCI_BAR_COUNT (6), so
we'll now check the ROM resource, IOV resources, and bridge windows.
- Checks for res->flags & IORESOURCE_UNSET. The s390 code never sets
IORESOURCE_UNSET, so this isn't a problem.
- Checks res->parent. The s390 pcibios_add_device() calls
pci_claim_resource() on all BARs (except ROM, IOV, and bridge windows)
so this isn't a problem either.
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
CC: Martin Schwidefsky <schwidefsky@de.ibm.com>
CC: Heiko Carstens <heiko.carstens@de.ibm.com>
CC: Sebastian Ott <sebott@linux.vnet.ibm.com>
CC: Jan Glauber <jang@linux.vnet.ibm.com>
CC: linux390@de.ibm.com
---
arch/s390/pci/pci.c | 16 +---------------
1 file changed, 1 insertion(+), 15 deletions(-)
--- a/arch/s390/pci/pci.c
+++ b/arch/s390/pci/pci.c
@@ -686,27 +686,13 @@ int pcibios_add_device(struct pci_dev *p
int pcibios_enable_device(struct pci_dev *pdev, int mask)
{
struct zpci_dev *zdev = get_zdev(pdev);
- struct resource *res;
- u16 cmd;
- int i;
zdev->pdev = pdev;
zpci_debug_init_device(zdev);
zpci_fmb_enable_device(zdev);
zpci_map_resources(zdev);
- pci_read_config_word(pdev, PCI_COMMAND, &cmd);
- for (i = 0; i < PCI_BAR_COUNT; i++) {
- res = &pdev->resource[i];
-
- if (res->flags & IORESOURCE_IO)
- return -EINVAL;
-
- if (res->flags & IORESOURCE_MEM)
- cmd |= PCI_COMMAND_MEMORY;
- }
- pci_write_config_word(pdev, PCI_COMMAND, cmd);
- return 0;
+ return pci_enable_resources(pdev, mask);
}
void pcibios_disable_device(struct pci_dev *pdev)
next prev parent reply other threads:[~2014-03-03 13:35 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-26 23:41 [PATCH 0/7] PCI: Use default pcibios_enable_device() Bjorn Helgaas
2014-02-26 23:41 ` [PATCH 1/7] PCI: Add "weak" generic pcibios_enable_device() implementation Bjorn Helgaas
2014-02-26 23:41 ` [PATCH 2/7] alpha/PCI: Use default pcibios_enable_device() Bjorn Helgaas
2014-02-26 23:41 ` [PATCH 3/7] microblaze/PCI: " Bjorn Helgaas
2014-02-26 23:41 ` [PATCH 4/7] sh/PCI: " Bjorn Helgaas
2014-02-26 23:42 ` [PATCH 5/7] sparc/PCI: Use default pcibios_enable_device() (Leon only) Bjorn Helgaas
2014-02-26 23:42 ` [PATCH 6/7] tile PCI RC: Use default pcibios_enable_device() Bjorn Helgaas
2014-03-04 17:20 ` Chris Metcalf
2014-02-26 23:42 ` [PATCH 7/7] s390/PCI: Use generic pci_enable_resources() Bjorn Helgaas
2014-03-03 13:35 ` Sebastian Ott [this message]
2014-03-03 16:13 ` Bjorn Helgaas
2014-03-04 20:53 ` [PATCH 0/7] PCI: Use default pcibios_enable_device() Bjorn Helgaas
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=alpine.LFD.2.11.1403031429080.1476@denkbrett \
--to=sebott@linux.vnet.ibm.com \
--cc=bhelgaas@google.com \
--cc=heiko.carstens@de.ibm.com \
--cc=jang@linux.vnet.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=linux390@de.ibm.com \
--cc=schwidefsky@de.ibm.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®