From patchwork Sun Dec 5 23:59:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 12657451 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0FA4EC433F5 for ; Mon, 6 Dec 2021 00:01:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233578AbhLFAFW (ORCPT ); Sun, 5 Dec 2021 19:05:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47192 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229567AbhLFAFW (ORCPT ); Sun, 5 Dec 2021 19:05:22 -0500 Received: from mail-lf1-x135.google.com (mail-lf1-x135.google.com [IPv6:2a00:1450:4864:20::135]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 19486C061751 for ; Sun, 5 Dec 2021 16:01:54 -0800 (PST) Received: by mail-lf1-x135.google.com with SMTP id b1so20990655lfs.13 for ; Sun, 05 Dec 2021 16:01:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=0+F3PJbLbQYGNAa8CDSqdzVHmcTZVX0tkllKEeXGns0=; b=Zy/kXk6Lb7J47/b6eV4YvUWjKVbCy//1er7eCwZgdnKoaK+x3+bIQNIY5nhI5l3iDU nPIQJazrZgiPNHS4dIDpSDtuRw2cQ5iYkj5BG7a5rr08UlC3EjeCE01+Jrakggu7S3jB SGwJcU8RBtxvajlxF8DDuRGoMCTKDNr/ju2mT93epFJd/uaq6ebaXU62Ogb/H/Ye8UYw ve8DH7yg/cs2z/obz0smke1QsjDvTI3petH0r+MNv6QwDwzLzI72CPykuldNJTxKTWa7 4/NUdp64FBUYiURC2Diz8OAbI+rXHbI9G7ceVVN+TuKRXgKwQp0/YoSf7iK97rPLRYiB 1q5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=0+F3PJbLbQYGNAa8CDSqdzVHmcTZVX0tkllKEeXGns0=; b=r8PYoG4WJDFN0V3ryqOItofGS3Tj6M4NonyQcOq7P1SLceZfTQDRjNB0NOQmd4TBBQ ZkqT9OCJxxi6f88qWt6J+wsAHn4CpzCdPfjHaHR4HE/OWeb7DPLftq7Xl28ynyi7FVs5 2VOM06q2m9t0cgwBHXeToSkoMtsB2neQrb7bm+HmUBrZm1jA025b0m1DGrjBBs5f1VOg sUlAjCBPWV1AFNbC2hyj/gLaXpQzhMP8/sxEQraQg43dfE57eG4h2T6xOwcIB5jM+sWn GwlKsWpA9TRPrge5I8P3X7NDJR/kRVpNdDSoCPbm9yVwrAGUJzm8oATdjdRDZqxgdccK aUtw== X-Gm-Message-State: AOAM5321eW96R/0znyLbZcc576DprnjOmaQSFXHmyWcWgsW2fnCkYmhw DdR8BTbwHBFeaONyFxYvwTInOO2e80w2hA== X-Google-Smtp-Source: ABdhPJxpyelwEek6KnJlzpzhUuref/j+nUHQaDN3T5a0XVmee7NE/RFowksbsm4n83SSNmxzsu2hqA== X-Received: by 2002:a05:6512:2249:: with SMTP id i9mr32813866lfu.62.1638748911747; Sun, 05 Dec 2021 16:01:51 -0800 (PST) Received: from localhost.localdomain (c-fdcc225c.014-348-6c756e10.bbcust.telenor.se. [92.34.204.253]) by smtp.gmail.com with ESMTPSA id m27sm1189021lfp.268.2021.12.05.16.01.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Dec 2021 16:01:50 -0800 (PST) From: Linus Walleij To: Jean Delvare , Guenter Roeck Cc: linux-hwmon@vger.kernel.org, Linus Walleij , Peter Rosin , Chris Lesiak Subject: [PATCH 1/3] hwmon: (ntc_thermistor): Inline OF data lookup in probe() Date: Mon, 6 Dec 2021 00:59:46 +0100 Message-Id: <20211205235948.4167075-1-linus.walleij@linaro.org> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org There is no need to allocate the state container and look up DT properties in a separate function if OF is all we support. Inline it into probe(). Cc: Peter Rosin Cc: Chris Lesiak Signed-off-by: Linus Walleij --- drivers/hwmon/ntc_thermistor.c | 76 ++++++++++++---------------------- 1 file changed, 27 insertions(+), 49 deletions(-) diff --git a/drivers/hwmon/ntc_thermistor.c b/drivers/hwmon/ntc_thermistor.c index ed638ebd0923..44abcb8a2393 100644 --- a/drivers/hwmon/ntc_thermistor.c +++ b/drivers/hwmon/ntc_thermistor.c @@ -403,49 +403,6 @@ static const struct of_device_id ntc_match[] = { }; MODULE_DEVICE_TABLE(of, ntc_match); -static struct ntc_data *ntc_thermistor_parse_dt(struct device *dev) -{ - struct ntc_data *data; - struct iio_channel *chan; - enum iio_chan_type type; - struct device_node *np = dev->of_node; - int ret; - - if (!np) - return NULL; - - data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); - if (!data) - return ERR_PTR(-ENOMEM); - - chan = devm_iio_channel_get(dev, NULL); - if (IS_ERR(chan)) - return ERR_CAST(chan); - - ret = iio_get_channel_type(chan, &type); - if (ret < 0) - return ERR_PTR(ret); - - if (type != IIO_VOLTAGE) - return ERR_PTR(-EINVAL); - - if (of_property_read_u32(np, "pullup-uv", &data->pullup_uv)) - return ERR_PTR(-ENODEV); - if (of_property_read_u32(np, "pullup-ohm", &data->pullup_ohm)) - return ERR_PTR(-ENODEV); - if (of_property_read_u32(np, "pulldown-ohm", &data->pulldown_ohm)) - return ERR_PTR(-ENODEV); - - if (of_find_property(np, "connected-positive", NULL)) - data->connect = NTC_CONNECTED_POSITIVE; - else /* status change should be possible if not always on. */ - data->connect = NTC_CONNECTED_GROUND; - - data->chan = chan; - - return data; -} - static inline u64 div64_u64_safe(u64 dividend, u64 divisor) { if (divisor == 0 && dividend == 0) @@ -641,20 +598,41 @@ static const struct hwmon_chip_info ntc_chip_info = { static int ntc_thermistor_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; + struct device_node *np = dev->of_node; const struct of_device_id *of_id = of_match_device(of_match_ptr(ntc_match), dev); const struct platform_device_id *pdev_id; struct device *hwmon_dev; struct ntc_data *data; + enum iio_chan_type type; + int ret; - data = ntc_thermistor_parse_dt(dev); - if (IS_ERR(data)) - return PTR_ERR(data); + data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + if (!data) + return -ENOMEM; + + data->chan = devm_iio_channel_get(dev, NULL); + if (IS_ERR(data->chan)) + return PTR_ERR(data->chan); + + ret = iio_get_channel_type(data->chan, &type); + if (ret < 0) + return ret; - if (!data) { - dev_err(dev, "No platform init data supplied.\n"); + if (type != IIO_VOLTAGE) + return -EINVAL; + + if (of_property_read_u32(np, "pullup-uv", &data->pullup_uv)) return -ENODEV; - } + if (of_property_read_u32(np, "pullup-ohm", &data->pullup_ohm)) + return -ENODEV; + if (of_property_read_u32(np, "pulldown-ohm", &data->pulldown_ohm)) + return -ENODEV; + + if (of_find_property(np, "connected-positive", NULL)) + data->connect = NTC_CONNECTED_POSITIVE; + else /* status change should be possible if not always on. */ + data->connect = NTC_CONNECTED_GROUND; if (data->pullup_uv == 0 || (data->pullup_ohm == 0 && data->connect == From patchwork Sun Dec 5 23:59:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 12657453 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 88DDBC433F5 for ; Mon, 6 Dec 2021 00:02:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241156AbhLFAF3 (ORCPT ); Sun, 5 Dec 2021 19:05:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47216 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229567AbhLFAF3 (ORCPT ); Sun, 5 Dec 2021 19:05:29 -0500 Received: from mail-lj1-x236.google.com (mail-lj1-x236.google.com [IPv6:2a00:1450:4864:20::236]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 74DDDC061751 for ; Sun, 5 Dec 2021 16:02:01 -0800 (PST) Received: by mail-lj1-x236.google.com with SMTP id 207so17621291ljf.10 for ; Sun, 05 Dec 2021 16:02:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=OjoUMudfcTdB7sU0Mur7xaxZwOZAE1cho5LNq1WnRZQ=; b=aliR30jGSGJsBUKcYixK8SSW1qy4X5kowewLPh1Eze25MQR+ZeMXAsH3/Vku/Rrr6W p4ZLyixKEQfaa75Br7jBWwVEadYuv+Q3J6BAj05dNsRIma4YnuNRq9z7nTp9/1vKUtxn /GH8/LVF6BJVRoh8DjEifZdTeT7qx32rQeEhRcwEcXzztFstKgYz/MyQ3KOVxLPO0hX4 yJgxJtal2YV7zYuJ03OqDVdGWNYTLbLkMxsqqCpdSQK3p0eis7+kpdvvIOeMaUr118Nt 96eg/YaEO+7JywbV2eD5NF5AbgcdewiW8mXFadzrphIPPvL3UVzCOBQn6w3/jBDI9SVp h04g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=OjoUMudfcTdB7sU0Mur7xaxZwOZAE1cho5LNq1WnRZQ=; b=Dm51EcVn7m+B4SgcI5FD0HWVcsOWgpYPvfzf7UzY//i/GThSa10BxtdGEaANPsuhnn 1LTn/xG0Aj3Nyc+qNqId723YmsghBi/9pF0J4UCrq8if8e7AUtqJb7eG07FJjFd4m5SD xGnPiA4B0+Uq6idTHKhpnjhzOrP4V8ps2KpewfxqgriBVd+s3jAoiuo5IVpdKgzUJQ7K Qhi7u40gxsxfTBuVW3uDDsv5XceZ8wxunQB+FL3qLp4w8+RsiJJU9PhWRJ4nqTaaRCPK 8vtX6GPtbSGgpH82XQ7FpRP+mnu5ME8OEpEIUUmleoJSAT6Ki99uQGnsVEIsIFCHUW3D SzFQ== X-Gm-Message-State: AOAM531nhyLStSavkYTnADLlG2jNXHWcxWkapLlQP2TrH+kXB657EP4x fdI2j8+0XNRhOiyQii2wVT9ZGQ== X-Google-Smtp-Source: ABdhPJwASwj47+PMJJPJMoEfr/bgWHgdjYspY+2gvED+rWJMXUfWeasOahHIvRbn1bOwkFhWidY96Q== X-Received: by 2002:a2e:81da:: with SMTP id s26mr33374976ljg.63.1638748919741; Sun, 05 Dec 2021 16:01:59 -0800 (PST) Received: from localhost.localdomain (c-fdcc225c.014-348-6c756e10.bbcust.telenor.se. [92.34.204.253]) by smtp.gmail.com with ESMTPSA id m27sm1189021lfp.268.2021.12.05.16.01.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Dec 2021 16:01:58 -0800 (PST) From: Linus Walleij To: Jean Delvare , Guenter Roeck Cc: linux-hwmon@vger.kernel.org, Linus Walleij , Peter Rosin , Chris Lesiak Subject: [PATCH 2/3] hwmon: (ntc_thermistor): Switch to generic firmware props Date: Mon, 6 Dec 2021 00:59:47 +0100 Message-Id: <20211205235948.4167075-2-linus.walleij@linaro.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211205235948.4167075-1-linus.walleij@linaro.org> References: <20211205235948.4167075-1-linus.walleij@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org This switches to retrieveing the configuration of the NTC from generic firmware properties so that we get neutral from device tree: now ACPI or, more importantly, software nodes can be used to spawn NTC devices provided they have the required properties. This was inspired by the similar changes made to the IIO drivers. This was tested on the Ux500 HREF with the NTC devices probing from device tree just as fine after this as before. Cc: Peter Rosin Cc: Chris Lesiak Signed-off-by: Linus Walleij --- drivers/hwmon/ntc_thermistor.c | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/drivers/hwmon/ntc_thermistor.c b/drivers/hwmon/ntc_thermistor.c index 44abcb8a2393..246e109db462 100644 --- a/drivers/hwmon/ntc_thermistor.c +++ b/drivers/hwmon/ntc_thermistor.c @@ -9,10 +9,10 @@ #include #include #include +#include #include +#include #include -#include -#include #include #include #include @@ -598,9 +598,6 @@ static const struct hwmon_chip_info ntc_chip_info = { static int ntc_thermistor_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; - struct device_node *np = dev->of_node; - const struct of_device_id *of_id = - of_match_device(of_match_ptr(ntc_match), dev); const struct platform_device_id *pdev_id; struct device *hwmon_dev; struct ntc_data *data; @@ -622,14 +619,19 @@ static int ntc_thermistor_probe(struct platform_device *pdev) if (type != IIO_VOLTAGE) return -EINVAL; - if (of_property_read_u32(np, "pullup-uv", &data->pullup_uv)) - return -ENODEV; - if (of_property_read_u32(np, "pullup-ohm", &data->pullup_ohm)) - return -ENODEV; - if (of_property_read_u32(np, "pulldown-ohm", &data->pulldown_ohm)) - return -ENODEV; + ret = device_property_read_u32(dev, "pullup-uv", &data->pullup_uv); + if (ret) + return dev_err_probe(dev, ret, "pullup-uv not specified\n"); - if (of_find_property(np, "connected-positive", NULL)) + ret = device_property_read_u32(dev, "pullup-ohm", &data->pullup_ohm); + if (ret) + return dev_err_probe(dev, ret, "pullup-ohm not specified\n"); + + ret = device_property_read_u32(dev, "pulldown-ohm", &data->pulldown_ohm); + if (ret) + return dev_err_probe(dev, ret, "pulldown-ohm not specified\n"); + + if (device_property_read_bool(dev, "connected-positive")) data->connect = NTC_CONNECTED_POSITIVE; else /* status change should be possible if not always on. */ data->connect = NTC_CONNECTED_GROUND; @@ -645,8 +647,7 @@ static int ntc_thermistor_probe(struct platform_device *pdev) return -EINVAL; } - pdev_id = of_id ? of_id->data : platform_get_device_id(pdev); - + pdev_id = device_get_match_data(dev); if (pdev_id->driver_data >= ARRAY_SIZE(ntc_type)) { dev_err(dev, "Unknown device type: %lu(%s)\n", pdev_id->driver_data, pdev_id->name); @@ -673,7 +674,7 @@ static int ntc_thermistor_probe(struct platform_device *pdev) static struct platform_driver ntc_thermistor_driver = { .driver = { .name = "ntc-thermistor", - .of_match_table = of_match_ptr(ntc_match), + .of_match_table = ntc_match, }, .probe = ntc_thermistor_probe, .id_table = ntc_thermistor_id, From patchwork Sun Dec 5 23:59:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 12657455 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F3413C433EF for ; Mon, 6 Dec 2021 00:02:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241158AbhLFAFc (ORCPT ); Sun, 5 Dec 2021 19:05:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47224 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229567AbhLFAFb (ORCPT ); Sun, 5 Dec 2021 19:05:31 -0500 Received: from mail-lf1-x135.google.com (mail-lf1-x135.google.com [IPv6:2a00:1450:4864:20::135]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8E2BFC061751 for ; Sun, 5 Dec 2021 16:02:03 -0800 (PST) Received: by mail-lf1-x135.google.com with SMTP id k37so21115739lfv.3 for ; Sun, 05 Dec 2021 16:02:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Iwh1a9nJSEL2Y6XpXGdfJZLbmIt/5VxoaNngz+jDeB0=; b=tPsnxpfoOvsvIjN4IkxvZ56BUhCZD1CFWboeQgOECXgGnmFuiB+5GsJY7Qa4ksw2MC /TjpNv/ahcAY7kpCgvPBUrSZHm0g7QEbORYYCpaLZxdONhzuVlG7i4btQPSjq9nX/Bc3 RbvrdWymwIXKHRVPALAoHcfkg7qldjrAB6+t7ldA+YMJKQU2I7wBgqocPNSkk4cnLld0 Vi4m2zKK72XgQFhvvSH/QrivlaYrL036x9oFUSiisxWkCEWp4LhFxuUwbK0sfrulx/wB DEzmWlc+7fsWadsw2Ez27+RlYTQUwPvRwKtCgQlEa6lm/Vk9DJ0H0ISdeKU/uruVFJDb P+4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Iwh1a9nJSEL2Y6XpXGdfJZLbmIt/5VxoaNngz+jDeB0=; b=Y7mS41P64rftel2/4Fcxs34kESMoU0OxkOOfXqtDY5McJwOs/97JmheLFnQAa7NqDI N23GUfQQ0daf1YXT9LlWAysuknh6F9Lcl2aiSLyiSqsgaUyrOzDEfLll+pUN3LogqZjA liHfgB76xtAKtCOjY+771SGtdPgV5oMHLH/wcePgrz/FLVvNaa9XonAjT0FGfb9pvpNa ZFkLxYwLDvOSAxanBoSElLJvv9eZ6S3hNB/xwl31nXMz466FC507hrzY1Q0WkRoY1PxT deUrgivwXCwDmh6+6mRsYV4gB8i6prspV/AUdxHCjD5bqNtERxlhCy5cmQtNlCBvK0W/ z89g== X-Gm-Message-State: AOAM530tV3SyNJm/IszDDU67RbxV1FcBckhaGDAEmCvd+Ax+V+srZ+vA qZzWOv/mlY/ivTYCXJDtLnsjcw== X-Google-Smtp-Source: ABdhPJwJWlAuhHd5u7tJ+Z1dOcssQKU+6jljdU1cR4DnUQfH1TE82TuE2z40YTORk2yUs/Is7E43/w== X-Received: by 2002:ac2:5499:: with SMTP id t25mr32098421lfk.674.1638748921859; Sun, 05 Dec 2021 16:02:01 -0800 (PST) Received: from localhost.localdomain (c-fdcc225c.014-348-6c756e10.bbcust.telenor.se. [92.34.204.253]) by smtp.gmail.com with ESMTPSA id m27sm1189021lfp.268.2021.12.05.16.02.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Dec 2021 16:02:00 -0800 (PST) From: Linus Walleij To: Jean Delvare , Guenter Roeck Cc: linux-hwmon@vger.kernel.org, Linus Walleij , Peter Rosin , Chris Lesiak Subject: [PATCH 3/3] hwmon: (ntc_thermistor): Move DT matches to the driver block Date: Mon, 6 Dec 2021 00:59:48 +0100 Message-Id: <20211205235948.4167075-3-linus.walleij@linaro.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211205235948.4167075-1-linus.walleij@linaro.org> References: <20211205235948.4167075-1-linus.walleij@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org This moves the device tree match data toward the end of the driver which is the convention, here we can also add ACPI and similar match data in a conforming manner. Cc: Peter Rosin Cc: Chris Lesiak Signed-off-by: Linus Walleij --- drivers/hwmon/ntc_thermistor.c | 70 +++++++++++++++++----------------- 1 file changed, 35 insertions(+), 35 deletions(-) diff --git a/drivers/hwmon/ntc_thermistor.c b/drivers/hwmon/ntc_thermistor.c index 246e109db462..a3588ec12ca5 100644 --- a/drivers/hwmon/ntc_thermistor.c +++ b/drivers/hwmon/ntc_thermistor.c @@ -368,41 +368,6 @@ static int ntc_adc_iio_read(struct ntc_data *data) return uv; } -static const struct of_device_id ntc_match[] = { - { .compatible = "epcos,b57330v2103", - .data = &ntc_thermistor_id[NTC_B57330V2103]}, - { .compatible = "epcos,b57891s0103", - .data = &ntc_thermistor_id[NTC_B57891S0103] }, - { .compatible = "murata,ncp03wb473", - .data = &ntc_thermistor_id[NTC_NCP03WB473] }, - { .compatible = "murata,ncp03wf104", - .data = &ntc_thermistor_id[NTC_NCP03WF104] }, - { .compatible = "murata,ncp15wb473", - .data = &ntc_thermistor_id[NTC_NCP15WB473] }, - { .compatible = "murata,ncp15wl333", - .data = &ntc_thermistor_id[NTC_NCP15WL333] }, - { .compatible = "murata,ncp15xh103", - .data = &ntc_thermistor_id[NTC_NCP15XH103] }, - { .compatible = "murata,ncp18wb473", - .data = &ntc_thermistor_id[NTC_NCP18WB473] }, - { .compatible = "murata,ncp21wb473", - .data = &ntc_thermistor_id[NTC_NCP21WB473] }, - - /* Usage of vendor name "ntc" is deprecated */ - { .compatible = "ntc,ncp03wb473", - .data = &ntc_thermistor_id[NTC_NCP03WB473] }, - { .compatible = "ntc,ncp15wb473", - .data = &ntc_thermistor_id[NTC_NCP15WB473] }, - { .compatible = "ntc,ncp15wl333", - .data = &ntc_thermistor_id[NTC_NCP15WL333] }, - { .compatible = "ntc,ncp18wb473", - .data = &ntc_thermistor_id[NTC_NCP18WB473] }, - { .compatible = "ntc,ncp21wb473", - .data = &ntc_thermistor_id[NTC_NCP21WB473] }, - { }, -}; -MODULE_DEVICE_TABLE(of, ntc_match); - static inline u64 div64_u64_safe(u64 dividend, u64 divisor) { if (divisor == 0 && dividend == 0) @@ -671,6 +636,41 @@ static int ntc_thermistor_probe(struct platform_device *pdev) return 0; } +static const struct of_device_id ntc_match[] = { + { .compatible = "epcos,b57330v2103", + .data = &ntc_thermistor_id[NTC_B57330V2103]}, + { .compatible = "epcos,b57891s0103", + .data = &ntc_thermistor_id[NTC_B57891S0103] }, + { .compatible = "murata,ncp03wb473", + .data = &ntc_thermistor_id[NTC_NCP03WB473] }, + { .compatible = "murata,ncp03wf104", + .data = &ntc_thermistor_id[NTC_NCP03WF104] }, + { .compatible = "murata,ncp15wb473", + .data = &ntc_thermistor_id[NTC_NCP15WB473] }, + { .compatible = "murata,ncp15wl333", + .data = &ntc_thermistor_id[NTC_NCP15WL333] }, + { .compatible = "murata,ncp15xh103", + .data = &ntc_thermistor_id[NTC_NCP15XH103] }, + { .compatible = "murata,ncp18wb473", + .data = &ntc_thermistor_id[NTC_NCP18WB473] }, + { .compatible = "murata,ncp21wb473", + .data = &ntc_thermistor_id[NTC_NCP21WB473] }, + + /* Usage of vendor name "ntc" is deprecated */ + { .compatible = "ntc,ncp03wb473", + .data = &ntc_thermistor_id[NTC_NCP03WB473] }, + { .compatible = "ntc,ncp15wb473", + .data = &ntc_thermistor_id[NTC_NCP15WB473] }, + { .compatible = "ntc,ncp15wl333", + .data = &ntc_thermistor_id[NTC_NCP15WL333] }, + { .compatible = "ntc,ncp18wb473", + .data = &ntc_thermistor_id[NTC_NCP18WB473] }, + { .compatible = "ntc,ncp21wb473", + .data = &ntc_thermistor_id[NTC_NCP21WB473] }, + { }, +}; +MODULE_DEVICE_TABLE(of, ntc_match); + static struct platform_driver ntc_thermistor_driver = { .driver = { .name = "ntc-thermistor",