From patchwork Tue Nov 5 23:29:03 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Helgaas X-Patchwork-Id: 3144301 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Original-To: patchwork-linux-pci@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id A04B49F3C4 for ; Tue, 5 Nov 2013 23:29:10 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A9015205E2 for ; Tue, 5 Nov 2013 23:29:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DB5EA205AD for ; Tue, 5 Nov 2013 23:29:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755850Ab3KEX3G (ORCPT ); Tue, 5 Nov 2013 18:29:06 -0500 Received: from mail-ie0-f181.google.com ([209.85.223.181]:40679 "EHLO mail-ie0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755842Ab3KEX3G (ORCPT ); Tue, 5 Nov 2013 18:29:06 -0500 Received: by mail-ie0-f181.google.com with SMTP id ar20so15744072iec.26 for ; Tue, 05 Nov 2013 15:29:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=subject:to:from:cc:date:message-id:user-agent:mime-version :content-type:content-transfer-encoding; bh=ZR7V8ZCmIgZqgC26Pw5OjkD+lHyBQhSksHHOo8ovYa0=; b=SwVEX8lb/tIXPgatthIzDPbQy13qQm4v+pkpkj1DhTeoJ1rTmdo4F/YBqYg2F5HrGY 27x4qwf6lugF7uCVPP4kneGHvCYjkjKtp2rzWUTReqGnaVha3DMk/spDyqxcTT1EhSFy 2rCggZPKV/h1v6yykNs6YQAXQWZl5rndMa0zSLspS11wQQilqY9Wu+FUtDBMZnFGjfcN 05v7F4dKlMj7U3/ttGnN+lJ/bpg48goAjP/L8X0+m8bEjohpA9Gy55tqXq48b6LoB7E4 UaduGgvkVMVol4QPUll+aXGzXNaJlpjHgvIJMO0T7VFIuRMKihZFMa39JGe8GV8RI0K2 bVMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:from:cc:date:message-id:user-agent :mime-version:content-type:content-transfer-encoding; bh=ZR7V8ZCmIgZqgC26Pw5OjkD+lHyBQhSksHHOo8ovYa0=; b=kfkbQIAo641HEl+gu6ttOApaNuJ7O5AVPZL2t/ai7HFARjOGkAbSDfGSo12TSPI6Sc nahkWGDQsc2UCOuIpqtg8OiQKmELkVshi0eot44ZSLRCZZcWYuhm9dOLT4xPF8zGhPg5 HxFrC37z18cv7UVjsd2wDpSjD/9vS1aqcqu8daIBaiJg/x4ZYiDsJH+Qc6s+SnauMlLp 5pO3C2pcPwfRaJhXKs3KVEh9z8QVx6Aet2FQkTPj9l5aaQPst8SrSHfY4ixiFvL1NLaZ pX5eqGC1yLL0pQJcoUNFsiOYrSOTCjEJRaLrhaLrq0Uc98RQOiDYlDYcurMt27oVjRS0 zXjw== X-Gm-Message-State: ALoCoQn2ZUWCttYeSEm3RaptKp3TP1OUIhI8dBKx9Ja7mukaqYcgtSsl/5i0knWmpHN9ntJD28VFr2pUBjeAJIIDR/I+ZrfCdFDtPUB/YVPjm3oYpCYh+6NGh7VjbUoiICXqetBhqGbBiUA0Xt4tHuZZfm4biS1w5CfNy7y2r90r3M2d6iZBCmWDrT2lEht1DlL+vcVMeWW+WC0wIzVQZKiyMeELse53nwxz1rs9Z+lPbIHPW4hXpNc= X-Received: by 10.42.126.18 with SMTP id c18mr103436ics.46.1383694144808; Tue, 05 Nov 2013 15:29:04 -0800 (PST) Received: from localhost ([172.16.55.118]) by mx.google.com with ESMTPSA id j16sm10927685igf.6.2013.11.05.15.29.04 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 05 Nov 2013 15:29:04 -0800 (PST) Subject: [PATCH] PCI: Use pci_is_root_bus() to check for root bus To: linux-pci@vger.kernel.org From: Bjorn Helgaas Cc: Wei Yang , Yinghai Lu Date: Tue, 05 Nov 2013 16:29:03 -0700 Message-ID: <20131105232903.3790.8738.stgit@bhelgaas-glaptop.roam.corp.google.com> User-Agent: StGit/0.16 MIME-Version: 1.0 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP pci_enable_device_flags() and pci_enable_bridge() assume that "bus->self == NULL" means that "bus" is a root bus. That assumption is false; see 2ba29e270e97 ("PCI: Use pci_is_root_bus() to check for root bus") for details. This patch changes them to use pci_is_root_bus() instead. Signed-off-by: Bjorn Helgaas --- drivers/pci/pci.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-pci" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index ac40f90..de65bf7 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -1150,10 +1150,8 @@ static void pci_enable_bridge(struct pci_dev *dev) { int retval; - if (!dev) - return; - - pci_enable_bridge(dev->bus->self); + if (!pci_is_root_bus(dev->bus)) + pci_enable_bridge(dev->bus->self); if (pci_is_enabled(dev)) { if (!dev->is_busmaster) @@ -1188,7 +1186,8 @@ static int pci_enable_device_flags(struct pci_dev *dev, unsigned long flags) if (atomic_inc_return(&dev->enable_cnt) > 1) return 0; /* already enabled */ - pci_enable_bridge(dev->bus->self); + if (!pci_is_root_bus(dev->bus)) + pci_enable_bridge(dev->bus->self); /* only skip sriov related */ for (i = 0; i <= PCI_ROM_RESOURCE; i++)