aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/bfa/bfad_attr.c
diff options
context:
space:
mode:
authorKrishna Gudipati <kgudipat@brocade.com>2010-03-05 22:37:57 -0500
committerJames Bottomley <James.Bottomley@suse.de>2010-03-07 02:37:00 -0500
commit0a4b1fc0b24fc7adbaf8413f2992ce1395991a78 (patch)
tree9a07aeee614e2e3f3191aee552effc467163fb33 /drivers/scsi/bfa/bfad_attr.c
parentf58e9ebbf78bd36c6cf1ca651280d39efe73a7c0 (diff)
[SCSI] bfa: Replace bfa_get_attr() with specific APIs
bfa_ioc_attr_s is a big structure and some times could cause stack overflow if defined locally, so add specific APIs that are needed to replace the use of ioc_attr local var. Signed-off-by: Krishna Gudipati <kgudipat@brocade.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/scsi/bfa/bfad_attr.c')
-rw-r--r--drivers/scsi/bfa/bfad_attr.c62
1 files changed, 25 insertions, 37 deletions
diff --git a/drivers/scsi/bfa/bfad_attr.c b/drivers/scsi/bfa/bfad_attr.c
index a691133c31a2..dd5cb20d4b37 100644
--- a/drivers/scsi/bfa/bfad_attr.c
+++ b/drivers/scsi/bfa/bfad_attr.c
@@ -424,12 +424,10 @@ bfad_im_serial_num_show(struct device *dev, struct device_attribute *attr,
424 struct bfad_im_port_s *im_port = 424 struct bfad_im_port_s *im_port =
425 (struct bfad_im_port_s *) shost->hostdata[0]; 425 (struct bfad_im_port_s *) shost->hostdata[0];
426 struct bfad_s *bfad = im_port->bfad; 426 struct bfad_s *bfad = im_port->bfad;
427 struct bfa_ioc_attr_s ioc_attr; 427 char serial_num[BFA_ADAPTER_SERIAL_NUM_LEN];
428 428
429 memset(&ioc_attr, 0, sizeof(ioc_attr)); 429 bfa_get_adapter_serial_num(&bfad->bfa, serial_num);
430 bfa_get_attr(&bfad->bfa, &ioc_attr); 430 return snprintf(buf, PAGE_SIZE, "%s\n", serial_num);
431 return snprintf(buf, PAGE_SIZE, "%s\n",
432 ioc_attr.adapter_attr.serial_num);
433} 431}
434 432
435static ssize_t 433static ssize_t
@@ -440,11 +438,10 @@ bfad_im_model_show(struct device *dev, struct device_attribute *attr,
440 struct bfad_im_port_s *im_port = 438 struct bfad_im_port_s *im_port =
441 (struct bfad_im_port_s *) shost->hostdata[0]; 439 (struct bfad_im_port_s *) shost->hostdata[0];
442 struct bfad_s *bfad = im_port->bfad; 440 struct bfad_s *bfad = im_port->bfad;
443 struct bfa_ioc_attr_s ioc_attr; 441 char model[BFA_ADAPTER_MODEL_NAME_LEN];
444 442
445 memset(&ioc_attr, 0, sizeof(ioc_attr)); 443 bfa_get_adapter_model(&bfad->bfa, model);
446 bfa_get_attr(&bfad->bfa, &ioc_attr); 444 return snprintf(buf, PAGE_SIZE, "%s\n", model);
447 return snprintf(buf, PAGE_SIZE, "%s\n", ioc_attr.adapter_attr.model);
448} 445}
449 446
450static ssize_t 447static ssize_t
@@ -455,12 +452,10 @@ bfad_im_model_desc_show(struct device *dev, struct device_attribute *attr,
455 struct bfad_im_port_s *im_port = 452 struct bfad_im_port_s *im_port =
456 (struct bfad_im_port_s *) shost->hostdata[0]; 453 (struct bfad_im_port_s *) shost->hostdata[0];
457 struct bfad_s *bfad = im_port->bfad; 454 struct bfad_s *bfad = im_port->bfad;
458 struct bfa_ioc_attr_s ioc_attr; 455 char model_descr[BFA_ADAPTER_MODEL_DESCR_LEN];
459 456
460 memset(&ioc_attr, 0, sizeof(ioc_attr)); 457 bfa_get_adapter_model(&bfad->bfa, model_descr);
461 bfa_get_attr(&bfad->bfa, &ioc_attr); 458 return snprintf(buf, PAGE_SIZE, "%s\n", model_descr);
462 return snprintf(buf, PAGE_SIZE, "%s\n",
463 ioc_attr.adapter_attr.model_descr);
464} 459}
465 460
466static ssize_t 461static ssize_t
@@ -485,14 +480,13 @@ bfad_im_symbolic_name_show(struct device *dev, struct device_attribute *attr,
485 struct bfad_im_port_s *im_port = 480 struct bfad_im_port_s *im_port =
486 (struct bfad_im_port_s *) shost->hostdata[0]; 481 (struct bfad_im_port_s *) shost->hostdata[0];
487 struct bfad_s *bfad = im_port->bfad; 482 struct bfad_s *bfad = im_port->bfad;
488 struct bfa_ioc_attr_s ioc_attr; 483 char model[BFA_ADAPTER_MODEL_NAME_LEN];
489 484 char fw_ver[BFA_VERSION_LEN];
490 memset(&ioc_attr, 0, sizeof(ioc_attr));
491 bfa_get_attr(&bfad->bfa, &ioc_attr);
492 485
486 bfa_get_adapter_model(&bfad->bfa, model);
487 bfa_get_adapter_fw_ver(&bfad->bfa, fw_ver);
493 return snprintf(buf, PAGE_SIZE, "Brocade %s FV%s DV%s\n", 488 return snprintf(buf, PAGE_SIZE, "Brocade %s FV%s DV%s\n",
494 ioc_attr.adapter_attr.model, 489 model, fw_ver, BFAD_DRIVER_VERSION);
495 ioc_attr.adapter_attr.fw_ver, BFAD_DRIVER_VERSION);
496} 490}
497 491
498static ssize_t 492static ssize_t
@@ -503,11 +497,10 @@ bfad_im_hw_version_show(struct device *dev, struct device_attribute *attr,
503 struct bfad_im_port_s *im_port = 497 struct bfad_im_port_s *im_port =
504 (struct bfad_im_port_s *) shost->hostdata[0]; 498 (struct bfad_im_port_s *) shost->hostdata[0];
505 struct bfad_s *bfad = im_port->bfad; 499 struct bfad_s *bfad = im_port->bfad;
506 struct bfa_ioc_attr_s ioc_attr; 500 char hw_ver[BFA_VERSION_LEN];
507 501
508 memset(&ioc_attr, 0, sizeof(ioc_attr)); 502 bfa_get_pci_chip_rev(&bfad->bfa, hw_ver);
509 bfa_get_attr(&bfad->bfa, &ioc_attr); 503 return snprintf(buf, PAGE_SIZE, "%s\n", hw_ver);
510 return snprintf(buf, PAGE_SIZE, "%s\n", ioc_attr.adapter_attr.hw_ver);
511} 504}
512 505
513static ssize_t 506static ssize_t
@@ -525,12 +518,10 @@ bfad_im_optionrom_version_show(struct device *dev,
525 struct bfad_im_port_s *im_port = 518 struct bfad_im_port_s *im_port =
526 (struct bfad_im_port_s *) shost->hostdata[0]; 519 (struct bfad_im_port_s *) shost->hostdata[0];
527 struct bfad_s *bfad = im_port->bfad; 520 struct bfad_s *bfad = im_port->bfad;
528 struct bfa_ioc_attr_s ioc_attr; 521 char optrom_ver[BFA_VERSION_LEN];
529 522
530 memset(&ioc_attr, 0, sizeof(ioc_attr)); 523 bfa_get_adapter_optrom_ver(&bfad->bfa, optrom_ver);
531 bfa_get_attr(&bfad->bfa, &ioc_attr); 524 return snprintf(buf, PAGE_SIZE, "%s\n", optrom_ver);
532 return snprintf(buf, PAGE_SIZE, "%s\n",
533 ioc_attr.adapter_attr.optrom_ver);
534} 525}
535 526
536static ssize_t 527static ssize_t
@@ -541,11 +532,10 @@ bfad_im_fw_version_show(struct device *dev, struct device_attribute *attr,
541 struct bfad_im_port_s *im_port = 532 struct bfad_im_port_s *im_port =
542 (struct bfad_im_port_s *) shost->hostdata[0]; 533 (struct bfad_im_port_s *) shost->hostdata[0];
543 struct bfad_s *bfad = im_port->bfad; 534 struct bfad_s *bfad = im_port->bfad;
544 struct bfa_ioc_attr_s ioc_attr; 535 char fw_ver[BFA_VERSION_LEN];
545 536
546 memset(&ioc_attr, 0, sizeof(ioc_attr)); 537 bfa_get_adapter_fw_ver(&bfad->bfa, fw_ver);
547 bfa_get_attr(&bfad->bfa, &ioc_attr); 538 return snprintf(buf, PAGE_SIZE, "%s\n", fw_ver);
548 return snprintf(buf, PAGE_SIZE, "%s\n", ioc_attr.adapter_attr.fw_ver);
549} 539}
550 540
551static ssize_t 541static ssize_t
@@ -556,11 +546,9 @@ bfad_im_num_of_ports_show(struct device *dev, struct device_attribute *attr,
556 struct bfad_im_port_s *im_port = 546 struct bfad_im_port_s *im_port =
557 (struct bfad_im_port_s *) shost->hostdata[0]; 547 (struct bfad_im_port_s *) shost->hostdata[0];
558 struct bfad_s *bfad = im_port->bfad; 548 struct bfad_s *bfad = im_port->bfad;
559 struct bfa_ioc_attr_s ioc_attr;
560 549
561 memset(&ioc_attr, 0, sizeof(ioc_attr)); 550 return snprintf(buf, PAGE_SIZE, "%d\n",
562 bfa_get_attr(&bfad->bfa, &ioc_attr); 551 bfa_get_nports(&bfad->bfa));
563 return snprintf(buf, PAGE_SIZE, "%d\n", ioc_attr.adapter_attr.nports);
564} 552}
565 553
566static ssize_t 554static ssize_t