Linux IIO development
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: "Uwe Kleine-König (The Capable Hub)" <u.kleine-koenig@baylibre.com>
Cc: "Lars-Peter Clausen" <lars@metafoo.de>,
	"Michael Hennerich" <Michael.Hennerich@analog.com>,
	"David Lechner" <dlechner@baylibre.com>,
	"Nuno Sá" <nuno.sa@analog.com>,
	"Andy Shevchenko" <andy@kernel.org>,
	"Puranjay Mohan" <puranjay@kernel.org>,
	"Marcelo Schmitt" <marcelo.schmitt@analog.com>,
	"Antoniu Miclaus" <antoniu.miclaus@analog.com>,
	"Ramona Gradinariu" <ramona.gradinariu@analog.com>,
	"Petre Rodan" <petre.rodan@subdimension.ro>,
	"Dan Robertson" <dan@dlrobertson.com>,
	"Herve Codina" <herve.codina@bootlin.com>,
	"Matti Vaittinen" <mazziesaccount@gmail.com>,
	"Francesco Dolcini" <francesco@dolcini.it>,
	"João Paulo Gonçalves" <jpaulo.silvagoncalves@gmail.com>,
	"Hugo Villeneuve" <hvilleneuve@dimonoff.com>,
	"Anshul Dalal" <anshulusr@gmail.com>,
	"Gustavo Silva" <gustavograzs@gmail.com>,
	"Andreas Klinger" <ak@it-klinger.de>,
	"Tomasz Duszynski" <tduszyns@gmail.com>,
	"Ariana Lazar" <ariana.lazar@microchip.com>,
	"Rui Miguel Silva" <rmfrfs@gmail.com>,
	"Linus Walleij" <linusw@kernel.org>,
	"Javier Carrasco" <javier.carrasco.cruz@gmail.com>,
	"Li peiyu" <579lpy@gmail.com>,
	"Lorenzo Bianconi" <lorenzo@kernel.org>,
	"Alex Lanzano" <lanzano.alex@gmail.com>,
	"Jagath Jog J" <jagathjog1996@gmail.com>,
	"Jean-Baptiste Maneyrol" <jean-baptiste.maneyrol@tdk.com>,
	"Remi Buisson" <remi.buisson@tdk.com>,
	"Christian Eggers" <ceggers@arri.de>,
	"Mudit Sharma" <muditsharma.info@gmail.com>,
	"Kevin Tsai" <ktsai@capellamicro.com>,
	"Ondřej Jirman" <megi@xff.cz>,
	"Dixit Parmar" <dixitparmar19@gmail.com>,
	"Gerald Loacker" <gerald.loacker@wolfvision.net>,
	"Akhilesh Patil" <akhilesh@ee.iitb.ac.in>,
	"Eddie James" <eajames@linux.ibm.com>,
	"Petar Stoykov" <petar.stoykov@prodrive-technologies.com>,
	"Song Qiang" <songqiang1304521@gmail.com>,
	"Siratul Islam" <email@sirat.me>, "Crt Mori" <cmo@melexis.com>,
	"Waqar Hameed" <waqar.hameed@axis.com>,
	"Sebastian Andrzej Siewior" <bigeasy@linutronix.de>,
	"Gustavo Vaz" <gustavo.vaz@usp.br>,
	"Sakari Ailus" <sakari.ailus@linux.intel.com>,
	"Marcus Folkesson" <marcus.folkesson@gmail.com>,
	"Guenter Roeck" <linux@roeck-us.net>,
	"Bartosz Golaszewski" <bartosz.golaszewski@oss.qualcomm.com>,
	"Chuang Zhu" <git@chuang.cz>,
	"Kyle Hsieh" <kylehsieh1995@gmail.com>,
	"Giorgi Tchankvetadze" <giorgitchankvetadze1997@gmail.com>,
	"Chen-Yu Tsai" <wens@kernel.org>,
	"Oleksij Rempel" <o.rempel@pengutronix.de>,
	"Romain Gantois" <romain.gantois@bootlin.com>,
	"Sander Vanheule" <sander@svanheule.net>,
	"David Jander" <david@protonic.nl>, "Andrew Davis" <afd@ti.com>,
	chuguangqing <chuguangqing@inspur.com>,
	"Shrikant Raskar" <raskar.shree97@gmail.com>,
	"Kurt Borja" <kuurtb@gmail.com>,
	"Denis Benato" <benato.denis96@gmail.com>,
	"Ethan Tidmore" <ethantidmore06@gmail.com>,
	"Tomas Borquez" <tomasborquez13@gmail.com>,
	"Srinivas Pandruvada" <srinivas.pandruvada@linux.intel.com>,
	"Shi Hao" <i.shihao.999@gmail.com>,
	"Xichao Zhao" <zhao.xichao@vivo.com>,
	"Erikas Bitovtas" <xerikasxx@gmail.com>,
	"Aldo Conte" <aldocontelk@gmail.com>,
	"Colin Ian King" <colin.i.king@gmail.com>,
	"Gabriel Almeida" <gabrielsousa230@gmail.com>,
	"Gabriela Victor" <gabevictor333@gmail.com>,
	"Beatriz Viana Costa" <beatrizvianacosta16@gmail.com>,
	"Frank Li" <Frank.Li@nxp.com>,
	"Adrian Fluturel" <fluturel.adrian@gmail.com>,
	"Antoni Pokusinski" <apokusinski01@gmail.com>,
	"Yasin Lee" <yasin.lee.x@gmail.com>,
	"Felix Gu" <ustc.gu@gmail.com>,
	"Ben Collins" <bcollins@watter.com>,
	linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 7/7] iio: Initialize i2c_device_id arrays using member names
Date: Fri, 22 May 2026 12:10:32 +0100	[thread overview]
Message-ID: <20260522121032.1598fa09@jic23-huawei> (raw)
In-Reply-To: <ag8BYvxUs0Jni5op@monoceros>

On Thu, 21 May 2026 15:20:09 +0200
Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com> wrote:

> Hello Jonathan,
> 
> On Thu, May 21, 2026 at 01:04:44PM +0100, Jonathan Cameron wrote:
> > On Tue, 19 May 2026 21:51:20 +0200
> > Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com> wrote:  
> > > On Tue, May 19, 2026 at 07:39:13PM +0100, Jonathan Cameron wrote:  
> > > > On Tue, 19 May 2026 10:13:09 +0200
> > > > Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com> wrote:
> > > >     
> > > > > While being less compact, using named initializers allows to more easily
> > > > > see which members of the structs are assigned which value without having
> > > > > to lookup the declaration of the struct. And it's also more robust
> > > > > against changes to the struct definition.
> > > > > 
> > > > > The mentioned robustness is relevant for a planned change to struct
> > > > > i2c_device_id that replaces .driver_data by an anonymous union.
> > > > > 
> > > > > This patch doesn't modify the compiled arrays, only their representation
> > > > > in source form benefits. The former was confirmed with x86 and arm64
> > > > > builds.
> > > > > 
> > > > > Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com>    
> > > > 
> > > > I'd prefer it split into cases you care about (not just name) and the name only ones.
> > > > That is unless I'm missing some potential change that breaks initializing
> > > > just the first element and hence not the union you plan to add.
> > > > 
> > > > It's a lot of churn and the name one isn't enabling anything new unless
> > > > I'm missing something.    
> > > 
> > > Today all hunks are about using named initializers to improve
> > > readability, so the split into only .name vs. .name+.driver_data feels
> > > very artificial to me. But if you think that's the compromise to use,
> > > I'll adapt.
> > >   
> > > > We also get fixes in these annoyingly often so chances are this will mess
> > > > up backports.  Might even be worth splitting it up into directories
> > > > just to reduce that backport mess.    
> > > 
> > > In my opinion this is the reason to do this kind of cleanup with one
> > > patch per driver. This doesn't only make backports easier, it also
> > > allows to better record who reviewed and acked what, it reduces merge
> > > conflicts (because if one driver is updated in your tree already since
> > > my base, with one subsystem patch you get a merge conflict which makes
> > > the whole patch unapplicable, with one patch per driver only one out of
> > > (here) 208 fails).
> > > 
> > > But that isn't popular with most subsystem maintainers and so I went
> > > with one patch per subsystem. 🤷  
> > 
> > Meh.  This is going to be painful whatever, so to have it as fresh
> > as possible I'll pick it up now as one giant patch.  
> 
> \o/, thanks.
> 
> > Note there are already conflicts... Fixed up:
> > light/tsl2772.c (a couple more entries)
> > light/vcnl4000.c (data is now all pointers, not enum values).
> > 
> > Bunch of line changes in other drivers, but otherwise went in fine.  
> 
> I reproduced the issue, my conflict resolution (on top of next-20260521)
> looks as follows:
> 



> diff --git a/drivers/iio/adc/rtq6056.c b/drivers/iio/adc/rtq6056.c
> index e2b1da13c0d3..ae50fb27bac9 100644
> --- a/drivers/iio/adc/rtq6056.c
> +++ b/drivers/iio/adc/rtq6056.c
> @@ -872,8 +872,8 @@ static const struct richtek_dev_data rtq6059_devdata = {
>  };
>  
>  static const struct i2c_device_id rtq6056_id[] = {
> -	{ "rtq6056", (kernel_ulong_t)&rtq6056_devdata },
> -	{ "rtq6059", (kernel_ulong_t)&rtq6059_devdata },
> +	{ .name = "rtq6056", .driver_data = (kernel_ulong_t)&rtq6056_devdata },
> +	{ .name = "rtq6059", .driver_data = (kernel_ulong_t)&rtq6059_devdata },
>  	{ }
>  };
>  MODULE_DEVICE_TABLE(i2c, rtq6056_id);
> 
> The last hunk was made necessary by commit
> ce80292ead5bb42b50a6b63e44fd95c0edf9d334. And I'm pretty sure that the
> following is possible on top:
> 
>  static const struct of_device_id rtq6056_device_match[] = {
> -	{ .compatible = "richtek,rtq6056", .data = &rtq6056_devdata },
> -	{ .compatible = "richtek,rtq6059", .data = &rtq6059_devdata },
> +	{ .compatible = "richtek,rtq6056" },
> +	{ .compatible = "richtek,rtq6059" },
>  	{ }
>  };
>  MODULE_DEVICE_TABLE(of, rtq6056_device_match);
First two match what I had.

For the rtq one lets do it as a separate patch along with any other stragglers.

> 
> > There are a few new instances in tree, though from a quick glance
> > maybe no i2c ones.  Since you sent the first series I've been looking
> > out for this in reviews, but some stuff was a already queued.
> > 
> > Anyhow, new ones can be dealt with in follow up patches.  
> 
> There will more some more drivers I missed in other subsystems, so I'll
> have to reiterate anyhow. If you catch drivers before going in, that's
> great, but it's not a problem if you miss a few.
> 
> Thanks for your cooperation,
Thanks for doing the hard work ;)

J
> Uwe


      reply	other threads:[~2026-05-22 11:11 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-19  8:13 [PATCH v2 0/7] iio: Rework i2c_device_id initialisation Uwe Kleine-König (The Capable Hub)
2026-05-19  8:13 ` [PATCH v2 1/7] iio: Drop unused driver_data in four i2c drivers Uwe Kleine-König (The Capable Hub)
2026-05-19  8:13 ` [PATCH v2 2/7] iio: accel: bmc150: Explicitly set .driver_data Uwe Kleine-König (The Capable Hub)
2026-05-19 18:42   ` Jonathan Cameron
2026-05-19  8:13 ` [PATCH v2 3/7] iio: adc: ad7091r5: Simplify driver_data handling Uwe Kleine-König (The Capable Hub)
2026-05-19 18:49   ` Jonathan Cameron
2026-05-21 17:15   ` Marcelo Schmitt
2026-05-22 11:59     ` Jonathan Cameron
2026-05-19  8:13 ` [PATCH v2 4/7] iio: dac: max5821: Drop unused i2c driver data Uwe Kleine-König (The Capable Hub)
2026-05-19 19:06   ` Jonathan Cameron
2026-05-19  8:13 ` [PATCH v2 5/7] iio: proximity: sx9324: Drop unused " Uwe Kleine-König (The Capable Hub)
2026-05-19 19:08   ` Jonathan Cameron
2026-05-19  8:13 ` [PATCH v2 6/7] iio: proximity: sx9360: " Uwe Kleine-König (The Capable Hub)
2026-05-19 19:09   ` Jonathan Cameron
2026-05-19  8:13 ` [PATCH v2 7/7] iio: Initialize i2c_device_id arrays using member names Uwe Kleine-König (The Capable Hub)
2026-05-19 11:35   ` Matti Vaittinen
2026-05-19 15:46   ` Sirat
2026-05-19 18:39   ` Jonathan Cameron
2026-05-19 19:51     ` Uwe Kleine-König (The Capable Hub)
2026-05-21 12:04       ` Jonathan Cameron
2026-05-21 13:20         ` Uwe Kleine-König (The Capable Hub)
2026-05-22 11:10           ` Jonathan Cameron [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=20260522121032.1598fa09@jic23-huawei \
    --to=jic23@kernel.org \
    --cc=579lpy@gmail.com \
    --cc=Frank.Li@nxp.com \
    --cc=Michael.Hennerich@analog.com \
    --cc=afd@ti.com \
    --cc=ak@it-klinger.de \
    --cc=akhilesh@ee.iitb.ac.in \
    --cc=aldocontelk@gmail.com \
    --cc=andy@kernel.org \
    --cc=anshulusr@gmail.com \
    --cc=antoniu.miclaus@analog.com \
    --cc=apokusinski01@gmail.com \
    --cc=ariana.lazar@microchip.com \
    --cc=bartosz.golaszewski@oss.qualcomm.com \
    --cc=bcollins@watter.com \
    --cc=beatrizvianacosta16@gmail.com \
    --cc=benato.denis96@gmail.com \
    --cc=bigeasy@linutronix.de \
    --cc=ceggers@arri.de \
    --cc=chuguangqing@inspur.com \
    --cc=cmo@melexis.com \
    --cc=colin.i.king@gmail.com \
    --cc=dan@dlrobertson.com \
    --cc=david@protonic.nl \
    --cc=dixitparmar19@gmail.com \
    --cc=dlechner@baylibre.com \
    --cc=eajames@linux.ibm.com \
    --cc=email@sirat.me \
    --cc=ethantidmore06@gmail.com \
    --cc=fluturel.adrian@gmail.com \
    --cc=francesco@dolcini.it \
    --cc=gabevictor333@gmail.com \
    --cc=gabrielsousa230@gmail.com \
    --cc=gerald.loacker@wolfvision.net \
    --cc=giorgitchankvetadze1997@gmail.com \
    --cc=git@chuang.cz \
    --cc=gustavo.vaz@usp.br \
    --cc=gustavograzs@gmail.com \
    --cc=herve.codina@bootlin.com \
    --cc=hvilleneuve@dimonoff.com \
    --cc=i.shihao.999@gmail.com \
    --cc=jagathjog1996@gmail.com \
    --cc=javier.carrasco.cruz@gmail.com \
    --cc=jean-baptiste.maneyrol@tdk.com \
    --cc=jpaulo.silvagoncalves@gmail.com \
    --cc=ktsai@capellamicro.com \
    --cc=kuurtb@gmail.com \
    --cc=kylehsieh1995@gmail.com \
    --cc=lanzano.alex@gmail.com \
    --cc=lars@metafoo.de \
    --cc=linusw@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=lorenzo@kernel.org \
    --cc=marcelo.schmitt@analog.com \
    --cc=marcus.folkesson@gmail.com \
    --cc=mazziesaccount@gmail.com \
    --cc=megi@xff.cz \
    --cc=muditsharma.info@gmail.com \
    --cc=nuno.sa@analog.com \
    --cc=o.rempel@pengutronix.de \
    --cc=petar.stoykov@prodrive-technologies.com \
    --cc=petre.rodan@subdimension.ro \
    --cc=puranjay@kernel.org \
    --cc=ramona.gradinariu@analog.com \
    --cc=raskar.shree97@gmail.com \
    --cc=remi.buisson@tdk.com \
    --cc=rmfrfs@gmail.com \
    --cc=romain.gantois@bootlin.com \
    --cc=sakari.ailus@linux.intel.com \
    --cc=sander@svanheule.net \
    --cc=songqiang1304521@gmail.com \
    --cc=srinivas.pandruvada@linux.intel.com \
    --cc=tduszyns@gmail.com \
    --cc=tomasborquez13@gmail.com \
    --cc=u.kleine-koenig@baylibre.com \
    --cc=ustc.gu@gmail.com \
    --cc=waqar.hameed@axis.com \
    --cc=wens@kernel.org \
    --cc=xerikasxx@gmail.com \
    --cc=yasin.lee.x@gmail.com \
    --cc=zhao.xichao@vivo.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