From patchwork Fri Apr 12 15:44:15 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiang Liu X-Patchwork-Id: 2436561 Return-Path: X-Original-To: patchwork-linux-acpi@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 6CCA23FD1A for ; Fri, 12 Apr 2013 15:46:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753893Ab3DLPqO (ORCPT ); Fri, 12 Apr 2013 11:46:14 -0400 Received: from mail-pa0-f42.google.com ([209.85.220.42]:37451 "EHLO mail-pa0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752847Ab3DLPqM (ORCPT ); Fri, 12 Apr 2013 11:46:12 -0400 Received: by mail-pa0-f42.google.com with SMTP id kq13so1535442pab.1 for ; Fri, 12 Apr 2013 08:46:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=k6zcmaK989x5Liqn0bQ2xqZygcj7sgT4YjNdCY8b0FM=; b=q9vPYKRCjE/zzOud8i0Hf27LHqIbyg70xt1fYEAAXuzn78rrM3JoVKSCBurDMQnx9K CUyDIgtT/JcGHbYgQ7aYZcPkYfAEY+wIh9J3KSUBgW9OLXetRwQQoJ9Xeg8vHrXDgnfT FOPfUpELRLhQ9LgSe7T7mbsYz4lBTFCudFxyqxIzSvYOPu+vkskXvqPVE57ZSaXZW0+K lJmrcwQi9ryoWC/RTbvamlpu+nPNkO5G5SRSuBOZxncIGSi5itGVnG2hruXWMgFX/3x+ ki0r0nJS+fTY8ZIhQzOzaq9Qg0DtSHfm7fyVaFllTeRjmBPcKhA5ylAHT0NGKBwVDDPY QEuQ== X-Received: by 10.66.76.170 with SMTP id l10mr15920887paw.190.1365781572006; Fri, 12 Apr 2013 08:46:12 -0700 (PDT) Received: from localhost.localdomain ([114.250.74.212]) by mx.google.com with ESMTPS id wz9sm9048741pbc.5.2013.04.12.08.46.04 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 12 Apr 2013 08:46:11 -0700 (PDT) From: Jiang Liu To: Bjorn Helgaas , "Rafael J . Wysocki" Cc: Jiang Liu , Yinghai Lu , Yijing Wang , Jiang Liu , linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, Greg Kroah-Hartman , ACPI Devel Maling List , Toshi Kani , Myron Stowe , "Rafael J. Wysocki" Subject: [PATCH v9 01/16] PCI: do not check is_added flag in pci_remove_bus() Date: Fri, 12 Apr 2013 23:44:15 +0800 Message-Id: <1365781470-32379-2-git-send-email-jiang.liu@huawei.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1365781470-32379-1-git-send-email-jiang.liu@huawei.com> References: <1365781470-32379-1-git-send-email-jiang.liu@huawei.com> Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org The is_added flag in struct pci_bus is always set after invoking device_register() and pci_create_legacy_files(). The related code paths are: 1) pci_create_root_bus() and pci_add_new_bus() bus = pci_alloc_bus() device_register(&bus->dev) pci_create_legacy_file(bus) 2.a) pci_scan_child_bus(bus) set is_added flag for PCI root buses 2.b) pci_bus_add_devices(bus) set is_added flag for normal PCI buses So pci_remove_bus() shouldn't use is_added flag to guard invoking of pci_remove_lagecy_files() and device_unregister(). Signed-off-by: Jiang Liu Signed-off-by: Yijing Wang Cc: Yinghai Lu Cc: "Rafael J. Wysocki" Cc: Toshi Kani Cc: linux-pci@vger.kernel.org Cc: linux-kernel@vger.kernel.org --- drivers/pci/remove.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/pci/remove.c b/drivers/pci/remove.c index cc875e6..a831880 100644 --- a/drivers/pci/remove.c +++ b/drivers/pci/remove.c @@ -50,9 +50,6 @@ void pci_remove_bus(struct pci_bus *bus) list_del(&bus->node); pci_bus_release_busn_res(bus); up_write(&pci_bus_sem); - if (!bus->is_added) - return; - pci_remove_legacy_files(bus); device_unregister(&bus->dev); }