Commit 7a61d0207465e41b7dbe3a25f628ddef24572c6f
Committed by
Matthew Garrett
1 parent
c55d995dd3
Exists in
smarc-l5.0.0_1.0.0-ga
and in
5 other branches
eeepc-wmi: split et2012 specific hacks
Signed-off-by: Corentin Chary <corentin.chary@gmail.com> Signed-off-by: Matthew Garrett <mjg@redhat.com>
Showing 1 changed file with 20 additions and 14 deletions Side-by-side Diff
drivers/platform/x86/eeepc-wmi.c
... | ... | @@ -109,26 +109,32 @@ |
109 | 109 | |
110 | 110 | static struct quirk_entry *quirks; |
111 | 111 | |
112 | +static void et2012_quirks(void) | |
113 | +{ | |
114 | + const struct dmi_device *dev = NULL; | |
115 | + char oemstring[30]; | |
116 | + | |
117 | + while ((dev = dmi_find_device(DMI_DEV_TYPE_OEM_STRING, NULL, dev))) { | |
118 | + if (sscanf(dev->name, "AEMS%24c", oemstring) == 1) { | |
119 | + if (oemstring[18] == '1') | |
120 | + quirks = &quirk_asus_et2012_type1; | |
121 | + else if (oemstring[18] == '3') | |
122 | + quirks = &quirk_asus_et2012_type3; | |
123 | + break; | |
124 | + } | |
125 | + } | |
126 | +} | |
127 | + | |
112 | 128 | static int dmi_matched(const struct dmi_system_id *dmi) |
113 | 129 | { |
114 | 130 | char *model; |
131 | + | |
115 | 132 | quirks = dmi->driver_data; |
116 | 133 | |
117 | 134 | model = (char *)dmi->matches[1].substr; |
118 | - if (unlikely(strncmp(model, "ET2012", 6) == 0)) { | |
119 | - const struct dmi_device *dev = NULL; | |
120 | - char oemstring[30]; | |
121 | - while ((dev = dmi_find_device(DMI_DEV_TYPE_OEM_STRING, | |
122 | - NULL, dev))) { | |
123 | - if (sscanf(dev->name, "AEMS%24c", oemstring) == 1) { | |
124 | - if (oemstring[18] == '1') | |
125 | - quirks = &quirk_asus_et2012_type1; | |
126 | - else if (oemstring[18] == '3') | |
127 | - quirks = &quirk_asus_et2012_type3; | |
128 | - break; | |
129 | - } | |
130 | - } | |
131 | - } | |
135 | + if (unlikely(strncmp(model, "ET2012", 6) == 0)) | |
136 | + et2012_quirks(); | |
137 | + | |
132 | 138 | return 1; |
133 | 139 | } |
134 | 140 |