hwmon: (ntc_thermistor) Fix OF device ID mapping

The mapping from OF device IDs to platform device IDs is wrong.
TYPE_NCPXXWB473 is 0, TYPE_NCPXXWL333 is 1, so
ntc_thermistor_id[TYPE_NCPXXWB473] is { "ncp15wb473", TYPE_NCPXXWB473 }
while
ntc_thermistor_id[TYPE_NCPXXWL333] is { "ncp18wb473", TYPE_NCPXXWB473 }.

So the name is wrong for all but the "ntc,ncp15wb473" entry, and the
type is wrong for the "ntc,ncp15wl333" entry.

So map the entries by index, it is neither elegant nor robust but at
least it is correct.

Signed-off-by: Jean Delvare <jdelvare@suse.de>
Fixes: 9e8269de hwmon: (ntc_thermistor) Add DT with IIO support to NTC thermistor driver
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Cc: Naveen Krishna Chatradhi <ch.naveen@samsung.com>
Cc: Doug Anderson <dianders@chromium.org>

+6 -5
+6 -5
drivers/hwmon/ntc_thermistor.c
··· 44 unsigned int ohm; 45 }; 46 47 static const struct platform_device_id ntc_thermistor_id[] = { 48 { "ncp15wb473", TYPE_NCPXXWB473 }, 49 { "ncp18wb473", TYPE_NCPXXWB473 }, ··· 164 165 static const struct of_device_id ntc_match[] = { 166 { .compatible = "ntc,ncp15wb473", 167 - .data = &ntc_thermistor_id[TYPE_NCPXXWB473] }, 168 { .compatible = "ntc,ncp18wb473", 169 - .data = &ntc_thermistor_id[TYPE_NCPXXWB473] }, 170 { .compatible = "ntc,ncp21wb473", 171 - .data = &ntc_thermistor_id[TYPE_NCPXXWB473] }, 172 { .compatible = "ntc,ncp03wb473", 173 - .data = &ntc_thermistor_id[TYPE_NCPXXWB473] }, 174 { .compatible = "ntc,ncp15wl333", 175 - .data = &ntc_thermistor_id[TYPE_NCPXXWL333] }, 176 { }, 177 }; 178 MODULE_DEVICE_TABLE(of, ntc_match);
··· 44 unsigned int ohm; 45 }; 46 47 + /* Order matters, ntc_match references the entries by index */ 48 static const struct platform_device_id ntc_thermistor_id[] = { 49 { "ncp15wb473", TYPE_NCPXXWB473 }, 50 { "ncp18wb473", TYPE_NCPXXWB473 }, ··· 163 164 static const struct of_device_id ntc_match[] = { 165 { .compatible = "ntc,ncp15wb473", 166 + .data = &ntc_thermistor_id[0] }, 167 { .compatible = "ntc,ncp18wb473", 168 + .data = &ntc_thermistor_id[1] }, 169 { .compatible = "ntc,ncp21wb473", 170 + .data = &ntc_thermistor_id[2] }, 171 { .compatible = "ntc,ncp03wb473", 172 + .data = &ntc_thermistor_id[3] }, 173 { .compatible = "ntc,ncp15wl333", 174 + .data = &ntc_thermistor_id[4] }, 175 { }, 176 }; 177 MODULE_DEVICE_TABLE(of, ntc_match);