From patchwork Tue Nov 1 15:42:32 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emil Velikov X-Patchwork-Id: 9407537 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 942CE60234 for ; Tue, 1 Nov 2016 15:42:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 864FF29A1A for ; Tue, 1 Nov 2016 15:42:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7AF8429A1D; Tue, 1 Nov 2016 15:42:46 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E66B529A1C for ; Tue, 1 Nov 2016 15:42:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750712AbcKAPmn (ORCPT ); Tue, 1 Nov 2016 11:42:43 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:35265 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750696AbcKAPmm (ORCPT ); Tue, 1 Nov 2016 11:42:42 -0400 Received: by mail-wm0-f66.google.com with SMTP id 68so16495044wmz.2; Tue, 01 Nov 2016 08:42:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=ni4MMw7ocC1Y7s35uCkUfL+NYLt8lDUOyqaCICpuEJY=; b=GJ2n8k/9G7+/3o0Wz/Q38+wkzQWHYBqM8cKnoqxk4cxsHi4QV8okqq8P8rCoTiBJky GOf5MQOvi5KoqmXP59Y5nlDDvj7t08cD3La0a1uvv2H0teenQm5OkIyxXxtIaQAQpN3a yxp69el4jYIyqJF6rBg37RqJHhDyNE4Nr/iLJ+2VI7Mj0A0iQLlY9RQbFO7BHgZ/AwO1 iXXPlyGFUnjt5S0W8b883fvB61LJqvWmcRUjGoLffYNTZi/8jwdhblpHCAnVSnPXLk0+ OKLqqd3qy55T1+yEPD2ncuf54IYPjiqHF8VGVmf12roRY81g25bLU6gCH7ZG9u9eTLnT KGMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=ni4MMw7ocC1Y7s35uCkUfL+NYLt8lDUOyqaCICpuEJY=; b=Fwgc/e5so1BLuzGvQBxaM7/N0ctE9Tzhj4hbmS1/s8VAfE6oMDIvFSGNUaf4H+d/G0 OCmrmkPAOuKaOfri3N1QULYpPPk6oA1vCIYBIypO/ttrMLWtt8KJHvUyxMvYO0gC9Ym9 AuYaRX7/Dgo4ZTcGHpWgropzCJLA2neJM/dt+LuVLh+o0FkP107+bgPN6vkn2ZfpOtVP WCPhIws1XwD4FV+nTPMlnzYyx7iR7B19ECnhRieDoFvkIwN92Rg077KqIZ0ZSAXR/pN5 kdKB/xOumNUGq1fKmq2+auAE7B/kvjb2llcCg65LX7ZGNIGT/5nDWND0e73Ry+Zs0Wte hlYQ== X-Gm-Message-State: ABUngvfl1YeOZ4RfrYO2+iQZXRjUq+i23tcsM+RfFvxBEevLEEmQ7BiPDeeiWkhfxbwFFw== X-Received: by 10.28.111.71 with SMTP id k68mr2007016wmc.109.1478014960905; Tue, 01 Nov 2016 08:42:40 -0700 (PDT) Received: from arch-x220.cbg.collabora.co.uk ([2a00:1098:5:0:120b:a9ff:fe8d:c914]) by smtp.gmail.com with ESMTPSA id a1sm36283640wjl.28.2016.11.01.08.42.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 01 Nov 2016 08:42:40 -0700 (PDT) From: Emil Velikov To: dri-devel@lists.freedesktop.org Cc: emil.l.velikov@gmail.com, Jammy Zhou , =?UTF-8?q?Michel=20D=C3=A4nzer?= , Bjorn Helgaas , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] PCI: create revision file in sysfs Date: Tue, 1 Nov 2016 15:42:32 +0000 Message-Id: <20161101154232.6451-1-emil.l.velikov@gmail.com> X-Mailer: git-send-email 2.9.3 MIME-Version: 1.0 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Emil Velikov Currently the revision isn't available via sysfs/libudev thus if one wants to know the value they need to read through the config file. This in itself wakes/powers up the device, causing unwanted delay since it can be quite costly. Expose the revision as a separate file, just like we do for the device, vendor, their subsystem version and class. Cc: Jammy Zhou Cc: Michel Dänzer Cc: Bjorn Helgaas Cc: linux-pci@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Emil Velikov Reviewed-by: Alex Deucher --- Gents, I'm not subscribed to the mailing list so please keep me in the CC chain. Thanks Emil --- drivers/pci/pci-sysfs.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c index bcd10c7..0666287 100644 --- a/drivers/pci/pci-sysfs.c +++ b/drivers/pci/pci-sysfs.c @@ -50,6 +50,7 @@ pci_config_attr(vendor, "0x%04x\n"); pci_config_attr(device, "0x%04x\n"); pci_config_attr(subsystem_vendor, "0x%04x\n"); pci_config_attr(subsystem_device, "0x%04x\n"); +pci_config_attr(revision, "0x%02x\n"); pci_config_attr(class, "0x%06x\n"); pci_config_attr(irq, "%u\n"); @@ -568,6 +569,7 @@ static struct attribute *pci_dev_attrs[] = { &dev_attr_device.attr, &dev_attr_subsystem_vendor.attr, &dev_attr_subsystem_device.attr, + &dev_attr_revision.attr, &dev_attr_class.attr, &dev_attr_irq.attr, &dev_attr_local_cpus.attr,