diff options
author | Geert Uytterhoeven <geert+renesas@linux-m68k.org> | 2013-12-24 04:49:32 -0500 |
---|---|---|
committer | Mark Brown <broonie@linaro.org> | 2013-12-24 08:19:55 -0500 |
commit | baf588f428e2b3bf91ac138e600c2e33c23cbfa3 (patch) | |
tree | 541e14c1136240c7c1f78934f3c6165edf90b1dc | |
parent | c132f0949ab62ba95474f6eda44e9e1b5780b973 (diff) |
spi: rspi: Make more pointers const
Signed-off-by: Geert Uytterhoeven <geert+renesas@linux-m68k.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
-rw-r--r-- | drivers/spi/spi-rspi.c | 37 |
1 files changed, 20 insertions, 17 deletions
diff --git a/drivers/spi/spi-rspi.c b/drivers/spi/spi-rspi.c index 73f1a29b22c3..aea0c62b095d 100644 --- a/drivers/spi/spi-rspi.c +++ b/drivers/spi/spi-rspi.c | |||
@@ -170,34 +170,35 @@ struct rspi_data { | |||
170 | unsigned dma_callbacked:1; | 170 | unsigned dma_callbacked:1; |
171 | }; | 171 | }; |
172 | 172 | ||
173 | static void rspi_write8(struct rspi_data *rspi, u8 data, u16 offset) | 173 | static void rspi_write8(const struct rspi_data *rspi, u8 data, u16 offset) |
174 | { | 174 | { |
175 | iowrite8(data, rspi->addr + offset); | 175 | iowrite8(data, rspi->addr + offset); |
176 | } | 176 | } |
177 | 177 | ||
178 | static void rspi_write16(struct rspi_data *rspi, u16 data, u16 offset) | 178 | static void rspi_write16(const struct rspi_data *rspi, u16 data, u16 offset) |
179 | { | 179 | { |
180 | iowrite16(data, rspi->addr + offset); | 180 | iowrite16(data, rspi->addr + offset); |
181 | } | 181 | } |
182 | 182 | ||
183 | static void rspi_write32(struct rspi_data *rspi, u32 data, u16 offset) | 183 | static void rspi_write32(const struct rspi_data *rspi, u32 data, u16 offset) |
184 | { | 184 | { |
185 | iowrite32(data, rspi->addr + offset); | 185 | iowrite32(data, rspi->addr + offset); |
186 | } | 186 | } |
187 | 187 | ||
188 | static u8 rspi_read8(struct rspi_data *rspi, u16 offset) | 188 | static u8 rspi_read8(const struct rspi_data *rspi, u16 offset) |
189 | { | 189 | { |
190 | return ioread8(rspi->addr + offset); | 190 | return ioread8(rspi->addr + offset); |
191 | } | 191 | } |
192 | 192 | ||
193 | static u16 rspi_read16(struct rspi_data *rspi, u16 offset) | 193 | static u16 rspi_read16(const struct rspi_data *rspi, u16 offset) |
194 | { | 194 | { |
195 | return ioread16(rspi->addr + offset); | 195 | return ioread16(rspi->addr + offset); |
196 | } | 196 | } |
197 | 197 | ||
198 | /* optional functions */ | 198 | /* optional functions */ |
199 | struct spi_ops { | 199 | struct spi_ops { |
200 | int (*set_config_register)(struct rspi_data *rspi, int access_size); | 200 | int (*set_config_register)(const struct rspi_data *rspi, |
201 | int access_size); | ||
201 | int (*send_pio)(struct rspi_data *rspi, struct spi_message *mesg, | 202 | int (*send_pio)(struct rspi_data *rspi, struct spi_message *mesg, |
202 | struct spi_transfer *t); | 203 | struct spi_transfer *t); |
203 | int (*receive_pio)(struct rspi_data *rspi, struct spi_message *mesg, | 204 | int (*receive_pio)(struct rspi_data *rspi, struct spi_message *mesg, |
@@ -208,7 +209,8 @@ struct spi_ops { | |||
208 | /* | 209 | /* |
209 | * functions for RSPI | 210 | * functions for RSPI |
210 | */ | 211 | */ |
211 | static int rspi_set_config_register(struct rspi_data *rspi, int access_size) | 212 | static int rspi_set_config_register(const struct rspi_data *rspi, |
213 | int access_size) | ||
212 | { | 214 | { |
213 | int spbr; | 215 | int spbr; |
214 | 216 | ||
@@ -243,7 +245,8 @@ static int rspi_set_config_register(struct rspi_data *rspi, int access_size) | |||
243 | /* | 245 | /* |
244 | * functions for QSPI | 246 | * functions for QSPI |
245 | */ | 247 | */ |
246 | static int qspi_set_config_register(struct rspi_data *rspi, int access_size) | 248 | static int qspi_set_config_register(const struct rspi_data *rspi, |
249 | int access_size) | ||
247 | { | 250 | { |
248 | u16 spcmd; | 251 | u16 spcmd; |
249 | int spbr; | 252 | int spbr; |
@@ -292,12 +295,12 @@ static int qspi_set_config_register(struct rspi_data *rspi, int access_size) | |||
292 | 295 | ||
293 | #define set_config_register(spi, n) spi->ops->set_config_register(spi, n) | 296 | #define set_config_register(spi, n) spi->ops->set_config_register(spi, n) |
294 | 297 | ||
295 | static void rspi_enable_irq(struct rspi_data *rspi, u8 enable) | 298 | static void rspi_enable_irq(const struct rspi_data *rspi, u8 enable) |
296 | { | 299 | { |
297 | rspi_write8(rspi, rspi_read8(rspi, RSPI_SPCR) | enable, RSPI_SPCR); | 300 | rspi_write8(rspi, rspi_read8(rspi, RSPI_SPCR) | enable, RSPI_SPCR); |
298 | } | 301 | } |
299 | 302 | ||
300 | static void rspi_disable_irq(struct rspi_data *rspi, u8 disable) | 303 | static void rspi_disable_irq(const struct rspi_data *rspi, u8 disable) |
301 | { | 304 | { |
302 | rspi_write8(rspi, rspi_read8(rspi, RSPI_SPCR) & ~disable, RSPI_SPCR); | 305 | rspi_write8(rspi, rspi_read8(rspi, RSPI_SPCR) & ~disable, RSPI_SPCR); |
303 | } | 306 | } |
@@ -316,12 +319,12 @@ static int rspi_wait_for_interrupt(struct rspi_data *rspi, u8 wait_mask, | |||
316 | return 0; | 319 | return 0; |
317 | } | 320 | } |
318 | 321 | ||
319 | static void rspi_assert_ssl(struct rspi_data *rspi) | 322 | static void rspi_assert_ssl(const struct rspi_data *rspi) |
320 | { | 323 | { |
321 | rspi_write8(rspi, rspi_read8(rspi, RSPI_SPCR) | SPCR_SPE, RSPI_SPCR); | 324 | rspi_write8(rspi, rspi_read8(rspi, RSPI_SPCR) | SPCR_SPE, RSPI_SPCR); |
322 | } | 325 | } |
323 | 326 | ||
324 | static void rspi_negate_ssl(struct rspi_data *rspi) | 327 | static void rspi_negate_ssl(const struct rspi_data *rspi) |
325 | { | 328 | { |
326 | rspi_write8(rspi, rspi_read8(rspi, RSPI_SPCR) & ~SPCR_SPE, RSPI_SPCR); | 329 | rspi_write8(rspi, rspi_read8(rspi, RSPI_SPCR) & ~SPCR_SPE, RSPI_SPCR); |
327 | } | 330 | } |
@@ -507,7 +510,7 @@ end_nomap: | |||
507 | return ret; | 510 | return ret; |
508 | } | 511 | } |
509 | 512 | ||
510 | static void rspi_receive_init(struct rspi_data *rspi) | 513 | static void rspi_receive_init(const struct rspi_data *rspi) |
511 | { | 514 | { |
512 | unsigned char spsr; | 515 | unsigned char spsr; |
513 | 516 | ||
@@ -555,7 +558,7 @@ static int rspi_receive_pio(struct rspi_data *rspi, struct spi_message *mesg, | |||
555 | return 0; | 558 | return 0; |
556 | } | 559 | } |
557 | 560 | ||
558 | static void qspi_receive_init(struct rspi_data *rspi) | 561 | static void qspi_receive_init(const struct rspi_data *rspi) |
559 | { | 562 | { |
560 | unsigned char spsr; | 563 | unsigned char spsr; |
561 | 564 | ||
@@ -703,7 +706,7 @@ end_nomap: | |||
703 | return ret; | 706 | return ret; |
704 | } | 707 | } |
705 | 708 | ||
706 | static int rspi_is_dma(struct rspi_data *rspi, struct spi_transfer *t) | 709 | static int rspi_is_dma(const struct rspi_data *rspi, struct spi_transfer *t) |
707 | { | 710 | { |
708 | if (t->tx_buf && rspi->chan_tx) | 711 | if (t->tx_buf && rspi->chan_tx) |
709 | return 1; | 712 | return 1; |
@@ -824,7 +827,7 @@ static irqreturn_t rspi_irq(int irq, void *_sr) | |||
824 | static int rspi_request_dma(struct rspi_data *rspi, | 827 | static int rspi_request_dma(struct rspi_data *rspi, |
825 | struct platform_device *pdev) | 828 | struct platform_device *pdev) |
826 | { | 829 | { |
827 | struct rspi_plat_data *rspi_pd = dev_get_platdata(&pdev->dev); | 830 | const struct rspi_plat_data *rspi_pd = dev_get_platdata(&pdev->dev); |
828 | struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 831 | struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
829 | dma_cap_mask_t mask; | 832 | dma_cap_mask_t mask; |
830 | struct dma_slave_config cfg; | 833 | struct dma_slave_config cfg; |
@@ -903,7 +906,7 @@ static int rspi_probe(struct platform_device *pdev) | |||
903 | struct rspi_data *rspi; | 906 | struct rspi_data *rspi; |
904 | int ret, irq; | 907 | int ret, irq; |
905 | char clk_name[16]; | 908 | char clk_name[16]; |
906 | struct rspi_plat_data *rspi_pd = dev_get_platdata(&pdev->dev); | 909 | const struct rspi_plat_data *rspi_pd = dev_get_platdata(&pdev->dev); |
907 | const struct spi_ops *ops; | 910 | const struct spi_ops *ops; |
908 | const struct platform_device_id *id_entry = pdev->id_entry; | 911 | const struct platform_device_id *id_entry = pdev->id_entry; |
909 | 912 | ||