media: atomisp: gmin_platform: Make DMI quirks take precedence over the _DSM table
On some devices the _DSM sensor-info table contains wrong info, move the DMI quirk handling up to above the _DSM table check to allow DMI quirks to override wrong info in the _DSM table. Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
This commit is contained in:
Родитель
2f2fce05a7
Коммит
bd8856c65d
|
@ -1353,37 +1353,22 @@ static int gmin_get_config_var(struct device *maindev,
|
|||
const char *var,
|
||||
char *out, size_t *out_len)
|
||||
{
|
||||
struct acpi_device *adev = ACPI_COMPANION(maindev);
|
||||
efi_char16_t var16[CFG_VAR_NAME_MAX];
|
||||
const struct dmi_system_id *id;
|
||||
struct device *dev = maindev;
|
||||
char var8[CFG_VAR_NAME_MAX];
|
||||
efi_status_t status;
|
||||
int i, ret;
|
||||
|
||||
/* For sensors, try first to use the _DSM table */
|
||||
if (!is_gmin) {
|
||||
ret = gmin_get_config_dsm_var(maindev, var, out, out_len);
|
||||
if (!ret)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Fall-back to other approaches */
|
||||
|
||||
if (!is_gmin && ACPI_COMPANION(dev))
|
||||
dev = &ACPI_COMPANION(dev)->dev;
|
||||
|
||||
if (!is_gmin)
|
||||
ret = snprintf(var8, sizeof(var8), "%s_%s", dev_name(dev), var);
|
||||
if (!is_gmin && adev)
|
||||
ret = snprintf(var8, sizeof(var8), "%s_%s", acpi_dev_name(adev), var);
|
||||
else
|
||||
ret = snprintf(var8, sizeof(var8), "gmin_%s", var);
|
||||
|
||||
if (ret < 0 || ret >= sizeof(var8) - 1)
|
||||
return -EINVAL;
|
||||
|
||||
/* First check a hard-coded list of board-specific variables.
|
||||
* Some device firmwares lack the ability to set EFI variables at
|
||||
* runtime.
|
||||
*/
|
||||
/* DMI based quirks override both the _DSM table and EFI variables */
|
||||
id = dmi_first_match(gmin_vars);
|
||||
if (id) {
|
||||
ret = gmin_get_hardcoded_var(maindev, id->driver_data, var8,
|
||||
|
@ -1392,6 +1377,13 @@ static int gmin_get_config_var(struct device *maindev,
|
|||
return 0;
|
||||
}
|
||||
|
||||
/* For sensors, try first to use the _DSM table */
|
||||
if (!is_gmin) {
|
||||
ret = gmin_get_config_dsm_var(maindev, var, out, out_len);
|
||||
if (!ret)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Our variable names are ASCII by construction, but EFI names
|
||||
* are wide chars. Convert and zero-pad.
|
||||
*/
|
||||
|
|
Загрузка…
Ссылка в новой задаче