From patchwork Wed Jun 19 16:48:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kelsey X-Patchwork-Id: 11004793 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-2.web.codeaurora.org (Postfix) with ESMTP id B52B976 for ; Wed, 19 Jun 2019 16:51:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A651C204C1 for ; Wed, 19 Jun 2019 16:51:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9A45527CAF; Wed, 19 Jun 2019 16:51:35 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 4AD31204C1 for ; Wed, 19 Jun 2019 16:51:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730164AbfFSQve (ORCPT ); Wed, 19 Jun 2019 12:51:34 -0400 Received: from mail-io1-f66.google.com ([209.85.166.66]:39415 "EHLO mail-io1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726109AbfFSQve (ORCPT ); Wed, 19 Jun 2019 12:51:34 -0400 Received: by mail-io1-f66.google.com with SMTP id r185so81485iod.6 for ; Wed, 19 Jun 2019 09:51:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=awq0kd/pbC6/f3LB05GmM3HTWa9MlL3HqmM1yphZqrg=; b=rX1F5EmPJN5epcReG/X4jseGh+4nu0KBixKgLZaRwdZDRzSGPf3XY8fxQ0ZrkiOp41 SoE36kYh4AghaVeBq+4ThJCZLYbKgJPZ83gn+/iEtW3BUKR2BJaVDei2dHB9Oq5M8n8f f32Q2XWtbCGoKZLuqXMnfOxubXP+g3d4ZvJO8TVuzgmdefYe0ptiaX39+VZZXfOscgTU ZuDnU1JL+dQEaxezOKFLIwd5dbi5Kfma8IoAht5IOTYWshPa/3bPFXDWu/Yhw6UPWP99 Hf14kXBk/TZFgwdP7jjRFFKvxp7LBcEuvH0UhoDJkpS15fmQ5v2HHMXMlkPjn+nWK45C /oRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=awq0kd/pbC6/f3LB05GmM3HTWa9MlL3HqmM1yphZqrg=; b=MhqRBJNLAUPAMspa1HFCRAj/MvtZWENr8mDogOpavoCi/fgJYMWub458Wk5DSsUeYm wEzL6neDpMdmUxM4HzC5TBhg+gZtb1e7y/sK62e/yjxjJnc/INO+kf53ja4IyQNRlN5q 3NlZB2YHZJv4vPHmenc6/CQXcaU8mjgUI4krju0ZFEGBWh1omlwIoaUXmzXPqOlSl4Hy BDftAbe0+/yuSvaiHyqN9RyuK1cMFCh1CqSf75tNGUO08u4d6KNSOUupurKfwO+uF6KY vB2aP6fgzU2n8VsAYmlp8BG1OyOzB1DfovurKkFEewEpXeupxfHAu1kW6UVV9dzRok6s izpw== X-Gm-Message-State: APjAAAVIEfX9cAMtRCisGz0hvS4lmn4fq5MPlJ3433FIlOqaSJXtwzgo rZ0hj94Vf9SzVr44fIcK1XRMS3ayUHjS2A== X-Google-Smtp-Source: APXvYqzlhTqZhKXbvbpHsicVy14njI/mLgVFZh18QFJ/3kfiYwVmPUR+dHMOXKPkR81NwWztdR0+2A== X-Received: by 2002:a02:ce52:: with SMTP id y18mr11755763jar.78.1560963093412; Wed, 19 Jun 2019 09:51:33 -0700 (PDT) Received: from localhost.localdomain (c-73-243-191-173.hsd1.co.comcast.net. [73.243.191.173]) by smtp.gmail.com with ESMTPSA id f4sm17863408iok.56.2019.06.19.09.51.32 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 19 Jun 2019 09:51:32 -0700 (PDT) From: Kelsey Skunberg To: linux-pci@vger.kernel.org Cc: skhan@linuxfoundation.org, linux-kernel-mentees@lists.linuxfoundation.org, mj@ucw.cz, bjorn@helgaas.com, skunberg.kelsey@gmail.com Subject: [PATCH v4 1/3] lspci: Include -vvv option in help Date: Wed, 19 Jun 2019 10:48:56 -0600 Message-Id: <20190619164858.84746-2-skunberg.kelsey@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190619164858.84746-1-skunberg.kelsey@gmail.com> References: <20190619164858.84746-1-skunberg.kelsey@gmail.com> 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 Include -vvv in help message. Signed-off-by: Kelsey Skunberg --- lspci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lspci.c b/lspci.c index d63b6d0..937c6e4 100644 --- a/lspci.c +++ b/lspci.c @@ -41,7 +41,7 @@ static char help_msg[] = "-t\t\tShow bus tree\n" "\n" "Display options:\n" -"-v\t\tBe verbose (-vv for very verbose)\n" +"-v\t\tBe verbose (-vv or -vvv for higher verbosity)\n" #ifdef PCI_OS_LINUX "-k\t\tShow kernel drivers handling each device\n" #endif From patchwork Wed Jun 19 16:48:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kelsey X-Patchwork-Id: 11004795 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-2.web.codeaurora.org (Postfix) with ESMTP id 4E80876 for ; Wed, 19 Jun 2019 16:51:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3F81F201CB for ; Wed, 19 Jun 2019 16:51:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 33CFA2022B; Wed, 19 Jun 2019 16:51:37 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 D7A78204C1 for ; Wed, 19 Jun 2019 16:51:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726496AbfFSQvg (ORCPT ); Wed, 19 Jun 2019 12:51:36 -0400 Received: from mail-io1-f66.google.com ([209.85.166.66]:36844 "EHLO mail-io1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726109AbfFSQvg (ORCPT ); Wed, 19 Jun 2019 12:51:36 -0400 Received: by mail-io1-f66.google.com with SMTP id h6so128714ioh.3 for ; Wed, 19 Jun 2019 09:51:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=FFjC6CZpi0wJ+pIwQc4j+iYpRFyiXs/VvQdVulnO5iw=; b=USx+Oae19Zisth6D5xHMcGnmEMbZij3He6bC/ywRcIReP143qOjW0h2XjHSv2v74QN LW0ZJ2KoST8mAfyjCQGnDaPDP5wuy8XdOJSojep2PoIRSknwqC+hMtKA/N8XkXxx1u1i hv27Y//K2pxRHfA3fjkqNWC19boADlhY94Z584xglbcTYt3nmje1E/0/AMRGW3Pl+tFR QwXwYMlTVe/Xnvl0mbpK4YRy2sW9y/JISUf7yyLuZIyqVuebkIGXlvxAE9WMOCuOkYOH DTPrtkJwjEqPw8JTdyESUz88oVmYz9f9B7ScdpKa5/STK7PVlIXPOk5stjkKCGfmp8tu TMlA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=FFjC6CZpi0wJ+pIwQc4j+iYpRFyiXs/VvQdVulnO5iw=; b=WIA++tS10l9pCTzx9/jDnqu11kdYxAwIXCOrxpstwHbjUaxdahwTM4c8B84oL5ckwC pRIWdZvNegGyfhjPmX+Gz5HKfBDY2kETpUk4fbB5fJLJDncFYvyy2GdbsAUkbxjVZdst T5AKNZhIHEvO2nJ+pcjzt6hdLjGRdmztv/KJwp8APYx0+NpPGRMF2r3mhYslXdg2EDPC HjCt7e9rhhfJixGXSAueM27yuxGcxS09A4oT4Z5uK86YIJosMTbI7lbSsrkme4uLcWdV B2btL83dTWLCbRCVQ7NOvt0kVFA9kvFu7lXqotvt2Pi7tHD2Nmjnu9mALvgrTF2vAa5E uy3g== X-Gm-Message-State: APjAAAVm/XZtT13UcppOsARZzHCDhTLkuvuy1JNveA8Lye/M+W9Qx7D9 wl/0AC+agSGlZnuPa3x5IXFyMXUiQ9RvXQ== X-Google-Smtp-Source: APXvYqxy1pMm5DTeMcuVPWcfqF/XwCZAubscRhnJYVi0IebtkaLlYiAFIcoETLanuteaFLuLPCNMeg== X-Received: by 2002:a5d:9047:: with SMTP id v7mr179842ioq.18.1560963095027; Wed, 19 Jun 2019 09:51:35 -0700 (PDT) Received: from localhost.localdomain (c-73-243-191-173.hsd1.co.comcast.net. [73.243.191.173]) by smtp.gmail.com with ESMTPSA id f4sm17863408iok.56.2019.06.19.09.51.33 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 19 Jun 2019 09:51:34 -0700 (PDT) From: Kelsey Skunberg To: linux-pci@vger.kernel.org Cc: skhan@linuxfoundation.org, linux-kernel-mentees@lists.linuxfoundation.org, mj@ucw.cz, bjorn@helgaas.com, skunberg.kelsey@gmail.com Subject: [PATCH v4 2/3] lspci: Remove unnecessary !verbose check in show_range() Date: Wed, 19 Jun 2019 10:48:57 -0600 Message-Id: <20190619164858.84746-3-skunberg.kelsey@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190619164858.84746-1-skunberg.kelsey@gmail.com> References: <20190619164858.84746-1-skunberg.kelsey@gmail.com> 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 Remove 'if (!verbose)' code in show_range() due to not being called. show_range() will only be called when verbose is true. Additional call to check for verbosity within show_range() is dead code. !verbose was used so nothing would print if the range behind a bridge had a base > limit and verbose == false. Since show_range() will not be called when verbose == false, not printing bridge information is still accomplished. Signed-off-by: Kelsey Skunberg --- lspci.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/lspci.c b/lspci.c index 937c6e4..7418b07 100644 --- a/lspci.c +++ b/lspci.c @@ -376,17 +376,11 @@ show_size(u64 x) static void show_range(char *prefix, u64 base, u64 limit, int is_64bit) { - if (base > limit) + if (base > limit && verbose < 3) { - if (!verbose) - return; - else if (verbose < 3) - { - printf("%s: None\n", prefix); - return; - } + printf("%s: None\n", prefix); + return; } - printf("%s: ", prefix); if (is_64bit) printf("%016" PCI_U64_FMT_X "-%016" PCI_U64_FMT_X, base, limit); From patchwork Wed Jun 19 16:48:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kelsey X-Patchwork-Id: 11004797 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-2.web.codeaurora.org (Postfix) with ESMTP id 841E21398 for ; Wed, 19 Jun 2019 16:51:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7588F2012F for ; Wed, 19 Jun 2019 16:51:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 69C192022B; Wed, 19 Jun 2019 16:51:38 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 141C1201CB for ; Wed, 19 Jun 2019 16:51:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730165AbfFSQvh (ORCPT ); Wed, 19 Jun 2019 12:51:37 -0400 Received: from mail-io1-f65.google.com ([209.85.166.65]:33196 "EHLO mail-io1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728671AbfFSQvh (ORCPT ); Wed, 19 Jun 2019 12:51:37 -0400 Received: by mail-io1-f65.google.com with SMTP id u13so184867iop.0 for ; Wed, 19 Jun 2019 09:51:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=9/VY+/HxtJ6r/tUKypc3sQ2VNbSxhUCs/lSBxOu+yqE=; b=dc9GnjCnvJh9dC+V8gpqT+JQQD6h1Hmf+iN3ekFQd8nAGGK6QkK4M3UciNprQk3uwr YglJ/BkpLBqBnfaa1P18rkWcyHMrSguRGb9YBstvaVFYqNl37SwsUIGH4omGiE+S24Qt eQJYJxtgGAXDoSnqSAdOM09GIbPzoNt3fKN4Igy7cP/yDKjyGoacTwPFhVmfWqxJXsmT LVU2PUqGVWBnWV770Pc1NtaVsbh6IlKzRClqgDPEOvJoiY+TxiYXedo1z2IfCt3JjK12 zONUvnIbkmwgUfGahSZuqug5NJwrR2SloWkFc0bqKFj0UKSZkFkotxO7JCJhniP6JGc+ BlZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=9/VY+/HxtJ6r/tUKypc3sQ2VNbSxhUCs/lSBxOu+yqE=; b=Z8jo2bD8pIV6+c1Q2DnWl3qhqj70xOXWt9On5t5eO+TB4eg9x2t9FkTB4ofY0C4KWq 4tivW+hqiHpL5f0Z84WN++91R78wYgK0F0mbMhZklDFT7QMklNDnE1lQypq5GuOi202p +x0XeVJH0EgbZqE4oO3CDZcz1xYk3xi85LQb5VdoYyNrIqhPZ2e/+sgJBOnaMjzFhqmk fjOvo441LI/9xbJ+dnLKL9YBuBEMkpZIkLSmObscjKKqI/YNGsGOMvrLM09stcmEPqSu xWWtQZ5Qi46XvL+mR2wr5XVvqJbNCXYz5sHO7f8re8mXGD83fgmszsJRnqrDvFa77Igp jpmA== X-Gm-Message-State: APjAAAWl6AHjI7k1Jfde0euNdPIsFBpCJeXXrrI+ARiAyCLhNUyqIcVm oz8MvWAkE0NNkMfXSuUmWUO/NJuoXP7jsg== X-Google-Smtp-Source: APXvYqxg6VzUUrpqS273dZtQJuvzSd+ZGiVXGnaXKV1stmSzkQ9fxDRhPFIN4/MtXX+tw/vhMKqj4Q== X-Received: by 2002:a02:1006:: with SMTP id 6mr100102148jay.47.1560963096306; Wed, 19 Jun 2019 09:51:36 -0700 (PDT) Received: from localhost.localdomain (c-73-243-191-173.hsd1.co.comcast.net. [73.243.191.173]) by smtp.gmail.com with ESMTPSA id f4sm17863408iok.56.2019.06.19.09.51.35 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 19 Jun 2019 09:51:35 -0700 (PDT) From: Kelsey Skunberg To: linux-pci@vger.kernel.org Cc: skhan@linuxfoundation.org, linux-kernel-mentees@lists.linuxfoundation.org, mj@ucw.cz, bjorn@helgaas.com, skunberg.kelsey@gmail.com Subject: [PATCH v4 3/3] lspci: Change output for bridge with empty range to "[disabled]" Date: Wed, 19 Jun 2019 10:48:58 -0600 Message-Id: <20190619164858.84746-4-skunberg.kelsey@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190619164858.84746-1-skunberg.kelsey@gmail.com> References: <20190619164858.84746-1-skunberg.kelsey@gmail.com> 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 Change output displayed for memory behind bridge when the range is empty to be consistent between each verbosity level. Replace "None" and "[empty]" with "[disabled]". Old and new output examples listed below for each verbosity level. Show_range() is not called unless verbose == true. No output given unless a verbose argument is provided. OLD output for -v and -vv which uses "None" and -vvv uses "[empty]": Memory behind bridge: None # lspci -v Memory behind bridge: None # lspci -vv Memory behind bridge: 0000e000-0000efff [empty] # lspci -vvv NEW output for -v, -vv, and -vvv to use "[disabled]": Memory behind bridge: [disabled] # lspci -v Memory behind bridge: [disabled] # lspci -vv Memory behind bridge: 0000e000-0000efff [disabled] # lspci -vvv Advantage is consistent output regardless of verbosity level chosen and to simplify the code. Signed-off-by: Kelsey Skunberg --- lspci.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/lspci.c b/lspci.c index 7418b07..525bb82 100644 --- a/lspci.c +++ b/lspci.c @@ -376,20 +376,18 @@ show_size(u64 x) static void show_range(char *prefix, u64 base, u64 limit, int is_64bit) { - if (base > limit && verbose < 3) + printf("%s:", prefix); + if (base <= limit || verbose > 2) { - printf("%s: None\n", prefix); - return; + if (is_64bit) + printf(" %016" PCI_U64_FMT_X "-%016" PCI_U64_FMT_X, base, limit); + else + printf(" %08x-%08x", (unsigned) base, (unsigned) limit); } - printf("%s: ", prefix); - if (is_64bit) - printf("%016" PCI_U64_FMT_X "-%016" PCI_U64_FMT_X, base, limit); - else - printf("%08x-%08x", (unsigned) base, (unsigned) limit); if (base <= limit) show_size(limit - base + 1); else - printf(" [empty]"); + printf(" [disabled]"); putchar('\n'); }