linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2.6] I2C: Separate non-i2c hwmon drivers from i2c-core (0/9)
@ 2005-07-19 21:39 Jean Delvare
  2005-07-19 21:45 ` [PATCH 2.6] I2C: Separate non-i2c hwmon drivers from i2c-core (1/9) Jean Delvare
                   ` (8 more replies)
  0 siblings, 9 replies; 21+ messages in thread
From: Jean Delvare @ 2005-07-19 21:39 UTC (permalink / raw)
  To: LKML, LM Sensors; +Cc: Greg KH

Hi all,

This is a set of patches for review and comments. The aim is to start
separating a number of hardware monitoring drivers from the i2c
subsystem. Hardware monitoring (or sensors) have a long history of being
registered with the i2c subsystem even when they are not I2C (nor SMBus)
devices. This adds artificial dependencies  between various kernel
drivers, is reponsible for some weird code, and prevents us from
cleaning up some code in the i2c subsystem. For all these reasons, I
would like to separate non-I2C hardware monitoring drivers from the i2c
core.

This will be a multistep process, as we need to keep all the drivers
working and to preserve user-space compatibility (most notably with
libsensors) while cleaning up the various parts which need be.

This patchset constitutes the first big step, and is made up of 9
patches, to be applied in order. Individual patches follow, each with
comments and diffstat.

Andrew, please don't pick this for -mm yet. It'll hopefully come to you
through Greg's i2c tree when it is ready.

Additional notes:

* Stats (debugging disabled)

                                  before       after        diff

# I2C-only drivers
drivers/hwmon/adm1021.ko           16855       16820	     -35
drivers/hwmon/adm1025.ko           21677       21642	     -35
drivers/hwmon/adm1026.ko           41379       41344	     -35
drivers/hwmon/adm1031.ko           23071       23036	     -35
drivers/hwmon/adm9240.ko           21338       21303	     -35
drivers/hwmon/asb100.ko            27512       27445	     -67
drivers/hwmon/atxp1.ko             10410       10375	     -35
drivers/hwmon/ds1621.ko             9970        9903	     -67
drivers/hwmon/fscher.ko            19333       19298	     -35
drivers/hwmon/fscpos.ko            19192       19157	     -35
drivers/hwmon/gl518sm.ko           21011       20976	     -35
drivers/hwmon/gl520sm.ko           23552       23517	     -35
drivers/hwmon/lm63.ko              12532       12497	     -35
drivers/hwmon/lm75.ko               9382        9347	     -35
drivers/hwmon/lm77.ko              11666       11631	     -35
drivers/hwmon/lm80.ko              22552       22517	     -35
drivers/hwmon/lm83.ko              10146       10111	     -35
drivers/hwmon/lm85.ko              41069       41034	     -35
drivers/hwmon/lm87.ko              25868       25833	     -35
drivers/hwmon/lm90.ko              15511       15458	     -53
drivers/hwmon/lm92.ko              12072       12037	     -35
drivers/hwmon/max1619.ko           10995       10960	     -35
drivers/hwmon/w83l785ts.ko          8513        8478	     -35
drivers/i2c/chips/ds1337.ko         8800        8765	     -35
drivers/i2c/chips/eeprom.ko         8331        8296	     -35
drivers/i2c/chips/max6875.ko       10460       10425	     -35
drivers/i2c/chips/pca9539.ko        7981        7946	     -35
drivers/i2c/chips/pcf8574.ko        8260        8225	     -35
drivers/i2c/chips/pcf8591.ko        9798        9763	     -35

# hybrid drivers
drivers/hwmon/it87.ko              25924       26563	    +639
drivers/hwmon/lm78.ko              21781       22420	    +639
drivers/hwmon/w83781d.ko           39132       39745	    +613

# ISA-only drivers
drivers/hwmon/pc87360.ko           48007       47734	    -273
drivers/hwmon/sis5595.ko           20257       17401	   -2856
drivers/hwmon/smsc47b397.ko         7422        7122	    -300
drivers/hwmon/smsc47m1.ko          11330       11080	    -250
drivers/hwmon/via686a.ko           22922       20066	   -2856
drivers/hwmon/w83627ehf.ko         19155       16255	   -2900
drivers/hwmon/w83627hf.ko          35861       30955	   -4906

# core modules
drivers/i2c/busses/i2c-isa.ko       2991        5685	   +2694
drivers/i2c/i2c-core.ko            21257       21805	    +548
drivers/i2c/i2c-sensor.ko           4057        3767	    -290

total                                                     -10595

 Documentation/i2c/porting-clients |    7 -
 Documentation/i2c/writing-clients |   46 ++++-------
 drivers/hwmon/Kconfig             |    3 
 drivers/hwmon/adm1021.c           |   10 --
 drivers/hwmon/adm1025.c           |    1 
 drivers/hwmon/adm1026.c           |    1 
 drivers/hwmon/adm1031.c           |    1 
 drivers/hwmon/adm9240.c           |    2 
 drivers/hwmon/asb100.c            |   11 --
 drivers/hwmon/atxp1.c             |    1 
 drivers/hwmon/ds1621.c            |    1 
 drivers/hwmon/fscher.c            |    1 
 drivers/hwmon/fscpos.c            |    1 
 drivers/hwmon/gl518sm.c           |    1 
 drivers/hwmon/gl520sm.c           |    1 
 drivers/hwmon/it87.c              |   42 ++++++++--
 drivers/hwmon/lm63.c              |    1 
 drivers/hwmon/lm75.c              |   11 --
 drivers/hwmon/lm77.c              |    1 
 drivers/hwmon/lm78.c              |   37 +++++++-
 drivers/hwmon/lm80.c              |    1 
 drivers/hwmon/lm83.c              |    1 
 drivers/hwmon/lm85.c              |    6 -
 drivers/hwmon/lm87.c              |    1 
 drivers/hwmon/lm90.c              |    1 
 drivers/hwmon/lm92.c              |    1 
 drivers/hwmon/max1619.c           |    1 
 drivers/hwmon/pc87360.c           |   43 ++--------
 drivers/hwmon/sis5595.c           |   46 ++---------
 drivers/hwmon/smsc47b397.c        |   53 +++---------
 drivers/hwmon/smsc47m1.c          |   47 ++---------
 drivers/hwmon/via686a.c           |   46 ++---------
 drivers/hwmon/w83627ehf.c         |   40 ++-------
 drivers/hwmon/w83627hf.c          |   54 +++---------
 drivers/hwmon/w83781d.c           |   37 +++++++-
 drivers/hwmon/w83l785ts.c         |    1 
 drivers/i2c/busses/Kconfig        |    8 -
 drivers/i2c/busses/i2c-isa.c      |  158 +++++++++++++++++++++++++++++++++++---
 drivers/i2c/chips/ds1337.c        |    1 
 drivers/i2c/chips/eeprom.c        |    1 
 drivers/i2c/chips/max6875.c       |    1 
 drivers/i2c/chips/pca9539.c       |    1 
 drivers/i2c/chips/pcf8574.c       |    1 
 drivers/i2c/chips/pcf8591.c       |    1 
 drivers/i2c/i2c-core.c            |   14 ++-
 drivers/i2c/i2c-sensor-detect.c   |   45 +++-------
 include/linux/i2c-isa.h           |   36 ++++++++
 include/linux/i2c-sensor.h        |   36 +++-----
 include/linux/i2c.h               |   22 ++---
 49 files changed, 448 insertions(+), 436 deletions(-)

These stats are not necessarily very impressive by themselves, as
i2c-isa and i2c-core both increase in size quite significantly, and so
do the hybrid drivers. However this changeset opens possibilities to
many other cleanups in the future, including dropping i2c-isa altogether
(which will revert all the losses on i2c-core and i2c-isa), merging
i2c_probe and i2c_detect (100 lines of code) and reworking the way i2c
module parameters are handled (150 lines of ugly macros).

The size shrink of the ISA-only drivers is nice already. The loss on
hybrid drivers isn't very significant as this is a rare case, and even
it87 may become an ISA-only driver in the long run.

* ISA drivers are still registered with the i2c subsystem at the moment,
even if not as directly as before. This is a requirement as long as
user-space tools (libsensors) are not taught to search for hardware
monitoring drivers in /sys/class/hwmon rather than /sys/bus/i2c. I'll
work on that in parallel. In the long run, we really want these drivers
to be completely independant from the i2c subsystem, and this patchset
is a step in this direction, even if it might not be obvious at first
sight.

* Each hybrid driver could be split in three parts, one I2C part, one
ISA part and one common part. This would make things cleaner and would
suppress some artificial dependencies. There is little value in doing so
right now though, as the ISA part would still depend on i2c-core. Doing
so would also break compatibility with user-space (not by much but
still). Not sure what we want to do here as there are only three (or
even two) such drivers and there is a significant work to split them.

* i2c-isa could have been moved to drivers/hwmon or drivers/i2c as it is
no more an i2c bus driver (it never really has been), but I chose not to
do it because in the long run this module will disappear anyway - so why
bother?

Thanks,
-- 
Jean Delvare

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH 2.6] I2C: Separate non-i2c hwmon drivers from i2c-core (1/9)
  2005-07-19 21:39 [PATCH 2.6] I2C: Separate non-i2c hwmon drivers from i2c-core (0/9) Jean Delvare
@ 2005-07-19 21:45 ` Jean Delvare
  2005-07-20  4:26   ` Greg KH
  2005-07-19 21:48 ` [PATCH 2.6] I2C: Separate non-i2c hwmon drivers from i2c-core (2/9) Jean Delvare
                   ` (7 subsequent siblings)
  8 siblings, 1 reply; 21+ messages in thread
From: Jean Delvare @ 2005-07-19 21:45 UTC (permalink / raw)
  To: LKML, LM Sensors; +Cc: Greg KH

Temporarily export a few structures and functions from i2c-core, because
we will soon need them in i2c-isa.

 drivers/i2c/i2c-core.c |   14 ++++++++++----
 include/linux/i2c.h    |    7 +++++++
 2 files changed, 17 insertions(+), 4 deletions(-)

--- linux-2.6.13-rc3.orig/drivers/i2c/i2c-core.c	2005-07-13 23:34:12.000000000 +0200
+++ linux-2.6.13-rc3/drivers/i2c/i2c-core.c	2005-07-16 18:37:09.000000000 +0200
@@ -61,7 +61,7 @@
 	return rc;
 }
 
-static struct bus_type i2c_bus_type = {
+struct bus_type i2c_bus_type = {
 	.name =		"i2c",
 	.match =	i2c_device_match,
 	.suspend =      i2c_bus_suspend,
@@ -78,13 +78,13 @@
 	return 0;
 }
 
-static void i2c_adapter_dev_release(struct device *dev)
+void i2c_adapter_dev_release(struct device *dev)
 {
 	struct i2c_adapter *adap = dev_to_i2c_adapter(dev);
 	complete(&adap->dev_released);
 }
 
-static struct device_driver i2c_adapter_driver = {
+struct device_driver i2c_adapter_driver = {
 	.name =	"i2c_adapter",
 	.bus = &i2c_bus_type,
 	.probe = i2c_device_probe,
@@ -97,7 +97,7 @@
 	complete(&adap->class_dev_released);
 }
 
-static struct class i2c_adapter_class = {
+struct class i2c_adapter_class = {
 	.name =		"i2c-adapter",
 	.release =	&i2c_adapter_class_dev_release,
 };
@@ -1171,6 +1171,12 @@
 }
 
 
+/* Next four are needed by i2c-isa */
+EXPORT_SYMBOL(i2c_adapter_dev_release);
+EXPORT_SYMBOL(i2c_adapter_driver);
+EXPORT_SYMBOL(i2c_adapter_class);
+EXPORT_SYMBOL(i2c_bus_type);
+
 EXPORT_SYMBOL(i2c_add_adapter);
 EXPORT_SYMBOL(i2c_del_adapter);
 EXPORT_SYMBOL(i2c_add_driver);
--- linux-2.6.13-rc3.orig/include/linux/i2c.h	2005-07-13 23:34:37.000000000 +0200
+++ linux-2.6.13-rc3/include/linux/i2c.h	2005-07-16 18:34:02.000000000 +0200
@@ -34,6 +34,13 @@
 #include <linux/device.h>	/* for struct device */
 #include <asm/semaphore.h>
 
+/* --- For i2c-isa ---------------------------------------------------- */
+
+extern void i2c_adapter_dev_release(struct device *dev);
+extern struct device_driver i2c_adapter_driver;
+extern struct class i2c_adapter_class;
+extern struct bus_type i2c_bus_type;
+
 /* --- General options ------------------------------------------------	*/
 
 struct i2c_msg;

-- 
Jean Delvare

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH 2.6] I2C: Separate non-i2c hwmon drivers from i2c-core (2/9)
  2005-07-19 21:39 [PATCH 2.6] I2C: Separate non-i2c hwmon drivers from i2c-core (0/9) Jean Delvare
  2005-07-19 21:45 ` [PATCH 2.6] I2C: Separate non-i2c hwmon drivers from i2c-core (1/9) Jean Delvare
@ 2005-07-19 21:48 ` Jean Delvare
  2005-07-20  4:27   ` Greg KH
  2005-07-19 21:51 ` [PATCH 2.6] I2C: Separate non-i2c hwmon drivers from i2c-core (3/9) Jean Delvare
                   ` (6 subsequent siblings)
  8 siblings, 1 reply; 21+ messages in thread
From: Jean Delvare @ 2005-07-19 21:48 UTC (permalink / raw)
  To: LKML, LM Sensors; +Cc: Greg KH

Convert i2c-isa from a dumb i2c_adapter into a pseudo i2c-core for ISA
hardware monitoring drivers. The isa i2c_adapter is no more registered
with i2c-core, drivers have to explicitely connect to it using the new
i2c_isa_{add,del}_driver interface.

At this point, all ISA chip drivers are useless, because they still
register with i2c-core in the hope i2c-isa is registered there as well,
but it isn't anymore.

The fake bus will be named i2c-9191 in sysfs. This is the number it
already had internally in various places, so it's not exactly new,
except that now the number is seen in userspace as well. This shouldn't
be a problem until someone really has 9192 I2C busses in a given system
;)

The fake bus will no more show in "i2cdetect -l", as it won't be seen by
i2c-dev anymore (not being registered with i2c-core), which is a good
thing, as i2cdetect/i2cdump/i2cset cannot operate on this fake bus
anyway.

 drivers/i2c/busses/i2c-isa.c |  158 ++++++++++++++++++++++++++++++++++++++++---
 include/linux/i2c-isa.h      |   29 +++++++
 2 files changed, 177 insertions(+), 10 deletions(-)

--- linux-2.6.13-rc3.orig/drivers/i2c/busses/i2c-isa.c	2005-07-13 23:34:12.000000000 +0200
+++ linux-2.6.13-rc3/drivers/i2c/busses/i2c-isa.c	2005-07-16 21:06:14.000000000 +0200
@@ -1,6 +1,8 @@
 /*
-    i2c-isa.c - Part of lm_sensors, Linux kernel modules for hardware
-            monitoring
+    i2c-isa.c - an i2c-core-like thing for ISA hardware monitoring chips
+    Copyright (C) 2005  Jean Delvare <khali@linux-fr.org>
+
+    Based on the i2c-isa pseudo-adapter from the lm_sensors project
     Copyright (c) 1998, 1999  Frodo Looijaard <frodol@dds.nl> 
 
     This program is free software; you can redistribute it and/or modify
@@ -18,17 +20,24 @@
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */
 
-/* This implements an i2c algorithm/adapter for ISA bus. Not that this is
-   on first sight very useful; almost no functionality is preserved.
-   Except that it makes writing drivers for chips which can be on both
-   the SMBus and the ISA bus very much easier. See lm78.c for an example
-   of this. */
+/* This implements an i2c-core-like thing for ISA hardware monitoring
+   chips. Such chips are linked to the i2c subsystem for historical
+   reasons (because the early ISA hardware monitoring chips such as the
+   LM78 had both an I2C and an ISA interface). They used to be
+   registered with the main i2c-core, but as a first step in the
+   direction of a clean separation between I2C and ISA chip drivers,
+   we now have this separate core for ISA ones. It is significantly
+   more simple than the real one, of course, because we don't have to
+   handle multiple busses: there is only one (fake) ISA adapter.
+   It is worth noting that we still rely on i2c-core for some things
+   at the moment - but hopefully this won't last. */
 
 #include <linux/init.h>
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/errno.h>
 #include <linux/i2c.h>
+#include <linux/i2c-isa.h>
 
 static u32 isa_func(struct i2c_adapter *adapter);
 
@@ -53,17 +62,146 @@
 	return 0;
 }
 
+
+/* Copied from i2c-core */
+static ssize_t show_adapter_name(struct device *dev,
+		struct device_attribute *attr, char *buf)
+{
+	struct i2c_adapter *adap = dev_to_i2c_adapter(dev);
+	return sprintf(buf, "%s\n", adap->name);
+}
+static DEVICE_ATTR(name, S_IRUGO, show_adapter_name, NULL);
+
+static int i2c_isa_device_probe(struct device *dev)
+{
+	return -ENODEV;
+}
+
+static int i2c_isa_device_remove(struct device *dev)
+{
+	return 0;
+}
+
+
+/* We implement an interface which resembles i2c_{add,del}_driver,
+   but for i2c-isa drivers. We don't have to remember and handle lists
+   of drivers and adapters so this is much more simple, of course. */
+
+int i2c_isa_add_driver(struct i2c_driver *driver)
+{
+	int res;
+
+	/* Add the driver to the list of i2c drivers in the driver core */
+	driver->driver.name = driver->name;
+	driver->driver.bus = &i2c_bus_type;
+	driver->driver.probe = i2c_isa_device_probe;
+	driver->driver.remove = i2c_isa_device_remove;
+	res = driver_register(&driver->driver);
+	if (res)
+		return res;
+	dev_dbg(&isa_adapter.dev, "Driver %s registered\n", driver->name);
+
+	/* Now look for clients */
+	driver->attach_adapter(&isa_adapter);
+
+	return 0;
+}
+
+int i2c_isa_del_driver(struct i2c_driver *driver)
+{
+	struct list_head *item, *_n;
+	struct i2c_client *client;
+	int res;
+
+	/* Detach all clients belonging to this one driver */
+	list_for_each_safe(item, _n, &isa_adapter.clients) {
+		client = list_entry(item, struct i2c_client, list);
+		if (client->driver != driver)
+			continue;
+		dev_dbg(&isa_adapter.dev, "Detaching client %s at 0x%x\n",
+			client->name, client->addr);
+		if ((res = driver->detach_client(client))) {
+			dev_err(&isa_adapter.dev, "Failed, driver "
+				"%s not unregistered!\n",
+				driver->name);
+			return res;
+		}
+	}
+
+	/* Get the driver off the core list */
+	driver_unregister(&driver->driver);
+	dev_dbg(&isa_adapter.dev, "Driver %s unregistered\n", driver->name);
+
+	return 0;
+}
+
+
 static int __init i2c_isa_init(void)
 {
-	return i2c_add_adapter(&isa_adapter);
+	init_MUTEX(&isa_adapter.clist_lock);
+	INIT_LIST_HEAD(&isa_adapter.clients);
+
+	isa_adapter.nr = ANY_I2C_ISA_BUS;
+	isa_adapter.dev.parent = &platform_bus;
+	sprintf(isa_adapter.dev.bus_id, "i2c-%d", isa_adapter.nr);
+	isa_adapter.dev.driver = &i2c_adapter_driver;
+	isa_adapter.dev.release = &i2c_adapter_dev_release;
+	device_register(&isa_adapter.dev);
+	device_create_file(&isa_adapter.dev, &dev_attr_name);
+
+	/* Add this adapter to the i2c_adapter class */
+	memset(&isa_adapter.class_dev, 0x00, sizeof(struct class_device));
+	isa_adapter.class_dev.dev = &isa_adapter.dev;
+	isa_adapter.class_dev.class = &i2c_adapter_class;
+	strlcpy(isa_adapter.class_dev.class_id, isa_adapter.dev.bus_id,
+		BUS_ID_SIZE);
+	class_device_register(&isa_adapter.class_dev);
+
+	dev_dbg(&isa_adapter.dev, "%s registered\n", isa_adapter.name);
+
+	return 0;
 }
 
 static void __exit i2c_isa_exit(void)
 {
-	i2c_del_adapter(&isa_adapter);
+#ifdef DEBUG
+	struct list_head  *item, *_n;
+	struct i2c_client *client = NULL;
+#endif
+
+	/* There should be no more active client */
+#ifdef DEBUG
+	dev_dbg(&isa_adapter.dev, "Looking for clients\n");
+	list_for_each_safe(item, _n, &isa_adapter.clients) {
+		client = list_entry(item, struct i2c_client, list);
+		dev_err(&isa_adapter.dev, "Driver %s still has an active "
+			"ISA client at 0x%x\n", client->driver->name,
+			client->addr);
+	}
+	if (client != NULL)
+		return;
+#endif
+
+	/* Clean up the sysfs representation */
+	dev_dbg(&isa_adapter.dev, "Unregistering from sysfs\n");
+	init_completion(&isa_adapter.dev_released);
+	init_completion(&isa_adapter.class_dev_released);
+	class_device_unregister(&isa_adapter.class_dev);
+	device_remove_file(&isa_adapter.dev, &dev_attr_name);
+	device_unregister(&isa_adapter.dev);
+
+	/* Wait for sysfs to drop all references */
+	dev_dbg(&isa_adapter.dev, "Waiting for sysfs completion\n");
+	wait_for_completion(&isa_adapter.dev_released);
+	wait_for_completion(&isa_adapter.class_dev_released);
+
+	dev_dbg(&isa_adapter.dev, "%s unregistered\n", isa_adapter.name);
 }
 
-MODULE_AUTHOR("Frodo Looijaard <frodol@dds.nl>");
+EXPORT_SYMBOL(i2c_isa_add_driver);
+EXPORT_SYMBOL(i2c_isa_del_driver);
+
+MODULE_AUTHOR("Jean Delvare <khali@linux-fr.org>");
 MODULE_DESCRIPTION("ISA bus access through i2c");
 MODULE_LICENSE("GPL");
 
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ linux-2.6.13-rc3/include/linux/i2c-isa.h	2005-07-16 18:46:37.000000000 +0200
@@ -0,0 +1,29 @@
+/*
+ * i2c-isa.h - definitions for the i2c-isa pseudo-i2c-adapter interface
+ *
+ * Copyright (C) 2005 Jean Delvare <khali@linux-fr.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#ifndef _LINUX_I2C_ISA_H
+#define _LINUX_I2C_ISA_H
+
+#include <linux/i2c.h>
+
+extern int i2c_isa_add_driver(struct i2c_driver *driver);
+extern int i2c_isa_del_driver(struct i2c_driver *driver);
+
+#endif /* _LINUX_I2C_ISA_H */

-- 
Jean Delvare

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH 2.6] I2C: Separate non-i2c hwmon drivers from i2c-core (3/9)
  2005-07-19 21:39 [PATCH 2.6] I2C: Separate non-i2c hwmon drivers from i2c-core (0/9) Jean Delvare
  2005-07-19 21:45 ` [PATCH 2.6] I2C: Separate non-i2c hwmon drivers from i2c-core (1/9) Jean Delvare
  2005-07-19 21:48 ` [PATCH 2.6] I2C: Separate non-i2c hwmon drivers from i2c-core (2/9) Jean Delvare
@ 2005-07-19 21:51 ` Jean Delvare
  2005-07-19 21:53 ` [PATCH 2.6] I2C: Separate non-i2c hwmon drivers from i2c-core (4/9) Jean Delvare
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 21+ messages in thread
From: Jean Delvare @ 2005-07-19 21:51 UTC (permalink / raw)
  To: LKML, LM Sensors; +Cc: Greg KH

Convert the 10 ISA hardware monitoring drivers (it87, lm78, pc87360,
sis5595, smsc47b397, smsc47m1, via686a, w83627hf, w83627ehf, w83781d) to
explicitely register with i2c-isa. For hybrid drivers (it87, lm78,
w83781d), we now have two separate instances of i2c_driver, one for the
I2C interface of the chip, and one for ISA interface. In the long run,
the one for ISA will be replaced with a different driver type.

At this point, all drivers are working again, except for missing
dependencies in Kconfig.

 drivers/hwmon/it87.c       |   29 +++++++++++++++++++++++++----
 drivers/hwmon/lm78.c       |   29 ++++++++++++++++++++++++++---
 drivers/hwmon/pc87360.c    |    5 +++--
 drivers/hwmon/sis5595.c    |    5 +++--
 drivers/hwmon/smsc47b397.c |    5 +++--
 drivers/hwmon/smsc47m1.c   |    5 +++--
 drivers/hwmon/via686a.c    |    5 +++--
 drivers/hwmon/w83627ehf.c  |    5 +++--
 drivers/hwmon/w83627hf.c   |    5 +++--
 drivers/hwmon/w83781d.c    |   28 +++++++++++++++++++++++++---
 10 files changed, 97 insertions(+), 24 deletions(-)

--- linux-2.6.13-rc3.orig/drivers/hwmon/it87.c	2005-07-16 09:53:09.000000000 +0200
+++ linux-2.6.13-rc3/drivers/hwmon/it87.c	2005-07-16 20:15:39.000000000 +0200
@@ -36,6 +36,7 @@
 #include <linux/slab.h>
 #include <linux/jiffies.h>
 #include <linux/i2c.h>
+#include <linux/i2c-isa.h>
 #include <linux/i2c-sensor.h>
 #include <linux/i2c-vid.h>
 #include <linux/hwmon-sysfs.h>
@@ -242,6 +243,14 @@
 	.detach_client	= it87_detach_client,
 };
 
+static struct i2c_driver it87_isa_driver = {
+	.owner		= THIS_MODULE,
+	.name		= "it87-isa",
+	.attach_adapter	= it87_attach_adapter,
+	.detach_client	= it87_detach_client,
+};
+
+
 static ssize_t show_in(struct device *dev, struct device_attribute *attr,
 		char *buf)
 {
@@ -741,7 +750,7 @@
 
 	/* Reserve the ISA region */
 	if (is_isa)
-		if (!request_region(address, IT87_EXTENT, it87_driver.name))
+		if (!request_region(address, IT87_EXTENT, it87_isa_driver.name))
 			goto ERROR0;
 
 	/* Probe whether there is anything available on this address. Already
@@ -787,7 +796,7 @@
 	i2c_set_clientdata(new_client, data);
 	new_client->addr = address;
 	new_client->adapter = adapter;
-	new_client->driver = &it87_driver;
+	new_client->driver = is_isa ? &it87_isa_driver : &it87_driver;
 	new_client->flags = 0;
 
 	/* Now, we do the remaining detection. */
@@ -1172,16 +1181,28 @@
 
 static int __init sm_it87_init(void)
 {
-	int addr;
+	int addr, res;
 
 	if (!it87_find(&addr)) {
 		normal_isa[0] = addr;
 	}
-	return i2c_add_driver(&it87_driver);
+
+	res = i2c_add_driver(&it87_driver);
+	if (res)
+		return res;
+
+	res = i2c_isa_add_driver(&it87_isa_driver);
+	if (res) {
+		i2c_del_driver(&it87_driver);
+		return res;
+	}
+
+	return 0;
 }
 
 static void __exit sm_it87_exit(void)
 {
+	i2c_isa_del_driver(&it87_isa_driver);
 	i2c_del_driver(&it87_driver);
 }
 
--- linux-2.6.13-rc3.orig/drivers/hwmon/lm78.c	2005-07-16 09:53:09.000000000 +0200
+++ linux-2.6.13-rc3/drivers/hwmon/lm78.c	2005-07-16 20:17:04.000000000 +0200
@@ -23,6 +23,7 @@
 #include <linux/slab.h>
 #include <linux/jiffies.h>
 #include <linux/i2c.h>
+#include <linux/i2c-isa.h>
 #include <linux/i2c-sensor.h>
 #include <linux/hwmon.h>
 #include <linux/err.h>
@@ -177,6 +178,14 @@
 	.detach_client	= lm78_detach_client,
 };
 
+static struct i2c_driver lm78_isa_driver = {
+	.owner		= THIS_MODULE,
+	.name		= "lm78-isa",
+	.attach_adapter	= lm78_attach_adapter,
+	.detach_client	= lm78_detach_client,
+};
+
+
 /* 7 Voltages */
 static ssize_t show_in(struct device *dev, char *buf, int nr)
 {
@@ -488,7 +497,8 @@
 
 	/* Reserve the ISA region */
 	if (is_isa)
-		if (!request_region(address, LM78_EXTENT, lm78_driver.name)) {
+		if (!request_region(address, LM78_EXTENT,
+				    lm78_isa_driver.name)) {
 			err = -EBUSY;
 			goto ERROR0;
 		}
@@ -543,7 +553,7 @@
 	i2c_set_clientdata(new_client, data);
 	new_client->addr = address;
 	new_client->adapter = adapter;
-	new_client->driver = &lm78_driver;
+	new_client->driver = is_isa ? &lm78_isa_driver : &lm78_driver;
 	new_client->flags = 0;
 
 	/* Now, we do the remaining detection. */
@@ -791,11 +801,24 @@
 
 static int __init sm_lm78_init(void)
 {
-	return i2c_add_driver(&lm78_driver);
+	int res;
+
+	res = i2c_add_driver(&lm78_driver);
+	if (res)
+		return res;
+
+	res = i2c_isa_add_driver(&lm78_isa_driver);
+	if (res) {
+		i2c_del_driver(&lm78_driver);
+		return res;
+	}
+
+	return 0;
 }
 
 static void __exit sm_lm78_exit(void)
 {
+	i2c_isa_del_driver(&lm78_isa_driver);
 	i2c_del_driver(&lm78_driver);
 }
 
--- linux-2.6.13-rc3.orig/drivers/hwmon/pc87360.c	2005-07-16 09:53:15.000000000 +0200
+++ linux-2.6.13-rc3/drivers/hwmon/pc87360.c	2005-07-16 20:11:59.000000000 +0200
@@ -38,6 +38,7 @@
 #include <linux/slab.h>
 #include <linux/jiffies.h>
 #include <linux/i2c.h>
+#include <linux/i2c-isa.h>
 #include <linux/i2c-sensor.h>
 #include <linux/i2c-vid.h>
 #include <linux/hwmon.h>
@@ -1344,12 +1345,12 @@
 		return -ENODEV;
 	}
 
-	return i2c_add_driver(&pc87360_driver);
+	return i2c_isa_add_driver(&pc87360_driver);
 }
 
 static void __exit pc87360_exit(void)
 {
-	i2c_del_driver(&pc87360_driver);
+	i2c_isa_del_driver(&pc87360_driver);
 }
 
 
--- linux-2.6.13-rc3.orig/drivers/hwmon/sis5595.c	2005-07-16 09:53:09.000000000 +0200
+++ linux-2.6.13-rc3/drivers/hwmon/sis5595.c	2005-07-16 20:11:59.000000000 +0200
@@ -55,6 +55,7 @@
 #include <linux/ioport.h>
 #include <linux/pci.h>
 #include <linux/i2c.h>
+#include <linux/i2c-isa.h>
 #include <linux/i2c-sensor.h>
 #include <linux/hwmon.h>
 #include <linux/err.h>
@@ -790,7 +791,7 @@
 	normal_isa[0] = addr;
 
 	s_bridge = pci_dev_get(dev);
-	if (i2c_add_driver(&sis5595_driver)) {
+	if (i2c_isa_add_driver(&sis5595_driver)) {
 		pci_dev_put(s_bridge);
 		s_bridge = NULL;
 	}
@@ -817,7 +818,7 @@
 {
 	pci_unregister_driver(&sis5595_pci_driver);
 	if (s_bridge != NULL) {
-		i2c_del_driver(&sis5595_driver);
+		i2c_isa_del_driver(&sis5595_driver);
 		pci_dev_put(s_bridge);
 		s_bridge = NULL;
 	}
--- linux-2.6.13-rc3.orig/drivers/hwmon/smsc47b397.c	2005-07-16 09:53:09.000000000 +0200
+++ linux-2.6.13-rc3/drivers/hwmon/smsc47b397.c	2005-07-16 20:11:59.000000000 +0200
@@ -31,6 +31,7 @@
 #include <linux/ioport.h>
 #include <linux/jiffies.h>
 #include <linux/i2c.h>
+#include <linux/i2c-isa.h>
 #include <linux/i2c-sensor.h>
 #include <linux/hwmon.h>
 #include <linux/err.h>
@@ -350,12 +351,12 @@
 	if ((ret = smsc47b397_find(normal_isa)))
 		return ret;
 
-	return i2c_add_driver(&smsc47b397_driver);
+	return i2c_isa_add_driver(&smsc47b397_driver);
 }
 
 static void __exit smsc47b397_exit(void)
 {
-	i2c_del_driver(&smsc47b397_driver);
+	i2c_isa_del_driver(&smsc47b397_driver);
 }
 
 MODULE_AUTHOR("Mark M. Hoffman <mhoffman@lightlink.com>");
--- linux-2.6.13-rc3.orig/drivers/hwmon/smsc47m1.c	2005-07-16 09:53:09.000000000 +0200
+++ linux-2.6.13-rc3/drivers/hwmon/smsc47m1.c	2005-07-16 20:11:59.000000000 +0200
@@ -30,6 +30,7 @@
 #include <linux/ioport.h>
 #include <linux/jiffies.h>
 #include <linux/i2c.h>
+#include <linux/i2c-isa.h>
 #include <linux/i2c-sensor.h>
 #include <linux/hwmon.h>
 #include <linux/err.h>
@@ -592,12 +593,12 @@
 		return -ENODEV;
 	}
 
-	return i2c_add_driver(&smsc47m1_driver);
+	return i2c_isa_add_driver(&smsc47m1_driver);
 }
 
 static void __exit sm_smsc47m1_exit(void)
 {
-	i2c_del_driver(&smsc47m1_driver);
+	i2c_isa_del_driver(&smsc47m1_driver);
 }
 
 MODULE_AUTHOR("Mark D. Studebaker <mdsxyz123@yahoo.com>");
--- linux-2.6.13-rc3.orig/drivers/hwmon/via686a.c	2005-07-16 09:53:09.000000000 +0200
+++ linux-2.6.13-rc3/drivers/hwmon/via686a.c	2005-07-16 20:11:59.000000000 +0200
@@ -35,6 +35,7 @@
 #include <linux/pci.h>
 #include <linux/jiffies.h>
 #include <linux/i2c.h>
+#include <linux/i2c-isa.h>
 #include <linux/i2c-sensor.h>
 #include <linux/hwmon.h>
 #include <linux/err.h>
@@ -846,7 +847,7 @@
 	normal_isa[0] = addr;
 
 	s_bridge = pci_dev_get(dev);
-	if (i2c_add_driver(&via686a_driver)) {
+	if (i2c_isa_add_driver(&via686a_driver)) {
 		pci_dev_put(s_bridge);
 		s_bridge = NULL;
 	}
@@ -873,7 +874,7 @@
 {
 	pci_unregister_driver(&via686a_pci_driver);
 	if (s_bridge != NULL) {
-		i2c_del_driver(&via686a_driver);
+		i2c_isa_del_driver(&via686a_driver);
 		pci_dev_put(s_bridge);
 		s_bridge = NULL;
 	}
--- linux-2.6.13-rc3.orig/drivers/hwmon/w83627hf.c	2005-07-16 09:53:09.000000000 +0200
+++ linux-2.6.13-rc3/drivers/hwmon/w83627hf.c	2005-07-16 20:11:59.000000000 +0200
@@ -42,6 +42,7 @@
 #include <linux/slab.h>
 #include <linux/jiffies.h>
 #include <linux/i2c.h>
+#include <linux/i2c-isa.h>
 #include <linux/i2c-sensor.h>
 #include <linux/i2c-vid.h>
 #include <linux/hwmon.h>
@@ -1507,12 +1508,12 @@
 	}
 	normal_isa[0] = addr;
 
-	return i2c_add_driver(&w83627hf_driver);
+	return i2c_isa_add_driver(&w83627hf_driver);
 }
 
 static void __exit sensors_w83627hf_exit(void)
 {
-	i2c_del_driver(&w83627hf_driver);
+	i2c_isa_del_driver(&w83627hf_driver);
 }
 
 MODULE_AUTHOR("Frodo Looijaard <frodol@dds.nl>, "
--- linux-2.6.13-rc3.orig/drivers/hwmon/w83781d.c	2005-07-16 09:53:09.000000000 +0200
+++ linux-2.6.13-rc3/drivers/hwmon/w83781d.c	2005-07-16 20:17:22.000000000 +0200
@@ -38,6 +38,7 @@
 #include <linux/slab.h>
 #include <linux/jiffies.h>
 #include <linux/i2c.h>
+#include <linux/i2c-isa.h>
 #include <linux/i2c-sensor.h>
 #include <linux/i2c-vid.h>
 #include <linux/hwmon.h>
@@ -276,6 +277,14 @@
 	.detach_client = w83781d_detach_client,
 };
 
+static struct i2c_driver w83781d_isa_driver = {
+	.owner = THIS_MODULE,
+	.name = "w83781d-isa",
+	.attach_adapter = w83781d_attach_adapter,
+	.detach_client = w83781d_detach_client,
+};
+
+
 /* following are the sysfs callback functions */
 #define show_in_reg(reg) \
 static ssize_t show_##reg (struct device *dev, char *buf, int nr) \
@@ -1002,7 +1011,7 @@
 	
 	if (is_isa)
 		if (!request_region(address, W83781D_EXTENT,
-				    w83781d_driver.name)) {
+				    w83781d_isa_driver.name)) {
 			dev_dbg(&adapter->dev, "Request of region "
 				"0x%x-0x%x for w83781d failed\n", address,
 				address + W83781D_EXTENT - 1);
@@ -1060,7 +1069,7 @@
 	new_client->addr = address;
 	init_MUTEX(&data->lock);
 	new_client->adapter = adapter;
-	new_client->driver = &w83781d_driver;
+	new_client->driver = is_isa ? &w83781d_isa_driver : &w83781d_driver;
 	new_client->flags = 0;
 
 	/* Now, we do the remaining detection. */
@@ -1636,12 +1645,25 @@
 static int __init
 sensors_w83781d_init(void)
 {
-	return i2c_add_driver(&w83781d_driver);
+	int res;
+
+	res = i2c_add_driver(&w83781d_driver);
+	if (res)
+		return res;
+
+	res = i2c_isa_add_driver(&w83781d_isa_driver);
+	if (res) {
+		i2c_del_driver(&w83781d_driver);
+		return res;
+	}
+
+	return 0;
 }
 
 static void __exit
 sensors_w83781d_exit(void)
 {
+	i2c_isa_del_driver(&w83781d_isa_driver);
 	i2c_del_driver(&w83781d_driver);
 }
 
--- linux-2.6.13-rc3.orig/drivers/hwmon/w83627ehf.c	2005-07-16 09:53:09.000000000 +0200
+++ linux-2.6.13-rc3/drivers/hwmon/w83627ehf.c	2005-07-16 20:14:00.000000000 +0200
@@ -37,6 +37,7 @@
 #include <linux/init.h>
 #include <linux/slab.h>
 #include <linux/i2c.h>
+#include <linux/i2c-isa.h>
 #include <linux/i2c-sensor.h>
 #include <linux/hwmon.h>
 #include <linux/err.h>
@@ -844,12 +845,12 @@
 	 && w83627ehf_find(0x4e, &normal_isa[0]))
 		return -ENODEV;
 
-	return i2c_add_driver(&w83627ehf_driver);
+	return i2c_isa_add_driver(&w83627ehf_driver);
 }
 
 static void __exit sensors_w83627ehf_exit(void)
 {
-	i2c_del_driver(&w83627ehf_driver);
+	i2c_isa_del_driver(&w83627ehf_driver);
 }
 
 MODULE_AUTHOR("Jean Delvare <khali@linux-fr.org>");


-- 
Jean Delvare

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH 2.6] I2C: Separate non-i2c hwmon drivers from i2c-core (4/9)
  2005-07-19 21:39 [PATCH 2.6] I2C: Separate non-i2c hwmon drivers from i2c-core (0/9) Jean Delvare
                   ` (2 preceding siblings ...)
  2005-07-19 21:51 ` [PATCH 2.6] I2C: Separate non-i2c hwmon drivers from i2c-core (3/9) Jean Delvare
@ 2005-07-19 21:53 ` Jean Delvare
  2005-07-19 21:56 ` [PATCH 2.6] I2C: Separate non-i2c hwmon drivers from i2c-core (5/9) Jean Delvare
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 21+ messages in thread
From: Jean Delvare @ 2005-07-19 21:53 UTC (permalink / raw)
  To: LKML, LM Sensors; +Cc: Greg KH

All ISA hardware monitoring drivers (including hybrid drivers) now have
a hard dependency on i2c-isa, so they must select I2C_ISA. As a result,
CONFIG_I2C_ISA doesn't need to be left visible to the user. The good
thing here is that users will stop complaining that some driver doesn't
work just because they forgot to compile or load i2c-isa.

At this point, all drivers are working again and the cleanup phase can
begin.

 drivers/hwmon/Kconfig      |    3 +++
 drivers/i2c/busses/Kconfig |    8 +-------
 2 files changed, 4 insertions(+), 7 deletions(-)

--- linux-2.6.13-rc3.orig/drivers/hwmon/Kconfig	2005-07-16 09:53:08.000000000 +0200
+++ linux-2.6.13-rc3/drivers/hwmon/Kconfig	2005-07-16 20:33:50.000000000 +0200
@@ -160,6 +160,7 @@
 	tristate "ITE IT87xx and compatibles"
 	depends on HWMON && I2C
 	select I2C_SENSOR
+	select I2C_ISA
 	help
 	  If you say yes here you get support for ITE IT87xx sensor chips
 	  and clones: SiS960.
@@ -211,6 +212,7 @@
 	tristate "National Semiconductor LM78 and compatibles"
 	depends on HWMON && I2C && EXPERIMENTAL
 	select I2C_SENSOR
+	select I2C_ISA
 	help
 	  If you say yes here you get support for National Semiconductor LM78,
 	  LM78-J and LM79.
@@ -366,6 +368,7 @@
 	tristate "Winbond W83781D, W83782D, W83783S, W83627HF, Asus AS99127F"
 	depends on HWMON && I2C
 	select I2C_SENSOR
+	select I2C_ISA
 	help
 	  If you say yes here you get support for the Winbond W8378x series
 	  of sensor chips: the W83781D, W83782D, W83783S and W83627HF,
--- linux-2.6.13-rc3.orig/drivers/i2c/busses/Kconfig	2005-07-13 23:34:12.000000000 +0200
+++ linux-2.6.13-rc3/drivers/i2c/busses/Kconfig	2005-07-16 20:34:31.000000000 +0200
@@ -182,14 +182,8 @@
 	  will be called i2c-iop3xx.
 
 config I2C_ISA
-	tristate "ISA Bus support"
+	tristate
 	depends on I2C
-	help
-	  If you say yes to this option, support will be included for i2c
-	  interfaces that are on the ISA bus.
-
-	  This driver can also be built as a module.  If so, the module
-	  will be called i2c-isa.
 
 config I2C_ITE
 	tristate "ITE I2C Adapter"


-- 
Jean Delvare

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH 2.6] I2C: Separate non-i2c hwmon drivers from i2c-core (5/9)
  2005-07-19 21:39 [PATCH 2.6] I2C: Separate non-i2c hwmon drivers from i2c-core (0/9) Jean Delvare
                   ` (3 preceding siblings ...)
  2005-07-19 21:53 ` [PATCH 2.6] I2C: Separate non-i2c hwmon drivers from i2c-core (4/9) Jean Delvare
@ 2005-07-19 21:56 ` Jean Delvare
  2005-07-26 22:33   ` patch i2c-hwmon-split-05.patch added to gregkh-2.6 tree gregkh
  2005-07-19 21:57 ` [PATCH 2.6] I2C: Separate non-i2c hwmon drivers from i2c-core (6/9) Jean Delvare
                   ` (3 subsequent siblings)
  8 siblings, 1 reply; 21+ messages in thread
From: Jean Delvare @ 2005-07-19 21:56 UTC (permalink / raw)
  To: LKML, LM Sensors; +Cc: Greg KH

Call the ISA chip drivers detection function directly instead of relying
on i2c_detect. The net effect is that address lists won't be handled
anymore, but they were mostly useless in the ISA case anyway (pc87360,
smsc47m1, smsc47b397 had already dropped them).

We don't need to handle multiple devices, all we may need is a way to
force a given address instead of the original one (some drivers already
do: sis5595, via686a, w83627hf), and, for drivers supporting multiple
chips, a way to force one given kind. All this may be added later on
demand, but I actually don't think there will be much demand.

 drivers/hwmon/it87.c       |   16 ++++++++++----
 drivers/hwmon/lm78.c       |   11 ++++++++--
 drivers/hwmon/pc87360.c    |   38 ++++++++--------------------------
 drivers/hwmon/sis5595.c    |   41 ++++++++-----------------------------
 drivers/hwmon/smsc47b397.c |   48 +++++++++++---------------------------------
 drivers/hwmon/smsc47m1.c   |   42 ++++++++------------------------------
 drivers/hwmon/via686a.c    |   41 +++++++------------------------------
 drivers/hwmon/w83627ehf.c  |   35 ++++++++------------------------
 drivers/hwmon/w83627hf.c   |   49 +++++++++++----------------------------------
 drivers/hwmon/w83781d.c    |   12 +++++++++--
 10 files changed, 98 insertions(+), 235 deletions(-)

--- linux-2.6.13-rc3.orig/drivers/hwmon/pc87360.c	2005-07-16 21:26:53.000000000 +0200
+++ linux-2.6.13-rc3/drivers/hwmon/pc87360.c	2005-07-17 12:47:11.000000000 +0200
@@ -39,25 +39,17 @@
 #include <linux/jiffies.h>
 #include <linux/i2c.h>
 #include <linux/i2c-isa.h>
-#include <linux/i2c-sensor.h>
 #include <linux/i2c-vid.h>
 #include <linux/hwmon.h>
 #include <linux/err.h>
 #include <asm/io.h>
 
-static unsigned short normal_i2c[] = { I2C_CLIENT_END };
-static unsigned int normal_isa[] = { 0, I2C_CLIENT_ISA_END };
-static struct i2c_force_data forces[] = {{ NULL }};
 static u8 devid;
-static unsigned int extra_isa[3];
+static unsigned short address;
+static unsigned short extra_isa[3];
 static u8 confreg[4];
 
 enum chips { any_chip, pc87360, pc87363, pc87364, pc87365, pc87366 };
-static struct i2c_address_data addr_data = {
-	.normal_i2c		= normal_i2c,
-	.normal_isa		= normal_isa,
-	.forces			= forces,
-};
 
 static int init = 1;
 module_param(init, int, 0);
@@ -228,8 +220,7 @@
  * Functions declaration
  */
 
-static int pc87360_attach_adapter(struct i2c_adapter *adapter);
-static int pc87360_detect(struct i2c_adapter *adapter, int address, int kind);
+static int pc87360_detect(struct i2c_adapter *adapter);
 static int pc87360_detach_client(struct i2c_client *client);
 
 static int pc87360_read_value(struct pc87360_data *data, u8 ldi, u8 bank,
@@ -246,8 +237,7 @@
 static struct i2c_driver pc87360_driver = {
 	.owner		= THIS_MODULE,
 	.name		= "pc87360",
-	.flags		= I2C_DF_NOTIFY,
-	.attach_adapter	= pc87360_attach_adapter,
+	.attach_adapter	= pc87360_detect,
 	.detach_client	= pc87360_detach_client,
 };
 
@@ -636,12 +626,7 @@
  * Device detection, registration and update
  */
 
-static int pc87360_attach_adapter(struct i2c_adapter *adapter)
-{
-	return i2c_detect(adapter, &addr_data, pc87360_detect);
-}
-
-static int pc87360_find(int sioaddr, u8 *devid, int *address)
+static int pc87360_find(int sioaddr, u8 *devid, unsigned short *addresses)
 {
 	u16 val;
 	int i;
@@ -687,7 +672,7 @@
 			continue;
 		}
 
-		address[i] = val;
+		addresses[i] = val;
 
 		if (i==0) { /* Fans */
 			confreg[0] = superio_inb(sioaddr, 0xF0);
@@ -731,9 +716,7 @@
 	return 0;
 }
 
-/* We don't really care about the address.
-   Read from extra_isa instead. */
-int pc87360_detect(struct i2c_adapter *adapter, int address, int kind)
+static int pc87360_detect(struct i2c_adapter *adapter)
 {
 	int i;
 	struct i2c_client *new_client;
@@ -742,9 +725,6 @@
 	const char *name = "pc87360";
 	int use_thermistors = 0;
 
-	if (!i2c_is_isa_adapter(adapter))
-		return -ENODEV;
-
 	if (!(data = kmalloc(sizeof(struct pc87360_data), GFP_KERNEL)))
 		return -ENOMEM;
 	memset(data, 0x00, sizeof(struct pc87360_data));
@@ -1334,12 +1314,12 @@
 	/* Arbitrarily pick one of the addresses */
 	for (i = 0; i < 3; i++) {
 		if (extra_isa[i] != 0x0000) {
-			normal_isa[0] = extra_isa[i];
+			address = extra_isa[i];
 			break;
 		}
 	}
 
-	if (normal_isa[0] == 0x0000) {
+	if (address == 0x0000) {
 		printk(KERN_WARNING "pc87360: No active logical device, "
 		       "module not inserted.\n");
 		return -ENODEV;
--- linux-2.6.13-rc3.orig/drivers/hwmon/sis5595.c	2005-07-16 21:26:53.000000000 +0200
+++ linux-2.6.13-rc3/drivers/hwmon/sis5595.c	2005-07-17 10:11:17.000000000 +0200
@@ -71,14 +71,10 @@
 MODULE_PARM_DESC(force_addr,
 		 "Initialize the base address of the sensors");
 
-/* Addresses to scan.
+/* Device address
    Note that we can't determine the ISA address until we have initialized
    our module */
-static unsigned short normal_i2c[] = { I2C_CLIENT_END };
-static unsigned int normal_isa[] = { 0x0000, I2C_CLIENT_ISA_END };
-
-/* Insmod parameters */
-SENSORS_INSMOD_1(sis5595);
+static unsigned short address;
 
 /* Many SIS5595 constants specified below */
 
@@ -194,8 +190,7 @@
 
 static struct pci_dev *s_bridge;	/* pointer to the (only) sis5595 */
 
-static int sis5595_attach_adapter(struct i2c_adapter *adapter);
-static int sis5595_detect(struct i2c_adapter *adapter, int address, int kind);
+static int sis5595_detect(struct i2c_adapter *adapter);
 static int sis5595_detach_client(struct i2c_client *client);
 
 static int sis5595_read_value(struct i2c_client *client, u8 register);
@@ -206,9 +201,7 @@
 static struct i2c_driver sis5595_driver = {
 	.owner		= THIS_MODULE,
 	.name		= "sis5595",
-	.id		= I2C_DRIVERID_SIS5595,
-	.flags		= I2C_DF_NOTIFY,
-	.attach_adapter	= sis5595_attach_adapter,
+	.attach_adapter	= sis5595_detect,
 	.detach_client	= sis5595_detach_client,
 };
 
@@ -480,14 +473,7 @@
 static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL);
  
 /* This is called when the module is loaded */
-static int sis5595_attach_adapter(struct i2c_adapter *adapter)
-{
-	if (!(adapter->class & I2C_CLASS_HWMON))
-		return 0;
-	return i2c_detect(adapter, &addr_data, sis5595_detect);
-}
-
-int sis5595_detect(struct i2c_adapter *adapter, int address, int kind)
+static int sis5595_detect(struct i2c_adapter *adapter)
 {
 	int err = 0;
 	int i;
@@ -496,10 +482,6 @@
 	char val;
 	u16 a;
 
-	/* Make sure we are probing the ISA bus!!  */
-	if (!i2c_is_isa_adapter(adapter))
-		goto exit;
-
 	if (force_addr)
 		address = force_addr & ~(SIS5595_EXTENT - 1);
 	/* Reserve the ISA region */
@@ -642,8 +624,7 @@
 		return err;
 	}
 
-	if (i2c_is_isa_client(client))
-		release_region(client->addr, SIS5595_EXTENT);
+	release_region(client->addr, SIS5595_EXTENT);
 
 	kfree(data);
 
@@ -760,7 +741,6 @@
 {
 	u16 val;
 	int *i;
-	int addr = 0;
 
 	for (i = blacklist; *i != 0; i++) {
 		struct pci_dev *dev;
@@ -776,19 +756,16 @@
 	    pci_read_config_word(dev, SIS5595_BASE_REG, &val))
 		return -ENODEV;
 	
-	addr = val & ~(SIS5595_EXTENT - 1);
-	if (addr == 0 && force_addr == 0) {
+	address = val & ~(SIS5595_EXTENT - 1);
+	if (address == 0 && force_addr == 0) {
 		dev_err(&dev->dev, "Base address not set - upgrade BIOS or use force_addr=0xaddr\n");
 		return -ENODEV;
 	}
-	if (force_addr)
-		addr = force_addr;	/* so detect will get called */
 
-	if (!addr) {
+	if (!address) {
 		dev_err(&dev->dev,"No SiS 5595 sensors found.\n");
 		return -ENODEV;
 	}
-	normal_isa[0] = addr;
 
 	s_bridge = pci_dev_get(dev);
 	if (i2c_isa_add_driver(&sis5595_driver)) {
--- linux-2.6.13-rc3.orig/drivers/hwmon/via686a.c	2005-07-16 21:26:53.000000000 +0200
+++ linux-2.6.13-rc3/drivers/hwmon/via686a.c	2005-07-17 10:11:25.000000000 +0200
@@ -50,14 +50,10 @@
 MODULE_PARM_DESC(force_addr,
 		 "Initialize the base address of the sensors");
 
-/* Addresses to scan.
+/* Device address
    Note that we can't determine the ISA address until we have initialized
    our module */
-static unsigned short normal_i2c[] = { I2C_CLIENT_END };
-static unsigned int normal_isa[] = { 0x0000, I2C_CLIENT_ISA_END };
-
-/* Insmod parameters */
-SENSORS_INSMOD_1(via686a);
+static unsigned short address;
 
 /*
    The Via 686a southbridge has a LM78-like chip integrated on the same IC.
@@ -319,8 +315,7 @@
 
 static struct pci_dev *s_bridge;	/* pointer to the (only) via686a */
 
-static int via686a_attach_adapter(struct i2c_adapter *adapter);
-static int via686a_detect(struct i2c_adapter *adapter, int address, int kind);
+static int via686a_detect(struct i2c_adapter *adapter);
 static int via686a_detach_client(struct i2c_client *client);
 
 static inline int via686a_read_value(struct i2c_client *client, u8 reg)
@@ -580,22 +575,13 @@
 static struct i2c_driver via686a_driver = {
 	.owner		= THIS_MODULE,
 	.name		= "via686a",
-	.id		= I2C_DRIVERID_VIA686A,
-	.flags		= I2C_DF_NOTIFY,
-	.attach_adapter	= via686a_attach_adapter,
+	.attach_adapter	= via686a_detect,
 	.detach_client	= via686a_detach_client,
 };
 
 
 /* This is called when the module is loaded */
-static int via686a_attach_adapter(struct i2c_adapter *adapter)
-{
-	if (!(adapter->class & I2C_CLASS_HWMON))
-		return 0;
-	return i2c_detect(adapter, &addr_data, via686a_detect);
-}
-
-static int via686a_detect(struct i2c_adapter *adapter, int address, int kind)
+static int via686a_detect(struct i2c_adapter *adapter)
 {
 	struct i2c_client *new_client;
 	struct via686a_data *data;
@@ -603,13 +589,6 @@
 	const char client_name[] = "via686a";
 	u16 val;
 
-	/* Make sure we are probing the ISA bus!!  */
-	if (!i2c_is_isa_adapter(adapter)) {
-		dev_err(&adapter->dev,
-		"via686a_detect called for an I2C bus adapter?!?\n");
-		return 0;
-	}
-
 	/* 8231 requires multiple of 256, we enforce that on 686 as well */
 	if (force_addr)
 		address = force_addr & 0xFF00;
@@ -825,26 +804,22 @@
 				       const struct pci_device_id *id)
 {
 	u16 val;
-	int addr = 0;
 
 	if (PCIBIOS_SUCCESSFUL !=
 	    pci_read_config_word(dev, VIA686A_BASE_REG, &val))
 		return -ENODEV;
 
-	addr = val & ~(VIA686A_EXTENT - 1);
-	if (addr == 0 && force_addr == 0) {
+	address = val & ~(VIA686A_EXTENT - 1);
+	if (address == 0 && force_addr == 0) {
 		dev_err(&dev->dev, "base address not set - upgrade BIOS "
 			"or use force_addr=0xaddr\n");
 		return -ENODEV;
 	}
-	if (force_addr)
-		addr = force_addr;	/* so detect will get called */
 
-	if (!addr) {
+	if (!address) {
 		dev_err(&dev->dev, "No Via 686A sensors found.\n");
 		return -ENODEV;
 	}
-	normal_isa[0] = addr;
 
 	s_bridge = pci_dev_get(dev);
 	if (i2c_isa_add_driver(&via686a_driver)) {
--- linux-2.6.13-rc3.orig/drivers/hwmon/it87.c	2005-07-16 21:26:53.000000000 +0200
+++ linux-2.6.13-rc3/drivers/hwmon/it87.c	2005-07-17 13:56:38.000000000 +0200
@@ -48,7 +48,8 @@
 /* Addresses to scan */
 static unsigned short normal_i2c[] = { 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d,
 					0x2e, 0x2f, I2C_CLIENT_END };
-static unsigned int normal_isa[] = { 0x0290, I2C_CLIENT_ISA_END };
+static unsigned int normal_isa[] = { I2C_CLIENT_ISA_END };
+static unsigned short isa_address = 0x290;
 
 /* Insmod parameters */
 SENSORS_INSMOD_2(it87, it8712);
@@ -222,7 +223,7 @@
 
 
 static int it87_attach_adapter(struct i2c_adapter *adapter);
-static int it87_find(int *address);
+static int it87_isa_attach_adapter(struct i2c_adapter *adapter);
 static int it87_detect(struct i2c_adapter *adapter, int address, int kind);
 static int it87_detach_client(struct i2c_client *client);
 
@@ -246,7 +247,7 @@
 static struct i2c_driver it87_isa_driver = {
 	.owner		= THIS_MODULE,
 	.name		= "it87-isa",
-	.attach_adapter	= it87_attach_adapter,
+	.attach_adapter	= it87_isa_attach_adapter,
 	.detach_client	= it87_detach_client,
 };
 
@@ -701,7 +702,12 @@
 	return i2c_detect(adapter, &addr_data, it87_detect);
 }
 
-/* SuperIO detection - will change normal_isa[0] if a chip is found */
+static int it87_isa_attach_adapter(struct i2c_adapter *adapter)
+{
+	return it87_detect(adapter, isa_address, -1);
+}
+
+/* SuperIO detection - will change isa_address if a chip is found */
 static int it87_find(int *address)
 {
 	int err = -ENODEV;
@@ -1184,7 +1190,7 @@
 	int addr, res;
 
 	if (!it87_find(&addr)) {
-		normal_isa[0] = addr;
+		isa_address = addr;
 	}
 
 	res = i2c_add_driver(&it87_driver);
--- linux-2.6.13-rc3.orig/drivers/hwmon/lm78.c	2005-07-16 21:26:53.000000000 +0200
+++ linux-2.6.13-rc3/drivers/hwmon/lm78.c	2005-07-17 09:28:50.000000000 +0200
@@ -34,7 +34,8 @@
 					0x25, 0x26, 0x27, 0x28, 0x29,
 					0x2a, 0x2b, 0x2c, 0x2d, 0x2e,
 					0x2f, I2C_CLIENT_END };
-static unsigned int normal_isa[] = { 0x0290, I2C_CLIENT_ISA_END };
+static unsigned int normal_isa[] = { I2C_CLIENT_ISA_END };
+static unsigned short isa_address = 0x290;
 
 /* Insmod parameters */
 SENSORS_INSMOD_3(lm78, lm78j, lm79);
@@ -160,6 +161,7 @@
 
 
 static int lm78_attach_adapter(struct i2c_adapter *adapter);
+static int lm78_isa_attach_adapter(struct i2c_adapter *adapter);
 static int lm78_detect(struct i2c_adapter *adapter, int address, int kind);
 static int lm78_detach_client(struct i2c_client *client);
 
@@ -181,7 +183,7 @@
 static struct i2c_driver lm78_isa_driver = {
 	.owner		= THIS_MODULE,
 	.name		= "lm78-isa",
-	.attach_adapter	= lm78_attach_adapter,
+	.attach_adapter	= lm78_isa_attach_adapter,
 	.detach_client	= lm78_detach_client,
 };
 
@@ -480,6 +482,11 @@
 	return i2c_detect(adapter, &addr_data, lm78_detect);
 }
 
+static int lm78_isa_attach_adapter(struct i2c_adapter *adapter)
+{
+	return lm78_detect(adapter, isa_address, -1);
+}
+
 /* This function is called by i2c_detect */
 int lm78_detect(struct i2c_adapter *adapter, int address, int kind)
 {
--- linux-2.6.13-rc3.orig/drivers/hwmon/w83781d.c	2005-07-16 21:26:53.000000000 +0200
+++ linux-2.6.13-rc3/drivers/hwmon/w83781d.c	2005-07-17 09:36:20.000000000 +0200
@@ -50,7 +50,8 @@
 static unsigned short normal_i2c[] = { 0x20, 0x21, 0x22, 0x23, 0x24, 0x25,
 					0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b,
 					0x2c, 0x2d, 0x2e, 0x2f, I2C_CLIENT_END };
-static unsigned int normal_isa[] = { 0x0290, I2C_CLIENT_ISA_END };
+static unsigned int normal_isa[] = { I2C_CLIENT_ISA_END };
+static unsigned short isa_address = 0x290;
 
 /* Insmod parameters */
 SENSORS_INSMOD_5(w83781d, w83782d, w83783s, w83627hf, as99127f);
@@ -259,6 +260,7 @@
 };
 
 static int w83781d_attach_adapter(struct i2c_adapter *adapter);
+static int w83781d_isa_attach_adapter(struct i2c_adapter *adapter);
 static int w83781d_detect(struct i2c_adapter *adapter, int address, int kind);
 static int w83781d_detach_client(struct i2c_client *client);
 
@@ -280,7 +282,7 @@
 static struct i2c_driver w83781d_isa_driver = {
 	.owner = THIS_MODULE,
 	.name = "w83781d-isa",
-	.attach_adapter = w83781d_attach_adapter,
+	.attach_adapter = w83781d_isa_attach_adapter,
 	.detach_client = w83781d_detach_client,
 };
 
@@ -871,6 +873,12 @@
 	return i2c_detect(adapter, &addr_data, w83781d_detect);
 }
 
+static int
+w83781d_isa_attach_adapter(struct i2c_adapter *adapter)
+{
+	return w83781d_detect(adapter, isa_address, -1);
+}
+
 /* Assumes that adapter is of I2C, not ISA variety.
  * OTHERWISE DON'T CALL THIS
  */
--- linux-2.6.13-rc3.orig/drivers/hwmon/smsc47b397.c	2005-07-16 21:26:53.000000000 +0200
+++ linux-2.6.13-rc3/drivers/hwmon/smsc47b397.c	2005-07-17 09:48:06.000000000 +0200
@@ -32,25 +32,13 @@
 #include <linux/jiffies.h>
 #include <linux/i2c.h>
 #include <linux/i2c-isa.h>
-#include <linux/i2c-sensor.h>
 #include <linux/hwmon.h>
 #include <linux/err.h>
 #include <linux/init.h>
 #include <asm/io.h>
 
-static unsigned short normal_i2c[] = { I2C_CLIENT_END };
 /* Address is autodetected, there is no default value */
-static unsigned int normal_isa[] = { 0x0000, I2C_CLIENT_ISA_END };
-static struct i2c_force_data forces[] = {{NULL}};
-
-enum chips { any_chip, smsc47b397 };
-static struct i2c_address_data addr_data = {
-	.normal_i2c		= normal_i2c,
-	.normal_isa		= normal_isa,
-	.probe			= normal_i2c,		/* cheat */
-	.ignore			= normal_i2c,		/* cheat */
-	.forces			= forces,
-};
+static unsigned short address;
 
 /* Super-I/0 registers and commands */
 
@@ -219,15 +207,6 @@
 #define device_create_file_fan(client, num) \
 	device_create_file(&client->dev, &dev_attr_fan##num##_input)
 
-static int smsc47b397_detect(struct i2c_adapter *adapter, int addr, int kind);
-
-static int smsc47b397_attach_adapter(struct i2c_adapter *adapter)
-{
-	if (!(adapter->class & I2C_CLASS_HWMON))
-		return 0;
-	return i2c_detect(adapter, &addr_data, smsc47b397_detect);
-}
-
 static int smsc47b397_detach_client(struct i2c_client *client)
 {
 	struct smsc47b397_data *data = i2c_get_clientdata(client);
@@ -247,27 +226,24 @@
 	return 0;
 }
 
+static int smsc47b397_detect(struct i2c_adapter *adapter);
+
 static struct i2c_driver smsc47b397_driver = {
 	.owner		= THIS_MODULE,
 	.name		= "smsc47b397",
-	.id		= I2C_DRIVERID_SMSC47B397,
-	.flags		= I2C_DF_NOTIFY,
-	.attach_adapter	= smsc47b397_attach_adapter,
+	.attach_adapter	= smsc47b397_detect,
 	.detach_client	= smsc47b397_detach_client,
 };
 
-static int smsc47b397_detect(struct i2c_adapter *adapter, int addr, int kind)
+static int smsc47b397_detect(struct i2c_adapter *adapter)
 {
 	struct i2c_client *new_client;
 	struct smsc47b397_data *data;
 	int err = 0;
 
-	if (!i2c_is_isa_adapter(adapter)) {
-		return 0;
-	}
-
-	if (!request_region(addr, SMSC_EXTENT, smsc47b397_driver.name)) {
-		dev_err(&adapter->dev, "Region 0x%x already in use!\n", addr);
+	if (!request_region(address, SMSC_EXTENT, smsc47b397_driver.name)) {
+		dev_err(&adapter->dev, "Region 0x%x already in use!\n",
+			address);
 		return -EBUSY;
 	}
 
@@ -279,7 +255,7 @@
 
 	new_client = &data->client;
 	i2c_set_clientdata(new_client, data);
-	new_client->addr = addr;
+	new_client->addr = address;
 	init_MUTEX(&data->lock);
 	new_client->adapter = adapter;
 	new_client->driver = &smsc47b397_driver;
@@ -315,11 +291,11 @@
 error_free:
 	kfree(data);
 error_release:
-	release_region(addr, SMSC_EXTENT);
+	release_region(address, SMSC_EXTENT);
 	return err;
 }
 
-static int __init smsc47b397_find(unsigned int *addr)
+static int __init smsc47b397_find(unsigned short *addr)
 {
 	u8 id, rev;
 
@@ -348,7 +324,7 @@
 {
 	int ret;
 
-	if ((ret = smsc47b397_find(normal_isa)))
+	if ((ret = smsc47b397_find(&address)))
 		return ret;
 
 	return i2c_isa_add_driver(&smsc47b397_driver);
--- linux-2.6.13-rc3.orig/drivers/hwmon/smsc47m1.c	2005-07-16 21:26:53.000000000 +0200
+++ linux-2.6.13-rc3/drivers/hwmon/smsc47m1.c	2005-07-17 09:59:58.000000000 +0200
@@ -37,17 +37,8 @@
 #include <linux/init.h>
 #include <asm/io.h>
 
-static unsigned short normal_i2c[] = { I2C_CLIENT_END };
 /* Address is autodetected, there is no default value */
-static unsigned int normal_isa[] = { 0x0000, I2C_CLIENT_ISA_END };
-static struct i2c_force_data forces[] = {{NULL}};
-
-enum chips { any_chip, smsc47m1 };
-static struct i2c_address_data addr_data = {
-	.normal_i2c		= normal_i2c,
-	.normal_isa		= normal_isa,
-	.forces			= forces,
-};
+static unsigned short address;
 
 /* Super-I/0 registers and commands */
 
@@ -125,9 +116,7 @@
 };
 
 
-static int smsc47m1_attach_adapter(struct i2c_adapter *adapter);
-static int smsc47m1_find(int *address);
-static int smsc47m1_detect(struct i2c_adapter *adapter, int address, int kind);
+static int smsc47m1_detect(struct i2c_adapter *adapter);
 static int smsc47m1_detach_client(struct i2c_client *client);
 
 static int smsc47m1_read_value(struct i2c_client *client, u8 reg);
@@ -140,9 +129,7 @@
 static struct i2c_driver smsc47m1_driver = {
 	.owner		= THIS_MODULE,
 	.name		= "smsc47m1",
-	.id		= I2C_DRIVERID_SMSC47M1,
-	.flags		= I2C_DF_NOTIFY,
-	.attach_adapter	= smsc47m1_attach_adapter,
+	.attach_adapter	= smsc47m1_detect,
 	.detach_client	= smsc47m1_detach_client,
 };
 
@@ -358,14 +345,7 @@
 
 static DEVICE_ATTR(alarms, S_IRUGO, get_alarms, NULL);
 
-static int smsc47m1_attach_adapter(struct i2c_adapter *adapter)
-{
-	if (!(adapter->class & I2C_CLASS_HWMON))
-		return 0;
-	return i2c_detect(adapter, &addr_data, smsc47m1_detect);
-}
-
-static int smsc47m1_find(int *address)
+static int smsc47m1_find(unsigned short *addr)
 {
 	u8 val;
 
@@ -392,10 +372,10 @@
 	}
 
 	superio_select();
-	*address = (superio_inb(SUPERIO_REG_BASE) << 8)
-		 |  superio_inb(SUPERIO_REG_BASE + 1);
+	*addr = (superio_inb(SUPERIO_REG_BASE) << 8)
+	      |  superio_inb(SUPERIO_REG_BASE + 1);
 	val = superio_inb(SUPERIO_REG_ACT);
-	if (*address == 0 || (val & 0x01) == 0) {
+	if (*addr == 0 || (val & 0x01) == 0) {
 		printk(KERN_INFO "smsc47m1: Device is disabled, will not use\n");
 		superio_exit();
 		return -ENODEV;
@@ -405,17 +385,13 @@
 	return 0;
 }
 
-static int smsc47m1_detect(struct i2c_adapter *adapter, int address, int kind)
+static int smsc47m1_detect(struct i2c_adapter *adapter)
 {
 	struct i2c_client *new_client;
 	struct smsc47m1_data *data;
 	int err = 0;
 	int fan1, fan2, pwm1, pwm2;
 
-	if (!i2c_is_isa_adapter(adapter)) {
-		return 0;
-	}
-
 	if (!request_region(address, SMSC_EXTENT, smsc47m1_driver.name)) {
 		dev_err(&adapter->dev, "Region 0x%x already in use!\n", address);
 		return -EBUSY;
@@ -589,7 +565,7 @@
 
 static int __init sm_smsc47m1_init(void)
 {
-	if (smsc47m1_find(normal_isa)) {
+	if (smsc47m1_find(&address)) {
 		return -ENODEV;
 	}
 
--- linux-2.6.13-rc3.orig/drivers/hwmon/w83627ehf.c	2005-07-16 21:26:53.000000000 +0200
+++ linux-2.6.13-rc3/drivers/hwmon/w83627ehf.c	2005-07-17 10:02:50.000000000 +0200
@@ -38,19 +38,13 @@
 #include <linux/slab.h>
 #include <linux/i2c.h>
 #include <linux/i2c-isa.h>
-#include <linux/i2c-sensor.h>
 #include <linux/hwmon.h>
 #include <linux/err.h>
 #include <asm/io.h>
 #include "lm75.h"
 
-/* Addresses to scan
-   The actual ISA address is read from Super-I/O configuration space */
-static unsigned short normal_i2c[] = { I2C_CLIENT_END };
-static unsigned int normal_isa[] = { 0, I2C_CLIENT_ISA_END };
-
-/* Insmod parameters */
-SENSORS_INSMOD_1(w83627ehf);
+/* The actual ISA address is read from Super-I/O configuration space */
+static unsigned short address;
 
 /*
  * Super-I/O constants and functions
@@ -670,15 +664,12 @@
 	}
 }
 
-static int w83627ehf_detect(struct i2c_adapter *adapter, int address, int kind)
+static int w83627ehf_detect(struct i2c_adapter *adapter)
 {
 	struct i2c_client *client;
 	struct w83627ehf_data *data;
 	int i, err = 0;
 
-	if (!i2c_is_isa_adapter(adapter))
-		return 0;
-
 	if (!request_region(address, REGION_LENGTH, w83627ehf_driver.name)) {
 		err = -EBUSY;
 		goto exit;
@@ -773,13 +764,6 @@
 	return err;
 }
 
-static int w83627ehf_attach_adapter(struct i2c_adapter *adapter)
-{
-	if (!(adapter->class & I2C_CLASS_HWMON))
-		return 0;
-	return i2c_detect(adapter, &addr_data, w83627ehf_detect);
-}
-
 static int w83627ehf_detach_client(struct i2c_client *client)
 {
 	struct w83627ehf_data *data = i2c_get_clientdata(client);
@@ -801,12 +785,11 @@
 static struct i2c_driver w83627ehf_driver = {
 	.owner		= THIS_MODULE,
 	.name		= "w83627ehf",
-	.flags		= I2C_DF_NOTIFY,
-	.attach_adapter	= w83627ehf_attach_adapter,
+	.attach_adapter	= w83627ehf_detect,
 	.detach_client	= w83627ehf_detach_client,
 };
 
-static int __init w83627ehf_find(int sioaddr, int *address)
+static int __init w83627ehf_find(int sioaddr, unsigned short *addr)
 {
 	u16 val;
 
@@ -824,8 +807,8 @@
 	superio_select(W83627EHF_LD_HWM);
 	val = (superio_inb(SIO_REG_ADDR) << 8)
 	    | superio_inb(SIO_REG_ADDR + 1);
-	*address = val & ~(REGION_LENGTH - 1);
-	if (*address == 0) {
+	*addr = val & ~(REGION_LENGTH - 1);
+	if (*addr == 0) {
 		superio_exit();
 		return -ENODEV;
 	}
@@ -841,8 +824,8 @@
 
 static int __init sensors_w83627ehf_init(void)
 {
-	if (w83627ehf_find(0x2e, &normal_isa[0])
-	 && w83627ehf_find(0x4e, &normal_isa[0]))
+	if (w83627ehf_find(0x2e, &address)
+	 && w83627ehf_find(0x4e, &address))
 		return -ENODEV;
 
 	return i2c_isa_add_driver(&w83627ehf_driver);
--- linux-2.6.13-rc3.orig/drivers/hwmon/w83627hf.c	2005-07-16 21:26:53.000000000 +0200
+++ linux-2.6.13-rc3/drivers/hwmon/w83627hf.c	2005-07-17 12:48:53.000000000 +0200
@@ -59,12 +59,11 @@
 MODULE_PARM_DESC(force_i2c,
 		 "Initialize the i2c address of the sensors");
 
-/* Addresses to scan */
-static unsigned short normal_i2c[] = { I2C_CLIENT_END };
-static unsigned int normal_isa[] = { 0, I2C_CLIENT_ISA_END };
+/* The actual ISA address is read from Super-I/O configuration space */
+static unsigned short address;
 
 /* Insmod parameters */
-SENSORS_INSMOD_4(w83627hf, w83627thf, w83697hf, w83637hf);
+enum chips { any_chip, w83627hf, w83627thf, w83697hf, w83637hf };
 
 static int init = 1;
 module_param(init, bool, 0);
@@ -318,9 +317,7 @@
 };
 
 
-static int w83627hf_attach_adapter(struct i2c_adapter *adapter);
-static int w83627hf_detect(struct i2c_adapter *adapter, int address,
-			  int kind);
+static int w83627hf_detect(struct i2c_adapter *adapter);
 static int w83627hf_detach_client(struct i2c_client *client);
 
 static int w83627hf_read_value(struct i2c_client *client, u16 register);
@@ -332,9 +329,7 @@
 static struct i2c_driver w83627hf_driver = {
 	.owner		= THIS_MODULE,
 	.name		= "w83627hf",
-	.id		= I2C_DRIVERID_W83627HF,
-	.flags		= I2C_DF_NOTIFY,
-	.attach_adapter	= w83627hf_attach_adapter,
+	.attach_adapter	= w83627hf_detect,
 	.detach_client	= w83627hf_detach_client,
 };
 
@@ -963,16 +958,7 @@
 } while (0)
 
 
-/* This function is called when:
-     * w83627hf_driver is inserted (when this module is loaded), for each
-       available adapter
-     * when a new adapter is inserted (and w83627hf_driver is still present) */
-static int w83627hf_attach_adapter(struct i2c_adapter *adapter)
-{
-	return i2c_detect(adapter, &addr_data, w83627hf_detect);
-}
-
-static int w83627hf_find(int sioaddr, int *address)
+static int w83627hf_find(int sioaddr, unsigned short *addr)
 {
 	u16 val;
 
@@ -992,32 +978,24 @@
 	superio_select(W83627HF_LD_HWM);
 	val = (superio_inb(WINB_BASE_REG) << 8) |
 	       superio_inb(WINB_BASE_REG + 1);
-	*address = val & ~(WINB_EXTENT - 1);
-	if (*address == 0 && force_addr == 0) {
+	*addr = val & ~(WINB_EXTENT - 1);
+	if (*addr == 0 && force_addr == 0) {
 		superio_exit();
 		return -ENODEV;
 	}
-	if (force_addr)
-		*address = force_addr;	/* so detect will get called */
 
 	superio_exit();
 	return 0;
 }
 
-int w83627hf_detect(struct i2c_adapter *adapter, int address,
-		   int kind)
+static int w83627hf_detect(struct i2c_adapter *adapter)
 {
-	int val;
+	int val, kind;
 	struct i2c_client *new_client;
 	struct w83627hf_data *data;
 	int err = 0;
 	const char *client_name = "";
 
-	if (!i2c_is_isa_adapter(adapter)) {
-		err = -ENODEV;
-		goto ERROR0;
-	}
-
 	if(force_addr)
 		address = force_addr & ~(WINB_EXTENT - 1);
 
@@ -1500,13 +1478,10 @@
 
 static int __init sensors_w83627hf_init(void)
 {
-	int addr;
-
-	if (w83627hf_find(0x2e, &addr)
-	 && w83627hf_find(0x4e, &addr)) {
+	if (w83627hf_find(0x2e, &address)
+	 && w83627hf_find(0x4e, &address)) {
 		return -ENODEV;
 	}
-	normal_isa[0] = addr;
 
 	return i2c_isa_add_driver(&w83627hf_driver);
 }

-- 
Jean Delvare

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH 2.6] I2C: Separate non-i2c hwmon drivers from i2c-core (6/9)
  2005-07-19 21:39 [PATCH 2.6] I2C: Separate non-i2c hwmon drivers from i2c-core (0/9) Jean Delvare
                   ` (4 preceding siblings ...)
  2005-07-19 21:56 ` [PATCH 2.6] I2C: Separate non-i2c hwmon drivers from i2c-core (5/9) Jean Delvare
@ 2005-07-19 21:57 ` Jean Delvare
  2005-07-19 22:02 ` [PATCH 2.6] I2C: Separate non-i2c hwmon drivers from i2c-core (7/9) Jean Delvare
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 21+ messages in thread
From: Jean Delvare @ 2005-07-19 21:57 UTC (permalink / raw)
  To: LKML, LM Sensors; +Cc: Greg KH

Kill all isa-related stuff from i2c_detect, it's not used anymore.

This is one major step in the directiom of merging i2c_probe and
i2c_detect. The last obstacle I can think of is the different way forced
addresses work between sensors and non-sensors i2c drivers. I'll deal
with that in a later patchset.

 drivers/i2c/i2c-sensor-detect.c |   45 +++++++++++-----------------------------
 1 files changed, 13 insertions(+), 32 deletions(-)

--- linux-2.6.13-rc3.orig/drivers/i2c/i2c-sensor-detect.c	2005-06-18 09:32:15.000000000 +0200
+++ linux-2.6.13-rc3/drivers/i2c/i2c-sensor-detect.c	2005-07-17 14:27:26.000000000 +0200
@@ -25,42 +25,34 @@
 #include <linux/i2c-sensor.h>
 
 static unsigned short empty[] = {I2C_CLIENT_END};
-static unsigned int empty_isa[] = {I2C_CLIENT_ISA_END};
 
-/* Very inefficient for ISA detects, and won't work for 10-bit addresses! */
+/* Won't work for 10-bit addresses! */
 int i2c_detect(struct i2c_adapter *adapter,
 	       struct i2c_address_data *address_data,
 	       int (*found_proc) (struct i2c_adapter *, int, int))
 {
 	int addr, i, found, j, err;
 	struct i2c_force_data *this_force;
-	int is_isa = i2c_is_isa_adapter(adapter);
-	int adapter_id =
-	    is_isa ? ANY_I2C_ISA_BUS : i2c_adapter_id(adapter);
+	int adapter_id = i2c_adapter_id(adapter);
 	unsigned short *normal_i2c;
-	unsigned int *normal_isa;
 	unsigned short *probe;
 	unsigned short *ignore;
 
 	/* Forget it if we can't probe using SMBUS_QUICK */
-	if ((!is_isa) &&
-	    !i2c_check_functionality(adapter, I2C_FUNC_SMBUS_QUICK))
+	if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_QUICK))
 		return -1;
 	
 	/* Use default "empty" list if the adapter doesn't specify any */
 	normal_i2c = probe = ignore = empty;
-	normal_isa = empty_isa;
 	if (address_data->normal_i2c)
 		normal_i2c = address_data->normal_i2c;
-	if (address_data->normal_isa)
-		normal_isa = address_data->normal_isa;
 	if (address_data->probe)
 		probe = address_data->probe;
 	if (address_data->ignore)
 		ignore = address_data->ignore;
 
-	for (addr = 0x00; addr <= (is_isa ? 0xffff : 0x7f); addr++) {
-		if (!is_isa && i2c_check_addr(adapter, addr))
+	for (addr = 0x00; addr <= 0x7f; addr++) {
+		if (i2c_check_addr(adapter, addr))
 			continue;
 
 		/* If it is in one of the force entries, we don't do any
@@ -69,7 +61,7 @@
 		for (i = 0; !found && (this_force = address_data->forces + i, this_force->force); i++) {
 			for (j = 0; !found && (this_force->force[j] != I2C_CLIENT_END); j += 2) {
 				if ( ((adapter_id == this_force->force[j]) ||
-				      ((this_force->force[j] == ANY_I2C_BUS) && !is_isa)) &&
+				      (this_force->force[j] == ANY_I2C_BUS)) &&
 				      (addr == this_force->force[j + 1]) ) {
 					dev_dbg(&adapter->dev, "found force parameter for adapter %d, addr %04x\n", adapter_id, addr);
 					if ((err = found_proc(adapter, addr, this_force->kind)))
@@ -85,8 +77,7 @@
 		   right now */
 		for (i = 0; !found && (ignore[i] != I2C_CLIENT_END); i += 2) {
 			if ( ((adapter_id == ignore[i]) ||
-			      ((ignore[i] == ANY_I2C_BUS) &&
-			       !is_isa)) &&
+			      (ignore[i] == ANY_I2C_BUS)) &&
 			      (addr == ignore[i + 1])) {
 				dev_dbg(&adapter->dev, "found ignore parameter for adapter %d, addr %04x\n", adapter_id, addr);
 				found = 1;
@@ -97,19 +88,10 @@
 
 		/* Now, we will do a detection, but only if it is in the normal or 
 		   probe entries */
-		if (is_isa) {
-			for (i = 0; !found && (normal_isa[i] != I2C_CLIENT_ISA_END); i += 1) {
-				if (addr == normal_isa[i]) {
-					dev_dbg(&adapter->dev, "found normal isa entry for adapter %d, addr %04x\n", adapter_id, addr);
-					found = 1;
-				}
-			}
-		} else {
-			for (i = 0; !found && (normal_i2c[i] != I2C_CLIENT_END); i += 1) {
-				if (addr == normal_i2c[i]) {
-					found = 1;
-					dev_dbg(&adapter->dev, "found normal i2c entry for adapter %d, addr %02x\n", adapter_id, addr);
-				}
+		for (i = 0; !found && (normal_i2c[i] != I2C_CLIENT_END); i += 1) {
+			if (addr == normal_i2c[i]) {
+				found = 1;
+				dev_dbg(&adapter->dev, "found normal i2c entry for adapter %d, addr %02x\n", adapter_id, addr);
 			}
 		}
 
@@ -117,7 +99,7 @@
 		     !found && (probe[i] != I2C_CLIENT_END);
 		     i += 2) {
 			if (((adapter_id == probe[i]) ||
-			     ((probe[i] == ANY_I2C_BUS) && !is_isa))
+			     (probe[i] == ANY_I2C_BUS))
 			    && (addr == probe[i + 1])) {
 				dev_dbg(&adapter->dev, "found probe parameter for adapter %d, addr %04x\n", adapter_id, addr);
 				found = 1;
@@ -128,8 +110,7 @@
 
 		/* OK, so we really should examine this address. First check
 		   whether there is some client here at all! */
-		if (is_isa ||
-		    (i2c_smbus_xfer (adapter, addr, 0, 0, 0, I2C_SMBUS_QUICK, NULL) >= 0))
+		if (i2c_smbus_xfer(adapter, addr, 0, 0, 0, I2C_SMBUS_QUICK, NULL) >= 0)
 			if ((err = found_proc(adapter, addr, -1)))
 				return err;
 	}


-- 
Jean Delvare

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH 2.6] I2C: Separate non-i2c hwmon drivers from i2c-core (7/9)
  2005-07-19 21:39 [PATCH 2.6] I2C: Separate non-i2c hwmon drivers from i2c-core (0/9) Jean Delvare
                   ` (5 preceding siblings ...)
  2005-07-19 21:57 ` [PATCH 2.6] I2C: Separate non-i2c hwmon drivers from i2c-core (6/9) Jean Delvare
@ 2005-07-19 22:02 ` Jean Delvare
  2005-07-19 22:05 ` [PATCH 2.6] I2C: Separate non-i2c hwmon drivers from i2c-core (8/9) Jean Delvare
  2005-07-19 22:09 ` [PATCH 2.6] I2C: Separate non-i2c hwmon drivers from i2c-core (9/9) Jean Delvare
  8 siblings, 0 replies; 21+ messages in thread
From: Jean Delvare @ 2005-07-19 22:02 UTC (permalink / raw)
  To: LKML, LM Sensors; +Cc: Greg KH

Kill normal_isa in header files, documentation and all chip drivers, as
it is no more used.

normal_i2c could be renamed to normal, but I decided not to do so at the
moment, so as to limit the number of changes. This might be done later
as part of the i2c_probe/i2c_detect merge.

 Documentation/i2c/porting-clients |    7 ++++---
 Documentation/i2c/writing-clients |   35 +++++++++++++++--------------------
 drivers/hwmon/adm1021.c           |    1 -
 drivers/hwmon/adm1025.c           |    1 -
 drivers/hwmon/adm1026.c           |    1 -
 drivers/hwmon/adm1031.c           |    1 -
 drivers/hwmon/adm9240.c           |    2 --
 drivers/hwmon/asb100.c            |    3 ---
 drivers/hwmon/atxp1.c             |    1 -
 drivers/hwmon/ds1621.c            |    1 -
 drivers/hwmon/fscher.c            |    1 -
 drivers/hwmon/fscpos.c            |    1 -
 drivers/hwmon/gl518sm.c           |    1 -
 drivers/hwmon/gl520sm.c           |    1 -
 drivers/hwmon/it87.c              |    1 -
 drivers/hwmon/lm63.c              |    1 -
 drivers/hwmon/lm75.c              |    1 -
 drivers/hwmon/lm77.c              |    1 -
 drivers/hwmon/lm78.c              |    1 -
 drivers/hwmon/lm80.c              |    1 -
 drivers/hwmon/lm83.c              |    1 -
 drivers/hwmon/lm85.c              |    1 -
 drivers/hwmon/lm87.c              |    1 -
 drivers/hwmon/lm90.c              |    1 -
 drivers/hwmon/lm92.c              |    1 -
 drivers/hwmon/max1619.c           |    1 -
 drivers/hwmon/w83781d.c           |    1 -
 drivers/hwmon/w83l785ts.c         |    1 -
 drivers/i2c/chips/ds1337.c        |    1 -
 drivers/i2c/chips/eeprom.c        |    1 -
 drivers/i2c/chips/max6875.c       |    1 -
 drivers/i2c/chips/pca9539.c       |    1 -
 drivers/i2c/chips/pcf8574.c       |    1 -
 drivers/i2c/chips/pcf8591.c       |    1 -
 include/linux/i2c-sensor.h        |   36 +++++++++++++++---------------------
 include/linux/i2c.h               |    8 ++------
 36 files changed, 36 insertions(+), 85 deletions(-)

--- linux-2.6.13-rc3.orig/Documentation/i2c/writing-clients	2005-07-13 23:34:03.000000000 +0200
+++ linux-2.6.13-rc3/Documentation/i2c/writing-clients	2005-07-17 16:40:39.000000000 +0200
@@ -195,31 +195,28 @@
 -------------------------
 
 If you write a `sensors' driver, you use a slightly different interface.
-As well as I2C addresses, we have to cope with ISA addresses. Also, we
-use a enum of chip types. Don't forget to include `sensors.h'.
+Also, we use a enum of chip types. Don't forget to include `sensors.h'.
 
 The following lists are used internally. They are all lists of integers.
 
-   normal_i2c: filled in by the module writer. Terminated by SENSORS_I2C_END.
+   normal_i2c: filled in by the module writer. Terminated by I2C_CLIENT_END.
      A list of I2C addresses which should normally be examined.
-   normal_isa: filled in by the module writer. Terminated by SENSORS_ISA_END.
-     A list of ISA addresses which should normally be examined.
-   probe: insmod parameter. Initialize this list with SENSORS_I2C_END values.
-     A list of pairs. The first value is a bus number (SENSORS_ISA_BUS for
-     the ISA bus, -1 for any I2C bus), the second is the address. These
-     addresses are also probed, as if they were in the 'normal' list.
-   ignore: insmod parameter. Initialize this list with SENSORS_I2C_END values.
-     A list of pairs. The first value is a bus number (SENSORS_ISA_BUS for
-     the ISA bus, -1 for any I2C bus), the second is the I2C address. These
-     addresses are never probed. This parameter overrules 'normal' and 
-     'probe', but not the 'force' lists.
+   probe: insmod parameter. Initialize this list with I2C_CLIENT_END values.
+     A list of pairs. The first value is a bus number (ANY_I2C_BUS for any
+     I2C bus), the second is the address. These addresses are also probed,
+     as if they were in the 'normal' list.
+   ignore: insmod parameter. Initialize this list with I2C_CLIENT_END values.
+     A list of pairs. The first value is a bus number (ANY_I2C_BUS for any
+     I2C bus), the second is the I2C address. These addresses are never
+     probed. This parameter overrules 'normal' and 'probe', but not the
+     'force' lists.
 
 Also used is a list of pointers to sensors_force_data structures:
    force_data: insmod parameters. A list, ending with an element of which
      the force field is NULL.
      Each element contains the type of chip and a list of pairs.
-     The first value is a bus number (SENSORS_ISA_BUS for the ISA bus, 
-     -1 for any I2C bus), the second is the address. 
+     The first value is a bus number (ANY_I2C_BUS for any I2C bus), the
+     second is the address.
      These are automatically translated to insmod variables of the form
      force_foo.
 
@@ -227,13 +224,11 @@
 `force_CHIPNAME'.
 
 Fortunately, as a module writer, you just have to define the `normal_i2c' 
-and `normal_isa' parameters, and define what chip names are used. 
-The complete declaration could look like this:
+parameter, and define what chip names are used. The complete declaration
+could look like this:
   /* Scan i2c addresses 0x37, and 0x48 to 0x4f */
   static unsigned short normal_i2c[] = { 0x37, 0x48, 0x49, 0x4a, 0x4b, 0x4c,
                                          0x4d, 0x4e, 0x4f, I2C_CLIENT_END };
-  /* Scan ISA address 0x290 */
-  static unsigned int normal_isa[] = {0x0290,SENSORS_ISA_END};
 
   /* Define chips foo and bar, as well as all module parameters and things */
   SENSORS_INSMOD_2(foo,bar);
--- linux-2.6.13-rc3.orig/drivers/hwmon/adm1021.c	2005-07-16 09:53:09.000000000 +0200
+++ linux-2.6.13-rc3/drivers/hwmon/adm1021.c	2005-07-17 16:40:39.000000000 +0200
@@ -34,7 +34,6 @@
 					0x29, 0x2a, 0x2b,
 					0x4c, 0x4d, 0x4e, 
 					I2C_CLIENT_END };
-static unsigned int normal_isa[] = { I2C_CLIENT_ISA_END };
 
 /* Insmod parameters */
 SENSORS_INSMOD_8(adm1021, adm1023, max1617, max1617a, thmc10, lm84, gl523sm, mc1066);
--- linux-2.6.13-rc3.orig/drivers/hwmon/adm1025.c	2005-07-16 09:53:09.000000000 +0200
+++ linux-2.6.13-rc3/drivers/hwmon/adm1025.c	2005-07-17 15:13:10.000000000 +0200
@@ -62,7 +62,6 @@
  */
 
 static unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, I2C_CLIENT_END };
-static unsigned int normal_isa[] = { I2C_CLIENT_ISA_END };
 
 /*
  * Insmod parameters
--- linux-2.6.13-rc3.orig/drivers/hwmon/adm1026.c	2005-07-16 09:53:15.000000000 +0200
+++ linux-2.6.13-rc3/drivers/hwmon/adm1026.c	2005-07-17 15:13:06.000000000 +0200
@@ -36,7 +36,6 @@
 
 /* Addresses to scan */
 static unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, I2C_CLIENT_END };
-static unsigned int normal_isa[] = { I2C_CLIENT_ISA_END };
 
 /* Insmod parameters */
 SENSORS_INSMOD_1(adm1026);
--- linux-2.6.13-rc3.orig/drivers/hwmon/adm1031.c	2005-07-16 09:53:09.000000000 +0200
+++ linux-2.6.13-rc3/drivers/hwmon/adm1031.c	2005-07-17 15:13:02.000000000 +0200
@@ -61,7 +61,6 @@
 
 /* Addresses to scan */
 static unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, I2C_CLIENT_END };
-static unsigned int normal_isa[] = { I2C_CLIENT_ISA_END };
 
 /* Insmod parameters */
 SENSORS_INSMOD_2(adm1030, adm1031);
--- linux-2.6.13-rc3.orig/drivers/hwmon/adm9240.c	2005-07-16 09:53:09.000000000 +0200
+++ linux-2.6.13-rc3/drivers/hwmon/adm9240.c	2005-07-17 15:12:59.000000000 +0200
@@ -54,8 +54,6 @@
 static unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, 0x2f,
 					I2C_CLIENT_END };
 
-static unsigned int normal_isa[] = { I2C_CLIENT_ISA_END };
-
 /* Insmod parameters */
 SENSORS_INSMOD_3(adm9240, ds1780, lm81);
 
--- linux-2.6.13-rc3.orig/drivers/hwmon/asb100.c	2005-07-16 09:53:09.000000000 +0200
+++ linux-2.6.13-rc3/drivers/hwmon/asb100.c	2005-07-17 16:40:39.000000000 +0200
@@ -56,9 +56,6 @@
 /* I2C addresses to scan */
 static unsigned short normal_i2c[] = { 0x2d, I2C_CLIENT_END };
 
-/* ISA addresses to scan (none) */
-static unsigned int normal_isa[] = { I2C_CLIENT_ISA_END };
-
 /* Insmod parameters */
 SENSORS_INSMOD_1(asb100);
 I2C_CLIENT_MODULE_PARM(force_subclients, "List of subclient addresses: "
--- linux-2.6.13-rc3.orig/drivers/hwmon/atxp1.c	2005-07-16 09:53:18.000000000 +0200
+++ linux-2.6.13-rc3/drivers/hwmon/atxp1.c	2005-07-17 15:12:41.000000000 +0200
@@ -42,7 +42,6 @@
 #define ATXP1_GPIO1MASK	0x0f
 
 static unsigned short normal_i2c[] = { 0x37, 0x4e, I2C_CLIENT_END };
-static unsigned int normal_isa[] = { I2C_CLIENT_ISA_END };
 
 SENSORS_INSMOD_1(atxp1);
 
--- linux-2.6.13-rc3.orig/drivers/hwmon/ds1621.c	2005-07-16 09:53:09.000000000 +0200
+++ linux-2.6.13-rc3/drivers/hwmon/ds1621.c	2005-07-17 15:12:29.000000000 +0200
@@ -34,7 +34,6 @@
 /* Addresses to scan */
 static unsigned short normal_i2c[] = { 0x48, 0x49, 0x4a, 0x4b, 0x4c,
 					0x4d, 0x4e, 0x4f, I2C_CLIENT_END };
-static unsigned int normal_isa[] = { I2C_CLIENT_ISA_END };
 
 /* Insmod parameters */
 SENSORS_INSMOD_1(ds1621);
--- linux-2.6.13-rc3.orig/drivers/hwmon/fscher.c	2005-07-16 09:53:09.000000000 +0200
+++ linux-2.6.13-rc3/drivers/hwmon/fscher.c	2005-07-17 15:12:24.000000000 +0200
@@ -40,7 +40,6 @@
  */
 
 static unsigned short normal_i2c[] = { 0x73, I2C_CLIENT_END };
-static unsigned int normal_isa[] = { I2C_CLIENT_ISA_END };
 
 /*
  * Insmod parameters
--- linux-2.6.13-rc3.orig/drivers/hwmon/fscpos.c	2005-07-16 09:53:18.000000000 +0200
+++ linux-2.6.13-rc3/drivers/hwmon/fscpos.c	2005-07-17 15:12:19.000000000 +0200
@@ -43,7 +43,6 @@
  * Addresses to scan
  */
 static unsigned short normal_i2c[] = { 0x73, I2C_CLIENT_END };
-static unsigned int normal_isa[] = { I2C_CLIENT_ISA_END };
 
 /*
  * Insmod parameters
--- linux-2.6.13-rc3.orig/drivers/hwmon/gl518sm.c	2005-07-16 09:53:09.000000000 +0200
+++ linux-2.6.13-rc3/drivers/hwmon/gl518sm.c	2005-07-17 15:12:14.000000000 +0200
@@ -47,7 +47,6 @@
 
 /* Addresses to scan */
 static unsigned short normal_i2c[] = { 0x2c, 0x2d, I2C_CLIENT_END };
-static unsigned int normal_isa[] = { I2C_CLIENT_ISA_END };
 
 /* Insmod parameters */
 SENSORS_INSMOD_2(gl518sm_r00, gl518sm_r80);
--- linux-2.6.13-rc3.orig/drivers/hwmon/gl520sm.c	2005-07-16 09:53:18.000000000 +0200
+++ linux-2.6.13-rc3/drivers/hwmon/gl520sm.c	2005-07-17 15:12:08.000000000 +0200
@@ -38,7 +38,6 @@
 
 /* Addresses to scan */
 static unsigned short normal_i2c[] = { 0x2c, 0x2d, I2C_CLIENT_END };
-static unsigned int normal_isa[] = { I2C_CLIENT_ISA_END };
 
 /* Insmod parameters */
 SENSORS_INSMOD_1(gl520sm);
--- linux-2.6.13-rc3.orig/drivers/hwmon/it87.c	2005-07-17 13:56:38.000000000 +0200
+++ linux-2.6.13-rc3/drivers/hwmon/it87.c	2005-07-17 15:12:04.000000000 +0200
@@ -48,7 +48,6 @@
 /* Addresses to scan */
 static unsigned short normal_i2c[] = { 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d,
 					0x2e, 0x2f, I2C_CLIENT_END };
-static unsigned int normal_isa[] = { I2C_CLIENT_ISA_END };
 static unsigned short isa_address = 0x290;
 
 /* Insmod parameters */
--- linux-2.6.13-rc3.orig/drivers/hwmon/lm63.c	2005-07-16 09:53:09.000000000 +0200
+++ linux-2.6.13-rc3/drivers/hwmon/lm63.c	2005-07-17 15:11:56.000000000 +0200
@@ -53,7 +53,6 @@
  */
 
 static unsigned short normal_i2c[] = { 0x4c, I2C_CLIENT_END };
-static unsigned int normal_isa[] = { I2C_CLIENT_ISA_END };
 
 /*
  * Insmod parameters
--- linux-2.6.13-rc3.orig/drivers/hwmon/lm75.c	2005-07-16 17:35:18.000000000 +0200
+++ linux-2.6.13-rc3/drivers/hwmon/lm75.c	2005-07-17 16:40:39.000000000 +0200
@@ -32,7 +32,6 @@
 /* Addresses to scan */
 static unsigned short normal_i2c[] = { 0x48, 0x49, 0x4a, 0x4b, 0x4c,
 					0x4d, 0x4e, 0x4f, I2C_CLIENT_END };
-static unsigned int normal_isa[] = { I2C_CLIENT_ISA_END };
 
 /* Insmod parameters */
 SENSORS_INSMOD_1(lm75);
--- linux-2.6.13-rc3.orig/drivers/hwmon/lm77.c	2005-07-16 09:53:09.000000000 +0200
+++ linux-2.6.13-rc3/drivers/hwmon/lm77.c	2005-07-17 15:11:48.000000000 +0200
@@ -36,7 +36,6 @@
 
 /* Addresses to scan */
 static unsigned short normal_i2c[] = { 0x48, 0x49, 0x4a, 0x4b, I2C_CLIENT_END };
-static unsigned int normal_isa[] = { I2C_CLIENT_ISA_END };
 
 /* Insmod parameters */
 SENSORS_INSMOD_1(lm77);
--- linux-2.6.13-rc3.orig/drivers/hwmon/lm78.c	2005-07-17 09:28:50.000000000 +0200
+++ linux-2.6.13-rc3/drivers/hwmon/lm78.c	2005-07-17 15:11:42.000000000 +0200
@@ -34,7 +34,6 @@
 					0x25, 0x26, 0x27, 0x28, 0x29,
 					0x2a, 0x2b, 0x2c, 0x2d, 0x2e,
 					0x2f, I2C_CLIENT_END };
-static unsigned int normal_isa[] = { I2C_CLIENT_ISA_END };
 static unsigned short isa_address = 0x290;
 
 /* Insmod parameters */
--- linux-2.6.13-rc3.orig/drivers/hwmon/lm80.c	2005-07-16 09:53:09.000000000 +0200
+++ linux-2.6.13-rc3/drivers/hwmon/lm80.c	2005-07-17 15:11:36.000000000 +0200
@@ -33,7 +33,6 @@
 /* Addresses to scan */
 static unsigned short normal_i2c[] = { 0x28, 0x29, 0x2a, 0x2b, 0x2c,
 					0x2d, 0x2e, 0x2f, I2C_CLIENT_END };
-static unsigned int normal_isa[] = { I2C_CLIENT_ISA_END };
 
 /* Insmod parameters */
 SENSORS_INSMOD_1(lm80);
--- linux-2.6.13-rc3.orig/drivers/hwmon/lm83.c	2005-07-16 09:53:09.000000000 +0200
+++ linux-2.6.13-rc3/drivers/hwmon/lm83.c	2005-07-17 15:11:32.000000000 +0200
@@ -47,7 +47,6 @@
 					0x29, 0x2a, 0x2b,
 					0x4c, 0x4d, 0x4e,
 					I2C_CLIENT_END };
-static unsigned int normal_isa[] = { I2C_CLIENT_ISA_END };
 
 /*
  * Insmod parameters
--- linux-2.6.13-rc3.orig/drivers/hwmon/lm85.c	2005-07-16 09:53:09.000000000 +0200
+++ linux-2.6.13-rc3/drivers/hwmon/lm85.c	2005-07-17 16:40:39.000000000 +0200
@@ -35,7 +35,6 @@
 
 /* Addresses to scan */
 static unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, I2C_CLIENT_END };
-static unsigned int normal_isa[] = { I2C_CLIENT_ISA_END };
 
 /* Insmod parameters */
 SENSORS_INSMOD_6(lm85b, lm85c, adm1027, adt7463, emc6d100, emc6d102);
--- linux-2.6.13-rc3.orig/drivers/hwmon/lm87.c	2005-07-16 09:53:09.000000000 +0200
+++ linux-2.6.13-rc3/drivers/hwmon/lm87.c	2005-07-17 15:11:00.000000000 +0200
@@ -68,7 +68,6 @@
  */
 
 static unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, I2C_CLIENT_END };
-static unsigned int normal_isa[] = { I2C_CLIENT_ISA_END };
 
 /*
  * Insmod parameters
--- linux-2.6.13-rc3.orig/drivers/hwmon/lm90.c	2005-07-16 09:53:09.000000000 +0200
+++ linux-2.6.13-rc3/drivers/hwmon/lm90.c	2005-07-17 15:10:53.000000000 +0200
@@ -91,7 +91,6 @@
  */
 
 static unsigned short normal_i2c[] = { 0x4c, 0x4d, I2C_CLIENT_END };
-static unsigned int normal_isa[] = { I2C_CLIENT_ISA_END };
 
 /*
  * Insmod parameters
--- linux-2.6.13-rc3.orig/drivers/hwmon/lm92.c	2005-07-16 09:53:09.000000000 +0200
+++ linux-2.6.13-rc3/drivers/hwmon/lm92.c	2005-07-17 15:10:47.000000000 +0200
@@ -52,7 +52,6 @@
    resulting in 4 possible addresses. */
 static unsigned short normal_i2c[] = { 0x48, 0x49, 0x4a, 0x4b,
 				       I2C_CLIENT_END };
-static unsigned int normal_isa[] = { I2C_CLIENT_ISA_END };
 
 /* Insmod parameters */
 SENSORS_INSMOD_1(lm92);
--- linux-2.6.13-rc3.orig/drivers/hwmon/max1619.c	2005-07-16 09:53:15.000000000 +0200
+++ linux-2.6.13-rc3/drivers/hwmon/max1619.c	2005-07-17 15:10:42.000000000 +0200
@@ -39,7 +39,6 @@
 					0x29, 0x2a, 0x2b,
 					0x4c, 0x4d, 0x4e,
 					I2C_CLIENT_END };
-static unsigned int normal_isa[] = { I2C_CLIENT_ISA_END };
 
 /*
  * Insmod parameters
--- linux-2.6.13-rc3.orig/drivers/hwmon/w83781d.c	2005-07-17 09:36:20.000000000 +0200
+++ linux-2.6.13-rc3/drivers/hwmon/w83781d.c	2005-07-17 15:10:38.000000000 +0200
@@ -50,7 +50,6 @@
 static unsigned short normal_i2c[] = { 0x20, 0x21, 0x22, 0x23, 0x24, 0x25,
 					0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b,
 					0x2c, 0x2d, 0x2e, 0x2f, I2C_CLIENT_END };
-static unsigned int normal_isa[] = { I2C_CLIENT_ISA_END };
 static unsigned short isa_address = 0x290;
 
 /* Insmod parameters */
--- linux-2.6.13-rc3.orig/drivers/hwmon/w83l785ts.c	2005-07-16 09:53:09.000000000 +0200
+++ linux-2.6.13-rc3/drivers/hwmon/w83l785ts.c	2005-07-17 15:09:57.000000000 +0200
@@ -49,7 +49,6 @@
  */
 
 static unsigned short normal_i2c[] = { 0x2e, I2C_CLIENT_END };
-static unsigned int normal_isa[] = { I2C_CLIENT_ISA_END };
 
 /*
  * Insmod parameters
--- linux-2.6.13-rc3.orig/drivers/i2c/chips/ds1337.c	2005-07-13 23:34:12.000000000 +0200
+++ linux-2.6.13-rc3/drivers/i2c/chips/ds1337.c	2005-07-17 15:09:21.000000000 +0200
@@ -39,7 +39,6 @@
  * Functions declaration
  */
 static unsigned short normal_i2c[] = { 0x68, I2C_CLIENT_END };
-static unsigned int normal_isa[] = { I2C_CLIENT_ISA_END };
 
 SENSORS_INSMOD_1(ds1337);
 
--- linux-2.6.13-rc3.orig/drivers/i2c/chips/eeprom.c	2005-07-13 23:34:12.000000000 +0200
+++ linux-2.6.13-rc3/drivers/i2c/chips/eeprom.c	2005-07-17 15:09:16.000000000 +0200
@@ -38,7 +38,6 @@
 /* Addresses to scan */
 static unsigned short normal_i2c[] = { 0x50, 0x51, 0x52, 0x53, 0x54,
 					0x55, 0x56, 0x57, I2C_CLIENT_END };
-static unsigned int normal_isa[] = { I2C_CLIENT_ISA_END };
 
 /* Insmod parameters */
 SENSORS_INSMOD_1(eeprom);
--- linux-2.6.13-rc3.orig/drivers/i2c/chips/max6875.c	2005-07-13 23:34:12.000000000 +0200
+++ linux-2.6.13-rc3/drivers/i2c/chips/max6875.c	2005-07-17 15:09:11.000000000 +0200
@@ -39,7 +39,6 @@
 /* Addresses to scan */
 /* No address scanned by default, as this could corrupt standard EEPROMS. */
 static unsigned short normal_i2c[] = {I2C_CLIENT_END};
-static unsigned int normal_isa[] = {I2C_CLIENT_ISA_END};
 
 /* Insmod parameters */
 SENSORS_INSMOD_1(max6875);
--- linux-2.6.13-rc3.orig/drivers/i2c/chips/pca9539.c	2005-07-13 23:34:12.000000000 +0200
+++ linux-2.6.13-rc3/drivers/i2c/chips/pca9539.c	2005-07-17 15:09:00.000000000 +0200
@@ -17,7 +17,6 @@
 
 /* Addresses to scan */
 static unsigned short normal_i2c[] = {0x74, 0x75, 0x76, 0x77, I2C_CLIENT_END};
-static unsigned int normal_isa[] = {I2C_CLIENT_ISA_END};
 
 /* Insmod parameters */
 SENSORS_INSMOD_1(pca9539);
--- linux-2.6.13-rc3.orig/drivers/i2c/chips/pcf8574.c	2005-07-13 23:34:12.000000000 +0200
+++ linux-2.6.13-rc3/drivers/i2c/chips/pcf8574.c	2005-07-17 15:08:55.000000000 +0200
@@ -45,7 +45,6 @@
 static unsigned short normal_i2c[] = { 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27,
 					0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
 					I2C_CLIENT_END };
-static unsigned int normal_isa[] = { I2C_CLIENT_ISA_END };
 
 /* Insmod parameters */
 SENSORS_INSMOD_2(pcf8574, pcf8574a);
--- linux-2.6.13-rc3.orig/drivers/i2c/chips/pcf8591.c	2005-07-13 23:34:12.000000000 +0200
+++ linux-2.6.13-rc3/drivers/i2c/chips/pcf8591.c	2005-07-17 15:08:47.000000000 +0200
@@ -29,7 +29,6 @@
 /* Addresses to scan */
 static unsigned short normal_i2c[] = { 0x48, 0x49, 0x4a, 0x4b, 0x4c,
 					0x4d, 0x4e, 0x4f, I2C_CLIENT_END };
-static unsigned int normal_isa[] = { I2C_CLIENT_ISA_END };
 
 /* Insmod parameters */
 SENSORS_INSMOD_1(pcf8591);
--- linux-2.6.13-rc3.orig/include/linux/i2c-sensor.h	2004-12-24 22:34:58.000000000 +0100
+++ linux-2.6.13-rc3/include/linux/i2c-sensor.h	2005-07-17 16:42:39.000000000 +0200
@@ -27,11 +27,10 @@
    that place. If a specific chip is given, the module blindly assumes this
    chip type is present; if a general force (kind == 0) is given, the module
    will still try to figure out what type of chip is present. This is useful
-   if for some reasons the detect for SMBus or ISA address space filled
-   fails.
-   probe: insmod parameter. Initialize this list with I2C_CLIENT_ISA_END values.
-     A list of pairs. The first value is a bus number (ANY_I2C_ISA_BUS for
-     the ISA bus, -1 for any I2C bus), the second is the address. 
+   if for some reasons the detect for SMBus address space filled fails.
+   probe: insmod parameter. Initialize this list with I2C_CLIENT_END values.
+     A list of pairs. The first value is a bus number (ANY_I2C_BUS for any
+     I2C bus), the second is the address.
    kind: The kind of chip. 0 equals any chip.
 */
 struct i2c_force_data {
@@ -40,25 +39,22 @@
 };
 
 /* A structure containing the detect information.
-   normal_i2c: filled in by the module writer. Terminated by I2C_CLIENT_ISA_END.
+   normal_i2c: filled in by the module writer. Terminated by I2C_CLIENT_END.
      A list of I2C addresses which should normally be examined.
-   normal_isa: filled in by the module writer. Terminated by SENSORS_ISA_END.
-     A list of ISA addresses which should normally be examined.
-   probe: insmod parameter. Initialize this list with I2C_CLIENT_ISA_END values.
-     A list of pairs. The first value is a bus number (ANY_I2C_ISA_BUS for
-     the ISA bus, -1 for any I2C bus), the second is the address. These
-     addresses are also probed, as if they were in the 'normal' list.
-   ignore: insmod parameter. Initialize this list with I2C_CLIENT_ISA_END values.
-     A list of pairs. The first value is a bus number (ANY_I2C_ISA_BUS for
-     the ISA bus, -1 for any I2C bus), the second is the I2C address. These
-     addresses are never probed. This parameter overrules 'normal' and 
-     'probe', but not the 'force' lists.
+   probe: insmod parameter. Initialize this list with I2C_CLIENT_END values.
+     A list of pairs. The first value is a bus number (ANY_I2C_BUS for any
+     I2C bus), the second is the address. These addresses are also probed,
+     as if they were in the 'normal' list.
+   ignore: insmod parameter. Initialize this list with I2C_CLIENT_END values.
+     A list of pairs. The first value is a bus number (ANY_I2C_BUS for any
+     I2C bus), the second is the I2C address. These addresses are never
+     probed. This parameter overrules 'normal' and  probe', but not the
+    'force' lists.
    force_data: insmod parameters. A list, ending with an element of which
      the force field is NULL.
 */
 struct i2c_address_data {
 	unsigned short *normal_i2c;
-	unsigned int *normal_isa;
 	unsigned short *probe;
 	unsigned short *ignore;
 	struct i2c_force_data *forces;
@@ -78,7 +74,6 @@
                       "List of adapter,address pairs not to scan"); \
 	static struct i2c_address_data addr_data = {			\
 			.normal_i2c =		normal_i2c,		\
-			.normal_isa =		normal_isa,		\
 			.probe =		probe,			\
 			.ignore =		ignore,			\
 			.forces =		forces,			\
@@ -242,8 +237,7 @@
 
 /* Detect function. It iterates over all possible addresses itself. For
    SMBus addresses, it will only call found_proc if some client is connected
-   to the SMBus (unless a 'force' matched); for ISA detections, this is not
-   done. */
+   to the SMBus (unless a 'force' matched). */
 extern int i2c_detect(struct i2c_adapter *adapter,
 		      struct i2c_address_data *address_data,
 		      int (*found_proc) (struct i2c_adapter *, int, int));
--- linux-2.6.13-rc3.orig/include/linux/i2c.h	2005-07-16 18:34:02.000000000 +0200
+++ linux-2.6.13-rc3/include/linux/i2c.h	2005-07-17 15:26:30.000000000 +0200
@@ -150,12 +150,9 @@
  */
 struct i2c_client {
 	unsigned int flags;		/* div., see below		*/
-	unsigned int addr;		/* chip address - NOTE: 7bit 	*/
+	unsigned short addr;		/* chip address - NOTE: 7bit 	*/
 					/* addresses are stored in the	*/
-					/* _LOWER_ 7 bits of this char	*/
-	/* addr: unsigned int to make lm_sensors i2c-isa adapter work
-	  more cleanly. It does not take any more memory space, due to
-	  alignment considerations */
+					/* _LOWER_ 7 bits		*/
 	struct i2c_adapter *adapter;	/* the adapter we sit on	*/
 	struct i2c_driver *driver;	/* and our access routines	*/
 	int usage_count;		/* How many accesses currently  */
@@ -304,7 +301,6 @@
 
 /* Internal numbers to terminate lists */
 #define I2C_CLIENT_END		0xfffeU
-#define I2C_CLIENT_ISA_END	0xfffefffeU
 
 /* The numbers to use to set I2C bus address */
 #define ANY_I2C_BUS		0xffff
--- linux-2.6.13-rc3.orig/Documentation/i2c/porting-clients	2005-07-13 23:34:03.000000000 +0200
+++ linux-2.6.13-rc3/Documentation/i2c/porting-clients	2005-07-17 16:42:15.000000000 +0200
@@ -29,8 +29,8 @@
   Please respect this inclusion order. Some extra headers may be
   required for a given driver (e.g. "lm75.h").
 
-* [Addresses] SENSORS_I2C_END becomes I2C_CLIENT_END, SENSORS_ISA_END
-  becomes I2C_CLIENT_ISA_END.
+* [Addresses] SENSORS_I2C_END becomes I2C_CLIENT_END, ISA addresses
+  are no more handled by the i2c core.
 
 * [Client data] Get rid of sysctl_id. Try using standard names for
   register values (for example, temp_os becomes temp_max). You're
@@ -72,7 +72,8 @@
   name string, which will be filled with a lowercase, short string
   (typically the driver name, e.g. "lm75").
   In i2c-only drivers, drop the i2c_is_isa_adapter check, it's
-  useless.
+  useless. Same for isa-only drivers, as the test would always be
+  true. Only hybrid drivers (which are quite rare) still need it.
   The errorN labels are reduced to the number needed. If that number
   is 2 (i2c-only drivers), it is advised that the labels are named
   exit and exit_free. For i2c+isa drivers, labels should be named


-- 
Jean Delvare

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH 2.6] I2C: Separate non-i2c hwmon drivers from i2c-core (8/9)
  2005-07-19 21:39 [PATCH 2.6] I2C: Separate non-i2c hwmon drivers from i2c-core (0/9) Jean Delvare
                   ` (6 preceding siblings ...)
  2005-07-19 22:02 ` [PATCH 2.6] I2C: Separate non-i2c hwmon drivers from i2c-core (7/9) Jean Delvare
@ 2005-07-19 22:05 ` Jean Delvare
  2005-07-26 22:33   ` patch i2c-hwmon-split-08.patch added to gregkh-2.6 tree gregkh
  2005-07-19 22:09 ` [PATCH 2.6] I2C: Separate non-i2c hwmon drivers from i2c-core (9/9) Jean Delvare
  8 siblings, 1 reply; 21+ messages in thread
From: Jean Delvare @ 2005-07-19 22:05 UTC (permalink / raw)
  To: LKML, LM Sensors; +Cc: Greg KH

Kill all uses of i2c_is_isa_adapter except for the hybrid drivers (it87,
lm78, w83781d). The i2c-isa adapter not being registered with the i2c
core anymore, drivers don't have to fear being erroneously attached to
it.

 Documentation/i2c/writing-clients |   11 +++++------
 drivers/hwmon/adm1021.c           |    9 ---------
 drivers/hwmon/asb100.c            |    8 --------
 drivers/hwmon/lm75.c              |   10 ----------
 drivers/hwmon/lm85.c              |    5 -----
 5 files changed, 5 insertions(+), 38 deletions(-)

--- linux-2.6.13-rc3.orig/Documentation/i2c/writing-clients	2005-07-17 15:20:30.000000000 +0200
+++ linux-2.6.13-rc3/Documentation/i2c/writing-clients	2005-07-17 15:45:47.000000000 +0200
@@ -315,11 +315,10 @@
     const char *type_name = "";
     int is_isa = i2c_is_isa_adapter(adapter);
 
-    if (is_isa) {
+    /* Do this only if the chip can additionally be found on the ISA bus
+       (hybrid chip). */
 
-      /* If this client can't be on the ISA bus at all, we can stop now
-         (call `goto ERROR0'). But for kicks, we will assume it is all
-         right. */
+    if (is_isa) {
 
       /* Discard immediately if this ISA range is already used */
       if (check_region(address,FOO_EXTENT))
@@ -495,10 +494,10 @@
       return err;
     }
 
-    /* SENSORS ONLY START */
+    /* HYBRID SENSORS CHIP ONLY START */
     if i2c_is_isa_client(client)
       release_region(client->addr,LM78_EXTENT);
-    /* SENSORS ONLY END */
+    /* HYBRID SENSORS CHIP ONLY END */
 
     kfree(client); /* Frees client data too, if allocated at the same time */
     return 0;
--- linux-2.6.13-rc3.orig/drivers/hwmon/adm1021.c	2005-07-17 15:13:16.000000000 +0200
+++ linux-2.6.13-rc3/drivers/hwmon/adm1021.c	2005-07-17 16:06:34.000000000 +0200
@@ -198,15 +198,6 @@
 	int err = 0;
 	const char *type_name = "";
 
-	/* Make sure we aren't probing the ISA bus!! This is just a safety check
-	   at this moment; i2c_detect really won't call us. */
-#ifdef DEBUG
-	if (i2c_is_isa_adapter(adapter)) {
-		dev_dbg(&adapter->dev, "adm1021_detect called for an ISA bus adapter?!?\n");
-		return 0;
-	}
-#endif
-
 	if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA))
 		goto error0;
 
--- linux-2.6.13-rc3.orig/drivers/hwmon/asb100.c	2005-07-17 15:12:52.000000000 +0200
+++ linux-2.6.13-rc3/drivers/hwmon/asb100.c	2005-07-17 16:06:23.000000000 +0200
@@ -714,14 +714,6 @@
 	struct i2c_client *new_client;
 	struct asb100_data *data;
 
-	/* asb100 is SMBus only */
-	if (i2c_is_isa_adapter(adapter)) {
-		pr_debug("asb100.o: detect failed, "
-				"cannot attach to legacy adapter!\n");
-		err = -ENODEV;
-		goto ERROR0;
-	}
-
 	if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) {
 		pr_debug("asb100.o: detect failed, "
 				"smbus byte data not supported!\n");
--- linux-2.6.13-rc3.orig/drivers/hwmon/lm75.c	2005-07-17 15:11:52.000000000 +0200
+++ linux-2.6.13-rc3/drivers/hwmon/lm75.c	2005-07-17 16:05:51.000000000 +0200
@@ -121,16 +121,6 @@
 	int err = 0;
 	const char *name = "";
 
-	/* Make sure we aren't probing the ISA bus!! This is just a safety check
-	   at this moment; i2c_detect really won't call us. */
-#ifdef DEBUG
-	if (i2c_is_isa_adapter(adapter)) {
-		dev_dbg(&adapter->dev,
-			"lm75_detect called for an ISA bus adapter?!?\n");
-		goto exit;
-	}
-#endif
-
 	if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA |
 				     I2C_FUNC_SMBUS_WORD_DATA))
 		goto exit;
--- linux-2.6.13-rc3.orig/drivers/hwmon/lm85.c	2005-07-17 15:11:12.000000000 +0200
+++ linux-2.6.13-rc3/drivers/hwmon/lm85.c	2005-07-17 16:05:43.000000000 +0200
@@ -1033,11 +1033,6 @@
 	int err = 0;
 	const char *type_name = "";
 
-	if (i2c_is_isa_adapter(adapter)) {
-		/* This chip has no ISA interface */
-		goto ERROR0 ;
-	};
-
 	if (!i2c_check_functionality(adapter,
 					I2C_FUNC_SMBUS_BYTE_DATA)) {
 		/* We need to be able to do byte I/O */


-- 
Jean Delvare

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH 2.6] I2C: Separate non-i2c hwmon drivers from i2c-core (9/9)
  2005-07-19 21:39 [PATCH 2.6] I2C: Separate non-i2c hwmon drivers from i2c-core (0/9) Jean Delvare
                   ` (7 preceding siblings ...)
  2005-07-19 22:05 ` [PATCH 2.6] I2C: Separate non-i2c hwmon drivers from i2c-core (8/9) Jean Delvare
@ 2005-07-19 22:09 ` Jean Delvare
  2005-07-26 22:33   ` patch i2c-hwmon-split-09.patch added to gregkh-2.6 tree gregkh
  8 siblings, 1 reply; 21+ messages in thread
From: Jean Delvare @ 2005-07-19 22:09 UTC (permalink / raw)
  To: LKML, LM Sensors; +Cc: Greg KH

Move the definitions of i2c_is_isa_client and i2c_is_isa_adapter from
i2c.h to i2c-isa.h. Only hybrid drivers still need them.

 include/linux/i2c-isa.h |    7 +++++++
 include/linux/i2c.h     |    7 -------
 2 files changed, 7 insertions(+), 7 deletions(-)

--- linux-2.6.13-rc3.orig/include/linux/i2c-isa.h	2005-07-16 18:46:37.000000000 +0200
+++ linux-2.6.13-rc3/include/linux/i2c-isa.h	2005-07-17 16:45:22.000000000 +0200
@@ -26,4 +26,11 @@
 extern int i2c_isa_add_driver(struct i2c_driver *driver);
 extern int i2c_isa_del_driver(struct i2c_driver *driver);
 
+/* Detect whether we are on the isa bus. This is only useful to hybrid
+   (i2c+isa) drivers. */
+#define i2c_is_isa_client(clientptr) \
+        ((clientptr)->adapter->algo->id == I2C_ALGO_ISA)
+#define i2c_is_isa_adapter(adapptr) \
+        ((adapptr)->algo->id == I2C_ALGO_ISA)
+
 #endif /* _LINUX_I2C_ISA_H */
--- linux-2.6.13-rc3.orig/include/linux/i2c.h	2005-07-17 15:26:30.000000000 +0200
+++ linux-2.6.13-rc3/include/linux/i2c.h	2005-07-17 16:44:40.000000000 +0200
@@ -575,11 +575,4 @@
 			.force =		force,			\
 		}
 
-/* Detect whether we are on the isa bus. If this returns true, all i2c
-   access will fail! */
-#define i2c_is_isa_client(clientptr) \
-        ((clientptr)->adapter->algo->id == I2C_ALGO_ISA)
-#define i2c_is_isa_adapter(adapptr) \
-        ((adapptr)->algo->id == I2C_ALGO_ISA)
-
 #endif /* _LINUX_I2C_H */


-- 
Jean Delvare

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 2.6] I2C: Separate non-i2c hwmon drivers from i2c-core (1/9)
  2005-07-19 21:45 ` [PATCH 2.6] I2C: Separate non-i2c hwmon drivers from i2c-core (1/9) Jean Delvare
@ 2005-07-20  4:26   ` Greg KH
  2005-07-20 21:03     ` Jean Delvare
  0 siblings, 1 reply; 21+ messages in thread
From: Greg KH @ 2005-07-20  4:26 UTC (permalink / raw)
  To: Jean Delvare; +Cc: LKML, LM Sensors

On Tue, Jul 19, 2005 at 11:45:40PM +0200, Jean Delvare wrote:
> +/* Next four are needed by i2c-isa */
> +EXPORT_SYMBOL(i2c_adapter_dev_release);
> +EXPORT_SYMBOL(i2c_adapter_driver);
> +EXPORT_SYMBOL(i2c_adapter_class);
> +EXPORT_SYMBOL(i2c_bus_type);

EXPORT_SYMBOL_GPL() instead?  As these were, core, GPL only symbols
before you exported them.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 2.6] I2C: Separate non-i2c hwmon drivers from i2c-core (2/9)
  2005-07-19 21:48 ` [PATCH 2.6] I2C: Separate non-i2c hwmon drivers from i2c-core (2/9) Jean Delvare
@ 2005-07-20  4:27   ` Greg KH
  2005-07-20 21:46     ` Jean Delvare
  0 siblings, 1 reply; 21+ messages in thread
From: Greg KH @ 2005-07-20  4:27 UTC (permalink / raw)
  To: Jean Delvare; +Cc: LKML, LM Sensors

On Tue, Jul 19, 2005 at 11:48:43PM +0200, Jean Delvare wrote:
> Convert i2c-isa from a dumb i2c_adapter into a pseudo i2c-core for ISA
> hardware monitoring drivers. The isa i2c_adapter is no more registered
> with i2c-core, drivers have to explicitely connect to it using the new
> i2c_isa_{add,del}_driver interface.

Ick, when I did this originally it was a hack, and it's still a hack.
It's sad to see it spreading around, but that's proably my fault...

Anyway, what are your plans for after this?  How long will this code
stay around?  What do you want to do next?

I don't have any real objections to this patch series at all, just very
curious as to your proposed roadmap after this.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 2.6] I2C: Separate non-i2c hwmon drivers from i2c-core (1/9)
  2005-07-20  4:26   ` Greg KH
@ 2005-07-20 21:03     ` Jean Delvare
  0 siblings, 0 replies; 21+ messages in thread
From: Jean Delvare @ 2005-07-20 21:03 UTC (permalink / raw)
  To: Greg KH; +Cc: LKML, LM Sensors

Hi Greg,

> > +/* Next four are needed by i2c-isa */
> > +EXPORT_SYMBOL(i2c_adapter_dev_release);
> > +EXPORT_SYMBOL(i2c_adapter_driver);
> > +EXPORT_SYMBOL(i2c_adapter_class);
> > +EXPORT_SYMBOL(i2c_bus_type);
> 
> EXPORT_SYMBOL_GPL() instead?  As these were, core, GPL only symbols
> before you exported them.

Sure, no problem. I would even use EXPORT_SYMBOL_I2C_ISA_ONLY() if it
happened to exist ;)

Updated patch follows, thanks.

Temporarily export a few structures and functions from i2c-core, because we
will soon need them in i2c-isa.

Signed-off-by: Jean Delvare <khali@linux-fr.org>

 drivers/i2c/i2c-core.c |   14 ++++++++++----
 include/linux/i2c.h    |    7 +++++++
 2 files changed, 17 insertions(+), 4 deletions(-)

--- linux-2.6.13-rc3.orig/drivers/i2c/i2c-core.c	2005-07-17 20:15:52.000000000 +0200
+++ linux-2.6.13-rc3/drivers/i2c/i2c-core.c	2005-07-20 18:19:46.000000000 +0200
@@ -61,7 +61,7 @@
 	return rc;
 }
 
-static struct bus_type i2c_bus_type = {
+struct bus_type i2c_bus_type = {
 	.name =		"i2c",
 	.match =	i2c_device_match,
 	.suspend =      i2c_bus_suspend,
@@ -78,13 +78,13 @@
 	return 0;
 }
 
-static void i2c_adapter_dev_release(struct device *dev)
+void i2c_adapter_dev_release(struct device *dev)
 {
 	struct i2c_adapter *adap = dev_to_i2c_adapter(dev);
 	complete(&adap->dev_released);
 }
 
-static struct device_driver i2c_adapter_driver = {
+struct device_driver i2c_adapter_driver = {
 	.name =	"i2c_adapter",
 	.bus = &i2c_bus_type,
 	.probe = i2c_device_probe,
@@ -97,7 +97,7 @@
 	complete(&adap->class_dev_released);
 }
 
-static struct class i2c_adapter_class = {
+struct class i2c_adapter_class = {
 	.name =		"i2c-adapter",
 	.release =	&i2c_adapter_class_dev_release,
 };
@@ -1171,6 +1171,12 @@
 }
 
 
+/* Next four are needed by i2c-isa */
+EXPORT_SYMBOL_GPL(i2c_adapter_dev_release);
+EXPORT_SYMBOL_GPL(i2c_adapter_driver);
+EXPORT_SYMBOL_GPL(i2c_adapter_class);
+EXPORT_SYMBOL_GPL(i2c_bus_type);
+
 EXPORT_SYMBOL(i2c_add_adapter);
 EXPORT_SYMBOL(i2c_del_adapter);
 EXPORT_SYMBOL(i2c_add_driver);
--- linux-2.6.13-rc3.orig/include/linux/i2c.h	2005-07-17 20:15:52.000000000 +0200
+++ linux-2.6.13-rc3/include/linux/i2c.h	2005-07-20 18:19:01.000000000 +0200
@@ -34,6 +34,13 @@
 #include <linux/device.h>	/* for struct device */
 #include <asm/semaphore.h>
 
+/* --- For i2c-isa ---------------------------------------------------- */
+
+extern void i2c_adapter_dev_release(struct device *dev);
+extern struct device_driver i2c_adapter_driver;
+extern struct class i2c_adapter_class;
+extern struct bus_type i2c_bus_type;
+
 /* --- General options ------------------------------------------------	*/
 
 struct i2c_msg;


-- 
Jean Delvare

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 2.6] I2C: Separate non-i2c hwmon drivers from i2c-core (2/9)
  2005-07-20  4:27   ` Greg KH
@ 2005-07-20 21:46     ` Jean Delvare
  2005-07-25  0:35       ` Greg KH
  0 siblings, 1 reply; 21+ messages in thread
From: Jean Delvare @ 2005-07-20 21:46 UTC (permalink / raw)
  To: Greg KH; +Cc: LKML, LM Sensors

Hi Greg,

> > Convert i2c-isa from a dumb i2c_adapter into a pseudo i2c-core for
> > ISA hardware monitoring drivers. The isa i2c_adapter is no more
> > registered with i2c-core, drivers have to explicitely connect to it
> > using the new i2c_isa_{add,del}_driver interface.
> 
> Ick, when I did this originally it was a hack, and it's still a hack.
> It's sad to see it spreading around, but that's proably my fault...

I didn't know that, I'm sorry. As I don't really know how the driver
core works, I just copied from the nearest working driver, which
happened to be i2c-core. If this isn't good and you want me to do it
differently, just tell me how and I'll tackle this. Actually it might be
more important for i2c-core than i2c-isa, as i2c-isa will die in the
long run.

> Anyway, what are your plans for after this?  How long will this code
> stay around?  What do you want to do next?
> 
> I don't have any real objections to this patch series at all, just
> very curious as to your proposed roadmap after this.

I'm sorry, I thought I had explained it in the first post of the set,
but now I realize that I explained in detail *what* I am doing, not
*why* nor the whole picture.

The whole point is to end with the current state where i2c and hardware
monitoring are the same subsystem. There are more and more non-i2c
hardware monitoring chip, in particular Super-I/O integrated sensors
(IT8712F, W83627HF, PC87366 and all their variants), which have a very
high overhead currently due to being linked to the i2c core for no
reason but historical.

The positive side effect is that there are a few ugly hooks in the
i2c-core (expecially the sensors part) to handle the non-i2c chips, and
we will be able to get rid of them and clean up a few things - as
details in my original post.

The reason why I am going into this now is that a totally different
hardware monitoring driver is in the process of being added to the Linux
kernel: bmcsensors, which is IPMI based. This would be yet another
driver articifially linked to the i2c subsystem, requiring yet other
hooks. So I wanted to clean up the mess first.

Another reason is that I now have a Super-I/O chip with integrated
sensors on one of my systems, as well as a legacy ISA hardware
monitoring chip on another one, so I should be able to test my changes
more efficiently than before in that field (although more hardware would
be even better, as usual).

The major steps in the process are:

1* Define a hardware monitoring class, which all hardware monitoring
drivers would register with. Mark M. Hoffman just did that a few weeks
ago.

2* Separate the non-i2c hardware monitoring drivers from the i2c-core.
This is what I am doing right now.

3* Have the user-space tools (libsensors) search for hardware monitoring
drivers through /sys/class/hwmon rather than (or, for the time being,
additionally to) /sys/bus/i2c. Next on my list.

4* Clean up the i2c core. This isn't directly related, but needs to be
done, and will be much easier now that the isa hooks are gone. This
includes a full rewrite of the way the i2c chip driver module parameters
are handled, and a merge of i2c_probe and i2c_detect, to name only the
two major ones. We might also get rid of some IDs that don't seem to be
strictly needed (in i2c_algorithm and i2c_driver). And maybe split the
SMBus 1 and 2 implementations away from i2c-core, not too sure what it
would take.

5* Really attach the non-i2c drivers to their right location in the
sysfs tree. I don't know exactly where the correct location is, but
we'll have to find. Once the hwmon class is in use, moving the drivers
around in the sysfs tree will not break the user-space compatibility.

Note that 3* depends on 1* and 4* depends on 2*. Also, we will need to
wait some time (6 months? 1 year?) between 3* and 5* so as to not break
user-space compatibility too much. This is the reason why I made 2* and
5* different points even though it would sound saner to do them in a
single step. This approach also lets me parallelize with 4*, which I
want to do now rather than wait for 5* to happen.

So, the approximate timeline would be 1* to 3* right now, 4* after that
as time permits, and 5* when we estimate that 3* happened long enough
ago (roughly 1st half of 2006?)

I hope I explained it correctly this time. If not, just complain ;)

Thanks,
-- 
Jean Delvare

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 2.6] I2C: Separate non-i2c hwmon drivers from i2c-core (2/9)
  2005-07-20 21:46     ` Jean Delvare
@ 2005-07-25  0:35       ` Greg KH
  2005-07-25 17:28         ` Jean Delvare
  0 siblings, 1 reply; 21+ messages in thread
From: Greg KH @ 2005-07-25  0:35 UTC (permalink / raw)
  To: Jean Delvare; +Cc: LKML, LM Sensors

On Wed, Jul 20, 2005 at 11:46:03PM +0200, Jean Delvare wrote:
> 
> So, the approximate timeline would be 1* to 3* right now, 4* after that
> as time permits, and 5* when we estimate that 3* happened long enough
> ago (roughly 1st half of 2006?)
> 
> I hope I explained it correctly this time. If not, just complain ;)

Ah, much better, thanks.  Sounds like a great plan, I'll go apply your
patches in a day or so when I catch up from my travels.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 2.6] I2C: Separate non-i2c hwmon drivers from i2c-core (2/9)
  2005-07-25  0:35       ` Greg KH
@ 2005-07-25 17:28         ` Jean Delvare
  2005-07-26 22:54           ` Greg KH
  0 siblings, 1 reply; 21+ messages in thread
From: Jean Delvare @ 2005-07-25 17:28 UTC (permalink / raw)
  To: Greg KH; +Cc: LKML, LM Sensors

Hi Greg,

> Ah, much better, thanks.  Sounds like a great plan, I'll go apply your
> patches in a day or so when I catch up from my travels.

OK, thanks.

Note that there are a few patches which you should apply before this
series, in particular Mark Hoffman's 3 hwmon class patches. There are no
hard dependencies between both series but applying them in order is
likely to ease your work.

You can take a look at my current stack here for reference:
http://khali.linux-fr.org/devel/i2c/linux-2.6/series

Not everything is i2c or hwmon related, but that should give you an idea
of which order you should apply them in to keep the noise to a minimum
level. There might be a number of individual patches that I did not post
yet, because I was waiting for you to apply Mark's stuff first. Just let
me know when you're done with the hwmon class patches and everything
else you might have on your end, and I'll post all other patches - after
I checked that they properly apply on top of what you have.

Thanks,
-- 
Jean Delvare

^ permalink raw reply	[flat|nested] 21+ messages in thread

* patch i2c-hwmon-split-05.patch added to gregkh-2.6 tree
  2005-07-19 21:56 ` [PATCH 2.6] I2C: Separate non-i2c hwmon drivers from i2c-core (5/9) Jean Delvare
@ 2005-07-26 22:33   ` gregkh
  0 siblings, 0 replies; 21+ messages in thread
From: gregkh @ 2005-07-26 22:33 UTC (permalink / raw)
  To: khali, greg, gregkh, linux-kernel, lm-sensors


This is a note to let you know that I've just added the patch titled

     Subject: I2C: Separate non-i2c hwmon drivers from i2c-core (5/9)

to my gregkh-2.6 tree.  Its filename is

     i2c-hwmon-split-05.patch

This tree can be found at 
    http://www.kernel.org/pub/linux/kernel/people/gregkh/gregkh-2.6/patches/

Patches currently in gregkh-2.6 which might be from khali@linux-fr.org are

i2c/i2c-max6875-documentation-update.patch
i2c/i2c-max6875-simplify.patch
i2c/i2c-hwmon-class-01.patch
i2c/i2c-hwmon-class-02.patch
i2c/i2c-hwmon-class-03.patch
i2c/i2c-missing-space.patch
i2c/i2c-nforce2-cleanup.patch
i2c/i2c-hwmon-split-01.patch
i2c/i2c-hwmon-split-02.patch
i2c/i2c-hwmon-split-03.patch
i2c/i2c-hwmon-split-04.patch
i2c/i2c-hwmon-split-05.patch
i2c/i2c-hwmon-split-06.patch
i2c/i2c-hwmon-split-07.patch
i2c/i2c-hwmon-split-08.patch
i2c/i2c-hwmon-split-09.patch


>From khali@linux-fr.org Tue Jul 19 18:00:07 2005
Date: Tue, 19 Jul 2005 23:56:35 +0200
From: Jean Delvare <khali@linux-fr.org>
To: LKML <linux-kernel@vger.kernel.org>, LM Sensors
 <lm-sensors@lm-sensors.org>
Cc: Greg KH <greg@kroah.com>
Subject: I2C: Separate non-i2c hwmon drivers from i2c-core (5/9)
Message-Id: <20050719235635.42eca56e.khali@linux-fr.org>

Call the ISA chip drivers detection function directly instead of relying
on i2c_detect. The net effect is that address lists won't be handled
anymore, but they were mostly useless in the ISA case anyway (pc87360,
smsc47m1, smsc47b397 had already dropped them).

We don't need to handle multiple devices, all we may need is a way to
force a given address instead of the original one (some drivers already
do: sis5595, via686a, w83627hf), and, for drivers supporting multiple
chips, a way to force one given kind. All this may be added later on
demand, but I actually don't think there will be much demand.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
 drivers/hwmon/it87.c       |   16 ++++++++++----
 drivers/hwmon/lm78.c       |   11 ++++++++--
 drivers/hwmon/pc87360.c    |   38 ++++++++--------------------------
 drivers/hwmon/sis5595.c    |   41 ++++++++-----------------------------
 drivers/hwmon/smsc47b397.c |   48 +++++++++++---------------------------------
 drivers/hwmon/smsc47m1.c   |   42 ++++++++------------------------------
 drivers/hwmon/via686a.c    |   41 +++++++------------------------------
 drivers/hwmon/w83627ehf.c  |   35 ++++++++------------------------
 drivers/hwmon/w83627hf.c   |   49 +++++++++++----------------------------------
 drivers/hwmon/w83781d.c    |   12 +++++++++--
 10 files changed, 98 insertions(+), 235 deletions(-)

--- gregkh-2.6.orig/drivers/hwmon/pc87360.c	2005-07-26 15:14:08.000000000 -0700
+++ gregkh-2.6/drivers/hwmon/pc87360.c	2005-07-26 15:16:29.000000000 -0700
@@ -39,25 +39,17 @@
 #include <linux/jiffies.h>
 #include <linux/i2c.h>
 #include <linux/i2c-isa.h>
-#include <linux/i2c-sensor.h>
 #include <linux/i2c-vid.h>
 #include <linux/hwmon.h>
 #include <linux/err.h>
 #include <asm/io.h>
 
-static unsigned short normal_i2c[] = { I2C_CLIENT_END };
-static unsigned int normal_isa[] = { 0, I2C_CLIENT_ISA_END };
-static struct i2c_force_data forces[] = {{ NULL }};
 static u8 devid;
-static unsigned int extra_isa[3];
+static unsigned short address;
+static unsigned short extra_isa[3];
 static u8 confreg[4];
 
 enum chips { any_chip, pc87360, pc87363, pc87364, pc87365, pc87366 };
-static struct i2c_address_data addr_data = {
-	.normal_i2c		= normal_i2c,
-	.normal_isa		= normal_isa,
-	.forces			= forces,
-};
 
 static int init = 1;
 module_param(init, int, 0);
@@ -228,8 +220,7 @@
  * Functions declaration
  */
 
-static int pc87360_attach_adapter(struct i2c_adapter *adapter);
-static int pc87360_detect(struct i2c_adapter *adapter, int address, int kind);
+static int pc87360_detect(struct i2c_adapter *adapter);
 static int pc87360_detach_client(struct i2c_client *client);
 
 static int pc87360_read_value(struct pc87360_data *data, u8 ldi, u8 bank,
@@ -246,8 +237,7 @@
 static struct i2c_driver pc87360_driver = {
 	.owner		= THIS_MODULE,
 	.name		= "pc87360",
-	.flags		= I2C_DF_NOTIFY,
-	.attach_adapter	= pc87360_attach_adapter,
+	.attach_adapter	= pc87360_detect,
 	.detach_client	= pc87360_detach_client,
 };
 
@@ -636,12 +626,7 @@
  * Device detection, registration and update
  */
 
-static int pc87360_attach_adapter(struct i2c_adapter *adapter)
-{
-	return i2c_detect(adapter, &addr_data, pc87360_detect);
-}
-
-static int pc87360_find(int sioaddr, u8 *devid, int *address)
+static int pc87360_find(int sioaddr, u8 *devid, unsigned short *addresses)
 {
 	u16 val;
 	int i;
@@ -687,7 +672,7 @@
 			continue;
 		}
 
-		address[i] = val;
+		addresses[i] = val;
 
 		if (i==0) { /* Fans */
 			confreg[0] = superio_inb(sioaddr, 0xF0);
@@ -731,9 +716,7 @@
 	return 0;
 }
 
-/* We don't really care about the address.
-   Read from extra_isa instead. */
-int pc87360_detect(struct i2c_adapter *adapter, int address, int kind)
+static int pc87360_detect(struct i2c_adapter *adapter)
 {
 	int i;
 	struct i2c_client *new_client;
@@ -742,9 +725,6 @@
 	const char *name = "pc87360";
 	int use_thermistors = 0;
 
-	if (!i2c_is_isa_adapter(adapter))
-		return -ENODEV;
-
 	if (!(data = kmalloc(sizeof(struct pc87360_data), GFP_KERNEL)))
 		return -ENOMEM;
 	memset(data, 0x00, sizeof(struct pc87360_data));
@@ -1334,12 +1314,12 @@
 	/* Arbitrarily pick one of the addresses */
 	for (i = 0; i < 3; i++) {
 		if (extra_isa[i] != 0x0000) {
-			normal_isa[0] = extra_isa[i];
+			address = extra_isa[i];
 			break;
 		}
 	}
 
-	if (normal_isa[0] == 0x0000) {
+	if (address == 0x0000) {
 		printk(KERN_WARNING "pc87360: No active logical device, "
 		       "module not inserted.\n");
 		return -ENODEV;
--- gregkh-2.6.orig/drivers/hwmon/sis5595.c	2005-07-26 15:14:08.000000000 -0700
+++ gregkh-2.6/drivers/hwmon/sis5595.c	2005-07-26 15:16:29.000000000 -0700
@@ -71,14 +71,10 @@
 MODULE_PARM_DESC(force_addr,
 		 "Initialize the base address of the sensors");
 
-/* Addresses to scan.
+/* Device address
    Note that we can't determine the ISA address until we have initialized
    our module */
-static unsigned short normal_i2c[] = { I2C_CLIENT_END };
-static unsigned int normal_isa[] = { 0x0000, I2C_CLIENT_ISA_END };
-
-/* Insmod parameters */
-SENSORS_INSMOD_1(sis5595);
+static unsigned short address;
 
 /* Many SIS5595 constants specified below */
 
@@ -194,8 +190,7 @@
 
 static struct pci_dev *s_bridge;	/* pointer to the (only) sis5595 */
 
-static int sis5595_attach_adapter(struct i2c_adapter *adapter);
-static int sis5595_detect(struct i2c_adapter *adapter, int address, int kind);
+static int sis5595_detect(struct i2c_adapter *adapter);
 static int sis5595_detach_client(struct i2c_client *client);
 
 static int sis5595_read_value(struct i2c_client *client, u8 register);
@@ -206,9 +201,7 @@
 static struct i2c_driver sis5595_driver = {
 	.owner		= THIS_MODULE,
 	.name		= "sis5595",
-	.id		= I2C_DRIVERID_SIS5595,
-	.flags		= I2C_DF_NOTIFY,
-	.attach_adapter	= sis5595_attach_adapter,
+	.attach_adapter	= sis5595_detect,
 	.detach_client	= sis5595_detach_client,
 };
 
@@ -480,14 +473,7 @@
 static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL);
  
 /* This is called when the module is loaded */
-static int sis5595_attach_adapter(struct i2c_adapter *adapter)
-{
-	if (!(adapter->class & I2C_CLASS_HWMON))
-		return 0;
-	return i2c_detect(adapter, &addr_data, sis5595_detect);
-}
-
-int sis5595_detect(struct i2c_adapter *adapter, int address, int kind)
+static int sis5595_detect(struct i2c_adapter *adapter)
 {
 	int err = 0;
 	int i;
@@ -496,10 +482,6 @@
 	char val;
 	u16 a;
 
-	/* Make sure we are probing the ISA bus!!  */
-	if (!i2c_is_isa_adapter(adapter))
-		goto exit;
-
 	if (force_addr)
 		address = force_addr & ~(SIS5595_EXTENT - 1);
 	/* Reserve the ISA region */
@@ -642,8 +624,7 @@
 		return err;
 	}
 
-	if (i2c_is_isa_client(client))
-		release_region(client->addr, SIS5595_EXTENT);
+	release_region(client->addr, SIS5595_EXTENT);
 
 	kfree(data);
 
@@ -760,7 +741,6 @@
 {
 	u16 val;
 	int *i;
-	int addr = 0;
 
 	for (i = blacklist; *i != 0; i++) {
 		struct pci_dev *dev;
@@ -776,19 +756,16 @@
 	    pci_read_config_word(dev, SIS5595_BASE_REG, &val))
 		return -ENODEV;
 	
-	addr = val & ~(SIS5595_EXTENT - 1);
-	if (addr == 0 && force_addr == 0) {
+	address = val & ~(SIS5595_EXTENT - 1);
+	if (address == 0 && force_addr == 0) {
 		dev_err(&dev->dev, "Base address not set - upgrade BIOS or use force_addr=0xaddr\n");
 		return -ENODEV;
 	}
-	if (force_addr)
-		addr = force_addr;	/* so detect will get called */
 
-	if (!addr) {
+	if (!address) {
 		dev_err(&dev->dev,"No SiS 5595 sensors found.\n");
 		return -ENODEV;
 	}
-	normal_isa[0] = addr;
 
 	s_bridge = pci_dev_get(dev);
 	if (i2c_isa_add_driver(&sis5595_driver)) {
--- gregkh-2.6.orig/drivers/hwmon/via686a.c	2005-07-26 15:14:08.000000000 -0700
+++ gregkh-2.6/drivers/hwmon/via686a.c	2005-07-26 15:16:29.000000000 -0700
@@ -50,14 +50,10 @@
 MODULE_PARM_DESC(force_addr,
 		 "Initialize the base address of the sensors");
 
-/* Addresses to scan.
+/* Device address
    Note that we can't determine the ISA address until we have initialized
    our module */
-static unsigned short normal_i2c[] = { I2C_CLIENT_END };
-static unsigned int normal_isa[] = { 0x0000, I2C_CLIENT_ISA_END };
-
-/* Insmod parameters */
-SENSORS_INSMOD_1(via686a);
+static unsigned short address;
 
 /*
    The Via 686a southbridge has a LM78-like chip integrated on the same IC.
@@ -319,8 +315,7 @@
 
 static struct pci_dev *s_bridge;	/* pointer to the (only) via686a */
 
-static int via686a_attach_adapter(struct i2c_adapter *adapter);
-static int via686a_detect(struct i2c_adapter *adapter, int address, int kind);
+static int via686a_detect(struct i2c_adapter *adapter);
 static int via686a_detach_client(struct i2c_client *client);
 
 static inline int via686a_read_value(struct i2c_client *client, u8 reg)
@@ -580,22 +575,13 @@
 static struct i2c_driver via686a_driver = {
 	.owner		= THIS_MODULE,
 	.name		= "via686a",
-	.id		= I2C_DRIVERID_VIA686A,
-	.flags		= I2C_DF_NOTIFY,
-	.attach_adapter	= via686a_attach_adapter,
+	.attach_adapter	= via686a_detect,
 	.detach_client	= via686a_detach_client,
 };
 
 
 /* This is called when the module is loaded */
-static int via686a_attach_adapter(struct i2c_adapter *adapter)
-{
-	if (!(adapter->class & I2C_CLASS_HWMON))
-		return 0;
-	return i2c_detect(adapter, &addr_data, via686a_detect);
-}
-
-static int via686a_detect(struct i2c_adapter *adapter, int address, int kind)
+static int via686a_detect(struct i2c_adapter *adapter)
 {
 	struct i2c_client *new_client;
 	struct via686a_data *data;
@@ -603,13 +589,6 @@
 	const char client_name[] = "via686a";
 	u16 val;
 
-	/* Make sure we are probing the ISA bus!!  */
-	if (!i2c_is_isa_adapter(adapter)) {
-		dev_err(&adapter->dev,
-		"via686a_detect called for an I2C bus adapter?!?\n");
-		return 0;
-	}
-
 	/* 8231 requires multiple of 256, we enforce that on 686 as well */
 	if (force_addr)
 		address = force_addr & 0xFF00;
@@ -825,26 +804,22 @@
 				       const struct pci_device_id *id)
 {
 	u16 val;
-	int addr = 0;
 
 	if (PCIBIOS_SUCCESSFUL !=
 	    pci_read_config_word(dev, VIA686A_BASE_REG, &val))
 		return -ENODEV;
 
-	addr = val & ~(VIA686A_EXTENT - 1);
-	if (addr == 0 && force_addr == 0) {
+	address = val & ~(VIA686A_EXTENT - 1);
+	if (address == 0 && force_addr == 0) {
 		dev_err(&dev->dev, "base address not set - upgrade BIOS "
 			"or use force_addr=0xaddr\n");
 		return -ENODEV;
 	}
-	if (force_addr)
-		addr = force_addr;	/* so detect will get called */
 
-	if (!addr) {
+	if (!address) {
 		dev_err(&dev->dev, "No Via 686A sensors found.\n");
 		return -ENODEV;
 	}
-	normal_isa[0] = addr;
 
 	s_bridge = pci_dev_get(dev);
 	if (i2c_isa_add_driver(&via686a_driver)) {
--- gregkh-2.6.orig/drivers/hwmon/it87.c	2005-07-26 15:14:08.000000000 -0700
+++ gregkh-2.6/drivers/hwmon/it87.c	2005-07-26 15:16:29.000000000 -0700
@@ -48,7 +48,8 @@
 /* Addresses to scan */
 static unsigned short normal_i2c[] = { 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d,
 					0x2e, 0x2f, I2C_CLIENT_END };
-static unsigned int normal_isa[] = { 0x0290, I2C_CLIENT_ISA_END };
+static unsigned int normal_isa[] = { I2C_CLIENT_ISA_END };
+static unsigned short isa_address = 0x290;
 
 /* Insmod parameters */
 SENSORS_INSMOD_2(it87, it8712);
@@ -222,7 +223,7 @@
 
 
 static int it87_attach_adapter(struct i2c_adapter *adapter);
-static int it87_find(int *address);
+static int it87_isa_attach_adapter(struct i2c_adapter *adapter);
 static int it87_detect(struct i2c_adapter *adapter, int address, int kind);
 static int it87_detach_client(struct i2c_client *client);
 
@@ -246,7 +247,7 @@
 static struct i2c_driver it87_isa_driver = {
 	.owner		= THIS_MODULE,
 	.name		= "it87-isa",
-	.attach_adapter	= it87_attach_adapter,
+	.attach_adapter	= it87_isa_attach_adapter,
 	.detach_client	= it87_detach_client,
 };
 
@@ -701,7 +702,12 @@
 	return i2c_detect(adapter, &addr_data, it87_detect);
 }
 
-/* SuperIO detection - will change normal_isa[0] if a chip is found */
+static int it87_isa_attach_adapter(struct i2c_adapter *adapter)
+{
+	return it87_detect(adapter, isa_address, -1);
+}
+
+/* SuperIO detection - will change isa_address if a chip is found */
 static int it87_find(int *address)
 {
 	int err = -ENODEV;
@@ -1184,7 +1190,7 @@
 	int addr, res;
 
 	if (!it87_find(&addr)) {
-		normal_isa[0] = addr;
+		isa_address = addr;
 	}
 
 	res = i2c_add_driver(&it87_driver);
--- gregkh-2.6.orig/drivers/hwmon/lm78.c	2005-07-26 15:14:08.000000000 -0700
+++ gregkh-2.6/drivers/hwmon/lm78.c	2005-07-26 15:16:29.000000000 -0700
@@ -34,7 +34,8 @@
 					0x25, 0x26, 0x27, 0x28, 0x29,
 					0x2a, 0x2b, 0x2c, 0x2d, 0x2e,
 					0x2f, I2C_CLIENT_END };
-static unsigned int normal_isa[] = { 0x0290, I2C_CLIENT_ISA_END };
+static unsigned int normal_isa[] = { I2C_CLIENT_ISA_END };
+static unsigned short isa_address = 0x290;
 
 /* Insmod parameters */
 SENSORS_INSMOD_3(lm78, lm78j, lm79);
@@ -160,6 +161,7 @@
 
 
 static int lm78_attach_adapter(struct i2c_adapter *adapter);
+static int lm78_isa_attach_adapter(struct i2c_adapter *adapter);
 static int lm78_detect(struct i2c_adapter *adapter, int address, int kind);
 static int lm78_detach_client(struct i2c_client *client);
 
@@ -181,7 +183,7 @@
 static struct i2c_driver lm78_isa_driver = {
 	.owner		= THIS_MODULE,
 	.name		= "lm78-isa",
-	.attach_adapter	= lm78_attach_adapter,
+	.attach_adapter	= lm78_isa_attach_adapter,
 	.detach_client	= lm78_detach_client,
 };
 
@@ -480,6 +482,11 @@
 	return i2c_detect(adapter, &addr_data, lm78_detect);
 }
 
+static int lm78_isa_attach_adapter(struct i2c_adapter *adapter)
+{
+	return lm78_detect(adapter, isa_address, -1);
+}
+
 /* This function is called by i2c_detect */
 int lm78_detect(struct i2c_adapter *adapter, int address, int kind)
 {
--- gregkh-2.6.orig/drivers/hwmon/w83781d.c	2005-07-26 15:14:08.000000000 -0700
+++ gregkh-2.6/drivers/hwmon/w83781d.c	2005-07-26 15:16:29.000000000 -0700
@@ -50,7 +50,8 @@
 static unsigned short normal_i2c[] = { 0x20, 0x21, 0x22, 0x23, 0x24, 0x25,
 					0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b,
 					0x2c, 0x2d, 0x2e, 0x2f, I2C_CLIENT_END };
-static unsigned int normal_isa[] = { 0x0290, I2C_CLIENT_ISA_END };
+static unsigned int normal_isa[] = { I2C_CLIENT_ISA_END };
+static unsigned short isa_address = 0x290;
 
 /* Insmod parameters */
 SENSORS_INSMOD_5(w83781d, w83782d, w83783s, w83627hf, as99127f);
@@ -259,6 +260,7 @@
 };
 
 static int w83781d_attach_adapter(struct i2c_adapter *adapter);
+static int w83781d_isa_attach_adapter(struct i2c_adapter *adapter);
 static int w83781d_detect(struct i2c_adapter *adapter, int address, int kind);
 static int w83781d_detach_client(struct i2c_client *client);
 
@@ -280,7 +282,7 @@
 static struct i2c_driver w83781d_isa_driver = {
 	.owner = THIS_MODULE,
 	.name = "w83781d-isa",
-	.attach_adapter = w83781d_attach_adapter,
+	.attach_adapter = w83781d_isa_attach_adapter,
 	.detach_client = w83781d_detach_client,
 };
 
@@ -871,6 +873,12 @@
 	return i2c_detect(adapter, &addr_data, w83781d_detect);
 }
 
+static int
+w83781d_isa_attach_adapter(struct i2c_adapter *adapter)
+{
+	return w83781d_detect(adapter, isa_address, -1);
+}
+
 /* Assumes that adapter is of I2C, not ISA variety.
  * OTHERWISE DON'T CALL THIS
  */
--- gregkh-2.6.orig/drivers/hwmon/smsc47b397.c	2005-07-26 15:14:08.000000000 -0700
+++ gregkh-2.6/drivers/hwmon/smsc47b397.c	2005-07-26 15:16:29.000000000 -0700
@@ -32,25 +32,13 @@
 #include <linux/jiffies.h>
 #include <linux/i2c.h>
 #include <linux/i2c-isa.h>
-#include <linux/i2c-sensor.h>
 #include <linux/hwmon.h>
 #include <linux/err.h>
 #include <linux/init.h>
 #include <asm/io.h>
 
-static unsigned short normal_i2c[] = { I2C_CLIENT_END };
 /* Address is autodetected, there is no default value */
-static unsigned int normal_isa[] = { 0x0000, I2C_CLIENT_ISA_END };
-static struct i2c_force_data forces[] = {{NULL}};
-
-enum chips { any_chip, smsc47b397 };
-static struct i2c_address_data addr_data = {
-	.normal_i2c		= normal_i2c,
-	.normal_isa		= normal_isa,
-	.probe			= normal_i2c,		/* cheat */
-	.ignore			= normal_i2c,		/* cheat */
-	.forces			= forces,
-};
+static unsigned short address;
 
 /* Super-I/0 registers and commands */
 
@@ -219,15 +207,6 @@
 #define device_create_file_fan(client, num) \
 	device_create_file(&client->dev, &dev_attr_fan##num##_input)
 
-static int smsc47b397_detect(struct i2c_adapter *adapter, int addr, int kind);
-
-static int smsc47b397_attach_adapter(struct i2c_adapter *adapter)
-{
-	if (!(adapter->class & I2C_CLASS_HWMON))
-		return 0;
-	return i2c_detect(adapter, &addr_data, smsc47b397_detect);
-}
-
 static int smsc47b397_detach_client(struct i2c_client *client)
 {
 	struct smsc47b397_data *data = i2c_get_clientdata(client);
@@ -247,27 +226,24 @@
 	return 0;
 }
 
+static int smsc47b397_detect(struct i2c_adapter *adapter);
+
 static struct i2c_driver smsc47b397_driver = {
 	.owner		= THIS_MODULE,
 	.name		= "smsc47b397",
-	.id		= I2C_DRIVERID_SMSC47B397,
-	.flags		= I2C_DF_NOTIFY,
-	.attach_adapter	= smsc47b397_attach_adapter,
+	.attach_adapter	= smsc47b397_detect,
 	.detach_client	= smsc47b397_detach_client,
 };
 
-static int smsc47b397_detect(struct i2c_adapter *adapter, int addr, int kind)
+static int smsc47b397_detect(struct i2c_adapter *adapter)
 {
 	struct i2c_client *new_client;
 	struct smsc47b397_data *data;
 	int err = 0;
 
-	if (!i2c_is_isa_adapter(adapter)) {
-		return 0;
-	}
-
-	if (!request_region(addr, SMSC_EXTENT, smsc47b397_driver.name)) {
-		dev_err(&adapter->dev, "Region 0x%x already in use!\n", addr);
+	if (!request_region(address, SMSC_EXTENT, smsc47b397_driver.name)) {
+		dev_err(&adapter->dev, "Region 0x%x already in use!\n",
+			address);
 		return -EBUSY;
 	}
 
@@ -279,7 +255,7 @@
 
 	new_client = &data->client;
 	i2c_set_clientdata(new_client, data);
-	new_client->addr = addr;
+	new_client->addr = address;
 	init_MUTEX(&data->lock);
 	new_client->adapter = adapter;
 	new_client->driver = &smsc47b397_driver;
@@ -315,11 +291,11 @@
 error_free:
 	kfree(data);
 error_release:
-	release_region(addr, SMSC_EXTENT);
+	release_region(address, SMSC_EXTENT);
 	return err;
 }
 
-static int __init smsc47b397_find(unsigned int *addr)
+static int __init smsc47b397_find(unsigned short *addr)
 {
 	u8 id, rev;
 
@@ -348,7 +324,7 @@
 {
 	int ret;
 
-	if ((ret = smsc47b397_find(normal_isa)))
+	if ((ret = smsc47b397_find(&address)))
 		return ret;
 
 	return i2c_isa_add_driver(&smsc47b397_driver);
--- gregkh-2.6.orig/drivers/hwmon/smsc47m1.c	2005-07-26 15:14:08.000000000 -0700
+++ gregkh-2.6/drivers/hwmon/smsc47m1.c	2005-07-26 15:16:29.000000000 -0700
@@ -37,17 +37,8 @@
 #include <linux/init.h>
 #include <asm/io.h>
 
-static unsigned short normal_i2c[] = { I2C_CLIENT_END };
 /* Address is autodetected, there is no default value */
-static unsigned int normal_isa[] = { 0x0000, I2C_CLIENT_ISA_END };
-static struct i2c_force_data forces[] = {{NULL}};
-
-enum chips { any_chip, smsc47m1 };
-static struct i2c_address_data addr_data = {
-	.normal_i2c		= normal_i2c,
-	.normal_isa		= normal_isa,
-	.forces			= forces,
-};
+static unsigned short address;
 
 /* Super-I/0 registers and commands */
 
@@ -125,9 +116,7 @@
 };
 
 
-static int smsc47m1_attach_adapter(struct i2c_adapter *adapter);
-static int smsc47m1_find(int *address);
-static int smsc47m1_detect(struct i2c_adapter *adapter, int address, int kind);
+static int smsc47m1_detect(struct i2c_adapter *adapter);
 static int smsc47m1_detach_client(struct i2c_client *client);
 
 static int smsc47m1_read_value(struct i2c_client *client, u8 reg);
@@ -140,9 +129,7 @@
 static struct i2c_driver smsc47m1_driver = {
 	.owner		= THIS_MODULE,
 	.name		= "smsc47m1",
-	.id		= I2C_DRIVERID_SMSC47M1,
-	.flags		= I2C_DF_NOTIFY,
-	.attach_adapter	= smsc47m1_attach_adapter,
+	.attach_adapter	= smsc47m1_detect,
 	.detach_client	= smsc47m1_detach_client,
 };
 
@@ -358,14 +345,7 @@
 
 static DEVICE_ATTR(alarms, S_IRUGO, get_alarms, NULL);
 
-static int smsc47m1_attach_adapter(struct i2c_adapter *adapter)
-{
-	if (!(adapter->class & I2C_CLASS_HWMON))
-		return 0;
-	return i2c_detect(adapter, &addr_data, smsc47m1_detect);
-}
-
-static int smsc47m1_find(int *address)
+static int smsc47m1_find(unsigned short *addr)
 {
 	u8 val;
 
@@ -392,10 +372,10 @@
 	}
 
 	superio_select();
-	*address = (superio_inb(SUPERIO_REG_BASE) << 8)
-		 |  superio_inb(SUPERIO_REG_BASE + 1);
+	*addr = (superio_inb(SUPERIO_REG_BASE) << 8)
+	      |  superio_inb(SUPERIO_REG_BASE + 1);
 	val = superio_inb(SUPERIO_REG_ACT);
-	if (*address == 0 || (val & 0x01) == 0) {
+	if (*addr == 0 || (val & 0x01) == 0) {
 		printk(KERN_INFO "smsc47m1: Device is disabled, will not use\n");
 		superio_exit();
 		return -ENODEV;
@@ -405,17 +385,13 @@
 	return 0;
 }
 
-static int smsc47m1_detect(struct i2c_adapter *adapter, int address, int kind)
+static int smsc47m1_detect(struct i2c_adapter *adapter)
 {
 	struct i2c_client *new_client;
 	struct smsc47m1_data *data;
 	int err = 0;
 	int fan1, fan2, pwm1, pwm2;
 
-	if (!i2c_is_isa_adapter(adapter)) {
-		return 0;
-	}
-
 	if (!request_region(address, SMSC_EXTENT, smsc47m1_driver.name)) {
 		dev_err(&adapter->dev, "Region 0x%x already in use!\n", address);
 		return -EBUSY;
@@ -589,7 +565,7 @@
 
 static int __init sm_smsc47m1_init(void)
 {
-	if (smsc47m1_find(normal_isa)) {
+	if (smsc47m1_find(&address)) {
 		return -ENODEV;
 	}
 
--- gregkh-2.6.orig/drivers/hwmon/w83627ehf.c	2005-07-26 15:14:08.000000000 -0700
+++ gregkh-2.6/drivers/hwmon/w83627ehf.c	2005-07-26 15:16:29.000000000 -0700
@@ -38,19 +38,13 @@
 #include <linux/slab.h>
 #include <linux/i2c.h>
 #include <linux/i2c-isa.h>
-#include <linux/i2c-sensor.h>
 #include <linux/hwmon.h>
 #include <linux/err.h>
 #include <asm/io.h>
 #include "lm75.h"
 
-/* Addresses to scan
-   The actual ISA address is read from Super-I/O configuration space */
-static unsigned short normal_i2c[] = { I2C_CLIENT_END };
-static unsigned int normal_isa[] = { 0, I2C_CLIENT_ISA_END };
-
-/* Insmod parameters */
-SENSORS_INSMOD_1(w83627ehf);
+/* The actual ISA address is read from Super-I/O configuration space */
+static unsigned short address;
 
 /*
  * Super-I/O constants and functions
@@ -670,15 +664,12 @@
 	}
 }
 
-static int w83627ehf_detect(struct i2c_adapter *adapter, int address, int kind)
+static int w83627ehf_detect(struct i2c_adapter *adapter)
 {
 	struct i2c_client *client;
 	struct w83627ehf_data *data;
 	int i, err = 0;
 
-	if (!i2c_is_isa_adapter(adapter))
-		return 0;
-
 	if (!request_region(address, REGION_LENGTH, w83627ehf_driver.name)) {
 		err = -EBUSY;
 		goto exit;
@@ -773,13 +764,6 @@
 	return err;
 }
 
-static int w83627ehf_attach_adapter(struct i2c_adapter *adapter)
-{
-	if (!(adapter->class & I2C_CLASS_HWMON))
-		return 0;
-	return i2c_detect(adapter, &addr_data, w83627ehf_detect);
-}
-
 static int w83627ehf_detach_client(struct i2c_client *client)
 {
 	struct w83627ehf_data *data = i2c_get_clientdata(client);
@@ -801,12 +785,11 @@
 static struct i2c_driver w83627ehf_driver = {
 	.owner		= THIS_MODULE,
 	.name		= "w83627ehf",
-	.flags		= I2C_DF_NOTIFY,
-	.attach_adapter	= w83627ehf_attach_adapter,
+	.attach_adapter	= w83627ehf_detect,
 	.detach_client	= w83627ehf_detach_client,
 };
 
-static int __init w83627ehf_find(int sioaddr, int *address)
+static int __init w83627ehf_find(int sioaddr, unsigned short *addr)
 {
 	u16 val;
 
@@ -824,8 +807,8 @@
 	superio_select(W83627EHF_LD_HWM);
 	val = (superio_inb(SIO_REG_ADDR) << 8)
 	    | superio_inb(SIO_REG_ADDR + 1);
-	*address = val & ~(REGION_LENGTH - 1);
-	if (*address == 0) {
+	*addr = val & ~(REGION_LENGTH - 1);
+	if (*addr == 0) {
 		superio_exit();
 		return -ENODEV;
 	}
@@ -841,8 +824,8 @@
 
 static int __init sensors_w83627ehf_init(void)
 {
-	if (w83627ehf_find(0x2e, &normal_isa[0])
-	 && w83627ehf_find(0x4e, &normal_isa[0]))
+	if (w83627ehf_find(0x2e, &address)
+	 && w83627ehf_find(0x4e, &address))
 		return -ENODEV;
 
 	return i2c_isa_add_driver(&w83627ehf_driver);
--- gregkh-2.6.orig/drivers/hwmon/w83627hf.c	2005-07-26 15:14:08.000000000 -0700
+++ gregkh-2.6/drivers/hwmon/w83627hf.c	2005-07-26 15:16:29.000000000 -0700
@@ -59,12 +59,11 @@
 MODULE_PARM_DESC(force_i2c,
 		 "Initialize the i2c address of the sensors");
 
-/* Addresses to scan */
-static unsigned short normal_i2c[] = { I2C_CLIENT_END };
-static unsigned int normal_isa[] = { 0, I2C_CLIENT_ISA_END };
+/* The actual ISA address is read from Super-I/O configuration space */
+static unsigned short address;
 
 /* Insmod parameters */
-SENSORS_INSMOD_4(w83627hf, w83627thf, w83697hf, w83637hf);
+enum chips { any_chip, w83627hf, w83627thf, w83697hf, w83637hf };
 
 static int init = 1;
 module_param(init, bool, 0);
@@ -318,9 +317,7 @@
 };
 
 
-static int w83627hf_attach_adapter(struct i2c_adapter *adapter);
-static int w83627hf_detect(struct i2c_adapter *adapter, int address,
-			  int kind);
+static int w83627hf_detect(struct i2c_adapter *adapter);
 static int w83627hf_detach_client(struct i2c_client *client);
 
 static int w83627hf_read_value(struct i2c_client *client, u16 register);
@@ -332,9 +329,7 @@
 static struct i2c_driver w83627hf_driver = {
 	.owner		= THIS_MODULE,
 	.name		= "w83627hf",
-	.id		= I2C_DRIVERID_W83627HF,
-	.flags		= I2C_DF_NOTIFY,
-	.attach_adapter	= w83627hf_attach_adapter,
+	.attach_adapter	= w83627hf_detect,
 	.detach_client	= w83627hf_detach_client,
 };
 
@@ -963,16 +958,7 @@
 } while (0)
 
 
-/* This function is called when:
-     * w83627hf_driver is inserted (when this module is loaded), for each
-       available adapter
-     * when a new adapter is inserted (and w83627hf_driver is still present) */
-static int w83627hf_attach_adapter(struct i2c_adapter *adapter)
-{
-	return i2c_detect(adapter, &addr_data, w83627hf_detect);
-}
-
-static int w83627hf_find(int sioaddr, int *address)
+static int w83627hf_find(int sioaddr, unsigned short *addr)
 {
 	u16 val;
 
@@ -992,32 +978,24 @@
 	superio_select(W83627HF_LD_HWM);
 	val = (superio_inb(WINB_BASE_REG) << 8) |
 	       superio_inb(WINB_BASE_REG + 1);
-	*address = val & ~(WINB_EXTENT - 1);
-	if (*address == 0 && force_addr == 0) {
+	*addr = val & ~(WINB_EXTENT - 1);
+	if (*addr == 0 && force_addr == 0) {
 		superio_exit();
 		return -ENODEV;
 	}
-	if (force_addr)
-		*address = force_addr;	/* so detect will get called */
 
 	superio_exit();
 	return 0;
 }
 
-int w83627hf_detect(struct i2c_adapter *adapter, int address,
-		   int kind)
+static int w83627hf_detect(struct i2c_adapter *adapter)
 {
-	int val;
+	int val, kind;
 	struct i2c_client *new_client;
 	struct w83627hf_data *data;
 	int err = 0;
 	const char *client_name = "";
 
-	if (!i2c_is_isa_adapter(adapter)) {
-		err = -ENODEV;
-		goto ERROR0;
-	}
-
 	if(force_addr)
 		address = force_addr & ~(WINB_EXTENT - 1);
 
@@ -1500,13 +1478,10 @@
 
 static int __init sensors_w83627hf_init(void)
 {
-	int addr;
-
-	if (w83627hf_find(0x2e, &addr)
-	 && w83627hf_find(0x4e, &addr)) {
+	if (w83627hf_find(0x2e, &address)
+	 && w83627hf_find(0x4e, &address)) {
 		return -ENODEV;
 	}
-	normal_isa[0] = addr;
 
 	return i2c_isa_add_driver(&w83627hf_driver);
 }

^ permalink raw reply	[flat|nested] 21+ messages in thread

* patch i2c-hwmon-split-09.patch added to gregkh-2.6 tree
  2005-07-19 22:09 ` [PATCH 2.6] I2C: Separate non-i2c hwmon drivers from i2c-core (9/9) Jean Delvare
@ 2005-07-26 22:33   ` gregkh
  0 siblings, 0 replies; 21+ messages in thread
From: gregkh @ 2005-07-26 22:33 UTC (permalink / raw)
  To: khali, greg, gregkh, linux-kernel, lm-sensors


This is a note to let you know that I've just added the patch titled

     Subject: I2C: Separate non-i2c hwmon drivers from i2c-core (9/9)

to my gregkh-2.6 tree.  Its filename is

     i2c-hwmon-split-09.patch

This tree can be found at 
    http://www.kernel.org/pub/linux/kernel/people/gregkh/gregkh-2.6/patches/

Patches currently in gregkh-2.6 which might be from khali@linux-fr.org are

i2c/i2c-max6875-documentation-update.patch
i2c/i2c-max6875-simplify.patch
i2c/i2c-hwmon-class-01.patch
i2c/i2c-hwmon-class-02.patch
i2c/i2c-hwmon-class-03.patch
i2c/i2c-missing-space.patch
i2c/i2c-nforce2-cleanup.patch
i2c/i2c-hwmon-split-01.patch
i2c/i2c-hwmon-split-02.patch
i2c/i2c-hwmon-split-03.patch
i2c/i2c-hwmon-split-04.patch
i2c/i2c-hwmon-split-05.patch
i2c/i2c-hwmon-split-06.patch
i2c/i2c-hwmon-split-07.patch
i2c/i2c-hwmon-split-08.patch
i2c/i2c-hwmon-split-09.patch


>From khali@linux-fr.org Tue Jul 19 18:12:04 2005
Date: Wed, 20 Jul 2005 00:09:03 +0200
From: Jean Delvare <khali@linux-fr.org>
To: LKML <linux-kernel@vger.kernel.org>, LM Sensors
 <lm-sensors@lm-sensors.org>
Cc: Greg KH <greg@kroah.com>
Subject: I2C: Separate non-i2c hwmon drivers from i2c-core (9/9)
Message-Id: <20050720000903.2f2cf8e3.khali@linux-fr.org>

Move the definitions of i2c_is_isa_client and i2c_is_isa_adapter from
i2c.h to i2c-isa.h. Only hybrid drivers still need them.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
 include/linux/i2c-isa.h |    7 +++++++
 include/linux/i2c.h     |    7 -------
 2 files changed, 7 insertions(+), 7 deletions(-)

--- gregkh-2.6.orig/include/linux/i2c-isa.h	2005-07-26 15:14:08.000000000 -0700
+++ gregkh-2.6/include/linux/i2c-isa.h	2005-07-26 15:16:51.000000000 -0700
@@ -26,4 +26,11 @@
 extern int i2c_isa_add_driver(struct i2c_driver *driver);
 extern int i2c_isa_del_driver(struct i2c_driver *driver);
 
+/* Detect whether we are on the isa bus. This is only useful to hybrid
+   (i2c+isa) drivers. */
+#define i2c_is_isa_client(clientptr) \
+        ((clientptr)->adapter->algo->id == I2C_ALGO_ISA)
+#define i2c_is_isa_adapter(adapptr) \
+        ((adapptr)->algo->id == I2C_ALGO_ISA)
+
 #endif /* _LINUX_I2C_ISA_H */
--- gregkh-2.6.orig/include/linux/i2c.h	2005-07-26 15:16:45.000000000 -0700
+++ gregkh-2.6/include/linux/i2c.h	2005-07-26 15:16:51.000000000 -0700
@@ -575,11 +575,4 @@
 			.force =		force,			\
 		}
 
-/* Detect whether we are on the isa bus. If this returns true, all i2c
-   access will fail! */
-#define i2c_is_isa_client(clientptr) \
-        ((clientptr)->adapter->algo->id == I2C_ALGO_ISA)
-#define i2c_is_isa_adapter(adapptr) \
-        ((adapptr)->algo->id == I2C_ALGO_ISA)
-
 #endif /* _LINUX_I2C_H */

^ permalink raw reply	[flat|nested] 21+ messages in thread

* patch i2c-hwmon-split-08.patch added to gregkh-2.6 tree
  2005-07-19 22:05 ` [PATCH 2.6] I2C: Separate non-i2c hwmon drivers from i2c-core (8/9) Jean Delvare
@ 2005-07-26 22:33   ` gregkh
  0 siblings, 0 replies; 21+ messages in thread
From: gregkh @ 2005-07-26 22:33 UTC (permalink / raw)
  To: khali, greg, gregkh, linux-kernel, lm-sensors


This is a note to let you know that I've just added the patch titled

     Subject: I2C: Separate non-i2c hwmon drivers from i2c-core (8/9)

to my gregkh-2.6 tree.  Its filename is

     i2c-hwmon-split-08.patch

This tree can be found at 
    http://www.kernel.org/pub/linux/kernel/people/gregkh/gregkh-2.6/patches/

Patches currently in gregkh-2.6 which might be from khali@linux-fr.org are

i2c/i2c-max6875-documentation-update.patch
i2c/i2c-max6875-simplify.patch
i2c/i2c-hwmon-class-01.patch
i2c/i2c-hwmon-class-02.patch
i2c/i2c-hwmon-class-03.patch
i2c/i2c-missing-space.patch
i2c/i2c-nforce2-cleanup.patch
i2c/i2c-hwmon-split-01.patch
i2c/i2c-hwmon-split-02.patch
i2c/i2c-hwmon-split-03.patch
i2c/i2c-hwmon-split-04.patch
i2c/i2c-hwmon-split-05.patch
i2c/i2c-hwmon-split-06.patch
i2c/i2c-hwmon-split-07.patch
i2c/i2c-hwmon-split-08.patch
i2c/i2c-hwmon-split-09.patch


>From khali@linux-fr.org Tue Jul 19 18:06:45 2005
Date: Wed, 20 Jul 2005 00:05:33 +0200
From: Jean Delvare <khali@linux-fr.org>
To: LKML <linux-kernel@vger.kernel.org>, LM Sensors
 <lm-sensors@lm-sensors.org>
Cc: Greg KH <greg@kroah.com>
Subject: I2C: Separate non-i2c hwmon drivers from i2c-core (8/9)
Message-Id: <20050720000533.57ad4953.khali@linux-fr.org>

Kill all uses of i2c_is_isa_adapter except for the hybrid drivers (it87,
lm78, w83781d). The i2c-isa adapter not being registered with the i2c
core anymore, drivers don't have to fear being erroneously attached to
it.


Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


---
 Documentation/i2c/writing-clients |   11 +++++------
 drivers/hwmon/adm1021.c           |    9 ---------
 drivers/hwmon/asb100.c            |    8 --------
 drivers/hwmon/lm75.c              |   10 ----------
 drivers/hwmon/lm85.c              |    5 -----
 5 files changed, 5 insertions(+), 38 deletions(-)

--- gregkh-2.6.orig/Documentation/i2c/writing-clients	2005-07-26 15:16:45.000000000 -0700
+++ gregkh-2.6/Documentation/i2c/writing-clients	2005-07-26 15:16:46.000000000 -0700
@@ -315,11 +315,10 @@
     const char *type_name = "";
     int is_isa = i2c_is_isa_adapter(adapter);
 
-    if (is_isa) {
+    /* Do this only if the chip can additionally be found on the ISA bus
+       (hybrid chip). */
 
-      /* If this client can't be on the ISA bus at all, we can stop now
-         (call `goto ERROR0'). But for kicks, we will assume it is all
-         right. */
+    if (is_isa) {
 
       /* Discard immediately if this ISA range is already used */
       if (check_region(address,FOO_EXTENT))
@@ -495,10 +494,10 @@
       return err;
     }
 
-    /* SENSORS ONLY START */
+    /* HYBRID SENSORS CHIP ONLY START */
     if i2c_is_isa_client(client)
       release_region(client->addr,LM78_EXTENT);
-    /* SENSORS ONLY END */
+    /* HYBRID SENSORS CHIP ONLY END */
 
     kfree(client); /* Frees client data too, if allocated at the same time */
     return 0;
--- gregkh-2.6.orig/drivers/hwmon/adm1021.c	2005-07-26 15:16:45.000000000 -0700
+++ gregkh-2.6/drivers/hwmon/adm1021.c	2005-07-26 15:16:46.000000000 -0700
@@ -198,15 +198,6 @@
 	int err = 0;
 	const char *type_name = "";
 
-	/* Make sure we aren't probing the ISA bus!! This is just a safety check
-	   at this moment; i2c_detect really won't call us. */
-#ifdef DEBUG
-	if (i2c_is_isa_adapter(adapter)) {
-		dev_dbg(&adapter->dev, "adm1021_detect called for an ISA bus adapter?!?\n");
-		return 0;
-	}
-#endif
-
 	if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA))
 		goto error0;
 
--- gregkh-2.6.orig/drivers/hwmon/asb100.c	2005-07-26 15:16:45.000000000 -0700
+++ gregkh-2.6/drivers/hwmon/asb100.c	2005-07-26 15:16:46.000000000 -0700
@@ -714,14 +714,6 @@
 	struct i2c_client *new_client;
 	struct asb100_data *data;
 
-	/* asb100 is SMBus only */
-	if (i2c_is_isa_adapter(adapter)) {
-		pr_debug("asb100.o: detect failed, "
-				"cannot attach to legacy adapter!\n");
-		err = -ENODEV;
-		goto ERROR0;
-	}
-
 	if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) {
 		pr_debug("asb100.o: detect failed, "
 				"smbus byte data not supported!\n");
--- gregkh-2.6.orig/drivers/hwmon/lm75.c	2005-07-26 15:16:45.000000000 -0700
+++ gregkh-2.6/drivers/hwmon/lm75.c	2005-07-26 15:16:46.000000000 -0700
@@ -121,16 +121,6 @@
 	int err = 0;
 	const char *name = "";
 
-	/* Make sure we aren't probing the ISA bus!! This is just a safety check
-	   at this moment; i2c_detect really won't call us. */
-#ifdef DEBUG
-	if (i2c_is_isa_adapter(adapter)) {
-		dev_dbg(&adapter->dev,
-			"lm75_detect called for an ISA bus adapter?!?\n");
-		goto exit;
-	}
-#endif
-
 	if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA |
 				     I2C_FUNC_SMBUS_WORD_DATA))
 		goto exit;
--- gregkh-2.6.orig/drivers/hwmon/lm85.c	2005-07-26 15:16:45.000000000 -0700
+++ gregkh-2.6/drivers/hwmon/lm85.c	2005-07-26 15:16:46.000000000 -0700
@@ -1033,11 +1033,6 @@
 	int err = 0;
 	const char *type_name = "";
 
-	if (i2c_is_isa_adapter(adapter)) {
-		/* This chip has no ISA interface */
-		goto ERROR0 ;
-	};
-
 	if (!i2c_check_functionality(adapter,
 					I2C_FUNC_SMBUS_BYTE_DATA)) {
 		/* We need to be able to do byte I/O */

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 2.6] I2C: Separate non-i2c hwmon drivers from i2c-core (2/9)
  2005-07-25 17:28         ` Jean Delvare
@ 2005-07-26 22:54           ` Greg KH
  2005-07-27 20:21             ` Jean Delvare
  0 siblings, 1 reply; 21+ messages in thread
From: Greg KH @ 2005-07-26 22:54 UTC (permalink / raw)
  To: Jean Delvare; +Cc: LKML, LM Sensors

On Mon, Jul 25, 2005 at 07:28:27PM +0200, Jean Delvare wrote:
> Hi Greg,
> 
> > Ah, much better, thanks.  Sounds like a great plan, I'll go apply your
> > patches in a day or so when I catch up from my travels.
> 
> OK, thanks.
> 
> Note that there are a few patches which you should apply before this
> series, in particular Mark Hoffman's 3 hwmon class patches. There are no
> hard dependencies between both series but applying them in order is
> likely to ease your work.
> 
> You can take a look at my current stack here for reference:
> http://khali.linux-fr.org/devel/i2c/linux-2.6/series

Ok, should be caught up now.  I have a pci patch or two still left to
apply that i know you were also tracking.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 2.6] I2C: Separate non-i2c hwmon drivers from i2c-core (2/9)
  2005-07-26 22:54           ` Greg KH
@ 2005-07-27 20:21             ` Jean Delvare
  0 siblings, 0 replies; 21+ messages in thread
From: Jean Delvare @ 2005-07-27 20:21 UTC (permalink / raw)
  To: Greg KH; +Cc: LKML, LM Sensors

Hi Greg,

> > You can take a look at my current stack here for reference:
> > http://khali.linux-fr.org/devel/i2c/linux-2.6/series
> 
> Ok, should be caught up now.  I have a pci patch or two still left to
> apply that i know you were also tracking.

I've picked up the few i2c patches you have and I didn't, and just
posted the ones I had and you didn't to the the sensors list, so we
should be sync'd again soon now.

As for PCI, I only have one patch pending and it seems you have it
already, so it's OK.

Thanks,
-- 
Jean Delvare

^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2005-07-27 20:25 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-07-19 21:39 [PATCH 2.6] I2C: Separate non-i2c hwmon drivers from i2c-core (0/9) Jean Delvare
2005-07-19 21:45 ` [PATCH 2.6] I2C: Separate non-i2c hwmon drivers from i2c-core (1/9) Jean Delvare
2005-07-20  4:26   ` Greg KH
2005-07-20 21:03     ` Jean Delvare
2005-07-19 21:48 ` [PATCH 2.6] I2C: Separate non-i2c hwmon drivers from i2c-core (2/9) Jean Delvare
2005-07-20  4:27   ` Greg KH
2005-07-20 21:46     ` Jean Delvare
2005-07-25  0:35       ` Greg KH
2005-07-25 17:28         ` Jean Delvare
2005-07-26 22:54           ` Greg KH
2005-07-27 20:21             ` Jean Delvare
2005-07-19 21:51 ` [PATCH 2.6] I2C: Separate non-i2c hwmon drivers from i2c-core (3/9) Jean Delvare
2005-07-19 21:53 ` [PATCH 2.6] I2C: Separate non-i2c hwmon drivers from i2c-core (4/9) Jean Delvare
2005-07-19 21:56 ` [PATCH 2.6] I2C: Separate non-i2c hwmon drivers from i2c-core (5/9) Jean Delvare
2005-07-26 22:33   ` patch i2c-hwmon-split-05.patch added to gregkh-2.6 tree gregkh
2005-07-19 21:57 ` [PATCH 2.6] I2C: Separate non-i2c hwmon drivers from i2c-core (6/9) Jean Delvare
2005-07-19 22:02 ` [PATCH 2.6] I2C: Separate non-i2c hwmon drivers from i2c-core (7/9) Jean Delvare
2005-07-19 22:05 ` [PATCH 2.6] I2C: Separate non-i2c hwmon drivers from i2c-core (8/9) Jean Delvare
2005-07-26 22:33   ` patch i2c-hwmon-split-08.patch added to gregkh-2.6 tree gregkh
2005-07-19 22:09 ` [PATCH 2.6] I2C: Separate non-i2c hwmon drivers from i2c-core (9/9) Jean Delvare
2005-07-26 22:33   ` patch i2c-hwmon-split-09.patch added to gregkh-2.6 tree gregkh

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).