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

ASoC: cs35l32: Use case range at appropriate places

Use case range syntax makes the code shorter with better readability when
we have a large number of continuous switch cases.

Below are the summary of readable/volatile/precious registers.

The readable registers:
0x01 ~ 0x0D, 0x0F ~ 0x1C
The volatile registers:
0x01 ~ 0x05, 0x15 ~ 0x18
The precious registers:
0x15 ~ 0x18

No functional change with this patch.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Brian Austin <brian.austin@cirrus.com>
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Axel Lin and committed by
Mark Brown
c1763308 d5a78c8e

+5 -40
+5 -40
sound/soc/codecs/cs35l32.c
··· 74 74 static bool cs35l32_readable_register(struct device *dev, unsigned int reg) 75 75 { 76 76 switch (reg) { 77 - case CS35L32_DEVID_AB: 78 - case CS35L32_DEVID_CD: 79 - case CS35L32_DEVID_E: 80 - case CS35L32_FAB_ID: 81 - case CS35L32_REV_ID: 82 - case CS35L32_PWRCTL1: 83 - case CS35L32_PWRCTL2: 84 - case CS35L32_CLK_CTL: 85 - case CS35L32_BATT_THRESHOLD: 86 - case CS35L32_VMON: 87 - case CS35L32_BST_CPCP_CTL: 88 - case CS35L32_IMON_SCALING: 89 - case CS35L32_AUDIO_LED_MNGR: 90 - case CS35L32_ADSP_CTL: 91 - case CS35L32_CLASSD_CTL: 92 - case CS35L32_PROTECT_CTL: 93 - case CS35L32_INT_MASK_1: 94 - case CS35L32_INT_MASK_2: 95 - case CS35L32_INT_MASK_3: 96 - case CS35L32_INT_STATUS_1: 97 - case CS35L32_INT_STATUS_2: 98 - case CS35L32_INT_STATUS_3: 99 - case CS35L32_LED_STATUS: 100 - case CS35L32_FLASH_MODE: 101 - case CS35L32_MOVIE_MODE: 102 - case CS35L32_FLASH_TIMER: 103 - case CS35L32_FLASH_INHIBIT: 77 + case CS35L32_DEVID_AB ... CS35L32_AUDIO_LED_MNGR: 78 + case CS35L32_ADSP_CTL ... CS35L32_FLASH_INHIBIT: 104 79 return true; 105 80 default: 106 81 return false; ··· 85 110 static bool cs35l32_volatile_register(struct device *dev, unsigned int reg) 86 111 { 87 112 switch (reg) { 88 - case CS35L32_DEVID_AB: 89 - case CS35L32_DEVID_CD: 90 - case CS35L32_DEVID_E: 91 - case CS35L32_FAB_ID: 92 - case CS35L32_REV_ID: 93 - case CS35L32_INT_STATUS_1: 94 - case CS35L32_INT_STATUS_2: 95 - case CS35L32_INT_STATUS_3: 96 - case CS35L32_LED_STATUS: 113 + case CS35L32_DEVID_AB ... CS35L32_REV_ID: 114 + case CS35L32_INT_STATUS_1 ... CS35L32_LED_STATUS: 97 115 return true; 98 116 default: 99 117 return false; ··· 96 128 static bool cs35l32_precious_register(struct device *dev, unsigned int reg) 97 129 { 98 130 switch (reg) { 99 - case CS35L32_INT_STATUS_1: 100 - case CS35L32_INT_STATUS_2: 101 - case CS35L32_INT_STATUS_3: 102 - case CS35L32_LED_STATUS: 131 + case CS35L32_INT_STATUS_1 ... CS35L32_LED_STATUS: 103 132 return true; 104 133 default: 105 134 return false;