simple question about struct pointer

arshad hussain arshad.super at gmail.com
Mon Apr 15 05:48:58 EDT 2013


On Mon, Apr 15, 2013 at 12:32 PM, Ben Wu <crayben at yahoo.cn> wrote:

>
> Dear All ,Im new to linux kernel program, and found struct pointer is
> difficult to understand, that the  struct s3c_i2sv2_info *i2s =
> snd_soc_dai_get_drvdata(cpu_dai) means,? why is use the struct pointer
> assgn another struct pointer??
>
>
> static int s3c2412_i2s_hw_params(struct snd_pcm_substream *substream,
>                  struct snd_pcm_hw_params *params,
>                  struct snd_soc_dai *cpu_dai)
> {
>     struct s3c_i2sv2_info *i2s = snd_soc_dai_get_drvdata(cpu_dai);
>     struct s3c_dma_params *dma_data;
>     ....................................................................
> }
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>
>

Have a look at a utility binary "cdecl". This will help you greatly.
However, the statement above
means, snd_soc... is a function which takes a argument which is a pointer
and returns a pointer
to struct s3c_..

Here the pointer i2s is declared and initialize. Else it will do nasty
thing if you try to de-reference it.

Thanks,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20130415/bfb9b97a/attachment.html 


More information about the Kernelnewbies mailing list