public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Peter Hüwe" <PeterHuewe@gmx.de>
To: Alexey Dobriyan <adobriyan@gmail.com>
Cc: Samuel Ortiz <sameo@linux.intel.com>,
	Srinidhi Kasagar <srinidhi.kasagar@stericsson.com>,
	Linus Walleij <linus.walleij@stericsson.com>,
	Mark Brown <broonie@opensource.wolfsonmicro.com>,
	Ian Lartey <ian@opensource.wolfsonmicro.com>,
	Dimitris Papastamos <dp@opensource.wolfsonmicro.com>,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH 1/2 v2] mfd/ab3550: Convert to kstrtou8_from_user
Date: Mon, 20 Jun 2011 22:16:19 +0200	[thread overview]
Message-ID: <201106202216.20343.PeterHuewe@gmx.de> (raw)
In-Reply-To: <20110620195037.GA2534@p183.telecom.by>

Am Montag 20 Juni 2011, 21:50:38 schrieb Alexey Dobriyan:
> On Mon, Jun 20, 2011 at 09:46:28PM +0200, Peter Huewe wrote:
> > -	char buf[32];
> > -	int buf_size;
> > -	unsigned long user_address;
> > +	u8 user_address;

> > +	/* Get userspace string and convert to number */
> > +	err = kstrtou8_from_user(user_buf, count, 0, &user_address);
...
> > 
> >  	ab->debug_address = user_address;

> 
> You don't need temporary variable and should write straight to final
> location, because kstrto* functions will never write to result unless it
> was converted successfully.

Alexey thank you very much for your review, hints and most of all patience ;)
The code really gets cleaner and cleaner.

While changing the code (once again ;) and looking at your remarks I also saw 
that ab3550->debug_address and ->debug_bank are always casted to u8.

Do you think I could also change the two fields of the struct ab3550 (only 
used in this file) to u8 in this patch, too?
This way I could get rid of the u8* cast which is now needed in this case, if 
I take you last remark into account.
> err = kstrtou8_from_user(user_buf, count, 0, (u8 *)&ab->debug_address);

And also clean the code from all the other unnecessary u8 casts.

What do you think?
Or split it up into two seperate patches?

Thanks,
Peter

  reply	other threads:[~2011-06-20 20:16 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-06 20:43 [PATCH 1/2] mfd/ab3550: Use kstrtoul_from_user Peter Huewe
2011-06-06 20:43 ` [PATCH 2/2] mfd/ab8500: " Peter Huewe
2011-06-20 13:45   ` Alexey Dobriyan
2011-06-20 19:46     ` Peter Hüwe
2011-06-20 19:46     ` [PATCH 1/2 v2] mfd/ab3550: Convert to kstrtou8_from_user Peter Huewe
2011-06-20 19:50       ` Alexey Dobriyan
2011-06-20 20:16         ` Peter Hüwe [this message]
2011-06-20 21:01         ` [PATCH 1/2 v3] " Peter Huewe
2011-06-20 21:01         ` [PATCH 2/2 v4] mfd/ab8500: " Peter Huewe
2011-06-20 19:46     ` [PATCH 2/2 v2] " Peter Huewe
2011-06-20 19:51       ` [PATCH v3] " Peter Huewe
2011-06-20 13:29 ` [PATCH 1/2] mfd/ab3550: Use kstrtoul_from_user Samuel Ortiz

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=201106202216.20343.PeterHuewe@gmx.de \
    --to=peterhuewe@gmx.de \
    --cc=adobriyan@gmail.com \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=dp@opensource.wolfsonmicro.com \
    --cc=ian@opensource.wolfsonmicro.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linus.walleij@stericsson.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sameo@linux.intel.com \
    --cc=srinidhi.kasagar@stericsson.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