Re: [RESEND][PATCH] early platform drivers V2

From: Magnus Damm
Date: Thu Jan 15 2009 - 05:38:20 EST


Hi Roel,

Thanks for your feedback!

On Thu, Jan 15, 2009 at 7:29 PM, roel kluin <roel.kluin@xxxxxxxxx> wrote:
>> + if (id != -2) /* skip previously checked device */
>> + if (match_id == epdrv->requested_id)
>> + goto skip;
>> +
>> + if (pdev->id == match_id)
>> + *match = pdev;
>> +
>> +skip:
>> + if (pdev->id > match_id)
>> + n++;
>
> you can replace the 10 lines above by:
>
> /* skip previously checked device */
> if ((id == -2 || match_id != epdrv->requested_id) && pdev->id == match_id)
> *match = pdev;
> else if (pdev->id > match_id)
> n++;

I agree that the code looks a bit special, but are you sure your
replacement is correct?

Will the "n++" happen in the case of (pdev->id == match_id)?

>> + if (epdrv->pdrv->probe(match)) {
>
> shouldn't this be
>
> if (!epdrv->pdrv->probe(match)) {

No, probe() returns 0 if things went well. Non-zero means error.

> I think k, n and i could get more descriptive names

Sure, why not! Care to give any suggestions? =)

/ magnus
--
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/