Dear Corentin,

2012/3/19 Corentin Chary <[email protected]>:
> On Mon, Mar 19, 2012 at 7:33 AM, AceLan Kao <[email protected]> wrote:
>> Some models work better with different values of wapf, so move the
>> variable into quriks_entry to make it more easy to give a specific
>> value to different models.
>>
>> Signed-off-by: AceLan Kao <[email protected]>
>> ---
>>  drivers/platform/x86/asus-nb-wmi.c |    2 +-
>>  drivers/platform/x86/asus-wmi.c    |    4 ++--
>>  drivers/platform/x86/asus-wmi.h    |    2 +-
>>  drivers/platform/x86/eeepc-wmi.c   |    2 +-
>>  4 files changed, 5 insertions(+), 5 deletions(-)
>>
>> diff --git a/drivers/platform/x86/asus-nb-wmi.c 
>> b/drivers/platform/x86/asus-nb-wmi.c
>> index 396dafc..9dd7b93 100644
>> --- a/drivers/platform/x86/asus-nb-wmi.c
>> +++ b/drivers/platform/x86/asus-nb-wmi.c
>> @@ -53,7 +53,7 @@ MODULE_PARM_DESC(wapf, "WAPF value");
>>
>>  static void asus_nb_wmi_quirks(struct asus_wmi_driver *driver)
>>  {
>
> Missing "driver->quirks = asus_unknown_quriks" (or similar). quirks is
> NULL here, and the module will segfault (unfortunatly I tried without
> reading the code and it did :p).

So sorry about that, I'm not aware of the loading sequence of the
asus-nb-wmi module,
I thought it can see drivers->quirks which assigned from eeepc-wmi module.
If I allocate a new asus_unknown_quirks here, then it might be
overwriten by eeepc-wmi later,
if both of the modules will be loaded.
Moreover, asus-nb-wmi should have the ability to access the
asus_quirks defined in eeepc-wmi,
so, the better way to do this is the detect_quirks function pointer
should point to the same function
in the eeepc-wmi.
Do you have any good idea of this?

>
>> -       driver->wapf = wapf;
>> +       driver->quirks->wapf = wapf;
>>  }
>>
>>  static const struct key_entry asus_nb_wmi_keymap[] = {
>> diff --git a/drivers/platform/x86/asus-wmi.c 
>> b/drivers/platform/x86/asus-wmi.c
>> index 9cd459a..1d2047d 100644
>> --- a/drivers/platform/x86/asus-wmi.c
>> +++ b/drivers/platform/x86/asus-wmi.c
>> @@ -1471,9 +1471,9 @@ static int asus_wmi_platform_init(struct asus_wmi 
>> *asus)
>>
>>        /* CWAP allow to define the behavior of the Fn+F2 key,
>>         * this method doesn't seems to be present on Eee PCs */
>> -       if (asus->driver->wapf >= 0)
>> +       if (asus->driver->quirks->wapf >= 0)
>>                asus_wmi_set_devstate(ASUS_WMI_DEVID_CWAP,
>> -                                     asus->driver->wapf, NULL);
>> +                                     asus->driver->quirks->wapf, NULL);
>>
>>        return asus_wmi_sysfs_init(asus->platform_device);
>>  }
>> diff --git a/drivers/platform/x86/asus-wmi.h 
>> b/drivers/platform/x86/asus-wmi.h
>> index 35003e4..d43b667 100644
>> --- a/drivers/platform/x86/asus-wmi.h
>> +++ b/drivers/platform/x86/asus-wmi.h
>> @@ -39,10 +39,10 @@ struct quirk_entry {
>>        bool hotplug_wireless;
>>        bool scalar_panel_brightness;
>>        bool store_backlight_power;
>> +       int wapf;
>>  };
>>
>>  struct asus_wmi_driver {
>> -       int                     wapf;
>>        int                     brightness;
>>        int                     panel_power;
>>
>> diff --git a/drivers/platform/x86/eeepc-wmi.c 
>> b/drivers/platform/x86/eeepc-wmi.c
>> index c1a0ac0..7e15d54 100644
>> --- a/drivers/platform/x86/eeepc-wmi.c
>> +++ b/drivers/platform/x86/eeepc-wmi.c
>> @@ -207,10 +207,10 @@ static int eeepc_wmi_probe(struct platform_device 
>> *pdev)
>>  static void eeepc_wmi_quirks(struct asus_wmi_driver *driver)
>>  {
>>        quirks = driver->quirks;
>> -       driver->wapf = -1;
>>        driver->panel_power = FB_BLANK_UNBLANK;
>>        driver->quirks = &quirk_asus_unknown;
>>        driver->quirks->hotplug_wireless = hotplug_wireless;
>> +       driver->quirks->wapf = -1;
>>        dmi_check_system(asus_quirks);
>>  }
>>
>> --
>> 1.7.9.1
>>
>
>
>
> --
> Corentin Chary
> http://xf.iksaif.net
> --
> To unsubscribe from this list: send the line "unsubscribe 
> platform-driver-x86" in
> the body of a message to [email protected]
> More majordomo info at  http://vger.kernel.org/majordomo-info.html



-- 
Chia-Lin Kao(AceLan)
http://blog.acelan.idv.tw/
E-Mail: acelan.kaoATcanonical.com (s/AT/@/)
--
To unsubscribe from this list: send the line "unsubscribe platform-driver-x86" 
in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to