From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: "Uwe Kleine-König" <u.kleine-koenig@baylibre.com>
Cc: Lars-Peter Clausen <lars@metafoo.de>,
Jonathan Cameron <jic23@kernel.org>,
Wolfram Sang <wsa+renesas@sang-engineering.com>,
linux-iio@vger.kernel.org, linux-i2c@vger.kernel.org
Subject: Re: [PATCH] iio: Initialize i2c_device_id structures by name
Date: Thu, 5 Dec 2024 10:24:01 +0200 [thread overview]
Message-ID: <Z1FjIQuluXtBeZuc@smile.fi.intel.com> (raw)
In-Reply-To: <20241204150036.1695824-2-u.kleine-koenig@baylibre.com>
On Wed, Dec 04, 2024 at 04:00:36PM +0100, Uwe Kleine-König wrote:
> I intend to change the definition of struct i2c_device_id to look as
> follows:
>
> struct i2c_device_id {
> char name[I2C_NAME_SIZE];
> /* Data private to the driver */
> union {
> kernel_ulong_t driver_data;
> const void *driver_data_ptr;
> };
> };
>
> That the initializers for these structures also work with this new
> definition, they must use named members.
>
> The motivation for that change is to be able to drop many casts from
> pointer to kernel_ulong_t. So once the definition is updated,
> initializers that today use:
>
> { "fxls8471", (kernel_ulong_t)&mma_chip_info_table[fxls8471], },
>
> or
>
> { .name = "fxls8471", .driver_data = (kernel_ulong_t)&mma_chip_info_table[fxls8471], },
>
> can be changed to
>
> { .name = "fxls8471", .driver_data_ptr = &mma_chip_info_table[fxls8471], }
>
> and some more casts when the driver data is used can be dropped, too.
...
> static const struct i2c_device_id adxl345_i2c_id[] = {
> - { "adxl345", (kernel_ulong_t)&adxl345_i2c_info },
> - { "adxl375", (kernel_ulong_t)&adxl375_i2c_info },
> + { .name = "adxl345", .driver_data = (kernel_ulong_t)&adxl345_i2c_info, },
> + { .name = "adxl375", .driver_data = (kernel_ulong_t)&adxl375_i2c_info, },
Redundant inner trailing commas. And they were absent in the original code.
And I find that better style as usually we leave commas (or add them) only in
multi-line cases.
> { }
> };
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2024-12-05 8:24 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-04 15:00 [PATCH] iio: Initialize i2c_device_id structures by name Uwe Kleine-König
2024-12-05 8:24 ` Andy Shevchenko [this message]
2024-12-08 12:59 ` 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=Z1FjIQuluXtBeZuc@smile.fi.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=jic23@kernel.org \
--cc=lars@metafoo.de \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=u.kleine-koenig@baylibre.com \
--cc=wsa+renesas@sang-engineering.com \
/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