[PATCH 3/5] ibmebus: Add device creation and bus probing based on of_device

Joachim Fenkes FENKES at de.ibm.com
Wed Sep 26 18:58:37 EST 2007


> > +/* These devices will automatically be added to the bus during init 
*/
> > +static struct of_device_id builtin_matches[] = {
> > +   { .name = "lhca" },
> > +   { .compatible = "IBM,lhca" },
> > +   { .name = "lhea" },
> > +   { .compatible = "IBM,lhea" },
> > +   {},
> > +};
> > +
> 
> Hmm, do you have devices that only have the matching name property
> but not the compatible property? If not, I'd suggest only looking
> for compatible, so you have less chance of false positives.

If a device that's not an lhca is called "lhca", that's its own fault, i 
guess ;) But i concur that looking for the compatible property will 
probably suffice.
 
> > +static int ibmebus_create_device(struct device_node *dn)
> > [...]
> 
> nice!

Thanks.
 
> > -      rc = IS_ERR(dev) ? PTR_ERR(dev) : count;
> > +      rc = rc ? rc : count;
> 
> the last line looks a bit silly. Maybe instead do
> 
>       rc = ibmebus_create_device(dn);
>         of_node_put(dn);
>    }
> 
>    kfree(path);
>    if (rc)
>       return rc;
>    return count;
> }

More code lines? ;) But yes, that looks more like "standard kernel 
pattern" - I'll change that.

Joachim



More information about the Linuxppc-dev mailing list