All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] devtmpfs: Fix section mismatch on devtmpfsd()
@ 2011-08-04 22:36 Grant Likely
  2011-08-04 22:54 ` Greg KH
  0 siblings, 1 reply; 4+ messages in thread
From: Grant Likely @ 2011-08-04 22:36 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Linus Torvalds, Al Viro, linux-kernel; +Cc: Grant Likely

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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] devtmpfs: Fix section mismatch on devtmpfsd()
  2011-08-04 22:36 [PATCH] devtmpfs: Fix section mismatch on devtmpfsd() Grant Likely
@ 2011-08-04 22:54 ` Greg KH
  2011-08-04 23:32   ` Grant Likely
  0 siblings, 1 reply; 4+ messages in thread
From: Greg KH @ 2011-08-04 22:54 UTC (permalink / raw)
  To: Grant Likely; +Cc: Linus Torvalds, Al Viro, linux-kernel

On Thu, Aug 04, 2011 at 11:36:11PM +0100, Grant Likely wrote:
> 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.

I have a simpler patch here that just removes the __initdata function,
which is simpler.

I hate the initdata stuff, it's almost always pointless...

Would that solve the problem for you as well?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] devtmpfs: Fix section mismatch on devtmpfsd()
  2011-08-04 22:54 ` Greg KH
@ 2011-08-04 23:32   ` Grant Likely
  2011-08-04 23:42     ` Greg KH
  0 siblings, 1 reply; 4+ messages in thread
From: Grant Likely @ 2011-08-04 23:32 UTC (permalink / raw)
  To: Greg KH; +Cc: Linus Torvalds, Al Viro, linux-kernel

On Thu, Aug 4, 2011 at 11:54 PM, Greg KH <gregkh@suse.de> wrote:
> On Thu, Aug 04, 2011 at 11:36:11PM +0100, Grant Likely wrote:
>> 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.
>
> I have a simpler patch here that just removes the __initdata function,
> which is simpler.
>
> I hate the initdata stuff, it's almost always pointless...

initdata I don't mind.  Discarding stuff that is no longer necessary
isn't a bad thing and I don't find it that onerous.  __devinit* seems
less useful since I've never worked on a system that can actually
discard it.

> Would that solve the problem for you as well?

Sure.  I was just doing random sparc builds and fixing up the bugs I
ran into.  I'm happy with that solution too.

g.

g.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] devtmpfs: Fix section mismatch on devtmpfsd()
  2011-08-04 23:32   ` Grant Likely
@ 2011-08-04 23:42     ` Greg KH
  0 siblings, 0 replies; 4+ messages in thread
From: Greg KH @ 2011-08-04 23:42 UTC (permalink / raw)
  To: Grant Likely; +Cc: Linus Torvalds, Al Viro, linux-kernel

On Fri, Aug 05, 2011 at 12:32:15AM +0100, Grant Likely wrote:
> On Thu, Aug 4, 2011 at 11:54 PM, Greg KH <gregkh@suse.de> wrote:
> > On Thu, Aug 04, 2011 at 11:36:11PM +0100, Grant Likely wrote:
> >> 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.
> >
> > I have a simpler patch here that just removes the __initdata function,
> > which is simpler.
> >
> > I hate the initdata stuff, it's almost always pointless...
> 
> initdata I don't mind.  Discarding stuff that is no longer necessary
> isn't a bad thing and I don't find it that onerous.  __devinit* seems
> less useful since I've never worked on a system that can actually
> discard it.

Yes, that's the one I really want to get rid of.  One of these days on a
long flight I'll work up a series of patches to drop it...

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-08-04 23:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-04 22:36 [PATCH] devtmpfs: Fix section mismatch on devtmpfsd() Grant Likely
2011-08-04 22:54 ` Greg KH
2011-08-04 23:32   ` Grant Likely
2011-08-04 23:42     ` Greg KH

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.