Re: [PATCH] regulator: max8973: get rid of extra variable for gpio validity

From: Laxman Dewangan
Date: Thu Apr 09 2015 - 06:40:26 EST


On Wednesday 08 April 2015 08:12 PM, Mark Brown wrote:
* PGP Signed by an unknown key

On Wed, Apr 08, 2015 at 07:08:00PM +0530, Laxman Dewangan wrote:
To find that dvs-gpio is valid or not, gpio API gpio_is_valid()
can be directly used instead of intermediate variable.

Removing the extra variable and using the gpio_is_valid().
Are you sure that platform data using 0 as default/unset is still
handled correctly after this?


This issue already exist and this patch will not handle this case because gpio_is_valid() return true for gpio 0 also.

I search the registration of this driver on linux-next and found that it is used from DT only. No one is registering this device from non-DT.

However, I can push another patch to fix the issue as if platform data is provided from non-DT and dvs_gpio is 0 then mark this as -EINVAL so that it will treat this as invalid gpio.
Still there will be issue if some platform have real GPIO number as 0 and register from board files.

Does it make sense?


--
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/