linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kamal Dasu <kdasu.kdev-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Florian Fainelli <f.fainelli-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: Ray Jui <rjui-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Wolfram Sang <wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org>,
	Gregory Fong
	<gregory.0xf0-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	"Jayachandran C
	<jchandra-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>,
	bcm-kernel-feedback-list"
	<jchandra-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>,
	rajeev kumar
	<rajeevkumar.linux-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	"Jayachandran C
	<jchandra-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>,
	bcm-kernel-feedback-list"
	<bcm-kernel-feedback-list-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
Subject: Re: [V3, 1/2] i2c: brcmstb: Add Broadcom settop SoC i2c controller driver
Date: Tue, 19 May 2015 12:25:48 -0400	[thread overview]
Message-ID: <CAC=U0a1UhmLvMBK1SuV2m3Md5_ihFwpe-JWqRMDhO+N_ohs2bg@mail.gmail.com> (raw)
In-Reply-To: <55563407.9070409-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

Ray,

"I don't think you answered my question on whether or not you can add
a dependency on COMPILE_TEST during the previous review."

 Added it.

" picky, but in alphabetical order, delay.h should be before device.h
there's an unexpected tab after #define. This was brought up in the
previous review but not addressed"

Fixed both the comments.

"Again, previous comment unanswered or addressed:
So you only allow an exact rate match? I think a round down of the
rate when not exactly matched might be sufficient?"

I prefer to use the exact rate match, to match what the hardware is
doing. Would like to keep it this way.

>+/* i2c xfer completion function, handles both irq and polling mode */
>+static int brcmstb_i2c_wait_for_completion(struct brcmstb_i2c_dev *dev)
>+{
>+       int ret = 0;
>+       unsigned long timeout = msecs_to_jiffies(I2C_TIMEOUT);
>+
+       if (dev->irq >= 0) {
>+               if (!wait_for_completion_timeout(&dev->done, timeout))

"I've mentioned this during the previous review. If timeout happens
and interrupt did not fire, you exit and leave the interrupt enabled.
This should be fixed."

Missed this one last time,  fixed this.

[snip]
> +            ret = -ETIMEDOUT;
> +    } else {
> +        /* we are in polling mode */
> +        u32 bsc_intrp;
> +        unsigned long time_left = jiffies + timeout;
> +
> +        do {
> +            bsc_intrp = bsc_readl(dev, iic_enable) &
> +                BSC_IIC_EN_INTRP_MASK;
> +            if (time_after(jiffies, time_left)) {
> +                ret = -ETIMEDOUT;
> +                break;
> +            }
> +            cpu_relax();
> +        } while (!bsc_intrp);
> +        brcmstb_i2c_enable_disable_irq(dev, INT_DISABLE);

"My question was, why do you need to disable interrupt in the end of
the polling loop? Do you use interrupt at all in polling mode? If so,
why?"

 Need to enable the level 2 interrupt else the interrupt does not fire
if I do not enable and have to clear it too.

>+       if (msg->flags & I2C_M_TEN) {
>+

"Redundant space. Again, I menioned this in the previous review."

Fixed this

"Previous question:
Why do you need a specific DT property to specify the interrupt name?
Why can't you simply set it to pdev->name?"

The pdev->name will have a format like this "f040a200.i2c", based on
how current device tree node is defined as shown in the binding
documentation. This is not helpful to the user. Hence I am using the
int name which is in readable form.

>+
>+       brcmstb_i2c_set_bsc_reg_defaults(dev);

"In the previous review, I asked you:
Don't you want to do this before calling i2c_add_adapter?"

You answered:
Will make the change.
But you did not make the change."

Will make sure I change it this time.

> +       dev_info(dev->device, "%s@%dhz registered in %s mode\n",
> +                int_name ? int_name : " ", dev->clk_freq_hz,
> +                (dev->irq >= 0) ? "interrupt" : "polling");
> +
> +       return 0;
> +
> +probe_errorout:
> +       kfree(dev->bsc_regmap);


"bsc_regmap is allocated by devm_kzalloc, so you don't need to free it here."

> +       return rc;
> +}
> +
> +static int brcmstb_i2c_remove(struct platform_device *pdev)
> +{
> +       struct brcmstb_i2c_dev *dev = platform_get_drvdata(pdev);
> +
> +       i2c_del_adapter(&dev->adapter);
> +       kfree(dev->bsc_regmap);

"No need to free bsc_regmap."

Removed the kfree(dev->bsc_regmap) from the above two places.

Thanks
Kamal

      parent reply	other threads:[~2015-05-19 16:25 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-13 16:59 [V3, 1/2] i2c: brcmstb: Add Broadcom settop SoC i2c controller driver Kamal Dasu
     [not found] ` <1431536390-9761-1-git-send-email-kdasu.kdev-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-05-13 16:59   ` [V3, 2/2] dt-bindings: i2c: Add i2c-brcmstb dt bindings Kamal Dasu
2015-05-15 17:46   ` [V3, 1/2] i2c: brcmstb: Add Broadcom settop SoC i2c controller driver Ray Jui
     [not found]     ` <555630DE.2090100-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
2015-05-15 17:59       ` Florian Fainelli
     [not found]         ` <55563407.9070409-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-05-19 16:25           ` Kamal Dasu [this message]

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='CAC=U0a1UhmLvMBK1SuV2m3Md5_ihFwpe-JWqRMDhO+N_ohs2bg@mail.gmail.com' \
    --to=kdasu.kdev-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=bcm-kernel-feedback-list-dY08KVG/lbpWk0Htik3J/w@public.gmane.org \
    --cc=f.fainelli-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=gregory.0xf0-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=jchandra-dY08KVG/lbpWk0Htik3J/w@public.gmane.org \
    --cc=linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=rajeevkumar.linux-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=rjui-dY08KVG/lbpWk0Htik3J/w@public.gmane.org \
    --cc=wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org \
    /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).