linux-watchdog.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Luca Ceresoli <luca@lucaceresoli.net>
To: Lee Jones <lee.jones@linaro.org>
Cc: linux-kernel@vger.kernel.org, Rob Herring <robh+dt@kernel.org>,
	Alessandro Zummo <a.zummo@towertech.it>,
	Alexandre Belloni <alexandre.belloni@bootlin.com>,
	Chanwoo Choi <cw00.choi@samsung.com>,
	Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>,
	Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>,
	Wim Van Sebroeck <wim@linux-watchdog.org>,
	Guenter Roeck <linux@roeck-us.net>,
	devicetree@vger.kernel.org, linux-rtc@vger.kernel.org,
	linux-watchdog@vger.kernel.org,
	Chiwoong Byun <woong.byun@samsung.com>,
	Laxman Dewangan <ldewangan@nvidia.com>,
	Randy Dunlap <rdunlap@infradead.org>
Subject: Re: [PATCH v2 6/9] mfd: max77714: Add driver for Maxim MAX77714 PMIC
Date: Wed, 27 Oct 2021 16:23:57 +0200	[thread overview]
Message-ID: <d5674e8e-34c9-86ca-94cc-dca79ed82496@lucaceresoli.net> (raw)
In-Reply-To: <YXlXvovUsvOIPYyV@google.com>

Hi Lee,

On 27/10/21 15:44, Lee Jones wrote:
> On Wed, 27 Oct 2021, Luca Ceresoli wrote:
> 
>> Hi Lee,
>>
>> On 21/10/21 20:43, Lee Jones wrote:
>>> On Tue, 19 Oct 2021, Luca Ceresoli wrote:
>> [...]
>>>> diff --git a/drivers/mfd/max77714.c b/drivers/mfd/max77714.c
>>>> new file mode 100644
>>>> index 000000000000..4b49d16fe199
>>>> --- /dev/null
>>>> +++ b/drivers/mfd/max77714.c
>>>> @@ -0,0 +1,165 @@
>>>> +// SPDX-License-Identifier: GPL-2.0-only
>>>> +/*
>>>> + * Maxim MAX77714 MFD Driver
>>>> + *
>>>> + * Copyright (C) 2021 Luca Ceresoli
>>>> + * Author: Luca Ceresoli <luca@lucaceresoli.net>
>>>> + */
>>>> +
>>>> +#include <linux/i2c.h>
>>>> +#include <linux/interrupt.h>
>>>> +#include <linux/mfd/core.h>
>>>> +#include <linux/mfd/max77714.h>
>>>> +#include <linux/module.h>
>>>> +#include <linux/of.h>
>>>> +#include <linux/regmap.h>
>>>> +
>>>> +struct max77714 {
>>>> +	struct device *dev;
>>>> +	struct regmap *regmap;
>>>> +	struct regmap_irq_chip_data *irq_data;
>>>
>>> Is this used outside of .probe()?
>>
>> No.
> 
> Then you don't need to store it in a struct.
> 
> [...]
> 
>>>> +	/* Internal Crystal Load Capacitance, indexed by value of 32KLOAD bits */
>>>> +	static const unsigned int load_cap[4] = {0, 10, 12, 22};
>>>
>>> Probably best to define these magic numbers.
>>
>> Since these numbers do not appear anywhere else I don't find added value in:
>>
>>   #define MAX77714_LOAD_CAP_0   0
>>   #define MAX77714_LOAD_CAP_10  10
>>   #define MAX77714_LOAD_CAP_12  12
>>   #define MAX77714_LOAD_CAP_22  22
>>   [...]
>>   static const unsigned int load_cap[4] = {
>>       MAX77714_LOAD_CAP_0,
>>       MAX77714_LOAD_CAP_10,
>>       MAX77714_LOAD_CAP_12,
>>       MAX77714_LOAD_CAP_12,
>>   };
> 
> I don't find value in that nomenclature either! :)
> 
> I was suggesting that you used better, more forthcoming names.
> 
>  LOAD_CAPACITANCE_00_pF
>  LOAD_CAPACITANCE_10_pF
>  LOAD_CAPACITANCE_12_pF
>  LOAD_CAPACITANCE_22_pF
> 
>> besides adding lots of lines and lots of "MAX77714_LOAD_CAP_". Even
>> worse, there is potential for copy-paste errors -- can you spot it? ;)
> 
> Yes.  Straight away.
> 
>> Finally, consider this is not even global but local to a small function.
>>
>> But I'd rather add the unit ("pF") to either the comment line of the
>> array name (load_cap -> load_cap_pf) for clarity. Would that be OK for you?
> 
> I did have to read the code again to get a handle on things (probably
> not a good sign).  To keep things simple, just add "/* pF */" onto the
> end of the load_cap line for now.  That should clear things up at
> first glance.

Ok, let's see how it works. I'm sending v3 in the next few days.

-- 
Luca

  reply	other threads:[~2021-10-27 14:24 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-19 14:59 [PATCH v2 0/9] Add MAX77714 PMIC minimal driver (RTC and watchdog only) Luca Ceresoli
2021-10-19 14:59 ` [PATCH v2 1/9] mfd: max77686: Correct tab-based alignment of register addresses Luca Ceresoli
2021-10-21 15:53   ` Lee Jones
2021-10-19 14:59 ` [PATCH v2 2/9] rtc: max77686: convert comments to kernel-doc format Luca Ceresoli
2021-10-19 14:59 ` [PATCH v2 3/9] rtc: max77686: rename day-of-month defines Luca Ceresoli
2021-10-21  9:42   ` Alexandre Belloni
2021-10-19 14:59 ` [PATCH v2 4/9] rtc: max77686: remove unused code to read in 12-hour mode Luca Ceresoli
2021-10-21  9:43   ` Alexandre Belloni
2021-10-19 14:59 ` [PATCH v2 5/9] dt-bindings: mfd: add Maxim MAX77714 PMIC Luca Ceresoli
2021-10-27  3:17   ` Rob Herring
2021-10-29 15:50     ` Luca Ceresoli
2021-10-19 14:59 ` [PATCH v2 6/9] mfd: max77714: Add driver for " Luca Ceresoli
2021-10-20  7:00   ` Krzysztof Kozlowski
2021-10-21 18:43   ` Lee Jones
2021-10-27 10:32     ` Luca Ceresoli
2021-10-27 13:44       ` Lee Jones
2021-10-27 14:23         ` Luca Ceresoli [this message]
2021-10-19 14:59 ` [PATCH v2 7/9] watchdog: Kconfig: fix help text indentation Luca Ceresoli
2021-10-19 15:06   ` Guenter Roeck
2021-10-21 16:28     ` Luca Ceresoli
2021-10-19 14:59 ` [PATCH v2 8/9] watchdog: max77714: add driver for the watchdog in the MAX77714 PMIC Luca Ceresoli
2021-10-19 15:10   ` Guenter Roeck
2021-10-19 14:59 ` [PATCH v2 9/9] rtc: max77686: add MAX77714 support Luca Ceresoli

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=d5674e8e-34c9-86ca-94cc-dca79ed82496@lucaceresoli.net \
    --to=luca@lucaceresoli.net \
    --cc=a.zummo@towertech.it \
    --cc=alexandre.belloni@bootlin.com \
    --cc=b.zolnierkie@samsung.com \
    --cc=cw00.choi@samsung.com \
    --cc=devicetree@vger.kernel.org \
    --cc=krzysztof.kozlowski@canonical.com \
    --cc=ldewangan@nvidia.com \
    --cc=lee.jones@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rtc@vger.kernel.org \
    --cc=linux-watchdog@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=rdunlap@infradead.org \
    --cc=robh+dt@kernel.org \
    --cc=wim@linux-watchdog.org \
    --cc=woong.byun@samsung.com \
    /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;
as well as URLs for NNTP newsgroup(s).