staging:iio:naming in the EV_BIT macro fix.
Should always have been IIO_EV_DIR_MAX as that's what it actually controls. Also reduced the number to 4 as not yet seen a case needing more and this is not userspace visible anyway. Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
e614a54b29
commit
c04ea8ae99
@@ -791,27 +791,27 @@ static int iio_device_add_event_sysfs(struct iio_dev *dev_info,
|
|||||||
|
|
||||||
for_each_set_bit(i, &chan->event_mask, sizeof(chan->event_mask)*8) {
|
for_each_set_bit(i, &chan->event_mask, sizeof(chan->event_mask)*8) {
|
||||||
postfix = kasprintf(GFP_KERNEL, "%s_%s_en",
|
postfix = kasprintf(GFP_KERNEL, "%s_%s_en",
|
||||||
iio_ev_type_text[i/IIO_EV_TYPE_MAX],
|
iio_ev_type_text[i/IIO_EV_DIR_MAX],
|
||||||
iio_ev_dir_text[i%IIO_EV_TYPE_MAX]);
|
iio_ev_dir_text[i%IIO_EV_DIR_MAX]);
|
||||||
if (postfix == NULL) {
|
if (postfix == NULL) {
|
||||||
ret = -ENOMEM;
|
ret = -ENOMEM;
|
||||||
goto error_ret;
|
goto error_ret;
|
||||||
}
|
}
|
||||||
if (chan->modified)
|
if (chan->modified)
|
||||||
mask = IIO_MOD_EVENT_CODE(chan->type, 0, chan->channel,
|
mask = IIO_MOD_EVENT_CODE(chan->type, 0, chan->channel,
|
||||||
i/IIO_EV_TYPE_MAX,
|
i/IIO_EV_DIR_MAX,
|
||||||
i%IIO_EV_TYPE_MAX);
|
i%IIO_EV_DIR_MAX);
|
||||||
else if (chan->type == IIO_VOLTAGE_DIFF)
|
else if (chan->type == IIO_VOLTAGE_DIFF)
|
||||||
mask = IIO_MOD_EVENT_CODE(chan->type,
|
mask = IIO_MOD_EVENT_CODE(chan->type,
|
||||||
chan->channel,
|
chan->channel,
|
||||||
chan->channel2,
|
chan->channel2,
|
||||||
i/IIO_EV_TYPE_MAX,
|
i/IIO_EV_DIR_MAX,
|
||||||
i%IIO_EV_TYPE_MAX);
|
i%IIO_EV_DIR_MAX);
|
||||||
else
|
else
|
||||||
mask = IIO_UNMOD_EVENT_CODE(chan->type,
|
mask = IIO_UNMOD_EVENT_CODE(chan->type,
|
||||||
chan->channel,
|
chan->channel,
|
||||||
i/IIO_EV_TYPE_MAX,
|
i/IIO_EV_DIR_MAX,
|
||||||
i%IIO_EV_TYPE_MAX);
|
i%IIO_EV_DIR_MAX);
|
||||||
|
|
||||||
ret = __iio_add_chan_devattr(postfix,
|
ret = __iio_add_chan_devattr(postfix,
|
||||||
chan,
|
chan,
|
||||||
@@ -827,8 +827,8 @@ static int iio_device_add_event_sysfs(struct iio_dev *dev_info,
|
|||||||
goto error_ret;
|
goto error_ret;
|
||||||
attrcount++;
|
attrcount++;
|
||||||
postfix = kasprintf(GFP_KERNEL, "%s_%s_value",
|
postfix = kasprintf(GFP_KERNEL, "%s_%s_value",
|
||||||
iio_ev_type_text[i/IIO_EV_TYPE_MAX],
|
iio_ev_type_text[i/IIO_EV_DIR_MAX],
|
||||||
iio_ev_dir_text[i%IIO_EV_TYPE_MAX]);
|
iio_ev_dir_text[i%IIO_EV_DIR_MAX]);
|
||||||
if (postfix == NULL) {
|
if (postfix == NULL) {
|
||||||
ret = -ENOMEM;
|
ret = -ENOMEM;
|
||||||
goto error_ret;
|
goto error_ret;
|
||||||
|
@@ -131,9 +131,9 @@ enum iio_event_direction {
|
|||||||
(((u64)type << 56) | ((u64)direction << 48) | ((u64)modifier << 40) | \
|
(((u64)type << 56) | ((u64)direction << 48) | ((u64)modifier << 40) | \
|
||||||
((u64)chan_type << 32) | (chan2 << 16) | chan1 | chan)
|
((u64)chan_type << 32) | (chan2 << 16) | chan1 | chan)
|
||||||
|
|
||||||
#define IIO_EV_TYPE_MAX 8
|
#define IIO_EV_DIR_MAX 4
|
||||||
#define IIO_EV_BIT(type, direction) \
|
#define IIO_EV_BIT(type, direction) \
|
||||||
(1 << (type*IIO_EV_TYPE_MAX + direction))
|
(1 << (type*IIO_EV_DIR_MAX + direction))
|
||||||
|
|
||||||
#define IIO_MOD_EVENT_CODE(channelclass, number, modifier, \
|
#define IIO_MOD_EVENT_CODE(channelclass, number, modifier, \
|
||||||
type, direction) \
|
type, direction) \
|
||||||
|
Reference in New Issue
Block a user