Re: [PATCH v2 21/22] sound/usb: Use Media Controller API to share media resources

From: Takashi Iwai
Date: Thu Feb 04 2016 - 05:47:03 EST


On Thu, 04 Feb 2016 11:36:00 +0100,
Mauro Carvalho Chehab wrote:
>
> > diff --git a/sound/usb/card.h b/sound/usb/card.h
> > index 71778ca..c15a03c 100644
> > --- a/sound/usb/card.h
> > +++ b/sound/usb/card.h
> > @@ -156,6 +156,7 @@ struct snd_usb_substream {
> > } dsd_dop;
> >
> > bool trigger_tstamp_pending_update; /* trigger timestamp being updated from initial estimate */
> > + void *media_ctl;
> > };
>
> This is Takashi's call, but I would prefer to avoid using a void *
> here. Fortunately, GCC is smart enough to handle struct pointers
> even if the header doesn't have a full declaration of the struct.
>
> So, I would change the above to:
>
> struct media_device;
>
> struct snd_usb_substream {
> ...
> struct media_device *media_ctl;
> };
>
> This way, we ensure strong typecast checks when compiling the code under
> sound/usb/media.c, while not needing to include media_device.h header here.

Agreed, this is no big merit to make it a void pointer.


Takashi