device interface api

From: Martin Waitz (tali@admingilde.org)
Date: Tue Dec 17 2002 - 19:40:39 EST


hi :)

please have a look at interface_add_data:

int interface_add_data(struct intf_data * data)
{
        struct device_interface * intf = intf_from_data(data);

        data->intf_num = data->intf->devnum++;
        data->kobj.subsys = &intf->subsys;
        kobject_register(&data->kobj);
        [...]

data->kobj.subsys is initialized here, but intf_from_data
is using this data->kobj.subsys to get intf, instead of data->intf.
do you want to remove data->intf?
either way, interface_add_data should change.

are interface users supposed to set data->intf or data->kobj.subsys?

another small glitch i noticed while diggin in the code:

================================================================
--- linux-2.5/lib/kobject.c Tue Dec 10 12:59:02 2002
+++ linux/lib/kobject.c Tue Dec 17 13:15:19 2002
@@ -218,7 +218,7 @@ int subsystem_register(struct subsystem
                s->kobj.parent = &s->parent->kobj;
        pr_debug("subsystem %s: registering, parent: %s\n",
                 s->kobj.name,s->parent ? s->parent->kobj.name : "<none>");
- return kobject_register(&s->kobj);
+ return kobject_add(&s->kobj);
 }
 
 void subsystem_unregister(struct subsystem * s)
================================================================

subsystem_register first calls subsystem_init, which already
does kobject_init, so a full kobject_register is not needed
(and is in fact bad, as it again increases the refcounter for kobj.subsys)

-- 
CU,		  / Friedrich-Alexander University Erlangen, Germany
Martin Waitz	//  [Tali on IRCnet]  [tali.home.pages.de] _________
______________/// - - - - - - - - - - - - - - - - - - - - ///
dies ist eine manuell generierte mail, sie beinhaltet    //
tippfehler und ist auch ohne grossbuchstaben gueltig.   /
			    -
Wer bereit ist, grundlegende Freiheiten aufzugeben, um sich 
kurzfristige Sicherheit zu verschaffen, der hat weder Freiheit 
noch Sicherheit verdient.
			Benjamin Franklin  (1706 - 1790)


- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Mon Dec 23 2002 - 22:00:18 EST