[alsa-devel] [PATCH 21/30] ALSA: oxfw: Change the way to name card

Takashi Iwai tiwai at suse.de
Sat Nov 29 20:37:19 CET 2014


At Sat, 29 Nov 2014 00:59:30 +0900,
Takashi Sakamoto wrote:
> 
> The 'struct snd_card' has 4 members for name. They're 'driver', 'shortname',
> 'longname' and 'mixername'. This commit names these 4 members according to
> two members in model-specific structure and reduce rest of members in the
> structure.
> 
> The reason that alias names are still used is that currently supported devices,
> Griffin FireWave and LaCie Firewire Speaker have too long names for model and
> vendor field in their config rom to be over allocated buffer for the names.
> 
> Signed-off-by: Takashi Sakamoto <o-takashi at sakamocchi.jp>
> ---
>  sound/firewire/oxfw/oxfw.c | 51 +++++++++++++++++++++++++++-------------------
>  sound/firewire/oxfw/oxfw.h |  3 +--
>  2 files changed, 31 insertions(+), 23 deletions(-)
> 
> diff --git a/sound/firewire/oxfw/oxfw.c b/sound/firewire/oxfw/oxfw.c
> index 951d9a4..3308253 100644
> --- a/sound/firewire/oxfw/oxfw.c
> +++ b/sound/firewire/oxfw/oxfw.c
> @@ -25,14 +25,34 @@ MODULE_AUTHOR("Clemens Ladisch <clemens at ladisch.de>");
>  MODULE_LICENSE("GPL v2");
>  MODULE_ALIAS("snd-firewire-speakers");
>  
> -static u32 oxfw_read_firmware_version(struct fw_unit *unit)
> +static int name_card(struct snd_oxfw *oxfw)
>  {
> -	__be32 data;
> +	struct fw_device *fw_dev = fw_parent_device(oxfw->unit);
> +	const char *d, *v, *m;
> +	u32 firmware;
>  	int err;
>  
> -	err = snd_fw_transaction(unit, TCODE_READ_QUADLET_REQUEST,
> -				 OXFORD_FIRMWARE_ID_ADDRESS, &data, 4, 0);
> -	return err >= 0 ? be32_to_cpu(data) : 0;
> +	err = snd_fw_transaction(oxfw->unit, TCODE_READ_QUADLET_REQUEST,
> +				 OXFORD_FIRMWARE_ID_ADDRESS, &firmware, 4, 0);
> +	if (err < 0)
> +		goto end;
> +	be32_to_cpus(&firmware);
> +
> +	d = oxfw->device_info->driver_name;
> +	v = oxfw->device_info->vendor_name;
> +	m = oxfw->device_info->driver_name;
> +
> +	strcpy(oxfw->card->driver, d);
> +	strcpy(oxfw->card->shortname, m);
> +	strcpy(oxfw->card->mixername, m);

So, this ends up with the identical strings for both driver and
shortname?  This doesn't sound like an improvement.


thanks,

Takashi


More information about the Alsa-devel mailing list