Commit b2680ba4 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag 'spi-fix-v7.1-merge-window' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi

Pull spi fixes from Mark Brown:
 "This is quite a big set of fixes, almost all from Johan Hovold who is
  on an ongoing quest to clean up issues with probe and removal handling
  in drivers.

  There isn't anything too concerning here especially with the
  deregistration stuff which will very rarely get run in production
  systems since this is all platform devices in the SoC on embedded
  hardware, but it's all real issues which should be fixed. There's more
  in flight here.

  We also have a few other minor fixes, one from Felix Gu along the same
  lines as Johan's work and a couple of documentation things"

* tag 'spi-fix-v7.1-merge-window' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi: (23 commits)
  spi: fix controller cleanup() documentation
  spi: fix resource leaks on device setup failure
  spi: axiado: clean up probe return value
  spi: axiado: rename probe error labels
  spi: axiado: fix runtime pm imbalance on probe failure
  spi: orion: clean up probe return value
  spi: orion: fix clock imbalance on registration failure
  spi: orion: fix runtime pm leak on unbind
  spi: imx: fix runtime pm leak on probe deferral
  spi: mpc52xx: fix use-after-free on registration failure
  spi: Fix the error description in the `ptp_sts_word_post` comment
  spi: topcliff-pch: fix use-after-free on unbind
  spi: topcliff-pch: fix controller deregistration
  spi: orion: fix controller deregistration
  spi: mxic: fix controller deregistration
  spi: mpc52xx: fix use-after-free on unbind
  spi: mpc52xx: fix controller deregistration
  spi: cadence-quadspi: fix controller deregistration
  spi: cadence: fix controller deregistration
  spi: mtk-snfi: fix memory leak in probe
  ...
parents f6439983 16ab65df
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -59,7 +59,7 @@ unevaluatedProperties: false

examples:
  - |
    #include <dt-bindings/interrupt-controller/irq.h>
    #include <dt-bindings/gpio/gpio.h>

    spi@4c0 {
        compatible = "fsl,spi";
@@ -67,8 +67,8 @@ examples:
        cell-index = <0>;
        interrupts = <82 0>;
        mode = "cpu";
        cs-gpios = <&gpio 18 IRQ_TYPE_EDGE_RISING          // device reg=<0>
                    &gpio 19 IRQ_TYPE_EDGE_RISING>;        // device reg=<1>
        cs-gpios = <&gpio 18 GPIO_ACTIVE_HIGH>,        // device reg=<0>
                   <&gpio 19 GPIO_ACTIVE_HIGH>;        // device reg=<1>
    };

...
+2 −2
Original line number Diff line number Diff line
@@ -24655,8 +24655,8 @@ F: Documentation/devicetree/bindings/net/socionext,synquacer-netsec.yaml
F:	drivers/net/ethernet/socionext/netsec.c
SOCIONEXT (SNI) Synquacer SPI DRIVER
M:	Masahisa Kojima <masahisa.kojima@linaro.org>
M:	Jassi Brar <jaswinder.singh@linaro.org>
M:	Masahisa Kojima <kojima.masahisa@socionext.com>
M:	Jassi Brar <jassisinghbrar@gmail.com>
L:	linux-spi@vger.kernel.org
S:	Maintained
F:	Documentation/devicetree/bindings/spi/socionext,synquacer-spi.yaml
+19 −12
Original line number Diff line number Diff line
@@ -751,9 +751,9 @@ static const struct spi_controller_mem_ops ax_spi_mem_ops = {
 */
static int ax_spi_probe(struct platform_device *pdev)
{
	int ret = 0, irq;
	struct spi_controller *ctlr;
	struct ax_spi *xspi;
	int ret, irq;
	u32 num_cs;

	ctlr = devm_spi_alloc_host(&pdev->dev, sizeof(*xspi));
@@ -785,7 +785,7 @@ static int ax_spi_probe(struct platform_device *pdev)
	ret = clk_prepare_enable(xspi->ref_clk);
	if (ret) {
		dev_err(&pdev->dev, "Unable to enable device clock.\n");
		goto clk_dis_apb;
		goto err_disable_apb;
	}

	pm_runtime_use_autosuspend(&pdev->dev);
@@ -815,7 +815,7 @@ static int ax_spi_probe(struct platform_device *pdev)
	irq = platform_get_irq(pdev, 0);
	if (irq <= 0) {
		ret = -ENXIO;
		goto clk_dis_all;
		goto err_disable_rpm;
	}

	ret = devm_request_irq(&pdev->dev, irq, ax_spi_irq,
@@ -823,7 +823,7 @@ static int ax_spi_probe(struct platform_device *pdev)
	if (ret != 0) {
		ret = -ENXIO;
		dev_err(&pdev->dev, "request_irq failed\n");
		goto clk_dis_all;
		goto err_disable_rpm;
	}

	ctlr->use_gpio_descriptors = true;
@@ -842,23 +842,26 @@ static int ax_spi_probe(struct platform_device *pdev)

	ctlr->bits_per_word_mask = SPI_BPW_MASK(8);

	pm_runtime_put_autosuspend(&pdev->dev);

	ctlr->mem_ops = &ax_spi_mem_ops;

	ret = spi_register_controller(ctlr);
	if (ret) {
		dev_err(&pdev->dev, "spi_register_controller failed\n");
		goto clk_dis_all;
		goto err_disable_rpm;
	}

	return ret;
	pm_runtime_put_autosuspend(&pdev->dev);

clk_dis_all:
	pm_runtime_set_suspended(&pdev->dev);
	return 0;

err_disable_rpm:
	pm_runtime_disable(&pdev->dev);
	pm_runtime_put_noidle(&pdev->dev);
	pm_runtime_set_suspended(&pdev->dev);
	pm_runtime_dont_use_autosuspend(&pdev->dev);

	clk_disable_unprepare(xspi->ref_clk);
clk_dis_apb:
err_disable_apb:
	clk_disable_unprepare(xspi->pclk);

	return ret;
@@ -877,10 +880,14 @@ static void ax_spi_remove(struct platform_device *pdev)
	struct spi_controller *ctlr = platform_get_drvdata(pdev);
	struct ax_spi *xspi = spi_controller_get_devdata(ctlr);

	pm_runtime_get_sync(&pdev->dev);

	spi_unregister_controller(ctlr);

	pm_runtime_set_suspended(&pdev->dev);
	pm_runtime_disable(&pdev->dev);
	pm_runtime_put_noidle(&pdev->dev);
	pm_runtime_set_suspended(&pdev->dev);
	pm_runtime_dont_use_autosuspend(&pdev->dev);

	clk_disable_unprepare(xspi->ref_clk);
	clk_disable_unprepare(xspi->pclk);
+2 −2
Original line number Diff line number Diff line
@@ -2016,13 +2016,13 @@ static void cqspi_remove(struct platform_device *pdev)

	ddata = of_device_get_match_data(dev);

	spi_unregister_controller(cqspi->host);

	refcount_set(&cqspi->refcount, 0);

	if (!refcount_dec_and_test(&cqspi->inflight_ops))
		cqspi_wait_idle(cqspi);

	spi_unregister_controller(cqspi->host);

	if (cqspi->rx_chan)
		dma_release_channel(cqspi->rx_chan);

+5 −1
Original line number Diff line number Diff line
@@ -777,6 +777,10 @@ static void cdns_spi_remove(struct platform_device *pdev)
	struct spi_controller *ctlr = platform_get_drvdata(pdev);
	struct cdns_spi *xspi = spi_controller_get_devdata(ctlr);

	spi_controller_get(ctlr);

	spi_unregister_controller(ctlr);

	cdns_spi_write(xspi, CDNS_SPI_ER, CDNS_SPI_ER_DISABLE);

	if (!spi_controller_is_target(ctlr)) {
@@ -784,7 +788,7 @@ static void cdns_spi_remove(struct platform_device *pdev)
		pm_runtime_set_suspended(&pdev->dev);
	}

	spi_unregister_controller(ctlr);
	spi_controller_put(ctlr);
}

/**
Loading