summaryrefslogtreecommitdiff
path: root/drivers/thermal/tegra
diff options
context:
space:
mode:
authorThierry Reding <treding@nvidia.com>2022-09-22 15:41:24 +0200
committerThierry Reding <treding@nvidia.com>2022-10-24 15:18:11 +0200
commit4c1e0a97351a5e88e7e503b40cdbe0f220039a5e (patch)
treebe5165a467aec518ffacc940069c4564d39c9df1 /drivers/thermal/tegra
parent236d3907aa7c03168dbc4d0e8faa77d10bbb969f (diff)
firmware: tegra: bpmp: Use iosys-map helpers
The shared memory used for inter-processor communication between the CPU and the BPMP can reside either in system memory or in I/O memory. Use the iosys-map helpers to abstract these differences away. Signed-off-by: Thierry Reding <treding@nvidia.com>
Diffstat (limited to 'drivers/thermal/tegra')
-rw-r--r--drivers/thermal/tegra/tegra-bpmp-thermal.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/drivers/thermal/tegra/tegra-bpmp-thermal.c b/drivers/thermal/tegra/tegra-bpmp-thermal.c
index eb84f0b9dc7c..0b7a1a1948cb 100644
--- a/drivers/thermal/tegra/tegra-bpmp-thermal.c
+++ b/drivers/thermal/tegra/tegra-bpmp-thermal.c
@@ -106,21 +106,22 @@ static void tz_device_update_work_fn(struct work_struct *work)
static void bpmp_mrq_thermal(unsigned int mrq, struct tegra_bpmp_channel *ch,
void *data)
{
- struct mrq_thermal_bpmp_to_host_request *req;
+ struct mrq_thermal_bpmp_to_host_request req;
struct tegra_bpmp_thermal *tegra = data;
+ size_t offset;
int i;
- req = (struct mrq_thermal_bpmp_to_host_request *)ch->ib->data;
+ offset = offsetof(struct tegra_bpmp_mb_data, data);
+ iosys_map_memcpy_from(&req, &ch->ib, offset, sizeof(req));
- if (req->type != CMD_THERMAL_HOST_TRIP_REACHED) {
- dev_err(tegra->dev, "%s: invalid request type: %d\n",
- __func__, req->type);
+ if (req.type != CMD_THERMAL_HOST_TRIP_REACHED) {
+ dev_err(tegra->dev, "%s: invalid request type: %d\n", __func__, req.type);
tegra_bpmp_mrq_return(ch, -EINVAL, NULL, 0);
return;
}
for (i = 0; i < tegra->num_zones; ++i) {
- if (tegra->zones[i]->idx != req->host_trip_reached.zone)
+ if (tegra->zones[i]->idx != req.host_trip_reached.zone)
continue;
schedule_work(&tegra->zones[i]->tz_device_update_work);
@@ -129,7 +130,7 @@ static void bpmp_mrq_thermal(unsigned int mrq, struct tegra_bpmp_channel *ch,
}
dev_err(tegra->dev, "%s: invalid thermal zone: %d\n", __func__,
- req->host_trip_reached.zone);
+ req.host_trip_reached.zone);
tegra_bpmp_mrq_return(ch, -EINVAL, NULL, 0);
}