Skip to contentSkip to conversation

therm_* drivers need i2c-keywest

PATCH In review Colin Leroy 3 participants 6 messages Jan 16, 2004 – Jan 17, 2004

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 therm_* drivers need i2c-keywest

Hi,

This patch lets the different pmac thermostat drivers try to load i2c-keywest if necessary and possible.

HTH,
--
Colin

Index: drivers/macintosh/therm_adt7467.c
===================================================================
RCS file: /home/cvsroot/linuxppc/drivers/macintosh/therm_adt7467.c,v retrieving revision 1.1

macintosh/therm_adt7467.c +6 -0
diff -u -u -r1.1 therm_adt7467.c
@@ -27,6 +27,7 @@
 #include <asm/system.h>
 #include <asm/sections.h>
 #include <asm/of_device.h>
+#include <linux/kmod.h>
 
 #undef DEBUG
 
@@ -392,6 +393,7 @@
 {
 	struct device_node* np;
 	u32 *prop;
+	int res = 0;
 
 	/* Currently, we only deal with the iBook G4, we will support
 	 * all "2003" powerbooks later on
@@ -424,6 +426,10 @@
 	device_create_file(&of_dev->dev, &dev_attr_gpu_limit);
 	device_create_file(&of_dev->dev, &dev_attr_fan_speed);
 
+#ifdef CONFIG_KMOD
+	if ((res = request_module("i2c-keywest")) != 0)
+		return res;
+#endif
 	return i2c_add_driver(&thermostat_driver);
 }
 

Index: drivers/macintosh/therm_pm72.c
===================================================================
RCS file: /home/cvsroot/linuxppc/drivers/macintosh/therm_pm72.c,v retrieving revision 1.1.1.1

macintosh/therm_pm72.c +6 -0
diff -u -u -r1.1.1.1 therm_pm72.c
@@ -91,6 +91,7 @@
 #include <asm/system.h>
 #include <asm/sections.h>
 #include <asm/of_device.h>
+#include <linux/kmod.h>
 
 #include "therm_pm72.h"
 
@@ -1165,6 +1166,11 @@
 
 	state = state_detached;
 
+#ifdef CONFIG_KMOD
+	rc = request_module("i2c-keywest");
+	if (rc != 0)
+		return ret;
+#endif
 	rc = i2c_add_driver(&therm_pm72_driver);
 	if (rc < 0)
 		return rc;

Index: drivers/macintosh/therm_windtunnel.c
===================================================================
RCS file: /home/cvsroot/linuxppc/drivers/macintosh/therm_windtunnel.c,v retrieving revision 1.1

macintosh/therm_windtunnel.c +5 -0
diff -u -u -r1.1 therm_windtunnel.c
@@ -44,6 +44,7 @@
 #include <asm/io.h>
 #include <asm/system.h>
 #include <asm/sections.h>
+#include <linux/kmod.h>
 
 MODULE_AUTHOR("Samuel Rydh <[email protected]>");
 MODULE_DESCRIPTION("Apple G4 (windtunnel) fan driver");
@@ -380,6 +381,10 @@
 		printk(KERN_ERR "g4fan: unsupported machine type\n");
 		return -ENODEV;
 	}
+#ifdef CONFIG_KMOD
+	if( (ret=request_module("i2c-keywest")) )
+		return ret;
+#endif
 	if( (ret=i2c_add_driver(&g4fan_driver)) )
 		return ret;
 
#1 lore raw
Quoted 4 lines · Colin Leroy

Hi,

This patch lets the different pmac thermostat drivers try to load i2c-keywest if necessary and possible.

As I didn't saw that request_module() errors if the module is already loaded (heh.), a better version of this is to avoid checking return value... See attached.
--
Colin

Index: drivers/macintosh/therm_adt7467.c
===================================================================
RCS file: /home/cvsroot/linuxppc/drivers/macintosh/therm_adt7467.c,v retrieving revision 1.1

macintosh/therm_adt7467.c +5 -0
diff -u -u -r1.1 therm_adt7467.c
@@ -27,6 +27,7 @@
 #include <asm/system.h>
 #include <asm/sections.h>
 #include <asm/of_device.h>
+#include <linux/kmod.h>
 
 #undef DEBUG
 
@@ -392,6 +393,7 @@
 {
 	struct device_node* np;
 	u32 *prop;
+	int res = 0;
 
 	/* Currently, we only deal with the iBook G4, we will support
 	 * all "2003" powerbooks later on
@@ -424,6 +426,9 @@
 	device_create_file(&of_dev->dev, &dev_attr_gpu_limit);
 	device_create_file(&of_dev->dev, &dev_attr_fan_speed);
 
+#ifdef CONFIG_KMOD
+	request_module("i2c-keywest");
+#endif
 	return i2c_add_driver(&thermostat_driver);
 }
 

Index: drivers/macintosh/therm_pm72.c
===================================================================
RCS file: /home/cvsroot/linuxppc/drivers/macintosh/therm_pm72.c,v retrieving revision 1.1.1.1

macintosh/therm_pm72.c +4 -0
diff -u -u -r1.1.1.1 therm_pm72.c
@@ -91,6 +91,7 @@
 #include <asm/system.h>
 #include <asm/sections.h>
 #include <asm/of_device.h>
+#include <linux/kmod.h>
 
 #include "therm_pm72.h"
 
@@ -1165,6 +1166,9 @@
 
 	state = state_detached;
 
+#ifdef CONFIG_KMOD
+	request_module("i2c-keywest");
+#endif
 	rc = i2c_add_driver(&therm_pm72_driver);
 	if (rc < 0)
 		return rc;

Index: drivers/macintosh/therm_windtunnel.c
===================================================================
RCS file: /home/cvsroot/linuxppc/drivers/macintosh/therm_windtunnel.c,v retrieving revision 1.1

macintosh/therm_windtunnel.c +4 -0
diff -u -u -r1.1 therm_windtunnel.c
@@ -44,6 +44,7 @@
 #include <asm/io.h>
 #include <asm/system.h>
 #include <asm/sections.h>
+#include <linux/kmod.h>
 
 MODULE_AUTHOR("Samuel Rydh <[email protected]>");
 MODULE_DESCRIPTION("Apple G4 (windtunnel) fan driver");
@@ -380,6 +381,9 @@
 		printk(KERN_ERR "g4fan: unsupported machine type\n");
 		return -ENODEV;
 	}
+#ifdef CONFIG_KMOD
+	request_module("i2c-keywest");
+#endif
 	if( (ret=i2c_add_driver(&g4fan_driver)) )
 		return ret;
 
#2 lore raw
Quoted 6 lines · Colin Leroy
Quoted 2 lines · Colin Leroy

This patch lets the different pmac thermostat drivers try to load i2c-keywest if necessary and possible.

As I didn't saw that request_module() errors if the module is already loaded (heh.), a better version of this is to avoid checking return value... See attached.

And you want to drop the #ifdef CONFIG_KMOD, since that's already in <linux/kmod.h>.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#3 lore raw

hi,

Quoted 2 lines

And you want to drop the #ifdef CONFIG_KMOD, since that's already in <linux/kmod.h>.

Sure, here it is.
--
Colin
Ne disez pas disez, mais disez dites

Index: drivers/macintosh/therm_adt7467.c
===================================================================
RCS file: /home/cvsroot/linuxppc/drivers/macintosh/therm_adt7467.c,v retrieving revision 1.1

macintosh/therm_adt7467.c +2 -0
diff -u -u -r1.1 therm_adt7467.c
@@ -27,6 +27,7 @@
 #include <asm/system.h>
 #include <asm/sections.h>
 #include <asm/of_device.h>
+#include <linux/kmod.h>
 
 #undef DEBUG
 
@@ -424,6 +425,7 @@
 	device_create_file(&of_dev->dev, &dev_attr_gpu_limit);
 	device_create_file(&of_dev->dev, &dev_attr_fan_speed);
 	
+	request_module("i2c-keywest");
 	return i2c_add_driver(&thermostat_driver);
 }
 

Index: drivers/macintosh/therm_pm72.c
===================================================================
RCS file: /home/cvsroot/linuxppc/drivers/macintosh/therm_pm72.c,v retrieving revision 1.1.1.1

macintosh/therm_pm72.c +2 -0
diff -u -u -r1.1.1.1 therm_pm72.c
@@ -91,6 +91,7 @@
 #include <asm/system.h>
 #include <asm/sections.h>
 #include <asm/of_device.h>
+#include <linux/kmod.h>
 
 #include "therm_pm72.h"
 
@@ -1165,6 +1166,7 @@
 
 	state = state_detached;
 
+	request_module("i2c-keywest");
 	rc = i2c_add_driver(&therm_pm72_driver);
 	if (rc < 0)
 		return rc;

Index: drivers/macintosh/therm_windtunnel.c
===================================================================
RCS file: /home/cvsroot/linuxppc/drivers/macintosh/therm_windtunnel.c,v retrieving revision 1.1

macintosh/therm_windtunnel.c +2 -0
diff -u -u -r1.1 therm_windtunnel.c
@@ -44,6 +44,7 @@
 #include <asm/io.h>
 #include <asm/system.h>
 #include <asm/sections.h>
+#include <linux/kmod.h>
 
 MODULE_AUTHOR("Samuel Rydh <[email protected]>");
 MODULE_DESCRIPTION("Apple G4 (windtunnel) fan driver");
@@ -380,6 +381,7 @@
 		printk(KERN_ERR "g4fan: unsupported machine type\n");
 		return -ENODEV;
 	}
+	request_module("i2c-keywest");
 	if( (ret=i2c_add_driver(&g4fan_driver)) )
 		return ret;
 
#4 lore raw
In reply to Colin Leroy
Quoted 1 line · Colin Leroy

This patch lets the different pmac thermostat drivers try to load i2c-keywest if necessary and possible.

the patch works fine against the soundcore/i2c_west modprobing problem, which i've talk about some threads ago.

what's about /dev/ entries ?, i still see nothing into it...the only infos that i can fetch are into /var/log/syslog.

If i don't make a mismatch, there should be some /dev entries that the module should create, usefull to set/fetch important informations about fans/cpu.

regards
--
[ valvoline :: VRL Team :: s0ftpj :: freaknet Medialab :: GPG key available ] [ key fingerprint :: - :: B7E2 48BC 705F AE8F 9ABE E422 076A 2561 1D67 B4DD ] [ GPG key available on keyserver :: pgp.mit.edu :: with keyID :: 1D67B4DD :: ]

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#5 lore raw

On 16 Jan 2004 at 17h01, valvoline wrote:

Hi,

Quoted 6 lines

what's about /dev/ entries ?, i still see nothing into it...the only infos that i can fetch are into /var/log/syslog.

If i don't make a mismatch, there should be some /dev entries that the module should create, usefull to set/fetch important informations about fans/cpu.

They're in /sys - that's the new 2.6 location for such things. Look in /sys/devices/temperatures/

--
Colin

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/