2024-02-07 18:51:34

by Uwe Kleine-König

[permalink] [raw]
Subject: [PATCH v3 31/32] spi: Drop compat layer from renaming "master" to "controller"

Now that all in-tree users followed the rename, the compat stuff can go
away. This completes the renaming started with commit 8caab75fd2c2
("spi: Generalize SPI "master" to "controller"")

Acked-by: Jonathan Cameron <[email protected]>
Signed-off-by: Uwe Kleine-König <[email protected]>
---
.../driver-api/driver-model/devres.rst | 2 +-
drivers/spi/spi.c | 2 +-
include/linux/spi/spi.h | 20 +------------------
3 files changed, 3 insertions(+), 21 deletions(-)

diff --git a/Documentation/driver-api/driver-model/devres.rst b/Documentation/driver-api/driver-model/devres.rst
index c5f99d834ec5..49c6fd82cd5d 100644
--- a/Documentation/driver-api/driver-model/devres.rst
+++ b/Documentation/driver-api/driver-model/devres.rst
@@ -462,7 +462,7 @@ SLAVE DMA ENGINE
SPI
devm_spi_alloc_master()
devm_spi_alloc_slave()
- devm_spi_register_master()
+ devm_spi_register_controller()

WATCHDOG
devm_watchdog_register_device()
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 53c25a351dab..c08fe2cb256c 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -584,7 +584,7 @@ struct spi_device *spi_alloc_device(struct spi_controller *ctlr)
return NULL;
}

- spi->master = spi->controller = ctlr;
+ spi->controller = ctlr;
spi->dev.parent = &ctlr->dev;
spi->dev.bus = &spi_bus_type;
spi->dev.release = spidev_release;
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
index 9e3866809a0e..7500db33f70c 100644
--- a/include/linux/spi/spi.h
+++ b/include/linux/spi/spi.h
@@ -131,7 +131,6 @@ extern void spi_transfer_cs_change_delay_exec(struct spi_message *msg,
* struct spi_device - Controller side proxy for an SPI slave device
* @dev: Driver model representation of the device.
* @controller: SPI controller used with the device.
- * @master: Copy of controller, for backwards compatibility.
* @max_speed_hz: Maximum clock rate to be used with this chip
* (on this board); may be changed by the device's driver.
* The spi_transfer.speed_hz can override this for each transfer.
@@ -185,7 +184,6 @@ extern void spi_transfer_cs_change_delay_exec(struct spi_message *msg,
struct spi_device {
struct device dev;
struct spi_controller *controller;
- struct spi_controller *master; /* Compatibility layer */
u32 max_speed_hz;
u8 chip_select[SPI_CS_CNT_MAX];
u8 bits_per_word;
@@ -1298,7 +1296,7 @@ spi_max_transfer_size(struct spi_device *spi)
*/
static inline bool spi_is_bpw_supported(struct spi_device *spi, u32 bpw)
{
- u32 bpw_mask = spi->master->bits_per_word_mask;
+ u32 bpw_mask = spi->controller->bits_per_word_mask;

if (bpw == 8 || (bpw <= 32 && bpw_mask & SPI_BPW_MASK(bpw)))
return true;
@@ -1670,20 +1668,4 @@ spi_transfer_is_last(struct spi_controller *ctlr, struct spi_transfer *xfer)
return list_is_last(&xfer->transfer_list, &ctlr->cur_msg->transfers);
}

-/* Compatibility layer */
-#define spi_master spi_controller
-
-#define spi_master_get_devdata(_ctlr) spi_controller_get_devdata(_ctlr)
-#define spi_master_set_devdata(_ctlr, _data) \
- spi_controller_set_devdata(_ctlr, _data)
-#define spi_master_get(_ctlr) spi_controller_get(_ctlr)
-#define spi_master_put(_ctlr) spi_controller_put(_ctlr)
-#define spi_master_suspend(_ctlr) spi_controller_suspend(_ctlr)
-#define spi_master_resume(_ctlr) spi_controller_resume(_ctlr)
-
-#define spi_register_master(_ctlr) spi_register_controller(_ctlr)
-#define devm_spi_register_master(_dev, _ctlr) \
- devm_spi_register_controller(_dev, _ctlr)
-#define spi_unregister_master(_ctlr) spi_unregister_controller(_ctlr)
-
#endif /* __LINUX_SPI_H */
--
2.43.0



2024-02-09 15:24:58

by Andy Shevchenko

[permalink] [raw]
Subject: Re: [PATCH v3 31/32] spi: Drop compat layer from renaming "master" to "controller"

On Wed, Feb 07, 2024 at 07:40:45PM +0100, Uwe Kleine-K?nig wrote:
> Now that all in-tree users followed the rename, the compat stuff can go
> away. This completes the renaming started with commit 8caab75fd2c2
> ("spi: Generalize SPI "master" to "controller"")

It does not complete the conversion.
We still have spi_alloc_master/slave.

Besides, we still have drivers that use master/slave terminology in
their (local) variables, functions and data type names.

--
With Best Regards,
Andy Shevchenko



2024-02-09 15:48:32

by Mark Brown

[permalink] [raw]
Subject: Re: [PATCH v3 31/32] spi: Drop compat layer from renaming "master" to "controller"

On Fri, Feb 09, 2024 at 05:24:42PM +0200, Andy Shevchenko wrote:

> Besides, we still have drivers that use master/slave terminology in
> their (local) variables, functions and data type names.

There are also devices that have the terminology in their register maps
which we can't really do anything about. This series was just getting
rid of this specific compat API, not solving every problem ever.


Attachments:
(No filename) (411.00 B)
signature.asc (499.00 B)
Download all attachments

2024-02-09 17:06:21

by Andy Shevchenko

[permalink] [raw]
Subject: Re: [PATCH v3 31/32] spi: Drop compat layer from renaming "master" to "controller"

On Fri, Feb 09, 2024 at 03:48:19PM +0000, Mark Brown wrote:
> On Fri, Feb 09, 2024 at 05:24:42PM +0200, Andy Shevchenko wrote:
>
> > Besides, we still have drivers that use master/slave terminology in
> > their (local) variables, functions and data type names.
>
> There are also devices that have the terminology in their register maps
> which we can't really do anything about. This series was just getting
> rid of this specific compat API, not solving every problem ever.

Don't take me wrong, I am not against this series, it's a very good job by Uwe
(I planned to do myself something similar, but as you know only had time for
definitions)!

My comment is to point Uwe's attention to (still) missing parts (as per my
first paragraph).

--
With Best Regards,
Andy Shevchenko