Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 249855
b: refs/heads/master
c: 3b8ebfb
h: refs/heads/master
i:
  249853: 2b6a9b9
  249851: 749dcb8
  249847: 5eb4291
  249839: 9e82401
  249823: 15e45f4
  249791: efdca3c
  249727: 2c2c4cd
  249599: c8671a1
  249343: bd5b9c4
  248831: 9b1fade
  247807: 3d0bcdc
  245759: ce03e5c
v: v3
  • Loading branch information
Jonathan Cameron authored and Greg Kroah-Hartman committed May 19, 2011
1 parent 505a74e commit 097017c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 19 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: d731aea081dc96b91be680c23b844f33aa4759e1
refs/heads/master: 3b8ebfb47f0cacc82c88b6f886ad84d78d6fdd61
8 changes: 1 addition & 7 deletions trunk/drivers/staging/iio/chrdev.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,24 +60,18 @@ struct iio_detected_event_list {
* @det_events: list of detected events
* @max_events: maximum number of events before new ones are dropped
* @current_events: number of events in detected list
* @owner: ensure the driver module owns the file, not iio
* @private: driver specific data
* @_name: used internally to store the sysfs name for minor id
* attribute
* @_attrname: the event interface's attribute name
*/
struct iio_event_interface {
struct device dev;
struct iio_handler handler;
wait_queue_head_t wait;
struct mutex event_list_lock;
struct iio_detected_event_list det_events;
struct list_head det_events;
int max_events;
int current_events;
struct module *owner;
void *private;
char _name[35];
char _attrname[20];
struct list_head dev_attr_list;
};

Expand Down
18 changes: 7 additions & 11 deletions trunk/drivers/staging/iio/industrialio-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ int iio_push_event(struct iio_dev *dev_info,
ev->ev.id = ev_code;
ev->ev.timestamp = timestamp;

list_add_tail(&ev->list, &ev_int->det_events.list);
list_add_tail(&ev->list, &ev_int->det_events);
ev_int->current_events++;
mutex_unlock(&ev_int->event_list_lock);
wake_up_interruptible(&ev_int->wait);
Expand Down Expand Up @@ -146,7 +146,7 @@ static ssize_t iio_event_chrdev_read(struct file *filep,
size_t len;

mutex_lock(&ev_int->event_list_lock);
if (list_empty(&ev_int->det_events.list)) {
if (list_empty(&ev_int->det_events)) {
if (filep->f_flags & O_NONBLOCK) {
ret = -EAGAIN;
goto error_mutex_unlock;
Expand All @@ -155,14 +155,14 @@ static ssize_t iio_event_chrdev_read(struct file *filep,
/* Blocking on device; waiting for something to be there */
ret = wait_event_interruptible(ev_int->wait,
!list_empty(&ev_int
->det_events.list));
->det_events));
if (ret)
goto error_ret;
/* Single access device so no one else can get the data */
mutex_lock(&ev_int->event_list_lock);
}

el = list_first_entry(&ev_int->det_events.list,
el = list_first_entry(&ev_int->det_events,
struct iio_detected_event_list,
list);
len = sizeof el->ev;
Expand Down Expand Up @@ -197,7 +197,7 @@ static int iio_event_chrdev_release(struct inode *inode, struct file *filep)
* clear out any awaiting events. The mask will prevent
* any new __iio_push_event calls running.
*/
list_for_each_entry_safe(el, t, &ev_int->det_events.list, list) {
list_for_each_entry_safe(el, t, &ev_int->det_events, list) {
list_del(&el->list);
kfree(el);
}
Expand Down Expand Up @@ -300,7 +300,7 @@ static int iio_setup_ev_int(struct iio_event_interface *ev_int,
/* discussion point - make this variable? */
ev_int->max_events = 10;
ev_int->current_events = 0;
INIT_LIST_HEAD(&ev_int->det_events.list);
INIT_LIST_HEAD(&ev_int->det_events);
init_waitqueue_head(&ev_int->wait);
ev_int->handler.private = ev_int;
ev_int->handler.flags = 0;
Expand Down Expand Up @@ -1041,17 +1041,13 @@ static int iio_device_register_eventset(struct iio_dev *dev_info)
}

for (i = 0; i < dev_info->num_interrupt_lines; i++) {
dev_info->event_interfaces[i].owner = dev_info->driver_module;

snprintf(dev_info->event_interfaces[i]._name, 20,
"%s:event%d",
dev_name(&dev_info->dev),
i);

ret = iio_setup_ev_int(&dev_info->event_interfaces[i],
(const char *)(dev_info
->event_interfaces[i]
._name),
dev_info->event_interfaces[i]._name,
dev_info->driver_module,
&dev_info->dev);
if (ret) {
Expand Down

0 comments on commit 097017c

Please sign in to comment.