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] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 14 Aug 2015 22:57:28 +0200
From:	Arnd Bergmann <arnd@...db.de>
To:	linux-arm-kernel@...ts.infradead.org
Cc:	Kenneth Lee <liguozhu@...ilicon.com>, robh+dt@...nel.org,
	pawel.moll@....com, mark.rutland@....com,
	ijc+devicetree@...lion.org.uk, galak@...eaurora.org,
	catalin.marinas@....com, will.deacon@....com,
	Yisen.Zhuang@...wei.com, davem@...emloft.net,
	paul.gortmaker@...driver.com, dingtianhong@...wei.com,
	zhangfei.gao@...aro.org, devicetree@...r.kernel.org,
	linux-kernel@...r.kernel.org, netdev@...r.kernel.org,
	linuxarm@...wei.com, salil.mehta@...wei.com,
	huangdaode@...ilicon.com, Kenneth Lee <liguozhu@...wei.com>
Subject: Re: [PATCH 3/5] net: add Hisilicon Network Subsystem MDIO support

On Friday 14 August 2015 18:30:20 Kenneth Lee wrote:

> +#define MDIO_BASE_ADDR                 0x403C0000

Does not belong in here (and is not used)

> +#define MDIO_COMMAND_REG               0x0
> +#define MDIO_ADDR_REG                  0x4
> +#define MDIO_WDATA_REG                 0x8
> +#define MDIO_RDATA_REG                 0xc
> +#define MDIO_STA_REG                   0x10

These look suspiciously similar to definitions from
drivers/net/ethernet/hisilicon/hip04_mdio.c.

Could the hardware be related? If so, please try to share
the common parts.

> +static inline void mdio_write_reg(void *base, u32 reg, u32 value)
> +{
> +       u8 __iomem *reg_addr = ACCESS_ONCE(base);
> +
> +       writel(value, reg_addr + reg);
> +}
> +
> +#define MDIO_WRITE_REG(a, reg, value) \
> +       mdio_write_reg((a)->vbase, (reg), (value))
> 

Something seems wrong here: why do you have an ACCESS_ONCE() on a
local variable? Doesn't this just make the code less efficient
without providing lockless access to shared variables?

The types are inconsistent here, you should get a warning from
running this through 'make C=1' because of the missing __iomem
annotation of the pointer.

Also, why both a macro and an inline function? Just use an inline
function.

	Arnd
--
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