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]
Message-ID: <YO3cHoEGwzpWDxnI@lunn.ch>
Date:   Tue, 13 Jul 2021 20:31:58 +0200
From:   Andrew Lunn <andrew@...n.ch>
To:     Felix Fietkau <nbd@....name>
Cc:     linux-wireless@...r.kernel.org, netdev@...r.kernel.org,
        pablo@...filter.org, ryder.lee@...iatek.com
Subject: Re: [RFC 2/7] net: ethernet: mtk_eth_soc: add support for Wireless
 Ethernet Dispatch (WED)

> diff --git a/drivers/net/ethernet/mediatek/mtk_wed.c b/drivers/net/ethernet/mediatek/mtk_wed.c
> +
> +static inline void
> +wed_m32(struct mtk_wed_device *dev, u32 reg, u32 mask, u32 val)
> +{
> +	regmap_update_bits(dev->hw->regs, reg, mask | val, val);
> +}

Please don't use inline functions in .c files. Let the compiler
decide.

> +static void
> +mtk_wed_reset(struct mtk_wed_device *dev, u32 mask)
> +{
> +	int i;
> +
> +	wed_w32(dev, MTK_WED_RESET, mask);
> +	for (i = 0; i < 100; i++) {
> +		if (wed_r32(dev, MTK_WED_RESET) & mask)
> +			continue;
> +
> +		return;
> +	}

It may be better to use something from iopoll.h

> +static inline int
> +mtk_wed_device_attach(struct mtk_wed_device *dev)
> +{
> +	int ret = -ENODEV;
> +
> +#ifdef CONFIG_NET_MEDIATEK_SOC_WED

if (IS_ENABLED(CONFIG_NET_MEDIATEK_SOC_WED) is better, since it
compiles the code, and then the optimizer throws away.

> +	rcu_read_lock();
> +	dev->ops = rcu_dereference(mtk_soc_wed_ops);
> +	if (dev->ops)
> +		ret = dev->ops->attach(dev);
> +	rcu_read_unlock();
> +
> +	if (ret)
> +		dev->ops = NULL;
> +#endif
> +
> +	return ret;
> +}

  Andrew

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ