All of lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: James Courtier-Dutton <james.dutton@gmail.com>
Cc: alsa-devel@alsa-project.org
Subject: Re: RFC: snd_card_create() function
Date: Mon, 12 Jan 2009 15:47:48 +0100	[thread overview]
Message-ID: <s5h4p04d1ij.wl%tiwai@suse.de> (raw)
In-Reply-To: <ad2655cb0901120642h542f2a5s9f3e9bb05e6e176c@mail.gmail.com>

At Mon, 12 Jan 2009 14:42:06 +0000,
James Courtier-Dutton wrote:
> 
> Sounds good to me.
> One can keep the wrapper outside of the kernel, and only available in
> alsa-driver for those out of tree people.

Yes, that's good.
I think it'd be better to do that after one kernel-cycle later for a
softer landing, though.


thanks,

Takashi


> Kind Regards
> 
> James
> 
> 
> 
> 
> 2009/1/12 Takashi Iwai <tiwai@suse.de>:
> > Hi,
> >
> > so far, we use snd_card_new() function to create a card instance.
> > A known problem regarding this API is that it doesn't return a proper
> > error code, thus the probe callback always returns -ENOMEM (or
> > whatever the driver defines) no matter which error occurred actually.
> > A typical case is the card slot conflict.  Even in such a case, it
> > returns -ENOMEM, which may mislead the user.
> >
> > For fixing this situation, I'd like to convert from snd_card_new() to
> > a new function, snd_card_create():
> >
> > int snd_card_create(int idx, const char *id,
> >                    struct module *module, int extra_size,
> >                    struct snd_card **card_ret);
> >
> > and provides snd_card_new() as a wrapper with deprecated flag:
> >
> > static inline __deprecated
> > struct snd_card *snd_card_new(int idx, const char *id,
> >                              struct module *module, int extra_size)
> > {
> >        struct snd_card *card;
> >        if (snd_card_create(idx, id, module, extra_size, &card) < 0)
> >                return NULL;
> >        return card;
> > }
> >
> > The merit of creating a new function is that the older and out-of-tree
> > codes (like xfi) work without modification.  There is alternative
> > option, namely to use PTR_ERR() and keep the function as is.
> > But this has no advantage in practice -- it can't detect the old API
> > at build time, and it may Oops.
> >
> > The preliminary patches are found in test/snd_card_new-err branch
> > of sound git tree:
> >  git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6.git test/snd_card_new-err
> >
> > If anyone finds problems with this, please let me know.
> >
> >
> > thanks,
> >
> > Takashi
> > _______________________________________________
> > Alsa-devel mailing list
> > Alsa-devel@alsa-project.org
> > http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
> >
> 

  reply	other threads:[~2009-01-12 14:47 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-12 14:35 RFC: snd_card_create() function Takashi Iwai
2009-01-12 14:42 ` James Courtier-Dutton
2009-01-12 14:47   ` Takashi Iwai [this message]
2009-01-12 15:06     ` James Courtier-Dutton
2009-01-12 15:25       ` Takashi Iwai
2009-01-14 15:14         ` James Courtier-Dutton
2009-01-14 15:31           ` Takashi Iwai
2009-01-12 16:08 ` Krzysztof Helt
2009-01-12 16:12   ` Takashi Iwai
2009-01-15 13:05 ` 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=s5h4p04d1ij.wl%tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=james.dutton@gmail.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 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.