From patchwork Fri Apr 12 15:44:18 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiang Liu X-Patchwork-Id: 2436991 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Original-To: patchwork-linux-pci@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 70E40DF2A1 for ; Fri, 12 Apr 2013 15:50:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755155Ab3DLPqh (ORCPT ); Fri, 12 Apr 2013 11:46:37 -0400 Received: from mail-pb0-f47.google.com ([209.85.160.47]:63944 "EHLO mail-pb0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755931Ab3DLPqe (ORCPT ); Fri, 12 Apr 2013 11:46:34 -0400 Received: by mail-pb0-f47.google.com with SMTP id rq13so1477218pbb.6 for ; Fri, 12 Apr 2013 08:46:33 -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=h9FGEJrVeu/7UHv+qEDfgsSRF/t/7O4ivUeTUIkOlrw=; b=sSfFB4xZdsH2NLuPiCA7YF8H5w7gTd9ZEPjc0kVi0FM9xW8rC8sr2PQVK8QYtVqEAm /yb+E+hQmfAuldHYfyE5Sn4eNvPXW/n1cvmX5Tn/iLzKyyAy5v9AGVUWFkXeVs+9dyuo 8P90hOfuU9vmKJCge0jZFWyr2YoJBDgbqI85/3Z34p4NTJuy8lv63bHyF6db8GdHzkwO AG8Ie3sCKLY+C1dSLR8DF70u40Dg9IB3NyAvAzYaS4VPj/jCOLOHrxFQzEFXWZQdKLJ9 XW8wZNCFy6tXpEYloeigUl+yOQU435h5ITOOrTR4Vtq74C/tWVd++kMEJeQxmYHYCGBg rZMw== X-Received: by 10.66.248.99 with SMTP id yl3mr16321784pac.134.1365781593791; Fri, 12 Apr 2013 08:46:33 -0700 (PDT) Received: from localhost.localdomain ([114.250.74.212]) by mx.google.com with ESMTPS id wz9sm9048741pbc.5.2013.04.12.08.46.26 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 12 Apr 2013 08:46:32 -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 04/16] PCI/acpiphp: don't rely on function 0 in disable_device() Date: Fri, 12 Apr 2013 23:44:18 +0800 Message-Id: <1365781470-32379-5-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-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 7948bc9..a1c8dd6 100644 --- a/drivers/pci/hotplug/acpiphp_glue.c +++ b/drivers/pci/hotplug/acpiphp_glue.c @@ -914,13 +914,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 */