spi: struct spi_device constification

Merge series from Geert Uytterhoeven <geert+renesas@glider.be>:

After noticing new cases of casting away constness, I went over all
spi_get_*() functions and their callers, and made the following changes:
  1. Make all pointer parameters const where possible,
  2. Remove unneeded casts, some not even related to constness.
This commit is contained in:
Mark Brown 2023-03-13 18:19:31 +00:00
Родитель 0762875674 7859ad5a40
Коммит 4d8ff713e6
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 24D68B725D5487D0
3 изменённых файлов: 7 добавлений и 7 удалений

Просмотреть файл

@ -1068,7 +1068,7 @@ static int dspi_setup(struct spi_device *spi)
static void dspi_cleanup(struct spi_device *spi)
{
struct chip_data *chip = spi_get_ctldata((struct spi_device *)spi);
struct chip_data *chip = spi_get_ctldata(spi);
dev_dbg(&spi->dev, "spi_device %u.%u cleanup\n",
spi->controller->bus_num, spi_get_chipselect(spi, 0));

Просмотреть файл

@ -587,11 +587,11 @@ static int sh_msiof_prepare_message(struct spi_controller *ctlr,
u32 ss, cs_high;
/* Configure pins before asserting CS */
if (spi_get_csgpiod((struct spi_device *)spi, 0)) {
if (spi_get_csgpiod(spi, 0)) {
ss = ctlr->unused_native_cs;
cs_high = p->native_cs_high;
} else {
ss = spi_get_chipselect((struct spi_device *)spi, 0);
ss = spi_get_chipselect(spi, 0);
cs_high = !!(spi->mode & SPI_CS_HIGH);
}
sh_msiof_spi_set_pin_regs(p, ss, !!(spi->mode & SPI_CPOL),

Просмотреть файл

@ -244,7 +244,7 @@ static inline void spi_dev_put(struct spi_device *spi)
}
/* ctldata is for the bus_controller driver's runtime state */
static inline void *spi_get_ctldata(struct spi_device *spi)
static inline void *spi_get_ctldata(const struct spi_device *spi)
{
return spi->controller_state;
}
@ -261,12 +261,12 @@ static inline void spi_set_drvdata(struct spi_device *spi, void *data)
dev_set_drvdata(&spi->dev, data);
}
static inline void *spi_get_drvdata(struct spi_device *spi)
static inline void *spi_get_drvdata(const struct spi_device *spi)
{
return dev_get_drvdata(&spi->dev);
}
static inline u8 spi_get_chipselect(struct spi_device *spi, u8 idx)
static inline u8 spi_get_chipselect(const struct spi_device *spi, u8 idx)
{
return spi->chip_select;
}
@ -276,7 +276,7 @@ static inline void spi_set_chipselect(struct spi_device *spi, u8 idx, u8 chipsel
spi->chip_select = chipselect;
}
static inline struct gpio_desc *spi_get_csgpiod(struct spi_device *spi, u8 idx)
static inline struct gpio_desc *spi_get_csgpiod(const struct spi_device *spi, u8 idx)
{
return spi->cs_gpiod;
}