From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Tali Perry <tali.perry1@gmail.com>
Cc: ofery@google.com, brendanhiggins@google.com,
avifishman70@gmail.com, tmaimon77@gmail.com, kfting@nuvoton.com,
venture@google.com, yuenn@google.com, benjaminfair@google.com,
robh+dt@kernel.org, wsa@the-dreams.de,
linux-arm-kernel@lists.infradead.org, linux-i2c@vger.kernel.org,
openbmc@lists.ozlabs.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v13 2/3] i2c: npcm7xx: Add Nuvoton NPCM I2C controller driver
Date: Fri, 22 May 2020 15:27:17 +0300 [thread overview]
Message-ID: <20200522122717.GB1634618@smile.fi.intel.com> (raw)
In-Reply-To: <20200522113312.181413-3-tali.perry1@gmail.com>
On Fri, May 22, 2020 at 02:33:11PM +0300, Tali Perry wrote:
> Add Nuvoton NPCM BMC I2C controller driver.
I thought we are waiting for Wolfram finishing his review...
In any case see couple of comments below.
...
> +#ifdef CONFIG_DEBUG_FS
Now, do we need the rest of DEBUG_FS guards?
> + if (status) {
> + if (bus->rec_fail_cnt == ULLONG_MAX) {
> + dev_dbg(bus->dev, "rec_fail_cnt reach max, reset to 0");
> + bus->rec_fail_cnt = 0;
It's redundant, since we will anyway roll over when incrementing.
https://stackoverflow.com/q/18195715/2511795
> + }
> + bus->rec_fail_cnt++;
> + } else {
> + if (bus->rec_succ_cnt == ULLONG_MAX) {
> + dev_dbg(bus->dev, "rec_succ_cnt reach max, reset to 0");
> + bus->rec_succ_cnt = 0;
Ditto.
> + }
> + bus->rec_succ_cnt++;
> + }
> +#endif
...
> +static int npcm_i2c_remove_bus(struct platform_device *pdev)
> +{
> + unsigned long lock_flags;
> + struct npcm_i2c *bus = platform_get_drvdata(pdev);
> +
> + spin_lock_irqsave(&bus->lock, lock_flags);
> + npcm_i2c_disable(bus);
> + spin_unlock_irqrestore(&bus->lock, lock_flags);
> + i2c_del_adapter(&bus->adap);
> + debugfs_remove_recursive(bus->debugfs);
This should be in reversed order, i.e. you inited last in ->probe(), thus
should remove first in ->remove().
> + return 0;
> +}
...
> +static int __init npcm_i2c_init(void)
> +{
> + struct dentry *dir;
> +
> + dir = debugfs_create_dir("i2c", NULL);
> + if (IS_ERR_OR_NULL(dir))
IS_ERR() is redundant. And NULL already being checked inside i2c_init_debugfs()
or how do you call it?
> + return 0;
> +
> + npcm_i2c_debugfs_dir = dir;
> + return 0;
> +}
> +
> +static void __exit npcm_i2c_exit(void)
> +{
> + debugfs_remove_recursive(npcm_i2c_debugfs_dir);
> +}
> +
> +module_init(npcm_i2c_init);
> +module_exit(npcm_i2c_exit);
Slightly better to attach to the respective function, like other macros above
do.
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2020-05-22 12:27 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-22 11:33 [PATCH v13 0/3] i2c: npcm7xx: add NPCM i2c " Tali Perry
2020-05-22 11:33 ` [PATCH v13 1/3] dt-bindings: i2c: npcm7xx: add NPCM I2C controller Tali Perry
2020-05-22 22:42 ` Rob Herring
2020-05-22 22:47 ` Rob Herring
2020-05-24 8:35 ` Tali Perry
2020-05-22 11:33 ` [PATCH v13 2/3] i2c: npcm7xx: Add Nuvoton NPCM I2C controller driver Tali Perry
2020-05-22 12:27 ` Andy Shevchenko [this message]
2020-05-24 12:20 ` kbuild test robot
2020-05-22 11:33 ` [PATCH v13 3/3] i2c: npcm7xx: Add support for slave mode for Nuvoton Tali Perry
2020-05-22 12:32 ` Andy Shevchenko
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=20200522122717.GB1634618@smile.fi.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=avifishman70@gmail.com \
--cc=benjaminfair@google.com \
--cc=brendanhiggins@google.com \
--cc=devicetree@vger.kernel.org \
--cc=kfting@nuvoton.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ofery@google.com \
--cc=openbmc@lists.ozlabs.org \
--cc=robh+dt@kernel.org \
--cc=tali.perry1@gmail.com \
--cc=tmaimon77@gmail.com \
--cc=venture@google.com \
--cc=wsa@the-dreams.de \
--cc=yuenn@google.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
all inboxes | Powered by JetHome®