Re: [PATCHv4 1/9] extcon: Add extcon_dev_allocate/free() to control the memory of extcon device

From: Felipe Balbi
Date: Fri Apr 25 2014 - 11:12:51 EST


On Fri, Apr 25, 2014 at 09:42:16AM +0900, Chanwoo Choi wrote:
> This patch add APIs to control the extcon device on extcon provider driver.
> The extcon_dev_allocate() allocates the memory of extcon device and initializes
> supported cables. And then extcon_dev_free() decrement the reference of the
> device of extcon device and free the memory of the extcon device. This APIs
> must need to implement devm_extcon_dev_allocate()/free() APIs.
>
> Signed-off-by: Chanwoo Choi <cw00.choi@xxxxxxxxxxx>

except for the one comment below, you can add:

Reviewed-by: Felipe Balbi <balbi@xxxxxx>

> @@ -267,6 +273,13 @@ static inline int devm_extcon_dev_register(struct device *dev,
> static inline void devm_extcon_dev_unregister(struct device *dev,
> struct extcon_dev *edev) { }
>
> +static inline struct extcon_dev *extcon_dev_allocate(const char **cables)
> +{
> + return ERR_PTR(-ENOMEM);

so this is executed when extcon isn't enabled right ? -ENOMEM is kind of
lying to your user. You're telling the user that you don't have memory
when in reality you didn't implement this function. -ENOSYS looks like a
better choice

--
balbi

Attachment: signature.asc
Description: Digital signature