mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Herbert Xu <herbert@gondor.apana.org.au>
To: Rolf Kutz <kutz@netcologne.de>,
	244207@bugs.debian.org, Andrew Morton <akpm@osdl.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Cc: Russell King <rmk+lkml@arm.linux.org.uk>
Subject: Re: Bug#244207: kernel-source-2.6.5: mwave gives warning on suspend
Date: Sun, 18 Apr 2004 20:31:09 +1000	[thread overview]
Message-ID: <20040418103109.GA13756@gondor.apana.org.au> (raw)
In-Reply-To: <20040417122954.GA7533@gondor.apana.org.au>

[-- Attachment #1: Type: text/plain, Size: 489 bytes --]

On Sat, Apr 17, 2004 at 10:29:54PM +1000, herbert wrote:
> 
> Please scrap that one, it just makes the module unloadable.

This patch resolves the problem of the module getting unloaded before
the device is released by waiting in the module_exit function.

Cheers,
-- 
Debian GNU/Linux 3.0 is out! ( http://www.debian.org/ )
Email:  Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

[-- Attachment #2: p --]
[-- Type: text/plain, Size: 1610 bytes --]

Index: drivers/char/mwave/mwavedd.c
===================================================================
RCS file: /home/gondolin/herbert/src/CVS/debian/kernel-source-2.5/drivers/char/mwave/mwavedd.c,v
retrieving revision 1.1.1.7
diff -u -r1.1.1.7 mwavedd.c
--- a/drivers/char/mwave/mwavedd.c	28 Sep 2003 04:44:12 -0000	1.1.1.7
+++ b/drivers/char/mwave/mwavedd.c	18 Apr 2004 10:26:41 -0000
@@ -57,6 +57,7 @@
 #include <linux/sched.h>
 #include <linux/spinlock.h>
 #include <linux/delay.h>
+#include <linux/completion.h>
 #include "smapi.h"
 #include "mwavedd.h"
 #include "3780i.h"
@@ -470,7 +471,17 @@
  * sysfs support <paulsch@us.ibm.com>
  */
 
-struct device mwave_device;
+static DECLARE_COMPLETION(mwave_device_released);
+
+static void mwave_device_release(struct device *dev)
+{
+	complete(&mwave_device_released);
+}
+
+static struct device mwave_device = {
+	.bus_id = "mwave",
+	.release = mwave_device_release,
+};
 
 /* Prevent code redundancy, create a macro for mwave_show_* functions. */
 #define mwave_show_function(attr_name, format_string, field)		\
@@ -518,7 +529,9 @@
 	pDrvData->nr_registered_attrs = 0;
 
 	if (pDrvData->device_registered) {
+		INIT_COMPLETION(mwave_device_released);
 		device_unregister(&mwave_device);
+		wait_for_completion(&mwave_device_released);
 		pDrvData->device_registered = FALSE;
 	}
 
@@ -639,9 +652,6 @@
 	/* uart is registered */
 
 	/* sysfs */
-	memset(&mwave_device, 0, sizeof (struct device));
-	snprintf(mwave_device.bus_id, BUS_ID_SIZE, "mwave");
-
 	if (device_register(&mwave_device))
 		goto cleanup_error;
 	pDrvData->device_registered = TRUE;

  reply	other threads:[~2004-04-18 10:31 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20040417104311.9C13A1D802@jamaika.kutz.dyndns.org>
2004-04-17 11:39 ` Herbert Xu
2004-04-17 11:48   ` Russell King
2004-04-17 12:23     ` Herbert Xu
2004-04-17 12:29       ` Herbert Xu
2004-04-18 10:31         ` Herbert Xu [this message]
2004-04-18 11:17           ` Christoph Hellwig
2004-04-18 11:32             ` Christoph Hellwig

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=20040418103109.GA13756@gondor.apana.org.au \
    --to=herbert@gondor.apana.org.au \
    --cc=244207@bugs.debian.org \
    --cc=akpm@osdl.org \
    --cc=kutz@netcologne.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rmk+lkml@arm.linux.org.uk \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®