mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Grant Likely <grant.likely@secretlab.ca>
To: Greg Kroah-Hartman <gregkh@suse.de>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Al Viro <viro@zeniv.linux.org.uk>,
	linux-kernel@vger.kernel.org
Cc: Grant Likely <grant.likely@secretlab.ca>
Subject: [PATCH] devtmpfs: Fix section mismatch on devtmpfsd()
Date: Thu,  4 Aug 2011 23:36:11 +0100	[thread overview]
Message-ID: <1312497371-25685-1-git-send-email-grant.likely@secretlab.ca> (raw)

devtmpfsd_init() references setup_done which is __initdata, but
devtmpfsd() is not an __init function.  The code is fine, because it
is never referenced after discarding __init sections, but it leaves
some additional code that can be discarded with the rest of __init and
it causes gcc to complain with a section mismatch warning.

This patch moves the discardable portion into a separate __init
function.

Compile tested on SPARC and ARM.

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
---
 drivers/base/devtmpfs.c |   31 ++++++++++++++++++-------------
 1 files changed, 18 insertions(+), 13 deletions(-)

diff --git a/drivers/base/devtmpfs.c b/drivers/base/devtmpfs.c
index 33e1bed..5bf4f33 100644
--- a/drivers/base/devtmpfs.c
+++ b/drivers/base/devtmpfs.c
@@ -386,19 +386,8 @@ static int handle(const char *name, mode_t mode, struct device *dev)
 		return handle_remove(name, dev);
 }
 
-static int devtmpfsd(void *p)
+static void devtmpfsd(void)
 {
-	char options[] = "mode=0755";
-	int *err = p;
-	*err = sys_unshare(CLONE_NEWNS);
-	if (*err)
-		goto out;
-	*err = sys_mount("devtmpfs", "/", "devtmpfs", MS_SILENT, options);
-	if (*err)
-		goto out;
-	sys_chdir("/.."); /* will traverse into overmounted root */
-	sys_chroot(".");
-	complete(&setup_done);
 	while (1) {
 		spin_lock(&req_lock);
 		while (requests) {
@@ -418,6 +407,22 @@ static int devtmpfsd(void *p)
 		schedule();
 		__set_current_state(TASK_RUNNING);
 	}
+}
+
+static int __init devtmpfsd_run(void *p)
+{
+	char options[] = "mode=0755";
+	int *err = p;
+	*err = sys_unshare(CLONE_NEWNS);
+	if (*err)
+		goto out;
+	*err = sys_mount("devtmpfs", "/", "devtmpfs", MS_SILENT, options);
+	if (*err)
+		goto out;
+	sys_chdir("/.."); /* will traverse into overmounted root */
+	sys_chroot(".");
+	complete(&setup_done);
+	devtmpfsd();
 	return 0;
 out:
 	complete(&setup_done);
@@ -437,7 +442,7 @@ int __init devtmpfs_init(void)
 		return err;
 	}
 
-	thread = kthread_run(devtmpfsd, &err, "kdevtmpfs");
+	thread = kthread_run(devtmpfsd_run, &err, "kdevtmpfs");
 	if (!IS_ERR(thread)) {
 		wait_for_completion(&setup_done);
 	} else {
-- 
1.7.4.1


             reply	other threads:[~2011-08-04 22:36 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-04 22:36 Grant Likely [this message]
2011-08-04 22:54 ` Greg KH
2011-08-04 23:32   ` Grant Likely
2011-08-04 23:42     ` Greg KH

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=1312497371-25685-1-git-send-email-grant.likely@secretlab.ca \
    --to=grant.likely@secretlab.ca \
    --cc=gregkh@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@linux-foundation.org \
    --cc=viro@zeniv.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®