[1/2] thermal: rcar: add rcar_zone_to_priv() macro
diff mbox

Message ID 87r4nmuo66.wl%kuninori.morimoto.gx@renesas.com
State Superseded, archived
Delegated to: Zhang Rui
Headers show

Commit Message

Kuninori Morimoto Nov. 22, 2012, 6:50 a.m. UTC
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(-)

Patch
diff mbox

diff --git a/drivers/thermal/rcar_thermal.c b/drivers/thermal/rcar_thermal.c
index f7a1b57..454035c 100644
--- a/drivers/thermal/rcar_thermal.c
+++ b/drivers/thermal/rcar_thermal.c
@@ -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);