Commit db940cb0 authored by Alexey Dobriyan's avatar Alexey Dobriyan Committed by Gustavo F. Padovan

Bluetooth: convert net/bluetooth/ to kstrtox

Convert from strict_strto*() interfaces to kstrto*() interfaces.
Signed-off-by: default avatarAlexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: default avatarGustavo F. Padovan <padovan@profusion.mobi>
parent e63a15ec
...@@ -277,10 +277,12 @@ static ssize_t show_idle_timeout(struct device *dev, struct device_attribute *at ...@@ -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) 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); struct hci_dev *hdev = dev_get_drvdata(dev);
unsigned long val; unsigned int val;
int rv;
if (strict_strtoul(buf, 0, &val) < 0) rv = kstrtouint(buf, 0, &val);
return -EINVAL; if (rv < 0)
return rv;
if (val != 0 && (val < 500 || val > 3600000)) if (val != 0 && (val < 500 || val > 3600000))
return -EINVAL; return -EINVAL;
...@@ -299,15 +301,14 @@ static ssize_t show_sniff_max_interval(struct device *dev, struct device_attribu ...@@ -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) 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); 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) rv = kstrtou16(buf, 0, &val);
return -EINVAL; if (rv < 0)
return rv;
if (val < hdev->sniff_min_interval) if (val == 0 || val % 2 || val < hdev->sniff_min_interval)
return -EINVAL; return -EINVAL;
hdev->sniff_max_interval = val; hdev->sniff_max_interval = val;
...@@ -324,15 +325,14 @@ static ssize_t show_sniff_min_interval(struct device *dev, struct device_attribu ...@@ -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) 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); struct hci_dev *hdev = dev_get_drvdata(dev);
unsigned long val; u16 val;
int rv;
if (strict_strtoul(buf, 0, &val) < 0) rv = kstrtou16(buf, 0, &val);
return -EINVAL; if (rv < 0)
return rv;
if (val < 0x0002 || val > 0xFFFE || val % 2)
return -EINVAL;
if (val > hdev->sniff_max_interval) if (val == 0 || val % 2 || val > hdev->sniff_max_interval)
return -EINVAL; return -EINVAL;
hdev->sniff_min_interval = val; hdev->sniff_min_interval = val;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment