From: Dave Jones <davej@redhat.com>
To: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Cc: hsweeten@visionengravers.com
Subject: Re: staging: comedi: drivers: use comedi_dio_update_state() for complex cases
Date: Fri, 8 Nov 2013 15:06:59 -0500 [thread overview]
Message-ID: <20131108200659.GA2101@redhat.com> (raw)
In-Reply-To: <20131107062754.93B2D660F4A@gitolite.kernel.org>
On Thu, Nov 07, 2013 at 06:27:54AM +0000, Linux Kernel wrote:
> Gitweb: http://git.kernel.org/linus/;a=commit;h=b3ff824a81e8978deb56f6d163479c1a0a606037
> Commit: b3ff824a81e8978deb56f6d163479c1a0a606037
> Parent: 97f4289ad08cffe55de06d4ac4f89ac540450aee
> Author: H Hartley Sweeten <hsweeten@visionengravers.com>
> AuthorDate: Fri Aug 30 11:06:17 2013 -0700
> Committer: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> CommitDate: Tue Sep 17 07:47:40 2013 -0700
>
> staging: comedi: drivers: use comedi_dio_update_state() for complex cases
>
> Use comedi_dio_update_state() to handle the boilerplate code to update
> the subdevice s->state for more complex cases where the hardware is only
> updated based on the 'mask' of the channels that are modified.
>
> Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
> Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This bit looks suspect :-
> if (mask) {
> - s->state &= ~mask;
> - s->state |= (bits & mask);
> -
> if (mask & 0x00ff)
> outb(s->state & 0xff, dev->iobase + reg);
> - if ((mask & 0xff00) && (s->n_chan > 8))
> + if ((mask & 0xff00) & (s->n_chan > 8))
> outb((s->state >> 8) & 0xff, dev->iobase + reg + 1);
> - if ((mask & 0xff0000) && (s->n_chan > 16))
> + if ((mask & 0xff0000) & (s->n_chan > 16))
> outb((s->state >> 16) & 0xff, dev->iobase + reg + 2);
> - if ((mask & 0xff000000) && (s->n_chan > 24))
> + if ((mask & 0xff000000) & (s->n_chan > 24))
> outb((s->state >> 24) & 0xff, dev->iobase + reg + 3);
> }
should those be shifts ? Like so ?
diff --git a/drivers/staging/comedi/drivers/pcl730.c b/drivers/staging/comedi/drivers/pcl730.c
index d041b714db29..29a54e5d73d6 100644
--- a/drivers/staging/comedi/drivers/pcl730.c
+++ b/drivers/staging/comedi/drivers/pcl730.c
@@ -173,11 +173,11 @@ static int pcl730_do_insn_bits(struct comedi_device *dev,
if (mask) {
if (mask & 0x00ff)
outb(s->state & 0xff, dev->iobase + reg);
- if ((mask & 0xff00) & (s->n_chan > 8))
+ if ((mask & 0xff00) & (s->n_chan >> 8))
outb((s->state >> 8) & 0xff, dev->iobase + reg + 1);
- if ((mask & 0xff0000) & (s->n_chan > 16))
+ if ((mask & 0xff0000) & (s->n_chan >> 16))
outb((s->state >> 16) & 0xff, dev->iobase + reg + 2);
- if ((mask & 0xff000000) & (s->n_chan > 24))
+ if ((mask & 0xff000000) & (s->n_chan >> 24))
outb((s->state >> 24) & 0xff, dev->iobase + reg + 3);
}
next parent reply other threads:[~2013-11-08 20:07 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20131107062754.93B2D660F4A@gitolite.kernel.org>
2013-11-08 20:06 ` Dave Jones [this message]
2013-11-26 18:07 ` Hartley Sweeten
2013-11-27 2:57 ` staging: comedi: Fix boolean/logical and mix-up Dave Jones
2013-11-27 16:38 ` Hartley Sweeten
2013-11-27 16:59 ` Hartley Sweeten
2013-11-27 17:11 ` Dave Jones
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20131108200659.GA2101@redhat.com \
--to=davej@redhat.com \
--cc=hsweeten@visionengravers.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome