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

From: Joachim Fenkes
Date: Wed Sep 26 2007 - 04:58:54 EST


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