--=_courier-15175-1042754001-0001-2
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
hi :)
the note for cpufreq sysfs support regarding locking in add_intf
has bitten me, too
i don't have a really good idea how to change the locking
so that it just works, so i wrote a workaround
the following patch allows to add interfaces again for me,
it just deferres the actual device additions:
--- src/linux-2.5/drivers/base/intf.c Mon Jan 13 09:49:02 2003
+++ src/linux-rc/drivers/base/intf.c Thu Jan 16 11:13:19 2003
@@ -132,6 +132,22 @@
=20
=20
/**
+ * delayed_add - version of add() called via schedule_work
+ * @_data: pointer to arguments
+ */
+static void delayed_add(void *_data)
+{
+ struct {
+ struct device_interface *intf;
+ struct device *dev;
+ struct work_struct work;
+ } *data =3D _data;
+
+ add(data->intf, data->dev);
+ kfree(data);
+}
+
+/**
* add_intf - add class's devices to interface.
* @intf: interface.
*
@@ -142,12 +158,24 @@
*/
static void add_intf(struct device_interface * intf)
{
+ struct {
+ struct device_interface *intf;
+ struct device *dev;
+ struct work_struct work;
+ } *data;
struct device_class * cls =3D intf->devclass;
struct list_head * entry;
=20
down_write(&cls->subsys.rwsem);
- list_for_each(entry,&cls->devices.list)
- add(intf,to_dev(entry));
+ list_for_each(entry,&cls->devices.list) {
+ /* add will lock subsys.rwsem via interface_add_data, */
+ /* do it after lock is released */
+ data =3D kmalloc(sizeof(*data), GFP_KERNEL);
+ INIT_WORK(&data->work, delayed_add, data);
+ data->intf =3D intf;
+ data->dev =3D to_dev(entry);
+ schedule_work(&data->work);
+ }
up_write(&cls->subsys.rwsem);
}
=20
--=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)
--=_courier-15175-1042754001-0001-2
Content-Type: application/pgp-signature
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)
iD8DBQE+JymRj/Eaxd/oD7IRAhKWAJ9qCvGMi8RfL3274djvep/trDe5ygCdEQoD
DOKcVofNKlGi09JW4yBi/OU=
=Ejfe
-----END PGP SIGNATURE-----
--=_courier-15175-1042754001-0001-2--