Thread (2 messages) 2 messages, 2 authors, 2019-02-10

Re: [PATCH] Input: apanel - switch to using brightness_set_blocking()

From: Sven Van Asbroeck <hidden>
Date: 2019-02-10 23:21:55
Also in: lkml

Hi Dmitry,

On Sat, Feb 9, 2019 at 12:19 PM Dmitry Torokhov
[off-list ref] wrote:
Now that LEDs core allows "blocking" flavor of "set brightness" method we
can use it and get rid of private work item. As a bonus, we are no longer
forgetting to cancel it when we unbind the driver.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
This is the blocking set_brightness callback after applying the patch :
(it's not immediately obvious when looking at only the patch)

struct apanel {
...
        u16    led_bits;
...
};

static int mail_led_set(struct led_classdev *led,
             enum led_brightness value)
{
    struct apanel *ap = container_of(led, struct apanel, mail_led);

    if (value != LED_OFF)
        ap->led_bits |= 0x8000;
    else
        ap->led_bits &= ~0x8000;

    return i2c_smbus_write_word_data(ap->client, 0x10, ap->led_bits);
}

ap->led_bits was previously used as a 'mailslot' between the
set_brightness callback and the deferred work, right?

After the patch, it's used only in this function. Maybe it could be
replaced by a local variable? As a bonus, that would make
the driver's private struct slightly smaller.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help