Re: [PATCH] extcon: arizona: Only set GPIO if it has been requested

From: Chanwoo Choi
Date: Tue Nov 27 2012 - 02:15:13 EST


On 11/27/2012 03:35 PM, Mark Brown wrote:
> On Tue, Nov 27, 2012 at 08:26:35AM +0900, Chanwoo Choi wrote:
>> On 11/26/2012 08:28 PM, Mark Brown wrote:
>
>>> + if (arizona->pdata.micd_pol_gpio > 0)
>>> + gpio_set_value_cansleep(arizona->pdata.micd_pol_gpio,
>>> + info->micd_modes[mode].gpio);
>
>> Why not use gpio_is_valid() function to test arizona->pdata.micd_pol_gpio ?
>
> Zero is normally a valid GPIO (since it's an index into a big array
> after all) but this is unhelpful when checking to see if someone filled
> in platform data as it's also the default value for uninitialised member
> variables. It's much more likely that someone didn't fill in a GPIO
> than that GPIO 0 got assigned to this.

OK, Applied it.

You can check it after some minutes.
- git://git.kernel.org/pub/scm/linux/kernel/git/chanwoo/extcon.git (for-next branch)

Thanks,
Chanwoo Choi
--
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/