aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-02-01 17:09:23 -0500
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-02-01 17:09:23 -0500
commit89d13ec7c8b85f3c62a4a12034e65d3d2d3273a8 (patch)
tree403300e5a0bf92acb68888424725a9c14843e708 /drivers/ide
parent1b1215d5e954726b142d5408dfd6d7153b3abe8b (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')
-rw-r--r--drivers/ide/ide-cd.c65
-rw-r--r--drivers/ide/ide-cd.h33
2 files changed, 49 insertions, 49 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
diff --git a/drivers/ide/ide-cd.h b/drivers/ide/ide-cd.h
index 33019cb8c68d..3a43178ab121 100644
--- a/drivers/ide/ide-cd.h
+++ b/drivers/ide/ide-cd.h
@@ -159,9 +159,8 @@ struct cdrom_info {
159 159
160/* This stuff should be in cdrom.h, since it is now generic... */ 160/* This stuff should be in cdrom.h, since it is now generic... */
161#if VERBOSE_IDE_CD_ERRORS 161#if VERBOSE_IDE_CD_ERRORS
162 162/* The generic packet command opcodes for CD/DVD Logical Units,
163 /* The generic packet command opcodes for CD/DVD Logical Units, 163 * From Table 57 of the SFF8090 Ver. 3 (Mt. Fuji) draft standard. */
164 * From Table 57 of the SFF8090 Ver. 3 (Mt. Fuji) draft standard. */
165static const struct { 164static const struct {
166 unsigned short packet_command; 165 unsigned short packet_command;
167 const char * const text; 166 const char * const text;
@@ -187,7 +186,8 @@ static const struct {
187 { GPCMD_GET_CONFIGURATION, "Get Configuration" }, 186 { GPCMD_GET_CONFIGURATION, "Get Configuration" },
188 { GPCMD_PLAY_AUDIO_MSF, "Play Audio MSF" }, 187 { GPCMD_PLAY_AUDIO_MSF, "Play Audio MSF" },
189 { GPCMD_PLAYAUDIO_TI, "Play Audio TrackIndex" }, 188 { GPCMD_PLAYAUDIO_TI, "Play Audio TrackIndex" },
190 { GPCMD_GET_EVENT_STATUS_NOTIFICATION, "Get Event Status Notification" }, 189 { GPCMD_GET_EVENT_STATUS_NOTIFICATION,
190 "Get Event Status Notification" },
191 { GPCMD_PAUSE_RESUME, "Pause/Resume" }, 191 { GPCMD_PAUSE_RESUME, "Pause/Resume" },
192 { GPCMD_STOP_PLAY_SCAN, "Stop Play/Scan" }, 192 { GPCMD_STOP_PLAY_SCAN, "Stop Play/Scan" },
193 { GPCMD_READ_DISC_INFO, "Read Disc Info" }, 193 { GPCMD_READ_DISC_INFO, "Read Disc Info" },
@@ -217,8 +217,6 @@ static const struct {
217 { GPCMD_READ_CD, "Read CD" }, 217 { GPCMD_READ_CD, "Read CD" },
218}; 218};
219 219
220
221
222/* From Table 303 of the SFF8090 Ver. 3 (Mt. Fuji) draft standard. */ 220/* From Table 303 of the SFF8090 Ver. 3 (Mt. Fuji) draft standard. */
223static const char * const sense_key_texts[16] = { 221static const char * const sense_key_texts[16] = {
224 "No sense data", 222 "No sense data",
@@ -262,16 +260,16 @@ static const struct {
262 { 0x011802, "Recovered data - the data was auto-reallocated" }, 260 { 0x011802, "Recovered data - the data was auto-reallocated" },
263 { 0x011803, "Recovered data with CIRC" }, 261 { 0x011803, "Recovered data with CIRC" },
264 { 0x011804, "Recovered data with L-EC" }, 262 { 0x011804, "Recovered data with L-EC" },
265 { 0x015d00, 263 { 0x015d00, "Failure prediction threshold exceeded"
266 "Failure prediction threshold exceeded - Predicted logical unit failure" }, 264 " - Predicted logical unit failure" },
267 { 0x015d01, 265 { 0x015d01, "Failure prediction threshold exceeded"
268 "Failure prediction threshold exceeded - Predicted media failure" }, 266 " - Predicted media failure" },
269 { 0x015dff, "Failure prediction threshold exceeded - False" }, 267 { 0x015dff, "Failure prediction threshold exceeded - False" },
270 { 0x017301, "Power calibration area almost full" }, 268 { 0x017301, "Power calibration area almost full" },
271 { 0x020400, "Logical unit not ready - cause not reportable" }, 269 { 0x020400, "Logical unit not ready - cause not reportable" },
272 /* Following is misspelled in ATAPI 2.6, _and_ in Mt. Fuji */ 270 /* Following is misspelled in ATAPI 2.6, _and_ in Mt. Fuji */
273 { 0x020401, 271 { 0x020401, "Logical unit not ready"
274 "Logical unit not ready - in progress [sic] of becoming ready" }, 272 " - in progress [sic] of becoming ready" },
275 { 0x020402, "Logical unit not ready - initializing command required" }, 273 { 0x020402, "Logical unit not ready - initializing command required" },
276 { 0x020403, "Logical unit not ready - manual intervention required" }, 274 { 0x020403, "Logical unit not ready - manual intervention required" },
277 { 0x020404, "Logical unit not ready - format in progress" }, 275 { 0x020404, "Logical unit not ready - format in progress" },
@@ -310,7 +308,6 @@ static const struct {
310 { 0x037304, "Program memory area / RMA update failure" }, 308 { 0x037304, "Program memory area / RMA update failure" },
311 { 0x037305, "Program memory area / RMA is full" }, 309 { 0x037305, "Program memory area / RMA is full" },
312 { 0x037306, "Program memory area / RMA is (almost) full" }, 310 { 0x037306, "Program memory area / RMA is (almost) full" },
313
314 { 0x040200, "No seek complete" }, 311 { 0x040200, "No seek complete" },
315 { 0x040300, "Write fault" }, 312 { 0x040300, "Write fault" },
316 { 0x040900, "Track following error" }, 313 { 0x040900, "Track following error" },
@@ -344,12 +341,15 @@ static const struct {
344 { 0x055500, "System resource failure" }, 341 { 0x055500, "System resource failure" },
345 { 0x056300, "End of user area encountered on this track" }, 342 { 0x056300, "End of user area encountered on this track" },
346 { 0x056400, "Illegal mode for this track or incompatible medium" }, 343 { 0x056400, "Illegal mode for this track or incompatible medium" },
347 { 0x056f00, "Copy protection key exchange failure - Authentication failure" }, 344 { 0x056f00, "Copy protection key exchange failure"
345 " - Authentication failure" },
348 { 0x056f01, "Copy protection key exchange failure - Key not present" }, 346 { 0x056f01, "Copy protection key exchange failure - Key not present" },
349 { 0x056f02, "Copy protection key exchange failure - Key not established" }, 347 { 0x056f02, "Copy protection key exchange failure"
348 " - Key not established" },
350 { 0x056f03, "Read of scrambled sector without authentication" }, 349 { 0x056f03, "Read of scrambled sector without authentication" },
351 { 0x056f04, "Media region code is mismatched to logical unit" }, 350 { 0x056f04, "Media region code is mismatched to logical unit" },
352 { 0x056f05, "Drive region must be permanent / region reset count error" }, 351 { 0x056f05, "Drive region must be permanent"
352 " / region reset count error" },
353 { 0x057203, "Session fixation error - incomplete track in session" }, 353 { 0x057203, "Session fixation error - incomplete track in session" },
354 { 0x057204, "Empty or partially written reserved track" }, 354 { 0x057204, "Empty or partially written reserved track" },
355 { 0x057205, "No more RZONE reservations are allowed" }, 355 { 0x057205, "No more RZONE reservations are allowed" },
@@ -364,7 +364,6 @@ static const struct {
364 { 0x065a00, "Operator request or state change input (unspecified)" }, 364 { 0x065a00, "Operator request or state change input (unspecified)" },
365 { 0x065a01, "Operator medium removal request" }, 365 { 0x065a01, "Operator medium removal request" },
366 { 0x0bb900, "Play operation aborted" }, 366 { 0x0bb900, "Play operation aborted" },
367
368 /* Here we use 0xff for the key (not a valid key) to signify 367 /* Here we use 0xff for the key (not a valid key) to signify
369 * that these can have _any_ key value associated with them... */ 368 * that these can have _any_ key value associated with them... */
370 { 0xff0401, "Logical unit is in process of becoming ready" }, 369 { 0xff0401, "Logical unit is in process of becoming ready" },