From patchwork Fri Jan 17 07:19:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Deepak Ukey X-Patchwork-Id: 11338427 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0F12E921 for ; Fri, 17 Jan 2020 07:10:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id EBC0A2083E for ; Fri, 17 Jan 2020 07:10:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729190AbgAQHKl (ORCPT ); Fri, 17 Jan 2020 02:10:41 -0500 Received: from esa5.microchip.iphmx.com ([216.71.150.166]:16677 "EHLO esa5.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726675AbgAQHKl (ORCPT ); Fri, 17 Jan 2020 02:10:41 -0500 Received-SPF: Pass (esa5.microchip.iphmx.com: domain of viswas.g@microsemi.com designates 208.19.100.22 as permitted sender) identity=mailfrom; client-ip=208.19.100.22; receiver=esa5.microchip.iphmx.com; envelope-from="viswas.g@microsemi.com"; x-sender="viswas.g@microsemi.com"; x-conformance=spf_only; x-record-type="v=spf1"; x-record-text="v=spf1 ip4:208.19.100.20 ip4:208.19.100.21 ip4:208.19.100.22 ip4:208.19.100.23 ip4:208.19.99.221 ip4:208.19.99.222 ip4:208.19.99.223 ip4:208.19.99.225 -all" Received-SPF: None (esa5.microchip.iphmx.com: no sender authenticity information available from domain of postmaster@smtp.microsemi.com) identity=helo; client-ip=208.19.100.22; receiver=esa5.microchip.iphmx.com; envelope-from="viswas.g@microsemi.com"; x-sender="postmaster@smtp.microsemi.com"; x-conformance=spf_only Authentication-Results: esa5.microchip.iphmx.com; dkim=none (message not signed) header.i=none; spf=Pass smtp.mailfrom=viswas.g@microsemi.com; spf=None smtp.helo=postmaster@smtp.microsemi.com; dmarc=fail (p=none dis=none) d=microchip.com IronPort-SDR: y3yItHEHPM5phpJ5frNv4cV/zZjgB9ustdw+CmIX9LxDd2xH/EmDRiUTKMaanDKOvgZxp6pZYM QW/54zCzX7noUvtkMJ7TaGDrIyJboRBUgJXxhWh0Tki2HirggEUj4i1PnzxqSCWW4lNvSExsiV p4BMrx/fOgyUdcyHVHKgjxAPc2ThmGteXeggyF7p+t0hPf79cF6k7kNB+ForrLKvWolkd6RvyV xs/gVUji+8Mr9E8feNgUgZ/yU0EXoQTfwnBzLw91wNdr7oTAUoGRgo0kakDOIoRiHtMG2Y2d4+ dg8= X-IronPort-AV: E=Sophos;i="5.70,329,1574146800"; d="scan'208";a="62253227" Received: from unknown (HELO smtp.microsemi.com) ([208.19.100.22]) by esa5.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 17 Jan 2020 00:10:41 -0700 Received: from AVMBX1.microsemi.net (10.100.34.31) by AVMBX2.microsemi.net (10.100.34.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1847.3; Thu, 16 Jan 2020 23:10:39 -0800 Received: from localhost (10.41.130.51) by avmbx1.microsemi.net (10.100.34.31) with Microsoft SMTP Server id 15.1.1847.3 via Frontend Transport; Thu, 16 Jan 2020 23:10:39 -0800 From: Deepak Ukey To: CC: , , , , , , , , , , Subject: [PATCH V2 06/13] pm80xx : sysfs attribute for number of phys. Date: Fri, 17 Jan 2020 12:49:16 +0530 Message-ID: <20200117071923.7445-7-deepak.ukey@microchip.com> X-Mailer: git-send-email 2.19.0-rc1 In-Reply-To: <20200117071923.7445-1-deepak.ukey@microchip.com> References: <20200117071923.7445-1-deepak.ukey@microchip.com> MIME-Version: 1.0 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org From: Viswas G Added sysfs attribute to show number of phys. Signed-off-by: Deepak Ukey Signed-off-by: Viswas G Signed-off-by: Radha Ramachandran --- drivers/scsi/pm8001/pm8001_ctl.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/drivers/scsi/pm8001/pm8001_ctl.c b/drivers/scsi/pm8001/pm8001_ctl.c index 69458b318a20..8091e78a04b0 100644 --- a/drivers/scsi/pm8001/pm8001_ctl.c +++ b/drivers/scsi/pm8001/pm8001_ctl.c @@ -89,6 +89,25 @@ static ssize_t controller_fatal_error_show(struct device *cdev, } static DEVICE_ATTR_RO(controller_fatal_error); +/** + * num_phys_show - Number of phys + * @cdev:pointer to embedded class device + * @buf:the buffer returned + * A sysfs 'read-only' shost attribute. + */ +static ssize_t num_phys_show(struct device *cdev, + struct device_attribute *attr, char *buf) +{ + int ret; + struct Scsi_Host *shost = class_to_shost(cdev); + struct sas_ha_struct *sha = SHOST_TO_SAS_HA(shost); + struct pm8001_hba_info *pm8001_ha = sha->lldd_ha; + + ret = sprintf(buf, "%d", pm8001_ha->chip->n_phy); + return ret; +} +static DEVICE_ATTR_RO(num_phys); + /** * pm8001_ctl_fw_version_show - firmware version * @cdev: pointer to embedded class device @@ -825,6 +844,7 @@ static DEVICE_ATTR(update_fw, S_IRUGO|S_IWUSR|S_IWGRP, struct device_attribute *pm8001_host_attrs[] = { &dev_attr_interface_rev, &dev_attr_controller_fatal_error, + &dev_attr_num_phys, &dev_attr_fw_version, &dev_attr_update_fw, &dev_attr_aap_log,