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: 10014735 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 C441C60211 for ; Wed, 18 Oct 2017 13:58:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B9DDE28B68 for ; Wed, 18 Oct 2017 13:58:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AEEDC28B6B; Wed, 18 Oct 2017 13:58:34 +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=-4.1 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 2413D28B68 for ; Wed, 18 Oct 2017 13:58:34 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9D5A06E8BE; Wed, 18 Oct 2017 13:58:29 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wr0-x243.google.com (mail-wr0-x243.google.com [IPv6:2a00:1450:400c:c0c::243]) by gabe.freedesktop.org (Postfix) with ESMTPS id 651D16E8B2; Wed, 18 Oct 2017 13:58:28 +0000 (UTC) Received: by mail-wr0-x243.google.com with SMTP id k7so5135997wre.2; Wed, 18 Oct 2017 06:58:28 -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=cb5eYc66hBZb31ggtrSASlGxdaC/k9pP3kYUVOYuJGleakY+2P+YeByYULN1wQ/IH4 HHIS4X1POa+CFtJ9r2isBgehrvP9cU/3Rdb+MOT1bOX+CYJWVLhbJb4cbnvM7tp2wQNM aRX/HZNG4o79N7QrxVrPgxosbaFCL+iyT7yB59eppoDx7rlUkRs3kH1L0spSWbTl2JTX cCLcKHGjl7IY512V+HkXwB0ztU6pH8MUFd4pbkIMOhs1tczm1FPvgaf7dDyxDzlU1qaP S7c6o1c+65CVWArGBwLQUM9SPzQGw4db/FhnYM8xK7Km9gbbhV9F+bskkVAxhCsF0Lwe Lbww== X-Gm-Message-State: AMCzsaVqrqkJaPdiX8aT5/ip8AHlB8U21BDkB8FITIdZRkgZ4VMTn/Y+ 659KkD5cI7zLTvHeJQRR2Fw= 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 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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 */