Commit 1a89dd8f0b4d7eca2dd4abffb736f37676e1b073

Authored by Felix Beck
Committed by Heiko Carstens
1 parent 26348f78e8

[S390] Cleanup zcrypt printk messages.

Signed-off-by: Felix Beck <felix.beck@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>

Showing 7 changed files with 17 additions and 130 deletions Side-by-side Diff

drivers/s390/crypto/zcrypt_api.c
... ... @@ -1068,10 +1068,8 @@
1068 1068  
1069 1069 #define LBUFSIZE 1200UL
1070 1070 lbuf = kmalloc(LBUFSIZE, GFP_KERNEL);
1071   - if (!lbuf) {
1072   - PRINTK("kmalloc failed!\n");
  1071 + if (!lbuf)
1073 1072 return 0;
1074   - }
1075 1073  
1076 1074 local_count = min(LBUFSIZE - 1, count);
1077 1075 if (copy_from_user(lbuf, buffer, local_count) != 0) {
1078 1076  
1079 1077  
1080 1078  
1081 1079  
1082 1080  
... ... @@ -1081,23 +1079,15 @@
1081 1079 lbuf[local_count] = '\0';
1082 1080  
1083 1081 ptr = strstr(lbuf, "Online devices");
1084   - if (!ptr) {
1085   - PRINTK("Unable to parse data (missing \"Online devices\")\n");
  1082 + if (!ptr)
1086 1083 goto out;
1087   - }
1088 1084 ptr = strstr(ptr, "\n");
1089   - if (!ptr) {
1090   - PRINTK("Unable to parse data (missing newline "
1091   - "after \"Online devices\")\n");
  1085 + if (!ptr)
1092 1086 goto out;
1093   - }
1094 1087 ptr++;
1095 1088  
1096   - if (strstr(ptr, "Waiting work element counts") == NULL) {
1097   - PRINTK("Unable to parse data (missing "
1098   - "\"Waiting work element counts\")\n");
  1089 + if (strstr(ptr, "Waiting work element counts") == NULL)
1099 1090 goto out;
1100   - }
1101 1091  
1102 1092 for (j = 0; j < 64 && *ptr; ptr++) {
1103 1093 /*
1104 1094  
1105 1095  
... ... @@ -1197,16 +1187,12 @@
1197 1187  
1198 1188 /* Register the request sprayer. */
1199 1189 rc = misc_register(&zcrypt_misc_device);
1200   - if (rc < 0) {
1201   - PRINTKW(KERN_ERR "misc_register (minor %d) failed with %d\n",
1202   - zcrypt_misc_device.minor, rc);
  1190 + if (rc < 0)
1203 1191 goto out;
1204   - }
1205 1192  
1206 1193 /* Set up the proc file system */
1207 1194 zcrypt_entry = create_proc_entry("driver/z90crypt", 0644, NULL);
1208 1195 if (!zcrypt_entry) {
1209   - PRINTK("Couldn't create z90crypt proc entry\n");
1210 1196 rc = -ENOMEM;
1211 1197 goto out_misc;
1212 1198 }
drivers/s390/crypto/zcrypt_api.h
... ... @@ -30,34 +30,6 @@
30 30 #ifndef _ZCRYPT_API_H_
31 31 #define _ZCRYPT_API_H_
32 32  
33   -/**
34   - * Macro definitions
35   - *
36   - * PDEBUG debugs in the form "zcrypt: function_name -> message"
37   - *
38   - * PRINTK is like PDEBUG, except that it is always enabled
39   - * PRINTKN is like PRINTK, except that it does not include the function name
40   - * PRINTKW is like PRINTK, except that it uses KERN_WARNING
41   - * PRINTKC is like PRINTK, except that it uses KERN_CRIT
42   - */
43   -#define DEV_NAME "zcrypt"
44   -
45   -#define PRINTK(fmt, args...) \
46   - printk(KERN_DEBUG DEV_NAME ": %s -> " fmt, __func__ , ## args)
47   -#define PRINTKN(fmt, args...) \
48   - printk(KERN_DEBUG DEV_NAME ": " fmt, ## args)
49   -#define PRINTKW(fmt, args...) \
50   - printk(KERN_WARNING DEV_NAME ": %s -> " fmt, __func__ , ## args)
51   -#define PRINTKC(fmt, args...) \
52   - printk(KERN_CRIT DEV_NAME ": %s -> " fmt, __func__ , ## args)
53   -
54   -#ifdef ZCRYPT_DEBUG
55   -#define PDEBUG(fmt, args...) \
56   - printk(KERN_DEBUG DEV_NAME ": %s -> " fmt, __func__ , ## args)
57   -#else
58   -#define PDEBUG(fmt, args...) do {} while (0)
59   -#endif
60   -
61 33 #include "ap_bus.h"
62 34 #include <asm/zcrypt.h>
63 35  
drivers/s390/crypto/zcrypt_cex2a.c
... ... @@ -243,9 +243,6 @@
243 243 return convert_type80(zdev, reply,
244 244 outputdata, outputdatalength);
245 245 default: /* Unknown response type, this should NEVER EVER happen */
246   - PRINTK("Unrecognized Message Header: %08x%08x\n",
247   - *(unsigned int *) reply->message,
248   - *(unsigned int *) (reply->message+4));
249 246 zdev->online = 0;
250 247 return -EAGAIN; /* repeat the request on a different device. */
251 248 }
drivers/s390/crypto/zcrypt_error.h
... ... @@ -92,10 +92,6 @@
92 92 {
93 93 struct error_hdr *ehdr = reply->message;
94 94  
95   - PRINTK("Hardware error : Type %02x Message Header: %08x%08x\n",
96   - ehdr->type, *(unsigned int *) reply->message,
97   - *(unsigned int *) (reply->message + 4));
98   -
99 95 switch (ehdr->reply_code) {
100 96 case REP82_ERROR_OPERAND_INVALID:
101 97 case REP82_ERROR_OPERAND_SIZE:
... ... @@ -123,8 +119,6 @@
123 119 zdev->online = 0;
124 120 return -EAGAIN;
125 121 default:
126   - PRINTKW("unknown type %02x reply code = %d\n",
127   - ehdr->type, ehdr->reply_code);
128 122 zdev->online = 0;
129 123 return -EAGAIN; /* repeat the request on a different device. */
130 124 }
drivers/s390/crypto/zcrypt_pcica.c
... ... @@ -226,9 +226,6 @@
226 226 return convert_type84(zdev, reply,
227 227 outputdata, outputdatalength);
228 228 default: /* Unknown response type, this should NEVER EVER happen */
229   - PRINTK("Unrecognized Message Header: %08x%08x\n",
230   - *(unsigned int *) reply->message,
231   - *(unsigned int *) (reply->message+4));
232 229 zdev->online = 0;
233 230 return -EAGAIN; /* repeat the request on a different device. */
234 231 }
drivers/s390/crypto/zcrypt_pcicc.c
... ... @@ -361,26 +361,18 @@
361 361 service_rc = le16_to_cpu(msg->cprb.ccp_rtcode);
362 362 if (unlikely(service_rc != 0)) {
363 363 service_rs = le16_to_cpu(msg->cprb.ccp_rscode);
364   - if (service_rc == 8 && service_rs == 66) {
365   - PDEBUG("Bad block format on PCICC\n");
  364 + if (service_rc == 8 && service_rs == 66)
366 365 return -EINVAL;
367   - }
368   - if (service_rc == 8 && service_rs == 65) {
369   - PDEBUG("Probably an even modulus on PCICC\n");
  366 + if (service_rc == 8 && service_rs == 65)
370 367 return -EINVAL;
371   - }
372 368 if (service_rc == 8 && service_rs == 770) {
373   - PDEBUG("Invalid key length on PCICC\n");
374 369 zdev->max_mod_size = PCICC_MAX_MOD_SIZE_OLD;
375 370 return -EAGAIN;
376 371 }
377 372 if (service_rc == 8 && service_rs == 783) {
378   - PDEBUG("Extended bitlengths not enabled on PCICC\n");
379 373 zdev->max_mod_size = PCICC_MAX_MOD_SIZE_OLD;
380 374 return -EAGAIN;
381 375 }
382   - PRINTK("Unknown service rc/rs (PCICC): %d/%d\n",
383   - service_rc, service_rs);
384 376 zdev->online = 0;
385 377 return -EAGAIN; /* repeat the request on a different device. */
386 378 }
... ... @@ -434,9 +426,6 @@
434 426 outputdata, outputdatalength);
435 427 /* no break, incorrect cprb version is an unknown response */
436 428 default: /* Unknown response type, this should NEVER EVER happen */
437   - PRINTK("Unrecognized Message Header: %08x%08x\n",
438   - *(unsigned int *) reply->message,
439   - *(unsigned int *) (reply->message+4));
440 429 zdev->online = 0;
441 430 return -EAGAIN; /* repeat the request on a different device. */
442 431 }
drivers/s390/crypto/zcrypt_pcixcc.c
... ... @@ -290,38 +290,19 @@
290 290 ap_msg->length = sizeof(struct type6_hdr) +
291 291 CEIL4(xcRB->request_control_blk_length) +
292 292 xcRB->request_data_length;
293   - if (ap_msg->length > PCIXCC_MAX_XCRB_MESSAGE_SIZE) {
294   - PRINTK("Combined message is too large (%ld/%d/%d).\n",
295   - sizeof(struct type6_hdr),
296   - xcRB->request_control_blk_length,
297   - xcRB->request_data_length);
  293 + if (ap_msg->length > PCIXCC_MAX_XCRB_MESSAGE_SIZE)
298 294 return -EFAULT;
299   - }
300   - if (CEIL4(xcRB->reply_control_blk_length) >
301   - PCIXCC_MAX_XCRB_REPLY_SIZE) {
302   - PDEBUG("Reply CPRB length is too large (%d).\n",
303   - xcRB->request_control_blk_length);
  295 + if (CEIL4(xcRB->reply_control_blk_length) > PCIXCC_MAX_XCRB_REPLY_SIZE)
304 296 return -EFAULT;
305   - }
306   - if (CEIL4(xcRB->reply_data_length) > PCIXCC_MAX_XCRB_DATA_SIZE) {
307   - PDEBUG("Reply data block length is too large (%d).\n",
308   - xcRB->reply_data_length);
  297 + if (CEIL4(xcRB->reply_data_length) > PCIXCC_MAX_XCRB_DATA_SIZE)
309 298 return -EFAULT;
310   - }
311 299 replylen = CEIL4(xcRB->reply_control_blk_length) +
312 300 CEIL4(xcRB->reply_data_length) +
313 301 sizeof(struct type86_fmt2_msg);
314 302 if (replylen > PCIXCC_MAX_XCRB_RESPONSE_SIZE) {
315   - PDEBUG("Reply CPRB + data block > PCIXCC_MAX_XCRB_RESPONSE_SIZE"
316   - " (%d/%d/%d).\n",
317   - sizeof(struct type86_fmt2_msg),
318   - xcRB->reply_control_blk_length,
319   - xcRB->reply_data_length);
320 303 xcRB->reply_control_blk_length = PCIXCC_MAX_XCRB_RESPONSE_SIZE -
321 304 (sizeof(struct type86_fmt2_msg) +
322 305 CEIL4(xcRB->reply_data_length));
323   - PDEBUG("Capping Reply CPRB length at %d\n",
324   - xcRB->reply_control_blk_length);
325 306 }
326 307  
327 308 /* prepare type6 header */
328 309  
... ... @@ -340,11 +321,8 @@
340 321 xcRB->request_control_blk_length))
341 322 return -EFAULT;
342 323 if (msg->cprbx.cprb_len + sizeof(msg->hdr.function_code) >
343   - xcRB->request_control_blk_length) {
344   - PDEBUG("cprb_len too large (%d/%d)\n", msg->cprbx.cprb_len,
345   - xcRB->request_control_blk_length);
  324 + xcRB->request_control_blk_length)
346 325 return -EFAULT;
347   - }
348 326 function_code = ((unsigned char *)&msg->cprbx) + msg->cprbx.cprb_len;
349 327 memcpy(msg->hdr.function_code, function_code, sizeof(msg->hdr.function_code));
350 328  
351 329  
352 330  
353 331  
354 332  
355 333  
356 334  
... ... @@ -472,29 +450,18 @@
472 450 service_rc = msg->cprbx.ccp_rtcode;
473 451 if (unlikely(service_rc != 0)) {
474 452 service_rs = msg->cprbx.ccp_rscode;
475   - if (service_rc == 8 && service_rs == 66) {
476   - PDEBUG("Bad block format on PCIXCC/CEX2C\n");
  453 + if (service_rc == 8 && service_rs == 66)
477 454 return -EINVAL;
478   - }
479   - if (service_rc == 8 && service_rs == 65) {
480   - PDEBUG("Probably an even modulus on PCIXCC/CEX2C\n");
  455 + if (service_rc == 8 && service_rs == 65)
481 456 return -EINVAL;
482   - }
483   - if (service_rc == 8 && service_rs == 770) {
484   - PDEBUG("Invalid key length on PCIXCC/CEX2C\n");
  457 + if (service_rc == 8 && service_rs == 770)
485 458 return -EINVAL;
486   - }
487 459 if (service_rc == 8 && service_rs == 783) {
488   - PDEBUG("Extended bitlengths not enabled on PCIXCC/CEX2C\n");
489 460 zdev->min_mod_size = PCIXCC_MIN_MOD_SIZE_OLD;
490 461 return -EAGAIN;
491 462 }
492   - if (service_rc == 12 && service_rs == 769) {
493   - PDEBUG("Invalid key on PCIXCC/CEX2C\n");
  463 + if (service_rc == 12 && service_rs == 769)
494 464 return -EINVAL;
495   - }
496   - PRINTK("Unknown service rc/rs (PCIXCC/CEX2C): %d/%d\n",
497   - service_rc, service_rs);
498 465 zdev->online = 0;
499 466 return -EAGAIN; /* repeat the request on a different device. */
500 467 }
501 468  
... ... @@ -570,11 +537,8 @@
570 537 } __attribute__((packed)) *msg = reply->message;
571 538 char *data = reply->message;
572 539  
573   - if (msg->cprbx.ccp_rtcode != 0 || msg->cprbx.ccp_rscode != 0) {
574   - PDEBUG("RNG response error on PCIXCC/CEX2C rc=%hu/rs=%hu\n",
575   - rc, rs);
  540 + if (msg->cprbx.ccp_rtcode != 0 || msg->cprbx.ccp_rscode != 0)
576 541 return -EINVAL;
577   - }
578 542 memcpy(buffer, data + msg->fmt2.offset2, msg->fmt2.count2);
579 543 return msg->fmt2.count2;
580 544 }
... ... @@ -599,9 +563,6 @@
599 563 outputdata, outputdatalength);
600 564 /* no break, incorrect cprb version is an unknown response */
601 565 default: /* Unknown response type, this should NEVER EVER happen */
602   - PRINTK("Unrecognized Message Header: %08x%08x\n",
603   - *(unsigned int *) reply->message,
604   - *(unsigned int *) (reply->message+4));
605 566 zdev->online = 0;
606 567 return -EAGAIN; /* repeat the request on a different device. */
607 568 }
... ... @@ -628,9 +589,6 @@
628 589 return convert_type86_xcrb(zdev, reply, xcRB);
629 590 /* no break, incorrect cprb version is an unknown response */
630 591 default: /* Unknown response type, this should NEVER EVER happen */
631   - PRINTK("Unrecognized Message Header: %08x%08x\n",
632   - *(unsigned int *) reply->message,
633   - *(unsigned int *) (reply->message+4));
634 592 xcRB->status = 0x0008044DL; /* HDD_InvalidParm */
635 593 zdev->online = 0;
636 594 return -EAGAIN; /* repeat the request on a different device. */
... ... @@ -654,9 +612,6 @@
654 612 return convert_type86_rng(zdev, reply, data);
655 613 /* no break, incorrect cprb version is an unknown response */
656 614 default: /* Unknown response type, this should NEVER EVER happen */
657   - PRINTK("Unrecognized Message Header: %08x%08x\n",
658   - *(unsigned int *) reply->message,
659   - *(unsigned int *) (reply->message+4));
660 615 zdev->online = 0;
661 616 return -EAGAIN; /* repeat the request on a different device. */
662 617 }
... ... @@ -701,10 +656,7 @@
701 656 memcpy(msg->message, reply->message, length);
702 657 break;
703 658 default:
704   - PRINTK("Invalid internal response type: %i\n",
705   - resp_type->type);
706   - memcpy(msg->message, &error_reply,
707   - sizeof error_reply);
  659 + memcpy(msg->message, &error_reply, sizeof error_reply);
708 660 }
709 661 } else
710 662 memcpy(msg->message, reply->message, sizeof error_reply);