Re: I2C Driver: Attach_adapter VS Probe or Detect

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

 



On Thu, Sep 30, 2010 at 2:45 AM, Dev Null <devnullfin@xxxxxxxxx> wrote:
> What are the pitfalls of using attach_adapter and detach_adapter way of
> driver detection? I know its old way and its for legacy drivers.

This approach has to be  used when you are not aware on which i2c bus
is your chip connected to.
So you have to probe on all the adapters for a particular i2c chip.
But on an embedded board, I2C bus number is known in advance. So using
the method Silesh suggested can save booting time by avoiding
unnecessary probing for the chip on all the adapters.

Have a look here,
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=blob;f=Documentation/i2c/instantiating-devices

Arun

> I am using the i2c driver and lm sensors drivers that is also i2c driver
> through SMBus. If I run my system for longer period of time  i.e. 48 hours,
> then it hangs on reboot. Somehow, CPU doesn't get reset signal.
>
>
> On Wed, Sep 29, 2010 at 3:08 AM, Silesh C V <saileshcv@xxxxxxxxx> wrote:
>>
>> Hello,
>>
>> On Wed, Sep 29, 2010 at 12:57 AM, Dev Null <devnullfin@xxxxxxxxx> wrote:
>> > Hello,
>> > I have been using the I2C driver and the driver detection routine
>> > through
>> > attach_adapter in that driver. In attach_adapter, I am calling i2c_probe
>> > i2c_core call back function for the device detection.
>> > There is an another way of detecting the I2C device through probe
>> > routine
>> > and detect routine.
>> > I have looked into i2c.h and the author has mentioned that
>> > attach_adapter
>> > and detach_adapter routines are for legacy drivers.
>> > Is attach_adapter and detach_adapter way of driver detection method okay
>> > to
>> > use?
>>
>> IMO, the simplest way is using probe/remove in struct i2c_driver and
>> use i2c_board_info and i2c_device_id to match it with your device. You
>> do not have to use attach_adapter and detach_adapter.
>>
>> > I have been getting some issue in the SMBus through i2c-core. Do you
>> > think
>> > this could be the source of that issue?
>>
>> What kind of issue ?
>>
>> Regards,
>> Silesh
>
>

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ




[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux