[alsa-devel] [PATCH 16/39] firewire-lib: Add some AV/C general commands

Clemens Ladisch clemens at ladisch.de
Sun Mar 9 22:32:54 CET 2014


Takashi Sakamoto wrote:
> This commit adds three commands, which may be used by some firewire device
> drivers. These commands are defined in 'AV/C Digital Interface Command Set
> General Specification Version 4.2 (2004006, 1394TA)'.
>
> 1. PLUG INFO command (10.1)
> 2. INPUT PLUG SIGNAL FORMAT command (10.10)
> 3. OUTPUT PLUG SIGNAL FORMAT command (10.11)
>
> By the command 1, the drivers can get the number of plugs for AV/C unit or
> subunit.
> By the command 2 and 3, the drivers can get/set sampling frequency.

All these functions return errors with two different mechanisms, the AV/C
response code or a negative Linux error code.  This forces the caller to
add a second error check that duplicates the one inside the function:

> +	err = avc_general_set_sig_fmt(fwspk->unit, params_rate(hw_params),
> +				      AVC_GENERAL_PLUG_DIR_IN, 0);
>  	if (err < 0)
>  		goto err_buffer;
> +	if (err != 0x09 /* ACCEPTED */) {
> +		dev_err(&fwspk->unit->device, "failed to set sample rate\n");
> +		err = -EIO;
> +		goto error;
> +	}

Would there be problems if any response except ACCEPTED resulted in -EIO?

(And here, error should be err_buffer.)


Regards,
Clemens


More information about the Alsa-devel mailing list