From patchwork Tue Feb 26 15:25:43 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiang Liu X-Patchwork-Id: 2186061 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Original-To: patchwork-linux-pci@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 B2FEB3FCF2 for ; Tue, 26 Feb 2013 15:34:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759651Ab3BZPa4 (ORCPT ); Tue, 26 Feb 2013 10:30:56 -0500 Received: from mail-pb0-f44.google.com ([209.85.160.44]:42479 "EHLO mail-pb0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759734Ab3BZPay (ORCPT ); Tue, 26 Feb 2013 10:30:54 -0500 Received: by mail-pb0-f44.google.com with SMTP id wz12so2426614pbc.17 for ; Tue, 26 Feb 2013 07:30:53 -0800 (PST) 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=mgbvDyG9uhVTwYr3ZsYob0COg64ZY7twhd4brJi+ysU=; b=g/4x3WksmK92vKLAf9N1w+fcjCMwJUwULcZNrjVq8ai00Ux+/A/+oTLZW6YsgS5pkH OQbLyBDbNXKwpVAiP2g5qqOuO0G7eq0tmBMRF+fRBgS28ohHtcgMGoCdyRts0FRA287o JAJe03IN73zV5y5ofGXnz1HpPSX5Ol6dD/yLQx4wY9uBG1iTJ6J13B6lx1139YBuDls9 TvaOwlZg2UCXtTyyVDR2zZY3AXdUIVB6GZK3gjzzoXLW/k7ayjlhNapRKspeRxJ2S19R 51XRNLI7SIXz4kjSgw235k15pxyPCuuZprGPrACvudy74U423b8yqS/R3VR5nKsUhMre QXKw== X-Received: by 10.68.48.227 with SMTP id p3mr24248079pbn.34.1361892653686; Tue, 26 Feb 2013 07:30:53 -0800 (PST) Received: from localhost.localdomain ([114.250.77.63]) by mx.google.com with ESMTPS id gg7sm1229055pbc.45.2013.02.26.07.30.46 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 26 Feb 2013 07:30:52 -0800 (PST) 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 v8 03/13] PCI/acpiphp: don't rely on function 0 in disable_device() Date: Tue, 26 Feb 2013 23:25:43 +0800 Message-Id: <1361892353-14786-4-git-send-email-jiang.liu@huawei.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1361892353-14786-1-git-send-email-jiang.liu@huawei.com> References: <1361892353-14786-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 Currently function disable_device() detects slot state by checking existence of PCI device for function 0. It's unreliable because PCI device for function 0 may be removed through sysfs interface. If that happens, it will cause powering off a hotplug slot without destroying all PCI devices. On the other hand, it won't hurt us except wasting some computation power if the check is removed, because all code of disable_device() is self-protected. So remove the check. 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/hotplug/acpiphp_glue.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c index 514851d8..4101c15 100644 --- a/drivers/pci/hotplug/acpiphp_glue.c +++ b/drivers/pci/hotplug/acpiphp_glue.c @@ -918,13 +918,6 @@ static int disable_device(struct acpiphp_slot *slot) struct pci_dev *pdev; struct pci_bus *bus = slot->bridge->pci_bus; - /* The slot will be enabled when func 0 is added, so check - func 0 before disable the slot. */ - pdev = pci_get_slot(bus, PCI_DEVFN(slot->device, 0)); - if (!pdev) - goto err_exit; - pci_dev_put(pdev); - list_for_each_entry(func, &slot->funcs, sibling) { if (func->bridge) { /* cleanup p2p bridges under this P2P bridge */