Skip to content

Commit 8d485da

Browse files
mjg59dlezcano
authored andcommitted
thermal/int340x_thermal: Don't require IDSP to exist
The IDSP method doesn't appear to exist on the most recent Intel platforms: instead, the IDSP data is included in the GDDV blob. Since we probably don't want to decompress and parse that in-kernel, just allow any UUID to be written if IDSP is missing. Signed-off-by: Matthew Garrett <[email protected]> Tested-by: Pandruvada, Srinivas <[email protected]> [ rzhang: fix checkpatch warning in changelog ] Signed-off-by: Zhang Rui <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 006f006 commit 8d485da

File tree

1 file changed

+22
-8
lines changed

1 file changed

+22
-8
lines changed

drivers/thermal/intel/int340x_thermal/int3400_thermal.c

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,9 @@ static ssize_t available_uuids_show(struct device *dev,
9696
int i;
9797
int length = 0;
9898

99+
if (!priv->uuid_bitmap)
100+
return sprintf(buf, "UNKNOWN\n");
101+
99102
for (i = 0; i < INT3400_THERMAL_MAXIMUM_UUID; i++) {
100103
if (priv->uuid_bitmap & (1 << i))
101104
if (PAGE_SIZE - length > 0)
@@ -113,11 +116,11 @@ static ssize_t current_uuid_show(struct device *dev,
113116
{
114117
struct int3400_thermal_priv *priv = dev_get_drvdata(dev);
115118

116-
if (priv->uuid_bitmap & (1 << priv->current_uuid_index))
117-
return sprintf(buf, "%s\n",
118-
int3400_thermal_uuids[priv->current_uuid_index]);
119-
else
119+
if (priv->current_uuid_index == -1)
120120
return sprintf(buf, "INVALID\n");
121+
122+
return sprintf(buf, "%s\n",
123+
int3400_thermal_uuids[priv->current_uuid_index]);
121124
}
122125

123126
static ssize_t current_uuid_store(struct device *dev,
@@ -128,9 +131,16 @@ static ssize_t current_uuid_store(struct device *dev,
128131
int i;
129132

130133
for (i = 0; i < INT3400_THERMAL_MAXIMUM_UUID; ++i) {
131-
if ((priv->uuid_bitmap & (1 << i)) &&
132-
!(strncmp(buf, int3400_thermal_uuids[i],
133-
sizeof(int3400_thermal_uuids[i]) - 1))) {
134+
if (!strncmp(buf, int3400_thermal_uuids[i],
135+
sizeof(int3400_thermal_uuids[i]) - 1)) {
136+
/*
137+
* If we have a list of supported UUIDs, make sure
138+
* this one is supported.
139+
*/
140+
if (priv->uuid_bitmap &&
141+
!(priv->uuid_bitmap & (1 << i)))
142+
return -EINVAL;
143+
134144
priv->current_uuid_index = i;
135145
return count;
136146
}
@@ -464,9 +474,13 @@ static int int3400_thermal_probe(struct platform_device *pdev)
464474
priv->adev = adev;
465475

466476
result = int3400_thermal_get_uuids(priv);
467-
if (result)
477+
478+
/* Missing IDSP isn't fatal */
479+
if (result && result != -ENODEV)
468480
goto free_priv;
469481

482+
priv->current_uuid_index = -1;
483+
470484
result = acpi_parse_art(priv->adev->handle, &priv->art_count,
471485
&priv->arts, true);
472486
if (result)

0 commit comments

Comments
 (0)