GitHub/LineageOS/G12/android_kernel_amlogic_linux-4.9.git
11 years agousb: common: introduce usb_state_string()
Felipe Balbi [Thu, 24 Jan 2013 20:29:48 +0000 (22:29 +0200)]
usb: common: introduce usb_state_string()

this function will receive enum usb_device_state
and return a human-readable string from it or,
case an unknown value is passed as argument,
the string "UNKNOWN".

Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: dwc3: gadget: move to threaded IRQ
Felipe Balbi [Thu, 30 Jun 2011 13:57:15 +0000 (16:57 +0300)]
usb: dwc3: gadget: move to threaded IRQ

by moving to threaded IRQs, we allow our IRQ
priorities to be configurable when running with
realtime patch. Also, since we're running in
thread context, we can call functions which
might sleep, such as sysfs_notify() without
problems.

Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: dwc3: add count field to event buffer
Felipe Balbi [Mon, 4 Jul 2011 17:23:14 +0000 (20:23 +0300)]
usb: dwc3: add count field to event buffer

we can cache the last read value of the event
buffer count register on this field, for later
handling.

Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: dwc3: add a flags field to event buffer
Felipe Balbi [Mon, 4 Jul 2011 17:20:04 +0000 (20:20 +0300)]
usb: dwc3: add a flags field to event buffer

that way we know if a particular event buffer
has pending events, or not.

Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: dwc3: core: remove bogus comment to our structure
Felipe Balbi [Fri, 22 Feb 2013 10:47:07 +0000 (12:47 +0200)]
usb: dwc3: core: remove bogus comment to our structure

that irq field has been removed already. This
patch just removes its documentation.

Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: musb: Kconfig: drop unnecessary dependencies
Felipe Balbi [Wed, 6 Feb 2013 08:23:37 +0000 (10:23 +0200)]
usb: musb: Kconfig: drop unnecessary dependencies

those glues can build cleanly anywhere.

Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: musb: gadget: fix compile warning
Felipe Balbi [Wed, 6 Feb 2013 08:19:15 +0000 (10:19 +0200)]
usb: musb: gadget: fix compile warning

Fix the following compile warning:

drivers/usb/musb/musb_gadget.c: In function ‘rxstate’:
drivers/usb/musb/musb_gadget.c:714:22: warning: comparison of distinct pointer types lacks a cast [enabled by default]

Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: musb: dsps: fix possible compile warning
Felipe Balbi [Wed, 6 Feb 2013 07:57:18 +0000 (09:57 +0200)]
usb: musb: dsps: fix possible compile warning

if CONFIG_OF is disabled, np will be unused
and that will give us a compile warning. This
patch just avoids it.

Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: musb: ux500_dma: kill compile warnings
Felipe Balbi [Wed, 6 Feb 2013 07:53:01 +0000 (09:53 +0200)]
usb: musb: ux500_dma: kill compile warnings

Fix the following compile warnings:

drivers/usb/musb/ux500_dma.c: In function ‘ux500_configure_channel’:
drivers/usb/musb/ux500_dma.c:96:2: warning: format ‘%x’ expects argument of type ‘unsigned int’, but argument 6 has type ‘dma_addr_t’ [-Wformat]
drivers/usb/musb/ux500_dma.c: In function ‘ux500_dma_is_compatible’:
drivers/usb/musb/ux500_dma.c:195:4: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]

Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: musb: dsps: add missing include
Felipe Balbi [Wed, 6 Feb 2013 07:47:58 +0000 (09:47 +0200)]
usb: musb: dsps: add missing include

<linux/sizes.h> is the header defining SZ_4
and SZ_16M, we shouldn't depend on indirect
inclusion so let's explicitly include it.

Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: musb: make davinci and da8xx glues depend on BROKEN
Felipe Balbi [Wed, 6 Feb 2013 07:24:55 +0000 (09:24 +0200)]
usb: musb: make davinci and da8xx glues depend on BROKEN

those two glues are still including <mach/>
headers and no active developement has been
going on those glues for quite some time.

Apparently, for da8xx glue, only initial commit
3ee076de (usb: musb: introduce DA8xx/OMAP-L1x
glue layer) has been tested. All other patches
seem to have been compile-tested only.

For davinci glue layer, last real commit dates
back from 2010, with commit f405387 (USB: MUSB:
fix kernel WARNING/oops when unloading module
in OTG mode).

Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: musb: force PIO-only if we're building multiplatform kernels
Felipe Balbi [Wed, 6 Feb 2013 07:22:47 +0000 (09:22 +0200)]
usb: musb: force PIO-only if we're building multiplatform kernels

MUSB still needs lots of work on the DMA part
if we want to enable multiple DMA engines on
a multiplatform kernel. Meanwhile, we're forcing
PIO-only so that we, at least, have a working
driver.

Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: musb: gadget: delete wrong comment
Felipe Balbi [Mon, 4 Feb 2013 17:57:23 +0000 (19:57 +0200)]
usb: musb: gadget: delete wrong comment

Those comments haven't been updated for a long
time, so much that they don't make sense anymore.

Best to remove them.

Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: musb: switch over to devm_ioremap_resource()
Felipe Balbi [Mon, 4 Feb 2013 17:04:45 +0000 (19:04 +0200)]
usb: musb: switch over to devm_ioremap_resource()

this will make sure that request_memory_region() will
be called and that we don't need to manually call
iounmap() on ->remove().

Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: musb: core: remove unnecessary pr_info()
Felipe Balbi [Fri, 1 Feb 2013 21:33:50 +0000 (23:33 +0200)]
usb: musb: core: remove unnecessary pr_info()

there's really no need for that message. It's
been a while since it printed something useful.

Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: dwc3: pci: add basic suspend/resume support
Felipe Balbi [Mon, 11 Feb 2013 09:36:22 +0000 (11:36 +0200)]
usb: dwc3: pci: add basic suspend/resume support

this patch adds basic PM support for the
PCI glue layer.

Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: dwc3: exynos: add basic suspend/resume support
Vikas Sajjan [Tue, 16 Oct 2012 09:45:38 +0000 (15:15 +0530)]
usb: dwc3: exynos: add basic suspend/resume support

Adds suspend and resume callbacks to exynos dwc3 driver as part of
power management support.

This change does gating of dwc3 clock during suspend/resume cycles.

Signed-off-by: Abhilash Kesavan <a.kesavan@samsung.com>
Signed-off-by: Vikas C Sajjan <vikas.sajjan@linaro.org>
CC: Doug Anderson <dianders@chromium.org>
Tested-by: Vivek Gautam <gautam.vivek@samsung.com>
[ balbi@ti.com : refreshed to current linus/master ]

Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: dwc3: omap: add basic suspend/resume support
Felipe Balbi [Mon, 11 Feb 2013 09:12:02 +0000 (11:12 +0200)]
usb: dwc3: omap: add basic suspend/resume support

this patch implements basic suspend/resume
functionality for the OMAP glue layer.

Tested-by: Vivek Gautam <gautam.vivek@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: dwc3: omap: remove unused fields from private structure
Felipe Balbi [Mon, 11 Feb 2013 09:07:34 +0000 (11:07 +0200)]
usb: dwc3: omap: remove unused fields from private structure

we're not using those fields of the structure,
might as well remove them.

Tested-by: Vivek Gautam <gautam.vivek@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: dwc3: omap: introduce enable/disable IRQ methods
Felipe Balbi [Mon, 11 Feb 2013 09:03:59 +0000 (11:03 +0200)]
usb: dwc3: omap: introduce enable/disable IRQ methods

they will be re-used on suspend/resume implementation.

Tested-by: Vivek Gautam <gautam.vivek@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: dwc3: core: add power management support
Felipe Balbi [Mon, 30 Apr 2012 11:56:33 +0000 (14:56 +0300)]
usb: dwc3: core: add power management support

Add support for basic power management on
the dwc3 driver. While there is still lots
to improve for full PM support, this minimal
patch will already make sure that we survive
suspend-to-ram and suspend-to-disk without
major issues.

Cc: Vikas C Sajjan <vikas.sajjan@linaro.org>
Tested-by: Vivek Gautam <gautam.vivek@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: dwc3: gadget: save state of pullups
Felipe Balbi [Fri, 8 Feb 2013 15:55:58 +0000 (17:55 +0200)]
usb: dwc3: gadget: save state of pullups

This will be used during resume to verify
if we should reconnect our pullups or not.

Tested-by: Vivek Gautam <gautam.vivek@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: dwc3: gadget: introduce and use enable/disable irq methods
Felipe Balbi [Fri, 8 Feb 2013 13:24:04 +0000 (15:24 +0200)]
usb: dwc3: gadget: introduce and use enable/disable irq methods

we don't need to enable IRQs until we have
a gadget driver loaded and ready to work,
so let's delay IRQ enable to ->udc_start()
and IRQ disable to ->udc_stop().

While at that, also move the related use of
request_irq() and free_irq().

Tested-by: Vivek Gautam <gautam.vivek@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: dwc3: core: explicitly setup and cleanup event buffers
Felipe Balbi [Fri, 8 Feb 2013 13:15:11 +0000 (15:15 +0200)]
usb: dwc3: core: explicitly setup and cleanup event buffers

Make the call to dwc3_event_buffers_setup()
and dwc3_event_buffers_cleanup() explicit,
so it's easier to implement PM.

Tested-by: Vivek Gautam <gautam.vivek@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: gadget: mv_udc_core: switch over to usb_gadget_map/unmap_request()
Felipe Balbi [Mon, 28 Jan 2013 15:19:34 +0000 (17:19 +0200)]
usb: gadget: mv_udc_core: switch over to usb_gadget_map/unmap_request()

we have generic implementations for a reason,
let's use them

Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: gadget: lpc32xx_udc: switch over to usb_gadget_map/unmap_request()
Felipe Balbi [Mon, 28 Jan 2013 15:13:27 +0000 (17:13 +0200)]
usb: gadget: lpc32xx_udc: switch over to usb_gadget_map/unmap_request()

we have generic implementations for a reason,
let's use them

Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: gadget: fusb300: switch over to usb_gadget_map/unmap_request()
Felipe Balbi [Mon, 28 Jan 2013 15:08:28 +0000 (17:08 +0200)]
usb: gadget: fusb300: switch over to usb_gadget_map/unmap_request()

we have generic implementations for a reason,
let's use them

Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: gadget: fsl_udc_core: switch over to usb_gadget_map/unmap_request()
Felipe Balbi [Mon, 28 Jan 2013 15:03:21 +0000 (17:03 +0200)]
usb: gadget: fsl_udc_core: switch over to usb_gadget_map/unmap_request()

we have generic implementations for a reason,
let's use them

Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: gadget: atmel_usba_udc: switch over to usb_gadget_map/unmap_request()
Felipe Balbi [Mon, 28 Jan 2013 14:57:02 +0000 (16:57 +0200)]
usb: gadget: atmel_usba_udc: switch over to usb_gadget_map/unmap_request()

we have generic implementations for a reason,
let's use them.

Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: gadget: amd5536udc: remove unused structure member
Felipe Balbi [Mon, 28 Jan 2013 12:51:34 +0000 (14:51 +0200)]
usb: gadget: amd5536udc: remove unused structure member

that member isn't used anywhere in the driver
and be removed with no mercy.

Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: gadget: s3c-hsotg: switch over to usb_gadget_map/unmap_request()
Felipe Balbi [Mon, 28 Jan 2013 12:48:36 +0000 (14:48 +0200)]
usb: gadget: s3c-hsotg: switch over to usb_gadget_map/unmap_request()

we have generic implementations for a reason,
let's use them.

Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: gadget: drop now unnecessary flag
Felipe Balbi [Thu, 24 Jan 2013 15:41:00 +0000 (17:41 +0200)]
usb: gadget: drop now unnecessary flag

We don't need the ->register_my_device flag
anymore because all UDC drivers have been
properly converted.

Let's remove every history of it.

Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: chipidea: let udc-core manage gadget->dev
Felipe Balbi [Thu, 24 Jan 2013 15:36:39 +0000 (17:36 +0200)]
usb: chipidea: let udc-core manage gadget->dev

By simply setting a flag, we can drop some
boilerplate code.

Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: gadget: pxa27x_udc: let udc-core manage gadget->dev
Felipe Balbi [Thu, 24 Jan 2013 15:29:39 +0000 (17:29 +0200)]
usb: gadget: pxa27x_udc: let udc-core manage gadget->dev

By simply setting a flag, we can drop some
boilerplate code.

Acked-by: Robert Jarzmik <robert.jarzmik@free.fr>
Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: gadget: pxa25x_udc: let udc-core manage gadget->dev
Felipe Balbi [Thu, 24 Jan 2013 15:28:30 +0000 (17:28 +0200)]
usb: gadget: pxa25x_udc: let udc-core manage gadget->dev

By simply setting a flag, we can drop some
boilerplate code.

Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: renesas_usbhs: gadget: let udc-core manage gadget->dev
Felipe Balbi [Thu, 24 Jan 2013 15:08:01 +0000 (17:08 +0200)]
usb: renesas_usbhs: gadget: let udc-core manage gadget->dev

By simply setting a flag, we can drop some
boilerplate code.

Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: gadget: s3c2410_udc: let udc-core manage gadget->dev
Felipe Balbi [Thu, 24 Jan 2013 15:06:42 +0000 (17:06 +0200)]
usb: gadget: s3c2410_udc: let udc-core manage gadget->dev

By simply setting a flag, we can drop some
boilerplate code.

Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: gadget: s3c-hsudc: let udc-core manage gadget->dev
Felipe Balbi [Thu, 24 Jan 2013 15:04:56 +0000 (17:04 +0200)]
usb: gadget: s3c-hsudc: let udc-core manage gadget->dev

By simply setting a flag, we can drop some
boilerplate code.

Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: gadget: s3c-hsotg: let udc-core manage gadget->dev
Felipe Balbi [Thu, 24 Jan 2013 15:03:10 +0000 (17:03 +0200)]
usb: gadget: s3c-hsotg: let udc-core manage gadget->dev

By simply setting a flag, we can drop some
boilerplate code.

Reviewed-by: Tomasz Figa <tomasz.figa@gmail.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: gadget: r8a66597-udc: let udc-core manage gadget->dev
Felipe Balbi [Thu, 24 Jan 2013 15:01:28 +0000 (17:01 +0200)]
usb: gadget: r8a66597-udc: let udc-core manage gadget->dev

By simply setting a flag, we can drop some
boilerplate code.

Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: gadget: pch_udc: let udc-core manage gadget->dev
Felipe Balbi [Thu, 24 Jan 2013 14:56:35 +0000 (16:56 +0200)]
usb: gadget: pch_udc: let udc-core manage gadget->dev

By simply setting a flag, we can drop some
boilerplate code.

Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: gadget: net2280: let udc-core manage gadget->dev
Felipe Balbi [Thu, 24 Jan 2013 14:52:14 +0000 (16:52 +0200)]
usb: gadget: net2280: let udc-core manage gadget->dev

By simply setting a flag, we can drop some
boilerplate code.

Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: gadget: net2272: let udc-core manage gadget->dev
Felipe Balbi [Thu, 24 Jan 2013 14:48:12 +0000 (16:48 +0200)]
usb: gadget: net2272: let udc-core manage gadget->dev

By simply setting a flag, we can drop some
boilerplate code.

Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: gadget: mv_udc_core: let udc-core manage gadget->dev
Felipe Balbi [Thu, 24 Jan 2013 14:43:47 +0000 (16:43 +0200)]
usb: gadget: mv_udc_core: let udc-core manage gadget->dev

By simply setting a flag, we can drop some
boilerplate code.

Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: gadget: mv_u3d_core: fix a compile warning
Felipe Balbi [Thu, 24 Jan 2013 14:38:19 +0000 (16:38 +0200)]
usb: gadget: mv_u3d_core: fix a compile warning

Fix the following compile warning:

mv_u3d_core.c:1766:12: warning: 'mv_u3d_remove' \
defined but not used [-Wunused-function]

Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: gadget: mv_u3d_core: let udc-core manage gadget->dev
Felipe Balbi [Thu, 24 Jan 2013 14:37:24 +0000 (16:37 +0200)]
usb: gadget: mv_u3d_core: let udc-core manage gadget->dev

By simply setting a flag, we can drop some
boilerplate code.

Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: gadget: m66592-udc: let udc-core manage gadget->dev
Felipe Balbi [Thu, 24 Jan 2013 14:35:12 +0000 (16:35 +0200)]
usb: gadget: m66592-udc: let udc-core manage gadget->dev

By simply setting a flag, we can drop some
boilerplate code.

Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: gadget: lpc32xx_udc: let udc-core manage gadget->dev
Felipe Balbi [Thu, 24 Jan 2013 14:26:46 +0000 (16:26 +0200)]
usb: gadget: lpc32xx_udc: let udc-core manage gadget->dev

By simply setting a flag, we can drop some
boilerplate code.

Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: gadget: imx_udc: let udc-core manage gadget->dev
Felipe Balbi [Thu, 24 Jan 2013 14:22:57 +0000 (16:22 +0200)]
usb: gadget: imx_udc: let udc-core manage gadget->dev

By simply setting a flag, we can drop some
boilerplate code.

Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: gadget: goku_udc: let udc-core manage gadget->dev
Felipe Balbi [Thu, 24 Jan 2013 14:17:45 +0000 (16:17 +0200)]
usb: gadget: goku_udc: let udc-core manage gadget->dev

By simply setting a flag, we can drop some
boilerplate code.

Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: gadget: fusb300_udc: let udc-core manage gadget->dev
Felipe Balbi [Thu, 24 Jan 2013 14:14:45 +0000 (16:14 +0200)]
usb: gadget: fusb300_udc: let udc-core manage gadget->dev

By simply setting a flag, we can drop some
boilerplate code.

Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: gadget: fsl_udc_core: let udc-core manage gadget->dev
Felipe Balbi [Thu, 24 Jan 2013 14:13:20 +0000 (16:13 +0200)]
usb: gadget: fsl_udc_core: let udc-core manage gadget->dev

By simply setting a flag, we can drop some
boilerplate code.

Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: gadget: fsl_qe_udc: let udc-core manage gadget->dev
Felipe Balbi [Thu, 24 Jan 2013 14:11:38 +0000 (16:11 +0200)]
usb: gadget: fsl_qe_udc: let udc-core manage gadget->dev

By simply setting a flag, we can drop some
boilerplate code.

Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: gadget: dummy_hcd: let udc-core manage gadget->dev
Felipe Balbi [Thu, 24 Jan 2013 14:10:16 +0000 (16:10 +0200)]
usb: gadget: dummy_hcd: let udc-core manage gadget->dev

By simply setting a flag, we can drop some
boilerplate code.

Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: gadget: bcm63xx_udc: let udc-core manage gadget->dev
Felipe Balbi [Thu, 24 Jan 2013 14:09:06 +0000 (16:09 +0200)]
usb: gadget: bcm63xx_udc: let udc-core manage gadget->dev

By simply setting a flag, we can drop some
boilerplate code.

Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: gadget: atmel_usba_udc: let udc-core manage gadget->dev
Felipe Balbi [Thu, 24 Jan 2013 13:21:36 +0000 (15:21 +0200)]
usb: gadget: atmel_usba_udc: let udc-core manage gadget->dev

By simply setting a flag, we can drop some
boilerplate code.

Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: gadget: at91_udc: let udc-core manage gadget->dev
Felipe Balbi [Thu, 24 Jan 2013 13:15:30 +0000 (15:15 +0200)]
usb: gadget: at91_udc: let udc-core manage gadget->dev

By simply setting a flag, we can remove some
boilerplate code.

Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: gadget: amd5536udc: let udc-core manage gadget->dev
Felipe Balbi [Thu, 24 Jan 2013 13:10:10 +0000 (15:10 +0200)]
usb: gadget: amd5536udc: let udc-core manage gadget->dev

By simply setting a flag, we drop some boilerplate
code.

Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: gadget: omap_udc: let udc-core manage gadget->dev
Felipe Balbi [Thu, 24 Jan 2013 13:07:29 +0000 (15:07 +0200)]
usb: gadget: omap_udc: let udc-core manage gadget->dev

By simply setting a flag, we drop some boilerplate
code.

Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: musb: gadget: let udc-core manage gadget-dev
Felipe Balbi [Thu, 24 Jan 2013 13:03:59 +0000 (15:03 +0200)]
usb: musb: gadget: let udc-core manage gadget-dev

By simply setting a flag, we can delete a little
boilerplate code.

Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: dwc3: gadget: let udc-core manage gadget->dev
Felipe Balbi [Thu, 24 Jan 2013 12:56:26 +0000 (14:56 +0200)]
usb: dwc3: gadget: let udc-core manage gadget->dev

We don't need to register that device ourselves
if we simply set gadget->register_my_device.

Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: gadget: udc-core: allow udc class register gadget device
Felipe Balbi [Thu, 24 Jan 2013 12:52:24 +0000 (14:52 +0200)]
usb: gadget: udc-core: allow udc class register gadget device

Currently all UDC drivers are calling
device_register() before calling
usb_add_gadget_udc(). In order to avoid
code duplication, we can allow udc-core.c
register that device.

However that would become a really large patch,
so to cope with the meanwhile and allow us
to write bite-sized patches, we're adding
a flag which will be set by UDC driver once
it removes the code for registering the
gadget device.

Once all are converted, the new flag will
be removed.

Reviewed-by: Tomasz Figa <tomasz.figa@gmail.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: dwc3: omap: stop using nop-usb-xceiv
Kishon Vijay Abraham I [Tue, 26 Feb 2013 14:33:29 +0000 (20:03 +0530)]
usb: dwc3: omap: stop using nop-usb-xceiv

Now that we have drivers for omap-usb2 phy and omap-usb3 phy, stop
using nop-usb-xceiv.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: dwc3: omap: remove platform data associated with dwc3-omap
Kishon Vijay Abraham I [Tue, 26 Feb 2013 14:33:28 +0000 (20:03 +0530)]
usb: dwc3: omap: remove platform data associated with dwc3-omap

omap5 is not going to have support for non-dt boot making the platform
data associated with dwc3 useless. Removed it here.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: dwc3: omap: minor fixes to get dt working
Kishon Vijay Abraham I [Tue, 26 Feb 2013 14:33:27 +0000 (20:03 +0530)]
usb: dwc3: omap: minor fixes to get dt working

Includes few minor fixes in dwc3-omap like populating the compatible
string in a correct way, extracting the utmi-mode property properly and
changing the index of get_irq since irq of core is removed from hwmod
entry.

Also updated the documentation with dwc3-omap device tree binding
information.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
[ balbi@ti.com : fix a compile warning introduced by
this commit ]

Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agoUSB: phy: nop: Defer probe if device needs VCC/RESET
Roger Quadros [Tue, 12 Mar 2013 11:24:26 +0000 (13:24 +0200)]
USB: phy: nop: Defer probe if device needs VCC/RESET

Add 2 flags, needs_vcc and needs_reset to platform data.
If the flag is set and the regulator couldn't be found
then we bail out with -EPROBE_DEFER.

For device tree boot we depend on presensce of vcc-supply/
reset-supply properties to decide if we should bail out
with -EPROBE_DEFER or just continue in case the regulator
can't be found.

This is required for proper functionality in cases where the
regulator is needed but is probed later than the PHY device.

Signed-off-by: Roger Quadros <rogerq@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: phy: nop: Add device tree support and binding information
Roger Quadros [Tue, 12 Mar 2013 11:24:25 +0000 (13:24 +0200)]
usb: phy: nop: Add device tree support and binding information

The PHY clock, clock rate, VCC regulator and RESET regulator
can now be provided via device tree.

Signed-off-by: Roger Quadros <rogerq@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: phy: nop: use new PHY API to register PHY
Roger Quadros [Tue, 12 Mar 2013 11:24:24 +0000 (13:24 +0200)]
usb: phy: nop: use new PHY API to register PHY

We would need to support multiple PHYs of the same type
so use the new PHY API usb_add_phy_dev() to register the PHY.

Signed-off-by: Roger Quadros <rogerq@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: phy: nop: Handle RESET for the PHY
Roger Quadros [Tue, 12 Mar 2013 11:24:23 +0000 (13:24 +0200)]
usb: phy: nop: Handle RESET for the PHY

We expect the RESET line to be modeled as a regulator with supply
name "reset". The regulator should be modeled such that enabling
the regulator brings the PHY device out of RESET and disabling the
regulator holds the device in RESET.

They PHY will be held in RESET in .shutdown() and brought out of
RESET in .init().

Signed-off-by: Roger Quadros <rogerq@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: phy: nop: Handle power supply regulator for the PHY
Roger Quadros [Tue, 12 Mar 2013 11:24:22 +0000 (13:24 +0200)]
usb: phy: nop: Handle power supply regulator for the PHY

We use "vcc" as the supply name for the PHY's power supply.
The power supply will be enabled during .init() and disabled
during .shutdown()

Signed-off-by: Roger Quadros <rogerq@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: phy: nop: Manage PHY clock
Roger Quadros [Tue, 12 Mar 2013 11:24:21 +0000 (13:24 +0200)]
usb: phy: nop: Manage PHY clock

If the PHY has a clock associated to it then manage the clock.
We just enable the clock in .init() and disable it in .shutdown().

Add clk_rate parameter in platform data and configure the
clock rate during probe if supplied.

Signed-off-by: Roger Quadros <rogerq@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: phy: nop: use devm_kzalloc()
Roger Quadros [Tue, 12 Mar 2013 11:24:20 +0000 (13:24 +0200)]
usb: phy: nop: use devm_kzalloc()

Use resource managed kzalloc.

Signed-off-by: Roger Quadros <rogerq@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agousb: phy: nop: Add some parameters to platform data
Roger Quadros [Tue, 12 Mar 2013 11:24:19 +0000 (13:24 +0200)]
usb: phy: nop: Add some parameters to platform data

Add clk_rate parameter to platform data. If supplied, the
NOP phy driver will program the clock to that rate during probe.

Also add 2 flags, needs_vcc and needs_reset.
If the flag is set and the regulator couldn't be found
then the driver will bail out with -EPROBE_DEFER.

Signed-off-by: Roger Quadros <rogerq@ti.com>
Acked-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
11 years agoLinux 3.9-rc3
Linus Torvalds [Sun, 17 Mar 2013 22:59:32 +0000 (15:59 -0700)]
Linux 3.9-rc3

11 years agoperf,x86: fix link failure for non-Intel configs
David Rientjes [Sun, 17 Mar 2013 22:49:10 +0000 (15:49 -0700)]
perf,x86: fix link failure for non-Intel configs

Commit 1d9d8639c063 ("perf,x86: fix kernel crash with PEBS/BTS after
suspend/resume") introduces a link failure since
perf_restore_debug_store() is only defined for CONFIG_CPU_SUP_INTEL:

arch/x86/power/built-in.o: In function `restore_processor_state':
(.text+0x45c): undefined reference to `perf_restore_debug_store'

Fix it by defining the dummy function appropriately.

Signed-off-by: David Rientjes <rientjes@google.com>
Cc: stable@vger.kernel.org
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
11 years agoperf,x86: fix wrmsr_on_cpu() warning on suspend/resume
Linus Torvalds [Sun, 17 Mar 2013 22:44:43 +0000 (15:44 -0700)]
perf,x86: fix wrmsr_on_cpu() warning on suspend/resume

Commit 1d9d8639c063 ("perf,x86: fix kernel crash with PEBS/BTS after
suspend/resume") fixed a crash when doing PEBS performance profiling
after resuming, but in using init_debug_store_on_cpu() to restore the
DS_AREA mtrr it also resulted in a new WARN_ON() triggering.

init_debug_store_on_cpu() uses "wrmsr_on_cpu()", which in turn uses CPU
cross-calls to do the MSR update.  Which is not really valid at the
early resume stage, and the warning is quite reasonable.  Now, it all
happens to _work_, for the simple reason that smp_call_function_single()
ends up just doing the call directly on the CPU when the CPU number
matches, but we really should just do the wrmsr() directly instead.

This duplicates the wrmsr() logic, but hopefully we can just remove the
wrmsr_on_cpu() version eventually.

Reported-and-tested-by: Parag Warudkar <parag.lkml@gmail.com>
Cc: stable@vger.kernel.org
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
11 years agoMerge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux...
Linus Torvalds [Sun, 17 Mar 2013 18:04:14 +0000 (11:04 -0700)]
Merge branch 'for-linus' of git://git./linux/kernel/git/mason/linux-btrfs

Pull btrfs fixes from Chris Mason:
 "Eric's rcu barrier patch fixes a long standing problem with our
  unmount code hanging on to devices in workqueue helpers.  Liu Bo
  nailed down a difficult assertion for in-memory extent mappings."

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs:
  Btrfs: fix warning of free_extent_map
  Btrfs: fix warning when creating snapshots
  Btrfs: return as soon as possible when edquot happens
  Btrfs: return EIO if we have extent tree corruption
  btrfs: use rcu_barrier() to wait for bdev puts at unmount
  Btrfs: remove btrfs_try_spin_lock
  Btrfs: get better concurrency for snapshot-aware defrag work

11 years agoBtrfs: fix warning of free_extent_map
Liu Bo [Fri, 15 Mar 2013 14:46:39 +0000 (08:46 -0600)]
Btrfs: fix warning of free_extent_map

Users report that an extent map's list is still linked when it's actually
going to be freed from cache.

The story is that

a) when we're going to drop an extent map and may split this large one into
smaller ems, and if this large one is flagged as EXTENT_FLAG_LOGGING which means
that it's on the list to be logged, then the smaller ems split from it will also
be flagged as EXTENT_FLAG_LOGGING, and this is _not_ expected.

b) we'll keep ems from unlinking the list and freeing when they are flagged with
EXTENT_FLAG_LOGGING, because the log code holds one reference.

The end result is the warning, but the truth is that we set the flag
EXTENT_FLAG_LOGGING only during fsync.

So clear flag EXTENT_FLAG_LOGGING for extent maps split from a large one.

Reported-by: Johannes Hirte <johannes.hirte@fem.tu-ilmenau.de>
Reported-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
11 years agoMerge branch 'kbuild' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild
Linus Torvalds [Sat, 16 Mar 2013 01:06:55 +0000 (18:06 -0700)]
Merge branch 'kbuild' of git://git./linux/kernel/git/mmarek/kbuild

Pull kbuild fix from Michal Marek:
 "One fix for for make headers_install/headers_check to not require make
  3.81.  The requirement has been accidentally introduced in 3.7."

* 'kbuild' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild:
  kbuild: fix make headers_check with make 3.80

11 years agoMerge tag 'for-3.9-rc3' of git://openrisc.net/jonas/linux
Linus Torvalds [Sat, 16 Mar 2013 01:05:37 +0000 (18:05 -0700)]
Merge tag 'for-3.9-rc3' of git://openrisc.net/jonas/linux

Pull OpenRISC bug fixes from Jonas Bonn:

 - The GPIO descriptor work has exposed how broken the non-GPIOLIB bits
   for OpenRISC were.  We now require GPIOLIB as this is the preferred
   way forward.

 - The system.h split introduced a bug in llist.h for arches using
   asm-generic/cmpxchg.h directly, which is currently only OpenRISC.
   The patch here moves two defines from asm-generic/atomic.h to
   asm-generic/cmpxchg.h to make things work as they should.

 - The VIRT_TO_BUS selector was added for OpenRISC, but OpenRISC does
   not have the virt_to_bus methods, so there's a patch to remove it
   again.

* tag 'for-3.9-rc3' of git://openrisc.net/jonas/linux:
  openrisc: remove HAVE_VIRT_TO_BUS
  asm-generic: move cmpxchg*_local defs to cmpxchg.h
  openrisc: require gpiolib

11 years agoMerge tag 'char-misc-3.9-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh...
Linus Torvalds [Sat, 16 Mar 2013 01:04:38 +0000 (18:04 -0700)]
Merge tag 'char-misc-3.9-rc2' of git://git./linux/kernel/git/gregkh/char-misc

Pull char/misc fixes from Greg Kroah-Hartman:
 "Here are some tiny fixes for the w1 drivers and the final removal
  patch for getting rid of CONFIG_EXPERIMENTAL (all users of it are now
  gone from your tree, this just drops the Kconfig item itself.)

  All have been in the linux-next tree for a while"

* tag 'char-misc-3.9-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc:
  final removal of CONFIG_EXPERIMENTAL
  w1: fix oops when w1_search is called from netlink connector
  w1-gpio: fix unused variable warning
  w1-gpio: remove erroneous __exit and __exit_p()
  ARM: w1-gpio: fix erroneous gpio requests

11 years agoMerge tag 'sound-3.9' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound
Linus Torvalds [Sat, 16 Mar 2013 00:35:49 +0000 (17:35 -0700)]
Merge tag 'sound-3.9' of git://git./linux/kernel/git/tiwai/sound

Pull sound fixes from Takashi Iwai:
 "A collection of small fixes, as expected for the middle rc:
   - A couple of fixes for potential NULL dereferences and out-of-range
     array accesses revealed by static code parsers
   - A fix for the wrong error handling detected by trinity
   - A regression fix for missing audio on some MacBooks
   - CA0132 DSP loader fixes
   - Fix for EAPD control of IDT codecs on machines w/o speaker
   - Fix a regression in the HD-audio widget list parser code
   - Workaround for the NuForce UDH-100 USB audio"

* tag 'sound-3.9' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound:
  ALSA: hda - Fix missing EAPD/GPIO setup for Cirrus codecs
  sound: sequencer: cap array index in seq_chn_common_event()
  ALSA: hda/ca0132 - Remove extra setting of dsp_state.
  ALSA: hda/ca0132 - Check download state of DSP.
  ALSA: hda/ca0132 - Check if dspload_image succeeded.
  ALSA: hda - Disable IDT eapd_switch if there are no internal speakers
  ALSA: hda - Fix snd_hda_get_num_raw_conns() to return a correct value
  ALSA: usb-audio: add a workaround for the NuForce UDH-100
  ALSA: asihpi - fix potential NULL pointer dereference
  ALSA: seq: Fix missing error handling in snd_seq_timer_open()

11 years agoMerge branch 'fixes-for-3.9' of git://git.linaro.org/people/mszyprowski/linux-dma...
Linus Torvalds [Sat, 16 Mar 2013 00:35:03 +0000 (17:35 -0700)]
Merge branch 'fixes-for-3.9' of git://git.linaro.org/people/mszyprowski/linux-dma-mapping

Pull DMA-mapping fix from Marek Szyprowski:
 "An important fix for all ARM architectures which use ZONE_DMA.
  Without it dma_alloc_* calls with GFP_ATOMIC flag might have allocated
  buffers outsize DMA zone."

* 'fixes-for-3.9' of git://git.linaro.org/people/mszyprowski/linux-dma-mapping:
  ARM: DMA-mapping: add missing GFP_DMA flag for atomic buffer allocation

11 years agoMerge tag 'mfd-fixes-3.9-1' of git://git.kernel.org/pub/scm/linux/kernel/git/sameo...
Linus Torvalds [Sat, 16 Mar 2013 00:34:01 +0000 (17:34 -0700)]
Merge tag 'mfd-fixes-3.9-1' of git://git./linux/kernel/git/sameo/mfd-fixes

Pull MFD fixes from Samuel Ortiz:
 "This is the first batch of MFD fixes for 3.9.

  With this one we have:

   - An ab8500 build failure fix.
   - An ab8500 device tree parsing fix.
   - A fix for twl4030_madc remove routine to work properly (when
     built-in).
   - A fix for properly registering palmas interrupt handler.
   - A fix for omap-usb init routine to actually write into the
     hostconfig register.
   - A couple of warning fixes for ab8500-gpadc and tps65912"

* tag 'mfd-fixes-3.9-1' of git://git.kernel.org/pub/scm/linux/kernel/git/sameo/mfd-fixes:
  mfd: twl4030-madc: Remove __exit_p annotation
  mfd: ab8500: Kill "reg" property from binding
  mfd: ab8500-gpadc: Complain if we fail to enable vtvout LDO
  mfd: wm831x: Don't forward declare enum wm831x_auxadc
  mfd: twl4030-audio: Fix argument type for twl4030_audio_disable_resource()
  mfd: tps65912: Declare and use tps65912_irq_exit()
  mfd: palmas: Provide irq flags through DT/platform data
  mfd: Make AB8500_CORE select POWER_SUPPLY to fix build error
  mfd: omap-usb-host: Actually update hostconfig

11 years agoMerge tag 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck...
Linus Torvalds [Sat, 16 Mar 2013 00:33:13 +0000 (17:33 -0700)]
Merge tag 'hwmon-for-linus' of git://git./linux/kernel/git/groeck/linux-staging

Pull hwmon fixes from Guenter Roeck:
 "Bug fixes for pmbus, ltc2978, and lineage-pem drivers

  Added specific maintainer for some hwmon drivers"

* tag 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging:
  hwmon: (pmbus/ltc2978) Fix temperature reporting
  hwmon: (pmbus) Fix krealloc() misuse in pmbus_add_attribute()
  hwmon: (lineage-pem) Add missing terminating entry for pem_[input|fan]_attributes
  MAINTAINERS: Add maintainer for MAX6697, INA209, and INA2XX drivers

11 years agoperf,x86: fix kernel crash with PEBS/BTS after suspend/resume
Stephane Eranian [Fri, 15 Mar 2013 13:26:07 +0000 (14:26 +0100)]
perf,x86: fix kernel crash with PEBS/BTS after suspend/resume

This patch fixes a kernel crash when using precise sampling (PEBS)
after a suspend/resume. Turns out the CPU notifier code is not invoked
on CPU0 (BP). Therefore, the DS_AREA (used by PEBS) is not restored properly
by the kernel and keeps it power-on/resume value of 0 causing any PEBS
measurement to crash when running on CPU0.

The workaround is to add a hook in the actual resume code to restore
the DS Area MSR value. It is invoked for all CPUS. So for all but CPU0,
the DS_AREA will be restored twice but this is harmless.

Reported-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Stephane Eranian <eranian@google.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
11 years agoALSA: hda - Fix missing EAPD/GPIO setup for Cirrus codecs
Takashi Iwai [Fri, 15 Mar 2013 13:23:32 +0000 (14:23 +0100)]
ALSA: hda - Fix missing EAPD/GPIO setup for Cirrus codecs

During the transition to the generic parser, the hook to the codec
specific automute function was forgotten.  This resulted in the silent
output on some MacBooks.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agosound: sequencer: cap array index in seq_chn_common_event()
Dan Carpenter [Fri, 15 Mar 2013 06:14:22 +0000 (09:14 +0300)]
sound: sequencer: cap array index in seq_chn_common_event()

"chn" here is a number between 0 and 255, but ->chn_info[] only has
16 elements so there is a potential write beyond the end of the
array.

If the seq_mode isn't SEQ_2 then we let the individual drivers
(either opl3.c or midi_synth.c) handle it.  Those functions all
do a bounds check on "chn" so I haven't changed anything here.
The opl3.c driver has up to 18 channels and not 16.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agomfd: twl4030-madc: Remove __exit_p annotation
Arnd Bergmann [Thu, 14 Mar 2013 21:56:38 +0000 (22:56 +0100)]
mfd: twl4030-madc: Remove __exit_p annotation

4740f73fe5 "mfd: remove use of __devexit" removed the __devexit annotation
on the twl4030_madc_remove function, but left an __exit_p() present on the
pointer to this function. Using __exit_p was as wrong with the devexit in
place as it is now, but now we get a gcc warning about an unused function.

In order for the twl4030_madc_remove to work correctly in built-in code, we
have to remove the __exit_p.

Cc: Bill Pemberton <wfp5p@virginia.edu>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
11 years agoALSA: hda/ca0132 - Remove extra setting of dsp_state.
Dylan Reid [Fri, 15 Mar 2013 00:27:46 +0000 (17:27 -0700)]
ALSA: hda/ca0132 - Remove extra setting of dsp_state.

spec->dsp_state is initialized to DSP_DOWNLOAD_INIT, no need to reset
and check it in ca0132_download_dsp().

Signed-off-by: Dylan Reid <dgreid@chromium.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: hda/ca0132 - Check download state of DSP.
Dylan Reid [Fri, 15 Mar 2013 00:27:45 +0000 (17:27 -0700)]
ALSA: hda/ca0132 - Check download state of DSP.

Instead of using the dspload_is_loaded() function, check the dsp_state
that is kept in the spec.  The dspload_is_loaded() function returns
true if the DSP transfer was never started.  This false-positive leads
to multiple second delays when ca0132_setup_efaults() times out on
each write.

Signed-off-by: Dylan Reid <dgreid@chromium.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoALSA: hda/ca0132 - Check if dspload_image succeeded.
Dylan Reid [Fri, 15 Mar 2013 00:27:44 +0000 (17:27 -0700)]
ALSA: hda/ca0132 - Check if dspload_image succeeded.

If dspload_image() fails, it was ignored and dspload_wait_loaded() was
still called.  dsp_loaded should never be set to true in this case,
skip it.  The check in dspload_wait_loaded() return true if the DSP is
loaded or if it never started.

Signed-off-by: Dylan Reid <dgreid@chromium.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agomm/fremap.c: fix possible oops on error path
Michel Lespinasse [Thu, 14 Mar 2013 23:50:02 +0000 (16:50 -0700)]
mm/fremap.c: fix possible oops on error path

The vm_flags introduced in 6d7825b10dbe ("mm/fremap.c: fix oops on error
path") is supposed to avoid a compiler warning about unitialized
vm_flags without changing the generated code.

However I am concerned that this is going to be very brittle, and fail
with some compiler versions. The failure could be either of:

- compiler could actually load vma->vm_flags before checking for the
  !vma condition, thus reintroducing the oops

- compiler could optimize out the !vma check, since the pointer just got
  dereferenced shortly before (so the compiler knows it can't be NULL!)

I propose reversing this part of the change and initializing vm_flags to 0
just to avoid the bogus uninitialized use warning.

Signed-off-by: Michel Lespinasse <walken@google.com>
Cc: Tommi Rantala <tt.rantala@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
11 years agoMerge branch 'rcu/urgent' of git://git.kernel.org/pub/scm/linux/kernel/git/paulmck...
Linus Torvalds [Thu, 14 Mar 2013 21:53:07 +0000 (14:53 -0700)]
Merge branch 'rcu/urgent' of git://git./linux/kernel/git/paulmck/linux-rcu

Pull fix for hlist_entry_safe() regression from Paul McKenney:
 "This contains a single commit that fixes a regression in
  hlist_entry_safe().  This macro references its argument twice, which
  can cause NULL-pointer errors.  This commit applies a gcc statement
  expression, creating a temporary variable to avoid the double
  reference.  This has been posted to LKML at

    https://lkml.org/lkml/2013/3/9/75.

  Kudos to CAI Qian, whose testing uncovered this, to Eric Dumazet, who
  spotted root cause, and to Li Zefan, who tested this commit."

* 'rcu/urgent' of git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu:
  list: Fix double fetch of pointer in hlist_entry_safe()

11 years agolist: Fix double fetch of pointer in hlist_entry_safe()
Paul E. McKenney [Sat, 9 Mar 2013 15:38:41 +0000 (07:38 -0800)]
list: Fix double fetch of pointer in hlist_entry_safe()

The current version of hlist_entry_safe() fetches the pointer twice,
once to test for NULL and the other to compute the offset back to the
enclosing structure.  This is OK for normal lock-based use because in
that case, the pointer cannot change.  However, when the pointer is
protected by RCU (as in "rcu_dereference(p)"), then the pointer can
change at any time.  This use case can result in the following sequence
of events:

1. CPU 0 invokes hlist_entry_safe(), fetches the RCU-protected
pointer as sees that it is non-NULL.

2. CPU 1 invokes hlist_del_rcu(), deleting the entry that CPU 0
just fetched a pointer to.  Because this is the last entry
in the list, the pointer fetched by CPU 0 is now NULL.

3. CPU 0 refetches the pointer, obtains NULL, and then gets a
NULL-pointer crash.

This commit therefore applies gcc's "({ })" statement expression to
create a temporary variable so that the specified pointer is fetched
only once, avoiding the above sequence of events.  Please note that
it is the caller's responsibility to use rcu_dereference() as needed.
This allows RCU-protected uses to work correctly without imposing
any additional overhead on the non-RCU case.

Many thanks to Eric Dumazet for spotting root cause!

Reported-by: CAI Qian <caiqian@redhat.com>
Reported-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Tested-by: Li Zefan <lizefan@huawei.com>
11 years agoMerge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs
Linus Torvalds [Thu, 14 Mar 2013 19:11:28 +0000 (12:11 -0700)]
Merge branch 'for_linus' of git://git./linux/kernel/git/jack/linux-fs

Pull ext2, ext3, reiserfs, quota fixes from Jan Kara:
 "A fix for regression in ext2, and a format string issue in ext3.  The
  rest isn't too serious."

* 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs:
  ext2: Fix BUG_ON in evict() on inode deletion
  reiserfs: Use kstrdup instead of kmalloc/strcpy
  ext3: Fix format string issues
  quota: add missing use of dq_data_lock in __dquot_initialize

11 years agoBtrfs: fix warning when creating snapshots
Liu Bo [Wed, 13 Mar 2013 13:43:03 +0000 (07:43 -0600)]
Btrfs: fix warning when creating snapshots

Creating snapshot passes extent_root to commit its transaction,
but it can lead to the warning of checking root for quota in
the __btrfs_end_transaction() when someone else is committing
the current transaction.  Since we've recorded the needed root
in trans_handle, just use it to get rid of the warning.

Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
11 years agoBtrfs: return as soon as possible when edquot happens
Wang Shilong [Wed, 6 Mar 2013 11:51:47 +0000 (11:51 +0000)]
Btrfs: return as soon as possible when edquot happens

If one of qgroup fails to reserve firstly, we should return immediately,
it is unnecessary to continue check.

Signed-off-by: Wang Shilong <wangsl-fnst@cn.fujitsu.com>
Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
11 years agoBtrfs: return EIO if we have extent tree corruption
Josef Bacik [Fri, 8 Mar 2013 20:41:02 +0000 (15:41 -0500)]
Btrfs: return EIO if we have extent tree corruption

The callers of lookup_inline_extent_info all handle getting an error back
properly, so return an error if we have corruption instead of being a jerk and
panicing.  Still WARN_ON() since this is kind of crucial and I've been seeing it
a bit too much recently for my taste, I think we're doing something wrong
somewhere.  Thanks,

Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
11 years agobtrfs: use rcu_barrier() to wait for bdev puts at unmount
Eric Sandeen [Sat, 9 Mar 2013 15:18:39 +0000 (15:18 +0000)]
btrfs: use rcu_barrier() to wait for bdev puts at unmount

Doing this would reliably fail with -EBUSY for me:

# mount /dev/sdb2 /mnt/scratch; umount /mnt/scratch; mkfs.btrfs -f /dev/sdb2
...
unable to open /dev/sdb2: Device or resource busy

because mkfs.btrfs tries to open the device O_EXCL, and somebody still has it.

Using systemtap to track bdev gets & puts shows a kworker thread doing a
blkdev put after mkfs attempts a get; this is left over from the unmount
path:

btrfs_close_devices
__btrfs_close_devices
call_rcu(&device->rcu, free_device);
free_device
INIT_WORK(&device->rcu_work, __free_device);
schedule_work(&device->rcu_work);

so unmount might complete before __free_device fires & does its blkdev_put.

Adding an rcu_barrier() to btrfs_close_devices() causes unmount to wait
until all blkdev_put()s are done, and the device is truly free once
unmount completes.

Cc: stable@vger.kernel.org
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>