Hi Janusz,
struct led_classdev *led = n->led; struct fb_event *fb_event = data; int *blank = fb_event->data; int new_status = *blank ? BLANK : UNBLANK; switch (event) { case FB_EVENT_BLANK : if (new_status == n->old_status) break; if ((n->old_status == UNBLANK) ^ n->invert) { n->brightness = led->brightness; led_set_brightness(led, LED_OFF); } else { led_set_brightness(led, n->brightness); } n->old_status = new_status; break; } return 0;
This is a general question rather than a comment on the patch. My gcc for x86 with -O3 produces code that sets up led, blank, and new_status before testing if event == FB_EVENT_BLANK. Clearly, none of that work is needed if the condition is false.
Is it assumed in kernel coding that the compiler is clever enough not to do this, or that the extra work doesn't matter?
Cheers, Ralph.