@@ -43,6 +43,8 @@ struct rcar_thermal_priv {
u32 comp;
};
+#define rcar_zone_to_priv(zone) (zone->devdata)
+
/*
* basic functions
*/
@@ -96,7 +98,7 @@ static void rcar_thermal_bset(struct rcar_thermal_priv *priv, u32 reg,
static int rcar_thermal_get_temp(struct thermal_zone_device *zone,
unsigned long *temp)
{
- struct rcar_thermal_priv *priv = zone->devdata;
+ struct rcar_thermal_priv *priv = rcar_zone_to_priv(zone);
int val, min, max, tmp;
tmp = -200; /* default */
@@ -235,7 +237,7 @@ error_free_priv:
static int rcar_thermal_remove(struct platform_device *pdev)
{
struct thermal_zone_device *zone = platform_get_drvdata(pdev);
- struct rcar_thermal_priv *priv = zone->devdata;
+ struct rcar_thermal_priv *priv = rcar_zone_to_priv(zone);
thermal_zone_device_unregister(zone);
platform_set_drvdata(pdev, NULL);
This patch adds rcar_zone_to_priv() which is a helper macro for gettign private data. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> --- drivers/thermal/rcar_thermal.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)