From: Oliver Neukum <oliver@neukum.org>
To: Greg KH <greg@kroah.com>
Cc: linux-usb@vger.kernel.org, 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 10:13:06 +0200 [thread overview]
Message-ID: <200808271013.07561.oliver@neukum.org> (raw)
In-Reply-To: <20080827000501.GA29570@kroah.com>
Am Mittwoch 27 August 2008 02:05:01 schrieb Greg KH:> +static ssize_t usbtmc_read(struct file *filp, char __user *buf,> + size_t count, loff_t *f_pos)> +{> + struct usbtmc_device_data *data;> + struct device *dev;> + unsigned long int n_characters;> + u8 *buffer;> + int actual;> + int done;> + int remaining;> + int retval;> + int this_part;> +> + /* Get pointer to private data structure */> + data = filp->private_data;> + dev = &data->intf->dev;> + buffer = data->buffer;> +> + remaining = count;> + done = 0;> +> + while (remaining > 0) {> + if (remaining > USBTMC_SIZE_IOBUFFER - 12 - 3)> + this_part = USBTMC_SIZE_IOBUFFER - 12 - 3;> + else> + this_part = remaining;> +> + /* Setup IO buffer for DEV_DEP_MSG_IN message> + * Refer to class specs for details> + */> + buffer[0] = 2;> + buffer[1] = data->bTag;> + buffer[2] = ~(data->bTag);> + buffer[3] = 0; /* Reserved */> + buffer[4] = (this_part - 12 - 3) & 255;> + buffer[5] = ((this_part - 12 - 3) >> 8) & 255;> + buffer[6] = ((this_part - 12 - 3) >> 16) & 255;> + buffer[7] = ((this_part - 12 - 3) >> 24) & 255;> + buffer[8] = data->TermCharEnabled * 2;> + /* Use term character? */> + buffer[9] = data->TermChar;> + buffer[10] = 0; /* Reserved */> + buffer[11] = 0; /* Reserved */
This function will go bad if concurrent readers enter, yet it has no locking.
Regards Oliver
ÿôèº{.nÇ+·®+%Ëÿ±éݶ\x17¥wÿº{.nÇ+·¥{±þG«éÿ{ayº\x1dÊÚë,j\a¢f£¢·hïêÿêçz_è®\x03(éÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?¨èÚ&£ø§~á¶iOæ¬z·vØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?I¥
next prev parent reply other threads:[~2008-08-27 8:12 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
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 [this message]
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=200808271013.07561.oliver@neukum.org \
--to=oliver@neukum.org \
--cc=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