public inbox for linux-iio@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] iio: imu: adis16xxx: use helper to access iio core debugfs dir
@ 2020-04-30 11:04 Alexandru Ardelean
  2020-04-30 11:53 ` Sa, Nuno
  0 siblings, 1 reply; 3+ messages in thread
From: Alexandru Ardelean @ 2020-04-30 11:04 UTC (permalink / raw)
  To: linux-iio, linux-kernel; +Cc: dragos.bogdan, nuno.sa, jic23, Alexandru Ardelean

The IIO core provides a iio_get_debugfs_dentry() helper.
It seems that the ADIS IMU drivers access that field directly.

This change converts them to use iio_get_debugfs_dentry() instead.

Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
---
 drivers/iio/gyro/adis16136.c | 10 ++++------
 drivers/iio/imu/adis16400.c  | 10 ++++------
 drivers/iio/imu/adis16460.c  | 10 ++++------
 drivers/iio/imu/adis16475.c  | 15 ++++++---------
 drivers/iio/imu/adis16480.c  | 16 ++++++----------
 5 files changed, 24 insertions(+), 37 deletions(-)

diff --git a/drivers/iio/gyro/adis16136.c b/drivers/iio/gyro/adis16136.c
index a4c967a5fc5c..afdc57af475d 100644
--- a/drivers/iio/gyro/adis16136.c
+++ b/drivers/iio/gyro/adis16136.c
@@ -148,16 +148,14 @@ DEFINE_DEBUGFS_ATTRIBUTE(adis16136_flash_count_fops,
 static int adis16136_debugfs_init(struct iio_dev *indio_dev)
 {
 	struct adis16136 *adis16136 = iio_priv(indio_dev);
+	struct dentry *d = iio_get_debugfs_dentry(indio_dev);
 
 	debugfs_create_file_unsafe("serial_number", 0400,
-		indio_dev->debugfs_dentry, adis16136,
-		&adis16136_serial_fops);
+		d, adis16136, &adis16136_serial_fops);
 	debugfs_create_file_unsafe("product_id", 0400,
-		indio_dev->debugfs_dentry,
-		adis16136, &adis16136_product_id_fops);
+		d, adis16136, &adis16136_product_id_fops);
 	debugfs_create_file_unsafe("flash_count", 0400,
-		indio_dev->debugfs_dentry,
-		adis16136, &adis16136_flash_count_fops);
+		d, adis16136, &adis16136_flash_count_fops);
 
 	return 0;
 }
diff --git a/drivers/iio/imu/adis16400.c b/drivers/iio/imu/adis16400.c
index 439feb755d82..229f2ff98469 100644
--- a/drivers/iio/imu/adis16400.c
+++ b/drivers/iio/imu/adis16400.c
@@ -281,18 +281,16 @@ DEFINE_DEBUGFS_ATTRIBUTE(adis16400_flash_count_fops,
 static int adis16400_debugfs_init(struct iio_dev *indio_dev)
 {
 	struct adis16400_state *st = iio_priv(indio_dev);
+	struct dentry *d = iio_get_debugfs_dentry(indio_dev);
 
 	if (st->variant->flags & ADIS16400_HAS_SERIAL_NUMBER)
 		debugfs_create_file_unsafe("serial_number", 0400,
-				indio_dev->debugfs_dentry, st,
-				&adis16400_serial_number_fops);
+				d, st, &adis16400_serial_number_fops);
 	if (st->variant->flags & ADIS16400_HAS_PROD_ID)
 		debugfs_create_file_unsafe("product_id", 0400,
-				indio_dev->debugfs_dentry, st,
-				&adis16400_product_id_fops);
+				d, st, &adis16400_product_id_fops);
 	debugfs_create_file_unsafe("flash_count", 0400,
-			indio_dev->debugfs_dentry, st,
-			&adis16400_flash_count_fops);
+			d, st, &adis16400_flash_count_fops);
 
 	return 0;
 }
diff --git a/drivers/iio/imu/adis16460.c b/drivers/iio/imu/adis16460.c
index 0957f5cfe9c0..ad20c488a3ba 100644
--- a/drivers/iio/imu/adis16460.c
+++ b/drivers/iio/imu/adis16460.c
@@ -129,16 +129,14 @@ DEFINE_DEBUGFS_ATTRIBUTE(adis16460_flash_count_fops,
 static int adis16460_debugfs_init(struct iio_dev *indio_dev)
 {
 	struct adis16460 *adis16460 = iio_priv(indio_dev);
+	struct dentry *d = iio_get_debugfs_dentry(indio_dev);
 
 	debugfs_create_file_unsafe("serial_number", 0400,
-			indio_dev->debugfs_dentry, adis16460,
-			&adis16460_serial_number_fops);
+			d, adis16460, &adis16460_serial_number_fops);
 	debugfs_create_file_unsafe("product_id", 0400,
-			indio_dev->debugfs_dentry, adis16460,
-			&adis16460_product_id_fops);
+			d, adis16460, &adis16460_product_id_fops);
 	debugfs_create_file_unsafe("flash_count", 0400,
-			indio_dev->debugfs_dentry, adis16460,
-			&adis16460_flash_count_fops);
+			d, adis16460, &adis16460_flash_count_fops);
 
 	return 0;
 }
diff --git a/drivers/iio/imu/adis16475.c b/drivers/iio/imu/adis16475.c
index e2bd4214eaeb..4fac24227fae 100644
--- a/drivers/iio/imu/adis16475.c
+++ b/drivers/iio/imu/adis16475.c
@@ -228,20 +228,17 @@ DEFINE_DEBUGFS_ATTRIBUTE(adis16475_flash_count_fops,
 static void adis16475_debugfs_init(struct iio_dev *indio_dev)
 {
 	struct adis16475 *st = iio_priv(indio_dev);
+	struct dentry *d = iio_get_debugfs_dentry(indio_dev);
 
 	debugfs_create_file_unsafe("serial_number", 0400,
-				   indio_dev->debugfs_dentry, st,
-				   &adis16475_serial_number_fops);
+				   d, st, &adis16475_serial_number_fops);
 	debugfs_create_file_unsafe("product_id", 0400,
-				   indio_dev->debugfs_dentry, st,
-				   &adis16475_product_id_fops);
+				   d, st, &adis16475_product_id_fops);
 	debugfs_create_file_unsafe("flash_count", 0400,
-				   indio_dev->debugfs_dentry, st,
-				   &adis16475_flash_count_fops);
+				   d, st, &adis16475_flash_count_fops);
 	debugfs_create_file("firmware_revision", 0400,
-			    indio_dev->debugfs_dentry, st,
-			    &adis16475_firmware_revision_fops);
-	debugfs_create_file("firmware_date", 0400, indio_dev->debugfs_dentry,
+			    d, st, &adis16475_firmware_revision_fops);
+	debugfs_create_file("firmware_date", 0400, d,
 			    st, &adis16475_firmware_date_fops);
 }
 #else
diff --git a/drivers/iio/imu/adis16480.c b/drivers/iio/imu/adis16480.c
index cfae0e4476e7..6a471eee110e 100644
--- a/drivers/iio/imu/adis16480.c
+++ b/drivers/iio/imu/adis16480.c
@@ -284,22 +284,18 @@ DEFINE_DEBUGFS_ATTRIBUTE(adis16480_flash_count_fops,
 static int adis16480_debugfs_init(struct iio_dev *indio_dev)
 {
 	struct adis16480 *adis16480 = iio_priv(indio_dev);
+	struct dentry *d = iio_get_debugfs_dentry(indio_dev);
 
 	debugfs_create_file_unsafe("firmware_revision", 0400,
-		indio_dev->debugfs_dentry, adis16480,
-		&adis16480_firmware_revision_fops);
+		d, adis16480, &adis16480_firmware_revision_fops);
 	debugfs_create_file_unsafe("firmware_date", 0400,
-		indio_dev->debugfs_dentry, adis16480,
-		&adis16480_firmware_date_fops);
+		d, adis16480, &adis16480_firmware_date_fops);
 	debugfs_create_file_unsafe("serial_number", 0400,
-		indio_dev->debugfs_dentry, adis16480,
-		&adis16480_serial_number_fops);
+		d, adis16480, &adis16480_serial_number_fops);
 	debugfs_create_file_unsafe("product_id", 0400,
-		indio_dev->debugfs_dentry, adis16480,
-		&adis16480_product_id_fops);
+		d, adis16480, &adis16480_product_id_fops);
 	debugfs_create_file_unsafe("flash_count", 0400,
-		indio_dev->debugfs_dentry, adis16480,
-		&adis16480_flash_count_fops);
+		d, adis16480, &adis16480_flash_count_fops);
 
 	return 0;
 }
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* RE: [PATCH] iio: imu: adis16xxx: use helper to access iio core debugfs dir
  2020-04-30 11:04 [PATCH] iio: imu: adis16xxx: use helper to access iio core debugfs dir Alexandru Ardelean
@ 2020-04-30 11:53 ` Sa, Nuno
  2020-05-03 13:13   ` Jonathan Cameron
  0 siblings, 1 reply; 3+ messages in thread
From: Sa, Nuno @ 2020-04-30 11:53 UTC (permalink / raw)
  To: Ardelean, Alexandru, linux-iio@vger.kernel.org,
	linux-kernel@vger.kernel.org
  Cc: Bogdan, Dragos, jic23@kernel.org, Ardelean, Alexandru


> From: Alexandru Ardelean <alexandru.ardelean@analog.com>
> Sent: Donnerstag, 30. April 2020 13:04
> To: linux-iio@vger.kernel.org; linux-kernel@vger.kernel.org
> Cc: Bogdan, Dragos <Dragos.Bogdan@analog.com>; Sa, Nuno
> <Nuno.Sa@analog.com>; jic23@kernel.org; Ardelean, Alexandru
> <alexandru.Ardelean@analog.com>
> Subject: [PATCH] iio: imu: adis16xxx: use helper to access iio core debugfs dir
> 
> The IIO core provides a iio_get_debugfs_dentry() helper.
> It seems that the ADIS IMU drivers access that field directly.
> 
> This change converts them to use iio_get_debugfs_dentry() instead.
> 
> Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
> ---
>  drivers/iio/gyro/adis16136.c | 10 ++++------
>  drivers/iio/imu/adis16400.c  | 10 ++++------
>  drivers/iio/imu/adis16460.c  | 10 ++++------
>  drivers/iio/imu/adis16475.c  | 15 ++++++---------
>  drivers/iio/imu/adis16480.c  | 16 ++++++----------
>  5 files changed, 24 insertions(+), 37 deletions(-)
> 

Acked-by: Nuno Sá <nuno.sa@analog.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] iio: imu: adis16xxx: use helper to access iio core debugfs dir
  2020-04-30 11:53 ` Sa, Nuno
@ 2020-05-03 13:13   ` Jonathan Cameron
  0 siblings, 0 replies; 3+ messages in thread
From: Jonathan Cameron @ 2020-05-03 13:13 UTC (permalink / raw)
  To: Sa, Nuno
  Cc: Ardelean, Alexandru, linux-iio@vger.kernel.org,
	linux-kernel@vger.kernel.org, Bogdan, Dragos

On Thu, 30 Apr 2020 11:53:08 +0000
"Sa, Nuno" <Nuno.Sa@analog.com> wrote:

> > From: Alexandru Ardelean <alexandru.ardelean@analog.com>
> > Sent: Donnerstag, 30. April 2020 13:04
> > To: linux-iio@vger.kernel.org; linux-kernel@vger.kernel.org
> > Cc: Bogdan, Dragos <Dragos.Bogdan@analog.com>; Sa, Nuno
> > <Nuno.Sa@analog.com>; jic23@kernel.org; Ardelean, Alexandru
> > <alexandru.Ardelean@analog.com>
> > Subject: [PATCH] iio: imu: adis16xxx: use helper to access iio core debugfs dir
> > 
> > The IIO core provides a iio_get_debugfs_dentry() helper.
> > It seems that the ADIS IMU drivers access that field directly.
> > 
> > This change converts them to use iio_get_debugfs_dentry() instead.
> > 
> > Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
> > ---
> >  drivers/iio/gyro/adis16136.c | 10 ++++------
> >  drivers/iio/imu/adis16400.c  | 10 ++++------
> >  drivers/iio/imu/adis16460.c  | 10 ++++------
> >  drivers/iio/imu/adis16475.c  | 15 ++++++---------
> >  drivers/iio/imu/adis16480.c  | 16 ++++++----------
> >  5 files changed, 24 insertions(+), 37 deletions(-)
> >   
> 
> Acked-by: Nuno Sá <nuno.sa@analog.com>

Applied to the togreg branch of iio.git and pushed out as testing for
the usual reasons.

Thanks,

Jonathan

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-05-03 13:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-04-30 11:04 [PATCH] iio: imu: adis16xxx: use helper to access iio core debugfs dir Alexandru Ardelean
2020-04-30 11:53 ` Sa, Nuno
2020-05-03 13:13   ` Jonathan Cameron

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox