From patchwork Fri Feb 10 01:28: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: 9565799 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 CDFFE60573 for ; Fri, 10 Feb 2017 01:29:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BF5E328532 for ; Fri, 10 Feb 2017 01:29:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B46492853B; Fri, 10 Feb 2017 01:29:45 +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 6158728532 for ; Fri, 10 Feb 2017 01:29:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751404AbdBJB3o (ORCPT ); Thu, 9 Feb 2017 20:29:44 -0500 Received: from esa1.hgst.iphmx.com ([68.232.141.245]:15691 "EHLO esa1.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751480AbdBJB3j (ORCPT ); Thu, 9 Feb 2017 20:29:39 -0500 X-IronPort-AV: E=Sophos;i="5.33,348,1477929600"; d="scan'208";a="82349580" Received: from unknown (HELO milsmgep15.sandisk.com) ([63.163.107.21]) by ob1.hgst.iphmx.com with ESMTP; 10 Feb 2017 09:29:02 +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 D3.97.57638.E571D985; Thu, 9 Feb 2017 17:29:02 -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; Thu, 9 Feb 2017 17:28:56 -0800 X-AuditID: 0ac94369-26dee9800001e126-09-589d175e0abf Received: from exp-402881.sdcorp.global.sandisk.com ( [10.177.9.6]) by (Symantec Messaging Gateway) with SMTP id F9.9F.11415.7571D985; Thu, 9 Feb 2017 17:28:55 -0800 (PST) From: Bart Van Assche To: "Nicholas A . Bellinger" CC: , Bart Van Assche , Hannes Reinecke , Christoph Hellwig , David Disseldorp Subject: [PATCH v5 21/22] target: Introduce target_get_device() and target_put_device() Date: Thu, 9 Feb 2017 17:28:51 -0800 Message-ID: <20170210012852.15735-22-bart.vanassche@sandisk.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170210012852.15735-1-bart.vanassche@sandisk.com> References: <20170210012852.15735-1-bart.vanassche@sandisk.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrALMWRmVeSWpSXmKPExsXCddJ5kW6c+NwIg/9nNS2+/p/OYrHgzV42 i5WrjzJZtK0+w2jRuvQtkwOrx/3tR5g8dt9sYPNYv+Uqi8fm09UenzfJBbBGcdmkpOZklqUW 6dslcGUc/nWJueAKb8WR3e+ZGhi/cncxcnJICJhITH3TwdTFyMUhJLCUSeLN0QtsEM52Rom7 S1rZYapOf3zHDJHYyCjx5Nx/RpAEm4CRxLf3M1lAbBEge3XPMrBRzCDd16e8BUsIC4RL3D98 hBXEZhFQkfg+qxvM5hVwkHg45R/UBnmJXW0XweKcQPFXs68D2RxA2+wlduwyAJkpITCJVeLK uSYmiF5BiZMzn4DNZxaQkDj44gUziC0koC5xcsl8pgmMQrOQlM1CUraAkWkVo1huZk5xbnpq gaGpXnFiXkpmcbZecn7uJkZIuGfuYLz7xPsQowAHoxIP74uaORFCrIllxZW5hxglOJiVRHjv 882NEOJNSaysSi3Kjy8qzUktPsQozcGiJM57TmZqhJBAemJJanZqakFqEUyWiYNTqoFx8eac 7fY77ytLl1esFGCM31UnvOXoKblDSQntjpN8osWLmCYWbzz56U/Wh2lT2Pws9jPX2886LNj5 3VLG/47S8jj/c9GS654w5hyYfmn/AYOtrxV+rV2s0ZogJPhjvqZI5FvP+Uy3H5jfuMBc/LHx UK9agtK5LIdIp1XHd9wTusvd3xur88ZYiaU4I9FQi7moOBEAoaJxBnMCAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrPJMWRmVeSWpSXmKPExsXCtZGTTTdcfG6EweoOdYuDP9sYLb7+n85i seDNXjaLlauPMlm0rT7DaNG69C2TA5vH/e1HmDx232xg85i25jyTx/otV1k8Np+u9vi8SS6A LYrLJiU1J7MstUjfLoEr4/CvS8wFV3grjux+z9TA+JW7i5GTQ0LAROL0x3fMXYxcHEIC6xkl +lZPYQNJsAkYSXx7P5MFxBYBslf3LGMCKWIW2MkosePMVCaQhLBAuMT9w0dYQWwWAVWJL2/2 MIPYvAIOEjtWPmGD2CAvsavtIlgNJ1D81ezrQDYH0DZ7iR27DCYwci9gZFjFKJabmVOcm55Z YGioV5yYl5JZnK2XnJ+7iRESJJE7GJ9OND/EyMTBKdXAaL+dbdVt9rmaS6T1rnN+EfCdlaVr MvOfodxP+8tJbWy+onu61vsassR/X7GkfE+Cw53J++MPsz668WXRokrlDXoLn8VIWOyy/X4v 7dLKVdd3nHUMa5R3y+td75IfVf3k4Yvmz/r7FWy8Ytv50/0mxu3WUlj9Y85nzgNuKYe3CF52 CnTxX6o3VYmlOCPRUIu5qDgRAJY+EGfCAQAA 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 cb7047d66afc..1e6246966b6e 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 2b85e6ca7fa7..0b3c3cbfdd55 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 */