staging:iio: remove legacy event chrdev for the buffers
part of sca3000 driver temporarily disabled (buffer won't run anyway). This section is replaced later in this patch set. Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
parent
a7348347ba
commit
b9d40a9d55
6 changed files with 5 additions and 103 deletions
|
@ -357,6 +357,7 @@ void sca3000_register_ring_funcs(struct iio_dev *indio_dev)
|
||||||
**/
|
**/
|
||||||
void sca3000_ring_int_process(u8 val, struct iio_ring_buffer *ring)
|
void sca3000_ring_int_process(u8 val, struct iio_ring_buffer *ring)
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
if (val & SCA3000_INT_STATUS_THREE_QUARTERS)
|
if (val & SCA3000_INT_STATUS_THREE_QUARTERS)
|
||||||
iio_push_ring_event(ring,
|
iio_push_ring_event(ring,
|
||||||
IIO_EVENT_CODE_RING_75_FULL,
|
IIO_EVENT_CODE_RING_75_FULL,
|
||||||
|
@ -364,4 +365,5 @@ void sca3000_ring_int_process(u8 val, struct iio_ring_buffer *ring)
|
||||||
else if (val & SCA3000_INT_STATUS_HALF)
|
else if (val & SCA3000_INT_STATUS_HALF)
|
||||||
iio_push_ring_event(ring,
|
iio_push_ring_event(ring,
|
||||||
IIO_EVENT_CODE_RING_50_FULL, 0);
|
IIO_EVENT_CODE_RING_50_FULL, 0);
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
|
@ -399,20 +399,6 @@ int __iio_push_event(struct iio_event_interface *ev_int,
|
||||||
int ev_code,
|
int ev_code,
|
||||||
s64 timestamp);
|
s64 timestamp);
|
||||||
|
|
||||||
/**
|
|
||||||
* iio_setup_ev_int() - configure an event interface (chrdev)
|
|
||||||
* @name: name used for resulting sysfs directory etc.
|
|
||||||
* @ev_int: interface we are configuring
|
|
||||||
* @owner: module that is responsible for registering this ev_int
|
|
||||||
* @dev: device whose ev_int this is
|
|
||||||
**/
|
|
||||||
int iio_setup_ev_int(struct iio_event_interface *ev_int,
|
|
||||||
const char *name,
|
|
||||||
struct module *owner,
|
|
||||||
struct device *dev);
|
|
||||||
|
|
||||||
void iio_free_ev_int(struct iio_event_interface *ev_int);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* iio_allocate_chrdev() - Allocate a chrdev
|
* iio_allocate_chrdev() - Allocate a chrdev
|
||||||
* @handler: struct that contains relevant file handling for chrdev
|
* @handler: struct that contains relevant file handling for chrdev
|
||||||
|
|
|
@ -393,7 +393,7 @@ void iio_device_free_chrdev_minor(int val)
|
||||||
spin_unlock(&iio_ida_lock);
|
spin_unlock(&iio_ida_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
int iio_setup_ev_int(struct iio_event_interface *ev_int,
|
static int iio_setup_ev_int(struct iio_event_interface *ev_int,
|
||||||
const char *name,
|
const char *name,
|
||||||
struct module *owner,
|
struct module *owner,
|
||||||
struct device *dev)
|
struct device *dev)
|
||||||
|
@ -445,7 +445,7 @@ error_device_put:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void iio_free_ev_int(struct iio_event_interface *ev_int)
|
static void iio_free_ev_int(struct iio_event_interface *ev_int)
|
||||||
{
|
{
|
||||||
device_unregister(&ev_int->dev);
|
device_unregister(&ev_int->dev);
|
||||||
put_device(&ev_int->dev);
|
put_device(&ev_int->dev);
|
||||||
|
|
|
@ -23,16 +23,6 @@
|
||||||
#include "iio.h"
|
#include "iio.h"
|
||||||
#include "ring_generic.h"
|
#include "ring_generic.h"
|
||||||
|
|
||||||
int iio_push_ring_event(struct iio_ring_buffer *ring_buf,
|
|
||||||
int event_code,
|
|
||||||
s64 timestamp)
|
|
||||||
{
|
|
||||||
return __iio_push_event(&ring_buf->ev_int,
|
|
||||||
event_code,
|
|
||||||
timestamp);
|
|
||||||
}
|
|
||||||
EXPORT_SYMBOL(iio_push_ring_event);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* iio_ring_open() - chrdev file open for ring buffer access
|
* iio_ring_open() - chrdev file open for ring buffer access
|
||||||
*
|
*
|
||||||
|
@ -116,43 +106,6 @@ static const struct file_operations iio_ring_fileops = {
|
||||||
.llseek = noop_llseek,
|
.llseek = noop_llseek,
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* __iio_request_ring_buffer_event_chrdev() - allocate ring event chrdev
|
|
||||||
* @buf: ring buffer whose event chrdev we are allocating
|
|
||||||
* @id: id of this ring buffer (typically 0)
|
|
||||||
* @owner: the module who owns the ring buffer (for ref counting)
|
|
||||||
* @dev: device with which the chrdev is associated
|
|
||||||
**/
|
|
||||||
static inline int
|
|
||||||
__iio_request_ring_buffer_event_chrdev(struct iio_ring_buffer *buf,
|
|
||||||
int id,
|
|
||||||
struct module *owner,
|
|
||||||
struct device *dev)
|
|
||||||
{
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
snprintf(buf->ev_int._name, sizeof(buf->ev_int._name),
|
|
||||||
"%s:event%d",
|
|
||||||
dev_name(&buf->dev),
|
|
||||||
id);
|
|
||||||
ret = iio_setup_ev_int(&(buf->ev_int),
|
|
||||||
buf->ev_int._name,
|
|
||||||
owner,
|
|
||||||
dev);
|
|
||||||
if (ret)
|
|
||||||
goto error_ret;
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
error_ret:
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void
|
|
||||||
__iio_free_ring_buffer_event_chrdev(struct iio_ring_buffer *buf)
|
|
||||||
{
|
|
||||||
iio_free_ev_int(&(buf->ev_int));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void iio_ring_access_release(struct device *dev)
|
static void iio_ring_access_release(struct device *dev)
|
||||||
{
|
{
|
||||||
struct iio_ring_buffer *buf
|
struct iio_ring_buffer *buf
|
||||||
|
@ -227,7 +180,6 @@ void iio_ring_buffer_init(struct iio_ring_buffer *ring,
|
||||||
if (ring->access.mark_param_change)
|
if (ring->access.mark_param_change)
|
||||||
ring->access.mark_param_change(ring);
|
ring->access.mark_param_change(ring);
|
||||||
ring->indio_dev = dev_info;
|
ring->indio_dev = dev_info;
|
||||||
ring->ev_int.private = ring;
|
|
||||||
ring->access_handler.private = ring;
|
ring->access_handler.private = ring;
|
||||||
init_waitqueue_head(&ring->pollq);
|
init_waitqueue_head(&ring->pollq);
|
||||||
}
|
}
|
||||||
|
@ -399,19 +351,12 @@ int iio_ring_buffer_register_ex(struct iio_ring_buffer *ring, int id,
|
||||||
if (ret)
|
if (ret)
|
||||||
goto error_ret;
|
goto error_ret;
|
||||||
|
|
||||||
ret = __iio_request_ring_buffer_event_chrdev(ring,
|
|
||||||
0,
|
|
||||||
ring->owner,
|
|
||||||
&ring->dev);
|
|
||||||
if (ret)
|
|
||||||
goto error_remove_device;
|
|
||||||
|
|
||||||
ret = __iio_request_ring_buffer_access_chrdev(ring,
|
ret = __iio_request_ring_buffer_access_chrdev(ring,
|
||||||
0,
|
0,
|
||||||
ring->owner);
|
ring->owner);
|
||||||
|
|
||||||
if (ret)
|
if (ret)
|
||||||
goto error_ret;
|
goto error_remove_device;
|
||||||
|
|
||||||
if (ring->scan_el_attrs) {
|
if (ring->scan_el_attrs) {
|
||||||
ret = sysfs_create_group(&ring->dev.kobj,
|
ret = sysfs_create_group(&ring->dev.kobj,
|
||||||
|
@ -462,7 +407,6 @@ void iio_ring_buffer_unregister(struct iio_ring_buffer *ring)
|
||||||
{
|
{
|
||||||
__iio_ring_attr_cleanup(ring);
|
__iio_ring_attr_cleanup(ring);
|
||||||
__iio_free_ring_buffer_access_chrdev(ring);
|
__iio_free_ring_buffer_access_chrdev(ring);
|
||||||
__iio_free_ring_buffer_event_chrdev(ring);
|
|
||||||
device_del(&ring->dev);
|
device_del(&ring->dev);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(iio_ring_buffer_unregister);
|
EXPORT_SYMBOL(iio_ring_buffer_unregister);
|
||||||
|
|
|
@ -15,29 +15,6 @@
|
||||||
|
|
||||||
struct iio_ring_buffer;
|
struct iio_ring_buffer;
|
||||||
|
|
||||||
/**
|
|
||||||
* iio_push_ring_event() - ring buffer specific push to event chrdev
|
|
||||||
* @ring_buf: ring buffer that is the event source
|
|
||||||
* @event_code: event indentification code
|
|
||||||
* @timestamp: time of event
|
|
||||||
**/
|
|
||||||
int iio_push_ring_event(struct iio_ring_buffer *ring_buf,
|
|
||||||
int event_code,
|
|
||||||
s64 timestamp);
|
|
||||||
/**
|
|
||||||
* iio_push_or_escallate_ring_event() - escalate or add as appropriate
|
|
||||||
* @ring_buf: ring buffer that is the event source
|
|
||||||
* @event_code: event indentification code
|
|
||||||
* @timestamp: time of event
|
|
||||||
*
|
|
||||||
* Typical usecase is to escalate a 50% ring full to 75% full if no one has yet
|
|
||||||
* read the first event. Clearly the 50% full is no longer of interest in
|
|
||||||
* typical use case.
|
|
||||||
**/
|
|
||||||
int iio_push_or_escallate_ring_event(struct iio_ring_buffer *ring_buf,
|
|
||||||
int event_code,
|
|
||||||
s64 timestamp);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* struct iio_ring_access_funcs - access functions for ring buffers.
|
* struct iio_ring_access_funcs - access functions for ring buffers.
|
||||||
* @mark_in_use: reference counting, typically to prevent module removal
|
* @mark_in_use: reference counting, typically to prevent module removal
|
||||||
|
@ -106,7 +83,6 @@ struct iio_ring_access_funcs {
|
||||||
* @scan_mask: [INTERN] bitmask used in masking scan mode elements
|
* @scan_mask: [INTERN] bitmask used in masking scan mode elements
|
||||||
* @scan_timestamp: [INTERN] does the scan mode include a timestamp
|
* @scan_timestamp: [INTERN] does the scan mode include a timestamp
|
||||||
* @access_handler: [INTERN] chrdev access handling
|
* @access_handler: [INTERN] chrdev access handling
|
||||||
* @ev_int: [INTERN] chrdev interface for the event chrdev
|
|
||||||
* @access: [DRIVER] ring access functions associated with the
|
* @access: [DRIVER] ring access functions associated with the
|
||||||
* implementation.
|
* implementation.
|
||||||
* @preenable: [DRIVER] function to run prior to marking ring enabled
|
* @preenable: [DRIVER] function to run prior to marking ring enabled
|
||||||
|
@ -130,7 +106,6 @@ struct iio_ring_buffer {
|
||||||
u32 scan_mask;
|
u32 scan_mask;
|
||||||
bool scan_timestamp;
|
bool scan_timestamp;
|
||||||
struct iio_handler access_handler;
|
struct iio_handler access_handler;
|
||||||
struct iio_event_interface ev_int;
|
|
||||||
struct iio_ring_access_funcs access;
|
struct iio_ring_access_funcs access;
|
||||||
int (*preenable)(struct iio_dev *);
|
int (*preenable)(struct iio_dev *);
|
||||||
int (*postenable)(struct iio_dev *);
|
int (*postenable)(struct iio_dev *);
|
||||||
|
|
|
@ -69,7 +69,6 @@ static int iio_store_to_sw_ring(struct iio_sw_ring_buffer *ring,
|
||||||
unsigned char *data, s64 timestamp)
|
unsigned char *data, s64 timestamp)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
int code;
|
|
||||||
unsigned char *temp_ptr, *change_test_ptr;
|
unsigned char *temp_ptr, *change_test_ptr;
|
||||||
|
|
||||||
/* initial store */
|
/* initial store */
|
||||||
|
@ -133,10 +132,6 @@ static int iio_store_to_sw_ring(struct iio_sw_ring_buffer *ring,
|
||||||
if (ring->half_p == ring->data + ring->buf.length*ring->buf.bytes_per_datum)
|
if (ring->half_p == ring->data + ring->buf.length*ring->buf.bytes_per_datum)
|
||||||
ring->half_p = ring->data;
|
ring->half_p = ring->data;
|
||||||
if (ring->half_p == ring->read_p) {
|
if (ring->half_p == ring->read_p) {
|
||||||
code = IIO_EVENT_CODE_RING_50_FULL;
|
|
||||||
ret = __iio_push_event(&ring->buf.ev_int,
|
|
||||||
code,
|
|
||||||
timestamp);
|
|
||||||
ring->buf.stufftoread = true;
|
ring->buf.stufftoread = true;
|
||||||
wake_up_interruptible(&ring->buf.pollq);
|
wake_up_interruptible(&ring->buf.pollq);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue