Re: [PATCH] ASoC: tlv320aic32x4-i2c: Simplify probe()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Aug 28, 2023 at 11:48:28AM +0000, Biju Das wrote:
> > On Sun, Aug 27, 2023 at 10:45:36AM +0100, Biju Das wrote:

...

> > > +	dev_set_drvdata(&i2c->dev, (void *)i2c_get_match_data(i2c));
> > 
> > You (potentially) drop const qualifier here. It's not good and it's not
> > explained in the commit message why.
> 
> dev_set_drvdata() needs non-const void*, otherwise I get warning.
> The original code also use this cast. That is the reason it is not
> explained in commit message.

Maybe it shouldn't use this pointer directly then?


aic32x4_probe() has these lines

        aic32x4->type = (uintptr_t)dev_get_drvdata(dev);
        dev_set_drvdata(dev, aic32x4);

Dragging data like this makes a little sense to me. What you should do is to
have a precursor patch that adds a third parameter to ->probe().

Also it makes sense to all your improvements for -i2c.c do similar to all
-spi.c cases where it applies.

-- 
With Best Regards,
Andy Shevchenko





[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Pulse Audio]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux