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: 689975 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 3t7b8k3zDLz9t0q for ; Wed, 2 Nov 2016 02:42:45 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=GJ2n8k/9; dkim-atps=neutral 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 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,