Skip to content

Commit bd8856c

Browse files
jwrdegoedemchehab
authored andcommitted
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>
1 parent 2f2fce0 commit bd8856c

1 file changed

Lines changed: 11 additions & 19 deletions

File tree

drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1353,37 +1353,22 @@ static int gmin_get_config_var(struct device *maindev,
13531353
const char *var,
13541354
char *out, size_t *out_len)
13551355
{
1356+
struct acpi_device *adev = ACPI_COMPANION(maindev);
13561357
efi_char16_t var16[CFG_VAR_NAME_MAX];
13571358
const struct dmi_system_id *id;
1358-
struct device *dev = maindev;
13591359
char var8[CFG_VAR_NAME_MAX];
13601360
efi_status_t status;
13611361
int i, ret;
13621362

1363-
/* For sensors, try first to use the _DSM table */
1364-
if (!is_gmin) {
1365-
ret = gmin_get_config_dsm_var(maindev, var, out, out_len);
1366-
if (!ret)
1367-
return 0;
1368-
}
1369-
1370-
/* Fall-back to other approaches */
1371-
1372-
if (!is_gmin && ACPI_COMPANION(dev))
1373-
dev = &ACPI_COMPANION(dev)->dev;
1374-
1375-
if (!is_gmin)
1376-
ret = snprintf(var8, sizeof(var8), "%s_%s", dev_name(dev), var);
1363+
if (!is_gmin && adev)
1364+
ret = snprintf(var8, sizeof(var8), "%s_%s", acpi_dev_name(adev), var);
13771365
else
13781366
ret = snprintf(var8, sizeof(var8), "gmin_%s", var);
13791367

13801368
if (ret < 0 || ret >= sizeof(var8) - 1)
13811369
return -EINVAL;
13821370

1383-
/* First check a hard-coded list of board-specific variables.
1384-
* Some device firmwares lack the ability to set EFI variables at
1385-
* runtime.
1386-
*/
1371+
/* DMI based quirks override both the _DSM table and EFI variables */
13871372
id = dmi_first_match(gmin_vars);
13881373
if (id) {
13891374
ret = gmin_get_hardcoded_var(maindev, id->driver_data, var8,
@@ -1392,6 +1377,13 @@ static int gmin_get_config_var(struct device *maindev,
13921377
return 0;
13931378
}
13941379

1380+
/* For sensors, try first to use the _DSM table */
1381+
if (!is_gmin) {
1382+
ret = gmin_get_config_dsm_var(maindev, var, out, out_len);
1383+
if (!ret)
1384+
return 0;
1385+
}
1386+
13951387
/* Our variable names are ASCII by construction, but EFI names
13961388
* are wide chars. Convert and zero-pad.
13971389
*/

0 commit comments

Comments
 (0)