Am 24.06.2012 08:16, schrieb Blue Swirl:
> On Fri, Jun 22, 2012 at 10:33 AM, Pavel Hrdina <phrd...@redhat.com> wrote:
>> After rewrite DSKCHG bit handling the test has to be updated. Now
>> is needed to seek to different track to clear DSKCHG bit.
>>
>> Signed-off-by: Pavel Hrdina <phrd...@redhat.com>
>> ---
>>  tests/fdc-test.c |   29 +++++++++++++++++++++--------
>>  1 files changed, 21 insertions(+), 8 deletions(-)
>>
>> diff --git a/tests/fdc-test.c b/tests/fdc-test.c
>> index 610e2f1..5280eff 100644
>> --- a/tests/fdc-test.c
>> +++ b/tests/fdc-test.c
>> @@ -156,19 +156,20 @@ static uint8_t send_read_command(void)
>>     return ret;
>>  }
>>
>> -static void send_step_pulse(void)
>> +static void send_step_pulse(bool chg_cyl)
>>  {
>>     int drive = 0;
>>     int head = 0;
>> -    static int cyl = 0;
>> +    int cyl = 0;
>> +
>> +    if (chg_cyl)
>> +        cyl = (cyl + 1) % 4;
> 
> Missing braces, please use checkpatch.pl to avoid these issues.
> 
> % 4 could be turned into & 3, maybe with a separate patch.

I wouldn't do that. It's not something like a mask for a bitfield, but
just a way to let counting start from the beginning after a while. If
you have two way to express the same, choose the one that expresses the
clearest what the real intention is. The compiler will optimise it (not
that this optimisation in a test case like this really mattered...)

Kevin

Reply via email to