All of lore.kernel.org
 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 12:32:32 +0200	[thread overview]
Message-ID: <3520ff3d-1ec0-5500-7fee-538afa25d413@lucaceresoli.net> (raw)
In-Reply-To: <YXG060evUw8rnR3O@google.com>

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.

>> +/*
>> + * MAX77714 initially uses the internal, low precision oscillator. Enable
>> + * the external oscillator by setting the XOSC_RETRY bit. If the external
>> + * oscillator is not OK (probably not installed) this has no effect.
>> + */
>> +static int max77714_setup_xosc(struct max77714 *chip)
> 
> May as well just pass 'dev' and 'regmap' to this function and do away
> with the superfluous struct along with all of it's memory management
> handling requirements.

Good idea!

>> +{
>> +	/* 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,
  };

besides adding lots of lines and lots of "MAX77714_LOAD_CAP_". Even
worse, there is potential for copy-paste errors -- can you spot it? ;)
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?

Apart from this coding style topic I'm OK with all the other
improvements you proposed to this patch, all of them will be in v3.

Thank you for the detailed review!
-- 
Luca

  reply	other threads:[~2021-10-27 10:32 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 [this message]
2021-10-27 13:44       ` Lee Jones
2021-10-27 14:23         ` Luca Ceresoli
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=3520ff3d-1ec0-5500-7fee-538afa25d413@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.