Re: [PATCH 2/6] platform/x86: int3472/discrete: Refactor GPIO to sensor mapping

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

 



Hi,

On 11/30/22 10:49, Andy Shevchenko wrote:
> On Wed, Nov 30, 2022 at 1:12 AM Hans de Goede <hdegoede@xxxxxxxxxx> wrote:
>>
>> Add a helper function to map the type returned by the _DSM
>> method to a function name + the default polarity for that function.
>>
>> And fold the INT3472_GPIO_TYPE_RESET and INT3472_GPIO_TYPE_POWERDOWN
>> cases into a single generic case.
>>
>> This is a preparation patch for further GPIO mapping changes.
> 
> ...
> 
>> +       switch (type) {
>> +       case INT3472_GPIO_TYPE_RESET:
>> +               *func = "reset";
>> +               *polarity = GPIO_ACTIVE_LOW;
>> +               break;
>> +       case INT3472_GPIO_TYPE_POWERDOWN:
>> +               *func = "powerdown";
>> +               *polarity = GPIO_ACTIVE_LOW;
>> +               break;
>> +       case INT3472_GPIO_TYPE_CLK_ENABLE:
>> +               *func = "clk-enable";
>> +               *polarity = GPIO_ACTIVE_HIGH;
>> +               break;
>> +       case INT3472_GPIO_TYPE_PRIVACY_LED:
>> +               *func = "privacy-led";
>> +               *polarity = GPIO_ACTIVE_HIGH;
>> +               break;
>> +       case INT3472_GPIO_TYPE_POWER_ENABLE:
>> +               *func = "power-enable";
>> +               *polarity = GPIO_ACTIVE_HIGH;
>> +               break;
>> +       default:
>> +               *func = "unknown";
>> +               *polarity = GPIO_ACTIVE_HIGH;
> 
> A nit-pick: In long term maintenance it's always good to have a break
> statement even in the default case.

Ack, I'll add this when merging this (unless there are other / bigger
reasons for a v2).

Regards,

Hans




[Index of Archives]     [Linux Kernel Development]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux