Skip to content

Commit 6ebc25d

Browse files
spandruvadarafaeljw
authored andcommitted
thermal: int340x: processor_thermal: Set feature mask before proc_thermal_add
The function proc_thermal_add() adds sysfs entries for power limits. The feature mask of available features is not present at that time, so it cannot be used by proc_thermal_add() to selectively create sysfs attributes. The feature mask is set by proc_thermal_mmio_add(), so modify the code to call it before proc_thermal_add() so as to allow the latter to use the feature mask. There is no functional impact with this change. Signed-off-by: Srinivas Pandruvada <[email protected]> [ rjw: Changelog edits ] Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent 088f16f commit 6ebc25d

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

drivers/thermal/intel/int340x_thermal/processor_thermal_device_pci.c

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -266,19 +266,19 @@ static int proc_thermal_pci_probe(struct pci_dev *pdev, const struct pci_device_
266266

267267
INIT_DELAYED_WORK(&pci_info->work, proc_thermal_threshold_work_fn);
268268

269-
ret = proc_thermal_add(&pdev->dev, proc_priv);
270-
if (ret) {
271-
dev_err(&pdev->dev, "error: proc_thermal_add, will continue\n");
272-
pci_info->no_legacy = 1;
273-
}
274-
275269
proc_priv->priv_data = pci_info;
276270
pci_info->proc_priv = proc_priv;
277271
pci_set_drvdata(pdev, proc_priv);
278272

279273
ret = proc_thermal_mmio_add(pdev, proc_priv, id->driver_data);
280274
if (ret)
281-
goto err_ret_thermal;
275+
return ret;
276+
277+
ret = proc_thermal_add(&pdev->dev, proc_priv);
278+
if (ret) {
279+
dev_err(&pdev->dev, "error: proc_thermal_add, will continue\n");
280+
pci_info->no_legacy = 1;
281+
}
282282

283283
psv_trip.temperature = get_trip_temp(pci_info);
284284

@@ -288,7 +288,7 @@ static int proc_thermal_pci_probe(struct pci_dev *pdev, const struct pci_device_
288288
&tzone_params, 0, 0);
289289
if (IS_ERR(pci_info->tzone)) {
290290
ret = PTR_ERR(pci_info->tzone);
291-
goto err_ret_mmio;
291+
goto err_del_legacy;
292292
}
293293

294294
if (use_msi && (pdev->msi_enabled || pdev->msix_enabled)) {
@@ -325,11 +325,10 @@ static int proc_thermal_pci_probe(struct pci_dev *pdev, const struct pci_device_
325325
pci_free_irq_vectors(pdev);
326326
err_ret_tzone:
327327
thermal_zone_device_unregister(pci_info->tzone);
328-
err_ret_mmio:
329-
proc_thermal_mmio_remove(pdev, proc_priv);
330-
err_ret_thermal:
328+
err_del_legacy:
331329
if (!pci_info->no_legacy)
332330
proc_thermal_remove(proc_priv);
331+
proc_thermal_mmio_remove(pdev, proc_priv);
333332
pci_disable_device(pdev);
334333

335334
return ret;

0 commit comments

Comments
 (0)