All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC][2.6] Additional i2c adapter flags for i2c client isolation
@ 2004-03-16  9:25 Michael Hunold
  2004-03-16 13:26 ` Adrian Cox
  2005-05-19  6:24   ` Greg KH
  0 siblings, 2 replies; 20+ messages in thread
From: Michael Hunold @ 2004-03-16  9:25 UTC (permalink / raw)
  To: Linux Kernel Mailing List

Hello all,

the DVB subsystem currently has it's own i2c subsystem and I'm working 
on going back to in-kernel i2c.

The original problem that made a colleague create a separate i2c 
subsystem was that i2c client  drivers were probing on new appearing 
busses unconditionally. The worst  example were the Matrox clients that 
were driving other i2c busses besides the ones on the Matrox adapters nuts.

The problem is that some i2c busses on some dvb cards *really* don't 
like being probed by unknown clients on unknown address ranges.

Most i2c client drivers check in their attach_adapter() function if they
need to probe by investigating the adapter->id. But not all.

Unfortunately, this only keeps well-written clients from attaching. The 
i2c-core unconditionally tells every i2c client every new i2c adapter. 
If the i2c-client doesn't check the adapter->id, then it can screw up 
the i2c bus anyway:

int i2c_add_adapter(struct i2c_adapter *adap)
{
[...]
  /* inform drivers of new adapters */
   list_for_each(item,&drivers) {
   driver = list_entry(item, struct i2c_driver, list);
   if (driver->flags & I2C_DF_NOTIFY)
    /* We ignore the return code; if it fails, too bad */
    driver->attach_adapter(adap);
[...]

Here, all client drivers are unconditionally told to try and attach to
the adapter. There is no way that an i2c adapter can keep an i2c driver
away from the bus.

Currently, adapters can already specify a class, for DVB
I2C_ADAP_CLASS_TV_DIGITAL matches perfectly.

What I'd like to have is that client can specify some sort of "class",
too, and that i2c adapters can tell the core that only clients where the
class is matching are allowed to probe their existence.

The above code snippet would then probably look like this:

int i2c_add_adapter(struct i2c_adapter *adap)
{
[...]
  /* inform drivers of new adapters */
  list_for_each(item,&drivers) {
   driver = list_entry(item, struct i2c_driver, list);
   /* skip driver if it specifies a class and class to the
      adapter does not match */
   if (driver->class != 0 && driver->class != adap->client_class)
     continue;	
   if (driver->flags & I2C_DF_NOTIFY)
     /* We ignore the return code; if it fails, too bad */
     driver->attach_adapter(adap);
[...]

This would greatly help to keep any i2c client driver away from the i2c
bus of the dvb card besides the dvb i2c drivers.

Do you think this is feasible? If so, I'd be happy to prepare a patch to
outline my ideas with some lines of code.

CU
Michael.


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

end of thread, other threads:[~2005-05-19  6:24 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-03-16  9:25 [RFC][2.6] Additional i2c adapter flags for i2c client isolation Michael Hunold
2004-03-16 13:26 ` Adrian Cox
2004-03-16 14:23   ` Michael Hunold
2004-03-16 15:44 ` Greg KH
2005-05-19  6:24   ` Greg KH
2004-03-16 19:14   ` Jean Delvare
2005-05-19  6:24     ` [RFC][2.6] Additional i2c adapter flags for i2c client Jean Delvare
2004-03-16 19:53     ` [RFC][2.6] Additional i2c adapter flags for i2c client isolation Greg KH
2005-05-19  6:24       ` Greg KH
2004-03-17  9:17       ` Jean Delvare
2005-05-19  6:24         ` Jean Delvare
2004-03-17 17:42         ` Greg KH
2005-05-19  6:24           ` Greg KH
2004-03-17 20:05           ` Jean Delvare
2005-05-19  6:24             ` [RFC][2.6] Additional i2c adapter flags for i2c client Jean Delvare
2004-03-17 23:11             ` [RFC][2.6] Additional i2c adapter flags for i2c client isolation Greg KH
2005-05-19  6:24               ` Greg KH
2004-03-18 15:56   ` Michael Hunold
2005-05-19  6:24     ` Michael Hunold
2005-05-19  6:24   ` [RFC][2.6] Additional i2c adapter flags for i2c client Jean Delvare

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.