<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-toradex.git/drivers/usb/class/usbtmc.c, branch v3.10.78</title>
<subtitle>Linux kernel for Apalis and Colibri modules</subtitle>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/'/>
<entry>
<title>USB: usbtmc: remove unnecessary memory allocation</title>
<updated>2013-04-19T17:20:41+00:00</updated>
<author>
<name>Ming Lei</name>
<email>ming.lei@canonical.com</email>
</author>
<published>2013-04-18T04:17:38+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=ac9e59cad7b0b699b2aa9a104eb22ed67a560e02'/>
<id>ac9e59cad7b0b699b2aa9a104eb22ed67a560e02</id>
<content type='text'>
Inside usbtmc_ioctl_clear_out_halt()/usbtmc_ioctl_clear_in_halt(),
usb_clear_halt() needn't any buffer to pass in, so remove the
unnecessary memory allocation.

Signed-off-by: Ming Lei &lt;ming.lei@canonical.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Inside usbtmc_ioctl_clear_out_halt()/usbtmc_ioctl_clear_in_halt(),
usb_clear_halt() needn't any buffer to pass in, so remove the
unnecessary memory allocation.

Signed-off-by: Ming Lei &lt;ming.lei@canonical.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>USB: convert drivers/usb/* to use module_usb_driver()</title>
<updated>2011-11-18T17:34:02+00:00</updated>
<author>
<name>Greg Kroah-Hartman</name>
<email>gregkh@suse.de</email>
</author>
<published>2011-11-18T17:34:02+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=65db43054065790a75291b0834657445fea2cf56'/>
<id>65db43054065790a75291b0834657445fea2cf56</id>
<content type='text'>
This converts the drivers in drivers/usb/* to use the
module_usb_driver() macro which makes the code smaller and a bit
simpler.

Added bonus is that it removes some unneeded kernel log messages about
drivers loading and/or unloading.

Cc: Simon Arlott &lt;cxacru@fire.lp0.eu&gt;
Cc: Duncan Sands &lt;duncan.sands@free.fr&gt;
Cc: Matthieu CASTET &lt;castet.matthieu@free.fr&gt;
Cc: Stanislaw Gruszka &lt;stf_xl@wp.pl&gt;
Cc: Pete Zaitcev &lt;zaitcev@redhat.com&gt;
Cc: Oliver Neukum &lt;oliver@neukum.name&gt;
Cc: Juergen Stuber &lt;starblue@users.sourceforge.net&gt;
Cc: Cesar Miquel &lt;miquel@df.uba.ar&gt;
Cc: Matthew Dharm &lt;mdharm-usb@one-eyed-alien.net&gt;
Cc: Matthew Wilcox &lt;willy@linux.intel.com&gt;
Cc: Sarah Sharp &lt;sarah.a.sharp@linux.intel.com&gt;
Cc: Kuninori Morimoto &lt;kuninori.morimoto.gx@renesas.com&gt;
Cc: Felipe Balbi &lt;balbi@ti.com&gt;
Cc: Lucas De Marchi &lt;lucas.demarchi@profusion.mobi&gt;
Cc: Michael Hund &lt;mhund@ld-didactic.de&gt;
Cc: Zack Parsons &lt;k3bacon@gmail.com&gt;
Cc: Melchior FRANZ &lt;mfranz@aon.at&gt;
Cc: Tomoki Sekiyama &lt;tomoki.sekiyama@gmail.com&gt;
Cc: Dan Carpenter &lt;error27@gmail.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This converts the drivers in drivers/usb/* to use the
module_usb_driver() macro which makes the code smaller and a bit
simpler.

Added bonus is that it removes some unneeded kernel log messages about
drivers loading and/or unloading.

Cc: Simon Arlott &lt;cxacru@fire.lp0.eu&gt;
Cc: Duncan Sands &lt;duncan.sands@free.fr&gt;
Cc: Matthieu CASTET &lt;castet.matthieu@free.fr&gt;
Cc: Stanislaw Gruszka &lt;stf_xl@wp.pl&gt;
Cc: Pete Zaitcev &lt;zaitcev@redhat.com&gt;
Cc: Oliver Neukum &lt;oliver@neukum.name&gt;
Cc: Juergen Stuber &lt;starblue@users.sourceforge.net&gt;
Cc: Cesar Miquel &lt;miquel@df.uba.ar&gt;
Cc: Matthew Dharm &lt;mdharm-usb@one-eyed-alien.net&gt;
Cc: Matthew Wilcox &lt;willy@linux.intel.com&gt;
Cc: Sarah Sharp &lt;sarah.a.sharp@linux.intel.com&gt;
Cc: Kuninori Morimoto &lt;kuninori.morimoto.gx@renesas.com&gt;
Cc: Felipe Balbi &lt;balbi@ti.com&gt;
Cc: Lucas De Marchi &lt;lucas.demarchi@profusion.mobi&gt;
Cc: Michael Hund &lt;mhund@ld-didactic.de&gt;
Cc: Zack Parsons &lt;k3bacon@gmail.com&gt;
Cc: Melchior FRANZ &lt;mfranz@aon.at&gt;
Cc: Tomoki Sekiyama &lt;tomoki.sekiyama@gmail.com&gt;
Cc: Dan Carpenter &lt;error27@gmail.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>USB: use usb_endpoint_maxp() instead of le16_to_cpu()</title>
<updated>2011-08-23T16:47:40+00:00</updated>
<author>
<name>Kuninori Morimoto</name>
<email>kuninori.morimoto.gx@renesas.com</email>
</author>
<published>2011-08-23T10:12:03+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=29cc88979a8818cd8c5019426e945aed118b400e'/>
<id>29cc88979a8818cd8c5019426e945aed118b400e</id>
<content type='text'>
Now ${LINUX}/drivers/usb/* can use usb_endpoint_maxp(desc) to get maximum packet size
instead of le16_to_cpu(desc-&gt;wMaxPacketSize).
This patch fix it up

Cc: Armin Fuerst &lt;fuerst@in.tum.de&gt;
Cc: Pavel Machek &lt;pavel@ucw.cz&gt;
Cc: Johannes Erdfelt &lt;johannes@erdfelt.com&gt;
Cc: Vojtech Pavlik &lt;vojtech@suse.cz&gt;
Cc: Oliver Neukum &lt;oliver@neukum.name&gt;
Cc: David Kubicek &lt;dave@awk.cz&gt;
Cc: Johan Hovold &lt;jhovold@gmail.com&gt;
Cc: Brad Hards &lt;bhards@bigpond.net.au&gt;
Acked-by: Felipe Balbi &lt;balbi@ti.com&gt;
Cc: Sebastian Andrzej Siewior &lt;bigeasy@linutronix.de&gt;
Cc: Thomas Dahlmann &lt;dahlmann.thomas@arcor.de&gt;
Cc: David Brownell &lt;david-b@pacbell.net&gt;
Cc: David Lopo &lt;dlopo@chipidea.mips.com&gt;
Cc: Alan Stern &lt;stern@rowland.harvard.edu&gt;
Cc: Michal Nazarewicz &lt;m.nazarewicz@samsung.com&gt;
Cc: Xie Xiaobo &lt;X.Xie@freescale.com&gt;
Cc: Li Yang &lt;leoli@freescale.com&gt;
Cc: Jiang Bo &lt;tanya.jiang@freescale.com&gt;
Cc: Yuan-hsin Chen &lt;yhchen@faraday-tech.com&gt;
Cc: Darius Augulis &lt;augulis.darius@gmail.com&gt;
Cc: Xiaochen Shen &lt;xiaochen.shen@intel.com&gt;
Cc: Yoshihiro Shimoda &lt;yoshihiro.shimoda.uh@renesas.com&gt;
Cc: OKI SEMICONDUCTOR, &lt;toshiharu-linux@dsn.okisemi.com&gt;
Cc: Robert Jarzmik &lt;robert.jarzmik@free.fr&gt;
Cc: Ben Dooks &lt;ben@simtec.co.uk&gt;
Cc: Thomas Abraham &lt;thomas.ab@samsung.com&gt;
Cc: Herbert Pötzl &lt;herbert@13thfloor.at&gt;
Cc: Arnaud Patard &lt;arnaud.patard@rtp-net.org&gt;
Cc: Roman Weissgaerber &lt;weissg@vienna.at&gt;
Acked-by: Sarah Sharp &lt;sarah.a.sharp@linux.intel.com&gt;
Cc: Tony Olech &lt;tony.olech@elandigitalsystems.com&gt;
Cc: Florian Floe Echtler &lt;echtler@fs.tum.de&gt;
Cc: Christian Lucht &lt;lucht@codemercs.com&gt;
Cc: Juergen Stuber &lt;starblue@sourceforge.net&gt;
Cc: Georges Toth &lt;g.toth@e-biz.lu&gt;
Cc: Bill Ryder &lt;bryder@sgi.com&gt;
Cc: Kuba Ober &lt;kuba@mareimbrium.org&gt;
Cc: Inaky Perez-Gonzalez &lt;inaky.perez-gonzalez@intel.com&gt;
Signed-off-by: Kuninori Morimoto &lt;kuninori.morimoto.gx@renesas.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Now ${LINUX}/drivers/usb/* can use usb_endpoint_maxp(desc) to get maximum packet size
instead of le16_to_cpu(desc-&gt;wMaxPacketSize).
This patch fix it up

Cc: Armin Fuerst &lt;fuerst@in.tum.de&gt;
Cc: Pavel Machek &lt;pavel@ucw.cz&gt;
Cc: Johannes Erdfelt &lt;johannes@erdfelt.com&gt;
Cc: Vojtech Pavlik &lt;vojtech@suse.cz&gt;
Cc: Oliver Neukum &lt;oliver@neukum.name&gt;
Cc: David Kubicek &lt;dave@awk.cz&gt;
Cc: Johan Hovold &lt;jhovold@gmail.com&gt;
Cc: Brad Hards &lt;bhards@bigpond.net.au&gt;
Acked-by: Felipe Balbi &lt;balbi@ti.com&gt;
Cc: Sebastian Andrzej Siewior &lt;bigeasy@linutronix.de&gt;
Cc: Thomas Dahlmann &lt;dahlmann.thomas@arcor.de&gt;
Cc: David Brownell &lt;david-b@pacbell.net&gt;
Cc: David Lopo &lt;dlopo@chipidea.mips.com&gt;
Cc: Alan Stern &lt;stern@rowland.harvard.edu&gt;
Cc: Michal Nazarewicz &lt;m.nazarewicz@samsung.com&gt;
Cc: Xie Xiaobo &lt;X.Xie@freescale.com&gt;
Cc: Li Yang &lt;leoli@freescale.com&gt;
Cc: Jiang Bo &lt;tanya.jiang@freescale.com&gt;
Cc: Yuan-hsin Chen &lt;yhchen@faraday-tech.com&gt;
Cc: Darius Augulis &lt;augulis.darius@gmail.com&gt;
Cc: Xiaochen Shen &lt;xiaochen.shen@intel.com&gt;
Cc: Yoshihiro Shimoda &lt;yoshihiro.shimoda.uh@renesas.com&gt;
Cc: OKI SEMICONDUCTOR, &lt;toshiharu-linux@dsn.okisemi.com&gt;
Cc: Robert Jarzmik &lt;robert.jarzmik@free.fr&gt;
Cc: Ben Dooks &lt;ben@simtec.co.uk&gt;
Cc: Thomas Abraham &lt;thomas.ab@samsung.com&gt;
Cc: Herbert Pötzl &lt;herbert@13thfloor.at&gt;
Cc: Arnaud Patard &lt;arnaud.patard@rtp-net.org&gt;
Cc: Roman Weissgaerber &lt;weissg@vienna.at&gt;
Acked-by: Sarah Sharp &lt;sarah.a.sharp@linux.intel.com&gt;
Cc: Tony Olech &lt;tony.olech@elandigitalsystems.com&gt;
Cc: Florian Floe Echtler &lt;echtler@fs.tum.de&gt;
Cc: Christian Lucht &lt;lucht@codemercs.com&gt;
Cc: Juergen Stuber &lt;starblue@sourceforge.net&gt;
Cc: Georges Toth &lt;g.toth@e-biz.lu&gt;
Cc: Bill Ryder &lt;bryder@sgi.com&gt;
Cc: Kuba Ober &lt;kuba@mareimbrium.org&gt;
Cc: Inaky Perez-Gonzalez &lt;inaky.perez-gonzalez@intel.com&gt;
Signed-off-by: Kuninori Morimoto &lt;kuninori.morimoto.gx@renesas.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>USB: assign instead of equal in usbtmc.c</title>
<updated>2011-08-08T19:34:45+00:00</updated>
<author>
<name>Maxim Nikulin</name>
<email>m.a.nikulin@gmail.com</email>
</author>
<published>2011-07-09T16:44:44+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=4f1a7a3e78037721496283ea3e87cfefc64d99c7'/>
<id>4f1a7a3e78037721496283ea3e87cfefc64d99c7</id>
<content type='text'>
Assign operator instead of equality test in the usbtmc_ioctl_abort_bulk_in() function.

Signed-off-by: Maxim A. Nikulin &lt;M.A.Nikulin@gmail.com&gt;
Cc: stable &lt;stable@kernel.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Assign operator instead of equality test in the usbtmc_ioctl_abort_bulk_in() function.

Signed-off-by: Maxim A. Nikulin &lt;M.A.Nikulin@gmail.com&gt;
Cc: stable &lt;stable@kernel.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix common misspellings</title>
<updated>2011-03-31T14:26:23+00:00</updated>
<author>
<name>Lucas De Marchi</name>
<email>lucas.demarchi@profusion.mobi</email>
</author>
<published>2011-03-31T01:57:33+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=25985edcedea6396277003854657b5f3cb31a628'/>
<id>25985edcedea6396277003854657b5f3cb31a628</id>
<content type='text'>
Fixes generated by 'codespell' and manually reviewed.

Signed-off-by: Lucas De Marchi &lt;lucas.demarchi@profusion.mobi&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Fixes generated by 'codespell' and manually reviewed.

Signed-off-by: Lucas De Marchi &lt;lucas.demarchi@profusion.mobi&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>llseek: automatically add .llseek fop</title>
<updated>2010-10-15T13:53:27+00:00</updated>
<author>
<name>Arnd Bergmann</name>
<email>arnd@arndb.de</email>
</author>
<published>2010-08-15T16:52:59+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=6038f373a3dc1f1c26496e60b6c40b164716f07e'/>
<id>6038f373a3dc1f1c26496e60b6c40b164716f07e</id>
<content type='text'>
All file_operations should get a .llseek operation so we can make
nonseekable_open the default for future file operations without a
.llseek pointer.

The three cases that we can automatically detect are no_llseek, seq_lseek
and default_llseek. For cases where we can we can automatically prove that
the file offset is always ignored, we use noop_llseek, which maintains
the current behavior of not returning an error from a seek.

New drivers should normally not use noop_llseek but instead use no_llseek
and call nonseekable_open at open time.  Existing drivers can be converted
to do the same when the maintainer knows for certain that no user code
relies on calling seek on the device file.

The generated code is often incorrectly indented and right now contains
comments that clarify for each added line why a specific variant was
chosen. In the version that gets submitted upstream, the comments will
be gone and I will manually fix the indentation, because there does not
seem to be a way to do that using coccinelle.

Some amount of new code is currently sitting in linux-next that should get
the same modifications, which I will do at the end of the merge window.

Many thanks to Julia Lawall for helping me learn to write a semantic
patch that does all this.

===== begin semantic patch =====
// This adds an llseek= method to all file operations,
// as a preparation for making no_llseek the default.
//
// The rules are
// - use no_llseek explicitly if we do nonseekable_open
// - use seq_lseek for sequential files
// - use default_llseek if we know we access f_pos
// - use noop_llseek if we know we don't access f_pos,
//   but we still want to allow users to call lseek
//
@ open1 exists @
identifier nested_open;
@@
nested_open(...)
{
&lt;+...
nonseekable_open(...)
...+&gt;
}

@ open exists@
identifier open_f;
identifier i, f;
identifier open1.nested_open;
@@
int open_f(struct inode *i, struct file *f)
{
&lt;+...
(
nonseekable_open(...)
|
nested_open(...)
)
...+&gt;
}

@ read disable optional_qualifier exists @
identifier read_f;
identifier f, p, s, off;
type ssize_t, size_t, loff_t;
expression E;
identifier func;
@@
ssize_t read_f(struct file *f, char *p, size_t s, loff_t *off)
{
&lt;+...
(
   *off = E
|
   *off += E
|
   func(..., off, ...)
|
   E = *off
)
...+&gt;
}

@ read_no_fpos disable optional_qualifier exists @
identifier read_f;
identifier f, p, s, off;
type ssize_t, size_t, loff_t;
@@
ssize_t read_f(struct file *f, char *p, size_t s, loff_t *off)
{
... when != off
}

@ write @
identifier write_f;
identifier f, p, s, off;
type ssize_t, size_t, loff_t;
expression E;
identifier func;
@@
ssize_t write_f(struct file *f, const char *p, size_t s, loff_t *off)
{
&lt;+...
(
  *off = E
|
  *off += E
|
  func(..., off, ...)
|
  E = *off
)
...+&gt;
}

@ write_no_fpos @
identifier write_f;
identifier f, p, s, off;
type ssize_t, size_t, loff_t;
@@
ssize_t write_f(struct file *f, const char *p, size_t s, loff_t *off)
{
... when != off
}

@ fops0 @
identifier fops;
@@
struct file_operations fops = {
 ...
};

@ has_llseek depends on fops0 @
identifier fops0.fops;
identifier llseek_f;
@@
struct file_operations fops = {
...
 .llseek = llseek_f,
...
};

@ has_read depends on fops0 @
identifier fops0.fops;
identifier read_f;
@@
struct file_operations fops = {
...
 .read = read_f,
...
};

@ has_write depends on fops0 @
identifier fops0.fops;
identifier write_f;
@@
struct file_operations fops = {
...
 .write = write_f,
...
};

@ has_open depends on fops0 @
identifier fops0.fops;
identifier open_f;
@@
struct file_operations fops = {
...
 .open = open_f,
...
};

// use no_llseek if we call nonseekable_open
////////////////////////////////////////////
@ nonseekable1 depends on !has_llseek &amp;&amp; has_open @
identifier fops0.fops;
identifier nso ~= "nonseekable_open";
@@
struct file_operations fops = {
...  .open = nso, ...
+.llseek = no_llseek, /* nonseekable */
};

@ nonseekable2 depends on !has_llseek @
identifier fops0.fops;
identifier open.open_f;
@@
struct file_operations fops = {
...  .open = open_f, ...
+.llseek = no_llseek, /* open uses nonseekable */
};

// use seq_lseek for sequential files
/////////////////////////////////////
@ seq depends on !has_llseek @
identifier fops0.fops;
identifier sr ~= "seq_read";
@@
struct file_operations fops = {
...  .read = sr, ...
+.llseek = seq_lseek, /* we have seq_read */
};

// use default_llseek if there is a readdir
///////////////////////////////////////////
@ fops1 depends on !has_llseek &amp;&amp; !nonseekable1 &amp;&amp; !nonseekable2 &amp;&amp; !seq @
identifier fops0.fops;
identifier readdir_e;
@@
// any other fop is used that changes pos
struct file_operations fops = {
... .readdir = readdir_e, ...
+.llseek = default_llseek, /* readdir is present */
};

// use default_llseek if at least one of read/write touches f_pos
/////////////////////////////////////////////////////////////////
@ fops2 depends on !fops1 &amp;&amp; !has_llseek &amp;&amp; !nonseekable1 &amp;&amp; !nonseekable2 &amp;&amp; !seq @
identifier fops0.fops;
identifier read.read_f;
@@
// read fops use offset
struct file_operations fops = {
... .read = read_f, ...
+.llseek = default_llseek, /* read accesses f_pos */
};

@ fops3 depends on !fops1 &amp;&amp; !fops2 &amp;&amp; !has_llseek &amp;&amp; !nonseekable1 &amp;&amp; !nonseekable2 &amp;&amp; !seq @
identifier fops0.fops;
identifier write.write_f;
@@
// write fops use offset
struct file_operations fops = {
... .write = write_f, ...
+	.llseek = default_llseek, /* write accesses f_pos */
};

// Use noop_llseek if neither read nor write accesses f_pos
///////////////////////////////////////////////////////////

@ fops4 depends on !fops1 &amp;&amp; !fops2 &amp;&amp; !fops3 &amp;&amp; !has_llseek &amp;&amp; !nonseekable1 &amp;&amp; !nonseekable2 &amp;&amp; !seq @
identifier fops0.fops;
identifier read_no_fpos.read_f;
identifier write_no_fpos.write_f;
@@
// write fops use offset
struct file_operations fops = {
...
 .write = write_f,
 .read = read_f,
...
+.llseek = noop_llseek, /* read and write both use no f_pos */
};

@ depends on has_write &amp;&amp; !has_read &amp;&amp; !fops1 &amp;&amp; !fops2 &amp;&amp; !has_llseek &amp;&amp; !nonseekable1 &amp;&amp; !nonseekable2 &amp;&amp; !seq @
identifier fops0.fops;
identifier write_no_fpos.write_f;
@@
struct file_operations fops = {
... .write = write_f, ...
+.llseek = noop_llseek, /* write uses no f_pos */
};

@ depends on has_read &amp;&amp; !has_write &amp;&amp; !fops1 &amp;&amp; !fops2 &amp;&amp; !has_llseek &amp;&amp; !nonseekable1 &amp;&amp; !nonseekable2 &amp;&amp; !seq @
identifier fops0.fops;
identifier read_no_fpos.read_f;
@@
struct file_operations fops = {
... .read = read_f, ...
+.llseek = noop_llseek, /* read uses no f_pos */
};

@ depends on !has_read &amp;&amp; !has_write &amp;&amp; !fops1 &amp;&amp; !fops2 &amp;&amp; !has_llseek &amp;&amp; !nonseekable1 &amp;&amp; !nonseekable2 &amp;&amp; !seq @
identifier fops0.fops;
@@
struct file_operations fops = {
...
+.llseek = noop_llseek, /* no read or write fn */
};
===== End semantic patch =====

Signed-off-by: Arnd Bergmann &lt;arnd@arndb.de&gt;
Cc: Julia Lawall &lt;julia@diku.dk&gt;
Cc: Christoph Hellwig &lt;hch@infradead.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
All file_operations should get a .llseek operation so we can make
nonseekable_open the default for future file operations without a
.llseek pointer.

The three cases that we can automatically detect are no_llseek, seq_lseek
and default_llseek. For cases where we can we can automatically prove that
the file offset is always ignored, we use noop_llseek, which maintains
the current behavior of not returning an error from a seek.

New drivers should normally not use noop_llseek but instead use no_llseek
and call nonseekable_open at open time.  Existing drivers can be converted
to do the same when the maintainer knows for certain that no user code
relies on calling seek on the device file.

The generated code is often incorrectly indented and right now contains
comments that clarify for each added line why a specific variant was
chosen. In the version that gets submitted upstream, the comments will
be gone and I will manually fix the indentation, because there does not
seem to be a way to do that using coccinelle.

Some amount of new code is currently sitting in linux-next that should get
the same modifications, which I will do at the end of the merge window.

Many thanks to Julia Lawall for helping me learn to write a semantic
patch that does all this.

===== begin semantic patch =====
// This adds an llseek= method to all file operations,
// as a preparation for making no_llseek the default.
//
// The rules are
// - use no_llseek explicitly if we do nonseekable_open
// - use seq_lseek for sequential files
// - use default_llseek if we know we access f_pos
// - use noop_llseek if we know we don't access f_pos,
//   but we still want to allow users to call lseek
//
@ open1 exists @
identifier nested_open;
@@
nested_open(...)
{
&lt;+...
nonseekable_open(...)
...+&gt;
}

@ open exists@
identifier open_f;
identifier i, f;
identifier open1.nested_open;
@@
int open_f(struct inode *i, struct file *f)
{
&lt;+...
(
nonseekable_open(...)
|
nested_open(...)
)
...+&gt;
}

@ read disable optional_qualifier exists @
identifier read_f;
identifier f, p, s, off;
type ssize_t, size_t, loff_t;
expression E;
identifier func;
@@
ssize_t read_f(struct file *f, char *p, size_t s, loff_t *off)
{
&lt;+...
(
   *off = E
|
   *off += E
|
   func(..., off, ...)
|
   E = *off
)
...+&gt;
}

@ read_no_fpos disable optional_qualifier exists @
identifier read_f;
identifier f, p, s, off;
type ssize_t, size_t, loff_t;
@@
ssize_t read_f(struct file *f, char *p, size_t s, loff_t *off)
{
... when != off
}

@ write @
identifier write_f;
identifier f, p, s, off;
type ssize_t, size_t, loff_t;
expression E;
identifier func;
@@
ssize_t write_f(struct file *f, const char *p, size_t s, loff_t *off)
{
&lt;+...
(
  *off = E
|
  *off += E
|
  func(..., off, ...)
|
  E = *off
)
...+&gt;
}

@ write_no_fpos @
identifier write_f;
identifier f, p, s, off;
type ssize_t, size_t, loff_t;
@@
ssize_t write_f(struct file *f, const char *p, size_t s, loff_t *off)
{
... when != off
}

@ fops0 @
identifier fops;
@@
struct file_operations fops = {
 ...
};

@ has_llseek depends on fops0 @
identifier fops0.fops;
identifier llseek_f;
@@
struct file_operations fops = {
...
 .llseek = llseek_f,
...
};

@ has_read depends on fops0 @
identifier fops0.fops;
identifier read_f;
@@
struct file_operations fops = {
...
 .read = read_f,
...
};

@ has_write depends on fops0 @
identifier fops0.fops;
identifier write_f;
@@
struct file_operations fops = {
...
 .write = write_f,
...
};

@ has_open depends on fops0 @
identifier fops0.fops;
identifier open_f;
@@
struct file_operations fops = {
...
 .open = open_f,
...
};

// use no_llseek if we call nonseekable_open
////////////////////////////////////////////
@ nonseekable1 depends on !has_llseek &amp;&amp; has_open @
identifier fops0.fops;
identifier nso ~= "nonseekable_open";
@@
struct file_operations fops = {
...  .open = nso, ...
+.llseek = no_llseek, /* nonseekable */
};

@ nonseekable2 depends on !has_llseek @
identifier fops0.fops;
identifier open.open_f;
@@
struct file_operations fops = {
...  .open = open_f, ...
+.llseek = no_llseek, /* open uses nonseekable */
};

// use seq_lseek for sequential files
/////////////////////////////////////
@ seq depends on !has_llseek @
identifier fops0.fops;
identifier sr ~= "seq_read";
@@
struct file_operations fops = {
...  .read = sr, ...
+.llseek = seq_lseek, /* we have seq_read */
};

// use default_llseek if there is a readdir
///////////////////////////////////////////
@ fops1 depends on !has_llseek &amp;&amp; !nonseekable1 &amp;&amp; !nonseekable2 &amp;&amp; !seq @
identifier fops0.fops;
identifier readdir_e;
@@
// any other fop is used that changes pos
struct file_operations fops = {
... .readdir = readdir_e, ...
+.llseek = default_llseek, /* readdir is present */
};

// use default_llseek if at least one of read/write touches f_pos
/////////////////////////////////////////////////////////////////
@ fops2 depends on !fops1 &amp;&amp; !has_llseek &amp;&amp; !nonseekable1 &amp;&amp; !nonseekable2 &amp;&amp; !seq @
identifier fops0.fops;
identifier read.read_f;
@@
// read fops use offset
struct file_operations fops = {
... .read = read_f, ...
+.llseek = default_llseek, /* read accesses f_pos */
};

@ fops3 depends on !fops1 &amp;&amp; !fops2 &amp;&amp; !has_llseek &amp;&amp; !nonseekable1 &amp;&amp; !nonseekable2 &amp;&amp; !seq @
identifier fops0.fops;
identifier write.write_f;
@@
// write fops use offset
struct file_operations fops = {
... .write = write_f, ...
+	.llseek = default_llseek, /* write accesses f_pos */
};

// Use noop_llseek if neither read nor write accesses f_pos
///////////////////////////////////////////////////////////

@ fops4 depends on !fops1 &amp;&amp; !fops2 &amp;&amp; !fops3 &amp;&amp; !has_llseek &amp;&amp; !nonseekable1 &amp;&amp; !nonseekable2 &amp;&amp; !seq @
identifier fops0.fops;
identifier read_no_fpos.read_f;
identifier write_no_fpos.write_f;
@@
// write fops use offset
struct file_operations fops = {
...
 .write = write_f,
 .read = read_f,
...
+.llseek = noop_llseek, /* read and write both use no f_pos */
};

@ depends on has_write &amp;&amp; !has_read &amp;&amp; !fops1 &amp;&amp; !fops2 &amp;&amp; !has_llseek &amp;&amp; !nonseekable1 &amp;&amp; !nonseekable2 &amp;&amp; !seq @
identifier fops0.fops;
identifier write_no_fpos.write_f;
@@
struct file_operations fops = {
... .write = write_f, ...
+.llseek = noop_llseek, /* write uses no f_pos */
};

@ depends on has_read &amp;&amp; !has_write &amp;&amp; !fops1 &amp;&amp; !fops2 &amp;&amp; !has_llseek &amp;&amp; !nonseekable1 &amp;&amp; !nonseekable2 &amp;&amp; !seq @
identifier fops0.fops;
identifier read_no_fpos.read_f;
@@
struct file_operations fops = {
... .read = read_f, ...
+.llseek = noop_llseek, /* read uses no f_pos */
};

@ depends on !has_read &amp;&amp; !has_write &amp;&amp; !fops1 &amp;&amp; !fops2 &amp;&amp; !has_llseek &amp;&amp; !nonseekable1 &amp;&amp; !nonseekable2 &amp;&amp; !seq @
identifier fops0.fops;
@@
struct file_operations fops = {
...
+.llseek = noop_llseek, /* no read or write fn */
};
===== End semantic patch =====

Signed-off-by: Arnd Bergmann &lt;arnd@arndb.de&gt;
Cc: Julia Lawall &lt;julia@diku.dk&gt;
Cc: Christoph Hellwig &lt;hch@infradead.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h</title>
<updated>2010-03-30T13:02:32+00:00</updated>
<author>
<name>Tejun Heo</name>
<email>tj@kernel.org</email>
</author>
<published>2010-03-24T08:04:11+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=5a0e3ad6af8660be21ca98a971cd00f331318c05'/>
<id>5a0e3ad6af8660be21ca98a971cd00f331318c05</id>
<content type='text'>
percpu.h is included by sched.h and module.h and thus ends up being
included when building most .c files.  percpu.h includes slab.h which
in turn includes gfp.h making everything defined by the two files
universally available and complicating inclusion dependencies.

percpu.h -&gt; slab.h dependency is about to be removed.  Prepare for
this change by updating users of gfp and slab facilities include those
headers directly instead of assuming availability.  As this conversion
needs to touch large number of source files, the following script is
used as the basis of conversion.

  http://userweb.kernel.org/~tj/misc/slabh-sweep.py

The script does the followings.

* Scan files for gfp and slab usages and update includes such that
  only the necessary includes are there.  ie. if only gfp is used,
  gfp.h, if slab is used, slab.h.

* When the script inserts a new include, it looks at the include
  blocks and try to put the new include such that its order conforms
  to its surrounding.  It's put in the include block which contains
  core kernel includes, in the same order that the rest are ordered -
  alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
  doesn't seem to be any matching order.

* If the script can't find a place to put a new include (mostly
  because the file doesn't have fitting include block), it prints out
  an error message indicating which .h file needs to be added to the
  file.

The conversion was done in the following steps.

1. The initial automatic conversion of all .c files updated slightly
   over 4000 files, deleting around 700 includes and adding ~480 gfp.h
   and ~3000 slab.h inclusions.  The script emitted errors for ~400
   files.

2. Each error was manually checked.  Some didn't need the inclusion,
   some needed manual addition while adding it to implementation .h or
   embedding .c file was more appropriate for others.  This step added
   inclusions to around 150 files.

3. The script was run again and the output was compared to the edits
   from #2 to make sure no file was left behind.

4. Several build tests were done and a couple of problems were fixed.
   e.g. lib/decompress_*.c used malloc/free() wrappers around slab
   APIs requiring slab.h to be added manually.

5. The script was run on all .h files but without automatically
   editing them as sprinkling gfp.h and slab.h inclusions around .h
   files could easily lead to inclusion dependency hell.  Most gfp.h
   inclusion directives were ignored as stuff from gfp.h was usually
   wildly available and often used in preprocessor macros.  Each
   slab.h inclusion directive was examined and added manually as
   necessary.

6. percpu.h was updated not to include slab.h.

7. Build test were done on the following configurations and failures
   were fixed.  CONFIG_GCOV_KERNEL was turned off for all tests (as my
   distributed build env didn't work with gcov compiles) and a few
   more options had to be turned off depending on archs to make things
   build (like ipr on powerpc/64 which failed due to missing writeq).

   * x86 and x86_64 UP and SMP allmodconfig and a custom test config.
   * powerpc and powerpc64 SMP allmodconfig
   * sparc and sparc64 SMP allmodconfig
   * ia64 SMP allmodconfig
   * s390 SMP allmodconfig
   * alpha SMP allmodconfig
   * um on x86_64 SMP allmodconfig

8. percpu.h modifications were reverted so that it could be applied as
   a separate patch and serve as bisection point.

Given the fact that I had only a couple of failures from tests on step
6, I'm fairly confident about the coverage of this conversion patch.
If there is a breakage, it's likely to be something in one of the arch
headers which should be easily discoverable easily on most builds of
the specific arch.

Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
Guess-its-ok-by: Christoph Lameter &lt;cl@linux-foundation.org&gt;
Cc: Ingo Molnar &lt;mingo@redhat.com&gt;
Cc: Lee Schermerhorn &lt;Lee.Schermerhorn@hp.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
percpu.h is included by sched.h and module.h and thus ends up being
included when building most .c files.  percpu.h includes slab.h which
in turn includes gfp.h making everything defined by the two files
universally available and complicating inclusion dependencies.

percpu.h -&gt; slab.h dependency is about to be removed.  Prepare for
this change by updating users of gfp and slab facilities include those
headers directly instead of assuming availability.  As this conversion
needs to touch large number of source files, the following script is
used as the basis of conversion.

  http://userweb.kernel.org/~tj/misc/slabh-sweep.py

The script does the followings.

* Scan files for gfp and slab usages and update includes such that
  only the necessary includes are there.  ie. if only gfp is used,
  gfp.h, if slab is used, slab.h.

* When the script inserts a new include, it looks at the include
  blocks and try to put the new include such that its order conforms
  to its surrounding.  It's put in the include block which contains
  core kernel includes, in the same order that the rest are ordered -
  alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
  doesn't seem to be any matching order.

* If the script can't find a place to put a new include (mostly
  because the file doesn't have fitting include block), it prints out
  an error message indicating which .h file needs to be added to the
  file.

The conversion was done in the following steps.

1. The initial automatic conversion of all .c files updated slightly
   over 4000 files, deleting around 700 includes and adding ~480 gfp.h
   and ~3000 slab.h inclusions.  The script emitted errors for ~400
   files.

2. Each error was manually checked.  Some didn't need the inclusion,
   some needed manual addition while adding it to implementation .h or
   embedding .c file was more appropriate for others.  This step added
   inclusions to around 150 files.

3. The script was run again and the output was compared to the edits
   from #2 to make sure no file was left behind.

4. Several build tests were done and a couple of problems were fixed.
   e.g. lib/decompress_*.c used malloc/free() wrappers around slab
   APIs requiring slab.h to be added manually.

5. The script was run on all .h files but without automatically
   editing them as sprinkling gfp.h and slab.h inclusions around .h
   files could easily lead to inclusion dependency hell.  Most gfp.h
   inclusion directives were ignored as stuff from gfp.h was usually
   wildly available and often used in preprocessor macros.  Each
   slab.h inclusion directive was examined and added manually as
   necessary.

6. percpu.h was updated not to include slab.h.

7. Build test were done on the following configurations and failures
   were fixed.  CONFIG_GCOV_KERNEL was turned off for all tests (as my
   distributed build env didn't work with gcov compiles) and a few
   more options had to be turned off depending on archs to make things
   build (like ipr on powerpc/64 which failed due to missing writeq).

   * x86 and x86_64 UP and SMP allmodconfig and a custom test config.
   * powerpc and powerpc64 SMP allmodconfig
   * sparc and sparc64 SMP allmodconfig
   * ia64 SMP allmodconfig
   * s390 SMP allmodconfig
   * alpha SMP allmodconfig
   * um on x86_64 SMP allmodconfig

8. percpu.h modifications were reverted so that it could be applied as
   a separate patch and serve as bisection point.

Given the fact that I had only a couple of failures from tests on step
6, I'm fairly confident about the coverage of this conversion patch.
If there is a breakage, it's likely to be something in one of the arch
headers which should be easily discoverable easily on most builds of
the specific arch.

Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
Guess-its-ok-by: Christoph Lameter &lt;cl@linux-foundation.org&gt;
Cc: Ingo Molnar &lt;mingo@redhat.com&gt;
Cc: Lee Schermerhorn &lt;Lee.Schermerhorn@hp.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>USB: BKL removal: usbtmc</title>
<updated>2010-03-02T22:54:27+00:00</updated>
<author>
<name>Oliver Neukum</name>
<email>oliver@neukum.org</email>
</author>
<published>2010-01-14T15:08:42+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=0022457a5469d328219dfb1ea5bd89d076e28372'/>
<id>0022457a5469d328219dfb1ea5bd89d076e28372</id>
<content type='text'>
BKL not needed at all. Removed without replacement.

Signed-off-by: Oliver Neukum &lt;oliver@neukum.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;

</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
BKL not needed at all. Removed without replacement.

Signed-off-by: Oliver Neukum &lt;oliver@neukum.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;

</pre>
</div>
</content>
</entry>
<entry>
<title>USB: Push BKL on open down into the drivers</title>
<updated>2010-03-02T22:54:23+00:00</updated>
<author>
<name>Oliver Neukum</name>
<email>oliver@neukum.org</email>
</author>
<published>2010-01-13T14:33:15+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=86266452f80545285c14e20a8024f79c4fb88a86'/>
<id>86266452f80545285c14e20a8024f79c4fb88a86</id>
<content type='text'>
Straightforward push into the drivers to allow
auditing individual drivers separately

Signed-off-by: Oliver Neukum &lt;oliver@neukum.org&gt;
Acked-by: Mauro Carvalho Chehab &lt;mchehab@redhat.com&gt;
Cc: Jiri Kosina &lt;jkosina@suse.cz&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;

</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Straightforward push into the drivers to allow
auditing individual drivers separately

Signed-off-by: Oliver Neukum &lt;oliver@neukum.org&gt;
Acked-by: Mauro Carvalho Chehab &lt;mchehab@redhat.com&gt;
Cc: Jiri Kosina &lt;jkosina@suse.cz&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;

</pre>
</div>
</content>
</entry>
<entry>
<title>USB class: make USB device id constant</title>
<updated>2010-03-02T22:54:15+00:00</updated>
<author>
<name>Németh Márton</name>
<email>nm127@freemail.hu</email>
</author>
<published>2010-01-10T14:33:45+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=6ef4852b1326301f6e9657e99b2c3221be1a3a44'/>
<id>6ef4852b1326301f6e9657e99b2c3221be1a3a44</id>
<content type='text'>
The id_table field of the struct usb_device_id is constant in &lt;linux/usb.h&gt;
so it is worth to make the initialization data also constant.

The semantic match that finds this kind of pattern is as follows:
(http://coccinelle.lip6.fr/)

// &lt;smpl&gt;
@r@
disable decl_init,const_decl_init;
identifier I1, I2, x;
@@
	struct I1 {
	  ...
	  const struct I2 *x;
	  ...
	};
@s@
identifier r.I1, y;
identifier r.x, E;
@@
	struct I1 y = {
	  .x = E,
	};
@c@
identifier r.I2;
identifier s.E;
@@
	const struct I2 E[] = ... ;
@depends on !c@
identifier r.I2;
identifier s.E;
@@
+	const
	struct I2 E[] = ...;
// &lt;/smpl&gt;

Signed-off-by: Németh Márton &lt;nm127@freemail.hu&gt;
Cc: Julia Lawall &lt;julia@diku.dk&gt;
Cc: cocci@diku.dk
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;

</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The id_table field of the struct usb_device_id is constant in &lt;linux/usb.h&gt;
so it is worth to make the initialization data also constant.

The semantic match that finds this kind of pattern is as follows:
(http://coccinelle.lip6.fr/)

// &lt;smpl&gt;
@r@
disable decl_init,const_decl_init;
identifier I1, I2, x;
@@
	struct I1 {
	  ...
	  const struct I2 *x;
	  ...
	};
@s@
identifier r.I1, y;
identifier r.x, E;
@@
	struct I1 y = {
	  .x = E,
	};
@c@
identifier r.I2;
identifier s.E;
@@
	const struct I2 E[] = ... ;
@depends on !c@
identifier r.I2;
identifier s.E;
@@
+	const
	struct I2 E[] = ...;
// &lt;/smpl&gt;

Signed-off-by: Németh Márton &lt;nm127@freemail.hu&gt;
Cc: Julia Lawall &lt;julia@diku.dk&gt;
Cc: cocci@diku.dk
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;

</pre>
</div>
</content>
</entry>
</feed>
