Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1279189

Re: [PATCH v5 1/5] Implement an ioctl to support the USMTMC-USB488 READ_STATUS_BYTE operation.

From Dave Penkler <dpenkler@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH v5 1/5] Implement an ioctl to support the USMTMC-USB488 READ_STATUS_BYTE operation.
Date 2015-11-28 18:50 +0100
Message-ID <qzRNg-3pu-3@gated-at.bofh.it> (permalink)
References (4 earlier) <qxAdP-2sv-1@gated-at.bofh.it> <qyEp4-4c9-25@gated-at.bofh.it> <qyP18-2J1-15@gated-at.bofh.it> <qzMky-8q1-9@gated-at.bofh.it> <qzP8K-1HY-19@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Sat, Nov 28, 2015 at 04:57:47PM +0200, Andy Shevchenko wrote:
> On Sat, Nov 28, 2015 at 1:55 PM, Dave Penkler <dpenkler@gmail.com> wrote:
> > On Wed, Nov 25, 2015 at 10:38:39PM +0200, Andy Shevchenko wrote:
> >> On Wed, Nov 25, 2015 at 11:18 AM, Dave Penkler <dpenkler@gmail.com> wrote:
> >> > On Sun, Nov 22, 2015 at 12:32:41PM +0200, Andy Shevchenko wrote:
> >> >> On Sun, Nov 22, 2015 at 11:19 AM, Dave Penkler <dpenkler@gmail.com> wrote:
> >> >> > On Wed, Nov 18, 2015 at 11:55:27AM +0200, Andy Shevchenko wrote:
> >> >> >> On Wed, Nov 18, 2015 at 10:37 AM, Dave Penkler <dpenkler@gmail.com> wrote:
> 
> Thank you for an update!
> 
> >> >> >> > +       switch (status) {
> >> >> >> > +       case 0: /* SUCCESS */
> >> >> >> > +               if (data->iin_buffer[0] & 0x80) {
> >> >> >> > +                       /* check for valid STB notification */
> >> >> >> > +                       if ((data->iin_buffer[0] & 0x7f) > 1) {
> 
> How can I miss that there are two conditionals in a sequence and
> moreover for the same data?!

Sorry, my fault, it is the combination of patch 1 and 2

> That might explain the optimization done by compiler.
> 
> So, could it be transformed to simple one condition
>    if (data->iin_buffer[0] > 0x81 /* 129 */) {
> ?

OK so now for patch 1 and 2 we have:

	switch (status) {
	case 0: /* SUCCESS */
		/* PATCH 1 check for valid STB notification */
		if (data->iin_buffer[0] > 0x81) {
			data->bNotify1 = data->iin_buffer[0];
			data->bNotify2 = data->iin_buffer[1];
			atomic_set(&data->iin_data_valid, 1);
			wake_up_interruptible(&data->waitq);
			goto exit;
		}
		/* PATCH 2 check for SRQ notification */
		if (data->iin_buffer[0] == 0x81) {
			if (data->fasync)
				kill_fasync(&data->fasync,
					SIGIO, POLL_IN);

			atomic_set(&data->srq_asserted, 1);
			wake_up_interruptible(&data->waitq);
			goto exit;
		}


I'll push a new set if you are OK with this.
cheers,
-Dave
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v5 0/5] usb: usbtmc: Add support for missing functions in  USBTMC-USB488 spec Dave Penkler <dpenkler@gmail.com> - 2015-11-18 09:40 +0100
  [PATCH v5 1/5] Implement an ioctl to support the USMTMC-USB488  READ_STATUS_BYTE operation. Dave Penkler <dpenkler@gmail.com> - 2015-11-18 09:40 +0100
    Re: [PATCH v5 1/5] Implement an ioctl to support the USMTMC-USB488  READ_STATUS_BYTE operation. Andy Shevchenko <andy.shevchenko@gmail.com> - 2015-11-18 11:00 +0100
      Re: [PATCH v5 1/5] Implement an ioctl to support the USMTMC-USB488  READ_STATUS_BYTE operation. Dave Penkler <dpenkler@gmail.com> - 2015-11-22 10:30 +0100
        Re: [PATCH v5 1/5] Implement an ioctl to support the USMTMC-USB488  READ_STATUS_BYTE operation. Andy Shevchenko <andy.shevchenko@gmail.com> - 2015-11-22 11:40 +0100
          Re: [PATCH v5 1/5] Implement an ioctl to support the USMTMC-USB488  READ_STATUS_BYTE operation. Dave Penkler <dpenkler@gmail.com> - 2015-11-25 10:20 +0100
            Re: [PATCH v5 1/5] Implement an ioctl to support the USMTMC-USB488  READ_STATUS_BYTE operation. Andy Shevchenko <andy.shevchenko@gmail.com> - 2015-11-25 21:40 +0100
              Re: [PATCH v5 1/5] Implement an ioctl to support the USMTMC-USB488  READ_STATUS_BYTE operation. Dave Penkler <dpenkler@gmail.com> - 2015-11-28 13:00 +0100
                Re: [PATCH v5 1/5] Implement an ioctl to support the USMTMC-USB488  READ_STATUS_BYTE operation. Andy Shevchenko <andy.shevchenko@gmail.com> - 2015-11-28 16:00 +0100
                Re: [PATCH v5 1/5] Implement an ioctl to support the USMTMC-USB488  READ_STATUS_BYTE operation. Dave Penkler <dpenkler@gmail.com> - 2015-11-28 18:50 +0100
                Re: [PATCH v5 1/5] Implement an ioctl to support the USMTMC-USB488  READ_STATUS_BYTE operation. Andy Shevchenko <andy.shevchenko@gmail.com> - 2015-11-28 20:20 +0100
  [PATCH v5 2/5] Add support for USBTMC USB488 SRQ notification with  fasync Dave Penkler <dpenkler@gmail.com> - 2015-11-18 09:40 +0100
  [PATCH v5 5/5] Add ioctls to enable and disable local controls on an  instrument Dave Penkler <dpenkler@gmail.com> - 2015-11-18 09:40 +0100
    Re: [PATCH v5 5/5] Add ioctls to enable and disable local controls on  an instrument Andy Shevchenko <andy.shevchenko@gmail.com> - 2015-11-18 10:50 +0100
      Re: [PATCH v5 5/5] Add ioctls to enable and disable local controls  on an instrument Dave Penkler <dpenkler@gmail.com> - 2015-11-22 10:00 +0100
        Re: [PATCH v5 5/5] Add ioctls to enable and disable local controls on  an instrument Andy Shevchenko <andy.shevchenko@gmail.com> - 2015-11-22 11:40 +0100
          Re: [PATCH v5 5/5] Add ioctls to enable and disable local controls  on an instrument Dave Penkler <dpenkler@gmail.com> - 2015-11-25 10:20 +0100
            Re: [PATCH v5 5/5] Add ioctls to enable and disable local controls on  an instrument Andy Shevchenko <andy.shevchenko@gmail.com> - 2015-11-25 21:50 +0100
  [PATCH v5 4/5] Add ioctl to retrieve USBTMC-USB488 capabilities Dave Penkler <dpenkler@gmail.com> - 2015-11-18 09:40 +0100

csiph-web