From patchwork Mon Mar 3 13:35:04 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Ott X-Patchwork-Id: 3754181 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Original-To: patchwork-linux-pci@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id ED967BF13A for ; Mon, 3 Mar 2014 13:35:16 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CFE65203B7 for ; Mon, 3 Mar 2014 13:35:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id ADA6020266 for ; Mon, 3 Mar 2014 13:35:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753924AbaCCNfM (ORCPT ); Mon, 3 Mar 2014 08:35:12 -0500 Received: from e06smtp14.uk.ibm.com ([195.75.94.110]:50236 "EHLO e06smtp14.uk.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753881AbaCCNfL (ORCPT ); Mon, 3 Mar 2014 08:35:11 -0500 Received: from /spool/local by e06smtp14.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 3 Mar 2014 13:35:08 -0000 Received: from d06dlp03.portsmouth.uk.ibm.com (9.149.20.15) by e06smtp14.uk.ibm.com (192.168.101.144) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 3 Mar 2014 13:35:06 -0000 Received: from b06cxnps4074.portsmouth.uk.ibm.com (d06relay11.portsmouth.uk.ibm.com [9.149.109.196]) by d06dlp03.portsmouth.uk.ibm.com (Postfix) with ESMTP id AD4CB1B08051; Mon, 3 Mar 2014 13:34:48 +0000 (GMT) Received: from d06av06.portsmouth.uk.ibm.com (d06av06.portsmouth.uk.ibm.com [9.149.37.217]) by b06cxnps4074.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id s23DYrav1376748; Mon, 3 Mar 2014 13:34:53 GMT Received: from d06av06.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av06.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id s23EZ5J0004109; Mon, 3 Mar 2014 07:35:05 -0700 Received: from dyn-9-152-212-106.boeblingen.de.ibm.com (dyn-9-152-212-106.boeblingen.de.ibm.com [9.152.212.106]) by d06av06.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id s23EZ4Pq004105 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 3 Mar 2014 07:35:05 -0700 Date: Mon, 3 Mar 2014 14:35:04 +0100 (CET) From: Sebastian Ott X-X-Sender: sebott@denkbrett To: Bjorn Helgaas cc: linux-pci@vger.kernel.org, Jan Glauber , Heiko Carstens , linux-kernel@vger.kernel.org, Martin Schwidefsky , linux390@de.ibm.com Subject: Re: [PATCH 7/7] s390/PCI: Use generic pci_enable_resources() In-Reply-To: <20140226234215.18970.1743.stgit@bhelgaas-glaptop.roam.corp.google.com> Message-ID: References: <20140226233541.18970.83328.stgit@bhelgaas-glaptop.roam.corp.google.com> <20140226234215.18970.1743.stgit@bhelgaas-glaptop.roam.corp.google.com> User-Agent: Alpine 2.11 (LFD 23 2013-08-11) Organization: =?ISO-8859-15?Q?=22IBM_Deutschland_Research_&_Development_GmbH_=2F_Vorsitzende_des_Aufsichtsrats=3A_Martina_Koederitz_Gesch=E4ftsf=FChrung=3A_Dirk_Wittkopp_Sitz_der_Gesellschaft=3A_B=F6blingen_=2F_Registergericht?= =?ISO-8859-15?Q?=3A_Amtsgericht_Stuttgart=2C_HRB_243294=22?= MIME-Version: 1.0 X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 14030313-1948-0000-0000-0000080061AE Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 > CC: Martin Schwidefsky > CC: Heiko Carstens > CC: Sebastian Ott > CC: Jan Glauber > 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 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 CC: Martin Schwidefsky CC: Heiko Carstens CC: Sebastian Ott CC: Jan Glauber CC: linux390@de.ibm.com --- arch/s390/pci/pci.c | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-pci" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html --- 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)