device interface api

Martin Waitz (tali@admingilde.org)
Wed, 18 Dec 2002 01:40:39 +0100


--3MwIy2ne0vdjdPXF
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

hi :)

please have a look at interface_add_data:

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

data->intf_num =3D data->intf->devnum++;
data->kobj.subsys =3D &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:

=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- 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=20
s->kobj.parent =3D &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);
}
=20
void subsystem_unregister(struct subsystem * s)
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D

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)

--=20
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=20
kurzfristige Sicherheit zu verschaffen, der hat weder Freiheit=20
noch Sicherheit verdient.
Benjamin Franklin (1706 - 1790)

--3MwIy2ne0vdjdPXF
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQE9/8QHj/Eaxd/oD7IRAm7QAJ95inNcMAZ+daQhi7fdkOdPflYXPgCdF7uq
YPJ70FMzkMnbIHaXmtWnL+w=
=nAt1
-----END PGP SIGNATURE-----

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