spi: ppc4xx: switch to use modern name
Change legacy name master to modern name host or controller. No functional changed. Signed-off-by: Yang Yingliang <yangyingliang@huawei.com> Link: https://lore.kernel.org/r/20230818093154.1183529-7-yangyingliang@huawei.com Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Родитель
c97a43a546
Коммит
7134583057
|
@ -126,7 +126,7 @@ struct ppc4xx_spi {
|
|||
unsigned char *rx;
|
||||
|
||||
struct spi_ppc4xx_regs __iomem *regs; /* pointer to the registers */
|
||||
struct spi_master *master;
|
||||
struct spi_controller *host;
|
||||
struct device *dev;
|
||||
};
|
||||
|
||||
|
@ -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",
|
||||
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->rx = t->rx_buf;
|
||||
|
@ -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)
|
||||
{
|
||||
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;
|
||||
int scr;
|
||||
u8 cdm = 0;
|
||||
|
@ -340,7 +340,7 @@ static void spi_ppc4xx_enable(struct ppc4xx_spi *hw)
|
|||
static int spi_ppc4xx_of_probe(struct platform_device *op)
|
||||
{
|
||||
struct ppc4xx_spi *hw;
|
||||
struct spi_master *master;
|
||||
struct spi_controller *host;
|
||||
struct spi_bitbang *bbp;
|
||||
struct resource resource;
|
||||
struct device_node *np = op->dev.of_node;
|
||||
|
@ -349,20 +349,20 @@ static int spi_ppc4xx_of_probe(struct platform_device *op)
|
|||
int ret;
|
||||
const unsigned int *clk;
|
||||
|
||||
master = spi_alloc_master(dev, sizeof(*hw));
|
||||
if (master == NULL)
|
||||
host = spi_alloc_host(dev, sizeof(*hw));
|
||||
if (host == NULL)
|
||||
return -ENOMEM;
|
||||
master->dev.of_node = np;
|
||||
platform_set_drvdata(op, master);
|
||||
hw = spi_master_get_devdata(master);
|
||||
hw->master = master;
|
||||
host->dev.of_node = np;
|
||||
platform_set_drvdata(op, host);
|
||||
hw = spi_controller_get_devdata(host);
|
||||
hw->host = host;
|
||||
hw->dev = dev;
|
||||
|
||||
init_completion(&hw->done);
|
||||
|
||||
/* Setup the state for the bitbang driver */
|
||||
bbp = &hw->bitbang;
|
||||
bbp->master = hw->master;
|
||||
bbp->master = hw->host;
|
||||
bbp->setup_transfer = spi_ppc4xx_setupxfer;
|
||||
bbp->txrx_bufs = spi_ppc4xx_txrx;
|
||||
bbp->use_dma = 0;
|
||||
|
@ -385,7 +385,7 @@ static int spi_ppc4xx_of_probe(struct platform_device *op)
|
|||
if (opbnp == NULL) {
|
||||
dev_err(dev, "OPB: cannot find node\n");
|
||||
ret = -ENODEV;
|
||||
goto free_master;
|
||||
goto free_host;
|
||||
}
|
||||
/* Get the clock (Hz) for the OPB */
|
||||
clk = of_get_property(opbnp, "clock-frequency", NULL);
|
||||
|
@ -393,7 +393,7 @@ static int spi_ppc4xx_of_probe(struct platform_device *op)
|
|||
dev_err(dev, "OPB: no clock-frequency property set\n");
|
||||
of_node_put(opbnp);
|
||||
ret = -ENODEV;
|
||||
goto free_master;
|
||||
goto free_host;
|
||||
}
|
||||
hw->opb_freq = *clk;
|
||||
hw->opb_freq >>= 2;
|
||||
|
@ -402,7 +402,7 @@ static int spi_ppc4xx_of_probe(struct platform_device *op)
|
|||
ret = of_address_to_resource(np, 0, &resource);
|
||||
if (ret) {
|
||||
dev_err(dev, "error while parsing device node resource\n");
|
||||
goto free_master;
|
||||
goto free_host;
|
||||
}
|
||||
hw->mapbase = resource.start;
|
||||
hw->mapsize = resource_size(&resource);
|
||||
|
@ -411,7 +411,7 @@ static int spi_ppc4xx_of_probe(struct platform_device *op)
|
|||
if (hw->mapsize < sizeof(struct spi_ppc4xx_regs)) {
|
||||
dev_err(dev, "too small to map registers\n");
|
||||
ret = -EINVAL;
|
||||
goto free_master;
|
||||
goto free_host;
|
||||
}
|
||||
|
||||
/* Request IRQ */
|
||||
|
@ -420,7 +420,7 @@ static int spi_ppc4xx_of_probe(struct platform_device *op)
|
|||
0, "spi_ppc4xx_of", (void *)hw);
|
||||
if (ret) {
|
||||
dev_err(dev, "unable to allocate interrupt\n");
|
||||
goto free_master;
|
||||
goto free_host;
|
||||
}
|
||||
|
||||
if (!request_mem_region(hw->mapbase, hw->mapsize, DRIVER_NAME)) {
|
||||
|
@ -443,7 +443,7 @@ static int spi_ppc4xx_of_probe(struct platform_device *op)
|
|||
dev->dma_mask = 0;
|
||||
ret = spi_bitbang_start(bbp);
|
||||
if (ret) {
|
||||
dev_err(dev, "failed to register SPI master\n");
|
||||
dev_err(dev, "failed to register SPI host\n");
|
||||
goto unmap_regs;
|
||||
}
|
||||
|
||||
|
@ -457,8 +457,8 @@ map_io_error:
|
|||
release_mem_region(hw->mapbase, hw->mapsize);
|
||||
request_mem_error:
|
||||
free_irq(hw->irqnum, hw);
|
||||
free_master:
|
||||
spi_master_put(master);
|
||||
free_host:
|
||||
spi_controller_put(host);
|
||||
|
||||
dev_err(dev, "initialization failed\n");
|
||||
return ret;
|
||||
|
@ -466,14 +466,14 @@ free_master:
|
|||
|
||||
static void spi_ppc4xx_of_remove(struct platform_device *op)
|
||||
{
|
||||
struct spi_master *master = platform_get_drvdata(op);
|
||||
struct ppc4xx_spi *hw = spi_master_get_devdata(master);
|
||||
struct spi_controller *host = platform_get_drvdata(op);
|
||||
struct ppc4xx_spi *hw = spi_controller_get_devdata(host);
|
||||
|
||||
spi_bitbang_stop(&hw->bitbang);
|
||||
release_mem_region(hw->mapbase, hw->mapsize);
|
||||
free_irq(hw->irqnum, hw);
|
||||
iounmap(hw->regs);
|
||||
spi_master_put(master);
|
||||
spi_controller_put(host);
|
||||
}
|
||||
|
||||
static const struct of_device_id spi_ppc4xx_of_match[] = {
|
||||
|
|
Загрузка…
Ссылка в новой задаче