Re: [PATCH V2 6/7] platform/x86: lg-laptop.c: Expose reader mode as a LED, rather than a sysfs file for 2018 and newer models

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Nov 30, 2019 at 10:53 AM Matan Ziv-Av <matan@xxxxxxxxxxx> wrote:
>
> On 2018 and newer models, setting reader mode does not change display
> Gamma, so treat reader mode as a LED, instead of a switch.

>  static struct attribute *dev_attributes[] = {
>         &dev_attr_fan_mode.attr,
>         &dev_attr_usb_charge.attr,
> -       &dev_attr_reader_mode.attr,
>         &dev_attr_fn_lock.attr,
>         &dev_attr_battery_care_limit.attr,
> +       &dev_attr_reader_mode.attr, // This is last, to be easily removed
>         NULL
>  };

Can't you simple add it at run-time?

> +       if (year >= 2018)
> +               dev_attributes[4] = NULL; // Remove reader mode special file.
> +

I don't like this code. It's fragile against changes and makes
maintenance harder.
See acpi_tad_probe() for example how it's done.

-- 
With Best Regards,
Andy Shevchenko



[Index of Archives]     [Linux Kernel Development]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux