* GL520SM Sensor Chip driver fix
@ 2005-02-20 15:06 Adam 'dredzik' Kuczynski
2005-02-21 19:17 ` Jean Delvare
0 siblings, 1 reply; 2+ messages in thread
From: Adam 'dredzik' Kuczynski @ 2005-02-20 15:06 UTC (permalink / raw)
To: linux-kernel; +Cc: dredzik
[-- Attachment #1.1: Type: text/plain, Size: 773 bytes --]
Hi,
I've been recently trying to get my lmsensors working under
2.6.9, and i've found this:
http://seclists.org/lists/linux-kernel/2005/Feb/2856.html
http://lkml.org/lkml/2005/2/11/90
kernel patch for gl520 chip, but after applying it kernel refused to
compile. So I've fixed it using gl518sm module source code and I want to
share the results of my work with you. I hope that it will be useful.
I've tested this on my machine and it works fine.
Bye
PS: I hope i'm writting to good list.
--
.$ .,_ .$ [ Adam 'dredzik' Kuczynski ]
gP""Y:$ g. ,gP ,P" _,P gP""Y:$ [ http://dredzik.ekg2.org/ ]
Y. ,Y: `$,P Y$ Y. ,Y: [ mailto: dredzik@ekg2.org ]
`"" `b.`Y' `"-- `"" `b. [ JID: dredzik@jabber.org ]
[-- Attachment #1.2: gl520sm-sensor-fixed.patch --]
[-- Type: text/plain, Size: 1367 bytes --]
--- linux-2.6.9/drivers/i2c/chips/gl520sm.c.orig 2005-02-20 15:20:38.000000000 +0100
+++ linux-2.6.9/drivers/i2c/chips/gl520sm.c 2005-02-20 15:41:25.000000000 +0100
@@ -37,6 +37,9 @@
static unsigned short normal_i2c[] = { 0x2c, 0x2d, I2C_CLIENT_END };
static unsigned int normal_isa[] = { I2C_CLIENT_ISA_END };
+static unsigned short normal_i2c_range[] = { I2C_CLIENT_END };
+static unsigned int normal_isa_range[] = { I2C_CLIENT_ISA_END };
+
/* Insmod parameters */
SENSORS_INSMOD_1(gl520sm);
@@ -500,13 +503,25 @@
static int gl520_attach_adapter(struct i2c_adapter *adapter)
{
- if (!(adapter->clRD_DATA))
- goto exit;
+ if (!(adapter->class & I2C_CLASS_HWMON))
+ return 0;
+ return i2c_detect(adapter, &addr_data, gl520_detect);
+}
+static int gl520_detect(struct i2c_adapter *adapter, int address, int kind)
+{
+ struct i2c_client *new_client;
+ struct gl520_data *data;
+ int err = 0;
+
+ if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA |
+ I2C_FUNC_SMBUS_WORD_DATA))
+ goto exit;
+
/* OK. For now, we presume we have a valid client. We now create the
client structure, even though we cannot fill it completely yet.
But it allows us to access gl520_{read,write}_value. */
-
+
if (!(data = kmalloc(sizeof(struct gl520_data), GFP_KERNEL))) {
err = -ENOMEM;
goto exit;
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: GL520SM Sensor Chip driver fix
2005-02-20 15:06 GL520SM Sensor Chip driver fix Adam 'dredzik' Kuczynski
@ 2005-02-21 19:17 ` Jean Delvare
0 siblings, 0 replies; 2+ messages in thread
From: Jean Delvare @ 2005-02-21 19:17 UTC (permalink / raw)
To: Adam 'dredzik' Kuczynski; +Cc: LKML, Maarten Deprez
Hi Adam,
> I've been recently trying to get my lmsensors working under
> 2.6.9, and i've found this:
>
> http://seclists.org/lists/linux-kernel/2005/Feb/2856.html
> http://lkml.org/lkml/2005/2/11/90
>
> kernel patch for gl520 chip, but after applying it kernel refused to
> compile. So I've fixed it using gl518sm module source code and I want
> to share the results of my work with you. I hope that it will be
> useful.
> (...)
> +static unsigned short normal_i2c_range[] = { I2C_CLIENT_END };
> +static unsigned int normal_isa_range[] = { I2C_CLIENT_ISA_END };
Ranges were taken apart in 2.6.10-rc2, and Maarten's patch was meant for
linux-2.6.11-rc3-mm2, so it comes to no surprise that you had to
reintroduce them when backporting to 2.6.9.
> static int gl520_attach_adapter(struct i2c_adapter *adapter)
> {
> - if (!(adapter->clRD_DATA))
> - goto exit;
> + if (!(adapter->class & I2C_CLASS_HWMON))
> + return 0;
> + return i2c_detect(adapter, &addr_data, gl520_detect);
> +}
>
> +static int gl520_detect(struct i2c_adapter *adapter, int address, int kind)
> +{
> + struct i2c_client *new_client;
> + struct gl520_data *data;
> + int err = 0;
> +
> + if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA |
> + I2C_FUNC_SMBUS_WORD_DATA))
> + goto exit;
> +
I suspect that a problem happened when you retrieved the original patch
and it somehow got corrupted, because everything you restore here is
already correct in Maarten's patch.
As a summary, Maarten's patch was just fine and doesn't need any update.
Thanks,
--
Jean Delvare
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2005-02-21 19:28 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-02-20 15:06 GL520SM Sensor Chip driver fix Adam 'dredzik' Kuczynski
2005-02-21 19:17 ` Jean Delvare
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).