usb: gadget: defer setting maxpacket till ->setup()
maxpacket is set by the udc driver for ep0 very early. This value is
copied by the function gadget used later for the USB_DT_DEVICE and
USB_DT_DEVICE_QUALIFIER query. This seems to work fine so far. For USB3
we need set a different value here. In SS speed it is 2^x with x=9 and
in HS we set something <= 64. If the UDC starts in SS and continues in
HS after the cable has been plugged it will report a too small value.
There setting of this value is defered and taken automaticly from the
ep0 pointer where the UDC driver can update it according to the speed it
detected _after_ a cable has been plugged.
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Felipe Balbi [Wed, 22 Jun 2011 14:28:10 +0000 (17:28 +0300)]
usb: gadget: allow multiple gadgets to be built
now that we have the udc class, we can allow
multiple gadget controller drivers to be
compiled as modules. This will allow for
distro-like kernels for embedded devices.
With this patch, I managed to build an x86
kernel with support for many of the controllers
enabled:
The next step would be to get rid of the
direct access to arch/ and mach/ directories
on some gadget controllers so that we can
build all of them without depending on their
respective ARCH_* symbols.
Signed-off-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Felipe Balbi [Wed, 29 Jun 2011 09:45:03 +0000 (12:45 +0300)]
usb: musb: choose correct fifo_mode
When we start building glue layers as modules,
we need to be careful with the fifo_mode changes
otherwise that weird ifdeferry won't evaluate
correctly. Add the missing _MODULE variants for
all glue layers to prevent everybody from using
fifo_mode 2.
Signed-off-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Felipe Balbi [Mon, 27 Jun 2011 12:57:46 +0000 (15:57 +0300)]
usb: musb: be careful when using different fifo_modes
if we have more endpoints configured than
enabled on fifo_mode, then we need to be
careful on save/restore context operations,
otherwise we will try to access uninitialized
__iomem pointer.
Signed-off-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
usb: gadget: dummy_hcd: move common bits of suspend/resume into one function
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This function has no user in my tree. It looks like it belongs to
net2280 but it somehow morphed into the dummy_hcd. So I remove it
before it spreads into more drivers.
After some digging I figured out that the only user was removed in
|commit 9079e91b5b5a84836e65cdc9128d2602e3beaef2
|Author: David Brownell <david-b@pacbell.net>
|Date: Wed May 7 16:00:36 2008 -0700
|
| USB: serial gadget: cleanup/reorg
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
usb: gadget: dummy_hcd: use less checks for USB_SPEED_SUPER
Taking the correct struct once avoids doing the speed dance.
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
usb: gadget: dummy_hcd: use gadget_to_dummy_hcd() where possible
gadget_to_dummy_hcd() already does the speed check, so
it's unnecessary to unroll that all the time.
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
usb: gadget: dummy_hcd: set gadget.is_otg before calling bind()
Before commit 53832daea ("usb: gadget: dummy_hcd: use the shared_hcd
infrastructure") the is_otg field was set in dummy_udc_probe(). It seems
to me that this field is used in gadget's bind function. Therefore I'm
moving it before the bind() callback is called.
Cc: Tatyana Brokhman <tlinder@codeaurora.org Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
usb: gadget: dummy_hcd: use dummy_pullup() instead of open coding
The removed code does the same thing as dummy_pullup(). The only
difference is that in dummy_udc_stop() the first dummy_pullup()
did not call usb_hcd_poll_rh_status().
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Sergei Shtylyov [Wed, 15 Jun 2011 18:10:37 +0000 (21:10 +0300)]
usb: gadget: add missing #include's
When #include'd alone, <linux/usb/gadget.h>
causes a lot of compilation errors and warnings
-- all because it relies on the including code to
bring in the necessary #include's instead of
doing this itself.
Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com> Signed-off-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Felipe Balbi [Mon, 13 Jun 2011 15:43:59 +0000 (18:43 +0300)]
usb: gadget: chips: remove ifdef trickery
the gadget controller number is only used
during bind() to update descriptors and/or
check that a particular controller can support
a particular gadget driver.
Because of that, we can remove the ifdef
trickery as it's a rather small optimization
anyway.
While at that, also sort the entries
alphabetically and add a comment stating we
want to keep the list ordered alphabetically.
Signed-off-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
usb: gadget: s3c2410_udc: use platform ids instead
This also fixes the error path: If the second device fails to register
we never remove the first one.
This is compile-tested only. I don't see any difference between those
two. Maybe we should just use one name instead?
Cc: Ben Dooks <ben-linux@fluff.org> Cc: Kukjin Kim <kgene.kim@samsung.com> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
usb: gadget: add platform module alias where it is missing
Without it udev won't be able to load the driver once it notices the
device unbound.
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
In case pci_register_driver() fails it error will be 0 in case
platform_driver_register() was fine. Also without PCI
pci_register_driver() evaluates to 1 which is well, special. If
platform_driver_register() returns EINVAL or EBUSY we end up with 0.
Acked-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Tatyana Brokhman [Wed, 29 Jun 2011 13:41:52 +0000 (16:41 +0300)]
usb: gadget: dummy_hcd: add SuperSpeed support
This patch adds SS support to the dummy hcd module.
It may be used to test SS device when no (SS) HW is
available.
USB 3.0 hub includes 2 hubs - one HS and one SS. This
patch adds support for a SS root hub in the dummy_hcd
module.
A new module parameter was added: is_super_speed. When
set to true, a SS root hub will also be registered and
the connected device will be enumerated over the SS
root hub. The default of this parameter is false.
Signed-off-by: Tatyana Brokhman <tlinder@codeaurora.org>
[ balbi@ti.com : slight change to commit log
fixed one coding style issue ]
Signed-off-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Tatyana Brokhman [Wed, 29 Jun 2011 13:41:51 +0000 (16:41 +0300)]
usb: gadget: dummy_hcd: use the shared_hcd infrastructure
This patch is a preparation for adding SuperSpeed
support to dummy hcd.
It takes the master side fields out of the struct
dummy to a separate structure. The init process
was also modified to resemble the way it is
done by xHCI.
Tatyana Brokhman [Wed, 29 Jun 2011 13:41:50 +0000 (16:41 +0300)]
usb: gadget: add SuperSpeed support to the Gadget Framework
SuperSpeed USB has defined a new descriptor, called
the Binary Device Object Store (BOS) Descriptor. It
has also changed a bit the definition of SET_FEATURE
and GET_STATUS requests to add USB3-specific details.
This patch implements both changes to the Composite
Gadget Framework.
[ balbi@ti.com : slight changes to commit log
fixed a compile error on ARM ]
Tatyana Brokhman [Tue, 28 Jun 2011 13:33:53 +0000 (16:33 +0300)]
usb: gadget: add streams support to the gadget framework
This patch defines necessary fields to support
streaming for USB3.0.
It implements a new function, called
usb_ep_autoconfig_ss(), to be used instead of the
existing usb_ep_autoconfig() when working in
SuperSpeed mode and there is a need to search for
an endpoint according to the number of required
streams.
Tatyana Brokhman [Tue, 28 Jun 2011 13:33:48 +0000 (16:33 +0300)]
usb: gadget: add usb_endpoint_descriptor to struct usb_ep
Change usb_ep_enable() prototype to use endpoint
descriptor from usb_ep.
This optimization spares the FDs from saving the
endpoint chosen descriptor. This optimization is
not full though. To fully exploit this change, one
needs to update all the UDCs as well since in the
current implementation each of them saves the
endpoint descriptor in it's internal (and extended)
endpoint structure.
usb: gadget: convert all users to the new udc infrastructure
peripheral drivers are using usb_add_gadget()/usb_del_gadget() to
register/unregister to the udc-core.
The udc-core will take the first available gadget driver and attach
function driver which is calling usb_gadget_register_driver(). This is
the same behaviour we have right now.
Only dummy_hcd was tested, the others were compiled tested.
Cc: Alan Stern <stern@rowland.harvard.edu> Cc: Anton Tikhomirov <av.tikhomirov@samsung.com> Cc: Ben Dooks <ben-linux@fluff.org> Cc: Dan Carpenter <error27@gmail.com> Cc: Darius Augulis <augulis.darius@gmail.com> Cc: Eric Miao <eric.y.miao@gmail.com> Cc: Jingoo Han <jg1.han@samsung.com> Cc: Kukjin Kim <kgene.kim@samsung.com> Cc: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Cc: Li Yang <leoli@freescale.com> Cc: Michael Hennerich <michael.hennerich@analog.com> Acked-by: Mike Frysinger <vapier@gentoo.org> Cc: Nicolas Ferre <nicolas.ferre@atmel.com> Cc: Pavankumar Kondeti <pkondeti@codeaurora.org> Cc: Roy Huang <roy.huang@analog.com> Cc: Russell King <linux@arm.linux.org.uk> Cc: Toshiharu Okada <toshiharu-linux@dsn.okisemi.com> Cc: Xiaochen Shen <xiaochen.shen@intel.com> Cc: Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com> Cc: Yuan-Hsin Chen <yhchen@faraday-tech.com> Cc: cxie4 <cxie4@marvell.com> Cc: linux-geode@lists.infradead.org Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Felipe Balbi [Tue, 28 Jun 2011 13:33:46 +0000 (16:33 +0300)]
usb: gadget: introduce UDC Class
this class will be used to abstract away several of the duplicated
operations scattered among the USB gadget controller drivers.
Later, we can add an atomic notifier to tell interested drivers about
what's happening with the controller. Notifications such as suspend,
resume, enumerated, etc. will be useful, at a minimum, for implementing
usb charger detection.
As part of the converting process usb_gadget_probe_driver() is no longer
part of each udc but pushed into the ->stap() callback. The same for his
couterpart.
The core is currently set explicit to 'n'. It will be changed to 'y' once
all users are converted since it provides functions which clash with
other drivers.
Signed-off-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Acked-by: Michal Nazarewicz <mina86@mina86.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Alan Stern [Wed, 15 Jun 2011 20:31:37 +0000 (16:31 -0400)]
USB: deprecate g_file_storage
This patch (as1471) deprecates the File-backed Storage Driver and
schedules its replacement for the 3.8 kernel release (about two years
from now). Users are advised to switch to the Mass Storage Gadget
instead.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Linus Torvalds [Mon, 13 Jun 2011 20:00:53 +0000 (13:00 -0700)]
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/penberg/slab-2.6
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/penberg/slab-2.6:
SLAB: Record actual last user of freed objects.
slub: always align cpu_slab to honor cmpxchg_double requirement
Linus Torvalds [Mon, 13 Jun 2011 18:21:50 +0000 (11:21 -0700)]
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/sage/ceph-client
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/sage/ceph-client:
ceph: unwind canceled flock state
ceph: fix ENOENT logic in striped_read
ceph: fix short sync reads from the OSD
ceph: fix sync vs canceled write
ceph: use ihold when we already have an inode ref
Linus Torvalds [Sun, 12 Jun 2011 18:06:36 +0000 (11:06 -0700)]
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/btrfs-unstable
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/btrfs-unstable:
Btrfs: use join_transaction in btrfs_evict_inode()
Btrfs - use %pU to print fsid
Btrfs: fix extent state leak on failed nodatasum reads
btrfs: fix unlocked access of delalloc_inodes
Btrfs: avoid stack bloat in btrfs_ioctl_fs_info()
btrfs: remove 64bit alignment padding to allow extent_buffer to fit into one fewer cacheline
Btrfs: clear current->journal_info on async transaction commit
Btrfs: make sure to recheck for bitmaps in clusters
btrfs: remove unneeded includes from scrub.c
btrfs: reinitialize scrub workers
btrfs: scrub: errors in tree enumeration
Btrfs: don't map extent buffer if path->skip_locking is set
Btrfs: unlock the trans lock properly
Btrfs: don't map extent buffer if path->skip_locking is set
Btrfs: fix duplicate checking logic
Btrfs: fix the allocator loop logic
Btrfs: fix bitmap regression
Btrfs: don't commit the transaction if we dont have enough pinned bytes
Btrfs: noinline the cluster searching functions
Btrfs: cache bitmaps when searching for a cluster
Linus Torvalds [Sun, 12 Jun 2011 18:04:25 +0000 (11:04 -0700)]
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6:
ALSA: hda: Fix inaudible internal speakers on CyberpowerPC Gamer Xplorer N57001 laptop
ALSA: Use %pV for snd_printk()
ALSA: hda - Fix initialization of hp pins with master_mute in Realtek
ALSA: hda - Fix invalid unsol tag for some alc262 model quirks
ASoC: SAMSUNG: Fix the incorrect referencing of I2SCON register
ASoC: snd_soc_new_{mixer,mux,pga} make sure to use right DAPM context
ASoC: fsl: fix initialization of DMA buffers
ASoC: WM8804 does not support sample rates below 32kHz
ASoC: Fix WM8962 headphone volume update for use of advanced caches
ASoC: Blackfin: bf5xx-ad1836: Fix codec device name
ALSA: hda: Fix quirk for Dell Inspiron 910
ASoC: AD1836: Fix setting the PCM format
ASoC: Check for NULL register bank in snd_soc_get_cache_val()
ASoC: Add missing break in WM8915 FLL source selection
ASoC: Only update SYSCLK_ENA when pausing WM8915 SYSCLK
ASoC: atmel_ssc: Don't try to free ssc if request failed
Linus Torvalds [Sun, 12 Jun 2011 18:03:29 +0000 (11:03 -0700)]
Merge branch 'gpio/merge' of git://git.secretlab.ca/git/linux-2.6
* 'gpio/merge' of git://git.secretlab.ca/git/linux-2.6:
gpio/basic_mmio: add missing include of spinlock_types.h
gpio/nomadik: fix sleepmode for elder Nomadik
Linus Torvalds [Sun, 12 Jun 2011 02:56:25 +0000 (19:56 -0700)]
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/security-testing-2.6
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/security-testing-2.6:
AppArmor: Fix sleep in invalid context from task_setrlimit
Mika Westerberg [Sat, 11 Jun 2011 08:39:58 +0000 (08:39 +0000)]
net: ep93xx_eth: fix DMA API violations
Russell King said:
>
> So, to summarize what its doing:
>
> 1. It allocates buffers for rx and tx.
> 2. It maps them with dma_map_single().
> This transfers ownership of the buffer to the DMA device.
> 3. In ep93xx_xmit,
> 3a. It copies the data into the buffer with skb_copy_and_csum_dev()
> This violates the DMA buffer ownership rules - the CPU should
> not be writing to this buffer while it is (in principle) owned
> by the DMA device.
> 3b. It then calls dma_sync_single_for_cpu() for the buffer.
> This transfers ownership of the buffer to the CPU, which surely
> is the wrong direction.
> 4. In ep93xx_rx,
> 4a. It calls dma_sync_single_for_cpu() for the buffer.
> This at least transfers the DMA buffer ownership to the CPU
> before the CPU reads the buffer
> 4b. It then uses skb_copy_to_linear_data() to copy the data out.
> At no point does it transfer ownership back to the DMA device.
> 5. When the driver is removed, it dma_unmap_single()'s the buffer.
> This transfers ownership of the buffer to the CPU.
> 6. It frees the buffer.
>
> While it may work on ep93xx, it's not respecting the DMA API rules,
> and with DMA debugging enabled it will probably encounter quite a few
> warnings.
This patch fixes these violations.
Signed-off-by: Mika Westerberg <mika.westerberg@iki.fi> Acked-by: Russell King <rmk+kernel@arm.linux.org.uk> Acked-by: H Hartley Sweeten <hsweeten@visionengravers.com> Tested-by: Petr Stetiar <ynezz@true.cz> Signed-off-by: David S. Miller <davem@davemloft.net>
Mika Westerberg [Sat, 11 Jun 2011 08:39:57 +0000 (08:39 +0000)]
net: ep93xx_eth: drop GFP_DMA from call to dma_alloc_coherent()
Commit a197b59ae6e8 (mm: fail GFP_DMA allocations when ZONE_DMA is not
configured) made page allocator to return NULL if GFP_DMA is set but
CONFIG_ZONE_DMA is disabled.
This causes ep93xx_eth to fail:
WARNING: at mm/page_alloc.c:2251 __alloc_pages_nodemask+0x11c/0x638()
Modules linked in:
[<c0035498>] (unwind_backtrace+0x0/0xf4) from [<c0043da4>] (warn_slowpath_common+0x48/0x60)
[<c0043da4>] (warn_slowpath_common+0x48/0x60) from [<c0043dd8>] (warn_slowpath_null+0x1c/0x24)
[<c0043dd8>] (warn_slowpath_null+0x1c/0x24) from [<c0083b6c>] (__alloc_pages_nodemask+0x11c/0x638)
[<c0083b6c>] (__alloc_pages_nodemask+0x11c/0x638) from [<c00366fc>] (__dma_alloc+0x8c/0x3ec)
[<c00366fc>] (__dma_alloc+0x8c/0x3ec) from [<c0036adc>] (dma_alloc_coherent+0x54/0x60)
[<c0036adc>] (dma_alloc_coherent+0x54/0x60) from [<c0227808>] (ep93xx_open+0x20/0x864)
[<c0227808>] (ep93xx_open+0x20/0x864) from [<c0283144>] (__dev_open+0xb8/0x108)
[<c0283144>] (__dev_open+0xb8/0x108) from [<c0280528>] (__dev_change_flags+0x70/0x128)
[<c0280528>] (__dev_change_flags+0x70/0x128) from [<c0283054>] (dev_change_flags+0x10/0x48)
[<c0283054>] (dev_change_flags+0x10/0x48) from [<c001a720>] (ip_auto_config+0x190/0xf68)
[<c001a720>] (ip_auto_config+0x190/0xf68) from [<c00233b0>] (do_one_initcall+0x34/0x18c)
[<c00233b0>] (do_one_initcall+0x34/0x18c) from [<c0008400>] (kernel_init+0x94/0x134)
[<c0008400>] (kernel_init+0x94/0x134) from [<c0030858>] (kernel_thread_exit+0x0/0x8)
Since there is no restrictions for DMA on ep93xx, we can fix this by just
removing the GFP_DMA flag from the call.
Signed-off-by: Mika Westerberg <mika.westerberg@iki.fi> Acked-by: Russell King <rmk+kernel@arm.linux.org.uk> Acked-by: H Hartley Sweeten <hsweeten@visionengravers.com> Tested-by: Petr Stetiar <ynezz@true.cz> Signed-off-by: David S. Miller <davem@davemloft.net>
Mika Westerberg [Sat, 11 Jun 2011 08:39:56 +0000 (08:39 +0000)]
net: ep93xx_eth: allocate buffers using kmalloc()
We can use simply kmalloc() to allocate the buffers. This also simplifies the
code and allows us to perform DMA sync operations more easily.
Memory is allocated with only GFP_KERNEL since there are no DMA allocation
restrictions on this platform.
Signed-off-by: Mika Westerberg <mika.westerberg@iki.fi> Acked-by: Russell King <rmk+kernel@arm.linux.org.uk> Acked-by: H Hartley Sweeten <hsweeten@visionengravers.com> Tested-by: Petr Stetiar <ynezz@true.cz> Signed-off-by: David S. Miller <davem@davemloft.net>
Mika Westerberg [Sat, 11 Jun 2011 08:39:54 +0000 (08:39 +0000)]
ep93xx: set DMA masks for the ep93xx_eth
Since the driver uses the DMA API, we should pass it valid DMA masks.
Signed-off-by: Mika Westerberg <mika.westerberg@iki.fi> Acked-by: Russell King <rmk+kernel@arm.linux.org.uk> Acked-by: H Hartley Sweeten <hsweeten@visionengravers.com> Tested-by: Petr Stetiar <ynezz@true.cz> Signed-off-by: David S. Miller <davem@davemloft.net>
Jiri Pirko [Fri, 10 Jun 2011 06:56:58 +0000 (06:56 +0000)]
vlan: Fix the ingress VLAN_FLAG_REORDER_HDR check
Testing of VLAN_FLAG_REORDER_HDR does not belong in vlan_untag
but rather in vlan_do_receive. Otherwise the vlan header
will not be properly put on the packet in the case of
vlan header accelleration.
As we remove the check from vlan_check_reorder_header
rename it vlan_reorder_header to keep the naming clean.
Fix up the skb->pkt_type early so we don't look at the packet
after adding the vlan tag, which guarantees we don't goof
and look at the wrong field.
Use a simple if statement instead of a complicated switch
statement to decided that we need to increment rx_stats
for a multicast packet.
Hopefully at somepoint we will just declare the case where
VLAN_FLAG_REORDER_HDR is cleared as unsupported and remove
the code. Until then this keeps it working correctly.
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> Signed-off-by: Jiri Pirko <jpirko@redhat.com> Acked-by: Changli Gao <xiaosuo@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Fix:
/tmp/ccvoZ6h8.s: Assembler messages:
/tmp/ccvoZ6h8.s:284: Warning: register range not in ascending order
/tmp/ccvoZ6h8.s:881: Warning: register range not in ascending order
/tmp/ccvoZ6h8.s:1087: Warning: register range not in ascending order
by ensuring that we have temporary variables placed into specific
registers. Reorder the code a bit to allow the resulting assembly
to be slightly more optimal.
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk> Signed-off-by: David S. Miller <davem@davemloft.net>
NET: am79c961: ensure multicast filter is correctly set at open
We were clearing out the multicast filter whenever the interface was
upped, and not setting the mode bits correctly. This can cause
problems if there are any multicast addresses already set at this
point, or if ALLMULTI was set.
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk> Signed-off-by: David S. Miller <davem@davemloft.net>
Connor Hansen [Sat, 11 Jun 2011 22:06:48 +0000 (15:06 -0700)]
ide-cd: signedness warning fix again
One of the legit warnings 'make W=3 drivers/ide/ide-cd.c'
generates is:
drivers/ide/ide-cd.c: In function ide_cd_do_request
drivers/ide/ide-cd.c:828:2: warning: conversion to int from \
unsigned int may change the sign of the result
drivers/ide/ide-cd.c:833:2: warning: conversion to int from \
unsigned int may change the sign of the result
nsectors is declared int, should be unsigned int.
blk_rq_sectors() returns unsigned int, and ide_complete_rq
expects unsigned int as well. Fixes both warnings.
Signed-off-by: Connor Hansen <cmdkhh@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
David Howells [Sat, 11 Jun 2011 11:29:58 +0000 (12:29 +0100)]
linux/seqlock.h should #include asm/processor.h for cpu_relax()
It uses cpu_relax(), and so needs <asm/processor.h>
Without this patch, I see:
CC arch/mn10300/kernel/asm-offsets.s
In file included from include/linux/time.h:8,
from include/linux/timex.h:56,
from include/linux/sched.h:57,
from arch/mn10300/kernel/asm-offsets.c:7:
include/linux/seqlock.h: In function 'read_seqbegin':
include/linux/seqlock.h:91: error: implicit declaration of function 'cpu_relax'
whilst building asb2364_defconfig on MN10300.
Signed-off-by: David Howells <dhowells@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Li Zefan [Wed, 8 Jun 2011 03:56:44 +0000 (03:56 +0000)]
Btrfs: use join_transaction in btrfs_evict_inode()
The WARN_ON() in start_transaction() was triggered while balancing.
The cause is btrfs_relocate_chunk() started a transaction and
then called iput() on the inode that stores free space cache,
and iput() called btrfs_start_transaction() again.
Reported-by: Tsutomu Itoh <t-itoh@jp.fujitsu.com> Signed-off-by: Li Zefan <lizf@cn.fujitsu.com> Reviewed-by: Josef Bacik <josef@redhat.com> Signed-off-by: Chris Mason <chris.mason@oracle.com>
Ryusuke Konishi [Wed, 25 May 2011 14:00:27 +0000 (23:00 +0900)]
nilfs2: fix missing block address termination in btree node shrinking
nilfs_btree_delete function does not terminate part of virtual block
addresses when shrinking the last remaining child node into the root
node. The missing address termination causes that dead btree node
blocks persist and chip away free disk space.
This fixes the leak bug on the btree node deletion.
Ryusuke Konishi [Wed, 25 May 2011 14:00:27 +0000 (23:00 +0900)]
nilfs2: fix incorrect block address termination in node concatenation
nilfs_btree_delete function wrongly terminates virtual block address
of the btree node held by its parent at index 0. When concatenating
the index-0 node with its right sibling node, nilfs_btree_delete
terminates the block address of index-0 node instead of the right
sibling node which should be deleted.
This bug not only wears disk space in the long run, but also causes
file system corruption. This will fix it.
Jan Schmidt [Wed, 4 May 2011 14:18:50 +0000 (16:18 +0200)]
Btrfs: fix extent state leak on failed nodatasum reads
When encountering an EIO while reading from a nodatasum extent, we
insert an error record into the inode's failure tree.
btrfs_readpage_end_io_hook returns early for nodatasum inodes. We'd
better clear the failure tree in that case, otherwise the kernel
complains about
BUG extent_state: Objects remaining on kmem_cache_close()
on rmmod.
Signed-off-by: Jan Schmidt <list.btrfs@jan-o-sch.net> Signed-off-by: Chris Mason <chris.mason@oracle.com>
David Sterba [Thu, 9 Jun 2011 10:02:51 +0000 (10:02 +0000)]
btrfs: fix unlocked access of delalloc_inodes
list_splice_init will make delalloc_inodes empty, but without a spinlock
around, this may produce corrupted list head, accessed in many placess,
The race window is very tight and nobody seems to have hit it so far.
Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <chris.mason@oracle.com>
richard kennedy [Tue, 7 Jun 2011 10:46:32 +0000 (10:46 +0000)]
btrfs: remove 64bit alignment padding to allow extent_buffer to fit into one fewer cacheline
Reorder extent_buffer to remove 8 bytes of alignment padding on 64 bit
builds. This shrinks its size to 128 bytes allowing it to fit into one
fewer cache lines and allows more objects per slab in its kmem_cache.
slabinfo extent_buffer reports :-
before:-
Sizes (bytes) Slabs
----------------------------------
Object : 136 Total : 123
SlabObj: 136 Full : 121
SlabSiz: 4096 Partial: 0
Loss : 0 CpuSlab: 2
Align : 8 Objects: 30
after :-
Object : 128 Total : 4
SlabObj: 128 Full : 2
SlabSiz: 4096 Partial: 0
Loss : 0 CpuSlab: 2
Align : 8 Objects: 32
Signed-off-by: Richard Kennedy <richard@rsk.demon.co.uk> Signed-off-by: Chris Mason <chris.mason@oracle.com>
Sage Weil [Fri, 10 Jun 2011 18:43:13 +0000 (18:43 +0000)]
Btrfs: clear current->journal_info on async transaction commit
Normally current->jouranl_info is cleared by commit_transaction. For an
async snap or subvol creation, though, it runs in a work queue. Clear
it in btrfs_commit_transaction_async() to avoid leaking a non-NULL
journal_info when we return to userspace. When the actual commit runs in
the other thread it won't care that it's current->journal_info is already
NULL.
Signed-off-by: Sage Weil <sage@newdream.net> Tested-by: Jim Schutt <jaschut@sandia.gov> Signed-off-by: Chris Mason <chris.mason@oracle.com>
Chris Mason [Fri, 10 Jun 2011 20:36:57 +0000 (16:36 -0400)]
Btrfs: make sure to recheck for bitmaps in clusters
Josef recently changed the free extent cache to look in
the block group cluster for any bitmaps before trying to
add a new bitmap for the same offset. This avoids BUG_ON()s due
covering duplicate ranges.
But it didn't go quite far enough. A given free range might span
between one or more bitmaps or free space entries. The code has
looping to cover this, but it doesn't check for clustered bitmaps
every time.
This shuffles our gotos to check for a bitmap in the cluster
for every new bitmap entry we try to add.
Signed-off-by: Chris Mason <chris.mason@oracle.com>
BugLink: https://launchpad.net/bugs/761171
The original reporter needs the model=auto quirk for his internal
speakers to be audible in the latest daily snapshot, so add an entry in
the quirk table for his PCI SSID.
A trivially different version of this patch using the model=asus quirk
should be applied to the 2.6.38 and 2.6.39 stable kernels. We don't use
the asus quirk in 3.0-rc2, because 3.0-rc2's autoparser is much
improved.
Reported-and-tested-by: tomdeering7 Signed-off-by: Daniel T Chen <crimsun@ubuntu.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Fri, 10 Jun 2011 13:28:15 +0000 (15:28 +0200)]
ALSA: hda - Fix initialization of hp pins with master_mute in Realtek
Some Reatlek model quirks use master_mute bool switch for controlling
the master-mute of outputs. For these cases, the initialization of HP
pins/amps were forgotten during the transition to the common automute
helper function in 3.0 development time, and resulted in the muted HP
output as default.
This patch fixes the issue by adjusting the HP output explicitly with
master_mute switch.
Tested-by: Michal Hocko <mhocko@suse.cz> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Arne Jansen [Fri, 10 Jun 2011 10:07:07 +0000 (12:07 +0200)]
btrfs: reinitialize scrub workers
Scrub starts the workers each time a scrub starts and stops them after it
finished. This patch adds an initialization for the workers before each
start, otherwise the workers behave strangely.
Arne Jansen [Fri, 3 Jun 2011 08:09:26 +0000 (10:09 +0200)]
btrfs: scrub: errors in tree enumeration
due to the semantics of btrfs_search_slot the path can point to an
invalid slot when ret > 0. This condition went unnoticed, which in
turn could have led to an incomplete scrubbing.
Josef Bacik [Wed, 8 Jun 2011 18:45:50 +0000 (14:45 -0400)]
Btrfs: don't map extent buffer if path->skip_locking is set
Arne's scrub stuff exposed a problem with mapping the extent buffer in
reada_for_search. He searches the commit root with multiple threads and with
skip_locking set, so we can race and overwrite node->map_token since node isn't
locked. So fix this so that we only map the extent buffer if we don't already
have a map_token and skip_locking isn't set. Without this patch scrub would
panic almost immediately, with the patch it doesn't panic anymore. Thanks,
Reported-by: Arne Jansen <sensille@gmx.net> Signed-off-by: Josef Bacik <josef@redhat.com>
Jesper Juhl [Thu, 9 Jun 2011 21:14:58 +0000 (23:14 +0200)]
genirq: Prevent potential NULL dereference in irq_set_irq_wake()
In kernel/irq/manage.c::irq_set_irq_wake() we call
irq_get_desc_buslock() which may return NULL, but the code
dereferences the result unconditionally.
irq_set_irq_wake() has lots of callers - I checked a few and I couldn't
find anything that guarantees that they won't call it with some input that
will cause irq_get_desc_buslock() to return NULL, so I think it's a good
thing to test and -EINVAL was the most sane error code in this situation
that I could think of.
Not all callers test the return value of irq_set_irq_wake(), but those
that do take != 0 to mean error as far as I can see, so they should be
fine. I guess those that don't test actually should, but that's a
different issue.
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc-2.6:
sparc32, leon: bugfix in LEON SMP interrupt init
sparc32, sun4m: bugfix in SMP IPI traphandler
sparc: Remove unnecessary semicolons
Add support for allocating irqs for bootbus devices
Do not skip interrupt sources in sun4d interrupt handler and acknowledge interrupts correctly
Restructure sun4d_build_device_irq so that timer interrupts can be allocated
sparc: PCIC_PCI needs SPARC32 dependency
sparc: Do not select GENERIC_HARDIRQS_NO_DEPRECATED
sparc32,leon: add GRPCI2 PCI Host driver
sparc32,leon: added LEON-common low-level PCI routines
sparc32: added CONFIG_PCIC_PCI Kconfig setting
Linus Torvalds [Thu, 9 Jun 2011 23:27:42 +0000 (16:27 -0700)]
Merge branch 'rc-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild-2.6
* 'rc-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild-2.6:
perf: Use make kernelversion instead of parsing the Makefile
kbuild: Hack for depmod not handling X.Y versions
kbuild: Move depmod call to a separate script
kbuild: Fix <linux/version.h> for empty SUBLEVEL or PATCHLEVEL
kbuild: Fix KERNELVERSION for empty SUBLEVEL or PATCHLEVEL
kbuild: silence Nothing to be done for 'all' message
During converting per-cpu ticker to genirq layer some
IRQ initialization code was removed by commit 2cf9530420e446bb61f665d02afeb81070106900 ("sparc32,leon:
per-cpu ticker use genirq per-cpu handler").
This patch reintroduces the code at the same place it was
removed from. IRQ12 - IRQ14 will crash on LEON SMP without
this patch because it will run the SUN4M IRQ trap handler.
Reported-by: Jan Andersson <jan@gaisler.com> Signed-off-by: Daniel Hellstrom <daniel@gaisler.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Three new IPIs were introduced by commit ecbc42b70acbc6327adefe9635db93fcf62bf59d ("sparc32, sun4m:
Implemented SMP IPIs support for SUN4M machines"), the
old handler was already prepared for IPIs but handled only
IRQ14 and IRQ13, this patch adds support for the new IPI at
IRQ12.
The IPI trap handler looks at the mask rather than the
pending IRQ/IPI, this bug may have masked the problem
above, introduced by the same commit.
Signed-off-by: Daniel Hellstrom <daniel@gaisler.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Lennert stated that he has been short on time lately. Since I'm maintaining
the ep93xx core stuff, I'm willing to also take over maintaining the Ethernet
driver.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Acked-by: Mika Westerberg <mika.westerberg@iki.fi> Acked-by: Lennert Buytenhek <kernel@wantstofly.org> Signed-off-by: David S. Miller <davem@davemloft.net>
ipv4: Fix packet size calculation for raw IPsec packets in __ip_append_data
We assume that transhdrlen is positive on the first fragment
which is wrong for raw packets. So we don't add exthdrlen to the
packet size for raw packets. This leads to a reallocation on IPsec
because we have not enough headroom on the skb to place the IPsec
headers. This patch fixes this by adding exthdrlen to the packet
size whenever the send queue of the socket is empty. This issue was
introduced with git commit 1470ddf7 (inet: Remove explicit write
references to sk/inet in ip_append_data)
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Michal Marek [Mon, 30 May 2011 12:12:09 +0000 (14:12 +0200)]
perf: Use make kernelversion instead of parsing the Makefile
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Paul Mackerras <paulus@samba.org> Cc: Ingo Molnar <mingo@elte.hu> Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net> Signed-off-by: Michal Marek <mmarek@suse.cz>
Michal Marek [Thu, 9 Jun 2011 14:35:41 +0000 (16:35 +0200)]
kbuild: Hack for depmod not handling X.Y versions
depmod from module-init-tools < 3.13 and the busybox depmod check if the
kernel release starts with <num>.<num>.<num>. To support these versions,
we create a symlink with two numbers prepended.
Michal Marek [Mon, 30 May 2011 11:37:20 +0000 (13:37 +0200)]
kbuild: Fix <linux/version.h> for empty SUBLEVEL or PATCHLEVEL
expr treats all numbers as decimals, so prepending a zero is safe. Note
that the KERNEL_VERSION() macro still takes three arguments, 3.0 has to be
written as KERNEL_VERSION(3,0,0).