| From horms@vergenet.net Tue Sep 5 10:07:52 2017 |
| From: Simon Horman <horms@verge.net.au> |
| Date: Tue, 5 Sep 2017 10:06:43 +0200 |
| Subject: [PATCH 08/13] thermal: rcar_gen3_thermal: store device match data in private structure |
| To: Greg KH <gregkh@linuxfoundation.org> |
| Cc: ltsi-dev@lists.linuxfoundation.org, linux-renesas-soc@vger.kernel.org, Magnus Damm <magnus.damm@gmail.com> |
| Message-ID: <1504598808-19810-9-git-send-email-horms@verge.net.au> |
| |
| |
| From: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se> |
| |
| 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@ragnatech.se> |
| Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be> |
| Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com> |
| Signed-off-by: Eduardo Valentin <edubezval@gmail.com> |
| (cherry picked from commit cc4d072b66298716484f5c78d782c64509f4b6d9) |
| Signed-off-by: Simon Horman <horms+renesas@verge.net.au> |
| --- |
| drivers/thermal/rcar_gen3_thermal.c | 7 ++++--- |
| 1 file changed, 4 insertions(+), 3 deletions(-) |
| |
| --- a/drivers/thermal/rcar_gen3_thermal.c |
| +++ b/drivers/thermal/rcar_gen3_thermal.c |
| @@ -88,6 +88,7 @@ struct rcar_gen3_thermal_priv { |
| struct rcar_gen3_thermal_tsc *tscs[TSC_MAX_NUM]; |
| unsigned int num_tscs; |
| spinlock_t lock; /* Protect interrupts on and off */ |
| + const struct rcar_gen3_thermal_data *data; |
| }; |
| |
| struct rcar_gen3_thermal_data { |
| @@ -351,8 +352,6 @@ static int rcar_gen3_thermal_probe(struc |
| 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 */ |
| @@ -367,6 +366,8 @@ static int rcar_gen3_thermal_probe(struc |
| if (!priv) |
| return -ENOMEM; |
| |
| + priv->data = of_device_get_match_data(dev); |
| + |
| spin_lock_init(&priv->lock); |
| |
| platform_set_drvdata(pdev, priv); |
| @@ -417,7 +418,7 @@ static int rcar_gen3_thermal_probe(struc |
| |
| 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, |