mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 10:40:15 +02:00 
			
		
		
		
	thermal: rcar_gen3_thermal: Register hwmon sysfs interface
Register the hwmon sysfs interface on R-Car Gen3 thermal driver to align it with Gen2 driver. Use devm_add_action() to unregister the hwmon interface automatically. Cc: Eduardo Valentin <edubezval@gmail.com> Cc: Wolfram Sang <wsa+renesas@sang-engineering.com> Cc: linux-renesas-soc@vger.kernel.org To: linux-pm@vger.kernel.org From: Marek Vasut <marek.vasut+renesas@gmail.com> Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
This commit is contained in:
		
							parent
							
								
									a245b62be3
								
							
						
					
					
						commit
						6269e9f790
					
				
					 1 changed files with 19 additions and 0 deletions
				
			
		| 
						 | 
					@ -19,6 +19,7 @@
 | 
				
			||||||
#include <linux/thermal.h>
 | 
					#include <linux/thermal.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "thermal_core.h"
 | 
					#include "thermal_core.h"
 | 
				
			||||||
 | 
					#include "thermal_hwmon.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Register offsets */
 | 
					/* Register offsets */
 | 
				
			||||||
#define REG_GEN3_IRQSTR		0x04
 | 
					#define REG_GEN3_IRQSTR		0x04
 | 
				
			||||||
| 
						 | 
					@ -337,6 +338,13 @@ static int rcar_gen3_thermal_remove(struct platform_device *pdev)
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static void rcar_gen3_hwmon_action(void *data)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						struct thermal_zone_device *zone = data;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						thermal_remove_hwmon_sysfs(zone);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int rcar_gen3_thermal_probe(struct platform_device *pdev)
 | 
					static int rcar_gen3_thermal_probe(struct platform_device *pdev)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct rcar_gen3_thermal_priv *priv;
 | 
						struct rcar_gen3_thermal_priv *priv;
 | 
				
			||||||
| 
						 | 
					@ -429,6 +437,17 @@ static int rcar_gen3_thermal_probe(struct platform_device *pdev)
 | 
				
			||||||
		if (ret < 0)
 | 
							if (ret < 0)
 | 
				
			||||||
			goto error_unregister;
 | 
								goto error_unregister;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							tsc->zone->tzp->no_hwmon = false;
 | 
				
			||||||
 | 
							ret = thermal_add_hwmon_sysfs(tsc->zone);
 | 
				
			||||||
 | 
							if (ret)
 | 
				
			||||||
 | 
								goto error_unregister;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							ret = devm_add_action(dev, rcar_gen3_hwmon_action, zone);
 | 
				
			||||||
 | 
							if (ret) {
 | 
				
			||||||
 | 
								rcar_gen3_hwmon_action(zone);
 | 
				
			||||||
 | 
								goto error_unregister;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		dev_info(dev, "TSC%d: Loaded %d trip points\n", i, ret);
 | 
							dev_info(dev, "TSC%d: Loaded %d trip points\n", i, ret);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue