Commit cc4d072b authored by Niklas Söderlund's avatar Niklas Söderlund Committed by Eduardo Valentin

thermal: rcar_gen3_thermal: store device match data in private structure

The device match data needs to be accessible outside the probe function,
store it in the private data structure.
Signed-off-by: default avatarNiklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Reviewed-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: default avatarWolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: default avatarEduardo Valentin <edubezval@gmail.com>
parent 7d4b2697
...@@ -88,6 +88,7 @@ struct rcar_gen3_thermal_priv { ...@@ -88,6 +88,7 @@ struct rcar_gen3_thermal_priv {
struct rcar_gen3_thermal_tsc *tscs[TSC_MAX_NUM]; struct rcar_gen3_thermal_tsc *tscs[TSC_MAX_NUM];
unsigned int num_tscs; unsigned int num_tscs;
spinlock_t lock; /* Protect interrupts on and off */ spinlock_t lock; /* Protect interrupts on and off */
const struct rcar_gen3_thermal_data *data;
}; };
struct rcar_gen3_thermal_data { struct rcar_gen3_thermal_data {
...@@ -351,8 +352,6 @@ static int rcar_gen3_thermal_probe(struct platform_device *pdev) ...@@ -351,8 +352,6 @@ static int rcar_gen3_thermal_probe(struct platform_device *pdev)
struct thermal_zone_device *zone; struct thermal_zone_device *zone;
int ret, irq, i; int ret, irq, i;
char *irqname; char *irqname;
const struct rcar_gen3_thermal_data *match_data =
of_device_get_match_data(dev);
/* default values if FUSEs are missing */ /* default values if FUSEs are missing */
/* TODO: Read values from hardware on supported platforms */ /* TODO: Read values from hardware on supported platforms */
...@@ -367,6 +366,8 @@ static int rcar_gen3_thermal_probe(struct platform_device *pdev) ...@@ -367,6 +366,8 @@ static int rcar_gen3_thermal_probe(struct platform_device *pdev)
if (!priv) if (!priv)
return -ENOMEM; return -ENOMEM;
priv->data = of_device_get_match_data(dev);
spin_lock_init(&priv->lock); spin_lock_init(&priv->lock);
platform_set_drvdata(pdev, priv); platform_set_drvdata(pdev, priv);
...@@ -417,7 +418,7 @@ static int rcar_gen3_thermal_probe(struct platform_device *pdev) ...@@ -417,7 +418,7 @@ static int rcar_gen3_thermal_probe(struct platform_device *pdev)
priv->tscs[i] = tsc; priv->tscs[i] = tsc;
match_data->thermal_init(tsc); priv->data->thermal_init(tsc);
rcar_gen3_thermal_calc_coefs(&tsc->coef, ptat, thcode[i]); rcar_gen3_thermal_calc_coefs(&tsc->coef, ptat, thcode[i]);
zone = devm_thermal_zone_of_sensor_register(dev, i, tsc, zone = devm_thermal_zone_of_sensor_register(dev, i, tsc,
......
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