From patchwork Thu Aug 11 18:35:57 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Smart X-Patchwork-Id: 9275759 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A03996022E for ; Thu, 11 Aug 2016 18:36:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9324F28775 for ; Thu, 11 Aug 2016 18:36:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 880D428777; Thu, 11 Aug 2016 18:36:08 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 34D5428775 for ; Thu, 11 Aug 2016 18:36:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932219AbcHKSgG (ORCPT ); Thu, 11 Aug 2016 14:36:06 -0400 Received: from mail-qk0-f180.google.com ([209.85.220.180]:34742 "EHLO mail-qk0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752056AbcHKSgA (ORCPT ); Thu, 11 Aug 2016 14:36:00 -0400 Received: by mail-qk0-f180.google.com with SMTP id p186so4257152qkd.1 for ; Thu, 11 Aug 2016 11:36:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=date:from:to:subject:message-id:user-agent:mime-version :content-transfer-encoding; bh=ow4nby7iT9yjpsIwcMREbcjIDkXu3UPvpPnpB/hGNzk=; b=dPPkelYxN7kqHk/30u87TDxfOPNpqEdxLExQP4WRuoTgZUh4zMMEgRkDrs9XC2OM/J Z3Dyz0jFRFzI0gADrspRCL6QkF8GbjdAfaDZcAPa47kiEen/4o4/c8lpuucTk78dPOMs lZ51REQ8SjqbQSvY9D86qd40n2ZXBwXpMK9Mg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:subject:message-id:user-agent :mime-version:content-transfer-encoding; bh=ow4nby7iT9yjpsIwcMREbcjIDkXu3UPvpPnpB/hGNzk=; b=RMXGmbmmWFnd3yIytPs9UYU+YWK76lVAnHgOnURYX9Gq+rEa0rRZU4sPTREjIoxUKS 7w32NdXRWrzrChiwR+rh9f8t006GoPLAZnUEg6AtXOX/HcR72CRrjZ5wY59yIAbHwk7I dAzKpJTLPHXrjXVt+GYOzb1O+/tB3l6mQaLIie08uNTuArSoKwEUB6evlc87YjSeowDa 7dJVNWRQYUxNtqAXrf5FZgizROPbyZV8AeKRPSX8vKgBr09yTP1e5RqfyDKtMlTvrst1 0qHqVOruT4hfGDPM7/aZixyYTC2aTpUqVr+BNMb8lR9H85N5yf9Illq/Qy9AuqX6D1d5 uLKQ== X-Gm-Message-State: AEkoous4WuZJdxyUTBLJI+U9e0SW4WVVhqYcjVYnaYrLKT8vOGaiqjtKTGJ8xN4/uiP0l6kx X-Received: by 10.55.109.198 with SMTP id i189mr13299742qkc.73.1470940559518; Thu, 11 Aug 2016 11:35:59 -0700 (PDT) Received: from flash ([192.19.245.250]) by smtp.gmail.com with ESMTPSA id v24sm975604qkv.3.2016.08.11.11.35.58 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 11 Aug 2016 11:35:59 -0700 (PDT) Date: Thu, 11 Aug 2016 11:35:57 -0700 From: james.smart@broadcom.com (James Smart) To: linux-scsi@vger.kernel.org Subject: [PATCH 10/14] lpfc: Code cleanup for lpfc_sriov_nr_virtfn parameter Message-ID: <57acc58d.lt/m+VA/JxYpj1Hz%james.smart@broadcom.com> User-Agent: Heirloom mailx 12.5 6/20/10 MIME-Version: 1.0 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Code cleanup for lpfc_sriov_nr_virtfn parameter Signed-off-by: Dick Kennedy Signed-off-by: James Smart Reviewed-by: Johannes Thumshirn --- drivers/scsi/lpfc/lpfc_attr.c | 35 +++-------------------------------- 1 file changed, 3 insertions(+), 32 deletions(-) diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c index 3051e66..1b6090c 100644 --- a/drivers/scsi/lpfc/lpfc_attr.c +++ b/drivers/scsi/lpfc/lpfc_attr.c @@ -4007,39 +4007,10 @@ lpfc_sriov_nr_virtfn_store(struct device *dev, struct device_attribute *attr, return rc; } -static int lpfc_sriov_nr_virtfn = LPFC_DEF_VFN_PER_PFN; -module_param(lpfc_sriov_nr_virtfn, int, S_IRUGO|S_IWUSR); -MODULE_PARM_DESC(lpfc_sriov_nr_virtfn, "Enable PCIe device SR-IOV virtual fn"); -lpfc_param_show(sriov_nr_virtfn) +LPFC_ATTR(sriov_nr_virtfn, LPFC_DEF_VFN_PER_PFN, 0, LPFC_MAX_VFN_PER_PFN, + "Enable PCIe device SR-IOV virtual fn"); -/** - * lpfc_sriov_nr_virtfn_init - Set the initial sr-iov virtual function enable - * @phba: lpfc_hba pointer. - * @val: link speed value. - * - * Description: - * If val is in a valid range [0,255], then set the adapter's initial - * cfg_sriov_nr_virtfn field. If it's greater than the maximum, the maximum - * number shall be used instead. It will be up to the driver's probe_one - * routine to determine whether the device's SR-IOV is supported or not. - * - * Returns: - * zero if val saved. - * -EINVAL val out of range - **/ -static int -lpfc_sriov_nr_virtfn_init(struct lpfc_hba *phba, int val) -{ - if (val >= 0 && val <= LPFC_MAX_VFN_PER_PFN) { - phba->cfg_sriov_nr_virtfn = val; - return 0; - } - - lpfc_printf_log(phba, KERN_ERR, LOG_INIT, - "3017 Enabling %d virtual functions is not " - "allowed.\n", val); - return -EINVAL; -} +lpfc_param_show(sriov_nr_virtfn) static DEVICE_ATTR(lpfc_sriov_nr_virtfn, S_IRUGO | S_IWUSR, lpfc_sriov_nr_virtfn_show, lpfc_sriov_nr_virtfn_store);