From: Jean Delvare <jdelvare@suse.de>
To: cgel.zte@gmail.com
Cc: linux@roeck-us.net, linux-hwmon@vger.kernel.org,
linux-kernel@vger.kernel.org,
Minghao Chi <chi.minghao@zte.com.cn>,
Zeal Robot <zealci@zte.com.cn>
Subject: Re: [PATCH] hwmon: (scpi-hwmon): Use of_device_get_match_data()
Date: Tue, 15 Mar 2022 17:18:52 +0100 [thread overview]
Message-ID: <20220315171852.3b2f1dc4@endymion.delvare> (raw)
In-Reply-To: <20220315023412.2118415-1-chi.minghao@zte.com.cn>
On Tue, 15 Mar 2022 02:34:12 +0000, cgel.zte@gmail.com wrote:
> From: Minghao Chi <chi.minghao@zte.com.cn>
>
> Use of_device_get_match_data() to simplify the code.
>
> Reported-by: Zeal Robot <zealci@zte.com.cn>
> Signed-off-by: Minghao Chi <chi.minghao@zte.com.cn>
> ---
> drivers/hwmon/scpi-hwmon.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/hwmon/scpi-hwmon.c b/drivers/hwmon/scpi-hwmon.c
> index 919877970ae3..5187c6dd5a4f 100644
> --- a/drivers/hwmon/scpi-hwmon.c
> +++ b/drivers/hwmon/scpi-hwmon.c
> @@ -141,7 +141,6 @@ static int scpi_hwmon_probe(struct platform_device *pdev)
> struct scpi_ops *scpi_ops;
> struct device *hwdev, *dev = &pdev->dev;
> struct scpi_sensors *scpi_sensors;
> - const struct of_device_id *of_id;
> int idx, ret;
>
> scpi_ops = get_scpi_ops();
> @@ -171,12 +170,11 @@ static int scpi_hwmon_probe(struct platform_device *pdev)
>
> scpi_sensors->scpi_ops = scpi_ops;
>
> - of_id = of_match_device(scpi_of_match, &pdev->dev);
> - if (!of_id) {
> + scale = of_device_get_match_data(&pdev->dev);
> + if (!scale) {
> dev_err(&pdev->dev, "Unable to initialize scpi-hwmon data\n");
> return -ENODEV;
> }
> - scale = of_id->data;
>
> for (i = 0, idx = 0; i < nr_sensors; i++) {
> struct sensor_data *sensor = &scpi_sensors->data[idx];
Reviewed-by: Jean Delvare <jdelvare@suse.de>
--
Jean Delvare
SUSE L3 Support
next prev parent reply other threads:[~2022-03-15 16:18 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-15 2:34 cgel.zte
2022-03-15 16:18 ` Jean Delvare [this message]
2022-03-15 23:31 ` Guenter Roeck
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220315171852.3b2f1dc4@endymion.delvare \
--to=jdelvare@suse.de \
--cc=cgel.zte@gmail.com \
--cc=chi.minghao@zte.com.cn \
--cc=linux-hwmon@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=zealci@zte.com.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®