lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Sun, 03 Jan 2016 11:18:47 -0800
From:	Joe Perches <joe@...ches.com>
To:	John Crispin <blogic@...nwrt.org>,
	"David S. Miller" <davem@...emloft.net>
Cc:	netdev@...r.kernel.org, linux-mips@...ux-mips.org,
	linux-mediatek@...ts.infradead.org, Felix Fietkau <nbd@....name>,
	Michael Lee <igvtee@...il.com>,
	Steven Liu (劉人豪) 
	<steven.liu@...iatek.com>,
	Fred Chang (張嘉宏) 
	<Fred.Chang@...iatek.com>
Subject: Re: [PATCH 05/12] net-next: mediatek: add switch driver for mt7621

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");
	}


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ