Skip to contentSkip to conversation

thermal: build generic thermal driver as a module

PATCH In review Zhang, Rui 2 participants 2 messages Apr 2, 2008 – Apr 6, 2008

Subsystems (2)
lore
Share & tools
lore

Zhang, Rui

author reviewer
#0 lore raw

PATCH 1/3 thermal: build generic thermal driver as a module

The generic thermal driver can be built as module "thermal_sys", which give us more flexibility both at build time and when bugs are reported.

---
 drivers/thermal/Kconfig   |    4 ++--
 drivers/thermal/Makefile  |    3 ++-
 drivers/thermal/thermal.c |    2 +-
 3 files changed, 5 insertions(+), 4 deletions(-)

Index: linux-2.6/drivers/thermal/Kconfig =================================--- linux-2.6.orig/drivers/thermal/Kconfig +++ linux-2.6/drivers/thermal/Kconfig
@@ -3,7 +3,7 @@
#

menuconfig THERMAL
- bool "Generic Thermal sysfs driver"
+ tristate "Generic Thermal sysfs driver"
help
Generic Thermal Sysfs driver offers a generic mechanism for thermal management. Usually it's made up of one or more thermal
@@ -11,4 +11,4 @@ menuconfig THERMAL
Each thermal zone contains its own temperature, trip points, cooling devices.
All platforms with ACPI thermal support can use this driver.
- If you want this support, you should say Y here.
+ If you want this support, you should say Y or M here.
Index: linux-2.6/drivers/thermal/thermal.c =================================--- linux-2.6.orig/drivers/thermal/thermal.c +++ linux-2.6/drivers/thermal/thermal.c
@@ -31,7 +31,7 @@
#include <linux/thermal.h>
#include <linux/spinlock.h>

-MODULE_AUTHOR("Zhang Rui")
+MODULE_AUTHOR("Zhang Rui");
MODULE_DESCRIPTION("Generic thermal management sysfs support"); MODULE_LICENSE("GPL");

Index: linux-2.6/drivers/thermal/Makefile =================================--- linux-2.6.orig/drivers/thermal/Makefile +++ linux-2.6/drivers/thermal/Makefile
@@ -2,4 +2,5 @@
# Makefile for sensor chip drivers.
#

-obj-$(CONFIG_THERMAL) += thermal.o
+thermal_sys-objs += thermal.o
+obj-$(CONFIG_THERMAL) += thermal_sys.o

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

#1 lore raw

Hi Rui,

Quoted 3 lines · Rui

The generic thermal driver can be built as module "thermal_sys", which give us more flexibility both at build time and when bugs are reported.

I (obviously) like the idea...

Quoted 12 lines
---
 drivers/thermal/Kconfig   |    4 ++--
 drivers/thermal/Makefile  |    3 ++-
 drivers/thermal/thermal.c |    2 +-
 3 files changed, 5 insertions(+), 4 deletions(-)

Index: linux-2.6/drivers/thermal/Kconfig =================================> --- linux-2.6.orig/drivers/thermal/Kconfig +++ linux-2.6/drivers/thermal/Kconfig

Review line 6

Quoted 5 lines
(quoted diff) +1 -1
@@ -3,7 +3,7 @@
 #
 
 menuconfig THERMAL
-	bool "Generic Thermal sysfs driver"
+	tristate "Generic Thermal sysfs driver"

There's a build breakage currently if this is compiled as module, fix is below:

---
 include/linux/thermal.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/thermal.h +1 -1
@@ -89,7 +89,7 @@ int thermal_zone_bind_cooling_device(str
 int thermal_zone_unbind_cooling_device(struct thermal_zone_device *, int,
 				       struct thermal_cooling_device *);
 
-#ifdef	CONFIG_THERMAL
+#if defined CONFIG_THERMAL || defined CONFIG_THERMAL_MODULE
 struct thermal_cooling_device *thermal_cooling_device_register(char *, void *,
 							       struct
 							       thermal_cooling_device_ops
Quoted 27 lines
(quoted diff) +1 -1
 	help
 	  Generic Thermal Sysfs driver offers a generic mechanism for
 	  thermal management. Usually it's made up of one or more thermal
@@ -11,4 +11,4 @@ menuconfig THERMAL
 	  Each thermal zone contains its own temperature, trip points,
 	  cooling devices.
 	  All platforms with ACPI thermal support can use this driver.
-	  If you want this support, you should say Y here.
+	  If you want this support, you should say Y or M here.

Index: linux-2.6/drivers/thermal/thermal.c =================================> --- linux-2.6.orig/drivers/thermal/thermal.c +++ linux-2.6/drivers/thermal/thermal.c

(quoted diff) +1 -1
@@ -31,7 +31,7 @@
 #include <linux/thermal.h>
 #include <linux/spinlock.h>
 
-MODULE_AUTHOR("Zhang Rui")
+MODULE_AUTHOR("Zhang Rui");
 MODULE_DESCRIPTION("Generic thermal management sysfs support");
 MODULE_LICENSE("GPL");
 

Index: linux-2.6/drivers/thermal/Makefile =================================> --- linux-2.6.orig/drivers/thermal/Makefile +++ linux-2.6/drivers/thermal/Makefile

Review line 6

Quoted 6 lines
(quoted diff) +2 -1
@@ -2,4 +2,5 @@
 # Makefile for sensor chip drivers.
 #
 
-obj-$(CONFIG_THERMAL)		+= thermal.o
+thermal_sys-objs	+= thermal.o
+obj-$(CONFIG_THERMAL)		+= thermal_sys.o

I'd rather rename the source file to thermal_sys.c, so that developers can search for the module name and find it. It's also more efficient. Git handles renaming just fine, so I guess Len can take care of this.

Signature · 6 lines
Jean Delvare

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors