Commit 71345830 authored by Yang Yingliang's avatar Yang Yingliang Committed by Mark Brown

spi: ppc4xx: switch to use modern name

Change legacy name master to modern name host or controller.

No functional changed.
Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
Link: https://lore.kernel.org/r/20230818093154.1183529-7-yangyingliang@huawei.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent c97a43a5
...@@ -126,7 +126,7 @@ struct ppc4xx_spi { ...@@ -126,7 +126,7 @@ struct ppc4xx_spi {
unsigned char *rx; unsigned char *rx;
struct spi_ppc4xx_regs __iomem *regs; /* pointer to the registers */ struct spi_ppc4xx_regs __iomem *regs; /* pointer to the registers */
struct spi_master *master; struct spi_controller *host;
struct device *dev; struct device *dev;
}; };
...@@ -143,7 +143,7 @@ static int spi_ppc4xx_txrx(struct spi_device *spi, struct spi_transfer *t) ...@@ -143,7 +143,7 @@ static int spi_ppc4xx_txrx(struct spi_device *spi, struct spi_transfer *t)
dev_dbg(&spi->dev, "txrx: tx %p, rx %p, len %d\n", dev_dbg(&spi->dev, "txrx: tx %p, rx %p, len %d\n",
t->tx_buf, t->rx_buf, t->len); t->tx_buf, t->rx_buf, t->len);
hw = spi_master_get_devdata(spi->master); hw = spi_controller_get_devdata(spi->controller);
hw->tx = t->tx_buf; hw->tx = t->tx_buf;
hw->rx = t->rx_buf; hw->rx = t->rx_buf;
...@@ -161,7 +161,7 @@ static int spi_ppc4xx_txrx(struct spi_device *spi, struct spi_transfer *t) ...@@ -161,7 +161,7 @@ static int spi_ppc4xx_txrx(struct spi_device *spi, struct spi_transfer *t)
static int spi_ppc4xx_setupxfer(struct spi_device *spi, struct spi_transfer *t) static int spi_ppc4xx_setupxfer(struct spi_device *spi, struct spi_transfer *t)
{ {
struct ppc4xx_spi *hw = spi_master_get_devdata(spi->master); struct ppc4xx_spi *hw = spi_controller_get_devdata(spi->controller);
struct spi_ppc4xx_cs *cs = spi->controller_state; struct spi_ppc4xx_cs *cs = spi->controller_state;
int scr; int scr;
u8 cdm = 0; u8 cdm = 0;
...@@ -340,7 +340,7 @@ static void spi_ppc4xx_enable(struct ppc4xx_spi *hw) ...@@ -340,7 +340,7 @@ static void spi_ppc4xx_enable(struct ppc4xx_spi *hw)
static int spi_ppc4xx_of_probe(struct platform_device *op) static int spi_ppc4xx_of_probe(struct platform_device *op)
{ {
struct ppc4xx_spi *hw; struct ppc4xx_spi *hw;
struct spi_master *master; struct spi_controller *host;
struct spi_bitbang *bbp; struct spi_bitbang *bbp;
struct resource resource; struct resource resource;
struct device_node *np = op->dev.of_node; struct device_node *np = op->dev.of_node;
...@@ -349,20 +349,20 @@ static int spi_ppc4xx_of_probe(struct platform_device *op) ...@@ -349,20 +349,20 @@ static int spi_ppc4xx_of_probe(struct platform_device *op)
int ret; int ret;
const unsigned int *clk; const unsigned int *clk;
master = spi_alloc_master(dev, sizeof(*hw)); host = spi_alloc_host(dev, sizeof(*hw));
if (master == NULL) if (host == NULL)
return -ENOMEM; return -ENOMEM;
master->dev.of_node = np; host->dev.of_node = np;
platform_set_drvdata(op, master); platform_set_drvdata(op, host);
hw = spi_master_get_devdata(master); hw = spi_controller_get_devdata(host);
hw->master = master; hw->host = host;
hw->dev = dev; hw->dev = dev;
init_completion(&hw->done); init_completion(&hw->done);
/* Setup the state for the bitbang driver */ /* Setup the state for the bitbang driver */
bbp = &hw->bitbang; bbp = &hw->bitbang;
bbp->master = hw->master; bbp->master = hw->host;
bbp->setup_transfer = spi_ppc4xx_setupxfer; bbp->setup_transfer = spi_ppc4xx_setupxfer;
bbp->txrx_bufs = spi_ppc4xx_txrx; bbp->txrx_bufs = spi_ppc4xx_txrx;
bbp->use_dma = 0; bbp->use_dma = 0;
...@@ -385,7 +385,7 @@ static int spi_ppc4xx_of_probe(struct platform_device *op) ...@@ -385,7 +385,7 @@ static int spi_ppc4xx_of_probe(struct platform_device *op)
if (opbnp == NULL) { if (opbnp == NULL) {
dev_err(dev, "OPB: cannot find node\n"); dev_err(dev, "OPB: cannot find node\n");
ret = -ENODEV; ret = -ENODEV;
goto free_master; goto free_host;
} }
/* Get the clock (Hz) for the OPB */ /* Get the clock (Hz) for the OPB */
clk = of_get_property(opbnp, "clock-frequency", NULL); clk = of_get_property(opbnp, "clock-frequency", NULL);
...@@ -393,7 +393,7 @@ static int spi_ppc4xx_of_probe(struct platform_device *op) ...@@ -393,7 +393,7 @@ static int spi_ppc4xx_of_probe(struct platform_device *op)
dev_err(dev, "OPB: no clock-frequency property set\n"); dev_err(dev, "OPB: no clock-frequency property set\n");
of_node_put(opbnp); of_node_put(opbnp);
ret = -ENODEV; ret = -ENODEV;
goto free_master; goto free_host;
} }
hw->opb_freq = *clk; hw->opb_freq = *clk;
hw->opb_freq >>= 2; hw->opb_freq >>= 2;
...@@ -402,7 +402,7 @@ static int spi_ppc4xx_of_probe(struct platform_device *op) ...@@ -402,7 +402,7 @@ static int spi_ppc4xx_of_probe(struct platform_device *op)
ret = of_address_to_resource(np, 0, &resource); ret = of_address_to_resource(np, 0, &resource);
if (ret) { if (ret) {
dev_err(dev, "error while parsing device node resource\n"); dev_err(dev, "error while parsing device node resource\n");
goto free_master; goto free_host;
} }
hw->mapbase = resource.start; hw->mapbase = resource.start;
hw->mapsize = resource_size(&resource); hw->mapsize = resource_size(&resource);
...@@ -411,7 +411,7 @@ static int spi_ppc4xx_of_probe(struct platform_device *op) ...@@ -411,7 +411,7 @@ static int spi_ppc4xx_of_probe(struct platform_device *op)
if (hw->mapsize < sizeof(struct spi_ppc4xx_regs)) { if (hw->mapsize < sizeof(struct spi_ppc4xx_regs)) {
dev_err(dev, "too small to map registers\n"); dev_err(dev, "too small to map registers\n");
ret = -EINVAL; ret = -EINVAL;
goto free_master; goto free_host;
} }
/* Request IRQ */ /* Request IRQ */
...@@ -420,7 +420,7 @@ static int spi_ppc4xx_of_probe(struct platform_device *op) ...@@ -420,7 +420,7 @@ static int spi_ppc4xx_of_probe(struct platform_device *op)
0, "spi_ppc4xx_of", (void *)hw); 0, "spi_ppc4xx_of", (void *)hw);
if (ret) { if (ret) {
dev_err(dev, "unable to allocate interrupt\n"); dev_err(dev, "unable to allocate interrupt\n");
goto free_master; goto free_host;
} }
if (!request_mem_region(hw->mapbase, hw->mapsize, DRIVER_NAME)) { if (!request_mem_region(hw->mapbase, hw->mapsize, DRIVER_NAME)) {
...@@ -443,7 +443,7 @@ static int spi_ppc4xx_of_probe(struct platform_device *op) ...@@ -443,7 +443,7 @@ static int spi_ppc4xx_of_probe(struct platform_device *op)
dev->dma_mask = 0; dev->dma_mask = 0;
ret = spi_bitbang_start(bbp); ret = spi_bitbang_start(bbp);
if (ret) { if (ret) {
dev_err(dev, "failed to register SPI master\n"); dev_err(dev, "failed to register SPI host\n");
goto unmap_regs; goto unmap_regs;
} }
...@@ -457,8 +457,8 @@ static int spi_ppc4xx_of_probe(struct platform_device *op) ...@@ -457,8 +457,8 @@ static int spi_ppc4xx_of_probe(struct platform_device *op)
release_mem_region(hw->mapbase, hw->mapsize); release_mem_region(hw->mapbase, hw->mapsize);
request_mem_error: request_mem_error:
free_irq(hw->irqnum, hw); free_irq(hw->irqnum, hw);
free_master: free_host:
spi_master_put(master); spi_controller_put(host);
dev_err(dev, "initialization failed\n"); dev_err(dev, "initialization failed\n");
return ret; return ret;
...@@ -466,14 +466,14 @@ static int spi_ppc4xx_of_probe(struct platform_device *op) ...@@ -466,14 +466,14 @@ static int spi_ppc4xx_of_probe(struct platform_device *op)
static void spi_ppc4xx_of_remove(struct platform_device *op) static void spi_ppc4xx_of_remove(struct platform_device *op)
{ {
struct spi_master *master = platform_get_drvdata(op); struct spi_controller *host = platform_get_drvdata(op);
struct ppc4xx_spi *hw = spi_master_get_devdata(master); struct ppc4xx_spi *hw = spi_controller_get_devdata(host);
spi_bitbang_stop(&hw->bitbang); spi_bitbang_stop(&hw->bitbang);
release_mem_region(hw->mapbase, hw->mapsize); release_mem_region(hw->mapbase, hw->mapsize);
free_irq(hw->irqnum, hw); free_irq(hw->irqnum, hw);
iounmap(hw->regs); iounmap(hw->regs);
spi_master_put(master); spi_controller_put(host);
} }
static const struct of_device_id spi_ppc4xx_of_match[] = { static const struct of_device_id spi_ppc4xx_of_match[] = {
......
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