Commit 6ec067e3 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/evalenti/linux-soc-thermal

Pull thermal SoC fixes from Eduardo Valentin:
 "Fixes for armada and broadcom thermal drivers"

* 'fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/evalenti/linux-soc-thermal:
  thermal: broadcom: constify thermal_zone_of_device_ops structure
  thermal: armada: constify thermal_zone_of_device_ops structure
  thermal: bcm2835: Switch to SPDX identifier
  thermal: armada: fix legacy resource fixup
  thermal: armada: fix legacy validity test sense
parents 8214bdf7 1aea7aee
...@@ -357,7 +357,7 @@ static int armada_get_temp_legacy(struct thermal_zone_device *thermal, ...@@ -357,7 +357,7 @@ static int armada_get_temp_legacy(struct thermal_zone_device *thermal,
int ret; int ret;
/* Valid check */ /* Valid check */
if (armada_is_valid(priv)) { if (!armada_is_valid(priv)) {
dev_err(priv->dev, dev_err(priv->dev,
"Temperature sensor reading not valid\n"); "Temperature sensor reading not valid\n");
return -EIO; return -EIO;
...@@ -395,7 +395,7 @@ static int armada_get_temp(void *_sensor, int *temp) ...@@ -395,7 +395,7 @@ static int armada_get_temp(void *_sensor, int *temp)
return ret; return ret;
} }
static struct thermal_zone_of_device_ops of_ops = { static const struct thermal_zone_of_device_ops of_ops = {
.get_temp = armada_get_temp, .get_temp = armada_get_temp,
}; };
...@@ -526,23 +526,21 @@ static int armada_thermal_probe_legacy(struct platform_device *pdev, ...@@ -526,23 +526,21 @@ static int armada_thermal_probe_legacy(struct platform_device *pdev,
/* First memory region points towards the status register */ /* First memory region points towards the status register */
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!res)
return -EIO;
/*
* Edit the resource start address and length to map over all the
* registers, instead of pointing at them one by one.
*/
res->start -= data->syscon_status_off;
res->end = res->start + max(data->syscon_status_off,
max(data->syscon_control0_off,
data->syscon_control1_off)) +
sizeof(unsigned int) - 1;
base = devm_ioremap_resource(&pdev->dev, res); base = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(base)) if (IS_ERR(base))
return PTR_ERR(base); return PTR_ERR(base);
/*
* Fix up from the old individual DT register specification to
* cover all the registers. We do this by adjusting the ioremap()
* result, which should be fine as ioremap() deals with pages.
* However, validate that we do not cross a page boundary while
* making this adjustment.
*/
if (((unsigned long)base & ~PAGE_MASK) < data->syscon_status_off)
return -EINVAL;
base -= data->syscon_status_off;
priv->syscon = devm_regmap_init_mmio(&pdev->dev, base, priv->syscon = devm_regmap_init_mmio(&pdev->dev, base,
&armada_thermal_regmap_config); &armada_thermal_regmap_config);
if (IS_ERR(priv->syscon)) if (IS_ERR(priv->syscon))
......
// SPDX-License-Identifier: GPL-2.0+
/* /*
* Driver for Broadcom BCM2835 SoC temperature sensor * Driver for Broadcom BCM2835 SoC temperature sensor
* *
* Copyright (C) 2016 Martin Sperl * Copyright (C) 2016 Martin Sperl
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/ */
#include <linux/clk.h> #include <linux/clk.h>
......
...@@ -299,7 +299,7 @@ static int brcmstb_set_trips(void *data, int low, int high) ...@@ -299,7 +299,7 @@ static int brcmstb_set_trips(void *data, int low, int high)
return 0; return 0;
} }
static struct thermal_zone_of_device_ops of_ops = { static const struct thermal_zone_of_device_ops of_ops = {
.get_temp = brcmstb_get_temp, .get_temp = brcmstb_get_temp,
.set_trips = brcmstb_set_trips, .set_trips = brcmstb_set_trips,
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment