Commit 8ded8f00 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'spi-fix-v4.8-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi

Pull spi fixes from Mark Brown:
 "As well as the usual driver fixes there's a couple of non-trivial core
  fixes in here:

   - Fixes for issues reported by Julia Lawall in the changes that were
     sent last time to fix interaction between the bus lock and the
     locking done for the SPI thread.  I'd let this one cook for a while
     to make sure nothing else came up in testing.

   - A fix from Sien Wu for arithmetic overflows when calculating the
     timeout for larger transfers (espcially common with slow buses with
     flashes on them)"

* tag 'spi-fix-v4.8-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi:
  spi: Prevent unexpected SPI time out due to arithmetic overflow
  spi: pxa2xx-pci: fix ACPI-based enumeration of SPI devices
  MAINTAINERS: add myself as Samsung SPI maintainer
  spi: Drop io_mutex in error paths
  spi: sh-msiof: Avoid invalid clock generator parameters
  spi: img-spfi: Remove spi_master_put in img_spfi_remove()
  spi: mediatek: remove spi_master_put in mtk_spi_remove()
  spi: qup: Remove spi_master_put in spi_qup_remove()
parents 8fa5729d ae4860b5
...@@ -1644,7 +1644,6 @@ F: drivers/*/*s3c64xx* ...@@ -1644,7 +1644,6 @@ F: drivers/*/*s3c64xx*
F: drivers/*/*s5pv210* F: drivers/*/*s5pv210*
F: drivers/memory/samsung/* F: drivers/memory/samsung/*
F: drivers/soc/samsung/* F: drivers/soc/samsung/*
F: drivers/spi/spi-s3c*
F: Documentation/arm/Samsung/ F: Documentation/arm/Samsung/
F: Documentation/devicetree/bindings/arm/samsung/ F: Documentation/devicetree/bindings/arm/samsung/
F: Documentation/devicetree/bindings/sram/samsung-sram.txt F: Documentation/devicetree/bindings/sram/samsung-sram.txt
...@@ -10254,6 +10253,17 @@ S: Supported ...@@ -10254,6 +10253,17 @@ S: Supported
L: linux-samsung-soc@vger.kernel.org (moderated for non-subscribers) L: linux-samsung-soc@vger.kernel.org (moderated for non-subscribers)
F: drivers/clk/samsung/ F: drivers/clk/samsung/
SAMSUNG SPI DRIVERS
M: Kukjin Kim <kgene@kernel.org>
M: Krzysztof Kozlowski <krzk@kernel.org>
M: Andi Shyti <andi.shyti@samsung.com>
L: linux-spi@vger.kernel.org
L: linux-samsung-soc@vger.kernel.org (moderated for non-subscribers)
S: Maintained
F: Documentation/devicetree/bindings/spi/spi-samsung.txt
F: drivers/spi/spi-s3c*
F: include/linux/platform_data/spi-s3c64xx.h
SAMSUNG SXGBE DRIVERS SAMSUNG SXGBE DRIVERS
M: Byungho An <bh74.an@samsung.com> M: Byungho An <bh74.an@samsung.com>
M: Girish K S <ks.giri@samsung.com> M: Girish K S <ks.giri@samsung.com>
......
...@@ -720,8 +720,6 @@ static int img_spfi_remove(struct platform_device *pdev) ...@@ -720,8 +720,6 @@ static int img_spfi_remove(struct platform_device *pdev)
clk_disable_unprepare(spfi->sys_clk); clk_disable_unprepare(spfi->sys_clk);
} }
spi_master_put(master);
return 0; return 0;
} }
......
...@@ -685,7 +685,6 @@ static int mtk_spi_remove(struct platform_device *pdev) ...@@ -685,7 +685,6 @@ static int mtk_spi_remove(struct platform_device *pdev)
pm_runtime_disable(&pdev->dev); pm_runtime_disable(&pdev->dev);
mtk_spi_reset(mdata); mtk_spi_reset(mdata);
spi_master_put(master);
return 0; return 0;
} }
......
...@@ -214,6 +214,7 @@ static int pxa2xx_spi_pci_probe(struct pci_dev *dev, ...@@ -214,6 +214,7 @@ static int pxa2xx_spi_pci_probe(struct pci_dev *dev,
return PTR_ERR(ssp->clk); return PTR_ERR(ssp->clk);
memset(&pi, 0, sizeof(pi)); memset(&pi, 0, sizeof(pi));
pi.fwnode = dev->dev.fwnode;
pi.parent = &dev->dev; pi.parent = &dev->dev;
pi.name = "pxa2xx-spi"; pi.name = "pxa2xx-spi";
pi.id = ssp->port_id; pi.id = ssp->port_id;
......
...@@ -1030,7 +1030,6 @@ static int spi_qup_remove(struct platform_device *pdev) ...@@ -1030,7 +1030,6 @@ static int spi_qup_remove(struct platform_device *pdev)
pm_runtime_put_noidle(&pdev->dev); pm_runtime_put_noidle(&pdev->dev);
pm_runtime_disable(&pdev->dev); pm_runtime_disable(&pdev->dev);
spi_master_put(master);
return 0; return 0;
} }
......
...@@ -262,6 +262,9 @@ static void sh_msiof_spi_set_clk_regs(struct sh_msiof_spi_priv *p, ...@@ -262,6 +262,9 @@ static void sh_msiof_spi_set_clk_regs(struct sh_msiof_spi_priv *p,
for (k = 0; k < ARRAY_SIZE(sh_msiof_spi_div_table); k++) { for (k = 0; k < ARRAY_SIZE(sh_msiof_spi_div_table); k++) {
brps = DIV_ROUND_UP(div, sh_msiof_spi_div_table[k].div); brps = DIV_ROUND_UP(div, sh_msiof_spi_div_table[k].div);
/* SCR_BRDV_DIV_1 is valid only if BRPS is x 1/1 or x 1/2 */
if (sh_msiof_spi_div_table[k].div == 1 && brps > 2)
continue;
if (brps <= 32) /* max of brdv is 32 */ if (brps <= 32) /* max of brdv is 32 */
break; break;
} }
......
...@@ -960,7 +960,7 @@ static int spi_transfer_one_message(struct spi_master *master, ...@@ -960,7 +960,7 @@ static int spi_transfer_one_message(struct spi_master *master,
struct spi_transfer *xfer; struct spi_transfer *xfer;
bool keep_cs = false; bool keep_cs = false;
int ret = 0; int ret = 0;
unsigned long ms = 1; unsigned long long ms = 1;
struct spi_statistics *statm = &master->statistics; struct spi_statistics *statm = &master->statistics;
struct spi_statistics *stats = &msg->spi->statistics; struct spi_statistics *stats = &msg->spi->statistics;
...@@ -991,9 +991,13 @@ static int spi_transfer_one_message(struct spi_master *master, ...@@ -991,9 +991,13 @@ static int spi_transfer_one_message(struct spi_master *master,
if (ret > 0) { if (ret > 0) {
ret = 0; ret = 0;
ms = xfer->len * 8 * 1000 / xfer->speed_hz; ms = 8LL * 1000LL * xfer->len;
do_div(ms, xfer->speed_hz);
ms += ms + 100; /* some tolerance */ ms += ms + 100; /* some tolerance */
if (ms > UINT_MAX)
ms = UINT_MAX;
ms = wait_for_completion_timeout(&master->xfer_completion, ms = wait_for_completion_timeout(&master->xfer_completion,
msecs_to_jiffies(ms)); msecs_to_jiffies(ms));
} }
...@@ -1159,6 +1163,7 @@ static void __spi_pump_messages(struct spi_master *master, bool in_kthread) ...@@ -1159,6 +1163,7 @@ static void __spi_pump_messages(struct spi_master *master, bool in_kthread)
if (ret < 0) { if (ret < 0) {
dev_err(&master->dev, "Failed to power device: %d\n", dev_err(&master->dev, "Failed to power device: %d\n",
ret); ret);
mutex_unlock(&master->io_mutex);
return; return;
} }
} }
...@@ -1174,6 +1179,7 @@ static void __spi_pump_messages(struct spi_master *master, bool in_kthread) ...@@ -1174,6 +1179,7 @@ static void __spi_pump_messages(struct spi_master *master, bool in_kthread)
if (master->auto_runtime_pm) if (master->auto_runtime_pm)
pm_runtime_put(master->dev.parent); pm_runtime_put(master->dev.parent);
mutex_unlock(&master->io_mutex);
return; return;
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment