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: 9407535 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 9CD7460234 for ; Tue, 1 Nov 2016 15:42:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8E52A29A1A for ; Tue, 1 Nov 2016 15:42:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8256129A27; Tue, 1 Nov 2016 15:42:45 +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=-4.1 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id A794929A1A for ; Tue, 1 Nov 2016 15:42:43 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1E4FE89650; Tue, 1 Nov 2016 15:42:43 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm0-x241.google.com (mail-wm0-x241.google.com [IPv6:2a00:1450:400c:c09::241]) by gabe.freedesktop.org (Postfix) with ESMTPS id 43E3C89650 for ; Tue, 1 Nov 2016 15:42:42 +0000 (UTC) Received: by mail-wm0-x241.google.com with SMTP id c17so23199026wmc.3 for ; Tue, 01 Nov 2016 08:42:42 -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=iF1i/qlk1aN7c7m3VHTG/9OfSneHTg9C8bZ1Q5HMd54BaTldzlIOUjAg2jmymi4Xhe nCYOS9HYX4NhO2baVlk48iO6ecGaYxvWgTTOEUnDYtSrgO5HavdbSXnsWrR4MAmXOC/w sOL67JT6OhU+AtOKwiUafqt/rGS2pXbKAGOknisTUYSTjd6pCBhdfbfNbXr2LnqmDzkN LIUSPvg/orK/dk+ZdwSPqpaV9p/2XFEvgTTdGFp6PuqXvGW4yiz/0zQxL1liX20/RL/L 9HXWxHkkw2XfAtxQihSYFVpvV/QKLo7StkWo6iAtTqdMF4VMjbuIfz+b8npXuukhu8Bh Slsw== X-Gm-Message-State: ABUngvfWPlw1dN3ktJ5SlHz2/Sn1h9w5Sfjm06DG5vHrN4eFC8RuRgOxNFIuxpgDhmGWjw== 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 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 Cc: Jammy Zhou , emil.l.velikov@gmail.com, =?UTF-8?q?Michel=20D=C3=A4nzer?= , linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, Bjorn Helgaas X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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,