Skip to content

Commit

Permalink
Merge branch 'fixes-togreg' into togreg
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonathan Cameron committed Jun 30, 2012
2 parents 2da049b + 06d5199 commit c1f1a9d
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 11 deletions.
24 changes: 19 additions & 5 deletions drivers/staging/iio/Documentation/iio_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,8 @@ inline int iioutils_get_type(unsigned *is_signed,
&padint, shift);
if (ret < 0) {
printf("failed to pass scan type description\n");
return ret;
ret = -errno;
goto error_close_sysfsfp;
}
*be = (endianchar == 'b');
*bytes = padint / 8;
Expand All @@ -174,7 +175,11 @@ inline int iioutils_get_type(unsigned *is_signed,
free(filename);

filename = 0;
sysfsfp = 0;
}
error_close_sysfsfp:
if (sysfsfp)
fclose(sysfsfp);
error_free_filename:
if (filename)
free(filename);
Expand Down Expand Up @@ -468,23 +473,30 @@ inline int find_type_by_name(const char *name, const char *type)
+ strlen(type)
+ numstrlen
+ 6);
if (filename == NULL)
if (filename == NULL) {
closedir(dp);
return -ENOMEM;
}
sprintf(filename, "%s%s%d/name",
iio_dir,
type,
number);
nameFile = fopen(filename, "r");
if (!nameFile)
if (!nameFile) {
free(filename);
continue;
}
free(filename);
fscanf(nameFile, "%s", thisname);
if (strcmp(name, thisname) == 0)
return number;
fclose(nameFile);
if (strcmp(name, thisname) == 0) {
closedir(dp);
return number;
}
}
}
}
closedir(dp);
return -ENODEV;
}

Expand Down Expand Up @@ -513,6 +525,7 @@ inline int _write_sysfs_int(char *filename, char *basedir, int val, int verify)
goto error_free;
}
fscanf(sysfsfp, "%d", &test);
fclose(sysfsfp);
if (test != val) {
printf("Possible failure in int write %d to %s%s\n",
val,
Expand Down Expand Up @@ -562,6 +575,7 @@ int _write_sysfs_string(char *filename, char *basedir, char *val, int verify)
goto error_free;
}
fscanf(sysfsfp, "%s", temp);
fclose(sysfsfp);
if (strcmp(temp, val) != 0) {
printf("Possible failure in string write of %s "
"Should be %s "
Expand Down
2 changes: 1 addition & 1 deletion drivers/staging/iio/accel/adis16204_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ static int adis16204_read_raw(struct iio_dev *indio_dev,
return IIO_VAL_INT_PLUS_MICRO;
case IIO_ACCEL:
*val = 0;
if (chan->channel == 'x')
if (chan->channel2 == IIO_MOD_X)
*val2 = 17125;
else
*val2 = 8407;
Expand Down
9 changes: 6 additions & 3 deletions drivers/staging/iio/accel/adis16240_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,8 @@ static struct iio_chan_spec adis16240_channels[] = {
.channel2 = IIO_MOD_X,
.info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT |
IIO_CHAN_INFO_SCALE_SHARED_BIT |
IIO_CHAN_INFO_CALIBBIAS_SEPARATE_BIT,
IIO_CHAN_INFO_CALIBBIAS_SEPARATE_BIT |
IIO_CHAN_INFO_PEAK_SEPARATE_BIT,
.address = accel_x,
.scan_index = ADIS16240_SCAN_ACC_X,
.scan_type = {
Expand All @@ -514,7 +515,8 @@ static struct iio_chan_spec adis16240_channels[] = {
.channel2 = IIO_MOD_Y,
.info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT |
IIO_CHAN_INFO_SCALE_SHARED_BIT |
IIO_CHAN_INFO_CALIBBIAS_SEPARATE_BIT,
IIO_CHAN_INFO_CALIBBIAS_SEPARATE_BIT |
IIO_CHAN_INFO_PEAK_SEPARATE_BIT,
.address = accel_y,
.scan_index = ADIS16240_SCAN_ACC_Y,
.scan_type = {
Expand All @@ -528,7 +530,8 @@ static struct iio_chan_spec adis16240_channels[] = {
.channel2 = IIO_MOD_Z,
.info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT |
IIO_CHAN_INFO_SCALE_SHARED_BIT |
IIO_CHAN_INFO_CALIBBIAS_SEPARATE_BIT,
IIO_CHAN_INFO_CALIBBIAS_SEPARATE_BIT |
IIO_CHAN_INFO_PEAK_SEPARATE_BIT,
.address = accel_z,
.scan_index = ADIS16240_SCAN_ACC_Z,
.scan_type = {
Expand Down
4 changes: 2 additions & 2 deletions drivers/staging/iio/adc/ad7793.c
Original file line number Diff line number Diff line change
Expand Up @@ -758,7 +758,7 @@ static const struct ad7793_chip_info ad7793_chip_info_tbl[] = {
.address = AD7793_CH_AIN1M_AIN1M,
.info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT |
IIO_CHAN_INFO_SCALE_SHARED_BIT,
.scan_index = 2,
.scan_index = 3,
.scan_type = IIO_ST('s', 24, 32, 0)
},
.channel[4] = {
Expand Down Expand Up @@ -831,7 +831,7 @@ static const struct ad7793_chip_info ad7793_chip_info_tbl[] = {
.address = AD7793_CH_AIN1M_AIN1M,
.info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT |
IIO_CHAN_INFO_SCALE_SHARED_BIT,
.scan_index = 2,
.scan_index = 3,
.scan_type = IIO_ST('s', 16, 32, 0)
},
.channel[4] = {
Expand Down

0 comments on commit c1f1a9d

Please sign in to comment.