Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

platform/x86: system76-acpi: Fix brightness_set schedule while atomic

system76_set() was set as an LED ->brightness_set() callback, but it calls
acpi_evaluate_object() which is not atomic-safe. Switch to the
->brightness_set_blocking() LED callback instead.

Signed-off-by: Nick Shipp <git@segbrk.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

authored by

Nick Shipp and committed by
Andy Shevchenko
5b36398d eca6f176

+6 -6
+6 -6
drivers/platform/x86/system76_acpi.c
··· 103 103 } 104 104 105 105 // Set the airplane mode LED brightness 106 - static void ap_led_set(struct led_classdev *led, enum led_brightness value) 106 + static int ap_led_set(struct led_classdev *led, enum led_brightness value) 107 107 { 108 108 struct system76_data *data; 109 109 110 110 data = container_of(led, struct system76_data, ap_led); 111 - system76_set(data, "SAPL", value == LED_OFF ? 0 : 1); 111 + return system76_set(data, "SAPL", value == LED_OFF ? 0 : 1); 112 112 } 113 113 114 114 // Get the last set keyboard LED brightness ··· 121 121 } 122 122 123 123 // Set the keyboard LED brightness 124 - static void kb_led_set(struct led_classdev *led, enum led_brightness value) 124 + static int kb_led_set(struct led_classdev *led, enum led_brightness value) 125 125 { 126 126 struct system76_data *data; 127 127 128 128 data = container_of(led, struct system76_data, kb_led); 129 129 data->kb_brightness = value; 130 - system76_set(data, "SKBL", (int)data->kb_brightness); 130 + return system76_set(data, "SKBL", (int)data->kb_brightness); 131 131 } 132 132 133 133 // Get the last set keyboard LED color ··· 313 313 data->ap_led.name = "system76_acpi::airplane"; 314 314 data->ap_led.flags = LED_CORE_SUSPENDRESUME; 315 315 data->ap_led.brightness_get = ap_led_get; 316 - data->ap_led.brightness_set = ap_led_set; 316 + data->ap_led.brightness_set_blocking = ap_led_set; 317 317 data->ap_led.max_brightness = 1; 318 318 data->ap_led.default_trigger = "rfkill-none"; 319 319 err = devm_led_classdev_register(&acpi_dev->dev, &data->ap_led); ··· 323 323 data->kb_led.name = "system76_acpi::kbd_backlight"; 324 324 data->kb_led.flags = LED_BRIGHT_HW_CHANGED | LED_CORE_SUSPENDRESUME; 325 325 data->kb_led.brightness_get = kb_led_get; 326 - data->kb_led.brightness_set = kb_led_set; 326 + data->kb_led.brightness_set_blocking = kb_led_set; 327 327 if (acpi_has_method(acpi_device_handle(data->acpi_dev), "SKBC")) { 328 328 data->kb_led.max_brightness = 255; 329 329 data->kb_toggle_brightness = 72;