2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-22 20:23:57 +08:00

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>
Acked-by: Nuno Sá <nuno.sa@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
This commit is contained in:
Alexandru Ardelean 2020-04-30 14:04:22 +03:00 committed by Jonathan Cameron
parent 6f1c9e0da9
commit b7190859ab
5 changed files with 24 additions and 37 deletions

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -230,20 +230,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

View File

@ -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;
}