From: Bjorn Helgaas <helgaas@kernel.org>
To: Chaitanya Kulkarni <Chaitanya.Kulkarni@wdc.com>
Cc: Puranjay Mohan <puranjay12@gmail.com>,
"bjorn@helgaas.com" <bjorn@helgaas.com>,
"linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org>,
Damien Le Moal <Damien.LeMoal@wdc.com>,
"axboe@kernel.dk" <axboe@kernel.dk>,
"linux-block@vger.kernel.org" <linux-block@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] drivers: block: skd: remove skd_pci_info()
Date: Fri, 11 Dec 2020 16:41:51 -0600 [thread overview]
Message-ID: <20201211224151.GA113093@bjorn-Precision-5520> (raw)
In-Reply-To: <BYAPR04MB496513CB49E42A3467427BF686CA0@BYAPR04MB4965.namprd04.prod.outlook.com>
On Fri, Dec 11, 2020 at 09:50:52PM +0000, Chaitanya Kulkarni wrote:
> On 12/11/20 08:45, Puranjay Mohan wrote:
> > PCI core calls __pcie_print_link_status() for every device, it prints
> > both the link width and the link speed. skd_pci_info() does the same
> > thing again, hence it can be removed.
> >
> > Signed-off-by: Puranjay Mohan <puranjay12@gmail.com>
> > ---
> > drivers/block/skd_main.c | 31 -------------------------------
> > 1 file changed, 31 deletions(-)
> >
> > diff --git a/drivers/block/skd_main.c b/drivers/block/skd_main.c
> > index a962b4551bed..da7aac5335d9 100644
> > --- a/drivers/block/skd_main.c
> > +++ b/drivers/block/skd_main.c
> > @@ -3134,40 +3134,11 @@ static const struct pci_device_id skd_pci_tbl[] = {
> >
> > MODULE_DEVICE_TABLE(pci, skd_pci_tbl);
> >
> > -static char *skd_pci_info(struct skd_device *skdev, char *str)
> > -{
> > - int pcie_reg;
> > -
> > - strcpy(str, "PCIe (");
> > - pcie_reg = pci_find_capability(skdev->pdev, PCI_CAP_ID_EXP);
> > -
> > - if (pcie_reg) {
> > -
> > - char lwstr[6];
> > - uint16_t pcie_lstat, lspeed, lwidth;
> > -
> > - pcie_reg += 0x12;
> > - pci_read_config_word(skdev->pdev, pcie_reg, &pcie_lstat);
> > - lspeed = pcie_lstat & (0xF);
> > - lwidth = (pcie_lstat & 0x3F0) >> 4;
> > -
> > - if (lspeed == 1)
> > - strcat(str, "2.5GT/s ");
> > - else if (lspeed == 2)
> > - strcat(str, "5.0GT/s ");
> > - else
> > - strcat(str, "<unknown> ");
> The skd driver prints unknown if the speed is not "2.5GT/s" or "5.0GT/s".
> __pcie_print_link_status() prints "unknown" only if speed
> value >= ARRAY_SIZE(speed_strings).
>
> If a buggy skd card returns value that is not != ("2.5GT/s" or "5.0GT/s")
> && value < ARRAY_SIZE(speed_strings) then it will not print the unknown but
> the value from speed string array.
>
> Which breaks the current behavior. Please correct me if I'm wrong.
I think you're right, but I don't think it actually *breaks* anything.
For skd devices that work correctly, there should be no problem, and
if there ever were an skd device that operated at a speed greater than
5GT/s, the PCI core would print that speed correctly instead of having
the driver print "<unknown>".
I don't think it's a good idea to have a driver artificially constrain
the speed a device operates at. And the existing code doesn't
actually constrain anything; it only prints "<unknown>" if it doesn't
recognize it. The probe still succeeds. I don't see much value in
that "<unknown>".
Or am I missing an actual problem this patch causes?
> > - snprintf(lwstr, sizeof(lwstr), "%dX)", lwidth);
> > - strcat(str, lwstr);
> > - }
> > - return str;
> > -}
> >
> > static int skd_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
> > {
> > int i;
> > int rc = 0;
> > - char pci_str[32];
> > struct skd_device *skdev;
> >
> > dev_dbg(&pdev->dev, "vendor=%04X device=%04x\n", pdev->vendor,
> > @@ -3201,8 +3172,6 @@ static int skd_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
> > goto err_out_regions;
> > }
> >
> > - skd_pci_info(skdev, pci_str);
> > - dev_info(&pdev->dev, "%s 64bit\n", pci_str);
> >
> > pci_set_master(pdev);
> > rc = pci_enable_pcie_error_reporting(pdev);
>
next prev parent reply other threads:[~2020-12-11 23:32 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-11 16:41 Puranjay Mohan
2020-12-11 21:50 ` Chaitanya Kulkarni
2020-12-11 22:41 ` Bjorn Helgaas [this message]
2020-12-12 1:59 ` Chaitanya Kulkarni
2020-12-14 6:02 ` Damien Le Moal
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201211224151.GA113093@bjorn-Precision-5520 \
--to=helgaas@kernel.org \
--cc=Chaitanya.Kulkarni@wdc.com \
--cc=Damien.LeMoal@wdc.com \
--cc=axboe@kernel.dk \
--cc=bjorn@helgaas.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=puranjay12@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®