17 Jul, 2020

1 commit

  • No attempt has been made to document any of the demoted functions here.

    Fixes the following W=1 kernel build warning(s):

    drivers/spi/spi-bitbang.c:181: warning: Function parameter or member 'spi' not described in 'spi_bitbang_setup'
    drivers/spi/spi-bitbang.c:215: warning: Function parameter or member 'spi' not described in 'spi_bitbang_cleanup'
    drivers/spi/spi-bitbang.c:434: warning: Function parameter or member 'bitbang' not described in 'spi_bitbang_stop'

    Signed-off-by: Lee Jones
    Link: https://lore.kernel.org/r/20200717135424.2442271-3-lee.jones@linaro.org
    Signed-off-by: Mark Brown

    Lee Jones
     

10 Dec, 2019

1 commit

  • The ->chipselect() callback on the bit-banged SPI library
    master is optional if using GPIO descriptors: when using
    descriptors exclusively without any native chipselects,
    the core does not even call out the the native ->set_cs()
    and therefore ->chipselect() on a bit-banged SPI master
    will not even be called in this case.

    Make sure to respect the SPI_MASTER_GPIO_SS as used by
    e.g. spi-gpio.c though: this setting will make the core
    handle the chip select using GPIO descriptors *AND* call
    the local chipselect handler.

    Signed-off-by: Linus Walleij
    Link: https://lore.kernel.org/r/20191205091340.59850-1-linus.walleij@linaro.org
    Signed-off-by: Mark Brown

    Linus Walleij
     

11 Jun, 2019

1 commit

  • Pull spi fixes from Mark Brown:
    "A small set of fixes here.

    One core fix for error handling when we fail to set up the hardware
    before initiating a transfer and another one reverting a change in the
    core which broke Raspberry Pi in common use cases as part of some
    optimization work.

    There's also a couple of driver specific fixes"

    * tag 'spi-fix-v5.2-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi:
    spi: abort spi_sync if failed to prepare_transfer_hardware
    spi: spi-fsl-spi: call spi_finalize_current_message() at the end
    spi: bitbang: Fix NULL pointer dereference in spi_unregister_master
    spi: Fix Raspberry Pi breakage

    Linus Torvalds
     

31 May, 2019

1 commit

  • Based on 3 normalized pattern(s):

    this program is free software you can redistribute it and or modify
    it under the terms of the gnu general public license as published by
    the free software foundation either version 2 of the license or at
    your option any later version this program is distributed in the
    hope that it will be useful but without any warranty without even
    the implied warranty of merchantability or fitness for a particular
    purpose see the gnu general public license for more details

    this program is free software you can redistribute it and or modify
    it under the terms of the gnu general public license as published by
    the free software foundation either version 2 of the license or at
    your option any later version [author] [kishon] [vijay] [abraham]
    [i] [kishon]@[ti] [com] this program is distributed in the hope that
    it will be useful but without any warranty without even the implied
    warranty of merchantability or fitness for a particular purpose see
    the gnu general public license for more details

    this program is free software you can redistribute it and or modify
    it under the terms of the gnu general public license as published by
    the free software foundation either version 2 of the license or at
    your option any later version [author] [graeme] [gregory]
    [gg]@[slimlogic] [co] [uk] [author] [kishon] [vijay] [abraham] [i]
    [kishon]@[ti] [com] [based] [on] [twl6030]_[usb] [c] [author] [hema]
    [hk] [hemahk]@[ti] [com] this program is distributed in the hope
    that it will be useful but without any warranty without even the
    implied warranty of merchantability or fitness for a particular
    purpose see the gnu general public license for more details

    extracted by the scancode license scanner the SPDX license identifier

    GPL-2.0-or-later

    has been chosen to replace the boilerplate/reference in 1105 file(s).

    Signed-off-by: Thomas Gleixner
    Reviewed-by: Allison Randal
    Reviewed-by: Richard Fontana
    Reviewed-by: Kate Stewart
    Cc: linux-spdx@vger.kernel.org
    Link: https://lkml.kernel.org/r/20190527070033.202006027@linutronix.de
    Signed-off-by: Greg Kroah-Hartman

    Thomas Gleixner
     

16 May, 2019

1 commit

  • If spi_register_master fails in spi_bitbang_start
    because device_add failure, We should return the
    error code other than 0, otherwise calling
    spi_bitbang_stop may trigger NULL pointer dereference
    like this:

    BUG: KASAN: null-ptr-deref in __list_del_entry_valid+0x45/0xd0
    Read of size 8 at addr 0000000000000000 by task syz-executor.0/3661

    CPU: 0 PID: 3661 Comm: syz-executor.0 Not tainted 5.1.0+ #28
    Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.2-1ubuntu1 04/01/2014
    Call Trace:
    dump_stack+0xa9/0x10e
    ? __list_del_entry_valid+0x45/0xd0
    ? __list_del_entry_valid+0x45/0xd0
    __kasan_report+0x171/0x18d
    ? __list_del_entry_valid+0x45/0xd0
    kasan_report+0xe/0x20
    __list_del_entry_valid+0x45/0xd0
    spi_unregister_controller+0x99/0x1b0
    spi_lm70llp_attach+0x3ae/0x4b0 [spi_lm70llp]
    ? 0xffffffffc1128000
    ? klist_next+0x131/0x1e0
    ? driver_detach+0x40/0x40 [parport]
    port_check+0x3b/0x50 [parport]
    bus_for_each_dev+0x115/0x180
    ? subsys_dev_iter_exit+0x20/0x20
    __parport_register_driver+0x1f0/0x210 [parport]
    ? 0xffffffffc1150000
    do_one_initcall+0xb9/0x3b5
    ? perf_trace_initcall_level+0x270/0x270
    ? kasan_unpoison_shadow+0x30/0x40
    ? kasan_unpoison_shadow+0x30/0x40
    do_init_module+0xe0/0x330
    load_module+0x38eb/0x4270
    ? module_frob_arch_sections+0x20/0x20
    ? kernel_read_file+0x188/0x3f0
    ? find_held_lock+0x6d/0xd0
    ? fput_many+0x1a/0xe0
    ? __do_sys_finit_module+0x162/0x190
    __do_sys_finit_module+0x162/0x190
    ? __ia32_sys_init_module+0x40/0x40
    ? __mutex_unlock_slowpath+0xb4/0x3f0
    ? wait_for_completion+0x240/0x240
    ? vfs_write+0x160/0x2a0
    ? lockdep_hardirqs_off+0xb5/0x100
    ? mark_held_locks+0x1a/0x90
    ? do_syscall_64+0x14/0x2a0
    do_syscall_64+0x72/0x2a0
    entry_SYSCALL_64_after_hwframe+0x49/0xbe

    Reported-by: Hulk Robot
    Fixes: 702a4879ec33 ("spi: bitbang: Let spi_bitbang_start() take a reference to master")
    Signed-off-by: YueHaibing
    Reviewed-by: Geert Uytterhoeven
    Reviewed-by: Axel Lin
    Reviewed-by: Mukesh Ojha
    Signed-off-by: Mark Brown

    YueHaibing
     

08 Apr, 2019

1 commit

  • Move all of the code doing struct spi_bitbang initialization, so that
    it can be paired with devm_spi_register_master() in order to avoid
    having to call spi_bitbang_stop() explicitly.

    Signed-off-by: Andrey Smirnov
    Cc: Mark Brown
    Cc: Chris Healy
    Cc: linux-spi@vger.kernel.org
    Cc: linux-kernel@vger.kernel.org
    Signed-off-by: Mark Brown

    Andrey Smirnov
     

17 Jan, 2019

1 commit


01 Aug, 2018

2 commits

  • Add SPI_3WIRE support to spi-gpio controller introducing
    set_line_direction function pointer in spi_bitbang data structure.
    Spi-gpio controller has been tested using hts221 temp/rh iio sensor
    running in 3wire mode and lsm6dsm running in 4wire mode

    Signed-off-by: Lorenzo Bianconi
    Signed-off-by: Mark Brown

    Lorenzo Bianconi
     
  • Add the capability to specify the flag parameter used in
    bitbang_txrx_be_cpha{0,1} through the txrx_word function pointers of
    spi_bitbang data structure. That feature will be used to add spi-3wire
    support to the spi-gpio controller

    Signed-off-by: Lorenzo Bianconi
    Signed-off-by: Mark Brown

    Lorenzo Bianconi
     

05 Oct, 2015

2 commits


17 Sep, 2015

1 commit

  • chipselect (in the case of spi-gpio: spi_gpio_chipselect, which
    calls gpiod_set_raw_value_cansleep) can sleep, so we should not
    hold a spinlock while calling it from spi_bitbang_setup.

    This issue was introduced by this commit, which converted spi-gpio
    to cansleep variants:
    d9dda5a191 "spi: spi-gpio: Use 'cansleep' variants to access GPIO"

    Replacing the lock variable by a mutex fixes the issue: This is
    safe as all instances where the lock is used are called from
    contexts that can sleep.

    Finally, update spi-ppc4xx and and spi-s3c24xx to use mutex
    functions, as they directly hold the lock for similar purpose.

    Signed-off-by: Nicolas Boichat
    Signed-off-by: Mark Brown

    Nicolas Boichat
     

18 Apr, 2015

1 commit

  • Some controller drivers have no need of this callback (spi-altera even
    causes a NULL pointer dereference because it doesn't register the callback,
    falsely assuming that it is already optional).

    Fixes: 30af9b558a56 ("spi/bitbang: Drop empty setup() functions")
    Signed-off-by: Pelle Nilsson
    Reviewed-by: Ezequiel Garcia
    Signed-off-by: Mark Brown

    Pelle Nilsson
     

22 Dec, 2014

1 commit


30 Mar, 2014

1 commit


29 Mar, 2014

1 commit


03 Feb, 2014

1 commit


15 Oct, 2013

1 commit

  • Fix the following checkpatch warnings

    WARNING: sizeof *cs should be sizeof(*cs)
    WARNING: please, no space before tabs
    WARNING: space prohibited between function name and open parenthesis '('
    WARNING: line over 80 characters

    Signed-off-by: Jingoo Han
    Signed-off-by: Mark Brown

    Jingoo Han
     

07 Oct, 2013

1 commit

  • Many drivers that use bitbang library have a leak on probe error paths.
    This is because once a spi_master_get() call succeeds, we need an additional
    spi_master_put() call to free the memory.

    Fix this issue by moving the code taking a reference to master to
    spi_bitbang_start(), so spi_bitbang_start() will take a reference to master on
    success. With this change, the caller is responsible for calling
    spi_bitbang_stop() to decrement the reference and spi_master_put() as
    counterpart of spi_alloc_master() to prevent a memory leak.

    So now we have below patten for drivers using bitbang library:

    probe:
    spi_alloc_master -> Init reference count to 1
    spi_bitbang_start -> Increment reference count
    remove:
    spi_bitbang_stop -> Decrement reference count
    spi_master_put -> Decrement reference count (reference count reaches 0)

    Fixup all users accordingly.

    Signed-off-by: Axel Lin
    Suggested-by: Uwe Kleine-Koenig
    Acked-by: Uwe Kleine-Koenig
    Signed-off-by: Mark Brown

    Axel Lin
     

07 Sep, 2013

1 commit

  • Pull trivial tree from Jiri Kosina:
    "The usual trivial updates all over the tree -- mostly typo fixes and
    documentation updates"

    * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial: (52 commits)
    doc: Documentation/cputopology.txt fix typo
    treewide: Convert retrun typos to return
    Fix comment typo for init_cma_reserved_pageblock
    Documentation/trace: Correcting and extending tracepoint documentation
    mm/hotplug: fix a typo in Documentation/memory-hotplug.txt
    power: Documentation: Update s2ram link
    doc: fix a typo in Documentation/00-INDEX
    Documentation/printk-formats.txt: No casts needed for u64/s64
    doc: Fix typo "is is" in Documentations
    treewide: Fix printks with 0x%#
    zram: doc fixes
    Documentation/kmemcheck: update kmemcheck documentation
    doc: documentation/hwspinlock.txt fix typo
    PM / Hibernate: add section for resume options
    doc: filesystems : Fix typo in Documentations/filesystems
    scsi/megaraid fixed several typos in comments
    ppc: init_32: Fix error typo "CONFIG_START_KERNEL"
    treewide: Add __GFP_NOWARN to k.alloc calls with v.alloc fallbacks
    page_isolation: Fix a comment typo in test_pages_isolated()
    doc: fix a typo about irq affinity
    ...

    Linus Torvalds
     

20 Aug, 2013

1 commit


15 Aug, 2013

1 commit


10 Aug, 2013

1 commit


18 Jul, 2013

2 commits

  • Since commit 2025172e3 (spi/bitbang: Use core message pump), the following
    kernel crash is seen:

    Unable to handle kernel NULL pointer dereference at virtual address 0000000d
    pgd = 80004000
    [0000000d] *pgd=00000000
    Internal error: Oops: 5 [#1] SMP ARM
    Modules linked in:
    CPU: 1 PID: 48 Comm: spi32766 Not tainted 3.11.0-rc1+ #4
    task: bfa3e580 ti: bfb90000 task.ti: bfb90000
    PC is at spi_bitbang_transfer_one+0x50/0x248
    LR is at spi_bitbang_transfer_one+0x20/0x248
    ...

    ,and also the following build warning:

    drivers/spi/spi-bitbang.c: In function 'spi_bitbang_start':
    drivers/spi/spi-bitbang.c:436:31: warning: assignment from incompatible pointer type [enabled by default]

    In order to fix it, we need to change the first parameter of
    spi_bitbang_transfer_one() to 'struct spi_master *master'.

    Tested on a mx6qsabrelite by succesfully probing a SPI NOR flash.

    Signed-off-by: Fabio Estevam
    Signed-off-by: Mark Brown

    Fabio Estevam
     
  • Convert drivers using bitbang to use the core mesasge pump infrastructure,
    saving some code and meaning that these drivers get to take advantage of
    work done on improving the core implementation.

    Signed-off-by: Mark Brown

    Mark Brown
     

15 Jul, 2013

2 commits


05 Feb, 2013

2 commits


14 Jan, 2013

1 commit


14 Nov, 2012

2 commits


01 Nov, 2011

1 commit


06 Jun, 2011

1 commit

  • Sort the SPI makefile and enforce the naming convention spi_*.c for
    spi drivers.

    This change also rolls the contents of atmel_spi.h into the .c file
    since there is only one user of that particular include file.

    v2: - Use 'spi-' prefix instead of 'spi_' to match what seems to be
    be the predominant pattern for subsystem prefixes.
    - Clean up filenames in Kconfig and header comment blocks

    Signed-off-by: Grant Likely
    Acked-by: Wolfram Sang
    Acked-by: Linus Walleij

    Grant Likely