mirror of
https://github.com/torvalds/linux.git
synced 2024-12-29 14:21:47 +00:00
spi: spi-altera-platform: 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/20221229103837.4192759-4-yangyingliang@huawei.com Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
ec168190c1
commit
02c9e5b768
@ -39,16 +39,16 @@ static int altera_spi_probe(struct platform_device *pdev)
|
|||||||
struct altera_spi_platform_data *pdata = dev_get_platdata(&pdev->dev);
|
struct altera_spi_platform_data *pdata = dev_get_platdata(&pdev->dev);
|
||||||
enum altera_spi_type type = ALTERA_SPI_TYPE_UNKNOWN;
|
enum altera_spi_type type = ALTERA_SPI_TYPE_UNKNOWN;
|
||||||
struct altera_spi *hw;
|
struct altera_spi *hw;
|
||||||
struct spi_master *master;
|
struct spi_controller *host;
|
||||||
int err = -ENODEV;
|
int err = -ENODEV;
|
||||||
u16 i;
|
u16 i;
|
||||||
|
|
||||||
master = spi_alloc_master(&pdev->dev, sizeof(struct altera_spi));
|
host = spi_alloc_host(&pdev->dev, sizeof(struct altera_spi));
|
||||||
if (!master)
|
if (!host)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
/* setup the master state. */
|
/* setup the host state. */
|
||||||
master->bus_num = -1;
|
host->bus_num = -1;
|
||||||
|
|
||||||
if (pdata) {
|
if (pdata) {
|
||||||
if (pdata->num_chipselect > ALTERA_SPI_MAX_CS) {
|
if (pdata->num_chipselect > ALTERA_SPI_MAX_CS) {
|
||||||
@ -59,18 +59,18 @@ static int altera_spi_probe(struct platform_device *pdev)
|
|||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
master->num_chipselect = pdata->num_chipselect;
|
host->num_chipselect = pdata->num_chipselect;
|
||||||
master->mode_bits = pdata->mode_bits;
|
host->mode_bits = pdata->mode_bits;
|
||||||
master->bits_per_word_mask = pdata->bits_per_word_mask;
|
host->bits_per_word_mask = pdata->bits_per_word_mask;
|
||||||
} else {
|
} else {
|
||||||
master->num_chipselect = 16;
|
host->num_chipselect = 16;
|
||||||
master->mode_bits = SPI_CS_HIGH;
|
host->mode_bits = SPI_CS_HIGH;
|
||||||
master->bits_per_word_mask = SPI_BPW_RANGE_MASK(1, 16);
|
host->bits_per_word_mask = SPI_BPW_RANGE_MASK(1, 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
master->dev.of_node = pdev->dev.of_node;
|
host->dev.of_node = pdev->dev.of_node;
|
||||||
|
|
||||||
hw = spi_master_get_devdata(master);
|
hw = spi_controller_get_devdata(host);
|
||||||
hw->dev = &pdev->dev;
|
hw->dev = &pdev->dev;
|
||||||
|
|
||||||
if (platid)
|
if (platid)
|
||||||
@ -107,24 +107,24 @@ static int altera_spi_probe(struct platform_device *pdev)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
altera_spi_init_host(master);
|
altera_spi_init_host(host);
|
||||||
|
|
||||||
/* irq is optional */
|
/* irq is optional */
|
||||||
hw->irq = platform_get_irq(pdev, 0);
|
hw->irq = platform_get_irq(pdev, 0);
|
||||||
if (hw->irq >= 0) {
|
if (hw->irq >= 0) {
|
||||||
err = devm_request_irq(&pdev->dev, hw->irq, altera_spi_irq, 0,
|
err = devm_request_irq(&pdev->dev, hw->irq, altera_spi_irq, 0,
|
||||||
pdev->name, master);
|
pdev->name, host);
|
||||||
if (err)
|
if (err)
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
err = devm_spi_register_master(&pdev->dev, master);
|
err = devm_spi_register_controller(&pdev->dev, host);
|
||||||
if (err)
|
if (err)
|
||||||
goto exit;
|
goto exit;
|
||||||
|
|
||||||
if (pdata) {
|
if (pdata) {
|
||||||
for (i = 0; i < pdata->num_devices; i++) {
|
for (i = 0; i < pdata->num_devices; i++) {
|
||||||
if (!spi_new_device(master, pdata->devices + i))
|
if (!spi_new_device(host, pdata->devices + i))
|
||||||
dev_warn(&pdev->dev,
|
dev_warn(&pdev->dev,
|
||||||
"unable to create SPI device: %s\n",
|
"unable to create SPI device: %s\n",
|
||||||
pdata->devices[i].modalias);
|
pdata->devices[i].modalias);
|
||||||
@ -135,7 +135,7 @@ static int altera_spi_probe(struct platform_device *pdev)
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
exit:
|
exit:
|
||||||
spi_master_put(master);
|
spi_controller_put(host);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user