Re: Dynamically-allocated i2c_device_id vs MODULE_DEVICE_TABLE

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Jan 23, 2009 at 03:03:19PM -0600, Timur Tabi wrote:

> The problem I'm having is the MODULE_DEVICE_TABLE.  What I really should be
> doing is this:

> 	socdev = kmalloc(...);
> 	struct i2c_driver *cs4270_i2c_driver = kmalloc(...);
> 	struct i2c_device_id *cs4270_id = kmalloc(...);
> 	cs4270_i2c_driver->id_table = cs4270_id;
> 	c24270_id->driver_data = socdev;
> 	i2c_add_driver(cs4270_i2c_driver);

This is because the ASoC core still hasn't quite got the idea of
instantiating the differnet bits of the device separately.  Really what
you're having to do here is fairly nasty and there's no good reason for
it to be supported - if something is being registered dynamically and
passing instantiation specific data around it really should be the
device and not the driver.  The fact that attempting to do this looks
bad is a win on the part of the I2C core.

For now an idiomatic solution for ASoC drivers is to have a single
static variable that you use to get the socdev through.
--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux GPIO]     [Linux SPI]     [Linux Hardward Monitoring]     [LM Sensors]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux