[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <d19ac9827d064307910edab181b8813f@AcuMS.aculab.com>
Date: Mon, 4 Jul 2022 10:15:48 +0000
From: David Laight <David.Laight@...LAB.COM>
To: 'Andy Shevchenko' <andriy.shevchenko@...ux.intel.com>,
Wolfram Sang <wsa+renesas@...g-engineering.com>,
Michael Walle <michael@...le.cc>,
Krzysztof Kozlowski <krzk@...nel.org>,
Sam Protsenko <semen.protsenko@...aro.org>,
Lucas De Marchi <lucas.demarchi@...el.com>,
"linux-i2c@...r.kernel.org" <linux-i2c@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-arm-kernel@...ts.infradead.org"
<linux-arm-kernel@...ts.infradead.org>,
"linux-samsung-soc@...r.kernel.org"
<linux-samsung-soc@...r.kernel.org>,
"linux-renesas-soc@...r.kernel.org"
<linux-renesas-soc@...r.kernel.org>
CC: Codrin Ciubotariu <codrin.ciubotariu@...rochip.com>,
Nicolas Ferre <nicolas.ferre@...rochip.com>,
Alexandre Belloni <alexandre.belloni@...tlin.com>,
Claudiu Beznea <claudiu.beznea@...rochip.com>,
Krzysztof Kozlowski <krzysztof.kozlowski@...aro.org>,
Alim Akhtar <alim.akhtar@...sung.com>,
"Till Harbaum" <till@...baum.org>, Wolfram Sang <wsa@...nel.org>
Subject: RE: [PATCH v1 2/2] i2c: Introduce i2c_str_read_write() and make use
of it
From: Andy Shevchenko
> Sent: 02 July 2022 14:59
>
> str_read_write() returns a string literal "read" or "write" based
> on the value. It also allows to unify usage of a such in the kernel.
>
> For i2c case introduce a wrapper that takes struct i2c_msg as parameter.
>
...
>
> - DEB2("=== SLAVE ADDRESS %#04x+%c=%#04x\n",
> - msg->addr, msg->flags & I2C_M_RD ? 'R' : 'W', addr);
> + DEB2("=== SLAVE ADDRESS %#04x+%s=%#04x\n", msg->addr, i2c_str_read_write(msg), addr);
You should ask yourself whether this actually makes the code more readable.
Imagine someone who is scan-reading the code to see what it does.
They're not going to be impressed when they've chased through
two searches to find out the code does.
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
Powered by blists - more mailing lists