From: David Laight <David.Laight@ACULAB.COM>
To: 'Andy Shevchenko' <andriy.shevchenko@linux.intel.com>,
Wolfram Sang <wsa+renesas@sang-engineering.com>,
Michael Walle <michael@walle.cc>,
Krzysztof Kozlowski <krzk@kernel.org>,
Sam Protsenko <semen.protsenko@linaro.org>,
Lucas De Marchi <lucas.demarchi@intel.com>,
"linux-i2c@vger.kernel.org" <linux-i2c@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
"linux-samsung-soc@vger.kernel.org"
<linux-samsung-soc@vger.kernel.org>,
"linux-renesas-soc@vger.kernel.org"
<linux-renesas-soc@vger.kernel.org>
Cc: Codrin Ciubotariu <codrin.ciubotariu@microchip.com>,
Nicolas Ferre <nicolas.ferre@microchip.com>,
Alexandre Belloni <alexandre.belloni@bootlin.com>,
Claudiu Beznea <claudiu.beznea@microchip.com>,
Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>,
Alim Akhtar <alim.akhtar@samsung.com>,
"Till Harbaum" <till@harbaum.org>, Wolfram Sang <wsa@kernel.org>
Subject: RE: [PATCH v1 2/2] i2c: Introduce i2c_str_read_write() and make use of it
Date: Mon, 4 Jul 2022 10:15:48 +0000 [thread overview]
Message-ID: <d19ac9827d064307910edab181b8813f@AcuMS.aculab.com> (raw)
In-Reply-To: <20220702135925.73406-2-andriy.shevchenko@linux.intel.com>
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)
prev parent reply other threads:[~2022-07-04 10:16 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-02 13:59 [PATCH v1 1/2] lib/string_helpers: Add str_read_write() helper Andy Shevchenko
2022-07-02 13:59 ` [PATCH v1 2/2] i2c: Introduce i2c_str_read_write() and make use of it Andy Shevchenko
2022-07-02 15:41 ` kernel test robot
2022-07-02 16:12 ` kernel test robot
2022-07-04 10:15 ` David Laight [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=d19ac9827d064307910edab181b8813f@AcuMS.aculab.com \
--to=david.laight@aculab.com \
--cc=alexandre.belloni@bootlin.com \
--cc=alim.akhtar@samsung.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=claudiu.beznea@microchip.com \
--cc=codrin.ciubotariu@microchip.com \
--cc=krzk@kernel.org \
--cc=krzysztof.kozlowski@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=linux-samsung-soc@vger.kernel.org \
--cc=lucas.demarchi@intel.com \
--cc=michael@walle.cc \
--cc=nicolas.ferre@microchip.com \
--cc=semen.protsenko@linaro.org \
--cc=till@harbaum.org \
--cc=wsa+renesas@sang-engineering.com \
--cc=wsa@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).