[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <OS0PR01MB592289296A66DD07BF6077B286E7A@OS0PR01MB5922.jpnprd01.prod.outlook.com>
Date: Tue, 29 Aug 2023 18:01:35 +0000
From: Biju Das <biju.das.jz@...renesas.com>
To: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
CC: James Schulman <james.schulman@...rus.com>,
David Rhodes <david.rhodes@...rus.com>,
Richard Fitzgerald <rf@...nsource.cirrus.com>,
Jaroslav Kysela <perex@...ex.cz>,
Takashi Iwai <tiwai@...e.com>,
Liam Girdwood <lgirdwood@...il.com>,
Mark Brown <broonie@...nel.org>,
"alsa-devel@...a-project.org" <alsa-devel@...a-project.org>,
"patches@...nsource.cirrus.com" <patches@...nsource.cirrus.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Charles Keepax <ckeepax@...nsource.cirrus.com>
Subject: RE: [PATCH v2] ASoC: cs42xx8-i2c: Simplify probe()
Hi Andy,
> Subject: Re: [PATCH v2] ASoC: cs42xx8-i2c: Simplify probe()
>
> On Mon, Aug 28, 2023 at 06:48:56PM +0100, Biju Das wrote:
> > Simplify probe() by replacing of_match_device->i2c_get_match_data()
> > and extend matching support for ID table. Also replace
> > dev_err()->dev_err_probe() to simplify the code.
>
> ...
>
> Can also be
>
> struct device *dev = &i2c->dev;
>
> > int ret;
> > struct cs42xx8_driver_data *drvdata;
> > - const struct of_device_id *of_id;
> > -
> > - of_id = of_match_device(cs42xx8_of_match, &i2c->dev);
> > - if (!of_id) {
> > - dev_err(&i2c->dev, "failed to find driver data\n");
> > - return -EINVAL;
> > - }
> >
> > - drvdata = (struct cs42xx8_driver_data *)of_id->data;
> > + drvdata = (struct cs42xx8_driver_data *)i2c_get_match_data(i2c);
> > + if (!drvdata)
>
> > + return dev_err_probe(&i2c->dev, -EINVAL,
> > + "failed to find driver data\n");
>
> return dev_err_probe(dev, -EINVAL, "failed to find driver
> data\n");
True,
Cheers,
Biju
Powered by blists - more mailing lists