| From horms@vergenet.net Tue Sep 5 10:07:56 2017 |
| From: Simon Horman <horms@verge.net.au> |
| Date: Tue, 5 Sep 2017 10:06:41 +0200 |
| Subject: [PATCH 06/13] thermal: rcar_gen3_thermal: record and check number of TSCs found |
| 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-7-git-send-email-horms@verge.net.au> |
| |
| |
| From: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se> |
| |
| Record how many TSCs are found in struct rcar_gen3_thermal_priv, this is |
| needed to be able to add hardware interrupts for trip points later. Also |
| add a check to make sure at least one TSC is found. |
| |
| 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 97dad1f1d2b3f2a2a77551849357b7ac38b0b6ff) |
| Signed-off-by: Simon Horman <horms+renesas@verge.net.au> |
| --- |
| drivers/thermal/rcar_gen3_thermal.c | 8 ++++++++ |
| 1 file changed, 8 insertions(+) |
| |
| --- a/drivers/thermal/rcar_gen3_thermal.c |
| +++ b/drivers/thermal/rcar_gen3_thermal.c |
| @@ -75,6 +75,7 @@ struct rcar_gen3_thermal_tsc { |
| |
| struct rcar_gen3_thermal_priv { |
| struct rcar_gen3_thermal_tsc *tscs[TSC_MAX_NUM]; |
| + unsigned int num_tscs; |
| }; |
| |
| struct rcar_gen3_thermal_data { |
| @@ -307,6 +308,13 @@ static int rcar_gen3_thermal_probe(struc |
| tsc->zone = zone; |
| } |
| |
| + priv->num_tscs = i; |
| + |
| + if (!priv->num_tscs) { |
| + ret = -ENODEV; |
| + goto error_unregister; |
| + } |
| + |
| return 0; |
| |
| error_unregister: |