From: Paulo Miguel Almeida <paulo.miguel.almeida.rodenas@gmail.com>
To: Greg KH <gregkh@linuxfoundation.org>
Cc: realwakka@gmail.com, linux-staging@lists.linux.dev,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] staging: pi433: move get version func to where all other functions are
Date: Fri, 7 Jan 2022 10:01:34 +1300 [thread overview]
Message-ID: <20220106210134.GB3416@mail.google.com> (raw)
In-Reply-To: <Ydb22Tuvm0MwfpOK@kroah.com>
On Thu, Jan 06, 2022 at 03:04:09PM +0100, Greg KH wrote:
> > --- a/drivers/staging/pi433/pi433_if.c
> > +++ b/drivers/staging/pi433/pi433_if.c
> > @@ -1116,9 +1116,7 @@ static int pi433_probe(struct spi_device *spi)
> > spi->mode, spi->bits_per_word, spi->max_speed_hz);
> >
> > /* Ping the chip by reading the version register */
> > - retval = spi_w8r8(spi, 0x10);
> > - if (retval < 0)
> > - return retval;
> > + retval = rf69_get_chip_version(spi);
>
> This can not fail anymore, like it used to be able to. So I think you
> just broke the functionality for why this call was being made in the
> first place (i.e. ping the chip to see if it was alive, and fail if it
> is not.)
>
I thought that this if statement was somewhat redudant because right
after obtaining the chip version, there is a switch statement that
checks if the value is what we expect or return an error otherwise.
Unfortunately, in the patch file generated the whole switch statement
isn't visible so I admit that it looks funny at first. I will paste the
routine here:
/* Ping the chip by reading the version register */
retval = rf69_get_chip_version(spi);
switch (retval) {
case 0x24:
dev_dbg(&spi->dev, "found pi433 (ver. 0x%x)", retval);
break;
default:
dev_dbg(&spi->dev, "unknown chip version: 0x%x", retval);
return -ENODEV;
}
Let me know if you agree with the approach I've taken, otherwise I am
more than happy to add the original if statement if you think I'm
missing any edge case here.
Once again, thanks for taking the time to review my patch :)
thanks,
Paulo A.
next prev parent reply other threads:[~2022-01-06 21:01 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-06 9:31 [PATCH] staging: pi433: move get version func to where all other functions are Paulo Miguel Almeida
2022-01-06 10:19 ` Sidong Yang
2022-01-06 20:14 ` Paulo Miguel Almeida
2022-01-06 21:33 ` [PATCH v2] " Paulo Miguel Almeida
2022-01-07 8:53 ` Dan Carpenter
2022-01-07 19:24 ` Paulo Miguel Almeida
2022-01-08 11:19 ` Dan Carpenter
2022-01-08 16:36 ` Sidong Yang
2022-01-08 21:02 ` Paulo Miguel Almeida
2022-01-08 20:59 ` Paulo Miguel Almeida
2022-01-08 21:27 ` [PATCH v3] " Paulo Miguel Almeida
2022-01-06 14:04 ` [PATCH] " Greg KH
2022-01-06 21:01 ` Paulo Miguel Almeida [this message]
2022-01-07 8:32 ` Dan Carpenter
2022-01-07 18:45 ` Paulo Miguel Almeida
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=20220106210134.GB3416@mail.google.com \
--to=paulo.miguel.almeida.rodenas@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
--cc=realwakka@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;
as well as URLs for NNTP newsgroup(s).