|
@@ -1255,10 +1255,15 @@ static ssize_t toshiba_kbd_bl_mode_store(struct device *dev,
|
|
const char *buf, size_t count)
|
|
const char *buf, size_t count)
|
|
{
|
|
{
|
|
struct toshiba_acpi_dev *toshiba = dev_get_drvdata(dev);
|
|
struct toshiba_acpi_dev *toshiba = dev_get_drvdata(dev);
|
|
- int mode = -1;
|
|
|
|
- int time = -1;
|
|
|
|
|
|
+ int mode;
|
|
|
|
+ int time;
|
|
|
|
+ int ret;
|
|
|
|
+
|
|
|
|
|
|
- if (sscanf(buf, "%i", &mode) != 1 && (mode != 2 || mode != 1))
|
|
|
|
|
|
+ ret = kstrtoint(buf, 0, &mode);
|
|
|
|
+ if (ret)
|
|
|
|
+ return ret;
|
|
|
|
+ if (mode != SCI_KBD_MODE_FNZ && mode != SCI_KBD_MODE_AUTO)
|
|
return -EINVAL;
|
|
return -EINVAL;
|
|
|
|
|
|
/* Set the Keyboard Backlight Mode where:
|
|
/* Set the Keyboard Backlight Mode where:
|
|
@@ -1266,11 +1271,12 @@ static ssize_t toshiba_kbd_bl_mode_store(struct device *dev,
|
|
* Auto - KBD backlight turns off automatically in given time
|
|
* Auto - KBD backlight turns off automatically in given time
|
|
* FN-Z - KBD backlight "toggles" when hotkey pressed
|
|
* FN-Z - KBD backlight "toggles" when hotkey pressed
|
|
*/
|
|
*/
|
|
- if (mode != -1 && toshiba->kbd_mode != mode) {
|
|
|
|
|
|
+ if (toshiba->kbd_mode != mode) {
|
|
time = toshiba->kbd_time << HCI_MISC_SHIFT;
|
|
time = toshiba->kbd_time << HCI_MISC_SHIFT;
|
|
time = time + toshiba->kbd_mode;
|
|
time = time + toshiba->kbd_mode;
|
|
- if (toshiba_kbd_illum_status_set(toshiba, time) < 0)
|
|
|
|
- return -EIO;
|
|
|
|
|
|
+ ret = toshiba_kbd_illum_status_set(toshiba, time);
|
|
|
|
+ if (ret)
|
|
|
|
+ return ret;
|
|
toshiba->kbd_mode = mode;
|
|
toshiba->kbd_mode = mode;
|
|
}
|
|
}
|
|
|
|
|