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:   Tue, 19 Sep 2017 16:14:23 +0000
From:   David Laight <David.Laight@...LAB.COM>
To:     'Florian Fainelli' <f.fainelli@...il.com>,
        Vivien Didelot <vivien.didelot@...oirfairelinux.com>,
        "netdev@...r.kernel.org" <netdev@...r.kernel.org>
CC:     "davem@...emloft.net" <davem@...emloft.net>,
        "andrew@...n.ch" <andrew@...n.ch>
Subject: RE: [PATCH net-next 05/12] net: dsa: b53: Use a macro to define I/O
 operations

> >>> +#define b53_build_op(type, op_size, val_type)	\
> >>> +static inline int b53_##type##op_size(struct b53_device *dev, u8
> >page,		\
> >>> +				      u8 reg, val_type val)			\
> >>> +{										\
> >>> +	int ret;								\
> >>> +										\
> >>> +	mutex_lock(&dev->reg_mutex);						\
> >>> +	ret = dev->ops->type##op_size(dev, page, reg, val);			\
> >>> +	mutex_unlock(&dev->reg_mutex);						\
> >>> +										\
> >>> +	return ret;								\
> >>>  }
> >>
> >> Why separate the 'type' and 'op_size' arguments since they
> >> are always pasted together?
> >
> >For read/write48, the value type is u64.
> 
> The way I read David's comment is that instead of calling the macro with read, 48, just combine that
> in a single argument: read48. I don't have a preference about that and can respin eventually.

Indeed, factoring in the type is harder because reads want 'u64 *' not 'u64'.
While that could be factored, it would take more source lines and make
things very obfuscated.

	David

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ