"default maximum size of asynchronous buffer in KiB (default "
__MODULE_STRING(CONFIG_COMEDI_DEFAULT_BUF_MAXSIZE_KB) ")");
-struct comedi_device_file_info {
+struct comedi_file_info {
struct comedi_device *device;
struct comedi_subdevice *read_subdevice;
struct comedi_subdevice *write_subdevice;
};
static DEFINE_SPINLOCK(comedi_file_info_table_lock);
-static struct comedi_device_file_info
-*comedi_file_info_table[COMEDI_NUM_MINORS];
+static struct comedi_file_info *comedi_file_info_table[COMEDI_NUM_MINORS];
-static struct comedi_device_file_info *
-comedi_get_device_file_info(unsigned minor)
+static struct comedi_file_info *comedi_get_device_file_info(unsigned minor)
{
- struct comedi_device_file_info *info;
+ struct comedi_file_info *info;
BUG_ON(minor >= COMEDI_NUM_MINORS);
spin_lock(&comedi_file_info_table_lock);
struct comedi_device *comedi_dev_from_minor(unsigned minor)
{
- struct comedi_device_file_info *info;
+ struct comedi_file_info *info;
info = comedi_get_device_file_info(minor);
EXPORT_SYMBOL_GPL(comedi_dev_from_minor);
static struct comedi_subdevice *
-comedi_get_read_subdevice(const struct comedi_device_file_info *info)
+comedi_get_read_subdevice(const struct comedi_file_info *info)
{
if (info->read_subdevice)
return info->read_subdevice;
}
static struct comedi_subdevice *
-comedi_get_write_subdevice(const struct comedi_device_file_info *info)
+comedi_get_write_subdevice(const struct comedi_file_info *info)
{
if (info->write_subdevice)
return info->write_subdevice;
static ssize_t show_max_read_buffer_kb(struct device *dev,
struct device_attribute *attr, char *buf)
{
- struct comedi_device_file_info *info = dev_get_drvdata(dev);
+ struct comedi_file_info *info = dev_get_drvdata(dev);
struct comedi_subdevice *s = comedi_get_read_subdevice(info);
unsigned int size = 0;
struct device_attribute *attr,
const char *buf, size_t count)
{
- struct comedi_device_file_info *info = dev_get_drvdata(dev);
+ struct comedi_file_info *info = dev_get_drvdata(dev);
struct comedi_subdevice *s = comedi_get_read_subdevice(info);
unsigned int size;
int err;
static ssize_t show_read_buffer_kb(struct device *dev,
struct device_attribute *attr, char *buf)
{
- struct comedi_device_file_info *info = dev_get_drvdata(dev);
+ struct comedi_file_info *info = dev_get_drvdata(dev);
struct comedi_subdevice *s = comedi_get_read_subdevice(info);
unsigned int size = 0;
struct device_attribute *attr,
const char *buf, size_t count)
{
- struct comedi_device_file_info *info = dev_get_drvdata(dev);
+ struct comedi_file_info *info = dev_get_drvdata(dev);
struct comedi_subdevice *s = comedi_get_read_subdevice(info);
unsigned int size;
int err;
struct device_attribute *attr,
char *buf)
{
- struct comedi_device_file_info *info = dev_get_drvdata(dev);
+ struct comedi_file_info *info = dev_get_drvdata(dev);
struct comedi_subdevice *s = comedi_get_write_subdevice(info);
unsigned int size = 0;
struct device_attribute *attr,
const char *buf, size_t count)
{
- struct comedi_device_file_info *info = dev_get_drvdata(dev);
+ struct comedi_file_info *info = dev_get_drvdata(dev);
struct comedi_subdevice *s = comedi_get_write_subdevice(info);
unsigned int size;
int err;
static ssize_t show_write_buffer_kb(struct device *dev,
struct device_attribute *attr, char *buf)
{
- struct comedi_device_file_info *info = dev_get_drvdata(dev);
+ struct comedi_file_info *info = dev_get_drvdata(dev);
struct comedi_subdevice *s = comedi_get_write_subdevice(info);
unsigned int size = 0;
struct device_attribute *attr,
const char *buf, size_t count)
{
- struct comedi_device_file_info *info = dev_get_drvdata(dev);
+ struct comedi_file_info *info = dev_get_drvdata(dev);
struct comedi_subdevice *s = comedi_get_write_subdevice(info);
unsigned int size;
int err;
{
struct comedi_devinfo devinfo;
const unsigned minor = iminor(file->f_dentry->d_inode);
- struct comedi_device_file_info *dev_file_info =
- comedi_get_device_file_info(minor);
+ struct comedi_file_info *info = comedi_get_device_file_info(minor);
struct comedi_subdevice *read_subdev =
- comedi_get_read_subdevice(dev_file_info);
+ comedi_get_read_subdevice(info);
struct comedi_subdevice *write_subdev =
- comedi_get_write_subdevice(dev_file_info);
+ comedi_get_write_subdevice(info);
memset(&devinfo, 0, sizeof(devinfo));
int i;
int retval;
struct comedi_subdevice *s;
- struct comedi_device_file_info *dev_file_info;
+ struct comedi_file_info *info = comedi_get_device_file_info(minor);
struct comedi_device *dev;
- dev_file_info = comedi_get_device_file_info(minor);
- if (dev_file_info == NULL)
+ if (info == NULL)
return -ENODEV;
- dev = dev_file_info->device;
+ dev = info->device;
if (dev == NULL)
return -ENODEV;
goto done;
}
if (vma->vm_flags & VM_WRITE)
- s = comedi_get_write_subdevice(dev_file_info);
+ s = comedi_get_write_subdevice(info);
else
- s = comedi_get_read_subdevice(dev_file_info);
+ s = comedi_get_read_subdevice(info);
if (s == NULL) {
retval = -EINVAL;
const unsigned minor = iminor(file->f_dentry->d_inode);
struct comedi_subdevice *read_subdev;
struct comedi_subdevice *write_subdev;
- struct comedi_device_file_info *dev_file_info;
+ struct comedi_file_info *info = comedi_get_device_file_info(minor);
struct comedi_device *dev;
- dev_file_info = comedi_get_device_file_info(minor);
- if (dev_file_info == NULL)
+ if (info == NULL)
return -ENODEV;
- dev = dev_file_info->device;
+ dev = info->device;
if (dev == NULL)
return -ENODEV;
}
mask = 0;
- read_subdev = comedi_get_read_subdevice(dev_file_info);
+ read_subdev = comedi_get_read_subdevice(info);
if (read_subdev) {
poll_wait(file, &read_subdev->async->wait_head, wait);
if (!read_subdev->busy
mask |= POLLIN | POLLRDNORM;
}
}
- write_subdev = comedi_get_write_subdevice(dev_file_info);
+ write_subdev = comedi_get_write_subdevice(info);
if (write_subdev) {
poll_wait(file, &write_subdev->async->wait_head, wait);
comedi_buf_write_alloc(write_subdev->async,
int n, m, count = 0, retval = 0;
DECLARE_WAITQUEUE(wait, current);
const unsigned minor = iminor(file->f_dentry->d_inode);
- struct comedi_device_file_info *dev_file_info;
+ struct comedi_file_info *info = comedi_get_device_file_info(minor);
struct comedi_device *dev;
- dev_file_info = comedi_get_device_file_info(minor);
- if (dev_file_info == NULL)
+ if (info == NULL)
return -ENODEV;
- dev = dev_file_info->device;
+ dev = info->device;
if (dev == NULL)
return -ENODEV;
goto done;
}
- s = comedi_get_write_subdevice(dev_file_info);
+ s = comedi_get_write_subdevice(info);
if (s == NULL) {
retval = -EIO;
goto done;
int n, m, count = 0, retval = 0;
DECLARE_WAITQUEUE(wait, current);
const unsigned minor = iminor(file->f_dentry->d_inode);
- struct comedi_device_file_info *dev_file_info;
+ struct comedi_file_info *info = comedi_get_device_file_info(minor);
struct comedi_device *dev;
- dev_file_info = comedi_get_device_file_info(minor);
- if (dev_file_info == NULL)
+ if (info == NULL)
return -ENODEV;
- dev = dev_file_info->device;
+ dev = info->device;
if (dev == NULL)
return -ENODEV;
goto done;
}
- s = comedi_get_read_subdevice(dev_file_info);
+ s = comedi_get_read_subdevice(info);
if (s == NULL) {
retval = -EIO;
goto done;
comedi_num_legacy_minors = 16;
memset(comedi_file_info_table, 0,
- sizeof(struct comedi_device_file_info *) * COMEDI_NUM_MINORS);
+ sizeof(struct comedi_file_info *) * COMEDI_NUM_MINORS);
retval = register_chrdev_region(MKDEV(COMEDI_MAJOR, 0),
COMEDI_NUM_MINORS, "comedi");
int comedi_alloc_board_minor(struct device *hardware_device)
{
- struct comedi_device_file_info *info;
+ struct comedi_file_info *info;
struct device *csdev;
unsigned i;
- info = kzalloc(sizeof(struct comedi_device_file_info), GFP_KERNEL);
+ info = kzalloc(sizeof(struct comedi_file_info), GFP_KERNEL);
if (info == NULL)
return -ENOMEM;
info->device = kzalloc(sizeof(struct comedi_device), GFP_KERNEL);
void comedi_free_board_minor(unsigned minor)
{
- struct comedi_device_file_info *info;
+ struct comedi_file_info *info;
BUG_ON(minor >= COMEDI_NUM_BOARD_MINORS);
spin_lock(&comedi_file_info_table_lock);
int comedi_find_board_minor(struct device *hardware_device)
{
int minor;
- struct comedi_device_file_info *info;
+ struct comedi_file_info *info;
for (minor = 0; minor < COMEDI_NUM_BOARD_MINORS; minor++) {
spin_lock(&comedi_file_info_table_lock);
int comedi_alloc_subdevice_minor(struct comedi_device *dev,
struct comedi_subdevice *s)
{
- struct comedi_device_file_info *info;
+ struct comedi_file_info *info;
struct device *csdev;
unsigned i;
- info = kmalloc(sizeof(struct comedi_device_file_info), GFP_KERNEL);
+ info = kmalloc(sizeof(struct comedi_file_info), GFP_KERNEL);
if (info == NULL)
return -ENOMEM;
info->device = dev;
void comedi_free_subdevice_minor(struct comedi_subdevice *s)
{
- struct comedi_device_file_info *info;
+ struct comedi_file_info *info;
if (s == NULL)
return;