aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pcmcia
diff options
context:
space:
mode:
authorDominik Brodowski <linux@dominikbrodowski.net>2008-08-03 08:03:07 -0400
committerDominik Brodowski <linux@dominikbrodowski.net>2008-08-22 20:34:36 -0400
commit79ba6757277ea7228480bee4c56c0f028f806b91 (patch)
treef725be3a9e8a8e29b9aba9dd94307095923376dd /drivers/pcmcia
parent9c8b7965f594fdff37c59446b9314ed7b4b44d07 (diff)
pcmcia: use dev_printk for cs_error()
Use dev_printk() in cs_error()-based error reporting. While this function-turned-macro will hopefully go away soon, using dev_printk simplifies the code much. Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Diffstat (limited to 'drivers/pcmcia')
-rw-r--r--drivers/pcmcia/ds.c50
1 files changed, 18 insertions, 32 deletions
diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c
index 55a46af33ca4..e0624a8fb6e3 100644
--- a/drivers/pcmcia/ds.c
+++ b/drivers/pcmcia/ds.c
@@ -69,8 +69,8 @@ spinlock_t pcmcia_dev_list_lock;
69/* String tables for error messages */ 69/* String tables for error messages */
70 70
71typedef struct lookup_t { 71typedef struct lookup_t {
72 int key; 72 const int key;
73 char *msg; 73 const char *msg;
74} lookup_t; 74} lookup_t;
75 75
76static const lookup_t error_table[] = { 76static const lookup_t error_table[] = {
@@ -137,46 +137,32 @@ static const lookup_t service_table[] = {
137 { ReplaceCIS, "ReplaceCIS" } 137 { ReplaceCIS, "ReplaceCIS" }
138}; 138};
139 139
140 140const char *pcmcia_error_func(int func)
141static int pcmcia_report_error(struct pcmcia_device *p_dev, error_info_t *err)
142{ 141{
143 int i; 142 int i;
144 char *serv;
145
146 if (!p_dev)
147 printk(KERN_NOTICE);
148 else
149 printk(KERN_NOTICE "%s: ", p_dev->dev.bus_id);
150 143
151 for (i = 0; i < ARRAY_SIZE(service_table); i++) 144 for (i = 0; i < ARRAY_SIZE(service_table); i++)
152 if (service_table[i].key == err->func) 145 if (service_table[i].key == func)
153 break; 146 return service_table[i].msg;
154 if (i < ARRAY_SIZE(service_table))
155 serv = service_table[i].msg;
156 else
157 serv = "Unknown service number";
158 147
159 for (i = 0; i < ARRAY_SIZE(error_table); i++) 148 return "Unknown service number";
160 if (error_table[i].key == err->retcode) 149}
161 break; 150EXPORT_SYMBOL(pcmcia_error_func);
162 if (i < ARRAY_SIZE(error_table))
163 printk("%s: %s\n", serv, error_table[i].msg);
164 else
165 printk("%s: Unknown error code %#x\n", serv, err->retcode);
166 151
167 return 0; 152const char *pcmcia_error_ret(int ret)
168} /* report_error */ 153{
154 int i;
155
156 for (i = 0; i < ARRAY_SIZE(error_table); i++)
157 if (error_table[i].key == ret)
158 return error_table[i].msg;
169 159
170/* end of code which was in cs.c before */ 160 return "unknown";
161}
162EXPORT_SYMBOL(pcmcia_error_ret);
171 163
172/*======================================================================*/ 164/*======================================================================*/
173 165
174void cs_error(struct pcmcia_device *p_dev, int func, int ret)
175{
176 error_info_t err = { func, ret };
177 pcmcia_report_error(p_dev, &err);
178}
179EXPORT_SYMBOL(cs_error);
180 166
181 167
182static void pcmcia_check_driver(struct pcmcia_driver *p_drv) 168static void pcmcia_check_driver(struct pcmcia_driver *p_drv)