Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Mark Brown <broonie@kernel.org>
To: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Cc: Liam Girdwood <liam.r.girdwood@linux.intel.com>,
	alsa-devel@alsa-project.org, Liam Girdwood <lgirdwood@gmail.com>
Subject: Re: [PATCH] ASoC: Intel: Add Baytrail byt-max98090 machine driver
Date: Fri, 16 May 2014 19:54:29 +0100	[thread overview]
Message-ID: <20140516185429.GR22111@sirena.org.uk> (raw)
In-Reply-To: <1400248684-21960-1-git-send-email-jarkko.nikula@linux.intel.com>


[-- Attachment #1.1: Type: text/plain, Size: 2377 bytes --]

On Fri, May 16, 2014 at 04:58:04PM +0300, Jarkko Nikula wrote:

> +	snd_soc_dapm_enable_pin(dapm, "Headset Mic");
> +	snd_soc_dapm_enable_pin(dapm, "Headphone");
> +	snd_soc_dapm_enable_pin(dapm, "Ext Spk");
> +	snd_soc_dapm_enable_pin(dapm, "Int Mic");
> +
> +	snd_soc_dapm_sync(dapm);

None of the above code should have any effect - pins are enabled by
default and syncs suppressed until probe is complete.

> +
> +	/*
> +	 * ASoC still uses legacy GPIOs so we look both GPIOs using
> +	 * descriptors here, convert them to numbers and release the
> +	 * acquired descriptors. Once ASoC switches over to GPIO descriptor
> +	 * APIs we can pass them directly.
> +	 */

You could just add the required support to the framework...  it seems
quicker and simpler.

> +	hp_desc = gpiod_get_index(card->dev->parent, NULL, 0);
> +	if (IS_ERR(hp_desc))
> +		return 0;

This just eats errors, it's broken for deferred probe.

> +	snd_soc_jack_report(jack, SND_JACK_LINEOUT | SND_JACK_LINEIN,
> +			    SND_JACK_HEADSET | SND_JACK_LINEOUT |
> +			    SND_JACK_LINEIN);

Why is this here?

> +#ifdef CONFIG_PM_SLEEP
> +static const struct dev_pm_ops byt_max98090_pm_ops = {
> +	.suspend = snd_soc_suspend,
> +	.resume = snd_soc_resume,
> +};
> +
> +#define BYT_MAX98090_PM_OPS	(&byt_max98090_pm_ops)
> +#else
> +#define BYT_MAX98090_PM_OPS	NULL
> +#endif

Why not just use snd_soc_pm_ops?

> +	drv = devm_kzalloc(&pdev->dev, sizeof(*drv), GFP_ATOMIC);
> +	if (!drv) {
> +		dev_err(&pdev->dev, "allocation failed\n");
> +		return -ENOMEM;
> +	}

The allocator is already quite noisy of it goes OOM, no need to print.

> +	ret_val = snd_soc_register_card(&byt_max98090_card);
> +	if (ret_val) {

devm_snd_soc_register_card().

> +static int byt_max98090_remove(struct platform_device *pdev)
> +{
> +	struct snd_soc_card *soc_card = platform_get_drvdata(pdev);
> +	struct byt_max98090_private *drv = snd_soc_card_get_drvdata(soc_card);
> +
> +	snd_soc_jack_free_gpios(&drv->jack, ARRAY_SIZE(hs_jack_gpios),
> +				hs_jack_gpios);

> +	snd_soc_card_set_drvdata(soc_card, NULL);
> +	snd_soc_unregister_card(soc_card);
> +	platform_set_drvdata(pdev, NULL);

Setting the data to NULL on removal is just a waste of time and is done
by the core anyway.

You're freeing these in the device level remove path but allocating them
in the ASoC level probe path.  They should be managed consistently.

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



  reply	other threads:[~2014-05-16 18:54 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-16 13:58 [PATCH] ASoC: Intel: Add Baytrail byt-max98090 machine driver Jarkko Nikula
2014-05-16 18:54 ` Mark Brown [this message]
2014-05-19  7:56   ` Jarkko Nikula

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=20140516185429.GR22111@sirena.org.uk \
    --to=broonie@kernel.org \
    --cc=alsa-devel@alsa-project.org \
    --cc=jarkko.nikula@linux.intel.com \
    --cc=lgirdwood@gmail.com \
    --cc=liam.r.girdwood@linux.intel.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