[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <063D6719AE5E284EB5DD2968C1650D6DD007A003@AcuExch.aculab.com>
Date: Tue, 19 Sep 2017 12:53:51 +0000
From: David Laight <David.Laight@...LAB.COM>
To: 'Florian Fainelli' <f.fainelli@...il.com>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>
CC: "davem@...emloft.net" <davem@...emloft.net>,
"andrew@...n.ch" <andrew@...n.ch>,
"vivien.didelot@...oirfairelinux.com"
<vivien.didelot@...oirfairelinux.com>
Subject: RE: [PATCH net-next 05/12] net: dsa: b53: Use a macro to define I/O
operations
From: Florian Fainelli
> Sent: 18 September 2017 22:41
> Instead of repeating the same pattern: acquire mutex, read/write, release
> mutex, define a macro: b53_build_op() which takes the type (read|write), I/O
> size, and value (scalar or pointer). This helps with fixing bugs that could
> exit (e.g: missing barrier, lock etc.).
....
> +#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?
David
Powered by blists - more mailing lists