From: Mark Brown <broonie@opensource.wolfsonmicro.com>
To: Zeng Zhaoming <zengzm.kernel@gmail.com>
Cc: alsa-devel@alsa-project.org, s.hauer@pengutronix.de,
timur.tabi@gmail.com, xiao-lizhang@freescale.com,
zhaoming.zeng@freescale.com, lrg@slimlogic.co.uk,
arnaud.patard@rtp-net.org, linuxzsc@gmail.com
Subject: Re: [PATCH v5] ASoC: Add Freescale SGTL5000 codec support
Date: Mon, 28 Feb 2011 14:45:26 +0000 [thread overview]
Message-ID: <20110228144526.GG13869@opensource.wolfsonmicro.com> (raw)
In-Reply-To: <AANLkTikpBB5vVKj+Y2EfbjfC=6aigeCjaqZ9mz9+qWuF@mail.gmail.com>
On Fri, Feb 25, 2011 at 11:56:52PM +0800, Zeng Zhaoming wrote:
> On Fri, Feb 25, 2011 at 8:09 PM, Mark Brown
> > This is going to fail on systems without voltage readback capabilities,
> > including systems which have the regulator API disabled and stubbed out.
> if the regulator driver not allow readback, I have no way to get the
> voltage of vdda and vddio,
> the voltage levels are critical to codec initialization.
> Can you shed some light on howto around this?
If you can't read the data back you need to guess what the configuration
is somehow; I'd suggest just picking values and warning about what
you're doing.
> >> + memcpy((void *)(&sgtl5000_regs[0] + (SGTL5000_DAP_REG_OFFSET >> 1)),
> >> + sgtl5000_dap_regs,
> >> + SGTL5000_MAX_REG_OFFSET - SGTL5000_DAP_REG_OFFSET);
> > As has been pointed out on previous revisions of the patch there is no
> > need to cast away from void in C and it can be actively harmful.
> I have not remove void* since my toolchain ( gcc 4.4.4) complains
> about the type mismatch, I will test
> it with other version toolchain to confirm.
As Timur indicated the reason this is complaining is that you're
memcpy() is writing to const data. This is *clearly* buggy - the fact
that casting away removes the warning is an example of why you should
never have casts like this.
You should take a copy of the array and modify that, having the defaults
as const is correct.
prev parent reply other threads:[~2011-02-28 14:45 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-23 18:08 [PATCH v5] ASoC: Add Freescale SGTL5000 codec support zhaoming.zeng
2011-02-25 9:13 ` Liam Girdwood
2011-02-25 12:09 ` Mark Brown
[not found] ` <AANLkTikpBB5vVKj+Y2EfbjfC=6aigeCjaqZ9mz9+qWuF@mail.gmail.com>
2011-02-25 16:13 ` Timur Tabi
2011-02-25 23:01 ` Timur Tabi
2011-02-28 14:45 ` Mark Brown [this message]
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=20110228144526.GG13869@opensource.wolfsonmicro.com \
--to=broonie@opensource.wolfsonmicro.com \
--cc=alsa-devel@alsa-project.org \
--cc=arnaud.patard@rtp-net.org \
--cc=linuxzsc@gmail.com \
--cc=lrg@slimlogic.co.uk \
--cc=s.hauer@pengutronix.de \
--cc=timur.tabi@gmail.com \
--cc=xiao-lizhang@freescale.com \
--cc=zengzm.kernel@gmail.com \
--cc=zhaoming.zeng@freescale.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;
as well as URLs for NNTP newsgroup(s).