public inbox for linux-iio@vger.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: linux-iio@vger.kernel.org
Cc: Alexandru Ardelean <ardeleanalex@gmail.com>,
	Jonathan Cameron <Jonathan.Cameron@huawei.com>
Subject: [PATCH 8/9] iio: core: move @flags from struct iio_dev to struct iio_dev_opaque
Date: Mon, 26 Apr 2021 18:49:10 +0100	[thread overview]
Message-ID: <20210426174911.397061-9-jic23@kernel.org> (raw)
In-Reply-To: <20210426174911.397061-1-jic23@kernel.org>

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

No reason any driver should ever need access to this field, so hide it.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
 drivers/iio/industrialio-core.c | 6 +++---
 include/linux/iio/iio-opaque.h  | 2 ++
 include/linux/iio/iio.h         | 2 --
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c
index 6fbe29f0b1de..4a4c02fea152 100644
--- a/drivers/iio/industrialio-core.c
+++ b/drivers/iio/industrialio-core.c
@@ -1720,7 +1720,7 @@ static int iio_chrdev_open(struct inode *inode, struct file *filp)
 	struct iio_dev *indio_dev = &iio_dev_opaque->indio_dev;
 	struct iio_dev_buffer_pair *ib;
 
-	if (test_and_set_bit(IIO_BUSY_BIT_POS, &indio_dev->flags))
+	if (test_and_set_bit(IIO_BUSY_BIT_POS, &iio_dev_opaque->flags))
 		return -EBUSY;
 
 	iio_device_get(indio_dev);
@@ -1728,7 +1728,7 @@ static int iio_chrdev_open(struct inode *inode, struct file *filp)
 	ib = kmalloc(sizeof(*ib), GFP_KERNEL);
 	if (!ib) {
 		iio_device_put(indio_dev);
-		clear_bit(IIO_BUSY_BIT_POS, &indio_dev->flags);
+		clear_bit(IIO_BUSY_BIT_POS, &iio_dev_opaque->flags);
 		return -ENOMEM;
 	}
 
@@ -1754,7 +1754,7 @@ static int iio_chrdev_release(struct inode *inode, struct file *filp)
 		container_of(inode->i_cdev, struct iio_dev_opaque, chrdev);
 	struct iio_dev *indio_dev = &iio_dev_opaque->indio_dev;
 	kfree(ib);
-	clear_bit(IIO_BUSY_BIT_POS, &indio_dev->flags);
+	clear_bit(IIO_BUSY_BIT_POS, &iio_dev_opaque->flags);
 	iio_device_put(indio_dev);
 
 	return 0;
diff --git a/include/linux/iio/iio-opaque.h b/include/linux/iio/iio-opaque.h
index 2f8ef5d15a66..d7c3036861ac 100644
--- a/include/linux/iio/iio-opaque.h
+++ b/include/linux/iio/iio-opaque.h
@@ -25,6 +25,7 @@
  * @legacy_buffer_group:	attribute group for legacy buffer attributes group
  * @scan_index_timestamp:	cache of the index to the timestamp
  * @chrdev:			associated character device
+ * @flags:			file ops related flags including busy flag.
  * @debugfs_dentry:		device specific debugfs dentry
  * @cached_reg_addr:		cached register address for debugfs reads
  * @read_buf:			read buffer to be used for the initial reg read
@@ -51,6 +52,7 @@ struct iio_dev_opaque {
 
 	unsigned int			scan_index_timestamp;
 	struct cdev			chrdev;
+	unsigned long			flags;
 
 #if defined(CONFIG_DEBUG_FS)
 	struct dentry			*debugfs_dentry;
diff --git a/include/linux/iio/iio.h b/include/linux/iio/iio.h
index 586e2dc4fbf3..ed0537015eee 100644
--- a/include/linux/iio/iio.h
+++ b/include/linux/iio/iio.h
@@ -512,7 +512,6 @@ struct iio_buffer_setup_ops {
  * @clock_id:		[INTERN] timestamping clock posix identifier
  * @setup_ops:		[DRIVER] callbacks to call before and after buffer
  *			enable/disable
- * @flags:		[INTERN] file ops related flags including busy flag.
  * @priv:		[DRIVER] reference to driver's private information
  *			**MUST** be accessed **ONLY** via iio_priv() helper
  */
@@ -542,7 +541,6 @@ struct iio_dev {
 	clockid_t			clock_id;
 	const struct iio_buffer_setup_ops	*setup_ops;
 
-	unsigned long			flags;
 	void				*priv;
 };
 
-- 
2.31.1


  parent reply	other threads:[~2021-04-26 17:50 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-26 17:49 [PATCH 0/9] iio: Move more things from iio_dev to iio_dev_opaque Jonathan Cameron
2021-04-26 17:49 ` [PATCH 1/9] iio: core: move @id from struct iio_dev to struct iio_dev_opaque Jonathan Cameron
2021-04-27  7:44   ` Alexandru Ardelean
2021-04-27 17:16     ` Jonathan Cameron
2021-05-03 11:42   ` Jonathan Cameron
2021-04-26 17:49 ` [PATCH 2/9] iio: avoid shadowing of variable name in to_iio_dev_opaque() Jonathan Cameron
2021-04-27  7:45   ` Alexandru Ardelean
2021-04-26 17:49 ` [PATCH 3/9] iio: core: move @driver_module from struct iio_dev to struct iio_dev_opaque Jonathan Cameron
2021-04-28  6:55   ` Alexandru Ardelean
2021-04-26 17:49 ` [PATCH 4/9] iio: core: move @trig_readonly " Jonathan Cameron
2021-04-27  8:03   ` Alexandru Ardelean
2021-04-26 17:49 ` [PATCH 5/9] iio: core: move @scan_index_timestamp " Jonathan Cameron
2021-04-27  8:03   ` Alexandru Ardelean
2021-04-26 17:49 ` [PATCH 6/9] iio: core: move @info_exist_lock " Jonathan Cameron
2021-04-27  8:04   ` Alexandru Ardelean
2021-04-26 17:49 ` [PATCH 7/9] iio: core: move @chrdev from struct iio_dev " Jonathan Cameron
2021-04-27  8:06   ` Alexandru Ardelean
2021-04-27 17:17     ` Jonathan Cameron
2021-04-26 17:49 ` Jonathan Cameron [this message]
2021-04-27  8:07   ` [PATCH 8/9] iio: core: move @flags " Alexandru Ardelean
2021-04-26 17:49 ` [PATCH 9/9] iio: core: move @clock_id " Jonathan Cameron
2021-04-27  8:02   ` Alexandru Ardelean
2021-04-27 17:19     ` Jonathan Cameron
2021-04-27  8:08 ` [PATCH 0/9] iio: Move more things from iio_dev to iio_dev_opaque Alexandru Ardelean
2021-04-27 17:12   ` Jonathan Cameron
2021-04-28  6:55     ` Alexandru Ardelean
2021-05-03 11:53       ` Jonathan Cameron

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210426174911.397061-9-jic23@kernel.org \
    --to=jic23@kernel.org \
    --cc=Jonathan.Cameron@huawei.com \
    --cc=ardeleanalex@gmail.com \
    --cc=linux-iio@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox