aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/misc
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-04-20 19:53:40 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-04-20 19:53:40 -0400
commite9a527dae346c0ad56410c3794ba5ec535c66bcc (patch)
tree708d64621772e9b392bf54be13a830e1d6c63d2e /drivers/usb/misc
parentb412284b969845615e860001b2f34614ece1d576 (diff)
USB: emi62.c: remove err() usage
err() was a very old USB-specific macro that I thought had gone away. This patch removes it from being used in the driver and uses dev_err() instead. CC: Paul Gortmaker <paul.gortmaker@windriver.com> CC: Andrew Morton <akpm@linux-foundation.org> CC: Felipe Balbi <balbi@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/misc')
-rw-r--r--drivers/usb/misc/emi62.c62
1 files changed, 19 insertions, 43 deletions
diff --git a/drivers/usb/misc/emi62.c b/drivers/usb/misc/emi62.c
index 4e0f167a6c4e..ff08015b230c 100644
--- a/drivers/usb/misc/emi62.c
+++ b/drivers/usb/misc/emi62.c
@@ -56,7 +56,7 @@ static int emi62_writememory(struct usb_device *dev, int address,
56 unsigned char *buffer = kmemdup(data, length, GFP_KERNEL); 56 unsigned char *buffer = kmemdup(data, length, GFP_KERNEL);
57 57
58 if (!buffer) { 58 if (!buffer) {
59 err("emi62: kmalloc(%d) failed.", length); 59 dev_err(&dev->dev, "kmalloc(%d) failed.\n", length);
60 return -ENOMEM; 60 return -ENOMEM;
61 } 61 }
62 /* Note: usb_control_msg returns negative value on error or length of the 62 /* Note: usb_control_msg returns negative value on error or length of the
@@ -73,9 +73,8 @@ static int emi62_set_reset (struct usb_device *dev, unsigned char reset_bit)
73 dev_info(&dev->dev, "%s - %d\n", __func__, reset_bit); 73 dev_info(&dev->dev, "%s - %d\n", __func__, reset_bit);
74 74
75 response = emi62_writememory (dev, CPUCS_REG, &reset_bit, 1, 0xa0); 75 response = emi62_writememory (dev, CPUCS_REG, &reset_bit, 1, 0xa0);
76 if (response < 0) { 76 if (response < 0)
77 err("emi62: set_reset (%d) failed", reset_bit); 77 dev_err(&dev->dev, "set_reset (%d) failed\n", reset_bit);
78 }
79 return response; 78 return response;
80} 79}
81 80
@@ -87,18 +86,15 @@ static int emi62_load_firmware (struct usb_device *dev)
87 const struct firmware *bitstream_fw = NULL; 86 const struct firmware *bitstream_fw = NULL;
88 const struct firmware *firmware_fw = NULL; 87 const struct firmware *firmware_fw = NULL;
89 const struct ihex_binrec *rec; 88 const struct ihex_binrec *rec;
90 int err; 89 int err = -ENOMEM;
91 int i; 90 int i;
92 __u32 addr; /* Address to write */ 91 __u32 addr; /* Address to write */
93 __u8 *buf; 92 __u8 *buf;
94 93
95 dev_dbg(&dev->dev, "load_firmware\n"); 94 dev_dbg(&dev->dev, "load_firmware\n");
96 buf = kmalloc(FW_LOAD_SIZE, GFP_KERNEL); 95 buf = kmalloc(FW_LOAD_SIZE, GFP_KERNEL);
97 if (!buf) { 96 if (!buf)
98 err( "%s - error loading firmware: error = %d", __func__, -ENOMEM);
99 err = -ENOMEM;
100 goto wraperr; 97 goto wraperr;
101 }
102 98
103 err = request_ihex_firmware(&loader_fw, "emi62/loader.fw", &dev->dev); 99 err = request_ihex_firmware(&loader_fw, "emi62/loader.fw", &dev->dev);
104 if (err) 100 if (err)
@@ -112,16 +108,13 @@ static int emi62_load_firmware (struct usb_device *dev)
112 err = request_ihex_firmware(&firmware_fw, FIRMWARE_FW, &dev->dev); 108 err = request_ihex_firmware(&firmware_fw, FIRMWARE_FW, &dev->dev);
113 if (err) { 109 if (err) {
114 nofw: 110 nofw:
115 err( "%s - request_firmware() failed", __func__);
116 goto wraperr; 111 goto wraperr;
117 } 112 }
118 113
119 /* Assert reset (stop the CPU in the EMI) */ 114 /* Assert reset (stop the CPU in the EMI) */
120 err = emi62_set_reset(dev,1); 115 err = emi62_set_reset(dev,1);
121 if (err < 0) { 116 if (err < 0)
122 err("%s - error loading firmware: error = %d", __func__, err);
123 goto wraperr; 117 goto wraperr;
124 }
125 118
126 rec = (const struct ihex_binrec *)loader_fw->data; 119 rec = (const struct ihex_binrec *)loader_fw->data;
127 120
@@ -130,19 +123,15 @@ static int emi62_load_firmware (struct usb_device *dev)
130 err = emi62_writememory(dev, be32_to_cpu(rec->addr), 123 err = emi62_writememory(dev, be32_to_cpu(rec->addr),
131 rec->data, be16_to_cpu(rec->len), 124 rec->data, be16_to_cpu(rec->len),
132 ANCHOR_LOAD_INTERNAL); 125 ANCHOR_LOAD_INTERNAL);
133 if (err < 0) { 126 if (err < 0)
134 err("%s - error loading firmware: error = %d", __func__, err);
135 goto wraperr; 127 goto wraperr;
136 }
137 rec = ihex_next_binrec(rec); 128 rec = ihex_next_binrec(rec);
138 } 129 }
139 130
140 /* De-assert reset (let the CPU run) */ 131 /* De-assert reset (let the CPU run) */
141 err = emi62_set_reset(dev,0); 132 err = emi62_set_reset(dev,0);
142 if (err < 0) { 133 if (err < 0)
143 err("%s - error loading firmware: error = %d", __func__, err);
144 goto wraperr; 134 goto wraperr;
145 }
146 msleep(250); /* let device settle */ 135 msleep(250); /* let device settle */
147 136
148 /* 2. We upload the FPGA firmware into the EMI 137 /* 2. We upload the FPGA firmware into the EMI
@@ -160,18 +149,14 @@ static int emi62_load_firmware (struct usb_device *dev)
160 rec = ihex_next_binrec(rec); 149 rec = ihex_next_binrec(rec);
161 } 150 }
162 err = emi62_writememory(dev, addr, buf, i, ANCHOR_LOAD_FPGA); 151 err = emi62_writememory(dev, addr, buf, i, ANCHOR_LOAD_FPGA);
163 if (err < 0) { 152 if (err < 0)
164 err("%s - error loading firmware: error = %d", __func__, err);
165 goto wraperr; 153 goto wraperr;
166 }
167 } while (rec); 154 } while (rec);
168 155
169 /* Assert reset (stop the CPU in the EMI) */ 156 /* Assert reset (stop the CPU in the EMI) */
170 err = emi62_set_reset(dev,1); 157 err = emi62_set_reset(dev,1);
171 if (err < 0) { 158 if (err < 0)
172 err("%s - error loading firmware: error = %d", __func__, err);
173 goto wraperr; 159 goto wraperr;
174 }
175 160
176 /* 3. We need to put the loader for the firmware into the EZ-USB (again...) */ 161 /* 3. We need to put the loader for the firmware into the EZ-USB (again...) */
177 for (rec = (const struct ihex_binrec *)loader_fw->data; 162 for (rec = (const struct ihex_binrec *)loader_fw->data;
@@ -179,18 +164,14 @@ static int emi62_load_firmware (struct usb_device *dev)
179 err = emi62_writememory(dev, be32_to_cpu(rec->addr), 164 err = emi62_writememory(dev, be32_to_cpu(rec->addr),
180 rec->data, be16_to_cpu(rec->len), 165 rec->data, be16_to_cpu(rec->len),
181 ANCHOR_LOAD_INTERNAL); 166 ANCHOR_LOAD_INTERNAL);
182 if (err < 0) { 167 if (err < 0)
183 err("%s - error loading firmware: error = %d", __func__, err);
184 goto wraperr; 168 goto wraperr;
185 }
186 } 169 }
187 170
188 /* De-assert reset (let the CPU run) */ 171 /* De-assert reset (let the CPU run) */
189 err = emi62_set_reset(dev,0); 172 err = emi62_set_reset(dev,0);
190 if (err < 0) { 173 if (err < 0)
191 err("%s - error loading firmware: error = %d", __func__, err);
192 goto wraperr; 174 goto wraperr;
193 }
194 msleep(250); /* let device settle */ 175 msleep(250); /* let device settle */
195 176
196 /* 4. We put the part of the firmware that lies in the external RAM into the EZ-USB */ 177 /* 4. We put the part of the firmware that lies in the external RAM into the EZ-USB */
@@ -201,19 +182,15 @@ static int emi62_load_firmware (struct usb_device *dev)
201 err = emi62_writememory(dev, be32_to_cpu(rec->addr), 182 err = emi62_writememory(dev, be32_to_cpu(rec->addr),
202 rec->data, be16_to_cpu(rec->len), 183 rec->data, be16_to_cpu(rec->len),
203 ANCHOR_LOAD_EXTERNAL); 184 ANCHOR_LOAD_EXTERNAL);
204 if (err < 0) { 185 if (err < 0)
205 err("%s - error loading firmware: error = %d", __func__, err);
206 goto wraperr; 186 goto wraperr;
207 }
208 } 187 }
209 } 188 }
210 189
211 /* Assert reset (stop the CPU in the EMI) */ 190 /* Assert reset (stop the CPU in the EMI) */
212 err = emi62_set_reset(dev,1); 191 err = emi62_set_reset(dev,1);
213 if (err < 0) { 192 if (err < 0)
214 err("%s - error loading firmware: error = %d", __func__, err);
215 goto wraperr; 193 goto wraperr;
216 }
217 194
218 for (rec = (const struct ihex_binrec *)firmware_fw->data; 195 for (rec = (const struct ihex_binrec *)firmware_fw->data;
219 rec; rec = ihex_next_binrec(rec)) { 196 rec; rec = ihex_next_binrec(rec)) {
@@ -221,19 +198,15 @@ static int emi62_load_firmware (struct usb_device *dev)
221 err = emi62_writememory(dev, be32_to_cpu(rec->addr), 198 err = emi62_writememory(dev, be32_to_cpu(rec->addr),
222 rec->data, be16_to_cpu(rec->len), 199 rec->data, be16_to_cpu(rec->len),
223 ANCHOR_LOAD_EXTERNAL); 200 ANCHOR_LOAD_EXTERNAL);
224 if (err < 0) { 201 if (err < 0)
225 err("%s - error loading firmware: error = %d", __func__, err);
226 goto wraperr; 202 goto wraperr;
227 }
228 } 203 }
229 } 204 }
230 205
231 /* De-assert reset (let the CPU run) */ 206 /* De-assert reset (let the CPU run) */
232 err = emi62_set_reset(dev,0); 207 err = emi62_set_reset(dev,0);
233 if (err < 0) { 208 if (err < 0)
234 err("%s - error loading firmware: error = %d", __func__, err);
235 goto wraperr; 209 goto wraperr;
236 }
237 msleep(250); /* let device settle */ 210 msleep(250); /* let device settle */
238 211
239 release_firmware(loader_fw); 212 release_firmware(loader_fw);
@@ -247,6 +220,9 @@ static int emi62_load_firmware (struct usb_device *dev)
247 return 1; 220 return 1;
248 221
249wraperr: 222wraperr:
223 if (err < 0)
224 dev_err(&dev->dev,"%s - error loading firmware: error = %d\n",
225 __func__, err);
250 release_firmware(loader_fw); 226 release_firmware(loader_fw);
251 release_firmware(bitstream_fw); 227 release_firmware(bitstream_fw);
252 release_firmware(firmware_fw); 228 release_firmware(firmware_fw);