[alsa-devel] [PATCH 1/4] drm/i915: Add audio hotplug info struct

Vinod Koul vinod.koul at intel.com
Wed Jul 22 16:13:23 CEST 2015


On Wed, Jul 22, 2015 at 10:55:55AM +0200, Takashi Iwai wrote:
> On Wed, 22 Jul 2015 10:50:03 +0200,
> David Henningsson wrote:
> > 
> > >>   struct i915_audio_component {
> > >>   	struct device *dev;
> > >> +	struct hdac_bus *hdac_bus;
> > >
> > > If we want to be more generic, using a struct device would be better,
> > > e.g.
> > > 	struct device *audio_dev;
> > 
> > Does this work? If we want to have the hdac_bus.dev ptr instead of a 
> > hdac_bus ptr, there does not seem to be an obvious way to go from the 
> > audio_dev back to the hdac_bus struct (as snd_hdac_bus_init takes an 
> > arbitrary dev pointer).
> 
> Hrm, right, currently it's not straightforward.  Scratch the idea,
> then.

That depends on the device we register this with. Actually this makes more
sense to me :)

If we register with struct device *audio_dev, which in this case would be
the codec device we create while probing the bus. This way you are linking i915
ops to the codec device. Ofcourse hdac_device has bus pointer but you can
invoke device callback without even searching for the device :)

-- 
~Vinod
> 
> 
> > >> +		void (*hotplug_notify)(struct hdac_bus *, const struct i915_audio_hotplug_info *);
> > >> +	} *cb_ops;
> > >
> > > cb_ops doesn't sound intuitive.  Any better name?
> > 
> > I was thinking of it as "callback ops", i e, calls that go in the 
> > reverse direction compared to the already existing "ops".
> > 
> > But if we call the device "audio_dev" as you suggested above, then maybe 
> > "audio_ops" would be nice and symmetric?
> 
> Yes, it sounds better.
> 
> 
> Takashi

-- 


More information about the Alsa-devel mailing list