Skip to content

Commit

Permalink
platform/x86: system76_acpi: Use dev_get_drvdata
Browse files Browse the repository at this point in the history
Eliminate direct accesses to the driver_data field.

Signed-off-by: Haowen Bai <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Reviewed-by: Hans de Goede <[email protected]>
Signed-off-by: Hans de Goede <[email protected]>
Signed-off-by: Tim Crawford <[email protected]>
  • Loading branch information
Lotte-Bai authored and crawfxrd committed Aug 3, 2022
1 parent 04145b8 commit a88dcce
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions system76_acpi.c
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ static ssize_t kb_led_color_show(
struct led_classdev *led;
struct system76_data *data;

led = (struct led_classdev *)dev->driver_data;
led = dev_get_drvdata(dev);
data = container_of(led, struct system76_data, kb_led);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0)
return sysfs_emit(buf, "%06X\n", data->kb_color);
Expand All @@ -369,7 +369,7 @@ static ssize_t kb_led_color_store(
unsigned int val;
int ret;

led = (struct led_classdev *)dev->driver_data;
led = dev_get_drvdata(dev);
data = container_of(led, struct system76_data, kb_led);
ret = kstrtouint(buf, 16, &val);
if (ret)
Expand Down

0 comments on commit a88dcce

Please sign in to comment.