Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

powerpc/5200: convert mpc52xx_psc_spi to use cs_control callback

mpc52xx_psc_spi driver is the last user of the legacy activate_cs
and deactivate_cs callbacks, so convert the driver to the cs_control
hook and remove the legacy callbacks from fsl_spi_platform_data
struct.

Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>

authored by

Anton Vorontsov and committed by
Grant Likely
ab7f3341 aa296a89

+9 -17
+9 -13
drivers/spi/mpc52xx_psc_spi.c
··· 13 13 14 14 #include <linux/module.h> 15 15 #include <linux/init.h> 16 + #include <linux/types.h> 16 17 #include <linux/errno.h> 17 18 #include <linux/interrupt.h> 18 19 #include <linux/of_platform.h> ··· 31 30 32 31 struct mpc52xx_psc_spi { 33 32 /* fsl_spi_platform data */ 34 - void (*activate_cs)(u8, u8); 35 - void (*deactivate_cs)(u8, u8); 33 + void (*cs_control)(struct spi_device *spi, bool on); 36 34 u32 sysclk; 37 35 38 36 /* driver internal data */ ··· 111 111 out_be16((u16 __iomem *)&psc->ccr, ccr); 112 112 mps->bits_per_word = cs->bits_per_word; 113 113 114 - if (mps->activate_cs) 115 - mps->activate_cs(spi->chip_select, 116 - (spi->mode & SPI_CS_HIGH) ? 1 : 0); 114 + if (mps->cs_control) 115 + mps->cs_control(spi, (spi->mode & SPI_CS_HIGH) ? 1 : 0); 117 116 } 118 117 119 118 static void mpc52xx_psc_spi_deactivate_cs(struct spi_device *spi) 120 119 { 121 120 struct mpc52xx_psc_spi *mps = spi_master_get_devdata(spi->master); 122 121 123 - if (mps->deactivate_cs) 124 - mps->deactivate_cs(spi->chip_select, 125 - (spi->mode & SPI_CS_HIGH) ? 1 : 0); 122 + if (mps->cs_control) 123 + mps->cs_control(spi, (spi->mode & SPI_CS_HIGH) ? 0 : 1); 126 124 } 127 125 128 126 #define MPC52xx_PSC_BUFSIZE (MPC52xx_PSC_RFNUM_MASK + 1) ··· 386 388 mps->irq = irq; 387 389 if (pdata == NULL) { 388 390 dev_warn(dev, "probe called without platform data, no " 389 - "(de)activate_cs function will be called\n"); 390 - mps->activate_cs = NULL; 391 - mps->deactivate_cs = NULL; 391 + "cs_control function will be called\n"); 392 + mps->cs_control = NULL; 392 393 mps->sysclk = 0; 393 394 master->bus_num = bus_num; 394 395 master->num_chipselect = 255; 395 396 } else { 396 - mps->activate_cs = pdata->activate_cs; 397 - mps->deactivate_cs = pdata->deactivate_cs; 397 + mps->cs_control = pdata->cs_control; 398 398 mps->sysclk = pdata->sysclk; 399 399 master->bus_num = pdata->bus_num; 400 400 master->num_chipselect = pdata->max_chipselect;
-4
include/linux/fsl_devices.h
··· 79 79 u16 max_chipselect; 80 80 void (*cs_control)(struct spi_device *spi, bool on); 81 81 u32 sysclk; 82 - 83 - /* Legacy hooks, used by mpc52xx_psc_spi driver. */ 84 - void (*activate_cs)(u8 cs, u8 polarity); 85 - void (*deactivate_cs)(u8 cs, u8 polarity); 86 82 }; 87 83 88 84 struct mpc8xx_pcmcia_ops {