Commit d1843132 authored by H Hartley Sweeten's avatar H Hartley Sweeten Committed by Greg Kroah-Hartman

staging: comedi: deprecate loading firmware with comedi_config

All the comedi drivers have been converted to use the request_firmware()
hotplug interface. The COMEDI_DEVCONFIG ioctl support for passing the
firmware blob as 'aux_data' is no longer required.

Remove the feature and give the user a dev_warn message if it is
attempted.
Signed-off-by: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent ba1bcf6f
...@@ -41,7 +41,17 @@ ...@@ -41,7 +41,17 @@
/* number of config options in the config structure */ /* number of config options in the config structure */
#define COMEDI_NDEVCONFOPTS 32 #define COMEDI_NDEVCONFOPTS 32
/*length of nth chunk of firmware data*/
/*
* NOTE: 'comedi_config --init-data' is deprecated
*
* The following indexes in the config options were used by
* comedi_config to pass firmware blobs from user space to the
* comedi drivers. The request_firmware() hotplug interface is
* now used by all comedi drivers instead.
*/
/* length of nth chunk of firmware data -*/
#define COMEDI_DEVCONF_AUX_DATA3_LENGTH 25 #define COMEDI_DEVCONF_AUX_DATA3_LENGTH 25
#define COMEDI_DEVCONF_AUX_DATA2_LENGTH 26 #define COMEDI_DEVCONF_AUX_DATA2_LENGTH 26
#define COMEDI_DEVCONF_AUX_DATA1_LENGTH 27 #define COMEDI_DEVCONF_AUX_DATA1_LENGTH 27
......
...@@ -469,8 +469,6 @@ static int do_devconfig_ioctl(struct comedi_device *dev, ...@@ -469,8 +469,6 @@ static int do_devconfig_ioctl(struct comedi_device *dev,
{ {
struct comedi_devconfig it; struct comedi_devconfig it;
int ret; int ret;
unsigned char *aux_data = NULL;
int aux_len;
if (!capable(CAP_SYS_ADMIN)) if (!capable(CAP_SYS_ADMIN))
return -EPERM; return -EPERM;
...@@ -491,31 +489,10 @@ static int do_devconfig_ioctl(struct comedi_device *dev, ...@@ -491,31 +489,10 @@ static int do_devconfig_ioctl(struct comedi_device *dev,
it.board_name[COMEDI_NAMELEN - 1] = 0; it.board_name[COMEDI_NAMELEN - 1] = 0;
if (comedi_aux_data(it.options, 0) && if (it.options[COMEDI_DEVCONF_AUX_DATA_LENGTH]) {
it.options[COMEDI_DEVCONF_AUX_DATA_LENGTH]) { dev_warn(dev->class_dev,
int bit_shift; "comedi_config --init_data is deprecated\n");
aux_len = it.options[COMEDI_DEVCONF_AUX_DATA_LENGTH]; return -EINVAL;
if (aux_len < 0)
return -EFAULT;
aux_data = vmalloc(aux_len);
if (!aux_data)
return -ENOMEM;
if (copy_from_user(aux_data,
(unsigned char __user *
)comedi_aux_data(it.options, 0), aux_len)) {
vfree(aux_data);
return -EFAULT;
}
it.options[COMEDI_DEVCONF_AUX_DATA_LO] =
(unsigned long)aux_data;
if (sizeof(void *) > sizeof(int)) {
bit_shift = sizeof(int) * 8;
it.options[COMEDI_DEVCONF_AUX_DATA_HI] =
((unsigned long)aux_data) >> bit_shift;
} else
it.options[COMEDI_DEVCONF_AUX_DATA_HI] = 0;
} }
ret = comedi_device_attach(dev, &it); ret = comedi_device_attach(dev, &it);
...@@ -526,9 +503,6 @@ static int do_devconfig_ioctl(struct comedi_device *dev, ...@@ -526,9 +503,6 @@ static int do_devconfig_ioctl(struct comedi_device *dev,
} }
} }
if (aux_data)
vfree(aux_data);
return ret; return ret;
} }
......
...@@ -461,31 +461,6 @@ static inline unsigned comedi_buf_read_n_allocated(struct comedi_async *async) ...@@ -461,31 +461,6 @@ static inline unsigned comedi_buf_read_n_allocated(struct comedi_async *async)
return async->buf_read_alloc_count - async->buf_read_count; return async->buf_read_alloc_count - async->buf_read_count;
} }
static inline void *comedi_aux_data(int options[], int n)
{
unsigned long address;
unsigned long address_low;
int bit_shift;
if (sizeof(int) >= sizeof(void *))
address = options[COMEDI_DEVCONF_AUX_DATA_LO];
else {
address = options[COMEDI_DEVCONF_AUX_DATA_HI];
bit_shift = sizeof(int) * 8;
address <<= bit_shift;
address_low = options[COMEDI_DEVCONF_AUX_DATA_LO];
address_low &= (1UL << bit_shift) - 1;
address |= address_low;
}
if (n >= 1)
address += options[COMEDI_DEVCONF_AUX_DATA0_LENGTH];
if (n >= 2)
address += options[COMEDI_DEVCONF_AUX_DATA1_LENGTH];
if (n >= 3)
address += options[COMEDI_DEVCONF_AUX_DATA2_LENGTH];
BUG_ON(n > 3);
return (void *)address;
}
int comedi_alloc_subdevice_minor(struct comedi_device *dev, int comedi_alloc_subdevice_minor(struct comedi_device *dev,
struct comedi_subdevice *s); struct comedi_subdevice *s);
void comedi_free_subdevice_minor(struct comedi_subdevice *s); void comedi_free_subdevice_minor(struct comedi_subdevice *s);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment