All of lore.kernel.org
 help / color / mirror / Atom feed
* substream->private_data == NULL in hw_params
@ 2007-07-17  1:00 Florian Demski
  2007-07-17 10:11 ` Takashi Iwai
  0 siblings, 1 reply; 2+ messages in thread
From: Florian Demski @ 2007-07-17  1:00 UTC (permalink / raw)
  To: alsa-devel

Hi there,

after many reboots I finally fixed an error in a driver but I am not 
sure if there ain't an underlying problem which causes this error.

The initialization is done with

        struct snd_pcm *pcm;
        int err;

        if((err = snd_pcm_new(chip->pod->line6.card, (char 
*)chip->pod->line6.devname, 0, 1, 1, &pcm)) < 0)
                return err;

        pcm->private_data = chip;
        pcm->private_free = pod_cleanup_pcm;
        chip->pcm = pcm;

However in hw_param, substream->private_data is NULL and I have to get 
the right value with this construct:

static int snd_pod_capture_hw_params(struct snd_pcm_substream 
*substream, struct snd_pcm_hw_params *hw_params)
{
        int ret;
        struct snd_pod_pcm *chip = snd_pcm_substream_chip(substream);

        /* -- Florian Demski [FD] */
        /* don't ask me why, but this fixes the bug on my machine */
        if ( chip == NULL ) {
                if ( substream->pcm == NULL )
                        return -ENOMEM;
                if ( substream->pcm->private_data == NULL )
                        return -ENOMEM;
                substream->private_data = substream->pcm->private_data;
                chip = snd_pcm_substream_chip( substream );
        }
        /* -- [FD] end */

Somehow only my machine produces this error, I tried switching off SMP 
and PREEMPT, but with no other result.

Or is this possibly an (undocumented) feature in alsa?

I'd be happy if actually some of you experienced guys might take a look 
at that driver:

SVN
https://line6linux.svn.sourceforge.net/svnroot/line6linux/driver/trunk

Browse
https://line6linux.svn.sourceforge.net/viewvc/line6linux/driver/trunk/

Thanks in advance,

Florian

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: substream->private_data == NULL in hw_params
  2007-07-17  1:00 substream->private_data == NULL in hw_params Florian Demski
@ 2007-07-17 10:11 ` Takashi Iwai
  0 siblings, 0 replies; 2+ messages in thread
From: Takashi Iwai @ 2007-07-17 10:11 UTC (permalink / raw)
  To: Florian Demski; +Cc: alsa-devel

At Tue, 17 Jul 2007 03:00:44 +0200,
Florian Demski wrote:
> 
> Hi there,
> 
> after many reboots I finally fixed an error in a driver but I am not 
> sure if there ain't an underlying problem which causes this error.
> 
> The initialization is done with
> 
>         struct snd_pcm *pcm;
>         int err;
> 
>         if((err = snd_pcm_new(chip->pod->line6.card, (char 
> *)chip->pod->line6.devname, 0, 1, 1, &pcm)) < 0)
>                 return err;
> 
>         pcm->private_data = chip;
>         pcm->private_free = pod_cleanup_pcm;
>         chip->pcm = pcm;
> 
> However in hw_param, substream->private_data is NULL and I have to get 
> the right value with this construct:

That's weird.  substream->private_data is copied from
pcm->private_data at snd_pcm_open(), and never changed in another part
of PCM core layer.  So, my guess is somewhere in your driver
overwrites it.  Maybe not explicitly.

I'd check each call between open and hw_params, e.g. adding printk
appropriately...


Takashi

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-07-17 10:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-17  1:00 substream->private_data == NULL in hw_params Florian Demski
2007-07-17 10:11 ` Takashi Iwai

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.