All of lore.kernel.org
 help / color / mirror / Atom feed
From: John Levon <levon@movementarian.org>
To: Zwane Mwaikambo <zwane@linuxpower.ca>
Cc: Greg KH <greg@kroah.com>, Linux Kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH][2.6][CFT] rmmod floppy kills box fixes + default_device_remove
Date: Tue, 9 Sep 2003 20:45:53 +0100	[thread overview]
Message-ID: <20030909194553.GA75492@compsoc.man.ac.uk> (raw)
In-Reply-To: <Pine.LNX.4.53.0309091359450.14426@montezuma.fsmlabs.com>

On Tue, Sep 09, 2003 at 03:18:20PM -0400, Zwane Mwaikambo wrote:

> > Any thoughts on how to solve this?
> 
> How about something like the following, the kobj_type.done is passed from 
> the driver so the driver's presence can maintain it's persistence and 

This works. Repeat ad infinitum for all the other platform devices in
pcmcia etc, 99% of which don't need to release anything extra.

Alternatively why don't we do something like the below ? This still
allows platform devices to clean up if necessary, but solves the "wait
for last reference" on a sensible level IMHO.

Index: platform.c
===================================================================
RCS file: /home/cvs/linux-2.5/drivers/base/platform.c,v
retrieving revision 1.11
diff -u -p -r1.11 platform.c
--- platform.c	16 Aug 2003 05:00:10 -0000	1.11
+++ platform.c	9 Sep 2003 18:02:22 -0000
@@ -18,6 +18,16 @@ struct device legacy_bus = {
 	.bus_id		= "legacy",
 };
 
+
+static void platform_device_release(struct device * dev)
+{
+	struct platform_device * pdev = to_platform_device(dev);
+	if (pdev->release)
+		pdev->release(pdev);
+	complete(&pdev->done);
+}
+
+
 /**
  *	platform_device_register - add a platform-level device
  *	@dev:	platform device we're adding
@@ -32,6 +42,12 @@ int platform_device_register(struct plat
 		pdev->dev.parent = &legacy_bus;
 
 	pdev->dev.bus = &platform_bus_type;
+
+	if (pdev->dev.release) {
+		printk("use the other release dude\n");
+	}
+	pdev->dev.release = platform_device_release;
+	init_completion(&pdev->done);
 	
 	snprintf(pdev->dev.bus_id,BUS_ID_SIZE,"%s%u",pdev->name,pdev->id);
 
@@ -44,6 +60,7 @@ void platform_device_unregister(struct p
 {
 	if (pdev)
 		device_unregister(&pdev->dev);
+	wait_for_completion(&pdev->done);
 }
 
 
-- 
Khendon's Law:
If the same point is made twice by the same person, the thread is over.

      reply	other threads:[~2003-09-09 19:45 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-09-08  2:53 [PATCH][2.6][CFT] rmmod floppy kills box fixes + default_device_remove Zwane Mwaikambo
2003-09-08 15:50 ` Greg KH
2003-09-08 21:27   ` Zwane Mwaikambo
2003-09-08 23:08     ` Greg KH
2003-09-09 11:50       ` Zwane Mwaikambo
2003-09-09 16:38         ` Zwane Mwaikambo
2003-09-09 17:13           ` Greg KH
2003-09-09 19:18             ` Zwane Mwaikambo
2003-09-09 19:45               ` John Levon [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20030909194553.GA75492@compsoc.man.ac.uk \
    --to=levon@movementarian.org \
    --cc=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=zwane@linuxpower.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.