RE: [PATCH net-next 3/5] r8152: add MCU typed read/write functions

2020-11-05 Thread Hayes Wang
Marek Behún > Sent: Friday, November 6, 2020 2:40 PM [...] > Hi Hayes, > > just to be clear: > Are you against defining these functions via macros? > If so, I can simply rewrite this so that it does not use macros... I would like the way which let me find the source of the function easily. I don

Re: [PATCH net-next 3/5] r8152: add MCU typed read/write functions

2020-11-05 Thread Marek Behún
On Fri, 6 Nov 2020 03:01:22 + Hayes Wang wrote: > Vladimir Oltean > > Sent: Thursday, November 5, 2020 6:57 PM > > On Thu, Nov 05, 2020 at 10:54:18AM +0100, Marek Behún wrote: > > > I thought that static inline functions are preferred to macros, since > > > compiler warns better if they ar

RE: [PATCH net-next 3/5] r8152: add MCU typed read/write functions

2020-11-05 Thread Hayes Wang
Vladimir Oltean > Sent: Thursday, November 5, 2020 6:57 PM > On Thu, Nov 05, 2020 at 10:54:18AM +0100, Marek Behún wrote: > > I thought that static inline functions are preferred to macros, since > > compiler warns better if they are used incorrectly... > > Citation needed. Also, how do static in

Re: [PATCH net-next 3/5] r8152: add MCU typed read/write functions

2020-11-05 Thread Vladimir Oltean
On Thu, Nov 05, 2020 at 12:30:43PM +0100, Marek Behún wrote: > On Thu, 5 Nov 2020 12:56:42 +0200 > Vladimir Oltean wrote: > > > On Thu, Nov 05, 2020 at 10:54:18AM +0100, Marek Behún wrote: > > > I thought that static inline functions are preferred to macros, since > > > compiler warns better if th

Re: [PATCH net-next 3/5] r8152: add MCU typed read/write functions

2020-11-05 Thread Marek Behún
On Thu, 5 Nov 2020 12:56:42 +0200 Vladimir Oltean wrote: > On Thu, Nov 05, 2020 at 10:54:18AM +0100, Marek Behún wrote: > > I thought that static inline functions are preferred to macros, since > > compiler warns better if they are used incorrectly... > > Citation needed. Just search for subs

Re: [PATCH net-next 3/5] r8152: add MCU typed read/write functions

2020-11-05 Thread Vladimir Oltean
On Thu, Nov 05, 2020 at 10:54:18AM +0100, Marek Behún wrote: > I thought that static inline functions are preferred to macros, since > compiler warns better if they are used incorrectly... Citation needed. Also, how do static inline functions wrapped in macros (i.e. your patch) stack up against yo

Re: [PATCH net-next 3/5] r8152: add MCU typed read/write functions

2020-11-05 Thread Marek Behún
On Wed, 4 Nov 2020 14:14:24 +0200 Vladimir Oltean wrote: > On Wed, Nov 04, 2020 at 12:10:53PM +0100, Marek Behún wrote: > > > I'm not sure it's worth the change :( > > > Let's put it another way, your diffstat has 338 insertions and 335 > > > deletions. Aka you're saving 3 lines overall. > > > Wi

Re: [PATCH net-next 3/5] r8152: add MCU typed read/write functions

2020-11-04 Thread Jakub Kicinski
On Wed, 4 Nov 2020 14:14:24 +0200 Vladimir Oltean wrote: > To my eyes this is easier to digest. +1

Re: [PATCH net-next 3/5] r8152: add MCU typed read/write functions

2020-11-04 Thread Vladimir Oltean
On Wed, Nov 04, 2020 at 12:10:53PM +0100, Marek Behún wrote: > > I'm not sure it's worth the change :( > > Let's put it another way, your diffstat has 338 insertions and 335 > > deletions. Aka you're saving 3 lines overall. > > With this new approach that doesn't use token concatenation at all, > >

Re: [PATCH net-next 3/5] r8152: add MCU typed read/write functions

2020-11-04 Thread Marek Behún
On Wed, 4 Nov 2020 13:00:59 +0200 Vladimir Oltean wrote: > On Wed, Nov 04, 2020 at 11:35:45AM +0100, Marek Behún wrote: > > Or something like this? > > > > #define DEF_R_FUNC(_t, _r, _r_i, _mcu) \ > > static inline _t _r(struct r8152 *tp, u16 index)\ > >

Re: [PATCH net-next 3/5] r8152: add MCU typed read/write functions

2020-11-04 Thread Vladimir Oltean
On Wed, Nov 04, 2020 at 11:35:45AM +0100, Marek Behún wrote: > Or something like this? > > #define DEF_R_FUNC(_t, _r, _r_i, _mcu)\ > static inline _t _r(struct r8152 *tp, u16 index) \ > { \ >

Re: [PATCH net-next 3/5] r8152: add MCU typed read/write functions

2020-11-04 Thread Marek Behún
Or something like this? #define DEF_R_FUNC(_t, _r, _r_i, _mcu) \ static inline _t _r(struct r8152 *tp, u16 index)\ { \ return _r_i(tp, _mcu, index); \ } #define

Re: [PATCH net-next 3/5] r8152: add MCU typed read/write functions

2020-11-04 Thread Marek Behún
On Wed, 4 Nov 2020 10:47:10 +0200 Vladimir Oltean wrote: > > So you aren't complaining about the definition of pla_ and usb_ > > functions, just that they are defined via macros? > > Yes. What if concatenation wasn't used, but the functions were still defined with macro? DEFINE_READ_FUNC(pla

Re: [PATCH net-next 3/5] r8152: add MCU typed read/write functions

2020-11-04 Thread Vladimir Oltean
On Wed, Nov 04, 2020 at 06:55:24AM +0100, Marek Behún wrote: > On Tue, 3 Nov 2020 23:47:12 +0200 > Vladimir Oltean wrote: > > > On Tue, Nov 03, 2020 at 08:22:24PM +0100, Marek Behún wrote: > > > Add pla_ and usb_ prefixed versions of ocp_read_* and ocp_write_* > > > functions. This saves us from

Re: [PATCH net-next 3/5] r8152: add MCU typed read/write functions

2020-11-03 Thread Marek Behún
On Tue, 3 Nov 2020 23:47:12 +0200 Vladimir Oltean wrote: > On Tue, Nov 03, 2020 at 08:22:24PM +0100, Marek Behún wrote: > > Add pla_ and usb_ prefixed versions of ocp_read_* and ocp_write_* > > functions. This saves us from always writing MCU_TYPE_PLA/MCU_TYPE_USB > > as parameter. > > > > Signe

Re: [PATCH net-next 3/5] r8152: add MCU typed read/write functions

2020-11-03 Thread Vladimir Oltean
On Tue, Nov 03, 2020 at 08:22:24PM +0100, Marek Behún wrote: > Add pla_ and usb_ prefixed versions of ocp_read_* and ocp_write_* > functions. This saves us from always writing MCU_TYPE_PLA/MCU_TYPE_USB > as parameter. > > Signed-off-by: Marek Behún > --- You just made it harder for everyone to f

[PATCH net-next 3/5] r8152: add MCU typed read/write functions

2020-11-03 Thread Marek Behún
Add pla_ and usb_ prefixed versions of ocp_read_* and ocp_write_* functions. This saves us from always writing MCU_TYPE_PLA/MCU_TYPE_USB as parameter. Signed-off-by: Marek Behún --- drivers/net/usb/r8152.c | 673 1 file changed, 338 insertions(+), 335 del