Re: [PATCH V1] regmap: Support for caching in reg_raw_write()

From: Mark Brown
Date: Fri Feb 10 2012 - 06:46:13 EST


On Fri, Feb 10, 2012 at 05:02:52PM +0530, Laxman Dewangan wrote:

This looks good, but could you make the few small improvements below
please?

> + if (!map->cache_bypass && map->format.parse_val) {
> + int val_bytes = map->format.val_bytes;
> + unsigned int ival;
> + for (i = 0; i < val_len / map->format.val_bytes; i++) {

A bit nit picky but since you've got a local val_bytes you may as well
use it.

> + memcpy(map->work_buf, val + (i * val_bytes), val_bytes);
> + ival = map->format.parse_val(map->work_buf);
> + ret = regcache_write(map, reg + i, ival);
> + if (ret) {
> + dev_warn(map->dev,
> + "Error in caching of register\n");

Say which register and the return value here - knowing the register
might be very helpful for debug. This should probably also be at least
a dev_err().

Attachment: signature.asc
Description: Digital signature