[i2c] [patch 2.6.20-rc1 5/6] remove i2c_adapter.dev from i2c core and adapters

David Brownell david-b at pacbell.net
Thu Dec 21 03:03:01 CET 2006


Hi Jean,

On Wednesday 20 December 2006 1:57 pm, Jean Delvare wrote:

> > To cope with incomplete driver model conversions in I2C bus drivers, if
> > there's no real device associated with the adapter, a warning is issued
> > and a "legacy_i2c_adapter" platform device is created.  One hopes all
> > the I2C bus drivers will be fixed over the next year or so, letting that
> > hack be removed.
> 
> I'm not happy with this. We're in the process of cleaning the i2c-core,
> and now we're adding yet another temporary workaround. When we later
> remove this workaround, we'll once again modify the i2c_adapter
> structure, and the sysfs representation will change as well. I'd rather
> fix the offending drivers right now.

So there would be two changes:  (a) replace the code working around that
"legacy adapter" case with a clean failure mode, and (b) remove a pointer
from the struct.  Those aren't big changes ... I chose that tradeoff
to minimize breakage, and expected most of the missing device nodes would
be on the platform_bus anyway.


> In a number of cases, the missing device is not declared, but it's
> there. That's the case for all PCI and USB devices, mostly in
> media/video drivers. I have a patch to fix these, attached.

Excellent!  As I did it originally, those could be added to the
sequence as "#5.5 of 6".  (Or added to this #5 patch, although it
seems quite separate to me.)

Or the "missing device" can be handed to i2c core using the old
i2c_adapter.dev.parent field, if there's a delay getting #5 merged.
The updates in #6 more or less rely on having a sane device hierarchy,
and providing the "missing device" is a big help there.


> For the rest, these are legacy drivers, I suppose we would need to
> convert them to platform drivers. That would be a significant amount of
> work... But after investigating a bit, I found that registering a class
> device without an associated device should work. Other drivers do that
> already (fbcon or lp for example.) So I suggest that we don't implement
> that legacy_i2c_adapter hack at all.

The problem with that is that registering the class works fine, but then
I'm not sure where the individual I2C devices would end up.  If we have
such a legacy_i2c_adapter node, we know:  they'll be children of that,
and the suspend/resume/shutdown call sequences (from patch #6) will always
be correct with respect to the adapter.  (That is, the i2c_client devices
will suspend or shutdown before the adapter, and resume after it.)



> > @@ -222,8 +220,9 @@ struct i2c_adapter {
> >  
> >  	int timeout;
> >  	int retries;
> > -	struct device dev;		/* the adapter device */
> >  	struct class_device class_dev;	/* the class device */
> > +	struct platform_device *legacy_hack;
> > +	void *adapdata;
> >  
> >  	int nr;
> >  	struct list_head clients;
> 
> What about dev_released? Shouldn't it go away with dev?

Yes it should.  Nothing calls complete() on it any more.  Looks
like my testing didn't include rmmod of a live adapter ... seems
all my systems that need I2C need it during system boot, so that
modules are inappropriate!

I'll fix that.  Then I'll have to re-issue the "Part II" patches
again, that'll break them..


> > @@ -237,12 +236,12 @@ struct i2c_adapter {
> >  
> >  static inline void *i2c_get_adapdata (struct i2c_adapter *dev)
> >  {
> > -	return dev_get_drvdata (&dev->dev);
> > +	return dev->adapdata;
> >  }
> >  
> >  static inline void i2c_set_adapdata (struct i2c_adapter *dev, void *data)
> >  {
> > -	dev_set_drvdata (&dev->dev, data);
> > +	dev->adapdata = data;
> >  }
> 
> struct class_device has a class_data pointer, isn't it meant exactly
> for this usage? If so, we don't need the new adapdata field.

That's what I was thinking too, but I looked and thought I saw something
else claiming ownership of that field.  Hmm, either that changed since
the first version of the patch (Greg's changes?) or I goofed.

Either way, it's currently safe to remove that, and I'll do that.



> > +struct class i2c_adapter_class = {
> > +	.name =			"i2c-adapter",
> > +	.owner =		THIS_MODULE,
> > +	.class_dev_attrs =	adapter_attrs,
> > +	.release =		&i2c_adapter_class_dev_release,
> > +};
> 
> I see why this is necessary,

Because the place the attribute used to live isn't there any more.  :)


> but it changes the interface we offer to 
> user-space, and will break some tools and libraries. For example
> libsensors uses this field to present the adapter name to the user, and
> will need to be updated to get the class name attribute instead of the
> device name attribute.
> 
> Unfortunately there's no way around it now. We should have anticipated
> the change by creating the class attribute earlier, and by teaching
> libsensors to read from it earlier. It's too late now... But we might
> have to delay a bit the merging of this patch because of this :(

Grr, I see what you mean.

So what's the migration strategy ... can we get 2.6.20 to expose the
class attribute, and start deploying smarter libsensors ASAP?  (The
change would be to try for the class attribute first, then fallback.)
I don't even know who maintains libsensors.

That'd cause some chaos later in these patch series, but it'd be
manageable.  In functional terms, the rest of these patches can be
decoupled from this particular patch ... none of them really "changed"
things (other than stopping use of i2c_adapter.dev), they're all
additions.  It'll make a mess of the later patches, which now apply
against code that assumes this bit, but that's fixable; and earlier
patches will apply just fine without it.



> >  static void i2c_client_release(struct device *dev)
> > @@ -172,30 +165,34 @@ int i2c_add_adapter(struct i2c_adapter *
> >  	list_add_tail(&adap->list,&adapters);
> >  	INIT_LIST_HEAD(&adap->clients);
> >  
> > -	/* Add the adapter to the driver core.
> > -	 * If the parent pointer is not set up,
> > -	 * we add this adapter to the host bus.
> > +	/* Caller must have zero-initialized adap->class_dev, then
> > +	 * initialized adap->class_dev.dev as the real device so we
> > +	 * can properly add this adapter to the i2c_adapter class.
> > +	 *
> > +	 * As a **TEMPORARY migration aid** we create a platform
> > +	 * device for drivers that don't yet use the driver model.
> > +	 * Expect this to vanish by January 2008.
> 
> If we really do this, then this must be documented in
> Documentation/feature-removal-schedule.txt, not just here. But as I
> said above, I don't think we need to introduce these fake devices.

If you don't want to do that, so be it.  I'd make this block of code
report a fatal error then, for the reasons I sketched above.


> >  	init_completion(&adap->class_dev_released);
> >  	class_device_unregister(&adap->class_dev);
> > -	device_remove_file(&adap->dev, &dev_attr_name);
> > -	device_unregister(&adap->dev);
> >  	list_del(&adap->list);
> >  
> >  	/* wait for sysfs to drop all references */
> 
> You forgot to unregister the fake platform device here, so we have a
> leak. Not that it really matters, as I still think we don't want this
> fake device...

I'll fix it in my copy anyway ... at least until you respond to
the point about making sure the device tree is correct, so that
tree-related operations (as in patch #6 of this group) behave.



> > -/* We can't do a thing... */
> > -static u32 isa_func(struct i2c_adapter *adapter)
> > +static void i2c_isa_dev_release(struct device *dev)
> >  {
> > -	return 0;
> > +	complete(&isa_adapter.dev_released);
> 
> So this is where you use i2c_adapter.dev_released...

It's actually a bug.  :)


> Given that this is 
> the only place where you will still use it, and i2c-isa is eventually
> going away, wouldn't it be better to make it local to the i2c-isa
> driver?

Yes.


> BTW, it's still a mystery to me what these operations we do on
> dev_released are for, if you could explain that to me...

As I recall, the basic issue is that for nodes that are visible
in sysfs you need to remember what happens with sequences like:

	# cd /sys/.../node
	# rmmod "module that created node"

In that case, it's not safe to free the memory associated with
the node until after your shell changes directory out of that node. 
(There are many other similar cases, with files open for other
reasons.)  So the wait_for_completion() before the free is
preventing some nastiness.

But that also highlights a few other glitches in the process.
Again using that example, the "rmmod" should complete, so that
your shell can change directory.

The _simple_ way to work around this stuff is not to have drivers
allocate or free the memory associated with devices (or classes).
For example, by using routines like class_device_create(), rather
than doing what i2c now does... that sort of change was more than
I wanted to do myself, but it'd be easier after everyone (including
i2c core) stops using i2c_adapter.dev and after some other cleanup
to the i2c core code.


> The diff is much larger than it should, I can't really figure out why
> "diff" can't make it better :(

This is one of the lesser mysteries of life.  ;)


 
> >  /* We implement an interface which resembles i2c_{add,del}_driver,
> > @@ -137,44 +140,33 @@ static int __init i2c_isa_init(void)
> >  
> >  	mutex_init(&isa_adapter.clist_lock);
> >  	INIT_LIST_HEAD(&isa_adapter.clients);
> > +	init_completion(&isa_adapter.dev_released);
> > +	init_completion(&isa_adapter.class_dev_released);
> 
> Now I'm confused. Here we initialize them at the beginning, while in
> i2c-core we initialize them right before deleting the i2c_adapter?

If you look at "part II patch #4" you'll see this is fixed there.
In general, it's correct to init completions right when they're
allocated ... but I didn't want to make this patch ("part I #5")
larger than needed.  The i2c-isa bits needed more rework.


> I start wondering if we shouldn't kill i2c-isa right now so that we
> don't have to modify it (and break user-space compatibility...)

Well, if i2c_adapter.dev has to linger until libsysfs changes get
deployed (call it 6 months), that'd seem plenty of time for you
to finish your "kill i2c-isa" jihad.  ;)

How do you think we should proceed with these patches then?  What
I think you're implying is:

 - #1-4 in this series are all but ready to go into MM;
   I think I've addressed all your review comments.

 - #5 needs to wait until libsysfs gets updated, which for
   now I'm calling "6 months".

 - Some parts of #5, notably creation of class attribute,
   should be merged soonish, to support new libsysfs.

 - "#5.5" (which you attached to this email) should get
   respun to init using i2c_adapter.dev.parent, so that it
   doesn't require #5.

 - #6 you've not commented on recently, but I believe that once
   it gets respun to apply without #5, it's ready to go to MM.

 - All the "Part II" patches ("new style" driver binding) would
   need to get respun to apply without #5 ... but pending more
   review (they had one round already), I think they should go
   to MM in expectation of a 2.6.21 merge.

Please let me know.

Regardless, attached you'll find an updated version of #5 which
addresses your comments above.

- Dave


================	CUT HERE
Some I2C driver model core cleanup, removing:

  - Inappropriate "i2c_adapter.dev"; users of that should have used
    (or, for adapters, provided) i2c_adapter.class_dev.dev instead.

  - The non-class "i2c-adapter" driver, which should never have been
    needed given the i2c_adapter class.

And corresponding changes to all I2C adapter drivers:

  - LOTS of one-line updates to adapter init: don't set the parent of
    a no-longer-existing device, set i2c_adapter.class_dev.dev instead.

  - The "i2c-isa" driver needed somewhat larger changes, since it was
    directly mucking about with the stuff that was removed.

This shrinks the data footprint for each I2C adapter by a fair amount,
and i2c core code (and data) space by a bit.  Later, the core can shrink
more, removing lists and pointers duplicating more driver model functions.

To cope with incomplete driver model conversions in I2C bus drivers, if
there's no real device associated with the adapter, a warning is issued
and a "legacy_i2c_adapter" platform device is created.  One hopes all
the I2C bus drivers will be fixed over the next year or so, letting that
hack be removed.

Signed-off-by: David Brownell <dbrownell at users.sourceforge.net>


Index: at91/include/linux/i2c.h
===================================================================
--- at91.orig/include/linux/i2c.h	2006-12-20 11:15:49.000000000 -0800
+++ at91/include/linux/i2c.h	2006-12-20 17:02:15.000000000 -0800
@@ -37,8 +37,6 @@
 
 /* --- 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;
 
@@ -222,14 +220,13 @@ struct i2c_adapter {
 
 	int timeout;
 	int retries;
-	struct device dev;		/* the adapter device */
 	struct class_device class_dev;	/* the class device */
+	struct platform_device *legacy_hack;
 
 	int nr;
 	struct list_head clients;
 	struct list_head list;
 	char name[I2C_NAME_SIZE];
-	struct completion dev_released;
 	struct completion class_dev_released;
 };
 #define dev_to_i2c_adapter(d) container_of(d, struct i2c_adapter, dev)
@@ -237,12 +234,12 @@ struct i2c_adapter {
 
 static inline void *i2c_get_adapdata (struct i2c_adapter *dev)
 {
-	return dev_get_drvdata (&dev->dev);
+	return class_get_devdata(&dev->class_dev);
 }
 
 static inline void i2c_set_adapdata (struct i2c_adapter *dev, void *data)
 {
-	dev_set_drvdata (&dev->dev, data);
+	class_set_devdata(&dev->class_dev, data);
 }
 
 /*flags for the client struct: */
Index: at91/drivers/i2c/i2c-core.c
===================================================================
--- at91.orig/drivers/i2c/i2c-core.c	2006-12-20 12:35:59.000000000 -0800
+++ at91/drivers/i2c/i2c-core.c	2006-12-20 17:51:53.000000000 -0800
@@ -83,36 +83,29 @@ struct bus_type i2c_bus_type = {
 	.resume =       i2c_bus_resume,
 };
 
-void i2c_adapter_dev_release(struct device *dev)
-{
-	struct i2c_adapter *adap = dev_to_i2c_adapter(dev);
-	complete(&adap->dev_released);
-}
-
-struct device_driver i2c_adapter_driver = {
-	.owner = THIS_MODULE,
-	.name =	"i2c_adapter",
-	.bus = &i2c_bus_type,
-};
-
 static void i2c_adapter_class_dev_release(struct class_device *dev)
 {
 	struct i2c_adapter *adap = class_dev_to_i2c_adapter(dev);
 	complete(&adap->class_dev_released);
 }
 
-struct class i2c_adapter_class = {
-	.owner =	THIS_MODULE,
-	.name =		"i2c-adapter",
-	.release =	&i2c_adapter_class_dev_release,
-};
-
-static ssize_t show_adapter_name(struct device *dev, struct device_attribute *attr, char *buf)
+static ssize_t show_adapter_name(struct class_device *cdev, char *buf)
 {
-	struct i2c_adapter *adap = dev_to_i2c_adapter(dev);
+	struct i2c_adapter *adap = class_dev_to_i2c_adapter(cdev);
 	return sprintf(buf, "%s\n", adap->name);
 }
-static DEVICE_ATTR(name, S_IRUGO, show_adapter_name, NULL);
+
+static struct class_device_attribute adapter_attrs[] = {
+	__ATTR(name, S_IRUGO, show_adapter_name, NULL),
+	{ },
+};
+
+struct class i2c_adapter_class = {
+	.name =			"i2c-adapter",
+	.owner =		THIS_MODULE,
+	.class_dev_attrs =	adapter_attrs,
+	.release =		&i2c_adapter_class_dev_release,
+};
 
 
 static void i2c_client_release(struct device *dev)
@@ -171,30 +164,33 @@ int i2c_add_adapter(struct i2c_adapter *
 	list_add_tail(&adap->list,&adapters);
 	INIT_LIST_HEAD(&adap->clients);
 
-	/* Add the adapter to the driver core.
-	 * If the parent pointer is not set up,
-	 * we add this adapter to the host bus.
+	/* Caller must have zero-initialized adap->class_dev, then
+	 * initialized adap->class_dev.dev as the real device so we
+	 * can properly add this adapter to the i2c_adapter class.
+	 *
+	 * As a **TEMPORARY migration aid** we create a platform
+	 * device for drivers that don't yet use the driver model.
+	 * Expect this to vanish by January 2008.
 	 */
-	if (adap->dev.parent == NULL)
-		adap->dev.parent = &platform_bus;
-	sprintf(adap->dev.bus_id, "i2c-%d", adap->nr);
-	adap->dev.driver = &i2c_adapter_driver;
-	adap->dev.release = &i2c_adapter_dev_release;
-	res = device_register(&adap->dev);
-	if (res)
-		goto out_list;
-	res = device_create_file(&adap->dev, &dev_attr_name);
-	if (res)
-		goto out_unregister;
+	if (!adap->class_dev.dev) {
+		printk(KERN_WARNING "I2C bus '%s' has no device; "
+			"convert it to the driver model\n",
+			adap->name);
+		adap->legacy_hack = platform_device_register_simple(
+			"legacy_i2c_adapter", adap->nr, NULL, 0);
+		if (adap->legacy_hack)
+			adap->class_dev.dev = &adap->legacy_hack->dev;
+		else {
+			res = -ENODEV;
+			goto out_unlock;
+		}
+	}
 
-	/* Add this adapter to the i2c_adapter class */
-	memset(&adap->class_dev, 0x00, sizeof(struct class_device));
-	adap->class_dev.dev = &adap->dev;
+	sprintf(adap->class_dev.class_id, "i2c-%d", adap->nr);
 	adap->class_dev.class = &i2c_adapter_class;
-	strlcpy(adap->class_dev.class_id, adap->dev.bus_id, BUS_ID_SIZE);
 	res = class_device_register(&adap->class_dev);
 	if (res)
-		goto out_remove_name;
+		goto out_list;
 
 	dev_dbg(adap->class_dev.dev, "adapter %s [%s] registered\n",
 			adap->class_dev.class_id, adap->name);
@@ -211,14 +207,9 @@ out_unlock:
 	mutex_unlock(&core_lists);
 	return res;
 
-out_remove_name:
-	device_remove_file(&adap->dev, &dev_attr_name);
-out_unregister:
-	init_completion(&adap->dev_released); /* Needed? */
-	device_unregister(&adap->dev);
-	wait_for_completion(&adap->dev_released);
 out_list:
 	list_del(&adap->list);
+	platform_device_unregister(adap->legacy_hack);
 	idr_remove(&i2c_adapter_idr, adap->nr);
 	goto out_unlock;
 }
@@ -272,17 +263,15 @@ int i2c_del_adapter(struct i2c_adapter *
 	}
 
 	/* clean up the sysfs representation */
-	init_completion(&adap->dev_released);
 	init_completion(&adap->class_dev_released);
 	class_device_unregister(&adap->class_dev);
-	device_remove_file(&adap->dev, &dev_attr_name);
-	device_unregister(&adap->dev);
 	list_del(&adap->list);
 
 	/* wait for sysfs to drop all references */
-	wait_for_completion(&adap->dev_released);
 	wait_for_completion(&adap->class_dev_released);
 
+	platform_device_unregister(adap->legacy_hack);
+
 	/* free dynamically allocated bus id */
 	idr_remove(&i2c_adapter_idr, adap->nr);
 
@@ -425,7 +414,7 @@ int i2c_attach_client(struct i2c_client 
 
 	client->usage_count = 0;
 
-	client->dev.parent = &client->adapter->dev;
+	client->dev.parent = adapter->class_dev.dev;
 	client->dev.driver = &client->driver->driver;
 	client->dev.bus = &i2c_bus_type;
 	client->dev.release = &i2c_client_release;
@@ -574,16 +563,12 @@ static int __init i2c_init(void)
 	retval = bus_register(&i2c_bus_type);
 	if (retval)
 		return retval;
-	retval = driver_register(&i2c_adapter_driver);
-	if (retval)
-		return retval;
 	return class_register(&i2c_adapter_class);
 }
 
 static void __exit i2c_exit(void)
 {
 	class_unregister(&i2c_adapter_class);
-	driver_unregister(&i2c_adapter_driver);
 	bus_unregister(&i2c_bus_type);
 }
 
@@ -1176,9 +1161,7 @@ s32 i2c_smbus_xfer(struct i2c_adapter * 
 }
 
 
-/* Next four are needed by i2c-isa */
-EXPORT_SYMBOL_GPL(i2c_adapter_dev_release);
-EXPORT_SYMBOL_GPL(i2c_adapter_driver);
+/* Next two are needed by i2c-isa */
 EXPORT_SYMBOL_GPL(i2c_adapter_class);
 EXPORT_SYMBOL_GPL(i2c_bus_type);
 
Index: at91/drivers/i2c/busses/i2c-isa.c
===================================================================
--- at91.orig/drivers/i2c/busses/i2c-isa.c	2006-12-20 12:35:59.000000000 -0800
+++ at91/drivers/i2c/busses/i2c-isa.c	2006-12-20 17:45:58.000000000 -0800
@@ -56,21 +56,26 @@ static struct i2c_adapter isa_adapter = 
 	.name		= "ISA main adapter",
 };
 
-/* We can't do a thing... */
-static u32 isa_func(struct i2c_adapter *adapter)
+static DECLARE_COMPLETION(isa_completion);
+
+static void i2c_isa_dev_release(struct device *dev)
 {
-	return 0;
+	complete(&isa_completion);
 }
 
+static struct platform_device i2c_isa_dev = {
+	.name		= "i2c_isa",
+	.id		= -1,
+	.dev = {
+		.release = i2c_isa_dev_release,
+	},
+};
 
-/* Copied from i2c-core */
-static ssize_t show_adapter_name(struct device *dev,
-		struct device_attribute *attr, char *buf)
+/* We can't do a thing... */
+static u32 isa_func(struct i2c_adapter *adapter)
 {
-	struct i2c_adapter *adap = dev_to_i2c_adapter(dev);
-	return sprintf(buf, "%s\n", adap->name);
+	return 0;
 }
-static DEVICE_ATTR(name, S_IRUGO, show_adapter_name, NULL);
 
 
 /* We implement an interface which resembles i2c_{add,del}_driver,
@@ -137,45 +142,33 @@ static int __init i2c_isa_init(void)
 
 	mutex_init(&isa_adapter.clist_lock);
 	INIT_LIST_HEAD(&isa_adapter.clients);
+	init_completion(&isa_adapter.class_dev_released);
 
 	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;
-	err = device_register(&isa_adapter.dev);
+	sprintf(isa_adapter.class_dev.class_id, "i2c-%d", isa_adapter.nr);
+
+	err = platform_device_register(&i2c_isa_dev);
 	if (err) {
 		printk(KERN_ERR "i2c-isa: Failed to register device\n");
 		goto exit;
 	}
-	err = device_create_file(&isa_adapter.dev, &dev_attr_name);
-	if (err) {
-		printk(KERN_ERR "i2c-isa: Failed to create name file\n");
-		goto exit_unregister;
-	}
 
 	/* 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.dev = &i2c_isa_dev.dev;
 	isa_adapter.class_dev.class = &i2c_adapter_class;
-	strlcpy(isa_adapter.class_dev.class_id, isa_adapter.dev.bus_id,
-		BUS_ID_SIZE);
 	err = class_device_register(&isa_adapter.class_dev);
 	if (err) {
 		printk(KERN_ERR "i2c-isa: Failed to register class device\n");
-		goto exit_remove_name;
+		goto exit_unregister;
 	}
 
 	dev_dbg(isa_adapter.class_dev.dev, "%s registered\n", isa_adapter.name);
 
 	return 0;
 
-exit_remove_name:
-	device_remove_file(&isa_adapter.dev, &dev_attr_name);
 exit_unregister:
-	init_completion(&isa_adapter.dev_released); /* Needed? */
-	device_unregister(&isa_adapter.dev);
-	wait_for_completion(&isa_adapter.dev_released);
+	platform_device_unregister(&i2c_isa_dev);
+	wait_for_completion(&isa_completion);
 exit:
 	return err;
 }
@@ -203,15 +196,12 @@ static void __exit i2c_isa_exit(void)
 
 	/* Clean up the sysfs representation */
 	dev_dbg(isa_adapter.class_dev.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);
+	platform_device_unregister(&i2c_isa_dev);
 
 	/* Wait for sysfs to drop all references */
 	dev_dbg(isa_adapter.class_dev.dev, "Waiting for sysfs completion\n");
-	wait_for_completion(&isa_adapter.dev_released);
+	wait_for_completion(&isa_completion);
 	wait_for_completion(&isa_adapter.class_dev_released);
 
 	dev_dbg(isa_adapter.class_dev.dev,
Index: at91/drivers/i2c/busses/i2c-at91.c
===================================================================
--- at91.orig/drivers/i2c/busses/i2c-at91.c	2006-12-20 12:35:59.000000000 -0800
+++ at91/drivers/i2c/busses/i2c-at91.c	2006-12-20 12:35:59.000000000 -0800
@@ -229,7 +229,7 @@ static int __devinit at91_i2c_probe(stru
 	sprintf(adapter->name, "AT91");
 	adapter->algo = &at91_algorithm;
 	adapter->class = I2C_CLASS_HWMON;
-	adapter->dev.parent = &pdev->dev;
+	adapter->class_dev.dev = &pdev->dev;
 
 	platform_set_drvdata(pdev, adapter);
 
Index: at91/drivers/i2c/busses/i2c-ali1535.c
===================================================================
--- at91.orig/drivers/i2c/busses/i2c-ali1535.c	2006-12-20 12:35:59.000000000 -0800
+++ at91/drivers/i2c/busses/i2c-ali1535.c	2006-12-20 12:35:59.000000000 -0800
@@ -498,8 +498,8 @@ static int __devinit ali1535_probe(struc
 		return -ENODEV;
 	}
 
-	/* set up the driverfs linkage to our parent device */
-	ali1535_adapter.dev.parent = &dev->dev;
+	/* set up the driver model linkage to our parent device */
+	ali1535_adapter.class_dev.dev = &dev->dev;
 
 	snprintf(ali1535_adapter.name, I2C_NAME_SIZE, 
 		"SMBus ALI1535 adapter at %04x", ali1535_smba);
Index: at91/drivers/i2c/busses/i2c-ali1563.c
===================================================================
--- at91.orig/drivers/i2c/busses/i2c-ali1563.c	2006-12-20 12:35:59.000000000 -0800
+++ at91/drivers/i2c/busses/i2c-ali1563.c	2006-12-20 12:36:00.000000000 -0800
@@ -390,7 +390,7 @@ static int __devinit ali1563_probe(struc
 
 	if ((error = ali1563_setup(dev)))
 		return error;
-	ali1563_adapter.dev.parent = &dev->dev;
+	ali1563_adapter.class_dev.dev = &dev->dev;
 	sprintf(ali1563_adapter.name,"SMBus ALi 1563 Adapter @ %04x",
 		ali1563_smba);
 	if ((error = i2c_add_adapter(&ali1563_adapter)))
Index: at91/drivers/i2c/busses/i2c-ali15x3.c
===================================================================
--- at91.orig/drivers/i2c/busses/i2c-ali15x3.c	2006-12-20 12:35:59.000000000 -0800
+++ at91/drivers/i2c/busses/i2c-ali15x3.c	2006-12-20 12:36:00.000000000 -0800
@@ -495,8 +495,8 @@ static int __devinit ali15x3_probe(struc
 		return -ENODEV;
 	}
 
-	/* set up the driverfs linkage to our parent device */
-	ali15x3_adapter.dev.parent = &dev->dev;
+	/* set up the driver model linkage to our parent device */
+	ali15x3_adapter.class_dev.dev = &dev->dev;
 
 	snprintf(ali15x3_adapter.name, I2C_NAME_SIZE,
 		"SMBus ALI15X3 adapter at %04x", ali15x3_smba);
Index: at91/drivers/i2c/busses/i2c-amd756.c
===================================================================
--- at91.orig/drivers/i2c/busses/i2c-amd756.c	2006-12-20 12:35:59.000000000 -0800
+++ at91/drivers/i2c/busses/i2c-amd756.c	2006-12-20 12:36:00.000000000 -0800
@@ -379,8 +379,8 @@ static int __devinit amd756_probe(struct
 	dev_dbg(&pdev->dev, "SMBREV = 0x%X\n", temp);
 	dev_dbg(&pdev->dev, "AMD756_smba = 0x%X\n", amd756_ioport);
 
-	/* set up the driverfs linkage to our parent device */
-	amd756_smbus.dev.parent = &pdev->dev;
+	/* set up the driver model linkage to our parent device */
+	amd756_smbus.class_dev.dev = &pdev->dev;
 
 	sprintf(amd756_smbus.name, "SMBus %s adapter at %04x",
 		chipname[id->driver_data], amd756_ioport);
Index: at91/drivers/i2c/busses/i2c-amd8111.c
===================================================================
--- at91.orig/drivers/i2c/busses/i2c-amd8111.c	2006-12-20 12:35:59.000000000 -0800
+++ at91/drivers/i2c/busses/i2c-amd8111.c	2006-12-20 12:36:00.000000000 -0800
@@ -356,8 +356,8 @@ static int __devinit amd8111_probe(struc
 	smbus->adapter.algo = &smbus_algorithm;
 	smbus->adapter.algo_data = smbus;
 
-	/* set up the driverfs linkage to our parent device */
-	smbus->adapter.dev.parent = &dev->dev;
+	/* set up the driver model linkage to our parent device */
+	smbus->adapter.class_dev.dev = &dev->dev;
 
 	error = i2c_add_adapter(&smbus->adapter);
 	if (error)
Index: at91/drivers/i2c/busses/i2c-hydra.c
===================================================================
--- at91.orig/drivers/i2c/busses/i2c-hydra.c	2006-12-20 11:15:49.000000000 -0800
+++ at91/drivers/i2c/busses/i2c-hydra.c	2006-12-20 12:36:00.000000000 -0800
@@ -133,7 +133,7 @@ static int __devinit hydra_probe(struct 
 	}
 
 	pdregw(hydra_bit_data.data, 0);		/* clear SCLK_OE and SDAT_OE */
-	hydra_adap.dev.parent = &dev->dev;
+	hydra_adap.class_dev.dev = &dev->dev;
 	res = i2c_bit_add_bus(&hydra_adap);
 	if (res < 0) {
 		iounmap(hydra_bit_data.data);
Index: at91/drivers/i2c/busses/i2c-i801.c
===================================================================
--- at91.orig/drivers/i2c/busses/i2c-i801.c	2006-12-20 11:15:49.000000000 -0800
+++ at91/drivers/i2c/busses/i2c-i801.c	2006-12-20 12:36:00.000000000 -0800
@@ -522,8 +522,8 @@ static int __devinit i801_probe(struct p
 	else
 		dev_dbg(&dev->dev, "SMBus using PCI Interrupt\n");
 
-	/* set up the driverfs linkage to our parent device */
-	i801_adapter.dev.parent = &dev->dev;
+	/* set up the driver model linkage to our parent device */
+	i801_adapter.class_dev.dev = &dev->dev;
 
 	snprintf(i801_adapter.name, I2C_NAME_SIZE,
 		"SMBus I801 adapter at %04lx", i801_smba);
Index: at91/drivers/i2c/busses/i2c-i810.c
===================================================================
--- at91.orig/drivers/i2c/busses/i2c-i810.c	2006-12-20 11:15:49.000000000 -0800
+++ at91/drivers/i2c/busses/i2c-i810.c	2006-12-20 12:36:00.000000000 -0800
@@ -210,9 +210,9 @@ static int __devinit i810_probe(struct p
 		return retval;
 	dev_info(&dev->dev, "i810/i815 i2c device found.\n");
 
-	/* set up the sysfs linkage to our parent device */
-	i810_i2c_adapter.dev.parent = &dev->dev;
-	i810_ddc_adapter.dev.parent = &dev->dev;
+	/* set up the driver model linkage to our parent device */
+	i810_i2c_adapter.class_dev.dev = &dev->dev;
+	i810_ddc_adapter.class_dev.dev = &dev->dev;
 
 	retval = i2c_bit_add_bus(&i810_i2c_adapter);
 	if (retval)
Index: at91/drivers/i2c/busses/i2c-ibm_iic.c
===================================================================
--- at91.orig/drivers/i2c/busses/i2c-ibm_iic.c	2006-12-20 11:15:49.000000000 -0800
+++ at91/drivers/i2c/busses/i2c-ibm_iic.c	2006-12-20 12:36:00.000000000 -0800
@@ -727,6 +727,7 @@ static int __devinit iic_probe(struct oc
 	
 	/* Register it with i2c layer */
 	adap = &dev->adap;
+	adap->class_dev.dev = &ocp->dev;
 	strcpy(adap->name, "IBM IIC");
 	i2c_set_adapdata(adap, dev);
 	adap->id = I2C_HW_OCP;
Index: at91/drivers/i2c/busses/i2c-iop3xx.c
===================================================================
--- at91.orig/drivers/i2c/busses/i2c-iop3xx.c	2006-12-20 11:15:49.000000000 -0800
+++ at91/drivers/i2c/busses/i2c-iop3xx.c	2006-12-20 12:36:00.000000000 -0800
@@ -491,7 +491,7 @@ iop3xx_i2c_probe(struct platform_device 
 	memcpy(new_adapter->name, pdev->name, strlen(pdev->name));
 	new_adapter->id = I2C_HW_IOP3XX;
 	new_adapter->owner = THIS_MODULE;
-	new_adapter->dev.parent = &pdev->dev;
+	new_adapter->class_dev.dev = &pdev->dev;
 
 	/*
 	 * Default values...should these come in from board code?
Index: at91/drivers/i2c/busses/i2c-ixp2000.c
===================================================================
--- at91.orig/drivers/i2c/busses/i2c-ixp2000.c	2006-12-20 11:15:49.000000000 -0800
+++ at91/drivers/i2c/busses/i2c-ixp2000.c	2006-12-20 12:36:00.000000000 -0800
@@ -121,7 +121,7 @@ static int ixp2000_i2c_probe(struct plat
 		I2C_NAME_SIZE);
 	drv_data->adapter.algo_data = &drv_data->algo_data,
 
-	drv_data->adapter.dev.parent = &plat_dev->dev;
+	drv_data->adapter.class_dev.dev = &plat_dev->dev;
 
 	gpio_line_config(gpio->sda_pin, GPIO_IN);
 	gpio_line_config(gpio->scl_pin, GPIO_IN);
Index: at91/drivers/i2c/busses/i2c-ixp4xx.c
===================================================================
--- at91.orig/drivers/i2c/busses/i2c-ixp4xx.c	2006-12-20 11:15:49.000000000 -0800
+++ at91/drivers/i2c/busses/i2c-ixp4xx.c	2006-12-20 12:36:00.000000000 -0800
@@ -130,7 +130,7 @@ static int ixp4xx_i2c_probe(struct platf
 		I2C_NAME_SIZE);
 	drv_data->adapter.algo_data = &drv_data->algo_data;
 
-	drv_data->adapter.dev.parent = &plat_dev->dev;
+	drv_data->adapter.class_dev.dev = &plat_dev->dev;
 
 	gpio_line_config(gpio->scl_pin, IXP4XX_GPIO_IN);
 	gpio_line_config(gpio->sda_pin, IXP4XX_GPIO_IN);
Index: at91/drivers/i2c/busses/i2c-mpc.c
===================================================================
--- at91.orig/drivers/i2c/busses/i2c-mpc.c	2006-12-20 11:15:49.000000000 -0800
+++ at91/drivers/i2c/busses/i2c-mpc.c	2006-12-20 12:36:00.000000000 -0800
@@ -329,7 +329,7 @@ static int fsl_i2c_probe(struct platform
 
 	i2c->adap = mpc_ops;
 	i2c_set_adapdata(&i2c->adap, i2c);
-	i2c->adap.dev.parent = &pdev->dev;
+	i2c->adap.class_dev.dev = &pdev->dev;
 	if ((result = i2c_add_adapter(&i2c->adap)) < 0) {
 		printk(KERN_ERR "i2c-mpc - failed to add adapter\n");
 		goto fail_add;
Index: at91/drivers/i2c/busses/i2c-mv64xxx.c
===================================================================
--- at91.orig/drivers/i2c/busses/i2c-mv64xxx.c	2006-12-20 11:15:49.000000000 -0800
+++ at91/drivers/i2c/busses/i2c-mv64xxx.c	2006-12-20 12:36:00.000000000 -0800
@@ -520,6 +520,7 @@ mv64xxx_i2c_probe(struct platform_device
 		rc = -ENXIO;
 		goto exit_unmap_regs;
 	}
+	drv_data->adapter.class_dev.dev = &pd->dev;
 	drv_data->adapter.id = I2C_HW_MV64XXX;
 	drv_data->adapter.algo = &mv64xxx_i2c_algo;
 	drv_data->adapter.owner = THIS_MODULE;
Index: at91/drivers/i2c/busses/i2c-ocores.c
===================================================================
--- at91.orig/drivers/i2c/busses/i2c-ocores.c	2006-12-20 11:15:49.000000000 -0800
+++ at91/drivers/i2c/busses/i2c-ocores.c	2006-12-20 12:36:00.000000000 -0800
@@ -262,7 +262,7 @@ static int __devinit ocores_i2c_probe(st
 	platform_set_drvdata(pdev, i2c);
 	i2c->adap = ocores_adapter;
 	i2c_set_adapdata(&i2c->adap, i2c);
-	i2c->adap.dev.parent = &pdev->dev;
+	i2c->adap.class_dev.dev = &pdev->dev;
 
 	/* add i2c adapter to i2c tree */
 	ret = i2c_add_adapter(&i2c->adap);
Index: at91/drivers/i2c/busses/i2c-omap.c
===================================================================
--- at91.orig/drivers/i2c/busses/i2c-omap.c	2006-12-20 11:15:49.000000000 -0800
+++ at91/drivers/i2c/busses/i2c-omap.c	2006-12-20 16:27:42.000000000 -0800
@@ -602,7 +602,7 @@ omap_i2c_probe(struct platform_device *p
 	adap->class = I2C_CLASS_HWMON;
 	strncpy(adap->name, "OMAP I2C adapter", sizeof(adap->name));
 	adap->algo = &omap_i2c_algo;
-	adap->dev.parent = &pdev->dev;
+	adap->class_dev.dev = &pdev->dev;
 
 	/* i2c device drivers may be active on return from add_adapter() */
 	r = i2c_add_adapter(adap);
Index: at91/drivers/i2c/busses/i2c-piix4.c
===================================================================
--- at91.orig/drivers/i2c/busses/i2c-piix4.c	2006-12-20 12:35:59.000000000 -0800
+++ at91/drivers/i2c/busses/i2c-piix4.c	2006-12-20 12:36:00.000000000 -0800
@@ -428,8 +428,8 @@ static int __devinit piix4_probe(struct 
 	if (retval)
 		return retval;
 
-	/* set up the driverfs linkage to our parent device */
-	piix4_adapter.dev.parent = &dev->dev;
+	/* set up the driver model linkage to our parent device */
+	piix4_adapter.class_dev.dev = &dev->dev;
 
 	snprintf(piix4_adapter.name, I2C_NAME_SIZE,
 		"SMBus PIIX4 adapter at %04x", piix4_smba);
Index: at91/drivers/i2c/busses/i2c-powermac.c
===================================================================
--- at91.orig/drivers/i2c/busses/i2c-powermac.c	2006-12-20 11:15:49.000000000 -0800
+++ at91/drivers/i2c/busses/i2c-powermac.c	2006-12-20 12:36:00.000000000 -0800
@@ -250,7 +250,7 @@ static int __devexit i2c_powermac_probe(
 	strcpy(adapter->name, name);
 	adapter->algo = &i2c_powermac_algorithm;
 	i2c_set_adapdata(adapter, bus);
-	adapter->dev.parent = &dev->dev;
+	adapter->class_dev.dev = &dev->dev;
 	pmac_i2c_attach_adapter(bus, adapter);
 	rc = i2c_add_adapter(adapter);
 	if (rc) {
Index: at91/drivers/i2c/busses/i2c-prosavage.c
===================================================================
--- at91.orig/drivers/i2c/busses/i2c-prosavage.c	2006-12-20 11:15:49.000000000 -0800
+++ at91/drivers/i2c/busses/i2c-prosavage.c	2006-12-20 12:36:00.000000000 -0800
@@ -174,7 +174,7 @@ static int i2c_register_bus(struct pci_d
 	p->adap.owner	  = THIS_MODULE;
 	p->adap.id	  = I2C_HW_B_S3VIA;
 	p->adap.algo_data = &p->algo;
-	p->adap.dev.parent = &dev->dev;
+	p->adap.class_dev.dev = &dev->dev;
 	p->algo.setsda	  = bit_s3via_setsda;
 	p->algo.setscl	  = bit_s3via_setscl;
 	p->algo.getsda	  = bit_s3via_getsda;
Index: at91/drivers/i2c/busses/i2c-pxa.c
===================================================================
--- at91.orig/drivers/i2c/busses/i2c-pxa.c	2006-12-20 12:35:59.000000000 -0800
+++ at91/drivers/i2c/busses/i2c-pxa.c	2006-12-20 12:36:00.000000000 -0800
@@ -871,7 +871,7 @@ static int i2c_pxa_probe(struct platform
 	i2c_pxa_reset(i2c);
 
 	i2c->adap.algo_data = i2c;
-	i2c->adap.dev.parent = &dev->dev;
+	i2c->adap.class_dev.dev = &dev->dev;
 
 	ret = i2c_add_adapter(&i2c->adap);
 	if (ret < 0) {
Index: at91/drivers/i2c/busses/i2c-s3c2410.c
===================================================================
--- at91.orig/drivers/i2c/busses/i2c-s3c2410.c	2006-12-20 12:35:59.000000000 -0800
+++ at91/drivers/i2c/busses/i2c-s3c2410.c	2006-12-20 12:36:00.000000000 -0800
@@ -808,7 +808,7 @@ static int s3c24xx_i2c_probe(struct plat
 	/* setup info block for the i2c core */
 
 	i2c->adap.algo_data = i2c;
-	i2c->adap.dev.parent = &pdev->dev;
+	i2c->adap.class_dev.dev = &pdev->dev;
 
 	/* initialise the i2c controller */
 
Index: at91/drivers/i2c/busses/i2c-savage4.c
===================================================================
--- at91.orig/drivers/i2c/busses/i2c-savage4.c	2006-12-20 11:15:49.000000000 -0800
+++ at91/drivers/i2c/busses/i2c-savage4.c	2006-12-20 12:36:00.000000000 -0800
@@ -165,8 +165,8 @@ static int __devinit savage4_probe(struc
 	if (retval)
 		return retval;
 
-	/* set up the sysfs linkage to our parent device */
-	savage4_i2c_adapter.dev.parent = &dev->dev;
+	/* set up the driver model linkage to our parent device */
+	savage4_i2c_adapter.class_dev.dev = &dev->dev;
 
 	return i2c_bit_add_bus(&savage4_i2c_adapter);
 }
Index: at91/drivers/i2c/busses/i2c-sis5595.c
===================================================================
--- at91.orig/drivers/i2c/busses/i2c-sis5595.c	2006-12-20 12:35:59.000000000 -0800
+++ at91/drivers/i2c/busses/i2c-sis5595.c	2006-12-20 12:36:00.000000000 -0800
@@ -386,8 +386,8 @@ static int __devinit sis5595_probe(struc
 		return -ENODEV;
 	}
 
-	/* set up the driverfs linkage to our parent device */
-	sis5595_adapter.dev.parent = &dev->dev;
+	/* set up the driver model linkage to our parent device */
+	sis5595_adapter.class_dev.dev = &dev->dev;
 
 	sprintf(sis5595_adapter.name, "SMBus SIS5595 adapter at %04x",
 		sis5595_base + SMB_INDEX);
Index: at91/drivers/i2c/busses/i2c-sis630.c
===================================================================
--- at91.orig/drivers/i2c/busses/i2c-sis630.c	2006-12-20 12:35:59.000000000 -0800
+++ at91/drivers/i2c/busses/i2c-sis630.c	2006-12-20 12:36:00.000000000 -0800
@@ -490,8 +490,8 @@ static int __devinit sis630_probe(struct
 		return -ENODEV;
 	}
 
-	/* set up the driverfs linkage to our parent device */
-	sis630_adapter.dev.parent = &dev->dev;
+	/* set up the driver model linkage to our parent device */
+	sis630_adapter.class_dev.dev = &dev->dev;
 
 	sprintf(sis630_adapter.name, "SMBus SIS630 adapter at %04x",
 		acpi_base + SMB_STS);
Index: at91/drivers/i2c/busses/i2c-sis96x.c
===================================================================
--- at91.orig/drivers/i2c/busses/i2c-sis96x.c	2006-12-20 12:35:59.000000000 -0800
+++ at91/drivers/i2c/busses/i2c-sis96x.c	2006-12-20 12:36:00.000000000 -0800
@@ -302,8 +302,8 @@ static int __devinit sis96x_probe(struct
 		return -EINVAL;
 	}
 
-	/* set up the driverfs linkage to our parent device */
-	sis96x_adapter.dev.parent = &dev->dev;
+	/* set up the driver model linkage to our parent device */
+	sis96x_adapter.class_dev.dev = &dev->dev;
 
 	snprintf(sis96x_adapter.name, I2C_NAME_SIZE,
 		"SiS96x SMBus adapter at 0x%04x", sis96x_smbus_base);
Index: at91/drivers/i2c/busses/i2c-via.c
===================================================================
--- at91.orig/drivers/i2c/busses/i2c-via.c	2006-12-20 11:15:49.000000000 -0800
+++ at91/drivers/i2c/busses/i2c-via.c	2006-12-20 12:36:00.000000000 -0800
@@ -137,8 +137,8 @@ static int __devinit vt586b_probe(struct
 	outb(inb(I2C_DIR) & ~(I2C_SDA | I2C_SCL), I2C_DIR);
 	outb(inb(I2C_OUT) & ~(I2C_SDA | I2C_SCL), I2C_OUT);
 
-	/* set up the driverfs linkage to our parent device */
-	vt586b_adapter.dev.parent = &dev->dev;
+	/* set up the driver model linkage to our parent device */
+	vt586b_adapter.class_dev.dev = &dev->dev;
 
 	res = i2c_bit_add_bus(&vt586b_adapter);
 	if ( res < 0 ) {
Index: at91/drivers/i2c/busses/i2c-viapro.c
===================================================================
--- at91.orig/drivers/i2c/busses/i2c-viapro.c	2006-12-20 12:35:59.000000000 -0800
+++ at91/drivers/i2c/busses/i2c-viapro.c	2006-12-20 12:36:00.000000000 -0800
@@ -405,7 +405,7 @@ found:
 		break;
 	}
 
-	vt596_adapter.dev.parent = &pdev->dev;
+	vt596_adapter.class_dev.dev = &pdev->dev;
 	snprintf(vt596_adapter.name, I2C_NAME_SIZE,
 		 "SMBus Via Pro adapter at %04x", vt596_smba);
 
Index: at91/drivers/i2c/busses/i2c-voodoo3.c
===================================================================
--- at91.orig/drivers/i2c/busses/i2c-voodoo3.c	2006-12-20 11:15:49.000000000 -0800
+++ at91/drivers/i2c/busses/i2c-voodoo3.c	2006-12-20 12:36:00.000000000 -0800
@@ -202,9 +202,9 @@ static int __devinit voodoo3_probe(struc
 	if (retval)
 		return retval;
 
-	/* set up the sysfs linkage to our parent device */
-	voodoo3_i2c_adapter.dev.parent = &dev->dev;
-	voodoo3_ddc_adapter.dev.parent = &dev->dev;
+	/* set up the driver model linkage to our parent device */
+	voodoo3_i2c_adapter.class_dev.dev = &dev->dev;
+	voodoo3_ddc_adapter.class_dev.dev = &dev->dev;
 
 	retval = i2c_bit_add_bus(&voodoo3_i2c_adapter);
 	if (retval)
Index: at91/drivers/media/common/saa7146_i2c.c
===================================================================
--- at91.orig/drivers/media/common/saa7146_i2c.c	2006-12-20 11:15:49.000000000 -0800
+++ at91/drivers/media/common/saa7146_i2c.c	2006-12-20 12:36:00.000000000 -0800
@@ -409,7 +409,7 @@ int saa7146_i2c_adapter_prepare(struct s
 	if( NULL != i2c_adapter ) {
 		BUG_ON(!i2c_adapter->class);
 		i2c_set_adapdata(i2c_adapter,dev);
-		i2c_adapter->dev.parent    = &dev->pci->dev;
+		i2c_adapter->class_dev.dev = &dev->pci->dev;
 		i2c_adapter->algo	   = &saa7146_algo;
 		i2c_adapter->algo_data     = NULL;
 		i2c_adapter->id		   = I2C_HW_SAA7146;
Index: at91/drivers/media/dvb/pluto2/pluto2.c
===================================================================
--- at91.orig/drivers/media/dvb/pluto2/pluto2.c	2006-12-20 11:15:49.000000000 -0800
+++ at91/drivers/media/dvb/pluto2/pluto2.c	2006-12-20 12:36:00.000000000 -0800
@@ -629,7 +629,7 @@ static int __devinit pluto2_probe(struct
 	strcpy(pluto->i2c_adap.name, DRIVER_NAME);
 	pluto->i2c_adap.owner = THIS_MODULE;
 	pluto->i2c_adap.class = I2C_CLASS_TV_DIGITAL;
-	pluto->i2c_adap.dev.parent = &pdev->dev;
+	pluto->i2c_adap.class_dev.dev = &pdev->dev;
 	pluto->i2c_adap.algo_data = &pluto->i2c_bit;
 	pluto->i2c_bit.data = pluto;
 	pluto->i2c_bit.setsda = pluto_setsda;
Index: at91/drivers/media/video/bt8xx/bttv-i2c.c
===================================================================
--- at91.orig/drivers/media/video/bt8xx/bttv-i2c.c	2006-12-20 11:15:49.000000000 -0800
+++ at91/drivers/media/video/bt8xx/bttv-i2c.c	2006-12-20 12:36:00.000000000 -0800
@@ -449,7 +449,7 @@ int __devinit init_bttv_i2c(struct bttv 
 		btv->c.i2c_adap.algo_data = &btv->i2c_algo;
 	}
 
-	btv->c.i2c_adap.dev.parent = &btv->c.pci->dev;
+	btv->c.i2c_adap.class_dev.dev = &btv->c.pci->dev;
 	snprintf(btv->c.i2c_adap.name, sizeof(btv->c.i2c_adap.name),
 		 "bt%d #%d [%s]", btv->id, btv->c.nr,
 		 btv->use_i2c_hw ? "hw" : "sw");
Index: at91/drivers/media/video/cx88/cx88-i2c.c
===================================================================
--- at91.orig/drivers/media/video/cx88/cx88-i2c.c	2006-12-20 11:15:49.000000000 -0800
+++ at91/drivers/media/video/cx88/cx88-i2c.c	2006-12-20 12:36:00.000000000 -0800
@@ -223,7 +223,7 @@ int cx88_i2c_init(struct cx88_core *core
 	if (cx88_boards[core->board].mpeg & CX88_MPEG_DVB)
 		core->i2c_adap.class |= I2C_CLASS_TV_DIGITAL;
 
-	core->i2c_adap.dev.parent = &pci->dev;
+	core->i2c_adap.class_dev.dev = &pci->dev;
 	strlcpy(core->i2c_adap.name,core->name,sizeof(core->i2c_adap.name));
 	core->i2c_algo.data = core;
 	i2c_set_adapdata(&core->i2c_adap,core);
Index: at91/drivers/media/video/cx88/cx88-vp3054-i2c.c
===================================================================
--- at91.orig/drivers/media/video/cx88/cx88-vp3054-i2c.c	2006-12-20 11:15:49.000000000 -0800
+++ at91/drivers/media/video/cx88/cx88-vp3054-i2c.c	2006-12-20 12:36:00.000000000 -0800
@@ -138,7 +138,7 @@ int vp3054_i2c_probe(struct cx8802_dev *
 
 	vp3054_i2c->adap.class |= I2C_CLASS_TV_DIGITAL;
 
-	vp3054_i2c->adap.dev.parent = &dev->pci->dev;
+	vp3054_i2c->adap.class_dev.dev = &dev->pci->dev;
 	strlcpy(vp3054_i2c->adap.name, core->name,
 		sizeof(vp3054_i2c->adap.name));
 	vp3054_i2c->algo.data = dev;
Index: at91/drivers/media/video/em28xx/em28xx-i2c.c
===================================================================
--- at91.orig/drivers/media/video/em28xx/em28xx-i2c.c	2006-12-20 11:15:49.000000000 -0800
+++ at91/drivers/media/video/em28xx/em28xx-i2c.c	2006-12-20 12:36:00.000000000 -0800
@@ -552,7 +552,7 @@ int em28xx_i2c_register(struct em28xx *d
 	BUG_ON(!dev->em28xx_write_regs || !dev->em28xx_read_reg);
 	BUG_ON(!dev->em28xx_write_regs_req || !dev->em28xx_read_reg_req);
 	dev->i2c_adap = em28xx_adap_template;
-	dev->i2c_adap.dev.parent = &dev->udev->dev;
+	dev->i2c_adap.class_dev.dev = &dev->udev->dev;
 	strcpy(dev->i2c_adap.name, dev->name);
 	dev->i2c_adap.algo_data = dev;
 	i2c_add_adapter(&dev->i2c_adap);
Index: at91/drivers/media/video/saa7134/saa7134-i2c.c
===================================================================
--- at91.orig/drivers/media/video/saa7134/saa7134-i2c.c	2006-12-20 11:15:49.000000000 -0800
+++ at91/drivers/media/video/saa7134/saa7134-i2c.c	2006-12-20 12:36:00.000000000 -0800
@@ -465,7 +465,7 @@ void saa7134_i2c_call_clients(struct saa
 int saa7134_i2c_register(struct saa7134_dev *dev)
 {
 	dev->i2c_adap = saa7134_adap_template;
-	dev->i2c_adap.dev.parent = &dev->pci->dev;
+	dev->i2c_adap.class_dev.dev = &dev->pci->dev;
 	strcpy(dev->i2c_adap.name,dev->name);
 	dev->i2c_adap.algo_data = dev;
 	i2c_add_adapter(&dev->i2c_adap);
Index: at91/drivers/i2c/busses/i2c-nforce2.c
===================================================================
--- at91.orig/drivers/i2c/busses/i2c-nforce2.c	2006-12-20 12:35:59.000000000 -0800
+++ at91/drivers/i2c/busses/i2c-nforce2.c	2006-12-20 12:36:00.000000000 -0800
@@ -243,7 +243,7 @@ static int __devinit nforce2_probe_smb (
 	smbus->adapter.class = I2C_CLASS_HWMON;
 	smbus->adapter.algo = &smbus_algorithm;
 	smbus->adapter.algo_data = smbus;
-	smbus->adapter.dev.parent = &dev->dev;
+	smbus->adapter.class_dev.dev = &dev->dev;
 	snprintf(smbus->adapter.name, I2C_NAME_SIZE,
 		"SMBus nForce2 adapter at %04x", smbus->base);
 
Index: at91/drivers/i2c/busses/i2c-pnx.c
===================================================================
--- at91.orig/drivers/i2c/busses/i2c-pnx.c	2006-12-20 12:35:59.000000000 -0800
+++ at91/drivers/i2c/busses/i2c-pnx.c	2006-12-20 12:36:00.000000000 -0800
@@ -641,7 +641,7 @@ static int __devinit i2c_pnx_probe(struc
 		goto out_clock;
 
 	/* Register this adapter with the I2C subsystem */
-	i2c_pnx->adapter->dev.parent = &pdev->dev;
+	i2c_pnx->adapter->class_dev.dev = &pdev->dev;
 	ret = i2c_add_adapter(i2c_pnx->adapter);
 	if (ret < 0) {
 		dev_err(&pdev->dev, "I2C: Failed to add bus\n");
Index: at91/drivers/i2c/busses/i2c-versatile.c
===================================================================
--- at91.orig/drivers/i2c/busses/i2c-versatile.c	2006-12-20 11:15:49.000000000 -0800
+++ at91/drivers/i2c/busses/i2c-versatile.c	2006-12-20 12:36:00.000000000 -0800
@@ -98,7 +98,7 @@ static int i2c_versatile_probe(struct pl
 	i2c->adap.owner = THIS_MODULE;
 	strlcpy(i2c->adap.name, "Versatile I2C adapter", sizeof(i2c->adap.name));
 	i2c->adap.algo_data = &i2c->algo;
-	i2c->adap.dev.parent = &dev->dev;
+	i2c->adap.class_dev.dev = &dev->dev;
 	i2c->algo = i2c_versatile_algo;
 	i2c->algo.data = i2c;
 
Index: at91/drivers/video/aty/radeon_i2c.c
===================================================================
--- at91.orig/drivers/video/aty/radeon_i2c.c	2006-12-20 11:15:49.000000000 -0800
+++ at91/drivers/video/aty/radeon_i2c.c	2006-12-20 12:36:00.000000000 -0800
@@ -74,7 +74,7 @@ static int radeon_setup_i2c_bus(struct r
 	chan->adapter.owner		= THIS_MODULE;
 	chan->adapter.id		= I2C_HW_B_RADEON;
 	chan->adapter.algo_data		= &chan->algo;
-	chan->adapter.dev.parent	= &chan->rinfo->pdev->dev;
+	chan->adapter.class_dev.dev	= &chan->rinfo->pdev->dev;
 	chan->algo.setsda		= radeon_gpio_setsda;
 	chan->algo.setscl		= radeon_gpio_setscl;
 	chan->algo.getsda		= radeon_gpio_getsda;
Index: at91/drivers/video/i810/i810-i2c.c
===================================================================
--- at91.orig/drivers/video/i810/i810-i2c.c	2006-12-20 11:15:49.000000000 -0800
+++ at91/drivers/video/i810/i810-i2c.c	2006-12-20 12:36:00.000000000 -0800
@@ -90,7 +90,7 @@ static int i810_setup_i2c_bus(struct i81
         strcpy(chan->adapter.name, name);
         chan->adapter.owner             = THIS_MODULE;
         chan->adapter.algo_data         = &chan->algo;
-        chan->adapter.dev.parent        = &chan->par->dev->dev;
+        chan->adapter.class_dev.dev     = &chan->par->dev->dev;
 	chan->adapter.id                = I2C_HW_B_I810;
 	chan->algo.setsda               = i810i2c_setsda;
 	chan->algo.setscl               = i810i2c_setscl;
Index: at91/drivers/video/intelfb/intelfb_i2c.c
===================================================================
--- at91.orig/drivers/video/intelfb/intelfb_i2c.c	2006-12-20 11:15:49.000000000 -0800
+++ at91/drivers/video/intelfb/intelfb_i2c.c	2006-12-20 12:36:00.000000000 -0800
@@ -109,7 +109,7 @@ static int intelfb_setup_i2c_bus(struct 
 	chan->adapter.owner			= THIS_MODULE;
 	chan->adapter.id			= I2C_HW_B_INTELFB;
 	chan->adapter.algo_data		= &chan->algo;
-	chan->adapter.dev.parent	= &chan->dinfo->pdev->dev;
+	chan->adapter.class_dev.dev	= &chan->dinfo->pdev->dev;
 	chan->algo.setsda			= intelfb_gpio_setsda;
 	chan->algo.setscl			= intelfb_gpio_setscl;
 	chan->algo.getsda			= intelfb_gpio_getsda;
Index: at91/drivers/video/nvidia/nv_i2c.c
===================================================================
--- at91.orig/drivers/video/nvidia/nv_i2c.c	2006-12-20 11:15:49.000000000 -0800
+++ at91/drivers/video/nvidia/nv_i2c.c	2006-12-20 12:36:00.000000000 -0800
@@ -97,7 +97,7 @@ static int nvidia_setup_i2c_bus(struct n
 	chan->adapter.owner = THIS_MODULE;
 	chan->adapter.id = I2C_HW_B_NVIDIA;
 	chan->adapter.algo_data = &chan->algo;
-	chan->adapter.dev.parent = &chan->par->pci_dev->dev;
+	chan->adapter.class_dev.dev = &chan->par->pci_dev->dev;
 	chan->algo.setsda = nvidia_gpio_setsda;
 	chan->algo.setscl = nvidia_gpio_setscl;
 	chan->algo.getsda = nvidia_gpio_getsda;
Index: at91/drivers/video/riva/rivafb-i2c.c
===================================================================
--- at91.orig/drivers/video/riva/rivafb-i2c.c	2006-12-20 11:15:49.000000000 -0800
+++ at91/drivers/video/riva/rivafb-i2c.c	2006-12-20 12:36:00.000000000 -0800
@@ -97,7 +97,7 @@ static int riva_setup_i2c_bus(struct riv
 	chan->adapter.owner		= THIS_MODULE;
 	chan->adapter.id		= I2C_HW_B_RIVA;
 	chan->adapter.algo_data		= &chan->algo;
-	chan->adapter.dev.parent	= &chan->par->pdev->dev;
+	chan->adapter.class_dev.dev	= &chan->par->pdev->dev;
 	chan->algo.setsda		= riva_gpio_setsda;
 	chan->algo.setscl		= riva_gpio_setscl;
 	chan->algo.getsda		= riva_gpio_getsda;
Index: at91/drivers/video/savage/savagefb-i2c.c
===================================================================
--- at91.orig/drivers/video/savage/savagefb-i2c.c	2006-12-20 11:15:49.000000000 -0800
+++ at91/drivers/video/savage/savagefb-i2c.c	2006-12-20 12:36:00.000000000 -0800
@@ -146,7 +146,7 @@ static int savage_setup_i2c_bus(struct s
 		chan->adapter.owner		= THIS_MODULE;
 		chan->adapter.id		= I2C_HW_B_SAVAGE;
 		chan->adapter.algo_data		= &chan->algo;
-		chan->adapter.dev.parent	= &chan->par->pcidev->dev;
+		chan->adapter.class_dev.dev	= &chan->par->pcidev->dev;
 		chan->algo.udelay		= 40;
 		chan->algo.timeout		= 20;
 		chan->algo.data 		= chan;



More information about the i2c mailing list