From: Takashi Iwai <tiwai@suse.de>
To: Wu Fengguang <fengguang.wu@intel.com>
Cc: alsa-devel <alsa-devel@alsa-project.org>
Subject: Re: [PATCH] Intel HDMI audio support
Date: Tue, 04 Nov 2008 12:51:35 +0100 [thread overview]
Message-ID: <s5hskq71zg8.wl%tiwai@suse.de> (raw)
In-Reply-To: <1225791520.847299.30896@de>
At Tue, 4 Nov 2008 17:38:39 +0800,
Wu Fengguang wrote:
>
> Add support for Intel G45 integrated HDMI audio codecs.
>
> This initial release supports:
> - 2 channel stereo sound output
> - report monitor's ELD information
>
> Signed-off-by: Wu Fengguang <wfg@linux.intel.com>
Thanks. The patch looks almost fine, but a few things to be fixed.
> +/*
> + * ELD: EDID Like Data
> + */
> +struct sink_eld {
> + int eld_size;
> + int baseline_len;
> + int eld_ver; /* (eld_ver == 0) indicates invalid ELD */
> + int cea_edid_ver;
> + char monitor_name[ELD_MAX_MNL + 1];
> + int manufacture_id;
> + int product_id;
> + long port_id;
If you need a 64bit value, use u64 explicitly.
> +struct hdmi_audio_infoframe {
> + u8 type; /* 0x84 */
> + u8 ver; /* 0x01 */
> + u8 len; /* 0x0a */
> +
> + u8 checksum; /* PB0 */
> + u8 CC02_CT47; /* CC in bits 0:2, CT in 4:7 */
> + u8 SS01_SF24;
> + u8 CXT04;
> + u8 CA;
> + u8 LFEPBL01_LSV36_DM_INH7;
> + u8 reserved[5]; /* PB6 - PB10 */
> +};
> +#define GRAB_BITS(buf, byte, lowbit, bits, val) \
> + (val) = ((buf)[(byte)] >> (lowbit)) & ((1 << (bits)) - 1)
This should be rather a form
#define GRAB_BITS(buf, byte, lowbit, bits) \
((buf)[(byte)] >> (lowbit)) & ((1 << (bits)) - 1)
and
foo = GRAB_BITS(buf, byte, low, bits);
> +static void hdmi_update_short_audio_desc(struct cea_sad *a,
> + const unsigned char *buf)
> +{
> + int i;
> + int val;
> +
> + GRAB_BITS(buf, 1, 0, 7, val);
The numbers is GRAB_BITS() could be better defined.
> +static int hdmi_update_sink_eld(struct hda_codec *codec,
> + const unsigned char *buf, int size)
(snip)
> + e->port_id = le64_to_cpu(*(u64 *)(buf + 8));
Use get_unaligned_*() for this, just to be more portable.
(And include <asm/unaligned.h> beforehand.)
> + /* the spec's tendency is little endian */
> + e->manufacture_id = le16_to_cpu(*(u16 *)(buf + 16));
> + e->product_id = le16_to_cpu(*(u16 *)(buf + 18));
Ditto.
> +
> + if (mnl > ELD_MAX_MNL) {
> + snd_printd(KERN_INFO "MNL is reserved value %d\n", mnl);
> + goto out_fail;
> + } else if (ELD_FIXED_BYTES + mnl > size) {
> + snd_printd(KERN_INFO "out of range MNL %d\n", mnl);
> + goto out_fail;
> + } else {
> + strncpy(e->monitor_name, buf + ELD_FIXED_BYTES, mnl);
> + e->monitor_name[mnl] = '\0';
Use strlcpy().
> +static void hdmi_show_eld(struct hda_codec *codec)
> +{
> + int i;
> + int j;
> + struct intel_hdmi_spec *spec = codec->spec;
> + struct sink_eld *e = &spec->sink;
> + char buf[80];
(snip)
> + for (i = 0; i < ARRAY_SIZE(cea_speaker_allocation_names); i++) {
> + if (e->spk_alloc & (1 << i))
> + j += sprintf(buf + j, " %s",
> + cea_speaker_allocation_names[i]);
Use snprintf() instead to avoid overflow.
> + }
> + buf[j] = '\0';
> + printk(KERN_INFO "speaker allocations: (0x%x)%s\n", e->spk_alloc, buf);
> +
> + for (i = 0; i < e->sad_count; i++) {
> + hdmi_show_short_audio_desc(e->sad + i);
> + }
checkpatch.pl warns about these braces.
In general, it's worth to run once before submission.
Could you fix these and repost?
thanks,
Takashi
next prev parent reply other threads:[~2008-11-04 11:51 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-04 9:38 [PATCH] Intel HDMI audio support Wu Fengguang
2008-11-04 11:51 ` Takashi Iwai [this message]
2008-11-05 0:27 ` Wu, Fengguang
2008-11-05 3:16 ` Wu, Fengguang
2008-11-05 7:14 ` Takashi Iwai
2008-11-05 7:41 ` Wu, Fengguang
2008-11-05 15:34 ` Vedran Miletić
2008-11-05 15:42 ` Vedran Miletić
2008-11-05 15:43 ` Takashi Iwai
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=s5hskq71zg8.wl%tiwai@suse.de \
--to=tiwai@suse.de \
--cc=alsa-devel@alsa-project.org \
--cc=fengguang.wu@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox