From patchwork Wed Oct 18 13:58:17 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Christian_K=C3=B6nig?= X-Patchwork-Id: 10014759 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id CD84060211 for ; Wed, 18 Oct 2017 14:00:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C2E7828722 for ; Wed, 18 Oct 2017 14:00:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B660D28B5E; Wed, 18 Oct 2017 14:00:15 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6C63A28722 for ; Wed, 18 Oct 2017 14:00:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753534AbdJRN6a (ORCPT ); Wed, 18 Oct 2017 09:58:30 -0400 Received: from mail-wr0-f193.google.com ([209.85.128.193]:53294 "EHLO mail-wr0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753013AbdJRN62 (ORCPT ); Wed, 18 Oct 2017 09:58:28 -0400 Received: by mail-wr0-f193.google.com with SMTP id y44so5128704wry.10; Wed, 18 Oct 2017 06:58:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=Y2bEKafksFT3a6FsrdA76mMSe6J+UJw6583d4sySj3Y=; b=njvgkZ7izTnuApS+ZP0xPXxBKxvoeRdQRKnV5YCplJoFHHXZ5LaJM6qfARaJa7OXsj 64ixU5IPVvNCvx3dyy+eBneaZde4Io2Ou9YeAIZU326YSWoCrDTXJASAwT8ovbBPpVOm 6lumFufDD2MtQbeuv3h5pRCIroCdjAEo1KELxPCrA5mzSGAJBuymdKuSDJmfoyTO2GQF RoF+77UOsMxnDKuXwJJ3xyzJTSpW3KTQf63vpPY3IOUOrEJY9tlTLdTFx64F062KSLM7 krfQeqffP0MqZQzgxGkRBG1ERTXcBwOt5T0q63ooAGn01sh+0qGXElb+km8V08hm0ObQ H82A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Y2bEKafksFT3a6FsrdA76mMSe6J+UJw6583d4sySj3Y=; b=QlyZfRbLinFe8o9drma2hXigxNVJPcy89dJQhsmgZwei8CoL+M46YCdmISWr44qwsN KkjV3gcMWOu3sFLHiN44Pr0BT58s19oqIHPtP4JzSgCG5/I1Vt/ctIAPlkQdc/HKq1OX 0TM0Nb4xnrnfQLslSVPz74TwXrvQ23fzlMGWMwPxZCu4y6QjEZP9oFhcRwAQiUjmeCET HoL+DMkuO8ExtNptlkymzZAClwpX9Yx0ZEj65e8BusX9u8ZaB/Tam8DSVL2QYVl8i50H 8RmSh8iyaSgAdGSefXgg7ACDsmUAfImZJgIE4BWH191mLmWU8i8RXPJG8eS70R6FqzUV BczA== X-Gm-Message-State: AMCzsaXsXK4AXpgYTFV6t1eRS/D2/sxca9prZyOMrijSjBUPxJHZPI4l O6ArmKeQdcElqL6xOn1Tt9E= X-Google-Smtp-Source: ABhQp+RZXH/RNJgB+ir/dHqOxAJixmv/LULB1mNOLPL5JcSFTH3e1wXWsPwO0wZ/mOlpabi964Hw2A== X-Received: by 10.223.148.162 with SMTP id 31mr7493961wrr.149.1508335107078; Wed, 18 Oct 2017 06:58:27 -0700 (PDT) Received: from localhost.localdomain ([2a02:908:1251:7981:4537:45bc:69b6:7f1e]) by smtp.gmail.com with ESMTPSA id o24sm15780699wmi.39.2017.10.18.06.58.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Oct 2017 06:58:26 -0700 (PDT) From: "=?UTF-8?q?Christian=20K=C3=B6nig?=" X-Google-Original-From: =?UTF-8?q?Christian=20K=C3=B6nig?= To: helgaas@kernel.org, linux-pci@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, amd-gfx@lists.freedesktop.org Subject: [PATCH v9 1/5] PCI: add a define for the PCI resource type mask v2 Date: Wed, 18 Oct 2017 15:58:17 +0200 Message-Id: <20171018135821.3248-2-deathsimple@vodafone.de> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171018135821.3248-1-deathsimple@vodafone.de> References: <20171018135821.3248-1-deathsimple@vodafone.de> MIME-Version: 1.0 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Christian König We use this mask multiple times in the bus setup. v2: fix some style nit picks Signed-off-by: Christian König Reviewed-by: Andy Shevchenko --- drivers/pci/pci.h | 3 +++ drivers/pci/setup-bus.c | 12 +++--------- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h index 22e061738c6f..5c475edc78c2 100644 --- a/drivers/pci/pci.h +++ b/drivers/pci/pci.h @@ -4,6 +4,9 @@ #define PCI_FIND_CAP_TTL 48 #define PCI_VSEC_ID_INTEL_TBT 0x1234 /* Thunderbolt */ +#define PCI_RES_TYPE_MASK \ + (IORESOURCE_IO | IORESOURCE_MEM | IORESOURCE_PREFETCH |\ + IORESOURCE_MEM_64) extern const unsigned char pcie_link_speed[]; diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c index 958da7db9033..37450d9e1132 100644 --- a/drivers/pci/setup-bus.c +++ b/drivers/pci/setup-bus.c @@ -1523,8 +1523,6 @@ static void pci_bridge_release_resources(struct pci_bus *bus, { struct pci_dev *dev = bus->self; struct resource *r; - unsigned long type_mask = IORESOURCE_IO | IORESOURCE_MEM | - IORESOURCE_PREFETCH | IORESOURCE_MEM_64; unsigned old_flags = 0; struct resource *b_res; int idx = 1; @@ -1567,7 +1565,7 @@ static void pci_bridge_release_resources(struct pci_bus *bus, */ release_child_resources(r); if (!release_resource(r)) { - type = old_flags = r->flags & type_mask; + type = old_flags = r->flags & PCI_RES_TYPE_MASK; dev_printk(KERN_DEBUG, &dev->dev, "resource %d %pR released\n", PCI_BRIDGE_RESOURCES + idx, r); /* keep the old size */ @@ -1758,8 +1756,6 @@ void pci_assign_unassigned_root_bus_resources(struct pci_bus *bus) enum release_type rel_type = leaf_only; LIST_HEAD(fail_head); struct pci_dev_resource *fail_res; - unsigned long type_mask = IORESOURCE_IO | IORESOURCE_MEM | - IORESOURCE_PREFETCH | IORESOURCE_MEM_64; int pci_try_num = 1; enum enable_type enable_local; @@ -1818,7 +1814,7 @@ void pci_assign_unassigned_root_bus_resources(struct pci_bus *bus) */ list_for_each_entry(fail_res, &fail_head, list) pci_bus_release_bridge_resources(fail_res->dev->bus, - fail_res->flags & type_mask, + fail_res->flags & PCI_RES_TYPE_MASK, rel_type); /* restore size and flags */ @@ -1862,8 +1858,6 @@ void pci_assign_unassigned_bridge_resources(struct pci_dev *bridge) LIST_HEAD(fail_head); struct pci_dev_resource *fail_res; int retval; - unsigned long type_mask = IORESOURCE_IO | IORESOURCE_MEM | - IORESOURCE_PREFETCH | IORESOURCE_MEM_64; again: __pci_bus_size_bridges(parent, &add_list); @@ -1889,7 +1883,7 @@ void pci_assign_unassigned_bridge_resources(struct pci_dev *bridge) */ list_for_each_entry(fail_res, &fail_head, list) pci_bus_release_bridge_resources(fail_res->dev->bus, - fail_res->flags & type_mask, + fail_res->flags & PCI_RES_TYPE_MASK, whole_subtree); /* restore size and flags */