@@ -1021,7 +1021,7 @@ static inline bool spi_is_last_cs(struct spi_device *spi)
10211021 bool last = false;
10221022
10231023 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 )) {
10251025 if (spi -> controller -> last_cs [idx ] == spi_get_chipselect (spi , idx ))
10261026 last = true;
10271027 }
@@ -1072,8 +1072,7 @@ static void spi_set_cs(struct spi_device *spi, bool enable, bool force)
10721072 * into account.
10731073 */
10741074 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 )) {
10771076 if (has_acpi_companion (& spi -> dev ))
10781077 gpiod_set_value_cansleep (spi_get_csgpiod (spi , idx ),
10791078 !enable );
@@ -2456,14 +2455,10 @@ static int of_spi_parse_dt(struct spi_controller *ctlr, struct spi_device *spi,
24562455 spi_set_chipselect (spi , idx , cs [idx ]);
24572456
24582457 /*
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.
24652460 */
2466- spi -> cs_index_mask = 0x01 ;
2461+ spi -> cs_index_mask = BIT ( 0 ) ;
24672462
24682463 /* Device speed */
24692464 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,
25872582 ancillary -> max_speed_hz = spi -> max_speed_hz ;
25882583 ancillary -> mode = spi -> mode ;
25892584 /*
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.
25962587 */
2597- ancillary -> cs_index_mask = 0x01 ;
2588+ ancillary -> cs_index_mask = BIT ( 0 ) ;
25982589
25992590 WARN_ON (!mutex_is_locked (& ctlr -> add_lock ));
26002591
@@ -2841,14 +2832,10 @@ struct spi_device *acpi_spi_device_alloc(struct spi_controller *ctlr,
28412832 spi -> irq = lookup .irq ;
28422833 spi -> bits_per_word = lookup .bits_per_word ;
28432834 /*
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.
28502837 */
2851- spi -> cs_index_mask = 0x01 ;
2838+ spi -> cs_index_mask = BIT ( 0 ) ;
28522839
28532840 return spi ;
28542841}
0 commit comments