All of lore.kernel.org
 help / color / mirror / Atom feed
From: Samuil Ivanov <samuil.ivanovbg@gmail.com>
To: Greg KH <gregkh@linuxfoundation.org>
Cc: devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org,
	rspringer@google.com, toddpoynor@google.com,
	benchan@chromium.org
Subject: Re: [PATCH 1/2] Staging: gasket: implement apex_get_status() to check driver status
Date: Tue, 29 Oct 2019 17:22:24 +0200	[thread overview]
Message-ID: <20191029152224.GA9523@sivanov-pc> (raw)
In-Reply-To: <20191029081007.GA520581@kroah.com>

On Tue, Oct 29, 2019 at 09:10:07AM +0100, Greg KH wrote:
> On Tue, Oct 29, 2019 at 12:59:25AM +0200, Samuil Ivanov wrote:
> > >From the TODO:
> > - apex_get_status() should actually check status
> > 
> > The function now checkes the status of the driver
> > 
> > Signed-off-by: Samuil Ivanov <samuil.ivanovbg@gmail.com>
> > ---
> >  drivers/staging/gasket/apex_driver.c | 3 +++
> >  1 file changed, 3 insertions(+)
> > 
> > diff --git a/drivers/staging/gasket/apex_driver.c b/drivers/staging/gasket/apex_driver.c
> > index 46199c8ca441..a5dd6f3c367d 100644
> > --- a/drivers/staging/gasket/apex_driver.c
> > +++ b/drivers/staging/gasket/apex_driver.c
> > @@ -247,6 +247,9 @@ module_param(bypass_top_level, int, 0644);
> >  static int apex_get_status(struct gasket_dev *gasket_dev)
> >  {
> >  	/* TODO: Check device status. */
> > +	if (gasket_dev->status == GASKET_STATUS_DEAD)
> > +		return GASKET_STATUS_DEAD;
> > +
> 
> Have you tested this to verify that this is what is needed here?
> 
> thanks,
> 
> greg k-h

Hello Greg,

After going through the code again, I am sure this not what is needed here.

I thought that gasket_dev->status is already set to either
GASKET_STATUS_ALIVE of GASKET_STATUS_DEAD,
and all I needed to do is check it. It turns out that status
has to be set before that.

So what I found is that function gasket_get_hw_status()
in file gasket_core.c is used to determine the health of the Gasket device,
and other function use it to set gasket_dev->status and then check
the device status.

I think it should be something like this.
...
gasket_dev->status = gasket_get_hw_status(gasket_dev);
if (gasket_dev->status == GASKET_STATUS_DEAD) {
        dev_dbg(gasket_dev->dev, "Device reported as dead.\n");
        return -EINVAL;
}
return GASKET_STATUS_ALIVE;
...

I can try this, but I have no means of testing it.

Grt,
Samuil

  reply	other threads:[~2019-10-29 15:22 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-28 22:59 [PATCH 0/2] Staging: gasket: Implement apex_get_status() to check driver status Samuil Ivanov
2019-10-28 22:59 ` [PATCH 1/2] Staging: gasket: implement " Samuil Ivanov
2019-10-29  8:10   ` Greg KH
2019-10-29 15:22     ` Samuil Ivanov [this message]
2019-10-28 22:59 ` [PATCH 2/2] Staging: gasket: Clean apex_get_status function of comment Samuil Ivanov

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=20191029152224.GA9523@sivanov-pc \
    --to=samuil.ivanovbg@gmail.com \
    --cc=benchan@chromium.org \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rspringer@google.com \
    --cc=toddpoynor@google.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.