From: Waqar Hameed <waqar.hameed@axis.com>
To: Jonathan Cameron <jic23@kernel.org>,
Lars-Peter Clausen <lars@metafoo.de>,
Michael Hennerich <Michael.Hennerich@analog.com>,
Haibo Chen <haibo.chen@nxp.com>
Cc: <kernel@axis.com>, <linux-iio@vger.kernel.org>,
<linux-kernel@vger.kernel.org>
Subject: [PATCH 0/4] iio: Clean up macro definitions
Date: Tue, 27 May 2025 16:45:41 +0200 [thread overview]
Message-ID: <cover.1748356671.git.waqar.hameed@axis.com> (raw)
Currently there are a bunch of drivers using macro definitions for
string literals that are only used once. There seem to be a "style
guide" to not do this, and this is often mentioned during the reviews
(if caught). And since developers most often look at other drivers for
inspiration (or just trying to figure out the "style guide") when
writing a new one, it is desirable to have some consistency.
In this patch series we identify the drivers that have macro definitions
for string literals that are only used once. The most common one is the
driver name. These can be identified by
rgrep -A 10 "\.driver" drivers/iio/ | grep "\.name" | grep -v '"'
And then count the number of occurrences of the particular macro
definition (e.g. with `grep -c`). Most drivers use these macro
definitions for `.name` in `struct device_driver` and `indio_dev->name`
(which could be justified with a macro definition). However, the ones
with only one occurrence are identified and removed in this patch
series.
There are also drivers that have a mixture, e.g. macro definition for
`indio_dev->name` but in-line string literal for `.name` in `struct
device_driver`). The following have therefore not been touched (but
should maybe use the macro definition for both places):
drivers/iio/accel/stk8ba50.c
drivers/iio/accel/mma7660.c
drivers/iio/humidity/am2315.c
drivers/iio/light/stk3310.c
Likewise, there are drivers that only use `KBUILD_MODNAME` in one place.
These have also been left for the same reasons.
Finally, while cleaning up these ones, other similar macro definitions
could be identified with the same "style guide" issue: macro definitions
for IRQ name and `regmap` name. There are even unused macro definitions.
All of these are also addressed in this patch series.
Waqar Hameed (4):
iio: Remove single use of macro definition for driver name
iio: Remove single use of macro definition for IRQ name
iio: Remove single use of macro definition for regmap name
iio: Remove unused macro definition for driver and IRQ name
drivers/iio/accel/bma180.c | 3 ---
drivers/iio/accel/bmc150-accel-core.c | 5 +----
drivers/iio/accel/kxcjk-1013.c | 7 ++-----
drivers/iio/accel/mma9551.c | 6 ++----
drivers/iio/accel/mma9553.c | 7 ++-----
drivers/iio/accel/mxc4005.c | 6 ++----
drivers/iio/accel/mxc6255.c | 3 +--
drivers/iio/accel/sca3300.c | 4 +---
drivers/iio/accel/stk8312.c | 3 +--
drivers/iio/accel/stk8ba50.c | 3 +--
drivers/iio/adc/hi8435.c | 4 +---
drivers/iio/adc/max9611.c | 4 +---
drivers/iio/adc/vf610_adc.c | 5 +----
drivers/iio/chemical/atlas-sensor.c | 3 +--
drivers/iio/dac/max517.c | 4 +---
drivers/iio/dac/mcp4725.c | 4 +---
drivers/iio/gyro/bmg160_core.c | 4 +---
drivers/iio/health/max30100.c | 3 +--
drivers/iio/health/max30102.c | 3 +--
drivers/iio/humidity/dht11.c | 4 +---
drivers/iio/imu/kmx61.c | 7 ++-----
drivers/iio/light/adux1020.c | 3 +--
drivers/iio/light/apds9160.c | 4 +---
drivers/iio/light/apds9300.c | 3 +--
drivers/iio/light/apds9960.c | 3 +--
drivers/iio/light/jsa1212.c | 3 +--
drivers/iio/light/ltr501.c | 8 ++------
drivers/iio/light/rpr0521.c | 6 ++----
drivers/iio/light/stk3310.c | 6 ++----
drivers/iio/light/vcnl4035.c | 6 ++----
drivers/iio/magnetometer/bmc150_magn.c | 5 +----
drivers/iio/magnetometer/mmc35240.c | 3 +--
drivers/iio/proximity/sx9500.c | 3 +--
drivers/iio/resolver/ad2s1200.c | 3 +--
34 files changed, 42 insertions(+), 106 deletions(-)
base-commit: 914873bc7df913db988284876c16257e6ab772c6
--
2.39.5
next reply other threads:[~2025-05-27 14:45 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-27 14:45 Waqar Hameed [this message]
2025-05-27 14:45 ` [PATCH 1/4] iio: Remove single use of macro definition for driver name Waqar Hameed
2025-05-27 14:45 ` [PATCH 2/4] iio: Remove single use of macro definition for IRQ name Waqar Hameed
2025-05-27 14:45 ` [PATCH 3/4] iio: Remove single use of macro definition for regmap name Waqar Hameed
2025-05-27 14:45 ` [PATCH 4/4] iio: Remove unused macro definition for driver and IRQ name Waqar Hameed
2025-05-31 15:12 ` [PATCH 0/4] iio: Clean up macro definitions Jonathan Cameron
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=cover.1748356671.git.waqar.hameed@axis.com \
--to=waqar.hameed@axis.com \
--cc=Michael.Hennerich@analog.com \
--cc=haibo.chen@nxp.com \
--cc=jic23@kernel.org \
--cc=kernel@axis.com \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.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