From patchwork Tue May 2 10:55:40 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sujith Pandel X-Patchwork-Id: 757548 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 3wHJ9v3PKXz9ryZ for ; Tue, 2 May 2017 20:56:03 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="TlnUcy6l"; dkim-atps=neutral Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750912AbdEBK4C (ORCPT ); Tue, 2 May 2017 06:56:02 -0400 Received: from mail-pf0-f195.google.com ([209.85.192.195]:36050 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750789AbdEBK4B (ORCPT ); Tue, 2 May 2017 06:56:01 -0400 Received: by mail-pf0-f195.google.com with SMTP id v14so32327233pfd.3 for ; Tue, 02 May 2017 03:56:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :user-agent; bh=bBuzXkbWsQaTlqSBA8UqIauoejGQWqzzvU383bnL9dU=; b=TlnUcy6lEenfLrBK0WoxQCgz9C1PGq8bNYjKqvkivP0rcKXKDNqGaa4vF7WU9q0ZGM xv8bHvj2GUTs2mRdmUnV/rX9vdecaH+/GCnZRPIH74I73c8tHoYBCOoWkPHaW1MiP3bO MVbzjuD1+dF81r1nlxPyjkTcaqFyRbH0bE8jQt2++9juEKmB2MUnwo75SjEsQeMOG8jl S9RCTcnic5XrVUtXp1r/yAYU19ZU8DL37tMlIuY8xANd19UX38UqsHJ5sNrLRUTfKKQ0 6dIwBkokg6U9HrrcNZ22Vw4E5ZKuRXy9i4EpL2WoGDoIi6nwcfzAwl+2JBU4EGxqyeK6 Ijng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:user-agent; bh=bBuzXkbWsQaTlqSBA8UqIauoejGQWqzzvU383bnL9dU=; b=RsQ/yNEYjlXGDk5zhhf6FsotfQ4awzp0ghXFQHoC/dolKfYxXR0ZSIHxyy6kK/em+7 /hr8zhE6P6Mt8BGucgQNuTpxdUC8VL/BzJt9kDGsefMzM1vSZ0SIGFUq7kuS7sXcNR+3 wPy8bI5LhSxsGvEzjS+VVLWn+RfRJC8prIaypx2kVTh8tP6TaQ78EMk4/nO4pzsjAE+O GQOa41kpiGPQLswxyJGLTNvKjx08aj8m92l+AYCq1NnLsUBfCGRuE2zl2UrkZcND16K0 0QBCNhExiB6XuOV66Mu+kxYxm/SPStHxcryGDH2z87kE001qcf0EBKid5/4xoL+KStLa OV0A== X-Gm-Message-State: AN3rC/76+W//ckE1kR9Sqg6+A0wNlagd9veTh33hxDAygCDp1Aq5F5zc gz3xvAOOrNiwsA== X-Received: by 10.99.6.2 with SMTP id 2mr6623192pgg.122.1493722560714; Tue, 02 May 2017 03:56:00 -0700 (PDT) Received: from localhost.localdomain ([125.23.194.242]) by smtp.gmail.com with ESMTPSA id r73sm30197996pfa.65.2017.05.02.03.55.58 (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 02 May 2017 03:56:00 -0700 (PDT) Date: Tue, 2 May 2017 06:55:40 -0400 From: Sujith Pandel To: linux-pci@vger.kernel.org Cc: Shai@ScaleMP.com, sujithpshankar@gmail.com, Narendra_K@Dell.com Subject: [PATCH] Add PCI domain number check to find_smbios_instance_string Message-ID: <20170502105540.GA36230@localhost.localdomain> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-12-10) Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org The function 'find_smbios_instance_string' does not consider the PCI domain number. As a result, SMBIOS type 41 device type instance would be exported to sysfs for all the PCI domains which have a PCI device with same bus/device/function, though PCI bus/device/func from a specific PCI domain has SMBIOS type 41 device type instance defined. Address the issue by making 'find_smbios_instance_string' function check PCI domain number as well. Reported-by: Shai Fultheim Suggested-by: Shai Fultheim Signed-off-by: Sujith Pandel Signed-off-by: Narendra K Tested-by: Shai Fultheim --- drivers/pci/pci-label.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/pci/pci-label.c b/drivers/pci/pci-label.c index 5135737..1d828a6 100644 --- a/drivers/pci/pci-label.c +++ b/drivers/pci/pci-label.c @@ -43,9 +43,11 @@ static size_t find_smbios_instance_string(struct pci_dev *pdev, char *buf, { const struct dmi_device *dmi; struct dmi_dev_onboard *donboard; + int domain_nr; int bus; int devfn; + domain_nr = pci_domain_nr(pdev->bus); bus = pdev->bus->number; devfn = pdev->devfn; @@ -53,8 +55,9 @@ static size_t find_smbios_instance_string(struct pci_dev *pdev, char *buf, while ((dmi = dmi_find_device(DMI_DEV_TYPE_DEV_ONBOARD, NULL, dmi)) != NULL) { donboard = dmi->device_data; - if (donboard && donboard->bus == bus && - donboard->devfn == devfn) { + if (donboard && donboard->segment == domain_nr && + donboard->bus == bus && + donboard->devfn == devfn) { if (buf) { if (attribute == SMBIOS_ATTR_INSTANCE_SHOW) return scnprintf(buf, PAGE_SIZE,