On Thu, Apr 6, 2017 at 11:11 AM, Benjamin Tissoires <benjamin.tissoires@xxxxxxxxxx> wrote: > Hi Carlo, Hi Benjamin, [cut] >> +static int asus_kbd_get_report(struct hid_device *hdev, u8 *buf, size_t buf_size) > > Nitpick: should be asus_kbd_set_report() right :) [cut] >> +static void asus_kbd_backlight_work(struct work_struct *work) >> +{ >> + struct asus_kbd_leds *led = container_of(work, struct asus_kbd_leds, work); >> + u8 buf[] = { FEATURE_KBD_REPORT_ID, 0xba, 0xc5, 0xc4, 0x00 }; >> + int ret; >> + > > You should probably protect leds->removed by a mutex here to avoid > having it set to false right after the test. (or not, see asus_remove()) Yeah, makes sense. [cut] >> + /* Initialize keyboard */ >> + if (asus_kbd_init(hdev) < 0) >> + return -ENODEV; > > Don't hide the returned error code please. I know it'll be dropped in > the end, but better not hiding it with an other one. (same for the next > 2) ok for the next one but when checking the bit field in kbd_func I think we still want to return -ENODEV. >> struct input_dev *input = hi->input; >> @@ -178,7 +326,6 @@ static int asus_input_configured(struct hid_device *hdev, struct hid_input *hi) >> >> if (drvdata->quirks & QUIRK_IS_MULTITOUCH) { >> int ret; >> - > > Leftover from the previous patch, but please don't remove this empty > line, it's the coding style policy. yeah, this slipped through >> input_set_abs_params(input, ABS_MT_POSITION_X, 0, MAX_X, 0, 0); >> input_set_abs_params(input, ABS_MT_POSITION_Y, 0, MAX_Y, 0, 0); >> input_set_abs_params(input, ABS_TOOL_WIDTH, 0, MAX_TOUCH_MAJOR, 0, 0); >> @@ -198,6 +345,10 @@ static int asus_input_configured(struct hid_device *hdev, struct hid_input *hi) >> >> drvdata->input = input; >> >> + if (drvdata->enable_backlight) >> + if (asus_kbd_register_leds(hdev)) > > could be changed into: > if (drvdata->enable_backlight && asus_kbd_register_leds(hdev)) OK [cut] >> +static void asus_remove(struct hid_device *hdev) >> +{ >> + struct asus_drvdata *drvdata = hid_get_drvdata(hdev); >> + >> + if (drvdata->kbd_backlight) >> + drvdata->kbd_backlight->removed = true; > > Add a cancel_work_sync() here too to terminate currently working > workers. Bonus point, you don't need the mutex if you call > cancel_work_sync(). I'll do. Thanks for the quick review. -- Carlo Caione | +39.340.80.30.096 | Endless -- To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html