Re: [PATCH 6/6] RTC: Trivially probe for an M41T80 (#2)

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Jean Delvare
Date: Monday, May 19, 2008 - 1:37 pm

Hi Maciej,

On Wed, 14 May 2008 02:13:34 +0100 (BST), Maciej W. Rozycki wrote:

As I wrote above: the I2C device will be listed as present forever. I
believe it's pretty confusing to have a device listed
under /sys/bus/i2c/devices which is in fact not present on the system.
On top of that, in case of modular setups with proper coldplug support,
the I2C device driver will be loaded automatically when the device is
declared, but will not be removed automatically when the probe fails,
so this is wasted memory.


The comparison with ISA devices does not hold: ISA devices are created
by their own drivers (much like the legacy I2C device drivers.) Thus,
when the probe fails, they can simply delete the device they created (or
even better, they can delay the device creation until they are sure
that the device is there.) New-style I2C device drivers do not create
their devices, so they don't get a chance to delete them nor to delay
their creation.


It could certainly be implemented in terms of i2c_new_probed_device()
in i2c-sibyte, if it was a proper platform driver with proper platform
data. I admit it wouldn't be necessarily very elegant, in particular if
we have more similar cases in the future. That could still do for now,
though. Converting i2c-sibyte to a proper platform driver is needed
anyway.


The flag in struct i2c_board_info would trigger the exact same probing
mechanism as i2c_new_probed_device() does. The whole point it to test
for the presence of the device _before_ its driver is loaded. It you
have to let the I2C device driver decide, then it's already too late:
the I2C device is created and it won't go even if the probe fails.

If said probing mechanism doesn't work properly for some devices, we'll
improve it, but it has to stay in i2c-core.


Agreed.

-- 
Jean Delvare
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 6/6] RTC: Trivially probe for an M41T80 (#2), Maciej W. Rozycki, (Mon May 12, 8:27 pm)
Re: [PATCH 6/6] RTC: Trivially probe for an M41T80 (#2), Jean Delvare, (Tue May 13, 5:28 am)
Re: [PATCH 6/6] RTC: Trivially probe for an M41T80 (#2), Maciej W. Rozycki, (Tue May 13, 6:13 pm)
Re: [PATCH 6/6] RTC: Trivially probe for an M41T80 (#2), Jean Delvare, (Mon May 19, 1:37 pm)
Re: [PATCH 6/6] RTC: Trivially probe for an M41T80 (#2), David Brownell, (Thu May 22, 8:07 pm)