lkml.org 
[lkml]   [2022]   [Jan]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] staging: pi433: move get version func to where all other functions are
On Thu, Jan 06, 2022 at 10:31:10PM +1300, Paulo Miguel Almeida wrote:
> As a convention for the pi433 driver, all routines that deals with the
> rf69 chip are defined in the rf69.c file. There was an exception in
> which the uC version verification was being done directly elsewhere.
> While at it, the Version Register hardcoded value was replaced with a
> pre-existing constant in the driver.
>
> This patch adds rf69_get_chip_version function to rf69.c
>
> Additionally, the patch below must be applied first as it was sent
> before and touches the same file.
> https://lore.kernel.org/lkml/20220103222334.GA6814@mail.google.com/
>
> Signed-off-by: Paulo Miguel Almeida <paulo.miguel.almeida.rodenas@gmail.com>
> ---
> drivers/staging/pi433/pi433_if.c | 4 +---
> drivers/staging/pi433/rf69.c | 8 ++++++++
> drivers/staging/pi433/rf69.h | 1 +
> 3 files changed, 10 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/staging/pi433/pi433_if.c b/drivers/staging/pi433/pi433_if.c
> index 29bd37669059..a19afda5b188 100644
> --- 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.)

thanks,

greg k-h

\
 
 \ /
  Last update: 2022-01-06 15:04    [W:0.073 / U:0.976 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site