public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Bjorn Helgaas <helgaas@kernel.org>
To: Sathya Prakash Veerichetty <sathya.prakash@broadcom.com>
Cc: Ranjan Kumar <ranjan.kumar@broadcom.com>,
	linux-scsi@vger.kernel.org, martin.petersen@oracle.com,
	rajsekhar.chundru@broadcom.com, sumit.saxena@broadcom.com,
	chandrakanth.patil@broadcom.com, prayas.patel@broadcom.com
Subject: Re: [PATCH v1 2/4] mpi3mr: Support PCIe Error Recovery callback handlers
Date: Thu, 7 Dec 2023 14:24:42 -0600	[thread overview]
Message-ID: <20231207202442.GA764233@bhelgaas> (raw)
In-Reply-To: <CAFdVvOyCCEOLs4z-aOnuEdcnak52HqvNMUOQfv-6OwMTSkaGBg@mail.gmail.com>

On Thu, Dec 07, 2023 at 09:55:09AM -0700, Sathya Prakash Veerichetty wrote:
> On Wed, Dec 6, 2023 at 9:56 AM Bjorn Helgaas <helgaas@kernel.org> wrote:
> > On Wed, Dec 06, 2023 at 08:55:11PM +0530, Ranjan Kumar wrote:
> ...

> > >  static int __maybe_unused
> > >  mpi3mr_suspend(struct device *dev)
> > >  {
> > >       struct pci_dev *pdev = to_pci_dev(dev);
> > > -     struct Scsi_Host *shost = pci_get_drvdata(pdev);
> > > +     struct Scsi_Host *shost;
> > >       struct mpi3mr_ioc *mrioc;
> > >
> > > -     if (!shost)
> > > -             return 0;
> > > +     if (mpi3mr_get_shost_and_mrioc(pdev, &shost, &mrioc))
> > > +             return -1;
> >
> > Is -1 really the best return value here?  It seems like usually a
> > negative errno is returned.
>
> The __suspend_report_result just prints the return value, so i thought
> -1 is fine as we already print a error message. Do you recommend to
> use another negative (non -1) number for differentiation between
> generic error and this?

In addition to being printed by __suspend_report_result() (if the
return value is non-zero), the return value is returned up the chain
by legacy_suspend(), pci_pm_suspend(), etc.

I would probably make mpi3mr_get_shost_and_mrioc() return an errno
like -ENODEV and then have mpi3mr_suspend() capture that and return
it.

These function pointers go in struct dev_pm_ops, and these functions
are documented as returning "error codes", which I interpret as errno
values:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/linux/pm.h?id=v6.6#n258

Bjorn

  reply	other threads:[~2023-12-07 20:24 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-06 15:25 [PATCH v1 0/4] mpi3mr: Few Enhancements and minor fix Ranjan Kumar
2023-12-06 15:25 ` [PATCH v1 1/4] mpi3mr: Improve Shutdown times when firmware has faulted Ranjan Kumar
2023-12-06 15:25 ` [PATCH v1 2/4] mpi3mr: Support PCIe Error Recovery callback handlers Ranjan Kumar
2023-12-06 16:56   ` Bjorn Helgaas
2023-12-07 16:55     ` Sathya Prakash Veerichetty
2023-12-07 20:24       ` Bjorn Helgaas [this message]
2023-12-07 15:07   ` kernel test robot
2023-12-06 15:25 ` [PATCH v1 3/4] mpi3mr: Reset stop_bsgs flag post controller reset failure Ranjan Kumar
2023-12-06 15:25 ` [PATCH v1 4/4] mpi3mr: Update driver version to 8.6.1.0.0 Ranjan Kumar

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=20231207202442.GA764233@bhelgaas \
    --to=helgaas@kernel.org \
    --cc=chandrakanth.patil@broadcom.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=prayas.patel@broadcom.com \
    --cc=rajsekhar.chundru@broadcom.com \
    --cc=ranjan.kumar@broadcom.com \
    --cc=sathya.prakash@broadcom.com \
    --cc=sumit.saxena@broadcom.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