aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/iio/industrialio-core.c
diff options
context:
space:
mode:
authorJonathan Cameron <jic23@cam.ac.uk>2011-09-02 12:14:34 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2011-09-06 19:01:58 -0400
commitc6fc806247be874c2e6d9a9494489a0430f92718 (patch)
treeacbc8f8d3c740e04ca19c14d44fcedf113fff90b /drivers/staging/iio/industrialio-core.c
parent26a54797c1b0941021a40a5973098fc28fe53d12 (diff)
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 f59a603713c..5717f1945f4 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[] = {
44 [IIO_PROCESSED] = "input", 44 [IIO_PROCESSED] = "input",
45}; 45};
46 46
47static const char * const iio_direction[] = {
48 [0] = "in",
49 [1] = "out",
50};
51
47static const char * const iio_chan_type_name_spec_shared[] = { 52static const char * const iio_chan_type_name_spec_shared[] = {
48 [IIO_IN] = "in", 53 [IIO_VOLTAGE] = "voltage",
49 [IIO_OUT] = "out",
50 [IIO_CURRENT] = "current", 54 [IIO_CURRENT] = "current",
51 [IIO_POWER] = "power", 55 [IIO_POWER] = "power",
52 [IIO_ACCEL] = "accel", 56 [IIO_ACCEL] = "accel",
53 [IIO_IN_DIFF] = "in-in", 57 [IIO_VOLTAGE_DIFF] = "voltage-voltage",
54 [IIO_GYRO] = "gyro", 58 [IIO_GYRO] = "gyro",
55 [IIO_MAGN] = "magn", 59 [IIO_MAGN] = "magn",
56 [IIO_LIGHT] = "illuminance", 60 [IIO_LIGHT] = "illuminance",
@@ -64,7 +68,7 @@ static const char * const iio_chan_type_name_spec_shared[] = {
64}; 68};
65 69
66static const char * const iio_chan_type_name_spec_complex[] = { 70static const char * const iio_chan_type_name_spec_complex[] = {
67 [IIO_IN_DIFF] = "in%d-in%d", 71 [IIO_VOLTAGE_DIFF] = "voltage%d-voltage%d",
68}; 72};
69 73
70static const char * const iio_modifier_names_light[] = { 74static const char * const iio_modifier_names_light[] = {
@@ -462,19 +466,22 @@ int __iio_device_attr_init(struct device_attribute *dev_attr,
462 goto error_ret; 466 goto error_ret;
463 467
464 /* Special case for types that uses both channel numbers in naming */ 468 /* Special case for types that uses both channel numbers in naming */
465 if (chan->type == IIO_IN_DIFF && !generic) 469 if (chan->type == IIO_VOLTAGE_DIFF && !generic)
466 name_format 470 name_format
467 = kasprintf(GFP_KERNEL, "%s_%s", 471 = kasprintf(GFP_KERNEL, "%s_%s_%s",
472 iio_direction[chan->output],
468 iio_chan_type_name_spec_complex[chan->type], 473 iio_chan_type_name_spec_complex[chan->type],
469 full_postfix); 474 full_postfix);
470 else if (generic || !chan->indexed) 475 else if (generic || !chan->indexed)
471 name_format 476 name_format
472 = kasprintf(GFP_KERNEL, "%s_%s", 477 = kasprintf(GFP_KERNEL, "%s_%s_%s",
478 iio_direction[chan->output],
473 iio_chan_type_name_spec_shared[chan->type], 479 iio_chan_type_name_spec_shared[chan->type],
474 full_postfix); 480 full_postfix);
475 else 481 else
476 name_format 482 name_format
477 = kasprintf(GFP_KERNEL, "%s%d_%s", 483 = kasprintf(GFP_KERNEL, "%s_%s%d_%s",
484 iio_direction[chan->output],
478 iio_chan_type_name_spec_shared[chan->type], 485 iio_chan_type_name_spec_shared[chan->type],
479 chan->channel, 486 chan->channel,
480 full_postfix); 487 full_postfix);
@@ -587,7 +594,7 @@ static int iio_device_add_channel_sysfs(struct iio_dev *dev_info,
587 ret = __iio_add_chan_devattr(iio_data_type_name[chan->processed_val], 594 ret = __iio_add_chan_devattr(iio_data_type_name[chan->processed_val],
588 NULL, chan, 595 NULL, chan,
589 &iio_read_channel_info, 596 &iio_read_channel_info,
590 (chan->type == IIO_OUT ? 597 (chan->output ?
591 &iio_write_channel_info : NULL), 598 &iio_write_channel_info : NULL),
592 0, 599 0,
593 0, 600 0,
@@ -819,7 +826,7 @@ static int iio_device_add_event_sysfs(struct iio_dev *dev_info,
819 } 826 }
820 switch (chan->type) { 827 switch (chan->type) {
821 /* Switch this to a table at some point */ 828 /* Switch this to a table at some point */
822 case IIO_IN: 829 case IIO_VOLTAGE:
823 mask = IIO_UNMOD_EVENT_CODE(chan->type, chan->channel, 830 mask = IIO_UNMOD_EVENT_CODE(chan->type, chan->channel,
824 i/IIO_EV_TYPE_MAX, 831 i/IIO_EV_TYPE_MAX,
825 i%IIO_EV_TYPE_MAX); 832 i%IIO_EV_TYPE_MAX);
@@ -829,7 +836,7 @@ static int iio_device_add_event_sysfs(struct iio_dev *dev_info,
829 i/IIO_EV_TYPE_MAX, 836 i/IIO_EV_TYPE_MAX,
830 i%IIO_EV_TYPE_MAX); 837 i%IIO_EV_TYPE_MAX);
831 break; 838 break;
832 case IIO_IN_DIFF: 839 case IIO_VOLTAGE_DIFF:
833 mask = IIO_MOD_EVENT_CODE(chan->type, chan->channel, 840 mask = IIO_MOD_EVENT_CODE(chan->type, chan->channel,
834 chan->channel2, 841 chan->channel2,
835 i/IIO_EV_TYPE_MAX, 842 i/IIO_EV_TYPE_MAX,