diff mbox

[v4,36/37] target: Introduce target_get_device() and target_put_device()

Message ID 20170208222507.25715-37-bart.vanassche@sandisk.com (mailing list archive)
State Superseded
Headers show

Commit Message

Bart Van Assche Feb. 8, 2017, 10:25 p.m. UTC
These new functions will be used by the next patch in this series.

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Cc: Hannes Reinecke <hare@suse.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: David Disseldorp <ddiss@suse.de>
---
 drivers/target/target_core_device.c   | 12 ++++++++++++
 drivers/target/target_core_internal.h |  2 ++
 2 files changed, 14 insertions(+)

Comments

Nicholas A. Bellinger Feb. 9, 2017, 11:31 a.m. UTC | #1
On Wed, 2017-02-08 at 14:25 -0800, Bart Van Assche wrote:
> These new functions will be used by the next patch in this series.
> 
> Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
> Cc: Hannes Reinecke <hare@suse.com>
> Cc: Christoph Hellwig <hch@lst.de>
> Cc: David Disseldorp <ddiss@suse.de>
> ---
>  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 */

I'm all for this patch, but #35 needs to be merged first.

--
To unsubscribe from this list: send the line "unsubscribe target-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

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 */