linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
To: Emil Goode <emilgoode@gmail.com>
Cc: linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] video: bfin_adv7393fb: Convert to kstrtouint_from_user
Date: Sat, 09 Jun 2012 12:41:47 +0000	[thread overview]
Message-ID: <4FD3448B.2050806@gmx.de> (raw)
In-Reply-To: <1338310620-6886-1-git-send-email-emilgoode@gmail.com>

On 05/29/2012 04:57 PM, Emil Goode wrote:
> This patch removes a call to the deprecated simple_strtoul function
> and simplifies the code by replacing two function calls with one
> call to kstrtouint_from_user.
> 
> -Simplify the adv7393_write_proc function by replacing the
>  simple_strtoul and copy_from_user calls with one call
>  to kstrtouint_from_user.
> 
> -Change the count parameter from unsigned long to size_t as
>  this is the type that the kstrtouint_from_user function expects.
>  (size_t is what will be passed to the adv7393_write_proc function
>  by the proc write handler function proc_file_write anyway)
> 
> Signed-off-by: Emil Goode <emilgoode@gmail.com>

Applied.


Thanks,

Florian Tobias Schandinat

> ---
>  drivers/video/bfin_adv7393fb.c |    6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/video/bfin_adv7393fb.c b/drivers/video/bfin_adv7393fb.c
> index 1a268a2..8c6edfd 100644
> --- a/drivers/video/bfin_adv7393fb.c
> +++ b/drivers/video/bfin_adv7393fb.c
> @@ -353,18 +353,16 @@ adv7393_read_proc(char *page, char **start, off_t off,
>  
>  static int
>  adv7393_write_proc(struct file *file, const char __user * buffer,
> -		   unsigned long count, void *data)
> +		   size_t count, void *data)
>  {
>  	struct adv7393fb_device *fbdev = data;
> -	char line[8];
>  	unsigned int val;
>  	int ret;
>  
> -	ret = copy_from_user(line, buffer, count);
> +	ret = kstrtouint_from_user(buffer, count, 0, &val);
>  	if (ret)
>  		return -EFAULT;
>  
> -	val = simple_strtoul(line, NULL, 0);
>  	adv7393_write(fbdev->client, val >> 8, val & 0xff);
>  
>  	return count;


      reply	other threads:[~2012-06-09 12:41 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-29 16:57 [PATCH] video: bfin_adv7393fb: Convert to kstrtouint_from_user Emil Goode
2012-06-09 12:41 ` Florian Tobias Schandinat [this message]

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=4FD3448B.2050806@gmx.de \
    --to=florianschandinat@gmx.de \
    --cc=emilgoode@gmail.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-fbdev@vger.kernel.org \
    --cc=linux-kernel@vger.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).