Re: [PATCH v2 1/1] ASoC: Intel: catpt: remove duplicating driver data retrieval

From: Cezary Rojewski
Date: Tue Jul 05 2022 - 09:23:29 EST


On 2022-07-04 6:20 PM, Andy Shevchenko wrote:
On Mon, Jul 04, 2022 at 10:36:33AM +0300, Péter Ujfalusi wrote:
On 03/07/2022 17:51, Andy Shevchenko wrote:

...

We could just pass the "(const struct catpt_spec *)id->driver_data" in
place of spec to catpt_dev_init() and we can get rid of the local
temporary pointer?

I would not go this way for non-POD types.


Agree with Andy here.

If not, then I would cast out the spec before it's use:
spec = (const struct catpt_spec *)id->driver_data;
catpt_dev_init(cdev, dev, spec);

This I can do (as well as in the other patch).


Agree with Peter's suggestion here too.


Thank you both for taking time in improving driver's quality!

Regards,
Czarek