static ssize_t show_max_read_buffer_kb(struct device *csdev,
struct device_attribute *attr, char *buf)
{
- struct comedi_file_info *info = dev_get_drvdata(csdev);
+ unsigned int minor = MINOR(csdev->devt);
+ struct comedi_file_info *info;
struct comedi_device *dev;
struct comedi_subdevice *s;
unsigned int size = 0;
+ info = comedi_file_info_from_minor(minor);
+ if (!info)
+ return -ENODEV;
+
dev = info->device;
mutex_lock(&dev->mutex);
s = comedi_read_subdevice(info);
struct device_attribute *attr,
const char *buf, size_t count)
{
- struct comedi_file_info *info = dev_get_drvdata(csdev);
+ unsigned int minor = MINOR(csdev->devt);
+ struct comedi_file_info *info;
struct comedi_device *dev;
struct comedi_subdevice *s;
unsigned int size;
return -EINVAL;
size *= 1024;
+ info = comedi_file_info_from_minor(minor);
+ if (!info)
+ return -ENODEV;
+
dev = info->device;
mutex_lock(&dev->mutex);
s = comedi_read_subdevice(info);
static ssize_t show_read_buffer_kb(struct device *csdev,
struct device_attribute *attr, char *buf)
{
- struct comedi_file_info *info = dev_get_drvdata(csdev);
+ unsigned int minor = MINOR(csdev->devt);
+ struct comedi_file_info *info;
struct comedi_device *dev;
struct comedi_subdevice *s;
unsigned int size = 0;
+ info = comedi_file_info_from_minor(minor);
+ if (!info)
+ return -ENODEV;
+
dev = info->device;
mutex_lock(&dev->mutex);
s = comedi_read_subdevice(info);
struct device_attribute *attr,
const char *buf, size_t count)
{
- struct comedi_file_info *info = dev_get_drvdata(csdev);
+ unsigned int minor = MINOR(csdev->devt);
+ struct comedi_file_info *info;
struct comedi_device *dev;
struct comedi_subdevice *s;
unsigned int size;
return -EINVAL;
size *= 1024;
+ info = comedi_file_info_from_minor(minor);
+ if (!info)
+ return -ENODEV;
+
dev = info->device;
mutex_lock(&dev->mutex);
s = comedi_read_subdevice(info);
struct device_attribute *attr,
char *buf)
{
- struct comedi_file_info *info = dev_get_drvdata(csdev);
+ unsigned int minor = MINOR(csdev->devt);
+ struct comedi_file_info *info;
struct comedi_device *dev;
struct comedi_subdevice *s;
unsigned int size = 0;
+ info = comedi_file_info_from_minor(minor);
+ if (!info)
+ return -ENODEV;
+
dev = info->device;
mutex_lock(&dev->mutex);
s = comedi_write_subdevice(info);
struct device_attribute *attr,
const char *buf, size_t count)
{
- struct comedi_file_info *info = dev_get_drvdata(csdev);
+ unsigned int minor = MINOR(csdev->devt);
+ struct comedi_file_info *info;
struct comedi_device *dev;
struct comedi_subdevice *s;
unsigned int size;
return -EINVAL;
size *= 1024;
+ info = comedi_file_info_from_minor(minor);
+ if (!info)
+ return -ENODEV;
+
dev = info->device;
mutex_lock(&dev->mutex);
s = comedi_write_subdevice(info);
static ssize_t show_write_buffer_kb(struct device *csdev,
struct device_attribute *attr, char *buf)
{
- struct comedi_file_info *info = dev_get_drvdata(csdev);
+ unsigned int minor = MINOR(csdev->devt);
+ struct comedi_file_info *info;
struct comedi_device *dev;
struct comedi_subdevice *s;
unsigned int size = 0;
+ info = comedi_file_info_from_minor(minor);
+ if (!info)
+ return -ENODEV;
+
dev = info->device;
mutex_lock(&dev->mutex);
s = comedi_write_subdevice(info);
struct device_attribute *attr,
const char *buf, size_t count)
{
- struct comedi_file_info *info = dev_get_drvdata(csdev);
+ unsigned int minor = MINOR(csdev->devt);
+ struct comedi_file_info *info;
struct comedi_device *dev;
struct comedi_subdevice *s;
unsigned int size;
return -EINVAL;
size *= 1024;
+ info = comedi_file_info_from_minor(minor);
+ if (!info)
+ return -ENODEV;
+
dev = info->device;
mutex_lock(&dev->mutex);
s = comedi_write_subdevice(info);
MKDEV(COMEDI_MAJOR, i), NULL, "comedi%i", i);
if (!IS_ERR(csdev))
dev->class_dev = csdev;
- dev_set_drvdata(csdev, info);
/* Note: dev->mutex needs to be unlocked by the caller. */
return dev;
dev->minor, s->index);
if (!IS_ERR(csdev))
s->class_dev = csdev;
- dev_set_drvdata(csdev, info);
return 0;
}