diff options
author | Andrew F. Davis <afd@ti.com> | 2016-05-01 22:36:59 +0200 |
---|---|---|
committer | Jonathan Cameron <jic23@kernel.org> | 2016-05-04 12:10:38 +0200 |
commit | b36e8257641a043764c62240316610c81e36376c (patch) | |
tree | 6739afa1b341288ca45c8484b8c8d9eb7fb9554c /drivers/iio/health/afe440x.h | |
parent | iio: health/afe440x: Remove channel names (diff) | |
download | linux-b36e8257641a043764c62240316610c81e36376c.tar.xz linux-b36e8257641a043764c62240316610c81e36376c.zip |
iio: health/afe440x: Use regmap fields
These drivers can use regmap fields to access fields in registers, this
allows us to remove some macros/defines and simplify code, do this here.
Signed-off-by: Andrew F. Davis <afd@ti.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'drivers/iio/health/afe440x.h')
-rw-r--r-- | drivers/iio/health/afe440x.h | 25 |
1 files changed, 3 insertions, 22 deletions
diff --git a/drivers/iio/health/afe440x.h b/drivers/iio/health/afe440x.h index 713972fd4601..1a0f247043ca 100644 --- a/drivers/iio/health/afe440x.h +++ b/drivers/iio/health/afe440x.h @@ -88,21 +88,6 @@ #define AFE440X_CONTROL0_WRITE 0x0 #define AFE440X_CONTROL0_READ 0x1 -struct afe440x_reg_info { - unsigned int reg; - unsigned int offreg; - unsigned int shift; - unsigned int mask; -}; - -#define AFE440X_REG_INFO(_reg, _offreg, _sm) \ - { \ - .reg = _reg, \ - .offreg = _offreg, \ - .shift = _sm ## _SHIFT, \ - .mask = _sm ## _MASK, \ - } - #define AFE440X_INTENSITY_CHAN(_index, _mask) \ { \ .type = IIO_INTENSITY, \ @@ -157,9 +142,7 @@ static DEVICE_ATTR_RO(_name) struct afe440x_attr { struct device_attribute dev_attr; - unsigned int reg; - unsigned int shift; - unsigned int mask; + unsigned int field; const struct afe440x_val_table *val_table; unsigned int table_size; }; @@ -167,14 +150,12 @@ struct afe440x_attr { #define to_afe440x_attr(_dev_attr) \ container_of(_dev_attr, struct afe440x_attr, dev_attr) -#define AFE440X_ATTR(_name, _reg, _field, _table) \ +#define AFE440X_ATTR(_name, _field, _table) \ struct afe440x_attr afe440x_attr_##_name = { \ .dev_attr = __ATTR(_name, (S_IRUGO | S_IWUSR), \ afe440x_show_register, \ afe440x_store_register), \ - .reg = _reg, \ - .shift = _field ## _SHIFT, \ - .mask = _field ## _MASK, \ + .field = _field, \ .val_table = _table, \ .table_size = ARRAY_SIZE(_table), \ } |