spi: replace and remove

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

Switch to use {devm_}spi_alloc_host/target() in drivers and remove
{devm_}spi_alloc_master/slave() in spi driver.
This commit is contained in:
Mark Brown 2024-09-30 22:43:40 +01:00
commit 9e3dfbcf70
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0
8 changed files with 20 additions and 50 deletions

View File

@ -462,8 +462,8 @@ SLAVE DMA ENGINE
devm_acpi_dma_controller_free()
SPI
devm_spi_alloc_master()
devm_spi_alloc_slave()
devm_spi_alloc_host()
devm_spi_alloc_target()
devm_spi_optimize_message()
devm_spi_register_controller()
devm_spi_register_host()

View File

@ -175,11 +175,11 @@ int netup_spi_init(struct netup_unidvb_dev *ndev)
struct spi_controller *ctlr;
struct netup_spi *nspi;
ctlr = devm_spi_alloc_master(&ndev->pci_dev->dev,
sizeof(struct netup_spi));
ctlr = devm_spi_alloc_host(&ndev->pci_dev->dev,
sizeof(struct netup_spi));
if (!ctlr) {
dev_err(&ndev->pci_dev->dev,
"%s(): unable to alloc SPI master\n", __func__);
"%s(): unable to alloc SPI host\n", __func__);
return -EINVAL;
}
nspi = spi_controller_get_devdata(ctlr);

View File

@ -1219,8 +1219,8 @@ static int msi2500_probe(struct usb_interface *intf,
goto err_free_mem;
}
/* SPI master adapter */
ctlr = spi_alloc_master(dev->dev, 0);
/* SPI host adapter */
ctlr = spi_alloc_host(dev->dev, 0);
if (ctlr == NULL) {
ret = -ENOMEM;
goto err_unregister_v4l2_dev;

View File

@ -152,7 +152,7 @@ static int ch341_probe(struct usb_interface *intf,
if (ret)
return ret;
ctrl = devm_spi_alloc_master(&udev->dev, sizeof(struct ch341_spi_dev));
ctrl = devm_spi_alloc_host(&udev->dev, sizeof(struct ch341_spi_dev));
if (!ctrl)
return -ENOMEM;

View File

@ -388,9 +388,9 @@ static int mtk_spi_slave_probe(struct platform_device *pdev)
int irq, ret;
const struct of_device_id *of_id;
ctlr = spi_alloc_slave(&pdev->dev, sizeof(*mdata));
ctlr = spi_alloc_target(&pdev->dev, sizeof(*mdata));
if (!ctlr) {
dev_err(&pdev->dev, "failed to alloc spi slave\n");
dev_err(&pdev->dev, "failed to alloc spi target\n");
return -ENOMEM;
}

View File

@ -3238,9 +3238,9 @@ static int spi_controller_id_alloc(struct spi_controller *ctlr, int start, int e
}
/**
* spi_register_controller - register SPI master or slave controller
* @ctlr: initialized master, originally from spi_alloc_master() or
* spi_alloc_slave()
* spi_register_controller - register SPI host or target controller
* @ctlr: initialized controller, originally from spi_alloc_host() or
* spi_alloc_target()
* Context: can sleep
*
* SPI controllers connect to their drivers using some non-SPI bus,
@ -3390,11 +3390,11 @@ static void devm_spi_unregister(struct device *dev, void *res)
}
/**
* devm_spi_register_controller - register managed SPI master or slave
* devm_spi_register_controller - register managed SPI host or target
* controller
* @dev: device managing SPI controller
* @ctlr: initialized controller, originally from spi_alloc_master() or
* spi_alloc_slave()
* @ctlr: initialized controller, originally from spi_alloc_host() or
* spi_alloc_target()
* Context: can sleep
*
* Register a SPI device as with spi_register_controller() which will
@ -3478,7 +3478,7 @@ void spi_unregister_controller(struct spi_controller *ctlr)
/*
* Release the last reference on the controller if its driver
* has not yet been converted to devm_spi_alloc_master/slave().
* has not yet been converted to devm_spi_alloc_host/target().
*/
if (!ctlr->devm_allocated)
put_device(&ctlr->dev);

View File

@ -140,9 +140,9 @@ int lcd_spi_register(struct mmphw_ctrl *ctrl)
void **p_regbase;
int err;
ctlr = spi_alloc_master(ctrl->dev, sizeof(void *));
ctlr = spi_alloc_host(ctrl->dev, sizeof(void *));
if (!ctlr) {
dev_err(ctrl->dev, "unable to allocate SPI master\n");
dev_err(ctrl->dev, "unable to allocate SPI host\n");
return -ENOMEM;
}
p_regbase = spi_controller_get_devdata(ctlr);
@ -156,7 +156,7 @@ int lcd_spi_register(struct mmphw_ctrl *ctrl)
err = spi_register_controller(ctlr);
if (err < 0) {
dev_err(ctrl->dev, "unable to register SPI master\n");
dev_err(ctrl->dev, "unable to register SPI host\n");
spi_controller_put(ctlr);
return err;
}

View File

@ -824,21 +824,6 @@ void spi_take_timestamp_post(struct spi_controller *ctlr,
extern struct spi_controller *__spi_alloc_controller(struct device *host,
unsigned int size, bool slave);
static inline struct spi_controller *spi_alloc_master(struct device *host,
unsigned int size)
{
return __spi_alloc_controller(host, size, false);
}
static inline struct spi_controller *spi_alloc_slave(struct device *host,
unsigned int size)
{
if (!IS_ENABLED(CONFIG_SPI_SLAVE))
return NULL;
return __spi_alloc_controller(host, size, true);
}
static inline struct spi_controller *spi_alloc_host(struct device *dev,
unsigned int size)
{
@ -858,21 +843,6 @@ struct spi_controller *__devm_spi_alloc_controller(struct device *dev,
unsigned int size,
bool slave);
static inline struct spi_controller *devm_spi_alloc_master(struct device *dev,
unsigned int size)
{
return __devm_spi_alloc_controller(dev, size, false);
}
static inline struct spi_controller *devm_spi_alloc_slave(struct device *dev,
unsigned int size)
{
if (!IS_ENABLED(CONFIG_SPI_SLAVE))
return NULL;
return __devm_spi_alloc_controller(dev, size, true);
}
static inline struct spi_controller *devm_spi_alloc_host(struct device *dev,
unsigned int size)
{