From patchwork Mon Mar 22 08:05:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Bogdanov X-Patchwork-Id: 406399 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 51099C433E6 for ; Mon, 22 Mar 2021 08:07:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 22CDC61974 for ; Mon, 22 Mar 2021 08:07:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229865AbhCVIG3 (ORCPT ); Mon, 22 Mar 2021 04:06:29 -0400 Received: from mta-02.yadro.com ([89.207.88.252]:39582 "EHLO mta-01.yadro.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S229874AbhCVIGQ (ORCPT ); Mon, 22 Mar 2021 04:06:16 -0400 Received: from localhost (unknown [127.0.0.1]) by mta-01.yadro.com (Postfix) with ESMTP id 761BB41207; Mon, 22 Mar 2021 08:06:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=yadro.com; h= content-type:content-type:content-transfer-encoding:mime-version :references:in-reply-to:x-mailer:message-id:date:date:subject :subject:from:from:received:received:received; s=mta-01; t= 1616400373; x=1618214774; bh=2pydSoIVlrDtZaiJi7E+MdJiYU0PVTfZRA1 v9Nkjcxs=; b=aaYN1AKXAZAvD8ZnFUpd5T1uH0UHtRxrBJmpgVKOhMc1ENzMVqi zgP2DQ0Dlx61BCc6qysulHnMygDeahB5He0OlW8nLhd2yBK82V+Bcgnc3/NW6s9F sjJ9TkKLMhVEN1dakQhl+IuRtGu8Ilgft21H6SK9HYxWOKLMVlmnG0Xg= X-Virus-Scanned: amavisd-new at yadro.com Received: from mta-01.yadro.com ([127.0.0.1]) by localhost (mta-01.yadro.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 4pKHcCCvIiXh; Mon, 22 Mar 2021 11:06:13 +0300 (MSK) Received: from T-EXCH-03.corp.yadro.com (t-exch-03.corp.yadro.com [172.17.100.103]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mta-01.yadro.com (Postfix) with ESMTPS id AF8D741292; Mon, 22 Mar 2021 11:06:10 +0300 (MSK) Received: from NB-591.corp.yadro.com (10.199.0.33) by T-EXCH-03.corp.yadro.com (172.17.100.103) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.669.32; Mon, 22 Mar 2021 11:06:10 +0300 From: Dmitry Bogdanov To: Martin Petersen , CC: , , Nilesh Javali , Chris Boot , Bart Van Assche , Michael Cyr , Felipe Balbi , Dmitry Bogdanov , Roman Bolshakov Subject: [PATCH v2 3/7] target: qla2xx: replace enable attr to ops.enable Date: Mon, 22 Mar 2021 11:05:50 +0300 Message-ID: <20210322080554.7611-4-d.bogdanov@yadro.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210322080554.7611-1-d.bogdanov@yadro.com> References: <20210322080554.7611-1-d.bogdanov@yadro.com> MIME-Version: 1.0 X-Originating-IP: [10.199.0.33] X-ClientProxiedBy: T-EXCH-01.corp.yadro.com (172.17.10.101) To T-EXCH-03.corp.yadro.com (172.17.100.103) Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Remove tpg/enable attribute. Add fabric ops enable_tpg implementation instead. Reviewed-by: Roman Bolshakov Signed-off-by: Dmitry Bogdanov --- drivers/scsi/qla2xxx/tcm_qla2xxx.c | 73 +++++------------------------- 1 file changed, 12 insertions(+), 61 deletions(-) diff --git a/drivers/scsi/qla2xxx/tcm_qla2xxx.c b/drivers/scsi/qla2xxx/tcm_qla2xxx.c index b55fc768a2a7..a16f9b06b165 100644 --- a/drivers/scsi/qla2xxx/tcm_qla2xxx.c +++ b/drivers/scsi/qla2xxx/tcm_qla2xxx.c @@ -910,40 +910,17 @@ static struct configfs_attribute *tcm_qla2xxx_tpg_attrib_attrs[] = { /* End items for tcm_qla2xxx_tpg_attrib_cit */ -static ssize_t tcm_qla2xxx_tpg_enable_show(struct config_item *item, - char *page) -{ - struct se_portal_group *se_tpg = to_tpg(item); - struct tcm_qla2xxx_tpg *tpg = container_of(se_tpg, - struct tcm_qla2xxx_tpg, se_tpg); - - return snprintf(page, PAGE_SIZE, "%d\n", - atomic_read(&tpg->lport_tpg_enabled)); -} - -static ssize_t tcm_qla2xxx_tpg_enable_store(struct config_item *item, - const char *page, size_t count) +static int tcm_qla2xxx_enable_tpg(struct se_portal_group *se_tpg, + bool enable) { - struct se_portal_group *se_tpg = to_tpg(item); struct se_wwn *se_wwn = se_tpg->se_tpg_wwn; struct tcm_qla2xxx_lport *lport = container_of(se_wwn, struct tcm_qla2xxx_lport, lport_wwn); struct scsi_qla_host *vha = lport->qla_vha; struct tcm_qla2xxx_tpg *tpg = container_of(se_tpg, struct tcm_qla2xxx_tpg, se_tpg); - unsigned long op; - int rc; - rc = kstrtoul(page, 0, &op); - if (rc < 0) { - pr_err("kstrtoul() returned %d\n", rc); - return -EINVAL; - } - if ((op != 1) && (op != 0)) { - pr_err("Illegal value for tpg_enable: %lu\n", op); - return -EINVAL; - } - if (op) { + if (enable) { if (atomic_read(&tpg->lport_tpg_enabled)) return -EEXIST; @@ -951,14 +928,14 @@ static ssize_t tcm_qla2xxx_tpg_enable_store(struct config_item *item, qlt_enable_vha(vha); } else { if (!atomic_read(&tpg->lport_tpg_enabled)) - return count; + return 0; atomic_set(&tpg->lport_tpg_enabled, 0); qlt_stop_phase1(vha->vha_tgt.qla_tgt); qlt_stop_phase2(vha->vha_tgt.qla_tgt); } - return count; + return 0; } static ssize_t tcm_qla2xxx_tpg_dynamic_sessions_show(struct config_item *item, @@ -999,12 +976,10 @@ static ssize_t tcm_qla2xxx_tpg_fabric_prot_type_show(struct config_item *item, return sprintf(page, "%d\n", tpg->tpg_attrib.fabric_prot_type); } -CONFIGFS_ATTR(tcm_qla2xxx_tpg_, enable); CONFIGFS_ATTR_RO(tcm_qla2xxx_tpg_, dynamic_sessions); CONFIGFS_ATTR(tcm_qla2xxx_tpg_, fabric_prot_type); static struct configfs_attribute *tcm_qla2xxx_tpg_attrs[] = { - &tcm_qla2xxx_tpg_attr_enable, &tcm_qla2xxx_tpg_attr_dynamic_sessions, &tcm_qla2xxx_tpg_attr_fabric_prot_type, NULL, @@ -1078,35 +1053,17 @@ static void tcm_qla2xxx_drop_tpg(struct se_portal_group *se_tpg) kfree(tpg); } -static ssize_t tcm_qla2xxx_npiv_tpg_enable_show(struct config_item *item, - char *page) -{ - return tcm_qla2xxx_tpg_enable_show(item, page); -} - -static ssize_t tcm_qla2xxx_npiv_tpg_enable_store(struct config_item *item, - const char *page, size_t count) +static int tcm_qla2xxx_npiv_enable_tpg(struct se_portal_group *se_tpg, + bool enable) { - struct se_portal_group *se_tpg = to_tpg(item); struct se_wwn *se_wwn = se_tpg->se_tpg_wwn; struct tcm_qla2xxx_lport *lport = container_of(se_wwn, struct tcm_qla2xxx_lport, lport_wwn); struct scsi_qla_host *vha = lport->qla_vha; struct tcm_qla2xxx_tpg *tpg = container_of(se_tpg, struct tcm_qla2xxx_tpg, se_tpg); - unsigned long op; - int rc; - rc = kstrtoul(page, 0, &op); - if (rc < 0) { - pr_err("kstrtoul() returned %d\n", rc); - return -EINVAL; - } - if ((op != 1) && (op != 0)) { - pr_err("Illegal value for tpg_enable: %lu\n", op); - return -EINVAL; - } - if (op) { + if (enable) { if (atomic_read(&tpg->lport_tpg_enabled)) return -EEXIST; @@ -1114,23 +1071,16 @@ static ssize_t tcm_qla2xxx_npiv_tpg_enable_store(struct config_item *item, qlt_enable_vha(vha); } else { if (!atomic_read(&tpg->lport_tpg_enabled)) - return count; + return 0; atomic_set(&tpg->lport_tpg_enabled, 0); qlt_stop_phase1(vha->vha_tgt.qla_tgt); qlt_stop_phase2(vha->vha_tgt.qla_tgt); } - return count; + return 0; } -CONFIGFS_ATTR(tcm_qla2xxx_npiv_tpg_, enable); - -static struct configfs_attribute *tcm_qla2xxx_npiv_tpg_attrs[] = { - &tcm_qla2xxx_npiv_tpg_attr_enable, - NULL, -}; - static struct se_portal_group *tcm_qla2xxx_npiv_make_tpg(struct se_wwn *wwn, const char *name) { @@ -1873,6 +1823,7 @@ static const struct target_core_fabric_ops tcm_qla2xxx_ops = { .fabric_make_wwn = tcm_qla2xxx_make_lport, .fabric_drop_wwn = tcm_qla2xxx_drop_lport, .fabric_make_tpg = tcm_qla2xxx_make_tpg, + .fabric_enable_tpg = tcm_qla2xxx_enable_tpg, .fabric_drop_tpg = tcm_qla2xxx_drop_tpg, .fabric_init_nodeacl = tcm_qla2xxx_init_nodeacl, @@ -1913,11 +1864,11 @@ static const struct target_core_fabric_ops tcm_qla2xxx_npiv_ops = { .fabric_make_wwn = tcm_qla2xxx_npiv_make_lport, .fabric_drop_wwn = tcm_qla2xxx_npiv_drop_lport, .fabric_make_tpg = tcm_qla2xxx_npiv_make_tpg, + .fabric_enable_tpg = tcm_qla2xxx_npiv_enable_tpg, .fabric_drop_tpg = tcm_qla2xxx_drop_tpg, .fabric_init_nodeacl = tcm_qla2xxx_init_nodeacl, .tfc_wwn_attrs = tcm_qla2xxx_wwn_attrs, - .tfc_tpg_base_attrs = tcm_qla2xxx_npiv_tpg_attrs, }; static int tcm_qla2xxx_register_configfs(void) From patchwork Mon Mar 22 08:05:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Bogdanov X-Patchwork-Id: 406397 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8A96DC433F1 for ; Mon, 22 Mar 2021 08:07:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5263461967 for ; Mon, 22 Mar 2021 08:07:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229915AbhCVIGe (ORCPT ); Mon, 22 Mar 2021 04:06:34 -0400 Received: from mta-02.yadro.com ([89.207.88.252]:39596 "EHLO mta-01.yadro.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S229875AbhCVIGQ (ORCPT ); Mon, 22 Mar 2021 04:06:16 -0400 Received: from localhost (unknown [127.0.0.1]) by mta-01.yadro.com (Postfix) with ESMTP id AF68A4120D; Mon, 22 Mar 2021 08:06:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=yadro.com; h= content-type:content-type:content-transfer-encoding:mime-version :references:in-reply-to:x-mailer:message-id:date:date:subject :subject:from:from:received:received:received; s=mta-01; t= 1616400373; x=1618214774; bh=uduGAqCQON2nAWKPqKV7WSGmbjJeL0w7EIG R8RS2lwQ=; b=FMuk2DGCXF7Hz4wHxwVJAbncSOg5wc9XlMqZtD9tUDbTsFdEXJe /4ZF6bbBJGbdpoO16PyCNQzIKBqrFdXaeOR5PQ9TM9yfuV9gn2Pb6wCNl+oedsgL Gx4ixSNzfgbMrRiOmOIE4eip2427v13GT9CEe4+LE5iUgQEsZ+iC2I3U= X-Virus-Scanned: amavisd-new at yadro.com Received: from mta-01.yadro.com ([127.0.0.1]) by localhost (mta-01.yadro.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id dkSyqiM3JHAH; Mon, 22 Mar 2021 11:06:13 +0300 (MSK) Received: from T-EXCH-03.corp.yadro.com (t-exch-03.corp.yadro.com [172.17.100.103]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mta-01.yadro.com (Postfix) with ESMTPS id 3ED4D4126D; Mon, 22 Mar 2021 11:06:11 +0300 (MSK) Received: from NB-591.corp.yadro.com (10.199.0.33) by T-EXCH-03.corp.yadro.com (172.17.100.103) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.669.32; Mon, 22 Mar 2021 11:06:10 +0300 From: Dmitry Bogdanov To: Martin Petersen , CC: , , Nilesh Javali , Chris Boot , Bart Van Assche , Michael Cyr , Felipe Balbi , Dmitry Bogdanov , Roman Bolshakov Subject: [PATCH v2 4/7] target: sbp: replace enable attr to ops.enable Date: Mon, 22 Mar 2021 11:05:51 +0300 Message-ID: <20210322080554.7611-5-d.bogdanov@yadro.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210322080554.7611-1-d.bogdanov@yadro.com> References: <20210322080554.7611-1-d.bogdanov@yadro.com> MIME-Version: 1.0 X-Originating-IP: [10.199.0.33] X-ClientProxiedBy: T-EXCH-01.corp.yadro.com (172.17.10.101) To T-EXCH-03.corp.yadro.com (172.17.100.103) Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Remove tpg/enable attribute. Add fabric ops enable_tpg implementation instead. Reviewed-by: Roman Bolshakov Signed-off-by: Dmitry Bogdanov --- drivers/target/sbp/sbp_target.c | 30 +++++------------------------- 1 file changed, 5 insertions(+), 25 deletions(-) diff --git a/drivers/target/sbp/sbp_target.c b/drivers/target/sbp/sbp_target.c index 2a6165febd3b..72f7c00134d3 100644 --- a/drivers/target/sbp/sbp_target.c +++ b/drivers/target/sbp/sbp_target.c @@ -2128,32 +2128,13 @@ static ssize_t sbp_tpg_directory_id_store(struct config_item *item, return count; } -static ssize_t sbp_tpg_enable_show(struct config_item *item, char *page) +static int sbp_enable_tpg(struct se_portal_group *se_tpg, bool enable) { - struct se_portal_group *se_tpg = to_tpg(item); struct sbp_tpg *tpg = container_of(se_tpg, struct sbp_tpg, se_tpg); struct sbp_tport *tport = tpg->tport; - return sprintf(page, "%d\n", tport->enable); -} - -static ssize_t sbp_tpg_enable_store(struct config_item *item, - const char *page, size_t count) -{ - struct se_portal_group *se_tpg = to_tpg(item); - struct sbp_tpg *tpg = container_of(se_tpg, struct sbp_tpg, se_tpg); - struct sbp_tport *tport = tpg->tport; - unsigned long val; int ret; - if (kstrtoul(page, 0, &val) < 0) - return -EINVAL; - if ((val != 0) && (val != 1)) - return -EINVAL; - - if (tport->enable == val) - return count; - - if (val) { + if (enable) { if (sbp_count_se_tpg_luns(&tpg->se_tpg) == 0) { pr_err("Cannot enable a target with no LUNs!\n"); return -EINVAL; @@ -2168,7 +2149,7 @@ static ssize_t sbp_tpg_enable_store(struct config_item *item, spin_unlock_bh(&se_tpg->session_lock); } - tport->enable = val; + tport->enable = enable; ret = sbp_update_unit_directory(tport); if (ret < 0) { @@ -2176,15 +2157,13 @@ static ssize_t sbp_tpg_enable_store(struct config_item *item, return ret; } - return count; + return 0; } CONFIGFS_ATTR(sbp_tpg_, directory_id); -CONFIGFS_ATTR(sbp_tpg_, enable); static struct configfs_attribute *sbp_tpg_base_attrs[] = { &sbp_tpg_attr_directory_id, - &sbp_tpg_attr_enable, NULL, }; @@ -2322,6 +2301,7 @@ static const struct target_core_fabric_ops sbp_ops = { .fabric_make_wwn = sbp_make_tport, .fabric_drop_wwn = sbp_drop_tport, .fabric_make_tpg = sbp_make_tpg, + .fabric_enable_tpg = sbp_enable_tpg, .fabric_drop_tpg = sbp_drop_tpg, .fabric_post_link = sbp_post_link_lun, .fabric_pre_unlink = sbp_pre_unlink_lun, From patchwork Mon Mar 22 08:05:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Bogdanov X-Patchwork-Id: 406398 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E02C4C433E9 for ; Mon, 22 Mar 2021 08:07:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AE90761969 for ; Mon, 22 Mar 2021 08:07:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229872AbhCVIG3 (ORCPT ); Mon, 22 Mar 2021 04:06:29 -0400 Received: from mta-02.yadro.com ([89.207.88.252]:39618 "EHLO mta-01.yadro.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S229884AbhCVIGR (ORCPT ); Mon, 22 Mar 2021 04:06:17 -0400 Received: from localhost (unknown [127.0.0.1]) by mta-01.yadro.com (Postfix) with ESMTP id D283F4128C; Mon, 22 Mar 2021 08:06:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=yadro.com; h= content-type:content-type:content-transfer-encoding:mime-version :references:in-reply-to:x-mailer:message-id:date:date:subject :subject:from:from:received:received:received; s=mta-01; t= 1616400374; x=1618214775; bh=U5GyY3Hr3yNOehxV+yAai293DXLkhHxSo2e 8uLW71YQ=; b=A2es+42J/un0h0Zg6d6j8oItab72mTE/iQPzulVsquDztBtAmpi FUYGq8b3pKi9cna/NyeIlwlPkXExsokmiseeA6iyvs8TCK+dniBP1FF++Wh21g0E OpB4HxUG3mbrwcS257wuV9cATPYwkTDpyP1t8TZMFhHCwmevRvcjy8o4= X-Virus-Scanned: amavisd-new at yadro.com Received: from mta-01.yadro.com ([127.0.0.1]) by localhost (mta-01.yadro.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id uI1ZatKdN0Le; Mon, 22 Mar 2021 11:06:14 +0300 (MSK) Received: from T-EXCH-03.corp.yadro.com (t-exch-03.corp.yadro.com [172.17.100.103]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mta-01.yadro.com (Postfix) with ESMTPS id 4A6794129F; Mon, 22 Mar 2021 11:06:12 +0300 (MSK) Received: from NB-591.corp.yadro.com (10.199.0.33) by T-EXCH-03.corp.yadro.com (172.17.100.103) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.669.32; Mon, 22 Mar 2021 11:06:11 +0300 From: Dmitry Bogdanov To: Martin Petersen , CC: , , Nilesh Javali , Chris Boot , Bart Van Assche , Michael Cyr , Felipe Balbi , Dmitry Bogdanov , Roman Bolshakov Subject: [PATCH v2 6/7] target: ibm_vscsi: replace enable attr to ops.enable Date: Mon, 22 Mar 2021 11:05:53 +0300 Message-ID: <20210322080554.7611-7-d.bogdanov@yadro.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210322080554.7611-1-d.bogdanov@yadro.com> References: <20210322080554.7611-1-d.bogdanov@yadro.com> MIME-Version: 1.0 X-Originating-IP: [10.199.0.33] X-ClientProxiedBy: T-EXCH-01.corp.yadro.com (172.17.10.101) To T-EXCH-03.corp.yadro.com (172.17.100.103) Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Remove tpg/enable attribute. Add fabric ops enable_tpg implementation instead. Reviewed-by: Roman Bolshakov Signed-off-by: Dmitry Bogdanov --- drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c | 42 +++--------------------- 1 file changed, 4 insertions(+), 38 deletions(-) diff --git a/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c b/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c index 9abd9e253af6..90129a6c3496 100644 --- a/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c +++ b/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c @@ -3956,41 +3956,16 @@ static struct configfs_attribute *ibmvscsis_wwn_attrs[] = { NULL, }; -static ssize_t ibmvscsis_tpg_enable_show(struct config_item *item, - char *page) -{ - struct se_portal_group *se_tpg = to_tpg(item); - struct ibmvscsis_tport *tport = container_of(se_tpg, - struct ibmvscsis_tport, - se_tpg); - return snprintf(page, PAGE_SIZE, "%d\n", (tport->enabled) ? 1 : 0); -} - -static ssize_t ibmvscsis_tpg_enable_store(struct config_item *item, - const char *page, size_t count) +static int ibmvscsis_enable_tpg(struct se_portal_group *se_tpg, bool enable) { - struct se_portal_group *se_tpg = to_tpg(item); struct ibmvscsis_tport *tport = container_of(se_tpg, struct ibmvscsis_tport, se_tpg); struct scsi_info *vscsi = container_of(tport, struct scsi_info, tport); - unsigned long tmp; - int rc; long lrc; - rc = kstrtoul(page, 0, &tmp); - if (rc < 0) { - dev_err(&vscsi->dev, "Unable to extract srpt_tpg_store_enable\n"); - return -EINVAL; - } - - if ((tmp != 0) && (tmp != 1)) { - dev_err(&vscsi->dev, "Illegal value for srpt_tpg_store_enable\n"); - return -EINVAL; - } - - if (tmp) { + if (enable) { spin_lock_bh(&vscsi->intr_lock); tport->enabled = true; lrc = ibmvscsis_enable_change_state(vscsi); @@ -4006,17 +3981,8 @@ static ssize_t ibmvscsis_tpg_enable_store(struct config_item *item, spin_unlock_bh(&vscsi->intr_lock); } - dev_dbg(&vscsi->dev, "tpg_enable_store, tmp %ld, state %d\n", tmp, - vscsi->state); - - return count; + return 0; } -CONFIGFS_ATTR(ibmvscsis_tpg_, enable); - -static struct configfs_attribute *ibmvscsis_tpg_attrs[] = { - &ibmvscsis_tpg_attr_enable, - NULL, -}; static const struct target_core_fabric_ops ibmvscsis_ops = { .module = THIS_MODULE, @@ -4046,10 +4012,10 @@ static const struct target_core_fabric_ops ibmvscsis_ops = { .fabric_make_wwn = ibmvscsis_make_tport, .fabric_drop_wwn = ibmvscsis_drop_tport, .fabric_make_tpg = ibmvscsis_make_tpg, + .fabric_enable_tpg = ibmvscsis_enable_tpg, .fabric_drop_tpg = ibmvscsis_drop_tpg, .tfc_wwn_attrs = ibmvscsis_wwn_attrs, - .tfc_tpg_base_attrs = ibmvscsis_tpg_attrs, }; static void ibmvscsis_dev_release(struct device *dev) {};