[PATCH 0/5] Introduce devfs_append_partition and a few users
Uwe Kleine-König
u.kleine-koenig at pengutronix.de
Tue Feb 18 05:36:10 EST 2014
Hello,
the fist patch was already sent some time ago by Jan Lübbe (with
Message-Id: <1371559852-21867-1-git-send-email-jlu at 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
More information about the barebox
mailing list