Unverified Commit f5b19425 authored by Mark Brown's avatar Mark Brown
Browse files

spi: switch to use modern name (part2)

Merge series from Yang Yingliang <yangyingliang@huawei.com>:

I'm trying to rename the legacy name to modern name used in SPI drivers,
this is part2 patchset.

After introducing devm_spi_alloc_host/spi_alloc_host(), the legacy
named function devm_spi_alloc_master/spi_alloc_master() can be replaced.
And also change other legacy name master/slave to modern name host/target
or controller. All compile test passed.

Yang Yingliang (20):
  spi: amlogic-spifc-a1: switch to use devm_spi_alloc_host()
  spi: au1550: switch to use modern name
  spi: ep93xx: switch to use modern name
  spi: falcon: switch to use modern name
  spi: fsi: switch to use spi_alloc_host()
  spi: fsl-dspi: switch to use modern name
  spi: fsl-espi: switch to use modern name
  spi: fsl-lpspi: switch to use modern name
  spi: fsl-qspi: switch to use modern name
  spi: fsl-spi: switch to use modern name
  spi: gpio: switch to use modern name
  spi: gxp: switch to use modern name
  spi: bcmbca-hsspi: switch to use modern name
  spi: hisi-sfc-v3xx: switch to use modern name
  spi: img-spfi: switch to use modern name
  spi: imx: switch to use modern name
  spi: ingenic: switch to use devm_spi_alloc_host()
  spi: intel: switch to use modern name
  spi: jcore: switch to use modern name
  spi: lantiq: switch to use modern name

 drivers/spi/spi-amlogic-spifc-a1.c |   2 +-
 drivers/spi/spi-au1550.c           |  74 ++++++------
 drivers/spi/spi-bcmbca-hsspi.c     |  66 +++++------
 drivers/spi/spi-ep93xx.c           | 174 ++++++++++++++---------------
 drivers/spi/spi-falcon.c           |  34 +++---
 drivers/spi/spi-fsi.c              |   2 +-
 drivers/spi/spi-fsl-dspi.c         |  24 ++--
 drivers/spi/spi-fsl-espi.c         |  76 ++++++-------
 drivers/spi/spi-fsl-lpspi.c        |  54 ++++-----
 drivers/spi/spi-fsl-qspi.c         |  10 +-
 drivers/spi/spi-fsl-spi.c          |  76 ++++++-------
 drivers/spi/spi-gpio.c             |  72 ++++++------
 drivers/spi/spi-gxp.c              |   6 +-
 drivers/spi/spi-hisi-sfc-v3xx.c    |  18 +--
 drivers/spi/spi-img-spfi.c         | 118 +++++++++----------
 drivers/spi/spi-imx.c              | 114 +++++++++----------
 drivers/spi/spi-ingenic.c          |   2 +-
 drivers/spi/spi-intel.c            |  42 +++----
 drivers/spi/spi-jcore.c            |  44 ++++----
 drivers/spi/spi-lantiq-ssc.c       |  96 ++++++++--------
 20 files changed, 552 insertions(+), 552 deletions(-)

--
2.25.1
parents 675b8e35 ea11a8bb
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -326,7 +326,7 @@ static int amlogic_spifc_a1_probe(struct platform_device *pdev)
	struct amlogic_spifc_a1 *spifc;
	int ret;

	ctrl = devm_spi_alloc_master(&pdev->dev, sizeof(*spifc));
	ctrl = devm_spi_alloc_host(&pdev->dev, sizeof(*spifc));
	if (!ctrl)
		return -ENOMEM;

+37 −37
Original line number Diff line number Diff line
@@ -54,7 +54,7 @@ struct au1550_spi {
	int (*txrx_bufs)(struct spi_device *spi, struct spi_transfer *t);
	irqreturn_t (*irq_callback)(struct au1550_spi *hw);

	struct completion master_done;
	struct completion host_done;

	unsigned int usedma;
	u32 dma_tx_id;
@@ -66,7 +66,7 @@ struct au1550_spi {
	unsigned int dma_rx_tmpbuf_size;
	u32 dma_rx_tmpbuf_addr;

	struct spi_master *master;
	struct spi_controller *host;
	struct device *dev;
	struct au1550_spi_info *pdata;
	struct resource *ioarea;
@@ -159,7 +159,7 @@ static void au1550_spi_reset_fifos(struct au1550_spi *hw)
 */
static void au1550_spi_chipsel(struct spi_device *spi, int value)
{
	struct au1550_spi *hw = spi_master_get_devdata(spi->master);
	struct au1550_spi *hw = spi_controller_get_devdata(spi->controller);
	unsigned int cspol = spi->mode & SPI_CS_HIGH ? 1 : 0;
	u32 cfg, stat;

@@ -219,7 +219,7 @@ static void au1550_spi_chipsel(struct spi_device *spi, int value)

static int au1550_spi_setupxfer(struct spi_device *spi, struct spi_transfer *t)
{
	struct au1550_spi *hw = spi_master_get_devdata(spi->master);
	struct au1550_spi *hw = spi_controller_get_devdata(spi->controller);
	unsigned int bpw, hz;
	u32 cfg, stat;

@@ -272,7 +272,7 @@ static int au1550_spi_setupxfer(struct spi_device *spi, struct spi_transfer *t)
 * no reliable way how to recognize that spi transfer is done
 * dma complete callbacks are called before real spi transfer is finished
 * and if only tx dma channel is set up (and rx fifo overflow event masked)
 * spi master done event irq is not generated unless rx fifo is empty (emptied)
 * spi host done event irq is not generated unless rx fifo is empty (emptied)
 * so we need rx tmp buffer to use for rx dma if user does not provide one
 */
static int au1550_spi_dma_rxtmp_alloc(struct au1550_spi *hw, unsigned int size)
@@ -303,7 +303,7 @@ static void au1550_spi_dma_rxtmp_free(struct au1550_spi *hw)

static int au1550_spi_dma_txrxb(struct spi_device *spi, struct spi_transfer *t)
{
	struct au1550_spi *hw = spi_master_get_devdata(spi->master);
	struct au1550_spi *hw = spi_controller_get_devdata(spi->controller);
	dma_addr_t dma_tx_addr;
	dma_addr_t dma_rx_addr;
	u32 res;
@@ -387,7 +387,7 @@ static int au1550_spi_dma_txrxb(struct spi_device *spi, struct spi_transfer *t)
	hw->regs->psc_spipcr = PSC_SPIPCR_MS;
	wmb(); /* drain writebuffer */

	wait_for_completion(&hw->master_done);
	wait_for_completion(&hw->host_done);

	au1xxx_dbdma_stop(hw->dma_tx_ch);
	au1xxx_dbdma_stop(hw->dma_rx_ch);
@@ -449,7 +449,7 @@ static irqreturn_t au1550_spi_dma_irq_callback(struct au1550_spi *hw)
				"dma transfer: unexpected SPI error (event=0x%x stat=0x%x)!\n",
				evnt, stat);

		complete(&hw->master_done);
		complete(&hw->host_done);
		return IRQ_HANDLED;
	}

@@ -458,7 +458,7 @@ static irqreturn_t au1550_spi_dma_irq_callback(struct au1550_spi *hw)
		au1550_spi_mask_ack_all(hw);
		hw->rx_count = hw->len;
		hw->tx_count = hw->len;
		complete(&hw->master_done);
		complete(&hw->host_done);
	}
	return IRQ_HANDLED;
}
@@ -502,7 +502,7 @@ AU1550_SPI_TX_WORD(32, 0xffffff)
static int au1550_spi_pio_txrxb(struct spi_device *spi, struct spi_transfer *t)
{
	u32 stat, mask;
	struct au1550_spi *hw = spi_master_get_devdata(spi->master);
	struct au1550_spi *hw = spi_controller_get_devdata(spi->controller);

	hw->tx = t->tx_buf;
	hw->rx = t->rx_buf;
@@ -537,7 +537,7 @@ static int au1550_spi_pio_txrxb(struct spi_device *spi, struct spi_transfer *t)
	hw->regs->psc_spipcr = PSC_SPIPCR_MS;
	wmb(); /* drain writebuffer */

	wait_for_completion(&hw->master_done);
	wait_for_completion(&hw->host_done);

	return min(hw->rx_count, hw->tx_count);
}
@@ -568,7 +568,7 @@ static irqreturn_t au1550_spi_pio_irq_callback(struct au1550_spi *hw)
		dev_err(hw->dev,
			"pio transfer: unexpected SPI error (event=0x%x stat=0x%x)!\n",
			evnt, stat);
		complete(&hw->master_done);
		complete(&hw->host_done);
		return IRQ_HANDLED;
	}

@@ -605,11 +605,11 @@ static irqreturn_t au1550_spi_pio_irq_callback(struct au1550_spi *hw)
	/*
	 * Restart the SPI transmission in case of a transmit underflow.
	 * This seems to work despite the notes in the Au1550 data book
	 * of Figure 8-4 with flowchart for SPI master operation:
	 * of Figure 8-4 with flowchart for SPI host operation:
	 *
	 * """Note 1: An XFR Error Interrupt occurs, unless masked,
	 * for any of the following events: Tx FIFO Underflow,
	 * Rx FIFO Overflow, or Multiple-master Error
	 * Rx FIFO Overflow, or Multiple-host Error
	 *    Note 2: In case of a Tx Underflow Error, all zeroes are
	 * transmitted."""
	 *
@@ -627,14 +627,14 @@ static irqreturn_t au1550_spi_pio_irq_callback(struct au1550_spi *hw)
	if (hw->rx_count >= hw->len) {
		/* transfer completed successfully */
		au1550_spi_mask_ack_all(hw);
		complete(&hw->master_done);
		complete(&hw->host_done);
	}
	return IRQ_HANDLED;
}

static int au1550_spi_txrx_bufs(struct spi_device *spi, struct spi_transfer *t)
{
	struct au1550_spi *hw = spi_master_get_devdata(spi->master);
	struct au1550_spi *hw = spi_controller_get_devdata(spi->controller);

	return hw->txrx_bufs(spi, t);
}
@@ -723,24 +723,24 @@ static void au1550_spi_setup_psc_as_spi(struct au1550_spi *hw)
static int au1550_spi_probe(struct platform_device *pdev)
{
	struct au1550_spi *hw;
	struct spi_master *master;
	struct spi_controller *host;
	struct resource *r;
	int err = 0;

	master = spi_alloc_master(&pdev->dev, sizeof(struct au1550_spi));
	if (master == NULL) {
		dev_err(&pdev->dev, "No memory for spi_master\n");
	host = spi_alloc_host(&pdev->dev, sizeof(struct au1550_spi));
	if (host == NULL) {
		dev_err(&pdev->dev, "No memory for spi_controller\n");
		err = -ENOMEM;
		goto err_nomem;
	}

	/* the spi->mode bits understood by this driver: */
	master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH | SPI_LSB_FIRST;
	master->bits_per_word_mask = SPI_BPW_RANGE_MASK(4, 24);
	host->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH | SPI_LSB_FIRST;
	host->bits_per_word_mask = SPI_BPW_RANGE_MASK(4, 24);

	hw = spi_master_get_devdata(master);
	hw = spi_controller_get_devdata(host);

	hw->master = master;
	hw->host = host;
	hw->pdata = dev_get_platdata(&pdev->dev);
	hw->dev = &pdev->dev;

@@ -798,9 +798,9 @@ static int au1550_spi_probe(struct platform_device *pdev)

	platform_set_drvdata(pdev, hw);

	init_completion(&hw->master_done);
	init_completion(&hw->host_done);

	hw->bitbang.master = hw->master;
	hw->bitbang.master = hw->host;
	hw->bitbang.setup_transfer = au1550_spi_setupxfer;
	hw->bitbang.chipselect = au1550_spi_chipsel;
	hw->bitbang.txrx_bufs = au1550_spi_txrx_bufs;
@@ -858,8 +858,8 @@ static int au1550_spi_probe(struct platform_device *pdev)
		goto err_no_irq;
	}

	master->bus_num = pdev->id;
	master->num_chipselect = hw->pdata->num_chipselect;
	host->bus_num = pdev->id;
	host->num_chipselect = hw->pdata->num_chipselect;

	/*
	 *  precompute valid range for spi freq - from au1550 datasheet:
@@ -874,8 +874,8 @@ static int au1550_spi_probe(struct platform_device *pdev)
		int min_div = (2 << 0) * (2 * (4 + 1));
		int max_div = (2 << 3) * (2 * (63 + 1));

		master->max_speed_hz = hw->pdata->mainclk_hz / min_div;
		master->min_speed_hz =
		host->max_speed_hz = hw->pdata->mainclk_hz / min_div;
		host->min_speed_hz =
				hw->pdata->mainclk_hz / (max_div + 1) + 1;
	}

@@ -883,13 +883,13 @@ static int au1550_spi_probe(struct platform_device *pdev)

	err = spi_bitbang_start(&hw->bitbang);
	if (err) {
		dev_err(&pdev->dev, "Failed to register SPI master\n");
		dev_err(&pdev->dev, "Failed to register SPI host\n");
		goto err_register;
	}

	dev_info(&pdev->dev,
		"spi master registered: bus_num=%d num_chipselect=%d\n",
		master->bus_num, master->num_chipselect);
		"spi host registered: bus_num=%d num_chipselect=%d\n",
		host->bus_num, host->num_chipselect);

	return 0;

@@ -917,7 +917,7 @@ static int au1550_spi_probe(struct platform_device *pdev)

err_no_iores:
err_no_pdata:
	spi_master_put(hw->master);
	spi_controller_put(hw->host);

err_nomem:
	return err;
@@ -927,8 +927,8 @@ static void au1550_spi_remove(struct platform_device *pdev)
{
	struct au1550_spi *hw = platform_get_drvdata(pdev);

	dev_info(&pdev->dev, "spi master remove: bus_num=%d\n",
		hw->master->bus_num);
	dev_info(&pdev->dev, "spi host remove: bus_num=%d\n",
		hw->host->bus_num);

	spi_bitbang_stop(&hw->bitbang);
	free_irq(hw->irq, hw);
@@ -941,7 +941,7 @@ static void au1550_spi_remove(struct platform_device *pdev)
		au1xxx_dbdma_chan_free(hw->dma_tx_ch);
	}

	spi_master_put(hw->master);
	spi_controller_put(hw->host);
}

/* work with hotplug and coldplug */
+33 −33
Original line number Diff line number Diff line
@@ -127,7 +127,7 @@ static ssize_t wait_mode_show(struct device *dev, struct device_attribute *attr,
			 char *buf)
{
	struct spi_controller *ctrl = dev_get_drvdata(dev);
	struct bcmbca_hsspi *bs = spi_master_get_devdata(ctrl);
	struct bcmbca_hsspi *bs = spi_controller_get_devdata(ctrl);

	return sprintf(buf, "%d\n", bs->wait_mode);
}
@@ -136,7 +136,7 @@ static ssize_t wait_mode_store(struct device *dev, struct device_attribute *attr
			  const char *buf, size_t count)
{
	struct spi_controller *ctrl = dev_get_drvdata(dev);
	struct bcmbca_hsspi *bs = spi_master_get_devdata(ctrl);
	struct bcmbca_hsspi *bs = spi_controller_get_devdata(ctrl);
	u32 val;

	if (kstrtou32(buf, 10, &val))
@@ -250,7 +250,7 @@ static int bcmbca_hsspi_wait_cmd(struct bcmbca_hsspi *bs, unsigned int cs)
static int bcmbca_hsspi_do_txrx(struct spi_device *spi, struct spi_transfer *t,
								struct spi_message *msg)
{
	struct bcmbca_hsspi *bs = spi_master_get_devdata(spi->master);
	struct bcmbca_hsspi *bs = spi_controller_get_devdata(spi->controller);
	unsigned int chip_select = spi_get_chipselect(spi, 0);
	u16 opcode = 0, val;
	int pending = t->len;
@@ -328,7 +328,7 @@ static int bcmbca_hsspi_do_txrx(struct spi_device *spi, struct spi_transfer *t,

static int bcmbca_hsspi_setup(struct spi_device *spi)
{
	struct bcmbca_hsspi *bs = spi_master_get_devdata(spi->master);
	struct bcmbca_hsspi *bs = spi_controller_get_devdata(spi->controller);
	u32 reg;

	reg = __raw_readl(bs->regs +
@@ -366,10 +366,10 @@ static int bcmbca_hsspi_setup(struct spi_device *spi)
	return 0;
}

static int bcmbca_hsspi_transfer_one(struct spi_master *master,
static int bcmbca_hsspi_transfer_one(struct spi_controller *host,
				      struct spi_message *msg)
{
	struct bcmbca_hsspi *bs = spi_master_get_devdata(master);
	struct bcmbca_hsspi *bs = spi_controller_get_devdata(host);
	struct spi_transfer *t;
	struct spi_device *spi = msg->spi;
	int status = -EINVAL;
@@ -409,7 +409,7 @@ static int bcmbca_hsspi_transfer_one(struct spi_master *master,
		bcmbca_hsspi_set_cs(bs, spi_get_chipselect(spi, 0), false);

	msg->status = status;
	spi_finalize_current_message(master);
	spi_finalize_current_message(host);

	return 0;
}
@@ -431,7 +431,7 @@ static irqreturn_t bcmbca_hsspi_interrupt(int irq, void *dev_id)

static int bcmbca_hsspi_probe(struct platform_device *pdev)
{
	struct spi_master *master;
	struct spi_controller *host;
	struct bcmbca_hsspi *bs;
	struct resource *res_mem;
	void __iomem *spim_ctrl;
@@ -487,13 +487,13 @@ static int bcmbca_hsspi_probe(struct platform_device *pdev)
		}
	}

	master = spi_alloc_master(&pdev->dev, sizeof(*bs));
	if (!master) {
	host = spi_alloc_host(&pdev->dev, sizeof(*bs));
	if (!host) {
		ret = -ENOMEM;
		goto out_disable_pll_clk;
	}

	bs = spi_master_get_devdata(master);
	bs = spi_controller_get_devdata(host);
	bs->pdev = pdev;
	bs->clk = clk;
	bs->pll_clk = pll_clk;
@@ -507,9 +507,9 @@ static int bcmbca_hsspi_probe(struct platform_device *pdev)
	mutex_init(&bs->msg_mutex);
	init_completion(&bs->done);

	master->dev.of_node = dev->of_node;
	host->dev.of_node = dev->of_node;
	if (!dev->of_node)
		master->bus_num = HSSPI_BUS_NUM;
		host->bus_num = HSSPI_BUS_NUM;

	of_property_read_u32(dev->of_node, "num-cs", &num_cs);
	if (num_cs > 8) {
@@ -517,15 +517,15 @@ static int bcmbca_hsspi_probe(struct platform_device *pdev)
			 num_cs);
		num_cs = HSSPI_SPI_MAX_CS;
	}
	master->num_chipselect = num_cs;
	master->setup = bcmbca_hsspi_setup;
	master->transfer_one_message = bcmbca_hsspi_transfer_one;
	master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH |
	host->num_chipselect = num_cs;
	host->setup = bcmbca_hsspi_setup;
	host->transfer_one_message = bcmbca_hsspi_transfer_one;
	host->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH |
			  SPI_RX_DUAL | SPI_TX_DUAL;
	master->bits_per_word_mask = SPI_BPW_MASK(8);
	master->auto_runtime_pm = true;
	host->bits_per_word_mask = SPI_BPW_MASK(8);
	host->auto_runtime_pm = true;

	platform_set_drvdata(pdev, master);
	platform_set_drvdata(pdev, host);

	/* Initialize the hardware */
	__raw_writel(0, bs->regs + HSSPI_INT_MASK_REG);
@@ -543,7 +543,7 @@ static int bcmbca_hsspi_probe(struct platform_device *pdev)
		ret = devm_request_irq(dev, irq, bcmbca_hsspi_interrupt, IRQF_SHARED,
			       pdev->name, bs);
		if (ret)
			goto out_put_master;
			goto out_put_host;
	}

	pm_runtime_enable(&pdev->dev);
@@ -555,7 +555,7 @@ static int bcmbca_hsspi_probe(struct platform_device *pdev)
	}

	/* register and we are done */
	ret = devm_spi_register_master(dev, master);
	ret = devm_spi_register_controller(dev, host);
	if (ret)
		goto out_sysgroup_disable;

@@ -567,8 +567,8 @@ static int bcmbca_hsspi_probe(struct platform_device *pdev)
	sysfs_remove_group(&pdev->dev.kobj, &bcmbca_hsspi_group);
out_pm_disable:
	pm_runtime_disable(&pdev->dev);
out_put_master:
	spi_master_put(master);
out_put_host:
	spi_controller_put(host);
out_disable_pll_clk:
	clk_disable_unprepare(pll_clk);
out_disable_clk:
@@ -578,8 +578,8 @@ static int bcmbca_hsspi_probe(struct platform_device *pdev)

static void bcmbca_hsspi_remove(struct platform_device *pdev)
{
	struct spi_master *master = platform_get_drvdata(pdev);
	struct bcmbca_hsspi *bs = spi_master_get_devdata(master);
	struct spi_controller *host = platform_get_drvdata(pdev);
	struct bcmbca_hsspi *bs = spi_controller_get_devdata(host);

	/* reset the hardware and block queue progress */
	__raw_writel(0, bs->regs + HSSPI_INT_MASK_REG);
@@ -591,10 +591,10 @@ static void bcmbca_hsspi_remove(struct platform_device *pdev)
#ifdef CONFIG_PM_SLEEP
static int bcmbca_hsspi_suspend(struct device *dev)
{
	struct spi_master *master = dev_get_drvdata(dev);
	struct bcmbca_hsspi *bs = spi_master_get_devdata(master);
	struct spi_controller *host = dev_get_drvdata(dev);
	struct bcmbca_hsspi *bs = spi_controller_get_devdata(host);

	spi_master_suspend(master);
	spi_controller_suspend(host);
	clk_disable_unprepare(bs->pll_clk);
	clk_disable_unprepare(bs->clk);

@@ -603,8 +603,8 @@ static int bcmbca_hsspi_suspend(struct device *dev)

static int bcmbca_hsspi_resume(struct device *dev)
{
	struct spi_master *master = dev_get_drvdata(dev);
	struct bcmbca_hsspi *bs = spi_master_get_devdata(master);
	struct spi_controller *host = dev_get_drvdata(dev);
	struct bcmbca_hsspi *bs = spi_controller_get_devdata(host);
	int ret;

	ret = clk_prepare_enable(bs->clk);
@@ -619,7 +619,7 @@ static int bcmbca_hsspi_resume(struct device *dev)
		}
	}

	spi_master_resume(master);
	spi_controller_resume(host);

	return 0;
}
+87 −87

File changed.

Preview size limit exceeded, changes collapsed.

+17 −17
Original line number Diff line number Diff line
@@ -91,14 +91,14 @@

struct falcon_sflash {
	u32 sfcmd; /* for caching of opcode, direction, ... */
	struct spi_master *master;
	struct spi_controller *host;
};

int falcon_sflash_xfer(struct spi_device *spi, struct spi_transfer *t,
		unsigned long flags)
{
	struct device *dev = &spi->dev;
	struct falcon_sflash *priv = spi_master_get_devdata(spi->master);
	struct falcon_sflash *priv = spi_controller_get_devdata(spi->controller);
	const u8 *txp = t->tx_buf;
	u8 *rxp = t->rx_buf;
	unsigned int bytelen = ((8 * t->len + 7) / 8);
@@ -351,10 +351,10 @@ static int falcon_sflash_setup(struct spi_device *spi)
	return 0;
}

static int falcon_sflash_xfer_one(struct spi_master *master,
static int falcon_sflash_xfer_one(struct spi_controller *host,
					struct spi_message *m)
{
	struct falcon_sflash *priv = spi_master_get_devdata(master);
	struct falcon_sflash *priv = spi_controller_get_devdata(host);
	struct spi_transfer *t;
	unsigned long spi_flags;
	unsigned long flags;
@@ -382,7 +382,7 @@ static int falcon_sflash_xfer_one(struct spi_master *master,
	}

	m->status = ret;
	spi_finalize_current_message(master);
	spi_finalize_current_message(host);

	return 0;
}
@@ -390,25 +390,25 @@ static int falcon_sflash_xfer_one(struct spi_master *master,
static int falcon_sflash_probe(struct platform_device *pdev)
{
	struct falcon_sflash *priv;
	struct spi_master *master;
	struct spi_controller *host;
	int ret;

	master = spi_alloc_master(&pdev->dev, sizeof(*priv));
	if (!master)
	host = spi_alloc_host(&pdev->dev, sizeof(*priv));
	if (!host)
		return -ENOMEM;

	priv = spi_master_get_devdata(master);
	priv->master = master;
	priv = spi_controller_get_devdata(host);
	priv->host = host;

	master->mode_bits = SPI_MODE_3;
	master->flags = SPI_CONTROLLER_HALF_DUPLEX;
	master->setup = falcon_sflash_setup;
	master->transfer_one_message = falcon_sflash_xfer_one;
	master->dev.of_node = pdev->dev.of_node;
	host->mode_bits = SPI_MODE_3;
	host->flags = SPI_CONTROLLER_HALF_DUPLEX;
	host->setup = falcon_sflash_setup;
	host->transfer_one_message = falcon_sflash_xfer_one;
	host->dev.of_node = pdev->dev.of_node;

	ret = devm_spi_register_master(&pdev->dev, master);
	ret = devm_spi_register_controller(&pdev->dev, host);
	if (ret)
		spi_master_put(master);
		spi_controller_put(host);
	return ret;
}

Loading