mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 11:11:45 -04:00
firewire: move rcode_string() to core
There is nothing audio-specific about the rcode_string() helper, so move it from snd-firewire-lib into firewire-core to allow other code to use it. Signed-off-by: Clemens Ladisch <[email protected]> Signed-off-by: Stefan Richter <[email protected]> (fixed sound/firewire/cmp.c)
This commit is contained in:
parent
db7494e2ce
commit
7bdbff6762
5 changed files with 29 additions and 29 deletions
|
|
@ -84,7 +84,7 @@ static int pcr_modify(struct cmp_connection *c,
|
|||
return 0;
|
||||
|
||||
io_error:
|
||||
cmp_error(c, "transaction failed: %s\n", rcode_string(rcode));
|
||||
cmp_error(c, "transaction failed: %s\n", fw_rcode_string(rcode));
|
||||
return -EIO;
|
||||
|
||||
bus_reset:
|
||||
|
|
|
|||
|
|
@ -13,32 +13,6 @@
|
|||
|
||||
#define ERROR_RETRY_DELAY_MS 5
|
||||
|
||||
/**
|
||||
* rcode_string - convert a firewire result code to a string
|
||||
* @rcode: the result
|
||||
*/
|
||||
const char *rcode_string(unsigned int rcode)
|
||||
{
|
||||
static const char *const names[] = {
|
||||
[RCODE_COMPLETE] = "complete",
|
||||
[RCODE_CONFLICT_ERROR] = "conflict error",
|
||||
[RCODE_DATA_ERROR] = "data error",
|
||||
[RCODE_TYPE_ERROR] = "type error",
|
||||
[RCODE_ADDRESS_ERROR] = "address error",
|
||||
[RCODE_SEND_ERROR] = "send error",
|
||||
[RCODE_CANCELLED] = "cancelled",
|
||||
[RCODE_BUSY] = "busy",
|
||||
[RCODE_GENERATION] = "generation",
|
||||
[RCODE_NO_ACK] = "no ack",
|
||||
};
|
||||
|
||||
if (rcode < ARRAY_SIZE(names) && names[rcode])
|
||||
return names[rcode];
|
||||
else
|
||||
return "unknown";
|
||||
}
|
||||
EXPORT_SYMBOL(rcode_string);
|
||||
|
||||
/**
|
||||
* snd_fw_transaction - send a request and wait for its completion
|
||||
* @unit: the driver's unit on the target device
|
||||
|
|
@ -71,7 +45,7 @@ int snd_fw_transaction(struct fw_unit *unit, int tcode,
|
|||
|
||||
if (rcode_is_permanent_error(rcode) || ++tries >= 3) {
|
||||
dev_err(&unit->device, "transaction failed: %s\n",
|
||||
rcode_string(rcode));
|
||||
fw_rcode_string(rcode));
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ struct fw_unit;
|
|||
|
||||
int snd_fw_transaction(struct fw_unit *unit, int tcode,
|
||||
u64 offset, void *buffer, size_t length);
|
||||
const char *rcode_string(unsigned int rcode);
|
||||
|
||||
/* returns true if retrying the transaction would not make sense */
|
||||
static inline bool rcode_is_permanent_error(int rcode)
|
||||
|
|
|
|||
Loading…
Reference in a new issue