linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Amey Narkhede <ameynarkhede03@gmail.com>
To: Alex Williamson <alex.williamson@redhat.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>,
	Raphael Norwitz <raphael.norwitz@nutanix.com>,
	linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org,
	kw@linux.com, Shanker Donthineni <sdonthineni@nvidia.com>,
	Sinan Kaya <okaya@kernel.org>
Subject: Re: [PATCH v3 7/7] PCI: Change the type of probe argument in reset functions
Date: Thu, 27 May 2021 01:35:57 +0530	[thread overview]
Message-ID: <20210526200557.5wrrmflygfmdzd6b@archlinux> (raw)
In-Reply-To: <20210526135230.2ecd94d3.alex.williamson@redhat.com>

On 21/05/26 01:52PM, Alex Williamson wrote:
> On Wed, 26 May 2021 15:44:03 +0530
> Amey Narkhede <ameynarkhede03@gmail.com> wrote:
>
> > Introduce a new enum pci_reset_mode_t to make the context
> > of probe argument in reset functions clear and the code
> > easier to read.
> > Change the type of probe argument in functions which implement
> > reset methods from int to pci_reset_mode_t to make the intent clear.
> > Add a new line in return statement of pci_reset_bus_function.
> >
> > Suggested-by: Alex Williamson <alex.williamson@redhat.com>
> > Suggested-by: Krzysztof Wilczyński <kw@linux.com>
> > Signed-off-by: Amey Narkhede <ameynarkhede03@gmail.com>
> > ---
[...]
> >   */
> > -int pciehp_reset_slot(struct hotplug_slot *hotplug_slot, int probe)
> > +int pciehp_reset_slot(struct hotplug_slot *hotplug_slot, enum pci_reset_mode probe)
>
> This should use your typedef, pci_reset_mode_t.  Is "probe" still the
> best name for this arg?  The enum name suggests a "mode", the MAX entry
> suggests an "action", "probe" is but one mode/action.
>
My bad I missed this. Which sounds more intuitive to you
"mode" or "action"? I update this in v4 to use consistent terminology
once we everybody agrees on name.
[...]
> > @@ -3910,11 +3922,16 @@ static int nvme_disable_and_flr(struct pci_dev *dev, int probe)
> >   * device too soon after FLR.  A 250ms delay after FLR has heuristically
> >   * proven to produce reliably working results for device assignment cases.
> >   */
> > -static int delay_250ms_after_flr(struct pci_dev *dev, int probe)
> > +static int delay_250ms_after_flr(struct pci_dev *dev, pci_reset_mode_t probe)
> >  {
> > -	int ret = pcie_reset_flr(dev, probe);
> > +	int ret;
> > +
> > +	if (probe >= PCI_RESET_ACTION_MAX)
> > +		return -EINVAL;
>
> pcie_reset_flr() handles this case, we could simply test (ret || probe
> == PCI_RESET_PROBE) below.  In fact, that's probably what the code flow
> should have been regardless of this series.
>
[...]
> > -int pci_dev_specific_reset(struct pci_dev *dev, int probe)
> > +int pci_dev_specific_reset(struct pci_dev *dev, pci_reset_mode_t probe)
> >  {
> >  	const struct pci_dev_reset_methods *i;
> >
> > +	if (probe >= PCI_RESET_ACTION_MAX)
> > +		return -EINVAL;
>
> If we test this here, none of the device specific resets modified above
> need a duplicate check.  Thanks,
>
> Alex
>
I went ahead with excessive error checking in this patch.
Will update in v4.

Thanks,
Amey

      reply	other threads:[~2021-05-26 20:06 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-26 10:13 [PATCH v3 0/7] Expose and manage PCI device reset Amey Narkhede
2021-05-26 10:13 ` [PATCH v3 1/7] PCI: Add pcie_reset_flr to follow calling convention of other reset methods Amey Narkhede
2021-05-26 10:13 ` [PATCH v3 2/7] PCI: Add new array for keeping track of ordering of " Amey Narkhede
2021-05-26 10:13 ` [PATCH v3 3/7] PCI: Remove reset_fn field from pci_dev Amey Narkhede
2021-05-26 10:14 ` [PATCH v3 4/7] PCI/sysfs: Allow userspace to query and set device reset mechanism Amey Narkhede
2021-05-26 10:14 ` [PATCH v3 5/7] PCI: Add support for a function level reset based on _RST method Amey Narkhede
2021-05-26 10:14 ` [PATCH v3 6/7] PCI: Enable NO_BUS_RESET quirk for Nvidia GPUs Amey Narkhede
2021-05-26 10:14 ` [PATCH v3 7/7] PCI: Change the type of probe argument in reset functions Amey Narkhede
2021-05-26 19:52   ` Alex Williamson
2021-05-26 20:05     ` Amey Narkhede [this message]

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=20210526200557.5wrrmflygfmdzd6b@archlinux \
    --to=ameynarkhede03@gmail.com \
    --cc=alex.williamson@redhat.com \
    --cc=bhelgaas@google.com \
    --cc=kw@linux.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=okaya@kernel.org \
    --cc=raphael.norwitz@nutanix.com \
    --cc=sdonthineni@nvidia.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;
as well as URLs for NNTP newsgroup(s).