[PATCH 1/2] fix-gta02_lis302dl_bitbang.patch

Nelson Castillo nelsoneci at gmail.com
Sat Nov 15 08:52:10 CET 2008


On Fri, Nov 14, 2008 at 9:42 PM, Werner Almesberger <werner at openmoko.org> wrote:
> Nelson Castillo wrote:
>> -                     shifter = tx[n >> 3];
>> +                     shifter = ~tx[n >> 3];
>>               s3c2410_gpio_setpin(pdata->pin_clk, 0);
>> -             s3c2410_gpio_setpin(pdata->pin_mosi, (shifter >> (7 - n)) & 1);
>> +             s3c2410_gpio_setpin(pdata->pin_mosi, !(shifter & 0x80));
>
> Hmm, wouldn't
>                shifter = tx[n >> 3];
> and
>                ... !!(shifter & 0x80) ...
> be a bit more efficient (and perhaps a tad more obvious as well) ?

Well, the "!!" was your idea :-)

I like the ~ because one flipping is done in parallel but it really
doesn't matter because this code will fly and the GPIO code will be
slow. !! might be clearer... anyway the patch has already been
applied.

Best regards,
Nelson.-



More information about the openmoko-kernel mailing list