[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f224391a-2e51-ec37-7045-4a16f04b5384@linux.intel.com>
Date: Mon, 5 Oct 2020 16:50:50 +0800
From: "Tanwar, Rahul" <rahul.tanwar@...ux.intel.com>
To: Andy Shevchenko <andriy.shevchenko@...el.com>
Cc: jdelvare@...e.com, linux@...ck-us.net, p.zabel@...gutronix.de,
linux-hwmon@...r.kernel.org, robh+dt@...nel.org,
linux-kernel@...r.kernel.org, devicetree@...r.kernel.org,
songjun.Wu@...el.com, cheol.yong.kim@...el.com,
qi-ming.wu@...el.com, rtanwar@...linear.com
Subject: Re: [PATCH v4 2/2] Add hardware monitoring driver for Moortec MR75203
PVT controller
Hi Andy
On 3/10/2020 2:11 am, Andy Shevchenko wrote:
> On Fri, Oct 02, 2020 at 03:04:27PM +0800, Rahul Tanwar wrote:
>> PVT controller (MR75203) is used to configure & control
>> Moortec embedded analog IP which contains temprature
>> sensor(TS), voltage monitor(VM) & process detector(PD)
>> modules. Add hardware monitoring driver to support
>> MR75203 PVT controller.
> Some nit-picks below.
> Reviewed-by: Andy Shevchenko <andriy.shevchenko@...el.com>
>
>> Signed-off-by: Rahul Tanwar <rahul.tanwar@...ux.intel.com>
>> ---
>> drivers/hwmon/Kconfig | 10 +
>> drivers/hwmon/Makefile | 1 +
>> drivers/hwmon/mr75203.c | 651 ++++++++++++++++++++++++++++++++++++++++++++++++
>> 3 files changed, 662 insertions(+)
>> create mode 100644 drivers/hwmon/mr75203.c
[...]
>> + pvt_temp.config = temp_config;
>> +
>> + pvt_info[index++] = &pvt_temp;
>> + }
>> +
>> + if (pd_num) {
>> + ret = pvt_get_regmap(pdev, "pd", pvt);
>> + if (ret)
>> + return ret;
>> + }
>> +
>> + if (vm_num) {
>> + u32 num = vm_num;
>> +
>> + ret = pvt_get_regmap(pdev, "vm", pvt);
>> + if (ret)
>> + return ret;
>> +
>> + pvt->vm_idx = devm_kcalloc(dev, vm_num, sizeof(*pvt->vm_idx),
>> + GFP_KERNEL);
>> + if (!pvt->vm_idx)
>> + return -ENOMEM;
>> + for (i = 0; i < vm_num; i++)
>> + pvt->vm_idx[i] = i;
> What the point if you are replace them below in one case?
>
>> + ret = device_property_read_u8_array(dev, "intel,vm-map",
>> + pvt->vm_idx, vm_num);
>> + if (!ret)
> Misses {} and because of above
>
> if (ret) {
> for () ...
> } else {
> for () ...
> }
>
>> + for (i = 0; i < vm_num; i++)
>> + if (pvt->vm_idx[i] >= vm_num ||
>> + pvt->vm_idx[i] == 0xff) {
>> + num = i;
>> + break;
>> + }
> Or looking in this, perhaps move the incremental for-loop here and start it
> with num which is 0.
Not able to understand what exactly you are suggesting here. Presently
it is like below:
1. Init vm_idx array with incremental values.
2. Read array from device property.
3. If success, figure out the last valid value and assign to num.
Can you please elaborate and explain more clearly? Thanks.
Regards,
Rahul
Powered by blists - more mailing lists