Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3c99c2ce authored by Javi Merino's avatar Javi Merino Committed by Eduardo Valentin
Browse files

thermal: devfreq_cooling: use a thermal_cooling_device for register and unregister



Be consistent with what other cooling devices do and return a struct
thermal_cooling_device * on register.  Also, for the unregister, accept
a struct thermal_cooling_device * as parameter.

Cc: Zhang Rui <rui.zhang@intel.com>
Cc: Eduardo Valentin <edubezval@gmail.com>
Signed-off-by: default avatarJavi Merino <javi.merino@arm.com>
Signed-off-by: default avatarEduardo Valentin <edubezval@gmail.com>
parent 8fb2b9ac
Loading
Loading
Loading
Loading
+10 −6
Original line number Original line Diff line number Diff line
@@ -467,7 +467,7 @@ static int devfreq_cooling_gen_tables(struct devfreq_cooling_device *dfc)
 * devfreq should use the simple_ondemand governor, other governors
 * devfreq should use the simple_ondemand governor, other governors
 * are not currently supported.
 * are not currently supported.
 */
 */
struct devfreq_cooling_device *
struct thermal_cooling_device *
of_devfreq_cooling_register_power(struct device_node *np, struct devfreq *df,
of_devfreq_cooling_register_power(struct device_node *np, struct devfreq *df,
				  struct devfreq_cooling_power *dfc_power)
				  struct devfreq_cooling_power *dfc_power)
{
{
@@ -513,7 +513,7 @@ of_devfreq_cooling_register_power(struct device_node *np, struct devfreq *df,


	dfc->cdev = cdev;
	dfc->cdev = cdev;


	return dfc;
	return cdev;


release_idr:
release_idr:
	release_idr(&devfreq_idr, dfc->id);
	release_idr(&devfreq_idr, dfc->id);
@@ -533,7 +533,7 @@ EXPORT_SYMBOL_GPL(of_devfreq_cooling_register_power);
 * @np: Pointer to OF device_node.
 * @np: Pointer to OF device_node.
 * @df: Pointer to devfreq device.
 * @df: Pointer to devfreq device.
 */
 */
struct devfreq_cooling_device *
struct thermal_cooling_device *
of_devfreq_cooling_register(struct device_node *np, struct devfreq *df)
of_devfreq_cooling_register(struct device_node *np, struct devfreq *df)
{
{
	return of_devfreq_cooling_register_power(np, df, NULL);
	return of_devfreq_cooling_register_power(np, df, NULL);
@@ -544,7 +544,7 @@ EXPORT_SYMBOL_GPL(of_devfreq_cooling_register);
 * devfreq_cooling_register() - Register devfreq cooling device.
 * devfreq_cooling_register() - Register devfreq cooling device.
 * @df: Pointer to devfreq device.
 * @df: Pointer to devfreq device.
 */
 */
struct devfreq_cooling_device *devfreq_cooling_register(struct devfreq *df)
struct thermal_cooling_device *devfreq_cooling_register(struct devfreq *df)
{
{
	return of_devfreq_cooling_register(NULL, df);
	return of_devfreq_cooling_register(NULL, df);
}
}
@@ -554,11 +554,15 @@ EXPORT_SYMBOL_GPL(devfreq_cooling_register);
 * devfreq_cooling_unregister() - Unregister devfreq cooling device.
 * devfreq_cooling_unregister() - Unregister devfreq cooling device.
 * @dfc: Pointer to devfreq cooling device to unregister.
 * @dfc: Pointer to devfreq cooling device to unregister.
 */
 */
void devfreq_cooling_unregister(struct devfreq_cooling_device *dfc)
void devfreq_cooling_unregister(struct thermal_cooling_device *cdev)
{
{
	if (!dfc)
	struct devfreq_cooling_device *dfc;

	if (!cdev)
		return;
		return;


	dfc = cdev->devdata;

	thermal_cooling_device_unregister(dfc->cdev);
	thermal_cooling_device_unregister(dfc->cdev);
	release_idr(&devfreq_idr, dfc->id);
	release_idr(&devfreq_idr, dfc->id);
	kfree(dfc->power_table);
	kfree(dfc->power_table);
+8 −8
Original line number Original line Diff line number Diff line
@@ -43,37 +43,37 @@ struct devfreq_cooling_power {
	unsigned long dyn_power_coeff;
	unsigned long dyn_power_coeff;
};
};


struct devfreq_cooling_device *
struct thermal_cooling_device *
of_devfreq_cooling_register_power(struct device_node *np, struct devfreq *df,
of_devfreq_cooling_register_power(struct device_node *np, struct devfreq *df,
				  struct devfreq_cooling_power *dfc_power);
				  struct devfreq_cooling_power *dfc_power);
struct devfreq_cooling_device *
struct thermal_cooling_device *
of_devfreq_cooling_register(struct device_node *np, struct devfreq *df);
of_devfreq_cooling_register(struct device_node *np, struct devfreq *df);
struct devfreq_cooling_device *devfreq_cooling_register(struct devfreq *df);
struct thermal_cooling_device *devfreq_cooling_register(struct devfreq *df);
void devfreq_cooling_unregister(struct devfreq_cooling_device *dfc);
void devfreq_cooling_unregister(struct thermal_cooling_device *dfc);


#else /* !CONFIG_DEVFREQ_THERMAL */
#else /* !CONFIG_DEVFREQ_THERMAL */


struct devfreq_cooling_device *
struct thermal_cooling_device *
of_devfreq_cooling_register_power(struct device_node *np, struct devfreq *df,
of_devfreq_cooling_register_power(struct device_node *np, struct devfreq *df,
				  struct devfreq_cooling_power *dfc_power)
				  struct devfreq_cooling_power *dfc_power)
{
{
	return ERR_PTR(-EINVAL);
	return ERR_PTR(-EINVAL);
}
}


static inline struct devfreq_cooling_device *
static inline struct thermal_cooling_device *
of_devfreq_cooling_register(struct device_node *np, struct devfreq *df)
of_devfreq_cooling_register(struct device_node *np, struct devfreq *df)
{
{
	return ERR_PTR(-EINVAL);
	return ERR_PTR(-EINVAL);
}
}


static inline struct devfreq_cooling_device *
static inline struct thermal_cooling_device *
devfreq_cooling_register(struct devfreq *df)
devfreq_cooling_register(struct devfreq *df)
{
{
	return ERR_PTR(-EINVAL);
	return ERR_PTR(-EINVAL);
}
}


static inline void
static inline void
devfreq_cooling_unregister(struct devfreq_cooling_device *dfc)
devfreq_cooling_unregister(struct thermal_cooling_device *dfc)
{
{
}
}