mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Link Mauve <linkmauve@linkmauve.fr>
To: "Uwe Kleine-König" <u.kleine-koenig@baylibre.com>
Cc: Link Mauve <linkmauve@linkmauve.fr>,
	linux-media@vger.kernel.org,
	Sakari Ailus <sakari.ailus@linux.intel.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Hans Verkuil <hverkuil+cisco@kernel.org>,
	Bradford Love <brad@nextdimension.cc>,
	Kees Cook <kees@kernel.org>,
	Deepanshu Kartikey <kartikey406@gmail.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/3] media: ts2020: put regmap_config on the stack
Date: Mon, 21 Sep 2026 19:00:55 +0200	[thread overview]
Message-ID: <arFixwvATR2hkp68@desktop> (raw)
In-Reply-To: <arA3TaFiFOx7ubjj@monoceros>

On Sun, Sep 20, 2026 at 09:46:42PM +0200, Uwe Kleine-König wrote:
> Hello,
> 
> On Tue, Aug 04, 2026 at 01:46:23PM +0200, Link Mauve wrote:
> > diff --git a/drivers/media/dvb-frontends/ts2020.c b/drivers/media/dvb-frontends/ts2020.c
> > index 8775083f4dd6..27f096ce522e 100644
> > --- a/drivers/media/dvb-frontends/ts2020.c
> > +++ b/drivers/media/dvb-frontends/ts2020.c
> > @@ -18,7 +18,6 @@
> >  struct ts2020_priv {
> >  	struct i2c_client *client;
> >  	struct mutex regmap_mutex;
> > -	struct regmap_config regmap_config;
> >  	struct regmap *regmap;
> >  	struct dvb_frontend *fe;
> >  	struct delayed_work stat_work;
> > @@ -559,6 +558,12 @@ static int ts2020_probe(struct i2c_client *client)
> >  	u8 u8tmp;
> >  	unsigned int utmp;
> >  	char *chip_str;
> > +	struct regmap_config regmap_config = {
> > +		.reg_bits = 8,
> > +		.val_bits = 8,
> > +		.lock = ts2020_regmap_lock,
> > +		.unlock = ts2020_regmap_unlock,
> > +	};
> >  
> >  	if (!pdata) {
> >  		dev_err(&client->dev, "platform data is mandatory\n");
> > @@ -574,12 +579,8 @@ static int ts2020_probe(struct i2c_client *client)
> >  
> >  	/* create regmap */
> >  	mutex_init(&dev->regmap_mutex);
> > -	dev->regmap_config.reg_bits = 8;
> > -	dev->regmap_config.val_bits = 8;
> > -	dev->regmap_config.lock = ts2020_regmap_lock;
> > -	dev->regmap_config.unlock = ts2020_regmap_unlock;
> > -	dev->regmap_config.lock_arg = dev;
> > -	dev->regmap = regmap_init_i2c(client, &dev->regmap_config);
> > +	regmap_config.lock_arg = dev;
> 
> If desired you can keep all the assignments here using:
> 
> 	regmap_config = (typeof(regmap_config)){
> 		.reg_bits = 8,
> 		.val_bits = 8,
> 		.lock = ts2020_regmap_lock,
> 		.unlock = ts2020_regmap_unlock,
> 		.lock_arg = dev,
> 	};
> 
> > +	dev->regmap = regmap_init_i2c(client, &regmap_config);

I think I still prefer my approach, there is very little usage of the
typeof() pattern in the kernel, the only benefit would be to keep
lock_arg in the same location as the rest of the initial values.

> 
> With or without that approach:
> 
> Acked-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>

Thanks!

> 
> Best regards
> Uwe

-- 
Link Mauve

  reply	other threads:[~2026-09-21 17:01 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-04 11:46 [PATCH 0/3] Remove regmap_config struct from allocated data Link Mauve
2026-08-04 11:46 ` [PATCH 1/3] media: rtl2832: make regmap_config static const Link Mauve
2026-08-04 11:46 ` [PATCH 2/3] media: m88ds3103: " Link Mauve
2026-08-04 11:46 ` [PATCH 3/3] media: ts2020: put regmap_config on the stack Link Mauve
2026-09-20 19:46   ` Uwe Kleine-König
2026-09-21 17:00     ` Link Mauve [this message]
2026-09-21 18:45       ` Uwe Kleine-König
2026-09-20 16:31 ` [PATCH 0/3] Remove regmap_config struct from allocated data Link Mauve

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=arFixwvATR2hkp68@desktop \
    --to=linkmauve@linkmauve.fr \
    --cc=brad@nextdimension.cc \
    --cc=hverkuil+cisco@kernel.org \
    --cc=kartikey406@gmail.com \
    --cc=kees@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=sakari.ailus@linux.intel.com \
    --cc=u.kleine-koenig@baylibre.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

all inboxes | Powered by JetHome®