Re: [PATCH] gpio: twl4030: Correct status reporting when the GPIOis used as output

From: Peter Ujfalusi
Date: Thu Dec 06 2012 - 05:54:55 EST


On 12/05/2012 11:48 PM, Grant Likely wrote:
>> - base = REG_GPIODATAIN1 + d_bnk;
>> + direction = gpio_twl4030_read(REG_GPIODATADIR1 + d_bnk);
>> + if (direction > 0 && (direction >> d_off) & 0x1)
>> + base = REG_SETGPIODATAOUT1 + d_bnk;
>> + else
>> + base = REG_GPIODATAIN1 + d_bnk;
>> +
>
> This is probably quite expensive considering that reads need to go out
> the i2c bus. Things like the output state and the pin direction should
> be cached by the driver in its private data structure so that you don't
> add an additional i2c round trip.

True. I have sent the v2, which grown a bit since I did not wanted to add more
global variable to this driver.

--
Péter
--
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/