mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH 0/5] Introduce devfs_append_partition and a few users
Date: Tue, 18 Feb 2014 11:36:10 +0100	[thread overview]
Message-ID: <1392719775-16886-1-git-send-email-u.kleine-koenig@pengutronix.de> (raw)

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

             reply	other threads:[~2014-02-18 10:36 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-18 10:36 Uwe Kleine-König [this message]
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

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=1392719775-16886-1-git-send-email-u.kleine-koenig@pengutronix.de \
    --to=u.kleine-koenig@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /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