diff options
author | Hans de Goede <hdegoede@redhat.com> | 2023-03-10 15:34:45 +0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@kernel.org> | 2023-04-15 12:42:41 +0300 |
commit | bd8856c65dbcb2a31054faece053d28378f185c1 (patch) | |
tree | 4b613dce91730c8bba3c8130ebfe1fbb0aee977b /drivers/staging | |
parent | 2f2fce05a75dd27d47afcf50eed52217cc99c556 (diff) | |
download | linux-bd8856c65dbcb2a31054faece053d28378f185c1.tar.xz |
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>
Diffstat (limited to 'drivers/staging')
-rw-r--r-- | drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c | 30 |
1 files changed, 11 insertions, 19 deletions
diff --git a/drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c b/drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c index fdd71b60c074..5dcfc1220017 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c +++ b/drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c @@ -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. */ |