| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Copyright (c) 2005-2014 Brocade Communications Systems, Inc. |
|---|
| 3 | 4 | * Copyright (c) 2014- QLogic Corporation. |
|---|
| .. | .. |
|---|
| 5 | 6 | * www.qlogic.com |
|---|
| 6 | 7 | * |
|---|
| 7 | 8 | * Linux driver for QLogic BR-series Fibre Channel Host Bus Adapter. |
|---|
| 8 | | - * |
|---|
| 9 | | - * This program is free software; you can redistribute it and/or modify it |
|---|
| 10 | | - * under the terms of the GNU General Public License (GPL) Version 2 as |
|---|
| 11 | | - * published by the Free Software Foundation |
|---|
| 12 | | - * |
|---|
| 13 | | - * This program is distributed in the hope that it will be useful, but |
|---|
| 14 | | - * WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 15 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|---|
| 16 | | - * General Public License for more details. |
|---|
| 17 | 9 | */ |
|---|
| 18 | 10 | |
|---|
| 19 | 11 | /* |
|---|
| .. | .. |
|---|
| 445 | 437 | return status; |
|---|
| 446 | 438 | } |
|---|
| 447 | 439 | |
|---|
| 448 | | -int |
|---|
| 440 | +static int |
|---|
| 449 | 441 | bfad_im_issue_fc_host_lip(struct Scsi_Host *shost) |
|---|
| 450 | 442 | { |
|---|
| 451 | 443 | struct bfad_im_port_s *im_port = |
|---|
| .. | .. |
|---|
| 570 | 562 | return 0; |
|---|
| 571 | 563 | } |
|---|
| 572 | 564 | |
|---|
| 573 | | -void |
|---|
| 565 | +static void |
|---|
| 574 | 566 | bfad_im_vport_set_symbolic_name(struct fc_vport *fc_vport) |
|---|
| 575 | 567 | { |
|---|
| 576 | 568 | struct bfad_vport_s *vport = (struct bfad_vport_s *)fc_vport->dd_data; |
|---|
| .. | .. |
|---|
| 719 | 711 | char serial_num[BFA_ADAPTER_SERIAL_NUM_LEN]; |
|---|
| 720 | 712 | |
|---|
| 721 | 713 | bfa_get_adapter_serial_num(&bfad->bfa, serial_num); |
|---|
| 722 | | - return snprintf(buf, PAGE_SIZE, "%s\n", serial_num); |
|---|
| 714 | + return sysfs_emit(buf, "%s\n", serial_num); |
|---|
| 723 | 715 | } |
|---|
| 724 | 716 | |
|---|
| 725 | 717 | static ssize_t |
|---|
| .. | .. |
|---|
| 733 | 725 | char model[BFA_ADAPTER_MODEL_NAME_LEN]; |
|---|
| 734 | 726 | |
|---|
| 735 | 727 | bfa_get_adapter_model(&bfad->bfa, model); |
|---|
| 736 | | - return snprintf(buf, PAGE_SIZE, "%s\n", model); |
|---|
| 728 | + return sysfs_emit(buf, "%s\n", model); |
|---|
| 737 | 729 | } |
|---|
| 738 | 730 | |
|---|
| 739 | 731 | static ssize_t |
|---|
| .. | .. |
|---|
| 813 | 805 | snprintf(model_descr, BFA_ADAPTER_MODEL_DESCR_LEN, |
|---|
| 814 | 806 | "Invalid Model"); |
|---|
| 815 | 807 | |
|---|
| 816 | | - return snprintf(buf, PAGE_SIZE, "%s\n", model_descr); |
|---|
| 808 | + return sysfs_emit(buf, "%s\n", model_descr); |
|---|
| 817 | 809 | } |
|---|
| 818 | 810 | |
|---|
| 819 | 811 | static ssize_t |
|---|
| .. | .. |
|---|
| 827 | 819 | u64 nwwn; |
|---|
| 828 | 820 | |
|---|
| 829 | 821 | nwwn = bfa_fcs_lport_get_nwwn(port->fcs_port); |
|---|
| 830 | | - return snprintf(buf, PAGE_SIZE, "0x%llx\n", cpu_to_be64(nwwn)); |
|---|
| 822 | + return sysfs_emit(buf, "0x%llx\n", cpu_to_be64(nwwn)); |
|---|
| 831 | 823 | } |
|---|
| 832 | 824 | |
|---|
| 833 | 825 | static ssize_t |
|---|
| .. | .. |
|---|
| 844 | 836 | bfa_fcs_lport_get_attr(&bfad->bfa_fcs.fabric.bport, &port_attr); |
|---|
| 845 | 837 | strlcpy(symname, port_attr.port_cfg.sym_name.symname, |
|---|
| 846 | 838 | BFA_SYMNAME_MAXLEN); |
|---|
| 847 | | - return snprintf(buf, PAGE_SIZE, "%s\n", symname); |
|---|
| 839 | + return sysfs_emit(buf, "%s\n", symname); |
|---|
| 848 | 840 | } |
|---|
| 849 | 841 | |
|---|
| 850 | 842 | static ssize_t |
|---|
| .. | .. |
|---|
| 858 | 850 | char hw_ver[BFA_VERSION_LEN]; |
|---|
| 859 | 851 | |
|---|
| 860 | 852 | bfa_get_pci_chip_rev(&bfad->bfa, hw_ver); |
|---|
| 861 | | - return snprintf(buf, PAGE_SIZE, "%s\n", hw_ver); |
|---|
| 853 | + return sysfs_emit(buf, "%s\n", hw_ver); |
|---|
| 862 | 854 | } |
|---|
| 863 | 855 | |
|---|
| 864 | 856 | static ssize_t |
|---|
| 865 | 857 | bfad_im_drv_version_show(struct device *dev, struct device_attribute *attr, |
|---|
| 866 | 858 | char *buf) |
|---|
| 867 | 859 | { |
|---|
| 868 | | - return snprintf(buf, PAGE_SIZE, "%s\n", BFAD_DRIVER_VERSION); |
|---|
| 860 | + return sysfs_emit(buf, "%s\n", BFAD_DRIVER_VERSION); |
|---|
| 869 | 861 | } |
|---|
| 870 | 862 | |
|---|
| 871 | 863 | static ssize_t |
|---|
| .. | .. |
|---|
| 879 | 871 | char optrom_ver[BFA_VERSION_LEN]; |
|---|
| 880 | 872 | |
|---|
| 881 | 873 | bfa_get_adapter_optrom_ver(&bfad->bfa, optrom_ver); |
|---|
| 882 | | - return snprintf(buf, PAGE_SIZE, "%s\n", optrom_ver); |
|---|
| 874 | + return sysfs_emit(buf, "%s\n", optrom_ver); |
|---|
| 883 | 875 | } |
|---|
| 884 | 876 | |
|---|
| 885 | 877 | static ssize_t |
|---|
| .. | .. |
|---|
| 893 | 885 | char fw_ver[BFA_VERSION_LEN]; |
|---|
| 894 | 886 | |
|---|
| 895 | 887 | bfa_get_adapter_fw_ver(&bfad->bfa, fw_ver); |
|---|
| 896 | | - return snprintf(buf, PAGE_SIZE, "%s\n", fw_ver); |
|---|
| 888 | + return sysfs_emit(buf, "%s\n", fw_ver); |
|---|
| 897 | 889 | } |
|---|
| 898 | 890 | |
|---|
| 899 | 891 | static ssize_t |
|---|
| .. | .. |
|---|
| 905 | 897 | (struct bfad_im_port_s *) shost->hostdata[0]; |
|---|
| 906 | 898 | struct bfad_s *bfad = im_port->bfad; |
|---|
| 907 | 899 | |
|---|
| 908 | | - return snprintf(buf, PAGE_SIZE, "%d\n", |
|---|
| 900 | + return sysfs_emit(buf, "%d\n", |
|---|
| 909 | 901 | bfa_get_nports(&bfad->bfa)); |
|---|
| 910 | 902 | } |
|---|
| 911 | 903 | |
|---|
| .. | .. |
|---|
| 913 | 905 | bfad_im_drv_name_show(struct device *dev, struct device_attribute *attr, |
|---|
| 914 | 906 | char *buf) |
|---|
| 915 | 907 | { |
|---|
| 916 | | - return snprintf(buf, PAGE_SIZE, "%s\n", BFAD_DRIVER_NAME); |
|---|
| 908 | + return sysfs_emit(buf, "%s\n", BFAD_DRIVER_NAME); |
|---|
| 917 | 909 | } |
|---|
| 918 | 910 | |
|---|
| 919 | 911 | static ssize_t |
|---|
| .. | .. |
|---|
| 932 | 924 | rports = kcalloc(nrports, sizeof(struct bfa_rport_qualifier_s), |
|---|
| 933 | 925 | GFP_ATOMIC); |
|---|
| 934 | 926 | if (rports == NULL) |
|---|
| 935 | | - return snprintf(buf, PAGE_SIZE, "Failed\n"); |
|---|
| 927 | + return sysfs_emit(buf, "Failed\n"); |
|---|
| 936 | 928 | |
|---|
| 937 | 929 | spin_lock_irqsave(&bfad->bfad_lock, flags); |
|---|
| 938 | 930 | bfa_fcs_lport_get_rport_quals(port->fcs_port, rports, &nrports); |
|---|
| 939 | 931 | spin_unlock_irqrestore(&bfad->bfad_lock, flags); |
|---|
| 940 | 932 | kfree(rports); |
|---|
| 941 | 933 | |
|---|
| 942 | | - return snprintf(buf, PAGE_SIZE, "%d\n", nrports); |
|---|
| 934 | + return sysfs_emit(buf, "%d\n", nrports); |
|---|
| 943 | 935 | } |
|---|
| 944 | 936 | |
|---|
| 945 | 937 | static DEVICE_ATTR(serial_number, S_IRUGO, |
|---|