Re: kobj_to_dev ?

From: Hollis Blanchard
Date: Mon Jan 19 2004 - 19:33:38 EST



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.

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?

--
Hollis Blanchard
IBM Linux Technology Center

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