Re: kobj_to_dev ?

From: Greg KH
Date: Mon Jan 19 2004 - 19:58:12 EST


On Mon, Jan 19, 2004 at 06:25:14PM -0600, Hollis Blanchard wrote:
>
> On Jan 19, 2004, at 6:04 PM, Greg KH wrote:
>
> >On Mon, Jan 19, 2004 at 02:26:47PM -0600, Hollis Blanchard wrote:
> >>Greg KH wrote:
> >>>
> >>>How about just adding a find_device() function to the driver core,
> >>>where
> >>>you pass in a name and a type, so that others can use it?
> >>
> >>Something like this?
> >
> >Very nice, yes. But I'll rename it to device_find() to keep the
> >namespace sane. Sound ok?
>
> Sure. I'm having a problem inside kset_find_obj() when actually using
> it though, and I'm not sure if it's my fault or not. It seems there are
> kobjects present for which kobject_name() returns NULL.

Hm, we should probably fix that oops up too. I'll go do that.

> kset_find_obj:
> list_for_each(entry,&kset->list) {
> struct kobject * k = to_kobj(entry);
> if (!strcmp(kobject_name(k),name)) {
> ret = k;
> break;
> }
> }
>
> where "kset" above is "&my_bus_type.devices". strcmp doesn't like NULL
> and panics. I've registered 11 devices in my_bus_type, and all of them
> have names (device_add() makes sure of that).
>
> Does this sound like my fault?

I don't know. If you enable debugging for kobjects (in kobject.c) do
you see any kobjects getting added to your bus with no name?

thanks,

greg k-h
-
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/