aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/firewire/core-transaction.c26
-rw-r--r--include/linux/firewire.h1
-rw-r--r--sound/firewire/cmp.c2
-rw-r--r--sound/firewire/lib.c28
-rw-r--r--sound/firewire/lib.h1
5 files changed, 29 insertions, 29 deletions
diff --git a/drivers/firewire/core-transaction.c b/drivers/firewire/core-transaction.c
index dea2dcc9310d..1c4980c32f90 100644
--- a/drivers/firewire/core-transaction.c
+++ b/drivers/firewire/core-transaction.c
@@ -994,6 +994,32 @@ void fw_core_handle_response(struct fw_card *card, struct fw_packet *p)
994} 994}
995EXPORT_SYMBOL(fw_core_handle_response); 995EXPORT_SYMBOL(fw_core_handle_response);
996 996
997/**
998 * fw_rcode_string - convert a firewire result code to an error description
999 * @rcode: the result code
1000 */
1001const char *fw_rcode_string(int rcode)
1002{
1003 static const char *const names[] = {
1004 [RCODE_COMPLETE] = "no error",
1005 [RCODE_CONFLICT_ERROR] = "conflict error",
1006 [RCODE_DATA_ERROR] = "data error",
1007 [RCODE_TYPE_ERROR] = "type error",
1008 [RCODE_ADDRESS_ERROR] = "address error",
1009 [RCODE_SEND_ERROR] = "send error",
1010 [RCODE_CANCELLED] = "timeout",
1011 [RCODE_BUSY] = "busy",
1012 [RCODE_GENERATION] = "bus reset",
1013 [RCODE_NO_ACK] = "no ack",
1014 };
1015
1016 if ((unsigned int)rcode < ARRAY_SIZE(names) && names[rcode])
1017 return names[rcode];
1018 else
1019 return "unknown";
1020}
1021EXPORT_SYMBOL(fw_rcode_string);
1022
997static const struct fw_address_region topology_map_region = 1023static const struct fw_address_region topology_map_region =
998 { .start = CSR_REGISTER_BASE | CSR_TOPOLOGY_MAP, 1024 { .start = CSR_REGISTER_BASE | CSR_TOPOLOGY_MAP,
999 .end = CSR_REGISTER_BASE | CSR_TOPOLOGY_MAP_END, }; 1025 .end = CSR_REGISTER_BASE | CSR_TOPOLOGY_MAP_END, };
diff --git a/include/linux/firewire.h b/include/linux/firewire.h
index 0a1905719f6f..584826ba2eb7 100644
--- a/include/linux/firewire.h
+++ b/include/linux/firewire.h
@@ -334,6 +334,7 @@ int fw_cancel_transaction(struct fw_card *card,
334int fw_run_transaction(struct fw_card *card, int tcode, int destination_id, 334int fw_run_transaction(struct fw_card *card, int tcode, int destination_id,
335 int generation, int speed, unsigned long long offset, 335 int generation, int speed, unsigned long long offset,
336 void *payload, size_t length); 336 void *payload, size_t length);
337const char *fw_rcode_string(int rcode);
337 338
338static inline int fw_stream_packet_destination_id(int tag, int channel, int sy) 339static inline int fw_stream_packet_destination_id(int tag, int channel, int sy)
339{ 340{
diff --git a/sound/firewire/cmp.c b/sound/firewire/cmp.c
index 76294f2ae47f..645cb0ba4293 100644
--- a/sound/firewire/cmp.c
+++ b/sound/firewire/cmp.c
@@ -84,7 +84,7 @@ static int pcr_modify(struct cmp_connection *c,
84 return 0; 84 return 0;
85 85
86io_error: 86io_error:
87 cmp_error(c, "transaction failed: %s\n", rcode_string(rcode)); 87 cmp_error(c, "transaction failed: %s\n", fw_rcode_string(rcode));
88 return -EIO; 88 return -EIO;
89 89
90bus_reset: 90bus_reset:
diff --git a/sound/firewire/lib.c b/sound/firewire/lib.c
index 4750cea2210e..14eb41498372 100644
--- a/sound/firewire/lib.c
+++ b/sound/firewire/lib.c
@@ -14,32 +14,6 @@
14#define ERROR_RETRY_DELAY_MS 5 14#define ERROR_RETRY_DELAY_MS 5
15 15
16/** 16/**
17 * rcode_string - convert a firewire result code to a string
18 * @rcode: the result
19 */
20const char *rcode_string(unsigned int rcode)
21{
22 static const char *const names[] = {
23 [RCODE_COMPLETE] = "complete",
24 [RCODE_CONFLICT_ERROR] = "conflict error",
25 [RCODE_DATA_ERROR] = "data error",
26 [RCODE_TYPE_ERROR] = "type error",
27 [RCODE_ADDRESS_ERROR] = "address error",
28 [RCODE_SEND_ERROR] = "send error",
29 [RCODE_CANCELLED] = "cancelled",
30 [RCODE_BUSY] = "busy",
31 [RCODE_GENERATION] = "generation",
32 [RCODE_NO_ACK] = "no ack",
33 };
34
35 if (rcode < ARRAY_SIZE(names) && names[rcode])
36 return names[rcode];
37 else
38 return "unknown";
39}
40EXPORT_SYMBOL(rcode_string);
41
42/**
43 * snd_fw_transaction - send a request and wait for its completion 17 * snd_fw_transaction - send a request and wait for its completion
44 * @unit: the driver's unit on the target device 18 * @unit: the driver's unit on the target device
45 * @tcode: the transaction code 19 * @tcode: the transaction code
@@ -71,7 +45,7 @@ int snd_fw_transaction(struct fw_unit *unit, int tcode,
71 45
72 if (rcode_is_permanent_error(rcode) || ++tries >= 3) { 46 if (rcode_is_permanent_error(rcode) || ++tries >= 3) {
73 dev_err(&unit->device, "transaction failed: %s\n", 47 dev_err(&unit->device, "transaction failed: %s\n",
74 rcode_string(rcode)); 48 fw_rcode_string(rcode));
75 return -EIO; 49 return -EIO;
76 } 50 }
77 51
diff --git a/sound/firewire/lib.h b/sound/firewire/lib.h
index 064f3fd9ab06..aef301476ea9 100644
--- a/sound/firewire/lib.h
+++ b/sound/firewire/lib.h
@@ -8,7 +8,6 @@ struct fw_unit;
8 8
9int snd_fw_transaction(struct fw_unit *unit, int tcode, 9int snd_fw_transaction(struct fw_unit *unit, int tcode,
10 u64 offset, void *buffer, size_t length); 10 u64 offset, void *buffer, size_t length);
11const char *rcode_string(unsigned int rcode);
12 11
13/* returns true if retrying the transaction would not make sense */ 12/* returns true if retrying the transaction would not make sense */
14static inline bool rcode_is_permanent_error(int rcode) 13static inline bool rcode_is_permanent_error(int rcode)