On Mon, Feb 17, 2014 at 05:58:34PM +0000, Grant Likely wrote:
> This seems wrong also. The compatible order should be checked for even
> when m->name or m->type are set. You actually need to score the entries
> to do this properly. The pseudo-code should look like this:
>
> uint best_score = ~0;
> of_device_id *best_match = NULL;
> for_each(matches) {
> uint score = ~0;
> for_each_compatible(index) {
> if (match->compatible == compatible[index])
> score = index * 10;
> }
>
> /* Matching name is a bit better than not */
> if (match->name == node->name)
> score--;
>
> /* Matching type is better than matching name */
> /* (but matching both is even better than that */
> if (match->type == node->type)
> score -= 2;
>
> if (score < best_score)
> best_match = match;
> }
> return best_match;
>
> This is actually very similar to the original code. It is an easy
> modification. This is very similar to how the of_fdt_is_compatible()
> function works.I like this idea and will make a new patch based on this. Thanks, Kevin > > g.
pgpYSOYZZ9Vcz.pgp
Description: PGP signature
_______________________________________________ Linuxppc-dev mailing list [email protected] https://lists.ozlabs.org/listinfo/linuxppc-dev
