mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Biju Das <biju.das.jz@bp.renesas.com>
Cc: James Schulman <james.schulman@cirrus.com>,
	David Rhodes <david.rhodes@cirrus.com>,
	Richard Fitzgerald <rf@opensource.cirrus.com>,
	Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Mark Brown <broonie@kernel.org>,
	alsa-devel@alsa-project.org, patches@opensource.cirrus.com,
	linux-kernel@vger.kernel.org,
	Charles Keepax <ckeepax@opensource.cirrus.com>
Subject: Re: [PATCH v2] ASoC: cs42xx8-i2c: Simplify probe()
Date: Tue, 29 Aug 2023 18:19:33 +0300	[thread overview]
Message-ID: <ZO4MhWUmamTqJvXd@smile.fi.intel.com> (raw)
In-Reply-To: <20230828174856.122559-1-biju.das.jz@bp.renesas.com>

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");

-- 
With Best Regards,
Andy Shevchenko



  reply	other threads:[~2023-08-29 15:20 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-28 17:48 Biju Das
2023-08-29 15:19 ` Andy Shevchenko [this message]
2023-08-29 18:01   ` Biju Das
2023-09-11 23:57 ` Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZO4MhWUmamTqJvXd@smile.fi.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=biju.das.jz@bp.renesas.com \
    --cc=broonie@kernel.org \
    --cc=ckeepax@opensource.cirrus.com \
    --cc=david.rhodes@cirrus.com \
    --cc=james.schulman@cirrus.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=patches@opensource.cirrus.com \
    --cc=perex@perex.cz \
    --cc=rf@opensource.cirrus.com \
    --cc=tiwai@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®