public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <greg@kroah.com>
To: linux-usb@vger.kernel.org
Cc: Stefan Kopp <stefan_kopp@agilent.com>,
	Marcel Janssen <korgull@home.nl>,
	Felipe Balbi <me@felipebalbi.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] USB: add USB test and measurement class driver
Date: Wed, 27 Aug 2008 09:36:21 -0700	[thread overview]
Message-ID: <20080827163621.GA14379@kroah.com> (raw)
In-Reply-To: <20080827031205.GA22912@kroah.com>

On Tue, Aug 26, 2008 at 08:12:05PM -0700, Greg KH wrote:
> On Tue, Aug 26, 2008 at 05:05:01PM -0700, Greg KH wrote:
> > I've now added this to my tree, and any review comments are greatly
> > welcome.
> 
> Heck, I'll review my own patch, as I noticed I forgot some things:
> 
> > ---
> >  drivers/usb/class/Kconfig  |   10 
> >  drivers/usb/class/Makefile |    1 
> >  drivers/usb/class/usbtmc.c | 1058 +++++++++++++++++++++++++++++++++++++++++++++
> >  drivers/usb/class/usbtmc.h |   24 +
> >  include/linux/usb/tmc.h    |   27 +
> >  5 files changed, 1120 insertions(+)
> 
> needs Documentation/ABI description of new sysfs files

Now added.

> > +/*
> > + * This structure is the capabilities for the device
> > + * See section 4.2.1.8 of the USBTMC specification for details.
> > + */
> > +struct usbtmc_dev_capabilities {
> > +	__u8 interface_capabilities;
> > +	__u8 device_capabilities;
> > +	__u8 usb488_interface_capabilities;
> > +	__u8 usb488_device_capabilities;
> > +};
> 
> These should match the usbif description names to make it easier to
> understand.

Nevermind, they match the spec description just fine, these will stay.

> > +	/* USBTMC devices have only one setting, so use that */
> > +	iface_desc = data->intf->cur_altsetting;
> > +
> > +	/* Find bulk in endpoint */
> > +	for (n = 0; n < iface_desc->desc.bNumEndpoints; n++) {
> > +		endpoint = &iface_desc->endpoint[n].desc;
> > +
> > +		if (usb_endpoint_is_bulk_in(endpoint)) {
> > +			data->bulk_in = endpoint->bEndpointAddress;
> > +			dev_dbg(dev, "Found bulk in endpoint at %u\n",
> > +				data->bulk_in);
> > +			break;
> > +		}
> > +	}
> > +
> > +	/* Find bulk out endpoint */
> > +	for (n = 0; n < iface_desc->desc.bNumEndpoints; n++) {
> > +		endpoint = &iface_desc->endpoint[n].desc;
> > +
> > +		if (usb_endpoint_is_bulk_out(endpoint)) {
> > +			data->bulk_out = endpoint->bEndpointAddress;
> > +			dev_dbg(dev, "Found Bulk out endpoint at %u\n",
> > +				data->bulk_out);
> > +			break;
> > +		}
> > +	}
> 
> This can all be done at probe() time, no need to wait until open().

Now moved.

> > +static ssize_t usbtmc_write(struct file *filp, const char __user *buf,
> > +			    size_t count, loff_t *f_pos)
> > +{
> > +	struct usbtmc_device_data *data;
> > +	u8 *buffer;
> > +	int retval;
> > +	int actual;
> > +	unsigned long int n_bytes;
> > +	int n;
> > +	int remaining;
> > +	int done;
> > +	int this_part;
> > +
> > +	data = filp->private_data;
> > +	buffer = data->buffer;
> 
> This buffer should be local to the function, and not the device as we
> could overlap reads and writes.  It should be removed from the device
> itself to make sure everything is correct.  The ioctls already have
> their own local buffers, fixing a bug in the original driver which used
> 1! buffer for all devices and all commands...

Now fixed.

It's fun talking to yourself...

greg k-h

  reply	other threads:[~2008-08-27 16:39 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-27  0:05 [PATCH] USB: add USB test and measurement class driver Greg KH
2008-08-27  3:12 ` Greg KH
2008-08-27 16:36   ` Greg KH [this message]
2008-08-27  6:22 ` Marcel Janssen
2008-08-27 17:21   ` Greg KH
2008-08-27  8:08 ` Oliver Neukum
2008-08-27 15:40   ` Greg KH
2008-08-27 16:06   ` Alan Stern
2008-08-27 17:05     ` Oliver Neukum
2008-08-27  8:13 ` Oliver Neukum
2008-08-27 16:08   ` Greg KH
2008-08-27  8:56 ` Oliver Neukum
2008-08-27 15:28   ` Greg KH
2008-08-27 15:44     ` Oliver Neukum
2008-08-27 16:02       ` Greg KH
2008-08-27 16:11   ` Greg KH
2008-08-27 16:15   ` Greg KH

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=20080827163621.GA14379@kroah.com \
    --to=greg@kroah.com \
    --cc=korgull@home.nl \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=me@felipebalbi.com \
    --cc=stefan_kopp@agilent.com \
    /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