From patchwork Tue Aug 7 16:11:01 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiang Liu X-Patchwork-Id: 175704 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id BEED02C00A3 for ; Wed, 8 Aug 2012 02:22:10 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755804Ab2HGQVl (ORCPT ); Tue, 7 Aug 2012 12:21:41 -0400 Received: from mail-pb0-f46.google.com ([209.85.160.46]:51364 "EHLO mail-pb0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755802Ab2HGQVk (ORCPT ); Tue, 7 Aug 2012 12:21:40 -0400 Received: by mail-pb0-f46.google.com with SMTP id rr13so4529963pbb.19 for ; Tue, 07 Aug 2012 09:21:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=bRerahf6xS/9F66dh8imohwSk5Gta5jTGKIXvzQy8Io=; b=QM0zwPMg7pFtXb0EP7PC13ZsRyMz6VRGh+yhSrfEU5BSmXF0v3m+UC8KEKFiTUGnhz MO7NQw0BUELmdngHNvUJsRwZGZh/O9htZ4yaIkf+xk5bvqimYGTSkoKXnlB64BeNRTQu 3269ClYbmUv8vOmqhyrl4CstEnhzDe2f2UXi6TcAt7Z1qZGU1q392r7eboYsSltvsUVK +X5NnhOWYHP5ijX6ej2jXK7fXx5poHu2O3CZDNvnhhmoemJCK/9arEJvqEwmVmNwq+jw FP0aQjiF/b+HZNLh11YL3+CmTKwEsMxZuhEr5ND3h3N3ypGrkKFVdmz2fQpXELF4QMpr C75Q== Received: by 10.68.200.138 with SMTP id js10mr29417544pbc.23.1344356499990; Tue, 07 Aug 2012 09:21:39 -0700 (PDT) Received: from localhost.localdomain ([58.250.81.2]) by mx.google.com with ESMTPS id pt2sm11429362pbb.58.2012.08.07.09.21.30 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 07 Aug 2012 09:21:37 -0700 (PDT) From: Jiang Liu To: Bjorn Helgaas , Don Dutile , Yinghai Lu , Greg KH , Kenji Kaneshige Cc: Jiang Liu , Taku Izumi , "Rafael J . Wysocki" , Yijing Wang , Xinwei Hu , linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, Jiang Liu Subject: [RFC PATCH v1 21/22] PCI: cleanups for PCI bus lock implementation Date: Wed, 8 Aug 2012 00:11:01 +0800 Message-Id: <1344355862-2726-22-git-send-email-jiang.liu@huawei.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1344355862-2726-1-git-send-email-jiang.liu@huawei.com> References: <1344355862-2726-1-git-send-email-jiang.liu@huawei.com> Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org Now all Archs have been converted to the new PCI bus lock mechanism, so clean up unused code. Signed-off-by: Jiang Liu --- drivers/pci/Kconfig | 3 --- drivers/pci/bus.c | 1 - drivers/pci/pci-sysfs.c | 9 --------- drivers/pci/probe.c | 4 +--- include/linux/pci.h | 10 ---------- 5 files changed, 1 insertion(+), 26 deletions(-) diff --git a/drivers/pci/Kconfig b/drivers/pci/Kconfig index 5a796c0..848bfb8 100644 --- a/drivers/pci/Kconfig +++ b/drivers/pci/Kconfig @@ -120,6 +120,3 @@ config PCI_IOAPIC config PCI_LABEL def_bool y if (DMI || ACPI) select NLS - -config PCI_BUS_LOCK - def_bool y if (X86 || IA64) diff --git a/drivers/pci/bus.c b/drivers/pci/bus.c index 371f20a..308c376 100644 --- a/drivers/pci/bus.c +++ b/drivers/pci/bus.c @@ -196,7 +196,6 @@ int pci_bus_add_child(struct pci_bus *bus) pci_create_legacy_files(bus); pci_bus_change_state(bus, PCI_BUS_STATE_INITIALIZED, PCI_BUS_STATE_WORKING, false); - bus->is_added = 1; } } diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c index 11043b4..a5a4195 100644 --- a/drivers/pci/pci-sysfs.c +++ b/drivers/pci/pci-sysfs.c @@ -284,7 +284,6 @@ msi_bus_store(struct device *dev, struct device_attribute *attr, } #ifdef CONFIG_HOTPLUG -static DEFINE_MUTEX(pci_remove_rescan_mutex); static ssize_t bus_rescan_store(struct bus_type *bus, const char *buf, size_t count) { @@ -296,13 +295,11 @@ static ssize_t bus_rescan_store(struct bus_type *bus, const char *buf, if (val) { pci_host_bridge_hotplug_lock(); - mutex_lock(&pci_remove_rescan_mutex); while ((b = pci_find_next_bus(b)) != NULL) if (pci_bus_lock_states(b, PCI_BUS_STATE_WORKING) > 0) { pci_rescan_bus(b); pci_bus_unlock(b); } - mutex_unlock(&pci_remove_rescan_mutex); pci_host_bridge_hotplug_unlock(); } return count; @@ -326,13 +323,11 @@ dev_rescan_store(struct device *dev, struct device_attribute *attr, if (val) { struct pci_bus *bus = pdev->bus; - mutex_lock(&pci_remove_rescan_mutex); if (pci_bus_lock_states(bus, PCI_BUS_STATE_WORKING) > 0) { if (pdev->is_added) pci_rescan_bus(bus); pci_bus_unlock(bus); } - mutex_unlock(&pci_remove_rescan_mutex); } return count; } @@ -342,13 +337,11 @@ static void remove_callback(struct device *dev) struct pci_dev *pdev = to_pci_dev(dev); struct pci_bus *bus = pdev->bus; - mutex_lock(&pci_remove_rescan_mutex); if (pci_bus_lock_states(bus, PCI_BUS_STATE_WORKING) > 0) { pci_bus_get(bus); pci_stop_and_remove_bus_device(pdev); pci_unlock_and_put_bus(bus); } - mutex_unlock(&pci_remove_rescan_mutex); } static ssize_t @@ -382,14 +375,12 @@ dev_bus_rescan_store(struct device *dev, struct device_attribute *attr, return -EINVAL; if (val) { - mutex_lock(&pci_remove_rescan_mutex); if (!pci_is_root_bus(bus)) pci_rescan_bus_bridge_resize(bus->self); else if (pci_bus_lock_states(bus, PCI_BUS_STATE_WORKING) > 0) { pci_rescan_bus(bus); pci_bus_unlock(bus); } - mutex_unlock(&pci_remove_rescan_mutex); } return count; } diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index da6f04c..09517c3 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c @@ -1626,11 +1626,9 @@ unsigned int __devinit pci_scan_child_bus(struct pci_bus *bus) if (pci_bus_get_state(bus) < PCI_BUS_STATE_WORKING) { dev_dbg(&bus->dev, "fixups for bus\n"); pcibios_fixup_bus(bus); - if (pci_is_root_bus(bus)) { + if (pci_is_root_bus(bus)) pci_bus_change_state(bus, PCI_BUS_STATE_REGISTERED, PCI_BUS_STATE_WORKING, false); - bus->is_added = 1; - } } for (pass=0; pass < 2; pass++) diff --git a/include/linux/pci.h b/include/linux/pci.h index 9e52e88..0e50ec8 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -442,7 +442,6 @@ struct pci_bus { struct device dev; struct bin_attribute *legacy_io; /* legacy I/O for this bus */ struct bin_attribute *legacy_mem; /* legacy mem */ - unsigned int is_added:1; atomic_t state; }; @@ -463,21 +462,12 @@ struct pci_bus { #define PCI_BUS_STATE_DESTROYED 0x40 /* invalid state */ #define PCI_BUS_STATE_MASK 0x7F -#ifdef CONFIG_PCI_BUS_LOCK #define PCI_BUS_STATE_LOCK 0x10000 /* for pci core only */ static inline bool pci_bus_is_locked(struct pci_bus *bus) { return !!(atomic_read(&bus->state) & PCI_BUS_STATE_LOCK); } -#else /* CONFIG_PCI_BUS_LOCK */ -#define PCI_BUS_STATE_LOCK 0x0000 /* for pci core only */ - -static inline bool pci_bus_is_locked(struct pci_bus *bus) -{ - return true; -} -#endif /* CONFIG_PCI_BUS_LOCK */ static inline int pci_bus_get_state(struct pci_bus *bus) {