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

mfd: arizona: Split of_match table into I2C and SPI versions

The Arizona driver has both some devices which only have an I2C
interface and some which only have a SPI interface. Currently both of
these share an of_match table, but this means inapproriate compatibles
are available for each interface. Tidy this up by creating a table for
each interface listing only the appropriate compatibles.

Reported-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20210928163035.23960-1-ckeepax@opensource.cirrus.com

authored by

Charles Keepax and committed by
Lee Jones
3f65555c 239f2bb1

+25 -17
-13
drivers/mfd/arizona-core.c
··· 845 845 846 846 return 0; 847 847 } 848 - 849 - const struct of_device_id arizona_of_match[] = { 850 - { .compatible = "wlf,wm5102", .data = (void *)WM5102 }, 851 - { .compatible = "wlf,wm5110", .data = (void *)WM5110 }, 852 - { .compatible = "wlf,wm8280", .data = (void *)WM8280 }, 853 - { .compatible = "wlf,wm8997", .data = (void *)WM8997 }, 854 - { .compatible = "wlf,wm8998", .data = (void *)WM8998 }, 855 - { .compatible = "wlf,wm1814", .data = (void *)WM1814 }, 856 - { .compatible = "wlf,wm1831", .data = (void *)WM1831 }, 857 - { .compatible = "cirrus,cs47l24", .data = (void *)CS47L24 }, 858 - {}, 859 - }; 860 - EXPORT_SYMBOL_GPL(arizona_of_match); 861 848 #else 862 849 static inline int arizona_of_get_core_pdata(struct arizona *arizona) 863 850 {
+13 -1
drivers/mfd/arizona-i2c.c
··· 104 104 }; 105 105 MODULE_DEVICE_TABLE(i2c, arizona_i2c_id); 106 106 107 + #ifdef CONFIG_OF 108 + const struct of_device_id arizona_i2c_of_match[] = { 109 + { .compatible = "wlf,wm5102", .data = (void *)WM5102 }, 110 + { .compatible = "wlf,wm5110", .data = (void *)WM5110 }, 111 + { .compatible = "wlf,wm8280", .data = (void *)WM8280 }, 112 + { .compatible = "wlf,wm8997", .data = (void *)WM8997 }, 113 + { .compatible = "wlf,wm8998", .data = (void *)WM8998 }, 114 + { .compatible = "wlf,wm1814", .data = (void *)WM1814 }, 115 + {}, 116 + }; 117 + #endif 118 + 107 119 static struct i2c_driver arizona_i2c_driver = { 108 120 .driver = { 109 121 .name = "arizona", 110 122 .pm = &arizona_pm_ops, 111 - .of_match_table = of_match_ptr(arizona_of_match), 123 + .of_match_table = of_match_ptr(arizona_i2c_of_match), 112 124 }, 113 125 .probe = arizona_i2c_probe, 114 126 .remove = arizona_i2c_remove,
+12 -1
drivers/mfd/arizona-spi.c
··· 225 225 }; 226 226 MODULE_DEVICE_TABLE(spi, arizona_spi_ids); 227 227 228 + #ifdef CONFIG_OF 229 + const struct of_device_id arizona_spi_of_match[] = { 230 + { .compatible = "wlf,wm5102", .data = (void *)WM5102 }, 231 + { .compatible = "wlf,wm5110", .data = (void *)WM5110 }, 232 + { .compatible = "wlf,wm8280", .data = (void *)WM8280 }, 233 + { .compatible = "wlf,wm1831", .data = (void *)WM1831 }, 234 + { .compatible = "cirrus,cs47l24", .data = (void *)CS47L24 }, 235 + {}, 236 + }; 237 + #endif 238 + 228 239 static struct spi_driver arizona_spi_driver = { 229 240 .driver = { 230 241 .name = "arizona", 231 242 .pm = &arizona_pm_ops, 232 - .of_match_table = of_match_ptr(arizona_of_match), 243 + .of_match_table = of_match_ptr(arizona_spi_of_match), 233 244 .acpi_match_table = ACPI_PTR(arizona_acpi_match), 234 245 }, 235 246 .probe = arizona_spi_probe,
-2
drivers/mfd/arizona.h
··· 28 28 29 29 extern const struct dev_pm_ops arizona_pm_ops; 30 30 31 - extern const struct of_device_id arizona_of_match[]; 32 - 33 31 extern const struct regmap_irq_chip wm5102_aod; 34 32 extern const struct regmap_irq_chip wm5102_irq; 35 33