12 Aug, 2010

2 commits

  • "plat_id" is always non-NULL here. There is a zero element on the end
    of the m25p_ids[] array and if we hit the end of the loop then plat_id
    points to that.

    This would lead to a NULL pointer dereference later on in the function.

    Signed-off-by: Dan Carpenter
    Acked-by: Anton Vorontsov
    Signed-off-by: David Woodhouse

    Dan Carpenter
     
  • This is just a cleanup, it doesn't fix any bugs.

    These functions all check retlen inconsistently and it generates a
    warning in Smatch (http://smatch.sf.net). If retlen were ever NULL it
    would cause an oops and the code has been this way since 2006 so someone
    would have complained. Also I looked at other places that implemented
    the mtd read and write functions and they dereference retlen without
    checking.

    I removed the checks.

    Signed-off-by: Dan Carpenter
    Signed-off-by: David Woodhouse

    Dan Carpenter
     

09 Aug, 2010

1 commit


06 Aug, 2010

3 commits


04 Aug, 2010

2 commits

  • spi_write_then_read() may return its own return codes (e.g. -EIO),
    so let's propagate the value down to the probe().

    Also, remove jedec == 0 check, it isn't needed as nowadays we use
    dedicated SPI device IDs for non-JEDEC flashes.

    Suggested-by: Barry Song
    Signed-off-by: Anton Vorontsov
    Acked-by: Mike Frysinger
    Signed-off-by: Artem Bityutskiy
    Signed-off-by: David Woodhouse

    Anton Vorontsov
     
  • Since commit 18c6182bae0acca220ed6611f741034d563cd19f ("Rework
    probing/JEDEC code"), m25p80 driver successfully registers chips
    even if JEDEC probing fails.

    This was needed to support non-JEDEC flashes. Though, it appears
    that some platforms (e.g. blackfin bf533 stamp[1]) used the old
    behavior to detect if there's any flash connected, so the driver
    have to fail on JEDEC probing errors.

    This patch restores the old behavior for JEDEC flashes, and adds
    "-nonjedec" SPI device IDs for M25Pxx flashes, so that the kernel
    still supports non-JEDEC flashes.

    [1] http://blackfin.uclinux.org/gf/project/uclinux-dist/tracker/?action=TrackerItemEdit&tracker_item_id=5975

    Reported-by: Mingquan Pan
    Reported-by: Barry Song
    Signed-off-by: Anton Vorontsov
    Acked-by: Mike Frysinger
    Signed-off-by: Artem Bityutskiy
    Signed-off-by: David Woodhouse

    Anton Vorontsov
     

02 Aug, 2010

3 commits


14 May, 2010

1 commit

  • Some SPI masters (ep93xx) have limitations when using the SFRMOUT
    signal for the spi device chip select. The SFRMOUT signal is
    only asserted as long as the spi transmit fifo contains data. As
    soon as the last bit is clocked into the receive fifo it gets
    deasserted.

    The functions sst25l_status and sst25l_match_device use the API
    function spi_write_then_read to write a command to the flash then
    read the response back. This API function creates a two part spi
    message for the write then read. When this message is transferred
    the SFRMOUT signal ends up getting deasserted after the command
    phase. This causes the command to get aborted by the device so
    the read phase returns invalid data.

    By changing sst25l_status and sst25l_match_device to use a single
    transfer synchronous message, the SFRMOUT signal stays asserted
    during the entire message so the correct data always gets returned.

    This change will have no effect on SPI masters which use a chip
    select mechanism (GPIO's, etc.) which does stay asserted correctly.
    As a bonus, the single transfer synchronous messages complete faster
    than multi-part messages.

    Signed-off-by: H Hartley Sweeten
    Signed-off-by: David Woodhouse

    H Hartley Sweeten
     

10 May, 2010

2 commits


30 Mar, 2010

1 commit

  • …it slab.h inclusion from percpu.h

    percpu.h is included by sched.h and module.h and thus ends up being
    included when building most .c files. percpu.h includes slab.h which
    in turn includes gfp.h making everything defined by the two files
    universally available and complicating inclusion dependencies.

    percpu.h -> slab.h dependency is about to be removed. Prepare for
    this change by updating users of gfp and slab facilities include those
    headers directly instead of assuming availability. As this conversion
    needs to touch large number of source files, the following script is
    used as the basis of conversion.

    http://userweb.kernel.org/~tj/misc/slabh-sweep.py

    The script does the followings.

    * Scan files for gfp and slab usages and update includes such that
    only the necessary includes are there. ie. if only gfp is used,
    gfp.h, if slab is used, slab.h.

    * When the script inserts a new include, it looks at the include
    blocks and try to put the new include such that its order conforms
    to its surrounding. It's put in the include block which contains
    core kernel includes, in the same order that the rest are ordered -
    alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
    doesn't seem to be any matching order.

    * If the script can't find a place to put a new include (mostly
    because the file doesn't have fitting include block), it prints out
    an error message indicating which .h file needs to be added to the
    file.

    The conversion was done in the following steps.

    1. The initial automatic conversion of all .c files updated slightly
    over 4000 files, deleting around 700 includes and adding ~480 gfp.h
    and ~3000 slab.h inclusions. The script emitted errors for ~400
    files.

    2. Each error was manually checked. Some didn't need the inclusion,
    some needed manual addition while adding it to implementation .h or
    embedding .c file was more appropriate for others. This step added
    inclusions to around 150 files.

    3. The script was run again and the output was compared to the edits
    from #2 to make sure no file was left behind.

    4. Several build tests were done and a couple of problems were fixed.
    e.g. lib/decompress_*.c used malloc/free() wrappers around slab
    APIs requiring slab.h to be added manually.

    5. The script was run on all .h files but without automatically
    editing them as sprinkling gfp.h and slab.h inclusions around .h
    files could easily lead to inclusion dependency hell. Most gfp.h
    inclusion directives were ignored as stuff from gfp.h was usually
    wildly available and often used in preprocessor macros. Each
    slab.h inclusion directive was examined and added manually as
    necessary.

    6. percpu.h was updated not to include slab.h.

    7. Build test were done on the following configurations and failures
    were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my
    distributed build env didn't work with gcov compiles) and a few
    more options had to be turned off depending on archs to make things
    build (like ipr on powerpc/64 which failed due to missing writeq).

    * x86 and x86_64 UP and SMP allmodconfig and a custom test config.
    * powerpc and powerpc64 SMP allmodconfig
    * sparc and sparc64 SMP allmodconfig
    * ia64 SMP allmodconfig
    * s390 SMP allmodconfig
    * alpha SMP allmodconfig
    * um on x86_64 SMP allmodconfig

    8. percpu.h modifications were reverted so that it could be applied as
    a separate patch and serve as bisection point.

    Given the fact that I had only a couple of failures from tests on step
    6, I'm fairly confident about the coverage of this conversion patch.
    If there is a breakage, it's likely to be something in one of the arch
    headers which should be easily discoverable easily on most builds of
    the specific arch.

    Signed-off-by: Tejun Heo <tj@kernel.org>
    Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
    Cc: Ingo Molnar <mingo@redhat.com>
    Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>

    Tejun Heo
     

18 Mar, 2010

2 commits

  • kasprintf combines kmalloc and sprintf, and takes care of the size
    calculation itself.

    The semantic patch that makes this change is as follows:
    (http://coccinelle.lip6.fr/)

    //
    @@
    expression a,flag;
    expression list args;
    statement S;
    @@

    a =
    - \(kmalloc\|kzalloc\)(...,flag)
    + kasprintf(flag,args)

    - sprintf(a,args);
    //

    Signed-off-by: Julia Lawall
    Signed-off-by: David Woodhouse

    Julia Lawall
     
  • Cosmetic fix: the path in the Makefile is wrong

    Signed-off-by: Matteo Croce
    Signed-off-by: David Woodhouse

    Matteo Croce
     

25 Feb, 2010

1 commit


17 Dec, 2009

1 commit

  • * git://git.infradead.org/mtd-2.6: (90 commits)
    jffs2: Fix long-standing bug with symlink garbage collection.
    mtd: OneNAND: Fix test of unsigned in onenand_otp_walk()
    mtd: cfi_cmdset_0002, fix lock imbalance
    Revert "mtd: move mxcnd_remove to .exit.text"
    mtd: m25p80: add support for Macronix MX25L4005A
    kmsg_dump: fix build for CONFIG_PRINTK=n
    mtd: nandsim: add support for 4KiB pages
    mtd: mtdoops: refactor as a kmsg_dumper
    mtd: mtdoops: make record size configurable
    mtd: mtdoops: limit the maximum mtd partition size
    mtd: mtdoops: keep track of used/unused pages in an array
    mtd: mtdoops: several minor cleanups
    core: Add kernel message dumper to call on oopses and panics
    mtd: add ARM pismo support
    mtd: pxa3xx_nand: Fix PIO data transfer
    mtd: nand: fix multi-chip suspend problem
    mtd: add support for switching old SST chips into QRY mode
    mtd: fix M29W800D dev_id and uaddr
    mtd: don't use PF_MEMALLOC
    mtd: Add bad block table overrides to Davinci NAND driver
    ...

    Fixed up conflicts (mostly trivial) in
    drivers/mtd/devices/m25p80.c
    drivers/mtd/maps/pcmciamtd.c
    drivers/mtd/nand/pxa3xx_nand.c
    kernel/printk.c

    Linus Torvalds
     

06 Dec, 2009

1 commit


04 Dec, 2009

1 commit

  • That is "success", "unknown", "through", "performance", "[re|un]mapping"
    , "access", "default", "reasonable", "[con]currently", "temperature"
    , "channel", "[un]used", "application", "example","hierarchy", "therefore"
    , "[over|under]flow", "contiguous", "threshold", "enough" and others.

    Signed-off-by: André Goddard Rosa
    Signed-off-by: Jiri Kosina

    André Goddard Rosa
     

30 Nov, 2009

4 commits

  • CAT25 chips (as manufactured by On Semiconductor, previously Catalyst
    Semiconductor) are similar to the original M25Px0 chips, except:

    - Address width can vary (1-2 bytes, in contrast to 3 bytes in M25P
    chips). So, implement convenient m25p_addr2cmd() and m25p_cmdsz()
    calls, and place address width information into flash_info struct;

    - Page size can vary, therefore we shouldn't hardcode it, so get rid
    of FLASH_PAGESIZE definition, and place the page size information
    into flash_info struct;

    - CAT25 EEPROMs don't need to be erased, so add NO_ERASE flag, and
    propagate it to the mtd subsystem.

    [dwmw2: Fix up for conflicts with DMA safety patch]
    Signed-off-by: Anton Vorontsov
    Signed-off-by: David Woodhouse

    Anton Vorontsov
     
  • Previosly the driver always tried JEDEC probing, assuming that non-JEDEC
    chips will return '0'. But truly non-JEDEC chips (like CAT25) won't do
    that, their behaviour on RDID command is undefined, so the driver should
    not call jedec_probe() for these chips.

    Also, be less strict on error conditions, don't fail to probe if JEDEC
    found a chip that is different from what platform code told, instead
    just print some warnings and use an information obtained via JEDEC. In
    that case we should not trust partitions any longer, but they might be
    still useful (i.e. they could protect some parts of the chip).

    Signed-off-by: Anton Vorontsov
    Signed-off-by: David Woodhouse

    Anton Vorontsov
     
  • This patch converts the m25p80 driver so that now it uses .id_table
    for device matching, making it properly detect devices on OpenFirmware
    platforms (prior to this patch the driver misdetected non-JEDEC chips,
    seeing all chips as "m25p80").

    Also, now jedec_probe() only does jedec probing, nothing else. If it
    is not able to detect a chip, NULL is returned and the driver fall
    backs to the information specified by the platform (platform_data, or
    exact ID).

    Signed-off-by: Anton Vorontsov
    Signed-off-by: David Woodhouse

    Anton Vorontsov
     
  • spi_write() requires the buffer to be DMA-safe, kmalloc()
    it seperately to ensure this.

    Signed-off-by: Johannes Stezenbach
    Signed-off-by: Artem Bityutskiy
    Signed-off-by: David Woodhouse

    Johannes Stezenbach
     

09 Nov, 2009

1 commit


17 Oct, 2009

1 commit

  • Fix a potential memory leak in mtd_dataflash driver.

    The private data that is allocated when registering a DataFlash
    device with the MTD subsystem is not released if an error occurs
    when add_mtd_partitions() or add_mtd_device() is called. Fix this
    by adding an error path. The memory is already released during a
    remove.

    Also, add a dev_set_drvdata(&spi->dev, NULL) before the kfree() so
    that the spi device does not reference invalid data.

    Signed-off-by: H Hartley Sweeten
    Cc: David Brownell
    Signed-off-by: Artem Bityutskiy
    Signed-off-by: David Woodhouse

    H Hartley Sweeten
     

12 Oct, 2009

1 commit


25 Sep, 2009

1 commit


24 Sep, 2009

1 commit

  • * git://git.infradead.org/mtd-2.6: (58 commits)
    mtd: jedec_probe: add PSD4256G6V id
    mtd: OneNand support for Nomadik 8815 SoC (on NHK8815 board)
    mtd: nand: driver for Nomadik 8815 SoC (on NHK8815 board)
    m25p80: Add Spansion S25FL129P serial flashes
    jffs2: Use SLAB_HWCACHE_ALIGN for jffs2_raw_{dirent,inode} slabs
    mtd: sh_flctl: register sh_flctl using platform_driver_probe()
    mtd: nand: txx9ndfmc: transfer 512 byte at a time if possible
    mtd: nand: fix tmio_nand ecc correction
    mtd: nand: add __nand_correct_data helper function
    mtd: cfi_cmdset_0002: add 0xFF intolerance for M29W128G
    mtd: inftl: fix fold chain block number
    mtd: jedec: fix compilation problem with I28F640C3B definition
    mtd: nand: fix ECC Correction bug for SMC ordering for NDFC driver
    mtd: ofpart: Check availability of reg property instead of name property
    driver/Makefile: Initialize "mtd" and "spi" before "net"
    mtd: omap: adding DMA mode support in nand prefetch/post-write
    mtd: omap: add support for nand prefetch-read and post-write
    mtd: add nand support for w90p910 (v2)
    mtd: maps: add mtd-ram support to physmap_of
    mtd: pxa3xx_nand: add single-bit error corrections reporting
    ...

    Linus Torvalds
     

23 Sep, 2009

1 commit

  • This makes it consistent with other buses (platform, i2c, vio, ...). I'm
    not sure why we use the prefixes, but there must be a reason.

    This was easy enough to do it, and I did it.

    Signed-off-by: Anton Vorontsov
    Cc: David Brownell
    Cc: David Woodhouse
    Cc: Grant Likely
    Cc: Jean Delvare
    Cc: Ben Dooks
    Cc: Benjamin Herrenschmidt
    Cc: Dmitry Torokhov
    Cc: Samuel Ortiz
    Cc: "John W. Linville"
    Acked-by: Mike Frysinger
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Anton Vorontsov
     

21 Sep, 2009

1 commit


20 Sep, 2009

7 commits


04 Sep, 2009

1 commit