mbox series

[v2,00/33] spi: get rid of some legacy macros

Message ID cover.1705944943.git.u.kleine-koenig@pengutronix.de
Headers show
Series spi: get rid of some legacy macros | expand

Message

Uwe Kleine-König Jan. 22, 2024, 6:06 p.m. UTC
Hello,

this is v2 of this patch set.

Changes since (implicit) v1, sent with Message-Id:
cover.1705348269.git.u.kleine-koenig@pengutronix.de:

 - Rebase to v6.8-rc1
 - Fix a build failure on sh
 - Added the tags received in (implicit) v1.

The slave-mt27xx driver needs some more work. The patch presented here
is enough however to get rid of the defines handled in patch 32.
Cleaning that up is out-of-scope for this series, so I'll delay that
until later.

Note that Jonathan Cameron has already applied patch 3 to his tree, it
didn't appear in a public tree though yet. I still included it here to
make the kernel build bots happy.

Best regards
Uwe

Uwe Kleine-König (33):
  fpga: ice40-spi: Follow renaming of SPI "master" to "controller"
  ieee802154: ca8210: Follow renaming of SPI "master" to "controller"
  iio: adc: ad_sigma_delta: Follow renaming of SPI "master" to
    "controller"
  Input: pxspad - follow renaming of SPI "master" to "controller"
  Input: synaptics-rmi4 - follow renaming of SPI "master" to
    "controller"
  media: mgb4: Follow renaming of SPI "master" to "controller"
  media: netup_unidvb: Follow renaming of SPI "master" to "controller"
  media: usb/msi2500: Follow renaming of SPI "master" to "controller"
  media: v4l2-subdev: Follow renaming of SPI "master" to "controller"
  misc: gehc-achc: Follow renaming of SPI "master" to "controller"
  mmc: mmc_spi: Follow renaming of SPI "master" to "controller"
  mtd: dataflash: Follow renaming of SPI "master" to "controller"
  mtd: rawnand: fsl_elbc: Let .probe retry if local bus is missing
  net: ks8851: Follow renaming of SPI "master" to "controller"
  net: vertexcom: mse102x: Follow renaming of SPI "master" to
    "controller"
  platform/chrome: cros_ec_spi: Follow renaming of SPI "master" to
    "controller"
  spi: bitbang: Follow renaming of SPI "master" to "controller"
  spi: cadence-quadspi: Don't emit error message on allocation error
  spi: cadence-quadspi: Follow renaming of SPI "master" to "controller"
  spi: cavium: Follow renaming of SPI "master" to "controller"
  spi: geni-qcom: Follow renaming of SPI "master" to "controller"
  spi: loopback-test: Follow renaming of SPI "master" to "controller"
  spi: slave-mt27xx: Follow renaming of SPI "master" to "controller"
  spi: spidev: Follow renaming of SPI "master" to "controller"
  staging: fbtft: Follow renaming of SPI "master" to "controller"
  staging: greybus: spi: Follow renaming of SPI "master" to "controller"
  tpm_tis_spi: Follow renaming of SPI "master" to "controller"
  usb: gadget: max3420_udc: Follow renaming of SPI "master" to
    "controller"
  video: fbdev: mmp: Follow renaming of SPI "master" to "controller"
  wifi: libertas: Follow renaming of SPI "master" to "controller"
  spi: fsl-lib: Follow renaming of SPI "master" to "controller"
  spi: Drop compat layer from renaming "master" to "controller"
  Documentation: spi: Update documentation for renaming "master" to
    "controller"

 .../driver-api/driver-model/devres.rst        |  2 +-
 Documentation/spi/spi-summary.rst             | 74 +++++++++----------
 drivers/char/tpm/tpm_tis_spi_main.c           |  4 +-
 drivers/fpga/ice40-spi.c                      |  4 +-
 drivers/iio/adc/ad_sigma_delta.c              | 14 ++--
 drivers/input/joystick/psxpad-spi.c           |  4 +-
 drivers/input/rmi4/rmi_spi.c                  |  2 +-
 drivers/media/pci/mgb4/mgb4_core.c            | 14 ++--
 .../media/pci/netup_unidvb/netup_unidvb_spi.c | 48 ++++++------
 drivers/media/usb/msi2500/msi2500.c           | 38 +++++-----
 drivers/media/v4l2-core/v4l2-spi.c            |  4 +-
 drivers/misc/gehc-achc.c                      |  8 +-
 drivers/mmc/host/mmc_spi.c                    |  6 +-
 drivers/mtd/devices/mtd_dataflash.c           |  2 +-
 drivers/mtd/nand/raw/fsl_elbc_nand.c          |  3 +-
 drivers/net/ethernet/micrel/ks8851_spi.c      |  4 +-
 drivers/net/ethernet/vertexcom/mse102x.c      |  2 +-
 drivers/net/ieee802154/ca8210.c               |  2 +-
 .../net/wireless/marvell/libertas/if_spi.c    |  2 +-
 drivers/platform/chrome/cros_ec_spi.c         |  8 +-
 drivers/spi/spi-ath79.c                       |  4 +-
 drivers/spi/spi-bitbang.c                     | 64 ++++++++--------
 drivers/spi/spi-butterfly.c                   |  6 +-
 drivers/spi/spi-cadence-quadspi.c             |  7 +-
 drivers/spi/spi-cavium.c                      |  6 +-
 drivers/spi/spi-cavium.h                      |  2 +-
 drivers/spi/spi-davinci.c                     |  6 +-
 drivers/spi/spi-fsl-lib.c                     | 14 ++--
 drivers/spi/spi-geni-qcom.c                   |  2 +-
 drivers/spi/spi-gpio.c                        |  2 +-
 drivers/spi/spi-lm70llp.c                     |  6 +-
 drivers/spi/spi-loopback-test.c               |  4 +-
 drivers/spi/spi-oc-tiny.c                     |  6 +-
 drivers/spi/spi-omap-uwire.c                  |  4 +-
 drivers/spi/spi-sh-sci.c                      | 10 +--
 drivers/spi/spi-slave-mt27xx.c                |  2 +-
 drivers/spi/spi-xilinx.c                      |  4 +-
 drivers/spi/spi-xtensa-xtfpga.c               |  2 +-
 drivers/spi/spi.c                             |  2 +-
 drivers/spi/spidev.c                          |  2 +-
 drivers/staging/fbtft/fbtft-core.c            |  4 +-
 drivers/staging/greybus/spilib.c              | 66 ++++++++---------
 drivers/usb/gadget/udc/max3420_udc.c          |  2 +-
 drivers/video/fbdev/mmp/hw/mmp_spi.c          | 26 +++----
 include/linux/spi/spi.h                       | 20 +----
 include/linux/spi/spi_bitbang.h               |  2 +-
 include/media/v4l2-common.h                   |  6 +-
 47 files changed, 254 insertions(+), 272 deletions(-)


base-commit: 6613476e225e090cc9aad49be7fa504e290dd33d

Comments

Mark Brown Jan. 24, 2024, 5:22 p.m. UTC | #1
On Wed, Jan 24, 2024 at 09:13:49AM -0800, Greg Kroah-Hartman wrote:
> On Mon, Jan 22, 2024 at 07:06:55PM +0100, Uwe Kleine-König wrote:

> > Note that Jonathan Cameron has already applied patch 3 to his tree, it
> > didn't appear in a public tree though yet. I still included it here to
> > make the kernel build bots happy.

> Are we supposed to take the individual changes in our different
> subsystem trees, or do you want them all to go through the spi tree?

Given that the final patch removes the legacy interfaces I'm expecting
to take them via SPI.
Jonathan Cameron Jan. 24, 2024, 8:02 p.m. UTC | #2
On Mon, 22 Jan 2024 19:23:43 +0000
Jonathan Cameron <jic23@kernel.org> wrote:

> On Mon, 22 Jan 2024 18:18:22 +0000
> Mark Brown <broonie@kernel.org> wrote:
> 
> > On Mon, Jan 22, 2024 at 07:06:55PM +0100, Uwe Kleine-König wrote:
> >   
> > > Note that Jonathan Cameron has already applied patch 3 to his tree, it
> > > didn't appear in a public tree though yet. I still included it here to
> > > make the kernel build bots happy.    
> > 
> > It's also going to be needed for buildability of the end of the series.  
> 
> Ah.  I thought intent was to split this across all the different trees
> then do the final patch only after they were all gone?
> 
> I'm fine with it going all in one go if people prefer that.
> 
> My tree will be out in a few mins. Was just waiting to rebase on rc1
> which I've just done.
> 
> Jonathan
> 

Dropped from my tree.

Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Jarkko Sakkinen Feb. 1, 2024, 9:47 p.m. UTC | #3
On Wed Jan 24, 2024 at 7:22 PM EET, Mark Brown wrote:
> On Wed, Jan 24, 2024 at 09:13:49AM -0800, Greg Kroah-Hartman wrote:
> > On Mon, Jan 22, 2024 at 07:06:55PM +0100, Uwe Kleine-König wrote:
>
> > > Note that Jonathan Cameron has already applied patch 3 to his tree, it
> > > didn't appear in a public tree though yet. I still included it here to
> > > make the kernel build bots happy.
>
> > Are we supposed to take the individual changes in our different
> > subsystem trees, or do you want them all to go through the spi tree?
>
> Given that the final patch removes the legacy interfaces I'm expecting
> to take them via SPI.

+1

least fuss approach

BR, Jarkko
Mauro Carvalho Chehab Feb. 7, 2024, 4:43 a.m. UTC | #4
Em Mon, 22 Jan 2024 19:07:02 +0100
Uwe Kleine-König <u.kleine-koenig@pengutronix.de> escreveu:

> In commit 8caab75fd2c2 ("spi: Generalize SPI "master" to "controller"")
> some functions and struct members were renamed. To not break all drivers
> compatibility macros were provided.
> 
> To be able to remove these compatibility macros push the renaming into
> this driver.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

It is probably better to have this series applied altogether, so 
feel free to handle it via your tree:

Acked-by: Mauro Carvalho Chehab <mchehab@kernel.org>

> ---
>  .../media/pci/netup_unidvb/netup_unidvb_spi.c | 48 +++++++++----------
>  1 file changed, 24 insertions(+), 24 deletions(-)
> 
> diff --git a/drivers/media/pci/netup_unidvb/netup_unidvb_spi.c b/drivers/media/pci/netup_unidvb/netup_unidvb_spi.c
> index 526042d8afae..e90aa1c1584c 100644
> --- a/drivers/media/pci/netup_unidvb/netup_unidvb_spi.c
> +++ b/drivers/media/pci/netup_unidvb/netup_unidvb_spi.c
> @@ -35,7 +35,7 @@ struct netup_spi_regs {
>  
>  struct netup_spi {
>  	struct device			*dev;
> -	struct spi_master		*master;
> +	struct spi_controller		*ctlr;
>  	struct netup_spi_regs __iomem	*regs;
>  	u8 __iomem			*mmio;
>  	spinlock_t			lock;
> @@ -78,7 +78,7 @@ irqreturn_t netup_spi_interrupt(struct netup_spi *spi)
>  	reg = readw(&spi->regs->control_stat);
>  	if (!(reg & NETUP_SPI_CTRL_IRQ)) {
>  		spin_unlock_irqrestore(&spi->lock, flags);
> -		dev_dbg(&spi->master->dev,
> +		dev_dbg(&spi->ctlr->dev,
>  			"%s(): not mine interrupt\n", __func__);
>  		return IRQ_NONE;
>  	}
> @@ -88,15 +88,15 @@ irqreturn_t netup_spi_interrupt(struct netup_spi *spi)
>  	spi->state = SPI_STATE_DONE;
>  	wake_up(&spi->waitq);
>  	spin_unlock_irqrestore(&spi->lock, flags);
> -	dev_dbg(&spi->master->dev,
> +	dev_dbg(&spi->ctlr->dev,
>  		"%s(): SPI interrupt handled\n", __func__);
>  	return IRQ_HANDLED;
>  }
>  
> -static int netup_spi_transfer(struct spi_master *master,
> +static int netup_spi_transfer(struct spi_controller *ctlr,
>  			      struct spi_message *msg)
>  {
> -	struct netup_spi *spi = spi_master_get_devdata(master);
> +	struct netup_spi *spi = spi_controller_get_devdata(ctlr);
>  	struct spi_transfer *t;
>  	int result = 0;
>  	u32 tr_size;
> @@ -131,7 +131,7 @@ static int netup_spi_transfer(struct spi_master *master,
>  				NETUP_SPI_CTRL_START |
>  				(frag_last ? NETUP_SPI_CTRL_LAST_CS : 0),
>  				&spi->regs->control_stat);
> -			dev_dbg(&spi->master->dev,
> +			dev_dbg(&spi->ctlr->dev,
>  				"%s(): control_stat 0x%04x\n",
>  				__func__, readw(&spi->regs->control_stat));
>  			wait_event_timeout(spi->waitq,
> @@ -144,11 +144,11 @@ static int netup_spi_transfer(struct spi_master *master,
>  				}
>  			} else {
>  				if (spi->state == SPI_STATE_START) {
> -					dev_dbg(&spi->master->dev,
> +					dev_dbg(&spi->ctlr->dev,
>  						"%s(): transfer timeout\n",
>  						__func__);
>  				} else {
> -					dev_dbg(&spi->master->dev,
> +					dev_dbg(&spi->ctlr->dev,
>  						"%s(): invalid state %d\n",
>  						__func__, spi->state);
>  				}
> @@ -161,7 +161,7 @@ static int netup_spi_transfer(struct spi_master *master,
>  	}
>  done:
>  	msg->status = result;
> -	spi_finalize_current_message(master);
> +	spi_finalize_current_message(ctlr);
>  	return result;
>  }
>  
> @@ -172,30 +172,30 @@ static int netup_spi_setup(struct spi_device *spi)
>  
>  int netup_spi_init(struct netup_unidvb_dev *ndev)
>  {
> -	struct spi_master *master;
> +	struct spi_controller *ctlr;
>  	struct netup_spi *nspi;
>  
> -	master = devm_spi_alloc_master(&ndev->pci_dev->dev,
> -		sizeof(struct netup_spi));
> -	if (!master) {
> +	ctlr = devm_spi_alloc_master(&ndev->pci_dev->dev,
> +					 sizeof(struct netup_spi));
> +	if (!ctlr) {
>  		dev_err(&ndev->pci_dev->dev,
>  			"%s(): unable to alloc SPI master\n", __func__);
>  		return -EINVAL;
>  	}
> -	nspi = spi_master_get_devdata(master);
> -	master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_LSB_FIRST;
> -	master->bus_num = -1;
> -	master->num_chipselect = 1;
> -	master->transfer_one_message = netup_spi_transfer;
> -	master->setup = netup_spi_setup;
> +	nspi = spi_controller_get_devdata(ctlr);
> +	ctlr->mode_bits = SPI_CPOL | SPI_CPHA | SPI_LSB_FIRST;
> +	ctlr->bus_num = -1;
> +	ctlr->num_chipselect = 1;
> +	ctlr->transfer_one_message = netup_spi_transfer;
> +	ctlr->setup = netup_spi_setup;
>  	spin_lock_init(&nspi->lock);
>  	init_waitqueue_head(&nspi->waitq);
> -	nspi->master = master;
> +	nspi->ctlr = ctlr;
>  	nspi->regs = (struct netup_spi_regs __iomem *)(ndev->bmmio0 + 0x4000);
>  	writew(2, &nspi->regs->clock_divider);
>  	writew(NETUP_UNIDVB_IRQ_SPI, ndev->bmmio0 + REG_IMASK_SET);
>  	ndev->spi = nspi;
> -	if (spi_register_master(master)) {
> +	if (spi_register_controller(ctlr)) {
>  		ndev->spi = NULL;
>  		dev_err(&ndev->pci_dev->dev,
>  			"%s(): unable to register SPI bus\n", __func__);
> @@ -207,8 +207,8 @@ int netup_spi_init(struct netup_unidvb_dev *ndev)
>  		ndev->pci_bus,
>  		ndev->pci_slot,
>  		ndev->pci_func);
> -	if (!spi_new_device(master, &netup_spi_board)) {
> -		spi_unregister_master(master);
> +	if (!spi_new_device(ctlr, &netup_spi_board)) {
> +		spi_unregister_controller(ctlr);
>  		ndev->spi = NULL;
>  		dev_err(&ndev->pci_dev->dev,
>  			"%s(): unable to create SPI device\n", __func__);
> @@ -227,7 +227,7 @@ void netup_spi_release(struct netup_unidvb_dev *ndev)
>  	if (!spi)
>  		return;
>  
> -	spi_unregister_master(spi->master);
> +	spi_unregister_controller(spi->ctlr);
>  	spin_lock_irqsave(&spi->lock, flags);
>  	reg = readw(&spi->regs->control_stat);
>  	writew(reg | NETUP_SPI_CTRL_IRQ, &spi->regs->control_stat);



Thanks,
Mauro