From: Takashi Iwai <tiwai@suse.de>
To: Tim Blechmann <tim@klingt.org>
Cc: alsa-devel@alsa-project.org
Subject: Re: [PATCH] alsa: lx6464es - include mac address in device name
Date: Sat, 25 Jun 2011 09:21:31 +0200 [thread overview]
Message-ID: <s5hliwqv0jo.wl%tiwai@suse.de> (raw)
In-Reply-To: <33902511f2861df4ef513785464b0db0a8ab2133.1308929468.git.tim@klingt.org>
At Fri, 24 Jun 2011 17:36:20 +0200,
Tim Blechmann wrote:
>
> each device has a unique mac address, which can be used to distinguish
> multiple devices in the same machine. we therefore include the full mac
> address in the device shortname and the last 6 bytes in the device id.
>
> Signed-off-by: Tim Blechmann <tim@klingt.org>
Applied now. Thanks.
Takashi
> ---
> sound/pci/lx6464es/lx6464es.c | 21 +++++++++++++--------
> sound/pci/lx6464es/lx6464es.h | 2 ++
> sound/pci/lx6464es/lx_core.c | 14 +++++++-------
> sound/pci/lx6464es/lx_core.h | 2 +-
> 4 files changed, 23 insertions(+), 16 deletions(-)
>
> diff --git a/sound/pci/lx6464es/lx6464es.c b/sound/pci/lx6464es/lx6464es.c
> index 1bd7a54..2736cf1 100644
> --- a/sound/pci/lx6464es/lx6464es.c
> +++ b/sound/pci/lx6464es/lx6464es.c
> @@ -762,7 +762,6 @@ static int lx_set_granularity(struct lx6464es *chip, u32 gran)
> static int __devinit lx_init_dsp(struct lx6464es *chip)
> {
> int err;
> - u8 mac_address[6];
> int i;
>
> snd_printdd("->lx_init_dsp\n");
> @@ -787,11 +786,11 @@ static int __devinit lx_init_dsp(struct lx6464es *chip)
> /** \todo the mac address should be ready by not, but it isn't,
> * so we wait for it */
> for (i = 0; i != 1000; ++i) {
> - err = lx_dsp_get_mac(chip, mac_address);
> + err = lx_dsp_get_mac(chip);
> if (err)
> return err;
> - if (mac_address[0] || mac_address[1] || mac_address[2] ||
> - mac_address[3] || mac_address[4] || mac_address[5])
> + if (chip->mac_address[0] || chip->mac_address[1] || chip->mac_address[2] ||
> + chip->mac_address[3] || chip->mac_address[4] || chip->mac_address[5])
> goto mac_ready;
> msleep(1);
> }
> @@ -800,8 +799,8 @@ static int __devinit lx_init_dsp(struct lx6464es *chip)
> mac_ready:
> snd_printd(LXP "mac address ready read after: %dms\n", i);
> snd_printk(LXP "mac address: %02X.%02X.%02X.%02X.%02X.%02X\n",
> - mac_address[0], mac_address[1], mac_address[2],
> - mac_address[3], mac_address[4], mac_address[5]);
> + chip->mac_address[0], chip->mac_address[1], chip->mac_address[2],
> + chip->mac_address[3], chip->mac_address[4], chip->mac_address[5]);
>
> err = lx_init_get_version_features(chip);
> if (err)
> @@ -1108,8 +1107,14 @@ static int __devinit snd_lx6464es_probe(struct pci_dev *pci,
> goto out_free;
> }
>
> - strcpy(card->driver, "lx6464es");
> - strcpy(card->shortname, "Digigram LX6464ES");
> + strcpy(card->driver, "LX6464ES");
> + sprintf(card->id, "LX6464ES_%02X%02X%02X",
> + chip->mac_address[3], chip->mac_address[4], chip->mac_address[5]);
> +
> + sprintf(card->shortname, "LX6464ES %02X.%02X.%02X.%02X.%02X.%02X",
> + chip->mac_address[0], chip->mac_address[1], chip->mac_address[2],
> + chip->mac_address[3], chip->mac_address[4], chip->mac_address[5]);
> +
> sprintf(card->longname, "%s at 0x%lx, 0x%p, irq %i",
> card->shortname, chip->port_plx,
> chip->port_dsp_bar, chip->irq);
> diff --git a/sound/pci/lx6464es/lx6464es.h b/sound/pci/lx6464es/lx6464es.h
> index aea621e..e2a124a 100644
> --- a/sound/pci/lx6464es/lx6464es.h
> +++ b/sound/pci/lx6464es/lx6464es.h
> @@ -69,6 +69,8 @@ struct lx6464es {
> struct pci_dev *pci;
> int irq;
>
> + u8 mac_address[6];
> +
> spinlock_t lock; /* interrupt spinlock */
> struct mutex setup_mutex; /* mutex used in hw_params, open
> * and close */
> diff --git a/sound/pci/lx6464es/lx_core.c b/sound/pci/lx6464es/lx_core.c
> index 617f98b..5c8717e 100644
> --- a/sound/pci/lx6464es/lx_core.c
> +++ b/sound/pci/lx6464es/lx_core.c
> @@ -424,7 +424,7 @@ int lx_dsp_get_clock_frequency(struct lx6464es *chip, u32 *rfreq)
> return ret;
> }
>
> -int lx_dsp_get_mac(struct lx6464es *chip, u8 *mac_address)
> +int lx_dsp_get_mac(struct lx6464es *chip)
> {
> u32 macmsb, maclsb;
>
> @@ -432,12 +432,12 @@ int lx_dsp_get_mac(struct lx6464es *chip, u8 *mac_address)
> maclsb = lx_dsp_reg_read(chip, eReg_ADMACESLSB) & 0x00FFFFFF;
>
> /* todo: endianess handling */
> - mac_address[5] = ((u8 *)(&maclsb))[0];
> - mac_address[4] = ((u8 *)(&maclsb))[1];
> - mac_address[3] = ((u8 *)(&maclsb))[2];
> - mac_address[2] = ((u8 *)(&macmsb))[0];
> - mac_address[1] = ((u8 *)(&macmsb))[1];
> - mac_address[0] = ((u8 *)(&macmsb))[2];
> + chip->mac_address[5] = ((u8 *)(&maclsb))[0];
> + chip->mac_address[4] = ((u8 *)(&maclsb))[1];
> + chip->mac_address[3] = ((u8 *)(&maclsb))[2];
> + chip->mac_address[2] = ((u8 *)(&macmsb))[0];
> + chip->mac_address[1] = ((u8 *)(&macmsb))[1];
> + chip->mac_address[0] = ((u8 *)(&macmsb))[2];
>
> return 0;
> }
> diff --git a/sound/pci/lx6464es/lx_core.h b/sound/pci/lx6464es/lx_core.h
> index 6bd9cbb..1dd5629 100644
> --- a/sound/pci/lx6464es/lx_core.h
> +++ b/sound/pci/lx6464es/lx_core.h
> @@ -116,7 +116,7 @@ int __devinit lx_dsp_get_version(struct lx6464es *chip, u32 *rdsp_version);
> int lx_dsp_get_clock_frequency(struct lx6464es *chip, u32 *rfreq);
> int lx_dsp_set_granularity(struct lx6464es *chip, u32 gran);
> int lx_dsp_read_async_events(struct lx6464es *chip, u32 *data);
> -int lx_dsp_get_mac(struct lx6464es *chip, u8 *mac_address);
> +int lx_dsp_get_mac(struct lx6464es *chip);
>
>
> /* low-level pipe handling */
> --
> 1.7.4.1
>
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel@alsa-project.org
> http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
>
prev parent reply other threads:[~2011-06-25 7:21 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-24 15:36 [PATCH] alsa: lx6464es - include mac address in device name Tim Blechmann
2011-06-25 7:21 ` Takashi Iwai [this message]
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=s5hliwqv0jo.wl%tiwai@suse.de \
--to=tiwai@suse.de \
--cc=alsa-devel@alsa-project.org \
--cc=tim@klingt.org \
/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