Re: [PATCH v3 3/3] power: supply: add CellWise cw2015 fuel gauge driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Andy,

thanks for reviewing again.

>> +	/* wait for gauge to become ready */
>> +	for (i = 0; i < CW2015_READ_TRIES; i++) {
>> +		ret = regmap_read(cw_bat->regmap, CW2015_REG_SOC, &reg_val);
>> +		if (ret)
>> +			return ret;
>> +		/* SoC must not be more than 100% */
>> +		else if (reg_val <= 100)
>> +			break;
>> +
>> +		msleep(100);
>> +	}
> 
> Have you considered to use regmap_read_poll_timeout()?

Neat! That is a much cleaner solution. Will use that in v4.

> 
>> +
>> +	if (i >= CW2015_READ_TRIES) {
>> +		reg_val = CW2015_MODE_SLEEP;
>> +		regmap_write(cw_bat->regmap, CW2015_REG_MODE, reg_val);
>> +		dev_err(cw_bat->dev,
>> +			"Gauge did not become ready after profile upload");
>> +		return -ETIMEDOUT;
>> +	}
> 
> ...
> 
>> +		if (memcmp(bat_info, cw_bat->bat_profile,
>> +				CW2015_SIZE_BATINFO)) {
> 
> I think it's pretty much okay to have this on one line, disregard 80 limit
> (it's only 1 extra).

Ok, will probably do that in a few places.


Best Regards,

Tobias



[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux