[i2c] [PATCH] i2c: Add write support to the EEPROM driver

Jean Delvare khali at linux-fr.org
Sat Aug 11 19:09:45 CEST 2007


Hi Martin,

On Thu, 9 Aug 2007 11:47:40 -0400, Martin Hicks wrote:
> 
> This adds write support to the i2c eeprom driver.  I suspect that
> this is extremely dangerous due to what is sometimes stored in these
> chips.  Added a separate Kconfig option to enable it.

Yes, it is extremely dangerous, and this is the reason why I've always
rejected patches like the one you're sending now. Even if it's a
separate compilation option, it's still not safe enough, because the
"eeprom" driver attaches to all EEPROMs it finds on the system. As soon
as it's enabled, write support will put all these EEPROMs at risk, even
if there's only one EEPROM you need to write to. We simply can't do
that.

The "eeprom" driver is only a hack to let user-space read SPD and EDID
data easily. If you're doing any serious work with EEPROMs, that's not
what you need. I suggest that you either do it from user-space using
i2c-dev (there are tools for that under prog/eepromer in the lm-sensors
package), or take a look at the "at24c" driver by David Brownell:
http://lists.lm-sensors.org/pipermail/i2c/2006-December/000561.html

It's not upstream yet, as nobody took the time to review it, but if you
want to work with EEPROMs in the kernel space, then that's the way to
go. The "at24c" driver should be converted to a new-style i2c driver
first though. If you're interested, please work with David on this.

The "eeprom" driver is NEVER going to receive write support.

-- 
Jean Delvare



More information about the i2c mailing list