Linux MIPS Architecture development
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: John Crispin <blogic@openwrt.org>,
	"David S. Miller" <davem@davemloft.net>
Cc: netdev@vger.kernel.org, linux-mips@linux-mips.org,
	linux-mediatek@lists.infradead.org,
	"Felix Fietkau" <nbd@nbd.name>, "Michael Lee" <igvtee@gmail.com>,
	"Steven Liu (劉人豪)" <steven.liu@mediatek.com>,
	"Fred Chang (張嘉宏)" <Fred.Chang@mediatek.com>
Subject: Re: [PATCH 05/12] net-next: mediatek: add switch driver for mt7621
Date: Sun, 03 Jan 2016 11:18:47 -0800	[thread overview]
Message-ID: <1451848727.4334.55.camel@perches.com> (raw)
In-Reply-To: <1451834775-15789-5-git-send-email-blogic@openwrt.org>

On Sun, 2016-01-03 at 16:26 +0100, John Crispin wrote:
> This driver is very basic and only provides basic init and irq support.
> The SoC and switch core both have support for a special tag making DSA
> support possible.

trivia:

> diff --git a/drivers/net/ethernet/mediatek/gsw_mt7621.c b/drivers/net/ethernet/mediatek/gsw_mt7621.c
[]
> +static irqreturn_t gsw_interrupt_mt7621(int irq, void *_priv)
> +{
> +	struct fe_priv *priv = (struct fe_priv *)_priv;
> +	struct mt7620_gsw *gsw = (struct mt7620_gsw *)priv->soc->swpriv;
> +	u32 reg, i;
> +
> +	reg = mt7530_mdio_r32(gsw, 0x700c);
> +
> +	for (i = 0; i < 5; i++)
> +		if (reg & BIT(i)) {
> +			unsigned int link;
> +
> +			link = mt7530_mdio_r32(gsw,
> +					       0x3008 + (i * 0x100)) & 0x1;
> +
> +			if (link != priv->link[i]) {
> +				priv->link[i] = link;
> +				if (link)
> +					netdev_info(priv->netdev,
> +						    "port %d link up\n", i);
> +				else
> +					netdev_info(priv->netdev,
> +						    "port %d link down\n", i);
> +			}
> +		}

It's more common to use braces after the for loop.
Perhaps this could be written with a continue; to reduce
indentation and also use a single netdev_info().

	for (i = 0; i < 5; i++) {
		unsigned int link;

		if (!(reg & BIT(i)))
			continue;

		link = mt7530_mdio_r32(gsw, 0x3008 + (i * 0x100)) & 0x1;

		if (link == priv->link[i])
			continue;

		priv->link[i] = link;
		netdev_info(priv->netdev, "port %d link %s\n",
			    i, link ? "up" : "down");
	}

  reply	other threads:[~2016-01-03 19:18 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-03 15:26 [PATCH 01/12] Documentation: DT: net: add docs for ralink/mediatek SoC ethernet binding John Crispin
2016-01-03 15:26 ` [PATCH 02/12] net-next: mediatek: add the drivers core files John Crispin
2016-01-03 15:26 ` [PATCH 03/12] net-next: mediatek: add switch driver for rt3050 John Crispin
2016-01-03 15:26 ` [PATCH 04/12] net-next: mediatek: add switch driver for mt7620 John Crispin
2016-01-03 15:26 ` [PATCH 05/12] net-next: mediatek: add switch driver for mt7621 John Crispin
2016-01-03 19:18   ` Joe Perches [this message]
2016-01-03 15:26 ` [PATCH 06/12] net-next: mediatek: add support for rt2880 John Crispin
2016-01-03 15:26 ` [PATCH 07/12] net-next: mediatek: add support for rt3050 John Crispin
2016-01-03 15:26 ` [PATCH 08/12] net-next: mediatek: add support for rt3883 John Crispin
2016-01-03 15:26 ` [PATCH 09/12] net-next: mediatek: add support for mt7620 John Crispin
2016-01-03 15:26 ` [PATCH 10/12] net-next: mediatek: add support for mt7621 John Crispin
2016-01-03 15:26 ` [PATCH 11/12] net-next: mediatek: add Kconfig and Makefile John Crispin
2016-01-03 15:26 ` [PATCH 12/12] net-next: mediatek: add an entry to MAINTAINERS John Crispin

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=1451848727.4334.55.camel@perches.com \
    --to=joe@perches.com \
    --cc=Fred.Chang@mediatek.com \
    --cc=blogic@openwrt.org \
    --cc=davem@davemloft.net \
    --cc=igvtee@gmail.com \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-mips@linux-mips.org \
    --cc=nbd@nbd.name \
    --cc=netdev@vger.kernel.org \
    --cc=steven.liu@mediatek.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