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

Joachim Fenkes
2007-09-26T08:58:52Z

> > +/* 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