The device match data needs to be accessible outside the probe function, store it in the private data structure. Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@xxxxxxxxxxxx> Reviewed-by: Geert Uytterhoeven <geert+renesas@xxxxxxxxx> Reviewed-by: Wolfram Sang <wsa+renesas@xxxxxxxxxxxxxxxxxxxx> --- drivers/thermal/rcar_gen3_thermal.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/thermal/rcar_gen3_thermal.c b/drivers/thermal/rcar_gen3_thermal.c index dc019b7873273cf2..438fb9988eabb91b 100644 --- a/drivers/thermal/rcar_gen3_thermal.c +++ b/drivers/thermal/rcar_gen3_thermal.c @@ -85,6 +85,7 @@ struct rcar_gen3_thermal_tsc { }; struct rcar_gen3_thermal_priv { + const struct rcar_gen3_thermal_data *data; spinlock_t lock; /* Protect interrupts on and off */ unsigned int num_tscs; struct rcar_gen3_thermal_tsc *tscs[TSC_MAX_NUM]; @@ -353,8 +354,6 @@ static int rcar_gen3_thermal_probe(struct platform_device *pdev) struct thermal_zone_device *zone; int ret, irq, i; char *irqname; - const struct rcar_gen3_thermal_data *match_data = - of_device_get_match_data(dev); /* default values if FUSEs are missing */ /* TODO: Read values from hardware on supported platforms */ @@ -369,6 +368,8 @@ static int rcar_gen3_thermal_probe(struct platform_device *pdev) if (!priv) return -ENOMEM; + priv->data = of_device_get_match_data(dev); + spin_lock_init(&priv->lock); platform_set_drvdata(pdev, priv); @@ -414,7 +415,7 @@ static int rcar_gen3_thermal_probe(struct platform_device *pdev) priv->tscs[i] = tsc; - match_data->thermal_init(tsc); + priv->data->thermal_init(tsc); rcar_gen3_thermal_calc_coefs(&tsc->coef, ptat, thcode[i]); zone = devm_thermal_zone_of_sensor_register(dev, i, tsc, -- 2.12.0