2017-03-31 16:46:51

by Simran Singhal

[permalink] [raw]
Subject: [PATCH 0/3] iio: health: Clean up

This patch-series removes commented code in afe440x.h and
removes unused functions in afe4404.c and afe4403.c.

simran singhal (3):
iio: health: afe440x: Remove code in comments
iio: health: afe4404: Remove all unused functions
iio: health: afe4403: Remove all unused functions

drivers/iio/health/afe4403.c | 51 --------------------------------------
drivers/iio/health/afe4404.c | 51 --------------------------------------
drivers/iio/health/afe440x.h | 58 --------------------------------------------
3 files changed, 160 deletions(-)

--
2.7.4


2017-03-31 16:47:03

by Simran Singhal

[permalink] [raw]
Subject: [PATCH 3/3] iio: health: afe4403: Remove all unused functions

The functions afe440x_show_register and afe440x_store_register are never
used anywhere in the kernel. So, remove their definitions.
Grepped to find occurences.

Signed-off-by: simran singhal <[email protected]>
---
drivers/iio/health/afe4403.c | 51 --------------------------------------------
1 file changed, 51 deletions(-)

diff --git a/drivers/iio/health/afe4403.c b/drivers/iio/health/afe4403.c
index 6bb23a4..3059014 100644
--- a/drivers/iio/health/afe4403.c
+++ b/drivers/iio/health/afe4403.c
@@ -136,57 +136,6 @@ static const struct afe440x_val_table afe4403_cap_table[] = {
};
AFE440X_TABLE_ATTR(in_intensity_capacitance_available, afe4403_cap_table);

-static ssize_t afe440x_show_register(struct device *dev,
- struct device_attribute *attr,
- char *buf)
-{
- struct iio_dev *indio_dev = dev_to_iio_dev(dev);
- struct afe4403_data *afe = iio_priv(indio_dev);
- struct afe440x_attr *afe440x_attr = to_afe440x_attr(attr);
- unsigned int reg_val;
- int vals[2];
- int ret;
-
- ret = regmap_field_read(afe->fields[afe440x_attr->field], &reg_val);
- if (ret)
- return ret;
-
- if (reg_val >= afe440x_attr->table_size)
- return -EINVAL;
-
- vals[0] = afe440x_attr->val_table[reg_val].integer;
- vals[1] = afe440x_attr->val_table[reg_val].fract;
-
- return iio_format_value(buf, IIO_VAL_INT_PLUS_MICRO, 2, vals);
-}
-
-static ssize_t afe440x_store_register(struct device *dev,
- struct device_attribute *attr,
- const char *buf, size_t count)
-{
- struct iio_dev *indio_dev = dev_to_iio_dev(dev);
- struct afe4403_data *afe = iio_priv(indio_dev);
- struct afe440x_attr *afe440x_attr = to_afe440x_attr(attr);
- int val, integer, fract, ret;
-
- ret = iio_str_to_fixpoint(buf, 100000, &integer, &fract);
- if (ret)
- return ret;
-
- for (val = 0; val < afe440x_attr->table_size; val++)
- if (afe440x_attr->val_table[val].integer == integer &&
- afe440x_attr->val_table[val].fract == fract)
- break;
- if (val == afe440x_attr->table_size)
- return -EINVAL;
-
- ret = regmap_field_write(afe->fields[afe440x_attr->field], val);
- if (ret)
- return ret;
-
- return count;
-}
-
static AFE440X_ATTR(in_intensity1_resistance, F_RF_LED, afe4403_res_table);
static AFE440X_ATTR(in_intensity1_capacitance, F_CF_LED, afe4403_cap_table);

--
2.7.4

2017-03-31 16:46:59

by Simran Singhal

[permalink] [raw]
Subject: [PATCH 2/3] iio: health: afe4404: Remove all unused functions

The functions afe440x_show_register and afe440x_store_register are never
used anywhere in the kernel. So, remove their definitions.
Grepped to find occurences.

Signed-off-by: simran singhal <[email protected]>
---
drivers/iio/health/afe4404.c | 51 --------------------------------------------
1 file changed, 51 deletions(-)

diff --git a/drivers/iio/health/afe4404.c b/drivers/iio/health/afe4404.c
index 964f523..168991a 100644
--- a/drivers/iio/health/afe4404.c
+++ b/drivers/iio/health/afe4404.c
@@ -170,57 +170,6 @@ static const struct afe440x_val_table afe4404_cap_table[] = {
};
AFE440X_TABLE_ATTR(in_intensity_capacitance_available, afe4404_cap_table);

-static ssize_t afe440x_show_register(struct device *dev,
- struct device_attribute *attr,
- char *buf)
-{
- struct iio_dev *indio_dev = dev_to_iio_dev(dev);
- struct afe4404_data *afe = iio_priv(indio_dev);
- struct afe440x_attr *afe440x_attr = to_afe440x_attr(attr);
- unsigned int reg_val;
- int vals[2];
- int ret;
-
- ret = regmap_field_read(afe->fields[afe440x_attr->field], &reg_val);
- if (ret)
- return ret;
-
- if (reg_val >= afe440x_attr->table_size)
- return -EINVAL;
-
- vals[0] = afe440x_attr->val_table[reg_val].integer;
- vals[1] = afe440x_attr->val_table[reg_val].fract;
-
- return iio_format_value(buf, IIO_VAL_INT_PLUS_MICRO, 2, vals);
-}
-
-static ssize_t afe440x_store_register(struct device *dev,
- struct device_attribute *attr,
- const char *buf, size_t count)
-{
- struct iio_dev *indio_dev = dev_to_iio_dev(dev);
- struct afe4404_data *afe = iio_priv(indio_dev);
- struct afe440x_attr *afe440x_attr = to_afe440x_attr(attr);
- int val, integer, fract, ret;
-
- ret = iio_str_to_fixpoint(buf, 100000, &integer, &fract);
- if (ret)
- return ret;
-
- for (val = 0; val < afe440x_attr->table_size; val++)
- if (afe440x_attr->val_table[val].integer == integer &&
- afe440x_attr->val_table[val].fract == fract)
- break;
- if (val == afe440x_attr->table_size)
- return -EINVAL;
-
- ret = regmap_field_write(afe->fields[afe440x_attr->field], val);
- if (ret)
- return ret;
-
- return count;
-}
-
static AFE440X_ATTR(in_intensity1_resistance, F_TIA_GAIN_SEP, afe4404_res_table);
static AFE440X_ATTR(in_intensity1_capacitance, F_TIA_CF_SEP, afe4404_cap_table);

--
2.7.4

2017-03-31 16:46:56

by Simran Singhal

[permalink] [raw]
Subject: [PATCH 1/3] iio: health: afe440x: Remove code in comments

Commenting out code is a bad idea.
As comments are for explaining what code is about.

Signed-off-by: simran singhal <[email protected]>
---
drivers/iio/health/afe440x.h | 58 --------------------------------------------
1 file changed, 58 deletions(-)

diff --git a/drivers/iio/health/afe440x.h b/drivers/iio/health/afe440x.h
index 1a0f247..71e2f0e 100644
--- a/drivers/iio/health/afe440x.h
+++ b/drivers/iio/health/afe440x.h
@@ -88,56 +88,11 @@
#define AFE440X_CONTROL0_WRITE 0x0
#define AFE440X_CONTROL0_READ 0x1

-#define AFE440X_INTENSITY_CHAN(_index, _mask) \
- { \
- .type = IIO_INTENSITY, \
- .channel = _index, \
- .address = _index, \
- .scan_index = _index, \
- .scan_type = { \
- .sign = 's', \
- .realbits = 24, \
- .storagebits = 32, \
- .endianness = IIO_CPU, \
- }, \
- .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | \
- _mask, \
- .indexed = true, \
- }
-
-#define AFE440X_CURRENT_CHAN(_index) \
- { \
- .type = IIO_CURRENT, \
- .channel = _index, \
- .address = _index, \
- .scan_index = -1, \
- .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | \
- BIT(IIO_CHAN_INFO_SCALE), \
- .indexed = true, \
- .output = true, \
- }
-
struct afe440x_val_table {
int integer;
int fract;
};

-#define AFE440X_TABLE_ATTR(_name, _table) \
-static ssize_t _name ## _show(struct device *dev, \
- struct device_attribute *attr, char *buf) \
-{ \
- ssize_t len = 0; \
- int i; \
- \
- for (i = 0; i < ARRAY_SIZE(_table); i++) \
- len += scnprintf(buf + len, PAGE_SIZE - len, "%d.%06u ", \
- _table[i].integer, \
- _table[i].fract); \
- \
- buf[len - 1] = '\n'; \
- \
- return len; \
-} \
static DEVICE_ATTR_RO(_name)

struct afe440x_attr {
@@ -147,17 +102,4 @@ struct afe440x_attr {
unsigned int table_size;
};

-#define to_afe440x_attr(_dev_attr) \
- container_of(_dev_attr, struct afe440x_attr, dev_attr)
-
-#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), \
- .field = _field, \
- .val_table = _table, \
- .table_size = ARRAY_SIZE(_table), \
- }
-
#endif /* _AFE440X_H */
--
2.7.4

2017-03-31 18:34:00

by Joe Perches

[permalink] [raw]
Subject: Re: [PATCH 1/3] iio: health: afe440x: Remove code in comments

On Fri, 2017-03-31 at 22:16 +0530, simran singhal wrote:
> Commenting out code is a bad idea.
> As comments are for explaining what code is about.

patch doesn't match commit message.

> Signed-off-by: simran singhal <[email protected]>
> ---
> drivers/iio/health/afe440x.h | 58 --------------------------------------------
> 1 file changed, 58 deletions(-)
>
> diff --git a/drivers/iio/health/afe440x.h b/drivers/iio/health/afe440x.h
> index 1a0f247..71e2f0e 100644
> --- a/drivers/iio/health/afe440x.h
> +++ b/drivers/iio/health/afe440x.h
> @@ -88,56 +88,11 @@
> #define AFE440X_CONTROL0_WRITE 0x0
> #define AFE440X_CONTROL0_READ 0x1
>
> -#define AFE440X_INTENSITY_CHAN(_index, _mask) \
> - { \
> - .type = IIO_INTENSITY, \
> - .channel = _index, \
> - .address = _index, \
> - .scan_index = _index, \
> - .scan_type = { \
> - .sign = 's', \
> - .realbits = 24, \
> - .storagebits = 32, \
> - .endianness = IIO_CPU, \
> - }, \
> - .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | \
> - _mask, \
> - .indexed = true, \
> - }
> -
> -#define AFE440X_CURRENT_CHAN(_index) \
> - { \
> - .type = IIO_CURRENT, \
> - .channel = _index, \
> - .address = _index, \
> - .scan_index = -1, \
> - .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | \
> - BIT(IIO_CHAN_INFO_SCALE), \
> - .indexed = true, \
> - .output = true, \
> - }
> -
> struct afe440x_val_table {
> int integer;
> int fract;
> };
>
> -#define AFE440X_TABLE_ATTR(_name, _table) \
> -static ssize_t _name ## _show(struct device *dev, \
> - struct device_attribute *attr, char *buf) \
> -{ \
> - ssize_t len = 0; \
> - int i; \
> - \
> - for (i = 0; i < ARRAY_SIZE(_table); i++) \
> - len += scnprintf(buf + len, PAGE_SIZE - len, "%d.%06u ", \
> - _table[i].integer, \
> - _table[i].fract); \
> - \
> - buf[len - 1] = '\n'; \
> - \
> - return len; \
> -} \
> static DEVICE_ATTR_RO(_name)
>
> struct afe440x_attr {
> @@ -147,17 +102,4 @@ struct afe440x_attr {
> unsigned int table_size;
> };
>
> -#define to_afe440x_attr(_dev_attr) \
> - container_of(_dev_attr, struct afe440x_attr, dev_attr)
> -
> -#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), \
> - .field = _field, \
> - .val_table = _table, \
> - .table_size = ARRAY_SIZE(_table), \
> - }
> -
> #endif /* _AFE440X_H */

2017-03-31 18:43:19

by Simran Singhal

[permalink] [raw]
Subject: Re: [PATCH 1/3] iio: health: afe440x: Remove code in comments

On Sat, Apr 1, 2017 at 12:03 AM, Joe Perches <[email protected]> wrote:
> On Fri, 2017-03-31 at 22:16 +0530, simran singhal wrote:
>> Commenting out code is a bad idea.
>> As comments are for explaining what code is about.
>
> patch doesn't match commit message.

In commit message I am clearly saying commenting out the code is a bad Idea.
As comments are for explaining what code is about.
And that's what I am doing in the patch deleting the commented codes.

My subject also says "Remove code in comments"

Than what is not matching?

>
>> Signed-off-by: simran singhal <[email protected]>
>> ---
>> drivers/iio/health/afe440x.h | 58 --------------------------------------------
>> 1 file changed, 58 deletions(-)
>>
>> diff --git a/drivers/iio/health/afe440x.h b/drivers/iio/health/afe440x.h
>> index 1a0f247..71e2f0e 100644
>> --- a/drivers/iio/health/afe440x.h
>> +++ b/drivers/iio/health/afe440x.h
>> @@ -88,56 +88,11 @@
>> #define AFE440X_CONTROL0_WRITE 0x0
>> #define AFE440X_CONTROL0_READ 0x1
>>
>> -#define AFE440X_INTENSITY_CHAN(_index, _mask) \
>> - { \
>> - .type = IIO_INTENSITY, \
>> - .channel = _index, \
>> - .address = _index, \
>> - .scan_index = _index, \
>> - .scan_type = { \
>> - .sign = 's', \
>> - .realbits = 24, \
>> - .storagebits = 32, \
>> - .endianness = IIO_CPU, \
>> - }, \
>> - .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | \
>> - _mask, \
>> - .indexed = true, \
>> - }
>> -
>> -#define AFE440X_CURRENT_CHAN(_index) \
>> - { \
>> - .type = IIO_CURRENT, \
>> - .channel = _index, \
>> - .address = _index, \
>> - .scan_index = -1, \
>> - .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | \
>> - BIT(IIO_CHAN_INFO_SCALE), \
>> - .indexed = true, \
>> - .output = true, \
>> - }
>> -
>> struct afe440x_val_table {
>> int integer;
>> int fract;
>> };
>>
>> -#define AFE440X_TABLE_ATTR(_name, _table) \
>> -static ssize_t _name ## _show(struct device *dev, \
>> - struct device_attribute *attr, char *buf) \
>> -{ \
>> - ssize_t len = 0; \
>> - int i; \
>> - \
>> - for (i = 0; i < ARRAY_SIZE(_table); i++) \
>> - len += scnprintf(buf + len, PAGE_SIZE - len, "%d.%06u ", \
>> - _table[i].integer, \
>> - _table[i].fract); \
>> - \
>> - buf[len - 1] = '\n'; \
>> - \
>> - return len; \
>> -} \
>> static DEVICE_ATTR_RO(_name)
>>
>> struct afe440x_attr {
>> @@ -147,17 +102,4 @@ struct afe440x_attr {
>> unsigned int table_size;
>> };
>>
>> -#define to_afe440x_attr(_dev_attr) \
>> - container_of(_dev_attr, struct afe440x_attr, dev_attr)
>> -
>> -#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), \
>> - .field = _field, \
>> - .val_table = _table, \
>> - .table_size = ARRAY_SIZE(_table), \
>> - }
>> -
>> #endif /* _AFE440X_H */

2017-03-31 18:50:32

by Joe Perches

[permalink] [raw]
Subject: Re: [PATCH 1/3] iio: health: afe440x: Remove code in comments

On Sat, 2017-04-01 at 00:13 +0530, SIMRAN SINGHAL wrote:
> On Sat, Apr 1, 2017 at 12:03 AM, Joe Perches <[email protected]> wrote:
> > On Fri, 2017-03-31 at 22:16 +0530, simran singhal wrote:
> > > Commenting out code is a bad idea.
> > > As comments are for explaining what code is about.
> >
> > patch doesn't match commit message.
>
> In commit message I am clearly saying commenting out the code is a bad Idea.
> As comments are for explaining what code is about.
> And that's what I am doing in the patch deleting the commented codes.
>
> My subject also says "Remove code in comments"
>
> Than what is not matching?

Read your own patch.

You are removing #defines not comments.

If the whole thing is in comments, then
the #defines immediately above what you
are removing should also be deleted.

> >
> > > Signed-off-by: simran singhal <[email protected]>
> > > ---
> > > drivers/iio/health/afe440x.h | 58 --------------------------------------------
> > > 1 file changed, 58 deletions(-)
> > >
> > > diff --git a/drivers/iio/health/afe440x.h b/drivers/iio/health/afe440x.h
> > > index 1a0f247..71e2f0e 100644
> > > --- a/drivers/iio/health/afe440x.h
> > > +++ b/drivers/iio/health/afe440x.h
> > > @@ -88,56 +88,11 @@
> > > #define AFE440X_CONTROL0_WRITE 0x0
> > > #define AFE440X_CONTROL0_READ 0x1
> > >
> > > -#define AFE440X_INTENSITY_CHAN(_index, _mask) \
> > > - { \
> > > - .type = IIO_INTENSITY, \
> > > - .channel = _index, \
> > > - .address = _index, \
> > > - .scan_index = _index, \
> > > - .scan_type = { \
> > > - .sign = 's', \
> > > - .realbits = 24, \
> > > - .storagebits = 32, \
> > > - .endianness = IIO_CPU, \
> > > - }, \
> > > - .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | \
> > > - _mask, \
> > > - .indexed = true, \
> > > - }
> > > -
> > > -#define AFE440X_CURRENT_CHAN(_index) \
> > > - { \
> > > - .type = IIO_CURRENT, \
> > > - .channel = _index, \
> > > - .address = _index, \
> > > - .scan_index = -1, \
> > > - .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | \
> > > - BIT(IIO_CHAN_INFO_SCALE), \
> > > - .indexed = true, \
> > > - .output = true, \
> > > - }
> > > -
> > > struct afe440x_val_table {
> > > int integer;
> > > int fract;
> > > };
> > >
> > > -#define AFE440X_TABLE_ATTR(_name, _table) \
> > > -static ssize_t _name ## _show(struct device *dev, \
> > > - struct device_attribute *attr, char *buf) \
> > > -{ \
> > > - ssize_t len = 0; \
> > > - int i; \
> > > - \
> > > - for (i = 0; i < ARRAY_SIZE(_table); i++) \
> > > - len += scnprintf(buf + len, PAGE_SIZE - len, "%d.%06u ", \
> > > - _table[i].integer, \
> > > - _table[i].fract); \
> > > - \
> > > - buf[len - 1] = '\n'; \
> > > - \
> > > - return len; \
> > > -} \
> > > static DEVICE_ATTR_RO(_name)
> > >
> > > struct afe440x_attr {
> > > @@ -147,17 +102,4 @@ struct afe440x_attr {
> > > unsigned int table_size;
> > > };
> > >
> > > -#define to_afe440x_attr(_dev_attr) \
> > > - container_of(_dev_attr, struct afe440x_attr, dev_attr)
> > > -
> > > -#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), \
> > > - .field = _field, \
> > > - .val_table = _table, \
> > > - .table_size = ARRAY_SIZE(_table), \
> > > - }
> > > -
> > > #endif /* _AFE440X_H */

2017-03-31 19:07:24

by Simran Singhal

[permalink] [raw]
Subject: Re: [PATCH 0/3] iio: health: Clean up

Please ignore this Patch. As this patch is completely wrong due to
my lack of understanding.

On Fri, Mar 31, 2017 at 10:16 PM, simran singhal
<[email protected]> wrote:
> This patch-series removes commented code in afe440x.h and
> removes unused functions in afe4404.c and afe4403.c.
>
> simran singhal (3):
> iio: health: afe440x: Remove code in comments
> iio: health: afe4404: Remove all unused functions
> iio: health: afe4403: Remove all unused functions
>
> drivers/iio/health/afe4403.c | 51 --------------------------------------
> drivers/iio/health/afe4404.c | 51 --------------------------------------
> drivers/iio/health/afe440x.h | 58 --------------------------------------------
> 3 files changed, 160 deletions(-)
>
> --
> 2.7.4
>

2017-03-31 19:08:59

by Simran Singhal

[permalink] [raw]
Subject: Re: [PATCH 1/3] iio: health: afe440x: Remove code in comments

Please ignore this Patch. This Patch is wrong.

On Sat, Apr 1, 2017 at 12:20 AM, Joe Perches <[email protected]> wrote:
> On Sat, 2017-04-01 at 00:13 +0530, SIMRAN SINGHAL wrote:
>> On Sat, Apr 1, 2017 at 12:03 AM, Joe Perches <[email protected]> wrote:
>> > On Fri, 2017-03-31 at 22:16 +0530, simran singhal wrote:
>> > > Commenting out code is a bad idea.
>> > > As comments are for explaining what code is about.
>> >
>> > patch doesn't match commit message.
>>
>> In commit message I am clearly saying commenting out the code is a bad Idea.
>> As comments are for explaining what code is about.
>> And that's what I am doing in the patch deleting the commented codes.
>>
>> My subject also says "Remove code in comments"
>>
>> Than what is not matching?
>
> Read your own patch.
>
> You are removing #defines not comments.
>
> If the whole thing is in comments, then
> the #defines immediately above what you
> are removing should also be deleted.
>
>> >
>> > > Signed-off-by: simran singhal <[email protected]>
>> > > ---
>> > > drivers/iio/health/afe440x.h | 58 --------------------------------------------
>> > > 1 file changed, 58 deletions(-)
>> > >
>> > > diff --git a/drivers/iio/health/afe440x.h b/drivers/iio/health/afe440x.h
>> > > index 1a0f247..71e2f0e 100644
>> > > --- a/drivers/iio/health/afe440x.h
>> > > +++ b/drivers/iio/health/afe440x.h
>> > > @@ -88,56 +88,11 @@
>> > > #define AFE440X_CONTROL0_WRITE 0x0
>> > > #define AFE440X_CONTROL0_READ 0x1
>> > >
>> > > -#define AFE440X_INTENSITY_CHAN(_index, _mask) \
>> > > - { \
>> > > - .type = IIO_INTENSITY, \
>> > > - .channel = _index, \
>> > > - .address = _index, \
>> > > - .scan_index = _index, \
>> > > - .scan_type = { \
>> > > - .sign = 's', \
>> > > - .realbits = 24, \
>> > > - .storagebits = 32, \
>> > > - .endianness = IIO_CPU, \
>> > > - }, \
>> > > - .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | \
>> > > - _mask, \
>> > > - .indexed = true, \
>> > > - }
>> > > -
>> > > -#define AFE440X_CURRENT_CHAN(_index) \
>> > > - { \
>> > > - .type = IIO_CURRENT, \
>> > > - .channel = _index, \
>> > > - .address = _index, \
>> > > - .scan_index = -1, \
>> > > - .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | \
>> > > - BIT(IIO_CHAN_INFO_SCALE), \
>> > > - .indexed = true, \
>> > > - .output = true, \
>> > > - }
>> > > -
>> > > struct afe440x_val_table {
>> > > int integer;
>> > > int fract;
>> > > };
>> > >
>> > > -#define AFE440X_TABLE_ATTR(_name, _table) \
>> > > -static ssize_t _name ## _show(struct device *dev, \
>> > > - struct device_attribute *attr, char *buf) \
>> > > -{ \
>> > > - ssize_t len = 0; \
>> > > - int i; \
>> > > - \
>> > > - for (i = 0; i < ARRAY_SIZE(_table); i++) \
>> > > - len += scnprintf(buf + len, PAGE_SIZE - len, "%d.%06u ", \
>> > > - _table[i].integer, \
>> > > - _table[i].fract); \
>> > > - \
>> > > - buf[len - 1] = '\n'; \
>> > > - \
>> > > - return len; \
>> > > -} \
>> > > static DEVICE_ATTR_RO(_name)
>> > >
>> > > struct afe440x_attr {
>> > > @@ -147,17 +102,4 @@ struct afe440x_attr {
>> > > unsigned int table_size;
>> > > };
>> > >
>> > > -#define to_afe440x_attr(_dev_attr) \
>> > > - container_of(_dev_attr, struct afe440x_attr, dev_attr)
>> > > -
>> > > -#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), \
>> > > - .field = _field, \
>> > > - .val_table = _table, \
>> > > - .table_size = ARRAY_SIZE(_table), \
>> > > - }
>> > > -
>> > > #endif /* _AFE440X_H */

2017-04-02 02:40:16

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH 1/3] iio: health: afe440x: Remove code in comments

Hi simran,

[auto build test ERROR on iio/togreg]
[also build test ERROR on v4.11-rc4 next-20170331]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url: https://github.com/0day-ci/linux/commits/simran-singhal/iio-health-Clean-up/20170402-095718
base: https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git togreg
config: x86_64-randconfig-x015-201714 (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64

All error/warnings (new ones prefixed by >>):

In file included from include/linux/kobject.h:21:0,
from include/linux/device.h:17,
from drivers/iio/health/afe4403.c:17:
>> drivers/iio/health/afe440x.h:96:23: error: '_name_show' undeclared here (not in a function)
static DEVICE_ATTR_RO(_name)
^
include/linux/sysfs.h:116:10: note: in definition of macro '__ATTR_RO'
.show = _name##_show, \
^~~~~
>> drivers/iio/health/afe440x.h:96:8: note: in expansion of macro 'DEVICE_ATTR_RO'
static DEVICE_ATTR_RO(_name)
^~~~~~~~~~~~~~
In file included from drivers/iio/health/afe4403.c:34:0:
>> drivers/iio/health/afe440x.h:98:1: error: expected ',' or ';' before 'struct'
struct afe440x_attr {
^~~~~~
>> drivers/iio/health/afe4403.c:110:2: error: implicit declaration of function 'AFE440X_INTENSITY_CHAN' [-Werror=implicit-function-declaration]
AFE440X_INTENSITY_CHAN(LED2, 0),
^~~~~~~~~~~~~~~~~~~~~~
>> drivers/iio/health/afe4403.c:110:2: error: initializer element is not constant
drivers/iio/health/afe4403.c:110:2: note: (near initialization for 'afe4403_channels[0].type')
drivers/iio/health/afe4403.c:111:2: error: initializer element is not constant
AFE440X_INTENSITY_CHAN(ALED2, 0),
^~~~~~~~~~~~~~~~~~~~~~
drivers/iio/health/afe4403.c:111:2: note: (near initialization for 'afe4403_channels[0].channel')
drivers/iio/health/afe4403.c:112:2: error: initializer element is not constant
AFE440X_INTENSITY_CHAN(LED1, 0),
^~~~~~~~~~~~~~~~~~~~~~
drivers/iio/health/afe4403.c:112:2: note: (near initialization for 'afe4403_channels[0].channel2')
drivers/iio/health/afe4403.c:113:2: error: initializer element is not constant
AFE440X_INTENSITY_CHAN(ALED1, 0),
^~~~~~~~~~~~~~~~~~~~~~
drivers/iio/health/afe4403.c:113:2: note: (near initialization for 'afe4403_channels[0].address')
drivers/iio/health/afe4403.c:114:2: error: initializer element is not constant
AFE440X_INTENSITY_CHAN(LED2_ALED2, 0),
^~~~~~~~~~~~~~~~~~~~~~
drivers/iio/health/afe4403.c:114:2: note: (near initialization for 'afe4403_channels[0].scan_index')
drivers/iio/health/afe4403.c:115:2: error: initializer element is not constant
AFE440X_INTENSITY_CHAN(LED1_ALED1, 0),
^~~~~~~~~~~~~~~~~~~~~~
drivers/iio/health/afe4403.c:115:2: note: (near initialization for 'afe4403_channels[0].scan_type.sign')
>> drivers/iio/health/afe4403.c:117:2: error: implicit declaration of function 'AFE440X_CURRENT_CHAN' [-Werror=implicit-function-declaration]
AFE440X_CURRENT_CHAN(LED2),
^~~~~~~~~~~~~~~~~~~~
drivers/iio/health/afe4403.c:117:2: error: initializer element is not constant
drivers/iio/health/afe4403.c:117:2: note: (near initialization for 'afe4403_channels[0].scan_type.realbits')
drivers/iio/health/afe4403.c:118:2: error: initializer element is not constant
AFE440X_CURRENT_CHAN(LED1),
^~~~~~~~~~~~~~~~~~~~
drivers/iio/health/afe4403.c:118:2: note: (near initialization for 'afe4403_channels[0].scan_type.storagebits')
>> drivers/iio/health/afe4403.c:125:1: warning: data definition has no type or storage class
AFE440X_TABLE_ATTR(in_intensity_resistance_available, afe4403_res_table);
^~~~~~~~~~~~~~~~~~
>> drivers/iio/health/afe4403.c:125:1: error: type defaults to 'int' in declaration of 'AFE440X_TABLE_ATTR' [-Werror=implicit-int]
>> drivers/iio/health/afe4403.c:125:1: warning: parameter names (without types) in function declaration
drivers/iio/health/afe4403.c:137:1: warning: data definition has no type or storage class
AFE440X_TABLE_ATTR(in_intensity_capacitance_available, afe4403_cap_table);
^~~~~~~~~~~~~~~~~~
drivers/iio/health/afe4403.c:137:1: error: type defaults to 'int' in declaration of 'AFE440X_TABLE_ATTR' [-Werror=implicit-int]
drivers/iio/health/afe4403.c:137:1: warning: parameter names (without types) in function declaration
drivers/iio/health/afe4403.c: In function 'afe440x_show_register':
>> drivers/iio/health/afe4403.c:145:38: error: implicit declaration of function 'to_afe440x_attr' [-Werror=implicit-function-declaration]
struct afe440x_attr *afe440x_attr = to_afe440x_attr(attr);
^~~~~~~~~~~~~~~
>> drivers/iio/health/afe4403.c:145:38: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
>> drivers/iio/health/afe4403.c:150:50: error: dereferencing pointer to incomplete type 'struct afe440x_attr'
ret = regmap_field_read(afe->fields[afe440x_attr->field], &reg_val);
^~
>> drivers/iio/health/afe4403.c:150:50: error: request for member 'field' in something not a structure or union
>> drivers/iio/health/afe4403.c:150:37: error: array subscript is not an integer
ret = regmap_field_read(afe->fields[afe440x_attr->field], &reg_val);
^
>> drivers/iio/health/afe4403.c:150:26: error: passing argument 1 of 'regmap_field_read' from incompatible pointer type [-Werror=incompatible-pointer-types]
ret = regmap_field_read(afe->fields[afe440x_attr->field], &reg_val);
^~~
In file included from drivers/iio/health/afe4403.c:22:0:
include/linux/regmap.h:850:5: note: expected 'struct regmap_field *' but argument is of type 'const struct iio_chan_spec *'
int regmap_field_read(struct regmap_field *field, unsigned int *val);
^~~~~~~~~~~~~~~~~
>> drivers/iio/health/afe4403.c:154:29: error: request for member 'table_size' in something not a structure or union
if (reg_val >= afe440x_attr->table_size)
^~
>> drivers/iio/health/afe4403.c:154:14: warning: comparison between pointer and integer
if (reg_val >= afe440x_attr->table_size)
^~
>> drivers/iio/health/afe4403.c:157:24: error: request for member 'val_table' in something not a structure or union
vals[0] = afe440x_attr->val_table[reg_val].integer;
^~
>> drivers/iio/health/afe4403.c:157:44: error: 'const struct iio_chan_spec' has no member named 'integer'; did you mean 'indexed'?
vals[0] = afe440x_attr->val_table[reg_val].integer;
^
>> drivers/iio/health/afe4403.c:157:10: warning: assignment makes integer from pointer without a cast [-Wint-conversion]
vals[0] = afe440x_attr->val_table[reg_val].integer;
^
drivers/iio/health/afe4403.c:158:24: error: request for member 'val_table' in something not a structure or union
vals[1] = afe440x_attr->val_table[reg_val].fract;
^~
--
In file included from include/linux/kobject.h:21:0,
from include/linux/device.h:17,
from drivers/iio/health/afe4404.c:17:
>> drivers/iio/health/afe440x.h:96:23: error: '_name_show' undeclared here (not in a function)
static DEVICE_ATTR_RO(_name)
^
include/linux/sysfs.h:116:10: note: in definition of macro '__ATTR_RO'
.show = _name##_show, \
^~~~~
>> drivers/iio/health/afe440x.h:96:8: note: in expansion of macro 'DEVICE_ATTR_RO'
static DEVICE_ATTR_RO(_name)
^~~~~~~~~~~~~~
In file included from drivers/iio/health/afe4404.c:34:0:
>> drivers/iio/health/afe440x.h:98:1: error: expected ',' or ';' before 'struct'
struct afe440x_attr {
^~~~~~
>> drivers/iio/health/afe4404.c:137:2: error: implicit declaration of function 'AFE440X_INTENSITY_CHAN' [-Werror=implicit-function-declaration]
AFE440X_INTENSITY_CHAN(LED2, BIT(IIO_CHAN_INFO_OFFSET)),
^~~~~~~~~~~~~~~~~~~~~~
>> drivers/iio/health/afe4404.c:137:2: error: initializer element is not constant
drivers/iio/health/afe4404.c:137:2: note: (near initialization for 'afe4404_channels[0].type')
drivers/iio/health/afe4404.c:138:2: error: initializer element is not constant
AFE440X_INTENSITY_CHAN(ALED2, BIT(IIO_CHAN_INFO_OFFSET)),
^~~~~~~~~~~~~~~~~~~~~~
drivers/iio/health/afe4404.c:138:2: note: (near initialization for 'afe4404_channels[0].channel')
drivers/iio/health/afe4404.c:139:2: error: initializer element is not constant
AFE440X_INTENSITY_CHAN(LED1, BIT(IIO_CHAN_INFO_OFFSET)),
^~~~~~~~~~~~~~~~~~~~~~
drivers/iio/health/afe4404.c:139:2: note: (near initialization for 'afe4404_channels[0].channel2')
drivers/iio/health/afe4404.c:140:2: error: initializer element is not constant
AFE440X_INTENSITY_CHAN(ALED1, BIT(IIO_CHAN_INFO_OFFSET)),
^~~~~~~~~~~~~~~~~~~~~~
drivers/iio/health/afe4404.c:140:2: note: (near initialization for 'afe4404_channels[0].address')
drivers/iio/health/afe4404.c:141:2: error: initializer element is not constant
AFE440X_INTENSITY_CHAN(LED2_ALED2, 0),
^~~~~~~~~~~~~~~~~~~~~~
drivers/iio/health/afe4404.c:141:2: note: (near initialization for 'afe4404_channels[0].scan_index')
drivers/iio/health/afe4404.c:142:2: error: initializer element is not constant
AFE440X_INTENSITY_CHAN(LED1_ALED1, 0),
^~~~~~~~~~~~~~~~~~~~~~
drivers/iio/health/afe4404.c:142:2: note: (near initialization for 'afe4404_channels[0].scan_type.sign')
>> drivers/iio/health/afe4404.c:144:2: error: implicit declaration of function 'AFE440X_CURRENT_CHAN' [-Werror=implicit-function-declaration]
AFE440X_CURRENT_CHAN(LED2),
^~~~~~~~~~~~~~~~~~~~
drivers/iio/health/afe4404.c:144:2: error: initializer element is not constant
drivers/iio/health/afe4404.c:144:2: note: (near initialization for 'afe4404_channels[0].scan_type.realbits')
drivers/iio/health/afe4404.c:145:2: error: initializer element is not constant
AFE440X_CURRENT_CHAN(ALED2),
^~~~~~~~~~~~~~~~~~~~
drivers/iio/health/afe4404.c:145:2: note: (near initialization for 'afe4404_channels[0].scan_type.storagebits')
drivers/iio/health/afe4404.c:146:2: error: initializer element is not constant
AFE440X_CURRENT_CHAN(LED1),
^~~~~~~~~~~~~~~~~~~~
drivers/iio/health/afe4404.c:146:2: note: (near initialization for 'afe4404_channels[0].scan_type.shift')
>> drivers/iio/health/afe4404.c:159:1: warning: data definition has no type or storage class
AFE440X_TABLE_ATTR(in_intensity_resistance_available, afe4404_res_table);
^~~~~~~~~~~~~~~~~~
>> drivers/iio/health/afe4404.c:159:1: error: type defaults to 'int' in declaration of 'AFE440X_TABLE_ATTR' [-Werror=implicit-int]
>> drivers/iio/health/afe4404.c:159:1: warning: parameter names (without types) in function declaration
drivers/iio/health/afe4404.c:171:1: warning: data definition has no type or storage class
AFE440X_TABLE_ATTR(in_intensity_capacitance_available, afe4404_cap_table);
^~~~~~~~~~~~~~~~~~
drivers/iio/health/afe4404.c:171:1: error: type defaults to 'int' in declaration of 'AFE440X_TABLE_ATTR' [-Werror=implicit-int]
drivers/iio/health/afe4404.c:171:1: warning: parameter names (without types) in function declaration
drivers/iio/health/afe4404.c: In function 'afe440x_show_register':
>> drivers/iio/health/afe4404.c:179:38: error: implicit declaration of function 'to_afe440x_attr' [-Werror=implicit-function-declaration]
struct afe440x_attr *afe440x_attr = to_afe440x_attr(attr);
^~~~~~~~~~~~~~~
>> drivers/iio/health/afe4404.c:179:38: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
>> drivers/iio/health/afe4404.c:184:50: error: dereferencing pointer to incomplete type 'struct afe440x_attr'
ret = regmap_field_read(afe->fields[afe440x_attr->field], &reg_val);
^~
>> drivers/iio/health/afe4404.c:184:50: error: request for member 'field' in something not a structure or union
>> drivers/iio/health/afe4404.c:184:37: error: array subscript is not an integer
ret = regmap_field_read(afe->fields[afe440x_attr->field], &reg_val);
^
>> drivers/iio/health/afe4404.c:184:26: error: passing argument 1 of 'regmap_field_read' from incompatible pointer type [-Werror=incompatible-pointer-types]
ret = regmap_field_read(afe->fields[afe440x_attr->field], &reg_val);
^~~
In file included from drivers/iio/health/afe4404.c:23:0:
include/linux/regmap.h:850:5: note: expected 'struct regmap_field *' but argument is of type 'const struct iio_chan_spec *'
int regmap_field_read(struct regmap_field *field, unsigned int *val);
^~~~~~~~~~~~~~~~~
>> drivers/iio/health/afe4404.c:188:29: error: request for member 'table_size' in something not a structure or union
if (reg_val >= afe440x_attr->table_size)
^~
>> drivers/iio/health/afe4404.c:188:14: warning: comparison between pointer and integer
if (reg_val >= afe440x_attr->table_size)
^~
>> drivers/iio/health/afe4404.c:191:24: error: request for member 'val_table' in something not a structure or union
vals[0] = afe440x_attr->val_table[reg_val].integer;
^~
>> drivers/iio/health/afe4404.c:191:44: error: 'const struct iio_chan_spec' has no member named 'integer'; did you mean 'indexed'?
vals[0] = afe440x_attr->val_table[reg_val].integer;
^
>> drivers/iio/health/afe4404.c:191:10: warning: assignment makes integer from pointer without a cast [-Wint-conversion]
vals[0] = afe440x_attr->val_table[reg_val].integer;
^
drivers/iio/health/afe4404.c:192:24: error: request for member 'val_table' in something not a structure or union
vals[1] = afe440x_attr->val_table[reg_val].fract;
^~

vim +/_name_show +96 drivers/iio/health/afe440x.h

87aec56e2 Andrew F. Davis 2016-02-02 90
87aec56e2 Andrew F. Davis 2016-02-02 91 struct afe440x_val_table {
87aec56e2 Andrew F. Davis 2016-02-02 92 int integer;
87aec56e2 Andrew F. Davis 2016-02-02 93 int fract;
87aec56e2 Andrew F. Davis 2016-02-02 94 };
87aec56e2 Andrew F. Davis 2016-02-02 95
87aec56e2 Andrew F. Davis 2016-02-02 @96 static DEVICE_ATTR_RO(_name)
87aec56e2 Andrew F. Davis 2016-02-02 97
87aec56e2 Andrew F. Davis 2016-02-02 @98 struct afe440x_attr {
87aec56e2 Andrew F. Davis 2016-02-02 99 struct device_attribute dev_attr;
b36e82576 Andrew F. Davis 2016-05-01 100 unsigned int field;
87aec56e2 Andrew F. Davis 2016-02-02 101 const struct afe440x_val_table *val_table;

:::::: The code at line 96 was first introduced by commit
:::::: 87aec56e27efac98b7a0abe93258687716bf0b1e iio: health: Add driver for the TI AFE4404 heart monitor

:::::: TO: Andrew F. Davis <[email protected]>
:::::: CC: Jonathan Cameron <[email protected]>

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation


Attachments:
(No filename) (15.16 kB)
.config.gz (27.01 kB)
Download all attachments

2017-04-02 03:26:55

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH 1/3] iio: health: afe440x: Remove code in comments

Hi simran,

[auto build test ERROR on iio/togreg]
[also build test ERROR on v4.11-rc4 next-20170331]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url: https://github.com/0day-ci/linux/commits/simran-singhal/iio-health-Clean-up/20170402-095718
base: https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git togreg
config: xtensa-allmodconfig (attached as .config)
compiler: xtensa-linux-gcc (GCC) 4.9.0
reproduce:
wget https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=xtensa

All error/warnings (new ones prefixed by >>):

In file included from include/linux/kobject.h:21:0,
from include/linux/device.h:17,
from drivers/iio/health/afe4403.c:17:
drivers/iio/health/afe440x.h:96:23: error: '_name_show' undeclared here (not in a function)
static DEVICE_ATTR_RO(_name)
^
include/linux/sysfs.h:116:10: note: in definition of macro '__ATTR_RO'
.show = _name##_show, \
^
drivers/iio/health/afe440x.h:96:8: note: in expansion of macro 'DEVICE_ATTR_RO'
static DEVICE_ATTR_RO(_name)
^
In file included from drivers/iio/health/afe4403.c:34:0:
drivers/iio/health/afe440x.h:98:1: error: expected ',' or ';' before 'struct'
struct afe440x_attr {
^
drivers/iio/health/afe4403.c:110:2: error: implicit declaration of function 'AFE440X_INTENSITY_CHAN' [-Werror=implicit-function-declaration]
AFE440X_INTENSITY_CHAN(LED2, 0),
^
>> drivers/iio/health/afe4403.c:110:2: warning: missing braces around initializer [-Wmissing-braces]
drivers/iio/health/afe4403.c:110:2: warning: (near initialization for 'afe4403_channels[0]') [-Wmissing-braces]
drivers/iio/health/afe4403.c:110:2: error: initializer element is not constant
drivers/iio/health/afe4403.c:110:2: error: (near initialization for 'afe4403_channels[0].type')
drivers/iio/health/afe4403.c:111:2: error: initializer element is not constant
AFE440X_INTENSITY_CHAN(ALED2, 0),
^
drivers/iio/health/afe4403.c:111:2: error: (near initialization for 'afe4403_channels[0].channel')
drivers/iio/health/afe4403.c:112:2: error: initializer element is not constant
AFE440X_INTENSITY_CHAN(LED1, 0),
^
drivers/iio/health/afe4403.c:112:2: error: (near initialization for 'afe4403_channels[0].channel2')
drivers/iio/health/afe4403.c:113:2: error: initializer element is not constant
AFE440X_INTENSITY_CHAN(ALED1, 0),
^
drivers/iio/health/afe4403.c:113:2: error: (near initialization for 'afe4403_channels[0].address')
drivers/iio/health/afe4403.c:114:2: error: initializer element is not constant
AFE440X_INTENSITY_CHAN(LED2_ALED2, 0),
^
drivers/iio/health/afe4403.c:114:2: error: (near initialization for 'afe4403_channels[0].scan_index')
drivers/iio/health/afe4403.c:115:2: error: initializer element is not constant
AFE440X_INTENSITY_CHAN(LED1_ALED1, 0),
^
drivers/iio/health/afe4403.c:115:2: error: (near initialization for 'afe4403_channels[0].scan_type.sign')
drivers/iio/health/afe4403.c:117:2: error: implicit declaration of function 'AFE440X_CURRENT_CHAN' [-Werror=implicit-function-declaration]
AFE440X_CURRENT_CHAN(LED2),
^
drivers/iio/health/afe4403.c:117:2: error: initializer element is not constant
drivers/iio/health/afe4403.c:117:2: error: (near initialization for 'afe4403_channels[0].scan_type.realbits')
drivers/iio/health/afe4403.c:118:2: error: initializer element is not constant
AFE440X_CURRENT_CHAN(LED1),
^
drivers/iio/health/afe4403.c:118:2: error: (near initialization for 'afe4403_channels[0].scan_type.storagebits')
drivers/iio/health/afe4403.c:125:1: warning: data definition has no type or storage class
AFE440X_TABLE_ATTR(in_intensity_resistance_available, afe4403_res_table);
^
drivers/iio/health/afe4403.c:125:1: error: type defaults to 'int' in declaration of 'AFE440X_TABLE_ATTR' [-Werror=implicit-int]
drivers/iio/health/afe4403.c:125:1: warning: parameter names (without types) in function declaration
drivers/iio/health/afe4403.c:137:1: warning: data definition has no type or storage class
AFE440X_TABLE_ATTR(in_intensity_capacitance_available, afe4403_cap_table);
^
drivers/iio/health/afe4403.c:137:1: error: type defaults to 'int' in declaration of 'AFE440X_TABLE_ATTR' [-Werror=implicit-int]
drivers/iio/health/afe4403.c:137:1: warning: parameter names (without types) in function declaration
drivers/iio/health/afe4403.c: In function 'afe440x_show_register':
drivers/iio/health/afe4403.c:145:9: error: implicit declaration of function 'to_afe440x_attr' [-Werror=implicit-function-declaration]
struct afe440x_attr *afe440x_attr = to_afe440x_attr(attr);
^
drivers/iio/health/afe4403.c:145:38: warning: initialization makes pointer from integer without a cast
struct afe440x_attr *afe440x_attr = to_afe440x_attr(attr);
^
drivers/iio/health/afe4403.c:150:50: error: dereferencing pointer to incomplete type
ret = regmap_field_read(afe->fields[afe440x_attr->field], &reg_val);
^
drivers/iio/health/afe4403.c:150:50: error: request for member 'field' in something not a structure or union
drivers/iio/health/afe4403.c:150:37: error: array subscript is not an integer
ret = regmap_field_read(afe->fields[afe440x_attr->field], &reg_val);
^
drivers/iio/health/afe4403.c:150:8: warning: passing argument 1 of 'regmap_field_read' from incompatible pointer type
ret = regmap_field_read(afe->fields[afe440x_attr->field], &reg_val);
^
In file included from drivers/iio/health/afe4403.c:22:0:
include/linux/regmap.h:850:5: note: expected 'struct regmap_field *' but argument is of type 'const struct iio_chan_spec *'
int regmap_field_read(struct regmap_field *field, unsigned int *val);
^
drivers/iio/health/afe4403.c:154:29: error: dereferencing pointer to incomplete type
if (reg_val >= afe440x_attr->table_size)
^
drivers/iio/health/afe4403.c:154:29: error: request for member 'table_size' in something not a structure or union
drivers/iio/health/afe4403.c:154:14: warning: comparison between pointer and integer
if (reg_val >= afe440x_attr->table_size)
^
drivers/iio/health/afe4403.c:157:24: error: dereferencing pointer to incomplete type
vals[0] = afe440x_attr->val_table[reg_val].integer;
^
drivers/iio/health/afe4403.c:157:24: error: request for member 'val_table' in something not a structure or union
drivers/iio/health/afe4403.c:157:44: error: 'const struct iio_chan_spec' has no member named 'integer'
vals[0] = afe440x_attr->val_table[reg_val].integer;
^
drivers/iio/health/afe4403.c:157:10: warning: assignment makes integer from pointer without a cast
vals[0] = afe440x_attr->val_table[reg_val].integer;
^
drivers/iio/health/afe4403.c:158:24: error: dereferencing pointer to incomplete type
vals[1] = afe440x_attr->val_table[reg_val].fract;
^
drivers/iio/health/afe4403.c:158:24: error: request for member 'val_table' in something not a structure or union
drivers/iio/health/afe4403.c:158:44: error: 'const struct iio_chan_spec' has no member named 'fract'
vals[1] = afe440x_attr->val_table[reg_val].fract;
^
drivers/iio/health/afe4403.c:158:10: warning: assignment makes integer from pointer without a cast
vals[1] = afe440x_attr->val_table[reg_val].fract;
^
drivers/iio/health/afe4403.c: In function 'afe440x_store_register':
drivers/iio/health/afe4403.c:169:38: warning: initialization makes pointer from integer without a cast
struct afe440x_attr *afe440x_attr = to_afe440x_attr(attr);
^
drivers/iio/health/afe4403.c:176:34: error: dereferencing pointer to incomplete type
for (val = 0; val < afe440x_attr->table_size; val++)
^
drivers/iio/health/afe4403.c:176:34: error: request for member 'table_size' in something not a structure or union
drivers/iio/health/afe4403.c:176:20: warning: comparison between pointer and integer
for (val = 0; val < afe440x_attr->table_size; val++)
--
drivers/iio/health/afe4403.c:177:44: warning: comparison between pointer and integer
if (afe440x_attr->val_table[val].integer == integer &&
^
drivers/iio/health/afe4403.c:178:19: error: dereferencing pointer to incomplete type
afe440x_attr->val_table[val].fract == fract)
^
drivers/iio/health/afe4403.c:178:19: error: request for member 'val_table' in something not a structure or union
drivers/iio/health/afe4403.c:178:35: error: 'const struct iio_chan_spec' has no member named 'fract'
afe440x_attr->val_table[val].fract == fract)
^
drivers/iio/health/afe4403.c:178:42: warning: comparison between pointer and integer
afe440x_attr->val_table[val].fract == fract)
^
drivers/iio/health/afe4403.c:180:25: error: dereferencing pointer to incomplete type
if (val == afe440x_attr->table_size)
^
drivers/iio/health/afe4403.c:180:25: error: request for member 'table_size' in something not a structure or union
drivers/iio/health/afe4403.c:180:10: warning: comparison between pointer and integer
if (val == afe440x_attr->table_size)
^
In file included from drivers/iio/health/afe4403.c:22:0:
drivers/iio/health/afe4403.c:183:51: error: dereferencing pointer to incomplete type
ret = regmap_field_write(afe->fields[afe440x_attr->field], val);
^
include/linux/regmap.h:85:32: note: in definition of macro 'regmap_field_write'
regmap_field_update_bits_base(field, ~0, val, NULL, false, false)
^
drivers/iio/health/afe4403.c:183:51: error: request for member 'field' in something not a structure or union
ret = regmap_field_write(afe->fields[afe440x_attr->field], val);
^
include/linux/regmap.h:85:32: note: in definition of macro 'regmap_field_write'
regmap_field_update_bits_base(field, ~0, val, NULL, false, false)
^
drivers/iio/health/afe4403.c:183:38: error: array subscript is not an integer
ret = regmap_field_write(afe->fields[afe440x_attr->field], val);
^
include/linux/regmap.h:85:32: note: in definition of macro 'regmap_field_write'
regmap_field_update_bits_base(field, ~0, val, NULL, false, false)
^
include/linux/regmap.h:85:2: warning: passing argument 1 of 'regmap_field_update_bits_base' from incompatible pointer type
regmap_field_update_bits_base(field, ~0, val, NULL, false, false)
^
drivers/iio/health/afe4403.c:183:8: note: in expansion of macro 'regmap_field_write'
ret = regmap_field_write(afe->fields[afe440x_attr->field], val);
^
include/linux/regmap.h:851:5: note: expected 'struct regmap_field *' but argument is of type 'const struct iio_chan_spec *'
int regmap_field_update_bits_base(struct regmap_field *field,
^
drivers/iio/health/afe4403.c: At top level:
drivers/iio/health/afe4403.c:190:8: error: type defaults to 'int' in declaration of 'AFE440X_ATTR' [-Werror=implicit-int]
static AFE440X_ATTR(in_intensity1_resistance, F_RF_LED, afe4403_res_table);
^
drivers/iio/health/afe4403.c:190:1: warning: parameter names (without types) in function declaration
static AFE440X_ATTR(in_intensity1_resistance, F_RF_LED, afe4403_res_table);
^
drivers/iio/health/afe4403.c:191:8: error: type defaults to 'int' in declaration of 'AFE440X_ATTR' [-Werror=implicit-int]
static AFE440X_ATTR(in_intensity1_capacitance, F_CF_LED, afe4403_cap_table);
^
drivers/iio/health/afe4403.c:191:1: warning: parameter names (without types) in function declaration
static AFE440X_ATTR(in_intensity1_capacitance, F_CF_LED, afe4403_cap_table);
^
drivers/iio/health/afe4403.c:193:8: error: type defaults to 'int' in declaration of 'AFE440X_ATTR' [-Werror=implicit-int]
static AFE440X_ATTR(in_intensity2_resistance, F_RF_LED, afe4403_res_table);
^
drivers/iio/health/afe4403.c:193:1: warning: parameter names (without types) in function declaration
static AFE440X_ATTR(in_intensity2_resistance, F_RF_LED, afe4403_res_table);
^
drivers/iio/health/afe4403.c:194:8: error: type defaults to 'int' in declaration of 'AFE440X_ATTR' [-Werror=implicit-int]
static AFE440X_ATTR(in_intensity2_capacitance, F_CF_LED, afe4403_cap_table);
^
drivers/iio/health/afe4403.c:194:1: warning: parameter names (without types) in function declaration
static AFE440X_ATTR(in_intensity2_capacitance, F_CF_LED, afe4403_cap_table);
^
drivers/iio/health/afe4403.c:196:8: error: type defaults to 'int' in declaration of 'AFE440X_ATTR' [-Werror=implicit-int]
static AFE440X_ATTR(in_intensity3_resistance, F_RF_LED1, afe4403_res_table);
^
drivers/iio/health/afe4403.c:196:1: warning: parameter names (without types) in function declaration
static AFE440X_ATTR(in_intensity3_resistance, F_RF_LED1, afe4403_res_table);
^
drivers/iio/health/afe4403.c:197:8: error: type defaults to 'int' in declaration of 'AFE440X_ATTR' [-Werror=implicit-int]
static AFE440X_ATTR(in_intensity3_capacitance, F_CF_LED1, afe4403_cap_table);
^
drivers/iio/health/afe4403.c:197:1: warning: parameter names (without types) in function declaration
static AFE440X_ATTR(in_intensity3_capacitance, F_CF_LED1, afe4403_cap_table);
^
drivers/iio/health/afe4403.c:199:8: error: type defaults to 'int' in declaration of 'AFE440X_ATTR' [-Werror=implicit-int]
static AFE440X_ATTR(in_intensity4_resistance, F_RF_LED1, afe4403_res_table);
^
drivers/iio/health/afe4403.c:199:1: warning: parameter names (without types) in function declaration
static AFE440X_ATTR(in_intensity4_resistance, F_RF_LED1, afe4403_res_table);
^
drivers/iio/health/afe4403.c:200:8: error: type defaults to 'int' in declaration of 'AFE440X_ATTR' [-Werror=implicit-int]
static AFE440X_ATTR(in_intensity4_capacitance, F_CF_LED1, afe4403_cap_table);
^
drivers/iio/health/afe4403.c:200:1: warning: parameter names (without types) in function declaration
static AFE440X_ATTR(in_intensity4_capacitance, F_CF_LED1, afe4403_cap_table);
^
drivers/iio/health/afe4403.c:203:3: error: 'dev_attr_in_intensity_resistance_available' undeclared here (not in a function)
&dev_attr_in_intensity_resistance_available.attr,
^
>> drivers/iio/health/afe4403.c:203:45: error: request for member 'attr' in something not a structure or union
&dev_attr_in_intensity_resistance_available.attr,
^
drivers/iio/health/afe4403.c:203:2: error: initializer element is not constant
&dev_attr_in_intensity_resistance_available.attr,
^
drivers/iio/health/afe4403.c:203:2: error: (near initialization for 'afe440x_attributes[0]')
drivers/iio/health/afe4403.c:204:3: error: 'dev_attr_in_intensity_capacitance_available' undeclared here (not in a function)
&dev_attr_in_intensity_capacitance_available.attr,
^
drivers/iio/health/afe4403.c:204:46: error: request for member 'attr' in something not a structure or union
&dev_attr_in_intensity_capacitance_available.attr,
^
drivers/iio/health/afe4403.c:204:2: error: initializer element is not constant
&dev_attr_in_intensity_capacitance_available.attr,
^
drivers/iio/health/afe4403.c:204:2: error: (near initialization for 'afe440x_attributes[1]')
drivers/iio/health/afe4403.c:205:3: error: 'afe440x_attr_in_intensity1_resistance' undeclared here (not in a function)
&afe440x_attr_in_intensity1_resistance.dev_attr.attr,
^
>> drivers/iio/health/afe4403.c:205:40: error: request for member 'dev_attr' in something not a structure or union
&afe440x_attr_in_intensity1_resistance.dev_attr.attr,
^
drivers/iio/health/afe4403.c:205:49: error: request for member 'attr' in something not a structure or union
&afe440x_attr_in_intensity1_resistance.dev_attr.attr,
^
drivers/iio/health/afe4403.c:205:2: error: initializer element is not constant
&afe440x_attr_in_intensity1_resistance.dev_attr.attr,
^
drivers/iio/health/afe4403.c:205:2: error: (near initialization for 'afe440x_attributes[2]')
drivers/iio/health/afe4403.c:206:3: error: 'afe440x_attr_in_intensity1_capacitance' undeclared here (not in a function)
&afe440x_attr_in_intensity1_capacitance.dev_attr.attr,
^
drivers/iio/health/afe4403.c:206:41: error: request for member 'dev_attr' in something not a structure or union
&afe440x_attr_in_intensity1_capacitance.dev_attr.attr,
^
drivers/iio/health/afe4403.c:206:50: error: request for member 'attr' in something not a structure or union
&afe440x_attr_in_intensity1_capacitance.dev_attr.attr,
^
drivers/iio/health/afe4403.c:206:2: error: initializer element is not constant
&afe440x_attr_in_intensity1_capacitance.dev_attr.attr,
^
drivers/iio/health/afe4403.c:206:2: error: (near initialization for 'afe440x_attributes[3]')
drivers/iio/health/afe4403.c:207:3: error: 'afe440x_attr_in_intensity2_resistance' undeclared here (not in a function)
&afe440x_attr_in_intensity2_resistance.dev_attr.attr,
^
drivers/iio/health/afe4403.c:207:40: error: request for member 'dev_attr' in something not a structure or union
&afe440x_attr_in_intensity2_resistance.dev_attr.attr,
^
drivers/iio/health/afe4403.c:207:49: error: request for member 'attr' in something not a structure or union
&afe440x_attr_in_intensity2_resistance.dev_attr.attr,
^
drivers/iio/health/afe4403.c:207:2: error: initializer element is not constant
&afe440x_attr_in_intensity2_resistance.dev_attr.attr,
^
drivers/iio/health/afe4403.c:207:2: error: (near initialization for 'afe440x_attributes[4]')
drivers/iio/health/afe4403.c:208:3: error: 'afe440x_attr_in_intensity2_capacitance' undeclared here (not in a function)
&afe440x_attr_in_intensity2_capacitance.dev_attr.attr,
^
drivers/iio/health/afe4403.c:208:41: error: request for member 'dev_attr' in something not a structure or union
&afe440x_attr_in_intensity2_capacitance.dev_attr.attr,
^
drivers/iio/health/afe4403.c:208:50: error: request for member 'attr' in something not a structure or union
&afe440x_attr_in_intensity2_capacitance.dev_attr.attr,
^
drivers/iio/health/afe4403.c:208:2: error: initializer element is not constant
&afe440x_attr_in_intensity2_capacitance.dev_attr.attr,
^
drivers/iio/health/afe4403.c:208:2: error: (near initialization for 'afe440x_attributes[5]')
drivers/iio/health/afe4403.c:209:3: error: 'afe440x_attr_in_intensity3_resistance' undeclared here (not in a function)
&afe440x_attr_in_intensity3_resistance.dev_attr.attr,
^
drivers/iio/health/afe4403.c:209:40: error: request for member 'dev_attr' in something not a structure or union
&afe440x_attr_in_intensity3_resistance.dev_attr.attr,
^
drivers/iio/health/afe4403.c:209:49: error: request for member 'attr' in something not a structure or union
&afe440x_attr_in_intensity3_resistance.dev_attr.attr,
^
drivers/iio/health/afe4403.c:209:2: error: initializer element is not constant
&afe440x_attr_in_intensity3_resistance.dev_attr.attr,
^
drivers/iio/health/afe4403.c:209:2: error: (near initialization for 'afe440x_attributes[6]')
drivers/iio/health/afe4403.c:210:3: error: 'afe440x_attr_in_intensity3_capacitance' undeclared here (not in a function)
&afe440x_attr_in_intensity3_capacitance.dev_attr.attr,
^
drivers/iio/health/afe4403.c:210:41: error: request for member 'dev_attr' in something not a structure or union
&afe440x_attr_in_intensity3_capacitance.dev_attr.attr,
^
drivers/iio/health/afe4403.c:210:50: error: request for member 'attr' in something not a structure or union
&afe440x_attr_in_intensity3_capacitance.dev_attr.attr,
^
drivers/iio/health/afe4403.c:210:2: error: initializer element is not constant
&afe440x_attr_in_intensity3_capacitance.dev_attr.attr,
^
drivers/iio/health/afe4403.c:210:2: error: (near initialization for 'afe440x_attributes[7]')
drivers/iio/health/afe4403.c:211:3: error: 'afe440x_attr_in_intensity4_resistance' undeclared here (not in a function)
&afe440x_attr_in_intensity4_resistance.dev_attr.attr,
^
drivers/iio/health/afe4403.c:211:40: error: request for member 'dev_attr' in something not a structure or union
&afe440x_attr_in_intensity4_resistance.dev_attr.attr,
^
drivers/iio/health/afe4403.c:211:49: error: request for member 'attr' in something not a structure or union
&afe440x_attr_in_intensity4_resistance.dev_attr.attr,
^
drivers/iio/health/afe4403.c:211:2: error: initializer element is not constant
&afe440x_attr_in_intensity4_resistance.dev_attr.attr,
^
drivers/iio/health/afe4403.c:211:2: error: (near initialization for 'afe440x_attributes[8]')
drivers/iio/health/afe4403.c:212:3: error: 'afe440x_attr_in_intensity4_capacitance' undeclared here (not in a function)
&afe440x_attr_in_intensity4_capacitance.dev_attr.attr,
^
drivers/iio/health/afe4403.c:212:41: error: request for member 'dev_attr' in something not a structure or union
&afe440x_attr_in_intensity4_capacitance.dev_attr.attr,
^
drivers/iio/health/afe4403.c:212:50: error: request for member 'attr' in something not a structure or union
&afe440x_attr_in_intensity4_capacitance.dev_attr.attr,
^
drivers/iio/health/afe4403.c:212:2: error: initializer element is not constant
&afe440x_attr_in_intensity4_capacitance.dev_attr.attr,
^
drivers/iio/health/afe4403.c:212:2: error: (near initialization for 'afe440x_attributes[9]')
..

vim +/dev_attr +205 drivers/iio/health/afe4403.c

eec96d1e2 Andrew F. Davis 2016-02-06 28 #include <linux/iio/sysfs.h>
eec96d1e2 Andrew F. Davis 2016-02-06 29 #include <linux/iio/buffer.h>
eec96d1e2 Andrew F. Davis 2016-02-06 30 #include <linux/iio/trigger.h>
eec96d1e2 Andrew F. Davis 2016-02-06 31 #include <linux/iio/triggered_buffer.h>
eec96d1e2 Andrew F. Davis 2016-02-06 32 #include <linux/iio/trigger_consumer.h>
eec96d1e2 Andrew F. Davis 2016-02-06 33
eec96d1e2 Andrew F. Davis 2016-02-06 @34 #include "afe440x.h"
eec96d1e2 Andrew F. Davis 2016-02-06 35
eec96d1e2 Andrew F. Davis 2016-02-06 36 #define AFE4403_DRIVER_NAME "afe4403"
eec96d1e2 Andrew F. Davis 2016-02-06 37
eec96d1e2 Andrew F. Davis 2016-02-06 38 /* AFE4403 Registers */
eec96d1e2 Andrew F. Davis 2016-02-06 39 #define AFE4403_TIAGAIN 0x20
eec96d1e2 Andrew F. Davis 2016-02-06 40 #define AFE4403_TIA_AMB_GAIN 0x21
eec96d1e2 Andrew F. Davis 2016-02-06 41
b36e82576 Andrew F. Davis 2016-05-01 42 enum afe4403_fields {
b36e82576 Andrew F. Davis 2016-05-01 43 /* Gains */
b36e82576 Andrew F. Davis 2016-05-01 44 F_RF_LED1, F_CF_LED1,
b36e82576 Andrew F. Davis 2016-05-01 45 F_RF_LED, F_CF_LED,
b36e82576 Andrew F. Davis 2016-05-01 46
b36e82576 Andrew F. Davis 2016-05-01 47 /* LED Current */
b36e82576 Andrew F. Davis 2016-05-01 48 F_ILED1, F_ILED2,
b36e82576 Andrew F. Davis 2016-05-01 49
b36e82576 Andrew F. Davis 2016-05-01 50 /* sentinel */
b36e82576 Andrew F. Davis 2016-05-01 51 F_MAX_FIELDS
b36e82576 Andrew F. Davis 2016-05-01 52 };
b36e82576 Andrew F. Davis 2016-05-01 53
b36e82576 Andrew F. Davis 2016-05-01 54 static const struct reg_field afe4403_reg_fields[] = {
b36e82576 Andrew F. Davis 2016-05-01 55 /* Gains */
b36e82576 Andrew F. Davis 2016-05-01 56 [F_RF_LED1] = REG_FIELD(AFE4403_TIAGAIN, 0, 2),
b36e82576 Andrew F. Davis 2016-05-01 57 [F_CF_LED1] = REG_FIELD(AFE4403_TIAGAIN, 3, 7),
b36e82576 Andrew F. Davis 2016-05-01 58 [F_RF_LED] = REG_FIELD(AFE4403_TIA_AMB_GAIN, 0, 2),
b36e82576 Andrew F. Davis 2016-05-01 59 [F_CF_LED] = REG_FIELD(AFE4403_TIA_AMB_GAIN, 3, 7),
b36e82576 Andrew F. Davis 2016-05-01 60 /* LED Current */
b36e82576 Andrew F. Davis 2016-05-01 61 [F_ILED1] = REG_FIELD(AFE440X_LEDCNTRL, 0, 7),
b36e82576 Andrew F. Davis 2016-05-01 62 [F_ILED2] = REG_FIELD(AFE440X_LEDCNTRL, 8, 15),
b36e82576 Andrew F. Davis 2016-05-01 63 };
b36e82576 Andrew F. Davis 2016-05-01 64
eec96d1e2 Andrew F. Davis 2016-02-06 65 /**
f59e6b5ae Andrew F. Davis 2016-05-01 66 * struct afe4403_data - AFE4403 device instance data
f59e6b5ae Andrew F. Davis 2016-05-01 67 * @dev: Device structure
f59e6b5ae Andrew F. Davis 2016-05-01 68 * @spi: SPI device handle
f59e6b5ae Andrew F. Davis 2016-05-01 69 * @regmap: Register map of the device
b36e82576 Andrew F. Davis 2016-05-01 70 * @fields: Register fields of the device
f59e6b5ae Andrew F. Davis 2016-05-01 71 * @regulator: Pointer to the regulator for the IC
f59e6b5ae Andrew F. Davis 2016-05-01 72 * @trig: IIO trigger for this device
f59e6b5ae Andrew F. Davis 2016-05-01 73 * @irq: ADC_RDY line interrupt number
eec96d1e2 Andrew F. Davis 2016-02-06 74 */
eec96d1e2 Andrew F. Davis 2016-02-06 75 struct afe4403_data {
eec96d1e2 Andrew F. Davis 2016-02-06 76 struct device *dev;
eec96d1e2 Andrew F. Davis 2016-02-06 77 struct spi_device *spi;
eec96d1e2 Andrew F. Davis 2016-02-06 78 struct regmap *regmap;
b36e82576 Andrew F. Davis 2016-05-01 79 struct regmap_field *fields[F_MAX_FIELDS];
eec96d1e2 Andrew F. Davis 2016-02-06 80 struct regulator *regulator;
eec96d1e2 Andrew F. Davis 2016-02-06 81 struct iio_trigger *trig;
eec96d1e2 Andrew F. Davis 2016-02-06 82 int irq;
eec96d1e2 Andrew F. Davis 2016-02-06 83 };
eec96d1e2 Andrew F. Davis 2016-02-06 84
eec96d1e2 Andrew F. Davis 2016-02-06 85 enum afe4403_chan_id {
24b9dea76 Andrew F. Davis 2016-05-01 86 LED2 = 1,
24b9dea76 Andrew F. Davis 2016-05-01 87 ALED2,
eec96d1e2 Andrew F. Davis 2016-02-06 88 LED1,
eec96d1e2 Andrew F. Davis 2016-02-06 89 ALED1,
eec96d1e2 Andrew F. Davis 2016-02-06 90 LED2_ALED2,
24b9dea76 Andrew F. Davis 2016-05-01 91 LED1_ALED1,
eec96d1e2 Andrew F. Davis 2016-02-06 92 };
eec96d1e2 Andrew F. Davis 2016-02-06 93
b36e82576 Andrew F. Davis 2016-05-01 94 static const unsigned int afe4403_channel_values[] = {
b36e82576 Andrew F. Davis 2016-05-01 95 [LED2] = AFE440X_LED2VAL,
b36e82576 Andrew F. Davis 2016-05-01 96 [ALED2] = AFE440X_ALED2VAL,
b36e82576 Andrew F. Davis 2016-05-01 97 [LED1] = AFE440X_LED1VAL,
b36e82576 Andrew F. Davis 2016-05-01 98 [ALED1] = AFE440X_ALED1VAL,
b36e82576 Andrew F. Davis 2016-05-01 99 [LED2_ALED2] = AFE440X_LED2_ALED2VAL,
b36e82576 Andrew F. Davis 2016-05-01 100 [LED1_ALED1] = AFE440X_LED1_ALED1VAL,
b36e82576 Andrew F. Davis 2016-05-01 101 };
b36e82576 Andrew F. Davis 2016-05-01 102
b36e82576 Andrew F. Davis 2016-05-01 103 static const unsigned int afe4403_channel_leds[] = {
3ff34ee2a Andrew F. Davis 2016-05-01 104 [LED2] = F_ILED2,
3ff34ee2a Andrew F. Davis 2016-05-01 105 [LED1] = F_ILED1,
eec96d1e2 Andrew F. Davis 2016-02-06 106 };
eec96d1e2 Andrew F. Davis 2016-02-06 107
eec96d1e2 Andrew F. Davis 2016-02-06 108 static const struct iio_chan_spec afe4403_channels[] = {
eec96d1e2 Andrew F. Davis 2016-02-06 109 /* ADC values */
24b9dea76 Andrew F. Davis 2016-05-01 @110 AFE440X_INTENSITY_CHAN(LED2, 0),
24b9dea76 Andrew F. Davis 2016-05-01 111 AFE440X_INTENSITY_CHAN(ALED2, 0),
24b9dea76 Andrew F. Davis 2016-05-01 112 AFE440X_INTENSITY_CHAN(LED1, 0),
24b9dea76 Andrew F. Davis 2016-05-01 113 AFE440X_INTENSITY_CHAN(ALED1, 0),
24b9dea76 Andrew F. Davis 2016-05-01 114 AFE440X_INTENSITY_CHAN(LED2_ALED2, 0),
24b9dea76 Andrew F. Davis 2016-05-01 115 AFE440X_INTENSITY_CHAN(LED1_ALED1, 0),
eec96d1e2 Andrew F. Davis 2016-02-06 116 /* LED current */
3ff34ee2a Andrew F. Davis 2016-05-01 117 AFE440X_CURRENT_CHAN(LED2),
3ff34ee2a Andrew F. Davis 2016-05-01 118 AFE440X_CURRENT_CHAN(LED1),
eec96d1e2 Andrew F. Davis 2016-02-06 119 };
eec96d1e2 Andrew F. Davis 2016-02-06 120
eec96d1e2 Andrew F. Davis 2016-02-06 121 static const struct afe440x_val_table afe4403_res_table[] = {
eec96d1e2 Andrew F. Davis 2016-02-06 122 { 500000 }, { 250000 }, { 100000 }, { 50000 },
eec96d1e2 Andrew F. Davis 2016-02-06 123 { 25000 }, { 10000 }, { 1000000 }, { 0 },
eec96d1e2 Andrew F. Davis 2016-02-06 124 };
1276187c5 Andrew F. Davis 2016-05-01 125 AFE440X_TABLE_ATTR(in_intensity_resistance_available, afe4403_res_table);
eec96d1e2 Andrew F. Davis 2016-02-06 126
eec96d1e2 Andrew F. Davis 2016-02-06 127 static const struct afe440x_val_table afe4403_cap_table[] = {
eec96d1e2 Andrew F. Davis 2016-02-06 128 { 0, 5000 }, { 0, 10000 }, { 0, 20000 }, { 0, 25000 },
eec96d1e2 Andrew F. Davis 2016-02-06 129 { 0, 30000 }, { 0, 35000 }, { 0, 45000 }, { 0, 50000 },
eec96d1e2 Andrew F. Davis 2016-02-06 130 { 0, 55000 }, { 0, 60000 }, { 0, 70000 }, { 0, 75000 },
eec96d1e2 Andrew F. Davis 2016-02-06 131 { 0, 80000 }, { 0, 85000 }, { 0, 95000 }, { 0, 100000 },
eec96d1e2 Andrew F. Davis 2016-02-06 132 { 0, 155000 }, { 0, 160000 }, { 0, 170000 }, { 0, 175000 },
eec96d1e2 Andrew F. Davis 2016-02-06 133 { 0, 180000 }, { 0, 185000 }, { 0, 195000 }, { 0, 200000 },
eec96d1e2 Andrew F. Davis 2016-02-06 134 { 0, 205000 }, { 0, 210000 }, { 0, 220000 }, { 0, 225000 },
eec96d1e2 Andrew F. Davis 2016-02-06 135 { 0, 230000 }, { 0, 235000 }, { 0, 245000 }, { 0, 250000 },
eec96d1e2 Andrew F. Davis 2016-02-06 136 };
1276187c5 Andrew F. Davis 2016-05-01 137 AFE440X_TABLE_ATTR(in_intensity_capacitance_available, afe4403_cap_table);
eec96d1e2 Andrew F. Davis 2016-02-06 138
eec96d1e2 Andrew F. Davis 2016-02-06 139 static ssize_t afe440x_show_register(struct device *dev,
eec96d1e2 Andrew F. Davis 2016-02-06 140 struct device_attribute *attr,
eec96d1e2 Andrew F. Davis 2016-02-06 141 char *buf)
eec96d1e2 Andrew F. Davis 2016-02-06 142 {
eec96d1e2 Andrew F. Davis 2016-02-06 143 struct iio_dev *indio_dev = dev_to_iio_dev(dev);
eec96d1e2 Andrew F. Davis 2016-02-06 144 struct afe4403_data *afe = iio_priv(indio_dev);
eec96d1e2 Andrew F. Davis 2016-02-06 145 struct afe440x_attr *afe440x_attr = to_afe440x_attr(attr);
81f517270 Andrew F. Davis 2016-05-01 146 unsigned int reg_val;
eec96d1e2 Andrew F. Davis 2016-02-06 147 int vals[2];
81f517270 Andrew F. Davis 2016-05-01 148 int ret;
eec96d1e2 Andrew F. Davis 2016-02-06 149
b36e82576 Andrew F. Davis 2016-05-01 150 ret = regmap_field_read(afe->fields[afe440x_attr->field], &reg_val);
eec96d1e2 Andrew F. Davis 2016-02-06 151 if (ret)
eec96d1e2 Andrew F. Davis 2016-02-06 152 return ret;
eec96d1e2 Andrew F. Davis 2016-02-06 153
81f517270 Andrew F. Davis 2016-05-01 154 if (reg_val >= afe440x_attr->table_size)
81f517270 Andrew F. Davis 2016-05-01 155 return -EINVAL;
81f517270 Andrew F. Davis 2016-05-01 156
eec96d1e2 Andrew F. Davis 2016-02-06 157 vals[0] = afe440x_attr->val_table[reg_val].integer;
eec96d1e2 Andrew F. Davis 2016-02-06 158 vals[1] = afe440x_attr->val_table[reg_val].fract;
eec96d1e2 Andrew F. Davis 2016-02-06 159
81f517270 Andrew F. Davis 2016-05-01 160 return iio_format_value(buf, IIO_VAL_INT_PLUS_MICRO, 2, vals);
eec96d1e2 Andrew F. Davis 2016-02-06 161 }
eec96d1e2 Andrew F. Davis 2016-02-06 162
eec96d1e2 Andrew F. Davis 2016-02-06 163 static ssize_t afe440x_store_register(struct device *dev,
eec96d1e2 Andrew F. Davis 2016-02-06 164 struct device_attribute *attr,
eec96d1e2 Andrew F. Davis 2016-02-06 165 const char *buf, size_t count)
eec96d1e2 Andrew F. Davis 2016-02-06 166 {
eec96d1e2 Andrew F. Davis 2016-02-06 167 struct iio_dev *indio_dev = dev_to_iio_dev(dev);
eec96d1e2 Andrew F. Davis 2016-02-06 168 struct afe4403_data *afe = iio_priv(indio_dev);
eec96d1e2 Andrew F. Davis 2016-02-06 169 struct afe440x_attr *afe440x_attr = to_afe440x_attr(attr);
eec96d1e2 Andrew F. Davis 2016-02-06 170 int val, integer, fract, ret;
eec96d1e2 Andrew F. Davis 2016-02-06 171
eec96d1e2 Andrew F. Davis 2016-02-06 172 ret = iio_str_to_fixpoint(buf, 100000, &integer, &fract);
eec96d1e2 Andrew F. Davis 2016-02-06 173 if (ret)
eec96d1e2 Andrew F. Davis 2016-02-06 174 return ret;
eec96d1e2 Andrew F. Davis 2016-02-06 175
eec96d1e2 Andrew F. Davis 2016-02-06 176 for (val = 0; val < afe440x_attr->table_size; val++)
eec96d1e2 Andrew F. Davis 2016-02-06 177 if (afe440x_attr->val_table[val].integer == integer &&
eec96d1e2 Andrew F. Davis 2016-02-06 178 afe440x_attr->val_table[val].fract == fract)
eec96d1e2 Andrew F. Davis 2016-02-06 179 break;
eec96d1e2 Andrew F. Davis 2016-02-06 180 if (val == afe440x_attr->table_size)
eec96d1e2 Andrew F. Davis 2016-02-06 181 return -EINVAL;
eec96d1e2 Andrew F. Davis 2016-02-06 182
b36e82576 Andrew F. Davis 2016-05-01 183 ret = regmap_field_write(afe->fields[afe440x_attr->field], val);
eec96d1e2 Andrew F. Davis 2016-02-06 184 if (ret)
eec96d1e2 Andrew F. Davis 2016-02-06 185 return ret;
eec96d1e2 Andrew F. Davis 2016-02-06 186
eec96d1e2 Andrew F. Davis 2016-02-06 187 return count;
eec96d1e2 Andrew F. Davis 2016-02-06 188 }
eec96d1e2 Andrew F. Davis 2016-02-06 189
1276187c5 Andrew F. Davis 2016-05-01 190 static AFE440X_ATTR(in_intensity1_resistance, F_RF_LED, afe4403_res_table);
1276187c5 Andrew F. Davis 2016-05-01 191 static AFE440X_ATTR(in_intensity1_capacitance, F_CF_LED, afe4403_cap_table);
eec96d1e2 Andrew F. Davis 2016-02-06 192
1276187c5 Andrew F. Davis 2016-05-01 193 static AFE440X_ATTR(in_intensity2_resistance, F_RF_LED, afe4403_res_table);
1276187c5 Andrew F. Davis 2016-05-01 194 static AFE440X_ATTR(in_intensity2_capacitance, F_CF_LED, afe4403_cap_table);
1276187c5 Andrew F. Davis 2016-05-01 195
1276187c5 Andrew F. Davis 2016-05-01 196 static AFE440X_ATTR(in_intensity3_resistance, F_RF_LED1, afe4403_res_table);
1276187c5 Andrew F. Davis 2016-05-01 197 static AFE440X_ATTR(in_intensity3_capacitance, F_CF_LED1, afe4403_cap_table);
1276187c5 Andrew F. Davis 2016-05-01 198
1276187c5 Andrew F. Davis 2016-05-01 199 static AFE440X_ATTR(in_intensity4_resistance, F_RF_LED1, afe4403_res_table);
1276187c5 Andrew F. Davis 2016-05-01 @200 static AFE440X_ATTR(in_intensity4_capacitance, F_CF_LED1, afe4403_cap_table);
eec96d1e2 Andrew F. Davis 2016-02-06 201
eec96d1e2 Andrew F. Davis 2016-02-06 202 static struct attribute *afe440x_attributes[] = {
1276187c5 Andrew F. Davis 2016-05-01 @203 &dev_attr_in_intensity_resistance_available.attr,
1276187c5 Andrew F. Davis 2016-05-01 @204 &dev_attr_in_intensity_capacitance_available.attr,
1276187c5 Andrew F. Davis 2016-05-01 @205 &afe440x_attr_in_intensity1_resistance.dev_attr.attr,
1276187c5 Andrew F. Davis 2016-05-01 206 &afe440x_attr_in_intensity1_capacitance.dev_attr.attr,
1276187c5 Andrew F. Davis 2016-05-01 207 &afe440x_attr_in_intensity2_resistance.dev_attr.attr,
1276187c5 Andrew F. Davis 2016-05-01 208 &afe440x_attr_in_intensity2_capacitance.dev_attr.attr,

:::::: The code at line 205 was first introduced by commit
:::::: 1276187c5261217aa9cc23ec153e0e903181c16b iio: health/afe440x: Make gain settings a modifier for the stages

:::::: TO: Andrew F. Davis <[email protected]>
:::::: CC: Jonathan Cameron <[email protected]>

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation


Attachments:
(No filename) (36.37 kB)
.config.gz (47.99 kB)
Download all attachments

2017-04-02 05:23:13

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH 1/3] iio: health: afe440x: Remove code in comments

Hi simran,

[auto build test WARNING on iio/togreg]
[also build test WARNING on v4.11-rc4 next-20170331]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url: https://github.com/0day-ci/linux/commits/simran-singhal/iio-health-Clean-up/20170402-095718
base: https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git togreg
reproduce:
# apt-get install sparse
make ARCH=x86_64 allmodconfig
make C=1 CF=-D__CHECK_ENDIAN__


sparse warnings: (new ones prefixed by >>)

include/linux/compiler.h:264:8: sparse: attribute 'no_sanitize_address': unknown attribute
drivers/iio/health/afe440x.h:98:1: sparse: Expected ; at end of declaration
drivers/iio/health/afe440x.h:98:1: sparse: got struct
drivers/iio/health/afe440x.h:103:1: sparse: Expected ; at the end of type declaration
drivers/iio/health/afe440x.h:103:1: sparse: got }
drivers/iio/health/afe440x.h:96:8: sparse: undefined identifier '_name_show'
drivers/iio/health/afe4403.c:110:9: sparse: undefined identifier 'AFE440X_INTENSITY_CHAN'
>> drivers/iio/health/afe4403.c:110:31: sparse: not a function <noident>
drivers/iio/health/afe4403.c:111:9: sparse: undefined identifier 'AFE440X_INTENSITY_CHAN'
drivers/iio/health/afe4403.c:112:9: sparse: undefined identifier 'AFE440X_INTENSITY_CHAN'
drivers/iio/health/afe4403.c:113:9: sparse: undefined identifier 'AFE440X_INTENSITY_CHAN'
drivers/iio/health/afe4403.c:114:9: sparse: undefined identifier 'AFE440X_INTENSITY_CHAN'
drivers/iio/health/afe4403.c:115:9: sparse: undefined identifier 'AFE440X_INTENSITY_CHAN'
drivers/iio/health/afe4403.c:115:31: sparse: not a function <noident>
drivers/iio/health/afe4403.c:117:9: sparse: undefined identifier 'AFE440X_CURRENT_CHAN'
drivers/iio/health/afe4403.c:118:9: sparse: undefined identifier 'AFE440X_CURRENT_CHAN'
drivers/iio/health/afe4403.c:145:45: sparse: undefined identifier 'to_afe440x_attr'
drivers/iio/health/afe4403.c:150:57: sparse: using member 'field' in incomplete struct afe440x_attr
drivers/iio/health/afe4403.c:154:36: sparse: using member 'table_size' in incomplete struct afe440x_attr
drivers/iio/health/afe4403.c:157:31: sparse: using member 'val_table' in incomplete struct afe440x_attr
drivers/iio/health/afe4403.c:158:31: sparse: using member 'val_table' in incomplete struct afe440x_attr
drivers/iio/health/afe4403.c:169:45: sparse: undefined identifier 'to_afe440x_attr'
drivers/iio/health/afe4403.c:176:41: sparse: using member 'table_size' in incomplete struct afe440x_attr
drivers/iio/health/afe4403.c:177:33: sparse: using member 'val_table' in incomplete struct afe440x_attr
drivers/iio/health/afe4403.c:180:32: sparse: using member 'table_size' in incomplete struct afe440x_attr
drivers/iio/health/afe4403.c:183:15: sparse: using member 'field' in incomplete struct afe440x_attr
drivers/iio/health/afe4403.c:203:10: sparse: undefined identifier 'dev_attr_in_intensity_resistance_available'
drivers/iio/health/afe4403.c:204:10: sparse: undefined identifier 'dev_attr_in_intensity_capacitance_available'
drivers/iio/health/afe4403.c:205:10: sparse: undefined identifier 'afe440x_attr_in_intensity1_resistance'
drivers/iio/health/afe4403.c:206:10: sparse: undefined identifier 'afe440x_attr_in_intensity1_capacitance'
drivers/iio/health/afe4403.c:207:10: sparse: undefined identifier 'afe440x_attr_in_intensity2_resistance'
drivers/iio/health/afe4403.c:208:10: sparse: undefined identifier 'afe440x_attr_in_intensity2_capacitance'
drivers/iio/health/afe4403.c:209:10: sparse: undefined identifier 'afe440x_attr_in_intensity3_resistance'
drivers/iio/health/afe4403.c:210:10: sparse: undefined identifier 'afe440x_attr_in_intensity3_capacitance'
drivers/iio/health/afe4403.c:211:10: sparse: undefined identifier 'afe440x_attr_in_intensity4_resistance'
drivers/iio/health/afe4403.c:212:10: sparse: undefined identifier 'afe440x_attr_in_intensity4_capacitance'
In file included from include/linux/kobject.h:21:0,
from include/linux/device.h:17,
from drivers/iio/health/afe4403.c:17:
drivers/iio/health/afe440x.h:96:23: error: '_name_show' undeclared here (not in a function)
static DEVICE_ATTR_RO(_name)
^
include/linux/sysfs.h:116:10: note: in definition of macro '__ATTR_RO'
.show = _name##_show, \
^~~~~
drivers/iio/health/afe440x.h:96:8: note: in expansion of macro 'DEVICE_ATTR_RO'
static DEVICE_ATTR_RO(_name)
^~~~~~~~~~~~~~
In file included from drivers/iio/health/afe4403.c:34:0:
drivers/iio/health/afe440x.h:98:1: error: expected ',' or ';' before 'struct'
struct afe440x_attr {
^~~~~~
drivers/iio/health/afe4403.c:110:2: error: implicit declaration of function 'AFE440X_INTENSITY_CHAN' [-Werror=implicit-function-declaration]
AFE440X_INTENSITY_CHAN(LED2, 0),
^~~~~~~~~~~~~~~~~~~~~~
drivers/iio/health/afe4403.c:110:2: error: initializer element is not constant
drivers/iio/health/afe4403.c:110:2: note: (near initialization for 'afe4403_channels[0].type')
drivers/iio/health/afe4403.c:111:2: error: initializer element is not constant
AFE440X_INTENSITY_CHAN(ALED2, 0),
^~~~~~~~~~~~~~~~~~~~~~
drivers/iio/health/afe4403.c:111:2: note: (near initialization for 'afe4403_channels[0].channel')
drivers/iio/health/afe4403.c:112:2: error: initializer element is not constant
AFE440X_INTENSITY_CHAN(LED1, 0),
^~~~~~~~~~~~~~~~~~~~~~
drivers/iio/health/afe4403.c:112:2: note: (near initialization for 'afe4403_channels[0].channel2')
drivers/iio/health/afe4403.c:113:2: error: initializer element is not constant
AFE440X_INTENSITY_CHAN(ALED1, 0),
^~~~~~~~~~~~~~~~~~~~~~
drivers/iio/health/afe4403.c:113:2: note: (near initialization for 'afe4403_channels[0].address')
drivers/iio/health/afe4403.c:114:2: error: initializer element is not constant
AFE440X_INTENSITY_CHAN(LED2_ALED2, 0),
^~~~~~~~~~~~~~~~~~~~~~
drivers/iio/health/afe4403.c:114:2: note: (near initialization for 'afe4403_channels[0].scan_index')
drivers/iio/health/afe4403.c:115:2: error: initializer element is not constant
AFE440X_INTENSITY_CHAN(LED1_ALED1, 0),
^~~~~~~~~~~~~~~~~~~~~~
drivers/iio/health/afe4403.c:115:2: note: (near initialization for 'afe4403_channels[0].scan_type.sign')
drivers/iio/health/afe4403.c:117:2: error: implicit declaration of function 'AFE440X_CURRENT_CHAN' [-Werror=implicit-function-declaration]
AFE440X_CURRENT_CHAN(LED2),
^~~~~~~~~~~~~~~~~~~~
drivers/iio/health/afe4403.c:117:2: error: initializer element is not constant
drivers/iio/health/afe4403.c:117:2: note: (near initialization for 'afe4403_channels[0].scan_type.realbits')
drivers/iio/health/afe4403.c:118:2: error: initializer element is not constant
AFE440X_CURRENT_CHAN(LED1),
^~~~~~~~~~~~~~~~~~~~
drivers/iio/health/afe4403.c:118:2: note: (near initialization for 'afe4403_channels[0].scan_type.storagebits')
drivers/iio/health/afe4403.c:125:1: warning: data definition has no type or storage class
AFE440X_TABLE_ATTR(in_intensity_resistance_available, afe4403_res_table);
^~~~~~~~~~~~~~~~~~
drivers/iio/health/afe4403.c:125:1: error: type defaults to 'int' in declaration of 'AFE440X_TABLE_ATTR' [-Werror=implicit-int]
drivers/iio/health/afe4403.c:125:1: warning: parameter names (without types) in function declaration
drivers/iio/health/afe4403.c:137:1: warning: data definition has no type or storage class
AFE440X_TABLE_ATTR(in_intensity_capacitance_available, afe4403_cap_table);
^~~~~~~~~~~~~~~~~~
drivers/iio/health/afe4403.c:137:1: error: type defaults to 'int' in declaration of 'AFE440X_TABLE_ATTR' [-Werror=implicit-int]
drivers/iio/health/afe4403.c:137:1: warning: parameter names (without types) in function declaration
drivers/iio/health/afe4403.c: In function 'afe440x_show_register':
drivers/iio/health/afe4403.c:145:38: error: implicit declaration of function 'to_afe440x_attr' [-Werror=implicit-function-declaration]
struct afe440x_attr *afe440x_attr = to_afe440x_attr(attr);
^~~~~~~~~~~~~~~
drivers/iio/health/afe4403.c:145:38: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
drivers/iio/health/afe4403.c:150:50: error: dereferencing pointer to incomplete type 'struct afe440x_attr'
ret = regmap_field_read(afe->fields[afe440x_attr->field], &reg_val);
^~
drivers/iio/health/afe4403.c:150:50: error: request for member 'field' in something not a structure or union
drivers/iio/health/afe4403.c:150:37: error: array subscript is not an integer
ret = regmap_field_read(afe->fields[afe440x_attr->field], &reg_val);
^
--
include/linux/compiler.h:264:8: sparse: attribute 'no_sanitize_address': unknown attribute
drivers/iio/health/afe440x.h:98:1: sparse: Expected ; at end of declaration
drivers/iio/health/afe440x.h:98:1: sparse: got struct
drivers/iio/health/afe440x.h:103:1: sparse: Expected ; at the end of type declaration
drivers/iio/health/afe440x.h:103:1: sparse: got }
drivers/iio/health/afe440x.h:96:8: sparse: undefined identifier '_name_show'
drivers/iio/health/afe4404.c:137:9: sparse: undefined identifier 'AFE440X_INTENSITY_CHAN'
>> drivers/iio/health/afe4404.c:137:31: sparse: not a function <noident>
drivers/iio/health/afe4404.c:138:9: sparse: undefined identifier 'AFE440X_INTENSITY_CHAN'
drivers/iio/health/afe4404.c:139:9: sparse: undefined identifier 'AFE440X_INTENSITY_CHAN'
drivers/iio/health/afe4404.c:140:9: sparse: undefined identifier 'AFE440X_INTENSITY_CHAN'
drivers/iio/health/afe4404.c:141:9: sparse: undefined identifier 'AFE440X_INTENSITY_CHAN'
drivers/iio/health/afe4404.c:142:9: sparse: undefined identifier 'AFE440X_INTENSITY_CHAN'
drivers/iio/health/afe4404.c:142:31: sparse: not a function <noident>
drivers/iio/health/afe4404.c:144:9: sparse: undefined identifier 'AFE440X_CURRENT_CHAN'
drivers/iio/health/afe4404.c:145:9: sparse: undefined identifier 'AFE440X_CURRENT_CHAN'
drivers/iio/health/afe4404.c:146:9: sparse: undefined identifier 'AFE440X_CURRENT_CHAN'
drivers/iio/health/afe4404.c:179:45: sparse: undefined identifier 'to_afe440x_attr'
drivers/iio/health/afe4404.c:184:57: sparse: using member 'field' in incomplete struct afe440x_attr
drivers/iio/health/afe4404.c:188:36: sparse: using member 'table_size' in incomplete struct afe440x_attr
drivers/iio/health/afe4404.c:191:31: sparse: using member 'val_table' in incomplete struct afe440x_attr
drivers/iio/health/afe4404.c:192:31: sparse: using member 'val_table' in incomplete struct afe440x_attr
drivers/iio/health/afe4404.c:203:45: sparse: undefined identifier 'to_afe440x_attr'
drivers/iio/health/afe4404.c:210:41: sparse: using member 'table_size' in incomplete struct afe440x_attr
drivers/iio/health/afe4404.c:211:33: sparse: using member 'val_table' in incomplete struct afe440x_attr
drivers/iio/health/afe4404.c:214:32: sparse: using member 'table_size' in incomplete struct afe440x_attr
drivers/iio/health/afe4404.c:217:15: sparse: using member 'field' in incomplete struct afe440x_attr
drivers/iio/health/afe4404.c:237:10: sparse: undefined identifier 'dev_attr_in_intensity_resistance_available'
drivers/iio/health/afe4404.c:238:10: sparse: undefined identifier 'dev_attr_in_intensity_capacitance_available'
drivers/iio/health/afe4404.c:239:10: sparse: undefined identifier 'afe440x_attr_in_intensity1_resistance'
drivers/iio/health/afe4404.c:240:10: sparse: undefined identifier 'afe440x_attr_in_intensity1_capacitance'
drivers/iio/health/afe4404.c:241:10: sparse: undefined identifier 'afe440x_attr_in_intensity2_resistance'
drivers/iio/health/afe4404.c:242:10: sparse: undefined identifier 'afe440x_attr_in_intensity2_capacitance'
drivers/iio/health/afe4404.c:243:10: sparse: undefined identifier 'afe440x_attr_in_intensity3_resistance'
drivers/iio/health/afe4404.c:244:10: sparse: undefined identifier 'afe440x_attr_in_intensity3_capacitance'
drivers/iio/health/afe4404.c:245:10: sparse: undefined identifier 'afe440x_attr_in_intensity4_resistance'
drivers/iio/health/afe4404.c:246:10: sparse: undefined identifier 'afe440x_attr_in_intensity4_capacitance'
In file included from include/linux/kobject.h:21:0,
from include/linux/device.h:17,
from drivers/iio/health/afe4404.c:17:
drivers/iio/health/afe440x.h:96:23: error: '_name_show' undeclared here (not in a function)
static DEVICE_ATTR_RO(_name)
^
include/linux/sysfs.h:116:10: note: in definition of macro '__ATTR_RO'
.show = _name##_show, \
^~~~~
drivers/iio/health/afe440x.h:96:8: note: in expansion of macro 'DEVICE_ATTR_RO'
static DEVICE_ATTR_RO(_name)
^~~~~~~~~~~~~~
In file included from drivers/iio/health/afe4404.c:34:0:
drivers/iio/health/afe440x.h:98:1: error: expected ',' or ';' before 'struct'
struct afe440x_attr {
^~~~~~
drivers/iio/health/afe4404.c:137:2: error: implicit declaration of function 'AFE440X_INTENSITY_CHAN' [-Werror=implicit-function-declaration]
AFE440X_INTENSITY_CHAN(LED2, BIT(IIO_CHAN_INFO_OFFSET)),
^~~~~~~~~~~~~~~~~~~~~~
drivers/iio/health/afe4404.c:137:2: error: initializer element is not constant
drivers/iio/health/afe4404.c:137:2: note: (near initialization for 'afe4404_channels[0].type')
drivers/iio/health/afe4404.c:138:2: error: initializer element is not constant
AFE440X_INTENSITY_CHAN(ALED2, BIT(IIO_CHAN_INFO_OFFSET)),
^~~~~~~~~~~~~~~~~~~~~~
drivers/iio/health/afe4404.c:138:2: note: (near initialization for 'afe4404_channels[0].channel')
drivers/iio/health/afe4404.c:139:2: error: initializer element is not constant
AFE440X_INTENSITY_CHAN(LED1, BIT(IIO_CHAN_INFO_OFFSET)),
^~~~~~~~~~~~~~~~~~~~~~
drivers/iio/health/afe4404.c:139:2: note: (near initialization for 'afe4404_channels[0].channel2')
drivers/iio/health/afe4404.c:140:2: error: initializer element is not constant
AFE440X_INTENSITY_CHAN(ALED1, BIT(IIO_CHAN_INFO_OFFSET)),
^~~~~~~~~~~~~~~~~~~~~~
drivers/iio/health/afe4404.c:140:2: note: (near initialization for 'afe4404_channels[0].address')
drivers/iio/health/afe4404.c:141:2: error: initializer element is not constant
AFE440X_INTENSITY_CHAN(LED2_ALED2, 0),
^~~~~~~~~~~~~~~~~~~~~~
drivers/iio/health/afe4404.c:141:2: note: (near initialization for 'afe4404_channels[0].scan_index')
drivers/iio/health/afe4404.c:142:2: error: initializer element is not constant
AFE440X_INTENSITY_CHAN(LED1_ALED1, 0),
^~~~~~~~~~~~~~~~~~~~~~
drivers/iio/health/afe4404.c:142:2: note: (near initialization for 'afe4404_channels[0].scan_type.sign')
drivers/iio/health/afe4404.c:144:2: error: implicit declaration of function 'AFE440X_CURRENT_CHAN' [-Werror=implicit-function-declaration]
AFE440X_CURRENT_CHAN(LED2),
^~~~~~~~~~~~~~~~~~~~
drivers/iio/health/afe4404.c:144:2: error: initializer element is not constant
drivers/iio/health/afe4404.c:144:2: note: (near initialization for 'afe4404_channels[0].scan_type.realbits')
drivers/iio/health/afe4404.c:145:2: error: initializer element is not constant
AFE440X_CURRENT_CHAN(ALED2),
^~~~~~~~~~~~~~~~~~~~
drivers/iio/health/afe4404.c:145:2: note: (near initialization for 'afe4404_channels[0].scan_type.storagebits')
drivers/iio/health/afe4404.c:146:2: error: initializer element is not constant
AFE440X_CURRENT_CHAN(LED1),
^~~~~~~~~~~~~~~~~~~~
drivers/iio/health/afe4404.c:146:2: note: (near initialization for 'afe4404_channels[0].scan_type.shift')
drivers/iio/health/afe4404.c:159:1: warning: data definition has no type or storage class
AFE440X_TABLE_ATTR(in_intensity_resistance_available, afe4404_res_table);
^~~~~~~~~~~~~~~~~~
drivers/iio/health/afe4404.c:159:1: error: type defaults to 'int' in declaration of 'AFE440X_TABLE_ATTR' [-Werror=implicit-int]
drivers/iio/health/afe4404.c:159:1: warning: parameter names (without types) in function declaration
drivers/iio/health/afe4404.c:171:1: warning: data definition has no type or storage class
AFE440X_TABLE_ATTR(in_intensity_capacitance_available, afe4404_cap_table);
^~~~~~~~~~~~~~~~~~
drivers/iio/health/afe4404.c:171:1: error: type defaults to 'int' in declaration of 'AFE440X_TABLE_ATTR' [-Werror=implicit-int]
drivers/iio/health/afe4404.c:171:1: warning: parameter names (without types) in function declaration
drivers/iio/health/afe4404.c: In function 'afe440x_show_register':
drivers/iio/health/afe4404.c:179:38: error: implicit declaration of function 'to_afe440x_attr' [-Werror=implicit-function-declaration]
struct afe440x_attr *afe440x_attr = to_afe440x_attr(attr);
^~~~~~~~~~~~~~~
drivers/iio/health/afe4404.c:179:38: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
drivers/iio/health/afe4404.c:184:50: error: dereferencing pointer to incomplete type 'struct afe440x_attr'
ret = regmap_field_read(afe->fields[afe440x_attr->field], &reg_val);

vim +110 drivers/iio/health/afe4403.c

b36e8257 Andrew F. Davis 2016-05-01 94 static const unsigned int afe4403_channel_values[] = {
b36e8257 Andrew F. Davis 2016-05-01 95 [LED2] = AFE440X_LED2VAL,
b36e8257 Andrew F. Davis 2016-05-01 96 [ALED2] = AFE440X_ALED2VAL,
b36e8257 Andrew F. Davis 2016-05-01 97 [LED1] = AFE440X_LED1VAL,
b36e8257 Andrew F. Davis 2016-05-01 98 [ALED1] = AFE440X_ALED1VAL,
b36e8257 Andrew F. Davis 2016-05-01 99 [LED2_ALED2] = AFE440X_LED2_ALED2VAL,
b36e8257 Andrew F. Davis 2016-05-01 100 [LED1_ALED1] = AFE440X_LED1_ALED1VAL,
b36e8257 Andrew F. Davis 2016-05-01 101 };
b36e8257 Andrew F. Davis 2016-05-01 102
b36e8257 Andrew F. Davis 2016-05-01 103 static const unsigned int afe4403_channel_leds[] = {
3ff34ee2 Andrew F. Davis 2016-05-01 104 [LED2] = F_ILED2,
3ff34ee2 Andrew F. Davis 2016-05-01 105 [LED1] = F_ILED1,
eec96d1e Andrew F. Davis 2016-02-06 106 };
eec96d1e Andrew F. Davis 2016-02-06 107
eec96d1e Andrew F. Davis 2016-02-06 108 static const struct iio_chan_spec afe4403_channels[] = {
eec96d1e Andrew F. Davis 2016-02-06 109 /* ADC values */
24b9dea7 Andrew F. Davis 2016-05-01 @110 AFE440X_INTENSITY_CHAN(LED2, 0),
24b9dea7 Andrew F. Davis 2016-05-01 111 AFE440X_INTENSITY_CHAN(ALED2, 0),
24b9dea7 Andrew F. Davis 2016-05-01 112 AFE440X_INTENSITY_CHAN(LED1, 0),
24b9dea7 Andrew F. Davis 2016-05-01 113 AFE440X_INTENSITY_CHAN(ALED1, 0),
24b9dea7 Andrew F. Davis 2016-05-01 114 AFE440X_INTENSITY_CHAN(LED2_ALED2, 0),
24b9dea7 Andrew F. Davis 2016-05-01 115 AFE440X_INTENSITY_CHAN(LED1_ALED1, 0),
eec96d1e Andrew F. Davis 2016-02-06 116 /* LED current */
3ff34ee2 Andrew F. Davis 2016-05-01 117 AFE440X_CURRENT_CHAN(LED2),
3ff34ee2 Andrew F. Davis 2016-05-01 118 AFE440X_CURRENT_CHAN(LED1),

:::::: The code at line 110 was first introduced by commit
:::::: 24b9dea764bdf0de8434fb4567e7f62038ba869e iio: health/afe440x: Remove channel names

:::::: TO: Andrew F. Davis <[email protected]>
:::::: CC: Jonathan Cameron <[email protected]>

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation