mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 0/5] Introduce devfs_append_partition and a few users
@ 2014-02-18 10:36 Uwe Kleine-König
  2014-02-18 10:36 ` [PATCH 1/5] devfs-core: introduce devfs_append_partition Uwe Kleine-König
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Uwe Kleine-König @ 2014-02-18 10:36 UTC (permalink / raw)
  To: barebox

Hello,

the fist patch was already sent some time ago by Jan Lübbe (with
Message-Id: <1371559852-21867-1-git-send-email-jlu@pengutronix.de>).
Back then Sascha said:

	I'm fine with the patch when some users are converted to this.

and Alexander Shiyan suggested to make offset a static variable which
Jan didn't consider this a good idea, me does neither.

I thought about making devfs_append_partition an inline function, but
this function doesn't compile as efficient as it looks like at least on
ARM. That is because comparing the parameter lists of
devfs_append_partition and devfs_add_partition the former takes a
pointer as 2nd parameter while the latter a loff_t which is a 64 bit
type. So register allocation for parameters is as follows:

	devfs_append_partition:
		r0: const char *devname
		r1: loff_t *offset
		r2/r3: loff_t size
		stack:	const char *name
			int flags

	devfs_add_partition:
		r0: const char *devname
		/* r1: unused */
		r2/r3: loff_t offset
		stack:	const char *name
			int flags
			loff_t size
			/

So some juggling has to be done to setup the parameters for
devfs_add_partition. This could be fixed by changing the parameters to:

	struct cdev *devfs_add_partition(loff_t offset, loff_t size,
		const char *devname, int flags, const char *name);
	struct cdev *devfs_append_partition(loff_t *offset, loff_t size,
		const char *devname, int flags, const char *name);

but not sure it's worth the hassle.

So I just picked four random boards and converted them and fixed up
patch 1 for commit 121c3d6e9c2f (devfs: let devfs_add_partition return
the new partition).

The diffstat is bad. The new function account for a net addition of 11
lines. sama5d3xek adds (net) 10 lines, that's: two for the newly
required offset variable, 4 lines because I broke overlong lines and
four additional lines to preserve the hole in the partitioning layout.
Still I think it's a nice cleanup because holes in the partitioning
(which should be the exception) are more explicit now.

Best regards
Uwe

Jan Luebbe (1):
  devfs-core: introduce devfs_append_partition

Uwe Kleine-König (4):
  ARM: sama5d3xek: convert to devfs_append_partition
  ARM: a9m2410: convert to devfs_append_partition
  ARM: freescale-mx35-3-stack: convert to devfs_append_partition
  ARM: pca100: convert to devfs_append_partition

 arch/arm/boards/a9m2410/a9m2410.c               | 24 +++++++++++++++++-------
 arch/arm/boards/freescale-mx35-3-stack/3stack.c | 13 +++++++++----
 arch/arm/boards/phycard-i.MX27/pca100.c         |  5 +++--
 arch/arm/boards/sama5d3xek/init.c               | 18 ++++++++++++++----
 fs/devfs-core.c                                 |  9 +++++++++
 include/driver.h                                |  6 ++++--
 6 files changed, 56 insertions(+), 19 deletions(-)

-- 
1.8.5.3


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

end of thread, other threads:[~2014-02-18 10:53 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-18 10:36 [PATCH 0/5] Introduce devfs_append_partition and a few users Uwe Kleine-König
2014-02-18 10:36 ` [PATCH 1/5] devfs-core: introduce devfs_append_partition Uwe Kleine-König
2014-02-18 10:36 ` [PATCH 2/5] ARM: sama5d3xek: convert to devfs_append_partition Uwe Kleine-König
2014-02-18 10:43   ` Jean-Christophe PLAGNIOL-VILLARD
2014-02-18 10:36 ` [PATCH 3/5] ARM: a9m2410: " Uwe Kleine-König
2014-02-18 10:36 ` [PATCH 4/5] ARM: freescale-mx35-3-stack: " Uwe Kleine-König
2014-02-18 10:36 ` [PATCH 5/5] ARM: pca100: " Uwe Kleine-König

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox