Re: [PATCH] video: bfin_adv7393fb: Convert to kstrtouint_from_user

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>

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;

--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux