All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Henningsson <david.henningsson@canonical.com>
To: Takashi Iwai <tiwai@suse.de>, alsa-devel@alsa-project.org
Subject: Re: [PATCH RFC 3/7] ALSA: hda - Make snd_hda_jack_detect_enable_callbac() returning the jack object
Date: Thu, 11 Sep 2014 16:44:40 +0200	[thread overview]
Message-ID: <5411B558.2010001@canonical.com> (raw)
In-Reply-To: <1410445157-23198-4-git-send-email-tiwai@suse.de>


Nitpick: s/callbac/callback and s/returning/return in subject

On 2014-09-11 16:19, Takashi Iwai wrote:
> STAC/IDT driver calls snd_hda_jack_tbl_get() again after calling
> snd_hda_jack_detect_enable_callback().  For simplifying this, let's
> make snd_hda_jack_detect_enable_callback() returning the pointer while
> handling the error with the standard IS_ERR() & co.
>
> Signed-off-by: Takashi Iwai <tiwai@suse.de>
> ---
>   sound/pci/hda/hda_jack.c       | 20 +++++++++++++-------
>   sound/pci/hda/hda_jack.h       |  5 +++--
>   sound/pci/hda/patch_sigmatel.c | 14 ++++++--------
>   3 files changed, 22 insertions(+), 17 deletions(-)
>
> diff --git a/sound/pci/hda/hda_jack.c b/sound/pci/hda/hda_jack.c
> index 7f332794993f..27fccd2c8d41 100644
> --- a/sound/pci/hda/hda_jack.c
> +++ b/sound/pci/hda/hda_jack.c
> @@ -215,28 +215,34 @@ EXPORT_SYMBOL_GPL(snd_hda_jack_detect_state);
>   /**
>    * snd_hda_jack_detect_enable - enable the jack-detection
>    */
> -int snd_hda_jack_detect_enable_callback(struct hda_codec *codec, hda_nid_t nid,
> -					hda_jack_callback cb)
> +struct hda_jack_tbl *
> +snd_hda_jack_detect_enable_callback(struct hda_codec *codec, hda_nid_t nid,
> +				    hda_jack_callback cb)

I have not seen the ERR_PTR usage before and it's not used commonly in 
the hda driver, so I think it's important to document that it can return 
a non-null pointer that is not a valid hda_jack_tbl. Looks dangerous 
otherwise.

-- 
David Henningsson, Canonical Ltd.
https://launchpad.net/~diwic

  reply	other threads:[~2014-09-11 14:44 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-11 14:19 [PATCH RFC 0/7] Allow multiple callbacks for hda_jack Takashi Iwai
2014-09-11 14:19 ` [PATCH RFC 1/7] ALSA: hda - Get rid of action field from struct hda_jack_tbl Takashi Iwai
2014-09-11 14:19 ` [PATCH RFC 2/7] ALSA: hda - Make snd_hda_jack_tbl_new() static Takashi Iwai
2014-09-11 14:19 ` [PATCH RFC 3/7] ALSA: hda - Make snd_hda_jack_detect_enable_callbac() returning the jack object Takashi Iwai
2014-09-11 14:44   ` David Henningsson [this message]
2014-09-15  8:40     ` Takashi Iwai
2014-09-11 14:19 ` [PATCH RFC 4/7] ALSA: hda - Allow multiple callbacks for jack Takashi Iwai
2014-09-11 15:01   ` David Henningsson
2014-09-15  8:41     ` Takashi Iwai
2014-09-11 14:19 ` [PATCH RFC 5/7] ALSA: hda - Remove superfluous callbacks from STAC/IDT codecs Takashi Iwai
2014-09-11 14:19 ` [PATCH RFC 6/7] ALSA: hda - Remove superfluous hooks from VIA driver Takashi Iwai
2014-09-11 14:19 ` [PATCH RFC 7/7] ALSA: hda - Use standard hda_jack infrastructure for CA0132 driver Takashi Iwai
2014-09-11 15:14 ` [PATCH RFC 0/7] Allow multiple callbacks for hda_jack David Henningsson
2014-09-15  8:42   ` Takashi Iwai
2014-09-15 12:11     ` Takashi Iwai
2014-09-16  8:33       ` David Henningsson
2014-09-16 14:36         ` Takashi Iwai

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=5411B558.2010001@canonical.com \
    --to=david.henningsson@canonical.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=tiwai@suse.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.