From patchwork Wed Feb 8 22:25:06 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: 9563651 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 238E660236 for ; Wed, 8 Feb 2017 22:28:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EBC52284F2 for ; Wed, 8 Feb 2017 22:28:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D11B52852B; Wed, 8 Feb 2017 22:28:06 +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 CE914284F2 for ; Wed, 8 Feb 2017 22:28:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752109AbdBHW2E (ORCPT ); Wed, 8 Feb 2017 17:28:04 -0500 Received: from esa2.hgst.iphmx.com ([68.232.143.124]:63845 "EHLO esa2.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752086AbdBHW2A (ORCPT ); Wed, 8 Feb 2017 17:28:00 -0500 X-IronPort-AV: E=Sophos;i="5.35,348,1483977600"; d="scan'208";a="76618231" Received: from unknown (HELO milsmgep14.sandisk.com) ([63.163.107.225]) by ob1.hgst.iphmx.com with ESMTP; 09 Feb 2017 06:28:25 +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 09.72.18895.ECA9B985; Wed, 8 Feb 2017 14:25:18 -0800 (PST) Received: from milsmgip12.sandisk.com (10.177.9.6) by MILHUBIP04.sdcorp.global.sandisk.com (10.177.9.97) with Microsoft SMTP Server id 14.3.319.2; Wed, 8 Feb 2017 14:25:11 -0800 X-AuditID: 0ac94371-0fadb980000049cf-06-589b9acec91a Received: from exp-402881.sdcorp.global.sandisk.com ( [10.177.9.6]) by (Symantec Messaging Gateway) with SMTP id 0A.42.18148.8CA9B985; Wed, 8 Feb 2017 14:25:12 -0800 (PST) From: Bart Van Assche To: Bart Van Assche CC: , Hannes Reinecke , Christoph Hellwig , David Disseldorp Subject: [PATCH v4 36/37] target: Introduce target_get_device() and target_put_device() Date: Wed, 8 Feb 2017 14:25:06 -0800 Message-ID: <20170208222507.25715-37-bart.vanassche@sandisk.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170208222507.25715-1-bart.vanassche@sandisk.com> References: <20170208222507.25715-1-bart.vanassche@sandisk.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrGLMWRmVeSWpSXmKPExsXCddJ5ke65WbMjDKY9Ebf4+n86i8WCN3vZ LFauPspk0br0LZMDi8fumw1sHuu3XGXx2Hy62uPzJrkAligum5TUnMyy1CJ9uwSujN0thgVX eCseLZnN2MD4lbuLkZNDQsBE4tmSBcxdjFwcQgJLmST+7G2DcrYySjzqPcUGU3V421EWiMRG RonNn9+xgiTYBIwkvr2fyQJiiwgYSPzuvcAIUsQs0M4o0XluFjNIQlggXKLv9GWwIhYBFYmW r+/BpvIKOEjMWjsHaoO8xK62i2BDOYHiE14+YwSxhQTsJV4d+AI2VEKgiVXiw9qvLBDNghIn Zz4Bs5kFJCQOvnjBDNGgLnFyyXymCYxCs5CUzUJStoCRaRWjWG5mTnFuemqBoYlecWJeSmZx tl5yfu4mRkhoF+5gfH3b+xCjAAejEg/vBevZEUKsiWXFlbmHGCU4mJVEeFOmAYV4UxIrq1KL 8uOLSnNSiw8xSnOwKInzZslOjRASSE8sSc1OTS1ILYLJMnFwSjUwqky0ffvuvim/r+/B2Mby T9PYfJm3iC1gTow62+15o7M0OqfbKTTV0fFeeMuc5nvNaxQ2bFDcf7jsofflyiM3Wm+obbp4 5FIELyO7+QtG9XbWeQpiO/+6L5Wr2RbOeKD6Yt+Z8HyZZR82l0x6Z9qYyv1uwrHKn0WGesc9 mVjvpDE78pfx7nqgxFKckWioxVxUnAgAB8MOjWkCAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrKJMWRmVeSWpSXmKPExsXCtZGTTffErNkRBvMmMlkc/NnGaPH1/3QW iwVv9rJZrFx9lMmidelbJgdWj903G9g8pq05z+SxfstVFo/Np6s9Pm+SC2CN4rJJSc3JLEst 0rdL4MrY3WJYcIW34tGS2YwNjF+5uxg5OSQETCQObzvK0sXIxSEksJ5RYsWll8wgCTYBI4lv 72eygNgiAgYSv3svMIIUMQt0Mko8WP2AESQhLBAu0Xf6MlgRi4CqxN7VC8GaeQUcJPZsW8QK sUFeYlfbRTCbEyg+4eUzsF4hAXuJVwe+ME5g5F7AyLCKUSw3M6c4Nz2zwNBIrzgxLyWzOFsv OT93EyMkIKJ2MF6faH6IkYmDU6qBcbkXZ4am/UR7FnEhxYRm4aw+vmf+AX/MepwyDqdVvW0+ +FTCL/+Y2OXQl6tC18zuV2EKquy/GaRZ+DTh8L7ESQ/zPrsXdx+9qvHx0bzJ/Rsn35i3L2I6 43Z3i3meiXlZyvNntrxzqJO+86Xf9RDn7sV2t1Vf2besPGQeEycor/vj6CH34oB8JZbijERD Leai4kQAMuFDbLgBAAA= 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 5431c51a70be..429a4c93115f 100644 --- a/drivers/target/target_core_device.c +++ b/drivers/target/target_core_device.c @@ -947,6 +947,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 944085bff6af..1f056c845c96 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 */