Re: [PATCH] Add I2C driver for Summit Microelectronics SMB347Battery Charger.

From: Mark Brown
Date: Mon Feb 06 2012 - 12:21:20 EST

On Mon, Feb 06, 2012 at 05:05:28PM +0000, Alan Cox wrote:
> Mark Brown <broonie@xxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote:

> > I'm not sure what complexity you mean? If the interface is too
> > difficult to use we should fix that but I didn't notice anything in the
> > driver which should be more than a straight substitution (or deletion of
> > code in the case of the debugfs file).

> The API seems fine to me but you've then got to implement the
> writeable/readable/volatile reg callbacks and figure out what is cachable
> for the chip and specify it.

All those callbacks are optional, you can tell the API what the maximum
register is with max_register and it should just show all registers
(which is pretty much what you have there) - you only need max_register
so that debugfs does something sensible, though thinking about it we can
probably just assume the maximum possible register value for devices
that don't specify it and have something sensible happen (at least for
smaller address sizes, I'm not sure we want 65535 registers shown by
default for 16 bit address devices).

The cache usage is totally optional too, it's available if you want it
but it won't make sense for all devices and is disabled by default.

Attachment: signature.asc
Description: Digital signature