• Mike Dunn's avatar
    mtd: fix partition wrapper functions · 994c8409
    Mike Dunn authored
    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: default avatarMike Dunn <mikedunn@newsguy.com>
    Signed-off-by: default avatarArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
    Signed-off-by: default avatarDavid Woodhouse <David.Woodhouse@intel.com>
    994c8409
mtdpart.c 20.4 KB