linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
To: Zhao Qiang <B45475@freescale.com>,
	linuxppc-dev@lists.ozlabs.org, netdev@vger.kernel.org,
	B07421@freescale.com
Cc: mugunthanvnm@ti.com, linux-kernel@vger.kernel.org,
	helmut.schaa@googlemail.com, zonque@gmail.com,
	R63061@freescale.com, davem@davemloft.net
Subject: Re: [PATCH] phy/at8031: enable at8031 to work on interrupt mode
Date: Thu, 27 Mar 2014 15:52:33 +0400	[thread overview]
Message-ID: <53341101.9000404@cogentembedded.com> (raw)
In-Reply-To: <1395901116-16034-1-git-send-email-B45475@freescale.com>

Hello.

On 27-03-2014 10:18, Zhao Qiang wrote:

> The at8031 can work on polling mode and interrupt mode.
> Add ack_interrupt and config intr funcs to enable
> interrupt mode for it.

> Signed-off-by: Zhao Qiang <B45475@freescale.com>
> ---
>   drivers/net/phy/at803x.c | 30 ++++++++++++++++++++++++++++++
>   1 file changed, 30 insertions(+)

> diff --git a/drivers/net/phy/at803x.c b/drivers/net/phy/at803x.c
> index bc71947..d034ef5 100644
> --- a/drivers/net/phy/at803x.c
> +++ b/drivers/net/phy/at803x.c
[...]
> @@ -191,6 +194,31 @@ static int at803x_config_init(struct phy_device *phydev)
>   	return 0;
>   }
>
> +static int at803x_ack_interrupt(struct phy_device *phydev)
> +{
> +	int err;
> +
> +	err = phy_read(phydev, AT803X_INSR);

    Could make this an initializer...

> +
> +	return (err < 0) ? err : 0;
> +}
> +
> +static int at803x_config_intr(struct phy_device *phydev)
> +{
> +	int err;
> +	int value;
> +
> +	value = phy_read(phydev, AT803X_INER);
> +
> +	if (phydev->interrupts == PHY_INTERRUPT_ENABLED)
> +		err = phy_write(phydev, AT803X_INER,
> +				(value | AT803X_INER_INIT));

    Inner parens not needed.

> +	else
> +		err = phy_write(phydev, AT803X_INER, value);

    Why are you not clearing the bits here? Why write back what has been read 
at all?

WBR, Sergei

  reply	other threads:[~2014-03-27 11:52 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-27  6:18 [PATCH] phy/at8031: enable at8031 to work on interrupt mode Zhao Qiang
2014-03-27 11:52 ` Sergei Shtylyov [this message]
2014-03-28  7:36   ` qiang.zhao
2014-03-28 18:09     ` Sergei Shtylyov
  -- strict thread matches above, loose matches on Subject: below --
2014-03-26  6:45 Zhao Qiang
2014-03-26 18:13 ` Scott Wood

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=53341101.9000404@cogentembedded.com \
    --to=sergei.shtylyov@cogentembedded.com \
    --cc=B07421@freescale.com \
    --cc=B45475@freescale.com \
    --cc=R63061@freescale.com \
    --cc=davem@davemloft.net \
    --cc=helmut.schaa@googlemail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mugunthanvnm@ti.com \
    --cc=netdev@vger.kernel.org \
    --cc=zonque@gmail.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).