]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/3.14.7/hwmon-ntc_thermistor-fix-of-device-id-mapping.patch
4.9-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 3.14.7 / hwmon-ntc_thermistor-fix-of-device-id-mapping.patch
1 From ead82d6792ef5c600d535bca6ec50a4da14ff7c7 Mon Sep 17 00:00:00 2001
2 From: Jean Delvare <jdelvare@suse.de>
3 Date: Sun, 25 May 2014 17:23:08 +0200
4 Subject: hwmon: (ntc_thermistor) Fix OF device ID mapping
5
6 From: Jean Delvare <jdelvare@suse.de>
7
8 commit ead82d6792ef5c600d535bca6ec50a4da14ff7c7 upstream.
9
10 The mapping from OF device IDs to platform device IDs is wrong.
11 TYPE_NCPXXWB473 is 0, TYPE_NCPXXWL333 is 1, so
12 ntc_thermistor_id[TYPE_NCPXXWB473] is { "ncp15wb473", TYPE_NCPXXWB473 }
13 while
14 ntc_thermistor_id[TYPE_NCPXXWL333] is { "ncp18wb473", TYPE_NCPXXWB473 }.
15
16 So the name is wrong for all but the "ntc,ncp15wb473" entry, and the
17 type is wrong for the "ntc,ncp15wl333" entry.
18
19 So map the entries by index, it is neither elegant nor robust but at
20 least it is correct.
21
22 Signed-off-by: Jean Delvare <jdelvare@suse.de>
23 Fixes: 9e8269de hwmon: (ntc_thermistor) Add DT with IIO support to NTC thermistor driver
24 Reviewed-by: Guenter Roeck <linux@roeck-us.net>
25 Cc: Naveen Krishna Chatradhi <ch.naveen@samsung.com>
26 Cc: Doug Anderson <dianders@chromium.org>
27 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
28
29 ---
30 drivers/hwmon/ntc_thermistor.c | 11 ++++++-----
31 1 file changed, 6 insertions(+), 5 deletions(-)
32
33 --- a/drivers/hwmon/ntc_thermistor.c
34 +++ b/drivers/hwmon/ntc_thermistor.c
35 @@ -44,6 +44,7 @@ struct ntc_compensation {
36 unsigned int ohm;
37 };
38
39 +/* Order matters, ntc_match references the entries by index */
40 static const struct platform_device_id ntc_thermistor_id[] = {
41 { "ncp15wb473", TYPE_NCPXXWB473 },
42 { "ncp18wb473", TYPE_NCPXXWB473 },
43 @@ -163,15 +164,15 @@ static int ntc_adc_iio_read(struct ntc_t
44
45 static const struct of_device_id ntc_match[] = {
46 { .compatible = "ntc,ncp15wb473",
47 - .data = &ntc_thermistor_id[TYPE_NCPXXWB473] },
48 + .data = &ntc_thermistor_id[0] },
49 { .compatible = "ntc,ncp18wb473",
50 - .data = &ntc_thermistor_id[TYPE_NCPXXWB473] },
51 + .data = &ntc_thermistor_id[1] },
52 { .compatible = "ntc,ncp21wb473",
53 - .data = &ntc_thermistor_id[TYPE_NCPXXWB473] },
54 + .data = &ntc_thermistor_id[2] },
55 { .compatible = "ntc,ncp03wb473",
56 - .data = &ntc_thermistor_id[TYPE_NCPXXWB473] },
57 + .data = &ntc_thermistor_id[3] },
58 { .compatible = "ntc,ncp15wl333",
59 - .data = &ntc_thermistor_id[TYPE_NCPXXWL333] },
60 + .data = &ntc_thermistor_id[4] },
61 { },
62 };
63 MODULE_DEVICE_TABLE(of, ntc_match);