Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1617771
| From | Carlo Caione <carlo@endlessm.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH v2] HID: asus: support backlight on USB keyboards |
| Date | 2017-04-06 11:30 +0200 |
| Message-ID | <ttbTQ-6GC-37@gated-at.bofh.it> (permalink) |
| References | <tsUpX-3RS-1@gated-at.bofh.it> <ttbK9-6Cm-11@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Thu, Apr 6, 2017 at 11:11 AM, Benjamin Tissoires
<benjamin.tissoires@redhat.com> 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
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
[PATCH v2] HID: asus: support backlight on USB keyboards Carlo Caione <carlo@caione.org> - 2017-04-05 16:50 +0200
Re: [PATCH v2] HID: asus: support backlight on USB keyboards Benjamin Tissoires <benjamin.tissoires@redhat.com> - 2017-04-06 11:20 +0200
Re: [PATCH v2] HID: asus: support backlight on USB keyboards Carlo Caione <carlo@endlessm.com> - 2017-04-06 11:30 +0200
csiph-web