Re: [PATCH 3/3] media: ts2020: put regmap_config on the stack
From: Uwe Kleine-König
Date: Mon Sep 21 2026 - 14:46:11 EST
Hello,
On Mon, Sep 21, 2026 at 07:00:55PM +0200, Link Mauve wrote:
> On Sun, Sep 20, 2026 at 09:46:42PM +0200, Uwe Kleine-König wrote:
> > 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, ®map_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.
If it's just the typeof you don't like, you can also use:
regmap_config = (struct regmap_config){
.reg_bits = 8,
...
};
🤷
Best regards
Uwe
Attachment:
signature.asc
Description: PGP signature