[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4f4d20b0-8de9-f1b6-c89d-659484b3cf0c@roeck-us.net>
Date: Tue, 2 Feb 2021 17:30:49 -0800
From: Guenter Roeck <linux@...ck-us.net>
To: Cristian Marussi <cristian.marussi@....com>,
linux-kernel@...r.kernel.org, linux-arm-kernel@...ts.infradead.org
Cc: sudeep.holla@....com, lukasz.luba@....com,
james.quinlan@...adcom.com, Jonathan.Cameron@...wei.com,
f.fainelli@...il.com, etienne.carriere@...aro.org,
thara.gopinath@...aro.org, vincent.guittot@...aro.org,
souvik.chakravarty@....com, Jean Delvare <jdelvare@...e.com>
Subject: Re: [PATCH v6 25/37] hwmon: (scmi) port driver to the new
scmi_sensor_proto_ops interface
On 2/2/21 2:15 PM, Cristian Marussi wrote:
> Port driver to the new SCMI Sensor interface based on protocol handles
> and common devm_get_ops().
>
> Cc: Guenter Roeck <linux@...ck-us.net>
> Cc: Jean Delvare <jdelvare@...e.com>
> Signed-off-by: Cristian Marussi <cristian.marussi@....com>
Assuming this will be handled with the series.
Acked-by: Guenter Roeck <linux@...ck-us.net>
> ---
> v4 --> v5
> - using renamed devm_get/put_protocol
> ---
> drivers/hwmon/scmi-hwmon.c | 24 +++++++++++++++---------
> 1 file changed, 15 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/hwmon/scmi-hwmon.c b/drivers/hwmon/scmi-hwmon.c
> index 17d064e58938..c5a260c6e3c6 100644
> --- a/drivers/hwmon/scmi-hwmon.c
> +++ b/drivers/hwmon/scmi-hwmon.c
> @@ -2,7 +2,7 @@
> /*
> * System Control and Management Interface(SCMI) based hwmon sensor driver
> *
> - * Copyright (C) 2018 ARM Ltd.
> + * Copyright (C) 2018-2020 ARM Ltd.
> * Sudeep Holla <sudeep.holla@....com>
> */
>
> @@ -13,8 +13,10 @@
> #include <linux/sysfs.h>
> #include <linux/thermal.h>
>
> +static const struct scmi_sensor_proto_ops *sensor_ops;
> +
> struct scmi_sensors {
> - const struct scmi_handle *handle;
> + const struct scmi_protocol_handle *ph;
> const struct scmi_sensor_info **info[hwmon_max];
> };
>
> @@ -69,10 +71,9 @@ static int scmi_hwmon_read(struct device *dev, enum hwmon_sensor_types type,
> u64 value;
> const struct scmi_sensor_info *sensor;
> struct scmi_sensors *scmi_sensors = dev_get_drvdata(dev);
> - const struct scmi_handle *h = scmi_sensors->handle;
>
> sensor = *(scmi_sensors->info[type] + channel);
> - ret = h->sensor_ops->reading_get(h, sensor->id, &value);
> + ret = sensor_ops->reading_get(scmi_sensors->ph, sensor->id, &value);
> if (ret)
> return ret;
>
> @@ -169,11 +170,16 @@ static int scmi_hwmon_probe(struct scmi_device *sdev)
> struct hwmon_channel_info *scmi_hwmon_chan;
> const struct hwmon_channel_info **ptr_scmi_ci;
> const struct scmi_handle *handle = sdev->handle;
> + struct scmi_protocol_handle *ph;
>
> - if (!handle || !handle->sensor_ops)
> + if (!handle)
> return -ENODEV;
>
> - nr_sensors = handle->sensor_ops->count_get(handle);
> + sensor_ops = handle->devm_get_protocol(sdev, SCMI_PROTOCOL_SENSOR, &ph);
> + if (IS_ERR(sensor_ops))
> + return PTR_ERR(sensor_ops);
> +
> + nr_sensors = sensor_ops->count_get(ph);
> if (!nr_sensors)
> return -EIO;
>
> @@ -181,10 +187,10 @@ static int scmi_hwmon_probe(struct scmi_device *sdev)
> if (!scmi_sensors)
> return -ENOMEM;
>
> - scmi_sensors->handle = handle;
> + scmi_sensors->ph = ph;
>
> for (i = 0; i < nr_sensors; i++) {
> - sensor = handle->sensor_ops->info_get(handle, i);
> + sensor = sensor_ops->info_get(ph, i);
> if (!sensor)
> return -EINVAL;
>
> @@ -236,7 +242,7 @@ static int scmi_hwmon_probe(struct scmi_device *sdev)
> }
>
> for (i = nr_sensors - 1; i >= 0 ; i--) {
> - sensor = handle->sensor_ops->info_get(handle, i);
> + sensor = sensor_ops->info_get(ph, i);
> if (!sensor)
> continue;
>
>
Powered by blists - more mailing lists