Skip to content

Commit

Permalink
staging: iio: sca3000 event attribute name updates
Browse files Browse the repository at this point in the history
Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Jonathan Cameron authored and Greg Kroah-Hartman committed Oct 8, 2010
1 parent c33680c commit fc5d0e4
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 18 deletions.
43 changes: 25 additions & 18 deletions drivers/staging/iio/accel/sca3000_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -774,19 +774,19 @@ static ssize_t sca3000_write_thresh(struct device *dev,
return ret ? ret : len;
}

static IIO_DEVICE_ATTR(accel_x_mag_either_rising_value,
static IIO_DEVICE_ATTR(accel_x_raw_mag_rising_value,
S_IRUGO | S_IWUSR,
sca3000_show_thresh,
sca3000_write_thresh,
SCA3000_REG_CTRL_SEL_MD_X_TH);

static IIO_DEVICE_ATTR(accel_y_mag_either_rising_value,
static IIO_DEVICE_ATTR(accel_y_raw_mag_rising_value,
S_IRUGO | S_IWUSR,
sca3000_show_thresh,
sca3000_write_thresh,
SCA3000_REG_CTRL_SEL_MD_Y_TH);

static IIO_DEVICE_ATTR(accel_z_mag_either_rising_value,
static IIO_DEVICE_ATTR(accel_z_raw_mag_rising_value,
S_IRUGO | S_IWUSR,
sca3000_show_thresh,
sca3000_write_thresh,
Expand Down Expand Up @@ -1172,25 +1172,31 @@ static ssize_t sca3000_set_mo_det(struct device *dev,
IIO_EVENT_SH(all, &sca3000_handler_th);

/* Free fall detector related event attribute */
IIO_EVENT_ATTR_FREE_FALL_DETECT_SH(iio_event_all,
sca3000_query_free_fall_mode,
sca3000_set_free_fall_mode,
0)
IIO_EVENT_ATTR_NAMED_SH(accel_xayaz_mag_falling_en,
accel_x&y&z_mag_falling_en,
iio_event_all,
sca3000_query_free_fall_mode,
sca3000_set_free_fall_mode,
0);

IIO_CONST_ATTR_NAMED(accel_xayaz_mag_falling_period,
accel_x&y&z_mag_falling_period,
"0.226");

/* Motion detector related event attributes */
IIO_EVENT_ATTR_SH(accel_x_mag_either_rising_en,
IIO_EVENT_ATTR_SH(accel_x_mag_rising_en,
iio_event_all,
sca3000_query_mo_det,
sca3000_set_mo_det,
SCA3000_MD_CTRL_OR_X);

IIO_EVENT_ATTR_SH(accel_y_mag_either_rising_en,
IIO_EVENT_ATTR_SH(accel_y_mag_rising_en,
iio_event_all,
sca3000_query_mo_det,
sca3000_set_mo_det,
SCA3000_MD_CTRL_OR_Y);

IIO_EVENT_ATTR_SH(accel_z_mag_either_rising_en,
IIO_EVENT_ATTR_SH(accel_z_mag_rising_en,
iio_event_all,
sca3000_query_mo_det,
sca3000_set_mo_det,
Expand All @@ -1208,15 +1214,16 @@ IIO_EVENT_ATTR_RING_75_FULL_SH(iio_event_all,
SCA3000_INT_MASK_RING_THREE_QUARTER);

static struct attribute *sca3000_event_attributes[] = {
&iio_event_attr_free_fall.dev_attr.attr,
&iio_event_attr_accel_x_mag_either_rising_en.dev_attr.attr,
&iio_event_attr_accel_y_mag_either_rising_en.dev_attr.attr,
&iio_event_attr_accel_z_mag_either_rising_en.dev_attr.attr,
&iio_event_attr_accel_xayaz_mag_falling_en.dev_attr.attr,
&iio_const_attr_accel_xayaz_mag_falling_period.dev_attr.attr,
&iio_event_attr_accel_x_mag_rising_en.dev_attr.attr,
&iio_dev_attr_accel_x_raw_mag_rising_value.dev_attr.attr,
&iio_event_attr_accel_y_mag_rising_en.dev_attr.attr,
&iio_dev_attr_accel_y_raw_mag_rising_value.dev_attr.attr,
&iio_event_attr_accel_z_mag_rising_en.dev_attr.attr,
&iio_dev_attr_accel_z_raw_mag_rising_value.dev_attr.attr,
&iio_event_attr_ring_50_full.dev_attr.attr,
&iio_event_attr_ring_75_full.dev_attr.attr,
&iio_dev_attr_accel_x_mag_either_rising_value.dev_attr.attr,
&iio_dev_attr_accel_y_mag_either_rising_value.dev_attr.attr,
&iio_dev_attr_accel_z_mag_either_rising_value.dev_attr.attr,
NULL,
};

Expand Down Expand Up @@ -1374,7 +1381,7 @@ static int __devinit __sca3000_probe(struct spi_device *spi,
* might be worthwhile.
*/
iio_add_event_to_list(
iio_event_attr_accel_z_mag_either_rising_en.listel,
iio_event_attr_accel_z_mag_rising_en.listel,
&st->indio_dev
->interrupts[0]->ev_list);
}
Expand Down
4 changes: 4 additions & 0 deletions drivers/staging/iio/sysfs.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ struct iio_const_attr {
= { .string = _string, \
.dev_attr = __ATTR(_name, S_IRUGO, iio_read_const_attr, NULL)}

#define IIO_CONST_ATTR_NAMED(_vname, _name, _string) \
struct iio_const_attr iio_const_attr_##_vname \
= { .string = _string, \
.dev_attr = __ATTR(_name, S_IRUGO, iio_read_const_attr, NULL)}
/* Generic attributes of onetype or another */

/**
Expand Down

0 comments on commit fc5d0e4

Please sign in to comment.