devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: "József Horváth" <info@ministro.hu>
Cc: "Jérôme Pouiller" <jerome.pouiller@silabs.com>,
	devel@driverdev.osuosl.org, devicetree@vger.kernel.org,
	"'Greg Kroah-Hartman'" <gregkh@linuxfoundation.org>,
	driverdev-devel@linuxdriverproject.org,
	linux-kernel@vger.kernel.org,
	"'Rob Herring'" <robh+dt@kernel.org>
Subject: Re: [PATCH] Staging: silabs si4455 serial driver
Date: Thu, 10 Dec 2020 11:00:06 +0300	[thread overview]
Message-ID: <20201210080006.GK2767@kadam> (raw)
In-Reply-To: <20201209194153.GC30918@dincontrollerdev>

On Wed, Dec 09, 2020 at 07:41:53PM +0000, József Horváth wrote:
> > > +static int si4455_get_part_info(struct uart_port *port,
> > > +                               struct si4455_part_info *result)
> > > +{
> > > +       int ret;
> > > +       u8 dataOut[] = { SI4455_CMD_ID_PART_INFO };
> > > +       u8 dataIn[SI4455_CMD_REPLY_COUNT_PART_INFO];
> > > +
> > > +       ret = si4455_send_command_get_response(port,
> > > +                                               sizeof(dataOut),
> > > +                                               dataOut,
> > > +                                               sizeof(dataIn),
> > > +                                               dataIn);
> > 
> > Why not:
> > 
> 
> I changed all like this in my code already. I test it, and I'll send it again.
> 
> Ps.: For my eyes is better to read line or list, reading table is harder :)
> 
> 	line(arg1, arg2, arg3, arg4);
> 
> 	list(arg1,
> 		arg2,
> 		arg3,
> 		arg4);
> 
> 	table(arg1, arg2,
> 		arg3, arg4);
> 

Use spaces to make arguments have to line up properly.
`checkpatch.pl --strict` will complain if it's not done.

	table(arg1, arg2,
	      arg_whatver, foo);
[tab][space x 7]arg_whaver, foo);

But I think Jérôme's main point was to get rid of the dataOut buffer and
use "result" directly.

> 
> >        ret = si4455_send_command_get_response(port,
> >                                               sizeof(*result), result,
> >                                               sizeof(dataIn), dataIn);
> > 
> > > +       if (ret == 0) {
> > > +               result->CHIPREV = dataIn[0];
> > > +               memcpy(&result->PART, &dataIn[1],sizeof(result->PART));
> > > +               result->PBUILD = dataIn[3];
> > > +               memcpy(&result->ID, &dataIn[4], sizeof(result->ID));
> > > +               result->CUSTOMER = dataIn[6];
> > > +               result->ROMID = dataIn[7];
> > > +               result->BOND = dataIn[8];
> > 
> > ... it would avoid all these lines.
> > 

regards,
dan carpenter


  reply	other threads:[~2020-12-10  8:01 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-09 11:09 [PATCH] Staging: silabs si4455 serial driver Info
2020-12-09 12:02 ` 'Greg Kroah-Hartman'
2020-12-09 12:57   ` ***UNCHECKED*** " Info
2020-12-09 12:42 ` Dan Carpenter
2020-12-09 18:56   ` József Horváth
2020-12-09 18:59     ` Dan Carpenter
2020-12-09 17:38 ` Jérôme Pouiller
2020-12-09 19:41   ` József Horváth
2020-12-10  8:00     ` Dan Carpenter [this message]
2020-12-10  3:06 ` Rob Herring
  -- strict thread matches above, loose matches on Subject: below --
2020-12-10 12:20 József Horváth
2020-12-10 12:55 ` 'Greg Kroah-Hartman'

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=20201210080006.GK2767@kadam \
    --to=dan.carpenter@oracle.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=devicetree@vger.kernel.org \
    --cc=driverdev-devel@linuxdriverproject.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=info@ministro.hu \
    --cc=jerome.pouiller@silabs.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robh+dt@kernel.org \
    /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).