On Fri, Jan 14, 2011 at 10:19:12AM +0100, Sascha Hauer wrote: > Hi Marc, > > > + > > +static int at24_probe(struct device_d *dev) > > +{ > > + struct at24 *at24; > > + struct at24_platform_data *pdata; > > + at24 = xzalloc(sizeof(*at24)); > > + > > + dev->priv = at24; > > + pdata = dev->platform_data; > > + > > + at24->cdev.name = DRIVERNAME; > > You should use at24->cdev.name = asprintf("%s%d", DRIVERNAME, dev->id); > here to support multiple eeproms. Note that this afaics needs patching > i2c_new_device to initialize client->dev.id to -1 to make sure the i2c > device gets an autoassigned id. This reminds me of something I should do in the next time. A cdev is not in any way related to a struct device_d anymore. Nevertheless we more than once use the device id to construct a cdev name like above. Instead we should have a get_cdev_name(char *template) function which creates a name suitable for cdevs. This way both a spi and a i2c eeprom driver could use "eeprom" as template and both would get a valid name. Sascha -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list barebox@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/barebox