Skip to content

Commit

Permalink
Bluetooth: convert net/bluetooth/ to kstrtox
Browse files Browse the repository at this point in the history
Convert from strict_strto*() interfaces to kstrto*() interfaces.

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
  • Loading branch information
Alexey Dobriyan authored and Gustavo F. Padovan committed Apr 5, 2011
1 parent e63a15e commit db940cb
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions net/bluetooth/hci_sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -277,10 +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;
unsigned int val;
int rv;

if (strict_strtoul(buf, 0, &val) < 0)
return -EINVAL;
rv = kstrtouint(buf, 0, &val);
if (rv < 0)
return rv;

if (val != 0 && (val < 500 || val > 3600000))
return -EINVAL;
Expand All @@ -299,15 +301,14 @@ 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;
u16 val;
int rv;

if (val < 0x0002 || val > 0xFFFE || val % 2)
return -EINVAL;
rv = kstrtou16(buf, 0, &val);
if (rv < 0)
return rv;

if (val < hdev->sniff_min_interval)
if (val == 0 || val % 2 || val < hdev->sniff_min_interval)
return -EINVAL;

hdev->sniff_max_interval = val;
Expand All @@ -324,15 +325,14 @@ 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;
u16 val;
int rv;

if (strict_strtoul(buf, 0, &val) < 0)
return -EINVAL;

if (val < 0x0002 || val > 0xFFFE || val % 2)
return -EINVAL;
rv = kstrtou16(buf, 0, &val);
if (rv < 0)
return rv;

if (val > hdev->sniff_max_interval)
if (val == 0 || val % 2 || val > hdev->sniff_max_interval)
return -EINVAL;

hdev->sniff_min_interval = val;
Expand Down

0 comments on commit db940cb

Please sign in to comment.