Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 141499
b: refs/heads/master
c: 790c554
h: refs/heads/master
i:
  141497: 3434f49
  141495: c978ab7
v: v3
  • Loading branch information
Bill Pemberton authored and Greg Kroah-Hartman committed Apr 3, 2009
1 parent 8369683 commit 2879310
Show file tree
Hide file tree
Showing 155 changed files with 1,484 additions and 1,487 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: 0b3fb27fa7b4bf811c31ee66453cda0a6d94aa6c
refs/heads/master: 790c55415aa31f4c732729f94d2c3a54f7d3bfc2
13 changes: 5 additions & 8 deletions trunk/drivers/staging/comedi/comedi.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,6 @@ extern "C" {
/* max length of device and driver names */
#define COMEDI_NAMELEN 20

typedef unsigned int lsampl_t;
typedef unsigned short sampl_t;

/* packs and unpacks a channel/range number */

#define CR_PACK(chan, rng, aref) ((((aref)&0x3)<<24) | (((rng)&0xff)<<16) | (chan))
Expand Down Expand Up @@ -332,7 +329,7 @@ struct comedi_trig_struct {
unsigned int flags;
unsigned int n_chan; /* number of channels */
unsigned int *chanlist; /* channel/range list */
sampl_t *data; /* data list, size depends on subd flags */
short *data; /* data list, size depends on subd flags */
unsigned int n; /* number of scans */
unsigned int trigsrc;
unsigned int trigvar;
Expand All @@ -344,7 +341,7 @@ struct comedi_trig_struct {
struct comedi_insn_struct {
unsigned int insn;
unsigned int n;
lsampl_t *data;
unsigned int *data;
unsigned int subdev;
unsigned int chanspec;
unsigned int unused[3];
Expand Down Expand Up @@ -377,13 +374,13 @@ struct comedi_cmd_struct {
unsigned int *chanlist; /* channel/range list */
unsigned int chanlist_len;

sampl_t *data; /* data list, size depends on subd flags */
short *data; /* data list, size depends on subd flags */
unsigned int data_len;
};

struct comedi_chaninfo_struct {
unsigned int subdev;
lsampl_t *maxdata_list;
unsigned int *maxdata_list;
unsigned int *flaglist;
unsigned int *rangelist;
unsigned int unused[4];
Expand All @@ -407,7 +404,7 @@ struct comedi_subdinfo_struct {
unsigned int subd_flags;
unsigned int timer_type;
unsigned int len_chanlist;
lsampl_t maxdata;
unsigned int maxdata;
unsigned int flags; /* channel flags */
unsigned int range_type; /* lookup in kernel */
unsigned int settling_time_0;
Expand Down
6 changes: 3 additions & 3 deletions trunk/drivers/staging/comedi/comedi_compat32.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@

struct comedi32_chaninfo_struct {
unsigned int subdev;
compat_uptr_t maxdata_list; /* 32-bit 'lsampl_t *' */
compat_uptr_t maxdata_list; /* 32-bit 'unsigned int *' */
compat_uptr_t flaglist; /* 32-bit 'unsigned int *' */
compat_uptr_t rangelist; /* 32-bit 'unsigned int *' */
unsigned int unused[4];
Expand All @@ -76,14 +76,14 @@ struct comedi32_cmd_struct {
unsigned int stop_arg;
compat_uptr_t chanlist; /* 32-bit 'unsigned int *' */
unsigned int chanlist_len;
compat_uptr_t data; /* 32-bit 'sampl_t *' */
compat_uptr_t data; /* 32-bit 'short *' */
unsigned int data_len;
};

struct comedi32_insn_struct {
unsigned int insn;
unsigned int n;
compat_uptr_t data; /* 32-bit 'lsampl_t *' */
compat_uptr_t data; /* 32-bit 'unsigned int *' */
unsigned int subdev;
unsigned int chanspec;
unsigned int unused[3];
Expand Down
26 changes: 13 additions & 13 deletions trunk/drivers/staging/comedi/comedi_fops.c
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,7 @@ static int do_chaninfo_ioctl(comedi_device *dev, comedi_chaninfo *arg)
if (s->maxdata || !s->maxdata_list)
return -EINVAL;
if (copy_to_user(it.maxdata_list, s->maxdata_list,
s->n_chan * sizeof(lsampl_t)))
s->n_chan * sizeof(unsigned int)))
return -EFAULT;
}

Expand Down Expand Up @@ -607,7 +607,7 @@ static int do_bufinfo_ioctl(comedi_device *dev, void *arg)
return 0;
}

static int parse_insn(comedi_device *dev, comedi_insn *insn, lsampl_t *data,
static int parse_insn(comedi_device *dev, comedi_insn *insn, unsigned int *data,
void *file);
/*
* COMEDI_INSNLIST
Expand All @@ -630,14 +630,14 @@ static int do_insnlist_ioctl(comedi_device *dev, void *arg, void *file)
{
comedi_insnlist insnlist;
comedi_insn *insns = NULL;
lsampl_t *data = NULL;
unsigned int *data = NULL;
int i = 0;
int ret = 0;

if (copy_from_user(&insnlist, arg, sizeof(comedi_insnlist)))
return -EFAULT;

data = kmalloc(sizeof(lsampl_t) * MAX_SAMPLES, GFP_KERNEL);
data = kmalloc(sizeof(unsigned int) * MAX_SAMPLES, GFP_KERNEL);
if (!data) {
DPRINTK("kmalloc failed\n");
ret = -ENOMEM;
Expand Down Expand Up @@ -666,7 +666,7 @@ static int do_insnlist_ioctl(comedi_device *dev, void *arg, void *file)
}
if (insns[i].insn & INSN_MASK_WRITE) {
if (copy_from_user(data, insns[i].data,
insns[i].n * sizeof(lsampl_t))) {
insns[i].n * sizeof(unsigned int))) {
DPRINTK("copy_from_user failed\n");
ret = -EFAULT;
goto error;
Expand All @@ -677,7 +677,7 @@ static int do_insnlist_ioctl(comedi_device *dev, void *arg, void *file)
goto error;
if (insns[i].insn & INSN_MASK_READ) {
if (copy_to_user(insns[i].data, data,
insns[i].n * sizeof(lsampl_t))) {
insns[i].n * sizeof(unsigned int))) {
DPRINTK("copy_to_user failed\n");
ret = -EFAULT;
goto error;
Expand All @@ -696,7 +696,7 @@ static int do_insnlist_ioctl(comedi_device *dev, void *arg, void *file)
return i;
}

static int check_insn_config_length(comedi_insn *insn, lsampl_t *data)
static int check_insn_config_length(comedi_insn *insn, unsigned int *data)
{
if (insn->n < 1)
return -EINVAL;
Expand Down Expand Up @@ -757,7 +757,7 @@ static int check_insn_config_length(comedi_insn *insn, lsampl_t *data)
return -EINVAL;
}

static int parse_insn(comedi_device *dev, comedi_insn *insn, lsampl_t *data,
static int parse_insn(comedi_device *dev, comedi_insn *insn, unsigned int *data,
void *file)
{
comedi_subdevice *s;
Expand Down Expand Up @@ -825,7 +825,7 @@ static int parse_insn(comedi_device *dev, comedi_insn *insn, lsampl_t *data,
}
} else {
/* a subdevice instruction */
lsampl_t maxdata;
unsigned int maxdata;

if (insn->subdev >= dev->n_subdevices) {
DPRINTK("subdevice %d out of range\n", insn->subdev);
Expand Down Expand Up @@ -920,10 +920,10 @@ static int parse_insn(comedi_device *dev, comedi_insn *insn, lsampl_t *data,
static int do_insn_ioctl(comedi_device *dev, void *arg, void *file)
{
comedi_insn insn;
lsampl_t *data = NULL;
unsigned int *data = NULL;
int ret = 0;

data = kmalloc(sizeof(lsampl_t) * MAX_SAMPLES, GFP_KERNEL);
data = kmalloc(sizeof(unsigned int) * MAX_SAMPLES, GFP_KERNEL);
if (!data) {
ret = -ENOMEM;
goto error;
Expand All @@ -938,7 +938,7 @@ static int do_insn_ioctl(comedi_device *dev, void *arg, void *file)
if (insn.n > MAX_SAMPLES)
insn.n = MAX_SAMPLES;
if (insn.insn & INSN_MASK_WRITE) {
if (copy_from_user(data, insn.data, insn.n * sizeof(lsampl_t))) {
if (copy_from_user(data, insn.data, insn.n * sizeof(unsigned int))) {
ret = -EFAULT;
goto error;
}
Expand All @@ -947,7 +947,7 @@ static int do_insn_ioctl(comedi_device *dev, void *arg, void *file)
if (ret < 0)
goto error;
if (insn.insn & INSN_MASK_READ) {
if (copy_to_user(insn.data, data, insn.n * sizeof(lsampl_t))) {
if (copy_to_user(insn.data, data, insn.n * sizeof(unsigned int))) {
ret = -EFAULT;
goto error;
}
Expand Down
22 changes: 11 additions & 11 deletions trunk/drivers/staging/comedi/comedidev.h
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,8 @@ struct comedi_subdevice_struct {

int io_bits;

lsampl_t maxdata; /* if maxdata==0, use list */
const lsampl_t *maxdata_list; /* list is channel specific */
unsigned int maxdata; /* if maxdata==0, use list */
const unsigned int *maxdata_list; /* list is channel specific */

unsigned int flags;
const unsigned int *flaglist;
Expand All @@ -164,13 +164,13 @@ struct comedi_subdevice_struct {
unsigned int *chanlist; /* driver-owned chanlist (not used) */

int (*insn_read) (comedi_device *, comedi_subdevice *, comedi_insn *,
lsampl_t *);
unsigned int *);
int (*insn_write) (comedi_device *, comedi_subdevice *, comedi_insn *,
lsampl_t *);
unsigned int *);
int (*insn_bits) (comedi_device *, comedi_subdevice *, comedi_insn *,
lsampl_t *);
unsigned int *);
int (*insn_config) (comedi_device *, comedi_subdevice *, comedi_insn *,
lsampl_t *);
unsigned int *);

int (*do_cmd) (comedi_device *, comedi_subdevice *);
int (*do_cmdtest) (comedi_device *, comedi_subdevice *, comedi_cmd *);
Expand Down Expand Up @@ -389,7 +389,7 @@ void comedi_set_subdevice_runflags(comedi_subdevice *s, unsigned mask,
unsigned bits);
unsigned comedi_get_subdevice_runflags(comedi_subdevice *s);
int insn_inval(comedi_device *dev, comedi_subdevice *s,
comedi_insn *insn, lsampl_t *data);
comedi_insn *insn, unsigned int *data);

/* range stuff */

Expand Down Expand Up @@ -452,9 +452,9 @@ static inline int alloc_private(comedi_device *dev, int size)
static inline unsigned int bytes_per_sample(const comedi_subdevice *subd)
{
if (subd->subdev_flags & SDF_LSAMPL)
return sizeof(lsampl_t);
return sizeof(unsigned int);
else
return sizeof(sampl_t);
return sizeof(short);
}

/* must be used in attach to set dev->hw_dev if you wish to dma directly
Expand All @@ -471,8 +471,8 @@ static inline void comedi_set_hw_dev(comedi_device *dev, struct device *hw_dev)
}
}

int comedi_buf_put(comedi_async *async, sampl_t x);
int comedi_buf_get(comedi_async *async, sampl_t *x);
int comedi_buf_put(comedi_async *async, short x);
int comedi_buf_get(comedi_async *async, short *x);

unsigned int comedi_buf_write_n_available(comedi_async *async);
unsigned int comedi_buf_write_alloc(comedi_async *async, unsigned int nbytes);
Expand Down
14 changes: 7 additions & 7 deletions trunk/drivers/staging/comedi/comedilib.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,14 @@ int comedi_command_test(void *dev, comedi_cmd *cmd);
int comedi_trigger(void *dev, unsigned int subdev, comedi_trig *it);
int __comedi_trigger(void *dev, unsigned int subdev, comedi_trig *it);
int comedi_data_write(void *dev, unsigned int subdev, unsigned int chan,
unsigned int range, unsigned int aref, lsampl_t data);
unsigned int range, unsigned int aref, unsigned int data);
int comedi_data_read(void *dev, unsigned int subdev, unsigned int chan,
unsigned int range, unsigned int aref, lsampl_t *data);
unsigned int range, unsigned int aref, unsigned int *data);
int comedi_data_read_hint(void *dev, unsigned int subdev,
unsigned int chan, unsigned int range, unsigned int aref);
int comedi_data_read_delayed(void *dev, unsigned int subdev,
unsigned int chan, unsigned int range, unsigned int aref,
lsampl_t *data, unsigned int nano_sec);
unsigned int *data, unsigned int nano_sec);
int comedi_dio_config(void *dev, unsigned int subdev, unsigned int chan,
unsigned int io);
int comedi_dio_read(void *dev, unsigned int subdev, unsigned int chan,
Expand All @@ -88,7 +88,7 @@ const char *comedi_get_board_name(void *dev);
int comedi_get_subdevice_type(void *dev, unsigned int subdevice);
int comedi_find_subdevice_by_type(void *dev, int type, unsigned int subd);
int comedi_get_n_channels(void *dev, unsigned int subdevice);
lsampl_t comedi_get_maxdata(void *dev, unsigned int subdevice, unsigned
unsigned int comedi_get_maxdata(void *dev, unsigned int subdevice, unsigned
int chan);
int comedi_get_n_ranges(void *dev, unsigned int subdevice, unsigned int
chan);
Expand Down Expand Up @@ -142,9 +142,9 @@ int comedi_command_test(unsigned int minor, comedi_cmd *cmd);
int comedi_trigger(unsigned int minor, unsigned int subdev, comedi_trig *it);
int __comedi_trigger(unsigned int minor, unsigned int subdev, comedi_trig *it);
int comedi_data_write(unsigned int dev, unsigned int subdev, unsigned int chan,
unsigned int range, unsigned int aref, lsampl_t data);
unsigned int range, unsigned int aref, unsigned int data);
int comedi_data_read(unsigned int dev, unsigned int subdev, unsigned int chan,
unsigned int range, unsigned int aref, lsampl_t *data);
unsigned int range, unsigned int aref, unsigned int *data);
int comedi_dio_config(unsigned int dev, unsigned int subdev, unsigned int chan,
unsigned int io);
int comedi_dio_read(unsigned int dev, unsigned int subdev, unsigned int chan,
Expand All @@ -161,7 +161,7 @@ int comedi_get_subdevice_type(unsigned int minor, unsigned int subdevice);
int comedi_find_subdevice_by_type(unsigned int minor, int type,
unsigned int subd);
int comedi_get_n_channels(unsigned int minor, unsigned int subdevice);
lsampl_t comedi_get_maxdata(unsigned int minor, unsigned int subdevice, unsigned
unsigned int comedi_get_maxdata(unsigned int minor, unsigned int subdevice, unsigned
int chan);
int comedi_get_n_ranges(unsigned int minor, unsigned int subdevice, unsigned int
chan);
Expand Down
28 changes: 14 additions & 14 deletions trunk/drivers/staging/comedi/drivers.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@

static int postconfig(comedi_device *dev);
static int insn_rw_emulate_bits(comedi_device *dev, comedi_subdevice *s,
comedi_insn *insn, lsampl_t *data);
comedi_insn *insn, unsigned int *data);
static void *comedi_recognize(comedi_driver * driv, const char *name);
static void comedi_report_boards(comedi_driver *driv);
static int poll_invalid(comedi_device *dev, comedi_subdevice *s);
Expand Down Expand Up @@ -337,13 +337,13 @@ static int poll_invalid(comedi_device *dev, comedi_subdevice *s)
}

int insn_inval(comedi_device *dev, comedi_subdevice *s,
comedi_insn *insn, lsampl_t *data)
comedi_insn *insn, unsigned int *data)
{
return -EINVAL;
}

static int insn_rw_emulate_bits(comedi_device *dev, comedi_subdevice *s,
comedi_insn *insn, lsampl_t *data)
comedi_insn *insn, unsigned int *data)
{
comedi_insn new_insn;
int ret;
Expand All @@ -352,7 +352,7 @@ static int insn_rw_emulate_bits(comedi_device *dev, comedi_subdevice *s,
unsigned chan = CR_CHAN(insn->chanspec);
const unsigned base_bitfield_channel =
(chan < channels_per_bitfield) ? 0 : chan;
lsampl_t new_data[2];
unsigned int new_data[2];
memset(new_data, 0, sizeof(new_data));
memset(&new_insn, 0, sizeof(new_insn));
new_insn.insn = INSN_BITS;
Expand Down Expand Up @@ -745,28 +745,28 @@ unsigned int comedi_buf_read_n_available(comedi_async *async)
return num_bytes;
}

int comedi_buf_get(comedi_async *async, sampl_t *x)
int comedi_buf_get(comedi_async *async, short *x)
{
unsigned int n = comedi_buf_read_n_available(async);

if (n < sizeof(sampl_t))
if (n < sizeof(short))
return 0;
comedi_buf_read_alloc(async, sizeof(sampl_t));
*x = *(sampl_t *) (async->prealloc_buf + async->buf_read_ptr);
comedi_buf_read_free(async, sizeof(sampl_t));
comedi_buf_read_alloc(async, sizeof(short));
*x = *(short *) (async->prealloc_buf + async->buf_read_ptr);
comedi_buf_read_free(async, sizeof(short));
return 1;
}

int comedi_buf_put(comedi_async *async, sampl_t x)
int comedi_buf_put(comedi_async *async, short x)
{
unsigned int n = comedi_buf_write_alloc_strict(async, sizeof(sampl_t));
unsigned int n = comedi_buf_write_alloc_strict(async, sizeof(short));

if (n < sizeof(sampl_t)) {
if (n < sizeof(short)) {
async->events |= COMEDI_CB_ERROR;
return 0;
}
*(sampl_t *) (async->prealloc_buf + async->buf_write_ptr) = x;
comedi_buf_write_free(async, sizeof(sampl_t));
*(short *) (async->prealloc_buf + async->buf_write_ptr) = x;
comedi_buf_write_free(async, sizeof(short));
return 1;
}

Expand Down
Loading

0 comments on commit 2879310

Please sign in to comment.