Linux laptop Discussion Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Neil Horman <nhorman@tuxdriver.com>
To: Stephen Rothwell <sfr@canb.auug.org.au>
Cc: kernel-janitors@lists.osdl.org, linux-laptop@vger.kernel.org,
	akpm@osdl.org
Subject: Re: [KJ] [PATCH] apm: clean up module initalization
Date: Tue, 1 Aug 2006 22:21:52 -0400	[thread overview]
Message-ID: <20060802022152.GA9097@localhost.localdomain> (raw)
In-Reply-To: <20060802110404.70edf996.sfr@canb.auug.org.au>

Copy all that.  New patch attached, with corrected cleanups for dangling proc
entry on kernel_thread failure, and logged warning on failure to register
misc_device.

Regards
Neil

Signed-off-by: Neil Horman <nhorman@tuxdriver.com>


 apm.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletion(-)


diff --git a/arch/i386/kernel/apm.c b/arch/i386/kernel/apm.c
index 8591f2f..24fd577 100644
--- a/arch/i386/kernel/apm.c
+++ b/arch/i386/kernel/apm.c
@@ -2339,6 +2339,7 @@ #endif
 	ret = kernel_thread(apm, NULL, CLONE_KERNEL | SIGCHLD);
 	if (ret < 0) {
 		printk(KERN_ERR "apm: disabled - Unable to start kernel thread.\n");
+		remove_proc_entry("apm", NULL);
 		return -ENOMEM;
 	}
 
@@ -2348,7 +2349,13 @@ #endif
 		return 0;
 	}
 
-	misc_register(&apm_device);
+	/*
+	 * Note we don't actually care if the misc_device cannot be registered.
+	 * this driver can do its job without it, even if userspace can't
+	 * control it.  just log the error
+	 */
+	if (misc_register(&apm_device))
+		printk(KERN_WARNING "apm: Could not register misc device.\n");
 
 	if (HZ != 100)
 		idle_period = (idle_period * HZ) / 100;


  reply	other threads:[~2006-08-02  2:21 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-01 16:25 [KJ] [PATCH] apm: clean up module initalization Neil Horman
2006-08-01 21:45 ` Alexey Dobriyan
2006-08-02  1:04 ` Stephen Rothwell
2006-08-02  2:21   ` Neil Horman [this message]
2006-08-02  3:54     ` Stephen Rothwell

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=20060802022152.GA9097@localhost.localdomain \
    --to=nhorman@tuxdriver.com \
    --cc=akpm@osdl.org \
    --cc=kernel-janitors@lists.osdl.org \
    --cc=linux-laptop@vger.kernel.org \
    --cc=sfr@canb.auug.org.au \
    /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