Commit Graph

68 Commits (5dae92a718570e6a942e0b882e53d25cab03b40f)

Author SHA1 Message Date
Sebastian Andrzej Siewior 5c4d46eb89 usb: gadget serial: don't shift bcd version left by 16
Fengguang Wu reported:
|drivers/usb/gadget/serial.c:89:22: sparse: cast truncates bits from
|constant value (24000000 becomes 0)

I obviously let the version number shift away. Since the version is a
16bit number it can be applied as it.

Cc: fengguang.wu@intel.com
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2012-09-10 20:04:20 +03:00
Sebastian Andrzej Siewior ed9cbda63d usb: gadget: remove usb_gadget_controller_number()
The bcdDevice field is defined as
|Device release number in binary-coded decimal
in the USB 2.0 specification. We use this field to distinguish the UDCs
from each other. In theory this could be used on the host side to apply
certain quirks if the "special" UDC in combination with this gadget is
used. This hasn't been done as far as I am aware. In practice it would
be better to fix the UDC driver before shipping since a later release
might not need this quirk anymore.

There are some driver in tree (on the host side) which use the bcdDevice
field to figure out special workarounds for a given firmware revision.
This seems to make sense. Therefore this patch converts all gadgets
(except a few) to use the kernel version instead a random 2 or 3 plus
the UDC number. The few that don't report kernel's version are:
- webcam
  This one reports always a version 0x10 so allow it to do so in future.
- nokia
  This one reports always 0x211. The comment says that this gadget works
  only if the UDC supports altsettings so I added a check for this.
- serial
  This one reports 0x2400 + UDC number. Since the gadget version is 2.4
  this could make sense. Therefore bcdDevice is 0x2400 here.

I also remove various gadget_is_<name> macros which are unused. The
remaining few macros should be moved to feature / bug bitfield.

Acked-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2012-09-10 16:43:24 +03:00
Sebastian Andrzej Siewior 721e2e9194 usb: gadget: libcomposite: move composite.c into libcomposite
This moves composite.c into libcomposite and updates all gadgets.
Finally!

Acked-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2012-09-10 16:13:03 +03:00
Sebastian Andrzej Siewior cc2683c318 usb: gadget: Provide a default implementation of default manufacturer string
Some gadgets provide custom entry here. Some may override it with an
etntry that is also created by composite if there was no value sumbitted
at all.
This patch removes all "custom manufacturer" strings which are the same
as these which are created by composite. Then it moves the creation of
the default manufacturer string to usb_composite_overwrite_options() in
case no command line argument has been used and the entry is still an
empty string.
By doing this we get rid of the global variable "composite_manufacturer"
in composite.

Acked-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2012-09-10 16:13:02 +03:00
Sebastian Andrzej Siewior 276e2e4f1f usb: gadget: make sure each gadget is using same index for Product, Serial,…
The index in usb_string array is defined by the gadget. The gadget can
choose which index entry it assigns for the serial number and which the
product name. The gadget has just to ensure that the descriptor contains
the proper string id which is assigned by composite.
If the composite layer knows the index of the "default" information
which will be overwritten by module parameters, it can be used later to
overwrite it.

Acked-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2012-09-10 16:13:00 +03:00
Sebastian Andrzej Siewior 7d16e8d3eb usb: gadget: push VID/PID/USB BCD module option into gadgets
This patch moves the module options idVendor, idProduct and bcdDevice
from composite.c into each gadgets. This ensures compatibility with
current gadgets and removes the global variable which brings me step
closer towards composite.c in libcomposite

Acked-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2012-09-10 16:12:59 +03:00
Sebastian Andrzej Siewior e1f15ccbae usb: gadget: use usb_string_ids_tab instead multiple usb_string_id()
Using usb_string_ids_tab() instead multiple calls of usb_string_id()
seems to be handy. It also allows to add string without many checks.

Acked-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2012-09-10 16:06:48 +03:00
Sebastian Andrzej Siewior dc995fc27c usb: gadget: libcomposite: add epautoconf.c to libcomposite
This patch adds epautoconf.c into libcomposite and updates all gadgets.

Acked-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2012-09-10 15:37:51 +03:00
Sebastian Andrzej Siewior 0ba16dea72 usb: gadget: libcomposite: move config.c into libcomposite
This patch moves config.c into libcomposite and updates all gadgets.

Acked-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2012-09-10 15:36:16 +03:00
Sebastian Andrzej Siewior a84d9e5361 usb: gadget: start with libcomposite
This patch aims to be simple. It removes #include usbstribgs.c line from each
gadget and creates libcomposite.ko which has only one member, that is
usbstribgs.c.

Acked-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2012-09-10 15:36:04 +03:00
Sebastian Andrzej Siewior 03e42bd593 usb: gadget: move bind() callback back to struct usb_composite_driver
This partly reverts 07a18bd7 ("usb gadget: don't save bind callback in
struct usb_composite_driver") and fixes new drivers. The section missmatch
problems was solved by whitelisting structs in question via __ref.

Cc: devel@driverdev.osuosl.org
Acked-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2012-09-10 15:34:48 +03:00
Sebastian Andrzej Siewior c2ec75c251 usb: gadget: push all usb_composite_driver structs into __refdata
As it turns out, Sam's comment was better than I initially assumed. This
patch pushes as struct usb_composite_driver data structures into
__refdata section to avoid a section missmatch report from modpost
because the ->bind() can be marked __init. The only downside is that
modpost does not check between ->bind() and other member. However, it is
temporary.

Cc: Sam Ravnborg <sam@ravnborg.org>
Acked-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2012-09-10 15:34:24 +03:00
Sebastian Andrzej Siewior 6fecfb05c0 usb: gadget: add usb3.0 descriptors to serial gadgets
This patch adds SS descriptors to the ACM & generic serial gadget. The
ACM part was tested with minicom + dummy + send / receive files over
ttyACM <=> ttyGS0.
The generic serial part (f_serial) was not tested (haven't found a
driver on the host side).
The nokia & multi gadget use HS at most.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2012-02-09 10:11:36 +02:00
Rusty Russell 90ab5ee941 module_param: make bool parameters really bool (drivers & misc)
module_param(bool) used to counter-intuitively take an int.  In
fddd5201 (mid-2009) we allowed bool or int/unsigned int using a messy
trick.

It's time to remove the int/unsigned int option.  For this version
it'll simply give a warning, but it'll break next kernel version.

Acked-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2012-01-13 09:32:20 +10:30
Tatyana Brokhman 35a0e0bf6f usb: gadget: add max_speed to usb_composite_driver
This field is used by the Gadget drivers to specify
the maximum speed they support, meaning: the maximum
speed they can provide descriptors for.

The driver speed will be set in consideration of this
value.

[ balbi@ti.com : dropped the ifdeffery ]

Signed-off-by: Tatyana Brokhman <tlinder@codeaurora.org>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-07-01 14:27:05 -07:00
Uwe Kleine-König c9bfff9c98 usb gadget: don't save bind callback in struct usb_configuration
The bind function is most of the time only called at init time so there
is no need to save a pointer to it in the configuration structure.

This fixes many section mismatches reported by modpost.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
[m.nazarewicz@samsung.com: updated for -next]
Signed-off-by: Michał Nazarewicz <m.nazarewicz@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2010-10-22 10:21:26 -07:00
Michal Nazarewicz 07a18bd716 usb gadget: don't save bind callback in struct usb_composite_driver
The bind function is most of the time only called at init time so there
is no need to save a pointer to it in the composite driver structure.

This fixes many section mismatches reported by modpost.

Signed-off-by: Michał Nazarewicz <m.nazarewicz@samsung.com>
Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2010-10-22 10:21:25 -07:00
Michal Nazarewicz e12995ec8f USB: Revert "USB: gadget: section mismatch warning fixed"
This reverts a commit which proposed an invalid solution
for a section mismatch.  Next 3 commits will fix it correctly.

Conflicts:

	drivers/usb/gadget/mass_storage.c

Signed-off-by: Michal Nazarewicz <m.nazarewicz@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2010-10-22 10:21:24 -07:00
Michal Nazarewicz 89ba85d401 USB: gadget: section mismatch warning fixed
In may gadgets bind and bind like functions were in a init section
as they were only run during initialisation.  However, being
callback functions they were referenced from structures in “normal”
sections.  Changing the tag from “__init” to “__ref” fixes the
warnings.

Signed-off-by: Michal Nazarewicz <m.nazarewicz@samsung.com>
Cc: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2010-08-10 14:35:37 -07:00
Harvey Harrison 551509d267 USB: replace uses of __constant_{endian}
The base versions handle constant folding now.

Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2009-03-24 16:20:33 -07:00
David Brownell 36e893d25a usb gadget: USB_GADGET_VBUS_DRAW Kconfig option
Offer a "how much VBUS power to request" configuration option
for USB gadgets that aren't using board-specific customization
of their gadget or (composite) configuration drivers.

Also remove a couple pointless "depends on USB_GADGET" bits
from the Kconfig text; booleans inside an "if USB_GADGET" will
already have that dependency.

Based on a patch from Justin Clacherty.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Cc: Justin Clacherty <justin@redfish-group.com>
Tested-by: Robert Jarzmik <robert.jarzmik@free.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-10-17 14:40:58 -07:00
Felipe Balbi 3086775a49 usb gadget: cdc obex glue
The following patch introduces a new f_obex.c function driver.
It allows userspace obex servers to use usb as transport layer
for their messages.

[ dbrownell@users.sourceforge.net: various fixes and cleanups ]

Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-10-17 14:40:53 -07:00
David Brownell 4e9ba518ec usb gadget: link fixes for serial gadget
Change how the serial gadget driver builds:  don't use
separate compilation, since it works poorly when key parts
are library code (with init sections etc).  Instead be as
close as we can to "gcc --combine ...".

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-10-16 09:24:45 -07:00
David Brownell 7bb5ea54be usb gadget serial: use composite gadget framework
This switches the serial gadget over to using the new "function"
versions of the serial port interfacing code.  The remaining code
in the main source file is quite small...

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-07-21 15:16:09 -07:00
David Brownell a7707adf9e usb gadget: use new serial core
Teach "gadget serial" to use the new abstracted (and bugfixed) TTY glue,
and remove all the orignal tangled-up code.  Update the documentation
accordingly.  This is a net object code shrink and cleanup; it should
make it a lot easier to see how the TTY glue should accomodate updates
to the TTY layer, be bugfixed, etc.

Notable behavior changes include:  it can now support getty even when
there's no USB connection; it fits properly into the mdev/udev world;
and RX handling is better (throttling works, and low latency).

Configurations with scripts setting up the /dev/ttygserial device node
(with "experimental" major number) may want to change that to be a
symlink pointing to the /dev/ttyGS0 file, as a migration aid; else,
just switch entirely over to mdev/udev.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-07-21 15:15:59 -07:00
David Brownell b9370332f4 USB: serial gadget: descriptor cleanup
Bugfix some serial gadget descriptors:

 - Stop mangling the low bits (controller type ID) of bcdDevice;
   just use the high bits for a driver revision code.

 - Serial numbers that aren't specific to individual devices
   are useless; stop reporting "0" for this.

 - Since it's not part of a CDC-conformant function, the "bulk only"
   configuration shouldn't be using "CDC Data" as its interface class.
   Switch over to using CLASS_VENDOR_SPEC (different value, 0xff).

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Cc: Al Borchers <alborchers@steinerpoint.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-05-14 10:00:28 -07:00
David Brownell 734d37c654 USB: serial gadget: simplify endpoint handling
Switch serial gadget away from a *very* old idiom:  just remember
the endpoints we'll be using, instead of looking them up by name
each time.  This is a net code and data (globals) shrink.

Also fix a small memory leak in the rmmod path, by working the
same as the disconnect code.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Cc: Al Borchers <alborchers@steinerpoint.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-05-14 10:00:28 -07:00
David Brownell 2c2d28a015 USB: serial gadget: remove needless data structure
This removes a needless data structure from the serial gadget code;
it's a small code shrink, and a larger data shrink.

Since "struct usb_request" already has a "struct list_head" reserved
for use by gadget drivers, the serial gadget code doesn't need to
allocate wrapper structs to hold that list ... it can (and should!)
just use the list_head provided for that exact use.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Cc: Al Borchers <alborchers@steinerpoint.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-05-14 10:00:28 -07:00
David Brownell 9079e91b5b USB: serial gadget: cleanup/reorg
Some cleanup/reorg of g_serial ... simplifying it, and disentangling
its structure so morphing it into a "function" driver (combinable with
other interfaces) should be less painful.

 - Remove most forward declarations
     * put tty and gadget driver structs after their contents
     * snug module init/exit decls next to their functions
     * reordered some functions

 - Other cleanup:
     * convert a funky macro to an inline function
     * snug up module params next to their declarations
     * add missing driver.owner
     * add separator lines between major driver sections

 - Add comments re potential parameter/#define changes:
     * only supports one port (shrank GS_NUM_PORTS)
     * changing from 9600-8-N-1 affects multiple sites

 - Remove net2280-specific optimization ... it was being done
   way too late, can be done by net2280 module options, and in
   any case doesn't matter at any sane serial data rates.

There are no behavioral changes, but the macro thing saves I-space.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Cc: Al Borchers <alborchers@steinerpoint.com>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-05-14 10:00:28 -07:00
David Brownell f371e750c9 usb serial gadget: CDC ACM fixes
Based on a patch from <Aurel.Thomi@ruag.com>, this makes the
CDC-ACM support in the serial gadget handle the SET_LINE_CODING
and SET_CONTROL_LINE_STATE requests ... which should improve
interop with at least MS-Windows "usbser.sys" if not some other
ACM host drivers.

It also adds a few REVISIT comments where this code plays a bit
loose with the CDC ACM spec.  If this were used to hook up to a
real RS232 or modem link, those places would need a bit of work.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-05-02 10:25:53 -07:00
Alan Cox 4cd55ab1f9 usb gadget: switch to put_char returning int
Signed-off-by: Alan Cox <alan@redhat.com>
Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
Acked-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-04-30 08:29:45 -07:00
Savin Zlobec 4208978ec4 USB: gadget: Hangup tty on g_serial disconnect
On USB cable disconnect g_serial doesn't hangup the port tty,
which results in an endless read on the tty device. With the
following patch the read and select behave correctly when
the cable is unplugged.

Tested on at91rm9200

Signed-off-by: Savin Zlobec <savin@epiko.si>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-04-24 21:16:35 -07:00
David Brownell 00274921a0 USB: gadget code switches to pr_err() and friends
We now have pr_err(), pr_warning(), and friends ... start using
them in the gadget stack instead of printk(KERN_ERR) and friends.
This gives us shorter lines and somewhat increased readability.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-02-01 14:34:51 -08:00
David Brownell 9454a57ab5 USB: move <linux/usb_gadget.h> to <linux/usb/gadget.h>
Move <linux/usb_gadget.h> to <linux/usb/gadget.h>, reducing
some of the clutter in the main include directory.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-10-12 14:55:31 -07:00
Vitaly Bordug 437f375f26 USB: serial gadget: Disable endpoints on unload
After Serial gadget is being unloaded, neither serial itself, nor other
gadget stuff can be loaded subsequently.

Signed-off-by: Vitaly Bordug <vitb@kernel.crashing.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-10-12 14:55:30 -07:00
David Brownell 51a0e85cd9 USB: gadget: serial gadget cleanups
Clean up the serial gadget, using newer APIs and conventions:

 - gadget_is_dualspeed() and gadget_is_otg() ... #ifdef removal

 - Remove many now-needless #includes

 - Use the DEBUG and VERBOSE_DEBUG conventions; turned up a bug in
   the original debug messaging

 - Various whitespace fixes.

This gave only a minor object code shrinkage, but the source looks
much cleaner in various places.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Cc: Al Borchers <alborchers@steinerpoint.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-10-12 14:55:03 -07:00
David Brownell 49b4f90285 USB: fix serial gadget ACM breakage
Two of the CDC ACM control requests in the serial gadget have never
been correct, and have been reported to cause serious troubles ... as
in, soft lockup and maybe watchdog reset (depending on hardware).

This patch makes those request fail cleanly, rather than misbehaving.
Someone using CDC ACM should fix them according to the FIXME comments
which now replace the previous bugs.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-09-11 07:48:16 -07:00
Matthias Kaehlcke 831c70fc13 USB: use mutex instead of semaphore in the USB gadget serial driver
The USB gadget serial driver uses a semaphore as mutex. Use the
mutex API instead of the (binary) semaphore.

Signed-off-by: Matthias Kaehlcke <matthias.kaehlcke@gmail.com>
Acked-by: David Brownell <david-b@pacbell.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-19 17:46:03 -07:00
Yoann Padioleau dd00cc486a some kmalloc/memset ->kzalloc (tree wide)
Transform some calls to kmalloc/memset to a single kzalloc (or kcalloc).

Here is a short excerpt of the semantic patch performing
this transformation:

@@
type T2;
expression x;
identifier f,fld;
expression E;
expression E1,E2;
expression e1,e2,e3,y;
statement S;
@@

 x =
- kmalloc
+ kzalloc
  (E1,E2)
  ...  when != \(x->fld=E;\|y=f(...,x,...);\|f(...,x,...);\|x=E;\|while(...) S\|for(e1;e2;e3) S\)
- memset((T2)x,0,E1);

@@
expression E1,E2,E3;
@@

- kzalloc(E1 * E2,E3)
+ kcalloc(E1,E2,E3)

[akpm@linux-foundation.org: get kcalloc args the right way around]
Signed-off-by: Yoann Padioleau <padator@wanadoo.fr>
Cc: Richard Henderson <rth@twiddle.net>
Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
Acked-by: Russell King <rmk@arm.linux.org.uk>
Cc: Bryan Wu <bryan.wu@analog.com>
Acked-by: Jiri Slaby <jirislaby@gmail.com>
Cc: Dave Airlie <airlied@linux.ie>
Acked-by: Roland Dreier <rolandd@cisco.com>
Cc: Jiri Kosina <jkosina@suse.cz>
Acked-by: Dmitry Torokhov <dtor@mail.ru>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Acked-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Acked-by: Pierre Ossman <drzeus-list@drzeus.cx>
Cc: Jeff Garzik <jeff@garzik.org>
Cc: "David S. Miller" <davem@davemloft.net>
Acked-by: Greg KH <greg@kroah.com>
Cc: James Bottomley <James.Bottomley@steeleye.com>
Cc: "Antonino A. Daplas" <adaplas@pol.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-07-19 10:04:50 -07:00
David Brownell b29dbbd811 USB: usb serial gadget, sparse fixes
Fix a few serial gadget issues reported by the latest "sparse":
some functions should have been defined as static, not just
declared that way.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:29:51 -07:00
Randy Dunlap e63340ae6b header cleaning: don't include smp_lock.h when not used
Remove includes of <linux/smp_lock.h> where it is not used/needed.
Suggested by Al Viro.

Builds cleanly on x86_64, i386, alpha, ia64, powerpc, sparc,
sparc64, and arm (all 59 defconfigs).

Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-05-08 11:15:07 -07:00
Bryan O'Donoghue 8356f3113d USB: fix g_serial small error
A SET_LINE_CODING control request should return a zero length packet
as an ACK to the host, during the status phase of a USB transaction.

The return value of gs_setup_class() is treated as the number of
bytes to write in the status phase of the control request, by
gs_setup(). For this case, the value returned by gs_setup_class should
be zero for SET_LINE_CODING but, right now, appears to be
sizeof(struct usb_cdc_line_coding).

However, if after doing the memcpy of the line coding descriptor we
set the variable "ret" to be zero, we should return the appropiate ZLP
to the host as an ACK in the status phase of the control request.
I've tested this out using Linux as both host and slave and confirmed
that the following small change fixes the spurious return of
sizeof(struct usb_cdc_line_coding)/wLength bytes in the status phase
of a USB_CDC_REQ_SET_LINE_CODING request. It's not a huge bug but, it
is worth fixing.

Signed-off-by: Bryan O'Donoghue <bodonoghue@codehermit.ie>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-02-16 15:32:20 -08:00
Tim Schmielau cd354f1ae7 [PATCH] remove many unneeded #includes of sched.h
After Al Viro (finally) succeeded in removing the sched.h #include in module.h
recently, it makes sense again to remove other superfluous sched.h includes.
There are quite a lot of files which include it but don't actually need
anything defined in there.  Presumably these includes were once needed for
macros that used to live in sched.h, but moved to other header files in the
course of cleaning it up.

To ease the pain, this time I did not fiddle with any header files and only
removed #includes from .c-files, which tend to cause less trouble.

Compile tested against 2.6.20-rc2 and 2.6.20-rc2-mm2 (with offsets) on alpha,
arm, i386, ia64, mips, powerpc, and x86_64 with allnoconfig, defconfig,
allmodconfig, and allyesconfig as well as a few randconfigs on x86_64 and all
configs in arch/arm/configs on arm.  I also checked that no new warnings were
introduced by the patch (actually, some warnings are removed that were emitted
by unnecessarily included header files).

Signed-off-by: Tim Schmielau <tim@physik3.uni-rostock.de>
Acked-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-02-14 08:09:54 -08:00
David Brownell 5f84813774 USB: <linux/usb_ch9.h> becomes <linux/usb/ch9.h>
This moves <linux/usb_ch9.h> to <linux/usb/ch9.h> to reduce some of the
clutter of usb header files.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-02-07 15:44:32 -08:00
David Brownell 6bea476cf6 USB: gadget driver unbind() is optional; section fixes; misc
Allow gadget drivers to omit the unbind() method.  When they're
statically linked, that's an appropriate memory saving tweak.

Similarly, provide consistent/simpler handling for a should-not-happen
error case:  removing a peripheral controller driver when a gadget
driver is still loaded.  Such code dates back to early versions of the
first implementation of the gadget API, and has never been triggered.

Includes relevant section annotation fixs for gmidi.c, file_storage.c,
and serial.c; we don't yet have an "init or exit" annotation.  Also
some whitespace fixes in gmidi.c (space at EOL, before tabs, etc).

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-12-20 10:14:26 -08:00
Robert P. J. Day 5cbded585d [PATCH] getting rid of all casts of k[cmz]alloc() calls
Run this:

	#!/bin/sh
	for f in $(grep -Erl "\([^\)]*\) *k[cmz]alloc" *) ; do
	  echo "De-casting $f..."
	  perl -pi -e "s/ ?= ?\([^\)]*\) *(k[cmz]alloc) *\(/ = \1\(/" $f
	done

And then go through and reinstate those cases where code is casting pointers
to non-pointers.

And then drop a few hunks which conflicted with outstanding work.

Cc: Russell King <rmk@arm.linux.org.uk>, Ian Molton <spyro@f2s.com>
Cc: Mikael Starvik <starvik@axis.com>
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Cc: Roman Zippel <zippel@linux-m68k.org>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Kyle McMartin <kyle@mcmartin.ca>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Jeff Dike <jdike@addtoit.com>
Cc: Greg KH <greg@kroah.com>
Cc: Jens Axboe <jens.axboe@oracle.com>
Cc: Paul Fulghum <paulkf@microgate.com>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: Karsten Keil <kkeil@suse.de>
Cc: Mauro Carvalho Chehab <mchehab@infradead.org>
Cc: Jeff Garzik <jeff@garzik.org>
Cc: James Bottomley <James.Bottomley@steeleye.com>
Cc: Ian Kent <raven@themaw.net>
Cc: Steven French <sfrench@us.ibm.com>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: Neil Brown <neilb@cse.unsw.edu.au>
Cc: Jaroslav Kysela <perex@suse.cz>
Cc: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-12-13 09:05:58 -08:00
Alan Cox 606d099cdd [PATCH] tty: switch to ktermios
This is the grungy swap all the occurrences in the right places patch that
goes with the updates.  At this point we have the same functionality as
before (except that sgttyb() returns speeds not zero) and are ready to
begin turning new stuff on providing nobody reports lots of bugs

If you are a tty driver author converting an out of tree driver the only
impact should be termios->ktermios name changes for the speed/property
setting functions from your upper layers.

If you are implementing your own TCGETS function before then your driver
was broken already and its about to get a whole lot more painful for you so
please fix it 8)

Also fill in c_ispeed/ospeed on init for most devices, although the current
code will do this for you anyway but I'd like eventually to lose that extra
paranoia

[akpm@osdl.org: bluetooth fix]
[mp3@de.ibm.com: sclp fix]
[mp3@de.ibm.com: warning fix for tty3270]
[hugh@veritas.com: fix tty_ioctl powerpc build]
[jdike@addtoit.com: uml: fix ->set_termios declaration]
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Martin Peschke <mp3@de.ibm.com>
Acked-by: Peter Oberparleiter <oberpar@de.ibm.com>
Cc: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Hugh Dickins <hugh@veritas.com>
Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-12-08 08:28:57 -08:00
Serge E. Hallyn 96b644bdec [PATCH] namespaces: utsname: use init_utsname when appropriate
In some places, particularly drivers and __init code, the init utsns is the
appropriate one to use.  This patch replaces those with a the init_utsname
helper.

Changes: Removed several uses of init_utsname().  Hope I picked all the
	right ones in net/ipv4/ipconfig.c.  These are now changed to
	utsname() (the per-process namespace utsname) in the previous
	patch (2/7)

[akpm@osdl.org: CIFS fix]
Signed-off-by: Serge E. Hallyn <serue@us.ibm.com>
Cc: Kirill Korotaev <dev@openvz.org>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Herbert Poetzl <herbert@13thfloor.at>
Cc: Andrey Savochkin <saw@sw.ru>
Cc: Serge Hallyn <serue@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-10-02 07:57:21 -07:00
Jeff Dike b68e31d0eb [PATCH] const struct tty_operations
As part of an SMP cleanliness pass over UML, I consted a bunch of
structures in order to not have to document their locking.  One of these
structures was a struct tty_operations.  In order to const it in UML
without introducing compiler complaints, the declaration of
tty_set_operations needs to be changed, and then all of its callers need to
be fixed.

This patch declares all struct tty_operations in the tree as const.  In all
cases, they are static and used only as input to tty_set_operations.  As an
extra check, I ran an i386 allyesconfig build which produced no extra
warnings.

53 drivers are affected.  I checked the history of a bunch of them, and in
most cases, there have been only a handful of maintenance changes in the
last six months.  serial_core.c was the busiest one that I looked at.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Acked-by: Alan Cox <alan@redhat.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-10-02 07:57:14 -07:00
Eugeny S. Mints 80f8af0c59 USB: usb serial gadget smp related bug
Adjust dev->dev_lock spinlock lock/unlock calls to be safe for SMP case.
Otherwise the following sequence may lead to a deadlock in SMP case:

gs_send()->usb_ep_queue()
	->(in case a request is satisfied immediatly) gs_write_complete()

for ex for pxa2xx_udc.c: 
usb_ep_queue()->pxa2xx_ep_queue()->write_fifo()->done()->gs_write_complete() 
(through req.complete pointer)

Signed-off-by: Eugeny S. Mints <emints@ru.mvista.com>
Acked-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-09-27 11:58:56 -07:00