Module: xenomai-abe Branch: analogy Commit: 1416bb83f9ad025757fa42f71accb3f69af1879c URL: http://git.xenomai.org/?p=xenomai-abe.git;a=commit;h=1416bb83f9ad025757fa42f71accb3f69af1879c
Author: Alexis Berlemont <alexis.berlem...@gmail.com> Date: Wed Jun 23 21:11:31 2010 +0200 analogy: remove calls of a4l_release/reserve_subd in the core --- include/analogy/subdevice.h | 7 ------- ksrc/drivers/analogy/buffer.c | 4 ++-- ksrc/drivers/analogy/instruction.c | 7 ++++--- 3 files changed, 6 insertions(+), 12 deletions(-) diff --git a/include/analogy/subdevice.h b/include/analogy/subdevice.h index 5be036b..a81fcb9 100644 --- a/include/analogy/subdevice.h +++ b/include/analogy/subdevice.h @@ -284,13 +284,6 @@ a4l_rng_t *a4l_get_rngfeat(a4l_subd_t * sb, int chidx, int rngidx); int a4l_check_chanlist(a4l_subd_t * subd, unsigned char nb_chan, unsigned int *chans); -static inline int a4l_reserve_subd(a4l_subd_t *subd) -{ - return test_and_set_bit(A4L_SUBD_BUSY_NR, &subd->status) ? -EBUSY : 0; -} -#define a4l_release_subd(x) clear_bit(A4L_SUBD_BUSY_NR, &((x)->status)) -#define a4l_subd_is_busy(x) (test_bit(A4L_SUBD_BUSY_NR, &((x)->status))) - #define a4l_subd_is_input(x) ((A4L_SUBD_MASK_READ & (x)->flags) != 0) /* The following macro considers that a DIO subdevice is firstly an output subdevice */ diff --git a/ksrc/drivers/analogy/buffer.c b/ksrc/drivers/analogy/buffer.c index b8b01d3..f9bcad7 100644 --- a/ksrc/drivers/analogy/buffer.c +++ b/ksrc/drivers/analogy/buffer.c @@ -136,7 +136,7 @@ int a4l_setup_buffer(a4l_cxt_t *cxt, a4l_cmd_t *cmd) return -EINVAL; } - if (a4l_reserve_subd(buf_desc->subd) < 0) { + if (test_and_set_bit(A4L_SUBD_BUSY_NR, &buf_desc->subd->status)) { __a4l_err("a4l_setup_buffer: subdevice %d already busy\n", cmd->idx_subd); return -EBUSY; @@ -196,7 +196,7 @@ int a4l_cancel_buffer(a4l_cxt_t *cxt) a4l_reinit_buffer(buf_desc); - a4l_release_subd(subd); + clear_bit(A4L_SUBD_BUSY_NR, &subd->status); subd->buf = NULL; return err; diff --git a/ksrc/drivers/analogy/instruction.c b/ksrc/drivers/analogy/instruction.c index 644c40c..1050753 100644 --- a/ksrc/drivers/analogy/instruction.c +++ b/ksrc/drivers/analogy/instruction.c @@ -266,9 +266,10 @@ int a4l_do_insn(a4l_cxt_t * cxt, a4l_kinsn_t * dsc) /* Prevents the subdevice from being used during the following operations */ - ret = a4l_reserve_subd(subd); - if (ret < 0) + if (test_and_set_bit(A4L_SUBD_BUSY_NR, &subd->status)) { + ret = -EBUSY; goto out_do_insn; + } /* Let's the driver-specific code perform the instruction */ ret = hdlr(subd, dsc); @@ -281,7 +282,7 @@ int a4l_do_insn(a4l_cxt_t * cxt, a4l_kinsn_t * dsc) out_do_insn: /* Releases the subdevice from its reserved state */ - a4l_release_subd(subd); + clear_bit(A4L_SUBD_BUSY_NR, &subd->status); return ret; } _______________________________________________ Xenomai-git mailing list Xenomai-git@gna.org https://mail.gna.org/listinfo/xenomai-git