lkml.org 
[lkml]   [2011]   [Feb]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 19/52] kstrtox: convert drivers/hid/
    Date

    Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
    ---
    drivers/hid/hid-magicmouse.c | 14 +++++++--
    drivers/hid/hid-ntrig.c | 54 ++++++++++++++++++++----------------
    drivers/hid/hid-roccat-kone.c | 8 +++---
    drivers/hid/hid-roccat-koneplus.c | 4 +-
    4 files changed, 47 insertions(+), 33 deletions(-)

    diff --git a/drivers/hid/hid-magicmouse.c b/drivers/hid/hid-magicmouse.c
    index 698e645..f3ce099 100644
    --- a/drivers/hid/hid-magicmouse.c
    +++ b/drivers/hid/hid-magicmouse.c
    @@ -34,9 +34,17 @@ module_param(emulate_scroll_wheel, bool, 0644);
    MODULE_PARM_DESC(emulate_scroll_wheel, "Emulate a scroll wheel");

    static unsigned int scroll_speed = 32;
    -static int param_set_scroll_speed(const char *val, struct kernel_param *kp) {
    - unsigned long speed;
    - if (!val || strict_strtoul(val, 0, &speed) || speed > 63)
    +static int param_set_scroll_speed(const char *val, struct kernel_param *kp)
    +{
    + unsigned int speed;
    + int rv;
    +
    + if (!val)
    + return -EINVAL;
    + rv = kstrtouint(val, 0, &speed);
    + if (rv < 0)
    + return rv;
    + if (speed > 63)
    return -EINVAL;
    scroll_speed = speed;
    return 0;
    diff --git a/drivers/hid/hid-ntrig.c b/drivers/hid/hid-ntrig.c
    index beb4034..4bbab1a 100644
    --- a/drivers/hid/hid-ntrig.c
    +++ b/drivers/hid/hid-ntrig.c
    @@ -205,11 +205,12 @@ static ssize_t set_min_width(struct device *dev,
    struct hid_device *hdev = container_of(dev, struct hid_device, dev);
    struct ntrig_data *nd = hid_get_drvdata(hdev);

    - unsigned long val;
    -
    - if (strict_strtoul(buf, 0, &val))
    - return -EINVAL;
    + u16 val;
    + int rv;

    + rv = kstrtou16(buf, 0, &val);
    + if (rv < 0)
    + return rv;
    if (val > nd->sensor_physical_width)
    return -EINVAL;

    @@ -240,11 +241,12 @@ static ssize_t set_min_height(struct device *dev,
    struct hid_device *hdev = container_of(dev, struct hid_device, dev);
    struct ntrig_data *nd = hid_get_drvdata(hdev);

    - unsigned long val;
    -
    - if (strict_strtoul(buf, 0, &val))
    - return -EINVAL;
    + u16 val;
    + int rv;

    + rv = kstrtou16(buf, 0, &val);
    + if (rv < 0)
    + return rv;
    if (val > nd->sensor_physical_height)
    return -EINVAL;

    @@ -274,11 +276,12 @@ static ssize_t set_activate_slack(struct device *dev,
    struct hid_device *hdev = container_of(dev, struct hid_device, dev);
    struct ntrig_data *nd = hid_get_drvdata(hdev);

    - unsigned long val;
    -
    - if (strict_strtoul(buf, 0, &val))
    - return -EINVAL;
    + u8 val;
    + int rv;

    + rv = kstrtou8(buf, 0, &val);
    + if (rv < 0)
    + return rv;
    if (val > 0x7f)
    return -EINVAL;

    @@ -309,11 +312,12 @@ static ssize_t set_activation_width(struct device *dev,
    struct hid_device *hdev = container_of(dev, struct hid_device, dev);
    struct ntrig_data *nd = hid_get_drvdata(hdev);

    - unsigned long val;
    -
    - if (strict_strtoul(buf, 0, &val))
    - return -EINVAL;
    + u16 val;
    + int rv;

    + rv = kstrtou16(buf, 0, &val);
    + if (rv < 0)
    + return rv;
    if (val > nd->sensor_physical_width)
    return -EINVAL;

    @@ -345,11 +349,12 @@ static ssize_t set_activation_height(struct device *dev,
    struct hid_device *hdev = container_of(dev, struct hid_device, dev);
    struct ntrig_data *nd = hid_get_drvdata(hdev);

    - unsigned long val;
    -
    - if (strict_strtoul(buf, 0, &val))
    - return -EINVAL;
    + u16 val;
    + int rv;

    + rv = kstrtou16(buf, 0, &val);
    + if (rv < 0)
    + return rv;
    if (val > nd->sensor_physical_height)
    return -EINVAL;

    @@ -379,11 +384,12 @@ static ssize_t set_deactivate_slack(struct device *dev,
    struct hid_device *hdev = container_of(dev, struct hid_device, dev);
    struct ntrig_data *nd = hid_get_drvdata(hdev);

    - unsigned long val;
    -
    - if (strict_strtoul(buf, 0, &val))
    - return -EINVAL;
    + u8 val;
    + int rv;

    + rv = kstrtou8(buf, 0, &val);
    + if (rv < 0)
    + return rv;
    /*
    * No more than 8 terminal frames have been observed so far
    * and higher slack is highly likely to leave the single
    diff --git a/drivers/hid/hid-roccat-kone.c b/drivers/hid/hid-roccat-kone.c
    index cbd8cc4..f803932 100644
    --- a/drivers/hid/hid-roccat-kone.c
    +++ b/drivers/hid/hid-roccat-kone.c
    @@ -464,13 +464,13 @@ static ssize_t kone_sysfs_set_tcu(struct device *dev,
    struct kone_device *kone;
    struct usb_device *usb_dev;
    int retval;
    - unsigned long state;
    + int state;

    dev = dev->parent->parent;
    kone = hid_get_drvdata(dev_get_drvdata(dev));
    usb_dev = interface_to_usbdev(to_usb_interface(dev));

    - retval = strict_strtoul(buf, 10, &state);
    + retval = kstrtoint(buf, 10, &state);
    if (retval)
    return retval;

    @@ -551,13 +551,13 @@ static ssize_t kone_sysfs_set_startup_profile(struct device *dev,
    struct kone_device *kone;
    struct usb_device *usb_dev;
    int retval;
    - unsigned long new_startup_profile;
    + int new_startup_profile;

    dev = dev->parent->parent;
    kone = hid_get_drvdata(dev_get_drvdata(dev));
    usb_dev = interface_to_usbdev(to_usb_interface(dev));

    - retval = strict_strtoul(buf, 10, &new_startup_profile);
    + retval = kstrtoint(buf, 10, &new_startup_profile);
    if (retval)
    return retval;

    diff --git a/drivers/hid/hid-roccat-koneplus.c b/drivers/hid/hid-roccat-koneplus.c
    index 1608c8d..6e13756 100644
    --- a/drivers/hid/hid-roccat-koneplus.c
    +++ b/drivers/hid/hid-roccat-koneplus.c
    @@ -463,14 +463,14 @@ static ssize_t koneplus_sysfs_set_startup_profile(struct device *dev,
    {
    struct koneplus_device *koneplus;
    struct usb_device *usb_dev;
    - unsigned long profile;
    + u8 profile;
    int retval;

    dev = dev->parent->parent;
    koneplus = hid_get_drvdata(dev_get_drvdata(dev));
    usb_dev = interface_to_usbdev(to_usb_interface(dev));

    - retval = strict_strtoul(buf, 10, &profile);
    + retval = kstrtou8(buf, 10, &profile);
    if (retval)
    return retval;

    --
    1.7.3.4


    \
     
     \ /
      Last update: 2011-02-05 15:27    [W:0.050 / U:0.488 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site