[lkml]   [2019]   [Feb]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH] Input: apanel - switch to using brightness_set_blocking()
Hi Dmitry,

On Sat, Feb 9, 2019 at 12:19 PM Dmitry Torokhov
<> 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 <>

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;
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.

 \ /
  Last update: 2019-02-11 00:22    [W:0.042 / U:30.228 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site