On Wed, Apr 1, 2015 at 5:55 AM, Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@xxxxxxxxxxxxxxx> wrote: > Added rate control support for ALS and proximity > threshold interrupts. > > Setting <n> to ALS intr_persist sysfs node would > generate interrupt whenever ALS data cross either > upper or lower threshold limits <n> number of times. > Similarly setting <m> to proximity intr_persist sysfs > node would genere interrupt whenever proximity data falls > outside threshold limit <m> number of times. > <snip> > +static ssize_t ltr501_read_intr_prst(struct iio_dev *indio_dev, > + uintptr_t private, > + const struct iio_chan_spec *chan, > + char *buf) > +{ > + struct ltr501_data *data = iio_priv(indio_dev); > + int ret = -EINVAL; > + > + switch (chan->type) { > + case IIO_INTENSITY: > + mutex_lock(&data->lock_als); > + ret = i2c_smbus_read_byte_data(data->client, LTR501_INTR_PRST); > + mutex_unlock(&data->lock_als); I am not sure I understand why is the mutex needed here? AFAIK I2C transactions are serialized. <snip> > +static const struct iio_chan_spec_ext_info ltr501_ext_info[] = { > + { > + .name = "intr_persist", > + .read = ltr501_read_intr_prst, > + .write = ltr501_write_intr_prst, > + .shared = IIO_SHARED_BY_TYPE, > + }, > + {}, > +}; > + Would be nice to standardize persistence attribute (IIO_CHAN_INFO_PERSISTENCE). thanks, Daniel. -- To unsubscribe from this list: send the line "unsubscribe linux-iio" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html