1. 20 May, 2014 2 commits
    • Geert Uytterhoeven's avatar
      mtd: Fix warning in access_ok() parameter passing · f62cde49
      Geert Uytterhoeven authored
      On m68k, where access_ok() doesn't cast the address parameter:
      
      drivers/mtd/mtdchar.c: In function 'mtdchar_write_ioctl':
      drivers/mtd/mtdchar.c:575:4: warning: passing argument 2 of 'access_ok' makes pointer from integer without a cast [enabled by default]
      arch/m68k/include/asm/uaccess_mm.h:17:90: note: expected 'const void *' but argument is of type '__u64'
      drivers/mtd/mtdchar.c:576:4: warning: passing argument 2 of 'access_ok' makes pointer from integer without a cast [enabled by default]
      arch/m68k/include/asm/uaccess_mm.h:17:90: note: expected 'const void *' but argument is of type '__u64'
      
      The address parameter of access_ok() is really a userspace pointer.
      On most architectures, access_ok() is a macro that casts the address
      parameter, hiding issues in its users.
      
      Move around and use the existing usr_data and usr_oob temporary variables
      to kill the warnings. Add a few "consts", and make more use of the
      temporaries while we're at it.
      Signed-off-by: default avatarGeert Uytterhoeven <geert@linux-m68k.org>
      Signed-off-by: default avatarBrian Norris <computersforpeace@gmail.com>
      f62cde49
    • pekon gupta's avatar
      mtd: nand: omap: fix BCHx ecc.correct to return detected bit-flips in erased-page · f306e8c3
      pekon gupta authored
      fixes: commit 62116e51
             mtd: nand: omap2: Support for hardware BCH error correction.
      
      In omap_elm_correct_data(), if bitflip_count in an erased-page is within the
      correctable limit (< ecc.strength), then it is not indicated back to the caller
      ecc->read_page().
      
      This mis-guides upper layers like MTD and UBIFS layer to assume erased-page as
      perfectly clean and use it for writing even if actual bitflip_count was
      dangerously high (bitflip_count > mtd->bitflip_threshold).
      
      This patch fixes this above issue, by returning 'stats' to caller
      ecc->read_page() under all scenarios.
      Reported-by: default avatarBrian Norris <computersforpeace@gmail.com>
      Signed-off-by: default avatarPekon Gupta <pekon@ti.com>
      Cc: <stable@vger.kernel.org> # 3.9.x+
      Signed-off-by: default avatarBrian Norris <computersforpeace@gmail.com>
      f306e8c3
  2. 12 May, 2014 4 commits
  3. 09 May, 2014 1 commit
    • Brian Norris's avatar
      mtd: nand: refactor erase_cmd() to return chip status · 49c50b97
      Brian Norris authored
      The nand_chip::erase_cmd callback previously served a dual purpose; for
      one, it allowed a per-flash-chip override, so that AG-AND devices could
      use a different erase command than other NAND. These AND devices were
      dropped in commit 14c65786 (mtd: nand:
      remove AG-AND support). On the other hand, some drivers (denali and
      doc-g4) need to use this sort of callback to implement
      controller-specific erase operations.
      
      To make the latter operation easier for some drivers (e.g., ST's new BCH
      NAND driver), it helps if the command dispatch and wait functions can be
      lumped together, rather than called separately.
      
      This patch does two things:
       1. Pull the call to chip->waitfunc() into chip->erase_cmd(), and return
          the status from this callback
       2. Rename erase_cmd() to just erase(), since this callback does a
          little more than just send a command
      Signed-off-by: default avatarBrian Norris <computersforpeace@gmail.com>
      Tested-by: default avatarLee Jones <lee.jones@linaro.org>
      49c50b97
  4. 29 Apr, 2014 1 commit
  5. 18 Apr, 2014 1 commit
  6. 17 Apr, 2014 3 commits
    • Brian Norris's avatar
      Merge branch 'spinor' · d66d3519
      Brian Norris authored
      Addition of the spi-nor framework, plus updates to the ST SPI FSM
      driver.
      d66d3519
    • Brian Norris's avatar
      mtd: st_spi_fsm: only build for ARM · dc002f99
      Brian Norris authored
      COMPILE_TEST allows us to build this driver on other arch'es. But not
      all arch'es have the right I/O accessors -- particularly, x86 is missing
      readsl() and writesl().
      
      So just restrict this driver to ARCH_STI. It's still buildable for a
      multiplatform ARM kernel, so it can get decent compile coverage.
      Signed-off-by: default avatarBrian Norris <computersforpeace@gmail.com>
      Acked-by: default avatarLee Jones <lee.jones@linaro.org>
      dc002f99
    • Brian Norris's avatar
      mtd: st_spi_fsm: correct type issues · 38e2eee9
      Brian Norris authored
      Compile-testing for a 64-bit arch uncovers several bad casts:
      
          In file included from include/linux/linkage.h:4:0,
                           from include/linux/kernel.h:6,
                           from drivers/mtd/devices/st_spi_fsm.c:15:
          drivers/mtd/devices/st_spi_fsm.c: In function ‘stfsm_read_fifo’:
          drivers/mtd/devices/st_spi_fsm.c:758:11: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
            BUG_ON((((uint32_t)buf) & 0x3) || (size & 0x3));
          ...
      
      Use uintptr_t instead of uint32_t, since it's guaranteed to be
      pointer-sized.
      
      We also see this warning, if size_t is not 32 bits wide:
      
          In file included from drivers/mtd/devices/st_spi_fsm.c:15:0:
          drivers/mtd/devices/st_spi_fsm.c: In function ‘stfsm_mtd_write’:
          include/linux/kernel.h:712:17: warning: comparison of distinct pointer types lacks a cast [enabled by default]
            (void) (&_min1 == &_min2);  \
                           ^
          drivers/mtd/devices/st_spi_fsm.c:1704:11: note: in expansion of macro ‘min’
             bytes = min(FLASH_PAGESIZE - page_offs, len);
                     ^
      
      Just use min_t() to force the type conversion, since we don't really
      want to upgrade 'page_offs' and 'bytes' to size_t; they only should be
      handling <= 256 byte offsets.
      Signed-off-by: default avatarBrian Norris <computersforpeace@gmail.com>
      Acked-by: default avatarLee Jones <lee.jones@linaro.org>
      38e2eee9
  7. 16 Apr, 2014 7 commits
  8. 14 Apr, 2014 21 commits