linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mark Brown <broonie@kernel.org>
To: Richard Fitzgerald <rf@opensource.wolfsonmicro.com>
Cc: lgirdwood@gmail.com, patches@opensource.wolfsonmicro.com,
	alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ASoC: wm_adsp: Add basic debugfs entries
Date: Mon, 8 Jun 2015 18:40:41 +0100	[thread overview]
Message-ID: <20150608174041.GK14071@sirena.org.uk> (raw)
In-Reply-To: <1433774222-25103-1-git-send-email-rf@opensource.wolfsonmicro.com>

[-- Attachment #1: Type: text/plain, Size: 2218 bytes --]

On Mon, Jun 08, 2015 at 03:37:02PM +0100, Richard Fitzgerald wrote:

> +++ b/sound/soc/codecs/wm5102.c
> @@ -1875,6 +1875,8 @@ static int wm5102_codec_probe(struct snd_soc_codec *codec)
>  	struct wm5102_priv *priv = snd_soc_codec_get_drvdata(codec);
>  	int ret;
>  
> +	wm_adsp_init_debugfs(&priv->core.adsp[0], codec);
> +

Why are we adding this init to every individual CODEC rather than doing
it when we initialize the DSP (which there are calls for already)?

> +#ifdef CONFIG_DEBUG_FS
> +static void wm_adsp_debugfs_save_wmfwname(struct wm_adsp *dsp, const char *s);
> +static void wm_adsp_debugfs_save_binname(struct wm_adsp *dsp, const char *s);
> +static void wm_adsp_debugfs_clear(struct wm_adsp *dsp);
> +#else
> +static inline void wm_adsp_debugfs_save_wmfwname(struct wm_adsp *dsp,
> +						 const char *s)
> +{
> +}
> +
> +static inline void wm_adsp_debugfs_save_binname(struct wm_adsp *dsp,
> +						const char *s)
> +{
> +}
> +
> +static inline void wm_adsp_debugfs_clear(struct wm_adsp *dsp)
> +{
> +}
> +#endif
> +

Why not just put the functions here rather than prototypes?

> +static ssize_t wm_adsp_debugfs_string_read(struct wm_adsp *dsp,
> +					  char __user *user_buf,
> +					  size_t count, loff_t *ppos,
> +					  const char *string)
> +{
> +	char *temp;
> +	int len;
> +	ssize_t ret;
> +
> +	if (!string || !dsp->running)
> +		return 0;

Does debugfs ensure that the right thing happens and this gets treated
as EOF rather than a "zero length read, please retry" (which something
might decide to busy wait trying)?  I'd have expected either an error or
substituting in an empty/informative string here.

> +	temp = kmalloc(PAGE_SIZE, GFP_KERNEL);
> +	if (!temp)
> +		return -ENOMEM;
> +
> +	len = snprintf(temp, PAGE_SIZE, "%s\n", string);

Given that we already have the string I don't understand why we're
allocating the temporary buffer - if it's just the length we're looking
for then strlen() should be enough?

> +} wm_adsp_debugfs_fops[] = {
> +	{
> +		.name = "wmfw_file",

> +		.name = "bin_file",

Bikeshedding but _name not _file perhaps?  It's not going to give you a
copy of the firmware/coefficients.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

  reply	other threads:[~2015-06-08 17:40 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-08 14:37 [PATCH] ASoC: wm_adsp: Add basic debugfs entries Richard Fitzgerald
2015-06-08 17:40 ` Mark Brown [this message]
2015-06-09 12:06   ` Richard Fitzgerald
2015-06-09 15:49     ` Mark Brown
2015-06-09 14:57   ` Richard Fitzgerald

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=20150608174041.GK14071@sirena.org.uk \
    --to=broonie@kernel.org \
    --cc=alsa-devel@alsa-project.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=patches@opensource.wolfsonmicro.com \
    --cc=rf@opensource.wolfsonmicro.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).