diff mbox

[1/2] thermal: of: Match function to pass bindparam index

Message ID 1421171482-16101-2-git-send-email-kapileshwar.singh@arm.com (mailing list archive)
State Changes Requested
Delegated to: Eduardo Valentin
Headers show

Commit Message

Kapileshwar Singh Jan. 13, 2015, 5:51 p.m. UTC
From: KP Singh <kapileshwar.singh@arm.com>

The match function should pass the index of the binding parameters
which the cooling device needs to be matched against. There are currently
no implementations of match function within the kernel. A successful
match requires:

	trip_mask == expected_trip_mask;
	weight == expected_weight;
	binding_limits == expected_binding_limits;
	thermal_zone == expected_thermal_zone;

Signed-off-by: Kapileshwar Singh <kapileshwar.singh@arm.com>
---
 drivers/thermal/thermal_core.c |    4 ++--
 include/linux/thermal.h        |    2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

Comments

Eduardo Valentin Jan. 20, 2015, 1:44 p.m. UTC | #1
On Tue, Jan 13, 2015 at 05:51:21PM +0000, Kapileshwar Singh wrote:
> From: KP Singh <kapileshwar.singh@arm.com>

The encoding still seams to be scrambled to me.

> 
> The match function should pass the index of the binding parameters
> which the cooling device needs to be matched against. There are currently
> no implementations of match function within the kernel. A successful
> match requires:
> 
> 	trip_mask == expected_trip_mask;
> 	weight == expected_weight;
> 	binding_limits == expected_binding_limits;
> 	thermal_zone == expected_thermal_zone;

ok. The .match callback is documented under
Documentation/thermal/sysfs-api.txt. Can you please also make sure the
documentation is sane after your change?

> 
> Signed-off-by: Kapileshwar Singh <kapileshwar.singh@arm.com>
> ---
>  drivers/thermal/thermal_core.c |    4 ++--
>  include/linux/thermal.h        |    2 +-
>  2 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c
> index 87e0b0782023..db4d6407c1ec 100644
> --- a/drivers/thermal/thermal_core.c
> +++ b/drivers/thermal/thermal_core.c
> @@ -276,7 +276,7 @@ static void bind_cdev(struct thermal_cooling_device *cdev)
>  		for (i = 0; i < tzp->num_tbps; i++) {
>  			if (tzp->tbp[i].cdev || !tzp->tbp[i].match)
>  				continue;
> -			if (tzp->tbp[i].match(pos, cdev))
> +			if (tzp->tbp[i].match(pos, cdev, i))
>  				continue;
>  			tzp->tbp[i].cdev = cdev;
>  			__bind(pos, tzp->tbp[i].trip_mask, cdev,
> @@ -315,7 +315,7 @@ static void bind_tz(struct thermal_zone_device *tz)
>  		for (i = 0; i < tzp->num_tbps; i++) {
>  			if (tzp->tbp[i].cdev || !tzp->tbp[i].match)
>  				continue;
> -			if (tzp->tbp[i].match(tz, pos))
> +			if (tzp->tbp[i].match(tz, pos, i))
>  				continue;
>  			tzp->tbp[i].cdev = pos;
>  			__bind(tz, tzp->tbp[i].trip_mask, pos,
> diff --git a/include/linux/thermal.h b/include/linux/thermal.h
> index fc52e307efab..dc8cf6dc59e5 100644
> --- a/include/linux/thermal.h
> +++ b/include/linux/thermal.h
> @@ -237,7 +237,7 @@ struct thermal_bind_params {
>  	 */
>  	unsigned long *binding_limits;
>  	int (*match) (struct thermal_zone_device *tz,
> -			struct thermal_cooling_device *cdev);
> +		      struct thermal_cooling_device *cdev, int index);
>  };
>  
>  /* Structure to define Thermal Zone parameters */
> -- 
> 1.7.9.5
> 
>
diff mbox

Patch

diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c
index 87e0b0782023..db4d6407c1ec 100644
--- a/drivers/thermal/thermal_core.c
+++ b/drivers/thermal/thermal_core.c
@@ -276,7 +276,7 @@  static void bind_cdev(struct thermal_cooling_device *cdev)
 		for (i = 0; i < tzp->num_tbps; i++) {
 			if (tzp->tbp[i].cdev || !tzp->tbp[i].match)
 				continue;
-			if (tzp->tbp[i].match(pos, cdev))
+			if (tzp->tbp[i].match(pos, cdev, i))
 				continue;
 			tzp->tbp[i].cdev = cdev;
 			__bind(pos, tzp->tbp[i].trip_mask, cdev,
@@ -315,7 +315,7 @@  static void bind_tz(struct thermal_zone_device *tz)
 		for (i = 0; i < tzp->num_tbps; i++) {
 			if (tzp->tbp[i].cdev || !tzp->tbp[i].match)
 				continue;
-			if (tzp->tbp[i].match(tz, pos))
+			if (tzp->tbp[i].match(tz, pos, i))
 				continue;
 			tzp->tbp[i].cdev = pos;
 			__bind(tz, tzp->tbp[i].trip_mask, pos,
diff --git a/include/linux/thermal.h b/include/linux/thermal.h
index fc52e307efab..dc8cf6dc59e5 100644
--- a/include/linux/thermal.h
+++ b/include/linux/thermal.h
@@ -237,7 +237,7 @@  struct thermal_bind_params {
 	 */
 	unsigned long *binding_limits;
 	int (*match) (struct thermal_zone_device *tz,
-			struct thermal_cooling_device *cdev);
+		      struct thermal_cooling_device *cdev, int index);
 };
 
 /* Structure to define Thermal Zone parameters */