All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/5] thermal: tegra-bpmp: Handle errors in BPMP response
@ 2021-09-15  8:55 Mikko Perttunen
  2021-09-15  8:55 ` [PATCH 2/5] reset: " Mikko Perttunen
                   ` (5 more replies)
  0 siblings, 6 replies; 21+ messages in thread
From: Mikko Perttunen @ 2021-09-15  8:55 UTC (permalink / raw)
  To: rafael, viresh.kumar, thierry.reding, jonathanh,
	krzysztof.kozlowski, lorenzo.pieralisi, robh, kw, p.zabel,
	rui.zhang, daniel.lezcano, amitk
  Cc: linux-pm, linux-tegra, linux-kernel, linux-pci, Mikko Perttunen

The return value from tegra_bpmp_transfer indicates the success or
failure of the IPC transaction with BPMP. If the transaction
succeeded, we also need to check the actual command's result code.
Add code to do this.

Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
---
 drivers/thermal/tegra/tegra-bpmp-thermal.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/drivers/thermal/tegra/tegra-bpmp-thermal.c b/drivers/thermal/tegra/tegra-bpmp-thermal.c
index 94f1da1dcd69..5affc3d196be 100644
--- a/drivers/thermal/tegra/tegra-bpmp-thermal.c
+++ b/drivers/thermal/tegra/tegra-bpmp-thermal.c
@@ -52,6 +52,8 @@ static int tegra_bpmp_thermal_get_temp(void *data, int *out_temp)
 	err = tegra_bpmp_transfer(zone->tegra->bpmp, &msg);
 	if (err)
 		return err;
+	if (msg.rx.ret)
+		return -EINVAL;
 
 	*out_temp = reply.get_temp.temp;
 
@@ -63,6 +65,7 @@ static int tegra_bpmp_thermal_set_trips(void *data, int low, int high)
 	struct tegra_bpmp_thermal_zone *zone = data;
 	struct mrq_thermal_host_to_bpmp_request req;
 	struct tegra_bpmp_message msg;
+	int err;
 
 	memset(&req, 0, sizeof(req));
 	req.type = CMD_THERMAL_SET_TRIP;
@@ -76,7 +79,13 @@ static int tegra_bpmp_thermal_set_trips(void *data, int low, int high)
 	msg.tx.data = &req;
 	msg.tx.size = sizeof(req);
 
-	return tegra_bpmp_transfer(zone->tegra->bpmp, &msg);
+	err = tegra_bpmp_transfer(zone->tegra->bpmp, &msg);
+	if (err)
+		return err;
+	if (msg.rx.ret)
+		return -EINVAL;
+
+	return 0;
 }
 
 static void tz_device_update_work_fn(struct work_struct *work)
@@ -140,6 +149,8 @@ static int tegra_bpmp_thermal_get_num_zones(struct tegra_bpmp *bpmp,
 	err = tegra_bpmp_transfer(bpmp, &msg);
 	if (err)
 		return err;
+	if (msg.rx.ret)
+		return -EINVAL;
 
 	*num_zones = reply.get_num_zones.num;
 
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2022-03-08 20:33 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-15  8:55 [PATCH 1/5] thermal: tegra-bpmp: Handle errors in BPMP response Mikko Perttunen
2021-09-15  8:55 ` [PATCH 2/5] reset: " Mikko Perttunen
2021-10-05  9:55   ` Philipp Zabel
2021-10-28 11:54   ` Jon Hunter
2021-11-02 13:10     ` Philipp Zabel
2021-11-12 11:30       ` Jon Hunter
2021-09-15  8:55 ` [PATCH 3/5] memory: tegra186-emc: " Mikko Perttunen
2021-09-20  8:34   ` (subset) " Krzysztof Kozlowski
2021-09-15  8:55 ` [PATCH 4/5] cpufreq: tegra186/tegra194: " Mikko Perttunen
2021-10-04  6:37   ` Viresh Kumar
2021-10-04  6:51     ` Mikko Perttunen
2021-10-04  7:01   ` Viresh Kumar
2021-10-04  7:02     ` Mikko Perttunen
2021-09-15  8:55 ` [PATCH 5/5] PCI: tegra194: " Mikko Perttunen
2021-10-07 18:21   ` Thierry Reding
2021-10-13 12:59     ` Lorenzo Pieralisi
2021-11-29 12:19       ` Lorenzo Pieralisi
2022-02-03 12:22         ` Lorenzo Pieralisi
2021-10-07 18:20 ` [PATCH 1/5] thermal: tegra-bpmp: " Thierry Reding
2022-02-25 12:22   ` Daniel Lezcano
2022-03-08 20:33 ` [thermal: thermal/next] " thermal-bot for Mikko Perttunen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.