Re: [PATCH 1/7] acpi: add a way to promote/demote vendor backlight drivers

From: Corentin Chary
Date: Fri Jun 29 2012 - 08:19:02 EST


On Wed, Jun 27, 2012 at 12:19 AM, Mattia Dongili <malattia@xxxxxxxx> wrote:
> Hi Corentin,
>
> On Wed, Jun 13, 2012 at 09:32:01AM +0200, Corentin Chary wrote:
> ...
>> +/* Promote the vendor interface instead of the generic video module.
>> + * This function allow DMI blacklists to be implemented by externals
>> + * platform drivers instead of putting a big blacklist in video_detect.c
>> + * After calling this function you will probably want to call
>> + * acpi_video_unregister() to make sure the video module is not loaded
>> + */
>> +void acpi_video_dmi_promote_vendor(void)
>> +{
>> + Â Â acpi_video_caps_check();
>> + Â Â acpi_video_support |= ACPI_VIDEO_BACKLIGHT_DMI_VENDOR;
>> +}
>> +EXPORT_SYMBOL(acpi_video_dmi_promote_vendor);
>
> I think having the promote_vendor() function do the sanity check on the
> acpi_backlight parameter and the unregistering of the acpi_video device
> may make the code cleaner and more acpi_video-agnostic in the drivers.
> I.e. (untested sample code):
>
> bool acpi_video_promote_vendor(void)
> {
> Â Â Â Âif (acpi_video_backlight_support())
> Â Â Â Â Â Â Â Âreturn false;
>
> Â Â Â Âacpi_video_support |= ACPI_VIDEO_BACKLIGHT_DMI_VENDOR;
> Â Â Â Âpr_info("Disabling ACPI video driver\n");
> Â Â Â Âacpi_video_unregister();
> Â Â Â Âreturn true;
> }
> EXPORT_SYMBOL(acpi_video_promote_vendor);
>
> and in the drivers you do
>
> Â Â Â Âif (my_drv->broken_acpi_video) {
> Â Â Â Â Â Â Â Âif (acpi_video_promote_vendor())
> Â Â Â Â Â Â Â Â Â Â Â Âdo_backlight_init();
> Â Â Â Â} else if (!acpi_video_backlight_support())
> Â Â Â Â Â Â Â Âdo_backlight_init();
>
> or something along these lines.
> If you give a boolean parameter to acpi_video_promote_vendor to force
> vendor backlight we could make the drivers' code even simpler but that
> would change the semantics of the "promotion" to something more of a
> "take-over".
>
> PS: I will need to promote backlight control in sony-laptop.ko
> eventually as well but I don't have a DMI based list but rather I should
> look at a specific handle (or say Method) presence in the SNC Device.
> I guess I'm just bothered by the function naming here but not a big
> deal. :)
> --
> mattia
> :wq!

I had something like that in mind, but it makes acpi.ko use symbols
from video.ko, and video.ko already uses symbols from acpi.ko, and I
didn't want to mess with circular dependencies. But if you manage to
make it work, and if you want to remove dmi_, I'll hapilly Ack it !



--
Corentin Chary
http://xf.iksaif.net
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/