From patchwork Wed Feb 15 00:25:51 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 9573077 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 C91CC600F6 for ; Wed, 15 Feb 2017 00:26:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BCBA4283F4 for ; Wed, 15 Feb 2017 00:26:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B15C328438; Wed, 15 Feb 2017 00:26:46 +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.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI 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 A510D283F4 for ; Wed, 15 Feb 2017 00:26:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751265AbdBOA0n (ORCPT ); Tue, 14 Feb 2017 19:26:43 -0500 Received: from esa1.hgst.iphmx.com ([68.232.141.245]:17288 "EHLO esa1.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750902AbdBOA0l (ORCPT ); Tue, 14 Feb 2017 19:26:41 -0500 X-IronPort-AV: E=Sophos;i="5.33,348,1477929600"; d="scan'208";a="86867748" Received: from unknown (HELO milsmgep15.sandisk.com) ([63.163.107.21]) by ob1.hgst.iphmx.com with ESMTP; 15 Feb 2017 08:26:19 +0800 Received: from MILHUBIP04.sdcorp.global.sandisk.com (Unknown_Domain [10.201.67.162]) (using TLS with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by (Symantec Messaging Gateway) with SMTP id 49.E4.57638.B20A3A85; Tue, 14 Feb 2017 16:26:19 -0800 (PST) Received: from milsmgip11.sandisk.com (10.177.8.100) by MILHUBIP04.sdcorp.global.sandisk.com (10.177.9.97) with Microsoft SMTP Server id 14.3.319.2; Tue, 14 Feb 2017 16:26:15 -0800 X-AuditID: 0ac94369-26dee9800001e126-6f-58a3a02b94e6 Received: from exp-402881.sdcorp.global.sandisk.com ( [10.177.9.6]) by (Symantec Messaging Gateway) with SMTP id 9B.7D.11415.720A3A85; Tue, 14 Feb 2017 16:26:15 -0800 (PST) From: Bart Van Assche To: "Nicholas A . Bellinger" CC: , Bart Van Assche , Hannes Reinecke , Christoph Hellwig , David Disseldorp Subject: [PATCH v6 12/33] target: Introduce target_get_device() and target_put_device() Date: Tue, 14 Feb 2017 16:25:51 -0800 Message-ID: <20170215002612.14566-13-bart.vanassche@sandisk.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170215002612.14566-1-bart.vanassche@sandisk.com> References: <20170215002612.14566-1-bart.vanassche@sandisk.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrPLMWRmVeSWpSXmKPExsXCddJ5ka72gsURBjd75C2+/p/OYrHgzV42 i5WrjzJZtK0+w2jRuvQtkwOrx/3tR5g8dt9sYPNYv+Uqi8fm09UenzfJBbBGcdmkpOZklqUW 6dslcGU86W5iK7jCW/Hr+DfWBsav3F2MnBwSAiYSLSd2sXUxcnEICSxlkpjSNJUFwtnBKNG/ sJMRpmrDkSVQiY2MEnv2/GYHSbAJGEl8ez+TBcQWAbJX9yxjAiliFtjOKHF9yluwhLBAuMTm x43MIDaLgKrEgbn7WUFsXgEHifV9m1ghNshL7Gq7CGZzAsVn7DgJ1MsBtM1e4tEZa4iSSawS O2anQrQKSpyc+QRsPLOAhMTBFy/AxgsJqEucXDKfaQKj0CwkZbOQlC1gZFrFKJabmVOcm55a YGiqV5yYl5JZnK2XnJ+7iRES7Jk7GO8+8T7EKMDBqMTDe0J2cYQQa2JZcWXuIUYJDmYlEV62 eqAQb0piZVVqUX58UWlOavEhRmkOFiVx3nMyUyOEBNITS1KzU1MLUotgskwcnFINjDa/9L7G 33E09xWO/rVIi7Mw0j1nrc97tpiaM3N/L6xS1gv33Mt4bsbmaEV5jiMMV03jgznXJN856Gb3 TCTrLOPUj4vlFE7z1HUv9FSaprj7xl/bpPhpgs3nbvhs/5A9rehIcH6BlsckpqBlVj8l9nGd tunPkdX+xHgw1NE5a/dJIQa776vYlViKMxINtZiLihMBnPxq3nICAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrPJMWRmVeSWpSXmKPExsXCtZGTTVd9weIIgwXfxCwO/mxjtPj6fzqL xYI3e9ksVq4+ymTRtvoMo0Xr0rdMDmwe97cfYfLYfbOBzWPamvNMHuu3XGXx2Hy62uPzJrkA tigum5TUnMyy1CJ9uwSujCfdTWwFV3grfh3/xtrA+JW7i5GTQ0LARGLDkSUsXYxcHEIC6xkl 9i45xw6SYBMwkvj2fiYLiC0CZK/uWcYEUsQssJNRYseZqUwgCWGBcInNjxuZQWwWAVWJA3P3 s4LYvAIOEtvnHmCC2CAvsavtIlicEyg+Y8dJoKEcQNvsJR6dsZ7AyL2AkWEVo1huZk5xbnpm gaGhXnFiXkpmcbZecn7uJkZIkETuYHw60fwQIxMHp1QDo+Y8n6iII8GKOsUm6cpa8/ftOeTB FiDeGH809opa5a+AFKuFSYebr5b8Pa9T+Sj9b7GbZqDd41vy5p1Tnjm68adszWKQy9rk4Dov 92FhRdrNM58uFRrt8jHj2+m3ZXHlkpfucves199y2Lrj1O8l+wqXykyNzm5/vNNnr/WjCwWz psZJGibcV2Ipzkg01GIuKk4EAIA5gjvCAQAA MIME-Version: 1.0 Sender: target-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: target-devel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP These new functions will be used by the next patch in this series. Signed-off-by: Bart Van Assche Cc: Hannes Reinecke Cc: Christoph Hellwig Cc: David Disseldorp --- drivers/target/target_core_device.c | 12 ++++++++++++ drivers/target/target_core_internal.h | 2 ++ 2 files changed, 14 insertions(+) diff --git a/drivers/target/target_core_device.c b/drivers/target/target_core_device.c index e62edd4bbae3..8003aceb3490 100644 --- a/drivers/target/target_core_device.c +++ b/drivers/target/target_core_device.c @@ -955,6 +955,18 @@ int target_configure_device(struct se_device *dev) return ret; } +int target_get_device(struct se_device *dev) +{ + return config_item_get_unless_zero(&dev->dev_group.cg_item) != NULL; +} +EXPORT_SYMBOL(target_get_device); + +void target_put_device(struct se_device *dev) +{ + config_item_put(&dev->dev_group.cg_item); +} +EXPORT_SYMBOL(target_put_device); + void target_free_device(struct se_device *dev) { struct se_hba *hba = dev->se_hba; diff --git a/drivers/target/target_core_internal.h b/drivers/target/target_core_internal.h index 9ab7090f7c83..cf32df0e65ba 100644 --- a/drivers/target/target_core_internal.h +++ b/drivers/target/target_core_internal.h @@ -86,6 +86,8 @@ int core_dev_setup_virtual_lun0(void); void core_dev_release_virtual_lun0(void); struct se_device *target_alloc_device(struct se_hba *hba, const char *name); int target_configure_device(struct se_device *dev); +int target_get_device(struct se_device *dev); +void target_put_device(struct se_device *dev); void target_free_device(struct se_device *); /* target_core_configfs.c */