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

spi: pxa2xx: Remove pointer to chip data from driver data

Transfer state machine in this driver does not need to set/unset pointer
to chip data between queueing and finalizing message as it is not
actually used as a state info itself but just pointer passing.

Since this per SPI device specific chip data is already carried in
ctldata use that and remove pointer to chip data from driver data.

While at it, group initialized variables before uninitialized variables
in pump_transfers().

Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Jarkko Nikula and committed by
Mark Brown
96579a4e 4fc0caac

+15 -17
+2 -1
drivers/spi/spi-pxa2xx-dma.c
··· 76 76 pxa2xx_spi_dma_prepare_one(struct driver_data *drv_data, 77 77 enum dma_transfer_direction dir) 78 78 { 79 - struct chip_data *chip = drv_data->cur_chip; 79 + struct chip_data *chip = 80 + spi_get_ctldata(drv_data->master->cur_msg->spi); 80 81 struct spi_transfer *xfer = drv_data->cur_transfer; 81 82 enum dma_slave_buswidth width; 82 83 struct dma_slave_config cfg;
+13 -15
drivers/spi/spi-pxa2xx.c
··· 355 355 356 356 static void cs_assert(struct driver_data *drv_data) 357 357 { 358 - struct chip_data *chip = drv_data->cur_chip; 358 + struct chip_data *chip = 359 + spi_get_ctldata(drv_data->master->cur_msg->spi); 359 360 360 361 if (drv_data->ssp_type == CE4100_SSP) { 361 - pxa2xx_spi_write(drv_data, SSSR, drv_data->cur_chip->frm); 362 + pxa2xx_spi_write(drv_data, SSSR, chip->frm); 362 363 return; 363 364 } 364 365 ··· 379 378 380 379 static void cs_deassert(struct driver_data *drv_data) 381 380 { 382 - struct chip_data *chip = drv_data->cur_chip; 381 + struct chip_data *chip = 382 + spi_get_ctldata(drv_data->master->cur_msg->spi); 383 383 384 384 if (drv_data->ssp_type == CE4100_SSP) 385 385 return; ··· 576 574 cs_deassert(drv_data); 577 575 } 578 576 579 - drv_data->cur_chip = NULL; 580 577 spi_finalize_current_message(drv_data->master); 581 578 } 582 579 583 580 static void reset_sccr1(struct driver_data *drv_data) 584 581 { 585 - struct chip_data *chip = drv_data->cur_chip; 582 + struct chip_data *chip = 583 + spi_get_ctldata(drv_data->master->cur_msg->spi); 586 584 u32 sccr1_reg; 587 585 588 586 sccr1_reg = pxa2xx_spi_read(drv_data, SSCR1) & ~drv_data->int_cr1; ··· 906 904 static unsigned int pxa2xx_ssp_get_clk_div(struct driver_data *drv_data, 907 905 int rate) 908 906 { 909 - struct chip_data *chip = drv_data->cur_chip; 907 + struct chip_data *chip = 908 + spi_get_ctldata(drv_data->master->cur_msg->spi); 910 909 unsigned int clk_div; 911 910 912 911 switch (drv_data->ssp_type) { ··· 937 934 struct driver_data *drv_data = (struct driver_data *)data; 938 935 struct spi_master *master = drv_data->master; 939 936 struct spi_message *message = master->cur_msg; 937 + struct chip_data *chip = spi_get_ctldata(message->spi); 938 + u32 dma_thresh = chip->dma_threshold; 939 + u32 dma_burst = chip->dma_burst_size; 940 + u32 change_mask = pxa2xx_spi_get_ssrc1_change_mask(drv_data); 940 941 struct spi_transfer *transfer; 941 942 struct spi_transfer *previous; 942 - struct chip_data *chip; 943 943 u32 clk_div; 944 944 u8 bits; 945 945 u32 speed; 946 946 u32 cr0; 947 947 u32 cr1; 948 - u32 dma_thresh = drv_data->cur_chip->dma_threshold; 949 - u32 dma_burst = drv_data->cur_chip->dma_burst_size; 950 - u32 change_mask = pxa2xx_spi_get_ssrc1_change_mask(drv_data); 951 948 int err; 952 949 int dma_mapped; 953 950 954 951 /* Get current state information */ 955 952 transfer = drv_data->cur_transfer; 956 - chip = drv_data->cur_chip; 957 953 958 954 /* Handle for abort */ 959 955 if (message->state == ERROR_STATE) { ··· 1151 1149 drv_data->cur_transfer = list_entry(msg->transfers.next, 1152 1150 struct spi_transfer, 1153 1151 transfer_list); 1154 - 1155 - /* prepare to setup the SSP, in pump_transfers, using the per 1156 - * chip configuration */ 1157 - drv_data->cur_chip = spi_get_ctldata(msg->spi); 1158 1152 1159 1153 /* Mark as busy and launch transfers */ 1160 1154 tasklet_schedule(&drv_data->pump_transfers);
-1
drivers/spi/spi-pxa2xx.h
··· 54 54 55 55 /* Current message transfer state info */ 56 56 struct spi_transfer *cur_transfer; 57 - struct chip_data *cur_chip; 58 57 size_t len; 59 58 void *tx; 60 59 void *tx_end;