@@ -1021,7 +1021,7 @@ static inline bool spi_is_last_cs(struct spi_device *spi)
1021
1021
bool last = false;
1022
1022
1023
1023
for (idx = 0 ; idx < SPI_CS_CNT_MAX ; idx ++ ) {
1024
- if (( spi -> cs_index_mask >> idx ) & 0x01 ) {
1024
+ if (spi -> cs_index_mask & BIT ( idx )) {
1025
1025
if (spi -> controller -> last_cs [idx ] == spi_get_chipselect (spi , idx ))
1026
1026
last = true;
1027
1027
}
@@ -1072,8 +1072,7 @@ static void spi_set_cs(struct spi_device *spi, bool enable, bool force)
1072
1072
* into account.
1073
1073
*/
1074
1074
for (idx = 0 ; idx < SPI_CS_CNT_MAX ; idx ++ ) {
1075
- if (((spi -> cs_index_mask >> idx ) & 0x01 ) &&
1076
- spi_get_csgpiod (spi , idx )) {
1075
+ if ((spi -> cs_index_mask & BIT (idx )) && spi_get_csgpiod (spi , idx )) {
1077
1076
if (has_acpi_companion (& spi -> dev ))
1078
1077
gpiod_set_value_cansleep (spi_get_csgpiod (spi , idx ),
1079
1078
!enable );
@@ -2456,14 +2455,10 @@ static int of_spi_parse_dt(struct spi_controller *ctlr, struct spi_device *spi,
2456
2455
spi_set_chipselect (spi , idx , cs [idx ]);
2457
2456
2458
2457
/*
2459
- * spi->chip_select[i] gives the corresponding physical CS for logical CS i
2460
- * logical CS number is represented by setting the ith bit in spi->cs_index_mask
2461
- * So, for example, if spi->cs_index_mask = 0x01 then logical CS number is 0 and
2462
- * spi->chip_select[0] will give the physical CS.
2463
- * By default spi->chip_select[0] will hold the physical CS number so, set
2464
- * spi->cs_index_mask as 0x01.
2458
+ * By default spi->chip_select[0] will hold the physical CS number,
2459
+ * so set bit 0 in spi->cs_index_mask.
2465
2460
*/
2466
- spi -> cs_index_mask = 0x01 ;
2461
+ spi -> cs_index_mask = BIT ( 0 ) ;
2467
2462
2468
2463
/* Device speed */
2469
2464
if (!of_property_read_u32 (nc , "spi-max-frequency" , & value ))
@@ -2587,14 +2582,10 @@ struct spi_device *spi_new_ancillary_device(struct spi_device *spi,
2587
2582
ancillary -> max_speed_hz = spi -> max_speed_hz ;
2588
2583
ancillary -> mode = spi -> mode ;
2589
2584
/*
2590
- * spi->chip_select[i] gives the corresponding physical CS for logical CS i
2591
- * logical CS number is represented by setting the ith bit in spi->cs_index_mask
2592
- * So, for example, if spi->cs_index_mask = 0x01 then logical CS number is 0 and
2593
- * spi->chip_select[0] will give the physical CS.
2594
- * By default spi->chip_select[0] will hold the physical CS number so, set
2595
- * spi->cs_index_mask as 0x01.
2585
+ * By default spi->chip_select[0] will hold the physical CS number,
2586
+ * so set bit 0 in spi->cs_index_mask.
2596
2587
*/
2597
- ancillary -> cs_index_mask = 0x01 ;
2588
+ ancillary -> cs_index_mask = BIT ( 0 ) ;
2598
2589
2599
2590
WARN_ON (!mutex_is_locked (& ctlr -> add_lock ));
2600
2591
@@ -2841,14 +2832,10 @@ struct spi_device *acpi_spi_device_alloc(struct spi_controller *ctlr,
2841
2832
spi -> irq = lookup .irq ;
2842
2833
spi -> bits_per_word = lookup .bits_per_word ;
2843
2834
/*
2844
- * spi->chip_select[i] gives the corresponding physical CS for logical CS i
2845
- * logical CS number is represented by setting the ith bit in spi->cs_index_mask
2846
- * So, for example, if spi->cs_index_mask = 0x01 then logical CS number is 0 and
2847
- * spi->chip_select[0] will give the physical CS.
2848
- * By default spi->chip_select[0] will hold the physical CS number so, set
2849
- * spi->cs_index_mask as 0x01.
2835
+ * By default spi->chip_select[0] will hold the physical CS number,
2836
+ * so set bit 0 in spi->cs_index_mask.
2850
2837
*/
2851
- spi -> cs_index_mask = 0x01 ;
2838
+ spi -> cs_index_mask = BIT ( 0 ) ;
2852
2839
2853
2840
return spi ;
2854
2841
}
0 commit comments