Re: [PATCH v1 2/3] ASoC: rt5677: Use device_get_match_data()

From: Andy Shevchenko
Date: Thu Jun 29 2023 - 07:10:07 EST


On Thu, Jun 29, 2023 at 11:56:10AM +0100, Mark Brown wrote:
> On Thu, Jun 29, 2023 at 01:46:02PM +0300, Andy Shevchenko wrote:

...

> > + rt5677->type = (enum rt5677_type)(uintptr_t)device_get_match_data(dev);

> Double casts, always a sign of a successful simplification! :P

Unfortunate of the C language and use of plain numbers when
pointers are required. :-( I feel your pain.

> > + if (rt5677->type == 0)
> > return -EINVAL;
> > - }

I would prefer to see in the ID table something like

.compatible = "foo", .data = &codec[RT5677],

but in this driver it seems it will require quite a refactoring.

--
With Best Regards,
Andy Shevchenko