lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 22 Mar 2011 17:00:55 +0100
From:	Ingo Molnar <mingo@...e.hu>
To:	Takashi Iwai <tiwai@...e.de>
Cc:	Randy Dunlap <randy.dunlap@...cle.com>,
	Mark Brown <broonie@...nsource.wolfsonmicro.com>,
	Linus Torvalds <torvalds@...ux-foundation.org>,
	Jaroslav Kysela <perex@...ex.cz>,
	Liam Girdwood <lrg@...mlogic.co.uk>,
	Andrew Morton <akpm@...ux-foundation.org>,
	linux-kernel@...r.kernel.org, Zeng Zhaoming <b32542@...escale.com>
Subject: Re: [build failure] Re: [GIT PULL] sound updates for 2.6.39-rc1


* Takashi Iwai <tiwai@...e.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@...nsource.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@...nsource.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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ