linux-staging.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: Paulo Miguel Almeida <paulo.miguel.almeida.rodenas@gmail.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: gregkh@linuxfoundation.org, realwakka@gmail.com,
	linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] staging: pi433: move get version func to where all other functions are
Date: Sat, 8 Jan 2022 08:24:38 +1300	[thread overview]
Message-ID: <20220107192438.GB2693@mail.google.com> (raw)
In-Reply-To: <20220107085343.GP7674@kadam>

On Fri, Jan 07, 2022 at 11:53:44AM +0300, Dan Carpenter wrote:
> On Fri, Jan 07, 2022 at 10:33:25AM +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.
> 
> That's some EnterpriseQuality[tm] style guidelines.  It's an over fussy
> rule that just makes the code harder to read for no reason.

EnterpriseQuality[tm] was witty :)

> >  
> >  	/* Ping the chip by reading the version register */
> 
> This comment doesn't make sense now.

you are right, I will change this.

> > -	retval = spi_w8r8(spi, 0x10);
> > -	if (retval < 0)
> > -		return retval;
> > +	retval = rf69_get_version(spi);
> 
> Just say:
> 
> 	retval = rf69_read_reg(spi, REG_VERSION);

atm rf69_read_reg is a static function in rf69.c.

I do agree that this is technically possible to write the code
exactly as you suggested but on the other hand, that would be the only
exception to the rule when considering all other higher-level functions
provided in the rf69.c

are you strongly set on the rf69_read_reg approach or would you 
be open to keep the original approach? (rf69_get_version)

> 	if (retval < 0)
> 		return retval;
> 
> Deleting the error handling was a bad style choice.  Also preserve the
> error code.
>

I just want to double-check if this suggestion is taking into
consideration what was mentioned here:
https://lore.kernel.org/lkml/20220106210134.GB3416@mail.google.com/

If it is, I'm happy to add it back but I just wanted to confirm it
first.

thanks,

Paulo A.

  reply	other threads:[~2022-01-07 19:24 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 [this message]
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
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=20220107192438.GB2693@mail.google.com \
    --to=paulo.miguel.almeida.rodenas@gmail.com \
    --cc=dan.carpenter@oracle.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).