diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-02-01 17:09:23 -0500 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-02-01 17:09:23 -0500 |
commit | 89d13ec7c8b85f3c62a4a12034e65d3d2d3273a8 (patch) | |
tree | 403300e5a0bf92acb68888424725a9c14843e708 /drivers/ide/ide-cd.c | |
parent | 1b1215d5e954726b142d5408dfd6d7153b3abe8b (diff) |
ide-cd: coding style fixes for VERBOSE_IDE_CD_ERRORS code
* Coding style fixes for VERBOSE_IDE_CD_ERRORS code.
* Add KERN_{ERR,CONT} printk() levels where needed.
This is a preparation for moving this code out of ide-cd.[c,h].
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/ide-cd.c')
-rw-r--r-- | drivers/ide/ide-cd.c | 65 |
1 files changed, 33 insertions, 32 deletions
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c index bd552328014a..02488b48fa7a 100644 --- a/drivers/ide/ide-cd.c +++ b/drivers/ide/ide-cd.c | |||
@@ -205,28 +205,30 @@ void cdrom_analyze_sense_data(ide_drive_t *drive, | |||
205 | const char *s = "bad sense key!"; | 205 | const char *s = "bad sense key!"; |
206 | char buf[80]; | 206 | char buf[80]; |
207 | 207 | ||
208 | printk ("ATAPI device %s:\n", drive->name); | 208 | printk(KERN_ERR "ATAPI device %s:\n", drive->name); |
209 | if (sense->error_code==0x70) | 209 | if (sense->error_code == 0x70) |
210 | printk(" Error: "); | 210 | printk(KERN_CONT " Error: "); |
211 | else if (sense->error_code==0x71) | 211 | else if (sense->error_code == 0x71) |
212 | printk(" Deferred Error: "); | 212 | printk(" Deferred Error: "); |
213 | else if (sense->error_code == 0x7f) | 213 | else if (sense->error_code == 0x7f) |
214 | printk(" Vendor-specific Error: "); | 214 | printk(KERN_CONT " Vendor-specific Error: "); |
215 | else | 215 | else |
216 | printk(" Unknown Error Type: "); | 216 | printk(KERN_CONT " Unknown Error Type: "); |
217 | 217 | ||
218 | if (sense->sense_key < ARRAY_SIZE(sense_key_texts)) | 218 | if (sense->sense_key < ARRAY_SIZE(sense_key_texts)) |
219 | s = sense_key_texts[sense->sense_key]; | 219 | s = sense_key_texts[sense->sense_key]; |
220 | 220 | ||
221 | printk("%s -- (Sense key=0x%02x)\n", s, sense->sense_key); | 221 | printk(KERN_CONT "%s -- (Sense key=0x%02x)\n", |
222 | s, sense->sense_key); | ||
222 | 223 | ||
223 | if (sense->asc == 0x40) { | 224 | if (sense->asc == 0x40) { |
224 | sprintf(buf, "Diagnostic failure on component 0x%02x", | 225 | sprintf(buf, "Diagnostic failure on component 0x%02x", |
225 | sense->ascq); | 226 | sense->ascq); |
226 | s = buf; | 227 | s = buf; |
227 | } else { | 228 | } else { |
228 | int lo = 0, mid, hi = ARRAY_SIZE(sense_data_texts); | 229 | int lo = 0, mid, hi = ARRAY_SIZE(sense_data_texts); |
229 | unsigned long key = (sense->sense_key << 16); | 230 | unsigned long key = (sense->sense_key << 16); |
231 | |||
230 | key |= (sense->asc << 8); | 232 | key |= (sense->asc << 8); |
231 | if (!(sense->ascq >= 0x80 && sense->ascq <= 0xdd)) | 233 | if (!(sense->ascq >= 0x80 && sense->ascq <= 0xdd)) |
232 | key |= sense->ascq; | 234 | key |= sense->ascq; |
@@ -238,11 +240,10 @@ void cdrom_analyze_sense_data(ide_drive_t *drive, | |||
238 | sense_data_texts[mid].asc_ascq == (0xff0000|key)) { | 240 | sense_data_texts[mid].asc_ascq == (0xff0000|key)) { |
239 | s = sense_data_texts[mid].text; | 241 | s = sense_data_texts[mid].text; |
240 | break; | 242 | break; |
241 | } | 243 | } else if (sense_data_texts[mid].asc_ascq > key) |
242 | else if (sense_data_texts[mid].asc_ascq > key) | ||
243 | hi = mid; | 244 | hi = mid; |
244 | else | 245 | else |
245 | lo = mid+1; | 246 | lo = mid + 1; |
246 | } | 247 | } |
247 | } | 248 | } |
248 | 249 | ||
@@ -254,11 +255,10 @@ void cdrom_analyze_sense_data(ide_drive_t *drive, | |||
254 | } | 255 | } |
255 | 256 | ||
256 | printk(KERN_ERR " %s -- (asc=0x%02x, ascq=0x%02x)\n", | 257 | printk(KERN_ERR " %s -- (asc=0x%02x, ascq=0x%02x)\n", |
257 | s, sense->asc, sense->ascq); | 258 | s, sense->asc, sense->ascq); |
258 | 259 | ||
259 | if (failed_command != NULL) { | 260 | if (failed_command != NULL) { |
260 | 261 | int lo = 0, mid, hi = ARRAY_SIZE(packet_command_texts); | |
261 | int lo=0, mid, hi= ARRAY_SIZE(packet_command_texts); | ||
262 | s = NULL; | 262 | s = NULL; |
263 | 263 | ||
264 | while (hi > lo) { | 264 | while (hi > lo) { |
@@ -272,13 +272,15 @@ void cdrom_analyze_sense_data(ide_drive_t *drive, | |||
272 | failed_command->cmd[0]) | 272 | failed_command->cmd[0]) |
273 | hi = mid; | 273 | hi = mid; |
274 | else | 274 | else |
275 | lo = mid+1; | 275 | lo = mid + 1; |
276 | } | 276 | } |
277 | 277 | ||
278 | printk (KERN_ERR " The failed \"%s\" packet command was: \n \"", s); | 278 | printk(KERN_ERR " The failed \"%s\" packet command " |
279 | for (i=0; i<sizeof (failed_command->cmd); i++) | 279 | "was: \n \"", s); |
280 | printk ("%02x ", failed_command->cmd[i]); | 280 | for (i = 0; i < sizeof(failed_command->cmd); i++) |
281 | printk ("\"\n"); | 281 | printk(KERN_CONT "%02x ", |
282 | failed_command->cmd[i]); | ||
283 | printk(KERN_CONT "\"\n"); | ||
282 | } | 284 | } |
283 | 285 | ||
284 | /* The SKSV bit specifies validity of the sense_key_specific | 286 | /* The SKSV bit specifies validity of the sense_key_specific |
@@ -288,38 +290,37 @@ void cdrom_analyze_sense_data(ide_drive_t *drive, | |||
288 | */ | 290 | */ |
289 | if (sense->sense_key == NOT_READY && (sense->sks[0] & 0x80)) { | 291 | if (sense->sense_key == NOT_READY && (sense->sks[0] & 0x80)) { |
290 | int progress = (sense->sks[1] << 8 | sense->sks[2]) * 100; | 292 | int progress = (sense->sks[1] << 8 | sense->sks[2]) * 100; |
291 | printk(KERN_ERR " Command is %02d%% complete\n", progress / 0xffff); | ||
292 | 293 | ||
294 | printk(KERN_ERR " Command is %02d%% complete\n", | ||
295 | progress / 0xffff); | ||
293 | } | 296 | } |
294 | 297 | ||
295 | if (sense->sense_key == ILLEGAL_REQUEST && | 298 | if (sense->sense_key == ILLEGAL_REQUEST && |
296 | (sense->sks[0] & 0x80) != 0) { | 299 | (sense->sks[0] & 0x80) != 0) { |
297 | printk(KERN_ERR " Error in %s byte %d", | 300 | printk(KERN_ERR " Error in %s byte %d", |
298 | (sense->sks[0] & 0x40) != 0 ? | 301 | (sense->sks[0] & 0x40) != 0 ? |
299 | "command packet" : "command data", | 302 | "command packet" : "command data", |
300 | (sense->sks[1] << 8) + sense->sks[2]); | 303 | (sense->sks[1] << 8) + sense->sks[2]); |
301 | 304 | ||
302 | if ((sense->sks[0] & 0x40) != 0) | 305 | if ((sense->sks[0] & 0x40) != 0) |
303 | printk (" bit %d", sense->sks[0] & 0x07); | 306 | printk(KERN_CONT " bit %d", |
307 | sense->sks[0] & 0x07); | ||
304 | 308 | ||
305 | printk ("\n"); | 309 | printk(KERN_CONT "\n"); |
306 | } | 310 | } |
307 | } | 311 | } |
308 | |||
309 | #else /* not VERBOSE_IDE_CD_ERRORS */ | 312 | #else /* not VERBOSE_IDE_CD_ERRORS */ |
310 | |||
311 | /* Suppress printing unit attention and `in progress of becoming ready' | 313 | /* Suppress printing unit attention and `in progress of becoming ready' |
312 | errors when we're not being verbose. */ | 314 | errors when we're not being verbose. */ |
313 | |||
314 | if (sense->sense_key == UNIT_ATTENTION || | 315 | if (sense->sense_key == UNIT_ATTENTION || |
315 | (sense->sense_key == NOT_READY && (sense->asc == 4 || | 316 | (sense->sense_key == NOT_READY && (sense->asc == 4 || |
316 | sense->asc == 0x3a))) | 317 | sense->asc == 0x3a))) |
317 | return; | 318 | return; |
318 | 319 | ||
319 | printk(KERN_ERR "%s: error code: 0x%02x sense_key: 0x%02x asc: 0x%02x ascq: 0x%02x\n", | 320 | printk(KERN_ERR "%s: error code: 0x%02x sense_key: 0x%02x " |
320 | drive->name, | 321 | "asc: 0x%02x ascq: 0x%02x\n", |
321 | sense->error_code, sense->sense_key, | 322 | drive->name, sense->error_code, sense->sense_key, |
322 | sense->asc, sense->ascq); | 323 | sense->asc, sense->ascq); |
323 | #endif /* not VERBOSE_IDE_CD_ERRORS */ | 324 | #endif /* not VERBOSE_IDE_CD_ERRORS */ |
324 | } | 325 | } |
325 | 326 | ||