* [PATCH 1/7] iio staging: fix generic_buffer print2byte()
@ 2012-06-25 19:11 Peter Meerwald
2012-06-25 19:11 ` [PATCH 2/7] iio staging: remove unused variable Peter Meerwald
` (6 more replies)
0 siblings, 7 replies; 15+ messages in thread
From: Peter Meerwald @ 2012-06-25 19:11 UTC (permalink / raw)
To: linux-iio; +Cc: jic23, Peter Meerwald
drop extra argument, move cast
Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
---
drivers/staging/iio/Documentation/generic_buffer.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/staging/iio/Documentation/generic_buffer.c b/drivers/staging/iio/Documentation/generic_buffer.c
index bf55335..8d6e91c 100644
--- a/drivers/staging/iio/Documentation/generic_buffer.c
+++ b/drivers/staging/iio/Documentation/generic_buffer.c
@@ -72,8 +72,7 @@ void print2byte(int input, struct iio_channel_info *info)
val &= (1 << info->bits_used) - 1;
val = (int16_t)(val << (16 - info->bits_used)) >>
(16 - info->bits_used);
- printf("%05f ", val,
- (float)(val + info->offset)*info->scale);
+ printf("%05f ", ((float)val + info->offset)*info->scale);
} else {
uint16_t val = input;
val &= (1 << info->bits_used) - 1;
--
1.7.9.5
^ permalink raw reply related [flat|nested] 15+ messages in thread* [PATCH 2/7] iio staging: remove unused variable 2012-06-25 19:11 [PATCH 1/7] iio staging: fix generic_buffer print2byte() Peter Meerwald @ 2012-06-25 19:11 ` Peter Meerwald 2012-06-25 20:28 ` Jonathan Cameron 2012-06-25 19:11 ` [PATCH 3/7] iio staging: move comment Peter Meerwald ` (5 subsequent siblings) 6 siblings, 1 reply; 15+ messages in thread From: Peter Meerwald @ 2012-06-25 19:11 UTC (permalink / raw) To: linux-iio; +Cc: jic23 --- drivers/staging/iio/Documentation/generic_buffer.c | 2 -- drivers/staging/iio/Documentation/iio_utils.h | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/staging/iio/Documentation/generic_buffer.c b/drivers/staging/iio/Documentation/generic_buffer.c index 8d6e91c..81358ac 100644 --- a/drivers/staging/iio/Documentation/generic_buffer.c +++ b/drivers/staging/iio/Documentation/generic_buffer.c @@ -131,8 +131,6 @@ int main(int argc, char **argv) int ret, c, i, j, toread; - - FILE *fp_ev; int fp; int num_channels; diff --git a/drivers/staging/iio/Documentation/iio_utils.h b/drivers/staging/iio/Documentation/iio_utils.h index 6f3a392..6fe8540 100644 --- a/drivers/staging/iio/Documentation/iio_utils.h +++ b/drivers/staging/iio/Documentation/iio_utils.h @@ -280,7 +280,7 @@ inline int build_channel_array(const char *device_dir, { DIR *dp; FILE *sysfsfp; - int count, temp, i; + int count, i; struct iio_channel_info *current; int ret; const struct dirent *ent; -- 1.7.9.5 ^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [PATCH 2/7] iio staging: remove unused variable 2012-06-25 19:11 ` [PATCH 2/7] iio staging: remove unused variable Peter Meerwald @ 2012-06-25 20:28 ` Jonathan Cameron 0 siblings, 0 replies; 15+ messages in thread From: Jonathan Cameron @ 2012-06-25 20:28 UTC (permalink / raw) To: Peter Meerwald; +Cc: linux-iio, jic23 Missing sign off. Just got the same warnings testing the previous patch as you did so yup agreed with this one. Do remember to add your sign off Acked-by: Jonathan Cameron <jic23@kernel.org> > --- > drivers/staging/iio/Documentation/generic_buffer.c | 2 -- > drivers/staging/iio/Documentation/iio_utils.h | 2 +- > 2 files changed, 1 insertion(+), 3 deletions(-) > > diff --git a/drivers/staging/iio/Documentation/generic_buffer.c b/drivers/staging/iio/Documentation/generic_buffer.c > index 8d6e91c..81358ac 100644 > --- a/drivers/staging/iio/Documentation/generic_buffer.c > +++ b/drivers/staging/iio/Documentation/generic_buffer.c > @@ -131,8 +131,6 @@ int main(int argc, char **argv) > > > int ret, c, i, j, toread; > - > - FILE *fp_ev; > int fp; > > int num_channels; > diff --git a/drivers/staging/iio/Documentation/iio_utils.h b/drivers/staging/iio/Documentation/iio_utils.h > index 6f3a392..6fe8540 100644 > --- a/drivers/staging/iio/Documentation/iio_utils.h > +++ b/drivers/staging/iio/Documentation/iio_utils.h > @@ -280,7 +280,7 @@ inline int build_channel_array(const char *device_dir, > { > DIR *dp; > FILE *sysfsfp; > - int count, temp, i; > + int count, i; > struct iio_channel_info *current; > int ret; > const struct dirent *ent; > ^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH 3/7] iio staging: move comment 2012-06-25 19:11 [PATCH 1/7] iio staging: fix generic_buffer print2byte() Peter Meerwald 2012-06-25 19:11 ` [PATCH 2/7] iio staging: remove unused variable Peter Meerwald @ 2012-06-25 19:11 ` Peter Meerwald 2012-06-25 20:30 ` Jonathan Cameron 2012-06-25 19:11 ` [PATCH 4/7] iio staging: generic_buffer cleanup Peter Meerwald ` (4 subsequent siblings) 6 siblings, 1 reply; 15+ messages in thread From: Peter Meerwald @ 2012-06-25 19:11 UTC (permalink / raw) To: linux-iio; +Cc: jic23, Peter Meerwald Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net> --- drivers/staging/iio/Documentation/iio_utils.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/iio/Documentation/iio_utils.h b/drivers/staging/iio/Documentation/iio_utils.h index 6fe8540..d9439f8 100644 --- a/drivers/staging/iio/Documentation/iio_utils.h +++ b/drivers/staging/iio/Documentation/iio_utils.h @@ -7,7 +7,6 @@ * the Free Software Foundation. */ -/* Made up value to limit allocation sizes */ #include <string.h> #include <stdlib.h> #include <ctype.h> @@ -15,6 +14,7 @@ #include <stdint.h> #include <dirent.h> +/* Made up value to limit allocation sizes */ #define IIO_MAX_NAME_LENGTH 30 #define FORMAT_SCAN_ELEMENTS_DIR "%s/scan_elements" -- 1.7.9.5 ^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [PATCH 3/7] iio staging: move comment 2012-06-25 19:11 ` [PATCH 3/7] iio staging: move comment Peter Meerwald @ 2012-06-25 20:30 ` Jonathan Cameron 0 siblings, 0 replies; 15+ messages in thread From: Jonathan Cameron @ 2012-06-25 20:30 UTC (permalink / raw) To: Peter Meerwald; +Cc: linux-iio, jic23 On 06/25/2012 08:11 PM, Peter Meerwald wrote: > Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net> Acked-by: Jonathan Cameron <jic23@kernel.org> > --- > drivers/staging/iio/Documentation/iio_utils.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/staging/iio/Documentation/iio_utils.h b/drivers/staging/iio/Documentation/iio_utils.h > index 6fe8540..d9439f8 100644 > --- a/drivers/staging/iio/Documentation/iio_utils.h > +++ b/drivers/staging/iio/Documentation/iio_utils.h > @@ -7,7 +7,6 @@ > * the Free Software Foundation. > */ > > -/* Made up value to limit allocation sizes */ > #include <string.h> > #include <stdlib.h> > #include <ctype.h> > @@ -15,6 +14,7 @@ > #include <stdint.h> > #include <dirent.h> > > +/* Made up value to limit allocation sizes */ > #define IIO_MAX_NAME_LENGTH 30 > > #define FORMAT_SCAN_ELEMENTS_DIR "%s/scan_elements" > ^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH 4/7] iio staging: generic_buffer cleanup 2012-06-25 19:11 [PATCH 1/7] iio staging: fix generic_buffer print2byte() Peter Meerwald 2012-06-25 19:11 ` [PATCH 2/7] iio staging: remove unused variable Peter Meerwald 2012-06-25 19:11 ` [PATCH 3/7] iio staging: move comment Peter Meerwald @ 2012-06-25 19:11 ` Peter Meerwald 2012-06-25 20:33 ` Jonathan Cameron 2012-06-25 19:11 ` [PATCH 5/7] iio staging: fix warning 'static but used in inline function' Peter Meerwald ` (3 subsequent siblings) 6 siblings, 1 reply; 15+ messages in thread From: Peter Meerwald @ 2012-06-25 19:11 UTC (permalink / raw) To: linux-iio; +Cc: jic23, Peter Meerwald Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net> --- drivers/staging/iio/Documentation/generic_buffer.c | 58 ++++++++++---------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/drivers/staging/iio/Documentation/generic_buffer.c b/drivers/staging/iio/Documentation/generic_buffer.c index 81358ac..ab228b4 100644 --- a/drivers/staging/iio/Documentation/generic_buffer.c +++ b/drivers/staging/iio/Documentation/generic_buffer.c @@ -33,8 +33,8 @@ /** * size_from_channelarray() - calculate the storage size of a scan - * @channels: the channel info array - * @num_channels: size of the channel info array + * @channels: the channel info array + * @num_channels: number of channels * * Has the side effect of filling the channels[i].location values used * in processing the buffer output. @@ -58,14 +58,15 @@ int size_from_channelarray(struct iio_channel_info *channels, int num_channels) void print2byte(int input, struct iio_channel_info *info) { /* First swap if incorrect endian */ - if (info->be) input = be16toh((uint16_t)input); else input = le16toh((uint16_t)input); - /* shift before conversion to avoid sign extension - of left aligned data */ + /* + * Shift before conversion to avoid sign extension + * of left aligned data + */ input = input >> info->shift; if (info->is_signed) { int16_t val = input; @@ -82,39 +83,39 @@ void print2byte(int input, struct iio_channel_info *info) /** * process_scan() - print out the values in SI units * @data: pointer to the start of the scan - * @infoarray: information about the channels. Note + * @channels: information about the channels. Note * size_from_channelarray must have been called first to fill the * location offsets. - * @num_channels: the number of active channels + * @num_channels: number of channels **/ void process_scan(char *data, - struct iio_channel_info *infoarray, + struct iio_channel_info *channels, int num_channels) { int k; for (k = 0; k < num_channels; k++) - switch (infoarray[k].bytes) { + switch (channels[k].bytes) { /* only a few cases implemented so far */ case 2: - print2byte(*(uint16_t *)(data + infoarray[k].location), - &infoarray[k]); + print2byte(*(uint16_t *)(data + channels[k].location), + &channels[k]); break; case 8: - if (infoarray[k].is_signed) { + if (channels[k].is_signed) { int64_t val = *(int64_t *) (data + - infoarray[k].location); - if ((val >> infoarray[k].bits_used) & 1) - val = (val & infoarray[k].mask) | - ~infoarray[k].mask; + channels[k].location); + if ((val >> channels[k].bits_used) & 1) + val = (val & channels[k].mask) | + ~channels[k].mask; /* special case for timestamp */ - if (infoarray[k].scale == 1.0f && - infoarray[k].offset == 0.0f) + if (channels[k].scale == 1.0f && + channels[k].offset == 0.0f) printf(" %lld", val); else printf("%05f ", ((float)val + - infoarray[k].offset)* - infoarray[k].scale); + channels[k].offset)* + channels[k].scale); } break; default: @@ -129,7 +130,6 @@ int main(int argc, char **argv) unsigned long timedelay = 1000000; unsigned long buf_len = 128; - int ret, c, i, j, toread; int fp; @@ -146,7 +146,7 @@ int main(int argc, char **argv) int noevents = 0; char *dummy; - struct iio_channel_info *infoarray; + struct iio_channel_info *channels; while ((c = getopt(argc, argv, "l:w:c:et:n:")) != -1) { switch (c) { @@ -214,7 +214,7 @@ int main(int argc, char **argv) * Parse the files in scan_elements to identify what channels are * present */ - ret = build_channel_array(dev_dir_name, &infoarray, &num_channels); + ret = build_channel_array(dev_dir_name, &channels, &num_channels); if (ret) { printf("Problem reading scan element information\n"); printf("diag %s\n", dev_dir_name); @@ -233,7 +233,7 @@ int main(int argc, char **argv) goto error_free_triggername; } printf("%s %s\n", dev_dir_name, trigger_name); - /* Set the device trigger to be the data rdy trigger found above */ + /* Set the device trigger to be the data ready trigger found above */ ret = write_sysfs_string_and_verify("trigger/current_trigger", dev_dir_name, trigger_name); @@ -251,7 +251,7 @@ int main(int argc, char **argv) ret = write_sysfs_int("enable", buf_dir_name, 1); if (ret < 0) goto error_free_buf_dir_name; - scan_size = size_from_channelarray(infoarray, num_channels); + scan_size = size_from_channelarray(channels, num_channels); data = malloc(scan_size*buf_len); if (!data) { ret = -ENOMEM; @@ -266,7 +266,7 @@ int main(int argc, char **argv) /* Attempt to open non blocking the access dev */ fp = open(buffer_access, O_RDONLY | O_NONBLOCK); - if (fp == -1) { /*If it isn't there make the node */ + if (fp == -1) { /* If it isn't there make the node */ printf("Failed to open %s\n", buffer_access); ret = -errno; goto error_free_buffer_access; @@ -297,16 +297,16 @@ int main(int argc, char **argv) } for (i = 0; i < read_size/scan_size; i++) process_scan(data + scan_size*i, - infoarray, + channels, num_channels); } - /* Stop the ring buffer */ + /* Stop the buffer */ ret = write_sysfs_int("enable", buf_dir_name, 0); if (ret < 0) goto error_close_buffer_access; - /* Disconnect from the trigger - just write a dummy name.*/ + /* Disconnect the trigger - just write a dummy name. */ write_sysfs_string("trigger/current_trigger", dev_dir_name, "NULL"); -- 1.7.9.5 ^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [PATCH 4/7] iio staging: generic_buffer cleanup 2012-06-25 19:11 ` [PATCH 4/7] iio staging: generic_buffer cleanup Peter Meerwald @ 2012-06-25 20:33 ` Jonathan Cameron 0 siblings, 0 replies; 15+ messages in thread From: Jonathan Cameron @ 2012-06-25 20:33 UTC (permalink / raw) To: Peter Meerwald; +Cc: linux-iio, jic23 On 06/25/2012 08:11 PM, Peter Meerwald wrote: Please run Checkpatch over your submissions just before sending them... Fix the obvious whitespace issue before sending this on. Nice tidy up otherwise. > Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net> Acked-by: Jonathan Cameron <jic23@kernel.org> > --- > drivers/staging/iio/Documentation/generic_buffer.c | 58 ++++++++++---------- > 1 file changed, 29 insertions(+), 29 deletions(-) > > diff --git a/drivers/staging/iio/Documentation/generic_buffer.c b/drivers/staging/iio/Documentation/generic_buffer.c > index 81358ac..ab228b4 100644 > --- a/drivers/staging/iio/Documentation/generic_buffer.c > +++ b/drivers/staging/iio/Documentation/generic_buffer.c > @@ -33,8 +33,8 @@ > > /** > * size_from_channelarray() - calculate the storage size of a scan > - * @channels: the channel info array > - * @num_channels: size of the channel info array > + * @channels: the channel info array > + * @num_channels: number of channels > * > * Has the side effect of filling the channels[i].location values used > * in processing the buffer output. > @@ -58,14 +58,15 @@ int size_from_channelarray(struct iio_channel_info *channels, int num_channels) > void print2byte(int input, struct iio_channel_info *info) > { > /* First swap if incorrect endian */ > - > if (info->be) > input = be16toh((uint16_t)input); > else > input = le16toh((uint16_t)input); > > - /* shift before conversion to avoid sign extension > - of left aligned data */ > + /* > + * Shift before conversion to avoid sign extension > + * of left aligned data > + */ > input = input >> info->shift; > if (info->is_signed) { > int16_t val = input; > @@ -82,39 +83,39 @@ void print2byte(int input, struct iio_channel_info *info) > /** > * process_scan() - print out the values in SI units > * @data: pointer to the start of the scan > - * @infoarray: information about the channels. Note > + * @channels: information about the channels. Note > * size_from_channelarray must have been called first to fill the > * location offsets. > - * @num_channels: the number of active channels > + * @num_channels: number of channels > **/ > void process_scan(char *data, > - struct iio_channel_info *infoarray, > + struct iio_channel_info *channels, > int num_channels) > { > int k; > for (k = 0; k < num_channels; k++) > - switch (infoarray[k].bytes) { > + switch (channels[k].bytes) { > /* only a few cases implemented so far */ > case 2: > - print2byte(*(uint16_t *)(data + infoarray[k].location), > - &infoarray[k]); > + print2byte(*(uint16_t *)(data + channels[k].location), > + &channels[k]); > break; > case 8: > - if (infoarray[k].is_signed) { > + if (channels[k].is_signed) { > int64_t val = *(int64_t *) > (data + > - infoarray[k].location); > - if ((val >> infoarray[k].bits_used) & 1) > - val = (val & infoarray[k].mask) | > - ~infoarray[k].mask; > + channels[k].location); > + if ((val >> channels[k].bits_used) & 1) > + val = (val & channels[k].mask) | > + ~channels[k].mask; > /* special case for timestamp */ > - if (infoarray[k].scale == 1.0f && > - infoarray[k].offset == 0.0f) > + if (channels[k].scale == 1.0f && > + channels[k].offset == 0.0f) > printf(" %lld", val); > else > printf("%05f ", ((float)val + > - infoarray[k].offset)* > - infoarray[k].scale); > + channels[k].offset)* > + channels[k].scale); > } > break; > default: > @@ -129,7 +130,6 @@ int main(int argc, char **argv) > unsigned long timedelay = 1000000; > unsigned long buf_len = 128; > > - > int ret, c, i, j, toread; > int fp; > > @@ -146,7 +146,7 @@ int main(int argc, char **argv) > int noevents = 0; > char *dummy; > > - struct iio_channel_info *infoarray; > + struct iio_channel_info *channels; > > while ((c = getopt(argc, argv, "l:w:c:et:n:")) != -1) { > switch (c) { > @@ -214,7 +214,7 @@ int main(int argc, char **argv) > * Parse the files in scan_elements to identify what channels are > * present > */ > - ret = build_channel_array(dev_dir_name, &infoarray, &num_channels); > + ret = build_channel_array(dev_dir_name, &channels, &num_channels); > if (ret) { > printf("Problem reading scan element information\n"); > printf("diag %s\n", dev_dir_name); > @@ -233,7 +233,7 @@ int main(int argc, char **argv) > goto error_free_triggername; > } > printf("%s %s\n", dev_dir_name, trigger_name); > - /* Set the device trigger to be the data rdy trigger found above */ > + /* Set the device trigger to be the data ready trigger found above */ > ret = write_sysfs_string_and_verify("trigger/current_trigger", > dev_dir_name, > trigger_name); > @@ -251,7 +251,7 @@ int main(int argc, char **argv) > ret = write_sysfs_int("enable", buf_dir_name, 1); > if (ret < 0) > goto error_free_buf_dir_name; > - scan_size = size_from_channelarray(infoarray, num_channels); > + scan_size = size_from_channelarray(channels, num_channels); > data = malloc(scan_size*buf_len); > if (!data) { > ret = -ENOMEM; > @@ -266,7 +266,7 @@ int main(int argc, char **argv) > > /* Attempt to open non blocking the access dev */ > fp = open(buffer_access, O_RDONLY | O_NONBLOCK); > - if (fp == -1) { /*If it isn't there make the node */ > + if (fp == -1) { /* If it isn't there make the node */ > printf("Failed to open %s\n", buffer_access); > ret = -errno; > goto error_free_buffer_access; > @@ -297,16 +297,16 @@ int main(int argc, char **argv) > } > for (i = 0; i < read_size/scan_size; i++) > process_scan(data + scan_size*i, > - infoarray, > + channels, > num_channels); > } > > - /* Stop the ring buffer */ > + /* Stop the buffer */ > ret = write_sysfs_int("enable", buf_dir_name, 0); > if (ret < 0) > goto error_close_buffer_access; > > - /* Disconnect from the trigger - just write a dummy name.*/ > + /* Disconnect the trigger - just write a dummy name. */ > write_sysfs_string("trigger/current_trigger", > dev_dir_name, "NULL"); > > ^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH 5/7] iio staging: fix warning 'static but used in inline function' 2012-06-25 19:11 [PATCH 1/7] iio staging: fix generic_buffer print2byte() Peter Meerwald ` (2 preceding siblings ...) 2012-06-25 19:11 ` [PATCH 4/7] iio staging: generic_buffer cleanup Peter Meerwald @ 2012-06-25 19:11 ` Peter Meerwald 2012-06-25 20:34 ` Jonathan Cameron 2012-06-25 19:11 ` [PATCH 6/7] iio staging: use PRId64 format specifier for int64_t Peter Meerwald ` (2 subsequent siblings) 6 siblings, 1 reply; 15+ messages in thread From: Peter Meerwald @ 2012-06-25 19:11 UTC (permalink / raw) To: linux-iio; +Cc: jic23, Peter Meerwald iio_utils.h:367:10: warning: =E2=80=98iioutils_break_up_name=E2=80=99 is = static but used in inline function =E2=80=98build_channel_array=E2=80=99 = which is not static [enabled by default] Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net> --- drivers/staging/iio/Documentation/iio_utils.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/iio/Documentation/iio_utils.h b/drivers/stag= ing/iio/Documentation/iio_utils.h index d9439f8..9c7a5aa 100644 --- a/drivers/staging/iio/Documentation/iio_utils.h +++ b/drivers/staging/iio/Documentation/iio_utils.h @@ -27,7 +27,7 @@ const char *iio_dir =3D "/sys/bus/iio/devices/"; * @full_name: the full channel name * @generic_name: the output generic channel name **/ -static int iioutils_break_up_name(const char *full_name, +inline int iioutils_break_up_name(const char *full_name, char **generic_name) { char *current; --=20 1.7.9.5 ^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [PATCH 5/7] iio staging: fix warning 'static but used in inline function' 2012-06-25 19:11 ` [PATCH 5/7] iio staging: fix warning 'static but used in inline function' Peter Meerwald @ 2012-06-25 20:34 ` Jonathan Cameron 0 siblings, 0 replies; 15+ messages in thread From: Jonathan Cameron @ 2012-06-25 20:34 UTC (permalink / raw) To: Peter Meerwald; +Cc: linux-iio, jic23 On 06/25/2012 08:11 PM, Peter Meerwald wrote: > iio_utils.h:367:10: warning: =E2=80=98iioutils_break_up_name=E2=80=99 i= s static but used in inline function =E2=80=98build_channel_array=E2=80=99= which is not static [enabled by default] >=20 oops. curriously don't get that warning myself. Ah well. > Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net> Acked-by: Jonathan Cameron <jic23@kernel.org> > --- > drivers/staging/iio/Documentation/iio_utils.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) >=20 > diff --git a/drivers/staging/iio/Documentation/iio_utils.h b/drivers/st= aging/iio/Documentation/iio_utils.h > index d9439f8..9c7a5aa 100644 > --- a/drivers/staging/iio/Documentation/iio_utils.h > +++ b/drivers/staging/iio/Documentation/iio_utils.h > @@ -27,7 +27,7 @@ const char *iio_dir =3D "/sys/bus/iio/devices/"; > * @full_name: the full channel name > * @generic_name: the output generic channel name > **/ > -static int iioutils_break_up_name(const char *full_name, > +inline int iioutils_break_up_name(const char *full_name, > char **generic_name) > { > char *current; >=20 ^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH 6/7] iio staging: use PRId64 format specifier for int64_t 2012-06-25 19:11 [PATCH 1/7] iio staging: fix generic_buffer print2byte() Peter Meerwald ` (3 preceding siblings ...) 2012-06-25 19:11 ` [PATCH 5/7] iio staging: fix warning 'static but used in inline function' Peter Meerwald @ 2012-06-25 19:11 ` Peter Meerwald 2012-06-25 20:37 ` Jonathan Cameron 2012-06-25 19:11 ` [PATCH 7/7] iio staging: quell asprintf() warning, missing #includes Peter Meerwald 2012-06-25 20:23 ` [PATCH 1/7] iio staging: fix generic_buffer print2byte() Jonathan Cameron 6 siblings, 1 reply; 15+ messages in thread From: Peter Meerwald @ 2012-06-25 19:11 UTC (permalink / raw) To: linux-iio; +Cc: jic23, Peter Meerwald Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net> --- drivers/staging/iio/Documentation/generic_buffer.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/staging/iio/Documentation/generic_buffer.c b/drivers/staging/iio/Documentation/generic_buffer.c index ab228b4..1dd0681 100644 --- a/drivers/staging/iio/Documentation/generic_buffer.c +++ b/drivers/staging/iio/Documentation/generic_buffer.c @@ -29,6 +29,7 @@ #include <string.h> #include <poll.h> #include <endian.h> +#include <inttypes.h> #include "iio_utils.h" /** @@ -111,7 +112,7 @@ void process_scan(char *data, /* special case for timestamp */ if (channels[k].scale == 1.0f && channels[k].offset == 0.0f) - printf(" %lld", val); + printf(" %" PRId64, val); else printf("%05f ", ((float)val + channels[k].offset)* -- 1.7.9.5 ^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [PATCH 6/7] iio staging: use PRId64 format specifier for int64_t 2012-06-25 19:11 ` [PATCH 6/7] iio staging: use PRId64 format specifier for int64_t Peter Meerwald @ 2012-06-25 20:37 ` Jonathan Cameron 0 siblings, 0 replies; 15+ messages in thread From: Jonathan Cameron @ 2012-06-25 20:37 UTC (permalink / raw) To: Peter Meerwald; +Cc: linux-iio, jic23 New one to me, but fair enough. On 06/25/2012 08:11 PM, Peter Meerwald wrote: > Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net> Acked-by: Jonathan Cameron <jic23@kernel.org> > --- > drivers/staging/iio/Documentation/generic_buffer.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/staging/iio/Documentation/generic_buffer.c b/drivers/staging/iio/Documentation/generic_buffer.c > index ab228b4..1dd0681 100644 > --- a/drivers/staging/iio/Documentation/generic_buffer.c > +++ b/drivers/staging/iio/Documentation/generic_buffer.c > @@ -29,6 +29,7 @@ > #include <string.h> > #include <poll.h> > #include <endian.h> > +#include <inttypes.h> > #include "iio_utils.h" > > /** > @@ -111,7 +112,7 @@ void process_scan(char *data, > /* special case for timestamp */ > if (channels[k].scale == 1.0f && > channels[k].offset == 0.0f) > - printf(" %lld", val); > + printf(" %" PRId64, val); > else > printf("%05f ", ((float)val + > channels[k].offset)* > ^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH 7/7] iio staging: quell asprintf() warning, missing #includes 2012-06-25 19:11 [PATCH 1/7] iio staging: fix generic_buffer print2byte() Peter Meerwald ` (4 preceding siblings ...) 2012-06-25 19:11 ` [PATCH 6/7] iio staging: use PRId64 format specifier for int64_t Peter Meerwald @ 2012-06-25 19:11 ` Peter Meerwald 2012-06-25 20:38 ` Jonathan Cameron 2012-06-25 20:23 ` [PATCH 1/7] iio staging: fix generic_buffer print2byte() Jonathan Cameron 6 siblings, 1 reply; 15+ messages in thread From: Peter Meerwald @ 2012-06-25 19:11 UTC (permalink / raw) To: linux-iio; +Cc: jic23 Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net --- drivers/staging/iio/Documentation/generic_buffer.c | 3 +++ drivers/staging/iio/Documentation/iio_utils.h | 1 + 2 files changed, 4 insertions(+) diff --git a/drivers/staging/iio/Documentation/generic_buffer.c b/drivers/staging/iio/Documentation/generic_buffer.c index 1dd0681..aaf6146 100644 --- a/drivers/staging/iio/Documentation/generic_buffer.c +++ b/drivers/staging/iio/Documentation/generic_buffer.c @@ -18,6 +18,8 @@ * */ +#define _GNU_SOURCE + #include <unistd.h> #include <dirent.h> #include <fcntl.h> @@ -29,6 +31,7 @@ #include <string.h> #include <poll.h> #include <endian.h> +#include <getopt.h> #include <inttypes.h> #include "iio_utils.h" diff --git a/drivers/staging/iio/Documentation/iio_utils.h b/drivers/staging/iio/Documentation/iio_utils.h index 9c7a5aa..c0448b3 100644 --- a/drivers/staging/iio/Documentation/iio_utils.h +++ b/drivers/staging/iio/Documentation/iio_utils.h @@ -13,6 +13,7 @@ #include <stdio.h> #include <stdint.h> #include <dirent.h> +#include <errno.h> /* Made up value to limit allocation sizes */ #define IIO_MAX_NAME_LENGTH 30 -- 1.7.9.5 ^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [PATCH 7/7] iio staging: quell asprintf() warning, missing #includes 2012-06-25 19:11 ` [PATCH 7/7] iio staging: quell asprintf() warning, missing #includes Peter Meerwald @ 2012-06-25 20:38 ` Jonathan Cameron 0 siblings, 0 replies; 15+ messages in thread From: Jonathan Cameron @ 2012-06-25 20:38 UTC (permalink / raw) To: Peter Meerwald; +Cc: linux-iio On 06/25/2012 08:11 PM, Peter Meerwald wrote: > Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net Acked-by: Jonathan Cameron <jic23@kernel.org> Thanks for this set Peter. Nice to get cleanups on the bits that don't get hit by the autobuilders! > --- > drivers/staging/iio/Documentation/generic_buffer.c | 3 +++ > drivers/staging/iio/Documentation/iio_utils.h | 1 + > 2 files changed, 4 insertions(+) > > diff --git a/drivers/staging/iio/Documentation/generic_buffer.c b/drivers/staging/iio/Documentation/generic_buffer.c > index 1dd0681..aaf6146 100644 > --- a/drivers/staging/iio/Documentation/generic_buffer.c > +++ b/drivers/staging/iio/Documentation/generic_buffer.c > @@ -18,6 +18,8 @@ > * > */ > > +#define _GNU_SOURCE > + > #include <unistd.h> > #include <dirent.h> > #include <fcntl.h> > @@ -29,6 +31,7 @@ > #include <string.h> > #include <poll.h> > #include <endian.h> > +#include <getopt.h> > #include <inttypes.h> > #include "iio_utils.h" > > diff --git a/drivers/staging/iio/Documentation/iio_utils.h b/drivers/staging/iio/Documentation/iio_utils.h > index 9c7a5aa..c0448b3 100644 > --- a/drivers/staging/iio/Documentation/iio_utils.h > +++ b/drivers/staging/iio/Documentation/iio_utils.h > @@ -13,6 +13,7 @@ > #include <stdio.h> > #include <stdint.h> > #include <dirent.h> > +#include <errno.h> > > /* Made up value to limit allocation sizes */ > #define IIO_MAX_NAME_LENGTH 30 > ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 1/7] iio staging: fix generic_buffer print2byte() 2012-06-25 19:11 [PATCH 1/7] iio staging: fix generic_buffer print2byte() Peter Meerwald ` (5 preceding siblings ...) 2012-06-25 19:11 ` [PATCH 7/7] iio staging: quell asprintf() warning, missing #includes Peter Meerwald @ 2012-06-25 20:23 ` Jonathan Cameron 6 siblings, 0 replies; 15+ messages in thread From: Jonathan Cameron @ 2012-06-25 20:23 UTC (permalink / raw) To: Peter Meerwald; +Cc: linux-iio, jic23 On 06/25/2012 08:11 PM, Peter Meerwald wrote: > drop extra argument, move cast Currious. I wonder how that one snuck in! Thanks. > > Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net> Acked-by: Jonathan Cameron <jic23@kernel.org> > --- > drivers/staging/iio/Documentation/generic_buffer.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/drivers/staging/iio/Documentation/generic_buffer.c b/drivers/staging/iio/Documentation/generic_buffer.c > index bf55335..8d6e91c 100644 > --- a/drivers/staging/iio/Documentation/generic_buffer.c > +++ b/drivers/staging/iio/Documentation/generic_buffer.c > @@ -72,8 +72,7 @@ void print2byte(int input, struct iio_channel_info *info) > val &= (1 << info->bits_used) - 1; > val = (int16_t)(val << (16 - info->bits_used)) >> > (16 - info->bits_used); > - printf("%05f ", val, > - (float)(val + info->offset)*info->scale); > + printf("%05f ", ((float)val + info->offset)*info->scale); > } else { > uint16_t val = input; > val &= (1 << info->bits_used) - 1; > ^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH 1/7] iio staging: fix generic_buffer print2byte() @ 2012-06-25 21:12 Peter Meerwald 2012-06-25 21:12 ` [PATCH 4/7] iio staging: generic_buffer cleanup Peter Meerwald 0 siblings, 1 reply; 15+ messages in thread From: Peter Meerwald @ 2012-06-25 21:12 UTC (permalink / raw) To: Greg KH; +Cc: linux-iio, Peter Meerwald drop extra argument, move cast Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net> Acked-by: Jonathan Cameron <jic23@kernel.org> --- drivers/staging/iio/Documentation/generic_buffer.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/staging/iio/Documentation/generic_buffer.c b/drivers/staging/iio/Documentation/generic_buffer.c index bf55335..361e481 100644 --- a/drivers/staging/iio/Documentation/generic_buffer.c +++ b/drivers/staging/iio/Documentation/generic_buffer.c @@ -72,8 +72,7 @@ void print2byte(int input, struct iio_channel_info *info) val &= (1 << info->bits_used) - 1; val = (int16_t)(val << (16 - info->bits_used)) >> (16 - info->bits_used); - printf("%05f ", val, - (float)(val + info->offset)*info->scale); + printf("%05f ", ((float)val + info->offset)*info->scale); } else { uint16_t val = input; val &= (1 << info->bits_used) - 1; -- 1.7.9.5 ^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 4/7] iio staging: generic_buffer cleanup 2012-06-25 21:12 Peter Meerwald @ 2012-06-25 21:12 ` Peter Meerwald 0 siblings, 0 replies; 15+ messages in thread From: Peter Meerwald @ 2012-06-25 21:12 UTC (permalink / raw) To: Greg KH; +Cc: linux-iio, Peter Meerwald Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net> Acked-by: Jonathan Cameron <jic23@kernel.org> --- drivers/staging/iio/Documentation/generic_buffer.c | 60 ++++++++++---------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/drivers/staging/iio/Documentation/generic_buffer.c b/drivers/staging/iio/Documentation/generic_buffer.c index 7b2a12c..b89b7218 100644 --- a/drivers/staging/iio/Documentation/generic_buffer.c +++ b/drivers/staging/iio/Documentation/generic_buffer.c @@ -33,8 +33,8 @@ /** * size_from_channelarray() - calculate the storage size of a scan - * @channels: the channel info array - * @num_channels: size of the channel info array + * @channels: the channel info array + * @num_channels: number of channels * * Has the side effect of filling the channels[i].location values used * in processing the buffer output. @@ -58,14 +58,15 @@ int size_from_channelarray(struct iio_channel_info *channels, int num_channels) void print2byte(int input, struct iio_channel_info *info) { /* First swap if incorrect endian */ - if (info->be) input = be16toh((uint16_t)input); else input = le16toh((uint16_t)input); - /* shift before conversion to avoid sign extension - of left aligned data */ + /* + * Shift before conversion to avoid sign extension + * of left aligned data + */ input = input >> info->shift; if (info->is_signed) { int16_t val = input; @@ -82,39 +83,39 @@ void print2byte(int input, struct iio_channel_info *info) /** * process_scan() - print out the values in SI units * @data: pointer to the start of the scan - * @infoarray: information about the channels. Note + * @channels: information about the channels. Note * size_from_channelarray must have been called first to fill the * location offsets. - * @num_channels: the number of active channels + * @num_channels: number of channels **/ void process_scan(char *data, - struct iio_channel_info *infoarray, + struct iio_channel_info *channels, int num_channels) { int k; for (k = 0; k < num_channels; k++) - switch (infoarray[k].bytes) { + switch (channels[k].bytes) { /* only a few cases implemented so far */ case 2: - print2byte(*(uint16_t *)(data + infoarray[k].location), - &infoarray[k]); + print2byte(*(uint16_t *)(data + channels[k].location), + &channels[k]); break; case 8: - if (infoarray[k].is_signed) { + if (channels[k].is_signed) { int64_t val = *(int64_t *) (data + - infoarray[k].location); - if ((val >> infoarray[k].bits_used) & 1) - val = (val & infoarray[k].mask) | - ~infoarray[k].mask; + channels[k].location); + if ((val >> channels[k].bits_used) & 1) + val = (val & channels[k].mask) | + ~channels[k].mask; /* special case for timestamp */ - if (infoarray[k].scale == 1.0f && - infoarray[k].offset == 0.0f) + if (channels[k].scale == 1.0f && + channels[k].offset == 0.0f) printf(" %lld", val); else printf("%05f ", ((float)val + - infoarray[k].offset)* - infoarray[k].scale); + channels[k].offset)* + channels[k].scale); } break; default: @@ -129,7 +130,6 @@ int main(int argc, char **argv) unsigned long timedelay = 1000000; unsigned long buf_len = 128; - int ret, c, i, j, toread; int fp; @@ -146,7 +146,7 @@ int main(int argc, char **argv) int noevents = 0; char *dummy; - struct iio_channel_info *infoarray; + struct iio_channel_info *channels; while ((c = getopt(argc, argv, "l:w:c:et:n:")) != -1) { switch (c) { @@ -189,7 +189,7 @@ int main(int argc, char **argv) asprintf(&dev_dir_name, "%siio:device%d", iio_dir, dev_num); if (trigger_name == NULL) { /* - * Build the trigger name. If it is device associated it's + * Build the trigger name. If it is device associated its * name is <device_name>_dev[n] where n matches the device * number found above */ @@ -214,7 +214,7 @@ int main(int argc, char **argv) * Parse the files in scan_elements to identify what channels are * present */ - ret = build_channel_array(dev_dir_name, &infoarray, &num_channels); + ret = build_channel_array(dev_dir_name, &channels, &num_channels); if (ret) { printf("Problem reading scan element information\n"); printf("diag %s\n", dev_dir_name); @@ -233,7 +233,7 @@ int main(int argc, char **argv) goto error_free_triggername; } printf("%s %s\n", dev_dir_name, trigger_name); - /* Set the device trigger to be the data rdy trigger found above */ + /* Set the device trigger to be the data ready trigger found above */ ret = write_sysfs_string_and_verify("trigger/current_trigger", dev_dir_name, trigger_name); @@ -251,7 +251,7 @@ int main(int argc, char **argv) ret = write_sysfs_int("enable", buf_dir_name, 1); if (ret < 0) goto error_free_buf_dir_name; - scan_size = size_from_channelarray(infoarray, num_channels); + scan_size = size_from_channelarray(channels, num_channels); data = malloc(scan_size*buf_len); if (!data) { ret = -ENOMEM; @@ -266,7 +266,7 @@ int main(int argc, char **argv) /* Attempt to open non blocking the access dev */ fp = open(buffer_access, O_RDONLY | O_NONBLOCK); - if (fp == -1) { /*If it isn't there make the node */ + if (fp == -1) { /* If it isn't there make the node */ printf("Failed to open %s\n", buffer_access); ret = -errno; goto error_free_buffer_access; @@ -297,16 +297,16 @@ int main(int argc, char **argv) } for (i = 0; i < read_size/scan_size; i++) process_scan(data + scan_size*i, - infoarray, + channels, num_channels); } - /* Stop the ring buffer */ + /* Stop the buffer */ ret = write_sysfs_int("enable", buf_dir_name, 0); if (ret < 0) goto error_close_buffer_access; - /* Disconnect from the trigger - just write a dummy name.*/ + /* Disconnect the trigger - just write a dummy name. */ write_sysfs_string("trigger/current_trigger", dev_dir_name, "NULL"); -- 1.7.9.5 ^ permalink raw reply related [flat|nested] 15+ messages in thread
end of thread, other threads:[~2012-06-25 21:12 UTC | newest] Thread overview: 15+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2012-06-25 19:11 [PATCH 1/7] iio staging: fix generic_buffer print2byte() Peter Meerwald 2012-06-25 19:11 ` [PATCH 2/7] iio staging: remove unused variable Peter Meerwald 2012-06-25 20:28 ` Jonathan Cameron 2012-06-25 19:11 ` [PATCH 3/7] iio staging: move comment Peter Meerwald 2012-06-25 20:30 ` Jonathan Cameron 2012-06-25 19:11 ` [PATCH 4/7] iio staging: generic_buffer cleanup Peter Meerwald 2012-06-25 20:33 ` Jonathan Cameron 2012-06-25 19:11 ` [PATCH 5/7] iio staging: fix warning 'static but used in inline function' Peter Meerwald 2012-06-25 20:34 ` Jonathan Cameron 2012-06-25 19:11 ` [PATCH 6/7] iio staging: use PRId64 format specifier for int64_t Peter Meerwald 2012-06-25 20:37 ` Jonathan Cameron 2012-06-25 19:11 ` [PATCH 7/7] iio staging: quell asprintf() warning, missing #includes Peter Meerwald 2012-06-25 20:38 ` Jonathan Cameron 2012-06-25 20:23 ` [PATCH 1/7] iio staging: fix generic_buffer print2byte() Jonathan Cameron -- strict thread matches above, loose matches on Subject: below -- 2012-06-25 21:12 Peter Meerwald 2012-06-25 21:12 ` [PATCH 4/7] iio staging: generic_buffer cleanup Peter Meerwald
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.