linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Gustavo F. Padovan" <padovan@profusion.mobi>
To: Alexey Dobriyan <adobriyan@gmail.com>
Cc: marcel@holtmann.org, linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH] kstrtox: convert net/bluetooth/
Date: Mon, 4 Apr 2011 19:00:02 -0300	[thread overview]
Message-ID: <20110404220002.GF2230@joana> (raw)
In-Reply-To: <20110402111941.GB19357@p183.telecom.by>

Hi Alexey,

* Alexey Dobriyan <adobriyan@gmail.com> [2011-04-02 14:19:41 +0300]:

> Convert from strict_strto*() interfaces to kstrto*() interfaces.
> 
> Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
> ---
> 
>  net/bluetooth/hci_sysfs.c |   37 +++++++++++++++++--------------------
>  1 file changed, 17 insertions(+), 20 deletions(-)
> 
> --- a/net/bluetooth/hci_sysfs.c
> +++ b/net/bluetooth/hci_sysfs.c
> @@ -277,11 +277,12 @@ static ssize_t show_idle_timeout(struct device *dev, struct device_attribute *at
>  static ssize_t store_idle_timeout(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
>  {
>  	struct hci_dev *hdev = dev_get_drvdata(dev);
> -	unsigned long val;
> -
> -	if (strict_strtoul(buf, 0, &val) < 0)
> -		return -EINVAL;
> +	unsigned int val;
> +	int rv;
>  
> +	rv = kstrtouint(buf, 0, &val);
> +	if (rv < 0)
> +		return rv;

Add a empty line here, please.

>  	if (val != 0 && (val < 500 || val > 3600000))
>  		return -EINVAL;
>  
> @@ -299,15 +300,13 @@ static ssize_t show_sniff_max_interval(struct device *dev, struct device_attribu
>  static ssize_t store_sniff_max_interval(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
>  {
>  	struct hci_dev *hdev = dev_get_drvdata(dev);
> -	unsigned long val;
> -
> -	if (strict_strtoul(buf, 0, &val) < 0)
> -		return -EINVAL;
> -
> -	if (val < 0x0002 || val > 0xFFFE || val % 2)
> -		return -EINVAL;
> +	u16 val;
> +	int rv;
>  
> -	if (val < hdev->sniff_min_interval)
> +	rv = kstrtou16(buf, 0, &val);
> +	if (rv < 0)
> +		return rv;
> +	if (val == 0 || val % 2 || val < hdev->sniff_min_interval)
>  		return -EINVAL;

Why are you changing other things besides the string conversions? The checks
for val should stay the same.

>  
>  	hdev->sniff_max_interval = val;
> @@ -324,15 +323,13 @@ static ssize_t show_sniff_min_interval(struct device *dev, struct device_attribu
>  static ssize_t store_sniff_min_interval(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
>  {
>  	struct hci_dev *hdev = dev_get_drvdata(dev);
> -	unsigned long val;
> -
> -	if (strict_strtoul(buf, 0, &val) < 0)
> -		return -EINVAL;
> -
> -	if (val < 0x0002 || val > 0xFFFE || val % 2)
> -		return -EINVAL;
> +	u16 val;
> +	int rv;
>  
> -	if (val > hdev->sniff_max_interval)
> +	rv = kstrtou16(buf, 0, &val);
> +	if (rv < 0)
> +		return rv;
> +	if (val == 0 || val % 2 || val > hdev->sniff_max_interval)
>  		return -EINVAL;

Same problem here.


-- 
Gustavo F. Padovan
http://profusion.mobi

  reply	other threads:[~2011-04-04 22:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-02 11:19 [PATCH] kstrtox: convert net/bluetooth/ Alexey Dobriyan
2011-04-04 22:00 ` Gustavo F. Padovan [this message]
2011-04-05 12:33   ` Alexey Dobriyan
2011-04-05 16:38     ` Gustavo F. Padovan

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=20110404220002.GF2230@joana \
    --to=padovan@profusion.mobi \
    --cc=adobriyan@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=marcel@holtmann.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).