[Intel-gfx] [PATCH 2/2 v2] hda - delayed ELD repoll

Takashi Iwai tiwai at suse.de
Tue Nov 15 18:10:37 CET 2011


At Wed, 16 Nov 2011 00:57:08 +0800,
Wu Fengguang wrote:
> +static void hda_eld_work(struct work_struct *work)
> +{
> +	struct hdmi_eld *eld = container_of(
> +				container_of(work, struct delayed_work, work),
> +				struct hdmi_eld, work);

Ugh, hardly to read.  Slightly better to use to_delayed_work()?

	struct hdmi_eld *eld = container_of(to_delayed_work(work),
					    struct hdmi_eld, work);

> +	struct hdmi_spec_per_pin *per_pin =
> +			container_of(eld, struct hdmi_spec_per_pin, sink_eld);
> +	struct hda_codec *codec = eld->codec;
> +
> +	hdmi_present_sense(codec, per_pin->pin_nid, eld, false);
> +}
> +
>  static int hdmi_add_pin(struct hda_codec *codec, hda_nid_t pin_nid)
>  {
>  	struct hdmi_spec *spec = codec->spec;
> @@ -1227,7 +1245,7 @@ static int generic_hdmi_build_jack(struc
>  	if (err < 0)
>  		return err;
>  
> -	hdmi_present_sense(codec, per_pin->pin_nid, &per_pin->sink_eld);
> +	hdmi_present_sense(codec, per_pin->pin_nid, &per_pin->sink_eld, false);
...

Looking through the code, I wonder how about keeping work and codec
pointer in struct hdmi_spec_per_pin instead of struct hdmi_eld.  Then
we don't need to expose it in hda_local.h, and changes would be
slightly more compact.

hdmi_present_sense() can be modified to receive hdmi_sepc_per_pin*
directly instead of individual nid and eld pointer.


thanks,

Takashi



More information about the Intel-gfx mailing list