@@ -98,6 +98,8 @@ static unsigned write_timeout = 25;
9898module_param (write_timeout , uint , 0 );
9999MODULE_PARM_DESC (write_timeout , "Time (in ms) to try writes (default 25)" );
100100
101+ static struct kobject * eeprom_kobj ;
102+
101103#define AT24_SIZE_BYTELEN 5
102104#define AT24_SIZE_FLAGS 8
103105
@@ -296,6 +298,13 @@ static ssize_t at24_bin_read(struct file *filp, struct kobject *kobj,
296298 return at24_read (at24 , buf , off , count );
297299}
298300
301+ void at24_read_eeprom (char * buf , loff_t off , size_t count )
302+ {
303+ struct at24_data * at24 ;
304+
305+ at24 = dev_get_drvdata (container_of (eeprom_kobj , struct device , kobj ));
306+ at24_read (at24 , buf , off , count );
307+ }
299308
300309/*
301310 * Note that if the hardware write-protect pin is pulled high, the whole
@@ -637,6 +646,7 @@ static int at24_probe(struct i2c_client *client, const struct i2c_device_id *id)
637646 if (err )
638647 goto err_clients ;
639648
649+ eeprom_kobj = & client -> dev .kobj ;
640650 i2c_set_clientdata (client , at24 );
641651
642652 dev_info (& client -> dev , "%zu byte %s EEPROM, %s, %u bytes/write\n" ,
0 commit comments