cregit-Linux how code gets into the kernel

Release 4.14 drivers/iio/industrialio-trigger.c

Directory: drivers/iio
/* The industrial I/O core, trigger handling functions
 *
 * Copyright (c) 2008 Jonathan Cameron
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License version 2 as published by
 * the Free Software Foundation.
 */

#include <linux/kernel.h>
#include <linux/idr.h>
#include <linux/err.h>
#include <linux/device.h>
#include <linux/interrupt.h>
#include <linux/list.h>
#include <linux/slab.h>

#include <linux/iio/iio.h>
#include <linux/iio/trigger.h>
#include "iio_core.h"
#include "iio_core_trigger.h"
#include <linux/iio/trigger_consumer.h>

/* RFC - Question of approach
 * Make the common case (single sensor single trigger)
 * simple by starting trigger capture from when first sensors
 * is added.
 *
 * Complex simultaneous start requires use of 'hold' functionality
 * of the trigger. (not implemented)
 *
 * Any other suggestions?
 */

static DEFINE_IDA(iio_trigger_ida);

/* Single list of all available triggers */
static LIST_HEAD(iio_trigger_list);
static DEFINE_MUTEX(iio_trigger_list_lock);

/**
 * iio_trigger_read_name() - retrieve useful identifying name
 * @dev:        device associated with the iio_trigger
 * @attr:       pointer to the device_attribute structure that is
 *              being processed
 * @buf:        buffer to print the name into
 *
 * Return: a negative number on failure or the number of written
 *         characters on success.
 */

static ssize_t iio_trigger_read_name(struct device *dev, struct device_attribute *attr, char *buf) { struct iio_trigger *trig = to_iio_trigger(dev); return sprintf(buf, "%s\n", trig->name); }

Contributors

PersonTokensPropCommitsCommitProp
Jonathan Cameron4197.62%150.00%
Lars-Peter Clausen12.38%150.00%
Total42100.00%2100.00%

static DEVICE_ATTR(name, S_IRUGO, iio_trigger_read_name, NULL); static struct attribute *iio_trig_dev_attrs[] = { &dev_attr_name.attr, NULL, }; ATTRIBUTE_GROUPS(iio_trig_dev); static struct iio_trigger *__iio_trigger_find_by_name(const char *name);
int iio_trigger_register(struct iio_trigger *trig_info) { int ret; /* trig_info->ops is required for the module member */ if (!trig_info->ops) return -EINVAL; trig_info->id = ida_simple_get(&iio_trigger_ida, 0, 0, GFP_KERNEL); if (trig_info->id < 0) return trig_info->id; /* Set the name used for the sysfs directory etc */ dev_set_name(&trig_info->dev, "trigger%ld", (unsigned long) trig_info->id); ret = device_add(&trig_info->dev); if (ret) goto error_unregister_id; /* Add to list of available triggers held by the IIO core */ mutex_lock(&iio_trigger_list_lock); if (__iio_trigger_find_by_name(trig_info->name)) { pr_err("Duplicate trigger name '%s'\n", trig_info->name); ret = -EEXIST; goto error_device_del; } list_add_tail(&trig_info->list, &iio_trigger_list); mutex_unlock(&iio_trigger_list_lock); return 0; error_device_del: mutex_unlock(&iio_trigger_list_lock); device_del(&trig_info->dev); error_unregister_id: ida_simple_remove(&iio_trigger_ida, trig_info->id); return ret; }

Contributors

PersonTokensPropCommitsCommitProp
Jonathan Cameron13073.86%360.00%
Crestez Dan Leonard4425.00%120.00%
Hartmut Knaack21.14%120.00%
Total176100.00%5100.00%

EXPORT_SYMBOL(iio_trigger_register);
void iio_trigger_unregister(struct iio_trigger *trig_info) { mutex_lock(&iio_trigger_list_lock); list_del(&trig_info->list); mutex_unlock(&iio_trigger_list_lock); ida_simple_remove(&iio_trigger_ida, trig_info->id); /* Possible issue in here */ device_del(&trig_info->dev); }

Contributors

PersonTokensPropCommitsCommitProp
Jonathan Cameron49100.00%4100.00%
Total49100.00%4100.00%

EXPORT_SYMBOL(iio_trigger_unregister);
int iio_trigger_set_immutable(struct iio_dev *indio_dev, struct iio_trigger *trig) { if (!indio_dev || !trig) return -EINVAL; mutex_lock(&indio_dev->mlock); WARN_ON(indio_dev->trig_readonly); indio_dev->trig = iio_trigger_get(trig); indio_dev->trig_readonly = true; mutex_unlock(&indio_dev->mlock); return 0; }

Contributors

PersonTokensPropCommitsCommitProp
Matthew Ranostay68100.00%1100.00%
Total68100.00%1100.00%

EXPORT_SYMBOL(iio_trigger_set_immutable); /* Search for trigger by name, assuming iio_trigger_list_lock held */
static struct iio_trigger *__iio_trigger_find_by_name(const char *name) { struct iio_trigger *iter; list_for_each_entry(iter, &iio_trigger_list, list) if (!strcmp(iter->name, name)) return iter; return NULL; }

Contributors

PersonTokensPropCommitsCommitProp
Crestez Dan Leonard44100.00%1100.00%
Total44100.00%1100.00%


static struct iio_trigger *iio_trigger_acquire_by_name(const char *name) { struct iio_trigger *trig = NULL, *iter; mutex_lock(&iio_trigger_list_lock); list_for_each_entry(iter, &iio_trigger_list, list) if (sysfs_streq(iter->name, name)) { trig = iter; iio_trigger_get(trig); break; } mutex_unlock(&iio_trigger_list_lock); return trig; }

Contributors

PersonTokensPropCommitsCommitProp
Jonathan Cameron6391.30%266.67%
Alison Schofield68.70%133.33%
Total69100.00%3100.00%


void iio_trigger_poll(struct iio_trigger *trig) { int i; if (!atomic_read(&trig->use_count)) { atomic_set(&trig->use_count, CONFIG_IIO_CONSUMERS_PER_TRIGGER); for (i = 0; i < CONFIG_IIO_CONSUMERS_PER_TRIGGER; i++) { if (trig->subirqs[i].enabled) generic_handle_irq(trig->subirq_base + i); else iio_trigger_notify_done(trig); } } }

Contributors

PersonTokensPropCommitsCommitProp
Jonathan Cameron5470.13%266.67%
Lars-Peter Clausen2329.87%133.33%
Total77100.00%3100.00%

EXPORT_SYMBOL(iio_trigger_poll);
irqreturn_t iio_trigger_generic_data_rdy_poll(int irq, void *private) { iio_trigger_poll(private); return IRQ_HANDLED; }

Contributors

PersonTokensPropCommitsCommitProp
Jonathan Cameron20100.00%1100.00%
Total20100.00%1100.00%

EXPORT_SYMBOL(iio_trigger_generic_data_rdy_poll);
void iio_trigger_poll_chained(struct iio_trigger *trig) { int i; if (!atomic_read(&trig->use_count)) { atomic_set(&trig->use_count, CONFIG_IIO_CONSUMERS_PER_TRIGGER); for (i = 0; i < CONFIG_IIO_CONSUMERS_PER_TRIGGER; i++) { if (trig->subirqs[i].enabled) handle_nested_irq(trig->subirq_base + i); else iio_trigger_notify_done(trig); } } }

Contributors

PersonTokensPropCommitsCommitProp
Jonathan Cameron5470.13%150.00%
Lars-Peter Clausen2329.87%150.00%
Total77100.00%2100.00%

EXPORT_SYMBOL(iio_trigger_poll_chained);
void iio_trigger_notify_done(struct iio_trigger *trig) { if (atomic_dec_and_test(&trig->use_count) && trig->ops->try_reenable) if (trig->ops->try_reenable(trig)) /* Missed an interrupt so launch new poll now */ iio_trigger_poll(trig); }

Contributors

PersonTokensPropCommitsCommitProp
Jonathan Cameron3888.37%250.00%
Lars-Peter Clausen49.30%125.00%
Peter Meerwald-Stadler12.33%125.00%
Total43100.00%4100.00%

EXPORT_SYMBOL(iio_trigger_notify_done); /* Trigger Consumer related functions */
static int iio_trigger_get_irq(struct iio_trigger *trig) { int ret; mutex_lock(&trig->pool_lock); ret = bitmap_find_free_region(trig->pool, CONFIG_IIO_CONSUMERS_PER_TRIGGER, ilog2(1)); mutex_unlock(&trig->pool_lock); if (ret >= 0) ret += trig->subirq_base; return ret; }

Contributors

PersonTokensPropCommitsCommitProp
Jonathan Cameron61100.00%1100.00%
Total61100.00%1100.00%


static void iio_trigger_put_irq(struct iio_trigger *trig, int irq) { mutex_lock(&trig->pool_lock); clear_bit(irq - trig->subirq_base, trig->pool); mutex_unlock(&trig->pool_lock); }

Contributors

PersonTokensPropCommitsCommitProp
Jonathan Cameron43100.00%1100.00%
Total43100.00%1100.00%

/* Complexity in here. With certain triggers (datardy) an acknowledgement * may be needed if the pollfuncs do not include the data read for the * triggering device. * This is not currently handled. Alternative of not enabling trigger unless * the relevant function is in there may be the best option. */ /* Worth protecting against double additions? */
static int iio_trigger_attach_poll_func(struct iio_trigger *trig, struct iio_poll_func *pf) { int ret = 0; bool notinuse = bitmap_empty(trig->pool, CONFIG_IIO_CONSUMERS_PER_TRIGGER); /* Prevent the module from being removed whilst attached to a trigger */ __module_get(pf->indio_dev->info->driver_module); /* Get irq number */ pf->irq = iio_trigger_get_irq(trig); if (pf->irq < 0) goto out_put_module; /* Request irq */ ret = request_threaded_irq(pf->irq, pf->h, pf->thread, pf->type, pf->name, pf); if (ret < 0) goto out_put_irq; /* Enable trigger in driver */ if (trig->ops->set_trigger_state && notinuse) { ret = trig->ops->set_trigger_state(trig, true); if (ret < 0) goto out_free_irq; } /* * Check if we just registered to our own trigger: we determine that * this is the case if the IIO device and the trigger device share the * same parent device. */ if (pf->indio_dev->dev.parent == trig->dev.parent) trig->attached_own_device = true; return ret; out_free_irq: free_irq(pf->irq, pf); out_put_irq: iio_trigger_put_irq(trig, pf->irq); out_put_module: module_put(pf->indio_dev->info->driver_module); return ret; }

Contributors

PersonTokensPropCommitsCommitProp
Jonathan Cameron13064.36%666.67%
Crestez Dan Leonard4823.76%111.11%
Linus Walleij2311.39%111.11%
Peter Meerwald-Stadler10.50%111.11%
Total202100.00%9100.00%


static int iio_trigger_detach_poll_func(struct iio_trigger *trig, struct iio_poll_func *pf) { int ret = 0; bool no_other_users = (bitmap_weight(trig->pool, CONFIG_IIO_CONSUMERS_PER_TRIGGER) == 1); if (trig->ops->set_trigger_state && no_other_users) { ret = trig->ops->set_trigger_state(trig, false); if (ret) return ret; } if (pf->indio_dev->dev.parent == trig->dev.parent) trig->attached_own_device = false; iio_trigger_put_irq(trig, pf->irq); free_irq(pf->irq, pf); module_put(pf->indio_dev->info->driver_module); return ret; }

Contributors

PersonTokensPropCommitsCommitProp
Jonathan Cameron9778.86%666.67%
Linus Walleij2217.89%111.11%
Hartmut Knaack32.44%111.11%
Peter Meerwald-Stadler10.81%111.11%
Total123100.00%9100.00%


irqreturn_t iio_pollfunc_store_time(int irq, void *p) { struct iio_poll_func *pf = p; pf->timestamp = iio_get_time_ns(pf->indio_dev); return IRQ_WAKE_THREAD; }

Contributors

PersonTokensPropCommitsCommitProp
Jonathan Cameron2884.85%150.00%
Grégor Boirie515.15%150.00%
Total33100.00%2100.00%

EXPORT_SYMBOL(iio_pollfunc_store_time);
struct iio_poll_func *iio_alloc_pollfunc(irqreturn_t (*h)(int irq, void *p), irqreturn_t (*thread)(int irq, void *p), int type, struct iio_dev *indio_dev, const char *fmt, ...) { va_list vargs; struct iio_poll_func *pf; pf = kmalloc(sizeof *pf, GFP_KERNEL); if (pf == NULL) return NULL; va_start(vargs, fmt); pf->name = kvasprintf(GFP_KERNEL, fmt, vargs); va_end(vargs); if (pf->name == NULL) { kfree(pf); return NULL; } pf->h = h; pf->thread = thread; pf->type = type; pf->indio_dev = indio_dev; return pf; }

Contributors

PersonTokensPropCommitsCommitProp
Jonathan Cameron14497.30%266.67%
Michael Hennerich42.70%133.33%
Total148100.00%3100.00%

EXPORT_SYMBOL_GPL(iio_alloc_pollfunc);
void iio_dealloc_pollfunc(struct iio_poll_func *pf) { kfree(pf->name); kfree(pf); }

Contributors

PersonTokensPropCommitsCommitProp
Jonathan Cameron22100.00%1100.00%
Total22100.00%1100.00%

EXPORT_SYMBOL_GPL(iio_dealloc_pollfunc); /** * iio_trigger_read_current() - trigger consumer sysfs query current trigger * @dev: device associated with an industrial I/O device * @attr: pointer to the device_attribute structure that * is being processed * @buf: buffer where the current trigger name will be printed into * * For trigger consumers the current_trigger interface allows the trigger * used by the device to be queried. * * Return: a negative number on failure, the number of characters written * on success or 0 if no trigger is available */
static ssize_t iio_trigger_read_current(struct device *dev, struct device_attribute *attr, char *buf) { struct iio_dev *indio_dev = dev_to_iio_dev(dev); if (indio_dev->trig) return sprintf(buf, "%s\n", indio_dev->trig->name); return 0; }

Contributors

PersonTokensPropCommitsCommitProp
Jonathan Cameron5298.11%480.00%
Lars-Peter Clausen11.89%120.00%
Total53100.00%5100.00%

/** * iio_trigger_write_current() - trigger consumer sysfs set current trigger * @dev: device associated with an industrial I/O device * @attr: device attribute that is being processed * @buf: string buffer that holds the name of the trigger * @len: length of the trigger name held by buf * * For trigger consumers the current_trigger interface allows the trigger * used for this device to be specified at run time based on the trigger's * name. * * Return: negative error code on failure or length of the buffer * on success */
static ssize_t iio_trigger_write_current(struct device *dev, struct device_attribute *attr, const char *buf, size_t len) { struct iio_dev *indio_dev = dev_to_iio_dev(dev); struct iio_trigger *oldtrig = indio_dev->trig; struct iio_trigger *trig; int ret; mutex_lock(&indio_dev->mlock); if (indio_dev->currentmode == INDIO_BUFFER_TRIGGERED) { mutex_unlock(&indio_dev->mlock); return -EBUSY; } if (indio_dev->trig_readonly) { mutex_unlock(&indio_dev->mlock); return -EPERM; } mutex_unlock(&indio_dev->mlock); trig = iio_trigger_acquire_by_name(buf); if (oldtrig == trig) { ret = len; goto out_trigger_put; } if (trig && indio_dev->info->validate_trigger) { ret = indio_dev->info->validate_trigger(indio_dev, trig); if (ret) goto out_trigger_put; } if (trig && trig->ops->validate_device) { ret = trig->ops->validate_device(trig, indio_dev); if (ret) goto out_trigger_put; } indio_dev->trig = trig; if (oldtrig) { if (indio_dev->modes & INDIO_EVENT_TRIGGERED) iio_trigger_detach_poll_func(oldtrig, indio_dev->pollfunc_event); iio_trigger_put(oldtrig); } if (indio_dev->trig) { if (indio_dev->modes & INDIO_EVENT_TRIGGERED) iio_trigger_attach_poll_func(indio_dev->trig, indio_dev->pollfunc_event); } return len; out_trigger_put: if (trig) iio_trigger_put(trig); return ret; }

Contributors

PersonTokensPropCommitsCommitProp
Jonathan Cameron11943.59%541.67%
Michael Hennerich6323.08%18.33%
Vladimir Barinov4014.65%18.33%
Alison Schofield259.16%18.33%
Matthew Ranostay207.33%18.33%
Marcin Niestroj41.47%18.33%
Lars-Peter Clausen20.73%216.67%
Total273100.00%12100.00%

static DEVICE_ATTR(current_trigger, S_IRUGO | S_IWUSR, iio_trigger_read_current, iio_trigger_write_current); static struct attribute *iio_trigger_consumer_attrs[] = { &dev_attr_current_trigger.attr, NULL, }; static const struct attribute_group iio_trigger_consumer_attr_group = { .name = "trigger", .attrs = iio_trigger_consumer_attrs, };
static void iio_trig_release(struct device *device) { struct iio_trigger *trig = to_iio_trigger(device); int i; if (trig->subirq_base) { for (i = 0; i < CONFIG_IIO_CONSUMERS_PER_TRIGGER; i++) { irq_modify_status(trig->subirq_base + i, IRQ_NOAUTOEN, IRQ_NOREQUEST | IRQ_NOPROBE); irq_set_chip(trig->subirq_base + i, NULL); irq_set_handler(trig->subirq_base + i, NULL); } irq_free_descs(trig->subirq_base, CONFIG_IIO_CONSUMERS_PER_TRIGGER); } kfree(trig->name); kfree(trig); }

Contributors

PersonTokensPropCommitsCommitProp
Jonathan Cameron105100.00%3100.00%
Total105100.00%3100.00%

static const struct device_type iio_trig_type = { .release = iio_trig_release, .groups = iio_trig_dev_groups, };
static void iio_trig_subirqmask(struct irq_data *d) { struct irq_chip *chip = irq_data_get_irq_chip(d); struct iio_trigger *trig = container_of(chip, struct iio_trigger, subirq_chip); trig->subirqs[d->irq - trig->subirq_base].enabled = false; }

Contributors

PersonTokensPropCommitsCommitProp
Jonathan Cameron53100.00%2100.00%
Total53100.00%2100.00%


static void iio_trig_subirqunmask(struct irq_data *d) { struct irq_chip *chip = irq_data_get_irq_chip(d); struct iio_trigger *trig = container_of(chip, struct iio_trigger, subirq_chip); trig->subirqs[d->irq - trig->subirq_base].enabled = true; }

Contributors

PersonTokensPropCommitsCommitProp
Jonathan Cameron53100.00%2100.00%
Total53100.00%2100.00%


static struct iio_trigger *viio_trigger_alloc(const char *fmt, va_list vargs) { struct iio_trigger *trig; int i; trig = kzalloc(sizeof *trig, GFP_KERNEL); if (!trig) return NULL; trig->dev.type = &iio_trig_type; trig->dev.bus = &iio_bus_type; device_initialize(&trig->dev); mutex_init(&trig->pool_lock); trig->subirq_base = irq_alloc_descs(-1, 0, CONFIG_IIO_CONSUMERS_PER_TRIGGER, 0); if (trig->subirq_base < 0) goto free_trig; trig->name = kvasprintf(GFP_KERNEL, fmt, vargs); if (trig->name == NULL) goto free_descs; trig->subirq_chip.name = trig->name; trig->subirq_chip.irq_mask = &iio_trig_subirqmask; trig->subirq_chip.irq_unmask = &iio_trig_subirqunmask; for (i = 0; i < CONFIG_IIO_CONSUMERS_PER_TRIGGER; i++) { irq_set_chip(trig->subirq_base + i, &trig->subirq_chip); irq_set_handler(trig->subirq_base + i, &handle_simple_irq); irq_modify_status(trig->subirq_base + i, IRQ_NOREQUEST | IRQ_NOAUTOEN, IRQ_NOPROBE); } get_device(&trig->dev); return trig; free_descs: irq_free_descs(trig->subirq_base, CONFIG_IIO_CONSUMERS_PER_TRIGGER); free_trig: kfree(trig); return NULL; }

Contributors

PersonTokensPropCommitsCommitProp
Jonathan Cameron20684.43%571.43%
Dan Carpenter3413.93%114.29%
Jacek Anaszewski41.64%114.29%
Total244100.00%7100.00%


struct iio_trigger *iio_trigger_alloc(const char *fmt, ...) { struct iio_trigger *trig; va_list vargs; va_start(vargs, fmt); trig = viio_trigger_alloc(fmt, vargs); va_end(vargs); return trig; }

Contributors

PersonTokensPropCommitsCommitProp
Jacek Anaszewski46100.00%1100.00%
Total46100.00%1100.00%

EXPORT_SYMBOL(iio_trigger_alloc);
void iio_trigger_free(struct iio_trigger *trig) { if (trig) put_device(&trig->dev); }

Contributors

PersonTokensPropCommitsCommitProp
Jonathan Cameron2195.45%150.00%
Lars-Peter Clausen14.55%150.00%
Total22100.00%2100.00%

EXPORT_SYMBOL(iio_trigger_free);
static void devm_iio_trigger_release(struct device *dev, void *res) { iio_trigger_free(*(struct iio_trigger **)res); }

Contributors

PersonTokensPropCommitsCommitProp
Jacek Anaszewski27100.00%1100.00%
Total27100.00%1100.00%


static int devm_iio_trigger_match(struct device *dev, void *res, void *data) { struct iio_trigger **r = res; if (!r || !*r) { WARN_ON(!r || !*r); return 0; } return *r == data; }

Contributors

PersonTokensPropCommitsCommitProp
Jacek Anaszewski57100.00%1100.00%
Total57100.00%1100.00%

/** * devm_iio_trigger_alloc - Resource-managed iio_trigger_alloc() * @dev: Device to allocate iio_trigger for * @fmt: trigger name format. If it includes format * specifiers, the additional arguments following * format are formatted and inserted in the resulting * string replacing their respective specifiers. * * Managed iio_trigger_alloc. iio_trigger allocated with this function is * automatically freed on driver detach. * * If an iio_trigger allocated with this function needs to be freed separately, * devm_iio_trigger_free() must be used. * * RETURNS: * Pointer to allocated iio_trigger on success, NULL on failure. */
struct iio_trigger *devm_iio_trigger_alloc(struct device *dev, const char *fmt, ...) { struct iio_trigger **ptr, *trig; va_list vargs; ptr = devres_alloc(devm_iio_trigger_release, sizeof(*ptr), GFP_KERNEL); if (!ptr) return NULL; /* use raw alloc_dr for kmalloc caller tracing */ va_start(vargs, fmt); trig = viio_trigger_alloc(fmt, vargs); va_end(vargs); if (trig) { *ptr = trig; devres_add(dev, ptr); } else { devres_free(ptr); } return trig; }

Contributors

PersonTokensPropCommitsCommitProp
Jacek Anaszewski105100.00%1100.00%
Total105100.00%1100.00%

EXPORT_SYMBOL_GPL(devm_iio_trigger_alloc); /** * devm_iio_trigger_free - Resource-managed iio_trigger_free() * @dev: Device this iio_dev belongs to * @iio_trig: the iio_trigger associated with the device * * Free iio_trigger allocated with devm_iio_trigger_alloc(). */
void devm_iio_trigger_free(struct device *dev, struct iio_trigger *iio_trig) { int rc; rc = devres_release(dev, devm_iio_trigger_release, devm_iio_trigger_match, iio_trig); WARN_ON(rc); }

Contributors

PersonTokensPropCommitsCommitProp
Jacek Anaszewski36100.00%1100.00%
Total36100.00%1100.00%

EXPORT_SYMBOL_GPL(devm_iio_trigger_free);
static void devm_iio_trigger_unreg(struct device *dev, void *res) { iio_trigger_unregister(*(struct iio_trigger **)res); }

Contributors

PersonTokensPropCommitsCommitProp
Grégor Boirie27100.00%1100.00%
Total27100.00%1100.00%

/** * devm_iio_trigger_register - Resource-managed iio_trigger_register() * @dev: device this trigger was allocated for * @trig_info: trigger to register * * Managed iio_trigger_register(). The IIO trigger registered with this * function is automatically unregistered on driver detach. This function * calls iio_trigger_register() internally. Refer to that function for more * information. * * If an iio_trigger registered with this function needs to be unregistered * separately, devm_iio_trigger_unregister() must be used. * * RETURNS: * 0 on success, negative error number on failure. */
int devm_iio_trigger_register(struct device *dev, struct iio_trigger *trig_info) { struct iio_trigger **ptr; int ret; ptr = devres_alloc(devm_iio_trigger_unreg, sizeof(*ptr), GFP_KERNEL); if (!ptr) return -ENOMEM; *ptr = trig_info; ret = iio_trigger_register(trig_info); if (!ret) devres_add(dev, ptr); else devres_free(ptr); return ret; }

Contributors

PersonTokensPropCommitsCommitProp
Grégor Boirie81100.00%1100.00%
Total81100.00%1100.00%

EXPORT_SYMBOL_GPL(devm_iio_trigger_register); /** * devm_iio_trigger_unregister - Resource-managed iio_trigger_unregister() * @dev: device this iio_trigger belongs to * @trig_info: the trigger associated with the device * * Unregister trigger registered with devm_iio_trigger_register(). */
void devm_iio_trigger_unregister(struct device *dev, struct iio_trigger *trig_info) { int rc; rc = devres_release(dev, devm_iio_trigger_unreg, devm_iio_trigger_match, trig_info); WARN_ON(rc); }

Contributors

PersonTokensPropCommitsCommitProp
Grégor Boirie36100.00%1100.00%
Total36100.00%1100.00%

EXPORT_SYMBOL_GPL(devm_iio_trigger_unregister);
bool iio_trigger_using_own(struct iio_dev *indio_dev) { return indio_dev->trig->attached_own_device; }

Contributors

PersonTokensPropCommitsCommitProp
Linus Walleij17100.00%1100.00%
Total17100.00%1100.00%

EXPORT_SYMBOL(iio_trigger_using_own); /** * iio_trigger_validate_own_device - Check if a trigger and IIO device belong to * the same device * @trig: The IIO trigger to check * @indio_dev: the IIO device to check * * This function can be used as the validate_device callback for triggers that * can only be attached to their own device. * * Return: 0 if both the trigger and the IIO device belong to the same * device, -EINVAL otherwise. */
int iio_trigger_validate_own_device(struct iio_trigger *trig, struct iio_dev *indio_dev) { if (indio_dev->dev.parent != trig->dev.parent) return -EINVAL; return 0; }

Contributors

PersonTokensPropCommitsCommitProp
Lars-Peter Clausen36100.00%1100.00%
Total36100.00%1100.00%

EXPORT_SYMBOL(iio_trigger_validate_own_device);
void iio_device_register_trigger_consumer(struct iio_dev *indio_dev) { indio_dev->groups[indio_dev->groupcounter++] = &iio_trigger_consumer_attr_group; }

Contributors

PersonTokensPropCommitsCommitProp
Jonathan Cameron23100.00%4100.00%
Total23100.00%4100.00%


void iio_device_unregister_trigger_consumer(struct iio_dev *indio_dev) { /* Clean up an associated but not attached trigger reference */ if (indio_dev->trig) iio_trigger_put(indio_dev->trig); }

Contributors

PersonTokensPropCommitsCommitProp
Jonathan Cameron2291.67%466.67%
Peter Meerwald-Stadler14.17%116.67%
Lars-Peter Clausen14.17%116.67%
Total24100.00%6100.00%


int iio_triggered_buffer_postenable(struct iio_dev *indio_dev) { return iio_trigger_attach_poll_func(indio_dev->trig, indio_dev->pollfunc); }

Contributors

PersonTokensPropCommitsCommitProp
Jonathan Cameron22100.00%2100.00%
Total22100.00%2100.00%

EXPORT_SYMBOL(iio_triggered_buffer_postenable);
int iio_triggered_buffer_predisable(struct iio_dev *indio_dev) { return iio_trigger_detach_poll_func(indio_dev->trig, indio_dev->pollfunc); }

Contributors

PersonTokensPropCommitsCommitProp
Jonathan Cameron2195.45%266.67%
Peter Meerwald-Stadler14.55%133.33%
Total22100.00%3100.00%

EXPORT_SYMBOL(iio_triggered_buffer_predisable);

Overall Contributors

PersonTokensPropCommitsCommitProp
Jonathan Cameron186863.56%3152.54%
Jacek Anaszewski2859.70%11.69%
Grégor Boirie1615.48%23.39%
Crestez Dan Leonard1495.07%23.39%
Lars-Peter Clausen1113.78%610.17%
Matthew Ranostay933.16%11.69%
Michael Hennerich672.28%23.39%
Linus Walleij672.28%11.69%
Vladimir Barinov401.36%11.69%
Dan Carpenter341.16%11.69%
Alison Schofield311.05%11.69%
Axel Lin60.20%11.69%
Peter Meerwald-Stadler60.20%23.39%
Hartmut Knaack50.17%11.69%
Marcin Niestroj40.14%11.69%
Cristina Opriceana30.10%11.69%
Tejun Heo30.10%11.69%
Greg Kroah-Hartman30.10%11.69%
Sachin Kamat20.07%11.69%
Bhumika Goyal10.03%11.69%
Total2939100.00%59100.00%
Directory: drivers/iio
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.
Created with cregit.