Skip to content

Commit 9e3dfbc

Browse files
committed
spi: replace and remove
Merge series from Yang Yingliang <[email protected]>: Switch to use {devm_}spi_alloc_host/target() in drivers and remove {devm_}spi_alloc_master/slave() in spi driver.
2 parents b45938e + 0809a9c commit 9e3dfbc

File tree

8 files changed

+20
-50
lines changed

8 files changed

+20
-50
lines changed

Documentation/driver-api/driver-model/devres.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -462,8 +462,8 @@ SLAVE DMA ENGINE
462462
devm_acpi_dma_controller_free()
463463

464464
SPI
465-
devm_spi_alloc_master()
466-
devm_spi_alloc_slave()
465+
devm_spi_alloc_host()
466+
devm_spi_alloc_target()
467467
devm_spi_optimize_message()
468468
devm_spi_register_controller()
469469
devm_spi_register_host()

drivers/media/pci/netup_unidvb/netup_unidvb_spi.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,11 +175,11 @@ int netup_spi_init(struct netup_unidvb_dev *ndev)
175175
struct spi_controller *ctlr;
176176
struct netup_spi *nspi;
177177

178-
ctlr = devm_spi_alloc_master(&ndev->pci_dev->dev,
179-
sizeof(struct netup_spi));
178+
ctlr = devm_spi_alloc_host(&ndev->pci_dev->dev,
179+
sizeof(struct netup_spi));
180180
if (!ctlr) {
181181
dev_err(&ndev->pci_dev->dev,
182-
"%s(): unable to alloc SPI master\n", __func__);
182+
"%s(): unable to alloc SPI host\n", __func__);
183183
return -EINVAL;
184184
}
185185
nspi = spi_controller_get_devdata(ctlr);

drivers/media/usb/msi2500/msi2500.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1219,8 +1219,8 @@ static int msi2500_probe(struct usb_interface *intf,
12191219
goto err_free_mem;
12201220
}
12211221

1222-
/* SPI master adapter */
1223-
ctlr = spi_alloc_master(dev->dev, 0);
1222+
/* SPI host adapter */
1223+
ctlr = spi_alloc_host(dev->dev, 0);
12241224
if (ctlr == NULL) {
12251225
ret = -ENOMEM;
12261226
goto err_unregister_v4l2_dev;

drivers/spi/spi-ch341.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ static int ch341_probe(struct usb_interface *intf,
152152
if (ret)
153153
return ret;
154154

155-
ctrl = devm_spi_alloc_master(&udev->dev, sizeof(struct ch341_spi_dev));
155+
ctrl = devm_spi_alloc_host(&udev->dev, sizeof(struct ch341_spi_dev));
156156
if (!ctrl)
157157
return -ENOMEM;
158158

drivers/spi/spi-slave-mt27xx.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -388,9 +388,9 @@ static int mtk_spi_slave_probe(struct platform_device *pdev)
388388
int irq, ret;
389389
const struct of_device_id *of_id;
390390

391-
ctlr = spi_alloc_slave(&pdev->dev, sizeof(*mdata));
391+
ctlr = spi_alloc_target(&pdev->dev, sizeof(*mdata));
392392
if (!ctlr) {
393-
dev_err(&pdev->dev, "failed to alloc spi slave\n");
393+
dev_err(&pdev->dev, "failed to alloc spi target\n");
394394
return -ENOMEM;
395395
}
396396

drivers/spi/spi.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3238,9 +3238,9 @@ static int spi_controller_id_alloc(struct spi_controller *ctlr, int start, int e
32383238
}
32393239

32403240
/**
3241-
* spi_register_controller - register SPI master or slave controller
3242-
* @ctlr: initialized master, originally from spi_alloc_master() or
3243-
* spi_alloc_slave()
3241+
* spi_register_controller - register SPI host or target controller
3242+
* @ctlr: initialized controller, originally from spi_alloc_host() or
3243+
* spi_alloc_target()
32443244
* Context: can sleep
32453245
*
32463246
* 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)
33903390
}
33913391

33923392
/**
3393-
* devm_spi_register_controller - register managed SPI master or slave
3393+
* devm_spi_register_controller - register managed SPI host or target
33943394
* controller
33953395
* @dev: device managing SPI controller
3396-
* @ctlr: initialized controller, originally from spi_alloc_master() or
3397-
* spi_alloc_slave()
3396+
* @ctlr: initialized controller, originally from spi_alloc_host() or
3397+
* spi_alloc_target()
33983398
* Context: can sleep
33993399
*
34003400
* Register a SPI device as with spi_register_controller() which will
@@ -3478,7 +3478,7 @@ void spi_unregister_controller(struct spi_controller *ctlr)
34783478

34793479
/*
34803480
* Release the last reference on the controller if its driver
3481-
* has not yet been converted to devm_spi_alloc_master/slave().
3481+
* has not yet been converted to devm_spi_alloc_host/target().
34823482
*/
34833483
if (!ctlr->devm_allocated)
34843484
put_device(&ctlr->dev);

drivers/video/fbdev/mmp/hw/mmp_spi.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,9 +140,9 @@ int lcd_spi_register(struct mmphw_ctrl *ctrl)
140140
void **p_regbase;
141141
int err;
142142

143-
ctlr = spi_alloc_master(ctrl->dev, sizeof(void *));
143+
ctlr = spi_alloc_host(ctrl->dev, sizeof(void *));
144144
if (!ctlr) {
145-
dev_err(ctrl->dev, "unable to allocate SPI master\n");
145+
dev_err(ctrl->dev, "unable to allocate SPI host\n");
146146
return -ENOMEM;
147147
}
148148
p_regbase = spi_controller_get_devdata(ctlr);
@@ -156,7 +156,7 @@ int lcd_spi_register(struct mmphw_ctrl *ctrl)
156156

157157
err = spi_register_controller(ctlr);
158158
if (err < 0) {
159-
dev_err(ctrl->dev, "unable to register SPI master\n");
159+
dev_err(ctrl->dev, "unable to register SPI host\n");
160160
spi_controller_put(ctlr);
161161
return err;
162162
}

include/linux/spi/spi.h

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -824,21 +824,6 @@ void spi_take_timestamp_post(struct spi_controller *ctlr,
824824
extern struct spi_controller *__spi_alloc_controller(struct device *host,
825825
unsigned int size, bool slave);
826826

827-
static inline struct spi_controller *spi_alloc_master(struct device *host,
828-
unsigned int size)
829-
{
830-
return __spi_alloc_controller(host, size, false);
831-
}
832-
833-
static inline struct spi_controller *spi_alloc_slave(struct device *host,
834-
unsigned int size)
835-
{
836-
if (!IS_ENABLED(CONFIG_SPI_SLAVE))
837-
return NULL;
838-
839-
return __spi_alloc_controller(host, size, true);
840-
}
841-
842827
static inline struct spi_controller *spi_alloc_host(struct device *dev,
843828
unsigned int size)
844829
{
@@ -858,21 +843,6 @@ struct spi_controller *__devm_spi_alloc_controller(struct device *dev,
858843
unsigned int size,
859844
bool slave);
860845

861-
static inline struct spi_controller *devm_spi_alloc_master(struct device *dev,
862-
unsigned int size)
863-
{
864-
return __devm_spi_alloc_controller(dev, size, false);
865-
}
866-
867-
static inline struct spi_controller *devm_spi_alloc_slave(struct device *dev,
868-
unsigned int size)
869-
{
870-
if (!IS_ENABLED(CONFIG_SPI_SLAVE))
871-
return NULL;
872-
873-
return __devm_spi_alloc_controller(dev, size, true);
874-
}
875-
876846
static inline struct spi_controller *devm_spi_alloc_host(struct device *dev,
877847
unsigned int size)
878848
{

0 commit comments

Comments
 (0)