linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@elte.hu>
To: Takashi Iwai <tiwai@suse.de>
Cc: Randy Dunlap <randy.dunlap@oracle.com>,
	Mark Brown <broonie@opensource.wolfsonmicro.com>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Jaroslav Kysela <perex@perex.cz>,
	Liam Girdwood <lrg@slimlogic.co.uk>,
	Andrew Morton <akpm@linux-foundation.org>,
	linux-kernel@vger.kernel.org,
	Zeng Zhaoming <b32542@freescale.com>
Subject: Re: [build failure] Re: [GIT PULL] sound updates for 2.6.39-rc1
Date: Tue, 22 Mar 2011 17:00:55 +0100	[thread overview]
Message-ID: <20110322160055.GA22128@elte.hu> (raw)
In-Reply-To: <s5hk4frnog6.wl%tiwai@suse.de>


* Takashi Iwai <tiwai@suse.de> wrote:

> At Tue, 22 Mar 2011 08:38:39 -0700,
> Randy Dunlap wrote:
> > 
> > On Tue, 22 Mar 2011 12:24:36 +0000 Mark Brown wrote:
> > 
> > > On Mon, Mar 21, 2011 at 04:58:27PM +0000, Mark Brown wrote:
> > > > That's the breakage, yes.  It should be very straightforward to make the
> > > > driver build no matter how CONFIG_REGULATOR is set.
> > > 
> > > And indeed it was - in the absence of any response from Zeng I've now
> > > sent a patch for review.
> > > --
> > 
> > Hi,
> > Where was the patch sent, please?
> 
> alsa-devel ML.  Attached below.
> 
> 
> Takashi
> 
> ===
> From: Mark Brown <broonie@opensource.wolfsonmicro.com>
> Subject: [alsa-devel] [PATCH] ASoC: Support !REGULATOR build for sgtl5000
> 
> The regulator is optional depending on board design.
> 
> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
> ---
>  sound/soc/codecs/sgtl5000.c |   14 ++++++++++++++
>  1 files changed, 14 insertions(+), 0 deletions(-)
> 
> diff --git a/sound/soc/codecs/sgtl5000.c b/sound/soc/codecs/sgtl5000.c
> index 1f7217f..ff29380 100644
> --- a/sound/soc/codecs/sgtl5000.c
> +++ b/sound/soc/codecs/sgtl5000.c
> @@ -772,6 +772,7 @@ static int sgtl5000_pcm_hw_params(struct snd_pcm_substream *substream,
>  	return 0;
>  }
>  
> +#ifdef CONFIG_REGULATOR
>  static int ldo_regulator_is_enabled(struct regulator_dev *dev)
>  {
>  	struct ldo_regulator *ldo = rdev_get_drvdata(dev);
> @@ -901,6 +902,19 @@ static int ldo_regulator_remove(struct snd_soc_codec *codec)
>  
>  	return 0;
>  }
> +#else
> +static int ldo_regulator_register(struct snd_soc_codec *codec,
> +				struct regulator_init_data *init_data,
> +				int voltage)
> +{
> +	return -EINVAL;
> +}
> +
> +static int ldo_regulator_remove(struct snd_soc_codec *codec)
> +{
> +	return 0;
> +}
> +#endif

Btw., ldo_regulator_remove() returns an int, but none of the call sites make 
use of the return value. Also, ldo_regulator_remove() can only ever return 0.

More importantly, it would be cleaner to wrap the !regulator case by making 
sgtl5000->ldo NULL (this should already be the case) and making 
regulator_unregister() available in the !REGULATOR case as well, as an inline 
stub.

If that is done then the #ifdef can be avoided altogether and the current code 
would just work out of box:

static int ldo_regulator_remove(struct snd_soc_codec *codec)
{
        struct sgtl5000_priv *sgtl5000 = snd_soc_codec_get_drvdata(codec);
        struct ldo_regulator *ldo = sgtl5000->ldo;

        if (!ldo)
                return 0;

        regulator_unregister(ldo->dev);
        kfree(ldo->desc.name);
        kfree(ldo);

        return 0;
}

Thanks,

	Ingo

  parent reply	other threads:[~2011-03-22 16:01 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-18 14:05 [GIT PULL] sound updates for 2.6.39-rc1 Takashi Iwai
2011-03-21 15:37 ` [build failure] " Ingo Molnar
2011-03-21 15:42   ` Randy Dunlap
2011-03-21 15:56   ` Takashi Iwai
2011-03-21 15:58   ` Mark Brown
2011-03-21 16:11     ` Ingo Molnar
2011-03-21 16:38       ` Mark Brown
2011-03-21 16:49         ` Ingo Molnar
2011-03-21 16:58           ` Mark Brown
2011-03-22 12:24             ` Mark Brown
2011-03-22 15:38               ` Randy Dunlap
2011-03-22 15:50                 ` Mark Brown
2011-03-22 15:51                 ` Takashi Iwai
2011-03-22 15:57                   ` Randy Dunlap
2011-03-22 16:00                   ` Ingo Molnar [this message]
2011-03-22 16:41                     ` 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=20110322160055.GA22128@elte.hu \
    --to=mingo@elte.hu \
    --cc=akpm@linux-foundation.org \
    --cc=b32542@freescale.com \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lrg@slimlogic.co.uk \
    --cc=perex@perex.cz \
    --cc=randy.dunlap@oracle.com \
    --cc=tiwai@suse.de \
    --cc=torvalds@linux-foundation.org \
    /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;
as well as URLs for NNTP newsgroup(s).