mtd: fix partition wrapper functions
authorMike Dunn <mikedunn@newsguy.com>
Sat, 3 Mar 2012 21:13:06 +0000 (13:13 -0800)
committerDavid Woodhouse <David.Woodhouse@intel.com>
Mon, 26 Mar 2012 23:44:29 +0000 (00:44 +0100)
commit994c8409c4591983898182bfb5a0368d3daf1fc1
tree610844d80a3433b1dd6b2031cd838b1e7689ee9f
parent31716a5ad32771be8339832b62aa030c263c6dac
mtd: fix partition wrapper functions

This patch reverts a change that may have been mistakenly included with the set
of patches that introduced the new mtd api entry functions.  Or perhaps I am
mistaken :)

The problem is in the partition wrapper functions, where the calls to the driver
methods were replaced with calls to the new mtd api functions.  This causes the
api function to be called a second time, further down the call stack.  This is
not only unnecessary and redundant - because the sanity checking code and (more
restrictive) bounds checks for the partition were done in the first call - but
is potentially problematic and confusing.

For example, the call stack for a call to mtd_read() on a partitioned device
currently looks like this:

mtd_read()             gets struct mtd_info for the partition
|
+-> part_read()        via the pointer assigned when the partition was created
    |
    +->mtd_read()      this time gets struct mtd_info for the master
       |
       +->xyz_driver_read()  via the pointer asigned by the driver

It seems that this can cause a variety of problems.  For example, if you want to
add code to the api function that tests a value in mtd_info that is relevant
only to the partition.  Or (in my case) you want the driver to return a value
that may be different from that returned by the mtd api function.

This patch eliminates the second call to the mtd api function.  It was tested on
the docg4 nand driver with a subset of the api functions, but I inspected the
rest and don't see any problems.

Signed-off-by: Mike Dunn <mikedunn@newsguy.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
drivers/mtd/mtdpart.c
This page took 0.029969 seconds and 5 git commands to generate.