Re: [PATCH] regmap: Allow regmap_bulk_write() to work for "no-bus"regmaps
From: Mark Brown
Date: Tue Dec 24 2013 - 07:54:32 EST
On Mon, Dec 23, 2013 at 12:05:53PM -0800, Stephen Boyd wrote:
> On 12/18/13 10:45, Mark Brown wrote:
> > This doesn't quite work - val is an array of objects of the size of the
> > size of a register not of unsigned integers so you're parsing extra data
> > out there. That possibly wasn't the best choice of API but we have
> > quite a few users now so ick.
> Are you concerned that we'll read past the end of the val buffer? Do we
> need to cast the pointer to be the appropriate size according to
> val_bytes? Something like this?
That's one issue, the other is that if we try to read (say) and 8 bit
value as an unsigned int we'll not just read the value we're looking
for.
> for (i = 0; i < val_count; i++) {
> unsigned int ival;
>
> switch (val_bytes) {
> case 1:
> ival = *(u8 *)(val + (i * val_bytes));
> break;
I think we do sadly. Or refactor the API to work in unsigned ints
which would've been more sensible in the first place but that'd make it
asymmetrical with the read API as it stands...
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/