summaryrefslogtreecommitdiffstats
path: root/drivers/staging/iio/industrialio-core.c
diff options
context:
space:
mode:
authorJonathan Cameron <jic23@cam.ac.uk>2011-09-02 17:14:34 +0100
committerGreg Kroah-Hartman <gregkh@suse.de>2011-09-06 16:01:58 -0700
commitc6fc806247be874c2e6d9a9494489a0430f92718 (patch)
treeacbc8f8d3c740e04ca19c14d44fcedf113fff90b /drivers/staging/iio/industrialio-core.c
parent26a54797c1b0941021a40a5973098fc28fe53d12 (diff)
downloadop-kernel-dev-c6fc806247be874c2e6d9a9494489a0430f92718.zip
op-kernel-dev-c6fc806247be874c2e6d9a9494489a0430f92718.tar.gz
staging:iio: ABI rework - add in_ or out_ prefix to channnels
Also involves changing current inX outX to in_voltageX and out_voltageX V2: squash users of the IIO_CHAN_OUT macro and get rid of it. There are very few of these, so it is easier to fix them. Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk> Acked-by: Michael Hennerich <Michael.Hennerich@analog.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging/iio/industrialio-core.c')
-rw-r--r--drivers/staging/iio/industrialio-core.c29
1 files changed, 18 insertions, 11 deletions
diff --git a/drivers/staging/iio/industrialio-core.c b/drivers/staging/iio/industrialio-core.c
index f59a603..5717f19 100644
--- a/drivers/staging/iio/industrialio-core.c
+++ b/drivers/staging/iio/industrialio-core.c
@@ -44,13 +44,17 @@ static const char * const iio_data_type_name[] = {
[IIO_PROCESSED] = "input",
};
+static const char * const iio_direction[] = {
+ [0] = "in",
+ [1] = "out",
+};
+
static const char * const iio_chan_type_name_spec_shared[] = {
- [IIO_IN] = "in",
- [IIO_OUT] = "out",
+ [IIO_VOLTAGE] = "voltage",
[IIO_CURRENT] = "current",
[IIO_POWER] = "power",
[IIO_ACCEL] = "accel",
- [IIO_IN_DIFF] = "in-in",
+ [IIO_VOLTAGE_DIFF] = "voltage-voltage",
[IIO_GYRO] = "gyro",
[IIO_MAGN] = "magn",
[IIO_LIGHT] = "illuminance",
@@ -64,7 +68,7 @@ static const char * const iio_chan_type_name_spec_shared[] = {
};
static const char * const iio_chan_type_name_spec_complex[] = {
- [IIO_IN_DIFF] = "in%d-in%d",
+ [IIO_VOLTAGE_DIFF] = "voltage%d-voltage%d",
};
static const char * const iio_modifier_names_light[] = {
@@ -462,19 +466,22 @@ int __iio_device_attr_init(struct device_attribute *dev_attr,
goto error_ret;
/* Special case for types that uses both channel numbers in naming */
- if (chan->type == IIO_IN_DIFF && !generic)
+ if (chan->type == IIO_VOLTAGE_DIFF && !generic)
name_format
- = kasprintf(GFP_KERNEL, "%s_%s",
+ = kasprintf(GFP_KERNEL, "%s_%s_%s",
+ iio_direction[chan->output],
iio_chan_type_name_spec_complex[chan->type],
full_postfix);
else if (generic || !chan->indexed)
name_format
- = kasprintf(GFP_KERNEL, "%s_%s",
+ = kasprintf(GFP_KERNEL, "%s_%s_%s",
+ iio_direction[chan->output],
iio_chan_type_name_spec_shared[chan->type],
full_postfix);
else
name_format
- = kasprintf(GFP_KERNEL, "%s%d_%s",
+ = kasprintf(GFP_KERNEL, "%s_%s%d_%s",
+ iio_direction[chan->output],
iio_chan_type_name_spec_shared[chan->type],
chan->channel,
full_postfix);
@@ -587,7 +594,7 @@ static int iio_device_add_channel_sysfs(struct iio_dev *dev_info,
ret = __iio_add_chan_devattr(iio_data_type_name[chan->processed_val],
NULL, chan,
&iio_read_channel_info,
- (chan->type == IIO_OUT ?
+ (chan->output ?
&iio_write_channel_info : NULL),
0,
0,
@@ -819,7 +826,7 @@ static int iio_device_add_event_sysfs(struct iio_dev *dev_info,
}
switch (chan->type) {
/* Switch this to a table at some point */
- case IIO_IN:
+ case IIO_VOLTAGE:
mask = IIO_UNMOD_EVENT_CODE(chan->type, chan->channel,
i/IIO_EV_TYPE_MAX,
i%IIO_EV_TYPE_MAX);
@@ -829,7 +836,7 @@ static int iio_device_add_event_sysfs(struct iio_dev *dev_info,
i/IIO_EV_TYPE_MAX,
i%IIO_EV_TYPE_MAX);
break;
- case IIO_IN_DIFF:
+ case IIO_VOLTAGE_DIFF:
mask = IIO_MOD_EVENT_CODE(chan->type, chan->channel,
chan->channel2,
i/IIO_EV_TYPE_MAX,
OpenPOWER on IntegriCloud