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


Groups > linux.kernel > #1277119

Re: [PATCH v5 5/5] Add ioctls to enable and disable local controls on an instrument

From Dave Penkler <dpenkler@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH v5 5/5] Add ioctls to enable and disable local controls on an instrument
Date 2015-11-25 10:20 +0100
Message-ID <qyEp3-4c9-1@gated-at.bofh.it> (permalink)
References <qw6rv-qW-5@gated-at.bofh.it> <qw6rw-qW-15@gated-at.bofh.it> <qw7xg-17g-7@gated-at.bofh.it> <qxyF3-1jE-1@gated-at.bofh.it> <qxAdP-2sv-17@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Sun, Nov 22, 2015 at 12:36:53PM +0200, Andy Shevchenko wrote:
> On Sun, Nov 22, 2015 at 10:51 AM, Dave Penkler <dpenkler@gmail.com> wrote:
> > On Wed, Nov 18, 2015 at 11:41:30AM +0200, Andy Shevchenko wrote:
> >> On Wed, Nov 18, 2015 at 10:38 AM, Dave Penkler <dpenkler@gmail.com> wrote:
> 
> 
> >> > +       if (rv < 0) {
> >> > +               dev_err(dev, "simple usb_control_msg failed %d\n", rv);
> >> > +               goto exit;
> >> > +       } else if (rv != 1) {
> >> > +               dev_warn(dev, "simple usb_control_msg returned %d\n", rv);
> >>
> >> Actually here what king of results could be? 0? 2+? In all cases of
> >> error you have to provide an error code.
> >>
> >
> > We seem to be going round in circles here, last time you suggested to
> > propagate the return value.
> 
> You didn't pay much attention to where I put my comment. You have few
> branches depending on return value
> 
> 1) negative, apparently an error code, should be propagated if nothing
> specific to framework;
> 2) zero, what does it means?

Zero bytes transferred -> error

> 3) one, seems the expected result when success, so, error code should be 0;

Which it is when we drop through

> 4) two, three, ??? non-negative numbers,see 2).
> 
> For my understanding 2) and 4) have to return what you initially had -EIO.
> 
> > The non-negative return is the number of bytes
> > transferred which should be 1 unless there is some usb implementation
> > flakiness happening. So I will go back to returning -EIO.
> 
> Yes, in *this* branch.
> 

OK so now I have the same as in v4 again:

	if (rv < 0) {
		dev_err(dev, "simple usb_control_msg failed %d\n", rv);
		goto exit;
	} else if (rv != 1) {
		dev_warn(dev, "simple usb_control_msg returned %d\n", rv);
		rv = -EIO;
		goto exit;
	}

> >
> >> > +               goto exit;
> >> > +       }
> >> > +
> >> > +       if (buffer[0] != USBTMC_STATUS_SUCCESS) {
> >> > +               dev_err(dev, "simple control status returned %x\n", buffer[0]);
> >> > +               rv = -EIO;
> >> > +               goto exit;
> >> > +       }
> >> > +       rv = 0;
> >> > +
> >> > + exit:
> >> > +       kfree(buffer);
> >> > +       return rv;
> >> > +}
> 
> -- 
> With Best Regards,
> Andy Shevchenko
--
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