Re: [PATCH 1/1] power supply: add driver for TI BQ20Z75 gas gauge IC

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Jean Delvare
Date: Tuesday, August 31, 2010 - 1:24 am

Hi Rhyland,

On Fri, 27 Aug 2010 15:50:43 -0700, rklein@nvidia.com wrote:

Quick review (I am not familiar with the power supply API):


Following the naming used for other options in this menu, this would be
BATTERY_BQ20Z75.


Not all capitals, please.


Please remove, this doesn't add much value and is likely to get
outdated at some point.


I don't think you need this one?


You don't use these anywhere?


This could be const.


You don't need the backslash at the end of the line.


Please be consistent with case in hexadecimal numbers.


This structure doesn't seem terribly useful. You typically need the
client to get to this information... And storing the device pointer as
a global is evil anyway, please don't do that.


-EINVAL doesn't look like the right error code. -ENODEV or -EIO would
seem more appropriate. Same issue several times, please address them
all.


As far as I can see, this masking is a no-op.


This should be moved...


... here, with a else.


Can also be written min(ret, 100).


For loops like int better.


You should pass down the exact error value returned by the function,
instead of hardcoding it. Same below.


Wrong indentation.


Should be turned into dev_dbg().


Wrong indentation, and useless code, as kzalloc did it for you already.


What you did here is register a device, not a driver.


You get the data from the client...


(typo: manufacturer)


... just to get the client from the data. Terribly efficient ;)


"-battery" is redundant, just use "bq20z75".


Needless comma.


This is essentially needless. The kernel will log the failure already.



-- 
Jean Delvare
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: [PATCH 1/1] power supply: add driver for TI BQ20Z75 ga ..., Jean Delvare, (Tue Aug 31, 1:24 am)