Commit 76496e7a authored by JJ Ding's avatar JJ Ding Committed by Dmitry Torokhov

Input: convert obsolete strict_strtox to kstrtox

With commit 67d0a075 we mark strict_strtox
as obsolete. Convert all remaining such uses in drivers/input/.

Also change long to appropriate types, and return error conditions
from kstrtox separately, as Dmitry sugguests.
Signed-off-by: default avatarJJ Ding <dgdunix@gmail.com>
Signed-off-by: default avatarDmitry Torokhov <dtor@mail.ru>
parent 7cf801cf
...@@ -83,10 +83,12 @@ static ssize_t input_polldev_set_poll(struct device *dev, ...@@ -83,10 +83,12 @@ static ssize_t input_polldev_set_poll(struct device *dev,
{ {
struct input_polled_dev *polldev = dev_get_drvdata(dev); struct input_polled_dev *polldev = dev_get_drvdata(dev);
struct input_dev *input = polldev->input; struct input_dev *input = polldev->input;
unsigned long interval; unsigned int interval;
int err;
if (strict_strtoul(buf, 0, &interval)) err = kstrtouint(buf, 0, &interval);
return -EINVAL; if (err)
return err;
if (interval < polldev->poll_interval_min) if (interval < polldev->poll_interval_min)
return -EINVAL; return -EINVAL;
......
...@@ -1305,7 +1305,7 @@ static ssize_t atkbd_show_extra(struct atkbd *atkbd, char *buf) ...@@ -1305,7 +1305,7 @@ static ssize_t atkbd_show_extra(struct atkbd *atkbd, char *buf)
static ssize_t atkbd_set_extra(struct atkbd *atkbd, const char *buf, size_t count) static ssize_t atkbd_set_extra(struct atkbd *atkbd, const char *buf, size_t count)
{ {
struct input_dev *old_dev, *new_dev; struct input_dev *old_dev, *new_dev;
unsigned long value; unsigned int value;
int err; int err;
bool old_extra; bool old_extra;
unsigned char old_set; unsigned char old_set;
...@@ -1313,7 +1313,11 @@ static ssize_t atkbd_set_extra(struct atkbd *atkbd, const char *buf, size_t coun ...@@ -1313,7 +1313,11 @@ static ssize_t atkbd_set_extra(struct atkbd *atkbd, const char *buf, size_t coun
if (!atkbd->write) if (!atkbd->write)
return -EIO; return -EIO;
if (strict_strtoul(buf, 10, &value) || value > 1) err = kstrtouint(buf, 10, &value);
if (err)
return err;
if (value > 1)
return -EINVAL; return -EINVAL;
if (atkbd->extra != value) { if (atkbd->extra != value) {
...@@ -1389,11 +1393,15 @@ static ssize_t atkbd_show_scroll(struct atkbd *atkbd, char *buf) ...@@ -1389,11 +1393,15 @@ static ssize_t atkbd_show_scroll(struct atkbd *atkbd, char *buf)
static ssize_t atkbd_set_scroll(struct atkbd *atkbd, const char *buf, size_t count) static ssize_t atkbd_set_scroll(struct atkbd *atkbd, const char *buf, size_t count)
{ {
struct input_dev *old_dev, *new_dev; struct input_dev *old_dev, *new_dev;
unsigned long value; unsigned int value;
int err; int err;
bool old_scroll; bool old_scroll;
if (strict_strtoul(buf, 10, &value) || value > 1) err = kstrtouint(buf, 10, &value);
if (err)
return err;
if (value > 1)
return -EINVAL; return -EINVAL;
if (atkbd->scroll != value) { if (atkbd->scroll != value) {
...@@ -1433,7 +1441,7 @@ static ssize_t atkbd_show_set(struct atkbd *atkbd, char *buf) ...@@ -1433,7 +1441,7 @@ static ssize_t atkbd_show_set(struct atkbd *atkbd, char *buf)
static ssize_t atkbd_set_set(struct atkbd *atkbd, const char *buf, size_t count) static ssize_t atkbd_set_set(struct atkbd *atkbd, const char *buf, size_t count)
{ {
struct input_dev *old_dev, *new_dev; struct input_dev *old_dev, *new_dev;
unsigned long value; unsigned int value;
int err; int err;
unsigned char old_set; unsigned char old_set;
bool old_extra; bool old_extra;
...@@ -1441,7 +1449,11 @@ static ssize_t atkbd_set_set(struct atkbd *atkbd, const char *buf, size_t count) ...@@ -1441,7 +1449,11 @@ static ssize_t atkbd_set_set(struct atkbd *atkbd, const char *buf, size_t count)
if (!atkbd->write) if (!atkbd->write)
return -EIO; return -EIO;
if (strict_strtoul(buf, 10, &value) || (value != 2 && value != 3)) err = kstrtouint(buf, 10, &value);
if (err)
return err;
if (value != 2 && value != 3)
return -EINVAL; return -EINVAL;
if (atkbd->set != value) { if (atkbd->set != value) {
...@@ -1484,14 +1496,18 @@ static ssize_t atkbd_show_softrepeat(struct atkbd *atkbd, char *buf) ...@@ -1484,14 +1496,18 @@ static ssize_t atkbd_show_softrepeat(struct atkbd *atkbd, char *buf)
static ssize_t atkbd_set_softrepeat(struct atkbd *atkbd, const char *buf, size_t count) static ssize_t atkbd_set_softrepeat(struct atkbd *atkbd, const char *buf, size_t count)
{ {
struct input_dev *old_dev, *new_dev; struct input_dev *old_dev, *new_dev;
unsigned long value; unsigned int value;
int err; int err;
bool old_softrepeat, old_softraw; bool old_softrepeat, old_softraw;
if (!atkbd->write) if (!atkbd->write)
return -EIO; return -EIO;
if (strict_strtoul(buf, 10, &value) || value > 1) err = kstrtouint(buf, 10, &value);
if (err)
return err;
if (value > 1)
return -EINVAL; return -EINVAL;
if (atkbd->softrepeat != value) { if (atkbd->softrepeat != value) {
...@@ -1534,11 +1550,15 @@ static ssize_t atkbd_show_softraw(struct atkbd *atkbd, char *buf) ...@@ -1534,11 +1550,15 @@ static ssize_t atkbd_show_softraw(struct atkbd *atkbd, char *buf)
static ssize_t atkbd_set_softraw(struct atkbd *atkbd, const char *buf, size_t count) static ssize_t atkbd_set_softraw(struct atkbd *atkbd, const char *buf, size_t count)
{ {
struct input_dev *old_dev, *new_dev; struct input_dev *old_dev, *new_dev;
unsigned long value; unsigned int value;
int err; int err;
bool old_softraw; bool old_softraw;
if (strict_strtoul(buf, 10, &value) || value > 1) err = kstrtouint(buf, 10, &value);
if (err)
return err;
if (value > 1)
return -EINVAL; return -EINVAL;
if (atkbd->softraw != value) { if (atkbd->softraw != value) {
......
...@@ -545,13 +545,12 @@ static ssize_t lm8323_pwm_store_time(struct device *dev, ...@@ -545,13 +545,12 @@ static ssize_t lm8323_pwm_store_time(struct device *dev,
{ {
struct led_classdev *led_cdev = dev_get_drvdata(dev); struct led_classdev *led_cdev = dev_get_drvdata(dev);
struct lm8323_pwm *pwm = cdev_to_pwm(led_cdev); struct lm8323_pwm *pwm = cdev_to_pwm(led_cdev);
int ret; int ret, time;
unsigned long time;
ret = strict_strtoul(buf, 10, &time); ret = kstrtoint(buf, 10, &time);
/* Numbers only, please. */ /* Numbers only, please. */
if (ret) if (ret)
return -EINVAL; return ret;
pwm->fade_time = time; pwm->fade_time = time;
...@@ -613,9 +612,9 @@ static ssize_t lm8323_set_disable(struct device *dev, ...@@ -613,9 +612,9 @@ static ssize_t lm8323_set_disable(struct device *dev,
{ {
struct lm8323_chip *lm = dev_get_drvdata(dev); struct lm8323_chip *lm = dev_get_drvdata(dev);
int ret; int ret;
unsigned long i; unsigned int i;
ret = strict_strtoul(buf, 10, &i); ret = kstrtouint(buf, 10, &i);
mutex_lock(&lm->lock); mutex_lock(&lm->lock);
lm->kp_enabled = !i; lm->kp_enabled = !i;
......
...@@ -451,10 +451,10 @@ static ssize_t adxl34x_disable_store(struct device *dev, ...@@ -451,10 +451,10 @@ static ssize_t adxl34x_disable_store(struct device *dev,
const char *buf, size_t count) const char *buf, size_t count)
{ {
struct adxl34x *ac = dev_get_drvdata(dev); struct adxl34x *ac = dev_get_drvdata(dev);
unsigned long val; unsigned int val;
int error; int error;
error = strict_strtoul(buf, 10, &val); error = kstrtouint(buf, 10, &val);
if (error) if (error)
return error; return error;
...@@ -540,10 +540,10 @@ static ssize_t adxl34x_rate_store(struct device *dev, ...@@ -540,10 +540,10 @@ static ssize_t adxl34x_rate_store(struct device *dev,
const char *buf, size_t count) const char *buf, size_t count)
{ {
struct adxl34x *ac = dev_get_drvdata(dev); struct adxl34x *ac = dev_get_drvdata(dev);
unsigned long val; unsigned char val;
int error; int error;
error = strict_strtoul(buf, 10, &val); error = kstrtou8(buf, 10, &val);
if (error) if (error)
return error; return error;
...@@ -575,10 +575,10 @@ static ssize_t adxl34x_autosleep_store(struct device *dev, ...@@ -575,10 +575,10 @@ static ssize_t adxl34x_autosleep_store(struct device *dev,
const char *buf, size_t count) const char *buf, size_t count)
{ {
struct adxl34x *ac = dev_get_drvdata(dev); struct adxl34x *ac = dev_get_drvdata(dev);
unsigned long val; unsigned int val;
int error; int error;
error = strict_strtoul(buf, 10, &val); error = kstrtouint(buf, 10, &val);
if (error) if (error)
return error; return error;
...@@ -622,13 +622,13 @@ static ssize_t adxl34x_write_store(struct device *dev, ...@@ -622,13 +622,13 @@ static ssize_t adxl34x_write_store(struct device *dev,
const char *buf, size_t count) const char *buf, size_t count)
{ {
struct adxl34x *ac = dev_get_drvdata(dev); struct adxl34x *ac = dev_get_drvdata(dev);
unsigned long val; unsigned int val;
int error; int error;
/* /*
* This allows basic ADXL register write access for debug purposes. * This allows basic ADXL register write access for debug purposes.
*/ */
error = strict_strtoul(buf, 16, &val); error = kstrtouint(buf, 16, &val);
if (error) if (error)
return error; return error;
......
...@@ -41,13 +41,13 @@ static int ati_remote2_set_mask(const char *val, ...@@ -41,13 +41,13 @@ static int ati_remote2_set_mask(const char *val,
const struct kernel_param *kp, const struct kernel_param *kp,
unsigned int max) unsigned int max)
{ {
unsigned long mask; unsigned int mask;
int ret; int ret;
if (!val) if (!val)
return -EINVAL; return -EINVAL;
ret = strict_strtoul(val, 0, &mask); ret = kstrtouint(val, 0, &mask);
if (ret) if (ret)
return ret; return ret;
...@@ -719,11 +719,12 @@ static ssize_t ati_remote2_store_channel_mask(struct device *dev, ...@@ -719,11 +719,12 @@ static ssize_t ati_remote2_store_channel_mask(struct device *dev,
struct usb_device *udev = to_usb_device(dev); struct usb_device *udev = to_usb_device(dev);
struct usb_interface *intf = usb_ifnum_to_if(udev, 0); struct usb_interface *intf = usb_ifnum_to_if(udev, 0);
struct ati_remote2 *ar2 = usb_get_intfdata(intf); struct ati_remote2 *ar2 = usb_get_intfdata(intf);
unsigned long mask; unsigned int mask;
int r; int r;
if (strict_strtoul(buf, 0, &mask)) r = kstrtouint(buf, 0, &mask);
return -EINVAL; if (r)
return r;
if (mask & ~ATI_REMOTE2_MAX_CHANNEL_MASK) if (mask & ~ATI_REMOTE2_MAX_CHANNEL_MASK)
return -EINVAL; return -EINVAL;
...@@ -768,10 +769,12 @@ static ssize_t ati_remote2_store_mode_mask(struct device *dev, ...@@ -768,10 +769,12 @@ static ssize_t ati_remote2_store_mode_mask(struct device *dev,
struct usb_device *udev = to_usb_device(dev); struct usb_device *udev = to_usb_device(dev);
struct usb_interface *intf = usb_ifnum_to_if(udev, 0); struct usb_interface *intf = usb_ifnum_to_if(udev, 0);
struct ati_remote2 *ar2 = usb_get_intfdata(intf); struct ati_remote2 *ar2 = usb_get_intfdata(intf);
unsigned long mask; unsigned int mask;
int err;
if (strict_strtoul(buf, 0, &mask)) err = kstrtouint(buf, 0, &mask);
return -EINVAL; if (err)
return err;
if (mask & ~ATI_REMOTE2_MAX_MODE_MASK) if (mask & ~ATI_REMOTE2_MAX_MODE_MASK)
return -EINVAL; return -EINVAL;
......
...@@ -1031,16 +1031,13 @@ static ssize_t elantech_set_int_attr(struct psmouse *psmouse, ...@@ -1031,16 +1031,13 @@ static ssize_t elantech_set_int_attr(struct psmouse *psmouse,
struct elantech_data *etd = psmouse->private; struct elantech_data *etd = psmouse->private;
struct elantech_attr_data *attr = data; struct elantech_attr_data *attr = data;
unsigned char *reg = (unsigned char *) etd + attr->field_offset; unsigned char *reg = (unsigned char *) etd + attr->field_offset;
unsigned long value; unsigned char value;
int err; int err;
err = strict_strtoul(buf, 16, &value); err = kstrtou8(buf, 16, &value);
if (err) if (err)
return err; return err;
if (value > 0xff)
return -EINVAL;
/* Do we need to preserve some bits for version 2 hardware too? */ /* Do we need to preserve some bits for version 2 hardware too? */
if (etd->hw_version == 1) { if (etd->hw_version == 1) {
if (attr->reg == 0x10) if (attr->reg == 0x10)
......
...@@ -789,11 +789,14 @@ static ssize_t hgpk_set_powered(struct psmouse *psmouse, void *data, ...@@ -789,11 +789,14 @@ static ssize_t hgpk_set_powered(struct psmouse *psmouse, void *data,
const char *buf, size_t count) const char *buf, size_t count)
{ {
struct hgpk_data *priv = psmouse->private; struct hgpk_data *priv = psmouse->private;
unsigned long value; unsigned int value;
int err; int err;
err = strict_strtoul(buf, 10, &value); err = kstrtouint(buf, 10, &value);
if (err || value > 1) if (err)
return err;
if (value > 1)
return -EINVAL; return -EINVAL;
if (value != priv->powered) { if (value != priv->powered) {
...@@ -881,11 +884,14 @@ static ssize_t hgpk_trigger_recal(struct psmouse *psmouse, void *data, ...@@ -881,11 +884,14 @@ static ssize_t hgpk_trigger_recal(struct psmouse *psmouse, void *data,
const char *buf, size_t count) const char *buf, size_t count)
{ {
struct hgpk_data *priv = psmouse->private; struct hgpk_data *priv = psmouse->private;
unsigned long value; unsigned int value;
int err; int err;
err = strict_strtoul(buf, 10, &value); err = kstrtouint(buf, 10, &value);
if (err || value != 1) if (err)
return err;
if (value != 1)
return -EINVAL; return -EINVAL;
/* /*
......
...@@ -155,9 +155,14 @@ static ssize_t ps2pp_attr_show_smartscroll(struct psmouse *psmouse, ...@@ -155,9 +155,14 @@ static ssize_t ps2pp_attr_show_smartscroll(struct psmouse *psmouse,
static ssize_t ps2pp_attr_set_smartscroll(struct psmouse *psmouse, void *data, static ssize_t ps2pp_attr_set_smartscroll(struct psmouse *psmouse, void *data,
const char *buf, size_t count) const char *buf, size_t count)
{ {
unsigned long value; unsigned int value;
int err;
if (strict_strtoul(buf, 10, &value) || value > 1) err = kstrtouint(buf, 10, &value);
if (err)
return err;
if (value > 1)
return -EINVAL; return -EINVAL;
ps2pp_set_smartscroll(psmouse, value); ps2pp_set_smartscroll(psmouse, value);
......
...@@ -1558,13 +1558,12 @@ static ssize_t psmouse_show_int_attr(struct psmouse *psmouse, void *offset, char ...@@ -1558,13 +1558,12 @@ static ssize_t psmouse_show_int_attr(struct psmouse *psmouse, void *offset, char
static ssize_t psmouse_set_int_attr(struct psmouse *psmouse, void *offset, const char *buf, size_t count) static ssize_t psmouse_set_int_attr(struct psmouse *psmouse, void *offset, const char *buf, size_t count)
{ {
unsigned int *field = (unsigned int *)((char *)psmouse + (size_t)offset); unsigned int *field = (unsigned int *)((char *)psmouse + (size_t)offset);
unsigned long value; unsigned int value;
int err;
if (strict_strtoul(buf, 10, &value))
return -EINVAL;
if ((unsigned int)value != value) err = kstrtouint(buf, 10, &value);
return -EINVAL; if (err)
return err;
*field = value; *field = value;
...@@ -1671,10 +1670,12 @@ static ssize_t psmouse_attr_set_protocol(struct psmouse *psmouse, void *data, co ...@@ -1671,10 +1670,12 @@ static ssize_t psmouse_attr_set_protocol(struct psmouse *psmouse, void *data, co
static ssize_t psmouse_attr_set_rate(struct psmouse *psmouse, void *data, const char *buf, size_t count) static ssize_t psmouse_attr_set_rate(struct psmouse *psmouse, void *data, const char *buf, size_t count)
{ {
unsigned long value; unsigned int value;
int err;
if (strict_strtoul(buf, 10, &value)) err = kstrtouint(buf, 10, &value);
return -EINVAL; if (err)
return err;
psmouse->set_rate(psmouse, value); psmouse->set_rate(psmouse, value);
return count; return count;
...@@ -1682,10 +1683,12 @@ static ssize_t psmouse_attr_set_rate(struct psmouse *psmouse, void *data, const ...@@ -1682,10 +1683,12 @@ static ssize_t psmouse_attr_set_rate(struct psmouse *psmouse, void *data, const
static ssize_t psmouse_attr_set_resolution(struct psmouse *psmouse, void *data, const char *buf, size_t count) static ssize_t psmouse_attr_set_resolution(struct psmouse *psmouse, void *data, const char *buf, size_t count)
{ {
unsigned long value; unsigned int value;
int err;
if (strict_strtoul(buf, 10, &value)) err = kstrtouint(buf, 10, &value);
return -EINVAL; if (err)
return err;
psmouse->set_resolution(psmouse, value); psmouse->set_resolution(psmouse, value);
return count; return count;
......
...@@ -408,7 +408,7 @@ static int fsp_onpad_hscr(struct psmouse *psmouse, bool enable) ...@@ -408,7 +408,7 @@ static int fsp_onpad_hscr(struct psmouse *psmouse, bool enable)
static ssize_t fsp_attr_set_setreg(struct psmouse *psmouse, void *data, static ssize_t fsp_attr_set_setreg(struct psmouse *psmouse, void *data,
const char *buf, size_t count) const char *buf, size_t count)
{ {
unsigned long reg, val; int reg, val;
char *rest; char *rest;
ssize_t retval; ssize_t retval;
...@@ -416,7 +416,11 @@ static ssize_t fsp_attr_set_setreg(struct psmouse *psmouse, void *data, ...@@ -416,7 +416,11 @@ static ssize_t fsp_attr_set_setreg(struct psmouse *psmouse, void *data,
if (rest == buf || *rest != ' ' || reg > 0xff) if (rest == buf || *rest != ' ' || reg > 0xff)
return -EINVAL; return -EINVAL;
if (strict_strtoul(rest + 1, 16, &val) || val > 0xff) retval = kstrtoint(rest + 1, 16, &val);
if (retval)
return retval;
if (val > 0xff)
return -EINVAL; return -EINVAL;
if (fsp_reg_write_enable(psmouse, true)) if (fsp_reg_write_enable(psmouse, true))
...@@ -448,10 +452,13 @@ static ssize_t fsp_attr_set_getreg(struct psmouse *psmouse, void *data, ...@@ -448,10 +452,13 @@ static ssize_t fsp_attr_set_getreg(struct psmouse *psmouse, void *data,
const char *buf, size_t count) const char *buf, size_t count)
{ {
struct fsp_data *pad = psmouse->private; struct fsp_data *pad = psmouse->private;
unsigned long reg; int reg, val, err;
int val;
err = kstrtoint(buf, 16, &reg);
if (err)
return err;
if (strict_strtoul(buf, 16, &reg) || reg > 0xff) if (reg > 0xff)
return -EINVAL; return -EINVAL;
if (fsp_reg_read(psmouse, reg, &val)) if (fsp_reg_read(psmouse, reg, &val))
...@@ -480,9 +487,13 @@ static ssize_t fsp_attr_show_pagereg(struct psmouse *psmouse, ...@@ -480,9 +487,13 @@ static ssize_t fsp_attr_show_pagereg(struct psmouse *psmouse,
static ssize_t fsp_attr_set_pagereg(struct psmouse *psmouse, void *data, static ssize_t fsp_attr_set_pagereg(struct psmouse *psmouse, void *data,
const char *buf, size_t count) const char *buf, size_t count)
{ {
unsigned long val; int val, err;
if (strict_strtoul(buf, 16, &val) || val > 0xff) err = kstrtoint(buf, 16, &val);
if (err)
return err;
if (val > 0xff)
return -EINVAL; return -EINVAL;
if (fsp_page_reg_write(psmouse, val)) if (fsp_page_reg_write(psmouse, val))
...@@ -505,9 +516,14 @@ static ssize_t fsp_attr_show_vscroll(struct psmouse *psmouse, ...@@ -505,9 +516,14 @@ static ssize_t fsp_attr_show_vscroll(struct psmouse *psmouse,
static ssize_t fsp_attr_set_vscroll(struct psmouse *psmouse, void *data, static ssize_t fsp_attr_set_vscroll(struct psmouse *psmouse, void *data,
const char *buf, size_t count) const char *buf, size_t count)
{ {
unsigned long val; unsigned int val;
int err;
err = kstrtouint(buf, 10, &val);
if (err)
return err;
if (strict_strtoul(buf, 10, &val) || val > 1) if (val > 1)
return -EINVAL; return -EINVAL;
fsp_onpad_vscr(psmouse, val); fsp_onpad_vscr(psmouse, val);
...@@ -529,9 +545,14 @@ static ssize_t fsp_attr_show_hscroll(struct psmouse *psmouse, ...@@ -529,9 +545,14 @@ static ssize_t fsp_attr_show_hscroll(struct psmouse *psmouse,
static ssize_t fsp_attr_set_hscroll(struct psmouse *psmouse, void *data, static ssize_t fsp_attr_set_hscroll(struct psmouse *psmouse, void *data,
const char *buf, size_t count) const char *buf, size_t count)
{ {
unsigned long val; unsigned int val;
int err;
err = kstrtouint(buf, 10, &val);
if (err)
return err;
if (strict_strtoul(buf, 10, &val) || val > 1) if (val > 1)
return -EINVAL; return -EINVAL;
fsp_onpad_hscr(psmouse, val); fsp_onpad_hscr(psmouse, val);
......
...@@ -89,10 +89,12 @@ static ssize_t trackpoint_set_int_attr(struct psmouse *psmouse, void *data, ...@@ -89,10 +89,12 @@ static ssize_t trackpoint_set_int_attr(struct psmouse *psmouse, void *data,
struct trackpoint_data *tp = psmouse->private; struct trackpoint_data *tp = psmouse->private;
struct trackpoint_attr_data *attr = data; struct trackpoint_attr_data *attr = data;
unsigned char *field = (unsigned char *)((char *)tp + attr->field_offset); unsigned char *field = (unsigned char *)((char *)tp + attr->field_offset);
unsigned long value; unsigned char value;
int err;
if (strict_strtoul(buf, 10, &value) || value > 255) err = kstrtou8(buf, 10, &value);
return -EINVAL; if (err)
return err;
*field = value; *field = value;
trackpoint_write(&psmouse->ps2dev, attr->command, value); trackpoint_write(&psmouse->ps2dev, attr->command, value);
...@@ -115,9 +117,14 @@ static ssize_t trackpoint_set_bit_attr(struct psmouse *psmouse, void *data, ...@@ -115,9 +117,14 @@ static ssize_t trackpoint_set_bit_attr(struct psmouse *psmouse, void *data,
struct trackpoint_data *tp = psmouse->private; struct trackpoint_data *tp = psmouse->private;
struct trackpoint_attr_data *attr = data; struct trackpoint_attr_data *attr = data;
unsigned char *field = (unsigned char *)((char *)tp + attr->field_offset); unsigned char *field = (unsigned char *)((char *)tp + attr->field_offset);
unsigned long value; unsigned int value;
int err;
err = kstrtouint(buf, 10, &value);
if (err)
return err;
if (strict_strtoul(buf, 10, &value) || value > 1) if (value > 1)
return -EINVAL; return -EINVAL;
if (attr->inverted) if (attr->inverted)
......
...@@ -1198,9 +1198,9 @@ static ssize_t ...@@ -1198,9 +1198,9 @@ static ssize_t
store_tabletXtilt(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) store_tabletXtilt(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
{ {
struct aiptek *aiptek = dev_get_drvdata(dev); struct aiptek *aiptek = dev_get_drvdata(dev);
long x; int x;
if (strict_strtol(buf, 10, &x)) { if (kstrtoint(buf, 10, &x)) {
size_t len = buf[count - 1] == '\n' ? count - 1 : count; size_t len = buf[count - 1] == '\n' ? count - 1 : count;
if (strncmp(buf, "disable", len)) if (strncmp(buf, "disable", len))
...@@ -1240,9 +1240,9 @@ static ssize_t ...@@ -1240,9 +1240,9 @@ static ssize_t
store_tabletYtilt(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) store_tabletYtilt(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
{ {
struct aiptek *aiptek = dev_get_drvdata(dev); struct aiptek *aiptek = dev_get_drvdata(dev);
long y; int y;
if (strict_strtol(buf, 10, &y)) { if (kstrtoint(buf, 10, &y)) {
size_t len = buf[count - 1] == '\n' ? count - 1 : count; size_t len = buf[count - 1] == '\n' ? count - 1 : count;
if (strncmp(buf, "disable", len)) if (strncmp(buf, "disable", len))
...@@ -1277,12 +1277,13 @@ static ssize_t ...@@ -1277,12 +1277,13 @@ static ssize_t
store_tabletJitterDelay(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) store_tabletJitterDelay(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
{ {
struct aiptek *aiptek = dev_get_drvdata(dev); struct aiptek *aiptek = dev_get_drvdata(dev);
long j; int err, j;
if (strict_strtol(buf, 10, &j)) err = kstrtoint(buf, 10, &j);
return -EINVAL; if (err)
return err;
aiptek->newSetting.jitterDelay = (int)j; aiptek->newSetting.jitterDelay = j;
return count; return count;
} }
...@@ -1306,12 +1307,13 @@ static ssize_t ...@@ -1306,12 +1307,13 @@ static ssize_t
store_tabletProgrammableDelay(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) store_tabletProgrammableDelay(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
{ {
struct aiptek *aiptek = dev_get_drvdata(dev); struct aiptek *aiptek = dev_get_drvdata(dev);
long d; int err, d;
if (strict_strtol(buf, 10, &d)) err = kstrtoint(buf, 10, &d);
return -EINVAL; if (err)
return err;
aiptek->newSetting.programmableDelay = (int)d; aiptek->newSetting.programmableDelay = d;
return count; return count;
} }
...@@ -1557,11 +1559,13 @@ static ssize_t ...@@ -1557,11 +1559,13 @@ static ssize_t
store_tabletWheel(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) store_tabletWheel(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
{ {
struct aiptek *aiptek = dev_get_drvdata(dev); struct aiptek *aiptek = dev_get_drvdata(dev);
long w; int err, w;
if (strict_strtol(buf, 10, &w)) return -EINVAL; err = kstrtoint(buf, 10, &w);
if (err)
return err;
aiptek->newSetting.wheel = (int)w; aiptek->newSetting.wheel = w;
return count; return count;
} }
......
...@@ -487,10 +487,10 @@ static ssize_t ad7877_disable_store(struct device *dev, ...@@ -487,10 +487,10 @@ static ssize_t ad7877_disable_store(struct device *dev,
const char *buf, size_t count) const char *buf, size_t count)
{ {
struct ad7877 *ts = dev_get_drvdata(dev); struct ad7877 *ts = dev_get_drvdata(dev);
unsigned long val; unsigned int val;
int error; int error;
error = strict_strtoul(buf, 10, &val); error = kstrtouint(buf, 10, &val);
if (error) if (error)
return error; return error;
...@@ -517,10 +517,10 @@ static ssize_t ad7877_dac_store(struct device *dev, ...@@ -517,10 +517,10 @@ static ssize_t ad7877_dac_store(struct device *dev,
const char *buf, size_t count) const char *buf, size_t count)
{ {
struct ad7877 *ts = dev_get_drvdata(dev); struct ad7877 *ts = dev_get_drvdata(dev);
unsigned long val; unsigned int val;
int error; int error;
error = strict_strtoul(buf, 10, &val); error = kstrtouint(buf, 10, &val);
if (error) if (error)
return error; return error;
...@@ -547,10 +547,10 @@ static ssize_t ad7877_gpio3_store(struct device *dev, ...@@ -547,10 +547,10 @@ static ssize_t ad7877_gpio3_store(struct device *dev,
const char *buf, size_t count) const char *buf, size_t count)
{ {
struct ad7877 *ts = dev_get_drvdata(dev); struct ad7877 *ts = dev_get_drvdata(dev);
unsigned long val; unsigned int val;
int error; int error;
error = strict_strtoul(buf, 10, &val); error = kstrtouint(buf, 10, &val);
if (error) if (error)
return error; return error;
...@@ -578,10 +578,10 @@ static ssize_t ad7877_gpio4_store(struct device *dev, ...@@ -578,10 +578,10 @@ static ssize_t ad7877_gpio4_store(struct device *dev,
const char *buf, size_t count) const char *buf, size_t count)
{ {
struct ad7877 *ts = dev_get_drvdata(dev); struct ad7877 *ts = dev_get_drvdata(dev);
unsigned long val; unsigned int val;
int error; int error;
error = strict_strtoul(buf, 10, &val); error = kstrtouint(buf, 10, &val);
if (error) if (error)
return error; return error;
......
...@@ -339,10 +339,10 @@ static ssize_t ad7879_disable_store(struct device *dev, ...@@ -339,10 +339,10 @@ static ssize_t ad7879_disable_store(struct device *dev,
const char *buf, size_t count) const char *buf, size_t count)
{ {
struct ad7879 *ts = dev_get_drvdata(dev); struct ad7879 *ts = dev_get_drvdata(dev);
unsigned long val; unsigned int val;
int error; int error;
error = strict_strtoul(buf, 10, &val); error = kstrtouint(buf, 10, &val);
if (error) if (error)
return error; return error;
......
...@@ -601,10 +601,12 @@ static ssize_t ads7846_disable_store(struct device *dev, ...@@ -601,10 +601,12 @@ static ssize_t ads7846_disable_store(struct device *dev,
const char *buf, size_t count) const char *buf, size_t count)
{ {
struct ads7846 *ts = dev_get_drvdata(dev); struct ads7846 *ts = dev_get_drvdata(dev);
unsigned long i; unsigned int i;
int err;
if (strict_strtoul(buf, 10, &i)) err = kstrtouint(buf, 10, &i);
return -EINVAL; if (err)
return err;
if (i) if (i)
ads7846_disable(ts); ads7846_disable(ts);
......
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