diff options
682 files changed, 6500 insertions, 4060 deletions
diff --git a/Documentation/ABI/testing/sysfs-bus-hsi b/Documentation/ABI/testing/sysfs-bus-hsi new file mode 100644 index 000000000000..1b1b282a99e1 --- /dev/null +++ b/Documentation/ABI/testing/sysfs-bus-hsi | |||
| @@ -0,0 +1,19 @@ | |||
| 1 | What: /sys/bus/hsi | ||
| 2 | Date: April 2012 | ||
| 3 | KernelVersion: 3.4 | ||
| 4 | Contact: Carlos Chinea <carlos.chinea@nokia.com> | ||
| 5 | Description: | ||
| 6 | High Speed Synchronous Serial Interface (HSI) is a | ||
| 7 | serial interface mainly used for connecting application | ||
| 8 | engines (APE) with cellular modem engines (CMT) in cellular | ||
| 9 | handsets. | ||
| 10 | The bus will be populated with devices (hsi_clients) representing | ||
| 11 | the protocols available in the system. Bus drivers implement | ||
| 12 | those protocols. | ||
| 13 | |||
| 14 | What: /sys/bus/hsi/devices/.../modalias | ||
| 15 | Date: April 2012 | ||
| 16 | KernelVersion: 3.4 | ||
| 17 | Contact: Carlos Chinea <carlos.chinea@nokia.com> | ||
| 18 | Description: Stores the same MODALIAS value emitted by uevent | ||
| 19 | Format: hsi:<hsi_client device name> | ||
diff --git a/Documentation/DocBook/media/v4l/pixfmt-nv12m.xml b/Documentation/DocBook/media/v4l/pixfmt-nv12m.xml index 3fd3ce5df270..5274c24d11e0 100644 --- a/Documentation/DocBook/media/v4l/pixfmt-nv12m.xml +++ b/Documentation/DocBook/media/v4l/pixfmt-nv12m.xml | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | <refentry id="V4L2-PIX-FMT-NV12M"> | 1 | <refentry id="V4L2-PIX-FMT-NV12M"> |
| 2 | <refmeta> | 2 | <refmeta> |
| 3 | <refentrytitle>V4L2_PIX_FMT_NV12M ('NV12M')</refentrytitle> | 3 | <refentrytitle>V4L2_PIX_FMT_NV12M ('NM12')</refentrytitle> |
| 4 | &manvol; | 4 | &manvol; |
| 5 | </refmeta> | 5 | </refmeta> |
| 6 | <refnamediv> | 6 | <refnamediv> |
diff --git a/Documentation/DocBook/media/v4l/pixfmt-yuv420m.xml b/Documentation/DocBook/media/v4l/pixfmt-yuv420m.xml index 9957863daf18..60308f1eefdf 100644 --- a/Documentation/DocBook/media/v4l/pixfmt-yuv420m.xml +++ b/Documentation/DocBook/media/v4l/pixfmt-yuv420m.xml | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | <refentry id="V4L2-PIX-FMT-YUV420M"> | 1 | <refentry id="V4L2-PIX-FMT-YUV420M"> |
| 2 | <refmeta> | 2 | <refmeta> |
| 3 | <refentrytitle>V4L2_PIX_FMT_YUV420M ('YU12M')</refentrytitle> | 3 | <refentrytitle>V4L2_PIX_FMT_YUV420M ('YM12')</refentrytitle> |
| 4 | &manvol; | 4 | &manvol; |
| 5 | </refmeta> | 5 | </refmeta> |
| 6 | <refnamediv> | 6 | <refnamediv> |
diff --git a/Documentation/devicetree/bindings/ata/calxeda-sata.txt b/Documentation/devicetree/bindings/ata/ahci-platform.txt index 79caa5651f53..8bb8a76d42e8 100644 --- a/Documentation/devicetree/bindings/ata/calxeda-sata.txt +++ b/Documentation/devicetree/bindings/ata/ahci-platform.txt | |||
| @@ -1,10 +1,10 @@ | |||
| 1 | * Calxeda SATA Controller | 1 | * AHCI SATA Controller |
| 2 | 2 | ||
| 3 | SATA nodes are defined to describe on-chip Serial ATA controllers. | 3 | SATA nodes are defined to describe on-chip Serial ATA controllers. |
| 4 | Each SATA controller should have its own node. | 4 | Each SATA controller should have its own node. |
| 5 | 5 | ||
| 6 | Required properties: | 6 | Required properties: |
| 7 | - compatible : compatible list, contains "calxeda,hb-ahci" | 7 | - compatible : compatible list, contains "calxeda,hb-ahci" or "snps,spear-ahci" |
| 8 | - interrupts : <interrupt mapping for SATA IRQ> | 8 | - interrupts : <interrupt mapping for SATA IRQ> |
| 9 | - reg : <registers mapping> | 9 | - reg : <registers mapping> |
| 10 | 10 | ||
| @@ -14,4 +14,3 @@ Example: | |||
| 14 | reg = <0xffe08000 0x1000>; | 14 | reg = <0xffe08000 0x1000>; |
| 15 | interrupts = <115>; | 15 | interrupts = <115>; |
| 16 | }; | 16 | }; |
| 17 | |||
diff --git a/Documentation/devicetree/bindings/sound/sgtl5000.txt b/Documentation/devicetree/bindings/sound/sgtl5000.txt index 2c3cd413f042..9cc44449508d 100644 --- a/Documentation/devicetree/bindings/sound/sgtl5000.txt +++ b/Documentation/devicetree/bindings/sound/sgtl5000.txt | |||
| @@ -3,6 +3,8 @@ | |||
| 3 | Required properties: | 3 | Required properties: |
| 4 | - compatible : "fsl,sgtl5000". | 4 | - compatible : "fsl,sgtl5000". |
| 5 | 5 | ||
| 6 | - reg : the I2C address of the device | ||
| 7 | |||
| 6 | Example: | 8 | Example: |
| 7 | 9 | ||
| 8 | codec: sgtl5000@0a { | 10 | codec: sgtl5000@0a { |
diff --git a/Documentation/networking/ip-sysctl.txt b/Documentation/networking/ip-sysctl.txt index bd80ba5847d2..1619a8c80873 100644 --- a/Documentation/networking/ip-sysctl.txt +++ b/Documentation/networking/ip-sysctl.txt | |||
| @@ -147,7 +147,7 @@ tcp_adv_win_scale - INTEGER | |||
| 147 | (if tcp_adv_win_scale > 0) or bytes-bytes/2^(-tcp_adv_win_scale), | 147 | (if tcp_adv_win_scale > 0) or bytes-bytes/2^(-tcp_adv_win_scale), |
| 148 | if it is <= 0. | 148 | if it is <= 0. |
| 149 | Possible values are [-31, 31], inclusive. | 149 | Possible values are [-31, 31], inclusive. |
| 150 | Default: 2 | 150 | Default: 1 |
| 151 | 151 | ||
| 152 | tcp_allowed_congestion_control - STRING | 152 | tcp_allowed_congestion_control - STRING |
| 153 | Show/set the congestion control choices available to non-privileged | 153 | Show/set the congestion control choices available to non-privileged |
| @@ -410,7 +410,7 @@ tcp_rmem - vector of 3 INTEGERs: min, default, max | |||
| 410 | net.core.rmem_max. Calling setsockopt() with SO_RCVBUF disables | 410 | net.core.rmem_max. Calling setsockopt() with SO_RCVBUF disables |
| 411 | automatic tuning of that socket's receive buffer size, in which | 411 | automatic tuning of that socket's receive buffer size, in which |
| 412 | case this value is ignored. | 412 | case this value is ignored. |
| 413 | Default: between 87380B and 4MB, depending on RAM size. | 413 | Default: between 87380B and 6MB, depending on RAM size. |
| 414 | 414 | ||
| 415 | tcp_sack - BOOLEAN | 415 | tcp_sack - BOOLEAN |
| 416 | Enable select acknowledgments (SACKS). | 416 | Enable select acknowledgments (SACKS). |
diff --git a/Documentation/power/freezing-of-tasks.txt b/Documentation/power/freezing-of-tasks.txt index ec715cd78fbb..6ec291ea1c78 100644 --- a/Documentation/power/freezing-of-tasks.txt +++ b/Documentation/power/freezing-of-tasks.txt | |||
| @@ -9,7 +9,7 @@ architectures). | |||
| 9 | 9 | ||
| 10 | II. How does it work? | 10 | II. How does it work? |
| 11 | 11 | ||
| 12 | There are four per-task flags used for that, PF_NOFREEZE, PF_FROZEN, TIF_FREEZE | 12 | There are three per-task flags used for that, PF_NOFREEZE, PF_FROZEN |
| 13 | and PF_FREEZER_SKIP (the last one is auxiliary). The tasks that have | 13 | and PF_FREEZER_SKIP (the last one is auxiliary). The tasks that have |
| 14 | PF_NOFREEZE unset (all user space processes and some kernel threads) are | 14 | PF_NOFREEZE unset (all user space processes and some kernel threads) are |
| 15 | regarded as 'freezable' and treated in a special way before the system enters a | 15 | regarded as 'freezable' and treated in a special way before the system enters a |
| @@ -17,30 +17,31 @@ suspend state as well as before a hibernation image is created (in what follows | |||
| 17 | we only consider hibernation, but the description also applies to suspend). | 17 | we only consider hibernation, but the description also applies to suspend). |
| 18 | 18 | ||
| 19 | Namely, as the first step of the hibernation procedure the function | 19 | Namely, as the first step of the hibernation procedure the function |
| 20 | freeze_processes() (defined in kernel/power/process.c) is called. It executes | 20 | freeze_processes() (defined in kernel/power/process.c) is called. A system-wide |
| 21 | try_to_freeze_tasks() that sets TIF_FREEZE for all of the freezable tasks and | 21 | variable system_freezing_cnt (as opposed to a per-task flag) is used to indicate |
| 22 | either wakes them up, if they are kernel threads, or sends fake signals to them, | 22 | whether the system is to undergo a freezing operation. And freeze_processes() |
| 23 | if they are user space processes. A task that has TIF_FREEZE set, should react | 23 | sets this variable. After this, it executes try_to_freeze_tasks() that sends a |
| 24 | to it by calling the function called __refrigerator() (defined in | 24 | fake signal to all user space processes, and wakes up all the kernel threads. |
| 25 | kernel/freezer.c), which sets the task's PF_FROZEN flag, changes its state | 25 | All freezable tasks must react to that by calling try_to_freeze(), which |
| 26 | to TASK_UNINTERRUPTIBLE and makes it loop until PF_FROZEN is cleared for it. | 26 | results in a call to __refrigerator() (defined in kernel/freezer.c), which sets |
| 27 | Then, we say that the task is 'frozen' and therefore the set of functions | 27 | the task's PF_FROZEN flag, changes its state to TASK_UNINTERRUPTIBLE and makes |
| 28 | handling this mechanism is referred to as 'the freezer' (these functions are | 28 | it loop until PF_FROZEN is cleared for it. Then, we say that the task is |
| 29 | defined in kernel/power/process.c, kernel/freezer.c & include/linux/freezer.h). | 29 | 'frozen' and therefore the set of functions handling this mechanism is referred |
| 30 | User space processes are generally frozen before kernel threads. | 30 | to as 'the freezer' (these functions are defined in kernel/power/process.c, |
| 31 | kernel/freezer.c & include/linux/freezer.h). User space processes are generally | ||
| 32 | frozen before kernel threads. | ||
| 31 | 33 | ||
| 32 | __refrigerator() must not be called directly. Instead, use the | 34 | __refrigerator() must not be called directly. Instead, use the |
| 33 | try_to_freeze() function (defined in include/linux/freezer.h), that checks | 35 | try_to_freeze() function (defined in include/linux/freezer.h), that checks |
| 34 | the task's TIF_FREEZE flag and makes the task enter __refrigerator() if the | 36 | if the task is to be frozen and makes the task enter __refrigerator(). |
| 35 | flag is set. | ||
| 36 | 37 | ||
| 37 | For user space processes try_to_freeze() is called automatically from the | 38 | For user space processes try_to_freeze() is called automatically from the |
| 38 | signal-handling code, but the freezable kernel threads need to call it | 39 | signal-handling code, but the freezable kernel threads need to call it |
| 39 | explicitly in suitable places or use the wait_event_freezable() or | 40 | explicitly in suitable places or use the wait_event_freezable() or |
| 40 | wait_event_freezable_timeout() macros (defined in include/linux/freezer.h) | 41 | wait_event_freezable_timeout() macros (defined in include/linux/freezer.h) |
| 41 | that combine interruptible sleep with checking if TIF_FREEZE is set and calling | 42 | that combine interruptible sleep with checking if the task is to be frozen and |
| 42 | try_to_freeze(). The main loop of a freezable kernel thread may look like the | 43 | calling try_to_freeze(). The main loop of a freezable kernel thread may look |
| 43 | following one: | 44 | like the following one: |
| 44 | 45 | ||
| 45 | set_freezable(); | 46 | set_freezable(); |
| 46 | do { | 47 | do { |
| @@ -53,7 +54,7 @@ following one: | |||
| 53 | (from drivers/usb/core/hub.c::hub_thread()). | 54 | (from drivers/usb/core/hub.c::hub_thread()). |
| 54 | 55 | ||
| 55 | If a freezable kernel thread fails to call try_to_freeze() after the freezer has | 56 | If a freezable kernel thread fails to call try_to_freeze() after the freezer has |
| 56 | set TIF_FREEZE for it, the freezing of tasks will fail and the entire | 57 | initiated a freezing operation, the freezing of tasks will fail and the entire |
| 57 | hibernation operation will be cancelled. For this reason, freezable kernel | 58 | hibernation operation will be cancelled. For this reason, freezable kernel |
| 58 | threads must call try_to_freeze() somewhere or use one of the | 59 | threads must call try_to_freeze() somewhere or use one of the |
| 59 | wait_event_freezable() and wait_event_freezable_timeout() macros. | 60 | wait_event_freezable() and wait_event_freezable_timeout() macros. |
diff --git a/Documentation/security/keys.txt b/Documentation/security/keys.txt index 787717091421..d389acd31e19 100644 --- a/Documentation/security/keys.txt +++ b/Documentation/security/keys.txt | |||
| @@ -123,7 +123,7 @@ KEY SERVICE OVERVIEW | |||
| 123 | 123 | ||
| 124 | The key service provides a number of features besides keys: | 124 | The key service provides a number of features besides keys: |
| 125 | 125 | ||
| 126 | (*) The key service defines two special key types: | 126 | (*) The key service defines three special key types: |
| 127 | 127 | ||
| 128 | (+) "keyring" | 128 | (+) "keyring" |
| 129 | 129 | ||
| @@ -137,6 +137,18 @@ The key service provides a number of features besides keys: | |||
| 137 | blobs of data. These can be created, updated and read by userspace, | 137 | blobs of data. These can be created, updated and read by userspace, |
| 138 | and aren't intended for use by kernel services. | 138 | and aren't intended for use by kernel services. |
| 139 | 139 | ||
| 140 | (+) "logon" | ||
| 141 | |||
| 142 | Like a "user" key, a "logon" key has a payload that is an arbitrary | ||
| 143 | blob of data. It is intended as a place to store secrets which are | ||
| 144 | accessible to the kernel but not to userspace programs. | ||
| 145 | |||
| 146 | The description can be arbitrary, but must be prefixed with a non-zero | ||
| 147 | length string that describes the key "subclass". The subclass is | ||
| 148 | separated from the rest of the description by a ':'. "logon" keys can | ||
| 149 | be created and updated from userspace, but the payload is only | ||
| 150 | readable from kernel space. | ||
| 151 | |||
| 140 | (*) Each process subscribes to three keyrings: a thread-specific keyring, a | 152 | (*) Each process subscribes to three keyrings: a thread-specific keyring, a |
| 141 | process-specific keyring, and a session-specific keyring. | 153 | process-specific keyring, and a session-specific keyring. |
| 142 | 154 | ||
diff --git a/MAINTAINERS b/MAINTAINERS index b0f1073c40b0..707163365a93 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
| @@ -1968,10 +1968,7 @@ S: Maintained | |||
| 1968 | F: drivers/net/ethernet/ti/cpmac.c | 1968 | F: drivers/net/ethernet/ti/cpmac.c |
| 1969 | 1969 | ||
| 1970 | CPU FREQUENCY DRIVERS | 1970 | CPU FREQUENCY DRIVERS |
| 1971 | M: Dave Jones <davej@redhat.com> | ||
| 1972 | L: cpufreq@vger.kernel.org | 1971 | L: cpufreq@vger.kernel.org |
| 1973 | W: http://www.codemonkey.org.uk/projects/cpufreq/ | ||
| 1974 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/davej/cpufreq.git | ||
| 1975 | S: Maintained | 1972 | S: Maintained |
| 1976 | F: drivers/cpufreq/ | 1973 | F: drivers/cpufreq/ |
| 1977 | F: include/linux/cpufreq.h | 1974 | F: include/linux/cpufreq.h |
| @@ -2321,9 +2318,9 @@ S: Supported | |||
| 2321 | F: drivers/acpi/dock.c | 2318 | F: drivers/acpi/dock.c |
| 2322 | 2319 | ||
| 2323 | DOCUMENTATION | 2320 | DOCUMENTATION |
| 2324 | M: Randy Dunlap <rdunlap@xenotime.net> | 2321 | M: Rob Landley <rob@landley.net> |
| 2325 | L: linux-doc@vger.kernel.org | 2322 | L: linux-doc@vger.kernel.org |
| 2326 | T: quilt http://xenotime.net/kernel-doc-patches/current/ | 2323 | T: TBD |
| 2327 | S: Maintained | 2324 | S: Maintained |
| 2328 | F: Documentation/ | 2325 | F: Documentation/ |
| 2329 | 2326 | ||
| @@ -3592,6 +3589,7 @@ S: Supported | |||
| 3592 | F: drivers/net/wireless/iwlegacy/ | 3589 | F: drivers/net/wireless/iwlegacy/ |
| 3593 | 3590 | ||
| 3594 | INTEL WIRELESS WIFI LINK (iwlwifi) | 3591 | INTEL WIRELESS WIFI LINK (iwlwifi) |
| 3592 | M: Johannes Berg <johannes.berg@intel.com> | ||
| 3595 | M: Wey-Yi Guy <wey-yi.w.guy@intel.com> | 3593 | M: Wey-Yi Guy <wey-yi.w.guy@intel.com> |
| 3596 | M: Intel Linux Wireless <ilw@linux.intel.com> | 3594 | M: Intel Linux Wireless <ilw@linux.intel.com> |
| 3597 | L: linux-wireless@vger.kernel.org | 3595 | L: linux-wireless@vger.kernel.org |
| @@ -5891,11 +5889,11 @@ F: Documentation/scsi/st.txt | |||
| 5891 | F: drivers/scsi/st* | 5889 | F: drivers/scsi/st* |
| 5892 | 5890 | ||
| 5893 | SCTP PROTOCOL | 5891 | SCTP PROTOCOL |
| 5894 | M: Vlad Yasevich <vladislav.yasevich@hp.com> | 5892 | M: Vlad Yasevich <vyasevich@gmail.com> |
| 5895 | M: Sridhar Samudrala <sri@us.ibm.com> | 5893 | M: Sridhar Samudrala <sri@us.ibm.com> |
| 5896 | L: linux-sctp@vger.kernel.org | 5894 | L: linux-sctp@vger.kernel.org |
| 5897 | W: http://lksctp.sourceforge.net | 5895 | W: http://lksctp.sourceforge.net |
| 5898 | S: Supported | 5896 | S: Maintained |
| 5899 | F: Documentation/networking/sctp.txt | 5897 | F: Documentation/networking/sctp.txt |
| 5900 | F: include/linux/sctp.h | 5898 | F: include/linux/sctp.h |
| 5901 | F: include/net/sctp/ | 5899 | F: include/net/sctp/ |
| @@ -7578,8 +7576,8 @@ F: Documentation/filesystems/xfs.txt | |||
| 7578 | F: fs/xfs/ | 7576 | F: fs/xfs/ |
| 7579 | 7577 | ||
| 7580 | XILINX AXI ETHERNET DRIVER | 7578 | XILINX AXI ETHERNET DRIVER |
| 7581 | M: Ariane Keller <ariane.keller@tik.ee.ethz.ch> | 7579 | M: Anirudha Sarangi <anirudh@xilinx.com> |
| 7582 | M: Daniel Borkmann <daniel.borkmann@tik.ee.ethz.ch> | 7580 | M: John Linn <John.Linn@xilinx.com> |
| 7583 | S: Maintained | 7581 | S: Maintained |
| 7584 | F: drivers/net/ethernet/xilinx/xilinx_axienet* | 7582 | F: drivers/net/ethernet/xilinx/xilinx_axienet* |
| 7585 | 7583 | ||
| @@ -1,7 +1,7 @@ | |||
| 1 | VERSION = 3 | 1 | VERSION = 3 |
| 2 | PATCHLEVEL = 4 | 2 | PATCHLEVEL = 4 |
| 3 | SUBLEVEL = 0 | 3 | SUBLEVEL = 0 |
| 4 | EXTRAVERSION = -rc3 | 4 | EXTRAVERSION = -rc6 |
| 5 | NAME = Saber-toothed Squirrel | 5 | NAME = Saber-toothed Squirrel |
| 6 | 6 | ||
| 7 | # *DOCUMENTATION* | 7 | # *DOCUMENTATION* |
diff --git a/arch/alpha/Kconfig b/arch/alpha/Kconfig index 56a4df952fb0..22e58a99f38b 100644 --- a/arch/alpha/Kconfig +++ b/arch/alpha/Kconfig | |||
| @@ -477,7 +477,7 @@ config ALPHA_BROKEN_IRQ_MASK | |||
| 477 | 477 | ||
| 478 | config VGA_HOSE | 478 | config VGA_HOSE |
| 479 | bool | 479 | bool |
| 480 | depends on ALPHA_GENERIC || ALPHA_TITAN || ALPHA_MARVEL || ALPHA_TSUNAMI | 480 | depends on VGA_CONSOLE && (ALPHA_GENERIC || ALPHA_TITAN || ALPHA_MARVEL || ALPHA_TSUNAMI) |
| 481 | default y | 481 | default y |
| 482 | help | 482 | help |
| 483 | Support VGA on an arbitrary hose; needed for several platforms | 483 | Support VGA on an arbitrary hose; needed for several platforms |
diff --git a/arch/alpha/include/asm/rtc.h b/arch/alpha/include/asm/rtc.h index 1f7fba671ae6..d70408d36677 100644 --- a/arch/alpha/include/asm/rtc.h +++ b/arch/alpha/include/asm/rtc.h | |||
| @@ -1,14 +1,10 @@ | |||
| 1 | #ifndef _ALPHA_RTC_H | 1 | #ifndef _ALPHA_RTC_H |
| 2 | #define _ALPHA_RTC_H | 2 | #define _ALPHA_RTC_H |
| 3 | 3 | ||
| 4 | #if defined(CONFIG_ALPHA_GENERIC) | 4 | #if defined(CONFIG_ALPHA_MARVEL) && defined(CONFIG_SMP) \ |
| 5 | || defined(CONFIG_ALPHA_GENERIC) | ||
| 5 | # define get_rtc_time alpha_mv.rtc_get_time | 6 | # define get_rtc_time alpha_mv.rtc_get_time |
| 6 | # define set_rtc_time alpha_mv.rtc_set_time | 7 | # define set_rtc_time alpha_mv.rtc_set_time |
| 7 | #else | ||
| 8 | # if defined(CONFIG_ALPHA_MARVEL) && defined(CONFIG_SMP) | ||
| 9 | # define get_rtc_time marvel_get_rtc_time | ||
| 10 | # define set_rtc_time marvel_set_rtc_time | ||
| 11 | # endif | ||
| 12 | #endif | 8 | #endif |
| 13 | 9 | ||
| 14 | #include <asm-generic/rtc.h> | 10 | #include <asm-generic/rtc.h> |
diff --git a/arch/alpha/kernel/core_tsunami.c b/arch/alpha/kernel/core_tsunami.c index 5e7c28f92f19..61893d7bdda5 100644 --- a/arch/alpha/kernel/core_tsunami.c +++ b/arch/alpha/kernel/core_tsunami.c | |||
| @@ -11,6 +11,7 @@ | |||
| 11 | #include <asm/core_tsunami.h> | 11 | #include <asm/core_tsunami.h> |
| 12 | #undef __EXTERN_INLINE | 12 | #undef __EXTERN_INLINE |
| 13 | 13 | ||
| 14 | #include <linux/module.h> | ||
| 14 | #include <linux/types.h> | 15 | #include <linux/types.h> |
| 15 | #include <linux/pci.h> | 16 | #include <linux/pci.h> |
| 16 | #include <linux/sched.h> | 17 | #include <linux/sched.h> |
diff --git a/arch/alpha/kernel/sys_marvel.c b/arch/alpha/kernel/sys_marvel.c index 14a4b6a7cf59..407accc80877 100644 --- a/arch/alpha/kernel/sys_marvel.c +++ b/arch/alpha/kernel/sys_marvel.c | |||
| @@ -317,7 +317,7 @@ marvel_init_irq(void) | |||
| 317 | } | 317 | } |
| 318 | 318 | ||
| 319 | static int | 319 | static int |
| 320 | marvel_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) | 320 | marvel_map_irq(struct pci_dev *dev, u8 slot, u8 pin) |
| 321 | { | 321 | { |
| 322 | struct pci_controller *hose = dev->sysdata; | 322 | struct pci_controller *hose = dev->sysdata; |
| 323 | struct io7_port *io7_port = hose->sysdata; | 323 | struct io7_port *io7_port = hose->sysdata; |
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index cf006d40342c..36586dba6fa6 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig | |||
| @@ -1186,6 +1186,15 @@ if !MMU | |||
| 1186 | source "arch/arm/Kconfig-nommu" | 1186 | source "arch/arm/Kconfig-nommu" |
| 1187 | endif | 1187 | endif |
| 1188 | 1188 | ||
| 1189 | config ARM_ERRATA_326103 | ||
| 1190 | bool "ARM errata: FSR write bit incorrect on a SWP to read-only memory" | ||
| 1191 | depends on CPU_V6 | ||
| 1192 | help | ||
| 1193 | Executing a SWP instruction to read-only memory does not set bit 11 | ||
| 1194 | of the FSR on the ARM 1136 prior to r1p0. This causes the kernel to | ||
| 1195 | treat the access as a read, preventing a COW from occurring and | ||
| 1196 | causing the faulting task to livelock. | ||
| 1197 | |||
| 1189 | config ARM_ERRATA_411920 | 1198 | config ARM_ERRATA_411920 |
| 1190 | bool "ARM errata: Invalidation of the Instruction Cache operation can fail" | 1199 | bool "ARM errata: Invalidation of the Instruction Cache operation can fail" |
| 1191 | depends on CPU_V6 || CPU_V6K | 1200 | depends on CPU_V6 || CPU_V6K |
diff --git a/arch/arm/boot/dts/msm8660-surf.dts b/arch/arm/boot/dts/msm8660-surf.dts index 15ded0deaa79..45bc4bb04e57 100644 --- a/arch/arm/boot/dts/msm8660-surf.dts +++ b/arch/arm/boot/dts/msm8660-surf.dts | |||
| @@ -10,7 +10,7 @@ | |||
| 10 | intc: interrupt-controller@02080000 { | 10 | intc: interrupt-controller@02080000 { |
| 11 | compatible = "qcom,msm-8660-qgic"; | 11 | compatible = "qcom,msm-8660-qgic"; |
| 12 | interrupt-controller; | 12 | interrupt-controller; |
| 13 | #interrupt-cells = <1>; | 13 | #interrupt-cells = <3>; |
| 14 | reg = < 0x02080000 0x1000 >, | 14 | reg = < 0x02080000 0x1000 >, |
| 15 | < 0x02081000 0x1000 >; | 15 | < 0x02081000 0x1000 >; |
| 16 | }; | 16 | }; |
| @@ -19,6 +19,6 @@ | |||
| 19 | compatible = "qcom,msm-hsuart", "qcom,msm-uart"; | 19 | compatible = "qcom,msm-hsuart", "qcom,msm-uart"; |
| 20 | reg = <0x19c40000 0x1000>, | 20 | reg = <0x19c40000 0x1000>, |
| 21 | <0x19c00000 0x1000>; | 21 | <0x19c00000 0x1000>; |
| 22 | interrupts = <195>; | 22 | interrupts = <0 195 0x0>; |
| 23 | }; | 23 | }; |
| 24 | }; | 24 | }; |
diff --git a/arch/arm/boot/dts/versatile-ab.dts b/arch/arm/boot/dts/versatile-ab.dts index 0b32925f2147..e2fe3195c0d1 100644 --- a/arch/arm/boot/dts/versatile-ab.dts +++ b/arch/arm/boot/dts/versatile-ab.dts | |||
| @@ -173,7 +173,7 @@ | |||
| 173 | mmc@5000 { | 173 | mmc@5000 { |
| 174 | compatible = "arm,primecell"; | 174 | compatible = "arm,primecell"; |
| 175 | reg = < 0x5000 0x1000>; | 175 | reg = < 0x5000 0x1000>; |
| 176 | interrupts = <22>; | 176 | interrupts = <22 34>; |
| 177 | }; | 177 | }; |
| 178 | kmi@6000 { | 178 | kmi@6000 { |
| 179 | compatible = "arm,pl050", "arm,primecell"; | 179 | compatible = "arm,pl050", "arm,primecell"; |
diff --git a/arch/arm/boot/dts/versatile-pb.dts b/arch/arm/boot/dts/versatile-pb.dts index 166461073b78..7e8175269064 100644 --- a/arch/arm/boot/dts/versatile-pb.dts +++ b/arch/arm/boot/dts/versatile-pb.dts | |||
| @@ -41,7 +41,7 @@ | |||
| 41 | mmc@b000 { | 41 | mmc@b000 { |
| 42 | compatible = "arm,primecell"; | 42 | compatible = "arm,primecell"; |
| 43 | reg = <0xb000 0x1000>; | 43 | reg = <0xb000 0x1000>; |
| 44 | interrupts = <23>; | 44 | interrupts = <23 34>; |
| 45 | }; | 45 | }; |
| 46 | }; | 46 | }; |
| 47 | }; | 47 | }; |
diff --git a/arch/arm/configs/imx_v4_v5_defconfig b/arch/arm/configs/imx_v4_v5_defconfig index b5ac644e12af..6b31cb60daab 100644 --- a/arch/arm/configs/imx_v4_v5_defconfig +++ b/arch/arm/configs/imx_v4_v5_defconfig | |||
| @@ -112,6 +112,7 @@ CONFIG_WATCHDOG=y | |||
| 112 | CONFIG_IMX2_WDT=y | 112 | CONFIG_IMX2_WDT=y |
| 113 | CONFIG_MFD_MC13XXX=y | 113 | CONFIG_MFD_MC13XXX=y |
| 114 | CONFIG_REGULATOR=y | 114 | CONFIG_REGULATOR=y |
| 115 | CONFIG_REGULATOR_FIXED_VOLTAGE=y | ||
| 115 | CONFIG_REGULATOR_MC13783=y | 116 | CONFIG_REGULATOR_MC13783=y |
| 116 | CONFIG_REGULATOR_MC13892=y | 117 | CONFIG_REGULATOR_MC13892=y |
| 117 | CONFIG_FB=y | 118 | CONFIG_FB=y |
diff --git a/arch/arm/configs/mini2440_defconfig b/arch/arm/configs/mini2440_defconfig index 42da9183acc8..082175c54e7c 100644 --- a/arch/arm/configs/mini2440_defconfig +++ b/arch/arm/configs/mini2440_defconfig | |||
| @@ -14,6 +14,8 @@ CONFIG_MODULE_FORCE_UNLOAD=y | |||
| 14 | # CONFIG_BLK_DEV_BSG is not set | 14 | # CONFIG_BLK_DEV_BSG is not set |
| 15 | CONFIG_BLK_DEV_INTEGRITY=y | 15 | CONFIG_BLK_DEV_INTEGRITY=y |
| 16 | CONFIG_ARCH_S3C24XX=y | 16 | CONFIG_ARCH_S3C24XX=y |
| 17 | # CONFIG_CPU_S3C2410 is not set | ||
| 18 | CONFIG_CPU_S3C2440=y | ||
| 17 | CONFIG_S3C_ADC=y | 19 | CONFIG_S3C_ADC=y |
| 18 | CONFIG_S3C24XX_PWM=y | 20 | CONFIG_S3C24XX_PWM=y |
| 19 | CONFIG_MACH_MINI2440=y | 21 | CONFIG_MACH_MINI2440=y |
diff --git a/arch/arm/configs/u8500_defconfig b/arch/arm/configs/u8500_defconfig index 889d73ac1ae1..7e84f453e8a6 100644 --- a/arch/arm/configs/u8500_defconfig +++ b/arch/arm/configs/u8500_defconfig | |||
| @@ -8,8 +8,6 @@ CONFIG_MODULE_UNLOAD=y | |||
| 8 | # CONFIG_LBDAF is not set | 8 | # CONFIG_LBDAF is not set |
| 9 | # CONFIG_BLK_DEV_BSG is not set | 9 | # CONFIG_BLK_DEV_BSG is not set |
| 10 | CONFIG_ARCH_U8500=y | 10 | CONFIG_ARCH_U8500=y |
| 11 | CONFIG_UX500_SOC_DB5500=y | ||
| 12 | CONFIG_UX500_SOC_DB8500=y | ||
| 13 | CONFIG_MACH_HREFV60=y | 11 | CONFIG_MACH_HREFV60=y |
| 14 | CONFIG_MACH_SNOWBALL=y | 12 | CONFIG_MACH_SNOWBALL=y |
| 15 | CONFIG_MACH_U5500=y | 13 | CONFIG_MACH_U5500=y |
| @@ -39,7 +37,6 @@ CONFIG_CAIF=y | |||
| 39 | CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" | 37 | CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" |
| 40 | CONFIG_BLK_DEV_RAM=y | 38 | CONFIG_BLK_DEV_RAM=y |
| 41 | CONFIG_BLK_DEV_RAM_SIZE=65536 | 39 | CONFIG_BLK_DEV_RAM_SIZE=65536 |
| 42 | CONFIG_MISC_DEVICES=y | ||
| 43 | CONFIG_AB8500_PWM=y | 40 | CONFIG_AB8500_PWM=y |
| 44 | CONFIG_SENSORS_BH1780=y | 41 | CONFIG_SENSORS_BH1780=y |
| 45 | CONFIG_NETDEVICES=y | 42 | CONFIG_NETDEVICES=y |
| @@ -65,16 +62,18 @@ CONFIG_SERIAL_AMBA_PL011=y | |||
| 65 | CONFIG_SERIAL_AMBA_PL011_CONSOLE=y | 62 | CONFIG_SERIAL_AMBA_PL011_CONSOLE=y |
| 66 | CONFIG_HW_RANDOM=y | 63 | CONFIG_HW_RANDOM=y |
| 67 | CONFIG_HW_RANDOM_NOMADIK=y | 64 | CONFIG_HW_RANDOM_NOMADIK=y |
| 68 | CONFIG_I2C=y | ||
| 69 | CONFIG_I2C_NOMADIK=y | ||
| 70 | CONFIG_SPI=y | 65 | CONFIG_SPI=y |
| 71 | CONFIG_SPI_PL022=y | 66 | CONFIG_SPI_PL022=y |
| 72 | CONFIG_GPIO_STMPE=y | 67 | CONFIG_GPIO_STMPE=y |
| 73 | CONFIG_GPIO_TC3589X=y | 68 | CONFIG_GPIO_TC3589X=y |
| 69 | CONFIG_POWER_SUPPLY=y | ||
| 70 | CONFIG_AB8500_BM=y | ||
| 71 | CONFIG_AB8500_BATTERY_THERM_ON_BATCTRL=y | ||
| 74 | CONFIG_MFD_STMPE=y | 72 | CONFIG_MFD_STMPE=y |
| 75 | CONFIG_MFD_TC3589X=y | 73 | CONFIG_MFD_TC3589X=y |
| 76 | CONFIG_AB5500_CORE=y | 74 | CONFIG_AB5500_CORE=y |
| 77 | CONFIG_AB8500_CORE=y | 75 | CONFIG_AB8500_CORE=y |
| 76 | CONFIG_REGULATOR=y | ||
| 78 | CONFIG_REGULATOR_AB8500=y | 77 | CONFIG_REGULATOR_AB8500=y |
| 79 | # CONFIG_HID_SUPPORT is not set | 78 | # CONFIG_HID_SUPPORT is not set |
| 80 | CONFIG_USB_GADGET=y | 79 | CONFIG_USB_GADGET=y |
diff --git a/arch/arm/include/asm/thread_info.h b/arch/arm/include/asm/thread_info.h index d4c24d412a8d..0f04d84582e1 100644 --- a/arch/arm/include/asm/thread_info.h +++ b/arch/arm/include/asm/thread_info.h | |||
| @@ -118,6 +118,13 @@ extern void iwmmxt_task_switch(struct thread_info *); | |||
| 118 | extern void vfp_sync_hwstate(struct thread_info *); | 118 | extern void vfp_sync_hwstate(struct thread_info *); |
| 119 | extern void vfp_flush_hwstate(struct thread_info *); | 119 | extern void vfp_flush_hwstate(struct thread_info *); |
| 120 | 120 | ||
| 121 | struct user_vfp; | ||
| 122 | struct user_vfp_exc; | ||
| 123 | |||
| 124 | extern int vfp_preserve_user_clear_hwstate(struct user_vfp __user *, | ||
| 125 | struct user_vfp_exc __user *); | ||
| 126 | extern int vfp_restore_user_hwstate(struct user_vfp __user *, | ||
| 127 | struct user_vfp_exc __user *); | ||
| 121 | #endif | 128 | #endif |
| 122 | 129 | ||
| 123 | /* | 130 | /* |
diff --git a/arch/arm/include/asm/tls.h b/arch/arm/include/asm/tls.h index 60843eb0f61c..73409e6c0251 100644 --- a/arch/arm/include/asm/tls.h +++ b/arch/arm/include/asm/tls.h | |||
| @@ -7,6 +7,8 @@ | |||
| 7 | 7 | ||
| 8 | .macro set_tls_v6k, tp, tmp1, tmp2 | 8 | .macro set_tls_v6k, tp, tmp1, tmp2 |
| 9 | mcr p15, 0, \tp, c13, c0, 3 @ set TLS register | 9 | mcr p15, 0, \tp, c13, c0, 3 @ set TLS register |
| 10 | mov \tmp1, #0 | ||
| 11 | mcr p15, 0, \tmp1, c13, c0, 2 @ clear user r/w TLS register | ||
| 10 | .endm | 12 | .endm |
| 11 | 13 | ||
| 12 | .macro set_tls_v6, tp, tmp1, tmp2 | 14 | .macro set_tls_v6, tp, tmp1, tmp2 |
| @@ -15,6 +17,8 @@ | |||
| 15 | mov \tmp2, #0xffff0fff | 17 | mov \tmp2, #0xffff0fff |
| 16 | tst \tmp1, #HWCAP_TLS @ hardware TLS available? | 18 | tst \tmp1, #HWCAP_TLS @ hardware TLS available? |
| 17 | mcrne p15, 0, \tp, c13, c0, 3 @ yes, set TLS register | 19 | mcrne p15, 0, \tp, c13, c0, 3 @ yes, set TLS register |
| 20 | movne \tmp1, #0 | ||
| 21 | mcrne p15, 0, \tmp1, c13, c0, 2 @ clear user r/w TLS register | ||
| 18 | streq \tp, [\tmp2, #-15] @ set TLS value at 0xffff0ff0 | 22 | streq \tp, [\tmp2, #-15] @ set TLS value at 0xffff0ff0 |
| 19 | .endm | 23 | .endm |
| 20 | 24 | ||
diff --git a/arch/arm/kernel/irq.c b/arch/arm/kernel/irq.c index 71ccdbfed662..8349d4e97e2b 100644 --- a/arch/arm/kernel/irq.c +++ b/arch/arm/kernel/irq.c | |||
| @@ -155,10 +155,10 @@ static bool migrate_one_irq(struct irq_desc *desc) | |||
| 155 | } | 155 | } |
| 156 | 156 | ||
| 157 | c = irq_data_get_irq_chip(d); | 157 | c = irq_data_get_irq_chip(d); |
| 158 | if (c->irq_set_affinity) | 158 | if (!c->irq_set_affinity) |
| 159 | c->irq_set_affinity(d, affinity, true); | ||
| 160 | else | ||
| 161 | pr_debug("IRQ%u: unable to set affinity\n", d->irq); | 159 | pr_debug("IRQ%u: unable to set affinity\n", d->irq); |
| 160 | else if (c->irq_set_affinity(d, affinity, true) == IRQ_SET_MASK_OK && ret) | ||
| 161 | cpumask_copy(d->affinity, affinity); | ||
| 162 | 162 | ||
| 163 | return ret; | 163 | return ret; |
| 164 | } | 164 | } |
diff --git a/arch/arm/kernel/signal.c b/arch/arm/kernel/signal.c index 7cb532fc8aa4..d68d1b694680 100644 --- a/arch/arm/kernel/signal.c +++ b/arch/arm/kernel/signal.c | |||
| @@ -180,44 +180,23 @@ static int restore_iwmmxt_context(struct iwmmxt_sigframe *frame) | |||
| 180 | 180 | ||
| 181 | static int preserve_vfp_context(struct vfp_sigframe __user *frame) | 181 | static int preserve_vfp_context(struct vfp_sigframe __user *frame) |
| 182 | { | 182 | { |
| 183 | struct thread_info *thread = current_thread_info(); | ||
| 184 | struct vfp_hard_struct *h = &thread->vfpstate.hard; | ||
| 185 | const unsigned long magic = VFP_MAGIC; | 183 | const unsigned long magic = VFP_MAGIC; |
| 186 | const unsigned long size = VFP_STORAGE_SIZE; | 184 | const unsigned long size = VFP_STORAGE_SIZE; |
| 187 | int err = 0; | 185 | int err = 0; |
| 188 | 186 | ||
| 189 | vfp_sync_hwstate(thread); | ||
| 190 | __put_user_error(magic, &frame->magic, err); | 187 | __put_user_error(magic, &frame->magic, err); |
| 191 | __put_user_error(size, &frame->size, err); | 188 | __put_user_error(size, &frame->size, err); |
| 192 | 189 | ||
| 193 | /* | 190 | if (err) |
| 194 | * Copy the floating point registers. There can be unused | 191 | return -EFAULT; |
| 195 | * registers see asm/hwcap.h for details. | ||
| 196 | */ | ||
| 197 | err |= __copy_to_user(&frame->ufp.fpregs, &h->fpregs, | ||
| 198 | sizeof(h->fpregs)); | ||
| 199 | /* | ||
| 200 | * Copy the status and control register. | ||
| 201 | */ | ||
| 202 | __put_user_error(h->fpscr, &frame->ufp.fpscr, err); | ||
| 203 | |||
| 204 | /* | ||
| 205 | * Copy the exception registers. | ||
| 206 | */ | ||
| 207 | __put_user_error(h->fpexc, &frame->ufp_exc.fpexc, err); | ||
| 208 | __put_user_error(h->fpinst, &frame->ufp_exc.fpinst, err); | ||
| 209 | __put_user_error(h->fpinst2, &frame->ufp_exc.fpinst2, err); | ||
| 210 | 192 | ||
| 211 | return err ? -EFAULT : 0; | 193 | return vfp_preserve_user_clear_hwstate(&frame->ufp, &frame->ufp_exc); |
| 212 | } | 194 | } |
| 213 | 195 | ||
| 214 | static int restore_vfp_context(struct vfp_sigframe __user *frame) | 196 | static int restore_vfp_context(struct vfp_sigframe __user *frame) |
| 215 | { | 197 | { |
| 216 | struct thread_info *thread = current_thread_info(); | ||
| 217 | struct vfp_hard_struct *h = &thread->vfpstate.hard; | ||
| 218 | unsigned long magic; | 198 | unsigned long magic; |
| 219 | unsigned long size; | 199 | unsigned long size; |
| 220 | unsigned long fpexc; | ||
| 221 | int err = 0; | 200 | int err = 0; |
| 222 | 201 | ||
| 223 | __get_user_error(magic, &frame->magic, err); | 202 | __get_user_error(magic, &frame->magic, err); |
| @@ -228,33 +207,7 @@ static int restore_vfp_context(struct vfp_sigframe __user *frame) | |||
| 228 | if (magic != VFP_MAGIC || size != VFP_STORAGE_SIZE) | 207 | if (magic != VFP_MAGIC || size != VFP_STORAGE_SIZE) |
| 229 | return -EINVAL; | 208 | return -EINVAL; |
| 230 | 209 | ||
| 231 | vfp_flush_hwstate(thread); | 210 | return vfp_restore_user_hwstate(&frame->ufp, &frame->ufp_exc); |
| 232 | |||
| 233 | /* | ||
| 234 | * Copy the floating point registers. There can be unused | ||
| 235 | * registers see asm/hwcap.h for details. | ||
| 236 | */ | ||
| 237 | err |= __copy_from_user(&h->fpregs, &frame->ufp.fpregs, | ||
| 238 | sizeof(h->fpregs)); | ||
| 239 | /* | ||
| 240 | * Copy the status and control register. | ||
| 241 | */ | ||
| 242 | __get_user_error(h->fpscr, &frame->ufp.fpscr, err); | ||
| 243 | |||
| 244 | /* | ||
| 245 | * Sanitise and restore the exception registers. | ||
| 246 | */ | ||
| 247 | __get_user_error(fpexc, &frame->ufp_exc.fpexc, err); | ||
| 248 | /* Ensure the VFP is enabled. */ | ||
| 249 | fpexc |= FPEXC_EN; | ||
| 250 | /* Ensure FPINST2 is invalid and the exception flag is cleared. */ | ||
| 251 | fpexc &= ~(FPEXC_EX | FPEXC_FP2V); | ||
| 252 | h->fpexc = fpexc; | ||
| 253 | |||
| 254 | __get_user_error(h->fpinst, &frame->ufp_exc.fpinst, err); | ||
| 255 | __get_user_error(h->fpinst2, &frame->ufp_exc.fpinst2, err); | ||
| 256 | |||
| 257 | return err ? -EFAULT : 0; | ||
| 258 | } | 211 | } |
| 259 | 212 | ||
| 260 | #endif | 213 | #endif |
diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c index addbbe8028c2..f6a4d32b0421 100644 --- a/arch/arm/kernel/smp.c +++ b/arch/arm/kernel/smp.c | |||
| @@ -510,10 +510,6 @@ static void ipi_cpu_stop(unsigned int cpu) | |||
| 510 | local_fiq_disable(); | 510 | local_fiq_disable(); |
| 511 | local_irq_disable(); | 511 | local_irq_disable(); |
| 512 | 512 | ||
| 513 | #ifdef CONFIG_HOTPLUG_CPU | ||
| 514 | platform_cpu_kill(cpu); | ||
| 515 | #endif | ||
| 516 | |||
| 517 | while (1) | 513 | while (1) |
| 518 | cpu_relax(); | 514 | cpu_relax(); |
| 519 | } | 515 | } |
| @@ -576,17 +572,25 @@ void smp_send_reschedule(int cpu) | |||
| 576 | smp_cross_call(cpumask_of(cpu), IPI_RESCHEDULE); | 572 | smp_cross_call(cpumask_of(cpu), IPI_RESCHEDULE); |
| 577 | } | 573 | } |
| 578 | 574 | ||
| 575 | #ifdef CONFIG_HOTPLUG_CPU | ||
| 576 | static void smp_kill_cpus(cpumask_t *mask) | ||
| 577 | { | ||
| 578 | unsigned int cpu; | ||
| 579 | for_each_cpu(cpu, mask) | ||
| 580 | platform_cpu_kill(cpu); | ||
| 581 | } | ||
| 582 | #else | ||
| 583 | static void smp_kill_cpus(cpumask_t *mask) { } | ||
| 584 | #endif | ||
| 585 | |||
| 579 | void smp_send_stop(void) | 586 | void smp_send_stop(void) |
| 580 | { | 587 | { |
| 581 | unsigned long timeout; | 588 | unsigned long timeout; |
| 589 | struct cpumask mask; | ||
| 582 | 590 | ||
| 583 | if (num_online_cpus() > 1) { | 591 | cpumask_copy(&mask, cpu_online_mask); |
| 584 | struct cpumask mask; | 592 | cpumask_clear_cpu(smp_processor_id(), &mask); |
| 585 | cpumask_copy(&mask, cpu_online_mask); | 593 | smp_cross_call(&mask, IPI_CPU_STOP); |
| 586 | cpumask_clear_cpu(smp_processor_id(), &mask); | ||
| 587 | |||
| 588 | smp_cross_call(&mask, IPI_CPU_STOP); | ||
| 589 | } | ||
| 590 | 594 | ||
| 591 | /* Wait up to one second for other CPUs to stop */ | 595 | /* Wait up to one second for other CPUs to stop */ |
| 592 | timeout = USEC_PER_SEC; | 596 | timeout = USEC_PER_SEC; |
| @@ -595,6 +599,8 @@ void smp_send_stop(void) | |||
| 595 | 599 | ||
| 596 | if (num_online_cpus() > 1) | 600 | if (num_online_cpus() > 1) |
| 597 | pr_warning("SMP: failed to stop secondary CPUs\n"); | 601 | pr_warning("SMP: failed to stop secondary CPUs\n"); |
| 602 | |||
| 603 | smp_kill_cpus(&mask); | ||
| 598 | } | 604 | } |
| 599 | 605 | ||
| 600 | /* | 606 | /* |
diff --git a/arch/arm/kernel/smp_twd.c b/arch/arm/kernel/smp_twd.c index 5b150afb995b..fef42b21cecb 100644 --- a/arch/arm/kernel/smp_twd.c +++ b/arch/arm/kernel/smp_twd.c | |||
| @@ -118,14 +118,10 @@ static int twd_cpufreq_transition(struct notifier_block *nb, | |||
| 118 | * The twd clock events must be reprogrammed to account for the new | 118 | * The twd clock events must be reprogrammed to account for the new |
| 119 | * frequency. The timer is local to a cpu, so cross-call to the | 119 | * frequency. The timer is local to a cpu, so cross-call to the |
| 120 | * changing cpu. | 120 | * changing cpu. |
| 121 | * | ||
| 122 | * Only wait for it to finish, if the cpu is active to avoid | ||
| 123 | * deadlock when cpu1 is spinning on while(!cpu_active(cpu1)) during | ||
| 124 | * booting of that cpu. | ||
| 125 | */ | 121 | */ |
| 126 | if (state == CPUFREQ_POSTCHANGE || state == CPUFREQ_RESUMECHANGE) | 122 | if (state == CPUFREQ_POSTCHANGE || state == CPUFREQ_RESUMECHANGE) |
| 127 | smp_call_function_single(freqs->cpu, twd_update_frequency, | 123 | smp_call_function_single(freqs->cpu, twd_update_frequency, |
| 128 | NULL, cpu_active(freqs->cpu)); | 124 | NULL, 1); |
| 129 | 125 | ||
| 130 | return NOTIFY_OK; | 126 | return NOTIFY_OK; |
| 131 | } | 127 | } |
diff --git a/arch/arm/mach-at91/at91rm9200_devices.c b/arch/arm/mach-at91/at91rm9200_devices.c index 99ce5c955e39..05774e5b1cba 100644 --- a/arch/arm/mach-at91/at91rm9200_devices.c +++ b/arch/arm/mach-at91/at91rm9200_devices.c | |||
| @@ -1173,7 +1173,6 @@ void __init at91_add_device_serial(void) | |||
| 1173 | printk(KERN_INFO "AT91: No default serial console defined.\n"); | 1173 | printk(KERN_INFO "AT91: No default serial console defined.\n"); |
| 1174 | } | 1174 | } |
| 1175 | #else | 1175 | #else |
| 1176 | void __init __deprecated at91_init_serial(struct at91_uart_config *config) {} | ||
| 1177 | void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins) {} | 1176 | void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins) {} |
| 1178 | void __init at91_set_serial_console(unsigned portnr) {} | 1177 | void __init at91_set_serial_console(unsigned portnr) {} |
| 1179 | void __init at91_add_device_serial(void) {} | 1178 | void __init at91_add_device_serial(void) {} |
diff --git a/arch/arm/mach-at91/at91rm9200_time.c b/arch/arm/mach-at91/at91rm9200_time.c index dd7f782b0b91..104ca40d8d18 100644 --- a/arch/arm/mach-at91/at91rm9200_time.c +++ b/arch/arm/mach-at91/at91rm9200_time.c | |||
| @@ -23,6 +23,7 @@ | |||
| 23 | #include <linux/interrupt.h> | 23 | #include <linux/interrupt.h> |
| 24 | #include <linux/irq.h> | 24 | #include <linux/irq.h> |
| 25 | #include <linux/clockchips.h> | 25 | #include <linux/clockchips.h> |
| 26 | #include <linux/export.h> | ||
| 26 | 27 | ||
| 27 | #include <asm/mach/time.h> | 28 | #include <asm/mach/time.h> |
| 28 | 29 | ||
| @@ -176,6 +177,7 @@ static struct clock_event_device clkevt = { | |||
| 176 | }; | 177 | }; |
| 177 | 178 | ||
| 178 | void __iomem *at91_st_base; | 179 | void __iomem *at91_st_base; |
| 180 | EXPORT_SYMBOL_GPL(at91_st_base); | ||
| 179 | 181 | ||
| 180 | void __init at91rm9200_ioremap_st(u32 addr) | 182 | void __init at91rm9200_ioremap_st(u32 addr) |
| 181 | { | 183 | { |
diff --git a/arch/arm/mach-at91/board-rm9200ek.c b/arch/arm/mach-at91/board-rm9200ek.c index 11cbaa8946fe..b2e4fe21f346 100644 --- a/arch/arm/mach-at91/board-rm9200ek.c +++ b/arch/arm/mach-at91/board-rm9200ek.c | |||
| @@ -117,7 +117,7 @@ static struct i2c_board_info __initdata ek_i2c_devices[] = { | |||
| 117 | }; | 117 | }; |
| 118 | 118 | ||
| 119 | #define EK_FLASH_BASE AT91_CHIPSELECT_0 | 119 | #define EK_FLASH_BASE AT91_CHIPSELECT_0 |
| 120 | #define EK_FLASH_SIZE SZ_2M | 120 | #define EK_FLASH_SIZE SZ_8M |
| 121 | 121 | ||
| 122 | static struct physmap_flash_data ek_flash_data = { | 122 | static struct physmap_flash_data ek_flash_data = { |
| 123 | .width = 2, | 123 | .width = 2, |
diff --git a/arch/arm/mach-at91/board-sam9261ek.c b/arch/arm/mach-at91/board-sam9261ek.c index c3f994462864..065fed342424 100644 --- a/arch/arm/mach-at91/board-sam9261ek.c +++ b/arch/arm/mach-at91/board-sam9261ek.c | |||
| @@ -85,8 +85,6 @@ static struct resource dm9000_resource[] = { | |||
| 85 | .flags = IORESOURCE_MEM | 85 | .flags = IORESOURCE_MEM |
| 86 | }, | 86 | }, |
| 87 | [2] = { | 87 | [2] = { |
| 88 | .start = AT91_PIN_PC11, | ||
| 89 | .end = AT91_PIN_PC11, | ||
| 90 | .flags = IORESOURCE_IRQ | 88 | .flags = IORESOURCE_IRQ |
| 91 | | IORESOURCE_IRQ_LOWEDGE | IORESOURCE_IRQ_HIGHEDGE, | 89 | | IORESOURCE_IRQ_LOWEDGE | IORESOURCE_IRQ_HIGHEDGE, |
| 92 | } | 90 | } |
| @@ -130,6 +128,8 @@ static struct sam9_smc_config __initdata dm9000_smc_config = { | |||
| 130 | 128 | ||
| 131 | static void __init ek_add_device_dm9000(void) | 129 | static void __init ek_add_device_dm9000(void) |
| 132 | { | 130 | { |
| 131 | struct resource *r = &dm9000_resource[2]; | ||
| 132 | |||
| 133 | /* Configure chip-select 2 (DM9000) */ | 133 | /* Configure chip-select 2 (DM9000) */ |
| 134 | sam9_smc_configure(0, 2, &dm9000_smc_config); | 134 | sam9_smc_configure(0, 2, &dm9000_smc_config); |
| 135 | 135 | ||
| @@ -139,6 +139,7 @@ static void __init ek_add_device_dm9000(void) | |||
| 139 | /* Configure Interrupt pin as input, no pull-up */ | 139 | /* Configure Interrupt pin as input, no pull-up */ |
| 140 | at91_set_gpio_input(AT91_PIN_PC11, 0); | 140 | at91_set_gpio_input(AT91_PIN_PC11, 0); |
| 141 | 141 | ||
| 142 | r->start = r->end = gpio_to_irq(AT91_PIN_PC11); | ||
| 142 | platform_device_register(&dm9000_device); | 143 | platform_device_register(&dm9000_device); |
| 143 | } | 144 | } |
| 144 | #else | 145 | #else |
diff --git a/arch/arm/mach-at91/clock.c b/arch/arm/mach-at91/clock.c index a0f4d7424cdc..6b692824c988 100644 --- a/arch/arm/mach-at91/clock.c +++ b/arch/arm/mach-at91/clock.c | |||
| @@ -35,6 +35,7 @@ | |||
| 35 | #include "generic.h" | 35 | #include "generic.h" |
| 36 | 36 | ||
| 37 | void __iomem *at91_pmc_base; | 37 | void __iomem *at91_pmc_base; |
| 38 | EXPORT_SYMBOL_GPL(at91_pmc_base); | ||
| 38 | 39 | ||
| 39 | /* | 40 | /* |
| 40 | * There's a lot more which can be done with clocks, including cpufreq | 41 | * There's a lot more which can be done with clocks, including cpufreq |
diff --git a/arch/arm/mach-at91/include/mach/at91_pmc.h b/arch/arm/mach-at91/include/mach/at91_pmc.h index 36604782a78f..ea2c57a86ca6 100644 --- a/arch/arm/mach-at91/include/mach/at91_pmc.h +++ b/arch/arm/mach-at91/include/mach/at91_pmc.h | |||
| @@ -25,7 +25,7 @@ extern void __iomem *at91_pmc_base; | |||
| 25 | #define at91_pmc_write(field, value) \ | 25 | #define at91_pmc_write(field, value) \ |
| 26 | __raw_writel(value, at91_pmc_base + field) | 26 | __raw_writel(value, at91_pmc_base + field) |
| 27 | #else | 27 | #else |
| 28 | .extern at91_aic_base | 28 | .extern at91_pmc_base |
| 29 | #endif | 29 | #endif |
| 30 | 30 | ||
| 31 | #define AT91_PMC_SCER 0x00 /* System Clock Enable Register */ | 31 | #define AT91_PMC_SCER 0x00 /* System Clock Enable Register */ |
diff --git a/arch/arm/mach-at91/setup.c b/arch/arm/mach-at91/setup.c index 97cc04dc8073..f44a2e7272e3 100644 --- a/arch/arm/mach-at91/setup.c +++ b/arch/arm/mach-at91/setup.c | |||
| @@ -54,6 +54,7 @@ void __init at91_init_interrupts(unsigned int *priority) | |||
| 54 | } | 54 | } |
| 55 | 55 | ||
| 56 | void __iomem *at91_ramc_base[2]; | 56 | void __iomem *at91_ramc_base[2]; |
| 57 | EXPORT_SYMBOL_GPL(at91_ramc_base); | ||
| 57 | 58 | ||
| 58 | void __init at91_ioremap_ramc(int id, u32 addr, u32 size) | 59 | void __init at91_ioremap_ramc(int id, u32 addr, u32 size) |
| 59 | { | 60 | { |
| @@ -292,6 +293,7 @@ void __init at91_ioremap_rstc(u32 base_addr) | |||
| 292 | } | 293 | } |
| 293 | 294 | ||
| 294 | void __iomem *at91_matrix_base; | 295 | void __iomem *at91_matrix_base; |
| 296 | EXPORT_SYMBOL_GPL(at91_matrix_base); | ||
| 295 | 297 | ||
| 296 | void __init at91_ioremap_matrix(u32 base_addr) | 298 | void __init at91_ioremap_matrix(u32 base_addr) |
| 297 | { | 299 | { |
diff --git a/arch/arm/mach-bcmring/core.c b/arch/arm/mach-bcmring/core.c index 22e4e0a28ad1..adbfb1994582 100644 --- a/arch/arm/mach-bcmring/core.c +++ b/arch/arm/mach-bcmring/core.c | |||
| @@ -52,8 +52,8 @@ | |||
| 52 | #include <mach/csp/chipcHw_inline.h> | 52 | #include <mach/csp/chipcHw_inline.h> |
| 53 | #include <mach/csp/tmrHw_reg.h> | 53 | #include <mach/csp/tmrHw_reg.h> |
| 54 | 54 | ||
| 55 | static AMBA_APB_DEVICE(uartA, "uarta", MM_ADDR_IO_UARTA, { IRQ_UARTA }, NULL); | 55 | static AMBA_APB_DEVICE(uartA, "uartA", 0, MM_ADDR_IO_UARTA, {IRQ_UARTA}, NULL); |
| 56 | static AMBA_APB_DEVICE(uartB, "uartb", MM_ADDR_IO_UARTB, { IRQ_UARTB }, NULL); | 56 | static AMBA_APB_DEVICE(uartB, "uartB", 0, MM_ADDR_IO_UARTB, {IRQ_UARTB}, NULL); |
| 57 | 57 | ||
| 58 | static struct clk pll1_clk = { | 58 | static struct clk pll1_clk = { |
| 59 | .name = "PLL1", | 59 | .name = "PLL1", |
diff --git a/arch/arm/mach-exynos/clock-exynos4.c b/arch/arm/mach-exynos/clock-exynos4.c index df54c2a92225..6efd1e5919fd 100644 --- a/arch/arm/mach-exynos/clock-exynos4.c +++ b/arch/arm/mach-exynos/clock-exynos4.c | |||
| @@ -497,25 +497,25 @@ static struct clk exynos4_init_clocks_off[] = { | |||
| 497 | .ctrlbit = (1 << 3), | 497 | .ctrlbit = (1 << 3), |
| 498 | }, { | 498 | }, { |
| 499 | .name = "hsmmc", | 499 | .name = "hsmmc", |
| 500 | .devname = "s3c-sdhci.0", | 500 | .devname = "exynos4-sdhci.0", |
| 501 | .parent = &exynos4_clk_aclk_133.clk, | 501 | .parent = &exynos4_clk_aclk_133.clk, |
| 502 | .enable = exynos4_clk_ip_fsys_ctrl, | 502 | .enable = exynos4_clk_ip_fsys_ctrl, |
| 503 | .ctrlbit = (1 << 5), | 503 | .ctrlbit = (1 << 5), |
| 504 | }, { | 504 | }, { |
| 505 | .name = "hsmmc", | 505 | .name = "hsmmc", |
| 506 | .devname = "s3c-sdhci.1", | 506 | .devname = "exynos4-sdhci.1", |
| 507 | .parent = &exynos4_clk_aclk_133.clk, | 507 | .parent = &exynos4_clk_aclk_133.clk, |
| 508 | .enable = exynos4_clk_ip_fsys_ctrl, | 508 | .enable = exynos4_clk_ip_fsys_ctrl, |
| 509 | .ctrlbit = (1 << 6), | 509 | .ctrlbit = (1 << 6), |
| 510 | }, { | 510 | }, { |
| 511 | .name = "hsmmc", | 511 | .name = "hsmmc", |
| 512 | .devname = "s3c-sdhci.2", | 512 | .devname = "exynos4-sdhci.2", |
| 513 | .parent = &exynos4_clk_aclk_133.clk, | 513 | .parent = &exynos4_clk_aclk_133.clk, |
| 514 | .enable = exynos4_clk_ip_fsys_ctrl, | 514 | .enable = exynos4_clk_ip_fsys_ctrl, |
| 515 | .ctrlbit = (1 << 7), | 515 | .ctrlbit = (1 << 7), |
| 516 | }, { | 516 | }, { |
| 517 | .name = "hsmmc", | 517 | .name = "hsmmc", |
| 518 | .devname = "s3c-sdhci.3", | 518 | .devname = "exynos4-sdhci.3", |
| 519 | .parent = &exynos4_clk_aclk_133.clk, | 519 | .parent = &exynos4_clk_aclk_133.clk, |
| 520 | .enable = exynos4_clk_ip_fsys_ctrl, | 520 | .enable = exynos4_clk_ip_fsys_ctrl, |
| 521 | .ctrlbit = (1 << 8), | 521 | .ctrlbit = (1 << 8), |
| @@ -1202,7 +1202,7 @@ static struct clksrc_clk exynos4_clk_sclk_uart3 = { | |||
| 1202 | static struct clksrc_clk exynos4_clk_sclk_mmc0 = { | 1202 | static struct clksrc_clk exynos4_clk_sclk_mmc0 = { |
| 1203 | .clk = { | 1203 | .clk = { |
| 1204 | .name = "sclk_mmc", | 1204 | .name = "sclk_mmc", |
| 1205 | .devname = "s3c-sdhci.0", | 1205 | .devname = "exynos4-sdhci.0", |
| 1206 | .parent = &exynos4_clk_dout_mmc0.clk, | 1206 | .parent = &exynos4_clk_dout_mmc0.clk, |
| 1207 | .enable = exynos4_clksrc_mask_fsys_ctrl, | 1207 | .enable = exynos4_clksrc_mask_fsys_ctrl, |
| 1208 | .ctrlbit = (1 << 0), | 1208 | .ctrlbit = (1 << 0), |
| @@ -1213,7 +1213,7 @@ static struct clksrc_clk exynos4_clk_sclk_mmc0 = { | |||
| 1213 | static struct clksrc_clk exynos4_clk_sclk_mmc1 = { | 1213 | static struct clksrc_clk exynos4_clk_sclk_mmc1 = { |
| 1214 | .clk = { | 1214 | .clk = { |
| 1215 | .name = "sclk_mmc", | 1215 | .name = "sclk_mmc", |
| 1216 | .devname = "s3c-sdhci.1", | 1216 | .devname = "exynos4-sdhci.1", |
| 1217 | .parent = &exynos4_clk_dout_mmc1.clk, | 1217 | .parent = &exynos4_clk_dout_mmc1.clk, |
| 1218 | .enable = exynos4_clksrc_mask_fsys_ctrl, | 1218 | .enable = exynos4_clksrc_mask_fsys_ctrl, |
| 1219 | .ctrlbit = (1 << 4), | 1219 | .ctrlbit = (1 << 4), |
| @@ -1224,7 +1224,7 @@ static struct clksrc_clk exynos4_clk_sclk_mmc1 = { | |||
| 1224 | static struct clksrc_clk exynos4_clk_sclk_mmc2 = { | 1224 | static struct clksrc_clk exynos4_clk_sclk_mmc2 = { |
| 1225 | .clk = { | 1225 | .clk = { |
| 1226 | .name = "sclk_mmc", | 1226 | .name = "sclk_mmc", |
| 1227 | .devname = "s3c-sdhci.2", | 1227 | .devname = "exynos4-sdhci.2", |
| 1228 | .parent = &exynos4_clk_dout_mmc2.clk, | 1228 | .parent = &exynos4_clk_dout_mmc2.clk, |
| 1229 | .enable = exynos4_clksrc_mask_fsys_ctrl, | 1229 | .enable = exynos4_clksrc_mask_fsys_ctrl, |
| 1230 | .ctrlbit = (1 << 8), | 1230 | .ctrlbit = (1 << 8), |
| @@ -1235,7 +1235,7 @@ static struct clksrc_clk exynos4_clk_sclk_mmc2 = { | |||
| 1235 | static struct clksrc_clk exynos4_clk_sclk_mmc3 = { | 1235 | static struct clksrc_clk exynos4_clk_sclk_mmc3 = { |
| 1236 | .clk = { | 1236 | .clk = { |
| 1237 | .name = "sclk_mmc", | 1237 | .name = "sclk_mmc", |
| 1238 | .devname = "s3c-sdhci.3", | 1238 | .devname = "exynos4-sdhci.3", |
| 1239 | .parent = &exynos4_clk_dout_mmc3.clk, | 1239 | .parent = &exynos4_clk_dout_mmc3.clk, |
| 1240 | .enable = exynos4_clksrc_mask_fsys_ctrl, | 1240 | .enable = exynos4_clksrc_mask_fsys_ctrl, |
| 1241 | .ctrlbit = (1 << 12), | 1241 | .ctrlbit = (1 << 12), |
| @@ -1340,10 +1340,10 @@ static struct clk_lookup exynos4_clk_lookup[] = { | |||
| 1340 | CLKDEV_INIT("exynos4210-uart.1", "clk_uart_baud0", &exynos4_clk_sclk_uart1.clk), | 1340 | CLKDEV_INIT("exynos4210-uart.1", "clk_uart_baud0", &exynos4_clk_sclk_uart1.clk), |
| 1341 | CLKDEV_INIT("exynos4210-uart.2", "clk_uart_baud0", &exynos4_clk_sclk_uart2.clk), | 1341 | CLKDEV_INIT("exynos4210-uart.2", "clk_uart_baud0", &exynos4_clk_sclk_uart2.clk), |
| 1342 | CLKDEV_INIT("exynos4210-uart.3", "clk_uart_baud0", &exynos4_clk_sclk_uart3.clk), | 1342 | CLKDEV_INIT("exynos4210-uart.3", "clk_uart_baud0", &exynos4_clk_sclk_uart3.clk), |
| 1343 | CLKDEV_INIT("s3c-sdhci.0", "mmc_busclk.2", &exynos4_clk_sclk_mmc0.clk), | 1343 | CLKDEV_INIT("exynos4-sdhci.0", "mmc_busclk.2", &exynos4_clk_sclk_mmc0.clk), |
| 1344 | CLKDEV_INIT("s3c-sdhci.1", "mmc_busclk.2", &exynos4_clk_sclk_mmc1.clk), | 1344 | CLKDEV_INIT("exynos4-sdhci.1", "mmc_busclk.2", &exynos4_clk_sclk_mmc1.clk), |
| 1345 | CLKDEV_INIT("s3c-sdhci.2", "mmc_busclk.2", &exynos4_clk_sclk_mmc2.clk), | 1345 | CLKDEV_INIT("exynos4-sdhci.2", "mmc_busclk.2", &exynos4_clk_sclk_mmc2.clk), |
| 1346 | CLKDEV_INIT("s3c-sdhci.3", "mmc_busclk.2", &exynos4_clk_sclk_mmc3.clk), | 1346 | CLKDEV_INIT("exynos4-sdhci.3", "mmc_busclk.2", &exynos4_clk_sclk_mmc3.clk), |
| 1347 | CLKDEV_INIT("exynos4-fb.0", "lcd", &exynos4_clk_fimd0), | 1347 | CLKDEV_INIT("exynos4-fb.0", "lcd", &exynos4_clk_fimd0), |
| 1348 | CLKDEV_INIT("dma-pl330.0", "apb_pclk", &exynos4_clk_pdma0), | 1348 | CLKDEV_INIT("dma-pl330.0", "apb_pclk", &exynos4_clk_pdma0), |
| 1349 | CLKDEV_INIT("dma-pl330.1", "apb_pclk", &exynos4_clk_pdma1), | 1349 | CLKDEV_INIT("dma-pl330.1", "apb_pclk", &exynos4_clk_pdma1), |
diff --git a/arch/arm/mach-exynos/clock-exynos5.c b/arch/arm/mach-exynos/clock-exynos5.c index d013982d0f8e..5cd7a8b8868c 100644 --- a/arch/arm/mach-exynos/clock-exynos5.c +++ b/arch/arm/mach-exynos/clock-exynos5.c | |||
| @@ -455,25 +455,25 @@ static struct clk exynos5_init_clocks_off[] = { | |||
| 455 | .ctrlbit = (1 << 20), | 455 | .ctrlbit = (1 << 20), |
| 456 | }, { | 456 | }, { |
| 457 | .name = "hsmmc", | 457 | .name = "hsmmc", |
| 458 | .devname = "s3c-sdhci.0", | 458 | .devname = "exynos4-sdhci.0", |
| 459 | .parent = &exynos5_clk_aclk_200.clk, | 459 | .parent = &exynos5_clk_aclk_200.clk, |
| 460 | .enable = exynos5_clk_ip_fsys_ctrl, | 460 | .enable = exynos5_clk_ip_fsys_ctrl, |
| 461 | .ctrlbit = (1 << 12), | 461 | .ctrlbit = (1 << 12), |
| 462 | }, { | 462 | }, { |
| 463 | .name = "hsmmc", | 463 | .name = "hsmmc", |
| 464 | .devname = "s3c-sdhci.1", | 464 | .devname = "exynos4-sdhci.1", |
| 465 | .parent = &exynos5_clk_aclk_200.clk, | 465 | .parent = &exynos5_clk_aclk_200.clk, |
| 466 | .enable = exynos5_clk_ip_fsys_ctrl, | 466 | .enable = exynos5_clk_ip_fsys_ctrl, |
| 467 | .ctrlbit = (1 << 13), | 467 | .ctrlbit = (1 << 13), |
| 468 | }, { | 468 | }, { |
| 469 | .name = "hsmmc", | 469 | .name = "hsmmc", |
| 470 | .devname = "s3c-sdhci.2", | 470 | .devname = "exynos4-sdhci.2", |
| 471 | .parent = &exynos5_clk_aclk_200.clk, | 471 | .parent = &exynos5_clk_aclk_200.clk, |
| 472 | .enable = exynos5_clk_ip_fsys_ctrl, | 472 | .enable = exynos5_clk_ip_fsys_ctrl, |
| 473 | .ctrlbit = (1 << 14), | 473 | .ctrlbit = (1 << 14), |
| 474 | }, { | 474 | }, { |
| 475 | .name = "hsmmc", | 475 | .name = "hsmmc", |
| 476 | .devname = "s3c-sdhci.3", | 476 | .devname = "exynos4-sdhci.3", |
| 477 | .parent = &exynos5_clk_aclk_200.clk, | 477 | .parent = &exynos5_clk_aclk_200.clk, |
| 478 | .enable = exynos5_clk_ip_fsys_ctrl, | 478 | .enable = exynos5_clk_ip_fsys_ctrl, |
| 479 | .ctrlbit = (1 << 15), | 479 | .ctrlbit = (1 << 15), |
| @@ -813,7 +813,7 @@ static struct clksrc_clk exynos5_clk_sclk_uart3 = { | |||
| 813 | static struct clksrc_clk exynos5_clk_sclk_mmc0 = { | 813 | static struct clksrc_clk exynos5_clk_sclk_mmc0 = { |
| 814 | .clk = { | 814 | .clk = { |
| 815 | .name = "sclk_mmc", | 815 | .name = "sclk_mmc", |
| 816 | .devname = "s3c-sdhci.0", | 816 | .devname = "exynos4-sdhci.0", |
| 817 | .parent = &exynos5_clk_dout_mmc0.clk, | 817 | .parent = &exynos5_clk_dout_mmc0.clk, |
| 818 | .enable = exynos5_clksrc_mask_fsys_ctrl, | 818 | .enable = exynos5_clksrc_mask_fsys_ctrl, |
| 819 | .ctrlbit = (1 << 0), | 819 | .ctrlbit = (1 << 0), |
| @@ -824,7 +824,7 @@ static struct clksrc_clk exynos5_clk_sclk_mmc0 = { | |||
| 824 | static struct clksrc_clk exynos5_clk_sclk_mmc1 = { | 824 | static struct clksrc_clk exynos5_clk_sclk_mmc1 = { |
| 825 | .clk = { | 825 | .clk = { |
| 826 | .name = "sclk_mmc", | 826 | .name = "sclk_mmc", |
| 827 | .devname = "s3c-sdhci.1", | 827 | .devname = "exynos4-sdhci.1", |
| 828 | .parent = &exynos5_clk_dout_mmc1.clk, | 828 | .parent = &exynos5_clk_dout_mmc1.clk, |
| 829 | .enable = exynos5_clksrc_mask_fsys_ctrl, | 829 | .enable = exynos5_clksrc_mask_fsys_ctrl, |
| 830 | .ctrlbit = (1 << 4), | 830 | .ctrlbit = (1 << 4), |
| @@ -835,7 +835,7 @@ static struct clksrc_clk exynos5_clk_sclk_mmc1 = { | |||
| 835 | static struct clksrc_clk exynos5_clk_sclk_mmc2 = { | 835 | static struct clksrc_clk exynos5_clk_sclk_mmc2 = { |
| 836 | .clk = { | 836 | .clk = { |
| 837 | .name = "sclk_mmc", | 837 | .name = "sclk_mmc", |
| 838 | .devname = "s3c-sdhci.2", | 838 | .devname = "exynos4-sdhci.2", |
| 839 | .parent = &exynos5_clk_dout_mmc2.clk, | 839 | .parent = &exynos5_clk_dout_mmc2.clk, |
| 840 | .enable = exynos5_clksrc_mask_fsys_ctrl, | 840 | .enable = exynos5_clksrc_mask_fsys_ctrl, |
| 841 | .ctrlbit = (1 << 8), | 841 | .ctrlbit = (1 << 8), |
| @@ -846,7 +846,7 @@ static struct clksrc_clk exynos5_clk_sclk_mmc2 = { | |||
| 846 | static struct clksrc_clk exynos5_clk_sclk_mmc3 = { | 846 | static struct clksrc_clk exynos5_clk_sclk_mmc3 = { |
| 847 | .clk = { | 847 | .clk = { |
| 848 | .name = "sclk_mmc", | 848 | .name = "sclk_mmc", |
| 849 | .devname = "s3c-sdhci.3", | 849 | .devname = "exynos4-sdhci.3", |
| 850 | .parent = &exynos5_clk_dout_mmc3.clk, | 850 | .parent = &exynos5_clk_dout_mmc3.clk, |
| 851 | .enable = exynos5_clksrc_mask_fsys_ctrl, | 851 | .enable = exynos5_clksrc_mask_fsys_ctrl, |
| 852 | .ctrlbit = (1 << 12), | 852 | .ctrlbit = (1 << 12), |
| @@ -990,10 +990,10 @@ static struct clk_lookup exynos5_clk_lookup[] = { | |||
| 990 | CLKDEV_INIT("exynos4210-uart.1", "clk_uart_baud0", &exynos5_clk_sclk_uart1.clk), | 990 | CLKDEV_INIT("exynos4210-uart.1", "clk_uart_baud0", &exynos5_clk_sclk_uart1.clk), |
| 991 | CLKDEV_INIT("exynos4210-uart.2", "clk_uart_baud0", &exynos5_clk_sclk_uart2.clk), | 991 | CLKDEV_INIT("exynos4210-uart.2", "clk_uart_baud0", &exynos5_clk_sclk_uart2.clk), |
| 992 | CLKDEV_INIT("exynos4210-uart.3", "clk_uart_baud0", &exynos5_clk_sclk_uart3.clk), | 992 | CLKDEV_INIT("exynos4210-uart.3", "clk_uart_baud0", &exynos5_clk_sclk_uart3.clk), |
| 993 | CLKDEV_INIT("s3c-sdhci.0", "mmc_busclk.2", &exynos5_clk_sclk_mmc0.clk), | 993 | CLKDEV_INIT("exynos4-sdhci.0", "mmc_busclk.2", &exynos5_clk_sclk_mmc0.clk), |
| 994 | CLKDEV_INIT("s3c-sdhci.1", "mmc_busclk.2", &exynos5_clk_sclk_mmc1.clk), | 994 | CLKDEV_INIT("exynos4-sdhci.1", "mmc_busclk.2", &exynos5_clk_sclk_mmc1.clk), |
| 995 | CLKDEV_INIT("s3c-sdhci.2", "mmc_busclk.2", &exynos5_clk_sclk_mmc2.clk), | 995 | CLKDEV_INIT("exynos4-sdhci.2", "mmc_busclk.2", &exynos5_clk_sclk_mmc2.clk), |
| 996 | CLKDEV_INIT("s3c-sdhci.3", "mmc_busclk.2", &exynos5_clk_sclk_mmc3.clk), | 996 | CLKDEV_INIT("exynos4-sdhci.3", "mmc_busclk.2", &exynos5_clk_sclk_mmc3.clk), |
| 997 | CLKDEV_INIT("dma-pl330.0", "apb_pclk", &exynos5_clk_pdma0), | 997 | CLKDEV_INIT("dma-pl330.0", "apb_pclk", &exynos5_clk_pdma0), |
| 998 | CLKDEV_INIT("dma-pl330.1", "apb_pclk", &exynos5_clk_pdma1), | 998 | CLKDEV_INIT("dma-pl330.1", "apb_pclk", &exynos5_clk_pdma1), |
| 999 | CLKDEV_INIT("dma-pl330.2", "apb_pclk", &exynos5_clk_mdma1), | 999 | CLKDEV_INIT("dma-pl330.2", "apb_pclk", &exynos5_clk_mdma1), |
diff --git a/arch/arm/mach-exynos/common.c b/arch/arm/mach-exynos/common.c index 8614aab47cc0..5ccd6e80a607 100644 --- a/arch/arm/mach-exynos/common.c +++ b/arch/arm/mach-exynos/common.c | |||
| @@ -326,6 +326,11 @@ static void __init exynos4_map_io(void) | |||
| 326 | s3c_fimc_setname(2, "exynos4-fimc"); | 326 | s3c_fimc_setname(2, "exynos4-fimc"); |
| 327 | s3c_fimc_setname(3, "exynos4-fimc"); | 327 | s3c_fimc_setname(3, "exynos4-fimc"); |
| 328 | 328 | ||
| 329 | s3c_sdhci_setname(0, "exynos4-sdhci"); | ||
| 330 | s3c_sdhci_setname(1, "exynos4-sdhci"); | ||
| 331 | s3c_sdhci_setname(2, "exynos4-sdhci"); | ||
| 332 | s3c_sdhci_setname(3, "exynos4-sdhci"); | ||
| 333 | |||
| 329 | /* The I2C bus controllers are directly compatible with s3c2440 */ | 334 | /* The I2C bus controllers are directly compatible with s3c2440 */ |
| 330 | s3c_i2c0_setname("s3c2440-i2c"); | 335 | s3c_i2c0_setname("s3c2440-i2c"); |
| 331 | s3c_i2c1_setname("s3c2440-i2c"); | 336 | s3c_i2c1_setname("s3c2440-i2c"); |
| @@ -344,6 +349,11 @@ static void __init exynos5_map_io(void) | |||
| 344 | s3c_device_i2c0.resource[1].start = EXYNOS5_IRQ_IIC; | 349 | s3c_device_i2c0.resource[1].start = EXYNOS5_IRQ_IIC; |
| 345 | s3c_device_i2c0.resource[1].end = EXYNOS5_IRQ_IIC; | 350 | s3c_device_i2c0.resource[1].end = EXYNOS5_IRQ_IIC; |
| 346 | 351 | ||
| 352 | s3c_sdhci_setname(0, "exynos4-sdhci"); | ||
| 353 | s3c_sdhci_setname(1, "exynos4-sdhci"); | ||
| 354 | s3c_sdhci_setname(2, "exynos4-sdhci"); | ||
| 355 | s3c_sdhci_setname(3, "exynos4-sdhci"); | ||
| 356 | |||
| 347 | /* The I2C bus controllers are directly compatible with s3c2440 */ | 357 | /* The I2C bus controllers are directly compatible with s3c2440 */ |
| 348 | s3c_i2c0_setname("s3c2440-i2c"); | 358 | s3c_i2c0_setname("s3c2440-i2c"); |
| 349 | s3c_i2c1_setname("s3c2440-i2c"); | 359 | s3c_i2c1_setname("s3c2440-i2c"); |
| @@ -537,7 +547,9 @@ void __init exynos5_init_irq(void) | |||
| 537 | { | 547 | { |
| 538 | int irq; | 548 | int irq; |
| 539 | 549 | ||
| 540 | gic_init(0, IRQ_PPI(0), S5P_VA_GIC_DIST, S5P_VA_GIC_CPU); | 550 | #ifdef CONFIG_OF |
| 551 | of_irq_init(exynos4_dt_irq_match); | ||
| 552 | #endif | ||
| 541 | 553 | ||
| 542 | for (irq = 0; irq < EXYNOS5_MAX_COMBINER_NR; irq++) { | 554 | for (irq = 0; irq < EXYNOS5_MAX_COMBINER_NR; irq++) { |
| 543 | combiner_init(irq, (void __iomem *)S5P_VA_COMBINER(irq), | 555 | combiner_init(irq, (void __iomem *)S5P_VA_COMBINER(irq), |
diff --git a/arch/arm/mach-exynos/dev-dwmci.c b/arch/arm/mach-exynos/dev-dwmci.c index b025db4bf602..79035018fb74 100644 --- a/arch/arm/mach-exynos/dev-dwmci.c +++ b/arch/arm/mach-exynos/dev-dwmci.c | |||
| @@ -16,6 +16,7 @@ | |||
| 16 | #include <linux/dma-mapping.h> | 16 | #include <linux/dma-mapping.h> |
| 17 | #include <linux/platform_device.h> | 17 | #include <linux/platform_device.h> |
| 18 | #include <linux/interrupt.h> | 18 | #include <linux/interrupt.h> |
| 19 | #include <linux/ioport.h> | ||
| 19 | #include <linux/mmc/dw_mmc.h> | 20 | #include <linux/mmc/dw_mmc.h> |
| 20 | 21 | ||
| 21 | #include <plat/devs.h> | 22 | #include <plat/devs.h> |
| @@ -33,16 +34,8 @@ static int exynos4_dwmci_init(u32 slot_id, irq_handler_t handler, void *data) | |||
| 33 | } | 34 | } |
| 34 | 35 | ||
| 35 | static struct resource exynos4_dwmci_resource[] = { | 36 | static struct resource exynos4_dwmci_resource[] = { |
| 36 | [0] = { | 37 | [0] = DEFINE_RES_MEM(EXYNOS4_PA_DWMCI, SZ_4K), |
| 37 | .start = EXYNOS4_PA_DWMCI, | 38 | [1] = DEFINE_RES_IRQ(EXYNOS4_IRQ_DWMCI), |
| 38 | .end = EXYNOS4_PA_DWMCI + SZ_4K - 1, | ||
| 39 | .flags = IORESOURCE_MEM, | ||
| 40 | }, | ||
| 41 | [1] = { | ||
| 42 | .start = IRQ_DWMCI, | ||
| 43 | .end = IRQ_DWMCI, | ||
| 44 | .flags = IORESOURCE_IRQ, | ||
| 45 | } | ||
| 46 | }; | 39 | }; |
| 47 | 40 | ||
| 48 | static struct dw_mci_board exynos4_dwci_pdata = { | 41 | static struct dw_mci_board exynos4_dwci_pdata = { |
diff --git a/arch/arm/mach-exynos/mach-nuri.c b/arch/arm/mach-exynos/mach-nuri.c index b4f1f902ce6d..ed90aef404c3 100644 --- a/arch/arm/mach-exynos/mach-nuri.c +++ b/arch/arm/mach-exynos/mach-nuri.c | |||
| @@ -112,6 +112,7 @@ static struct s3c_sdhci_platdata nuri_hsmmc0_data __initdata = { | |||
| 112 | .host_caps = (MMC_CAP_8_BIT_DATA | MMC_CAP_4_BIT_DATA | | 112 | .host_caps = (MMC_CAP_8_BIT_DATA | MMC_CAP_4_BIT_DATA | |
| 113 | MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED | | 113 | MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED | |
| 114 | MMC_CAP_ERASE), | 114 | MMC_CAP_ERASE), |
| 115 | .host_caps2 = MMC_CAP2_BROKEN_VOLTAGE, | ||
| 115 | .cd_type = S3C_SDHCI_CD_PERMANENT, | 116 | .cd_type = S3C_SDHCI_CD_PERMANENT, |
| 116 | .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL, | 117 | .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL, |
| 117 | }; | 118 | }; |
diff --git a/arch/arm/mach-exynos/mach-universal_c210.c b/arch/arm/mach-exynos/mach-universal_c210.c index 7ebf79c2ab34..cb2b027f09a6 100644 --- a/arch/arm/mach-exynos/mach-universal_c210.c +++ b/arch/arm/mach-exynos/mach-universal_c210.c | |||
| @@ -747,6 +747,7 @@ static struct s3c_sdhci_platdata universal_hsmmc0_data __initdata = { | |||
| 747 | .max_width = 8, | 747 | .max_width = 8, |
| 748 | .host_caps = (MMC_CAP_8_BIT_DATA | MMC_CAP_4_BIT_DATA | | 748 | .host_caps = (MMC_CAP_8_BIT_DATA | MMC_CAP_4_BIT_DATA | |
| 749 | MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED), | 749 | MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED), |
| 750 | .host_caps2 = MMC_CAP2_BROKEN_VOLTAGE, | ||
| 750 | .cd_type = S3C_SDHCI_CD_PERMANENT, | 751 | .cd_type = S3C_SDHCI_CD_PERMANENT, |
| 751 | .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL, | 752 | .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL, |
| 752 | }; | 753 | }; |
diff --git a/arch/arm/mach-imx/imx27-dt.c b/arch/arm/mach-imx/imx27-dt.c index 861ceb8232d6..ed38d03c61f2 100644 --- a/arch/arm/mach-imx/imx27-dt.c +++ b/arch/arm/mach-imx/imx27-dt.c | |||
| @@ -35,7 +35,7 @@ static const struct of_dev_auxdata imx27_auxdata_lookup[] __initconst = { | |||
| 35 | static int __init imx27_avic_add_irq_domain(struct device_node *np, | 35 | static int __init imx27_avic_add_irq_domain(struct device_node *np, |
| 36 | struct device_node *interrupt_parent) | 36 | struct device_node *interrupt_parent) |
| 37 | { | 37 | { |
| 38 | irq_domain_add_simple(np, 0); | 38 | irq_domain_add_legacy(np, 64, 0, 0, &irq_domain_simple_ops, NULL); |
| 39 | return 0; | 39 | return 0; |
| 40 | } | 40 | } |
| 41 | 41 | ||
| @@ -44,7 +44,9 @@ static int __init imx27_gpio_add_irq_domain(struct device_node *np, | |||
| 44 | { | 44 | { |
| 45 | static int gpio_irq_base = MXC_GPIO_IRQ_START + ARCH_NR_GPIOS; | 45 | static int gpio_irq_base = MXC_GPIO_IRQ_START + ARCH_NR_GPIOS; |
| 46 | 46 | ||
| 47 | irq_domain_add_simple(np, gpio_irq_base); | 47 | gpio_irq_base -= 32; |
| 48 | irq_domain_add_legacy(np, 32, gpio_irq_base, 0, &irq_domain_simple_ops, | ||
| 49 | NULL); | ||
| 48 | 50 | ||
| 49 | return 0; | 51 | return 0; |
| 50 | } | 52 | } |
diff --git a/arch/arm/mach-imx/mm-imx5.c b/arch/arm/mach-imx/mm-imx5.c index 05250aed61fb..e10f3914fcfe 100644 --- a/arch/arm/mach-imx/mm-imx5.c +++ b/arch/arm/mach-imx/mm-imx5.c | |||
| @@ -35,7 +35,7 @@ static void imx5_idle(void) | |||
| 35 | } | 35 | } |
| 36 | clk_enable(gpc_dvfs_clk); | 36 | clk_enable(gpc_dvfs_clk); |
| 37 | mx5_cpu_lp_set(WAIT_UNCLOCKED_POWER_OFF); | 37 | mx5_cpu_lp_set(WAIT_UNCLOCKED_POWER_OFF); |
| 38 | if (tzic_enable_wake() != 0) | 38 | if (!tzic_enable_wake()) |
| 39 | cpu_do_idle(); | 39 | cpu_do_idle(); |
| 40 | clk_disable(gpc_dvfs_clk); | 40 | clk_disable(gpc_dvfs_clk); |
| 41 | } | 41 | } |
diff --git a/arch/arm/mach-msm/board-msm8x60.c b/arch/arm/mach-msm/board-msm8x60.c index 962e71169750..fb3496a52ef4 100644 --- a/arch/arm/mach-msm/board-msm8x60.c +++ b/arch/arm/mach-msm/board-msm8x60.c | |||
| @@ -17,6 +17,7 @@ | |||
| 17 | #include <linux/irqdomain.h> | 17 | #include <linux/irqdomain.h> |
| 18 | #include <linux/of.h> | 18 | #include <linux/of.h> |
| 19 | #include <linux/of_address.h> | 19 | #include <linux/of_address.h> |
| 20 | #include <linux/of_irq.h> | ||
| 20 | #include <linux/of_platform.h> | 21 | #include <linux/of_platform.h> |
| 21 | #include <linux/memblock.h> | 22 | #include <linux/memblock.h> |
| 22 | 23 | ||
| @@ -49,10 +50,22 @@ static void __init msm8x60_map_io(void) | |||
| 49 | msm_map_msm8x60_io(); | 50 | msm_map_msm8x60_io(); |
| 50 | } | 51 | } |
| 51 | 52 | ||
| 53 | #ifdef CONFIG_OF | ||
| 54 | static struct of_device_id msm_dt_gic_match[] __initdata = { | ||
| 55 | { .compatible = "qcom,msm-8660-qgic", .data = gic_of_init }, | ||
| 56 | {} | ||
| 57 | }; | ||
| 58 | #endif | ||
| 59 | |||
| 52 | static void __init msm8x60_init_irq(void) | 60 | static void __init msm8x60_init_irq(void) |
| 53 | { | 61 | { |
| 54 | gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE, | 62 | if (!of_have_populated_dt()) |
| 55 | (void *)MSM_QGIC_CPU_BASE); | 63 | gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE, |
| 64 | (void *)MSM_QGIC_CPU_BASE); | ||
| 65 | #ifdef CONFIG_OF | ||
| 66 | else | ||
| 67 | of_irq_init(msm_dt_gic_match); | ||
| 68 | #endif | ||
| 56 | 69 | ||
| 57 | /* Edge trigger PPIs except AVS_SVICINT and AVS_SVICINTSWDONE */ | 70 | /* Edge trigger PPIs except AVS_SVICINT and AVS_SVICINTSWDONE */ |
| 58 | writel(0xFFFFD7FF, MSM_QGIC_DIST_BASE + GIC_DIST_CONFIG + 4); | 71 | writel(0xFFFFD7FF, MSM_QGIC_DIST_BASE + GIC_DIST_CONFIG + 4); |
| @@ -73,16 +86,8 @@ static struct of_dev_auxdata msm_auxdata_lookup[] __initdata = { | |||
| 73 | {} | 86 | {} |
| 74 | }; | 87 | }; |
| 75 | 88 | ||
| 76 | static struct of_device_id msm_dt_gic_match[] __initdata = { | ||
| 77 | { .compatible = "qcom,msm-8660-qgic", }, | ||
| 78 | {} | ||
| 79 | }; | ||
| 80 | |||
| 81 | static void __init msm8x60_dt_init(void) | 89 | static void __init msm8x60_dt_init(void) |
| 82 | { | 90 | { |
| 83 | irq_domain_generate_simple(msm_dt_gic_match, MSM8X60_QGIC_DIST_PHYS, | ||
| 84 | GIC_SPI_START); | ||
| 85 | |||
| 86 | if (of_machine_is_compatible("qcom,msm8660-surf")) { | 91 | if (of_machine_is_compatible("qcom,msm8660-surf")) { |
| 87 | printk(KERN_INFO "Init surf UART registers\n"); | 92 | printk(KERN_INFO "Init surf UART registers\n"); |
| 88 | msm8x60_init_uart12dm(); | 93 | msm8x60_init_uart12dm(); |
diff --git a/arch/arm/mach-omap1/mux.c b/arch/arm/mach-omap1/mux.c index 087dba0df47e..e9cc52d4cb28 100644 --- a/arch/arm/mach-omap1/mux.c +++ b/arch/arm/mach-omap1/mux.c | |||
| @@ -27,6 +27,7 @@ | |||
| 27 | #include <linux/io.h> | 27 | #include <linux/io.h> |
| 28 | #include <linux/spinlock.h> | 28 | #include <linux/spinlock.h> |
| 29 | 29 | ||
| 30 | #include <mach/hardware.h> | ||
| 30 | 31 | ||
| 31 | #include <plat/mux.h> | 32 | #include <plat/mux.h> |
| 32 | 33 | ||
diff --git a/arch/arm/mach-omap1/timer.c b/arch/arm/mach-omap1/timer.c index 6e90665a7c47..fb202af01d0d 100644 --- a/arch/arm/mach-omap1/timer.c +++ b/arch/arm/mach-omap1/timer.c | |||
| @@ -47,9 +47,9 @@ static int omap1_dm_timer_set_src(struct platform_device *pdev, | |||
| 47 | int n = (pdev->id - 1) << 1; | 47 | int n = (pdev->id - 1) << 1; |
| 48 | u32 l; | 48 | u32 l; |
| 49 | 49 | ||
| 50 | l = __raw_readl(MOD_CONF_CTRL_1) & ~(0x03 << n); | 50 | l = omap_readl(MOD_CONF_CTRL_1) & ~(0x03 << n); |
| 51 | l |= source << n; | 51 | l |= source << n; |
| 52 | __raw_writel(l, MOD_CONF_CTRL_1); | 52 | omap_writel(l, MOD_CONF_CTRL_1); |
| 53 | 53 | ||
| 54 | return 0; | 54 | return 0; |
| 55 | } | 55 | } |
diff --git a/arch/arm/mach-omap2/board-4430sdp.c b/arch/arm/mach-omap2/board-4430sdp.c index a39fc4bbd2b8..130ab00c09a2 100644 --- a/arch/arm/mach-omap2/board-4430sdp.c +++ b/arch/arm/mach-omap2/board-4430sdp.c | |||
| @@ -20,6 +20,7 @@ | |||
| 20 | #include <linux/usb/otg.h> | 20 | #include <linux/usb/otg.h> |
| 21 | #include <linux/spi/spi.h> | 21 | #include <linux/spi/spi.h> |
| 22 | #include <linux/i2c/twl.h> | 22 | #include <linux/i2c/twl.h> |
| 23 | #include <linux/mfd/twl6040.h> | ||
| 23 | #include <linux/gpio_keys.h> | 24 | #include <linux/gpio_keys.h> |
| 24 | #include <linux/regulator/machine.h> | 25 | #include <linux/regulator/machine.h> |
| 25 | #include <linux/regulator/fixed.h> | 26 | #include <linux/regulator/fixed.h> |
| @@ -560,7 +561,7 @@ static struct regulator_init_data sdp4430_vusim = { | |||
| 560 | }, | 561 | }, |
| 561 | }; | 562 | }; |
| 562 | 563 | ||
| 563 | static struct twl4030_codec_data twl6040_codec = { | 564 | static struct twl6040_codec_data twl6040_codec = { |
| 564 | /* single-step ramp for headset and handsfree */ | 565 | /* single-step ramp for headset and handsfree */ |
| 565 | .hs_left_step = 0x0f, | 566 | .hs_left_step = 0x0f, |
| 566 | .hs_right_step = 0x0f, | 567 | .hs_right_step = 0x0f, |
| @@ -568,7 +569,7 @@ static struct twl4030_codec_data twl6040_codec = { | |||
| 568 | .hf_right_step = 0x1d, | 569 | .hf_right_step = 0x1d, |
| 569 | }; | 570 | }; |
| 570 | 571 | ||
| 571 | static struct twl4030_vibra_data twl6040_vibra = { | 572 | static struct twl6040_vibra_data twl6040_vibra = { |
| 572 | .vibldrv_res = 8, | 573 | .vibldrv_res = 8, |
| 573 | .vibrdrv_res = 3, | 574 | .vibrdrv_res = 3, |
| 574 | .viblmotor_res = 10, | 575 | .viblmotor_res = 10, |
| @@ -577,16 +578,14 @@ static struct twl4030_vibra_data twl6040_vibra = { | |||
| 577 | .vddvibr_uV = 0, /* fixed volt supply - VBAT */ | 578 | .vddvibr_uV = 0, /* fixed volt supply - VBAT */ |
| 578 | }; | 579 | }; |
| 579 | 580 | ||
| 580 | static struct twl4030_audio_data twl6040_audio = { | 581 | static struct twl6040_platform_data twl6040_data = { |
| 581 | .codec = &twl6040_codec, | 582 | .codec = &twl6040_codec, |
| 582 | .vibra = &twl6040_vibra, | 583 | .vibra = &twl6040_vibra, |
| 583 | .audpwron_gpio = 127, | 584 | .audpwron_gpio = 127, |
| 584 | .naudint_irq = OMAP44XX_IRQ_SYS_2N, | ||
| 585 | .irq_base = TWL6040_CODEC_IRQ_BASE, | 585 | .irq_base = TWL6040_CODEC_IRQ_BASE, |
| 586 | }; | 586 | }; |
| 587 | 587 | ||
| 588 | static struct twl4030_platform_data sdp4430_twldata = { | 588 | static struct twl4030_platform_data sdp4430_twldata = { |
| 589 | .audio = &twl6040_audio, | ||
| 590 | /* Regulators */ | 589 | /* Regulators */ |
| 591 | .vusim = &sdp4430_vusim, | 590 | .vusim = &sdp4430_vusim, |
| 592 | .vaux1 = &sdp4430_vaux1, | 591 | .vaux1 = &sdp4430_vaux1, |
| @@ -617,7 +616,8 @@ static int __init omap4_i2c_init(void) | |||
| 617 | TWL_COMMON_REGULATOR_VCXIO | | 616 | TWL_COMMON_REGULATOR_VCXIO | |
| 618 | TWL_COMMON_REGULATOR_VUSB | | 617 | TWL_COMMON_REGULATOR_VUSB | |
| 619 | TWL_COMMON_REGULATOR_CLK32KG); | 618 | TWL_COMMON_REGULATOR_CLK32KG); |
| 620 | omap4_pmic_init("twl6030", &sdp4430_twldata); | 619 | omap4_pmic_init("twl6030", &sdp4430_twldata, |
| 620 | &twl6040_data, OMAP44XX_IRQ_SYS_2N); | ||
| 621 | omap_register_i2c_bus(2, 400, NULL, 0); | 621 | omap_register_i2c_bus(2, 400, NULL, 0); |
| 622 | omap_register_i2c_bus(3, 400, sdp4430_i2c_3_boardinfo, | 622 | omap_register_i2c_bus(3, 400, sdp4430_i2c_3_boardinfo, |
| 623 | ARRAY_SIZE(sdp4430_i2c_3_boardinfo)); | 623 | ARRAY_SIZE(sdp4430_i2c_3_boardinfo)); |
diff --git a/arch/arm/mach-omap2/board-generic.c b/arch/arm/mach-omap2/board-generic.c index 74e1687b5170..098d183a0086 100644 --- a/arch/arm/mach-omap2/board-generic.c +++ b/arch/arm/mach-omap2/board-generic.c | |||
| @@ -137,7 +137,7 @@ static struct twl4030_platform_data sdp4430_twldata = { | |||
| 137 | 137 | ||
| 138 | static void __init omap4_i2c_init(void) | 138 | static void __init omap4_i2c_init(void) |
| 139 | { | 139 | { |
| 140 | omap4_pmic_init("twl6030", &sdp4430_twldata); | 140 | omap4_pmic_init("twl6030", &sdp4430_twldata, NULL, 0); |
| 141 | } | 141 | } |
| 142 | 142 | ||
| 143 | static void __init omap4_init(void) | 143 | static void __init omap4_init(void) |
diff --git a/arch/arm/mach-omap2/board-omap4panda.c b/arch/arm/mach-omap2/board-omap4panda.c index d8c0e89f0126..1b782ba53433 100644 --- a/arch/arm/mach-omap2/board-omap4panda.c +++ b/arch/arm/mach-omap2/board-omap4panda.c | |||
| @@ -25,6 +25,7 @@ | |||
| 25 | #include <linux/gpio.h> | 25 | #include <linux/gpio.h> |
| 26 | #include <linux/usb/otg.h> | 26 | #include <linux/usb/otg.h> |
| 27 | #include <linux/i2c/twl.h> | 27 | #include <linux/i2c/twl.h> |
| 28 | #include <linux/mfd/twl6040.h> | ||
| 28 | #include <linux/regulator/machine.h> | 29 | #include <linux/regulator/machine.h> |
| 29 | #include <linux/regulator/fixed.h> | 30 | #include <linux/regulator/fixed.h> |
| 30 | #include <linux/wl12xx.h> | 31 | #include <linux/wl12xx.h> |
| @@ -284,7 +285,7 @@ static int __init omap4_twl6030_hsmmc_init(struct omap2_hsmmc_info *controllers) | |||
| 284 | return 0; | 285 | return 0; |
| 285 | } | 286 | } |
| 286 | 287 | ||
| 287 | static struct twl4030_codec_data twl6040_codec = { | 288 | static struct twl6040_codec_data twl6040_codec = { |
| 288 | /* single-step ramp for headset and handsfree */ | 289 | /* single-step ramp for headset and handsfree */ |
| 289 | .hs_left_step = 0x0f, | 290 | .hs_left_step = 0x0f, |
| 290 | .hs_right_step = 0x0f, | 291 | .hs_right_step = 0x0f, |
| @@ -292,17 +293,14 @@ static struct twl4030_codec_data twl6040_codec = { | |||
| 292 | .hf_right_step = 0x1d, | 293 | .hf_right_step = 0x1d, |
| 293 | }; | 294 | }; |
| 294 | 295 | ||
| 295 | static struct twl4030_audio_data twl6040_audio = { | 296 | static struct twl6040_platform_data twl6040_data = { |
| 296 | .codec = &twl6040_codec, | 297 | .codec = &twl6040_codec, |
| 297 | .audpwron_gpio = 127, | 298 | .audpwron_gpio = 127, |
| 298 | .naudint_irq = OMAP44XX_IRQ_SYS_2N, | ||
| 299 | .irq_base = TWL6040_CODEC_IRQ_BASE, | 299 | .irq_base = TWL6040_CODEC_IRQ_BASE, |
| 300 | }; | 300 | }; |
| 301 | 301 | ||
| 302 | /* Panda board uses the common PMIC configuration */ | 302 | /* Panda board uses the common PMIC configuration */ |
| 303 | static struct twl4030_platform_data omap4_panda_twldata = { | 303 | static struct twl4030_platform_data omap4_panda_twldata; |
| 304 | .audio = &twl6040_audio, | ||
| 305 | }; | ||
| 306 | 304 | ||
| 307 | /* | 305 | /* |
| 308 | * Display monitor features are burnt in their EEPROM as EDID data. The EEPROM | 306 | * Display monitor features are burnt in their EEPROM as EDID data. The EEPROM |
| @@ -326,7 +324,8 @@ static int __init omap4_panda_i2c_init(void) | |||
| 326 | TWL_COMMON_REGULATOR_VCXIO | | 324 | TWL_COMMON_REGULATOR_VCXIO | |
| 327 | TWL_COMMON_REGULATOR_VUSB | | 325 | TWL_COMMON_REGULATOR_VUSB | |
| 328 | TWL_COMMON_REGULATOR_CLK32KG); | 326 | TWL_COMMON_REGULATOR_CLK32KG); |
| 329 | omap4_pmic_init("twl6030", &omap4_panda_twldata); | 327 | omap4_pmic_init("twl6030", &omap4_panda_twldata, |
| 328 | &twl6040_data, OMAP44XX_IRQ_SYS_2N); | ||
| 330 | omap_register_i2c_bus(2, 400, NULL, 0); | 329 | omap_register_i2c_bus(2, 400, NULL, 0); |
| 331 | /* | 330 | /* |
| 332 | * Bus 3 is attached to the DVI port where devices like the pico DLP | 331 | * Bus 3 is attached to the DVI port where devices like the pico DLP |
diff --git a/arch/arm/mach-omap2/serial.c b/arch/arm/mach-omap2/serial.c index 0cdd359a128e..9fc2f44188cb 100644 --- a/arch/arm/mach-omap2/serial.c +++ b/arch/arm/mach-omap2/serial.c | |||
| @@ -108,8 +108,14 @@ static void omap_uart_set_noidle(struct platform_device *pdev) | |||
| 108 | static void omap_uart_set_smartidle(struct platform_device *pdev) | 108 | static void omap_uart_set_smartidle(struct platform_device *pdev) |
| 109 | { | 109 | { |
| 110 | struct omap_device *od = to_omap_device(pdev); | 110 | struct omap_device *od = to_omap_device(pdev); |
| 111 | u8 idlemode; | ||
| 111 | 112 | ||
| 112 | omap_hwmod_set_slave_idlemode(od->hwmods[0], HWMOD_IDLEMODE_SMART); | 113 | if (od->hwmods[0]->class->sysc->idlemodes & SIDLE_SMART_WKUP) |
| 114 | idlemode = HWMOD_IDLEMODE_SMART_WKUP; | ||
| 115 | else | ||
| 116 | idlemode = HWMOD_IDLEMODE_SMART; | ||
| 117 | |||
| 118 | omap_hwmod_set_slave_idlemode(od->hwmods[0], idlemode); | ||
| 113 | } | 119 | } |
| 114 | 120 | ||
| 115 | #else | 121 | #else |
| @@ -120,124 +126,8 @@ static void omap_uart_set_smartidle(struct platform_device *pdev) {} | |||
| 120 | #endif /* CONFIG_PM */ | 126 | #endif /* CONFIG_PM */ |
| 121 | 127 | ||
| 122 | #ifdef CONFIG_OMAP_MUX | 128 | #ifdef CONFIG_OMAP_MUX |
| 123 | static struct omap_device_pad default_uart1_pads[] __initdata = { | ||
| 124 | { | ||
| 125 | .name = "uart1_cts.uart1_cts", | ||
| 126 | .enable = OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0, | ||
| 127 | }, | ||
| 128 | { | ||
| 129 | .name = "uart1_rts.uart1_rts", | ||
| 130 | .enable = OMAP_PIN_OUTPUT | OMAP_MUX_MODE0, | ||
| 131 | }, | ||
| 132 | { | ||
| 133 | .name = "uart1_tx.uart1_tx", | ||
| 134 | .enable = OMAP_PIN_OUTPUT | OMAP_MUX_MODE0, | ||
| 135 | }, | ||
| 136 | { | ||
| 137 | .name = "uart1_rx.uart1_rx", | ||
| 138 | .flags = OMAP_DEVICE_PAD_REMUX | OMAP_DEVICE_PAD_WAKEUP, | ||
| 139 | .enable = OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0, | ||
| 140 | .idle = OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0, | ||
| 141 | }, | ||
| 142 | }; | ||
| 143 | |||
| 144 | static struct omap_device_pad default_uart2_pads[] __initdata = { | ||
| 145 | { | ||
| 146 | .name = "uart2_cts.uart2_cts", | ||
| 147 | .enable = OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0, | ||
| 148 | }, | ||
| 149 | { | ||
| 150 | .name = "uart2_rts.uart2_rts", | ||
| 151 | .enable = OMAP_PIN_OUTPUT | OMAP_MUX_MODE0, | ||
| 152 | }, | ||
| 153 | { | ||
| 154 | .name = "uart2_tx.uart2_tx", | ||
| 155 | .enable = OMAP_PIN_OUTPUT | OMAP_MUX_MODE0, | ||
| 156 | }, | ||
| 157 | { | ||
| 158 | .name = "uart2_rx.uart2_rx", | ||
| 159 | .flags = OMAP_DEVICE_PAD_REMUX | OMAP_DEVICE_PAD_WAKEUP, | ||
| 160 | .enable = OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0, | ||
| 161 | .idle = OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0, | ||
| 162 | }, | ||
| 163 | }; | ||
| 164 | |||
| 165 | static struct omap_device_pad default_uart3_pads[] __initdata = { | ||
| 166 | { | ||
| 167 | .name = "uart3_cts_rctx.uart3_cts_rctx", | ||
| 168 | .enable = OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0, | ||
| 169 | }, | ||
| 170 | { | ||
| 171 | .name = "uart3_rts_sd.uart3_rts_sd", | ||
| 172 | .enable = OMAP_PIN_OUTPUT | OMAP_MUX_MODE0, | ||
| 173 | }, | ||
| 174 | { | ||
| 175 | .name = "uart3_tx_irtx.uart3_tx_irtx", | ||
| 176 | .enable = OMAP_PIN_OUTPUT | OMAP_MUX_MODE0, | ||
| 177 | }, | ||
| 178 | { | ||
| 179 | .name = "uart3_rx_irrx.uart3_rx_irrx", | ||
| 180 | .flags = OMAP_DEVICE_PAD_REMUX | OMAP_DEVICE_PAD_WAKEUP, | ||
| 181 | .enable = OMAP_PIN_INPUT | OMAP_MUX_MODE0, | ||
| 182 | .idle = OMAP_PIN_INPUT | OMAP_MUX_MODE0, | ||
| 183 | }, | ||
| 184 | }; | ||
| 185 | |||
| 186 | static struct omap_device_pad default_omap36xx_uart4_pads[] __initdata = { | ||
| 187 | { | ||
| 188 | .name = "gpmc_wait2.uart4_tx", | ||
| 189 | .enable = OMAP_PIN_OUTPUT | OMAP_MUX_MODE0, | ||
| 190 | }, | ||
| 191 | { | ||
| 192 | .name = "gpmc_wait3.uart4_rx", | ||
| 193 | .flags = OMAP_DEVICE_PAD_REMUX | OMAP_DEVICE_PAD_WAKEUP, | ||
| 194 | .enable = OMAP_PIN_INPUT | OMAP_MUX_MODE2, | ||
| 195 | .idle = OMAP_PIN_INPUT | OMAP_MUX_MODE2, | ||
| 196 | }, | ||
| 197 | }; | ||
| 198 | |||
| 199 | static struct omap_device_pad default_omap4_uart4_pads[] __initdata = { | ||
| 200 | { | ||
| 201 | .name = "uart4_tx.uart4_tx", | ||
| 202 | .enable = OMAP_PIN_OUTPUT | OMAP_MUX_MODE0, | ||
| 203 | }, | ||
| 204 | { | ||
| 205 | .name = "uart4_rx.uart4_rx", | ||
| 206 | .flags = OMAP_DEVICE_PAD_REMUX | OMAP_DEVICE_PAD_WAKEUP, | ||
| 207 | .enable = OMAP_PIN_INPUT | OMAP_MUX_MODE0, | ||
| 208 | .idle = OMAP_PIN_INPUT | OMAP_MUX_MODE0, | ||
| 209 | }, | ||
| 210 | }; | ||
| 211 | |||
| 212 | static void omap_serial_fill_default_pads(struct omap_board_data *bdata) | 129 | static void omap_serial_fill_default_pads(struct omap_board_data *bdata) |
| 213 | { | 130 | { |
| 214 | switch (bdata->id) { | ||
| 215 | case 0: | ||
| 216 | bdata->pads = default_uart1_pads; | ||
| 217 | bdata->pads_cnt = ARRAY_SIZE(default_uart1_pads); | ||
| 218 | break; | ||
| 219 | case 1: | ||
| 220 | bdata->pads = default_uart2_pads; | ||
| 221 | bdata->pads_cnt = ARRAY_SIZE(default_uart2_pads); | ||
| 222 | break; | ||
| 223 | case 2: | ||
| 224 | bdata->pads = default_uart3_pads; | ||
| 225 | bdata->pads_cnt = ARRAY_SIZE(default_uart3_pads); | ||
| 226 | break; | ||
| 227 | case 3: | ||
| 228 | if (cpu_is_omap44xx()) { | ||
| 229 | bdata->pads = default_omap4_uart4_pads; | ||
| 230 | bdata->pads_cnt = | ||
| 231 | ARRAY_SIZE(default_omap4_uart4_pads); | ||
| 232 | } else if (cpu_is_omap3630()) { | ||
| 233 | bdata->pads = default_omap36xx_uart4_pads; | ||
| 234 | bdata->pads_cnt = | ||
| 235 | ARRAY_SIZE(default_omap36xx_uart4_pads); | ||
| 236 | } | ||
| 237 | break; | ||
| 238 | default: | ||
| 239 | break; | ||
| 240 | } | ||
| 241 | } | 131 | } |
| 242 | #else | 132 | #else |
| 243 | static void omap_serial_fill_default_pads(struct omap_board_data *bdata) {} | 133 | static void omap_serial_fill_default_pads(struct omap_board_data *bdata) {} |
diff --git a/arch/arm/mach-omap2/twl-common.c b/arch/arm/mach-omap2/twl-common.c index 4b57757bf9d1..7a7b89304c48 100644 --- a/arch/arm/mach-omap2/twl-common.c +++ b/arch/arm/mach-omap2/twl-common.c | |||
| @@ -37,6 +37,16 @@ static struct i2c_board_info __initdata pmic_i2c_board_info = { | |||
| 37 | .flags = I2C_CLIENT_WAKE, | 37 | .flags = I2C_CLIENT_WAKE, |
| 38 | }; | 38 | }; |
| 39 | 39 | ||
| 40 | static struct i2c_board_info __initdata omap4_i2c1_board_info[] = { | ||
| 41 | { | ||
| 42 | .addr = 0x48, | ||
| 43 | .flags = I2C_CLIENT_WAKE, | ||
| 44 | }, | ||
| 45 | { | ||
| 46 | I2C_BOARD_INFO("twl6040", 0x4b), | ||
| 47 | }, | ||
| 48 | }; | ||
| 49 | |||
| 40 | void __init omap_pmic_init(int bus, u32 clkrate, | 50 | void __init omap_pmic_init(int bus, u32 clkrate, |
| 41 | const char *pmic_type, int pmic_irq, | 51 | const char *pmic_type, int pmic_irq, |
| 42 | struct twl4030_platform_data *pmic_data) | 52 | struct twl4030_platform_data *pmic_data) |
| @@ -49,14 +59,31 @@ void __init omap_pmic_init(int bus, u32 clkrate, | |||
| 49 | omap_register_i2c_bus(bus, clkrate, &pmic_i2c_board_info, 1); | 59 | omap_register_i2c_bus(bus, clkrate, &pmic_i2c_board_info, 1); |
| 50 | } | 60 | } |
| 51 | 61 | ||
| 62 | void __init omap4_pmic_init(const char *pmic_type, | ||
| 63 | struct twl4030_platform_data *pmic_data, | ||
| 64 | struct twl6040_platform_data *twl6040_data, int twl6040_irq) | ||
| 65 | { | ||
| 66 | /* PMIC part*/ | ||
| 67 | strncpy(omap4_i2c1_board_info[0].type, pmic_type, | ||
| 68 | sizeof(omap4_i2c1_board_info[0].type)); | ||
| 69 | omap4_i2c1_board_info[0].irq = OMAP44XX_IRQ_SYS_1N; | ||
| 70 | omap4_i2c1_board_info[0].platform_data = pmic_data; | ||
| 71 | |||
| 72 | /* TWL6040 audio IC part */ | ||
| 73 | omap4_i2c1_board_info[1].irq = twl6040_irq; | ||
| 74 | omap4_i2c1_board_info[1].platform_data = twl6040_data; | ||
| 75 | |||
| 76 | omap_register_i2c_bus(1, 400, omap4_i2c1_board_info, 2); | ||
| 77 | |||
| 78 | } | ||
| 79 | |||
| 52 | void __init omap_pmic_late_init(void) | 80 | void __init omap_pmic_late_init(void) |
| 53 | { | 81 | { |
| 54 | /* Init the OMAP TWL parameters (if PMIC has been registerd) */ | 82 | /* Init the OMAP TWL parameters (if PMIC has been registerd) */ |
| 55 | if (!pmic_i2c_board_info.irq) | 83 | if (pmic_i2c_board_info.irq) |
| 56 | return; | 84 | omap3_twl_init(); |
| 57 | 85 | if (omap4_i2c1_board_info[0].irq) | |
| 58 | omap3_twl_init(); | 86 | omap4_twl_init(); |
| 59 | omap4_twl_init(); | ||
| 60 | } | 87 | } |
| 61 | 88 | ||
| 62 | #if defined(CONFIG_ARCH_OMAP3) | 89 | #if defined(CONFIG_ARCH_OMAP3) |
diff --git a/arch/arm/mach-omap2/twl-common.h b/arch/arm/mach-omap2/twl-common.h index 275dde8cb27a..09627483a57f 100644 --- a/arch/arm/mach-omap2/twl-common.h +++ b/arch/arm/mach-omap2/twl-common.h | |||
| @@ -29,6 +29,7 @@ | |||
| 29 | 29 | ||
| 30 | 30 | ||
| 31 | struct twl4030_platform_data; | 31 | struct twl4030_platform_data; |
| 32 | struct twl6040_platform_data; | ||
| 32 | 33 | ||
| 33 | void omap_pmic_init(int bus, u32 clkrate, const char *pmic_type, int pmic_irq, | 34 | void omap_pmic_init(int bus, u32 clkrate, const char *pmic_type, int pmic_irq, |
| 34 | struct twl4030_platform_data *pmic_data); | 35 | struct twl4030_platform_data *pmic_data); |
| @@ -46,12 +47,9 @@ static inline void omap3_pmic_init(const char *pmic_type, | |||
| 46 | omap_pmic_init(1, 2600, pmic_type, INT_34XX_SYS_NIRQ, pmic_data); | 47 | omap_pmic_init(1, 2600, pmic_type, INT_34XX_SYS_NIRQ, pmic_data); |
| 47 | } | 48 | } |
| 48 | 49 | ||
| 49 | static inline void omap4_pmic_init(const char *pmic_type, | 50 | void omap4_pmic_init(const char *pmic_type, |
| 50 | struct twl4030_platform_data *pmic_data) | 51 | struct twl4030_platform_data *pmic_data, |
| 51 | { | 52 | struct twl6040_platform_data *audio_data, int twl6040_irq); |
| 52 | /* Phoenix Audio IC needs I2C1 to start with 400 KHz or less */ | ||
| 53 | omap_pmic_init(1, 400, pmic_type, OMAP44XX_IRQ_SYS_1N, pmic_data); | ||
| 54 | } | ||
| 55 | 53 | ||
| 56 | void omap3_pmic_get_config(struct twl4030_platform_data *pmic_data, | 54 | void omap3_pmic_get_config(struct twl4030_platform_data *pmic_data, |
| 57 | u32 pdata_flags, u32 regulators_flags); | 55 | u32 pdata_flags, u32 regulators_flags); |
diff --git a/arch/arm/mach-pxa/include/mach/mfp-pxa2xx.h b/arch/arm/mach-pxa/include/mach/mfp-pxa2xx.h index c54cef25895c..cbf51ae81855 100644 --- a/arch/arm/mach-pxa/include/mach/mfp-pxa2xx.h +++ b/arch/arm/mach-pxa/include/mach/mfp-pxa2xx.h | |||
| @@ -17,6 +17,7 @@ | |||
| 17 | * | 17 | * |
| 18 | * bit 23 - Input/Output (PXA2xx specific) | 18 | * bit 23 - Input/Output (PXA2xx specific) |
| 19 | * bit 24 - Wakeup Enable(PXA2xx specific) | 19 | * bit 24 - Wakeup Enable(PXA2xx specific) |
| 20 | * bit 25 - Keep Output (PXA2xx specific) | ||
| 20 | */ | 21 | */ |
| 21 | 22 | ||
| 22 | #define MFP_DIR_IN (0x0 << 23) | 23 | #define MFP_DIR_IN (0x0 << 23) |
| @@ -25,6 +26,12 @@ | |||
| 25 | #define MFP_DIR(x) (((x) >> 23) & 0x1) | 26 | #define MFP_DIR(x) (((x) >> 23) & 0x1) |
| 26 | 27 | ||
| 27 | #define MFP_LPM_CAN_WAKEUP (0x1 << 24) | 28 | #define MFP_LPM_CAN_WAKEUP (0x1 << 24) |
| 29 | |||
| 30 | /* | ||
| 31 | * MFP_LPM_KEEP_OUTPUT must be specified for pins that need to | ||
| 32 | * retain their last output level (low or high). | ||
| 33 | * Note: MFP_LPM_KEEP_OUTPUT has no effect on pins configured for input. | ||
| 34 | */ | ||
| 28 | #define MFP_LPM_KEEP_OUTPUT (0x1 << 25) | 35 | #define MFP_LPM_KEEP_OUTPUT (0x1 << 25) |
| 29 | 36 | ||
| 30 | #define WAKEUP_ON_EDGE_RISE (MFP_LPM_CAN_WAKEUP | MFP_LPM_EDGE_RISE) | 37 | #define WAKEUP_ON_EDGE_RISE (MFP_LPM_CAN_WAKEUP | MFP_LPM_EDGE_RISE) |
diff --git a/arch/arm/mach-pxa/mfp-pxa2xx.c b/arch/arm/mach-pxa/mfp-pxa2xx.c index b0a842887780..ef0426a159d4 100644 --- a/arch/arm/mach-pxa/mfp-pxa2xx.c +++ b/arch/arm/mach-pxa/mfp-pxa2xx.c | |||
| @@ -33,6 +33,8 @@ | |||
| 33 | #define BANK_OFF(n) (((n) < 3) ? (n) << 2 : 0x100 + (((n) - 3) << 2)) | 33 | #define BANK_OFF(n) (((n) < 3) ? (n) << 2 : 0x100 + (((n) - 3) << 2)) |
| 34 | #define GPLR(x) __REG2(0x40E00000, BANK_OFF((x) >> 5)) | 34 | #define GPLR(x) __REG2(0x40E00000, BANK_OFF((x) >> 5)) |
| 35 | #define GPDR(x) __REG2(0x40E00000, BANK_OFF((x) >> 5) + 0x0c) | 35 | #define GPDR(x) __REG2(0x40E00000, BANK_OFF((x) >> 5) + 0x0c) |
| 36 | #define GPSR(x) __REG2(0x40E00000, BANK_OFF((x) >> 5) + 0x18) | ||
| 37 | #define GPCR(x) __REG2(0x40E00000, BANK_OFF((x) >> 5) + 0x24) | ||
| 36 | 38 | ||
| 37 | #define PWER_WE35 (1 << 24) | 39 | #define PWER_WE35 (1 << 24) |
| 38 | 40 | ||
| @@ -348,6 +350,7 @@ static inline void pxa27x_mfp_init(void) {} | |||
| 348 | #ifdef CONFIG_PM | 350 | #ifdef CONFIG_PM |
| 349 | static unsigned long saved_gafr[2][4]; | 351 | static unsigned long saved_gafr[2][4]; |
| 350 | static unsigned long saved_gpdr[4]; | 352 | static unsigned long saved_gpdr[4]; |
| 353 | static unsigned long saved_gplr[4]; | ||
| 351 | static unsigned long saved_pgsr[4]; | 354 | static unsigned long saved_pgsr[4]; |
| 352 | 355 | ||
| 353 | static int pxa2xx_mfp_suspend(void) | 356 | static int pxa2xx_mfp_suspend(void) |
| @@ -366,14 +369,26 @@ static int pxa2xx_mfp_suspend(void) | |||
| 366 | } | 369 | } |
| 367 | 370 | ||
| 368 | for (i = 0; i <= gpio_to_bank(pxa_last_gpio); i++) { | 371 | for (i = 0; i <= gpio_to_bank(pxa_last_gpio); i++) { |
| 369 | |||
| 370 | saved_gafr[0][i] = GAFR_L(i); | 372 | saved_gafr[0][i] = GAFR_L(i); |
| 371 | saved_gafr[1][i] = GAFR_U(i); | 373 | saved_gafr[1][i] = GAFR_U(i); |
| 372 | saved_gpdr[i] = GPDR(i * 32); | 374 | saved_gpdr[i] = GPDR(i * 32); |
| 375 | saved_gplr[i] = GPLR(i * 32); | ||
| 373 | saved_pgsr[i] = PGSR(i); | 376 | saved_pgsr[i] = PGSR(i); |
| 374 | 377 | ||
| 375 | GPDR(i * 32) = gpdr_lpm[i]; | 378 | GPSR(i * 32) = PGSR(i); |
| 379 | GPCR(i * 32) = ~PGSR(i); | ||
| 380 | } | ||
| 381 | |||
| 382 | /* set GPDR bits taking into account MFP_LPM_KEEP_OUTPUT */ | ||
| 383 | for (i = 0; i < pxa_last_gpio; i++) { | ||
| 384 | if ((gpdr_lpm[gpio_to_bank(i)] & GPIO_bit(i)) || | ||
| 385 | ((gpio_desc[i].config & MFP_LPM_KEEP_OUTPUT) && | ||
| 386 | (saved_gpdr[gpio_to_bank(i)] & GPIO_bit(i)))) | ||
| 387 | GPDR(i) |= GPIO_bit(i); | ||
| 388 | else | ||
| 389 | GPDR(i) &= ~GPIO_bit(i); | ||
| 376 | } | 390 | } |
| 391 | |||
| 377 | return 0; | 392 | return 0; |
| 378 | } | 393 | } |
| 379 | 394 | ||
| @@ -384,6 +399,8 @@ static void pxa2xx_mfp_resume(void) | |||
| 384 | for (i = 0; i <= gpio_to_bank(pxa_last_gpio); i++) { | 399 | for (i = 0; i <= gpio_to_bank(pxa_last_gpio); i++) { |
| 385 | GAFR_L(i) = saved_gafr[0][i]; | 400 | GAFR_L(i) = saved_gafr[0][i]; |
| 386 | GAFR_U(i) = saved_gafr[1][i]; | 401 | GAFR_U(i) = saved_gafr[1][i]; |
| 402 | GPSR(i * 32) = saved_gplr[i]; | ||
| 403 | GPCR(i * 32) = ~saved_gplr[i]; | ||
| 387 | GPDR(i * 32) = saved_gpdr[i]; | 404 | GPDR(i * 32) = saved_gpdr[i]; |
| 388 | PGSR(i) = saved_pgsr[i]; | 405 | PGSR(i) = saved_pgsr[i]; |
| 389 | } | 406 | } |
diff --git a/arch/arm/mach-pxa/pxa27x.c b/arch/arm/mach-pxa/pxa27x.c index 6bce78edce7a..4726c246dcdc 100644 --- a/arch/arm/mach-pxa/pxa27x.c +++ b/arch/arm/mach-pxa/pxa27x.c | |||
| @@ -421,8 +421,11 @@ void __init pxa27x_set_i2c_power_info(struct i2c_pxa_platform_data *info) | |||
| 421 | pxa_register_device(&pxa27x_device_i2c_power, info); | 421 | pxa_register_device(&pxa27x_device_i2c_power, info); |
| 422 | } | 422 | } |
| 423 | 423 | ||
| 424 | static struct pxa_gpio_platform_data pxa27x_gpio_info __initdata = { | ||
| 425 | .gpio_set_wake = gpio_set_wake, | ||
| 426 | }; | ||
| 427 | |||
| 424 | static struct platform_device *devices[] __initdata = { | 428 | static struct platform_device *devices[] __initdata = { |
| 425 | &pxa_device_gpio, | ||
| 426 | &pxa27x_device_udc, | 429 | &pxa27x_device_udc, |
| 427 | &pxa_device_pmu, | 430 | &pxa_device_pmu, |
| 428 | &pxa_device_i2s, | 431 | &pxa_device_i2s, |
| @@ -458,6 +461,7 @@ static int __init pxa27x_init(void) | |||
| 458 | register_syscore_ops(&pxa2xx_mfp_syscore_ops); | 461 | register_syscore_ops(&pxa2xx_mfp_syscore_ops); |
| 459 | register_syscore_ops(&pxa2xx_clock_syscore_ops); | 462 | register_syscore_ops(&pxa2xx_clock_syscore_ops); |
| 460 | 463 | ||
| 464 | pxa_register_device(&pxa_device_gpio, &pxa27x_gpio_info); | ||
| 461 | ret = platform_add_devices(devices, ARRAY_SIZE(devices)); | 465 | ret = platform_add_devices(devices, ARRAY_SIZE(devices)); |
| 462 | } | 466 | } |
| 463 | 467 | ||
diff --git a/arch/arm/mach-s3c24xx/Kconfig b/arch/arm/mach-s3c24xx/Kconfig index 0f3a327ebcaa..b34287ab5afd 100644 --- a/arch/arm/mach-s3c24xx/Kconfig +++ b/arch/arm/mach-s3c24xx/Kconfig | |||
| @@ -111,10 +111,6 @@ config S3C24XX_SETUP_TS | |||
| 111 | help | 111 | help |
| 112 | Compile in platform device definition for Samsung TouchScreen. | 112 | Compile in platform device definition for Samsung TouchScreen. |
| 113 | 113 | ||
| 114 | # cpu-specific sections | ||
| 115 | |||
| 116 | if CPU_S3C2410 | ||
| 117 | |||
| 118 | config S3C2410_DMA | 114 | config S3C2410_DMA |
| 119 | bool | 115 | bool |
| 120 | depends on S3C24XX_DMA && (CPU_S3C2410 || CPU_S3C2442) | 116 | depends on S3C24XX_DMA && (CPU_S3C2410 || CPU_S3C2442) |
| @@ -127,6 +123,10 @@ config S3C2410_PM | |||
| 127 | help | 123 | help |
| 128 | Power Management code common to S3C2410 and better | 124 | Power Management code common to S3C2410 and better |
| 129 | 125 | ||
| 126 | # cpu-specific sections | ||
| 127 | |||
| 128 | if CPU_S3C2410 | ||
| 129 | |||
| 130 | config S3C24XX_SIMTEC_NOR | 130 | config S3C24XX_SIMTEC_NOR |
| 131 | bool | 131 | bool |
| 132 | help | 132 | help |
diff --git a/arch/arm/mach-s5pv210/mach-goni.c b/arch/arm/mach-s5pv210/mach-goni.c index a8933de3d627..32395664e879 100644 --- a/arch/arm/mach-s5pv210/mach-goni.c +++ b/arch/arm/mach-s5pv210/mach-goni.c | |||
| @@ -25,6 +25,7 @@ | |||
| 25 | #include <linux/gpio_keys.h> | 25 | #include <linux/gpio_keys.h> |
| 26 | #include <linux/input.h> | 26 | #include <linux/input.h> |
| 27 | #include <linux/gpio.h> | 27 | #include <linux/gpio.h> |
| 28 | #include <linux/mmc/host.h> | ||
| 28 | #include <linux/interrupt.h> | 29 | #include <linux/interrupt.h> |
| 29 | 30 | ||
| 30 | #include <asm/hardware/vic.h> | 31 | #include <asm/hardware/vic.h> |
| @@ -765,6 +766,7 @@ static void __init goni_pmic_init(void) | |||
| 765 | /* MoviNAND */ | 766 | /* MoviNAND */ |
| 766 | static struct s3c_sdhci_platdata goni_hsmmc0_data __initdata = { | 767 | static struct s3c_sdhci_platdata goni_hsmmc0_data __initdata = { |
| 767 | .max_width = 4, | 768 | .max_width = 4, |
| 769 | .host_caps2 = MMC_CAP2_BROKEN_VOLTAGE, | ||
| 768 | .cd_type = S3C_SDHCI_CD_PERMANENT, | 770 | .cd_type = S3C_SDHCI_CD_PERMANENT, |
| 769 | }; | 771 | }; |
| 770 | 772 | ||
diff --git a/arch/arm/mach-sa1100/generic.c b/arch/arm/mach-sa1100/generic.c index 7c524b4e415d..16be4c56abe3 100644 --- a/arch/arm/mach-sa1100/generic.c +++ b/arch/arm/mach-sa1100/generic.c | |||
| @@ -306,7 +306,7 @@ void sa11x0_register_irda(struct irda_platform_data *irda) | |||
| 306 | } | 306 | } |
| 307 | 307 | ||
| 308 | static struct resource sa1100_rtc_resources[] = { | 308 | static struct resource sa1100_rtc_resources[] = { |
| 309 | DEFINE_RES_MEM(0x90010000, 0x9001003f), | 309 | DEFINE_RES_MEM(0x90010000, 0x40), |
| 310 | DEFINE_RES_IRQ_NAMED(IRQ_RTC1Hz, "rtc 1Hz"), | 310 | DEFINE_RES_IRQ_NAMED(IRQ_RTC1Hz, "rtc 1Hz"), |
| 311 | DEFINE_RES_IRQ_NAMED(IRQ_RTCAlrm, "rtc alarm"), | 311 | DEFINE_RES_IRQ_NAMED(IRQ_RTCAlrm, "rtc alarm"), |
| 312 | }; | 312 | }; |
diff --git a/arch/arm/mach-u300/core.c b/arch/arm/mach-u300/core.c index 1621ad07d284..33339745d432 100644 --- a/arch/arm/mach-u300/core.c +++ b/arch/arm/mach-u300/core.c | |||
| @@ -1667,8 +1667,10 @@ void __init u300_init_irq(void) | |||
| 1667 | 1667 | ||
| 1668 | for (i = 0; i < U300_VIC_IRQS_END; i++) | 1668 | for (i = 0; i < U300_VIC_IRQS_END; i++) |
| 1669 | set_bit(i, (unsigned long *) &mask[0]); | 1669 | set_bit(i, (unsigned long *) &mask[0]); |
| 1670 | vic_init((void __iomem *) U300_INTCON0_VBASE, 0, mask[0], mask[0]); | 1670 | vic_init((void __iomem *) U300_INTCON0_VBASE, IRQ_U300_INTCON0_START, |
| 1671 | vic_init((void __iomem *) U300_INTCON1_VBASE, 32, mask[1], mask[1]); | 1671 | mask[0], mask[0]); |
| 1672 | vic_init((void __iomem *) U300_INTCON1_VBASE, IRQ_U300_INTCON1_START, | ||
| 1673 | mask[1], mask[1]); | ||
| 1672 | } | 1674 | } |
| 1673 | 1675 | ||
| 1674 | 1676 | ||
diff --git a/arch/arm/mach-u300/i2c.c b/arch/arm/mach-u300/i2c.c index a38f80238ea9..cb04bd6ab3e7 100644 --- a/arch/arm/mach-u300/i2c.c +++ b/arch/arm/mach-u300/i2c.c | |||
| @@ -146,9 +146,6 @@ static struct ab3100_platform_data ab3100_plf_data = { | |||
| 146 | .min_uV = 1800000, | 146 | .min_uV = 1800000, |
| 147 | .max_uV = 1800000, | 147 | .max_uV = 1800000, |
| 148 | .valid_modes_mask = REGULATOR_MODE_NORMAL, | 148 | .valid_modes_mask = REGULATOR_MODE_NORMAL, |
| 149 | .valid_ops_mask = | ||
| 150 | REGULATOR_CHANGE_VOLTAGE | | ||
| 151 | REGULATOR_CHANGE_STATUS, | ||
| 152 | .always_on = 1, | 149 | .always_on = 1, |
| 153 | .boot_on = 1, | 150 | .boot_on = 1, |
| 154 | }, | 151 | }, |
| @@ -160,9 +157,6 @@ static struct ab3100_platform_data ab3100_plf_data = { | |||
| 160 | .min_uV = 2500000, | 157 | .min_uV = 2500000, |
| 161 | .max_uV = 2500000, | 158 | .max_uV = 2500000, |
| 162 | .valid_modes_mask = REGULATOR_MODE_NORMAL, | 159 | .valid_modes_mask = REGULATOR_MODE_NORMAL, |
| 163 | .valid_ops_mask = | ||
| 164 | REGULATOR_CHANGE_VOLTAGE | | ||
| 165 | REGULATOR_CHANGE_STATUS, | ||
| 166 | .always_on = 1, | 160 | .always_on = 1, |
| 167 | .boot_on = 1, | 161 | .boot_on = 1, |
| 168 | }, | 162 | }, |
| @@ -230,8 +224,7 @@ static struct ab3100_platform_data ab3100_plf_data = { | |||
| 230 | .max_uV = 1800000, | 224 | .max_uV = 1800000, |
| 231 | .valid_modes_mask = REGULATOR_MODE_NORMAL, | 225 | .valid_modes_mask = REGULATOR_MODE_NORMAL, |
| 232 | .valid_ops_mask = | 226 | .valid_ops_mask = |
| 233 | REGULATOR_CHANGE_VOLTAGE | | 227 | REGULATOR_CHANGE_VOLTAGE, |
| 234 | REGULATOR_CHANGE_STATUS, | ||
| 235 | .always_on = 1, | 228 | .always_on = 1, |
| 236 | .boot_on = 1, | 229 | .boot_on = 1, |
| 237 | }, | 230 | }, |
diff --git a/arch/arm/mach-u300/include/mach/irqs.h b/arch/arm/mach-u300/include/mach/irqs.h index ee78a26707eb..ec09c1e07b1a 100644 --- a/arch/arm/mach-u300/include/mach/irqs.h +++ b/arch/arm/mach-u300/include/mach/irqs.h | |||
| @@ -12,101 +12,101 @@ | |||
| 12 | #ifndef __MACH_IRQS_H | 12 | #ifndef __MACH_IRQS_H |
| 13 | #define __MACH_IRQS_H | 13 | #define __MACH_IRQS_H |
| 14 | 14 | ||
| 15 | #define IRQ_U300_INTCON0_START 0 | 15 | #define IRQ_U300_INTCON0_START 1 |
| 16 | #define IRQ_U300_INTCON1_START 32 | 16 | #define IRQ_U300_INTCON1_START 33 |
| 17 | /* These are on INTCON0 - 30 lines */ | 17 | /* These are on INTCON0 - 30 lines */ |
| 18 | #define IRQ_U300_IRQ0_EXT 0 | 18 | #define IRQ_U300_IRQ0_EXT 1 |
| 19 | #define IRQ_U300_IRQ1_EXT 1 | 19 | #define IRQ_U300_IRQ1_EXT 2 |
| 20 | #define IRQ_U300_DMA 2 | 20 | #define IRQ_U300_DMA 3 |
| 21 | #define IRQ_U300_VIDEO_ENC_0 3 | 21 | #define IRQ_U300_VIDEO_ENC_0 4 |
| 22 | #define IRQ_U300_VIDEO_ENC_1 4 | 22 | #define IRQ_U300_VIDEO_ENC_1 5 |
| 23 | #define IRQ_U300_AAIF_RX 5 | 23 | #define IRQ_U300_AAIF_RX 6 |
| 24 | #define IRQ_U300_AAIF_TX 6 | 24 | #define IRQ_U300_AAIF_TX 7 |
| 25 | #define IRQ_U300_AAIF_VGPIO 7 | 25 | #define IRQ_U300_AAIF_VGPIO 8 |
| 26 | #define IRQ_U300_AAIF_WAKEUP 8 | 26 | #define IRQ_U300_AAIF_WAKEUP 9 |
| 27 | #define IRQ_U300_PCM_I2S0_FRAME 9 | 27 | #define IRQ_U300_PCM_I2S0_FRAME 10 |
| 28 | #define IRQ_U300_PCM_I2S0_FIFO 10 | 28 | #define IRQ_U300_PCM_I2S0_FIFO 11 |
| 29 | #define IRQ_U300_PCM_I2S1_FRAME 11 | 29 | #define IRQ_U300_PCM_I2S1_FRAME 12 |
| 30 | #define IRQ_U300_PCM_I2S1_FIFO 12 | 30 | #define IRQ_U300_PCM_I2S1_FIFO 13 |
| 31 | #define IRQ_U300_XGAM_GAMCON 13 | 31 | #define IRQ_U300_XGAM_GAMCON 14 |
| 32 | #define IRQ_U300_XGAM_CDI 14 | 32 | #define IRQ_U300_XGAM_CDI 15 |
| 33 | #define IRQ_U300_XGAM_CDICON 15 | 33 | #define IRQ_U300_XGAM_CDICON 16 |
| 34 | #if defined(CONFIG_MACH_U300_BS2X) || defined(CONFIG_MACH_U300_BS330) | 34 | #if defined(CONFIG_MACH_U300_BS2X) || defined(CONFIG_MACH_U300_BS330) |
| 35 | /* MMIACC not used on the DB3210 or DB3350 chips */ | 35 | /* MMIACC not used on the DB3210 or DB3350 chips */ |
| 36 | #define IRQ_U300_XGAM_MMIACC 16 | 36 | #define IRQ_U300_XGAM_MMIACC 17 |
| 37 | #endif | 37 | #endif |
| 38 | #define IRQ_U300_XGAM_PDI 17 | 38 | #define IRQ_U300_XGAM_PDI 18 |
| 39 | #define IRQ_U300_XGAM_PDICON 18 | 39 | #define IRQ_U300_XGAM_PDICON 19 |
| 40 | #define IRQ_U300_XGAM_GAMEACC 19 | 40 | #define IRQ_U300_XGAM_GAMEACC 20 |
| 41 | #define IRQ_U300_XGAM_MCIDCT 20 | 41 | #define IRQ_U300_XGAM_MCIDCT 21 |
| 42 | #define IRQ_U300_APEX 21 | 42 | #define IRQ_U300_APEX 22 |
| 43 | #define IRQ_U300_UART0 22 | 43 | #define IRQ_U300_UART0 23 |
| 44 | #define IRQ_U300_SPI 23 | 44 | #define IRQ_U300_SPI 24 |
| 45 | #define IRQ_U300_TIMER_APP_OS 24 | 45 | #define IRQ_U300_TIMER_APP_OS 25 |
| 46 | #define IRQ_U300_TIMER_APP_DD 25 | 46 | #define IRQ_U300_TIMER_APP_DD 26 |
| 47 | #define IRQ_U300_TIMER_APP_GP1 26 | 47 | #define IRQ_U300_TIMER_APP_GP1 27 |
| 48 | #define IRQ_U300_TIMER_APP_GP2 27 | 48 | #define IRQ_U300_TIMER_APP_GP2 28 |
| 49 | #define IRQ_U300_TIMER_OS 28 | 49 | #define IRQ_U300_TIMER_OS 29 |
| 50 | #define IRQ_U300_TIMER_MS 29 | 50 | #define IRQ_U300_TIMER_MS 30 |
| 51 | #define IRQ_U300_KEYPAD_KEYBF 30 | 51 | #define IRQ_U300_KEYPAD_KEYBF 31 |
| 52 | #define IRQ_U300_KEYPAD_KEYBR 31 | 52 | #define IRQ_U300_KEYPAD_KEYBR 32 |
| 53 | /* These are on INTCON1 - 32 lines */ | 53 | /* These are on INTCON1 - 32 lines */ |
| 54 | #define IRQ_U300_GPIO_PORT0 32 | 54 | #define IRQ_U300_GPIO_PORT0 33 |
| 55 | #define IRQ_U300_GPIO_PORT1 33 | 55 | #define IRQ_U300_GPIO_PORT1 34 |
| 56 | #define IRQ_U300_GPIO_PORT2 34 | 56 | #define IRQ_U300_GPIO_PORT2 35 |
| 57 | 57 | ||
| 58 | #if defined(CONFIG_MACH_U300_BS2X) || defined(CONFIG_MACH_U300_BS330) || \ | 58 | #if defined(CONFIG_MACH_U300_BS2X) || defined(CONFIG_MACH_U300_BS330) || \ |
| 59 | defined(CONFIG_MACH_U300_BS335) | 59 | defined(CONFIG_MACH_U300_BS335) |
| 60 | /* These are for DB3150, DB3200 and DB3350 */ | 60 | /* These are for DB3150, DB3200 and DB3350 */ |
| 61 | #define IRQ_U300_WDOG 35 | 61 | #define IRQ_U300_WDOG 36 |
| 62 | #define IRQ_U300_EVHIST 36 | 62 | #define IRQ_U300_EVHIST 37 |
| 63 | #define IRQ_U300_MSPRO 37 | 63 | #define IRQ_U300_MSPRO 38 |
| 64 | #define IRQ_U300_MMCSD_MCIINTR0 38 | 64 | #define IRQ_U300_MMCSD_MCIINTR0 39 |
| 65 | #define IRQ_U300_MMCSD_MCIINTR1 39 | 65 | #define IRQ_U300_MMCSD_MCIINTR1 40 |
| 66 | #define IRQ_U300_I2C0 40 | 66 | #define IRQ_U300_I2C0 41 |
| 67 | #define IRQ_U300_I2C1 41 | 67 | #define IRQ_U300_I2C1 42 |
| 68 | #define IRQ_U300_RTC 42 | 68 | #define IRQ_U300_RTC 43 |
| 69 | #define IRQ_U300_NFIF 43 | 69 | #define IRQ_U300_NFIF 44 |
| 70 | #define IRQ_U300_NFIF2 44 | 70 | #define IRQ_U300_NFIF2 45 |
| 71 | #endif | 71 | #endif |
| 72 | 72 | ||
| 73 | /* DB3150 and DB3200 have only 45 IRQs */ | 73 | /* DB3150 and DB3200 have only 45 IRQs */ |
| 74 | #if defined(CONFIG_MACH_U300_BS2X) || defined(CONFIG_MACH_U300_BS330) | 74 | #if defined(CONFIG_MACH_U300_BS2X) || defined(CONFIG_MACH_U300_BS330) |
| 75 | #define U300_VIC_IRQS_END 45 | 75 | #define U300_VIC_IRQS_END 46 |
| 76 | #endif | 76 | #endif |
| 77 | 77 | ||
| 78 | /* The DB3350-specific interrupt lines */ | 78 | /* The DB3350-specific interrupt lines */ |
| 79 | #ifdef CONFIG_MACH_U300_BS335 | 79 | #ifdef CONFIG_MACH_U300_BS335 |
| 80 | #define IRQ_U300_ISP_F0 45 | 80 | #define IRQ_U300_ISP_F0 46 |
| 81 | #define IRQ_U300_ISP_F1 46 | 81 | #define IRQ_U300_ISP_F1 47 |
| 82 | #define IRQ_U300_ISP_F2 47 | 82 | #define IRQ_U300_ISP_F2 48 |
| 83 | #define IRQ_U300_ISP_F3 48 | 83 | #define IRQ_U300_ISP_F3 49 |
| 84 | #define IRQ_U300_ISP_F4 49 | 84 | #define IRQ_U300_ISP_F4 50 |
| 85 | #define IRQ_U300_GPIO_PORT3 50 | 85 | #define IRQ_U300_GPIO_PORT3 51 |
| 86 | #define IRQ_U300_SYSCON_PLL_LOCK 51 | 86 | #define IRQ_U300_SYSCON_PLL_LOCK 52 |
| 87 | #define IRQ_U300_UART1 52 | 87 | #define IRQ_U300_UART1 53 |
| 88 | #define IRQ_U300_GPIO_PORT4 53 | 88 | #define IRQ_U300_GPIO_PORT4 54 |
| 89 | #define IRQ_U300_GPIO_PORT5 54 | 89 | #define IRQ_U300_GPIO_PORT5 55 |
| 90 | #define IRQ_U300_GPIO_PORT6 55 | 90 | #define IRQ_U300_GPIO_PORT6 56 |
| 91 | #define U300_VIC_IRQS_END 56 | 91 | #define U300_VIC_IRQS_END 57 |
| 92 | #endif | 92 | #endif |
| 93 | 93 | ||
| 94 | /* The DB3210-specific interrupt lines */ | 94 | /* The DB3210-specific interrupt lines */ |
| 95 | #ifdef CONFIG_MACH_U300_BS365 | 95 | #ifdef CONFIG_MACH_U300_BS365 |
| 96 | #define IRQ_U300_GPIO_PORT3 35 | 96 | #define IRQ_U300_GPIO_PORT3 36 |
| 97 | #define IRQ_U300_GPIO_PORT4 36 | 97 | #define IRQ_U300_GPIO_PORT4 37 |
| 98 | #define IRQ_U300_WDOG 37 | 98 | #define IRQ_U300_WDOG 38 |
| 99 | #define IRQ_U300_EVHIST 38 | 99 | #define IRQ_U300_EVHIST 39 |
| 100 | #define IRQ_U300_MSPRO 39 | 100 | #define IRQ_U300_MSPRO 40 |
| 101 | #define IRQ_U300_MMCSD_MCIINTR0 40 | 101 | #define IRQ_U300_MMCSD_MCIINTR0 41 |
| 102 | #define IRQ_U300_MMCSD_MCIINTR1 41 | 102 | #define IRQ_U300_MMCSD_MCIINTR1 42 |
| 103 | #define IRQ_U300_I2C0 42 | 103 | #define IRQ_U300_I2C0 43 |
| 104 | #define IRQ_U300_I2C1 43 | 104 | #define IRQ_U300_I2C1 44 |
| 105 | #define IRQ_U300_RTC 44 | 105 | #define IRQ_U300_RTC 45 |
| 106 | #define IRQ_U300_NFIF 45 | 106 | #define IRQ_U300_NFIF 46 |
| 107 | #define IRQ_U300_NFIF2 46 | 107 | #define IRQ_U300_NFIF2 47 |
| 108 | #define IRQ_U300_SYSCON_PLL_LOCK 47 | 108 | #define IRQ_U300_SYSCON_PLL_LOCK 48 |
| 109 | #define U300_VIC_IRQS_END 48 | 109 | #define U300_VIC_IRQS_END 49 |
| 110 | #endif | 110 | #endif |
| 111 | 111 | ||
| 112 | /* Maximum 8*7 GPIO lines */ | 112 | /* Maximum 8*7 GPIO lines */ |
| @@ -117,6 +117,6 @@ | |||
| 117 | #define IRQ_U300_GPIO_END (U300_VIC_IRQS_END) | 117 | #define IRQ_U300_GPIO_END (U300_VIC_IRQS_END) |
| 118 | #endif | 118 | #endif |
| 119 | 119 | ||
| 120 | #define NR_IRQS (IRQ_U300_GPIO_END) | 120 | #define NR_IRQS (IRQ_U300_GPIO_END - IRQ_U300_INTCON0_START) |
| 121 | 121 | ||
| 122 | #endif | 122 | #endif |
diff --git a/arch/arm/mach-ux500/Kconfig b/arch/arm/mach-ux500/Kconfig index 880d02ec89d4..ef7099eea0f2 100644 --- a/arch/arm/mach-ux500/Kconfig +++ b/arch/arm/mach-ux500/Kconfig | |||
| @@ -17,6 +17,7 @@ config UX500_SOC_DB5500 | |||
| 17 | config UX500_SOC_DB8500 | 17 | config UX500_SOC_DB8500 |
| 18 | bool | 18 | bool |
| 19 | select MFD_DB8500_PRCMU | 19 | select MFD_DB8500_PRCMU |
| 20 | select REGULATOR | ||
| 20 | select REGULATOR_DB8500_PRCMU | 21 | select REGULATOR_DB8500_PRCMU |
| 21 | select CPU_FREQ_TABLE if CPU_FREQ | 22 | select CPU_FREQ_TABLE if CPU_FREQ |
| 22 | 23 | ||
diff --git a/arch/arm/mach-ux500/mbox-db5500.c b/arch/arm/mach-ux500/mbox-db5500.c index 2b2d51caf9d8..0127490218cd 100644 --- a/arch/arm/mach-ux500/mbox-db5500.c +++ b/arch/arm/mach-ux500/mbox-db5500.c | |||
| @@ -168,7 +168,7 @@ static ssize_t mbox_read_fifo(struct device *dev, | |||
| 168 | return sprintf(buf, "0x%X\n", mbox_value); | 168 | return sprintf(buf, "0x%X\n", mbox_value); |
| 169 | } | 169 | } |
| 170 | 170 | ||
| 171 | static DEVICE_ATTR(fifo, S_IWUGO | S_IRUGO, mbox_read_fifo, mbox_write_fifo); | 171 | static DEVICE_ATTR(fifo, S_IWUSR | S_IRUGO, mbox_read_fifo, mbox_write_fifo); |
| 172 | 172 | ||
| 173 | static int mbox_show(struct seq_file *s, void *data) | 173 | static int mbox_show(struct seq_file *s, void *data) |
| 174 | { | 174 | { |
diff --git a/arch/arm/mach-ux500/platsmp.c b/arch/arm/mach-ux500/platsmp.c index d2058ef8345f..eff5842f6232 100644 --- a/arch/arm/mach-ux500/platsmp.c +++ b/arch/arm/mach-ux500/platsmp.c | |||
| @@ -99,7 +99,7 @@ int __cpuinit boot_secondary(unsigned int cpu, struct task_struct *idle) | |||
| 99 | */ | 99 | */ |
| 100 | write_pen_release(cpu_logical_map(cpu)); | 100 | write_pen_release(cpu_logical_map(cpu)); |
| 101 | 101 | ||
| 102 | gic_raise_softirq(cpumask_of(cpu), 1); | 102 | smp_send_reschedule(cpu); |
| 103 | 103 | ||
| 104 | timeout = jiffies + (1 * HZ); | 104 | timeout = jiffies + (1 * HZ); |
| 105 | while (time_before(jiffies, timeout)) { | 105 | while (time_before(jiffies, timeout)) { |
diff --git a/arch/arm/mm/abort-ev6.S b/arch/arm/mm/abort-ev6.S index ff1f7cc11f87..80741992a9fc 100644 --- a/arch/arm/mm/abort-ev6.S +++ b/arch/arm/mm/abort-ev6.S | |||
| @@ -26,18 +26,23 @@ ENTRY(v6_early_abort) | |||
| 26 | mrc p15, 0, r1, c5, c0, 0 @ get FSR | 26 | mrc p15, 0, r1, c5, c0, 0 @ get FSR |
| 27 | mrc p15, 0, r0, c6, c0, 0 @ get FAR | 27 | mrc p15, 0, r0, c6, c0, 0 @ get FAR |
| 28 | /* | 28 | /* |
| 29 | * Faulty SWP instruction on 1136 doesn't set bit 11 in DFSR (erratum 326103). | 29 | * Faulty SWP instruction on 1136 doesn't set bit 11 in DFSR. |
| 30 | * The test below covers all the write situations, including Java bytecodes | ||
| 31 | */ | 30 | */ |
| 32 | bic r1, r1, #1 << 11 @ clear bit 11 of FSR | 31 | #ifdef CONFIG_ARM_ERRATA_326103 |
| 32 | ldr ip, =0x4107b36 | ||
| 33 | mrc p15, 0, r3, c0, c0, 0 @ get processor id | ||
| 34 | teq ip, r3, lsr #4 @ r0 ARM1136? | ||
| 35 | bne do_DataAbort | ||
| 33 | tst r5, #PSR_J_BIT @ Java? | 36 | tst r5, #PSR_J_BIT @ Java? |
| 37 | tsteq r5, #PSR_T_BIT @ Thumb? | ||
| 34 | bne do_DataAbort | 38 | bne do_DataAbort |
| 35 | do_thumb_abort fsr=r1, pc=r4, psr=r5, tmp=r3 | 39 | bic r1, r1, #1 << 11 @ clear bit 11 of FSR |
| 36 | ldreq r3, [r4] @ read aborted ARM instruction | 40 | ldr r3, [r4] @ read aborted ARM instruction |
| 37 | #ifdef CONFIG_CPU_ENDIAN_BE8 | 41 | #ifdef CONFIG_CPU_ENDIAN_BE8 |
| 38 | reveq r3, r3 | 42 | rev r3, r3 |
| 39 | #endif | 43 | #endif |
| 40 | do_ldrd_abort tmp=ip, insn=r3 | 44 | do_ldrd_abort tmp=ip, insn=r3 |
| 41 | tst r3, #1 << 20 @ L = 0 -> write | 45 | tst r3, #1 << 20 @ L = 0 -> write |
| 42 | orreq r1, r1, #1 << 11 @ yes. | 46 | orreq r1, r1, #1 << 11 @ yes. |
| 47 | #endif | ||
| 43 | b do_DataAbort | 48 | b do_DataAbort |
diff --git a/arch/arm/mm/cache-l2x0.c b/arch/arm/mm/cache-l2x0.c index a53fd2aaa2f4..2a8e380501e8 100644 --- a/arch/arm/mm/cache-l2x0.c +++ b/arch/arm/mm/cache-l2x0.c | |||
| @@ -32,6 +32,7 @@ static void __iomem *l2x0_base; | |||
| 32 | static DEFINE_RAW_SPINLOCK(l2x0_lock); | 32 | static DEFINE_RAW_SPINLOCK(l2x0_lock); |
| 33 | static u32 l2x0_way_mask; /* Bitmask of active ways */ | 33 | static u32 l2x0_way_mask; /* Bitmask of active ways */ |
| 34 | static u32 l2x0_size; | 34 | static u32 l2x0_size; |
| 35 | static unsigned long sync_reg_offset = L2X0_CACHE_SYNC; | ||
| 35 | 36 | ||
| 36 | struct l2x0_regs l2x0_saved_regs; | 37 | struct l2x0_regs l2x0_saved_regs; |
| 37 | 38 | ||
| @@ -61,12 +62,7 @@ static inline void cache_sync(void) | |||
| 61 | { | 62 | { |
| 62 | void __iomem *base = l2x0_base; | 63 | void __iomem *base = l2x0_base; |
| 63 | 64 | ||
| 64 | #ifdef CONFIG_PL310_ERRATA_753970 | 65 | writel_relaxed(0, base + sync_reg_offset); |
| 65 | /* write to an unmmapped register */ | ||
| 66 | writel_relaxed(0, base + L2X0_DUMMY_REG); | ||
| 67 | #else | ||
| 68 | writel_relaxed(0, base + L2X0_CACHE_SYNC); | ||
| 69 | #endif | ||
| 70 | cache_wait(base + L2X0_CACHE_SYNC, 1); | 66 | cache_wait(base + L2X0_CACHE_SYNC, 1); |
| 71 | } | 67 | } |
| 72 | 68 | ||
| @@ -85,10 +81,13 @@ static inline void l2x0_inv_line(unsigned long addr) | |||
| 85 | } | 81 | } |
| 86 | 82 | ||
| 87 | #if defined(CONFIG_PL310_ERRATA_588369) || defined(CONFIG_PL310_ERRATA_727915) | 83 | #if defined(CONFIG_PL310_ERRATA_588369) || defined(CONFIG_PL310_ERRATA_727915) |
| 84 | static inline void debug_writel(unsigned long val) | ||
| 85 | { | ||
| 86 | if (outer_cache.set_debug) | ||
| 87 | outer_cache.set_debug(val); | ||
| 88 | } | ||
| 88 | 89 | ||
| 89 | #define debug_writel(val) outer_cache.set_debug(val) | 90 | static void pl310_set_debug(unsigned long val) |
| 90 | |||
| 91 | static void l2x0_set_debug(unsigned long val) | ||
| 92 | { | 91 | { |
| 93 | writel_relaxed(val, l2x0_base + L2X0_DEBUG_CTRL); | 92 | writel_relaxed(val, l2x0_base + L2X0_DEBUG_CTRL); |
| 94 | } | 93 | } |
| @@ -98,7 +97,7 @@ static inline void debug_writel(unsigned long val) | |||
| 98 | { | 97 | { |
| 99 | } | 98 | } |
| 100 | 99 | ||
| 101 | #define l2x0_set_debug NULL | 100 | #define pl310_set_debug NULL |
| 102 | #endif | 101 | #endif |
| 103 | 102 | ||
| 104 | #ifdef CONFIG_PL310_ERRATA_588369 | 103 | #ifdef CONFIG_PL310_ERRATA_588369 |
| @@ -331,6 +330,11 @@ void __init l2x0_init(void __iomem *base, u32 aux_val, u32 aux_mask) | |||
| 331 | else | 330 | else |
| 332 | ways = 8; | 331 | ways = 8; |
| 333 | type = "L310"; | 332 | type = "L310"; |
| 333 | #ifdef CONFIG_PL310_ERRATA_753970 | ||
| 334 | /* Unmapped register. */ | ||
| 335 | sync_reg_offset = L2X0_DUMMY_REG; | ||
| 336 | #endif | ||
| 337 | outer_cache.set_debug = pl310_set_debug; | ||
| 334 | break; | 338 | break; |
| 335 | case L2X0_CACHE_ID_PART_L210: | 339 | case L2X0_CACHE_ID_PART_L210: |
| 336 | ways = (aux >> 13) & 0xf; | 340 | ways = (aux >> 13) & 0xf; |
| @@ -379,7 +383,6 @@ void __init l2x0_init(void __iomem *base, u32 aux_val, u32 aux_mask) | |||
| 379 | outer_cache.flush_all = l2x0_flush_all; | 383 | outer_cache.flush_all = l2x0_flush_all; |
| 380 | outer_cache.inv_all = l2x0_inv_all; | 384 | outer_cache.inv_all = l2x0_inv_all; |
| 381 | outer_cache.disable = l2x0_disable; | 385 | outer_cache.disable = l2x0_disable; |
| 382 | outer_cache.set_debug = l2x0_set_debug; | ||
| 383 | 386 | ||
| 384 | printk(KERN_INFO "%s cache controller enabled\n", type); | 387 | printk(KERN_INFO "%s cache controller enabled\n", type); |
| 385 | printk(KERN_INFO "l2x0: %d ways, CACHE_ID 0x%08x, AUX_CTRL 0x%08x, Cache size: %d B\n", | 388 | printk(KERN_INFO "l2x0: %d ways, CACHE_ID 0x%08x, AUX_CTRL 0x%08x, Cache size: %d B\n", |
diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c index 595079fa9d1d..8f5813bbffb5 100644 --- a/arch/arm/mm/init.c +++ b/arch/arm/mm/init.c | |||
| @@ -293,11 +293,11 @@ EXPORT_SYMBOL(pfn_valid); | |||
| 293 | #endif | 293 | #endif |
| 294 | 294 | ||
| 295 | #ifndef CONFIG_SPARSEMEM | 295 | #ifndef CONFIG_SPARSEMEM |
| 296 | static void arm_memory_present(void) | 296 | static void __init arm_memory_present(void) |
| 297 | { | 297 | { |
| 298 | } | 298 | } |
| 299 | #else | 299 | #else |
| 300 | static void arm_memory_present(void) | 300 | static void __init arm_memory_present(void) |
| 301 | { | 301 | { |
| 302 | struct memblock_region *reg; | 302 | struct memblock_region *reg; |
| 303 | 303 | ||
diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c index b86f8933ff91..2c7cf2f9c837 100644 --- a/arch/arm/mm/mmu.c +++ b/arch/arm/mm/mmu.c | |||
| @@ -618,8 +618,8 @@ static void __init alloc_init_section(pud_t *pud, unsigned long addr, | |||
| 618 | } | 618 | } |
| 619 | } | 619 | } |
| 620 | 620 | ||
| 621 | static void alloc_init_pud(pgd_t *pgd, unsigned long addr, unsigned long end, | 621 | static void __init alloc_init_pud(pgd_t *pgd, unsigned long addr, |
| 622 | unsigned long phys, const struct mem_type *type) | 622 | unsigned long end, unsigned long phys, const struct mem_type *type) |
| 623 | { | 623 | { |
| 624 | pud_t *pud = pud_offset(pgd, addr); | 624 | pud_t *pud = pud_offset(pgd, addr); |
| 625 | unsigned long next; | 625 | unsigned long next; |
diff --git a/arch/arm/plat-omap/dma.c b/arch/arm/plat-omap/dma.c index ecdb3da0dea9..c58d896cd5c3 100644 --- a/arch/arm/plat-omap/dma.c +++ b/arch/arm/plat-omap/dma.c | |||
| @@ -916,6 +916,13 @@ void omap_start_dma(int lch) | |||
| 916 | l |= OMAP_DMA_CCR_BUFFERING_DISABLE; | 916 | l |= OMAP_DMA_CCR_BUFFERING_DISABLE; |
| 917 | l |= OMAP_DMA_CCR_EN; | 917 | l |= OMAP_DMA_CCR_EN; |
| 918 | 918 | ||
| 919 | /* | ||
| 920 | * As dma_write() uses IO accessors which are weakly ordered, there | ||
| 921 | * is no guarantee that data in coherent DMA memory will be visible | ||
| 922 | * to the DMA device. Add a memory barrier here to ensure that any | ||
| 923 | * such data is visible prior to enabling DMA. | ||
| 924 | */ | ||
| 925 | mb(); | ||
| 919 | p->dma_write(l, CCR, lch); | 926 | p->dma_write(l, CCR, lch); |
| 920 | 927 | ||
| 921 | dma_chan[lch].flags |= OMAP_DMA_ACTIVE; | 928 | dma_chan[lch].flags |= OMAP_DMA_ACTIVE; |
| @@ -965,6 +972,13 @@ void omap_stop_dma(int lch) | |||
| 965 | p->dma_write(l, CCR, lch); | 972 | p->dma_write(l, CCR, lch); |
| 966 | } | 973 | } |
| 967 | 974 | ||
| 975 | /* | ||
| 976 | * Ensure that data transferred by DMA is visible to any access | ||
| 977 | * after DMA has been disabled. This is important for coherent | ||
| 978 | * DMA regions. | ||
| 979 | */ | ||
| 980 | mb(); | ||
| 981 | |||
| 968 | if (!omap_dma_in_1510_mode() && dma_chan[lch].next_lch != -1) { | 982 | if (!omap_dma_in_1510_mode() && dma_chan[lch].next_lch != -1) { |
| 969 | int next_lch, cur_lch = lch; | 983 | int next_lch, cur_lch = lch; |
| 970 | char dma_chan_link_map[dma_lch_count]; | 984 | char dma_chan_link_map[dma_lch_count]; |
diff --git a/arch/arm/plat-omap/sram.c b/arch/arm/plat-omap/sram.c index eec98afa0f83..f9a8c5341ee9 100644 --- a/arch/arm/plat-omap/sram.c +++ b/arch/arm/plat-omap/sram.c | |||
| @@ -348,7 +348,6 @@ u32 omap3_configure_core_dpll(u32 m2, u32 unlock_dll, u32 f, u32 inc, | |||
| 348 | sdrc_actim_ctrl_b_1, sdrc_mr_1); | 348 | sdrc_actim_ctrl_b_1, sdrc_mr_1); |
| 349 | } | 349 | } |
| 350 | 350 | ||
| 351 | #ifdef CONFIG_PM | ||
| 352 | void omap3_sram_restore_context(void) | 351 | void omap3_sram_restore_context(void) |
| 353 | { | 352 | { |
| 354 | omap_sram_ceil = omap_sram_base + omap_sram_size; | 353 | omap_sram_ceil = omap_sram_base + omap_sram_size; |
| @@ -358,17 +357,18 @@ void omap3_sram_restore_context(void) | |||
| 358 | omap3_sram_configure_core_dpll_sz); | 357 | omap3_sram_configure_core_dpll_sz); |
| 359 | omap_push_sram_idle(); | 358 | omap_push_sram_idle(); |
| 360 | } | 359 | } |
| 361 | #endif /* CONFIG_PM */ | ||
| 362 | |||
| 363 | #endif /* CONFIG_ARCH_OMAP3 */ | ||
| 364 | 360 | ||
| 365 | static inline int omap34xx_sram_init(void) | 361 | static inline int omap34xx_sram_init(void) |
| 366 | { | 362 | { |
| 367 | #if defined(CONFIG_ARCH_OMAP3) && defined(CONFIG_PM) | ||
| 368 | omap3_sram_restore_context(); | 363 | omap3_sram_restore_context(); |
| 369 | #endif | ||
| 370 | return 0; | 364 | return 0; |
| 371 | } | 365 | } |
| 366 | #else | ||
| 367 | static inline int omap34xx_sram_init(void) | ||
| 368 | { | ||
| 369 | return 0; | ||
| 370 | } | ||
| 371 | #endif /* CONFIG_ARCH_OMAP3 */ | ||
| 372 | 372 | ||
| 373 | static inline int am33xx_sram_init(void) | 373 | static inline int am33xx_sram_init(void) |
| 374 | { | 374 | { |
diff --git a/arch/arm/plat-samsung/include/plat/sdhci.h b/arch/arm/plat-samsung/include/plat/sdhci.h index 317e246ffc56..e834c5ef437c 100644 --- a/arch/arm/plat-samsung/include/plat/sdhci.h +++ b/arch/arm/plat-samsung/include/plat/sdhci.h | |||
| @@ -18,6 +18,8 @@ | |||
| 18 | #ifndef __PLAT_S3C_SDHCI_H | 18 | #ifndef __PLAT_S3C_SDHCI_H |
| 19 | #define __PLAT_S3C_SDHCI_H __FILE__ | 19 | #define __PLAT_S3C_SDHCI_H __FILE__ |
| 20 | 20 | ||
| 21 | #include <plat/devs.h> | ||
| 22 | |||
| 21 | struct platform_device; | 23 | struct platform_device; |
| 22 | struct mmc_host; | 24 | struct mmc_host; |
| 23 | struct mmc_card; | 25 | struct mmc_card; |
| @@ -356,4 +358,30 @@ static inline void exynos4_default_sdhci3(void) { } | |||
| 356 | 358 | ||
| 357 | #endif /* CONFIG_EXYNOS4_SETUP_SDHCI */ | 359 | #endif /* CONFIG_EXYNOS4_SETUP_SDHCI */ |
| 358 | 360 | ||
| 361 | static inline void s3c_sdhci_setname(int id, char *name) | ||
| 362 | { | ||
| 363 | switch (id) { | ||
| 364 | #ifdef CONFIG_S3C_DEV_HSMMC | ||
| 365 | case 0: | ||
| 366 | s3c_device_hsmmc0.name = name; | ||
| 367 | break; | ||
| 368 | #endif | ||
| 369 | #ifdef CONFIG_S3C_DEV_HSMMC1 | ||
| 370 | case 1: | ||
| 371 | s3c_device_hsmmc1.name = name; | ||
| 372 | break; | ||
| 373 | #endif | ||
| 374 | #ifdef CONFIG_S3C_DEV_HSMMC2 | ||
| 375 | case 2: | ||
| 376 | s3c_device_hsmmc2.name = name; | ||
| 377 | break; | ||
| 378 | #endif | ||
| 379 | #ifdef CONFIG_S3C_DEV_HSMMC3 | ||
| 380 | case 3: | ||
| 381 | s3c_device_hsmmc3.name = name; | ||
| 382 | break; | ||
| 383 | #endif | ||
| 384 | } | ||
| 385 | } | ||
| 386 | |||
| 359 | #endif /* __PLAT_S3C_SDHCI_H */ | 387 | #endif /* __PLAT_S3C_SDHCI_H */ |
diff --git a/arch/arm/vfp/vfpmodule.c b/arch/arm/vfp/vfpmodule.c index 858748eaa144..bc683b8219b5 100644 --- a/arch/arm/vfp/vfpmodule.c +++ b/arch/arm/vfp/vfpmodule.c | |||
| @@ -17,6 +17,8 @@ | |||
| 17 | #include <linux/sched.h> | 17 | #include <linux/sched.h> |
| 18 | #include <linux/smp.h> | 18 | #include <linux/smp.h> |
| 19 | #include <linux/init.h> | 19 | #include <linux/init.h> |
| 20 | #include <linux/uaccess.h> | ||
| 21 | #include <linux/user.h> | ||
| 20 | 22 | ||
| 21 | #include <asm/cp15.h> | 23 | #include <asm/cp15.h> |
| 22 | #include <asm/cputype.h> | 24 | #include <asm/cputype.h> |
| @@ -529,6 +531,103 @@ void vfp_flush_hwstate(struct thread_info *thread) | |||
| 529 | } | 531 | } |
| 530 | 532 | ||
| 531 | /* | 533 | /* |
| 534 | * Save the current VFP state into the provided structures and prepare | ||
| 535 | * for entry into a new function (signal handler). | ||
| 536 | */ | ||
| 537 | int vfp_preserve_user_clear_hwstate(struct user_vfp __user *ufp, | ||
| 538 | struct user_vfp_exc __user *ufp_exc) | ||
| 539 | { | ||
| 540 | struct thread_info *thread = current_thread_info(); | ||
| 541 | struct vfp_hard_struct *hwstate = &thread->vfpstate.hard; | ||
| 542 | int err = 0; | ||
| 543 | |||
| 544 | /* Ensure that the saved hwstate is up-to-date. */ | ||
| 545 | vfp_sync_hwstate(thread); | ||
| 546 | |||
| 547 | /* | ||
| 548 | * Copy the floating point registers. There can be unused | ||
| 549 | * registers see asm/hwcap.h for details. | ||
| 550 | */ | ||
| 551 | err |= __copy_to_user(&ufp->fpregs, &hwstate->fpregs, | ||
| 552 | sizeof(hwstate->fpregs)); | ||
| 553 | /* | ||
| 554 | * Copy the status and control register. | ||
| 555 | */ | ||
| 556 | __put_user_error(hwstate->fpscr, &ufp->fpscr, err); | ||
| 557 | |||
| 558 | /* | ||
| 559 | * Copy the exception registers. | ||
| 560 | */ | ||
| 561 | __put_user_error(hwstate->fpexc, &ufp_exc->fpexc, err); | ||
| 562 | __put_user_error(hwstate->fpinst, &ufp_exc->fpinst, err); | ||
| 563 | __put_user_error(hwstate->fpinst2, &ufp_exc->fpinst2, err); | ||
| 564 | |||
| 565 | if (err) | ||
| 566 | return -EFAULT; | ||
| 567 | |||
| 568 | /* Ensure that VFP is disabled. */ | ||
| 569 | vfp_flush_hwstate(thread); | ||
| 570 | |||
| 571 | /* | ||
| 572 | * As per the PCS, clear the length and stride bits for function | ||
| 573 | * entry. | ||
| 574 | */ | ||
| 575 | hwstate->fpscr &= ~(FPSCR_LENGTH_MASK | FPSCR_STRIDE_MASK); | ||
| 576 | |||
| 577 | /* | ||
| 578 | * Disable VFP in the hwstate so that we can detect if it gets | ||
| 579 | * used. | ||
| 580 | */ | ||
| 581 | hwstate->fpexc &= ~FPEXC_EN; | ||
| 582 | return 0; | ||
| 583 | } | ||
| 584 | |||
| 585 | /* Sanitise and restore the current VFP state from the provided structures. */ | ||
| 586 | int vfp_restore_user_hwstate(struct user_vfp __user *ufp, | ||
| 587 | struct user_vfp_exc __user *ufp_exc) | ||
| 588 | { | ||
| 589 | struct thread_info *thread = current_thread_info(); | ||
| 590 | struct vfp_hard_struct *hwstate = &thread->vfpstate.hard; | ||
| 591 | unsigned long fpexc; | ||
| 592 | int err = 0; | ||
| 593 | |||
| 594 | /* | ||
| 595 | * If VFP has been used, then disable it to avoid corrupting | ||
| 596 | * the new thread state. | ||
| 597 | */ | ||
| 598 | if (hwstate->fpexc & FPEXC_EN) | ||
| 599 | vfp_flush_hwstate(thread); | ||
| 600 | |||
| 601 | /* | ||
| 602 | * Copy the floating point registers. There can be unused | ||
| 603 | * registers see asm/hwcap.h for details. | ||
| 604 | */ | ||
| 605 | err |= __copy_from_user(&hwstate->fpregs, &ufp->fpregs, | ||
| 606 | sizeof(hwstate->fpregs)); | ||
| 607 | /* | ||
| 608 | * Copy the status and control register. | ||
| 609 | */ | ||
| 610 | __get_user_error(hwstate->fpscr, &ufp->fpscr, err); | ||
| 611 | |||
| 612 | /* | ||
| 613 | * Sanitise and restore the exception registers. | ||
| 614 | */ | ||
| 615 | __get_user_error(fpexc, &ufp_exc->fpexc, err); | ||
| 616 | |||
| 617 | /* Ensure the VFP is enabled. */ | ||
| 618 | fpexc |= FPEXC_EN; | ||
| 619 | |||
| 620 | /* Ensure FPINST2 is invalid and the exception flag is cleared. */ | ||
| 621 | fpexc &= ~(FPEXC_EX | FPEXC_FP2V); | ||
| 622 | hwstate->fpexc = fpexc; | ||
| 623 | |||
| 624 | __get_user_error(hwstate->fpinst, &ufp_exc->fpinst, err); | ||
| 625 | __get_user_error(hwstate->fpinst2, &ufp_exc->fpinst2, err); | ||
| 626 | |||
| 627 | return err ? -EFAULT : 0; | ||
| 628 | } | ||
| 629 | |||
| 630 | /* | ||
| 532 | * VFP hardware can lose all context when a CPU goes offline. | 631 | * VFP hardware can lose all context when a CPU goes offline. |
| 533 | * As we will be running in SMP mode with CPU hotplug, we will save the | 632 | * As we will be running in SMP mode with CPU hotplug, we will save the |
| 534 | * hardware state at every thread switch. We clear our held state when | 633 | * hardware state at every thread switch. We clear our held state when |
diff --git a/arch/blackfin/mach-bf538/boards/ezkit.c b/arch/blackfin/mach-bf538/boards/ezkit.c index 1633a6f306c0..85038f54354d 100644 --- a/arch/blackfin/mach-bf538/boards/ezkit.c +++ b/arch/blackfin/mach-bf538/boards/ezkit.c | |||
| @@ -38,7 +38,7 @@ static struct platform_device rtc_device = { | |||
| 38 | .name = "rtc-bfin", | 38 | .name = "rtc-bfin", |
| 39 | .id = -1, | 39 | .id = -1, |
| 40 | }; | 40 | }; |
| 41 | #endif | 41 | #endif /* CONFIG_RTC_DRV_BFIN */ |
| 42 | 42 | ||
| 43 | #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE) | 43 | #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE) |
| 44 | #ifdef CONFIG_SERIAL_BFIN_UART0 | 44 | #ifdef CONFIG_SERIAL_BFIN_UART0 |
| @@ -100,7 +100,7 @@ static struct platform_device bfin_uart0_device = { | |||
| 100 | .platform_data = &bfin_uart0_peripherals, /* Passed to driver */ | 100 | .platform_data = &bfin_uart0_peripherals, /* Passed to driver */ |
| 101 | }, | 101 | }, |
| 102 | }; | 102 | }; |
| 103 | #endif | 103 | #endif /* CONFIG_SERIAL_BFIN_UART0 */ |
| 104 | #ifdef CONFIG_SERIAL_BFIN_UART1 | 104 | #ifdef CONFIG_SERIAL_BFIN_UART1 |
| 105 | static struct resource bfin_uart1_resources[] = { | 105 | static struct resource bfin_uart1_resources[] = { |
| 106 | { | 106 | { |
| @@ -148,7 +148,7 @@ static struct platform_device bfin_uart1_device = { | |||
| 148 | .platform_data = &bfin_uart1_peripherals, /* Passed to driver */ | 148 | .platform_data = &bfin_uart1_peripherals, /* Passed to driver */ |
| 149 | }, | 149 | }, |
| 150 | }; | 150 | }; |
| 151 | #endif | 151 | #endif /* CONFIG_SERIAL_BFIN_UART1 */ |
| 152 | #ifdef CONFIG_SERIAL_BFIN_UART2 | 152 | #ifdef CONFIG_SERIAL_BFIN_UART2 |
| 153 | static struct resource bfin_uart2_resources[] = { | 153 | static struct resource bfin_uart2_resources[] = { |
| 154 | { | 154 | { |
| @@ -196,8 +196,8 @@ static struct platform_device bfin_uart2_device = { | |||
| 196 | .platform_data = &bfin_uart2_peripherals, /* Passed to driver */ | 196 | .platform_data = &bfin_uart2_peripherals, /* Passed to driver */ |
| 197 | }, | 197 | }, |
| 198 | }; | 198 | }; |
| 199 | #endif | 199 | #endif /* CONFIG_SERIAL_BFIN_UART2 */ |
| 200 | #endif | 200 | #endif /* CONFIG_SERIAL_BFIN */ |
| 201 | 201 | ||
| 202 | #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE) | 202 | #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE) |
| 203 | #ifdef CONFIG_BFIN_SIR0 | 203 | #ifdef CONFIG_BFIN_SIR0 |
| @@ -224,7 +224,7 @@ static struct platform_device bfin_sir0_device = { | |||
| 224 | .num_resources = ARRAY_SIZE(bfin_sir0_resources), | 224 | .num_resources = ARRAY_SIZE(bfin_sir0_resources), |
| 225 | .resource = bfin_sir0_resources, | 225 | .resource = bfin_sir0_resources, |
| 226 | }; | 226 | }; |
| 227 | #endif | 227 | #endif /* CONFIG_BFIN_SIR0 */ |
| 228 | #ifdef CONFIG_BFIN_SIR1 | 228 | #ifdef CONFIG_BFIN_SIR1 |
| 229 | static struct resource bfin_sir1_resources[] = { | 229 | static struct resource bfin_sir1_resources[] = { |
| 230 | { | 230 | { |
| @@ -249,7 +249,7 @@ static struct platform_device bfin_sir1_device = { | |||
| 249 | .num_resources = ARRAY_SIZE(bfin_sir1_resources), | 249 | .num_resources = ARRAY_SIZE(bfin_sir1_resources), |
| 250 | .resource = bfin_sir1_resources, | 250 | .resource = bfin_sir1_resources, |
| 251 | }; | 251 | }; |
| 252 | #endif | 252 | #endif /* CONFIG_BFIN_SIR1 */ |
| 253 | #ifdef CONFIG_BFIN_SIR2 | 253 | #ifdef CONFIG_BFIN_SIR2 |
| 254 | static struct resource bfin_sir2_resources[] = { | 254 | static struct resource bfin_sir2_resources[] = { |
| 255 | { | 255 | { |
| @@ -274,8 +274,8 @@ static struct platform_device bfin_sir2_device = { | |||
| 274 | .num_resources = ARRAY_SIZE(bfin_sir2_resources), | 274 | .num_resources = ARRAY_SIZE(bfin_sir2_resources), |
| 275 | .resource = bfin_sir2_resources, | 275 | .resource = bfin_sir2_resources, |
| 276 | }; | 276 | }; |
| 277 | #endif | 277 | #endif /* CONFIG_BFIN_SIR2 */ |
| 278 | #endif | 278 | #endif /* CONFIG_BFIN_SIR */ |
| 279 | 279 | ||
| 280 | #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE) | 280 | #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE) |
| 281 | #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART | 281 | #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART |
| @@ -311,7 +311,7 @@ static struct platform_device bfin_sport0_uart_device = { | |||
| 311 | .platform_data = &bfin_sport0_peripherals, /* Passed to driver */ | 311 | .platform_data = &bfin_sport0_peripherals, /* Passed to driver */ |
| 312 | }, | 312 | }, |
| 313 | }; | 313 | }; |
| 314 | #endif | 314 | #endif /* CONFIG_SERIAL_BFIN_SPORT0_UART */ |
| 315 | #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART | 315 | #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART |
| 316 | static struct resource bfin_sport1_uart_resources[] = { | 316 | static struct resource bfin_sport1_uart_resources[] = { |
| 317 | { | 317 | { |
| @@ -345,7 +345,7 @@ static struct platform_device bfin_sport1_uart_device = { | |||
| 345 | .platform_data = &bfin_sport1_peripherals, /* Passed to driver */ | 345 | .platform_data = &bfin_sport1_peripherals, /* Passed to driver */ |
| 346 | }, | 346 | }, |
| 347 | }; | 347 | }; |
| 348 | #endif | 348 | #endif /* CONFIG_SERIAL_BFIN_SPORT1_UART */ |
| 349 | #ifdef CONFIG_SERIAL_BFIN_SPORT2_UART | 349 | #ifdef CONFIG_SERIAL_BFIN_SPORT2_UART |
| 350 | static struct resource bfin_sport2_uart_resources[] = { | 350 | static struct resource bfin_sport2_uart_resources[] = { |
| 351 | { | 351 | { |
| @@ -379,7 +379,7 @@ static struct platform_device bfin_sport2_uart_device = { | |||
| 379 | .platform_data = &bfin_sport2_peripherals, /* Passed to driver */ | 379 | .platform_data = &bfin_sport2_peripherals, /* Passed to driver */ |
| 380 | }, | 380 | }, |
| 381 | }; | 381 | }; |
| 382 | #endif | 382 | #endif /* CONFIG_SERIAL_BFIN_SPORT2_UART */ |
| 383 | #ifdef CONFIG_SERIAL_BFIN_SPORT3_UART | 383 | #ifdef CONFIG_SERIAL_BFIN_SPORT3_UART |
| 384 | static struct resource bfin_sport3_uart_resources[] = { | 384 | static struct resource bfin_sport3_uart_resources[] = { |
| 385 | { | 385 | { |
| @@ -413,8 +413,8 @@ static struct platform_device bfin_sport3_uart_device = { | |||
| 413 | .platform_data = &bfin_sport3_peripherals, /* Passed to driver */ | 413 | .platform_data = &bfin_sport3_peripherals, /* Passed to driver */ |
| 414 | }, | 414 | }, |
| 415 | }; | 415 | }; |
| 416 | #endif | 416 | #endif /* CONFIG_SERIAL_BFIN_SPORT3_UART */ |
| 417 | #endif | 417 | #endif /* CONFIG_SERIAL_BFIN_SPORT */ |
| 418 | 418 | ||
| 419 | #if defined(CONFIG_CAN_BFIN) || defined(CONFIG_CAN_BFIN_MODULE) | 419 | #if defined(CONFIG_CAN_BFIN) || defined(CONFIG_CAN_BFIN_MODULE) |
| 420 | static unsigned short bfin_can_peripherals[] = { | 420 | static unsigned short bfin_can_peripherals[] = { |
| @@ -452,7 +452,7 @@ static struct platform_device bfin_can_device = { | |||
| 452 | .platform_data = &bfin_can_peripherals, /* Passed to driver */ | 452 | .platform_data = &bfin_can_peripherals, /* Passed to driver */ |
| 453 | }, | 453 | }, |
| 454 | }; | 454 | }; |
| 455 | #endif | 455 | #endif /* CONFIG_CAN_BFIN */ |
| 456 | 456 | ||
| 457 | /* | 457 | /* |
| 458 | * USB-LAN EzExtender board | 458 | * USB-LAN EzExtender board |
| @@ -488,7 +488,7 @@ static struct platform_device smc91x_device = { | |||
| 488 | .platform_data = &smc91x_info, | 488 | .platform_data = &smc91x_info, |
| 489 | }, | 489 | }, |
| 490 | }; | 490 | }; |
| 491 | #endif | 491 | #endif /* CONFIG_SMC91X */ |
| 492 | 492 | ||
| 493 | #if defined(CONFIG_SPI_BFIN5XX) || defined(CONFIG_SPI_BFIN5XX_MODULE) | 493 | #if defined(CONFIG_SPI_BFIN5XX) || defined(CONFIG_SPI_BFIN5XX_MODULE) |
| 494 | /* all SPI peripherals info goes here */ | 494 | /* all SPI peripherals info goes here */ |
| @@ -518,7 +518,8 @@ static struct flash_platform_data bfin_spi_flash_data = { | |||
| 518 | static struct bfin5xx_spi_chip spi_flash_chip_info = { | 518 | static struct bfin5xx_spi_chip spi_flash_chip_info = { |
| 519 | .enable_dma = 0, /* use dma transfer with this chip*/ | 519 | .enable_dma = 0, /* use dma transfer with this chip*/ |
| 520 | }; | 520 | }; |
| 521 | #endif | 521 | #endif /* CONFIG_MTD_M25P80 */ |
| 522 | #endif /* CONFIG_SPI_BFIN5XX */ | ||
| 522 | 523 | ||
| 523 | #if defined(CONFIG_TOUCHSCREEN_AD7879) || defined(CONFIG_TOUCHSCREEN_AD7879_MODULE) | 524 | #if defined(CONFIG_TOUCHSCREEN_AD7879) || defined(CONFIG_TOUCHSCREEN_AD7879_MODULE) |
| 524 | #include <linux/spi/ad7879.h> | 525 | #include <linux/spi/ad7879.h> |
| @@ -535,7 +536,7 @@ static const struct ad7879_platform_data bfin_ad7879_ts_info = { | |||
| 535 | .gpio_export = 1, /* Export GPIO to gpiolib */ | 536 | .gpio_export = 1, /* Export GPIO to gpiolib */ |
| 536 | .gpio_base = -1, /* Dynamic allocation */ | 537 | .gpio_base = -1, /* Dynamic allocation */ |
| 537 | }; | 538 | }; |
| 538 | #endif | 539 | #endif /* CONFIG_TOUCHSCREEN_AD7879 */ |
| 539 | 540 | ||
| 540 | #if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE) | 541 | #if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE) |
| 541 | #include <asm/bfin-lq035q1.h> | 542 | #include <asm/bfin-lq035q1.h> |
| @@ -564,7 +565,7 @@ static struct platform_device bfin_lq035q1_device = { | |||
| 564 | .platform_data = &bfin_lq035q1_data, | 565 | .platform_data = &bfin_lq035q1_data, |
| 565 | }, | 566 | }, |
| 566 | }; | 567 | }; |
| 567 | #endif | 568 | #endif /* CONFIG_FB_BFIN_LQ035Q1 */ |
| 568 | 569 | ||
| 569 | static struct spi_board_info bf538_spi_board_info[] __initdata = { | 570 | static struct spi_board_info bf538_spi_board_info[] __initdata = { |
| 570 | #if defined(CONFIG_MTD_M25P80) \ | 571 | #if defined(CONFIG_MTD_M25P80) \ |
| @@ -579,7 +580,7 @@ static struct spi_board_info bf538_spi_board_info[] __initdata = { | |||
| 579 | .controller_data = &spi_flash_chip_info, | 580 | .controller_data = &spi_flash_chip_info, |
| 580 | .mode = SPI_MODE_3, | 581 | .mode = SPI_MODE_3, |
| 581 | }, | 582 | }, |
| 582 | #endif | 583 | #endif /* CONFIG_MTD_M25P80 */ |
| 583 | #if defined(CONFIG_TOUCHSCREEN_AD7879_SPI) || defined(CONFIG_TOUCHSCREEN_AD7879_SPI_MODULE) | 584 | #if defined(CONFIG_TOUCHSCREEN_AD7879_SPI) || defined(CONFIG_TOUCHSCREEN_AD7879_SPI_MODULE) |
| 584 | { | 585 | { |
| 585 | .modalias = "ad7879", | 586 | .modalias = "ad7879", |
| @@ -590,7 +591,7 @@ static struct spi_board_info bf538_spi_board_info[] __initdata = { | |||
| 590 | .chip_select = 1, | 591 | .chip_select = 1, |
| 591 | .mode = SPI_CPHA | SPI_CPOL, | 592 | .mode = SPI_CPHA | SPI_CPOL, |
| 592 | }, | 593 | }, |
| 593 | #endif | 594 | #endif /* CONFIG_TOUCHSCREEN_AD7879_SPI */ |
| 594 | #if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE) | 595 | #if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE) |
| 595 | { | 596 | { |
| 596 | .modalias = "bfin-lq035q1-spi", | 597 | .modalias = "bfin-lq035q1-spi", |
| @@ -599,7 +600,7 @@ static struct spi_board_info bf538_spi_board_info[] __initdata = { | |||
| 599 | .chip_select = 2, | 600 | .chip_select = 2, |
| 600 | .mode = SPI_CPHA | SPI_CPOL, | 601 | .mode = SPI_CPHA | SPI_CPOL, |
| 601 | }, | 602 | }, |
| 602 | #endif | 603 | #endif /* CONFIG_FB_BFIN_LQ035Q1 */ |
| 603 | #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE) | 604 | #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE) |
| 604 | { | 605 | { |
| 605 | .modalias = "spidev", | 606 | .modalias = "spidev", |
| @@ -607,7 +608,7 @@ static struct spi_board_info bf538_spi_board_info[] __initdata = { | |||
| 607 | .bus_num = 0, | 608 | .bus_num = 0, |
| 608 | .chip_select = 1, | 609 | .chip_select = 1, |
| 609 | }, | 610 | }, |
| 610 | #endif | 611 | #endif /* CONFIG_SPI_SPIDEV */ |
| 611 | }; | 612 | }; |
| 612 | 613 | ||
| 613 | /* SPI (0) */ | 614 | /* SPI (0) */ |
| @@ -716,8 +717,6 @@ static struct platform_device bf538_spi_master2 = { | |||
| 716 | }, | 717 | }, |
| 717 | }; | 718 | }; |
| 718 | 719 | ||
| 719 | #endif /* spi master and devices */ | ||
| 720 | |||
| 721 | #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE) | 720 | #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE) |
| 722 | static struct resource bfin_twi0_resource[] = { | 721 | static struct resource bfin_twi0_resource[] = { |
| 723 | [0] = { | 722 | [0] = { |
| @@ -759,8 +758,8 @@ static struct platform_device i2c_bfin_twi1_device = { | |||
| 759 | .num_resources = ARRAY_SIZE(bfin_twi1_resource), | 758 | .num_resources = ARRAY_SIZE(bfin_twi1_resource), |
| 760 | .resource = bfin_twi1_resource, | 759 | .resource = bfin_twi1_resource, |
| 761 | }; | 760 | }; |
| 762 | #endif | 761 | #endif /* CONFIG_BF542 */ |
| 763 | #endif | 762 | #endif /* CONFIG_I2C_BLACKFIN_TWI */ |
| 764 | 763 | ||
| 765 | #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE) | 764 | #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE) |
| 766 | #include <linux/gpio_keys.h> | 765 | #include <linux/gpio_keys.h> |
diff --git a/arch/hexagon/kernel/dma.c b/arch/hexagon/kernel/dma.c index 37302218ca4a..0f2367cc5493 100644 --- a/arch/hexagon/kernel/dma.c +++ b/arch/hexagon/kernel/dma.c | |||
| @@ -22,6 +22,7 @@ | |||
| 22 | #include <linux/bootmem.h> | 22 | #include <linux/bootmem.h> |
| 23 | #include <linux/genalloc.h> | 23 | #include <linux/genalloc.h> |
| 24 | #include <asm/dma-mapping.h> | 24 | #include <asm/dma-mapping.h> |
| 25 | #include <linux/module.h> | ||
| 25 | 26 | ||
| 26 | struct dma_map_ops *dma_ops; | 27 | struct dma_map_ops *dma_ops; |
| 27 | EXPORT_SYMBOL(dma_ops); | 28 | EXPORT_SYMBOL(dma_ops); |
diff --git a/arch/hexagon/kernel/process.c b/arch/hexagon/kernel/process.c index 18c4f0b0f4ba..ff02821bfb7e 100644 --- a/arch/hexagon/kernel/process.c +++ b/arch/hexagon/kernel/process.c | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * Process creation support for Hexagon | 2 | * Process creation support for Hexagon |
| 3 | * | 3 | * |
| 4 | * Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved. | 4 | * Copyright (c) 2010-2012, Code Aurora Forum. All rights reserved. |
| 5 | * | 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify | 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License version 2 and | 7 | * it under the terms of the GNU General Public License version 2 and |
| @@ -88,7 +88,7 @@ void (*idle_sleep)(void) = default_idle; | |||
| 88 | void cpu_idle(void) | 88 | void cpu_idle(void) |
| 89 | { | 89 | { |
| 90 | while (1) { | 90 | while (1) { |
| 91 | tick_nohz_stop_sched_tick(1); | 91 | tick_nohz_idle_enter(); |
| 92 | local_irq_disable(); | 92 | local_irq_disable(); |
| 93 | while (!need_resched()) { | 93 | while (!need_resched()) { |
| 94 | idle_sleep(); | 94 | idle_sleep(); |
| @@ -97,7 +97,7 @@ void cpu_idle(void) | |||
| 97 | local_irq_disable(); | 97 | local_irq_disable(); |
| 98 | } | 98 | } |
| 99 | local_irq_enable(); | 99 | local_irq_enable(); |
| 100 | tick_nohz_restart_sched_tick(); | 100 | tick_nohz_idle_exit(); |
| 101 | schedule(); | 101 | schedule(); |
| 102 | } | 102 | } |
| 103 | } | 103 | } |
diff --git a/arch/hexagon/kernel/ptrace.c b/arch/hexagon/kernel/ptrace.c index 32342de1a79c..96c3b2c4dbad 100644 --- a/arch/hexagon/kernel/ptrace.c +++ b/arch/hexagon/kernel/ptrace.c | |||
| @@ -28,6 +28,7 @@ | |||
| 28 | #include <linux/ptrace.h> | 28 | #include <linux/ptrace.h> |
| 29 | #include <linux/regset.h> | 29 | #include <linux/regset.h> |
| 30 | #include <linux/user.h> | 30 | #include <linux/user.h> |
| 31 | #include <linux/elf.h> | ||
| 31 | 32 | ||
| 32 | #include <asm/user.h> | 33 | #include <asm/user.h> |
| 33 | 34 | ||
diff --git a/arch/hexagon/kernel/smp.c b/arch/hexagon/kernel/smp.c index 9b44a9e2d05a..1298141874a3 100644 --- a/arch/hexagon/kernel/smp.c +++ b/arch/hexagon/kernel/smp.c | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * SMP support for Hexagon | 2 | * SMP support for Hexagon |
| 3 | * | 3 | * |
| 4 | * Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved. | 4 | * Copyright (c) 2010-2012, Code Aurora Forum. All rights reserved. |
| 5 | * | 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify | 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License version 2 and | 7 | * it under the terms of the GNU General Public License version 2 and |
| @@ -28,6 +28,7 @@ | |||
| 28 | #include <linux/sched.h> | 28 | #include <linux/sched.h> |
| 29 | #include <linux/smp.h> | 29 | #include <linux/smp.h> |
| 30 | #include <linux/spinlock.h> | 30 | #include <linux/spinlock.h> |
| 31 | #include <linux/cpu.h> | ||
| 31 | 32 | ||
| 32 | #include <asm/time.h> /* timer_interrupt */ | 33 | #include <asm/time.h> /* timer_interrupt */ |
| 33 | #include <asm/hexagon_vm.h> | 34 | #include <asm/hexagon_vm.h> |
| @@ -177,7 +178,12 @@ void __cpuinit start_secondary(void) | |||
| 177 | 178 | ||
| 178 | printk(KERN_INFO "%s cpu %d\n", __func__, current_thread_info()->cpu); | 179 | printk(KERN_INFO "%s cpu %d\n", __func__, current_thread_info()->cpu); |
| 179 | 180 | ||
| 181 | notify_cpu_starting(cpu); | ||
| 182 | |||
| 183 | ipi_call_lock(); | ||
| 180 | set_cpu_online(cpu, true); | 184 | set_cpu_online(cpu, true); |
| 185 | ipi_call_unlock(); | ||
| 186 | |||
| 181 | local_irq_enable(); | 187 | local_irq_enable(); |
| 182 | 188 | ||
| 183 | cpu_idle(); | 189 | cpu_idle(); |
diff --git a/arch/hexagon/kernel/time.c b/arch/hexagon/kernel/time.c index 6bee15c9c113..5d9b33b67935 100644 --- a/arch/hexagon/kernel/time.c +++ b/arch/hexagon/kernel/time.c | |||
| @@ -28,6 +28,7 @@ | |||
| 28 | #include <linux/of.h> | 28 | #include <linux/of.h> |
| 29 | #include <linux/of_address.h> | 29 | #include <linux/of_address.h> |
| 30 | #include <linux/of_irq.h> | 30 | #include <linux/of_irq.h> |
| 31 | #include <linux/module.h> | ||
| 31 | 32 | ||
| 32 | #include <asm/timer-regs.h> | 33 | #include <asm/timer-regs.h> |
| 33 | #include <asm/hexagon_vm.h> | 34 | #include <asm/hexagon_vm.h> |
diff --git a/arch/hexagon/kernel/vdso.c b/arch/hexagon/kernel/vdso.c index f212a453b527..5d39f42f7085 100644 --- a/arch/hexagon/kernel/vdso.c +++ b/arch/hexagon/kernel/vdso.c | |||
| @@ -21,6 +21,7 @@ | |||
| 21 | #include <linux/err.h> | 21 | #include <linux/err.h> |
| 22 | #include <linux/mm.h> | 22 | #include <linux/mm.h> |
| 23 | #include <linux/vmalloc.h> | 23 | #include <linux/vmalloc.h> |
| 24 | #include <linux/binfmts.h> | ||
| 24 | 25 | ||
| 25 | #include <asm/vdso.h> | 26 | #include <asm/vdso.h> |
| 26 | 27 | ||
diff --git a/arch/ia64/include/asm/futex.h b/arch/ia64/include/asm/futex.h index 0ab82cc2dc8f..d2bf1fd5e44f 100644 --- a/arch/ia64/include/asm/futex.h +++ b/arch/ia64/include/asm/futex.h | |||
| @@ -106,15 +106,16 @@ futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr, | |||
| 106 | return -EFAULT; | 106 | return -EFAULT; |
| 107 | 107 | ||
| 108 | { | 108 | { |
| 109 | register unsigned long r8 __asm ("r8") = 0; | 109 | register unsigned long r8 __asm ("r8"); |
| 110 | unsigned long prev; | 110 | unsigned long prev; |
| 111 | __asm__ __volatile__( | 111 | __asm__ __volatile__( |
| 112 | " mf;; \n" | 112 | " mf;; \n" |
| 113 | " mov ar.ccv=%3;; \n" | 113 | " mov %0=r0 \n" |
| 114 | "[1:] cmpxchg4.acq %0=[%1],%2,ar.ccv \n" | 114 | " mov ar.ccv=%4;; \n" |
| 115 | "[1:] cmpxchg4.acq %1=[%2],%3,ar.ccv \n" | ||
| 115 | " .xdata4 \"__ex_table\", 1b-., 2f-. \n" | 116 | " .xdata4 \"__ex_table\", 1b-., 2f-. \n" |
| 116 | "[2:]" | 117 | "[2:]" |
| 117 | : "=r" (prev) | 118 | : "=r" (r8), "=r" (prev) |
| 118 | : "r" (uaddr), "r" (newval), | 119 | : "r" (uaddr), "r" (newval), |
| 119 | "rO" ((long) (unsigned) oldval) | 120 | "rO" ((long) (unsigned) oldval) |
| 120 | : "memory"); | 121 | : "memory"); |
diff --git a/arch/ia64/kernel/perfmon.c b/arch/ia64/kernel/perfmon.c index 9d0fd7d5bb82..f00ba025375d 100644 --- a/arch/ia64/kernel/perfmon.c +++ b/arch/ia64/kernel/perfmon.c | |||
| @@ -604,12 +604,6 @@ pfm_unprotect_ctx_ctxsw(pfm_context_t *x, unsigned long f) | |||
| 604 | spin_unlock(&(x)->ctx_lock); | 604 | spin_unlock(&(x)->ctx_lock); |
| 605 | } | 605 | } |
| 606 | 606 | ||
| 607 | static inline unsigned int | ||
| 608 | pfm_do_munmap(struct mm_struct *mm, unsigned long addr, size_t len, int acct) | ||
| 609 | { | ||
| 610 | return do_munmap(mm, addr, len); | ||
| 611 | } | ||
| 612 | |||
| 613 | static inline unsigned long | 607 | static inline unsigned long |
| 614 | pfm_get_unmapped_area(struct file *file, unsigned long addr, unsigned long len, unsigned long pgoff, unsigned long flags, unsigned long exec) | 608 | pfm_get_unmapped_area(struct file *file, unsigned long addr, unsigned long len, unsigned long pgoff, unsigned long flags, unsigned long exec) |
| 615 | { | 609 | { |
| @@ -1458,8 +1452,9 @@ pfm_unreserve_session(pfm_context_t *ctx, int is_syswide, unsigned int cpu) | |||
| 1458 | * a PROTECT_CTX() section. | 1452 | * a PROTECT_CTX() section. |
| 1459 | */ | 1453 | */ |
| 1460 | static int | 1454 | static int |
| 1461 | pfm_remove_smpl_mapping(struct task_struct *task, void *vaddr, unsigned long size) | 1455 | pfm_remove_smpl_mapping(void *vaddr, unsigned long size) |
| 1462 | { | 1456 | { |
| 1457 | struct task_struct *task = current; | ||
| 1463 | int r; | 1458 | int r; |
| 1464 | 1459 | ||
| 1465 | /* sanity checks */ | 1460 | /* sanity checks */ |
| @@ -1473,13 +1468,8 @@ pfm_remove_smpl_mapping(struct task_struct *task, void *vaddr, unsigned long siz | |||
| 1473 | /* | 1468 | /* |
| 1474 | * does the actual unmapping | 1469 | * does the actual unmapping |
| 1475 | */ | 1470 | */ |
| 1476 | down_write(&task->mm->mmap_sem); | 1471 | r = vm_munmap((unsigned long)vaddr, size); |
| 1477 | 1472 | ||
| 1478 | DPRINT(("down_write done smpl_vaddr=%p size=%lu\n", vaddr, size)); | ||
| 1479 | |||
| 1480 | r = pfm_do_munmap(task->mm, (unsigned long)vaddr, size, 0); | ||
| 1481 | |||
| 1482 | up_write(&task->mm->mmap_sem); | ||
| 1483 | if (r !=0) { | 1473 | if (r !=0) { |
| 1484 | printk(KERN_ERR "perfmon: [%d] unable to unmap sampling buffer @%p size=%lu\n", task_pid_nr(task), vaddr, size); | 1474 | printk(KERN_ERR "perfmon: [%d] unable to unmap sampling buffer @%p size=%lu\n", task_pid_nr(task), vaddr, size); |
| 1485 | } | 1475 | } |
| @@ -1945,7 +1935,7 @@ pfm_flush(struct file *filp, fl_owner_t id) | |||
| 1945 | * because some VM function reenables interrupts. | 1935 | * because some VM function reenables interrupts. |
| 1946 | * | 1936 | * |
| 1947 | */ | 1937 | */ |
| 1948 | if (smpl_buf_vaddr) pfm_remove_smpl_mapping(current, smpl_buf_vaddr, smpl_buf_size); | 1938 | if (smpl_buf_vaddr) pfm_remove_smpl_mapping(smpl_buf_vaddr, smpl_buf_size); |
| 1949 | 1939 | ||
| 1950 | return 0; | 1940 | return 0; |
| 1951 | } | 1941 | } |
diff --git a/arch/m68k/configs/m5275evb_defconfig b/arch/m68k/configs/m5275evb_defconfig index 33c32aeca12b..a1230e82bb1e 100644 --- a/arch/m68k/configs/m5275evb_defconfig +++ b/arch/m68k/configs/m5275evb_defconfig | |||
| @@ -49,7 +49,6 @@ CONFIG_BLK_DEV_RAM=y | |||
| 49 | CONFIG_NETDEVICES=y | 49 | CONFIG_NETDEVICES=y |
| 50 | CONFIG_NET_ETHERNET=y | 50 | CONFIG_NET_ETHERNET=y |
| 51 | CONFIG_FEC=y | 51 | CONFIG_FEC=y |
| 52 | CONFIG_FEC2=y | ||
| 53 | # CONFIG_NETDEV_1000 is not set | 52 | # CONFIG_NETDEV_1000 is not set |
| 54 | # CONFIG_NETDEV_10000 is not set | 53 | # CONFIG_NETDEV_10000 is not set |
| 55 | CONFIG_PPP=y | 54 | CONFIG_PPP=y |
diff --git a/arch/m68k/platform/527x/config.c b/arch/m68k/platform/527x/config.c index 7ed848c3b848..f91a53294c35 100644 --- a/arch/m68k/platform/527x/config.c +++ b/arch/m68k/platform/527x/config.c | |||
| @@ -74,9 +74,7 @@ static void __init m527x_fec_init(void) | |||
| 74 | writew(par | 0xf00, MCF_IPSBAR + 0x100082); | 74 | writew(par | 0xf00, MCF_IPSBAR + 0x100082); |
| 75 | v = readb(MCF_IPSBAR + 0x100078); | 75 | v = readb(MCF_IPSBAR + 0x100078); |
| 76 | writeb(v | 0xc0, MCF_IPSBAR + 0x100078); | 76 | writeb(v | 0xc0, MCF_IPSBAR + 0x100078); |
| 77 | #endif | ||
| 78 | 77 | ||
| 79 | #ifdef CONFIG_FEC2 | ||
| 80 | /* Set multi-function pins to ethernet mode for fec1 */ | 78 | /* Set multi-function pins to ethernet mode for fec1 */ |
| 81 | par = readw(MCF_IPSBAR + 0x100082); | 79 | par = readw(MCF_IPSBAR + 0x100082); |
| 82 | writew(par | 0xa0, MCF_IPSBAR + 0x100082); | 80 | writew(par | 0xa0, MCF_IPSBAR + 0x100082); |
diff --git a/arch/m68k/platform/68EZ328/Makefile b/arch/m68k/platform/68EZ328/Makefile index ee97735a242c..b44d799b1115 100644 --- a/arch/m68k/platform/68EZ328/Makefile +++ b/arch/m68k/platform/68EZ328/Makefile | |||
| @@ -3,9 +3,3 @@ | |||
| 3 | # | 3 | # |
| 4 | 4 | ||
| 5 | obj-y := config.o | 5 | obj-y := config.o |
| 6 | |||
| 7 | extra-y := bootlogo.rh | ||
| 8 | |||
| 9 | $(obj)/bootlogo.rh: $(src)/bootlogo.h | ||
| 10 | perl $(src)/../68328/bootlogo.pl < $(src)/bootlogo.h \ | ||
| 11 | > $(obj)/bootlogo.rh | ||
diff --git a/arch/m68k/platform/68VZ328/Makefile b/arch/m68k/platform/68VZ328/Makefile index 447ffa0fd7c7..a49d75e65489 100644 --- a/arch/m68k/platform/68VZ328/Makefile +++ b/arch/m68k/platform/68VZ328/Makefile | |||
| @@ -3,14 +3,9 @@ | |||
| 3 | # | 3 | # |
| 4 | 4 | ||
| 5 | obj-y := config.o | 5 | obj-y := config.o |
| 6 | logo-$(UCDIMM) := bootlogo.rh | 6 | extra-$(DRAGEN2):= screen.h |
| 7 | logo-$(DRAGEN2) := screen.h | ||
| 8 | extra-y := $(logo-y) | ||
| 9 | |||
| 10 | $(obj)/bootlogo.rh: $(src)/../68EZ328/bootlogo.h | ||
| 11 | perl $(src)/bootlogo.pl < $(src)/../68328/bootlogo.h > $(obj)/bootlogo.rh | ||
| 12 | 7 | ||
| 13 | $(obj)/screen.h: $(src)/screen.xbm $(src)/xbm2lcd.pl | 8 | $(obj)/screen.h: $(src)/screen.xbm $(src)/xbm2lcd.pl |
| 14 | perl $(src)/xbm2lcd.pl < $(src)/screen.xbm > $(obj)/screen.h | 9 | perl $(src)/xbm2lcd.pl < $(src)/screen.xbm > $(obj)/screen.h |
| 15 | 10 | ||
| 16 | clean-files := $(obj)/screen.h $(obj)/bootlogo.rh | 11 | clean-files := $(obj)/screen.h |
diff --git a/arch/m68k/platform/68EZ328/bootlogo.h b/arch/m68k/platform/68VZ328/bootlogo.h index e842bdae5839..b38e2b255142 100644 --- a/arch/m68k/platform/68EZ328/bootlogo.h +++ b/arch/m68k/platform/68VZ328/bootlogo.h | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | #define splash_width 640 | 1 | #define splash_width 640 |
| 2 | #define splash_height 480 | 2 | #define splash_height 480 |
| 3 | static unsigned char splash_bits[] = { | 3 | unsigned char __attribute__ ((aligned(16))) bootlogo_bits[] = { |
| 4 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 4 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 5 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 5 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 6 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 6 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
diff --git a/arch/m68k/platform/coldfire/device.c b/arch/m68k/platform/coldfire/device.c index fa50c48292ff..7af97362b95c 100644 --- a/arch/m68k/platform/coldfire/device.c +++ b/arch/m68k/platform/coldfire/device.c | |||
| @@ -114,7 +114,7 @@ static struct resource mcf_fec1_resources[] = { | |||
| 114 | 114 | ||
| 115 | static struct platform_device mcf_fec1 = { | 115 | static struct platform_device mcf_fec1 = { |
| 116 | .name = "fec", | 116 | .name = "fec", |
| 117 | .id = 0, | 117 | .id = 1, |
| 118 | .num_resources = ARRAY_SIZE(mcf_fec1_resources), | 118 | .num_resources = ARRAY_SIZE(mcf_fec1_resources), |
| 119 | .resource = mcf_fec1_resources, | 119 | .resource = mcf_fec1_resources, |
| 120 | }; | 120 | }; |
diff --git a/arch/mips/ath79/dev-wmac.c b/arch/mips/ath79/dev-wmac.c index e21507052066..9c717bf98ffe 100644 --- a/arch/mips/ath79/dev-wmac.c +++ b/arch/mips/ath79/dev-wmac.c | |||
| @@ -58,8 +58,8 @@ static void __init ar913x_wmac_setup(void) | |||
| 58 | 58 | ||
| 59 | static int ar933x_wmac_reset(void) | 59 | static int ar933x_wmac_reset(void) |
| 60 | { | 60 | { |
| 61 | ath79_device_reset_clear(AR933X_RESET_WMAC); | ||
| 62 | ath79_device_reset_set(AR933X_RESET_WMAC); | 61 | ath79_device_reset_set(AR933X_RESET_WMAC); |
| 62 | ath79_device_reset_clear(AR933X_RESET_WMAC); | ||
| 63 | 63 | ||
| 64 | return 0; | 64 | return 0; |
| 65 | } | 65 | } |
diff --git a/arch/mips/include/asm/mach-jz4740/irq.h b/arch/mips/include/asm/mach-jz4740/irq.h index a865c983c70a..5ad1a9c113c6 100644 --- a/arch/mips/include/asm/mach-jz4740/irq.h +++ b/arch/mips/include/asm/mach-jz4740/irq.h | |||
| @@ -45,7 +45,7 @@ | |||
| 45 | #define JZ4740_IRQ_LCD JZ4740_IRQ(30) | 45 | #define JZ4740_IRQ_LCD JZ4740_IRQ(30) |
| 46 | 46 | ||
| 47 | /* 2nd-level interrupts */ | 47 | /* 2nd-level interrupts */ |
| 48 | #define JZ4740_IRQ_DMA(x) (JZ4740_IRQ(32) + (X)) | 48 | #define JZ4740_IRQ_DMA(x) (JZ4740_IRQ(32) + (x)) |
| 49 | 49 | ||
| 50 | #define JZ4740_IRQ_INTC_GPIO(x) (JZ4740_IRQ_GPIO0 - (x)) | 50 | #define JZ4740_IRQ_INTC_GPIO(x) (JZ4740_IRQ_GPIO0 - (x)) |
| 51 | #define JZ4740_IRQ_GPIO(x) (JZ4740_IRQ(48) + (x)) | 51 | #define JZ4740_IRQ_GPIO(x) (JZ4740_IRQ(48) + (x)) |
diff --git a/arch/mips/include/asm/mmu_context.h b/arch/mips/include/asm/mmu_context.h index 73c0d45798de..9b02cfba7449 100644 --- a/arch/mips/include/asm/mmu_context.h +++ b/arch/mips/include/asm/mmu_context.h | |||
| @@ -37,12 +37,6 @@ extern void tlbmiss_handler_setup_pgd(unsigned long pgd); | |||
| 37 | write_c0_xcontext((unsigned long) smp_processor_id() << 51); \ | 37 | write_c0_xcontext((unsigned long) smp_processor_id() << 51); \ |
| 38 | } while (0) | 38 | } while (0) |
| 39 | 39 | ||
| 40 | |||
| 41 | static inline unsigned long get_current_pgd(void) | ||
| 42 | { | ||
| 43 | return PHYS_TO_XKSEG_CACHED((read_c0_context() >> 11) & ~0xfffUL); | ||
| 44 | } | ||
| 45 | |||
| 46 | #else /* CONFIG_MIPS_PGD_C0_CONTEXT: using pgd_current*/ | 40 | #else /* CONFIG_MIPS_PGD_C0_CONTEXT: using pgd_current*/ |
| 47 | 41 | ||
| 48 | /* | 42 | /* |
diff --git a/arch/mips/kernel/signal.c b/arch/mips/kernel/signal.c index 185ca00c4c84..d5a338a1739c 100644 --- a/arch/mips/kernel/signal.c +++ b/arch/mips/kernel/signal.c | |||
| @@ -257,11 +257,8 @@ asmlinkage int sys_sigsuspend(nabi_no_regargs struct pt_regs regs) | |||
| 257 | return -EFAULT; | 257 | return -EFAULT; |
| 258 | sigdelsetmask(&newset, ~_BLOCKABLE); | 258 | sigdelsetmask(&newset, ~_BLOCKABLE); |
| 259 | 259 | ||
| 260 | spin_lock_irq(¤t->sighand->siglock); | ||
| 261 | current->saved_sigmask = current->blocked; | 260 | current->saved_sigmask = current->blocked; |
| 262 | current->blocked = newset; | 261 | set_current_blocked(&newset); |
| 263 | recalc_sigpending(); | ||
| 264 | spin_unlock_irq(¤t->sighand->siglock); | ||
| 265 | 262 | ||
| 266 | current->state = TASK_INTERRUPTIBLE; | 263 | current->state = TASK_INTERRUPTIBLE; |
| 267 | schedule(); | 264 | schedule(); |
| @@ -286,11 +283,8 @@ asmlinkage int sys_rt_sigsuspend(nabi_no_regargs struct pt_regs regs) | |||
| 286 | return -EFAULT; | 283 | return -EFAULT; |
| 287 | sigdelsetmask(&newset, ~_BLOCKABLE); | 284 | sigdelsetmask(&newset, ~_BLOCKABLE); |
| 288 | 285 | ||
| 289 | spin_lock_irq(¤t->sighand->siglock); | ||
| 290 | current->saved_sigmask = current->blocked; | 286 | current->saved_sigmask = current->blocked; |
| 291 | current->blocked = newset; | 287 | set_current_blocked(&newset); |
| 292 | recalc_sigpending(); | ||
| 293 | spin_unlock_irq(¤t->sighand->siglock); | ||
| 294 | 288 | ||
| 295 | current->state = TASK_INTERRUPTIBLE; | 289 | current->state = TASK_INTERRUPTIBLE; |
| 296 | schedule(); | 290 | schedule(); |
| @@ -362,10 +356,7 @@ asmlinkage void sys_sigreturn(nabi_no_regargs struct pt_regs regs) | |||
| 362 | goto badframe; | 356 | goto badframe; |
| 363 | 357 | ||
| 364 | sigdelsetmask(&blocked, ~_BLOCKABLE); | 358 | sigdelsetmask(&blocked, ~_BLOCKABLE); |
| 365 | spin_lock_irq(¤t->sighand->siglock); | 359 | set_current_blocked(&blocked); |
| 366 | current->blocked = blocked; | ||
| 367 | recalc_sigpending(); | ||
| 368 | spin_unlock_irq(¤t->sighand->siglock); | ||
| 369 | 360 | ||
| 370 | sig = restore_sigcontext(®s, &frame->sf_sc); | 361 | sig = restore_sigcontext(®s, &frame->sf_sc); |
| 371 | if (sig < 0) | 362 | if (sig < 0) |
| @@ -401,10 +392,7 @@ asmlinkage void sys_rt_sigreturn(nabi_no_regargs struct pt_regs regs) | |||
| 401 | goto badframe; | 392 | goto badframe; |
| 402 | 393 | ||
| 403 | sigdelsetmask(&set, ~_BLOCKABLE); | 394 | sigdelsetmask(&set, ~_BLOCKABLE); |
| 404 | spin_lock_irq(¤t->sighand->siglock); | 395 | set_current_blocked(&set); |
| 405 | current->blocked = set; | ||
| 406 | recalc_sigpending(); | ||
| 407 | spin_unlock_irq(¤t->sighand->siglock); | ||
| 408 | 396 | ||
| 409 | sig = restore_sigcontext(®s, &frame->rs_uc.uc_mcontext); | 397 | sig = restore_sigcontext(®s, &frame->rs_uc.uc_mcontext); |
| 410 | if (sig < 0) | 398 | if (sig < 0) |
| @@ -580,12 +568,7 @@ static int handle_signal(unsigned long sig, siginfo_t *info, | |||
| 580 | if (ret) | 568 | if (ret) |
| 581 | return ret; | 569 | return ret; |
| 582 | 570 | ||
| 583 | spin_lock_irq(¤t->sighand->siglock); | 571 | block_sigmask(ka, sig); |
| 584 | sigorsets(¤t->blocked, ¤t->blocked, &ka->sa.sa_mask); | ||
| 585 | if (!(ka->sa.sa_flags & SA_NODEFER)) | ||
| 586 | sigaddset(¤t->blocked, sig); | ||
| 587 | recalc_sigpending(); | ||
| 588 | spin_unlock_irq(¤t->sighand->siglock); | ||
| 589 | 572 | ||
| 590 | return ret; | 573 | return ret; |
| 591 | } | 574 | } |
diff --git a/arch/mips/kernel/signal32.c b/arch/mips/kernel/signal32.c index 06b5da392e24..ac3b8d89aae5 100644 --- a/arch/mips/kernel/signal32.c +++ b/arch/mips/kernel/signal32.c | |||
| @@ -290,11 +290,8 @@ asmlinkage int sys32_sigsuspend(nabi_no_regargs struct pt_regs regs) | |||
| 290 | return -EFAULT; | 290 | return -EFAULT; |
| 291 | sigdelsetmask(&newset, ~_BLOCKABLE); | 291 | sigdelsetmask(&newset, ~_BLOCKABLE); |
| 292 | 292 | ||
| 293 | spin_lock_irq(¤t->sighand->siglock); | ||
| 294 | current->saved_sigmask = current->blocked; | 293 | current->saved_sigmask = current->blocked; |
| 295 | current->blocked = newset; | 294 | set_current_blocked(&newset); |
| 296 | recalc_sigpending(); | ||
| 297 | spin_unlock_irq(¤t->sighand->siglock); | ||
| 298 | 295 | ||
| 299 | current->state = TASK_INTERRUPTIBLE; | 296 | current->state = TASK_INTERRUPTIBLE; |
| 300 | schedule(); | 297 | schedule(); |
| @@ -318,11 +315,8 @@ asmlinkage int sys32_rt_sigsuspend(nabi_no_regargs struct pt_regs regs) | |||
| 318 | return -EFAULT; | 315 | return -EFAULT; |
| 319 | sigdelsetmask(&newset, ~_BLOCKABLE); | 316 | sigdelsetmask(&newset, ~_BLOCKABLE); |
| 320 | 317 | ||
| 321 | spin_lock_irq(¤t->sighand->siglock); | ||
| 322 | current->saved_sigmask = current->blocked; | 318 | current->saved_sigmask = current->blocked; |
| 323 | current->blocked = newset; | 319 | set_current_blocked(&newset); |
| 324 | recalc_sigpending(); | ||
| 325 | spin_unlock_irq(¤t->sighand->siglock); | ||
| 326 | 320 | ||
| 327 | current->state = TASK_INTERRUPTIBLE; | 321 | current->state = TASK_INTERRUPTIBLE; |
| 328 | schedule(); | 322 | schedule(); |
| @@ -488,10 +482,7 @@ asmlinkage void sys32_sigreturn(nabi_no_regargs struct pt_regs regs) | |||
| 488 | goto badframe; | 482 | goto badframe; |
| 489 | 483 | ||
| 490 | sigdelsetmask(&blocked, ~_BLOCKABLE); | 484 | sigdelsetmask(&blocked, ~_BLOCKABLE); |
| 491 | spin_lock_irq(¤t->sighand->siglock); | 485 | set_current_blocked(&blocked); |
| 492 | current->blocked = blocked; | ||
| 493 | recalc_sigpending(); | ||
| 494 | spin_unlock_irq(¤t->sighand->siglock); | ||
| 495 | 486 | ||
| 496 | sig = restore_sigcontext32(®s, &frame->sf_sc); | 487 | sig = restore_sigcontext32(®s, &frame->sf_sc); |
| 497 | if (sig < 0) | 488 | if (sig < 0) |
| @@ -529,10 +520,7 @@ asmlinkage void sys32_rt_sigreturn(nabi_no_regargs struct pt_regs regs) | |||
| 529 | goto badframe; | 520 | goto badframe; |
| 530 | 521 | ||
| 531 | sigdelsetmask(&set, ~_BLOCKABLE); | 522 | sigdelsetmask(&set, ~_BLOCKABLE); |
| 532 | spin_lock_irq(¤t->sighand->siglock); | 523 | set_current_blocked(&set); |
| 533 | current->blocked = set; | ||
| 534 | recalc_sigpending(); | ||
| 535 | spin_unlock_irq(¤t->sighand->siglock); | ||
| 536 | 524 | ||
| 537 | sig = restore_sigcontext32(®s, &frame->rs_uc.uc_mcontext); | 525 | sig = restore_sigcontext32(®s, &frame->rs_uc.uc_mcontext); |
| 538 | if (sig < 0) | 526 | if (sig < 0) |
diff --git a/arch/mips/kernel/signal_n32.c b/arch/mips/kernel/signal_n32.c index ae29e894ab8d..86eb4b04631c 100644 --- a/arch/mips/kernel/signal_n32.c +++ b/arch/mips/kernel/signal_n32.c | |||
| @@ -93,11 +93,8 @@ asmlinkage int sysn32_rt_sigsuspend(nabi_no_regargs struct pt_regs regs) | |||
| 93 | sigset_from_compat(&newset, &uset); | 93 | sigset_from_compat(&newset, &uset); |
| 94 | sigdelsetmask(&newset, ~_BLOCKABLE); | 94 | sigdelsetmask(&newset, ~_BLOCKABLE); |
| 95 | 95 | ||
| 96 | spin_lock_irq(¤t->sighand->siglock); | ||
| 97 | current->saved_sigmask = current->blocked; | 96 | current->saved_sigmask = current->blocked; |
| 98 | current->blocked = newset; | 97 | set_current_blocked(&newset); |
| 99 | recalc_sigpending(); | ||
| 100 | spin_unlock_irq(¤t->sighand->siglock); | ||
| 101 | 98 | ||
| 102 | current->state = TASK_INTERRUPTIBLE; | 99 | current->state = TASK_INTERRUPTIBLE; |
| 103 | schedule(); | 100 | schedule(); |
| @@ -121,10 +118,7 @@ asmlinkage void sysn32_rt_sigreturn(nabi_no_regargs struct pt_regs regs) | |||
| 121 | goto badframe; | 118 | goto badframe; |
| 122 | 119 | ||
| 123 | sigdelsetmask(&set, ~_BLOCKABLE); | 120 | sigdelsetmask(&set, ~_BLOCKABLE); |
| 124 | spin_lock_irq(¤t->sighand->siglock); | 121 | set_current_blocked(&set); |
| 125 | current->blocked = set; | ||
| 126 | recalc_sigpending(); | ||
| 127 | spin_unlock_irq(¤t->sighand->siglock); | ||
| 128 | 122 | ||
| 129 | sig = restore_sigcontext(®s, &frame->rs_uc.uc_mcontext); | 123 | sig = restore_sigcontext(®s, &frame->rs_uc.uc_mcontext); |
| 130 | if (sig < 0) | 124 | if (sig < 0) |
diff --git a/arch/parisc/kernel/pdc_cons.c b/arch/parisc/kernel/pdc_cons.c index 4f004596a6e7..0b3393381a81 100644 --- a/arch/parisc/kernel/pdc_cons.c +++ b/arch/parisc/kernel/pdc_cons.c | |||
| @@ -104,7 +104,7 @@ static int pdc_console_tty_open(struct tty_struct *tty, struct file *filp) | |||
| 104 | 104 | ||
| 105 | static void pdc_console_tty_close(struct tty_struct *tty, struct file *filp) | 105 | static void pdc_console_tty_close(struct tty_struct *tty, struct file *filp) |
| 106 | { | 106 | { |
| 107 | if (!tty->count) { | 107 | if (tty->count == 1) { |
| 108 | del_timer_sync(&pdc_console_timer); | 108 | del_timer_sync(&pdc_console_timer); |
| 109 | tty_port_tty_set(&tty_port, NULL); | 109 | tty_port_tty_set(&tty_port, NULL); |
| 110 | } | 110 | } |
diff --git a/arch/powerpc/boot/dts/fsl/pq3-mpic-message-B.dtsi b/arch/powerpc/boot/dts/fsl/pq3-mpic-message-B.dtsi new file mode 100644 index 000000000000..1cf0b77b1efe --- /dev/null +++ b/arch/powerpc/boot/dts/fsl/pq3-mpic-message-B.dtsi | |||
| @@ -0,0 +1,43 @@ | |||
| 1 | /* | ||
| 2 | * PQ3 MPIC Message (Group B) device tree stub [ controller @ offset 0x42400 ] | ||
| 3 | * | ||
| 4 | * Copyright 2012 Freescale Semiconductor Inc. | ||
| 5 | * | ||
| 6 | * Redistribution and use in source and binary forms, with or without | ||
| 7 | * modification, are permitted provided that the following conditions are met: | ||
| 8 | * * Redistributions of source code must retain the above copyright | ||
| 9 | * notice, this list of conditions and the following disclaimer. | ||
| 10 | * * Redistributions in binary form must reproduce the above copyright | ||
| 11 | * notice, this list of conditions and the following disclaimer in the | ||
| 12 | * documentation and/or other materials provided with the distribution. | ||
| 13 | * * Neither the name of Freescale Semiconductor nor the | ||
| 14 | * names of its contributors may be used to endorse or promote products | ||
| 15 | * derived from this software without specific prior written permission. | ||
| 16 | * | ||
| 17 | * | ||
| 18 | * ALTERNATIVELY, this software may be distributed under the terms of the | ||
| 19 | * GNU General Public License ("GPL") as published by the Free Software | ||
| 20 | * Foundation, either version 2 of that License or (at your option) any | ||
| 21 | * later version. | ||
| 22 | * | ||
| 23 | * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY | ||
| 24 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
| 25 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
| 26 | * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY | ||
| 27 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
| 28 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
| 29 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
| 30 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
| 31 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
| 32 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 33 | */ | ||
| 34 | |||
| 35 | message@42400 { | ||
| 36 | compatible = "fsl,mpic-v3.1-msgr"; | ||
| 37 | reg = <0x42400 0x200>; | ||
| 38 | interrupts = < | ||
| 39 | 0xb4 2 0 0 | ||
| 40 | 0xb5 2 0 0 | ||
| 41 | 0xb6 2 0 0 | ||
| 42 | 0xb7 2 0 0>; | ||
| 43 | }; | ||
diff --git a/arch/powerpc/boot/dts/fsl/pq3-mpic.dtsi b/arch/powerpc/boot/dts/fsl/pq3-mpic.dtsi index fdedf7b1fe0f..71c30eb10056 100644 --- a/arch/powerpc/boot/dts/fsl/pq3-mpic.dtsi +++ b/arch/powerpc/boot/dts/fsl/pq3-mpic.dtsi | |||
| @@ -53,6 +53,16 @@ timer@41100 { | |||
| 53 | 3 0 3 0>; | 53 | 3 0 3 0>; |
| 54 | }; | 54 | }; |
| 55 | 55 | ||
| 56 | message@41400 { | ||
| 57 | compatible = "fsl,mpic-v3.1-msgr"; | ||
| 58 | reg = <0x41400 0x200>; | ||
| 59 | interrupts = < | ||
| 60 | 0xb0 2 0 0 | ||
| 61 | 0xb1 2 0 0 | ||
| 62 | 0xb2 2 0 0 | ||
| 63 | 0xb3 2 0 0>; | ||
| 64 | }; | ||
| 65 | |||
| 56 | msi@41600 { | 66 | msi@41600 { |
| 57 | compatible = "fsl,mpic-msi"; | 67 | compatible = "fsl,mpic-msi"; |
| 58 | reg = <0x41600 0x80>; | 68 | reg = <0x41600 0x80>; |
diff --git a/arch/powerpc/include/asm/irq.h b/arch/powerpc/include/asm/irq.h index e648af92ced1..0e40843a1c6e 100644 --- a/arch/powerpc/include/asm/irq.h +++ b/arch/powerpc/include/asm/irq.h | |||
| @@ -18,10 +18,6 @@ | |||
| 18 | #include <linux/atomic.h> | 18 | #include <linux/atomic.h> |
| 19 | 19 | ||
| 20 | 20 | ||
| 21 | /* Define a way to iterate across irqs. */ | ||
| 22 | #define for_each_irq(i) \ | ||
| 23 | for ((i) = 0; (i) < NR_IRQS; ++(i)) | ||
| 24 | |||
| 25 | extern atomic_t ppc_n_lost_interrupts; | 21 | extern atomic_t ppc_n_lost_interrupts; |
| 26 | 22 | ||
| 27 | /* This number is used when no interrupt has been assigned */ | 23 | /* This number is used when no interrupt has been assigned */ |
diff --git a/arch/powerpc/include/asm/mpic.h b/arch/powerpc/include/asm/mpic.h index c65b9294376e..c9f698a994be 100644 --- a/arch/powerpc/include/asm/mpic.h +++ b/arch/powerpc/include/asm/mpic.h | |||
| @@ -275,9 +275,6 @@ struct mpic | |||
| 275 | unsigned int isu_mask; | 275 | unsigned int isu_mask; |
| 276 | /* Number of sources */ | 276 | /* Number of sources */ |
| 277 | unsigned int num_sources; | 277 | unsigned int num_sources; |
| 278 | /* default senses array */ | ||
| 279 | unsigned char *senses; | ||
| 280 | unsigned int senses_count; | ||
| 281 | 278 | ||
| 282 | /* vector numbers used for internal sources (ipi/timers) */ | 279 | /* vector numbers used for internal sources (ipi/timers) */ |
| 283 | unsigned int ipi_vecs[4]; | 280 | unsigned int ipi_vecs[4]; |
| @@ -415,21 +412,6 @@ extern struct mpic *mpic_alloc(struct device_node *node, | |||
| 415 | extern void mpic_assign_isu(struct mpic *mpic, unsigned int isu_num, | 412 | extern void mpic_assign_isu(struct mpic *mpic, unsigned int isu_num, |
| 416 | phys_addr_t phys_addr); | 413 | phys_addr_t phys_addr); |
| 417 | 414 | ||
| 418 | /* Set default sense codes | ||
| 419 | * | ||
| 420 | * @mpic: controller | ||
| 421 | * @senses: array of sense codes | ||
| 422 | * @count: size of above array | ||
| 423 | * | ||
| 424 | * Optionally provide an array (indexed on hardware interrupt numbers | ||
| 425 | * for this MPIC) of default sense codes for the chip. Those are linux | ||
| 426 | * sense codes IRQ_TYPE_* | ||
| 427 | * | ||
| 428 | * The driver gets ownership of the pointer, don't dispose of it or | ||
| 429 | * anything like that. __init only. | ||
| 430 | */ | ||
| 431 | extern void mpic_set_default_senses(struct mpic *mpic, u8 *senses, int count); | ||
| 432 | |||
| 433 | 415 | ||
| 434 | /* Initialize the controller. After this has been called, none of the above | 416 | /* Initialize the controller. After this has been called, none of the above |
| 435 | * should be called again for this mpic | 417 | * should be called again for this mpic |
diff --git a/arch/powerpc/include/asm/mpic_msgr.h b/arch/powerpc/include/asm/mpic_msgr.h index 3ec37dc9003e..326d33ca55cd 100644 --- a/arch/powerpc/include/asm/mpic_msgr.h +++ b/arch/powerpc/include/asm/mpic_msgr.h | |||
| @@ -13,6 +13,7 @@ | |||
| 13 | 13 | ||
| 14 | #include <linux/types.h> | 14 | #include <linux/types.h> |
| 15 | #include <linux/spinlock.h> | 15 | #include <linux/spinlock.h> |
| 16 | #include <asm/smp.h> | ||
| 16 | 17 | ||
| 17 | struct mpic_msgr { | 18 | struct mpic_msgr { |
| 18 | u32 __iomem *base; | 19 | u32 __iomem *base; |
diff --git a/arch/powerpc/include/asm/reg_booke.h b/arch/powerpc/include/asm/reg_booke.h index b86faa9107da..8a97aa7289d3 100644 --- a/arch/powerpc/include/asm/reg_booke.h +++ b/arch/powerpc/include/asm/reg_booke.h | |||
| @@ -15,11 +15,6 @@ | |||
| 15 | #ifndef __ASM_POWERPC_REG_BOOKE_H__ | 15 | #ifndef __ASM_POWERPC_REG_BOOKE_H__ |
| 16 | #define __ASM_POWERPC_REG_BOOKE_H__ | 16 | #define __ASM_POWERPC_REG_BOOKE_H__ |
| 17 | 17 | ||
| 18 | #ifdef CONFIG_BOOKE_WDT | ||
| 19 | extern u32 booke_wdt_enabled; | ||
| 20 | extern u32 booke_wdt_period; | ||
| 21 | #endif /* CONFIG_BOOKE_WDT */ | ||
| 22 | |||
| 23 | /* Machine State Register (MSR) Fields */ | 18 | /* Machine State Register (MSR) Fields */ |
| 24 | #define MSR_GS (1<<28) /* Guest state */ | 19 | #define MSR_GS (1<<28) /* Guest state */ |
| 25 | #define MSR_UCLE (1<<26) /* User-mode cache lock enable */ | 20 | #define MSR_UCLE (1<<26) /* User-mode cache lock enable */ |
diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c index 5ec1b2354ca6..43eb74fcedde 100644 --- a/arch/powerpc/kernel/irq.c +++ b/arch/powerpc/kernel/irq.c | |||
| @@ -330,14 +330,10 @@ void migrate_irqs(void) | |||
| 330 | 330 | ||
| 331 | alloc_cpumask_var(&mask, GFP_KERNEL); | 331 | alloc_cpumask_var(&mask, GFP_KERNEL); |
| 332 | 332 | ||
| 333 | for_each_irq(irq) { | 333 | for_each_irq_desc(irq, desc) { |
| 334 | struct irq_data *data; | 334 | struct irq_data *data; |
| 335 | struct irq_chip *chip; | 335 | struct irq_chip *chip; |
| 336 | 336 | ||
| 337 | desc = irq_to_desc(irq); | ||
| 338 | if (!desc) | ||
| 339 | continue; | ||
| 340 | |||
| 341 | data = irq_desc_get_irq_data(desc); | 337 | data = irq_desc_get_irq_data(desc); |
| 342 | if (irqd_is_per_cpu(data)) | 338 | if (irqd_is_per_cpu(data)) |
| 343 | continue; | 339 | continue; |
diff --git a/arch/powerpc/kernel/machine_kexec.c b/arch/powerpc/kernel/machine_kexec.c index c957b1202bdc..5df777794403 100644 --- a/arch/powerpc/kernel/machine_kexec.c +++ b/arch/powerpc/kernel/machine_kexec.c | |||
| @@ -23,14 +23,11 @@ | |||
| 23 | 23 | ||
| 24 | void machine_kexec_mask_interrupts(void) { | 24 | void machine_kexec_mask_interrupts(void) { |
| 25 | unsigned int i; | 25 | unsigned int i; |
| 26 | struct irq_desc *desc; | ||
| 26 | 27 | ||
| 27 | for_each_irq(i) { | 28 | for_each_irq_desc(i, desc) { |
| 28 | struct irq_desc *desc = irq_to_desc(i); | ||
| 29 | struct irq_chip *chip; | 29 | struct irq_chip *chip; |
| 30 | 30 | ||
| 31 | if (!desc) | ||
| 32 | continue; | ||
| 33 | |||
| 34 | chip = irq_desc_get_chip(desc); | 31 | chip = irq_desc_get_chip(desc); |
| 35 | if (!chip) | 32 | if (!chip) |
| 36 | continue; | 33 | continue; |
diff --git a/arch/powerpc/kernel/setup_32.c b/arch/powerpc/kernel/setup_32.c index 9825f29d1faf..ec8a53fa9e8f 100644 --- a/arch/powerpc/kernel/setup_32.c +++ b/arch/powerpc/kernel/setup_32.c | |||
| @@ -150,6 +150,9 @@ notrace void __init machine_init(u64 dt_ptr) | |||
| 150 | } | 150 | } |
| 151 | 151 | ||
| 152 | #ifdef CONFIG_BOOKE_WDT | 152 | #ifdef CONFIG_BOOKE_WDT |
| 153 | extern u32 booke_wdt_enabled; | ||
| 154 | extern u32 booke_wdt_period; | ||
| 155 | |||
| 153 | /* Checks wdt=x and wdt_period=xx command-line option */ | 156 | /* Checks wdt=x and wdt_period=xx command-line option */ |
| 154 | notrace int __init early_parse_wdt(char *p) | 157 | notrace int __init early_parse_wdt(char *p) |
| 155 | { | 158 | { |
diff --git a/arch/powerpc/net/bpf_jit.h b/arch/powerpc/net/bpf_jit.h index af1ab5e9a691..5c3cf2d04e41 100644 --- a/arch/powerpc/net/bpf_jit.h +++ b/arch/powerpc/net/bpf_jit.h | |||
| @@ -48,7 +48,13 @@ | |||
| 48 | /* | 48 | /* |
| 49 | * Assembly helpers from arch/powerpc/net/bpf_jit.S: | 49 | * Assembly helpers from arch/powerpc/net/bpf_jit.S: |
| 50 | */ | 50 | */ |
| 51 | extern u8 sk_load_word[], sk_load_half[], sk_load_byte[], sk_load_byte_msh[]; | 51 | #define DECLARE_LOAD_FUNC(func) \ |
| 52 | extern u8 func[], func##_negative_offset[], func##_positive_offset[] | ||
| 53 | |||
| 54 | DECLARE_LOAD_FUNC(sk_load_word); | ||
| 55 | DECLARE_LOAD_FUNC(sk_load_half); | ||
| 56 | DECLARE_LOAD_FUNC(sk_load_byte); | ||
| 57 | DECLARE_LOAD_FUNC(sk_load_byte_msh); | ||
| 52 | 58 | ||
| 53 | #define FUNCTION_DESCR_SIZE 24 | 59 | #define FUNCTION_DESCR_SIZE 24 |
| 54 | 60 | ||
diff --git a/arch/powerpc/net/bpf_jit_64.S b/arch/powerpc/net/bpf_jit_64.S index ff4506e85cce..55ba3855a97f 100644 --- a/arch/powerpc/net/bpf_jit_64.S +++ b/arch/powerpc/net/bpf_jit_64.S | |||
| @@ -31,14 +31,13 @@ | |||
| 31 | * then branch directly to slow_path_XXX if required. (In fact, could | 31 | * then branch directly to slow_path_XXX if required. (In fact, could |
| 32 | * load a spare GPR with the address of slow_path_generic and pass size | 32 | * load a spare GPR with the address of slow_path_generic and pass size |
| 33 | * as an argument, making the call site a mtlr, li and bllr.) | 33 | * as an argument, making the call site a mtlr, li and bllr.) |
| 34 | * | ||
| 35 | * Technically, the "is addr < 0" check is unnecessary & slowing down | ||
| 36 | * the ABS path, as it's statically checked on generation. | ||
| 37 | */ | 34 | */ |
| 38 | .globl sk_load_word | 35 | .globl sk_load_word |
| 39 | sk_load_word: | 36 | sk_load_word: |
| 40 | cmpdi r_addr, 0 | 37 | cmpdi r_addr, 0 |
| 41 | blt bpf_error | 38 | blt bpf_slow_path_word_neg |
| 39 | .globl sk_load_word_positive_offset | ||
| 40 | sk_load_word_positive_offset: | ||
| 42 | /* Are we accessing past headlen? */ | 41 | /* Are we accessing past headlen? */ |
| 43 | subi r_scratch1, r_HL, 4 | 42 | subi r_scratch1, r_HL, 4 |
| 44 | cmpd r_scratch1, r_addr | 43 | cmpd r_scratch1, r_addr |
| @@ -51,7 +50,9 @@ sk_load_word: | |||
| 51 | .globl sk_load_half | 50 | .globl sk_load_half |
| 52 | sk_load_half: | 51 | sk_load_half: |
| 53 | cmpdi r_addr, 0 | 52 | cmpdi r_addr, 0 |
| 54 | blt bpf_error | 53 | blt bpf_slow_path_half_neg |
| 54 | .globl sk_load_half_positive_offset | ||
| 55 | sk_load_half_positive_offset: | ||
| 55 | subi r_scratch1, r_HL, 2 | 56 | subi r_scratch1, r_HL, 2 |
| 56 | cmpd r_scratch1, r_addr | 57 | cmpd r_scratch1, r_addr |
| 57 | blt bpf_slow_path_half | 58 | blt bpf_slow_path_half |
| @@ -61,7 +62,9 @@ sk_load_half: | |||
| 61 | .globl sk_load_byte | 62 | .globl sk_load_byte |
| 62 | sk_load_byte: | 63 | sk_load_byte: |
| 63 | cmpdi r_addr, 0 | 64 | cmpdi r_addr, 0 |
| 64 | blt bpf_error | 65 | blt bpf_slow_path_byte_neg |
| 66 | .globl sk_load_byte_positive_offset | ||
| 67 | sk_load_byte_positive_offset: | ||
| 65 | cmpd r_HL, r_addr | 68 | cmpd r_HL, r_addr |
| 66 | ble bpf_slow_path_byte | 69 | ble bpf_slow_path_byte |
| 67 | lbzx r_A, r_D, r_addr | 70 | lbzx r_A, r_D, r_addr |
| @@ -69,22 +72,20 @@ sk_load_byte: | |||
| 69 | 72 | ||
| 70 | /* | 73 | /* |
| 71 | * BPF_S_LDX_B_MSH: ldxb 4*([offset]&0xf) | 74 | * BPF_S_LDX_B_MSH: ldxb 4*([offset]&0xf) |
| 72 | * r_addr is the offset value, already known positive | 75 | * r_addr is the offset value |
| 73 | */ | 76 | */ |
| 74 | .globl sk_load_byte_msh | 77 | .globl sk_load_byte_msh |
| 75 | sk_load_byte_msh: | 78 | sk_load_byte_msh: |
| 79 | cmpdi r_addr, 0 | ||
| 80 | blt bpf_slow_path_byte_msh_neg | ||
| 81 | .globl sk_load_byte_msh_positive_offset | ||
| 82 | sk_load_byte_msh_positive_offset: | ||
| 76 | cmpd r_HL, r_addr | 83 | cmpd r_HL, r_addr |
| 77 | ble bpf_slow_path_byte_msh | 84 | ble bpf_slow_path_byte_msh |
| 78 | lbzx r_X, r_D, r_addr | 85 | lbzx r_X, r_D, r_addr |
| 79 | rlwinm r_X, r_X, 2, 32-4-2, 31-2 | 86 | rlwinm r_X, r_X, 2, 32-4-2, 31-2 |
| 80 | blr | 87 | blr |
| 81 | 88 | ||
| 82 | bpf_error: | ||
| 83 | /* Entered with cr0 = lt */ | ||
| 84 | li r3, 0 | ||
| 85 | /* Generated code will 'blt epilogue', returning 0. */ | ||
| 86 | blr | ||
| 87 | |||
| 88 | /* Call out to skb_copy_bits: | 89 | /* Call out to skb_copy_bits: |
| 89 | * We'll need to back up our volatile regs first; we have | 90 | * We'll need to back up our volatile regs first; we have |
| 90 | * local variable space at r1+(BPF_PPC_STACK_BASIC). | 91 | * local variable space at r1+(BPF_PPC_STACK_BASIC). |
| @@ -136,3 +137,84 @@ bpf_slow_path_byte_msh: | |||
| 136 | lbz r_X, BPF_PPC_STACK_BASIC+(2*8)(r1) | 137 | lbz r_X, BPF_PPC_STACK_BASIC+(2*8)(r1) |
| 137 | rlwinm r_X, r_X, 2, 32-4-2, 31-2 | 138 | rlwinm r_X, r_X, 2, 32-4-2, 31-2 |
| 138 | blr | 139 | blr |
| 140 | |||
| 141 | /* Call out to bpf_internal_load_pointer_neg_helper: | ||
| 142 | * We'll need to back up our volatile regs first; we have | ||
| 143 | * local variable space at r1+(BPF_PPC_STACK_BASIC). | ||
| 144 | * Allocate a new stack frame here to remain ABI-compliant in | ||
| 145 | * stashing LR. | ||
| 146 | */ | ||
| 147 | #define sk_negative_common(SIZE) \ | ||
| 148 | mflr r0; \ | ||
| 149 | std r0, 16(r1); \ | ||
| 150 | /* R3 goes in parameter space of caller's frame */ \ | ||
| 151 | std r_skb, (BPF_PPC_STACKFRAME+48)(r1); \ | ||
| 152 | std r_A, (BPF_PPC_STACK_BASIC+(0*8))(r1); \ | ||
| 153 | std r_X, (BPF_PPC_STACK_BASIC+(1*8))(r1); \ | ||
| 154 | stdu r1, -BPF_PPC_SLOWPATH_FRAME(r1); \ | ||
| 155 | /* R3 = r_skb, as passed */ \ | ||
| 156 | mr r4, r_addr; \ | ||
| 157 | li r5, SIZE; \ | ||
| 158 | bl bpf_internal_load_pointer_neg_helper; \ | ||
| 159 | /* R3 != 0 on success */ \ | ||
| 160 | addi r1, r1, BPF_PPC_SLOWPATH_FRAME; \ | ||
| 161 | ld r0, 16(r1); \ | ||
| 162 | ld r_A, (BPF_PPC_STACK_BASIC+(0*8))(r1); \ | ||
| 163 | ld r_X, (BPF_PPC_STACK_BASIC+(1*8))(r1); \ | ||
| 164 | mtlr r0; \ | ||
| 165 | cmpldi r3, 0; \ | ||
| 166 | beq bpf_error_slow; /* cr0 = EQ */ \ | ||
| 167 | mr r_addr, r3; \ | ||
| 168 | ld r_skb, (BPF_PPC_STACKFRAME+48)(r1); \ | ||
| 169 | /* Great success! */ | ||
| 170 | |||
| 171 | bpf_slow_path_word_neg: | ||
| 172 | lis r_scratch1,-32 /* SKF_LL_OFF */ | ||
| 173 | cmpd r_addr, r_scratch1 /* addr < SKF_* */ | ||
| 174 | blt bpf_error /* cr0 = LT */ | ||
| 175 | .globl sk_load_word_negative_offset | ||
| 176 | sk_load_word_negative_offset: | ||
| 177 | sk_negative_common(4) | ||
| 178 | lwz r_A, 0(r_addr) | ||
| 179 | blr | ||
| 180 | |||
| 181 | bpf_slow_path_half_neg: | ||
| 182 | lis r_scratch1,-32 /* SKF_LL_OFF */ | ||
| 183 | cmpd r_addr, r_scratch1 /* addr < SKF_* */ | ||
| 184 | blt bpf_error /* cr0 = LT */ | ||
| 185 | .globl sk_load_half_negative_offset | ||
| 186 | sk_load_half_negative_offset: | ||
| 187 | sk_negative_common(2) | ||
| 188 | lhz r_A, 0(r_addr) | ||
| 189 | blr | ||
| 190 | |||
| 191 | bpf_slow_path_byte_neg: | ||
| 192 | lis r_scratch1,-32 /* SKF_LL_OFF */ | ||
| 193 | cmpd r_addr, r_scratch1 /* addr < SKF_* */ | ||
| 194 | blt bpf_error /* cr0 = LT */ | ||
| 195 | .globl sk_load_byte_negative_offset | ||
| 196 | sk_load_byte_negative_offset: | ||
| 197 | sk_negative_common(1) | ||
| 198 | lbz r_A, 0(r_addr) | ||
| 199 | blr | ||
| 200 | |||
| 201 | bpf_slow_path_byte_msh_neg: | ||
| 202 | lis r_scratch1,-32 /* SKF_LL_OFF */ | ||
| 203 | cmpd r_addr, r_scratch1 /* addr < SKF_* */ | ||
| 204 | blt bpf_error /* cr0 = LT */ | ||
| 205 | .globl sk_load_byte_msh_negative_offset | ||
| 206 | sk_load_byte_msh_negative_offset: | ||
| 207 | sk_negative_common(1) | ||
| 208 | lbz r_X, 0(r_addr) | ||
| 209 | rlwinm r_X, r_X, 2, 32-4-2, 31-2 | ||
| 210 | blr | ||
| 211 | |||
| 212 | bpf_error_slow: | ||
| 213 | /* fabricate a cr0 = lt */ | ||
| 214 | li r_scratch1, -1 | ||
| 215 | cmpdi r_scratch1, 0 | ||
| 216 | bpf_error: | ||
| 217 | /* Entered with cr0 = lt */ | ||
| 218 | li r3, 0 | ||
| 219 | /* Generated code will 'blt epilogue', returning 0. */ | ||
| 220 | blr | ||
diff --git a/arch/powerpc/net/bpf_jit_comp.c b/arch/powerpc/net/bpf_jit_comp.c index 73619d3aeb6c..2dc8b1484845 100644 --- a/arch/powerpc/net/bpf_jit_comp.c +++ b/arch/powerpc/net/bpf_jit_comp.c | |||
| @@ -127,6 +127,9 @@ static void bpf_jit_build_epilogue(u32 *image, struct codegen_context *ctx) | |||
| 127 | PPC_BLR(); | 127 | PPC_BLR(); |
| 128 | } | 128 | } |
| 129 | 129 | ||
| 130 | #define CHOOSE_LOAD_FUNC(K, func) \ | ||
| 131 | ((int)K < 0 ? ((int)K >= SKF_LL_OFF ? func##_negative_offset : func) : func##_positive_offset) | ||
| 132 | |||
| 130 | /* Assemble the body code between the prologue & epilogue. */ | 133 | /* Assemble the body code between the prologue & epilogue. */ |
| 131 | static int bpf_jit_build_body(struct sk_filter *fp, u32 *image, | 134 | static int bpf_jit_build_body(struct sk_filter *fp, u32 *image, |
| 132 | struct codegen_context *ctx, | 135 | struct codegen_context *ctx, |
| @@ -391,21 +394,16 @@ static int bpf_jit_build_body(struct sk_filter *fp, u32 *image, | |||
| 391 | 394 | ||
| 392 | /*** Absolute loads from packet header/data ***/ | 395 | /*** Absolute loads from packet header/data ***/ |
| 393 | case BPF_S_LD_W_ABS: | 396 | case BPF_S_LD_W_ABS: |
| 394 | func = sk_load_word; | 397 | func = CHOOSE_LOAD_FUNC(K, sk_load_word); |
| 395 | goto common_load; | 398 | goto common_load; |
| 396 | case BPF_S_LD_H_ABS: | 399 | case BPF_S_LD_H_ABS: |
| 397 | func = sk_load_half; | 400 | func = CHOOSE_LOAD_FUNC(K, sk_load_half); |
| 398 | goto common_load; | 401 | goto common_load; |
| 399 | case BPF_S_LD_B_ABS: | 402 | case BPF_S_LD_B_ABS: |
| 400 | func = sk_load_byte; | 403 | func = CHOOSE_LOAD_FUNC(K, sk_load_byte); |
| 401 | common_load: | 404 | common_load: |
| 402 | /* | 405 | /* Load from [K]. */ |
| 403 | * Load from [K]. Reference with the (negative) | ||
| 404 | * SKF_NET_OFF/SKF_LL_OFF offsets is unsupported. | ||
| 405 | */ | ||
| 406 | ctx->seen |= SEEN_DATAREF; | 406 | ctx->seen |= SEEN_DATAREF; |
| 407 | if ((int)K < 0) | ||
| 408 | return -ENOTSUPP; | ||
| 409 | PPC_LI64(r_scratch1, func); | 407 | PPC_LI64(r_scratch1, func); |
| 410 | PPC_MTLR(r_scratch1); | 408 | PPC_MTLR(r_scratch1); |
| 411 | PPC_LI32(r_addr, K); | 409 | PPC_LI32(r_addr, K); |
| @@ -429,7 +427,7 @@ static int bpf_jit_build_body(struct sk_filter *fp, u32 *image, | |||
| 429 | common_load_ind: | 427 | common_load_ind: |
| 430 | /* | 428 | /* |
| 431 | * Load from [X + K]. Negative offsets are tested for | 429 | * Load from [X + K]. Negative offsets are tested for |
| 432 | * in the helper functions, and result in a 'ret 0'. | 430 | * in the helper functions. |
| 433 | */ | 431 | */ |
| 434 | ctx->seen |= SEEN_DATAREF | SEEN_XREG; | 432 | ctx->seen |= SEEN_DATAREF | SEEN_XREG; |
| 435 | PPC_LI64(r_scratch1, func); | 433 | PPC_LI64(r_scratch1, func); |
| @@ -443,13 +441,7 @@ static int bpf_jit_build_body(struct sk_filter *fp, u32 *image, | |||
| 443 | break; | 441 | break; |
| 444 | 442 | ||
| 445 | case BPF_S_LDX_B_MSH: | 443 | case BPF_S_LDX_B_MSH: |
| 446 | /* | 444 | func = CHOOSE_LOAD_FUNC(K, sk_load_byte_msh); |
| 447 | * x86 version drops packet (RET 0) when K<0, whereas | ||
| 448 | * interpreter does allow K<0 (__load_pointer, special | ||
| 449 | * ancillary data). common_load returns ENOTSUPP if K<0, | ||
| 450 | * so we fall back to interpreter & filter works. | ||
| 451 | */ | ||
| 452 | func = sk_load_byte_msh; | ||
| 453 | goto common_load; | 445 | goto common_load; |
| 454 | break; | 446 | break; |
| 455 | 447 | ||
diff --git a/arch/powerpc/platforms/85xx/common.c b/arch/powerpc/platforms/85xx/common.c index 9fef5302adc1..67dac22b4363 100644 --- a/arch/powerpc/platforms/85xx/common.c +++ b/arch/powerpc/platforms/85xx/common.c | |||
| @@ -21,6 +21,12 @@ static struct of_device_id __initdata mpc85xx_common_ids[] = { | |||
| 21 | { .compatible = "fsl,qe", }, | 21 | { .compatible = "fsl,qe", }, |
| 22 | { .compatible = "fsl,cpm2", }, | 22 | { .compatible = "fsl,cpm2", }, |
| 23 | { .compatible = "fsl,srio", }, | 23 | { .compatible = "fsl,srio", }, |
| 24 | /* So that the DMA channel nodes can be probed individually: */ | ||
| 25 | { .compatible = "fsl,eloplus-dma", }, | ||
| 26 | /* For the PMC driver */ | ||
| 27 | { .compatible = "fsl,mpc8548-guts", }, | ||
| 28 | /* Probably unnecessary? */ | ||
| 29 | { .compatible = "gpio-leds", }, | ||
| 24 | {}, | 30 | {}, |
| 25 | }; | 31 | }; |
| 26 | 32 | ||
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_mds.c b/arch/powerpc/platforms/85xx/mpc85xx_mds.c index 9a6f04406e0d..d208ebccb91c 100644 --- a/arch/powerpc/platforms/85xx/mpc85xx_mds.c +++ b/arch/powerpc/platforms/85xx/mpc85xx_mds.c | |||
| @@ -399,12 +399,6 @@ static int __init board_fixups(void) | |||
| 399 | machine_arch_initcall(mpc8568_mds, board_fixups); | 399 | machine_arch_initcall(mpc8568_mds, board_fixups); |
| 400 | machine_arch_initcall(mpc8569_mds, board_fixups); | 400 | machine_arch_initcall(mpc8569_mds, board_fixups); |
| 401 | 401 | ||
| 402 | static struct of_device_id mpc85xx_ids[] = { | ||
| 403 | { .compatible = "fsl,mpc8548-guts", }, | ||
| 404 | { .compatible = "gpio-leds", }, | ||
| 405 | {}, | ||
| 406 | }; | ||
| 407 | |||
| 408 | static int __init mpc85xx_publish_devices(void) | 402 | static int __init mpc85xx_publish_devices(void) |
| 409 | { | 403 | { |
| 410 | if (machine_is(mpc8568_mds)) | 404 | if (machine_is(mpc8568_mds)) |
| @@ -412,10 +406,7 @@ static int __init mpc85xx_publish_devices(void) | |||
| 412 | if (machine_is(mpc8569_mds)) | 406 | if (machine_is(mpc8569_mds)) |
| 413 | simple_gpiochip_init("fsl,mpc8569mds-bcsr-gpio"); | 407 | simple_gpiochip_init("fsl,mpc8569mds-bcsr-gpio"); |
| 414 | 408 | ||
| 415 | mpc85xx_common_publish_devices(); | 409 | return mpc85xx_common_publish_devices(); |
| 416 | of_platform_bus_probe(NULL, mpc85xx_ids, NULL); | ||
| 417 | |||
| 418 | return 0; | ||
| 419 | } | 410 | } |
| 420 | 411 | ||
| 421 | machine_device_initcall(mpc8568_mds, mpc85xx_publish_devices); | 412 | machine_device_initcall(mpc8568_mds, mpc85xx_publish_devices); |
diff --git a/arch/powerpc/platforms/85xx/p1022_ds.c b/arch/powerpc/platforms/85xx/p1022_ds.c index e74b7cde9aee..f700c81a1321 100644 --- a/arch/powerpc/platforms/85xx/p1022_ds.c +++ b/arch/powerpc/platforms/85xx/p1022_ds.c | |||
| @@ -460,18 +460,7 @@ static void __init p1022_ds_setup_arch(void) | |||
| 460 | pr_info("Freescale P1022 DS reference board\n"); | 460 | pr_info("Freescale P1022 DS reference board\n"); |
| 461 | } | 461 | } |
| 462 | 462 | ||
| 463 | static struct of_device_id __initdata p1022_ds_ids[] = { | 463 | machine_device_initcall(p1022_ds, mpc85xx_common_publish_devices); |
| 464 | /* So that the DMA channel nodes can be probed individually: */ | ||
| 465 | { .compatible = "fsl,eloplus-dma", }, | ||
| 466 | {}, | ||
| 467 | }; | ||
| 468 | |||
| 469 | static int __init p1022_ds_publish_devices(void) | ||
| 470 | { | ||
| 471 | mpc85xx_common_publish_devices(); | ||
| 472 | return of_platform_bus_probe(NULL, p1022_ds_ids, NULL); | ||
| 473 | } | ||
| 474 | machine_device_initcall(p1022_ds, p1022_ds_publish_devices); | ||
| 475 | 464 | ||
| 476 | machine_arch_initcall(p1022_ds, swiotlb_setup_bus_notifier); | 465 | machine_arch_initcall(p1022_ds, swiotlb_setup_bus_notifier); |
| 477 | 466 | ||
diff --git a/arch/powerpc/platforms/cell/axon_msi.c b/arch/powerpc/platforms/cell/axon_msi.c index d09f3e8e6867..85825b5401e5 100644 --- a/arch/powerpc/platforms/cell/axon_msi.c +++ b/arch/powerpc/platforms/cell/axon_msi.c | |||
| @@ -114,7 +114,7 @@ static void axon_msi_cascade(unsigned int irq, struct irq_desc *desc) | |||
| 114 | pr_devel("axon_msi: woff %x roff %x msi %x\n", | 114 | pr_devel("axon_msi: woff %x roff %x msi %x\n", |
| 115 | write_offset, msic->read_offset, msi); | 115 | write_offset, msic->read_offset, msi); |
| 116 | 116 | ||
| 117 | if (msi < NR_IRQS && irq_get_chip_data(msi) == msic) { | 117 | if (msi < nr_irqs && irq_get_chip_data(msi) == msic) { |
| 118 | generic_handle_irq(msi); | 118 | generic_handle_irq(msi); |
| 119 | msic->fifo_virt[idx] = cpu_to_le32(0xffffffff); | 119 | msic->fifo_virt[idx] = cpu_to_le32(0xffffffff); |
| 120 | } else { | 120 | } else { |
| @@ -276,9 +276,6 @@ static int axon_msi_setup_msi_irqs(struct pci_dev *dev, int nvec, int type) | |||
| 276 | if (rc) | 276 | if (rc) |
| 277 | return rc; | 277 | return rc; |
| 278 | 278 | ||
| 279 | /* We rely on being able to stash a virq in a u16 */ | ||
| 280 | BUILD_BUG_ON(NR_IRQS > 65536); | ||
| 281 | |||
| 282 | list_for_each_entry(entry, &dev->msi_list, list) { | 279 | list_for_each_entry(entry, &dev->msi_list, list) { |
| 283 | virq = irq_create_direct_mapping(msic->irq_domain); | 280 | virq = irq_create_direct_mapping(msic->irq_domain); |
| 284 | if (virq == NO_IRQ) { | 281 | if (virq == NO_IRQ) { |
| @@ -392,7 +389,8 @@ static int axon_msi_probe(struct platform_device *device) | |||
| 392 | } | 389 | } |
| 393 | memset(msic->fifo_virt, 0xff, MSIC_FIFO_SIZE_BYTES); | 390 | memset(msic->fifo_virt, 0xff, MSIC_FIFO_SIZE_BYTES); |
| 394 | 391 | ||
| 395 | msic->irq_domain = irq_domain_add_nomap(dn, 0, &msic_host_ops, msic); | 392 | /* We rely on being able to stash a virq in a u16, so limit irqs to < 65536 */ |
| 393 | msic->irq_domain = irq_domain_add_nomap(dn, 65536, &msic_host_ops, msic); | ||
| 396 | if (!msic->irq_domain) { | 394 | if (!msic->irq_domain) { |
| 397 | printk(KERN_ERR "axon_msi: couldn't allocate irq_domain for %s\n", | 395 | printk(KERN_ERR "axon_msi: couldn't allocate irq_domain for %s\n", |
| 398 | dn->full_name); | 396 | dn->full_name); |
diff --git a/arch/powerpc/platforms/cell/beat_interrupt.c b/arch/powerpc/platforms/cell/beat_interrupt.c index f9a48af335cb..8c6dc42ecf65 100644 --- a/arch/powerpc/platforms/cell/beat_interrupt.c +++ b/arch/powerpc/platforms/cell/beat_interrupt.c | |||
| @@ -248,6 +248,6 @@ void beatic_deinit_IRQ(void) | |||
| 248 | { | 248 | { |
| 249 | int i; | 249 | int i; |
| 250 | 250 | ||
| 251 | for (i = 1; i < NR_IRQS; i++) | 251 | for (i = 1; i < nr_irqs; i++) |
| 252 | beat_destruct_irq_plug(i); | 252 | beat_destruct_irq_plug(i); |
| 253 | } | 253 | } |
diff --git a/arch/powerpc/platforms/powermac/low_i2c.c b/arch/powerpc/platforms/powermac/low_i2c.c index 996c5ff7824b..03685a329d7d 100644 --- a/arch/powerpc/platforms/powermac/low_i2c.c +++ b/arch/powerpc/platforms/powermac/low_i2c.c | |||
| @@ -366,11 +366,20 @@ static void kw_i2c_timeout(unsigned long data) | |||
| 366 | unsigned long flags; | 366 | unsigned long flags; |
| 367 | 367 | ||
| 368 | spin_lock_irqsave(&host->lock, flags); | 368 | spin_lock_irqsave(&host->lock, flags); |
| 369 | |||
| 370 | /* | ||
| 371 | * If the timer is pending, that means we raced with the | ||
| 372 | * irq, in which case we just return | ||
| 373 | */ | ||
| 374 | if (timer_pending(&host->timeout_timer)) | ||
| 375 | goto skip; | ||
| 376 | |||
| 369 | kw_i2c_handle_interrupt(host, kw_read_reg(reg_isr)); | 377 | kw_i2c_handle_interrupt(host, kw_read_reg(reg_isr)); |
| 370 | if (host->state != state_idle) { | 378 | if (host->state != state_idle) { |
| 371 | host->timeout_timer.expires = jiffies + KW_POLL_TIMEOUT; | 379 | host->timeout_timer.expires = jiffies + KW_POLL_TIMEOUT; |
| 372 | add_timer(&host->timeout_timer); | 380 | add_timer(&host->timeout_timer); |
| 373 | } | 381 | } |
| 382 | skip: | ||
| 374 | spin_unlock_irqrestore(&host->lock, flags); | 383 | spin_unlock_irqrestore(&host->lock, flags); |
| 375 | } | 384 | } |
| 376 | 385 | ||
diff --git a/arch/powerpc/platforms/powermac/pic.c b/arch/powerpc/platforms/powermac/pic.c index 66ad93de1d55..c4e630576ff2 100644 --- a/arch/powerpc/platforms/powermac/pic.c +++ b/arch/powerpc/platforms/powermac/pic.c | |||
| @@ -57,9 +57,9 @@ static int max_real_irqs; | |||
| 57 | 57 | ||
| 58 | static DEFINE_RAW_SPINLOCK(pmac_pic_lock); | 58 | static DEFINE_RAW_SPINLOCK(pmac_pic_lock); |
| 59 | 59 | ||
| 60 | #define NR_MASK_WORDS ((NR_IRQS + 31) / 32) | 60 | /* The max irq number this driver deals with is 128; see max_irqs */ |
| 61 | static unsigned long ppc_lost_interrupts[NR_MASK_WORDS]; | 61 | static DECLARE_BITMAP(ppc_lost_interrupts, 128); |
| 62 | static unsigned long ppc_cached_irq_mask[NR_MASK_WORDS]; | 62 | static DECLARE_BITMAP(ppc_cached_irq_mask, 128); |
| 63 | static int pmac_irq_cascade = -1; | 63 | static int pmac_irq_cascade = -1; |
| 64 | static struct irq_domain *pmac_pic_host; | 64 | static struct irq_domain *pmac_pic_host; |
| 65 | 65 | ||
diff --git a/arch/powerpc/platforms/pseries/Kconfig b/arch/powerpc/platforms/pseries/Kconfig index aadbe4f6d537..178a5f300bc9 100644 --- a/arch/powerpc/platforms/pseries/Kconfig +++ b/arch/powerpc/platforms/pseries/Kconfig | |||
| @@ -30,9 +30,9 @@ config PPC_SPLPAR | |||
| 30 | two or more partitions. | 30 | two or more partitions. |
| 31 | 31 | ||
| 32 | config EEH | 32 | config EEH |
| 33 | bool "PCI Extended Error Handling (EEH)" if EXPERT | 33 | bool |
| 34 | depends on PPC_PSERIES && PCI | 34 | depends on PPC_PSERIES && PCI |
| 35 | default y if !EXPERT | 35 | default y |
| 36 | 36 | ||
| 37 | config PSERIES_MSI | 37 | config PSERIES_MSI |
| 38 | bool | 38 | bool |
diff --git a/arch/powerpc/platforms/pseries/eeh.c b/arch/powerpc/platforms/pseries/eeh.c index 309d38ef7322..a75e37dc41aa 100644 --- a/arch/powerpc/platforms/pseries/eeh.c +++ b/arch/powerpc/platforms/pseries/eeh.c | |||
| @@ -1076,7 +1076,7 @@ static void eeh_add_device_late(struct pci_dev *dev) | |||
| 1076 | pr_debug("EEH: Adding device %s\n", pci_name(dev)); | 1076 | pr_debug("EEH: Adding device %s\n", pci_name(dev)); |
| 1077 | 1077 | ||
| 1078 | dn = pci_device_to_OF_node(dev); | 1078 | dn = pci_device_to_OF_node(dev); |
| 1079 | edev = pci_dev_to_eeh_dev(dev); | 1079 | edev = of_node_to_eeh_dev(dn); |
| 1080 | if (edev->pdev == dev) { | 1080 | if (edev->pdev == dev) { |
| 1081 | pr_debug("EEH: Already referenced !\n"); | 1081 | pr_debug("EEH: Already referenced !\n"); |
| 1082 | return; | 1082 | return; |
diff --git a/arch/powerpc/sysdev/cpm2_pic.c b/arch/powerpc/sysdev/cpm2_pic.c index d3be961e2ae7..10386b676d87 100644 --- a/arch/powerpc/sysdev/cpm2_pic.c +++ b/arch/powerpc/sysdev/cpm2_pic.c | |||
| @@ -51,8 +51,7 @@ | |||
| 51 | static intctl_cpm2_t __iomem *cpm2_intctl; | 51 | static intctl_cpm2_t __iomem *cpm2_intctl; |
| 52 | 52 | ||
| 53 | static struct irq_domain *cpm2_pic_host; | 53 | static struct irq_domain *cpm2_pic_host; |
| 54 | #define NR_MASK_WORDS ((NR_IRQS + 31) / 32) | 54 | static unsigned long ppc_cached_irq_mask[2]; /* 2 32-bit registers */ |
| 55 | static unsigned long ppc_cached_irq_mask[NR_MASK_WORDS]; | ||
| 56 | 55 | ||
| 57 | static const u_char irq_to_siureg[] = { | 56 | static const u_char irq_to_siureg[] = { |
| 58 | 1, 1, 1, 1, 1, 1, 1, 1, | 57 | 1, 1, 1, 1, 1, 1, 1, 1, |
diff --git a/arch/powerpc/sysdev/mpc8xx_pic.c b/arch/powerpc/sysdev/mpc8xx_pic.c index d5f5416be310..b724622c3a0b 100644 --- a/arch/powerpc/sysdev/mpc8xx_pic.c +++ b/arch/powerpc/sysdev/mpc8xx_pic.c | |||
| @@ -18,69 +18,45 @@ | |||
| 18 | extern int cpm_get_irq(struct pt_regs *regs); | 18 | extern int cpm_get_irq(struct pt_regs *regs); |
| 19 | 19 | ||
| 20 | static struct irq_domain *mpc8xx_pic_host; | 20 | static struct irq_domain *mpc8xx_pic_host; |
| 21 | #define NR_MASK_WORDS ((NR_IRQS + 31) / 32) | 21 | static unsigned long mpc8xx_cached_irq_mask; |
| 22 | static unsigned long ppc_cached_irq_mask[NR_MASK_WORDS]; | ||
| 23 | static sysconf8xx_t __iomem *siu_reg; | 22 | static sysconf8xx_t __iomem *siu_reg; |
| 24 | 23 | ||
| 25 | int cpm_get_irq(struct pt_regs *regs); | 24 | static inline unsigned long mpc8xx_irqd_to_bit(struct irq_data *d) |
| 25 | { | ||
| 26 | return 0x80000000 >> irqd_to_hwirq(d); | ||
| 27 | } | ||
| 26 | 28 | ||
| 27 | static void mpc8xx_unmask_irq(struct irq_data *d) | 29 | static void mpc8xx_unmask_irq(struct irq_data *d) |
| 28 | { | 30 | { |
| 29 | int bit, word; | 31 | mpc8xx_cached_irq_mask |= mpc8xx_irqd_to_bit(d); |
| 30 | unsigned int irq_nr = (unsigned int)irqd_to_hwirq(d); | 32 | out_be32(&siu_reg->sc_simask, mpc8xx_cached_irq_mask); |
| 31 | |||
| 32 | bit = irq_nr & 0x1f; | ||
| 33 | word = irq_nr >> 5; | ||
| 34 | |||
| 35 | ppc_cached_irq_mask[word] |= (1 << (31-bit)); | ||
| 36 | out_be32(&siu_reg->sc_simask, ppc_cached_irq_mask[word]); | ||
| 37 | } | 33 | } |
| 38 | 34 | ||
| 39 | static void mpc8xx_mask_irq(struct irq_data *d) | 35 | static void mpc8xx_mask_irq(struct irq_data *d) |
| 40 | { | 36 | { |
| 41 | int bit, word; | 37 | mpc8xx_cached_irq_mask &= ~mpc8xx_irqd_to_bit(d); |
| 42 | unsigned int irq_nr = (unsigned int)irqd_to_hwirq(d); | 38 | out_be32(&siu_reg->sc_simask, mpc8xx_cached_irq_mask); |
| 43 | |||
| 44 | bit = irq_nr & 0x1f; | ||
| 45 | word = irq_nr >> 5; | ||
| 46 | |||
| 47 | ppc_cached_irq_mask[word] &= ~(1 << (31-bit)); | ||
| 48 | out_be32(&siu_reg->sc_simask, ppc_cached_irq_mask[word]); | ||
| 49 | } | 39 | } |
| 50 | 40 | ||
| 51 | static void mpc8xx_ack(struct irq_data *d) | 41 | static void mpc8xx_ack(struct irq_data *d) |
| 52 | { | 42 | { |
| 53 | int bit; | 43 | out_be32(&siu_reg->sc_sipend, mpc8xx_irqd_to_bit(d)); |
| 54 | unsigned int irq_nr = (unsigned int)irqd_to_hwirq(d); | ||
| 55 | |||
| 56 | bit = irq_nr & 0x1f; | ||
| 57 | out_be32(&siu_reg->sc_sipend, 1 << (31-bit)); | ||
| 58 | } | 44 | } |
| 59 | 45 | ||
| 60 | static void mpc8xx_end_irq(struct irq_data *d) | 46 | static void mpc8xx_end_irq(struct irq_data *d) |
| 61 | { | 47 | { |
| 62 | int bit, word; | 48 | mpc8xx_cached_irq_mask |= mpc8xx_irqd_to_bit(d); |
| 63 | unsigned int irq_nr = (unsigned int)irqd_to_hwirq(d); | 49 | out_be32(&siu_reg->sc_simask, mpc8xx_cached_irq_mask); |
| 64 | |||
| 65 | bit = irq_nr & 0x1f; | ||
| 66 | word = irq_nr >> 5; | ||
| 67 | |||
| 68 | ppc_cached_irq_mask[word] |= (1 << (31-bit)); | ||
| 69 | out_be32(&siu_reg->sc_simask, ppc_cached_irq_mask[word]); | ||
| 70 | } | 50 | } |
| 71 | 51 | ||
| 72 | static int mpc8xx_set_irq_type(struct irq_data *d, unsigned int flow_type) | 52 | static int mpc8xx_set_irq_type(struct irq_data *d, unsigned int flow_type) |
| 73 | { | 53 | { |
| 74 | if (flow_type & IRQ_TYPE_EDGE_FALLING) { | 54 | /* only external IRQ senses are programmable */ |
| 75 | irq_hw_number_t hw = (unsigned int)irqd_to_hwirq(d); | 55 | if ((flow_type & IRQ_TYPE_EDGE_FALLING) && !(irqd_to_hwirq(d) & 1)) { |
| 76 | unsigned int siel = in_be32(&siu_reg->sc_siel); | 56 | unsigned int siel = in_be32(&siu_reg->sc_siel); |
| 77 | 57 | siel |= mpc8xx_irqd_to_bit(d); | |
| 78 | /* only external IRQ senses are programmable */ | 58 | out_be32(&siu_reg->sc_siel, siel); |
| 79 | if ((hw & 1) == 0) { | 59 | __irq_set_handler_locked(d->irq, handle_edge_irq); |
| 80 | siel |= (0x80000000 >> hw); | ||
| 81 | out_be32(&siu_reg->sc_siel, siel); | ||
| 82 | __irq_set_handler_locked(d->irq, handle_edge_irq); | ||
| 83 | } | ||
| 84 | } | 60 | } |
| 85 | return 0; | 61 | return 0; |
| 86 | } | 62 | } |
| @@ -132,6 +108,9 @@ static int mpc8xx_pic_host_xlate(struct irq_domain *h, struct device_node *ct, | |||
| 132 | IRQ_TYPE_EDGE_FALLING, | 108 | IRQ_TYPE_EDGE_FALLING, |
| 133 | }; | 109 | }; |
| 134 | 110 | ||
| 111 | if (intspec[0] > 0x1f) | ||
| 112 | return 0; | ||
| 113 | |||
| 135 | *out_hwirq = intspec[0]; | 114 | *out_hwirq = intspec[0]; |
| 136 | if (intsize > 1 && intspec[1] < 4) | 115 | if (intsize > 1 && intspec[1] < 4) |
| 137 | *out_flags = map_pic_senses[intspec[1]]; | 116 | *out_flags = map_pic_senses[intspec[1]]; |
diff --git a/arch/powerpc/sysdev/mpic.c b/arch/powerpc/sysdev/mpic.c index 9ac71ebd2c40..395af1347749 100644 --- a/arch/powerpc/sysdev/mpic.c +++ b/arch/powerpc/sysdev/mpic.c | |||
| @@ -604,18 +604,14 @@ static struct mpic *mpic_find(unsigned int irq) | |||
| 604 | } | 604 | } |
| 605 | 605 | ||
| 606 | /* Determine if the linux irq is an IPI */ | 606 | /* Determine if the linux irq is an IPI */ |
| 607 | static unsigned int mpic_is_ipi(struct mpic *mpic, unsigned int irq) | 607 | static unsigned int mpic_is_ipi(struct mpic *mpic, unsigned int src) |
| 608 | { | 608 | { |
| 609 | unsigned int src = virq_to_hw(irq); | ||
| 610 | |||
| 611 | return (src >= mpic->ipi_vecs[0] && src <= mpic->ipi_vecs[3]); | 609 | return (src >= mpic->ipi_vecs[0] && src <= mpic->ipi_vecs[3]); |
| 612 | } | 610 | } |
| 613 | 611 | ||
| 614 | /* Determine if the linux irq is a timer */ | 612 | /* Determine if the linux irq is a timer */ |
| 615 | static unsigned int mpic_is_tm(struct mpic *mpic, unsigned int irq) | 613 | static unsigned int mpic_is_tm(struct mpic *mpic, unsigned int src) |
| 616 | { | 614 | { |
| 617 | unsigned int src = virq_to_hw(irq); | ||
| 618 | |||
| 619 | return (src >= mpic->timer_vecs[0] && src <= mpic->timer_vecs[7]); | 615 | return (src >= mpic->timer_vecs[0] && src <= mpic->timer_vecs[7]); |
| 620 | } | 616 | } |
| 621 | 617 | ||
| @@ -876,21 +872,45 @@ int mpic_set_irq_type(struct irq_data *d, unsigned int flow_type) | |||
| 876 | if (src >= mpic->num_sources) | 872 | if (src >= mpic->num_sources) |
| 877 | return -EINVAL; | 873 | return -EINVAL; |
| 878 | 874 | ||
| 875 | vold = mpic_irq_read(src, MPIC_INFO(IRQ_VECTOR_PRI)); | ||
| 876 | |||
| 877 | /* We don't support "none" type */ | ||
| 879 | if (flow_type == IRQ_TYPE_NONE) | 878 | if (flow_type == IRQ_TYPE_NONE) |
| 880 | if (mpic->senses && src < mpic->senses_count) | 879 | flow_type = IRQ_TYPE_DEFAULT; |
| 881 | flow_type = mpic->senses[src]; | 880 | |
| 882 | if (flow_type == IRQ_TYPE_NONE) | 881 | /* Default: read HW settings */ |
| 883 | flow_type = IRQ_TYPE_LEVEL_LOW; | 882 | if (flow_type == IRQ_TYPE_DEFAULT) { |
| 883 | switch(vold & (MPIC_INFO(VECPRI_POLARITY_MASK) | | ||
| 884 | MPIC_INFO(VECPRI_SENSE_MASK))) { | ||
| 885 | case MPIC_INFO(VECPRI_SENSE_EDGE) | | ||
| 886 | MPIC_INFO(VECPRI_POLARITY_POSITIVE): | ||
| 887 | flow_type = IRQ_TYPE_EDGE_RISING; | ||
| 888 | break; | ||
| 889 | case MPIC_INFO(VECPRI_SENSE_EDGE) | | ||
| 890 | MPIC_INFO(VECPRI_POLARITY_NEGATIVE): | ||
| 891 | flow_type = IRQ_TYPE_EDGE_FALLING; | ||
| 892 | break; | ||
| 893 | case MPIC_INFO(VECPRI_SENSE_LEVEL) | | ||
| 894 | MPIC_INFO(VECPRI_POLARITY_POSITIVE): | ||
| 895 | flow_type = IRQ_TYPE_LEVEL_HIGH; | ||
| 896 | break; | ||
| 897 | case MPIC_INFO(VECPRI_SENSE_LEVEL) | | ||
| 898 | MPIC_INFO(VECPRI_POLARITY_NEGATIVE): | ||
| 899 | flow_type = IRQ_TYPE_LEVEL_LOW; | ||
| 900 | break; | ||
| 901 | } | ||
| 902 | } | ||
| 884 | 903 | ||
| 904 | /* Apply to irq desc */ | ||
| 885 | irqd_set_trigger_type(d, flow_type); | 905 | irqd_set_trigger_type(d, flow_type); |
| 886 | 906 | ||
| 907 | /* Apply to HW */ | ||
| 887 | if (mpic_is_ht_interrupt(mpic, src)) | 908 | if (mpic_is_ht_interrupt(mpic, src)) |
| 888 | vecpri = MPIC_VECPRI_POLARITY_POSITIVE | | 909 | vecpri = MPIC_VECPRI_POLARITY_POSITIVE | |
| 889 | MPIC_VECPRI_SENSE_EDGE; | 910 | MPIC_VECPRI_SENSE_EDGE; |
| 890 | else | 911 | else |
| 891 | vecpri = mpic_type_to_vecpri(mpic, flow_type); | 912 | vecpri = mpic_type_to_vecpri(mpic, flow_type); |
| 892 | 913 | ||
| 893 | vold = mpic_irq_read(src, MPIC_INFO(IRQ_VECTOR_PRI)); | ||
| 894 | vnew = vold & ~(MPIC_INFO(VECPRI_POLARITY_MASK) | | 914 | vnew = vold & ~(MPIC_INFO(VECPRI_POLARITY_MASK) | |
| 895 | MPIC_INFO(VECPRI_SENSE_MASK)); | 915 | MPIC_INFO(VECPRI_SENSE_MASK)); |
| 896 | vnew |= vecpri; | 916 | vnew |= vecpri; |
| @@ -1026,7 +1046,7 @@ static int mpic_host_map(struct irq_domain *h, unsigned int virq, | |||
| 1026 | irq_set_chip_and_handler(virq, chip, handle_fasteoi_irq); | 1046 | irq_set_chip_and_handler(virq, chip, handle_fasteoi_irq); |
| 1027 | 1047 | ||
| 1028 | /* Set default irq type */ | 1048 | /* Set default irq type */ |
| 1029 | irq_set_irq_type(virq, IRQ_TYPE_NONE); | 1049 | irq_set_irq_type(virq, IRQ_TYPE_DEFAULT); |
| 1030 | 1050 | ||
| 1031 | /* If the MPIC was reset, then all vectors have already been | 1051 | /* If the MPIC was reset, then all vectors have already been |
| 1032 | * initialized. Otherwise, a per source lazy initialization | 1052 | * initialized. Otherwise, a per source lazy initialization |
| @@ -1417,12 +1437,6 @@ void __init mpic_assign_isu(struct mpic *mpic, unsigned int isu_num, | |||
| 1417 | mpic->num_sources = isu_first + mpic->isu_size; | 1437 | mpic->num_sources = isu_first + mpic->isu_size; |
| 1418 | } | 1438 | } |
| 1419 | 1439 | ||
| 1420 | void __init mpic_set_default_senses(struct mpic *mpic, u8 *senses, int count) | ||
| 1421 | { | ||
| 1422 | mpic->senses = senses; | ||
| 1423 | mpic->senses_count = count; | ||
| 1424 | } | ||
| 1425 | |||
| 1426 | void __init mpic_init(struct mpic *mpic) | 1440 | void __init mpic_init(struct mpic *mpic) |
| 1427 | { | 1441 | { |
| 1428 | int i, cpu; | 1442 | int i, cpu; |
| @@ -1555,12 +1569,12 @@ void mpic_irq_set_priority(unsigned int irq, unsigned int pri) | |||
| 1555 | return; | 1569 | return; |
| 1556 | 1570 | ||
| 1557 | raw_spin_lock_irqsave(&mpic_lock, flags); | 1571 | raw_spin_lock_irqsave(&mpic_lock, flags); |
| 1558 | if (mpic_is_ipi(mpic, irq)) { | 1572 | if (mpic_is_ipi(mpic, src)) { |
| 1559 | reg = mpic_ipi_read(src - mpic->ipi_vecs[0]) & | 1573 | reg = mpic_ipi_read(src - mpic->ipi_vecs[0]) & |
| 1560 | ~MPIC_VECPRI_PRIORITY_MASK; | 1574 | ~MPIC_VECPRI_PRIORITY_MASK; |
| 1561 | mpic_ipi_write(src - mpic->ipi_vecs[0], | 1575 | mpic_ipi_write(src - mpic->ipi_vecs[0], |
| 1562 | reg | (pri << MPIC_VECPRI_PRIORITY_SHIFT)); | 1576 | reg | (pri << MPIC_VECPRI_PRIORITY_SHIFT)); |
| 1563 | } else if (mpic_is_tm(mpic, irq)) { | 1577 | } else if (mpic_is_tm(mpic, src)) { |
| 1564 | reg = mpic_tm_read(src - mpic->timer_vecs[0]) & | 1578 | reg = mpic_tm_read(src - mpic->timer_vecs[0]) & |
| 1565 | ~MPIC_VECPRI_PRIORITY_MASK; | 1579 | ~MPIC_VECPRI_PRIORITY_MASK; |
| 1566 | mpic_tm_write(src - mpic->timer_vecs[0], | 1580 | mpic_tm_write(src - mpic->timer_vecs[0], |
diff --git a/arch/powerpc/sysdev/mpic_msgr.c b/arch/powerpc/sysdev/mpic_msgr.c index 6e7fa386e76a..483d8fa72e8b 100644 --- a/arch/powerpc/sysdev/mpic_msgr.c +++ b/arch/powerpc/sysdev/mpic_msgr.c | |||
| @@ -27,6 +27,7 @@ | |||
| 27 | 27 | ||
| 28 | static struct mpic_msgr **mpic_msgrs; | 28 | static struct mpic_msgr **mpic_msgrs; |
| 29 | static unsigned int mpic_msgr_count; | 29 | static unsigned int mpic_msgr_count; |
| 30 | static DEFINE_RAW_SPINLOCK(msgrs_lock); | ||
| 30 | 31 | ||
| 31 | static inline void _mpic_msgr_mer_write(struct mpic_msgr *msgr, u32 value) | 32 | static inline void _mpic_msgr_mer_write(struct mpic_msgr *msgr, u32 value) |
| 32 | { | 33 | { |
| @@ -56,12 +57,11 @@ struct mpic_msgr *mpic_msgr_get(unsigned int reg_num) | |||
| 56 | if (reg_num >= mpic_msgr_count) | 57 | if (reg_num >= mpic_msgr_count) |
| 57 | return ERR_PTR(-ENODEV); | 58 | return ERR_PTR(-ENODEV); |
| 58 | 59 | ||
| 59 | raw_spin_lock_irqsave(&msgr->lock, flags); | 60 | raw_spin_lock_irqsave(&msgrs_lock, flags); |
| 60 | if (mpic_msgrs[reg_num]->in_use == MSGR_FREE) { | 61 | msgr = mpic_msgrs[reg_num]; |
| 61 | msgr = mpic_msgrs[reg_num]; | 62 | if (msgr->in_use == MSGR_FREE) |
| 62 | msgr->in_use = MSGR_INUSE; | 63 | msgr->in_use = MSGR_INUSE; |
| 63 | } | 64 | raw_spin_unlock_irqrestore(&msgrs_lock, flags); |
| 64 | raw_spin_unlock_irqrestore(&msgr->lock, flags); | ||
| 65 | 65 | ||
| 66 | return msgr; | 66 | return msgr; |
| 67 | } | 67 | } |
| @@ -228,7 +228,7 @@ static __devinit int mpic_msgr_probe(struct platform_device *dev) | |||
| 228 | 228 | ||
| 229 | reg_number = block_number * MPIC_MSGR_REGISTERS_PER_BLOCK + i; | 229 | reg_number = block_number * MPIC_MSGR_REGISTERS_PER_BLOCK + i; |
| 230 | msgr->base = msgr_block_addr + i * MPIC_MSGR_STRIDE; | 230 | msgr->base = msgr_block_addr + i * MPIC_MSGR_STRIDE; |
| 231 | msgr->mer = msgr->base + MPIC_MSGR_MER_OFFSET; | 231 | msgr->mer = (u32 *)((u8 *)msgr->base + MPIC_MSGR_MER_OFFSET); |
| 232 | msgr->in_use = MSGR_FREE; | 232 | msgr->in_use = MSGR_FREE; |
| 233 | msgr->num = i; | 233 | msgr->num = i; |
| 234 | raw_spin_lock_init(&msgr->lock); | 234 | raw_spin_lock_init(&msgr->lock); |
diff --git a/arch/powerpc/sysdev/scom.c b/arch/powerpc/sysdev/scom.c index 49a3ece1c6b3..702256a1ca11 100644 --- a/arch/powerpc/sysdev/scom.c +++ b/arch/powerpc/sysdev/scom.c | |||
| @@ -22,6 +22,7 @@ | |||
| 22 | #include <linux/debugfs.h> | 22 | #include <linux/debugfs.h> |
| 23 | #include <linux/slab.h> | 23 | #include <linux/slab.h> |
| 24 | #include <linux/export.h> | 24 | #include <linux/export.h> |
| 25 | #include <asm/debug.h> | ||
| 25 | #include <asm/prom.h> | 26 | #include <asm/prom.h> |
| 26 | #include <asm/scom.h> | 27 | #include <asm/scom.h> |
| 27 | 28 | ||
diff --git a/arch/powerpc/sysdev/xics/xics-common.c b/arch/powerpc/sysdev/xics/xics-common.c index ea5e204e3450..cd1d18db92c6 100644 --- a/arch/powerpc/sysdev/xics/xics-common.c +++ b/arch/powerpc/sysdev/xics/xics-common.c | |||
| @@ -188,6 +188,7 @@ void xics_migrate_irqs_away(void) | |||
| 188 | { | 188 | { |
| 189 | int cpu = smp_processor_id(), hw_cpu = hard_smp_processor_id(); | 189 | int cpu = smp_processor_id(), hw_cpu = hard_smp_processor_id(); |
| 190 | unsigned int irq, virq; | 190 | unsigned int irq, virq; |
| 191 | struct irq_desc *desc; | ||
| 191 | 192 | ||
| 192 | /* If we used to be the default server, move to the new "boot_cpuid" */ | 193 | /* If we used to be the default server, move to the new "boot_cpuid" */ |
| 193 | if (hw_cpu == xics_default_server) | 194 | if (hw_cpu == xics_default_server) |
| @@ -202,8 +203,7 @@ void xics_migrate_irqs_away(void) | |||
| 202 | /* Allow IPIs again... */ | 203 | /* Allow IPIs again... */ |
| 203 | icp_ops->set_priority(DEFAULT_PRIORITY); | 204 | icp_ops->set_priority(DEFAULT_PRIORITY); |
| 204 | 205 | ||
| 205 | for_each_irq(virq) { | 206 | for_each_irq_desc(virq, desc) { |
| 206 | struct irq_desc *desc; | ||
| 207 | struct irq_chip *chip; | 207 | struct irq_chip *chip; |
| 208 | long server; | 208 | long server; |
| 209 | unsigned long flags; | 209 | unsigned long flags; |
| @@ -212,9 +212,8 @@ void xics_migrate_irqs_away(void) | |||
| 212 | /* We can't set affinity on ISA interrupts */ | 212 | /* We can't set affinity on ISA interrupts */ |
| 213 | if (virq < NUM_ISA_INTERRUPTS) | 213 | if (virq < NUM_ISA_INTERRUPTS) |
| 214 | continue; | 214 | continue; |
| 215 | desc = irq_to_desc(virq); | ||
| 216 | /* We only need to migrate enabled IRQS */ | 215 | /* We only need to migrate enabled IRQS */ |
| 217 | if (!desc || !desc->action) | 216 | if (!desc->action) |
| 218 | continue; | 217 | continue; |
| 219 | if (desc->irq_data.domain != xics_host) | 218 | if (desc->irq_data.domain != xics_host) |
| 220 | continue; | 219 | continue; |
diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig index 2b7c0fbe578e..9015060919a0 100644 --- a/arch/s390/Kconfig +++ b/arch/s390/Kconfig | |||
| @@ -90,7 +90,6 @@ config S390 | |||
| 90 | select HAVE_KERNEL_XZ | 90 | select HAVE_KERNEL_XZ |
| 91 | select HAVE_ARCH_MUTEX_CPU_RELAX | 91 | select HAVE_ARCH_MUTEX_CPU_RELAX |
| 92 | select HAVE_ARCH_JUMP_LABEL if !MARCH_G5 | 92 | select HAVE_ARCH_JUMP_LABEL if !MARCH_G5 |
| 93 | select HAVE_RCU_TABLE_FREE if SMP | ||
| 94 | select ARCH_SAVE_PAGE_KEYS if HIBERNATION | 93 | select ARCH_SAVE_PAGE_KEYS if HIBERNATION |
| 95 | select HAVE_MEMBLOCK | 94 | select HAVE_MEMBLOCK |
| 96 | select HAVE_MEMBLOCK_NODE_MAP | 95 | select HAVE_MEMBLOCK_NODE_MAP |
diff --git a/arch/s390/defconfig b/arch/s390/defconfig index 6cf8e26b3137..1957a9dd256d 100644 --- a/arch/s390/defconfig +++ b/arch/s390/defconfig | |||
| @@ -1,8 +1,12 @@ | |||
| 1 | CONFIG_EXPERIMENTAL=y | 1 | CONFIG_EXPERIMENTAL=y |
| 2 | CONFIG_SYSVIPC=y | 2 | CONFIG_SYSVIPC=y |
| 3 | CONFIG_POSIX_MQUEUE=y | 3 | CONFIG_POSIX_MQUEUE=y |
| 4 | CONFIG_FHANDLE=y | ||
| 5 | CONFIG_TASKSTATS=y | ||
| 6 | CONFIG_TASK_DELAY_ACCT=y | ||
| 7 | CONFIG_TASK_XACCT=y | ||
| 8 | CONFIG_TASK_IO_ACCOUNTING=y | ||
| 4 | CONFIG_AUDIT=y | 9 | CONFIG_AUDIT=y |
| 5 | CONFIG_RCU_TRACE=y | ||
| 6 | CONFIG_IKCONFIG=y | 10 | CONFIG_IKCONFIG=y |
| 7 | CONFIG_IKCONFIG_PROC=y | 11 | CONFIG_IKCONFIG_PROC=y |
| 8 | CONFIG_CGROUPS=y | 12 | CONFIG_CGROUPS=y |
| @@ -14,16 +18,22 @@ CONFIG_CGROUP_MEM_RES_CTLR_SWAP=y | |||
| 14 | CONFIG_CGROUP_SCHED=y | 18 | CONFIG_CGROUP_SCHED=y |
| 15 | CONFIG_RT_GROUP_SCHED=y | 19 | CONFIG_RT_GROUP_SCHED=y |
| 16 | CONFIG_BLK_CGROUP=y | 20 | CONFIG_BLK_CGROUP=y |
| 21 | CONFIG_NAMESPACES=y | ||
| 17 | CONFIG_BLK_DEV_INITRD=y | 22 | CONFIG_BLK_DEV_INITRD=y |
| 18 | # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set | 23 | CONFIG_RD_BZIP2=y |
| 24 | CONFIG_RD_LZMA=y | ||
| 25 | CONFIG_RD_XZ=y | ||
| 26 | CONFIG_RD_LZO=y | ||
| 27 | CONFIG_EXPERT=y | ||
| 19 | # CONFIG_COMPAT_BRK is not set | 28 | # CONFIG_COMPAT_BRK is not set |
| 20 | CONFIG_SLAB=y | ||
| 21 | CONFIG_PROFILING=y | 29 | CONFIG_PROFILING=y |
| 22 | CONFIG_OPROFILE=y | 30 | CONFIG_OPROFILE=y |
| 23 | CONFIG_KPROBES=y | 31 | CONFIG_KPROBES=y |
| 24 | CONFIG_MODULES=y | 32 | CONFIG_MODULES=y |
| 25 | CONFIG_MODULE_UNLOAD=y | 33 | CONFIG_MODULE_UNLOAD=y |
| 26 | CONFIG_MODVERSIONS=y | 34 | CONFIG_MODVERSIONS=y |
| 35 | CONFIG_PARTITION_ADVANCED=y | ||
| 36 | CONFIG_IBM_PARTITION=y | ||
| 27 | CONFIG_DEFAULT_DEADLINE=y | 37 | CONFIG_DEFAULT_DEADLINE=y |
| 28 | CONFIG_NO_HZ=y | 38 | CONFIG_NO_HZ=y |
| 29 | CONFIG_HIGH_RES_TIMERS=y | 39 | CONFIG_HIGH_RES_TIMERS=y |
| @@ -34,18 +44,15 @@ CONFIG_KSM=y | |||
| 34 | CONFIG_BINFMT_MISC=m | 44 | CONFIG_BINFMT_MISC=m |
| 35 | CONFIG_CMM=m | 45 | CONFIG_CMM=m |
| 36 | CONFIG_HZ_100=y | 46 | CONFIG_HZ_100=y |
| 37 | CONFIG_KEXEC=y | 47 | CONFIG_CRASH_DUMP=y |
| 38 | CONFIG_PM=y | ||
| 39 | CONFIG_HIBERNATION=y | 48 | CONFIG_HIBERNATION=y |
| 40 | CONFIG_PACKET=y | 49 | CONFIG_PACKET=y |
| 41 | CONFIG_UNIX=y | 50 | CONFIG_UNIX=y |
| 42 | CONFIG_NET_KEY=y | 51 | CONFIG_NET_KEY=y |
| 43 | CONFIG_AFIUCV=m | ||
| 44 | CONFIG_INET=y | 52 | CONFIG_INET=y |
| 45 | CONFIG_IP_MULTICAST=y | 53 | CONFIG_IP_MULTICAST=y |
| 46 | # CONFIG_INET_LRO is not set | 54 | # CONFIG_INET_LRO is not set |
| 47 | CONFIG_IPV6=y | 55 | CONFIG_IPV6=y |
| 48 | CONFIG_NET_SCTPPROBE=m | ||
| 49 | CONFIG_L2TP=m | 56 | CONFIG_L2TP=m |
| 50 | CONFIG_L2TP_DEBUGFS=m | 57 | CONFIG_L2TP_DEBUGFS=m |
| 51 | CONFIG_VLAN_8021Q=y | 58 | CONFIG_VLAN_8021Q=y |
| @@ -84,15 +91,14 @@ CONFIG_SCSI_CONSTANTS=y | |||
| 84 | CONFIG_SCSI_LOGGING=y | 91 | CONFIG_SCSI_LOGGING=y |
| 85 | CONFIG_SCSI_SCAN_ASYNC=y | 92 | CONFIG_SCSI_SCAN_ASYNC=y |
| 86 | CONFIG_ZFCP=y | 93 | CONFIG_ZFCP=y |
| 87 | CONFIG_ZFCP_DIF=y | ||
| 88 | CONFIG_NETDEVICES=y | 94 | CONFIG_NETDEVICES=y |
| 89 | CONFIG_DUMMY=m | ||
| 90 | CONFIG_BONDING=m | 95 | CONFIG_BONDING=m |
| 96 | CONFIG_DUMMY=m | ||
| 91 | CONFIG_EQUALIZER=m | 97 | CONFIG_EQUALIZER=m |
| 92 | CONFIG_TUN=m | 98 | CONFIG_TUN=m |
| 93 | CONFIG_NET_ETHERNET=y | ||
| 94 | CONFIG_VIRTIO_NET=y | 99 | CONFIG_VIRTIO_NET=y |
| 95 | CONFIG_RAW_DRIVER=m | 100 | CONFIG_RAW_DRIVER=m |
| 101 | CONFIG_VIRTIO_BALLOON=y | ||
| 96 | CONFIG_EXT2_FS=y | 102 | CONFIG_EXT2_FS=y |
| 97 | CONFIG_EXT3_FS=y | 103 | CONFIG_EXT3_FS=y |
| 98 | # CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set | 104 | # CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set |
| @@ -103,27 +109,21 @@ CONFIG_PROC_KCORE=y | |||
| 103 | CONFIG_TMPFS=y | 109 | CONFIG_TMPFS=y |
| 104 | CONFIG_TMPFS_POSIX_ACL=y | 110 | CONFIG_TMPFS_POSIX_ACL=y |
| 105 | # CONFIG_NETWORK_FILESYSTEMS is not set | 111 | # CONFIG_NETWORK_FILESYSTEMS is not set |
| 106 | CONFIG_PARTITION_ADVANCED=y | ||
| 107 | CONFIG_IBM_PARTITION=y | ||
| 108 | CONFIG_DLM=m | ||
| 109 | CONFIG_MAGIC_SYSRQ=y | 112 | CONFIG_MAGIC_SYSRQ=y |
| 110 | CONFIG_DEBUG_KERNEL=y | ||
| 111 | CONFIG_TIMER_STATS=y | 113 | CONFIG_TIMER_STATS=y |
| 112 | CONFIG_PROVE_LOCKING=y | 114 | CONFIG_PROVE_LOCKING=y |
| 113 | CONFIG_PROVE_RCU=y | 115 | CONFIG_PROVE_RCU=y |
| 114 | CONFIG_LOCK_STAT=y | 116 | CONFIG_LOCK_STAT=y |
| 115 | CONFIG_DEBUG_LOCKDEP=y | 117 | CONFIG_DEBUG_LOCKDEP=y |
| 116 | CONFIG_DEBUG_SPINLOCK_SLEEP=y | ||
| 117 | CONFIG_DEBUG_LIST=y | 118 | CONFIG_DEBUG_LIST=y |
| 118 | CONFIG_DEBUG_NOTIFIERS=y | 119 | CONFIG_DEBUG_NOTIFIERS=y |
| 119 | # CONFIG_RCU_CPU_STALL_DETECTOR is not set | 120 | CONFIG_RCU_TRACE=y |
| 120 | CONFIG_KPROBES_SANITY_TEST=y | 121 | CONFIG_KPROBES_SANITY_TEST=y |
| 121 | CONFIG_DEBUG_FORCE_WEAK_PER_CPU=y | 122 | CONFIG_DEBUG_FORCE_WEAK_PER_CPU=y |
| 122 | CONFIG_CPU_NOTIFIER_ERROR_INJECT=m | 123 | CONFIG_CPU_NOTIFIER_ERROR_INJECT=m |
| 123 | CONFIG_LATENCYTOP=y | 124 | CONFIG_LATENCYTOP=y |
| 124 | CONFIG_SYSCTL_SYSCALL_CHECK=y | ||
| 125 | CONFIG_DEBUG_PAGEALLOC=y | 125 | CONFIG_DEBUG_PAGEALLOC=y |
| 126 | # CONFIG_FTRACE is not set | 126 | CONFIG_BLK_DEV_IO_TRACE=y |
| 127 | # CONFIG_STRICT_DEVMEM is not set | 127 | # CONFIG_STRICT_DEVMEM is not set |
| 128 | CONFIG_CRYPTO_NULL=m | 128 | CONFIG_CRYPTO_NULL=m |
| 129 | CONFIG_CRYPTO_CRYPTD=m | 129 | CONFIG_CRYPTO_CRYPTD=m |
| @@ -173,4 +173,3 @@ CONFIG_CRYPTO_SHA512_S390=m | |||
| 173 | CONFIG_CRYPTO_DES_S390=m | 173 | CONFIG_CRYPTO_DES_S390=m |
| 174 | CONFIG_CRYPTO_AES_S390=m | 174 | CONFIG_CRYPTO_AES_S390=m |
| 175 | CONFIG_CRC7=m | 175 | CONFIG_CRC7=m |
| 176 | CONFIG_VIRTIO_BALLOON=y | ||
diff --git a/arch/s390/include/asm/facility.h b/arch/s390/include/asm/facility.h index 1e5b27edc0c9..2ee66a65f2d4 100644 --- a/arch/s390/include/asm/facility.h +++ b/arch/s390/include/asm/facility.h | |||
| @@ -38,12 +38,11 @@ static inline void stfle(u64 *stfle_fac_list, int size) | |||
| 38 | unsigned long nr; | 38 | unsigned long nr; |
| 39 | 39 | ||
| 40 | preempt_disable(); | 40 | preempt_disable(); |
| 41 | S390_lowcore.stfl_fac_list = 0; | ||
| 42 | asm volatile( | 41 | asm volatile( |
| 43 | " .insn s,0xb2b10000,0(0)\n" /* stfl */ | 42 | " .insn s,0xb2b10000,0(0)\n" /* stfl */ |
| 44 | "0:\n" | 43 | "0:\n" |
| 45 | EX_TABLE(0b, 0b) | 44 | EX_TABLE(0b, 0b) |
| 46 | : "=m" (S390_lowcore.stfl_fac_list)); | 45 | : "+m" (S390_lowcore.stfl_fac_list)); |
| 47 | nr = 4; /* bytes stored by stfl */ | 46 | nr = 4; /* bytes stored by stfl */ |
| 48 | memcpy(stfle_fac_list, &S390_lowcore.stfl_fac_list, 4); | 47 | memcpy(stfle_fac_list, &S390_lowcore.stfl_fac_list, 4); |
| 49 | if (S390_lowcore.stfl_fac_list & 0x01000000) { | 48 | if (S390_lowcore.stfl_fac_list & 0x01000000) { |
diff --git a/arch/s390/include/asm/pgalloc.h b/arch/s390/include/asm/pgalloc.h index 8eef9b5b3cf4..78e3041919de 100644 --- a/arch/s390/include/asm/pgalloc.h +++ b/arch/s390/include/asm/pgalloc.h | |||
| @@ -22,10 +22,7 @@ void crst_table_free(struct mm_struct *, unsigned long *); | |||
| 22 | 22 | ||
| 23 | unsigned long *page_table_alloc(struct mm_struct *, unsigned long); | 23 | unsigned long *page_table_alloc(struct mm_struct *, unsigned long); |
| 24 | void page_table_free(struct mm_struct *, unsigned long *); | 24 | void page_table_free(struct mm_struct *, unsigned long *); |
| 25 | #ifdef CONFIG_HAVE_RCU_TABLE_FREE | ||
| 26 | void page_table_free_rcu(struct mmu_gather *, unsigned long *); | 25 | void page_table_free_rcu(struct mmu_gather *, unsigned long *); |
| 27 | void __tlb_remove_table(void *_table); | ||
| 28 | #endif | ||
| 29 | 26 | ||
| 30 | static inline void clear_table(unsigned long *s, unsigned long val, size_t n) | 27 | static inline void clear_table(unsigned long *s, unsigned long val, size_t n) |
| 31 | { | 28 | { |
diff --git a/arch/s390/include/asm/swab.h b/arch/s390/include/asm/swab.h index 6bdee21c077e..a3e4ebb32090 100644 --- a/arch/s390/include/asm/swab.h +++ b/arch/s390/include/asm/swab.h | |||
| @@ -77,7 +77,7 @@ static inline __u16 __arch_swab16p(const __u16 *x) | |||
| 77 | 77 | ||
| 78 | asm volatile( | 78 | asm volatile( |
| 79 | #ifndef __s390x__ | 79 | #ifndef __s390x__ |
| 80 | " icm %0,2,%O+1(%R1)\n" | 80 | " icm %0,2,%O1+1(%R1)\n" |
| 81 | " ic %0,%1\n" | 81 | " ic %0,%1\n" |
| 82 | : "=&d" (result) : "Q" (*x) : "cc"); | 82 | : "=&d" (result) : "Q" (*x) : "cc"); |
| 83 | #else /* __s390x__ */ | 83 | #else /* __s390x__ */ |
diff --git a/arch/s390/include/asm/tlb.h b/arch/s390/include/asm/tlb.h index c687a2c83462..775a5eea8f9e 100644 --- a/arch/s390/include/asm/tlb.h +++ b/arch/s390/include/asm/tlb.h | |||
| @@ -30,14 +30,10 @@ | |||
| 30 | 30 | ||
| 31 | struct mmu_gather { | 31 | struct mmu_gather { |
| 32 | struct mm_struct *mm; | 32 | struct mm_struct *mm; |
| 33 | #ifdef CONFIG_HAVE_RCU_TABLE_FREE | ||
| 34 | struct mmu_table_batch *batch; | 33 | struct mmu_table_batch *batch; |
| 35 | #endif | ||
| 36 | unsigned int fullmm; | 34 | unsigned int fullmm; |
| 37 | unsigned int need_flush; | ||
| 38 | }; | 35 | }; |
| 39 | 36 | ||
| 40 | #ifdef CONFIG_HAVE_RCU_TABLE_FREE | ||
| 41 | struct mmu_table_batch { | 37 | struct mmu_table_batch { |
| 42 | struct rcu_head rcu; | 38 | struct rcu_head rcu; |
| 43 | unsigned int nr; | 39 | unsigned int nr; |
| @@ -49,7 +45,6 @@ struct mmu_table_batch { | |||
| 49 | 45 | ||
| 50 | extern void tlb_table_flush(struct mmu_gather *tlb); | 46 | extern void tlb_table_flush(struct mmu_gather *tlb); |
| 51 | extern void tlb_remove_table(struct mmu_gather *tlb, void *table); | 47 | extern void tlb_remove_table(struct mmu_gather *tlb, void *table); |
| 52 | #endif | ||
| 53 | 48 | ||
| 54 | static inline void tlb_gather_mmu(struct mmu_gather *tlb, | 49 | static inline void tlb_gather_mmu(struct mmu_gather *tlb, |
| 55 | struct mm_struct *mm, | 50 | struct mm_struct *mm, |
| @@ -57,29 +52,20 @@ static inline void tlb_gather_mmu(struct mmu_gather *tlb, | |||
| 57 | { | 52 | { |
| 58 | tlb->mm = mm; | 53 | tlb->mm = mm; |
| 59 | tlb->fullmm = full_mm_flush; | 54 | tlb->fullmm = full_mm_flush; |
| 60 | tlb->need_flush = 0; | ||
| 61 | #ifdef CONFIG_HAVE_RCU_TABLE_FREE | ||
| 62 | tlb->batch = NULL; | 55 | tlb->batch = NULL; |
| 63 | #endif | ||
| 64 | if (tlb->fullmm) | 56 | if (tlb->fullmm) |
| 65 | __tlb_flush_mm(mm); | 57 | __tlb_flush_mm(mm); |
| 66 | } | 58 | } |
| 67 | 59 | ||
| 68 | static inline void tlb_flush_mmu(struct mmu_gather *tlb) | 60 | static inline void tlb_flush_mmu(struct mmu_gather *tlb) |
| 69 | { | 61 | { |
| 70 | if (!tlb->need_flush) | ||
| 71 | return; | ||
| 72 | tlb->need_flush = 0; | ||
| 73 | __tlb_flush_mm(tlb->mm); | ||
| 74 | #ifdef CONFIG_HAVE_RCU_TABLE_FREE | ||
| 75 | tlb_table_flush(tlb); | 62 | tlb_table_flush(tlb); |
| 76 | #endif | ||
| 77 | } | 63 | } |
| 78 | 64 | ||
| 79 | static inline void tlb_finish_mmu(struct mmu_gather *tlb, | 65 | static inline void tlb_finish_mmu(struct mmu_gather *tlb, |
| 80 | unsigned long start, unsigned long end) | 66 | unsigned long start, unsigned long end) |
| 81 | { | 67 | { |
| 82 | tlb_flush_mmu(tlb); | 68 | tlb_table_flush(tlb); |
| 83 | } | 69 | } |
| 84 | 70 | ||
| 85 | /* | 71 | /* |
| @@ -105,10 +91,8 @@ static inline void tlb_remove_page(struct mmu_gather *tlb, struct page *page) | |||
| 105 | static inline void pte_free_tlb(struct mmu_gather *tlb, pgtable_t pte, | 91 | static inline void pte_free_tlb(struct mmu_gather *tlb, pgtable_t pte, |
| 106 | unsigned long address) | 92 | unsigned long address) |
| 107 | { | 93 | { |
| 108 | #ifdef CONFIG_HAVE_RCU_TABLE_FREE | ||
| 109 | if (!tlb->fullmm) | 94 | if (!tlb->fullmm) |
| 110 | return page_table_free_rcu(tlb, (unsigned long *) pte); | 95 | return page_table_free_rcu(tlb, (unsigned long *) pte); |
| 111 | #endif | ||
| 112 | page_table_free(tlb->mm, (unsigned long *) pte); | 96 | page_table_free(tlb->mm, (unsigned long *) pte); |
| 113 | } | 97 | } |
| 114 | 98 | ||
| @@ -125,10 +109,8 @@ static inline void pmd_free_tlb(struct mmu_gather *tlb, pmd_t *pmd, | |||
| 125 | #ifdef __s390x__ | 109 | #ifdef __s390x__ |
| 126 | if (tlb->mm->context.asce_limit <= (1UL << 31)) | 110 | if (tlb->mm->context.asce_limit <= (1UL << 31)) |
| 127 | return; | 111 | return; |
| 128 | #ifdef CONFIG_HAVE_RCU_TABLE_FREE | ||
| 129 | if (!tlb->fullmm) | 112 | if (!tlb->fullmm) |
| 130 | return tlb_remove_table(tlb, pmd); | 113 | return tlb_remove_table(tlb, pmd); |
| 131 | #endif | ||
| 132 | crst_table_free(tlb->mm, (unsigned long *) pmd); | 114 | crst_table_free(tlb->mm, (unsigned long *) pmd); |
| 133 | #endif | 115 | #endif |
| 134 | } | 116 | } |
| @@ -146,10 +128,8 @@ static inline void pud_free_tlb(struct mmu_gather *tlb, pud_t *pud, | |||
| 146 | #ifdef __s390x__ | 128 | #ifdef __s390x__ |
| 147 | if (tlb->mm->context.asce_limit <= (1UL << 42)) | 129 | if (tlb->mm->context.asce_limit <= (1UL << 42)) |
| 148 | return; | 130 | return; |
| 149 | #ifdef CONFIG_HAVE_RCU_TABLE_FREE | ||
| 150 | if (!tlb->fullmm) | 131 | if (!tlb->fullmm) |
| 151 | return tlb_remove_table(tlb, pud); | 132 | return tlb_remove_table(tlb, pud); |
| 152 | #endif | ||
| 153 | crst_table_free(tlb->mm, (unsigned long *) pud); | 133 | crst_table_free(tlb->mm, (unsigned long *) pud); |
| 154 | #endif | 134 | #endif |
| 155 | } | 135 | } |
diff --git a/arch/s390/kernel/head.S b/arch/s390/kernel/head.S index c27a0727f930..adccd908ebc7 100644 --- a/arch/s390/kernel/head.S +++ b/arch/s390/kernel/head.S | |||
| @@ -474,9 +474,9 @@ ENTRY(startup_kdump) | |||
| 474 | stck __LC_LAST_UPDATE_CLOCK | 474 | stck __LC_LAST_UPDATE_CLOCK |
| 475 | spt 5f-.LPG0(%r13) | 475 | spt 5f-.LPG0(%r13) |
| 476 | mvc __LC_LAST_UPDATE_TIMER(8),5f-.LPG0(%r13) | 476 | mvc __LC_LAST_UPDATE_TIMER(8),5f-.LPG0(%r13) |
| 477 | xc __LC_STFL_FAC_LIST(8),__LC_STFL_FAC_LIST | ||
| 477 | #ifndef CONFIG_MARCH_G5 | 478 | #ifndef CONFIG_MARCH_G5 |
| 478 | # check capabilities against MARCH_{G5,Z900,Z990,Z9_109,Z10} | 479 | # check capabilities against MARCH_{G5,Z900,Z990,Z9_109,Z10} |
| 479 | xc __LC_STFL_FAC_LIST(8),__LC_STFL_FAC_LIST | ||
| 480 | .insn s,0xb2b10000,__LC_STFL_FAC_LIST # store facility list | 480 | .insn s,0xb2b10000,__LC_STFL_FAC_LIST # store facility list |
| 481 | tm __LC_STFL_FAC_LIST,0x01 # stfle available ? | 481 | tm __LC_STFL_FAC_LIST,0x01 # stfle available ? |
| 482 | jz 0f | 482 | jz 0f |
diff --git a/arch/s390/kernel/irq.c b/arch/s390/kernel/irq.c index 1c2cdd59ccd0..8a22c27219dd 100644 --- a/arch/s390/kernel/irq.c +++ b/arch/s390/kernel/irq.c | |||
| @@ -118,9 +118,10 @@ asmlinkage void do_softirq(void) | |||
| 118 | "a" (__do_softirq) | 118 | "a" (__do_softirq) |
| 119 | : "0", "1", "2", "3", "4", "5", "14", | 119 | : "0", "1", "2", "3", "4", "5", "14", |
| 120 | "cc", "memory" ); | 120 | "cc", "memory" ); |
| 121 | } else | 121 | } else { |
| 122 | /* We are already on the async stack. */ | 122 | /* We are already on the async stack. */ |
| 123 | __do_softirq(); | 123 | __do_softirq(); |
| 124 | } | ||
| 124 | } | 125 | } |
| 125 | 126 | ||
| 126 | local_irq_restore(flags); | 127 | local_irq_restore(flags); |
| @@ -192,11 +193,12 @@ int unregister_external_interrupt(u16 code, ext_int_handler_t handler) | |||
| 192 | int index = ext_hash(code); | 193 | int index = ext_hash(code); |
| 193 | 194 | ||
| 194 | spin_lock_irqsave(&ext_int_hash_lock, flags); | 195 | spin_lock_irqsave(&ext_int_hash_lock, flags); |
| 195 | list_for_each_entry_rcu(p, &ext_int_hash[index], entry) | 196 | list_for_each_entry_rcu(p, &ext_int_hash[index], entry) { |
| 196 | if (p->code == code && p->handler == handler) { | 197 | if (p->code == code && p->handler == handler) { |
| 197 | list_del_rcu(&p->entry); | 198 | list_del_rcu(&p->entry); |
| 198 | kfree_rcu(p, rcu); | 199 | kfree_rcu(p, rcu); |
| 199 | } | 200 | } |
| 201 | } | ||
| 200 | spin_unlock_irqrestore(&ext_int_hash_lock, flags); | 202 | spin_unlock_irqrestore(&ext_int_hash_lock, flags); |
| 201 | return 0; | 203 | return 0; |
| 202 | } | 204 | } |
| @@ -211,9 +213,10 @@ void __irq_entry do_extint(struct pt_regs *regs, struct ext_code ext_code, | |||
| 211 | 213 | ||
| 212 | old_regs = set_irq_regs(regs); | 214 | old_regs = set_irq_regs(regs); |
| 213 | irq_enter(); | 215 | irq_enter(); |
| 214 | if (S390_lowcore.int_clock >= S390_lowcore.clock_comparator) | 216 | if (S390_lowcore.int_clock >= S390_lowcore.clock_comparator) { |
| 215 | /* Serve timer interrupts first. */ | 217 | /* Serve timer interrupts first. */ |
| 216 | clock_comparator_work(); | 218 | clock_comparator_work(); |
| 219 | } | ||
| 217 | kstat_cpu(smp_processor_id()).irqs[EXTERNAL_INTERRUPT]++; | 220 | kstat_cpu(smp_processor_id()).irqs[EXTERNAL_INTERRUPT]++; |
| 218 | if (ext_code.code != 0x1004) | 221 | if (ext_code.code != 0x1004) |
| 219 | __get_cpu_var(s390_idle).nohz_delay = 1; | 222 | __get_cpu_var(s390_idle).nohz_delay = 1; |
diff --git a/arch/s390/kernel/perf_cpum_cf.c b/arch/s390/kernel/perf_cpum_cf.c index 46405086479c..cb019f429e88 100644 --- a/arch/s390/kernel/perf_cpum_cf.c +++ b/arch/s390/kernel/perf_cpum_cf.c | |||
| @@ -178,7 +178,7 @@ static void cpumf_pmu_enable(struct pmu *pmu) | |||
| 178 | err = lcctl(cpuhw->state); | 178 | err = lcctl(cpuhw->state); |
| 179 | if (err) { | 179 | if (err) { |
| 180 | pr_err("Enabling the performance measuring unit " | 180 | pr_err("Enabling the performance measuring unit " |
| 181 | "failed with rc=%lx\n", err); | 181 | "failed with rc=%x\n", err); |
| 182 | return; | 182 | return; |
| 183 | } | 183 | } |
| 184 | 184 | ||
| @@ -203,7 +203,7 @@ static void cpumf_pmu_disable(struct pmu *pmu) | |||
| 203 | err = lcctl(inactive); | 203 | err = lcctl(inactive); |
| 204 | if (err) { | 204 | if (err) { |
| 205 | pr_err("Disabling the performance measuring unit " | 205 | pr_err("Disabling the performance measuring unit " |
| 206 | "failed with rc=%lx\n", err); | 206 | "failed with rc=%x\n", err); |
| 207 | return; | 207 | return; |
| 208 | } | 208 | } |
| 209 | 209 | ||
diff --git a/arch/s390/mm/maccess.c b/arch/s390/mm/maccess.c index 7bb15fcca75e..e1335dc2b1b7 100644 --- a/arch/s390/mm/maccess.c +++ b/arch/s390/mm/maccess.c | |||
| @@ -61,21 +61,14 @@ long probe_kernel_write(void *dst, const void *src, size_t size) | |||
| 61 | return copied < 0 ? -EFAULT : 0; | 61 | return copied < 0 ? -EFAULT : 0; |
| 62 | } | 62 | } |
| 63 | 63 | ||
| 64 | /* | 64 | static int __memcpy_real(void *dest, void *src, size_t count) |
| 65 | * Copy memory in real mode (kernel to kernel) | ||
| 66 | */ | ||
| 67 | int memcpy_real(void *dest, void *src, size_t count) | ||
| 68 | { | 65 | { |
| 69 | register unsigned long _dest asm("2") = (unsigned long) dest; | 66 | register unsigned long _dest asm("2") = (unsigned long) dest; |
| 70 | register unsigned long _len1 asm("3") = (unsigned long) count; | 67 | register unsigned long _len1 asm("3") = (unsigned long) count; |
| 71 | register unsigned long _src asm("4") = (unsigned long) src; | 68 | register unsigned long _src asm("4") = (unsigned long) src; |
| 72 | register unsigned long _len2 asm("5") = (unsigned long) count; | 69 | register unsigned long _len2 asm("5") = (unsigned long) count; |
| 73 | unsigned long flags; | ||
| 74 | int rc = -EFAULT; | 70 | int rc = -EFAULT; |
| 75 | 71 | ||
| 76 | if (!count) | ||
| 77 | return 0; | ||
| 78 | flags = __arch_local_irq_stnsm(0xf8UL); | ||
| 79 | asm volatile ( | 72 | asm volatile ( |
| 80 | "0: mvcle %1,%2,0x0\n" | 73 | "0: mvcle %1,%2,0x0\n" |
| 81 | "1: jo 0b\n" | 74 | "1: jo 0b\n" |
| @@ -86,7 +79,23 @@ int memcpy_real(void *dest, void *src, size_t count) | |||
| 86 | "+d" (_len2), "=m" (*((long *) dest)) | 79 | "+d" (_len2), "=m" (*((long *) dest)) |
| 87 | : "m" (*((long *) src)) | 80 | : "m" (*((long *) src)) |
| 88 | : "cc", "memory"); | 81 | : "cc", "memory"); |
| 89 | arch_local_irq_restore(flags); | 82 | return rc; |
| 83 | } | ||
| 84 | |||
| 85 | /* | ||
| 86 | * Copy memory in real mode (kernel to kernel) | ||
| 87 | */ | ||
| 88 | int memcpy_real(void *dest, void *src, size_t count) | ||
| 89 | { | ||
| 90 | unsigned long flags; | ||
| 91 | int rc; | ||
| 92 | |||
| 93 | if (!count) | ||
| 94 | return 0; | ||
| 95 | local_irq_save(flags); | ||
| 96 | __arch_local_irq_stnsm(0xfbUL); | ||
| 97 | rc = __memcpy_real(dest, src, count); | ||
| 98 | local_irq_restore(flags); | ||
| 90 | return rc; | 99 | return rc; |
| 91 | } | 100 | } |
| 92 | 101 | ||
diff --git a/arch/s390/mm/pgtable.c b/arch/s390/mm/pgtable.c index 373adf69b01c..6e765bf00670 100644 --- a/arch/s390/mm/pgtable.c +++ b/arch/s390/mm/pgtable.c | |||
| @@ -678,8 +678,6 @@ void page_table_free(struct mm_struct *mm, unsigned long *table) | |||
| 678 | } | 678 | } |
| 679 | } | 679 | } |
| 680 | 680 | ||
| 681 | #ifdef CONFIG_HAVE_RCU_TABLE_FREE | ||
| 682 | |||
| 683 | static void __page_table_free_rcu(void *table, unsigned bit) | 681 | static void __page_table_free_rcu(void *table, unsigned bit) |
| 684 | { | 682 | { |
| 685 | struct page *page; | 683 | struct page *page; |
| @@ -733,7 +731,66 @@ void __tlb_remove_table(void *_table) | |||
| 733 | free_pages((unsigned long) table, ALLOC_ORDER); | 731 | free_pages((unsigned long) table, ALLOC_ORDER); |
| 734 | } | 732 | } |
| 735 | 733 | ||
| 736 | #endif | 734 | static void tlb_remove_table_smp_sync(void *arg) |
| 735 | { | ||
| 736 | /* Simply deliver the interrupt */ | ||
| 737 | } | ||
| 738 | |||
| 739 | static void tlb_remove_table_one(void *table) | ||
| 740 | { | ||
| 741 | /* | ||
| 742 | * This isn't an RCU grace period and hence the page-tables cannot be | ||
| 743 | * assumed to be actually RCU-freed. | ||
| 744 | * | ||
| 745 | * It is however sufficient for software page-table walkers that rely | ||
| 746 | * on IRQ disabling. See the comment near struct mmu_table_batch. | ||
| 747 | */ | ||
| 748 | smp_call_function(tlb_remove_table_smp_sync, NULL, 1); | ||
| 749 | __tlb_remove_table(table); | ||
| 750 | } | ||
| 751 | |||
| 752 | static void tlb_remove_table_rcu(struct rcu_head *head) | ||
| 753 | { | ||
| 754 | struct mmu_table_batch *batch; | ||
| 755 | int i; | ||
| 756 | |||
| 757 | batch = container_of(head, struct mmu_table_batch, rcu); | ||
| 758 | |||
| 759 | for (i = 0; i < batch->nr; i++) | ||
| 760 | __tlb_remove_table(batch->tables[i]); | ||
| 761 | |||
| 762 | free_page((unsigned long)batch); | ||
| 763 | } | ||
| 764 | |||
| 765 | void tlb_table_flush(struct mmu_gather *tlb) | ||
| 766 | { | ||
| 767 | struct mmu_table_batch **batch = &tlb->batch; | ||
| 768 | |||
| 769 | if (*batch) { | ||
| 770 | __tlb_flush_mm(tlb->mm); | ||
| 771 | call_rcu_sched(&(*batch)->rcu, tlb_remove_table_rcu); | ||
| 772 | *batch = NULL; | ||
| 773 | } | ||
| 774 | } | ||
| 775 | |||
| 776 | void tlb_remove_table(struct mmu_gather *tlb, void *table) | ||
| 777 | { | ||
| 778 | struct mmu_table_batch **batch = &tlb->batch; | ||
| 779 | |||
| 780 | if (*batch == NULL) { | ||
| 781 | *batch = (struct mmu_table_batch *) | ||
| 782 | __get_free_page(GFP_NOWAIT | __GFP_NOWARN); | ||
| 783 | if (*batch == NULL) { | ||
| 784 | __tlb_flush_mm(tlb->mm); | ||
| 785 | tlb_remove_table_one(table); | ||
| 786 | return; | ||
| 787 | } | ||
| 788 | (*batch)->nr = 0; | ||
| 789 | } | ||
| 790 | (*batch)->tables[(*batch)->nr++] = table; | ||
| 791 | if ((*batch)->nr == MAX_TABLE_BATCH) | ||
| 792 | tlb_table_flush(tlb); | ||
| 793 | } | ||
| 737 | 794 | ||
| 738 | /* | 795 | /* |
| 739 | * switch on pgstes for its userspace process (for kvm) | 796 | * switch on pgstes for its userspace process (for kvm) |
diff --git a/arch/sh/include/asm/atomic.h b/arch/sh/include/asm/atomic.h index 37f2f4a55231..f4c1c20bcdf6 100644 --- a/arch/sh/include/asm/atomic.h +++ b/arch/sh/include/asm/atomic.h | |||
| @@ -11,7 +11,7 @@ | |||
| 11 | #include <linux/types.h> | 11 | #include <linux/types.h> |
| 12 | #include <asm/cmpxchg.h> | 12 | #include <asm/cmpxchg.h> |
| 13 | 13 | ||
| 14 | #define ATOMIC_INIT(i) ( (atomic_t) { (i) } ) | 14 | #define ATOMIC_INIT(i) { (i) } |
| 15 | 15 | ||
| 16 | #define atomic_read(v) (*(volatile int *)&(v)->counter) | 16 | #define atomic_read(v) (*(volatile int *)&(v)->counter) |
| 17 | #define atomic_set(v,i) ((v)->counter = (i)) | 17 | #define atomic_set(v,i) ((v)->counter = (i)) |
diff --git a/arch/sh/mm/fault_32.c b/arch/sh/mm/fault_32.c index 324eef93c900..e99b104d967a 100644 --- a/arch/sh/mm/fault_32.c +++ b/arch/sh/mm/fault_32.c | |||
| @@ -86,7 +86,7 @@ static noinline int vmalloc_fault(unsigned long address) | |||
| 86 | pte_t *pte_k; | 86 | pte_t *pte_k; |
| 87 | 87 | ||
| 88 | /* Make sure we are in vmalloc/module/P3 area: */ | 88 | /* Make sure we are in vmalloc/module/P3 area: */ |
| 89 | if (!(address >= VMALLOC_START && address < P3_ADDR_MAX)) | 89 | if (!(address >= P3SEG && address < P3_ADDR_MAX)) |
| 90 | return -1; | 90 | return -1; |
| 91 | 91 | ||
| 92 | /* | 92 | /* |
diff --git a/arch/sparc/kernel/leon_smp.c b/arch/sparc/kernel/leon_smp.c index 1210fde18740..160cac9c4036 100644 --- a/arch/sparc/kernel/leon_smp.c +++ b/arch/sparc/kernel/leon_smp.c | |||
| @@ -23,6 +23,7 @@ | |||
| 23 | #include <linux/pm.h> | 23 | #include <linux/pm.h> |
| 24 | #include <linux/delay.h> | 24 | #include <linux/delay.h> |
| 25 | #include <linux/gfp.h> | 25 | #include <linux/gfp.h> |
| 26 | #include <linux/cpu.h> | ||
| 26 | 27 | ||
| 27 | #include <asm/cacheflush.h> | 28 | #include <asm/cacheflush.h> |
| 28 | #include <asm/tlbflush.h> | 29 | #include <asm/tlbflush.h> |
| @@ -78,6 +79,8 @@ void __cpuinit leon_callin(void) | |||
| 78 | local_flush_tlb_all(); | 79 | local_flush_tlb_all(); |
| 79 | leon_configure_cache_smp(); | 80 | leon_configure_cache_smp(); |
| 80 | 81 | ||
| 82 | notify_cpu_starting(cpuid); | ||
| 83 | |||
| 81 | /* Get our local ticker going. */ | 84 | /* Get our local ticker going. */ |
| 82 | smp_setup_percpu_timer(); | 85 | smp_setup_percpu_timer(); |
| 83 | 86 | ||
diff --git a/arch/sparc/kernel/sys_sparc_64.c b/arch/sparc/kernel/sys_sparc_64.c index 232df9949530..3ee51f189a55 100644 --- a/arch/sparc/kernel/sys_sparc_64.c +++ b/arch/sparc/kernel/sys_sparc_64.c | |||
| @@ -566,15 +566,10 @@ out: | |||
| 566 | 566 | ||
| 567 | SYSCALL_DEFINE2(64_munmap, unsigned long, addr, size_t, len) | 567 | SYSCALL_DEFINE2(64_munmap, unsigned long, addr, size_t, len) |
| 568 | { | 568 | { |
| 569 | long ret; | ||
| 570 | |||
| 571 | if (invalid_64bit_range(addr, len)) | 569 | if (invalid_64bit_range(addr, len)) |
| 572 | return -EINVAL; | 570 | return -EINVAL; |
| 573 | 571 | ||
| 574 | down_write(¤t->mm->mmap_sem); | 572 | return vm_munmap(addr, len); |
| 575 | ret = do_munmap(current->mm, addr, len); | ||
| 576 | up_write(¤t->mm->mmap_sem); | ||
| 577 | return ret; | ||
| 578 | } | 573 | } |
| 579 | 574 | ||
| 580 | extern unsigned long do_mremap(unsigned long addr, | 575 | extern unsigned long do_mremap(unsigned long addr, |
diff --git a/arch/tile/include/asm/pci.h b/arch/tile/include/asm/pci.h index 5d5a635530bd..32e6cbe8dff3 100644 --- a/arch/tile/include/asm/pci.h +++ b/arch/tile/include/asm/pci.h | |||
| @@ -47,8 +47,8 @@ struct pci_controller { | |||
| 47 | */ | 47 | */ |
| 48 | #define PCI_DMA_BUS_IS_PHYS 1 | 48 | #define PCI_DMA_BUS_IS_PHYS 1 |
| 49 | 49 | ||
| 50 | int __devinit tile_pci_init(void); | 50 | int __init tile_pci_init(void); |
| 51 | int __devinit pcibios_init(void); | 51 | int __init pcibios_init(void); |
| 52 | 52 | ||
| 53 | static inline void pci_iounmap(struct pci_dev *dev, void __iomem *addr) {} | 53 | static inline void pci_iounmap(struct pci_dev *dev, void __iomem *addr) {} |
| 54 | 54 | ||
diff --git a/arch/tile/kernel/pci.c b/arch/tile/kernel/pci.c index a1bb59eecc18..b56d12bf5900 100644 --- a/arch/tile/kernel/pci.c +++ b/arch/tile/kernel/pci.c | |||
| @@ -141,7 +141,7 @@ static int __devinit tile_init_irqs(int controller_id, | |||
| 141 | * | 141 | * |
| 142 | * Returns the number of controllers discovered. | 142 | * Returns the number of controllers discovered. |
| 143 | */ | 143 | */ |
| 144 | int __devinit tile_pci_init(void) | 144 | int __init tile_pci_init(void) |
| 145 | { | 145 | { |
| 146 | int i; | 146 | int i; |
| 147 | 147 | ||
| @@ -287,7 +287,7 @@ static void __devinit fixup_read_and_payload_sizes(void) | |||
| 287 | * The controllers have been set up by the time we get here, by a call to | 287 | * The controllers have been set up by the time we get here, by a call to |
| 288 | * tile_pci_init. | 288 | * tile_pci_init. |
| 289 | */ | 289 | */ |
| 290 | int __devinit pcibios_init(void) | 290 | int __init pcibios_init(void) |
| 291 | { | 291 | { |
| 292 | int i; | 292 | int i; |
| 293 | 293 | ||
diff --git a/arch/tile/kernel/single_step.c b/arch/tile/kernel/single_step.c index 9efbc1391b3c..89529c9f0605 100644 --- a/arch/tile/kernel/single_step.c +++ b/arch/tile/kernel/single_step.c | |||
| @@ -346,12 +346,10 @@ void single_step_once(struct pt_regs *regs) | |||
| 346 | } | 346 | } |
| 347 | 347 | ||
| 348 | /* allocate a cache line of writable, executable memory */ | 348 | /* allocate a cache line of writable, executable memory */ |
| 349 | down_write(¤t->mm->mmap_sem); | 349 | buffer = (void __user *) vm_mmap(NULL, 0, 64, |
| 350 | buffer = (void __user *) do_mmap(NULL, 0, 64, | ||
| 351 | PROT_EXEC | PROT_READ | PROT_WRITE, | 350 | PROT_EXEC | PROT_READ | PROT_WRITE, |
| 352 | MAP_PRIVATE | MAP_ANONYMOUS, | 351 | MAP_PRIVATE | MAP_ANONYMOUS, |
| 353 | 0); | 352 | 0); |
| 354 | up_write(¤t->mm->mmap_sem); | ||
| 355 | 353 | ||
| 356 | if (IS_ERR((void __force *)buffer)) { | 354 | if (IS_ERR((void __force *)buffer)) { |
| 357 | kfree(state); | 355 | kfree(state); |
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 1d14cc6b79ad..c9866b0b77d8 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig | |||
| @@ -81,7 +81,7 @@ config X86 | |||
| 81 | select CLKEVT_I8253 | 81 | select CLKEVT_I8253 |
| 82 | select ARCH_HAVE_NMI_SAFE_CMPXCHG | 82 | select ARCH_HAVE_NMI_SAFE_CMPXCHG |
| 83 | select GENERIC_IOMAP | 83 | select GENERIC_IOMAP |
| 84 | select DCACHE_WORD_ACCESS if !DEBUG_PAGEALLOC | 84 | select DCACHE_WORD_ACCESS |
| 85 | 85 | ||
| 86 | config INSTRUCTION_DECODER | 86 | config INSTRUCTION_DECODER |
| 87 | def_bool (KPROBES || PERF_EVENTS) | 87 | def_bool (KPROBES || PERF_EVENTS) |
diff --git a/arch/x86/boot/compressed/head_32.S b/arch/x86/boot/compressed/head_32.S index a0559930a180..c85e3ac99bba 100644 --- a/arch/x86/boot/compressed/head_32.S +++ b/arch/x86/boot/compressed/head_32.S | |||
| @@ -33,6 +33,9 @@ | |||
| 33 | __HEAD | 33 | __HEAD |
| 34 | ENTRY(startup_32) | 34 | ENTRY(startup_32) |
| 35 | #ifdef CONFIG_EFI_STUB | 35 | #ifdef CONFIG_EFI_STUB |
| 36 | jmp preferred_addr | ||
| 37 | |||
| 38 | .balign 0x10 | ||
| 36 | /* | 39 | /* |
| 37 | * We don't need the return address, so set up the stack so | 40 | * We don't need the return address, so set up the stack so |
| 38 | * efi_main() can find its arugments. | 41 | * efi_main() can find its arugments. |
| @@ -41,12 +44,17 @@ ENTRY(startup_32) | |||
| 41 | 44 | ||
| 42 | call efi_main | 45 | call efi_main |
| 43 | cmpl $0, %eax | 46 | cmpl $0, %eax |
| 44 | je preferred_addr | ||
| 45 | movl %eax, %esi | 47 | movl %eax, %esi |
| 46 | call 1f | 48 | jne 2f |
| 47 | 1: | 49 | 1: |
| 50 | /* EFI init failed, so hang. */ | ||
| 51 | hlt | ||
| 52 | jmp 1b | ||
| 53 | 2: | ||
| 54 | call 3f | ||
| 55 | 3: | ||
| 48 | popl %eax | 56 | popl %eax |
| 49 | subl $1b, %eax | 57 | subl $3b, %eax |
| 50 | subl BP_pref_address(%esi), %eax | 58 | subl BP_pref_address(%esi), %eax |
| 51 | add BP_code32_start(%esi), %eax | 59 | add BP_code32_start(%esi), %eax |
| 52 | leal preferred_addr(%eax), %eax | 60 | leal preferred_addr(%eax), %eax |
diff --git a/arch/x86/boot/compressed/head_64.S b/arch/x86/boot/compressed/head_64.S index 558d76ce23bc..87e03a13d8e3 100644 --- a/arch/x86/boot/compressed/head_64.S +++ b/arch/x86/boot/compressed/head_64.S | |||
| @@ -200,18 +200,28 @@ ENTRY(startup_64) | |||
| 200 | * entire text+data+bss and hopefully all of memory. | 200 | * entire text+data+bss and hopefully all of memory. |
| 201 | */ | 201 | */ |
| 202 | #ifdef CONFIG_EFI_STUB | 202 | #ifdef CONFIG_EFI_STUB |
| 203 | pushq %rsi | 203 | /* |
| 204 | * The entry point for the PE/COFF executable is 0x210, so only | ||
| 205 | * legacy boot loaders will execute this jmp. | ||
| 206 | */ | ||
| 207 | jmp preferred_addr | ||
| 208 | |||
| 209 | .org 0x210 | ||
| 204 | mov %rcx, %rdi | 210 | mov %rcx, %rdi |
| 205 | mov %rdx, %rsi | 211 | mov %rdx, %rsi |
| 206 | call efi_main | 212 | call efi_main |
| 207 | popq %rsi | ||
| 208 | cmpq $0,%rax | ||
| 209 | je preferred_addr | ||
| 210 | movq %rax,%rsi | 213 | movq %rax,%rsi |
| 211 | call 1f | 214 | cmpq $0,%rax |
| 215 | jne 2f | ||
| 212 | 1: | 216 | 1: |
| 217 | /* EFI init failed, so hang. */ | ||
| 218 | hlt | ||
| 219 | jmp 1b | ||
| 220 | 2: | ||
| 221 | call 3f | ||
| 222 | 3: | ||
| 213 | popq %rax | 223 | popq %rax |
| 214 | subq $1b, %rax | 224 | subq $3b, %rax |
| 215 | subq BP_pref_address(%rsi), %rax | 225 | subq BP_pref_address(%rsi), %rax |
| 216 | add BP_code32_start(%esi), %eax | 226 | add BP_code32_start(%esi), %eax |
| 217 | leaq preferred_addr(%rax), %rax | 227 | leaq preferred_addr(%rax), %rax |
diff --git a/arch/x86/boot/compressed/relocs.c b/arch/x86/boot/compressed/relocs.c index d3c0b0277666..fb7117a4ade1 100644 --- a/arch/x86/boot/compressed/relocs.c +++ b/arch/x86/boot/compressed/relocs.c | |||
| @@ -403,13 +403,11 @@ static void print_absolute_symbols(void) | |||
| 403 | for (i = 0; i < ehdr.e_shnum; i++) { | 403 | for (i = 0; i < ehdr.e_shnum; i++) { |
| 404 | struct section *sec = &secs[i]; | 404 | struct section *sec = &secs[i]; |
| 405 | char *sym_strtab; | 405 | char *sym_strtab; |
| 406 | Elf32_Sym *sh_symtab; | ||
| 407 | int j; | 406 | int j; |
| 408 | 407 | ||
| 409 | if (sec->shdr.sh_type != SHT_SYMTAB) { | 408 | if (sec->shdr.sh_type != SHT_SYMTAB) { |
| 410 | continue; | 409 | continue; |
| 411 | } | 410 | } |
| 412 | sh_symtab = sec->symtab; | ||
| 413 | sym_strtab = sec->link->strtab; | 411 | sym_strtab = sec->link->strtab; |
| 414 | for (j = 0; j < sec->shdr.sh_size/sizeof(Elf32_Sym); j++) { | 412 | for (j = 0; j < sec->shdr.sh_size/sizeof(Elf32_Sym); j++) { |
| 415 | Elf32_Sym *sym; | 413 | Elf32_Sym *sym; |
diff --git a/arch/x86/boot/tools/build.c b/arch/x86/boot/tools/build.c index ed549767a231..24443a332083 100644 --- a/arch/x86/boot/tools/build.c +++ b/arch/x86/boot/tools/build.c | |||
| @@ -205,8 +205,13 @@ int main(int argc, char ** argv) | |||
| 205 | put_unaligned_le32(file_sz, &buf[pe_header + 0x50]); | 205 | put_unaligned_le32(file_sz, &buf[pe_header + 0x50]); |
| 206 | 206 | ||
| 207 | #ifdef CONFIG_X86_32 | 207 | #ifdef CONFIG_X86_32 |
| 208 | /* Address of entry point */ | 208 | /* |
| 209 | put_unaligned_le32(i, &buf[pe_header + 0x28]); | 209 | * Address of entry point. |
| 210 | * | ||
| 211 | * The EFI stub entry point is +16 bytes from the start of | ||
| 212 | * the .text section. | ||
| 213 | */ | ||
| 214 | put_unaligned_le32(i + 16, &buf[pe_header + 0x28]); | ||
| 210 | 215 | ||
| 211 | /* .text size */ | 216 | /* .text size */ |
| 212 | put_unaligned_le32(file_sz, &buf[pe_header + 0xb0]); | 217 | put_unaligned_le32(file_sz, &buf[pe_header + 0xb0]); |
| @@ -217,9 +222,11 @@ int main(int argc, char ** argv) | |||
| 217 | /* | 222 | /* |
| 218 | * Address of entry point. startup_32 is at the beginning and | 223 | * Address of entry point. startup_32 is at the beginning and |
| 219 | * the 64-bit entry point (startup_64) is always 512 bytes | 224 | * the 64-bit entry point (startup_64) is always 512 bytes |
| 220 | * after. | 225 | * after. The EFI stub entry point is 16 bytes after that, as |
| 226 | * the first instruction allows legacy loaders to jump over | ||
| 227 | * the EFI stub initialisation | ||
| 221 | */ | 228 | */ |
| 222 | put_unaligned_le32(i + 512, &buf[pe_header + 0x28]); | 229 | put_unaligned_le32(i + 528, &buf[pe_header + 0x28]); |
| 223 | 230 | ||
| 224 | /* .text size */ | 231 | /* .text size */ |
| 225 | put_unaligned_le32(file_sz, &buf[pe_header + 0xc0]); | 232 | put_unaligned_le32(file_sz, &buf[pe_header + 0xc0]); |
diff --git a/arch/x86/ia32/ia32_aout.c b/arch/x86/ia32/ia32_aout.c index d511d951a052..07b3a68d2d29 100644 --- a/arch/x86/ia32/ia32_aout.c +++ b/arch/x86/ia32/ia32_aout.c | |||
| @@ -119,9 +119,7 @@ static void set_brk(unsigned long start, unsigned long end) | |||
| 119 | end = PAGE_ALIGN(end); | 119 | end = PAGE_ALIGN(end); |
| 120 | if (end <= start) | 120 | if (end <= start) |
| 121 | return; | 121 | return; |
| 122 | down_write(¤t->mm->mmap_sem); | 122 | vm_brk(start, end - start); |
| 123 | do_brk(start, end - start); | ||
| 124 | up_write(¤t->mm->mmap_sem); | ||
| 125 | } | 123 | } |
| 126 | 124 | ||
| 127 | #ifdef CORE_DUMP | 125 | #ifdef CORE_DUMP |
| @@ -296,8 +294,7 @@ static int load_aout_binary(struct linux_binprm *bprm, struct pt_regs *regs) | |||
| 296 | 294 | ||
| 297 | /* OK, This is the point of no return */ | 295 | /* OK, This is the point of no return */ |
| 298 | set_personality(PER_LINUX); | 296 | set_personality(PER_LINUX); |
| 299 | set_thread_flag(TIF_IA32); | 297 | set_personality_ia32(false); |
| 300 | current->mm->context.ia32_compat = 1; | ||
| 301 | 298 | ||
| 302 | setup_new_exec(bprm); | 299 | setup_new_exec(bprm); |
| 303 | 300 | ||
| @@ -332,9 +329,7 @@ static int load_aout_binary(struct linux_binprm *bprm, struct pt_regs *regs) | |||
| 332 | pos = 32; | 329 | pos = 32; |
| 333 | map_size = ex.a_text+ex.a_data; | 330 | map_size = ex.a_text+ex.a_data; |
| 334 | 331 | ||
| 335 | down_write(¤t->mm->mmap_sem); | 332 | error = vm_brk(text_addr & PAGE_MASK, map_size); |
| 336 | error = do_brk(text_addr & PAGE_MASK, map_size); | ||
| 337 | up_write(¤t->mm->mmap_sem); | ||
| 338 | 333 | ||
| 339 | if (error != (text_addr & PAGE_MASK)) { | 334 | if (error != (text_addr & PAGE_MASK)) { |
| 340 | send_sig(SIGKILL, current, 0); | 335 | send_sig(SIGKILL, current, 0); |
| @@ -373,9 +368,7 @@ static int load_aout_binary(struct linux_binprm *bprm, struct pt_regs *regs) | |||
| 373 | if (!bprm->file->f_op->mmap || (fd_offset & ~PAGE_MASK) != 0) { | 368 | if (!bprm->file->f_op->mmap || (fd_offset & ~PAGE_MASK) != 0) { |
| 374 | loff_t pos = fd_offset; | 369 | loff_t pos = fd_offset; |
| 375 | 370 | ||
| 376 | down_write(¤t->mm->mmap_sem); | 371 | vm_brk(N_TXTADDR(ex), ex.a_text+ex.a_data); |
| 377 | do_brk(N_TXTADDR(ex), ex.a_text+ex.a_data); | ||
| 378 | up_write(¤t->mm->mmap_sem); | ||
| 379 | bprm->file->f_op->read(bprm->file, | 372 | bprm->file->f_op->read(bprm->file, |
| 380 | (char __user *)N_TXTADDR(ex), | 373 | (char __user *)N_TXTADDR(ex), |
| 381 | ex.a_text+ex.a_data, &pos); | 374 | ex.a_text+ex.a_data, &pos); |
| @@ -385,26 +378,22 @@ static int load_aout_binary(struct linux_binprm *bprm, struct pt_regs *regs) | |||
| 385 | goto beyond_if; | 378 | goto beyond_if; |
| 386 | } | 379 | } |
| 387 | 380 | ||
| 388 | down_write(¤t->mm->mmap_sem); | 381 | error = vm_mmap(bprm->file, N_TXTADDR(ex), ex.a_text, |
| 389 | error = do_mmap(bprm->file, N_TXTADDR(ex), ex.a_text, | ||
| 390 | PROT_READ | PROT_EXEC, | 382 | PROT_READ | PROT_EXEC, |
| 391 | MAP_FIXED | MAP_PRIVATE | MAP_DENYWRITE | | 383 | MAP_FIXED | MAP_PRIVATE | MAP_DENYWRITE | |
| 392 | MAP_EXECUTABLE | MAP_32BIT, | 384 | MAP_EXECUTABLE | MAP_32BIT, |
| 393 | fd_offset); | 385 | fd_offset); |
| 394 | up_write(¤t->mm->mmap_sem); | ||
| 395 | 386 | ||
| 396 | if (error != N_TXTADDR(ex)) { | 387 | if (error != N_TXTADDR(ex)) { |
| 397 | send_sig(SIGKILL, current, 0); | 388 | send_sig(SIGKILL, current, 0); |
| 398 | return error; | 389 | return error; |
| 399 | } | 390 | } |
| 400 | 391 | ||
| 401 | down_write(¤t->mm->mmap_sem); | 392 | error = vm_mmap(bprm->file, N_DATADDR(ex), ex.a_data, |
| 402 | error = do_mmap(bprm->file, N_DATADDR(ex), ex.a_data, | ||
| 403 | PROT_READ | PROT_WRITE | PROT_EXEC, | 393 | PROT_READ | PROT_WRITE | PROT_EXEC, |
| 404 | MAP_FIXED | MAP_PRIVATE | MAP_DENYWRITE | | 394 | MAP_FIXED | MAP_PRIVATE | MAP_DENYWRITE | |
| 405 | MAP_EXECUTABLE | MAP_32BIT, | 395 | MAP_EXECUTABLE | MAP_32BIT, |
| 406 | fd_offset + ex.a_text); | 396 | fd_offset + ex.a_text); |
| 407 | up_write(¤t->mm->mmap_sem); | ||
| 408 | if (error != N_DATADDR(ex)) { | 397 | if (error != N_DATADDR(ex)) { |
| 409 | send_sig(SIGKILL, current, 0); | 398 | send_sig(SIGKILL, current, 0); |
| 410 | return error; | 399 | return error; |
| @@ -476,9 +465,7 @@ static int load_aout_library(struct file *file) | |||
| 476 | error_time = jiffies; | 465 | error_time = jiffies; |
| 477 | } | 466 | } |
| 478 | #endif | 467 | #endif |
| 479 | down_write(¤t->mm->mmap_sem); | 468 | vm_brk(start_addr, ex.a_text + ex.a_data + ex.a_bss); |
| 480 | do_brk(start_addr, ex.a_text + ex.a_data + ex.a_bss); | ||
| 481 | up_write(¤t->mm->mmap_sem); | ||
| 482 | 469 | ||
| 483 | file->f_op->read(file, (char __user *)start_addr, | 470 | file->f_op->read(file, (char __user *)start_addr, |
| 484 | ex.a_text + ex.a_data, &pos); | 471 | ex.a_text + ex.a_data, &pos); |
| @@ -490,12 +477,10 @@ static int load_aout_library(struct file *file) | |||
| 490 | goto out; | 477 | goto out; |
| 491 | } | 478 | } |
| 492 | /* Now use mmap to map the library into memory. */ | 479 | /* Now use mmap to map the library into memory. */ |
| 493 | down_write(¤t->mm->mmap_sem); | 480 | error = vm_mmap(file, start_addr, ex.a_text + ex.a_data, |
| 494 | error = do_mmap(file, start_addr, ex.a_text + ex.a_data, | ||
| 495 | PROT_READ | PROT_WRITE | PROT_EXEC, | 481 | PROT_READ | PROT_WRITE | PROT_EXEC, |
| 496 | MAP_FIXED | MAP_PRIVATE | MAP_DENYWRITE | MAP_32BIT, | 482 | MAP_FIXED | MAP_PRIVATE | MAP_DENYWRITE | MAP_32BIT, |
| 497 | N_TXTOFF(ex)); | 483 | N_TXTOFF(ex)); |
| 498 | up_write(¤t->mm->mmap_sem); | ||
| 499 | retval = error; | 484 | retval = error; |
| 500 | if (error != start_addr) | 485 | if (error != start_addr) |
| 501 | goto out; | 486 | goto out; |
| @@ -503,9 +488,7 @@ static int load_aout_library(struct file *file) | |||
| 503 | len = PAGE_ALIGN(ex.a_text + ex.a_data); | 488 | len = PAGE_ALIGN(ex.a_text + ex.a_data); |
| 504 | bss = ex.a_text + ex.a_data + ex.a_bss; | 489 | bss = ex.a_text + ex.a_data + ex.a_bss; |
| 505 | if (bss > len) { | 490 | if (bss > len) { |
| 506 | down_write(¤t->mm->mmap_sem); | 491 | error = vm_brk(start_addr + len, bss - len); |
| 507 | error = do_brk(start_addr + len, bss - len); | ||
| 508 | up_write(¤t->mm->mmap_sem); | ||
| 509 | retval = error; | 492 | retval = error; |
| 510 | if (error != start_addr + len) | 493 | if (error != start_addr + len) |
| 511 | goto out; | 494 | goto out; |
diff --git a/arch/x86/include/asm/posix_types.h b/arch/x86/include/asm/posix_types.h index 3427b7798dbc..7ef7c3020e5c 100644 --- a/arch/x86/include/asm/posix_types.h +++ b/arch/x86/include/asm/posix_types.h | |||
| @@ -7,9 +7,9 @@ | |||
| 7 | #else | 7 | #else |
| 8 | # ifdef __i386__ | 8 | # ifdef __i386__ |
| 9 | # include "posix_types_32.h" | 9 | # include "posix_types_32.h" |
| 10 | # elif defined(__LP64__) | 10 | # elif defined(__ILP32__) |
| 11 | # include "posix_types_64.h" | ||
| 12 | # else | ||
| 13 | # include "posix_types_x32.h" | 11 | # include "posix_types_x32.h" |
| 12 | # else | ||
| 13 | # include "posix_types_64.h" | ||
| 14 | # endif | 14 | # endif |
| 15 | #endif | 15 | #endif |
diff --git a/arch/x86/include/asm/sigcontext.h b/arch/x86/include/asm/sigcontext.h index 4a085383af27..5ca71c065eef 100644 --- a/arch/x86/include/asm/sigcontext.h +++ b/arch/x86/include/asm/sigcontext.h | |||
| @@ -257,7 +257,7 @@ struct sigcontext { | |||
| 257 | __u64 oldmask; | 257 | __u64 oldmask; |
| 258 | __u64 cr2; | 258 | __u64 cr2; |
| 259 | struct _fpstate __user *fpstate; /* zero when no FPU context */ | 259 | struct _fpstate __user *fpstate; /* zero when no FPU context */ |
| 260 | #ifndef __LP64__ | 260 | #ifdef __ILP32__ |
| 261 | __u32 __fpstate_pad; | 261 | __u32 __fpstate_pad; |
| 262 | #endif | 262 | #endif |
| 263 | __u64 reserved1[8]; | 263 | __u64 reserved1[8]; |
diff --git a/arch/x86/include/asm/siginfo.h b/arch/x86/include/asm/siginfo.h index fc1aa5535646..34c47b3341c0 100644 --- a/arch/x86/include/asm/siginfo.h +++ b/arch/x86/include/asm/siginfo.h | |||
| @@ -2,7 +2,13 @@ | |||
| 2 | #define _ASM_X86_SIGINFO_H | 2 | #define _ASM_X86_SIGINFO_H |
| 3 | 3 | ||
| 4 | #ifdef __x86_64__ | 4 | #ifdef __x86_64__ |
| 5 | # define __ARCH_SI_PREAMBLE_SIZE (4 * sizeof(int)) | 5 | # ifdef __ILP32__ /* x32 */ |
| 6 | typedef long long __kernel_si_clock_t __attribute__((aligned(4))); | ||
| 7 | # define __ARCH_SI_CLOCK_T __kernel_si_clock_t | ||
| 8 | # define __ARCH_SI_ATTRIBUTES __attribute__((aligned(8))) | ||
| 9 | # else /* x86-64 */ | ||
| 10 | # define __ARCH_SI_PREAMBLE_SIZE (4 * sizeof(int)) | ||
| 11 | # endif | ||
| 6 | #endif | 12 | #endif |
| 7 | 13 | ||
| 8 | #include <asm-generic/siginfo.h> | 14 | #include <asm-generic/siginfo.h> |
diff --git a/arch/x86/include/asm/unistd.h b/arch/x86/include/asm/unistd.h index 37cdc9d99bb1..4437001d8e3d 100644 --- a/arch/x86/include/asm/unistd.h +++ b/arch/x86/include/asm/unistd.h | |||
| @@ -63,10 +63,10 @@ | |||
| 63 | #else | 63 | #else |
| 64 | # ifdef __i386__ | 64 | # ifdef __i386__ |
| 65 | # include <asm/unistd_32.h> | 65 | # include <asm/unistd_32.h> |
| 66 | # elif defined(__LP64__) | 66 | # elif defined(__ILP32__) |
| 67 | # include <asm/unistd_64.h> | ||
| 68 | # else | ||
| 69 | # include <asm/unistd_x32.h> | 67 | # include <asm/unistd_x32.h> |
| 68 | # else | ||
| 69 | # include <asm/unistd_64.h> | ||
| 70 | # endif | 70 | # endif |
| 71 | #endif | 71 | #endif |
| 72 | 72 | ||
diff --git a/arch/x86/include/asm/word-at-a-time.h b/arch/x86/include/asm/word-at-a-time.h index 6fe6767b7124..e58f03b206c3 100644 --- a/arch/x86/include/asm/word-at-a-time.h +++ b/arch/x86/include/asm/word-at-a-time.h | |||
| @@ -43,4 +43,37 @@ static inline unsigned long has_zero(unsigned long a) | |||
| 43 | return ((a - REPEAT_BYTE(0x01)) & ~a) & REPEAT_BYTE(0x80); | 43 | return ((a - REPEAT_BYTE(0x01)) & ~a) & REPEAT_BYTE(0x80); |
| 44 | } | 44 | } |
| 45 | 45 | ||
| 46 | /* | ||
| 47 | * Load an unaligned word from kernel space. | ||
| 48 | * | ||
| 49 | * In the (very unlikely) case of the word being a page-crosser | ||
| 50 | * and the next page not being mapped, take the exception and | ||
| 51 | * return zeroes in the non-existing part. | ||
| 52 | */ | ||
| 53 | static inline unsigned long load_unaligned_zeropad(const void *addr) | ||
| 54 | { | ||
| 55 | unsigned long ret, dummy; | ||
| 56 | |||
| 57 | asm( | ||
| 58 | "1:\tmov %2,%0\n" | ||
| 59 | "2:\n" | ||
| 60 | ".section .fixup,\"ax\"\n" | ||
| 61 | "3:\t" | ||
| 62 | "lea %2,%1\n\t" | ||
| 63 | "and %3,%1\n\t" | ||
| 64 | "mov (%1),%0\n\t" | ||
| 65 | "leal %2,%%ecx\n\t" | ||
| 66 | "andl %4,%%ecx\n\t" | ||
| 67 | "shll $3,%%ecx\n\t" | ||
| 68 | "shr %%cl,%0\n\t" | ||
| 69 | "jmp 2b\n" | ||
| 70 | ".previous\n" | ||
| 71 | _ASM_EXTABLE(1b, 3b) | ||
| 72 | :"=&r" (ret),"=&c" (dummy) | ||
| 73 | :"m" (*(unsigned long *)addr), | ||
| 74 | "i" (-sizeof(unsigned long)), | ||
| 75 | "i" (sizeof(unsigned long)-1)); | ||
| 76 | return ret; | ||
| 77 | } | ||
| 78 | |||
| 46 | #endif /* _ASM_WORD_AT_A_TIME_H */ | 79 | #endif /* _ASM_WORD_AT_A_TIME_H */ |
diff --git a/arch/x86/include/asm/x86_init.h b/arch/x86/include/asm/x86_init.h index baaca8defec8..764b66a4cf89 100644 --- a/arch/x86/include/asm/x86_init.h +++ b/arch/x86/include/asm/x86_init.h | |||
| @@ -195,6 +195,5 @@ extern struct x86_msi_ops x86_msi; | |||
| 195 | 195 | ||
| 196 | extern void x86_init_noop(void); | 196 | extern void x86_init_noop(void); |
| 197 | extern void x86_init_uint_noop(unsigned int unused); | 197 | extern void x86_init_uint_noop(unsigned int unused); |
| 198 | extern void x86_default_fixup_cpu_id(struct cpuinfo_x86 *c, int node); | ||
| 199 | 198 | ||
| 200 | #endif | 199 | #endif |
diff --git a/arch/x86/kernel/acpi/sleep.c b/arch/x86/kernel/acpi/sleep.c index 103b6ab368d3..146a49c763a4 100644 --- a/arch/x86/kernel/acpi/sleep.c +++ b/arch/x86/kernel/acpi/sleep.c | |||
| @@ -24,6 +24,10 @@ unsigned long acpi_realmode_flags; | |||
| 24 | static char temp_stack[4096]; | 24 | static char temp_stack[4096]; |
| 25 | #endif | 25 | #endif |
| 26 | 26 | ||
| 27 | asmlinkage void acpi_enter_s3(void) | ||
| 28 | { | ||
| 29 | acpi_enter_sleep_state(3, wake_sleep_flags); | ||
| 30 | } | ||
| 27 | /** | 31 | /** |
| 28 | * acpi_suspend_lowlevel - save kernel state | 32 | * acpi_suspend_lowlevel - save kernel state |
| 29 | * | 33 | * |
diff --git a/arch/x86/kernel/acpi/sleep.h b/arch/x86/kernel/acpi/sleep.h index 416d4be13fef..d68677a2a010 100644 --- a/arch/x86/kernel/acpi/sleep.h +++ b/arch/x86/kernel/acpi/sleep.h | |||
| @@ -3,12 +3,16 @@ | |||
| 3 | */ | 3 | */ |
| 4 | 4 | ||
| 5 | #include <asm/trampoline.h> | 5 | #include <asm/trampoline.h> |
| 6 | #include <linux/linkage.h> | ||
| 6 | 7 | ||
| 7 | extern unsigned long saved_video_mode; | 8 | extern unsigned long saved_video_mode; |
| 8 | extern long saved_magic; | 9 | extern long saved_magic; |
| 9 | 10 | ||
| 10 | extern int wakeup_pmode_return; | 11 | extern int wakeup_pmode_return; |
| 11 | 12 | ||
| 13 | extern u8 wake_sleep_flags; | ||
| 14 | extern asmlinkage void acpi_enter_s3(void); | ||
| 15 | |||
| 12 | extern unsigned long acpi_copy_wakeup_routine(unsigned long); | 16 | extern unsigned long acpi_copy_wakeup_routine(unsigned long); |
| 13 | extern void wakeup_long64(void); | 17 | extern void wakeup_long64(void); |
| 14 | 18 | ||
diff --git a/arch/x86/kernel/acpi/wakeup_32.S b/arch/x86/kernel/acpi/wakeup_32.S index 13ab720573e3..72610839f03b 100644 --- a/arch/x86/kernel/acpi/wakeup_32.S +++ b/arch/x86/kernel/acpi/wakeup_32.S | |||
| @@ -74,9 +74,7 @@ restore_registers: | |||
| 74 | ENTRY(do_suspend_lowlevel) | 74 | ENTRY(do_suspend_lowlevel) |
| 75 | call save_processor_state | 75 | call save_processor_state |
| 76 | call save_registers | 76 | call save_registers |
| 77 | pushl $3 | 77 | call acpi_enter_s3 |
| 78 | call acpi_enter_sleep_state | ||
| 79 | addl $4, %esp | ||
| 80 | 78 | ||
| 81 | # In case of S3 failure, we'll emerge here. Jump | 79 | # In case of S3 failure, we'll emerge here. Jump |
| 82 | # to ret_point to recover | 80 | # to ret_point to recover |
diff --git a/arch/x86/kernel/acpi/wakeup_64.S b/arch/x86/kernel/acpi/wakeup_64.S index 8ea5164cbd04..014d1d28c397 100644 --- a/arch/x86/kernel/acpi/wakeup_64.S +++ b/arch/x86/kernel/acpi/wakeup_64.S | |||
| @@ -71,9 +71,7 @@ ENTRY(do_suspend_lowlevel) | |||
| 71 | movq %rsi, saved_rsi | 71 | movq %rsi, saved_rsi |
| 72 | 72 | ||
| 73 | addq $8, %rsp | 73 | addq $8, %rsp |
| 74 | movl $3, %edi | 74 | call acpi_enter_s3 |
| 75 | xorl %eax, %eax | ||
| 76 | call acpi_enter_sleep_state | ||
| 77 | /* in case something went wrong, restore the machine status and go on */ | 75 | /* in case something went wrong, restore the machine status and go on */ |
| 78 | jmp resume_point | 76 | jmp resume_point |
| 79 | 77 | ||
diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c index 11544d8f1e97..edc24480469f 100644 --- a/arch/x86/kernel/apic/apic.c +++ b/arch/x86/kernel/apic/apic.c | |||
| @@ -1637,9 +1637,11 @@ static int __init apic_verify(void) | |||
| 1637 | mp_lapic_addr = APIC_DEFAULT_PHYS_BASE; | 1637 | mp_lapic_addr = APIC_DEFAULT_PHYS_BASE; |
| 1638 | 1638 | ||
| 1639 | /* The BIOS may have set up the APIC at some other address */ | 1639 | /* The BIOS may have set up the APIC at some other address */ |
| 1640 | rdmsr(MSR_IA32_APICBASE, l, h); | 1640 | if (boot_cpu_data.x86 >= 6) { |
| 1641 | if (l & MSR_IA32_APICBASE_ENABLE) | 1641 | rdmsr(MSR_IA32_APICBASE, l, h); |
| 1642 | mp_lapic_addr = l & MSR_IA32_APICBASE_BASE; | 1642 | if (l & MSR_IA32_APICBASE_ENABLE) |
| 1643 | mp_lapic_addr = l & MSR_IA32_APICBASE_BASE; | ||
| 1644 | } | ||
| 1643 | 1645 | ||
| 1644 | pr_info("Found and enabled local APIC!\n"); | 1646 | pr_info("Found and enabled local APIC!\n"); |
| 1645 | return 0; | 1647 | return 0; |
| @@ -1657,13 +1659,15 @@ int __init apic_force_enable(unsigned long addr) | |||
| 1657 | * MSR. This can only be done in software for Intel P6 or later | 1659 | * MSR. This can only be done in software for Intel P6 or later |
| 1658 | * and AMD K7 (Model > 1) or later. | 1660 | * and AMD K7 (Model > 1) or later. |
| 1659 | */ | 1661 | */ |
| 1660 | rdmsr(MSR_IA32_APICBASE, l, h); | 1662 | if (boot_cpu_data.x86 >= 6) { |
| 1661 | if (!(l & MSR_IA32_APICBASE_ENABLE)) { | 1663 | rdmsr(MSR_IA32_APICBASE, l, h); |
| 1662 | pr_info("Local APIC disabled by BIOS -- reenabling.\n"); | 1664 | if (!(l & MSR_IA32_APICBASE_ENABLE)) { |
| 1663 | l &= ~MSR_IA32_APICBASE_BASE; | 1665 | pr_info("Local APIC disabled by BIOS -- reenabling.\n"); |
| 1664 | l |= MSR_IA32_APICBASE_ENABLE | addr; | 1666 | l &= ~MSR_IA32_APICBASE_BASE; |
| 1665 | wrmsr(MSR_IA32_APICBASE, l, h); | 1667 | l |= MSR_IA32_APICBASE_ENABLE | addr; |
| 1666 | enabled_via_apicbase = 1; | 1668 | wrmsr(MSR_IA32_APICBASE, l, h); |
| 1669 | enabled_via_apicbase = 1; | ||
| 1670 | } | ||
| 1667 | } | 1671 | } |
| 1668 | return apic_verify(); | 1672 | return apic_verify(); |
| 1669 | } | 1673 | } |
| @@ -2209,10 +2213,12 @@ static void lapic_resume(void) | |||
| 2209 | * FIXME! This will be wrong if we ever support suspend on | 2213 | * FIXME! This will be wrong if we ever support suspend on |
| 2210 | * SMP! We'll need to do this as part of the CPU restore! | 2214 | * SMP! We'll need to do this as part of the CPU restore! |
| 2211 | */ | 2215 | */ |
| 2212 | rdmsr(MSR_IA32_APICBASE, l, h); | 2216 | if (boot_cpu_data.x86 >= 6) { |
| 2213 | l &= ~MSR_IA32_APICBASE_BASE; | 2217 | rdmsr(MSR_IA32_APICBASE, l, h); |
| 2214 | l |= MSR_IA32_APICBASE_ENABLE | mp_lapic_addr; | 2218 | l &= ~MSR_IA32_APICBASE_BASE; |
| 2215 | wrmsr(MSR_IA32_APICBASE, l, h); | 2219 | l |= MSR_IA32_APICBASE_ENABLE | mp_lapic_addr; |
| 2220 | wrmsr(MSR_IA32_APICBASE, l, h); | ||
| 2221 | } | ||
| 2216 | } | 2222 | } |
| 2217 | 2223 | ||
| 2218 | maxlvt = lapic_get_maxlvt(); | 2224 | maxlvt = lapic_get_maxlvt(); |
diff --git a/arch/x86/kernel/apic/apic_numachip.c b/arch/x86/kernel/apic/apic_numachip.c index 899803e03214..23e75422e013 100644 --- a/arch/x86/kernel/apic/apic_numachip.c +++ b/arch/x86/kernel/apic/apic_numachip.c | |||
| @@ -207,8 +207,11 @@ static void __init map_csrs(void) | |||
| 207 | 207 | ||
| 208 | static void fixup_cpu_id(struct cpuinfo_x86 *c, int node) | 208 | static void fixup_cpu_id(struct cpuinfo_x86 *c, int node) |
| 209 | { | 209 | { |
| 210 | c->phys_proc_id = node; | 210 | |
| 211 | per_cpu(cpu_llc_id, smp_processor_id()) = node; | 211 | if (c->phys_proc_id != node) { |
| 212 | c->phys_proc_id = node; | ||
| 213 | per_cpu(cpu_llc_id, smp_processor_id()) = node; | ||
| 214 | } | ||
| 212 | } | 215 | } |
| 213 | 216 | ||
| 214 | static int __init numachip_system_init(void) | 217 | static int __init numachip_system_init(void) |
diff --git a/arch/x86/kernel/apic/x2apic_phys.c b/arch/x86/kernel/apic/x2apic_phys.c index 8a778db45e3a..991e315f4227 100644 --- a/arch/x86/kernel/apic/x2apic_phys.c +++ b/arch/x86/kernel/apic/x2apic_phys.c | |||
| @@ -24,6 +24,12 @@ static int x2apic_acpi_madt_oem_check(char *oem_id, char *oem_table_id) | |||
| 24 | { | 24 | { |
| 25 | if (x2apic_phys) | 25 | if (x2apic_phys) |
| 26 | return x2apic_enabled(); | 26 | return x2apic_enabled(); |
| 27 | else if ((acpi_gbl_FADT.header.revision >= FADT2_REVISION_ID) && | ||
| 28 | (acpi_gbl_FADT.flags & ACPI_FADT_APIC_PHYSICAL) && | ||
| 29 | x2apic_enabled()) { | ||
| 30 | printk(KERN_DEBUG "System requires x2apic physical mode\n"); | ||
| 31 | return 1; | ||
| 32 | } | ||
| 27 | else | 33 | else |
| 28 | return 0; | 34 | return 0; |
| 29 | } | 35 | } |
diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c index 0a44b90602b0..146bb6218eec 100644 --- a/arch/x86/kernel/cpu/amd.c +++ b/arch/x86/kernel/cpu/amd.c | |||
| @@ -26,7 +26,8 @@ | |||
| 26 | * contact AMD for precise details and a CPU swap. | 26 | * contact AMD for precise details and a CPU swap. |
| 27 | * | 27 | * |
| 28 | * See http://www.multimania.com/poulot/k6bug.html | 28 | * See http://www.multimania.com/poulot/k6bug.html |
| 29 | * http://www.amd.com/K6/k6docs/revgd.html | 29 | * and section 2.6.2 of "AMD-K6 Processor Revision Guide - Model 6" |
| 30 | * (Publication # 21266 Issue Date: August 1998) | ||
| 30 | * | 31 | * |
| 31 | * The following test is erm.. interesting. AMD neglected to up | 32 | * The following test is erm.. interesting. AMD neglected to up |
| 32 | * the chip setting when fixing the bug but they also tweaked some | 33 | * the chip setting when fixing the bug but they also tweaked some |
| @@ -94,7 +95,6 @@ static void __cpuinit init_amd_k6(struct cpuinfo_x86 *c) | |||
| 94 | "system stability may be impaired when more than 32 MB are used.\n"); | 95 | "system stability may be impaired when more than 32 MB are used.\n"); |
| 95 | else | 96 | else |
| 96 | printk(KERN_CONT "probably OK (after B9730xxxx).\n"); | 97 | printk(KERN_CONT "probably OK (after B9730xxxx).\n"); |
| 97 | printk(KERN_INFO "Please see http://membres.lycos.fr/poulot/k6bug.html\n"); | ||
| 98 | } | 98 | } |
| 99 | 99 | ||
| 100 | /* K6 with old style WHCR */ | 100 | /* K6 with old style WHCR */ |
| @@ -353,10 +353,11 @@ static void __cpuinit srat_detect_node(struct cpuinfo_x86 *c) | |||
| 353 | node = per_cpu(cpu_llc_id, cpu); | 353 | node = per_cpu(cpu_llc_id, cpu); |
| 354 | 354 | ||
| 355 | /* | 355 | /* |
| 356 | * If core numbers are inconsistent, it's likely a multi-fabric platform, | 356 | * On multi-fabric platform (e.g. Numascale NumaChip) a |
| 357 | * so invoke platform-specific handler | 357 | * platform-specific handler needs to be called to fixup some |
| 358 | * IDs of the CPU. | ||
| 358 | */ | 359 | */ |
| 359 | if (c->phys_proc_id != node) | 360 | if (x86_cpuinit.fixup_cpu_id) |
| 360 | x86_cpuinit.fixup_cpu_id(c, node); | 361 | x86_cpuinit.fixup_cpu_id(c, node); |
| 361 | 362 | ||
| 362 | if (!node_online(node)) { | 363 | if (!node_online(node)) { |
| @@ -579,6 +580,24 @@ static void __cpuinit init_amd(struct cpuinfo_x86 *c) | |||
| 579 | } | 580 | } |
| 580 | } | 581 | } |
| 581 | 582 | ||
| 583 | /* re-enable TopologyExtensions if switched off by BIOS */ | ||
| 584 | if ((c->x86 == 0x15) && | ||
| 585 | (c->x86_model >= 0x10) && (c->x86_model <= 0x1f) && | ||
| 586 | !cpu_has(c, X86_FEATURE_TOPOEXT)) { | ||
| 587 | u64 val; | ||
| 588 | |||
| 589 | if (!rdmsrl_amd_safe(0xc0011005, &val)) { | ||
| 590 | val |= 1ULL << 54; | ||
| 591 | wrmsrl_amd_safe(0xc0011005, val); | ||
| 592 | rdmsrl(0xc0011005, val); | ||
| 593 | if (val & (1ULL << 54)) { | ||
| 594 | set_cpu_cap(c, X86_FEATURE_TOPOEXT); | ||
| 595 | printk(KERN_INFO FW_INFO "CPU: Re-enabling " | ||
| 596 | "disabled Topology Extensions Support\n"); | ||
| 597 | } | ||
| 598 | } | ||
| 599 | } | ||
| 600 | |||
| 582 | cpu_detect_cache_sizes(c); | 601 | cpu_detect_cache_sizes(c); |
| 583 | 602 | ||
| 584 | /* Multi core CPU? */ | 603 | /* Multi core CPU? */ |
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c index 67e258362a3d..cf79302198a6 100644 --- a/arch/x86/kernel/cpu/common.c +++ b/arch/x86/kernel/cpu/common.c | |||
| @@ -1163,15 +1163,6 @@ static void dbg_restore_debug_regs(void) | |||
| 1163 | #endif /* ! CONFIG_KGDB */ | 1163 | #endif /* ! CONFIG_KGDB */ |
| 1164 | 1164 | ||
| 1165 | /* | 1165 | /* |
| 1166 | * Prints an error where the NUMA and configured core-number mismatch and the | ||
| 1167 | * platform didn't override this to fix it up | ||
| 1168 | */ | ||
| 1169 | void __cpuinit x86_default_fixup_cpu_id(struct cpuinfo_x86 *c, int node) | ||
| 1170 | { | ||
| 1171 | pr_err("NUMA core number %d differs from configured core number %d\n", node, c->phys_proc_id); | ||
| 1172 | } | ||
| 1173 | |||
| 1174 | /* | ||
| 1175 | * cpu_init() initializes state that is per-CPU. Some data is already | 1166 | * cpu_init() initializes state that is per-CPU. Some data is already |
| 1176 | * initialized (naturally) in the bootstrap process, such as the GDT | 1167 | * initialized (naturally) in the bootstrap process, such as the GDT |
| 1177 | * and IDT. We reload them nevertheless, this function acts as a | 1168 | * and IDT. We reload them nevertheless, this function acts as a |
diff --git a/arch/x86/kernel/cpu/intel_cacheinfo.c b/arch/x86/kernel/cpu/intel_cacheinfo.c index 73d08ed98a64..b8f3653dddbc 100644 --- a/arch/x86/kernel/cpu/intel_cacheinfo.c +++ b/arch/x86/kernel/cpu/intel_cacheinfo.c | |||
| @@ -433,14 +433,14 @@ int amd_set_l3_disable_slot(struct amd_northbridge *nb, int cpu, unsigned slot, | |||
| 433 | /* check if @slot is already used or the index is already disabled */ | 433 | /* check if @slot is already used or the index is already disabled */ |
| 434 | ret = amd_get_l3_disable_slot(nb, slot); | 434 | ret = amd_get_l3_disable_slot(nb, slot); |
| 435 | if (ret >= 0) | 435 | if (ret >= 0) |
| 436 | return -EINVAL; | 436 | return -EEXIST; |
| 437 | 437 | ||
| 438 | if (index > nb->l3_cache.indices) | 438 | if (index > nb->l3_cache.indices) |
| 439 | return -EINVAL; | 439 | return -EINVAL; |
| 440 | 440 | ||
| 441 | /* check whether the other slot has disabled the same index already */ | 441 | /* check whether the other slot has disabled the same index already */ |
| 442 | if (index == amd_get_l3_disable_slot(nb, !slot)) | 442 | if (index == amd_get_l3_disable_slot(nb, !slot)) |
| 443 | return -EINVAL; | 443 | return -EEXIST; |
| 444 | 444 | ||
| 445 | amd_l3_disable_index(nb, cpu, slot, index); | 445 | amd_l3_disable_index(nb, cpu, slot, index); |
| 446 | 446 | ||
| @@ -468,8 +468,8 @@ static ssize_t store_cache_disable(struct _cpuid4_info *this_leaf, | |||
| 468 | err = amd_set_l3_disable_slot(this_leaf->base.nb, cpu, slot, val); | 468 | err = amd_set_l3_disable_slot(this_leaf->base.nb, cpu, slot, val); |
| 469 | if (err) { | 469 | if (err) { |
| 470 | if (err == -EEXIST) | 470 | if (err == -EEXIST) |
| 471 | printk(KERN_WARNING "L3 disable slot %d in use!\n", | 471 | pr_warning("L3 slot %d in use/index already disabled!\n", |
| 472 | slot); | 472 | slot); |
| 473 | return err; | 473 | return err; |
| 474 | } | 474 | } |
| 475 | return count; | 475 | return count; |
diff --git a/arch/x86/kernel/i387.c b/arch/x86/kernel/i387.c index 7734bcbb5a3a..2d6e6498c176 100644 --- a/arch/x86/kernel/i387.c +++ b/arch/x86/kernel/i387.c | |||
| @@ -235,6 +235,7 @@ int init_fpu(struct task_struct *tsk) | |||
| 235 | if (tsk_used_math(tsk)) { | 235 | if (tsk_used_math(tsk)) { |
| 236 | if (HAVE_HWFP && tsk == current) | 236 | if (HAVE_HWFP && tsk == current) |
| 237 | unlazy_fpu(tsk); | 237 | unlazy_fpu(tsk); |
| 238 | tsk->thread.fpu.last_cpu = ~0; | ||
| 238 | return 0; | 239 | return 0; |
| 239 | } | 240 | } |
| 240 | 241 | ||
diff --git a/arch/x86/kernel/microcode_amd.c b/arch/x86/kernel/microcode_amd.c index 73465aab28f8..8a2ce8fd41c0 100644 --- a/arch/x86/kernel/microcode_amd.c +++ b/arch/x86/kernel/microcode_amd.c | |||
| @@ -82,11 +82,6 @@ static int collect_cpu_info_amd(int cpu, struct cpu_signature *csig) | |||
| 82 | { | 82 | { |
| 83 | struct cpuinfo_x86 *c = &cpu_data(cpu); | 83 | struct cpuinfo_x86 *c = &cpu_data(cpu); |
| 84 | 84 | ||
| 85 | if (c->x86_vendor != X86_VENDOR_AMD || c->x86 < 0x10) { | ||
| 86 | pr_warning("CPU%d: family %d not supported\n", cpu, c->x86); | ||
| 87 | return -1; | ||
| 88 | } | ||
| 89 | |||
| 90 | csig->rev = c->microcode; | 85 | csig->rev = c->microcode; |
| 91 | pr_info("CPU%d: patch_level=0x%08x\n", cpu, csig->rev); | 86 | pr_info("CPU%d: patch_level=0x%08x\n", cpu, csig->rev); |
| 92 | 87 | ||
| @@ -380,6 +375,13 @@ static struct microcode_ops microcode_amd_ops = { | |||
| 380 | 375 | ||
| 381 | struct microcode_ops * __init init_amd_microcode(void) | 376 | struct microcode_ops * __init init_amd_microcode(void) |
| 382 | { | 377 | { |
| 378 | struct cpuinfo_x86 *c = &cpu_data(0); | ||
| 379 | |||
| 380 | if (c->x86_vendor != X86_VENDOR_AMD || c->x86 < 0x10) { | ||
| 381 | pr_warning("AMD CPU family 0x%x not supported\n", c->x86); | ||
| 382 | return NULL; | ||
| 383 | } | ||
| 384 | |||
| 383 | patch = (void *)get_zeroed_page(GFP_KERNEL); | 385 | patch = (void *)get_zeroed_page(GFP_KERNEL); |
| 384 | if (!patch) | 386 | if (!patch) |
| 385 | return NULL; | 387 | return NULL; |
diff --git a/arch/x86/kernel/microcode_core.c b/arch/x86/kernel/microcode_core.c index 87a0f8688301..c9bda6d6035c 100644 --- a/arch/x86/kernel/microcode_core.c +++ b/arch/x86/kernel/microcode_core.c | |||
| @@ -419,10 +419,8 @@ static int mc_device_add(struct device *dev, struct subsys_interface *sif) | |||
| 419 | if (err) | 419 | if (err) |
| 420 | return err; | 420 | return err; |
| 421 | 421 | ||
| 422 | if (microcode_init_cpu(cpu) == UCODE_ERROR) { | 422 | if (microcode_init_cpu(cpu) == UCODE_ERROR) |
| 423 | sysfs_remove_group(&dev->kobj, &mc_attr_group); | ||
| 424 | return -EINVAL; | 423 | return -EINVAL; |
| 425 | } | ||
| 426 | 424 | ||
| 427 | return err; | 425 | return err; |
| 428 | } | 426 | } |
| @@ -528,11 +526,11 @@ static int __init microcode_init(void) | |||
| 528 | microcode_ops = init_intel_microcode(); | 526 | microcode_ops = init_intel_microcode(); |
| 529 | else if (c->x86_vendor == X86_VENDOR_AMD) | 527 | else if (c->x86_vendor == X86_VENDOR_AMD) |
| 530 | microcode_ops = init_amd_microcode(); | 528 | microcode_ops = init_amd_microcode(); |
| 531 | 529 | else | |
| 532 | if (!microcode_ops) { | ||
| 533 | pr_err("no support for this CPU vendor\n"); | 530 | pr_err("no support for this CPU vendor\n"); |
| 531 | |||
| 532 | if (!microcode_ops) | ||
| 534 | return -ENODEV; | 533 | return -ENODEV; |
| 535 | } | ||
| 536 | 534 | ||
| 537 | microcode_pdev = platform_device_register_simple("microcode", -1, | 535 | microcode_pdev = platform_device_register_simple("microcode", -1, |
| 538 | NULL, 0); | 536 | NULL, 0); |
diff --git a/arch/x86/kernel/x86_init.c b/arch/x86/kernel/x86_init.c index e9f265fd79ae..9cf71d0b2d37 100644 --- a/arch/x86/kernel/x86_init.c +++ b/arch/x86/kernel/x86_init.c | |||
| @@ -93,7 +93,6 @@ struct x86_init_ops x86_init __initdata = { | |||
| 93 | struct x86_cpuinit_ops x86_cpuinit __cpuinitdata = { | 93 | struct x86_cpuinit_ops x86_cpuinit __cpuinitdata = { |
| 94 | .early_percpu_clock_init = x86_init_noop, | 94 | .early_percpu_clock_init = x86_init_noop, |
| 95 | .setup_percpu_clockev = setup_secondary_APIC_clock, | 95 | .setup_percpu_clockev = setup_secondary_APIC_clock, |
| 96 | .fixup_cpu_id = x86_default_fixup_cpu_id, | ||
| 97 | }; | 96 | }; |
| 98 | 97 | ||
| 99 | static void default_nmi_init(void) { }; | 98 | static void default_nmi_init(void) { }; |
diff --git a/arch/x86/kvm/pmu.c b/arch/x86/kvm/pmu.c index 173df38dbda5..2e88438ffd83 100644 --- a/arch/x86/kvm/pmu.c +++ b/arch/x86/kvm/pmu.c | |||
| @@ -459,17 +459,17 @@ void kvm_pmu_cpuid_update(struct kvm_vcpu *vcpu) | |||
| 459 | pmu->available_event_types = ~entry->ebx & ((1ull << bitmap_len) - 1); | 459 | pmu->available_event_types = ~entry->ebx & ((1ull << bitmap_len) - 1); |
| 460 | 460 | ||
| 461 | if (pmu->version == 1) { | 461 | if (pmu->version == 1) { |
| 462 | pmu->global_ctrl = (1 << pmu->nr_arch_gp_counters) - 1; | 462 | pmu->nr_arch_fixed_counters = 0; |
| 463 | return; | 463 | } else { |
| 464 | pmu->nr_arch_fixed_counters = min((int)(entry->edx & 0x1f), | ||
| 465 | X86_PMC_MAX_FIXED); | ||
| 466 | pmu->counter_bitmask[KVM_PMC_FIXED] = | ||
| 467 | ((u64)1 << ((entry->edx >> 5) & 0xff)) - 1; | ||
| 464 | } | 468 | } |
| 465 | 469 | ||
| 466 | pmu->nr_arch_fixed_counters = min((int)(entry->edx & 0x1f), | 470 | pmu->global_ctrl = ((1 << pmu->nr_arch_gp_counters) - 1) | |
| 467 | X86_PMC_MAX_FIXED); | 471 | (((1ull << pmu->nr_arch_fixed_counters) - 1) << X86_PMC_IDX_FIXED); |
| 468 | pmu->counter_bitmask[KVM_PMC_FIXED] = | 472 | pmu->global_ctrl_mask = ~pmu->global_ctrl; |
| 469 | ((u64)1 << ((entry->edx >> 5) & 0xff)) - 1; | ||
| 470 | pmu->global_ctrl_mask = ~(((1 << pmu->nr_arch_gp_counters) - 1) | ||
| 471 | | (((1ull << pmu->nr_arch_fixed_counters) - 1) | ||
| 472 | << X86_PMC_IDX_FIXED)); | ||
| 473 | } | 473 | } |
| 474 | 474 | ||
| 475 | void kvm_pmu_init(struct kvm_vcpu *vcpu) | 475 | void kvm_pmu_init(struct kvm_vcpu *vcpu) |
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index ad85adfef843..4ff0ab9bc3c8 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c | |||
| @@ -2210,9 +2210,12 @@ static int vmx_set_msr(struct kvm_vcpu *vcpu, u32 msr_index, u64 data) | |||
| 2210 | msr = find_msr_entry(vmx, msr_index); | 2210 | msr = find_msr_entry(vmx, msr_index); |
| 2211 | if (msr) { | 2211 | if (msr) { |
| 2212 | msr->data = data; | 2212 | msr->data = data; |
| 2213 | if (msr - vmx->guest_msrs < vmx->save_nmsrs) | 2213 | if (msr - vmx->guest_msrs < vmx->save_nmsrs) { |
| 2214 | preempt_disable(); | ||
| 2214 | kvm_set_shared_msr(msr->index, msr->data, | 2215 | kvm_set_shared_msr(msr->index, msr->data, |
| 2215 | msr->mask); | 2216 | msr->mask); |
| 2217 | preempt_enable(); | ||
| 2218 | } | ||
| 2216 | break; | 2219 | break; |
| 2217 | } | 2220 | } |
| 2218 | ret = kvm_set_msr_common(vcpu, msr_index, data); | 2221 | ret = kvm_set_msr_common(vcpu, msr_index, data); |
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 4044ce0bf7c1..91a5e989abcf 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c | |||
| @@ -6336,13 +6336,11 @@ int kvm_arch_prepare_memory_region(struct kvm *kvm, | |||
| 6336 | if (npages && !old.rmap) { | 6336 | if (npages && !old.rmap) { |
| 6337 | unsigned long userspace_addr; | 6337 | unsigned long userspace_addr; |
| 6338 | 6338 | ||
| 6339 | down_write(¤t->mm->mmap_sem); | 6339 | userspace_addr = vm_mmap(NULL, 0, |
| 6340 | userspace_addr = do_mmap(NULL, 0, | ||
| 6341 | npages * PAGE_SIZE, | 6340 | npages * PAGE_SIZE, |
| 6342 | PROT_READ | PROT_WRITE, | 6341 | PROT_READ | PROT_WRITE, |
| 6343 | map_flags, | 6342 | map_flags, |
| 6344 | 0); | 6343 | 0); |
| 6345 | up_write(¤t->mm->mmap_sem); | ||
| 6346 | 6344 | ||
| 6347 | if (IS_ERR((void *)userspace_addr)) | 6345 | if (IS_ERR((void *)userspace_addr)) |
| 6348 | return PTR_ERR((void *)userspace_addr); | 6346 | return PTR_ERR((void *)userspace_addr); |
| @@ -6366,10 +6364,8 @@ void kvm_arch_commit_memory_region(struct kvm *kvm, | |||
| 6366 | if (!user_alloc && !old.user_alloc && old.rmap && !npages) { | 6364 | if (!user_alloc && !old.user_alloc && old.rmap && !npages) { |
| 6367 | int ret; | 6365 | int ret; |
| 6368 | 6366 | ||
| 6369 | down_write(¤t->mm->mmap_sem); | 6367 | ret = vm_munmap(old.userspace_addr, |
| 6370 | ret = do_munmap(current->mm, old.userspace_addr, | ||
| 6371 | old.npages * PAGE_SIZE); | 6368 | old.npages * PAGE_SIZE); |
| 6372 | up_write(¤t->mm->mmap_sem); | ||
| 6373 | if (ret < 0) | 6369 | if (ret < 0) |
| 6374 | printk(KERN_WARNING | 6370 | printk(KERN_WARNING |
| 6375 | "kvm_vm_ioctl_set_memory_region: " | 6371 | "kvm_vm_ioctl_set_memory_region: " |
diff --git a/arch/x86/lib/insn.c b/arch/x86/lib/insn.c index 25feb1ae71c5..b1e6c4b2e8eb 100644 --- a/arch/x86/lib/insn.c +++ b/arch/x86/lib/insn.c | |||
| @@ -379,8 +379,8 @@ err_out: | |||
| 379 | return; | 379 | return; |
| 380 | } | 380 | } |
| 381 | 381 | ||
| 382 | /* Decode moffset16/32/64 */ | 382 | /* Decode moffset16/32/64. Return 0 if failed */ |
| 383 | static void __get_moffset(struct insn *insn) | 383 | static int __get_moffset(struct insn *insn) |
| 384 | { | 384 | { |
| 385 | switch (insn->addr_bytes) { | 385 | switch (insn->addr_bytes) { |
| 386 | case 2: | 386 | case 2: |
| @@ -397,15 +397,19 @@ static void __get_moffset(struct insn *insn) | |||
| 397 | insn->moffset2.value = get_next(int, insn); | 397 | insn->moffset2.value = get_next(int, insn); |
| 398 | insn->moffset2.nbytes = 4; | 398 | insn->moffset2.nbytes = 4; |
| 399 | break; | 399 | break; |
| 400 | default: /* opnd_bytes must be modified manually */ | ||
| 401 | goto err_out; | ||
| 400 | } | 402 | } |
| 401 | insn->moffset1.got = insn->moffset2.got = 1; | 403 | insn->moffset1.got = insn->moffset2.got = 1; |
| 402 | 404 | ||
| 405 | return 1; | ||
| 406 | |||
| 403 | err_out: | 407 | err_out: |
| 404 | return; | 408 | return 0; |
| 405 | } | 409 | } |
| 406 | 410 | ||
| 407 | /* Decode imm v32(Iz) */ | 411 | /* Decode imm v32(Iz). Return 0 if failed */ |
| 408 | static void __get_immv32(struct insn *insn) | 412 | static int __get_immv32(struct insn *insn) |
| 409 | { | 413 | { |
| 410 | switch (insn->opnd_bytes) { | 414 | switch (insn->opnd_bytes) { |
| 411 | case 2: | 415 | case 2: |
| @@ -417,14 +421,18 @@ static void __get_immv32(struct insn *insn) | |||
| 417 | insn->immediate.value = get_next(int, insn); | 421 | insn->immediate.value = get_next(int, insn); |
| 418 | insn->immediate.nbytes = 4; | 422 | insn->immediate.nbytes = 4; |
| 419 | break; | 423 | break; |
| 424 | default: /* opnd_bytes must be modified manually */ | ||
| 425 | goto err_out; | ||
| 420 | } | 426 | } |
| 421 | 427 | ||
| 428 | return 1; | ||
| 429 | |||
| 422 | err_out: | 430 | err_out: |
| 423 | return; | 431 | return 0; |
| 424 | } | 432 | } |
| 425 | 433 | ||
| 426 | /* Decode imm v64(Iv/Ov) */ | 434 | /* Decode imm v64(Iv/Ov), Return 0 if failed */ |
| 427 | static void __get_immv(struct insn *insn) | 435 | static int __get_immv(struct insn *insn) |
| 428 | { | 436 | { |
| 429 | switch (insn->opnd_bytes) { | 437 | switch (insn->opnd_bytes) { |
| 430 | case 2: | 438 | case 2: |
| @@ -441,15 +449,18 @@ static void __get_immv(struct insn *insn) | |||
| 441 | insn->immediate2.value = get_next(int, insn); | 449 | insn->immediate2.value = get_next(int, insn); |
| 442 | insn->immediate2.nbytes = 4; | 450 | insn->immediate2.nbytes = 4; |
| 443 | break; | 451 | break; |
| 452 | default: /* opnd_bytes must be modified manually */ | ||
| 453 | goto err_out; | ||
| 444 | } | 454 | } |
| 445 | insn->immediate1.got = insn->immediate2.got = 1; | 455 | insn->immediate1.got = insn->immediate2.got = 1; |
| 446 | 456 | ||
| 457 | return 1; | ||
| 447 | err_out: | 458 | err_out: |
| 448 | return; | 459 | return 0; |
| 449 | } | 460 | } |
| 450 | 461 | ||
| 451 | /* Decode ptr16:16/32(Ap) */ | 462 | /* Decode ptr16:16/32(Ap) */ |
| 452 | static void __get_immptr(struct insn *insn) | 463 | static int __get_immptr(struct insn *insn) |
| 453 | { | 464 | { |
| 454 | switch (insn->opnd_bytes) { | 465 | switch (insn->opnd_bytes) { |
| 455 | case 2: | 466 | case 2: |
| @@ -462,14 +473,17 @@ static void __get_immptr(struct insn *insn) | |||
| 462 | break; | 473 | break; |
| 463 | case 8: | 474 | case 8: |
| 464 | /* ptr16:64 is not exist (no segment) */ | 475 | /* ptr16:64 is not exist (no segment) */ |
| 465 | return; | 476 | return 0; |
| 477 | default: /* opnd_bytes must be modified manually */ | ||
| 478 | goto err_out; | ||
| 466 | } | 479 | } |
| 467 | insn->immediate2.value = get_next(unsigned short, insn); | 480 | insn->immediate2.value = get_next(unsigned short, insn); |
| 468 | insn->immediate2.nbytes = 2; | 481 | insn->immediate2.nbytes = 2; |
| 469 | insn->immediate1.got = insn->immediate2.got = 1; | 482 | insn->immediate1.got = insn->immediate2.got = 1; |
| 470 | 483 | ||
| 484 | return 1; | ||
| 471 | err_out: | 485 | err_out: |
| 472 | return; | 486 | return 0; |
| 473 | } | 487 | } |
| 474 | 488 | ||
| 475 | /** | 489 | /** |
| @@ -489,7 +503,8 @@ void insn_get_immediate(struct insn *insn) | |||
| 489 | insn_get_displacement(insn); | 503 | insn_get_displacement(insn); |
| 490 | 504 | ||
| 491 | if (inat_has_moffset(insn->attr)) { | 505 | if (inat_has_moffset(insn->attr)) { |
| 492 | __get_moffset(insn); | 506 | if (!__get_moffset(insn)) |
| 507 | goto err_out; | ||
| 493 | goto done; | 508 | goto done; |
| 494 | } | 509 | } |
| 495 | 510 | ||
| @@ -517,16 +532,20 @@ void insn_get_immediate(struct insn *insn) | |||
| 517 | insn->immediate2.nbytes = 4; | 532 | insn->immediate2.nbytes = 4; |
| 518 | break; | 533 | break; |
| 519 | case INAT_IMM_PTR: | 534 | case INAT_IMM_PTR: |
| 520 | __get_immptr(insn); | 535 | if (!__get_immptr(insn)) |
| 536 | goto err_out; | ||
| 521 | break; | 537 | break; |
| 522 | case INAT_IMM_VWORD32: | 538 | case INAT_IMM_VWORD32: |
| 523 | __get_immv32(insn); | 539 | if (!__get_immv32(insn)) |
| 540 | goto err_out; | ||
| 524 | break; | 541 | break; |
| 525 | case INAT_IMM_VWORD: | 542 | case INAT_IMM_VWORD: |
| 526 | __get_immv(insn); | 543 | if (!__get_immv(insn)) |
| 544 | goto err_out; | ||
| 527 | break; | 545 | break; |
| 528 | default: | 546 | default: |
| 529 | break; | 547 | /* Here, insn must have an immediate, but failed */ |
| 548 | goto err_out; | ||
| 530 | } | 549 | } |
| 531 | if (inat_has_second_immediate(insn->attr)) { | 550 | if (inat_has_second_immediate(insn->attr)) { |
| 532 | insn->immediate2.value = get_next(char, insn); | 551 | insn->immediate2.value = get_next(char, insn); |
diff --git a/arch/x86/platform/geode/net5501.c b/arch/x86/platform/geode/net5501.c index 66d377e334f7..646e3b5b4bb6 100644 --- a/arch/x86/platform/geode/net5501.c +++ b/arch/x86/platform/geode/net5501.c | |||
| @@ -63,7 +63,7 @@ static struct gpio_led net5501_leds[] = { | |||
| 63 | .name = "net5501:1", | 63 | .name = "net5501:1", |
| 64 | .gpio = 6, | 64 | .gpio = 6, |
| 65 | .default_trigger = "default-on", | 65 | .default_trigger = "default-on", |
| 66 | .active_low = 1, | 66 | .active_low = 0, |
| 67 | }, | 67 | }, |
| 68 | }; | 68 | }; |
| 69 | 69 | ||
diff --git a/arch/x86/platform/mrst/mrst.c b/arch/x86/platform/mrst/mrst.c index e0a37233c0af..e31bcd8f2eee 100644 --- a/arch/x86/platform/mrst/mrst.c +++ b/arch/x86/platform/mrst/mrst.c | |||
| @@ -805,7 +805,7 @@ void intel_scu_devices_create(void) | |||
| 805 | } else | 805 | } else |
| 806 | i2c_register_board_info(i2c_bus[i], i2c_devs[i], 1); | 806 | i2c_register_board_info(i2c_bus[i], i2c_devs[i], 1); |
| 807 | } | 807 | } |
| 808 | intel_scu_notifier_post(SCU_AVAILABLE, 0L); | 808 | intel_scu_notifier_post(SCU_AVAILABLE, NULL); |
| 809 | } | 809 | } |
| 810 | EXPORT_SYMBOL_GPL(intel_scu_devices_create); | 810 | EXPORT_SYMBOL_GPL(intel_scu_devices_create); |
| 811 | 811 | ||
| @@ -814,7 +814,7 @@ void intel_scu_devices_destroy(void) | |||
| 814 | { | 814 | { |
| 815 | int i; | 815 | int i; |
| 816 | 816 | ||
| 817 | intel_scu_notifier_post(SCU_DOWN, 0L); | 817 | intel_scu_notifier_post(SCU_DOWN, NULL); |
| 818 | 818 | ||
| 819 | for (i = 0; i < ipc_next_dev; i++) | 819 | for (i = 0; i < ipc_next_dev; i++) |
| 820 | platform_device_del(ipc_devs[i]); | 820 | platform_device_del(ipc_devs[i]); |
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c index 4f51bebac02c..a8f8844b8d32 100644 --- a/arch/x86/xen/enlighten.c +++ b/arch/x86/xen/enlighten.c | |||
| @@ -261,7 +261,8 @@ static void xen_cpuid(unsigned int *ax, unsigned int *bx, | |||
| 261 | 261 | ||
| 262 | static bool __init xen_check_mwait(void) | 262 | static bool __init xen_check_mwait(void) |
| 263 | { | 263 | { |
| 264 | #ifdef CONFIG_ACPI | 264 | #if defined(CONFIG_ACPI) && !defined(CONFIG_ACPI_PROCESSOR_AGGREGATOR) && \ |
| 265 | !defined(CONFIG_ACPI_PROCESSOR_AGGREGATOR_MODULE) | ||
| 265 | struct xen_platform_op op = { | 266 | struct xen_platform_op op = { |
| 266 | .cmd = XENPF_set_processor_pminfo, | 267 | .cmd = XENPF_set_processor_pminfo, |
| 267 | .u.set_pminfo.id = -1, | 268 | .u.set_pminfo.id = -1, |
| @@ -349,7 +350,6 @@ static void __init xen_init_cpuid_mask(void) | |||
| 349 | /* Xen will set CR4.OSXSAVE if supported and not disabled by force */ | 350 | /* Xen will set CR4.OSXSAVE if supported and not disabled by force */ |
| 350 | if ((cx & xsave_mask) != xsave_mask) | 351 | if ((cx & xsave_mask) != xsave_mask) |
| 351 | cpuid_leaf1_ecx_mask &= ~xsave_mask; /* disable XSAVE & OSXSAVE */ | 352 | cpuid_leaf1_ecx_mask &= ~xsave_mask; /* disable XSAVE & OSXSAVE */ |
| 352 | |||
| 353 | if (xen_check_mwait()) | 353 | if (xen_check_mwait()) |
| 354 | cpuid_leaf1_ecx_set_mask = (1 << (X86_FEATURE_MWAIT % 32)); | 354 | cpuid_leaf1_ecx_set_mask = (1 << (X86_FEATURE_MWAIT % 32)); |
| 355 | } | 355 | } |
diff --git a/arch/x86/xen/smp.c b/arch/x86/xen/smp.c index 5fac6919b957..0503c0c493a9 100644 --- a/arch/x86/xen/smp.c +++ b/arch/x86/xen/smp.c | |||
| @@ -178,6 +178,7 @@ static void __init xen_fill_possible_map(void) | |||
| 178 | static void __init xen_filter_cpu_maps(void) | 178 | static void __init xen_filter_cpu_maps(void) |
| 179 | { | 179 | { |
| 180 | int i, rc; | 180 | int i, rc; |
| 181 | unsigned int subtract = 0; | ||
| 181 | 182 | ||
| 182 | if (!xen_initial_domain()) | 183 | if (!xen_initial_domain()) |
| 183 | return; | 184 | return; |
| @@ -192,8 +193,22 @@ static void __init xen_filter_cpu_maps(void) | |||
| 192 | } else { | 193 | } else { |
| 193 | set_cpu_possible(i, false); | 194 | set_cpu_possible(i, false); |
| 194 | set_cpu_present(i, false); | 195 | set_cpu_present(i, false); |
| 196 | subtract++; | ||
| 195 | } | 197 | } |
| 196 | } | 198 | } |
| 199 | #ifdef CONFIG_HOTPLUG_CPU | ||
| 200 | /* This is akin to using 'nr_cpus' on the Linux command line. | ||
| 201 | * Which is OK as when we use 'dom0_max_vcpus=X' we can only | ||
| 202 | * have up to X, while nr_cpu_ids is greater than X. This | ||
| 203 | * normally is not a problem, except when CPU hotplugging | ||
| 204 | * is involved and then there might be more than X CPUs | ||
| 205 | * in the guest - which will not work as there is no | ||
| 206 | * hypercall to expand the max number of VCPUs an already | ||
| 207 | * running guest has. So cap it up to X. */ | ||
| 208 | if (subtract) | ||
| 209 | nr_cpu_ids = nr_cpu_ids - subtract; | ||
| 210 | #endif | ||
| 211 | |||
| 197 | } | 212 | } |
| 198 | 213 | ||
| 199 | static void __init xen_smp_prepare_boot_cpu(void) | 214 | static void __init xen_smp_prepare_boot_cpu(void) |
diff --git a/arch/x86/xen/xen-asm.S b/arch/x86/xen/xen-asm.S index 79d7362ad6d1..3e45aa000718 100644 --- a/arch/x86/xen/xen-asm.S +++ b/arch/x86/xen/xen-asm.S | |||
| @@ -96,7 +96,7 @@ ENTRY(xen_restore_fl_direct) | |||
| 96 | 96 | ||
| 97 | /* check for unmasked and pending */ | 97 | /* check for unmasked and pending */ |
| 98 | cmpw $0x0001, PER_CPU_VAR(xen_vcpu_info) + XEN_vcpu_info_pending | 98 | cmpw $0x0001, PER_CPU_VAR(xen_vcpu_info) + XEN_vcpu_info_pending |
| 99 | jz 1f | 99 | jnz 1f |
| 100 | 2: call check_events | 100 | 2: call check_events |
| 101 | 1: | 101 | 1: |
| 102 | ENDPATCH(xen_restore_fl_direct) | 102 | ENDPATCH(xen_restore_fl_direct) |
diff --git a/arch/xtensa/include/asm/hardirq.h b/arch/xtensa/include/asm/hardirq.h index 26664cef8f11..91695a135498 100644 --- a/arch/xtensa/include/asm/hardirq.h +++ b/arch/xtensa/include/asm/hardirq.h | |||
| @@ -11,9 +11,6 @@ | |||
| 11 | #ifndef _XTENSA_HARDIRQ_H | 11 | #ifndef _XTENSA_HARDIRQ_H |
| 12 | #define _XTENSA_HARDIRQ_H | 12 | #define _XTENSA_HARDIRQ_H |
| 13 | 13 | ||
| 14 | void ack_bad_irq(unsigned int irq); | ||
| 15 | #define ack_bad_irq ack_bad_irq | ||
| 16 | |||
| 17 | #include <asm-generic/hardirq.h> | 14 | #include <asm-generic/hardirq.h> |
| 18 | 15 | ||
| 19 | #endif /* _XTENSA_HARDIRQ_H */ | 16 | #endif /* _XTENSA_HARDIRQ_H */ |
diff --git a/arch/xtensa/include/asm/io.h b/arch/xtensa/include/asm/io.h index d04cd3a625fa..4beb43c087d3 100644 --- a/arch/xtensa/include/asm/io.h +++ b/arch/xtensa/include/asm/io.h | |||
| @@ -14,6 +14,7 @@ | |||
| 14 | #ifdef __KERNEL__ | 14 | #ifdef __KERNEL__ |
| 15 | #include <asm/byteorder.h> | 15 | #include <asm/byteorder.h> |
| 16 | #include <asm/page.h> | 16 | #include <asm/page.h> |
| 17 | #include <linux/bug.h> | ||
| 17 | #include <linux/kernel.h> | 18 | #include <linux/kernel.h> |
| 18 | 19 | ||
| 19 | #include <linux/types.h> | 20 | #include <linux/types.h> |
diff --git a/arch/xtensa/kernel/signal.c b/arch/xtensa/kernel/signal.c index b69b000349fc..d78869a00b11 100644 --- a/arch/xtensa/kernel/signal.c +++ b/arch/xtensa/kernel/signal.c | |||
| @@ -496,6 +496,7 @@ int do_signal(struct pt_regs *regs, sigset_t *oldset) | |||
| 496 | signr = get_signal_to_deliver(&info, &ka, regs, NULL); | 496 | signr = get_signal_to_deliver(&info, &ka, regs, NULL); |
| 497 | 497 | ||
| 498 | if (signr > 0) { | 498 | if (signr > 0) { |
| 499 | int ret; | ||
| 499 | 500 | ||
| 500 | /* Are we from a system call? */ | 501 | /* Are we from a system call? */ |
| 501 | 502 | ||
diff --git a/crypto/sha512_generic.c b/crypto/sha512_generic.c index 107f6f7be5e1..dd30f40af9f5 100644 --- a/crypto/sha512_generic.c +++ b/crypto/sha512_generic.c | |||
| @@ -174,7 +174,7 @@ sha512_update(struct shash_desc *desc, const u8 *data, unsigned int len) | |||
| 174 | index = sctx->count[0] & 0x7f; | 174 | index = sctx->count[0] & 0x7f; |
| 175 | 175 | ||
| 176 | /* Update number of bytes */ | 176 | /* Update number of bytes */ |
| 177 | if (!(sctx->count[0] += len)) | 177 | if ((sctx->count[0] += len) < len) |
| 178 | sctx->count[1]++; | 178 | sctx->count[1]++; |
| 179 | 179 | ||
| 180 | part_len = 128 - index; | 180 | part_len = 128 - index; |
diff --git a/drivers/acpi/acpica/hwxface.c b/drivers/acpi/acpica/hwxface.c index ab513a972c95..a716fede4f25 100644 --- a/drivers/acpi/acpica/hwxface.c +++ b/drivers/acpi/acpica/hwxface.c | |||
| @@ -74,7 +74,8 @@ acpi_status acpi_reset(void) | |||
| 74 | 74 | ||
| 75 | /* Check if the reset register is supported */ | 75 | /* Check if the reset register is supported */ |
| 76 | 76 | ||
| 77 | if (!reset_reg->address) { | 77 | if (!(acpi_gbl_FADT.flags & ACPI_FADT_RESET_REGISTER) || |
| 78 | !reset_reg->address) { | ||
| 78 | return_ACPI_STATUS(AE_NOT_EXIST); | 79 | return_ACPI_STATUS(AE_NOT_EXIST); |
| 79 | } | 80 | } |
| 80 | 81 | ||
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index ba14fb93c929..c3881b2eb8b2 100644 --- a/drivers/acpi/osl.c +++ b/drivers/acpi/osl.c | |||
| @@ -607,8 +607,7 @@ acpi_os_install_interrupt_handler(u32 gsi, acpi_osd_handler handler, | |||
| 607 | 607 | ||
| 608 | acpi_irq_handler = handler; | 608 | acpi_irq_handler = handler; |
| 609 | acpi_irq_context = context; | 609 | acpi_irq_context = context; |
| 610 | if (request_threaded_irq(irq, NULL, acpi_irq, IRQF_SHARED, "acpi", | 610 | if (request_irq(irq, acpi_irq, IRQF_SHARED, "acpi", acpi_irq)) { |
| 611 | acpi_irq)) { | ||
| 612 | printk(KERN_ERR PREFIX "SCI (IRQ%d) allocation failed\n", irq); | 611 | printk(KERN_ERR PREFIX "SCI (IRQ%d) allocation failed\n", irq); |
| 613 | acpi_irq_handler = NULL; | 612 | acpi_irq_handler = NULL; |
| 614 | return AE_NOT_ACQUIRED; | 613 | return AE_NOT_ACQUIRED; |
diff --git a/drivers/acpi/power.c b/drivers/acpi/power.c index 7049a7d27c4f..330bb4d75852 100644 --- a/drivers/acpi/power.c +++ b/drivers/acpi/power.c | |||
| @@ -631,7 +631,7 @@ int acpi_power_get_inferred_state(struct acpi_device *device, int *state) | |||
| 631 | * We know a device's inferred power state when all the resources | 631 | * We know a device's inferred power state when all the resources |
| 632 | * required for a given D-state are 'on'. | 632 | * required for a given D-state are 'on'. |
| 633 | */ | 633 | */ |
| 634 | for (i = ACPI_STATE_D0; i < ACPI_STATE_D3; i++) { | 634 | for (i = ACPI_STATE_D0; i < ACPI_STATE_D3_HOT; i++) { |
| 635 | list = &device->power.states[i].resources; | 635 | list = &device->power.states[i].resources; |
| 636 | if (list->count < 1) | 636 | if (list->count < 1) |
| 637 | continue; | 637 | continue; |
diff --git a/drivers/acpi/reboot.c b/drivers/acpi/reboot.c index c1d612435939..a6c77e8b37bd 100644 --- a/drivers/acpi/reboot.c +++ b/drivers/acpi/reboot.c | |||
| @@ -23,7 +23,8 @@ void acpi_reboot(void) | |||
| 23 | /* Is the reset register supported? The spec says we should be | 23 | /* Is the reset register supported? The spec says we should be |
| 24 | * checking the bit width and bit offset, but Windows ignores | 24 | * checking the bit width and bit offset, but Windows ignores |
| 25 | * these fields */ | 25 | * these fields */ |
| 26 | /* Ignore also acpi_gbl_FADT.flags.ACPI_FADT_RESET_REGISTER */ | 26 | if (!(acpi_gbl_FADT.flags & ACPI_FADT_RESET_REGISTER)) |
| 27 | return; | ||
| 27 | 28 | ||
| 28 | reset_value = acpi_gbl_FADT.reset_value; | 29 | reset_value = acpi_gbl_FADT.reset_value; |
| 29 | 30 | ||
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index 767e2dcb9616..7417267e88fa 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c | |||
| @@ -869,7 +869,7 @@ static int acpi_bus_get_power_flags(struct acpi_device *device) | |||
| 869 | /* | 869 | /* |
| 870 | * Enumerate supported power management states | 870 | * Enumerate supported power management states |
| 871 | */ | 871 | */ |
| 872 | for (i = ACPI_STATE_D0; i <= ACPI_STATE_D3; i++) { | 872 | for (i = ACPI_STATE_D0; i <= ACPI_STATE_D3_HOT; i++) { |
| 873 | struct acpi_device_power_state *ps = &device->power.states[i]; | 873 | struct acpi_device_power_state *ps = &device->power.states[i]; |
| 874 | char object_name[5] = { '_', 'P', 'R', '0' + i, '\0' }; | 874 | char object_name[5] = { '_', 'P', 'R', '0' + i, '\0' }; |
| 875 | 875 | ||
| @@ -884,21 +884,18 @@ static int acpi_bus_get_power_flags(struct acpi_device *device) | |||
| 884 | acpi_bus_add_power_resource(ps->resources.handles[j]); | 884 | acpi_bus_add_power_resource(ps->resources.handles[j]); |
| 885 | } | 885 | } |
| 886 | 886 | ||
| 887 | /* The exist of _PR3 indicates D3Cold support */ | ||
| 888 | if (i == ACPI_STATE_D3) { | ||
| 889 | status = acpi_get_handle(device->handle, object_name, &handle); | ||
| 890 | if (ACPI_SUCCESS(status)) | ||
| 891 | device->power.states[ACPI_STATE_D3_COLD].flags.valid = 1; | ||
| 892 | } | ||
| 893 | |||
| 894 | /* Evaluate "_PSx" to see if we can do explicit sets */ | 887 | /* Evaluate "_PSx" to see if we can do explicit sets */ |
| 895 | object_name[2] = 'S'; | 888 | object_name[2] = 'S'; |
| 896 | status = acpi_get_handle(device->handle, object_name, &handle); | 889 | status = acpi_get_handle(device->handle, object_name, &handle); |
| 897 | if (ACPI_SUCCESS(status)) | 890 | if (ACPI_SUCCESS(status)) |
| 898 | ps->flags.explicit_set = 1; | 891 | ps->flags.explicit_set = 1; |
| 899 | 892 | ||
| 900 | /* State is valid if we have some power control */ | 893 | /* |
| 901 | if (ps->resources.count || ps->flags.explicit_set) | 894 | * State is valid if there are means to put the device into it. |
| 895 | * D3hot is only valid if _PR3 present. | ||
| 896 | */ | ||
| 897 | if (ps->resources.count || | ||
| 898 | (ps->flags.explicit_set && i < ACPI_STATE_D3_HOT)) | ||
| 902 | ps->flags.valid = 1; | 899 | ps->flags.valid = 1; |
| 903 | 900 | ||
| 904 | ps->power = -1; /* Unknown - driver assigned */ | 901 | ps->power = -1; /* Unknown - driver assigned */ |
diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c index 1d661b5c3287..eb6fd233764b 100644 --- a/drivers/acpi/sleep.c +++ b/drivers/acpi/sleep.c | |||
| @@ -28,23 +28,33 @@ | |||
| 28 | #include "internal.h" | 28 | #include "internal.h" |
| 29 | #include "sleep.h" | 29 | #include "sleep.h" |
| 30 | 30 | ||
| 31 | u8 wake_sleep_flags = ACPI_NO_OPTIONAL_METHODS; | ||
| 31 | static unsigned int gts, bfs; | 32 | static unsigned int gts, bfs; |
| 32 | module_param(gts, uint, 0644); | 33 | static int set_param_wake_flag(const char *val, struct kernel_param *kp) |
| 33 | module_param(bfs, uint, 0644); | ||
| 34 | MODULE_PARM_DESC(gts, "Enable evaluation of _GTS on suspend."); | ||
| 35 | MODULE_PARM_DESC(bfs, "Enable evaluation of _BFS on resume".); | ||
| 36 | |||
| 37 | static u8 wake_sleep_flags(void) | ||
| 38 | { | 34 | { |
| 39 | u8 flags = ACPI_NO_OPTIONAL_METHODS; | 35 | int ret = param_set_int(val, kp); |
| 40 | 36 | ||
| 41 | if (gts) | 37 | if (ret) |
| 42 | flags |= ACPI_EXECUTE_GTS; | 38 | return ret; |
| 43 | if (bfs) | ||
| 44 | flags |= ACPI_EXECUTE_BFS; | ||
| 45 | 39 | ||
| 46 | return flags; | 40 | if (kp->arg == (const char *)>s) { |
| 41 | if (gts) | ||
| 42 | wake_sleep_flags |= ACPI_EXECUTE_GTS; | ||
| 43 | else | ||
| 44 | wake_sleep_flags &= ~ACPI_EXECUTE_GTS; | ||
| 45 | } | ||
| 46 | if (kp->arg == (const char *)&bfs) { | ||
| 47 | if (bfs) | ||
| 48 | wake_sleep_flags |= ACPI_EXECUTE_BFS; | ||
| 49 | else | ||
| 50 | wake_sleep_flags &= ~ACPI_EXECUTE_BFS; | ||
| 51 | } | ||
| 52 | return ret; | ||
| 47 | } | 53 | } |
| 54 | module_param_call(gts, set_param_wake_flag, param_get_int, >s, 0644); | ||
| 55 | module_param_call(bfs, set_param_wake_flag, param_get_int, &bfs, 0644); | ||
| 56 | MODULE_PARM_DESC(gts, "Enable evaluation of _GTS on suspend."); | ||
| 57 | MODULE_PARM_DESC(bfs, "Enable evaluation of _BFS on resume".); | ||
| 48 | 58 | ||
| 49 | static u8 sleep_states[ACPI_S_STATE_COUNT]; | 59 | static u8 sleep_states[ACPI_S_STATE_COUNT]; |
| 50 | 60 | ||
| @@ -263,7 +273,6 @@ static int acpi_suspend_enter(suspend_state_t pm_state) | |||
| 263 | { | 273 | { |
| 264 | acpi_status status = AE_OK; | 274 | acpi_status status = AE_OK; |
| 265 | u32 acpi_state = acpi_target_sleep_state; | 275 | u32 acpi_state = acpi_target_sleep_state; |
| 266 | u8 flags = wake_sleep_flags(); | ||
| 267 | int error; | 276 | int error; |
| 268 | 277 | ||
| 269 | ACPI_FLUSH_CPU_CACHE(); | 278 | ACPI_FLUSH_CPU_CACHE(); |
| @@ -271,7 +280,7 @@ static int acpi_suspend_enter(suspend_state_t pm_state) | |||
| 271 | switch (acpi_state) { | 280 | switch (acpi_state) { |
| 272 | case ACPI_STATE_S1: | 281 | case ACPI_STATE_S1: |
| 273 | barrier(); | 282 | barrier(); |
| 274 | status = acpi_enter_sleep_state(acpi_state, flags); | 283 | status = acpi_enter_sleep_state(acpi_state, wake_sleep_flags); |
| 275 | break; | 284 | break; |
| 276 | 285 | ||
| 277 | case ACPI_STATE_S3: | 286 | case ACPI_STATE_S3: |
| @@ -286,7 +295,7 @@ static int acpi_suspend_enter(suspend_state_t pm_state) | |||
| 286 | acpi_write_bit_register(ACPI_BITREG_SCI_ENABLE, 1); | 295 | acpi_write_bit_register(ACPI_BITREG_SCI_ENABLE, 1); |
| 287 | 296 | ||
| 288 | /* Reprogram control registers and execute _BFS */ | 297 | /* Reprogram control registers and execute _BFS */ |
| 289 | acpi_leave_sleep_state_prep(acpi_state, flags); | 298 | acpi_leave_sleep_state_prep(acpi_state, wake_sleep_flags); |
| 290 | 299 | ||
| 291 | /* ACPI 3.0 specs (P62) says that it's the responsibility | 300 | /* ACPI 3.0 specs (P62) says that it's the responsibility |
| 292 | * of the OSPM to clear the status bit [ implying that the | 301 | * of the OSPM to clear the status bit [ implying that the |
| @@ -550,30 +559,27 @@ static int acpi_hibernation_begin(void) | |||
| 550 | 559 | ||
| 551 | static int acpi_hibernation_enter(void) | 560 | static int acpi_hibernation_enter(void) |
| 552 | { | 561 | { |
| 553 | u8 flags = wake_sleep_flags(); | ||
| 554 | acpi_status status = AE_OK; | 562 | acpi_status status = AE_OK; |
| 555 | 563 | ||
| 556 | ACPI_FLUSH_CPU_CACHE(); | 564 | ACPI_FLUSH_CPU_CACHE(); |
| 557 | 565 | ||
| 558 | /* This shouldn't return. If it returns, we have a problem */ | 566 | /* This shouldn't return. If it returns, we have a problem */ |
| 559 | status = acpi_enter_sleep_state(ACPI_STATE_S4, flags); | 567 | status = acpi_enter_sleep_state(ACPI_STATE_S4, wake_sleep_flags); |
| 560 | /* Reprogram control registers and execute _BFS */ | 568 | /* Reprogram control registers and execute _BFS */ |
| 561 | acpi_leave_sleep_state_prep(ACPI_STATE_S4, flags); | 569 | acpi_leave_sleep_state_prep(ACPI_STATE_S4, wake_sleep_flags); |
| 562 | 570 | ||
| 563 | return ACPI_SUCCESS(status) ? 0 : -EFAULT; | 571 | return ACPI_SUCCESS(status) ? 0 : -EFAULT; |
| 564 | } | 572 | } |
| 565 | 573 | ||
| 566 | static void acpi_hibernation_leave(void) | 574 | static void acpi_hibernation_leave(void) |
| 567 | { | 575 | { |
| 568 | u8 flags = wake_sleep_flags(); | ||
| 569 | |||
| 570 | /* | 576 | /* |
| 571 | * If ACPI is not enabled by the BIOS and the boot kernel, we need to | 577 | * If ACPI is not enabled by the BIOS and the boot kernel, we need to |
| 572 | * enable it here. | 578 | * enable it here. |
| 573 | */ | 579 | */ |
| 574 | acpi_enable(); | 580 | acpi_enable(); |
| 575 | /* Reprogram control registers and execute _BFS */ | 581 | /* Reprogram control registers and execute _BFS */ |
| 576 | acpi_leave_sleep_state_prep(ACPI_STATE_S4, flags); | 582 | acpi_leave_sleep_state_prep(ACPI_STATE_S4, wake_sleep_flags); |
| 577 | /* Check the hardware signature */ | 583 | /* Check the hardware signature */ |
| 578 | if (facs && s4_hardware_signature != facs->hardware_signature) { | 584 | if (facs && s4_hardware_signature != facs->hardware_signature) { |
| 579 | printk(KERN_EMERG "ACPI: Hardware changed while hibernated, " | 585 | printk(KERN_EMERG "ACPI: Hardware changed while hibernated, " |
| @@ -828,12 +834,10 @@ static void acpi_power_off_prepare(void) | |||
| 828 | 834 | ||
| 829 | static void acpi_power_off(void) | 835 | static void acpi_power_off(void) |
| 830 | { | 836 | { |
| 831 | u8 flags = wake_sleep_flags(); | ||
| 832 | |||
| 833 | /* acpi_sleep_prepare(ACPI_STATE_S5) should have already been called */ | 837 | /* acpi_sleep_prepare(ACPI_STATE_S5) should have already been called */ |
| 834 | printk(KERN_DEBUG "%s called\n", __func__); | 838 | printk(KERN_DEBUG "%s called\n", __func__); |
| 835 | local_irq_disable(); | 839 | local_irq_disable(); |
| 836 | acpi_enter_sleep_state(ACPI_STATE_S5, flags); | 840 | acpi_enter_sleep_state(ACPI_STATE_S5, wake_sleep_flags); |
| 837 | } | 841 | } |
| 838 | 842 | ||
| 839 | /* | 843 | /* |
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c index 79a1e9dd56d9..ebaf67e4b2bc 100644 --- a/drivers/ata/ahci.c +++ b/drivers/ata/ahci.c | |||
| @@ -394,6 +394,8 @@ static const struct pci_device_id ahci_pci_tbl[] = { | |||
| 394 | .driver_data = board_ahci_yes_fbs }, /* 88se9128 */ | 394 | .driver_data = board_ahci_yes_fbs }, /* 88se9128 */ |
| 395 | { PCI_DEVICE(0x1b4b, 0x9125), | 395 | { PCI_DEVICE(0x1b4b, 0x9125), |
| 396 | .driver_data = board_ahci_yes_fbs }, /* 88se9125 */ | 396 | .driver_data = board_ahci_yes_fbs }, /* 88se9125 */ |
| 397 | { PCI_DEVICE(0x1b4b, 0x917a), | ||
| 398 | .driver_data = board_ahci_yes_fbs }, /* 88se9172 */ | ||
| 397 | { PCI_DEVICE(0x1b4b, 0x91a3), | 399 | { PCI_DEVICE(0x1b4b, 0x91a3), |
| 398 | .driver_data = board_ahci_yes_fbs }, | 400 | .driver_data = board_ahci_yes_fbs }, |
| 399 | 401 | ||
diff --git a/drivers/ata/ahci_platform.c b/drivers/ata/ahci_platform.c index 0c86c77764bc..9e419e1c2006 100644 --- a/drivers/ata/ahci_platform.c +++ b/drivers/ata/ahci_platform.c | |||
| @@ -280,6 +280,7 @@ static struct dev_pm_ops ahci_pm_ops = { | |||
| 280 | 280 | ||
| 281 | static const struct of_device_id ahci_of_match[] = { | 281 | static const struct of_device_id ahci_of_match[] = { |
| 282 | { .compatible = "calxeda,hb-ahci", }, | 282 | { .compatible = "calxeda,hb-ahci", }, |
| 283 | { .compatible = "snps,spear-ahci", }, | ||
| 283 | {}, | 284 | {}, |
| 284 | }; | 285 | }; |
| 285 | MODULE_DEVICE_TABLE(of, ahci_of_match); | 286 | MODULE_DEVICE_TABLE(of, ahci_of_match); |
diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c index 68013f96729f..7857e8fd0a3e 100644 --- a/drivers/ata/ata_piix.c +++ b/drivers/ata/ata_piix.c | |||
| @@ -329,6 +329,8 @@ static const struct pci_device_id piix_pci_tbl[] = { | |||
| 329 | { 0x8086, 0x8c08, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata }, | 329 | { 0x8086, 0x8c08, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata }, |
| 330 | /* SATA Controller IDE (Lynx Point) */ | 330 | /* SATA Controller IDE (Lynx Point) */ |
| 331 | { 0x8086, 0x8c09, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata }, | 331 | { 0x8086, 0x8c09, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata }, |
| 332 | /* SATA Controller IDE (DH89xxCC) */ | ||
| 333 | { 0x8086, 0x2326, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata }, | ||
| 332 | { } /* terminate list */ | 334 | { } /* terminate list */ |
| 333 | }; | 335 | }; |
| 334 | 336 | ||
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index e0bda9ff89cd..23763a1ec570 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c | |||
| @@ -95,7 +95,7 @@ static unsigned int ata_dev_set_xfermode(struct ata_device *dev); | |||
| 95 | static void ata_dev_xfermask(struct ata_device *dev); | 95 | static void ata_dev_xfermask(struct ata_device *dev); |
| 96 | static unsigned long ata_dev_blacklisted(const struct ata_device *dev); | 96 | static unsigned long ata_dev_blacklisted(const struct ata_device *dev); |
| 97 | 97 | ||
| 98 | unsigned int ata_print_id = 1; | 98 | atomic_t ata_print_id = ATOMIC_INIT(0); |
| 99 | 99 | ||
| 100 | struct ata_force_param { | 100 | struct ata_force_param { |
| 101 | const char *name; | 101 | const char *name; |
| @@ -6029,7 +6029,7 @@ int ata_host_register(struct ata_host *host, struct scsi_host_template *sht) | |||
| 6029 | 6029 | ||
| 6030 | /* give ports names and add SCSI hosts */ | 6030 | /* give ports names and add SCSI hosts */ |
| 6031 | for (i = 0; i < host->n_ports; i++) | 6031 | for (i = 0; i < host->n_ports; i++) |
| 6032 | host->ports[i]->print_id = ata_print_id++; | 6032 | host->ports[i]->print_id = atomic_inc_return(&ata_print_id); |
| 6033 | 6033 | ||
| 6034 | 6034 | ||
| 6035 | /* Create associated sysfs transport objects */ | 6035 | /* Create associated sysfs transport objects */ |
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c index c61316e9d2f7..d1fbd59ead16 100644 --- a/drivers/ata/libata-eh.c +++ b/drivers/ata/libata-eh.c | |||
| @@ -3501,7 +3501,8 @@ static int ata_count_probe_trials_cb(struct ata_ering_entry *ent, void *void_arg | |||
| 3501 | u64 now = get_jiffies_64(); | 3501 | u64 now = get_jiffies_64(); |
| 3502 | int *trials = void_arg; | 3502 | int *trials = void_arg; |
| 3503 | 3503 | ||
| 3504 | if (ent->timestamp < now - min(now, interval)) | 3504 | if ((ent->eflags & ATA_EFLAG_OLD_ER) || |
| 3505 | (ent->timestamp < now - min(now, interval))) | ||
| 3505 | return -1; | 3506 | return -1; |
| 3506 | 3507 | ||
| 3507 | (*trials)++; | 3508 | (*trials)++; |
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c index 1ee00c8b5b04..22226350cd0c 100644 --- a/drivers/ata/libata-scsi.c +++ b/drivers/ata/libata-scsi.c | |||
| @@ -3399,7 +3399,8 @@ int ata_scsi_add_hosts(struct ata_host *host, struct scsi_host_template *sht) | |||
| 3399 | */ | 3399 | */ |
| 3400 | shost->max_host_blocked = 1; | 3400 | shost->max_host_blocked = 1; |
| 3401 | 3401 | ||
| 3402 | rc = scsi_add_host(ap->scsi_host, &ap->tdev); | 3402 | rc = scsi_add_host_with_dma(ap->scsi_host, |
| 3403 | &ap->tdev, ap->host->dev); | ||
| 3403 | if (rc) | 3404 | if (rc) |
| 3404 | goto err_add; | 3405 | goto err_add; |
| 3405 | } | 3406 | } |
| @@ -3838,18 +3839,25 @@ void ata_sas_port_stop(struct ata_port *ap) | |||
| 3838 | } | 3839 | } |
| 3839 | EXPORT_SYMBOL_GPL(ata_sas_port_stop); | 3840 | EXPORT_SYMBOL_GPL(ata_sas_port_stop); |
| 3840 | 3841 | ||
| 3841 | int ata_sas_async_port_init(struct ata_port *ap) | 3842 | /** |
| 3843 | * ata_sas_async_probe - simply schedule probing and return | ||
| 3844 | * @ap: Port to probe | ||
| 3845 | * | ||
| 3846 | * For batch scheduling of probe for sas attached ata devices, assumes | ||
| 3847 | * the port has already been through ata_sas_port_init() | ||
| 3848 | */ | ||
| 3849 | void ata_sas_async_probe(struct ata_port *ap) | ||
| 3842 | { | 3850 | { |
| 3843 | int rc = ap->ops->port_start(ap); | 3851 | __ata_port_probe(ap); |
| 3844 | 3852 | } | |
| 3845 | if (!rc) { | 3853 | EXPORT_SYMBOL_GPL(ata_sas_async_probe); |
| 3846 | ap->print_id = ata_print_id++; | ||
| 3847 | __ata_port_probe(ap); | ||
| 3848 | } | ||
| 3849 | 3854 | ||
| 3850 | return rc; | 3855 | int ata_sas_sync_probe(struct ata_port *ap) |
| 3856 | { | ||
| 3857 | return ata_port_probe(ap); | ||
| 3851 | } | 3858 | } |
| 3852 | EXPORT_SYMBOL_GPL(ata_sas_async_port_init); | 3859 | EXPORT_SYMBOL_GPL(ata_sas_sync_probe); |
| 3860 | |||
| 3853 | 3861 | ||
| 3854 | /** | 3862 | /** |
| 3855 | * ata_sas_port_init - Initialize a SATA device | 3863 | * ata_sas_port_init - Initialize a SATA device |
| @@ -3866,12 +3874,10 @@ int ata_sas_port_init(struct ata_port *ap) | |||
| 3866 | { | 3874 | { |
| 3867 | int rc = ap->ops->port_start(ap); | 3875 | int rc = ap->ops->port_start(ap); |
| 3868 | 3876 | ||
| 3869 | if (!rc) { | 3877 | if (rc) |
| 3870 | ap->print_id = ata_print_id++; | 3878 | return rc; |
| 3871 | rc = ata_port_probe(ap); | 3879 | ap->print_id = atomic_inc_return(&ata_print_id); |
| 3872 | } | 3880 | return 0; |
| 3873 | |||
| 3874 | return rc; | ||
| 3875 | } | 3881 | } |
| 3876 | EXPORT_SYMBOL_GPL(ata_sas_port_init); | 3882 | EXPORT_SYMBOL_GPL(ata_sas_port_init); |
| 3877 | 3883 | ||
diff --git a/drivers/ata/libata-transport.c b/drivers/ata/libata-transport.c index 74aaee30e264..c34190485377 100644 --- a/drivers/ata/libata-transport.c +++ b/drivers/ata/libata-transport.c | |||
| @@ -294,6 +294,7 @@ int ata_tport_add(struct device *parent, | |||
| 294 | device_enable_async_suspend(dev); | 294 | device_enable_async_suspend(dev); |
| 295 | pm_runtime_set_active(dev); | 295 | pm_runtime_set_active(dev); |
| 296 | pm_runtime_enable(dev); | 296 | pm_runtime_enable(dev); |
| 297 | pm_runtime_forbid(dev); | ||
| 297 | 298 | ||
| 298 | transport_add_device(dev); | 299 | transport_add_device(dev); |
| 299 | transport_configure_device(dev); | 300 | transport_configure_device(dev); |
diff --git a/drivers/ata/libata.h b/drivers/ata/libata.h index 2e26fcaf635b..9d0fd0b71852 100644 --- a/drivers/ata/libata.h +++ b/drivers/ata/libata.h | |||
| @@ -53,7 +53,7 @@ enum { | |||
| 53 | ATA_DNXFER_QUIET = (1 << 31), | 53 | ATA_DNXFER_QUIET = (1 << 31), |
| 54 | }; | 54 | }; |
| 55 | 55 | ||
| 56 | extern unsigned int ata_print_id; | 56 | extern atomic_t ata_print_id; |
| 57 | extern int atapi_passthru16; | 57 | extern int atapi_passthru16; |
| 58 | extern int libata_fua; | 58 | extern int libata_fua; |
| 59 | extern int libata_noacpi; | 59 | extern int libata_noacpi; |
diff --git a/drivers/ata/pata_arasan_cf.c b/drivers/ata/pata_arasan_cf.c index fc2db2a89a6b..3239517f4d90 100644 --- a/drivers/ata/pata_arasan_cf.c +++ b/drivers/ata/pata_arasan_cf.c | |||
| @@ -943,9 +943,9 @@ static int arasan_cf_resume(struct device *dev) | |||
| 943 | 943 | ||
| 944 | return 0; | 944 | return 0; |
| 945 | } | 945 | } |
| 946 | #endif | ||
| 946 | 947 | ||
| 947 | static SIMPLE_DEV_PM_OPS(arasan_cf_pm_ops, arasan_cf_suspend, arasan_cf_resume); | 948 | static SIMPLE_DEV_PM_OPS(arasan_cf_pm_ops, arasan_cf_suspend, arasan_cf_resume); |
| 948 | #endif | ||
| 949 | 949 | ||
| 950 | static struct platform_driver arasan_cf_driver = { | 950 | static struct platform_driver arasan_cf_driver = { |
| 951 | .probe = arasan_cf_probe, | 951 | .probe = arasan_cf_probe, |
| @@ -953,9 +953,7 @@ static struct platform_driver arasan_cf_driver = { | |||
| 953 | .driver = { | 953 | .driver = { |
| 954 | .name = DRIVER_NAME, | 954 | .name = DRIVER_NAME, |
| 955 | .owner = THIS_MODULE, | 955 | .owner = THIS_MODULE, |
| 956 | #ifdef CONFIG_PM | ||
| 957 | .pm = &arasan_cf_pm_ops, | 956 | .pm = &arasan_cf_pm_ops, |
| 958 | #endif | ||
| 959 | }, | 957 | }, |
| 960 | }; | 958 | }; |
| 961 | 959 | ||
diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c index 38950ea8398a..7336d4a7ab31 100644 --- a/drivers/ata/sata_mv.c +++ b/drivers/ata/sata_mv.c | |||
| @@ -4025,7 +4025,8 @@ static int mv_platform_probe(struct platform_device *pdev) | |||
| 4025 | struct ata_host *host; | 4025 | struct ata_host *host; |
| 4026 | struct mv_host_priv *hpriv; | 4026 | struct mv_host_priv *hpriv; |
| 4027 | struct resource *res; | 4027 | struct resource *res; |
| 4028 | int n_ports, rc; | 4028 | int n_ports = 0; |
| 4029 | int rc; | ||
| 4029 | 4030 | ||
| 4030 | ata_print_version_once(&pdev->dev, DRV_VERSION); | 4031 | ata_print_version_once(&pdev->dev, DRV_VERSION); |
| 4031 | 4032 | ||
diff --git a/drivers/bcma/sprom.c b/drivers/bcma/sprom.c index cdcf75c0954f..3e2a6002aae6 100644 --- a/drivers/bcma/sprom.c +++ b/drivers/bcma/sprom.c | |||
| @@ -404,16 +404,19 @@ int bcma_sprom_get(struct bcma_bus *bus) | |||
| 404 | return -EOPNOTSUPP; | 404 | return -EOPNOTSUPP; |
| 405 | 405 | ||
| 406 | if (!bcma_sprom_ext_available(bus)) { | 406 | if (!bcma_sprom_ext_available(bus)) { |
| 407 | bool sprom_onchip; | ||
| 408 | |||
| 407 | /* | 409 | /* |
| 408 | * External SPROM takes precedence so check | 410 | * External SPROM takes precedence so check |
| 409 | * on-chip OTP only when no external SPROM | 411 | * on-chip OTP only when no external SPROM |
| 410 | * is present. | 412 | * is present. |
| 411 | */ | 413 | */ |
| 412 | if (bcma_sprom_onchip_available(bus)) { | 414 | sprom_onchip = bcma_sprom_onchip_available(bus); |
| 415 | if (sprom_onchip) { | ||
| 413 | /* determine offset */ | 416 | /* determine offset */ |
| 414 | offset = bcma_sprom_onchip_offset(bus); | 417 | offset = bcma_sprom_onchip_offset(bus); |
| 415 | } | 418 | } |
| 416 | if (!offset) { | 419 | if (!offset || !sprom_onchip) { |
| 417 | /* | 420 | /* |
| 418 | * Maybe there is no SPROM on the device? | 421 | * Maybe there is no SPROM on the device? |
| 419 | * Now we ask the arch code if there is some sprom | 422 | * Now we ask the arch code if there is some sprom |
diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c index 0e4ef3de9d5d..0d39f2f4294a 100644 --- a/drivers/block/virtio_blk.c +++ b/drivers/block/virtio_blk.c | |||
| @@ -375,6 +375,34 @@ static int init_vq(struct virtio_blk *vblk) | |||
| 375 | return err; | 375 | return err; |
| 376 | } | 376 | } |
| 377 | 377 | ||
| 378 | /* | ||
| 379 | * Legacy naming scheme used for virtio devices. We are stuck with it for | ||
| 380 | * virtio blk but don't ever use it for any new driver. | ||
| 381 | */ | ||
| 382 | static int virtblk_name_format(char *prefix, int index, char *buf, int buflen) | ||
| 383 | { | ||
| 384 | const int base = 'z' - 'a' + 1; | ||
| 385 | char *begin = buf + strlen(prefix); | ||
| 386 | char *end = buf + buflen; | ||
| 387 | char *p; | ||
| 388 | int unit; | ||
| 389 | |||
| 390 | p = end - 1; | ||
| 391 | *p = '\0'; | ||
| 392 | unit = base; | ||
| 393 | do { | ||
| 394 | if (p == begin) | ||
| 395 | return -EINVAL; | ||
| 396 | *--p = 'a' + (index % unit); | ||
| 397 | index = (index / unit) - 1; | ||
| 398 | } while (index >= 0); | ||
| 399 | |||
| 400 | memmove(begin, p, end - p); | ||
| 401 | memcpy(buf, prefix, strlen(prefix)); | ||
| 402 | |||
| 403 | return 0; | ||
| 404 | } | ||
| 405 | |||
| 378 | static int __devinit virtblk_probe(struct virtio_device *vdev) | 406 | static int __devinit virtblk_probe(struct virtio_device *vdev) |
| 379 | { | 407 | { |
| 380 | struct virtio_blk *vblk; | 408 | struct virtio_blk *vblk; |
| @@ -443,18 +471,7 @@ static int __devinit virtblk_probe(struct virtio_device *vdev) | |||
| 443 | 471 | ||
| 444 | q->queuedata = vblk; | 472 | q->queuedata = vblk; |
| 445 | 473 | ||
| 446 | if (index < 26) { | 474 | virtblk_name_format("vd", index, vblk->disk->disk_name, DISK_NAME_LEN); |
| 447 | sprintf(vblk->disk->disk_name, "vd%c", 'a' + index % 26); | ||
| 448 | } else if (index < (26 + 1) * 26) { | ||
| 449 | sprintf(vblk->disk->disk_name, "vd%c%c", | ||
| 450 | 'a' + index / 26 - 1, 'a' + index % 26); | ||
| 451 | } else { | ||
| 452 | const unsigned int m1 = (index / 26 - 1) / 26 - 1; | ||
| 453 | const unsigned int m2 = (index / 26 - 1) % 26; | ||
| 454 | const unsigned int m3 = index % 26; | ||
| 455 | sprintf(vblk->disk->disk_name, "vd%c%c%c", | ||
| 456 | 'a' + m1, 'a' + m2, 'a' + m3); | ||
| 457 | } | ||
| 458 | 475 | ||
| 459 | vblk->disk->major = major; | 476 | vblk->disk->major = major; |
| 460 | vblk->disk->first_minor = index_to_minor(index); | 477 | vblk->disk->first_minor = index_to_minor(index); |
diff --git a/drivers/block/xen-blkback/xenbus.c b/drivers/block/xen-blkback/xenbus.c index 89860f34a7ec..4f66171c6683 100644 --- a/drivers/block/xen-blkback/xenbus.c +++ b/drivers/block/xen-blkback/xenbus.c | |||
| @@ -416,7 +416,7 @@ static void xen_blkbk_discard(struct xenbus_transaction xbt, struct backend_info | |||
| 416 | "discard-secure", "%d", | 416 | "discard-secure", "%d", |
| 417 | blkif->vbd.discard_secure); | 417 | blkif->vbd.discard_secure); |
| 418 | if (err) { | 418 | if (err) { |
| 419 | dev_warn(dev-dev, "writing discard-secure (%d)", err); | 419 | dev_warn(&dev->dev, "writing discard-secure (%d)", err); |
| 420 | return; | 420 | return; |
| 421 | } | 421 | } |
| 422 | } | 422 | } |
diff --git a/drivers/bluetooth/ath3k.c b/drivers/bluetooth/ath3k.c index ae9edca7b56d..57fd867553d7 100644 --- a/drivers/bluetooth/ath3k.c +++ b/drivers/bluetooth/ath3k.c | |||
| @@ -75,6 +75,8 @@ static struct usb_device_id ath3k_table[] = { | |||
| 75 | { USB_DEVICE(0x0CF3, 0x311D) }, | 75 | { USB_DEVICE(0x0CF3, 0x311D) }, |
| 76 | { USB_DEVICE(0x13d3, 0x3375) }, | 76 | { USB_DEVICE(0x13d3, 0x3375) }, |
| 77 | { USB_DEVICE(0x04CA, 0x3005) }, | 77 | { USB_DEVICE(0x04CA, 0x3005) }, |
| 78 | { USB_DEVICE(0x13d3, 0x3362) }, | ||
| 79 | { USB_DEVICE(0x0CF3, 0xE004) }, | ||
| 78 | 80 | ||
| 79 | /* Atheros AR5BBU12 with sflash firmware */ | 81 | /* Atheros AR5BBU12 with sflash firmware */ |
| 80 | { USB_DEVICE(0x0489, 0xE02C) }, | 82 | { USB_DEVICE(0x0489, 0xE02C) }, |
| @@ -94,6 +96,8 @@ static struct usb_device_id ath3k_blist_tbl[] = { | |||
| 94 | { USB_DEVICE(0x0cf3, 0x311D), .driver_info = BTUSB_ATH3012 }, | 96 | { USB_DEVICE(0x0cf3, 0x311D), .driver_info = BTUSB_ATH3012 }, |
| 95 | { USB_DEVICE(0x13d3, 0x3375), .driver_info = BTUSB_ATH3012 }, | 97 | { USB_DEVICE(0x13d3, 0x3375), .driver_info = BTUSB_ATH3012 }, |
| 96 | { USB_DEVICE(0x04ca, 0x3005), .driver_info = BTUSB_ATH3012 }, | 98 | { USB_DEVICE(0x04ca, 0x3005), .driver_info = BTUSB_ATH3012 }, |
| 99 | { USB_DEVICE(0x13d3, 0x3362), .driver_info = BTUSB_ATH3012 }, | ||
| 100 | { USB_DEVICE(0x0cf3, 0xe004), .driver_info = BTUSB_ATH3012 }, | ||
| 97 | 101 | ||
| 98 | { } /* Terminating entry */ | 102 | { } /* Terminating entry */ |
| 99 | }; | 103 | }; |
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c index 3311b812a0c6..9217121362e1 100644 --- a/drivers/bluetooth/btusb.c +++ b/drivers/bluetooth/btusb.c | |||
| @@ -101,12 +101,16 @@ static struct usb_device_id btusb_table[] = { | |||
| 101 | { USB_DEVICE(0x0c10, 0x0000) }, | 101 | { USB_DEVICE(0x0c10, 0x0000) }, |
| 102 | 102 | ||
| 103 | /* Broadcom BCM20702A0 */ | 103 | /* Broadcom BCM20702A0 */ |
| 104 | { USB_DEVICE(0x0489, 0xe042) }, | ||
| 104 | { USB_DEVICE(0x0a5c, 0x21e3) }, | 105 | { USB_DEVICE(0x0a5c, 0x21e3) }, |
| 105 | { USB_DEVICE(0x0a5c, 0x21e6) }, | 106 | { USB_DEVICE(0x0a5c, 0x21e6) }, |
| 106 | { USB_DEVICE(0x0a5c, 0x21e8) }, | 107 | { USB_DEVICE(0x0a5c, 0x21e8) }, |
| 107 | { USB_DEVICE(0x0a5c, 0x21f3) }, | 108 | { USB_DEVICE(0x0a5c, 0x21f3) }, |
| 108 | { USB_DEVICE(0x413c, 0x8197) }, | 109 | { USB_DEVICE(0x413c, 0x8197) }, |
| 109 | 110 | ||
| 111 | /* Foxconn - Hon Hai */ | ||
| 112 | { USB_DEVICE(0x0489, 0xe033) }, | ||
| 113 | |||
| 110 | { } /* Terminating entry */ | 114 | { } /* Terminating entry */ |
| 111 | }; | 115 | }; |
| 112 | 116 | ||
| @@ -133,6 +137,8 @@ static struct usb_device_id blacklist_table[] = { | |||
| 133 | { USB_DEVICE(0x0cf3, 0x311d), .driver_info = BTUSB_ATH3012 }, | 137 | { USB_DEVICE(0x0cf3, 0x311d), .driver_info = BTUSB_ATH3012 }, |
| 134 | { USB_DEVICE(0x13d3, 0x3375), .driver_info = BTUSB_ATH3012 }, | 138 | { USB_DEVICE(0x13d3, 0x3375), .driver_info = BTUSB_ATH3012 }, |
| 135 | { USB_DEVICE(0x04ca, 0x3005), .driver_info = BTUSB_ATH3012 }, | 139 | { USB_DEVICE(0x04ca, 0x3005), .driver_info = BTUSB_ATH3012 }, |
| 140 | { USB_DEVICE(0x13d3, 0x3362), .driver_info = BTUSB_ATH3012 }, | ||
| 141 | { USB_DEVICE(0x0cf3, 0xe004), .driver_info = BTUSB_ATH3012 }, | ||
| 136 | 142 | ||
| 137 | /* Atheros AR5BBU12 with sflash firmware */ | 143 | /* Atheros AR5BBU12 with sflash firmware */ |
| 138 | { USB_DEVICE(0x0489, 0xe02c), .driver_info = BTUSB_IGNORE }, | 144 | { USB_DEVICE(0x0489, 0xe02c), .driver_info = BTUSB_IGNORE }, |
diff --git a/drivers/crypto/ixp4xx_crypto.c b/drivers/crypto/ixp4xx_crypto.c index 0053d7ebb5ca..8f3f74ce8c7f 100644 --- a/drivers/crypto/ixp4xx_crypto.c +++ b/drivers/crypto/ixp4xx_crypto.c | |||
| @@ -18,6 +18,7 @@ | |||
| 18 | #include <linux/interrupt.h> | 18 | #include <linux/interrupt.h> |
| 19 | #include <linux/spinlock.h> | 19 | #include <linux/spinlock.h> |
| 20 | #include <linux/gfp.h> | 20 | #include <linux/gfp.h> |
| 21 | #include <linux/module.h> | ||
| 21 | 22 | ||
| 22 | #include <crypto/ctr.h> | 23 | #include <crypto/ctr.h> |
| 23 | #include <crypto/des.h> | 24 | #include <crypto/des.h> |
diff --git a/drivers/crypto/talitos.c b/drivers/crypto/talitos.c index dc641c796526..921039e56f87 100644 --- a/drivers/crypto/talitos.c +++ b/drivers/crypto/talitos.c | |||
| @@ -124,6 +124,9 @@ struct talitos_private { | |||
| 124 | void __iomem *reg; | 124 | void __iomem *reg; |
| 125 | int irq[2]; | 125 | int irq[2]; |
| 126 | 126 | ||
| 127 | /* SEC global registers lock */ | ||
| 128 | spinlock_t reg_lock ____cacheline_aligned; | ||
| 129 | |||
| 127 | /* SEC version geometry (from device tree node) */ | 130 | /* SEC version geometry (from device tree node) */ |
| 128 | unsigned int num_channels; | 131 | unsigned int num_channels; |
| 129 | unsigned int chfifo_len; | 132 | unsigned int chfifo_len; |
| @@ -412,6 +415,7 @@ static void talitos_done_##name(unsigned long data) \ | |||
| 412 | { \ | 415 | { \ |
| 413 | struct device *dev = (struct device *)data; \ | 416 | struct device *dev = (struct device *)data; \ |
| 414 | struct talitos_private *priv = dev_get_drvdata(dev); \ | 417 | struct talitos_private *priv = dev_get_drvdata(dev); \ |
| 418 | unsigned long flags; \ | ||
| 415 | \ | 419 | \ |
| 416 | if (ch_done_mask & 1) \ | 420 | if (ch_done_mask & 1) \ |
| 417 | flush_channel(dev, 0, 0, 0); \ | 421 | flush_channel(dev, 0, 0, 0); \ |
| @@ -427,8 +431,10 @@ static void talitos_done_##name(unsigned long data) \ | |||
| 427 | out: \ | 431 | out: \ |
| 428 | /* At this point, all completed channels have been processed */ \ | 432 | /* At this point, all completed channels have been processed */ \ |
| 429 | /* Unmask done interrupts for channels completed later on. */ \ | 433 | /* Unmask done interrupts for channels completed later on. */ \ |
| 434 | spin_lock_irqsave(&priv->reg_lock, flags); \ | ||
| 430 | setbits32(priv->reg + TALITOS_IMR, ch_done_mask); \ | 435 | setbits32(priv->reg + TALITOS_IMR, ch_done_mask); \ |
| 431 | setbits32(priv->reg + TALITOS_IMR_LO, TALITOS_IMR_LO_INIT); \ | 436 | setbits32(priv->reg + TALITOS_IMR_LO, TALITOS_IMR_LO_INIT); \ |
| 437 | spin_unlock_irqrestore(&priv->reg_lock, flags); \ | ||
| 432 | } | 438 | } |
| 433 | DEF_TALITOS_DONE(4ch, TALITOS_ISR_4CHDONE) | 439 | DEF_TALITOS_DONE(4ch, TALITOS_ISR_4CHDONE) |
| 434 | DEF_TALITOS_DONE(ch0_2, TALITOS_ISR_CH_0_2_DONE) | 440 | DEF_TALITOS_DONE(ch0_2, TALITOS_ISR_CH_0_2_DONE) |
| @@ -619,22 +625,28 @@ static irqreturn_t talitos_interrupt_##name(int irq, void *data) \ | |||
| 619 | struct device *dev = data; \ | 625 | struct device *dev = data; \ |
| 620 | struct talitos_private *priv = dev_get_drvdata(dev); \ | 626 | struct talitos_private *priv = dev_get_drvdata(dev); \ |
| 621 | u32 isr, isr_lo; \ | 627 | u32 isr, isr_lo; \ |
| 628 | unsigned long flags; \ | ||
| 622 | \ | 629 | \ |
| 630 | spin_lock_irqsave(&priv->reg_lock, flags); \ | ||
| 623 | isr = in_be32(priv->reg + TALITOS_ISR); \ | 631 | isr = in_be32(priv->reg + TALITOS_ISR); \ |
| 624 | isr_lo = in_be32(priv->reg + TALITOS_ISR_LO); \ | 632 | isr_lo = in_be32(priv->reg + TALITOS_ISR_LO); \ |
| 625 | /* Acknowledge interrupt */ \ | 633 | /* Acknowledge interrupt */ \ |
| 626 | out_be32(priv->reg + TALITOS_ICR, isr & (ch_done_mask | ch_err_mask)); \ | 634 | out_be32(priv->reg + TALITOS_ICR, isr & (ch_done_mask | ch_err_mask)); \ |
| 627 | out_be32(priv->reg + TALITOS_ICR_LO, isr_lo); \ | 635 | out_be32(priv->reg + TALITOS_ICR_LO, isr_lo); \ |
| 628 | \ | 636 | \ |
| 629 | if (unlikely((isr & ~TALITOS_ISR_4CHDONE) & ch_err_mask || isr_lo)) \ | 637 | if (unlikely(isr & ch_err_mask || isr_lo)) { \ |
| 630 | talitos_error(dev, isr, isr_lo); \ | 638 | spin_unlock_irqrestore(&priv->reg_lock, flags); \ |
| 631 | else \ | 639 | talitos_error(dev, isr & ch_err_mask, isr_lo); \ |
| 640 | } \ | ||
| 641 | else { \ | ||
| 632 | if (likely(isr & ch_done_mask)) { \ | 642 | if (likely(isr & ch_done_mask)) { \ |
| 633 | /* mask further done interrupts. */ \ | 643 | /* mask further done interrupts. */ \ |
| 634 | clrbits32(priv->reg + TALITOS_IMR, ch_done_mask); \ | 644 | clrbits32(priv->reg + TALITOS_IMR, ch_done_mask); \ |
| 635 | /* done_task will unmask done interrupts at exit */ \ | 645 | /* done_task will unmask done interrupts at exit */ \ |
| 636 | tasklet_schedule(&priv->done_task[tlet]); \ | 646 | tasklet_schedule(&priv->done_task[tlet]); \ |
| 637 | } \ | 647 | } \ |
| 648 | spin_unlock_irqrestore(&priv->reg_lock, flags); \ | ||
| 649 | } \ | ||
| 638 | \ | 650 | \ |
| 639 | return (isr & (ch_done_mask | ch_err_mask) || isr_lo) ? IRQ_HANDLED : \ | 651 | return (isr & (ch_done_mask | ch_err_mask) || isr_lo) ? IRQ_HANDLED : \ |
| 640 | IRQ_NONE; \ | 652 | IRQ_NONE; \ |
| @@ -2719,6 +2731,8 @@ static int talitos_probe(struct platform_device *ofdev) | |||
| 2719 | 2731 | ||
| 2720 | priv->ofdev = ofdev; | 2732 | priv->ofdev = ofdev; |
| 2721 | 2733 | ||
| 2734 | spin_lock_init(&priv->reg_lock); | ||
| 2735 | |||
| 2722 | err = talitos_probe_irq(ofdev); | 2736 | err = talitos_probe_irq(ofdev); |
| 2723 | if (err) | 2737 | if (err) |
| 2724 | goto err_out; | 2738 | goto err_out; |
diff --git a/drivers/dma/Kconfig b/drivers/dma/Kconfig index cf9da362d64f..ef378b5b17e4 100644 --- a/drivers/dma/Kconfig +++ b/drivers/dma/Kconfig | |||
| @@ -91,11 +91,10 @@ config DW_DMAC | |||
| 91 | 91 | ||
| 92 | config AT_HDMAC | 92 | config AT_HDMAC |
| 93 | tristate "Atmel AHB DMA support" | 93 | tristate "Atmel AHB DMA support" |
| 94 | depends on ARCH_AT91SAM9RL || ARCH_AT91SAM9G45 | 94 | depends on ARCH_AT91 |
| 95 | select DMA_ENGINE | 95 | select DMA_ENGINE |
| 96 | help | 96 | help |
| 97 | Support the Atmel AHB DMA controller. This can be integrated in | 97 | Support the Atmel AHB DMA controller. |
| 98 | chips such as the Atmel AT91SAM9RL. | ||
| 99 | 98 | ||
| 100 | config FSL_DMA | 99 | config FSL_DMA |
| 101 | tristate "Freescale Elo and Elo Plus DMA support" | 100 | tristate "Freescale Elo and Elo Plus DMA support" |
diff --git a/drivers/dma/amba-pl08x.c b/drivers/dma/amba-pl08x.c index c301a8ec31aa..3d704abd7912 100644 --- a/drivers/dma/amba-pl08x.c +++ b/drivers/dma/amba-pl08x.c | |||
| @@ -1429,6 +1429,7 @@ static int pl08x_control(struct dma_chan *chan, enum dma_ctrl_cmd cmd, | |||
| 1429 | * signal | 1429 | * signal |
| 1430 | */ | 1430 | */ |
| 1431 | release_phy_channel(plchan); | 1431 | release_phy_channel(plchan); |
| 1432 | plchan->phychan_hold = 0; | ||
| 1432 | } | 1433 | } |
| 1433 | /* Dequeue jobs and free LLIs */ | 1434 | /* Dequeue jobs and free LLIs */ |
| 1434 | if (plchan->at) { | 1435 | if (plchan->at) { |
diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c index 7aa58d204892..445fdf811695 100644 --- a/drivers/dma/at_hdmac.c +++ b/drivers/dma/at_hdmac.c | |||
| @@ -221,10 +221,6 @@ static void atc_dostart(struct at_dma_chan *atchan, struct at_desc *first) | |||
| 221 | 221 | ||
| 222 | vdbg_dump_regs(atchan); | 222 | vdbg_dump_regs(atchan); |
| 223 | 223 | ||
| 224 | /* clear any pending interrupt */ | ||
| 225 | while (dma_readl(atdma, EBCISR)) | ||
| 226 | cpu_relax(); | ||
| 227 | |||
| 228 | channel_writel(atchan, SADDR, 0); | 224 | channel_writel(atchan, SADDR, 0); |
| 229 | channel_writel(atchan, DADDR, 0); | 225 | channel_writel(atchan, DADDR, 0); |
| 230 | channel_writel(atchan, CTRLA, 0); | 226 | channel_writel(atchan, CTRLA, 0); |
diff --git a/drivers/dma/imx-dma.c b/drivers/dma/imx-dma.c index a45b5d2a5987..bb787d8e1529 100644 --- a/drivers/dma/imx-dma.c +++ b/drivers/dma/imx-dma.c | |||
| @@ -571,11 +571,14 @@ static void imxdma_tasklet(unsigned long data) | |||
| 571 | if (desc->desc.callback) | 571 | if (desc->desc.callback) |
| 572 | desc->desc.callback(desc->desc.callback_param); | 572 | desc->desc.callback(desc->desc.callback_param); |
| 573 | 573 | ||
| 574 | dma_cookie_complete(&desc->desc); | 574 | /* If we are dealing with a cyclic descriptor keep it on ld_active |
| 575 | 575 | * and dont mark the descripor as complete. | |
| 576 | /* If we are dealing with a cyclic descriptor keep it on ld_active */ | 576 | * Only in non-cyclic cases it would be marked as complete |
| 577 | */ | ||
| 577 | if (imxdma_chan_is_doing_cyclic(imxdmac)) | 578 | if (imxdma_chan_is_doing_cyclic(imxdmac)) |
| 578 | goto out; | 579 | goto out; |
| 580 | else | ||
| 581 | dma_cookie_complete(&desc->desc); | ||
| 579 | 582 | ||
| 580 | /* Free 2D slot if it was an interleaved transfer */ | 583 | /* Free 2D slot if it was an interleaved transfer */ |
| 581 | if (imxdmac->enabled_2d) { | 584 | if (imxdmac->enabled_2d) { |
diff --git a/drivers/dma/mxs-dma.c b/drivers/dma/mxs-dma.c index c81ef7e10e08..655d4ce6ed0d 100644 --- a/drivers/dma/mxs-dma.c +++ b/drivers/dma/mxs-dma.c | |||
| @@ -201,10 +201,6 @@ static struct mxs_dma_chan *to_mxs_dma_chan(struct dma_chan *chan) | |||
| 201 | 201 | ||
| 202 | static dma_cookie_t mxs_dma_tx_submit(struct dma_async_tx_descriptor *tx) | 202 | static dma_cookie_t mxs_dma_tx_submit(struct dma_async_tx_descriptor *tx) |
| 203 | { | 203 | { |
| 204 | struct mxs_dma_chan *mxs_chan = to_mxs_dma_chan(tx->chan); | ||
| 205 | |||
| 206 | mxs_dma_enable_chan(mxs_chan); | ||
| 207 | |||
| 208 | return dma_cookie_assign(tx); | 204 | return dma_cookie_assign(tx); |
| 209 | } | 205 | } |
| 210 | 206 | ||
| @@ -558,9 +554,9 @@ static enum dma_status mxs_dma_tx_status(struct dma_chan *chan, | |||
| 558 | 554 | ||
| 559 | static void mxs_dma_issue_pending(struct dma_chan *chan) | 555 | static void mxs_dma_issue_pending(struct dma_chan *chan) |
| 560 | { | 556 | { |
| 561 | /* | 557 | struct mxs_dma_chan *mxs_chan = to_mxs_dma_chan(chan); |
| 562 | * Nothing to do. We only have a single descriptor. | 558 | |
| 563 | */ | 559 | mxs_dma_enable_chan(mxs_chan); |
| 564 | } | 560 | } |
| 565 | 561 | ||
| 566 | static int __init mxs_dma_init(struct mxs_dma_engine *mxs_dma) | 562 | static int __init mxs_dma_init(struct mxs_dma_engine *mxs_dma) |
diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c index 282caf118be8..2ee6e23930ad 100644 --- a/drivers/dma/pl330.c +++ b/drivers/dma/pl330.c | |||
| @@ -2225,12 +2225,9 @@ static inline void free_desc_list(struct list_head *list) | |||
| 2225 | { | 2225 | { |
| 2226 | struct dma_pl330_dmac *pdmac; | 2226 | struct dma_pl330_dmac *pdmac; |
| 2227 | struct dma_pl330_desc *desc; | 2227 | struct dma_pl330_desc *desc; |
| 2228 | struct dma_pl330_chan *pch; | 2228 | struct dma_pl330_chan *pch = NULL; |
| 2229 | unsigned long flags; | 2229 | unsigned long flags; |
| 2230 | 2230 | ||
| 2231 | if (list_empty(list)) | ||
| 2232 | return; | ||
| 2233 | |||
| 2234 | /* Finish off the work list */ | 2231 | /* Finish off the work list */ |
| 2235 | list_for_each_entry(desc, list, node) { | 2232 | list_for_each_entry(desc, list, node) { |
| 2236 | dma_async_tx_callback callback; | 2233 | dma_async_tx_callback callback; |
| @@ -2247,6 +2244,10 @@ static inline void free_desc_list(struct list_head *list) | |||
| 2247 | desc->pchan = NULL; | 2244 | desc->pchan = NULL; |
| 2248 | } | 2245 | } |
| 2249 | 2246 | ||
| 2247 | /* pch will be unset if list was empty */ | ||
| 2248 | if (!pch) | ||
| 2249 | return; | ||
| 2250 | |||
| 2250 | pdmac = pch->dmac; | 2251 | pdmac = pch->dmac; |
| 2251 | 2252 | ||
| 2252 | spin_lock_irqsave(&pdmac->pool_lock, flags); | 2253 | spin_lock_irqsave(&pdmac->pool_lock, flags); |
| @@ -2257,12 +2258,9 @@ static inline void free_desc_list(struct list_head *list) | |||
| 2257 | static inline void handle_cyclic_desc_list(struct list_head *list) | 2258 | static inline void handle_cyclic_desc_list(struct list_head *list) |
| 2258 | { | 2259 | { |
| 2259 | struct dma_pl330_desc *desc; | 2260 | struct dma_pl330_desc *desc; |
| 2260 | struct dma_pl330_chan *pch; | 2261 | struct dma_pl330_chan *pch = NULL; |
| 2261 | unsigned long flags; | 2262 | unsigned long flags; |
| 2262 | 2263 | ||
| 2263 | if (list_empty(list)) | ||
| 2264 | return; | ||
| 2265 | |||
| 2266 | list_for_each_entry(desc, list, node) { | 2264 | list_for_each_entry(desc, list, node) { |
| 2267 | dma_async_tx_callback callback; | 2265 | dma_async_tx_callback callback; |
| 2268 | 2266 | ||
| @@ -2274,6 +2272,10 @@ static inline void handle_cyclic_desc_list(struct list_head *list) | |||
| 2274 | callback(desc->txd.callback_param); | 2272 | callback(desc->txd.callback_param); |
| 2275 | } | 2273 | } |
| 2276 | 2274 | ||
| 2275 | /* pch will be unset if list was empty */ | ||
| 2276 | if (!pch) | ||
| 2277 | return; | ||
| 2278 | |||
| 2277 | spin_lock_irqsave(&pch->lock, flags); | 2279 | spin_lock_irqsave(&pch->lock, flags); |
| 2278 | list_splice_tail_init(list, &pch->work_list); | 2280 | list_splice_tail_init(list, &pch->work_list); |
| 2279 | spin_unlock_irqrestore(&pch->lock, flags); | 2281 | spin_unlock_irqrestore(&pch->lock, flags); |
| @@ -2926,8 +2928,11 @@ pl330_probe(struct amba_device *adev, const struct amba_id *id) | |||
| 2926 | INIT_LIST_HEAD(&pd->channels); | 2928 | INIT_LIST_HEAD(&pd->channels); |
| 2927 | 2929 | ||
| 2928 | /* Initialize channel parameters */ | 2930 | /* Initialize channel parameters */ |
| 2929 | num_chan = max(pdat ? pdat->nr_valid_peri : (u8)pi->pcfg.num_peri, | 2931 | if (pdat) |
| 2930 | (u8)pi->pcfg.num_chan); | 2932 | num_chan = max_t(int, pdat->nr_valid_peri, pi->pcfg.num_chan); |
| 2933 | else | ||
| 2934 | num_chan = max_t(int, pi->pcfg.num_peri, pi->pcfg.num_chan); | ||
| 2935 | |||
| 2931 | pdmac->peripherals = kzalloc(num_chan * sizeof(*pch), GFP_KERNEL); | 2936 | pdmac->peripherals = kzalloc(num_chan * sizeof(*pch), GFP_KERNEL); |
| 2932 | 2937 | ||
| 2933 | for (i = 0; i < num_chan; i++) { | 2938 | for (i = 0; i < num_chan; i++) { |
diff --git a/drivers/dma/ste_dma40.c b/drivers/dma/ste_dma40.c index bdd41d4bfa8d..2ed1ac3513f3 100644 --- a/drivers/dma/ste_dma40.c +++ b/drivers/dma/ste_dma40.c | |||
| @@ -18,6 +18,7 @@ | |||
| 18 | #include <linux/pm_runtime.h> | 18 | #include <linux/pm_runtime.h> |
| 19 | #include <linux/err.h> | 19 | #include <linux/err.h> |
| 20 | #include <linux/amba/bus.h> | 20 | #include <linux/amba/bus.h> |
| 21 | #include <linux/regulator/consumer.h> | ||
| 21 | 22 | ||
| 22 | #include <plat/ste_dma40.h> | 23 | #include <plat/ste_dma40.h> |
| 23 | 24 | ||
| @@ -69,6 +70,22 @@ enum d40_command { | |||
| 69 | }; | 70 | }; |
| 70 | 71 | ||
| 71 | /* | 72 | /* |
| 73 | * enum d40_events - The different Event Enables for the event lines. | ||
| 74 | * | ||
| 75 | * @D40_DEACTIVATE_EVENTLINE: De-activate Event line, stopping the logical chan. | ||
| 76 | * @D40_ACTIVATE_EVENTLINE: Activate the Event line, to start a logical chan. | ||
| 77 | * @D40_SUSPEND_REQ_EVENTLINE: Requesting for suspending a event line. | ||
| 78 | * @D40_ROUND_EVENTLINE: Status check for event line. | ||
| 79 | */ | ||
| 80 | |||
| 81 | enum d40_events { | ||
| 82 | D40_DEACTIVATE_EVENTLINE = 0, | ||
| 83 | D40_ACTIVATE_EVENTLINE = 1, | ||
| 84 | D40_SUSPEND_REQ_EVENTLINE = 2, | ||
| 85 | D40_ROUND_EVENTLINE = 3 | ||
| 86 | }; | ||
| 87 | |||
| 88 | /* | ||
| 72 | * These are the registers that has to be saved and later restored | 89 | * These are the registers that has to be saved and later restored |
| 73 | * when the DMA hw is powered off. | 90 | * when the DMA hw is powered off. |
| 74 | * TODO: Add save/restore of D40_DREG_GCC on dma40 v3 or later, if that works. | 91 | * TODO: Add save/restore of D40_DREG_GCC on dma40 v3 or later, if that works. |
| @@ -870,8 +887,8 @@ static void d40_save_restore_registers(struct d40_base *base, bool save) | |||
| 870 | } | 887 | } |
| 871 | #endif | 888 | #endif |
| 872 | 889 | ||
| 873 | static int d40_channel_execute_command(struct d40_chan *d40c, | 890 | static int __d40_execute_command_phy(struct d40_chan *d40c, |
| 874 | enum d40_command command) | 891 | enum d40_command command) |
| 875 | { | 892 | { |
| 876 | u32 status; | 893 | u32 status; |
| 877 | int i; | 894 | int i; |
| @@ -880,6 +897,12 @@ static int d40_channel_execute_command(struct d40_chan *d40c, | |||
| 880 | unsigned long flags; | 897 | unsigned long flags; |
| 881 | u32 wmask; | 898 | u32 wmask; |
| 882 | 899 | ||
| 900 | if (command == D40_DMA_STOP) { | ||
| 901 | ret = __d40_execute_command_phy(d40c, D40_DMA_SUSPEND_REQ); | ||
| 902 | if (ret) | ||
| 903 | return ret; | ||
| 904 | } | ||
| 905 | |||
| 883 | spin_lock_irqsave(&d40c->base->execmd_lock, flags); | 906 | spin_lock_irqsave(&d40c->base->execmd_lock, flags); |
| 884 | 907 | ||
| 885 | if (d40c->phy_chan->num % 2 == 0) | 908 | if (d40c->phy_chan->num % 2 == 0) |
| @@ -973,67 +996,109 @@ static void d40_term_all(struct d40_chan *d40c) | |||
| 973 | } | 996 | } |
| 974 | 997 | ||
| 975 | d40c->pending_tx = 0; | 998 | d40c->pending_tx = 0; |
| 976 | d40c->busy = false; | ||
| 977 | } | 999 | } |
| 978 | 1000 | ||
| 979 | static void __d40_config_set_event(struct d40_chan *d40c, bool enable, | 1001 | static void __d40_config_set_event(struct d40_chan *d40c, |
| 980 | u32 event, int reg) | 1002 | enum d40_events event_type, u32 event, |
| 1003 | int reg) | ||
| 981 | { | 1004 | { |
| 982 | void __iomem *addr = chan_base(d40c) + reg; | 1005 | void __iomem *addr = chan_base(d40c) + reg; |
| 983 | int tries; | 1006 | int tries; |
| 1007 | u32 status; | ||
| 1008 | |||
| 1009 | switch (event_type) { | ||
| 1010 | |||
| 1011 | case D40_DEACTIVATE_EVENTLINE: | ||
| 984 | 1012 | ||
| 985 | if (!enable) { | ||
| 986 | writel((D40_DEACTIVATE_EVENTLINE << D40_EVENTLINE_POS(event)) | 1013 | writel((D40_DEACTIVATE_EVENTLINE << D40_EVENTLINE_POS(event)) |
| 987 | | ~D40_EVENTLINE_MASK(event), addr); | 1014 | | ~D40_EVENTLINE_MASK(event), addr); |
| 988 | return; | 1015 | break; |
| 989 | } | 1016 | |
| 1017 | case D40_SUSPEND_REQ_EVENTLINE: | ||
| 1018 | status = (readl(addr) & D40_EVENTLINE_MASK(event)) >> | ||
| 1019 | D40_EVENTLINE_POS(event); | ||
| 1020 | |||
| 1021 | if (status == D40_DEACTIVATE_EVENTLINE || | ||
| 1022 | status == D40_SUSPEND_REQ_EVENTLINE) | ||
| 1023 | break; | ||
| 990 | 1024 | ||
| 1025 | writel((D40_SUSPEND_REQ_EVENTLINE << D40_EVENTLINE_POS(event)) | ||
| 1026 | | ~D40_EVENTLINE_MASK(event), addr); | ||
| 1027 | |||
| 1028 | for (tries = 0 ; tries < D40_SUSPEND_MAX_IT; tries++) { | ||
| 1029 | |||
| 1030 | status = (readl(addr) & D40_EVENTLINE_MASK(event)) >> | ||
| 1031 | D40_EVENTLINE_POS(event); | ||
| 1032 | |||
| 1033 | cpu_relax(); | ||
| 1034 | /* | ||
| 1035 | * Reduce the number of bus accesses while | ||
| 1036 | * waiting for the DMA to suspend. | ||
| 1037 | */ | ||
| 1038 | udelay(3); | ||
| 1039 | |||
| 1040 | if (status == D40_DEACTIVATE_EVENTLINE) | ||
| 1041 | break; | ||
| 1042 | } | ||
| 1043 | |||
| 1044 | if (tries == D40_SUSPEND_MAX_IT) { | ||
| 1045 | chan_err(d40c, | ||
| 1046 | "unable to stop the event_line chl %d (log: %d)" | ||
| 1047 | "status %x\n", d40c->phy_chan->num, | ||
| 1048 | d40c->log_num, status); | ||
| 1049 | } | ||
| 1050 | break; | ||
| 1051 | |||
| 1052 | case D40_ACTIVATE_EVENTLINE: | ||
| 991 | /* | 1053 | /* |
| 992 | * The hardware sometimes doesn't register the enable when src and dst | 1054 | * The hardware sometimes doesn't register the enable when src and dst |
| 993 | * event lines are active on the same logical channel. Retry to ensure | 1055 | * event lines are active on the same logical channel. Retry to ensure |
| 994 | * it does. Usually only one retry is sufficient. | 1056 | * it does. Usually only one retry is sufficient. |
| 995 | */ | 1057 | */ |
| 996 | tries = 100; | 1058 | tries = 100; |
| 997 | while (--tries) { | 1059 | while (--tries) { |
| 998 | writel((D40_ACTIVATE_EVENTLINE << D40_EVENTLINE_POS(event)) | 1060 | writel((D40_ACTIVATE_EVENTLINE << |
| 999 | | ~D40_EVENTLINE_MASK(event), addr); | 1061 | D40_EVENTLINE_POS(event)) | |
| 1062 | ~D40_EVENTLINE_MASK(event), addr); | ||
| 1000 | 1063 | ||
| 1001 | if (readl(addr) & D40_EVENTLINE_MASK(event)) | 1064 | if (readl(addr) & D40_EVENTLINE_MASK(event)) |
| 1002 | break; | 1065 | break; |
| 1003 | } | 1066 | } |
| 1004 | 1067 | ||
| 1005 | if (tries != 99) | 1068 | if (tries != 99) |
| 1006 | dev_dbg(chan2dev(d40c), | 1069 | dev_dbg(chan2dev(d40c), |
| 1007 | "[%s] workaround enable S%cLNK (%d tries)\n", | 1070 | "[%s] workaround enable S%cLNK (%d tries)\n", |
| 1008 | __func__, reg == D40_CHAN_REG_SSLNK ? 'S' : 'D', | 1071 | __func__, reg == D40_CHAN_REG_SSLNK ? 'S' : 'D', |
| 1009 | 100 - tries); | 1072 | 100 - tries); |
| 1010 | 1073 | ||
| 1011 | WARN_ON(!tries); | 1074 | WARN_ON(!tries); |
| 1012 | } | 1075 | break; |
| 1013 | 1076 | ||
| 1014 | static void d40_config_set_event(struct d40_chan *d40c, bool do_enable) | 1077 | case D40_ROUND_EVENTLINE: |
| 1015 | { | 1078 | BUG(); |
| 1016 | unsigned long flags; | 1079 | break; |
| 1017 | 1080 | ||
| 1018 | spin_lock_irqsave(&d40c->phy_chan->lock, flags); | 1081 | } |
| 1082 | } | ||
| 1019 | 1083 | ||
| 1084 | static void d40_config_set_event(struct d40_chan *d40c, | ||
| 1085 | enum d40_events event_type) | ||
| 1086 | { | ||
| 1020 | /* Enable event line connected to device (or memcpy) */ | 1087 | /* Enable event line connected to device (or memcpy) */ |
| 1021 | if ((d40c->dma_cfg.dir == STEDMA40_PERIPH_TO_MEM) || | 1088 | if ((d40c->dma_cfg.dir == STEDMA40_PERIPH_TO_MEM) || |
| 1022 | (d40c->dma_cfg.dir == STEDMA40_PERIPH_TO_PERIPH)) { | 1089 | (d40c->dma_cfg.dir == STEDMA40_PERIPH_TO_PERIPH)) { |
| 1023 | u32 event = D40_TYPE_TO_EVENT(d40c->dma_cfg.src_dev_type); | 1090 | u32 event = D40_TYPE_TO_EVENT(d40c->dma_cfg.src_dev_type); |
| 1024 | 1091 | ||
| 1025 | __d40_config_set_event(d40c, do_enable, event, | 1092 | __d40_config_set_event(d40c, event_type, event, |
| 1026 | D40_CHAN_REG_SSLNK); | 1093 | D40_CHAN_REG_SSLNK); |
| 1027 | } | 1094 | } |
| 1028 | 1095 | ||
| 1029 | if (d40c->dma_cfg.dir != STEDMA40_PERIPH_TO_MEM) { | 1096 | if (d40c->dma_cfg.dir != STEDMA40_PERIPH_TO_MEM) { |
| 1030 | u32 event = D40_TYPE_TO_EVENT(d40c->dma_cfg.dst_dev_type); | 1097 | u32 event = D40_TYPE_TO_EVENT(d40c->dma_cfg.dst_dev_type); |
| 1031 | 1098 | ||
| 1032 | __d40_config_set_event(d40c, do_enable, event, | 1099 | __d40_config_set_event(d40c, event_type, event, |
| 1033 | D40_CHAN_REG_SDLNK); | 1100 | D40_CHAN_REG_SDLNK); |
| 1034 | } | 1101 | } |
| 1035 | |||
| 1036 | spin_unlock_irqrestore(&d40c->phy_chan->lock, flags); | ||
| 1037 | } | 1102 | } |
| 1038 | 1103 | ||
| 1039 | static u32 d40_chan_has_events(struct d40_chan *d40c) | 1104 | static u32 d40_chan_has_events(struct d40_chan *d40c) |
| @@ -1047,6 +1112,64 @@ static u32 d40_chan_has_events(struct d40_chan *d40c) | |||
| 1047 | return val; | 1112 | return val; |
| 1048 | } | 1113 | } |
| 1049 | 1114 | ||
| 1115 | static int | ||
| 1116 | __d40_execute_command_log(struct d40_chan *d40c, enum d40_command command) | ||
| 1117 | { | ||
| 1118 | unsigned long flags; | ||
| 1119 | int ret = 0; | ||
| 1120 | u32 active_status; | ||
| 1121 | void __iomem *active_reg; | ||
| 1122 | |||
| 1123 | if (d40c->phy_chan->num % 2 == 0) | ||
| 1124 | active_reg = d40c->base->virtbase + D40_DREG_ACTIVE; | ||
| 1125 | else | ||
| 1126 | active_reg = d40c->base->virtbase + D40_DREG_ACTIVO; | ||
| 1127 | |||
| 1128 | |||
| 1129 | spin_lock_irqsave(&d40c->phy_chan->lock, flags); | ||
| 1130 | |||
| 1131 | switch (command) { | ||
| 1132 | case D40_DMA_STOP: | ||
| 1133 | case D40_DMA_SUSPEND_REQ: | ||
| 1134 | |||
| 1135 | active_status = (readl(active_reg) & | ||
| 1136 | D40_CHAN_POS_MASK(d40c->phy_chan->num)) >> | ||
| 1137 | D40_CHAN_POS(d40c->phy_chan->num); | ||
| 1138 | |||
| 1139 | if (active_status == D40_DMA_RUN) | ||
| 1140 | d40_config_set_event(d40c, D40_SUSPEND_REQ_EVENTLINE); | ||
| 1141 | else | ||
| 1142 | d40_config_set_event(d40c, D40_DEACTIVATE_EVENTLINE); | ||
| 1143 | |||
| 1144 | if (!d40_chan_has_events(d40c) && (command == D40_DMA_STOP)) | ||
| 1145 | ret = __d40_execute_command_phy(d40c, command); | ||
| 1146 | |||
| 1147 | break; | ||
| 1148 | |||
| 1149 | case D40_DMA_RUN: | ||
| 1150 | |||
| 1151 | d40_config_set_event(d40c, D40_ACTIVATE_EVENTLINE); | ||
| 1152 | ret = __d40_execute_command_phy(d40c, command); | ||
| 1153 | break; | ||
| 1154 | |||
| 1155 | case D40_DMA_SUSPENDED: | ||
| 1156 | BUG(); | ||
| 1157 | break; | ||
| 1158 | } | ||
| 1159 | |||
| 1160 | spin_unlock_irqrestore(&d40c->phy_chan->lock, flags); | ||
| 1161 | return ret; | ||
| 1162 | } | ||
| 1163 | |||
| 1164 | static int d40_channel_execute_command(struct d40_chan *d40c, | ||
| 1165 | enum d40_command command) | ||
| 1166 | { | ||
| 1167 | if (chan_is_logical(d40c)) | ||
| 1168 | return __d40_execute_command_log(d40c, command); | ||
| 1169 | else | ||
| 1170 | return __d40_execute_command_phy(d40c, command); | ||
| 1171 | } | ||
| 1172 | |||
| 1050 | static u32 d40_get_prmo(struct d40_chan *d40c) | 1173 | static u32 d40_get_prmo(struct d40_chan *d40c) |
| 1051 | { | 1174 | { |
| 1052 | static const unsigned int phy_map[] = { | 1175 | static const unsigned int phy_map[] = { |
| @@ -1149,15 +1272,7 @@ static int d40_pause(struct d40_chan *d40c) | |||
| 1149 | spin_lock_irqsave(&d40c->lock, flags); | 1272 | spin_lock_irqsave(&d40c->lock, flags); |
| 1150 | 1273 | ||
| 1151 | res = d40_channel_execute_command(d40c, D40_DMA_SUSPEND_REQ); | 1274 | res = d40_channel_execute_command(d40c, D40_DMA_SUSPEND_REQ); |
| 1152 | if (res == 0) { | 1275 | |
| 1153 | if (chan_is_logical(d40c)) { | ||
| 1154 | d40_config_set_event(d40c, false); | ||
| 1155 | /* Resume the other logical channels if any */ | ||
| 1156 | if (d40_chan_has_events(d40c)) | ||
| 1157 | res = d40_channel_execute_command(d40c, | ||
| 1158 | D40_DMA_RUN); | ||
| 1159 | } | ||
| 1160 | } | ||
| 1161 | pm_runtime_mark_last_busy(d40c->base->dev); | 1276 | pm_runtime_mark_last_busy(d40c->base->dev); |
| 1162 | pm_runtime_put_autosuspend(d40c->base->dev); | 1277 | pm_runtime_put_autosuspend(d40c->base->dev); |
| 1163 | spin_unlock_irqrestore(&d40c->lock, flags); | 1278 | spin_unlock_irqrestore(&d40c->lock, flags); |
| @@ -1174,45 +1289,17 @@ static int d40_resume(struct d40_chan *d40c) | |||
| 1174 | 1289 | ||
| 1175 | spin_lock_irqsave(&d40c->lock, flags); | 1290 | spin_lock_irqsave(&d40c->lock, flags); |
| 1176 | pm_runtime_get_sync(d40c->base->dev); | 1291 | pm_runtime_get_sync(d40c->base->dev); |
| 1177 | if (d40c->base->rev == 0) | ||
| 1178 | if (chan_is_logical(d40c)) { | ||
| 1179 | res = d40_channel_execute_command(d40c, | ||
| 1180 | D40_DMA_SUSPEND_REQ); | ||
| 1181 | goto no_suspend; | ||
| 1182 | } | ||
| 1183 | 1292 | ||
| 1184 | /* If bytes left to transfer or linked tx resume job */ | 1293 | /* If bytes left to transfer or linked tx resume job */ |
| 1185 | if (d40_residue(d40c) || d40_tx_is_linked(d40c)) { | 1294 | if (d40_residue(d40c) || d40_tx_is_linked(d40c)) |
| 1186 | |||
| 1187 | if (chan_is_logical(d40c)) | ||
| 1188 | d40_config_set_event(d40c, true); | ||
| 1189 | |||
| 1190 | res = d40_channel_execute_command(d40c, D40_DMA_RUN); | 1295 | res = d40_channel_execute_command(d40c, D40_DMA_RUN); |
| 1191 | } | ||
| 1192 | 1296 | ||
| 1193 | no_suspend: | ||
| 1194 | pm_runtime_mark_last_busy(d40c->base->dev); | 1297 | pm_runtime_mark_last_busy(d40c->base->dev); |
| 1195 | pm_runtime_put_autosuspend(d40c->base->dev); | 1298 | pm_runtime_put_autosuspend(d40c->base->dev); |
| 1196 | spin_unlock_irqrestore(&d40c->lock, flags); | 1299 | spin_unlock_irqrestore(&d40c->lock, flags); |
| 1197 | return res; | 1300 | return res; |
| 1198 | } | 1301 | } |
| 1199 | 1302 | ||
| 1200 | static int d40_terminate_all(struct d40_chan *chan) | ||
| 1201 | { | ||
| 1202 | unsigned long flags; | ||
| 1203 | int ret = 0; | ||
| 1204 | |||
| 1205 | ret = d40_pause(chan); | ||
| 1206 | if (!ret && chan_is_physical(chan)) | ||
| 1207 | ret = d40_channel_execute_command(chan, D40_DMA_STOP); | ||
| 1208 | |||
| 1209 | spin_lock_irqsave(&chan->lock, flags); | ||
| 1210 | d40_term_all(chan); | ||
| 1211 | spin_unlock_irqrestore(&chan->lock, flags); | ||
| 1212 | |||
| 1213 | return ret; | ||
| 1214 | } | ||
| 1215 | |||
| 1216 | static dma_cookie_t d40_tx_submit(struct dma_async_tx_descriptor *tx) | 1303 | static dma_cookie_t d40_tx_submit(struct dma_async_tx_descriptor *tx) |
| 1217 | { | 1304 | { |
| 1218 | struct d40_chan *d40c = container_of(tx->chan, | 1305 | struct d40_chan *d40c = container_of(tx->chan, |
| @@ -1232,20 +1319,6 @@ static dma_cookie_t d40_tx_submit(struct dma_async_tx_descriptor *tx) | |||
| 1232 | 1319 | ||
| 1233 | static int d40_start(struct d40_chan *d40c) | 1320 | static int d40_start(struct d40_chan *d40c) |
| 1234 | { | 1321 | { |
| 1235 | if (d40c->base->rev == 0) { | ||
| 1236 | int err; | ||
| 1237 | |||
| 1238 | if (chan_is_logical(d40c)) { | ||
| 1239 | err = d40_channel_execute_command(d40c, | ||
| 1240 | D40_DMA_SUSPEND_REQ); | ||
| 1241 | if (err) | ||
| 1242 | return err; | ||
| 1243 | } | ||
| 1244 | } | ||
| 1245 | |||
| 1246 | if (chan_is_logical(d40c)) | ||
| 1247 | d40_config_set_event(d40c, true); | ||
| 1248 | |||
| 1249 | return d40_channel_execute_command(d40c, D40_DMA_RUN); | 1322 | return d40_channel_execute_command(d40c, D40_DMA_RUN); |
| 1250 | } | 1323 | } |
| 1251 | 1324 | ||
| @@ -1258,10 +1331,10 @@ static struct d40_desc *d40_queue_start(struct d40_chan *d40c) | |||
| 1258 | d40d = d40_first_queued(d40c); | 1331 | d40d = d40_first_queued(d40c); |
| 1259 | 1332 | ||
| 1260 | if (d40d != NULL) { | 1333 | if (d40d != NULL) { |
| 1261 | if (!d40c->busy) | 1334 | if (!d40c->busy) { |
| 1262 | d40c->busy = true; | 1335 | d40c->busy = true; |
| 1263 | 1336 | pm_runtime_get_sync(d40c->base->dev); | |
| 1264 | pm_runtime_get_sync(d40c->base->dev); | 1337 | } |
| 1265 | 1338 | ||
| 1266 | /* Remove from queue */ | 1339 | /* Remove from queue */ |
| 1267 | d40_desc_remove(d40d); | 1340 | d40_desc_remove(d40d); |
| @@ -1388,8 +1461,8 @@ static void dma_tasklet(unsigned long data) | |||
| 1388 | 1461 | ||
| 1389 | return; | 1462 | return; |
| 1390 | 1463 | ||
| 1391 | err: | 1464 | err: |
| 1392 | /* Rescue manoeuvre if receiving double interrupts */ | 1465 | /* Rescue manouver if receiving double interrupts */ |
| 1393 | if (d40c->pending_tx > 0) | 1466 | if (d40c->pending_tx > 0) |
| 1394 | d40c->pending_tx--; | 1467 | d40c->pending_tx--; |
| 1395 | spin_unlock_irqrestore(&d40c->lock, flags); | 1468 | spin_unlock_irqrestore(&d40c->lock, flags); |
| @@ -1770,7 +1843,6 @@ static int d40_config_memcpy(struct d40_chan *d40c) | |||
| 1770 | return 0; | 1843 | return 0; |
| 1771 | } | 1844 | } |
| 1772 | 1845 | ||
| 1773 | |||
| 1774 | static int d40_free_dma(struct d40_chan *d40c) | 1846 | static int d40_free_dma(struct d40_chan *d40c) |
| 1775 | { | 1847 | { |
| 1776 | 1848 | ||
| @@ -1806,43 +1878,18 @@ static int d40_free_dma(struct d40_chan *d40c) | |||
| 1806 | } | 1878 | } |
| 1807 | 1879 | ||
| 1808 | pm_runtime_get_sync(d40c->base->dev); | 1880 | pm_runtime_get_sync(d40c->base->dev); |
| 1809 | res = d40_channel_execute_command(d40c, D40_DMA_SUSPEND_REQ); | 1881 | res = d40_channel_execute_command(d40c, D40_DMA_STOP); |
| 1810 | if (res) { | 1882 | if (res) { |
| 1811 | chan_err(d40c, "suspend failed\n"); | 1883 | chan_err(d40c, "stop failed\n"); |
| 1812 | goto out; | 1884 | goto out; |
| 1813 | } | 1885 | } |
| 1814 | 1886 | ||
| 1815 | if (chan_is_logical(d40c)) { | 1887 | d40_alloc_mask_free(phy, is_src, chan_is_logical(d40c) ? event : 0); |
| 1816 | /* Release logical channel, deactivate the event line */ | ||
| 1817 | 1888 | ||
| 1818 | d40_config_set_event(d40c, false); | 1889 | if (chan_is_logical(d40c)) |
| 1819 | d40c->base->lookup_log_chans[d40c->log_num] = NULL; | 1890 | d40c->base->lookup_log_chans[d40c->log_num] = NULL; |
| 1820 | 1891 | else | |
| 1821 | /* | 1892 | d40c->base->lookup_phy_chans[phy->num] = NULL; |
| 1822 | * Check if there are more logical allocation | ||
| 1823 | * on this phy channel. | ||
| 1824 | */ | ||
| 1825 | if (!d40_alloc_mask_free(phy, is_src, event)) { | ||
| 1826 | /* Resume the other logical channels if any */ | ||
| 1827 | if (d40_chan_has_events(d40c)) { | ||
| 1828 | res = d40_channel_execute_command(d40c, | ||
| 1829 | D40_DMA_RUN); | ||
| 1830 | if (res) | ||
| 1831 | chan_err(d40c, | ||
| 1832 | "Executing RUN command\n"); | ||
| 1833 | } | ||
| 1834 | goto out; | ||
| 1835 | } | ||
| 1836 | } else { | ||
| 1837 | (void) d40_alloc_mask_free(phy, is_src, 0); | ||
| 1838 | } | ||
| 1839 | |||
| 1840 | /* Release physical channel */ | ||
| 1841 | res = d40_channel_execute_command(d40c, D40_DMA_STOP); | ||
| 1842 | if (res) { | ||
| 1843 | chan_err(d40c, "Failed to stop channel\n"); | ||
| 1844 | goto out; | ||
| 1845 | } | ||
| 1846 | 1893 | ||
| 1847 | if (d40c->busy) { | 1894 | if (d40c->busy) { |
| 1848 | pm_runtime_mark_last_busy(d40c->base->dev); | 1895 | pm_runtime_mark_last_busy(d40c->base->dev); |
| @@ -1852,7 +1899,6 @@ static int d40_free_dma(struct d40_chan *d40c) | |||
| 1852 | d40c->busy = false; | 1899 | d40c->busy = false; |
| 1853 | d40c->phy_chan = NULL; | 1900 | d40c->phy_chan = NULL; |
| 1854 | d40c->configured = false; | 1901 | d40c->configured = false; |
| 1855 | d40c->base->lookup_phy_chans[phy->num] = NULL; | ||
| 1856 | out: | 1902 | out: |
| 1857 | 1903 | ||
| 1858 | pm_runtime_mark_last_busy(d40c->base->dev); | 1904 | pm_runtime_mark_last_busy(d40c->base->dev); |
| @@ -2070,7 +2116,7 @@ d40_prep_sg(struct dma_chan *dchan, struct scatterlist *sg_src, | |||
| 2070 | if (sg_next(&sg_src[sg_len - 1]) == sg_src) | 2116 | if (sg_next(&sg_src[sg_len - 1]) == sg_src) |
| 2071 | desc->cyclic = true; | 2117 | desc->cyclic = true; |
| 2072 | 2118 | ||
| 2073 | if (direction != DMA_NONE) { | 2119 | if (direction != DMA_TRANS_NONE) { |
| 2074 | dma_addr_t dev_addr = d40_get_dev_addr(chan, direction); | 2120 | dma_addr_t dev_addr = d40_get_dev_addr(chan, direction); |
| 2075 | 2121 | ||
| 2076 | if (direction == DMA_DEV_TO_MEM) | 2122 | if (direction == DMA_DEV_TO_MEM) |
| @@ -2371,6 +2417,31 @@ static void d40_issue_pending(struct dma_chan *chan) | |||
| 2371 | spin_unlock_irqrestore(&d40c->lock, flags); | 2417 | spin_unlock_irqrestore(&d40c->lock, flags); |
| 2372 | } | 2418 | } |
| 2373 | 2419 | ||
| 2420 | static void d40_terminate_all(struct dma_chan *chan) | ||
| 2421 | { | ||
| 2422 | unsigned long flags; | ||
| 2423 | struct d40_chan *d40c = container_of(chan, struct d40_chan, chan); | ||
| 2424 | int ret; | ||
| 2425 | |||
| 2426 | spin_lock_irqsave(&d40c->lock, flags); | ||
| 2427 | |||
| 2428 | pm_runtime_get_sync(d40c->base->dev); | ||
| 2429 | ret = d40_channel_execute_command(d40c, D40_DMA_STOP); | ||
| 2430 | if (ret) | ||
| 2431 | chan_err(d40c, "Failed to stop channel\n"); | ||
| 2432 | |||
| 2433 | d40_term_all(d40c); | ||
| 2434 | pm_runtime_mark_last_busy(d40c->base->dev); | ||
| 2435 | pm_runtime_put_autosuspend(d40c->base->dev); | ||
| 2436 | if (d40c->busy) { | ||
| 2437 | pm_runtime_mark_last_busy(d40c->base->dev); | ||
| 2438 | pm_runtime_put_autosuspend(d40c->base->dev); | ||
| 2439 | } | ||
| 2440 | d40c->busy = false; | ||
| 2441 | |||
| 2442 | spin_unlock_irqrestore(&d40c->lock, flags); | ||
| 2443 | } | ||
| 2444 | |||
| 2374 | static int | 2445 | static int |
| 2375 | dma40_config_to_halfchannel(struct d40_chan *d40c, | 2446 | dma40_config_to_halfchannel(struct d40_chan *d40c, |
| 2376 | struct stedma40_half_channel_info *info, | 2447 | struct stedma40_half_channel_info *info, |
| @@ -2551,7 +2622,8 @@ static int d40_control(struct dma_chan *chan, enum dma_ctrl_cmd cmd, | |||
| 2551 | 2622 | ||
| 2552 | switch (cmd) { | 2623 | switch (cmd) { |
| 2553 | case DMA_TERMINATE_ALL: | 2624 | case DMA_TERMINATE_ALL: |
| 2554 | return d40_terminate_all(d40c); | 2625 | d40_terminate_all(chan); |
| 2626 | return 0; | ||
| 2555 | case DMA_PAUSE: | 2627 | case DMA_PAUSE: |
| 2556 | return d40_pause(d40c); | 2628 | return d40_pause(d40c); |
| 2557 | case DMA_RESUME: | 2629 | case DMA_RESUME: |
| @@ -2908,6 +2980,12 @@ static struct d40_base * __init d40_hw_detect_init(struct platform_device *pdev) | |||
| 2908 | dev_info(&pdev->dev, "hardware revision: %d @ 0x%x\n", | 2980 | dev_info(&pdev->dev, "hardware revision: %d @ 0x%x\n", |
| 2909 | rev, res->start); | 2981 | rev, res->start); |
| 2910 | 2982 | ||
| 2983 | if (rev < 2) { | ||
| 2984 | d40_err(&pdev->dev, "hardware revision: %d is not supported", | ||
| 2985 | rev); | ||
| 2986 | goto failure; | ||
| 2987 | } | ||
| 2988 | |||
| 2911 | plat_data = pdev->dev.platform_data; | 2989 | plat_data = pdev->dev.platform_data; |
| 2912 | 2990 | ||
| 2913 | /* Count the number of logical channels in use */ | 2991 | /* Count the number of logical channels in use */ |
| @@ -2998,6 +3076,7 @@ failure: | |||
| 2998 | 3076 | ||
| 2999 | if (base) { | 3077 | if (base) { |
| 3000 | kfree(base->lcla_pool.alloc_map); | 3078 | kfree(base->lcla_pool.alloc_map); |
| 3079 | kfree(base->reg_val_backup_chan); | ||
| 3001 | kfree(base->lookup_log_chans); | 3080 | kfree(base->lookup_log_chans); |
| 3002 | kfree(base->lookup_phy_chans); | 3081 | kfree(base->lookup_phy_chans); |
| 3003 | kfree(base->phy_res); | 3082 | kfree(base->phy_res); |
diff --git a/drivers/dma/ste_dma40_ll.h b/drivers/dma/ste_dma40_ll.h index 8d3d490968a3..51e8e5396e9b 100644 --- a/drivers/dma/ste_dma40_ll.h +++ b/drivers/dma/ste_dma40_ll.h | |||
| @@ -62,8 +62,6 @@ | |||
| 62 | #define D40_SREG_ELEM_LOG_LIDX_MASK (0xFF << D40_SREG_ELEM_LOG_LIDX_POS) | 62 | #define D40_SREG_ELEM_LOG_LIDX_MASK (0xFF << D40_SREG_ELEM_LOG_LIDX_POS) |
| 63 | 63 | ||
| 64 | /* Link register */ | 64 | /* Link register */ |
| 65 | #define D40_DEACTIVATE_EVENTLINE 0x0 | ||
| 66 | #define D40_ACTIVATE_EVENTLINE 0x1 | ||
| 67 | #define D40_EVENTLINE_POS(i) (2 * i) | 65 | #define D40_EVENTLINE_POS(i) (2 * i) |
| 68 | #define D40_EVENTLINE_MASK(i) (0x3 << D40_EVENTLINE_POS(i)) | 66 | #define D40_EVENTLINE_MASK(i) (0x3 << D40_EVENTLINE_POS(i)) |
| 69 | 67 | ||
diff --git a/drivers/firmware/efivars.c b/drivers/firmware/efivars.c index d25599f2a3f8..47408e802ab6 100644 --- a/drivers/firmware/efivars.c +++ b/drivers/firmware/efivars.c | |||
| @@ -191,6 +191,190 @@ utf16_strncmp(const efi_char16_t *a, const efi_char16_t *b, size_t len) | |||
| 191 | } | 191 | } |
| 192 | } | 192 | } |
| 193 | 193 | ||
| 194 | static bool | ||
| 195 | validate_device_path(struct efi_variable *var, int match, u8 *buffer, | ||
| 196 | unsigned long len) | ||
| 197 | { | ||
| 198 | struct efi_generic_dev_path *node; | ||
| 199 | int offset = 0; | ||
| 200 | |||
| 201 | node = (struct efi_generic_dev_path *)buffer; | ||
| 202 | |||
| 203 | if (len < sizeof(*node)) | ||
| 204 | return false; | ||
| 205 | |||
| 206 | while (offset <= len - sizeof(*node) && | ||
| 207 | node->length >= sizeof(*node) && | ||
| 208 | node->length <= len - offset) { | ||
| 209 | offset += node->length; | ||
| 210 | |||
| 211 | if ((node->type == EFI_DEV_END_PATH || | ||
| 212 | node->type == EFI_DEV_END_PATH2) && | ||
| 213 | node->sub_type == EFI_DEV_END_ENTIRE) | ||
| 214 | return true; | ||
| 215 | |||
| 216 | node = (struct efi_generic_dev_path *)(buffer + offset); | ||
| 217 | } | ||
| 218 | |||
| 219 | /* | ||
| 220 | * If we're here then either node->length pointed past the end | ||
| 221 | * of the buffer or we reached the end of the buffer without | ||
| 222 | * finding a device path end node. | ||
| 223 | */ | ||
| 224 | return false; | ||
| 225 | } | ||
| 226 | |||
| 227 | static bool | ||
| 228 | validate_boot_order(struct efi_variable *var, int match, u8 *buffer, | ||
| 229 | unsigned long len) | ||
| 230 | { | ||
| 231 | /* An array of 16-bit integers */ | ||
| 232 | if ((len % 2) != 0) | ||
| 233 | return false; | ||
| 234 | |||
| 235 | return true; | ||
| 236 | } | ||
| 237 | |||
| 238 | static bool | ||
| 239 | validate_load_option(struct efi_variable *var, int match, u8 *buffer, | ||
| 240 | unsigned long len) | ||
| 241 | { | ||
| 242 | u16 filepathlength; | ||
| 243 | int i, desclength = 0, namelen; | ||
| 244 | |||
| 245 | namelen = utf16_strnlen(var->VariableName, sizeof(var->VariableName)); | ||
| 246 | |||
| 247 | /* Either "Boot" or "Driver" followed by four digits of hex */ | ||
| 248 | for (i = match; i < match+4; i++) { | ||
| 249 | if (var->VariableName[i] > 127 || | ||
| 250 | hex_to_bin(var->VariableName[i] & 0xff) < 0) | ||
| 251 | return true; | ||
| 252 | } | ||
| 253 | |||
| 254 | /* Reject it if there's 4 digits of hex and then further content */ | ||
| 255 | if (namelen > match + 4) | ||
| 256 | return false; | ||
| 257 | |||
| 258 | /* A valid entry must be at least 8 bytes */ | ||
| 259 | if (len < 8) | ||
| 260 | return false; | ||
| 261 | |||
| 262 | filepathlength = buffer[4] | buffer[5] << 8; | ||
| 263 | |||
| 264 | /* | ||
| 265 | * There's no stored length for the description, so it has to be | ||
| 266 | * found by hand | ||
| 267 | */ | ||
| 268 | desclength = utf16_strsize((efi_char16_t *)(buffer + 6), len - 6) + 2; | ||
| 269 | |||
| 270 | /* Each boot entry must have a descriptor */ | ||
| 271 | if (!desclength) | ||
| 272 | return false; | ||
| 273 | |||
| 274 | /* | ||
| 275 | * If the sum of the length of the description, the claimed filepath | ||
| 276 | * length and the original header are greater than the length of the | ||
| 277 | * variable, it's malformed | ||
| 278 | */ | ||
| 279 | if ((desclength + filepathlength + 6) > len) | ||
| 280 | return false; | ||
| 281 | |||
| 282 | /* | ||
| 283 | * And, finally, check the filepath | ||
| 284 | */ | ||
| 285 | return validate_device_path(var, match, buffer + desclength + 6, | ||
| 286 | filepathlength); | ||
| 287 | } | ||
| 288 | |||
| 289 | static bool | ||
| 290 | validate_uint16(struct efi_variable *var, int match, u8 *buffer, | ||
| 291 | unsigned long len) | ||
| 292 | { | ||
| 293 | /* A single 16-bit integer */ | ||
| 294 | if (len != 2) | ||
| 295 | return false; | ||
| 296 | |||
| 297 | return true; | ||
| 298 | } | ||
| 299 | |||
| 300 | static bool | ||
| 301 | validate_ascii_string(struct efi_variable *var, int match, u8 *buffer, | ||
| 302 | unsigned long len) | ||
| 303 | { | ||
| 304 | int i; | ||
| 305 | |||
| 306 | for (i = 0; i < len; i++) { | ||
| 307 | if (buffer[i] > 127) | ||
| 308 | return false; | ||
| 309 | |||
| 310 | if (buffer[i] == 0) | ||
| 311 | return true; | ||
| 312 | } | ||
| 313 | |||
| 314 | return false; | ||
| 315 | } | ||
| 316 | |||
| 317 | struct variable_validate { | ||
| 318 | char *name; | ||
| 319 | bool (*validate)(struct efi_variable *var, int match, u8 *data, | ||
| 320 | unsigned long len); | ||
| 321 | }; | ||
| 322 | |||
| 323 | static const struct variable_validate variable_validate[] = { | ||
| 324 | { "BootNext", validate_uint16 }, | ||
| 325 | { "BootOrder", validate_boot_order }, | ||
| 326 | { "DriverOrder", validate_boot_order }, | ||
| 327 | { "Boot*", validate_load_option }, | ||
| 328 | { "Driver*", validate_load_option }, | ||
| 329 | { "ConIn", validate_device_path }, | ||
| 330 | { "ConInDev", validate_device_path }, | ||
| 331 | { "ConOut", validate_device_path }, | ||
| 332 | { "ConOutDev", validate_device_path }, | ||
| 333 | { "ErrOut", validate_device_path }, | ||
| 334 | { "ErrOutDev", validate_device_path }, | ||
| 335 | { "Timeout", validate_uint16 }, | ||
| 336 | { "Lang", validate_ascii_string }, | ||
| 337 | { "PlatformLang", validate_ascii_string }, | ||
| 338 | { "", NULL }, | ||
| 339 | }; | ||
| 340 | |||
| 341 | static bool | ||
| 342 | validate_var(struct efi_variable *var, u8 *data, unsigned long len) | ||
| 343 | { | ||
| 344 | int i; | ||
| 345 | u16 *unicode_name = var->VariableName; | ||
| 346 | |||
| 347 | for (i = 0; variable_validate[i].validate != NULL; i++) { | ||
| 348 | const char *name = variable_validate[i].name; | ||
| 349 | int match; | ||
| 350 | |||
| 351 | for (match = 0; ; match++) { | ||
| 352 | char c = name[match]; | ||
| 353 | u16 u = unicode_name[match]; | ||
| 354 | |||
| 355 | /* All special variables are plain ascii */ | ||
| 356 | if (u > 127) | ||
| 357 | return true; | ||
| 358 | |||
| 359 | /* Wildcard in the matching name means we've matched */ | ||
| 360 | if (c == '*') | ||
| 361 | return variable_validate[i].validate(var, | ||
| 362 | match, data, len); | ||
| 363 | |||
| 364 | /* Case sensitive match */ | ||
| 365 | if (c != u) | ||
| 366 | break; | ||
| 367 | |||
| 368 | /* Reached the end of the string while matching */ | ||
| 369 | if (!c) | ||
| 370 | return variable_validate[i].validate(var, | ||
| 371 | match, data, len); | ||
| 372 | } | ||
| 373 | } | ||
| 374 | |||
| 375 | return true; | ||
| 376 | } | ||
| 377 | |||
| 194 | static efi_status_t | 378 | static efi_status_t |
| 195 | get_var_data_locked(struct efivars *efivars, struct efi_variable *var) | 379 | get_var_data_locked(struct efivars *efivars, struct efi_variable *var) |
| 196 | { | 380 | { |
| @@ -324,6 +508,12 @@ efivar_store_raw(struct efivar_entry *entry, const char *buf, size_t count) | |||
| 324 | return -EINVAL; | 508 | return -EINVAL; |
| 325 | } | 509 | } |
| 326 | 510 | ||
| 511 | if ((new_var->Attributes & ~EFI_VARIABLE_MASK) != 0 || | ||
| 512 | validate_var(new_var, new_var->Data, new_var->DataSize) == false) { | ||
| 513 | printk(KERN_ERR "efivars: Malformed variable content\n"); | ||
| 514 | return -EINVAL; | ||
| 515 | } | ||
| 516 | |||
| 327 | spin_lock(&efivars->lock); | 517 | spin_lock(&efivars->lock); |
| 328 | status = efivars->ops->set_variable(new_var->VariableName, | 518 | status = efivars->ops->set_variable(new_var->VariableName, |
| 329 | &new_var->VendorGuid, | 519 | &new_var->VendorGuid, |
| @@ -626,6 +816,12 @@ static ssize_t efivar_create(struct file *filp, struct kobject *kobj, | |||
| 626 | if (!capable(CAP_SYS_ADMIN)) | 816 | if (!capable(CAP_SYS_ADMIN)) |
| 627 | return -EACCES; | 817 | return -EACCES; |
| 628 | 818 | ||
| 819 | if ((new_var->Attributes & ~EFI_VARIABLE_MASK) != 0 || | ||
| 820 | validate_var(new_var, new_var->Data, new_var->DataSize) == false) { | ||
| 821 | printk(KERN_ERR "efivars: Malformed variable content\n"); | ||
| 822 | return -EINVAL; | ||
| 823 | } | ||
| 824 | |||
| 629 | spin_lock(&efivars->lock); | 825 | spin_lock(&efivars->lock); |
| 630 | 826 | ||
| 631 | /* | 827 | /* |
diff --git a/drivers/gpio/gpio-pxa.c b/drivers/gpio/gpio-pxa.c index 5689ce62fd81..fc3ace3fd4cb 100644 --- a/drivers/gpio/gpio-pxa.c +++ b/drivers/gpio/gpio-pxa.c | |||
| @@ -64,6 +64,7 @@ struct pxa_gpio_chip { | |||
| 64 | unsigned long irq_mask; | 64 | unsigned long irq_mask; |
| 65 | unsigned long irq_edge_rise; | 65 | unsigned long irq_edge_rise; |
| 66 | unsigned long irq_edge_fall; | 66 | unsigned long irq_edge_fall; |
| 67 | int (*set_wake)(unsigned int gpio, unsigned int on); | ||
| 67 | 68 | ||
| 68 | #ifdef CONFIG_PM | 69 | #ifdef CONFIG_PM |
| 69 | unsigned long saved_gplr; | 70 | unsigned long saved_gplr; |
| @@ -269,7 +270,8 @@ static void pxa_gpio_set(struct gpio_chip *chip, unsigned offset, int value) | |||
| 269 | (value ? GPSR_OFFSET : GPCR_OFFSET)); | 270 | (value ? GPSR_OFFSET : GPCR_OFFSET)); |
| 270 | } | 271 | } |
| 271 | 272 | ||
| 272 | static int __devinit pxa_init_gpio_chip(int gpio_end) | 273 | static int __devinit pxa_init_gpio_chip(int gpio_end, |
| 274 | int (*set_wake)(unsigned int, unsigned int)) | ||
| 273 | { | 275 | { |
| 274 | int i, gpio, nbanks = gpio_to_bank(gpio_end) + 1; | 276 | int i, gpio, nbanks = gpio_to_bank(gpio_end) + 1; |
| 275 | struct pxa_gpio_chip *chips; | 277 | struct pxa_gpio_chip *chips; |
| @@ -285,6 +287,7 @@ static int __devinit pxa_init_gpio_chip(int gpio_end) | |||
| 285 | 287 | ||
| 286 | sprintf(chips[i].label, "gpio-%d", i); | 288 | sprintf(chips[i].label, "gpio-%d", i); |
| 287 | chips[i].regbase = gpio_reg_base + BANK_OFF(i); | 289 | chips[i].regbase = gpio_reg_base + BANK_OFF(i); |
| 290 | chips[i].set_wake = set_wake; | ||
| 288 | 291 | ||
| 289 | c->base = gpio; | 292 | c->base = gpio; |
| 290 | c->label = chips[i].label; | 293 | c->label = chips[i].label; |
| @@ -412,6 +415,17 @@ static void pxa_mask_muxed_gpio(struct irq_data *d) | |||
| 412 | writel_relaxed(gfer, c->regbase + GFER_OFFSET); | 415 | writel_relaxed(gfer, c->regbase + GFER_OFFSET); |
| 413 | } | 416 | } |
| 414 | 417 | ||
| 418 | static int pxa_gpio_set_wake(struct irq_data *d, unsigned int on) | ||
| 419 | { | ||
| 420 | int gpio = pxa_irq_to_gpio(d->irq); | ||
| 421 | struct pxa_gpio_chip *c = gpio_to_pxachip(gpio); | ||
| 422 | |||
| 423 | if (c->set_wake) | ||
| 424 | return c->set_wake(gpio, on); | ||
| 425 | else | ||
| 426 | return 0; | ||
| 427 | } | ||
| 428 | |||
| 415 | static void pxa_unmask_muxed_gpio(struct irq_data *d) | 429 | static void pxa_unmask_muxed_gpio(struct irq_data *d) |
| 416 | { | 430 | { |
| 417 | int gpio = pxa_irq_to_gpio(d->irq); | 431 | int gpio = pxa_irq_to_gpio(d->irq); |
| @@ -427,6 +441,7 @@ static struct irq_chip pxa_muxed_gpio_chip = { | |||
| 427 | .irq_mask = pxa_mask_muxed_gpio, | 441 | .irq_mask = pxa_mask_muxed_gpio, |
| 428 | .irq_unmask = pxa_unmask_muxed_gpio, | 442 | .irq_unmask = pxa_unmask_muxed_gpio, |
| 429 | .irq_set_type = pxa_gpio_irq_type, | 443 | .irq_set_type = pxa_gpio_irq_type, |
| 444 | .irq_set_wake = pxa_gpio_set_wake, | ||
| 430 | }; | 445 | }; |
| 431 | 446 | ||
| 432 | static int pxa_gpio_nums(void) | 447 | static int pxa_gpio_nums(void) |
| @@ -471,6 +486,7 @@ static int __devinit pxa_gpio_probe(struct platform_device *pdev) | |||
| 471 | struct pxa_gpio_chip *c; | 486 | struct pxa_gpio_chip *c; |
| 472 | struct resource *res; | 487 | struct resource *res; |
| 473 | struct clk *clk; | 488 | struct clk *clk; |
| 489 | struct pxa_gpio_platform_data *info; | ||
| 474 | int gpio, irq, ret; | 490 | int gpio, irq, ret; |
| 475 | int irq0 = 0, irq1 = 0, irq_mux, gpio_offset = 0; | 491 | int irq0 = 0, irq1 = 0, irq_mux, gpio_offset = 0; |
| 476 | 492 | ||
| @@ -516,7 +532,8 @@ static int __devinit pxa_gpio_probe(struct platform_device *pdev) | |||
| 516 | } | 532 | } |
| 517 | 533 | ||
| 518 | /* Initialize GPIO chips */ | 534 | /* Initialize GPIO chips */ |
| 519 | pxa_init_gpio_chip(pxa_last_gpio); | 535 | info = dev_get_platdata(&pdev->dev); |
| 536 | pxa_init_gpio_chip(pxa_last_gpio, info ? info->gpio_set_wake : NULL); | ||
| 520 | 537 | ||
| 521 | /* clear all GPIO edge detects */ | 538 | /* clear all GPIO edge detects */ |
| 522 | for_each_gpio_chip(gpio, c) { | 539 | for_each_gpio_chip(gpio, c) { |
diff --git a/drivers/gpu/drm/drm_bufs.c b/drivers/gpu/drm/drm_bufs.c index 30372f7b2d45..348b367debeb 100644 --- a/drivers/gpu/drm/drm_bufs.c +++ b/drivers/gpu/drm/drm_bufs.c | |||
| @@ -1510,8 +1510,8 @@ int drm_freebufs(struct drm_device *dev, void *data, | |||
| 1510 | * \param arg pointer to a drm_buf_map structure. | 1510 | * \param arg pointer to a drm_buf_map structure. |
| 1511 | * \return zero on success or a negative number on failure. | 1511 | * \return zero on success or a negative number on failure. |
| 1512 | * | 1512 | * |
| 1513 | * Maps the AGP, SG or PCI buffer region with do_mmap(), and copies information | 1513 | * Maps the AGP, SG or PCI buffer region with vm_mmap(), and copies information |
| 1514 | * about each buffer into user space. For PCI buffers, it calls do_mmap() with | 1514 | * about each buffer into user space. For PCI buffers, it calls vm_mmap() with |
| 1515 | * offset equal to 0, which drm_mmap() interpretes as PCI buffers and calls | 1515 | * offset equal to 0, which drm_mmap() interpretes as PCI buffers and calls |
| 1516 | * drm_mmap_dma(). | 1516 | * drm_mmap_dma(). |
| 1517 | */ | 1517 | */ |
| @@ -1553,18 +1553,14 @@ int drm_mapbufs(struct drm_device *dev, void *data, | |||
| 1553 | retcode = -EINVAL; | 1553 | retcode = -EINVAL; |
| 1554 | goto done; | 1554 | goto done; |
| 1555 | } | 1555 | } |
| 1556 | down_write(¤t->mm->mmap_sem); | 1556 | virtual = vm_mmap(file_priv->filp, 0, map->size, |
| 1557 | virtual = do_mmap(file_priv->filp, 0, map->size, | ||
| 1558 | PROT_READ | PROT_WRITE, | 1557 | PROT_READ | PROT_WRITE, |
| 1559 | MAP_SHARED, | 1558 | MAP_SHARED, |
| 1560 | token); | 1559 | token); |
| 1561 | up_write(¤t->mm->mmap_sem); | ||
| 1562 | } else { | 1560 | } else { |
| 1563 | down_write(¤t->mm->mmap_sem); | 1561 | virtual = vm_mmap(file_priv->filp, 0, dma->byte_count, |
| 1564 | virtual = do_mmap(file_priv->filp, 0, dma->byte_count, | ||
| 1565 | PROT_READ | PROT_WRITE, | 1562 | PROT_READ | PROT_WRITE, |
| 1566 | MAP_SHARED, 0); | 1563 | MAP_SHARED, 0); |
| 1567 | up_write(¤t->mm->mmap_sem); | ||
| 1568 | } | 1564 | } |
| 1569 | if (virtual > -1024UL) { | 1565 | if (virtual > -1024UL) { |
| 1570 | /* Real error */ | 1566 | /* Real error */ |
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c index d3aaeb6ae236..c79870a75c2f 100644 --- a/drivers/gpu/drm/drm_crtc.c +++ b/drivers/gpu/drm/drm_crtc.c | |||
| @@ -3335,10 +3335,12 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev, | |||
| 3335 | 3335 | ||
| 3336 | ret = crtc->funcs->page_flip(crtc, fb, e); | 3336 | ret = crtc->funcs->page_flip(crtc, fb, e); |
| 3337 | if (ret) { | 3337 | if (ret) { |
| 3338 | spin_lock_irqsave(&dev->event_lock, flags); | 3338 | if (page_flip->flags & DRM_MODE_PAGE_FLIP_EVENT) { |
| 3339 | file_priv->event_space += sizeof e->event; | 3339 | spin_lock_irqsave(&dev->event_lock, flags); |
| 3340 | spin_unlock_irqrestore(&dev->event_lock, flags); | 3340 | file_priv->event_space += sizeof e->event; |
| 3341 | kfree(e); | 3341 | spin_unlock_irqrestore(&dev->event_lock, flags); |
| 3342 | kfree(e); | ||
| 3343 | } | ||
| 3342 | } | 3344 | } |
| 3343 | 3345 | ||
| 3344 | out: | 3346 | out: |
diff --git a/drivers/gpu/drm/drm_fops.c b/drivers/gpu/drm/drm_fops.c index cdfbf27b2b3c..123de28f94ef 100644 --- a/drivers/gpu/drm/drm_fops.c +++ b/drivers/gpu/drm/drm_fops.c | |||
| @@ -507,12 +507,12 @@ int drm_release(struct inode *inode, struct file *filp) | |||
| 507 | 507 | ||
| 508 | drm_events_release(file_priv); | 508 | drm_events_release(file_priv); |
| 509 | 509 | ||
| 510 | if (dev->driver->driver_features & DRIVER_GEM) | ||
| 511 | drm_gem_release(dev, file_priv); | ||
| 512 | |||
| 513 | if (dev->driver->driver_features & DRIVER_MODESET) | 510 | if (dev->driver->driver_features & DRIVER_MODESET) |
| 514 | drm_fb_release(file_priv); | 511 | drm_fb_release(file_priv); |
| 515 | 512 | ||
| 513 | if (dev->driver->driver_features & DRIVER_GEM) | ||
| 514 | drm_gem_release(dev, file_priv); | ||
| 515 | |||
| 516 | mutex_lock(&dev->ctxlist_mutex); | 516 | mutex_lock(&dev->ctxlist_mutex); |
| 517 | if (!list_empty(&dev->ctxlist)) { | 517 | if (!list_empty(&dev->ctxlist)) { |
| 518 | struct drm_ctx_list *pos, *n; | 518 | struct drm_ctx_list *pos, *n; |
diff --git a/drivers/gpu/drm/drm_usb.c b/drivers/gpu/drm/drm_usb.c index c8c83dad2ce1..37c9a523dd1c 100644 --- a/drivers/gpu/drm/drm_usb.c +++ b/drivers/gpu/drm/drm_usb.c | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | #include "drmP.h" | 1 | #include "drmP.h" |
| 2 | #include <linux/usb.h> | 2 | #include <linux/usb.h> |
| 3 | #include <linux/export.h> | 3 | #include <linux/module.h> |
| 4 | 4 | ||
| 5 | int drm_get_usb_dev(struct usb_interface *interface, | 5 | int drm_get_usb_dev(struct usb_interface *interface, |
| 6 | const struct usb_device_id *id, | 6 | const struct usb_device_id *id, |
| @@ -114,3 +114,7 @@ void drm_usb_exit(struct drm_driver *driver, | |||
| 114 | usb_deregister(udriver); | 114 | usb_deregister(udriver); |
| 115 | } | 115 | } |
| 116 | EXPORT_SYMBOL(drm_usb_exit); | 116 | EXPORT_SYMBOL(drm_usb_exit); |
| 117 | |||
| 118 | MODULE_AUTHOR("David Airlie"); | ||
| 119 | MODULE_DESCRIPTION("USB DRM support"); | ||
| 120 | MODULE_LICENSE("GPL and additional rights"); | ||
diff --git a/drivers/gpu/drm/exynos/exynos_drm_gem.c b/drivers/gpu/drm/exynos/exynos_drm_gem.c index 26d51979116b..1dffa8359f88 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_gem.c +++ b/drivers/gpu/drm/exynos/exynos_drm_gem.c | |||
| @@ -149,22 +149,12 @@ static int exynos_drm_gem_map_pages(struct drm_gem_object *obj, | |||
| 149 | unsigned long pfn; | 149 | unsigned long pfn; |
| 150 | 150 | ||
| 151 | if (exynos_gem_obj->flags & EXYNOS_BO_NONCONTIG) { | 151 | if (exynos_gem_obj->flags & EXYNOS_BO_NONCONTIG) { |
| 152 | unsigned long usize = buf->size; | ||
| 153 | |||
| 154 | if (!buf->pages) | 152 | if (!buf->pages) |
| 155 | return -EINTR; | 153 | return -EINTR; |
| 156 | 154 | ||
| 157 | while (usize > 0) { | 155 | pfn = page_to_pfn(buf->pages[page_offset++]); |
| 158 | pfn = page_to_pfn(buf->pages[page_offset++]); | 156 | } else |
| 159 | vm_insert_mixed(vma, f_vaddr, pfn); | 157 | pfn = (buf->dma_addr >> PAGE_SHIFT) + page_offset; |
| 160 | f_vaddr += PAGE_SIZE; | ||
| 161 | usize -= PAGE_SIZE; | ||
| 162 | } | ||
| 163 | |||
| 164 | return 0; | ||
| 165 | } | ||
| 166 | |||
| 167 | pfn = (buf->dma_addr >> PAGE_SHIFT) + page_offset; | ||
| 168 | 158 | ||
| 169 | return vm_insert_mixed(vma, f_vaddr, pfn); | 159 | return vm_insert_mixed(vma, f_vaddr, pfn); |
| 170 | } | 160 | } |
| @@ -524,6 +514,8 @@ static int exynos_drm_gem_mmap_buffer(struct file *filp, | |||
| 524 | if (!buffer->pages) | 514 | if (!buffer->pages) |
| 525 | return -EINVAL; | 515 | return -EINVAL; |
| 526 | 516 | ||
| 517 | vma->vm_flags |= VM_MIXEDMAP; | ||
| 518 | |||
| 527 | do { | 519 | do { |
| 528 | ret = vm_insert_page(vma, uaddr, buffer->pages[i++]); | 520 | ret = vm_insert_page(vma, uaddr, buffer->pages[i++]); |
| 529 | if (ret) { | 521 | if (ret) { |
| @@ -581,10 +573,8 @@ int exynos_drm_gem_mmap_ioctl(struct drm_device *dev, void *data, | |||
| 581 | obj->filp->f_op = &exynos_drm_gem_fops; | 573 | obj->filp->f_op = &exynos_drm_gem_fops; |
| 582 | obj->filp->private_data = obj; | 574 | obj->filp->private_data = obj; |
| 583 | 575 | ||
| 584 | down_write(¤t->mm->mmap_sem); | 576 | addr = vm_mmap(obj->filp, 0, args->size, |
| 585 | addr = do_mmap(obj->filp, 0, args->size, | ||
| 586 | PROT_READ | PROT_WRITE, MAP_SHARED, 0); | 577 | PROT_READ | PROT_WRITE, MAP_SHARED, 0); |
| 587 | up_write(¤t->mm->mmap_sem); | ||
| 588 | 578 | ||
| 589 | drm_gem_object_unreference_unlocked(obj); | 579 | drm_gem_object_unreference_unlocked(obj); |
| 590 | 580 | ||
| @@ -712,7 +702,6 @@ int exynos_drm_gem_dumb_destroy(struct drm_file *file_priv, | |||
| 712 | int exynos_drm_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf) | 702 | int exynos_drm_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf) |
| 713 | { | 703 | { |
| 714 | struct drm_gem_object *obj = vma->vm_private_data; | 704 | struct drm_gem_object *obj = vma->vm_private_data; |
| 715 | struct exynos_drm_gem_obj *exynos_gem_obj = to_exynos_gem_obj(obj); | ||
| 716 | struct drm_device *dev = obj->dev; | 705 | struct drm_device *dev = obj->dev; |
| 717 | unsigned long f_vaddr; | 706 | unsigned long f_vaddr; |
| 718 | pgoff_t page_offset; | 707 | pgoff_t page_offset; |
| @@ -724,21 +713,10 @@ int exynos_drm_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf) | |||
| 724 | 713 | ||
| 725 | mutex_lock(&dev->struct_mutex); | 714 | mutex_lock(&dev->struct_mutex); |
| 726 | 715 | ||
| 727 | /* | ||
| 728 | * allocate all pages as desired size if user wants to allocate | ||
| 729 | * physically non-continuous memory. | ||
| 730 | */ | ||
| 731 | if (exynos_gem_obj->flags & EXYNOS_BO_NONCONTIG) { | ||
| 732 | ret = exynos_drm_gem_get_pages(obj); | ||
| 733 | if (ret < 0) | ||
| 734 | goto err; | ||
| 735 | } | ||
| 736 | |||
| 737 | ret = exynos_drm_gem_map_pages(obj, vma, f_vaddr, page_offset); | 716 | ret = exynos_drm_gem_map_pages(obj, vma, f_vaddr, page_offset); |
| 738 | if (ret < 0) | 717 | if (ret < 0) |
| 739 | DRM_ERROR("failed to map pages.\n"); | 718 | DRM_ERROR("failed to map pages.\n"); |
| 740 | 719 | ||
| 741 | err: | ||
| 742 | mutex_unlock(&dev->struct_mutex); | 720 | mutex_unlock(&dev->struct_mutex); |
| 743 | 721 | ||
| 744 | return convert_to_vm_err_msg(ret); | 722 | return convert_to_vm_err_msg(ret); |
diff --git a/drivers/gpu/drm/gma500/mdfld_dsi_output.h b/drivers/gpu/drm/gma500/mdfld_dsi_output.h index 21071cef92a4..36eb0744841c 100644 --- a/drivers/gpu/drm/gma500/mdfld_dsi_output.h +++ b/drivers/gpu/drm/gma500/mdfld_dsi_output.h | |||
| @@ -29,7 +29,6 @@ | |||
| 29 | #define __MDFLD_DSI_OUTPUT_H__ | 29 | #define __MDFLD_DSI_OUTPUT_H__ |
| 30 | 30 | ||
| 31 | #include <linux/backlight.h> | 31 | #include <linux/backlight.h> |
| 32 | #include <linux/version.h> | ||
| 33 | #include <drm/drmP.h> | 32 | #include <drm/drmP.h> |
| 34 | #include <drm/drm.h> | 33 | #include <drm/drm.h> |
| 35 | #include <drm/drm_crtc.h> | 34 | #include <drm/drm_crtc.h> |
diff --git a/drivers/gpu/drm/i810/i810_dma.c b/drivers/gpu/drm/i810/i810_dma.c index 2c8a60c3b98e..f920fb5e42b6 100644 --- a/drivers/gpu/drm/i810/i810_dma.c +++ b/drivers/gpu/drm/i810/i810_dma.c | |||
| @@ -129,6 +129,7 @@ static int i810_map_buffer(struct drm_buf *buf, struct drm_file *file_priv) | |||
| 129 | if (buf_priv->currently_mapped == I810_BUF_MAPPED) | 129 | if (buf_priv->currently_mapped == I810_BUF_MAPPED) |
| 130 | return -EINVAL; | 130 | return -EINVAL; |
| 131 | 131 | ||
| 132 | /* This is all entirely broken */ | ||
| 132 | down_write(¤t->mm->mmap_sem); | 133 | down_write(¤t->mm->mmap_sem); |
| 133 | old_fops = file_priv->filp->f_op; | 134 | old_fops = file_priv->filp->f_op; |
| 134 | file_priv->filp->f_op = &i810_buffer_fops; | 135 | file_priv->filp->f_op = &i810_buffer_fops; |
| @@ -157,11 +158,8 @@ static int i810_unmap_buffer(struct drm_buf *buf) | |||
| 157 | if (buf_priv->currently_mapped != I810_BUF_MAPPED) | 158 | if (buf_priv->currently_mapped != I810_BUF_MAPPED) |
| 158 | return -EINVAL; | 159 | return -EINVAL; |
| 159 | 160 | ||
| 160 | down_write(¤t->mm->mmap_sem); | 161 | retcode = vm_munmap((unsigned long)buf_priv->virtual, |
| 161 | retcode = do_munmap(current->mm, | ||
| 162 | (unsigned long)buf_priv->virtual, | ||
| 163 | (size_t) buf->total); | 162 | (size_t) buf->total); |
| 164 | up_write(¤t->mm->mmap_sem); | ||
| 165 | 163 | ||
| 166 | buf_priv->currently_mapped = I810_BUF_UNMAPPED; | 164 | buf_priv->currently_mapped = I810_BUF_UNMAPPED; |
| 167 | buf_priv->virtual = NULL; | 165 | buf_priv->virtual = NULL; |
diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c index b505b70dba05..e6162a1681f0 100644 --- a/drivers/gpu/drm/i915/i915_debugfs.c +++ b/drivers/gpu/drm/i915/i915_debugfs.c | |||
| @@ -1224,6 +1224,9 @@ static int i915_emon_status(struct seq_file *m, void *unused) | |||
| 1224 | unsigned long temp, chipset, gfx; | 1224 | unsigned long temp, chipset, gfx; |
| 1225 | int ret; | 1225 | int ret; |
| 1226 | 1226 | ||
| 1227 | if (!IS_GEN5(dev)) | ||
| 1228 | return -ENODEV; | ||
| 1229 | |||
| 1227 | ret = mutex_lock_interruptible(&dev->struct_mutex); | 1230 | ret = mutex_lock_interruptible(&dev->struct_mutex); |
| 1228 | if (ret) | 1231 | if (ret) |
| 1229 | return ret; | 1232 | return ret; |
diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c index 785f67f963ef..ba60f3c8f911 100644 --- a/drivers/gpu/drm/i915/i915_dma.c +++ b/drivers/gpu/drm/i915/i915_dma.c | |||
| @@ -1701,6 +1701,9 @@ void i915_update_gfx_val(struct drm_i915_private *dev_priv) | |||
| 1701 | unsigned long diffms; | 1701 | unsigned long diffms; |
| 1702 | u32 count; | 1702 | u32 count; |
| 1703 | 1703 | ||
| 1704 | if (dev_priv->info->gen != 5) | ||
| 1705 | return; | ||
| 1706 | |||
| 1704 | getrawmonotonic(&now); | 1707 | getrawmonotonic(&now); |
| 1705 | diff1 = timespec_sub(now, dev_priv->last_time2); | 1708 | diff1 = timespec_sub(now, dev_priv->last_time2); |
| 1706 | 1709 | ||
| @@ -2121,12 +2124,14 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags) | |||
| 2121 | setup_timer(&dev_priv->hangcheck_timer, i915_hangcheck_elapsed, | 2124 | setup_timer(&dev_priv->hangcheck_timer, i915_hangcheck_elapsed, |
| 2122 | (unsigned long) dev); | 2125 | (unsigned long) dev); |
| 2123 | 2126 | ||
| 2124 | spin_lock(&mchdev_lock); | 2127 | if (IS_GEN5(dev)) { |
| 2125 | i915_mch_dev = dev_priv; | 2128 | spin_lock(&mchdev_lock); |
| 2126 | dev_priv->mchdev_lock = &mchdev_lock; | 2129 | i915_mch_dev = dev_priv; |
| 2127 | spin_unlock(&mchdev_lock); | 2130 | dev_priv->mchdev_lock = &mchdev_lock; |
| 2131 | spin_unlock(&mchdev_lock); | ||
| 2128 | 2132 | ||
| 2129 | ips_ping_for_i915_load(); | 2133 | ips_ping_for_i915_load(); |
| 2134 | } | ||
| 2130 | 2135 | ||
| 2131 | return 0; | 2136 | return 0; |
| 2132 | 2137 | ||
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index 0e3c6acde955..0d1e4b7b4b99 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c | |||
| @@ -1087,11 +1087,9 @@ i915_gem_mmap_ioctl(struct drm_device *dev, void *data, | |||
| 1087 | if (obj == NULL) | 1087 | if (obj == NULL) |
| 1088 | return -ENOENT; | 1088 | return -ENOENT; |
| 1089 | 1089 | ||
| 1090 | down_write(¤t->mm->mmap_sem); | 1090 | addr = vm_mmap(obj->filp, 0, args->size, |
| 1091 | addr = do_mmap(obj->filp, 0, args->size, | ||
| 1092 | PROT_READ | PROT_WRITE, MAP_SHARED, | 1091 | PROT_READ | PROT_WRITE, MAP_SHARED, |
| 1093 | args->offset); | 1092 | args->offset); |
| 1094 | up_write(¤t->mm->mmap_sem); | ||
| 1095 | drm_gem_object_unreference_unlocked(obj); | 1093 | drm_gem_object_unreference_unlocked(obj); |
| 1096 | if (IS_ERR((void *)addr)) | 1094 | if (IS_ERR((void *)addr)) |
| 1097 | return addr; | 1095 | return addr; |
diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c index f51a696486cb..de431942ded4 100644 --- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c +++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c | |||
| @@ -1133,6 +1133,11 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data, | |||
| 1133 | return -EINVAL; | 1133 | return -EINVAL; |
| 1134 | } | 1134 | } |
| 1135 | 1135 | ||
| 1136 | if (args->num_cliprects > UINT_MAX / sizeof(*cliprects)) { | ||
| 1137 | DRM_DEBUG("execbuf with %u cliprects\n", | ||
| 1138 | args->num_cliprects); | ||
| 1139 | return -EINVAL; | ||
| 1140 | } | ||
| 1136 | cliprects = kmalloc(args->num_cliprects * sizeof(*cliprects), | 1141 | cliprects = kmalloc(args->num_cliprects * sizeof(*cliprects), |
| 1137 | GFP_KERNEL); | 1142 | GFP_KERNEL); |
| 1138 | if (cliprects == NULL) { | 1143 | if (cliprects == NULL) { |
| @@ -1404,7 +1409,8 @@ i915_gem_execbuffer2(struct drm_device *dev, void *data, | |||
| 1404 | struct drm_i915_gem_exec_object2 *exec2_list = NULL; | 1409 | struct drm_i915_gem_exec_object2 *exec2_list = NULL; |
| 1405 | int ret; | 1410 | int ret; |
| 1406 | 1411 | ||
| 1407 | if (args->buffer_count < 1) { | 1412 | if (args->buffer_count < 1 || |
| 1413 | args->buffer_count > UINT_MAX / sizeof(*exec2_list)) { | ||
| 1408 | DRM_DEBUG("execbuf2 with %d buffers\n", args->buffer_count); | 1414 | DRM_DEBUG("execbuf2 with %d buffers\n", args->buffer_count); |
| 1409 | return -EINVAL; | 1415 | return -EINVAL; |
| 1410 | } | 1416 | } |
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h index b4bb1ef77ddc..9d24d65f0c3e 100644 --- a/drivers/gpu/drm/i915/i915_reg.h +++ b/drivers/gpu/drm/i915/i915_reg.h | |||
| @@ -568,6 +568,7 @@ | |||
| 568 | #define CM0_MASK_SHIFT 16 | 568 | #define CM0_MASK_SHIFT 16 |
| 569 | #define CM0_IZ_OPT_DISABLE (1<<6) | 569 | #define CM0_IZ_OPT_DISABLE (1<<6) |
| 570 | #define CM0_ZR_OPT_DISABLE (1<<5) | 570 | #define CM0_ZR_OPT_DISABLE (1<<5) |
| 571 | #define CM0_STC_EVICT_DISABLE_LRA_SNB (1<<5) | ||
| 571 | #define CM0_DEPTH_EVICT_DISABLE (1<<4) | 572 | #define CM0_DEPTH_EVICT_DISABLE (1<<4) |
| 572 | #define CM0_COLOR_EVICT_DISABLE (1<<3) | 573 | #define CM0_COLOR_EVICT_DISABLE (1<<3) |
| 573 | #define CM0_DEPTH_WRITE_DISABLE (1<<1) | 574 | #define CM0_DEPTH_WRITE_DISABLE (1<<1) |
diff --git a/drivers/gpu/drm/i915/intel_crt.c b/drivers/gpu/drm/i915/intel_crt.c index 4d3d736a4f56..90b9793fd5da 100644 --- a/drivers/gpu/drm/i915/intel_crt.c +++ b/drivers/gpu/drm/i915/intel_crt.c | |||
| @@ -430,8 +430,8 @@ intel_crt_detect(struct drm_connector *connector, bool force) | |||
| 430 | { | 430 | { |
| 431 | struct drm_device *dev = connector->dev; | 431 | struct drm_device *dev = connector->dev; |
| 432 | struct intel_crt *crt = intel_attached_crt(connector); | 432 | struct intel_crt *crt = intel_attached_crt(connector); |
| 433 | struct drm_crtc *crtc; | ||
| 434 | enum drm_connector_status status; | 433 | enum drm_connector_status status; |
| 434 | struct intel_load_detect_pipe tmp; | ||
| 435 | 435 | ||
| 436 | if (I915_HAS_HOTPLUG(dev)) { | 436 | if (I915_HAS_HOTPLUG(dev)) { |
| 437 | if (intel_crt_detect_hotplug(connector)) { | 437 | if (intel_crt_detect_hotplug(connector)) { |
| @@ -450,23 +450,16 @@ intel_crt_detect(struct drm_connector *connector, bool force) | |||
| 450 | return connector->status; | 450 | return connector->status; |
| 451 | 451 | ||
| 452 | /* for pre-945g platforms use load detect */ | 452 | /* for pre-945g platforms use load detect */ |
| 453 | crtc = crt->base.base.crtc; | 453 | if (intel_get_load_detect_pipe(&crt->base, connector, NULL, |
| 454 | if (crtc && crtc->enabled) { | 454 | &tmp)) { |
| 455 | status = intel_crt_load_detect(crt); | 455 | if (intel_crt_detect_ddc(connector)) |
| 456 | } else { | 456 | status = connector_status_connected; |
| 457 | struct intel_load_detect_pipe tmp; | 457 | else |
| 458 | 458 | status = intel_crt_load_detect(crt); | |
| 459 | if (intel_get_load_detect_pipe(&crt->base, connector, NULL, | 459 | intel_release_load_detect_pipe(&crt->base, connector, |
| 460 | &tmp)) { | 460 | &tmp); |
| 461 | if (intel_crt_detect_ddc(connector)) | 461 | } else |
| 462 | status = connector_status_connected; | 462 | status = connector_status_unknown; |
| 463 | else | ||
| 464 | status = intel_crt_load_detect(crt); | ||
| 465 | intel_release_load_detect_pipe(&crt->base, connector, | ||
| 466 | &tmp); | ||
| 467 | } else | ||
| 468 | status = connector_status_unknown; | ||
| 469 | } | ||
| 470 | 463 | ||
| 471 | return status; | 464 | return status; |
| 472 | } | 465 | } |
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index bae38acf44dc..1b1cf3b3ff51 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
| @@ -3478,8 +3478,11 @@ static bool intel_crtc_mode_fixup(struct drm_crtc *crtc, | |||
| 3478 | return false; | 3478 | return false; |
| 3479 | } | 3479 | } |
| 3480 | 3480 | ||
| 3481 | /* All interlaced capable intel hw wants timings in frames. */ | 3481 | /* All interlaced capable intel hw wants timings in frames. Note though |
| 3482 | drm_mode_set_crtcinfo(adjusted_mode, 0); | 3482 | * that intel_lvds_mode_fixup does some funny tricks with the crtc |
| 3483 | * timings, so we need to be careful not to clobber these.*/ | ||
| 3484 | if (!(adjusted_mode->private_flags & INTEL_MODE_CRTC_TIMINGS_SET)) | ||
| 3485 | drm_mode_set_crtcinfo(adjusted_mode, 0); | ||
| 3483 | 3486 | ||
| 3484 | return true; | 3487 | return true; |
| 3485 | } | 3488 | } |
| @@ -7069,9 +7072,6 @@ static void intel_decrease_pllclock(struct drm_crtc *crtc) | |||
| 7069 | struct drm_device *dev = crtc->dev; | 7072 | struct drm_device *dev = crtc->dev; |
| 7070 | drm_i915_private_t *dev_priv = dev->dev_private; | 7073 | drm_i915_private_t *dev_priv = dev->dev_private; |
| 7071 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); | 7074 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); |
| 7072 | int pipe = intel_crtc->pipe; | ||
| 7073 | int dpll_reg = DPLL(pipe); | ||
| 7074 | int dpll = I915_READ(dpll_reg); | ||
| 7075 | 7075 | ||
| 7076 | if (HAS_PCH_SPLIT(dev)) | 7076 | if (HAS_PCH_SPLIT(dev)) |
| 7077 | return; | 7077 | return; |
| @@ -7084,10 +7084,15 @@ static void intel_decrease_pllclock(struct drm_crtc *crtc) | |||
| 7084 | * the manual case. | 7084 | * the manual case. |
| 7085 | */ | 7085 | */ |
| 7086 | if (!HAS_PIPE_CXSR(dev) && intel_crtc->lowfreq_avail) { | 7086 | if (!HAS_PIPE_CXSR(dev) && intel_crtc->lowfreq_avail) { |
| 7087 | int pipe = intel_crtc->pipe; | ||
| 7088 | int dpll_reg = DPLL(pipe); | ||
| 7089 | u32 dpll; | ||
| 7090 | |||
| 7087 | DRM_DEBUG_DRIVER("downclocking LVDS\n"); | 7091 | DRM_DEBUG_DRIVER("downclocking LVDS\n"); |
| 7088 | 7092 | ||
| 7089 | assert_panel_unlocked(dev_priv, pipe); | 7093 | assert_panel_unlocked(dev_priv, pipe); |
| 7090 | 7094 | ||
| 7095 | dpll = I915_READ(dpll_reg); | ||
| 7091 | dpll |= DISPLAY_RATE_SELECT_FPA1; | 7096 | dpll |= DISPLAY_RATE_SELECT_FPA1; |
| 7092 | I915_WRITE(dpll_reg, dpll); | 7097 | I915_WRITE(dpll_reg, dpll); |
| 7093 | intel_wait_for_vblank(dev, pipe); | 7098 | intel_wait_for_vblank(dev, pipe); |
| @@ -7095,7 +7100,6 @@ static void intel_decrease_pllclock(struct drm_crtc *crtc) | |||
| 7095 | if (!(dpll & DISPLAY_RATE_SELECT_FPA1)) | 7100 | if (!(dpll & DISPLAY_RATE_SELECT_FPA1)) |
| 7096 | DRM_DEBUG_DRIVER("failed to downclock LVDS!\n"); | 7101 | DRM_DEBUG_DRIVER("failed to downclock LVDS!\n"); |
| 7097 | } | 7102 | } |
| 7098 | |||
| 7099 | } | 7103 | } |
| 7100 | 7104 | ||
| 7101 | /** | 7105 | /** |
| @@ -7465,7 +7469,13 @@ static int intel_gen6_queue_flip(struct drm_device *dev, | |||
| 7465 | OUT_RING(fb->pitches[0] | obj->tiling_mode); | 7469 | OUT_RING(fb->pitches[0] | obj->tiling_mode); |
| 7466 | OUT_RING(obj->gtt_offset); | 7470 | OUT_RING(obj->gtt_offset); |
| 7467 | 7471 | ||
| 7468 | pf = I915_READ(PF_CTL(intel_crtc->pipe)) & PF_ENABLE; | 7472 | /* Contrary to the suggestions in the documentation, |
| 7473 | * "Enable Panel Fitter" does not seem to be required when page | ||
| 7474 | * flipping with a non-native mode, and worse causes a normal | ||
| 7475 | * modeset to fail. | ||
| 7476 | * pf = I915_READ(PF_CTL(intel_crtc->pipe)) & PF_ENABLE; | ||
| 7477 | */ | ||
| 7478 | pf = 0; | ||
| 7469 | pipesrc = I915_READ(PIPESRC(intel_crtc->pipe)) & 0x0fff0fff; | 7479 | pipesrc = I915_READ(PIPESRC(intel_crtc->pipe)) & 0x0fff0fff; |
| 7470 | OUT_RING(pf | pipesrc); | 7480 | OUT_RING(pf | pipesrc); |
| 7471 | ADVANCE_LP_RING(); | 7481 | ADVANCE_LP_RING(); |
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h index 5a14149b3794..715afa153025 100644 --- a/drivers/gpu/drm/i915/intel_drv.h +++ b/drivers/gpu/drm/i915/intel_drv.h | |||
| @@ -105,6 +105,10 @@ | |||
| 105 | #define INTEL_MODE_PIXEL_MULTIPLIER_SHIFT (0x0) | 105 | #define INTEL_MODE_PIXEL_MULTIPLIER_SHIFT (0x0) |
| 106 | #define INTEL_MODE_PIXEL_MULTIPLIER_MASK (0xf << INTEL_MODE_PIXEL_MULTIPLIER_SHIFT) | 106 | #define INTEL_MODE_PIXEL_MULTIPLIER_MASK (0xf << INTEL_MODE_PIXEL_MULTIPLIER_SHIFT) |
| 107 | #define INTEL_MODE_DP_FORCE_6BPC (0x10) | 107 | #define INTEL_MODE_DP_FORCE_6BPC (0x10) |
| 108 | /* This flag must be set by the encoder's mode_fixup if it changes the crtc | ||
| 109 | * timings in the mode to prevent the crtc fixup from overwriting them. | ||
| 110 | * Currently only lvds needs that. */ | ||
| 111 | #define INTEL_MODE_CRTC_TIMINGS_SET (0x20) | ||
| 108 | 112 | ||
| 109 | static inline void | 113 | static inline void |
| 110 | intel_mode_set_pixel_multiplier(struct drm_display_mode *mode, | 114 | intel_mode_set_pixel_multiplier(struct drm_display_mode *mode, |
diff --git a/drivers/gpu/drm/i915/intel_fb.c b/drivers/gpu/drm/i915/intel_fb.c index 19ecd78b8a2c..6e9ee33fd412 100644 --- a/drivers/gpu/drm/i915/intel_fb.c +++ b/drivers/gpu/drm/i915/intel_fb.c | |||
| @@ -279,6 +279,8 @@ void intel_fb_restore_mode(struct drm_device *dev) | |||
| 279 | struct drm_mode_config *config = &dev->mode_config; | 279 | struct drm_mode_config *config = &dev->mode_config; |
| 280 | struct drm_plane *plane; | 280 | struct drm_plane *plane; |
| 281 | 281 | ||
| 282 | mutex_lock(&dev->mode_config.mutex); | ||
| 283 | |||
| 282 | ret = drm_fb_helper_restore_fbdev_mode(&dev_priv->fbdev->helper); | 284 | ret = drm_fb_helper_restore_fbdev_mode(&dev_priv->fbdev->helper); |
| 283 | if (ret) | 285 | if (ret) |
| 284 | DRM_DEBUG("failed to restore crtc mode\n"); | 286 | DRM_DEBUG("failed to restore crtc mode\n"); |
| @@ -286,4 +288,6 @@ void intel_fb_restore_mode(struct drm_device *dev) | |||
| 286 | /* Be sure to shut off any planes that may be active */ | 288 | /* Be sure to shut off any planes that may be active */ |
| 287 | list_for_each_entry(plane, &config->plane_list, head) | 289 | list_for_each_entry(plane, &config->plane_list, head) |
| 288 | plane->funcs->disable_plane(plane); | 290 | plane->funcs->disable_plane(plane); |
| 291 | |||
| 292 | mutex_unlock(&dev->mode_config.mutex); | ||
| 289 | } | 293 | } |
diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c index cae3e5f17a49..2d7f47b56b6a 100644 --- a/drivers/gpu/drm/i915/intel_hdmi.c +++ b/drivers/gpu/drm/i915/intel_hdmi.c | |||
| @@ -136,7 +136,7 @@ static void i9xx_write_infoframe(struct drm_encoder *encoder, | |||
| 136 | 136 | ||
| 137 | val &= ~VIDEO_DIP_SELECT_MASK; | 137 | val &= ~VIDEO_DIP_SELECT_MASK; |
| 138 | 138 | ||
| 139 | I915_WRITE(VIDEO_DIP_CTL, val | port | flags); | 139 | I915_WRITE(VIDEO_DIP_CTL, VIDEO_DIP_ENABLE | val | port | flags); |
| 140 | 140 | ||
| 141 | for (i = 0; i < len; i += 4) { | 141 | for (i = 0; i < len; i += 4) { |
| 142 | I915_WRITE(VIDEO_DIP_DATA, *data); | 142 | I915_WRITE(VIDEO_DIP_DATA, *data); |
diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c index 95db2e988227..9c71183629c2 100644 --- a/drivers/gpu/drm/i915/intel_lvds.c +++ b/drivers/gpu/drm/i915/intel_lvds.c | |||
| @@ -187,6 +187,8 @@ centre_horizontally(struct drm_display_mode *mode, | |||
| 187 | 187 | ||
| 188 | mode->crtc_hsync_start = mode->crtc_hblank_start + sync_pos; | 188 | mode->crtc_hsync_start = mode->crtc_hblank_start + sync_pos; |
| 189 | mode->crtc_hsync_end = mode->crtc_hsync_start + sync_width; | 189 | mode->crtc_hsync_end = mode->crtc_hsync_start + sync_width; |
| 190 | |||
| 191 | mode->private_flags |= INTEL_MODE_CRTC_TIMINGS_SET; | ||
| 190 | } | 192 | } |
| 191 | 193 | ||
| 192 | static void | 194 | static void |
| @@ -208,6 +210,8 @@ centre_vertically(struct drm_display_mode *mode, | |||
| 208 | 210 | ||
| 209 | mode->crtc_vsync_start = mode->crtc_vblank_start + sync_pos; | 211 | mode->crtc_vsync_start = mode->crtc_vblank_start + sync_pos; |
| 210 | mode->crtc_vsync_end = mode->crtc_vsync_start + sync_width; | 212 | mode->crtc_vsync_end = mode->crtc_vsync_start + sync_width; |
| 213 | |||
| 214 | mode->private_flags |= INTEL_MODE_CRTC_TIMINGS_SET; | ||
| 211 | } | 215 | } |
| 212 | 216 | ||
| 213 | static inline u32 panel_fitter_scaling(u32 source, u32 target) | 217 | static inline u32 panel_fitter_scaling(u32 source, u32 target) |
| @@ -283,6 +287,8 @@ static bool intel_lvds_mode_fixup(struct drm_encoder *encoder, | |||
| 283 | for_each_pipe(pipe) | 287 | for_each_pipe(pipe) |
| 284 | I915_WRITE(BCLRPAT(pipe), 0); | 288 | I915_WRITE(BCLRPAT(pipe), 0); |
| 285 | 289 | ||
| 290 | drm_mode_set_crtcinfo(adjusted_mode, 0); | ||
| 291 | |||
| 286 | switch (intel_lvds->fitting_mode) { | 292 | switch (intel_lvds->fitting_mode) { |
| 287 | case DRM_MODE_SCALE_CENTER: | 293 | case DRM_MODE_SCALE_CENTER: |
| 288 | /* | 294 | /* |
| @@ -744,7 +750,7 @@ static const struct dmi_system_id intel_no_lvds[] = { | |||
| 744 | .ident = "Hewlett-Packard t5745", | 750 | .ident = "Hewlett-Packard t5745", |
| 745 | .matches = { | 751 | .matches = { |
| 746 | DMI_MATCH(DMI_BOARD_VENDOR, "Hewlett-Packard"), | 752 | DMI_MATCH(DMI_BOARD_VENDOR, "Hewlett-Packard"), |
| 747 | DMI_MATCH(DMI_BOARD_NAME, "hp t5745"), | 753 | DMI_MATCH(DMI_PRODUCT_NAME, "hp t5745"), |
| 748 | }, | 754 | }, |
| 749 | }, | 755 | }, |
| 750 | { | 756 | { |
| @@ -752,7 +758,7 @@ static const struct dmi_system_id intel_no_lvds[] = { | |||
| 752 | .ident = "Hewlett-Packard st5747", | 758 | .ident = "Hewlett-Packard st5747", |
| 753 | .matches = { | 759 | .matches = { |
| 754 | DMI_MATCH(DMI_BOARD_VENDOR, "Hewlett-Packard"), | 760 | DMI_MATCH(DMI_BOARD_VENDOR, "Hewlett-Packard"), |
| 755 | DMI_MATCH(DMI_BOARD_NAME, "hp st5747"), | 761 | DMI_MATCH(DMI_PRODUCT_NAME, "hp st5747"), |
| 756 | }, | 762 | }, |
| 757 | }, | 763 | }, |
| 758 | { | 764 | { |
diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c index 230a141dbea3..48177ec4720e 100644 --- a/drivers/gpu/drm/i915/intel_panel.c +++ b/drivers/gpu/drm/i915/intel_panel.c | |||
| @@ -47,8 +47,6 @@ intel_fixed_panel_mode(struct drm_display_mode *fixed_mode, | |||
| 47 | adjusted_mode->vtotal = fixed_mode->vtotal; | 47 | adjusted_mode->vtotal = fixed_mode->vtotal; |
| 48 | 48 | ||
| 49 | adjusted_mode->clock = fixed_mode->clock; | 49 | adjusted_mode->clock = fixed_mode->clock; |
| 50 | |||
| 51 | drm_mode_set_crtcinfo(adjusted_mode, 0); | ||
| 52 | } | 50 | } |
| 53 | 51 | ||
| 54 | /* adjusted_mode has been preset to be the panel's fixed mode */ | 52 | /* adjusted_mode has been preset to be the panel's fixed mode */ |
diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c index f75806e5bff5..80fce51e2f43 100644 --- a/drivers/gpu/drm/i915/intel_ringbuffer.c +++ b/drivers/gpu/drm/i915/intel_ringbuffer.c | |||
| @@ -401,6 +401,14 @@ static int init_render_ring(struct intel_ring_buffer *ring) | |||
| 401 | if (INTEL_INFO(dev)->gen >= 6) { | 401 | if (INTEL_INFO(dev)->gen >= 6) { |
| 402 | I915_WRITE(INSTPM, | 402 | I915_WRITE(INSTPM, |
| 403 | INSTPM_FORCE_ORDERING << 16 | INSTPM_FORCE_ORDERING); | 403 | INSTPM_FORCE_ORDERING << 16 | INSTPM_FORCE_ORDERING); |
| 404 | |||
| 405 | /* From the Sandybridge PRM, volume 1 part 3, page 24: | ||
| 406 | * "If this bit is set, STCunit will have LRA as replacement | ||
| 407 | * policy. [...] This bit must be reset. LRA replacement | ||
| 408 | * policy is not supported." | ||
| 409 | */ | ||
| 410 | I915_WRITE(CACHE_MODE_0, | ||
| 411 | CM0_STC_EVICT_DISABLE_LRA_SNB << CM0_MASK_SHIFT); | ||
| 404 | } | 412 | } |
| 405 | 413 | ||
| 406 | return ret; | 414 | return ret; |
diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c index e36b171c1e7d..232d77d07d8b 100644 --- a/drivers/gpu/drm/i915/intel_sdvo.c +++ b/drivers/gpu/drm/i915/intel_sdvo.c | |||
| @@ -731,6 +731,7 @@ static void intel_sdvo_get_dtd_from_mode(struct intel_sdvo_dtd *dtd, | |||
| 731 | uint16_t width, height; | 731 | uint16_t width, height; |
| 732 | uint16_t h_blank_len, h_sync_len, v_blank_len, v_sync_len; | 732 | uint16_t h_blank_len, h_sync_len, v_blank_len, v_sync_len; |
| 733 | uint16_t h_sync_offset, v_sync_offset; | 733 | uint16_t h_sync_offset, v_sync_offset; |
| 734 | int mode_clock; | ||
| 734 | 735 | ||
| 735 | width = mode->crtc_hdisplay; | 736 | width = mode->crtc_hdisplay; |
| 736 | height = mode->crtc_vdisplay; | 737 | height = mode->crtc_vdisplay; |
| @@ -745,7 +746,11 @@ static void intel_sdvo_get_dtd_from_mode(struct intel_sdvo_dtd *dtd, | |||
| 745 | h_sync_offset = mode->crtc_hsync_start - mode->crtc_hblank_start; | 746 | h_sync_offset = mode->crtc_hsync_start - mode->crtc_hblank_start; |
| 746 | v_sync_offset = mode->crtc_vsync_start - mode->crtc_vblank_start; | 747 | v_sync_offset = mode->crtc_vsync_start - mode->crtc_vblank_start; |
| 747 | 748 | ||
| 748 | dtd->part1.clock = mode->clock / 10; | 749 | mode_clock = mode->clock; |
| 750 | mode_clock /= intel_mode_get_pixel_multiplier(mode) ?: 1; | ||
| 751 | mode_clock /= 10; | ||
| 752 | dtd->part1.clock = mode_clock; | ||
| 753 | |||
| 749 | dtd->part1.h_active = width & 0xff; | 754 | dtd->part1.h_active = width & 0xff; |
| 750 | dtd->part1.h_blank = h_blank_len & 0xff; | 755 | dtd->part1.h_blank = h_blank_len & 0xff; |
| 751 | dtd->part1.h_high = (((width >> 8) & 0xf) << 4) | | 756 | dtd->part1.h_high = (((width >> 8) & 0xf) << 4) | |
| @@ -996,7 +1001,7 @@ static void intel_sdvo_mode_set(struct drm_encoder *encoder, | |||
| 996 | struct intel_sdvo *intel_sdvo = to_intel_sdvo(encoder); | 1001 | struct intel_sdvo *intel_sdvo = to_intel_sdvo(encoder); |
| 997 | u32 sdvox; | 1002 | u32 sdvox; |
| 998 | struct intel_sdvo_in_out_map in_out; | 1003 | struct intel_sdvo_in_out_map in_out; |
| 999 | struct intel_sdvo_dtd input_dtd; | 1004 | struct intel_sdvo_dtd input_dtd, output_dtd; |
| 1000 | int pixel_multiplier = intel_mode_get_pixel_multiplier(adjusted_mode); | 1005 | int pixel_multiplier = intel_mode_get_pixel_multiplier(adjusted_mode); |
| 1001 | int rate; | 1006 | int rate; |
| 1002 | 1007 | ||
| @@ -1021,20 +1026,13 @@ static void intel_sdvo_mode_set(struct drm_encoder *encoder, | |||
| 1021 | intel_sdvo->attached_output)) | 1026 | intel_sdvo->attached_output)) |
| 1022 | return; | 1027 | return; |
| 1023 | 1028 | ||
| 1024 | /* We have tried to get input timing in mode_fixup, and filled into | 1029 | /* lvds has a special fixed output timing. */ |
| 1025 | * adjusted_mode. | 1030 | if (intel_sdvo->is_lvds) |
| 1026 | */ | 1031 | intel_sdvo_get_dtd_from_mode(&output_dtd, |
| 1027 | if (intel_sdvo->is_tv || intel_sdvo->is_lvds) { | 1032 | intel_sdvo->sdvo_lvds_fixed_mode); |
| 1028 | input_dtd = intel_sdvo->input_dtd; | 1033 | else |
| 1029 | } else { | 1034 | intel_sdvo_get_dtd_from_mode(&output_dtd, mode); |
| 1030 | /* Set the output timing to the screen */ | 1035 | (void) intel_sdvo_set_output_timing(intel_sdvo, &output_dtd); |
| 1031 | if (!intel_sdvo_set_target_output(intel_sdvo, | ||
| 1032 | intel_sdvo->attached_output)) | ||
| 1033 | return; | ||
| 1034 | |||
| 1035 | intel_sdvo_get_dtd_from_mode(&input_dtd, adjusted_mode); | ||
| 1036 | (void) intel_sdvo_set_output_timing(intel_sdvo, &input_dtd); | ||
| 1037 | } | ||
| 1038 | 1036 | ||
| 1039 | /* Set the input timing to the screen. Assume always input 0. */ | 1037 | /* Set the input timing to the screen. Assume always input 0. */ |
| 1040 | if (!intel_sdvo_set_target_input(intel_sdvo)) | 1038 | if (!intel_sdvo_set_target_input(intel_sdvo)) |
| @@ -1052,6 +1050,10 @@ static void intel_sdvo_mode_set(struct drm_encoder *encoder, | |||
| 1052 | !intel_sdvo_set_tv_format(intel_sdvo)) | 1050 | !intel_sdvo_set_tv_format(intel_sdvo)) |
| 1053 | return; | 1051 | return; |
| 1054 | 1052 | ||
| 1053 | /* We have tried to get input timing in mode_fixup, and filled into | ||
| 1054 | * adjusted_mode. | ||
| 1055 | */ | ||
| 1056 | intel_sdvo_get_dtd_from_mode(&input_dtd, adjusted_mode); | ||
| 1055 | (void) intel_sdvo_set_input_timing(intel_sdvo, &input_dtd); | 1057 | (void) intel_sdvo_set_input_timing(intel_sdvo, &input_dtd); |
| 1056 | 1058 | ||
| 1057 | switch (pixel_multiplier) { | 1059 | switch (pixel_multiplier) { |
diff --git a/drivers/gpu/drm/nouveau/nouveau_acpi.c b/drivers/gpu/drm/nouveau/nouveau_acpi.c index 7814a760c164..284bd25d5d21 100644 --- a/drivers/gpu/drm/nouveau/nouveau_acpi.c +++ b/drivers/gpu/drm/nouveau/nouveau_acpi.c | |||
| @@ -270,7 +270,7 @@ static bool nouveau_dsm_detect(void) | |||
| 270 | struct acpi_buffer buffer = {sizeof(acpi_method_name), acpi_method_name}; | 270 | struct acpi_buffer buffer = {sizeof(acpi_method_name), acpi_method_name}; |
| 271 | struct pci_dev *pdev = NULL; | 271 | struct pci_dev *pdev = NULL; |
| 272 | int has_dsm = 0; | 272 | int has_dsm = 0; |
| 273 | int has_optimus; | 273 | int has_optimus = 0; |
| 274 | int vga_count = 0; | 274 | int vga_count = 0; |
| 275 | bool guid_valid; | 275 | bool guid_valid; |
| 276 | int retval; | 276 | int retval; |
diff --git a/drivers/gpu/drm/nouveau/nouveau_bios.c b/drivers/gpu/drm/nouveau/nouveau_bios.c index 80963d05b54a..0be4a815e706 100644 --- a/drivers/gpu/drm/nouveau/nouveau_bios.c +++ b/drivers/gpu/drm/nouveau/nouveau_bios.c | |||
| @@ -6156,10 +6156,14 @@ dcb_fake_connectors(struct nvbios *bios) | |||
| 6156 | 6156 | ||
| 6157 | /* heuristic: if we ever get a non-zero connector field, assume | 6157 | /* heuristic: if we ever get a non-zero connector field, assume |
| 6158 | * that all the indices are valid and we don't need fake them. | 6158 | * that all the indices are valid and we don't need fake them. |
| 6159 | * | ||
| 6160 | * and, as usual, a blacklist of boards with bad bios data.. | ||
| 6159 | */ | 6161 | */ |
| 6160 | for (i = 0; i < dcbt->entries; i++) { | 6162 | if (!nv_match_device(bios->dev, 0x0392, 0x107d, 0x20a2)) { |
| 6161 | if (dcbt->entry[i].connector) | 6163 | for (i = 0; i < dcbt->entries; i++) { |
| 6162 | return; | 6164 | if (dcbt->entry[i].connector) |
| 6165 | return; | ||
| 6166 | } | ||
| 6163 | } | 6167 | } |
| 6164 | 6168 | ||
| 6165 | /* no useful connector info available, we need to make it up | 6169 | /* no useful connector info available, we need to make it up |
diff --git a/drivers/gpu/drm/nouveau/nouveau_hdmi.c b/drivers/gpu/drm/nouveau/nouveau_hdmi.c index 59ea1c14eca0..c3de36384522 100644 --- a/drivers/gpu/drm/nouveau/nouveau_hdmi.c +++ b/drivers/gpu/drm/nouveau/nouveau_hdmi.c | |||
| @@ -32,7 +32,9 @@ static bool | |||
| 32 | hdmi_sor(struct drm_encoder *encoder) | 32 | hdmi_sor(struct drm_encoder *encoder) |
| 33 | { | 33 | { |
| 34 | struct drm_nouveau_private *dev_priv = encoder->dev->dev_private; | 34 | struct drm_nouveau_private *dev_priv = encoder->dev->dev_private; |
| 35 | if (dev_priv->chipset < 0xa3) | 35 | if (dev_priv->chipset < 0xa3 || |
| 36 | dev_priv->chipset == 0xaa || | ||
| 37 | dev_priv->chipset == 0xac) | ||
| 36 | return false; | 38 | return false; |
| 37 | return true; | 39 | return true; |
| 38 | } | 40 | } |
diff --git a/drivers/gpu/drm/nouveau/nouveau_pm.c b/drivers/gpu/drm/nouveau/nouveau_pm.c index 34d591b7d4ef..da3e7c3abab7 100644 --- a/drivers/gpu/drm/nouveau/nouveau_pm.c +++ b/drivers/gpu/drm/nouveau/nouveau_pm.c | |||
| @@ -235,6 +235,7 @@ nouveau_pm_profile_set(struct drm_device *dev, const char *profile) | |||
| 235 | return -EPERM; | 235 | return -EPERM; |
| 236 | 236 | ||
| 237 | strncpy(string, profile, sizeof(string)); | 237 | strncpy(string, profile, sizeof(string)); |
| 238 | string[sizeof(string) - 1] = 0; | ||
| 238 | if ((ptr = strchr(string, '\n'))) | 239 | if ((ptr = strchr(string, '\n'))) |
| 239 | *ptr = '\0'; | 240 | *ptr = '\0'; |
| 240 | 241 | ||
diff --git a/drivers/gpu/drm/nouveau/nv10_gpio.c b/drivers/gpu/drm/nouveau/nv10_gpio.c index 550ad3fcf0af..9d79180069df 100644 --- a/drivers/gpu/drm/nouveau/nv10_gpio.c +++ b/drivers/gpu/drm/nouveau/nv10_gpio.c | |||
| @@ -65,7 +65,7 @@ nv10_gpio_drive(struct drm_device *dev, int line, int dir, int out) | |||
| 65 | if (line < 10) { | 65 | if (line < 10) { |
| 66 | line = (line - 2) * 4; | 66 | line = (line - 2) * 4; |
| 67 | reg = NV_PCRTC_GPIO_EXT; | 67 | reg = NV_PCRTC_GPIO_EXT; |
| 68 | mask = 0x00000003 << ((line - 2) * 4); | 68 | mask = 0x00000003; |
| 69 | data = (dir << 1) | out; | 69 | data = (dir << 1) | out; |
| 70 | } else | 70 | } else |
| 71 | if (line < 14) { | 71 | if (line < 14) { |
diff --git a/drivers/gpu/drm/nouveau/nv50_sor.c b/drivers/gpu/drm/nouveau/nv50_sor.c index a7844ab6a50c..274640212475 100644 --- a/drivers/gpu/drm/nouveau/nv50_sor.c +++ b/drivers/gpu/drm/nouveau/nv50_sor.c | |||
| @@ -42,7 +42,7 @@ nv50_sor_dp_lane_map(struct drm_device *dev, struct dcb_entry *dcb, u8 lane) | |||
| 42 | struct drm_nouveau_private *dev_priv = dev->dev_private; | 42 | struct drm_nouveau_private *dev_priv = dev->dev_private; |
| 43 | static const u8 nvaf[] = { 24, 16, 8, 0 }; /* thanks, apple.. */ | 43 | static const u8 nvaf[] = { 24, 16, 8, 0 }; /* thanks, apple.. */ |
| 44 | static const u8 nv50[] = { 16, 8, 0, 24 }; | 44 | static const u8 nv50[] = { 16, 8, 0, 24 }; |
| 45 | if (dev_priv->card_type == 0xaf) | 45 | if (dev_priv->chipset == 0xaf) |
| 46 | return nvaf[lane]; | 46 | return nvaf[lane]; |
| 47 | return nv50[lane]; | 47 | return nv50[lane]; |
| 48 | } | 48 | } |
diff --git a/drivers/gpu/drm/nouveau/nvc0_fb.c b/drivers/gpu/drm/nouveau/nvc0_fb.c index 5bf55038fd92..f704e942372e 100644 --- a/drivers/gpu/drm/nouveau/nvc0_fb.c +++ b/drivers/gpu/drm/nouveau/nvc0_fb.c | |||
| @@ -54,6 +54,11 @@ nvc0_mfb_isr(struct drm_device *dev) | |||
| 54 | nvc0_mfb_subp_isr(dev, unit, subp); | 54 | nvc0_mfb_subp_isr(dev, unit, subp); |
| 55 | units &= ~(1 << unit); | 55 | units &= ~(1 << unit); |
| 56 | } | 56 | } |
| 57 | |||
| 58 | /* we do something horribly wrong and upset PMFB a lot, so mask off | ||
| 59 | * interrupts from it after the first one until it's fixed | ||
| 60 | */ | ||
| 61 | nv_mask(dev, 0x000640, 0x02000000, 0x00000000); | ||
| 57 | } | 62 | } |
| 58 | 63 | ||
| 59 | static void | 64 | static void |
diff --git a/drivers/gpu/drm/radeon/atombios_crtc.c b/drivers/gpu/drm/radeon/atombios_crtc.c index b5ff1f7b6f7e..af1054f8202a 100644 --- a/drivers/gpu/drm/radeon/atombios_crtc.c +++ b/drivers/gpu/drm/radeon/atombios_crtc.c | |||
| @@ -575,6 +575,9 @@ static u32 atombios_adjust_pll(struct drm_crtc *crtc, | |||
| 575 | 575 | ||
| 576 | if (rdev->family < CHIP_RV770) | 576 | if (rdev->family < CHIP_RV770) |
| 577 | pll->flags |= RADEON_PLL_PREFER_MINM_OVER_MAXP; | 577 | pll->flags |= RADEON_PLL_PREFER_MINM_OVER_MAXP; |
| 578 | /* use frac fb div on APUs */ | ||
| 579 | if (ASIC_IS_DCE41(rdev) || ASIC_IS_DCE61(rdev)) | ||
| 580 | pll->flags |= RADEON_PLL_USE_FRAC_FB_DIV; | ||
| 578 | } else { | 581 | } else { |
| 579 | pll->flags |= RADEON_PLL_LEGACY; | 582 | pll->flags |= RADEON_PLL_LEGACY; |
| 580 | 583 | ||
| @@ -955,8 +958,8 @@ static void atombios_crtc_set_pll(struct drm_crtc *crtc, struct drm_display_mode | |||
| 955 | break; | 958 | break; |
| 956 | } | 959 | } |
| 957 | 960 | ||
| 958 | if (radeon_encoder->active_device & | 961 | if ((radeon_encoder->active_device & (ATOM_DEVICE_LCD_SUPPORT | ATOM_DEVICE_DFP_SUPPORT)) || |
| 959 | (ATOM_DEVICE_LCD_SUPPORT | ATOM_DEVICE_DFP_SUPPORT)) { | 962 | (radeon_encoder_get_dp_bridge_encoder_id(encoder) != ENCODER_OBJECT_ID_NONE)) { |
| 960 | struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv; | 963 | struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv; |
| 961 | struct drm_connector *connector = | 964 | struct drm_connector *connector = |
| 962 | radeon_get_connector_for_encoder(encoder); | 965 | radeon_get_connector_for_encoder(encoder); |
diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c index de71243b591f..c8187c4b6ae8 100644 --- a/drivers/gpu/drm/radeon/r600.c +++ b/drivers/gpu/drm/radeon/r600.c | |||
| @@ -1135,7 +1135,7 @@ static void r600_vram_gtt_location(struct radeon_device *rdev, struct radeon_mc | |||
| 1135 | } | 1135 | } |
| 1136 | if (rdev->flags & RADEON_IS_AGP) { | 1136 | if (rdev->flags & RADEON_IS_AGP) { |
| 1137 | size_bf = mc->gtt_start; | 1137 | size_bf = mc->gtt_start; |
| 1138 | size_af = 0xFFFFFFFF - mc->gtt_end + 1; | 1138 | size_af = 0xFFFFFFFF - mc->gtt_end; |
| 1139 | if (size_bf > size_af) { | 1139 | if (size_bf > size_af) { |
| 1140 | if (mc->mc_vram_size > size_bf) { | 1140 | if (mc->mc_vram_size > size_bf) { |
| 1141 | dev_warn(rdev->dev, "limiting VRAM\n"); | 1141 | dev_warn(rdev->dev, "limiting VRAM\n"); |
| @@ -1149,7 +1149,7 @@ static void r600_vram_gtt_location(struct radeon_device *rdev, struct radeon_mc | |||
| 1149 | mc->real_vram_size = size_af; | 1149 | mc->real_vram_size = size_af; |
| 1150 | mc->mc_vram_size = size_af; | 1150 | mc->mc_vram_size = size_af; |
| 1151 | } | 1151 | } |
| 1152 | mc->vram_start = mc->gtt_end; | 1152 | mc->vram_start = mc->gtt_end + 1; |
| 1153 | } | 1153 | } |
| 1154 | mc->vram_end = mc->vram_start + mc->mc_vram_size - 1; | 1154 | mc->vram_end = mc->vram_start + mc->mc_vram_size - 1; |
| 1155 | dev_info(rdev->dev, "VRAM: %lluM 0x%08llX - 0x%08llX (%lluM used)\n", | 1155 | dev_info(rdev->dev, "VRAM: %lluM 0x%08llX - 0x%08llX (%lluM used)\n", |
diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c b/drivers/gpu/drm/radeon/radeon_connectors.c index bd05156edbdb..3c2e7a000a2a 100644 --- a/drivers/gpu/drm/radeon/radeon_connectors.c +++ b/drivers/gpu/drm/radeon/radeon_connectors.c | |||
| @@ -970,7 +970,7 @@ radeon_dvi_detect(struct drm_connector *connector, bool force) | |||
| 970 | 970 | ||
| 971 | encoder = obj_to_encoder(obj); | 971 | encoder = obj_to_encoder(obj); |
| 972 | 972 | ||
| 973 | if (encoder->encoder_type != DRM_MODE_ENCODER_DAC || | 973 | if (encoder->encoder_type != DRM_MODE_ENCODER_DAC && |
| 974 | encoder->encoder_type != DRM_MODE_ENCODER_TVDAC) | 974 | encoder->encoder_type != DRM_MODE_ENCODER_TVDAC) |
| 975 | continue; | 975 | continue; |
| 976 | 976 | ||
| @@ -1000,6 +1000,7 @@ radeon_dvi_detect(struct drm_connector *connector, bool force) | |||
| 1000 | * cases the DVI port is actually a virtual KVM port connected to the service | 1000 | * cases the DVI port is actually a virtual KVM port connected to the service |
| 1001 | * processor. | 1001 | * processor. |
| 1002 | */ | 1002 | */ |
| 1003 | out: | ||
| 1003 | if ((!rdev->is_atom_bios) && | 1004 | if ((!rdev->is_atom_bios) && |
| 1004 | (ret == connector_status_disconnected) && | 1005 | (ret == connector_status_disconnected) && |
| 1005 | rdev->mode_info.bios_hardcoded_edid_size) { | 1006 | rdev->mode_info.bios_hardcoded_edid_size) { |
| @@ -1007,7 +1008,6 @@ radeon_dvi_detect(struct drm_connector *connector, bool force) | |||
| 1007 | ret = connector_status_connected; | 1008 | ret = connector_status_connected; |
| 1008 | } | 1009 | } |
| 1009 | 1010 | ||
| 1010 | out: | ||
| 1011 | /* updated in get modes as well since we need to know if it's analog or digital */ | 1011 | /* updated in get modes as well since we need to know if it's analog or digital */ |
| 1012 | radeon_connector_update_scratch_regs(connector, ret); | 1012 | radeon_connector_update_scratch_regs(connector, ret); |
| 1013 | return ret; | 1013 | return ret; |
diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c index ea7df16e2f84..5992502a3448 100644 --- a/drivers/gpu/drm/radeon/radeon_device.c +++ b/drivers/gpu/drm/radeon/radeon_device.c | |||
| @@ -241,8 +241,8 @@ int radeon_wb_init(struct radeon_device *rdev) | |||
| 241 | rdev->wb.use_event = true; | 241 | rdev->wb.use_event = true; |
| 242 | } | 242 | } |
| 243 | } | 243 | } |
| 244 | /* always use writeback/events on NI */ | 244 | /* always use writeback/events on NI, APUs */ |
| 245 | if (ASIC_IS_DCE5(rdev)) { | 245 | if (rdev->family >= CHIP_PALM) { |
| 246 | rdev->wb.enabled = true; | 246 | rdev->wb.enabled = true; |
| 247 | rdev->wb.use_event = true; | 247 | rdev->wb.use_event = true; |
| 248 | } | 248 | } |
diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c index 8086c96e0b06..0a1d4bd65edc 100644 --- a/drivers/gpu/drm/radeon/radeon_display.c +++ b/drivers/gpu/drm/radeon/radeon_display.c | |||
| @@ -533,7 +533,7 @@ static void radeon_crtc_init(struct drm_device *dev, int index) | |||
| 533 | radeon_legacy_init_crtc(dev, radeon_crtc); | 533 | radeon_legacy_init_crtc(dev, radeon_crtc); |
| 534 | } | 534 | } |
| 535 | 535 | ||
| 536 | static const char *encoder_names[36] = { | 536 | static const char *encoder_names[37] = { |
| 537 | "NONE", | 537 | "NONE", |
| 538 | "INTERNAL_LVDS", | 538 | "INTERNAL_LVDS", |
| 539 | "INTERNAL_TMDS1", | 539 | "INTERNAL_TMDS1", |
| @@ -570,6 +570,7 @@ static const char *encoder_names[36] = { | |||
| 570 | "INTERNAL_UNIPHY2", | 570 | "INTERNAL_UNIPHY2", |
| 571 | "NUTMEG", | 571 | "NUTMEG", |
| 572 | "TRAVIS", | 572 | "TRAVIS", |
| 573 | "INTERNAL_VCE" | ||
| 573 | }; | 574 | }; |
| 574 | 575 | ||
| 575 | static const char *connector_names[15] = { | 576 | static const char *connector_names[15] = { |
diff --git a/drivers/gpu/drm/radeon/radeon_irq_kms.c b/drivers/gpu/drm/radeon/radeon_irq_kms.c index 66d5fe1c8174..65060b77c805 100644 --- a/drivers/gpu/drm/radeon/radeon_irq_kms.c +++ b/drivers/gpu/drm/radeon/radeon_irq_kms.c | |||
| @@ -147,6 +147,12 @@ static bool radeon_msi_ok(struct radeon_device *rdev) | |||
| 147 | (rdev->pdev->subsystem_device == 0x01fd)) | 147 | (rdev->pdev->subsystem_device == 0x01fd)) |
| 148 | return true; | 148 | return true; |
| 149 | 149 | ||
| 150 | /* RV515 seems to have MSI issues where it loses | ||
| 151 | * MSI rearms occasionally. This leads to lockups and freezes. | ||
| 152 | * disable it by default. | ||
| 153 | */ | ||
| 154 | if (rdev->family == CHIP_RV515) | ||
| 155 | return false; | ||
| 150 | if (rdev->flags & RADEON_IS_IGP) { | 156 | if (rdev->flags & RADEON_IS_IGP) { |
| 151 | /* APUs work fine with MSIs */ | 157 | /* APUs work fine with MSIs */ |
| 152 | if (rdev->family >= CHIP_PALM) | 158 | if (rdev->family >= CHIP_PALM) |
diff --git a/drivers/gpu/drm/radeon/rv770.c b/drivers/gpu/drm/radeon/rv770.c index c62ae4be3845..cdab1aeaed6e 100644 --- a/drivers/gpu/drm/radeon/rv770.c +++ b/drivers/gpu/drm/radeon/rv770.c | |||
| @@ -969,7 +969,7 @@ void r700_vram_gtt_location(struct radeon_device *rdev, struct radeon_mc *mc) | |||
| 969 | } | 969 | } |
| 970 | if (rdev->flags & RADEON_IS_AGP) { | 970 | if (rdev->flags & RADEON_IS_AGP) { |
| 971 | size_bf = mc->gtt_start; | 971 | size_bf = mc->gtt_start; |
| 972 | size_af = 0xFFFFFFFF - mc->gtt_end + 1; | 972 | size_af = 0xFFFFFFFF - mc->gtt_end; |
| 973 | if (size_bf > size_af) { | 973 | if (size_bf > size_af) { |
| 974 | if (mc->mc_vram_size > size_bf) { | 974 | if (mc->mc_vram_size > size_bf) { |
| 975 | dev_warn(rdev->dev, "limiting VRAM\n"); | 975 | dev_warn(rdev->dev, "limiting VRAM\n"); |
| @@ -983,7 +983,7 @@ void r700_vram_gtt_location(struct radeon_device *rdev, struct radeon_mc *mc) | |||
| 983 | mc->real_vram_size = size_af; | 983 | mc->real_vram_size = size_af; |
| 984 | mc->mc_vram_size = size_af; | 984 | mc->mc_vram_size = size_af; |
| 985 | } | 985 | } |
| 986 | mc->vram_start = mc->gtt_end; | 986 | mc->vram_start = mc->gtt_end + 1; |
| 987 | } | 987 | } |
| 988 | mc->vram_end = mc->vram_start + mc->mc_vram_size - 1; | 988 | mc->vram_end = mc->vram_start + mc->mc_vram_size - 1; |
| 989 | dev_info(rdev->dev, "VRAM: %lluM 0x%08llX - 0x%08llX (%lluM used)\n", | 989 | dev_info(rdev->dev, "VRAM: %lluM 0x%08llX - 0x%08llX (%lluM used)\n", |
diff --git a/drivers/gpu/drm/radeon/si.c b/drivers/gpu/drm/radeon/si.c index ac7a199ffece..27bda986fc2b 100644 --- a/drivers/gpu/drm/radeon/si.c +++ b/drivers/gpu/drm/radeon/si.c | |||
| @@ -2999,8 +2999,8 @@ int si_rlc_init(struct radeon_device *rdev) | |||
| 2999 | } | 2999 | } |
| 3000 | r = radeon_bo_pin(rdev->rlc.save_restore_obj, RADEON_GEM_DOMAIN_VRAM, | 3000 | r = radeon_bo_pin(rdev->rlc.save_restore_obj, RADEON_GEM_DOMAIN_VRAM, |
| 3001 | &rdev->rlc.save_restore_gpu_addr); | 3001 | &rdev->rlc.save_restore_gpu_addr); |
| 3002 | radeon_bo_unreserve(rdev->rlc.save_restore_obj); | ||
| 3002 | if (r) { | 3003 | if (r) { |
| 3003 | radeon_bo_unreserve(rdev->rlc.save_restore_obj); | ||
| 3004 | dev_warn(rdev->dev, "(%d) pin RLC sr bo failed\n", r); | 3004 | dev_warn(rdev->dev, "(%d) pin RLC sr bo failed\n", r); |
| 3005 | si_rlc_fini(rdev); | 3005 | si_rlc_fini(rdev); |
| 3006 | return r; | 3006 | return r; |
| @@ -3023,9 +3023,8 @@ int si_rlc_init(struct radeon_device *rdev) | |||
| 3023 | } | 3023 | } |
| 3024 | r = radeon_bo_pin(rdev->rlc.clear_state_obj, RADEON_GEM_DOMAIN_VRAM, | 3024 | r = radeon_bo_pin(rdev->rlc.clear_state_obj, RADEON_GEM_DOMAIN_VRAM, |
| 3025 | &rdev->rlc.clear_state_gpu_addr); | 3025 | &rdev->rlc.clear_state_gpu_addr); |
| 3026 | radeon_bo_unreserve(rdev->rlc.clear_state_obj); | ||
| 3026 | if (r) { | 3027 | if (r) { |
| 3027 | |||
| 3028 | radeon_bo_unreserve(rdev->rlc.clear_state_obj); | ||
| 3029 | dev_warn(rdev->dev, "(%d) pin RLC c bo failed\n", r); | 3028 | dev_warn(rdev->dev, "(%d) pin RLC c bo failed\n", r); |
| 3030 | si_rlc_fini(rdev); | 3029 | si_rlc_fini(rdev); |
| 3031 | return r; | 3030 | return r; |
diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig index a3d033252995..ffddcba32af6 100644 --- a/drivers/hid/Kconfig +++ b/drivers/hid/Kconfig | |||
| @@ -34,7 +34,7 @@ config HID | |||
| 34 | config HID_BATTERY_STRENGTH | 34 | config HID_BATTERY_STRENGTH |
| 35 | bool | 35 | bool |
| 36 | depends on HID && POWER_SUPPLY && HID = POWER_SUPPLY | 36 | depends on HID && POWER_SUPPLY && HID = POWER_SUPPLY |
| 37 | default y | 37 | default n |
| 38 | 38 | ||
| 39 | config HIDRAW | 39 | config HIDRAW |
| 40 | bool "/dev/hidraw raw HID device support" | 40 | bool "/dev/hidraw raw HID device support" |
diff --git a/drivers/hid/hid-tivo.c b/drivers/hid/hid-tivo.c index de47039c708c..9f85f827607f 100644 --- a/drivers/hid/hid-tivo.c +++ b/drivers/hid/hid-tivo.c | |||
| @@ -62,7 +62,7 @@ static int tivo_input_mapping(struct hid_device *hdev, struct hid_input *hi, | |||
| 62 | 62 | ||
| 63 | static const struct hid_device_id tivo_devices[] = { | 63 | static const struct hid_device_id tivo_devices[] = { |
| 64 | /* TiVo Slide Bluetooth remote, pairs with a Broadcom dongle */ | 64 | /* TiVo Slide Bluetooth remote, pairs with a Broadcom dongle */ |
| 65 | { HID_USB_DEVICE(USB_VENDOR_ID_TIVO, USB_DEVICE_ID_TIVO_SLIDE_BT) }, | 65 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_TIVO, USB_DEVICE_ID_TIVO_SLIDE_BT) }, |
| 66 | { HID_USB_DEVICE(USB_VENDOR_ID_TIVO, USB_DEVICE_ID_TIVO_SLIDE) }, | 66 | { HID_USB_DEVICE(USB_VENDOR_ID_TIVO, USB_DEVICE_ID_TIVO_SLIDE) }, |
| 67 | { } | 67 | { } |
| 68 | }; | 68 | }; |
diff --git a/drivers/hsi/clients/hsi_char.c b/drivers/hsi/clients/hsi_char.c index 88a050df2389..3ad91f6447d8 100644 --- a/drivers/hsi/clients/hsi_char.c +++ b/drivers/hsi/clients/hsi_char.c | |||
| @@ -123,7 +123,7 @@ struct hsc_client_data { | |||
| 123 | static unsigned int hsc_major; | 123 | static unsigned int hsc_major; |
| 124 | /* Maximum buffer size that hsi_char will accept from userspace */ | 124 | /* Maximum buffer size that hsi_char will accept from userspace */ |
| 125 | static unsigned int max_data_size = 0x1000; | 125 | static unsigned int max_data_size = 0x1000; |
| 126 | module_param(max_data_size, uint, S_IRUSR | S_IWUSR); | 126 | module_param(max_data_size, uint, 0); |
| 127 | MODULE_PARM_DESC(max_data_size, "max read/write data size [4,8..65536] (^2)"); | 127 | MODULE_PARM_DESC(max_data_size, "max read/write data size [4,8..65536] (^2)"); |
| 128 | 128 | ||
| 129 | static void hsc_add_tail(struct hsc_channel *channel, struct hsi_msg *msg, | 129 | static void hsc_add_tail(struct hsc_channel *channel, struct hsi_msg *msg, |
diff --git a/drivers/hsi/hsi.c b/drivers/hsi/hsi.c index 4e2d79b79334..2d58f939d27f 100644 --- a/drivers/hsi/hsi.c +++ b/drivers/hsi/hsi.c | |||
| @@ -21,26 +21,13 @@ | |||
| 21 | */ | 21 | */ |
| 22 | #include <linux/hsi/hsi.h> | 22 | #include <linux/hsi/hsi.h> |
| 23 | #include <linux/compiler.h> | 23 | #include <linux/compiler.h> |
| 24 | #include <linux/rwsem.h> | ||
| 25 | #include <linux/list.h> | 24 | #include <linux/list.h> |
| 26 | #include <linux/spinlock.h> | ||
| 27 | #include <linux/kobject.h> | 25 | #include <linux/kobject.h> |
| 28 | #include <linux/slab.h> | 26 | #include <linux/slab.h> |
| 29 | #include <linux/string.h> | 27 | #include <linux/string.h> |
| 28 | #include <linux/notifier.h> | ||
| 30 | #include "hsi_core.h" | 29 | #include "hsi_core.h" |
| 31 | 30 | ||
| 32 | static struct device_type hsi_ctrl = { | ||
| 33 | .name = "hsi_controller", | ||
| 34 | }; | ||
| 35 | |||
| 36 | static struct device_type hsi_cl = { | ||
| 37 | .name = "hsi_client", | ||
| 38 | }; | ||
| 39 | |||
| 40 | static struct device_type hsi_port = { | ||
| 41 | .name = "hsi_port", | ||
| 42 | }; | ||
| 43 | |||
| 44 | static ssize_t modalias_show(struct device *dev, | 31 | static ssize_t modalias_show(struct device *dev, |
| 45 | struct device_attribute *a __maybe_unused, char *buf) | 32 | struct device_attribute *a __maybe_unused, char *buf) |
| 46 | { | 33 | { |
| @@ -54,8 +41,7 @@ static struct device_attribute hsi_bus_dev_attrs[] = { | |||
| 54 | 41 | ||
| 55 | static int hsi_bus_uevent(struct device *dev, struct kobj_uevent_env *env) | 42 | static int hsi_bus_uevent(struct device *dev, struct kobj_uevent_env *env) |
| 56 | { | 43 | { |
| 57 | if (dev->type == &hsi_cl) | 44 | add_uevent_var(env, "MODALIAS=hsi:%s", dev_name(dev)); |
| 58 | add_uevent_var(env, "MODALIAS=hsi:%s", dev_name(dev)); | ||
| 59 | 45 | ||
| 60 | return 0; | 46 | return 0; |
| 61 | } | 47 | } |
| @@ -80,12 +66,10 @@ static void hsi_client_release(struct device *dev) | |||
| 80 | static void hsi_new_client(struct hsi_port *port, struct hsi_board_info *info) | 66 | static void hsi_new_client(struct hsi_port *port, struct hsi_board_info *info) |
| 81 | { | 67 | { |
| 82 | struct hsi_client *cl; | 68 | struct hsi_client *cl; |
| 83 | unsigned long flags; | ||
| 84 | 69 | ||
| 85 | cl = kzalloc(sizeof(*cl), GFP_KERNEL); | 70 | cl = kzalloc(sizeof(*cl), GFP_KERNEL); |
| 86 | if (!cl) | 71 | if (!cl) |
| 87 | return; | 72 | return; |
| 88 | cl->device.type = &hsi_cl; | ||
| 89 | cl->tx_cfg = info->tx_cfg; | 73 | cl->tx_cfg = info->tx_cfg; |
| 90 | cl->rx_cfg = info->rx_cfg; | 74 | cl->rx_cfg = info->rx_cfg; |
| 91 | cl->device.bus = &hsi_bus_type; | 75 | cl->device.bus = &hsi_bus_type; |
| @@ -93,14 +77,11 @@ static void hsi_new_client(struct hsi_port *port, struct hsi_board_info *info) | |||
| 93 | cl->device.release = hsi_client_release; | 77 | cl->device.release = hsi_client_release; |
| 94 | dev_set_name(&cl->device, info->name); | 78 | dev_set_name(&cl->device, info->name); |
| 95 | cl->device.platform_data = info->platform_data; | 79 | cl->device.platform_data = info->platform_data; |
| 96 | spin_lock_irqsave(&port->clock, flags); | ||
| 97 | list_add_tail(&cl->link, &port->clients); | ||
| 98 | spin_unlock_irqrestore(&port->clock, flags); | ||
| 99 | if (info->archdata) | 80 | if (info->archdata) |
| 100 | cl->device.archdata = *info->archdata; | 81 | cl->device.archdata = *info->archdata; |
| 101 | if (device_register(&cl->device) < 0) { | 82 | if (device_register(&cl->device) < 0) { |
| 102 | pr_err("hsi: failed to register client: %s\n", info->name); | 83 | pr_err("hsi: failed to register client: %s\n", info->name); |
| 103 | kfree(cl); | 84 | put_device(&cl->device); |
| 104 | } | 85 | } |
| 105 | } | 86 | } |
| 106 | 87 | ||
| @@ -120,13 +101,6 @@ static void hsi_scan_board_info(struct hsi_controller *hsi) | |||
| 120 | 101 | ||
| 121 | static int hsi_remove_client(struct device *dev, void *data __maybe_unused) | 102 | static int hsi_remove_client(struct device *dev, void *data __maybe_unused) |
| 122 | { | 103 | { |
| 123 | struct hsi_client *cl = to_hsi_client(dev); | ||
| 124 | struct hsi_port *port = to_hsi_port(dev->parent); | ||
| 125 | unsigned long flags; | ||
| 126 | |||
| 127 | spin_lock_irqsave(&port->clock, flags); | ||
| 128 | list_del(&cl->link); | ||
| 129 | spin_unlock_irqrestore(&port->clock, flags); | ||
| 130 | device_unregister(dev); | 104 | device_unregister(dev); |
| 131 | 105 | ||
| 132 | return 0; | 106 | return 0; |
| @@ -140,12 +114,17 @@ static int hsi_remove_port(struct device *dev, void *data __maybe_unused) | |||
| 140 | return 0; | 114 | return 0; |
| 141 | } | 115 | } |
| 142 | 116 | ||
| 143 | static void hsi_controller_release(struct device *dev __maybe_unused) | 117 | static void hsi_controller_release(struct device *dev) |
| 144 | { | 118 | { |
| 119 | struct hsi_controller *hsi = to_hsi_controller(dev); | ||
| 120 | |||
| 121 | kfree(hsi->port); | ||
| 122 | kfree(hsi); | ||
| 145 | } | 123 | } |
| 146 | 124 | ||
| 147 | static void hsi_port_release(struct device *dev __maybe_unused) | 125 | static void hsi_port_release(struct device *dev) |
| 148 | { | 126 | { |
| 127 | kfree(to_hsi_port(dev)); | ||
| 149 | } | 128 | } |
| 150 | 129 | ||
| 151 | /** | 130 | /** |
| @@ -170,20 +149,12 @@ int hsi_register_controller(struct hsi_controller *hsi) | |||
| 170 | unsigned int i; | 149 | unsigned int i; |
| 171 | int err; | 150 | int err; |
| 172 | 151 | ||
| 173 | hsi->device.type = &hsi_ctrl; | 152 | err = device_add(&hsi->device); |
| 174 | hsi->device.bus = &hsi_bus_type; | ||
| 175 | hsi->device.release = hsi_controller_release; | ||
| 176 | err = device_register(&hsi->device); | ||
| 177 | if (err < 0) | 153 | if (err < 0) |
| 178 | return err; | 154 | return err; |
| 179 | for (i = 0; i < hsi->num_ports; i++) { | 155 | for (i = 0; i < hsi->num_ports; i++) { |
| 180 | hsi->port[i].device.parent = &hsi->device; | 156 | hsi->port[i]->device.parent = &hsi->device; |
| 181 | hsi->port[i].device.bus = &hsi_bus_type; | 157 | err = device_add(&hsi->port[i]->device); |
| 182 | hsi->port[i].device.release = hsi_port_release; | ||
| 183 | hsi->port[i].device.type = &hsi_port; | ||
| 184 | INIT_LIST_HEAD(&hsi->port[i].clients); | ||
| 185 | spin_lock_init(&hsi->port[i].clock); | ||
| 186 | err = device_register(&hsi->port[i].device); | ||
| 187 | if (err < 0) | 158 | if (err < 0) |
| 188 | goto out; | 159 | goto out; |
| 189 | } | 160 | } |
| @@ -192,7 +163,9 @@ int hsi_register_controller(struct hsi_controller *hsi) | |||
| 192 | 163 | ||
| 193 | return 0; | 164 | return 0; |
| 194 | out: | 165 | out: |
| 195 | hsi_unregister_controller(hsi); | 166 | while (i-- > 0) |
| 167 | device_del(&hsi->port[i]->device); | ||
| 168 | device_del(&hsi->device); | ||
| 196 | 169 | ||
| 197 | return err; | 170 | return err; |
| 198 | } | 171 | } |
| @@ -223,6 +196,29 @@ static inline int hsi_dummy_cl(struct hsi_client *cl __maybe_unused) | |||
| 223 | } | 196 | } |
| 224 | 197 | ||
| 225 | /** | 198 | /** |
| 199 | * hsi_put_controller - Free an HSI controller | ||
| 200 | * | ||
| 201 | * @hsi: Pointer to the HSI controller to freed | ||
| 202 | * | ||
| 203 | * HSI controller drivers should only use this function if they need | ||
| 204 | * to free their allocated hsi_controller structures before a successful | ||
| 205 | * call to hsi_register_controller. Other use is not allowed. | ||
| 206 | */ | ||
| 207 | void hsi_put_controller(struct hsi_controller *hsi) | ||
| 208 | { | ||
| 209 | unsigned int i; | ||
| 210 | |||
| 211 | if (!hsi) | ||
| 212 | return; | ||
| 213 | |||
| 214 | for (i = 0; i < hsi->num_ports; i++) | ||
| 215 | if (hsi->port && hsi->port[i]) | ||
| 216 | put_device(&hsi->port[i]->device); | ||
| 217 | put_device(&hsi->device); | ||
| 218 | } | ||
| 219 | EXPORT_SYMBOL_GPL(hsi_put_controller); | ||
| 220 | |||
| 221 | /** | ||
| 226 | * hsi_alloc_controller - Allocate an HSI controller and its ports | 222 | * hsi_alloc_controller - Allocate an HSI controller and its ports |
| 227 | * @n_ports: Number of ports on the HSI controller | 223 | * @n_ports: Number of ports on the HSI controller |
| 228 | * @flags: Kernel allocation flags | 224 | * @flags: Kernel allocation flags |
| @@ -232,55 +228,52 @@ static inline int hsi_dummy_cl(struct hsi_client *cl __maybe_unused) | |||
| 232 | struct hsi_controller *hsi_alloc_controller(unsigned int n_ports, gfp_t flags) | 228 | struct hsi_controller *hsi_alloc_controller(unsigned int n_ports, gfp_t flags) |
| 233 | { | 229 | { |
| 234 | struct hsi_controller *hsi; | 230 | struct hsi_controller *hsi; |
| 235 | struct hsi_port *port; | 231 | struct hsi_port **port; |
| 236 | unsigned int i; | 232 | unsigned int i; |
| 237 | 233 | ||
| 238 | if (!n_ports) | 234 | if (!n_ports) |
| 239 | return NULL; | 235 | return NULL; |
| 240 | 236 | ||
| 241 | port = kzalloc(sizeof(*port)*n_ports, flags); | ||
| 242 | if (!port) | ||
| 243 | return NULL; | ||
| 244 | hsi = kzalloc(sizeof(*hsi), flags); | 237 | hsi = kzalloc(sizeof(*hsi), flags); |
| 245 | if (!hsi) | 238 | if (!hsi) |
| 246 | goto out; | 239 | return NULL; |
| 247 | for (i = 0; i < n_ports; i++) { | 240 | port = kzalloc(sizeof(*port)*n_ports, flags); |
| 248 | dev_set_name(&port[i].device, "port%d", i); | 241 | if (!port) { |
| 249 | port[i].num = i; | 242 | kfree(hsi); |
| 250 | port[i].async = hsi_dummy_msg; | 243 | return NULL; |
| 251 | port[i].setup = hsi_dummy_cl; | ||
| 252 | port[i].flush = hsi_dummy_cl; | ||
| 253 | port[i].start_tx = hsi_dummy_cl; | ||
| 254 | port[i].stop_tx = hsi_dummy_cl; | ||
| 255 | port[i].release = hsi_dummy_cl; | ||
| 256 | mutex_init(&port[i].lock); | ||
| 257 | } | 244 | } |
| 258 | hsi->num_ports = n_ports; | 245 | hsi->num_ports = n_ports; |
| 259 | hsi->port = port; | 246 | hsi->port = port; |
| 247 | hsi->device.release = hsi_controller_release; | ||
| 248 | device_initialize(&hsi->device); | ||
| 249 | |||
| 250 | for (i = 0; i < n_ports; i++) { | ||
| 251 | port[i] = kzalloc(sizeof(**port), flags); | ||
| 252 | if (port[i] == NULL) | ||
| 253 | goto out; | ||
| 254 | port[i]->num = i; | ||
| 255 | port[i]->async = hsi_dummy_msg; | ||
| 256 | port[i]->setup = hsi_dummy_cl; | ||
| 257 | port[i]->flush = hsi_dummy_cl; | ||
| 258 | port[i]->start_tx = hsi_dummy_cl; | ||
| 259 | port[i]->stop_tx = hsi_dummy_cl; | ||
| 260 | port[i]->release = hsi_dummy_cl; | ||
| 261 | mutex_init(&port[i]->lock); | ||
| 262 | ATOMIC_INIT_NOTIFIER_HEAD(&port[i]->n_head); | ||
| 263 | dev_set_name(&port[i]->device, "port%d", i); | ||
| 264 | hsi->port[i]->device.release = hsi_port_release; | ||
| 265 | device_initialize(&hsi->port[i]->device); | ||
| 266 | } | ||
| 260 | 267 | ||
| 261 | return hsi; | 268 | return hsi; |
| 262 | out: | 269 | out: |
| 263 | kfree(port); | 270 | hsi_put_controller(hsi); |
| 264 | 271 | ||
| 265 | return NULL; | 272 | return NULL; |
| 266 | } | 273 | } |
| 267 | EXPORT_SYMBOL_GPL(hsi_alloc_controller); | 274 | EXPORT_SYMBOL_GPL(hsi_alloc_controller); |
| 268 | 275 | ||
| 269 | /** | 276 | /** |
| 270 | * hsi_free_controller - Free an HSI controller | ||
| 271 | * @hsi: Pointer to HSI controller | ||
| 272 | */ | ||
| 273 | void hsi_free_controller(struct hsi_controller *hsi) | ||
| 274 | { | ||
| 275 | if (!hsi) | ||
| 276 | return; | ||
| 277 | |||
| 278 | kfree(hsi->port); | ||
| 279 | kfree(hsi); | ||
| 280 | } | ||
| 281 | EXPORT_SYMBOL_GPL(hsi_free_controller); | ||
| 282 | |||
| 283 | /** | ||
| 284 | * hsi_free_msg - Free an HSI message | 277 | * hsi_free_msg - Free an HSI message |
| 285 | * @msg: Pointer to the HSI message | 278 | * @msg: Pointer to the HSI message |
| 286 | * | 279 | * |
| @@ -414,37 +407,67 @@ void hsi_release_port(struct hsi_client *cl) | |||
| 414 | } | 407 | } |
| 415 | EXPORT_SYMBOL_GPL(hsi_release_port); | 408 | EXPORT_SYMBOL_GPL(hsi_release_port); |
| 416 | 409 | ||
| 417 | static int hsi_start_rx(struct hsi_client *cl, void *data __maybe_unused) | 410 | static int hsi_event_notifier_call(struct notifier_block *nb, |
| 411 | unsigned long event, void *data __maybe_unused) | ||
| 418 | { | 412 | { |
| 419 | if (cl->hsi_start_rx) | 413 | struct hsi_client *cl = container_of(nb, struct hsi_client, nb); |
| 420 | (*cl->hsi_start_rx)(cl); | 414 | |
| 415 | (*cl->ehandler)(cl, event); | ||
| 421 | 416 | ||
| 422 | return 0; | 417 | return 0; |
| 423 | } | 418 | } |
| 424 | 419 | ||
| 425 | static int hsi_stop_rx(struct hsi_client *cl, void *data __maybe_unused) | 420 | /** |
| 421 | * hsi_register_port_event - Register a client to receive port events | ||
| 422 | * @cl: HSI client that wants to receive port events | ||
| 423 | * @cb: Event handler callback | ||
| 424 | * | ||
| 425 | * Clients should register a callback to be able to receive | ||
| 426 | * events from the ports. Registration should happen after | ||
| 427 | * claiming the port. | ||
| 428 | * The handler can be called in interrupt context. | ||
| 429 | * | ||
| 430 | * Returns -errno on error, or 0 on success. | ||
| 431 | */ | ||
| 432 | int hsi_register_port_event(struct hsi_client *cl, | ||
| 433 | void (*handler)(struct hsi_client *, unsigned long)) | ||
| 426 | { | 434 | { |
| 427 | if (cl->hsi_stop_rx) | 435 | struct hsi_port *port = hsi_get_port(cl); |
| 428 | (*cl->hsi_stop_rx)(cl); | ||
| 429 | 436 | ||
| 430 | return 0; | 437 | if (!handler || cl->ehandler) |
| 438 | return -EINVAL; | ||
| 439 | if (!hsi_port_claimed(cl)) | ||
| 440 | return -EACCES; | ||
| 441 | cl->ehandler = handler; | ||
| 442 | cl->nb.notifier_call = hsi_event_notifier_call; | ||
| 443 | |||
| 444 | return atomic_notifier_chain_register(&port->n_head, &cl->nb); | ||
| 431 | } | 445 | } |
| 446 | EXPORT_SYMBOL_GPL(hsi_register_port_event); | ||
| 432 | 447 | ||
| 433 | static int hsi_port_for_each_client(struct hsi_port *port, void *data, | 448 | /** |
| 434 | int (*fn)(struct hsi_client *cl, void *data)) | 449 | * hsi_unregister_port_event - Stop receiving port events for a client |
| 450 | * @cl: HSI client that wants to stop receiving port events | ||
| 451 | * | ||
| 452 | * Clients should call this function before releasing their associated | ||
| 453 | * port. | ||
| 454 | * | ||
| 455 | * Returns -errno on error, or 0 on success. | ||
| 456 | */ | ||
| 457 | int hsi_unregister_port_event(struct hsi_client *cl) | ||
| 435 | { | 458 | { |
| 436 | struct hsi_client *cl; | 459 | struct hsi_port *port = hsi_get_port(cl); |
| 460 | int err; | ||
| 437 | 461 | ||
| 438 | spin_lock(&port->clock); | 462 | WARN_ON(!hsi_port_claimed(cl)); |
| 439 | list_for_each_entry(cl, &port->clients, link) { | ||
| 440 | spin_unlock(&port->clock); | ||
| 441 | (*fn)(cl, data); | ||
| 442 | spin_lock(&port->clock); | ||
| 443 | } | ||
| 444 | spin_unlock(&port->clock); | ||
| 445 | 463 | ||
| 446 | return 0; | 464 | err = atomic_notifier_chain_unregister(&port->n_head, &cl->nb); |
| 465 | if (!err) | ||
| 466 | cl->ehandler = NULL; | ||
| 467 | |||
| 468 | return err; | ||
| 447 | } | 469 | } |
| 470 | EXPORT_SYMBOL_GPL(hsi_unregister_port_event); | ||
| 448 | 471 | ||
| 449 | /** | 472 | /** |
| 450 | * hsi_event -Notifies clients about port events | 473 | * hsi_event -Notifies clients about port events |
| @@ -458,22 +481,12 @@ static int hsi_port_for_each_client(struct hsi_port *port, void *data, | |||
| 458 | * Events: | 481 | * Events: |
| 459 | * HSI_EVENT_START_RX - Incoming wake line high | 482 | * HSI_EVENT_START_RX - Incoming wake line high |
| 460 | * HSI_EVENT_STOP_RX - Incoming wake line down | 483 | * HSI_EVENT_STOP_RX - Incoming wake line down |
| 484 | * | ||
| 485 | * Returns -errno on error, or 0 on success. | ||
| 461 | */ | 486 | */ |
| 462 | void hsi_event(struct hsi_port *port, unsigned int event) | 487 | int hsi_event(struct hsi_port *port, unsigned long event) |
| 463 | { | 488 | { |
| 464 | int (*fn)(struct hsi_client *cl, void *data); | 489 | return atomic_notifier_call_chain(&port->n_head, event, NULL); |
| 465 | |||
| 466 | switch (event) { | ||
| 467 | case HSI_EVENT_START_RX: | ||
| 468 | fn = hsi_start_rx; | ||
| 469 | break; | ||
| 470 | case HSI_EVENT_STOP_RX: | ||
| 471 | fn = hsi_stop_rx; | ||
| 472 | break; | ||
| 473 | default: | ||
| 474 | return; | ||
| 475 | } | ||
| 476 | hsi_port_for_each_client(port, NULL, fn); | ||
| 477 | } | 490 | } |
| 478 | EXPORT_SYMBOL_GPL(hsi_event); | 491 | EXPORT_SYMBOL_GPL(hsi_event); |
| 479 | 492 | ||
diff --git a/drivers/hwmon/ad7314.c b/drivers/hwmon/ad7314.c index ce43642ef03e..f85ce70d9677 100644 --- a/drivers/hwmon/ad7314.c +++ b/drivers/hwmon/ad7314.c | |||
| @@ -47,7 +47,7 @@ struct ad7314_data { | |||
| 47 | u16 rx ____cacheline_aligned; | 47 | u16 rx ____cacheline_aligned; |
| 48 | }; | 48 | }; |
| 49 | 49 | ||
| 50 | static int ad7314_spi_read(struct ad7314_data *chip, s16 *data) | 50 | static int ad7314_spi_read(struct ad7314_data *chip) |
| 51 | { | 51 | { |
| 52 | int ret; | 52 | int ret; |
| 53 | 53 | ||
| @@ -57,9 +57,7 @@ static int ad7314_spi_read(struct ad7314_data *chip, s16 *data) | |||
| 57 | return ret; | 57 | return ret; |
| 58 | } | 58 | } |
| 59 | 59 | ||
| 60 | *data = be16_to_cpu(chip->rx); | 60 | return be16_to_cpu(chip->rx); |
| 61 | |||
| 62 | return ret; | ||
| 63 | } | 61 | } |
| 64 | 62 | ||
| 65 | static ssize_t ad7314_show_temperature(struct device *dev, | 63 | static ssize_t ad7314_show_temperature(struct device *dev, |
| @@ -70,12 +68,12 @@ static ssize_t ad7314_show_temperature(struct device *dev, | |||
| 70 | s16 data; | 68 | s16 data; |
| 71 | int ret; | 69 | int ret; |
| 72 | 70 | ||
| 73 | ret = ad7314_spi_read(chip, &data); | 71 | ret = ad7314_spi_read(chip); |
| 74 | if (ret < 0) | 72 | if (ret < 0) |
| 75 | return ret; | 73 | return ret; |
| 76 | switch (spi_get_device_id(chip->spi_dev)->driver_data) { | 74 | switch (spi_get_device_id(chip->spi_dev)->driver_data) { |
| 77 | case ad7314: | 75 | case ad7314: |
| 78 | data = (data & AD7314_TEMP_MASK) >> AD7314_TEMP_OFFSET; | 76 | data = (ret & AD7314_TEMP_MASK) >> AD7314_TEMP_OFFSET; |
| 79 | data = (data << 6) >> 6; | 77 | data = (data << 6) >> 6; |
| 80 | 78 | ||
| 81 | return sprintf(buf, "%d\n", 250 * data); | 79 | return sprintf(buf, "%d\n", 250 * data); |
| @@ -86,7 +84,7 @@ static ssize_t ad7314_show_temperature(struct device *dev, | |||
| 86 | * with a sign bit - which is a 14 bit 2's complement | 84 | * with a sign bit - which is a 14 bit 2's complement |
| 87 | * register. 1lsb - 31.25 milli degrees centigrade | 85 | * register. 1lsb - 31.25 milli degrees centigrade |
| 88 | */ | 86 | */ |
| 89 | data &= ADT7301_TEMP_MASK; | 87 | data = ret & ADT7301_TEMP_MASK; |
| 90 | data = (data << 2) >> 2; | 88 | data = (data << 2) >> 2; |
| 91 | 89 | ||
| 92 | return sprintf(buf, "%d\n", | 90 | return sprintf(buf, "%d\n", |
diff --git a/drivers/hwmon/ads1015.c b/drivers/hwmon/ads1015.c index 7765e4f74ec5..1958f03efd7a 100644 --- a/drivers/hwmon/ads1015.c +++ b/drivers/hwmon/ads1015.c | |||
| @@ -59,14 +59,11 @@ struct ads1015_data { | |||
| 59 | struct ads1015_channel_data channel_data[ADS1015_CHANNELS]; | 59 | struct ads1015_channel_data channel_data[ADS1015_CHANNELS]; |
| 60 | }; | 60 | }; |
| 61 | 61 | ||
| 62 | static int ads1015_read_value(struct i2c_client *client, unsigned int channel, | 62 | static int ads1015_read_adc(struct i2c_client *client, unsigned int channel) |
| 63 | int *value) | ||
| 64 | { | 63 | { |
| 65 | u16 config; | 64 | u16 config; |
| 66 | s16 conversion; | ||
| 67 | struct ads1015_data *data = i2c_get_clientdata(client); | 65 | struct ads1015_data *data = i2c_get_clientdata(client); |
| 68 | unsigned int pga = data->channel_data[channel].pga; | 66 | unsigned int pga = data->channel_data[channel].pga; |
| 69 | int fullscale; | ||
| 70 | unsigned int data_rate = data->channel_data[channel].data_rate; | 67 | unsigned int data_rate = data->channel_data[channel].data_rate; |
| 71 | unsigned int conversion_time_ms; | 68 | unsigned int conversion_time_ms; |
| 72 | int res; | 69 | int res; |
| @@ -78,7 +75,6 @@ static int ads1015_read_value(struct i2c_client *client, unsigned int channel, | |||
| 78 | if (res < 0) | 75 | if (res < 0) |
| 79 | goto err_unlock; | 76 | goto err_unlock; |
| 80 | config = res; | 77 | config = res; |
| 81 | fullscale = fullscale_table[pga]; | ||
| 82 | conversion_time_ms = DIV_ROUND_UP(1000, data_rate_table[data_rate]); | 78 | conversion_time_ms = DIV_ROUND_UP(1000, data_rate_table[data_rate]); |
| 83 | 79 | ||
| 84 | /* setup and start single conversion */ | 80 | /* setup and start single conversion */ |
| @@ -105,33 +101,36 @@ static int ads1015_read_value(struct i2c_client *client, unsigned int channel, | |||
| 105 | } | 101 | } |
| 106 | 102 | ||
| 107 | res = i2c_smbus_read_word_swapped(client, ADS1015_CONVERSION); | 103 | res = i2c_smbus_read_word_swapped(client, ADS1015_CONVERSION); |
| 108 | if (res < 0) | ||
| 109 | goto err_unlock; | ||
| 110 | conversion = res; | ||
| 111 | |||
| 112 | mutex_unlock(&data->update_lock); | ||
| 113 | |||
| 114 | *value = DIV_ROUND_CLOSEST(conversion * fullscale, 0x7ff0); | ||
| 115 | |||
| 116 | return 0; | ||
| 117 | 104 | ||
| 118 | err_unlock: | 105 | err_unlock: |
| 119 | mutex_unlock(&data->update_lock); | 106 | mutex_unlock(&data->update_lock); |
| 120 | return res; | 107 | return res; |
| 121 | } | 108 | } |
| 122 | 109 | ||
| 110 | static int ads1015_reg_to_mv(struct i2c_client *client, unsigned int channel, | ||
| 111 | s16 reg) | ||
| 112 | { | ||
| 113 | struct ads1015_data *data = i2c_get_clientdata(client); | ||
| 114 | unsigned int pga = data->channel_data[channel].pga; | ||
| 115 | int fullscale = fullscale_table[pga]; | ||
| 116 | |||
| 117 | return DIV_ROUND_CLOSEST(reg * fullscale, 0x7ff0); | ||
| 118 | } | ||
| 119 | |||
| 123 | /* sysfs callback function */ | 120 | /* sysfs callback function */ |
| 124 | static ssize_t show_in(struct device *dev, struct device_attribute *da, | 121 | static ssize_t show_in(struct device *dev, struct device_attribute *da, |
| 125 | char *buf) | 122 | char *buf) |
| 126 | { | 123 | { |
| 127 | struct sensor_device_attribute *attr = to_sensor_dev_attr(da); | 124 | struct sensor_device_attribute *attr = to_sensor_dev_attr(da); |
| 128 | struct i2c_client *client = to_i2c_client(dev); | 125 | struct i2c_client *client = to_i2c_client(dev); |
| 129 | int in; | ||
| 130 | int res; | 126 | int res; |
| 127 | int index = attr->index; | ||
| 131 | 128 | ||
| 132 | res = ads1015_read_value(client, attr->index, &in); | 129 | res = ads1015_read_adc(client, index); |
| 130 | if (res < 0) | ||
| 131 | return res; | ||
| 133 | 132 | ||
| 134 | return (res < 0) ? res : sprintf(buf, "%d\n", in); | 133 | return sprintf(buf, "%d\n", ads1015_reg_to_mv(client, index, res)); |
| 135 | } | 134 | } |
| 136 | 135 | ||
| 137 | static const struct sensor_device_attribute ads1015_in[] = { | 136 | static const struct sensor_device_attribute ads1015_in[] = { |
diff --git a/drivers/hwmon/coretemp.c b/drivers/hwmon/coretemp.c index 0d3141fbbc20..b9d512331ed4 100644 --- a/drivers/hwmon/coretemp.c +++ b/drivers/hwmon/coretemp.c | |||
| @@ -52,7 +52,7 @@ module_param_named(tjmax, force_tjmax, int, 0444); | |||
| 52 | MODULE_PARM_DESC(tjmax, "TjMax value in degrees Celsius"); | 52 | MODULE_PARM_DESC(tjmax, "TjMax value in degrees Celsius"); |
| 53 | 53 | ||
| 54 | #define BASE_SYSFS_ATTR_NO 2 /* Sysfs Base attr no for coretemp */ | 54 | #define BASE_SYSFS_ATTR_NO 2 /* Sysfs Base attr no for coretemp */ |
| 55 | #define NUM_REAL_CORES 16 /* Number of Real cores per cpu */ | 55 | #define NUM_REAL_CORES 32 /* Number of Real cores per cpu */ |
| 56 | #define CORETEMP_NAME_LENGTH 17 /* String Length of attrs */ | 56 | #define CORETEMP_NAME_LENGTH 17 /* String Length of attrs */ |
| 57 | #define MAX_CORE_ATTRS 4 /* Maximum no of basic attrs */ | 57 | #define MAX_CORE_ATTRS 4 /* Maximum no of basic attrs */ |
| 58 | #define TOTAL_ATTRS (MAX_CORE_ATTRS + 1) | 58 | #define TOTAL_ATTRS (MAX_CORE_ATTRS + 1) |
| @@ -709,6 +709,10 @@ static void __cpuinit put_core_offline(unsigned int cpu) | |||
| 709 | 709 | ||
| 710 | indx = TO_ATTR_NO(cpu); | 710 | indx = TO_ATTR_NO(cpu); |
| 711 | 711 | ||
| 712 | /* The core id is too big, just return */ | ||
| 713 | if (indx > MAX_CORE_DATA - 1) | ||
| 714 | return; | ||
| 715 | |||
| 712 | if (pdata->core_data[indx] && pdata->core_data[indx]->cpu == cpu) | 716 | if (pdata->core_data[indx] && pdata->core_data[indx]->cpu == cpu) |
| 713 | coretemp_remove_core(pdata, &pdev->dev, indx); | 717 | coretemp_remove_core(pdata, &pdev->dev, indx); |
| 714 | 718 | ||
diff --git a/drivers/hwmon/fam15h_power.c b/drivers/hwmon/fam15h_power.c index b7494af1e4a9..e8e18cab1fb8 100644 --- a/drivers/hwmon/fam15h_power.c +++ b/drivers/hwmon/fam15h_power.c | |||
| @@ -122,6 +122,41 @@ static bool __devinit fam15h_power_is_internal_node0(struct pci_dev *f4) | |||
| 122 | return true; | 122 | return true; |
| 123 | } | 123 | } |
| 124 | 124 | ||
| 125 | /* | ||
| 126 | * Newer BKDG versions have an updated recommendation on how to properly | ||
| 127 | * initialize the running average range (was: 0xE, now: 0x9). This avoids | ||
| 128 | * counter saturations resulting in bogus power readings. | ||
| 129 | * We correct this value ourselves to cope with older BIOSes. | ||
| 130 | */ | ||
| 131 | static DEFINE_PCI_DEVICE_TABLE(affected_device) = { | ||
| 132 | { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_15H_NB_F4) }, | ||
| 133 | { 0 } | ||
| 134 | }; | ||
| 135 | |||
| 136 | static void __devinit tweak_runavg_range(struct pci_dev *pdev) | ||
| 137 | { | ||
| 138 | u32 val; | ||
| 139 | |||
| 140 | /* | ||
| 141 | * let this quirk apply only to the current version of the | ||
| 142 | * northbridge, since future versions may change the behavior | ||
| 143 | */ | ||
| 144 | if (!pci_match_id(affected_device, pdev)) | ||
| 145 | return; | ||
| 146 | |||
| 147 | pci_bus_read_config_dword(pdev->bus, | ||
| 148 | PCI_DEVFN(PCI_SLOT(pdev->devfn), 5), | ||
| 149 | REG_TDP_RUNNING_AVERAGE, &val); | ||
| 150 | if ((val & 0xf) != 0xe) | ||
| 151 | return; | ||
| 152 | |||
| 153 | val &= ~0xf; | ||
| 154 | val |= 0x9; | ||
| 155 | pci_bus_write_config_dword(pdev->bus, | ||
| 156 | PCI_DEVFN(PCI_SLOT(pdev->devfn), 5), | ||
| 157 | REG_TDP_RUNNING_AVERAGE, val); | ||
| 158 | } | ||
| 159 | |||
| 125 | static void __devinit fam15h_power_init_data(struct pci_dev *f4, | 160 | static void __devinit fam15h_power_init_data(struct pci_dev *f4, |
| 126 | struct fam15h_power_data *data) | 161 | struct fam15h_power_data *data) |
| 127 | { | 162 | { |
| @@ -155,6 +190,13 @@ static int __devinit fam15h_power_probe(struct pci_dev *pdev, | |||
| 155 | struct device *dev; | 190 | struct device *dev; |
| 156 | int err; | 191 | int err; |
| 157 | 192 | ||
| 193 | /* | ||
| 194 | * though we ignore every other northbridge, we still have to | ||
| 195 | * do the tweaking on _each_ node in MCM processors as the counters | ||
| 196 | * are working hand-in-hand | ||
| 197 | */ | ||
| 198 | tweak_runavg_range(pdev); | ||
| 199 | |||
| 158 | if (!fam15h_power_is_internal_node0(pdev)) { | 200 | if (!fam15h_power_is_internal_node0(pdev)) { |
| 159 | err = -ENODEV; | 201 | err = -ENODEV; |
| 160 | goto exit; | 202 | goto exit; |
diff --git a/drivers/i2c/busses/i2c-eg20t.c b/drivers/i2c/busses/i2c-eg20t.c index f086131cb1c7..c811289b61e2 100644 --- a/drivers/i2c/busses/i2c-eg20t.c +++ b/drivers/i2c/busses/i2c-eg20t.c | |||
| @@ -324,7 +324,7 @@ static s32 pch_i2c_wait_for_xfer_complete(struct i2c_algo_pch_data *adap) | |||
| 324 | { | 324 | { |
| 325 | long ret; | 325 | long ret; |
| 326 | ret = wait_event_timeout(pch_event, | 326 | ret = wait_event_timeout(pch_event, |
| 327 | (adap->pch_event_flag != 0), msecs_to_jiffies(50)); | 327 | (adap->pch_event_flag != 0), msecs_to_jiffies(1000)); |
| 328 | 328 | ||
| 329 | if (ret == 0) { | 329 | if (ret == 0) { |
| 330 | pch_err(adap, "timeout: %x\n", adap->pch_event_flag); | 330 | pch_err(adap, "timeout: %x\n", adap->pch_event_flag); |
| @@ -1063,6 +1063,6 @@ module_exit(pch_pci_exit); | |||
| 1063 | 1063 | ||
| 1064 | MODULE_DESCRIPTION("Intel EG20T PCH/LAPIS Semico ML7213/ML7223/ML7831 IOH I2C"); | 1064 | MODULE_DESCRIPTION("Intel EG20T PCH/LAPIS Semico ML7213/ML7223/ML7831 IOH I2C"); |
| 1065 | MODULE_LICENSE("GPL"); | 1065 | MODULE_LICENSE("GPL"); |
| 1066 | MODULE_AUTHOR("Tomoya MORINAGA. <tomoya-linux@dsn.lapis-semi.com>"); | 1066 | MODULE_AUTHOR("Tomoya MORINAGA. <tomoya.rohm@gmail.com>"); |
| 1067 | module_param(pch_i2c_speed, int, (S_IRUSR | S_IWUSR)); | 1067 | module_param(pch_i2c_speed, int, (S_IRUSR | S_IWUSR)); |
| 1068 | module_param(pch_clk, int, (S_IRUSR | S_IWUSR)); | 1068 | module_param(pch_clk, int, (S_IRUSR | S_IWUSR)); |
diff --git a/drivers/i2c/busses/i2c-mxs.c b/drivers/i2c/busses/i2c-mxs.c index 3d471d56bf15..76b8af44f634 100644 --- a/drivers/i2c/busses/i2c-mxs.c +++ b/drivers/i2c/busses/i2c-mxs.c | |||
| @@ -227,6 +227,7 @@ static int mxs_i2c_xfer_msg(struct i2c_adapter *adap, struct i2c_msg *msg, | |||
| 227 | return -EINVAL; | 227 | return -EINVAL; |
| 228 | 228 | ||
| 229 | init_completion(&i2c->cmd_complete); | 229 | init_completion(&i2c->cmd_complete); |
| 230 | i2c->cmd_err = 0; | ||
| 230 | 231 | ||
| 231 | flags = stop ? MXS_I2C_CTRL0_POST_SEND_STOP : 0; | 232 | flags = stop ? MXS_I2C_CTRL0_POST_SEND_STOP : 0; |
| 232 | 233 | ||
| @@ -252,6 +253,9 @@ static int mxs_i2c_xfer_msg(struct i2c_adapter *adap, struct i2c_msg *msg, | |||
| 252 | 253 | ||
| 253 | if (i2c->cmd_err == -ENXIO) | 254 | if (i2c->cmd_err == -ENXIO) |
| 254 | mxs_i2c_reset(i2c); | 255 | mxs_i2c_reset(i2c); |
| 256 | else | ||
| 257 | writel(MXS_I2C_QUEUECTRL_QUEUE_RUN, | ||
| 258 | i2c->regs + MXS_I2C_QUEUECTRL_CLR); | ||
| 255 | 259 | ||
| 256 | dev_dbg(i2c->dev, "Done with err=%d\n", i2c->cmd_err); | 260 | dev_dbg(i2c->dev, "Done with err=%d\n", i2c->cmd_err); |
| 257 | 261 | ||
| @@ -299,8 +303,6 @@ static irqreturn_t mxs_i2c_isr(int this_irq, void *dev_id) | |||
| 299 | MXS_I2C_CTRL1_SLAVE_STOP_IRQ | MXS_I2C_CTRL1_SLAVE_IRQ)) | 303 | MXS_I2C_CTRL1_SLAVE_STOP_IRQ | MXS_I2C_CTRL1_SLAVE_IRQ)) |
| 300 | /* MXS_I2C_CTRL1_OVERSIZE_XFER_TERM_IRQ is only for slaves */ | 304 | /* MXS_I2C_CTRL1_OVERSIZE_XFER_TERM_IRQ is only for slaves */ |
| 301 | i2c->cmd_err = -EIO; | 305 | i2c->cmd_err = -EIO; |
| 302 | else | ||
| 303 | i2c->cmd_err = 0; | ||
| 304 | 306 | ||
| 305 | is_last_cmd = (readl(i2c->regs + MXS_I2C_QUEUESTAT) & | 307 | is_last_cmd = (readl(i2c->regs + MXS_I2C_QUEUESTAT) & |
| 306 | MXS_I2C_QUEUESTAT_WRITE_QUEUE_CNT_MASK) == 0; | 308 | MXS_I2C_QUEUESTAT_WRITE_QUEUE_CNT_MASK) == 0; |
| @@ -384,8 +386,6 @@ static int __devexit mxs_i2c_remove(struct platform_device *pdev) | |||
| 384 | if (ret) | 386 | if (ret) |
| 385 | return -EBUSY; | 387 | return -EBUSY; |
| 386 | 388 | ||
| 387 | writel(MXS_I2C_QUEUECTRL_QUEUE_RUN, | ||
| 388 | i2c->regs + MXS_I2C_QUEUECTRL_CLR); | ||
| 389 | writel(MXS_I2C_CTRL0_SFTRST, i2c->regs + MXS_I2C_CTRL0_SET); | 389 | writel(MXS_I2C_CTRL0_SFTRST, i2c->regs + MXS_I2C_CTRL0_SET); |
| 390 | 390 | ||
| 391 | platform_set_drvdata(pdev, NULL); | 391 | platform_set_drvdata(pdev, NULL); |
diff --git a/drivers/i2c/busses/i2c-pnx.c b/drivers/i2c/busses/i2c-pnx.c index 04be9f82e14b..eb8ad538c79f 100644 --- a/drivers/i2c/busses/i2c-pnx.c +++ b/drivers/i2c/busses/i2c-pnx.c | |||
| @@ -546,8 +546,7 @@ static int i2c_pnx_controller_suspend(struct platform_device *pdev, | |||
| 546 | { | 546 | { |
| 547 | struct i2c_pnx_algo_data *alg_data = platform_get_drvdata(pdev); | 547 | struct i2c_pnx_algo_data *alg_data = platform_get_drvdata(pdev); |
| 548 | 548 | ||
| 549 | /* FIXME: shouldn't this be clk_disable? */ | 549 | clk_disable(alg_data->clk); |
| 550 | clk_enable(alg_data->clk); | ||
| 551 | 550 | ||
| 552 | return 0; | 551 | return 0; |
| 553 | } | 552 | } |
diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c index e978635e60f0..55e5ea62ccee 100644 --- a/drivers/i2c/busses/i2c-tegra.c +++ b/drivers/i2c/busses/i2c-tegra.c | |||
| @@ -516,6 +516,14 @@ static int tegra_i2c_xfer_msg(struct tegra_i2c_dev *i2c_dev, | |||
| 516 | if (likely(i2c_dev->msg_err == I2C_ERR_NONE)) | 516 | if (likely(i2c_dev->msg_err == I2C_ERR_NONE)) |
| 517 | return 0; | 517 | return 0; |
| 518 | 518 | ||
| 519 | /* | ||
| 520 | * NACK interrupt is generated before the I2C controller generates the | ||
| 521 | * STOP condition on the bus. So wait for 2 clock periods before resetting | ||
| 522 | * the controller so that STOP condition has been delivered properly. | ||
| 523 | */ | ||
| 524 | if (i2c_dev->msg_err == I2C_ERR_NO_ACK) | ||
| 525 | udelay(DIV_ROUND_UP(2 * 1000000, i2c_dev->bus_clk_rate)); | ||
| 526 | |||
| 519 | tegra_i2c_init(i2c_dev); | 527 | tegra_i2c_init(i2c_dev); |
| 520 | if (i2c_dev->msg_err == I2C_ERR_NO_ACK) { | 528 | if (i2c_dev->msg_err == I2C_ERR_NO_ACK) { |
| 521 | if (msg->flags & I2C_M_IGNORE_NAK) | 529 | if (msg->flags & I2C_M_IGNORE_NAK) |
diff --git a/drivers/infiniband/core/mad.c b/drivers/infiniband/core/mad.c index 426bb7617ec6..b0d0bc8a6fb6 100644 --- a/drivers/infiniband/core/mad.c +++ b/drivers/infiniband/core/mad.c | |||
| @@ -1854,6 +1854,8 @@ static bool generate_unmatched_resp(struct ib_mad_private *recv, | |||
| 1854 | response->mad.mad.mad_hdr.method = IB_MGMT_METHOD_GET_RESP; | 1854 | response->mad.mad.mad_hdr.method = IB_MGMT_METHOD_GET_RESP; |
| 1855 | response->mad.mad.mad_hdr.status = | 1855 | response->mad.mad.mad_hdr.status = |
| 1856 | cpu_to_be16(IB_MGMT_MAD_STATUS_UNSUPPORTED_METHOD_ATTRIB); | 1856 | cpu_to_be16(IB_MGMT_MAD_STATUS_UNSUPPORTED_METHOD_ATTRIB); |
| 1857 | if (recv->mad.mad.mad_hdr.mgmt_class == IB_MGMT_CLASS_SUBN_DIRECTED_ROUTE) | ||
| 1858 | response->mad.mad.mad_hdr.status |= IB_SMP_DIRECTION; | ||
| 1857 | 1859 | ||
| 1858 | return true; | 1860 | return true; |
| 1859 | } else { | 1861 | } else { |
| @@ -1869,6 +1871,7 @@ static void ib_mad_recv_done_handler(struct ib_mad_port_private *port_priv, | |||
| 1869 | struct ib_mad_list_head *mad_list; | 1871 | struct ib_mad_list_head *mad_list; |
| 1870 | struct ib_mad_agent_private *mad_agent; | 1872 | struct ib_mad_agent_private *mad_agent; |
| 1871 | int port_num; | 1873 | int port_num; |
| 1874 | int ret = IB_MAD_RESULT_SUCCESS; | ||
| 1872 | 1875 | ||
| 1873 | mad_list = (struct ib_mad_list_head *)(unsigned long)wc->wr_id; | 1876 | mad_list = (struct ib_mad_list_head *)(unsigned long)wc->wr_id; |
| 1874 | qp_info = mad_list->mad_queue->qp_info; | 1877 | qp_info = mad_list->mad_queue->qp_info; |
| @@ -1952,8 +1955,6 @@ static void ib_mad_recv_done_handler(struct ib_mad_port_private *port_priv, | |||
| 1952 | local: | 1955 | local: |
| 1953 | /* Give driver "right of first refusal" on incoming MAD */ | 1956 | /* Give driver "right of first refusal" on incoming MAD */ |
| 1954 | if (port_priv->device->process_mad) { | 1957 | if (port_priv->device->process_mad) { |
| 1955 | int ret; | ||
| 1956 | |||
| 1957 | ret = port_priv->device->process_mad(port_priv->device, 0, | 1958 | ret = port_priv->device->process_mad(port_priv->device, 0, |
| 1958 | port_priv->port_num, | 1959 | port_priv->port_num, |
| 1959 | wc, &recv->grh, | 1960 | wc, &recv->grh, |
| @@ -1981,7 +1982,8 @@ local: | |||
| 1981 | * or via recv_handler in ib_mad_complete_recv() | 1982 | * or via recv_handler in ib_mad_complete_recv() |
| 1982 | */ | 1983 | */ |
| 1983 | recv = NULL; | 1984 | recv = NULL; |
| 1984 | } else if (generate_unmatched_resp(recv, response)) { | 1985 | } else if ((ret & IB_MAD_RESULT_SUCCESS) && |
| 1986 | generate_unmatched_resp(recv, response)) { | ||
| 1985 | agent_send_response(&response->mad.mad, &recv->grh, wc, | 1987 | agent_send_response(&response->mad.mad, &recv->grh, wc, |
| 1986 | port_priv->device, port_num, qp_info->qp->qp_num); | 1988 | port_priv->device, port_num, qp_info->qp->qp_num); |
| 1987 | } | 1989 | } |
diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c index 669673e81439..b948b6dd5d55 100644 --- a/drivers/infiniband/hw/mlx4/main.c +++ b/drivers/infiniband/hw/mlx4/main.c | |||
| @@ -247,7 +247,7 @@ static int ib_link_query_port(struct ib_device *ibdev, u8 port, | |||
| 247 | err = mlx4_MAD_IFC(to_mdev(ibdev), 1, 1, port, | 247 | err = mlx4_MAD_IFC(to_mdev(ibdev), 1, 1, port, |
| 248 | NULL, NULL, in_mad, out_mad); | 248 | NULL, NULL, in_mad, out_mad); |
| 249 | if (err) | 249 | if (err) |
| 250 | return err; | 250 | goto out; |
| 251 | 251 | ||
| 252 | /* Checking LinkSpeedActive for FDR-10 */ | 252 | /* Checking LinkSpeedActive for FDR-10 */ |
| 253 | if (out_mad->data[15] & 0x1) | 253 | if (out_mad->data[15] & 0x1) |
diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig index 2d787796bf50..7faf4a7fcaa9 100644 --- a/drivers/input/misc/Kconfig +++ b/drivers/input/misc/Kconfig | |||
| @@ -380,8 +380,7 @@ config INPUT_TWL4030_VIBRA | |||
| 380 | 380 | ||
| 381 | config INPUT_TWL6040_VIBRA | 381 | config INPUT_TWL6040_VIBRA |
| 382 | tristate "Support for TWL6040 Vibrator" | 382 | tristate "Support for TWL6040 Vibrator" |
| 383 | depends on TWL4030_CORE | 383 | depends on TWL6040_CORE |
| 384 | select TWL6040_CORE | ||
| 385 | select INPUT_FF_MEMLESS | 384 | select INPUT_FF_MEMLESS |
| 386 | help | 385 | help |
| 387 | This option enables support for TWL6040 Vibrator Driver. | 386 | This option enables support for TWL6040 Vibrator Driver. |
diff --git a/drivers/input/misc/twl6040-vibra.c b/drivers/input/misc/twl6040-vibra.c index 45874fed523a..14e94f56cb7d 100644 --- a/drivers/input/misc/twl6040-vibra.c +++ b/drivers/input/misc/twl6040-vibra.c | |||
| @@ -28,7 +28,7 @@ | |||
| 28 | #include <linux/module.h> | 28 | #include <linux/module.h> |
| 29 | #include <linux/platform_device.h> | 29 | #include <linux/platform_device.h> |
| 30 | #include <linux/workqueue.h> | 30 | #include <linux/workqueue.h> |
| 31 | #include <linux/i2c/twl.h> | 31 | #include <linux/input.h> |
| 32 | #include <linux/mfd/twl6040.h> | 32 | #include <linux/mfd/twl6040.h> |
| 33 | #include <linux/slab.h> | 33 | #include <linux/slab.h> |
| 34 | #include <linux/delay.h> | 34 | #include <linux/delay.h> |
| @@ -257,7 +257,7 @@ static SIMPLE_DEV_PM_OPS(twl6040_vibra_pm_ops, twl6040_vibra_suspend, NULL); | |||
| 257 | 257 | ||
| 258 | static int __devinit twl6040_vibra_probe(struct platform_device *pdev) | 258 | static int __devinit twl6040_vibra_probe(struct platform_device *pdev) |
| 259 | { | 259 | { |
| 260 | struct twl4030_vibra_data *pdata = pdev->dev.platform_data; | 260 | struct twl6040_vibra_data *pdata = pdev->dev.platform_data; |
| 261 | struct vibra_info *info; | 261 | struct vibra_info *info; |
| 262 | int ret; | 262 | int ret; |
| 263 | 263 | ||
diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c index 8081a0a5d602..a4b14a41cbf4 100644 --- a/drivers/input/mouse/synaptics.c +++ b/drivers/input/mouse/synaptics.c | |||
| @@ -274,7 +274,8 @@ static int synaptics_set_advanced_gesture_mode(struct psmouse *psmouse) | |||
| 274 | static unsigned char param = 0xc8; | 274 | static unsigned char param = 0xc8; |
| 275 | struct synaptics_data *priv = psmouse->private; | 275 | struct synaptics_data *priv = psmouse->private; |
| 276 | 276 | ||
| 277 | if (!SYN_CAP_ADV_GESTURE(priv->ext_cap_0c)) | 277 | if (!(SYN_CAP_ADV_GESTURE(priv->ext_cap_0c) || |
| 278 | SYN_CAP_IMAGE_SENSOR(priv->ext_cap_0c))) | ||
| 278 | return 0; | 279 | return 0; |
| 279 | 280 | ||
| 280 | if (psmouse_sliced_command(psmouse, SYN_QUE_MODEL)) | 281 | if (psmouse_sliced_command(psmouse, SYN_QUE_MODEL)) |
diff --git a/drivers/leds/leds-atmel-pwm.c b/drivers/leds/leds-atmel-pwm.c index 800243b6037e..64ad702a2ecc 100644 --- a/drivers/leds/leds-atmel-pwm.c +++ b/drivers/leds/leds-atmel-pwm.c | |||
| @@ -35,7 +35,7 @@ static void pwmled_brightness(struct led_classdev *cdev, enum led_brightness b) | |||
| 35 | * NOTE: we reuse the platform_data structure of GPIO leds, | 35 | * NOTE: we reuse the platform_data structure of GPIO leds, |
| 36 | * but repurpose its "gpio" number as a PWM channel number. | 36 | * but repurpose its "gpio" number as a PWM channel number. |
| 37 | */ | 37 | */ |
| 38 | static int __init pwmled_probe(struct platform_device *pdev) | 38 | static int __devinit pwmled_probe(struct platform_device *pdev) |
| 39 | { | 39 | { |
| 40 | const struct gpio_led_platform_data *pdata; | 40 | const struct gpio_led_platform_data *pdata; |
| 41 | struct pwmled *leds; | 41 | struct pwmled *leds; |
diff --git a/drivers/md/bitmap.c b/drivers/md/bitmap.c index 97e73e555d11..17e2b472e16d 100644 --- a/drivers/md/bitmap.c +++ b/drivers/md/bitmap.c | |||
| @@ -1727,8 +1727,7 @@ int bitmap_create(struct mddev *mddev) | |||
| 1727 | bitmap->chunkshift = (ffz(~mddev->bitmap_info.chunksize) | 1727 | bitmap->chunkshift = (ffz(~mddev->bitmap_info.chunksize) |
| 1728 | - BITMAP_BLOCK_SHIFT); | 1728 | - BITMAP_BLOCK_SHIFT); |
| 1729 | 1729 | ||
| 1730 | /* now that chunksize and chunkshift are set, we can use these macros */ | 1730 | chunks = (blocks + (1 << bitmap->chunkshift) - 1) >> |
| 1731 | chunks = (blocks + bitmap->chunkshift - 1) >> | ||
| 1732 | bitmap->chunkshift; | 1731 | bitmap->chunkshift; |
| 1733 | pages = (chunks + PAGE_COUNTER_RATIO - 1) / PAGE_COUNTER_RATIO; | 1732 | pages = (chunks + PAGE_COUNTER_RATIO - 1) / PAGE_COUNTER_RATIO; |
| 1734 | 1733 | ||
diff --git a/drivers/md/bitmap.h b/drivers/md/bitmap.h index 55ca5aec84e4..b44b0aba2d47 100644 --- a/drivers/md/bitmap.h +++ b/drivers/md/bitmap.h | |||
| @@ -101,9 +101,6 @@ typedef __u16 bitmap_counter_t; | |||
| 101 | 101 | ||
| 102 | #define BITMAP_BLOCK_SHIFT 9 | 102 | #define BITMAP_BLOCK_SHIFT 9 |
| 103 | 103 | ||
| 104 | /* how many blocks per chunk? (this is variable) */ | ||
| 105 | #define CHUNK_BLOCK_RATIO(bitmap) ((bitmap)->mddev->bitmap_info.chunksize >> BITMAP_BLOCK_SHIFT) | ||
| 106 | |||
| 107 | #endif | 104 | #endif |
| 108 | 105 | ||
| 109 | /* | 106 | /* |
diff --git a/drivers/md/dm-raid.c b/drivers/md/dm-raid.c index b0ba52459ed7..68965e663248 100644 --- a/drivers/md/dm-raid.c +++ b/drivers/md/dm-raid.c | |||
| @@ -859,7 +859,7 @@ static int analyse_superblocks(struct dm_target *ti, struct raid_set *rs) | |||
| 859 | int ret; | 859 | int ret; |
| 860 | unsigned redundancy = 0; | 860 | unsigned redundancy = 0; |
| 861 | struct raid_dev *dev; | 861 | struct raid_dev *dev; |
| 862 | struct md_rdev *rdev, *freshest; | 862 | struct md_rdev *rdev, *tmp, *freshest; |
| 863 | struct mddev *mddev = &rs->md; | 863 | struct mddev *mddev = &rs->md; |
| 864 | 864 | ||
| 865 | switch (rs->raid_type->level) { | 865 | switch (rs->raid_type->level) { |
| @@ -877,7 +877,7 @@ static int analyse_superblocks(struct dm_target *ti, struct raid_set *rs) | |||
| 877 | } | 877 | } |
| 878 | 878 | ||
| 879 | freshest = NULL; | 879 | freshest = NULL; |
| 880 | rdev_for_each(rdev, mddev) { | 880 | rdev_for_each_safe(rdev, tmp, mddev) { |
| 881 | if (!rdev->meta_bdev) | 881 | if (!rdev->meta_bdev) |
| 882 | continue; | 882 | continue; |
| 883 | 883 | ||
diff --git a/drivers/md/md.c b/drivers/md/md.c index b572e1e386ce..477eb2e180c0 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
| @@ -7560,14 +7560,14 @@ void md_check_recovery(struct mddev *mddev) | |||
| 7560 | * any transients in the value of "sync_action". | 7560 | * any transients in the value of "sync_action". |
| 7561 | */ | 7561 | */ |
| 7562 | set_bit(MD_RECOVERY_RUNNING, &mddev->recovery); | 7562 | set_bit(MD_RECOVERY_RUNNING, &mddev->recovery); |
| 7563 | clear_bit(MD_RECOVERY_NEEDED, &mddev->recovery); | ||
| 7564 | /* Clear some bits that don't mean anything, but | 7563 | /* Clear some bits that don't mean anything, but |
| 7565 | * might be left set | 7564 | * might be left set |
| 7566 | */ | 7565 | */ |
| 7567 | clear_bit(MD_RECOVERY_INTR, &mddev->recovery); | 7566 | clear_bit(MD_RECOVERY_INTR, &mddev->recovery); |
| 7568 | clear_bit(MD_RECOVERY_DONE, &mddev->recovery); | 7567 | clear_bit(MD_RECOVERY_DONE, &mddev->recovery); |
| 7569 | 7568 | ||
| 7570 | if (test_bit(MD_RECOVERY_FROZEN, &mddev->recovery)) | 7569 | if (!test_and_clear_bit(MD_RECOVERY_NEEDED, &mddev->recovery) || |
| 7570 | test_bit(MD_RECOVERY_FROZEN, &mddev->recovery)) | ||
| 7571 | goto unlock; | 7571 | goto unlock; |
| 7572 | /* no recovery is running. | 7572 | /* no recovery is running. |
| 7573 | * remove any failed drives, then | 7573 | * remove any failed drives, then |
| @@ -8140,7 +8140,8 @@ static int md_notify_reboot(struct notifier_block *this, | |||
| 8140 | 8140 | ||
| 8141 | for_each_mddev(mddev, tmp) { | 8141 | for_each_mddev(mddev, tmp) { |
| 8142 | if (mddev_trylock(mddev)) { | 8142 | if (mddev_trylock(mddev)) { |
| 8143 | __md_stop_writes(mddev); | 8143 | if (mddev->pers) |
| 8144 | __md_stop_writes(mddev); | ||
| 8144 | mddev->safemode = 2; | 8145 | mddev->safemode = 2; |
| 8145 | mddev_unlock(mddev); | 8146 | mddev_unlock(mddev); |
| 8146 | } | 8147 | } |
diff --git a/drivers/media/common/tuners/xc5000.c b/drivers/media/common/tuners/xc5000.c index 7f98984e4fad..eab2ea424200 100644 --- a/drivers/media/common/tuners/xc5000.c +++ b/drivers/media/common/tuners/xc5000.c | |||
| @@ -54,6 +54,7 @@ struct xc5000_priv { | |||
| 54 | struct list_head hybrid_tuner_instance_list; | 54 | struct list_head hybrid_tuner_instance_list; |
| 55 | 55 | ||
| 56 | u32 if_khz; | 56 | u32 if_khz; |
| 57 | u32 xtal_khz; | ||
| 57 | u32 freq_hz; | 58 | u32 freq_hz; |
| 58 | u32 bandwidth; | 59 | u32 bandwidth; |
| 59 | u8 video_standard; | 60 | u8 video_standard; |
| @@ -214,9 +215,9 @@ static const struct xc5000_fw_cfg xc5000a_1_6_114 = { | |||
| 214 | .size = 12401, | 215 | .size = 12401, |
| 215 | }; | 216 | }; |
| 216 | 217 | ||
| 217 | static const struct xc5000_fw_cfg xc5000c_41_024_5_31875 = { | 218 | static const struct xc5000_fw_cfg xc5000c_41_024_5 = { |
| 218 | .name = "dvb-fe-xc5000c-41.024.5-31875.fw", | 219 | .name = "dvb-fe-xc5000c-41.024.5.fw", |
| 219 | .size = 16503, | 220 | .size = 16497, |
| 220 | }; | 221 | }; |
| 221 | 222 | ||
| 222 | static inline const struct xc5000_fw_cfg *xc5000_assign_firmware(int chip_id) | 223 | static inline const struct xc5000_fw_cfg *xc5000_assign_firmware(int chip_id) |
| @@ -226,7 +227,7 @@ static inline const struct xc5000_fw_cfg *xc5000_assign_firmware(int chip_id) | |||
| 226 | case XC5000A: | 227 | case XC5000A: |
| 227 | return &xc5000a_1_6_114; | 228 | return &xc5000a_1_6_114; |
| 228 | case XC5000C: | 229 | case XC5000C: |
| 229 | return &xc5000c_41_024_5_31875; | 230 | return &xc5000c_41_024_5; |
| 230 | } | 231 | } |
| 231 | } | 232 | } |
| 232 | 233 | ||
| @@ -572,6 +573,31 @@ static int xc_tune_channel(struct xc5000_priv *priv, u32 freq_hz, int mode) | |||
| 572 | return found; | 573 | return found; |
| 573 | } | 574 | } |
| 574 | 575 | ||
| 576 | static int xc_set_xtal(struct dvb_frontend *fe) | ||
| 577 | { | ||
| 578 | struct xc5000_priv *priv = fe->tuner_priv; | ||
| 579 | int ret = XC_RESULT_SUCCESS; | ||
| 580 | |||
| 581 | switch (priv->chip_id) { | ||
| 582 | default: | ||
| 583 | case XC5000A: | ||
| 584 | /* 32.000 MHz xtal is default */ | ||
| 585 | break; | ||
| 586 | case XC5000C: | ||
| 587 | switch (priv->xtal_khz) { | ||
| 588 | default: | ||
| 589 | case 32000: | ||
| 590 | /* 32.000 MHz xtal is default */ | ||
| 591 | break; | ||
| 592 | case 31875: | ||
| 593 | /* 31.875 MHz xtal configuration */ | ||
| 594 | ret = xc_write_reg(priv, 0x000f, 0x8081); | ||
| 595 | break; | ||
| 596 | } | ||
| 597 | break; | ||
| 598 | } | ||
| 599 | return ret; | ||
| 600 | } | ||
| 575 | 601 | ||
| 576 | static int xc5000_fwupload(struct dvb_frontend *fe) | 602 | static int xc5000_fwupload(struct dvb_frontend *fe) |
| 577 | { | 603 | { |
| @@ -603,6 +629,8 @@ static int xc5000_fwupload(struct dvb_frontend *fe) | |||
| 603 | } else { | 629 | } else { |
| 604 | printk(KERN_INFO "xc5000: firmware uploading...\n"); | 630 | printk(KERN_INFO "xc5000: firmware uploading...\n"); |
| 605 | ret = xc_load_i2c_sequence(fe, fw->data); | 631 | ret = xc_load_i2c_sequence(fe, fw->data); |
| 632 | if (XC_RESULT_SUCCESS == ret) | ||
| 633 | ret = xc_set_xtal(fe); | ||
| 606 | printk(KERN_INFO "xc5000: firmware upload complete...\n"); | 634 | printk(KERN_INFO "xc5000: firmware upload complete...\n"); |
| 607 | } | 635 | } |
| 608 | 636 | ||
| @@ -1164,6 +1192,9 @@ struct dvb_frontend *xc5000_attach(struct dvb_frontend *fe, | |||
| 1164 | priv->if_khz = cfg->if_khz; | 1192 | priv->if_khz = cfg->if_khz; |
| 1165 | } | 1193 | } |
| 1166 | 1194 | ||
| 1195 | if (priv->xtal_khz == 0) | ||
| 1196 | priv->xtal_khz = cfg->xtal_khz; | ||
| 1197 | |||
| 1167 | if (priv->radio_input == 0) | 1198 | if (priv->radio_input == 0) |
| 1168 | priv->radio_input = cfg->radio_input; | 1199 | priv->radio_input = cfg->radio_input; |
| 1169 | 1200 | ||
diff --git a/drivers/media/common/tuners/xc5000.h b/drivers/media/common/tuners/xc5000.h index 3396f8e02b40..39a73bf01406 100644 --- a/drivers/media/common/tuners/xc5000.h +++ b/drivers/media/common/tuners/xc5000.h | |||
| @@ -34,6 +34,7 @@ struct xc5000_config { | |||
| 34 | u8 i2c_address; | 34 | u8 i2c_address; |
| 35 | u32 if_khz; | 35 | u32 if_khz; |
| 36 | u8 radio_input; | 36 | u8 radio_input; |
| 37 | u32 xtal_khz; | ||
| 37 | 38 | ||
| 38 | int chip_id; | 39 | int chip_id; |
| 39 | }; | 40 | }; |
diff --git a/drivers/media/dvb/dvb-core/dvb_frontend.c b/drivers/media/dvb/dvb-core/dvb_frontend.c index 39696c6a4ed7..0f64d7182657 100644 --- a/drivers/media/dvb/dvb-core/dvb_frontend.c +++ b/drivers/media/dvb/dvb-core/dvb_frontend.c | |||
| @@ -1446,6 +1446,28 @@ static int set_delivery_system(struct dvb_frontend *fe, u32 desired_system) | |||
| 1446 | __func__); | 1446 | __func__); |
| 1447 | return -EINVAL; | 1447 | return -EINVAL; |
| 1448 | } | 1448 | } |
| 1449 | /* | ||
| 1450 | * Get a delivery system that is compatible with DVBv3 | ||
| 1451 | * NOTE: in order for this to work with softwares like Kaffeine that | ||
| 1452 | * uses a DVBv5 call for DVB-S2 and a DVBv3 call to go back to | ||
| 1453 | * DVB-S, drivers that support both should put the SYS_DVBS entry | ||
| 1454 | * before the SYS_DVBS2, otherwise it won't switch back to DVB-S. | ||
| 1455 | * The real fix is that userspace applications should not use DVBv3 | ||
| 1456 | * and not trust on calling FE_SET_FRONTEND to switch the delivery | ||
| 1457 | * system. | ||
| 1458 | */ | ||
| 1459 | ncaps = 0; | ||
| 1460 | while (fe->ops.delsys[ncaps] && ncaps < MAX_DELSYS) { | ||
| 1461 | if (fe->ops.delsys[ncaps] == desired_system) { | ||
| 1462 | delsys = desired_system; | ||
| 1463 | break; | ||
| 1464 | } | ||
| 1465 | ncaps++; | ||
| 1466 | } | ||
| 1467 | if (delsys == SYS_UNDEFINED) { | ||
| 1468 | dprintk("%s() Couldn't find a delivery system that matches %d\n", | ||
| 1469 | __func__, desired_system); | ||
| 1470 | } | ||
| 1449 | } else { | 1471 | } else { |
| 1450 | /* | 1472 | /* |
| 1451 | * This is a DVBv5 call. So, it likely knows the supported | 1473 | * This is a DVBv5 call. So, it likely knows the supported |
| @@ -1494,9 +1516,10 @@ static int set_delivery_system(struct dvb_frontend *fe, u32 desired_system) | |||
| 1494 | __func__); | 1516 | __func__); |
| 1495 | return -EINVAL; | 1517 | return -EINVAL; |
| 1496 | } | 1518 | } |
| 1497 | c->delivery_system = delsys; | ||
| 1498 | } | 1519 | } |
| 1499 | 1520 | ||
| 1521 | c->delivery_system = delsys; | ||
| 1522 | |||
| 1500 | /* | 1523 | /* |
| 1501 | * The DVBv3 or DVBv5 call is requesting a different system. So, | 1524 | * The DVBv3 or DVBv5 call is requesting a different system. So, |
| 1502 | * emulation is needed. | 1525 | * emulation is needed. |
diff --git a/drivers/media/dvb/frontends/drxk_hard.c b/drivers/media/dvb/frontends/drxk_hard.c index 36d11756492f..a414b1f2b6a5 100644 --- a/drivers/media/dvb/frontends/drxk_hard.c +++ b/drivers/media/dvb/frontends/drxk_hard.c | |||
| @@ -1520,8 +1520,10 @@ static int scu_command(struct drxk_state *state, | |||
| 1520 | dprintk(1, "\n"); | 1520 | dprintk(1, "\n"); |
| 1521 | 1521 | ||
| 1522 | if ((cmd == 0) || ((parameterLen > 0) && (parameter == NULL)) || | 1522 | if ((cmd == 0) || ((parameterLen > 0) && (parameter == NULL)) || |
| 1523 | ((resultLen > 0) && (result == NULL))) | 1523 | ((resultLen > 0) && (result == NULL))) { |
| 1524 | goto error; | 1524 | printk(KERN_ERR "drxk: Error %d on %s\n", status, __func__); |
| 1525 | return status; | ||
| 1526 | } | ||
| 1525 | 1527 | ||
| 1526 | mutex_lock(&state->mutex); | 1528 | mutex_lock(&state->mutex); |
| 1527 | 1529 | ||
diff --git a/drivers/media/rc/winbond-cir.c b/drivers/media/rc/winbond-cir.c index b09c5fae489b..af526586fa26 100644 --- a/drivers/media/rc/winbond-cir.c +++ b/drivers/media/rc/winbond-cir.c | |||
| @@ -1046,6 +1046,7 @@ wbcir_probe(struct pnp_dev *device, const struct pnp_device_id *dev_id) | |||
| 1046 | goto exit_unregister_led; | 1046 | goto exit_unregister_led; |
| 1047 | } | 1047 | } |
| 1048 | 1048 | ||
| 1049 | data->dev->driver_type = RC_DRIVER_IR_RAW; | ||
| 1049 | data->dev->driver_name = WBCIR_NAME; | 1050 | data->dev->driver_name = WBCIR_NAME; |
| 1050 | data->dev->input_name = WBCIR_NAME; | 1051 | data->dev->input_name = WBCIR_NAME; |
| 1051 | data->dev->input_phys = "wbcir/cir0"; | 1052 | data->dev->input_phys = "wbcir/cir0"; |
diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig index f2479c5c0eb2..ce1e7ba940f6 100644 --- a/drivers/media/video/Kconfig +++ b/drivers/media/video/Kconfig | |||
| @@ -492,7 +492,7 @@ config VIDEO_VS6624 | |||
| 492 | 492 | ||
| 493 | config VIDEO_MT9M032 | 493 | config VIDEO_MT9M032 |
| 494 | tristate "MT9M032 camera sensor support" | 494 | tristate "MT9M032 camera sensor support" |
| 495 | depends on I2C && VIDEO_V4L2 | 495 | depends on I2C && VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API |
| 496 | select VIDEO_APTINA_PLL | 496 | select VIDEO_APTINA_PLL |
| 497 | ---help--- | 497 | ---help--- |
| 498 | This driver supports MT9M032 camera sensors from Aptina, monochrome | 498 | This driver supports MT9M032 camera sensors from Aptina, monochrome |
diff --git a/drivers/media/video/mt9m032.c b/drivers/media/video/mt9m032.c index 7636672c3548..645973c5feb0 100644 --- a/drivers/media/video/mt9m032.c +++ b/drivers/media/video/mt9m032.c | |||
| @@ -392,10 +392,11 @@ static int mt9m032_set_pad_format(struct v4l2_subdev *subdev, | |||
| 392 | } | 392 | } |
| 393 | 393 | ||
| 394 | /* Scaling is not supported, the format is thus fixed. */ | 394 | /* Scaling is not supported, the format is thus fixed. */ |
| 395 | ret = mt9m032_get_pad_format(subdev, fh, fmt); | 395 | fmt->format = *__mt9m032_get_pad_format(sensor, fh, fmt->which); |
| 396 | ret = 0; | ||
| 396 | 397 | ||
| 397 | done: | 398 | done: |
| 398 | mutex_lock(&sensor->lock); | 399 | mutex_unlock(&sensor->lock); |
| 399 | return ret; | 400 | return ret; |
| 400 | } | 401 | } |
| 401 | 402 | ||
diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig index 29f463cc09cb..11e44386fa9b 100644 --- a/drivers/mfd/Kconfig +++ b/drivers/mfd/Kconfig | |||
| @@ -268,10 +268,17 @@ config TWL6030_PWM | |||
| 268 | This is used to control charging LED brightness. | 268 | This is used to control charging LED brightness. |
| 269 | 269 | ||
| 270 | config TWL6040_CORE | 270 | config TWL6040_CORE |
| 271 | bool | 271 | bool "Support for TWL6040 audio codec" |
| 272 | depends on TWL4030_CORE && GENERIC_HARDIRQS | 272 | depends on I2C=y && GENERIC_HARDIRQS |
| 273 | select MFD_CORE | 273 | select MFD_CORE |
| 274 | select REGMAP_I2C | ||
| 274 | default n | 275 | default n |
| 276 | help | ||
| 277 | Say yes here if you want support for Texas Instruments TWL6040 audio | ||
| 278 | codec. | ||
| 279 | This driver provides common support for accessing the device, | ||
| 280 | additional drivers must be enabled in order to use the | ||
| 281 | functionality of the device (audio, vibra). | ||
| 275 | 282 | ||
| 276 | config MFD_STMPE | 283 | config MFD_STMPE |
| 277 | bool "Support STMicroelectronics STMPE" | 284 | bool "Support STMicroelectronics STMPE" |
diff --git a/drivers/mfd/asic3.c b/drivers/mfd/asic3.c index 1895cf9fab8c..1582c3d95257 100644 --- a/drivers/mfd/asic3.c +++ b/drivers/mfd/asic3.c | |||
| @@ -527,7 +527,9 @@ static void asic3_gpio_set(struct gpio_chip *chip, | |||
| 527 | 527 | ||
| 528 | static int asic3_gpio_to_irq(struct gpio_chip *chip, unsigned offset) | 528 | static int asic3_gpio_to_irq(struct gpio_chip *chip, unsigned offset) |
| 529 | { | 529 | { |
| 530 | return (offset < ASIC3_NUM_GPIOS) ? IRQ_BOARD_START + offset : -ENXIO; | 530 | struct asic3 *asic = container_of(chip, struct asic3, gpio); |
| 531 | |||
| 532 | return (offset < ASIC3_NUM_GPIOS) ? asic->irq_base + offset : -ENXIO; | ||
| 531 | } | 533 | } |
| 532 | 534 | ||
| 533 | static __init int asic3_gpio_probe(struct platform_device *pdev, | 535 | static __init int asic3_gpio_probe(struct platform_device *pdev, |
diff --git a/drivers/mfd/omap-usb-host.c b/drivers/mfd/omap-usb-host.c index 95a2e546a489..7e96bb229724 100644 --- a/drivers/mfd/omap-usb-host.c +++ b/drivers/mfd/omap-usb-host.c | |||
| @@ -25,7 +25,7 @@ | |||
| 25 | #include <linux/clk.h> | 25 | #include <linux/clk.h> |
| 26 | #include <linux/dma-mapping.h> | 26 | #include <linux/dma-mapping.h> |
| 27 | #include <linux/spinlock.h> | 27 | #include <linux/spinlock.h> |
| 28 | #include <linux/gpio.h> | 28 | #include <plat/cpu.h> |
| 29 | #include <plat/usb.h> | 29 | #include <plat/usb.h> |
| 30 | #include <linux/pm_runtime.h> | 30 | #include <linux/pm_runtime.h> |
| 31 | 31 | ||
| @@ -502,19 +502,6 @@ static void omap_usbhs_init(struct device *dev) | |||
| 502 | pm_runtime_get_sync(dev); | 502 | pm_runtime_get_sync(dev); |
| 503 | spin_lock_irqsave(&omap->lock, flags); | 503 | spin_lock_irqsave(&omap->lock, flags); |
| 504 | 504 | ||
| 505 | if (pdata->ehci_data->phy_reset) { | ||
| 506 | if (gpio_is_valid(pdata->ehci_data->reset_gpio_port[0])) | ||
| 507 | gpio_request_one(pdata->ehci_data->reset_gpio_port[0], | ||
| 508 | GPIOF_OUT_INIT_LOW, "USB1 PHY reset"); | ||
| 509 | |||
| 510 | if (gpio_is_valid(pdata->ehci_data->reset_gpio_port[1])) | ||
| 511 | gpio_request_one(pdata->ehci_data->reset_gpio_port[1], | ||
| 512 | GPIOF_OUT_INIT_LOW, "USB2 PHY reset"); | ||
| 513 | |||
| 514 | /* Hold the PHY in RESET for enough time till DIR is high */ | ||
| 515 | udelay(10); | ||
| 516 | } | ||
| 517 | |||
| 518 | omap->usbhs_rev = usbhs_read(omap->uhh_base, OMAP_UHH_REVISION); | 505 | omap->usbhs_rev = usbhs_read(omap->uhh_base, OMAP_UHH_REVISION); |
| 519 | dev_dbg(dev, "OMAP UHH_REVISION 0x%x\n", omap->usbhs_rev); | 506 | dev_dbg(dev, "OMAP UHH_REVISION 0x%x\n", omap->usbhs_rev); |
| 520 | 507 | ||
| @@ -593,39 +580,10 @@ static void omap_usbhs_init(struct device *dev) | |||
| 593 | usbhs_omap_tll_init(dev, OMAP_TLL_CHANNEL_COUNT); | 580 | usbhs_omap_tll_init(dev, OMAP_TLL_CHANNEL_COUNT); |
| 594 | } | 581 | } |
| 595 | 582 | ||
| 596 | if (pdata->ehci_data->phy_reset) { | ||
| 597 | /* Hold the PHY in RESET for enough time till | ||
| 598 | * PHY is settled and ready | ||
| 599 | */ | ||
| 600 | udelay(10); | ||
| 601 | |||
| 602 | if (gpio_is_valid(pdata->ehci_data->reset_gpio_port[0])) | ||
| 603 | gpio_set_value | ||
| 604 | (pdata->ehci_data->reset_gpio_port[0], 1); | ||
| 605 | |||
| 606 | if (gpio_is_valid(pdata->ehci_data->reset_gpio_port[1])) | ||
| 607 | gpio_set_value | ||
| 608 | (pdata->ehci_data->reset_gpio_port[1], 1); | ||
| 609 | } | ||
| 610 | |||
| 611 | spin_unlock_irqrestore(&omap->lock, flags); | 583 | spin_unlock_irqrestore(&omap->lock, flags); |
| 612 | pm_runtime_put_sync(dev); | 584 | pm_runtime_put_sync(dev); |
| 613 | } | 585 | } |
| 614 | 586 | ||
| 615 | static void omap_usbhs_deinit(struct device *dev) | ||
| 616 | { | ||
| 617 | struct usbhs_hcd_omap *omap = dev_get_drvdata(dev); | ||
| 618 | struct usbhs_omap_platform_data *pdata = &omap->platdata; | ||
| 619 | |||
| 620 | if (pdata->ehci_data->phy_reset) { | ||
| 621 | if (gpio_is_valid(pdata->ehci_data->reset_gpio_port[0])) | ||
| 622 | gpio_free(pdata->ehci_data->reset_gpio_port[0]); | ||
| 623 | |||
| 624 | if (gpio_is_valid(pdata->ehci_data->reset_gpio_port[1])) | ||
| 625 | gpio_free(pdata->ehci_data->reset_gpio_port[1]); | ||
| 626 | } | ||
| 627 | } | ||
| 628 | |||
| 629 | 587 | ||
| 630 | /** | 588 | /** |
| 631 | * usbhs_omap_probe - initialize TI-based HCDs | 589 | * usbhs_omap_probe - initialize TI-based HCDs |
| @@ -860,7 +818,6 @@ static int __devexit usbhs_omap_remove(struct platform_device *pdev) | |||
| 860 | { | 818 | { |
| 861 | struct usbhs_hcd_omap *omap = platform_get_drvdata(pdev); | 819 | struct usbhs_hcd_omap *omap = platform_get_drvdata(pdev); |
| 862 | 820 | ||
| 863 | omap_usbhs_deinit(&pdev->dev); | ||
| 864 | iounmap(omap->tll_base); | 821 | iounmap(omap->tll_base); |
| 865 | iounmap(omap->uhh_base); | 822 | iounmap(omap->uhh_base); |
| 866 | clk_put(omap->init_60m_fclk); | 823 | clk_put(omap->init_60m_fclk); |
diff --git a/drivers/mfd/rc5t583.c b/drivers/mfd/rc5t583.c index 99ef944c621d..44afae0a69ce 100644 --- a/drivers/mfd/rc5t583.c +++ b/drivers/mfd/rc5t583.c | |||
| @@ -80,44 +80,6 @@ static struct mfd_cell rc5t583_subdevs[] = { | |||
| 80 | {.name = "rc5t583-key", } | 80 | {.name = "rc5t583-key", } |
| 81 | }; | 81 | }; |
| 82 | 82 | ||
| 83 | int rc5t583_write(struct device *dev, uint8_t reg, uint8_t val) | ||
| 84 | { | ||
| 85 | struct rc5t583 *rc5t583 = dev_get_drvdata(dev); | ||
| 86 | return regmap_write(rc5t583->regmap, reg, val); | ||
| 87 | } | ||
| 88 | |||
| 89 | int rc5t583_read(struct device *dev, uint8_t reg, uint8_t *val) | ||
| 90 | { | ||
| 91 | struct rc5t583 *rc5t583 = dev_get_drvdata(dev); | ||
| 92 | unsigned int ival; | ||
| 93 | int ret; | ||
| 94 | ret = regmap_read(rc5t583->regmap, reg, &ival); | ||
| 95 | if (!ret) | ||
| 96 | *val = (uint8_t)ival; | ||
| 97 | return ret; | ||
| 98 | } | ||
| 99 | |||
| 100 | int rc5t583_set_bits(struct device *dev, unsigned int reg, | ||
| 101 | unsigned int bit_mask) | ||
| 102 | { | ||
| 103 | struct rc5t583 *rc5t583 = dev_get_drvdata(dev); | ||
| 104 | return regmap_update_bits(rc5t583->regmap, reg, bit_mask, bit_mask); | ||
| 105 | } | ||
| 106 | |||
| 107 | int rc5t583_clear_bits(struct device *dev, unsigned int reg, | ||
| 108 | unsigned int bit_mask) | ||
| 109 | { | ||
| 110 | struct rc5t583 *rc5t583 = dev_get_drvdata(dev); | ||
| 111 | return regmap_update_bits(rc5t583->regmap, reg, bit_mask, 0); | ||
| 112 | } | ||
| 113 | |||
| 114 | int rc5t583_update(struct device *dev, unsigned int reg, | ||
| 115 | unsigned int val, unsigned int mask) | ||
| 116 | { | ||
| 117 | struct rc5t583 *rc5t583 = dev_get_drvdata(dev); | ||
| 118 | return regmap_update_bits(rc5t583->regmap, reg, mask, val); | ||
| 119 | } | ||
| 120 | |||
| 121 | static int __rc5t583_set_ext_pwrreq1_control(struct device *dev, | 83 | static int __rc5t583_set_ext_pwrreq1_control(struct device *dev, |
| 122 | int id, int ext_pwr, int slots) | 84 | int id, int ext_pwr, int slots) |
| 123 | { | 85 | { |
| @@ -197,6 +159,7 @@ int rc5t583_ext_power_req_config(struct device *dev, int ds_id, | |||
| 197 | ds_id, ext_pwr_req); | 159 | ds_id, ext_pwr_req); |
| 198 | return 0; | 160 | return 0; |
| 199 | } | 161 | } |
| 162 | EXPORT_SYMBOL(rc5t583_ext_power_req_config); | ||
| 200 | 163 | ||
| 201 | static int rc5t583_clear_ext_power_req(struct rc5t583 *rc5t583, | 164 | static int rc5t583_clear_ext_power_req(struct rc5t583 *rc5t583, |
| 202 | struct rc5t583_platform_data *pdata) | 165 | struct rc5t583_platform_data *pdata) |
diff --git a/drivers/mfd/twl6040-core.c b/drivers/mfd/twl6040-core.c index b2d8e512d3cb..2d6bedadca09 100644 --- a/drivers/mfd/twl6040-core.c +++ b/drivers/mfd/twl6040-core.c | |||
| @@ -30,7 +30,9 @@ | |||
| 30 | #include <linux/platform_device.h> | 30 | #include <linux/platform_device.h> |
| 31 | #include <linux/gpio.h> | 31 | #include <linux/gpio.h> |
| 32 | #include <linux/delay.h> | 32 | #include <linux/delay.h> |
| 33 | #include <linux/i2c/twl.h> | 33 | #include <linux/i2c.h> |
| 34 | #include <linux/regmap.h> | ||
| 35 | #include <linux/err.h> | ||
| 34 | #include <linux/mfd/core.h> | 36 | #include <linux/mfd/core.h> |
| 35 | #include <linux/mfd/twl6040.h> | 37 | #include <linux/mfd/twl6040.h> |
| 36 | 38 | ||
| @@ -39,7 +41,7 @@ | |||
| 39 | int twl6040_reg_read(struct twl6040 *twl6040, unsigned int reg) | 41 | int twl6040_reg_read(struct twl6040 *twl6040, unsigned int reg) |
| 40 | { | 42 | { |
| 41 | int ret; | 43 | int ret; |
| 42 | u8 val = 0; | 44 | unsigned int val; |
| 43 | 45 | ||
| 44 | mutex_lock(&twl6040->io_mutex); | 46 | mutex_lock(&twl6040->io_mutex); |
| 45 | /* Vibra control registers from cache */ | 47 | /* Vibra control registers from cache */ |
| @@ -47,7 +49,7 @@ int twl6040_reg_read(struct twl6040 *twl6040, unsigned int reg) | |||
| 47 | reg == TWL6040_REG_VIBCTLR)) { | 49 | reg == TWL6040_REG_VIBCTLR)) { |
| 48 | val = twl6040->vibra_ctrl_cache[VIBRACTRL_MEMBER(reg)]; | 50 | val = twl6040->vibra_ctrl_cache[VIBRACTRL_MEMBER(reg)]; |
| 49 | } else { | 51 | } else { |
| 50 | ret = twl_i2c_read_u8(TWL_MODULE_AUDIO_VOICE, &val, reg); | 52 | ret = regmap_read(twl6040->regmap, reg, &val); |
| 51 | if (ret < 0) { | 53 | if (ret < 0) { |
| 52 | mutex_unlock(&twl6040->io_mutex); | 54 | mutex_unlock(&twl6040->io_mutex); |
| 53 | return ret; | 55 | return ret; |
| @@ -64,7 +66,7 @@ int twl6040_reg_write(struct twl6040 *twl6040, unsigned int reg, u8 val) | |||
| 64 | int ret; | 66 | int ret; |
| 65 | 67 | ||
| 66 | mutex_lock(&twl6040->io_mutex); | 68 | mutex_lock(&twl6040->io_mutex); |
| 67 | ret = twl_i2c_write_u8(TWL_MODULE_AUDIO_VOICE, val, reg); | 69 | ret = regmap_write(twl6040->regmap, reg, val); |
| 68 | /* Cache the vibra control registers */ | 70 | /* Cache the vibra control registers */ |
| 69 | if (reg == TWL6040_REG_VIBCTLL || reg == TWL6040_REG_VIBCTLR) | 71 | if (reg == TWL6040_REG_VIBCTLL || reg == TWL6040_REG_VIBCTLR) |
| 70 | twl6040->vibra_ctrl_cache[VIBRACTRL_MEMBER(reg)] = val; | 72 | twl6040->vibra_ctrl_cache[VIBRACTRL_MEMBER(reg)] = val; |
| @@ -77,16 +79,9 @@ EXPORT_SYMBOL(twl6040_reg_write); | |||
| 77 | int twl6040_set_bits(struct twl6040 *twl6040, unsigned int reg, u8 mask) | 79 | int twl6040_set_bits(struct twl6040 *twl6040, unsigned int reg, u8 mask) |
| 78 | { | 80 | { |
| 79 | int ret; | 81 | int ret; |
| 80 | u8 val; | ||
| 81 | 82 | ||
| 82 | mutex_lock(&twl6040->io_mutex); | 83 | mutex_lock(&twl6040->io_mutex); |
| 83 | ret = twl_i2c_read_u8(TWL_MODULE_AUDIO_VOICE, &val, reg); | 84 | ret = regmap_update_bits(twl6040->regmap, reg, mask, mask); |
| 84 | if (ret) | ||
| 85 | goto out; | ||
| 86 | |||
| 87 | val |= mask; | ||
| 88 | ret = twl_i2c_write_u8(TWL_MODULE_AUDIO_VOICE, val, reg); | ||
| 89 | out: | ||
| 90 | mutex_unlock(&twl6040->io_mutex); | 85 | mutex_unlock(&twl6040->io_mutex); |
| 91 | return ret; | 86 | return ret; |
| 92 | } | 87 | } |
| @@ -95,16 +90,9 @@ EXPORT_SYMBOL(twl6040_set_bits); | |||
| 95 | int twl6040_clear_bits(struct twl6040 *twl6040, unsigned int reg, u8 mask) | 90 | int twl6040_clear_bits(struct twl6040 *twl6040, unsigned int reg, u8 mask) |
| 96 | { | 91 | { |
| 97 | int ret; | 92 | int ret; |
| 98 | u8 val; | ||
| 99 | 93 | ||
| 100 | mutex_lock(&twl6040->io_mutex); | 94 | mutex_lock(&twl6040->io_mutex); |
| 101 | ret = twl_i2c_read_u8(TWL_MODULE_AUDIO_VOICE, &val, reg); | 95 | ret = regmap_update_bits(twl6040->regmap, reg, mask, 0); |
| 102 | if (ret) | ||
| 103 | goto out; | ||
| 104 | |||
| 105 | val &= ~mask; | ||
| 106 | ret = twl_i2c_write_u8(TWL_MODULE_AUDIO_VOICE, val, reg); | ||
| 107 | out: | ||
| 108 | mutex_unlock(&twl6040->io_mutex); | 96 | mutex_unlock(&twl6040->io_mutex); |
| 109 | return ret; | 97 | return ret; |
| 110 | } | 98 | } |
| @@ -494,32 +482,58 @@ static struct resource twl6040_codec_rsrc[] = { | |||
| 494 | }, | 482 | }, |
| 495 | }; | 483 | }; |
| 496 | 484 | ||
| 497 | static int __devinit twl6040_probe(struct platform_device *pdev) | 485 | static bool twl6040_readable_reg(struct device *dev, unsigned int reg) |
| 498 | { | 486 | { |
| 499 | struct twl4030_audio_data *pdata = pdev->dev.platform_data; | 487 | /* Register 0 is not readable */ |
| 488 | if (!reg) | ||
| 489 | return false; | ||
| 490 | return true; | ||
| 491 | } | ||
| 492 | |||
| 493 | static struct regmap_config twl6040_regmap_config = { | ||
| 494 | .reg_bits = 8, | ||
| 495 | .val_bits = 8, | ||
| 496 | .max_register = TWL6040_REG_STATUS, /* 0x2e */ | ||
| 497 | |||
| 498 | .readable_reg = twl6040_readable_reg, | ||
| 499 | }; | ||
| 500 | |||
| 501 | static int __devinit twl6040_probe(struct i2c_client *client, | ||
| 502 | const struct i2c_device_id *id) | ||
| 503 | { | ||
| 504 | struct twl6040_platform_data *pdata = client->dev.platform_data; | ||
| 500 | struct twl6040 *twl6040; | 505 | struct twl6040 *twl6040; |
| 501 | struct mfd_cell *cell = NULL; | 506 | struct mfd_cell *cell = NULL; |
| 502 | int ret, children = 0; | 507 | int ret, children = 0; |
| 503 | 508 | ||
| 504 | if (!pdata) { | 509 | if (!pdata) { |
| 505 | dev_err(&pdev->dev, "Platform data is missing\n"); | 510 | dev_err(&client->dev, "Platform data is missing\n"); |
| 506 | return -EINVAL; | 511 | return -EINVAL; |
| 507 | } | 512 | } |
| 508 | 513 | ||
| 509 | /* In order to operate correctly we need valid interrupt config */ | 514 | /* In order to operate correctly we need valid interrupt config */ |
| 510 | if (!pdata->naudint_irq || !pdata->irq_base) { | 515 | if (!client->irq || !pdata->irq_base) { |
| 511 | dev_err(&pdev->dev, "Invalid IRQ configuration\n"); | 516 | dev_err(&client->dev, "Invalid IRQ configuration\n"); |
| 512 | return -EINVAL; | 517 | return -EINVAL; |
| 513 | } | 518 | } |
| 514 | 519 | ||
| 515 | twl6040 = kzalloc(sizeof(struct twl6040), GFP_KERNEL); | 520 | twl6040 = devm_kzalloc(&client->dev, sizeof(struct twl6040), |
| 516 | if (!twl6040) | 521 | GFP_KERNEL); |
| 517 | return -ENOMEM; | 522 | if (!twl6040) { |
| 523 | ret = -ENOMEM; | ||
| 524 | goto err; | ||
| 525 | } | ||
| 526 | |||
| 527 | twl6040->regmap = regmap_init_i2c(client, &twl6040_regmap_config); | ||
| 528 | if (IS_ERR(twl6040->regmap)) { | ||
| 529 | ret = PTR_ERR(twl6040->regmap); | ||
| 530 | goto err; | ||
| 531 | } | ||
| 518 | 532 | ||
| 519 | platform_set_drvdata(pdev, twl6040); | 533 | i2c_set_clientdata(client, twl6040); |
| 520 | 534 | ||
| 521 | twl6040->dev = &pdev->dev; | 535 | twl6040->dev = &client->dev; |
| 522 | twl6040->irq = pdata->naudint_irq; | 536 | twl6040->irq = client->irq; |
| 523 | twl6040->irq_base = pdata->irq_base; | 537 | twl6040->irq_base = pdata->irq_base; |
| 524 | 538 | ||
| 525 | mutex_init(&twl6040->mutex); | 539 | mutex_init(&twl6040->mutex); |
| @@ -588,12 +602,12 @@ static int __devinit twl6040_probe(struct platform_device *pdev) | |||
| 588 | } | 602 | } |
| 589 | 603 | ||
| 590 | if (children) { | 604 | if (children) { |
| 591 | ret = mfd_add_devices(&pdev->dev, pdev->id, twl6040->cells, | 605 | ret = mfd_add_devices(&client->dev, -1, twl6040->cells, |
| 592 | children, NULL, 0); | 606 | children, NULL, 0); |
| 593 | if (ret) | 607 | if (ret) |
| 594 | goto mfd_err; | 608 | goto mfd_err; |
| 595 | } else { | 609 | } else { |
| 596 | dev_err(&pdev->dev, "No platform data found for children\n"); | 610 | dev_err(&client->dev, "No platform data found for children\n"); |
| 597 | ret = -ENODEV; | 611 | ret = -ENODEV; |
| 598 | goto mfd_err; | 612 | goto mfd_err; |
| 599 | } | 613 | } |
| @@ -608,14 +622,15 @@ gpio2_err: | |||
| 608 | if (gpio_is_valid(twl6040->audpwron)) | 622 | if (gpio_is_valid(twl6040->audpwron)) |
| 609 | gpio_free(twl6040->audpwron); | 623 | gpio_free(twl6040->audpwron); |
| 610 | gpio1_err: | 624 | gpio1_err: |
| 611 | platform_set_drvdata(pdev, NULL); | 625 | i2c_set_clientdata(client, NULL); |
| 612 | kfree(twl6040); | 626 | regmap_exit(twl6040->regmap); |
| 627 | err: | ||
| 613 | return ret; | 628 | return ret; |
| 614 | } | 629 | } |
| 615 | 630 | ||
| 616 | static int __devexit twl6040_remove(struct platform_device *pdev) | 631 | static int __devexit twl6040_remove(struct i2c_client *client) |
| 617 | { | 632 | { |
| 618 | struct twl6040 *twl6040 = platform_get_drvdata(pdev); | 633 | struct twl6040 *twl6040 = i2c_get_clientdata(client); |
| 619 | 634 | ||
| 620 | if (twl6040->power_count) | 635 | if (twl6040->power_count) |
| 621 | twl6040_power(twl6040, 0); | 636 | twl6040_power(twl6040, 0); |
| @@ -626,23 +641,30 @@ static int __devexit twl6040_remove(struct platform_device *pdev) | |||
| 626 | free_irq(twl6040->irq_base + TWL6040_IRQ_READY, twl6040); | 641 | free_irq(twl6040->irq_base + TWL6040_IRQ_READY, twl6040); |
| 627 | twl6040_irq_exit(twl6040); | 642 | twl6040_irq_exit(twl6040); |
| 628 | 643 | ||
| 629 | mfd_remove_devices(&pdev->dev); | 644 | mfd_remove_devices(&client->dev); |
| 630 | platform_set_drvdata(pdev, NULL); | 645 | i2c_set_clientdata(client, NULL); |
| 631 | kfree(twl6040); | 646 | regmap_exit(twl6040->regmap); |
| 632 | 647 | ||
| 633 | return 0; | 648 | return 0; |
| 634 | } | 649 | } |
| 635 | 650 | ||
| 636 | static struct platform_driver twl6040_driver = { | 651 | static const struct i2c_device_id twl6040_i2c_id[] = { |
| 652 | { "twl6040", 0, }, | ||
| 653 | { }, | ||
| 654 | }; | ||
| 655 | MODULE_DEVICE_TABLE(i2c, twl6040_i2c_id); | ||
| 656 | |||
| 657 | static struct i2c_driver twl6040_driver = { | ||
| 658 | .driver = { | ||
| 659 | .name = "twl6040", | ||
| 660 | .owner = THIS_MODULE, | ||
| 661 | }, | ||
| 637 | .probe = twl6040_probe, | 662 | .probe = twl6040_probe, |
| 638 | .remove = __devexit_p(twl6040_remove), | 663 | .remove = __devexit_p(twl6040_remove), |
| 639 | .driver = { | 664 | .id_table = twl6040_i2c_id, |
| 640 | .owner = THIS_MODULE, | ||
| 641 | .name = "twl6040", | ||
| 642 | }, | ||
| 643 | }; | 665 | }; |
| 644 | 666 | ||
| 645 | module_platform_driver(twl6040_driver); | 667 | module_i2c_driver(twl6040_driver); |
| 646 | 668 | ||
| 647 | MODULE_DESCRIPTION("TWL6040 MFD"); | 669 | MODULE_DESCRIPTION("TWL6040 MFD"); |
| 648 | MODULE_AUTHOR("Misael Lopez Cruz <misael.lopez@ti.com>"); | 670 | MODULE_AUTHOR("Misael Lopez Cruz <misael.lopez@ti.com>"); |
diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c index b1809650b7aa..dabec556ebb8 100644 --- a/drivers/mmc/card/block.c +++ b/drivers/mmc/card/block.c | |||
| @@ -873,7 +873,7 @@ static int mmc_blk_issue_secdiscard_rq(struct mmc_queue *mq, | |||
| 873 | { | 873 | { |
| 874 | struct mmc_blk_data *md = mq->data; | 874 | struct mmc_blk_data *md = mq->data; |
| 875 | struct mmc_card *card = md->queue.card; | 875 | struct mmc_card *card = md->queue.card; |
| 876 | unsigned int from, nr, arg; | 876 | unsigned int from, nr, arg, trim_arg, erase_arg; |
| 877 | int err = 0, type = MMC_BLK_SECDISCARD; | 877 | int err = 0, type = MMC_BLK_SECDISCARD; |
| 878 | 878 | ||
| 879 | if (!(mmc_can_secure_erase_trim(card) || mmc_can_sanitize(card))) { | 879 | if (!(mmc_can_secure_erase_trim(card) || mmc_can_sanitize(card))) { |
| @@ -881,20 +881,26 @@ static int mmc_blk_issue_secdiscard_rq(struct mmc_queue *mq, | |||
| 881 | goto out; | 881 | goto out; |
| 882 | } | 882 | } |
| 883 | 883 | ||
| 884 | from = blk_rq_pos(req); | ||
| 885 | nr = blk_rq_sectors(req); | ||
| 886 | |||
| 884 | /* The sanitize operation is supported at v4.5 only */ | 887 | /* The sanitize operation is supported at v4.5 only */ |
| 885 | if (mmc_can_sanitize(card)) { | 888 | if (mmc_can_sanitize(card)) { |
| 886 | err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, | 889 | erase_arg = MMC_ERASE_ARG; |
| 887 | EXT_CSD_SANITIZE_START, 1, 0); | 890 | trim_arg = MMC_TRIM_ARG; |
| 888 | goto out; | 891 | } else { |
| 892 | erase_arg = MMC_SECURE_ERASE_ARG; | ||
| 893 | trim_arg = MMC_SECURE_TRIM1_ARG; | ||
| 889 | } | 894 | } |
| 890 | 895 | ||
| 891 | from = blk_rq_pos(req); | 896 | if (mmc_erase_group_aligned(card, from, nr)) |
| 892 | nr = blk_rq_sectors(req); | 897 | arg = erase_arg; |
| 893 | 898 | else if (mmc_can_trim(card)) | |
| 894 | if (mmc_can_trim(card) && !mmc_erase_group_aligned(card, from, nr)) | 899 | arg = trim_arg; |
| 895 | arg = MMC_SECURE_TRIM1_ARG; | 900 | else { |
| 896 | else | 901 | err = -EINVAL; |
| 897 | arg = MMC_SECURE_ERASE_ARG; | 902 | goto out; |
| 903 | } | ||
| 898 | retry: | 904 | retry: |
| 899 | if (card->quirks & MMC_QUIRK_INAND_CMD38) { | 905 | if (card->quirks & MMC_QUIRK_INAND_CMD38) { |
| 900 | err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, | 906 | err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, |
| @@ -904,25 +910,41 @@ retry: | |||
| 904 | INAND_CMD38_ARG_SECERASE, | 910 | INAND_CMD38_ARG_SECERASE, |
| 905 | 0); | 911 | 0); |
| 906 | if (err) | 912 | if (err) |
| 907 | goto out; | 913 | goto out_retry; |
| 908 | } | 914 | } |
| 915 | |||
| 909 | err = mmc_erase(card, from, nr, arg); | 916 | err = mmc_erase(card, from, nr, arg); |
| 910 | if (!err && arg == MMC_SECURE_TRIM1_ARG) { | 917 | if (err == -EIO) |
| 918 | goto out_retry; | ||
| 919 | if (err) | ||
| 920 | goto out; | ||
| 921 | |||
| 922 | if (arg == MMC_SECURE_TRIM1_ARG) { | ||
| 911 | if (card->quirks & MMC_QUIRK_INAND_CMD38) { | 923 | if (card->quirks & MMC_QUIRK_INAND_CMD38) { |
| 912 | err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, | 924 | err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, |
| 913 | INAND_CMD38_ARG_EXT_CSD, | 925 | INAND_CMD38_ARG_EXT_CSD, |
| 914 | INAND_CMD38_ARG_SECTRIM2, | 926 | INAND_CMD38_ARG_SECTRIM2, |
| 915 | 0); | 927 | 0); |
| 916 | if (err) | 928 | if (err) |
| 917 | goto out; | 929 | goto out_retry; |
| 918 | } | 930 | } |
| 931 | |||
| 919 | err = mmc_erase(card, from, nr, MMC_SECURE_TRIM2_ARG); | 932 | err = mmc_erase(card, from, nr, MMC_SECURE_TRIM2_ARG); |
| 933 | if (err == -EIO) | ||
| 934 | goto out_retry; | ||
| 935 | if (err) | ||
| 936 | goto out; | ||
| 920 | } | 937 | } |
| 921 | out: | 938 | |
| 922 | if (err == -EIO && !mmc_blk_reset(md, card->host, type)) | 939 | if (mmc_can_sanitize(card)) |
| 940 | err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, | ||
| 941 | EXT_CSD_SANITIZE_START, 1, 0); | ||
| 942 | out_retry: | ||
| 943 | if (err && !mmc_blk_reset(md, card->host, type)) | ||
| 923 | goto retry; | 944 | goto retry; |
| 924 | if (!err) | 945 | if (!err) |
| 925 | mmc_blk_reset_success(md, type); | 946 | mmc_blk_reset_success(md, type); |
| 947 | out: | ||
| 926 | spin_lock_irq(&md->lock); | 948 | spin_lock_irq(&md->lock); |
| 927 | __blk_end_request(req, err, blk_rq_bytes(req)); | 949 | __blk_end_request(req, err, blk_rq_bytes(req)); |
| 928 | spin_unlock_irq(&md->lock); | 950 | spin_unlock_irq(&md->lock); |
| @@ -1802,7 +1824,7 @@ static void mmc_blk_remove(struct mmc_card *card) | |||
| 1802 | } | 1824 | } |
| 1803 | 1825 | ||
| 1804 | #ifdef CONFIG_PM | 1826 | #ifdef CONFIG_PM |
| 1805 | static int mmc_blk_suspend(struct mmc_card *card, pm_message_t state) | 1827 | static int mmc_blk_suspend(struct mmc_card *card) |
| 1806 | { | 1828 | { |
| 1807 | struct mmc_blk_data *part_md; | 1829 | struct mmc_blk_data *part_md; |
| 1808 | struct mmc_blk_data *md = mmc_get_drvdata(card); | 1830 | struct mmc_blk_data *md = mmc_get_drvdata(card); |
diff --git a/drivers/mmc/card/queue.c b/drivers/mmc/card/queue.c index 2517547b4366..996f8e36e23d 100644 --- a/drivers/mmc/card/queue.c +++ b/drivers/mmc/card/queue.c | |||
| @@ -139,7 +139,7 @@ static void mmc_queue_setup_discard(struct request_queue *q, | |||
| 139 | 139 | ||
| 140 | queue_flag_set_unlocked(QUEUE_FLAG_DISCARD, q); | 140 | queue_flag_set_unlocked(QUEUE_FLAG_DISCARD, q); |
| 141 | q->limits.max_discard_sectors = max_discard; | 141 | q->limits.max_discard_sectors = max_discard; |
| 142 | if (card->erased_byte == 0) | 142 | if (card->erased_byte == 0 && !mmc_can_discard(card)) |
| 143 | q->limits.discard_zeroes_data = 1; | 143 | q->limits.discard_zeroes_data = 1; |
| 144 | q->limits.discard_granularity = card->pref_erase << 9; | 144 | q->limits.discard_granularity = card->pref_erase << 9; |
| 145 | /* granularity must not be greater than max. discard */ | 145 | /* granularity must not be greater than max. discard */ |
diff --git a/drivers/mmc/core/bus.c b/drivers/mmc/core/bus.c index 3f606068d552..c60cee92a2b2 100644 --- a/drivers/mmc/core/bus.c +++ b/drivers/mmc/core/bus.c | |||
| @@ -122,14 +122,14 @@ static int mmc_bus_remove(struct device *dev) | |||
| 122 | return 0; | 122 | return 0; |
| 123 | } | 123 | } |
| 124 | 124 | ||
| 125 | static int mmc_bus_suspend(struct device *dev, pm_message_t state) | 125 | static int mmc_bus_suspend(struct device *dev) |
| 126 | { | 126 | { |
| 127 | struct mmc_driver *drv = to_mmc_driver(dev->driver); | 127 | struct mmc_driver *drv = to_mmc_driver(dev->driver); |
| 128 | struct mmc_card *card = mmc_dev_to_card(dev); | 128 | struct mmc_card *card = mmc_dev_to_card(dev); |
| 129 | int ret = 0; | 129 | int ret = 0; |
| 130 | 130 | ||
| 131 | if (dev->driver && drv->suspend) | 131 | if (dev->driver && drv->suspend) |
| 132 | ret = drv->suspend(card, state); | 132 | ret = drv->suspend(card); |
| 133 | return ret; | 133 | return ret; |
| 134 | } | 134 | } |
| 135 | 135 | ||
| @@ -165,20 +165,14 @@ static int mmc_runtime_idle(struct device *dev) | |||
| 165 | return pm_runtime_suspend(dev); | 165 | return pm_runtime_suspend(dev); |
| 166 | } | 166 | } |
| 167 | 167 | ||
| 168 | #endif /* !CONFIG_PM_RUNTIME */ | ||
| 169 | |||
| 168 | static const struct dev_pm_ops mmc_bus_pm_ops = { | 170 | static const struct dev_pm_ops mmc_bus_pm_ops = { |
| 169 | .runtime_suspend = mmc_runtime_suspend, | 171 | SET_RUNTIME_PM_OPS(mmc_runtime_suspend, mmc_runtime_resume, |
| 170 | .runtime_resume = mmc_runtime_resume, | 172 | mmc_runtime_idle) |
| 171 | .runtime_idle = mmc_runtime_idle, | 173 | SET_SYSTEM_SLEEP_PM_OPS(mmc_bus_suspend, mmc_bus_resume) |
| 172 | }; | 174 | }; |
| 173 | 175 | ||
| 174 | #define MMC_PM_OPS_PTR (&mmc_bus_pm_ops) | ||
| 175 | |||
| 176 | #else /* !CONFIG_PM_RUNTIME */ | ||
| 177 | |||
| 178 | #define MMC_PM_OPS_PTR NULL | ||
| 179 | |||
| 180 | #endif /* !CONFIG_PM_RUNTIME */ | ||
| 181 | |||
| 182 | static struct bus_type mmc_bus_type = { | 176 | static struct bus_type mmc_bus_type = { |
| 183 | .name = "mmc", | 177 | .name = "mmc", |
| 184 | .dev_attrs = mmc_dev_attrs, | 178 | .dev_attrs = mmc_dev_attrs, |
| @@ -186,9 +180,7 @@ static struct bus_type mmc_bus_type = { | |||
| 186 | .uevent = mmc_bus_uevent, | 180 | .uevent = mmc_bus_uevent, |
| 187 | .probe = mmc_bus_probe, | 181 | .probe = mmc_bus_probe, |
| 188 | .remove = mmc_bus_remove, | 182 | .remove = mmc_bus_remove, |
| 189 | .suspend = mmc_bus_suspend, | 183 | .pm = &mmc_bus_pm_ops, |
| 190 | .resume = mmc_bus_resume, | ||
| 191 | .pm = MMC_PM_OPS_PTR, | ||
| 192 | }; | 184 | }; |
| 193 | 185 | ||
| 194 | int mmc_register_bus(void) | 186 | int mmc_register_bus(void) |
diff --git a/drivers/mmc/core/cd-gpio.c b/drivers/mmc/core/cd-gpio.c index 29de31e260dd..2c14be73254c 100644 --- a/drivers/mmc/core/cd-gpio.c +++ b/drivers/mmc/core/cd-gpio.c | |||
| @@ -12,6 +12,7 @@ | |||
| 12 | #include <linux/gpio.h> | 12 | #include <linux/gpio.h> |
| 13 | #include <linux/interrupt.h> | 13 | #include <linux/interrupt.h> |
| 14 | #include <linux/jiffies.h> | 14 | #include <linux/jiffies.h> |
| 15 | #include <linux/mmc/cd-gpio.h> | ||
| 15 | #include <linux/mmc/host.h> | 16 | #include <linux/mmc/host.h> |
| 16 | #include <linux/module.h> | 17 | #include <linux/module.h> |
| 17 | #include <linux/slab.h> | 18 | #include <linux/slab.h> |
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index 7474c47b9c08..ba821fe70bca 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c | |||
| @@ -1409,7 +1409,10 @@ static unsigned int mmc_mmc_erase_timeout(struct mmc_card *card, | |||
| 1409 | { | 1409 | { |
| 1410 | unsigned int erase_timeout; | 1410 | unsigned int erase_timeout; |
| 1411 | 1411 | ||
| 1412 | if (card->ext_csd.erase_group_def & 1) { | 1412 | if (arg == MMC_DISCARD_ARG || |
| 1413 | (arg == MMC_TRIM_ARG && card->ext_csd.rev >= 6)) { | ||
| 1414 | erase_timeout = card->ext_csd.trim_timeout; | ||
| 1415 | } else if (card->ext_csd.erase_group_def & 1) { | ||
| 1413 | /* High Capacity Erase Group Size uses HC timeouts */ | 1416 | /* High Capacity Erase Group Size uses HC timeouts */ |
| 1414 | if (arg == MMC_TRIM_ARG) | 1417 | if (arg == MMC_TRIM_ARG) |
| 1415 | erase_timeout = card->ext_csd.trim_timeout; | 1418 | erase_timeout = card->ext_csd.trim_timeout; |
| @@ -1681,8 +1684,6 @@ int mmc_can_trim(struct mmc_card *card) | |||
| 1681 | { | 1684 | { |
| 1682 | if (card->ext_csd.sec_feature_support & EXT_CSD_SEC_GB_CL_EN) | 1685 | if (card->ext_csd.sec_feature_support & EXT_CSD_SEC_GB_CL_EN) |
| 1683 | return 1; | 1686 | return 1; |
| 1684 | if (mmc_can_discard(card)) | ||
| 1685 | return 1; | ||
| 1686 | return 0; | 1687 | return 0; |
| 1687 | } | 1688 | } |
| 1688 | EXPORT_SYMBOL(mmc_can_trim); | 1689 | EXPORT_SYMBOL(mmc_can_trim); |
| @@ -1701,6 +1702,8 @@ EXPORT_SYMBOL(mmc_can_discard); | |||
| 1701 | 1702 | ||
| 1702 | int mmc_can_sanitize(struct mmc_card *card) | 1703 | int mmc_can_sanitize(struct mmc_card *card) |
| 1703 | { | 1704 | { |
| 1705 | if (!mmc_can_trim(card) && !mmc_can_erase(card)) | ||
| 1706 | return 0; | ||
| 1704 | if (card->ext_csd.sec_feature_support & EXT_CSD_SEC_SANITIZE) | 1707 | if (card->ext_csd.sec_feature_support & EXT_CSD_SEC_SANITIZE) |
| 1705 | return 1; | 1708 | return 1; |
| 1706 | return 0; | 1709 | return 0; |
| @@ -2235,6 +2238,7 @@ int mmc_cache_ctrl(struct mmc_host *host, u8 enable) | |||
| 2235 | mmc_card_is_removable(host)) | 2238 | mmc_card_is_removable(host)) |
| 2236 | return err; | 2239 | return err; |
| 2237 | 2240 | ||
| 2241 | mmc_claim_host(host); | ||
| 2238 | if (card && mmc_card_mmc(card) && | 2242 | if (card && mmc_card_mmc(card) && |
| 2239 | (card->ext_csd.cache_size > 0)) { | 2243 | (card->ext_csd.cache_size > 0)) { |
| 2240 | enable = !!enable; | 2244 | enable = !!enable; |
| @@ -2252,6 +2256,7 @@ int mmc_cache_ctrl(struct mmc_host *host, u8 enable) | |||
| 2252 | card->ext_csd.cache_ctrl = enable; | 2256 | card->ext_csd.cache_ctrl = enable; |
| 2253 | } | 2257 | } |
| 2254 | } | 2258 | } |
| 2259 | mmc_release_host(host); | ||
| 2255 | 2260 | ||
| 2256 | return err; | 2261 | return err; |
| 2257 | } | 2262 | } |
| @@ -2269,49 +2274,32 @@ int mmc_suspend_host(struct mmc_host *host) | |||
| 2269 | 2274 | ||
| 2270 | cancel_delayed_work(&host->detect); | 2275 | cancel_delayed_work(&host->detect); |
| 2271 | mmc_flush_scheduled_work(); | 2276 | mmc_flush_scheduled_work(); |
| 2272 | if (mmc_try_claim_host(host)) { | ||
| 2273 | err = mmc_cache_ctrl(host, 0); | ||
| 2274 | mmc_release_host(host); | ||
| 2275 | } else { | ||
| 2276 | err = -EBUSY; | ||
| 2277 | } | ||
| 2278 | 2277 | ||
| 2278 | err = mmc_cache_ctrl(host, 0); | ||
| 2279 | if (err) | 2279 | if (err) |
| 2280 | goto out; | 2280 | goto out; |
| 2281 | 2281 | ||
| 2282 | mmc_bus_get(host); | 2282 | mmc_bus_get(host); |
| 2283 | if (host->bus_ops && !host->bus_dead) { | 2283 | if (host->bus_ops && !host->bus_dead) { |
| 2284 | 2284 | ||
| 2285 | /* | 2285 | if (host->bus_ops->suspend) |
| 2286 | * A long response time is not acceptable for device drivers | 2286 | err = host->bus_ops->suspend(host); |
| 2287 | * when doing suspend. Prevent mmc_claim_host in the suspend | ||
| 2288 | * sequence, to potentially wait "forever" by trying to | ||
| 2289 | * pre-claim the host. | ||
| 2290 | */ | ||
| 2291 | if (mmc_try_claim_host(host)) { | ||
| 2292 | if (host->bus_ops->suspend) { | ||
| 2293 | err = host->bus_ops->suspend(host); | ||
| 2294 | } | ||
| 2295 | mmc_release_host(host); | ||
| 2296 | 2287 | ||
| 2297 | if (err == -ENOSYS || !host->bus_ops->resume) { | 2288 | if (err == -ENOSYS || !host->bus_ops->resume) { |
| 2298 | /* | 2289 | /* |
| 2299 | * We simply "remove" the card in this case. | 2290 | * We simply "remove" the card in this case. |
| 2300 | * It will be redetected on resume. (Calling | 2291 | * It will be redetected on resume. (Calling |
| 2301 | * bus_ops->remove() with a claimed host can | 2292 | * bus_ops->remove() with a claimed host can |
| 2302 | * deadlock.) | 2293 | * deadlock.) |
| 2303 | */ | 2294 | */ |
| 2304 | if (host->bus_ops->remove) | 2295 | if (host->bus_ops->remove) |
| 2305 | host->bus_ops->remove(host); | 2296 | host->bus_ops->remove(host); |
| 2306 | mmc_claim_host(host); | 2297 | mmc_claim_host(host); |
| 2307 | mmc_detach_bus(host); | 2298 | mmc_detach_bus(host); |
| 2308 | mmc_power_off(host); | 2299 | mmc_power_off(host); |
| 2309 | mmc_release_host(host); | 2300 | mmc_release_host(host); |
| 2310 | host->pm_flags = 0; | 2301 | host->pm_flags = 0; |
| 2311 | err = 0; | 2302 | err = 0; |
| 2312 | } | ||
| 2313 | } else { | ||
| 2314 | err = -EBUSY; | ||
| 2315 | } | 2303 | } |
| 2316 | } | 2304 | } |
| 2317 | mmc_bus_put(host); | 2305 | mmc_bus_put(host); |
diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c index bf3c9b456aaf..ab3fc4617107 100644 --- a/drivers/mmc/host/dw_mmc.c +++ b/drivers/mmc/host/dw_mmc.c | |||
| @@ -526,8 +526,10 @@ static int dw_mci_submit_data_dma(struct dw_mci *host, struct mmc_data *data) | |||
| 526 | return -ENODEV; | 526 | return -ENODEV; |
| 527 | 527 | ||
| 528 | sg_len = dw_mci_pre_dma_transfer(host, data, 0); | 528 | sg_len = dw_mci_pre_dma_transfer(host, data, 0); |
| 529 | if (sg_len < 0) | 529 | if (sg_len < 0) { |
| 530 | host->dma_ops->stop(host); | ||
| 530 | return sg_len; | 531 | return sg_len; |
| 532 | } | ||
| 531 | 533 | ||
| 532 | host->using_dma = 1; | 534 | host->using_dma = 1; |
| 533 | 535 | ||
| @@ -1879,7 +1881,8 @@ static void dw_mci_init_dma(struct dw_mci *host) | |||
| 1879 | if (!host->dma_ops) | 1881 | if (!host->dma_ops) |
| 1880 | goto no_dma; | 1882 | goto no_dma; |
| 1881 | 1883 | ||
| 1882 | if (host->dma_ops->init) { | 1884 | if (host->dma_ops->init && host->dma_ops->start && |
| 1885 | host->dma_ops->stop && host->dma_ops->cleanup) { | ||
| 1883 | if (host->dma_ops->init(host)) { | 1886 | if (host->dma_ops->init(host)) { |
| 1884 | dev_err(&host->dev, "%s: Unable to initialize " | 1887 | dev_err(&host->dev, "%s: Unable to initialize " |
| 1885 | "DMA Controller.\n", __func__); | 1888 | "DMA Controller.\n", __func__); |
diff --git a/drivers/mmc/host/mxs-mmc.c b/drivers/mmc/host/mxs-mmc.c index b0f2ef988188..e3f5af96ab87 100644 --- a/drivers/mmc/host/mxs-mmc.c +++ b/drivers/mmc/host/mxs-mmc.c | |||
| @@ -363,6 +363,7 @@ static void mxs_mmc_bc(struct mxs_mmc_host *host) | |||
| 363 | goto out; | 363 | goto out; |
| 364 | 364 | ||
| 365 | dmaengine_submit(desc); | 365 | dmaengine_submit(desc); |
| 366 | dma_async_issue_pending(host->dmach); | ||
| 366 | return; | 367 | return; |
| 367 | 368 | ||
| 368 | out: | 369 | out: |
| @@ -403,6 +404,7 @@ static void mxs_mmc_ac(struct mxs_mmc_host *host) | |||
| 403 | goto out; | 404 | goto out; |
| 404 | 405 | ||
| 405 | dmaengine_submit(desc); | 406 | dmaengine_submit(desc); |
| 407 | dma_async_issue_pending(host->dmach); | ||
| 406 | return; | 408 | return; |
| 407 | 409 | ||
| 408 | out: | 410 | out: |
| @@ -531,6 +533,7 @@ static void mxs_mmc_adtc(struct mxs_mmc_host *host) | |||
| 531 | goto out; | 533 | goto out; |
| 532 | 534 | ||
| 533 | dmaengine_submit(desc); | 535 | dmaengine_submit(desc); |
| 536 | dma_async_issue_pending(host->dmach); | ||
| 534 | return; | 537 | return; |
| 535 | out: | 538 | out: |
| 536 | dev_warn(mmc_dev(host->mmc), | 539 | dev_warn(mmc_dev(host->mmc), |
diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c index 5c2b1c10af9c..56d4499d4388 100644 --- a/drivers/mmc/host/omap_hsmmc.c +++ b/drivers/mmc/host/omap_hsmmc.c | |||
| @@ -249,7 +249,7 @@ static int omap_hsmmc_set_power(struct device *dev, int slot, int power_on, | |||
| 249 | * the pbias cell programming support is still missing when | 249 | * the pbias cell programming support is still missing when |
| 250 | * booting with Device tree | 250 | * booting with Device tree |
| 251 | */ | 251 | */ |
| 252 | if (of_have_populated_dt() && !vdd) | 252 | if (dev->of_node && !vdd) |
| 253 | return 0; | 253 | return 0; |
| 254 | 254 | ||
| 255 | if (mmc_slot(host).before_set_reg) | 255 | if (mmc_slot(host).before_set_reg) |
| @@ -1549,7 +1549,7 @@ static void omap_hsmmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) | |||
| 1549 | * can't be allowed when booting with device | 1549 | * can't be allowed when booting with device |
| 1550 | * tree. | 1550 | * tree. |
| 1551 | */ | 1551 | */ |
| 1552 | (!of_have_populated_dt())) { | 1552 | !host->dev->of_node) { |
| 1553 | /* | 1553 | /* |
| 1554 | * The mmc_select_voltage fn of the core does | 1554 | * The mmc_select_voltage fn of the core does |
| 1555 | * not seem to set the power_mode to | 1555 | * not seem to set the power_mode to |
| @@ -1741,7 +1741,7 @@ static const struct of_device_id omap_mmc_of_match[] = { | |||
| 1741 | .data = &omap4_reg_offset, | 1741 | .data = &omap4_reg_offset, |
| 1742 | }, | 1742 | }, |
| 1743 | {}, | 1743 | {}, |
| 1744 | } | 1744 | }; |
| 1745 | MODULE_DEVICE_TABLE(of, omap_mmc_of_match); | 1745 | MODULE_DEVICE_TABLE(of, omap_mmc_of_match); |
| 1746 | 1746 | ||
| 1747 | static struct omap_mmc_platform_data *of_get_hsmmc_pdata(struct device *dev) | 1747 | static struct omap_mmc_platform_data *of_get_hsmmc_pdata(struct device *dev) |
diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c index 6193a0d7bde5..8abdaf6697a8 100644 --- a/drivers/mmc/host/sdhci-esdhc-imx.c +++ b/drivers/mmc/host/sdhci-esdhc-imx.c | |||
| @@ -467,8 +467,7 @@ static int __devinit sdhci_esdhc_imx_probe(struct platform_device *pdev) | |||
| 467 | clk_prepare_enable(clk); | 467 | clk_prepare_enable(clk); |
| 468 | pltfm_host->clk = clk; | 468 | pltfm_host->clk = clk; |
| 469 | 469 | ||
| 470 | if (!is_imx25_esdhc(imx_data)) | 470 | host->quirks |= SDHCI_QUIRK_BROKEN_TIMEOUT_VAL; |
| 471 | host->quirks |= SDHCI_QUIRK_BROKEN_TIMEOUT_VAL; | ||
| 472 | 471 | ||
| 473 | if (is_imx25_esdhc(imx_data) || is_imx35_esdhc(imx_data)) | 472 | if (is_imx25_esdhc(imx_data) || is_imx35_esdhc(imx_data)) |
| 474 | /* Fix errata ENGcm07207 present on i.MX25 and i.MX35 */ | 473 | /* Fix errata ENGcm07207 present on i.MX25 and i.MX35 */ |
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index 9aa77f3f04a8..ccefdebeff14 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c | |||
| @@ -147,7 +147,7 @@ static void sdhci_set_card_detection(struct sdhci_host *host, bool enable) | |||
| 147 | u32 present, irqs; | 147 | u32 present, irqs; |
| 148 | 148 | ||
| 149 | if ((host->quirks & SDHCI_QUIRK_BROKEN_CARD_DETECTION) || | 149 | if ((host->quirks & SDHCI_QUIRK_BROKEN_CARD_DETECTION) || |
| 150 | !mmc_card_is_removable(host->mmc)) | 150 | (host->mmc->caps & MMC_CAP_NONREMOVABLE)) |
| 151 | return; | 151 | return; |
| 152 | 152 | ||
| 153 | present = sdhci_readl(host, SDHCI_PRESENT_STATE) & | 153 | present = sdhci_readl(host, SDHCI_PRESENT_STATE) & |
diff --git a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c index 75b1dde16358..9ec51cec2e14 100644 --- a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c +++ b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c | |||
| @@ -266,6 +266,7 @@ int start_dma_without_bch_irq(struct gpmi_nand_data *this, | |||
| 266 | desc->callback = dma_irq_callback; | 266 | desc->callback = dma_irq_callback; |
| 267 | desc->callback_param = this; | 267 | desc->callback_param = this; |
| 268 | dmaengine_submit(desc); | 268 | dmaengine_submit(desc); |
| 269 | dma_async_issue_pending(get_dma_chan(this)); | ||
| 269 | 270 | ||
| 270 | /* Wait for the interrupt from the DMA block. */ | 271 | /* Wait for the interrupt from the DMA block. */ |
| 271 | err = wait_for_completion_timeout(dma_c, msecs_to_jiffies(1000)); | 272 | err = wait_for_completion_timeout(dma_c, msecs_to_jiffies(1000)); |
diff --git a/drivers/net/arcnet/arc-rimi.c b/drivers/net/arcnet/arc-rimi.c index 25197b698dd6..b8b4c7ba884f 100644 --- a/drivers/net/arcnet/arc-rimi.c +++ b/drivers/net/arcnet/arc-rimi.c | |||
| @@ -89,16 +89,16 @@ static int __init arcrimi_probe(struct net_device *dev) | |||
| 89 | BUGLVL(D_NORMAL) printk(VERSION); | 89 | BUGLVL(D_NORMAL) printk(VERSION); |
| 90 | BUGLVL(D_NORMAL) printk("E-mail me if you actually test the RIM I driver, please!\n"); | 90 | BUGLVL(D_NORMAL) printk("E-mail me if you actually test the RIM I driver, please!\n"); |
| 91 | 91 | ||
| 92 | BUGMSG(D_NORMAL, "Given: node %02Xh, shmem %lXh, irq %d\n", | 92 | BUGLVL(D_NORMAL) printk("Given: node %02Xh, shmem %lXh, irq %d\n", |
| 93 | dev->dev_addr[0], dev->mem_start, dev->irq); | 93 | dev->dev_addr[0], dev->mem_start, dev->irq); |
| 94 | 94 | ||
| 95 | if (dev->mem_start <= 0 || dev->irq <= 0) { | 95 | if (dev->mem_start <= 0 || dev->irq <= 0) { |
| 96 | BUGMSG(D_NORMAL, "No autoprobe for RIM I; you " | 96 | BUGLVL(D_NORMAL) printk("No autoprobe for RIM I; you " |
| 97 | "must specify the shmem and irq!\n"); | 97 | "must specify the shmem and irq!\n"); |
| 98 | return -ENODEV; | 98 | return -ENODEV; |
| 99 | } | 99 | } |
| 100 | if (dev->dev_addr[0] == 0) { | 100 | if (dev->dev_addr[0] == 0) { |
| 101 | BUGMSG(D_NORMAL, "You need to specify your card's station " | 101 | BUGLVL(D_NORMAL) printk("You need to specify your card's station " |
| 102 | "ID!\n"); | 102 | "ID!\n"); |
| 103 | return -ENODEV; | 103 | return -ENODEV; |
| 104 | } | 104 | } |
| @@ -109,7 +109,7 @@ static int __init arcrimi_probe(struct net_device *dev) | |||
| 109 | * will be taken. | 109 | * will be taken. |
| 110 | */ | 110 | */ |
| 111 | if (!request_mem_region(dev->mem_start, MIRROR_SIZE, "arcnet (90xx)")) { | 111 | if (!request_mem_region(dev->mem_start, MIRROR_SIZE, "arcnet (90xx)")) { |
| 112 | BUGMSG(D_NORMAL, "Card memory already allocated\n"); | 112 | BUGLVL(D_NORMAL) printk("Card memory already allocated\n"); |
| 113 | return -ENODEV; | 113 | return -ENODEV; |
| 114 | } | 114 | } |
| 115 | return arcrimi_found(dev); | 115 | return arcrimi_found(dev); |
diff --git a/drivers/net/caif/caif_hsi.c b/drivers/net/caif/caif_hsi.c index 9a66e2a910ae..9c1c8cd5223f 100644 --- a/drivers/net/caif/caif_hsi.c +++ b/drivers/net/caif/caif_hsi.c | |||
| @@ -744,14 +744,14 @@ static void cfhsi_wake_up(struct work_struct *work) | |||
| 744 | size_t fifo_occupancy = 0; | 744 | size_t fifo_occupancy = 0; |
| 745 | 745 | ||
| 746 | /* Wakeup timeout */ | 746 | /* Wakeup timeout */ |
| 747 | dev_err(&cfhsi->ndev->dev, "%s: Timeout.\n", | 747 | dev_dbg(&cfhsi->ndev->dev, "%s: Timeout.\n", |
| 748 | __func__); | 748 | __func__); |
| 749 | 749 | ||
| 750 | /* Check FIFO to check if modem has sent something. */ | 750 | /* Check FIFO to check if modem has sent something. */ |
| 751 | WARN_ON(cfhsi->dev->cfhsi_fifo_occupancy(cfhsi->dev, | 751 | WARN_ON(cfhsi->dev->cfhsi_fifo_occupancy(cfhsi->dev, |
| 752 | &fifo_occupancy)); | 752 | &fifo_occupancy)); |
| 753 | 753 | ||
| 754 | dev_err(&cfhsi->ndev->dev, "%s: Bytes in FIFO: %u.\n", | 754 | dev_dbg(&cfhsi->ndev->dev, "%s: Bytes in FIFO: %u.\n", |
| 755 | __func__, (unsigned) fifo_occupancy); | 755 | __func__, (unsigned) fifo_occupancy); |
| 756 | 756 | ||
| 757 | /* Check if we misssed the interrupt. */ | 757 | /* Check if we misssed the interrupt. */ |
| @@ -1210,7 +1210,7 @@ int cfhsi_probe(struct platform_device *pdev) | |||
| 1210 | 1210 | ||
| 1211 | static void cfhsi_shutdown(struct cfhsi *cfhsi) | 1211 | static void cfhsi_shutdown(struct cfhsi *cfhsi) |
| 1212 | { | 1212 | { |
| 1213 | u8 *tx_buf, *rx_buf; | 1213 | u8 *tx_buf, *rx_buf, *flip_buf; |
| 1214 | 1214 | ||
| 1215 | /* Stop TXing */ | 1215 | /* Stop TXing */ |
| 1216 | netif_tx_stop_all_queues(cfhsi->ndev); | 1216 | netif_tx_stop_all_queues(cfhsi->ndev); |
| @@ -1234,7 +1234,7 @@ static void cfhsi_shutdown(struct cfhsi *cfhsi) | |||
| 1234 | /* Store bufferes: will be freed later. */ | 1234 | /* Store bufferes: will be freed later. */ |
| 1235 | tx_buf = cfhsi->tx_buf; | 1235 | tx_buf = cfhsi->tx_buf; |
| 1236 | rx_buf = cfhsi->rx_buf; | 1236 | rx_buf = cfhsi->rx_buf; |
| 1237 | 1237 | flip_buf = cfhsi->rx_flip_buf; | |
| 1238 | /* Flush transmit queues. */ | 1238 | /* Flush transmit queues. */ |
| 1239 | cfhsi_abort_tx(cfhsi); | 1239 | cfhsi_abort_tx(cfhsi); |
| 1240 | 1240 | ||
| @@ -1247,6 +1247,7 @@ static void cfhsi_shutdown(struct cfhsi *cfhsi) | |||
| 1247 | /* Free buffers. */ | 1247 | /* Free buffers. */ |
| 1248 | kfree(tx_buf); | 1248 | kfree(tx_buf); |
| 1249 | kfree(rx_buf); | 1249 | kfree(rx_buf); |
| 1250 | kfree(flip_buf); | ||
| 1250 | } | 1251 | } |
| 1251 | 1252 | ||
| 1252 | int cfhsi_remove(struct platform_device *pdev) | 1253 | int cfhsi_remove(struct platform_device *pdev) |
diff --git a/drivers/net/can/usb/peak_usb/pcan_usb_pro.c b/drivers/net/can/usb/peak_usb/pcan_usb_pro.c index 5234586dff15..629c4ba5d49d 100644 --- a/drivers/net/can/usb/peak_usb/pcan_usb_pro.c +++ b/drivers/net/can/usb/peak_usb/pcan_usb_pro.c | |||
| @@ -875,6 +875,7 @@ static int pcan_usb_pro_init(struct peak_usb_device *dev) | |||
| 875 | PCAN_USBPRO_INFO_FW, | 875 | PCAN_USBPRO_INFO_FW, |
| 876 | &fi, sizeof(fi)); | 876 | &fi, sizeof(fi)); |
| 877 | if (err) { | 877 | if (err) { |
| 878 | kfree(usb_if); | ||
| 878 | dev_err(dev->netdev->dev.parent, | 879 | dev_err(dev->netdev->dev.parent, |
| 879 | "unable to read %s firmware info (err %d)\n", | 880 | "unable to read %s firmware info (err %d)\n", |
| 880 | pcan_usb_pro.name, err); | 881 | pcan_usb_pro.name, err); |
| @@ -885,6 +886,7 @@ static int pcan_usb_pro_init(struct peak_usb_device *dev) | |||
| 885 | PCAN_USBPRO_INFO_BL, | 886 | PCAN_USBPRO_INFO_BL, |
| 886 | &bi, sizeof(bi)); | 887 | &bi, sizeof(bi)); |
| 887 | if (err) { | 888 | if (err) { |
| 889 | kfree(usb_if); | ||
| 888 | dev_err(dev->netdev->dev.parent, | 890 | dev_err(dev->netdev->dev.parent, |
| 889 | "unable to read %s bootloader info (err %d)\n", | 891 | "unable to read %s bootloader info (err %d)\n", |
| 890 | pcan_usb_pro.name, err); | 892 | pcan_usb_pro.name, err); |
diff --git a/drivers/net/dummy.c b/drivers/net/dummy.c index d5c6d92f1ee7..442d91a2747b 100644 --- a/drivers/net/dummy.c +++ b/drivers/net/dummy.c | |||
| @@ -107,14 +107,14 @@ static int dummy_dev_init(struct net_device *dev) | |||
| 107 | return 0; | 107 | return 0; |
| 108 | } | 108 | } |
| 109 | 109 | ||
| 110 | static void dummy_dev_free(struct net_device *dev) | 110 | static void dummy_dev_uninit(struct net_device *dev) |
| 111 | { | 111 | { |
| 112 | free_percpu(dev->dstats); | 112 | free_percpu(dev->dstats); |
| 113 | free_netdev(dev); | ||
| 114 | } | 113 | } |
| 115 | 114 | ||
| 116 | static const struct net_device_ops dummy_netdev_ops = { | 115 | static const struct net_device_ops dummy_netdev_ops = { |
| 117 | .ndo_init = dummy_dev_init, | 116 | .ndo_init = dummy_dev_init, |
| 117 | .ndo_uninit = dummy_dev_uninit, | ||
| 118 | .ndo_start_xmit = dummy_xmit, | 118 | .ndo_start_xmit = dummy_xmit, |
| 119 | .ndo_validate_addr = eth_validate_addr, | 119 | .ndo_validate_addr = eth_validate_addr, |
| 120 | .ndo_set_rx_mode = set_multicast_list, | 120 | .ndo_set_rx_mode = set_multicast_list, |
| @@ -128,7 +128,7 @@ static void dummy_setup(struct net_device *dev) | |||
| 128 | 128 | ||
| 129 | /* Initialize the device structure. */ | 129 | /* Initialize the device structure. */ |
| 130 | dev->netdev_ops = &dummy_netdev_ops; | 130 | dev->netdev_ops = &dummy_netdev_ops; |
| 131 | dev->destructor = dummy_dev_free; | 131 | dev->destructor = free_netdev; |
| 132 | 132 | ||
| 133 | /* Fill in device structure with ethernet-generic values. */ | 133 | /* Fill in device structure with ethernet-generic values. */ |
| 134 | dev->tx_queue_len = 0; | 134 | dev->tx_queue_len = 0; |
diff --git a/drivers/net/ethernet/atheros/atlx/atl1.c b/drivers/net/ethernet/atheros/atlx/atl1.c index 40ac41436549..c926857e8205 100644 --- a/drivers/net/ethernet/atheros/atlx/atl1.c +++ b/drivers/net/ethernet/atheros/atlx/atl1.c | |||
| @@ -2476,7 +2476,7 @@ static irqreturn_t atl1_intr(int irq, void *data) | |||
| 2476 | "pcie phy link down %x\n", status); | 2476 | "pcie phy link down %x\n", status); |
| 2477 | if (netif_running(adapter->netdev)) { /* reset MAC */ | 2477 | if (netif_running(adapter->netdev)) { /* reset MAC */ |
| 2478 | iowrite32(0, adapter->hw.hw_addr + REG_IMR); | 2478 | iowrite32(0, adapter->hw.hw_addr + REG_IMR); |
| 2479 | schedule_work(&adapter->pcie_dma_to_rst_task); | 2479 | schedule_work(&adapter->reset_dev_task); |
| 2480 | return IRQ_HANDLED; | 2480 | return IRQ_HANDLED; |
| 2481 | } | 2481 | } |
| 2482 | } | 2482 | } |
| @@ -2488,7 +2488,7 @@ static irqreturn_t atl1_intr(int irq, void *data) | |||
| 2488 | "pcie DMA r/w error (status = 0x%x)\n", | 2488 | "pcie DMA r/w error (status = 0x%x)\n", |
| 2489 | status); | 2489 | status); |
| 2490 | iowrite32(0, adapter->hw.hw_addr + REG_IMR); | 2490 | iowrite32(0, adapter->hw.hw_addr + REG_IMR); |
| 2491 | schedule_work(&adapter->pcie_dma_to_rst_task); | 2491 | schedule_work(&adapter->reset_dev_task); |
| 2492 | return IRQ_HANDLED; | 2492 | return IRQ_HANDLED; |
| 2493 | } | 2493 | } |
| 2494 | 2494 | ||
| @@ -2633,10 +2633,10 @@ static void atl1_down(struct atl1_adapter *adapter) | |||
| 2633 | atl1_clean_rx_ring(adapter); | 2633 | atl1_clean_rx_ring(adapter); |
| 2634 | } | 2634 | } |
| 2635 | 2635 | ||
| 2636 | static void atl1_tx_timeout_task(struct work_struct *work) | 2636 | static void atl1_reset_dev_task(struct work_struct *work) |
| 2637 | { | 2637 | { |
| 2638 | struct atl1_adapter *adapter = | 2638 | struct atl1_adapter *adapter = |
| 2639 | container_of(work, struct atl1_adapter, tx_timeout_task); | 2639 | container_of(work, struct atl1_adapter, reset_dev_task); |
| 2640 | struct net_device *netdev = adapter->netdev; | 2640 | struct net_device *netdev = adapter->netdev; |
| 2641 | 2641 | ||
| 2642 | netif_device_detach(netdev); | 2642 | netif_device_detach(netdev); |
| @@ -3038,12 +3038,10 @@ static int __devinit atl1_probe(struct pci_dev *pdev, | |||
| 3038 | (unsigned long)adapter); | 3038 | (unsigned long)adapter); |
| 3039 | adapter->phy_timer_pending = false; | 3039 | adapter->phy_timer_pending = false; |
| 3040 | 3040 | ||
| 3041 | INIT_WORK(&adapter->tx_timeout_task, atl1_tx_timeout_task); | 3041 | INIT_WORK(&adapter->reset_dev_task, atl1_reset_dev_task); |
| 3042 | 3042 | ||
| 3043 | INIT_WORK(&adapter->link_chg_task, atlx_link_chg_task); | 3043 | INIT_WORK(&adapter->link_chg_task, atlx_link_chg_task); |
| 3044 | 3044 | ||
| 3045 | INIT_WORK(&adapter->pcie_dma_to_rst_task, atl1_tx_timeout_task); | ||
| 3046 | |||
| 3047 | err = register_netdev(netdev); | 3045 | err = register_netdev(netdev); |
| 3048 | if (err) | 3046 | if (err) |
| 3049 | goto err_common; | 3047 | goto err_common; |
diff --git a/drivers/net/ethernet/atheros/atlx/atl1.h b/drivers/net/ethernet/atheros/atlx/atl1.h index 109d6da8be97..e04bf4d71e46 100644 --- a/drivers/net/ethernet/atheros/atlx/atl1.h +++ b/drivers/net/ethernet/atheros/atlx/atl1.h | |||
| @@ -758,9 +758,8 @@ struct atl1_adapter { | |||
| 758 | u16 link_speed; | 758 | u16 link_speed; |
| 759 | u16 link_duplex; | 759 | u16 link_duplex; |
| 760 | spinlock_t lock; | 760 | spinlock_t lock; |
| 761 | struct work_struct tx_timeout_task; | 761 | struct work_struct reset_dev_task; |
| 762 | struct work_struct link_chg_task; | 762 | struct work_struct link_chg_task; |
| 763 | struct work_struct pcie_dma_to_rst_task; | ||
| 764 | 763 | ||
| 765 | struct timer_list phy_config_timer; | 764 | struct timer_list phy_config_timer; |
| 766 | bool phy_timer_pending; | 765 | bool phy_timer_pending; |
diff --git a/drivers/net/ethernet/atheros/atlx/atlx.c b/drivers/net/ethernet/atheros/atlx/atlx.c index 3cd8837236dc..c9e9dc57986c 100644 --- a/drivers/net/ethernet/atheros/atlx/atlx.c +++ b/drivers/net/ethernet/atheros/atlx/atlx.c | |||
| @@ -194,7 +194,7 @@ static void atlx_tx_timeout(struct net_device *netdev) | |||
| 194 | { | 194 | { |
| 195 | struct atlx_adapter *adapter = netdev_priv(netdev); | 195 | struct atlx_adapter *adapter = netdev_priv(netdev); |
| 196 | /* Do the reset outside of interrupt context */ | 196 | /* Do the reset outside of interrupt context */ |
| 197 | schedule_work(&adapter->tx_timeout_task); | 197 | schedule_work(&adapter->reset_dev_task); |
| 198 | } | 198 | } |
| 199 | 199 | ||
| 200 | /* | 200 | /* |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c index ad95324dc042..64392ec410a3 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c | |||
| @@ -942,6 +942,12 @@ static int bnx2x_ets_e3b0_sp_pri_to_cos_set(const struct link_params *params, | |||
| 942 | const u8 max_num_of_cos = (port) ? DCBX_E3B0_MAX_NUM_COS_PORT1 : | 942 | const u8 max_num_of_cos = (port) ? DCBX_E3B0_MAX_NUM_COS_PORT1 : |
| 943 | DCBX_E3B0_MAX_NUM_COS_PORT0; | 943 | DCBX_E3B0_MAX_NUM_COS_PORT0; |
| 944 | 944 | ||
| 945 | if (pri >= max_num_of_cos) { | ||
| 946 | DP(NETIF_MSG_LINK, "bnx2x_ets_e3b0_sp_pri_to_cos_set invalid " | ||
| 947 | "parameter Illegal strict priority\n"); | ||
| 948 | return -EINVAL; | ||
| 949 | } | ||
| 950 | |||
| 945 | if (sp_pri_to_cos[pri] != DCBX_INVALID_COS) { | 951 | if (sp_pri_to_cos[pri] != DCBX_INVALID_COS) { |
| 946 | DP(NETIF_MSG_LINK, "bnx2x_ets_e3b0_sp_pri_to_cos_set invalid " | 952 | DP(NETIF_MSG_LINK, "bnx2x_ets_e3b0_sp_pri_to_cos_set invalid " |
| 947 | "parameter There can't be two COS's with " | 953 | "parameter There can't be two COS's with " |
| @@ -949,12 +955,6 @@ static int bnx2x_ets_e3b0_sp_pri_to_cos_set(const struct link_params *params, | |||
| 949 | return -EINVAL; | 955 | return -EINVAL; |
| 950 | } | 956 | } |
| 951 | 957 | ||
| 952 | if (pri > max_num_of_cos) { | ||
| 953 | DP(NETIF_MSG_LINK, "bnx2x_ets_e3b0_sp_pri_to_cos_set invalid " | ||
| 954 | "parameter Illegal strict priority\n"); | ||
| 955 | return -EINVAL; | ||
| 956 | } | ||
| 957 | |||
| 958 | sp_pri_to_cos[pri] = cos_entry; | 958 | sp_pri_to_cos[pri] = cos_entry; |
| 959 | return 0; | 959 | return 0; |
| 960 | 960 | ||
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c index 062ac333fde6..ceeab8e852ef 100644 --- a/drivers/net/ethernet/broadcom/tg3.c +++ b/drivers/net/ethernet/broadcom/tg3.c | |||
| @@ -879,8 +879,13 @@ static inline unsigned int tg3_has_work(struct tg3_napi *tnapi) | |||
| 879 | if (sblk->status & SD_STATUS_LINK_CHG) | 879 | if (sblk->status & SD_STATUS_LINK_CHG) |
| 880 | work_exists = 1; | 880 | work_exists = 1; |
| 881 | } | 881 | } |
| 882 | /* check for RX/TX work to do */ | 882 | |
| 883 | if (sblk->idx[0].tx_consumer != tnapi->tx_cons || | 883 | /* check for TX work to do */ |
| 884 | if (sblk->idx[0].tx_consumer != tnapi->tx_cons) | ||
| 885 | work_exists = 1; | ||
| 886 | |||
| 887 | /* check for RX work to do */ | ||
| 888 | if (tnapi->rx_rcb_prod_idx && | ||
| 884 | *(tnapi->rx_rcb_prod_idx) != tnapi->rx_rcb_ptr) | 889 | *(tnapi->rx_rcb_prod_idx) != tnapi->rx_rcb_ptr) |
| 885 | work_exists = 1; | 890 | work_exists = 1; |
| 886 | 891 | ||
| @@ -6124,6 +6129,9 @@ static int tg3_poll_work(struct tg3_napi *tnapi, int work_done, int budget) | |||
| 6124 | return work_done; | 6129 | return work_done; |
| 6125 | } | 6130 | } |
| 6126 | 6131 | ||
| 6132 | if (!tnapi->rx_rcb_prod_idx) | ||
| 6133 | return work_done; | ||
| 6134 | |||
| 6127 | /* run RX thread, within the bounds set by NAPI. | 6135 | /* run RX thread, within the bounds set by NAPI. |
| 6128 | * All RX "locking" is done by ensuring outside | 6136 | * All RX "locking" is done by ensuring outside |
| 6129 | * code synchronizes with tg3->napi.poll() | 6137 | * code synchronizes with tg3->napi.poll() |
| @@ -7567,6 +7575,12 @@ static int tg3_alloc_consistent(struct tg3 *tp) | |||
| 7567 | */ | 7575 | */ |
| 7568 | switch (i) { | 7576 | switch (i) { |
| 7569 | default: | 7577 | default: |
| 7578 | if (tg3_flag(tp, ENABLE_RSS)) { | ||
| 7579 | tnapi->rx_rcb_prod_idx = NULL; | ||
| 7580 | break; | ||
| 7581 | } | ||
| 7582 | /* Fall through */ | ||
| 7583 | case 1: | ||
| 7570 | tnapi->rx_rcb_prod_idx = &sblk->idx[0].rx_producer; | 7584 | tnapi->rx_rcb_prod_idx = &sblk->idx[0].rx_producer; |
| 7571 | break; | 7585 | break; |
| 7572 | case 2: | 7586 | case 2: |
diff --git a/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c b/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c index 63bfdd10bd6d..abb6ce7c1b7e 100644 --- a/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c +++ b/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c | |||
| @@ -1150,6 +1150,48 @@ release_tpsram: | |||
| 1150 | } | 1150 | } |
| 1151 | 1151 | ||
| 1152 | /** | 1152 | /** |
| 1153 | * t3_synchronize_rx - wait for current Rx processing on a port to complete | ||
| 1154 | * @adap: the adapter | ||
| 1155 | * @p: the port | ||
| 1156 | * | ||
| 1157 | * Ensures that current Rx processing on any of the queues associated with | ||
| 1158 | * the given port completes before returning. We do this by acquiring and | ||
| 1159 | * releasing the locks of the response queues associated with the port. | ||
| 1160 | */ | ||
| 1161 | static void t3_synchronize_rx(struct adapter *adap, const struct port_info *p) | ||
| 1162 | { | ||
| 1163 | int i; | ||
| 1164 | |||
| 1165 | for (i = p->first_qset; i < p->first_qset + p->nqsets; i++) { | ||
| 1166 | struct sge_rspq *q = &adap->sge.qs[i].rspq; | ||
| 1167 | |||
| 1168 | spin_lock_irq(&q->lock); | ||
| 1169 | spin_unlock_irq(&q->lock); | ||
| 1170 | } | ||
| 1171 | } | ||
| 1172 | |||
| 1173 | static void cxgb_vlan_mode(struct net_device *dev, netdev_features_t features) | ||
| 1174 | { | ||
| 1175 | struct port_info *pi = netdev_priv(dev); | ||
| 1176 | struct adapter *adapter = pi->adapter; | ||
| 1177 | |||
| 1178 | if (adapter->params.rev > 0) { | ||
| 1179 | t3_set_vlan_accel(adapter, 1 << pi->port_id, | ||
| 1180 | features & NETIF_F_HW_VLAN_RX); | ||
| 1181 | } else { | ||
| 1182 | /* single control for all ports */ | ||
| 1183 | unsigned int i, have_vlans = features & NETIF_F_HW_VLAN_RX; | ||
| 1184 | |||
| 1185 | for_each_port(adapter, i) | ||
| 1186 | have_vlans |= | ||
| 1187 | adapter->port[i]->features & NETIF_F_HW_VLAN_RX; | ||
| 1188 | |||
| 1189 | t3_set_vlan_accel(adapter, 1, have_vlans); | ||
| 1190 | } | ||
| 1191 | t3_synchronize_rx(adapter, pi); | ||
| 1192 | } | ||
| 1193 | |||
| 1194 | /** | ||
| 1153 | * cxgb_up - enable the adapter | 1195 | * cxgb_up - enable the adapter |
| 1154 | * @adapter: adapter being enabled | 1196 | * @adapter: adapter being enabled |
| 1155 | * | 1197 | * |
| @@ -1161,7 +1203,7 @@ release_tpsram: | |||
| 1161 | */ | 1203 | */ |
| 1162 | static int cxgb_up(struct adapter *adap) | 1204 | static int cxgb_up(struct adapter *adap) |
| 1163 | { | 1205 | { |
| 1164 | int err; | 1206 | int i, err; |
| 1165 | 1207 | ||
| 1166 | if (!(adap->flags & FULL_INIT_DONE)) { | 1208 | if (!(adap->flags & FULL_INIT_DONE)) { |
| 1167 | err = t3_check_fw_version(adap); | 1209 | err = t3_check_fw_version(adap); |
| @@ -1198,6 +1240,9 @@ static int cxgb_up(struct adapter *adap) | |||
| 1198 | if (err) | 1240 | if (err) |
| 1199 | goto out; | 1241 | goto out; |
| 1200 | 1242 | ||
| 1243 | for_each_port(adap, i) | ||
| 1244 | cxgb_vlan_mode(adap->port[i], adap->port[i]->features); | ||
| 1245 | |||
| 1201 | setup_rss(adap); | 1246 | setup_rss(adap); |
| 1202 | if (!(adap->flags & NAPI_INIT)) | 1247 | if (!(adap->flags & NAPI_INIT)) |
| 1203 | init_napi(adap); | 1248 | init_napi(adap); |
| @@ -2508,48 +2553,6 @@ static int cxgb_set_mac_addr(struct net_device *dev, void *p) | |||
| 2508 | return 0; | 2553 | return 0; |
| 2509 | } | 2554 | } |
| 2510 | 2555 | ||
| 2511 | /** | ||
| 2512 | * t3_synchronize_rx - wait for current Rx processing on a port to complete | ||
| 2513 | * @adap: the adapter | ||
| 2514 | * @p: the port | ||
| 2515 | * | ||
| 2516 | * Ensures that current Rx processing on any of the queues associated with | ||
| 2517 | * the given port completes before returning. We do this by acquiring and | ||
| 2518 | * releasing the locks of the response queues associated with the port. | ||
| 2519 | */ | ||
| 2520 | static void t3_synchronize_rx(struct adapter *adap, const struct port_info *p) | ||
| 2521 | { | ||
| 2522 | int i; | ||
| 2523 | |||
| 2524 | for (i = p->first_qset; i < p->first_qset + p->nqsets; i++) { | ||
| 2525 | struct sge_rspq *q = &adap->sge.qs[i].rspq; | ||
| 2526 | |||
| 2527 | spin_lock_irq(&q->lock); | ||
| 2528 | spin_unlock_irq(&q->lock); | ||
| 2529 | } | ||
| 2530 | } | ||
| 2531 | |||
| 2532 | static void cxgb_vlan_mode(struct net_device *dev, netdev_features_t features) | ||
| 2533 | { | ||
| 2534 | struct port_info *pi = netdev_priv(dev); | ||
| 2535 | struct adapter *adapter = pi->adapter; | ||
| 2536 | |||
| 2537 | if (adapter->params.rev > 0) { | ||
| 2538 | t3_set_vlan_accel(adapter, 1 << pi->port_id, | ||
| 2539 | features & NETIF_F_HW_VLAN_RX); | ||
| 2540 | } else { | ||
| 2541 | /* single control for all ports */ | ||
| 2542 | unsigned int i, have_vlans = features & NETIF_F_HW_VLAN_RX; | ||
| 2543 | |||
| 2544 | for_each_port(adapter, i) | ||
| 2545 | have_vlans |= | ||
| 2546 | adapter->port[i]->features & NETIF_F_HW_VLAN_RX; | ||
| 2547 | |||
| 2548 | t3_set_vlan_accel(adapter, 1, have_vlans); | ||
| 2549 | } | ||
| 2550 | t3_synchronize_rx(adapter, pi); | ||
| 2551 | } | ||
| 2552 | |||
| 2553 | static netdev_features_t cxgb_fix_features(struct net_device *dev, | 2556 | static netdev_features_t cxgb_fix_features(struct net_device *dev, |
| 2554 | netdev_features_t features) | 2557 | netdev_features_t features) |
| 2555 | { | 2558 | { |
| @@ -3353,9 +3356,6 @@ static int __devinit init_one(struct pci_dev *pdev, | |||
| 3353 | err = sysfs_create_group(&adapter->port[0]->dev.kobj, | 3356 | err = sysfs_create_group(&adapter->port[0]->dev.kobj, |
| 3354 | &cxgb3_attr_group); | 3357 | &cxgb3_attr_group); |
| 3355 | 3358 | ||
| 3356 | for_each_port(adapter, i) | ||
| 3357 | cxgb_vlan_mode(adapter->port[i], adapter->port[i]->features); | ||
| 3358 | |||
| 3359 | print_port_info(adapter, ai); | 3359 | print_port_info(adapter, ai); |
| 3360 | return 0; | 3360 | return 0; |
| 3361 | 3361 | ||
diff --git a/drivers/net/ethernet/dlink/dl2k.c b/drivers/net/ethernet/dlink/dl2k.c index b2dc2c81a147..2e09edb9cdf8 100644 --- a/drivers/net/ethernet/dlink/dl2k.c +++ b/drivers/net/ethernet/dlink/dl2k.c | |||
| @@ -1259,55 +1259,21 @@ rio_ioctl (struct net_device *dev, struct ifreq *rq, int cmd) | |||
| 1259 | { | 1259 | { |
| 1260 | int phy_addr; | 1260 | int phy_addr; |
| 1261 | struct netdev_private *np = netdev_priv(dev); | 1261 | struct netdev_private *np = netdev_priv(dev); |
| 1262 | struct mii_data *miidata = (struct mii_data *) &rq->ifr_ifru; | 1262 | struct mii_ioctl_data *miidata = if_mii(rq); |
| 1263 | |||
| 1264 | struct netdev_desc *desc; | ||
| 1265 | int i; | ||
| 1266 | 1263 | ||
| 1267 | phy_addr = np->phy_addr; | 1264 | phy_addr = np->phy_addr; |
| 1268 | switch (cmd) { | 1265 | switch (cmd) { |
| 1269 | case SIOCDEVPRIVATE: | 1266 | case SIOCGMIIPHY: |
| 1270 | break; | 1267 | miidata->phy_id = phy_addr; |
| 1271 | |||
| 1272 | case SIOCDEVPRIVATE + 1: | ||
| 1273 | miidata->out_value = mii_read (dev, phy_addr, miidata->reg_num); | ||
| 1274 | break; | 1268 | break; |
| 1275 | case SIOCDEVPRIVATE + 2: | 1269 | case SIOCGMIIREG: |
| 1276 | mii_write (dev, phy_addr, miidata->reg_num, miidata->in_value); | 1270 | miidata->val_out = mii_read (dev, phy_addr, miidata->reg_num); |
| 1277 | break; | 1271 | break; |
| 1278 | case SIOCDEVPRIVATE + 3: | 1272 | case SIOCSMIIREG: |
| 1279 | break; | 1273 | if (!capable(CAP_NET_ADMIN)) |
| 1280 | case SIOCDEVPRIVATE + 4: | 1274 | return -EPERM; |
| 1281 | break; | 1275 | mii_write (dev, phy_addr, miidata->reg_num, miidata->val_in); |
| 1282 | case SIOCDEVPRIVATE + 5: | ||
| 1283 | netif_stop_queue (dev); | ||
| 1284 | break; | 1276 | break; |
| 1285 | case SIOCDEVPRIVATE + 6: | ||
| 1286 | netif_wake_queue (dev); | ||
| 1287 | break; | ||
| 1288 | case SIOCDEVPRIVATE + 7: | ||
| 1289 | printk | ||
| 1290 | ("tx_full=%x cur_tx=%lx old_tx=%lx cur_rx=%lx old_rx=%lx\n", | ||
| 1291 | netif_queue_stopped(dev), np->cur_tx, np->old_tx, np->cur_rx, | ||
| 1292 | np->old_rx); | ||
| 1293 | break; | ||
| 1294 | case SIOCDEVPRIVATE + 8: | ||
| 1295 | printk("TX ring:\n"); | ||
| 1296 | for (i = 0; i < TX_RING_SIZE; i++) { | ||
| 1297 | desc = &np->tx_ring[i]; | ||
| 1298 | printk | ||
| 1299 | ("%02x:cur:%08x next:%08x status:%08x frag1:%08x frag0:%08x", | ||
| 1300 | i, | ||
| 1301 | (u32) (np->tx_ring_dma + i * sizeof (*desc)), | ||
| 1302 | (u32)le64_to_cpu(desc->next_desc), | ||
| 1303 | (u32)le64_to_cpu(desc->status), | ||
| 1304 | (u32)(le64_to_cpu(desc->fraginfo) >> 32), | ||
| 1305 | (u32)le64_to_cpu(desc->fraginfo)); | ||
| 1306 | printk ("\n"); | ||
| 1307 | } | ||
| 1308 | printk ("\n"); | ||
| 1309 | break; | ||
| 1310 | |||
| 1311 | default: | 1277 | default: |
| 1312 | return -EOPNOTSUPP; | 1278 | return -EOPNOTSUPP; |
| 1313 | } | 1279 | } |
diff --git a/drivers/net/ethernet/dlink/dl2k.h b/drivers/net/ethernet/dlink/dl2k.h index ba0adcafa55a..30c2da3de548 100644 --- a/drivers/net/ethernet/dlink/dl2k.h +++ b/drivers/net/ethernet/dlink/dl2k.h | |||
| @@ -365,13 +365,6 @@ struct ioctl_data { | |||
| 365 | char *data; | 365 | char *data; |
| 366 | }; | 366 | }; |
| 367 | 367 | ||
| 368 | struct mii_data { | ||
| 369 | __u16 reserved; | ||
| 370 | __u16 reg_num; | ||
| 371 | __u16 in_value; | ||
| 372 | __u16 out_value; | ||
| 373 | }; | ||
| 374 | |||
| 375 | /* The Rx and Tx buffer descriptors. */ | 368 | /* The Rx and Tx buffer descriptors. */ |
| 376 | struct netdev_desc { | 369 | struct netdev_desc { |
| 377 | __le64 next_desc; | 370 | __le64 next_desc; |
diff --git a/drivers/net/ethernet/freescale/ucc_geth.c b/drivers/net/ethernet/freescale/ucc_geth.c index 17a46e76123f..9ac14f804851 100644 --- a/drivers/net/ethernet/freescale/ucc_geth.c +++ b/drivers/net/ethernet/freescale/ucc_geth.c | |||
| @@ -116,10 +116,10 @@ static struct ucc_geth_info ugeth_primary_info = { | |||
| 116 | .maxGroupAddrInHash = 4, | 116 | .maxGroupAddrInHash = 4, |
| 117 | .maxIndAddrInHash = 4, | 117 | .maxIndAddrInHash = 4, |
| 118 | .prel = 7, | 118 | .prel = 7, |
| 119 | .maxFrameLength = 1518, | 119 | .maxFrameLength = 1518+16, /* Add extra bytes for VLANs etc. */ |
| 120 | .minFrameLength = 64, | 120 | .minFrameLength = 64, |
| 121 | .maxD1Length = 1520, | 121 | .maxD1Length = 1520+16, /* Add extra bytes for VLANs etc. */ |
| 122 | .maxD2Length = 1520, | 122 | .maxD2Length = 1520+16, /* Add extra bytes for VLANs etc. */ |
| 123 | .vlantype = 0x8100, | 123 | .vlantype = 0x8100, |
| 124 | .ecamptr = ((uint32_t) NULL), | 124 | .ecamptr = ((uint32_t) NULL), |
| 125 | .eventRegMask = UCCE_OTHER, | 125 | .eventRegMask = UCCE_OTHER, |
diff --git a/drivers/net/ethernet/freescale/ucc_geth.h b/drivers/net/ethernet/freescale/ucc_geth.h index 2e395a2566b8..f71b3e7b12de 100644 --- a/drivers/net/ethernet/freescale/ucc_geth.h +++ b/drivers/net/ethernet/freescale/ucc_geth.h | |||
| @@ -877,7 +877,7 @@ struct ucc_geth_hardware_statistics { | |||
| 877 | 877 | ||
| 878 | /* Driver definitions */ | 878 | /* Driver definitions */ |
| 879 | #define TX_BD_RING_LEN 0x10 | 879 | #define TX_BD_RING_LEN 0x10 |
| 880 | #define RX_BD_RING_LEN 0x10 | 880 | #define RX_BD_RING_LEN 0x20 |
| 881 | 881 | ||
| 882 | #define TX_RING_MOD_MASK(size) (size-1) | 882 | #define TX_RING_MOD_MASK(size) (size-1) |
| 883 | #define RX_RING_MOD_MASK(size) (size-1) | 883 | #define RX_RING_MOD_MASK(size) (size-1) |
diff --git a/drivers/net/ethernet/ibm/ehea/ehea_main.c b/drivers/net/ethernet/ibm/ehea/ehea_main.c index 3516e17a399d..c9069a28832b 100644 --- a/drivers/net/ethernet/ibm/ehea/ehea_main.c +++ b/drivers/net/ethernet/ibm/ehea/ehea_main.c | |||
| @@ -290,16 +290,18 @@ static void ehea_update_bcmc_registrations(void) | |||
| 290 | 290 | ||
| 291 | arr[i].adh = adapter->handle; | 291 | arr[i].adh = adapter->handle; |
| 292 | arr[i].port_id = port->logical_port_id; | 292 | arr[i].port_id = port->logical_port_id; |
| 293 | arr[i].reg_type = EHEA_BCMC_SCOPE_ALL | | 293 | arr[i].reg_type = EHEA_BCMC_MULTICAST | |
| 294 | EHEA_BCMC_MULTICAST | | ||
| 295 | EHEA_BCMC_UNTAGGED; | 294 | EHEA_BCMC_UNTAGGED; |
| 295 | if (mc_entry->macaddr == 0) | ||
| 296 | arr[i].reg_type |= EHEA_BCMC_SCOPE_ALL; | ||
| 296 | arr[i++].macaddr = mc_entry->macaddr; | 297 | arr[i++].macaddr = mc_entry->macaddr; |
| 297 | 298 | ||
| 298 | arr[i].adh = adapter->handle; | 299 | arr[i].adh = adapter->handle; |
| 299 | arr[i].port_id = port->logical_port_id; | 300 | arr[i].port_id = port->logical_port_id; |
| 300 | arr[i].reg_type = EHEA_BCMC_SCOPE_ALL | | 301 | arr[i].reg_type = EHEA_BCMC_MULTICAST | |
| 301 | EHEA_BCMC_MULTICAST | | ||
| 302 | EHEA_BCMC_VLANID_ALL; | 302 | EHEA_BCMC_VLANID_ALL; |
| 303 | if (mc_entry->macaddr == 0) | ||
| 304 | arr[i].reg_type |= EHEA_BCMC_SCOPE_ALL; | ||
| 303 | arr[i++].macaddr = mc_entry->macaddr; | 305 | arr[i++].macaddr = mc_entry->macaddr; |
| 304 | num_registrations -= 2; | 306 | num_registrations -= 2; |
| 305 | } | 307 | } |
| @@ -1838,8 +1840,9 @@ static u64 ehea_multicast_reg_helper(struct ehea_port *port, u64 mc_mac_addr, | |||
| 1838 | u64 hret; | 1840 | u64 hret; |
| 1839 | u8 reg_type; | 1841 | u8 reg_type; |
| 1840 | 1842 | ||
| 1841 | reg_type = EHEA_BCMC_SCOPE_ALL | EHEA_BCMC_MULTICAST | 1843 | reg_type = EHEA_BCMC_MULTICAST | EHEA_BCMC_UNTAGGED; |
| 1842 | | EHEA_BCMC_UNTAGGED; | 1844 | if (mc_mac_addr == 0) |
| 1845 | reg_type |= EHEA_BCMC_SCOPE_ALL; | ||
| 1843 | 1846 | ||
| 1844 | hret = ehea_h_reg_dereg_bcmc(port->adapter->handle, | 1847 | hret = ehea_h_reg_dereg_bcmc(port->adapter->handle, |
| 1845 | port->logical_port_id, | 1848 | port->logical_port_id, |
| @@ -1847,8 +1850,9 @@ static u64 ehea_multicast_reg_helper(struct ehea_port *port, u64 mc_mac_addr, | |||
| 1847 | if (hret) | 1850 | if (hret) |
| 1848 | goto out; | 1851 | goto out; |
| 1849 | 1852 | ||
| 1850 | reg_type = EHEA_BCMC_SCOPE_ALL | EHEA_BCMC_MULTICAST | 1853 | reg_type = EHEA_BCMC_MULTICAST | EHEA_BCMC_VLANID_ALL; |
| 1851 | | EHEA_BCMC_VLANID_ALL; | 1854 | if (mc_mac_addr == 0) |
| 1855 | reg_type |= EHEA_BCMC_SCOPE_ALL; | ||
| 1852 | 1856 | ||
| 1853 | hret = ehea_h_reg_dereg_bcmc(port->adapter->handle, | 1857 | hret = ehea_h_reg_dereg_bcmc(port->adapter->handle, |
| 1854 | port->logical_port_id, | 1858 | port->logical_port_id, |
| @@ -1898,7 +1902,7 @@ static void ehea_allmulti(struct net_device *dev, int enable) | |||
| 1898 | netdev_err(dev, | 1902 | netdev_err(dev, |
| 1899 | "failed enabling IFF_ALLMULTI\n"); | 1903 | "failed enabling IFF_ALLMULTI\n"); |
| 1900 | } | 1904 | } |
| 1901 | } else | 1905 | } else { |
| 1902 | if (!enable) { | 1906 | if (!enable) { |
| 1903 | /* Disable ALLMULTI */ | 1907 | /* Disable ALLMULTI */ |
| 1904 | hret = ehea_multicast_reg_helper(port, 0, H_DEREG_BCMC); | 1908 | hret = ehea_multicast_reg_helper(port, 0, H_DEREG_BCMC); |
| @@ -1908,6 +1912,7 @@ static void ehea_allmulti(struct net_device *dev, int enable) | |||
| 1908 | netdev_err(dev, | 1912 | netdev_err(dev, |
| 1909 | "failed disabling IFF_ALLMULTI\n"); | 1913 | "failed disabling IFF_ALLMULTI\n"); |
| 1910 | } | 1914 | } |
| 1915 | } | ||
| 1911 | } | 1916 | } |
| 1912 | 1917 | ||
| 1913 | static void ehea_add_multicast_entry(struct ehea_port *port, u8 *mc_mac_addr) | 1918 | static void ehea_add_multicast_entry(struct ehea_port *port, u8 *mc_mac_addr) |
| @@ -1941,11 +1946,7 @@ static void ehea_set_multicast_list(struct net_device *dev) | |||
| 1941 | struct netdev_hw_addr *ha; | 1946 | struct netdev_hw_addr *ha; |
| 1942 | int ret; | 1947 | int ret; |
| 1943 | 1948 | ||
| 1944 | if (port->promisc) { | 1949 | ehea_promiscuous(dev, !!(dev->flags & IFF_PROMISC)); |
| 1945 | ehea_promiscuous(dev, 1); | ||
| 1946 | return; | ||
| 1947 | } | ||
| 1948 | ehea_promiscuous(dev, 0); | ||
| 1949 | 1950 | ||
| 1950 | if (dev->flags & IFF_ALLMULTI) { | 1951 | if (dev->flags & IFF_ALLMULTI) { |
| 1951 | ehea_allmulti(dev, 1); | 1952 | ehea_allmulti(dev, 1); |
| @@ -2463,6 +2464,7 @@ static int ehea_down(struct net_device *dev) | |||
| 2463 | return 0; | 2464 | return 0; |
| 2464 | 2465 | ||
| 2465 | ehea_drop_multicast_list(dev); | 2466 | ehea_drop_multicast_list(dev); |
| 2467 | ehea_allmulti(dev, 0); | ||
| 2466 | ehea_broadcast_reg_helper(port, H_DEREG_BCMC); | 2468 | ehea_broadcast_reg_helper(port, H_DEREG_BCMC); |
| 2467 | 2469 | ||
| 2468 | ehea_free_interrupts(dev); | 2470 | ehea_free_interrupts(dev); |
| @@ -3261,6 +3263,7 @@ static int __devinit ehea_probe_adapter(struct platform_device *dev, | |||
| 3261 | struct ehea_adapter *adapter; | 3263 | struct ehea_adapter *adapter; |
| 3262 | const u64 *adapter_handle; | 3264 | const u64 *adapter_handle; |
| 3263 | int ret; | 3265 | int ret; |
| 3266 | int i; | ||
| 3264 | 3267 | ||
| 3265 | if (!dev || !dev->dev.of_node) { | 3268 | if (!dev || !dev->dev.of_node) { |
| 3266 | pr_err("Invalid ibmebus device probed\n"); | 3269 | pr_err("Invalid ibmebus device probed\n"); |
| @@ -3314,17 +3317,9 @@ static int __devinit ehea_probe_adapter(struct platform_device *dev, | |||
| 3314 | tasklet_init(&adapter->neq_tasklet, ehea_neq_tasklet, | 3317 | tasklet_init(&adapter->neq_tasklet, ehea_neq_tasklet, |
| 3315 | (unsigned long)adapter); | 3318 | (unsigned long)adapter); |
| 3316 | 3319 | ||
| 3317 | ret = ibmebus_request_irq(adapter->neq->attr.ist1, | ||
| 3318 | ehea_interrupt_neq, IRQF_DISABLED, | ||
| 3319 | "ehea_neq", adapter); | ||
| 3320 | if (ret) { | ||
| 3321 | dev_err(&dev->dev, "requesting NEQ IRQ failed\n"); | ||
| 3322 | goto out_kill_eq; | ||
| 3323 | } | ||
| 3324 | |||
| 3325 | ret = ehea_create_device_sysfs(dev); | 3320 | ret = ehea_create_device_sysfs(dev); |
| 3326 | if (ret) | 3321 | if (ret) |
| 3327 | goto out_free_irq; | 3322 | goto out_kill_eq; |
| 3328 | 3323 | ||
| 3329 | ret = ehea_setup_ports(adapter); | 3324 | ret = ehea_setup_ports(adapter); |
| 3330 | if (ret) { | 3325 | if (ret) { |
| @@ -3332,15 +3327,28 @@ static int __devinit ehea_probe_adapter(struct platform_device *dev, | |||
| 3332 | goto out_rem_dev_sysfs; | 3327 | goto out_rem_dev_sysfs; |
| 3333 | } | 3328 | } |
| 3334 | 3329 | ||
| 3330 | ret = ibmebus_request_irq(adapter->neq->attr.ist1, | ||
| 3331 | ehea_interrupt_neq, IRQF_DISABLED, | ||
| 3332 | "ehea_neq", adapter); | ||
| 3333 | if (ret) { | ||
| 3334 | dev_err(&dev->dev, "requesting NEQ IRQ failed\n"); | ||
| 3335 | goto out_shutdown_ports; | ||
| 3336 | } | ||
| 3337 | |||
| 3338 | |||
| 3335 | ret = 0; | 3339 | ret = 0; |
| 3336 | goto out; | 3340 | goto out; |
| 3337 | 3341 | ||
| 3342 | out_shutdown_ports: | ||
| 3343 | for (i = 0; i < EHEA_MAX_PORTS; i++) | ||
| 3344 | if (adapter->port[i]) { | ||
| 3345 | ehea_shutdown_single_port(adapter->port[i]); | ||
| 3346 | adapter->port[i] = NULL; | ||
| 3347 | } | ||
| 3348 | |||
| 3338 | out_rem_dev_sysfs: | 3349 | out_rem_dev_sysfs: |
| 3339 | ehea_remove_device_sysfs(dev); | 3350 | ehea_remove_device_sysfs(dev); |
| 3340 | 3351 | ||
| 3341 | out_free_irq: | ||
| 3342 | ibmebus_free_irq(adapter->neq->attr.ist1, adapter); | ||
| 3343 | |||
| 3344 | out_kill_eq: | 3352 | out_kill_eq: |
| 3345 | ehea_destroy_eq(adapter->neq); | 3353 | ehea_destroy_eq(adapter->neq); |
| 3346 | 3354 | ||
diff --git a/drivers/net/ethernet/ibm/ehea/ehea_phyp.h b/drivers/net/ethernet/ibm/ehea/ehea_phyp.h index 52c456ec4d6c..8364815c32ff 100644 --- a/drivers/net/ethernet/ibm/ehea/ehea_phyp.h +++ b/drivers/net/ethernet/ibm/ehea/ehea_phyp.h | |||
| @@ -450,7 +450,7 @@ u64 ehea_h_modify_ehea_port(const u64 adapter_handle, const u16 port_num, | |||
| 450 | void *cb_addr); | 450 | void *cb_addr); |
| 451 | 451 | ||
| 452 | #define H_REGBCMC_PN EHEA_BMASK_IBM(48, 63) | 452 | #define H_REGBCMC_PN EHEA_BMASK_IBM(48, 63) |
| 453 | #define H_REGBCMC_REGTYPE EHEA_BMASK_IBM(61, 63) | 453 | #define H_REGBCMC_REGTYPE EHEA_BMASK_IBM(60, 63) |
| 454 | #define H_REGBCMC_MACADDR EHEA_BMASK_IBM(16, 63) | 454 | #define H_REGBCMC_MACADDR EHEA_BMASK_IBM(16, 63) |
| 455 | #define H_REGBCMC_VLANID EHEA_BMASK_IBM(52, 63) | 455 | #define H_REGBCMC_VLANID EHEA_BMASK_IBM(52, 63) |
| 456 | 456 | ||
diff --git a/drivers/net/ethernet/intel/e1000e/ich8lan.c b/drivers/net/ethernet/intel/e1000e/ich8lan.c index 64c76443a7aa..b461c24945e3 100644 --- a/drivers/net/ethernet/intel/e1000e/ich8lan.c +++ b/drivers/net/ethernet/intel/e1000e/ich8lan.c | |||
| @@ -1310,10 +1310,6 @@ static s32 e1000_oem_bits_config_ich8lan(struct e1000_hw *hw, bool d0_state) | |||
| 1310 | 1310 | ||
| 1311 | if (mac_reg & E1000_PHY_CTRL_D0A_LPLU) | 1311 | if (mac_reg & E1000_PHY_CTRL_D0A_LPLU) |
| 1312 | oem_reg |= HV_OEM_BITS_LPLU; | 1312 | oem_reg |= HV_OEM_BITS_LPLU; |
| 1313 | |||
| 1314 | /* Set Restart auto-neg to activate the bits */ | ||
| 1315 | if (!hw->phy.ops.check_reset_block(hw)) | ||
| 1316 | oem_reg |= HV_OEM_BITS_RESTART_AN; | ||
| 1317 | } else { | 1313 | } else { |
| 1318 | if (mac_reg & (E1000_PHY_CTRL_GBE_DISABLE | | 1314 | if (mac_reg & (E1000_PHY_CTRL_GBE_DISABLE | |
| 1319 | E1000_PHY_CTRL_NOND0A_GBE_DISABLE)) | 1315 | E1000_PHY_CTRL_NOND0A_GBE_DISABLE)) |
| @@ -1324,6 +1320,11 @@ static s32 e1000_oem_bits_config_ich8lan(struct e1000_hw *hw, bool d0_state) | |||
| 1324 | oem_reg |= HV_OEM_BITS_LPLU; | 1320 | oem_reg |= HV_OEM_BITS_LPLU; |
| 1325 | } | 1321 | } |
| 1326 | 1322 | ||
| 1323 | /* Set Restart auto-neg to activate the bits */ | ||
| 1324 | if ((d0_state || (hw->mac.type != e1000_pchlan)) && | ||
| 1325 | !hw->phy.ops.check_reset_block(hw)) | ||
| 1326 | oem_reg |= HV_OEM_BITS_RESTART_AN; | ||
| 1327 | |||
| 1327 | ret_val = hw->phy.ops.write_reg_locked(hw, HV_OEM_BITS, oem_reg); | 1328 | ret_val = hw->phy.ops.write_reg_locked(hw, HV_OEM_BITS, oem_reg); |
| 1328 | 1329 | ||
| 1329 | release: | 1330 | release: |
| @@ -3682,7 +3683,11 @@ void e1000_suspend_workarounds_ich8lan(struct e1000_hw *hw) | |||
| 3682 | 3683 | ||
| 3683 | if (hw->mac.type >= e1000_pchlan) { | 3684 | if (hw->mac.type >= e1000_pchlan) { |
| 3684 | e1000_oem_bits_config_ich8lan(hw, false); | 3685 | e1000_oem_bits_config_ich8lan(hw, false); |
| 3685 | e1000_phy_hw_reset_ich8lan(hw); | 3686 | |
| 3687 | /* Reset PHY to activate OEM bits on 82577/8 */ | ||
| 3688 | if (hw->mac.type == e1000_pchlan) | ||
| 3689 | e1000e_phy_hw_reset_generic(hw); | ||
| 3690 | |||
| 3686 | ret_val = hw->phy.ops.acquire(hw); | 3691 | ret_val = hw->phy.ops.acquire(hw); |
| 3687 | if (ret_val) | 3692 | if (ret_val) |
| 3688 | return; | 3693 | return; |
diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c index 19ab2154802c..9520a6ac1f30 100644 --- a/drivers/net/ethernet/intel/e1000e/netdev.c +++ b/drivers/net/ethernet/intel/e1000e/netdev.c | |||
| @@ -3799,7 +3799,7 @@ static int e1000_test_msi_interrupt(struct e1000_adapter *adapter) | |||
| 3799 | /* fire an unusual interrupt on the test handler */ | 3799 | /* fire an unusual interrupt on the test handler */ |
| 3800 | ew32(ICS, E1000_ICS_RXSEQ); | 3800 | ew32(ICS, E1000_ICS_RXSEQ); |
| 3801 | e1e_flush(); | 3801 | e1e_flush(); |
| 3802 | msleep(50); | 3802 | msleep(100); |
| 3803 | 3803 | ||
| 3804 | e1000_irq_disable(adapter); | 3804 | e1000_irq_disable(adapter); |
| 3805 | 3805 | ||
diff --git a/drivers/net/ethernet/intel/e1000e/param.c b/drivers/net/ethernet/intel/e1000e/param.c index ff796e42c3eb..16adeb9418a8 100644 --- a/drivers/net/ethernet/intel/e1000e/param.c +++ b/drivers/net/ethernet/intel/e1000e/param.c | |||
| @@ -106,7 +106,7 @@ E1000_PARAM(RxAbsIntDelay, "Receive Absolute Interrupt Delay"); | |||
| 106 | /* | 106 | /* |
| 107 | * Interrupt Throttle Rate (interrupts/sec) | 107 | * Interrupt Throttle Rate (interrupts/sec) |
| 108 | * | 108 | * |
| 109 | * Valid Range: 100-100000 (0=off, 1=dynamic, 3=dynamic conservative) | 109 | * Valid Range: 100-100000 or one of: 0=off, 1=dynamic, 3=dynamic conservative |
| 110 | */ | 110 | */ |
| 111 | E1000_PARAM(InterruptThrottleRate, "Interrupt Throttling Rate"); | 111 | E1000_PARAM(InterruptThrottleRate, "Interrupt Throttling Rate"); |
| 112 | #define DEFAULT_ITR 3 | 112 | #define DEFAULT_ITR 3 |
| @@ -344,53 +344,60 @@ void __devinit e1000e_check_options(struct e1000_adapter *adapter) | |||
| 344 | 344 | ||
| 345 | if (num_InterruptThrottleRate > bd) { | 345 | if (num_InterruptThrottleRate > bd) { |
| 346 | adapter->itr = InterruptThrottleRate[bd]; | 346 | adapter->itr = InterruptThrottleRate[bd]; |
| 347 | switch (adapter->itr) { | 347 | |
| 348 | case 0: | 348 | /* |
| 349 | e_info("%s turned off\n", opt.name); | 349 | * Make sure a message is printed for non-special |
| 350 | break; | 350 | * values. And in case of an invalid option, display |
| 351 | case 1: | 351 | * warning, use default and got through itr/itr_setting |
| 352 | e_info("%s set to dynamic mode\n", opt.name); | 352 | * adjustment logic below |
| 353 | adapter->itr_setting = adapter->itr; | 353 | */ |
| 354 | adapter->itr = 20000; | 354 | if ((adapter->itr > 4) && |
| 355 | break; | 355 | e1000_validate_option(&adapter->itr, &opt, adapter)) |
| 356 | case 3: | 356 | adapter->itr = opt.def; |
| 357 | e_info("%s set to dynamic conservative mode\n", | ||
| 358 | opt.name); | ||
| 359 | adapter->itr_setting = adapter->itr; | ||
| 360 | adapter->itr = 20000; | ||
| 361 | break; | ||
| 362 | case 4: | ||
| 363 | e_info("%s set to simplified (2000-8000 ints) " | ||
| 364 | "mode\n", opt.name); | ||
| 365 | adapter->itr_setting = 4; | ||
| 366 | break; | ||
| 367 | default: | ||
| 368 | /* | ||
| 369 | * Save the setting, because the dynamic bits | ||
| 370 | * change itr. | ||
| 371 | */ | ||
| 372 | if (e1000_validate_option(&adapter->itr, &opt, | ||
| 373 | adapter) && | ||
| 374 | (adapter->itr == 3)) { | ||
| 375 | /* | ||
| 376 | * In case of invalid user value, | ||
| 377 | * default to conservative mode. | ||
| 378 | */ | ||
| 379 | adapter->itr_setting = adapter->itr; | ||
| 380 | adapter->itr = 20000; | ||
| 381 | } else { | ||
| 382 | /* | ||
| 383 | * Clear the lower two bits because | ||
| 384 | * they are used as control. | ||
| 385 | */ | ||
| 386 | adapter->itr_setting = | ||
| 387 | adapter->itr & ~3; | ||
| 388 | } | ||
| 389 | break; | ||
| 390 | } | ||
| 391 | } else { | 357 | } else { |
| 392 | adapter->itr_setting = opt.def; | 358 | /* |
| 359 | * If no option specified, use default value and go | ||
| 360 | * through the logic below to adjust itr/itr_setting | ||
| 361 | */ | ||
| 362 | adapter->itr = opt.def; | ||
| 363 | |||
| 364 | /* | ||
| 365 | * Make sure a message is printed for non-special | ||
| 366 | * default values | ||
| 367 | */ | ||
| 368 | if (adapter->itr > 40) | ||
| 369 | e_info("%s set to default %d\n", opt.name, | ||
| 370 | adapter->itr); | ||
| 371 | } | ||
| 372 | |||
| 373 | adapter->itr_setting = adapter->itr; | ||
| 374 | switch (adapter->itr) { | ||
| 375 | case 0: | ||
| 376 | e_info("%s turned off\n", opt.name); | ||
| 377 | break; | ||
| 378 | case 1: | ||
| 379 | e_info("%s set to dynamic mode\n", opt.name); | ||
| 380 | adapter->itr = 20000; | ||
| 381 | break; | ||
| 382 | case 3: | ||
| 383 | e_info("%s set to dynamic conservative mode\n", | ||
| 384 | opt.name); | ||
| 393 | adapter->itr = 20000; | 385 | adapter->itr = 20000; |
| 386 | break; | ||
| 387 | case 4: | ||
| 388 | e_info("%s set to simplified (2000-8000 ints) mode\n", | ||
| 389 | opt.name); | ||
| 390 | break; | ||
| 391 | default: | ||
| 392 | /* | ||
| 393 | * Save the setting, because the dynamic bits | ||
| 394 | * change itr. | ||
| 395 | * | ||
| 396 | * Clear the lower two bits because | ||
| 397 | * they are used as control. | ||
| 398 | */ | ||
| 399 | adapter->itr_setting &= ~3; | ||
| 400 | break; | ||
| 394 | } | 401 | } |
| 395 | } | 402 | } |
| 396 | { /* Interrupt Mode */ | 403 | { /* Interrupt Mode */ |
diff --git a/drivers/net/ethernet/intel/igbvf/netdev.c b/drivers/net/ethernet/intel/igbvf/netdev.c index d61ca2a732f0..8ec74b07f940 100644 --- a/drivers/net/ethernet/intel/igbvf/netdev.c +++ b/drivers/net/ethernet/intel/igbvf/netdev.c | |||
| @@ -2731,14 +2731,14 @@ static int __devinit igbvf_probe(struct pci_dev *pdev, | |||
| 2731 | netdev->addr_len); | 2731 | netdev->addr_len); |
| 2732 | } | 2732 | } |
| 2733 | 2733 | ||
| 2734 | if (!is_valid_ether_addr(netdev->perm_addr)) { | 2734 | if (!is_valid_ether_addr(netdev->dev_addr)) { |
| 2735 | dev_err(&pdev->dev, "Invalid MAC Address: %pM\n", | 2735 | dev_err(&pdev->dev, "Invalid MAC Address: %pM\n", |
| 2736 | netdev->dev_addr); | 2736 | netdev->dev_addr); |
| 2737 | err = -EIO; | 2737 | err = -EIO; |
| 2738 | goto err_hw_init; | 2738 | goto err_hw_init; |
| 2739 | } | 2739 | } |
| 2740 | 2740 | ||
| 2741 | memcpy(netdev->perm_addr, adapter->hw.mac.addr, netdev->addr_len); | 2741 | memcpy(netdev->perm_addr, netdev->dev_addr, netdev->addr_len); |
| 2742 | 2742 | ||
| 2743 | setup_timer(&adapter->watchdog_timer, &igbvf_watchdog, | 2743 | setup_timer(&adapter->watchdog_timer, &igbvf_watchdog, |
| 2744 | (unsigned long) adapter); | 2744 | (unsigned long) adapter); |
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_fcoe.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_fcoe.c index 77ea4b716535..bc07933d67da 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_fcoe.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_fcoe.c | |||
| @@ -437,6 +437,7 @@ int ixgbe_fcoe_ddp(struct ixgbe_adapter *adapter, | |||
| 437 | */ | 437 | */ |
| 438 | if ((fh->fh_r_ctl == FC_RCTL_DD_SOL_DATA) && | 438 | if ((fh->fh_r_ctl == FC_RCTL_DD_SOL_DATA) && |
| 439 | (fctl & FC_FC_END_SEQ)) { | 439 | (fctl & FC_FC_END_SEQ)) { |
| 440 | skb_linearize(skb); | ||
| 440 | crc = (struct fcoe_crc_eof *)skb_put(skb, sizeof(*crc)); | 441 | crc = (struct fcoe_crc_eof *)skb_put(skb, sizeof(*crc)); |
| 441 | crc->fcoe_eof = FC_EOF_T; | 442 | crc->fcoe_eof = FC_EOF_T; |
| 442 | } | 443 | } |
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c index 027d7a75be39..ed1b47dc0834 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c | |||
| @@ -622,6 +622,16 @@ static int ixgbe_alloc_q_vector(struct ixgbe_adapter *adapter, int v_idx, | |||
| 622 | if (adapter->hw.mac.type == ixgbe_mac_82599EB) | 622 | if (adapter->hw.mac.type == ixgbe_mac_82599EB) |
| 623 | set_bit(__IXGBE_RX_CSUM_UDP_ZERO_ERR, &ring->state); | 623 | set_bit(__IXGBE_RX_CSUM_UDP_ZERO_ERR, &ring->state); |
| 624 | 624 | ||
| 625 | #ifdef IXGBE_FCOE | ||
| 626 | if (adapter->netdev->features & NETIF_F_FCOE_MTU) { | ||
| 627 | struct ixgbe_ring_feature *f; | ||
| 628 | f = &adapter->ring_feature[RING_F_FCOE]; | ||
| 629 | if ((rxr_idx >= f->mask) && | ||
| 630 | (rxr_idx < f->mask + f->indices)) | ||
| 631 | set_bit(__IXGBE_RX_FCOE_BUFSZ, &ring->state); | ||
| 632 | } | ||
| 633 | |||
| 634 | #endif /* IXGBE_FCOE */ | ||
| 625 | /* apply Rx specific ring traits */ | 635 | /* apply Rx specific ring traits */ |
| 626 | ring->count = adapter->rx_ring_count; | 636 | ring->count = adapter->rx_ring_count; |
| 627 | ring->queue_index = rxr_idx; | 637 | ring->queue_index = rxr_idx; |
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c index 3e26b1f9ac75..88f6b2e9b72d 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | |||
| @@ -3154,14 +3154,6 @@ static void ixgbe_set_rx_buffer_len(struct ixgbe_adapter *adapter) | |||
| 3154 | set_ring_rsc_enabled(rx_ring); | 3154 | set_ring_rsc_enabled(rx_ring); |
| 3155 | else | 3155 | else |
| 3156 | clear_ring_rsc_enabled(rx_ring); | 3156 | clear_ring_rsc_enabled(rx_ring); |
| 3157 | #ifdef IXGBE_FCOE | ||
| 3158 | if (netdev->features & NETIF_F_FCOE_MTU) { | ||
| 3159 | struct ixgbe_ring_feature *f; | ||
| 3160 | f = &adapter->ring_feature[RING_F_FCOE]; | ||
| 3161 | if ((i >= f->mask) && (i < f->mask + f->indices)) | ||
| 3162 | set_bit(__IXGBE_RX_FCOE_BUFSZ, &rx_ring->state); | ||
| 3163 | } | ||
| 3164 | #endif /* IXGBE_FCOE */ | ||
| 3165 | } | 3157 | } |
| 3166 | } | 3158 | } |
| 3167 | 3159 | ||
| @@ -4836,7 +4828,9 @@ static int ixgbe_resume(struct pci_dev *pdev) | |||
| 4836 | 4828 | ||
| 4837 | pci_wake_from_d3(pdev, false); | 4829 | pci_wake_from_d3(pdev, false); |
| 4838 | 4830 | ||
| 4831 | rtnl_lock(); | ||
| 4839 | err = ixgbe_init_interrupt_scheme(adapter); | 4832 | err = ixgbe_init_interrupt_scheme(adapter); |
| 4833 | rtnl_unlock(); | ||
| 4840 | if (err) { | 4834 | if (err) { |
| 4841 | e_dev_err("Cannot initialize interrupts for device\n"); | 4835 | e_dev_err("Cannot initialize interrupts for device\n"); |
| 4842 | return err; | 4836 | return err; |
| @@ -4879,10 +4873,6 @@ static int __ixgbe_shutdown(struct pci_dev *pdev, bool *enable_wake) | |||
| 4879 | } | 4873 | } |
| 4880 | 4874 | ||
| 4881 | ixgbe_clear_interrupt_scheme(adapter); | 4875 | ixgbe_clear_interrupt_scheme(adapter); |
| 4882 | #ifdef CONFIG_DCB | ||
| 4883 | kfree(adapter->ixgbe_ieee_pfc); | ||
| 4884 | kfree(adapter->ixgbe_ieee_ets); | ||
| 4885 | #endif | ||
| 4886 | 4876 | ||
| 4887 | #ifdef CONFIG_PM | 4877 | #ifdef CONFIG_PM |
| 4888 | retval = pci_save_state(pdev); | 4878 | retval = pci_save_state(pdev); |
| @@ -4893,6 +4883,16 @@ static int __ixgbe_shutdown(struct pci_dev *pdev, bool *enable_wake) | |||
| 4893 | if (wufc) { | 4883 | if (wufc) { |
| 4894 | ixgbe_set_rx_mode(netdev); | 4884 | ixgbe_set_rx_mode(netdev); |
| 4895 | 4885 | ||
| 4886 | /* | ||
| 4887 | * enable the optics for both mult-speed fiber and | ||
| 4888 | * 82599 SFP+ fiber as we can WoL. | ||
| 4889 | */ | ||
| 4890 | if (hw->mac.ops.enable_tx_laser && | ||
| 4891 | (hw->phy.multispeed_fiber || | ||
| 4892 | (hw->mac.ops.get_media_type(hw) == ixgbe_media_type_fiber && | ||
| 4893 | hw->mac.type == ixgbe_mac_82599EB))) | ||
| 4894 | hw->mac.ops.enable_tx_laser(hw); | ||
| 4895 | |||
| 4896 | /* turn on all-multi mode if wake on multicast is enabled */ | 4896 | /* turn on all-multi mode if wake on multicast is enabled */ |
| 4897 | if (wufc & IXGBE_WUFC_MC) { | 4897 | if (wufc & IXGBE_WUFC_MC) { |
| 4898 | fctrl = IXGBE_READ_REG(hw, IXGBE_FCTRL); | 4898 | fctrl = IXGBE_READ_REG(hw, IXGBE_FCTRL); |
| @@ -7220,6 +7220,11 @@ static void __devexit ixgbe_remove(struct pci_dev *pdev) | |||
| 7220 | 7220 | ||
| 7221 | ixgbe_release_hw_control(adapter); | 7221 | ixgbe_release_hw_control(adapter); |
| 7222 | 7222 | ||
| 7223 | #ifdef CONFIG_DCB | ||
| 7224 | kfree(adapter->ixgbe_ieee_pfc); | ||
| 7225 | kfree(adapter->ixgbe_ieee_ets); | ||
| 7226 | |||
| 7227 | #endif | ||
| 7223 | iounmap(adapter->hw.hw_addr); | 7228 | iounmap(adapter->hw.hw_addr); |
| 7224 | pci_release_selected_regions(pdev, pci_select_bars(pdev, | 7229 | pci_release_selected_regions(pdev, pci_select_bars(pdev, |
| 7225 | IORESOURCE_MEM)); | 7230 | IORESOURCE_MEM)); |
diff --git a/drivers/net/ethernet/marvell/sky2.c b/drivers/net/ethernet/marvell/sky2.c index c9b504e2dfc3..487a6c8bd4ec 100644 --- a/drivers/net/ethernet/marvell/sky2.c +++ b/drivers/net/ethernet/marvell/sky2.c | |||
| @@ -2494,8 +2494,13 @@ static struct sk_buff *receive_copy(struct sky2_port *sky2, | |||
| 2494 | skb_copy_from_linear_data(re->skb, skb->data, length); | 2494 | skb_copy_from_linear_data(re->skb, skb->data, length); |
| 2495 | skb->ip_summed = re->skb->ip_summed; | 2495 | skb->ip_summed = re->skb->ip_summed; |
| 2496 | skb->csum = re->skb->csum; | 2496 | skb->csum = re->skb->csum; |
| 2497 | skb->rxhash = re->skb->rxhash; | ||
| 2498 | skb->vlan_tci = re->skb->vlan_tci; | ||
| 2499 | |||
| 2497 | pci_dma_sync_single_for_device(sky2->hw->pdev, re->data_addr, | 2500 | pci_dma_sync_single_for_device(sky2->hw->pdev, re->data_addr, |
| 2498 | length, PCI_DMA_FROMDEVICE); | 2501 | length, PCI_DMA_FROMDEVICE); |
| 2502 | re->skb->vlan_tci = 0; | ||
| 2503 | re->skb->rxhash = 0; | ||
| 2499 | re->skb->ip_summed = CHECKSUM_NONE; | 2504 | re->skb->ip_summed = CHECKSUM_NONE; |
| 2500 | skb_put(skb, length); | 2505 | skb_put(skb, length); |
| 2501 | } | 2506 | } |
| @@ -2580,9 +2585,6 @@ static struct sk_buff *sky2_receive(struct net_device *dev, | |||
| 2580 | struct sk_buff *skb = NULL; | 2585 | struct sk_buff *skb = NULL; |
| 2581 | u16 count = (status & GMR_FS_LEN) >> 16; | 2586 | u16 count = (status & GMR_FS_LEN) >> 16; |
| 2582 | 2587 | ||
| 2583 | if (status & GMR_FS_VLAN) | ||
| 2584 | count -= VLAN_HLEN; /* Account for vlan tag */ | ||
| 2585 | |||
| 2586 | netif_printk(sky2, rx_status, KERN_DEBUG, dev, | 2588 | netif_printk(sky2, rx_status, KERN_DEBUG, dev, |
| 2587 | "rx slot %u status 0x%x len %d\n", | 2589 | "rx slot %u status 0x%x len %d\n", |
| 2588 | sky2->rx_next, status, length); | 2590 | sky2->rx_next, status, length); |
| @@ -2590,6 +2592,9 @@ static struct sk_buff *sky2_receive(struct net_device *dev, | |||
| 2590 | sky2->rx_next = (sky2->rx_next + 1) % sky2->rx_pending; | 2592 | sky2->rx_next = (sky2->rx_next + 1) % sky2->rx_pending; |
| 2591 | prefetch(sky2->rx_ring + sky2->rx_next); | 2593 | prefetch(sky2->rx_ring + sky2->rx_next); |
| 2592 | 2594 | ||
| 2595 | if (vlan_tx_tag_present(re->skb)) | ||
| 2596 | count -= VLAN_HLEN; /* Account for vlan tag */ | ||
| 2597 | |||
| 2593 | /* This chip has hardware problems that generates bogus status. | 2598 | /* This chip has hardware problems that generates bogus status. |
| 2594 | * So do only marginal checking and expect higher level protocols | 2599 | * So do only marginal checking and expect higher level protocols |
| 2595 | * to handle crap frames. | 2600 | * to handle crap frames. |
| @@ -2647,11 +2652,8 @@ static inline void sky2_tx_done(struct net_device *dev, u16 last) | |||
| 2647 | } | 2652 | } |
| 2648 | 2653 | ||
| 2649 | static inline void sky2_skb_rx(const struct sky2_port *sky2, | 2654 | static inline void sky2_skb_rx(const struct sky2_port *sky2, |
| 2650 | u32 status, struct sk_buff *skb) | 2655 | struct sk_buff *skb) |
| 2651 | { | 2656 | { |
| 2652 | if (status & GMR_FS_VLAN) | ||
| 2653 | __vlan_hwaccel_put_tag(skb, be16_to_cpu(sky2->rx_tag)); | ||
| 2654 | |||
| 2655 | if (skb->ip_summed == CHECKSUM_NONE) | 2657 | if (skb->ip_summed == CHECKSUM_NONE) |
| 2656 | netif_receive_skb(skb); | 2658 | netif_receive_skb(skb); |
| 2657 | else | 2659 | else |
| @@ -2705,6 +2707,14 @@ static void sky2_rx_checksum(struct sky2_port *sky2, u32 status) | |||
| 2705 | } | 2707 | } |
| 2706 | } | 2708 | } |
| 2707 | 2709 | ||
| 2710 | static void sky2_rx_tag(struct sky2_port *sky2, u16 length) | ||
| 2711 | { | ||
| 2712 | struct sk_buff *skb; | ||
| 2713 | |||
| 2714 | skb = sky2->rx_ring[sky2->rx_next].skb; | ||
| 2715 | __vlan_hwaccel_put_tag(skb, be16_to_cpu(length)); | ||
| 2716 | } | ||
| 2717 | |||
| 2708 | static void sky2_rx_hash(struct sky2_port *sky2, u32 status) | 2718 | static void sky2_rx_hash(struct sky2_port *sky2, u32 status) |
| 2709 | { | 2719 | { |
| 2710 | struct sk_buff *skb; | 2720 | struct sk_buff *skb; |
| @@ -2763,8 +2773,7 @@ static int sky2_status_intr(struct sky2_hw *hw, int to_do, u16 idx) | |||
| 2763 | } | 2773 | } |
| 2764 | 2774 | ||
| 2765 | skb->protocol = eth_type_trans(skb, dev); | 2775 | skb->protocol = eth_type_trans(skb, dev); |
| 2766 | 2776 | sky2_skb_rx(sky2, skb); | |
| 2767 | sky2_skb_rx(sky2, status, skb); | ||
| 2768 | 2777 | ||
| 2769 | /* Stop after net poll weight */ | 2778 | /* Stop after net poll weight */ |
| 2770 | if (++work_done >= to_do) | 2779 | if (++work_done >= to_do) |
| @@ -2772,11 +2781,11 @@ static int sky2_status_intr(struct sky2_hw *hw, int to_do, u16 idx) | |||
| 2772 | break; | 2781 | break; |
| 2773 | 2782 | ||
| 2774 | case OP_RXVLAN: | 2783 | case OP_RXVLAN: |
| 2775 | sky2->rx_tag = length; | 2784 | sky2_rx_tag(sky2, length); |
| 2776 | break; | 2785 | break; |
| 2777 | 2786 | ||
| 2778 | case OP_RXCHKSVLAN: | 2787 | case OP_RXCHKSVLAN: |
| 2779 | sky2->rx_tag = length; | 2788 | sky2_rx_tag(sky2, length); |
| 2780 | /* fall through */ | 2789 | /* fall through */ |
| 2781 | case OP_RXCHKS: | 2790 | case OP_RXCHKS: |
| 2782 | if (likely(dev->features & NETIF_F_RXCSUM)) | 2791 | if (likely(dev->features & NETIF_F_RXCSUM)) |
diff --git a/drivers/net/ethernet/marvell/sky2.h b/drivers/net/ethernet/marvell/sky2.h index ff6f58bf822a..3c896ce80b71 100644 --- a/drivers/net/ethernet/marvell/sky2.h +++ b/drivers/net/ethernet/marvell/sky2.h | |||
| @@ -2241,7 +2241,6 @@ struct sky2_port { | |||
| 2241 | u16 rx_pending; | 2241 | u16 rx_pending; |
| 2242 | u16 rx_data_size; | 2242 | u16 rx_data_size; |
| 2243 | u16 rx_nfrags; | 2243 | u16 rx_nfrags; |
| 2244 | u16 rx_tag; | ||
| 2245 | 2244 | ||
| 2246 | struct { | 2245 | struct { |
| 2247 | unsigned long last; | 2246 | unsigned long last; |
diff --git a/drivers/net/ethernet/micrel/ks8851.c b/drivers/net/ethernet/micrel/ks8851.c index c722aa607d07..f8dda009d3c0 100644 --- a/drivers/net/ethernet/micrel/ks8851.c +++ b/drivers/net/ethernet/micrel/ks8851.c | |||
| @@ -889,16 +889,17 @@ static int ks8851_net_stop(struct net_device *dev) | |||
| 889 | netif_stop_queue(dev); | 889 | netif_stop_queue(dev); |
| 890 | 890 | ||
| 891 | mutex_lock(&ks->lock); | 891 | mutex_lock(&ks->lock); |
| 892 | /* turn off the IRQs and ack any outstanding */ | ||
| 893 | ks8851_wrreg16(ks, KS_IER, 0x0000); | ||
| 894 | ks8851_wrreg16(ks, KS_ISR, 0xffff); | ||
| 895 | mutex_unlock(&ks->lock); | ||
| 892 | 896 | ||
| 893 | /* stop any outstanding work */ | 897 | /* stop any outstanding work */ |
| 894 | flush_work(&ks->irq_work); | 898 | flush_work(&ks->irq_work); |
| 895 | flush_work(&ks->tx_work); | 899 | flush_work(&ks->tx_work); |
| 896 | flush_work(&ks->rxctrl_work); | 900 | flush_work(&ks->rxctrl_work); |
| 897 | 901 | ||
| 898 | /* turn off the IRQs and ack any outstanding */ | 902 | mutex_lock(&ks->lock); |
| 899 | ks8851_wrreg16(ks, KS_IER, 0x0000); | ||
| 900 | ks8851_wrreg16(ks, KS_ISR, 0xffff); | ||
| 901 | |||
| 902 | /* shutdown RX process */ | 903 | /* shutdown RX process */ |
| 903 | ks8851_wrreg16(ks, KS_RXCR1, 0x0000); | 904 | ks8851_wrreg16(ks, KS_RXCR1, 0x0000); |
| 904 | 905 | ||
| @@ -907,6 +908,7 @@ static int ks8851_net_stop(struct net_device *dev) | |||
| 907 | 908 | ||
| 908 | /* set powermode to soft power down to save power */ | 909 | /* set powermode to soft power down to save power */ |
| 909 | ks8851_set_powermode(ks, PMECR_PM_SOFTDOWN); | 910 | ks8851_set_powermode(ks, PMECR_PM_SOFTDOWN); |
| 911 | mutex_unlock(&ks->lock); | ||
| 910 | 912 | ||
| 911 | /* ensure any queued tx buffers are dumped */ | 913 | /* ensure any queued tx buffers are dumped */ |
| 912 | while (!skb_queue_empty(&ks->txq)) { | 914 | while (!skb_queue_empty(&ks->txq)) { |
| @@ -918,7 +920,6 @@ static int ks8851_net_stop(struct net_device *dev) | |||
| 918 | dev_kfree_skb(txb); | 920 | dev_kfree_skb(txb); |
| 919 | } | 921 | } |
| 920 | 922 | ||
| 921 | mutex_unlock(&ks->lock); | ||
| 922 | return 0; | 923 | return 0; |
| 923 | } | 924 | } |
| 924 | 925 | ||
| @@ -1418,6 +1419,7 @@ static int __devinit ks8851_probe(struct spi_device *spi) | |||
| 1418 | struct net_device *ndev; | 1419 | struct net_device *ndev; |
| 1419 | struct ks8851_net *ks; | 1420 | struct ks8851_net *ks; |
| 1420 | int ret; | 1421 | int ret; |
| 1422 | unsigned cider; | ||
| 1421 | 1423 | ||
| 1422 | ndev = alloc_etherdev(sizeof(struct ks8851_net)); | 1424 | ndev = alloc_etherdev(sizeof(struct ks8851_net)); |
| 1423 | if (!ndev) | 1425 | if (!ndev) |
| @@ -1484,8 +1486,8 @@ static int __devinit ks8851_probe(struct spi_device *spi) | |||
| 1484 | ks8851_soft_reset(ks, GRR_GSR); | 1486 | ks8851_soft_reset(ks, GRR_GSR); |
| 1485 | 1487 | ||
| 1486 | /* simple check for a valid chip being connected to the bus */ | 1488 | /* simple check for a valid chip being connected to the bus */ |
| 1487 | 1489 | cider = ks8851_rdreg16(ks, KS_CIDER); | |
| 1488 | if ((ks8851_rdreg16(ks, KS_CIDER) & ~CIDER_REV_MASK) != CIDER_ID) { | 1490 | if ((cider & ~CIDER_REV_MASK) != CIDER_ID) { |
| 1489 | dev_err(&spi->dev, "failed to read device ID\n"); | 1491 | dev_err(&spi->dev, "failed to read device ID\n"); |
| 1490 | ret = -ENODEV; | 1492 | ret = -ENODEV; |
| 1491 | goto err_id; | 1493 | goto err_id; |
| @@ -1516,15 +1518,14 @@ static int __devinit ks8851_probe(struct spi_device *spi) | |||
| 1516 | } | 1518 | } |
| 1517 | 1519 | ||
| 1518 | netdev_info(ndev, "revision %d, MAC %pM, IRQ %d, %s EEPROM\n", | 1520 | netdev_info(ndev, "revision %d, MAC %pM, IRQ %d, %s EEPROM\n", |
| 1519 | CIDER_REV_GET(ks8851_rdreg16(ks, KS_CIDER)), | 1521 | CIDER_REV_GET(cider), ndev->dev_addr, ndev->irq, |
| 1520 | ndev->dev_addr, ndev->irq, | ||
| 1521 | ks->rc_ccr & CCR_EEPROM ? "has" : "no"); | 1522 | ks->rc_ccr & CCR_EEPROM ? "has" : "no"); |
| 1522 | 1523 | ||
| 1523 | return 0; | 1524 | return 0; |
| 1524 | 1525 | ||
| 1525 | 1526 | ||
| 1526 | err_netdev: | 1527 | err_netdev: |
| 1527 | free_irq(ndev->irq, ndev); | 1528 | free_irq(ndev->irq, ks); |
| 1528 | 1529 | ||
| 1529 | err_id: | 1530 | err_id: |
| 1530 | err_irq: | 1531 | err_irq: |
diff --git a/drivers/net/ethernet/micrel/ks8851_mll.c b/drivers/net/ethernet/micrel/ks8851_mll.c index b8104d9f4081..5ffde23ac8fb 100644 --- a/drivers/net/ethernet/micrel/ks8851_mll.c +++ b/drivers/net/ethernet/micrel/ks8851_mll.c | |||
| @@ -40,7 +40,7 @@ | |||
| 40 | #define DRV_NAME "ks8851_mll" | 40 | #define DRV_NAME "ks8851_mll" |
| 41 | 41 | ||
| 42 | static u8 KS_DEFAULT_MAC_ADDRESS[] = { 0x00, 0x10, 0xA1, 0x86, 0x95, 0x11 }; | 42 | static u8 KS_DEFAULT_MAC_ADDRESS[] = { 0x00, 0x10, 0xA1, 0x86, 0x95, 0x11 }; |
| 43 | #define MAX_RECV_FRAMES 32 | 43 | #define MAX_RECV_FRAMES 255 |
| 44 | #define MAX_BUF_SIZE 2048 | 44 | #define MAX_BUF_SIZE 2048 |
| 45 | #define TX_BUF_SIZE 2000 | 45 | #define TX_BUF_SIZE 2000 |
| 46 | #define RX_BUF_SIZE 2000 | 46 | #define RX_BUF_SIZE 2000 |
diff --git a/drivers/net/ethernet/micrel/ksz884x.c b/drivers/net/ethernet/micrel/ksz884x.c index ef723b185d85..eaf9ff0262a9 100644 --- a/drivers/net/ethernet/micrel/ksz884x.c +++ b/drivers/net/ethernet/micrel/ksz884x.c | |||
| @@ -5675,7 +5675,7 @@ static int netdev_set_mac_address(struct net_device *dev, void *addr) | |||
| 5675 | memcpy(hw->override_addr, mac->sa_data, ETH_ALEN); | 5675 | memcpy(hw->override_addr, mac->sa_data, ETH_ALEN); |
| 5676 | } | 5676 | } |
| 5677 | 5677 | ||
| 5678 | memcpy(dev->dev_addr, mac->sa_data, MAX_ADDR_LEN); | 5678 | memcpy(dev->dev_addr, mac->sa_data, ETH_ALEN); |
| 5679 | 5679 | ||
| 5680 | interrupt = hw_block_intr(hw); | 5680 | interrupt = hw_block_intr(hw); |
| 5681 | 5681 | ||
diff --git a/drivers/net/ethernet/realtek/8139cp.c b/drivers/net/ethernet/realtek/8139cp.c index abc79076f867..b3287c0fe279 100644 --- a/drivers/net/ethernet/realtek/8139cp.c +++ b/drivers/net/ethernet/realtek/8139cp.c | |||
| @@ -958,6 +958,11 @@ static inline void cp_start_hw (struct cp_private *cp) | |||
| 958 | cpw8(Cmd, RxOn | TxOn); | 958 | cpw8(Cmd, RxOn | TxOn); |
| 959 | } | 959 | } |
| 960 | 960 | ||
| 961 | static void cp_enable_irq(struct cp_private *cp) | ||
| 962 | { | ||
| 963 | cpw16_f(IntrMask, cp_intr_mask); | ||
| 964 | } | ||
| 965 | |||
| 961 | static void cp_init_hw (struct cp_private *cp) | 966 | static void cp_init_hw (struct cp_private *cp) |
| 962 | { | 967 | { |
| 963 | struct net_device *dev = cp->dev; | 968 | struct net_device *dev = cp->dev; |
| @@ -997,8 +1002,6 @@ static void cp_init_hw (struct cp_private *cp) | |||
| 997 | 1002 | ||
| 998 | cpw16(MultiIntr, 0); | 1003 | cpw16(MultiIntr, 0); |
| 999 | 1004 | ||
| 1000 | cpw16_f(IntrMask, cp_intr_mask); | ||
| 1001 | |||
| 1002 | cpw8_f(Cfg9346, Cfg9346_Lock); | 1005 | cpw8_f(Cfg9346, Cfg9346_Lock); |
| 1003 | } | 1006 | } |
| 1004 | 1007 | ||
| @@ -1130,6 +1133,8 @@ static int cp_open (struct net_device *dev) | |||
| 1130 | if (rc) | 1133 | if (rc) |
| 1131 | goto err_out_hw; | 1134 | goto err_out_hw; |
| 1132 | 1135 | ||
| 1136 | cp_enable_irq(cp); | ||
| 1137 | |||
| 1133 | netif_carrier_off(dev); | 1138 | netif_carrier_off(dev); |
| 1134 | mii_check_media(&cp->mii_if, netif_msg_link(cp), true); | 1139 | mii_check_media(&cp->mii_if, netif_msg_link(cp), true); |
| 1135 | netif_start_queue(dev); | 1140 | netif_start_queue(dev); |
| @@ -2031,6 +2036,7 @@ static int cp_resume (struct pci_dev *pdev) | |||
| 2031 | /* FIXME: sh*t may happen if the Rx ring buffer is depleted */ | 2036 | /* FIXME: sh*t may happen if the Rx ring buffer is depleted */ |
| 2032 | cp_init_rings_index (cp); | 2037 | cp_init_rings_index (cp); |
| 2033 | cp_init_hw (cp); | 2038 | cp_init_hw (cp); |
| 2039 | cp_enable_irq(cp); | ||
| 2034 | netif_start_queue (dev); | 2040 | netif_start_queue (dev); |
| 2035 | 2041 | ||
| 2036 | spin_lock_irqsave (&cp->lock, flags); | 2042 | spin_lock_irqsave (&cp->lock, flags); |
diff --git a/drivers/net/ethernet/smsc/smsc911x.c b/drivers/net/ethernet/smsc/smsc911x.c index 4a6971027076..cd3defb11ffb 100644 --- a/drivers/net/ethernet/smsc/smsc911x.c +++ b/drivers/net/ethernet/smsc/smsc911x.c | |||
| @@ -1166,10 +1166,8 @@ smsc911x_rx_counterrors(struct net_device *dev, unsigned int rxstat) | |||
| 1166 | 1166 | ||
| 1167 | /* Quickly dumps bad packets */ | 1167 | /* Quickly dumps bad packets */ |
| 1168 | static void | 1168 | static void |
| 1169 | smsc911x_rx_fastforward(struct smsc911x_data *pdata, unsigned int pktbytes) | 1169 | smsc911x_rx_fastforward(struct smsc911x_data *pdata, unsigned int pktwords) |
| 1170 | { | 1170 | { |
| 1171 | unsigned int pktwords = (pktbytes + NET_IP_ALIGN + 3) >> 2; | ||
| 1172 | |||
| 1173 | if (likely(pktwords >= 4)) { | 1171 | if (likely(pktwords >= 4)) { |
| 1174 | unsigned int timeout = 500; | 1172 | unsigned int timeout = 500; |
| 1175 | unsigned int val; | 1173 | unsigned int val; |
| @@ -1233,7 +1231,7 @@ static int smsc911x_poll(struct napi_struct *napi, int budget) | |||
| 1233 | continue; | 1231 | continue; |
| 1234 | } | 1232 | } |
| 1235 | 1233 | ||
| 1236 | skb = netdev_alloc_skb(dev, pktlength + NET_IP_ALIGN); | 1234 | skb = netdev_alloc_skb(dev, pktwords << 2); |
| 1237 | if (unlikely(!skb)) { | 1235 | if (unlikely(!skb)) { |
| 1238 | SMSC_WARN(pdata, rx_err, | 1236 | SMSC_WARN(pdata, rx_err, |
| 1239 | "Unable to allocate skb for rx packet"); | 1237 | "Unable to allocate skb for rx packet"); |
| @@ -1243,14 +1241,12 @@ static int smsc911x_poll(struct napi_struct *napi, int budget) | |||
| 1243 | break; | 1241 | break; |
| 1244 | } | 1242 | } |
| 1245 | 1243 | ||
| 1246 | skb->data = skb->head; | 1244 | pdata->ops->rx_readfifo(pdata, |
| 1247 | skb_reset_tail_pointer(skb); | 1245 | (unsigned int *)skb->data, pktwords); |
| 1248 | 1246 | ||
| 1249 | /* Align IP on 16B boundary */ | 1247 | /* Align IP on 16B boundary */ |
| 1250 | skb_reserve(skb, NET_IP_ALIGN); | 1248 | skb_reserve(skb, NET_IP_ALIGN); |
| 1251 | skb_put(skb, pktlength - 4); | 1249 | skb_put(skb, pktlength - 4); |
| 1252 | pdata->ops->rx_readfifo(pdata, | ||
| 1253 | (unsigned int *)skb->head, pktwords); | ||
| 1254 | skb->protocol = eth_type_trans(skb, dev); | 1250 | skb->protocol = eth_type_trans(skb, dev); |
| 1255 | skb_checksum_none_assert(skb); | 1251 | skb_checksum_none_assert(skb); |
| 1256 | netif_receive_skb(skb); | 1252 | netif_receive_skb(skb); |
| @@ -1565,7 +1561,7 @@ static int smsc911x_open(struct net_device *dev) | |||
| 1565 | smsc911x_reg_write(pdata, FIFO_INT, temp); | 1561 | smsc911x_reg_write(pdata, FIFO_INT, temp); |
| 1566 | 1562 | ||
| 1567 | /* set RX Data offset to 2 bytes for alignment */ | 1563 | /* set RX Data offset to 2 bytes for alignment */ |
| 1568 | smsc911x_reg_write(pdata, RX_CFG, (2 << 8)); | 1564 | smsc911x_reg_write(pdata, RX_CFG, (NET_IP_ALIGN << 8)); |
| 1569 | 1565 | ||
| 1570 | /* enable NAPI polling before enabling RX interrupts */ | 1566 | /* enable NAPI polling before enabling RX interrupts */ |
| 1571 | napi_enable(&pdata->napi); | 1567 | napi_enable(&pdata->napi); |
| @@ -2382,7 +2378,6 @@ static int __devinit smsc911x_drv_probe(struct platform_device *pdev) | |||
| 2382 | SET_NETDEV_DEV(dev, &pdev->dev); | 2378 | SET_NETDEV_DEV(dev, &pdev->dev); |
| 2383 | 2379 | ||
| 2384 | pdata = netdev_priv(dev); | 2380 | pdata = netdev_priv(dev); |
| 2385 | |||
| 2386 | dev->irq = irq_res->start; | 2381 | dev->irq = irq_res->start; |
| 2387 | irq_flags = irq_res->flags & IRQF_TRIGGER_MASK; | 2382 | irq_flags = irq_res->flags & IRQF_TRIGGER_MASK; |
| 2388 | pdata->ioaddr = ioremap_nocache(res->start, res_size); | 2383 | pdata->ioaddr = ioremap_nocache(res->start, res_size); |
| @@ -2446,7 +2441,7 @@ static int __devinit smsc911x_drv_probe(struct platform_device *pdev) | |||
| 2446 | if (retval) { | 2441 | if (retval) { |
| 2447 | SMSC_WARN(pdata, probe, | 2442 | SMSC_WARN(pdata, probe, |
| 2448 | "Unable to claim requested irq: %d", dev->irq); | 2443 | "Unable to claim requested irq: %d", dev->irq); |
| 2449 | goto out_free_irq; | 2444 | goto out_disable_resources; |
| 2450 | } | 2445 | } |
| 2451 | 2446 | ||
| 2452 | retval = register_netdev(dev); | 2447 | retval = register_netdev(dev); |
diff --git a/drivers/net/ethernet/sun/sungem.c b/drivers/net/ethernet/sun/sungem.c index 558409ff4058..4ba969096717 100644 --- a/drivers/net/ethernet/sun/sungem.c +++ b/drivers/net/ethernet/sun/sungem.c | |||
| @@ -2339,7 +2339,7 @@ static int gem_suspend(struct pci_dev *pdev, pm_message_t state) | |||
| 2339 | netif_device_detach(dev); | 2339 | netif_device_detach(dev); |
| 2340 | 2340 | ||
| 2341 | /* Switch off chip, remember WOL setting */ | 2341 | /* Switch off chip, remember WOL setting */ |
| 2342 | gp->asleep_wol = gp->wake_on_lan; | 2342 | gp->asleep_wol = !!gp->wake_on_lan; |
| 2343 | gem_do_stop(dev, gp->asleep_wol); | 2343 | gem_do_stop(dev, gp->asleep_wol); |
| 2344 | 2344 | ||
| 2345 | /* Unlock the network stack */ | 2345 | /* Unlock the network stack */ |
diff --git a/drivers/net/ethernet/ti/davinci_emac.c b/drivers/net/ethernet/ti/davinci_emac.c index 174a3348f676..08aff1a2087c 100644 --- a/drivers/net/ethernet/ti/davinci_emac.c +++ b/drivers/net/ethernet/ti/davinci_emac.c | |||
| @@ -1511,7 +1511,7 @@ static int emac_devioctl(struct net_device *ndev, struct ifreq *ifrq, int cmd) | |||
| 1511 | 1511 | ||
| 1512 | static int match_first_device(struct device *dev, void *data) | 1512 | static int match_first_device(struct device *dev, void *data) |
| 1513 | { | 1513 | { |
| 1514 | return 1; | 1514 | return !strncmp(dev_name(dev), "davinci_mdio", 12); |
| 1515 | } | 1515 | } |
| 1516 | 1516 | ||
| 1517 | /** | 1517 | /** |
diff --git a/drivers/net/ethernet/ti/davinci_mdio.c b/drivers/net/ethernet/ti/davinci_mdio.c index 2757c7d6e633..e4e47088e26b 100644 --- a/drivers/net/ethernet/ti/davinci_mdio.c +++ b/drivers/net/ethernet/ti/davinci_mdio.c | |||
| @@ -181,6 +181,11 @@ static inline int wait_for_user_access(struct davinci_mdio_data *data) | |||
| 181 | __davinci_mdio_reset(data); | 181 | __davinci_mdio_reset(data); |
| 182 | return -EAGAIN; | 182 | return -EAGAIN; |
| 183 | } | 183 | } |
| 184 | |||
| 185 | reg = __raw_readl(®s->user[0].access); | ||
| 186 | if ((reg & USERACCESS_GO) == 0) | ||
| 187 | return 0; | ||
| 188 | |||
| 184 | dev_err(data->dev, "timed out waiting for user access\n"); | 189 | dev_err(data->dev, "timed out waiting for user access\n"); |
| 185 | return -ETIMEDOUT; | 190 | return -ETIMEDOUT; |
| 186 | } | 191 | } |
diff --git a/drivers/net/ethernet/ti/tlan.c b/drivers/net/ethernet/ti/tlan.c index 817ad3bc4957..efd36691ce54 100644 --- a/drivers/net/ethernet/ti/tlan.c +++ b/drivers/net/ethernet/ti/tlan.c | |||
| @@ -228,7 +228,7 @@ tlan_get_skb(const struct tlan_list *tag) | |||
| 228 | unsigned long addr; | 228 | unsigned long addr; |
| 229 | 229 | ||
| 230 | addr = tag->buffer[9].address; | 230 | addr = tag->buffer[9].address; |
| 231 | addr |= (tag->buffer[8].address << 16) << 16; | 231 | addr |= ((unsigned long) tag->buffer[8].address << 16) << 16; |
| 232 | return (struct sk_buff *) addr; | 232 | return (struct sk_buff *) addr; |
| 233 | } | 233 | } |
| 234 | 234 | ||
diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet.h b/drivers/net/ethernet/xilinx/xilinx_axienet.h index cc83af083fd7..44b8d2bad8c3 100644 --- a/drivers/net/ethernet/xilinx/xilinx_axienet.h +++ b/drivers/net/ethernet/xilinx/xilinx_axienet.h | |||
| @@ -2,9 +2,7 @@ | |||
| 2 | * Definitions for Xilinx Axi Ethernet device driver. | 2 | * Definitions for Xilinx Axi Ethernet device driver. |
| 3 | * | 3 | * |
| 4 | * Copyright (c) 2009 Secret Lab Technologies, Ltd. | 4 | * Copyright (c) 2009 Secret Lab Technologies, Ltd. |
| 5 | * Copyright (c) 2010 Xilinx, Inc. All rights reserved. | 5 | * Copyright (c) 2010 - 2012 Xilinx, Inc. All rights reserved. |
| 6 | * Copyright (c) 2012 Daniel Borkmann, <daniel.borkmann@tik.ee.ethz.ch> | ||
| 7 | * Copyright (c) 2012 Ariane Keller, <ariane.keller@tik.ee.ethz.ch> | ||
| 8 | */ | 6 | */ |
| 9 | 7 | ||
| 10 | #ifndef XILINX_AXIENET_H | 8 | #ifndef XILINX_AXIENET_H |
diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c index 2fcbeba6814b..9c365e192a31 100644 --- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c +++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c | |||
| @@ -4,9 +4,9 @@ | |||
| 4 | * Copyright (c) 2008 Nissin Systems Co., Ltd., Yoshio Kashiwagi | 4 | * Copyright (c) 2008 Nissin Systems Co., Ltd., Yoshio Kashiwagi |
| 5 | * Copyright (c) 2005-2008 DLA Systems, David H. Lynch Jr. <dhlii@dlasys.net> | 5 | * Copyright (c) 2005-2008 DLA Systems, David H. Lynch Jr. <dhlii@dlasys.net> |
| 6 | * Copyright (c) 2008-2009 Secret Lab Technologies Ltd. | 6 | * Copyright (c) 2008-2009 Secret Lab Technologies Ltd. |
| 7 | * Copyright (c) 2010 Xilinx, Inc. All rights reserved. | 7 | * Copyright (c) 2010 - 2011 Michal Simek <monstr@monstr.eu> |
| 8 | * Copyright (c) 2012 Daniel Borkmann, <daniel.borkmann@tik.ee.ethz.ch> | 8 | * Copyright (c) 2010 - 2011 PetaLogix |
| 9 | * Copyright (c) 2012 Ariane Keller, <ariane.keller@tik.ee.ethz.ch> | 9 | * Copyright (c) 2010 - 2012 Xilinx, Inc. All rights reserved. |
| 10 | * | 10 | * |
| 11 | * This is a driver for the Xilinx Axi Ethernet which is used in the Virtex6 | 11 | * This is a driver for the Xilinx Axi Ethernet which is used in the Virtex6 |
| 12 | * and Spartan6. | 12 | * and Spartan6. |
diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_mdio.c b/drivers/net/ethernet/xilinx/xilinx_axienet_mdio.c index d70b6e79f6c0..e90e1f46121e 100644 --- a/drivers/net/ethernet/xilinx/xilinx_axienet_mdio.c +++ b/drivers/net/ethernet/xilinx/xilinx_axienet_mdio.c | |||
| @@ -2,9 +2,9 @@ | |||
| 2 | * MDIO bus driver for the Xilinx Axi Ethernet device | 2 | * MDIO bus driver for the Xilinx Axi Ethernet device |
| 3 | * | 3 | * |
| 4 | * Copyright (c) 2009 Secret Lab Technologies, Ltd. | 4 | * Copyright (c) 2009 Secret Lab Technologies, Ltd. |
| 5 | * Copyright (c) 2010 Xilinx, Inc. All rights reserved. | 5 | * Copyright (c) 2010 - 2011 Michal Simek <monstr@monstr.eu> |
| 6 | * Copyright (c) 2012 Daniel Borkmann, <daniel.borkmann@tik.ee.ethz.ch> | 6 | * Copyright (c) 2010 - 2011 PetaLogix |
| 7 | * Copyright (c) 2012 Ariane Keller, <ariane.keller@tik.ee.ethz.ch> | 7 | * Copyright (c) 2010 - 2012 Xilinx, Inc. All rights reserved. |
| 8 | */ | 8 | */ |
| 9 | 9 | ||
| 10 | #include <linux/of_address.h> | 10 | #include <linux/of_address.h> |
diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c index dd294783b5c5..2d59138db7f3 100644 --- a/drivers/net/hyperv/netvsc_drv.c +++ b/drivers/net/hyperv/netvsc_drv.c | |||
| @@ -44,6 +44,7 @@ struct net_device_context { | |||
| 44 | /* point back to our device context */ | 44 | /* point back to our device context */ |
| 45 | struct hv_device *device_ctx; | 45 | struct hv_device *device_ctx; |
| 46 | struct delayed_work dwork; | 46 | struct delayed_work dwork; |
| 47 | struct work_struct work; | ||
| 47 | }; | 48 | }; |
| 48 | 49 | ||
| 49 | 50 | ||
| @@ -51,30 +52,22 @@ static int ring_size = 128; | |||
| 51 | module_param(ring_size, int, S_IRUGO); | 52 | module_param(ring_size, int, S_IRUGO); |
| 52 | MODULE_PARM_DESC(ring_size, "Ring buffer size (# of pages)"); | 53 | MODULE_PARM_DESC(ring_size, "Ring buffer size (# of pages)"); |
| 53 | 54 | ||
| 54 | struct set_multicast_work { | ||
| 55 | struct work_struct work; | ||
| 56 | struct net_device *net; | ||
| 57 | }; | ||
| 58 | |||
| 59 | static void do_set_multicast(struct work_struct *w) | 55 | static void do_set_multicast(struct work_struct *w) |
| 60 | { | 56 | { |
| 61 | struct set_multicast_work *swk = | 57 | struct net_device_context *ndevctx = |
| 62 | container_of(w, struct set_multicast_work, work); | 58 | container_of(w, struct net_device_context, work); |
| 63 | struct net_device *net = swk->net; | ||
| 64 | |||
| 65 | struct net_device_context *ndevctx = netdev_priv(net); | ||
| 66 | struct netvsc_device *nvdev; | 59 | struct netvsc_device *nvdev; |
| 67 | struct rndis_device *rdev; | 60 | struct rndis_device *rdev; |
| 68 | 61 | ||
| 69 | nvdev = hv_get_drvdata(ndevctx->device_ctx); | 62 | nvdev = hv_get_drvdata(ndevctx->device_ctx); |
| 70 | if (nvdev == NULL) | 63 | if (nvdev == NULL || nvdev->ndev == NULL) |
| 71 | goto out; | 64 | return; |
| 72 | 65 | ||
| 73 | rdev = nvdev->extension; | 66 | rdev = nvdev->extension; |
| 74 | if (rdev == NULL) | 67 | if (rdev == NULL) |
| 75 | goto out; | 68 | return; |
| 76 | 69 | ||
| 77 | if (net->flags & IFF_PROMISC) | 70 | if (nvdev->ndev->flags & IFF_PROMISC) |
| 78 | rndis_filter_set_packet_filter(rdev, | 71 | rndis_filter_set_packet_filter(rdev, |
| 79 | NDIS_PACKET_TYPE_PROMISCUOUS); | 72 | NDIS_PACKET_TYPE_PROMISCUOUS); |
| 80 | else | 73 | else |
| @@ -82,21 +75,13 @@ static void do_set_multicast(struct work_struct *w) | |||
| 82 | NDIS_PACKET_TYPE_BROADCAST | | 75 | NDIS_PACKET_TYPE_BROADCAST | |
| 83 | NDIS_PACKET_TYPE_ALL_MULTICAST | | 76 | NDIS_PACKET_TYPE_ALL_MULTICAST | |
| 84 | NDIS_PACKET_TYPE_DIRECTED); | 77 | NDIS_PACKET_TYPE_DIRECTED); |
| 85 | |||
| 86 | out: | ||
| 87 | kfree(w); | ||
| 88 | } | 78 | } |
| 89 | 79 | ||
| 90 | static void netvsc_set_multicast_list(struct net_device *net) | 80 | static void netvsc_set_multicast_list(struct net_device *net) |
| 91 | { | 81 | { |
| 92 | struct set_multicast_work *swk = | 82 | struct net_device_context *net_device_ctx = netdev_priv(net); |
| 93 | kmalloc(sizeof(struct set_multicast_work), GFP_ATOMIC); | ||
| 94 | if (swk == NULL) | ||
| 95 | return; | ||
| 96 | 83 | ||
| 97 | swk->net = net; | 84 | schedule_work(&net_device_ctx->work); |
| 98 | INIT_WORK(&swk->work, do_set_multicast); | ||
| 99 | schedule_work(&swk->work); | ||
| 100 | } | 85 | } |
| 101 | 86 | ||
| 102 | static int netvsc_open(struct net_device *net) | 87 | static int netvsc_open(struct net_device *net) |
| @@ -125,6 +110,8 @@ static int netvsc_close(struct net_device *net) | |||
| 125 | 110 | ||
| 126 | netif_tx_disable(net); | 111 | netif_tx_disable(net); |
| 127 | 112 | ||
| 113 | /* Make sure netvsc_set_multicast_list doesn't re-enable filter! */ | ||
| 114 | cancel_work_sync(&net_device_ctx->work); | ||
| 128 | ret = rndis_filter_close(device_obj); | 115 | ret = rndis_filter_close(device_obj); |
| 129 | if (ret != 0) | 116 | if (ret != 0) |
| 130 | netdev_err(net, "unable to close device (ret %d).\n", ret); | 117 | netdev_err(net, "unable to close device (ret %d).\n", ret); |
| @@ -335,6 +322,7 @@ static int netvsc_change_mtu(struct net_device *ndev, int mtu) | |||
| 335 | 322 | ||
| 336 | nvdev->start_remove = true; | 323 | nvdev->start_remove = true; |
| 337 | cancel_delayed_work_sync(&ndevctx->dwork); | 324 | cancel_delayed_work_sync(&ndevctx->dwork); |
| 325 | cancel_work_sync(&ndevctx->work); | ||
| 338 | netif_tx_disable(ndev); | 326 | netif_tx_disable(ndev); |
| 339 | rndis_filter_device_remove(hdev); | 327 | rndis_filter_device_remove(hdev); |
| 340 | 328 | ||
| @@ -403,6 +391,7 @@ static int netvsc_probe(struct hv_device *dev, | |||
| 403 | net_device_ctx->device_ctx = dev; | 391 | net_device_ctx->device_ctx = dev; |
| 404 | hv_set_drvdata(dev, net); | 392 | hv_set_drvdata(dev, net); |
| 405 | INIT_DELAYED_WORK(&net_device_ctx->dwork, netvsc_send_garp); | 393 | INIT_DELAYED_WORK(&net_device_ctx->dwork, netvsc_send_garp); |
| 394 | INIT_WORK(&net_device_ctx->work, do_set_multicast); | ||
| 406 | 395 | ||
| 407 | net->netdev_ops = &device_ops; | 396 | net->netdev_ops = &device_ops; |
| 408 | 397 | ||
| @@ -456,6 +445,7 @@ static int netvsc_remove(struct hv_device *dev) | |||
| 456 | 445 | ||
| 457 | ndev_ctx = netdev_priv(net); | 446 | ndev_ctx = netdev_priv(net); |
| 458 | cancel_delayed_work_sync(&ndev_ctx->dwork); | 447 | cancel_delayed_work_sync(&ndev_ctx->dwork); |
| 448 | cancel_work_sync(&ndev_ctx->work); | ||
| 459 | 449 | ||
| 460 | /* Stop outbound asap */ | 450 | /* Stop outbound asap */ |
| 461 | netif_tx_disable(net); | 451 | netif_tx_disable(net); |
diff --git a/drivers/net/phy/icplus.c b/drivers/net/phy/icplus.c index f08c85acf761..5ac46f5226f3 100644 --- a/drivers/net/phy/icplus.c +++ b/drivers/net/phy/icplus.c | |||
| @@ -40,6 +40,7 @@ MODULE_LICENSE("GPL"); | |||
| 40 | #define IP1001_PHASE_SEL_MASK 3 /* IP1001 RX/TXPHASE_SEL */ | 40 | #define IP1001_PHASE_SEL_MASK 3 /* IP1001 RX/TXPHASE_SEL */ |
| 41 | #define IP1001_APS_ON 11 /* IP1001 APS Mode bit */ | 41 | #define IP1001_APS_ON 11 /* IP1001 APS Mode bit */ |
| 42 | #define IP101A_G_APS_ON 2 /* IP101A/G APS Mode bit */ | 42 | #define IP101A_G_APS_ON 2 /* IP101A/G APS Mode bit */ |
| 43 | #define IP101A_G_IRQ_CONF_STATUS 0x11 /* Conf Info IRQ & Status Reg */ | ||
| 43 | 44 | ||
| 44 | static int ip175c_config_init(struct phy_device *phydev) | 45 | static int ip175c_config_init(struct phy_device *phydev) |
| 45 | { | 46 | { |
| @@ -185,6 +186,15 @@ static int ip175c_config_aneg(struct phy_device *phydev) | |||
| 185 | return 0; | 186 | return 0; |
| 186 | } | 187 | } |
| 187 | 188 | ||
| 189 | static int ip101a_g_ack_interrupt(struct phy_device *phydev) | ||
| 190 | { | ||
| 191 | int err = phy_read(phydev, IP101A_G_IRQ_CONF_STATUS); | ||
| 192 | if (err < 0) | ||
| 193 | return err; | ||
| 194 | |||
| 195 | return 0; | ||
| 196 | } | ||
| 197 | |||
| 188 | static struct phy_driver ip175c_driver = { | 198 | static struct phy_driver ip175c_driver = { |
| 189 | .phy_id = 0x02430d80, | 199 | .phy_id = 0x02430d80, |
| 190 | .name = "ICPlus IP175C", | 200 | .name = "ICPlus IP175C", |
| @@ -204,7 +214,6 @@ static struct phy_driver ip1001_driver = { | |||
| 204 | .phy_id_mask = 0x0ffffff0, | 214 | .phy_id_mask = 0x0ffffff0, |
| 205 | .features = PHY_GBIT_FEATURES | SUPPORTED_Pause | | 215 | .features = PHY_GBIT_FEATURES | SUPPORTED_Pause | |
| 206 | SUPPORTED_Asym_Pause, | 216 | SUPPORTED_Asym_Pause, |
| 207 | .flags = PHY_HAS_INTERRUPT, | ||
| 208 | .config_init = &ip1001_config_init, | 217 | .config_init = &ip1001_config_init, |
| 209 | .config_aneg = &genphy_config_aneg, | 218 | .config_aneg = &genphy_config_aneg, |
| 210 | .read_status = &genphy_read_status, | 219 | .read_status = &genphy_read_status, |
| @@ -220,6 +229,7 @@ static struct phy_driver ip101a_g_driver = { | |||
| 220 | .features = PHY_BASIC_FEATURES | SUPPORTED_Pause | | 229 | .features = PHY_BASIC_FEATURES | SUPPORTED_Pause | |
| 221 | SUPPORTED_Asym_Pause, | 230 | SUPPORTED_Asym_Pause, |
| 222 | .flags = PHY_HAS_INTERRUPT, | 231 | .flags = PHY_HAS_INTERRUPT, |
| 232 | .ack_interrupt = ip101a_g_ack_interrupt, | ||
| 223 | .config_init = &ip101a_g_config_init, | 233 | .config_init = &ip101a_g_config_init, |
| 224 | .config_aneg = &genphy_config_aneg, | 234 | .config_aneg = &genphy_config_aneg, |
| 225 | .read_status = &genphy_read_status, | 235 | .read_status = &genphy_read_status, |
diff --git a/drivers/net/ppp/ppp_generic.c b/drivers/net/ppp/ppp_generic.c index 33f8c51968b6..21d7151fb0ab 100644 --- a/drivers/net/ppp/ppp_generic.c +++ b/drivers/net/ppp/ppp_generic.c | |||
| @@ -235,7 +235,7 @@ struct ppp_net { | |||
| 235 | /* Prototypes. */ | 235 | /* Prototypes. */ |
| 236 | static int ppp_unattached_ioctl(struct net *net, struct ppp_file *pf, | 236 | static int ppp_unattached_ioctl(struct net *net, struct ppp_file *pf, |
| 237 | struct file *file, unsigned int cmd, unsigned long arg); | 237 | struct file *file, unsigned int cmd, unsigned long arg); |
| 238 | static int ppp_xmit_process(struct ppp *ppp); | 238 | static void ppp_xmit_process(struct ppp *ppp); |
| 239 | static void ppp_send_frame(struct ppp *ppp, struct sk_buff *skb); | 239 | static void ppp_send_frame(struct ppp *ppp, struct sk_buff *skb); |
| 240 | static void ppp_push(struct ppp *ppp); | 240 | static void ppp_push(struct ppp *ppp); |
| 241 | static void ppp_channel_push(struct channel *pch); | 241 | static void ppp_channel_push(struct channel *pch); |
| @@ -969,8 +969,7 @@ ppp_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
| 969 | put_unaligned_be16(proto, pp); | 969 | put_unaligned_be16(proto, pp); |
| 970 | 970 | ||
| 971 | skb_queue_tail(&ppp->file.xq, skb); | 971 | skb_queue_tail(&ppp->file.xq, skb); |
| 972 | if (!ppp_xmit_process(ppp)) | 972 | ppp_xmit_process(ppp); |
| 973 | netif_stop_queue(dev); | ||
| 974 | return NETDEV_TX_OK; | 973 | return NETDEV_TX_OK; |
| 975 | 974 | ||
| 976 | outf: | 975 | outf: |
| @@ -1048,11 +1047,10 @@ static void ppp_setup(struct net_device *dev) | |||
| 1048 | * Called to do any work queued up on the transmit side | 1047 | * Called to do any work queued up on the transmit side |
| 1049 | * that can now be done. | 1048 | * that can now be done. |
| 1050 | */ | 1049 | */ |
| 1051 | static int | 1050 | static void |
| 1052 | ppp_xmit_process(struct ppp *ppp) | 1051 | ppp_xmit_process(struct ppp *ppp) |
| 1053 | { | 1052 | { |
| 1054 | struct sk_buff *skb; | 1053 | struct sk_buff *skb; |
| 1055 | int ret = 0; | ||
| 1056 | 1054 | ||
| 1057 | ppp_xmit_lock(ppp); | 1055 | ppp_xmit_lock(ppp); |
| 1058 | if (!ppp->closing) { | 1056 | if (!ppp->closing) { |
| @@ -1062,13 +1060,12 @@ ppp_xmit_process(struct ppp *ppp) | |||
| 1062 | ppp_send_frame(ppp, skb); | 1060 | ppp_send_frame(ppp, skb); |
| 1063 | /* If there's no work left to do, tell the core net | 1061 | /* If there's no work left to do, tell the core net |
| 1064 | code that we can accept some more. */ | 1062 | code that we can accept some more. */ |
| 1065 | if (!ppp->xmit_pending && !skb_peek(&ppp->file.xq)) { | 1063 | if (!ppp->xmit_pending && !skb_peek(&ppp->file.xq)) |
| 1066 | netif_wake_queue(ppp->dev); | 1064 | netif_wake_queue(ppp->dev); |
| 1067 | ret = 1; | 1065 | else |
| 1068 | } | 1066 | netif_stop_queue(ppp->dev); |
| 1069 | } | 1067 | } |
| 1070 | ppp_xmit_unlock(ppp); | 1068 | ppp_xmit_unlock(ppp); |
| 1071 | return ret; | ||
| 1072 | } | 1069 | } |
| 1073 | 1070 | ||
| 1074 | static inline struct sk_buff * | 1071 | static inline struct sk_buff * |
diff --git a/drivers/net/usb/asix.c b/drivers/net/usb/asix.c index 5ee032cafade..42b5151aa78a 100644 --- a/drivers/net/usb/asix.c +++ b/drivers/net/usb/asix.c | |||
| @@ -355,7 +355,7 @@ static struct sk_buff *asix_tx_fixup(struct usbnet *dev, struct sk_buff *skb, | |||
| 355 | u32 packet_len; | 355 | u32 packet_len; |
| 356 | u32 padbytes = 0xffff0000; | 356 | u32 padbytes = 0xffff0000; |
| 357 | 357 | ||
| 358 | padlen = ((skb->len + 4) % 512) ? 0 : 4; | 358 | padlen = ((skb->len + 4) & (dev->maxpacket - 1)) ? 0 : 4; |
| 359 | 359 | ||
| 360 | if ((!skb_cloned(skb)) && | 360 | if ((!skb_cloned(skb)) && |
| 361 | ((headroom + tailroom) >= (4 + padlen))) { | 361 | ((headroom + tailroom) >= (4 + padlen))) { |
| @@ -377,7 +377,7 @@ static struct sk_buff *asix_tx_fixup(struct usbnet *dev, struct sk_buff *skb, | |||
| 377 | cpu_to_le32s(&packet_len); | 377 | cpu_to_le32s(&packet_len); |
| 378 | skb_copy_to_linear_data(skb, &packet_len, sizeof(packet_len)); | 378 | skb_copy_to_linear_data(skb, &packet_len, sizeof(packet_len)); |
| 379 | 379 | ||
| 380 | if ((skb->len % 512) == 0) { | 380 | if (padlen) { |
| 381 | cpu_to_le32s(&padbytes); | 381 | cpu_to_le32s(&padbytes); |
| 382 | memcpy(skb_tail_pointer(skb), &padbytes, sizeof(padbytes)); | 382 | memcpy(skb_tail_pointer(skb), &padbytes, sizeof(padbytes)); |
| 383 | skb_put(skb, sizeof(padbytes)); | 383 | skb_put(skb, sizeof(padbytes)); |
diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c index 552d24bf862e..d316503b35d4 100644 --- a/drivers/net/usb/qmi_wwan.c +++ b/drivers/net/usb/qmi_wwan.c | |||
| @@ -365,6 +365,27 @@ static const struct driver_info qmi_wwan_force_int4 = { | |||
| 365 | .data = BIT(4), /* interface whitelist bitmap */ | 365 | .data = BIT(4), /* interface whitelist bitmap */ |
| 366 | }; | 366 | }; |
| 367 | 367 | ||
| 368 | /* Sierra Wireless provide equally useless interface descriptors | ||
| 369 | * Devices in QMI mode can be switched between two different | ||
| 370 | * configurations: | ||
| 371 | * a) USB interface #8 is QMI/wwan | ||
| 372 | * b) USB interfaces #8, #19 and #20 are QMI/wwan | ||
| 373 | * | ||
| 374 | * Both configurations provide a number of other interfaces (serial++), | ||
| 375 | * some of which have the same endpoint configuration as we expect, so | ||
| 376 | * a whitelist or blacklist is necessary. | ||
| 377 | * | ||
| 378 | * FIXME: The below whitelist should include BIT(20). It does not | ||
| 379 | * because I cannot get it to work... | ||
| 380 | */ | ||
| 381 | static const struct driver_info qmi_wwan_sierra = { | ||
| 382 | .description = "Sierra Wireless wwan/QMI device", | ||
| 383 | .flags = FLAG_WWAN, | ||
| 384 | .bind = qmi_wwan_bind_gobi, | ||
| 385 | .unbind = qmi_wwan_unbind_shared, | ||
| 386 | .manage_power = qmi_wwan_manage_power, | ||
| 387 | .data = BIT(8) | BIT(19), /* interface whitelist bitmap */ | ||
| 388 | }; | ||
| 368 | 389 | ||
| 369 | #define HUAWEI_VENDOR_ID 0x12D1 | 390 | #define HUAWEI_VENDOR_ID 0x12D1 |
| 370 | #define QMI_GOBI_DEVICE(vend, prod) \ | 391 | #define QMI_GOBI_DEVICE(vend, prod) \ |
| @@ -445,6 +466,15 @@ static const struct usb_device_id products[] = { | |||
| 445 | .bInterfaceProtocol = 0xff, | 466 | .bInterfaceProtocol = 0xff, |
| 446 | .driver_info = (unsigned long)&qmi_wwan_force_int4, | 467 | .driver_info = (unsigned long)&qmi_wwan_force_int4, |
| 447 | }, | 468 | }, |
| 469 | { /* Sierra Wireless MC77xx in QMI mode */ | ||
| 470 | .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO, | ||
| 471 | .idVendor = 0x1199, | ||
| 472 | .idProduct = 0x68a2, | ||
| 473 | .bInterfaceClass = 0xff, | ||
| 474 | .bInterfaceSubClass = 0xff, | ||
| 475 | .bInterfaceProtocol = 0xff, | ||
| 476 | .driver_info = (unsigned long)&qmi_wwan_sierra, | ||
| 477 | }, | ||
| 448 | {QMI_GOBI_DEVICE(0x05c6, 0x9212)}, /* Acer Gobi Modem Device */ | 478 | {QMI_GOBI_DEVICE(0x05c6, 0x9212)}, /* Acer Gobi Modem Device */ |
| 449 | {QMI_GOBI_DEVICE(0x03f0, 0x1f1d)}, /* HP un2400 Gobi Modem Device */ | 479 | {QMI_GOBI_DEVICE(0x03f0, 0x1f1d)}, /* HP un2400 Gobi Modem Device */ |
| 450 | {QMI_GOBI_DEVICE(0x03f0, 0x371d)}, /* HP un2430 Mobile Broadband Module */ | 480 | {QMI_GOBI_DEVICE(0x03f0, 0x371d)}, /* HP un2430 Mobile Broadband Module */ |
diff --git a/drivers/net/usb/smsc75xx.c b/drivers/net/usb/smsc75xx.c index 187d01ccb973..00103a8c5e04 100644 --- a/drivers/net/usb/smsc75xx.c +++ b/drivers/net/usb/smsc75xx.c | |||
| @@ -98,7 +98,7 @@ static int __must_check smsc75xx_read_reg(struct usbnet *dev, u32 index, | |||
| 98 | 98 | ||
| 99 | if (unlikely(ret < 0)) | 99 | if (unlikely(ret < 0)) |
| 100 | netdev_warn(dev->net, | 100 | netdev_warn(dev->net, |
| 101 | "Failed to read register index 0x%08x", index); | 101 | "Failed to read reg index 0x%08x: %d", index, ret); |
| 102 | 102 | ||
| 103 | le32_to_cpus(buf); | 103 | le32_to_cpus(buf); |
| 104 | *data = *buf; | 104 | *data = *buf; |
| @@ -128,7 +128,7 @@ static int __must_check smsc75xx_write_reg(struct usbnet *dev, u32 index, | |||
| 128 | 128 | ||
| 129 | if (unlikely(ret < 0)) | 129 | if (unlikely(ret < 0)) |
| 130 | netdev_warn(dev->net, | 130 | netdev_warn(dev->net, |
| 131 | "Failed to write register index 0x%08x", index); | 131 | "Failed to write reg index 0x%08x: %d", index, ret); |
| 132 | 132 | ||
| 133 | kfree(buf); | 133 | kfree(buf); |
| 134 | 134 | ||
| @@ -171,7 +171,7 @@ static int smsc75xx_mdio_read(struct net_device *netdev, int phy_id, int idx) | |||
| 171 | idx &= dev->mii.reg_num_mask; | 171 | idx &= dev->mii.reg_num_mask; |
| 172 | addr = ((phy_id << MII_ACCESS_PHY_ADDR_SHIFT) & MII_ACCESS_PHY_ADDR) | 172 | addr = ((phy_id << MII_ACCESS_PHY_ADDR_SHIFT) & MII_ACCESS_PHY_ADDR) |
| 173 | | ((idx << MII_ACCESS_REG_ADDR_SHIFT) & MII_ACCESS_REG_ADDR) | 173 | | ((idx << MII_ACCESS_REG_ADDR_SHIFT) & MII_ACCESS_REG_ADDR) |
| 174 | | MII_ACCESS_READ; | 174 | | MII_ACCESS_READ | MII_ACCESS_BUSY; |
| 175 | ret = smsc75xx_write_reg(dev, MII_ACCESS, addr); | 175 | ret = smsc75xx_write_reg(dev, MII_ACCESS, addr); |
| 176 | check_warn_goto_done(ret, "Error writing MII_ACCESS"); | 176 | check_warn_goto_done(ret, "Error writing MII_ACCESS"); |
| 177 | 177 | ||
| @@ -210,7 +210,7 @@ static void smsc75xx_mdio_write(struct net_device *netdev, int phy_id, int idx, | |||
| 210 | idx &= dev->mii.reg_num_mask; | 210 | idx &= dev->mii.reg_num_mask; |
| 211 | addr = ((phy_id << MII_ACCESS_PHY_ADDR_SHIFT) & MII_ACCESS_PHY_ADDR) | 211 | addr = ((phy_id << MII_ACCESS_PHY_ADDR_SHIFT) & MII_ACCESS_PHY_ADDR) |
| 212 | | ((idx << MII_ACCESS_REG_ADDR_SHIFT) & MII_ACCESS_REG_ADDR) | 212 | | ((idx << MII_ACCESS_REG_ADDR_SHIFT) & MII_ACCESS_REG_ADDR) |
| 213 | | MII_ACCESS_WRITE; | 213 | | MII_ACCESS_WRITE | MII_ACCESS_BUSY; |
| 214 | ret = smsc75xx_write_reg(dev, MII_ACCESS, addr); | 214 | ret = smsc75xx_write_reg(dev, MII_ACCESS, addr); |
| 215 | check_warn_goto_done(ret, "Error writing MII_ACCESS"); | 215 | check_warn_goto_done(ret, "Error writing MII_ACCESS"); |
| 216 | 216 | ||
| @@ -508,9 +508,10 @@ static int smsc75xx_link_reset(struct usbnet *dev) | |||
| 508 | u16 lcladv, rmtadv; | 508 | u16 lcladv, rmtadv; |
| 509 | int ret; | 509 | int ret; |
| 510 | 510 | ||
| 511 | /* clear interrupt status */ | 511 | /* read and write to clear phy interrupt status */ |
| 512 | ret = smsc75xx_mdio_read(dev->net, mii->phy_id, PHY_INT_SRC); | 512 | ret = smsc75xx_mdio_read(dev->net, mii->phy_id, PHY_INT_SRC); |
| 513 | check_warn_return(ret, "Error reading PHY_INT_SRC"); | 513 | check_warn_return(ret, "Error reading PHY_INT_SRC"); |
| 514 | smsc75xx_mdio_write(dev->net, mii->phy_id, PHY_INT_SRC, 0xffff); | ||
| 514 | 515 | ||
| 515 | ret = smsc75xx_write_reg(dev, INT_STS, INT_STS_CLEAR_ALL); | 516 | ret = smsc75xx_write_reg(dev, INT_STS, INT_STS_CLEAR_ALL); |
| 516 | check_warn_return(ret, "Error writing INT_STS"); | 517 | check_warn_return(ret, "Error writing INT_STS"); |
| @@ -643,7 +644,7 @@ static int smsc75xx_set_mac_address(struct usbnet *dev) | |||
| 643 | 644 | ||
| 644 | static int smsc75xx_phy_initialize(struct usbnet *dev) | 645 | static int smsc75xx_phy_initialize(struct usbnet *dev) |
| 645 | { | 646 | { |
| 646 | int bmcr, timeout = 0; | 647 | int bmcr, ret, timeout = 0; |
| 647 | 648 | ||
| 648 | /* Initialize MII structure */ | 649 | /* Initialize MII structure */ |
| 649 | dev->mii.dev = dev->net; | 650 | dev->mii.dev = dev->net; |
| @@ -651,6 +652,7 @@ static int smsc75xx_phy_initialize(struct usbnet *dev) | |||
| 651 | dev->mii.mdio_write = smsc75xx_mdio_write; | 652 | dev->mii.mdio_write = smsc75xx_mdio_write; |
| 652 | dev->mii.phy_id_mask = 0x1f; | 653 | dev->mii.phy_id_mask = 0x1f; |
| 653 | dev->mii.reg_num_mask = 0x1f; | 654 | dev->mii.reg_num_mask = 0x1f; |
| 655 | dev->mii.supports_gmii = 1; | ||
| 654 | dev->mii.phy_id = SMSC75XX_INTERNAL_PHY_ID; | 656 | dev->mii.phy_id = SMSC75XX_INTERNAL_PHY_ID; |
| 655 | 657 | ||
| 656 | /* reset phy and wait for reset to complete */ | 658 | /* reset phy and wait for reset to complete */ |
| @@ -661,7 +663,7 @@ static int smsc75xx_phy_initialize(struct usbnet *dev) | |||
| 661 | bmcr = smsc75xx_mdio_read(dev->net, dev->mii.phy_id, MII_BMCR); | 663 | bmcr = smsc75xx_mdio_read(dev->net, dev->mii.phy_id, MII_BMCR); |
| 662 | check_warn_return(bmcr, "Error reading MII_BMCR"); | 664 | check_warn_return(bmcr, "Error reading MII_BMCR"); |
| 663 | timeout++; | 665 | timeout++; |
| 664 | } while ((bmcr & MII_BMCR) && (timeout < 100)); | 666 | } while ((bmcr & BMCR_RESET) && (timeout < 100)); |
| 665 | 667 | ||
| 666 | if (timeout >= 100) { | 668 | if (timeout >= 100) { |
| 667 | netdev_warn(dev->net, "timeout on PHY Reset"); | 669 | netdev_warn(dev->net, "timeout on PHY Reset"); |
| @@ -671,10 +673,13 @@ static int smsc75xx_phy_initialize(struct usbnet *dev) | |||
| 671 | smsc75xx_mdio_write(dev->net, dev->mii.phy_id, MII_ADVERTISE, | 673 | smsc75xx_mdio_write(dev->net, dev->mii.phy_id, MII_ADVERTISE, |
| 672 | ADVERTISE_ALL | ADVERTISE_CSMA | ADVERTISE_PAUSE_CAP | | 674 | ADVERTISE_ALL | ADVERTISE_CSMA | ADVERTISE_PAUSE_CAP | |
| 673 | ADVERTISE_PAUSE_ASYM); | 675 | ADVERTISE_PAUSE_ASYM); |
| 676 | smsc75xx_mdio_write(dev->net, dev->mii.phy_id, MII_CTRL1000, | ||
| 677 | ADVERTISE_1000FULL); | ||
| 674 | 678 | ||
| 675 | /* read to clear */ | 679 | /* read and write to clear phy interrupt status */ |
| 676 | smsc75xx_mdio_read(dev->net, dev->mii.phy_id, PHY_INT_SRC); | 680 | ret = smsc75xx_mdio_read(dev->net, dev->mii.phy_id, PHY_INT_SRC); |
| 677 | check_warn_return(bmcr, "Error reading PHY_INT_SRC"); | 681 | check_warn_return(ret, "Error reading PHY_INT_SRC"); |
| 682 | smsc75xx_mdio_write(dev->net, dev->mii.phy_id, PHY_INT_SRC, 0xffff); | ||
| 678 | 683 | ||
| 679 | smsc75xx_mdio_write(dev->net, dev->mii.phy_id, PHY_INT_MASK, | 684 | smsc75xx_mdio_write(dev->net, dev->mii.phy_id, PHY_INT_MASK, |
| 680 | PHY_INT_MASK_DEFAULT); | 685 | PHY_INT_MASK_DEFAULT); |
| @@ -946,6 +951,14 @@ static int smsc75xx_reset(struct usbnet *dev) | |||
| 946 | ret = smsc75xx_write_reg(dev, INT_EP_CTL, buf); | 951 | ret = smsc75xx_write_reg(dev, INT_EP_CTL, buf); |
| 947 | check_warn_return(ret, "Failed to write INT_EP_CTL: %d", ret); | 952 | check_warn_return(ret, "Failed to write INT_EP_CTL: %d", ret); |
| 948 | 953 | ||
| 954 | /* allow mac to detect speed and duplex from phy */ | ||
| 955 | ret = smsc75xx_read_reg(dev, MAC_CR, &buf); | ||
| 956 | check_warn_return(ret, "Failed to read MAC_CR: %d", ret); | ||
| 957 | |||
| 958 | buf |= (MAC_CR_ADD | MAC_CR_ASD); | ||
| 959 | ret = smsc75xx_write_reg(dev, MAC_CR, buf); | ||
| 960 | check_warn_return(ret, "Failed to write MAC_CR: %d", ret); | ||
| 961 | |||
| 949 | ret = smsc75xx_read_reg(dev, MAC_TX, &buf); | 962 | ret = smsc75xx_read_reg(dev, MAC_TX, &buf); |
| 950 | check_warn_return(ret, "Failed to read MAC_TX: %d", ret); | 963 | check_warn_return(ret, "Failed to read MAC_TX: %d", ret); |
| 951 | 964 | ||
| @@ -1051,6 +1064,7 @@ static int smsc75xx_bind(struct usbnet *dev, struct usb_interface *intf) | |||
| 1051 | dev->net->ethtool_ops = &smsc75xx_ethtool_ops; | 1064 | dev->net->ethtool_ops = &smsc75xx_ethtool_ops; |
| 1052 | dev->net->flags |= IFF_MULTICAST; | 1065 | dev->net->flags |= IFF_MULTICAST; |
| 1053 | dev->net->hard_header_len += SMSC75XX_TX_OVERHEAD; | 1066 | dev->net->hard_header_len += SMSC75XX_TX_OVERHEAD; |
| 1067 | dev->hard_mtu = dev->net->mtu + dev->net->hard_header_len; | ||
| 1054 | return 0; | 1068 | return 0; |
| 1055 | } | 1069 | } |
| 1056 | 1070 | ||
| @@ -1211,7 +1225,7 @@ static const struct driver_info smsc75xx_info = { | |||
| 1211 | .rx_fixup = smsc75xx_rx_fixup, | 1225 | .rx_fixup = smsc75xx_rx_fixup, |
| 1212 | .tx_fixup = smsc75xx_tx_fixup, | 1226 | .tx_fixup = smsc75xx_tx_fixup, |
| 1213 | .status = smsc75xx_status, | 1227 | .status = smsc75xx_status, |
| 1214 | .flags = FLAG_ETHER | FLAG_SEND_ZLP, | 1228 | .flags = FLAG_ETHER | FLAG_SEND_ZLP | FLAG_LINK_INTR, |
| 1215 | }; | 1229 | }; |
| 1216 | 1230 | ||
| 1217 | static const struct usb_device_id products[] = { | 1231 | static const struct usb_device_id products[] = { |
diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c index 5f19f84d3494..94ae66999f59 100644 --- a/drivers/net/usb/smsc95xx.c +++ b/drivers/net/usb/smsc95xx.c | |||
| @@ -1017,6 +1017,7 @@ static int smsc95xx_bind(struct usbnet *dev, struct usb_interface *intf) | |||
| 1017 | dev->net->ethtool_ops = &smsc95xx_ethtool_ops; | 1017 | dev->net->ethtool_ops = &smsc95xx_ethtool_ops; |
| 1018 | dev->net->flags |= IFF_MULTICAST; | 1018 | dev->net->flags |= IFF_MULTICAST; |
| 1019 | dev->net->hard_header_len += SMSC95XX_TX_OVERHEAD_CSUM; | 1019 | dev->net->hard_header_len += SMSC95XX_TX_OVERHEAD_CSUM; |
| 1020 | dev->hard_mtu = dev->net->mtu + dev->net->hard_header_len; | ||
| 1020 | return 0; | 1021 | return 0; |
| 1021 | } | 1022 | } |
| 1022 | 1023 | ||
| @@ -1191,7 +1192,7 @@ static const struct driver_info smsc95xx_info = { | |||
| 1191 | .rx_fixup = smsc95xx_rx_fixup, | 1192 | .rx_fixup = smsc95xx_rx_fixup, |
| 1192 | .tx_fixup = smsc95xx_tx_fixup, | 1193 | .tx_fixup = smsc95xx_tx_fixup, |
| 1193 | .status = smsc95xx_status, | 1194 | .status = smsc95xx_status, |
| 1194 | .flags = FLAG_ETHER | FLAG_SEND_ZLP, | 1195 | .flags = FLAG_ETHER | FLAG_SEND_ZLP | FLAG_LINK_INTR, |
| 1195 | }; | 1196 | }; |
| 1196 | 1197 | ||
| 1197 | static const struct usb_device_id products[] = { | 1198 | static const struct usb_device_id products[] = { |
diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c index b7b3f5b0d406..2d927fb4adf4 100644 --- a/drivers/net/usb/usbnet.c +++ b/drivers/net/usb/usbnet.c | |||
| @@ -210,6 +210,7 @@ static int init_status (struct usbnet *dev, struct usb_interface *intf) | |||
| 210 | } else { | 210 | } else { |
| 211 | usb_fill_int_urb(dev->interrupt, dev->udev, pipe, | 211 | usb_fill_int_urb(dev->interrupt, dev->udev, pipe, |
| 212 | buf, maxp, intr_complete, dev, period); | 212 | buf, maxp, intr_complete, dev, period); |
| 213 | dev->interrupt->transfer_flags |= URB_FREE_BUFFER; | ||
| 213 | dev_dbg(&intf->dev, | 214 | dev_dbg(&intf->dev, |
| 214 | "status ep%din, %d bytes period %d\n", | 215 | "status ep%din, %d bytes period %d\n", |
| 215 | usb_pipeendpoint(pipe), maxp, period); | 216 | usb_pipeendpoint(pipe), maxp, period); |
| @@ -1443,7 +1444,7 @@ usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod) | |||
| 1443 | 1444 | ||
| 1444 | status = register_netdev (net); | 1445 | status = register_netdev (net); |
| 1445 | if (status) | 1446 | if (status) |
| 1446 | goto out3; | 1447 | goto out4; |
| 1447 | netif_info(dev, probe, dev->net, | 1448 | netif_info(dev, probe, dev->net, |
| 1448 | "register '%s' at usb-%s-%s, %s, %pM\n", | 1449 | "register '%s' at usb-%s-%s, %s, %pM\n", |
| 1449 | udev->dev.driver->name, | 1450 | udev->dev.driver->name, |
| @@ -1461,6 +1462,8 @@ usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod) | |||
| 1461 | 1462 | ||
| 1462 | return 0; | 1463 | return 0; |
| 1463 | 1464 | ||
| 1465 | out4: | ||
| 1466 | usb_free_urb(dev->interrupt); | ||
| 1464 | out3: | 1467 | out3: |
| 1465 | if (info->unbind) | 1468 | if (info->unbind) |
| 1466 | info->unbind (dev, udev); | 1469 | info->unbind (dev, udev); |
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index 4de2760c5937..af8acc85f4bb 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c | |||
| @@ -626,16 +626,15 @@ static netdev_tx_t start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
| 626 | /* This can happen with OOM and indirect buffers. */ | 626 | /* This can happen with OOM and indirect buffers. */ |
| 627 | if (unlikely(capacity < 0)) { | 627 | if (unlikely(capacity < 0)) { |
| 628 | if (likely(capacity == -ENOMEM)) { | 628 | if (likely(capacity == -ENOMEM)) { |
| 629 | if (net_ratelimit()) { | 629 | if (net_ratelimit()) |
| 630 | dev_warn(&dev->dev, | 630 | dev_warn(&dev->dev, |
| 631 | "TX queue failure: out of memory\n"); | 631 | "TX queue failure: out of memory\n"); |
| 632 | } else { | 632 | } else { |
| 633 | dev->stats.tx_fifo_errors++; | 633 | dev->stats.tx_fifo_errors++; |
| 634 | if (net_ratelimit()) | 634 | if (net_ratelimit()) |
| 635 | dev_warn(&dev->dev, | 635 | dev_warn(&dev->dev, |
| 636 | "Unexpected TX queue failure: %d\n", | 636 | "Unexpected TX queue failure: %d\n", |
| 637 | capacity); | 637 | capacity); |
| 638 | } | ||
| 639 | } | 638 | } |
| 640 | dev->stats.tx_dropped++; | 639 | dev->stats.tx_dropped++; |
| 641 | kfree_skb(skb); | 640 | kfree_skb(skb); |
diff --git a/drivers/net/wan/farsync.c b/drivers/net/wan/farsync.c index ebb9f24eefb5..1a623183cbe5 100644 --- a/drivers/net/wan/farsync.c +++ b/drivers/net/wan/farsync.c | |||
| @@ -2483,6 +2483,7 @@ fst_add_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
| 2483 | pr_err("Control memory remap failed\n"); | 2483 | pr_err("Control memory remap failed\n"); |
| 2484 | pci_release_regions(pdev); | 2484 | pci_release_regions(pdev); |
| 2485 | pci_disable_device(pdev); | 2485 | pci_disable_device(pdev); |
| 2486 | iounmap(card->mem); | ||
| 2486 | kfree(card); | 2487 | kfree(card); |
| 2487 | return -ENODEV; | 2488 | return -ENODEV; |
| 2488 | } | 2489 | } |
diff --git a/drivers/net/wireless/ath/ath5k/ahb.c b/drivers/net/wireless/ath/ath5k/ahb.c index 8faa129da5a0..aec33cc207fd 100644 --- a/drivers/net/wireless/ath/ath5k/ahb.c +++ b/drivers/net/wireless/ath/ath5k/ahb.c | |||
| @@ -19,6 +19,7 @@ | |||
| 19 | #include <linux/nl80211.h> | 19 | #include <linux/nl80211.h> |
| 20 | #include <linux/platform_device.h> | 20 | #include <linux/platform_device.h> |
| 21 | #include <linux/etherdevice.h> | 21 | #include <linux/etherdevice.h> |
| 22 | #include <linux/export.h> | ||
| 22 | #include <ar231x_platform.h> | 23 | #include <ar231x_platform.h> |
| 23 | #include "ath5k.h" | 24 | #include "ath5k.h" |
| 24 | #include "debug.h" | 25 | #include "debug.h" |
| @@ -119,7 +120,7 @@ static int ath_ahb_probe(struct platform_device *pdev) | |||
| 119 | if (res == NULL) { | 120 | if (res == NULL) { |
| 120 | dev_err(&pdev->dev, "no IRQ resource found\n"); | 121 | dev_err(&pdev->dev, "no IRQ resource found\n"); |
| 121 | ret = -ENXIO; | 122 | ret = -ENXIO; |
| 122 | goto err_out; | 123 | goto err_iounmap; |
| 123 | } | 124 | } |
| 124 | 125 | ||
| 125 | irq = res->start; | 126 | irq = res->start; |
| @@ -128,7 +129,7 @@ static int ath_ahb_probe(struct platform_device *pdev) | |||
| 128 | if (hw == NULL) { | 129 | if (hw == NULL) { |
| 129 | dev_err(&pdev->dev, "no memory for ieee80211_hw\n"); | 130 | dev_err(&pdev->dev, "no memory for ieee80211_hw\n"); |
| 130 | ret = -ENOMEM; | 131 | ret = -ENOMEM; |
| 131 | goto err_out; | 132 | goto err_iounmap; |
| 132 | } | 133 | } |
| 133 | 134 | ||
| 134 | ah = hw->priv; | 135 | ah = hw->priv; |
| @@ -185,6 +186,8 @@ static int ath_ahb_probe(struct platform_device *pdev) | |||
| 185 | err_free_hw: | 186 | err_free_hw: |
| 186 | ieee80211_free_hw(hw); | 187 | ieee80211_free_hw(hw); |
| 187 | platform_set_drvdata(pdev, NULL); | 188 | platform_set_drvdata(pdev, NULL); |
| 189 | err_iounmap: | ||
| 190 | iounmap(mem); | ||
| 188 | err_out: | 191 | err_out: |
| 189 | return ret; | 192 | return ret; |
| 190 | } | 193 | } |
| @@ -217,6 +220,7 @@ static int ath_ahb_remove(struct platform_device *pdev) | |||
| 217 | } | 220 | } |
| 218 | 221 | ||
| 219 | ath5k_deinit_ah(ah); | 222 | ath5k_deinit_ah(ah); |
| 223 | iounmap(ah->iobase); | ||
| 220 | platform_set_drvdata(pdev, NULL); | 224 | platform_set_drvdata(pdev, NULL); |
| 221 | ieee80211_free_hw(hw); | 225 | ieee80211_free_hw(hw); |
| 222 | 226 | ||
diff --git a/drivers/net/wireless/ath/ath9k/ar5008_phy.c b/drivers/net/wireless/ath/ath9k/ar5008_phy.c index d7d8e9199140..aba088005b22 100644 --- a/drivers/net/wireless/ath/ath9k/ar5008_phy.c +++ b/drivers/net/wireless/ath/ath9k/ar5008_phy.c | |||
| @@ -869,7 +869,7 @@ static int ar5008_hw_process_ini(struct ath_hw *ah, | |||
| 869 | ar5008_hw_set_channel_regs(ah, chan); | 869 | ar5008_hw_set_channel_regs(ah, chan); |
| 870 | ar5008_hw_init_chain_masks(ah); | 870 | ar5008_hw_init_chain_masks(ah); |
| 871 | ath9k_olc_init(ah); | 871 | ath9k_olc_init(ah); |
| 872 | ath9k_hw_apply_txpower(ah, chan); | 872 | ath9k_hw_apply_txpower(ah, chan, false); |
| 873 | 873 | ||
| 874 | /* Write analog registers */ | 874 | /* Write analog registers */ |
| 875 | if (!ath9k_hw_set_rf_regs(ah, chan, freqIndex)) { | 875 | if (!ath9k_hw_set_rf_regs(ah, chan, freqIndex)) { |
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_paprd.c b/drivers/net/wireless/ath/ath9k/ar9003_paprd.c index 59647a3ceb7f..3d400e8d6535 100644 --- a/drivers/net/wireless/ath/ath9k/ar9003_paprd.c +++ b/drivers/net/wireless/ath/ath9k/ar9003_paprd.c | |||
| @@ -54,7 +54,7 @@ void ar9003_paprd_enable(struct ath_hw *ah, bool val) | |||
| 54 | 54 | ||
| 55 | if (val) { | 55 | if (val) { |
| 56 | ah->paprd_table_write_done = true; | 56 | ah->paprd_table_write_done = true; |
| 57 | ath9k_hw_apply_txpower(ah, chan); | 57 | ath9k_hw_apply_txpower(ah, chan, false); |
| 58 | } | 58 | } |
| 59 | 59 | ||
| 60 | REG_RMW_FIELD(ah, AR_PHY_PAPRD_CTRL0_B0, | 60 | REG_RMW_FIELD(ah, AR_PHY_PAPRD_CTRL0_B0, |
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_phy.c b/drivers/net/wireless/ath/ath9k/ar9003_phy.c index bc992b237ae5..deb6cfb2959a 100644 --- a/drivers/net/wireless/ath/ath9k/ar9003_phy.c +++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.c | |||
| @@ -694,7 +694,7 @@ static int ar9003_hw_process_ini(struct ath_hw *ah, | |||
| 694 | ar9003_hw_override_ini(ah); | 694 | ar9003_hw_override_ini(ah); |
| 695 | ar9003_hw_set_channel_regs(ah, chan); | 695 | ar9003_hw_set_channel_regs(ah, chan); |
| 696 | ar9003_hw_set_chain_masks(ah, ah->rxchainmask, ah->txchainmask); | 696 | ar9003_hw_set_chain_masks(ah, ah->rxchainmask, ah->txchainmask); |
| 697 | ath9k_hw_apply_txpower(ah, chan); | 697 | ath9k_hw_apply_txpower(ah, chan, false); |
| 698 | 698 | ||
| 699 | if (AR_SREV_9462(ah)) { | 699 | if (AR_SREV_9462(ah)) { |
| 700 | if (REG_READ_FIELD(ah, AR_PHY_TX_IQCAL_CONTROL_0, | 700 | if (REG_READ_FIELD(ah, AR_PHY_TX_IQCAL_CONTROL_0, |
diff --git a/drivers/net/wireless/ath/ath9k/eeprom_9287.c b/drivers/net/wireless/ath/ath9k/eeprom_9287.c index f272236d8053..b34e8b2990b1 100644 --- a/drivers/net/wireless/ath/ath9k/eeprom_9287.c +++ b/drivers/net/wireless/ath/ath9k/eeprom_9287.c | |||
| @@ -824,6 +824,8 @@ static void ath9k_hw_ar9287_set_txpower(struct ath_hw *ah, | |||
| 824 | regulatory->max_power_level = ratesArray[i]; | 824 | regulatory->max_power_level = ratesArray[i]; |
| 825 | } | 825 | } |
| 826 | 826 | ||
| 827 | ath9k_hw_update_regulatory_maxpower(ah); | ||
| 828 | |||
| 827 | if (test) | 829 | if (test) |
| 828 | return; | 830 | return; |
| 829 | 831 | ||
diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c index 6c69e4e8b1cb..fa84e37bf091 100644 --- a/drivers/net/wireless/ath/ath9k/hw.c +++ b/drivers/net/wireless/ath/ath9k/hw.c | |||
| @@ -1454,7 +1454,7 @@ static bool ath9k_hw_channel_change(struct ath_hw *ah, | |||
| 1454 | return false; | 1454 | return false; |
| 1455 | } | 1455 | } |
| 1456 | ath9k_hw_set_clockrate(ah); | 1456 | ath9k_hw_set_clockrate(ah); |
| 1457 | ath9k_hw_apply_txpower(ah, chan); | 1457 | ath9k_hw_apply_txpower(ah, chan, false); |
| 1458 | ath9k_hw_rfbus_done(ah); | 1458 | ath9k_hw_rfbus_done(ah); |
| 1459 | 1459 | ||
| 1460 | if (IS_CHAN_OFDM(chan) || IS_CHAN_HT(chan)) | 1460 | if (IS_CHAN_OFDM(chan) || IS_CHAN_HT(chan)) |
| @@ -2652,7 +2652,8 @@ static int get_antenna_gain(struct ath_hw *ah, struct ath9k_channel *chan) | |||
| 2652 | return ah->eep_ops->get_eeprom(ah, gain_param); | 2652 | return ah->eep_ops->get_eeprom(ah, gain_param); |
| 2653 | } | 2653 | } |
| 2654 | 2654 | ||
| 2655 | void ath9k_hw_apply_txpower(struct ath_hw *ah, struct ath9k_channel *chan) | 2655 | void ath9k_hw_apply_txpower(struct ath_hw *ah, struct ath9k_channel *chan, |
| 2656 | bool test) | ||
| 2656 | { | 2657 | { |
| 2657 | struct ath_regulatory *reg = ath9k_hw_regulatory(ah); | 2658 | struct ath_regulatory *reg = ath9k_hw_regulatory(ah); |
| 2658 | struct ieee80211_channel *channel; | 2659 | struct ieee80211_channel *channel; |
| @@ -2673,7 +2674,7 @@ void ath9k_hw_apply_txpower(struct ath_hw *ah, struct ath9k_channel *chan) | |||
| 2673 | 2674 | ||
| 2674 | ah->eep_ops->set_txpower(ah, chan, | 2675 | ah->eep_ops->set_txpower(ah, chan, |
| 2675 | ath9k_regd_get_ctl(reg, chan), | 2676 | ath9k_regd_get_ctl(reg, chan), |
| 2676 | ant_reduction, new_pwr, false); | 2677 | ant_reduction, new_pwr, test); |
| 2677 | } | 2678 | } |
| 2678 | 2679 | ||
| 2679 | void ath9k_hw_set_txpowerlimit(struct ath_hw *ah, u32 limit, bool test) | 2680 | void ath9k_hw_set_txpowerlimit(struct ath_hw *ah, u32 limit, bool test) |
| @@ -2686,7 +2687,7 @@ void ath9k_hw_set_txpowerlimit(struct ath_hw *ah, u32 limit, bool test) | |||
| 2686 | if (test) | 2687 | if (test) |
| 2687 | channel->max_power = MAX_RATE_POWER / 2; | 2688 | channel->max_power = MAX_RATE_POWER / 2; |
| 2688 | 2689 | ||
| 2689 | ath9k_hw_apply_txpower(ah, chan); | 2690 | ath9k_hw_apply_txpower(ah, chan, test); |
| 2690 | 2691 | ||
| 2691 | if (test) | 2692 | if (test) |
| 2692 | channel->max_power = DIV_ROUND_UP(reg->max_power_level, 2); | 2693 | channel->max_power = DIV_ROUND_UP(reg->max_power_level, 2); |
diff --git a/drivers/net/wireless/ath/ath9k/hw.h b/drivers/net/wireless/ath/ath9k/hw.h index aa1680a0c7fd..e88f182ff45c 100644 --- a/drivers/net/wireless/ath/ath9k/hw.h +++ b/drivers/net/wireless/ath/ath9k/hw.h | |||
| @@ -985,7 +985,8 @@ void ath9k_hw_name(struct ath_hw *ah, char *hw_name, size_t len); | |||
| 985 | /* PHY */ | 985 | /* PHY */ |
| 986 | void ath9k_hw_get_delta_slope_vals(struct ath_hw *ah, u32 coef_scaled, | 986 | void ath9k_hw_get_delta_slope_vals(struct ath_hw *ah, u32 coef_scaled, |
| 987 | u32 *coef_mantissa, u32 *coef_exponent); | 987 | u32 *coef_mantissa, u32 *coef_exponent); |
| 988 | void ath9k_hw_apply_txpower(struct ath_hw *ah, struct ath9k_channel *chan); | 988 | void ath9k_hw_apply_txpower(struct ath_hw *ah, struct ath9k_channel *chan, |
| 989 | bool test); | ||
| 989 | 990 | ||
| 990 | /* | 991 | /* |
| 991 | * Code Specific to AR5008, AR9001 or AR9002, | 992 | * Code Specific to AR5008, AR9001 or AR9002, |
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c index 2504ab005589..798ea57252b4 100644 --- a/drivers/net/wireless/ath/ath9k/main.c +++ b/drivers/net/wireless/ath/ath9k/main.c | |||
| @@ -1548,6 +1548,7 @@ static int ath9k_config(struct ieee80211_hw *hw, u32 changed) | |||
| 1548 | struct ath_hw *ah = sc->sc_ah; | 1548 | struct ath_hw *ah = sc->sc_ah; |
| 1549 | struct ath_common *common = ath9k_hw_common(ah); | 1549 | struct ath_common *common = ath9k_hw_common(ah); |
| 1550 | struct ieee80211_conf *conf = &hw->conf; | 1550 | struct ieee80211_conf *conf = &hw->conf; |
| 1551 | bool reset_channel = false; | ||
| 1551 | 1552 | ||
| 1552 | ath9k_ps_wakeup(sc); | 1553 | ath9k_ps_wakeup(sc); |
| 1553 | mutex_lock(&sc->mutex); | 1554 | mutex_lock(&sc->mutex); |
| @@ -1556,6 +1557,12 @@ static int ath9k_config(struct ieee80211_hw *hw, u32 changed) | |||
| 1556 | sc->ps_idle = !!(conf->flags & IEEE80211_CONF_IDLE); | 1557 | sc->ps_idle = !!(conf->flags & IEEE80211_CONF_IDLE); |
| 1557 | if (sc->ps_idle) | 1558 | if (sc->ps_idle) |
| 1558 | ath_cancel_work(sc); | 1559 | ath_cancel_work(sc); |
| 1560 | else | ||
| 1561 | /* | ||
| 1562 | * The chip needs a reset to properly wake up from | ||
| 1563 | * full sleep | ||
| 1564 | */ | ||
| 1565 | reset_channel = ah->chip_fullsleep; | ||
| 1559 | } | 1566 | } |
| 1560 | 1567 | ||
| 1561 | /* | 1568 | /* |
| @@ -1584,7 +1591,7 @@ static int ath9k_config(struct ieee80211_hw *hw, u32 changed) | |||
| 1584 | } | 1591 | } |
| 1585 | } | 1592 | } |
| 1586 | 1593 | ||
| 1587 | if (changed & IEEE80211_CONF_CHANGE_CHANNEL) { | 1594 | if ((changed & IEEE80211_CONF_CHANGE_CHANNEL) || reset_channel) { |
| 1588 | struct ieee80211_channel *curchan = hw->conf.channel; | 1595 | struct ieee80211_channel *curchan = hw->conf.channel; |
| 1589 | int pos = curchan->hw_value; | 1596 | int pos = curchan->hw_value; |
| 1590 | int old_pos = -1; | 1597 | int old_pos = -1; |
diff --git a/drivers/net/wireless/ath/ath9k/xmit.c b/drivers/net/wireless/ath/ath9k/xmit.c index 834e6bc45e8b..23eaa1b26ebe 100644 --- a/drivers/net/wireless/ath/ath9k/xmit.c +++ b/drivers/net/wireless/ath/ath9k/xmit.c | |||
| @@ -1820,6 +1820,7 @@ static struct ath_buf *ath_tx_setup_buffer(struct ath_softc *sc, | |||
| 1820 | struct ath_frame_info *fi = get_frame_info(skb); | 1820 | struct ath_frame_info *fi = get_frame_info(skb); |
| 1821 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; | 1821 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; |
| 1822 | struct ath_buf *bf; | 1822 | struct ath_buf *bf; |
| 1823 | int fragno; | ||
| 1823 | u16 seqno; | 1824 | u16 seqno; |
| 1824 | 1825 | ||
| 1825 | bf = ath_tx_get_buffer(sc); | 1826 | bf = ath_tx_get_buffer(sc); |
| @@ -1831,9 +1832,16 @@ static struct ath_buf *ath_tx_setup_buffer(struct ath_softc *sc, | |||
| 1831 | ATH_TXBUF_RESET(bf); | 1832 | ATH_TXBUF_RESET(bf); |
| 1832 | 1833 | ||
| 1833 | if (tid) { | 1834 | if (tid) { |
| 1835 | fragno = le16_to_cpu(hdr->seq_ctrl) & IEEE80211_SCTL_FRAG; | ||
| 1834 | seqno = tid->seq_next; | 1836 | seqno = tid->seq_next; |
| 1835 | hdr->seq_ctrl = cpu_to_le16(tid->seq_next << IEEE80211_SEQ_SEQ_SHIFT); | 1837 | hdr->seq_ctrl = cpu_to_le16(tid->seq_next << IEEE80211_SEQ_SEQ_SHIFT); |
| 1836 | INCR(tid->seq_next, IEEE80211_SEQ_MAX); | 1838 | |
| 1839 | if (fragno) | ||
| 1840 | hdr->seq_ctrl |= cpu_to_le16(fragno); | ||
| 1841 | |||
| 1842 | if (!ieee80211_has_morefrags(hdr->frame_control)) | ||
| 1843 | INCR(tid->seq_next, IEEE80211_SEQ_MAX); | ||
| 1844 | |||
| 1837 | bf->bf_state.seqno = seqno; | 1845 | bf->bf_state.seqno = seqno; |
| 1838 | } | 1846 | } |
| 1839 | 1847 | ||
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c index c79e6638c88d..e4d6dc2e37d1 100644 --- a/drivers/net/wireless/b43/main.c +++ b/drivers/net/wireless/b43/main.c | |||
| @@ -4827,8 +4827,14 @@ static int b43_op_start(struct ieee80211_hw *hw) | |||
| 4827 | out_mutex_unlock: | 4827 | out_mutex_unlock: |
| 4828 | mutex_unlock(&wl->mutex); | 4828 | mutex_unlock(&wl->mutex); |
| 4829 | 4829 | ||
| 4830 | /* reload configuration */ | 4830 | /* |
| 4831 | b43_op_config(hw, ~0); | 4831 | * Configuration may have been overwritten during initialization. |
| 4832 | * Reload the configuration, but only if initialization was | ||
| 4833 | * successful. Reloading the configuration after a failed init | ||
| 4834 | * may hang the system. | ||
| 4835 | */ | ||
| 4836 | if (!err) | ||
| 4837 | b43_op_config(hw, ~0); | ||
| 4832 | 4838 | ||
| 4833 | return err; | 4839 | return err; |
| 4834 | } | 4840 | } |
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh_sdmmc.c b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh_sdmmc.c index 4688904908ec..758c115b556e 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh_sdmmc.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh_sdmmc.c | |||
| @@ -108,9 +108,15 @@ static inline int brcmf_sdioh_f0_write_byte(struct brcmf_sdio_dev *sdiodev, | |||
| 108 | sdio_release_host(sdfunc); | 108 | sdio_release_host(sdfunc); |
| 109 | } | 109 | } |
| 110 | } else if (regaddr == SDIO_CCCR_ABORT) { | 110 | } else if (regaddr == SDIO_CCCR_ABORT) { |
| 111 | sdfunc = kmemdup(sdiodev->func[0], sizeof(struct sdio_func), | ||
| 112 | GFP_KERNEL); | ||
| 113 | if (!sdfunc) | ||
| 114 | return -ENOMEM; | ||
| 115 | sdfunc->num = 0; | ||
| 111 | sdio_claim_host(sdfunc); | 116 | sdio_claim_host(sdfunc); |
| 112 | sdio_writeb(sdfunc, *byte, regaddr, &err_ret); | 117 | sdio_writeb(sdfunc, *byte, regaddr, &err_ret); |
| 113 | sdio_release_host(sdfunc); | 118 | sdio_release_host(sdfunc); |
| 119 | kfree(sdfunc); | ||
| 114 | } else if (regaddr < 0xF0) { | 120 | } else if (regaddr < 0xF0) { |
| 115 | brcmf_dbg(ERROR, "F0 Wr:0x%02x: write disallowed\n", regaddr); | 121 | brcmf_dbg(ERROR, "F0 Wr:0x%02x: write disallowed\n", regaddr); |
| 116 | err_ret = -EPERM; | 122 | err_ret = -EPERM; |
| @@ -486,7 +492,7 @@ static int brcmf_ops_sdio_probe(struct sdio_func *func, | |||
| 486 | kfree(bus_if); | 492 | kfree(bus_if); |
| 487 | return -ENOMEM; | 493 | return -ENOMEM; |
| 488 | } | 494 | } |
| 489 | sdiodev->func[0] = func->card->sdio_func[0]; | 495 | sdiodev->func[0] = func; |
| 490 | sdiodev->func[1] = func; | 496 | sdiodev->func[1] = func; |
| 491 | sdiodev->bus_if = bus_if; | 497 | sdiodev->bus_if = bus_if; |
| 492 | bus_if->bus_priv.sdio = sdiodev; | 498 | bus_if->bus_priv.sdio = sdiodev; |
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c b/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c index 2bf5dda29291..eb3829b03cd3 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c | |||
| @@ -574,6 +574,8 @@ struct brcmf_sdio { | |||
| 574 | 574 | ||
| 575 | struct task_struct *dpc_tsk; | 575 | struct task_struct *dpc_tsk; |
| 576 | struct completion dpc_wait; | 576 | struct completion dpc_wait; |
| 577 | struct list_head dpc_tsklst; | ||
| 578 | spinlock_t dpc_tl_lock; | ||
| 577 | 579 | ||
| 578 | struct semaphore sdsem; | 580 | struct semaphore sdsem; |
| 579 | 581 | ||
| @@ -2594,29 +2596,58 @@ clkwait: | |||
| 2594 | return resched; | 2596 | return resched; |
| 2595 | } | 2597 | } |
| 2596 | 2598 | ||
| 2599 | static inline void brcmf_sdbrcm_adddpctsk(struct brcmf_sdio *bus) | ||
| 2600 | { | ||
| 2601 | struct list_head *new_hd; | ||
| 2602 | unsigned long flags; | ||
| 2603 | |||
| 2604 | if (in_interrupt()) | ||
| 2605 | new_hd = kzalloc(sizeof(struct list_head), GFP_ATOMIC); | ||
| 2606 | else | ||
| 2607 | new_hd = kzalloc(sizeof(struct list_head), GFP_KERNEL); | ||
| 2608 | if (new_hd == NULL) | ||
| 2609 | return; | ||
| 2610 | |||
| 2611 | spin_lock_irqsave(&bus->dpc_tl_lock, flags); | ||
| 2612 | list_add_tail(new_hd, &bus->dpc_tsklst); | ||
| 2613 | spin_unlock_irqrestore(&bus->dpc_tl_lock, flags); | ||
| 2614 | } | ||
| 2615 | |||
| 2597 | static int brcmf_sdbrcm_dpc_thread(void *data) | 2616 | static int brcmf_sdbrcm_dpc_thread(void *data) |
| 2598 | { | 2617 | { |
| 2599 | struct brcmf_sdio *bus = (struct brcmf_sdio *) data; | 2618 | struct brcmf_sdio *bus = (struct brcmf_sdio *) data; |
| 2619 | struct list_head *cur_hd, *tmp_hd; | ||
| 2620 | unsigned long flags; | ||
| 2600 | 2621 | ||
| 2601 | allow_signal(SIGTERM); | 2622 | allow_signal(SIGTERM); |
| 2602 | /* Run until signal received */ | 2623 | /* Run until signal received */ |
| 2603 | while (1) { | 2624 | while (1) { |
| 2604 | if (kthread_should_stop()) | 2625 | if (kthread_should_stop()) |
| 2605 | break; | 2626 | break; |
| 2606 | if (!wait_for_completion_interruptible(&bus->dpc_wait)) { | 2627 | |
| 2607 | /* Call bus dpc unless it indicated down | 2628 | if (list_empty(&bus->dpc_tsklst)) |
| 2608 | (then clean stop) */ | 2629 | if (wait_for_completion_interruptible(&bus->dpc_wait)) |
| 2609 | if (bus->sdiodev->bus_if->state != BRCMF_BUS_DOWN) { | 2630 | break; |
| 2610 | if (brcmf_sdbrcm_dpc(bus)) | 2631 | |
| 2611 | complete(&bus->dpc_wait); | 2632 | spin_lock_irqsave(&bus->dpc_tl_lock, flags); |
| 2612 | } else { | 2633 | list_for_each_safe(cur_hd, tmp_hd, &bus->dpc_tsklst) { |
| 2634 | spin_unlock_irqrestore(&bus->dpc_tl_lock, flags); | ||
| 2635 | |||
| 2636 | if (bus->sdiodev->bus_if->state == BRCMF_BUS_DOWN) { | ||
| 2613 | /* after stopping the bus, exit thread */ | 2637 | /* after stopping the bus, exit thread */ |
| 2614 | brcmf_sdbrcm_bus_stop(bus->sdiodev->dev); | 2638 | brcmf_sdbrcm_bus_stop(bus->sdiodev->dev); |
| 2615 | bus->dpc_tsk = NULL; | 2639 | bus->dpc_tsk = NULL; |
| 2616 | break; | 2640 | break; |
| 2617 | } | 2641 | } |
| 2618 | } else | 2642 | |
| 2619 | break; | 2643 | if (brcmf_sdbrcm_dpc(bus)) |
| 2644 | brcmf_sdbrcm_adddpctsk(bus); | ||
| 2645 | |||
| 2646 | spin_lock_irqsave(&bus->dpc_tl_lock, flags); | ||
| 2647 | list_del(cur_hd); | ||
| 2648 | kfree(cur_hd); | ||
| 2649 | } | ||
| 2650 | spin_unlock_irqrestore(&bus->dpc_tl_lock, flags); | ||
| 2620 | } | 2651 | } |
| 2621 | return 0; | 2652 | return 0; |
| 2622 | } | 2653 | } |
| @@ -2669,8 +2700,10 @@ static int brcmf_sdbrcm_bus_txdata(struct device *dev, struct sk_buff *pkt) | |||
| 2669 | /* Schedule DPC if needed to send queued packet(s) */ | 2700 | /* Schedule DPC if needed to send queued packet(s) */ |
| 2670 | if (!bus->dpc_sched) { | 2701 | if (!bus->dpc_sched) { |
| 2671 | bus->dpc_sched = true; | 2702 | bus->dpc_sched = true; |
| 2672 | if (bus->dpc_tsk) | 2703 | if (bus->dpc_tsk) { |
| 2704 | brcmf_sdbrcm_adddpctsk(bus); | ||
| 2673 | complete(&bus->dpc_wait); | 2705 | complete(&bus->dpc_wait); |
| 2706 | } | ||
| 2674 | } | 2707 | } |
| 2675 | 2708 | ||
| 2676 | return ret; | 2709 | return ret; |
| @@ -3514,8 +3547,10 @@ void brcmf_sdbrcm_isr(void *arg) | |||
| 3514 | brcmf_dbg(ERROR, "isr w/o interrupt configured!\n"); | 3547 | brcmf_dbg(ERROR, "isr w/o interrupt configured!\n"); |
| 3515 | 3548 | ||
| 3516 | bus->dpc_sched = true; | 3549 | bus->dpc_sched = true; |
| 3517 | if (bus->dpc_tsk) | 3550 | if (bus->dpc_tsk) { |
| 3551 | brcmf_sdbrcm_adddpctsk(bus); | ||
| 3518 | complete(&bus->dpc_wait); | 3552 | complete(&bus->dpc_wait); |
| 3553 | } | ||
| 3519 | } | 3554 | } |
| 3520 | 3555 | ||
| 3521 | static bool brcmf_sdbrcm_bus_watchdog(struct brcmf_sdio *bus) | 3556 | static bool brcmf_sdbrcm_bus_watchdog(struct brcmf_sdio *bus) |
| @@ -3559,8 +3594,10 @@ static bool brcmf_sdbrcm_bus_watchdog(struct brcmf_sdio *bus) | |||
| 3559 | bus->ipend = true; | 3594 | bus->ipend = true; |
| 3560 | 3595 | ||
| 3561 | bus->dpc_sched = true; | 3596 | bus->dpc_sched = true; |
| 3562 | if (bus->dpc_tsk) | 3597 | if (bus->dpc_tsk) { |
| 3598 | brcmf_sdbrcm_adddpctsk(bus); | ||
| 3563 | complete(&bus->dpc_wait); | 3599 | complete(&bus->dpc_wait); |
| 3600 | } | ||
| 3564 | } | 3601 | } |
| 3565 | } | 3602 | } |
| 3566 | 3603 | ||
| @@ -3897,6 +3934,8 @@ void *brcmf_sdbrcm_probe(u32 regsva, struct brcmf_sdio_dev *sdiodev) | |||
| 3897 | } | 3934 | } |
| 3898 | /* Initialize DPC thread */ | 3935 | /* Initialize DPC thread */ |
| 3899 | init_completion(&bus->dpc_wait); | 3936 | init_completion(&bus->dpc_wait); |
| 3937 | INIT_LIST_HEAD(&bus->dpc_tsklst); | ||
| 3938 | spin_lock_init(&bus->dpc_tl_lock); | ||
| 3900 | bus->dpc_tsk = kthread_run(brcmf_sdbrcm_dpc_thread, | 3939 | bus->dpc_tsk = kthread_run(brcmf_sdbrcm_dpc_thread, |
| 3901 | bus, "brcmf_dpc"); | 3940 | bus, "brcmf_dpc"); |
| 3902 | if (IS_ERR(bus->dpc_tsk)) { | 3941 | if (IS_ERR(bus->dpc_tsk)) { |
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/main.c b/drivers/net/wireless/brcm80211/brcmsmac/main.c index 231ddf4a674f..b4d92792c502 100644 --- a/drivers/net/wireless/brcm80211/brcmsmac/main.c +++ b/drivers/net/wireless/brcm80211/brcmsmac/main.c | |||
| @@ -847,8 +847,7 @@ brcms_c_dotxstatus(struct brcms_c_info *wlc, struct tx_status *txs) | |||
| 847 | */ | 847 | */ |
| 848 | if (!(txs->status & TX_STATUS_AMPDU) | 848 | if (!(txs->status & TX_STATUS_AMPDU) |
| 849 | && (txs->status & TX_STATUS_INTERMEDIATE)) { | 849 | && (txs->status & TX_STATUS_INTERMEDIATE)) { |
| 850 | wiphy_err(wlc->wiphy, "%s: INTERMEDIATE but not AMPDU\n", | 850 | BCMMSG(wlc->wiphy, "INTERMEDIATE but not AMPDU\n"); |
| 851 | __func__); | ||
| 852 | return false; | 851 | return false; |
| 853 | } | 852 | } |
| 854 | 853 | ||
| @@ -7614,6 +7613,7 @@ brcms_c_recvctl(struct brcms_c_info *wlc, struct d11rxhdr *rxh, | |||
| 7614 | { | 7613 | { |
| 7615 | int len_mpdu; | 7614 | int len_mpdu; |
| 7616 | struct ieee80211_rx_status rx_status; | 7615 | struct ieee80211_rx_status rx_status; |
| 7616 | struct ieee80211_hdr *hdr; | ||
| 7617 | 7617 | ||
| 7618 | memset(&rx_status, 0, sizeof(rx_status)); | 7618 | memset(&rx_status, 0, sizeof(rx_status)); |
| 7619 | prep_mac80211_status(wlc, rxh, p, &rx_status); | 7619 | prep_mac80211_status(wlc, rxh, p, &rx_status); |
| @@ -7623,6 +7623,13 @@ brcms_c_recvctl(struct brcms_c_info *wlc, struct d11rxhdr *rxh, | |||
| 7623 | skb_pull(p, D11_PHY_HDR_LEN); | 7623 | skb_pull(p, D11_PHY_HDR_LEN); |
| 7624 | __skb_trim(p, len_mpdu); | 7624 | __skb_trim(p, len_mpdu); |
| 7625 | 7625 | ||
| 7626 | /* unmute transmit */ | ||
| 7627 | if (wlc->hw->suspended_fifos) { | ||
| 7628 | hdr = (struct ieee80211_hdr *)p->data; | ||
| 7629 | if (ieee80211_is_beacon(hdr->frame_control)) | ||
| 7630 | brcms_b_mute(wlc->hw, false); | ||
| 7631 | } | ||
| 7632 | |||
| 7626 | memcpy(IEEE80211_SKB_RXCB(p), &rx_status, sizeof(rx_status)); | 7633 | memcpy(IEEE80211_SKB_RXCB(p), &rx_status, sizeof(rx_status)); |
| 7627 | ieee80211_rx_irqsafe(wlc->pub->ieee_hw, p); | 7634 | ieee80211_rx_irqsafe(wlc->pub->ieee_hw, p); |
| 7628 | } | 7635 | } |
diff --git a/drivers/net/wireless/ipw2x00/ipw2200.c b/drivers/net/wireless/ipw2x00/ipw2200.c index 2b022571a859..1779db3aa2b0 100644 --- a/drivers/net/wireless/ipw2x00/ipw2200.c +++ b/drivers/net/wireless/ipw2x00/ipw2200.c | |||
| @@ -2191,6 +2191,7 @@ static int __ipw_send_cmd(struct ipw_priv *priv, struct host_cmd *cmd) | |||
| 2191 | { | 2191 | { |
| 2192 | int rc = 0; | 2192 | int rc = 0; |
| 2193 | unsigned long flags; | 2193 | unsigned long flags; |
| 2194 | unsigned long now, end; | ||
| 2194 | 2195 | ||
| 2195 | spin_lock_irqsave(&priv->lock, flags); | 2196 | spin_lock_irqsave(&priv->lock, flags); |
| 2196 | if (priv->status & STATUS_HCMD_ACTIVE) { | 2197 | if (priv->status & STATUS_HCMD_ACTIVE) { |
| @@ -2232,10 +2233,20 @@ static int __ipw_send_cmd(struct ipw_priv *priv, struct host_cmd *cmd) | |||
| 2232 | } | 2233 | } |
| 2233 | spin_unlock_irqrestore(&priv->lock, flags); | 2234 | spin_unlock_irqrestore(&priv->lock, flags); |
| 2234 | 2235 | ||
| 2236 | now = jiffies; | ||
| 2237 | end = now + HOST_COMPLETE_TIMEOUT; | ||
| 2238 | again: | ||
| 2235 | rc = wait_event_interruptible_timeout(priv->wait_command_queue, | 2239 | rc = wait_event_interruptible_timeout(priv->wait_command_queue, |
| 2236 | !(priv-> | 2240 | !(priv-> |
| 2237 | status & STATUS_HCMD_ACTIVE), | 2241 | status & STATUS_HCMD_ACTIVE), |
| 2238 | HOST_COMPLETE_TIMEOUT); | 2242 | end - now); |
| 2243 | if (rc < 0) { | ||
| 2244 | now = jiffies; | ||
| 2245 | if (time_before(now, end)) | ||
| 2246 | goto again; | ||
| 2247 | rc = 0; | ||
| 2248 | } | ||
| 2249 | |||
| 2239 | if (rc == 0) { | 2250 | if (rc == 0) { |
| 2240 | spin_lock_irqsave(&priv->lock, flags); | 2251 | spin_lock_irqsave(&priv->lock, flags); |
| 2241 | if (priv->status & STATUS_HCMD_ACTIVE) { | 2252 | if (priv->status & STATUS_HCMD_ACTIVE) { |
diff --git a/drivers/net/wireless/iwlwifi/iwl-1000.c b/drivers/net/wireless/iwlwifi/iwl-1000.c index 5b0d888f746b..8d80e233bc7a 100644 --- a/drivers/net/wireless/iwlwifi/iwl-1000.c +++ b/drivers/net/wireless/iwlwifi/iwl-1000.c | |||
| @@ -46,8 +46,8 @@ | |||
| 46 | #include "iwl-prph.h" | 46 | #include "iwl-prph.h" |
| 47 | 47 | ||
| 48 | /* Highest firmware API version supported */ | 48 | /* Highest firmware API version supported */ |
| 49 | #define IWL1000_UCODE_API_MAX 6 | 49 | #define IWL1000_UCODE_API_MAX 5 |
| 50 | #define IWL100_UCODE_API_MAX 6 | 50 | #define IWL100_UCODE_API_MAX 5 |
| 51 | 51 | ||
| 52 | /* Oldest version we won't warn about */ | 52 | /* Oldest version we won't warn about */ |
| 53 | #define IWL1000_UCODE_API_OK 5 | 53 | #define IWL1000_UCODE_API_OK 5 |
| @@ -226,5 +226,5 @@ const struct iwl_cfg iwl100_bg_cfg = { | |||
| 226 | IWL_DEVICE_100, | 226 | IWL_DEVICE_100, |
| 227 | }; | 227 | }; |
| 228 | 228 | ||
| 229 | MODULE_FIRMWARE(IWL1000_MODULE_FIRMWARE(IWL1000_UCODE_API_MAX)); | 229 | MODULE_FIRMWARE(IWL1000_MODULE_FIRMWARE(IWL1000_UCODE_API_OK)); |
| 230 | MODULE_FIRMWARE(IWL100_MODULE_FIRMWARE(IWL100_UCODE_API_MAX)); | 230 | MODULE_FIRMWARE(IWL100_MODULE_FIRMWARE(IWL100_UCODE_API_OK)); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-2000.c b/drivers/net/wireless/iwlwifi/iwl-2000.c index 5635b9e2c69e..ea108622e0bd 100644 --- a/drivers/net/wireless/iwlwifi/iwl-2000.c +++ b/drivers/net/wireless/iwlwifi/iwl-2000.c | |||
| @@ -51,10 +51,10 @@ | |||
| 51 | #define IWL135_UCODE_API_MAX 6 | 51 | #define IWL135_UCODE_API_MAX 6 |
| 52 | 52 | ||
| 53 | /* Oldest version we won't warn about */ | 53 | /* Oldest version we won't warn about */ |
| 54 | #define IWL2030_UCODE_API_OK 5 | 54 | #define IWL2030_UCODE_API_OK 6 |
| 55 | #define IWL2000_UCODE_API_OK 5 | 55 | #define IWL2000_UCODE_API_OK 6 |
| 56 | #define IWL105_UCODE_API_OK 5 | 56 | #define IWL105_UCODE_API_OK 6 |
| 57 | #define IWL135_UCODE_API_OK 5 | 57 | #define IWL135_UCODE_API_OK 6 |
| 58 | 58 | ||
| 59 | /* Lowest firmware API version supported */ | 59 | /* Lowest firmware API version supported */ |
| 60 | #define IWL2030_UCODE_API_MIN 5 | 60 | #define IWL2030_UCODE_API_MIN 5 |
| @@ -328,7 +328,7 @@ const struct iwl_cfg iwl135_bgn_cfg = { | |||
| 328 | .ht_params = &iwl2000_ht_params, | 328 | .ht_params = &iwl2000_ht_params, |
| 329 | }; | 329 | }; |
| 330 | 330 | ||
| 331 | MODULE_FIRMWARE(IWL2000_MODULE_FIRMWARE(IWL2000_UCODE_API_MAX)); | 331 | MODULE_FIRMWARE(IWL2000_MODULE_FIRMWARE(IWL2000_UCODE_API_OK)); |
| 332 | MODULE_FIRMWARE(IWL2030_MODULE_FIRMWARE(IWL2030_UCODE_API_MAX)); | 332 | MODULE_FIRMWARE(IWL2030_MODULE_FIRMWARE(IWL2030_UCODE_API_OK)); |
| 333 | MODULE_FIRMWARE(IWL105_MODULE_FIRMWARE(IWL105_UCODE_API_MAX)); | 333 | MODULE_FIRMWARE(IWL105_MODULE_FIRMWARE(IWL105_UCODE_API_OK)); |
| 334 | MODULE_FIRMWARE(IWL135_MODULE_FIRMWARE(IWL135_UCODE_API_MAX)); | 334 | MODULE_FIRMWARE(IWL135_MODULE_FIRMWARE(IWL135_UCODE_API_OK)); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-5000.c b/drivers/net/wireless/iwlwifi/iwl-5000.c index a805e97b89af..de0920c74cdd 100644 --- a/drivers/net/wireless/iwlwifi/iwl-5000.c +++ b/drivers/net/wireless/iwlwifi/iwl-5000.c | |||
| @@ -51,6 +51,10 @@ | |||
| 51 | #define IWL5000_UCODE_API_MAX 5 | 51 | #define IWL5000_UCODE_API_MAX 5 |
| 52 | #define IWL5150_UCODE_API_MAX 2 | 52 | #define IWL5150_UCODE_API_MAX 2 |
| 53 | 53 | ||
| 54 | /* Oldest version we won't warn about */ | ||
| 55 | #define IWL5000_UCODE_API_OK 5 | ||
| 56 | #define IWL5150_UCODE_API_OK 2 | ||
| 57 | |||
| 54 | /* Lowest firmware API version supported */ | 58 | /* Lowest firmware API version supported */ |
| 55 | #define IWL5000_UCODE_API_MIN 1 | 59 | #define IWL5000_UCODE_API_MIN 1 |
| 56 | #define IWL5150_UCODE_API_MIN 1 | 60 | #define IWL5150_UCODE_API_MIN 1 |
| @@ -326,6 +330,7 @@ static const struct iwl_ht_params iwl5000_ht_params = { | |||
| 326 | #define IWL_DEVICE_5000 \ | 330 | #define IWL_DEVICE_5000 \ |
| 327 | .fw_name_pre = IWL5000_FW_PRE, \ | 331 | .fw_name_pre = IWL5000_FW_PRE, \ |
| 328 | .ucode_api_max = IWL5000_UCODE_API_MAX, \ | 332 | .ucode_api_max = IWL5000_UCODE_API_MAX, \ |
| 333 | .ucode_api_ok = IWL5000_UCODE_API_OK, \ | ||
| 329 | .ucode_api_min = IWL5000_UCODE_API_MIN, \ | 334 | .ucode_api_min = IWL5000_UCODE_API_MIN, \ |
| 330 | .max_inst_size = IWLAGN_RTC_INST_SIZE, \ | 335 | .max_inst_size = IWLAGN_RTC_INST_SIZE, \ |
| 331 | .max_data_size = IWLAGN_RTC_DATA_SIZE, \ | 336 | .max_data_size = IWLAGN_RTC_DATA_SIZE, \ |
| @@ -371,6 +376,7 @@ const struct iwl_cfg iwl5350_agn_cfg = { | |||
| 371 | .name = "Intel(R) WiMAX/WiFi Link 5350 AGN", | 376 | .name = "Intel(R) WiMAX/WiFi Link 5350 AGN", |
| 372 | .fw_name_pre = IWL5000_FW_PRE, | 377 | .fw_name_pre = IWL5000_FW_PRE, |
| 373 | .ucode_api_max = IWL5000_UCODE_API_MAX, | 378 | .ucode_api_max = IWL5000_UCODE_API_MAX, |
| 379 | .ucode_api_ok = IWL5000_UCODE_API_OK, | ||
| 374 | .ucode_api_min = IWL5000_UCODE_API_MIN, | 380 | .ucode_api_min = IWL5000_UCODE_API_MIN, |
| 375 | .max_inst_size = IWLAGN_RTC_INST_SIZE, | 381 | .max_inst_size = IWLAGN_RTC_INST_SIZE, |
| 376 | .max_data_size = IWLAGN_RTC_DATA_SIZE, | 382 | .max_data_size = IWLAGN_RTC_DATA_SIZE, |
| @@ -386,6 +392,7 @@ const struct iwl_cfg iwl5350_agn_cfg = { | |||
| 386 | #define IWL_DEVICE_5150 \ | 392 | #define IWL_DEVICE_5150 \ |
| 387 | .fw_name_pre = IWL5150_FW_PRE, \ | 393 | .fw_name_pre = IWL5150_FW_PRE, \ |
| 388 | .ucode_api_max = IWL5150_UCODE_API_MAX, \ | 394 | .ucode_api_max = IWL5150_UCODE_API_MAX, \ |
| 395 | .ucode_api_ok = IWL5150_UCODE_API_OK, \ | ||
| 389 | .ucode_api_min = IWL5150_UCODE_API_MIN, \ | 396 | .ucode_api_min = IWL5150_UCODE_API_MIN, \ |
| 390 | .max_inst_size = IWLAGN_RTC_INST_SIZE, \ | 397 | .max_inst_size = IWLAGN_RTC_INST_SIZE, \ |
| 391 | .max_data_size = IWLAGN_RTC_DATA_SIZE, \ | 398 | .max_data_size = IWLAGN_RTC_DATA_SIZE, \ |
| @@ -409,5 +416,5 @@ const struct iwl_cfg iwl5150_abg_cfg = { | |||
| 409 | IWL_DEVICE_5150, | 416 | IWL_DEVICE_5150, |
| 410 | }; | 417 | }; |
| 411 | 418 | ||
| 412 | MODULE_FIRMWARE(IWL5000_MODULE_FIRMWARE(IWL5000_UCODE_API_MAX)); | 419 | MODULE_FIRMWARE(IWL5000_MODULE_FIRMWARE(IWL5000_UCODE_API_OK)); |
| 413 | MODULE_FIRMWARE(IWL5150_MODULE_FIRMWARE(IWL5150_UCODE_API_MAX)); | 420 | MODULE_FIRMWARE(IWL5150_MODULE_FIRMWARE(IWL5150_UCODE_API_OK)); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-6000.c b/drivers/net/wireless/iwlwifi/iwl-6000.c index 64060cd738b5..f0c91505a7f7 100644 --- a/drivers/net/wireless/iwlwifi/iwl-6000.c +++ b/drivers/net/wireless/iwlwifi/iwl-6000.c | |||
| @@ -53,6 +53,8 @@ | |||
| 53 | /* Oldest version we won't warn about */ | 53 | /* Oldest version we won't warn about */ |
| 54 | #define IWL6000_UCODE_API_OK 4 | 54 | #define IWL6000_UCODE_API_OK 4 |
| 55 | #define IWL6000G2_UCODE_API_OK 5 | 55 | #define IWL6000G2_UCODE_API_OK 5 |
| 56 | #define IWL6050_UCODE_API_OK 5 | ||
| 57 | #define IWL6000G2B_UCODE_API_OK 6 | ||
| 56 | 58 | ||
| 57 | /* Lowest firmware API version supported */ | 59 | /* Lowest firmware API version supported */ |
| 58 | #define IWL6000_UCODE_API_MIN 4 | 60 | #define IWL6000_UCODE_API_MIN 4 |
| @@ -388,7 +390,7 @@ const struct iwl_cfg iwl6005_2agn_mow2_cfg = { | |||
| 388 | #define IWL_DEVICE_6030 \ | 390 | #define IWL_DEVICE_6030 \ |
| 389 | .fw_name_pre = IWL6030_FW_PRE, \ | 391 | .fw_name_pre = IWL6030_FW_PRE, \ |
| 390 | .ucode_api_max = IWL6000G2_UCODE_API_MAX, \ | 392 | .ucode_api_max = IWL6000G2_UCODE_API_MAX, \ |
| 391 | .ucode_api_ok = IWL6000G2_UCODE_API_OK, \ | 393 | .ucode_api_ok = IWL6000G2B_UCODE_API_OK, \ |
| 392 | .ucode_api_min = IWL6000G2_UCODE_API_MIN, \ | 394 | .ucode_api_min = IWL6000G2_UCODE_API_MIN, \ |
| 393 | .max_inst_size = IWL60_RTC_INST_SIZE, \ | 395 | .max_inst_size = IWL60_RTC_INST_SIZE, \ |
| 394 | .max_data_size = IWL60_RTC_DATA_SIZE, \ | 396 | .max_data_size = IWL60_RTC_DATA_SIZE, \ |
| @@ -557,6 +559,6 @@ const struct iwl_cfg iwl6000_3agn_cfg = { | |||
| 557 | }; | 559 | }; |
| 558 | 560 | ||
| 559 | MODULE_FIRMWARE(IWL6000_MODULE_FIRMWARE(IWL6000_UCODE_API_OK)); | 561 | MODULE_FIRMWARE(IWL6000_MODULE_FIRMWARE(IWL6000_UCODE_API_OK)); |
| 560 | MODULE_FIRMWARE(IWL6050_MODULE_FIRMWARE(IWL6050_UCODE_API_MAX)); | 562 | MODULE_FIRMWARE(IWL6050_MODULE_FIRMWARE(IWL6050_UCODE_API_OK)); |
| 561 | MODULE_FIRMWARE(IWL6005_MODULE_FIRMWARE(IWL6000G2_UCODE_API_MAX)); | 563 | MODULE_FIRMWARE(IWL6005_MODULE_FIRMWARE(IWL6000G2_UCODE_API_OK)); |
| 562 | MODULE_FIRMWARE(IWL6030_MODULE_FIRMWARE(IWL6000G2_UCODE_API_MAX)); | 564 | MODULE_FIRMWARE(IWL6030_MODULE_FIRMWARE(IWL6000G2B_UCODE_API_OK)); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c index f1226dbf789d..2a9a16f901c3 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn.c | |||
| @@ -863,7 +863,6 @@ static void iwl_bg_run_time_calib_work(struct work_struct *work) | |||
| 863 | 863 | ||
| 864 | void iwlagn_prepare_restart(struct iwl_priv *priv) | 864 | void iwlagn_prepare_restart(struct iwl_priv *priv) |
| 865 | { | 865 | { |
| 866 | struct iwl_rxon_context *ctx; | ||
| 867 | bool bt_full_concurrent; | 866 | bool bt_full_concurrent; |
| 868 | u8 bt_ci_compliance; | 867 | u8 bt_ci_compliance; |
| 869 | u8 bt_load; | 868 | u8 bt_load; |
| @@ -872,8 +871,6 @@ void iwlagn_prepare_restart(struct iwl_priv *priv) | |||
| 872 | 871 | ||
| 873 | lockdep_assert_held(&priv->mutex); | 872 | lockdep_assert_held(&priv->mutex); |
| 874 | 873 | ||
| 875 | for_each_context(priv, ctx) | ||
| 876 | ctx->vif = NULL; | ||
| 877 | priv->is_open = 0; | 874 | priv->is_open = 0; |
| 878 | 875 | ||
| 879 | /* | 876 | /* |
diff --git a/drivers/net/wireless/iwlwifi/iwl-fh.h b/drivers/net/wireless/iwlwifi/iwl-fh.h index 90208094b8eb..74bce97a8600 100644 --- a/drivers/net/wireless/iwlwifi/iwl-fh.h +++ b/drivers/net/wireless/iwlwifi/iwl-fh.h | |||
| @@ -104,15 +104,29 @@ | |||
| 104 | * (see struct iwl_tfd_frame). These 16 pointer registers are offset by 0x04 | 104 | * (see struct iwl_tfd_frame). These 16 pointer registers are offset by 0x04 |
| 105 | * bytes from one another. Each TFD circular buffer in DRAM must be 256-byte | 105 | * bytes from one another. Each TFD circular buffer in DRAM must be 256-byte |
| 106 | * aligned (address bits 0-7 must be 0). | 106 | * aligned (address bits 0-7 must be 0). |
| 107 | * Later devices have 20 (5000 series) or 30 (higher) queues, but the registers | ||
| 108 | * for them are in different places. | ||
| 107 | * | 109 | * |
| 108 | * Bit fields in each pointer register: | 110 | * Bit fields in each pointer register: |
| 109 | * 27-0: TFD CB physical base address [35:8], must be 256-byte aligned | 111 | * 27-0: TFD CB physical base address [35:8], must be 256-byte aligned |
| 110 | */ | 112 | */ |
| 111 | #define FH_MEM_CBBC_LOWER_BOUND (FH_MEM_LOWER_BOUND + 0x9D0) | 113 | #define FH_MEM_CBBC_0_15_LOWER_BOUND (FH_MEM_LOWER_BOUND + 0x9D0) |
| 112 | #define FH_MEM_CBBC_UPPER_BOUND (FH_MEM_LOWER_BOUND + 0xA10) | 114 | #define FH_MEM_CBBC_0_15_UPPER_BOUND (FH_MEM_LOWER_BOUND + 0xA10) |
| 113 | 115 | #define FH_MEM_CBBC_16_19_LOWER_BOUND (FH_MEM_LOWER_BOUND + 0xBF0) | |
| 114 | /* Find TFD CB base pointer for given queue (range 0-15). */ | 116 | #define FH_MEM_CBBC_16_19_UPPER_BOUND (FH_MEM_LOWER_BOUND + 0xC00) |
| 115 | #define FH_MEM_CBBC_QUEUE(x) (FH_MEM_CBBC_LOWER_BOUND + (x) * 0x4) | 117 | #define FH_MEM_CBBC_20_31_LOWER_BOUND (FH_MEM_LOWER_BOUND + 0xB20) |
| 118 | #define FH_MEM_CBBC_20_31_UPPER_BOUND (FH_MEM_LOWER_BOUND + 0xB80) | ||
| 119 | |||
| 120 | /* Find TFD CB base pointer for given queue */ | ||
| 121 | static inline unsigned int FH_MEM_CBBC_QUEUE(unsigned int chnl) | ||
| 122 | { | ||
| 123 | if (chnl < 16) | ||
| 124 | return FH_MEM_CBBC_0_15_LOWER_BOUND + 4 * chnl; | ||
| 125 | if (chnl < 20) | ||
| 126 | return FH_MEM_CBBC_16_19_LOWER_BOUND + 4 * (chnl - 16); | ||
| 127 | WARN_ON_ONCE(chnl >= 32); | ||
| 128 | return FH_MEM_CBBC_20_31_LOWER_BOUND + 4 * (chnl - 20); | ||
| 129 | } | ||
| 116 | 130 | ||
| 117 | 131 | ||
| 118 | /** | 132 | /** |
diff --git a/drivers/net/wireless/iwlwifi/iwl-mac80211.c b/drivers/net/wireless/iwlwifi/iwl-mac80211.c index b6805f8e9a01..c24a7134a6f9 100644 --- a/drivers/net/wireless/iwlwifi/iwl-mac80211.c +++ b/drivers/net/wireless/iwlwifi/iwl-mac80211.c | |||
| @@ -1244,6 +1244,7 @@ static int iwlagn_mac_add_interface(struct ieee80211_hw *hw, | |||
| 1244 | struct iwl_rxon_context *tmp, *ctx = NULL; | 1244 | struct iwl_rxon_context *tmp, *ctx = NULL; |
| 1245 | int err; | 1245 | int err; |
| 1246 | enum nl80211_iftype viftype = ieee80211_vif_type_p2p(vif); | 1246 | enum nl80211_iftype viftype = ieee80211_vif_type_p2p(vif); |
| 1247 | bool reset = false; | ||
| 1247 | 1248 | ||
| 1248 | IWL_DEBUG_MAC80211(priv, "enter: type %d, addr %pM\n", | 1249 | IWL_DEBUG_MAC80211(priv, "enter: type %d, addr %pM\n", |
| 1249 | viftype, vif->addr); | 1250 | viftype, vif->addr); |
| @@ -1265,6 +1266,13 @@ static int iwlagn_mac_add_interface(struct ieee80211_hw *hw, | |||
| 1265 | tmp->interface_modes | tmp->exclusive_interface_modes; | 1266 | tmp->interface_modes | tmp->exclusive_interface_modes; |
| 1266 | 1267 | ||
| 1267 | if (tmp->vif) { | 1268 | if (tmp->vif) { |
| 1269 | /* On reset we need to add the same interface again */ | ||
| 1270 | if (tmp->vif == vif) { | ||
| 1271 | reset = true; | ||
| 1272 | ctx = tmp; | ||
| 1273 | break; | ||
| 1274 | } | ||
| 1275 | |||
| 1268 | /* check if this busy context is exclusive */ | 1276 | /* check if this busy context is exclusive */ |
| 1269 | if (tmp->exclusive_interface_modes & | 1277 | if (tmp->exclusive_interface_modes & |
| 1270 | BIT(tmp->vif->type)) { | 1278 | BIT(tmp->vif->type)) { |
| @@ -1291,7 +1299,7 @@ static int iwlagn_mac_add_interface(struct ieee80211_hw *hw, | |||
| 1291 | ctx->vif = vif; | 1299 | ctx->vif = vif; |
| 1292 | 1300 | ||
| 1293 | err = iwl_setup_interface(priv, ctx); | 1301 | err = iwl_setup_interface(priv, ctx); |
| 1294 | if (!err) | 1302 | if (!err || reset) |
| 1295 | goto out; | 1303 | goto out; |
| 1296 | 1304 | ||
| 1297 | ctx->vif = NULL; | 1305 | ctx->vif = NULL; |
diff --git a/drivers/net/wireless/iwlwifi/iwl-prph.h b/drivers/net/wireless/iwlwifi/iwl-prph.h index 75dc20bd965b..3b1069290fa9 100644 --- a/drivers/net/wireless/iwlwifi/iwl-prph.h +++ b/drivers/net/wireless/iwlwifi/iwl-prph.h | |||
| @@ -223,12 +223,33 @@ | |||
| 223 | #define SCD_AIT (SCD_BASE + 0x0c) | 223 | #define SCD_AIT (SCD_BASE + 0x0c) |
| 224 | #define SCD_TXFACT (SCD_BASE + 0x10) | 224 | #define SCD_TXFACT (SCD_BASE + 0x10) |
| 225 | #define SCD_ACTIVE (SCD_BASE + 0x14) | 225 | #define SCD_ACTIVE (SCD_BASE + 0x14) |
| 226 | #define SCD_QUEUE_WRPTR(x) (SCD_BASE + 0x18 + (x) * 4) | ||
| 227 | #define SCD_QUEUE_RDPTR(x) (SCD_BASE + 0x68 + (x) * 4) | ||
| 228 | #define SCD_QUEUECHAIN_SEL (SCD_BASE + 0xe8) | 226 | #define SCD_QUEUECHAIN_SEL (SCD_BASE + 0xe8) |
| 229 | #define SCD_AGGR_SEL (SCD_BASE + 0x248) | 227 | #define SCD_AGGR_SEL (SCD_BASE + 0x248) |
| 230 | #define SCD_INTERRUPT_MASK (SCD_BASE + 0x108) | 228 | #define SCD_INTERRUPT_MASK (SCD_BASE + 0x108) |
| 231 | #define SCD_QUEUE_STATUS_BITS(x) (SCD_BASE + 0x10c + (x) * 4) | 229 | |
| 230 | static inline unsigned int SCD_QUEUE_WRPTR(unsigned int chnl) | ||
| 231 | { | ||
| 232 | if (chnl < 20) | ||
| 233 | return SCD_BASE + 0x18 + chnl * 4; | ||
| 234 | WARN_ON_ONCE(chnl >= 32); | ||
| 235 | return SCD_BASE + 0x284 + (chnl - 20) * 4; | ||
| 236 | } | ||
| 237 | |||
| 238 | static inline unsigned int SCD_QUEUE_RDPTR(unsigned int chnl) | ||
| 239 | { | ||
| 240 | if (chnl < 20) | ||
| 241 | return SCD_BASE + 0x68 + chnl * 4; | ||
| 242 | WARN_ON_ONCE(chnl >= 32); | ||
| 243 | return SCD_BASE + 0x2B4 + (chnl - 20) * 4; | ||
| 244 | } | ||
| 245 | |||
| 246 | static inline unsigned int SCD_QUEUE_STATUS_BITS(unsigned int chnl) | ||
| 247 | { | ||
| 248 | if (chnl < 20) | ||
| 249 | return SCD_BASE + 0x10c + chnl * 4; | ||
| 250 | WARN_ON_ONCE(chnl >= 32); | ||
| 251 | return SCD_BASE + 0x384 + (chnl - 20) * 4; | ||
| 252 | } | ||
| 232 | 253 | ||
| 233 | /*********************** END TX SCHEDULER *************************************/ | 254 | /*********************** END TX SCHEDULER *************************************/ |
| 234 | 255 | ||
diff --git a/drivers/net/wireless/libertas/cfg.c b/drivers/net/wireless/libertas/cfg.c index 3fa1ecebadfd..2fa879b015b6 100644 --- a/drivers/net/wireless/libertas/cfg.c +++ b/drivers/net/wireless/libertas/cfg.c | |||
| @@ -103,7 +103,7 @@ static const u32 cipher_suites[] = { | |||
| 103 | * Convert NL80211's auth_type to the one from Libertas, see chapter 5.9.1 | 103 | * Convert NL80211's auth_type to the one from Libertas, see chapter 5.9.1 |
| 104 | * in the firmware spec | 104 | * in the firmware spec |
| 105 | */ | 105 | */ |
| 106 | static u8 lbs_auth_to_authtype(enum nl80211_auth_type auth_type) | 106 | static int lbs_auth_to_authtype(enum nl80211_auth_type auth_type) |
| 107 | { | 107 | { |
| 108 | int ret = -ENOTSUPP; | 108 | int ret = -ENOTSUPP; |
| 109 | 109 | ||
| @@ -1411,7 +1411,12 @@ static int lbs_cfg_connect(struct wiphy *wiphy, struct net_device *dev, | |||
| 1411 | goto done; | 1411 | goto done; |
| 1412 | } | 1412 | } |
| 1413 | 1413 | ||
| 1414 | lbs_set_authtype(priv, sme); | 1414 | ret = lbs_set_authtype(priv, sme); |
| 1415 | if (ret == -ENOTSUPP) { | ||
| 1416 | wiphy_err(wiphy, "unsupported authtype 0x%x\n", sme->auth_type); | ||
| 1417 | goto done; | ||
| 1418 | } | ||
| 1419 | |||
| 1415 | lbs_set_radio(priv, preamble, 1); | 1420 | lbs_set_radio(priv, preamble, 1); |
| 1416 | 1421 | ||
| 1417 | /* Do the actual association */ | 1422 | /* Do the actual association */ |
diff --git a/drivers/net/wireless/mwifiex/pcie.h b/drivers/net/wireless/mwifiex/pcie.h index 445ff21772e2..2f218f9a3fd3 100644 --- a/drivers/net/wireless/mwifiex/pcie.h +++ b/drivers/net/wireless/mwifiex/pcie.h | |||
| @@ -48,15 +48,15 @@ | |||
| 48 | #define PCIE_HOST_INT_STATUS_MASK 0xC3C | 48 | #define PCIE_HOST_INT_STATUS_MASK 0xC3C |
| 49 | #define PCIE_SCRATCH_2_REG 0xC40 | 49 | #define PCIE_SCRATCH_2_REG 0xC40 |
| 50 | #define PCIE_SCRATCH_3_REG 0xC44 | 50 | #define PCIE_SCRATCH_3_REG 0xC44 |
| 51 | #define PCIE_SCRATCH_4_REG 0xCC0 | 51 | #define PCIE_SCRATCH_4_REG 0xCD0 |
| 52 | #define PCIE_SCRATCH_5_REG 0xCC4 | 52 | #define PCIE_SCRATCH_5_REG 0xCD4 |
| 53 | #define PCIE_SCRATCH_6_REG 0xCC8 | 53 | #define PCIE_SCRATCH_6_REG 0xCD8 |
| 54 | #define PCIE_SCRATCH_7_REG 0xCCC | 54 | #define PCIE_SCRATCH_7_REG 0xCDC |
| 55 | #define PCIE_SCRATCH_8_REG 0xCD0 | 55 | #define PCIE_SCRATCH_8_REG 0xCE0 |
| 56 | #define PCIE_SCRATCH_9_REG 0xCD4 | 56 | #define PCIE_SCRATCH_9_REG 0xCE4 |
| 57 | #define PCIE_SCRATCH_10_REG 0xCD8 | 57 | #define PCIE_SCRATCH_10_REG 0xCE8 |
| 58 | #define PCIE_SCRATCH_11_REG 0xCDC | 58 | #define PCIE_SCRATCH_11_REG 0xCEC |
| 59 | #define PCIE_SCRATCH_12_REG 0xCE0 | 59 | #define PCIE_SCRATCH_12_REG 0xCF0 |
| 60 | 60 | ||
| 61 | #define CPU_INTR_DNLD_RDY BIT(0) | 61 | #define CPU_INTR_DNLD_RDY BIT(0) |
| 62 | #define CPU_INTR_DOOR_BELL BIT(1) | 62 | #define CPU_INTR_DOOR_BELL BIT(1) |
diff --git a/drivers/net/wireless/rtlwifi/pci.c b/drivers/net/wireless/rtlwifi/pci.c index 288b035a3579..cc15fdb36060 100644 --- a/drivers/net/wireless/rtlwifi/pci.c +++ b/drivers/net/wireless/rtlwifi/pci.c | |||
| @@ -1941,6 +1941,7 @@ void rtl_pci_disconnect(struct pci_dev *pdev) | |||
| 1941 | rtl_deinit_deferred_work(hw); | 1941 | rtl_deinit_deferred_work(hw); |
| 1942 | rtlpriv->intf_ops->adapter_stop(hw); | 1942 | rtlpriv->intf_ops->adapter_stop(hw); |
| 1943 | } | 1943 | } |
| 1944 | rtlpriv->cfg->ops->disable_interrupt(hw); | ||
| 1944 | 1945 | ||
| 1945 | /*deinit rfkill */ | 1946 | /*deinit rfkill */ |
| 1946 | rtl_deinit_rfkill(hw); | 1947 | rtl_deinit_rfkill(hw); |
diff --git a/drivers/net/wireless/wl1251/main.c b/drivers/net/wireless/wl1251/main.c index 41302c7b1ad0..d1afb8e3b2ef 100644 --- a/drivers/net/wireless/wl1251/main.c +++ b/drivers/net/wireless/wl1251/main.c | |||
| @@ -479,6 +479,7 @@ static void wl1251_op_stop(struct ieee80211_hw *hw) | |||
| 479 | cancel_work_sync(&wl->irq_work); | 479 | cancel_work_sync(&wl->irq_work); |
| 480 | cancel_work_sync(&wl->tx_work); | 480 | cancel_work_sync(&wl->tx_work); |
| 481 | cancel_work_sync(&wl->filter_work); | 481 | cancel_work_sync(&wl->filter_work); |
| 482 | cancel_delayed_work_sync(&wl->elp_work); | ||
| 482 | 483 | ||
| 483 | mutex_lock(&wl->mutex); | 484 | mutex_lock(&wl->mutex); |
| 484 | 485 | ||
diff --git a/drivers/net/wireless/wl1251/sdio.c b/drivers/net/wireless/wl1251/sdio.c index f78694295c39..1b851f650e07 100644 --- a/drivers/net/wireless/wl1251/sdio.c +++ b/drivers/net/wireless/wl1251/sdio.c | |||
| @@ -315,8 +315,8 @@ static void __devexit wl1251_sdio_remove(struct sdio_func *func) | |||
| 315 | 315 | ||
| 316 | if (wl->irq) | 316 | if (wl->irq) |
| 317 | free_irq(wl->irq, wl); | 317 | free_irq(wl->irq, wl); |
| 318 | kfree(wl_sdio); | ||
| 319 | wl1251_free_hw(wl); | 318 | wl1251_free_hw(wl); |
| 319 | kfree(wl_sdio); | ||
| 320 | 320 | ||
| 321 | sdio_claim_host(func); | 321 | sdio_claim_host(func); |
| 322 | sdio_release_irq(func); | 322 | sdio_release_irq(func); |
diff --git a/drivers/pci/Makefile b/drivers/pci/Makefile index 083a49fee56a..165274c064bc 100644 --- a/drivers/pci/Makefile +++ b/drivers/pci/Makefile | |||
| @@ -42,6 +42,7 @@ obj-$(CONFIG_UNICORE32) += setup-bus.o setup-irq.o | |||
| 42 | obj-$(CONFIG_PARISC) += setup-bus.o | 42 | obj-$(CONFIG_PARISC) += setup-bus.o |
| 43 | obj-$(CONFIG_SUPERH) += setup-bus.o setup-irq.o | 43 | obj-$(CONFIG_SUPERH) += setup-bus.o setup-irq.o |
| 44 | obj-$(CONFIG_PPC) += setup-bus.o | 44 | obj-$(CONFIG_PPC) += setup-bus.o |
| 45 | obj-$(CONFIG_FRV) += setup-bus.o | ||
| 45 | obj-$(CONFIG_MIPS) += setup-bus.o setup-irq.o | 46 | obj-$(CONFIG_MIPS) += setup-bus.o setup-irq.o |
| 46 | obj-$(CONFIG_X86_VISWS) += setup-irq.o | 47 | obj-$(CONFIG_X86_VISWS) += setup-irq.o |
| 47 | obj-$(CONFIG_MN10300) += setup-bus.o | 48 | obj-$(CONFIG_MN10300) += setup-bus.o |
diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c index 0f150f271c2a..1929c0c63b75 100644 --- a/drivers/pci/pci-acpi.c +++ b/drivers/pci/pci-acpi.c | |||
| @@ -200,7 +200,7 @@ static pci_power_t acpi_pci_choose_state(struct pci_dev *pdev) | |||
| 200 | return PCI_D1; | 200 | return PCI_D1; |
| 201 | case ACPI_STATE_D2: | 201 | case ACPI_STATE_D2: |
| 202 | return PCI_D2; | 202 | return PCI_D2; |
| 203 | case ACPI_STATE_D3: | 203 | case ACPI_STATE_D3_HOT: |
| 204 | return PCI_D3hot; | 204 | return PCI_D3hot; |
| 205 | case ACPI_STATE_D3_COLD: | 205 | case ACPI_STATE_D3_COLD: |
| 206 | return PCI_D3cold; | 206 | return PCI_D3cold; |
| @@ -223,7 +223,7 @@ static int acpi_pci_set_power_state(struct pci_dev *dev, pci_power_t state) | |||
| 223 | [PCI_D0] = ACPI_STATE_D0, | 223 | [PCI_D0] = ACPI_STATE_D0, |
| 224 | [PCI_D1] = ACPI_STATE_D1, | 224 | [PCI_D1] = ACPI_STATE_D1, |
| 225 | [PCI_D2] = ACPI_STATE_D2, | 225 | [PCI_D2] = ACPI_STATE_D2, |
| 226 | [PCI_D3hot] = ACPI_STATE_D3, | 226 | [PCI_D3hot] = ACPI_STATE_D3_HOT, |
| 227 | [PCI_D3cold] = ACPI_STATE_D3 | 227 | [PCI_D3cold] = ACPI_STATE_D3 |
| 228 | }; | 228 | }; |
| 229 | int error = -EINVAL; | 229 | int error = -EINVAL; |
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index d20f1334792b..111569ccab43 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c | |||
| @@ -991,8 +991,8 @@ static void pci_restore_config_dword(struct pci_dev *pdev, int offset, | |||
| 991 | } | 991 | } |
| 992 | } | 992 | } |
| 993 | 993 | ||
| 994 | static void pci_restore_config_space(struct pci_dev *pdev, int start, int end, | 994 | static void pci_restore_config_space_range(struct pci_dev *pdev, |
| 995 | int retry) | 995 | int start, int end, int retry) |
| 996 | { | 996 | { |
| 997 | int index; | 997 | int index; |
| 998 | 998 | ||
| @@ -1002,6 +1002,18 @@ static void pci_restore_config_space(struct pci_dev *pdev, int start, int end, | |||
| 1002 | retry); | 1002 | retry); |
| 1003 | } | 1003 | } |
| 1004 | 1004 | ||
| 1005 | static void pci_restore_config_space(struct pci_dev *pdev) | ||
| 1006 | { | ||
| 1007 | if (pdev->hdr_type == PCI_HEADER_TYPE_NORMAL) { | ||
| 1008 | pci_restore_config_space_range(pdev, 10, 15, 0); | ||
| 1009 | /* Restore BARs before the command register. */ | ||
| 1010 | pci_restore_config_space_range(pdev, 4, 9, 10); | ||
| 1011 | pci_restore_config_space_range(pdev, 0, 3, 0); | ||
| 1012 | } else { | ||
| 1013 | pci_restore_config_space_range(pdev, 0, 15, 0); | ||
| 1014 | } | ||
| 1015 | } | ||
| 1016 | |||
| 1005 | /** | 1017 | /** |
| 1006 | * pci_restore_state - Restore the saved state of a PCI device | 1018 | * pci_restore_state - Restore the saved state of a PCI device |
| 1007 | * @dev: - PCI device that we're dealing with | 1019 | * @dev: - PCI device that we're dealing with |
| @@ -1015,13 +1027,7 @@ void pci_restore_state(struct pci_dev *dev) | |||
| 1015 | pci_restore_pcie_state(dev); | 1027 | pci_restore_pcie_state(dev); |
| 1016 | pci_restore_ats_state(dev); | 1028 | pci_restore_ats_state(dev); |
| 1017 | 1029 | ||
| 1018 | pci_restore_config_space(dev, 10, 15, 0); | 1030 | pci_restore_config_space(dev); |
| 1019 | /* | ||
| 1020 | * The Base Address register should be programmed before the command | ||
| 1021 | * register(s) | ||
| 1022 | */ | ||
| 1023 | pci_restore_config_space(dev, 4, 9, 10); | ||
| 1024 | pci_restore_config_space(dev, 0, 3, 0); | ||
| 1025 | 1031 | ||
| 1026 | pci_restore_pcix_state(dev); | 1032 | pci_restore_pcix_state(dev); |
| 1027 | pci_restore_msi_state(dev); | 1033 | pci_restore_msi_state(dev); |
diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c index ec3b8cc188af..df6296c5f47b 100644 --- a/drivers/pinctrl/core.c +++ b/drivers/pinctrl/core.c | |||
| @@ -908,10 +908,6 @@ static int pinctrl_groups_show(struct seq_file *s, void *what) | |||
| 908 | const struct pinctrl_ops *ops = pctldev->desc->pctlops; | 908 | const struct pinctrl_ops *ops = pctldev->desc->pctlops; |
| 909 | unsigned selector = 0; | 909 | unsigned selector = 0; |
| 910 | 910 | ||
| 911 | /* No grouping */ | ||
| 912 | if (!ops) | ||
| 913 | return 0; | ||
| 914 | |||
| 915 | mutex_lock(&pinctrl_mutex); | 911 | mutex_lock(&pinctrl_mutex); |
| 916 | 912 | ||
| 917 | seq_puts(s, "registered pin groups:\n"); | 913 | seq_puts(s, "registered pin groups:\n"); |
| @@ -1225,6 +1221,19 @@ static void pinctrl_remove_device_debugfs(struct pinctrl_dev *pctldev) | |||
| 1225 | 1221 | ||
| 1226 | #endif | 1222 | #endif |
| 1227 | 1223 | ||
| 1224 | static int pinctrl_check_ops(struct pinctrl_dev *pctldev) | ||
| 1225 | { | ||
| 1226 | const struct pinctrl_ops *ops = pctldev->desc->pctlops; | ||
| 1227 | |||
| 1228 | if (!ops || | ||
| 1229 | !ops->list_groups || | ||
| 1230 | !ops->get_group_name || | ||
| 1231 | !ops->get_group_pins) | ||
| 1232 | return -EINVAL; | ||
| 1233 | |||
| 1234 | return 0; | ||
| 1235 | } | ||
| 1236 | |||
| 1228 | /** | 1237 | /** |
| 1229 | * pinctrl_register() - register a pin controller device | 1238 | * pinctrl_register() - register a pin controller device |
| 1230 | * @pctldesc: descriptor for this pin controller | 1239 | * @pctldesc: descriptor for this pin controller |
| @@ -1256,6 +1265,14 @@ struct pinctrl_dev *pinctrl_register(struct pinctrl_desc *pctldesc, | |||
| 1256 | INIT_LIST_HEAD(&pctldev->gpio_ranges); | 1265 | INIT_LIST_HEAD(&pctldev->gpio_ranges); |
| 1257 | pctldev->dev = dev; | 1266 | pctldev->dev = dev; |
| 1258 | 1267 | ||
| 1268 | /* check core ops for sanity */ | ||
| 1269 | ret = pinctrl_check_ops(pctldev); | ||
| 1270 | if (ret) { | ||
| 1271 | pr_err("%s pinctrl ops lacks necessary functions\n", | ||
| 1272 | pctldesc->name); | ||
| 1273 | goto out_err; | ||
| 1274 | } | ||
| 1275 | |||
| 1259 | /* If we're implementing pinmuxing, check the ops for sanity */ | 1276 | /* If we're implementing pinmuxing, check the ops for sanity */ |
| 1260 | if (pctldesc->pmxops) { | 1277 | if (pctldesc->pmxops) { |
| 1261 | ret = pinmux_check_ops(pctldev); | 1278 | ret = pinmux_check_ops(pctldev); |
diff --git a/drivers/platform/x86/acerhdf.c b/drivers/platform/x86/acerhdf.c index bc8384c6f3eb..639db4d0aa76 100644 --- a/drivers/platform/x86/acerhdf.c +++ b/drivers/platform/x86/acerhdf.c | |||
| @@ -50,7 +50,7 @@ | |||
| 50 | */ | 50 | */ |
| 51 | #undef START_IN_KERNEL_MODE | 51 | #undef START_IN_KERNEL_MODE |
| 52 | 52 | ||
| 53 | #define DRV_VER "0.5.24" | 53 | #define DRV_VER "0.5.26" |
| 54 | 54 | ||
| 55 | /* | 55 | /* |
| 56 | * According to the Atom N270 datasheet, | 56 | * According to the Atom N270 datasheet, |
| @@ -83,8 +83,8 @@ static int kernelmode; | |||
| 83 | #endif | 83 | #endif |
| 84 | 84 | ||
| 85 | static unsigned int interval = 10; | 85 | static unsigned int interval = 10; |
| 86 | static unsigned int fanon = 63000; | 86 | static unsigned int fanon = 60000; |
| 87 | static unsigned int fanoff = 58000; | 87 | static unsigned int fanoff = 53000; |
| 88 | static unsigned int verbose; | 88 | static unsigned int verbose; |
| 89 | static unsigned int fanstate = ACERHDF_FAN_AUTO; | 89 | static unsigned int fanstate = ACERHDF_FAN_AUTO; |
| 90 | static char force_bios[16]; | 90 | static char force_bios[16]; |
| @@ -150,6 +150,8 @@ static const struct bios_settings_t bios_tbl[] = { | |||
| 150 | {"Acer", "AOA150", "v0.3308", 0x55, 0x58, {0x20, 0x00} }, | 150 | {"Acer", "AOA150", "v0.3308", 0x55, 0x58, {0x20, 0x00} }, |
| 151 | {"Acer", "AOA150", "v0.3309", 0x55, 0x58, {0x20, 0x00} }, | 151 | {"Acer", "AOA150", "v0.3309", 0x55, 0x58, {0x20, 0x00} }, |
| 152 | {"Acer", "AOA150", "v0.3310", 0x55, 0x58, {0x20, 0x00} }, | 152 | {"Acer", "AOA150", "v0.3310", 0x55, 0x58, {0x20, 0x00} }, |
| 153 | /* LT1005u */ | ||
| 154 | {"Acer", "LT-10Q", "v0.3310", 0x55, 0x58, {0x20, 0x00} }, | ||
| 153 | /* Acer 1410 */ | 155 | /* Acer 1410 */ |
| 154 | {"Acer", "Aspire 1410", "v0.3108", 0x55, 0x58, {0x9e, 0x00} }, | 156 | {"Acer", "Aspire 1410", "v0.3108", 0x55, 0x58, {0x9e, 0x00} }, |
| 155 | {"Acer", "Aspire 1410", "v0.3113", 0x55, 0x58, {0x9e, 0x00} }, | 157 | {"Acer", "Aspire 1410", "v0.3113", 0x55, 0x58, {0x9e, 0x00} }, |
| @@ -161,6 +163,7 @@ static const struct bios_settings_t bios_tbl[] = { | |||
| 161 | {"Acer", "Aspire 1410", "v1.3303", 0x55, 0x58, {0x9e, 0x00} }, | 163 | {"Acer", "Aspire 1410", "v1.3303", 0x55, 0x58, {0x9e, 0x00} }, |
| 162 | {"Acer", "Aspire 1410", "v1.3308", 0x55, 0x58, {0x9e, 0x00} }, | 164 | {"Acer", "Aspire 1410", "v1.3308", 0x55, 0x58, {0x9e, 0x00} }, |
| 163 | {"Acer", "Aspire 1410", "v1.3310", 0x55, 0x58, {0x9e, 0x00} }, | 165 | {"Acer", "Aspire 1410", "v1.3310", 0x55, 0x58, {0x9e, 0x00} }, |
| 166 | {"Acer", "Aspire 1410", "v1.3314", 0x55, 0x58, {0x9e, 0x00} }, | ||
| 164 | /* Acer 1810xx */ | 167 | /* Acer 1810xx */ |
| 165 | {"Acer", "Aspire 1810TZ", "v0.3108", 0x55, 0x58, {0x9e, 0x00} }, | 168 | {"Acer", "Aspire 1810TZ", "v0.3108", 0x55, 0x58, {0x9e, 0x00} }, |
| 166 | {"Acer", "Aspire 1810T", "v0.3108", 0x55, 0x58, {0x9e, 0x00} }, | 169 | {"Acer", "Aspire 1810T", "v0.3108", 0x55, 0x58, {0x9e, 0x00} }, |
| @@ -183,29 +186,44 @@ static const struct bios_settings_t bios_tbl[] = { | |||
| 183 | {"Acer", "Aspire 1810TZ", "v1.3310", 0x55, 0x58, {0x9e, 0x00} }, | 186 | {"Acer", "Aspire 1810TZ", "v1.3310", 0x55, 0x58, {0x9e, 0x00} }, |
| 184 | {"Acer", "Aspire 1810T", "v1.3310", 0x55, 0x58, {0x9e, 0x00} }, | 187 | {"Acer", "Aspire 1810T", "v1.3310", 0x55, 0x58, {0x9e, 0x00} }, |
| 185 | {"Acer", "Aspire 1810TZ", "v1.3314", 0x55, 0x58, {0x9e, 0x00} }, | 188 | {"Acer", "Aspire 1810TZ", "v1.3314", 0x55, 0x58, {0x9e, 0x00} }, |
| 189 | {"Acer", "Aspire 1810T", "v1.3314", 0x55, 0x58, {0x9e, 0x00} }, | ||
| 186 | /* Acer 531 */ | 190 | /* Acer 531 */ |
| 191 | {"Acer", "AO531h", "v0.3104", 0x55, 0x58, {0x20, 0x00} }, | ||
| 187 | {"Acer", "AO531h", "v0.3201", 0x55, 0x58, {0x20, 0x00} }, | 192 | {"Acer", "AO531h", "v0.3201", 0x55, 0x58, {0x20, 0x00} }, |
| 193 | {"Acer", "AO531h", "v0.3304", 0x55, 0x58, {0x20, 0x00} }, | ||
| 194 | /* Acer 751 */ | ||
| 195 | {"Acer", "AO751h", "V0.3212", 0x55, 0x58, {0x21, 0x00} }, | ||
| 196 | /* Acer 1825 */ | ||
| 197 | {"Acer", "Aspire 1825PTZ", "V1.3118", 0x55, 0x58, {0x9e, 0x00} }, | ||
| 198 | {"Acer", "Aspire 1825PTZ", "V1.3127", 0x55, 0x58, {0x9e, 0x00} }, | ||
| 199 | /* Acer TravelMate 7730 */ | ||
| 200 | {"Acer", "TravelMate 7730G", "v0.3509", 0x55, 0x58, {0xaf, 0x00} }, | ||
| 188 | /* Gateway */ | 201 | /* Gateway */ |
| 189 | {"Gateway", "AOA110", "v0.3103", 0x55, 0x58, {0x21, 0x00} }, | 202 | {"Gateway", "AOA110", "v0.3103", 0x55, 0x58, {0x21, 0x00} }, |
| 190 | {"Gateway", "AOA150", "v0.3103", 0x55, 0x58, {0x20, 0x00} }, | 203 | {"Gateway", "AOA150", "v0.3103", 0x55, 0x58, {0x20, 0x00} }, |
| 191 | {"Gateway", "LT31", "v1.3103", 0x55, 0x58, {0x9e, 0x00} }, | 204 | {"Gateway", "LT31", "v1.3103", 0x55, 0x58, {0x9e, 0x00} }, |
| 192 | {"Gateway", "LT31", "v1.3201", 0x55, 0x58, {0x9e, 0x00} }, | 205 | {"Gateway", "LT31", "v1.3201", 0x55, 0x58, {0x9e, 0x00} }, |
| 193 | {"Gateway", "LT31", "v1.3302", 0x55, 0x58, {0x9e, 0x00} }, | 206 | {"Gateway", "LT31", "v1.3302", 0x55, 0x58, {0x9e, 0x00} }, |
| 207 | {"Gateway", "LT31", "v1.3303t", 0x55, 0x58, {0x9e, 0x00} }, | ||
| 194 | /* Packard Bell */ | 208 | /* Packard Bell */ |
| 195 | {"Packard Bell", "DOA150", "v0.3104", 0x55, 0x58, {0x21, 0x00} }, | 209 | {"Packard Bell", "DOA150", "v0.3104", 0x55, 0x58, {0x21, 0x00} }, |
| 196 | {"Packard Bell", "DOA150", "v0.3105", 0x55, 0x58, {0x20, 0x00} }, | 210 | {"Packard Bell", "DOA150", "v0.3105", 0x55, 0x58, {0x20, 0x00} }, |
| 197 | {"Packard Bell", "AOA110", "v0.3105", 0x55, 0x58, {0x21, 0x00} }, | 211 | {"Packard Bell", "AOA110", "v0.3105", 0x55, 0x58, {0x21, 0x00} }, |
| 198 | {"Packard Bell", "AOA150", "v0.3105", 0x55, 0x58, {0x20, 0x00} }, | 212 | {"Packard Bell", "AOA150", "v0.3105", 0x55, 0x58, {0x20, 0x00} }, |
| 199 | {"Packard Bell", "DOTMU", "v1.3303", 0x55, 0x58, {0x9e, 0x00} }, | 213 | {"Packard Bell", "ENBFT", "V1.3118", 0x55, 0x58, {0x9e, 0x00} }, |
| 200 | {"Packard Bell", "DOTMU", "v0.3120", 0x55, 0x58, {0x9e, 0x00} }, | 214 | {"Packard Bell", "ENBFT", "V1.3127", 0x55, 0x58, {0x9e, 0x00} }, |
| 201 | {"Packard Bell", "DOTMU", "v0.3108", 0x55, 0x58, {0x9e, 0x00} }, | 215 | {"Packard Bell", "DOTMU", "v1.3303", 0x55, 0x58, {0x9e, 0x00} }, |
| 202 | {"Packard Bell", "DOTMU", "v0.3113", 0x55, 0x58, {0x9e, 0x00} }, | 216 | {"Packard Bell", "DOTMU", "v0.3120", 0x55, 0x58, {0x9e, 0x00} }, |
| 203 | {"Packard Bell", "DOTMU", "v0.3115", 0x55, 0x58, {0x9e, 0x00} }, | 217 | {"Packard Bell", "DOTMU", "v0.3108", 0x55, 0x58, {0x9e, 0x00} }, |
| 204 | {"Packard Bell", "DOTMU", "v0.3117", 0x55, 0x58, {0x9e, 0x00} }, | 218 | {"Packard Bell", "DOTMU", "v0.3113", 0x55, 0x58, {0x9e, 0x00} }, |
| 205 | {"Packard Bell", "DOTMU", "v0.3119", 0x55, 0x58, {0x9e, 0x00} }, | 219 | {"Packard Bell", "DOTMU", "v0.3115", 0x55, 0x58, {0x9e, 0x00} }, |
| 206 | {"Packard Bell", "DOTMU", "v1.3204", 0x55, 0x58, {0x9e, 0x00} }, | 220 | {"Packard Bell", "DOTMU", "v0.3117", 0x55, 0x58, {0x9e, 0x00} }, |
| 207 | {"Packard Bell", "DOTMA", "v1.3201", 0x55, 0x58, {0x9e, 0x00} }, | 221 | {"Packard Bell", "DOTMU", "v0.3119", 0x55, 0x58, {0x9e, 0x00} }, |
| 208 | {"Packard Bell", "DOTMA", "v1.3302", 0x55, 0x58, {0x9e, 0x00} }, | 222 | {"Packard Bell", "DOTMU", "v1.3204", 0x55, 0x58, {0x9e, 0x00} }, |
| 223 | {"Packard Bell", "DOTMA", "v1.3201", 0x55, 0x58, {0x9e, 0x00} }, | ||
| 224 | {"Packard Bell", "DOTMA", "v1.3302", 0x55, 0x58, {0x9e, 0x00} }, | ||
| 225 | {"Packard Bell", "DOTMA", "v1.3303t", 0x55, 0x58, {0x9e, 0x00} }, | ||
| 226 | {"Packard Bell", "DOTVR46", "v1.3308", 0x55, 0x58, {0x9e, 0x00} }, | ||
| 209 | /* pewpew-terminator */ | 227 | /* pewpew-terminator */ |
| 210 | {"", "", "", 0, 0, {0, 0} } | 228 | {"", "", "", 0, 0, {0, 0} } |
| 211 | }; | 229 | }; |
| @@ -701,15 +719,20 @@ MODULE_LICENSE("GPL"); | |||
| 701 | MODULE_AUTHOR("Peter Feuerer"); | 719 | MODULE_AUTHOR("Peter Feuerer"); |
| 702 | MODULE_DESCRIPTION("Aspire One temperature and fan driver"); | 720 | MODULE_DESCRIPTION("Aspire One temperature and fan driver"); |
| 703 | MODULE_ALIAS("dmi:*:*Acer*:pnAOA*:"); | 721 | MODULE_ALIAS("dmi:*:*Acer*:pnAOA*:"); |
| 722 | MODULE_ALIAS("dmi:*:*Acer*:pnAO751h*:"); | ||
| 704 | MODULE_ALIAS("dmi:*:*Acer*:pnAspire*1410*:"); | 723 | MODULE_ALIAS("dmi:*:*Acer*:pnAspire*1410*:"); |
| 705 | MODULE_ALIAS("dmi:*:*Acer*:pnAspire*1810*:"); | 724 | MODULE_ALIAS("dmi:*:*Acer*:pnAspire*1810*:"); |
| 725 | MODULE_ALIAS("dmi:*:*Acer*:pnAspire*1825PTZ:"); | ||
| 706 | MODULE_ALIAS("dmi:*:*Acer*:pnAO531*:"); | 726 | MODULE_ALIAS("dmi:*:*Acer*:pnAO531*:"); |
| 727 | MODULE_ALIAS("dmi:*:*Acer*:TravelMate*7730G:"); | ||
| 707 | MODULE_ALIAS("dmi:*:*Gateway*:pnAOA*:"); | 728 | MODULE_ALIAS("dmi:*:*Gateway*:pnAOA*:"); |
| 708 | MODULE_ALIAS("dmi:*:*Gateway*:pnLT31*:"); | 729 | MODULE_ALIAS("dmi:*:*Gateway*:pnLT31*:"); |
| 709 | MODULE_ALIAS("dmi:*:*Packard*Bell*:pnAOA*:"); | 730 | MODULE_ALIAS("dmi:*:*Packard*Bell*:pnAOA*:"); |
| 710 | MODULE_ALIAS("dmi:*:*Packard*Bell*:pnDOA*:"); | 731 | MODULE_ALIAS("dmi:*:*Packard*Bell*:pnDOA*:"); |
| 711 | MODULE_ALIAS("dmi:*:*Packard*Bell*:pnDOTMU*:"); | 732 | MODULE_ALIAS("dmi:*:*Packard*Bell*:pnDOTMU*:"); |
| 733 | MODULE_ALIAS("dmi:*:*Packard*Bell*:pnENBFT*:"); | ||
| 712 | MODULE_ALIAS("dmi:*:*Packard*Bell*:pnDOTMA*:"); | 734 | MODULE_ALIAS("dmi:*:*Packard*Bell*:pnDOTMA*:"); |
| 735 | MODULE_ALIAS("dmi:*:*Packard*Bell*:pnDOTVR46*:"); | ||
| 713 | 736 | ||
| 714 | module_init(acerhdf_init); | 737 | module_init(acerhdf_init); |
| 715 | module_exit(acerhdf_exit); | 738 | module_exit(acerhdf_exit); |
diff --git a/drivers/platform/x86/dell-laptop.c b/drivers/platform/x86/dell-laptop.c index a05fc9c955d8..e6c08ee8d46c 100644 --- a/drivers/platform/x86/dell-laptop.c +++ b/drivers/platform/x86/dell-laptop.c | |||
| @@ -212,6 +212,7 @@ static struct dmi_system_id __devinitdata dell_quirks[] = { | |||
| 212 | }, | 212 | }, |
| 213 | .driver_data = &quirk_dell_vostro_v130, | 213 | .driver_data = &quirk_dell_vostro_v130, |
| 214 | }, | 214 | }, |
| 215 | { } | ||
| 215 | }; | 216 | }; |
| 216 | 217 | ||
| 217 | static struct calling_interface_buffer *buffer; | 218 | static struct calling_interface_buffer *buffer; |
diff --git a/drivers/platform/x86/intel_ips.c b/drivers/platform/x86/intel_ips.c index f7ba316e0ed6..0ffdb3cde2bb 100644 --- a/drivers/platform/x86/intel_ips.c +++ b/drivers/platform/x86/intel_ips.c | |||
| @@ -1565,7 +1565,7 @@ static int ips_probe(struct pci_dev *dev, const struct pci_device_id *id) | |||
| 1565 | ips->poll_turbo_status = true; | 1565 | ips->poll_turbo_status = true; |
| 1566 | 1566 | ||
| 1567 | if (!ips_get_i915_syms(ips)) { | 1567 | if (!ips_get_i915_syms(ips)) { |
| 1568 | dev_err(&dev->dev, "failed to get i915 symbols, graphics turbo disabled\n"); | 1568 | dev_info(&dev->dev, "failed to get i915 symbols, graphics turbo disabled until i915 loads\n"); |
| 1569 | ips->gpu_turbo_enabled = false; | 1569 | ips->gpu_turbo_enabled = false; |
| 1570 | } else { | 1570 | } else { |
| 1571 | dev_dbg(&dev->dev, "graphics turbo enabled\n"); | 1571 | dev_dbg(&dev->dev, "graphics turbo enabled\n"); |
diff --git a/drivers/platform/x86/intel_mid_powerbtn.c b/drivers/platform/x86/intel_mid_powerbtn.c index 0a3594c7e912..bcbad8452a6f 100644 --- a/drivers/platform/x86/intel_mid_powerbtn.c +++ b/drivers/platform/x86/intel_mid_powerbtn.c | |||
| @@ -78,7 +78,7 @@ static int __devinit mfld_pb_probe(struct platform_device *pdev) | |||
| 78 | 78 | ||
| 79 | input_set_capability(input, EV_KEY, KEY_POWER); | 79 | input_set_capability(input, EV_KEY, KEY_POWER); |
| 80 | 80 | ||
| 81 | error = request_threaded_irq(irq, NULL, mfld_pb_isr, 0, | 81 | error = request_threaded_irq(irq, NULL, mfld_pb_isr, IRQF_NO_SUSPEND, |
| 82 | DRIVER_NAME, input); | 82 | DRIVER_NAME, input); |
| 83 | if (error) { | 83 | if (error) { |
| 84 | dev_err(&pdev->dev, "Unable to request irq %d for mfld power" | 84 | dev_err(&pdev->dev, "Unable to request irq %d for mfld power" |
diff --git a/drivers/rtc/rtc-ds1307.c b/drivers/rtc/rtc-ds1307.c index cd188ab72f79..c293d0cdb104 100644 --- a/drivers/rtc/rtc-ds1307.c +++ b/drivers/rtc/rtc-ds1307.c | |||
| @@ -902,6 +902,7 @@ read_rtc: | |||
| 902 | } | 902 | } |
| 903 | ds1307->nvram->attr.name = "nvram"; | 903 | ds1307->nvram->attr.name = "nvram"; |
| 904 | ds1307->nvram->attr.mode = S_IRUGO | S_IWUSR; | 904 | ds1307->nvram->attr.mode = S_IRUGO | S_IWUSR; |
| 905 | sysfs_bin_attr_init(ds1307->nvram); | ||
| 905 | ds1307->nvram->read = ds1307_nvram_read, | 906 | ds1307->nvram->read = ds1307_nvram_read, |
| 906 | ds1307->nvram->write = ds1307_nvram_write, | 907 | ds1307->nvram->write = ds1307_nvram_write, |
| 907 | ds1307->nvram->size = chip->nvram_size; | 908 | ds1307->nvram->size = chip->nvram_size; |
diff --git a/drivers/rtc/rtc-mpc5121.c b/drivers/rtc/rtc-mpc5121.c index 42f5f829b3ee..029e421baaed 100644 --- a/drivers/rtc/rtc-mpc5121.c +++ b/drivers/rtc/rtc-mpc5121.c | |||
| @@ -360,12 +360,11 @@ static int __devinit mpc5121_rtc_probe(struct platform_device *op) | |||
| 360 | &mpc5200_rtc_ops, THIS_MODULE); | 360 | &mpc5200_rtc_ops, THIS_MODULE); |
| 361 | } | 361 | } |
| 362 | 362 | ||
| 363 | rtc->rtc->uie_unsupported = 1; | ||
| 364 | |||
| 365 | if (IS_ERR(rtc->rtc)) { | 363 | if (IS_ERR(rtc->rtc)) { |
| 366 | err = PTR_ERR(rtc->rtc); | 364 | err = PTR_ERR(rtc->rtc); |
| 367 | goto out_free_irq; | 365 | goto out_free_irq; |
| 368 | } | 366 | } |
| 367 | rtc->rtc->uie_unsupported = 1; | ||
| 369 | 368 | ||
| 370 | return 0; | 369 | return 0; |
| 371 | 370 | ||
diff --git a/drivers/s390/block/dasd_eckd.c b/drivers/s390/block/dasd_eckd.c index c21871a4e73d..bc2e8a7c265b 100644 --- a/drivers/s390/block/dasd_eckd.c +++ b/drivers/s390/block/dasd_eckd.c | |||
| @@ -2844,6 +2844,7 @@ static struct dasd_ccw_req *dasd_eckd_build_cp_tpm_track( | |||
| 2844 | sector_t recid, trkid; | 2844 | sector_t recid, trkid; |
| 2845 | unsigned int offs; | 2845 | unsigned int offs; |
| 2846 | unsigned int count, count_to_trk_end; | 2846 | unsigned int count, count_to_trk_end; |
| 2847 | int ret; | ||
| 2847 | 2848 | ||
| 2848 | basedev = block->base; | 2849 | basedev = block->base; |
| 2849 | if (rq_data_dir(req) == READ) { | 2850 | if (rq_data_dir(req) == READ) { |
| @@ -2884,8 +2885,8 @@ static struct dasd_ccw_req *dasd_eckd_build_cp_tpm_track( | |||
| 2884 | 2885 | ||
| 2885 | itcw = itcw_init(cqr->data, itcw_size, itcw_op, 0, ctidaw, 0); | 2886 | itcw = itcw_init(cqr->data, itcw_size, itcw_op, 0, ctidaw, 0); |
| 2886 | if (IS_ERR(itcw)) { | 2887 | if (IS_ERR(itcw)) { |
| 2887 | dasd_sfree_request(cqr, startdev); | 2888 | ret = -EINVAL; |
| 2888 | return ERR_PTR(-EINVAL); | 2889 | goto out_error; |
| 2889 | } | 2890 | } |
| 2890 | cqr->cpaddr = itcw_get_tcw(itcw); | 2891 | cqr->cpaddr = itcw_get_tcw(itcw); |
| 2891 | if (prepare_itcw(itcw, first_trk, last_trk, | 2892 | if (prepare_itcw(itcw, first_trk, last_trk, |
| @@ -2897,8 +2898,8 @@ static struct dasd_ccw_req *dasd_eckd_build_cp_tpm_track( | |||
| 2897 | /* Clock not in sync and XRC is enabled. | 2898 | /* Clock not in sync and XRC is enabled. |
| 2898 | * Try again later. | 2899 | * Try again later. |
| 2899 | */ | 2900 | */ |
| 2900 | dasd_sfree_request(cqr, startdev); | 2901 | ret = -EAGAIN; |
| 2901 | return ERR_PTR(-EAGAIN); | 2902 | goto out_error; |
| 2902 | } | 2903 | } |
| 2903 | len_to_track_end = 0; | 2904 | len_to_track_end = 0; |
| 2904 | /* | 2905 | /* |
| @@ -2937,8 +2938,10 @@ static struct dasd_ccw_req *dasd_eckd_build_cp_tpm_track( | |||
| 2937 | tidaw_flags = 0; | 2938 | tidaw_flags = 0; |
| 2938 | last_tidaw = itcw_add_tidaw(itcw, tidaw_flags, | 2939 | last_tidaw = itcw_add_tidaw(itcw, tidaw_flags, |
| 2939 | dst, part_len); | 2940 | dst, part_len); |
| 2940 | if (IS_ERR(last_tidaw)) | 2941 | if (IS_ERR(last_tidaw)) { |
| 2941 | return ERR_PTR(-EINVAL); | 2942 | ret = -EINVAL; |
| 2943 | goto out_error; | ||
| 2944 | } | ||
| 2942 | dst += part_len; | 2945 | dst += part_len; |
| 2943 | } | 2946 | } |
| 2944 | } | 2947 | } |
| @@ -2947,8 +2950,10 @@ static struct dasd_ccw_req *dasd_eckd_build_cp_tpm_track( | |||
| 2947 | dst = page_address(bv->bv_page) + bv->bv_offset; | 2950 | dst = page_address(bv->bv_page) + bv->bv_offset; |
| 2948 | last_tidaw = itcw_add_tidaw(itcw, 0x00, | 2951 | last_tidaw = itcw_add_tidaw(itcw, 0x00, |
| 2949 | dst, bv->bv_len); | 2952 | dst, bv->bv_len); |
| 2950 | if (IS_ERR(last_tidaw)) | 2953 | if (IS_ERR(last_tidaw)) { |
| 2951 | return ERR_PTR(-EINVAL); | 2954 | ret = -EINVAL; |
| 2955 | goto out_error; | ||
| 2956 | } | ||
| 2952 | } | 2957 | } |
| 2953 | } | 2958 | } |
| 2954 | last_tidaw->flags |= TIDAW_FLAGS_LAST; | 2959 | last_tidaw->flags |= TIDAW_FLAGS_LAST; |
| @@ -2968,6 +2973,9 @@ static struct dasd_ccw_req *dasd_eckd_build_cp_tpm_track( | |||
| 2968 | cqr->buildclk = get_clock(); | 2973 | cqr->buildclk = get_clock(); |
| 2969 | cqr->status = DASD_CQR_FILLED; | 2974 | cqr->status = DASD_CQR_FILLED; |
| 2970 | return cqr; | 2975 | return cqr; |
| 2976 | out_error: | ||
| 2977 | dasd_sfree_request(cqr, startdev); | ||
| 2978 | return ERR_PTR(ret); | ||
| 2971 | } | 2979 | } |
| 2972 | 2980 | ||
| 2973 | static struct dasd_ccw_req *dasd_eckd_build_cp(struct dasd_device *startdev, | 2981 | static struct dasd_ccw_req *dasd_eckd_build_cp(struct dasd_device *startdev, |
diff --git a/drivers/s390/char/vmur.c b/drivers/s390/char/vmur.c index 85f4a9a5d12e..73bef0bd394c 100644 --- a/drivers/s390/char/vmur.c +++ b/drivers/s390/char/vmur.c | |||
| @@ -903,7 +903,7 @@ static int ur_set_online(struct ccw_device *cdev) | |||
| 903 | goto fail_urdev_put; | 903 | goto fail_urdev_put; |
| 904 | } | 904 | } |
| 905 | 905 | ||
| 906 | cdev_init(urd->char_device, &ur_fops); | 906 | urd->char_device->ops = &ur_fops; |
| 907 | urd->char_device->dev = MKDEV(major, minor); | 907 | urd->char_device->dev = MKDEV(major, minor); |
| 908 | urd->char_device->owner = ur_fops.owner; | 908 | urd->char_device->owner = ur_fops.owner; |
| 909 | 909 | ||
diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c index 120955c66410..8334dadc681d 100644 --- a/drivers/s390/net/qeth_core_main.c +++ b/drivers/s390/net/qeth_core_main.c | |||
| @@ -1672,7 +1672,8 @@ static void qeth_configure_blkt_default(struct qeth_card *card, char *prcd) | |||
| 1672 | { | 1672 | { |
| 1673 | QETH_DBF_TEXT(SETUP, 2, "cfgblkt"); | 1673 | QETH_DBF_TEXT(SETUP, 2, "cfgblkt"); |
| 1674 | 1674 | ||
| 1675 | if (prcd[74] == 0xF0 && prcd[75] == 0xF0 && prcd[76] == 0xF5) { | 1675 | if (prcd[74] == 0xF0 && prcd[75] == 0xF0 && |
| 1676 | (prcd[76] == 0xF5 || prcd[76] == 0xF6)) { | ||
| 1676 | card->info.blkt.time_total = 250; | 1677 | card->info.blkt.time_total = 250; |
| 1677 | card->info.blkt.inter_packet = 5; | 1678 | card->info.blkt.inter_packet = 5; |
| 1678 | card->info.blkt.inter_packet_jumbo = 15; | 1679 | card->info.blkt.inter_packet_jumbo = 15; |
| @@ -4540,7 +4541,8 @@ static void qeth_determine_capabilities(struct qeth_card *card) | |||
| 4540 | goto out_offline; | 4541 | goto out_offline; |
| 4541 | } | 4542 | } |
| 4542 | qeth_configure_unitaddr(card, prcd); | 4543 | qeth_configure_unitaddr(card, prcd); |
| 4543 | qeth_configure_blkt_default(card, prcd); | 4544 | if (ddev_offline) |
| 4545 | qeth_configure_blkt_default(card, prcd); | ||
| 4544 | kfree(prcd); | 4546 | kfree(prcd); |
| 4545 | 4547 | ||
| 4546 | rc = qdio_get_ssqd_desc(ddev, &card->ssqd); | 4548 | rc = qdio_get_ssqd_desc(ddev, &card->ssqd); |
diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c index e002cd466e9a..467dc38246f9 100644 --- a/drivers/scsi/ipr.c +++ b/drivers/scsi/ipr.c | |||
| @@ -4549,8 +4549,12 @@ static int ipr_ata_slave_alloc(struct scsi_device *sdev) | |||
| 4549 | ENTER; | 4549 | ENTER; |
| 4550 | if (sdev->sdev_target) | 4550 | if (sdev->sdev_target) |
| 4551 | sata_port = sdev->sdev_target->hostdata; | 4551 | sata_port = sdev->sdev_target->hostdata; |
| 4552 | if (sata_port) | 4552 | if (sata_port) { |
| 4553 | rc = ata_sas_port_init(sata_port->ap); | 4553 | rc = ata_sas_port_init(sata_port->ap); |
| 4554 | if (rc == 0) | ||
| 4555 | rc = ata_sas_sync_probe(sata_port->ap); | ||
| 4556 | } | ||
| 4557 | |||
| 4554 | if (rc) | 4558 | if (rc) |
| 4555 | ipr_slave_destroy(sdev); | 4559 | ipr_slave_destroy(sdev); |
| 4556 | 4560 | ||
diff --git a/drivers/scsi/libfc/fc_lport.c b/drivers/scsi/libfc/fc_lport.c index ef9560dff295..cc83b66d45b7 100644 --- a/drivers/scsi/libfc/fc_lport.c +++ b/drivers/scsi/libfc/fc_lport.c | |||
| @@ -1742,17 +1742,19 @@ void fc_lport_flogi_resp(struct fc_seq *sp, struct fc_frame *fp, | |||
| 1742 | 1742 | ||
| 1743 | mfs = ntohs(flp->fl_csp.sp_bb_data) & | 1743 | mfs = ntohs(flp->fl_csp.sp_bb_data) & |
| 1744 | FC_SP_BB_DATA_MASK; | 1744 | FC_SP_BB_DATA_MASK; |
| 1745 | if (mfs >= FC_SP_MIN_MAX_PAYLOAD && | 1745 | |
| 1746 | mfs <= lport->mfs) { | 1746 | if (mfs < FC_SP_MIN_MAX_PAYLOAD || mfs > FC_SP_MAX_MAX_PAYLOAD) { |
| 1747 | lport->mfs = mfs; | ||
| 1748 | fc_host_maxframe_size(lport->host) = mfs; | ||
| 1749 | } else { | ||
| 1750 | FC_LPORT_DBG(lport, "FLOGI bad mfs:%hu response, " | 1747 | FC_LPORT_DBG(lport, "FLOGI bad mfs:%hu response, " |
| 1751 | "lport->mfs:%hu\n", mfs, lport->mfs); | 1748 | "lport->mfs:%hu\n", mfs, lport->mfs); |
| 1752 | fc_lport_error(lport, fp); | 1749 | fc_lport_error(lport, fp); |
| 1753 | goto err; | 1750 | goto err; |
| 1754 | } | 1751 | } |
| 1755 | 1752 | ||
| 1753 | if (mfs <= lport->mfs) { | ||
| 1754 | lport->mfs = mfs; | ||
| 1755 | fc_host_maxframe_size(lport->host) = mfs; | ||
| 1756 | } | ||
| 1757 | |||
| 1756 | csp_flags = ntohs(flp->fl_csp.sp_features); | 1758 | csp_flags = ntohs(flp->fl_csp.sp_features); |
| 1757 | r_a_tov = ntohl(flp->fl_csp.sp_r_a_tov); | 1759 | r_a_tov = ntohl(flp->fl_csp.sp_r_a_tov); |
| 1758 | e_d_tov = ntohl(flp->fl_csp.sp_e_d_tov); | 1760 | e_d_tov = ntohl(flp->fl_csp.sp_e_d_tov); |
diff --git a/drivers/scsi/libsas/sas_ata.c b/drivers/scsi/libsas/sas_ata.c index bc0cecc6ad62..441d88ad99a7 100644 --- a/drivers/scsi/libsas/sas_ata.c +++ b/drivers/scsi/libsas/sas_ata.c | |||
| @@ -546,11 +546,12 @@ static struct ata_port_info sata_port_info = { | |||
| 546 | .port_ops = &sas_sata_ops | 546 | .port_ops = &sas_sata_ops |
| 547 | }; | 547 | }; |
| 548 | 548 | ||
| 549 | int sas_ata_init_host_and_port(struct domain_device *found_dev) | 549 | int sas_ata_init(struct domain_device *found_dev) |
| 550 | { | 550 | { |
| 551 | struct sas_ha_struct *ha = found_dev->port->ha; | 551 | struct sas_ha_struct *ha = found_dev->port->ha; |
| 552 | struct Scsi_Host *shost = ha->core.shost; | 552 | struct Scsi_Host *shost = ha->core.shost; |
| 553 | struct ata_port *ap; | 553 | struct ata_port *ap; |
| 554 | int rc; | ||
| 554 | 555 | ||
| 555 | ata_host_init(&found_dev->sata_dev.ata_host, | 556 | ata_host_init(&found_dev->sata_dev.ata_host, |
| 556 | ha->dev, | 557 | ha->dev, |
| @@ -567,8 +568,11 @@ int sas_ata_init_host_and_port(struct domain_device *found_dev) | |||
| 567 | ap->private_data = found_dev; | 568 | ap->private_data = found_dev; |
| 568 | ap->cbl = ATA_CBL_SATA; | 569 | ap->cbl = ATA_CBL_SATA; |
| 569 | ap->scsi_host = shost; | 570 | ap->scsi_host = shost; |
| 570 | /* publish initialized ata port */ | 571 | rc = ata_sas_port_init(ap); |
| 571 | smp_wmb(); | 572 | if (rc) { |
| 573 | ata_sas_port_destroy(ap); | ||
| 574 | return rc; | ||
| 575 | } | ||
| 572 | found_dev->sata_dev.ap = ap; | 576 | found_dev->sata_dev.ap = ap; |
| 573 | 577 | ||
| 574 | return 0; | 578 | return 0; |
| @@ -648,18 +652,13 @@ static void sas_get_ata_command_set(struct domain_device *dev) | |||
| 648 | void sas_probe_sata(struct asd_sas_port *port) | 652 | void sas_probe_sata(struct asd_sas_port *port) |
| 649 | { | 653 | { |
| 650 | struct domain_device *dev, *n; | 654 | struct domain_device *dev, *n; |
| 651 | int err; | ||
| 652 | 655 | ||
| 653 | mutex_lock(&port->ha->disco_mutex); | 656 | mutex_lock(&port->ha->disco_mutex); |
| 654 | list_for_each_entry_safe(dev, n, &port->disco_list, disco_list_node) { | 657 | list_for_each_entry(dev, &port->disco_list, disco_list_node) { |
| 655 | if (!dev_is_sata(dev)) | 658 | if (!dev_is_sata(dev)) |
| 656 | continue; | 659 | continue; |
| 657 | 660 | ||
| 658 | err = sas_ata_init_host_and_port(dev); | 661 | ata_sas_async_probe(dev->sata_dev.ap); |
| 659 | if (err) | ||
| 660 | sas_fail_probe(dev, __func__, err); | ||
| 661 | else | ||
| 662 | ata_sas_async_port_init(dev->sata_dev.ap); | ||
| 663 | } | 662 | } |
| 664 | mutex_unlock(&port->ha->disco_mutex); | 663 | mutex_unlock(&port->ha->disco_mutex); |
| 665 | 664 | ||
| @@ -718,18 +717,6 @@ static void async_sas_ata_eh(void *data, async_cookie_t cookie) | |||
| 718 | sas_put_device(dev); | 717 | sas_put_device(dev); |
| 719 | } | 718 | } |
| 720 | 719 | ||
| 721 | static bool sas_ata_dev_eh_valid(struct domain_device *dev) | ||
| 722 | { | ||
| 723 | struct ata_port *ap; | ||
| 724 | |||
| 725 | if (!dev_is_sata(dev)) | ||
| 726 | return false; | ||
| 727 | ap = dev->sata_dev.ap; | ||
| 728 | /* consume fully initialized ata ports */ | ||
| 729 | smp_rmb(); | ||
| 730 | return !!ap; | ||
| 731 | } | ||
| 732 | |||
| 733 | void sas_ata_strategy_handler(struct Scsi_Host *shost) | 720 | void sas_ata_strategy_handler(struct Scsi_Host *shost) |
| 734 | { | 721 | { |
| 735 | struct sas_ha_struct *sas_ha = SHOST_TO_SAS_HA(shost); | 722 | struct sas_ha_struct *sas_ha = SHOST_TO_SAS_HA(shost); |
| @@ -753,7 +740,7 @@ void sas_ata_strategy_handler(struct Scsi_Host *shost) | |||
| 753 | 740 | ||
| 754 | spin_lock(&port->dev_list_lock); | 741 | spin_lock(&port->dev_list_lock); |
| 755 | list_for_each_entry(dev, &port->dev_list, dev_list_node) { | 742 | list_for_each_entry(dev, &port->dev_list, dev_list_node) { |
| 756 | if (!sas_ata_dev_eh_valid(dev)) | 743 | if (!dev_is_sata(dev)) |
| 757 | continue; | 744 | continue; |
| 758 | async_schedule_domain(async_sas_ata_eh, dev, &async); | 745 | async_schedule_domain(async_sas_ata_eh, dev, &async); |
| 759 | } | 746 | } |
diff --git a/drivers/scsi/libsas/sas_discover.c b/drivers/scsi/libsas/sas_discover.c index 364679675602..629a0865b130 100644 --- a/drivers/scsi/libsas/sas_discover.c +++ b/drivers/scsi/libsas/sas_discover.c | |||
| @@ -72,6 +72,7 @@ static int sas_get_port_device(struct asd_sas_port *port) | |||
| 72 | struct asd_sas_phy *phy; | 72 | struct asd_sas_phy *phy; |
| 73 | struct sas_rphy *rphy; | 73 | struct sas_rphy *rphy; |
| 74 | struct domain_device *dev; | 74 | struct domain_device *dev; |
| 75 | int rc = -ENODEV; | ||
| 75 | 76 | ||
| 76 | dev = sas_alloc_device(); | 77 | dev = sas_alloc_device(); |
| 77 | if (!dev) | 78 | if (!dev) |
| @@ -110,9 +111,16 @@ static int sas_get_port_device(struct asd_sas_port *port) | |||
| 110 | 111 | ||
| 111 | sas_init_dev(dev); | 112 | sas_init_dev(dev); |
| 112 | 113 | ||
| 114 | dev->port = port; | ||
| 113 | switch (dev->dev_type) { | 115 | switch (dev->dev_type) { |
| 114 | case SAS_END_DEV: | ||
| 115 | case SATA_DEV: | 116 | case SATA_DEV: |
| 117 | rc = sas_ata_init(dev); | ||
| 118 | if (rc) { | ||
| 119 | rphy = NULL; | ||
| 120 | break; | ||
| 121 | } | ||
| 122 | /* fall through */ | ||
| 123 | case SAS_END_DEV: | ||
| 116 | rphy = sas_end_device_alloc(port->port); | 124 | rphy = sas_end_device_alloc(port->port); |
| 117 | break; | 125 | break; |
| 118 | case EDGE_DEV: | 126 | case EDGE_DEV: |
| @@ -131,19 +139,14 @@ static int sas_get_port_device(struct asd_sas_port *port) | |||
| 131 | 139 | ||
| 132 | if (!rphy) { | 140 | if (!rphy) { |
| 133 | sas_put_device(dev); | 141 | sas_put_device(dev); |
| 134 | return -ENODEV; | 142 | return rc; |
| 135 | } | 143 | } |
| 136 | 144 | ||
| 137 | spin_lock_irq(&port->phy_list_lock); | ||
| 138 | list_for_each_entry(phy, &port->phy_list, port_phy_el) | ||
| 139 | sas_phy_set_target(phy, dev); | ||
| 140 | spin_unlock_irq(&port->phy_list_lock); | ||
| 141 | rphy->identify.phy_identifier = phy->phy->identify.phy_identifier; | 145 | rphy->identify.phy_identifier = phy->phy->identify.phy_identifier; |
| 142 | memcpy(dev->sas_addr, port->attached_sas_addr, SAS_ADDR_SIZE); | 146 | memcpy(dev->sas_addr, port->attached_sas_addr, SAS_ADDR_SIZE); |
| 143 | sas_fill_in_rphy(dev, rphy); | 147 | sas_fill_in_rphy(dev, rphy); |
| 144 | sas_hash_addr(dev->hashed_sas_addr, dev->sas_addr); | 148 | sas_hash_addr(dev->hashed_sas_addr, dev->sas_addr); |
| 145 | port->port_dev = dev; | 149 | port->port_dev = dev; |
| 146 | dev->port = port; | ||
| 147 | dev->linkrate = port->linkrate; | 150 | dev->linkrate = port->linkrate; |
| 148 | dev->min_linkrate = port->linkrate; | 151 | dev->min_linkrate = port->linkrate; |
| 149 | dev->max_linkrate = port->linkrate; | 152 | dev->max_linkrate = port->linkrate; |
| @@ -155,6 +158,7 @@ static int sas_get_port_device(struct asd_sas_port *port) | |||
| 155 | sas_device_set_phy(dev, port->port); | 158 | sas_device_set_phy(dev, port->port); |
| 156 | 159 | ||
| 157 | dev->rphy = rphy; | 160 | dev->rphy = rphy; |
| 161 | get_device(&dev->rphy->dev); | ||
| 158 | 162 | ||
| 159 | if (dev_is_sata(dev) || dev->dev_type == SAS_END_DEV) | 163 | if (dev_is_sata(dev) || dev->dev_type == SAS_END_DEV) |
| 160 | list_add_tail(&dev->disco_list_node, &port->disco_list); | 164 | list_add_tail(&dev->disco_list_node, &port->disco_list); |
| @@ -164,6 +168,11 @@ static int sas_get_port_device(struct asd_sas_port *port) | |||
| 164 | spin_unlock_irq(&port->dev_list_lock); | 168 | spin_unlock_irq(&port->dev_list_lock); |
| 165 | } | 169 | } |
| 166 | 170 | ||
| 171 | spin_lock_irq(&port->phy_list_lock); | ||
| 172 | list_for_each_entry(phy, &port->phy_list, port_phy_el) | ||
| 173 | sas_phy_set_target(phy, dev); | ||
| 174 | spin_unlock_irq(&port->phy_list_lock); | ||
| 175 | |||
| 167 | return 0; | 176 | return 0; |
| 168 | } | 177 | } |
| 169 | 178 | ||
| @@ -205,8 +214,7 @@ void sas_notify_lldd_dev_gone(struct domain_device *dev) | |||
| 205 | static void sas_probe_devices(struct work_struct *work) | 214 | static void sas_probe_devices(struct work_struct *work) |
| 206 | { | 215 | { |
| 207 | struct domain_device *dev, *n; | 216 | struct domain_device *dev, *n; |
| 208 | struct sas_discovery_event *ev = | 217 | struct sas_discovery_event *ev = to_sas_discovery_event(work); |
| 209 | container_of(work, struct sas_discovery_event, work); | ||
| 210 | struct asd_sas_port *port = ev->port; | 218 | struct asd_sas_port *port = ev->port; |
| 211 | 219 | ||
| 212 | clear_bit(DISCE_PROBE, &port->disc.pending); | 220 | clear_bit(DISCE_PROBE, &port->disc.pending); |
| @@ -255,6 +263,9 @@ void sas_free_device(struct kref *kref) | |||
| 255 | { | 263 | { |
| 256 | struct domain_device *dev = container_of(kref, typeof(*dev), kref); | 264 | struct domain_device *dev = container_of(kref, typeof(*dev), kref); |
| 257 | 265 | ||
| 266 | put_device(&dev->rphy->dev); | ||
| 267 | dev->rphy = NULL; | ||
| 268 | |||
| 258 | if (dev->parent) | 269 | if (dev->parent) |
| 259 | sas_put_device(dev->parent); | 270 | sas_put_device(dev->parent); |
| 260 | 271 | ||
| @@ -291,8 +302,7 @@ static void sas_unregister_common_dev(struct asd_sas_port *port, struct domain_d | |||
| 291 | static void sas_destruct_devices(struct work_struct *work) | 302 | static void sas_destruct_devices(struct work_struct *work) |
| 292 | { | 303 | { |
| 293 | struct domain_device *dev, *n; | 304 | struct domain_device *dev, *n; |
| 294 | struct sas_discovery_event *ev = | 305 | struct sas_discovery_event *ev = to_sas_discovery_event(work); |
| 295 | container_of(work, struct sas_discovery_event, work); | ||
| 296 | struct asd_sas_port *port = ev->port; | 306 | struct asd_sas_port *port = ev->port; |
| 297 | 307 | ||
| 298 | clear_bit(DISCE_DESTRUCT, &port->disc.pending); | 308 | clear_bit(DISCE_DESTRUCT, &port->disc.pending); |
| @@ -302,7 +312,6 @@ static void sas_destruct_devices(struct work_struct *work) | |||
| 302 | 312 | ||
| 303 | sas_remove_children(&dev->rphy->dev); | 313 | sas_remove_children(&dev->rphy->dev); |
| 304 | sas_rphy_delete(dev->rphy); | 314 | sas_rphy_delete(dev->rphy); |
| 305 | dev->rphy = NULL; | ||
| 306 | sas_unregister_common_dev(port, dev); | 315 | sas_unregister_common_dev(port, dev); |
| 307 | } | 316 | } |
| 308 | } | 317 | } |
| @@ -314,11 +323,11 @@ void sas_unregister_dev(struct asd_sas_port *port, struct domain_device *dev) | |||
| 314 | /* this rphy never saw sas_rphy_add */ | 323 | /* this rphy never saw sas_rphy_add */ |
| 315 | list_del_init(&dev->disco_list_node); | 324 | list_del_init(&dev->disco_list_node); |
| 316 | sas_rphy_free(dev->rphy); | 325 | sas_rphy_free(dev->rphy); |
| 317 | dev->rphy = NULL; | ||
| 318 | sas_unregister_common_dev(port, dev); | 326 | sas_unregister_common_dev(port, dev); |
| 327 | return; | ||
| 319 | } | 328 | } |
| 320 | 329 | ||
| 321 | if (dev->rphy && !test_and_set_bit(SAS_DEV_DESTROY, &dev->state)) { | 330 | if (!test_and_set_bit(SAS_DEV_DESTROY, &dev->state)) { |
| 322 | sas_rphy_unlink(dev->rphy); | 331 | sas_rphy_unlink(dev->rphy); |
| 323 | list_move_tail(&dev->disco_list_node, &port->destroy_list); | 332 | list_move_tail(&dev->disco_list_node, &port->destroy_list); |
| 324 | sas_discover_event(dev->port, DISCE_DESTRUCT); | 333 | sas_discover_event(dev->port, DISCE_DESTRUCT); |
| @@ -377,8 +386,7 @@ static void sas_discover_domain(struct work_struct *work) | |||
| 377 | { | 386 | { |
| 378 | struct domain_device *dev; | 387 | struct domain_device *dev; |
| 379 | int error = 0; | 388 | int error = 0; |
| 380 | struct sas_discovery_event *ev = | 389 | struct sas_discovery_event *ev = to_sas_discovery_event(work); |
| 381 | container_of(work, struct sas_discovery_event, work); | ||
| 382 | struct asd_sas_port *port = ev->port; | 390 | struct asd_sas_port *port = ev->port; |
| 383 | 391 | ||
| 384 | clear_bit(DISCE_DISCOVER_DOMAIN, &port->disc.pending); | 392 | clear_bit(DISCE_DISCOVER_DOMAIN, &port->disc.pending); |
| @@ -419,8 +427,6 @@ static void sas_discover_domain(struct work_struct *work) | |||
| 419 | 427 | ||
| 420 | if (error) { | 428 | if (error) { |
| 421 | sas_rphy_free(dev->rphy); | 429 | sas_rphy_free(dev->rphy); |
| 422 | dev->rphy = NULL; | ||
| 423 | |||
| 424 | list_del_init(&dev->disco_list_node); | 430 | list_del_init(&dev->disco_list_node); |
| 425 | spin_lock_irq(&port->dev_list_lock); | 431 | spin_lock_irq(&port->dev_list_lock); |
| 426 | list_del_init(&dev->dev_list_node); | 432 | list_del_init(&dev->dev_list_node); |
| @@ -437,8 +443,7 @@ static void sas_discover_domain(struct work_struct *work) | |||
| 437 | static void sas_revalidate_domain(struct work_struct *work) | 443 | static void sas_revalidate_domain(struct work_struct *work) |
| 438 | { | 444 | { |
| 439 | int res = 0; | 445 | int res = 0; |
| 440 | struct sas_discovery_event *ev = | 446 | struct sas_discovery_event *ev = to_sas_discovery_event(work); |
| 441 | container_of(work, struct sas_discovery_event, work); | ||
| 442 | struct asd_sas_port *port = ev->port; | 447 | struct asd_sas_port *port = ev->port; |
| 443 | struct sas_ha_struct *ha = port->ha; | 448 | struct sas_ha_struct *ha = port->ha; |
| 444 | 449 | ||
| @@ -466,21 +471,25 @@ static void sas_revalidate_domain(struct work_struct *work) | |||
| 466 | 471 | ||
| 467 | /* ---------- Events ---------- */ | 472 | /* ---------- Events ---------- */ |
| 468 | 473 | ||
| 469 | static void sas_chain_work(struct sas_ha_struct *ha, struct work_struct *work) | 474 | static void sas_chain_work(struct sas_ha_struct *ha, struct sas_work *sw) |
| 470 | { | 475 | { |
| 471 | /* chained work is not subject to SA_HA_DRAINING or SAS_HA_REGISTERED */ | 476 | /* chained work is not subject to SA_HA_DRAINING or |
| 472 | scsi_queue_work(ha->core.shost, work); | 477 | * SAS_HA_REGISTERED, because it is either submitted in the |
| 478 | * workqueue, or known to be submitted from a context that is | ||
| 479 | * not racing against draining | ||
| 480 | */ | ||
| 481 | scsi_queue_work(ha->core.shost, &sw->work); | ||
| 473 | } | 482 | } |
| 474 | 483 | ||
| 475 | static void sas_chain_event(int event, unsigned long *pending, | 484 | static void sas_chain_event(int event, unsigned long *pending, |
| 476 | struct work_struct *work, | 485 | struct sas_work *sw, |
| 477 | struct sas_ha_struct *ha) | 486 | struct sas_ha_struct *ha) |
| 478 | { | 487 | { |
| 479 | if (!test_and_set_bit(event, pending)) { | 488 | if (!test_and_set_bit(event, pending)) { |
| 480 | unsigned long flags; | 489 | unsigned long flags; |
| 481 | 490 | ||
| 482 | spin_lock_irqsave(&ha->state_lock, flags); | 491 | spin_lock_irqsave(&ha->state_lock, flags); |
| 483 | sas_chain_work(ha, work); | 492 | sas_chain_work(ha, sw); |
| 484 | spin_unlock_irqrestore(&ha->state_lock, flags); | 493 | spin_unlock_irqrestore(&ha->state_lock, flags); |
| 485 | } | 494 | } |
| 486 | } | 495 | } |
| @@ -519,7 +528,7 @@ void sas_init_disc(struct sas_discovery *disc, struct asd_sas_port *port) | |||
| 519 | 528 | ||
| 520 | disc->pending = 0; | 529 | disc->pending = 0; |
| 521 | for (i = 0; i < DISC_NUM_EVENTS; i++) { | 530 | for (i = 0; i < DISC_NUM_EVENTS; i++) { |
| 522 | INIT_WORK(&disc->disc_work[i].work, sas_event_fns[i]); | 531 | INIT_SAS_WORK(&disc->disc_work[i].work, sas_event_fns[i]); |
| 523 | disc->disc_work[i].port = port; | 532 | disc->disc_work[i].port = port; |
| 524 | } | 533 | } |
| 525 | } | 534 | } |
diff --git a/drivers/scsi/libsas/sas_event.c b/drivers/scsi/libsas/sas_event.c index 16639bbae629..4e4292d210c1 100644 --- a/drivers/scsi/libsas/sas_event.c +++ b/drivers/scsi/libsas/sas_event.c | |||
| @@ -27,19 +27,21 @@ | |||
| 27 | #include "sas_internal.h" | 27 | #include "sas_internal.h" |
| 28 | #include "sas_dump.h" | 28 | #include "sas_dump.h" |
| 29 | 29 | ||
| 30 | void sas_queue_work(struct sas_ha_struct *ha, struct work_struct *work) | 30 | void sas_queue_work(struct sas_ha_struct *ha, struct sas_work *sw) |
| 31 | { | 31 | { |
| 32 | if (!test_bit(SAS_HA_REGISTERED, &ha->state)) | 32 | if (!test_bit(SAS_HA_REGISTERED, &ha->state)) |
| 33 | return; | 33 | return; |
| 34 | 34 | ||
| 35 | if (test_bit(SAS_HA_DRAINING, &ha->state)) | 35 | if (test_bit(SAS_HA_DRAINING, &ha->state)) { |
| 36 | list_add(&work->entry, &ha->defer_q); | 36 | /* add it to the defer list, if not already pending */ |
| 37 | else | 37 | if (list_empty(&sw->drain_node)) |
| 38 | scsi_queue_work(ha->core.shost, work); | 38 | list_add(&sw->drain_node, &ha->defer_q); |
| 39 | } else | ||
| 40 | scsi_queue_work(ha->core.shost, &sw->work); | ||
| 39 | } | 41 | } |
| 40 | 42 | ||
| 41 | static void sas_queue_event(int event, unsigned long *pending, | 43 | static void sas_queue_event(int event, unsigned long *pending, |
| 42 | struct work_struct *work, | 44 | struct sas_work *work, |
| 43 | struct sas_ha_struct *ha) | 45 | struct sas_ha_struct *ha) |
| 44 | { | 46 | { |
| 45 | if (!test_and_set_bit(event, pending)) { | 47 | if (!test_and_set_bit(event, pending)) { |
| @@ -55,7 +57,7 @@ static void sas_queue_event(int event, unsigned long *pending, | |||
| 55 | void __sas_drain_work(struct sas_ha_struct *ha) | 57 | void __sas_drain_work(struct sas_ha_struct *ha) |
| 56 | { | 58 | { |
| 57 | struct workqueue_struct *wq = ha->core.shost->work_q; | 59 | struct workqueue_struct *wq = ha->core.shost->work_q; |
| 58 | struct work_struct *w, *_w; | 60 | struct sas_work *sw, *_sw; |
| 59 | 61 | ||
| 60 | set_bit(SAS_HA_DRAINING, &ha->state); | 62 | set_bit(SAS_HA_DRAINING, &ha->state); |
| 61 | /* flush submitters */ | 63 | /* flush submitters */ |
| @@ -66,9 +68,9 @@ void __sas_drain_work(struct sas_ha_struct *ha) | |||
| 66 | 68 | ||
| 67 | spin_lock_irq(&ha->state_lock); | 69 | spin_lock_irq(&ha->state_lock); |
| 68 | clear_bit(SAS_HA_DRAINING, &ha->state); | 70 | clear_bit(SAS_HA_DRAINING, &ha->state); |
| 69 | list_for_each_entry_safe(w, _w, &ha->defer_q, entry) { | 71 | list_for_each_entry_safe(sw, _sw, &ha->defer_q, drain_node) { |
| 70 | list_del_init(&w->entry); | 72 | list_del_init(&sw->drain_node); |
| 71 | sas_queue_work(ha, w); | 73 | sas_queue_work(ha, sw); |
| 72 | } | 74 | } |
| 73 | spin_unlock_irq(&ha->state_lock); | 75 | spin_unlock_irq(&ha->state_lock); |
| 74 | } | 76 | } |
| @@ -151,7 +153,7 @@ int sas_init_events(struct sas_ha_struct *sas_ha) | |||
| 151 | int i; | 153 | int i; |
| 152 | 154 | ||
| 153 | for (i = 0; i < HA_NUM_EVENTS; i++) { | 155 | for (i = 0; i < HA_NUM_EVENTS; i++) { |
| 154 | INIT_WORK(&sas_ha->ha_events[i].work, sas_ha_event_fns[i]); | 156 | INIT_SAS_WORK(&sas_ha->ha_events[i].work, sas_ha_event_fns[i]); |
| 155 | sas_ha->ha_events[i].ha = sas_ha; | 157 | sas_ha->ha_events[i].ha = sas_ha; |
| 156 | } | 158 | } |
| 157 | 159 | ||
diff --git a/drivers/scsi/libsas/sas_expander.c b/drivers/scsi/libsas/sas_expander.c index 05acd9e35fc4..caa0525d2523 100644 --- a/drivers/scsi/libsas/sas_expander.c +++ b/drivers/scsi/libsas/sas_expander.c | |||
| @@ -202,6 +202,7 @@ static void sas_set_ex_phy(struct domain_device *dev, int phy_id, void *rsp) | |||
| 202 | u8 sas_addr[SAS_ADDR_SIZE]; | 202 | u8 sas_addr[SAS_ADDR_SIZE]; |
| 203 | struct smp_resp *resp = rsp; | 203 | struct smp_resp *resp = rsp; |
| 204 | struct discover_resp *dr = &resp->disc; | 204 | struct discover_resp *dr = &resp->disc; |
| 205 | struct sas_ha_struct *ha = dev->port->ha; | ||
| 205 | struct expander_device *ex = &dev->ex_dev; | 206 | struct expander_device *ex = &dev->ex_dev; |
| 206 | struct ex_phy *phy = &ex->ex_phy[phy_id]; | 207 | struct ex_phy *phy = &ex->ex_phy[phy_id]; |
| 207 | struct sas_rphy *rphy = dev->rphy; | 208 | struct sas_rphy *rphy = dev->rphy; |
| @@ -209,6 +210,8 @@ static void sas_set_ex_phy(struct domain_device *dev, int phy_id, void *rsp) | |||
| 209 | char *type; | 210 | char *type; |
| 210 | 211 | ||
| 211 | if (new_phy) { | 212 | if (new_phy) { |
| 213 | if (WARN_ON_ONCE(test_bit(SAS_HA_ATA_EH_ACTIVE, &ha->state))) | ||
| 214 | return; | ||
| 212 | phy->phy = sas_phy_alloc(&rphy->dev, phy_id); | 215 | phy->phy = sas_phy_alloc(&rphy->dev, phy_id); |
| 213 | 216 | ||
| 214 | /* FIXME: error_handling */ | 217 | /* FIXME: error_handling */ |
| @@ -233,6 +236,8 @@ static void sas_set_ex_phy(struct domain_device *dev, int phy_id, void *rsp) | |||
| 233 | memcpy(sas_addr, phy->attached_sas_addr, SAS_ADDR_SIZE); | 236 | memcpy(sas_addr, phy->attached_sas_addr, SAS_ADDR_SIZE); |
| 234 | 237 | ||
| 235 | phy->attached_dev_type = to_dev_type(dr); | 238 | phy->attached_dev_type = to_dev_type(dr); |
| 239 | if (test_bit(SAS_HA_ATA_EH_ACTIVE, &ha->state)) | ||
| 240 | goto out; | ||
| 236 | phy->phy_id = phy_id; | 241 | phy->phy_id = phy_id; |
| 237 | phy->linkrate = dr->linkrate; | 242 | phy->linkrate = dr->linkrate; |
| 238 | phy->attached_sata_host = dr->attached_sata_host; | 243 | phy->attached_sata_host = dr->attached_sata_host; |
| @@ -240,7 +245,14 @@ static void sas_set_ex_phy(struct domain_device *dev, int phy_id, void *rsp) | |||
| 240 | phy->attached_sata_ps = dr->attached_sata_ps; | 245 | phy->attached_sata_ps = dr->attached_sata_ps; |
| 241 | phy->attached_iproto = dr->iproto << 1; | 246 | phy->attached_iproto = dr->iproto << 1; |
| 242 | phy->attached_tproto = dr->tproto << 1; | 247 | phy->attached_tproto = dr->tproto << 1; |
| 243 | memcpy(phy->attached_sas_addr, dr->attached_sas_addr, SAS_ADDR_SIZE); | 248 | /* help some expanders that fail to zero sas_address in the 'no |
| 249 | * device' case | ||
| 250 | */ | ||
| 251 | if (phy->attached_dev_type == NO_DEVICE || | ||
| 252 | phy->linkrate < SAS_LINK_RATE_1_5_GBPS) | ||
| 253 | memset(phy->attached_sas_addr, 0, SAS_ADDR_SIZE); | ||
| 254 | else | ||
| 255 | memcpy(phy->attached_sas_addr, dr->attached_sas_addr, SAS_ADDR_SIZE); | ||
| 244 | phy->attached_phy_id = dr->attached_phy_id; | 256 | phy->attached_phy_id = dr->attached_phy_id; |
| 245 | phy->phy_change_count = dr->change_count; | 257 | phy->phy_change_count = dr->change_count; |
| 246 | phy->routing_attr = dr->routing_attr; | 258 | phy->routing_attr = dr->routing_attr; |
| @@ -266,6 +278,7 @@ static void sas_set_ex_phy(struct domain_device *dev, int phy_id, void *rsp) | |||
| 266 | return; | 278 | return; |
| 267 | } | 279 | } |
| 268 | 280 | ||
| 281 | out: | ||
| 269 | switch (phy->attached_dev_type) { | 282 | switch (phy->attached_dev_type) { |
| 270 | case SATA_PENDING: | 283 | case SATA_PENDING: |
| 271 | type = "stp pending"; | 284 | type = "stp pending"; |
| @@ -304,7 +317,15 @@ static void sas_set_ex_phy(struct domain_device *dev, int phy_id, void *rsp) | |||
| 304 | else | 317 | else |
| 305 | return; | 318 | return; |
| 306 | 319 | ||
| 307 | SAS_DPRINTK("ex %016llx phy%02d:%c:%X attached: %016llx (%s)\n", | 320 | /* if the attached device type changed and ata_eh is active, |
| 321 | * make sure we run revalidation when eh completes (see: | ||
| 322 | * sas_enable_revalidation) | ||
| 323 | */ | ||
| 324 | if (test_bit(SAS_HA_ATA_EH_ACTIVE, &ha->state)) | ||
| 325 | set_bit(DISCE_REVALIDATE_DOMAIN, &dev->port->disc.pending); | ||
| 326 | |||
| 327 | SAS_DPRINTK("%sex %016llx phy%02d:%c:%X attached: %016llx (%s)\n", | ||
| 328 | test_bit(SAS_HA_ATA_EH_ACTIVE, &ha->state) ? "ata: " : "", | ||
| 308 | SAS_ADDR(dev->sas_addr), phy->phy_id, | 329 | SAS_ADDR(dev->sas_addr), phy->phy_id, |
| 309 | sas_route_char(dev, phy), phy->linkrate, | 330 | sas_route_char(dev, phy), phy->linkrate, |
| 310 | SAS_ADDR(phy->attached_sas_addr), type); | 331 | SAS_ADDR(phy->attached_sas_addr), type); |
| @@ -776,13 +797,16 @@ static struct domain_device *sas_ex_discover_end_dev( | |||
| 776 | if (res) | 797 | if (res) |
| 777 | goto out_free; | 798 | goto out_free; |
| 778 | 799 | ||
| 800 | sas_init_dev(child); | ||
| 801 | res = sas_ata_init(child); | ||
| 802 | if (res) | ||
| 803 | goto out_free; | ||
| 779 | rphy = sas_end_device_alloc(phy->port); | 804 | rphy = sas_end_device_alloc(phy->port); |
| 780 | if (unlikely(!rphy)) | 805 | if (!rphy) |
| 781 | goto out_free; | 806 | goto out_free; |
| 782 | 807 | ||
| 783 | sas_init_dev(child); | ||
| 784 | |||
| 785 | child->rphy = rphy; | 808 | child->rphy = rphy; |
| 809 | get_device(&rphy->dev); | ||
| 786 | 810 | ||
| 787 | list_add_tail(&child->disco_list_node, &parent->port->disco_list); | 811 | list_add_tail(&child->disco_list_node, &parent->port->disco_list); |
| 788 | 812 | ||
| @@ -806,6 +830,7 @@ static struct domain_device *sas_ex_discover_end_dev( | |||
| 806 | sas_init_dev(child); | 830 | sas_init_dev(child); |
| 807 | 831 | ||
| 808 | child->rphy = rphy; | 832 | child->rphy = rphy; |
| 833 | get_device(&rphy->dev); | ||
| 809 | sas_fill_in_rphy(child, rphy); | 834 | sas_fill_in_rphy(child, rphy); |
| 810 | 835 | ||
| 811 | list_add_tail(&child->disco_list_node, &parent->port->disco_list); | 836 | list_add_tail(&child->disco_list_node, &parent->port->disco_list); |
| @@ -830,8 +855,6 @@ static struct domain_device *sas_ex_discover_end_dev( | |||
| 830 | 855 | ||
| 831 | out_list_del: | 856 | out_list_del: |
| 832 | sas_rphy_free(child->rphy); | 857 | sas_rphy_free(child->rphy); |
| 833 | child->rphy = NULL; | ||
| 834 | |||
| 835 | list_del(&child->disco_list_node); | 858 | list_del(&child->disco_list_node); |
| 836 | spin_lock_irq(&parent->port->dev_list_lock); | 859 | spin_lock_irq(&parent->port->dev_list_lock); |
| 837 | list_del(&child->dev_list_node); | 860 | list_del(&child->dev_list_node); |
| @@ -911,6 +934,7 @@ static struct domain_device *sas_ex_discover_expander( | |||
| 911 | } | 934 | } |
| 912 | port = parent->port; | 935 | port = parent->port; |
| 913 | child->rphy = rphy; | 936 | child->rphy = rphy; |
| 937 | get_device(&rphy->dev); | ||
| 914 | edev = rphy_to_expander_device(rphy); | 938 | edev = rphy_to_expander_device(rphy); |
| 915 | child->dev_type = phy->attached_dev_type; | 939 | child->dev_type = phy->attached_dev_type; |
| 916 | kref_get(&parent->kref); | 940 | kref_get(&parent->kref); |
| @@ -934,6 +958,7 @@ static struct domain_device *sas_ex_discover_expander( | |||
| 934 | 958 | ||
| 935 | res = sas_discover_expander(child); | 959 | res = sas_discover_expander(child); |
| 936 | if (res) { | 960 | if (res) { |
| 961 | sas_rphy_delete(rphy); | ||
| 937 | spin_lock_irq(&parent->port->dev_list_lock); | 962 | spin_lock_irq(&parent->port->dev_list_lock); |
| 938 | list_del(&child->dev_list_node); | 963 | list_del(&child->dev_list_node); |
| 939 | spin_unlock_irq(&parent->port->dev_list_lock); | 964 | spin_unlock_irq(&parent->port->dev_list_lock); |
| @@ -1718,9 +1743,17 @@ static int sas_find_bcast_phy(struct domain_device *dev, int *phy_id, | |||
| 1718 | int phy_change_count = 0; | 1743 | int phy_change_count = 0; |
| 1719 | 1744 | ||
| 1720 | res = sas_get_phy_change_count(dev, i, &phy_change_count); | 1745 | res = sas_get_phy_change_count(dev, i, &phy_change_count); |
| 1721 | if (res) | 1746 | switch (res) { |
| 1722 | goto out; | 1747 | case SMP_RESP_PHY_VACANT: |
| 1723 | else if (phy_change_count != ex->ex_phy[i].phy_change_count) { | 1748 | case SMP_RESP_NO_PHY: |
| 1749 | continue; | ||
| 1750 | case SMP_RESP_FUNC_ACC: | ||
| 1751 | break; | ||
| 1752 | default: | ||
| 1753 | return res; | ||
| 1754 | } | ||
| 1755 | |||
| 1756 | if (phy_change_count != ex->ex_phy[i].phy_change_count) { | ||
| 1724 | if (update) | 1757 | if (update) |
| 1725 | ex->ex_phy[i].phy_change_count = | 1758 | ex->ex_phy[i].phy_change_count = |
| 1726 | phy_change_count; | 1759 | phy_change_count; |
| @@ -1728,8 +1761,7 @@ static int sas_find_bcast_phy(struct domain_device *dev, int *phy_id, | |||
| 1728 | return 0; | 1761 | return 0; |
| 1729 | } | 1762 | } |
| 1730 | } | 1763 | } |
| 1731 | out: | 1764 | return 0; |
| 1732 | return res; | ||
| 1733 | } | 1765 | } |
| 1734 | 1766 | ||
| 1735 | static int sas_get_ex_change_count(struct domain_device *dev, int *ecc) | 1767 | static int sas_get_ex_change_count(struct domain_device *dev, int *ecc) |
diff --git a/drivers/scsi/libsas/sas_init.c b/drivers/scsi/libsas/sas_init.c index 120bff64be30..10cb5ae30977 100644 --- a/drivers/scsi/libsas/sas_init.c +++ b/drivers/scsi/libsas/sas_init.c | |||
| @@ -94,8 +94,7 @@ void sas_hash_addr(u8 *hashed, const u8 *sas_addr) | |||
| 94 | 94 | ||
| 95 | void sas_hae_reset(struct work_struct *work) | 95 | void sas_hae_reset(struct work_struct *work) |
| 96 | { | 96 | { |
| 97 | struct sas_ha_event *ev = | 97 | struct sas_ha_event *ev = to_sas_ha_event(work); |
| 98 | container_of(work, struct sas_ha_event, work); | ||
| 99 | struct sas_ha_struct *ha = ev->ha; | 98 | struct sas_ha_struct *ha = ev->ha; |
| 100 | 99 | ||
| 101 | clear_bit(HAE_RESET, &ha->pending); | 100 | clear_bit(HAE_RESET, &ha->pending); |
| @@ -369,14 +368,14 @@ static void sas_phy_release(struct sas_phy *phy) | |||
| 369 | 368 | ||
| 370 | static void phy_reset_work(struct work_struct *work) | 369 | static void phy_reset_work(struct work_struct *work) |
| 371 | { | 370 | { |
| 372 | struct sas_phy_data *d = container_of(work, typeof(*d), reset_work); | 371 | struct sas_phy_data *d = container_of(work, typeof(*d), reset_work.work); |
| 373 | 372 | ||
| 374 | d->reset_result = transport_sas_phy_reset(d->phy, d->hard_reset); | 373 | d->reset_result = transport_sas_phy_reset(d->phy, d->hard_reset); |
| 375 | } | 374 | } |
| 376 | 375 | ||
| 377 | static void phy_enable_work(struct work_struct *work) | 376 | static void phy_enable_work(struct work_struct *work) |
| 378 | { | 377 | { |
| 379 | struct sas_phy_data *d = container_of(work, typeof(*d), enable_work); | 378 | struct sas_phy_data *d = container_of(work, typeof(*d), enable_work.work); |
| 380 | 379 | ||
| 381 | d->enable_result = sas_phy_enable(d->phy, d->enable); | 380 | d->enable_result = sas_phy_enable(d->phy, d->enable); |
| 382 | } | 381 | } |
| @@ -389,8 +388,8 @@ static int sas_phy_setup(struct sas_phy *phy) | |||
| 389 | return -ENOMEM; | 388 | return -ENOMEM; |
| 390 | 389 | ||
| 391 | mutex_init(&d->event_lock); | 390 | mutex_init(&d->event_lock); |
| 392 | INIT_WORK(&d->reset_work, phy_reset_work); | 391 | INIT_SAS_WORK(&d->reset_work, phy_reset_work); |
| 393 | INIT_WORK(&d->enable_work, phy_enable_work); | 392 | INIT_SAS_WORK(&d->enable_work, phy_enable_work); |
| 394 | d->phy = phy; | 393 | d->phy = phy; |
| 395 | phy->hostdata = d; | 394 | phy->hostdata = d; |
| 396 | 395 | ||
diff --git a/drivers/scsi/libsas/sas_internal.h b/drivers/scsi/libsas/sas_internal.h index f05c63879949..507e4cf12e56 100644 --- a/drivers/scsi/libsas/sas_internal.h +++ b/drivers/scsi/libsas/sas_internal.h | |||
| @@ -45,10 +45,10 @@ struct sas_phy_data { | |||
| 45 | struct mutex event_lock; | 45 | struct mutex event_lock; |
| 46 | int hard_reset; | 46 | int hard_reset; |
| 47 | int reset_result; | 47 | int reset_result; |
| 48 | struct work_struct reset_work; | 48 | struct sas_work reset_work; |
| 49 | int enable; | 49 | int enable; |
| 50 | int enable_result; | 50 | int enable_result; |
| 51 | struct work_struct enable_work; | 51 | struct sas_work enable_work; |
| 52 | }; | 52 | }; |
| 53 | 53 | ||
| 54 | void sas_scsi_recover_host(struct Scsi_Host *shost); | 54 | void sas_scsi_recover_host(struct Scsi_Host *shost); |
| @@ -80,7 +80,7 @@ void sas_porte_broadcast_rcvd(struct work_struct *work); | |||
| 80 | void sas_porte_link_reset_err(struct work_struct *work); | 80 | void sas_porte_link_reset_err(struct work_struct *work); |
| 81 | void sas_porte_timer_event(struct work_struct *work); | 81 | void sas_porte_timer_event(struct work_struct *work); |
| 82 | void sas_porte_hard_reset(struct work_struct *work); | 82 | void sas_porte_hard_reset(struct work_struct *work); |
| 83 | void sas_queue_work(struct sas_ha_struct *ha, struct work_struct *work); | 83 | void sas_queue_work(struct sas_ha_struct *ha, struct sas_work *sw); |
| 84 | 84 | ||
| 85 | int sas_notify_lldd_dev_found(struct domain_device *); | 85 | int sas_notify_lldd_dev_found(struct domain_device *); |
| 86 | void sas_notify_lldd_dev_gone(struct domain_device *); | 86 | void sas_notify_lldd_dev_gone(struct domain_device *); |
diff --git a/drivers/scsi/libsas/sas_phy.c b/drivers/scsi/libsas/sas_phy.c index dcfd4a9105c5..521422e857ab 100644 --- a/drivers/scsi/libsas/sas_phy.c +++ b/drivers/scsi/libsas/sas_phy.c | |||
| @@ -32,8 +32,7 @@ | |||
| 32 | 32 | ||
| 33 | static void sas_phye_loss_of_signal(struct work_struct *work) | 33 | static void sas_phye_loss_of_signal(struct work_struct *work) |
| 34 | { | 34 | { |
| 35 | struct asd_sas_event *ev = | 35 | struct asd_sas_event *ev = to_asd_sas_event(work); |
| 36 | container_of(work, struct asd_sas_event, work); | ||
| 37 | struct asd_sas_phy *phy = ev->phy; | 36 | struct asd_sas_phy *phy = ev->phy; |
| 38 | 37 | ||
| 39 | clear_bit(PHYE_LOSS_OF_SIGNAL, &phy->phy_events_pending); | 38 | clear_bit(PHYE_LOSS_OF_SIGNAL, &phy->phy_events_pending); |
| @@ -43,8 +42,7 @@ static void sas_phye_loss_of_signal(struct work_struct *work) | |||
| 43 | 42 | ||
| 44 | static void sas_phye_oob_done(struct work_struct *work) | 43 | static void sas_phye_oob_done(struct work_struct *work) |
| 45 | { | 44 | { |
| 46 | struct asd_sas_event *ev = | 45 | struct asd_sas_event *ev = to_asd_sas_event(work); |
| 47 | container_of(work, struct asd_sas_event, work); | ||
| 48 | struct asd_sas_phy *phy = ev->phy; | 46 | struct asd_sas_phy *phy = ev->phy; |
| 49 | 47 | ||
| 50 | clear_bit(PHYE_OOB_DONE, &phy->phy_events_pending); | 48 | clear_bit(PHYE_OOB_DONE, &phy->phy_events_pending); |
| @@ -53,8 +51,7 @@ static void sas_phye_oob_done(struct work_struct *work) | |||
| 53 | 51 | ||
| 54 | static void sas_phye_oob_error(struct work_struct *work) | 52 | static void sas_phye_oob_error(struct work_struct *work) |
| 55 | { | 53 | { |
| 56 | struct asd_sas_event *ev = | 54 | struct asd_sas_event *ev = to_asd_sas_event(work); |
| 57 | container_of(work, struct asd_sas_event, work); | ||
| 58 | struct asd_sas_phy *phy = ev->phy; | 55 | struct asd_sas_phy *phy = ev->phy; |
| 59 | struct sas_ha_struct *sas_ha = phy->ha; | 56 | struct sas_ha_struct *sas_ha = phy->ha; |
| 60 | struct asd_sas_port *port = phy->port; | 57 | struct asd_sas_port *port = phy->port; |
| @@ -85,8 +82,7 @@ static void sas_phye_oob_error(struct work_struct *work) | |||
| 85 | 82 | ||
| 86 | static void sas_phye_spinup_hold(struct work_struct *work) | 83 | static void sas_phye_spinup_hold(struct work_struct *work) |
| 87 | { | 84 | { |
| 88 | struct asd_sas_event *ev = | 85 | struct asd_sas_event *ev = to_asd_sas_event(work); |
| 89 | container_of(work, struct asd_sas_event, work); | ||
| 90 | struct asd_sas_phy *phy = ev->phy; | 86 | struct asd_sas_phy *phy = ev->phy; |
| 91 | struct sas_ha_struct *sas_ha = phy->ha; | 87 | struct sas_ha_struct *sas_ha = phy->ha; |
| 92 | struct sas_internal *i = | 88 | struct sas_internal *i = |
| @@ -127,14 +123,12 @@ int sas_register_phys(struct sas_ha_struct *sas_ha) | |||
| 127 | phy->error = 0; | 123 | phy->error = 0; |
| 128 | INIT_LIST_HEAD(&phy->port_phy_el); | 124 | INIT_LIST_HEAD(&phy->port_phy_el); |
| 129 | for (k = 0; k < PORT_NUM_EVENTS; k++) { | 125 | for (k = 0; k < PORT_NUM_EVENTS; k++) { |
| 130 | INIT_WORK(&phy->port_events[k].work, | 126 | INIT_SAS_WORK(&phy->port_events[k].work, sas_port_event_fns[k]); |
| 131 | sas_port_event_fns[k]); | ||
| 132 | phy->port_events[k].phy = phy; | 127 | phy->port_events[k].phy = phy; |
| 133 | } | 128 | } |
| 134 | 129 | ||
| 135 | for (k = 0; k < PHY_NUM_EVENTS; k++) { | 130 | for (k = 0; k < PHY_NUM_EVENTS; k++) { |
| 136 | INIT_WORK(&phy->phy_events[k].work, | 131 | INIT_SAS_WORK(&phy->phy_events[k].work, sas_phy_event_fns[k]); |
| 137 | sas_phy_event_fns[k]); | ||
| 138 | phy->phy_events[k].phy = phy; | 132 | phy->phy_events[k].phy = phy; |
| 139 | } | 133 | } |
| 140 | 134 | ||
| @@ -144,8 +138,7 @@ int sas_register_phys(struct sas_ha_struct *sas_ha) | |||
| 144 | spin_lock_init(&phy->sas_prim_lock); | 138 | spin_lock_init(&phy->sas_prim_lock); |
| 145 | phy->frame_rcvd_size = 0; | 139 | phy->frame_rcvd_size = 0; |
| 146 | 140 | ||
| 147 | phy->phy = sas_phy_alloc(&sas_ha->core.shost->shost_gendev, | 141 | phy->phy = sas_phy_alloc(&sas_ha->core.shost->shost_gendev, i); |
| 148 | i); | ||
| 149 | if (!phy->phy) | 142 | if (!phy->phy) |
| 150 | return -ENOMEM; | 143 | return -ENOMEM; |
| 151 | 144 | ||
diff --git a/drivers/scsi/libsas/sas_port.c b/drivers/scsi/libsas/sas_port.c index eb19c016d500..e884a8c58a0c 100644 --- a/drivers/scsi/libsas/sas_port.c +++ b/drivers/scsi/libsas/sas_port.c | |||
| @@ -123,7 +123,7 @@ static void sas_form_port(struct asd_sas_phy *phy) | |||
| 123 | spin_unlock_irqrestore(&sas_ha->phy_port_lock, flags); | 123 | spin_unlock_irqrestore(&sas_ha->phy_port_lock, flags); |
| 124 | 124 | ||
| 125 | if (!port->port) { | 125 | if (!port->port) { |
| 126 | port->port = sas_port_alloc(phy->phy->dev.parent, phy->id); | 126 | port->port = sas_port_alloc(phy->phy->dev.parent, port->id); |
| 127 | BUG_ON(!port->port); | 127 | BUG_ON(!port->port); |
| 128 | sas_port_add(port->port); | 128 | sas_port_add(port->port); |
| 129 | } | 129 | } |
| @@ -208,8 +208,7 @@ void sas_deform_port(struct asd_sas_phy *phy, int gone) | |||
| 208 | 208 | ||
| 209 | void sas_porte_bytes_dmaed(struct work_struct *work) | 209 | void sas_porte_bytes_dmaed(struct work_struct *work) |
| 210 | { | 210 | { |
| 211 | struct asd_sas_event *ev = | 211 | struct asd_sas_event *ev = to_asd_sas_event(work); |
| 212 | container_of(work, struct asd_sas_event, work); | ||
| 213 | struct asd_sas_phy *phy = ev->phy; | 212 | struct asd_sas_phy *phy = ev->phy; |
| 214 | 213 | ||
| 215 | clear_bit(PORTE_BYTES_DMAED, &phy->port_events_pending); | 214 | clear_bit(PORTE_BYTES_DMAED, &phy->port_events_pending); |
| @@ -219,8 +218,7 @@ void sas_porte_bytes_dmaed(struct work_struct *work) | |||
| 219 | 218 | ||
| 220 | void sas_porte_broadcast_rcvd(struct work_struct *work) | 219 | void sas_porte_broadcast_rcvd(struct work_struct *work) |
| 221 | { | 220 | { |
| 222 | struct asd_sas_event *ev = | 221 | struct asd_sas_event *ev = to_asd_sas_event(work); |
| 223 | container_of(work, struct asd_sas_event, work); | ||
| 224 | struct asd_sas_phy *phy = ev->phy; | 222 | struct asd_sas_phy *phy = ev->phy; |
| 225 | unsigned long flags; | 223 | unsigned long flags; |
| 226 | u32 prim; | 224 | u32 prim; |
| @@ -237,8 +235,7 @@ void sas_porte_broadcast_rcvd(struct work_struct *work) | |||
| 237 | 235 | ||
| 238 | void sas_porte_link_reset_err(struct work_struct *work) | 236 | void sas_porte_link_reset_err(struct work_struct *work) |
| 239 | { | 237 | { |
| 240 | struct asd_sas_event *ev = | 238 | struct asd_sas_event *ev = to_asd_sas_event(work); |
| 241 | container_of(work, struct asd_sas_event, work); | ||
| 242 | struct asd_sas_phy *phy = ev->phy; | 239 | struct asd_sas_phy *phy = ev->phy; |
| 243 | 240 | ||
| 244 | clear_bit(PORTE_LINK_RESET_ERR, &phy->port_events_pending); | 241 | clear_bit(PORTE_LINK_RESET_ERR, &phy->port_events_pending); |
| @@ -248,8 +245,7 @@ void sas_porte_link_reset_err(struct work_struct *work) | |||
| 248 | 245 | ||
| 249 | void sas_porte_timer_event(struct work_struct *work) | 246 | void sas_porte_timer_event(struct work_struct *work) |
| 250 | { | 247 | { |
| 251 | struct asd_sas_event *ev = | 248 | struct asd_sas_event *ev = to_asd_sas_event(work); |
| 252 | container_of(work, struct asd_sas_event, work); | ||
| 253 | struct asd_sas_phy *phy = ev->phy; | 249 | struct asd_sas_phy *phy = ev->phy; |
| 254 | 250 | ||
| 255 | clear_bit(PORTE_TIMER_EVENT, &phy->port_events_pending); | 251 | clear_bit(PORTE_TIMER_EVENT, &phy->port_events_pending); |
| @@ -259,8 +255,7 @@ void sas_porte_timer_event(struct work_struct *work) | |||
| 259 | 255 | ||
| 260 | void sas_porte_hard_reset(struct work_struct *work) | 256 | void sas_porte_hard_reset(struct work_struct *work) |
| 261 | { | 257 | { |
| 262 | struct asd_sas_event *ev = | 258 | struct asd_sas_event *ev = to_asd_sas_event(work); |
| 263 | container_of(work, struct asd_sas_event, work); | ||
| 264 | struct asd_sas_phy *phy = ev->phy; | 259 | struct asd_sas_phy *phy = ev->phy; |
| 265 | 260 | ||
| 266 | clear_bit(PORTE_HARD_RESET, &phy->port_events_pending); | 261 | clear_bit(PORTE_HARD_RESET, &phy->port_events_pending); |
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index ead6405f3e51..5dfd7495d1a1 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c | |||
| @@ -1638,7 +1638,7 @@ struct request_queue *__scsi_alloc_queue(struct Scsi_Host *shost, | |||
| 1638 | request_fn_proc *request_fn) | 1638 | request_fn_proc *request_fn) |
| 1639 | { | 1639 | { |
| 1640 | struct request_queue *q; | 1640 | struct request_queue *q; |
| 1641 | struct device *dev = shost->shost_gendev.parent; | 1641 | struct device *dev = shost->dma_dev; |
| 1642 | 1642 | ||
| 1643 | q = blk_init_queue(request_fn, NULL); | 1643 | q = blk_init_queue(request_fn, NULL); |
| 1644 | if (!q) | 1644 | if (!q) |
diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig index 3ed748355b98..00c024039c97 100644 --- a/drivers/spi/Kconfig +++ b/drivers/spi/Kconfig | |||
| @@ -74,7 +74,7 @@ config SPI_ATMEL | |||
| 74 | This selects a driver for the Atmel SPI Controller, present on | 74 | This selects a driver for the Atmel SPI Controller, present on |
| 75 | many AT32 (AVR32) and AT91 (ARM) chips. | 75 | many AT32 (AVR32) and AT91 (ARM) chips. |
| 76 | 76 | ||
| 77 | config SPI_BFIN | 77 | config SPI_BFIN5XX |
| 78 | tristate "SPI controller driver for ADI Blackfin5xx" | 78 | tristate "SPI controller driver for ADI Blackfin5xx" |
| 79 | depends on BLACKFIN | 79 | depends on BLACKFIN |
| 80 | help | 80 | help |
diff --git a/drivers/spi/Makefile b/drivers/spi/Makefile index a1d48e0ba3dc..9d75d2198ff5 100644 --- a/drivers/spi/Makefile +++ b/drivers/spi/Makefile | |||
| @@ -15,7 +15,7 @@ obj-$(CONFIG_SPI_ATMEL) += spi-atmel.o | |||
| 15 | obj-$(CONFIG_SPI_ATH79) += spi-ath79.o | 15 | obj-$(CONFIG_SPI_ATH79) += spi-ath79.o |
| 16 | obj-$(CONFIG_SPI_AU1550) += spi-au1550.o | 16 | obj-$(CONFIG_SPI_AU1550) += spi-au1550.o |
| 17 | obj-$(CONFIG_SPI_BCM63XX) += spi-bcm63xx.o | 17 | obj-$(CONFIG_SPI_BCM63XX) += spi-bcm63xx.o |
| 18 | obj-$(CONFIG_SPI_BFIN) += spi-bfin5xx.o | 18 | obj-$(CONFIG_SPI_BFIN5XX) += spi-bfin5xx.o |
| 19 | obj-$(CONFIG_SPI_BFIN_SPORT) += spi-bfin-sport.o | 19 | obj-$(CONFIG_SPI_BFIN_SPORT) += spi-bfin-sport.o |
| 20 | obj-$(CONFIG_SPI_BITBANG) += spi-bitbang.o | 20 | obj-$(CONFIG_SPI_BITBANG) += spi-bitbang.o |
| 21 | obj-$(CONFIG_SPI_BUTTERFLY) += spi-butterfly.o | 21 | obj-$(CONFIG_SPI_BUTTERFLY) += spi-butterfly.o |
diff --git a/drivers/spi/spi-bcm63xx.c b/drivers/spi/spi-bcm63xx.c index f01b2648452e..7491971139a6 100644 --- a/drivers/spi/spi-bcm63xx.c +++ b/drivers/spi/spi-bcm63xx.c | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * Broadcom BCM63xx SPI controller support | 2 | * Broadcom BCM63xx SPI controller support |
| 3 | * | 3 | * |
| 4 | * Copyright (C) 2009-2011 Florian Fainelli <florian@openwrt.org> | 4 | * Copyright (C) 2009-2012 Florian Fainelli <florian@openwrt.org> |
| 5 | * Copyright (C) 2010 Tanguy Bouzeloc <tanguy.bouzeloc@efixo.com> | 5 | * Copyright (C) 2010 Tanguy Bouzeloc <tanguy.bouzeloc@efixo.com> |
| 6 | * | 6 | * |
| 7 | * This program is free software; you can redistribute it and/or | 7 | * This program is free software; you can redistribute it and/or |
| @@ -30,6 +30,8 @@ | |||
| 30 | #include <linux/spi/spi.h> | 30 | #include <linux/spi/spi.h> |
| 31 | #include <linux/completion.h> | 31 | #include <linux/completion.h> |
| 32 | #include <linux/err.h> | 32 | #include <linux/err.h> |
| 33 | #include <linux/workqueue.h> | ||
| 34 | #include <linux/pm_runtime.h> | ||
| 33 | 35 | ||
| 34 | #include <bcm63xx_dev_spi.h> | 36 | #include <bcm63xx_dev_spi.h> |
| 35 | 37 | ||
| @@ -37,8 +39,6 @@ | |||
| 37 | #define DRV_VER "0.1.2" | 39 | #define DRV_VER "0.1.2" |
| 38 | 40 | ||
| 39 | struct bcm63xx_spi { | 41 | struct bcm63xx_spi { |
| 40 | spinlock_t lock; | ||
| 41 | int stopping; | ||
| 42 | struct completion done; | 42 | struct completion done; |
| 43 | 43 | ||
| 44 | void __iomem *regs; | 44 | void __iomem *regs; |
| @@ -96,17 +96,12 @@ static const unsigned bcm63xx_spi_freq_table[SPI_CLK_MASK][2] = { | |||
| 96 | { 391000, SPI_CLK_0_391MHZ } | 96 | { 391000, SPI_CLK_0_391MHZ } |
| 97 | }; | 97 | }; |
| 98 | 98 | ||
| 99 | static int bcm63xx_spi_setup_transfer(struct spi_device *spi, | 99 | static int bcm63xx_spi_check_transfer(struct spi_device *spi, |
| 100 | struct spi_transfer *t) | 100 | struct spi_transfer *t) |
| 101 | { | 101 | { |
| 102 | struct bcm63xx_spi *bs = spi_master_get_devdata(spi->master); | ||
| 103 | u8 bits_per_word; | 102 | u8 bits_per_word; |
| 104 | u8 clk_cfg, reg; | ||
| 105 | u32 hz; | ||
| 106 | int i; | ||
| 107 | 103 | ||
| 108 | bits_per_word = (t) ? t->bits_per_word : spi->bits_per_word; | 104 | bits_per_word = (t) ? t->bits_per_word : spi->bits_per_word; |
| 109 | hz = (t) ? t->speed_hz : spi->max_speed_hz; | ||
| 110 | if (bits_per_word != 8) { | 105 | if (bits_per_word != 8) { |
| 111 | dev_err(&spi->dev, "%s, unsupported bits_per_word=%d\n", | 106 | dev_err(&spi->dev, "%s, unsupported bits_per_word=%d\n", |
| 112 | __func__, bits_per_word); | 107 | __func__, bits_per_word); |
| @@ -119,6 +114,19 @@ static int bcm63xx_spi_setup_transfer(struct spi_device *spi, | |||
| 119 | return -EINVAL; | 114 | return -EINVAL; |
| 120 | } | 115 | } |
| 121 | 116 | ||
| 117 | return 0; | ||
| 118 | } | ||
| 119 | |||
| 120 | static void bcm63xx_spi_setup_transfer(struct spi_device *spi, | ||
| 121 | struct spi_transfer *t) | ||
| 122 | { | ||
| 123 | struct bcm63xx_spi *bs = spi_master_get_devdata(spi->master); | ||
| 124 | u32 hz; | ||
| 125 | u8 clk_cfg, reg; | ||
| 126 | int i; | ||
| 127 | |||
| 128 | hz = (t) ? t->speed_hz : spi->max_speed_hz; | ||
| 129 | |||
| 122 | /* Find the closest clock configuration */ | 130 | /* Find the closest clock configuration */ |
| 123 | for (i = 0; i < SPI_CLK_MASK; i++) { | 131 | for (i = 0; i < SPI_CLK_MASK; i++) { |
| 124 | if (hz <= bcm63xx_spi_freq_table[i][0]) { | 132 | if (hz <= bcm63xx_spi_freq_table[i][0]) { |
| @@ -139,8 +147,6 @@ static int bcm63xx_spi_setup_transfer(struct spi_device *spi, | |||
| 139 | bcm_spi_writeb(bs, reg, SPI_CLK_CFG); | 147 | bcm_spi_writeb(bs, reg, SPI_CLK_CFG); |
| 140 | dev_dbg(&spi->dev, "Setting clock register to %02x (hz %d)\n", | 148 | dev_dbg(&spi->dev, "Setting clock register to %02x (hz %d)\n", |
| 141 | clk_cfg, hz); | 149 | clk_cfg, hz); |
| 142 | |||
| 143 | return 0; | ||
| 144 | } | 150 | } |
| 145 | 151 | ||
| 146 | /* the spi->mode bits understood by this driver: */ | 152 | /* the spi->mode bits understood by this driver: */ |
| @@ -153,9 +159,6 @@ static int bcm63xx_spi_setup(struct spi_device *spi) | |||
| 153 | 159 | ||
| 154 | bs = spi_master_get_devdata(spi->master); | 160 | bs = spi_master_get_devdata(spi->master); |
| 155 | 161 | ||
| 156 | if (bs->stopping) | ||
| 157 | return -ESHUTDOWN; | ||
| 158 | |||
| 159 | if (!spi->bits_per_word) | 162 | if (!spi->bits_per_word) |
| 160 | spi->bits_per_word = 8; | 163 | spi->bits_per_word = 8; |
| 161 | 164 | ||
| @@ -165,7 +168,7 @@ static int bcm63xx_spi_setup(struct spi_device *spi) | |||
| 165 | return -EINVAL; | 168 | return -EINVAL; |
| 166 | } | 169 | } |
| 167 | 170 | ||
| 168 | ret = bcm63xx_spi_setup_transfer(spi, NULL); | 171 | ret = bcm63xx_spi_check_transfer(spi, NULL); |
| 169 | if (ret < 0) { | 172 | if (ret < 0) { |
| 170 | dev_err(&spi->dev, "setup: unsupported mode bits %x\n", | 173 | dev_err(&spi->dev, "setup: unsupported mode bits %x\n", |
| 171 | spi->mode & ~MODEBITS); | 174 | spi->mode & ~MODEBITS); |
| @@ -190,28 +193,29 @@ static void bcm63xx_spi_fill_tx_fifo(struct bcm63xx_spi *bs) | |||
| 190 | bs->remaining_bytes -= size; | 193 | bs->remaining_bytes -= size; |
| 191 | } | 194 | } |
| 192 | 195 | ||
| 193 | static int bcm63xx_txrx_bufs(struct spi_device *spi, struct spi_transfer *t) | 196 | static unsigned int bcm63xx_txrx_bufs(struct spi_device *spi, |
| 197 | struct spi_transfer *t) | ||
| 194 | { | 198 | { |
| 195 | struct bcm63xx_spi *bs = spi_master_get_devdata(spi->master); | 199 | struct bcm63xx_spi *bs = spi_master_get_devdata(spi->master); |
| 196 | u16 msg_ctl; | 200 | u16 msg_ctl; |
| 197 | u16 cmd; | 201 | u16 cmd; |
| 198 | 202 | ||
| 203 | /* Disable the CMD_DONE interrupt */ | ||
| 204 | bcm_spi_writeb(bs, 0, SPI_INT_MASK); | ||
| 205 | |||
| 199 | dev_dbg(&spi->dev, "txrx: tx %p, rx %p, len %d\n", | 206 | dev_dbg(&spi->dev, "txrx: tx %p, rx %p, len %d\n", |
| 200 | t->tx_buf, t->rx_buf, t->len); | 207 | t->tx_buf, t->rx_buf, t->len); |
| 201 | 208 | ||
| 202 | /* Transmitter is inhibited */ | 209 | /* Transmitter is inhibited */ |
| 203 | bs->tx_ptr = t->tx_buf; | 210 | bs->tx_ptr = t->tx_buf; |
| 204 | bs->rx_ptr = t->rx_buf; | 211 | bs->rx_ptr = t->rx_buf; |
| 205 | init_completion(&bs->done); | ||
| 206 | 212 | ||
| 207 | if (t->tx_buf) { | 213 | if (t->tx_buf) { |
| 208 | bs->remaining_bytes = t->len; | 214 | bs->remaining_bytes = t->len; |
| 209 | bcm63xx_spi_fill_tx_fifo(bs); | 215 | bcm63xx_spi_fill_tx_fifo(bs); |
| 210 | } | 216 | } |
| 211 | 217 | ||
| 212 | /* Enable the command done interrupt which | 218 | init_completion(&bs->done); |
| 213 | * we use to determine completion of a command */ | ||
| 214 | bcm_spi_writeb(bs, SPI_INTR_CMD_DONE, SPI_INT_MASK); | ||
| 215 | 219 | ||
| 216 | /* Fill in the Message control register */ | 220 | /* Fill in the Message control register */ |
| 217 | msg_ctl = (t->len << SPI_BYTE_CNT_SHIFT); | 221 | msg_ctl = (t->len << SPI_BYTE_CNT_SHIFT); |
| @@ -230,33 +234,76 @@ static int bcm63xx_txrx_bufs(struct spi_device *spi, struct spi_transfer *t) | |||
| 230 | cmd |= (0 << SPI_CMD_PREPEND_BYTE_CNT_SHIFT); | 234 | cmd |= (0 << SPI_CMD_PREPEND_BYTE_CNT_SHIFT); |
| 231 | cmd |= (spi->chip_select << SPI_CMD_DEVICE_ID_SHIFT); | 235 | cmd |= (spi->chip_select << SPI_CMD_DEVICE_ID_SHIFT); |
| 232 | bcm_spi_writew(bs, cmd, SPI_CMD); | 236 | bcm_spi_writew(bs, cmd, SPI_CMD); |
| 233 | wait_for_completion(&bs->done); | ||
| 234 | 237 | ||
| 235 | /* Disable the CMD_DONE interrupt */ | 238 | /* Enable the CMD_DONE interrupt */ |
| 236 | bcm_spi_writeb(bs, 0, SPI_INT_MASK); | 239 | bcm_spi_writeb(bs, SPI_INTR_CMD_DONE, SPI_INT_MASK); |
| 237 | 240 | ||
| 238 | return t->len - bs->remaining_bytes; | 241 | return t->len - bs->remaining_bytes; |
| 239 | } | 242 | } |
| 240 | 243 | ||
| 241 | static int bcm63xx_transfer(struct spi_device *spi, struct spi_message *m) | 244 | static int bcm63xx_spi_prepare_transfer(struct spi_master *master) |
| 242 | { | 245 | { |
| 243 | struct bcm63xx_spi *bs = spi_master_get_devdata(spi->master); | 246 | struct bcm63xx_spi *bs = spi_master_get_devdata(master); |
| 244 | struct spi_transfer *t; | ||
| 245 | int ret = 0; | ||
| 246 | 247 | ||
| 247 | if (unlikely(list_empty(&m->transfers))) | 248 | pm_runtime_get_sync(&bs->pdev->dev); |
| 248 | return -EINVAL; | ||
| 249 | 249 | ||
| 250 | if (bs->stopping) | 250 | return 0; |
| 251 | return -ESHUTDOWN; | 251 | } |
| 252 | |||
| 253 | static int bcm63xx_spi_unprepare_transfer(struct spi_master *master) | ||
| 254 | { | ||
| 255 | struct bcm63xx_spi *bs = spi_master_get_devdata(master); | ||
| 256 | |||
| 257 | pm_runtime_put(&bs->pdev->dev); | ||
| 258 | |||
| 259 | return 0; | ||
| 260 | } | ||
| 261 | |||
| 262 | static int bcm63xx_spi_transfer_one(struct spi_master *master, | ||
| 263 | struct spi_message *m) | ||
| 264 | { | ||
| 265 | struct bcm63xx_spi *bs = spi_master_get_devdata(master); | ||
| 266 | struct spi_transfer *t; | ||
| 267 | struct spi_device *spi = m->spi; | ||
| 268 | int status = 0; | ||
| 269 | unsigned int timeout = 0; | ||
| 252 | 270 | ||
| 253 | list_for_each_entry(t, &m->transfers, transfer_list) { | 271 | list_for_each_entry(t, &m->transfers, transfer_list) { |
| 254 | ret += bcm63xx_txrx_bufs(spi, t); | 272 | unsigned int len = t->len; |
| 255 | } | 273 | u8 rx_tail; |
| 256 | 274 | ||
| 257 | m->complete(m->context); | 275 | status = bcm63xx_spi_check_transfer(spi, t); |
| 276 | if (status < 0) | ||
| 277 | goto exit; | ||
| 258 | 278 | ||
| 259 | return ret; | 279 | /* configure adapter for a new transfer */ |
| 280 | bcm63xx_spi_setup_transfer(spi, t); | ||
| 281 | |||
| 282 | while (len) { | ||
| 283 | /* send the data */ | ||
| 284 | len -= bcm63xx_txrx_bufs(spi, t); | ||
| 285 | |||
| 286 | timeout = wait_for_completion_timeout(&bs->done, HZ); | ||
| 287 | if (!timeout) { | ||
| 288 | status = -ETIMEDOUT; | ||
| 289 | goto exit; | ||
| 290 | } | ||
| 291 | |||
| 292 | /* read out all data */ | ||
| 293 | rx_tail = bcm_spi_readb(bs, SPI_RX_TAIL); | ||
| 294 | |||
| 295 | /* Read out all the data */ | ||
| 296 | if (rx_tail) | ||
| 297 | memcpy_fromio(bs->rx_ptr, bs->rx_io, rx_tail); | ||
| 298 | } | ||
| 299 | |||
| 300 | m->actual_length += t->len; | ||
| 301 | } | ||
| 302 | exit: | ||
| 303 | m->status = status; | ||
| 304 | spi_finalize_current_message(master); | ||
| 305 | |||
| 306 | return 0; | ||
| 260 | } | 307 | } |
| 261 | 308 | ||
| 262 | /* This driver supports single master mode only. Hence | 309 | /* This driver supports single master mode only. Hence |
| @@ -267,39 +314,15 @@ static irqreturn_t bcm63xx_spi_interrupt(int irq, void *dev_id) | |||
| 267 | struct spi_master *master = (struct spi_master *)dev_id; | 314 | struct spi_master *master = (struct spi_master *)dev_id; |
| 268 | struct bcm63xx_spi *bs = spi_master_get_devdata(master); | 315 | struct bcm63xx_spi *bs = spi_master_get_devdata(master); |
| 269 | u8 intr; | 316 | u8 intr; |
| 270 | u16 cmd; | ||
| 271 | 317 | ||
| 272 | /* Read interupts and clear them immediately */ | 318 | /* Read interupts and clear them immediately */ |
| 273 | intr = bcm_spi_readb(bs, SPI_INT_STATUS); | 319 | intr = bcm_spi_readb(bs, SPI_INT_STATUS); |
| 274 | bcm_spi_writeb(bs, SPI_INTR_CLEAR_ALL, SPI_INT_STATUS); | 320 | bcm_spi_writeb(bs, SPI_INTR_CLEAR_ALL, SPI_INT_STATUS); |
| 275 | bcm_spi_writeb(bs, 0, SPI_INT_MASK); | 321 | bcm_spi_writeb(bs, 0, SPI_INT_MASK); |
| 276 | 322 | ||
| 277 | /* A tansfer completed */ | 323 | /* A transfer completed */ |
| 278 | if (intr & SPI_INTR_CMD_DONE) { | 324 | if (intr & SPI_INTR_CMD_DONE) |
| 279 | u8 rx_tail; | 325 | complete(&bs->done); |
| 280 | |||
| 281 | rx_tail = bcm_spi_readb(bs, SPI_RX_TAIL); | ||
| 282 | |||
| 283 | /* Read out all the data */ | ||
| 284 | if (rx_tail) | ||
| 285 | memcpy_fromio(bs->rx_ptr, bs->rx_io, rx_tail); | ||
| 286 | |||
| 287 | /* See if there is more data to send */ | ||
| 288 | if (bs->remaining_bytes > 0) { | ||
| 289 | bcm63xx_spi_fill_tx_fifo(bs); | ||
| 290 | |||
| 291 | /* Start the transfer */ | ||
| 292 | bcm_spi_writew(bs, SPI_HD_W << SPI_MSG_TYPE_SHIFT, | ||
| 293 | SPI_MSG_CTL); | ||
| 294 | cmd = bcm_spi_readw(bs, SPI_CMD); | ||
| 295 | cmd |= SPI_CMD_START_IMMEDIATE; | ||
| 296 | cmd |= (0 << SPI_CMD_PREPEND_BYTE_CNT_SHIFT); | ||
| 297 | bcm_spi_writeb(bs, SPI_INTR_CMD_DONE, SPI_INT_MASK); | ||
| 298 | bcm_spi_writew(bs, cmd, SPI_CMD); | ||
| 299 | } else { | ||
| 300 | complete(&bs->done); | ||
| 301 | } | ||
| 302 | } | ||
| 303 | 326 | ||
| 304 | return IRQ_HANDLED; | 327 | return IRQ_HANDLED; |
| 305 | } | 328 | } |
| @@ -345,7 +368,6 @@ static int __devinit bcm63xx_spi_probe(struct platform_device *pdev) | |||
| 345 | } | 368 | } |
| 346 | 369 | ||
| 347 | bs = spi_master_get_devdata(master); | 370 | bs = spi_master_get_devdata(master); |
| 348 | init_completion(&bs->done); | ||
| 349 | 371 | ||
| 350 | platform_set_drvdata(pdev, master); | 372 | platform_set_drvdata(pdev, master); |
| 351 | bs->pdev = pdev; | 373 | bs->pdev = pdev; |
| @@ -379,12 +401,13 @@ static int __devinit bcm63xx_spi_probe(struct platform_device *pdev) | |||
| 379 | master->bus_num = pdata->bus_num; | 401 | master->bus_num = pdata->bus_num; |
| 380 | master->num_chipselect = pdata->num_chipselect; | 402 | master->num_chipselect = pdata->num_chipselect; |
| 381 | master->setup = bcm63xx_spi_setup; | 403 | master->setup = bcm63xx_spi_setup; |
| 382 | master->transfer = bcm63xx_transfer; | 404 | master->prepare_transfer_hardware = bcm63xx_spi_prepare_transfer; |
| 405 | master->unprepare_transfer_hardware = bcm63xx_spi_unprepare_transfer; | ||
| 406 | master->transfer_one_message = bcm63xx_spi_transfer_one; | ||
| 407 | master->mode_bits = MODEBITS; | ||
| 383 | bs->speed_hz = pdata->speed_hz; | 408 | bs->speed_hz = pdata->speed_hz; |
| 384 | bs->stopping = 0; | ||
| 385 | bs->tx_io = (u8 *)(bs->regs + bcm63xx_spireg(SPI_MSG_DATA)); | 409 | bs->tx_io = (u8 *)(bs->regs + bcm63xx_spireg(SPI_MSG_DATA)); |
| 386 | bs->rx_io = (const u8 *)(bs->regs + bcm63xx_spireg(SPI_RX_DATA)); | 410 | bs->rx_io = (const u8 *)(bs->regs + bcm63xx_spireg(SPI_RX_DATA)); |
| 387 | spin_lock_init(&bs->lock); | ||
| 388 | 411 | ||
| 389 | /* Initialize hardware */ | 412 | /* Initialize hardware */ |
| 390 | clk_enable(bs->clk); | 413 | clk_enable(bs->clk); |
| @@ -418,18 +441,16 @@ static int __devexit bcm63xx_spi_remove(struct platform_device *pdev) | |||
| 418 | struct spi_master *master = platform_get_drvdata(pdev); | 441 | struct spi_master *master = platform_get_drvdata(pdev); |
| 419 | struct bcm63xx_spi *bs = spi_master_get_devdata(master); | 442 | struct bcm63xx_spi *bs = spi_master_get_devdata(master); |
| 420 | 443 | ||
| 444 | spi_unregister_master(master); | ||
| 445 | |||
| 421 | /* reset spi block */ | 446 | /* reset spi block */ |
| 422 | bcm_spi_writeb(bs, 0, SPI_INT_MASK); | 447 | bcm_spi_writeb(bs, 0, SPI_INT_MASK); |
| 423 | spin_lock(&bs->lock); | ||
| 424 | bs->stopping = 1; | ||
| 425 | 448 | ||
| 426 | /* HW shutdown */ | 449 | /* HW shutdown */ |
| 427 | clk_disable(bs->clk); | 450 | clk_disable(bs->clk); |
| 428 | clk_put(bs->clk); | 451 | clk_put(bs->clk); |
| 429 | 452 | ||
| 430 | spin_unlock(&bs->lock); | ||
| 431 | platform_set_drvdata(pdev, 0); | 453 | platform_set_drvdata(pdev, 0); |
| 432 | spi_unregister_master(master); | ||
| 433 | 454 | ||
| 434 | return 0; | 455 | return 0; |
| 435 | } | 456 | } |
diff --git a/drivers/spi/spi-bfin-sport.c b/drivers/spi/spi-bfin-sport.c index 248a2cc671a9..1fe51198a622 100644 --- a/drivers/spi/spi-bfin-sport.c +++ b/drivers/spi/spi-bfin-sport.c | |||
| @@ -252,19 +252,15 @@ static void | |||
| 252 | bfin_sport_spi_restore_state(struct bfin_sport_spi_master_data *drv_data) | 252 | bfin_sport_spi_restore_state(struct bfin_sport_spi_master_data *drv_data) |
| 253 | { | 253 | { |
| 254 | struct bfin_sport_spi_slave_data *chip = drv_data->cur_chip; | 254 | struct bfin_sport_spi_slave_data *chip = drv_data->cur_chip; |
| 255 | unsigned int bits = (drv_data->ops == &bfin_sport_transfer_ops_u8 ? 7 : 15); | ||
| 256 | 255 | ||
| 257 | bfin_sport_spi_disable(drv_data); | 256 | bfin_sport_spi_disable(drv_data); |
| 258 | dev_dbg(drv_data->dev, "restoring spi ctl state\n"); | 257 | dev_dbg(drv_data->dev, "restoring spi ctl state\n"); |
| 259 | 258 | ||
| 260 | bfin_write(&drv_data->regs->tcr1, chip->ctl_reg); | 259 | bfin_write(&drv_data->regs->tcr1, chip->ctl_reg); |
| 261 | bfin_write(&drv_data->regs->tcr2, bits); | ||
| 262 | bfin_write(&drv_data->regs->tclkdiv, chip->baud); | 260 | bfin_write(&drv_data->regs->tclkdiv, chip->baud); |
| 263 | bfin_write(&drv_data->regs->tfsdiv, bits); | ||
| 264 | SSYNC(); | 261 | SSYNC(); |
| 265 | 262 | ||
| 266 | bfin_write(&drv_data->regs->rcr1, chip->ctl_reg & ~(ITCLK | ITFS)); | 263 | bfin_write(&drv_data->regs->rcr1, chip->ctl_reg & ~(ITCLK | ITFS)); |
| 267 | bfin_write(&drv_data->regs->rcr2, bits); | ||
| 268 | SSYNC(); | 264 | SSYNC(); |
| 269 | 265 | ||
| 270 | bfin_sport_spi_cs_active(chip); | 266 | bfin_sport_spi_cs_active(chip); |
| @@ -420,11 +416,15 @@ bfin_sport_spi_pump_transfers(unsigned long data) | |||
| 420 | drv_data->cs_change = transfer->cs_change; | 416 | drv_data->cs_change = transfer->cs_change; |
| 421 | 417 | ||
| 422 | /* Bits per word setup */ | 418 | /* Bits per word setup */ |
| 423 | bits_per_word = transfer->bits_per_word ? : message->spi->bits_per_word; | 419 | bits_per_word = transfer->bits_per_word ? : |
| 424 | if (bits_per_word == 8) | 420 | message->spi->bits_per_word ? : 8; |
| 425 | drv_data->ops = &bfin_sport_transfer_ops_u8; | 421 | if (bits_per_word % 16 == 0) |
| 426 | else | ||
| 427 | drv_data->ops = &bfin_sport_transfer_ops_u16; | 422 | drv_data->ops = &bfin_sport_transfer_ops_u16; |
| 423 | else | ||
| 424 | drv_data->ops = &bfin_sport_transfer_ops_u8; | ||
| 425 | bfin_write(&drv_data->regs->tcr2, bits_per_word - 1); | ||
| 426 | bfin_write(&drv_data->regs->tfsdiv, bits_per_word - 1); | ||
| 427 | bfin_write(&drv_data->regs->rcr2, bits_per_word - 1); | ||
| 428 | 428 | ||
| 429 | drv_data->state = RUNNING_STATE; | 429 | drv_data->state = RUNNING_STATE; |
| 430 | 430 | ||
| @@ -598,11 +598,12 @@ bfin_sport_spi_setup(struct spi_device *spi) | |||
| 598 | } | 598 | } |
| 599 | chip->cs_chg_udelay = chip_info->cs_chg_udelay; | 599 | chip->cs_chg_udelay = chip_info->cs_chg_udelay; |
| 600 | chip->idle_tx_val = chip_info->idle_tx_val; | 600 | chip->idle_tx_val = chip_info->idle_tx_val; |
| 601 | spi->bits_per_word = chip_info->bits_per_word; | ||
| 602 | } | 601 | } |
| 603 | } | 602 | } |
| 604 | 603 | ||
| 605 | if (spi->bits_per_word != 8 && spi->bits_per_word != 16) { | 604 | if (spi->bits_per_word % 8) { |
| 605 | dev_err(&spi->dev, "%d bits_per_word is not supported\n", | ||
| 606 | spi->bits_per_word); | ||
| 606 | ret = -EINVAL; | 607 | ret = -EINVAL; |
| 607 | goto error; | 608 | goto error; |
| 608 | } | 609 | } |
diff --git a/drivers/spi/spi-bfin5xx.c b/drivers/spi/spi-bfin5xx.c index 3b83ff8b1e2b..9bb4d4af8547 100644 --- a/drivers/spi/spi-bfin5xx.c +++ b/drivers/spi/spi-bfin5xx.c | |||
| @@ -396,7 +396,7 @@ static irqreturn_t bfin_spi_pio_irq_handler(int irq, void *dev_id) | |||
| 396 | /* last read */ | 396 | /* last read */ |
| 397 | if (drv_data->rx) { | 397 | if (drv_data->rx) { |
| 398 | dev_dbg(&drv_data->pdev->dev, "last read\n"); | 398 | dev_dbg(&drv_data->pdev->dev, "last read\n"); |
| 399 | if (n_bytes % 2) { | 399 | if (!(n_bytes % 2)) { |
| 400 | u16 *buf = (u16 *)drv_data->rx; | 400 | u16 *buf = (u16 *)drv_data->rx; |
| 401 | for (loop = 0; loop < n_bytes / 2; loop++) | 401 | for (loop = 0; loop < n_bytes / 2; loop++) |
| 402 | *buf++ = bfin_read(&drv_data->regs->rdbr); | 402 | *buf++ = bfin_read(&drv_data->regs->rdbr); |
| @@ -424,7 +424,7 @@ static irqreturn_t bfin_spi_pio_irq_handler(int irq, void *dev_id) | |||
| 424 | if (drv_data->rx && drv_data->tx) { | 424 | if (drv_data->rx && drv_data->tx) { |
| 425 | /* duplex */ | 425 | /* duplex */ |
| 426 | dev_dbg(&drv_data->pdev->dev, "duplex: write_TDBR\n"); | 426 | dev_dbg(&drv_data->pdev->dev, "duplex: write_TDBR\n"); |
| 427 | if (n_bytes % 2) { | 427 | if (!(n_bytes % 2)) { |
| 428 | u16 *buf = (u16 *)drv_data->rx; | 428 | u16 *buf = (u16 *)drv_data->rx; |
| 429 | u16 *buf2 = (u16 *)drv_data->tx; | 429 | u16 *buf2 = (u16 *)drv_data->tx; |
| 430 | for (loop = 0; loop < n_bytes / 2; loop++) { | 430 | for (loop = 0; loop < n_bytes / 2; loop++) { |
| @@ -442,7 +442,7 @@ static irqreturn_t bfin_spi_pio_irq_handler(int irq, void *dev_id) | |||
| 442 | } else if (drv_data->rx) { | 442 | } else if (drv_data->rx) { |
| 443 | /* read */ | 443 | /* read */ |
| 444 | dev_dbg(&drv_data->pdev->dev, "read: write_TDBR\n"); | 444 | dev_dbg(&drv_data->pdev->dev, "read: write_TDBR\n"); |
| 445 | if (n_bytes % 2) { | 445 | if (!(n_bytes % 2)) { |
| 446 | u16 *buf = (u16 *)drv_data->rx; | 446 | u16 *buf = (u16 *)drv_data->rx; |
| 447 | for (loop = 0; loop < n_bytes / 2; loop++) { | 447 | for (loop = 0; loop < n_bytes / 2; loop++) { |
| 448 | *buf++ = bfin_read(&drv_data->regs->rdbr); | 448 | *buf++ = bfin_read(&drv_data->regs->rdbr); |
| @@ -458,7 +458,7 @@ static irqreturn_t bfin_spi_pio_irq_handler(int irq, void *dev_id) | |||
| 458 | } else if (drv_data->tx) { | 458 | } else if (drv_data->tx) { |
| 459 | /* write */ | 459 | /* write */ |
| 460 | dev_dbg(&drv_data->pdev->dev, "write: write_TDBR\n"); | 460 | dev_dbg(&drv_data->pdev->dev, "write: write_TDBR\n"); |
| 461 | if (n_bytes % 2) { | 461 | if (!(n_bytes % 2)) { |
| 462 | u16 *buf = (u16 *)drv_data->tx; | 462 | u16 *buf = (u16 *)drv_data->tx; |
| 463 | for (loop = 0; loop < n_bytes / 2; loop++) { | 463 | for (loop = 0; loop < n_bytes / 2; loop++) { |
| 464 | bfin_read(&drv_data->regs->rdbr); | 464 | bfin_read(&drv_data->regs->rdbr); |
| @@ -587,6 +587,7 @@ static void bfin_spi_pump_transfers(unsigned long data) | |||
| 587 | if (message->state == DONE_STATE) { | 587 | if (message->state == DONE_STATE) { |
| 588 | dev_dbg(&drv_data->pdev->dev, "transfer: all done!\n"); | 588 | dev_dbg(&drv_data->pdev->dev, "transfer: all done!\n"); |
| 589 | message->status = 0; | 589 | message->status = 0; |
| 590 | bfin_spi_flush(drv_data); | ||
| 590 | bfin_spi_giveback(drv_data); | 591 | bfin_spi_giveback(drv_data); |
| 591 | return; | 592 | return; |
| 592 | } | 593 | } |
| @@ -870,8 +871,10 @@ static void bfin_spi_pump_transfers(unsigned long data) | |||
| 870 | message->actual_length += drv_data->len_in_bytes; | 871 | message->actual_length += drv_data->len_in_bytes; |
| 871 | /* Move to next transfer of this msg */ | 872 | /* Move to next transfer of this msg */ |
| 872 | message->state = bfin_spi_next_transfer(drv_data); | 873 | message->state = bfin_spi_next_transfer(drv_data); |
| 873 | if (drv_data->cs_change) | 874 | if (drv_data->cs_change && message->state != DONE_STATE) { |
| 875 | bfin_spi_flush(drv_data); | ||
| 874 | bfin_spi_cs_deactive(drv_data, chip); | 876 | bfin_spi_cs_deactive(drv_data, chip); |
| 877 | } | ||
| 875 | } | 878 | } |
| 876 | 879 | ||
| 877 | /* Schedule next transfer tasklet */ | 880 | /* Schedule next transfer tasklet */ |
| @@ -1026,7 +1029,6 @@ static int bfin_spi_setup(struct spi_device *spi) | |||
| 1026 | chip->cs_chg_udelay = chip_info->cs_chg_udelay; | 1029 | chip->cs_chg_udelay = chip_info->cs_chg_udelay; |
| 1027 | chip->idle_tx_val = chip_info->idle_tx_val; | 1030 | chip->idle_tx_val = chip_info->idle_tx_val; |
| 1028 | chip->pio_interrupt = chip_info->pio_interrupt; | 1031 | chip->pio_interrupt = chip_info->pio_interrupt; |
| 1029 | spi->bits_per_word = chip_info->bits_per_word; | ||
| 1030 | } else { | 1032 | } else { |
| 1031 | /* force a default base state */ | 1033 | /* force a default base state */ |
| 1032 | chip->ctl_reg &= bfin_ctl_reg; | 1034 | chip->ctl_reg &= bfin_ctl_reg; |
diff --git a/drivers/spi/spi-ep93xx.c b/drivers/spi/spi-ep93xx.c index 6db2887852d6..e8055073e84d 100644 --- a/drivers/spi/spi-ep93xx.c +++ b/drivers/spi/spi-ep93xx.c | |||
| @@ -545,13 +545,12 @@ static void ep93xx_spi_pio_transfer(struct ep93xx_spi *espi) | |||
| 545 | * in case of failure. | 545 | * in case of failure. |
| 546 | */ | 546 | */ |
| 547 | static struct dma_async_tx_descriptor * | 547 | static struct dma_async_tx_descriptor * |
| 548 | ep93xx_spi_dma_prepare(struct ep93xx_spi *espi, enum dma_data_direction dir) | 548 | ep93xx_spi_dma_prepare(struct ep93xx_spi *espi, enum dma_transfer_direction dir) |
| 549 | { | 549 | { |
| 550 | struct spi_transfer *t = espi->current_msg->state; | 550 | struct spi_transfer *t = espi->current_msg->state; |
| 551 | struct dma_async_tx_descriptor *txd; | 551 | struct dma_async_tx_descriptor *txd; |
| 552 | enum dma_slave_buswidth buswidth; | 552 | enum dma_slave_buswidth buswidth; |
| 553 | struct dma_slave_config conf; | 553 | struct dma_slave_config conf; |
| 554 | enum dma_transfer_direction slave_dirn; | ||
| 555 | struct scatterlist *sg; | 554 | struct scatterlist *sg; |
| 556 | struct sg_table *sgt; | 555 | struct sg_table *sgt; |
| 557 | struct dma_chan *chan; | 556 | struct dma_chan *chan; |
| @@ -567,14 +566,13 @@ ep93xx_spi_dma_prepare(struct ep93xx_spi *espi, enum dma_data_direction dir) | |||
| 567 | memset(&conf, 0, sizeof(conf)); | 566 | memset(&conf, 0, sizeof(conf)); |
| 568 | conf.direction = dir; | 567 | conf.direction = dir; |
| 569 | 568 | ||
| 570 | if (dir == DMA_FROM_DEVICE) { | 569 | if (dir == DMA_DEV_TO_MEM) { |
| 571 | chan = espi->dma_rx; | 570 | chan = espi->dma_rx; |
| 572 | buf = t->rx_buf; | 571 | buf = t->rx_buf; |
| 573 | sgt = &espi->rx_sgt; | 572 | sgt = &espi->rx_sgt; |
| 574 | 573 | ||
| 575 | conf.src_addr = espi->sspdr_phys; | 574 | conf.src_addr = espi->sspdr_phys; |
| 576 | conf.src_addr_width = buswidth; | 575 | conf.src_addr_width = buswidth; |
| 577 | slave_dirn = DMA_DEV_TO_MEM; | ||
| 578 | } else { | 576 | } else { |
| 579 | chan = espi->dma_tx; | 577 | chan = espi->dma_tx; |
| 580 | buf = t->tx_buf; | 578 | buf = t->tx_buf; |
| @@ -582,7 +580,6 @@ ep93xx_spi_dma_prepare(struct ep93xx_spi *espi, enum dma_data_direction dir) | |||
| 582 | 580 | ||
| 583 | conf.dst_addr = espi->sspdr_phys; | 581 | conf.dst_addr = espi->sspdr_phys; |
| 584 | conf.dst_addr_width = buswidth; | 582 | conf.dst_addr_width = buswidth; |
| 585 | slave_dirn = DMA_MEM_TO_DEV; | ||
| 586 | } | 583 | } |
| 587 | 584 | ||
| 588 | ret = dmaengine_slave_config(chan, &conf); | 585 | ret = dmaengine_slave_config(chan, &conf); |
| @@ -633,8 +630,7 @@ ep93xx_spi_dma_prepare(struct ep93xx_spi *espi, enum dma_data_direction dir) | |||
| 633 | if (!nents) | 630 | if (!nents) |
| 634 | return ERR_PTR(-ENOMEM); | 631 | return ERR_PTR(-ENOMEM); |
| 635 | 632 | ||
| 636 | txd = dmaengine_prep_slave_sg(chan, sgt->sgl, nents, | 633 | txd = dmaengine_prep_slave_sg(chan, sgt->sgl, nents, dir, DMA_CTRL_ACK); |
| 637 | slave_dirn, DMA_CTRL_ACK); | ||
| 638 | if (!txd) { | 634 | if (!txd) { |
| 639 | dma_unmap_sg(chan->device->dev, sgt->sgl, sgt->nents, dir); | 635 | dma_unmap_sg(chan->device->dev, sgt->sgl, sgt->nents, dir); |
| 640 | return ERR_PTR(-ENOMEM); | 636 | return ERR_PTR(-ENOMEM); |
| @@ -651,12 +647,12 @@ ep93xx_spi_dma_prepare(struct ep93xx_spi *espi, enum dma_data_direction dir) | |||
| 651 | * unmapped. | 647 | * unmapped. |
| 652 | */ | 648 | */ |
| 653 | static void ep93xx_spi_dma_finish(struct ep93xx_spi *espi, | 649 | static void ep93xx_spi_dma_finish(struct ep93xx_spi *espi, |
| 654 | enum dma_data_direction dir) | 650 | enum dma_transfer_direction dir) |
| 655 | { | 651 | { |
| 656 | struct dma_chan *chan; | 652 | struct dma_chan *chan; |
| 657 | struct sg_table *sgt; | 653 | struct sg_table *sgt; |
| 658 | 654 | ||
| 659 | if (dir == DMA_FROM_DEVICE) { | 655 | if (dir == DMA_DEV_TO_MEM) { |
| 660 | chan = espi->dma_rx; | 656 | chan = espi->dma_rx; |
| 661 | sgt = &espi->rx_sgt; | 657 | sgt = &espi->rx_sgt; |
| 662 | } else { | 658 | } else { |
| @@ -677,16 +673,16 @@ static void ep93xx_spi_dma_transfer(struct ep93xx_spi *espi) | |||
| 677 | struct spi_message *msg = espi->current_msg; | 673 | struct spi_message *msg = espi->current_msg; |
| 678 | struct dma_async_tx_descriptor *rxd, *txd; | 674 | struct dma_async_tx_descriptor *rxd, *txd; |
| 679 | 675 | ||
| 680 | rxd = ep93xx_spi_dma_prepare(espi, DMA_FROM_DEVICE); | 676 | rxd = ep93xx_spi_dma_prepare(espi, DMA_DEV_TO_MEM); |
| 681 | if (IS_ERR(rxd)) { | 677 | if (IS_ERR(rxd)) { |
| 682 | dev_err(&espi->pdev->dev, "DMA RX failed: %ld\n", PTR_ERR(rxd)); | 678 | dev_err(&espi->pdev->dev, "DMA RX failed: %ld\n", PTR_ERR(rxd)); |
| 683 | msg->status = PTR_ERR(rxd); | 679 | msg->status = PTR_ERR(rxd); |
| 684 | return; | 680 | return; |
| 685 | } | 681 | } |
| 686 | 682 | ||
| 687 | txd = ep93xx_spi_dma_prepare(espi, DMA_TO_DEVICE); | 683 | txd = ep93xx_spi_dma_prepare(espi, DMA_MEM_TO_DEV); |
| 688 | if (IS_ERR(txd)) { | 684 | if (IS_ERR(txd)) { |
| 689 | ep93xx_spi_dma_finish(espi, DMA_FROM_DEVICE); | 685 | ep93xx_spi_dma_finish(espi, DMA_DEV_TO_MEM); |
| 690 | dev_err(&espi->pdev->dev, "DMA TX failed: %ld\n", PTR_ERR(rxd)); | 686 | dev_err(&espi->pdev->dev, "DMA TX failed: %ld\n", PTR_ERR(rxd)); |
| 691 | msg->status = PTR_ERR(txd); | 687 | msg->status = PTR_ERR(txd); |
| 692 | return; | 688 | return; |
| @@ -705,8 +701,8 @@ static void ep93xx_spi_dma_transfer(struct ep93xx_spi *espi) | |||
| 705 | 701 | ||
| 706 | wait_for_completion(&espi->wait); | 702 | wait_for_completion(&espi->wait); |
| 707 | 703 | ||
| 708 | ep93xx_spi_dma_finish(espi, DMA_TO_DEVICE); | 704 | ep93xx_spi_dma_finish(espi, DMA_MEM_TO_DEV); |
| 709 | ep93xx_spi_dma_finish(espi, DMA_FROM_DEVICE); | 705 | ep93xx_spi_dma_finish(espi, DMA_DEV_TO_MEM); |
| 710 | } | 706 | } |
| 711 | 707 | ||
| 712 | /** | 708 | /** |
diff --git a/drivers/spi/spi-pl022.c b/drivers/spi/spi-pl022.c index 09c925aaf320..400ae2121a2a 100644 --- a/drivers/spi/spi-pl022.c +++ b/drivers/spi/spi-pl022.c | |||
| @@ -1667,9 +1667,15 @@ static int calculate_effective_freq(struct pl022 *pl022, int freq, struct | |||
| 1667 | /* cpsdvsr = 254 & scr = 255 */ | 1667 | /* cpsdvsr = 254 & scr = 255 */ |
| 1668 | min_tclk = spi_rate(rate, CPSDVR_MAX, SCR_MAX); | 1668 | min_tclk = spi_rate(rate, CPSDVR_MAX, SCR_MAX); |
| 1669 | 1669 | ||
| 1670 | if (!((freq <= max_tclk) && (freq >= min_tclk))) { | 1670 | if (freq > max_tclk) |
| 1671 | dev_warn(&pl022->adev->dev, | ||
| 1672 | "Max speed that can be programmed is %d Hz, you requested %d\n", | ||
| 1673 | max_tclk, freq); | ||
| 1674 | |||
| 1675 | if (freq < min_tclk) { | ||
| 1671 | dev_err(&pl022->adev->dev, | 1676 | dev_err(&pl022->adev->dev, |
| 1672 | "controller data is incorrect: out of range frequency"); | 1677 | "Requested frequency: %d Hz is less than minimum possible %d Hz\n", |
| 1678 | freq, min_tclk); | ||
| 1673 | return -EINVAL; | 1679 | return -EINVAL; |
| 1674 | } | 1680 | } |
| 1675 | 1681 | ||
| @@ -1681,26 +1687,37 @@ static int calculate_effective_freq(struct pl022 *pl022, int freq, struct | |||
| 1681 | while (scr <= SCR_MAX) { | 1687 | while (scr <= SCR_MAX) { |
| 1682 | tmp = spi_rate(rate, cpsdvsr, scr); | 1688 | tmp = spi_rate(rate, cpsdvsr, scr); |
| 1683 | 1689 | ||
| 1684 | if (tmp > freq) | 1690 | if (tmp > freq) { |
| 1691 | /* we need lower freq */ | ||
| 1685 | scr++; | 1692 | scr++; |
| 1693 | continue; | ||
| 1694 | } | ||
| 1695 | |||
| 1686 | /* | 1696 | /* |
| 1687 | * If found exact value, update and break. | 1697 | * If found exact value, mark found and break. |
| 1688 | * If found more closer value, update and continue. | 1698 | * If found more closer value, update and break. |
| 1689 | */ | 1699 | */ |
| 1690 | else if ((tmp == freq) || (tmp > best_freq)) { | 1700 | if (tmp > best_freq) { |
| 1691 | best_freq = tmp; | 1701 | best_freq = tmp; |
| 1692 | best_cpsdvsr = cpsdvsr; | 1702 | best_cpsdvsr = cpsdvsr; |
| 1693 | best_scr = scr; | 1703 | best_scr = scr; |
| 1694 | 1704 | ||
| 1695 | if (tmp == freq) | 1705 | if (tmp == freq) |
| 1696 | break; | 1706 | found = 1; |
| 1697 | } | 1707 | } |
| 1698 | scr++; | 1708 | /* |
| 1709 | * increased scr will give lower rates, which are not | ||
| 1710 | * required | ||
| 1711 | */ | ||
| 1712 | break; | ||
| 1699 | } | 1713 | } |
| 1700 | cpsdvsr += 2; | 1714 | cpsdvsr += 2; |
| 1701 | scr = SCR_MIN; | 1715 | scr = SCR_MIN; |
| 1702 | } | 1716 | } |
| 1703 | 1717 | ||
| 1718 | WARN(!best_freq, "pl022: Matching cpsdvsr and scr not found for %d Hz rate \n", | ||
| 1719 | freq); | ||
| 1720 | |||
| 1704 | clk_freq->cpsdvsr = (u8) (best_cpsdvsr & 0xFF); | 1721 | clk_freq->cpsdvsr = (u8) (best_cpsdvsr & 0xFF); |
| 1705 | clk_freq->scr = (u8) (best_scr & 0xFF); | 1722 | clk_freq->scr = (u8) (best_scr & 0xFF); |
| 1706 | dev_dbg(&pl022->adev->dev, | 1723 | dev_dbg(&pl022->adev->dev, |
| @@ -1823,9 +1840,12 @@ static int pl022_setup(struct spi_device *spi) | |||
| 1823 | } else | 1840 | } else |
| 1824 | chip->cs_control = chip_info->cs_control; | 1841 | chip->cs_control = chip_info->cs_control; |
| 1825 | 1842 | ||
| 1826 | if (bits <= 3) { | 1843 | /* Check bits per word with vendor specific range */ |
| 1827 | /* PL022 doesn't support less than 4-bits */ | 1844 | if ((bits <= 3) || (bits > pl022->vendor->max_bpw)) { |
| 1828 | status = -ENOTSUPP; | 1845 | status = -ENOTSUPP; |
| 1846 | dev_err(&spi->dev, "illegal data size for this controller!\n"); | ||
| 1847 | dev_err(&spi->dev, "This controller can only handle 4 <= n <= %d bit words\n", | ||
| 1848 | pl022->vendor->max_bpw); | ||
| 1829 | goto err_config_params; | 1849 | goto err_config_params; |
| 1830 | } else if (bits <= 8) { | 1850 | } else if (bits <= 8) { |
| 1831 | dev_dbg(&spi->dev, "4 <= n <=8 bits per word\n"); | 1851 | dev_dbg(&spi->dev, "4 <= n <=8 bits per word\n"); |
| @@ -1838,20 +1858,10 @@ static int pl022_setup(struct spi_device *spi) | |||
| 1838 | chip->read = READING_U16; | 1858 | chip->read = READING_U16; |
| 1839 | chip->write = WRITING_U16; | 1859 | chip->write = WRITING_U16; |
| 1840 | } else { | 1860 | } else { |
| 1841 | if (pl022->vendor->max_bpw >= 32) { | 1861 | dev_dbg(&spi->dev, "17 <= n <= 32 bits per word\n"); |
| 1842 | dev_dbg(&spi->dev, "17 <= n <= 32 bits per word\n"); | 1862 | chip->n_bytes = 4; |
| 1843 | chip->n_bytes = 4; | 1863 | chip->read = READING_U32; |
| 1844 | chip->read = READING_U32; | 1864 | chip->write = WRITING_U32; |
| 1845 | chip->write = WRITING_U32; | ||
| 1846 | } else { | ||
| 1847 | dev_err(&spi->dev, | ||
| 1848 | "illegal data size for this controller!\n"); | ||
| 1849 | dev_err(&spi->dev, | ||
| 1850 | "a standard pl022 can only handle " | ||
| 1851 | "1 <= n <= 16 bit words\n"); | ||
| 1852 | status = -ENOTSUPP; | ||
| 1853 | goto err_config_params; | ||
| 1854 | } | ||
| 1855 | } | 1865 | } |
| 1856 | 1866 | ||
| 1857 | /* Now Initialize all register settings required for this chip */ | 1867 | /* Now Initialize all register settings required for this chip */ |
diff --git a/drivers/staging/octeon/ethernet-rx.c b/drivers/staging/octeon/ethernet-rx.c index 400df8cbee53..d91751f9ffe8 100644 --- a/drivers/staging/octeon/ethernet-rx.c +++ b/drivers/staging/octeon/ethernet-rx.c | |||
| @@ -36,6 +36,7 @@ | |||
| 36 | #include <linux/prefetch.h> | 36 | #include <linux/prefetch.h> |
| 37 | #include <linux/ratelimit.h> | 37 | #include <linux/ratelimit.h> |
| 38 | #include <linux/smp.h> | 38 | #include <linux/smp.h> |
| 39 | #include <linux/interrupt.h> | ||
| 39 | #include <net/dst.h> | 40 | #include <net/dst.h> |
| 40 | #ifdef CONFIG_XFRM | 41 | #ifdef CONFIG_XFRM |
| 41 | #include <linux/xfrm.h> | 42 | #include <linux/xfrm.h> |
diff --git a/drivers/staging/octeon/ethernet-tx.c b/drivers/staging/octeon/ethernet-tx.c index 56d74dc2fbd5..91a97b3e45c6 100644 --- a/drivers/staging/octeon/ethernet-tx.c +++ b/drivers/staging/octeon/ethernet-tx.c | |||
| @@ -32,6 +32,7 @@ | |||
| 32 | #include <linux/ip.h> | 32 | #include <linux/ip.h> |
| 33 | #include <linux/ratelimit.h> | 33 | #include <linux/ratelimit.h> |
| 34 | #include <linux/string.h> | 34 | #include <linux/string.h> |
| 35 | #include <linux/interrupt.h> | ||
| 35 | #include <net/dst.h> | 36 | #include <net/dst.h> |
| 36 | #ifdef CONFIG_XFRM | 37 | #ifdef CONFIG_XFRM |
| 37 | #include <linux/xfrm.h> | 38 | #include <linux/xfrm.h> |
diff --git a/drivers/staging/octeon/ethernet.c b/drivers/staging/octeon/ethernet.c index 9112cd882154..60cba8194de3 100644 --- a/drivers/staging/octeon/ethernet.c +++ b/drivers/staging/octeon/ethernet.c | |||
| @@ -31,6 +31,7 @@ | |||
| 31 | #include <linux/etherdevice.h> | 31 | #include <linux/etherdevice.h> |
| 32 | #include <linux/phy.h> | 32 | #include <linux/phy.h> |
| 33 | #include <linux/slab.h> | 33 | #include <linux/slab.h> |
| 34 | #include <linux/interrupt.h> | ||
| 34 | 35 | ||
| 35 | #include <net/dst.h> | 36 | #include <net/dst.h> |
| 36 | 37 | ||
diff --git a/drivers/staging/ozwpan/ozpd.c b/drivers/staging/ozwpan/ozpd.c index 2b45d3d1800c..04cd57f2a6da 100644 --- a/drivers/staging/ozwpan/ozpd.c +++ b/drivers/staging/ozwpan/ozpd.c | |||
| @@ -383,8 +383,6 @@ static void oz_tx_frame_free(struct oz_pd *pd, struct oz_tx_frame *f) | |||
| 383 | pd->tx_pool = &f->link; | 383 | pd->tx_pool = &f->link; |
| 384 | pd->tx_pool_count++; | 384 | pd->tx_pool_count++; |
| 385 | f = 0; | 385 | f = 0; |
| 386 | } else { | ||
| 387 | kfree(f); | ||
| 388 | } | 386 | } |
| 389 | spin_unlock_bh(&pd->tx_frame_lock); | 387 | spin_unlock_bh(&pd->tx_frame_lock); |
| 390 | if (f) | 388 | if (f) |
diff --git a/drivers/staging/tidspbridge/core/tiomap3430.c b/drivers/staging/tidspbridge/core/tiomap3430.c index 7862513cc295..9cf29fcea11e 100644 --- a/drivers/staging/tidspbridge/core/tiomap3430.c +++ b/drivers/staging/tidspbridge/core/tiomap3430.c | |||
| @@ -79,10 +79,6 @@ | |||
| 79 | #define OMAP343X_CONTROL_IVA2_BOOTADDR (OMAP2_CONTROL_GENERAL + 0x0190) | 79 | #define OMAP343X_CONTROL_IVA2_BOOTADDR (OMAP2_CONTROL_GENERAL + 0x0190) |
| 80 | #define OMAP343X_CONTROL_IVA2_BOOTMOD (OMAP2_CONTROL_GENERAL + 0x0194) | 80 | #define OMAP343X_CONTROL_IVA2_BOOTMOD (OMAP2_CONTROL_GENERAL + 0x0194) |
| 81 | 81 | ||
| 82 | #define OMAP343X_CTRL_REGADDR(reg) \ | ||
| 83 | OMAP2_L4_IO_ADDRESS(OMAP343X_CTRL_BASE + (reg)) | ||
| 84 | |||
| 85 | |||
| 86 | /* Forward Declarations: */ | 82 | /* Forward Declarations: */ |
| 87 | static int bridge_brd_monitor(struct bridge_dev_context *dev_ctxt); | 83 | static int bridge_brd_monitor(struct bridge_dev_context *dev_ctxt); |
| 88 | static int bridge_brd_read(struct bridge_dev_context *dev_ctxt, | 84 | static int bridge_brd_read(struct bridge_dev_context *dev_ctxt, |
| @@ -418,19 +414,27 @@ static int bridge_brd_start(struct bridge_dev_context *dev_ctxt, | |||
| 418 | 414 | ||
| 419 | /* Assert RST1 i.e only the RST only for DSP megacell */ | 415 | /* Assert RST1 i.e only the RST only for DSP megacell */ |
| 420 | if (!status) { | 416 | if (!status) { |
| 417 | /* | ||
| 418 | * XXX: ioremapping MUST be removed once ctrl | ||
| 419 | * function is made available. | ||
| 420 | */ | ||
| 421 | void __iomem *ctrl = ioremap(OMAP343X_CTRL_BASE, SZ_4K); | ||
| 422 | if (!ctrl) | ||
| 423 | return -ENOMEM; | ||
| 424 | |||
| 421 | (*pdata->dsp_prm_rmw_bits)(OMAP3430_RST1_IVA2_MASK, | 425 | (*pdata->dsp_prm_rmw_bits)(OMAP3430_RST1_IVA2_MASK, |
| 422 | OMAP3430_RST1_IVA2_MASK, OMAP3430_IVA2_MOD, | 426 | OMAP3430_RST1_IVA2_MASK, OMAP3430_IVA2_MOD, |
| 423 | OMAP2_RM_RSTCTRL); | 427 | OMAP2_RM_RSTCTRL); |
| 424 | /* Mask address with 1K for compatibility */ | 428 | /* Mask address with 1K for compatibility */ |
| 425 | __raw_writel(dsp_addr & OMAP3_IVA2_BOOTADDR_MASK, | 429 | __raw_writel(dsp_addr & OMAP3_IVA2_BOOTADDR_MASK, |
| 426 | OMAP343X_CTRL_REGADDR( | 430 | ctrl + OMAP343X_CONTROL_IVA2_BOOTADDR); |
| 427 | OMAP343X_CONTROL_IVA2_BOOTADDR)); | ||
| 428 | /* | 431 | /* |
| 429 | * Set bootmode to self loop if dsp_debug flag is true | 432 | * Set bootmode to self loop if dsp_debug flag is true |
| 430 | */ | 433 | */ |
| 431 | __raw_writel((dsp_debug) ? OMAP3_IVA2_BOOTMOD_IDLE : 0, | 434 | __raw_writel((dsp_debug) ? OMAP3_IVA2_BOOTMOD_IDLE : 0, |
| 432 | OMAP343X_CTRL_REGADDR( | 435 | ctrl + OMAP343X_CONTROL_IVA2_BOOTMOD); |
| 433 | OMAP343X_CONTROL_IVA2_BOOTMOD)); | 436 | |
| 437 | iounmap(ctrl); | ||
| 434 | } | 438 | } |
| 435 | } | 439 | } |
| 436 | if (!status) { | 440 | if (!status) { |
diff --git a/drivers/staging/tidspbridge/core/wdt.c b/drivers/staging/tidspbridge/core/wdt.c index 70055c8111ed..870f934f4f3b 100644 --- a/drivers/staging/tidspbridge/core/wdt.c +++ b/drivers/staging/tidspbridge/core/wdt.c | |||
| @@ -53,7 +53,10 @@ int dsp_wdt_init(void) | |||
| 53 | int ret = 0; | 53 | int ret = 0; |
| 54 | 54 | ||
| 55 | dsp_wdt.sm_wdt = NULL; | 55 | dsp_wdt.sm_wdt = NULL; |
| 56 | dsp_wdt.reg_base = OMAP2_L4_IO_ADDRESS(OMAP34XX_WDT3_BASE); | 56 | dsp_wdt.reg_base = ioremap(OMAP34XX_WDT3_BASE, SZ_4K); |
| 57 | if (!dsp_wdt.reg_base) | ||
| 58 | return -ENOMEM; | ||
| 59 | |||
| 57 | tasklet_init(&dsp_wdt.wdt3_tasklet, dsp_wdt_dpc, 0); | 60 | tasklet_init(&dsp_wdt.wdt3_tasklet, dsp_wdt_dpc, 0); |
| 58 | 61 | ||
| 59 | dsp_wdt.fclk = clk_get(NULL, "wdt3_fck"); | 62 | dsp_wdt.fclk = clk_get(NULL, "wdt3_fck"); |
| @@ -99,6 +102,9 @@ void dsp_wdt_exit(void) | |||
| 99 | dsp_wdt.fclk = NULL; | 102 | dsp_wdt.fclk = NULL; |
| 100 | dsp_wdt.iclk = NULL; | 103 | dsp_wdt.iclk = NULL; |
| 101 | dsp_wdt.sm_wdt = NULL; | 104 | dsp_wdt.sm_wdt = NULL; |
| 105 | |||
| 106 | if (dsp_wdt.reg_base) | ||
| 107 | iounmap(dsp_wdt.reg_base); | ||
| 102 | dsp_wdt.reg_base = NULL; | 108 | dsp_wdt.reg_base = NULL; |
| 103 | } | 109 | } |
| 104 | 110 | ||
diff --git a/drivers/staging/zcache/Kconfig b/drivers/staging/zcache/Kconfig index 3ed2c8f656a5..7048e01f0817 100644 --- a/drivers/staging/zcache/Kconfig +++ b/drivers/staging/zcache/Kconfig | |||
| @@ -2,7 +2,7 @@ config ZCACHE | |||
| 2 | bool "Dynamic compression of swap pages and clean pagecache pages" | 2 | bool "Dynamic compression of swap pages and clean pagecache pages" |
| 3 | # X86 dependency is because zsmalloc uses non-portable pte/tlb | 3 | # X86 dependency is because zsmalloc uses non-portable pte/tlb |
| 4 | # functions | 4 | # functions |
| 5 | depends on (CLEANCACHE || FRONTSWAP) && CRYPTO && X86 | 5 | depends on (CLEANCACHE || FRONTSWAP) && CRYPTO=y && X86 |
| 6 | select ZSMALLOC | 6 | select ZSMALLOC |
| 7 | select CRYPTO_LZO | 7 | select CRYPTO_LZO |
| 8 | default n | 8 | default n |
diff --git a/drivers/tty/amiserial.c b/drivers/tty/amiserial.c index 24145c30c9b0..6cc4358f68c1 100644 --- a/drivers/tty/amiserial.c +++ b/drivers/tty/amiserial.c | |||
| @@ -1073,8 +1073,10 @@ static int set_serial_info(struct tty_struct *tty, struct serial_state *state, | |||
| 1073 | (new_serial.close_delay != port->close_delay) || | 1073 | (new_serial.close_delay != port->close_delay) || |
| 1074 | (new_serial.xmit_fifo_size != state->xmit_fifo_size) || | 1074 | (new_serial.xmit_fifo_size != state->xmit_fifo_size) || |
| 1075 | ((new_serial.flags & ~ASYNC_USR_MASK) != | 1075 | ((new_serial.flags & ~ASYNC_USR_MASK) != |
| 1076 | (port->flags & ~ASYNC_USR_MASK))) | 1076 | (port->flags & ~ASYNC_USR_MASK))) { |
| 1077 | tty_unlock(); | ||
| 1077 | return -EPERM; | 1078 | return -EPERM; |
| 1079 | } | ||
| 1078 | port->flags = ((port->flags & ~ASYNC_USR_MASK) | | 1080 | port->flags = ((port->flags & ~ASYNC_USR_MASK) | |
| 1079 | (new_serial.flags & ASYNC_USR_MASK)); | 1081 | (new_serial.flags & ASYNC_USR_MASK)); |
| 1080 | state->custom_divisor = new_serial.custom_divisor; | 1082 | state->custom_divisor = new_serial.custom_divisor; |
diff --git a/drivers/tty/serial/clps711x.c b/drivers/tty/serial/clps711x.c index e6c3dbd781d6..836fe2731234 100644 --- a/drivers/tty/serial/clps711x.c +++ b/drivers/tty/serial/clps711x.c | |||
| @@ -154,10 +154,9 @@ static irqreturn_t clps711xuart_int_tx(int irq, void *dev_id) | |||
| 154 | port->x_char = 0; | 154 | port->x_char = 0; |
| 155 | return IRQ_HANDLED; | 155 | return IRQ_HANDLED; |
| 156 | } | 156 | } |
| 157 | if (uart_circ_empty(xmit) || uart_tx_stopped(port)) { | 157 | |
| 158 | clps711xuart_stop_tx(port); | 158 | if (uart_circ_empty(xmit) || uart_tx_stopped(port)) |
| 159 | return IRQ_HANDLED; | 159 | goto disable_tx_irq; |
| 160 | } | ||
| 161 | 160 | ||
| 162 | count = port->fifosize >> 1; | 161 | count = port->fifosize >> 1; |
| 163 | do { | 162 | do { |
| @@ -171,8 +170,11 @@ static irqreturn_t clps711xuart_int_tx(int irq, void *dev_id) | |||
| 171 | if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS) | 170 | if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS) |
| 172 | uart_write_wakeup(port); | 171 | uart_write_wakeup(port); |
| 173 | 172 | ||
| 174 | if (uart_circ_empty(xmit)) | 173 | if (uart_circ_empty(xmit)) { |
| 175 | clps711xuart_stop_tx(port); | 174 | disable_tx_irq: |
| 175 | disable_irq_nosync(TX_IRQ(port)); | ||
| 176 | tx_enabled(port) = 0; | ||
| 177 | } | ||
| 176 | 178 | ||
| 177 | return IRQ_HANDLED; | 179 | return IRQ_HANDLED; |
| 178 | } | 180 | } |
diff --git a/drivers/tty/serial/pch_uart.c b/drivers/tty/serial/pch_uart.c index bbbec4a74cfb..c2816f494807 100644 --- a/drivers/tty/serial/pch_uart.c +++ b/drivers/tty/serial/pch_uart.c | |||
| @@ -1447,9 +1447,11 @@ static int pch_uart_verify_port(struct uart_port *port, | |||
| 1447 | __func__); | 1447 | __func__); |
| 1448 | return -EOPNOTSUPP; | 1448 | return -EOPNOTSUPP; |
| 1449 | #endif | 1449 | #endif |
| 1450 | priv->use_dma = 1; | ||
| 1451 | priv->use_dma_flag = 1; | 1450 | priv->use_dma_flag = 1; |
| 1452 | dev_info(priv->port.dev, "PCH UART : Use DMA Mode\n"); | 1451 | dev_info(priv->port.dev, "PCH UART : Use DMA Mode\n"); |
| 1452 | if (!priv->use_dma) | ||
| 1453 | pch_request_dma(port); | ||
| 1454 | priv->use_dma = 1; | ||
| 1453 | } | 1455 | } |
| 1454 | 1456 | ||
| 1455 | return 0; | 1457 | return 0; |
diff --git a/drivers/tty/serial/pmac_zilog.c b/drivers/tty/serial/pmac_zilog.c index 08ebe901bb59..654755a990df 100644 --- a/drivers/tty/serial/pmac_zilog.c +++ b/drivers/tty/serial/pmac_zilog.c | |||
| @@ -469,7 +469,7 @@ static irqreturn_t pmz_interrupt(int irq, void *dev_id) | |||
| 469 | tty = NULL; | 469 | tty = NULL; |
| 470 | if (r3 & (CHAEXT | CHATxIP | CHARxIP)) { | 470 | if (r3 & (CHAEXT | CHATxIP | CHARxIP)) { |
| 471 | if (!ZS_IS_OPEN(uap_a)) { | 471 | if (!ZS_IS_OPEN(uap_a)) { |
| 472 | pmz_debug("ChanA interrupt while open !\n"); | 472 | pmz_debug("ChanA interrupt while not open !\n"); |
| 473 | goto skip_a; | 473 | goto skip_a; |
| 474 | } | 474 | } |
| 475 | write_zsreg(uap_a, R0, RES_H_IUS); | 475 | write_zsreg(uap_a, R0, RES_H_IUS); |
| @@ -493,8 +493,8 @@ static irqreturn_t pmz_interrupt(int irq, void *dev_id) | |||
| 493 | spin_lock(&uap_b->port.lock); | 493 | spin_lock(&uap_b->port.lock); |
| 494 | tty = NULL; | 494 | tty = NULL; |
| 495 | if (r3 & (CHBEXT | CHBTxIP | CHBRxIP)) { | 495 | if (r3 & (CHBEXT | CHBTxIP | CHBRxIP)) { |
| 496 | if (!ZS_IS_OPEN(uap_a)) { | 496 | if (!ZS_IS_OPEN(uap_b)) { |
| 497 | pmz_debug("ChanB interrupt while open !\n"); | 497 | pmz_debug("ChanB interrupt while not open !\n"); |
| 498 | goto skip_b; | 498 | goto skip_b; |
| 499 | } | 499 | } |
| 500 | write_zsreg(uap_b, R0, RES_H_IUS); | 500 | write_zsreg(uap_b, R0, RES_H_IUS); |
diff --git a/drivers/tty/vt/keyboard.c b/drivers/tty/vt/keyboard.c index 86dd1e302bb3..29ca20dbd335 100644 --- a/drivers/tty/vt/keyboard.c +++ b/drivers/tty/vt/keyboard.c | |||
| @@ -1085,15 +1085,21 @@ void vt_set_led_state(int console, int leds) | |||
| 1085 | * | 1085 | * |
| 1086 | * Handle console start. This is a wrapper for the VT layer | 1086 | * Handle console start. This is a wrapper for the VT layer |
| 1087 | * so that we can keep kbd knowledge internal | 1087 | * so that we can keep kbd knowledge internal |
| 1088 | * | ||
| 1089 | * FIXME: We eventually need to hold the kbd lock here to protect | ||
| 1090 | * the LED updating. We can't do it yet because fn_hold calls stop_tty | ||
| 1091 | * and start_tty under the kbd_event_lock, while normal tty paths | ||
| 1092 | * don't hold the lock. We probably need to split out an LED lock | ||
| 1093 | * but not during an -rc release! | ||
| 1088 | */ | 1094 | */ |
| 1089 | void vt_kbd_con_start(int console) | 1095 | void vt_kbd_con_start(int console) |
| 1090 | { | 1096 | { |
| 1091 | struct kbd_struct * kbd = kbd_table + console; | 1097 | struct kbd_struct * kbd = kbd_table + console; |
| 1092 | unsigned long flags; | 1098 | /* unsigned long flags; */ |
| 1093 | spin_lock_irqsave(&kbd_event_lock, flags); | 1099 | /* spin_lock_irqsave(&kbd_event_lock, flags); */ |
| 1094 | clr_vc_kbd_led(kbd, VC_SCROLLOCK); | 1100 | clr_vc_kbd_led(kbd, VC_SCROLLOCK); |
| 1095 | set_leds(); | 1101 | set_leds(); |
| 1096 | spin_unlock_irqrestore(&kbd_event_lock, flags); | 1102 | /* spin_unlock_irqrestore(&kbd_event_lock, flags); */ |
| 1097 | } | 1103 | } |
| 1098 | 1104 | ||
| 1099 | /** | 1105 | /** |
| @@ -1102,22 +1108,28 @@ void vt_kbd_con_start(int console) | |||
| 1102 | * | 1108 | * |
| 1103 | * Handle console stop. This is a wrapper for the VT layer | 1109 | * Handle console stop. This is a wrapper for the VT layer |
| 1104 | * so that we can keep kbd knowledge internal | 1110 | * so that we can keep kbd knowledge internal |
| 1111 | * | ||
| 1112 | * FIXME: We eventually need to hold the kbd lock here to protect | ||
| 1113 | * the LED updating. We can't do it yet because fn_hold calls stop_tty | ||
| 1114 | * and start_tty under the kbd_event_lock, while normal tty paths | ||
| 1115 | * don't hold the lock. We probably need to split out an LED lock | ||
| 1116 | * but not during an -rc release! | ||
| 1105 | */ | 1117 | */ |
| 1106 | void vt_kbd_con_stop(int console) | 1118 | void vt_kbd_con_stop(int console) |
| 1107 | { | 1119 | { |
| 1108 | struct kbd_struct * kbd = kbd_table + console; | 1120 | struct kbd_struct * kbd = kbd_table + console; |
| 1109 | unsigned long flags; | 1121 | /* unsigned long flags; */ |
| 1110 | spin_lock_irqsave(&kbd_event_lock, flags); | 1122 | /* spin_lock_irqsave(&kbd_event_lock, flags); */ |
| 1111 | set_vc_kbd_led(kbd, VC_SCROLLOCK); | 1123 | set_vc_kbd_led(kbd, VC_SCROLLOCK); |
| 1112 | set_leds(); | 1124 | set_leds(); |
| 1113 | spin_unlock_irqrestore(&kbd_event_lock, flags); | 1125 | /* spin_unlock_irqrestore(&kbd_event_lock, flags); */ |
| 1114 | } | 1126 | } |
| 1115 | 1127 | ||
| 1116 | /* | 1128 | /* |
| 1117 | * This is the tasklet that updates LED state on all keyboards | 1129 | * This is the tasklet that updates LED state on all keyboards |
| 1118 | * attached to the box. The reason we use tasklet is that we | 1130 | * attached to the box. The reason we use tasklet is that we |
| 1119 | * need to handle the scenario when keyboard handler is not | 1131 | * need to handle the scenario when keyboard handler is not |
| 1120 | * registered yet but we already getting updates form VT to | 1132 | * registered yet but we already getting updates from the VT to |
| 1121 | * update led state. | 1133 | * update led state. |
| 1122 | */ | 1134 | */ |
| 1123 | static void kbd_bh(unsigned long dummy) | 1135 | static void kbd_bh(unsigned long dummy) |
diff --git a/drivers/usb/class/cdc-wdm.c b/drivers/usb/class/cdc-wdm.c index c6f6560d436c..0bb2b3248dad 100644 --- a/drivers/usb/class/cdc-wdm.c +++ b/drivers/usb/class/cdc-wdm.c | |||
| @@ -157,8 +157,9 @@ static void wdm_out_callback(struct urb *urb) | |||
| 157 | spin_lock(&desc->iuspin); | 157 | spin_lock(&desc->iuspin); |
| 158 | desc->werr = urb->status; | 158 | desc->werr = urb->status; |
| 159 | spin_unlock(&desc->iuspin); | 159 | spin_unlock(&desc->iuspin); |
| 160 | clear_bit(WDM_IN_USE, &desc->flags); | ||
| 161 | kfree(desc->outbuf); | 160 | kfree(desc->outbuf); |
| 161 | desc->outbuf = NULL; | ||
| 162 | clear_bit(WDM_IN_USE, &desc->flags); | ||
| 162 | wake_up(&desc->wait); | 163 | wake_up(&desc->wait); |
| 163 | } | 164 | } |
| 164 | 165 | ||
| @@ -338,7 +339,7 @@ static ssize_t wdm_write | |||
| 338 | if (we < 0) | 339 | if (we < 0) |
| 339 | return -EIO; | 340 | return -EIO; |
| 340 | 341 | ||
| 341 | desc->outbuf = buf = kmalloc(count, GFP_KERNEL); | 342 | buf = kmalloc(count, GFP_KERNEL); |
| 342 | if (!buf) { | 343 | if (!buf) { |
| 343 | rv = -ENOMEM; | 344 | rv = -ENOMEM; |
| 344 | goto outnl; | 345 | goto outnl; |
| @@ -406,10 +407,12 @@ static ssize_t wdm_write | |||
| 406 | req->wIndex = desc->inum; | 407 | req->wIndex = desc->inum; |
| 407 | req->wLength = cpu_to_le16(count); | 408 | req->wLength = cpu_to_le16(count); |
| 408 | set_bit(WDM_IN_USE, &desc->flags); | 409 | set_bit(WDM_IN_USE, &desc->flags); |
| 410 | desc->outbuf = buf; | ||
| 409 | 411 | ||
| 410 | rv = usb_submit_urb(desc->command, GFP_KERNEL); | 412 | rv = usb_submit_urb(desc->command, GFP_KERNEL); |
| 411 | if (rv < 0) { | 413 | if (rv < 0) { |
| 412 | kfree(buf); | 414 | kfree(buf); |
| 415 | desc->outbuf = NULL; | ||
| 413 | clear_bit(WDM_IN_USE, &desc->flags); | 416 | clear_bit(WDM_IN_USE, &desc->flags); |
| 414 | dev_err(&desc->intf->dev, "Tx URB error: %d\n", rv); | 417 | dev_err(&desc->intf->dev, "Tx URB error: %d\n", rv); |
| 415 | } else { | 418 | } else { |
diff --git a/drivers/usb/core/hcd-pci.c b/drivers/usb/core/hcd-pci.c index 622b4a48e732..57ed9e400c06 100644 --- a/drivers/usb/core/hcd-pci.c +++ b/drivers/usb/core/hcd-pci.c | |||
| @@ -493,6 +493,15 @@ static int hcd_pci_suspend_noirq(struct device *dev) | |||
| 493 | 493 | ||
| 494 | pci_save_state(pci_dev); | 494 | pci_save_state(pci_dev); |
| 495 | 495 | ||
| 496 | /* | ||
| 497 | * Some systems crash if an EHCI controller is in D3 during | ||
| 498 | * a sleep transition. We have to leave such controllers in D0. | ||
| 499 | */ | ||
| 500 | if (hcd->broken_pci_sleep) { | ||
| 501 | dev_dbg(dev, "Staying in PCI D0\n"); | ||
| 502 | return retval; | ||
| 503 | } | ||
| 504 | |||
| 496 | /* If the root hub is dead rather than suspended, disallow remote | 505 | /* If the root hub is dead rather than suspended, disallow remote |
| 497 | * wakeup. usb_hc_died() should ensure that both hosts are marked as | 506 | * wakeup. usb_hc_died() should ensure that both hosts are marked as |
| 498 | * dying, so we only need to check the primary roothub. | 507 | * dying, so we only need to check the primary roothub. |
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index a2aa9d652c67..ec6c97dadbe4 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c | |||
| @@ -1667,7 +1667,6 @@ void usb_disconnect(struct usb_device **pdev) | |||
| 1667 | { | 1667 | { |
| 1668 | struct usb_device *udev = *pdev; | 1668 | struct usb_device *udev = *pdev; |
| 1669 | int i; | 1669 | int i; |
| 1670 | struct usb_hcd *hcd = bus_to_hcd(udev->bus); | ||
| 1671 | 1670 | ||
| 1672 | /* mark the device as inactive, so any further urb submissions for | 1671 | /* mark the device as inactive, so any further urb submissions for |
| 1673 | * this device (and any of its children) will fail immediately. | 1672 | * this device (and any of its children) will fail immediately. |
| @@ -1690,9 +1689,7 @@ void usb_disconnect(struct usb_device **pdev) | |||
| 1690 | * so that the hardware is now fully quiesced. | 1689 | * so that the hardware is now fully quiesced. |
| 1691 | */ | 1690 | */ |
| 1692 | dev_dbg (&udev->dev, "unregistering device\n"); | 1691 | dev_dbg (&udev->dev, "unregistering device\n"); |
| 1693 | mutex_lock(hcd->bandwidth_mutex); | ||
| 1694 | usb_disable_device(udev, 0); | 1692 | usb_disable_device(udev, 0); |
| 1695 | mutex_unlock(hcd->bandwidth_mutex); | ||
| 1696 | usb_hcd_synchronize_unlinks(udev); | 1693 | usb_hcd_synchronize_unlinks(udev); |
| 1697 | 1694 | ||
| 1698 | usb_remove_ep_devs(&udev->ep0); | 1695 | usb_remove_ep_devs(&udev->ep0); |
diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c index aed3e07942d4..ca717da3be95 100644 --- a/drivers/usb/core/message.c +++ b/drivers/usb/core/message.c | |||
| @@ -1136,8 +1136,6 @@ void usb_disable_interface(struct usb_device *dev, struct usb_interface *intf, | |||
| 1136 | * Deallocates hcd/hardware state for the endpoints (nuking all or most | 1136 | * Deallocates hcd/hardware state for the endpoints (nuking all or most |
| 1137 | * pending urbs) and usbcore state for the interfaces, so that usbcore | 1137 | * pending urbs) and usbcore state for the interfaces, so that usbcore |
| 1138 | * must usb_set_configuration() before any interfaces could be used. | 1138 | * must usb_set_configuration() before any interfaces could be used. |
| 1139 | * | ||
| 1140 | * Must be called with hcd->bandwidth_mutex held. | ||
| 1141 | */ | 1139 | */ |
| 1142 | void usb_disable_device(struct usb_device *dev, int skip_ep0) | 1140 | void usb_disable_device(struct usb_device *dev, int skip_ep0) |
| 1143 | { | 1141 | { |
| @@ -1190,7 +1188,9 @@ void usb_disable_device(struct usb_device *dev, int skip_ep0) | |||
| 1190 | usb_disable_endpoint(dev, i + USB_DIR_IN, false); | 1188 | usb_disable_endpoint(dev, i + USB_DIR_IN, false); |
| 1191 | } | 1189 | } |
| 1192 | /* Remove endpoints from the host controller internal state */ | 1190 | /* Remove endpoints from the host controller internal state */ |
| 1191 | mutex_lock(hcd->bandwidth_mutex); | ||
| 1193 | usb_hcd_alloc_bandwidth(dev, NULL, NULL, NULL); | 1192 | usb_hcd_alloc_bandwidth(dev, NULL, NULL, NULL); |
| 1193 | mutex_unlock(hcd->bandwidth_mutex); | ||
| 1194 | /* Second pass: remove endpoint pointers */ | 1194 | /* Second pass: remove endpoint pointers */ |
| 1195 | } | 1195 | } |
| 1196 | for (i = skip_ep0; i < 16; ++i) { | 1196 | for (i = skip_ep0; i < 16; ++i) { |
| @@ -1750,7 +1750,6 @@ free_interfaces: | |||
| 1750 | /* if it's already configured, clear out old state first. | 1750 | /* if it's already configured, clear out old state first. |
| 1751 | * getting rid of old interfaces means unbinding their drivers. | 1751 | * getting rid of old interfaces means unbinding their drivers. |
| 1752 | */ | 1752 | */ |
| 1753 | mutex_lock(hcd->bandwidth_mutex); | ||
| 1754 | if (dev->state != USB_STATE_ADDRESS) | 1753 | if (dev->state != USB_STATE_ADDRESS) |
| 1755 | usb_disable_device(dev, 1); /* Skip ep0 */ | 1754 | usb_disable_device(dev, 1); /* Skip ep0 */ |
| 1756 | 1755 | ||
| @@ -1763,6 +1762,7 @@ free_interfaces: | |||
| 1763 | * host controller will not allow submissions to dropped endpoints. If | 1762 | * host controller will not allow submissions to dropped endpoints. If |
| 1764 | * this call fails, the device state is unchanged. | 1763 | * this call fails, the device state is unchanged. |
| 1765 | */ | 1764 | */ |
| 1765 | mutex_lock(hcd->bandwidth_mutex); | ||
| 1766 | ret = usb_hcd_alloc_bandwidth(dev, cp, NULL, NULL); | 1766 | ret = usb_hcd_alloc_bandwidth(dev, cp, NULL, NULL); |
| 1767 | if (ret < 0) { | 1767 | if (ret < 0) { |
| 1768 | mutex_unlock(hcd->bandwidth_mutex); | 1768 | mutex_unlock(hcd->bandwidth_mutex); |
diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index 7bd815a507e8..99b58d84553a 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c | |||
| @@ -206,11 +206,11 @@ static void dwc3_free_event_buffers(struct dwc3 *dwc) | |||
| 206 | 206 | ||
| 207 | for (i = 0; i < dwc->num_event_buffers; i++) { | 207 | for (i = 0; i < dwc->num_event_buffers; i++) { |
| 208 | evt = dwc->ev_buffs[i]; | 208 | evt = dwc->ev_buffs[i]; |
| 209 | if (evt) { | 209 | if (evt) |
| 210 | dwc3_free_one_event_buffer(dwc, evt); | 210 | dwc3_free_one_event_buffer(dwc, evt); |
| 211 | dwc->ev_buffs[i] = NULL; | ||
| 212 | } | ||
| 213 | } | 211 | } |
| 212 | |||
| 213 | kfree(dwc->ev_buffs); | ||
| 214 | } | 214 | } |
| 215 | 215 | ||
| 216 | /** | 216 | /** |
diff --git a/drivers/usb/dwc3/ep0.c b/drivers/usb/dwc3/ep0.c index 25910e251c04..3584a169886f 100644 --- a/drivers/usb/dwc3/ep0.c +++ b/drivers/usb/dwc3/ep0.c | |||
| @@ -353,6 +353,9 @@ static int dwc3_ep0_handle_feature(struct dwc3 *dwc, | |||
| 353 | 353 | ||
| 354 | dwc->test_mode_nr = wIndex >> 8; | 354 | dwc->test_mode_nr = wIndex >> 8; |
| 355 | dwc->test_mode = true; | 355 | dwc->test_mode = true; |
| 356 | break; | ||
| 357 | default: | ||
| 358 | return -EINVAL; | ||
| 356 | } | 359 | } |
| 357 | break; | 360 | break; |
| 358 | 361 | ||
| @@ -559,15 +562,20 @@ static void dwc3_ep0_complete_data(struct dwc3 *dwc, | |||
| 559 | length = trb->size & DWC3_TRB_SIZE_MASK; | 562 | length = trb->size & DWC3_TRB_SIZE_MASK; |
| 560 | 563 | ||
| 561 | if (dwc->ep0_bounced) { | 564 | if (dwc->ep0_bounced) { |
| 565 | unsigned transfer_size = ur->length; | ||
| 566 | unsigned maxp = ep0->endpoint.maxpacket; | ||
| 567 | |||
| 568 | transfer_size += (maxp - (transfer_size % maxp)); | ||
| 562 | transferred = min_t(u32, ur->length, | 569 | transferred = min_t(u32, ur->length, |
| 563 | ep0->endpoint.maxpacket - length); | 570 | transfer_size - length); |
| 564 | memcpy(ur->buf, dwc->ep0_bounce, transferred); | 571 | memcpy(ur->buf, dwc->ep0_bounce, transferred); |
| 565 | dwc->ep0_bounced = false; | 572 | dwc->ep0_bounced = false; |
| 566 | } else { | 573 | } else { |
| 567 | transferred = ur->length - length; | 574 | transferred = ur->length - length; |
| 568 | ur->actual += transferred; | ||
| 569 | } | 575 | } |
| 570 | 576 | ||
| 577 | ur->actual += transferred; | ||
| 578 | |||
| 571 | if ((epnum & 1) && ur->actual < ur->length) { | 579 | if ((epnum & 1) && ur->actual < ur->length) { |
| 572 | /* for some reason we did not get everything out */ | 580 | /* for some reason we did not get everything out */ |
| 573 | 581 | ||
diff --git a/drivers/usb/gadget/at91_udc.c b/drivers/usb/gadget/at91_udc.c index 0c935d7c65bd..9d7bcd910074 100644 --- a/drivers/usb/gadget/at91_udc.c +++ b/drivers/usb/gadget/at91_udc.c | |||
| @@ -1863,8 +1863,8 @@ static int __devinit at91udc_probe(struct platform_device *pdev) | |||
| 1863 | mod_timer(&udc->vbus_timer, | 1863 | mod_timer(&udc->vbus_timer, |
| 1864 | jiffies + VBUS_POLL_TIMEOUT); | 1864 | jiffies + VBUS_POLL_TIMEOUT); |
| 1865 | } else { | 1865 | } else { |
| 1866 | if (request_irq(udc->board.vbus_pin, at91_vbus_irq, | 1866 | if (request_irq(gpio_to_irq(udc->board.vbus_pin), |
| 1867 | 0, driver_name, udc)) { | 1867 | at91_vbus_irq, 0, driver_name, udc)) { |
| 1868 | DBG("request vbus irq %d failed\n", | 1868 | DBG("request vbus irq %d failed\n", |
| 1869 | udc->board.vbus_pin); | 1869 | udc->board.vbus_pin); |
| 1870 | retval = -EBUSY; | 1870 | retval = -EBUSY; |
| @@ -1886,7 +1886,7 @@ static int __devinit at91udc_probe(struct platform_device *pdev) | |||
| 1886 | return 0; | 1886 | return 0; |
| 1887 | fail4: | 1887 | fail4: |
| 1888 | if (gpio_is_valid(udc->board.vbus_pin) && !udc->board.vbus_polled) | 1888 | if (gpio_is_valid(udc->board.vbus_pin) && !udc->board.vbus_polled) |
| 1889 | free_irq(udc->board.vbus_pin, udc); | 1889 | free_irq(gpio_to_irq(udc->board.vbus_pin), udc); |
| 1890 | fail3: | 1890 | fail3: |
| 1891 | if (gpio_is_valid(udc->board.vbus_pin)) | 1891 | if (gpio_is_valid(udc->board.vbus_pin)) |
| 1892 | gpio_free(udc->board.vbus_pin); | 1892 | gpio_free(udc->board.vbus_pin); |
| @@ -1924,7 +1924,7 @@ static int __exit at91udc_remove(struct platform_device *pdev) | |||
| 1924 | device_init_wakeup(&pdev->dev, 0); | 1924 | device_init_wakeup(&pdev->dev, 0); |
| 1925 | remove_debug_file(udc); | 1925 | remove_debug_file(udc); |
| 1926 | if (gpio_is_valid(udc->board.vbus_pin)) { | 1926 | if (gpio_is_valid(udc->board.vbus_pin)) { |
| 1927 | free_irq(udc->board.vbus_pin, udc); | 1927 | free_irq(gpio_to_irq(udc->board.vbus_pin), udc); |
| 1928 | gpio_free(udc->board.vbus_pin); | 1928 | gpio_free(udc->board.vbus_pin); |
| 1929 | } | 1929 | } |
| 1930 | free_irq(udc->udp_irq, udc); | 1930 | free_irq(udc->udp_irq, udc); |
diff --git a/drivers/usb/gadget/dummy_hcd.c b/drivers/usb/gadget/dummy_hcd.c index a6dfd2164166..170cbe89d9f8 100644 --- a/drivers/usb/gadget/dummy_hcd.c +++ b/drivers/usb/gadget/dummy_hcd.c | |||
| @@ -927,7 +927,6 @@ static int dummy_udc_stop(struct usb_gadget *g, | |||
| 927 | 927 | ||
| 928 | dum->driver = NULL; | 928 | dum->driver = NULL; |
| 929 | 929 | ||
| 930 | dummy_pullup(&dum->gadget, 0); | ||
| 931 | return 0; | 930 | return 0; |
| 932 | } | 931 | } |
| 933 | 932 | ||
diff --git a/drivers/usb/gadget/f_fs.c b/drivers/usb/gadget/f_fs.c index 1cbba70836bc..f52cb1ae45d9 100644 --- a/drivers/usb/gadget/f_fs.c +++ b/drivers/usb/gadget/f_fs.c | |||
| @@ -712,7 +712,7 @@ static long ffs_ep0_ioctl(struct file *file, unsigned code, unsigned long value) | |||
| 712 | if (code == FUNCTIONFS_INTERFACE_REVMAP) { | 712 | if (code == FUNCTIONFS_INTERFACE_REVMAP) { |
| 713 | struct ffs_function *func = ffs->func; | 713 | struct ffs_function *func = ffs->func; |
| 714 | ret = func ? ffs_func_revmap_intf(func, value) : -ENODEV; | 714 | ret = func ? ffs_func_revmap_intf(func, value) : -ENODEV; |
| 715 | } else if (gadget->ops->ioctl) { | 715 | } else if (gadget && gadget->ops->ioctl) { |
| 716 | ret = gadget->ops->ioctl(gadget, code, value); | 716 | ret = gadget->ops->ioctl(gadget, code, value); |
| 717 | } else { | 717 | } else { |
| 718 | ret = -ENOTTY; | 718 | ret = -ENOTTY; |
| @@ -1382,6 +1382,7 @@ static void functionfs_unbind(struct ffs_data *ffs) | |||
| 1382 | ffs->ep0req = NULL; | 1382 | ffs->ep0req = NULL; |
| 1383 | ffs->gadget = NULL; | 1383 | ffs->gadget = NULL; |
| 1384 | ffs_data_put(ffs); | 1384 | ffs_data_put(ffs); |
| 1385 | clear_bit(FFS_FL_BOUND, &ffs->flags); | ||
| 1385 | } | 1386 | } |
| 1386 | } | 1387 | } |
| 1387 | 1388 | ||
diff --git a/drivers/usb/gadget/f_mass_storage.c b/drivers/usb/gadget/f_mass_storage.c index a371e966425f..cb8c162cae5a 100644 --- a/drivers/usb/gadget/f_mass_storage.c +++ b/drivers/usb/gadget/f_mass_storage.c | |||
| @@ -2189,7 +2189,7 @@ unknown_cmnd: | |||
| 2189 | common->data_size_from_cmnd = 0; | 2189 | common->data_size_from_cmnd = 0; |
| 2190 | sprintf(unknown, "Unknown x%02x", common->cmnd[0]); | 2190 | sprintf(unknown, "Unknown x%02x", common->cmnd[0]); |
| 2191 | reply = check_command(common, common->cmnd_size, | 2191 | reply = check_command(common, common->cmnd_size, |
| 2192 | DATA_DIR_UNKNOWN, 0xff, 0, unknown); | 2192 | DATA_DIR_UNKNOWN, ~0, 0, unknown); |
| 2193 | if (reply == 0) { | 2193 | if (reply == 0) { |
| 2194 | common->curlun->sense_data = SS_INVALID_COMMAND; | 2194 | common->curlun->sense_data = SS_INVALID_COMMAND; |
| 2195 | reply = -EINVAL; | 2195 | reply = -EINVAL; |
diff --git a/drivers/usb/gadget/f_rndis.c b/drivers/usb/gadget/f_rndis.c index 7b1cf18df5e3..52343654f5df 100644 --- a/drivers/usb/gadget/f_rndis.c +++ b/drivers/usb/gadget/f_rndis.c | |||
| @@ -500,6 +500,7 @@ rndis_setup(struct usb_function *f, const struct usb_ctrlrequest *ctrl) | |||
| 500 | if (buf) { | 500 | if (buf) { |
| 501 | memcpy(req->buf, buf, n); | 501 | memcpy(req->buf, buf, n); |
| 502 | req->complete = rndis_response_complete; | 502 | req->complete = rndis_response_complete; |
| 503 | req->context = rndis; | ||
| 503 | rndis_free_response(rndis->config, buf); | 504 | rndis_free_response(rndis->config, buf); |
| 504 | value = n; | 505 | value = n; |
| 505 | } | 506 | } |
diff --git a/drivers/usb/gadget/file_storage.c b/drivers/usb/gadget/file_storage.c index 4fac56927741..a896d73f7a93 100644 --- a/drivers/usb/gadget/file_storage.c +++ b/drivers/usb/gadget/file_storage.c | |||
| @@ -2579,7 +2579,7 @@ static int do_scsi_command(struct fsg_dev *fsg) | |||
| 2579 | fsg->data_size_from_cmnd = 0; | 2579 | fsg->data_size_from_cmnd = 0; |
| 2580 | sprintf(unknown, "Unknown x%02x", fsg->cmnd[0]); | 2580 | sprintf(unknown, "Unknown x%02x", fsg->cmnd[0]); |
| 2581 | if ((reply = check_command(fsg, fsg->cmnd_size, | 2581 | if ((reply = check_command(fsg, fsg->cmnd_size, |
| 2582 | DATA_DIR_UNKNOWN, 0xff, 0, unknown)) == 0) { | 2582 | DATA_DIR_UNKNOWN, ~0, 0, unknown)) == 0) { |
| 2583 | fsg->curlun->sense_data = SS_INVALID_COMMAND; | 2583 | fsg->curlun->sense_data = SS_INVALID_COMMAND; |
| 2584 | reply = -EINVAL; | 2584 | reply = -EINVAL; |
| 2585 | } | 2585 | } |
diff --git a/drivers/usb/gadget/fsl_udc_core.c b/drivers/usb/gadget/fsl_udc_core.c index 5f94e79cd6b9..55abfb6bd612 100644 --- a/drivers/usb/gadget/fsl_udc_core.c +++ b/drivers/usb/gadget/fsl_udc_core.c | |||
| @@ -730,7 +730,7 @@ static void fsl_queue_td(struct fsl_ep *ep, struct fsl_req *req) | |||
| 730 | : (1 << (ep_index(ep))); | 730 | : (1 << (ep_index(ep))); |
| 731 | 731 | ||
| 732 | /* check if the pipe is empty */ | 732 | /* check if the pipe is empty */ |
| 733 | if (!(list_empty(&ep->queue))) { | 733 | if (!(list_empty(&ep->queue)) && !(ep_index(ep) == 0)) { |
| 734 | /* Add td to the end */ | 734 | /* Add td to the end */ |
| 735 | struct fsl_req *lastreq; | 735 | struct fsl_req *lastreq; |
| 736 | lastreq = list_entry(ep->queue.prev, struct fsl_req, queue); | 736 | lastreq = list_entry(ep->queue.prev, struct fsl_req, queue); |
| @@ -918,10 +918,6 @@ fsl_ep_queue(struct usb_ep *_ep, struct usb_request *_req, gfp_t gfp_flags) | |||
| 918 | return -ENOMEM; | 918 | return -ENOMEM; |
| 919 | } | 919 | } |
| 920 | 920 | ||
| 921 | /* Update ep0 state */ | ||
| 922 | if ((ep_index(ep) == 0)) | ||
| 923 | udc->ep0_state = DATA_STATE_XMIT; | ||
| 924 | |||
| 925 | /* irq handler advances the queue */ | 921 | /* irq handler advances the queue */ |
| 926 | if (req != NULL) | 922 | if (req != NULL) |
| 927 | list_add_tail(&req->queue, &ep->queue); | 923 | list_add_tail(&req->queue, &ep->queue); |
| @@ -1279,7 +1275,8 @@ static int ep0_prime_status(struct fsl_udc *udc, int direction) | |||
| 1279 | udc->ep0_dir = USB_DIR_OUT; | 1275 | udc->ep0_dir = USB_DIR_OUT; |
| 1280 | 1276 | ||
| 1281 | ep = &udc->eps[0]; | 1277 | ep = &udc->eps[0]; |
| 1282 | udc->ep0_state = WAIT_FOR_OUT_STATUS; | 1278 | if (udc->ep0_state != DATA_STATE_XMIT) |
| 1279 | udc->ep0_state = WAIT_FOR_OUT_STATUS; | ||
| 1283 | 1280 | ||
| 1284 | req->ep = ep; | 1281 | req->ep = ep; |
| 1285 | req->req.length = 0; | 1282 | req->req.length = 0; |
| @@ -1384,6 +1381,9 @@ static void ch9getstatus(struct fsl_udc *udc, u8 request_type, u16 value, | |||
| 1384 | 1381 | ||
| 1385 | list_add_tail(&req->queue, &ep->queue); | 1382 | list_add_tail(&req->queue, &ep->queue); |
| 1386 | udc->ep0_state = DATA_STATE_XMIT; | 1383 | udc->ep0_state = DATA_STATE_XMIT; |
| 1384 | if (ep0_prime_status(udc, EP_DIR_OUT)) | ||
| 1385 | ep0stall(udc); | ||
| 1386 | |||
| 1387 | return; | 1387 | return; |
| 1388 | stall: | 1388 | stall: |
| 1389 | ep0stall(udc); | 1389 | ep0stall(udc); |
| @@ -1492,6 +1492,14 @@ static void setup_received_irq(struct fsl_udc *udc, | |||
| 1492 | spin_lock(&udc->lock); | 1492 | spin_lock(&udc->lock); |
| 1493 | udc->ep0_state = (setup->bRequestType & USB_DIR_IN) | 1493 | udc->ep0_state = (setup->bRequestType & USB_DIR_IN) |
| 1494 | ? DATA_STATE_XMIT : DATA_STATE_RECV; | 1494 | ? DATA_STATE_XMIT : DATA_STATE_RECV; |
| 1495 | /* | ||
| 1496 | * If the data stage is IN, send status prime immediately. | ||
| 1497 | * See 2.0 Spec chapter 8.5.3.3 for detail. | ||
| 1498 | */ | ||
| 1499 | if (udc->ep0_state == DATA_STATE_XMIT) | ||
| 1500 | if (ep0_prime_status(udc, EP_DIR_OUT)) | ||
| 1501 | ep0stall(udc); | ||
| 1502 | |||
| 1495 | } else { | 1503 | } else { |
| 1496 | /* No data phase, IN status from gadget */ | 1504 | /* No data phase, IN status from gadget */ |
| 1497 | udc->ep0_dir = USB_DIR_IN; | 1505 | udc->ep0_dir = USB_DIR_IN; |
| @@ -1520,9 +1528,8 @@ static void ep0_req_complete(struct fsl_udc *udc, struct fsl_ep *ep0, | |||
| 1520 | 1528 | ||
| 1521 | switch (udc->ep0_state) { | 1529 | switch (udc->ep0_state) { |
| 1522 | case DATA_STATE_XMIT: | 1530 | case DATA_STATE_XMIT: |
| 1523 | /* receive status phase */ | 1531 | /* already primed at setup_received_irq */ |
| 1524 | if (ep0_prime_status(udc, EP_DIR_OUT)) | 1532 | udc->ep0_state = WAIT_FOR_OUT_STATUS; |
| 1525 | ep0stall(udc); | ||
| 1526 | break; | 1533 | break; |
| 1527 | case DATA_STATE_RECV: | 1534 | case DATA_STATE_RECV: |
| 1528 | /* send status phase */ | 1535 | /* send status phase */ |
diff --git a/drivers/usb/gadget/g_ffs.c b/drivers/usb/gadget/g_ffs.c index 331cd6729d3c..a85eaf40b948 100644 --- a/drivers/usb/gadget/g_ffs.c +++ b/drivers/usb/gadget/g_ffs.c | |||
| @@ -161,7 +161,7 @@ static struct usb_composite_driver gfs_driver = { | |||
| 161 | static struct ffs_data *gfs_ffs_data; | 161 | static struct ffs_data *gfs_ffs_data; |
| 162 | static unsigned long gfs_registered; | 162 | static unsigned long gfs_registered; |
| 163 | 163 | ||
| 164 | static int gfs_init(void) | 164 | static int __init gfs_init(void) |
| 165 | { | 165 | { |
| 166 | ENTER(); | 166 | ENTER(); |
| 167 | 167 | ||
| @@ -169,7 +169,7 @@ static int gfs_init(void) | |||
| 169 | } | 169 | } |
| 170 | module_init(gfs_init); | 170 | module_init(gfs_init); |
| 171 | 171 | ||
| 172 | static void gfs_exit(void) | 172 | static void __exit gfs_exit(void) |
| 173 | { | 173 | { |
| 174 | ENTER(); | 174 | ENTER(); |
| 175 | 175 | ||
diff --git a/drivers/usb/gadget/s3c-hsotg.c b/drivers/usb/gadget/s3c-hsotg.c index 69295ba9d99a..105b206cd844 100644 --- a/drivers/usb/gadget/s3c-hsotg.c +++ b/drivers/usb/gadget/s3c-hsotg.c | |||
| @@ -340,7 +340,7 @@ static void s3c_hsotg_init_fifo(struct s3c_hsotg *hsotg) | |||
| 340 | /* currently we allocate TX FIFOs for all possible endpoints, | 340 | /* currently we allocate TX FIFOs for all possible endpoints, |
| 341 | * and assume that they are all the same size. */ | 341 | * and assume that they are all the same size. */ |
| 342 | 342 | ||
| 343 | for (ep = 0; ep <= 15; ep++) { | 343 | for (ep = 1; ep <= 15; ep++) { |
| 344 | val = addr; | 344 | val = addr; |
| 345 | val |= size << S3C_DPTXFSIZn_DPTxFSize_SHIFT; | 345 | val |= size << S3C_DPTXFSIZn_DPTxFSize_SHIFT; |
| 346 | addr += size; | 346 | addr += size; |
| @@ -741,7 +741,7 @@ static void s3c_hsotg_start_req(struct s3c_hsotg *hsotg, | |||
| 741 | /* write size / packets */ | 741 | /* write size / packets */ |
| 742 | writel(epsize, hsotg->regs + epsize_reg); | 742 | writel(epsize, hsotg->regs + epsize_reg); |
| 743 | 743 | ||
| 744 | if (using_dma(hsotg)) { | 744 | if (using_dma(hsotg) && !continuing) { |
| 745 | unsigned int dma_reg; | 745 | unsigned int dma_reg; |
| 746 | 746 | ||
| 747 | /* write DMA address to control register, buffer already | 747 | /* write DMA address to control register, buffer already |
| @@ -1696,10 +1696,12 @@ static void s3c_hsotg_set_ep_maxpacket(struct s3c_hsotg *hsotg, | |||
| 1696 | reg |= mpsval; | 1696 | reg |= mpsval; |
| 1697 | writel(reg, regs + S3C_DIEPCTL(ep)); | 1697 | writel(reg, regs + S3C_DIEPCTL(ep)); |
| 1698 | 1698 | ||
| 1699 | reg = readl(regs + S3C_DOEPCTL(ep)); | 1699 | if (ep) { |
| 1700 | reg &= ~S3C_DxEPCTL_MPS_MASK; | 1700 | reg = readl(regs + S3C_DOEPCTL(ep)); |
| 1701 | reg |= mpsval; | 1701 | reg &= ~S3C_DxEPCTL_MPS_MASK; |
| 1702 | writel(reg, regs + S3C_DOEPCTL(ep)); | 1702 | reg |= mpsval; |
| 1703 | writel(reg, regs + S3C_DOEPCTL(ep)); | ||
| 1704 | } | ||
| 1703 | 1705 | ||
| 1704 | return; | 1706 | return; |
| 1705 | 1707 | ||
| @@ -1919,7 +1921,8 @@ static void s3c_hsotg_epint(struct s3c_hsotg *hsotg, unsigned int idx, | |||
| 1919 | ints & S3C_DIEPMSK_TxFIFOEmpty) { | 1921 | ints & S3C_DIEPMSK_TxFIFOEmpty) { |
| 1920 | dev_dbg(hsotg->dev, "%s: ep%d: TxFIFOEmpty\n", | 1922 | dev_dbg(hsotg->dev, "%s: ep%d: TxFIFOEmpty\n", |
| 1921 | __func__, idx); | 1923 | __func__, idx); |
| 1922 | s3c_hsotg_trytx(hsotg, hs_ep); | 1924 | if (!using_dma(hsotg)) |
| 1925 | s3c_hsotg_trytx(hsotg, hs_ep); | ||
| 1923 | } | 1926 | } |
| 1924 | } | 1927 | } |
| 1925 | } | 1928 | } |
diff --git a/drivers/usb/gadget/udc-core.c b/drivers/usb/gadget/udc-core.c index 56da49f31d6c..e5e44f8cde9a 100644 --- a/drivers/usb/gadget/udc-core.c +++ b/drivers/usb/gadget/udc-core.c | |||
| @@ -263,9 +263,9 @@ static void usb_gadget_remove_driver(struct usb_udc *udc) | |||
| 263 | 263 | ||
| 264 | if (udc_is_newstyle(udc)) { | 264 | if (udc_is_newstyle(udc)) { |
| 265 | udc->driver->disconnect(udc->gadget); | 265 | udc->driver->disconnect(udc->gadget); |
| 266 | usb_gadget_disconnect(udc->gadget); | ||
| 266 | udc->driver->unbind(udc->gadget); | 267 | udc->driver->unbind(udc->gadget); |
| 267 | usb_gadget_udc_stop(udc->gadget, udc->driver); | 268 | usb_gadget_udc_stop(udc->gadget, udc->driver); |
| 268 | usb_gadget_disconnect(udc->gadget); | ||
| 269 | } else { | 269 | } else { |
| 270 | usb_gadget_stop(udc->gadget, udc->driver); | 270 | usb_gadget_stop(udc->gadget, udc->driver); |
| 271 | } | 271 | } |
| @@ -411,9 +411,13 @@ static ssize_t usb_udc_softconn_store(struct device *dev, | |||
| 411 | struct usb_udc *udc = container_of(dev, struct usb_udc, dev); | 411 | struct usb_udc *udc = container_of(dev, struct usb_udc, dev); |
| 412 | 412 | ||
| 413 | if (sysfs_streq(buf, "connect")) { | 413 | if (sysfs_streq(buf, "connect")) { |
| 414 | if (udc_is_newstyle(udc)) | ||
| 415 | usb_gadget_udc_start(udc->gadget, udc->driver); | ||
| 414 | usb_gadget_connect(udc->gadget); | 416 | usb_gadget_connect(udc->gadget); |
| 415 | } else if (sysfs_streq(buf, "disconnect")) { | 417 | } else if (sysfs_streq(buf, "disconnect")) { |
| 416 | usb_gadget_disconnect(udc->gadget); | 418 | usb_gadget_disconnect(udc->gadget); |
| 419 | if (udc_is_newstyle(udc)) | ||
| 420 | usb_gadget_udc_stop(udc->gadget, udc->driver); | ||
| 417 | } else { | 421 | } else { |
| 418 | dev_err(dev, "unsupported command '%s'\n", buf); | 422 | dev_err(dev, "unsupported command '%s'\n", buf); |
| 419 | return -EINVAL; | 423 | return -EINVAL; |
diff --git a/drivers/usb/gadget/uvc.h b/drivers/usb/gadget/uvc.h index bc78c606c12b..ca4e03a1c73a 100644 --- a/drivers/usb/gadget/uvc.h +++ b/drivers/usb/gadget/uvc.h | |||
| @@ -28,7 +28,7 @@ | |||
| 28 | 28 | ||
| 29 | struct uvc_request_data | 29 | struct uvc_request_data |
| 30 | { | 30 | { |
| 31 | unsigned int length; | 31 | __s32 length; |
| 32 | __u8 data[60]; | 32 | __u8 data[60]; |
| 33 | }; | 33 | }; |
| 34 | 34 | ||
diff --git a/drivers/usb/gadget/uvc_queue.c b/drivers/usb/gadget/uvc_queue.c index d776adb2da67..0cdf89d32a15 100644 --- a/drivers/usb/gadget/uvc_queue.c +++ b/drivers/usb/gadget/uvc_queue.c | |||
| @@ -543,11 +543,11 @@ done: | |||
| 543 | return ret; | 543 | return ret; |
| 544 | } | 544 | } |
| 545 | 545 | ||
| 546 | /* called with queue->irqlock held.. */ | ||
| 546 | static struct uvc_buffer * | 547 | static struct uvc_buffer * |
| 547 | uvc_queue_next_buffer(struct uvc_video_queue *queue, struct uvc_buffer *buf) | 548 | uvc_queue_next_buffer(struct uvc_video_queue *queue, struct uvc_buffer *buf) |
| 548 | { | 549 | { |
| 549 | struct uvc_buffer *nextbuf; | 550 | struct uvc_buffer *nextbuf; |
| 550 | unsigned long flags; | ||
| 551 | 551 | ||
| 552 | if ((queue->flags & UVC_QUEUE_DROP_INCOMPLETE) && | 552 | if ((queue->flags & UVC_QUEUE_DROP_INCOMPLETE) && |
| 553 | buf->buf.length != buf->buf.bytesused) { | 553 | buf->buf.length != buf->buf.bytesused) { |
| @@ -556,14 +556,12 @@ uvc_queue_next_buffer(struct uvc_video_queue *queue, struct uvc_buffer *buf) | |||
| 556 | return buf; | 556 | return buf; |
| 557 | } | 557 | } |
| 558 | 558 | ||
| 559 | spin_lock_irqsave(&queue->irqlock, flags); | ||
| 560 | list_del(&buf->queue); | 559 | list_del(&buf->queue); |
| 561 | if (!list_empty(&queue->irqqueue)) | 560 | if (!list_empty(&queue->irqqueue)) |
| 562 | nextbuf = list_first_entry(&queue->irqqueue, struct uvc_buffer, | 561 | nextbuf = list_first_entry(&queue->irqqueue, struct uvc_buffer, |
| 563 | queue); | 562 | queue); |
| 564 | else | 563 | else |
| 565 | nextbuf = NULL; | 564 | nextbuf = NULL; |
| 566 | spin_unlock_irqrestore(&queue->irqlock, flags); | ||
| 567 | 565 | ||
| 568 | buf->buf.sequence = queue->sequence++; | 566 | buf->buf.sequence = queue->sequence++; |
| 569 | do_gettimeofday(&buf->buf.timestamp); | 567 | do_gettimeofday(&buf->buf.timestamp); |
diff --git a/drivers/usb/gadget/uvc_v4l2.c b/drivers/usb/gadget/uvc_v4l2.c index f6e083b50191..54d7ca559cb2 100644 --- a/drivers/usb/gadget/uvc_v4l2.c +++ b/drivers/usb/gadget/uvc_v4l2.c | |||
| @@ -39,7 +39,7 @@ uvc_send_response(struct uvc_device *uvc, struct uvc_request_data *data) | |||
| 39 | if (data->length < 0) | 39 | if (data->length < 0) |
| 40 | return usb_ep_set_halt(cdev->gadget->ep0); | 40 | return usb_ep_set_halt(cdev->gadget->ep0); |
| 41 | 41 | ||
| 42 | req->length = min(uvc->event_length, data->length); | 42 | req->length = min_t(unsigned int, uvc->event_length, data->length); |
| 43 | req->zero = data->length < uvc->event_length; | 43 | req->zero = data->length < uvc->event_length; |
| 44 | req->dma = DMA_ADDR_INVALID; | 44 | req->dma = DMA_ADDR_INVALID; |
| 45 | 45 | ||
diff --git a/drivers/usb/host/ehci-fsl.c b/drivers/usb/host/ehci-fsl.c index 3e7345172e03..d0a84bd3f3eb 100644 --- a/drivers/usb/host/ehci-fsl.c +++ b/drivers/usb/host/ehci-fsl.c | |||
| @@ -218,6 +218,9 @@ static void ehci_fsl_setup_phy(struct ehci_hcd *ehci, | |||
| 218 | u32 portsc; | 218 | u32 portsc; |
| 219 | struct usb_hcd *hcd = ehci_to_hcd(ehci); | 219 | struct usb_hcd *hcd = ehci_to_hcd(ehci); |
| 220 | void __iomem *non_ehci = hcd->regs; | 220 | void __iomem *non_ehci = hcd->regs; |
| 221 | struct fsl_usb2_platform_data *pdata; | ||
| 222 | |||
| 223 | pdata = hcd->self.controller->platform_data; | ||
| 221 | 224 | ||
| 222 | portsc = ehci_readl(ehci, &ehci->regs->port_status[port_offset]); | 225 | portsc = ehci_readl(ehci, &ehci->regs->port_status[port_offset]); |
| 223 | portsc &= ~(PORT_PTS_MSK | PORT_PTS_PTW); | 226 | portsc &= ~(PORT_PTS_MSK | PORT_PTS_PTW); |
| @@ -234,7 +237,9 @@ static void ehci_fsl_setup_phy(struct ehci_hcd *ehci, | |||
| 234 | /* fall through */ | 237 | /* fall through */ |
| 235 | case FSL_USB2_PHY_UTMI: | 238 | case FSL_USB2_PHY_UTMI: |
| 236 | /* enable UTMI PHY */ | 239 | /* enable UTMI PHY */ |
| 237 | setbits32(non_ehci + FSL_SOC_USB_CTRL, CTRL_UTMI_PHY_EN); | 240 | if (pdata->have_sysif_regs) |
| 241 | setbits32(non_ehci + FSL_SOC_USB_CTRL, | ||
| 242 | CTRL_UTMI_PHY_EN); | ||
| 238 | portsc |= PORT_PTS_UTMI; | 243 | portsc |= PORT_PTS_UTMI; |
| 239 | break; | 244 | break; |
| 240 | case FSL_USB2_PHY_NONE: | 245 | case FSL_USB2_PHY_NONE: |
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c index 806cc95317aa..4a3bc5b7a06f 100644 --- a/drivers/usb/host/ehci-hcd.c +++ b/drivers/usb/host/ehci-hcd.c | |||
| @@ -858,8 +858,13 @@ static irqreturn_t ehci_irq (struct usb_hcd *hcd) | |||
| 858 | goto dead; | 858 | goto dead; |
| 859 | } | 859 | } |
| 860 | 860 | ||
| 861 | /* | ||
| 862 | * We don't use STS_FLR, but some controllers don't like it to | ||
| 863 | * remain on, so mask it out along with the other status bits. | ||
| 864 | */ | ||
| 865 | masked_status = status & (INTR_MASK | STS_FLR); | ||
| 866 | |||
| 861 | /* Shared IRQ? */ | 867 | /* Shared IRQ? */ |
| 862 | masked_status = status & INTR_MASK; | ||
| 863 | if (!masked_status || unlikely(ehci->rh_state == EHCI_RH_HALTED)) { | 868 | if (!masked_status || unlikely(ehci->rh_state == EHCI_RH_HALTED)) { |
| 864 | spin_unlock(&ehci->lock); | 869 | spin_unlock(&ehci->lock); |
| 865 | return IRQ_NONE; | 870 | return IRQ_NONE; |
| @@ -910,7 +915,7 @@ static irqreturn_t ehci_irq (struct usb_hcd *hcd) | |||
| 910 | pcd_status = status; | 915 | pcd_status = status; |
| 911 | 916 | ||
| 912 | /* resume root hub? */ | 917 | /* resume root hub? */ |
| 913 | if (!(cmd & CMD_RUN)) | 918 | if (ehci->rh_state == EHCI_RH_SUSPENDED) |
| 914 | usb_hcd_resume_root_hub(hcd); | 919 | usb_hcd_resume_root_hub(hcd); |
| 915 | 920 | ||
| 916 | /* get per-port change detect bits */ | 921 | /* get per-port change detect bits */ |
diff --git a/drivers/usb/host/ehci-omap.c b/drivers/usb/host/ehci-omap.c index bba9850f32f0..5c78f9e71466 100644 --- a/drivers/usb/host/ehci-omap.c +++ b/drivers/usb/host/ehci-omap.c | |||
| @@ -42,6 +42,7 @@ | |||
| 42 | #include <plat/usb.h> | 42 | #include <plat/usb.h> |
| 43 | #include <linux/regulator/consumer.h> | 43 | #include <linux/regulator/consumer.h> |
| 44 | #include <linux/pm_runtime.h> | 44 | #include <linux/pm_runtime.h> |
| 45 | #include <linux/gpio.h> | ||
| 45 | 46 | ||
| 46 | /* EHCI Register Set */ | 47 | /* EHCI Register Set */ |
| 47 | #define EHCI_INSNREG04 (0xA0) | 48 | #define EHCI_INSNREG04 (0xA0) |
| @@ -191,6 +192,19 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev) | |||
| 191 | } | 192 | } |
| 192 | } | 193 | } |
| 193 | 194 | ||
| 195 | if (pdata->phy_reset) { | ||
| 196 | if (gpio_is_valid(pdata->reset_gpio_port[0])) | ||
| 197 | gpio_request_one(pdata->reset_gpio_port[0], | ||
| 198 | GPIOF_OUT_INIT_LOW, "USB1 PHY reset"); | ||
| 199 | |||
| 200 | if (gpio_is_valid(pdata->reset_gpio_port[1])) | ||
| 201 | gpio_request_one(pdata->reset_gpio_port[1], | ||
| 202 | GPIOF_OUT_INIT_LOW, "USB2 PHY reset"); | ||
| 203 | |||
| 204 | /* Hold the PHY in RESET for enough time till DIR is high */ | ||
| 205 | udelay(10); | ||
| 206 | } | ||
| 207 | |||
| 194 | pm_runtime_enable(dev); | 208 | pm_runtime_enable(dev); |
| 195 | pm_runtime_get_sync(dev); | 209 | pm_runtime_get_sync(dev); |
| 196 | 210 | ||
| @@ -237,6 +251,19 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev) | |||
| 237 | /* root ports should always stay powered */ | 251 | /* root ports should always stay powered */ |
| 238 | ehci_port_power(omap_ehci, 1); | 252 | ehci_port_power(omap_ehci, 1); |
| 239 | 253 | ||
| 254 | if (pdata->phy_reset) { | ||
| 255 | /* Hold the PHY in RESET for enough time till | ||
| 256 | * PHY is settled and ready | ||
| 257 | */ | ||
| 258 | udelay(10); | ||
| 259 | |||
| 260 | if (gpio_is_valid(pdata->reset_gpio_port[0])) | ||
| 261 | gpio_set_value(pdata->reset_gpio_port[0], 1); | ||
| 262 | |||
| 263 | if (gpio_is_valid(pdata->reset_gpio_port[1])) | ||
| 264 | gpio_set_value(pdata->reset_gpio_port[1], 1); | ||
| 265 | } | ||
| 266 | |||
| 240 | return 0; | 267 | return 0; |
| 241 | 268 | ||
| 242 | err_add_hcd: | 269 | err_add_hcd: |
| @@ -259,8 +286,9 @@ err_io: | |||
| 259 | */ | 286 | */ |
| 260 | static int ehci_hcd_omap_remove(struct platform_device *pdev) | 287 | static int ehci_hcd_omap_remove(struct platform_device *pdev) |
| 261 | { | 288 | { |
| 262 | struct device *dev = &pdev->dev; | 289 | struct device *dev = &pdev->dev; |
| 263 | struct usb_hcd *hcd = dev_get_drvdata(dev); | 290 | struct usb_hcd *hcd = dev_get_drvdata(dev); |
| 291 | struct ehci_hcd_omap_platform_data *pdata = dev->platform_data; | ||
| 264 | 292 | ||
| 265 | usb_remove_hcd(hcd); | 293 | usb_remove_hcd(hcd); |
| 266 | disable_put_regulator(dev->platform_data); | 294 | disable_put_regulator(dev->platform_data); |
| @@ -269,6 +297,13 @@ static int ehci_hcd_omap_remove(struct platform_device *pdev) | |||
| 269 | pm_runtime_put_sync(dev); | 297 | pm_runtime_put_sync(dev); |
| 270 | pm_runtime_disable(dev); | 298 | pm_runtime_disable(dev); |
| 271 | 299 | ||
| 300 | if (pdata->phy_reset) { | ||
| 301 | if (gpio_is_valid(pdata->reset_gpio_port[0])) | ||
| 302 | gpio_free(pdata->reset_gpio_port[0]); | ||
| 303 | |||
| 304 | if (gpio_is_valid(pdata->reset_gpio_port[1])) | ||
| 305 | gpio_free(pdata->reset_gpio_port[1]); | ||
| 306 | } | ||
| 272 | return 0; | 307 | return 0; |
| 273 | } | 308 | } |
| 274 | 309 | ||
diff --git a/drivers/usb/host/ehci-pci.c b/drivers/usb/host/ehci-pci.c index 01bb7241d6ef..fe8dc069164e 100644 --- a/drivers/usb/host/ehci-pci.c +++ b/drivers/usb/host/ehci-pci.c | |||
| @@ -144,6 +144,14 @@ static int ehci_pci_setup(struct usb_hcd *hcd) | |||
| 144 | hcd->has_tt = 1; | 144 | hcd->has_tt = 1; |
| 145 | tdi_reset(ehci); | 145 | tdi_reset(ehci); |
| 146 | } | 146 | } |
| 147 | if (pdev->subsystem_vendor == PCI_VENDOR_ID_ASUSTEK) { | ||
| 148 | /* EHCI #1 or #2 on 6 Series/C200 Series chipset */ | ||
| 149 | if (pdev->device == 0x1c26 || pdev->device == 0x1c2d) { | ||
| 150 | ehci_info(ehci, "broken D3 during system sleep on ASUS\n"); | ||
| 151 | hcd->broken_pci_sleep = 1; | ||
| 152 | device_set_wakeup_capable(&pdev->dev, false); | ||
| 153 | } | ||
| 154 | } | ||
| 147 | break; | 155 | break; |
| 148 | case PCI_VENDOR_ID_TDI: | 156 | case PCI_VENDOR_ID_TDI: |
| 149 | if (pdev->device == PCI_DEVICE_ID_TDI_EHCI) { | 157 | if (pdev->device == PCI_DEVICE_ID_TDI_EHCI) { |
diff --git a/drivers/usb/host/ehci-tegra.c b/drivers/usb/host/ehci-tegra.c index 73544bd440bd..f214a80cdee2 100644 --- a/drivers/usb/host/ehci-tegra.c +++ b/drivers/usb/host/ehci-tegra.c | |||
| @@ -24,6 +24,7 @@ | |||
| 24 | #include <linux/gpio.h> | 24 | #include <linux/gpio.h> |
| 25 | #include <linux/of.h> | 25 | #include <linux/of.h> |
| 26 | #include <linux/of_gpio.h> | 26 | #include <linux/of_gpio.h> |
| 27 | #include <linux/pm_runtime.h> | ||
| 27 | 28 | ||
| 28 | #include <mach/usb_phy.h> | 29 | #include <mach/usb_phy.h> |
| 29 | #include <mach/iomap.h> | 30 | #include <mach/iomap.h> |
| @@ -37,9 +38,7 @@ struct tegra_ehci_hcd { | |||
| 37 | struct clk *emc_clk; | 38 | struct clk *emc_clk; |
| 38 | struct usb_phy *transceiver; | 39 | struct usb_phy *transceiver; |
| 39 | int host_resumed; | 40 | int host_resumed; |
| 40 | int bus_suspended; | ||
| 41 | int port_resuming; | 41 | int port_resuming; |
| 42 | int power_down_on_bus_suspend; | ||
| 43 | enum tegra_usb_phy_port_speed port_speed; | 42 | enum tegra_usb_phy_port_speed port_speed; |
| 44 | }; | 43 | }; |
| 45 | 44 | ||
| @@ -273,120 +272,6 @@ static void tegra_ehci_restart(struct usb_hcd *hcd) | |||
| 273 | up_write(&ehci_cf_port_reset_rwsem); | 272 | up_write(&ehci_cf_port_reset_rwsem); |
| 274 | } | 273 | } |
| 275 | 274 | ||
| 276 | static int tegra_usb_suspend(struct usb_hcd *hcd) | ||
| 277 | { | ||
| 278 | struct tegra_ehci_hcd *tegra = dev_get_drvdata(hcd->self.controller); | ||
| 279 | struct ehci_regs __iomem *hw = tegra->ehci->regs; | ||
| 280 | unsigned long flags; | ||
| 281 | |||
| 282 | spin_lock_irqsave(&tegra->ehci->lock, flags); | ||
| 283 | |||
| 284 | tegra->port_speed = (readl(&hw->port_status[0]) >> 26) & 0x3; | ||
| 285 | ehci_halt(tegra->ehci); | ||
| 286 | clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags); | ||
| 287 | |||
| 288 | spin_unlock_irqrestore(&tegra->ehci->lock, flags); | ||
| 289 | |||
| 290 | tegra_ehci_power_down(hcd); | ||
| 291 | return 0; | ||
| 292 | } | ||
| 293 | |||
| 294 | static int tegra_usb_resume(struct usb_hcd *hcd) | ||
| 295 | { | ||
| 296 | struct tegra_ehci_hcd *tegra = dev_get_drvdata(hcd->self.controller); | ||
| 297 | struct ehci_hcd *ehci = hcd_to_ehci(hcd); | ||
| 298 | struct ehci_regs __iomem *hw = ehci->regs; | ||
| 299 | unsigned long val; | ||
| 300 | |||
| 301 | set_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags); | ||
| 302 | tegra_ehci_power_up(hcd); | ||
| 303 | |||
| 304 | if (tegra->port_speed > TEGRA_USB_PHY_PORT_SPEED_HIGH) { | ||
| 305 | /* Wait for the phy to detect new devices | ||
| 306 | * before we restart the controller */ | ||
| 307 | msleep(10); | ||
| 308 | goto restart; | ||
| 309 | } | ||
| 310 | |||
| 311 | /* Force the phy to keep data lines in suspend state */ | ||
| 312 | tegra_ehci_phy_restore_start(tegra->phy, tegra->port_speed); | ||
| 313 | |||
| 314 | /* Enable host mode */ | ||
| 315 | tdi_reset(ehci); | ||
| 316 | |||
| 317 | /* Enable Port Power */ | ||
| 318 | val = readl(&hw->port_status[0]); | ||
| 319 | val |= PORT_POWER; | ||
| 320 | writel(val, &hw->port_status[0]); | ||
| 321 | udelay(10); | ||
| 322 | |||
| 323 | /* Check if the phy resume from LP0. When the phy resume from LP0 | ||
| 324 | * USB register will be reset. */ | ||
| 325 | if (!readl(&hw->async_next)) { | ||
| 326 | /* Program the field PTC based on the saved speed mode */ | ||
| 327 | val = readl(&hw->port_status[0]); | ||
| 328 | val &= ~PORT_TEST(~0); | ||
| 329 | if (tegra->port_speed == TEGRA_USB_PHY_PORT_SPEED_HIGH) | ||
| 330 | val |= PORT_TEST_FORCE; | ||
| 331 | else if (tegra->port_speed == TEGRA_USB_PHY_PORT_SPEED_FULL) | ||
| 332 | val |= PORT_TEST(6); | ||
| 333 | else if (tegra->port_speed == TEGRA_USB_PHY_PORT_SPEED_LOW) | ||
| 334 | val |= PORT_TEST(7); | ||
| 335 | writel(val, &hw->port_status[0]); | ||
| 336 | udelay(10); | ||
| 337 | |||
| 338 | /* Disable test mode by setting PTC field to NORMAL_OP */ | ||
| 339 | val = readl(&hw->port_status[0]); | ||
| 340 | val &= ~PORT_TEST(~0); | ||
| 341 | writel(val, &hw->port_status[0]); | ||
| 342 | udelay(10); | ||
| 343 | } | ||
| 344 | |||
| 345 | /* Poll until CCS is enabled */ | ||
| 346 | if (handshake(ehci, &hw->port_status[0], PORT_CONNECT, | ||
| 347 | PORT_CONNECT, 2000)) { | ||
| 348 | pr_err("%s: timeout waiting for PORT_CONNECT\n", __func__); | ||
| 349 | goto restart; | ||
| 350 | } | ||
| 351 | |||
| 352 | /* Poll until PE is enabled */ | ||
| 353 | if (handshake(ehci, &hw->port_status[0], PORT_PE, | ||
| 354 | PORT_PE, 2000)) { | ||
| 355 | pr_err("%s: timeout waiting for USB_PORTSC1_PE\n", __func__); | ||
| 356 | goto restart; | ||
| 357 | } | ||
| 358 | |||
| 359 | /* Clear the PCI status, to avoid an interrupt taken upon resume */ | ||
| 360 | val = readl(&hw->status); | ||
| 361 | val |= STS_PCD; | ||
| 362 | writel(val, &hw->status); | ||
| 363 | |||
| 364 | /* Put controller in suspend mode by writing 1 to SUSP bit of PORTSC */ | ||
| 365 | val = readl(&hw->port_status[0]); | ||
| 366 | if ((val & PORT_POWER) && (val & PORT_PE)) { | ||
| 367 | val |= PORT_SUSPEND; | ||
| 368 | writel(val, &hw->port_status[0]); | ||
| 369 | |||
| 370 | /* Wait until port suspend completes */ | ||
| 371 | if (handshake(ehci, &hw->port_status[0], PORT_SUSPEND, | ||
| 372 | PORT_SUSPEND, 1000)) { | ||
| 373 | pr_err("%s: timeout waiting for PORT_SUSPEND\n", | ||
| 374 | __func__); | ||
| 375 | goto restart; | ||
| 376 | } | ||
| 377 | } | ||
| 378 | |||
| 379 | tegra_ehci_phy_restore_end(tegra->phy); | ||
| 380 | return 0; | ||
| 381 | |||
| 382 | restart: | ||
| 383 | if (tegra->port_speed <= TEGRA_USB_PHY_PORT_SPEED_HIGH) | ||
| 384 | tegra_ehci_phy_restore_end(tegra->phy); | ||
| 385 | |||
| 386 | tegra_ehci_restart(hcd); | ||
| 387 | return 0; | ||
| 388 | } | ||
| 389 | |||
| 390 | static void tegra_ehci_shutdown(struct usb_hcd *hcd) | 275 | static void tegra_ehci_shutdown(struct usb_hcd *hcd) |
| 391 | { | 276 | { |
| 392 | struct tegra_ehci_hcd *tegra = dev_get_drvdata(hcd->self.controller); | 277 | struct tegra_ehci_hcd *tegra = dev_get_drvdata(hcd->self.controller); |
| @@ -434,36 +319,6 @@ static int tegra_ehci_setup(struct usb_hcd *hcd) | |||
| 434 | return retval; | 319 | return retval; |
| 435 | } | 320 | } |
| 436 | 321 | ||
| 437 | #ifdef CONFIG_PM | ||
| 438 | static int tegra_ehci_bus_suspend(struct usb_hcd *hcd) | ||
| 439 | { | ||
| 440 | struct tegra_ehci_hcd *tegra = dev_get_drvdata(hcd->self.controller); | ||
| 441 | int error_status = 0; | ||
| 442 | |||
| 443 | error_status = ehci_bus_suspend(hcd); | ||
| 444 | if (!error_status && tegra->power_down_on_bus_suspend) { | ||
| 445 | tegra_usb_suspend(hcd); | ||
| 446 | tegra->bus_suspended = 1; | ||
| 447 | } | ||
| 448 | |||
| 449 | return error_status; | ||
| 450 | } | ||
| 451 | |||
| 452 | static int tegra_ehci_bus_resume(struct usb_hcd *hcd) | ||
| 453 | { | ||
| 454 | struct tegra_ehci_hcd *tegra = dev_get_drvdata(hcd->self.controller); | ||
| 455 | |||
| 456 | if (tegra->bus_suspended && tegra->power_down_on_bus_suspend) { | ||
| 457 | tegra_usb_resume(hcd); | ||
| 458 | tegra->bus_suspended = 0; | ||
| 459 | } | ||
| 460 | |||
| 461 | tegra_usb_phy_preresume(tegra->phy); | ||
| 462 | tegra->port_resuming = 1; | ||
| 463 | return ehci_bus_resume(hcd); | ||
| 464 | } | ||
| 465 | #endif | ||
| 466 | |||
| 467 | struct temp_buffer { | 322 | struct temp_buffer { |
| 468 | void *kmalloc_ptr; | 323 | void *kmalloc_ptr; |
| 469 | void *old_xfer_buffer; | 324 | void *old_xfer_buffer; |
| @@ -574,8 +429,8 @@ static const struct hc_driver tegra_ehci_hc_driver = { | |||
| 574 | .hub_control = tegra_ehci_hub_control, | 429 | .hub_control = tegra_ehci_hub_control, |
| 575 | .clear_tt_buffer_complete = ehci_clear_tt_buffer_complete, | 430 | .clear_tt_buffer_complete = ehci_clear_tt_buffer_complete, |
| 576 | #ifdef CONFIG_PM | 431 | #ifdef CONFIG_PM |
| 577 | .bus_suspend = tegra_ehci_bus_suspend, | 432 | .bus_suspend = ehci_bus_suspend, |
| 578 | .bus_resume = tegra_ehci_bus_resume, | 433 | .bus_resume = ehci_bus_resume, |
| 579 | #endif | 434 | #endif |
| 580 | .relinquish_port = ehci_relinquish_port, | 435 | .relinquish_port = ehci_relinquish_port, |
| 581 | .port_handed_over = ehci_port_handed_over, | 436 | .port_handed_over = ehci_port_handed_over, |
| @@ -603,11 +458,187 @@ static int setup_vbus_gpio(struct platform_device *pdev) | |||
| 603 | dev_err(&pdev->dev, "can't enable vbus\n"); | 458 | dev_err(&pdev->dev, "can't enable vbus\n"); |
| 604 | return err; | 459 | return err; |
| 605 | } | 460 | } |
| 606 | gpio_set_value(gpio, 1); | ||
| 607 | 461 | ||
| 608 | return err; | 462 | return err; |
| 609 | } | 463 | } |
| 610 | 464 | ||
| 465 | #ifdef CONFIG_PM | ||
| 466 | |||
| 467 | static int controller_suspend(struct device *dev) | ||
| 468 | { | ||
| 469 | struct tegra_ehci_hcd *tegra = | ||
| 470 | platform_get_drvdata(to_platform_device(dev)); | ||
| 471 | struct ehci_hcd *ehci = tegra->ehci; | ||
| 472 | struct usb_hcd *hcd = ehci_to_hcd(ehci); | ||
| 473 | struct ehci_regs __iomem *hw = ehci->regs; | ||
| 474 | unsigned long flags; | ||
| 475 | |||
| 476 | if (time_before(jiffies, ehci->next_statechange)) | ||
| 477 | msleep(10); | ||
| 478 | |||
| 479 | spin_lock_irqsave(&ehci->lock, flags); | ||
| 480 | |||
| 481 | tegra->port_speed = (readl(&hw->port_status[0]) >> 26) & 0x3; | ||
| 482 | ehci_halt(ehci); | ||
| 483 | clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags); | ||
| 484 | |||
| 485 | spin_unlock_irqrestore(&ehci->lock, flags); | ||
| 486 | |||
| 487 | tegra_ehci_power_down(hcd); | ||
| 488 | return 0; | ||
| 489 | } | ||
| 490 | |||
| 491 | static int controller_resume(struct device *dev) | ||
| 492 | { | ||
| 493 | struct tegra_ehci_hcd *tegra = | ||
| 494 | platform_get_drvdata(to_platform_device(dev)); | ||
| 495 | struct ehci_hcd *ehci = tegra->ehci; | ||
| 496 | struct usb_hcd *hcd = ehci_to_hcd(ehci); | ||
| 497 | struct ehci_regs __iomem *hw = ehci->regs; | ||
| 498 | unsigned long val; | ||
| 499 | |||
| 500 | set_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags); | ||
| 501 | tegra_ehci_power_up(hcd); | ||
| 502 | |||
| 503 | if (tegra->port_speed > TEGRA_USB_PHY_PORT_SPEED_HIGH) { | ||
| 504 | /* Wait for the phy to detect new devices | ||
| 505 | * before we restart the controller */ | ||
| 506 | msleep(10); | ||
| 507 | goto restart; | ||
| 508 | } | ||
| 509 | |||
| 510 | /* Force the phy to keep data lines in suspend state */ | ||
| 511 | tegra_ehci_phy_restore_start(tegra->phy, tegra->port_speed); | ||
| 512 | |||
| 513 | /* Enable host mode */ | ||
| 514 | tdi_reset(ehci); | ||
| 515 | |||
| 516 | /* Enable Port Power */ | ||
| 517 | val = readl(&hw->port_status[0]); | ||
| 518 | val |= PORT_POWER; | ||
| 519 | writel(val, &hw->port_status[0]); | ||
| 520 | udelay(10); | ||
| 521 | |||
| 522 | /* Check if the phy resume from LP0. When the phy resume from LP0 | ||
| 523 | * USB register will be reset. */ | ||
| 524 | if (!readl(&hw->async_next)) { | ||
| 525 | /* Program the field PTC based on the saved speed mode */ | ||
| 526 | val = readl(&hw->port_status[0]); | ||
| 527 | val &= ~PORT_TEST(~0); | ||
| 528 | if (tegra->port_speed == TEGRA_USB_PHY_PORT_SPEED_HIGH) | ||
| 529 | val |= PORT_TEST_FORCE; | ||
| 530 | else if (tegra->port_speed == TEGRA_USB_PHY_PORT_SPEED_FULL) | ||
| 531 | val |= PORT_TEST(6); | ||
| 532 | else if (tegra->port_speed == TEGRA_USB_PHY_PORT_SPEED_LOW) | ||
| 533 | val |= PORT_TEST(7); | ||
| 534 | writel(val, &hw->port_status[0]); | ||
| 535 | udelay(10); | ||
| 536 | |||
| 537 | /* Disable test mode by setting PTC field to NORMAL_OP */ | ||
| 538 | val = readl(&hw->port_status[0]); | ||
| 539 | val &= ~PORT_TEST(~0); | ||
| 540 | writel(val, &hw->port_status[0]); | ||
| 541 | udelay(10); | ||
| 542 | } | ||
| 543 | |||
| 544 | /* Poll until CCS is enabled */ | ||
| 545 | if (handshake(ehci, &hw->port_status[0], PORT_CONNECT, | ||
| 546 | PORT_CONNECT, 2000)) { | ||
| 547 | pr_err("%s: timeout waiting for PORT_CONNECT\n", __func__); | ||
| 548 | goto restart; | ||
| 549 | } | ||
| 550 | |||
| 551 | /* Poll until PE is enabled */ | ||
| 552 | if (handshake(ehci, &hw->port_status[0], PORT_PE, | ||
| 553 | PORT_PE, 2000)) { | ||
| 554 | pr_err("%s: timeout waiting for USB_PORTSC1_PE\n", __func__); | ||
| 555 | goto restart; | ||
| 556 | } | ||
| 557 | |||
| 558 | /* Clear the PCI status, to avoid an interrupt taken upon resume */ | ||
| 559 | val = readl(&hw->status); | ||
| 560 | val |= STS_PCD; | ||
| 561 | writel(val, &hw->status); | ||
| 562 | |||
| 563 | /* Put controller in suspend mode by writing 1 to SUSP bit of PORTSC */ | ||
| 564 | val = readl(&hw->port_status[0]); | ||
| 565 | if ((val & PORT_POWER) && (val & PORT_PE)) { | ||
| 566 | val |= PORT_SUSPEND; | ||
| 567 | writel(val, &hw->port_status[0]); | ||
| 568 | |||
| 569 | /* Wait until port suspend completes */ | ||
| 570 | if (handshake(ehci, &hw->port_status[0], PORT_SUSPEND, | ||
| 571 | PORT_SUSPEND, 1000)) { | ||
| 572 | pr_err("%s: timeout waiting for PORT_SUSPEND\n", | ||
| 573 | __func__); | ||
| 574 | goto restart; | ||
| 575 | } | ||
| 576 | } | ||
| 577 | |||
| 578 | tegra_ehci_phy_restore_end(tegra->phy); | ||
| 579 | goto done; | ||
| 580 | |||
| 581 | restart: | ||
| 582 | if (tegra->port_speed <= TEGRA_USB_PHY_PORT_SPEED_HIGH) | ||
| 583 | tegra_ehci_phy_restore_end(tegra->phy); | ||
| 584 | |||
| 585 | tegra_ehci_restart(hcd); | ||
| 586 | |||
| 587 | done: | ||
| 588 | tegra_usb_phy_preresume(tegra->phy); | ||
| 589 | tegra->port_resuming = 1; | ||
| 590 | return 0; | ||
| 591 | } | ||
| 592 | |||
| 593 | static int tegra_ehci_suspend(struct device *dev) | ||
| 594 | { | ||
| 595 | struct tegra_ehci_hcd *tegra = | ||
| 596 | platform_get_drvdata(to_platform_device(dev)); | ||
| 597 | struct usb_hcd *hcd = ehci_to_hcd(tegra->ehci); | ||
| 598 | int rc = 0; | ||
| 599 | |||
| 600 | /* | ||
| 601 | * When system sleep is supported and USB controller wakeup is | ||
| 602 | * implemented: If the controller is runtime-suspended and the | ||
| 603 | * wakeup setting needs to be changed, call pm_runtime_resume(). | ||
| 604 | */ | ||
| 605 | if (HCD_HW_ACCESSIBLE(hcd)) | ||
| 606 | rc = controller_suspend(dev); | ||
| 607 | return rc; | ||
| 608 | } | ||
| 609 | |||
| 610 | static int tegra_ehci_resume(struct device *dev) | ||
| 611 | { | ||
| 612 | int rc; | ||
| 613 | |||
| 614 | rc = controller_resume(dev); | ||
| 615 | if (rc == 0) { | ||
| 616 | pm_runtime_disable(dev); | ||
| 617 | pm_runtime_set_active(dev); | ||
| 618 | pm_runtime_enable(dev); | ||
| 619 | } | ||
| 620 | return rc; | ||
| 621 | } | ||
| 622 | |||
| 623 | static int tegra_ehci_runtime_suspend(struct device *dev) | ||
| 624 | { | ||
| 625 | return controller_suspend(dev); | ||
| 626 | } | ||
| 627 | |||
| 628 | static int tegra_ehci_runtime_resume(struct device *dev) | ||
| 629 | { | ||
| 630 | return controller_resume(dev); | ||
| 631 | } | ||
| 632 | |||
| 633 | static const struct dev_pm_ops tegra_ehci_pm_ops = { | ||
| 634 | .suspend = tegra_ehci_suspend, | ||
| 635 | .resume = tegra_ehci_resume, | ||
| 636 | .runtime_suspend = tegra_ehci_runtime_suspend, | ||
| 637 | .runtime_resume = tegra_ehci_runtime_resume, | ||
| 638 | }; | ||
| 639 | |||
| 640 | #endif | ||
| 641 | |||
| 611 | static u64 tegra_ehci_dma_mask = DMA_BIT_MASK(32); | 642 | static u64 tegra_ehci_dma_mask = DMA_BIT_MASK(32); |
| 612 | 643 | ||
| 613 | static int tegra_ehci_probe(struct platform_device *pdev) | 644 | static int tegra_ehci_probe(struct platform_device *pdev) |
| @@ -722,7 +753,6 @@ static int tegra_ehci_probe(struct platform_device *pdev) | |||
| 722 | } | 753 | } |
| 723 | 754 | ||
| 724 | tegra->host_resumed = 1; | 755 | tegra->host_resumed = 1; |
| 725 | tegra->power_down_on_bus_suspend = pdata->power_down_on_bus_suspend; | ||
| 726 | tegra->ehci = hcd_to_ehci(hcd); | 756 | tegra->ehci = hcd_to_ehci(hcd); |
| 727 | 757 | ||
| 728 | irq = platform_get_irq(pdev, 0); | 758 | irq = platform_get_irq(pdev, 0); |
| @@ -731,7 +761,6 @@ static int tegra_ehci_probe(struct platform_device *pdev) | |||
| 731 | err = -ENODEV; | 761 | err = -ENODEV; |
| 732 | goto fail; | 762 | goto fail; |
| 733 | } | 763 | } |
| 734 | set_irq_flags(irq, IRQF_VALID); | ||
| 735 | 764 | ||
| 736 | #ifdef CONFIG_USB_OTG_UTILS | 765 | #ifdef CONFIG_USB_OTG_UTILS |
| 737 | if (pdata->operating_mode == TEGRA_USB_OTG) { | 766 | if (pdata->operating_mode == TEGRA_USB_OTG) { |
| @@ -747,6 +776,14 @@ static int tegra_ehci_probe(struct platform_device *pdev) | |||
| 747 | goto fail; | 776 | goto fail; |
| 748 | } | 777 | } |
| 749 | 778 | ||
| 779 | pm_runtime_set_active(&pdev->dev); | ||
| 780 | pm_runtime_get_noresume(&pdev->dev); | ||
| 781 | |||
| 782 | /* Don't skip the pm_runtime_forbid call if wakeup isn't working */ | ||
| 783 | /* if (!pdata->power_down_on_bus_suspend) */ | ||
| 784 | pm_runtime_forbid(&pdev->dev); | ||
| 785 | pm_runtime_enable(&pdev->dev); | ||
| 786 | pm_runtime_put_sync(&pdev->dev); | ||
| 750 | return err; | 787 | return err; |
| 751 | 788 | ||
| 752 | fail: | 789 | fail: |
| @@ -773,33 +810,6 @@ fail_hcd: | |||
| 773 | return err; | 810 | return err; |
| 774 | } | 811 | } |
| 775 | 812 | ||
| 776 | #ifdef CONFIG_PM | ||
| 777 | static int tegra_ehci_resume(struct platform_device *pdev) | ||
| 778 | { | ||
| 779 | struct tegra_ehci_hcd *tegra = platform_get_drvdata(pdev); | ||
| 780 | struct usb_hcd *hcd = ehci_to_hcd(tegra->ehci); | ||
| 781 | |||
| 782 | if (tegra->bus_suspended) | ||
| 783 | return 0; | ||
| 784 | |||
| 785 | return tegra_usb_resume(hcd); | ||
| 786 | } | ||
| 787 | |||
| 788 | static int tegra_ehci_suspend(struct platform_device *pdev, pm_message_t state) | ||
| 789 | { | ||
| 790 | struct tegra_ehci_hcd *tegra = platform_get_drvdata(pdev); | ||
| 791 | struct usb_hcd *hcd = ehci_to_hcd(tegra->ehci); | ||
| 792 | |||
| 793 | if (tegra->bus_suspended) | ||
| 794 | return 0; | ||
| 795 | |||
| 796 | if (time_before(jiffies, tegra->ehci->next_statechange)) | ||
| 797 | msleep(10); | ||
| 798 | |||
| 799 | return tegra_usb_suspend(hcd); | ||
| 800 | } | ||
| 801 | #endif | ||
| 802 | |||
| 803 | static int tegra_ehci_remove(struct platform_device *pdev) | 813 | static int tegra_ehci_remove(struct platform_device *pdev) |
| 804 | { | 814 | { |
| 805 | struct tegra_ehci_hcd *tegra = platform_get_drvdata(pdev); | 815 | struct tegra_ehci_hcd *tegra = platform_get_drvdata(pdev); |
| @@ -808,6 +818,10 @@ static int tegra_ehci_remove(struct platform_device *pdev) | |||
| 808 | if (tegra == NULL || hcd == NULL) | 818 | if (tegra == NULL || hcd == NULL) |
| 809 | return -EINVAL; | 819 | return -EINVAL; |
| 810 | 820 | ||
| 821 | pm_runtime_get_sync(&pdev->dev); | ||
| 822 | pm_runtime_disable(&pdev->dev); | ||
| 823 | pm_runtime_put_noidle(&pdev->dev); | ||
| 824 | |||
| 811 | #ifdef CONFIG_USB_OTG_UTILS | 825 | #ifdef CONFIG_USB_OTG_UTILS |
| 812 | if (tegra->transceiver) { | 826 | if (tegra->transceiver) { |
| 813 | otg_set_host(tegra->transceiver->otg, NULL); | 827 | otg_set_host(tegra->transceiver->otg, NULL); |
| @@ -848,13 +862,12 @@ static struct of_device_id tegra_ehci_of_match[] __devinitdata = { | |||
| 848 | static struct platform_driver tegra_ehci_driver = { | 862 | static struct platform_driver tegra_ehci_driver = { |
| 849 | .probe = tegra_ehci_probe, | 863 | .probe = tegra_ehci_probe, |
| 850 | .remove = tegra_ehci_remove, | 864 | .remove = tegra_ehci_remove, |
| 851 | #ifdef CONFIG_PM | ||
| 852 | .suspend = tegra_ehci_suspend, | ||
| 853 | .resume = tegra_ehci_resume, | ||
| 854 | #endif | ||
| 855 | .shutdown = tegra_ehci_hcd_shutdown, | 865 | .shutdown = tegra_ehci_hcd_shutdown, |
| 856 | .driver = { | 866 | .driver = { |
| 857 | .name = "tegra-ehci", | 867 | .name = "tegra-ehci", |
| 858 | .of_match_table = tegra_ehci_of_match, | 868 | .of_match_table = tegra_ehci_of_match, |
| 869 | #ifdef CONFIG_PM | ||
| 870 | .pm = &tegra_ehci_pm_ops, | ||
| 871 | #endif | ||
| 859 | } | 872 | } |
| 860 | }; | 873 | }; |
diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c index 09f597ad6e00..13ebeca8e73e 100644 --- a/drivers/usb/host/ohci-at91.c +++ b/drivers/usb/host/ohci-at91.c | |||
| @@ -94,7 +94,7 @@ static void at91_stop_hc(struct platform_device *pdev) | |||
| 94 | 94 | ||
| 95 | /*-------------------------------------------------------------------------*/ | 95 | /*-------------------------------------------------------------------------*/ |
| 96 | 96 | ||
| 97 | static void usb_hcd_at91_remove (struct usb_hcd *, struct platform_device *); | 97 | static void __devexit usb_hcd_at91_remove (struct usb_hcd *, struct platform_device *); |
| 98 | 98 | ||
| 99 | /* configure so an HC device and id are always provided */ | 99 | /* configure so an HC device and id are always provided */ |
| 100 | /* always called with process context; sleeping is OK */ | 100 | /* always called with process context; sleeping is OK */ |
| @@ -108,7 +108,7 @@ static void usb_hcd_at91_remove (struct usb_hcd *, struct platform_device *); | |||
| 108 | * then invokes the start() method for the HCD associated with it | 108 | * then invokes the start() method for the HCD associated with it |
| 109 | * through the hotplug entry's driver_data. | 109 | * through the hotplug entry's driver_data. |
| 110 | */ | 110 | */ |
| 111 | static int usb_hcd_at91_probe(const struct hc_driver *driver, | 111 | static int __devinit usb_hcd_at91_probe(const struct hc_driver *driver, |
| 112 | struct platform_device *pdev) | 112 | struct platform_device *pdev) |
| 113 | { | 113 | { |
| 114 | int retval; | 114 | int retval; |
| @@ -203,7 +203,7 @@ static int usb_hcd_at91_probe(const struct hc_driver *driver, | |||
| 203 | * context, "rmmod" or something similar. | 203 | * context, "rmmod" or something similar. |
| 204 | * | 204 | * |
| 205 | */ | 205 | */ |
| 206 | static void usb_hcd_at91_remove(struct usb_hcd *hcd, | 206 | static void __devexit usb_hcd_at91_remove(struct usb_hcd *hcd, |
| 207 | struct platform_device *pdev) | 207 | struct platform_device *pdev) |
| 208 | { | 208 | { |
| 209 | usb_remove_hcd(hcd); | 209 | usb_remove_hcd(hcd); |
| @@ -545,7 +545,7 @@ static int __devinit ohci_at91_of_init(struct platform_device *pdev) | |||
| 545 | 545 | ||
| 546 | /*-------------------------------------------------------------------------*/ | 546 | /*-------------------------------------------------------------------------*/ |
| 547 | 547 | ||
| 548 | static int ohci_hcd_at91_drv_probe(struct platform_device *pdev) | 548 | static int __devinit ohci_hcd_at91_drv_probe(struct platform_device *pdev) |
| 549 | { | 549 | { |
| 550 | struct at91_usbh_data *pdata; | 550 | struct at91_usbh_data *pdata; |
| 551 | int i; | 551 | int i; |
| @@ -620,7 +620,7 @@ static int ohci_hcd_at91_drv_probe(struct platform_device *pdev) | |||
| 620 | return usb_hcd_at91_probe(&ohci_at91_hc_driver, pdev); | 620 | return usb_hcd_at91_probe(&ohci_at91_hc_driver, pdev); |
| 621 | } | 621 | } |
| 622 | 622 | ||
| 623 | static int ohci_hcd_at91_drv_remove(struct platform_device *pdev) | 623 | static int __devexit ohci_hcd_at91_drv_remove(struct platform_device *pdev) |
| 624 | { | 624 | { |
| 625 | struct at91_usbh_data *pdata = pdev->dev.platform_data; | 625 | struct at91_usbh_data *pdata = pdev->dev.platform_data; |
| 626 | int i; | 626 | int i; |
| @@ -696,7 +696,7 @@ MODULE_ALIAS("platform:at91_ohci"); | |||
| 696 | 696 | ||
| 697 | static struct platform_driver ohci_hcd_at91_driver = { | 697 | static struct platform_driver ohci_hcd_at91_driver = { |
| 698 | .probe = ohci_hcd_at91_drv_probe, | 698 | .probe = ohci_hcd_at91_drv_probe, |
| 699 | .remove = ohci_hcd_at91_drv_remove, | 699 | .remove = __devexit_p(ohci_hcd_at91_drv_remove), |
| 700 | .shutdown = usb_hcd_platform_shutdown, | 700 | .shutdown = usb_hcd_platform_shutdown, |
| 701 | .suspend = ohci_hcd_at91_drv_suspend, | 701 | .suspend = ohci_hcd_at91_drv_suspend, |
| 702 | .resume = ohci_hcd_at91_drv_resume, | 702 | .resume = ohci_hcd_at91_drv_resume, |
diff --git a/drivers/usb/misc/usbtest.c b/drivers/usb/misc/usbtest.c index 959145baf3cf..9dcb68f04f03 100644 --- a/drivers/usb/misc/usbtest.c +++ b/drivers/usb/misc/usbtest.c | |||
| @@ -423,7 +423,7 @@ alloc_sglist(int nents, int max, int vary) | |||
| 423 | unsigned i; | 423 | unsigned i; |
| 424 | unsigned size = max; | 424 | unsigned size = max; |
| 425 | 425 | ||
| 426 | sg = kmalloc(nents * sizeof *sg, GFP_KERNEL); | 426 | sg = kmalloc_array(nents, sizeof *sg, GFP_KERNEL); |
| 427 | if (!sg) | 427 | if (!sg) |
| 428 | return NULL; | 428 | return NULL; |
| 429 | sg_init_table(sg, nents); | 429 | sg_init_table(sg, nents); |
| @@ -904,6 +904,9 @@ test_ctrl_queue(struct usbtest_dev *dev, struct usbtest_param *param) | |||
| 904 | struct ctrl_ctx context; | 904 | struct ctrl_ctx context; |
| 905 | int i; | 905 | int i; |
| 906 | 906 | ||
| 907 | if (param->sglen == 0 || param->iterations > UINT_MAX / param->sglen) | ||
| 908 | return -EOPNOTSUPP; | ||
| 909 | |||
| 907 | spin_lock_init(&context.lock); | 910 | spin_lock_init(&context.lock); |
| 908 | context.dev = dev; | 911 | context.dev = dev; |
| 909 | init_completion(&context.complete); | 912 | init_completion(&context.complete); |
| @@ -1981,8 +1984,6 @@ usbtest_ioctl(struct usb_interface *intf, unsigned int code, void *buf) | |||
| 1981 | 1984 | ||
| 1982 | /* queued control messaging */ | 1985 | /* queued control messaging */ |
| 1983 | case 10: | 1986 | case 10: |
| 1984 | if (param->sglen == 0) | ||
| 1985 | break; | ||
| 1986 | retval = 0; | 1987 | retval = 0; |
| 1987 | dev_info(&intf->dev, | 1988 | dev_info(&intf->dev, |
| 1988 | "TEST 10: queue %d control calls, %d times\n", | 1989 | "TEST 10: queue %d control calls, %d times\n", |
| @@ -2276,6 +2277,8 @@ usbtest_probe(struct usb_interface *intf, const struct usb_device_id *id) | |||
| 2276 | if (status < 0) { | 2277 | if (status < 0) { |
| 2277 | WARNING(dev, "couldn't get endpoints, %d\n", | 2278 | WARNING(dev, "couldn't get endpoints, %d\n", |
| 2278 | status); | 2279 | status); |
| 2280 | kfree(dev->buf); | ||
| 2281 | kfree(dev); | ||
| 2279 | return status; | 2282 | return status; |
| 2280 | } | 2283 | } |
| 2281 | /* may find bulk or ISO pipes */ | 2284 | /* may find bulk or ISO pipes */ |
diff --git a/drivers/usb/misc/yurex.c b/drivers/usb/misc/yurex.c index 897edda42270..70201462e19c 100644 --- a/drivers/usb/misc/yurex.c +++ b/drivers/usb/misc/yurex.c | |||
| @@ -99,9 +99,7 @@ static void yurex_delete(struct kref *kref) | |||
| 99 | usb_put_dev(dev->udev); | 99 | usb_put_dev(dev->udev); |
| 100 | if (dev->cntl_urb) { | 100 | if (dev->cntl_urb) { |
| 101 | usb_kill_urb(dev->cntl_urb); | 101 | usb_kill_urb(dev->cntl_urb); |
| 102 | if (dev->cntl_req) | 102 | kfree(dev->cntl_req); |
| 103 | usb_free_coherent(dev->udev, YUREX_BUF_SIZE, | ||
| 104 | dev->cntl_req, dev->cntl_urb->setup_dma); | ||
| 105 | if (dev->cntl_buffer) | 103 | if (dev->cntl_buffer) |
| 106 | usb_free_coherent(dev->udev, YUREX_BUF_SIZE, | 104 | usb_free_coherent(dev->udev, YUREX_BUF_SIZE, |
| 107 | dev->cntl_buffer, dev->cntl_urb->transfer_dma); | 105 | dev->cntl_buffer, dev->cntl_urb->transfer_dma); |
| @@ -234,9 +232,7 @@ static int yurex_probe(struct usb_interface *interface, const struct usb_device_ | |||
| 234 | } | 232 | } |
| 235 | 233 | ||
| 236 | /* allocate buffer for control req */ | 234 | /* allocate buffer for control req */ |
| 237 | dev->cntl_req = usb_alloc_coherent(dev->udev, YUREX_BUF_SIZE, | 235 | dev->cntl_req = kmalloc(YUREX_BUF_SIZE, GFP_KERNEL); |
| 238 | GFP_KERNEL, | ||
| 239 | &dev->cntl_urb->setup_dma); | ||
| 240 | if (!dev->cntl_req) { | 236 | if (!dev->cntl_req) { |
| 241 | err("Could not allocate cntl_req"); | 237 | err("Could not allocate cntl_req"); |
| 242 | goto error; | 238 | goto error; |
| @@ -286,7 +282,7 @@ static int yurex_probe(struct usb_interface *interface, const struct usb_device_ | |||
| 286 | usb_rcvintpipe(dev->udev, dev->int_in_endpointAddr), | 282 | usb_rcvintpipe(dev->udev, dev->int_in_endpointAddr), |
| 287 | dev->int_buffer, YUREX_BUF_SIZE, yurex_interrupt, | 283 | dev->int_buffer, YUREX_BUF_SIZE, yurex_interrupt, |
| 288 | dev, 1); | 284 | dev, 1); |
| 289 | dev->cntl_urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; | 285 | dev->urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; |
| 290 | if (usb_submit_urb(dev->urb, GFP_KERNEL)) { | 286 | if (usb_submit_urb(dev->urb, GFP_KERNEL)) { |
| 291 | retval = -EIO; | 287 | retval = -EIO; |
| 292 | err("Could not submitting URB"); | 288 | err("Could not submitting URB"); |
diff --git a/drivers/usb/musb/davinci.c b/drivers/usb/musb/davinci.c index 97ab975fa442..768b4b55c816 100644 --- a/drivers/usb/musb/davinci.c +++ b/drivers/usb/musb/davinci.c | |||
| @@ -386,7 +386,7 @@ static int davinci_musb_init(struct musb *musb) | |||
| 386 | usb_nop_xceiv_register(); | 386 | usb_nop_xceiv_register(); |
| 387 | musb->xceiv = usb_get_transceiver(); | 387 | musb->xceiv = usb_get_transceiver(); |
| 388 | if (!musb->xceiv) | 388 | if (!musb->xceiv) |
| 389 | return -ENODEV; | 389 | goto unregister; |
| 390 | 390 | ||
| 391 | musb->mregs += DAVINCI_BASE_OFFSET; | 391 | musb->mregs += DAVINCI_BASE_OFFSET; |
| 392 | 392 | ||
| @@ -444,6 +444,7 @@ static int davinci_musb_init(struct musb *musb) | |||
| 444 | 444 | ||
| 445 | fail: | 445 | fail: |
| 446 | usb_put_transceiver(musb->xceiv); | 446 | usb_put_transceiver(musb->xceiv); |
| 447 | unregister: | ||
| 447 | usb_nop_xceiv_unregister(); | 448 | usb_nop_xceiv_unregister(); |
| 448 | return -ENODEV; | 449 | return -ENODEV; |
| 449 | } | 450 | } |
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c index 0f8b82918a40..66aaccf04490 100644 --- a/drivers/usb/musb/musb_core.c +++ b/drivers/usb/musb/musb_core.c | |||
| @@ -137,6 +137,9 @@ static int musb_ulpi_read(struct usb_phy *phy, u32 offset) | |||
| 137 | int i = 0; | 137 | int i = 0; |
| 138 | u8 r; | 138 | u8 r; |
| 139 | u8 power; | 139 | u8 power; |
| 140 | int ret; | ||
| 141 | |||
| 142 | pm_runtime_get_sync(phy->io_dev); | ||
| 140 | 143 | ||
| 141 | /* Make sure the transceiver is not in low power mode */ | 144 | /* Make sure the transceiver is not in low power mode */ |
| 142 | power = musb_readb(addr, MUSB_POWER); | 145 | power = musb_readb(addr, MUSB_POWER); |
| @@ -154,15 +157,22 @@ static int musb_ulpi_read(struct usb_phy *phy, u32 offset) | |||
| 154 | while (!(musb_readb(addr, MUSB_ULPI_REG_CONTROL) | 157 | while (!(musb_readb(addr, MUSB_ULPI_REG_CONTROL) |
| 155 | & MUSB_ULPI_REG_CMPLT)) { | 158 | & MUSB_ULPI_REG_CMPLT)) { |
| 156 | i++; | 159 | i++; |
| 157 | if (i == 10000) | 160 | if (i == 10000) { |
| 158 | return -ETIMEDOUT; | 161 | ret = -ETIMEDOUT; |
| 162 | goto out; | ||
| 163 | } | ||
| 159 | 164 | ||
| 160 | } | 165 | } |
| 161 | r = musb_readb(addr, MUSB_ULPI_REG_CONTROL); | 166 | r = musb_readb(addr, MUSB_ULPI_REG_CONTROL); |
| 162 | r &= ~MUSB_ULPI_REG_CMPLT; | 167 | r &= ~MUSB_ULPI_REG_CMPLT; |
| 163 | musb_writeb(addr, MUSB_ULPI_REG_CONTROL, r); | 168 | musb_writeb(addr, MUSB_ULPI_REG_CONTROL, r); |
| 164 | 169 | ||
| 165 | return musb_readb(addr, MUSB_ULPI_REG_DATA); | 170 | ret = musb_readb(addr, MUSB_ULPI_REG_DATA); |
| 171 | |||
| 172 | out: | ||
| 173 | pm_runtime_put(phy->io_dev); | ||
| 174 | |||
| 175 | return ret; | ||
| 166 | } | 176 | } |
| 167 | 177 | ||
| 168 | static int musb_ulpi_write(struct usb_phy *phy, u32 offset, u32 data) | 178 | static int musb_ulpi_write(struct usb_phy *phy, u32 offset, u32 data) |
| @@ -171,6 +181,9 @@ static int musb_ulpi_write(struct usb_phy *phy, u32 offset, u32 data) | |||
| 171 | int i = 0; | 181 | int i = 0; |
| 172 | u8 r = 0; | 182 | u8 r = 0; |
| 173 | u8 power; | 183 | u8 power; |
| 184 | int ret = 0; | ||
| 185 | |||
| 186 | pm_runtime_get_sync(phy->io_dev); | ||
| 174 | 187 | ||
| 175 | /* Make sure the transceiver is not in low power mode */ | 188 | /* Make sure the transceiver is not in low power mode */ |
| 176 | power = musb_readb(addr, MUSB_POWER); | 189 | power = musb_readb(addr, MUSB_POWER); |
| @@ -184,15 +197,20 @@ static int musb_ulpi_write(struct usb_phy *phy, u32 offset, u32 data) | |||
| 184 | while (!(musb_readb(addr, MUSB_ULPI_REG_CONTROL) | 197 | while (!(musb_readb(addr, MUSB_ULPI_REG_CONTROL) |
| 185 | & MUSB_ULPI_REG_CMPLT)) { | 198 | & MUSB_ULPI_REG_CMPLT)) { |
| 186 | i++; | 199 | i++; |
| 187 | if (i == 10000) | 200 | if (i == 10000) { |
| 188 | return -ETIMEDOUT; | 201 | ret = -ETIMEDOUT; |
| 202 | goto out; | ||
| 203 | } | ||
| 189 | } | 204 | } |
| 190 | 205 | ||
| 191 | r = musb_readb(addr, MUSB_ULPI_REG_CONTROL); | 206 | r = musb_readb(addr, MUSB_ULPI_REG_CONTROL); |
| 192 | r &= ~MUSB_ULPI_REG_CMPLT; | 207 | r &= ~MUSB_ULPI_REG_CMPLT; |
| 193 | musb_writeb(addr, MUSB_ULPI_REG_CONTROL, r); | 208 | musb_writeb(addr, MUSB_ULPI_REG_CONTROL, r); |
| 194 | 209 | ||
| 195 | return 0; | 210 | out: |
| 211 | pm_runtime_put(phy->io_dev); | ||
| 212 | |||
| 213 | return ret; | ||
| 196 | } | 214 | } |
| 197 | #else | 215 | #else |
| 198 | #define musb_ulpi_read NULL | 216 | #define musb_ulpi_read NULL |
| @@ -1904,14 +1922,17 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl) | |||
| 1904 | 1922 | ||
| 1905 | if (!musb->isr) { | 1923 | if (!musb->isr) { |
| 1906 | status = -ENODEV; | 1924 | status = -ENODEV; |
| 1907 | goto fail3; | 1925 | goto fail2; |
| 1908 | } | 1926 | } |
| 1909 | 1927 | ||
| 1910 | if (!musb->xceiv->io_ops) { | 1928 | if (!musb->xceiv->io_ops) { |
| 1929 | musb->xceiv->io_dev = musb->controller; | ||
| 1911 | musb->xceiv->io_priv = musb->mregs; | 1930 | musb->xceiv->io_priv = musb->mregs; |
| 1912 | musb->xceiv->io_ops = &musb_ulpi_access; | 1931 | musb->xceiv->io_ops = &musb_ulpi_access; |
| 1913 | } | 1932 | } |
| 1914 | 1933 | ||
| 1934 | pm_runtime_get_sync(musb->controller); | ||
| 1935 | |||
| 1915 | #ifndef CONFIG_MUSB_PIO_ONLY | 1936 | #ifndef CONFIG_MUSB_PIO_ONLY |
| 1916 | if (use_dma && dev->dma_mask) { | 1937 | if (use_dma && dev->dma_mask) { |
| 1917 | struct dma_controller *c; | 1938 | struct dma_controller *c; |
| @@ -2023,6 +2044,8 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl) | |||
| 2023 | goto fail5; | 2044 | goto fail5; |
| 2024 | #endif | 2045 | #endif |
| 2025 | 2046 | ||
| 2047 | pm_runtime_put(musb->controller); | ||
| 2048 | |||
| 2026 | dev_info(dev, "USB %s mode controller at %p using %s, IRQ %d\n", | 2049 | dev_info(dev, "USB %s mode controller at %p using %s, IRQ %d\n", |
| 2027 | ({char *s; | 2050 | ({char *s; |
| 2028 | switch (musb->board_mode) { | 2051 | switch (musb->board_mode) { |
| @@ -2047,6 +2070,9 @@ fail4: | |||
| 2047 | musb_gadget_cleanup(musb); | 2070 | musb_gadget_cleanup(musb); |
| 2048 | 2071 | ||
| 2049 | fail3: | 2072 | fail3: |
| 2073 | pm_runtime_put_sync(musb->controller); | ||
| 2074 | |||
| 2075 | fail2: | ||
| 2050 | if (musb->irq_wake) | 2076 | if (musb->irq_wake) |
| 2051 | device_init_wakeup(dev, 0); | 2077 | device_init_wakeup(dev, 0); |
| 2052 | musb_platform_exit(musb); | 2078 | musb_platform_exit(musb); |
diff --git a/drivers/usb/musb/musb_core.h b/drivers/usb/musb/musb_core.h index 93de517a32a0..f4a40f001c88 100644 --- a/drivers/usb/musb/musb_core.h +++ b/drivers/usb/musb/musb_core.h | |||
| @@ -449,7 +449,7 @@ struct musb { | |||
| 449 | * We added this flag to forcefully disable double | 449 | * We added this flag to forcefully disable double |
| 450 | * buffering until we get it working. | 450 | * buffering until we get it working. |
| 451 | */ | 451 | */ |
| 452 | unsigned double_buffer_not_ok:1 __deprecated; | 452 | unsigned double_buffer_not_ok:1; |
| 453 | 453 | ||
| 454 | struct musb_hdrc_config *config; | 454 | struct musb_hdrc_config *config; |
| 455 | 455 | ||
diff --git a/drivers/usb/musb/musb_host.c b/drivers/usb/musb/musb_host.c index 79cb0af779fa..ef8d744800ac 100644 --- a/drivers/usb/musb/musb_host.c +++ b/drivers/usb/musb/musb_host.c | |||
| @@ -2098,7 +2098,7 @@ static int musb_cleanup_urb(struct urb *urb, struct musb_qh *qh) | |||
| 2098 | } | 2098 | } |
| 2099 | 2099 | ||
| 2100 | /* turn off DMA requests, discard state, stop polling ... */ | 2100 | /* turn off DMA requests, discard state, stop polling ... */ |
| 2101 | if (is_in) { | 2101 | if (ep->epnum && is_in) { |
| 2102 | /* giveback saves bulk toggle */ | 2102 | /* giveback saves bulk toggle */ |
| 2103 | csr = musb_h_flush_rxfifo(ep, 0); | 2103 | csr = musb_h_flush_rxfifo(ep, 0); |
| 2104 | 2104 | ||
diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c index 2ae0bb309994..c7785e81254c 100644 --- a/drivers/usb/musb/omap2430.c +++ b/drivers/usb/musb/omap2430.c | |||
| @@ -282,7 +282,8 @@ static void musb_otg_notifier_work(struct work_struct *data_notifier_work) | |||
| 282 | 282 | ||
| 283 | static int omap2430_musb_init(struct musb *musb) | 283 | static int omap2430_musb_init(struct musb *musb) |
| 284 | { | 284 | { |
| 285 | u32 l, status = 0; | 285 | u32 l; |
| 286 | int status = 0; | ||
| 286 | struct device *dev = musb->controller; | 287 | struct device *dev = musb->controller; |
| 287 | struct musb_hdrc_platform_data *plat = dev->platform_data; | 288 | struct musb_hdrc_platform_data *plat = dev->platform_data; |
| 288 | struct omap_musb_board_data *data = plat->board_data; | 289 | struct omap_musb_board_data *data = plat->board_data; |
| @@ -301,7 +302,7 @@ static int omap2430_musb_init(struct musb *musb) | |||
| 301 | 302 | ||
| 302 | status = pm_runtime_get_sync(dev); | 303 | status = pm_runtime_get_sync(dev); |
| 303 | if (status < 0) { | 304 | if (status < 0) { |
| 304 | dev_err(dev, "pm_runtime_get_sync FAILED"); | 305 | dev_err(dev, "pm_runtime_get_sync FAILED %d\n", status); |
| 305 | goto err1; | 306 | goto err1; |
| 306 | } | 307 | } |
| 307 | 308 | ||
| @@ -333,6 +334,7 @@ static int omap2430_musb_init(struct musb *musb) | |||
| 333 | 334 | ||
| 334 | setup_timer(&musb_idle_timer, musb_do_idle, (unsigned long) musb); | 335 | setup_timer(&musb_idle_timer, musb_do_idle, (unsigned long) musb); |
| 335 | 336 | ||
| 337 | pm_runtime_put_noidle(musb->controller); | ||
| 336 | return 0; | 338 | return 0; |
| 337 | 339 | ||
| 338 | err1: | 340 | err1: |
| @@ -452,14 +454,14 @@ static int __devinit omap2430_probe(struct platform_device *pdev) | |||
| 452 | goto err2; | 454 | goto err2; |
| 453 | } | 455 | } |
| 454 | 456 | ||
| 457 | pm_runtime_enable(&pdev->dev); | ||
| 458 | |||
| 455 | ret = platform_device_add(musb); | 459 | ret = platform_device_add(musb); |
| 456 | if (ret) { | 460 | if (ret) { |
| 457 | dev_err(&pdev->dev, "failed to register musb device\n"); | 461 | dev_err(&pdev->dev, "failed to register musb device\n"); |
| 458 | goto err2; | 462 | goto err2; |
| 459 | } | 463 | } |
| 460 | 464 | ||
| 461 | pm_runtime_enable(&pdev->dev); | ||
| 462 | |||
| 463 | return 0; | 465 | return 0; |
| 464 | 466 | ||
| 465 | err2: | 467 | err2: |
| @@ -478,7 +480,6 @@ static int __devexit omap2430_remove(struct platform_device *pdev) | |||
| 478 | 480 | ||
| 479 | platform_device_del(glue->musb); | 481 | platform_device_del(glue->musb); |
| 480 | platform_device_put(glue->musb); | 482 | platform_device_put(glue->musb); |
| 481 | pm_runtime_put(&pdev->dev); | ||
| 482 | kfree(glue); | 483 | kfree(glue); |
| 483 | 484 | ||
| 484 | return 0; | 485 | return 0; |
| @@ -491,11 +492,13 @@ static int omap2430_runtime_suspend(struct device *dev) | |||
| 491 | struct omap2430_glue *glue = dev_get_drvdata(dev); | 492 | struct omap2430_glue *glue = dev_get_drvdata(dev); |
| 492 | struct musb *musb = glue_to_musb(glue); | 493 | struct musb *musb = glue_to_musb(glue); |
| 493 | 494 | ||
| 494 | musb->context.otg_interfsel = musb_readl(musb->mregs, | 495 | if (musb) { |
| 495 | OTG_INTERFSEL); | 496 | musb->context.otg_interfsel = musb_readl(musb->mregs, |
| 497 | OTG_INTERFSEL); | ||
| 496 | 498 | ||
| 497 | omap2430_low_level_exit(musb); | 499 | omap2430_low_level_exit(musb); |
| 498 | usb_phy_set_suspend(musb->xceiv, 1); | 500 | usb_phy_set_suspend(musb->xceiv, 1); |
| 501 | } | ||
| 499 | 502 | ||
| 500 | return 0; | 503 | return 0; |
| 501 | } | 504 | } |
| @@ -505,11 +508,13 @@ static int omap2430_runtime_resume(struct device *dev) | |||
| 505 | struct omap2430_glue *glue = dev_get_drvdata(dev); | 508 | struct omap2430_glue *glue = dev_get_drvdata(dev); |
| 506 | struct musb *musb = glue_to_musb(glue); | 509 | struct musb *musb = glue_to_musb(glue); |
| 507 | 510 | ||
| 508 | omap2430_low_level_init(musb); | 511 | if (musb) { |
| 509 | musb_writel(musb->mregs, OTG_INTERFSEL, | 512 | omap2430_low_level_init(musb); |
| 510 | musb->context.otg_interfsel); | 513 | musb_writel(musb->mregs, OTG_INTERFSEL, |
| 514 | musb->context.otg_interfsel); | ||
| 511 | 515 | ||
| 512 | usb_phy_set_suspend(musb->xceiv, 0); | 516 | usb_phy_set_suspend(musb->xceiv, 0); |
| 517 | } | ||
| 513 | 518 | ||
| 514 | return 0; | 519 | return 0; |
| 515 | } | 520 | } |
diff --git a/drivers/usb/otg/gpio_vbus.c b/drivers/usb/otg/gpio_vbus.c index 3ece43a2e4c1..a0a2178974fe 100644 --- a/drivers/usb/otg/gpio_vbus.c +++ b/drivers/usb/otg/gpio_vbus.c | |||
| @@ -96,7 +96,7 @@ static void gpio_vbus_work(struct work_struct *work) | |||
| 96 | struct gpio_vbus_data *gpio_vbus = | 96 | struct gpio_vbus_data *gpio_vbus = |
| 97 | container_of(work, struct gpio_vbus_data, work); | 97 | container_of(work, struct gpio_vbus_data, work); |
| 98 | struct gpio_vbus_mach_info *pdata = gpio_vbus->dev->platform_data; | 98 | struct gpio_vbus_mach_info *pdata = gpio_vbus->dev->platform_data; |
| 99 | int gpio; | 99 | int gpio, status; |
| 100 | 100 | ||
| 101 | if (!gpio_vbus->phy.otg->gadget) | 101 | if (!gpio_vbus->phy.otg->gadget) |
| 102 | return; | 102 | return; |
| @@ -108,7 +108,9 @@ static void gpio_vbus_work(struct work_struct *work) | |||
| 108 | */ | 108 | */ |
| 109 | gpio = pdata->gpio_pullup; | 109 | gpio = pdata->gpio_pullup; |
| 110 | if (is_vbus_powered(pdata)) { | 110 | if (is_vbus_powered(pdata)) { |
| 111 | status = USB_EVENT_VBUS; | ||
| 111 | gpio_vbus->phy.state = OTG_STATE_B_PERIPHERAL; | 112 | gpio_vbus->phy.state = OTG_STATE_B_PERIPHERAL; |
| 113 | gpio_vbus->phy.last_event = status; | ||
| 112 | usb_gadget_vbus_connect(gpio_vbus->phy.otg->gadget); | 114 | usb_gadget_vbus_connect(gpio_vbus->phy.otg->gadget); |
| 113 | 115 | ||
| 114 | /* drawing a "unit load" is *always* OK, except for OTG */ | 116 | /* drawing a "unit load" is *always* OK, except for OTG */ |
| @@ -117,6 +119,9 @@ static void gpio_vbus_work(struct work_struct *work) | |||
| 117 | /* optionally enable D+ pullup */ | 119 | /* optionally enable D+ pullup */ |
| 118 | if (gpio_is_valid(gpio)) | 120 | if (gpio_is_valid(gpio)) |
| 119 | gpio_set_value(gpio, !pdata->gpio_pullup_inverted); | 121 | gpio_set_value(gpio, !pdata->gpio_pullup_inverted); |
| 122 | |||
| 123 | atomic_notifier_call_chain(&gpio_vbus->phy.notifier, | ||
| 124 | status, gpio_vbus->phy.otg->gadget); | ||
| 120 | } else { | 125 | } else { |
| 121 | /* optionally disable D+ pullup */ | 126 | /* optionally disable D+ pullup */ |
| 122 | if (gpio_is_valid(gpio)) | 127 | if (gpio_is_valid(gpio)) |
| @@ -125,7 +130,12 @@ static void gpio_vbus_work(struct work_struct *work) | |||
| 125 | set_vbus_draw(gpio_vbus, 0); | 130 | set_vbus_draw(gpio_vbus, 0); |
| 126 | 131 | ||
| 127 | usb_gadget_vbus_disconnect(gpio_vbus->phy.otg->gadget); | 132 | usb_gadget_vbus_disconnect(gpio_vbus->phy.otg->gadget); |
| 133 | status = USB_EVENT_NONE; | ||
| 128 | gpio_vbus->phy.state = OTG_STATE_B_IDLE; | 134 | gpio_vbus->phy.state = OTG_STATE_B_IDLE; |
| 135 | gpio_vbus->phy.last_event = status; | ||
| 136 | |||
| 137 | atomic_notifier_call_chain(&gpio_vbus->phy.notifier, | ||
| 138 | status, gpio_vbus->phy.otg->gadget); | ||
| 129 | } | 139 | } |
| 130 | } | 140 | } |
| 131 | 141 | ||
| @@ -287,6 +297,9 @@ static int __init gpio_vbus_probe(struct platform_device *pdev) | |||
| 287 | irq, err); | 297 | irq, err); |
| 288 | goto err_irq; | 298 | goto err_irq; |
| 289 | } | 299 | } |
| 300 | |||
| 301 | ATOMIC_INIT_NOTIFIER_HEAD(&gpio_vbus->phy.notifier); | ||
| 302 | |||
| 290 | INIT_WORK(&gpio_vbus->work, gpio_vbus_work); | 303 | INIT_WORK(&gpio_vbus->work, gpio_vbus_work); |
| 291 | 304 | ||
| 292 | gpio_vbus->vbus_draw = regulator_get(&pdev->dev, "vbus_draw"); | 305 | gpio_vbus->vbus_draw = regulator_get(&pdev->dev, "vbus_draw"); |
diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c index 0310e2df59f5..ec30f95ef399 100644 --- a/drivers/usb/serial/cp210x.c +++ b/drivers/usb/serial/cp210x.c | |||
| @@ -287,7 +287,8 @@ static int cp210x_get_config(struct usb_serial_port *port, u8 request, | |||
| 287 | /* Issue the request, attempting to read 'size' bytes */ | 287 | /* Issue the request, attempting to read 'size' bytes */ |
| 288 | result = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0), | 288 | result = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0), |
| 289 | request, REQTYPE_DEVICE_TO_HOST, 0x0000, | 289 | request, REQTYPE_DEVICE_TO_HOST, 0x0000, |
| 290 | port_priv->bInterfaceNumber, buf, size, 300); | 290 | port_priv->bInterfaceNumber, buf, size, |
| 291 | USB_CTRL_GET_TIMEOUT); | ||
| 291 | 292 | ||
| 292 | /* Convert data into an array of integers */ | 293 | /* Convert data into an array of integers */ |
| 293 | for (i = 0; i < length; i++) | 294 | for (i = 0; i < length; i++) |
| @@ -340,12 +341,14 @@ static int cp210x_set_config(struct usb_serial_port *port, u8 request, | |||
| 340 | result = usb_control_msg(serial->dev, | 341 | result = usb_control_msg(serial->dev, |
| 341 | usb_sndctrlpipe(serial->dev, 0), | 342 | usb_sndctrlpipe(serial->dev, 0), |
| 342 | request, REQTYPE_HOST_TO_DEVICE, 0x0000, | 343 | request, REQTYPE_HOST_TO_DEVICE, 0x0000, |
| 343 | port_priv->bInterfaceNumber, buf, size, 300); | 344 | port_priv->bInterfaceNumber, buf, size, |
| 345 | USB_CTRL_SET_TIMEOUT); | ||
| 344 | } else { | 346 | } else { |
| 345 | result = usb_control_msg(serial->dev, | 347 | result = usb_control_msg(serial->dev, |
| 346 | usb_sndctrlpipe(serial->dev, 0), | 348 | usb_sndctrlpipe(serial->dev, 0), |
| 347 | request, REQTYPE_HOST_TO_DEVICE, data[0], | 349 | request, REQTYPE_HOST_TO_DEVICE, data[0], |
| 348 | port_priv->bInterfaceNumber, NULL, 0, 300); | 350 | port_priv->bInterfaceNumber, NULL, 0, |
| 351 | USB_CTRL_SET_TIMEOUT); | ||
| 349 | } | 352 | } |
| 350 | 353 | ||
| 351 | kfree(buf); | 354 | kfree(buf); |
diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c index fdd5aa2c8d82..8c8bf806f6fa 100644 --- a/drivers/usb/serial/sierra.c +++ b/drivers/usb/serial/sierra.c | |||
| @@ -221,7 +221,7 @@ static const struct sierra_iface_info typeB_interface_list = { | |||
| 221 | }; | 221 | }; |
| 222 | 222 | ||
| 223 | /* 'blacklist' of interfaces not served by this driver */ | 223 | /* 'blacklist' of interfaces not served by this driver */ |
| 224 | static const u8 direct_ip_non_serial_ifaces[] = { 7, 8, 9, 10, 11 }; | 224 | static const u8 direct_ip_non_serial_ifaces[] = { 7, 8, 9, 10, 11, 19, 20 }; |
| 225 | static const struct sierra_iface_info direct_ip_interface_blacklist = { | 225 | static const struct sierra_iface_info direct_ip_interface_blacklist = { |
| 226 | .infolen = ARRAY_SIZE(direct_ip_non_serial_ifaces), | 226 | .infolen = ARRAY_SIZE(direct_ip_non_serial_ifaces), |
| 227 | .ifaceinfo = direct_ip_non_serial_ifaces, | 227 | .ifaceinfo = direct_ip_non_serial_ifaces, |
| @@ -289,7 +289,6 @@ static const struct usb_device_id id_table[] = { | |||
| 289 | { USB_DEVICE(0x1199, 0x6856) }, /* Sierra Wireless AirCard 881 U */ | 289 | { USB_DEVICE(0x1199, 0x6856) }, /* Sierra Wireless AirCard 881 U */ |
| 290 | { USB_DEVICE(0x1199, 0x6859) }, /* Sierra Wireless AirCard 885 E */ | 290 | { USB_DEVICE(0x1199, 0x6859) }, /* Sierra Wireless AirCard 885 E */ |
| 291 | { USB_DEVICE(0x1199, 0x685A) }, /* Sierra Wireless AirCard 885 E */ | 291 | { USB_DEVICE(0x1199, 0x685A) }, /* Sierra Wireless AirCard 885 E */ |
| 292 | { USB_DEVICE(0x1199, 0x68A2) }, /* Sierra Wireless MC7710 */ | ||
| 293 | /* Sierra Wireless C885 */ | 292 | /* Sierra Wireless C885 */ |
| 294 | { USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x6880, 0xFF, 0xFF, 0xFF)}, | 293 | { USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x6880, 0xFF, 0xFF, 0xFF)}, |
| 295 | /* Sierra Wireless C888, Air Card 501, USB 303, USB 304 */ | 294 | /* Sierra Wireless C888, Air Card 501, USB 303, USB 304 */ |
| @@ -299,6 +298,9 @@ static const struct usb_device_id id_table[] = { | |||
| 299 | /* Sierra Wireless HSPA Non-Composite Device */ | 298 | /* Sierra Wireless HSPA Non-Composite Device */ |
| 300 | { USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x6892, 0xFF, 0xFF, 0xFF)}, | 299 | { USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x6892, 0xFF, 0xFF, 0xFF)}, |
| 301 | { USB_DEVICE(0x1199, 0x6893) }, /* Sierra Wireless Device */ | 300 | { USB_DEVICE(0x1199, 0x6893) }, /* Sierra Wireless Device */ |
| 301 | { USB_DEVICE(0x1199, 0x68A2), /* Sierra Wireless MC77xx in QMI mode */ | ||
| 302 | .driver_info = (kernel_ulong_t)&direct_ip_interface_blacklist | ||
| 303 | }, | ||
| 302 | { USB_DEVICE(0x1199, 0x68A3), /* Sierra Wireless Direct IP modems */ | 304 | { USB_DEVICE(0x1199, 0x68A3), /* Sierra Wireless Direct IP modems */ |
| 303 | .driver_info = (kernel_ulong_t)&direct_ip_interface_blacklist | 305 | .driver_info = (kernel_ulong_t)&direct_ip_interface_blacklist |
| 304 | }, | 306 | }, |
diff --git a/drivers/uwb/hwa-rc.c b/drivers/uwb/hwa-rc.c index 66797e9c5010..810c90ae2c55 100644 --- a/drivers/uwb/hwa-rc.c +++ b/drivers/uwb/hwa-rc.c | |||
| @@ -645,7 +645,8 @@ void hwarc_neep_cb(struct urb *urb) | |||
| 645 | dev_err(dev, "NEEP: URB error %d\n", urb->status); | 645 | dev_err(dev, "NEEP: URB error %d\n", urb->status); |
| 646 | } | 646 | } |
| 647 | result = usb_submit_urb(urb, GFP_ATOMIC); | 647 | result = usb_submit_urb(urb, GFP_ATOMIC); |
| 648 | if (result < 0) { | 648 | if (result < 0 && result != -ENODEV && result != -EPERM) { |
| 649 | /* ignoring unrecoverable errors */ | ||
| 649 | dev_err(dev, "NEEP: Can't resubmit URB (%d) resetting device\n", | 650 | dev_err(dev, "NEEP: Can't resubmit URB (%d) resetting device\n", |
| 650 | result); | 651 | result); |
| 651 | goto error; | 652 | goto error; |
diff --git a/drivers/uwb/neh.c b/drivers/uwb/neh.c index a269937be1b8..8cb71bb333c2 100644 --- a/drivers/uwb/neh.c +++ b/drivers/uwb/neh.c | |||
| @@ -107,6 +107,7 @@ struct uwb_rc_neh { | |||
| 107 | u8 evt_type; | 107 | u8 evt_type; |
| 108 | __le16 evt; | 108 | __le16 evt; |
| 109 | u8 context; | 109 | u8 context; |
| 110 | u8 completed; | ||
| 110 | uwb_rc_cmd_cb_f cb; | 111 | uwb_rc_cmd_cb_f cb; |
| 111 | void *arg; | 112 | void *arg; |
| 112 | 113 | ||
| @@ -409,6 +410,7 @@ static void uwb_rc_neh_grok_event(struct uwb_rc *rc, struct uwb_rceb *rceb, size | |||
| 409 | struct device *dev = &rc->uwb_dev.dev; | 410 | struct device *dev = &rc->uwb_dev.dev; |
| 410 | struct uwb_rc_neh *neh; | 411 | struct uwb_rc_neh *neh; |
| 411 | struct uwb_rceb *notif; | 412 | struct uwb_rceb *notif; |
| 413 | unsigned long flags; | ||
| 412 | 414 | ||
| 413 | if (rceb->bEventContext == 0) { | 415 | if (rceb->bEventContext == 0) { |
| 414 | notif = kmalloc(size, GFP_ATOMIC); | 416 | notif = kmalloc(size, GFP_ATOMIC); |
| @@ -422,7 +424,11 @@ static void uwb_rc_neh_grok_event(struct uwb_rc *rc, struct uwb_rceb *rceb, size | |||
| 422 | } else { | 424 | } else { |
| 423 | neh = uwb_rc_neh_lookup(rc, rceb); | 425 | neh = uwb_rc_neh_lookup(rc, rceb); |
| 424 | if (neh) { | 426 | if (neh) { |
| 425 | del_timer_sync(&neh->timer); | 427 | spin_lock_irqsave(&rc->neh_lock, flags); |
| 428 | /* to guard against a timeout */ | ||
| 429 | neh->completed = 1; | ||
| 430 | del_timer(&neh->timer); | ||
| 431 | spin_unlock_irqrestore(&rc->neh_lock, flags); | ||
| 426 | uwb_rc_neh_cb(neh, rceb, size); | 432 | uwb_rc_neh_cb(neh, rceb, size); |
| 427 | } else | 433 | } else |
| 428 | dev_warn(dev, "event 0x%02x/%04x/%02x (%zu bytes): nobody cared\n", | 434 | dev_warn(dev, "event 0x%02x/%04x/%02x (%zu bytes): nobody cared\n", |
| @@ -568,6 +574,10 @@ static void uwb_rc_neh_timer(unsigned long arg) | |||
| 568 | unsigned long flags; | 574 | unsigned long flags; |
| 569 | 575 | ||
| 570 | spin_lock_irqsave(&rc->neh_lock, flags); | 576 | spin_lock_irqsave(&rc->neh_lock, flags); |
| 577 | if (neh->completed) { | ||
| 578 | spin_unlock_irqrestore(&rc->neh_lock, flags); | ||
| 579 | return; | ||
| 580 | } | ||
| 571 | if (neh->context) | 581 | if (neh->context) |
| 572 | __uwb_rc_neh_rm(rc, neh); | 582 | __uwb_rc_neh_rm(rc, neh); |
| 573 | else | 583 | else |
diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c index f0da2c32fbde..1f21d2a1e528 100644 --- a/drivers/vhost/net.c +++ b/drivers/vhost/net.c | |||
| @@ -238,7 +238,7 @@ static void handle_tx(struct vhost_net *net) | |||
| 238 | 238 | ||
| 239 | vq->heads[vq->upend_idx].len = len; | 239 | vq->heads[vq->upend_idx].len = len; |
| 240 | ubuf->callback = vhost_zerocopy_callback; | 240 | ubuf->callback = vhost_zerocopy_callback; |
| 241 | ubuf->arg = vq->ubufs; | 241 | ubuf->ctx = vq->ubufs; |
| 242 | ubuf->desc = vq->upend_idx; | 242 | ubuf->desc = vq->upend_idx; |
| 243 | msg.msg_control = ubuf; | 243 | msg.msg_control = ubuf; |
| 244 | msg.msg_controllen = sizeof(ubuf); | 244 | msg.msg_controllen = sizeof(ubuf); |
diff --git a/drivers/vhost/test.c b/drivers/vhost/test.c index fc9a1d75281f..3de00d9fae2e 100644 --- a/drivers/vhost/test.c +++ b/drivers/vhost/test.c | |||
| @@ -155,7 +155,7 @@ static int vhost_test_release(struct inode *inode, struct file *f) | |||
| 155 | 155 | ||
| 156 | vhost_test_stop(n, &private); | 156 | vhost_test_stop(n, &private); |
| 157 | vhost_test_flush(n); | 157 | vhost_test_flush(n); |
| 158 | vhost_dev_cleanup(&n->dev); | 158 | vhost_dev_cleanup(&n->dev, false); |
| 159 | /* We do an extra flush before freeing memory, | 159 | /* We do an extra flush before freeing memory, |
| 160 | * since jobs can re-queue themselves. */ | 160 | * since jobs can re-queue themselves. */ |
| 161 | vhost_test_flush(n); | 161 | vhost_test_flush(n); |
diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c index 947f00d8e091..51e4c1eeec4f 100644 --- a/drivers/vhost/vhost.c +++ b/drivers/vhost/vhost.c | |||
| @@ -1598,10 +1598,9 @@ void vhost_ubuf_put_and_wait(struct vhost_ubuf_ref *ubufs) | |||
| 1598 | kfree(ubufs); | 1598 | kfree(ubufs); |
| 1599 | } | 1599 | } |
| 1600 | 1600 | ||
| 1601 | void vhost_zerocopy_callback(void *arg) | 1601 | void vhost_zerocopy_callback(struct ubuf_info *ubuf) |
| 1602 | { | 1602 | { |
| 1603 | struct ubuf_info *ubuf = arg; | 1603 | struct vhost_ubuf_ref *ubufs = ubuf->ctx; |
| 1604 | struct vhost_ubuf_ref *ubufs = ubuf->arg; | ||
| 1605 | struct vhost_virtqueue *vq = ubufs->vq; | 1604 | struct vhost_virtqueue *vq = ubufs->vq; |
| 1606 | 1605 | ||
| 1607 | /* set len = 1 to mark this desc buffers done DMA */ | 1606 | /* set len = 1 to mark this desc buffers done DMA */ |
diff --git a/drivers/vhost/vhost.h b/drivers/vhost/vhost.h index 8dcf4cca6bf2..8de1fd5b8efb 100644 --- a/drivers/vhost/vhost.h +++ b/drivers/vhost/vhost.h | |||
| @@ -188,7 +188,7 @@ bool vhost_enable_notify(struct vhost_dev *, struct vhost_virtqueue *); | |||
| 188 | 188 | ||
| 189 | int vhost_log_write(struct vhost_virtqueue *vq, struct vhost_log *log, | 189 | int vhost_log_write(struct vhost_virtqueue *vq, struct vhost_log *log, |
| 190 | unsigned int log_num, u64 len); | 190 | unsigned int log_num, u64 len); |
| 191 | void vhost_zerocopy_callback(void *arg); | 191 | void vhost_zerocopy_callback(struct ubuf_info *); |
| 192 | int vhost_zerocopy_signal_used(struct vhost_virtqueue *vq); | 192 | int vhost_zerocopy_signal_used(struct vhost_virtqueue *vq); |
| 193 | 193 | ||
| 194 | #define vq_err(vq, fmt, ...) do { \ | 194 | #define vq_err(vq, fmt, ...) do { \ |
diff --git a/drivers/video/bfin-lq035q1-fb.c b/drivers/video/bfin-lq035q1-fb.c index 86922ac84412..353c02fe8a95 100644 --- a/drivers/video/bfin-lq035q1-fb.c +++ b/drivers/video/bfin-lq035q1-fb.c | |||
| @@ -13,6 +13,7 @@ | |||
| 13 | #include <linux/errno.h> | 13 | #include <linux/errno.h> |
| 14 | #include <linux/string.h> | 14 | #include <linux/string.h> |
| 15 | #include <linux/fb.h> | 15 | #include <linux/fb.h> |
| 16 | #include <linux/gpio.h> | ||
| 16 | #include <linux/slab.h> | 17 | #include <linux/slab.h> |
| 17 | #include <linux/init.h> | 18 | #include <linux/init.h> |
| 18 | #include <linux/types.h> | 19 | #include <linux/types.h> |
diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c index 05f0a80818a2..c2d05a8279fd 100644 --- a/drivers/virtio/virtio_balloon.c +++ b/drivers/virtio/virtio_balloon.c | |||
| @@ -28,6 +28,13 @@ | |||
| 28 | #include <linux/slab.h> | 28 | #include <linux/slab.h> |
| 29 | #include <linux/module.h> | 29 | #include <linux/module.h> |
| 30 | 30 | ||
| 31 | /* | ||
| 32 | * Balloon device works in 4K page units. So each page is pointed to by | ||
| 33 | * multiple balloon pages. All memory counters in this driver are in balloon | ||
| 34 | * page units. | ||
| 35 | */ | ||
| 36 | #define VIRTIO_BALLOON_PAGES_PER_PAGE (PAGE_SIZE >> VIRTIO_BALLOON_PFN_SHIFT) | ||
| 37 | |||
| 31 | struct virtio_balloon | 38 | struct virtio_balloon |
| 32 | { | 39 | { |
| 33 | struct virtio_device *vdev; | 40 | struct virtio_device *vdev; |
| @@ -42,8 +49,13 @@ struct virtio_balloon | |||
| 42 | /* Waiting for host to ack the pages we released. */ | 49 | /* Waiting for host to ack the pages we released. */ |
| 43 | struct completion acked; | 50 | struct completion acked; |
| 44 | 51 | ||
| 45 | /* The pages we've told the Host we're not using. */ | 52 | /* Number of balloon pages we've told the Host we're not using. */ |
| 46 | unsigned int num_pages; | 53 | unsigned int num_pages; |
| 54 | /* | ||
| 55 | * The pages we've told the Host we're not using. | ||
| 56 | * Each page on this list adds VIRTIO_BALLOON_PAGES_PER_PAGE | ||
| 57 | * to num_pages above. | ||
| 58 | */ | ||
| 47 | struct list_head pages; | 59 | struct list_head pages; |
| 48 | 60 | ||
| 49 | /* The array of pfns we tell the Host about. */ | 61 | /* The array of pfns we tell the Host about. */ |
| @@ -66,7 +78,13 @@ static u32 page_to_balloon_pfn(struct page *page) | |||
| 66 | 78 | ||
| 67 | BUILD_BUG_ON(PAGE_SHIFT < VIRTIO_BALLOON_PFN_SHIFT); | 79 | BUILD_BUG_ON(PAGE_SHIFT < VIRTIO_BALLOON_PFN_SHIFT); |
| 68 | /* Convert pfn from Linux page size to balloon page size. */ | 80 | /* Convert pfn from Linux page size to balloon page size. */ |
| 69 | return pfn >> (PAGE_SHIFT - VIRTIO_BALLOON_PFN_SHIFT); | 81 | return pfn * VIRTIO_BALLOON_PAGES_PER_PAGE; |
| 82 | } | ||
| 83 | |||
| 84 | static struct page *balloon_pfn_to_page(u32 pfn) | ||
| 85 | { | ||
| 86 | BUG_ON(pfn % VIRTIO_BALLOON_PAGES_PER_PAGE); | ||
| 87 | return pfn_to_page(pfn / VIRTIO_BALLOON_PAGES_PER_PAGE); | ||
| 70 | } | 88 | } |
| 71 | 89 | ||
| 72 | static void balloon_ack(struct virtqueue *vq) | 90 | static void balloon_ack(struct virtqueue *vq) |
| @@ -96,12 +114,23 @@ static void tell_host(struct virtio_balloon *vb, struct virtqueue *vq) | |||
| 96 | wait_for_completion(&vb->acked); | 114 | wait_for_completion(&vb->acked); |
| 97 | } | 115 | } |
| 98 | 116 | ||
| 117 | static void set_page_pfns(u32 pfns[], struct page *page) | ||
| 118 | { | ||
| 119 | unsigned int i; | ||
| 120 | |||
| 121 | /* Set balloon pfns pointing at this page. | ||
| 122 | * Note that the first pfn points at start of the page. */ | ||
| 123 | for (i = 0; i < VIRTIO_BALLOON_PAGES_PER_PAGE; i++) | ||
| 124 | pfns[i] = page_to_balloon_pfn(page) + i; | ||
| 125 | } | ||
| 126 | |||
| 99 | static void fill_balloon(struct virtio_balloon *vb, size_t num) | 127 | static void fill_balloon(struct virtio_balloon *vb, size_t num) |
| 100 | { | 128 | { |
| 101 | /* We can only do one array worth at a time. */ | 129 | /* We can only do one array worth at a time. */ |
| 102 | num = min(num, ARRAY_SIZE(vb->pfns)); | 130 | num = min(num, ARRAY_SIZE(vb->pfns)); |
| 103 | 131 | ||
| 104 | for (vb->num_pfns = 0; vb->num_pfns < num; vb->num_pfns++) { | 132 | for (vb->num_pfns = 0; vb->num_pfns < num; |
| 133 | vb->num_pfns += VIRTIO_BALLOON_PAGES_PER_PAGE) { | ||
| 105 | struct page *page = alloc_page(GFP_HIGHUSER | __GFP_NORETRY | | 134 | struct page *page = alloc_page(GFP_HIGHUSER | __GFP_NORETRY | |
| 106 | __GFP_NOMEMALLOC | __GFP_NOWARN); | 135 | __GFP_NOMEMALLOC | __GFP_NOWARN); |
| 107 | if (!page) { | 136 | if (!page) { |
| @@ -113,9 +142,9 @@ static void fill_balloon(struct virtio_balloon *vb, size_t num) | |||
| 113 | msleep(200); | 142 | msleep(200); |
| 114 | break; | 143 | break; |
| 115 | } | 144 | } |
| 116 | vb->pfns[vb->num_pfns] = page_to_balloon_pfn(page); | 145 | set_page_pfns(vb->pfns + vb->num_pfns, page); |
| 146 | vb->num_pages += VIRTIO_BALLOON_PAGES_PER_PAGE; | ||
| 117 | totalram_pages--; | 147 | totalram_pages--; |
| 118 | vb->num_pages++; | ||
| 119 | list_add(&page->lru, &vb->pages); | 148 | list_add(&page->lru, &vb->pages); |
| 120 | } | 149 | } |
| 121 | 150 | ||
| @@ -130,8 +159,9 @@ static void release_pages_by_pfn(const u32 pfns[], unsigned int num) | |||
| 130 | { | 159 | { |
| 131 | unsigned int i; | 160 | unsigned int i; |
| 132 | 161 | ||
| 133 | for (i = 0; i < num; i++) { | 162 | /* Find pfns pointing at start of each page, get pages and free them. */ |
| 134 | __free_page(pfn_to_page(pfns[i])); | 163 | for (i = 0; i < num; i += VIRTIO_BALLOON_PAGES_PER_PAGE) { |
| 164 | __free_page(balloon_pfn_to_page(pfns[i])); | ||
| 135 | totalram_pages++; | 165 | totalram_pages++; |
| 136 | } | 166 | } |
| 137 | } | 167 | } |
| @@ -143,11 +173,12 @@ static void leak_balloon(struct virtio_balloon *vb, size_t num) | |||
| 143 | /* We can only do one array worth at a time. */ | 173 | /* We can only do one array worth at a time. */ |
| 144 | num = min(num, ARRAY_SIZE(vb->pfns)); | 174 | num = min(num, ARRAY_SIZE(vb->pfns)); |
| 145 | 175 | ||
| 146 | for (vb->num_pfns = 0; vb->num_pfns < num; vb->num_pfns++) { | 176 | for (vb->num_pfns = 0; vb->num_pfns < num; |
| 177 | vb->num_pfns += VIRTIO_BALLOON_PAGES_PER_PAGE) { | ||
| 147 | page = list_first_entry(&vb->pages, struct page, lru); | 178 | page = list_first_entry(&vb->pages, struct page, lru); |
| 148 | list_del(&page->lru); | 179 | list_del(&page->lru); |
| 149 | vb->pfns[vb->num_pfns] = page_to_balloon_pfn(page); | 180 | set_page_pfns(vb->pfns + vb->num_pfns, page); |
| 150 | vb->num_pages--; | 181 | vb->num_pages -= VIRTIO_BALLOON_PAGES_PER_PAGE; |
| 151 | } | 182 | } |
| 152 | 183 | ||
| 153 | /* | 184 | /* |
| @@ -234,11 +265,14 @@ static void virtballoon_changed(struct virtio_device *vdev) | |||
| 234 | 265 | ||
| 235 | static inline s64 towards_target(struct virtio_balloon *vb) | 266 | static inline s64 towards_target(struct virtio_balloon *vb) |
| 236 | { | 267 | { |
| 237 | u32 v; | 268 | __le32 v; |
| 269 | s64 target; | ||
| 270 | |||
| 238 | vb->vdev->config->get(vb->vdev, | 271 | vb->vdev->config->get(vb->vdev, |
| 239 | offsetof(struct virtio_balloon_config, num_pages), | 272 | offsetof(struct virtio_balloon_config, num_pages), |
| 240 | &v, sizeof(v)); | 273 | &v, sizeof(v)); |
| 241 | return (s64)v - vb->num_pages; | 274 | target = le32_to_cpu(v); |
| 275 | return target - vb->num_pages; | ||
| 242 | } | 276 | } |
| 243 | 277 | ||
| 244 | static void update_balloon_size(struct virtio_balloon *vb) | 278 | static void update_balloon_size(struct virtio_balloon *vb) |
diff --git a/drivers/watchdog/hpwdt.c b/drivers/watchdog/hpwdt.c index cbc7ceef2786..9f13b897fd64 100644 --- a/drivers/watchdog/hpwdt.c +++ b/drivers/watchdog/hpwdt.c | |||
| @@ -435,16 +435,16 @@ static void hpwdt_start(void) | |||
| 435 | { | 435 | { |
| 436 | reload = SECS_TO_TICKS(soft_margin); | 436 | reload = SECS_TO_TICKS(soft_margin); |
| 437 | iowrite16(reload, hpwdt_timer_reg); | 437 | iowrite16(reload, hpwdt_timer_reg); |
| 438 | iowrite16(0x85, hpwdt_timer_con); | 438 | iowrite8(0x85, hpwdt_timer_con); |
| 439 | } | 439 | } |
| 440 | 440 | ||
| 441 | static void hpwdt_stop(void) | 441 | static void hpwdt_stop(void) |
| 442 | { | 442 | { |
| 443 | unsigned long data; | 443 | unsigned long data; |
| 444 | 444 | ||
| 445 | data = ioread16(hpwdt_timer_con); | 445 | data = ioread8(hpwdt_timer_con); |
| 446 | data &= 0xFE; | 446 | data &= 0xFE; |
| 447 | iowrite16(data, hpwdt_timer_con); | 447 | iowrite8(data, hpwdt_timer_con); |
| 448 | } | 448 | } |
| 449 | 449 | ||
| 450 | static void hpwdt_ping(void) | 450 | static void hpwdt_ping(void) |
diff --git a/drivers/xen/events.c b/drivers/xen/events.c index 4b33acd8ed4e..0a8a17cd80be 100644 --- a/drivers/xen/events.c +++ b/drivers/xen/events.c | |||
| @@ -274,7 +274,7 @@ static unsigned int cpu_from_evtchn(unsigned int evtchn) | |||
| 274 | 274 | ||
| 275 | static bool pirq_check_eoi_map(unsigned irq) | 275 | static bool pirq_check_eoi_map(unsigned irq) |
| 276 | { | 276 | { |
| 277 | return test_bit(irq, pirq_eoi_map); | 277 | return test_bit(pirq_from_irq(irq), pirq_eoi_map); |
| 278 | } | 278 | } |
| 279 | 279 | ||
| 280 | static bool pirq_needs_eoi_flag(unsigned irq) | 280 | static bool pirq_needs_eoi_flag(unsigned irq) |
diff --git a/drivers/xen/gntdev.c b/drivers/xen/gntdev.c index 99d8151c824a..1ffd03bf8e10 100644 --- a/drivers/xen/gntdev.c +++ b/drivers/xen/gntdev.c | |||
| @@ -722,7 +722,7 @@ static int gntdev_mmap(struct file *flip, struct vm_area_struct *vma) | |||
| 722 | vma->vm_flags |= VM_RESERVED|VM_DONTEXPAND; | 722 | vma->vm_flags |= VM_RESERVED|VM_DONTEXPAND; |
| 723 | 723 | ||
| 724 | if (use_ptemod) | 724 | if (use_ptemod) |
| 725 | vma->vm_flags |= VM_DONTCOPY|VM_PFNMAP; | 725 | vma->vm_flags |= VM_DONTCOPY; |
| 726 | 726 | ||
| 727 | vma->vm_private_data = map; | 727 | vma->vm_private_data = map; |
| 728 | 728 | ||
diff --git a/drivers/xen/grant-table.c b/drivers/xen/grant-table.c index b4d4eac761db..f100ce20b16b 100644 --- a/drivers/xen/grant-table.c +++ b/drivers/xen/grant-table.c | |||
| @@ -1029,6 +1029,7 @@ int gnttab_init(void) | |||
| 1029 | int i; | 1029 | int i; |
| 1030 | unsigned int max_nr_glist_frames, nr_glist_frames; | 1030 | unsigned int max_nr_glist_frames, nr_glist_frames; |
| 1031 | unsigned int nr_init_grefs; | 1031 | unsigned int nr_init_grefs; |
| 1032 | int ret; | ||
| 1032 | 1033 | ||
| 1033 | nr_grant_frames = 1; | 1034 | nr_grant_frames = 1; |
| 1034 | boot_max_nr_grant_frames = __max_nr_grant_frames(); | 1035 | boot_max_nr_grant_frames = __max_nr_grant_frames(); |
| @@ -1047,12 +1048,16 @@ int gnttab_init(void) | |||
| 1047 | nr_glist_frames = (nr_grant_frames * GREFS_PER_GRANT_FRAME + RPP - 1) / RPP; | 1048 | nr_glist_frames = (nr_grant_frames * GREFS_PER_GRANT_FRAME + RPP - 1) / RPP; |
| 1048 | for (i = 0; i < nr_glist_frames; i++) { | 1049 | for (i = 0; i < nr_glist_frames; i++) { |
| 1049 | gnttab_list[i] = (grant_ref_t *)__get_free_page(GFP_KERNEL); | 1050 | gnttab_list[i] = (grant_ref_t *)__get_free_page(GFP_KERNEL); |
| 1050 | if (gnttab_list[i] == NULL) | 1051 | if (gnttab_list[i] == NULL) { |
| 1052 | ret = -ENOMEM; | ||
| 1051 | goto ini_nomem; | 1053 | goto ini_nomem; |
| 1054 | } | ||
| 1052 | } | 1055 | } |
| 1053 | 1056 | ||
| 1054 | if (gnttab_resume() < 0) | 1057 | if (gnttab_resume() < 0) { |
| 1055 | return -ENODEV; | 1058 | ret = -ENODEV; |
| 1059 | goto ini_nomem; | ||
| 1060 | } | ||
| 1056 | 1061 | ||
| 1057 | nr_init_grefs = nr_grant_frames * GREFS_PER_GRANT_FRAME; | 1062 | nr_init_grefs = nr_grant_frames * GREFS_PER_GRANT_FRAME; |
| 1058 | 1063 | ||
| @@ -1070,7 +1075,7 @@ int gnttab_init(void) | |||
| 1070 | for (i--; i >= 0; i--) | 1075 | for (i--; i >= 0; i--) |
| 1071 | free_page((unsigned long)gnttab_list[i]); | 1076 | free_page((unsigned long)gnttab_list[i]); |
| 1072 | kfree(gnttab_list); | 1077 | kfree(gnttab_list); |
| 1073 | return -ENOMEM; | 1078 | return ret; |
| 1074 | } | 1079 | } |
| 1075 | EXPORT_SYMBOL_GPL(gnttab_init); | 1080 | EXPORT_SYMBOL_GPL(gnttab_init); |
| 1076 | 1081 | ||
diff --git a/drivers/xen/manage.c b/drivers/xen/manage.c index 9e14ae6cd49c..412b96cc5305 100644 --- a/drivers/xen/manage.c +++ b/drivers/xen/manage.c | |||
| @@ -132,6 +132,7 @@ static void do_suspend(void) | |||
| 132 | err = dpm_suspend_end(PMSG_FREEZE); | 132 | err = dpm_suspend_end(PMSG_FREEZE); |
| 133 | if (err) { | 133 | if (err) { |
| 134 | printk(KERN_ERR "dpm_suspend_end failed: %d\n", err); | 134 | printk(KERN_ERR "dpm_suspend_end failed: %d\n", err); |
| 135 | si.cancelled = 0; | ||
| 135 | goto out_resume; | 136 | goto out_resume; |
| 136 | } | 137 | } |
| 137 | 138 | ||
diff --git a/drivers/xen/xen-acpi-processor.c b/drivers/xen/xen-acpi-processor.c index 174b5653cd8a..0b48579a9cd6 100644 --- a/drivers/xen/xen-acpi-processor.c +++ b/drivers/xen/xen-acpi-processor.c | |||
| @@ -128,7 +128,10 @@ static int push_cxx_to_hypervisor(struct acpi_processor *_pr) | |||
| 128 | pr_debug(" C%d: %s %d uS\n", | 128 | pr_debug(" C%d: %s %d uS\n", |
| 129 | cx->type, cx->desc, (u32)cx->latency); | 129 | cx->type, cx->desc, (u32)cx->latency); |
| 130 | } | 130 | } |
| 131 | } else | 131 | } else if (ret != -EINVAL) |
| 132 | /* EINVAL means the ACPI ID is incorrect - meaning the ACPI | ||
| 133 | * table is referencing a non-existing CPU - which can happen | ||
| 134 | * with broken ACPI tables. */ | ||
| 132 | pr_err(DRV_NAME "(CX): Hypervisor error (%d) for ACPI CPU%u\n", | 135 | pr_err(DRV_NAME "(CX): Hypervisor error (%d) for ACPI CPU%u\n", |
| 133 | ret, _pr->acpi_id); | 136 | ret, _pr->acpi_id); |
| 134 | 137 | ||
diff --git a/drivers/xen/xenbus/xenbus_probe_frontend.c b/drivers/xen/xenbus/xenbus_probe_frontend.c index f20c5f178b40..a31b54d48839 100644 --- a/drivers/xen/xenbus/xenbus_probe_frontend.c +++ b/drivers/xen/xenbus/xenbus_probe_frontend.c | |||
| @@ -135,7 +135,7 @@ static int read_backend_details(struct xenbus_device *xendev) | |||
| 135 | return xenbus_read_otherend_details(xendev, "backend-id", "backend"); | 135 | return xenbus_read_otherend_details(xendev, "backend-id", "backend"); |
| 136 | } | 136 | } |
| 137 | 137 | ||
| 138 | static int is_device_connecting(struct device *dev, void *data) | 138 | static int is_device_connecting(struct device *dev, void *data, bool ignore_nonessential) |
| 139 | { | 139 | { |
| 140 | struct xenbus_device *xendev = to_xenbus_device(dev); | 140 | struct xenbus_device *xendev = to_xenbus_device(dev); |
| 141 | struct device_driver *drv = data; | 141 | struct device_driver *drv = data; |
| @@ -152,16 +152,41 @@ static int is_device_connecting(struct device *dev, void *data) | |||
| 152 | if (drv && (dev->driver != drv)) | 152 | if (drv && (dev->driver != drv)) |
| 153 | return 0; | 153 | return 0; |
| 154 | 154 | ||
| 155 | if (ignore_nonessential) { | ||
| 156 | /* With older QEMU, for PVonHVM guests the guest config files | ||
| 157 | * could contain: vfb = [ 'vnc=1, vnclisten=0.0.0.0'] | ||
| 158 | * which is nonsensical as there is no PV FB (there can be | ||
| 159 | * a PVKB) running as HVM guest. */ | ||
| 160 | |||
| 161 | if ((strncmp(xendev->nodename, "device/vkbd", 11) == 0)) | ||
| 162 | return 0; | ||
| 163 | |||
| 164 | if ((strncmp(xendev->nodename, "device/vfb", 10) == 0)) | ||
| 165 | return 0; | ||
| 166 | } | ||
| 155 | xendrv = to_xenbus_driver(dev->driver); | 167 | xendrv = to_xenbus_driver(dev->driver); |
| 156 | return (xendev->state < XenbusStateConnected || | 168 | return (xendev->state < XenbusStateConnected || |
| 157 | (xendev->state == XenbusStateConnected && | 169 | (xendev->state == XenbusStateConnected && |
| 158 | xendrv->is_ready && !xendrv->is_ready(xendev))); | 170 | xendrv->is_ready && !xendrv->is_ready(xendev))); |
| 159 | } | 171 | } |
| 172 | static int essential_device_connecting(struct device *dev, void *data) | ||
| 173 | { | ||
| 174 | return is_device_connecting(dev, data, true /* ignore PV[KBB+FB] */); | ||
| 175 | } | ||
| 176 | static int non_essential_device_connecting(struct device *dev, void *data) | ||
| 177 | { | ||
| 178 | return is_device_connecting(dev, data, false); | ||
| 179 | } | ||
| 160 | 180 | ||
| 161 | static int exists_connecting_device(struct device_driver *drv) | 181 | static int exists_essential_connecting_device(struct device_driver *drv) |
| 162 | { | 182 | { |
| 163 | return bus_for_each_dev(&xenbus_frontend.bus, NULL, drv, | 183 | return bus_for_each_dev(&xenbus_frontend.bus, NULL, drv, |
| 164 | is_device_connecting); | 184 | essential_device_connecting); |
| 185 | } | ||
| 186 | static int exists_non_essential_connecting_device(struct device_driver *drv) | ||
| 187 | { | ||
| 188 | return bus_for_each_dev(&xenbus_frontend.bus, NULL, drv, | ||
| 189 | non_essential_device_connecting); | ||
| 165 | } | 190 | } |
| 166 | 191 | ||
| 167 | static int print_device_status(struct device *dev, void *data) | 192 | static int print_device_status(struct device *dev, void *data) |
| @@ -192,6 +217,23 @@ static int print_device_status(struct device *dev, void *data) | |||
| 192 | /* We only wait for device setup after most initcalls have run. */ | 217 | /* We only wait for device setup after most initcalls have run. */ |
| 193 | static int ready_to_wait_for_devices; | 218 | static int ready_to_wait_for_devices; |
| 194 | 219 | ||
| 220 | static bool wait_loop(unsigned long start, unsigned int max_delay, | ||
| 221 | unsigned int *seconds_waited) | ||
| 222 | { | ||
| 223 | if (time_after(jiffies, start + (*seconds_waited+5)*HZ)) { | ||
| 224 | if (!*seconds_waited) | ||
| 225 | printk(KERN_WARNING "XENBUS: Waiting for " | ||
| 226 | "devices to initialise: "); | ||
| 227 | *seconds_waited += 5; | ||
| 228 | printk("%us...", max_delay - *seconds_waited); | ||
| 229 | if (*seconds_waited == max_delay) | ||
| 230 | return true; | ||
| 231 | } | ||
| 232 | |||
| 233 | schedule_timeout_interruptible(HZ/10); | ||
| 234 | |||
| 235 | return false; | ||
| 236 | } | ||
| 195 | /* | 237 | /* |
| 196 | * On a 5-minute timeout, wait for all devices currently configured. We need | 238 | * On a 5-minute timeout, wait for all devices currently configured. We need |
| 197 | * to do this to guarantee that the filesystems and / or network devices | 239 | * to do this to guarantee that the filesystems and / or network devices |
| @@ -215,19 +257,14 @@ static void wait_for_devices(struct xenbus_driver *xendrv) | |||
| 215 | if (!ready_to_wait_for_devices || !xen_domain()) | 257 | if (!ready_to_wait_for_devices || !xen_domain()) |
| 216 | return; | 258 | return; |
| 217 | 259 | ||
| 218 | while (exists_connecting_device(drv)) { | 260 | while (exists_non_essential_connecting_device(drv)) |
| 219 | if (time_after(jiffies, start + (seconds_waited+5)*HZ)) { | 261 | if (wait_loop(start, 30, &seconds_waited)) |
| 220 | if (!seconds_waited) | 262 | break; |
| 221 | printk(KERN_WARNING "XENBUS: Waiting for " | 263 | |
| 222 | "devices to initialise: "); | 264 | /* Skips PVKB and PVFB check.*/ |
| 223 | seconds_waited += 5; | 265 | while (exists_essential_connecting_device(drv)) |
| 224 | printk("%us...", 300 - seconds_waited); | 266 | if (wait_loop(start, 270, &seconds_waited)) |
| 225 | if (seconds_waited == 300) | 267 | break; |
| 226 | break; | ||
| 227 | } | ||
| 228 | |||
| 229 | schedule_timeout_interruptible(HZ/10); | ||
| 230 | } | ||
| 231 | 268 | ||
| 232 | if (seconds_waited) | 269 | if (seconds_waited) |
| 233 | printk("\n"); | 270 | printk("\n"); |
| @@ -93,9 +93,8 @@ static void aio_free_ring(struct kioctx *ctx) | |||
| 93 | put_page(info->ring_pages[i]); | 93 | put_page(info->ring_pages[i]); |
| 94 | 94 | ||
| 95 | if (info->mmap_size) { | 95 | if (info->mmap_size) { |
| 96 | down_write(&ctx->mm->mmap_sem); | 96 | BUG_ON(ctx->mm != current->mm); |
| 97 | do_munmap(ctx->mm, info->mmap_base, info->mmap_size); | 97 | vm_munmap(info->mmap_base, info->mmap_size); |
| 98 | up_write(&ctx->mm->mmap_sem); | ||
| 99 | } | 98 | } |
| 100 | 99 | ||
| 101 | if (info->ring_pages && info->ring_pages != info->internal_pages) | 100 | if (info->ring_pages && info->ring_pages != info->internal_pages) |
| @@ -389,6 +388,17 @@ void exit_aio(struct mm_struct *mm) | |||
| 389 | "exit_aio:ioctx still alive: %d %d %d\n", | 388 | "exit_aio:ioctx still alive: %d %d %d\n", |
| 390 | atomic_read(&ctx->users), ctx->dead, | 389 | atomic_read(&ctx->users), ctx->dead, |
| 391 | ctx->reqs_active); | 390 | ctx->reqs_active); |
| 391 | /* | ||
| 392 | * We don't need to bother with munmap() here - | ||
| 393 | * exit_mmap(mm) is coming and it'll unmap everything. | ||
| 394 | * Since aio_free_ring() uses non-zero ->mmap_size | ||
| 395 | * as indicator that it needs to unmap the area, | ||
| 396 | * just set it to 0; aio_free_ring() is the only | ||
| 397 | * place that uses ->mmap_size, so it's safe. | ||
| 398 | * That way we get all munmap done to current->mm - | ||
| 399 | * all other callers have ctx->mm == current->mm. | ||
| 400 | */ | ||
| 401 | ctx->ring_info.mmap_size = 0; | ||
| 392 | put_ioctx(ctx); | 402 | put_ioctx(ctx); |
| 393 | } | 403 | } |
| 394 | } | 404 | } |
diff --git a/fs/autofs4/autofs_i.h b/fs/autofs4/autofs_i.h index eb1cc92cd67d..908e18455413 100644 --- a/fs/autofs4/autofs_i.h +++ b/fs/autofs4/autofs_i.h | |||
| @@ -110,7 +110,6 @@ struct autofs_sb_info { | |||
| 110 | int sub_version; | 110 | int sub_version; |
| 111 | int min_proto; | 111 | int min_proto; |
| 112 | int max_proto; | 112 | int max_proto; |
| 113 | int compat_daemon; | ||
| 114 | unsigned long exp_timeout; | 113 | unsigned long exp_timeout; |
| 115 | unsigned int type; | 114 | unsigned int type; |
| 116 | int reghost_enabled; | 115 | int reghost_enabled; |
| @@ -270,6 +269,17 @@ int autofs4_fill_super(struct super_block *, void *, int); | |||
| 270 | struct autofs_info *autofs4_new_ino(struct autofs_sb_info *); | 269 | struct autofs_info *autofs4_new_ino(struct autofs_sb_info *); |
| 271 | void autofs4_clean_ino(struct autofs_info *); | 270 | void autofs4_clean_ino(struct autofs_info *); |
| 272 | 271 | ||
| 272 | static inline int autofs_prepare_pipe(struct file *pipe) | ||
| 273 | { | ||
| 274 | if (!pipe->f_op || !pipe->f_op->write) | ||
| 275 | return -EINVAL; | ||
| 276 | if (!S_ISFIFO(pipe->f_dentry->d_inode->i_mode)) | ||
| 277 | return -EINVAL; | ||
| 278 | /* We want a packet pipe */ | ||
| 279 | pipe->f_flags |= O_DIRECT; | ||
| 280 | return 0; | ||
| 281 | } | ||
| 282 | |||
| 273 | /* Queue management functions */ | 283 | /* Queue management functions */ |
| 274 | 284 | ||
| 275 | int autofs4_wait(struct autofs_sb_info *,struct dentry *, enum autofs_notify); | 285 | int autofs4_wait(struct autofs_sb_info *,struct dentry *, enum autofs_notify); |
diff --git a/fs/autofs4/dev-ioctl.c b/fs/autofs4/dev-ioctl.c index 9dacb8586701..aa9103f8f01b 100644 --- a/fs/autofs4/dev-ioctl.c +++ b/fs/autofs4/dev-ioctl.c | |||
| @@ -376,7 +376,7 @@ static int autofs_dev_ioctl_setpipefd(struct file *fp, | |||
| 376 | err = -EBADF; | 376 | err = -EBADF; |
| 377 | goto out; | 377 | goto out; |
| 378 | } | 378 | } |
| 379 | if (!pipe->f_op || !pipe->f_op->write) { | 379 | if (autofs_prepare_pipe(pipe) < 0) { |
| 380 | err = -EPIPE; | 380 | err = -EPIPE; |
| 381 | fput(pipe); | 381 | fput(pipe); |
| 382 | goto out; | 382 | goto out; |
| @@ -385,7 +385,6 @@ static int autofs_dev_ioctl_setpipefd(struct file *fp, | |||
| 385 | sbi->pipefd = pipefd; | 385 | sbi->pipefd = pipefd; |
| 386 | sbi->pipe = pipe; | 386 | sbi->pipe = pipe; |
| 387 | sbi->catatonic = 0; | 387 | sbi->catatonic = 0; |
| 388 | sbi->compat_daemon = is_compat_task(); | ||
| 389 | } | 388 | } |
| 390 | out: | 389 | out: |
| 391 | mutex_unlock(&sbi->wq_mutex); | 390 | mutex_unlock(&sbi->wq_mutex); |
diff --git a/fs/autofs4/inode.c b/fs/autofs4/inode.c index d8dc002e9cc3..6e488ebe7784 100644 --- a/fs/autofs4/inode.c +++ b/fs/autofs4/inode.c | |||
| @@ -19,7 +19,6 @@ | |||
| 19 | #include <linux/parser.h> | 19 | #include <linux/parser.h> |
| 20 | #include <linux/bitops.h> | 20 | #include <linux/bitops.h> |
| 21 | #include <linux/magic.h> | 21 | #include <linux/magic.h> |
| 22 | #include <linux/compat.h> | ||
| 23 | #include "autofs_i.h" | 22 | #include "autofs_i.h" |
| 24 | #include <linux/module.h> | 23 | #include <linux/module.h> |
| 25 | 24 | ||
| @@ -225,7 +224,6 @@ int autofs4_fill_super(struct super_block *s, void *data, int silent) | |||
| 225 | set_autofs_type_indirect(&sbi->type); | 224 | set_autofs_type_indirect(&sbi->type); |
| 226 | sbi->min_proto = 0; | 225 | sbi->min_proto = 0; |
| 227 | sbi->max_proto = 0; | 226 | sbi->max_proto = 0; |
| 228 | sbi->compat_daemon = is_compat_task(); | ||
| 229 | mutex_init(&sbi->wq_mutex); | 227 | mutex_init(&sbi->wq_mutex); |
| 230 | mutex_init(&sbi->pipe_mutex); | 228 | mutex_init(&sbi->pipe_mutex); |
| 231 | spin_lock_init(&sbi->fs_lock); | 229 | spin_lock_init(&sbi->fs_lock); |
| @@ -292,7 +290,7 @@ int autofs4_fill_super(struct super_block *s, void *data, int silent) | |||
| 292 | printk("autofs: could not open pipe file descriptor\n"); | 290 | printk("autofs: could not open pipe file descriptor\n"); |
| 293 | goto fail_dput; | 291 | goto fail_dput; |
| 294 | } | 292 | } |
| 295 | if (!pipe->f_op || !pipe->f_op->write) | 293 | if (autofs_prepare_pipe(pipe) < 0) |
| 296 | goto fail_fput; | 294 | goto fail_fput; |
| 297 | sbi->pipe = pipe; | 295 | sbi->pipe = pipe; |
| 298 | sbi->pipefd = pipefd; | 296 | sbi->pipefd = pipefd; |
diff --git a/fs/autofs4/waitq.c b/fs/autofs4/waitq.c index 9c098db43344..da8876d38a7b 100644 --- a/fs/autofs4/waitq.c +++ b/fs/autofs4/waitq.c | |||
| @@ -91,24 +91,7 @@ static int autofs4_write(struct autofs_sb_info *sbi, | |||
| 91 | 91 | ||
| 92 | return (bytes > 0); | 92 | return (bytes > 0); |
| 93 | } | 93 | } |
| 94 | 94 | ||
| 95 | /* | ||
| 96 | * The autofs_v5 packet was misdesigned. | ||
| 97 | * | ||
| 98 | * The packets are identical on x86-32 and x86-64, but have different | ||
| 99 | * alignment. Which means that 'sizeof()' will give different results. | ||
| 100 | * Fix it up for the case of running 32-bit user mode on a 64-bit kernel. | ||
| 101 | */ | ||
| 102 | static noinline size_t autofs_v5_packet_size(struct autofs_sb_info *sbi) | ||
| 103 | { | ||
| 104 | size_t pktsz = sizeof(struct autofs_v5_packet); | ||
| 105 | #if defined(CONFIG_X86_64) && defined(CONFIG_COMPAT) | ||
| 106 | if (sbi->compat_daemon > 0) | ||
| 107 | pktsz -= 4; | ||
| 108 | #endif | ||
| 109 | return pktsz; | ||
| 110 | } | ||
| 111 | |||
| 112 | static void autofs4_notify_daemon(struct autofs_sb_info *sbi, | 95 | static void autofs4_notify_daemon(struct autofs_sb_info *sbi, |
| 113 | struct autofs_wait_queue *wq, | 96 | struct autofs_wait_queue *wq, |
| 114 | int type) | 97 | int type) |
| @@ -172,7 +155,8 @@ static void autofs4_notify_daemon(struct autofs_sb_info *sbi, | |||
| 172 | { | 155 | { |
| 173 | struct autofs_v5_packet *packet = &pkt.v5_pkt.v5_packet; | 156 | struct autofs_v5_packet *packet = &pkt.v5_pkt.v5_packet; |
| 174 | 157 | ||
| 175 | pktsz = autofs_v5_packet_size(sbi); | 158 | pktsz = sizeof(*packet); |
| 159 | |||
| 176 | packet->wait_queue_token = wq->wait_queue_token; | 160 | packet->wait_queue_token = wq->wait_queue_token; |
| 177 | packet->len = wq->name.len; | 161 | packet->len = wq->name.len; |
| 178 | memcpy(packet->name, wq->name.name, wq->name.len); | 162 | memcpy(packet->name, wq->name.name, wq->name.len); |
diff --git a/fs/binfmt_aout.c b/fs/binfmt_aout.c index 2eb12f13593d..d146e181d10d 100644 --- a/fs/binfmt_aout.c +++ b/fs/binfmt_aout.c | |||
| @@ -50,9 +50,7 @@ static int set_brk(unsigned long start, unsigned long end) | |||
| 50 | end = PAGE_ALIGN(end); | 50 | end = PAGE_ALIGN(end); |
| 51 | if (end > start) { | 51 | if (end > start) { |
| 52 | unsigned long addr; | 52 | unsigned long addr; |
| 53 | down_write(¤t->mm->mmap_sem); | 53 | addr = vm_brk(start, end - start); |
| 54 | addr = do_brk(start, end - start); | ||
| 55 | up_write(¤t->mm->mmap_sem); | ||
| 56 | if (BAD_ADDR(addr)) | 54 | if (BAD_ADDR(addr)) |
| 57 | return addr; | 55 | return addr; |
| 58 | } | 56 | } |
| @@ -280,9 +278,7 @@ static int load_aout_binary(struct linux_binprm * bprm, struct pt_regs * regs) | |||
| 280 | pos = 32; | 278 | pos = 32; |
| 281 | map_size = ex.a_text+ex.a_data; | 279 | map_size = ex.a_text+ex.a_data; |
| 282 | #endif | 280 | #endif |
| 283 | down_write(¤t->mm->mmap_sem); | 281 | error = vm_brk(text_addr & PAGE_MASK, map_size); |
| 284 | error = do_brk(text_addr & PAGE_MASK, map_size); | ||
| 285 | up_write(¤t->mm->mmap_sem); | ||
| 286 | if (error != (text_addr & PAGE_MASK)) { | 282 | if (error != (text_addr & PAGE_MASK)) { |
| 287 | send_sig(SIGKILL, current, 0); | 283 | send_sig(SIGKILL, current, 0); |
| 288 | return error; | 284 | return error; |
| @@ -313,9 +309,7 @@ static int load_aout_binary(struct linux_binprm * bprm, struct pt_regs * regs) | |||
| 313 | 309 | ||
| 314 | if (!bprm->file->f_op->mmap||((fd_offset & ~PAGE_MASK) != 0)) { | 310 | if (!bprm->file->f_op->mmap||((fd_offset & ~PAGE_MASK) != 0)) { |
| 315 | loff_t pos = fd_offset; | 311 | loff_t pos = fd_offset; |
| 316 | down_write(¤t->mm->mmap_sem); | 312 | vm_brk(N_TXTADDR(ex), ex.a_text+ex.a_data); |
| 317 | do_brk(N_TXTADDR(ex), ex.a_text+ex.a_data); | ||
| 318 | up_write(¤t->mm->mmap_sem); | ||
| 319 | bprm->file->f_op->read(bprm->file, | 313 | bprm->file->f_op->read(bprm->file, |
| 320 | (char __user *)N_TXTADDR(ex), | 314 | (char __user *)N_TXTADDR(ex), |
| 321 | ex.a_text+ex.a_data, &pos); | 315 | ex.a_text+ex.a_data, &pos); |
| @@ -325,24 +319,20 @@ static int load_aout_binary(struct linux_binprm * bprm, struct pt_regs * regs) | |||
| 325 | goto beyond_if; | 319 | goto beyond_if; |
| 326 | } | 320 | } |
| 327 | 321 | ||
| 328 | down_write(¤t->mm->mmap_sem); | 322 | error = vm_mmap(bprm->file, N_TXTADDR(ex), ex.a_text, |
| 329 | error = do_mmap(bprm->file, N_TXTADDR(ex), ex.a_text, | ||
| 330 | PROT_READ | PROT_EXEC, | 323 | PROT_READ | PROT_EXEC, |
| 331 | MAP_FIXED | MAP_PRIVATE | MAP_DENYWRITE | MAP_EXECUTABLE, | 324 | MAP_FIXED | MAP_PRIVATE | MAP_DENYWRITE | MAP_EXECUTABLE, |
| 332 | fd_offset); | 325 | fd_offset); |
| 333 | up_write(¤t->mm->mmap_sem); | ||
| 334 | 326 | ||
| 335 | if (error != N_TXTADDR(ex)) { | 327 | if (error != N_TXTADDR(ex)) { |
| 336 | send_sig(SIGKILL, current, 0); | 328 | send_sig(SIGKILL, current, 0); |
| 337 | return error; | 329 | return error; |
| 338 | } | 330 | } |
| 339 | 331 | ||
| 340 | down_write(¤t->mm->mmap_sem); | 332 | error = vm_mmap(bprm->file, N_DATADDR(ex), ex.a_data, |
| 341 | error = do_mmap(bprm->file, N_DATADDR(ex), ex.a_data, | ||
| 342 | PROT_READ | PROT_WRITE | PROT_EXEC, | 333 | PROT_READ | PROT_WRITE | PROT_EXEC, |
| 343 | MAP_FIXED | MAP_PRIVATE | MAP_DENYWRITE | MAP_EXECUTABLE, | 334 | MAP_FIXED | MAP_PRIVATE | MAP_DENYWRITE | MAP_EXECUTABLE, |
| 344 | fd_offset + ex.a_text); | 335 | fd_offset + ex.a_text); |
| 345 | up_write(¤t->mm->mmap_sem); | ||
| 346 | if (error != N_DATADDR(ex)) { | 336 | if (error != N_DATADDR(ex)) { |
| 347 | send_sig(SIGKILL, current, 0); | 337 | send_sig(SIGKILL, current, 0); |
| 348 | return error; | 338 | return error; |
| @@ -412,9 +402,7 @@ static int load_aout_library(struct file *file) | |||
| 412 | "N_TXTOFF is not page aligned. Please convert library: %s\n", | 402 | "N_TXTOFF is not page aligned. Please convert library: %s\n", |
| 413 | file->f_path.dentry->d_name.name); | 403 | file->f_path.dentry->d_name.name); |
| 414 | } | 404 | } |
| 415 | down_write(¤t->mm->mmap_sem); | 405 | vm_brk(start_addr, ex.a_text + ex.a_data + ex.a_bss); |
| 416 | do_brk(start_addr, ex.a_text + ex.a_data + ex.a_bss); | ||
| 417 | up_write(¤t->mm->mmap_sem); | ||
| 418 | 406 | ||
| 419 | file->f_op->read(file, (char __user *)start_addr, | 407 | file->f_op->read(file, (char __user *)start_addr, |
| 420 | ex.a_text + ex.a_data, &pos); | 408 | ex.a_text + ex.a_data, &pos); |
| @@ -425,12 +413,10 @@ static int load_aout_library(struct file *file) | |||
| 425 | goto out; | 413 | goto out; |
| 426 | } | 414 | } |
| 427 | /* Now use mmap to map the library into memory. */ | 415 | /* Now use mmap to map the library into memory. */ |
| 428 | down_write(¤t->mm->mmap_sem); | 416 | error = vm_mmap(file, start_addr, ex.a_text + ex.a_data, |
| 429 | error = do_mmap(file, start_addr, ex.a_text + ex.a_data, | ||
| 430 | PROT_READ | PROT_WRITE | PROT_EXEC, | 417 | PROT_READ | PROT_WRITE | PROT_EXEC, |
| 431 | MAP_FIXED | MAP_PRIVATE | MAP_DENYWRITE, | 418 | MAP_FIXED | MAP_PRIVATE | MAP_DENYWRITE, |
| 432 | N_TXTOFF(ex)); | 419 | N_TXTOFF(ex)); |
| 433 | up_write(¤t->mm->mmap_sem); | ||
| 434 | retval = error; | 420 | retval = error; |
| 435 | if (error != start_addr) | 421 | if (error != start_addr) |
| 436 | goto out; | 422 | goto out; |
| @@ -438,9 +424,7 @@ static int load_aout_library(struct file *file) | |||
| 438 | len = PAGE_ALIGN(ex.a_text + ex.a_data); | 424 | len = PAGE_ALIGN(ex.a_text + ex.a_data); |
| 439 | bss = ex.a_text + ex.a_data + ex.a_bss; | 425 | bss = ex.a_text + ex.a_data + ex.a_bss; |
| 440 | if (bss > len) { | 426 | if (bss > len) { |
| 441 | down_write(¤t->mm->mmap_sem); | 427 | error = vm_brk(start_addr + len, bss - len); |
| 442 | error = do_brk(start_addr + len, bss - len); | ||
| 443 | up_write(¤t->mm->mmap_sem); | ||
| 444 | retval = error; | 428 | retval = error; |
| 445 | if (error != start_addr + len) | 429 | if (error != start_addr + len) |
| 446 | goto out; | 430 | goto out; |
diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c index 48ffb3dc610a..16f735417072 100644 --- a/fs/binfmt_elf.c +++ b/fs/binfmt_elf.c | |||
| @@ -82,9 +82,7 @@ static int set_brk(unsigned long start, unsigned long end) | |||
| 82 | end = ELF_PAGEALIGN(end); | 82 | end = ELF_PAGEALIGN(end); |
| 83 | if (end > start) { | 83 | if (end > start) { |
| 84 | unsigned long addr; | 84 | unsigned long addr; |
| 85 | down_write(¤t->mm->mmap_sem); | 85 | addr = vm_brk(start, end - start); |
| 86 | addr = do_brk(start, end - start); | ||
| 87 | up_write(¤t->mm->mmap_sem); | ||
| 88 | if (BAD_ADDR(addr)) | 86 | if (BAD_ADDR(addr)) |
| 89 | return addr; | 87 | return addr; |
| 90 | } | 88 | } |
| @@ -514,9 +512,7 @@ static unsigned long load_elf_interp(struct elfhdr *interp_elf_ex, | |||
| 514 | elf_bss = ELF_PAGESTART(elf_bss + ELF_MIN_ALIGN - 1); | 512 | elf_bss = ELF_PAGESTART(elf_bss + ELF_MIN_ALIGN - 1); |
| 515 | 513 | ||
| 516 | /* Map the last of the bss segment */ | 514 | /* Map the last of the bss segment */ |
| 517 | down_write(¤t->mm->mmap_sem); | 515 | error = vm_brk(elf_bss, last_bss - elf_bss); |
| 518 | error = do_brk(elf_bss, last_bss - elf_bss); | ||
| 519 | up_write(¤t->mm->mmap_sem); | ||
| 520 | if (BAD_ADDR(error)) | 516 | if (BAD_ADDR(error)) |
| 521 | goto out_close; | 517 | goto out_close; |
| 522 | } | 518 | } |
| @@ -962,10 +958,8 @@ static int load_elf_binary(struct linux_binprm *bprm, struct pt_regs *regs) | |||
| 962 | and some applications "depend" upon this behavior. | 958 | and some applications "depend" upon this behavior. |
| 963 | Since we do not have the power to recompile these, we | 959 | Since we do not have the power to recompile these, we |
| 964 | emulate the SVr4 behavior. Sigh. */ | 960 | emulate the SVr4 behavior. Sigh. */ |
| 965 | down_write(¤t->mm->mmap_sem); | 961 | error = vm_mmap(NULL, 0, PAGE_SIZE, PROT_READ | PROT_EXEC, |
| 966 | error = do_mmap(NULL, 0, PAGE_SIZE, PROT_READ | PROT_EXEC, | ||
| 967 | MAP_FIXED | MAP_PRIVATE, 0); | 962 | MAP_FIXED | MAP_PRIVATE, 0); |
| 968 | up_write(¤t->mm->mmap_sem); | ||
| 969 | } | 963 | } |
| 970 | 964 | ||
| 971 | #ifdef ELF_PLAT_INIT | 965 | #ifdef ELF_PLAT_INIT |
| @@ -1050,8 +1044,7 @@ static int load_elf_library(struct file *file) | |||
| 1050 | eppnt++; | 1044 | eppnt++; |
| 1051 | 1045 | ||
| 1052 | /* Now use mmap to map the library into memory. */ | 1046 | /* Now use mmap to map the library into memory. */ |
| 1053 | down_write(¤t->mm->mmap_sem); | 1047 | error = vm_mmap(file, |
| 1054 | error = do_mmap(file, | ||
| 1055 | ELF_PAGESTART(eppnt->p_vaddr), | 1048 | ELF_PAGESTART(eppnt->p_vaddr), |
| 1056 | (eppnt->p_filesz + | 1049 | (eppnt->p_filesz + |
| 1057 | ELF_PAGEOFFSET(eppnt->p_vaddr)), | 1050 | ELF_PAGEOFFSET(eppnt->p_vaddr)), |
| @@ -1059,7 +1052,6 @@ static int load_elf_library(struct file *file) | |||
| 1059 | MAP_FIXED | MAP_PRIVATE | MAP_DENYWRITE, | 1052 | MAP_FIXED | MAP_PRIVATE | MAP_DENYWRITE, |
| 1060 | (eppnt->p_offset - | 1053 | (eppnt->p_offset - |
| 1061 | ELF_PAGEOFFSET(eppnt->p_vaddr))); | 1054 | ELF_PAGEOFFSET(eppnt->p_vaddr))); |
| 1062 | up_write(¤t->mm->mmap_sem); | ||
| 1063 | if (error != ELF_PAGESTART(eppnt->p_vaddr)) | 1055 | if (error != ELF_PAGESTART(eppnt->p_vaddr)) |
| 1064 | goto out_free_ph; | 1056 | goto out_free_ph; |
| 1065 | 1057 | ||
| @@ -1072,11 +1064,8 @@ static int load_elf_library(struct file *file) | |||
| 1072 | len = ELF_PAGESTART(eppnt->p_filesz + eppnt->p_vaddr + | 1064 | len = ELF_PAGESTART(eppnt->p_filesz + eppnt->p_vaddr + |
| 1073 | ELF_MIN_ALIGN - 1); | 1065 | ELF_MIN_ALIGN - 1); |
| 1074 | bss = eppnt->p_memsz + eppnt->p_vaddr; | 1066 | bss = eppnt->p_memsz + eppnt->p_vaddr; |
| 1075 | if (bss > len) { | 1067 | if (bss > len) |
| 1076 | down_write(¤t->mm->mmap_sem); | 1068 | vm_brk(len, bss - len); |
| 1077 | do_brk(len, bss - len); | ||
| 1078 | up_write(¤t->mm->mmap_sem); | ||
| 1079 | } | ||
| 1080 | error = 0; | 1069 | error = 0; |
| 1081 | 1070 | ||
| 1082 | out_free_ph: | 1071 | out_free_ph: |
diff --git a/fs/binfmt_elf_fdpic.c b/fs/binfmt_elf_fdpic.c index 9bd5612a8224..d390a0fffc65 100644 --- a/fs/binfmt_elf_fdpic.c +++ b/fs/binfmt_elf_fdpic.c | |||
| @@ -390,21 +390,17 @@ static int load_elf_fdpic_binary(struct linux_binprm *bprm, | |||
| 390 | (executable_stack == EXSTACK_DEFAULT && VM_STACK_FLAGS & VM_EXEC)) | 390 | (executable_stack == EXSTACK_DEFAULT && VM_STACK_FLAGS & VM_EXEC)) |
| 391 | stack_prot |= PROT_EXEC; | 391 | stack_prot |= PROT_EXEC; |
| 392 | 392 | ||
| 393 | down_write(¤t->mm->mmap_sem); | 393 | current->mm->start_brk = vm_mmap(NULL, 0, stack_size, stack_prot, |
| 394 | current->mm->start_brk = do_mmap(NULL, 0, stack_size, stack_prot, | ||
| 395 | MAP_PRIVATE | MAP_ANONYMOUS | | 394 | MAP_PRIVATE | MAP_ANONYMOUS | |
| 396 | MAP_UNINITIALIZED | MAP_GROWSDOWN, | 395 | MAP_UNINITIALIZED | MAP_GROWSDOWN, |
| 397 | 0); | 396 | 0); |
| 398 | 397 | ||
| 399 | if (IS_ERR_VALUE(current->mm->start_brk)) { | 398 | if (IS_ERR_VALUE(current->mm->start_brk)) { |
| 400 | up_write(¤t->mm->mmap_sem); | ||
| 401 | retval = current->mm->start_brk; | 399 | retval = current->mm->start_brk; |
| 402 | current->mm->start_brk = 0; | 400 | current->mm->start_brk = 0; |
| 403 | goto error_kill; | 401 | goto error_kill; |
| 404 | } | 402 | } |
| 405 | 403 | ||
| 406 | up_write(¤t->mm->mmap_sem); | ||
| 407 | |||
| 408 | current->mm->brk = current->mm->start_brk; | 404 | current->mm->brk = current->mm->start_brk; |
| 409 | current->mm->context.end_brk = current->mm->start_brk; | 405 | current->mm->context.end_brk = current->mm->start_brk; |
| 410 | current->mm->context.end_brk += | 406 | current->mm->context.end_brk += |
| @@ -955,10 +951,8 @@ static int elf_fdpic_map_file_constdisp_on_uclinux( | |||
| 955 | if (params->flags & ELF_FDPIC_FLAG_EXECUTABLE) | 951 | if (params->flags & ELF_FDPIC_FLAG_EXECUTABLE) |
| 956 | mflags |= MAP_EXECUTABLE; | 952 | mflags |= MAP_EXECUTABLE; |
| 957 | 953 | ||
| 958 | down_write(&mm->mmap_sem); | 954 | maddr = vm_mmap(NULL, load_addr, top - base, |
| 959 | maddr = do_mmap(NULL, load_addr, top - base, | ||
| 960 | PROT_READ | PROT_WRITE | PROT_EXEC, mflags, 0); | 955 | PROT_READ | PROT_WRITE | PROT_EXEC, mflags, 0); |
| 961 | up_write(&mm->mmap_sem); | ||
| 962 | if (IS_ERR_VALUE(maddr)) | 956 | if (IS_ERR_VALUE(maddr)) |
| 963 | return (int) maddr; | 957 | return (int) maddr; |
| 964 | 958 | ||
| @@ -1096,10 +1090,8 @@ static int elf_fdpic_map_file_by_direct_mmap(struct elf_fdpic_params *params, | |||
| 1096 | 1090 | ||
| 1097 | /* create the mapping */ | 1091 | /* create the mapping */ |
| 1098 | disp = phdr->p_vaddr & ~PAGE_MASK; | 1092 | disp = phdr->p_vaddr & ~PAGE_MASK; |
| 1099 | down_write(&mm->mmap_sem); | 1093 | maddr = vm_mmap(file, maddr, phdr->p_memsz + disp, prot, flags, |
| 1100 | maddr = do_mmap(file, maddr, phdr->p_memsz + disp, prot, flags, | ||
| 1101 | phdr->p_offset - disp); | 1094 | phdr->p_offset - disp); |
| 1102 | up_write(&mm->mmap_sem); | ||
| 1103 | 1095 | ||
| 1104 | kdebug("mmap[%d] <file> sz=%lx pr=%x fl=%x of=%lx --> %08lx", | 1096 | kdebug("mmap[%d] <file> sz=%lx pr=%x fl=%x of=%lx --> %08lx", |
| 1105 | loop, phdr->p_memsz + disp, prot, flags, | 1097 | loop, phdr->p_memsz + disp, prot, flags, |
| @@ -1143,10 +1135,8 @@ static int elf_fdpic_map_file_by_direct_mmap(struct elf_fdpic_params *params, | |||
| 1143 | unsigned long xmaddr; | 1135 | unsigned long xmaddr; |
| 1144 | 1136 | ||
| 1145 | flags |= MAP_FIXED | MAP_ANONYMOUS; | 1137 | flags |= MAP_FIXED | MAP_ANONYMOUS; |
| 1146 | down_write(&mm->mmap_sem); | 1138 | xmaddr = vm_mmap(NULL, xaddr, excess - excess1, |
| 1147 | xmaddr = do_mmap(NULL, xaddr, excess - excess1, | ||
| 1148 | prot, flags, 0); | 1139 | prot, flags, 0); |
| 1149 | up_write(&mm->mmap_sem); | ||
| 1150 | 1140 | ||
| 1151 | kdebug("mmap[%d] <anon>" | 1141 | kdebug("mmap[%d] <anon>" |
| 1152 | " ad=%lx sz=%lx pr=%x fl=%x of=0 --> %08lx", | 1142 | " ad=%lx sz=%lx pr=%x fl=%x of=0 --> %08lx", |
diff --git a/fs/binfmt_flat.c b/fs/binfmt_flat.c index 024d20ee3ca3..6b2daf99fab8 100644 --- a/fs/binfmt_flat.c +++ b/fs/binfmt_flat.c | |||
| @@ -542,10 +542,8 @@ static int load_flat_file(struct linux_binprm * bprm, | |||
| 542 | */ | 542 | */ |
| 543 | DBG_FLT("BINFMT_FLAT: ROM mapping of file (we hope)\n"); | 543 | DBG_FLT("BINFMT_FLAT: ROM mapping of file (we hope)\n"); |
| 544 | 544 | ||
| 545 | down_write(¤t->mm->mmap_sem); | 545 | textpos = vm_mmap(bprm->file, 0, text_len, PROT_READ|PROT_EXEC, |
| 546 | textpos = do_mmap(bprm->file, 0, text_len, PROT_READ|PROT_EXEC, | ||
| 547 | MAP_PRIVATE|MAP_EXECUTABLE, 0); | 546 | MAP_PRIVATE|MAP_EXECUTABLE, 0); |
| 548 | up_write(¤t->mm->mmap_sem); | ||
| 549 | if (!textpos || IS_ERR_VALUE(textpos)) { | 547 | if (!textpos || IS_ERR_VALUE(textpos)) { |
| 550 | if (!textpos) | 548 | if (!textpos) |
| 551 | textpos = (unsigned long) -ENOMEM; | 549 | textpos = (unsigned long) -ENOMEM; |
| @@ -556,10 +554,8 @@ static int load_flat_file(struct linux_binprm * bprm, | |||
| 556 | 554 | ||
| 557 | len = data_len + extra + MAX_SHARED_LIBS * sizeof(unsigned long); | 555 | len = data_len + extra + MAX_SHARED_LIBS * sizeof(unsigned long); |
| 558 | len = PAGE_ALIGN(len); | 556 | len = PAGE_ALIGN(len); |
| 559 | down_write(¤t->mm->mmap_sem); | 557 | realdatastart = vm_mmap(0, 0, len, |
| 560 | realdatastart = do_mmap(0, 0, len, | ||
| 561 | PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE, 0); | 558 | PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE, 0); |
| 562 | up_write(¤t->mm->mmap_sem); | ||
| 563 | 559 | ||
| 564 | if (realdatastart == 0 || IS_ERR_VALUE(realdatastart)) { | 560 | if (realdatastart == 0 || IS_ERR_VALUE(realdatastart)) { |
| 565 | if (!realdatastart) | 561 | if (!realdatastart) |
| @@ -603,10 +599,8 @@ static int load_flat_file(struct linux_binprm * bprm, | |||
| 603 | 599 | ||
| 604 | len = text_len + data_len + extra + MAX_SHARED_LIBS * sizeof(unsigned long); | 600 | len = text_len + data_len + extra + MAX_SHARED_LIBS * sizeof(unsigned long); |
| 605 | len = PAGE_ALIGN(len); | 601 | len = PAGE_ALIGN(len); |
| 606 | down_write(¤t->mm->mmap_sem); | 602 | textpos = vm_mmap(0, 0, len, |
| 607 | textpos = do_mmap(0, 0, len, | ||
| 608 | PROT_READ | PROT_EXEC | PROT_WRITE, MAP_PRIVATE, 0); | 603 | PROT_READ | PROT_EXEC | PROT_WRITE, MAP_PRIVATE, 0); |
| 609 | up_write(¤t->mm->mmap_sem); | ||
| 610 | 604 | ||
| 611 | if (!textpos || IS_ERR_VALUE(textpos)) { | 605 | if (!textpos || IS_ERR_VALUE(textpos)) { |
| 612 | if (!textpos) | 606 | if (!textpos) |
diff --git a/fs/binfmt_som.c b/fs/binfmt_som.c index e4fc746629a7..4517aaff61b4 100644 --- a/fs/binfmt_som.c +++ b/fs/binfmt_som.c | |||
| @@ -147,10 +147,8 @@ static int map_som_binary(struct file *file, | |||
| 147 | code_size = SOM_PAGEALIGN(hpuxhdr->exec_tsize); | 147 | code_size = SOM_PAGEALIGN(hpuxhdr->exec_tsize); |
| 148 | current->mm->start_code = code_start; | 148 | current->mm->start_code = code_start; |
| 149 | current->mm->end_code = code_start + code_size; | 149 | current->mm->end_code = code_start + code_size; |
| 150 | down_write(¤t->mm->mmap_sem); | 150 | retval = vm_mmap(file, code_start, code_size, prot, |
| 151 | retval = do_mmap(file, code_start, code_size, prot, | ||
| 152 | flags, SOM_PAGESTART(hpuxhdr->exec_tfile)); | 151 | flags, SOM_PAGESTART(hpuxhdr->exec_tfile)); |
| 153 | up_write(¤t->mm->mmap_sem); | ||
| 154 | if (retval < 0 && retval > -1024) | 152 | if (retval < 0 && retval > -1024) |
| 155 | goto out; | 153 | goto out; |
| 156 | 154 | ||
| @@ -158,20 +156,16 @@ static int map_som_binary(struct file *file, | |||
| 158 | data_size = SOM_PAGEALIGN(hpuxhdr->exec_dsize); | 156 | data_size = SOM_PAGEALIGN(hpuxhdr->exec_dsize); |
| 159 | current->mm->start_data = data_start; | 157 | current->mm->start_data = data_start; |
| 160 | current->mm->end_data = bss_start = data_start + data_size; | 158 | current->mm->end_data = bss_start = data_start + data_size; |
| 161 | down_write(¤t->mm->mmap_sem); | 159 | retval = vm_mmap(file, data_start, data_size, |
| 162 | retval = do_mmap(file, data_start, data_size, | ||
| 163 | prot | PROT_WRITE, flags, | 160 | prot | PROT_WRITE, flags, |
| 164 | SOM_PAGESTART(hpuxhdr->exec_dfile)); | 161 | SOM_PAGESTART(hpuxhdr->exec_dfile)); |
| 165 | up_write(¤t->mm->mmap_sem); | ||
| 166 | if (retval < 0 && retval > -1024) | 162 | if (retval < 0 && retval > -1024) |
| 167 | goto out; | 163 | goto out; |
| 168 | 164 | ||
| 169 | som_brk = bss_start + SOM_PAGEALIGN(hpuxhdr->exec_bsize); | 165 | som_brk = bss_start + SOM_PAGEALIGN(hpuxhdr->exec_bsize); |
| 170 | current->mm->start_brk = current->mm->brk = som_brk; | 166 | current->mm->start_brk = current->mm->brk = som_brk; |
| 171 | down_write(¤t->mm->mmap_sem); | 167 | retval = vm_mmap(NULL, bss_start, som_brk - bss_start, |
| 172 | retval = do_mmap(NULL, bss_start, som_brk - bss_start, | ||
| 173 | prot | PROT_WRITE, MAP_FIXED | MAP_PRIVATE, 0); | 168 | prot | PROT_WRITE, MAP_FIXED | MAP_PRIVATE, 0); |
| 174 | up_write(¤t->mm->mmap_sem); | ||
| 175 | if (retval > 0 || retval < -1024) | 169 | if (retval > 0 || retval < -1024) |
| 176 | retval = 0; | 170 | retval = 0; |
| 177 | out: | 171 | out: |
diff --git a/fs/btrfs/backref.c b/fs/btrfs/backref.c index f4e90748940a..bcec06750232 100644 --- a/fs/btrfs/backref.c +++ b/fs/btrfs/backref.c | |||
| @@ -22,6 +22,7 @@ | |||
| 22 | #include "ulist.h" | 22 | #include "ulist.h" |
| 23 | #include "transaction.h" | 23 | #include "transaction.h" |
| 24 | #include "delayed-ref.h" | 24 | #include "delayed-ref.h" |
| 25 | #include "locking.h" | ||
| 25 | 26 | ||
| 26 | /* | 27 | /* |
| 27 | * this structure records all encountered refs on the way up to the root | 28 | * this structure records all encountered refs on the way up to the root |
| @@ -893,18 +894,22 @@ static char *iref_to_path(struct btrfs_root *fs_root, struct btrfs_path *path, | |||
| 893 | s64 bytes_left = size - 1; | 894 | s64 bytes_left = size - 1; |
| 894 | struct extent_buffer *eb = eb_in; | 895 | struct extent_buffer *eb = eb_in; |
| 895 | struct btrfs_key found_key; | 896 | struct btrfs_key found_key; |
| 897 | int leave_spinning = path->leave_spinning; | ||
| 896 | 898 | ||
| 897 | if (bytes_left >= 0) | 899 | if (bytes_left >= 0) |
| 898 | dest[bytes_left] = '\0'; | 900 | dest[bytes_left] = '\0'; |
| 899 | 901 | ||
| 902 | path->leave_spinning = 1; | ||
| 900 | while (1) { | 903 | while (1) { |
| 901 | len = btrfs_inode_ref_name_len(eb, iref); | 904 | len = btrfs_inode_ref_name_len(eb, iref); |
| 902 | bytes_left -= len; | 905 | bytes_left -= len; |
| 903 | if (bytes_left >= 0) | 906 | if (bytes_left >= 0) |
| 904 | read_extent_buffer(eb, dest + bytes_left, | 907 | read_extent_buffer(eb, dest + bytes_left, |
| 905 | (unsigned long)(iref + 1), len); | 908 | (unsigned long)(iref + 1), len); |
| 906 | if (eb != eb_in) | 909 | if (eb != eb_in) { |
| 910 | btrfs_tree_read_unlock_blocking(eb); | ||
| 907 | free_extent_buffer(eb); | 911 | free_extent_buffer(eb); |
| 912 | } | ||
| 908 | ret = inode_ref_info(parent, 0, fs_root, path, &found_key); | 913 | ret = inode_ref_info(parent, 0, fs_root, path, &found_key); |
| 909 | if (ret > 0) | 914 | if (ret > 0) |
| 910 | ret = -ENOENT; | 915 | ret = -ENOENT; |
| @@ -919,8 +924,11 @@ static char *iref_to_path(struct btrfs_root *fs_root, struct btrfs_path *path, | |||
| 919 | slot = path->slots[0]; | 924 | slot = path->slots[0]; |
| 920 | eb = path->nodes[0]; | 925 | eb = path->nodes[0]; |
| 921 | /* make sure we can use eb after releasing the path */ | 926 | /* make sure we can use eb after releasing the path */ |
| 922 | if (eb != eb_in) | 927 | if (eb != eb_in) { |
| 923 | atomic_inc(&eb->refs); | 928 | atomic_inc(&eb->refs); |
| 929 | btrfs_tree_read_lock(eb); | ||
| 930 | btrfs_set_lock_blocking_rw(eb, BTRFS_READ_LOCK); | ||
| 931 | } | ||
| 924 | btrfs_release_path(path); | 932 | btrfs_release_path(path); |
| 925 | 933 | ||
| 926 | iref = btrfs_item_ptr(eb, slot, struct btrfs_inode_ref); | 934 | iref = btrfs_item_ptr(eb, slot, struct btrfs_inode_ref); |
| @@ -931,6 +939,7 @@ static char *iref_to_path(struct btrfs_root *fs_root, struct btrfs_path *path, | |||
| 931 | } | 939 | } |
| 932 | 940 | ||
| 933 | btrfs_release_path(path); | 941 | btrfs_release_path(path); |
| 942 | path->leave_spinning = leave_spinning; | ||
| 934 | 943 | ||
| 935 | if (ret) | 944 | if (ret) |
| 936 | return ERR_PTR(ret); | 945 | return ERR_PTR(ret); |
| @@ -1247,7 +1256,7 @@ static int iterate_irefs(u64 inum, struct btrfs_root *fs_root, | |||
| 1247 | struct btrfs_path *path, | 1256 | struct btrfs_path *path, |
| 1248 | iterate_irefs_t *iterate, void *ctx) | 1257 | iterate_irefs_t *iterate, void *ctx) |
| 1249 | { | 1258 | { |
| 1250 | int ret; | 1259 | int ret = 0; |
| 1251 | int slot; | 1260 | int slot; |
| 1252 | u32 cur; | 1261 | u32 cur; |
| 1253 | u32 len; | 1262 | u32 len; |
| @@ -1259,7 +1268,8 @@ static int iterate_irefs(u64 inum, struct btrfs_root *fs_root, | |||
| 1259 | struct btrfs_inode_ref *iref; | 1268 | struct btrfs_inode_ref *iref; |
| 1260 | struct btrfs_key found_key; | 1269 | struct btrfs_key found_key; |
| 1261 | 1270 | ||
| 1262 | while (1) { | 1271 | while (!ret) { |
| 1272 | path->leave_spinning = 1; | ||
| 1263 | ret = inode_ref_info(inum, parent ? parent+1 : 0, fs_root, path, | 1273 | ret = inode_ref_info(inum, parent ? parent+1 : 0, fs_root, path, |
| 1264 | &found_key); | 1274 | &found_key); |
| 1265 | if (ret < 0) | 1275 | if (ret < 0) |
| @@ -1275,6 +1285,8 @@ static int iterate_irefs(u64 inum, struct btrfs_root *fs_root, | |||
| 1275 | eb = path->nodes[0]; | 1285 | eb = path->nodes[0]; |
| 1276 | /* make sure we can use eb after releasing the path */ | 1286 | /* make sure we can use eb after releasing the path */ |
| 1277 | atomic_inc(&eb->refs); | 1287 | atomic_inc(&eb->refs); |
| 1288 | btrfs_tree_read_lock(eb); | ||
| 1289 | btrfs_set_lock_blocking_rw(eb, BTRFS_READ_LOCK); | ||
| 1278 | btrfs_release_path(path); | 1290 | btrfs_release_path(path); |
| 1279 | 1291 | ||
| 1280 | item = btrfs_item_nr(eb, slot); | 1292 | item = btrfs_item_nr(eb, slot); |
| @@ -1288,13 +1300,12 @@ static int iterate_irefs(u64 inum, struct btrfs_root *fs_root, | |||
| 1288 | (unsigned long long)found_key.objectid, | 1300 | (unsigned long long)found_key.objectid, |
| 1289 | (unsigned long long)fs_root->objectid); | 1301 | (unsigned long long)fs_root->objectid); |
| 1290 | ret = iterate(parent, iref, eb, ctx); | 1302 | ret = iterate(parent, iref, eb, ctx); |
| 1291 | if (ret) { | 1303 | if (ret) |
| 1292 | free_extent_buffer(eb); | ||
| 1293 | break; | 1304 | break; |
| 1294 | } | ||
| 1295 | len = sizeof(*iref) + name_len; | 1305 | len = sizeof(*iref) + name_len; |
| 1296 | iref = (struct btrfs_inode_ref *)((char *)iref + len); | 1306 | iref = (struct btrfs_inode_ref *)((char *)iref + len); |
| 1297 | } | 1307 | } |
| 1308 | btrfs_tree_read_unlock_blocking(eb); | ||
| 1298 | free_extent_buffer(eb); | 1309 | free_extent_buffer(eb); |
| 1299 | } | 1310 | } |
| 1300 | 1311 | ||
| @@ -1414,6 +1425,8 @@ struct inode_fs_paths *init_ipath(s32 total_bytes, struct btrfs_root *fs_root, | |||
| 1414 | 1425 | ||
| 1415 | void free_ipath(struct inode_fs_paths *ipath) | 1426 | void free_ipath(struct inode_fs_paths *ipath) |
| 1416 | { | 1427 | { |
| 1428 | if (!ipath) | ||
| 1429 | return; | ||
| 1417 | kfree(ipath->fspath); | 1430 | kfree(ipath->fspath); |
| 1418 | kfree(ipath); | 1431 | kfree(ipath); |
| 1419 | } | 1432 | } |
diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c index e801f226d7e0..4106264fbc65 100644 --- a/fs/btrfs/ctree.c +++ b/fs/btrfs/ctree.c | |||
| @@ -220,10 +220,12 @@ struct extent_buffer *btrfs_read_lock_root_node(struct btrfs_root *root) | |||
| 220 | */ | 220 | */ |
| 221 | static void add_root_to_dirty_list(struct btrfs_root *root) | 221 | static void add_root_to_dirty_list(struct btrfs_root *root) |
| 222 | { | 222 | { |
| 223 | spin_lock(&root->fs_info->trans_lock); | ||
| 223 | if (root->track_dirty && list_empty(&root->dirty_list)) { | 224 | if (root->track_dirty && list_empty(&root->dirty_list)) { |
| 224 | list_add(&root->dirty_list, | 225 | list_add(&root->dirty_list, |
| 225 | &root->fs_info->dirty_cowonly_roots); | 226 | &root->fs_info->dirty_cowonly_roots); |
| 226 | } | 227 | } |
| 228 | spin_unlock(&root->fs_info->trans_lock); | ||
| 227 | } | 229 | } |
| 228 | 230 | ||
| 229 | /* | 231 | /* |
| @@ -723,7 +725,7 @@ int btrfs_realloc_node(struct btrfs_trans_handle *trans, | |||
| 723 | 725 | ||
| 724 | cur = btrfs_find_tree_block(root, blocknr, blocksize); | 726 | cur = btrfs_find_tree_block(root, blocknr, blocksize); |
| 725 | if (cur) | 727 | if (cur) |
| 726 | uptodate = btrfs_buffer_uptodate(cur, gen); | 728 | uptodate = btrfs_buffer_uptodate(cur, gen, 0); |
| 727 | else | 729 | else |
| 728 | uptodate = 0; | 730 | uptodate = 0; |
| 729 | if (!cur || !uptodate) { | 731 | if (!cur || !uptodate) { |
| @@ -1358,7 +1360,12 @@ static noinline int reada_for_balance(struct btrfs_root *root, | |||
| 1358 | block1 = btrfs_node_blockptr(parent, slot - 1); | 1360 | block1 = btrfs_node_blockptr(parent, slot - 1); |
| 1359 | gen = btrfs_node_ptr_generation(parent, slot - 1); | 1361 | gen = btrfs_node_ptr_generation(parent, slot - 1); |
| 1360 | eb = btrfs_find_tree_block(root, block1, blocksize); | 1362 | eb = btrfs_find_tree_block(root, block1, blocksize); |
| 1361 | if (eb && btrfs_buffer_uptodate(eb, gen)) | 1363 | /* |
| 1364 | * if we get -eagain from btrfs_buffer_uptodate, we | ||
| 1365 | * don't want to return eagain here. That will loop | ||
| 1366 | * forever | ||
| 1367 | */ | ||
| 1368 | if (eb && btrfs_buffer_uptodate(eb, gen, 1) != 0) | ||
| 1362 | block1 = 0; | 1369 | block1 = 0; |
| 1363 | free_extent_buffer(eb); | 1370 | free_extent_buffer(eb); |
| 1364 | } | 1371 | } |
| @@ -1366,7 +1373,7 @@ static noinline int reada_for_balance(struct btrfs_root *root, | |||
| 1366 | block2 = btrfs_node_blockptr(parent, slot + 1); | 1373 | block2 = btrfs_node_blockptr(parent, slot + 1); |
| 1367 | gen = btrfs_node_ptr_generation(parent, slot + 1); | 1374 | gen = btrfs_node_ptr_generation(parent, slot + 1); |
| 1368 | eb = btrfs_find_tree_block(root, block2, blocksize); | 1375 | eb = btrfs_find_tree_block(root, block2, blocksize); |
| 1369 | if (eb && btrfs_buffer_uptodate(eb, gen)) | 1376 | if (eb && btrfs_buffer_uptodate(eb, gen, 1) != 0) |
| 1370 | block2 = 0; | 1377 | block2 = 0; |
| 1371 | free_extent_buffer(eb); | 1378 | free_extent_buffer(eb); |
| 1372 | } | 1379 | } |
| @@ -1504,8 +1511,9 @@ read_block_for_search(struct btrfs_trans_handle *trans, | |||
| 1504 | 1511 | ||
| 1505 | tmp = btrfs_find_tree_block(root, blocknr, blocksize); | 1512 | tmp = btrfs_find_tree_block(root, blocknr, blocksize); |
| 1506 | if (tmp) { | 1513 | if (tmp) { |
| 1507 | if (btrfs_buffer_uptodate(tmp, 0)) { | 1514 | /* first we do an atomic uptodate check */ |
| 1508 | if (btrfs_buffer_uptodate(tmp, gen)) { | 1515 | if (btrfs_buffer_uptodate(tmp, 0, 1) > 0) { |
| 1516 | if (btrfs_buffer_uptodate(tmp, gen, 1) > 0) { | ||
| 1509 | /* | 1517 | /* |
| 1510 | * we found an up to date block without | 1518 | * we found an up to date block without |
| 1511 | * sleeping, return | 1519 | * sleeping, return |
| @@ -1523,8 +1531,9 @@ read_block_for_search(struct btrfs_trans_handle *trans, | |||
| 1523 | free_extent_buffer(tmp); | 1531 | free_extent_buffer(tmp); |
| 1524 | btrfs_set_path_blocking(p); | 1532 | btrfs_set_path_blocking(p); |
| 1525 | 1533 | ||
| 1534 | /* now we're allowed to do a blocking uptodate check */ | ||
| 1526 | tmp = read_tree_block(root, blocknr, blocksize, gen); | 1535 | tmp = read_tree_block(root, blocknr, blocksize, gen); |
| 1527 | if (tmp && btrfs_buffer_uptodate(tmp, gen)) { | 1536 | if (tmp && btrfs_buffer_uptodate(tmp, gen, 0) > 0) { |
| 1528 | *eb_ret = tmp; | 1537 | *eb_ret = tmp; |
| 1529 | return 0; | 1538 | return 0; |
| 1530 | } | 1539 | } |
| @@ -1559,7 +1568,7 @@ read_block_for_search(struct btrfs_trans_handle *trans, | |||
| 1559 | * and give up so that our caller doesn't loop forever | 1568 | * and give up so that our caller doesn't loop forever |
| 1560 | * on our EAGAINs. | 1569 | * on our EAGAINs. |
| 1561 | */ | 1570 | */ |
| 1562 | if (!btrfs_buffer_uptodate(tmp, 0)) | 1571 | if (!btrfs_buffer_uptodate(tmp, 0, 0)) |
| 1563 | ret = -EIO; | 1572 | ret = -EIO; |
| 1564 | free_extent_buffer(tmp); | 1573 | free_extent_buffer(tmp); |
| 1565 | } | 1574 | } |
| @@ -4043,7 +4052,7 @@ again: | |||
| 4043 | tmp = btrfs_find_tree_block(root, blockptr, | 4052 | tmp = btrfs_find_tree_block(root, blockptr, |
| 4044 | btrfs_level_size(root, level - 1)); | 4053 | btrfs_level_size(root, level - 1)); |
| 4045 | 4054 | ||
| 4046 | if (tmp && btrfs_buffer_uptodate(tmp, gen)) { | 4055 | if (tmp && btrfs_buffer_uptodate(tmp, gen, 1) > 0) { |
| 4047 | free_extent_buffer(tmp); | 4056 | free_extent_buffer(tmp); |
| 4048 | break; | 4057 | break; |
| 4049 | } | 4058 | } |
| @@ -4166,7 +4175,8 @@ next: | |||
| 4166 | struct extent_buffer *cur; | 4175 | struct extent_buffer *cur; |
| 4167 | cur = btrfs_find_tree_block(root, blockptr, | 4176 | cur = btrfs_find_tree_block(root, blockptr, |
| 4168 | btrfs_level_size(root, level - 1)); | 4177 | btrfs_level_size(root, level - 1)); |
| 4169 | if (!cur || !btrfs_buffer_uptodate(cur, gen)) { | 4178 | if (!cur || |
| 4179 | btrfs_buffer_uptodate(cur, gen, 1) <= 0) { | ||
| 4170 | slot++; | 4180 | slot++; |
| 4171 | if (cur) | 4181 | if (cur) |
| 4172 | free_extent_buffer(cur); | 4182 | free_extent_buffer(cur); |
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index 5b8ef8eb3521..8fd72331d600 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h | |||
| @@ -1078,7 +1078,7 @@ struct btrfs_fs_info { | |||
| 1078 | * is required instead of the faster short fsync log commits | 1078 | * is required instead of the faster short fsync log commits |
| 1079 | */ | 1079 | */ |
| 1080 | u64 last_trans_log_full_commit; | 1080 | u64 last_trans_log_full_commit; |
| 1081 | unsigned long mount_opt:21; | 1081 | unsigned long mount_opt; |
| 1082 | unsigned long compress_type:4; | 1082 | unsigned long compress_type:4; |
| 1083 | u64 max_inline; | 1083 | u64 max_inline; |
| 1084 | u64 alloc_start; | 1084 | u64 alloc_start; |
| @@ -2166,7 +2166,7 @@ BTRFS_SETGET_STACK_FUNCS(root_last_snapshot, struct btrfs_root_item, | |||
| 2166 | 2166 | ||
| 2167 | static inline bool btrfs_root_readonly(struct btrfs_root *root) | 2167 | static inline bool btrfs_root_readonly(struct btrfs_root *root) |
| 2168 | { | 2168 | { |
| 2169 | return root->root_item.flags & BTRFS_ROOT_SUBVOL_RDONLY; | 2169 | return (root->root_item.flags & cpu_to_le64(BTRFS_ROOT_SUBVOL_RDONLY)) != 0; |
| 2170 | } | 2170 | } |
| 2171 | 2171 | ||
| 2172 | /* struct btrfs_root_backup */ | 2172 | /* struct btrfs_root_backup */ |
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 20196f411206..a7ffc88a7dbe 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c | |||
| @@ -323,7 +323,8 @@ static int csum_tree_block(struct btrfs_root *root, struct extent_buffer *buf, | |||
| 323 | * in the wrong place. | 323 | * in the wrong place. |
| 324 | */ | 324 | */ |
| 325 | static int verify_parent_transid(struct extent_io_tree *io_tree, | 325 | static int verify_parent_transid(struct extent_io_tree *io_tree, |
| 326 | struct extent_buffer *eb, u64 parent_transid) | 326 | struct extent_buffer *eb, u64 parent_transid, |
| 327 | int atomic) | ||
| 327 | { | 328 | { |
| 328 | struct extent_state *cached_state = NULL; | 329 | struct extent_state *cached_state = NULL; |
| 329 | int ret; | 330 | int ret; |
| @@ -331,6 +332,9 @@ static int verify_parent_transid(struct extent_io_tree *io_tree, | |||
| 331 | if (!parent_transid || btrfs_header_generation(eb) == parent_transid) | 332 | if (!parent_transid || btrfs_header_generation(eb) == parent_transid) |
| 332 | return 0; | 333 | return 0; |
| 333 | 334 | ||
| 335 | if (atomic) | ||
| 336 | return -EAGAIN; | ||
| 337 | |||
| 334 | lock_extent_bits(io_tree, eb->start, eb->start + eb->len - 1, | 338 | lock_extent_bits(io_tree, eb->start, eb->start + eb->len - 1, |
| 335 | 0, &cached_state); | 339 | 0, &cached_state); |
| 336 | if (extent_buffer_uptodate(eb) && | 340 | if (extent_buffer_uptodate(eb) && |
| @@ -372,7 +376,8 @@ static int btree_read_extent_buffer_pages(struct btrfs_root *root, | |||
| 372 | ret = read_extent_buffer_pages(io_tree, eb, start, | 376 | ret = read_extent_buffer_pages(io_tree, eb, start, |
| 373 | WAIT_COMPLETE, | 377 | WAIT_COMPLETE, |
| 374 | btree_get_extent, mirror_num); | 378 | btree_get_extent, mirror_num); |
| 375 | if (!ret && !verify_parent_transid(io_tree, eb, parent_transid)) | 379 | if (!ret && !verify_parent_transid(io_tree, eb, |
| 380 | parent_transid, 0)) | ||
| 376 | break; | 381 | break; |
| 377 | 382 | ||
| 378 | /* | 383 | /* |
| @@ -383,17 +388,16 @@ static int btree_read_extent_buffer_pages(struct btrfs_root *root, | |||
| 383 | if (test_bit(EXTENT_BUFFER_CORRUPT, &eb->bflags)) | 388 | if (test_bit(EXTENT_BUFFER_CORRUPT, &eb->bflags)) |
| 384 | break; | 389 | break; |
| 385 | 390 | ||
| 386 | if (!failed_mirror) { | ||
| 387 | failed = 1; | ||
| 388 | printk(KERN_ERR "failed mirror was %d\n", eb->failed_mirror); | ||
| 389 | failed_mirror = eb->failed_mirror; | ||
| 390 | } | ||
| 391 | |||
| 392 | num_copies = btrfs_num_copies(&root->fs_info->mapping_tree, | 391 | num_copies = btrfs_num_copies(&root->fs_info->mapping_tree, |
| 393 | eb->start, eb->len); | 392 | eb->start, eb->len); |
| 394 | if (num_copies == 1) | 393 | if (num_copies == 1) |
| 395 | break; | 394 | break; |
| 396 | 395 | ||
| 396 | if (!failed_mirror) { | ||
| 397 | failed = 1; | ||
| 398 | failed_mirror = eb->read_mirror; | ||
| 399 | } | ||
| 400 | |||
| 397 | mirror_num++; | 401 | mirror_num++; |
| 398 | if (mirror_num == failed_mirror) | 402 | if (mirror_num == failed_mirror) |
| 399 | mirror_num++; | 403 | mirror_num++; |
| @@ -564,7 +568,7 @@ struct extent_buffer *find_eb_for_page(struct extent_io_tree *tree, | |||
| 564 | } | 568 | } |
| 565 | 569 | ||
| 566 | static int btree_readpage_end_io_hook(struct page *page, u64 start, u64 end, | 570 | static int btree_readpage_end_io_hook(struct page *page, u64 start, u64 end, |
| 567 | struct extent_state *state) | 571 | struct extent_state *state, int mirror) |
| 568 | { | 572 | { |
| 569 | struct extent_io_tree *tree; | 573 | struct extent_io_tree *tree; |
| 570 | u64 found_start; | 574 | u64 found_start; |
| @@ -589,6 +593,7 @@ static int btree_readpage_end_io_hook(struct page *page, u64 start, u64 end, | |||
| 589 | if (!reads_done) | 593 | if (!reads_done) |
| 590 | goto err; | 594 | goto err; |
| 591 | 595 | ||
| 596 | eb->read_mirror = mirror; | ||
| 592 | if (test_bit(EXTENT_BUFFER_IOERR, &eb->bflags)) { | 597 | if (test_bit(EXTENT_BUFFER_IOERR, &eb->bflags)) { |
| 593 | ret = -EIO; | 598 | ret = -EIO; |
| 594 | goto err; | 599 | goto err; |
| @@ -652,7 +657,7 @@ static int btree_io_failed_hook(struct page *page, int failed_mirror) | |||
| 652 | 657 | ||
| 653 | eb = (struct extent_buffer *)page->private; | 658 | eb = (struct extent_buffer *)page->private; |
| 654 | set_bit(EXTENT_BUFFER_IOERR, &eb->bflags); | 659 | set_bit(EXTENT_BUFFER_IOERR, &eb->bflags); |
| 655 | eb->failed_mirror = failed_mirror; | 660 | eb->read_mirror = failed_mirror; |
| 656 | if (test_and_clear_bit(EXTENT_BUFFER_READAHEAD, &eb->bflags)) | 661 | if (test_and_clear_bit(EXTENT_BUFFER_READAHEAD, &eb->bflags)) |
| 657 | btree_readahead_hook(root, eb, eb->start, -EIO); | 662 | btree_readahead_hook(root, eb, eb->start, -EIO); |
| 658 | return -EIO; /* we fixed nothing */ | 663 | return -EIO; /* we fixed nothing */ |
| @@ -1202,7 +1207,7 @@ static int __must_check find_and_setup_root(struct btrfs_root *tree_root, | |||
| 1202 | root->commit_root = NULL; | 1207 | root->commit_root = NULL; |
| 1203 | root->node = read_tree_block(root, btrfs_root_bytenr(&root->root_item), | 1208 | root->node = read_tree_block(root, btrfs_root_bytenr(&root->root_item), |
| 1204 | blocksize, generation); | 1209 | blocksize, generation); |
| 1205 | if (!root->node || !btrfs_buffer_uptodate(root->node, generation)) { | 1210 | if (!root->node || !btrfs_buffer_uptodate(root->node, generation, 0)) { |
| 1206 | free_extent_buffer(root->node); | 1211 | free_extent_buffer(root->node); |
| 1207 | root->node = NULL; | 1212 | root->node = NULL; |
| 1208 | return -EIO; | 1213 | return -EIO; |
| @@ -2254,9 +2259,9 @@ int open_ctree(struct super_block *sb, | |||
| 2254 | goto fail_sb_buffer; | 2259 | goto fail_sb_buffer; |
| 2255 | } | 2260 | } |
| 2256 | 2261 | ||
| 2257 | if (sectorsize < PAGE_SIZE) { | 2262 | if (sectorsize != PAGE_SIZE) { |
| 2258 | printk(KERN_WARNING "btrfs: Incompatible sector size " | 2263 | printk(KERN_WARNING "btrfs: Incompatible sector size(%lu) " |
| 2259 | "found on %s\n", sb->s_id); | 2264 | "found on %s\n", (unsigned long)sectorsize, sb->s_id); |
| 2260 | goto fail_sb_buffer; | 2265 | goto fail_sb_buffer; |
| 2261 | } | 2266 | } |
| 2262 | 2267 | ||
| @@ -3143,7 +3148,8 @@ int close_ctree(struct btrfs_root *root) | |||
| 3143 | return 0; | 3148 | return 0; |
| 3144 | } | 3149 | } |
| 3145 | 3150 | ||
| 3146 | int btrfs_buffer_uptodate(struct extent_buffer *buf, u64 parent_transid) | 3151 | int btrfs_buffer_uptodate(struct extent_buffer *buf, u64 parent_transid, |
| 3152 | int atomic) | ||
| 3147 | { | 3153 | { |
| 3148 | int ret; | 3154 | int ret; |
| 3149 | struct inode *btree_inode = buf->pages[0]->mapping->host; | 3155 | struct inode *btree_inode = buf->pages[0]->mapping->host; |
| @@ -3153,7 +3159,9 @@ int btrfs_buffer_uptodate(struct extent_buffer *buf, u64 parent_transid) | |||
| 3153 | return ret; | 3159 | return ret; |
| 3154 | 3160 | ||
| 3155 | ret = verify_parent_transid(&BTRFS_I(btree_inode)->io_tree, buf, | 3161 | ret = verify_parent_transid(&BTRFS_I(btree_inode)->io_tree, buf, |
| 3156 | parent_transid); | 3162 | parent_transid, atomic); |
| 3163 | if (ret == -EAGAIN) | ||
| 3164 | return ret; | ||
| 3157 | return !ret; | 3165 | return !ret; |
| 3158 | } | 3166 | } |
| 3159 | 3167 | ||
diff --git a/fs/btrfs/disk-io.h b/fs/btrfs/disk-io.h index a7ace1a2dd12..ab1830aaf0ed 100644 --- a/fs/btrfs/disk-io.h +++ b/fs/btrfs/disk-io.h | |||
| @@ -66,7 +66,8 @@ void btrfs_btree_balance_dirty(struct btrfs_root *root, unsigned long nr); | |||
| 66 | void __btrfs_btree_balance_dirty(struct btrfs_root *root, unsigned long nr); | 66 | void __btrfs_btree_balance_dirty(struct btrfs_root *root, unsigned long nr); |
| 67 | void btrfs_free_fs_root(struct btrfs_fs_info *fs_info, struct btrfs_root *root); | 67 | void btrfs_free_fs_root(struct btrfs_fs_info *fs_info, struct btrfs_root *root); |
| 68 | void btrfs_mark_buffer_dirty(struct extent_buffer *buf); | 68 | void btrfs_mark_buffer_dirty(struct extent_buffer *buf); |
| 69 | int btrfs_buffer_uptodate(struct extent_buffer *buf, u64 parent_transid); | 69 | int btrfs_buffer_uptodate(struct extent_buffer *buf, u64 parent_transid, |
| 70 | int atomic); | ||
| 70 | int btrfs_set_buffer_uptodate(struct extent_buffer *buf); | 71 | int btrfs_set_buffer_uptodate(struct extent_buffer *buf); |
| 71 | int btrfs_read_buffer(struct extent_buffer *buf, u64 parent_transid); | 72 | int btrfs_read_buffer(struct extent_buffer *buf, u64 parent_transid); |
| 72 | u32 btrfs_csum_data(struct btrfs_root *root, char *data, u32 seed, size_t len); | 73 | u32 btrfs_csum_data(struct btrfs_root *root, char *data, u32 seed, size_t len); |
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 2b35f8d14bb9..49fd7b66d57b 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c | |||
| @@ -2301,6 +2301,7 @@ static noinline int run_clustered_refs(struct btrfs_trans_handle *trans, | |||
| 2301 | 2301 | ||
| 2302 | if (ret) { | 2302 | if (ret) { |
| 2303 | printk(KERN_DEBUG "btrfs: run_delayed_extent_op returned %d\n", ret); | 2303 | printk(KERN_DEBUG "btrfs: run_delayed_extent_op returned %d\n", ret); |
| 2304 | spin_lock(&delayed_refs->lock); | ||
| 2304 | return ret; | 2305 | return ret; |
| 2305 | } | 2306 | } |
| 2306 | 2307 | ||
| @@ -2331,6 +2332,7 @@ static noinline int run_clustered_refs(struct btrfs_trans_handle *trans, | |||
| 2331 | 2332 | ||
| 2332 | if (ret) { | 2333 | if (ret) { |
| 2333 | printk(KERN_DEBUG "btrfs: run_one_delayed_ref returned %d\n", ret); | 2334 | printk(KERN_DEBUG "btrfs: run_one_delayed_ref returned %d\n", ret); |
| 2335 | spin_lock(&delayed_refs->lock); | ||
| 2334 | return ret; | 2336 | return ret; |
| 2335 | } | 2337 | } |
| 2336 | 2338 | ||
| @@ -3769,13 +3771,10 @@ again: | |||
| 3769 | */ | 3771 | */ |
| 3770 | if (current->journal_info) | 3772 | if (current->journal_info) |
| 3771 | return -EAGAIN; | 3773 | return -EAGAIN; |
| 3772 | ret = wait_event_interruptible(space_info->wait, | 3774 | ret = wait_event_killable(space_info->wait, !space_info->flush); |
| 3773 | !space_info->flush); | 3775 | /* Must have been killed, return */ |
| 3774 | /* Must have been interrupted, return */ | 3776 | if (ret) |
| 3775 | if (ret) { | ||
| 3776 | printk(KERN_DEBUG "btrfs: %s returning -EINTR\n", __func__); | ||
| 3777 | return -EINTR; | 3777 | return -EINTR; |
| 3778 | } | ||
| 3779 | 3778 | ||
| 3780 | spin_lock(&space_info->lock); | 3779 | spin_lock(&space_info->lock); |
| 3781 | } | 3780 | } |
| @@ -4215,8 +4214,8 @@ static void update_global_block_rsv(struct btrfs_fs_info *fs_info) | |||
| 4215 | 4214 | ||
| 4216 | num_bytes = calc_global_metadata_size(fs_info); | 4215 | num_bytes = calc_global_metadata_size(fs_info); |
| 4217 | 4216 | ||
| 4218 | spin_lock(&block_rsv->lock); | ||
| 4219 | spin_lock(&sinfo->lock); | 4217 | spin_lock(&sinfo->lock); |
| 4218 | spin_lock(&block_rsv->lock); | ||
| 4220 | 4219 | ||
| 4221 | block_rsv->size = num_bytes; | 4220 | block_rsv->size = num_bytes; |
| 4222 | 4221 | ||
| @@ -4242,8 +4241,8 @@ static void update_global_block_rsv(struct btrfs_fs_info *fs_info) | |||
| 4242 | block_rsv->full = 1; | 4241 | block_rsv->full = 1; |
| 4243 | } | 4242 | } |
| 4244 | 4243 | ||
| 4245 | spin_unlock(&sinfo->lock); | ||
| 4246 | spin_unlock(&block_rsv->lock); | 4244 | spin_unlock(&block_rsv->lock); |
| 4245 | spin_unlock(&sinfo->lock); | ||
| 4247 | } | 4246 | } |
| 4248 | 4247 | ||
| 4249 | static void init_global_block_rsv(struct btrfs_fs_info *fs_info) | 4248 | static void init_global_block_rsv(struct btrfs_fs_info *fs_info) |
| @@ -6569,7 +6568,7 @@ static noinline int do_walk_down(struct btrfs_trans_handle *trans, | |||
| 6569 | goto skip; | 6568 | goto skip; |
| 6570 | } | 6569 | } |
| 6571 | 6570 | ||
| 6572 | if (!btrfs_buffer_uptodate(next, generation)) { | 6571 | if (!btrfs_buffer_uptodate(next, generation, 0)) { |
| 6573 | btrfs_tree_unlock(next); | 6572 | btrfs_tree_unlock(next); |
| 6574 | free_extent_buffer(next); | 6573 | free_extent_buffer(next); |
| 6575 | next = NULL; | 6574 | next = NULL; |
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index cd4b5e400221..c9018a05036e 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c | |||
| @@ -402,20 +402,28 @@ static int split_state(struct extent_io_tree *tree, struct extent_state *orig, | |||
| 402 | return 0; | 402 | return 0; |
| 403 | } | 403 | } |
| 404 | 404 | ||
| 405 | static struct extent_state *next_state(struct extent_state *state) | ||
| 406 | { | ||
| 407 | struct rb_node *next = rb_next(&state->rb_node); | ||
| 408 | if (next) | ||
| 409 | return rb_entry(next, struct extent_state, rb_node); | ||
| 410 | else | ||
| 411 | return NULL; | ||
| 412 | } | ||
| 413 | |||
| 405 | /* | 414 | /* |
| 406 | * utility function to clear some bits in an extent state struct. | 415 | * utility function to clear some bits in an extent state struct. |
| 407 | * it will optionally wake up any one waiting on this state (wake == 1), or | 416 | * it will optionally wake up any one waiting on this state (wake == 1) |
| 408 | * forcibly remove the state from the tree (delete == 1). | ||
| 409 | * | 417 | * |
| 410 | * If no bits are set on the state struct after clearing things, the | 418 | * If no bits are set on the state struct after clearing things, the |
| 411 | * struct is freed and removed from the tree | 419 | * struct is freed and removed from the tree |
| 412 | */ | 420 | */ |
| 413 | static int clear_state_bit(struct extent_io_tree *tree, | 421 | static struct extent_state *clear_state_bit(struct extent_io_tree *tree, |
| 414 | struct extent_state *state, | 422 | struct extent_state *state, |
| 415 | int *bits, int wake) | 423 | int *bits, int wake) |
| 416 | { | 424 | { |
| 425 | struct extent_state *next; | ||
| 417 | int bits_to_clear = *bits & ~EXTENT_CTLBITS; | 426 | int bits_to_clear = *bits & ~EXTENT_CTLBITS; |
| 418 | int ret = state->state & bits_to_clear; | ||
| 419 | 427 | ||
| 420 | if ((bits_to_clear & EXTENT_DIRTY) && (state->state & EXTENT_DIRTY)) { | 428 | if ((bits_to_clear & EXTENT_DIRTY) && (state->state & EXTENT_DIRTY)) { |
| 421 | u64 range = state->end - state->start + 1; | 429 | u64 range = state->end - state->start + 1; |
| @@ -427,6 +435,7 @@ static int clear_state_bit(struct extent_io_tree *tree, | |||
| 427 | if (wake) | 435 | if (wake) |
| 428 | wake_up(&state->wq); | 436 | wake_up(&state->wq); |
| 429 | if (state->state == 0) { | 437 | if (state->state == 0) { |
| 438 | next = next_state(state); | ||
| 430 | if (state->tree) { | 439 | if (state->tree) { |
| 431 | rb_erase(&state->rb_node, &tree->state); | 440 | rb_erase(&state->rb_node, &tree->state); |
| 432 | state->tree = NULL; | 441 | state->tree = NULL; |
| @@ -436,8 +445,9 @@ static int clear_state_bit(struct extent_io_tree *tree, | |||
| 436 | } | 445 | } |
| 437 | } else { | 446 | } else { |
| 438 | merge_state(tree, state); | 447 | merge_state(tree, state); |
| 448 | next = next_state(state); | ||
| 439 | } | 449 | } |
| 440 | return ret; | 450 | return next; |
| 441 | } | 451 | } |
| 442 | 452 | ||
| 443 | static struct extent_state * | 453 | static struct extent_state * |
| @@ -476,7 +486,6 @@ int clear_extent_bit(struct extent_io_tree *tree, u64 start, u64 end, | |||
| 476 | struct extent_state *state; | 486 | struct extent_state *state; |
| 477 | struct extent_state *cached; | 487 | struct extent_state *cached; |
| 478 | struct extent_state *prealloc = NULL; | 488 | struct extent_state *prealloc = NULL; |
| 479 | struct rb_node *next_node; | ||
| 480 | struct rb_node *node; | 489 | struct rb_node *node; |
| 481 | u64 last_end; | 490 | u64 last_end; |
| 482 | int err; | 491 | int err; |
| @@ -528,14 +537,11 @@ hit_next: | |||
| 528 | WARN_ON(state->end < start); | 537 | WARN_ON(state->end < start); |
| 529 | last_end = state->end; | 538 | last_end = state->end; |
| 530 | 539 | ||
| 531 | if (state->end < end && !need_resched()) | ||
| 532 | next_node = rb_next(&state->rb_node); | ||
| 533 | else | ||
| 534 | next_node = NULL; | ||
| 535 | |||
| 536 | /* the state doesn't have the wanted bits, go ahead */ | 540 | /* the state doesn't have the wanted bits, go ahead */ |
| 537 | if (!(state->state & bits)) | 541 | if (!(state->state & bits)) { |
| 542 | state = next_state(state); | ||
| 538 | goto next; | 543 | goto next; |
| 544 | } | ||
| 539 | 545 | ||
| 540 | /* | 546 | /* |
| 541 | * | ---- desired range ---- | | 547 | * | ---- desired range ---- | |
| @@ -593,16 +599,13 @@ hit_next: | |||
| 593 | goto out; | 599 | goto out; |
| 594 | } | 600 | } |
| 595 | 601 | ||
| 596 | clear_state_bit(tree, state, &bits, wake); | 602 | state = clear_state_bit(tree, state, &bits, wake); |
| 597 | next: | 603 | next: |
| 598 | if (last_end == (u64)-1) | 604 | if (last_end == (u64)-1) |
| 599 | goto out; | 605 | goto out; |
| 600 | start = last_end + 1; | 606 | start = last_end + 1; |
| 601 | if (start <= end && next_node) { | 607 | if (start <= end && state && !need_resched()) |
| 602 | state = rb_entry(next_node, struct extent_state, | ||
| 603 | rb_node); | ||
| 604 | goto hit_next; | 608 | goto hit_next; |
| 605 | } | ||
| 606 | goto search_again; | 609 | goto search_again; |
| 607 | 610 | ||
| 608 | out: | 611 | out: |
| @@ -2301,7 +2304,7 @@ static void end_bio_extent_readpage(struct bio *bio, int err) | |||
| 2301 | u64 start; | 2304 | u64 start; |
| 2302 | u64 end; | 2305 | u64 end; |
| 2303 | int whole_page; | 2306 | int whole_page; |
| 2304 | int failed_mirror; | 2307 | int mirror; |
| 2305 | int ret; | 2308 | int ret; |
| 2306 | 2309 | ||
| 2307 | if (err) | 2310 | if (err) |
| @@ -2340,20 +2343,18 @@ static void end_bio_extent_readpage(struct bio *bio, int err) | |||
| 2340 | } | 2343 | } |
| 2341 | spin_unlock(&tree->lock); | 2344 | spin_unlock(&tree->lock); |
| 2342 | 2345 | ||
| 2346 | mirror = (int)(unsigned long)bio->bi_bdev; | ||
| 2343 | if (uptodate && tree->ops && tree->ops->readpage_end_io_hook) { | 2347 | if (uptodate && tree->ops && tree->ops->readpage_end_io_hook) { |
| 2344 | ret = tree->ops->readpage_end_io_hook(page, start, end, | 2348 | ret = tree->ops->readpage_end_io_hook(page, start, end, |
| 2345 | state); | 2349 | state, mirror); |
| 2346 | if (ret) | 2350 | if (ret) |
| 2347 | uptodate = 0; | 2351 | uptodate = 0; |
| 2348 | else | 2352 | else |
| 2349 | clean_io_failure(start, page); | 2353 | clean_io_failure(start, page); |
| 2350 | } | 2354 | } |
| 2351 | 2355 | ||
| 2352 | if (!uptodate) | ||
| 2353 | failed_mirror = (int)(unsigned long)bio->bi_bdev; | ||
| 2354 | |||
| 2355 | if (!uptodate && tree->ops && tree->ops->readpage_io_failed_hook) { | 2356 | if (!uptodate && tree->ops && tree->ops->readpage_io_failed_hook) { |
| 2356 | ret = tree->ops->readpage_io_failed_hook(page, failed_mirror); | 2357 | ret = tree->ops->readpage_io_failed_hook(page, mirror); |
| 2357 | if (!ret && !err && | 2358 | if (!ret && !err && |
| 2358 | test_bit(BIO_UPTODATE, &bio->bi_flags)) | 2359 | test_bit(BIO_UPTODATE, &bio->bi_flags)) |
| 2359 | uptodate = 1; | 2360 | uptodate = 1; |
| @@ -2368,8 +2369,7 @@ static void end_bio_extent_readpage(struct bio *bio, int err) | |||
| 2368 | * can't handle the error it will return -EIO and we | 2369 | * can't handle the error it will return -EIO and we |
| 2369 | * remain responsible for that page. | 2370 | * remain responsible for that page. |
| 2370 | */ | 2371 | */ |
| 2371 | ret = bio_readpage_error(bio, page, start, end, | 2372 | ret = bio_readpage_error(bio, page, start, end, mirror, NULL); |
| 2372 | failed_mirror, NULL); | ||
| 2373 | if (ret == 0) { | 2373 | if (ret == 0) { |
| 2374 | uptodate = | 2374 | uptodate = |
| 2375 | test_bit(BIO_UPTODATE, &bio->bi_flags); | 2375 | test_bit(BIO_UPTODATE, &bio->bi_flags); |
| @@ -4120,6 +4120,7 @@ struct extent_buffer *alloc_extent_buffer(struct extent_io_tree *tree, | |||
| 4120 | if (atomic_inc_not_zero(&exists->refs)) { | 4120 | if (atomic_inc_not_zero(&exists->refs)) { |
| 4121 | spin_unlock(&mapping->private_lock); | 4121 | spin_unlock(&mapping->private_lock); |
| 4122 | unlock_page(p); | 4122 | unlock_page(p); |
| 4123 | page_cache_release(p); | ||
| 4123 | mark_extent_buffer_accessed(exists); | 4124 | mark_extent_buffer_accessed(exists); |
| 4124 | goto free_eb; | 4125 | goto free_eb; |
| 4125 | } | 4126 | } |
| @@ -4199,8 +4200,7 @@ free_eb: | |||
| 4199 | unlock_page(eb->pages[i]); | 4200 | unlock_page(eb->pages[i]); |
| 4200 | } | 4201 | } |
| 4201 | 4202 | ||
| 4202 | if (!atomic_dec_and_test(&eb->refs)) | 4203 | WARN_ON(!atomic_dec_and_test(&eb->refs)); |
| 4203 | return exists; | ||
| 4204 | btrfs_release_extent_buffer(eb); | 4204 | btrfs_release_extent_buffer(eb); |
| 4205 | return exists; | 4205 | return exists; |
| 4206 | } | 4206 | } |
| @@ -4462,7 +4462,7 @@ int read_extent_buffer_pages(struct extent_io_tree *tree, | |||
| 4462 | } | 4462 | } |
| 4463 | 4463 | ||
| 4464 | clear_bit(EXTENT_BUFFER_IOERR, &eb->bflags); | 4464 | clear_bit(EXTENT_BUFFER_IOERR, &eb->bflags); |
| 4465 | eb->failed_mirror = 0; | 4465 | eb->read_mirror = 0; |
| 4466 | atomic_set(&eb->io_pages, num_reads); | 4466 | atomic_set(&eb->io_pages, num_reads); |
| 4467 | for (i = start_i; i < num_pages; i++) { | 4467 | for (i = start_i; i < num_pages; i++) { |
| 4468 | page = extent_buffer_page(eb, i); | 4468 | page = extent_buffer_page(eb, i); |
diff --git a/fs/btrfs/extent_io.h b/fs/btrfs/extent_io.h index faf10eb57f75..b516c3b8dec6 100644 --- a/fs/btrfs/extent_io.h +++ b/fs/btrfs/extent_io.h | |||
| @@ -79,7 +79,7 @@ struct extent_io_ops { | |||
| 79 | u64 start, u64 end, | 79 | u64 start, u64 end, |
| 80 | struct extent_state *state); | 80 | struct extent_state *state); |
| 81 | int (*readpage_end_io_hook)(struct page *page, u64 start, u64 end, | 81 | int (*readpage_end_io_hook)(struct page *page, u64 start, u64 end, |
| 82 | struct extent_state *state); | 82 | struct extent_state *state, int mirror); |
| 83 | int (*writepage_end_io_hook)(struct page *page, u64 start, u64 end, | 83 | int (*writepage_end_io_hook)(struct page *page, u64 start, u64 end, |
| 84 | struct extent_state *state, int uptodate); | 84 | struct extent_state *state, int uptodate); |
| 85 | void (*set_bit_hook)(struct inode *inode, struct extent_state *state, | 85 | void (*set_bit_hook)(struct inode *inode, struct extent_state *state, |
| @@ -135,7 +135,7 @@ struct extent_buffer { | |||
| 135 | spinlock_t refs_lock; | 135 | spinlock_t refs_lock; |
| 136 | atomic_t refs; | 136 | atomic_t refs; |
| 137 | atomic_t io_pages; | 137 | atomic_t io_pages; |
| 138 | int failed_mirror; | 138 | int read_mirror; |
| 139 | struct list_head leak_list; | 139 | struct list_head leak_list; |
| 140 | struct rcu_head rcu_head; | 140 | struct rcu_head rcu_head; |
| 141 | pid_t lock_owner; | 141 | pid_t lock_owner; |
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index d83260d7498f..53bf2d764bbc 100644 --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c | |||
| @@ -567,6 +567,7 @@ int btrfs_drop_extents(struct btrfs_trans_handle *trans, struct inode *inode, | |||
| 567 | int extent_type; | 567 | int extent_type; |
| 568 | int recow; | 568 | int recow; |
| 569 | int ret; | 569 | int ret; |
| 570 | int modify_tree = -1; | ||
| 570 | 571 | ||
| 571 | if (drop_cache) | 572 | if (drop_cache) |
| 572 | btrfs_drop_extent_cache(inode, start, end - 1, 0); | 573 | btrfs_drop_extent_cache(inode, start, end - 1, 0); |
| @@ -575,10 +576,13 @@ int btrfs_drop_extents(struct btrfs_trans_handle *trans, struct inode *inode, | |||
| 575 | if (!path) | 576 | if (!path) |
| 576 | return -ENOMEM; | 577 | return -ENOMEM; |
| 577 | 578 | ||
| 579 | if (start >= BTRFS_I(inode)->disk_i_size) | ||
| 580 | modify_tree = 0; | ||
| 581 | |||
| 578 | while (1) { | 582 | while (1) { |
| 579 | recow = 0; | 583 | recow = 0; |
| 580 | ret = btrfs_lookup_file_extent(trans, root, path, ino, | 584 | ret = btrfs_lookup_file_extent(trans, root, path, ino, |
| 581 | search_start, -1); | 585 | search_start, modify_tree); |
| 582 | if (ret < 0) | 586 | if (ret < 0) |
| 583 | break; | 587 | break; |
| 584 | if (ret > 0 && path->slots[0] > 0 && search_start == start) { | 588 | if (ret > 0 && path->slots[0] > 0 && search_start == start) { |
| @@ -634,7 +638,8 @@ next_slot: | |||
| 634 | } | 638 | } |
| 635 | 639 | ||
| 636 | search_start = max(key.offset, start); | 640 | search_start = max(key.offset, start); |
| 637 | if (recow) { | 641 | if (recow || !modify_tree) { |
| 642 | modify_tree = -1; | ||
| 638 | btrfs_release_path(path); | 643 | btrfs_release_path(path); |
| 639 | continue; | 644 | continue; |
| 640 | } | 645 | } |
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 115bc05e42b0..61b16c641ce0 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
| @@ -1947,7 +1947,7 @@ static int btrfs_writepage_end_io_hook(struct page *page, u64 start, u64 end, | |||
| 1947 | * extent_io.c will try to find good copies for us. | 1947 | * extent_io.c will try to find good copies for us. |
| 1948 | */ | 1948 | */ |
| 1949 | static int btrfs_readpage_end_io_hook(struct page *page, u64 start, u64 end, | 1949 | static int btrfs_readpage_end_io_hook(struct page *page, u64 start, u64 end, |
| 1950 | struct extent_state *state) | 1950 | struct extent_state *state, int mirror) |
| 1951 | { | 1951 | { |
| 1952 | size_t offset = start - ((u64)page->index << PAGE_CACHE_SHIFT); | 1952 | size_t offset = start - ((u64)page->index << PAGE_CACHE_SHIFT); |
| 1953 | struct inode *inode = page->mapping->host; | 1953 | struct inode *inode = page->mapping->host; |
| @@ -4069,7 +4069,7 @@ static struct inode *new_simple_dir(struct super_block *s, | |||
| 4069 | BTRFS_I(inode)->dummy_inode = 1; | 4069 | BTRFS_I(inode)->dummy_inode = 1; |
| 4070 | 4070 | ||
| 4071 | inode->i_ino = BTRFS_EMPTY_SUBVOL_DIR_OBJECTID; | 4071 | inode->i_ino = BTRFS_EMPTY_SUBVOL_DIR_OBJECTID; |
| 4072 | inode->i_op = &simple_dir_inode_operations; | 4072 | inode->i_op = &btrfs_dir_ro_inode_operations; |
| 4073 | inode->i_fop = &simple_dir_operations; | 4073 | inode->i_fop = &simple_dir_operations; |
| 4074 | inode->i_mode = S_IFDIR | S_IRUGO | S_IWUSR | S_IXUGO; | 4074 | inode->i_mode = S_IFDIR | S_IRUGO | S_IWUSR | S_IXUGO; |
| 4075 | inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME; | 4075 | inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME; |
| @@ -4140,14 +4140,18 @@ struct inode *btrfs_lookup_dentry(struct inode *dir, struct dentry *dentry) | |||
| 4140 | static int btrfs_dentry_delete(const struct dentry *dentry) | 4140 | static int btrfs_dentry_delete(const struct dentry *dentry) |
| 4141 | { | 4141 | { |
| 4142 | struct btrfs_root *root; | 4142 | struct btrfs_root *root; |
| 4143 | struct inode *inode = dentry->d_inode; | ||
| 4143 | 4144 | ||
| 4144 | if (!dentry->d_inode && !IS_ROOT(dentry)) | 4145 | if (!inode && !IS_ROOT(dentry)) |
| 4145 | dentry = dentry->d_parent; | 4146 | inode = dentry->d_parent->d_inode; |
| 4146 | 4147 | ||
| 4147 | if (dentry->d_inode) { | 4148 | if (inode) { |
| 4148 | root = BTRFS_I(dentry->d_inode)->root; | 4149 | root = BTRFS_I(inode)->root; |
| 4149 | if (btrfs_root_refs(&root->root_item) == 0) | 4150 | if (btrfs_root_refs(&root->root_item) == 0) |
| 4150 | return 1; | 4151 | return 1; |
| 4152 | |||
| 4153 | if (btrfs_ino(inode) == BTRFS_EMPTY_SUBVOL_DIR_OBJECTID) | ||
| 4154 | return 1; | ||
| 4151 | } | 4155 | } |
| 4152 | return 0; | 4156 | return 0; |
| 4153 | } | 4157 | } |
| @@ -4188,7 +4192,6 @@ static int btrfs_real_readdir(struct file *filp, void *dirent, | |||
| 4188 | struct btrfs_path *path; | 4192 | struct btrfs_path *path; |
| 4189 | struct list_head ins_list; | 4193 | struct list_head ins_list; |
| 4190 | struct list_head del_list; | 4194 | struct list_head del_list; |
| 4191 | struct qstr q; | ||
| 4192 | int ret; | 4195 | int ret; |
| 4193 | struct extent_buffer *leaf; | 4196 | struct extent_buffer *leaf; |
| 4194 | int slot; | 4197 | int slot; |
| @@ -4279,7 +4282,6 @@ static int btrfs_real_readdir(struct file *filp, void *dirent, | |||
| 4279 | 4282 | ||
| 4280 | while (di_cur < di_total) { | 4283 | while (di_cur < di_total) { |
| 4281 | struct btrfs_key location; | 4284 | struct btrfs_key location; |
| 4282 | struct dentry *tmp; | ||
| 4283 | 4285 | ||
| 4284 | if (verify_dir_item(root, leaf, di)) | 4286 | if (verify_dir_item(root, leaf, di)) |
| 4285 | break; | 4287 | break; |
| @@ -4300,35 +4302,15 @@ static int btrfs_real_readdir(struct file *filp, void *dirent, | |||
| 4300 | d_type = btrfs_filetype_table[btrfs_dir_type(leaf, di)]; | 4302 | d_type = btrfs_filetype_table[btrfs_dir_type(leaf, di)]; |
| 4301 | btrfs_dir_item_key_to_cpu(leaf, di, &location); | 4303 | btrfs_dir_item_key_to_cpu(leaf, di, &location); |
| 4302 | 4304 | ||
| 4303 | q.name = name_ptr; | 4305 | |
| 4304 | q.len = name_len; | ||
| 4305 | q.hash = full_name_hash(q.name, q.len); | ||
| 4306 | tmp = d_lookup(filp->f_dentry, &q); | ||
| 4307 | if (!tmp) { | ||
| 4308 | struct btrfs_key *newkey; | ||
| 4309 | |||
| 4310 | newkey = kzalloc(sizeof(struct btrfs_key), | ||
| 4311 | GFP_NOFS); | ||
| 4312 | if (!newkey) | ||
| 4313 | goto no_dentry; | ||
| 4314 | tmp = d_alloc(filp->f_dentry, &q); | ||
| 4315 | if (!tmp) { | ||
| 4316 | kfree(newkey); | ||
| 4317 | dput(tmp); | ||
| 4318 | goto no_dentry; | ||
| 4319 | } | ||
| 4320 | memcpy(newkey, &location, | ||
| 4321 | sizeof(struct btrfs_key)); | ||
| 4322 | tmp->d_fsdata = newkey; | ||
| 4323 | tmp->d_flags |= DCACHE_NEED_LOOKUP; | ||
| 4324 | d_rehash(tmp); | ||
| 4325 | dput(tmp); | ||
| 4326 | } else { | ||
| 4327 | dput(tmp); | ||
| 4328 | } | ||
| 4329 | no_dentry: | ||
| 4330 | /* is this a reference to our own snapshot? If so | 4306 | /* is this a reference to our own snapshot? If so |
| 4331 | * skip it | 4307 | * skip it. |
| 4308 | * | ||
| 4309 | * In contrast to old kernels, we insert the snapshot's | ||
| 4310 | * dir item and dir index after it has been created, so | ||
| 4311 | * we won't find a reference to our own snapshot. We | ||
| 4312 | * still keep the following code for backward | ||
| 4313 | * compatibility. | ||
| 4332 | */ | 4314 | */ |
| 4333 | if (location.type == BTRFS_ROOT_ITEM_KEY && | 4315 | if (location.type == BTRFS_ROOT_ITEM_KEY && |
| 4334 | location.objectid == root->root_key.objectid) { | 4316 | location.objectid == root->root_key.objectid) { |
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index 18cc23d164a8..14f8e1faa46e 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c | |||
| @@ -2262,7 +2262,10 @@ static long btrfs_ioctl_dev_info(struct btrfs_root *root, void __user *arg) | |||
| 2262 | di_args->bytes_used = dev->bytes_used; | 2262 | di_args->bytes_used = dev->bytes_used; |
| 2263 | di_args->total_bytes = dev->total_bytes; | 2263 | di_args->total_bytes = dev->total_bytes; |
| 2264 | memcpy(di_args->uuid, dev->uuid, sizeof(di_args->uuid)); | 2264 | memcpy(di_args->uuid, dev->uuid, sizeof(di_args->uuid)); |
| 2265 | strncpy(di_args->path, dev->name, sizeof(di_args->path)); | 2265 | if (dev->name) |
| 2266 | strncpy(di_args->path, dev->name, sizeof(di_args->path)); | ||
| 2267 | else | ||
| 2268 | di_args->path[0] = '\0'; | ||
| 2266 | 2269 | ||
| 2267 | out: | 2270 | out: |
| 2268 | if (ret == 0 && copy_to_user(arg, di_args, sizeof(*di_args))) | 2271 | if (ret == 0 && copy_to_user(arg, di_args, sizeof(*di_args))) |
diff --git a/fs/btrfs/ioctl.h b/fs/btrfs/ioctl.h index 4f69028a68c4..086e6bdae1c4 100644 --- a/fs/btrfs/ioctl.h +++ b/fs/btrfs/ioctl.h | |||
| @@ -252,7 +252,7 @@ struct btrfs_data_container { | |||
| 252 | 252 | ||
| 253 | struct btrfs_ioctl_ino_path_args { | 253 | struct btrfs_ioctl_ino_path_args { |
| 254 | __u64 inum; /* in */ | 254 | __u64 inum; /* in */ |
| 255 | __u32 size; /* in */ | 255 | __u64 size; /* in */ |
| 256 | __u64 reserved[4]; | 256 | __u64 reserved[4]; |
| 257 | /* struct btrfs_data_container *fspath; out */ | 257 | /* struct btrfs_data_container *fspath; out */ |
| 258 | __u64 fspath; /* out */ | 258 | __u64 fspath; /* out */ |
| @@ -260,7 +260,7 @@ struct btrfs_ioctl_ino_path_args { | |||
| 260 | 260 | ||
| 261 | struct btrfs_ioctl_logical_ino_args { | 261 | struct btrfs_ioctl_logical_ino_args { |
| 262 | __u64 logical; /* in */ | 262 | __u64 logical; /* in */ |
| 263 | __u32 size; /* in */ | 263 | __u64 size; /* in */ |
| 264 | __u64 reserved[4]; | 264 | __u64 reserved[4]; |
| 265 | /* struct btrfs_data_container *inodes; out */ | 265 | /* struct btrfs_data_container *inodes; out */ |
| 266 | __u64 inodes; | 266 | __u64 inodes; |
diff --git a/fs/btrfs/reada.c b/fs/btrfs/reada.c index dc5d33146fdb..ac5d01085884 100644 --- a/fs/btrfs/reada.c +++ b/fs/btrfs/reada.c | |||
| @@ -250,14 +250,12 @@ static struct reada_zone *reada_find_zone(struct btrfs_fs_info *fs_info, | |||
| 250 | struct btrfs_bio *bbio) | 250 | struct btrfs_bio *bbio) |
| 251 | { | 251 | { |
| 252 | int ret; | 252 | int ret; |
| 253 | int looped = 0; | ||
| 254 | struct reada_zone *zone; | 253 | struct reada_zone *zone; |
| 255 | struct btrfs_block_group_cache *cache = NULL; | 254 | struct btrfs_block_group_cache *cache = NULL; |
| 256 | u64 start; | 255 | u64 start; |
| 257 | u64 end; | 256 | u64 end; |
| 258 | int i; | 257 | int i; |
| 259 | 258 | ||
| 260 | again: | ||
| 261 | zone = NULL; | 259 | zone = NULL; |
| 262 | spin_lock(&fs_info->reada_lock); | 260 | spin_lock(&fs_info->reada_lock); |
| 263 | ret = radix_tree_gang_lookup(&dev->reada_zones, (void **)&zone, | 261 | ret = radix_tree_gang_lookup(&dev->reada_zones, (void **)&zone, |
| @@ -274,9 +272,6 @@ again: | |||
| 274 | spin_unlock(&fs_info->reada_lock); | 272 | spin_unlock(&fs_info->reada_lock); |
| 275 | } | 273 | } |
| 276 | 274 | ||
| 277 | if (looped) | ||
| 278 | return NULL; | ||
| 279 | |||
| 280 | cache = btrfs_lookup_block_group(fs_info, logical); | 275 | cache = btrfs_lookup_block_group(fs_info, logical); |
| 281 | if (!cache) | 276 | if (!cache) |
| 282 | return NULL; | 277 | return NULL; |
| @@ -307,13 +302,15 @@ again: | |||
| 307 | ret = radix_tree_insert(&dev->reada_zones, | 302 | ret = radix_tree_insert(&dev->reada_zones, |
| 308 | (unsigned long)(zone->end >> PAGE_CACHE_SHIFT), | 303 | (unsigned long)(zone->end >> PAGE_CACHE_SHIFT), |
| 309 | zone); | 304 | zone); |
| 310 | spin_unlock(&fs_info->reada_lock); | ||
| 311 | 305 | ||
| 312 | if (ret) { | 306 | if (ret == -EEXIST) { |
| 313 | kfree(zone); | 307 | kfree(zone); |
| 314 | looped = 1; | 308 | ret = radix_tree_gang_lookup(&dev->reada_zones, (void **)&zone, |
| 315 | goto again; | 309 | logical >> PAGE_CACHE_SHIFT, 1); |
| 310 | if (ret == 1) | ||
| 311 | kref_get(&zone->refcnt); | ||
| 316 | } | 312 | } |
| 313 | spin_unlock(&fs_info->reada_lock); | ||
| 317 | 314 | ||
| 318 | return zone; | 315 | return zone; |
| 319 | } | 316 | } |
| @@ -323,26 +320,26 @@ static struct reada_extent *reada_find_extent(struct btrfs_root *root, | |||
| 323 | struct btrfs_key *top, int level) | 320 | struct btrfs_key *top, int level) |
| 324 | { | 321 | { |
| 325 | int ret; | 322 | int ret; |
| 326 | int looped = 0; | ||
| 327 | struct reada_extent *re = NULL; | 323 | struct reada_extent *re = NULL; |
| 324 | struct reada_extent *re_exist = NULL; | ||
| 328 | struct btrfs_fs_info *fs_info = root->fs_info; | 325 | struct btrfs_fs_info *fs_info = root->fs_info; |
| 329 | struct btrfs_mapping_tree *map_tree = &fs_info->mapping_tree; | 326 | struct btrfs_mapping_tree *map_tree = &fs_info->mapping_tree; |
| 330 | struct btrfs_bio *bbio = NULL; | 327 | struct btrfs_bio *bbio = NULL; |
| 331 | struct btrfs_device *dev; | 328 | struct btrfs_device *dev; |
| 329 | struct btrfs_device *prev_dev; | ||
| 332 | u32 blocksize; | 330 | u32 blocksize; |
| 333 | u64 length; | 331 | u64 length; |
| 334 | int nzones = 0; | 332 | int nzones = 0; |
| 335 | int i; | 333 | int i; |
| 336 | unsigned long index = logical >> PAGE_CACHE_SHIFT; | 334 | unsigned long index = logical >> PAGE_CACHE_SHIFT; |
| 337 | 335 | ||
| 338 | again: | ||
| 339 | spin_lock(&fs_info->reada_lock); | 336 | spin_lock(&fs_info->reada_lock); |
| 340 | re = radix_tree_lookup(&fs_info->reada_tree, index); | 337 | re = radix_tree_lookup(&fs_info->reada_tree, index); |
| 341 | if (re) | 338 | if (re) |
| 342 | kref_get(&re->refcnt); | 339 | kref_get(&re->refcnt); |
| 343 | spin_unlock(&fs_info->reada_lock); | 340 | spin_unlock(&fs_info->reada_lock); |
| 344 | 341 | ||
| 345 | if (re || looped) | 342 | if (re) |
| 346 | return re; | 343 | return re; |
| 347 | 344 | ||
| 348 | re = kzalloc(sizeof(*re), GFP_NOFS); | 345 | re = kzalloc(sizeof(*re), GFP_NOFS); |
| @@ -398,16 +395,31 @@ again: | |||
| 398 | /* insert extent in reada_tree + all per-device trees, all or nothing */ | 395 | /* insert extent in reada_tree + all per-device trees, all or nothing */ |
| 399 | spin_lock(&fs_info->reada_lock); | 396 | spin_lock(&fs_info->reada_lock); |
| 400 | ret = radix_tree_insert(&fs_info->reada_tree, index, re); | 397 | ret = radix_tree_insert(&fs_info->reada_tree, index, re); |
| 398 | if (ret == -EEXIST) { | ||
| 399 | re_exist = radix_tree_lookup(&fs_info->reada_tree, index); | ||
| 400 | BUG_ON(!re_exist); | ||
| 401 | kref_get(&re_exist->refcnt); | ||
| 402 | spin_unlock(&fs_info->reada_lock); | ||
| 403 | goto error; | ||
| 404 | } | ||
| 401 | if (ret) { | 405 | if (ret) { |
| 402 | spin_unlock(&fs_info->reada_lock); | 406 | spin_unlock(&fs_info->reada_lock); |
| 403 | if (ret != -ENOMEM) { | ||
| 404 | /* someone inserted the extent in the meantime */ | ||
| 405 | looped = 1; | ||
| 406 | } | ||
| 407 | goto error; | 407 | goto error; |
| 408 | } | 408 | } |
| 409 | prev_dev = NULL; | ||
| 409 | for (i = 0; i < nzones; ++i) { | 410 | for (i = 0; i < nzones; ++i) { |
| 410 | dev = bbio->stripes[i].dev; | 411 | dev = bbio->stripes[i].dev; |
| 412 | if (dev == prev_dev) { | ||
| 413 | /* | ||
| 414 | * in case of DUP, just add the first zone. As both | ||
| 415 | * are on the same device, there's nothing to gain | ||
| 416 | * from adding both. | ||
| 417 | * Also, it wouldn't work, as the tree is per device | ||
| 418 | * and adding would fail with EEXIST | ||
| 419 | */ | ||
| 420 | continue; | ||
| 421 | } | ||
| 422 | prev_dev = dev; | ||
| 411 | ret = radix_tree_insert(&dev->reada_extents, index, re); | 423 | ret = radix_tree_insert(&dev->reada_extents, index, re); |
| 412 | if (ret) { | 424 | if (ret) { |
| 413 | while (--i >= 0) { | 425 | while (--i >= 0) { |
| @@ -450,9 +462,7 @@ error: | |||
| 450 | } | 462 | } |
| 451 | kfree(bbio); | 463 | kfree(bbio); |
| 452 | kfree(re); | 464 | kfree(re); |
| 453 | if (looped) | 465 | return re_exist; |
| 454 | goto again; | ||
| 455 | return NULL; | ||
| 456 | } | 466 | } |
| 457 | 467 | ||
| 458 | static void reada_kref_dummy(struct kref *kr) | 468 | static void reada_kref_dummy(struct kref *kr) |
diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c index 017281dbb2a7..646ee21bb035 100644 --- a/fs/btrfs/relocation.c +++ b/fs/btrfs/relocation.c | |||
| @@ -1279,7 +1279,9 @@ static int __update_reloc_root(struct btrfs_root *root, int del) | |||
| 1279 | if (rb_node) | 1279 | if (rb_node) |
| 1280 | backref_tree_panic(rb_node, -EEXIST, node->bytenr); | 1280 | backref_tree_panic(rb_node, -EEXIST, node->bytenr); |
| 1281 | } else { | 1281 | } else { |
| 1282 | spin_lock(&root->fs_info->trans_lock); | ||
| 1282 | list_del_init(&root->root_list); | 1283 | list_del_init(&root->root_list); |
| 1284 | spin_unlock(&root->fs_info->trans_lock); | ||
| 1283 | kfree(node); | 1285 | kfree(node); |
| 1284 | } | 1286 | } |
| 1285 | return 0; | 1287 | return 0; |
| @@ -3811,7 +3813,7 @@ restart: | |||
| 3811 | 3813 | ||
| 3812 | ret = btrfs_block_rsv_check(rc->extent_root, rc->block_rsv, 5); | 3814 | ret = btrfs_block_rsv_check(rc->extent_root, rc->block_rsv, 5); |
| 3813 | if (ret < 0) { | 3815 | if (ret < 0) { |
| 3814 | if (ret != -EAGAIN) { | 3816 | if (ret != -ENOSPC) { |
| 3815 | err = ret; | 3817 | err = ret; |
| 3816 | WARN_ON(1); | 3818 | WARN_ON(1); |
| 3817 | break; | 3819 | break; |
diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c index bc015f77f3ea..2f3d6f917fb3 100644 --- a/fs/btrfs/scrub.c +++ b/fs/btrfs/scrub.c | |||
| @@ -998,6 +998,7 @@ static int scrub_setup_recheck_block(struct scrub_dev *sdev, | |||
| 998 | page = sblock->pagev + page_index; | 998 | page = sblock->pagev + page_index; |
| 999 | page->logical = logical; | 999 | page->logical = logical; |
| 1000 | page->physical = bbio->stripes[mirror_index].physical; | 1000 | page->physical = bbio->stripes[mirror_index].physical; |
| 1001 | /* for missing devices, bdev is NULL */ | ||
| 1001 | page->bdev = bbio->stripes[mirror_index].dev->bdev; | 1002 | page->bdev = bbio->stripes[mirror_index].dev->bdev; |
| 1002 | page->mirror_num = mirror_index + 1; | 1003 | page->mirror_num = mirror_index + 1; |
| 1003 | page->page = alloc_page(GFP_NOFS); | 1004 | page->page = alloc_page(GFP_NOFS); |
| @@ -1042,6 +1043,12 @@ static int scrub_recheck_block(struct btrfs_fs_info *fs_info, | |||
| 1042 | struct scrub_page *page = sblock->pagev + page_num; | 1043 | struct scrub_page *page = sblock->pagev + page_num; |
| 1043 | DECLARE_COMPLETION_ONSTACK(complete); | 1044 | DECLARE_COMPLETION_ONSTACK(complete); |
| 1044 | 1045 | ||
| 1046 | if (page->bdev == NULL) { | ||
| 1047 | page->io_error = 1; | ||
| 1048 | sblock->no_io_error_seen = 0; | ||
| 1049 | continue; | ||
| 1050 | } | ||
| 1051 | |||
| 1045 | BUG_ON(!page->page); | 1052 | BUG_ON(!page->page); |
| 1046 | bio = bio_alloc(GFP_NOFS, 1); | 1053 | bio = bio_alloc(GFP_NOFS, 1); |
| 1047 | if (!bio) | 1054 | if (!bio) |
| @@ -1257,12 +1264,6 @@ static int scrub_checksum_data(struct scrub_block *sblock) | |||
| 1257 | if (memcmp(csum, on_disk_csum, sdev->csum_size)) | 1264 | if (memcmp(csum, on_disk_csum, sdev->csum_size)) |
| 1258 | fail = 1; | 1265 | fail = 1; |
| 1259 | 1266 | ||
| 1260 | if (fail) { | ||
| 1261 | spin_lock(&sdev->stat_lock); | ||
| 1262 | ++sdev->stat.csum_errors; | ||
| 1263 | spin_unlock(&sdev->stat_lock); | ||
| 1264 | } | ||
| 1265 | |||
| 1266 | return fail; | 1267 | return fail; |
| 1267 | } | 1268 | } |
| 1268 | 1269 | ||
| @@ -1335,15 +1336,6 @@ static int scrub_checksum_tree_block(struct scrub_block *sblock) | |||
| 1335 | if (memcmp(calculated_csum, on_disk_csum, sdev->csum_size)) | 1336 | if (memcmp(calculated_csum, on_disk_csum, sdev->csum_size)) |
| 1336 | ++crc_fail; | 1337 | ++crc_fail; |
| 1337 | 1338 | ||
| 1338 | if (crc_fail || fail) { | ||
| 1339 | spin_lock(&sdev->stat_lock); | ||
| 1340 | if (crc_fail) | ||
| 1341 | ++sdev->stat.csum_errors; | ||
| 1342 | if (fail) | ||
| 1343 | ++sdev->stat.verify_errors; | ||
| 1344 | spin_unlock(&sdev->stat_lock); | ||
| 1345 | } | ||
| 1346 | |||
| 1347 | return fail || crc_fail; | 1339 | return fail || crc_fail; |
| 1348 | } | 1340 | } |
| 1349 | 1341 | ||
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index 8d5d380f7bdb..c5f8fca4195f 100644 --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c | |||
| @@ -815,7 +815,6 @@ int btrfs_sync_fs(struct super_block *sb, int wait) | |||
| 815 | return 0; | 815 | return 0; |
| 816 | } | 816 | } |
| 817 | 817 | ||
| 818 | btrfs_start_delalloc_inodes(root, 0); | ||
| 819 | btrfs_wait_ordered_extents(root, 0, 0); | 818 | btrfs_wait_ordered_extents(root, 0, 0); |
| 820 | 819 | ||
| 821 | trans = btrfs_start_transaction(root, 0); | 820 | trans = btrfs_start_transaction(root, 0); |
| @@ -1148,13 +1147,15 @@ static int btrfs_remount(struct super_block *sb, int *flags, char *data) | |||
| 1148 | if (ret) | 1147 | if (ret) |
| 1149 | goto restore; | 1148 | goto restore; |
| 1150 | } else { | 1149 | } else { |
| 1151 | if (fs_info->fs_devices->rw_devices == 0) | 1150 | if (fs_info->fs_devices->rw_devices == 0) { |
| 1152 | ret = -EACCES; | 1151 | ret = -EACCES; |
| 1153 | goto restore; | 1152 | goto restore; |
| 1153 | } | ||
| 1154 | 1154 | ||
| 1155 | if (btrfs_super_log_root(fs_info->super_copy) != 0) | 1155 | if (btrfs_super_log_root(fs_info->super_copy) != 0) { |
| 1156 | ret = -EINVAL; | 1156 | ret = -EINVAL; |
| 1157 | goto restore; | 1157 | goto restore; |
| 1158 | } | ||
| 1158 | 1159 | ||
| 1159 | ret = btrfs_cleanup_fs_roots(fs_info); | 1160 | ret = btrfs_cleanup_fs_roots(fs_info); |
| 1160 | if (ret) | 1161 | if (ret) |
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c index 11b77a59db62..36422254ef67 100644 --- a/fs/btrfs/transaction.c +++ b/fs/btrfs/transaction.c | |||
| @@ -73,8 +73,10 @@ loop: | |||
| 73 | 73 | ||
| 74 | cur_trans = root->fs_info->running_transaction; | 74 | cur_trans = root->fs_info->running_transaction; |
| 75 | if (cur_trans) { | 75 | if (cur_trans) { |
| 76 | if (cur_trans->aborted) | 76 | if (cur_trans->aborted) { |
| 77 | spin_unlock(&root->fs_info->trans_lock); | ||
| 77 | return cur_trans->aborted; | 78 | return cur_trans->aborted; |
| 79 | } | ||
| 78 | atomic_inc(&cur_trans->use_count); | 80 | atomic_inc(&cur_trans->use_count); |
| 79 | atomic_inc(&cur_trans->num_writers); | 81 | atomic_inc(&cur_trans->num_writers); |
| 80 | cur_trans->num_joined++; | 82 | cur_trans->num_joined++; |
| @@ -1400,6 +1402,7 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans, | |||
| 1400 | ret = commit_fs_roots(trans, root); | 1402 | ret = commit_fs_roots(trans, root); |
| 1401 | if (ret) { | 1403 | if (ret) { |
| 1402 | mutex_unlock(&root->fs_info->tree_log_mutex); | 1404 | mutex_unlock(&root->fs_info->tree_log_mutex); |
| 1405 | mutex_unlock(&root->fs_info->reloc_mutex); | ||
| 1403 | goto cleanup_transaction; | 1406 | goto cleanup_transaction; |
| 1404 | } | 1407 | } |
| 1405 | 1408 | ||
| @@ -1411,6 +1414,7 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans, | |||
| 1411 | ret = commit_cowonly_roots(trans, root); | 1414 | ret = commit_cowonly_roots(trans, root); |
| 1412 | if (ret) { | 1415 | if (ret) { |
| 1413 | mutex_unlock(&root->fs_info->tree_log_mutex); | 1416 | mutex_unlock(&root->fs_info->tree_log_mutex); |
| 1417 | mutex_unlock(&root->fs_info->reloc_mutex); | ||
| 1414 | goto cleanup_transaction; | 1418 | goto cleanup_transaction; |
| 1415 | } | 1419 | } |
| 1416 | 1420 | ||
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c index d017283ae6f5..eb1ae908582c 100644 --- a/fs/btrfs/tree-log.c +++ b/fs/btrfs/tree-log.c | |||
| @@ -279,7 +279,7 @@ static int process_one_buffer(struct btrfs_root *log, | |||
| 279 | log->fs_info->extent_root, | 279 | log->fs_info->extent_root, |
| 280 | eb->start, eb->len); | 280 | eb->start, eb->len); |
| 281 | 281 | ||
| 282 | if (btrfs_buffer_uptodate(eb, gen)) { | 282 | if (btrfs_buffer_uptodate(eb, gen, 0)) { |
| 283 | if (wc->write) | 283 | if (wc->write) |
| 284 | btrfs_write_tree_block(eb); | 284 | btrfs_write_tree_block(eb); |
| 285 | if (wc->wait) | 285 | if (wc->wait) |
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 759d02486d7c..1411b99555a4 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c | |||
| @@ -3324,12 +3324,14 @@ static int __btrfs_alloc_chunk(struct btrfs_trans_handle *trans, | |||
| 3324 | stripe_size = devices_info[ndevs-1].max_avail; | 3324 | stripe_size = devices_info[ndevs-1].max_avail; |
| 3325 | num_stripes = ndevs * dev_stripes; | 3325 | num_stripes = ndevs * dev_stripes; |
| 3326 | 3326 | ||
| 3327 | if (stripe_size * num_stripes > max_chunk_size * ncopies) { | 3327 | if (stripe_size * ndevs > max_chunk_size * ncopies) { |
| 3328 | stripe_size = max_chunk_size * ncopies; | 3328 | stripe_size = max_chunk_size * ncopies; |
| 3329 | do_div(stripe_size, num_stripes); | 3329 | do_div(stripe_size, ndevs); |
| 3330 | } | 3330 | } |
| 3331 | 3331 | ||
| 3332 | do_div(stripe_size, dev_stripes); | 3332 | do_div(stripe_size, dev_stripes); |
| 3333 | |||
| 3334 | /* align to BTRFS_STRIPE_LEN */ | ||
| 3333 | do_div(stripe_size, BTRFS_STRIPE_LEN); | 3335 | do_div(stripe_size, BTRFS_STRIPE_LEN); |
| 3334 | stripe_size *= BTRFS_STRIPE_LEN; | 3336 | stripe_size *= BTRFS_STRIPE_LEN; |
| 3335 | 3337 | ||
| @@ -3805,10 +3807,11 @@ static int __btrfs_map_block(struct btrfs_mapping_tree *map_tree, int rw, | |||
| 3805 | else if (mirror_num) | 3807 | else if (mirror_num) |
| 3806 | stripe_index += mirror_num - 1; | 3808 | stripe_index += mirror_num - 1; |
| 3807 | else { | 3809 | else { |
| 3810 | int old_stripe_index = stripe_index; | ||
| 3808 | stripe_index = find_live_mirror(map, stripe_index, | 3811 | stripe_index = find_live_mirror(map, stripe_index, |
| 3809 | map->sub_stripes, stripe_index + | 3812 | map->sub_stripes, stripe_index + |
| 3810 | current->pid % map->sub_stripes); | 3813 | current->pid % map->sub_stripes); |
| 3811 | mirror_num = stripe_index + 1; | 3814 | mirror_num = stripe_index - old_stripe_index + 1; |
| 3812 | } | 3815 | } |
| 3813 | } else { | 3816 | } else { |
| 3814 | /* | 3817 | /* |
| @@ -4350,8 +4353,10 @@ static int open_seed_devices(struct btrfs_root *root, u8 *fsid) | |||
| 4350 | 4353 | ||
| 4351 | ret = __btrfs_open_devices(fs_devices, FMODE_READ, | 4354 | ret = __btrfs_open_devices(fs_devices, FMODE_READ, |
| 4352 | root->fs_info->bdev_holder); | 4355 | root->fs_info->bdev_holder); |
| 4353 | if (ret) | 4356 | if (ret) { |
| 4357 | free_fs_devices(fs_devices); | ||
| 4354 | goto out; | 4358 | goto out; |
| 4359 | } | ||
| 4355 | 4360 | ||
| 4356 | if (!fs_devices->seeding) { | 4361 | if (!fs_devices->seeding) { |
| 4357 | __btrfs_close_devices(fs_devices); | 4362 | __btrfs_close_devices(fs_devices); |
diff --git a/fs/buffer.c b/fs/buffer.c index 36d66653b931..351e18ea2e53 100644 --- a/fs/buffer.c +++ b/fs/buffer.c | |||
| @@ -985,7 +985,6 @@ grow_dev_page(struct block_device *bdev, sector_t block, | |||
| 985 | return page; | 985 | return page; |
| 986 | 986 | ||
| 987 | failed: | 987 | failed: |
| 988 | BUG(); | ||
| 989 | unlock_page(page); | 988 | unlock_page(page); |
| 990 | page_cache_release(page); | 989 | page_cache_release(page); |
| 991 | return NULL; | 990 | return NULL; |
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c index d34212822444..ca6a3796a33b 100644 --- a/fs/cifs/cifsfs.c +++ b/fs/cifs/cifsfs.c | |||
| @@ -370,13 +370,13 @@ cifs_show_options(struct seq_file *s, struct dentry *root) | |||
| 370 | (int)(srcaddr->sa_family)); | 370 | (int)(srcaddr->sa_family)); |
| 371 | } | 371 | } |
| 372 | 372 | ||
| 373 | seq_printf(s, ",uid=%d", cifs_sb->mnt_uid); | 373 | seq_printf(s, ",uid=%u", cifs_sb->mnt_uid); |
| 374 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_OVERR_UID) | 374 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_OVERR_UID) |
| 375 | seq_printf(s, ",forceuid"); | 375 | seq_printf(s, ",forceuid"); |
| 376 | else | 376 | else |
| 377 | seq_printf(s, ",noforceuid"); | 377 | seq_printf(s, ",noforceuid"); |
| 378 | 378 | ||
| 379 | seq_printf(s, ",gid=%d", cifs_sb->mnt_gid); | 379 | seq_printf(s, ",gid=%u", cifs_sb->mnt_gid); |
| 380 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_OVERR_GID) | 380 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_OVERR_GID) |
| 381 | seq_printf(s, ",forcegid"); | 381 | seq_printf(s, ",forcegid"); |
| 382 | else | 382 | else |
| @@ -434,11 +434,15 @@ cifs_show_options(struct seq_file *s, struct dentry *root) | |||
| 434 | seq_printf(s, ",noperm"); | 434 | seq_printf(s, ",noperm"); |
| 435 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_STRICT_IO) | 435 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_STRICT_IO) |
| 436 | seq_printf(s, ",strictcache"); | 436 | seq_printf(s, ",strictcache"); |
| 437 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_CIFS_BACKUPUID) | ||
| 438 | seq_printf(s, ",backupuid=%u", cifs_sb->mnt_backupuid); | ||
| 439 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_CIFS_BACKUPGID) | ||
| 440 | seq_printf(s, ",backupgid=%u", cifs_sb->mnt_backupgid); | ||
| 437 | 441 | ||
| 438 | seq_printf(s, ",rsize=%d", cifs_sb->rsize); | 442 | seq_printf(s, ",rsize=%u", cifs_sb->rsize); |
| 439 | seq_printf(s, ",wsize=%d", cifs_sb->wsize); | 443 | seq_printf(s, ",wsize=%u", cifs_sb->wsize); |
| 440 | /* convert actimeo and display it in seconds */ | 444 | /* convert actimeo and display it in seconds */ |
| 441 | seq_printf(s, ",actimeo=%lu", cifs_sb->actimeo / HZ); | 445 | seq_printf(s, ",actimeo=%lu", cifs_sb->actimeo / HZ); |
| 442 | 446 | ||
| 443 | return 0; | 447 | return 0; |
| 444 | } | 448 | } |
diff --git a/fs/cifs/cifsfs.h b/fs/cifs/cifsfs.h index d1389bb33ceb..65365358c976 100644 --- a/fs/cifs/cifsfs.h +++ b/fs/cifs/cifsfs.h | |||
| @@ -125,5 +125,5 @@ extern long cifs_ioctl(struct file *filep, unsigned int cmd, unsigned long arg); | |||
| 125 | extern const struct export_operations cifs_export_ops; | 125 | extern const struct export_operations cifs_export_ops; |
| 126 | #endif /* CONFIG_CIFS_NFSD_EXPORT */ | 126 | #endif /* CONFIG_CIFS_NFSD_EXPORT */ |
| 127 | 127 | ||
| 128 | #define CIFS_VERSION "1.77" | 128 | #define CIFS_VERSION "1.78" |
| 129 | #endif /* _CIFSFS_H */ | 129 | #endif /* _CIFSFS_H */ |
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c index f52c5ab78f9d..da2f5446fa7a 100644 --- a/fs/cifs/cifssmb.c +++ b/fs/cifs/cifssmb.c | |||
| @@ -4844,8 +4844,12 @@ parse_DFS_referrals(TRANSACTION2_GET_DFS_REFER_RSP *pSMBr, | |||
| 4844 | max_len = data_end - temp; | 4844 | max_len = data_end - temp; |
| 4845 | node->node_name = cifs_strndup_from_utf16(temp, max_len, | 4845 | node->node_name = cifs_strndup_from_utf16(temp, max_len, |
| 4846 | is_unicode, nls_codepage); | 4846 | is_unicode, nls_codepage); |
| 4847 | if (!node->node_name) | 4847 | if (!node->node_name) { |
| 4848 | rc = -ENOMEM; | 4848 | rc = -ENOMEM; |
| 4849 | goto parse_DFS_referrals_exit; | ||
| 4850 | } | ||
| 4851 | |||
| 4852 | ref++; | ||
| 4849 | } | 4853 | } |
| 4850 | 4854 | ||
| 4851 | parse_DFS_referrals_exit: | 4855 | parse_DFS_referrals_exit: |
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index d81e933a796b..5dcc55197fb3 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c | |||
| @@ -109,6 +109,8 @@ enum { | |||
| 109 | 109 | ||
| 110 | /* Options which could be blank */ | 110 | /* Options which could be blank */ |
| 111 | Opt_blank_pass, | 111 | Opt_blank_pass, |
| 112 | Opt_blank_user, | ||
| 113 | Opt_blank_ip, | ||
| 112 | 114 | ||
| 113 | Opt_err | 115 | Opt_err |
| 114 | }; | 116 | }; |
| @@ -183,11 +185,15 @@ static const match_table_t cifs_mount_option_tokens = { | |||
| 183 | { Opt_wsize, "wsize=%s" }, | 185 | { Opt_wsize, "wsize=%s" }, |
| 184 | { Opt_actimeo, "actimeo=%s" }, | 186 | { Opt_actimeo, "actimeo=%s" }, |
| 185 | 187 | ||
| 188 | { Opt_blank_user, "user=" }, | ||
| 189 | { Opt_blank_user, "username=" }, | ||
| 186 | { Opt_user, "user=%s" }, | 190 | { Opt_user, "user=%s" }, |
| 187 | { Opt_user, "username=%s" }, | 191 | { Opt_user, "username=%s" }, |
| 188 | { Opt_blank_pass, "pass=" }, | 192 | { Opt_blank_pass, "pass=" }, |
| 189 | { Opt_pass, "pass=%s" }, | 193 | { Opt_pass, "pass=%s" }, |
| 190 | { Opt_pass, "password=%s" }, | 194 | { Opt_pass, "password=%s" }, |
| 195 | { Opt_blank_ip, "ip=" }, | ||
| 196 | { Opt_blank_ip, "addr=" }, | ||
| 191 | { Opt_ip, "ip=%s" }, | 197 | { Opt_ip, "ip=%s" }, |
| 192 | { Opt_ip, "addr=%s" }, | 198 | { Opt_ip, "addr=%s" }, |
| 193 | { Opt_unc, "unc=%s" }, | 199 | { Opt_unc, "unc=%s" }, |
| @@ -209,6 +215,8 @@ static const match_table_t cifs_mount_option_tokens = { | |||
| 209 | 215 | ||
| 210 | { Opt_ignore, "cred" }, | 216 | { Opt_ignore, "cred" }, |
| 211 | { Opt_ignore, "credentials" }, | 217 | { Opt_ignore, "credentials" }, |
| 218 | { Opt_ignore, "cred=%s" }, | ||
| 219 | { Opt_ignore, "credentials=%s" }, | ||
| 212 | { Opt_ignore, "guest" }, | 220 | { Opt_ignore, "guest" }, |
| 213 | { Opt_ignore, "rw" }, | 221 | { Opt_ignore, "rw" }, |
| 214 | { Opt_ignore, "ro" }, | 222 | { Opt_ignore, "ro" }, |
| @@ -1117,7 +1125,7 @@ static int get_option_ul(substring_t args[], unsigned long *option) | |||
| 1117 | string = match_strdup(args); | 1125 | string = match_strdup(args); |
| 1118 | if (string == NULL) | 1126 | if (string == NULL) |
| 1119 | return -ENOMEM; | 1127 | return -ENOMEM; |
| 1120 | rc = kstrtoul(string, 10, option); | 1128 | rc = kstrtoul(string, 0, option); |
| 1121 | kfree(string); | 1129 | kfree(string); |
| 1122 | 1130 | ||
| 1123 | return rc; | 1131 | return rc; |
| @@ -1534,15 +1542,17 @@ cifs_parse_mount_options(const char *mountdata, const char *devname, | |||
| 1534 | 1542 | ||
| 1535 | /* String Arguments */ | 1543 | /* String Arguments */ |
| 1536 | 1544 | ||
| 1545 | case Opt_blank_user: | ||
| 1546 | /* null user, ie. anonymous authentication */ | ||
| 1547 | vol->nullauth = 1; | ||
| 1548 | vol->username = NULL; | ||
| 1549 | break; | ||
| 1537 | case Opt_user: | 1550 | case Opt_user: |
| 1538 | string = match_strdup(args); | 1551 | string = match_strdup(args); |
| 1539 | if (string == NULL) | 1552 | if (string == NULL) |
| 1540 | goto out_nomem; | 1553 | goto out_nomem; |
| 1541 | 1554 | ||
| 1542 | if (!*string) { | 1555 | if (strnlen(string, MAX_USERNAME_SIZE) > |
| 1543 | /* null user, ie. anonymous authentication */ | ||
| 1544 | vol->nullauth = 1; | ||
| 1545 | } else if (strnlen(string, MAX_USERNAME_SIZE) > | ||
| 1546 | MAX_USERNAME_SIZE) { | 1556 | MAX_USERNAME_SIZE) { |
| 1547 | printk(KERN_WARNING "CIFS: username too long\n"); | 1557 | printk(KERN_WARNING "CIFS: username too long\n"); |
| 1548 | goto cifs_parse_mount_err; | 1558 | goto cifs_parse_mount_err; |
| @@ -1611,14 +1621,15 @@ cifs_parse_mount_options(const char *mountdata, const char *devname, | |||
| 1611 | } | 1621 | } |
| 1612 | vol->password[j] = '\0'; | 1622 | vol->password[j] = '\0'; |
| 1613 | break; | 1623 | break; |
| 1624 | case Opt_blank_ip: | ||
| 1625 | vol->UNCip = NULL; | ||
| 1626 | break; | ||
| 1614 | case Opt_ip: | 1627 | case Opt_ip: |
| 1615 | string = match_strdup(args); | 1628 | string = match_strdup(args); |
| 1616 | if (string == NULL) | 1629 | if (string == NULL) |
| 1617 | goto out_nomem; | 1630 | goto out_nomem; |
| 1618 | 1631 | ||
| 1619 | if (!*string) { | 1632 | if (strnlen(string, INET6_ADDRSTRLEN) > |
| 1620 | vol->UNCip = NULL; | ||
| 1621 | } else if (strnlen(string, INET6_ADDRSTRLEN) > | ||
| 1622 | INET6_ADDRSTRLEN) { | 1633 | INET6_ADDRSTRLEN) { |
| 1623 | printk(KERN_WARNING "CIFS: ip address " | 1634 | printk(KERN_WARNING "CIFS: ip address " |
| 1624 | "too long\n"); | 1635 | "too long\n"); |
| @@ -1636,12 +1647,6 @@ cifs_parse_mount_options(const char *mountdata, const char *devname, | |||
| 1636 | if (string == NULL) | 1647 | if (string == NULL) |
| 1637 | goto out_nomem; | 1648 | goto out_nomem; |
| 1638 | 1649 | ||
| 1639 | if (!*string) { | ||
| 1640 | printk(KERN_WARNING "CIFS: invalid path to " | ||
| 1641 | "network resource\n"); | ||
| 1642 | goto cifs_parse_mount_err; | ||
| 1643 | } | ||
| 1644 | |||
| 1645 | temp_len = strnlen(string, 300); | 1650 | temp_len = strnlen(string, 300); |
| 1646 | if (temp_len == 300) { | 1651 | if (temp_len == 300) { |
| 1647 | printk(KERN_WARNING "CIFS: UNC name too long\n"); | 1652 | printk(KERN_WARNING "CIFS: UNC name too long\n"); |
| @@ -1670,11 +1675,7 @@ cifs_parse_mount_options(const char *mountdata, const char *devname, | |||
| 1670 | if (string == NULL) | 1675 | if (string == NULL) |
| 1671 | goto out_nomem; | 1676 | goto out_nomem; |
| 1672 | 1677 | ||
| 1673 | if (!*string) { | 1678 | if (strnlen(string, 256) == 256) { |
| 1674 | printk(KERN_WARNING "CIFS: invalid domain" | ||
| 1675 | " name\n"); | ||
| 1676 | goto cifs_parse_mount_err; | ||
| 1677 | } else if (strnlen(string, 256) == 256) { | ||
| 1678 | printk(KERN_WARNING "CIFS: domain name too" | 1679 | printk(KERN_WARNING "CIFS: domain name too" |
| 1679 | " long\n"); | 1680 | " long\n"); |
| 1680 | goto cifs_parse_mount_err; | 1681 | goto cifs_parse_mount_err; |
| @@ -1693,11 +1694,7 @@ cifs_parse_mount_options(const char *mountdata, const char *devname, | |||
| 1693 | if (string == NULL) | 1694 | if (string == NULL) |
| 1694 | goto out_nomem; | 1695 | goto out_nomem; |
| 1695 | 1696 | ||
| 1696 | if (!*string) { | 1697 | if (!cifs_convert_address( |
| 1697 | printk(KERN_WARNING "CIFS: srcaddr value not" | ||
| 1698 | " specified\n"); | ||
| 1699 | goto cifs_parse_mount_err; | ||
| 1700 | } else if (!cifs_convert_address( | ||
| 1701 | (struct sockaddr *)&vol->srcaddr, | 1698 | (struct sockaddr *)&vol->srcaddr, |
| 1702 | string, strlen(string))) { | 1699 | string, strlen(string))) { |
| 1703 | printk(KERN_WARNING "CIFS: Could not parse" | 1700 | printk(KERN_WARNING "CIFS: Could not parse" |
| @@ -1710,11 +1707,6 @@ cifs_parse_mount_options(const char *mountdata, const char *devname, | |||
| 1710 | if (string == NULL) | 1707 | if (string == NULL) |
| 1711 | goto out_nomem; | 1708 | goto out_nomem; |
| 1712 | 1709 | ||
| 1713 | if (!*string) { | ||
| 1714 | printk(KERN_WARNING "CIFS: Invalid path" | ||
| 1715 | " prefix\n"); | ||
| 1716 | goto cifs_parse_mount_err; | ||
| 1717 | } | ||
| 1718 | temp_len = strnlen(string, 1024); | 1710 | temp_len = strnlen(string, 1024); |
| 1719 | if (string[0] != '/') | 1711 | if (string[0] != '/') |
| 1720 | temp_len++; /* missing leading slash */ | 1712 | temp_len++; /* missing leading slash */ |
| @@ -1742,11 +1734,7 @@ cifs_parse_mount_options(const char *mountdata, const char *devname, | |||
| 1742 | if (string == NULL) | 1734 | if (string == NULL) |
| 1743 | goto out_nomem; | 1735 | goto out_nomem; |
| 1744 | 1736 | ||
| 1745 | if (!*string) { | 1737 | if (strnlen(string, 1024) >= 65) { |
| 1746 | printk(KERN_WARNING "CIFS: Invalid iocharset" | ||
| 1747 | " specified\n"); | ||
| 1748 | goto cifs_parse_mount_err; | ||
| 1749 | } else if (strnlen(string, 1024) >= 65) { | ||
| 1750 | printk(KERN_WARNING "CIFS: iocharset name " | 1738 | printk(KERN_WARNING "CIFS: iocharset name " |
| 1751 | "too long.\n"); | 1739 | "too long.\n"); |
| 1752 | goto cifs_parse_mount_err; | 1740 | goto cifs_parse_mount_err; |
| @@ -1771,11 +1759,6 @@ cifs_parse_mount_options(const char *mountdata, const char *devname, | |||
| 1771 | if (string == NULL) | 1759 | if (string == NULL) |
| 1772 | goto out_nomem; | 1760 | goto out_nomem; |
| 1773 | 1761 | ||
| 1774 | if (!*string) { | ||
| 1775 | printk(KERN_WARNING "CIFS: No socket option" | ||
| 1776 | " specified\n"); | ||
| 1777 | goto cifs_parse_mount_err; | ||
| 1778 | } | ||
| 1779 | if (strnicmp(string, "TCP_NODELAY", 11) == 0) | 1762 | if (strnicmp(string, "TCP_NODELAY", 11) == 0) |
| 1780 | vol->sockopt_tcp_nodelay = 1; | 1763 | vol->sockopt_tcp_nodelay = 1; |
| 1781 | break; | 1764 | break; |
| @@ -1784,12 +1767,6 @@ cifs_parse_mount_options(const char *mountdata, const char *devname, | |||
| 1784 | if (string == NULL) | 1767 | if (string == NULL) |
| 1785 | goto out_nomem; | 1768 | goto out_nomem; |
| 1786 | 1769 | ||
| 1787 | if (!*string) { | ||
| 1788 | printk(KERN_WARNING "CIFS: Invalid (empty)" | ||
| 1789 | " netbiosname\n"); | ||
| 1790 | break; | ||
| 1791 | } | ||
| 1792 | |||
| 1793 | memset(vol->source_rfc1001_name, 0x20, | 1770 | memset(vol->source_rfc1001_name, 0x20, |
| 1794 | RFC1001_NAME_LEN); | 1771 | RFC1001_NAME_LEN); |
| 1795 | /* | 1772 | /* |
| @@ -1817,11 +1794,6 @@ cifs_parse_mount_options(const char *mountdata, const char *devname, | |||
| 1817 | if (string == NULL) | 1794 | if (string == NULL) |
| 1818 | goto out_nomem; | 1795 | goto out_nomem; |
| 1819 | 1796 | ||
| 1820 | if (!*string) { | ||
| 1821 | printk(KERN_WARNING "CIFS: Empty server" | ||
| 1822 | " netbiosname specified\n"); | ||
| 1823 | break; | ||
| 1824 | } | ||
| 1825 | /* last byte, type, is 0x20 for servr type */ | 1797 | /* last byte, type, is 0x20 for servr type */ |
| 1826 | memset(vol->target_rfc1001_name, 0x20, | 1798 | memset(vol->target_rfc1001_name, 0x20, |
| 1827 | RFC1001_NAME_LEN_WITH_NULL); | 1799 | RFC1001_NAME_LEN_WITH_NULL); |
| @@ -1848,12 +1820,6 @@ cifs_parse_mount_options(const char *mountdata, const char *devname, | |||
| 1848 | if (string == NULL) | 1820 | if (string == NULL) |
| 1849 | goto out_nomem; | 1821 | goto out_nomem; |
| 1850 | 1822 | ||
| 1851 | if (!*string) { | ||
| 1852 | cERROR(1, "no protocol version specified" | ||
| 1853 | " after vers= mount option"); | ||
| 1854 | goto cifs_parse_mount_err; | ||
| 1855 | } | ||
| 1856 | |||
| 1857 | if (strnicmp(string, "cifs", 4) == 0 || | 1823 | if (strnicmp(string, "cifs", 4) == 0 || |
| 1858 | strnicmp(string, "1", 1) == 0) { | 1824 | strnicmp(string, "1", 1) == 0) { |
| 1859 | /* This is the default */ | 1825 | /* This is the default */ |
| @@ -1868,12 +1834,6 @@ cifs_parse_mount_options(const char *mountdata, const char *devname, | |||
| 1868 | if (string == NULL) | 1834 | if (string == NULL) |
| 1869 | goto out_nomem; | 1835 | goto out_nomem; |
| 1870 | 1836 | ||
| 1871 | if (!*string) { | ||
| 1872 | printk(KERN_WARNING "CIFS: no security flavor" | ||
| 1873 | " specified\n"); | ||
| 1874 | break; | ||
| 1875 | } | ||
| 1876 | |||
| 1877 | if (cifs_parse_security_flavors(string, vol) != 0) | 1837 | if (cifs_parse_security_flavors(string, vol) != 0) |
| 1878 | goto cifs_parse_mount_err; | 1838 | goto cifs_parse_mount_err; |
| 1879 | break; | 1839 | break; |
| @@ -2225,6 +2185,7 @@ cifs_get_tcp_session(struct smb_vol *volume_info) | |||
| 2225 | tcp_ses->session_estab = false; | 2185 | tcp_ses->session_estab = false; |
| 2226 | tcp_ses->sequence_number = 0; | 2186 | tcp_ses->sequence_number = 0; |
| 2227 | tcp_ses->lstrp = jiffies; | 2187 | tcp_ses->lstrp = jiffies; |
| 2188 | spin_lock_init(&tcp_ses->req_lock); | ||
| 2228 | INIT_LIST_HEAD(&tcp_ses->tcp_ses_list); | 2189 | INIT_LIST_HEAD(&tcp_ses->tcp_ses_list); |
| 2229 | INIT_LIST_HEAD(&tcp_ses->smb_ses_list); | 2190 | INIT_LIST_HEAD(&tcp_ses->smb_ses_list); |
| 2230 | INIT_DELAYED_WORK(&tcp_ses->echo, cifs_echo_request); | 2191 | INIT_DELAYED_WORK(&tcp_ses->echo, cifs_echo_request); |
| @@ -3270,10 +3231,6 @@ void cifs_setup_cifs_sb(struct smb_vol *pvolume_info, | |||
| 3270 | 3231 | ||
| 3271 | cifs_sb->mnt_uid = pvolume_info->linux_uid; | 3232 | cifs_sb->mnt_uid = pvolume_info->linux_uid; |
| 3272 | cifs_sb->mnt_gid = pvolume_info->linux_gid; | 3233 | cifs_sb->mnt_gid = pvolume_info->linux_gid; |
| 3273 | if (pvolume_info->backupuid_specified) | ||
| 3274 | cifs_sb->mnt_backupuid = pvolume_info->backupuid; | ||
| 3275 | if (pvolume_info->backupgid_specified) | ||
| 3276 | cifs_sb->mnt_backupgid = pvolume_info->backupgid; | ||
| 3277 | cifs_sb->mnt_file_mode = pvolume_info->file_mode; | 3234 | cifs_sb->mnt_file_mode = pvolume_info->file_mode; |
| 3278 | cifs_sb->mnt_dir_mode = pvolume_info->dir_mode; | 3235 | cifs_sb->mnt_dir_mode = pvolume_info->dir_mode; |
| 3279 | cFYI(1, "file mode: 0x%hx dir mode: 0x%hx", | 3236 | cFYI(1, "file mode: 0x%hx dir mode: 0x%hx", |
| @@ -3304,10 +3261,14 @@ void cifs_setup_cifs_sb(struct smb_vol *pvolume_info, | |||
| 3304 | cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_RWPIDFORWARD; | 3261 | cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_RWPIDFORWARD; |
| 3305 | if (pvolume_info->cifs_acl) | 3262 | if (pvolume_info->cifs_acl) |
| 3306 | cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_CIFS_ACL; | 3263 | cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_CIFS_ACL; |
| 3307 | if (pvolume_info->backupuid_specified) | 3264 | if (pvolume_info->backupuid_specified) { |
| 3308 | cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_CIFS_BACKUPUID; | 3265 | cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_CIFS_BACKUPUID; |
| 3309 | if (pvolume_info->backupgid_specified) | 3266 | cifs_sb->mnt_backupuid = pvolume_info->backupuid; |
| 3267 | } | ||
| 3268 | if (pvolume_info->backupgid_specified) { | ||
| 3310 | cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_CIFS_BACKUPGID; | 3269 | cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_CIFS_BACKUPGID; |
| 3270 | cifs_sb->mnt_backupgid = pvolume_info->backupgid; | ||
| 3271 | } | ||
| 3311 | if (pvolume_info->override_uid) | 3272 | if (pvolume_info->override_uid) |
| 3312 | cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_OVERR_UID; | 3273 | cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_OVERR_UID; |
| 3313 | if (pvolume_info->override_gid) | 3274 | if (pvolume_info->override_gid) |
| @@ -3656,22 +3617,6 @@ cifs_get_volume_info(char *mount_data, const char *devname) | |||
| 3656 | return volume_info; | 3617 | return volume_info; |
| 3657 | } | 3618 | } |
| 3658 | 3619 | ||
| 3659 | /* make sure ra_pages is a multiple of rsize */ | ||
| 3660 | static inline unsigned int | ||
| 3661 | cifs_ra_pages(struct cifs_sb_info *cifs_sb) | ||
| 3662 | { | ||
| 3663 | unsigned int reads; | ||
| 3664 | unsigned int rsize_pages = cifs_sb->rsize / PAGE_CACHE_SIZE; | ||
| 3665 | |||
| 3666 | if (rsize_pages >= default_backing_dev_info.ra_pages) | ||
| 3667 | return default_backing_dev_info.ra_pages; | ||
| 3668 | else if (rsize_pages == 0) | ||
| 3669 | return rsize_pages; | ||
| 3670 | |||
| 3671 | reads = default_backing_dev_info.ra_pages / rsize_pages; | ||
| 3672 | return reads * rsize_pages; | ||
| 3673 | } | ||
| 3674 | |||
| 3675 | int | 3620 | int |
| 3676 | cifs_mount(struct cifs_sb_info *cifs_sb, struct smb_vol *volume_info) | 3621 | cifs_mount(struct cifs_sb_info *cifs_sb, struct smb_vol *volume_info) |
| 3677 | { | 3622 | { |
| @@ -3759,7 +3704,7 @@ try_mount_again: | |||
| 3759 | cifs_sb->rsize = cifs_negotiate_rsize(tcon, volume_info); | 3704 | cifs_sb->rsize = cifs_negotiate_rsize(tcon, volume_info); |
| 3760 | 3705 | ||
| 3761 | /* tune readahead according to rsize */ | 3706 | /* tune readahead according to rsize */ |
| 3762 | cifs_sb->bdi.ra_pages = cifs_ra_pages(cifs_sb); | 3707 | cifs_sb->bdi.ra_pages = cifs_sb->rsize / PAGE_CACHE_SIZE; |
| 3763 | 3708 | ||
| 3764 | remote_path_check: | 3709 | remote_path_check: |
| 3765 | #ifdef CONFIG_CIFS_DFS_UPCALL | 3710 | #ifdef CONFIG_CIFS_DFS_UPCALL |
diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c index d172c8ed9017..ec4e9a2a12f8 100644 --- a/fs/cifs/dir.c +++ b/fs/cifs/dir.c | |||
| @@ -668,12 +668,19 @@ cifs_d_revalidate(struct dentry *direntry, struct nameidata *nd) | |||
| 668 | return 0; | 668 | return 0; |
| 669 | else { | 669 | else { |
| 670 | /* | 670 | /* |
| 671 | * Forcibly invalidate automounting directory inodes | 671 | * If the inode wasn't known to be a dfs entry when |
| 672 | * (remote DFS directories) so to have them | 672 | * the dentry was instantiated, such as when created |
| 673 | * instantiated again for automount | 673 | * via ->readdir(), it needs to be set now since the |
| 674 | * attributes will have been updated by | ||
| 675 | * cifs_revalidate_dentry(). | ||
| 674 | */ | 676 | */ |
| 675 | if (IS_AUTOMOUNT(direntry->d_inode)) | 677 | if (IS_AUTOMOUNT(direntry->d_inode) && |
| 676 | return 0; | 678 | !(direntry->d_flags & DCACHE_NEED_AUTOMOUNT)) { |
| 679 | spin_lock(&direntry->d_lock); | ||
| 680 | direntry->d_flags |= DCACHE_NEED_AUTOMOUNT; | ||
| 681 | spin_unlock(&direntry->d_lock); | ||
| 682 | } | ||
| 683 | |||
| 677 | return 1; | 684 | return 1; |
| 678 | } | 685 | } |
| 679 | } | 686 | } |
diff --git a/fs/cifs/file.c b/fs/cifs/file.c index fae765dac934..81725e9286e9 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c | |||
| @@ -2178,7 +2178,7 @@ cifs_iovec_write(struct file *file, const struct iovec *iov, | |||
| 2178 | unsigned long nr_pages, i; | 2178 | unsigned long nr_pages, i; |
| 2179 | size_t copied, len, cur_len; | 2179 | size_t copied, len, cur_len; |
| 2180 | ssize_t total_written = 0; | 2180 | ssize_t total_written = 0; |
| 2181 | loff_t offset = *poffset; | 2181 | loff_t offset; |
| 2182 | struct iov_iter it; | 2182 | struct iov_iter it; |
| 2183 | struct cifsFileInfo *open_file; | 2183 | struct cifsFileInfo *open_file; |
| 2184 | struct cifs_tcon *tcon; | 2184 | struct cifs_tcon *tcon; |
| @@ -2200,6 +2200,7 @@ cifs_iovec_write(struct file *file, const struct iovec *iov, | |||
| 2200 | cifs_sb = CIFS_SB(file->f_path.dentry->d_sb); | 2200 | cifs_sb = CIFS_SB(file->f_path.dentry->d_sb); |
| 2201 | open_file = file->private_data; | 2201 | open_file = file->private_data; |
| 2202 | tcon = tlink_tcon(open_file->tlink); | 2202 | tcon = tlink_tcon(open_file->tlink); |
| 2203 | offset = *poffset; | ||
| 2203 | 2204 | ||
| 2204 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_RWPIDFORWARD) | 2205 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_RWPIDFORWARD) |
| 2205 | pid = open_file->pid; | 2206 | pid = open_file->pid; |
diff --git a/fs/dcache.c b/fs/dcache.c index b60ddc41d783..b80531c91779 100644 --- a/fs/dcache.c +++ b/fs/dcache.c | |||
| @@ -141,18 +141,29 @@ int proc_nr_dentry(ctl_table *table, int write, void __user *buffer, | |||
| 141 | * Compare 2 name strings, return 0 if they match, otherwise non-zero. | 141 | * Compare 2 name strings, return 0 if they match, otherwise non-zero. |
| 142 | * The strings are both count bytes long, and count is non-zero. | 142 | * The strings are both count bytes long, and count is non-zero. |
| 143 | */ | 143 | */ |
| 144 | #ifdef CONFIG_DCACHE_WORD_ACCESS | ||
| 145 | |||
| 146 | #include <asm/word-at-a-time.h> | ||
| 147 | /* | ||
| 148 | * NOTE! 'cs' and 'scount' come from a dentry, so it has a | ||
| 149 | * aligned allocation for this particular component. We don't | ||
| 150 | * strictly need the load_unaligned_zeropad() safety, but it | ||
| 151 | * doesn't hurt either. | ||
| 152 | * | ||
| 153 | * In contrast, 'ct' and 'tcount' can be from a pathname, and do | ||
| 154 | * need the careful unaligned handling. | ||
| 155 | */ | ||
| 144 | static inline int dentry_cmp(const unsigned char *cs, size_t scount, | 156 | static inline int dentry_cmp(const unsigned char *cs, size_t scount, |
| 145 | const unsigned char *ct, size_t tcount) | 157 | const unsigned char *ct, size_t tcount) |
| 146 | { | 158 | { |
| 147 | #ifdef CONFIG_DCACHE_WORD_ACCESS | ||
| 148 | unsigned long a,b,mask; | 159 | unsigned long a,b,mask; |
| 149 | 160 | ||
| 150 | if (unlikely(scount != tcount)) | 161 | if (unlikely(scount != tcount)) |
| 151 | return 1; | 162 | return 1; |
| 152 | 163 | ||
| 153 | for (;;) { | 164 | for (;;) { |
| 154 | a = *(unsigned long *)cs; | 165 | a = load_unaligned_zeropad(cs); |
| 155 | b = *(unsigned long *)ct; | 166 | b = load_unaligned_zeropad(ct); |
| 156 | if (tcount < sizeof(unsigned long)) | 167 | if (tcount < sizeof(unsigned long)) |
| 157 | break; | 168 | break; |
| 158 | if (unlikely(a != b)) | 169 | if (unlikely(a != b)) |
| @@ -165,7 +176,13 @@ static inline int dentry_cmp(const unsigned char *cs, size_t scount, | |||
| 165 | } | 176 | } |
| 166 | mask = ~(~0ul << tcount*8); | 177 | mask = ~(~0ul << tcount*8); |
| 167 | return unlikely(!!((a ^ b) & mask)); | 178 | return unlikely(!!((a ^ b) & mask)); |
| 179 | } | ||
| 180 | |||
| 168 | #else | 181 | #else |
| 182 | |||
| 183 | static inline int dentry_cmp(const unsigned char *cs, size_t scount, | ||
| 184 | const unsigned char *ct, size_t tcount) | ||
| 185 | { | ||
| 169 | if (scount != tcount) | 186 | if (scount != tcount) |
| 170 | return 1; | 187 | return 1; |
| 171 | 188 | ||
| @@ -177,9 +194,10 @@ static inline int dentry_cmp(const unsigned char *cs, size_t scount, | |||
| 177 | tcount--; | 194 | tcount--; |
| 178 | } while (tcount); | 195 | } while (tcount); |
| 179 | return 0; | 196 | return 0; |
| 180 | #endif | ||
| 181 | } | 197 | } |
| 182 | 198 | ||
| 199 | #endif | ||
| 200 | |||
| 183 | static void __d_free(struct rcu_head *head) | 201 | static void __d_free(struct rcu_head *head) |
| 184 | { | 202 | { |
| 185 | struct dentry *dentry = container_of(head, struct dentry, d_u.d_rcu); | 203 | struct dentry *dentry = container_of(head, struct dentry, d_u.d_rcu); |
diff --git a/fs/dlm/lock.c b/fs/dlm/lock.c index fa5c07d51dcc..4c58d4a3adc4 100644 --- a/fs/dlm/lock.c +++ b/fs/dlm/lock.c | |||
| @@ -1737,6 +1737,18 @@ static int _can_be_granted(struct dlm_rsb *r, struct dlm_lkb *lkb, int now) | |||
| 1737 | return 1; | 1737 | return 1; |
| 1738 | 1738 | ||
| 1739 | /* | 1739 | /* |
| 1740 | * Even if the convert is compat with all granted locks, | ||
| 1741 | * QUECVT forces it behind other locks on the convert queue. | ||
| 1742 | */ | ||
| 1743 | |||
| 1744 | if (now && conv && (lkb->lkb_exflags & DLM_LKF_QUECVT)) { | ||
| 1745 | if (list_empty(&r->res_convertqueue)) | ||
| 1746 | return 1; | ||
| 1747 | else | ||
| 1748 | goto out; | ||
| 1749 | } | ||
| 1750 | |||
| 1751 | /* | ||
| 1740 | * The NOORDER flag is set to avoid the standard vms rules on grant | 1752 | * The NOORDER flag is set to avoid the standard vms rules on grant |
| 1741 | * order. | 1753 | * order. |
| 1742 | */ | 1754 | */ |
diff --git a/fs/eventpoll.c b/fs/eventpoll.c index 739b0985b398..c0b3c70ee87a 100644 --- a/fs/eventpoll.c +++ b/fs/eventpoll.c | |||
| @@ -1663,8 +1663,10 @@ SYSCALL_DEFINE4(epoll_ctl, int, epfd, int, op, int, fd, | |||
| 1663 | if (op == EPOLL_CTL_ADD) { | 1663 | if (op == EPOLL_CTL_ADD) { |
| 1664 | if (is_file_epoll(tfile)) { | 1664 | if (is_file_epoll(tfile)) { |
| 1665 | error = -ELOOP; | 1665 | error = -ELOOP; |
| 1666 | if (ep_loop_check(ep, tfile) != 0) | 1666 | if (ep_loop_check(ep, tfile) != 0) { |
| 1667 | clear_tfile_check_list(); | ||
| 1667 | goto error_tgt_fput; | 1668 | goto error_tgt_fput; |
| 1669 | } | ||
| 1668 | } else | 1670 | } else |
| 1669 | list_add(&tfile->f_tfile_llink, &tfile_check_list); | 1671 | list_add(&tfile->f_tfile_llink, &tfile_check_list); |
| 1670 | } | 1672 | } |
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h index ab2594a30f86..0e01e90add8b 100644 --- a/fs/ext4/ext4.h +++ b/fs/ext4/ext4.h | |||
| @@ -1203,9 +1203,6 @@ struct ext4_sb_info { | |||
| 1203 | unsigned long s_ext_blocks; | 1203 | unsigned long s_ext_blocks; |
| 1204 | unsigned long s_ext_extents; | 1204 | unsigned long s_ext_extents; |
| 1205 | #endif | 1205 | #endif |
| 1206 | /* ext4 extent cache stats */ | ||
| 1207 | unsigned long extent_cache_hits; | ||
| 1208 | unsigned long extent_cache_misses; | ||
| 1209 | 1206 | ||
| 1210 | /* for buddy allocator */ | 1207 | /* for buddy allocator */ |
| 1211 | struct ext4_group_info ***s_group_info; | 1208 | struct ext4_group_info ***s_group_info; |
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c index 1421938e6792..abcdeab67f52 100644 --- a/fs/ext4/extents.c +++ b/fs/ext4/extents.c | |||
| @@ -2066,10 +2066,6 @@ static int ext4_ext_check_cache(struct inode *inode, ext4_lblk_t block, | |||
| 2066 | ret = 1; | 2066 | ret = 1; |
| 2067 | } | 2067 | } |
| 2068 | errout: | 2068 | errout: |
| 2069 | if (!ret) | ||
| 2070 | sbi->extent_cache_misses++; | ||
| 2071 | else | ||
| 2072 | sbi->extent_cache_hits++; | ||
| 2073 | trace_ext4_ext_in_cache(inode, block, ret); | 2069 | trace_ext4_ext_in_cache(inode, block, ret); |
| 2074 | spin_unlock(&EXT4_I(inode)->i_block_reservation_lock); | 2070 | spin_unlock(&EXT4_I(inode)->i_block_reservation_lock); |
| 2075 | return ret; | 2071 | return ret; |
| @@ -2882,7 +2878,7 @@ static int ext4_split_extent_at(handle_t *handle, | |||
| 2882 | if (err) | 2878 | if (err) |
| 2883 | goto fix_extent_len; | 2879 | goto fix_extent_len; |
| 2884 | /* update the extent length and mark as initialized */ | 2880 | /* update the extent length and mark as initialized */ |
| 2885 | ex->ee_len = cpu_to_le32(ee_len); | 2881 | ex->ee_len = cpu_to_le16(ee_len); |
| 2886 | ext4_ext_try_to_merge(inode, path, ex); | 2882 | ext4_ext_try_to_merge(inode, path, ex); |
| 2887 | err = ext4_ext_dirty(handle, inode, path + depth); | 2883 | err = ext4_ext_dirty(handle, inode, path + depth); |
| 2888 | goto out; | 2884 | goto out; |
diff --git a/fs/ext4/super.c b/fs/ext4/super.c index ceebaf853beb..e1fb1d5de58e 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c | |||
| @@ -1305,20 +1305,20 @@ static int set_qf_name(struct super_block *sb, int qtype, substring_t *args) | |||
| 1305 | ext4_msg(sb, KERN_ERR, | 1305 | ext4_msg(sb, KERN_ERR, |
| 1306 | "Cannot change journaled " | 1306 | "Cannot change journaled " |
| 1307 | "quota options when quota turned on"); | 1307 | "quota options when quota turned on"); |
| 1308 | return 0; | 1308 | return -1; |
| 1309 | } | 1309 | } |
| 1310 | qname = match_strdup(args); | 1310 | qname = match_strdup(args); |
| 1311 | if (!qname) { | 1311 | if (!qname) { |
| 1312 | ext4_msg(sb, KERN_ERR, | 1312 | ext4_msg(sb, KERN_ERR, |
| 1313 | "Not enough memory for storing quotafile name"); | 1313 | "Not enough memory for storing quotafile name"); |
| 1314 | return 0; | 1314 | return -1; |
| 1315 | } | 1315 | } |
| 1316 | if (sbi->s_qf_names[qtype] && | 1316 | if (sbi->s_qf_names[qtype] && |
| 1317 | strcmp(sbi->s_qf_names[qtype], qname)) { | 1317 | strcmp(sbi->s_qf_names[qtype], qname)) { |
| 1318 | ext4_msg(sb, KERN_ERR, | 1318 | ext4_msg(sb, KERN_ERR, |
| 1319 | "%s quota file already specified", QTYPE2NAME(qtype)); | 1319 | "%s quota file already specified", QTYPE2NAME(qtype)); |
| 1320 | kfree(qname); | 1320 | kfree(qname); |
| 1321 | return 0; | 1321 | return -1; |
| 1322 | } | 1322 | } |
| 1323 | sbi->s_qf_names[qtype] = qname; | 1323 | sbi->s_qf_names[qtype] = qname; |
| 1324 | if (strchr(sbi->s_qf_names[qtype], '/')) { | 1324 | if (strchr(sbi->s_qf_names[qtype], '/')) { |
| @@ -1326,7 +1326,7 @@ static int set_qf_name(struct super_block *sb, int qtype, substring_t *args) | |||
| 1326 | "quotafile must be on filesystem root"); | 1326 | "quotafile must be on filesystem root"); |
| 1327 | kfree(sbi->s_qf_names[qtype]); | 1327 | kfree(sbi->s_qf_names[qtype]); |
| 1328 | sbi->s_qf_names[qtype] = NULL; | 1328 | sbi->s_qf_names[qtype] = NULL; |
| 1329 | return 0; | 1329 | return -1; |
| 1330 | } | 1330 | } |
| 1331 | set_opt(sb, QUOTA); | 1331 | set_opt(sb, QUOTA); |
| 1332 | return 1; | 1332 | return 1; |
| @@ -1341,7 +1341,7 @@ static int clear_qf_name(struct super_block *sb, int qtype) | |||
| 1341 | sbi->s_qf_names[qtype]) { | 1341 | sbi->s_qf_names[qtype]) { |
| 1342 | ext4_msg(sb, KERN_ERR, "Cannot change journaled quota options" | 1342 | ext4_msg(sb, KERN_ERR, "Cannot change journaled quota options" |
| 1343 | " when quota turned on"); | 1343 | " when quota turned on"); |
| 1344 | return 0; | 1344 | return -1; |
| 1345 | } | 1345 | } |
| 1346 | /* | 1346 | /* |
| 1347 | * The space will be released later when all options are confirmed | 1347 | * The space will be released later when all options are confirmed |
| @@ -1450,6 +1450,16 @@ static int handle_mount_opt(struct super_block *sb, char *opt, int token, | |||
| 1450 | const struct mount_opts *m; | 1450 | const struct mount_opts *m; |
| 1451 | int arg = 0; | 1451 | int arg = 0; |
| 1452 | 1452 | ||
| 1453 | #ifdef CONFIG_QUOTA | ||
| 1454 | if (token == Opt_usrjquota) | ||
| 1455 | return set_qf_name(sb, USRQUOTA, &args[0]); | ||
| 1456 | else if (token == Opt_grpjquota) | ||
| 1457 | return set_qf_name(sb, GRPQUOTA, &args[0]); | ||
| 1458 | else if (token == Opt_offusrjquota) | ||
| 1459 | return clear_qf_name(sb, USRQUOTA); | ||
| 1460 | else if (token == Opt_offgrpjquota) | ||
| 1461 | return clear_qf_name(sb, GRPQUOTA); | ||
| 1462 | #endif | ||
| 1453 | if (args->from && match_int(args, &arg)) | 1463 | if (args->from && match_int(args, &arg)) |
| 1454 | return -1; | 1464 | return -1; |
| 1455 | switch (token) { | 1465 | switch (token) { |
| @@ -1549,18 +1559,6 @@ static int handle_mount_opt(struct super_block *sb, char *opt, int token, | |||
| 1549 | sbi->s_mount_opt |= m->mount_opt; | 1559 | sbi->s_mount_opt |= m->mount_opt; |
| 1550 | } | 1560 | } |
| 1551 | #ifdef CONFIG_QUOTA | 1561 | #ifdef CONFIG_QUOTA |
| 1552 | } else if (token == Opt_usrjquota) { | ||
| 1553 | if (!set_qf_name(sb, USRQUOTA, &args[0])) | ||
| 1554 | return -1; | ||
| 1555 | } else if (token == Opt_grpjquota) { | ||
| 1556 | if (!set_qf_name(sb, GRPQUOTA, &args[0])) | ||
| 1557 | return -1; | ||
| 1558 | } else if (token == Opt_offusrjquota) { | ||
| 1559 | if (!clear_qf_name(sb, USRQUOTA)) | ||
| 1560 | return -1; | ||
| 1561 | } else if (token == Opt_offgrpjquota) { | ||
| 1562 | if (!clear_qf_name(sb, GRPQUOTA)) | ||
| 1563 | return -1; | ||
| 1564 | } else if (m->flags & MOPT_QFMT) { | 1562 | } else if (m->flags & MOPT_QFMT) { |
| 1565 | if (sb_any_quota_loaded(sb) && | 1563 | if (sb_any_quota_loaded(sb) && |
| 1566 | sbi->s_jquota_fmt != m->mount_opt) { | 1564 | sbi->s_jquota_fmt != m->mount_opt) { |
| @@ -1599,7 +1597,9 @@ static int parse_options(char *options, struct super_block *sb, | |||
| 1599 | unsigned int *journal_ioprio, | 1597 | unsigned int *journal_ioprio, |
| 1600 | int is_remount) | 1598 | int is_remount) |
| 1601 | { | 1599 | { |
| 1600 | #ifdef CONFIG_QUOTA | ||
| 1602 | struct ext4_sb_info *sbi = EXT4_SB(sb); | 1601 | struct ext4_sb_info *sbi = EXT4_SB(sb); |
| 1602 | #endif | ||
| 1603 | char *p; | 1603 | char *p; |
| 1604 | substring_t args[MAX_OPT_ARGS]; | 1604 | substring_t args[MAX_OPT_ARGS]; |
| 1605 | int token; | 1605 | int token; |
| @@ -2366,18 +2366,6 @@ static ssize_t lifetime_write_kbytes_show(struct ext4_attr *a, | |||
| 2366 | EXT4_SB(sb)->s_sectors_written_start) >> 1))); | 2366 | EXT4_SB(sb)->s_sectors_written_start) >> 1))); |
| 2367 | } | 2367 | } |
| 2368 | 2368 | ||
| 2369 | static ssize_t extent_cache_hits_show(struct ext4_attr *a, | ||
| 2370 | struct ext4_sb_info *sbi, char *buf) | ||
| 2371 | { | ||
| 2372 | return snprintf(buf, PAGE_SIZE, "%lu\n", sbi->extent_cache_hits); | ||
| 2373 | } | ||
| 2374 | |||
| 2375 | static ssize_t extent_cache_misses_show(struct ext4_attr *a, | ||
| 2376 | struct ext4_sb_info *sbi, char *buf) | ||
| 2377 | { | ||
| 2378 | return snprintf(buf, PAGE_SIZE, "%lu\n", sbi->extent_cache_misses); | ||
| 2379 | } | ||
| 2380 | |||
| 2381 | static ssize_t inode_readahead_blks_store(struct ext4_attr *a, | 2369 | static ssize_t inode_readahead_blks_store(struct ext4_attr *a, |
| 2382 | struct ext4_sb_info *sbi, | 2370 | struct ext4_sb_info *sbi, |
| 2383 | const char *buf, size_t count) | 2371 | const char *buf, size_t count) |
| @@ -2435,8 +2423,6 @@ static struct ext4_attr ext4_attr_##name = __ATTR(name, mode, show, store) | |||
| 2435 | EXT4_RO_ATTR(delayed_allocation_blocks); | 2423 | EXT4_RO_ATTR(delayed_allocation_blocks); |
| 2436 | EXT4_RO_ATTR(session_write_kbytes); | 2424 | EXT4_RO_ATTR(session_write_kbytes); |
| 2437 | EXT4_RO_ATTR(lifetime_write_kbytes); | 2425 | EXT4_RO_ATTR(lifetime_write_kbytes); |
| 2438 | EXT4_RO_ATTR(extent_cache_hits); | ||
| 2439 | EXT4_RO_ATTR(extent_cache_misses); | ||
| 2440 | EXT4_ATTR_OFFSET(inode_readahead_blks, 0644, sbi_ui_show, | 2426 | EXT4_ATTR_OFFSET(inode_readahead_blks, 0644, sbi_ui_show, |
| 2441 | inode_readahead_blks_store, s_inode_readahead_blks); | 2427 | inode_readahead_blks_store, s_inode_readahead_blks); |
| 2442 | EXT4_RW_ATTR_SBI_UI(inode_goal, s_inode_goal); | 2428 | EXT4_RW_ATTR_SBI_UI(inode_goal, s_inode_goal); |
| @@ -2452,8 +2438,6 @@ static struct attribute *ext4_attrs[] = { | |||
| 2452 | ATTR_LIST(delayed_allocation_blocks), | 2438 | ATTR_LIST(delayed_allocation_blocks), |
| 2453 | ATTR_LIST(session_write_kbytes), | 2439 | ATTR_LIST(session_write_kbytes), |
| 2454 | ATTR_LIST(lifetime_write_kbytes), | 2440 | ATTR_LIST(lifetime_write_kbytes), |
| 2455 | ATTR_LIST(extent_cache_hits), | ||
| 2456 | ATTR_LIST(extent_cache_misses), | ||
| 2457 | ATTR_LIST(inode_readahead_blks), | 2441 | ATTR_LIST(inode_readahead_blks), |
| 2458 | ATTR_LIST(inode_goal), | 2442 | ATTR_LIST(inode_goal), |
| 2459 | ATTR_LIST(mb_stats), | 2443 | ATTR_LIST(mb_stats), |
diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c index 206632887bb4..df5ac048dc74 100644 --- a/fs/fuse/dir.c +++ b/fs/fuse/dir.c | |||
| @@ -387,9 +387,6 @@ static int fuse_create_open(struct inode *dir, struct dentry *entry, | |||
| 387 | if (fc->no_create) | 387 | if (fc->no_create) |
| 388 | return -ENOSYS; | 388 | return -ENOSYS; |
| 389 | 389 | ||
| 390 | if (flags & O_DIRECT) | ||
| 391 | return -EINVAL; | ||
| 392 | |||
| 393 | forget = fuse_alloc_forget(); | 390 | forget = fuse_alloc_forget(); |
| 394 | if (!forget) | 391 | if (!forget) |
| 395 | return -ENOMEM; | 392 | return -ENOMEM; |
| @@ -644,13 +641,12 @@ static int fuse_unlink(struct inode *dir, struct dentry *entry) | |||
| 644 | fuse_put_request(fc, req); | 641 | fuse_put_request(fc, req); |
| 645 | if (!err) { | 642 | if (!err) { |
| 646 | struct inode *inode = entry->d_inode; | 643 | struct inode *inode = entry->d_inode; |
| 644 | struct fuse_inode *fi = get_fuse_inode(inode); | ||
| 647 | 645 | ||
| 648 | /* | 646 | spin_lock(&fc->lock); |
| 649 | * Set nlink to zero so the inode can be cleared, if the inode | 647 | fi->attr_version = ++fc->attr_version; |
| 650 | * does have more links this will be discovered at the next | 648 | drop_nlink(inode); |
| 651 | * lookup/getattr. | 649 | spin_unlock(&fc->lock); |
| 652 | */ | ||
| 653 | clear_nlink(inode); | ||
| 654 | fuse_invalidate_attr(inode); | 650 | fuse_invalidate_attr(inode); |
| 655 | fuse_invalidate_attr(dir); | 651 | fuse_invalidate_attr(dir); |
| 656 | fuse_invalidate_entry_cache(entry); | 652 | fuse_invalidate_entry_cache(entry); |
| @@ -762,8 +758,17 @@ static int fuse_link(struct dentry *entry, struct inode *newdir, | |||
| 762 | will reflect changes in the backing inode (link count, | 758 | will reflect changes in the backing inode (link count, |
| 763 | etc.) | 759 | etc.) |
| 764 | */ | 760 | */ |
| 765 | if (!err || err == -EINTR) | 761 | if (!err) { |
| 762 | struct fuse_inode *fi = get_fuse_inode(inode); | ||
| 763 | |||
| 764 | spin_lock(&fc->lock); | ||
| 765 | fi->attr_version = ++fc->attr_version; | ||
| 766 | inc_nlink(inode); | ||
| 767 | spin_unlock(&fc->lock); | ||
| 768 | fuse_invalidate_attr(inode); | ||
| 769 | } else if (err == -EINTR) { | ||
| 766 | fuse_invalidate_attr(inode); | 770 | fuse_invalidate_attr(inode); |
| 771 | } | ||
| 767 | return err; | 772 | return err; |
| 768 | } | 773 | } |
| 769 | 774 | ||
diff --git a/fs/fuse/file.c b/fs/fuse/file.c index a841868bf9ce..504e61b7fd75 100644 --- a/fs/fuse/file.c +++ b/fs/fuse/file.c | |||
| @@ -194,10 +194,6 @@ int fuse_open_common(struct inode *inode, struct file *file, bool isdir) | |||
| 194 | struct fuse_conn *fc = get_fuse_conn(inode); | 194 | struct fuse_conn *fc = get_fuse_conn(inode); |
| 195 | int err; | 195 | int err; |
| 196 | 196 | ||
| 197 | /* VFS checks this, but only _after_ ->open() */ | ||
| 198 | if (file->f_flags & O_DIRECT) | ||
| 199 | return -EINVAL; | ||
| 200 | |||
| 201 | err = generic_file_open(inode, file); | 197 | err = generic_file_open(inode, file); |
| 202 | if (err) | 198 | if (err) |
| 203 | return err; | 199 | return err; |
| @@ -932,17 +928,23 @@ static ssize_t fuse_file_aio_write(struct kiocb *iocb, const struct iovec *iov, | |||
| 932 | struct file *file = iocb->ki_filp; | 928 | struct file *file = iocb->ki_filp; |
| 933 | struct address_space *mapping = file->f_mapping; | 929 | struct address_space *mapping = file->f_mapping; |
| 934 | size_t count = 0; | 930 | size_t count = 0; |
| 931 | size_t ocount = 0; | ||
| 935 | ssize_t written = 0; | 932 | ssize_t written = 0; |
| 933 | ssize_t written_buffered = 0; | ||
| 936 | struct inode *inode = mapping->host; | 934 | struct inode *inode = mapping->host; |
| 937 | ssize_t err; | 935 | ssize_t err; |
| 938 | struct iov_iter i; | 936 | struct iov_iter i; |
| 937 | loff_t endbyte = 0; | ||
| 939 | 938 | ||
| 940 | WARN_ON(iocb->ki_pos != pos); | 939 | WARN_ON(iocb->ki_pos != pos); |
| 941 | 940 | ||
| 942 | err = generic_segment_checks(iov, &nr_segs, &count, VERIFY_READ); | 941 | ocount = 0; |
| 942 | err = generic_segment_checks(iov, &nr_segs, &ocount, VERIFY_READ); | ||
| 943 | if (err) | 943 | if (err) |
| 944 | return err; | 944 | return err; |
| 945 | 945 | ||
| 946 | count = ocount; | ||
| 947 | |||
| 946 | mutex_lock(&inode->i_mutex); | 948 | mutex_lock(&inode->i_mutex); |
| 947 | vfs_check_frozen(inode->i_sb, SB_FREEZE_WRITE); | 949 | vfs_check_frozen(inode->i_sb, SB_FREEZE_WRITE); |
| 948 | 950 | ||
| @@ -962,11 +964,41 @@ static ssize_t fuse_file_aio_write(struct kiocb *iocb, const struct iovec *iov, | |||
| 962 | 964 | ||
| 963 | file_update_time(file); | 965 | file_update_time(file); |
| 964 | 966 | ||
| 965 | iov_iter_init(&i, iov, nr_segs, count, 0); | 967 | if (file->f_flags & O_DIRECT) { |
| 966 | written = fuse_perform_write(file, mapping, &i, pos); | 968 | written = generic_file_direct_write(iocb, iov, &nr_segs, |
| 967 | if (written >= 0) | 969 | pos, &iocb->ki_pos, |
| 968 | iocb->ki_pos = pos + written; | 970 | count, ocount); |
| 971 | if (written < 0 || written == count) | ||
| 972 | goto out; | ||
| 973 | |||
| 974 | pos += written; | ||
| 975 | count -= written; | ||
| 969 | 976 | ||
| 977 | iov_iter_init(&i, iov, nr_segs, count, written); | ||
| 978 | written_buffered = fuse_perform_write(file, mapping, &i, pos); | ||
| 979 | if (written_buffered < 0) { | ||
| 980 | err = written_buffered; | ||
| 981 | goto out; | ||
| 982 | } | ||
| 983 | endbyte = pos + written_buffered - 1; | ||
| 984 | |||
| 985 | err = filemap_write_and_wait_range(file->f_mapping, pos, | ||
| 986 | endbyte); | ||
| 987 | if (err) | ||
| 988 | goto out; | ||
| 989 | |||
| 990 | invalidate_mapping_pages(file->f_mapping, | ||
| 991 | pos >> PAGE_CACHE_SHIFT, | ||
| 992 | endbyte >> PAGE_CACHE_SHIFT); | ||
| 993 | |||
| 994 | written += written_buffered; | ||
| 995 | iocb->ki_pos = pos + written_buffered; | ||
| 996 | } else { | ||
| 997 | iov_iter_init(&i, iov, nr_segs, count, 0); | ||
| 998 | written = fuse_perform_write(file, mapping, &i, pos); | ||
| 999 | if (written >= 0) | ||
| 1000 | iocb->ki_pos = pos + written; | ||
| 1001 | } | ||
| 970 | out: | 1002 | out: |
| 971 | current->backing_dev_info = NULL; | 1003 | current->backing_dev_info = NULL; |
| 972 | mutex_unlock(&inode->i_mutex); | 1004 | mutex_unlock(&inode->i_mutex); |
| @@ -1101,30 +1133,41 @@ static ssize_t fuse_direct_read(struct file *file, char __user *buf, | |||
| 1101 | return res; | 1133 | return res; |
| 1102 | } | 1134 | } |
| 1103 | 1135 | ||
| 1104 | static ssize_t fuse_direct_write(struct file *file, const char __user *buf, | 1136 | static ssize_t __fuse_direct_write(struct file *file, const char __user *buf, |
| 1105 | size_t count, loff_t *ppos) | 1137 | size_t count, loff_t *ppos) |
| 1106 | { | 1138 | { |
| 1107 | struct inode *inode = file->f_path.dentry->d_inode; | 1139 | struct inode *inode = file->f_path.dentry->d_inode; |
| 1108 | ssize_t res; | 1140 | ssize_t res; |
| 1109 | 1141 | ||
| 1110 | if (is_bad_inode(inode)) | ||
| 1111 | return -EIO; | ||
| 1112 | |||
| 1113 | /* Don't allow parallel writes to the same file */ | ||
| 1114 | mutex_lock(&inode->i_mutex); | ||
| 1115 | res = generic_write_checks(file, ppos, &count, 0); | 1142 | res = generic_write_checks(file, ppos, &count, 0); |
| 1116 | if (!res) { | 1143 | if (!res) { |
| 1117 | res = fuse_direct_io(file, buf, count, ppos, 1); | 1144 | res = fuse_direct_io(file, buf, count, ppos, 1); |
| 1118 | if (res > 0) | 1145 | if (res > 0) |
| 1119 | fuse_write_update_size(inode, *ppos); | 1146 | fuse_write_update_size(inode, *ppos); |
| 1120 | } | 1147 | } |
| 1121 | mutex_unlock(&inode->i_mutex); | ||
| 1122 | 1148 | ||
| 1123 | fuse_invalidate_attr(inode); | 1149 | fuse_invalidate_attr(inode); |
| 1124 | 1150 | ||
| 1125 | return res; | 1151 | return res; |
| 1126 | } | 1152 | } |
| 1127 | 1153 | ||
| 1154 | static ssize_t fuse_direct_write(struct file *file, const char __user *buf, | ||
| 1155 | size_t count, loff_t *ppos) | ||
| 1156 | { | ||
| 1157 | struct inode *inode = file->f_path.dentry->d_inode; | ||
| 1158 | ssize_t res; | ||
| 1159 | |||
| 1160 | if (is_bad_inode(inode)) | ||
| 1161 | return -EIO; | ||
| 1162 | |||
| 1163 | /* Don't allow parallel writes to the same file */ | ||
| 1164 | mutex_lock(&inode->i_mutex); | ||
| 1165 | res = __fuse_direct_write(file, buf, count, ppos); | ||
| 1166 | mutex_unlock(&inode->i_mutex); | ||
| 1167 | |||
| 1168 | return res; | ||
| 1169 | } | ||
| 1170 | |||
| 1128 | static void fuse_writepage_free(struct fuse_conn *fc, struct fuse_req *req) | 1171 | static void fuse_writepage_free(struct fuse_conn *fc, struct fuse_req *req) |
| 1129 | { | 1172 | { |
| 1130 | __free_page(req->pages[0]); | 1173 | __free_page(req->pages[0]); |
| @@ -2077,6 +2120,57 @@ int fuse_notify_poll_wakeup(struct fuse_conn *fc, | |||
| 2077 | return 0; | 2120 | return 0; |
| 2078 | } | 2121 | } |
| 2079 | 2122 | ||
| 2123 | static ssize_t fuse_loop_dio(struct file *filp, const struct iovec *iov, | ||
| 2124 | unsigned long nr_segs, loff_t *ppos, int rw) | ||
| 2125 | { | ||
| 2126 | const struct iovec *vector = iov; | ||
| 2127 | ssize_t ret = 0; | ||
| 2128 | |||
| 2129 | while (nr_segs > 0) { | ||
| 2130 | void __user *base; | ||
| 2131 | size_t len; | ||
| 2132 | ssize_t nr; | ||
| 2133 | |||
| 2134 | base = vector->iov_base; | ||
| 2135 | len = vector->iov_len; | ||
| 2136 | vector++; | ||
| 2137 | nr_segs--; | ||
| 2138 | |||
| 2139 | if (rw == WRITE) | ||
| 2140 | nr = __fuse_direct_write(filp, base, len, ppos); | ||
| 2141 | else | ||
| 2142 | nr = fuse_direct_read(filp, base, len, ppos); | ||
| 2143 | |||
| 2144 | if (nr < 0) { | ||
| 2145 | if (!ret) | ||
| 2146 | ret = nr; | ||
| 2147 | break; | ||
| 2148 | } | ||
| 2149 | ret += nr; | ||
| 2150 | if (nr != len) | ||
| 2151 | break; | ||
| 2152 | } | ||
| 2153 | |||
| 2154 | return ret; | ||
| 2155 | } | ||
| 2156 | |||
| 2157 | |||
| 2158 | static ssize_t | ||
| 2159 | fuse_direct_IO(int rw, struct kiocb *iocb, const struct iovec *iov, | ||
| 2160 | loff_t offset, unsigned long nr_segs) | ||
| 2161 | { | ||
| 2162 | ssize_t ret = 0; | ||
| 2163 | struct file *file = NULL; | ||
| 2164 | loff_t pos = 0; | ||
| 2165 | |||
| 2166 | file = iocb->ki_filp; | ||
| 2167 | pos = offset; | ||
| 2168 | |||
| 2169 | ret = fuse_loop_dio(file, iov, nr_segs, &pos, rw); | ||
| 2170 | |||
| 2171 | return ret; | ||
| 2172 | } | ||
| 2173 | |||
| 2080 | static const struct file_operations fuse_file_operations = { | 2174 | static const struct file_operations fuse_file_operations = { |
| 2081 | .llseek = fuse_file_llseek, | 2175 | .llseek = fuse_file_llseek, |
| 2082 | .read = do_sync_read, | 2176 | .read = do_sync_read, |
| @@ -2120,6 +2214,7 @@ static const struct address_space_operations fuse_file_aops = { | |||
| 2120 | .readpages = fuse_readpages, | 2214 | .readpages = fuse_readpages, |
| 2121 | .set_page_dirty = __set_page_dirty_nobuffers, | 2215 | .set_page_dirty = __set_page_dirty_nobuffers, |
| 2122 | .bmap = fuse_bmap, | 2216 | .bmap = fuse_bmap, |
| 2217 | .direct_IO = fuse_direct_IO, | ||
| 2123 | }; | 2218 | }; |
| 2124 | 2219 | ||
| 2125 | void fuse_init_file_inode(struct inode *inode) | 2220 | void fuse_init_file_inode(struct inode *inode) |
diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c index 4aec5995867e..26783eb2b1fc 100644 --- a/fs/fuse/inode.c +++ b/fs/fuse/inode.c | |||
| @@ -947,6 +947,7 @@ static int fuse_fill_super(struct super_block *sb, void *data, int silent) | |||
| 947 | sb->s_magic = FUSE_SUPER_MAGIC; | 947 | sb->s_magic = FUSE_SUPER_MAGIC; |
| 948 | sb->s_op = &fuse_super_operations; | 948 | sb->s_op = &fuse_super_operations; |
| 949 | sb->s_maxbytes = MAX_LFS_FILESIZE; | 949 | sb->s_maxbytes = MAX_LFS_FILESIZE; |
| 950 | sb->s_time_gran = 1; | ||
| 950 | sb->s_export_op = &fuse_export_operations; | 951 | sb->s_export_op = &fuse_export_operations; |
| 951 | 952 | ||
| 952 | file = fget(d.fd); | 953 | file = fget(d.fd); |
diff --git a/fs/gfs2/lock_dlm.c b/fs/gfs2/lock_dlm.c index f8411bd1b805..5f5e70e047dc 100644 --- a/fs/gfs2/lock_dlm.c +++ b/fs/gfs2/lock_dlm.c | |||
| @@ -200,10 +200,11 @@ static int make_mode(const unsigned int lmstate) | |||
| 200 | return -1; | 200 | return -1; |
| 201 | } | 201 | } |
| 202 | 202 | ||
| 203 | static u32 make_flags(const u32 lkid, const unsigned int gfs_flags, | 203 | static u32 make_flags(struct gfs2_glock *gl, const unsigned int gfs_flags, |
| 204 | const int req) | 204 | const int req) |
| 205 | { | 205 | { |
| 206 | u32 lkf = DLM_LKF_VALBLK; | 206 | u32 lkf = DLM_LKF_VALBLK; |
| 207 | u32 lkid = gl->gl_lksb.sb_lkid; | ||
| 207 | 208 | ||
| 208 | if (gfs_flags & LM_FLAG_TRY) | 209 | if (gfs_flags & LM_FLAG_TRY) |
| 209 | lkf |= DLM_LKF_NOQUEUE; | 210 | lkf |= DLM_LKF_NOQUEUE; |
| @@ -227,8 +228,11 @@ static u32 make_flags(const u32 lkid, const unsigned int gfs_flags, | |||
| 227 | BUG(); | 228 | BUG(); |
| 228 | } | 229 | } |
| 229 | 230 | ||
| 230 | if (lkid != 0) | 231 | if (lkid != 0) { |
| 231 | lkf |= DLM_LKF_CONVERT; | 232 | lkf |= DLM_LKF_CONVERT; |
| 233 | if (test_bit(GLF_BLOCKING, &gl->gl_flags)) | ||
| 234 | lkf |= DLM_LKF_QUECVT; | ||
| 235 | } | ||
| 232 | 236 | ||
| 233 | return lkf; | 237 | return lkf; |
| 234 | } | 238 | } |
| @@ -250,7 +254,7 @@ static int gdlm_lock(struct gfs2_glock *gl, unsigned int req_state, | |||
| 250 | char strname[GDLM_STRNAME_BYTES] = ""; | 254 | char strname[GDLM_STRNAME_BYTES] = ""; |
| 251 | 255 | ||
| 252 | req = make_mode(req_state); | 256 | req = make_mode(req_state); |
| 253 | lkf = make_flags(gl->gl_lksb.sb_lkid, flags, req); | 257 | lkf = make_flags(gl, flags, req); |
| 254 | gfs2_glstats_inc(gl, GFS2_LKS_DCOUNT); | 258 | gfs2_glstats_inc(gl, GFS2_LKS_DCOUNT); |
| 255 | gfs2_sbstats_inc(gl, GFS2_LKS_DCOUNT); | 259 | gfs2_sbstats_inc(gl, GFS2_LKS_DCOUNT); |
| 256 | if (gl->gl_lksb.sb_lkid) { | 260 | if (gl->gl_lksb.sb_lkid) { |
diff --git a/fs/hfsplus/catalog.c b/fs/hfsplus/catalog.c index 4dfbfec357e8..ec2a9c23f0c9 100644 --- a/fs/hfsplus/catalog.c +++ b/fs/hfsplus/catalog.c | |||
| @@ -366,6 +366,10 @@ int hfsplus_rename_cat(u32 cnid, | |||
| 366 | err = hfs_brec_find(&src_fd); | 366 | err = hfs_brec_find(&src_fd); |
| 367 | if (err) | 367 | if (err) |
| 368 | goto out; | 368 | goto out; |
| 369 | if (src_fd.entrylength > sizeof(entry) || src_fd.entrylength < 0) { | ||
| 370 | err = -EIO; | ||
| 371 | goto out; | ||
| 372 | } | ||
| 369 | 373 | ||
| 370 | hfs_bnode_read(src_fd.bnode, &entry, src_fd.entryoffset, | 374 | hfs_bnode_read(src_fd.bnode, &entry, src_fd.entryoffset, |
| 371 | src_fd.entrylength); | 375 | src_fd.entrylength); |
diff --git a/fs/hfsplus/dir.c b/fs/hfsplus/dir.c index 88e155f895c6..26b53fb09f68 100644 --- a/fs/hfsplus/dir.c +++ b/fs/hfsplus/dir.c | |||
| @@ -150,6 +150,11 @@ static int hfsplus_readdir(struct file *filp, void *dirent, filldir_t filldir) | |||
| 150 | filp->f_pos++; | 150 | filp->f_pos++; |
| 151 | /* fall through */ | 151 | /* fall through */ |
| 152 | case 1: | 152 | case 1: |
| 153 | if (fd.entrylength > sizeof(entry) || fd.entrylength < 0) { | ||
| 154 | err = -EIO; | ||
| 155 | goto out; | ||
| 156 | } | ||
| 157 | |||
| 153 | hfs_bnode_read(fd.bnode, &entry, fd.entryoffset, | 158 | hfs_bnode_read(fd.bnode, &entry, fd.entryoffset, |
| 154 | fd.entrylength); | 159 | fd.entrylength); |
| 155 | if (be16_to_cpu(entry.type) != HFSPLUS_FOLDER_THREAD) { | 160 | if (be16_to_cpu(entry.type) != HFSPLUS_FOLDER_THREAD) { |
| @@ -181,6 +186,12 @@ static int hfsplus_readdir(struct file *filp, void *dirent, filldir_t filldir) | |||
| 181 | err = -EIO; | 186 | err = -EIO; |
| 182 | goto out; | 187 | goto out; |
| 183 | } | 188 | } |
| 189 | |||
| 190 | if (fd.entrylength > sizeof(entry) || fd.entrylength < 0) { | ||
| 191 | err = -EIO; | ||
| 192 | goto out; | ||
| 193 | } | ||
| 194 | |||
| 184 | hfs_bnode_read(fd.bnode, &entry, fd.entryoffset, | 195 | hfs_bnode_read(fd.bnode, &entry, fd.entryoffset, |
| 185 | fd.entrylength); | 196 | fd.entrylength); |
| 186 | type = be16_to_cpu(entry.type); | 197 | type = be16_to_cpu(entry.type); |
diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c index 28cf06e4ec84..001ef01d2fe2 100644 --- a/fs/hugetlbfs/inode.c +++ b/fs/hugetlbfs/inode.c | |||
| @@ -485,6 +485,7 @@ static struct inode *hugetlbfs_get_root(struct super_block *sb, | |||
| 485 | inode->i_fop = &simple_dir_operations; | 485 | inode->i_fop = &simple_dir_operations; |
| 486 | /* directory inodes start off with i_nlink == 2 (for "." entry) */ | 486 | /* directory inodes start off with i_nlink == 2 (for "." entry) */ |
| 487 | inc_nlink(inode); | 487 | inc_nlink(inode); |
| 488 | lockdep_annotate_inode_mutex_key(inode); | ||
| 488 | } | 489 | } |
| 489 | return inode; | 490 | return inode; |
| 490 | } | 491 | } |
diff --git a/fs/jbd2/commit.c b/fs/jbd2/commit.c index 806525a7269c..840f70f50792 100644 --- a/fs/jbd2/commit.c +++ b/fs/jbd2/commit.c | |||
| @@ -723,7 +723,7 @@ start_journal_io: | |||
| 723 | if (commit_transaction->t_need_data_flush && | 723 | if (commit_transaction->t_need_data_flush && |
| 724 | (journal->j_fs_dev != journal->j_dev) && | 724 | (journal->j_fs_dev != journal->j_dev) && |
| 725 | (journal->j_flags & JBD2_BARRIER)) | 725 | (journal->j_flags & JBD2_BARRIER)) |
| 726 | blkdev_issue_flush(journal->j_fs_dev, GFP_KERNEL, NULL); | 726 | blkdev_issue_flush(journal->j_fs_dev, GFP_NOFS, NULL); |
| 727 | 727 | ||
| 728 | /* Done it all: now write the commit record asynchronously. */ | 728 | /* Done it all: now write the commit record asynchronously. */ |
| 729 | if (JBD2_HAS_INCOMPAT_FEATURE(journal, | 729 | if (JBD2_HAS_INCOMPAT_FEATURE(journal, |
| @@ -859,7 +859,7 @@ wait_for_iobuf: | |||
| 859 | if (JBD2_HAS_INCOMPAT_FEATURE(journal, | 859 | if (JBD2_HAS_INCOMPAT_FEATURE(journal, |
| 860 | JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT) && | 860 | JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT) && |
| 861 | journal->j_flags & JBD2_BARRIER) { | 861 | journal->j_flags & JBD2_BARRIER) { |
| 862 | blkdev_issue_flush(journal->j_dev, GFP_KERNEL, NULL); | 862 | blkdev_issue_flush(journal->j_dev, GFP_NOFS, NULL); |
| 863 | } | 863 | } |
| 864 | 864 | ||
| 865 | if (err) | 865 | if (err) |
diff --git a/fs/lockd/clnt4xdr.c b/fs/lockd/clnt4xdr.c index 3ddcbb1c0a43..13ad1539fbf2 100644 --- a/fs/lockd/clnt4xdr.c +++ b/fs/lockd/clnt4xdr.c | |||
| @@ -241,7 +241,7 @@ static int decode_nlm4_stat(struct xdr_stream *xdr, __be32 *stat) | |||
| 241 | p = xdr_inline_decode(xdr, 4); | 241 | p = xdr_inline_decode(xdr, 4); |
| 242 | if (unlikely(p == NULL)) | 242 | if (unlikely(p == NULL)) |
| 243 | goto out_overflow; | 243 | goto out_overflow; |
| 244 | if (unlikely(*p > nlm4_failed)) | 244 | if (unlikely(ntohl(*p) > ntohl(nlm4_failed))) |
| 245 | goto out_bad_xdr; | 245 | goto out_bad_xdr; |
| 246 | *stat = *p; | 246 | *stat = *p; |
| 247 | return 0; | 247 | return 0; |
diff --git a/fs/lockd/clntxdr.c b/fs/lockd/clntxdr.c index 3d35e3e80c1c..d269ada7670e 100644 --- a/fs/lockd/clntxdr.c +++ b/fs/lockd/clntxdr.c | |||
| @@ -236,7 +236,7 @@ static int decode_nlm_stat(struct xdr_stream *xdr, | |||
| 236 | p = xdr_inline_decode(xdr, 4); | 236 | p = xdr_inline_decode(xdr, 4); |
| 237 | if (unlikely(p == NULL)) | 237 | if (unlikely(p == NULL)) |
| 238 | goto out_overflow; | 238 | goto out_overflow; |
| 239 | if (unlikely(*p > nlm_lck_denied_grace_period)) | 239 | if (unlikely(ntohl(*p) > ntohl(nlm_lck_denied_grace_period))) |
| 240 | goto out_enum; | 240 | goto out_enum; |
| 241 | *stat = *p; | 241 | *stat = *p; |
| 242 | return 0; | 242 | return 0; |
diff --git a/fs/namei.c b/fs/namei.c index 0062dd17eb55..c42791914f82 100644 --- a/fs/namei.c +++ b/fs/namei.c | |||
| @@ -1429,7 +1429,7 @@ unsigned int full_name_hash(const unsigned char *name, unsigned int len) | |||
| 1429 | unsigned long hash = 0; | 1429 | unsigned long hash = 0; |
| 1430 | 1430 | ||
| 1431 | for (;;) { | 1431 | for (;;) { |
| 1432 | a = *(unsigned long *)name; | 1432 | a = load_unaligned_zeropad(name); |
| 1433 | if (len < sizeof(unsigned long)) | 1433 | if (len < sizeof(unsigned long)) |
| 1434 | break; | 1434 | break; |
| 1435 | hash += a; | 1435 | hash += a; |
| @@ -1459,7 +1459,7 @@ static inline unsigned long hash_name(const char *name, unsigned int *hashp) | |||
| 1459 | do { | 1459 | do { |
| 1460 | hash = (hash + a) * 9; | 1460 | hash = (hash + a) * 9; |
| 1461 | len += sizeof(unsigned long); | 1461 | len += sizeof(unsigned long); |
| 1462 | a = *(unsigned long *)(name+len); | 1462 | a = load_unaligned_zeropad(name+len); |
| 1463 | /* Do we have any NUL or '/' bytes in this word? */ | 1463 | /* Do we have any NUL or '/' bytes in this word? */ |
| 1464 | mask = has_zero(a) | has_zero(a ^ REPEAT_BYTE('/')); | 1464 | mask = has_zero(a) | has_zero(a ^ REPEAT_BYTE('/')); |
| 1465 | } while (!mask); | 1465 | } while (!mask); |
diff --git a/fs/nfs/blocklayout/blocklayout.c b/fs/nfs/blocklayout/blocklayout.c index 9c94297bb70e..7f6a23f0244e 100644 --- a/fs/nfs/blocklayout/blocklayout.c +++ b/fs/nfs/blocklayout/blocklayout.c | |||
| @@ -38,6 +38,8 @@ | |||
| 38 | #include <linux/buffer_head.h> /* various write calls */ | 38 | #include <linux/buffer_head.h> /* various write calls */ |
| 39 | #include <linux/prefetch.h> | 39 | #include <linux/prefetch.h> |
| 40 | 40 | ||
| 41 | #include "../pnfs.h" | ||
| 42 | #include "../internal.h" | ||
| 41 | #include "blocklayout.h" | 43 | #include "blocklayout.h" |
| 42 | 44 | ||
| 43 | #define NFSDBG_FACILITY NFSDBG_PNFS_LD | 45 | #define NFSDBG_FACILITY NFSDBG_PNFS_LD |
| @@ -868,7 +870,7 @@ nfs4_blk_get_deviceinfo(struct nfs_server *server, const struct nfs_fh *fh, | |||
| 868 | * GETDEVICEINFO's maxcount | 870 | * GETDEVICEINFO's maxcount |
| 869 | */ | 871 | */ |
| 870 | max_resp_sz = server->nfs_client->cl_session->fc_attrs.max_resp_sz; | 872 | max_resp_sz = server->nfs_client->cl_session->fc_attrs.max_resp_sz; |
| 871 | max_pages = max_resp_sz >> PAGE_SHIFT; | 873 | max_pages = nfs_page_array_len(0, max_resp_sz); |
| 872 | dprintk("%s max_resp_sz %u max_pages %d\n", | 874 | dprintk("%s max_resp_sz %u max_pages %d\n", |
| 873 | __func__, max_resp_sz, max_pages); | 875 | __func__, max_resp_sz, max_pages); |
| 874 | 876 | ||
diff --git a/fs/nfs/client.c b/fs/nfs/client.c index da7b5e4ff9ec..60f7e4ec842c 100644 --- a/fs/nfs/client.c +++ b/fs/nfs/client.c | |||
| @@ -1729,7 +1729,8 @@ error: | |||
| 1729 | */ | 1729 | */ |
| 1730 | struct nfs_server *nfs_clone_server(struct nfs_server *source, | 1730 | struct nfs_server *nfs_clone_server(struct nfs_server *source, |
| 1731 | struct nfs_fh *fh, | 1731 | struct nfs_fh *fh, |
| 1732 | struct nfs_fattr *fattr) | 1732 | struct nfs_fattr *fattr, |
| 1733 | rpc_authflavor_t flavor) | ||
| 1733 | { | 1734 | { |
| 1734 | struct nfs_server *server; | 1735 | struct nfs_server *server; |
| 1735 | struct nfs_fattr *fattr_fsinfo; | 1736 | struct nfs_fattr *fattr_fsinfo; |
| @@ -1758,7 +1759,7 @@ struct nfs_server *nfs_clone_server(struct nfs_server *source, | |||
| 1758 | 1759 | ||
| 1759 | error = nfs_init_server_rpcclient(server, | 1760 | error = nfs_init_server_rpcclient(server, |
| 1760 | source->client->cl_timeout, | 1761 | source->client->cl_timeout, |
| 1761 | source->client->cl_auth->au_flavor); | 1762 | flavor); |
| 1762 | if (error < 0) | 1763 | if (error < 0) |
| 1763 | goto out_free_server; | 1764 | goto out_free_server; |
| 1764 | if (!IS_ERR(source->client_acl)) | 1765 | if (!IS_ERR(source->client_acl)) |
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c index 4aaf0316d76a..8789210c6905 100644 --- a/fs/nfs/dir.c +++ b/fs/nfs/dir.c | |||
| @@ -1429,7 +1429,7 @@ static struct dentry *nfs_atomic_lookup(struct inode *dir, struct dentry *dentry | |||
| 1429 | } | 1429 | } |
| 1430 | 1430 | ||
| 1431 | open_flags = nd->intent.open.flags; | 1431 | open_flags = nd->intent.open.flags; |
| 1432 | attr.ia_valid = 0; | 1432 | attr.ia_valid = ATTR_OPEN; |
| 1433 | 1433 | ||
| 1434 | ctx = create_nfs_open_context(dentry, open_flags); | 1434 | ctx = create_nfs_open_context(dentry, open_flags); |
| 1435 | res = ERR_CAST(ctx); | 1435 | res = ERR_CAST(ctx); |
| @@ -1536,7 +1536,7 @@ static int nfs_open_revalidate(struct dentry *dentry, struct nameidata *nd) | |||
| 1536 | if (IS_ERR(ctx)) | 1536 | if (IS_ERR(ctx)) |
| 1537 | goto out; | 1537 | goto out; |
| 1538 | 1538 | ||
| 1539 | attr.ia_valid = 0; | 1539 | attr.ia_valid = ATTR_OPEN; |
| 1540 | if (openflags & O_TRUNC) { | 1540 | if (openflags & O_TRUNC) { |
| 1541 | attr.ia_valid |= ATTR_SIZE; | 1541 | attr.ia_valid |= ATTR_SIZE; |
| 1542 | attr.ia_size = 0; | 1542 | attr.ia_size = 0; |
diff --git a/fs/nfs/idmap.c b/fs/nfs/idmap.c index b7f348bb618b..ba3019f5934c 100644 --- a/fs/nfs/idmap.c +++ b/fs/nfs/idmap.c | |||
| @@ -554,12 +554,16 @@ static int rpc_pipefs_event(struct notifier_block *nb, unsigned long event, | |||
| 554 | struct nfs_client *clp; | 554 | struct nfs_client *clp; |
| 555 | int error = 0; | 555 | int error = 0; |
| 556 | 556 | ||
| 557 | if (!try_module_get(THIS_MODULE)) | ||
| 558 | return 0; | ||
| 559 | |||
| 557 | while ((clp = nfs_get_client_for_event(sb->s_fs_info, event))) { | 560 | while ((clp = nfs_get_client_for_event(sb->s_fs_info, event))) { |
| 558 | error = __rpc_pipefs_event(clp, event, sb); | 561 | error = __rpc_pipefs_event(clp, event, sb); |
| 559 | nfs_put_client(clp); | 562 | nfs_put_client(clp); |
| 560 | if (error) | 563 | if (error) |
| 561 | break; | 564 | break; |
| 562 | } | 565 | } |
| 566 | module_put(THIS_MODULE); | ||
| 563 | return error; | 567 | return error; |
| 564 | } | 568 | } |
| 565 | 569 | ||
diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h index 2476dc69365f..b777bdaba4c5 100644 --- a/fs/nfs/internal.h +++ b/fs/nfs/internal.h | |||
| @@ -165,7 +165,8 @@ extern struct nfs_server *nfs4_create_referral_server(struct nfs_clone_mount *, | |||
| 165 | extern void nfs_free_server(struct nfs_server *server); | 165 | extern void nfs_free_server(struct nfs_server *server); |
| 166 | extern struct nfs_server *nfs_clone_server(struct nfs_server *, | 166 | extern struct nfs_server *nfs_clone_server(struct nfs_server *, |
| 167 | struct nfs_fh *, | 167 | struct nfs_fh *, |
| 168 | struct nfs_fattr *); | 168 | struct nfs_fattr *, |
| 169 | rpc_authflavor_t); | ||
| 169 | extern void nfs_mark_client_ready(struct nfs_client *clp, int state); | 170 | extern void nfs_mark_client_ready(struct nfs_client *clp, int state); |
| 170 | extern int nfs4_check_client_ready(struct nfs_client *clp); | 171 | extern int nfs4_check_client_ready(struct nfs_client *clp); |
| 171 | extern struct nfs_client *nfs4_set_ds_client(struct nfs_client* mds_clp, | 172 | extern struct nfs_client *nfs4_set_ds_client(struct nfs_client* mds_clp, |
| @@ -186,10 +187,10 @@ static inline void nfs_fs_proc_exit(void) | |||
| 186 | 187 | ||
| 187 | /* nfs4namespace.c */ | 188 | /* nfs4namespace.c */ |
| 188 | #ifdef CONFIG_NFS_V4 | 189 | #ifdef CONFIG_NFS_V4 |
| 189 | extern struct vfsmount *nfs_do_refmount(struct dentry *dentry); | 190 | extern struct vfsmount *nfs_do_refmount(struct rpc_clnt *client, struct dentry *dentry); |
| 190 | #else | 191 | #else |
| 191 | static inline | 192 | static inline |
| 192 | struct vfsmount *nfs_do_refmount(struct dentry *dentry) | 193 | struct vfsmount *nfs_do_refmount(struct rpc_clnt *client, struct dentry *dentry) |
| 193 | { | 194 | { |
| 194 | return ERR_PTR(-ENOENT); | 195 | return ERR_PTR(-ENOENT); |
| 195 | } | 196 | } |
| @@ -234,7 +235,6 @@ extern const u32 nfs41_maxwrite_overhead; | |||
| 234 | /* nfs4proc.c */ | 235 | /* nfs4proc.c */ |
| 235 | #ifdef CONFIG_NFS_V4 | 236 | #ifdef CONFIG_NFS_V4 |
| 236 | extern struct rpc_procinfo nfs4_procedures[]; | 237 | extern struct rpc_procinfo nfs4_procedures[]; |
| 237 | void nfs_fixup_secinfo_attributes(struct nfs_fattr *, struct nfs_fh *); | ||
| 238 | #endif | 238 | #endif |
| 239 | 239 | ||
| 240 | extern int nfs4_init_ds_session(struct nfs_client *clp); | 240 | extern int nfs4_init_ds_session(struct nfs_client *clp); |
diff --git a/fs/nfs/namespace.c b/fs/nfs/namespace.c index 1807866bb3ab..d51868e5683c 100644 --- a/fs/nfs/namespace.c +++ b/fs/nfs/namespace.c | |||
| @@ -148,66 +148,31 @@ rpc_authflavor_t nfs_find_best_sec(struct nfs4_secinfo_flavors *flavors) | |||
| 148 | return pseudoflavor; | 148 | return pseudoflavor; |
| 149 | } | 149 | } |
| 150 | 150 | ||
| 151 | static int nfs_negotiate_security(const struct dentry *parent, | 151 | static struct rpc_clnt *nfs_lookup_mountpoint(struct inode *dir, |
| 152 | const struct dentry *dentry, | 152 | struct qstr *name, |
| 153 | rpc_authflavor_t *flavor) | 153 | struct nfs_fh *fh, |
| 154 | struct nfs_fattr *fattr) | ||
| 154 | { | 155 | { |
| 155 | struct page *page; | ||
| 156 | struct nfs4_secinfo_flavors *flavors; | ||
| 157 | int (*secinfo)(struct inode *, const struct qstr *, struct nfs4_secinfo_flavors *); | ||
| 158 | int ret = -EPERM; | ||
| 159 | |||
| 160 | secinfo = NFS_PROTO(parent->d_inode)->secinfo; | ||
| 161 | if (secinfo != NULL) { | ||
| 162 | page = alloc_page(GFP_KERNEL); | ||
| 163 | if (!page) { | ||
| 164 | ret = -ENOMEM; | ||
| 165 | goto out; | ||
| 166 | } | ||
| 167 | flavors = page_address(page); | ||
| 168 | ret = secinfo(parent->d_inode, &dentry->d_name, flavors); | ||
| 169 | *flavor = nfs_find_best_sec(flavors); | ||
| 170 | put_page(page); | ||
| 171 | } | ||
| 172 | |||
| 173 | out: | ||
| 174 | return ret; | ||
| 175 | } | ||
| 176 | |||
| 177 | static int nfs_lookup_with_sec(struct nfs_server *server, struct dentry *parent, | ||
| 178 | struct dentry *dentry, struct path *path, | ||
| 179 | struct nfs_fh *fh, struct nfs_fattr *fattr, | ||
| 180 | rpc_authflavor_t *flavor) | ||
| 181 | { | ||
| 182 | struct rpc_clnt *clone; | ||
| 183 | struct rpc_auth *auth; | ||
| 184 | int err; | 156 | int err; |
| 185 | 157 | ||
| 186 | err = nfs_negotiate_security(parent, path->dentry, flavor); | 158 | if (NFS_PROTO(dir)->version == 4) |
| 187 | if (err < 0) | 159 | return nfs4_proc_lookup_mountpoint(dir, name, fh, fattr); |
| 188 | goto out; | 160 | |
| 189 | clone = rpc_clone_client(server->client); | 161 | err = NFS_PROTO(dir)->lookup(NFS_SERVER(dir)->client, dir, name, fh, fattr); |
| 190 | auth = rpcauth_create(*flavor, clone); | 162 | if (err) |
| 191 | if (!auth) { | 163 | return ERR_PTR(err); |
| 192 | err = -EIO; | 164 | return rpc_clone_client(NFS_SERVER(dir)->client); |
| 193 | goto out_shutdown; | ||
| 194 | } | ||
| 195 | err = server->nfs_client->rpc_ops->lookup(clone, parent->d_inode, | ||
| 196 | &path->dentry->d_name, | ||
| 197 | fh, fattr); | ||
| 198 | out_shutdown: | ||
| 199 | rpc_shutdown_client(clone); | ||
| 200 | out: | ||
| 201 | return err; | ||
| 202 | } | 165 | } |
| 203 | #else /* CONFIG_NFS_V4 */ | 166 | #else /* CONFIG_NFS_V4 */ |
| 204 | static inline int nfs_lookup_with_sec(struct nfs_server *server, | 167 | static inline struct rpc_clnt *nfs_lookup_mountpoint(struct inode *dir, |
| 205 | struct dentry *parent, struct dentry *dentry, | 168 | struct qstr *name, |
| 206 | struct path *path, struct nfs_fh *fh, | 169 | struct nfs_fh *fh, |
| 207 | struct nfs_fattr *fattr, | 170 | struct nfs_fattr *fattr) |
| 208 | rpc_authflavor_t *flavor) | ||
| 209 | { | 171 | { |
| 210 | return -EPERM; | 172 | int err = NFS_PROTO(dir)->lookup(NFS_SERVER(dir)->client, dir, name, fh, fattr); |
| 173 | if (err) | ||
| 174 | return ERR_PTR(err); | ||
| 175 | return rpc_clone_client(NFS_SERVER(dir)->client); | ||
| 211 | } | 176 | } |
| 212 | #endif /* CONFIG_NFS_V4 */ | 177 | #endif /* CONFIG_NFS_V4 */ |
| 213 | 178 | ||
| @@ -226,12 +191,10 @@ static inline int nfs_lookup_with_sec(struct nfs_server *server, | |||
| 226 | struct vfsmount *nfs_d_automount(struct path *path) | 191 | struct vfsmount *nfs_d_automount(struct path *path) |
| 227 | { | 192 | { |
| 228 | struct vfsmount *mnt; | 193 | struct vfsmount *mnt; |
| 229 | struct nfs_server *server = NFS_SERVER(path->dentry->d_inode); | ||
| 230 | struct dentry *parent; | 194 | struct dentry *parent; |
| 231 | struct nfs_fh *fh = NULL; | 195 | struct nfs_fh *fh = NULL; |
| 232 | struct nfs_fattr *fattr = NULL; | 196 | struct nfs_fattr *fattr = NULL; |
| 233 | int err; | 197 | struct rpc_clnt *client; |
| 234 | rpc_authflavor_t flavor = RPC_AUTH_UNIX; | ||
| 235 | 198 | ||
| 236 | dprintk("--> nfs_d_automount()\n"); | 199 | dprintk("--> nfs_d_automount()\n"); |
| 237 | 200 | ||
| @@ -249,21 +212,19 @@ struct vfsmount *nfs_d_automount(struct path *path) | |||
| 249 | 212 | ||
| 250 | /* Look it up again to get its attributes */ | 213 | /* Look it up again to get its attributes */ |
| 251 | parent = dget_parent(path->dentry); | 214 | parent = dget_parent(path->dentry); |
| 252 | err = server->nfs_client->rpc_ops->lookup(server->client, parent->d_inode, | 215 | client = nfs_lookup_mountpoint(parent->d_inode, &path->dentry->d_name, fh, fattr); |
| 253 | &path->dentry->d_name, | ||
| 254 | fh, fattr); | ||
| 255 | if (err == -EPERM && NFS_PROTO(parent->d_inode)->secinfo != NULL) | ||
| 256 | err = nfs_lookup_with_sec(server, parent, path->dentry, path, fh, fattr, &flavor); | ||
| 257 | dput(parent); | 216 | dput(parent); |
| 258 | if (err != 0) { | 217 | if (IS_ERR(client)) { |
| 259 | mnt = ERR_PTR(err); | 218 | mnt = ERR_CAST(client); |
| 260 | goto out; | 219 | goto out; |
| 261 | } | 220 | } |
| 262 | 221 | ||
| 263 | if (fattr->valid & NFS_ATTR_FATTR_V4_REFERRAL) | 222 | if (fattr->valid & NFS_ATTR_FATTR_V4_REFERRAL) |
| 264 | mnt = nfs_do_refmount(path->dentry); | 223 | mnt = nfs_do_refmount(client, path->dentry); |
| 265 | else | 224 | else |
| 266 | mnt = nfs_do_submount(path->dentry, fh, fattr, flavor); | 225 | mnt = nfs_do_submount(path->dentry, fh, fattr, client->cl_auth->au_flavor); |
| 226 | rpc_shutdown_client(client); | ||
| 227 | |||
| 267 | if (IS_ERR(mnt)) | 228 | if (IS_ERR(mnt)) |
| 268 | goto out; | 229 | goto out; |
| 269 | 230 | ||
diff --git a/fs/nfs/nfs4_fs.h b/fs/nfs/nfs4_fs.h index 97ecc863dd76..8d75021020b3 100644 --- a/fs/nfs/nfs4_fs.h +++ b/fs/nfs/nfs4_fs.h | |||
| @@ -59,6 +59,7 @@ struct nfs_unique_id { | |||
| 59 | 59 | ||
| 60 | #define NFS_SEQID_CONFIRMED 1 | 60 | #define NFS_SEQID_CONFIRMED 1 |
| 61 | struct nfs_seqid_counter { | 61 | struct nfs_seqid_counter { |
| 62 | ktime_t create_time; | ||
| 62 | int owner_id; | 63 | int owner_id; |
| 63 | int flags; | 64 | int flags; |
| 64 | u32 counter; | 65 | u32 counter; |
| @@ -204,6 +205,9 @@ struct nfs4_state_maintenance_ops { | |||
| 204 | extern const struct dentry_operations nfs4_dentry_operations; | 205 | extern const struct dentry_operations nfs4_dentry_operations; |
| 205 | extern const struct inode_operations nfs4_dir_inode_operations; | 206 | extern const struct inode_operations nfs4_dir_inode_operations; |
| 206 | 207 | ||
| 208 | /* nfs4namespace.c */ | ||
| 209 | struct rpc_clnt *nfs4_create_sec_client(struct rpc_clnt *, struct inode *, struct qstr *); | ||
| 210 | |||
| 207 | /* nfs4proc.c */ | 211 | /* nfs4proc.c */ |
| 208 | extern int nfs4_proc_setclientid(struct nfs_client *, u32, unsigned short, struct rpc_cred *, struct nfs4_setclientid_res *); | 212 | extern int nfs4_proc_setclientid(struct nfs_client *, u32, unsigned short, struct rpc_cred *, struct nfs4_setclientid_res *); |
| 209 | extern int nfs4_proc_setclientid_confirm(struct nfs_client *, struct nfs4_setclientid_res *arg, struct rpc_cred *); | 213 | extern int nfs4_proc_setclientid_confirm(struct nfs_client *, struct nfs4_setclientid_res *arg, struct rpc_cred *); |
| @@ -212,8 +216,11 @@ extern int nfs4_init_clientid(struct nfs_client *, struct rpc_cred *); | |||
| 212 | extern int nfs41_init_clientid(struct nfs_client *, struct rpc_cred *); | 216 | extern int nfs41_init_clientid(struct nfs_client *, struct rpc_cred *); |
| 213 | extern int nfs4_do_close(struct nfs4_state *state, gfp_t gfp_mask, int wait, bool roc); | 217 | extern int nfs4_do_close(struct nfs4_state *state, gfp_t gfp_mask, int wait, bool roc); |
| 214 | extern int nfs4_server_capabilities(struct nfs_server *server, struct nfs_fh *fhandle); | 218 | extern int nfs4_server_capabilities(struct nfs_server *server, struct nfs_fh *fhandle); |
| 215 | extern int nfs4_proc_fs_locations(struct inode *dir, const struct qstr *name, | 219 | extern int nfs4_proc_fs_locations(struct rpc_clnt *, struct inode *, const struct qstr *, |
| 216 | struct nfs4_fs_locations *fs_locations, struct page *page); | 220 | struct nfs4_fs_locations *, struct page *); |
| 221 | extern struct rpc_clnt *nfs4_proc_lookup_mountpoint(struct inode *, struct qstr *, | ||
| 222 | struct nfs_fh *, struct nfs_fattr *); | ||
| 223 | extern int nfs4_proc_secinfo(struct inode *, const struct qstr *, struct nfs4_secinfo_flavors *); | ||
| 217 | extern int nfs4_release_lockowner(struct nfs4_lock_state *); | 224 | extern int nfs4_release_lockowner(struct nfs4_lock_state *); |
| 218 | extern const struct xattr_handler *nfs4_xattr_handlers[]; | 225 | extern const struct xattr_handler *nfs4_xattr_handlers[]; |
| 219 | 226 | ||
diff --git a/fs/nfs/nfs4filelayoutdev.c b/fs/nfs/nfs4filelayoutdev.c index a866bbd2890a..c9cff9adb2d3 100644 --- a/fs/nfs/nfs4filelayoutdev.c +++ b/fs/nfs/nfs4filelayoutdev.c | |||
| @@ -699,7 +699,7 @@ get_device_info(struct inode *inode, struct nfs4_deviceid *dev_id, gfp_t gfp_fla | |||
| 699 | * GETDEVICEINFO's maxcount | 699 | * GETDEVICEINFO's maxcount |
| 700 | */ | 700 | */ |
| 701 | max_resp_sz = server->nfs_client->cl_session->fc_attrs.max_resp_sz; | 701 | max_resp_sz = server->nfs_client->cl_session->fc_attrs.max_resp_sz; |
| 702 | max_pages = max_resp_sz >> PAGE_SHIFT; | 702 | max_pages = nfs_page_array_len(0, max_resp_sz); |
| 703 | dprintk("%s inode %p max_resp_sz %u max_pages %d\n", | 703 | dprintk("%s inode %p max_resp_sz %u max_pages %d\n", |
| 704 | __func__, inode, max_resp_sz, max_pages); | 704 | __func__, inode, max_resp_sz, max_pages); |
| 705 | 705 | ||
diff --git a/fs/nfs/nfs4namespace.c b/fs/nfs/nfs4namespace.c index 9c8eca315f43..a7f3dedc4ec7 100644 --- a/fs/nfs/nfs4namespace.c +++ b/fs/nfs/nfs4namespace.c | |||
| @@ -52,6 +52,30 @@ Elong: | |||
| 52 | } | 52 | } |
| 53 | 53 | ||
| 54 | /* | 54 | /* |
| 55 | * return the path component of "<server>:<path>" | ||
| 56 | * nfspath - the "<server>:<path>" string | ||
| 57 | * end - one past the last char that could contain "<server>:" | ||
| 58 | * returns NULL on failure | ||
| 59 | */ | ||
| 60 | static char *nfs_path_component(const char *nfspath, const char *end) | ||
| 61 | { | ||
| 62 | char *p; | ||
| 63 | |||
| 64 | if (*nfspath == '[') { | ||
| 65 | /* parse [] escaped IPv6 addrs */ | ||
| 66 | p = strchr(nfspath, ']'); | ||
| 67 | if (p != NULL && ++p < end && *p == ':') | ||
| 68 | return p + 1; | ||
| 69 | } else { | ||
| 70 | /* otherwise split on first colon */ | ||
| 71 | p = strchr(nfspath, ':'); | ||
| 72 | if (p != NULL && p < end) | ||
| 73 | return p + 1; | ||
| 74 | } | ||
| 75 | return NULL; | ||
| 76 | } | ||
| 77 | |||
| 78 | /* | ||
| 55 | * Determine the mount path as a string | 79 | * Determine the mount path as a string |
| 56 | */ | 80 | */ |
| 57 | static char *nfs4_path(struct dentry *dentry, char *buffer, ssize_t buflen) | 81 | static char *nfs4_path(struct dentry *dentry, char *buffer, ssize_t buflen) |
| @@ -59,9 +83,9 @@ static char *nfs4_path(struct dentry *dentry, char *buffer, ssize_t buflen) | |||
| 59 | char *limit; | 83 | char *limit; |
| 60 | char *path = nfs_path(&limit, dentry, buffer, buflen); | 84 | char *path = nfs_path(&limit, dentry, buffer, buflen); |
| 61 | if (!IS_ERR(path)) { | 85 | if (!IS_ERR(path)) { |
| 62 | char *colon = strchr(path, ':'); | 86 | char *path_component = nfs_path_component(path, limit); |
| 63 | if (colon && colon < limit) | 87 | if (path_component) |
| 64 | path = colon + 1; | 88 | return path_component; |
| 65 | } | 89 | } |
| 66 | return path; | 90 | return path; |
| 67 | } | 91 | } |
| @@ -108,6 +132,58 @@ static size_t nfs_parse_server_name(char *string, size_t len, | |||
| 108 | return ret; | 132 | return ret; |
| 109 | } | 133 | } |
| 110 | 134 | ||
| 135 | static rpc_authflavor_t nfs4_negotiate_security(struct inode *inode, struct qstr *name) | ||
| 136 | { | ||
| 137 | struct page *page; | ||
| 138 | struct nfs4_secinfo_flavors *flavors; | ||
| 139 | rpc_authflavor_t flavor; | ||
| 140 | int err; | ||
| 141 | |||
| 142 | page = alloc_page(GFP_KERNEL); | ||
| 143 | if (!page) | ||
| 144 | return -ENOMEM; | ||
| 145 | flavors = page_address(page); | ||
| 146 | |||
| 147 | err = nfs4_proc_secinfo(inode, name, flavors); | ||
| 148 | if (err < 0) { | ||
| 149 | flavor = err; | ||
| 150 | goto out; | ||
| 151 | } | ||
| 152 | |||
| 153 | flavor = nfs_find_best_sec(flavors); | ||
| 154 | |||
| 155 | out: | ||
| 156 | put_page(page); | ||
| 157 | return flavor; | ||
| 158 | } | ||
| 159 | |||
| 160 | /* | ||
| 161 | * Please call rpc_shutdown_client() when you are done with this client. | ||
| 162 | */ | ||
| 163 | struct rpc_clnt *nfs4_create_sec_client(struct rpc_clnt *clnt, struct inode *inode, | ||
| 164 | struct qstr *name) | ||
| 165 | { | ||
| 166 | struct rpc_clnt *clone; | ||
| 167 | struct rpc_auth *auth; | ||
| 168 | rpc_authflavor_t flavor; | ||
| 169 | |||
| 170 | flavor = nfs4_negotiate_security(inode, name); | ||
| 171 | if (flavor < 0) | ||
| 172 | return ERR_PTR(flavor); | ||
| 173 | |||
| 174 | clone = rpc_clone_client(clnt); | ||
| 175 | if (IS_ERR(clone)) | ||
| 176 | return clone; | ||
| 177 | |||
| 178 | auth = rpcauth_create(flavor, clone); | ||
| 179 | if (!auth) { | ||
| 180 | rpc_shutdown_client(clone); | ||
| 181 | clone = ERR_PTR(-EIO); | ||
| 182 | } | ||
| 183 | |||
| 184 | return clone; | ||
| 185 | } | ||
| 186 | |||
| 111 | static struct vfsmount *try_location(struct nfs_clone_mount *mountdata, | 187 | static struct vfsmount *try_location(struct nfs_clone_mount *mountdata, |
| 112 | char *page, char *page2, | 188 | char *page, char *page2, |
| 113 | const struct nfs4_fs_location *location) | 189 | const struct nfs4_fs_location *location) |
| @@ -224,7 +300,7 @@ out: | |||
| 224 | * @dentry - dentry of referral | 300 | * @dentry - dentry of referral |
| 225 | * | 301 | * |
| 226 | */ | 302 | */ |
| 227 | struct vfsmount *nfs_do_refmount(struct dentry *dentry) | 303 | struct vfsmount *nfs_do_refmount(struct rpc_clnt *client, struct dentry *dentry) |
| 228 | { | 304 | { |
| 229 | struct vfsmount *mnt = ERR_PTR(-ENOMEM); | 305 | struct vfsmount *mnt = ERR_PTR(-ENOMEM); |
| 230 | struct dentry *parent; | 306 | struct dentry *parent; |
| @@ -250,7 +326,7 @@ struct vfsmount *nfs_do_refmount(struct dentry *dentry) | |||
| 250 | dprintk("%s: getting locations for %s/%s\n", | 326 | dprintk("%s: getting locations for %s/%s\n", |
| 251 | __func__, parent->d_name.name, dentry->d_name.name); | 327 | __func__, parent->d_name.name, dentry->d_name.name); |
| 252 | 328 | ||
| 253 | err = nfs4_proc_fs_locations(parent->d_inode, &dentry->d_name, fs_locations, page); | 329 | err = nfs4_proc_fs_locations(client, parent->d_inode, &dentry->d_name, fs_locations, page); |
| 254 | dput(parent); | 330 | dput(parent); |
| 255 | if (err != 0 || | 331 | if (err != 0 || |
| 256 | fs_locations->nlocations <= 0 || | 332 | fs_locations->nlocations <= 0 || |
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index f82bde005a82..99650aaf8937 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
| @@ -838,7 +838,8 @@ static struct nfs4_opendata *nfs4_opendata_alloc(struct dentry *dentry, | |||
| 838 | p->o_arg.open_flags = flags; | 838 | p->o_arg.open_flags = flags; |
| 839 | p->o_arg.fmode = fmode & (FMODE_READ|FMODE_WRITE); | 839 | p->o_arg.fmode = fmode & (FMODE_READ|FMODE_WRITE); |
| 840 | p->o_arg.clientid = server->nfs_client->cl_clientid; | 840 | p->o_arg.clientid = server->nfs_client->cl_clientid; |
| 841 | p->o_arg.id = sp->so_seqid.owner_id; | 841 | p->o_arg.id.create_time = ktime_to_ns(sp->so_seqid.create_time); |
| 842 | p->o_arg.id.uniquifier = sp->so_seqid.owner_id; | ||
| 842 | p->o_arg.name = &dentry->d_name; | 843 | p->o_arg.name = &dentry->d_name; |
| 843 | p->o_arg.server = server; | 844 | p->o_arg.server = server; |
| 844 | p->o_arg.bitmask = server->attr_bitmask; | 845 | p->o_arg.bitmask = server->attr_bitmask; |
| @@ -1466,8 +1467,7 @@ static void nfs4_open_prepare(struct rpc_task *task, void *calldata) | |||
| 1466 | goto unlock_no_action; | 1467 | goto unlock_no_action; |
| 1467 | rcu_read_unlock(); | 1468 | rcu_read_unlock(); |
| 1468 | } | 1469 | } |
| 1469 | /* Update sequence id. */ | 1470 | /* Update client id. */ |
| 1470 | data->o_arg.id = sp->so_seqid.owner_id; | ||
| 1471 | data->o_arg.clientid = sp->so_server->nfs_client->cl_clientid; | 1471 | data->o_arg.clientid = sp->so_server->nfs_client->cl_clientid; |
| 1472 | if (data->o_arg.claim == NFS4_OPEN_CLAIM_PREVIOUS) { | 1472 | if (data->o_arg.claim == NFS4_OPEN_CLAIM_PREVIOUS) { |
| 1473 | task->tk_msg.rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_OPEN_NOATTR]; | 1473 | task->tk_msg.rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_OPEN_NOATTR]; |
| @@ -1954,10 +1954,19 @@ static int nfs4_do_setattr(struct inode *inode, struct rpc_cred *cred, | |||
| 1954 | }; | 1954 | }; |
| 1955 | int err; | 1955 | int err; |
| 1956 | do { | 1956 | do { |
| 1957 | err = nfs4_handle_exception(server, | 1957 | err = _nfs4_do_setattr(inode, cred, fattr, sattr, state); |
| 1958 | _nfs4_do_setattr(inode, cred, fattr, sattr, state), | 1958 | switch (err) { |
| 1959 | &exception); | 1959 | case -NFS4ERR_OPENMODE: |
| 1960 | if (state && !(state->state & FMODE_WRITE)) { | ||
| 1961 | err = -EBADF; | ||
| 1962 | if (sattr->ia_valid & ATTR_OPEN) | ||
| 1963 | err = -EACCES; | ||
| 1964 | goto out; | ||
| 1965 | } | ||
| 1966 | } | ||
| 1967 | err = nfs4_handle_exception(server, err, &exception); | ||
| 1960 | } while (exception.retry); | 1968 | } while (exception.retry); |
| 1969 | out: | ||
| 1961 | return err; | 1970 | return err; |
| 1962 | } | 1971 | } |
| 1963 | 1972 | ||
| @@ -2368,8 +2377,9 @@ static int nfs4_proc_get_root(struct nfs_server *server, struct nfs_fh *fhandle, | |||
| 2368 | * Note that we'll actually follow the referral later when | 2377 | * Note that we'll actually follow the referral later when |
| 2369 | * we detect fsid mismatch in inode revalidation | 2378 | * we detect fsid mismatch in inode revalidation |
| 2370 | */ | 2379 | */ |
| 2371 | static int nfs4_get_referral(struct inode *dir, const struct qstr *name, | 2380 | static int nfs4_get_referral(struct rpc_clnt *client, struct inode *dir, |
| 2372 | struct nfs_fattr *fattr, struct nfs_fh *fhandle) | 2381 | const struct qstr *name, struct nfs_fattr *fattr, |
| 2382 | struct nfs_fh *fhandle) | ||
| 2373 | { | 2383 | { |
| 2374 | int status = -ENOMEM; | 2384 | int status = -ENOMEM; |
| 2375 | struct page *page = NULL; | 2385 | struct page *page = NULL; |
| @@ -2382,7 +2392,7 @@ static int nfs4_get_referral(struct inode *dir, const struct qstr *name, | |||
| 2382 | if (locations == NULL) | 2392 | if (locations == NULL) |
| 2383 | goto out; | 2393 | goto out; |
| 2384 | 2394 | ||
| 2385 | status = nfs4_proc_fs_locations(dir, name, locations, page); | 2395 | status = nfs4_proc_fs_locations(client, dir, name, locations, page); |
| 2386 | if (status != 0) | 2396 | if (status != 0) |
| 2387 | goto out; | 2397 | goto out; |
| 2388 | /* Make sure server returned a different fsid for the referral */ | 2398 | /* Make sure server returned a different fsid for the referral */ |
| @@ -2519,39 +2529,84 @@ static int _nfs4_proc_lookup(struct rpc_clnt *clnt, struct inode *dir, | |||
| 2519 | return status; | 2529 | return status; |
| 2520 | } | 2530 | } |
| 2521 | 2531 | ||
| 2522 | void nfs_fixup_secinfo_attributes(struct nfs_fattr *fattr, struct nfs_fh *fh) | 2532 | static void nfs_fixup_secinfo_attributes(struct nfs_fattr *fattr) |
| 2523 | { | 2533 | { |
| 2524 | memset(fh, 0, sizeof(struct nfs_fh)); | ||
| 2525 | fattr->fsid.major = 1; | ||
| 2526 | fattr->valid |= NFS_ATTR_FATTR_TYPE | NFS_ATTR_FATTR_MODE | | 2534 | fattr->valid |= NFS_ATTR_FATTR_TYPE | NFS_ATTR_FATTR_MODE | |
| 2527 | NFS_ATTR_FATTR_NLINK | NFS_ATTR_FATTR_FSID | NFS_ATTR_FATTR_MOUNTPOINT; | 2535 | NFS_ATTR_FATTR_NLINK | NFS_ATTR_FATTR_MOUNTPOINT; |
| 2528 | fattr->mode = S_IFDIR | S_IRUGO | S_IXUGO; | 2536 | fattr->mode = S_IFDIR | S_IRUGO | S_IXUGO; |
| 2529 | fattr->nlink = 2; | 2537 | fattr->nlink = 2; |
| 2530 | } | 2538 | } |
| 2531 | 2539 | ||
| 2532 | static int nfs4_proc_lookup(struct rpc_clnt *clnt, struct inode *dir, struct qstr *name, | 2540 | static int nfs4_proc_lookup_common(struct rpc_clnt **clnt, struct inode *dir, |
| 2533 | struct nfs_fh *fhandle, struct nfs_fattr *fattr) | 2541 | struct qstr *name, struct nfs_fh *fhandle, |
| 2542 | struct nfs_fattr *fattr) | ||
| 2534 | { | 2543 | { |
| 2535 | struct nfs4_exception exception = { }; | 2544 | struct nfs4_exception exception = { }; |
| 2545 | struct rpc_clnt *client = *clnt; | ||
| 2536 | int err; | 2546 | int err; |
| 2537 | do { | 2547 | do { |
| 2538 | int status; | 2548 | err = _nfs4_proc_lookup(client, dir, name, fhandle, fattr); |
| 2539 | 2549 | switch (err) { | |
| 2540 | status = _nfs4_proc_lookup(clnt, dir, name, fhandle, fattr); | ||
| 2541 | switch (status) { | ||
| 2542 | case -NFS4ERR_BADNAME: | 2550 | case -NFS4ERR_BADNAME: |
| 2543 | return -ENOENT; | 2551 | err = -ENOENT; |
| 2552 | goto out; | ||
| 2544 | case -NFS4ERR_MOVED: | 2553 | case -NFS4ERR_MOVED: |
| 2545 | return nfs4_get_referral(dir, name, fattr, fhandle); | 2554 | err = nfs4_get_referral(client, dir, name, fattr, fhandle); |
| 2555 | goto out; | ||
| 2546 | case -NFS4ERR_WRONGSEC: | 2556 | case -NFS4ERR_WRONGSEC: |
| 2547 | nfs_fixup_secinfo_attributes(fattr, fhandle); | 2557 | err = -EPERM; |
| 2558 | if (client != *clnt) | ||
| 2559 | goto out; | ||
| 2560 | |||
| 2561 | client = nfs4_create_sec_client(client, dir, name); | ||
| 2562 | if (IS_ERR(client)) | ||
| 2563 | return PTR_ERR(client); | ||
| 2564 | |||
| 2565 | exception.retry = 1; | ||
| 2566 | break; | ||
| 2567 | default: | ||
| 2568 | err = nfs4_handle_exception(NFS_SERVER(dir), err, &exception); | ||
| 2548 | } | 2569 | } |
| 2549 | err = nfs4_handle_exception(NFS_SERVER(dir), | ||
| 2550 | status, &exception); | ||
| 2551 | } while (exception.retry); | 2570 | } while (exception.retry); |
| 2571 | |||
| 2572 | out: | ||
| 2573 | if (err == 0) | ||
| 2574 | *clnt = client; | ||
| 2575 | else if (client != *clnt) | ||
| 2576 | rpc_shutdown_client(client); | ||
| 2577 | |||
| 2552 | return err; | 2578 | return err; |
| 2553 | } | 2579 | } |
| 2554 | 2580 | ||
| 2581 | static int nfs4_proc_lookup(struct rpc_clnt *clnt, struct inode *dir, struct qstr *name, | ||
| 2582 | struct nfs_fh *fhandle, struct nfs_fattr *fattr) | ||
| 2583 | { | ||
| 2584 | int status; | ||
| 2585 | struct rpc_clnt *client = NFS_CLIENT(dir); | ||
| 2586 | |||
| 2587 | status = nfs4_proc_lookup_common(&client, dir, name, fhandle, fattr); | ||
| 2588 | if (client != NFS_CLIENT(dir)) { | ||
| 2589 | rpc_shutdown_client(client); | ||
| 2590 | nfs_fixup_secinfo_attributes(fattr); | ||
| 2591 | } | ||
| 2592 | return status; | ||
| 2593 | } | ||
| 2594 | |||
| 2595 | struct rpc_clnt * | ||
| 2596 | nfs4_proc_lookup_mountpoint(struct inode *dir, struct qstr *name, | ||
| 2597 | struct nfs_fh *fhandle, struct nfs_fattr *fattr) | ||
| 2598 | { | ||
| 2599 | int status; | ||
| 2600 | struct rpc_clnt *client = rpc_clone_client(NFS_CLIENT(dir)); | ||
| 2601 | |||
| 2602 | status = nfs4_proc_lookup_common(&client, dir, name, fhandle, fattr); | ||
| 2603 | if (status < 0) { | ||
| 2604 | rpc_shutdown_client(client); | ||
| 2605 | return ERR_PTR(status); | ||
| 2606 | } | ||
| 2607 | return client; | ||
| 2608 | } | ||
| 2609 | |||
| 2555 | static int _nfs4_proc_access(struct inode *inode, struct nfs_access_entry *entry) | 2610 | static int _nfs4_proc_access(struct inode *inode, struct nfs_access_entry *entry) |
| 2556 | { | 2611 | { |
| 2557 | struct nfs_server *server = NFS_SERVER(inode); | 2612 | struct nfs_server *server = NFS_SERVER(inode); |
| @@ -3619,16 +3674,16 @@ out: | |||
| 3619 | return ret; | 3674 | return ret; |
| 3620 | } | 3675 | } |
| 3621 | 3676 | ||
| 3622 | static void nfs4_write_cached_acl(struct inode *inode, const char *buf, size_t acl_len) | 3677 | static void nfs4_write_cached_acl(struct inode *inode, struct page **pages, size_t pgbase, size_t acl_len) |
| 3623 | { | 3678 | { |
| 3624 | struct nfs4_cached_acl *acl; | 3679 | struct nfs4_cached_acl *acl; |
| 3625 | 3680 | ||
| 3626 | if (buf && acl_len <= PAGE_SIZE) { | 3681 | if (pages && acl_len <= PAGE_SIZE) { |
| 3627 | acl = kmalloc(sizeof(*acl) + acl_len, GFP_KERNEL); | 3682 | acl = kmalloc(sizeof(*acl) + acl_len, GFP_KERNEL); |
| 3628 | if (acl == NULL) | 3683 | if (acl == NULL) |
| 3629 | goto out; | 3684 | goto out; |
| 3630 | acl->cached = 1; | 3685 | acl->cached = 1; |
| 3631 | memcpy(acl->data, buf, acl_len); | 3686 | _copy_from_pages(acl->data, pages, pgbase, acl_len); |
| 3632 | } else { | 3687 | } else { |
| 3633 | acl = kmalloc(sizeof(*acl), GFP_KERNEL); | 3688 | acl = kmalloc(sizeof(*acl), GFP_KERNEL); |
| 3634 | if (acl == NULL) | 3689 | if (acl == NULL) |
| @@ -3661,7 +3716,6 @@ static ssize_t __nfs4_get_acl_uncached(struct inode *inode, void *buf, size_t bu | |||
| 3661 | struct nfs_getaclres res = { | 3716 | struct nfs_getaclres res = { |
| 3662 | .acl_len = buflen, | 3717 | .acl_len = buflen, |
| 3663 | }; | 3718 | }; |
| 3664 | void *resp_buf; | ||
| 3665 | struct rpc_message msg = { | 3719 | struct rpc_message msg = { |
| 3666 | .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_GETACL], | 3720 | .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_GETACL], |
| 3667 | .rpc_argp = &args, | 3721 | .rpc_argp = &args, |
| @@ -3675,24 +3729,27 @@ static ssize_t __nfs4_get_acl_uncached(struct inode *inode, void *buf, size_t bu | |||
| 3675 | if (npages == 0) | 3729 | if (npages == 0) |
| 3676 | npages = 1; | 3730 | npages = 1; |
| 3677 | 3731 | ||
| 3732 | /* Add an extra page to handle the bitmap returned */ | ||
| 3733 | npages++; | ||
| 3734 | |||
| 3678 | for (i = 0; i < npages; i++) { | 3735 | for (i = 0; i < npages; i++) { |
| 3679 | pages[i] = alloc_page(GFP_KERNEL); | 3736 | pages[i] = alloc_page(GFP_KERNEL); |
| 3680 | if (!pages[i]) | 3737 | if (!pages[i]) |
| 3681 | goto out_free; | 3738 | goto out_free; |
| 3682 | } | 3739 | } |
| 3683 | if (npages > 1) { | 3740 | |
| 3684 | /* for decoding across pages */ | 3741 | /* for decoding across pages */ |
| 3685 | res.acl_scratch = alloc_page(GFP_KERNEL); | 3742 | res.acl_scratch = alloc_page(GFP_KERNEL); |
| 3686 | if (!res.acl_scratch) | 3743 | if (!res.acl_scratch) |
| 3687 | goto out_free; | 3744 | goto out_free; |
| 3688 | } | 3745 | |
| 3689 | args.acl_len = npages * PAGE_SIZE; | 3746 | args.acl_len = npages * PAGE_SIZE; |
| 3690 | args.acl_pgbase = 0; | 3747 | args.acl_pgbase = 0; |
| 3748 | |||
| 3691 | /* Let decode_getfacl know not to fail if the ACL data is larger than | 3749 | /* Let decode_getfacl know not to fail if the ACL data is larger than |
| 3692 | * the page we send as a guess */ | 3750 | * the page we send as a guess */ |
| 3693 | if (buf == NULL) | 3751 | if (buf == NULL) |
| 3694 | res.acl_flags |= NFS4_ACL_LEN_REQUEST; | 3752 | res.acl_flags |= NFS4_ACL_LEN_REQUEST; |
| 3695 | resp_buf = page_address(pages[0]); | ||
| 3696 | 3753 | ||
| 3697 | dprintk("%s buf %p buflen %zu npages %d args.acl_len %zu\n", | 3754 | dprintk("%s buf %p buflen %zu npages %d args.acl_len %zu\n", |
| 3698 | __func__, buf, buflen, npages, args.acl_len); | 3755 | __func__, buf, buflen, npages, args.acl_len); |
| @@ -3703,9 +3760,9 @@ static ssize_t __nfs4_get_acl_uncached(struct inode *inode, void *buf, size_t bu | |||
| 3703 | 3760 | ||
| 3704 | acl_len = res.acl_len - res.acl_data_offset; | 3761 | acl_len = res.acl_len - res.acl_data_offset; |
| 3705 | if (acl_len > args.acl_len) | 3762 | if (acl_len > args.acl_len) |
| 3706 | nfs4_write_cached_acl(inode, NULL, acl_len); | 3763 | nfs4_write_cached_acl(inode, NULL, 0, acl_len); |
| 3707 | else | 3764 | else |
| 3708 | nfs4_write_cached_acl(inode, resp_buf + res.acl_data_offset, | 3765 | nfs4_write_cached_acl(inode, pages, res.acl_data_offset, |
| 3709 | acl_len); | 3766 | acl_len); |
| 3710 | if (buf) { | 3767 | if (buf) { |
| 3711 | ret = -ERANGE; | 3768 | ret = -ERANGE; |
| @@ -4558,7 +4615,9 @@ static int _nfs4_do_setlk(struct nfs4_state *state, int cmd, struct file_lock *f | |||
| 4558 | static int nfs4_lock_reclaim(struct nfs4_state *state, struct file_lock *request) | 4615 | static int nfs4_lock_reclaim(struct nfs4_state *state, struct file_lock *request) |
| 4559 | { | 4616 | { |
| 4560 | struct nfs_server *server = NFS_SERVER(state->inode); | 4617 | struct nfs_server *server = NFS_SERVER(state->inode); |
| 4561 | struct nfs4_exception exception = { }; | 4618 | struct nfs4_exception exception = { |
| 4619 | .inode = state->inode, | ||
| 4620 | }; | ||
| 4562 | int err; | 4621 | int err; |
| 4563 | 4622 | ||
| 4564 | do { | 4623 | do { |
| @@ -4576,7 +4635,9 @@ static int nfs4_lock_reclaim(struct nfs4_state *state, struct file_lock *request | |||
| 4576 | static int nfs4_lock_expired(struct nfs4_state *state, struct file_lock *request) | 4635 | static int nfs4_lock_expired(struct nfs4_state *state, struct file_lock *request) |
| 4577 | { | 4636 | { |
| 4578 | struct nfs_server *server = NFS_SERVER(state->inode); | 4637 | struct nfs_server *server = NFS_SERVER(state->inode); |
| 4579 | struct nfs4_exception exception = { }; | 4638 | struct nfs4_exception exception = { |
| 4639 | .inode = state->inode, | ||
| 4640 | }; | ||
| 4580 | int err; | 4641 | int err; |
| 4581 | 4642 | ||
| 4582 | err = nfs4_set_lock_state(state, request); | 4643 | err = nfs4_set_lock_state(state, request); |
| @@ -4676,6 +4737,7 @@ static int nfs4_proc_setlk(struct nfs4_state *state, int cmd, struct file_lock * | |||
| 4676 | { | 4737 | { |
| 4677 | struct nfs4_exception exception = { | 4738 | struct nfs4_exception exception = { |
| 4678 | .state = state, | 4739 | .state = state, |
| 4740 | .inode = state->inode, | ||
| 4679 | }; | 4741 | }; |
| 4680 | int err; | 4742 | int err; |
| 4681 | 4743 | ||
| @@ -4721,6 +4783,20 @@ nfs4_proc_lock(struct file *filp, int cmd, struct file_lock *request) | |||
| 4721 | 4783 | ||
| 4722 | if (state == NULL) | 4784 | if (state == NULL) |
| 4723 | return -ENOLCK; | 4785 | return -ENOLCK; |
| 4786 | /* | ||
| 4787 | * Don't rely on the VFS having checked the file open mode, | ||
| 4788 | * since it won't do this for flock() locks. | ||
| 4789 | */ | ||
| 4790 | switch (request->fl_type & (F_RDLCK|F_WRLCK|F_UNLCK)) { | ||
| 4791 | case F_RDLCK: | ||
| 4792 | if (!(filp->f_mode & FMODE_READ)) | ||
| 4793 | return -EBADF; | ||
| 4794 | break; | ||
| 4795 | case F_WRLCK: | ||
| 4796 | if (!(filp->f_mode & FMODE_WRITE)) | ||
| 4797 | return -EBADF; | ||
| 4798 | } | ||
| 4799 | |||
| 4724 | do { | 4800 | do { |
| 4725 | status = nfs4_proc_setlk(state, cmd, request); | 4801 | status = nfs4_proc_setlk(state, cmd, request); |
| 4726 | if ((status != -EAGAIN) || IS_SETLK(cmd)) | 4802 | if ((status != -EAGAIN) || IS_SETLK(cmd)) |
| @@ -4891,8 +4967,10 @@ static void nfs_fixup_referral_attributes(struct nfs_fattr *fattr) | |||
| 4891 | fattr->nlink = 2; | 4967 | fattr->nlink = 2; |
| 4892 | } | 4968 | } |
| 4893 | 4969 | ||
| 4894 | int nfs4_proc_fs_locations(struct inode *dir, const struct qstr *name, | 4970 | static int _nfs4_proc_fs_locations(struct rpc_clnt *client, struct inode *dir, |
| 4895 | struct nfs4_fs_locations *fs_locations, struct page *page) | 4971 | const struct qstr *name, |
| 4972 | struct nfs4_fs_locations *fs_locations, | ||
| 4973 | struct page *page) | ||
| 4896 | { | 4974 | { |
| 4897 | struct nfs_server *server = NFS_SERVER(dir); | 4975 | struct nfs_server *server = NFS_SERVER(dir); |
| 4898 | u32 bitmask[2] = { | 4976 | u32 bitmask[2] = { |
| @@ -4926,11 +5004,26 @@ int nfs4_proc_fs_locations(struct inode *dir, const struct qstr *name, | |||
| 4926 | nfs_fattr_init(&fs_locations->fattr); | 5004 | nfs_fattr_init(&fs_locations->fattr); |
| 4927 | fs_locations->server = server; | 5005 | fs_locations->server = server; |
| 4928 | fs_locations->nlocations = 0; | 5006 | fs_locations->nlocations = 0; |
| 4929 | status = nfs4_call_sync(server->client, server, &msg, &args.seq_args, &res.seq_res, 0); | 5007 | status = nfs4_call_sync(client, server, &msg, &args.seq_args, &res.seq_res, 0); |
| 4930 | dprintk("%s: returned status = %d\n", __func__, status); | 5008 | dprintk("%s: returned status = %d\n", __func__, status); |
| 4931 | return status; | 5009 | return status; |
| 4932 | } | 5010 | } |
| 4933 | 5011 | ||
| 5012 | int nfs4_proc_fs_locations(struct rpc_clnt *client, struct inode *dir, | ||
| 5013 | const struct qstr *name, | ||
| 5014 | struct nfs4_fs_locations *fs_locations, | ||
| 5015 | struct page *page) | ||
| 5016 | { | ||
| 5017 | struct nfs4_exception exception = { }; | ||
| 5018 | int err; | ||
| 5019 | do { | ||
| 5020 | err = nfs4_handle_exception(NFS_SERVER(dir), | ||
| 5021 | _nfs4_proc_fs_locations(client, dir, name, fs_locations, page), | ||
| 5022 | &exception); | ||
| 5023 | } while (exception.retry); | ||
| 5024 | return err; | ||
| 5025 | } | ||
| 5026 | |||
| 4934 | static int _nfs4_proc_secinfo(struct inode *dir, const struct qstr *name, struct nfs4_secinfo_flavors *flavors) | 5027 | static int _nfs4_proc_secinfo(struct inode *dir, const struct qstr *name, struct nfs4_secinfo_flavors *flavors) |
| 4935 | { | 5028 | { |
| 4936 | int status; | 5029 | int status; |
| @@ -4953,8 +5046,8 @@ static int _nfs4_proc_secinfo(struct inode *dir, const struct qstr *name, struct | |||
| 4953 | return status; | 5046 | return status; |
| 4954 | } | 5047 | } |
| 4955 | 5048 | ||
| 4956 | static int nfs4_proc_secinfo(struct inode *dir, const struct qstr *name, | 5049 | int nfs4_proc_secinfo(struct inode *dir, const struct qstr *name, |
| 4957 | struct nfs4_secinfo_flavors *flavors) | 5050 | struct nfs4_secinfo_flavors *flavors) |
| 4958 | { | 5051 | { |
| 4959 | struct nfs4_exception exception = { }; | 5052 | struct nfs4_exception exception = { }; |
| 4960 | int err; | 5053 | int err; |
| @@ -5029,10 +5122,9 @@ int nfs4_proc_exchange_id(struct nfs_client *clp, struct rpc_cred *cred) | |||
| 5029 | nfs4_construct_boot_verifier(clp, &verifier); | 5122 | nfs4_construct_boot_verifier(clp, &verifier); |
| 5030 | 5123 | ||
| 5031 | args.id_len = scnprintf(args.id, sizeof(args.id), | 5124 | args.id_len = scnprintf(args.id, sizeof(args.id), |
| 5032 | "%s/%s.%s/%u", | 5125 | "%s/%s/%u", |
| 5033 | clp->cl_ipaddr, | 5126 | clp->cl_ipaddr, |
| 5034 | init_utsname()->nodename, | 5127 | clp->cl_rpcclient->cl_nodename, |
| 5035 | init_utsname()->domainname, | ||
| 5036 | clp->cl_rpcclient->cl_auth->au_flavor); | 5128 | clp->cl_rpcclient->cl_auth->au_flavor); |
| 5037 | 5129 | ||
| 5038 | res.server_scope = kzalloc(sizeof(struct server_scope), GFP_KERNEL); | 5130 | res.server_scope = kzalloc(sizeof(struct server_scope), GFP_KERNEL); |
diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c index 0f43414eb25a..7f0fcfc1fe9d 100644 --- a/fs/nfs/nfs4state.c +++ b/fs/nfs/nfs4state.c | |||
| @@ -393,6 +393,7 @@ nfs4_remove_state_owner_locked(struct nfs4_state_owner *sp) | |||
| 393 | static void | 393 | static void |
| 394 | nfs4_init_seqid_counter(struct nfs_seqid_counter *sc) | 394 | nfs4_init_seqid_counter(struct nfs_seqid_counter *sc) |
| 395 | { | 395 | { |
| 396 | sc->create_time = ktime_get(); | ||
| 396 | sc->flags = 0; | 397 | sc->flags = 0; |
| 397 | sc->counter = 0; | 398 | sc->counter = 0; |
| 398 | spin_lock_init(&sc->lock); | 399 | spin_lock_init(&sc->lock); |
| @@ -434,13 +435,17 @@ nfs4_alloc_state_owner(struct nfs_server *server, | |||
| 434 | static void | 435 | static void |
| 435 | nfs4_drop_state_owner(struct nfs4_state_owner *sp) | 436 | nfs4_drop_state_owner(struct nfs4_state_owner *sp) |
| 436 | { | 437 | { |
| 437 | if (!RB_EMPTY_NODE(&sp->so_server_node)) { | 438 | struct rb_node *rb_node = &sp->so_server_node; |
| 439 | |||
| 440 | if (!RB_EMPTY_NODE(rb_node)) { | ||
| 438 | struct nfs_server *server = sp->so_server; | 441 | struct nfs_server *server = sp->so_server; |
| 439 | struct nfs_client *clp = server->nfs_client; | 442 | struct nfs_client *clp = server->nfs_client; |
| 440 | 443 | ||
| 441 | spin_lock(&clp->cl_lock); | 444 | spin_lock(&clp->cl_lock); |
| 442 | rb_erase(&sp->so_server_node, &server->state_owners); | 445 | if (!RB_EMPTY_NODE(rb_node)) { |
| 443 | RB_CLEAR_NODE(&sp->so_server_node); | 446 | rb_erase(rb_node, &server->state_owners); |
| 447 | RB_CLEAR_NODE(rb_node); | ||
| 448 | } | ||
| 444 | spin_unlock(&clp->cl_lock); | 449 | spin_unlock(&clp->cl_lock); |
| 445 | } | 450 | } |
| 446 | } | 451 | } |
| @@ -516,6 +521,14 @@ out: | |||
| 516 | /** | 521 | /** |
| 517 | * nfs4_put_state_owner - Release a nfs4_state_owner | 522 | * nfs4_put_state_owner - Release a nfs4_state_owner |
| 518 | * @sp: state owner data to release | 523 | * @sp: state owner data to release |
| 524 | * | ||
| 525 | * Note that we keep released state owners on an LRU | ||
| 526 | * list. | ||
| 527 | * This caches valid state owners so that they can be | ||
| 528 | * reused, to avoid the OPEN_CONFIRM on minor version 0. | ||
| 529 | * It also pins the uniquifier of dropped state owners for | ||
| 530 | * a while, to ensure that those state owner names are | ||
| 531 | * never reused. | ||
| 519 | */ | 532 | */ |
| 520 | void nfs4_put_state_owner(struct nfs4_state_owner *sp) | 533 | void nfs4_put_state_owner(struct nfs4_state_owner *sp) |
| 521 | { | 534 | { |
| @@ -525,15 +538,9 @@ void nfs4_put_state_owner(struct nfs4_state_owner *sp) | |||
| 525 | if (!atomic_dec_and_lock(&sp->so_count, &clp->cl_lock)) | 538 | if (!atomic_dec_and_lock(&sp->so_count, &clp->cl_lock)) |
| 526 | return; | 539 | return; |
| 527 | 540 | ||
| 528 | if (!RB_EMPTY_NODE(&sp->so_server_node)) { | 541 | sp->so_expires = jiffies; |
| 529 | sp->so_expires = jiffies; | 542 | list_add_tail(&sp->so_lru, &server->state_owners_lru); |
| 530 | list_add_tail(&sp->so_lru, &server->state_owners_lru); | 543 | spin_unlock(&clp->cl_lock); |
| 531 | spin_unlock(&clp->cl_lock); | ||
| 532 | } else { | ||
| 533 | nfs4_remove_state_owner_locked(sp); | ||
| 534 | spin_unlock(&clp->cl_lock); | ||
| 535 | nfs4_free_state_owner(sp); | ||
| 536 | } | ||
| 537 | } | 544 | } |
| 538 | 545 | ||
| 539 | /** | 546 | /** |
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c index c74fdb114b48..c54aae364bee 100644 --- a/fs/nfs/nfs4xdr.c +++ b/fs/nfs/nfs4xdr.c | |||
| @@ -74,7 +74,7 @@ static int nfs4_stat_to_errno(int); | |||
| 74 | /* lock,open owner id: | 74 | /* lock,open owner id: |
| 75 | * we currently use size 2 (u64) out of (NFS4_OPAQUE_LIMIT >> 2) | 75 | * we currently use size 2 (u64) out of (NFS4_OPAQUE_LIMIT >> 2) |
| 76 | */ | 76 | */ |
| 77 | #define open_owner_id_maxsz (1 + 1 + 4) | 77 | #define open_owner_id_maxsz (1 + 2 + 1 + 1 + 2) |
| 78 | #define lock_owner_id_maxsz (1 + 1 + 4) | 78 | #define lock_owner_id_maxsz (1 + 1 + 4) |
| 79 | #define decode_lockowner_maxsz (1 + XDR_QUADLEN(IDMAP_NAMESZ)) | 79 | #define decode_lockowner_maxsz (1 + XDR_QUADLEN(IDMAP_NAMESZ)) |
| 80 | #define compound_encode_hdr_maxsz (3 + (NFS4_MAXTAGLEN >> 2)) | 80 | #define compound_encode_hdr_maxsz (3 + (NFS4_MAXTAGLEN >> 2)) |
| @@ -1340,12 +1340,13 @@ static inline void encode_openhdr(struct xdr_stream *xdr, const struct nfs_opena | |||
| 1340 | */ | 1340 | */ |
| 1341 | encode_nfs4_seqid(xdr, arg->seqid); | 1341 | encode_nfs4_seqid(xdr, arg->seqid); |
| 1342 | encode_share_access(xdr, arg->fmode); | 1342 | encode_share_access(xdr, arg->fmode); |
| 1343 | p = reserve_space(xdr, 32); | 1343 | p = reserve_space(xdr, 36); |
| 1344 | p = xdr_encode_hyper(p, arg->clientid); | 1344 | p = xdr_encode_hyper(p, arg->clientid); |
| 1345 | *p++ = cpu_to_be32(20); | 1345 | *p++ = cpu_to_be32(24); |
| 1346 | p = xdr_encode_opaque_fixed(p, "open id:", 8); | 1346 | p = xdr_encode_opaque_fixed(p, "open id:", 8); |
| 1347 | *p++ = cpu_to_be32(arg->server->s_dev); | 1347 | *p++ = cpu_to_be32(arg->server->s_dev); |
| 1348 | xdr_encode_hyper(p, arg->id); | 1348 | *p++ = cpu_to_be32(arg->id.uniquifier); |
| 1349 | xdr_encode_hyper(p, arg->id.create_time); | ||
| 1349 | } | 1350 | } |
| 1350 | 1351 | ||
| 1351 | static inline void encode_createmode(struct xdr_stream *xdr, const struct nfs_openargs *arg) | 1352 | static inline void encode_createmode(struct xdr_stream *xdr, const struct nfs_openargs *arg) |
| @@ -4257,8 +4258,6 @@ static int decode_getfattr_attrs(struct xdr_stream *xdr, uint32_t *bitmap, | |||
| 4257 | status = decode_attr_error(xdr, bitmap, &err); | 4258 | status = decode_attr_error(xdr, bitmap, &err); |
| 4258 | if (status < 0) | 4259 | if (status < 0) |
| 4259 | goto xdr_error; | 4260 | goto xdr_error; |
| 4260 | if (err == -NFS4ERR_WRONGSEC) | ||
| 4261 | nfs_fixup_secinfo_attributes(fattr, fh); | ||
| 4262 | 4261 | ||
| 4263 | status = decode_attr_filehandle(xdr, bitmap, fh); | 4262 | status = decode_attr_filehandle(xdr, bitmap, fh); |
| 4264 | if (status < 0) | 4263 | if (status < 0) |
| @@ -4901,11 +4900,19 @@ static int decode_getacl(struct xdr_stream *xdr, struct rpc_rqst *req, | |||
| 4901 | bitmap[3] = {0}; | 4900 | bitmap[3] = {0}; |
| 4902 | struct kvec *iov = req->rq_rcv_buf.head; | 4901 | struct kvec *iov = req->rq_rcv_buf.head; |
| 4903 | int status; | 4902 | int status; |
| 4903 | size_t page_len = xdr->buf->page_len; | ||
| 4904 | 4904 | ||
| 4905 | res->acl_len = 0; | 4905 | res->acl_len = 0; |
| 4906 | if ((status = decode_op_hdr(xdr, OP_GETATTR)) != 0) | 4906 | if ((status = decode_op_hdr(xdr, OP_GETATTR)) != 0) |
| 4907 | goto out; | 4907 | goto out; |
| 4908 | |||
| 4908 | bm_p = xdr->p; | 4909 | bm_p = xdr->p; |
| 4910 | res->acl_data_offset = be32_to_cpup(bm_p) + 2; | ||
| 4911 | res->acl_data_offset <<= 2; | ||
| 4912 | /* Check if the acl data starts beyond the allocated buffer */ | ||
| 4913 | if (res->acl_data_offset > page_len) | ||
| 4914 | return -ERANGE; | ||
| 4915 | |||
| 4909 | if ((status = decode_attr_bitmap(xdr, bitmap)) != 0) | 4916 | if ((status = decode_attr_bitmap(xdr, bitmap)) != 0) |
| 4910 | goto out; | 4917 | goto out; |
| 4911 | if ((status = decode_attr_length(xdr, &attrlen, &savep)) != 0) | 4918 | if ((status = decode_attr_length(xdr, &attrlen, &savep)) != 0) |
| @@ -4915,28 +4922,24 @@ static int decode_getacl(struct xdr_stream *xdr, struct rpc_rqst *req, | |||
| 4915 | return -EIO; | 4922 | return -EIO; |
| 4916 | if (likely(bitmap[0] & FATTR4_WORD0_ACL)) { | 4923 | if (likely(bitmap[0] & FATTR4_WORD0_ACL)) { |
| 4917 | size_t hdrlen; | 4924 | size_t hdrlen; |
| 4918 | u32 recvd; | ||
| 4919 | 4925 | ||
| 4920 | /* The bitmap (xdr len + bitmaps) and the attr xdr len words | 4926 | /* The bitmap (xdr len + bitmaps) and the attr xdr len words |
| 4921 | * are stored with the acl data to handle the problem of | 4927 | * are stored with the acl data to handle the problem of |
| 4922 | * variable length bitmaps.*/ | 4928 | * variable length bitmaps.*/ |
| 4923 | xdr->p = bm_p; | 4929 | xdr->p = bm_p; |
| 4924 | res->acl_data_offset = be32_to_cpup(bm_p) + 2; | ||
| 4925 | res->acl_data_offset <<= 2; | ||
| 4926 | 4930 | ||
| 4927 | /* We ignore &savep and don't do consistency checks on | 4931 | /* We ignore &savep and don't do consistency checks on |
| 4928 | * the attr length. Let userspace figure it out.... */ | 4932 | * the attr length. Let userspace figure it out.... */ |
| 4929 | hdrlen = (u8 *)xdr->p - (u8 *)iov->iov_base; | 4933 | hdrlen = (u8 *)xdr->p - (u8 *)iov->iov_base; |
| 4930 | attrlen += res->acl_data_offset; | 4934 | attrlen += res->acl_data_offset; |
| 4931 | recvd = req->rq_rcv_buf.len - hdrlen; | 4935 | if (attrlen > page_len) { |
| 4932 | if (attrlen > recvd) { | ||
| 4933 | if (res->acl_flags & NFS4_ACL_LEN_REQUEST) { | 4936 | if (res->acl_flags & NFS4_ACL_LEN_REQUEST) { |
| 4934 | /* getxattr interface called with a NULL buf */ | 4937 | /* getxattr interface called with a NULL buf */ |
| 4935 | res->acl_len = attrlen; | 4938 | res->acl_len = attrlen; |
| 4936 | goto out; | 4939 | goto out; |
| 4937 | } | 4940 | } |
| 4938 | dprintk("NFS: acl reply: attrlen %u > recvd %u\n", | 4941 | dprintk("NFS: acl reply: attrlen %u > page_len %zu\n", |
| 4939 | attrlen, recvd); | 4942 | attrlen, page_len); |
| 4940 | return -EINVAL; | 4943 | return -EINVAL; |
| 4941 | } | 4944 | } |
| 4942 | xdr_read_pages(xdr, attrlen); | 4945 | xdr_read_pages(xdr, attrlen); |
| @@ -5089,16 +5092,13 @@ out_err: | |||
| 5089 | return -EINVAL; | 5092 | return -EINVAL; |
| 5090 | } | 5093 | } |
| 5091 | 5094 | ||
| 5092 | static int decode_secinfo(struct xdr_stream *xdr, struct nfs4_secinfo_res *res) | 5095 | static int decode_secinfo_common(struct xdr_stream *xdr, struct nfs4_secinfo_res *res) |
| 5093 | { | 5096 | { |
| 5094 | struct nfs4_secinfo_flavor *sec_flavor; | 5097 | struct nfs4_secinfo_flavor *sec_flavor; |
| 5095 | int status; | 5098 | int status; |
| 5096 | __be32 *p; | 5099 | __be32 *p; |
| 5097 | int i, num_flavors; | 5100 | int i, num_flavors; |
| 5098 | 5101 | ||
| 5099 | status = decode_op_hdr(xdr, OP_SECINFO); | ||
| 5100 | if (status) | ||
| 5101 | goto out; | ||
| 5102 | p = xdr_inline_decode(xdr, 4); | 5102 | p = xdr_inline_decode(xdr, 4); |
| 5103 | if (unlikely(!p)) | 5103 | if (unlikely(!p)) |
| 5104 | goto out_overflow; | 5104 | goto out_overflow; |
| @@ -5124,6 +5124,7 @@ static int decode_secinfo(struct xdr_stream *xdr, struct nfs4_secinfo_res *res) | |||
| 5124 | res->flavors->num_flavors++; | 5124 | res->flavors->num_flavors++; |
| 5125 | } | 5125 | } |
| 5126 | 5126 | ||
| 5127 | status = 0; | ||
| 5127 | out: | 5128 | out: |
| 5128 | return status; | 5129 | return status; |
| 5129 | out_overflow: | 5130 | out_overflow: |
| @@ -5131,7 +5132,23 @@ out_overflow: | |||
| 5131 | return -EIO; | 5132 | return -EIO; |
| 5132 | } | 5133 | } |
| 5133 | 5134 | ||
| 5135 | static int decode_secinfo(struct xdr_stream *xdr, struct nfs4_secinfo_res *res) | ||
| 5136 | { | ||
| 5137 | int status = decode_op_hdr(xdr, OP_SECINFO); | ||
| 5138 | if (status) | ||
| 5139 | return status; | ||
| 5140 | return decode_secinfo_common(xdr, res); | ||
| 5141 | } | ||
| 5142 | |||
| 5134 | #if defined(CONFIG_NFS_V4_1) | 5143 | #if defined(CONFIG_NFS_V4_1) |
| 5144 | static int decode_secinfo_no_name(struct xdr_stream *xdr, struct nfs4_secinfo_res *res) | ||
| 5145 | { | ||
| 5146 | int status = decode_op_hdr(xdr, OP_SECINFO_NO_NAME); | ||
| 5147 | if (status) | ||
| 5148 | return status; | ||
| 5149 | return decode_secinfo_common(xdr, res); | ||
| 5150 | } | ||
| 5151 | |||
| 5135 | static int decode_exchange_id(struct xdr_stream *xdr, | 5152 | static int decode_exchange_id(struct xdr_stream *xdr, |
| 5136 | struct nfs41_exchange_id_res *res) | 5153 | struct nfs41_exchange_id_res *res) |
| 5137 | { | 5154 | { |
| @@ -6816,7 +6833,7 @@ static int nfs4_xdr_dec_secinfo_no_name(struct rpc_rqst *rqstp, | |||
| 6816 | status = decode_putrootfh(xdr); | 6833 | status = decode_putrootfh(xdr); |
| 6817 | if (status) | 6834 | if (status) |
| 6818 | goto out; | 6835 | goto out; |
| 6819 | status = decode_secinfo(xdr, res); | 6836 | status = decode_secinfo_no_name(xdr, res); |
| 6820 | out: | 6837 | out: |
| 6821 | return status; | 6838 | return status; |
| 6822 | } | 6839 | } |
diff --git a/fs/nfs/objlayout/objlayout.c b/fs/nfs/objlayout/objlayout.c index 8d45f1c318ce..595c5fc21a19 100644 --- a/fs/nfs/objlayout/objlayout.c +++ b/fs/nfs/objlayout/objlayout.c | |||
| @@ -604,7 +604,6 @@ int objlayout_get_deviceinfo(struct pnfs_layout_hdr *pnfslay, | |||
| 604 | { | 604 | { |
| 605 | struct objlayout_deviceinfo *odi; | 605 | struct objlayout_deviceinfo *odi; |
| 606 | struct pnfs_device pd; | 606 | struct pnfs_device pd; |
| 607 | struct super_block *sb; | ||
| 608 | struct page *page, **pages; | 607 | struct page *page, **pages; |
| 609 | u32 *p; | 608 | u32 *p; |
| 610 | int err; | 609 | int err; |
| @@ -623,7 +622,6 @@ int objlayout_get_deviceinfo(struct pnfs_layout_hdr *pnfslay, | |||
| 623 | pd.pglen = PAGE_SIZE; | 622 | pd.pglen = PAGE_SIZE; |
| 624 | pd.mincount = 0; | 623 | pd.mincount = 0; |
| 625 | 624 | ||
| 626 | sb = pnfslay->plh_inode->i_sb; | ||
| 627 | err = nfs4_proc_getdeviceinfo(NFS_SERVER(pnfslay->plh_inode), &pd); | 625 | err = nfs4_proc_getdeviceinfo(NFS_SERVER(pnfslay->plh_inode), &pd); |
| 628 | dprintk("%s nfs_getdeviceinfo returned %d\n", __func__, err); | 626 | dprintk("%s nfs_getdeviceinfo returned %d\n", __func__, err); |
| 629 | if (err) | 627 | if (err) |
diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c index b5d451586943..38512bcd2e98 100644 --- a/fs/nfs/pnfs.c +++ b/fs/nfs/pnfs.c | |||
| @@ -587,7 +587,7 @@ send_layoutget(struct pnfs_layout_hdr *lo, | |||
| 587 | 587 | ||
| 588 | /* allocate pages for xdr post processing */ | 588 | /* allocate pages for xdr post processing */ |
| 589 | max_resp_sz = server->nfs_client->cl_session->fc_attrs.max_resp_sz; | 589 | max_resp_sz = server->nfs_client->cl_session->fc_attrs.max_resp_sz; |
| 590 | max_pages = max_resp_sz >> PAGE_SHIFT; | 590 | max_pages = nfs_page_array_len(0, max_resp_sz); |
| 591 | 591 | ||
| 592 | pages = kcalloc(max_pages, sizeof(struct page *), gfp_flags); | 592 | pages = kcalloc(max_pages, sizeof(struct page *), gfp_flags); |
| 593 | if (!pages) | 593 | if (!pages) |
diff --git a/fs/nfs/read.c b/fs/nfs/read.c index 9a0e8ef4a409..0a4be28c2ea3 100644 --- a/fs/nfs/read.c +++ b/fs/nfs/read.c | |||
| @@ -322,7 +322,7 @@ out_bad: | |||
| 322 | while (!list_empty(res)) { | 322 | while (!list_empty(res)) { |
| 323 | data = list_entry(res->next, struct nfs_read_data, list); | 323 | data = list_entry(res->next, struct nfs_read_data, list); |
| 324 | list_del(&data->list); | 324 | list_del(&data->list); |
| 325 | nfs_readdata_free(data); | 325 | nfs_readdata_release(data); |
| 326 | } | 326 | } |
| 327 | nfs_readpage_release(req); | 327 | nfs_readpage_release(req); |
| 328 | return -ENOMEM; | 328 | return -ENOMEM; |
diff --git a/fs/nfs/super.c b/fs/nfs/super.c index 37412f706b32..4ac7fca7e4bf 100644 --- a/fs/nfs/super.c +++ b/fs/nfs/super.c | |||
| @@ -2428,7 +2428,7 @@ nfs_xdev_mount(struct file_system_type *fs_type, int flags, | |||
| 2428 | dprintk("--> nfs_xdev_mount()\n"); | 2428 | dprintk("--> nfs_xdev_mount()\n"); |
| 2429 | 2429 | ||
| 2430 | /* create a new volume representation */ | 2430 | /* create a new volume representation */ |
| 2431 | server = nfs_clone_server(NFS_SB(data->sb), data->fh, data->fattr); | 2431 | server = nfs_clone_server(NFS_SB(data->sb), data->fh, data->fattr, data->authflavor); |
| 2432 | if (IS_ERR(server)) { | 2432 | if (IS_ERR(server)) { |
| 2433 | error = PTR_ERR(server); | 2433 | error = PTR_ERR(server); |
| 2434 | goto out_err_noserver; | 2434 | goto out_err_noserver; |
| @@ -2767,11 +2767,15 @@ static struct vfsmount *nfs_do_root_mount(struct file_system_type *fs_type, | |||
| 2767 | char *root_devname; | 2767 | char *root_devname; |
| 2768 | size_t len; | 2768 | size_t len; |
| 2769 | 2769 | ||
| 2770 | len = strlen(hostname) + 3; | 2770 | len = strlen(hostname) + 5; |
| 2771 | root_devname = kmalloc(len, GFP_KERNEL); | 2771 | root_devname = kmalloc(len, GFP_KERNEL); |
| 2772 | if (root_devname == NULL) | 2772 | if (root_devname == NULL) |
| 2773 | return ERR_PTR(-ENOMEM); | 2773 | return ERR_PTR(-ENOMEM); |
| 2774 | snprintf(root_devname, len, "%s:/", hostname); | 2774 | /* Does hostname needs to be enclosed in brackets? */ |
| 2775 | if (strchr(hostname, ':')) | ||
| 2776 | snprintf(root_devname, len, "[%s]:/", hostname); | ||
| 2777 | else | ||
| 2778 | snprintf(root_devname, len, "%s:/", hostname); | ||
| 2775 | root_mnt = vfs_kern_mount(fs_type, flags, root_devname, data); | 2779 | root_mnt = vfs_kern_mount(fs_type, flags, root_devname, data); |
| 2776 | kfree(root_devname); | 2780 | kfree(root_devname); |
| 2777 | return root_mnt; | 2781 | return root_mnt; |
| @@ -2951,7 +2955,7 @@ nfs4_xdev_mount(struct file_system_type *fs_type, int flags, | |||
| 2951 | dprintk("--> nfs4_xdev_mount()\n"); | 2955 | dprintk("--> nfs4_xdev_mount()\n"); |
| 2952 | 2956 | ||
| 2953 | /* create a new volume representation */ | 2957 | /* create a new volume representation */ |
| 2954 | server = nfs_clone_server(NFS_SB(data->sb), data->fh, data->fattr); | 2958 | server = nfs_clone_server(NFS_SB(data->sb), data->fh, data->fattr, data->authflavor); |
| 2955 | if (IS_ERR(server)) { | 2959 | if (IS_ERR(server)) { |
| 2956 | error = PTR_ERR(server); | 2960 | error = PTR_ERR(server); |
| 2957 | goto out_err_noserver; | 2961 | goto out_err_noserver; |
diff --git a/fs/nfs/write.c b/fs/nfs/write.c index 2c68818f68ac..c07462320f6b 100644 --- a/fs/nfs/write.c +++ b/fs/nfs/write.c | |||
| @@ -682,7 +682,8 @@ static struct nfs_page *nfs_try_to_update_request(struct inode *inode, | |||
| 682 | req->wb_bytes = rqend - req->wb_offset; | 682 | req->wb_bytes = rqend - req->wb_offset; |
| 683 | out_unlock: | 683 | out_unlock: |
| 684 | spin_unlock(&inode->i_lock); | 684 | spin_unlock(&inode->i_lock); |
| 685 | nfs_clear_request_commit(req); | 685 | if (req) |
| 686 | nfs_clear_request_commit(req); | ||
| 686 | return req; | 687 | return req; |
| 687 | out_flushme: | 688 | out_flushme: |
| 688 | spin_unlock(&inode->i_lock); | 689 | spin_unlock(&inode->i_lock); |
| @@ -1018,7 +1019,7 @@ out_bad: | |||
| 1018 | while (!list_empty(res)) { | 1019 | while (!list_empty(res)) { |
| 1019 | data = list_entry(res->next, struct nfs_write_data, list); | 1020 | data = list_entry(res->next, struct nfs_write_data, list); |
| 1020 | list_del(&data->list); | 1021 | list_del(&data->list); |
| 1021 | nfs_writedata_free(data); | 1022 | nfs_writedata_release(data); |
| 1022 | } | 1023 | } |
| 1023 | nfs_redirty_request(req); | 1024 | nfs_redirty_request(req); |
| 1024 | return -ENOMEM; | 1025 | return -ENOMEM; |
diff --git a/fs/nfsd/nfs3xdr.c b/fs/nfsd/nfs3xdr.c index 08c6e36ab2eb..43f46cd9edea 100644 --- a/fs/nfsd/nfs3xdr.c +++ b/fs/nfsd/nfs3xdr.c | |||
| @@ -803,13 +803,13 @@ encode_entry_baggage(struct nfsd3_readdirres *cd, __be32 *p, const char *name, | |||
| 803 | return p; | 803 | return p; |
| 804 | } | 804 | } |
| 805 | 805 | ||
| 806 | static int | 806 | static __be32 |
| 807 | compose_entry_fh(struct nfsd3_readdirres *cd, struct svc_fh *fhp, | 807 | compose_entry_fh(struct nfsd3_readdirres *cd, struct svc_fh *fhp, |
| 808 | const char *name, int namlen) | 808 | const char *name, int namlen) |
| 809 | { | 809 | { |
| 810 | struct svc_export *exp; | 810 | struct svc_export *exp; |
| 811 | struct dentry *dparent, *dchild; | 811 | struct dentry *dparent, *dchild; |
| 812 | int rv = 0; | 812 | __be32 rv = nfserr_noent; |
| 813 | 813 | ||
| 814 | dparent = cd->fh.fh_dentry; | 814 | dparent = cd->fh.fh_dentry; |
| 815 | exp = cd->fh.fh_export; | 815 | exp = cd->fh.fh_export; |
| @@ -817,26 +817,20 @@ compose_entry_fh(struct nfsd3_readdirres *cd, struct svc_fh *fhp, | |||
| 817 | if (isdotent(name, namlen)) { | 817 | if (isdotent(name, namlen)) { |
| 818 | if (namlen == 2) { | 818 | if (namlen == 2) { |
| 819 | dchild = dget_parent(dparent); | 819 | dchild = dget_parent(dparent); |
| 820 | if (dchild == dparent) { | 820 | /* filesystem root - cannot return filehandle for ".." */ |
| 821 | /* filesystem root - cannot return filehandle for ".." */ | 821 | if (dchild == dparent) |
| 822 | dput(dchild); | 822 | goto out; |
| 823 | return -ENOENT; | ||
| 824 | } | ||
| 825 | } else | 823 | } else |
| 826 | dchild = dget(dparent); | 824 | dchild = dget(dparent); |
| 827 | } else | 825 | } else |
| 828 | dchild = lookup_one_len(name, dparent, namlen); | 826 | dchild = lookup_one_len(name, dparent, namlen); |
| 829 | if (IS_ERR(dchild)) | 827 | if (IS_ERR(dchild)) |
| 830 | return -ENOENT; | 828 | return rv; |
| 831 | rv = -ENOENT; | ||
| 832 | if (d_mountpoint(dchild)) | 829 | if (d_mountpoint(dchild)) |
| 833 | goto out; | 830 | goto out; |
| 834 | rv = fh_compose(fhp, exp, dchild, &cd->fh); | ||
| 835 | if (rv) | ||
| 836 | goto out; | ||
| 837 | if (!dchild->d_inode) | 831 | if (!dchild->d_inode) |
| 838 | goto out; | 832 | goto out; |
| 839 | rv = 0; | 833 | rv = fh_compose(fhp, exp, dchild, &cd->fh); |
| 840 | out: | 834 | out: |
| 841 | dput(dchild); | 835 | dput(dchild); |
| 842 | return rv; | 836 | return rv; |
| @@ -845,7 +839,7 @@ out: | |||
| 845 | static __be32 *encode_entryplus_baggage(struct nfsd3_readdirres *cd, __be32 *p, const char *name, int namlen) | 839 | static __be32 *encode_entryplus_baggage(struct nfsd3_readdirres *cd, __be32 *p, const char *name, int namlen) |
| 846 | { | 840 | { |
| 847 | struct svc_fh fh; | 841 | struct svc_fh fh; |
| 848 | int err; | 842 | __be32 err; |
| 849 | 843 | ||
| 850 | fh_init(&fh, NFS3_FHSIZE); | 844 | fh_init(&fh, NFS3_FHSIZE); |
| 851 | err = compose_entry_fh(cd, &fh, name, namlen); | 845 | err = compose_entry_fh(cd, &fh, name, namlen); |
diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c index 2ed14dfd00a2..987e719fbae8 100644 --- a/fs/nfsd/nfs4proc.c +++ b/fs/nfsd/nfs4proc.c | |||
| @@ -235,17 +235,17 @@ do_open_lookup(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_o | |||
| 235 | */ | 235 | */ |
| 236 | if (open->op_createmode == NFS4_CREATE_EXCLUSIVE && status == 0) | 236 | if (open->op_createmode == NFS4_CREATE_EXCLUSIVE && status == 0) |
| 237 | open->op_bmval[1] = (FATTR4_WORD1_TIME_ACCESS | | 237 | open->op_bmval[1] = (FATTR4_WORD1_TIME_ACCESS | |
| 238 | FATTR4_WORD1_TIME_MODIFY); | 238 | FATTR4_WORD1_TIME_MODIFY); |
| 239 | } else { | 239 | } else { |
| 240 | status = nfsd_lookup(rqstp, current_fh, | 240 | status = nfsd_lookup(rqstp, current_fh, |
| 241 | open->op_fname.data, open->op_fname.len, resfh); | 241 | open->op_fname.data, open->op_fname.len, resfh); |
| 242 | fh_unlock(current_fh); | 242 | fh_unlock(current_fh); |
| 243 | if (status) | ||
| 244 | goto out; | ||
| 245 | status = nfsd_check_obj_isreg(resfh); | ||
| 246 | } | 243 | } |
| 247 | if (status) | 244 | if (status) |
| 248 | goto out; | 245 | goto out; |
| 246 | status = nfsd_check_obj_isreg(resfh); | ||
| 247 | if (status) | ||
| 248 | goto out; | ||
| 249 | 249 | ||
| 250 | if (is_create_with_attrs(open) && open->op_acl != NULL) | 250 | if (is_create_with_attrs(open) && open->op_acl != NULL) |
| 251 | do_set_nfs4_acl(rqstp, resfh, open->op_acl, open->op_bmval); | 251 | do_set_nfs4_acl(rqstp, resfh, open->op_acl, open->op_bmval); |
| @@ -841,6 +841,7 @@ nfsd4_setattr(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, | |||
| 841 | struct nfsd4_setattr *setattr) | 841 | struct nfsd4_setattr *setattr) |
| 842 | { | 842 | { |
| 843 | __be32 status = nfs_ok; | 843 | __be32 status = nfs_ok; |
| 844 | int err; | ||
| 844 | 845 | ||
| 845 | if (setattr->sa_iattr.ia_valid & ATTR_SIZE) { | 846 | if (setattr->sa_iattr.ia_valid & ATTR_SIZE) { |
| 846 | nfs4_lock_state(); | 847 | nfs4_lock_state(); |
| @@ -852,9 +853,9 @@ nfsd4_setattr(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, | |||
| 852 | return status; | 853 | return status; |
| 853 | } | 854 | } |
| 854 | } | 855 | } |
| 855 | status = fh_want_write(&cstate->current_fh); | 856 | err = fh_want_write(&cstate->current_fh); |
| 856 | if (status) | 857 | if (err) |
| 857 | return status; | 858 | return nfserrno(err); |
| 858 | status = nfs_ok; | 859 | status = nfs_ok; |
| 859 | 860 | ||
| 860 | status = check_attr_support(rqstp, cstate, setattr->sa_bmval, | 861 | status = check_attr_support(rqstp, cstate, setattr->sa_bmval, |
diff --git a/fs/nfsd/nfs4recover.c b/fs/nfsd/nfs4recover.c index 4767429264a2..ed3f9206a0ee 100644 --- a/fs/nfsd/nfs4recover.c +++ b/fs/nfsd/nfs4recover.c | |||
| @@ -577,7 +577,7 @@ cld_pipe_downcall(struct file *filp, const char __user *src, size_t mlen) | |||
| 577 | struct cld_net *cn = nn->cld_net; | 577 | struct cld_net *cn = nn->cld_net; |
| 578 | 578 | ||
| 579 | if (mlen != sizeof(*cmsg)) { | 579 | if (mlen != sizeof(*cmsg)) { |
| 580 | dprintk("%s: got %lu bytes, expected %lu\n", __func__, mlen, | 580 | dprintk("%s: got %zu bytes, expected %zu\n", __func__, mlen, |
| 581 | sizeof(*cmsg)); | 581 | sizeof(*cmsg)); |
| 582 | return -EINVAL; | 582 | return -EINVAL; |
| 583 | } | 583 | } |
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index 1841f8bf845e..7f71c69cdcdf 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c | |||
| @@ -4211,16 +4211,14 @@ out: | |||
| 4211 | * vfs_test_lock. (Arguably perhaps test_lock should be done with an | 4211 | * vfs_test_lock. (Arguably perhaps test_lock should be done with an |
| 4212 | * inode operation.) | 4212 | * inode operation.) |
| 4213 | */ | 4213 | */ |
| 4214 | static int nfsd_test_lock(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file_lock *lock) | 4214 | static __be32 nfsd_test_lock(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file_lock *lock) |
| 4215 | { | 4215 | { |
| 4216 | struct file *file; | 4216 | struct file *file; |
| 4217 | int err; | 4217 | __be32 err = nfsd_open(rqstp, fhp, S_IFREG, NFSD_MAY_READ, &file); |
| 4218 | 4218 | if (!err) { | |
| 4219 | err = nfsd_open(rqstp, fhp, S_IFREG, NFSD_MAY_READ, &file); | 4219 | err = nfserrno(vfs_test_lock(file, lock)); |
| 4220 | if (err) | 4220 | nfsd_close(file); |
| 4221 | return err; | 4221 | } |
| 4222 | err = vfs_test_lock(file, lock); | ||
| 4223 | nfsd_close(file); | ||
| 4224 | return err; | 4222 | return err; |
| 4225 | } | 4223 | } |
| 4226 | 4224 | ||
| @@ -4234,7 +4232,6 @@ nfsd4_lockt(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, | |||
| 4234 | struct inode *inode; | 4232 | struct inode *inode; |
| 4235 | struct file_lock file_lock; | 4233 | struct file_lock file_lock; |
| 4236 | struct nfs4_lockowner *lo; | 4234 | struct nfs4_lockowner *lo; |
| 4237 | int error; | ||
| 4238 | __be32 status; | 4235 | __be32 status; |
| 4239 | 4236 | ||
| 4240 | if (locks_in_grace()) | 4237 | if (locks_in_grace()) |
| @@ -4280,12 +4277,10 @@ nfsd4_lockt(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, | |||
| 4280 | 4277 | ||
| 4281 | nfs4_transform_lock_offset(&file_lock); | 4278 | nfs4_transform_lock_offset(&file_lock); |
| 4282 | 4279 | ||
| 4283 | status = nfs_ok; | 4280 | status = nfsd_test_lock(rqstp, &cstate->current_fh, &file_lock); |
| 4284 | error = nfsd_test_lock(rqstp, &cstate->current_fh, &file_lock); | 4281 | if (status) |
| 4285 | if (error) { | ||
| 4286 | status = nfserrno(error); | ||
| 4287 | goto out; | 4282 | goto out; |
| 4288 | } | 4283 | |
| 4289 | if (file_lock.fl_type != F_UNLCK) { | 4284 | if (file_lock.fl_type != F_UNLCK) { |
| 4290 | status = nfserr_denied; | 4285 | status = nfserr_denied; |
| 4291 | nfs4_set_lock_denied(&file_lock, &lockt->lt_denied); | 4286 | nfs4_set_lock_denied(&file_lock, &lockt->lt_denied); |
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c index bcd8904ab1e3..74c00bc92b9a 100644 --- a/fs/nfsd/nfs4xdr.c +++ b/fs/nfsd/nfs4xdr.c | |||
| @@ -1392,7 +1392,7 @@ nfsd4_decode_test_stateid(struct nfsd4_compoundargs *argp, struct nfsd4_test_sta | |||
| 1392 | for (i = 0; i < test_stateid->ts_num_ids; i++) { | 1392 | for (i = 0; i < test_stateid->ts_num_ids; i++) { |
| 1393 | stateid = kmalloc(sizeof(struct nfsd4_test_stateid_id), GFP_KERNEL); | 1393 | stateid = kmalloc(sizeof(struct nfsd4_test_stateid_id), GFP_KERNEL); |
| 1394 | if (!stateid) { | 1394 | if (!stateid) { |
| 1395 | status = PTR_ERR(stateid); | 1395 | status = nfserrno(-ENOMEM); |
| 1396 | goto out; | 1396 | goto out; |
| 1397 | } | 1397 | } |
| 1398 | 1398 | ||
| @@ -3410,7 +3410,7 @@ nfsd4_encode_test_stateid(struct nfsd4_compoundres *resp, int nfserr, | |||
| 3410 | *p++ = htonl(test_stateid->ts_num_ids); | 3410 | *p++ = htonl(test_stateid->ts_num_ids); |
| 3411 | 3411 | ||
| 3412 | list_for_each_entry_safe(stateid, next, &test_stateid->ts_stateid_list, ts_id_list) { | 3412 | list_for_each_entry_safe(stateid, next, &test_stateid->ts_stateid_list, ts_id_list) { |
| 3413 | *p++ = htonl(stateid->ts_id_status); | 3413 | *p++ = stateid->ts_id_status; |
| 3414 | } | 3414 | } |
| 3415 | 3415 | ||
| 3416 | ADJUST_ARGS(); | 3416 | ADJUST_ARGS(); |
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c index 296d671654d6..568666156ea4 100644 --- a/fs/nfsd/vfs.c +++ b/fs/nfsd/vfs.c | |||
| @@ -1458,7 +1458,7 @@ do_nfsd_create(struct svc_rqst *rqstp, struct svc_fh *fhp, | |||
| 1458 | switch (createmode) { | 1458 | switch (createmode) { |
| 1459 | case NFS3_CREATE_UNCHECKED: | 1459 | case NFS3_CREATE_UNCHECKED: |
| 1460 | if (! S_ISREG(dchild->d_inode->i_mode)) | 1460 | if (! S_ISREG(dchild->d_inode->i_mode)) |
| 1461 | err = nfserr_exist; | 1461 | goto out; |
| 1462 | else if (truncp) { | 1462 | else if (truncp) { |
| 1463 | /* in nfsv4, we need to treat this case a little | 1463 | /* in nfsv4, we need to treat this case a little |
| 1464 | * differently. we don't want to truncate the | 1464 | * differently. we don't want to truncate the |
diff --git a/fs/ocfs2/alloc.c b/fs/ocfs2/alloc.c index 3165aebb43c8..31b9463fba1f 100644 --- a/fs/ocfs2/alloc.c +++ b/fs/ocfs2/alloc.c | |||
| @@ -1134,7 +1134,7 @@ static int ocfs2_adjust_rightmost_branch(handle_t *handle, | |||
| 1134 | } | 1134 | } |
| 1135 | 1135 | ||
| 1136 | el = path_leaf_el(path); | 1136 | el = path_leaf_el(path); |
| 1137 | rec = &el->l_recs[le32_to_cpu(el->l_next_free_rec) - 1]; | 1137 | rec = &el->l_recs[le16_to_cpu(el->l_next_free_rec) - 1]; |
| 1138 | 1138 | ||
| 1139 | ocfs2_adjust_rightmost_records(handle, et, path, rec); | 1139 | ocfs2_adjust_rightmost_records(handle, et, path, rec); |
| 1140 | 1140 | ||
diff --git a/fs/ocfs2/refcounttree.c b/fs/ocfs2/refcounttree.c index cf7823382664..9f32d7cbb7a3 100644 --- a/fs/ocfs2/refcounttree.c +++ b/fs/ocfs2/refcounttree.c | |||
| @@ -1036,14 +1036,14 @@ static int ocfs2_get_refcount_cpos_end(struct ocfs2_caching_info *ci, | |||
| 1036 | 1036 | ||
| 1037 | tmp_el = left_path->p_node[subtree_root].el; | 1037 | tmp_el = left_path->p_node[subtree_root].el; |
| 1038 | blkno = left_path->p_node[subtree_root+1].bh->b_blocknr; | 1038 | blkno = left_path->p_node[subtree_root+1].bh->b_blocknr; |
| 1039 | for (i = 0; i < le32_to_cpu(tmp_el->l_next_free_rec); i++) { | 1039 | for (i = 0; i < le16_to_cpu(tmp_el->l_next_free_rec); i++) { |
| 1040 | if (le64_to_cpu(tmp_el->l_recs[i].e_blkno) == blkno) { | 1040 | if (le64_to_cpu(tmp_el->l_recs[i].e_blkno) == blkno) { |
| 1041 | *cpos_end = le32_to_cpu(tmp_el->l_recs[i+1].e_cpos); | 1041 | *cpos_end = le32_to_cpu(tmp_el->l_recs[i+1].e_cpos); |
| 1042 | break; | 1042 | break; |
| 1043 | } | 1043 | } |
| 1044 | } | 1044 | } |
| 1045 | 1045 | ||
| 1046 | BUG_ON(i == le32_to_cpu(tmp_el->l_next_free_rec)); | 1046 | BUG_ON(i == le16_to_cpu(tmp_el->l_next_free_rec)); |
| 1047 | 1047 | ||
| 1048 | out: | 1048 | out: |
| 1049 | ocfs2_free_path(left_path); | 1049 | ocfs2_free_path(left_path); |
| @@ -1468,7 +1468,7 @@ static int ocfs2_divide_leaf_refcount_block(struct buffer_head *ref_leaf_bh, | |||
| 1468 | 1468 | ||
| 1469 | trace_ocfs2_divide_leaf_refcount_block( | 1469 | trace_ocfs2_divide_leaf_refcount_block( |
| 1470 | (unsigned long long)ref_leaf_bh->b_blocknr, | 1470 | (unsigned long long)ref_leaf_bh->b_blocknr, |
| 1471 | le32_to_cpu(rl->rl_count), le32_to_cpu(rl->rl_used)); | 1471 | le16_to_cpu(rl->rl_count), le16_to_cpu(rl->rl_used)); |
| 1472 | 1472 | ||
| 1473 | /* | 1473 | /* |
| 1474 | * XXX: Improvement later. | 1474 | * XXX: Improvement later. |
| @@ -2411,7 +2411,7 @@ static int ocfs2_calc_refcount_meta_credits(struct super_block *sb, | |||
| 2411 | rb = (struct ocfs2_refcount_block *) | 2411 | rb = (struct ocfs2_refcount_block *) |
| 2412 | prev_bh->b_data; | 2412 | prev_bh->b_data; |
| 2413 | 2413 | ||
| 2414 | if (le64_to_cpu(rb->rf_records.rl_used) + | 2414 | if (le16_to_cpu(rb->rf_records.rl_used) + |
| 2415 | recs_add > | 2415 | recs_add > |
| 2416 | le16_to_cpu(rb->rf_records.rl_count)) | 2416 | le16_to_cpu(rb->rf_records.rl_count)) |
| 2417 | ref_blocks++; | 2417 | ref_blocks++; |
| @@ -2476,7 +2476,7 @@ static int ocfs2_calc_refcount_meta_credits(struct super_block *sb, | |||
| 2476 | if (prev_bh) { | 2476 | if (prev_bh) { |
| 2477 | rb = (struct ocfs2_refcount_block *)prev_bh->b_data; | 2477 | rb = (struct ocfs2_refcount_block *)prev_bh->b_data; |
| 2478 | 2478 | ||
| 2479 | if (le64_to_cpu(rb->rf_records.rl_used) + recs_add > | 2479 | if (le16_to_cpu(rb->rf_records.rl_used) + recs_add > |
| 2480 | le16_to_cpu(rb->rf_records.rl_count)) | 2480 | le16_to_cpu(rb->rf_records.rl_count)) |
| 2481 | ref_blocks++; | 2481 | ref_blocks++; |
| 2482 | 2482 | ||
| @@ -3629,7 +3629,7 @@ int ocfs2_refcounted_xattr_delete_need(struct inode *inode, | |||
| 3629 | * one will split a refcount rec, so totally we need | 3629 | * one will split a refcount rec, so totally we need |
| 3630 | * clusters * 2 new refcount rec. | 3630 | * clusters * 2 new refcount rec. |
| 3631 | */ | 3631 | */ |
| 3632 | if (le64_to_cpu(rb->rf_records.rl_used) + clusters * 2 > | 3632 | if (le16_to_cpu(rb->rf_records.rl_used) + clusters * 2 > |
| 3633 | le16_to_cpu(rb->rf_records.rl_count)) | 3633 | le16_to_cpu(rb->rf_records.rl_count)) |
| 3634 | ref_blocks++; | 3634 | ref_blocks++; |
| 3635 | 3635 | ||
diff --git a/fs/ocfs2/suballoc.c b/fs/ocfs2/suballoc.c index ba5d97e4a73e..f169da4624fd 100644 --- a/fs/ocfs2/suballoc.c +++ b/fs/ocfs2/suballoc.c | |||
| @@ -600,7 +600,7 @@ static void ocfs2_bg_alloc_cleanup(handle_t *handle, | |||
| 600 | ret = ocfs2_free_clusters(handle, cluster_ac->ac_inode, | 600 | ret = ocfs2_free_clusters(handle, cluster_ac->ac_inode, |
| 601 | cluster_ac->ac_bh, | 601 | cluster_ac->ac_bh, |
| 602 | le64_to_cpu(rec->e_blkno), | 602 | le64_to_cpu(rec->e_blkno), |
| 603 | le32_to_cpu(rec->e_leaf_clusters)); | 603 | le16_to_cpu(rec->e_leaf_clusters)); |
| 604 | if (ret) | 604 | if (ret) |
| 605 | mlog_errno(ret); | 605 | mlog_errno(ret); |
| 606 | /* Try all the clusters to free */ | 606 | /* Try all the clusters to free */ |
| @@ -1628,7 +1628,7 @@ static int ocfs2_bg_discontig_fix_by_rec(struct ocfs2_suballoc_result *res, | |||
| 1628 | { | 1628 | { |
| 1629 | unsigned int bpc = le16_to_cpu(cl->cl_bpc); | 1629 | unsigned int bpc = le16_to_cpu(cl->cl_bpc); |
| 1630 | unsigned int bitoff = le32_to_cpu(rec->e_cpos) * bpc; | 1630 | unsigned int bitoff = le32_to_cpu(rec->e_cpos) * bpc; |
| 1631 | unsigned int bitcount = le32_to_cpu(rec->e_leaf_clusters) * bpc; | 1631 | unsigned int bitcount = le16_to_cpu(rec->e_leaf_clusters) * bpc; |
| 1632 | 1632 | ||
| 1633 | if (res->sr_bit_offset < bitoff) | 1633 | if (res->sr_bit_offset < bitoff) |
| 1634 | return 0; | 1634 | return 0; |
| @@ -346,6 +346,16 @@ static const struct pipe_buf_operations anon_pipe_buf_ops = { | |||
| 346 | .get = generic_pipe_buf_get, | 346 | .get = generic_pipe_buf_get, |
| 347 | }; | 347 | }; |
| 348 | 348 | ||
| 349 | static const struct pipe_buf_operations packet_pipe_buf_ops = { | ||
| 350 | .can_merge = 0, | ||
| 351 | .map = generic_pipe_buf_map, | ||
| 352 | .unmap = generic_pipe_buf_unmap, | ||
| 353 | .confirm = generic_pipe_buf_confirm, | ||
| 354 | .release = anon_pipe_buf_release, | ||
| 355 | .steal = generic_pipe_buf_steal, | ||
| 356 | .get = generic_pipe_buf_get, | ||
| 357 | }; | ||
| 358 | |||
| 349 | static ssize_t | 359 | static ssize_t |
| 350 | pipe_read(struct kiocb *iocb, const struct iovec *_iov, | 360 | pipe_read(struct kiocb *iocb, const struct iovec *_iov, |
| 351 | unsigned long nr_segs, loff_t pos) | 361 | unsigned long nr_segs, loff_t pos) |
| @@ -407,6 +417,13 @@ redo: | |||
| 407 | ret += chars; | 417 | ret += chars; |
| 408 | buf->offset += chars; | 418 | buf->offset += chars; |
| 409 | buf->len -= chars; | 419 | buf->len -= chars; |
| 420 | |||
| 421 | /* Was it a packet buffer? Clean up and exit */ | ||
| 422 | if (buf->flags & PIPE_BUF_FLAG_PACKET) { | ||
| 423 | total_len = chars; | ||
| 424 | buf->len = 0; | ||
| 425 | } | ||
| 426 | |||
| 410 | if (!buf->len) { | 427 | if (!buf->len) { |
| 411 | buf->ops = NULL; | 428 | buf->ops = NULL; |
| 412 | ops->release(pipe, buf); | 429 | ops->release(pipe, buf); |
| @@ -459,6 +476,11 @@ redo: | |||
| 459 | return ret; | 476 | return ret; |
| 460 | } | 477 | } |
| 461 | 478 | ||
| 479 | static inline int is_packetized(struct file *file) | ||
| 480 | { | ||
| 481 | return (file->f_flags & O_DIRECT) != 0; | ||
| 482 | } | ||
| 483 | |||
| 462 | static ssize_t | 484 | static ssize_t |
| 463 | pipe_write(struct kiocb *iocb, const struct iovec *_iov, | 485 | pipe_write(struct kiocb *iocb, const struct iovec *_iov, |
| 464 | unsigned long nr_segs, loff_t ppos) | 486 | unsigned long nr_segs, loff_t ppos) |
| @@ -593,6 +615,11 @@ redo2: | |||
| 593 | buf->ops = &anon_pipe_buf_ops; | 615 | buf->ops = &anon_pipe_buf_ops; |
| 594 | buf->offset = 0; | 616 | buf->offset = 0; |
| 595 | buf->len = chars; | 617 | buf->len = chars; |
| 618 | buf->flags = 0; | ||
| 619 | if (is_packetized(filp)) { | ||
| 620 | buf->ops = &packet_pipe_buf_ops; | ||
| 621 | buf->flags = PIPE_BUF_FLAG_PACKET; | ||
| 622 | } | ||
| 596 | pipe->nrbufs = ++bufs; | 623 | pipe->nrbufs = ++bufs; |
| 597 | pipe->tmp_page = NULL; | 624 | pipe->tmp_page = NULL; |
| 598 | 625 | ||
| @@ -1013,7 +1040,7 @@ struct file *create_write_pipe(int flags) | |||
| 1013 | goto err_dentry; | 1040 | goto err_dentry; |
| 1014 | f->f_mapping = inode->i_mapping; | 1041 | f->f_mapping = inode->i_mapping; |
| 1015 | 1042 | ||
| 1016 | f->f_flags = O_WRONLY | (flags & O_NONBLOCK); | 1043 | f->f_flags = O_WRONLY | (flags & (O_NONBLOCK | O_DIRECT)); |
| 1017 | f->f_version = 0; | 1044 | f->f_version = 0; |
| 1018 | 1045 | ||
| 1019 | return f; | 1046 | return f; |
| @@ -1057,7 +1084,7 @@ int do_pipe_flags(int *fd, int flags) | |||
| 1057 | int error; | 1084 | int error; |
| 1058 | int fdw, fdr; | 1085 | int fdw, fdr; |
| 1059 | 1086 | ||
| 1060 | if (flags & ~(O_CLOEXEC | O_NONBLOCK)) | 1087 | if (flags & ~(O_CLOEXEC | O_NONBLOCK | O_DIRECT)) |
| 1061 | return -EINVAL; | 1088 | return -EINVAL; |
| 1062 | 1089 | ||
| 1063 | fw = create_write_pipe(flags); | 1090 | fw = create_write_pipe(flags); |
diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c index 2b9a7607cbd5..2d60492d6df8 100644 --- a/fs/proc/task_mmu.c +++ b/fs/proc/task_mmu.c | |||
| @@ -597,9 +597,6 @@ static int clear_refs_pte_range(pmd_t *pmd, unsigned long addr, | |||
| 597 | if (!page) | 597 | if (!page) |
| 598 | continue; | 598 | continue; |
| 599 | 599 | ||
| 600 | if (PageReserved(page)) | ||
| 601 | continue; | ||
| 602 | |||
| 603 | /* Clear accessed and referenced bits. */ | 600 | /* Clear accessed and referenced bits. */ |
| 604 | ptep_test_and_clear_young(vma, addr, pte); | 601 | ptep_test_and_clear_young(vma, addr, pte); |
| 605 | ClearPageReferenced(page); | 602 | ClearPageReferenced(page); |
diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h index eba66043cf1b..e8bcc4742e0e 100644 --- a/include/acpi/actypes.h +++ b/include/acpi/actypes.h | |||
| @@ -499,9 +499,10 @@ typedef u64 acpi_integer; | |||
| 499 | #define ACPI_STATE_D0 (u8) 0 | 499 | #define ACPI_STATE_D0 (u8) 0 |
| 500 | #define ACPI_STATE_D1 (u8) 1 | 500 | #define ACPI_STATE_D1 (u8) 1 |
| 501 | #define ACPI_STATE_D2 (u8) 2 | 501 | #define ACPI_STATE_D2 (u8) 2 |
| 502 | #define ACPI_STATE_D3 (u8) 3 | 502 | #define ACPI_STATE_D3_HOT (u8) 3 |
| 503 | #define ACPI_STATE_D3_COLD (u8) 4 | 503 | #define ACPI_STATE_D3 (u8) 4 |
| 504 | #define ACPI_D_STATES_MAX ACPI_STATE_D3_COLD | 504 | #define ACPI_STATE_D3_COLD ACPI_STATE_D3 |
| 505 | #define ACPI_D_STATES_MAX ACPI_STATE_D3 | ||
| 505 | #define ACPI_D_STATE_COUNT 5 | 506 | #define ACPI_D_STATE_COUNT 5 |
| 506 | 507 | ||
| 507 | #define ACPI_STATE_C0 (u8) 0 | 508 | #define ACPI_STATE_C0 (u8) 0 |
diff --git a/include/asm-generic/siginfo.h b/include/asm-generic/siginfo.h index 0dd4e87f6fba..5e5e3865f1ed 100644 --- a/include/asm-generic/siginfo.h +++ b/include/asm-generic/siginfo.h | |||
| @@ -35,6 +35,14 @@ typedef union sigval { | |||
| 35 | #define __ARCH_SI_BAND_T long | 35 | #define __ARCH_SI_BAND_T long |
| 36 | #endif | 36 | #endif |
| 37 | 37 | ||
| 38 | #ifndef __ARCH_SI_CLOCK_T | ||
| 39 | #define __ARCH_SI_CLOCK_T __kernel_clock_t | ||
| 40 | #endif | ||
| 41 | |||
| 42 | #ifndef __ARCH_SI_ATTRIBUTES | ||
| 43 | #define __ARCH_SI_ATTRIBUTES | ||
| 44 | #endif | ||
| 45 | |||
| 38 | #ifndef HAVE_ARCH_SIGINFO_T | 46 | #ifndef HAVE_ARCH_SIGINFO_T |
| 39 | 47 | ||
| 40 | typedef struct siginfo { | 48 | typedef struct siginfo { |
| @@ -72,8 +80,8 @@ typedef struct siginfo { | |||
| 72 | __kernel_pid_t _pid; /* which child */ | 80 | __kernel_pid_t _pid; /* which child */ |
| 73 | __ARCH_SI_UID_T _uid; /* sender's uid */ | 81 | __ARCH_SI_UID_T _uid; /* sender's uid */ |
| 74 | int _status; /* exit code */ | 82 | int _status; /* exit code */ |
| 75 | __kernel_clock_t _utime; | 83 | __ARCH_SI_CLOCK_T _utime; |
| 76 | __kernel_clock_t _stime; | 84 | __ARCH_SI_CLOCK_T _stime; |
| 77 | } _sigchld; | 85 | } _sigchld; |
| 78 | 86 | ||
| 79 | /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */ | 87 | /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */ |
| @@ -91,7 +99,7 @@ typedef struct siginfo { | |||
| 91 | int _fd; | 99 | int _fd; |
| 92 | } _sigpoll; | 100 | } _sigpoll; |
| 93 | } _sifields; | 101 | } _sifields; |
| 94 | } siginfo_t; | 102 | } __ARCH_SI_ATTRIBUTES siginfo_t; |
| 95 | 103 | ||
| 96 | #endif | 104 | #endif |
| 97 | 105 | ||
diff --git a/include/asm-generic/statfs.h b/include/asm-generic/statfs.h index 0fd28e028de1..c749af9c0983 100644 --- a/include/asm-generic/statfs.h +++ b/include/asm-generic/statfs.h | |||
| @@ -15,7 +15,7 @@ typedef __kernel_fsid_t fsid_t; | |||
| 15 | * with a 10' pole. | 15 | * with a 10' pole. |
| 16 | */ | 16 | */ |
| 17 | #ifndef __statfs_word | 17 | #ifndef __statfs_word |
| 18 | #if BITS_PER_LONG == 64 | 18 | #if __BITS_PER_LONG == 64 |
| 19 | #define __statfs_word long | 19 | #define __statfs_word long |
| 20 | #else | 20 | #else |
| 21 | #define __statfs_word __u32 | 21 | #define __statfs_word __u32 |
diff --git a/include/linux/efi.h b/include/linux/efi.h index 88ec80670d5f..ec45ccd8708a 100644 --- a/include/linux/efi.h +++ b/include/linux/efi.h | |||
| @@ -554,7 +554,18 @@ extern int __init efi_setup_pcdp_console(char *); | |||
| 554 | #define EFI_VARIABLE_NON_VOLATILE 0x0000000000000001 | 554 | #define EFI_VARIABLE_NON_VOLATILE 0x0000000000000001 |
| 555 | #define EFI_VARIABLE_BOOTSERVICE_ACCESS 0x0000000000000002 | 555 | #define EFI_VARIABLE_BOOTSERVICE_ACCESS 0x0000000000000002 |
| 556 | #define EFI_VARIABLE_RUNTIME_ACCESS 0x0000000000000004 | 556 | #define EFI_VARIABLE_RUNTIME_ACCESS 0x0000000000000004 |
| 557 | 557 | #define EFI_VARIABLE_HARDWARE_ERROR_RECORD 0x0000000000000008 | |
| 558 | #define EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS 0x0000000000000010 | ||
| 559 | #define EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS 0x0000000000000020 | ||
| 560 | #define EFI_VARIABLE_APPEND_WRITE 0x0000000000000040 | ||
| 561 | |||
| 562 | #define EFI_VARIABLE_MASK (EFI_VARIABLE_NON_VOLATILE | \ | ||
| 563 | EFI_VARIABLE_BOOTSERVICE_ACCESS | \ | ||
| 564 | EFI_VARIABLE_RUNTIME_ACCESS | \ | ||
| 565 | EFI_VARIABLE_HARDWARE_ERROR_RECORD | \ | ||
| 566 | EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS | \ | ||
| 567 | EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS | \ | ||
| 568 | EFI_VARIABLE_APPEND_WRITE) | ||
| 558 | /* | 569 | /* |
| 559 | * The type of search to perform when calling boottime->locate_handle | 570 | * The type of search to perform when calling boottime->locate_handle |
| 560 | */ | 571 | */ |
diff --git a/include/linux/fuse.h b/include/linux/fuse.h index 8ba2c9460b28..8f2ab8fef929 100644 --- a/include/linux/fuse.h +++ b/include/linux/fuse.h | |||
| @@ -593,7 +593,7 @@ struct fuse_dirent { | |||
| 593 | __u64 off; | 593 | __u64 off; |
| 594 | __u32 namelen; | 594 | __u32 namelen; |
| 595 | __u32 type; | 595 | __u32 type; |
| 596 | char name[0]; | 596 | char name[]; |
| 597 | }; | 597 | }; |
| 598 | 598 | ||
| 599 | #define FUSE_NAME_OFFSET offsetof(struct fuse_dirent, name) | 599 | #define FUSE_NAME_OFFSET offsetof(struct fuse_dirent, name) |
diff --git a/include/linux/gpio-pxa.h b/include/linux/gpio-pxa.h index 05071ee34c3f..d755b28ba635 100644 --- a/include/linux/gpio-pxa.h +++ b/include/linux/gpio-pxa.h | |||
| @@ -13,4 +13,8 @@ extern int pxa_last_gpio; | |||
| 13 | 13 | ||
| 14 | extern int pxa_irq_to_gpio(int irq); | 14 | extern int pxa_irq_to_gpio(int irq); |
| 15 | 15 | ||
| 16 | struct pxa_gpio_platform_data { | ||
| 17 | int (*gpio_set_wake)(unsigned int gpio, unsigned int on); | ||
| 18 | }; | ||
| 19 | |||
| 16 | #endif /* __GPIO_PXA_H */ | 20 | #endif /* __GPIO_PXA_H */ |
diff --git a/include/linux/hsi/hsi.h b/include/linux/hsi/hsi.h index 4b178067f405..56fae865e272 100644 --- a/include/linux/hsi/hsi.h +++ b/include/linux/hsi/hsi.h | |||
| @@ -26,9 +26,9 @@ | |||
| 26 | #include <linux/device.h> | 26 | #include <linux/device.h> |
| 27 | #include <linux/mutex.h> | 27 | #include <linux/mutex.h> |
| 28 | #include <linux/scatterlist.h> | 28 | #include <linux/scatterlist.h> |
| 29 | #include <linux/spinlock.h> | ||
| 30 | #include <linux/list.h> | 29 | #include <linux/list.h> |
| 31 | #include <linux/module.h> | 30 | #include <linux/module.h> |
| 31 | #include <linux/notifier.h> | ||
| 32 | 32 | ||
| 33 | /* HSI message ttype */ | 33 | /* HSI message ttype */ |
| 34 | #define HSI_MSG_READ 0 | 34 | #define HSI_MSG_READ 0 |
| @@ -121,18 +121,18 @@ static inline int hsi_register_board_info(struct hsi_board_info const *info, | |||
| 121 | * @device: Driver model representation of the device | 121 | * @device: Driver model representation of the device |
| 122 | * @tx_cfg: HSI TX configuration | 122 | * @tx_cfg: HSI TX configuration |
| 123 | * @rx_cfg: HSI RX configuration | 123 | * @rx_cfg: HSI RX configuration |
| 124 | * @hsi_start_rx: Called after incoming wake line goes high | 124 | * @e_handler: Callback for handling port events (RX Wake High/Low) |
| 125 | * @hsi_stop_rx: Called after incoming wake line goes low | 125 | * @pclaimed: Keeps tracks if the clients claimed its associated HSI port |
| 126 | * @nb: Notifier block for port events | ||
| 126 | */ | 127 | */ |
| 127 | struct hsi_client { | 128 | struct hsi_client { |
| 128 | struct device device; | 129 | struct device device; |
| 129 | struct hsi_config tx_cfg; | 130 | struct hsi_config tx_cfg; |
| 130 | struct hsi_config rx_cfg; | 131 | struct hsi_config rx_cfg; |
| 131 | void (*hsi_start_rx)(struct hsi_client *cl); | ||
| 132 | void (*hsi_stop_rx)(struct hsi_client *cl); | ||
| 133 | /* private: */ | 132 | /* private: */ |
| 133 | void (*ehandler)(struct hsi_client *, unsigned long); | ||
| 134 | unsigned int pclaimed:1; | 134 | unsigned int pclaimed:1; |
| 135 | struct list_head link; | 135 | struct notifier_block nb; |
| 136 | }; | 136 | }; |
| 137 | 137 | ||
| 138 | #define to_hsi_client(dev) container_of(dev, struct hsi_client, device) | 138 | #define to_hsi_client(dev) container_of(dev, struct hsi_client, device) |
| @@ -147,6 +147,10 @@ static inline void *hsi_client_drvdata(struct hsi_client *cl) | |||
| 147 | return dev_get_drvdata(&cl->device); | 147 | return dev_get_drvdata(&cl->device); |
| 148 | } | 148 | } |
| 149 | 149 | ||
| 150 | int hsi_register_port_event(struct hsi_client *cl, | ||
| 151 | void (*handler)(struct hsi_client *, unsigned long)); | ||
| 152 | int hsi_unregister_port_event(struct hsi_client *cl); | ||
| 153 | |||
| 150 | /** | 154 | /** |
| 151 | * struct hsi_client_driver - Driver associated to an HSI client | 155 | * struct hsi_client_driver - Driver associated to an HSI client |
| 152 | * @driver: Driver model representation of the driver | 156 | * @driver: Driver model representation of the driver |
| @@ -214,8 +218,7 @@ void hsi_free_msg(struct hsi_msg *msg); | |||
| 214 | * @start_tx: Callback to inform that a client wants to TX data | 218 | * @start_tx: Callback to inform that a client wants to TX data |
| 215 | * @stop_tx: Callback to inform that a client no longer wishes to TX data | 219 | * @stop_tx: Callback to inform that a client no longer wishes to TX data |
| 216 | * @release: Callback to inform that a client no longer uses the port | 220 | * @release: Callback to inform that a client no longer uses the port |
| 217 | * @clients: List of hsi_clients using the port. | 221 | * @n_head: Notifier chain for signaling port events to the clients. |
| 218 | * @clock: Lock to serialize access to the clients list. | ||
| 219 | */ | 222 | */ |
| 220 | struct hsi_port { | 223 | struct hsi_port { |
| 221 | struct device device; | 224 | struct device device; |
| @@ -231,14 +234,14 @@ struct hsi_port { | |||
| 231 | int (*start_tx)(struct hsi_client *cl); | 234 | int (*start_tx)(struct hsi_client *cl); |
| 232 | int (*stop_tx)(struct hsi_client *cl); | 235 | int (*stop_tx)(struct hsi_client *cl); |
| 233 | int (*release)(struct hsi_client *cl); | 236 | int (*release)(struct hsi_client *cl); |
| 234 | struct list_head clients; | 237 | /* private */ |
| 235 | spinlock_t clock; | 238 | struct atomic_notifier_head n_head; |
| 236 | }; | 239 | }; |
| 237 | 240 | ||
| 238 | #define to_hsi_port(dev) container_of(dev, struct hsi_port, device) | 241 | #define to_hsi_port(dev) container_of(dev, struct hsi_port, device) |
| 239 | #define hsi_get_port(cl) to_hsi_port((cl)->device.parent) | 242 | #define hsi_get_port(cl) to_hsi_port((cl)->device.parent) |
| 240 | 243 | ||
| 241 | void hsi_event(struct hsi_port *port, unsigned int event); | 244 | int hsi_event(struct hsi_port *port, unsigned long event); |
| 242 | int hsi_claim_port(struct hsi_client *cl, unsigned int share); | 245 | int hsi_claim_port(struct hsi_client *cl, unsigned int share); |
| 243 | void hsi_release_port(struct hsi_client *cl); | 246 | void hsi_release_port(struct hsi_client *cl); |
| 244 | 247 | ||
| @@ -270,13 +273,13 @@ struct hsi_controller { | |||
| 270 | struct module *owner; | 273 | struct module *owner; |
| 271 | unsigned int id; | 274 | unsigned int id; |
| 272 | unsigned int num_ports; | 275 | unsigned int num_ports; |
| 273 | struct hsi_port *port; | 276 | struct hsi_port **port; |
| 274 | }; | 277 | }; |
| 275 | 278 | ||
| 276 | #define to_hsi_controller(dev) container_of(dev, struct hsi_controller, device) | 279 | #define to_hsi_controller(dev) container_of(dev, struct hsi_controller, device) |
| 277 | 280 | ||
| 278 | struct hsi_controller *hsi_alloc_controller(unsigned int n_ports, gfp_t flags); | 281 | struct hsi_controller *hsi_alloc_controller(unsigned int n_ports, gfp_t flags); |
| 279 | void hsi_free_controller(struct hsi_controller *hsi); | 282 | void hsi_put_controller(struct hsi_controller *hsi); |
| 280 | int hsi_register_controller(struct hsi_controller *hsi); | 283 | int hsi_register_controller(struct hsi_controller *hsi); |
| 281 | void hsi_unregister_controller(struct hsi_controller *hsi); | 284 | void hsi_unregister_controller(struct hsi_controller *hsi); |
| 282 | 285 | ||
| @@ -294,7 +297,7 @@ static inline void *hsi_controller_drvdata(struct hsi_controller *hsi) | |||
| 294 | static inline struct hsi_port *hsi_find_port_num(struct hsi_controller *hsi, | 297 | static inline struct hsi_port *hsi_find_port_num(struct hsi_controller *hsi, |
| 295 | unsigned int num) | 298 | unsigned int num) |
| 296 | { | 299 | { |
| 297 | return (num < hsi->num_ports) ? &hsi->port[num] : NULL; | 300 | return (num < hsi->num_ports) ? hsi->port[num] : NULL; |
| 298 | } | 301 | } |
| 299 | 302 | ||
| 300 | /* | 303 | /* |
diff --git a/include/linux/i2c/twl.h b/include/linux/i2c/twl.h index 2463b6100333..1f90de0cfdbe 100644 --- a/include/linux/i2c/twl.h +++ b/include/linux/i2c/twl.h | |||
| @@ -666,23 +666,11 @@ struct twl4030_codec_data { | |||
| 666 | unsigned int check_defaults:1; | 666 | unsigned int check_defaults:1; |
| 667 | unsigned int reset_registers:1; | 667 | unsigned int reset_registers:1; |
| 668 | unsigned int hs_extmute:1; | 668 | unsigned int hs_extmute:1; |
| 669 | u16 hs_left_step; | ||
| 670 | u16 hs_right_step; | ||
| 671 | u16 hf_left_step; | ||
| 672 | u16 hf_right_step; | ||
| 673 | void (*set_hs_extmute)(int mute); | 669 | void (*set_hs_extmute)(int mute); |
| 674 | }; | 670 | }; |
| 675 | 671 | ||
| 676 | struct twl4030_vibra_data { | 672 | struct twl4030_vibra_data { |
| 677 | unsigned int coexist; | 673 | unsigned int coexist; |
| 678 | |||
| 679 | /* twl6040 */ | ||
| 680 | unsigned int vibldrv_res; /* left driver resistance */ | ||
| 681 | unsigned int vibrdrv_res; /* right driver resistance */ | ||
| 682 | unsigned int viblmotor_res; /* left motor resistance */ | ||
| 683 | unsigned int vibrmotor_res; /* right motor resistance */ | ||
| 684 | int vddvibl_uV; /* VDDVIBL volt, set 0 for fixed reg */ | ||
| 685 | int vddvibr_uV; /* VDDVIBR volt, set 0 for fixed reg */ | ||
| 686 | }; | 674 | }; |
| 687 | 675 | ||
| 688 | struct twl4030_audio_data { | 676 | struct twl4030_audio_data { |
diff --git a/include/linux/irq.h b/include/linux/irq.h index 7810406f3d80..b27cfcfd3a59 100644 --- a/include/linux/irq.h +++ b/include/linux/irq.h | |||
| @@ -49,6 +49,12 @@ typedef void (*irq_preflow_handler_t)(struct irq_data *data); | |||
| 49 | * IRQ_TYPE_LEVEL_LOW - low level triggered | 49 | * IRQ_TYPE_LEVEL_LOW - low level triggered |
| 50 | * IRQ_TYPE_LEVEL_MASK - Mask to filter out the level bits | 50 | * IRQ_TYPE_LEVEL_MASK - Mask to filter out the level bits |
| 51 | * IRQ_TYPE_SENSE_MASK - Mask for all the above bits | 51 | * IRQ_TYPE_SENSE_MASK - Mask for all the above bits |
| 52 | * IRQ_TYPE_DEFAULT - For use by some PICs to ask irq_set_type | ||
| 53 | * to setup the HW to a sane default (used | ||
| 54 | * by irqdomain map() callbacks to synchronize | ||
| 55 | * the HW state and SW flags for a newly | ||
| 56 | * allocated descriptor). | ||
| 57 | * | ||
| 52 | * IRQ_TYPE_PROBE - Special flag for probing in progress | 58 | * IRQ_TYPE_PROBE - Special flag for probing in progress |
| 53 | * | 59 | * |
| 54 | * Bits which can be modified via irq_set/clear/modify_status_flags() | 60 | * Bits which can be modified via irq_set/clear/modify_status_flags() |
| @@ -77,6 +83,7 @@ enum { | |||
| 77 | IRQ_TYPE_LEVEL_LOW = 0x00000008, | 83 | IRQ_TYPE_LEVEL_LOW = 0x00000008, |
| 78 | IRQ_TYPE_LEVEL_MASK = (IRQ_TYPE_LEVEL_LOW | IRQ_TYPE_LEVEL_HIGH), | 84 | IRQ_TYPE_LEVEL_MASK = (IRQ_TYPE_LEVEL_LOW | IRQ_TYPE_LEVEL_HIGH), |
| 79 | IRQ_TYPE_SENSE_MASK = 0x0000000f, | 85 | IRQ_TYPE_SENSE_MASK = 0x0000000f, |
| 86 | IRQ_TYPE_DEFAULT = IRQ_TYPE_SENSE_MASK, | ||
| 80 | 87 | ||
| 81 | IRQ_TYPE_PROBE = 0x00000010, | 88 | IRQ_TYPE_PROBE = 0x00000010, |
| 82 | 89 | ||
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h index 665a260c7e09..72cbf08d45fb 100644 --- a/include/linux/kvm_host.h +++ b/include/linux/kvm_host.h | |||
| @@ -596,6 +596,7 @@ void kvm_free_irq_source_id(struct kvm *kvm, int irq_source_id); | |||
| 596 | 596 | ||
| 597 | #ifdef CONFIG_IOMMU_API | 597 | #ifdef CONFIG_IOMMU_API |
| 598 | int kvm_iommu_map_pages(struct kvm *kvm, struct kvm_memory_slot *slot); | 598 | int kvm_iommu_map_pages(struct kvm *kvm, struct kvm_memory_slot *slot); |
| 599 | void kvm_iommu_unmap_pages(struct kvm *kvm, struct kvm_memory_slot *slot); | ||
| 599 | int kvm_iommu_map_guest(struct kvm *kvm); | 600 | int kvm_iommu_map_guest(struct kvm *kvm); |
| 600 | int kvm_iommu_unmap_guest(struct kvm *kvm); | 601 | int kvm_iommu_unmap_guest(struct kvm *kvm); |
| 601 | int kvm_assign_device(struct kvm *kvm, | 602 | int kvm_assign_device(struct kvm *kvm, |
| @@ -609,6 +610,11 @@ static inline int kvm_iommu_map_pages(struct kvm *kvm, | |||
| 609 | return 0; | 610 | return 0; |
| 610 | } | 611 | } |
| 611 | 612 | ||
| 613 | static inline void kvm_iommu_unmap_pages(struct kvm *kvm, | ||
| 614 | struct kvm_memory_slot *slot) | ||
| 615 | { | ||
| 616 | } | ||
| 617 | |||
| 612 | static inline int kvm_iommu_map_guest(struct kvm *kvm) | 618 | static inline int kvm_iommu_map_guest(struct kvm *kvm) |
| 613 | { | 619 | { |
| 614 | return -ENODEV; | 620 | return -ENODEV; |
diff --git a/include/linux/libata.h b/include/linux/libata.h index 42378d637ffb..e926df7b54c9 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h | |||
| @@ -996,7 +996,8 @@ extern int ata_sas_scsi_ioctl(struct ata_port *ap, struct scsi_device *dev, | |||
| 996 | extern void ata_sas_port_destroy(struct ata_port *); | 996 | extern void ata_sas_port_destroy(struct ata_port *); |
| 997 | extern struct ata_port *ata_sas_port_alloc(struct ata_host *, | 997 | extern struct ata_port *ata_sas_port_alloc(struct ata_host *, |
| 998 | struct ata_port_info *, struct Scsi_Host *); | 998 | struct ata_port_info *, struct Scsi_Host *); |
| 999 | extern int ata_sas_async_port_init(struct ata_port *); | 999 | extern void ata_sas_async_probe(struct ata_port *ap); |
| 1000 | extern int ata_sas_sync_probe(struct ata_port *ap); | ||
| 1000 | extern int ata_sas_port_init(struct ata_port *); | 1001 | extern int ata_sas_port_init(struct ata_port *); |
| 1001 | extern int ata_sas_port_start(struct ata_port *ap); | 1002 | extern int ata_sas_port_start(struct ata_port *ap); |
| 1002 | extern void ata_sas_port_stop(struct ata_port *ap); | 1003 | extern void ata_sas_port_stop(struct ata_port *ap); |
diff --git a/include/linux/mfd/db5500-prcmu.h b/include/linux/mfd/db5500-prcmu.h index 9890687f582d..5a049dfaf153 100644 --- a/include/linux/mfd/db5500-prcmu.h +++ b/include/linux/mfd/db5500-prcmu.h | |||
| @@ -8,41 +8,14 @@ | |||
| 8 | #ifndef __MFD_DB5500_PRCMU_H | 8 | #ifndef __MFD_DB5500_PRCMU_H |
| 9 | #define __MFD_DB5500_PRCMU_H | 9 | #define __MFD_DB5500_PRCMU_H |
| 10 | 10 | ||
| 11 | #ifdef CONFIG_MFD_DB5500_PRCMU | 11 | static inline int prcmu_resetout(u8 resoutn, u8 state) |
| 12 | |||
| 13 | void db5500_prcmu_early_init(void); | ||
| 14 | int db5500_prcmu_set_epod(u16 epod_id, u8 epod_state); | ||
| 15 | int db5500_prcmu_set_display_clocks(void); | ||
| 16 | int db5500_prcmu_disable_dsipll(void); | ||
| 17 | int db5500_prcmu_enable_dsipll(void); | ||
| 18 | int db5500_prcmu_abb_read(u8 slave, u8 reg, u8 *value, u8 size); | ||
| 19 | int db5500_prcmu_abb_write(u8 slave, u8 reg, u8 *value, u8 size); | ||
| 20 | void db5500_prcmu_enable_wakeups(u32 wakeups); | ||
| 21 | int db5500_prcmu_request_clock(u8 clock, bool enable); | ||
| 22 | void db5500_prcmu_config_abb_event_readout(u32 abb_events); | ||
| 23 | void db5500_prcmu_get_abb_event_buffer(void __iomem **buf); | ||
| 24 | int prcmu_resetout(u8 resoutn, u8 state); | ||
| 25 | int db5500_prcmu_set_power_state(u8 state, bool keep_ulp_clk, | ||
| 26 | bool keep_ap_pll); | ||
| 27 | int db5500_prcmu_config_esram0_deep_sleep(u8 state); | ||
| 28 | void db5500_prcmu_system_reset(u16 reset_code); | ||
| 29 | u16 db5500_prcmu_get_reset_code(void); | ||
| 30 | bool db5500_prcmu_is_ac_wake_requested(void); | ||
| 31 | int db5500_prcmu_set_arm_opp(u8 opp); | ||
| 32 | int db5500_prcmu_get_arm_opp(void); | ||
| 33 | |||
| 34 | #else /* !CONFIG_UX500_SOC_DB5500 */ | ||
| 35 | |||
| 36 | static inline void db5500_prcmu_early_init(void) {} | ||
| 37 | |||
| 38 | static inline int db5500_prcmu_abb_read(u8 slave, u8 reg, u8 *value, u8 size) | ||
| 39 | { | 12 | { |
| 40 | return -ENOSYS; | 13 | return 0; |
| 41 | } | 14 | } |
| 42 | 15 | ||
| 43 | static inline int db5500_prcmu_abb_write(u8 slave, u8 reg, u8 *value, u8 size) | 16 | static inline int db5500_prcmu_set_epod(u16 epod_id, u8 epod_state) |
| 44 | { | 17 | { |
| 45 | return -ENOSYS; | 18 | return 0; |
| 46 | } | 19 | } |
| 47 | 20 | ||
| 48 | static inline int db5500_prcmu_request_clock(u8 clock, bool enable) | 21 | static inline int db5500_prcmu_request_clock(u8 clock, bool enable) |
| @@ -50,69 +23,82 @@ static inline int db5500_prcmu_request_clock(u8 clock, bool enable) | |||
| 50 | return 0; | 23 | return 0; |
| 51 | } | 24 | } |
| 52 | 25 | ||
| 53 | static inline int db5500_prcmu_set_display_clocks(void) | 26 | static inline int db5500_prcmu_set_power_state(u8 state, bool keep_ulp_clk, |
| 27 | bool keep_ap_pll) | ||
| 54 | { | 28 | { |
| 55 | return 0; | 29 | return 0; |
| 56 | } | 30 | } |
| 57 | 31 | ||
| 58 | static inline int db5500_prcmu_disable_dsipll(void) | 32 | static inline int db5500_prcmu_config_esram0_deep_sleep(u8 state) |
| 59 | { | 33 | { |
| 60 | return 0; | 34 | return 0; |
| 61 | } | 35 | } |
| 62 | 36 | ||
| 63 | static inline int db5500_prcmu_enable_dsipll(void) | 37 | static inline u16 db5500_prcmu_get_reset_code(void) |
| 64 | { | 38 | { |
| 65 | return 0; | 39 | return 0; |
| 66 | } | 40 | } |
| 67 | 41 | ||
| 68 | static inline int db5500_prcmu_config_esram0_deep_sleep(u8 state) | 42 | static inline bool db5500_prcmu_is_ac_wake_requested(void) |
| 69 | { | 43 | { |
| 70 | return 0; | 44 | return 0; |
| 71 | } | 45 | } |
| 72 | 46 | ||
| 73 | static inline void db5500_prcmu_enable_wakeups(u32 wakeups) {} | 47 | static inline int db5500_prcmu_set_arm_opp(u8 opp) |
| 74 | |||
| 75 | static inline int prcmu_resetout(u8 resoutn, u8 state) | ||
| 76 | { | 48 | { |
| 77 | return 0; | 49 | return 0; |
| 78 | } | 50 | } |
| 79 | 51 | ||
| 80 | static inline int db5500_prcmu_set_epod(u16 epod_id, u8 epod_state) | 52 | static inline int db5500_prcmu_get_arm_opp(void) |
| 81 | { | 53 | { |
| 82 | return 0; | 54 | return 0; |
| 83 | } | 55 | } |
| 84 | 56 | ||
| 85 | static inline void db5500_prcmu_get_abb_event_buffer(void __iomem **buf) {} | ||
| 86 | static inline void db5500_prcmu_config_abb_event_readout(u32 abb_events) {} | 57 | static inline void db5500_prcmu_config_abb_event_readout(u32 abb_events) {} |
| 87 | 58 | ||
| 88 | static inline int db5500_prcmu_set_power_state(u8 state, bool keep_ulp_clk, | 59 | static inline void db5500_prcmu_get_abb_event_buffer(void __iomem **buf) {} |
| 89 | bool keep_ap_pll) | ||
| 90 | { | ||
| 91 | return 0; | ||
| 92 | } | ||
| 93 | 60 | ||
| 94 | static inline void db5500_prcmu_system_reset(u16 reset_code) {} | 61 | static inline void db5500_prcmu_system_reset(u16 reset_code) {} |
| 95 | 62 | ||
| 96 | static inline u16 db5500_prcmu_get_reset_code(void) | 63 | static inline void db5500_prcmu_enable_wakeups(u32 wakeups) {} |
| 64 | |||
| 65 | #ifdef CONFIG_MFD_DB5500_PRCMU | ||
| 66 | |||
| 67 | void db5500_prcmu_early_init(void); | ||
| 68 | int db5500_prcmu_set_display_clocks(void); | ||
| 69 | int db5500_prcmu_disable_dsipll(void); | ||
| 70 | int db5500_prcmu_enable_dsipll(void); | ||
| 71 | int db5500_prcmu_abb_read(u8 slave, u8 reg, u8 *value, u8 size); | ||
| 72 | int db5500_prcmu_abb_write(u8 slave, u8 reg, u8 *value, u8 size); | ||
| 73 | |||
| 74 | #else /* !CONFIG_UX500_SOC_DB5500 */ | ||
| 75 | |||
| 76 | static inline void db5500_prcmu_early_init(void) {} | ||
| 77 | |||
| 78 | static inline int db5500_prcmu_abb_read(u8 slave, u8 reg, u8 *value, u8 size) | ||
| 97 | { | 79 | { |
| 98 | return 0; | 80 | return -ENOSYS; |
| 99 | } | 81 | } |
| 100 | 82 | ||
| 101 | static inline bool db5500_prcmu_is_ac_wake_requested(void) | 83 | static inline int db5500_prcmu_abb_write(u8 slave, u8 reg, u8 *value, u8 size) |
| 102 | { | 84 | { |
| 103 | return 0; | 85 | return -ENOSYS; |
| 104 | } | 86 | } |
| 105 | 87 | ||
| 106 | static inline int db5500_prcmu_set_arm_opp(u8 opp) | 88 | static inline int db5500_prcmu_set_display_clocks(void) |
| 107 | { | 89 | { |
| 108 | return 0; | 90 | return 0; |
| 109 | } | 91 | } |
| 110 | 92 | ||
| 111 | static inline int db5500_prcmu_get_arm_opp(void) | 93 | static inline int db5500_prcmu_disable_dsipll(void) |
| 112 | { | 94 | { |
| 113 | return 0; | 95 | return 0; |
| 114 | } | 96 | } |
| 115 | 97 | ||
| 98 | static inline int db5500_prcmu_enable_dsipll(void) | ||
| 99 | { | ||
| 100 | return 0; | ||
| 101 | } | ||
| 116 | 102 | ||
| 117 | #endif /* CONFIG_MFD_DB5500_PRCMU */ | 103 | #endif /* CONFIG_MFD_DB5500_PRCMU */ |
| 118 | 104 | ||
diff --git a/include/linux/mfd/rc5t583.h b/include/linux/mfd/rc5t583.h index a2c61609d21d..0b64b19d81ab 100644 --- a/include/linux/mfd/rc5t583.h +++ b/include/linux/mfd/rc5t583.h | |||
| @@ -26,6 +26,7 @@ | |||
| 26 | 26 | ||
| 27 | #include <linux/mutex.h> | 27 | #include <linux/mutex.h> |
| 28 | #include <linux/types.h> | 28 | #include <linux/types.h> |
| 29 | #include <linux/regmap.h> | ||
| 29 | 30 | ||
| 30 | #define RC5T583_MAX_REGS 0xF8 | 31 | #define RC5T583_MAX_REGS 0xF8 |
| 31 | 32 | ||
| @@ -279,14 +280,44 @@ struct rc5t583_platform_data { | |||
| 279 | bool enable_shutdown; | 280 | bool enable_shutdown; |
| 280 | }; | 281 | }; |
| 281 | 282 | ||
| 282 | int rc5t583_write(struct device *dev, u8 reg, uint8_t val); | 283 | static inline int rc5t583_write(struct device *dev, uint8_t reg, uint8_t val) |
| 283 | int rc5t583_read(struct device *dev, uint8_t reg, uint8_t *val); | 284 | { |
| 284 | int rc5t583_set_bits(struct device *dev, unsigned int reg, | 285 | struct rc5t583 *rc5t583 = dev_get_drvdata(dev); |
| 285 | unsigned int bit_mask); | 286 | return regmap_write(rc5t583->regmap, reg, val); |
| 286 | int rc5t583_clear_bits(struct device *dev, unsigned int reg, | 287 | } |
| 287 | unsigned int bit_mask); | 288 | |
| 288 | int rc5t583_update(struct device *dev, unsigned int reg, | 289 | static inline int rc5t583_read(struct device *dev, uint8_t reg, uint8_t *val) |
| 289 | unsigned int val, unsigned int mask); | 290 | { |
| 291 | struct rc5t583 *rc5t583 = dev_get_drvdata(dev); | ||
| 292 | unsigned int ival; | ||
| 293 | int ret; | ||
| 294 | ret = regmap_read(rc5t583->regmap, reg, &ival); | ||
| 295 | if (!ret) | ||
| 296 | *val = (uint8_t)ival; | ||
| 297 | return ret; | ||
| 298 | } | ||
| 299 | |||
| 300 | static inline int rc5t583_set_bits(struct device *dev, unsigned int reg, | ||
| 301 | unsigned int bit_mask) | ||
| 302 | { | ||
| 303 | struct rc5t583 *rc5t583 = dev_get_drvdata(dev); | ||
| 304 | return regmap_update_bits(rc5t583->regmap, reg, bit_mask, bit_mask); | ||
| 305 | } | ||
| 306 | |||
| 307 | static inline int rc5t583_clear_bits(struct device *dev, unsigned int reg, | ||
| 308 | unsigned int bit_mask) | ||
| 309 | { | ||
| 310 | struct rc5t583 *rc5t583 = dev_get_drvdata(dev); | ||
| 311 | return regmap_update_bits(rc5t583->regmap, reg, bit_mask, 0); | ||
| 312 | } | ||
| 313 | |||
| 314 | static inline int rc5t583_update(struct device *dev, unsigned int reg, | ||
| 315 | unsigned int val, unsigned int mask) | ||
| 316 | { | ||
| 317 | struct rc5t583 *rc5t583 = dev_get_drvdata(dev); | ||
| 318 | return regmap_update_bits(rc5t583->regmap, reg, mask, val); | ||
| 319 | } | ||
| 320 | |||
| 290 | int rc5t583_ext_power_req_config(struct device *dev, int deepsleep_id, | 321 | int rc5t583_ext_power_req_config(struct device *dev, int deepsleep_id, |
| 291 | int ext_pwr_req, int deepsleep_slot_nr); | 322 | int ext_pwr_req, int deepsleep_slot_nr); |
| 292 | int rc5t583_irq_init(struct rc5t583 *rc5t583, int irq, int irq_base); | 323 | int rc5t583_irq_init(struct rc5t583 *rc5t583, int irq, int irq_base); |
diff --git a/include/linux/mfd/twl6040.h b/include/linux/mfd/twl6040.h index 9bc9ac651dad..b15b5f03f5c4 100644 --- a/include/linux/mfd/twl6040.h +++ b/include/linux/mfd/twl6040.h | |||
| @@ -174,8 +174,35 @@ | |||
| 174 | #define TWL6040_SYSCLK_SEL_LPPLL 0 | 174 | #define TWL6040_SYSCLK_SEL_LPPLL 0 |
| 175 | #define TWL6040_SYSCLK_SEL_HPPLL 1 | 175 | #define TWL6040_SYSCLK_SEL_HPPLL 1 |
| 176 | 176 | ||
| 177 | struct twl6040_codec_data { | ||
| 178 | u16 hs_left_step; | ||
| 179 | u16 hs_right_step; | ||
| 180 | u16 hf_left_step; | ||
| 181 | u16 hf_right_step; | ||
| 182 | }; | ||
| 183 | |||
| 184 | struct twl6040_vibra_data { | ||
| 185 | unsigned int vibldrv_res; /* left driver resistance */ | ||
| 186 | unsigned int vibrdrv_res; /* right driver resistance */ | ||
| 187 | unsigned int viblmotor_res; /* left motor resistance */ | ||
| 188 | unsigned int vibrmotor_res; /* right motor resistance */ | ||
| 189 | int vddvibl_uV; /* VDDVIBL volt, set 0 for fixed reg */ | ||
| 190 | int vddvibr_uV; /* VDDVIBR volt, set 0 for fixed reg */ | ||
| 191 | }; | ||
| 192 | |||
| 193 | struct twl6040_platform_data { | ||
| 194 | int audpwron_gpio; /* audio power-on gpio */ | ||
| 195 | unsigned int irq_base; | ||
| 196 | |||
| 197 | struct twl6040_codec_data *codec; | ||
| 198 | struct twl6040_vibra_data *vibra; | ||
| 199 | }; | ||
| 200 | |||
| 201 | struct regmap; | ||
| 202 | |||
| 177 | struct twl6040 { | 203 | struct twl6040 { |
| 178 | struct device *dev; | 204 | struct device *dev; |
| 205 | struct regmap *regmap; | ||
| 179 | struct mutex mutex; | 206 | struct mutex mutex; |
| 180 | struct mutex io_mutex; | 207 | struct mutex io_mutex; |
| 181 | struct mutex irq_mutex; | 208 | struct mutex irq_mutex; |
diff --git a/include/linux/mm.h b/include/linux/mm.h index d8738a464b94..74aa71bea1e4 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h | |||
| @@ -1393,29 +1393,20 @@ extern int install_special_mapping(struct mm_struct *mm, | |||
| 1393 | 1393 | ||
| 1394 | extern unsigned long get_unmapped_area(struct file *, unsigned long, unsigned long, unsigned long, unsigned long); | 1394 | extern unsigned long get_unmapped_area(struct file *, unsigned long, unsigned long, unsigned long, unsigned long); |
| 1395 | 1395 | ||
| 1396 | extern unsigned long do_mmap_pgoff(struct file *file, unsigned long addr, | ||
| 1397 | unsigned long len, unsigned long prot, | ||
| 1398 | unsigned long flag, unsigned long pgoff); | ||
| 1399 | extern unsigned long mmap_region(struct file *file, unsigned long addr, | 1396 | extern unsigned long mmap_region(struct file *file, unsigned long addr, |
| 1400 | unsigned long len, unsigned long flags, | 1397 | unsigned long len, unsigned long flags, |
| 1401 | vm_flags_t vm_flags, unsigned long pgoff); | 1398 | vm_flags_t vm_flags, unsigned long pgoff); |
| 1402 | 1399 | extern unsigned long do_mmap(struct file *, unsigned long, | |
| 1403 | static inline unsigned long do_mmap(struct file *file, unsigned long addr, | 1400 | unsigned long, unsigned long, |
| 1404 | unsigned long len, unsigned long prot, | 1401 | unsigned long, unsigned long); |
| 1405 | unsigned long flag, unsigned long offset) | ||
| 1406 | { | ||
| 1407 | unsigned long ret = -EINVAL; | ||
| 1408 | if ((offset + PAGE_ALIGN(len)) < offset) | ||
| 1409 | goto out; | ||
| 1410 | if (!(offset & ~PAGE_MASK)) | ||
| 1411 | ret = do_mmap_pgoff(file, addr, len, prot, flag, offset >> PAGE_SHIFT); | ||
| 1412 | out: | ||
| 1413 | return ret; | ||
| 1414 | } | ||
| 1415 | |||
| 1416 | extern int do_munmap(struct mm_struct *, unsigned long, size_t); | 1402 | extern int do_munmap(struct mm_struct *, unsigned long, size_t); |
| 1417 | 1403 | ||
| 1418 | extern unsigned long do_brk(unsigned long, unsigned long); | 1404 | /* These take the mm semaphore themselves */ |
| 1405 | extern unsigned long vm_brk(unsigned long, unsigned long); | ||
| 1406 | extern int vm_munmap(unsigned long, size_t); | ||
| 1407 | extern unsigned long vm_mmap(struct file *, unsigned long, | ||
| 1408 | unsigned long, unsigned long, | ||
| 1409 | unsigned long, unsigned long); | ||
| 1419 | 1410 | ||
| 1420 | /* truncate.c */ | 1411 | /* truncate.c */ |
| 1421 | extern void truncate_inode_pages(struct address_space *, loff_t); | 1412 | extern void truncate_inode_pages(struct address_space *, loff_t); |
diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h index 01beae78f079..629b823f8836 100644 --- a/include/linux/mmc/card.h +++ b/include/linux/mmc/card.h | |||
| @@ -481,7 +481,7 @@ struct mmc_driver { | |||
| 481 | struct device_driver drv; | 481 | struct device_driver drv; |
| 482 | int (*probe)(struct mmc_card *); | 482 | int (*probe)(struct mmc_card *); |
| 483 | void (*remove)(struct mmc_card *); | 483 | void (*remove)(struct mmc_card *); |
| 484 | int (*suspend)(struct mmc_card *, pm_message_t); | 484 | int (*suspend)(struct mmc_card *); |
| 485 | int (*resume)(struct mmc_card *); | 485 | int (*resume)(struct mmc_card *); |
| 486 | }; | 486 | }; |
| 487 | 487 | ||
diff --git a/include/linux/netfilter_bridge.h b/include/linux/netfilter_bridge.h index 0ddd161f3b06..31d2844e6572 100644 --- a/include/linux/netfilter_bridge.h +++ b/include/linux/netfilter_bridge.h | |||
| @@ -104,9 +104,18 @@ struct bridge_skb_cb { | |||
| 104 | } daddr; | 104 | } daddr; |
| 105 | }; | 105 | }; |
| 106 | 106 | ||
| 107 | static inline void br_drop_fake_rtable(struct sk_buff *skb) | ||
| 108 | { | ||
| 109 | struct dst_entry *dst = skb_dst(skb); | ||
| 110 | |||
| 111 | if (dst && (dst->flags & DST_FAKE_RTABLE)) | ||
| 112 | skb_dst_drop(skb); | ||
| 113 | } | ||
| 114 | |||
| 107 | #else | 115 | #else |
| 108 | #define nf_bridge_maybe_copy_header(skb) (0) | 116 | #define nf_bridge_maybe_copy_header(skb) (0) |
| 109 | #define nf_bridge_pad(skb) (0) | 117 | #define nf_bridge_pad(skb) (0) |
| 118 | #define br_drop_fake_rtable(skb) do { } while (0) | ||
| 110 | #endif /* CONFIG_BRIDGE_NETFILTER */ | 119 | #endif /* CONFIG_BRIDGE_NETFILTER */ |
| 111 | 120 | ||
| 112 | #endif /* __KERNEL__ */ | 121 | #endif /* __KERNEL__ */ |
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h index bfd0d1bf6707..7ba3551a0414 100644 --- a/include/linux/nfs_xdr.h +++ b/include/linux/nfs_xdr.h | |||
| @@ -312,6 +312,11 @@ struct nfs4_layoutreturn { | |||
| 312 | int rpc_status; | 312 | int rpc_status; |
| 313 | }; | 313 | }; |
| 314 | 314 | ||
| 315 | struct stateowner_id { | ||
| 316 | __u64 create_time; | ||
| 317 | __u32 uniquifier; | ||
| 318 | }; | ||
| 319 | |||
| 315 | /* | 320 | /* |
| 316 | * Arguments to the open call. | 321 | * Arguments to the open call. |
| 317 | */ | 322 | */ |
| @@ -321,7 +326,7 @@ struct nfs_openargs { | |||
| 321 | int open_flags; | 326 | int open_flags; |
| 322 | fmode_t fmode; | 327 | fmode_t fmode; |
| 323 | __u64 clientid; | 328 | __u64 clientid; |
| 324 | __u64 id; | 329 | struct stateowner_id id; |
| 325 | union { | 330 | union { |
| 326 | struct { | 331 | struct { |
| 327 | struct iattr * attrs; /* UNCHECKED, GUARDED */ | 332 | struct iattr * attrs; /* UNCHECKED, GUARDED */ |
diff --git a/include/linux/nfsd/Kbuild b/include/linux/nfsd/Kbuild index b8d4001212b3..5b7d84ac954a 100644 --- a/include/linux/nfsd/Kbuild +++ b/include/linux/nfsd/Kbuild | |||
| @@ -1,3 +1,4 @@ | |||
| 1 | header-y += cld.h | ||
| 1 | header-y += debug.h | 2 | header-y += debug.h |
| 2 | header-y += export.h | 3 | header-y += export.h |
| 3 | header-y += nfsfh.h | 4 | header-y += nfsfh.h |
diff --git a/include/linux/pinctrl/machine.h b/include/linux/pinctrl/machine.h index fee4349364f7..e4d1de742502 100644 --- a/include/linux/pinctrl/machine.h +++ b/include/linux/pinctrl/machine.h | |||
| @@ -12,6 +12,8 @@ | |||
| 12 | #ifndef __LINUX_PINCTRL_MACHINE_H | 12 | #ifndef __LINUX_PINCTRL_MACHINE_H |
| 13 | #define __LINUX_PINCTRL_MACHINE_H | 13 | #define __LINUX_PINCTRL_MACHINE_H |
| 14 | 14 | ||
| 15 | #include <linux/bug.h> | ||
| 16 | |||
| 15 | #include "pinctrl-state.h" | 17 | #include "pinctrl-state.h" |
| 16 | 18 | ||
| 17 | enum pinctrl_map_type { | 19 | enum pinctrl_map_type { |
| @@ -148,7 +150,7 @@ struct pinctrl_map { | |||
| 148 | #define PIN_MAP_CONFIGS_GROUP_HOG_DEFAULT(dev, grp, cfgs) \ | 150 | #define PIN_MAP_CONFIGS_GROUP_HOG_DEFAULT(dev, grp, cfgs) \ |
| 149 | PIN_MAP_CONFIGS_GROUP(dev, PINCTRL_STATE_DEFAULT, dev, grp, cfgs) | 151 | PIN_MAP_CONFIGS_GROUP(dev, PINCTRL_STATE_DEFAULT, dev, grp, cfgs) |
| 150 | 152 | ||
| 151 | #ifdef CONFIG_PINMUX | 153 | #ifdef CONFIG_PINCTRL |
| 152 | 154 | ||
| 153 | extern int pinctrl_register_mappings(struct pinctrl_map const *map, | 155 | extern int pinctrl_register_mappings(struct pinctrl_map const *map, |
| 154 | unsigned num_maps); | 156 | unsigned num_maps); |
diff --git a/include/linux/pipe_fs_i.h b/include/linux/pipe_fs_i.h index 6d626ff0cfd0..e1ac1ce16fb0 100644 --- a/include/linux/pipe_fs_i.h +++ b/include/linux/pipe_fs_i.h | |||
| @@ -6,6 +6,7 @@ | |||
| 6 | #define PIPE_BUF_FLAG_LRU 0x01 /* page is on the LRU */ | 6 | #define PIPE_BUF_FLAG_LRU 0x01 /* page is on the LRU */ |
| 7 | #define PIPE_BUF_FLAG_ATOMIC 0x02 /* was atomically mapped */ | 7 | #define PIPE_BUF_FLAG_ATOMIC 0x02 /* was atomically mapped */ |
| 8 | #define PIPE_BUF_FLAG_GIFT 0x04 /* page is a gift */ | 8 | #define PIPE_BUF_FLAG_GIFT 0x04 /* page is a gift */ |
| 9 | #define PIPE_BUF_FLAG_PACKET 0x08 /* read() as a packet */ | ||
| 9 | 10 | ||
| 10 | /** | 11 | /** |
| 11 | * struct pipe_buffer - a linux kernel pipe buffer | 12 | * struct pipe_buffer - a linux kernel pipe buffer |
diff --git a/include/linux/seqlock.h b/include/linux/seqlock.h index c6db9fb33c44..600060e25ec6 100644 --- a/include/linux/seqlock.h +++ b/include/linux/seqlock.h | |||
| @@ -141,7 +141,7 @@ static inline unsigned __read_seqcount_begin(const seqcount_t *s) | |||
| 141 | unsigned ret; | 141 | unsigned ret; |
| 142 | 142 | ||
| 143 | repeat: | 143 | repeat: |
| 144 | ret = s->sequence; | 144 | ret = ACCESS_ONCE(s->sequence); |
| 145 | if (unlikely(ret & 1)) { | 145 | if (unlikely(ret & 1)) { |
| 146 | cpu_relax(); | 146 | cpu_relax(); |
| 147 | goto repeat; | 147 | goto repeat; |
| @@ -166,6 +166,27 @@ static inline unsigned read_seqcount_begin(const seqcount_t *s) | |||
| 166 | } | 166 | } |
| 167 | 167 | ||
| 168 | /** | 168 | /** |
| 169 | * raw_seqcount_begin - begin a seq-read critical section | ||
| 170 | * @s: pointer to seqcount_t | ||
| 171 | * Returns: count to be passed to read_seqcount_retry | ||
| 172 | * | ||
| 173 | * raw_seqcount_begin opens a read critical section of the given seqcount. | ||
| 174 | * Validity of the critical section is tested by checking read_seqcount_retry | ||
| 175 | * function. | ||
| 176 | * | ||
| 177 | * Unlike read_seqcount_begin(), this function will not wait for the count | ||
| 178 | * to stabilize. If a writer is active when we begin, we will fail the | ||
| 179 | * read_seqcount_retry() instead of stabilizing at the beginning of the | ||
| 180 | * critical section. | ||
| 181 | */ | ||
| 182 | static inline unsigned raw_seqcount_begin(const seqcount_t *s) | ||
| 183 | { | ||
| 184 | unsigned ret = ACCESS_ONCE(s->sequence); | ||
| 185 | smp_rmb(); | ||
| 186 | return ret & ~1; | ||
| 187 | } | ||
| 188 | |||
| 189 | /** | ||
| 169 | * __read_seqcount_retry - end a seq-read critical section (without barrier) | 190 | * __read_seqcount_retry - end a seq-read critical section (without barrier) |
| 170 | * @s: pointer to seqcount_t | 191 | * @s: pointer to seqcount_t |
| 171 | * @start: count, from read_seqcount_begin | 192 | * @start: count, from read_seqcount_begin |
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index 70a3f8d49118..111f26b6e28b 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h | |||
| @@ -238,11 +238,12 @@ enum { | |||
| 238 | /* | 238 | /* |
| 239 | * The callback notifies userspace to release buffers when skb DMA is done in | 239 | * The callback notifies userspace to release buffers when skb DMA is done in |
| 240 | * lower device, the skb last reference should be 0 when calling this. | 240 | * lower device, the skb last reference should be 0 when calling this. |
| 241 | * The desc is used to track userspace buffer index. | 241 | * The ctx field is used to track device context. |
| 242 | * The desc field is used to track userspace buffer index. | ||
| 242 | */ | 243 | */ |
| 243 | struct ubuf_info { | 244 | struct ubuf_info { |
| 244 | void (*callback)(void *); | 245 | void (*callback)(struct ubuf_info *); |
| 245 | void *arg; | 246 | void *ctx; |
| 246 | unsigned long desc; | 247 | unsigned long desc; |
| 247 | }; | 248 | }; |
| 248 | 249 | ||
| @@ -1019,7 +1020,7 @@ static inline void skb_queue_splice(const struct sk_buff_head *list, | |||
| 1019 | } | 1020 | } |
| 1020 | 1021 | ||
| 1021 | /** | 1022 | /** |
| 1022 | * skb_queue_splice - join two skb lists and reinitialise the emptied list | 1023 | * skb_queue_splice_init - join two skb lists and reinitialise the emptied list |
| 1023 | * @list: the new list to add | 1024 | * @list: the new list to add |
| 1024 | * @head: the place to add it in the first list | 1025 | * @head: the place to add it in the first list |
| 1025 | * | 1026 | * |
| @@ -1050,7 +1051,7 @@ static inline void skb_queue_splice_tail(const struct sk_buff_head *list, | |||
| 1050 | } | 1051 | } |
| 1051 | 1052 | ||
| 1052 | /** | 1053 | /** |
| 1053 | * skb_queue_splice_tail - join two skb lists and reinitialise the emptied list | 1054 | * skb_queue_splice_tail_init - join two skb lists and reinitialise the emptied list |
| 1054 | * @list: the new list to add | 1055 | * @list: the new list to add |
| 1055 | * @head: the place to add it in the first list | 1056 | * @head: the place to add it in the first list |
| 1056 | * | 1057 | * |
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h index 98679b061b63..fa702aeb5038 100644 --- a/include/linux/spi/spi.h +++ b/include/linux/spi/spi.h | |||
| @@ -254,7 +254,7 @@ static inline void spi_unregister_driver(struct spi_driver *sdrv) | |||
| 254 | * driver is finished with this message, it must call | 254 | * driver is finished with this message, it must call |
| 255 | * spi_finalize_current_message() so the subsystem can issue the next | 255 | * spi_finalize_current_message() so the subsystem can issue the next |
| 256 | * transfer | 256 | * transfer |
| 257 | * @prepare_transfer_hardware: there are currently no more messages on the | 257 | * @unprepare_transfer_hardware: there are currently no more messages on the |
| 258 | * queue so the subsystem notifies the driver that it may relax the | 258 | * queue so the subsystem notifies the driver that it may relax the |
| 259 | * hardware by issuing this call | 259 | * hardware by issuing this call |
| 260 | * | 260 | * |
diff --git a/include/linux/usb/hcd.h b/include/linux/usb/hcd.h index 5de415707c23..d28cc78a38e4 100644 --- a/include/linux/usb/hcd.h +++ b/include/linux/usb/hcd.h | |||
| @@ -126,6 +126,8 @@ struct usb_hcd { | |||
| 126 | unsigned wireless:1; /* Wireless USB HCD */ | 126 | unsigned wireless:1; /* Wireless USB HCD */ |
| 127 | unsigned authorized_default:1; | 127 | unsigned authorized_default:1; |
| 128 | unsigned has_tt:1; /* Integrated TT in root hub */ | 128 | unsigned has_tt:1; /* Integrated TT in root hub */ |
| 129 | unsigned broken_pci_sleep:1; /* Don't put the | ||
| 130 | controller in PCI-D3 for system sleep */ | ||
| 129 | 131 | ||
| 130 | unsigned int irq; /* irq allocated */ | 132 | unsigned int irq; /* irq allocated */ |
| 131 | void __iomem *regs; /* device memory/io */ | 133 | void __iomem *regs; /* device memory/io */ |
diff --git a/include/linux/usb/otg.h b/include/linux/usb/otg.h index f67810f8f21b..38ab3f46346f 100644 --- a/include/linux/usb/otg.h +++ b/include/linux/usb/otg.h | |||
| @@ -94,6 +94,7 @@ struct usb_phy { | |||
| 94 | 94 | ||
| 95 | struct usb_otg *otg; | 95 | struct usb_otg *otg; |
| 96 | 96 | ||
| 97 | struct device *io_dev; | ||
| 97 | struct usb_phy_io_ops *io_ops; | 98 | struct usb_phy_io_ops *io_ops; |
| 98 | void __iomem *io_priv; | 99 | void __iomem *io_priv; |
| 99 | 100 | ||
diff --git a/include/linux/vm_event_item.h b/include/linux/vm_event_item.h index 03b90cdc1921..06f8e3858251 100644 --- a/include/linux/vm_event_item.h +++ b/include/linux/vm_event_item.h | |||
| @@ -26,13 +26,14 @@ enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT, | |||
| 26 | PGFREE, PGACTIVATE, PGDEACTIVATE, | 26 | PGFREE, PGACTIVATE, PGDEACTIVATE, |
| 27 | PGFAULT, PGMAJFAULT, | 27 | PGFAULT, PGMAJFAULT, |
| 28 | FOR_ALL_ZONES(PGREFILL), | 28 | FOR_ALL_ZONES(PGREFILL), |
| 29 | FOR_ALL_ZONES(PGSTEAL), | 29 | FOR_ALL_ZONES(PGSTEAL_KSWAPD), |
| 30 | FOR_ALL_ZONES(PGSTEAL_DIRECT), | ||
| 30 | FOR_ALL_ZONES(PGSCAN_KSWAPD), | 31 | FOR_ALL_ZONES(PGSCAN_KSWAPD), |
| 31 | FOR_ALL_ZONES(PGSCAN_DIRECT), | 32 | FOR_ALL_ZONES(PGSCAN_DIRECT), |
| 32 | #ifdef CONFIG_NUMA | 33 | #ifdef CONFIG_NUMA |
| 33 | PGSCAN_ZONE_RECLAIM_FAILED, | 34 | PGSCAN_ZONE_RECLAIM_FAILED, |
| 34 | #endif | 35 | #endif |
| 35 | PGINODESTEAL, SLABS_SCANNED, KSWAPD_STEAL, KSWAPD_INODESTEAL, | 36 | PGINODESTEAL, SLABS_SCANNED, KSWAPD_INODESTEAL, |
| 36 | KSWAPD_LOW_WMARK_HIT_QUICKLY, KSWAPD_HIGH_WMARK_HIT_QUICKLY, | 37 | KSWAPD_LOW_WMARK_HIT_QUICKLY, KSWAPD_HIGH_WMARK_HIT_QUICKLY, |
| 37 | KSWAPD_SKIP_CONGESTION_WAIT, | 38 | KSWAPD_SKIP_CONGESTION_WAIT, |
| 38 | PAGEOUTRUN, ALLOCSTALL, PGROTATED, | 39 | PAGEOUTRUN, ALLOCSTALL, PGROTATED, |
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h index 6822d2595aff..db1c5df45224 100644 --- a/include/net/bluetooth/hci_core.h +++ b/include/net/bluetooth/hci_core.h | |||
| @@ -314,6 +314,7 @@ struct hci_conn { | |||
| 314 | 314 | ||
| 315 | __u8 remote_cap; | 315 | __u8 remote_cap; |
| 316 | __u8 remote_auth; | 316 | __u8 remote_auth; |
| 317 | bool flush_key; | ||
| 317 | 318 | ||
| 318 | unsigned int sent; | 319 | unsigned int sent; |
| 319 | 320 | ||
| @@ -980,7 +981,7 @@ int mgmt_discoverable(struct hci_dev *hdev, u8 discoverable); | |||
| 980 | int mgmt_connectable(struct hci_dev *hdev, u8 connectable); | 981 | int mgmt_connectable(struct hci_dev *hdev, u8 connectable); |
| 981 | int mgmt_write_scan_failed(struct hci_dev *hdev, u8 scan, u8 status); | 982 | int mgmt_write_scan_failed(struct hci_dev *hdev, u8 scan, u8 status); |
| 982 | int mgmt_new_link_key(struct hci_dev *hdev, struct link_key *key, | 983 | int mgmt_new_link_key(struct hci_dev *hdev, struct link_key *key, |
| 983 | u8 persistent); | 984 | bool persistent); |
| 984 | int mgmt_device_connected(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, | 985 | int mgmt_device_connected(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, |
| 985 | u8 addr_type, u32 flags, u8 *name, u8 name_len, | 986 | u8 addr_type, u32 flags, u8 *name, u8 name_len, |
| 986 | u8 *dev_class); | 987 | u8 *dev_class); |
diff --git a/include/net/dst.h b/include/net/dst.h index 59c5d18cc385..bed833d9796a 100644 --- a/include/net/dst.h +++ b/include/net/dst.h | |||
| @@ -36,7 +36,11 @@ struct dst_entry { | |||
| 36 | struct net_device *dev; | 36 | struct net_device *dev; |
| 37 | struct dst_ops *ops; | 37 | struct dst_ops *ops; |
| 38 | unsigned long _metrics; | 38 | unsigned long _metrics; |
| 39 | unsigned long expires; | 39 | union { |
| 40 | unsigned long expires; | ||
| 41 | /* point to where the dst_entry copied from */ | ||
| 42 | struct dst_entry *from; | ||
| 43 | }; | ||
| 40 | struct dst_entry *path; | 44 | struct dst_entry *path; |
| 41 | struct neighbour __rcu *_neighbour; | 45 | struct neighbour __rcu *_neighbour; |
| 42 | #ifdef CONFIG_XFRM | 46 | #ifdef CONFIG_XFRM |
| @@ -55,6 +59,7 @@ struct dst_entry { | |||
| 55 | #define DST_NOCACHE 0x0010 | 59 | #define DST_NOCACHE 0x0010 |
| 56 | #define DST_NOCOUNT 0x0020 | 60 | #define DST_NOCOUNT 0x0020 |
| 57 | #define DST_NOPEER 0x0040 | 61 | #define DST_NOPEER 0x0040 |
| 62 | #define DST_FAKE_RTABLE 0x0080 | ||
| 58 | 63 | ||
| 59 | short error; | 64 | short error; |
| 60 | short obsolete; | 65 | short obsolete; |
diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h index b26bb8101981..0ae759a6c76e 100644 --- a/include/net/ip6_fib.h +++ b/include/net/ip6_fib.h | |||
| @@ -123,6 +123,54 @@ static inline struct inet6_dev *ip6_dst_idev(struct dst_entry *dst) | |||
| 123 | return ((struct rt6_info *)dst)->rt6i_idev; | 123 | return ((struct rt6_info *)dst)->rt6i_idev; |
| 124 | } | 124 | } |
| 125 | 125 | ||
| 126 | static inline void rt6_clean_expires(struct rt6_info *rt) | ||
| 127 | { | ||
| 128 | if (!(rt->rt6i_flags & RTF_EXPIRES) && rt->dst.from) | ||
| 129 | dst_release(rt->dst.from); | ||
| 130 | |||
| 131 | rt->rt6i_flags &= ~RTF_EXPIRES; | ||
| 132 | rt->dst.from = NULL; | ||
| 133 | } | ||
| 134 | |||
| 135 | static inline void rt6_set_expires(struct rt6_info *rt, unsigned long expires) | ||
| 136 | { | ||
| 137 | if (!(rt->rt6i_flags & RTF_EXPIRES) && rt->dst.from) | ||
| 138 | dst_release(rt->dst.from); | ||
| 139 | |||
| 140 | rt->rt6i_flags |= RTF_EXPIRES; | ||
| 141 | rt->dst.expires = expires; | ||
| 142 | } | ||
| 143 | |||
| 144 | static inline void rt6_update_expires(struct rt6_info *rt, int timeout) | ||
| 145 | { | ||
| 146 | if (!(rt->rt6i_flags & RTF_EXPIRES)) { | ||
| 147 | if (rt->dst.from) | ||
| 148 | dst_release(rt->dst.from); | ||
| 149 | /* dst_set_expires relies on expires == 0 | ||
| 150 | * if it has not been set previously. | ||
| 151 | */ | ||
| 152 | rt->dst.expires = 0; | ||
| 153 | } | ||
| 154 | |||
| 155 | dst_set_expires(&rt->dst, timeout); | ||
| 156 | rt->rt6i_flags |= RTF_EXPIRES; | ||
| 157 | } | ||
| 158 | |||
| 159 | static inline void rt6_set_from(struct rt6_info *rt, struct rt6_info *from) | ||
| 160 | { | ||
| 161 | struct dst_entry *new = (struct dst_entry *) from; | ||
| 162 | |||
| 163 | if (!(rt->rt6i_flags & RTF_EXPIRES) && rt->dst.from) { | ||
| 164 | if (new == rt->dst.from) | ||
| 165 | return; | ||
| 166 | dst_release(rt->dst.from); | ||
| 167 | } | ||
| 168 | |||
| 169 | rt->rt6i_flags &= ~RTF_EXPIRES; | ||
| 170 | rt->dst.from = new; | ||
| 171 | dst_hold(new); | ||
| 172 | } | ||
| 173 | |||
| 126 | struct fib6_walker_t { | 174 | struct fib6_walker_t { |
| 127 | struct list_head lh; | 175 | struct list_head lh; |
| 128 | struct fib6_node *root, *node; | 176 | struct fib6_node *root, *node; |
diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h index 2bdee51ba30d..72522f087375 100644 --- a/include/net/ip_vs.h +++ b/include/net/ip_vs.h | |||
| @@ -393,7 +393,7 @@ struct ip_vs_protocol { | |||
| 393 | 393 | ||
| 394 | void (*exit)(struct ip_vs_protocol *pp); | 394 | void (*exit)(struct ip_vs_protocol *pp); |
| 395 | 395 | ||
| 396 | void (*init_netns)(struct net *net, struct ip_vs_proto_data *pd); | 396 | int (*init_netns)(struct net *net, struct ip_vs_proto_data *pd); |
| 397 | 397 | ||
| 398 | void (*exit_netns)(struct net *net, struct ip_vs_proto_data *pd); | 398 | void (*exit_netns)(struct net *net, struct ip_vs_proto_data *pd); |
| 399 | 399 | ||
| @@ -1203,6 +1203,8 @@ ip_vs_lookup_real_service(struct net *net, int af, __u16 protocol, | |||
| 1203 | 1203 | ||
| 1204 | extern int ip_vs_use_count_inc(void); | 1204 | extern int ip_vs_use_count_inc(void); |
| 1205 | extern void ip_vs_use_count_dec(void); | 1205 | extern void ip_vs_use_count_dec(void); |
| 1206 | extern int ip_vs_register_nl_ioctl(void); | ||
| 1207 | extern void ip_vs_unregister_nl_ioctl(void); | ||
| 1206 | extern int ip_vs_control_init(void); | 1208 | extern int ip_vs_control_init(void); |
| 1207 | extern void ip_vs_control_cleanup(void); | 1209 | extern void ip_vs_control_cleanup(void); |
| 1208 | extern struct ip_vs_dest * | 1210 | extern struct ip_vs_dest * |
diff --git a/include/net/red.h b/include/net/red.h index 77d4c3745cb5..ef46058d35bf 100644 --- a/include/net/red.h +++ b/include/net/red.h | |||
| @@ -245,7 +245,7 @@ static inline unsigned long red_calc_qavg_from_idle_time(const struct red_parms | |||
| 245 | * | 245 | * |
| 246 | * dummy packets as a burst after idle time, i.e. | 246 | * dummy packets as a burst after idle time, i.e. |
| 247 | * | 247 | * |
| 248 | * p->qavg *= (1-W)^m | 248 | * v->qavg *= (1-W)^m |
| 249 | * | 249 | * |
| 250 | * This is an apparently overcomplicated solution (f.e. we have to | 250 | * This is an apparently overcomplicated solution (f.e. we have to |
| 251 | * precompute a table to make this calculation in reasonable time) | 251 | * precompute a table to make this calculation in reasonable time) |
| @@ -279,7 +279,7 @@ static inline unsigned long red_calc_qavg_no_idle_time(const struct red_parms *p | |||
| 279 | unsigned int backlog) | 279 | unsigned int backlog) |
| 280 | { | 280 | { |
| 281 | /* | 281 | /* |
| 282 | * NOTE: p->qavg is fixed point number with point at Wlog. | 282 | * NOTE: v->qavg is fixed point number with point at Wlog. |
| 283 | * The formula below is equvalent to floating point | 283 | * The formula below is equvalent to floating point |
| 284 | * version: | 284 | * version: |
| 285 | * | 285 | * |
| @@ -390,7 +390,7 @@ static inline void red_adaptative_algo(struct red_parms *p, struct red_vars *v) | |||
| 390 | if (red_is_idling(v)) | 390 | if (red_is_idling(v)) |
| 391 | qavg = red_calc_qavg_from_idle_time(p, v); | 391 | qavg = red_calc_qavg_from_idle_time(p, v); |
| 392 | 392 | ||
| 393 | /* p->qavg is fixed point number with point at Wlog */ | 393 | /* v->qavg is fixed point number with point at Wlog */ |
| 394 | qavg >>= p->Wlog; | 394 | qavg >>= p->Wlog; |
| 395 | 395 | ||
| 396 | if (qavg > p->target_max && p->max_P <= MAX_P_MAX) | 396 | if (qavg > p->target_max && p->max_P <= MAX_P_MAX) |
diff --git a/include/net/sock.h b/include/net/sock.h index a6ba1f8871fd..5a0a58ac4126 100644 --- a/include/net/sock.h +++ b/include/net/sock.h | |||
| @@ -246,6 +246,7 @@ struct cg_proto; | |||
| 246 | * @sk_user_data: RPC layer private data | 246 | * @sk_user_data: RPC layer private data |
| 247 | * @sk_sndmsg_page: cached page for sendmsg | 247 | * @sk_sndmsg_page: cached page for sendmsg |
| 248 | * @sk_sndmsg_off: cached offset for sendmsg | 248 | * @sk_sndmsg_off: cached offset for sendmsg |
| 249 | * @sk_peek_off: current peek_offset value | ||
| 249 | * @sk_send_head: front of stuff to transmit | 250 | * @sk_send_head: front of stuff to transmit |
| 250 | * @sk_security: used by security modules | 251 | * @sk_security: used by security modules |
| 251 | * @sk_mark: generic packet mark | 252 | * @sk_mark: generic packet mark |
| @@ -1128,9 +1129,9 @@ sk_sockets_allocated_read_positive(struct sock *sk) | |||
| 1128 | struct proto *prot = sk->sk_prot; | 1129 | struct proto *prot = sk->sk_prot; |
| 1129 | 1130 | ||
| 1130 | if (mem_cgroup_sockets_enabled && sk->sk_cgrp) | 1131 | if (mem_cgroup_sockets_enabled && sk->sk_cgrp) |
| 1131 | return percpu_counter_sum_positive(sk->sk_cgrp->sockets_allocated); | 1132 | return percpu_counter_read_positive(sk->sk_cgrp->sockets_allocated); |
| 1132 | 1133 | ||
| 1133 | return percpu_counter_sum_positive(prot->sockets_allocated); | 1134 | return percpu_counter_read_positive(prot->sockets_allocated); |
| 1134 | } | 1135 | } |
| 1135 | 1136 | ||
| 1136 | static inline int | 1137 | static inline int |
diff --git a/include/scsi/libsas.h b/include/scsi/libsas.h index 5f5ed1b8b41b..f4f1c96dca72 100644 --- a/include/scsi/libsas.h +++ b/include/scsi/libsas.h | |||
| @@ -217,11 +217,29 @@ struct domain_device { | |||
| 217 | struct kref kref; | 217 | struct kref kref; |
| 218 | }; | 218 | }; |
| 219 | 219 | ||
| 220 | struct sas_discovery_event { | 220 | struct sas_work { |
| 221 | struct list_head drain_node; | ||
| 221 | struct work_struct work; | 222 | struct work_struct work; |
| 223 | }; | ||
| 224 | |||
| 225 | static inline void INIT_SAS_WORK(struct sas_work *sw, void (*fn)(struct work_struct *)) | ||
| 226 | { | ||
| 227 | INIT_WORK(&sw->work, fn); | ||
| 228 | INIT_LIST_HEAD(&sw->drain_node); | ||
| 229 | } | ||
| 230 | |||
| 231 | struct sas_discovery_event { | ||
| 232 | struct sas_work work; | ||
| 222 | struct asd_sas_port *port; | 233 | struct asd_sas_port *port; |
| 223 | }; | 234 | }; |
| 224 | 235 | ||
| 236 | static inline struct sas_discovery_event *to_sas_discovery_event(struct work_struct *work) | ||
| 237 | { | ||
| 238 | struct sas_discovery_event *ev = container_of(work, typeof(*ev), work.work); | ||
| 239 | |||
| 240 | return ev; | ||
| 241 | } | ||
| 242 | |||
| 225 | struct sas_discovery { | 243 | struct sas_discovery { |
| 226 | struct sas_discovery_event disc_work[DISC_NUM_EVENTS]; | 244 | struct sas_discovery_event disc_work[DISC_NUM_EVENTS]; |
| 227 | unsigned long pending; | 245 | unsigned long pending; |
| @@ -244,7 +262,7 @@ struct asd_sas_port { | |||
| 244 | struct list_head destroy_list; | 262 | struct list_head destroy_list; |
| 245 | enum sas_linkrate linkrate; | 263 | enum sas_linkrate linkrate; |
| 246 | 264 | ||
| 247 | struct work_struct work; | 265 | struct sas_work work; |
| 248 | 266 | ||
| 249 | /* public: */ | 267 | /* public: */ |
| 250 | int id; | 268 | int id; |
| @@ -270,10 +288,17 @@ struct asd_sas_port { | |||
| 270 | }; | 288 | }; |
| 271 | 289 | ||
| 272 | struct asd_sas_event { | 290 | struct asd_sas_event { |
| 273 | struct work_struct work; | 291 | struct sas_work work; |
| 274 | struct asd_sas_phy *phy; | 292 | struct asd_sas_phy *phy; |
| 275 | }; | 293 | }; |
| 276 | 294 | ||
| 295 | static inline struct asd_sas_event *to_asd_sas_event(struct work_struct *work) | ||
| 296 | { | ||
| 297 | struct asd_sas_event *ev = container_of(work, typeof(*ev), work.work); | ||
| 298 | |||
| 299 | return ev; | ||
| 300 | } | ||
| 301 | |||
| 277 | /* The phy pretty much is controlled by the LLDD. | 302 | /* The phy pretty much is controlled by the LLDD. |
| 278 | * The class only reads those fields. | 303 | * The class only reads those fields. |
| 279 | */ | 304 | */ |
| @@ -333,10 +358,17 @@ struct scsi_core { | |||
| 333 | }; | 358 | }; |
| 334 | 359 | ||
| 335 | struct sas_ha_event { | 360 | struct sas_ha_event { |
| 336 | struct work_struct work; | 361 | struct sas_work work; |
| 337 | struct sas_ha_struct *ha; | 362 | struct sas_ha_struct *ha; |
| 338 | }; | 363 | }; |
| 339 | 364 | ||
| 365 | static inline struct sas_ha_event *to_sas_ha_event(struct work_struct *work) | ||
| 366 | { | ||
| 367 | struct sas_ha_event *ev = container_of(work, typeof(*ev), work.work); | ||
| 368 | |||
| 369 | return ev; | ||
| 370 | } | ||
| 371 | |||
| 340 | enum sas_ha_state { | 372 | enum sas_ha_state { |
| 341 | SAS_HA_REGISTERED, | 373 | SAS_HA_REGISTERED, |
| 342 | SAS_HA_DRAINING, | 374 | SAS_HA_DRAINING, |
diff --git a/include/scsi/sas_ata.h b/include/scsi/sas_ata.h index cdccd2eb7b6c..77670e823ed8 100644 --- a/include/scsi/sas_ata.h +++ b/include/scsi/sas_ata.h | |||
| @@ -37,7 +37,7 @@ static inline int dev_is_sata(struct domain_device *dev) | |||
| 37 | } | 37 | } |
| 38 | 38 | ||
| 39 | int sas_get_ata_info(struct domain_device *dev, struct ex_phy *phy); | 39 | int sas_get_ata_info(struct domain_device *dev, struct ex_phy *phy); |
| 40 | int sas_ata_init_host_and_port(struct domain_device *found_dev); | 40 | int sas_ata_init(struct domain_device *dev); |
| 41 | void sas_ata_task_abort(struct sas_task *task); | 41 | void sas_ata_task_abort(struct sas_task *task); |
| 42 | void sas_ata_strategy_handler(struct Scsi_Host *shost); | 42 | void sas_ata_strategy_handler(struct Scsi_Host *shost); |
| 43 | void sas_ata_eh(struct Scsi_Host *shost, struct list_head *work_q, | 43 | void sas_ata_eh(struct Scsi_Host *shost, struct list_head *work_q, |
| @@ -52,7 +52,7 @@ static inline int dev_is_sata(struct domain_device *dev) | |||
| 52 | { | 52 | { |
| 53 | return 0; | 53 | return 0; |
| 54 | } | 54 | } |
| 55 | static inline int sas_ata_init_host_and_port(struct domain_device *found_dev) | 55 | static inline int sas_ata_init(struct domain_device *dev) |
| 56 | { | 56 | { |
| 57 | return 0; | 57 | return 0; |
| 58 | } | 58 | } |
diff --git a/init/do_mounts.c b/init/do_mounts.c index 0e93f92a0345..42b0707c3481 100644 --- a/init/do_mounts.c +++ b/init/do_mounts.c | |||
| @@ -472,7 +472,7 @@ void __init change_floppy(char *fmt, ...) | |||
| 472 | void __init mount_root(void) | 472 | void __init mount_root(void) |
| 473 | { | 473 | { |
| 474 | #ifdef CONFIG_ROOT_NFS | 474 | #ifdef CONFIG_ROOT_NFS |
| 475 | if (MAJOR(ROOT_DEV) == UNNAMED_MAJOR) { | 475 | if (ROOT_DEV == Root_NFS) { |
| 476 | if (mount_nfs_root()) | 476 | if (mount_nfs_root()) |
| 477 | return; | 477 | return; |
| 478 | 478 | ||
diff --git a/init/main.c b/init/main.c index 9d454f09f3b1..44b2433334c7 100644 --- a/init/main.c +++ b/init/main.c | |||
| @@ -225,13 +225,9 @@ static int __init loglevel(char *str) | |||
| 225 | 225 | ||
| 226 | early_param("loglevel", loglevel); | 226 | early_param("loglevel", loglevel); |
| 227 | 227 | ||
| 228 | /* | 228 | /* Change NUL term back to "=", to make "param" the whole string. */ |
| 229 | * Unknown boot options get handed to init, unless they look like | 229 | static int __init repair_env_string(char *param, char *val) |
| 230 | * unused parameters (modprobe will find them in /proc/cmdline). | ||
| 231 | */ | ||
| 232 | static int __init unknown_bootoption(char *param, char *val) | ||
| 233 | { | 230 | { |
| 234 | /* Change NUL term back to "=", to make "param" the whole string. */ | ||
| 235 | if (val) { | 231 | if (val) { |
| 236 | /* param=val or param="val"? */ | 232 | /* param=val or param="val"? */ |
| 237 | if (val == param+strlen(param)+1) | 233 | if (val == param+strlen(param)+1) |
| @@ -243,6 +239,16 @@ static int __init unknown_bootoption(char *param, char *val) | |||
| 243 | } else | 239 | } else |
| 244 | BUG(); | 240 | BUG(); |
| 245 | } | 241 | } |
| 242 | return 0; | ||
| 243 | } | ||
| 244 | |||
| 245 | /* | ||
| 246 | * Unknown boot options get handed to init, unless they look like | ||
| 247 | * unused parameters (modprobe will find them in /proc/cmdline). | ||
| 248 | */ | ||
| 249 | static int __init unknown_bootoption(char *param, char *val) | ||
| 250 | { | ||
| 251 | repair_env_string(param, val); | ||
| 246 | 252 | ||
| 247 | /* Handle obsolete-style parameters */ | 253 | /* Handle obsolete-style parameters */ |
| 248 | if (obsolete_checksetup(param)) | 254 | if (obsolete_checksetup(param)) |
| @@ -732,11 +738,6 @@ static char *initcall_level_names[] __initdata = { | |||
| 732 | "late parameters", | 738 | "late parameters", |
| 733 | }; | 739 | }; |
| 734 | 740 | ||
| 735 | static int __init ignore_unknown_bootoption(char *param, char *val) | ||
| 736 | { | ||
| 737 | return 0; | ||
| 738 | } | ||
| 739 | |||
| 740 | static void __init do_initcall_level(int level) | 741 | static void __init do_initcall_level(int level) |
| 741 | { | 742 | { |
| 742 | extern const struct kernel_param __start___param[], __stop___param[]; | 743 | extern const struct kernel_param __start___param[], __stop___param[]; |
| @@ -747,7 +748,7 @@ static void __init do_initcall_level(int level) | |||
| 747 | static_command_line, __start___param, | 748 | static_command_line, __start___param, |
| 748 | __stop___param - __start___param, | 749 | __stop___param - __start___param, |
| 749 | level, level, | 750 | level, level, |
| 750 | ignore_unknown_bootoption); | 751 | repair_env_string); |
| 751 | 752 | ||
| 752 | for (fn = initcall_levels[level]; fn < initcall_levels[level+1]; fn++) | 753 | for (fn = initcall_levels[level]; fn < initcall_levels[level+1]; fn++) |
| 753 | do_one_initcall(*fn); | 754 | do_one_initcall(*fn); |
diff --git a/kernel/events/core.c b/kernel/events/core.c index a6a9ec4cd8f5..fd126f82b57c 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c | |||
| @@ -3183,7 +3183,7 @@ static void perf_event_for_each(struct perf_event *event, | |||
| 3183 | perf_event_for_each_child(event, func); | 3183 | perf_event_for_each_child(event, func); |
| 3184 | func(event); | 3184 | func(event); |
| 3185 | list_for_each_entry(sibling, &event->sibling_list, group_entry) | 3185 | list_for_each_entry(sibling, &event->sibling_list, group_entry) |
| 3186 | perf_event_for_each_child(event, func); | 3186 | perf_event_for_each_child(sibling, func); |
| 3187 | mutex_unlock(&ctx->mutex); | 3187 | mutex_unlock(&ctx->mutex); |
| 3188 | } | 3188 | } |
| 3189 | 3189 | ||
diff --git a/kernel/irq/debug.h b/kernel/irq/debug.h index 97a8bfadc88a..e75e29e4434a 100644 --- a/kernel/irq/debug.h +++ b/kernel/irq/debug.h | |||
| @@ -4,10 +4,10 @@ | |||
| 4 | 4 | ||
| 5 | #include <linux/kallsyms.h> | 5 | #include <linux/kallsyms.h> |
| 6 | 6 | ||
| 7 | #define P(f) if (desc->status_use_accessors & f) printk("%14s set\n", #f) | 7 | #define ___P(f) if (desc->status_use_accessors & f) printk("%14s set\n", #f) |
| 8 | #define PS(f) if (desc->istate & f) printk("%14s set\n", #f) | 8 | #define ___PS(f) if (desc->istate & f) printk("%14s set\n", #f) |
| 9 | /* FIXME */ | 9 | /* FIXME */ |
| 10 | #define PD(f) do { } while (0) | 10 | #define ___PD(f) do { } while (0) |
| 11 | 11 | ||
| 12 | static inline void print_irq_desc(unsigned int irq, struct irq_desc *desc) | 12 | static inline void print_irq_desc(unsigned int irq, struct irq_desc *desc) |
| 13 | { | 13 | { |
| @@ -23,23 +23,23 @@ static inline void print_irq_desc(unsigned int irq, struct irq_desc *desc) | |||
| 23 | print_symbol("%s\n", (unsigned long)desc->action->handler); | 23 | print_symbol("%s\n", (unsigned long)desc->action->handler); |
| 24 | } | 24 | } |
| 25 | 25 | ||
| 26 | P(IRQ_LEVEL); | 26 | ___P(IRQ_LEVEL); |
| 27 | P(IRQ_PER_CPU); | 27 | ___P(IRQ_PER_CPU); |
| 28 | P(IRQ_NOPROBE); | 28 | ___P(IRQ_NOPROBE); |
| 29 | P(IRQ_NOREQUEST); | 29 | ___P(IRQ_NOREQUEST); |
| 30 | P(IRQ_NOTHREAD); | 30 | ___P(IRQ_NOTHREAD); |
| 31 | P(IRQ_NOAUTOEN); | 31 | ___P(IRQ_NOAUTOEN); |
| 32 | 32 | ||
| 33 | PS(IRQS_AUTODETECT); | 33 | ___PS(IRQS_AUTODETECT); |
| 34 | PS(IRQS_REPLAY); | 34 | ___PS(IRQS_REPLAY); |
| 35 | PS(IRQS_WAITING); | 35 | ___PS(IRQS_WAITING); |
| 36 | PS(IRQS_PENDING); | 36 | ___PS(IRQS_PENDING); |
| 37 | 37 | ||
| 38 | PD(IRQS_INPROGRESS); | 38 | ___PD(IRQS_INPROGRESS); |
| 39 | PD(IRQS_DISABLED); | 39 | ___PD(IRQS_DISABLED); |
| 40 | PD(IRQS_MASKED); | 40 | ___PD(IRQS_MASKED); |
| 41 | } | 41 | } |
| 42 | 42 | ||
| 43 | #undef P | 43 | #undef ___P |
| 44 | #undef PS | 44 | #undef ___PS |
| 45 | #undef PD | 45 | #undef ___PD |
diff --git a/kernel/power/swap.c b/kernel/power/swap.c index 8742fd013a94..eef311a58a64 100644 --- a/kernel/power/swap.c +++ b/kernel/power/swap.c | |||
| @@ -51,6 +51,23 @@ | |||
| 51 | 51 | ||
| 52 | #define MAP_PAGE_ENTRIES (PAGE_SIZE / sizeof(sector_t) - 1) | 52 | #define MAP_PAGE_ENTRIES (PAGE_SIZE / sizeof(sector_t) - 1) |
| 53 | 53 | ||
| 54 | /* | ||
| 55 | * Number of free pages that are not high. | ||
| 56 | */ | ||
| 57 | static inline unsigned long low_free_pages(void) | ||
| 58 | { | ||
| 59 | return nr_free_pages() - nr_free_highpages(); | ||
| 60 | } | ||
| 61 | |||
| 62 | /* | ||
| 63 | * Number of pages required to be kept free while writing the image. Always | ||
| 64 | * half of all available low pages before the writing starts. | ||
| 65 | */ | ||
| 66 | static inline unsigned long reqd_free_pages(void) | ||
| 67 | { | ||
| 68 | return low_free_pages() / 2; | ||
| 69 | } | ||
| 70 | |||
| 54 | struct swap_map_page { | 71 | struct swap_map_page { |
| 55 | sector_t entries[MAP_PAGE_ENTRIES]; | 72 | sector_t entries[MAP_PAGE_ENTRIES]; |
| 56 | sector_t next_swap; | 73 | sector_t next_swap; |
| @@ -72,7 +89,7 @@ struct swap_map_handle { | |||
| 72 | sector_t cur_swap; | 89 | sector_t cur_swap; |
| 73 | sector_t first_sector; | 90 | sector_t first_sector; |
| 74 | unsigned int k; | 91 | unsigned int k; |
| 75 | unsigned long nr_free_pages, written; | 92 | unsigned long reqd_free_pages; |
| 76 | u32 crc32; | 93 | u32 crc32; |
| 77 | }; | 94 | }; |
| 78 | 95 | ||
| @@ -316,8 +333,7 @@ static int get_swap_writer(struct swap_map_handle *handle) | |||
| 316 | goto err_rel; | 333 | goto err_rel; |
| 317 | } | 334 | } |
| 318 | handle->k = 0; | 335 | handle->k = 0; |
| 319 | handle->nr_free_pages = nr_free_pages() >> 1; | 336 | handle->reqd_free_pages = reqd_free_pages(); |
| 320 | handle->written = 0; | ||
| 321 | handle->first_sector = handle->cur_swap; | 337 | handle->first_sector = handle->cur_swap; |
| 322 | return 0; | 338 | return 0; |
| 323 | err_rel: | 339 | err_rel: |
| @@ -352,11 +368,11 @@ static int swap_write_page(struct swap_map_handle *handle, void *buf, | |||
| 352 | handle->cur_swap = offset; | 368 | handle->cur_swap = offset; |
| 353 | handle->k = 0; | 369 | handle->k = 0; |
| 354 | } | 370 | } |
| 355 | if (bio_chain && ++handle->written > handle->nr_free_pages) { | 371 | if (bio_chain && low_free_pages() <= handle->reqd_free_pages) { |
| 356 | error = hib_wait_on_bio_chain(bio_chain); | 372 | error = hib_wait_on_bio_chain(bio_chain); |
| 357 | if (error) | 373 | if (error) |
| 358 | goto out; | 374 | goto out; |
| 359 | handle->written = 0; | 375 | handle->reqd_free_pages = reqd_free_pages(); |
| 360 | } | 376 | } |
| 361 | out: | 377 | out: |
| 362 | return error; | 378 | return error; |
| @@ -618,7 +634,7 @@ static int save_image_lzo(struct swap_map_handle *handle, | |||
| 618 | * Adjust number of free pages after all allocations have been done. | 634 | * Adjust number of free pages after all allocations have been done. |
| 619 | * We don't want to run out of pages when writing. | 635 | * We don't want to run out of pages when writing. |
| 620 | */ | 636 | */ |
| 621 | handle->nr_free_pages = nr_free_pages() >> 1; | 637 | handle->reqd_free_pages = reqd_free_pages(); |
| 622 | 638 | ||
| 623 | /* | 639 | /* |
| 624 | * Start the CRC32 thread. | 640 | * Start the CRC32 thread. |
diff --git a/kernel/rcutree.c b/kernel/rcutree.c index 1050d6d3922c..d0c5baf1ab18 100644 --- a/kernel/rcutree.c +++ b/kernel/rcutree.c | |||
| @@ -1820,7 +1820,6 @@ __call_rcu(struct rcu_head *head, void (*func)(struct rcu_head *rcu), | |||
| 1820 | * a quiescent state betweentimes. | 1820 | * a quiescent state betweentimes. |
| 1821 | */ | 1821 | */ |
| 1822 | local_irq_save(flags); | 1822 | local_irq_save(flags); |
| 1823 | WARN_ON_ONCE(cpu_is_offline(smp_processor_id())); | ||
| 1824 | rdp = this_cpu_ptr(rsp->rda); | 1823 | rdp = this_cpu_ptr(rsp->rda); |
| 1825 | 1824 | ||
| 1826 | /* Add the callback to our list. */ | 1825 | /* Add the callback to our list. */ |
diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 4603b9d8f30a..0533a688ce22 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c | |||
| @@ -6405,16 +6405,26 @@ static void __sdt_free(const struct cpumask *cpu_map) | |||
| 6405 | struct sd_data *sdd = &tl->data; | 6405 | struct sd_data *sdd = &tl->data; |
| 6406 | 6406 | ||
| 6407 | for_each_cpu(j, cpu_map) { | 6407 | for_each_cpu(j, cpu_map) { |
| 6408 | struct sched_domain *sd = *per_cpu_ptr(sdd->sd, j); | 6408 | struct sched_domain *sd; |
| 6409 | if (sd && (sd->flags & SD_OVERLAP)) | 6409 | |
| 6410 | free_sched_groups(sd->groups, 0); | 6410 | if (sdd->sd) { |
| 6411 | kfree(*per_cpu_ptr(sdd->sd, j)); | 6411 | sd = *per_cpu_ptr(sdd->sd, j); |
| 6412 | kfree(*per_cpu_ptr(sdd->sg, j)); | 6412 | if (sd && (sd->flags & SD_OVERLAP)) |
| 6413 | kfree(*per_cpu_ptr(sdd->sgp, j)); | 6413 | free_sched_groups(sd->groups, 0); |
| 6414 | kfree(*per_cpu_ptr(sdd->sd, j)); | ||
| 6415 | } | ||
| 6416 | |||
| 6417 | if (sdd->sg) | ||
| 6418 | kfree(*per_cpu_ptr(sdd->sg, j)); | ||
| 6419 | if (sdd->sgp) | ||
| 6420 | kfree(*per_cpu_ptr(sdd->sgp, j)); | ||
| 6414 | } | 6421 | } |
| 6415 | free_percpu(sdd->sd); | 6422 | free_percpu(sdd->sd); |
| 6423 | sdd->sd = NULL; | ||
| 6416 | free_percpu(sdd->sg); | 6424 | free_percpu(sdd->sg); |
| 6425 | sdd->sg = NULL; | ||
| 6417 | free_percpu(sdd->sgp); | 6426 | free_percpu(sdd->sgp); |
| 6427 | sdd->sgp = NULL; | ||
| 6418 | } | 6428 | } |
| 6419 | } | 6429 | } |
| 6420 | 6430 | ||
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 0d97ebdc58f0..e9553640c1c3 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c | |||
| @@ -784,7 +784,7 @@ account_entity_enqueue(struct cfs_rq *cfs_rq, struct sched_entity *se) | |||
| 784 | update_load_add(&rq_of(cfs_rq)->load, se->load.weight); | 784 | update_load_add(&rq_of(cfs_rq)->load, se->load.weight); |
| 785 | #ifdef CONFIG_SMP | 785 | #ifdef CONFIG_SMP |
| 786 | if (entity_is_task(se)) | 786 | if (entity_is_task(se)) |
| 787 | list_add_tail(&se->group_node, &rq_of(cfs_rq)->cfs_tasks); | 787 | list_add(&se->group_node, &rq_of(cfs_rq)->cfs_tasks); |
| 788 | #endif | 788 | #endif |
| 789 | cfs_rq->nr_running++; | 789 | cfs_rq->nr_running++; |
| 790 | } | 790 | } |
| @@ -3215,6 +3215,8 @@ static int move_one_task(struct lb_env *env) | |||
| 3215 | 3215 | ||
| 3216 | static unsigned long task_h_load(struct task_struct *p); | 3216 | static unsigned long task_h_load(struct task_struct *p); |
| 3217 | 3217 | ||
| 3218 | static const unsigned int sched_nr_migrate_break = 32; | ||
| 3219 | |||
| 3218 | /* | 3220 | /* |
| 3219 | * move_tasks tries to move up to load_move weighted load from busiest to | 3221 | * move_tasks tries to move up to load_move weighted load from busiest to |
| 3220 | * this_rq, as part of a balancing operation within domain "sd". | 3222 | * this_rq, as part of a balancing operation within domain "sd". |
| @@ -3242,7 +3244,7 @@ static int move_tasks(struct lb_env *env) | |||
| 3242 | 3244 | ||
| 3243 | /* take a breather every nr_migrate tasks */ | 3245 | /* take a breather every nr_migrate tasks */ |
| 3244 | if (env->loop > env->loop_break) { | 3246 | if (env->loop > env->loop_break) { |
| 3245 | env->loop_break += sysctl_sched_nr_migrate; | 3247 | env->loop_break += sched_nr_migrate_break; |
| 3246 | env->flags |= LBF_NEED_BREAK; | 3248 | env->flags |= LBF_NEED_BREAK; |
| 3247 | break; | 3249 | break; |
| 3248 | } | 3250 | } |
| @@ -3252,7 +3254,7 @@ static int move_tasks(struct lb_env *env) | |||
| 3252 | 3254 | ||
| 3253 | load = task_h_load(p); | 3255 | load = task_h_load(p); |
| 3254 | 3256 | ||
| 3255 | if (load < 16 && !env->sd->nr_balance_failed) | 3257 | if (sched_feat(LB_MIN) && load < 16 && !env->sd->nr_balance_failed) |
| 3256 | goto next; | 3258 | goto next; |
| 3257 | 3259 | ||
| 3258 | if ((load / 2) > env->load_move) | 3260 | if ((load / 2) > env->load_move) |
| @@ -4407,7 +4409,7 @@ static int load_balance(int this_cpu, struct rq *this_rq, | |||
| 4407 | .dst_cpu = this_cpu, | 4409 | .dst_cpu = this_cpu, |
| 4408 | .dst_rq = this_rq, | 4410 | .dst_rq = this_rq, |
| 4409 | .idle = idle, | 4411 | .idle = idle, |
| 4410 | .loop_break = sysctl_sched_nr_migrate, | 4412 | .loop_break = sched_nr_migrate_break, |
| 4411 | }; | 4413 | }; |
| 4412 | 4414 | ||
| 4413 | cpumask_copy(cpus, cpu_active_mask); | 4415 | cpumask_copy(cpus, cpu_active_mask); |
| @@ -4445,10 +4447,10 @@ redo: | |||
| 4445 | * correctly treated as an imbalance. | 4447 | * correctly treated as an imbalance. |
| 4446 | */ | 4448 | */ |
| 4447 | env.flags |= LBF_ALL_PINNED; | 4449 | env.flags |= LBF_ALL_PINNED; |
| 4448 | env.load_move = imbalance; | 4450 | env.load_move = imbalance; |
| 4449 | env.src_cpu = busiest->cpu; | 4451 | env.src_cpu = busiest->cpu; |
| 4450 | env.src_rq = busiest; | 4452 | env.src_rq = busiest; |
| 4451 | env.loop_max = busiest->nr_running; | 4453 | env.loop_max = min_t(unsigned long, sysctl_sched_nr_migrate, busiest->nr_running); |
| 4452 | 4454 | ||
| 4453 | more_balance: | 4455 | more_balance: |
| 4454 | local_irq_save(flags); | 4456 | local_irq_save(flags); |
diff --git a/kernel/sched/features.h b/kernel/sched/features.h index e61fd73913d0..de00a486c5c6 100644 --- a/kernel/sched/features.h +++ b/kernel/sched/features.h | |||
| @@ -68,3 +68,4 @@ SCHED_FEAT(TTWU_QUEUE, true) | |||
| 68 | 68 | ||
| 69 | SCHED_FEAT(FORCE_SD_OVERLAP, false) | 69 | SCHED_FEAT(FORCE_SD_OVERLAP, false) |
| 70 | SCHED_FEAT(RT_RUNTIME_SHARE, true) | 70 | SCHED_FEAT(RT_RUNTIME_SHARE, true) |
| 71 | SCHED_FEAT(LB_MIN, false) | ||
diff --git a/kernel/time/tick-broadcast.c b/kernel/time/tick-broadcast.c index bf57abdc7bd0..f113755695e2 100644 --- a/kernel/time/tick-broadcast.c +++ b/kernel/time/tick-broadcast.c | |||
| @@ -346,7 +346,8 @@ int tick_resume_broadcast(void) | |||
| 346 | tick_get_broadcast_mask()); | 346 | tick_get_broadcast_mask()); |
| 347 | break; | 347 | break; |
| 348 | case TICKDEV_MODE_ONESHOT: | 348 | case TICKDEV_MODE_ONESHOT: |
| 349 | broadcast = tick_resume_broadcast_oneshot(bc); | 349 | if (!cpumask_empty(tick_get_broadcast_mask())) |
| 350 | broadcast = tick_resume_broadcast_oneshot(bc); | ||
| 350 | break; | 351 | break; |
| 351 | } | 352 | } |
| 352 | } | 353 | } |
| @@ -373,6 +374,9 @@ static int tick_broadcast_set_event(ktime_t expires, int force) | |||
| 373 | { | 374 | { |
| 374 | struct clock_event_device *bc = tick_broadcast_device.evtdev; | 375 | struct clock_event_device *bc = tick_broadcast_device.evtdev; |
| 375 | 376 | ||
| 377 | if (bc->mode != CLOCK_EVT_MODE_ONESHOT) | ||
| 378 | clockevents_set_mode(bc, CLOCK_EVT_MODE_ONESHOT); | ||
| 379 | |||
| 376 | return clockevents_program_event(bc, expires, force); | 380 | return clockevents_program_event(bc, expires, force); |
| 377 | } | 381 | } |
| 378 | 382 | ||
| @@ -531,7 +535,6 @@ void tick_broadcast_setup_oneshot(struct clock_event_device *bc) | |||
| 531 | int was_periodic = bc->mode == CLOCK_EVT_MODE_PERIODIC; | 535 | int was_periodic = bc->mode == CLOCK_EVT_MODE_PERIODIC; |
| 532 | 536 | ||
| 533 | bc->event_handler = tick_handle_oneshot_broadcast; | 537 | bc->event_handler = tick_handle_oneshot_broadcast; |
| 534 | clockevents_set_mode(bc, CLOCK_EVT_MODE_ONESHOT); | ||
| 535 | 538 | ||
| 536 | /* Take the do_timer update */ | 539 | /* Take the do_timer update */ |
| 537 | tick_do_timer_cpu = cpu; | 540 | tick_do_timer_cpu = cpu; |
| @@ -549,6 +552,7 @@ void tick_broadcast_setup_oneshot(struct clock_event_device *bc) | |||
| 549 | to_cpumask(tmpmask)); | 552 | to_cpumask(tmpmask)); |
| 550 | 553 | ||
| 551 | if (was_periodic && !cpumask_empty(to_cpumask(tmpmask))) { | 554 | if (was_periodic && !cpumask_empty(to_cpumask(tmpmask))) { |
| 555 | clockevents_set_mode(bc, CLOCK_EVT_MODE_ONESHOT); | ||
| 552 | tick_broadcast_init_next_event(to_cpumask(tmpmask), | 556 | tick_broadcast_init_next_event(to_cpumask(tmpmask), |
| 553 | tick_next_period); | 557 | tick_next_period); |
| 554 | tick_broadcast_set_event(tick_next_period, 1); | 558 | tick_broadcast_set_event(tick_next_period, 1); |
| @@ -577,15 +581,10 @@ void tick_broadcast_switch_to_oneshot(void) | |||
| 577 | raw_spin_lock_irqsave(&tick_broadcast_lock, flags); | 581 | raw_spin_lock_irqsave(&tick_broadcast_lock, flags); |
| 578 | 582 | ||
| 579 | tick_broadcast_device.mode = TICKDEV_MODE_ONESHOT; | 583 | tick_broadcast_device.mode = TICKDEV_MODE_ONESHOT; |
| 580 | |||
| 581 | if (cpumask_empty(tick_get_broadcast_mask())) | ||
| 582 | goto end; | ||
| 583 | |||
| 584 | bc = tick_broadcast_device.evtdev; | 584 | bc = tick_broadcast_device.evtdev; |
| 585 | if (bc) | 585 | if (bc) |
| 586 | tick_broadcast_setup_oneshot(bc); | 586 | tick_broadcast_setup_oneshot(bc); |
| 587 | 587 | ||
| 588 | end: | ||
| 589 | raw_spin_unlock_irqrestore(&tick_broadcast_lock, flags); | 588 | raw_spin_unlock_irqrestore(&tick_broadcast_lock, flags); |
| 590 | } | 589 | } |
| 591 | 590 | ||
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index ed7b5d1e12f4..2a22255c1010 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c | |||
| @@ -4629,7 +4629,8 @@ static ssize_t | |||
| 4629 | rb_simple_read(struct file *filp, char __user *ubuf, | 4629 | rb_simple_read(struct file *filp, char __user *ubuf, |
| 4630 | size_t cnt, loff_t *ppos) | 4630 | size_t cnt, loff_t *ppos) |
| 4631 | { | 4631 | { |
| 4632 | struct ring_buffer *buffer = filp->private_data; | 4632 | struct trace_array *tr = filp->private_data; |
| 4633 | struct ring_buffer *buffer = tr->buffer; | ||
| 4633 | char buf[64]; | 4634 | char buf[64]; |
| 4634 | int r; | 4635 | int r; |
| 4635 | 4636 | ||
| @@ -4647,7 +4648,8 @@ static ssize_t | |||
| 4647 | rb_simple_write(struct file *filp, const char __user *ubuf, | 4648 | rb_simple_write(struct file *filp, const char __user *ubuf, |
| 4648 | size_t cnt, loff_t *ppos) | 4649 | size_t cnt, loff_t *ppos) |
| 4649 | { | 4650 | { |
| 4650 | struct ring_buffer *buffer = filp->private_data; | 4651 | struct trace_array *tr = filp->private_data; |
| 4652 | struct ring_buffer *buffer = tr->buffer; | ||
| 4651 | unsigned long val; | 4653 | unsigned long val; |
| 4652 | int ret; | 4654 | int ret; |
| 4653 | 4655 | ||
| @@ -4734,7 +4736,7 @@ static __init int tracer_init_debugfs(void) | |||
| 4734 | &trace_clock_fops); | 4736 | &trace_clock_fops); |
| 4735 | 4737 | ||
| 4736 | trace_create_file("tracing_on", 0644, d_tracer, | 4738 | trace_create_file("tracing_on", 0644, d_tracer, |
| 4737 | global_trace.buffer, &rb_simple_fops); | 4739 | &global_trace, &rb_simple_fops); |
| 4738 | 4740 | ||
| 4739 | #ifdef CONFIG_DYNAMIC_FTRACE | 4741 | #ifdef CONFIG_DYNAMIC_FTRACE |
| 4740 | trace_create_file("dyn_ftrace_total_info", 0444, d_tracer, | 4742 | trace_create_file("dyn_ftrace_total_info", 0444, d_tracer, |
diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h index 95059f091a24..f95d65da6db8 100644 --- a/kernel/trace/trace.h +++ b/kernel/trace/trace.h | |||
| @@ -836,11 +836,11 @@ extern const char *__stop___trace_bprintk_fmt[]; | |||
| 836 | filter) | 836 | filter) |
| 837 | #include "trace_entries.h" | 837 | #include "trace_entries.h" |
| 838 | 838 | ||
| 839 | #ifdef CONFIG_FUNCTION_TRACER | 839 | #if defined(CONFIG_PERF_EVENTS) && defined(CONFIG_FUNCTION_TRACER) |
| 840 | int perf_ftrace_event_register(struct ftrace_event_call *call, | 840 | int perf_ftrace_event_register(struct ftrace_event_call *call, |
| 841 | enum trace_reg type, void *data); | 841 | enum trace_reg type, void *data); |
| 842 | #else | 842 | #else |
| 843 | #define perf_ftrace_event_register NULL | 843 | #define perf_ftrace_event_register NULL |
| 844 | #endif /* CONFIG_FUNCTION_TRACER */ | 844 | #endif |
| 845 | 845 | ||
| 846 | #endif /* _LINUX_KERNEL_TRACE_H */ | 846 | #endif /* _LINUX_KERNEL_TRACE_H */ |
diff --git a/kernel/trace/trace_output.c b/kernel/trace/trace_output.c index 859fae6b1825..df611a0e76c5 100644 --- a/kernel/trace/trace_output.c +++ b/kernel/trace/trace_output.c | |||
| @@ -652,6 +652,8 @@ int trace_print_lat_context(struct trace_iterator *iter) | |||
| 652 | { | 652 | { |
| 653 | u64 next_ts; | 653 | u64 next_ts; |
| 654 | int ret; | 654 | int ret; |
| 655 | /* trace_find_next_entry will reset ent_size */ | ||
| 656 | int ent_size = iter->ent_size; | ||
| 655 | struct trace_seq *s = &iter->seq; | 657 | struct trace_seq *s = &iter->seq; |
| 656 | struct trace_entry *entry = iter->ent, | 658 | struct trace_entry *entry = iter->ent, |
| 657 | *next_entry = trace_find_next_entry(iter, NULL, | 659 | *next_entry = trace_find_next_entry(iter, NULL, |
| @@ -660,6 +662,9 @@ int trace_print_lat_context(struct trace_iterator *iter) | |||
| 660 | unsigned long abs_usecs = ns2usecs(iter->ts - iter->tr->time_start); | 662 | unsigned long abs_usecs = ns2usecs(iter->ts - iter->tr->time_start); |
| 661 | unsigned long rel_usecs; | 663 | unsigned long rel_usecs; |
| 662 | 664 | ||
| 665 | /* Restore the original ent_size */ | ||
| 666 | iter->ent_size = ent_size; | ||
| 667 | |||
| 663 | if (!next_entry) | 668 | if (!next_entry) |
| 664 | next_ts = iter->ts; | 669 | next_ts = iter->ts; |
| 665 | rel_usecs = ns2usecs(next_ts - iter->ts); | 670 | rel_usecs = ns2usecs(next_ts - iter->ts); |
diff --git a/lib/mpi/mpi-bit.c b/lib/mpi/mpi-bit.c index 2f526627e4f5..0c505361da19 100644 --- a/lib/mpi/mpi-bit.c +++ b/lib/mpi/mpi-bit.c | |||
| @@ -177,8 +177,8 @@ int mpi_rshift(MPI x, MPI a, unsigned n) | |||
| 177 | */ | 177 | */ |
| 178 | int mpi_lshift_limbs(MPI a, unsigned int count) | 178 | int mpi_lshift_limbs(MPI a, unsigned int count) |
| 179 | { | 179 | { |
| 180 | mpi_ptr_t ap = a->d; | 180 | const int n = a->nlimbs; |
| 181 | int n = a->nlimbs; | 181 | mpi_ptr_t ap; |
| 182 | int i; | 182 | int i; |
| 183 | 183 | ||
| 184 | if (!count || !n) | 184 | if (!count || !n) |
| @@ -187,6 +187,7 @@ int mpi_lshift_limbs(MPI a, unsigned int count) | |||
| 187 | if (RESIZE_IF_NEEDED(a, n + count) < 0) | 187 | if (RESIZE_IF_NEEDED(a, n + count) < 0) |
| 188 | return -ENOMEM; | 188 | return -ENOMEM; |
| 189 | 189 | ||
| 190 | ap = a->d; | ||
| 190 | for (i = n - 1; i >= 0; i--) | 191 | for (i = n - 1; i >= 0; i--) |
| 191 | ap[i + count] = ap[i]; | 192 | ap[i + count] = ap[i]; |
| 192 | for (i = 0; i < count; i++) | 193 | for (i = 0; i < count; i++) |
diff --git a/mm/hugetlb.c b/mm/hugetlb.c index cd65cb19c941..5a16423a512c 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c | |||
| @@ -532,7 +532,7 @@ static struct page *dequeue_huge_page_vma(struct hstate *h, | |||
| 532 | struct vm_area_struct *vma, | 532 | struct vm_area_struct *vma, |
| 533 | unsigned long address, int avoid_reserve) | 533 | unsigned long address, int avoid_reserve) |
| 534 | { | 534 | { |
| 535 | struct page *page; | 535 | struct page *page = NULL; |
| 536 | struct mempolicy *mpol; | 536 | struct mempolicy *mpol; |
| 537 | nodemask_t *nodemask; | 537 | nodemask_t *nodemask; |
| 538 | struct zonelist *zonelist; | 538 | struct zonelist *zonelist; |
diff --git a/mm/memblock.c b/mm/memblock.c index 99f285599501..a44eab3157f8 100644 --- a/mm/memblock.c +++ b/mm/memblock.c | |||
| @@ -330,6 +330,9 @@ static int __init_memblock memblock_add_region(struct memblock_type *type, | |||
| 330 | phys_addr_t end = base + memblock_cap_size(base, &size); | 330 | phys_addr_t end = base + memblock_cap_size(base, &size); |
| 331 | int i, nr_new; | 331 | int i, nr_new; |
| 332 | 332 | ||
| 333 | if (!size) | ||
| 334 | return 0; | ||
| 335 | |||
| 333 | /* special case for empty array */ | 336 | /* special case for empty array */ |
| 334 | if (type->regions[0].size == 0) { | 337 | if (type->regions[0].size == 0) { |
| 335 | WARN_ON(type->cnt != 1 || type->total_size); | 338 | WARN_ON(type->cnt != 1 || type->total_size); |
| @@ -430,6 +433,9 @@ static int __init_memblock memblock_isolate_range(struct memblock_type *type, | |||
| 430 | 433 | ||
| 431 | *start_rgn = *end_rgn = 0; | 434 | *start_rgn = *end_rgn = 0; |
| 432 | 435 | ||
| 436 | if (!size) | ||
| 437 | return 0; | ||
| 438 | |||
| 433 | /* we'll create at most two more regions */ | 439 | /* we'll create at most two more regions */ |
| 434 | while (type->cnt + 2 > type->max) | 440 | while (type->cnt + 2 > type->max) |
| 435 | if (memblock_double_array(type) < 0) | 441 | if (memblock_double_array(type) < 0) |
| @@ -514,7 +520,6 @@ int __init_memblock memblock_reserve(phys_addr_t base, phys_addr_t size) | |||
| 514 | (unsigned long long)base, | 520 | (unsigned long long)base, |
| 515 | (unsigned long long)base + size, | 521 | (unsigned long long)base + size, |
| 516 | (void *)_RET_IP_); | 522 | (void *)_RET_IP_); |
| 517 | BUG_ON(0 == size); | ||
| 518 | 523 | ||
| 519 | return memblock_add_region(_rgn, base, size, MAX_NUMNODES); | 524 | return memblock_add_region(_rgn, base, size, MAX_NUMNODES); |
| 520 | } | 525 | } |
diff --git a/mm/memcontrol.c b/mm/memcontrol.c index a7165a60d0a7..31ab9c3f0178 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c | |||
| @@ -2476,10 +2476,10 @@ struct mem_cgroup *try_get_mem_cgroup_from_page(struct page *page) | |||
| 2476 | static void __mem_cgroup_commit_charge(struct mem_cgroup *memcg, | 2476 | static void __mem_cgroup_commit_charge(struct mem_cgroup *memcg, |
| 2477 | struct page *page, | 2477 | struct page *page, |
| 2478 | unsigned int nr_pages, | 2478 | unsigned int nr_pages, |
| 2479 | struct page_cgroup *pc, | ||
| 2480 | enum charge_type ctype, | 2479 | enum charge_type ctype, |
| 2481 | bool lrucare) | 2480 | bool lrucare) |
| 2482 | { | 2481 | { |
| 2482 | struct page_cgroup *pc = lookup_page_cgroup(page); | ||
| 2483 | struct zone *uninitialized_var(zone); | 2483 | struct zone *uninitialized_var(zone); |
| 2484 | bool was_on_lru = false; | 2484 | bool was_on_lru = false; |
| 2485 | bool anon; | 2485 | bool anon; |
| @@ -2716,7 +2716,6 @@ static int mem_cgroup_charge_common(struct page *page, struct mm_struct *mm, | |||
| 2716 | { | 2716 | { |
| 2717 | struct mem_cgroup *memcg = NULL; | 2717 | struct mem_cgroup *memcg = NULL; |
| 2718 | unsigned int nr_pages = 1; | 2718 | unsigned int nr_pages = 1; |
| 2719 | struct page_cgroup *pc; | ||
| 2720 | bool oom = true; | 2719 | bool oom = true; |
| 2721 | int ret; | 2720 | int ret; |
| 2722 | 2721 | ||
| @@ -2730,11 +2729,10 @@ static int mem_cgroup_charge_common(struct page *page, struct mm_struct *mm, | |||
| 2730 | oom = false; | 2729 | oom = false; |
| 2731 | } | 2730 | } |
| 2732 | 2731 | ||
| 2733 | pc = lookup_page_cgroup(page); | ||
| 2734 | ret = __mem_cgroup_try_charge(mm, gfp_mask, nr_pages, &memcg, oom); | 2732 | ret = __mem_cgroup_try_charge(mm, gfp_mask, nr_pages, &memcg, oom); |
| 2735 | if (ret == -ENOMEM) | 2733 | if (ret == -ENOMEM) |
| 2736 | return ret; | 2734 | return ret; |
| 2737 | __mem_cgroup_commit_charge(memcg, page, nr_pages, pc, ctype, false); | 2735 | __mem_cgroup_commit_charge(memcg, page, nr_pages, ctype, false); |
| 2738 | return 0; | 2736 | return 0; |
| 2739 | } | 2737 | } |
| 2740 | 2738 | ||
| @@ -2831,16 +2829,13 @@ static void | |||
| 2831 | __mem_cgroup_commit_charge_swapin(struct page *page, struct mem_cgroup *memcg, | 2829 | __mem_cgroup_commit_charge_swapin(struct page *page, struct mem_cgroup *memcg, |
| 2832 | enum charge_type ctype) | 2830 | enum charge_type ctype) |
| 2833 | { | 2831 | { |
| 2834 | struct page_cgroup *pc; | ||
| 2835 | |||
| 2836 | if (mem_cgroup_disabled()) | 2832 | if (mem_cgroup_disabled()) |
| 2837 | return; | 2833 | return; |
| 2838 | if (!memcg) | 2834 | if (!memcg) |
| 2839 | return; | 2835 | return; |
| 2840 | cgroup_exclude_rmdir(&memcg->css); | 2836 | cgroup_exclude_rmdir(&memcg->css); |
| 2841 | 2837 | ||
| 2842 | pc = lookup_page_cgroup(page); | 2838 | __mem_cgroup_commit_charge(memcg, page, 1, ctype, true); |
| 2843 | __mem_cgroup_commit_charge(memcg, page, 1, pc, ctype, true); | ||
| 2844 | /* | 2839 | /* |
| 2845 | * Now swap is on-memory. This means this page may be | 2840 | * Now swap is on-memory. This means this page may be |
| 2846 | * counted both as mem and swap....double count. | 2841 | * counted both as mem and swap....double count. |
| @@ -3298,14 +3293,13 @@ int mem_cgroup_prepare_migration(struct page *page, | |||
| 3298 | * page. In the case new page is migrated but not remapped, new page's | 3293 | * page. In the case new page is migrated but not remapped, new page's |
| 3299 | * mapcount will be finally 0 and we call uncharge in end_migration(). | 3294 | * mapcount will be finally 0 and we call uncharge in end_migration(). |
| 3300 | */ | 3295 | */ |
| 3301 | pc = lookup_page_cgroup(newpage); | ||
| 3302 | if (PageAnon(page)) | 3296 | if (PageAnon(page)) |
| 3303 | ctype = MEM_CGROUP_CHARGE_TYPE_MAPPED; | 3297 | ctype = MEM_CGROUP_CHARGE_TYPE_MAPPED; |
| 3304 | else if (page_is_file_cache(page)) | 3298 | else if (page_is_file_cache(page)) |
| 3305 | ctype = MEM_CGROUP_CHARGE_TYPE_CACHE; | 3299 | ctype = MEM_CGROUP_CHARGE_TYPE_CACHE; |
| 3306 | else | 3300 | else |
| 3307 | ctype = MEM_CGROUP_CHARGE_TYPE_SHMEM; | 3301 | ctype = MEM_CGROUP_CHARGE_TYPE_SHMEM; |
| 3308 | __mem_cgroup_commit_charge(memcg, newpage, 1, pc, ctype, false); | 3302 | __mem_cgroup_commit_charge(memcg, newpage, 1, ctype, false); |
| 3309 | return ret; | 3303 | return ret; |
| 3310 | } | 3304 | } |
| 3311 | 3305 | ||
| @@ -3392,7 +3386,7 @@ void mem_cgroup_replace_page_cache(struct page *oldpage, | |||
| 3392 | * the newpage may be on LRU(or pagevec for LRU) already. We lock | 3386 | * the newpage may be on LRU(or pagevec for LRU) already. We lock |
| 3393 | * LRU while we overwrite pc->mem_cgroup. | 3387 | * LRU while we overwrite pc->mem_cgroup. |
| 3394 | */ | 3388 | */ |
| 3395 | __mem_cgroup_commit_charge(memcg, newpage, 1, pc, type, true); | 3389 | __mem_cgroup_commit_charge(memcg, newpage, 1, type, true); |
| 3396 | } | 3390 | } |
| 3397 | 3391 | ||
| 3398 | #ifdef CONFIG_DEBUG_VM | 3392 | #ifdef CONFIG_DEBUG_VM |
diff --git a/mm/mempolicy.c b/mm/mempolicy.c index cfb6c8678754..b19569137529 100644 --- a/mm/mempolicy.c +++ b/mm/mempolicy.c | |||
| @@ -1361,11 +1361,14 @@ SYSCALL_DEFINE4(migrate_pages, pid_t, pid, unsigned long, maxnode, | |||
| 1361 | 1361 | ||
| 1362 | mm = get_task_mm(task); | 1362 | mm = get_task_mm(task); |
| 1363 | put_task_struct(task); | 1363 | put_task_struct(task); |
| 1364 | if (mm) | 1364 | |
| 1365 | err = do_migrate_pages(mm, old, new, | 1365 | if (!mm) { |
| 1366 | capable(CAP_SYS_NICE) ? MPOL_MF_MOVE_ALL : MPOL_MF_MOVE); | ||
| 1367 | else | ||
| 1368 | err = -EINVAL; | 1366 | err = -EINVAL; |
| 1367 | goto out; | ||
| 1368 | } | ||
| 1369 | |||
| 1370 | err = do_migrate_pages(mm, old, new, | ||
| 1371 | capable(CAP_SYS_NICE) ? MPOL_MF_MOVE_ALL : MPOL_MF_MOVE); | ||
| 1369 | 1372 | ||
| 1370 | mmput(mm); | 1373 | mmput(mm); |
| 1371 | out: | 1374 | out: |
diff --git a/mm/migrate.c b/mm/migrate.c index 51c08a0c6f68..11072383ae12 100644 --- a/mm/migrate.c +++ b/mm/migrate.c | |||
| @@ -1388,14 +1388,14 @@ SYSCALL_DEFINE6(move_pages, pid_t, pid, unsigned long, nr_pages, | |||
| 1388 | mm = get_task_mm(task); | 1388 | mm = get_task_mm(task); |
| 1389 | put_task_struct(task); | 1389 | put_task_struct(task); |
| 1390 | 1390 | ||
| 1391 | if (mm) { | 1391 | if (!mm) |
| 1392 | if (nodes) | 1392 | return -EINVAL; |
| 1393 | err = do_pages_move(mm, task_nodes, nr_pages, pages, | 1393 | |
| 1394 | nodes, status, flags); | 1394 | if (nodes) |
| 1395 | else | 1395 | err = do_pages_move(mm, task_nodes, nr_pages, pages, |
| 1396 | err = do_pages_stat(mm, nr_pages, pages, status); | 1396 | nodes, status, flags); |
| 1397 | } else | 1397 | else |
| 1398 | err = -EINVAL; | 1398 | err = do_pages_stat(mm, nr_pages, pages, status); |
| 1399 | 1399 | ||
| 1400 | mmput(mm); | 1400 | mmput(mm); |
| 1401 | return err; | 1401 | return err; |
| @@ -240,6 +240,8 @@ static struct vm_area_struct *remove_vma(struct vm_area_struct *vma) | |||
| 240 | return next; | 240 | return next; |
| 241 | } | 241 | } |
| 242 | 242 | ||
| 243 | static unsigned long do_brk(unsigned long addr, unsigned long len); | ||
| 244 | |||
| 243 | SYSCALL_DEFINE1(brk, unsigned long, brk) | 245 | SYSCALL_DEFINE1(brk, unsigned long, brk) |
| 244 | { | 246 | { |
| 245 | unsigned long rlim, retval; | 247 | unsigned long rlim, retval; |
| @@ -951,7 +953,7 @@ static inline unsigned long round_hint_to_min(unsigned long hint) | |||
| 951 | * The caller must hold down_write(¤t->mm->mmap_sem). | 953 | * The caller must hold down_write(¤t->mm->mmap_sem). |
| 952 | */ | 954 | */ |
| 953 | 955 | ||
| 954 | unsigned long do_mmap_pgoff(struct file *file, unsigned long addr, | 956 | static unsigned long do_mmap_pgoff(struct file *file, unsigned long addr, |
| 955 | unsigned long len, unsigned long prot, | 957 | unsigned long len, unsigned long prot, |
| 956 | unsigned long flags, unsigned long pgoff) | 958 | unsigned long flags, unsigned long pgoff) |
| 957 | { | 959 | { |
| @@ -1087,7 +1089,32 @@ unsigned long do_mmap_pgoff(struct file *file, unsigned long addr, | |||
| 1087 | 1089 | ||
| 1088 | return mmap_region(file, addr, len, flags, vm_flags, pgoff); | 1090 | return mmap_region(file, addr, len, flags, vm_flags, pgoff); |
| 1089 | } | 1091 | } |
| 1090 | EXPORT_SYMBOL(do_mmap_pgoff); | 1092 | |
| 1093 | unsigned long do_mmap(struct file *file, unsigned long addr, | ||
| 1094 | unsigned long len, unsigned long prot, | ||
| 1095 | unsigned long flag, unsigned long offset) | ||
| 1096 | { | ||
| 1097 | if (unlikely(offset + PAGE_ALIGN(len) < offset)) | ||
| 1098 | return -EINVAL; | ||
| 1099 | if (unlikely(offset & ~PAGE_MASK)) | ||
| 1100 | return -EINVAL; | ||
| 1101 | return do_mmap_pgoff(file, addr, len, prot, flag, offset >> PAGE_SHIFT); | ||
| 1102 | } | ||
| 1103 | EXPORT_SYMBOL(do_mmap); | ||
| 1104 | |||
| 1105 | unsigned long vm_mmap(struct file *file, unsigned long addr, | ||
| 1106 | unsigned long len, unsigned long prot, | ||
| 1107 | unsigned long flag, unsigned long offset) | ||
| 1108 | { | ||
| 1109 | unsigned long ret; | ||
| 1110 | struct mm_struct *mm = current->mm; | ||
| 1111 | |||
| 1112 | down_write(&mm->mmap_sem); | ||
| 1113 | ret = do_mmap(file, addr, len, prot, flag, offset); | ||
| 1114 | up_write(&mm->mmap_sem); | ||
| 1115 | return ret; | ||
| 1116 | } | ||
| 1117 | EXPORT_SYMBOL(vm_mmap); | ||
| 1091 | 1118 | ||
| 1092 | SYSCALL_DEFINE6(mmap_pgoff, unsigned long, addr, unsigned long, len, | 1119 | SYSCALL_DEFINE6(mmap_pgoff, unsigned long, addr, unsigned long, len, |
| 1093 | unsigned long, prot, unsigned long, flags, | 1120 | unsigned long, prot, unsigned long, flags, |
| @@ -2105,21 +2132,25 @@ int do_munmap(struct mm_struct *mm, unsigned long start, size_t len) | |||
| 2105 | 2132 | ||
| 2106 | return 0; | 2133 | return 0; |
| 2107 | } | 2134 | } |
| 2108 | |||
| 2109 | EXPORT_SYMBOL(do_munmap); | 2135 | EXPORT_SYMBOL(do_munmap); |
| 2110 | 2136 | ||
| 2111 | SYSCALL_DEFINE2(munmap, unsigned long, addr, size_t, len) | 2137 | int vm_munmap(unsigned long start, size_t len) |
| 2112 | { | 2138 | { |
| 2113 | int ret; | 2139 | int ret; |
| 2114 | struct mm_struct *mm = current->mm; | 2140 | struct mm_struct *mm = current->mm; |
| 2115 | 2141 | ||
| 2116 | profile_munmap(addr); | ||
| 2117 | |||
| 2118 | down_write(&mm->mmap_sem); | 2142 | down_write(&mm->mmap_sem); |
| 2119 | ret = do_munmap(mm, addr, len); | 2143 | ret = do_munmap(mm, start, len); |
| 2120 | up_write(&mm->mmap_sem); | 2144 | up_write(&mm->mmap_sem); |
| 2121 | return ret; | 2145 | return ret; |
| 2122 | } | 2146 | } |
| 2147 | EXPORT_SYMBOL(vm_munmap); | ||
| 2148 | |||
| 2149 | SYSCALL_DEFINE2(munmap, unsigned long, addr, size_t, len) | ||
| 2150 | { | ||
| 2151 | profile_munmap(addr); | ||
| 2152 | return vm_munmap(addr, len); | ||
| 2153 | } | ||
| 2123 | 2154 | ||
| 2124 | static inline void verify_mm_writelocked(struct mm_struct *mm) | 2155 | static inline void verify_mm_writelocked(struct mm_struct *mm) |
| 2125 | { | 2156 | { |
| @@ -2136,7 +2167,7 @@ static inline void verify_mm_writelocked(struct mm_struct *mm) | |||
| 2136 | * anonymous maps. eventually we may be able to do some | 2167 | * anonymous maps. eventually we may be able to do some |
| 2137 | * brk-specific accounting here. | 2168 | * brk-specific accounting here. |
| 2138 | */ | 2169 | */ |
| 2139 | unsigned long do_brk(unsigned long addr, unsigned long len) | 2170 | static unsigned long do_brk(unsigned long addr, unsigned long len) |
| 2140 | { | 2171 | { |
| 2141 | struct mm_struct * mm = current->mm; | 2172 | struct mm_struct * mm = current->mm; |
| 2142 | struct vm_area_struct * vma, * prev; | 2173 | struct vm_area_struct * vma, * prev; |
| @@ -2232,7 +2263,17 @@ out: | |||
| 2232 | return addr; | 2263 | return addr; |
| 2233 | } | 2264 | } |
| 2234 | 2265 | ||
| 2235 | EXPORT_SYMBOL(do_brk); | 2266 | unsigned long vm_brk(unsigned long addr, unsigned long len) |
| 2267 | { | ||
| 2268 | struct mm_struct *mm = current->mm; | ||
| 2269 | unsigned long ret; | ||
| 2270 | |||
| 2271 | down_write(&mm->mmap_sem); | ||
| 2272 | ret = do_brk(addr, len); | ||
| 2273 | up_write(&mm->mmap_sem); | ||
| 2274 | return ret; | ||
| 2275 | } | ||
| 2276 | EXPORT_SYMBOL(vm_brk); | ||
| 2236 | 2277 | ||
| 2237 | /* Release all mmaps. */ | 2278 | /* Release all mmaps. */ |
| 2238 | void exit_mmap(struct mm_struct *mm) | 2279 | void exit_mmap(struct mm_struct *mm) |
diff --git a/mm/nobootmem.c b/mm/nobootmem.c index 24f0fc1a56d6..e53bb8a256b1 100644 --- a/mm/nobootmem.c +++ b/mm/nobootmem.c | |||
| @@ -298,13 +298,19 @@ void * __init __alloc_bootmem_node(pg_data_t *pgdat, unsigned long size, | |||
| 298 | if (WARN_ON_ONCE(slab_is_available())) | 298 | if (WARN_ON_ONCE(slab_is_available())) |
| 299 | return kzalloc_node(size, GFP_NOWAIT, pgdat->node_id); | 299 | return kzalloc_node(size, GFP_NOWAIT, pgdat->node_id); |
| 300 | 300 | ||
| 301 | again: | ||
| 301 | ptr = __alloc_memory_core_early(pgdat->node_id, size, align, | 302 | ptr = __alloc_memory_core_early(pgdat->node_id, size, align, |
| 302 | goal, -1ULL); | 303 | goal, -1ULL); |
| 303 | if (ptr) | 304 | if (ptr) |
| 304 | return ptr; | 305 | return ptr; |
| 305 | 306 | ||
| 306 | return __alloc_memory_core_early(MAX_NUMNODES, size, align, | 307 | ptr = __alloc_memory_core_early(MAX_NUMNODES, size, align, |
| 307 | goal, -1ULL); | 308 | goal, -1ULL); |
| 309 | if (!ptr && goal) { | ||
| 310 | goal = 0; | ||
| 311 | goto again; | ||
| 312 | } | ||
| 313 | return ptr; | ||
| 308 | } | 314 | } |
| 309 | 315 | ||
| 310 | void * __init __alloc_bootmem_node_high(pg_data_t *pgdat, unsigned long size, | 316 | void * __init __alloc_bootmem_node_high(pg_data_t *pgdat, unsigned long size, |
diff --git a/mm/nommu.c b/mm/nommu.c index f59e170fceb4..bb8f4f004a82 100644 --- a/mm/nommu.c +++ b/mm/nommu.c | |||
| @@ -1233,7 +1233,7 @@ enomem: | |||
| 1233 | /* | 1233 | /* |
| 1234 | * handle mapping creation for uClinux | 1234 | * handle mapping creation for uClinux |
| 1235 | */ | 1235 | */ |
| 1236 | unsigned long do_mmap_pgoff(struct file *file, | 1236 | static unsigned long do_mmap_pgoff(struct file *file, |
| 1237 | unsigned long addr, | 1237 | unsigned long addr, |
| 1238 | unsigned long len, | 1238 | unsigned long len, |
| 1239 | unsigned long prot, | 1239 | unsigned long prot, |
| @@ -1470,7 +1470,32 @@ error_getting_region: | |||
| 1470 | show_free_areas(0); | 1470 | show_free_areas(0); |
| 1471 | return -ENOMEM; | 1471 | return -ENOMEM; |
| 1472 | } | 1472 | } |
| 1473 | EXPORT_SYMBOL(do_mmap_pgoff); | 1473 | |
| 1474 | unsigned long do_mmap(struct file *file, unsigned long addr, | ||
| 1475 | unsigned long len, unsigned long prot, | ||
| 1476 | unsigned long flag, unsigned long offset) | ||
| 1477 | { | ||
| 1478 | if (unlikely(offset + PAGE_ALIGN(len) < offset)) | ||
| 1479 | return -EINVAL; | ||
| 1480 | if (unlikely(offset & ~PAGE_MASK)) | ||
| 1481 | return -EINVAL; | ||
| 1482 | return do_mmap_pgoff(file, addr, len, prot, flag, offset >> PAGE_SHIFT); | ||
| 1483 | } | ||
| 1484 | EXPORT_SYMBOL(do_mmap); | ||
| 1485 | |||
| 1486 | unsigned long vm_mmap(struct file *file, unsigned long addr, | ||
| 1487 | unsigned long len, unsigned long prot, | ||
| 1488 | unsigned long flag, unsigned long offset) | ||
| 1489 | { | ||
| 1490 | unsigned long ret; | ||
| 1491 | struct mm_struct *mm = current->mm; | ||
| 1492 | |||
| 1493 | down_write(&mm->mmap_sem); | ||
| 1494 | ret = do_mmap(file, addr, len, prot, flag, offset); | ||
| 1495 | up_write(&mm->mmap_sem); | ||
| 1496 | return ret; | ||
| 1497 | } | ||
| 1498 | EXPORT_SYMBOL(vm_mmap); | ||
| 1474 | 1499 | ||
| 1475 | SYSCALL_DEFINE6(mmap_pgoff, unsigned long, addr, unsigned long, len, | 1500 | SYSCALL_DEFINE6(mmap_pgoff, unsigned long, addr, unsigned long, len, |
| 1476 | unsigned long, prot, unsigned long, flags, | 1501 | unsigned long, prot, unsigned long, flags, |
| @@ -1709,16 +1734,22 @@ erase_whole_vma: | |||
| 1709 | } | 1734 | } |
| 1710 | EXPORT_SYMBOL(do_munmap); | 1735 | EXPORT_SYMBOL(do_munmap); |
| 1711 | 1736 | ||
| 1712 | SYSCALL_DEFINE2(munmap, unsigned long, addr, size_t, len) | 1737 | int vm_munmap(unsigned long addr, size_t len) |
| 1713 | { | 1738 | { |
| 1714 | int ret; | ||
| 1715 | struct mm_struct *mm = current->mm; | 1739 | struct mm_struct *mm = current->mm; |
| 1740 | int ret; | ||
| 1716 | 1741 | ||
| 1717 | down_write(&mm->mmap_sem); | 1742 | down_write(&mm->mmap_sem); |
| 1718 | ret = do_munmap(mm, addr, len); | 1743 | ret = do_munmap(mm, addr, len); |
| 1719 | up_write(&mm->mmap_sem); | 1744 | up_write(&mm->mmap_sem); |
| 1720 | return ret; | 1745 | return ret; |
| 1721 | } | 1746 | } |
| 1747 | EXPORT_SYMBOL(vm_munmap); | ||
| 1748 | |||
| 1749 | SYSCALL_DEFINE2(munmap, unsigned long, addr, size_t, len) | ||
| 1750 | { | ||
| 1751 | return vm_munmap(addr, len); | ||
| 1752 | } | ||
| 1722 | 1753 | ||
| 1723 | /* | 1754 | /* |
| 1724 | * release all the mappings made in a process's VM space | 1755 | * release all the mappings made in a process's VM space |
| @@ -1744,7 +1775,7 @@ void exit_mmap(struct mm_struct *mm) | |||
| 1744 | kleave(""); | 1775 | kleave(""); |
| 1745 | } | 1776 | } |
| 1746 | 1777 | ||
| 1747 | unsigned long do_brk(unsigned long addr, unsigned long len) | 1778 | unsigned long vm_brk(unsigned long addr, unsigned long len) |
| 1748 | { | 1779 | { |
| 1749 | return -ENOMEM; | 1780 | return -ENOMEM; |
| 1750 | } | 1781 | } |
diff --git a/mm/swap_state.c b/mm/swap_state.c index 9d3dd3763cf7..4c5ff7f284d9 100644 --- a/mm/swap_state.c +++ b/mm/swap_state.c | |||
| @@ -26,7 +26,7 @@ | |||
| 26 | */ | 26 | */ |
| 27 | static const struct address_space_operations swap_aops = { | 27 | static const struct address_space_operations swap_aops = { |
| 28 | .writepage = swap_writepage, | 28 | .writepage = swap_writepage, |
| 29 | .set_page_dirty = __set_page_dirty_nobuffers, | 29 | .set_page_dirty = __set_page_dirty_no_writeback, |
| 30 | .migratepage = migrate_page, | 30 | .migratepage = migrate_page, |
| 31 | }; | 31 | }; |
| 32 | 32 | ||
diff --git a/mm/vmscan.c b/mm/vmscan.c index 1a518684a32f..33dc256033b5 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c | |||
| @@ -1568,9 +1568,14 @@ shrink_inactive_list(unsigned long nr_to_scan, struct mem_cgroup_zone *mz, | |||
| 1568 | reclaim_stat->recent_scanned[0] += nr_anon; | 1568 | reclaim_stat->recent_scanned[0] += nr_anon; |
| 1569 | reclaim_stat->recent_scanned[1] += nr_file; | 1569 | reclaim_stat->recent_scanned[1] += nr_file; |
| 1570 | 1570 | ||
| 1571 | if (current_is_kswapd()) | 1571 | if (global_reclaim(sc)) { |
| 1572 | __count_vm_events(KSWAPD_STEAL, nr_reclaimed); | 1572 | if (current_is_kswapd()) |
| 1573 | __count_zone_vm_events(PGSTEAL, zone, nr_reclaimed); | 1573 | __count_zone_vm_events(PGSTEAL_KSWAPD, zone, |
| 1574 | nr_reclaimed); | ||
| 1575 | else | ||
| 1576 | __count_zone_vm_events(PGSTEAL_DIRECT, zone, | ||
| 1577 | nr_reclaimed); | ||
| 1578 | } | ||
| 1574 | 1579 | ||
| 1575 | putback_inactive_pages(mz, &page_list); | 1580 | putback_inactive_pages(mz, &page_list); |
| 1576 | 1581 | ||
diff --git a/mm/vmstat.c b/mm/vmstat.c index f600557a7659..7db1b9bab492 100644 --- a/mm/vmstat.c +++ b/mm/vmstat.c | |||
| @@ -738,7 +738,8 @@ const char * const vmstat_text[] = { | |||
| 738 | "pgmajfault", | 738 | "pgmajfault", |
| 739 | 739 | ||
| 740 | TEXTS_FOR_ZONES("pgrefill") | 740 | TEXTS_FOR_ZONES("pgrefill") |
| 741 | TEXTS_FOR_ZONES("pgsteal") | 741 | TEXTS_FOR_ZONES("pgsteal_kswapd") |
| 742 | TEXTS_FOR_ZONES("pgsteal_direct") | ||
| 742 | TEXTS_FOR_ZONES("pgscan_kswapd") | 743 | TEXTS_FOR_ZONES("pgscan_kswapd") |
| 743 | TEXTS_FOR_ZONES("pgscan_direct") | 744 | TEXTS_FOR_ZONES("pgscan_direct") |
| 744 | 745 | ||
| @@ -747,7 +748,6 @@ const char * const vmstat_text[] = { | |||
| 747 | #endif | 748 | #endif |
| 748 | "pginodesteal", | 749 | "pginodesteal", |
| 749 | "slabs_scanned", | 750 | "slabs_scanned", |
| 750 | "kswapd_steal", | ||
| 751 | "kswapd_inodesteal", | 751 | "kswapd_inodesteal", |
| 752 | "kswapd_low_wmark_hit_quickly", | 752 | "kswapd_low_wmark_hit_quickly", |
| 753 | "kswapd_high_wmark_hit_quickly", | 753 | "kswapd_high_wmark_hit_quickly", |
diff --git a/net/ax25/af_ax25.c b/net/ax25/af_ax25.c index 0906c194a413..9d9a6a3edbd5 100644 --- a/net/ax25/af_ax25.c +++ b/net/ax25/af_ax25.c | |||
| @@ -2011,16 +2011,17 @@ static void __exit ax25_exit(void) | |||
| 2011 | proc_net_remove(&init_net, "ax25_route"); | 2011 | proc_net_remove(&init_net, "ax25_route"); |
| 2012 | proc_net_remove(&init_net, "ax25"); | 2012 | proc_net_remove(&init_net, "ax25"); |
| 2013 | proc_net_remove(&init_net, "ax25_calls"); | 2013 | proc_net_remove(&init_net, "ax25_calls"); |
| 2014 | ax25_rt_free(); | ||
| 2015 | ax25_uid_free(); | ||
| 2016 | ax25_dev_free(); | ||
| 2017 | 2014 | ||
| 2018 | ax25_unregister_sysctl(); | ||
| 2019 | unregister_netdevice_notifier(&ax25_dev_notifier); | 2015 | unregister_netdevice_notifier(&ax25_dev_notifier); |
| 2016 | ax25_unregister_sysctl(); | ||
| 2020 | 2017 | ||
| 2021 | dev_remove_pack(&ax25_packet_type); | 2018 | dev_remove_pack(&ax25_packet_type); |
| 2022 | 2019 | ||
| 2023 | sock_unregister(PF_AX25); | 2020 | sock_unregister(PF_AX25); |
| 2024 | proto_unregister(&ax25_proto); | 2021 | proto_unregister(&ax25_proto); |
| 2022 | |||
| 2023 | ax25_rt_free(); | ||
| 2024 | ax25_uid_free(); | ||
| 2025 | ax25_dev_free(); | ||
| 2025 | } | 2026 | } |
| 2026 | module_exit(ax25_exit); | 2027 | module_exit(ax25_exit); |
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index 92a857e3786d..edfd61addcec 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c | |||
| @@ -1215,40 +1215,40 @@ struct link_key *hci_find_link_key(struct hci_dev *hdev, bdaddr_t *bdaddr) | |||
| 1215 | return NULL; | 1215 | return NULL; |
| 1216 | } | 1216 | } |
| 1217 | 1217 | ||
| 1218 | static int hci_persistent_key(struct hci_dev *hdev, struct hci_conn *conn, | 1218 | static bool hci_persistent_key(struct hci_dev *hdev, struct hci_conn *conn, |
| 1219 | u8 key_type, u8 old_key_type) | 1219 | u8 key_type, u8 old_key_type) |
| 1220 | { | 1220 | { |
| 1221 | /* Legacy key */ | 1221 | /* Legacy key */ |
| 1222 | if (key_type < 0x03) | 1222 | if (key_type < 0x03) |
| 1223 | return 1; | 1223 | return true; |
| 1224 | 1224 | ||
| 1225 | /* Debug keys are insecure so don't store them persistently */ | 1225 | /* Debug keys are insecure so don't store them persistently */ |
| 1226 | if (key_type == HCI_LK_DEBUG_COMBINATION) | 1226 | if (key_type == HCI_LK_DEBUG_COMBINATION) |
| 1227 | return 0; | 1227 | return false; |
| 1228 | 1228 | ||
| 1229 | /* Changed combination key and there's no previous one */ | 1229 | /* Changed combination key and there's no previous one */ |
| 1230 | if (key_type == HCI_LK_CHANGED_COMBINATION && old_key_type == 0xff) | 1230 | if (key_type == HCI_LK_CHANGED_COMBINATION && old_key_type == 0xff) |
| 1231 | return 0; | 1231 | return false; |
| 1232 | 1232 | ||
| 1233 | /* Security mode 3 case */ | 1233 | /* Security mode 3 case */ |
| 1234 | if (!conn) | 1234 | if (!conn) |
| 1235 | return 1; | 1235 | return true; |
| 1236 | 1236 | ||
| 1237 | /* Neither local nor remote side had no-bonding as requirement */ | 1237 | /* Neither local nor remote side had no-bonding as requirement */ |
| 1238 | if (conn->auth_type > 0x01 && conn->remote_auth > 0x01) | 1238 | if (conn->auth_type > 0x01 && conn->remote_auth > 0x01) |
| 1239 | return 1; | 1239 | return true; |
| 1240 | 1240 | ||
| 1241 | /* Local side had dedicated bonding as requirement */ | 1241 | /* Local side had dedicated bonding as requirement */ |
| 1242 | if (conn->auth_type == 0x02 || conn->auth_type == 0x03) | 1242 | if (conn->auth_type == 0x02 || conn->auth_type == 0x03) |
| 1243 | return 1; | 1243 | return true; |
| 1244 | 1244 | ||
| 1245 | /* Remote side had dedicated bonding as requirement */ | 1245 | /* Remote side had dedicated bonding as requirement */ |
| 1246 | if (conn->remote_auth == 0x02 || conn->remote_auth == 0x03) | 1246 | if (conn->remote_auth == 0x02 || conn->remote_auth == 0x03) |
| 1247 | return 1; | 1247 | return true; |
| 1248 | 1248 | ||
| 1249 | /* If none of the above criteria match, then don't store the key | 1249 | /* If none of the above criteria match, then don't store the key |
| 1250 | * persistently */ | 1250 | * persistently */ |
| 1251 | return 0; | 1251 | return false; |
| 1252 | } | 1252 | } |
| 1253 | 1253 | ||
| 1254 | struct smp_ltk *hci_find_ltk(struct hci_dev *hdev, __le16 ediv, u8 rand[8]) | 1254 | struct smp_ltk *hci_find_ltk(struct hci_dev *hdev, __le16 ediv, u8 rand[8]) |
| @@ -1285,7 +1285,8 @@ int hci_add_link_key(struct hci_dev *hdev, struct hci_conn *conn, int new_key, | |||
| 1285 | bdaddr_t *bdaddr, u8 *val, u8 type, u8 pin_len) | 1285 | bdaddr_t *bdaddr, u8 *val, u8 type, u8 pin_len) |
| 1286 | { | 1286 | { |
| 1287 | struct link_key *key, *old_key; | 1287 | struct link_key *key, *old_key; |
| 1288 | u8 old_key_type, persistent; | 1288 | u8 old_key_type; |
| 1289 | bool persistent; | ||
| 1289 | 1290 | ||
| 1290 | old_key = hci_find_link_key(hdev, bdaddr); | 1291 | old_key = hci_find_link_key(hdev, bdaddr); |
| 1291 | if (old_key) { | 1292 | if (old_key) { |
| @@ -1328,10 +1329,8 @@ int hci_add_link_key(struct hci_dev *hdev, struct hci_conn *conn, int new_key, | |||
| 1328 | 1329 | ||
| 1329 | mgmt_new_link_key(hdev, key, persistent); | 1330 | mgmt_new_link_key(hdev, key, persistent); |
| 1330 | 1331 | ||
| 1331 | if (!persistent) { | 1332 | if (conn) |
| 1332 | list_del(&key->list); | 1333 | conn->flush_key = !persistent; |
| 1333 | kfree(key); | ||
| 1334 | } | ||
| 1335 | 1334 | ||
| 1336 | return 0; | 1335 | return 0; |
| 1337 | } | 1336 | } |
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c index b37531094c49..6c065254afc0 100644 --- a/net/bluetooth/hci_event.c +++ b/net/bluetooth/hci_event.c | |||
| @@ -1901,6 +1901,8 @@ static inline void hci_disconn_complete_evt(struct hci_dev *hdev, struct sk_buff | |||
| 1901 | } | 1901 | } |
| 1902 | 1902 | ||
| 1903 | if (ev->status == 0) { | 1903 | if (ev->status == 0) { |
| 1904 | if (conn->type == ACL_LINK && conn->flush_key) | ||
| 1905 | hci_remove_link_key(hdev, &conn->dst); | ||
| 1904 | hci_proto_disconn_cfm(conn, ev->reason); | 1906 | hci_proto_disconn_cfm(conn, ev->reason); |
| 1905 | hci_conn_del(conn); | 1907 | hci_conn_del(conn); |
| 1906 | } | 1908 | } |
| @@ -2311,6 +2313,7 @@ static inline void hci_cmd_complete_evt(struct hci_dev *hdev, struct sk_buff *sk | |||
| 2311 | 2313 | ||
| 2312 | case HCI_OP_USER_PASSKEY_NEG_REPLY: | 2314 | case HCI_OP_USER_PASSKEY_NEG_REPLY: |
| 2313 | hci_cc_user_passkey_neg_reply(hdev, skb); | 2315 | hci_cc_user_passkey_neg_reply(hdev, skb); |
| 2316 | break; | ||
| 2314 | 2317 | ||
| 2315 | case HCI_OP_LE_SET_SCAN_PARAM: | 2318 | case HCI_OP_LE_SET_SCAN_PARAM: |
| 2316 | hci_cc_le_set_scan_param(hdev, skb); | 2319 | hci_cc_le_set_scan_param(hdev, skb); |
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c index 4ef275c69675..4bb03b111122 100644 --- a/net/bluetooth/mgmt.c +++ b/net/bluetooth/mgmt.c | |||
| @@ -2884,7 +2884,7 @@ int mgmt_write_scan_failed(struct hci_dev *hdev, u8 scan, u8 status) | |||
| 2884 | return 0; | 2884 | return 0; |
| 2885 | } | 2885 | } |
| 2886 | 2886 | ||
| 2887 | int mgmt_new_link_key(struct hci_dev *hdev, struct link_key *key, u8 persistent) | 2887 | int mgmt_new_link_key(struct hci_dev *hdev, struct link_key *key, bool persistent) |
| 2888 | { | 2888 | { |
| 2889 | struct mgmt_ev_new_link_key ev; | 2889 | struct mgmt_ev_new_link_key ev; |
| 2890 | 2890 | ||
diff --git a/net/bridge/br_forward.c b/net/bridge/br_forward.c index 61f65344e711..a2098e3de500 100644 --- a/net/bridge/br_forward.c +++ b/net/bridge/br_forward.c | |||
| @@ -47,6 +47,7 @@ int br_dev_queue_push_xmit(struct sk_buff *skb) | |||
| 47 | kfree_skb(skb); | 47 | kfree_skb(skb); |
| 48 | } else { | 48 | } else { |
| 49 | skb_push(skb, ETH_HLEN); | 49 | skb_push(skb, ETH_HLEN); |
| 50 | br_drop_fake_rtable(skb); | ||
| 50 | dev_queue_xmit(skb); | 51 | dev_queue_xmit(skb); |
| 51 | } | 52 | } |
| 52 | 53 | ||
diff --git a/net/bridge/br_netfilter.c b/net/bridge/br_netfilter.c index dec4f3817133..d7f49b63ab0f 100644 --- a/net/bridge/br_netfilter.c +++ b/net/bridge/br_netfilter.c | |||
| @@ -156,7 +156,7 @@ void br_netfilter_rtable_init(struct net_bridge *br) | |||
| 156 | rt->dst.dev = br->dev; | 156 | rt->dst.dev = br->dev; |
| 157 | rt->dst.path = &rt->dst; | 157 | rt->dst.path = &rt->dst; |
| 158 | dst_init_metrics(&rt->dst, br_dst_default_metrics, true); | 158 | dst_init_metrics(&rt->dst, br_dst_default_metrics, true); |
| 159 | rt->dst.flags = DST_NOXFRM | DST_NOPEER; | 159 | rt->dst.flags = DST_NOXFRM | DST_NOPEER | DST_FAKE_RTABLE; |
| 160 | rt->dst.ops = &fake_dst_ops; | 160 | rt->dst.ops = &fake_dst_ops; |
| 161 | } | 161 | } |
| 162 | 162 | ||
| @@ -694,11 +694,7 @@ static unsigned int br_nf_local_in(unsigned int hook, struct sk_buff *skb, | |||
| 694 | const struct net_device *out, | 694 | const struct net_device *out, |
| 695 | int (*okfn)(struct sk_buff *)) | 695 | int (*okfn)(struct sk_buff *)) |
| 696 | { | 696 | { |
| 697 | struct rtable *rt = skb_rtable(skb); | 697 | br_drop_fake_rtable(skb); |
| 698 | |||
| 699 | if (rt && rt == bridge_parent_rtable(in)) | ||
| 700 | skb_dst_drop(skb); | ||
| 701 | |||
| 702 | return NF_ACCEPT; | 698 | return NF_ACCEPT; |
| 703 | } | 699 | } |
| 704 | 700 | ||
diff --git a/net/caif/chnl_net.c b/net/caif/chnl_net.c index 20618dd3088b..d09340e1523f 100644 --- a/net/caif/chnl_net.c +++ b/net/caif/chnl_net.c | |||
| @@ -103,6 +103,7 @@ static int chnl_recv_cb(struct cflayer *layr, struct cfpkt *pkt) | |||
| 103 | skb->protocol = htons(ETH_P_IPV6); | 103 | skb->protocol = htons(ETH_P_IPV6); |
| 104 | break; | 104 | break; |
| 105 | default: | 105 | default: |
| 106 | kfree_skb(skb); | ||
| 106 | priv->netdev->stats.rx_errors++; | 107 | priv->netdev->stats.rx_errors++; |
| 107 | return -EINVAL; | 108 | return -EINVAL; |
| 108 | } | 109 | } |
| @@ -220,14 +221,16 @@ static int chnl_net_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
| 220 | 221 | ||
| 221 | if (skb->len > priv->netdev->mtu) { | 222 | if (skb->len > priv->netdev->mtu) { |
| 222 | pr_warn("Size of skb exceeded MTU\n"); | 223 | pr_warn("Size of skb exceeded MTU\n"); |
| 224 | kfree_skb(skb); | ||
| 223 | dev->stats.tx_errors++; | 225 | dev->stats.tx_errors++; |
| 224 | return -ENOSPC; | 226 | return NETDEV_TX_OK; |
| 225 | } | 227 | } |
| 226 | 228 | ||
| 227 | if (!priv->flowenabled) { | 229 | if (!priv->flowenabled) { |
| 228 | pr_debug("dropping packets flow off\n"); | 230 | pr_debug("dropping packets flow off\n"); |
| 231 | kfree_skb(skb); | ||
| 229 | dev->stats.tx_dropped++; | 232 | dev->stats.tx_dropped++; |
| 230 | return NETDEV_TX_BUSY; | 233 | return NETDEV_TX_OK; |
| 231 | } | 234 | } |
| 232 | 235 | ||
| 233 | if (priv->conn_req.protocol == CAIFPROTO_DATAGRAM_LOOP) | 236 | if (priv->conn_req.protocol == CAIFPROTO_DATAGRAM_LOOP) |
| @@ -242,7 +245,7 @@ static int chnl_net_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
| 242 | result = priv->chnl.dn->transmit(priv->chnl.dn, pkt); | 245 | result = priv->chnl.dn->transmit(priv->chnl.dn, pkt); |
| 243 | if (result) { | 246 | if (result) { |
| 244 | dev->stats.tx_dropped++; | 247 | dev->stats.tx_dropped++; |
| 245 | return result; | 248 | return NETDEV_TX_OK; |
| 246 | } | 249 | } |
| 247 | 250 | ||
| 248 | /* Update statistics. */ | 251 | /* Update statistics. */ |
diff --git a/net/core/dev.c b/net/core/dev.c index c25d453b2803..9bb8f87c4cda 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
| @@ -1409,14 +1409,34 @@ EXPORT_SYMBOL(register_netdevice_notifier); | |||
| 1409 | * register_netdevice_notifier(). The notifier is unlinked into the | 1409 | * register_netdevice_notifier(). The notifier is unlinked into the |
| 1410 | * kernel structures and may then be reused. A negative errno code | 1410 | * kernel structures and may then be reused. A negative errno code |
| 1411 | * is returned on a failure. | 1411 | * is returned on a failure. |
| 1412 | * | ||
| 1413 | * After unregistering unregister and down device events are synthesized | ||
| 1414 | * for all devices on the device list to the removed notifier to remove | ||
| 1415 | * the need for special case cleanup code. | ||
| 1412 | */ | 1416 | */ |
| 1413 | 1417 | ||
| 1414 | int unregister_netdevice_notifier(struct notifier_block *nb) | 1418 | int unregister_netdevice_notifier(struct notifier_block *nb) |
| 1415 | { | 1419 | { |
| 1420 | struct net_device *dev; | ||
| 1421 | struct net *net; | ||
| 1416 | int err; | 1422 | int err; |
| 1417 | 1423 | ||
| 1418 | rtnl_lock(); | 1424 | rtnl_lock(); |
| 1419 | err = raw_notifier_chain_unregister(&netdev_chain, nb); | 1425 | err = raw_notifier_chain_unregister(&netdev_chain, nb); |
| 1426 | if (err) | ||
| 1427 | goto unlock; | ||
| 1428 | |||
| 1429 | for_each_net(net) { | ||
| 1430 | for_each_netdev(net, dev) { | ||
| 1431 | if (dev->flags & IFF_UP) { | ||
| 1432 | nb->notifier_call(nb, NETDEV_GOING_DOWN, dev); | ||
| 1433 | nb->notifier_call(nb, NETDEV_DOWN, dev); | ||
| 1434 | } | ||
| 1435 | nb->notifier_call(nb, NETDEV_UNREGISTER, dev); | ||
| 1436 | nb->notifier_call(nb, NETDEV_UNREGISTER_BATCH, dev); | ||
| 1437 | } | ||
| 1438 | } | ||
| 1439 | unlock: | ||
| 1420 | rtnl_unlock(); | 1440 | rtnl_unlock(); |
| 1421 | return err; | 1441 | return err; |
| 1422 | } | 1442 | } |
diff --git a/net/core/drop_monitor.c b/net/core/drop_monitor.c index 7f36b38e060f..a7cad741df01 100644 --- a/net/core/drop_monitor.c +++ b/net/core/drop_monitor.c | |||
| @@ -42,13 +42,14 @@ static void send_dm_alert(struct work_struct *unused); | |||
| 42 | * netlink alerts | 42 | * netlink alerts |
| 43 | */ | 43 | */ |
| 44 | static int trace_state = TRACE_OFF; | 44 | static int trace_state = TRACE_OFF; |
| 45 | static DEFINE_SPINLOCK(trace_state_lock); | 45 | static DEFINE_MUTEX(trace_state_mutex); |
| 46 | 46 | ||
| 47 | struct per_cpu_dm_data { | 47 | struct per_cpu_dm_data { |
| 48 | struct work_struct dm_alert_work; | 48 | struct work_struct dm_alert_work; |
| 49 | struct sk_buff *skb; | 49 | struct sk_buff __rcu *skb; |
| 50 | atomic_t dm_hit_count; | 50 | atomic_t dm_hit_count; |
| 51 | struct timer_list send_timer; | 51 | struct timer_list send_timer; |
| 52 | int cpu; | ||
| 52 | }; | 53 | }; |
| 53 | 54 | ||
| 54 | struct dm_hw_stat_delta { | 55 | struct dm_hw_stat_delta { |
| @@ -79,29 +80,53 @@ static void reset_per_cpu_data(struct per_cpu_dm_data *data) | |||
| 79 | size_t al; | 80 | size_t al; |
| 80 | struct net_dm_alert_msg *msg; | 81 | struct net_dm_alert_msg *msg; |
| 81 | struct nlattr *nla; | 82 | struct nlattr *nla; |
| 83 | struct sk_buff *skb; | ||
| 84 | struct sk_buff *oskb = rcu_dereference_protected(data->skb, 1); | ||
| 82 | 85 | ||
| 83 | al = sizeof(struct net_dm_alert_msg); | 86 | al = sizeof(struct net_dm_alert_msg); |
| 84 | al += dm_hit_limit * sizeof(struct net_dm_drop_point); | 87 | al += dm_hit_limit * sizeof(struct net_dm_drop_point); |
| 85 | al += sizeof(struct nlattr); | 88 | al += sizeof(struct nlattr); |
| 86 | 89 | ||
| 87 | data->skb = genlmsg_new(al, GFP_KERNEL); | 90 | skb = genlmsg_new(al, GFP_KERNEL); |
| 88 | genlmsg_put(data->skb, 0, 0, &net_drop_monitor_family, | 91 | |
| 89 | 0, NET_DM_CMD_ALERT); | 92 | if (skb) { |
| 90 | nla = nla_reserve(data->skb, NLA_UNSPEC, sizeof(struct net_dm_alert_msg)); | 93 | genlmsg_put(skb, 0, 0, &net_drop_monitor_family, |
| 91 | msg = nla_data(nla); | 94 | 0, NET_DM_CMD_ALERT); |
| 92 | memset(msg, 0, al); | 95 | nla = nla_reserve(skb, NLA_UNSPEC, |
| 93 | atomic_set(&data->dm_hit_count, dm_hit_limit); | 96 | sizeof(struct net_dm_alert_msg)); |
| 97 | msg = nla_data(nla); | ||
| 98 | memset(msg, 0, al); | ||
| 99 | } else | ||
| 100 | schedule_work_on(data->cpu, &data->dm_alert_work); | ||
| 101 | |||
| 102 | /* | ||
| 103 | * Don't need to lock this, since we are guaranteed to only | ||
| 104 | * run this on a single cpu at a time. | ||
| 105 | * Note also that we only update data->skb if the old and new skb | ||
| 106 | * pointers don't match. This ensures that we don't continually call | ||
| 107 | * synchornize_rcu if we repeatedly fail to alloc a new netlink message. | ||
| 108 | */ | ||
| 109 | if (skb != oskb) { | ||
| 110 | rcu_assign_pointer(data->skb, skb); | ||
| 111 | |||
| 112 | synchronize_rcu(); | ||
| 113 | |||
| 114 | atomic_set(&data->dm_hit_count, dm_hit_limit); | ||
| 115 | } | ||
| 116 | |||
| 94 | } | 117 | } |
| 95 | 118 | ||
| 96 | static void send_dm_alert(struct work_struct *unused) | 119 | static void send_dm_alert(struct work_struct *unused) |
| 97 | { | 120 | { |
| 98 | struct sk_buff *skb; | 121 | struct sk_buff *skb; |
| 99 | struct per_cpu_dm_data *data = &__get_cpu_var(dm_cpu_data); | 122 | struct per_cpu_dm_data *data = &get_cpu_var(dm_cpu_data); |
| 123 | |||
| 124 | WARN_ON_ONCE(data->cpu != smp_processor_id()); | ||
| 100 | 125 | ||
| 101 | /* | 126 | /* |
| 102 | * Grab the skb we're about to send | 127 | * Grab the skb we're about to send |
| 103 | */ | 128 | */ |
| 104 | skb = data->skb; | 129 | skb = rcu_dereference_protected(data->skb, 1); |
| 105 | 130 | ||
| 106 | /* | 131 | /* |
| 107 | * Replace it with a new one | 132 | * Replace it with a new one |
| @@ -111,8 +136,10 @@ static void send_dm_alert(struct work_struct *unused) | |||
| 111 | /* | 136 | /* |
| 112 | * Ship it! | 137 | * Ship it! |
| 113 | */ | 138 | */ |
| 114 | genlmsg_multicast(skb, 0, NET_DM_GRP_ALERT, GFP_KERNEL); | 139 | if (skb) |
| 140 | genlmsg_multicast(skb, 0, NET_DM_GRP_ALERT, GFP_KERNEL); | ||
| 115 | 141 | ||
| 142 | put_cpu_var(dm_cpu_data); | ||
| 116 | } | 143 | } |
| 117 | 144 | ||
| 118 | /* | 145 | /* |
| @@ -123,9 +150,11 @@ static void send_dm_alert(struct work_struct *unused) | |||
| 123 | */ | 150 | */ |
| 124 | static void sched_send_work(unsigned long unused) | 151 | static void sched_send_work(unsigned long unused) |
| 125 | { | 152 | { |
| 126 | struct per_cpu_dm_data *data = &__get_cpu_var(dm_cpu_data); | 153 | struct per_cpu_dm_data *data = &get_cpu_var(dm_cpu_data); |
| 154 | |||
| 155 | schedule_work_on(smp_processor_id(), &data->dm_alert_work); | ||
| 127 | 156 | ||
| 128 | schedule_work(&data->dm_alert_work); | 157 | put_cpu_var(dm_cpu_data); |
| 129 | } | 158 | } |
| 130 | 159 | ||
| 131 | static void trace_drop_common(struct sk_buff *skb, void *location) | 160 | static void trace_drop_common(struct sk_buff *skb, void *location) |
| @@ -134,8 +163,15 @@ static void trace_drop_common(struct sk_buff *skb, void *location) | |||
| 134 | struct nlmsghdr *nlh; | 163 | struct nlmsghdr *nlh; |
| 135 | struct nlattr *nla; | 164 | struct nlattr *nla; |
| 136 | int i; | 165 | int i; |
| 137 | struct per_cpu_dm_data *data = &__get_cpu_var(dm_cpu_data); | 166 | struct sk_buff *dskb; |
| 167 | struct per_cpu_dm_data *data = &get_cpu_var(dm_cpu_data); | ||
| 168 | |||
| 169 | |||
| 170 | rcu_read_lock(); | ||
| 171 | dskb = rcu_dereference(data->skb); | ||
| 138 | 172 | ||
| 173 | if (!dskb) | ||
| 174 | goto out; | ||
| 139 | 175 | ||
| 140 | if (!atomic_add_unless(&data->dm_hit_count, -1, 0)) { | 176 | if (!atomic_add_unless(&data->dm_hit_count, -1, 0)) { |
| 141 | /* | 177 | /* |
| @@ -144,12 +180,13 @@ static void trace_drop_common(struct sk_buff *skb, void *location) | |||
| 144 | goto out; | 180 | goto out; |
| 145 | } | 181 | } |
| 146 | 182 | ||
| 147 | nlh = (struct nlmsghdr *)data->skb->data; | 183 | nlh = (struct nlmsghdr *)dskb->data; |
| 148 | nla = genlmsg_data(nlmsg_data(nlh)); | 184 | nla = genlmsg_data(nlmsg_data(nlh)); |
| 149 | msg = nla_data(nla); | 185 | msg = nla_data(nla); |
| 150 | for (i = 0; i < msg->entries; i++) { | 186 | for (i = 0; i < msg->entries; i++) { |
| 151 | if (!memcmp(&location, msg->points[i].pc, sizeof(void *))) { | 187 | if (!memcmp(&location, msg->points[i].pc, sizeof(void *))) { |
| 152 | msg->points[i].count++; | 188 | msg->points[i].count++; |
| 189 | atomic_inc(&data->dm_hit_count); | ||
| 153 | goto out; | 190 | goto out; |
| 154 | } | 191 | } |
| 155 | } | 192 | } |
| @@ -157,7 +194,7 @@ static void trace_drop_common(struct sk_buff *skb, void *location) | |||
| 157 | /* | 194 | /* |
| 158 | * We need to create a new entry | 195 | * We need to create a new entry |
| 159 | */ | 196 | */ |
| 160 | __nla_reserve_nohdr(data->skb, sizeof(struct net_dm_drop_point)); | 197 | __nla_reserve_nohdr(dskb, sizeof(struct net_dm_drop_point)); |
| 161 | nla->nla_len += NLA_ALIGN(sizeof(struct net_dm_drop_point)); | 198 | nla->nla_len += NLA_ALIGN(sizeof(struct net_dm_drop_point)); |
| 162 | memcpy(msg->points[msg->entries].pc, &location, sizeof(void *)); | 199 | memcpy(msg->points[msg->entries].pc, &location, sizeof(void *)); |
| 163 | msg->points[msg->entries].count = 1; | 200 | msg->points[msg->entries].count = 1; |
| @@ -169,6 +206,8 @@ static void trace_drop_common(struct sk_buff *skb, void *location) | |||
| 169 | } | 206 | } |
| 170 | 207 | ||
| 171 | out: | 208 | out: |
| 209 | rcu_read_unlock(); | ||
| 210 | put_cpu_var(dm_cpu_data); | ||
| 172 | return; | 211 | return; |
| 173 | } | 212 | } |
| 174 | 213 | ||
| @@ -213,7 +252,7 @@ static int set_all_monitor_traces(int state) | |||
| 213 | struct dm_hw_stat_delta *new_stat = NULL; | 252 | struct dm_hw_stat_delta *new_stat = NULL; |
| 214 | struct dm_hw_stat_delta *temp; | 253 | struct dm_hw_stat_delta *temp; |
| 215 | 254 | ||
| 216 | spin_lock(&trace_state_lock); | 255 | mutex_lock(&trace_state_mutex); |
| 217 | 256 | ||
| 218 | if (state == trace_state) { | 257 | if (state == trace_state) { |
| 219 | rc = -EAGAIN; | 258 | rc = -EAGAIN; |
| @@ -252,7 +291,7 @@ static int set_all_monitor_traces(int state) | |||
| 252 | rc = -EINPROGRESS; | 291 | rc = -EINPROGRESS; |
| 253 | 292 | ||
| 254 | out_unlock: | 293 | out_unlock: |
| 255 | spin_unlock(&trace_state_lock); | 294 | mutex_unlock(&trace_state_mutex); |
| 256 | 295 | ||
| 257 | return rc; | 296 | return rc; |
| 258 | } | 297 | } |
| @@ -295,12 +334,12 @@ static int dropmon_net_event(struct notifier_block *ev_block, | |||
| 295 | 334 | ||
| 296 | new_stat->dev = dev; | 335 | new_stat->dev = dev; |
| 297 | new_stat->last_rx = jiffies; | 336 | new_stat->last_rx = jiffies; |
| 298 | spin_lock(&trace_state_lock); | 337 | mutex_lock(&trace_state_mutex); |
| 299 | list_add_rcu(&new_stat->list, &hw_stats_list); | 338 | list_add_rcu(&new_stat->list, &hw_stats_list); |
| 300 | spin_unlock(&trace_state_lock); | 339 | mutex_unlock(&trace_state_mutex); |
| 301 | break; | 340 | break; |
| 302 | case NETDEV_UNREGISTER: | 341 | case NETDEV_UNREGISTER: |
| 303 | spin_lock(&trace_state_lock); | 342 | mutex_lock(&trace_state_mutex); |
| 304 | list_for_each_entry_safe(new_stat, tmp, &hw_stats_list, list) { | 343 | list_for_each_entry_safe(new_stat, tmp, &hw_stats_list, list) { |
| 305 | if (new_stat->dev == dev) { | 344 | if (new_stat->dev == dev) { |
| 306 | new_stat->dev = NULL; | 345 | new_stat->dev = NULL; |
| @@ -311,7 +350,7 @@ static int dropmon_net_event(struct notifier_block *ev_block, | |||
| 311 | } | 350 | } |
| 312 | } | 351 | } |
| 313 | } | 352 | } |
| 314 | spin_unlock(&trace_state_lock); | 353 | mutex_unlock(&trace_state_mutex); |
| 315 | break; | 354 | break; |
| 316 | } | 355 | } |
| 317 | out: | 356 | out: |
| @@ -367,13 +406,15 @@ static int __init init_net_drop_monitor(void) | |||
| 367 | 406 | ||
| 368 | for_each_present_cpu(cpu) { | 407 | for_each_present_cpu(cpu) { |
| 369 | data = &per_cpu(dm_cpu_data, cpu); | 408 | data = &per_cpu(dm_cpu_data, cpu); |
| 370 | reset_per_cpu_data(data); | 409 | data->cpu = cpu; |
| 371 | INIT_WORK(&data->dm_alert_work, send_dm_alert); | 410 | INIT_WORK(&data->dm_alert_work, send_dm_alert); |
| 372 | init_timer(&data->send_timer); | 411 | init_timer(&data->send_timer); |
| 373 | data->send_timer.data = cpu; | 412 | data->send_timer.data = cpu; |
| 374 | data->send_timer.function = sched_send_work; | 413 | data->send_timer.function = sched_send_work; |
| 414 | reset_per_cpu_data(data); | ||
| 375 | } | 415 | } |
| 376 | 416 | ||
| 417 | |||
| 377 | goto out; | 418 | goto out; |
| 378 | 419 | ||
| 379 | out_unreg: | 420 | out_unreg: |
diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c index 0e950fda9a0a..31a5ae51a45c 100644 --- a/net/core/net_namespace.c +++ b/net/core/net_namespace.c | |||
| @@ -83,21 +83,29 @@ assign: | |||
| 83 | 83 | ||
| 84 | static int ops_init(const struct pernet_operations *ops, struct net *net) | 84 | static int ops_init(const struct pernet_operations *ops, struct net *net) |
| 85 | { | 85 | { |
| 86 | int err; | 86 | int err = -ENOMEM; |
| 87 | void *data = NULL; | ||
| 88 | |||
| 87 | if (ops->id && ops->size) { | 89 | if (ops->id && ops->size) { |
| 88 | void *data = kzalloc(ops->size, GFP_KERNEL); | 90 | data = kzalloc(ops->size, GFP_KERNEL); |
| 89 | if (!data) | 91 | if (!data) |
| 90 | return -ENOMEM; | 92 | goto out; |
| 91 | 93 | ||
| 92 | err = net_assign_generic(net, *ops->id, data); | 94 | err = net_assign_generic(net, *ops->id, data); |
| 93 | if (err) { | 95 | if (err) |
| 94 | kfree(data); | 96 | goto cleanup; |
| 95 | return err; | ||
| 96 | } | ||
| 97 | } | 97 | } |
| 98 | err = 0; | ||
| 98 | if (ops->init) | 99 | if (ops->init) |
| 99 | return ops->init(net); | 100 | err = ops->init(net); |
| 100 | return 0; | 101 | if (!err) |
| 102 | return 0; | ||
| 103 | |||
| 104 | cleanup: | ||
| 105 | kfree(data); | ||
| 106 | |||
| 107 | out: | ||
| 108 | return err; | ||
| 101 | } | 109 | } |
| 102 | 110 | ||
| 103 | static void ops_free(const struct pernet_operations *ops, struct net *net) | 111 | static void ops_free(const struct pernet_operations *ops, struct net *net) |
| @@ -448,12 +456,7 @@ static void __unregister_pernet_operations(struct pernet_operations *ops) | |||
| 448 | static int __register_pernet_operations(struct list_head *list, | 456 | static int __register_pernet_operations(struct list_head *list, |
| 449 | struct pernet_operations *ops) | 457 | struct pernet_operations *ops) |
| 450 | { | 458 | { |
| 451 | int err = 0; | 459 | return ops_init(ops, &init_net); |
| 452 | err = ops_init(ops, &init_net); | ||
| 453 | if (err) | ||
| 454 | ops_free(ops, &init_net); | ||
| 455 | return err; | ||
| 456 | |||
| 457 | } | 460 | } |
| 458 | 461 | ||
| 459 | static void __unregister_pernet_operations(struct pernet_operations *ops) | 462 | static void __unregister_pernet_operations(struct pernet_operations *ops) |
diff --git a/net/ieee802154/6lowpan.c b/net/ieee802154/6lowpan.c index 368515885368..840821b90bcd 100644 --- a/net/ieee802154/6lowpan.c +++ b/net/ieee802154/6lowpan.c | |||
| @@ -1044,6 +1044,24 @@ static void lowpan_dev_free(struct net_device *dev) | |||
| 1044 | free_netdev(dev); | 1044 | free_netdev(dev); |
| 1045 | } | 1045 | } |
| 1046 | 1046 | ||
| 1047 | static struct wpan_phy *lowpan_get_phy(const struct net_device *dev) | ||
| 1048 | { | ||
| 1049 | struct net_device *real_dev = lowpan_dev_info(dev)->real_dev; | ||
| 1050 | return ieee802154_mlme_ops(real_dev)->get_phy(real_dev); | ||
| 1051 | } | ||
| 1052 | |||
| 1053 | static u16 lowpan_get_pan_id(const struct net_device *dev) | ||
| 1054 | { | ||
| 1055 | struct net_device *real_dev = lowpan_dev_info(dev)->real_dev; | ||
| 1056 | return ieee802154_mlme_ops(real_dev)->get_pan_id(real_dev); | ||
| 1057 | } | ||
| 1058 | |||
| 1059 | static u16 lowpan_get_short_addr(const struct net_device *dev) | ||
| 1060 | { | ||
| 1061 | struct net_device *real_dev = lowpan_dev_info(dev)->real_dev; | ||
| 1062 | return ieee802154_mlme_ops(real_dev)->get_short_addr(real_dev); | ||
| 1063 | } | ||
| 1064 | |||
| 1047 | static struct header_ops lowpan_header_ops = { | 1065 | static struct header_ops lowpan_header_ops = { |
| 1048 | .create = lowpan_header_create, | 1066 | .create = lowpan_header_create, |
| 1049 | }; | 1067 | }; |
| @@ -1053,6 +1071,12 @@ static const struct net_device_ops lowpan_netdev_ops = { | |||
| 1053 | .ndo_set_mac_address = eth_mac_addr, | 1071 | .ndo_set_mac_address = eth_mac_addr, |
| 1054 | }; | 1072 | }; |
| 1055 | 1073 | ||
| 1074 | static struct ieee802154_mlme_ops lowpan_mlme = { | ||
| 1075 | .get_pan_id = lowpan_get_pan_id, | ||
| 1076 | .get_phy = lowpan_get_phy, | ||
| 1077 | .get_short_addr = lowpan_get_short_addr, | ||
| 1078 | }; | ||
| 1079 | |||
| 1056 | static void lowpan_setup(struct net_device *dev) | 1080 | static void lowpan_setup(struct net_device *dev) |
| 1057 | { | 1081 | { |
| 1058 | pr_debug("(%s)\n", __func__); | 1082 | pr_debug("(%s)\n", __func__); |
| @@ -1070,6 +1094,7 @@ static void lowpan_setup(struct net_device *dev) | |||
| 1070 | 1094 | ||
| 1071 | dev->netdev_ops = &lowpan_netdev_ops; | 1095 | dev->netdev_ops = &lowpan_netdev_ops; |
| 1072 | dev->header_ops = &lowpan_header_ops; | 1096 | dev->header_ops = &lowpan_header_ops; |
| 1097 | dev->ml_priv = &lowpan_mlme; | ||
| 1073 | dev->destructor = lowpan_dev_free; | 1098 | dev->destructor = lowpan_dev_free; |
| 1074 | } | 1099 | } |
| 1075 | 1100 | ||
| @@ -1143,6 +1168,8 @@ static int lowpan_newlink(struct net *src_net, struct net_device *dev, | |||
| 1143 | list_add_tail(&entry->list, &lowpan_devices); | 1168 | list_add_tail(&entry->list, &lowpan_devices); |
| 1144 | mutex_unlock(&lowpan_dev_info(dev)->dev_list_mtx); | 1169 | mutex_unlock(&lowpan_dev_info(dev)->dev_list_mtx); |
| 1145 | 1170 | ||
| 1171 | spin_lock_init(&flist_lock); | ||
| 1172 | |||
| 1146 | register_netdevice(dev); | 1173 | register_netdevice(dev); |
| 1147 | 1174 | ||
| 1148 | return 0; | 1175 | return 0; |
| @@ -1152,11 +1179,20 @@ static void lowpan_dellink(struct net_device *dev, struct list_head *head) | |||
| 1152 | { | 1179 | { |
| 1153 | struct lowpan_dev_info *lowpan_dev = lowpan_dev_info(dev); | 1180 | struct lowpan_dev_info *lowpan_dev = lowpan_dev_info(dev); |
| 1154 | struct net_device *real_dev = lowpan_dev->real_dev; | 1181 | struct net_device *real_dev = lowpan_dev->real_dev; |
| 1155 | struct lowpan_dev_record *entry; | 1182 | struct lowpan_dev_record *entry, *tmp; |
| 1156 | struct lowpan_dev_record *tmp; | 1183 | struct lowpan_fragment *frame, *tframe; |
| 1157 | 1184 | ||
| 1158 | ASSERT_RTNL(); | 1185 | ASSERT_RTNL(); |
| 1159 | 1186 | ||
| 1187 | spin_lock(&flist_lock); | ||
| 1188 | list_for_each_entry_safe(frame, tframe, &lowpan_fragments, list) { | ||
| 1189 | del_timer(&frame->timer); | ||
| 1190 | list_del(&frame->list); | ||
| 1191 | dev_kfree_skb(frame->skb); | ||
| 1192 | kfree(frame); | ||
| 1193 | } | ||
| 1194 | spin_unlock(&flist_lock); | ||
| 1195 | |||
| 1160 | mutex_lock(&lowpan_dev_info(dev)->dev_list_mtx); | 1196 | mutex_lock(&lowpan_dev_info(dev)->dev_list_mtx); |
| 1161 | list_for_each_entry_safe(entry, tmp, &lowpan_devices, list) { | 1197 | list_for_each_entry_safe(entry, tmp, &lowpan_devices, list) { |
| 1162 | if (entry->ldev == dev) { | 1198 | if (entry->ldev == dev) { |
diff --git a/net/ipv4/inet_diag.c b/net/ipv4/inet_diag.c index 8d25a1c557eb..8f8db724bfaf 100644 --- a/net/ipv4/inet_diag.c +++ b/net/ipv4/inet_diag.c | |||
| @@ -141,7 +141,7 @@ int inet_sk_diag_fill(struct sock *sk, struct inet_connection_sock *icsk, | |||
| 141 | goto rtattr_failure; | 141 | goto rtattr_failure; |
| 142 | 142 | ||
| 143 | if (icsk == NULL) { | 143 | if (icsk == NULL) { |
| 144 | r->idiag_rqueue = r->idiag_wqueue = 0; | 144 | handler->idiag_get_info(sk, r, NULL); |
| 145 | goto out; | 145 | goto out; |
| 146 | } | 146 | } |
| 147 | 147 | ||
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index 8bb6adeb62c0..1272a88c2a63 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c | |||
| @@ -3243,7 +3243,7 @@ void __init tcp_init(void) | |||
| 3243 | { | 3243 | { |
| 3244 | struct sk_buff *skb = NULL; | 3244 | struct sk_buff *skb = NULL; |
| 3245 | unsigned long limit; | 3245 | unsigned long limit; |
| 3246 | int max_share, cnt; | 3246 | int max_rshare, max_wshare, cnt; |
| 3247 | unsigned int i; | 3247 | unsigned int i; |
| 3248 | unsigned long jiffy = jiffies; | 3248 | unsigned long jiffy = jiffies; |
| 3249 | 3249 | ||
| @@ -3303,15 +3303,16 @@ void __init tcp_init(void) | |||
| 3303 | tcp_init_mem(&init_net); | 3303 | tcp_init_mem(&init_net); |
| 3304 | /* Set per-socket limits to no more than 1/128 the pressure threshold */ | 3304 | /* Set per-socket limits to no more than 1/128 the pressure threshold */ |
| 3305 | limit = nr_free_buffer_pages() << (PAGE_SHIFT - 7); | 3305 | limit = nr_free_buffer_pages() << (PAGE_SHIFT - 7); |
| 3306 | max_share = min(4UL*1024*1024, limit); | 3306 | max_wshare = min(4UL*1024*1024, limit); |
| 3307 | max_rshare = min(6UL*1024*1024, limit); | ||
| 3307 | 3308 | ||
| 3308 | sysctl_tcp_wmem[0] = SK_MEM_QUANTUM; | 3309 | sysctl_tcp_wmem[0] = SK_MEM_QUANTUM; |
| 3309 | sysctl_tcp_wmem[1] = 16*1024; | 3310 | sysctl_tcp_wmem[1] = 16*1024; |
| 3310 | sysctl_tcp_wmem[2] = max(64*1024, max_share); | 3311 | sysctl_tcp_wmem[2] = max(64*1024, max_wshare); |
| 3311 | 3312 | ||
| 3312 | sysctl_tcp_rmem[0] = SK_MEM_QUANTUM; | 3313 | sysctl_tcp_rmem[0] = SK_MEM_QUANTUM; |
| 3313 | sysctl_tcp_rmem[1] = 87380; | 3314 | sysctl_tcp_rmem[1] = 87380; |
| 3314 | sysctl_tcp_rmem[2] = max(87380, max_share); | 3315 | sysctl_tcp_rmem[2] = max(87380, max_rshare); |
| 3315 | 3316 | ||
| 3316 | pr_info("Hash tables configured (established %u bind %u)\n", | 3317 | pr_info("Hash tables configured (established %u bind %u)\n", |
| 3317 | tcp_hashinfo.ehash_mask + 1, tcp_hashinfo.bhash_size); | 3318 | tcp_hashinfo.ehash_mask + 1, tcp_hashinfo.bhash_size); |
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index 9944c1d9a218..257b61789eeb 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c | |||
| @@ -85,7 +85,7 @@ int sysctl_tcp_ecn __read_mostly = 2; | |||
| 85 | EXPORT_SYMBOL(sysctl_tcp_ecn); | 85 | EXPORT_SYMBOL(sysctl_tcp_ecn); |
| 86 | int sysctl_tcp_dsack __read_mostly = 1; | 86 | int sysctl_tcp_dsack __read_mostly = 1; |
| 87 | int sysctl_tcp_app_win __read_mostly = 31; | 87 | int sysctl_tcp_app_win __read_mostly = 31; |
| 88 | int sysctl_tcp_adv_win_scale __read_mostly = 2; | 88 | int sysctl_tcp_adv_win_scale __read_mostly = 1; |
| 89 | EXPORT_SYMBOL(sysctl_tcp_adv_win_scale); | 89 | EXPORT_SYMBOL(sysctl_tcp_adv_win_scale); |
| 90 | 90 | ||
| 91 | int sysctl_tcp_stdurg __read_mostly; | 91 | int sysctl_tcp_stdurg __read_mostly; |
| @@ -335,6 +335,7 @@ static void tcp_grow_window(struct sock *sk, const struct sk_buff *skb) | |||
| 335 | incr = __tcp_grow_window(sk, skb); | 335 | incr = __tcp_grow_window(sk, skb); |
| 336 | 336 | ||
| 337 | if (incr) { | 337 | if (incr) { |
| 338 | incr = max_t(int, incr, 2 * skb->len); | ||
| 338 | tp->rcv_ssthresh = min(tp->rcv_ssthresh + incr, | 339 | tp->rcv_ssthresh = min(tp->rcv_ssthresh + incr, |
| 339 | tp->window_clamp); | 340 | tp->window_clamp); |
| 340 | inet_csk(sk)->icsk_ack.quick |= 1; | 341 | inet_csk(sk)->icsk_ack.quick |= 1; |
| @@ -494,7 +495,7 @@ static inline void tcp_rcv_rtt_measure(struct tcp_sock *tp) | |||
| 494 | goto new_measure; | 495 | goto new_measure; |
| 495 | if (before(tp->rcv_nxt, tp->rcv_rtt_est.seq)) | 496 | if (before(tp->rcv_nxt, tp->rcv_rtt_est.seq)) |
| 496 | return; | 497 | return; |
| 497 | tcp_rcv_rtt_update(tp, jiffies - tp->rcv_rtt_est.time, 1); | 498 | tcp_rcv_rtt_update(tp, tcp_time_stamp - tp->rcv_rtt_est.time, 1); |
| 498 | 499 | ||
| 499 | new_measure: | 500 | new_measure: |
| 500 | tp->rcv_rtt_est.seq = tp->rcv_nxt + tp->rcv_wnd; | 501 | tp->rcv_rtt_est.seq = tp->rcv_nxt + tp->rcv_wnd; |
| @@ -2867,11 +2868,14 @@ static inline void tcp_complete_cwr(struct sock *sk) | |||
| 2867 | 2868 | ||
| 2868 | /* Do not moderate cwnd if it's already undone in cwr or recovery. */ | 2869 | /* Do not moderate cwnd if it's already undone in cwr or recovery. */ |
| 2869 | if (tp->undo_marker) { | 2870 | if (tp->undo_marker) { |
| 2870 | if (inet_csk(sk)->icsk_ca_state == TCP_CA_CWR) | 2871 | if (inet_csk(sk)->icsk_ca_state == TCP_CA_CWR) { |
| 2871 | tp->snd_cwnd = min(tp->snd_cwnd, tp->snd_ssthresh); | 2872 | tp->snd_cwnd = min(tp->snd_cwnd, tp->snd_ssthresh); |
| 2872 | else /* PRR */ | 2873 | tp->snd_cwnd_stamp = tcp_time_stamp; |
| 2874 | } else if (tp->snd_ssthresh < TCP_INFINITE_SSTHRESH) { | ||
| 2875 | /* PRR algorithm. */ | ||
| 2873 | tp->snd_cwnd = tp->snd_ssthresh; | 2876 | tp->snd_cwnd = tp->snd_ssthresh; |
| 2874 | tp->snd_cwnd_stamp = tcp_time_stamp; | 2877 | tp->snd_cwnd_stamp = tcp_time_stamp; |
| 2878 | } | ||
| 2875 | } | 2879 | } |
| 2876 | tcp_ca_event(sk, CA_EVENT_COMPLETE_CWR); | 2880 | tcp_ca_event(sk, CA_EVENT_COMPLETE_CWR); |
| 2877 | } | 2881 | } |
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index 376b2cfbb685..7ac6423117ad 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c | |||
| @@ -1096,6 +1096,7 @@ static void __pskb_trim_head(struct sk_buff *skb, int len) | |||
| 1096 | eat = min_t(int, len, skb_headlen(skb)); | 1096 | eat = min_t(int, len, skb_headlen(skb)); |
| 1097 | if (eat) { | 1097 | if (eat) { |
| 1098 | __skb_pull(skb, eat); | 1098 | __skb_pull(skb, eat); |
| 1099 | skb->avail_size -= eat; | ||
| 1099 | len -= eat; | 1100 | len -= eat; |
| 1100 | if (!len) | 1101 | if (!len) |
| 1101 | return; | 1102 | return; |
diff --git a/net/ipv4/udp_diag.c b/net/ipv4/udp_diag.c index 8a949f19deb6..a7f86a3cd502 100644 --- a/net/ipv4/udp_diag.c +++ b/net/ipv4/udp_diag.c | |||
| @@ -146,9 +146,17 @@ static int udp_diag_dump_one(struct sk_buff *in_skb, const struct nlmsghdr *nlh, | |||
| 146 | return udp_dump_one(&udp_table, in_skb, nlh, req); | 146 | return udp_dump_one(&udp_table, in_skb, nlh, req); |
| 147 | } | 147 | } |
| 148 | 148 | ||
| 149 | static void udp_diag_get_info(struct sock *sk, struct inet_diag_msg *r, | ||
| 150 | void *info) | ||
| 151 | { | ||
| 152 | r->idiag_rqueue = sk_rmem_alloc_get(sk); | ||
| 153 | r->idiag_wqueue = sk_wmem_alloc_get(sk); | ||
| 154 | } | ||
| 155 | |||
| 149 | static const struct inet_diag_handler udp_diag_handler = { | 156 | static const struct inet_diag_handler udp_diag_handler = { |
| 150 | .dump = udp_diag_dump, | 157 | .dump = udp_diag_dump, |
| 151 | .dump_one = udp_diag_dump_one, | 158 | .dump_one = udp_diag_dump_one, |
| 159 | .idiag_get_info = udp_diag_get_info, | ||
| 152 | .idiag_type = IPPROTO_UDP, | 160 | .idiag_type = IPPROTO_UDP, |
| 153 | }; | 161 | }; |
| 154 | 162 | ||
| @@ -167,6 +175,7 @@ static int udplite_diag_dump_one(struct sk_buff *in_skb, const struct nlmsghdr * | |||
| 167 | static const struct inet_diag_handler udplite_diag_handler = { | 175 | static const struct inet_diag_handler udplite_diag_handler = { |
| 168 | .dump = udplite_diag_dump, | 176 | .dump = udplite_diag_dump, |
| 169 | .dump_one = udplite_diag_dump_one, | 177 | .dump_one = udplite_diag_dump_one, |
| 178 | .idiag_get_info = udp_diag_get_info, | ||
| 170 | .idiag_type = IPPROTO_UDPLITE, | 179 | .idiag_type = IPPROTO_UDPLITE, |
| 171 | }; | 180 | }; |
| 172 | 181 | ||
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index 6a3bb6077e19..7d5cb975cc6f 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c | |||
| @@ -803,8 +803,7 @@ static void ipv6_del_addr(struct inet6_ifaddr *ifp) | |||
| 803 | ip6_del_rt(rt); | 803 | ip6_del_rt(rt); |
| 804 | rt = NULL; | 804 | rt = NULL; |
| 805 | } else if (!(rt->rt6i_flags & RTF_EXPIRES)) { | 805 | } else if (!(rt->rt6i_flags & RTF_EXPIRES)) { |
| 806 | rt->dst.expires = expires; | 806 | rt6_set_expires(rt, expires); |
| 807 | rt->rt6i_flags |= RTF_EXPIRES; | ||
| 808 | } | 807 | } |
| 809 | } | 808 | } |
| 810 | dst_release(&rt->dst); | 809 | dst_release(&rt->dst); |
| @@ -1887,11 +1886,9 @@ void addrconf_prefix_rcv(struct net_device *dev, u8 *opt, int len, bool sllao) | |||
| 1887 | rt = NULL; | 1886 | rt = NULL; |
| 1888 | } else if (addrconf_finite_timeout(rt_expires)) { | 1887 | } else if (addrconf_finite_timeout(rt_expires)) { |
| 1889 | /* not infinity */ | 1888 | /* not infinity */ |
| 1890 | rt->dst.expires = jiffies + rt_expires; | 1889 | rt6_set_expires(rt, jiffies + rt_expires); |
| 1891 | rt->rt6i_flags |= RTF_EXPIRES; | ||
| 1892 | } else { | 1890 | } else { |
| 1893 | rt->rt6i_flags &= ~RTF_EXPIRES; | 1891 | rt6_clean_expires(rt); |
| 1894 | rt->dst.expires = 0; | ||
| 1895 | } | 1892 | } |
| 1896 | } else if (valid_lft) { | 1893 | } else if (valid_lft) { |
| 1897 | clock_t expires = 0; | 1894 | clock_t expires = 0; |
diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c index 5b27fbcae346..93717435013e 100644 --- a/net/ipv6/ip6_fib.c +++ b/net/ipv6/ip6_fib.c | |||
| @@ -673,11 +673,10 @@ static int fib6_add_rt2node(struct fib6_node *fn, struct rt6_info *rt, | |||
| 673 | &rt->rt6i_gateway)) { | 673 | &rt->rt6i_gateway)) { |
| 674 | if (!(iter->rt6i_flags & RTF_EXPIRES)) | 674 | if (!(iter->rt6i_flags & RTF_EXPIRES)) |
| 675 | return -EEXIST; | 675 | return -EEXIST; |
| 676 | iter->dst.expires = rt->dst.expires; | 676 | if (!(rt->rt6i_flags & RTF_EXPIRES)) |
| 677 | if (!(rt->rt6i_flags & RTF_EXPIRES)) { | 677 | rt6_clean_expires(iter); |
| 678 | iter->rt6i_flags &= ~RTF_EXPIRES; | 678 | else |
| 679 | iter->dst.expires = 0; | 679 | rt6_set_expires(iter, rt->dst.expires); |
| 680 | } | ||
| 681 | return -EEXIST; | 680 | return -EEXIST; |
| 682 | } | 681 | } |
| 683 | } | 682 | } |
diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c index 3dcdb81ec3e8..176b469322ac 100644 --- a/net/ipv6/ndisc.c +++ b/net/ipv6/ndisc.c | |||
| @@ -1264,8 +1264,7 @@ static void ndisc_router_discovery(struct sk_buff *skb) | |||
| 1264 | } | 1264 | } |
| 1265 | 1265 | ||
| 1266 | if (rt) | 1266 | if (rt) |
| 1267 | rt->dst.expires = jiffies + (HZ * lifetime); | 1267 | rt6_set_expires(rt, jiffies + (HZ * lifetime)); |
| 1268 | |||
| 1269 | if (ra_msg->icmph.icmp6_hop_limit) { | 1268 | if (ra_msg->icmph.icmp6_hop_limit) { |
| 1270 | in6_dev->cnf.hop_limit = ra_msg->icmph.icmp6_hop_limit; | 1269 | in6_dev->cnf.hop_limit = ra_msg->icmph.icmp6_hop_limit; |
| 1271 | if (rt) | 1270 | if (rt) |
diff --git a/net/ipv6/route.c b/net/ipv6/route.c index 3992e26a6039..bc4888d902b2 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c | |||
| @@ -62,7 +62,7 @@ | |||
| 62 | #include <linux/sysctl.h> | 62 | #include <linux/sysctl.h> |
| 63 | #endif | 63 | #endif |
| 64 | 64 | ||
| 65 | static struct rt6_info *ip6_rt_copy(const struct rt6_info *ort, | 65 | static struct rt6_info *ip6_rt_copy(struct rt6_info *ort, |
| 66 | const struct in6_addr *dest); | 66 | const struct in6_addr *dest); |
| 67 | static struct dst_entry *ip6_dst_check(struct dst_entry *dst, u32 cookie); | 67 | static struct dst_entry *ip6_dst_check(struct dst_entry *dst, u32 cookie); |
| 68 | static unsigned int ip6_default_advmss(const struct dst_entry *dst); | 68 | static unsigned int ip6_default_advmss(const struct dst_entry *dst); |
| @@ -285,6 +285,10 @@ static void ip6_dst_destroy(struct dst_entry *dst) | |||
| 285 | rt->rt6i_idev = NULL; | 285 | rt->rt6i_idev = NULL; |
| 286 | in6_dev_put(idev); | 286 | in6_dev_put(idev); |
| 287 | } | 287 | } |
| 288 | |||
| 289 | if (!(rt->rt6i_flags & RTF_EXPIRES) && dst->from) | ||
| 290 | dst_release(dst->from); | ||
| 291 | |||
| 288 | if (peer) { | 292 | if (peer) { |
| 289 | rt->rt6i_peer = NULL; | 293 | rt->rt6i_peer = NULL; |
| 290 | inet_putpeer(peer); | 294 | inet_putpeer(peer); |
| @@ -329,8 +333,17 @@ static void ip6_dst_ifdown(struct dst_entry *dst, struct net_device *dev, | |||
| 329 | 333 | ||
| 330 | static __inline__ int rt6_check_expired(const struct rt6_info *rt) | 334 | static __inline__ int rt6_check_expired(const struct rt6_info *rt) |
| 331 | { | 335 | { |
| 332 | return (rt->rt6i_flags & RTF_EXPIRES) && | 336 | struct rt6_info *ort = NULL; |
| 333 | time_after(jiffies, rt->dst.expires); | 337 | |
| 338 | if (rt->rt6i_flags & RTF_EXPIRES) { | ||
| 339 | if (time_after(jiffies, rt->dst.expires)) | ||
| 340 | return 1; | ||
| 341 | } else if (rt->dst.from) { | ||
| 342 | ort = (struct rt6_info *) rt->dst.from; | ||
| 343 | return (ort->rt6i_flags & RTF_EXPIRES) && | ||
| 344 | time_after(jiffies, ort->dst.expires); | ||
| 345 | } | ||
| 346 | return 0; | ||
| 334 | } | 347 | } |
| 335 | 348 | ||
| 336 | static inline int rt6_need_strict(const struct in6_addr *daddr) | 349 | static inline int rt6_need_strict(const struct in6_addr *daddr) |
| @@ -620,12 +633,11 @@ int rt6_route_rcv(struct net_device *dev, u8 *opt, int len, | |||
| 620 | (rt->rt6i_flags & ~RTF_PREF_MASK) | RTF_PREF(pref); | 633 | (rt->rt6i_flags & ~RTF_PREF_MASK) | RTF_PREF(pref); |
| 621 | 634 | ||
| 622 | if (rt) { | 635 | if (rt) { |
| 623 | if (!addrconf_finite_timeout(lifetime)) { | 636 | if (!addrconf_finite_timeout(lifetime)) |
| 624 | rt->rt6i_flags &= ~RTF_EXPIRES; | 637 | rt6_clean_expires(rt); |
| 625 | } else { | 638 | else |
| 626 | rt->dst.expires = jiffies + HZ * lifetime; | 639 | rt6_set_expires(rt, jiffies + HZ * lifetime); |
| 627 | rt->rt6i_flags |= RTF_EXPIRES; | 640 | |
| 628 | } | ||
| 629 | dst_release(&rt->dst); | 641 | dst_release(&rt->dst); |
| 630 | } | 642 | } |
| 631 | return 0; | 643 | return 0; |
| @@ -730,7 +742,7 @@ int ip6_ins_rt(struct rt6_info *rt) | |||
| 730 | return __ip6_ins_rt(rt, &info); | 742 | return __ip6_ins_rt(rt, &info); |
| 731 | } | 743 | } |
| 732 | 744 | ||
| 733 | static struct rt6_info *rt6_alloc_cow(const struct rt6_info *ort, | 745 | static struct rt6_info *rt6_alloc_cow(struct rt6_info *ort, |
| 734 | const struct in6_addr *daddr, | 746 | const struct in6_addr *daddr, |
| 735 | const struct in6_addr *saddr) | 747 | const struct in6_addr *saddr) |
| 736 | { | 748 | { |
| @@ -954,10 +966,10 @@ struct dst_entry *ip6_blackhole_route(struct net *net, struct dst_entry *dst_ori | |||
| 954 | rt->rt6i_idev = ort->rt6i_idev; | 966 | rt->rt6i_idev = ort->rt6i_idev; |
| 955 | if (rt->rt6i_idev) | 967 | if (rt->rt6i_idev) |
| 956 | in6_dev_hold(rt->rt6i_idev); | 968 | in6_dev_hold(rt->rt6i_idev); |
| 957 | rt->dst.expires = 0; | ||
| 958 | 969 | ||
| 959 | rt->rt6i_gateway = ort->rt6i_gateway; | 970 | rt->rt6i_gateway = ort->rt6i_gateway; |
| 960 | rt->rt6i_flags = ort->rt6i_flags & ~RTF_EXPIRES; | 971 | rt->rt6i_flags = ort->rt6i_flags; |
| 972 | rt6_clean_expires(rt); | ||
| 961 | rt->rt6i_metric = 0; | 973 | rt->rt6i_metric = 0; |
| 962 | 974 | ||
| 963 | memcpy(&rt->rt6i_dst, &ort->rt6i_dst, sizeof(struct rt6key)); | 975 | memcpy(&rt->rt6i_dst, &ort->rt6i_dst, sizeof(struct rt6key)); |
| @@ -1019,10 +1031,9 @@ static void ip6_link_failure(struct sk_buff *skb) | |||
| 1019 | 1031 | ||
| 1020 | rt = (struct rt6_info *) skb_dst(skb); | 1032 | rt = (struct rt6_info *) skb_dst(skb); |
| 1021 | if (rt) { | 1033 | if (rt) { |
| 1022 | if (rt->rt6i_flags & RTF_CACHE) { | 1034 | if (rt->rt6i_flags & RTF_CACHE) |
| 1023 | dst_set_expires(&rt->dst, 0); | 1035 | rt6_update_expires(rt, 0); |
| 1024 | rt->rt6i_flags |= RTF_EXPIRES; | 1036 | else if (rt->rt6i_node && (rt->rt6i_flags & RTF_DEFAULT)) |
| 1025 | } else if (rt->rt6i_node && (rt->rt6i_flags & RTF_DEFAULT)) | ||
| 1026 | rt->rt6i_node->fn_sernum = -1; | 1037 | rt->rt6i_node->fn_sernum = -1; |
| 1027 | } | 1038 | } |
| 1028 | } | 1039 | } |
| @@ -1289,9 +1300,12 @@ int ip6_route_add(struct fib6_config *cfg) | |||
| 1289 | } | 1300 | } |
| 1290 | 1301 | ||
| 1291 | rt->dst.obsolete = -1; | 1302 | rt->dst.obsolete = -1; |
| 1292 | rt->dst.expires = (cfg->fc_flags & RTF_EXPIRES) ? | 1303 | |
| 1293 | jiffies + clock_t_to_jiffies(cfg->fc_expires) : | 1304 | if (cfg->fc_flags & RTF_EXPIRES) |
| 1294 | 0; | 1305 | rt6_set_expires(rt, jiffies + |
| 1306 | clock_t_to_jiffies(cfg->fc_expires)); | ||
| 1307 | else | ||
| 1308 | rt6_clean_expires(rt); | ||
| 1295 | 1309 | ||
| 1296 | if (cfg->fc_protocol == RTPROT_UNSPEC) | 1310 | if (cfg->fc_protocol == RTPROT_UNSPEC) |
| 1297 | cfg->fc_protocol = RTPROT_BOOT; | 1311 | cfg->fc_protocol = RTPROT_BOOT; |
| @@ -1736,8 +1750,8 @@ again: | |||
| 1736 | features |= RTAX_FEATURE_ALLFRAG; | 1750 | features |= RTAX_FEATURE_ALLFRAG; |
| 1737 | dst_metric_set(&rt->dst, RTAX_FEATURES, features); | 1751 | dst_metric_set(&rt->dst, RTAX_FEATURES, features); |
| 1738 | } | 1752 | } |
| 1739 | dst_set_expires(&rt->dst, net->ipv6.sysctl.ip6_rt_mtu_expires); | 1753 | rt6_update_expires(rt, net->ipv6.sysctl.ip6_rt_mtu_expires); |
| 1740 | rt->rt6i_flags |= RTF_MODIFIED|RTF_EXPIRES; | 1754 | rt->rt6i_flags |= RTF_MODIFIED; |
| 1741 | goto out; | 1755 | goto out; |
| 1742 | } | 1756 | } |
| 1743 | 1757 | ||
| @@ -1765,9 +1779,8 @@ again: | |||
| 1765 | * which is 10 mins. After 10 mins the decreased pmtu is expired | 1779 | * which is 10 mins. After 10 mins the decreased pmtu is expired |
| 1766 | * and detecting PMTU increase will be automatically happened. | 1780 | * and detecting PMTU increase will be automatically happened. |
| 1767 | */ | 1781 | */ |
| 1768 | dst_set_expires(&nrt->dst, net->ipv6.sysctl.ip6_rt_mtu_expires); | 1782 | rt6_update_expires(nrt, net->ipv6.sysctl.ip6_rt_mtu_expires); |
| 1769 | nrt->rt6i_flags |= RTF_DYNAMIC|RTF_EXPIRES; | 1783 | nrt->rt6i_flags |= RTF_DYNAMIC; |
| 1770 | |||
| 1771 | ip6_ins_rt(nrt); | 1784 | ip6_ins_rt(nrt); |
| 1772 | } | 1785 | } |
| 1773 | out: | 1786 | out: |
| @@ -1799,7 +1812,7 @@ void rt6_pmtu_discovery(const struct in6_addr *daddr, const struct in6_addr *sad | |||
| 1799 | * Misc support functions | 1812 | * Misc support functions |
| 1800 | */ | 1813 | */ |
| 1801 | 1814 | ||
| 1802 | static struct rt6_info *ip6_rt_copy(const struct rt6_info *ort, | 1815 | static struct rt6_info *ip6_rt_copy(struct rt6_info *ort, |
| 1803 | const struct in6_addr *dest) | 1816 | const struct in6_addr *dest) |
| 1804 | { | 1817 | { |
| 1805 | struct net *net = dev_net(ort->dst.dev); | 1818 | struct net *net = dev_net(ort->dst.dev); |
| @@ -1819,10 +1832,14 @@ static struct rt6_info *ip6_rt_copy(const struct rt6_info *ort, | |||
| 1819 | if (rt->rt6i_idev) | 1832 | if (rt->rt6i_idev) |
| 1820 | in6_dev_hold(rt->rt6i_idev); | 1833 | in6_dev_hold(rt->rt6i_idev); |
| 1821 | rt->dst.lastuse = jiffies; | 1834 | rt->dst.lastuse = jiffies; |
| 1822 | rt->dst.expires = 0; | ||
| 1823 | 1835 | ||
| 1824 | rt->rt6i_gateway = ort->rt6i_gateway; | 1836 | rt->rt6i_gateway = ort->rt6i_gateway; |
| 1825 | rt->rt6i_flags = ort->rt6i_flags & ~RTF_EXPIRES; | 1837 | rt->rt6i_flags = ort->rt6i_flags; |
| 1838 | if ((ort->rt6i_flags & (RTF_DEFAULT | RTF_ADDRCONF)) == | ||
| 1839 | (RTF_DEFAULT | RTF_ADDRCONF)) | ||
| 1840 | rt6_set_from(rt, ort); | ||
| 1841 | else | ||
| 1842 | rt6_clean_expires(rt); | ||
| 1826 | rt->rt6i_metric = 0; | 1843 | rt->rt6i_metric = 0; |
| 1827 | 1844 | ||
| 1828 | #ifdef CONFIG_IPV6_SUBTREES | 1845 | #ifdef CONFIG_IPV6_SUBTREES |
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c index 86cfe6005f40..98256cf72f9d 100644 --- a/net/ipv6/tcp_ipv6.c +++ b/net/ipv6/tcp_ipv6.c | |||
| @@ -1383,6 +1383,10 @@ static struct sock * tcp_v6_syn_recv_sock(struct sock *sk, struct sk_buff *skb, | |||
| 1383 | tcp_mtup_init(newsk); | 1383 | tcp_mtup_init(newsk); |
| 1384 | tcp_sync_mss(newsk, dst_mtu(dst)); | 1384 | tcp_sync_mss(newsk, dst_mtu(dst)); |
| 1385 | newtp->advmss = dst_metric_advmss(dst); | 1385 | newtp->advmss = dst_metric_advmss(dst); |
| 1386 | if (tcp_sk(sk)->rx_opt.user_mss && | ||
| 1387 | tcp_sk(sk)->rx_opt.user_mss < newtp->advmss) | ||
| 1388 | newtp->advmss = tcp_sk(sk)->rx_opt.user_mss; | ||
| 1389 | |||
| 1386 | tcp_initialize_rcv_mss(newsk); | 1390 | tcp_initialize_rcv_mss(newsk); |
| 1387 | if (tcp_rsk(req)->snt_synack) | 1391 | if (tcp_rsk(req)->snt_synack) |
| 1388 | tcp_valid_rtt_meas(newsk, | 1392 | tcp_valid_rtt_meas(newsk, |
diff --git a/net/key/af_key.c b/net/key/af_key.c index 11dbb2255ccb..7e5d927b576f 100644 --- a/net/key/af_key.c +++ b/net/key/af_key.c | |||
| @@ -3480,7 +3480,7 @@ static int pfkey_send_migrate(const struct xfrm_selector *sel, u8 dir, u8 type, | |||
| 3480 | 3480 | ||
| 3481 | /* Addresses to be used by KM for negotiation, if ext is available */ | 3481 | /* Addresses to be used by KM for negotiation, if ext is available */ |
| 3482 | if (k != NULL && (set_sadb_kmaddress(skb, k) < 0)) | 3482 | if (k != NULL && (set_sadb_kmaddress(skb, k) < 0)) |
| 3483 | return -EINVAL; | 3483 | goto err; |
| 3484 | 3484 | ||
| 3485 | /* selector src */ | 3485 | /* selector src */ |
| 3486 | set_sadb_address(skb, sasize_sel, SADB_EXT_ADDRESS_SRC, sel); | 3486 | set_sadb_address(skb, sasize_sel, SADB_EXT_ADDRESS_SRC, sel); |
diff --git a/net/l2tp/l2tp_ip.c b/net/l2tp/l2tp_ip.c index 55670ec3cd0f..6274f0be82b0 100644 --- a/net/l2tp/l2tp_ip.c +++ b/net/l2tp/l2tp_ip.c | |||
| @@ -232,7 +232,7 @@ static void l2tp_ip_close(struct sock *sk, long timeout) | |||
| 232 | { | 232 | { |
| 233 | write_lock_bh(&l2tp_ip_lock); | 233 | write_lock_bh(&l2tp_ip_lock); |
| 234 | hlist_del_init(&sk->sk_bind_node); | 234 | hlist_del_init(&sk->sk_bind_node); |
| 235 | hlist_del_init(&sk->sk_node); | 235 | sk_del_node_init(sk); |
| 236 | write_unlock_bh(&l2tp_ip_lock); | 236 | write_unlock_bh(&l2tp_ip_lock); |
| 237 | sk_common_release(sk); | 237 | sk_common_release(sk); |
| 238 | } | 238 | } |
| @@ -271,7 +271,8 @@ static int l2tp_ip_bind(struct sock *sk, struct sockaddr *uaddr, int addr_len) | |||
| 271 | chk_addr_ret != RTN_MULTICAST && chk_addr_ret != RTN_BROADCAST) | 271 | chk_addr_ret != RTN_MULTICAST && chk_addr_ret != RTN_BROADCAST) |
| 272 | goto out; | 272 | goto out; |
| 273 | 273 | ||
| 274 | inet->inet_rcv_saddr = inet->inet_saddr = addr->l2tp_addr.s_addr; | 274 | if (addr->l2tp_addr.s_addr) |
| 275 | inet->inet_rcv_saddr = inet->inet_saddr = addr->l2tp_addr.s_addr; | ||
| 275 | if (chk_addr_ret == RTN_MULTICAST || chk_addr_ret == RTN_BROADCAST) | 276 | if (chk_addr_ret == RTN_MULTICAST || chk_addr_ret == RTN_BROADCAST) |
| 276 | inet->inet_saddr = 0; /* Use device */ | 277 | inet->inet_saddr = 0; /* Use device */ |
| 277 | sk_dst_reset(sk); | 278 | sk_dst_reset(sk); |
| @@ -441,8 +442,9 @@ static int l2tp_ip_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *m | |||
| 441 | 442 | ||
| 442 | daddr = lip->l2tp_addr.s_addr; | 443 | daddr = lip->l2tp_addr.s_addr; |
| 443 | } else { | 444 | } else { |
| 445 | rc = -EDESTADDRREQ; | ||
| 444 | if (sk->sk_state != TCP_ESTABLISHED) | 446 | if (sk->sk_state != TCP_ESTABLISHED) |
| 445 | return -EDESTADDRREQ; | 447 | goto out; |
| 446 | 448 | ||
| 447 | daddr = inet->inet_daddr; | 449 | daddr = inet->inet_daddr; |
| 448 | connected = 1; | 450 | connected = 1; |
diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c index 33fd8d9f714e..cef7c29214a8 100644 --- a/net/mac80211/ibss.c +++ b/net/mac80211/ibss.c | |||
| @@ -457,8 +457,8 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata, | |||
| 457 | * fall back to HT20 if we don't use or use | 457 | * fall back to HT20 if we don't use or use |
| 458 | * the other extension channel | 458 | * the other extension channel |
| 459 | */ | 459 | */ |
| 460 | if ((channel_type == NL80211_CHAN_HT40MINUS || | 460 | if (!(channel_type == NL80211_CHAN_HT40MINUS || |
| 461 | channel_type == NL80211_CHAN_HT40PLUS) && | 461 | channel_type == NL80211_CHAN_HT40PLUS) || |
| 462 | channel_type != sdata->u.ibss.channel_type) | 462 | channel_type != sdata->u.ibss.channel_type) |
| 463 | sta_ht_cap_new.cap &= | 463 | sta_ht_cap_new.cap &= |
| 464 | ~IEEE80211_HT_CAP_SUP_WIDTH_20_40; | 464 | ~IEEE80211_HT_CAP_SUP_WIDTH_20_40; |
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h index d9798a307f20..db8fae51714c 100644 --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h | |||
| @@ -1210,7 +1210,7 @@ void ieee80211_sta_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata, | |||
| 1210 | struct sk_buff *skb); | 1210 | struct sk_buff *skb); |
| 1211 | void ieee80211_sta_reset_beacon_monitor(struct ieee80211_sub_if_data *sdata); | 1211 | void ieee80211_sta_reset_beacon_monitor(struct ieee80211_sub_if_data *sdata); |
| 1212 | void ieee80211_sta_reset_conn_monitor(struct ieee80211_sub_if_data *sdata); | 1212 | void ieee80211_sta_reset_conn_monitor(struct ieee80211_sub_if_data *sdata); |
| 1213 | void ieee80211_mgd_teardown(struct ieee80211_sub_if_data *sdata); | 1213 | void ieee80211_mgd_stop(struct ieee80211_sub_if_data *sdata); |
| 1214 | 1214 | ||
| 1215 | /* IBSS code */ | 1215 | /* IBSS code */ |
| 1216 | void ieee80211_ibss_notify_scan_completed(struct ieee80211_local *local); | 1216 | void ieee80211_ibss_notify_scan_completed(struct ieee80211_local *local); |
diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c index 401c01f0731e..c20051b7ffcd 100644 --- a/net/mac80211/iface.c +++ b/net/mac80211/iface.c | |||
| @@ -486,6 +486,8 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata, | |||
| 486 | /* free all potentially still buffered bcast frames */ | 486 | /* free all potentially still buffered bcast frames */ |
| 487 | local->total_ps_buffered -= skb_queue_len(&sdata->u.ap.ps_bc_buf); | 487 | local->total_ps_buffered -= skb_queue_len(&sdata->u.ap.ps_bc_buf); |
| 488 | skb_queue_purge(&sdata->u.ap.ps_bc_buf); | 488 | skb_queue_purge(&sdata->u.ap.ps_bc_buf); |
| 489 | } else if (sdata->vif.type == NL80211_IFTYPE_STATION) { | ||
| 490 | ieee80211_mgd_stop(sdata); | ||
| 489 | } | 491 | } |
| 490 | 492 | ||
| 491 | if (going_down) | 493 | if (going_down) |
| @@ -644,8 +646,6 @@ static void ieee80211_teardown_sdata(struct net_device *dev) | |||
| 644 | 646 | ||
| 645 | if (ieee80211_vif_is_mesh(&sdata->vif)) | 647 | if (ieee80211_vif_is_mesh(&sdata->vif)) |
| 646 | mesh_rmc_free(sdata); | 648 | mesh_rmc_free(sdata); |
| 647 | else if (sdata->vif.type == NL80211_IFTYPE_STATION) | ||
| 648 | ieee80211_mgd_teardown(sdata); | ||
| 649 | 649 | ||
| 650 | flushed = sta_info_flush(local, sdata); | 650 | flushed = sta_info_flush(local, sdata); |
| 651 | WARN_ON(flushed); | 651 | WARN_ON(flushed); |
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c index f76da5b3f5c5..20c680bfc3ae 100644 --- a/net/mac80211/mlme.c +++ b/net/mac80211/mlme.c | |||
| @@ -3497,7 +3497,7 @@ int ieee80211_mgd_disassoc(struct ieee80211_sub_if_data *sdata, | |||
| 3497 | return 0; | 3497 | return 0; |
| 3498 | } | 3498 | } |
| 3499 | 3499 | ||
| 3500 | void ieee80211_mgd_teardown(struct ieee80211_sub_if_data *sdata) | 3500 | void ieee80211_mgd_stop(struct ieee80211_sub_if_data *sdata) |
| 3501 | { | 3501 | { |
| 3502 | struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; | 3502 | struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; |
| 3503 | 3503 | ||
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c index bcfe8c77c839..d64e285400aa 100644 --- a/net/mac80211/rx.c +++ b/net/mac80211/rx.c | |||
| @@ -103,7 +103,7 @@ static void | |||
| 103 | ieee80211_add_rx_radiotap_header(struct ieee80211_local *local, | 103 | ieee80211_add_rx_radiotap_header(struct ieee80211_local *local, |
| 104 | struct sk_buff *skb, | 104 | struct sk_buff *skb, |
| 105 | struct ieee80211_rate *rate, | 105 | struct ieee80211_rate *rate, |
| 106 | int rtap_len) | 106 | int rtap_len, bool has_fcs) |
| 107 | { | 107 | { |
| 108 | struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb); | 108 | struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb); |
| 109 | struct ieee80211_radiotap_header *rthdr; | 109 | struct ieee80211_radiotap_header *rthdr; |
| @@ -134,7 +134,7 @@ ieee80211_add_rx_radiotap_header(struct ieee80211_local *local, | |||
| 134 | } | 134 | } |
| 135 | 135 | ||
| 136 | /* IEEE80211_RADIOTAP_FLAGS */ | 136 | /* IEEE80211_RADIOTAP_FLAGS */ |
| 137 | if (local->hw.flags & IEEE80211_HW_RX_INCLUDES_FCS) | 137 | if (has_fcs && (local->hw.flags & IEEE80211_HW_RX_INCLUDES_FCS)) |
| 138 | *pos |= IEEE80211_RADIOTAP_F_FCS; | 138 | *pos |= IEEE80211_RADIOTAP_F_FCS; |
| 139 | if (status->flag & (RX_FLAG_FAILED_FCS_CRC | RX_FLAG_FAILED_PLCP_CRC)) | 139 | if (status->flag & (RX_FLAG_FAILED_FCS_CRC | RX_FLAG_FAILED_PLCP_CRC)) |
| 140 | *pos |= IEEE80211_RADIOTAP_F_BADFCS; | 140 | *pos |= IEEE80211_RADIOTAP_F_BADFCS; |
| @@ -294,7 +294,8 @@ ieee80211_rx_monitor(struct ieee80211_local *local, struct sk_buff *origskb, | |||
| 294 | } | 294 | } |
| 295 | 295 | ||
| 296 | /* prepend radiotap information */ | 296 | /* prepend radiotap information */ |
| 297 | ieee80211_add_rx_radiotap_header(local, skb, rate, needed_headroom); | 297 | ieee80211_add_rx_radiotap_header(local, skb, rate, needed_headroom, |
| 298 | true); | ||
| 298 | 299 | ||
| 299 | skb_reset_mac_header(skb); | 300 | skb_reset_mac_header(skb); |
| 300 | skb->ip_summed = CHECKSUM_UNNECESSARY; | 301 | skb->ip_summed = CHECKSUM_UNNECESSARY; |
| @@ -2571,7 +2572,8 @@ static void ieee80211_rx_cooked_monitor(struct ieee80211_rx_data *rx, | |||
| 2571 | goto out_free_skb; | 2572 | goto out_free_skb; |
| 2572 | 2573 | ||
| 2573 | /* prepend radiotap information */ | 2574 | /* prepend radiotap information */ |
| 2574 | ieee80211_add_rx_radiotap_header(local, skb, rate, needed_headroom); | 2575 | ieee80211_add_rx_radiotap_header(local, skb, rate, needed_headroom, |
| 2576 | false); | ||
| 2575 | 2577 | ||
| 2576 | skb_set_mac_header(skb, 0); | 2578 | skb_set_mac_header(skb, 0); |
| 2577 | skb->ip_summed = CHECKSUM_UNNECESSARY; | 2579 | skb->ip_summed = CHECKSUM_UNNECESSARY; |
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index 782a60198df4..e76facc69e95 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c | |||
| @@ -1158,7 +1158,8 @@ ieee80211_tx_prepare(struct ieee80211_sub_if_data *sdata, | |||
| 1158 | tx->sta = rcu_dereference(sdata->u.vlan.sta); | 1158 | tx->sta = rcu_dereference(sdata->u.vlan.sta); |
| 1159 | if (!tx->sta && sdata->dev->ieee80211_ptr->use_4addr) | 1159 | if (!tx->sta && sdata->dev->ieee80211_ptr->use_4addr) |
| 1160 | return TX_DROP; | 1160 | return TX_DROP; |
| 1161 | } else if (info->flags & IEEE80211_TX_CTL_INJECTED) { | 1161 | } else if (info->flags & IEEE80211_TX_CTL_INJECTED || |
| 1162 | tx->sdata->control_port_protocol == tx->skb->protocol) { | ||
| 1162 | tx->sta = sta_info_get_bss(sdata, hdr->addr1); | 1163 | tx->sta = sta_info_get_bss(sdata, hdr->addr1); |
| 1163 | } | 1164 | } |
| 1164 | if (!tx->sta) | 1165 | if (!tx->sta) |
diff --git a/net/netfilter/ipvs/ip_vs_core.c b/net/netfilter/ipvs/ip_vs_core.c index 2555816e7788..00bdb1d9d690 100644 --- a/net/netfilter/ipvs/ip_vs_core.c +++ b/net/netfilter/ipvs/ip_vs_core.c | |||
| @@ -1924,6 +1924,7 @@ protocol_fail: | |||
| 1924 | control_fail: | 1924 | control_fail: |
| 1925 | ip_vs_estimator_net_cleanup(net); | 1925 | ip_vs_estimator_net_cleanup(net); |
| 1926 | estimator_fail: | 1926 | estimator_fail: |
| 1927 | net->ipvs = NULL; | ||
| 1927 | return -ENOMEM; | 1928 | return -ENOMEM; |
| 1928 | } | 1929 | } |
| 1929 | 1930 | ||
| @@ -1936,6 +1937,7 @@ static void __net_exit __ip_vs_cleanup(struct net *net) | |||
| 1936 | ip_vs_control_net_cleanup(net); | 1937 | ip_vs_control_net_cleanup(net); |
| 1937 | ip_vs_estimator_net_cleanup(net); | 1938 | ip_vs_estimator_net_cleanup(net); |
| 1938 | IP_VS_DBG(2, "ipvs netns %d released\n", net_ipvs(net)->gen); | 1939 | IP_VS_DBG(2, "ipvs netns %d released\n", net_ipvs(net)->gen); |
| 1940 | net->ipvs = NULL; | ||
| 1939 | } | 1941 | } |
| 1940 | 1942 | ||
| 1941 | static void __net_exit __ip_vs_dev_cleanup(struct net *net) | 1943 | static void __net_exit __ip_vs_dev_cleanup(struct net *net) |
| @@ -1993,10 +1995,18 @@ static int __init ip_vs_init(void) | |||
| 1993 | goto cleanup_dev; | 1995 | goto cleanup_dev; |
| 1994 | } | 1996 | } |
| 1995 | 1997 | ||
| 1998 | ret = ip_vs_register_nl_ioctl(); | ||
| 1999 | if (ret < 0) { | ||
| 2000 | pr_err("can't register netlink/ioctl.\n"); | ||
| 2001 | goto cleanup_hooks; | ||
| 2002 | } | ||
| 2003 | |||
| 1996 | pr_info("ipvs loaded.\n"); | 2004 | pr_info("ipvs loaded.\n"); |
| 1997 | 2005 | ||
| 1998 | return ret; | 2006 | return ret; |
| 1999 | 2007 | ||
| 2008 | cleanup_hooks: | ||
| 2009 | nf_unregister_hooks(ip_vs_ops, ARRAY_SIZE(ip_vs_ops)); | ||
| 2000 | cleanup_dev: | 2010 | cleanup_dev: |
| 2001 | unregister_pernet_device(&ipvs_core_dev_ops); | 2011 | unregister_pernet_device(&ipvs_core_dev_ops); |
| 2002 | cleanup_sub: | 2012 | cleanup_sub: |
| @@ -2012,6 +2022,7 @@ exit: | |||
| 2012 | 2022 | ||
| 2013 | static void __exit ip_vs_cleanup(void) | 2023 | static void __exit ip_vs_cleanup(void) |
| 2014 | { | 2024 | { |
| 2025 | ip_vs_unregister_nl_ioctl(); | ||
| 2015 | nf_unregister_hooks(ip_vs_ops, ARRAY_SIZE(ip_vs_ops)); | 2026 | nf_unregister_hooks(ip_vs_ops, ARRAY_SIZE(ip_vs_ops)); |
| 2016 | unregister_pernet_device(&ipvs_core_dev_ops); | 2027 | unregister_pernet_device(&ipvs_core_dev_ops); |
| 2017 | unregister_pernet_subsys(&ipvs_core_ops); /* free ip_vs struct */ | 2028 | unregister_pernet_subsys(&ipvs_core_ops); /* free ip_vs struct */ |
diff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c index b3afe189af61..f5589987fc80 100644 --- a/net/netfilter/ipvs/ip_vs_ctl.c +++ b/net/netfilter/ipvs/ip_vs_ctl.c | |||
| @@ -3680,7 +3680,7 @@ int __net_init ip_vs_control_net_init_sysctl(struct net *net) | |||
| 3680 | return 0; | 3680 | return 0; |
| 3681 | } | 3681 | } |
| 3682 | 3682 | ||
| 3683 | void __net_init ip_vs_control_net_cleanup_sysctl(struct net *net) | 3683 | void __net_exit ip_vs_control_net_cleanup_sysctl(struct net *net) |
| 3684 | { | 3684 | { |
| 3685 | struct netns_ipvs *ipvs = net_ipvs(net); | 3685 | struct netns_ipvs *ipvs = net_ipvs(net); |
| 3686 | 3686 | ||
| @@ -3692,7 +3692,7 @@ void __net_init ip_vs_control_net_cleanup_sysctl(struct net *net) | |||
| 3692 | #else | 3692 | #else |
| 3693 | 3693 | ||
| 3694 | int __net_init ip_vs_control_net_init_sysctl(struct net *net) { return 0; } | 3694 | int __net_init ip_vs_control_net_init_sysctl(struct net *net) { return 0; } |
| 3695 | void __net_init ip_vs_control_net_cleanup_sysctl(struct net *net) { } | 3695 | void __net_exit ip_vs_control_net_cleanup_sysctl(struct net *net) { } |
| 3696 | 3696 | ||
| 3697 | #endif | 3697 | #endif |
| 3698 | 3698 | ||
| @@ -3750,21 +3750,10 @@ void __net_exit ip_vs_control_net_cleanup(struct net *net) | |||
| 3750 | free_percpu(ipvs->tot_stats.cpustats); | 3750 | free_percpu(ipvs->tot_stats.cpustats); |
| 3751 | } | 3751 | } |
| 3752 | 3752 | ||
| 3753 | int __init ip_vs_control_init(void) | 3753 | int __init ip_vs_register_nl_ioctl(void) |
| 3754 | { | 3754 | { |
| 3755 | int idx; | ||
| 3756 | int ret; | 3755 | int ret; |
| 3757 | 3756 | ||
| 3758 | EnterFunction(2); | ||
| 3759 | |||
| 3760 | /* Initialize svc_table, ip_vs_svc_fwm_table, rs_table */ | ||
| 3761 | for(idx = 0; idx < IP_VS_SVC_TAB_SIZE; idx++) { | ||
| 3762 | INIT_LIST_HEAD(&ip_vs_svc_table[idx]); | ||
| 3763 | INIT_LIST_HEAD(&ip_vs_svc_fwm_table[idx]); | ||
| 3764 | } | ||
| 3765 | |||
| 3766 | smp_wmb(); /* Do we really need it now ? */ | ||
| 3767 | |||
| 3768 | ret = nf_register_sockopt(&ip_vs_sockopts); | 3757 | ret = nf_register_sockopt(&ip_vs_sockopts); |
| 3769 | if (ret) { | 3758 | if (ret) { |
| 3770 | pr_err("cannot register sockopt.\n"); | 3759 | pr_err("cannot register sockopt.\n"); |
| @@ -3776,28 +3765,47 @@ int __init ip_vs_control_init(void) | |||
| 3776 | pr_err("cannot register Generic Netlink interface.\n"); | 3765 | pr_err("cannot register Generic Netlink interface.\n"); |
| 3777 | goto err_genl; | 3766 | goto err_genl; |
| 3778 | } | 3767 | } |
| 3779 | |||
| 3780 | ret = register_netdevice_notifier(&ip_vs_dst_notifier); | ||
| 3781 | if (ret < 0) | ||
| 3782 | goto err_notf; | ||
| 3783 | |||
| 3784 | LeaveFunction(2); | ||
| 3785 | return 0; | 3768 | return 0; |
| 3786 | 3769 | ||
| 3787 | err_notf: | ||
| 3788 | ip_vs_genl_unregister(); | ||
| 3789 | err_genl: | 3770 | err_genl: |
| 3790 | nf_unregister_sockopt(&ip_vs_sockopts); | 3771 | nf_unregister_sockopt(&ip_vs_sockopts); |
| 3791 | err_sock: | 3772 | err_sock: |
| 3792 | return ret; | 3773 | return ret; |
| 3793 | } | 3774 | } |
| 3794 | 3775 | ||
| 3776 | void ip_vs_unregister_nl_ioctl(void) | ||
| 3777 | { | ||
| 3778 | ip_vs_genl_unregister(); | ||
| 3779 | nf_unregister_sockopt(&ip_vs_sockopts); | ||
| 3780 | } | ||
| 3781 | |||
| 3782 | int __init ip_vs_control_init(void) | ||
| 3783 | { | ||
| 3784 | int idx; | ||
| 3785 | int ret; | ||
| 3786 | |||
| 3787 | EnterFunction(2); | ||
| 3788 | |||
| 3789 | /* Initialize svc_table, ip_vs_svc_fwm_table, rs_table */ | ||
| 3790 | for (idx = 0; idx < IP_VS_SVC_TAB_SIZE; idx++) { | ||
| 3791 | INIT_LIST_HEAD(&ip_vs_svc_table[idx]); | ||
| 3792 | INIT_LIST_HEAD(&ip_vs_svc_fwm_table[idx]); | ||
| 3793 | } | ||
| 3794 | |||
| 3795 | smp_wmb(); /* Do we really need it now ? */ | ||
| 3796 | |||
| 3797 | ret = register_netdevice_notifier(&ip_vs_dst_notifier); | ||
| 3798 | if (ret < 0) | ||
| 3799 | return ret; | ||
| 3800 | |||
| 3801 | LeaveFunction(2); | ||
| 3802 | return 0; | ||
| 3803 | } | ||
| 3804 | |||
| 3795 | 3805 | ||
| 3796 | void ip_vs_control_cleanup(void) | 3806 | void ip_vs_control_cleanup(void) |
| 3797 | { | 3807 | { |
| 3798 | EnterFunction(2); | 3808 | EnterFunction(2); |
| 3799 | unregister_netdevice_notifier(&ip_vs_dst_notifier); | 3809 | unregister_netdevice_notifier(&ip_vs_dst_notifier); |
| 3800 | ip_vs_genl_unregister(); | ||
| 3801 | nf_unregister_sockopt(&ip_vs_sockopts); | ||
| 3802 | LeaveFunction(2); | 3810 | LeaveFunction(2); |
| 3803 | } | 3811 | } |
diff --git a/net/netfilter/ipvs/ip_vs_ftp.c b/net/netfilter/ipvs/ip_vs_ftp.c index 538d74ee4f68..e39f693dd3e4 100644 --- a/net/netfilter/ipvs/ip_vs_ftp.c +++ b/net/netfilter/ipvs/ip_vs_ftp.c | |||
| @@ -439,6 +439,8 @@ static int __net_init __ip_vs_ftp_init(struct net *net) | |||
| 439 | struct ip_vs_app *app; | 439 | struct ip_vs_app *app; |
| 440 | struct netns_ipvs *ipvs = net_ipvs(net); | 440 | struct netns_ipvs *ipvs = net_ipvs(net); |
| 441 | 441 | ||
| 442 | if (!ipvs) | ||
| 443 | return -ENOENT; | ||
| 442 | app = kmemdup(&ip_vs_ftp, sizeof(struct ip_vs_app), GFP_KERNEL); | 444 | app = kmemdup(&ip_vs_ftp, sizeof(struct ip_vs_app), GFP_KERNEL); |
| 443 | if (!app) | 445 | if (!app) |
| 444 | return -ENOMEM; | 446 | return -ENOMEM; |
diff --git a/net/netfilter/ipvs/ip_vs_lblc.c b/net/netfilter/ipvs/ip_vs_lblc.c index 0f16283fd058..caa43704e55e 100644 --- a/net/netfilter/ipvs/ip_vs_lblc.c +++ b/net/netfilter/ipvs/ip_vs_lblc.c | |||
| @@ -551,6 +551,9 @@ static int __net_init __ip_vs_lblc_init(struct net *net) | |||
| 551 | { | 551 | { |
| 552 | struct netns_ipvs *ipvs = net_ipvs(net); | 552 | struct netns_ipvs *ipvs = net_ipvs(net); |
| 553 | 553 | ||
| 554 | if (!ipvs) | ||
| 555 | return -ENOENT; | ||
| 556 | |||
| 554 | if (!net_eq(net, &init_net)) { | 557 | if (!net_eq(net, &init_net)) { |
| 555 | ipvs->lblc_ctl_table = kmemdup(vs_vars_table, | 558 | ipvs->lblc_ctl_table = kmemdup(vs_vars_table, |
| 556 | sizeof(vs_vars_table), | 559 | sizeof(vs_vars_table), |
diff --git a/net/netfilter/ipvs/ip_vs_lblcr.c b/net/netfilter/ipvs/ip_vs_lblcr.c index eec797f8cce7..548bf37aa29e 100644 --- a/net/netfilter/ipvs/ip_vs_lblcr.c +++ b/net/netfilter/ipvs/ip_vs_lblcr.c | |||
| @@ -745,6 +745,9 @@ static int __net_init __ip_vs_lblcr_init(struct net *net) | |||
| 745 | { | 745 | { |
| 746 | struct netns_ipvs *ipvs = net_ipvs(net); | 746 | struct netns_ipvs *ipvs = net_ipvs(net); |
| 747 | 747 | ||
| 748 | if (!ipvs) | ||
| 749 | return -ENOENT; | ||
| 750 | |||
| 748 | if (!net_eq(net, &init_net)) { | 751 | if (!net_eq(net, &init_net)) { |
| 749 | ipvs->lblcr_ctl_table = kmemdup(vs_vars_table, | 752 | ipvs->lblcr_ctl_table = kmemdup(vs_vars_table, |
| 750 | sizeof(vs_vars_table), | 753 | sizeof(vs_vars_table), |
diff --git a/net/netfilter/ipvs/ip_vs_proto.c b/net/netfilter/ipvs/ip_vs_proto.c index f843a8833250..ed835e67a07e 100644 --- a/net/netfilter/ipvs/ip_vs_proto.c +++ b/net/netfilter/ipvs/ip_vs_proto.c | |||
| @@ -59,9 +59,6 @@ static int __used __init register_ip_vs_protocol(struct ip_vs_protocol *pp) | |||
| 59 | return 0; | 59 | return 0; |
| 60 | } | 60 | } |
| 61 | 61 | ||
| 62 | #if defined(CONFIG_IP_VS_PROTO_TCP) || defined(CONFIG_IP_VS_PROTO_UDP) || \ | ||
| 63 | defined(CONFIG_IP_VS_PROTO_SCTP) || defined(CONFIG_IP_VS_PROTO_AH) || \ | ||
| 64 | defined(CONFIG_IP_VS_PROTO_ESP) | ||
| 65 | /* | 62 | /* |
| 66 | * register an ipvs protocols netns related data | 63 | * register an ipvs protocols netns related data |
| 67 | */ | 64 | */ |
| @@ -81,12 +78,18 @@ register_ip_vs_proto_netns(struct net *net, struct ip_vs_protocol *pp) | |||
| 81 | ipvs->proto_data_table[hash] = pd; | 78 | ipvs->proto_data_table[hash] = pd; |
| 82 | atomic_set(&pd->appcnt, 0); /* Init app counter */ | 79 | atomic_set(&pd->appcnt, 0); /* Init app counter */ |
| 83 | 80 | ||
| 84 | if (pp->init_netns != NULL) | 81 | if (pp->init_netns != NULL) { |
| 85 | pp->init_netns(net, pd); | 82 | int ret = pp->init_netns(net, pd); |
| 83 | if (ret) { | ||
| 84 | /* unlink an free proto data */ | ||
| 85 | ipvs->proto_data_table[hash] = pd->next; | ||
| 86 | kfree(pd); | ||
| 87 | return ret; | ||
| 88 | } | ||
| 89 | } | ||
| 86 | 90 | ||
| 87 | return 0; | 91 | return 0; |
| 88 | } | 92 | } |
| 89 | #endif | ||
| 90 | 93 | ||
| 91 | /* | 94 | /* |
| 92 | * unregister an ipvs protocol | 95 | * unregister an ipvs protocol |
| @@ -316,22 +319,35 @@ ip_vs_tcpudp_debug_packet(int af, struct ip_vs_protocol *pp, | |||
| 316 | */ | 319 | */ |
| 317 | int __net_init ip_vs_protocol_net_init(struct net *net) | 320 | int __net_init ip_vs_protocol_net_init(struct net *net) |
| 318 | { | 321 | { |
| 322 | int i, ret; | ||
| 323 | static struct ip_vs_protocol *protos[] = { | ||
| 319 | #ifdef CONFIG_IP_VS_PROTO_TCP | 324 | #ifdef CONFIG_IP_VS_PROTO_TCP |
| 320 | register_ip_vs_proto_netns(net, &ip_vs_protocol_tcp); | 325 | &ip_vs_protocol_tcp, |
| 321 | #endif | 326 | #endif |
| 322 | #ifdef CONFIG_IP_VS_PROTO_UDP | 327 | #ifdef CONFIG_IP_VS_PROTO_UDP |
| 323 | register_ip_vs_proto_netns(net, &ip_vs_protocol_udp); | 328 | &ip_vs_protocol_udp, |
| 324 | #endif | 329 | #endif |
| 325 | #ifdef CONFIG_IP_VS_PROTO_SCTP | 330 | #ifdef CONFIG_IP_VS_PROTO_SCTP |
| 326 | register_ip_vs_proto_netns(net, &ip_vs_protocol_sctp); | 331 | &ip_vs_protocol_sctp, |
| 327 | #endif | 332 | #endif |
| 328 | #ifdef CONFIG_IP_VS_PROTO_AH | 333 | #ifdef CONFIG_IP_VS_PROTO_AH |
| 329 | register_ip_vs_proto_netns(net, &ip_vs_protocol_ah); | 334 | &ip_vs_protocol_ah, |
| 330 | #endif | 335 | #endif |
| 331 | #ifdef CONFIG_IP_VS_PROTO_ESP | 336 | #ifdef CONFIG_IP_VS_PROTO_ESP |
| 332 | register_ip_vs_proto_netns(net, &ip_vs_protocol_esp); | 337 | &ip_vs_protocol_esp, |
| 333 | #endif | 338 | #endif |
| 339 | }; | ||
| 340 | |||
| 341 | for (i = 0; i < ARRAY_SIZE(protos); i++) { | ||
| 342 | ret = register_ip_vs_proto_netns(net, protos[i]); | ||
| 343 | if (ret < 0) | ||
| 344 | goto cleanup; | ||
| 345 | } | ||
| 334 | return 0; | 346 | return 0; |
| 347 | |||
| 348 | cleanup: | ||
| 349 | ip_vs_protocol_net_cleanup(net); | ||
| 350 | return ret; | ||
| 335 | } | 351 | } |
| 336 | 352 | ||
| 337 | void __net_exit ip_vs_protocol_net_cleanup(struct net *net) | 353 | void __net_exit ip_vs_protocol_net_cleanup(struct net *net) |
diff --git a/net/netfilter/ipvs/ip_vs_proto_sctp.c b/net/netfilter/ipvs/ip_vs_proto_sctp.c index 1fbf7a2816f5..9f3fb751c491 100644 --- a/net/netfilter/ipvs/ip_vs_proto_sctp.c +++ b/net/netfilter/ipvs/ip_vs_proto_sctp.c | |||
| @@ -1090,7 +1090,7 @@ out: | |||
| 1090 | * timeouts is netns related now. | 1090 | * timeouts is netns related now. |
| 1091 | * --------------------------------------------- | 1091 | * --------------------------------------------- |
| 1092 | */ | 1092 | */ |
| 1093 | static void __ip_vs_sctp_init(struct net *net, struct ip_vs_proto_data *pd) | 1093 | static int __ip_vs_sctp_init(struct net *net, struct ip_vs_proto_data *pd) |
| 1094 | { | 1094 | { |
| 1095 | struct netns_ipvs *ipvs = net_ipvs(net); | 1095 | struct netns_ipvs *ipvs = net_ipvs(net); |
| 1096 | 1096 | ||
| @@ -1098,6 +1098,9 @@ static void __ip_vs_sctp_init(struct net *net, struct ip_vs_proto_data *pd) | |||
| 1098 | spin_lock_init(&ipvs->sctp_app_lock); | 1098 | spin_lock_init(&ipvs->sctp_app_lock); |
| 1099 | pd->timeout_table = ip_vs_create_timeout_table((int *)sctp_timeouts, | 1099 | pd->timeout_table = ip_vs_create_timeout_table((int *)sctp_timeouts, |
| 1100 | sizeof(sctp_timeouts)); | 1100 | sizeof(sctp_timeouts)); |
| 1101 | if (!pd->timeout_table) | ||
| 1102 | return -ENOMEM; | ||
| 1103 | return 0; | ||
| 1101 | } | 1104 | } |
| 1102 | 1105 | ||
| 1103 | static void __ip_vs_sctp_exit(struct net *net, struct ip_vs_proto_data *pd) | 1106 | static void __ip_vs_sctp_exit(struct net *net, struct ip_vs_proto_data *pd) |
diff --git a/net/netfilter/ipvs/ip_vs_proto_tcp.c b/net/netfilter/ipvs/ip_vs_proto_tcp.c index ef8641f7af83..cd609cc62721 100644 --- a/net/netfilter/ipvs/ip_vs_proto_tcp.c +++ b/net/netfilter/ipvs/ip_vs_proto_tcp.c | |||
| @@ -677,7 +677,7 @@ void ip_vs_tcp_conn_listen(struct net *net, struct ip_vs_conn *cp) | |||
| 677 | * timeouts is netns related now. | 677 | * timeouts is netns related now. |
| 678 | * --------------------------------------------- | 678 | * --------------------------------------------- |
| 679 | */ | 679 | */ |
| 680 | static void __ip_vs_tcp_init(struct net *net, struct ip_vs_proto_data *pd) | 680 | static int __ip_vs_tcp_init(struct net *net, struct ip_vs_proto_data *pd) |
| 681 | { | 681 | { |
| 682 | struct netns_ipvs *ipvs = net_ipvs(net); | 682 | struct netns_ipvs *ipvs = net_ipvs(net); |
| 683 | 683 | ||
| @@ -685,7 +685,10 @@ static void __ip_vs_tcp_init(struct net *net, struct ip_vs_proto_data *pd) | |||
| 685 | spin_lock_init(&ipvs->tcp_app_lock); | 685 | spin_lock_init(&ipvs->tcp_app_lock); |
| 686 | pd->timeout_table = ip_vs_create_timeout_table((int *)tcp_timeouts, | 686 | pd->timeout_table = ip_vs_create_timeout_table((int *)tcp_timeouts, |
| 687 | sizeof(tcp_timeouts)); | 687 | sizeof(tcp_timeouts)); |
| 688 | if (!pd->timeout_table) | ||
| 689 | return -ENOMEM; | ||
| 688 | pd->tcp_state_table = tcp_states; | 690 | pd->tcp_state_table = tcp_states; |
| 691 | return 0; | ||
| 689 | } | 692 | } |
| 690 | 693 | ||
| 691 | static void __ip_vs_tcp_exit(struct net *net, struct ip_vs_proto_data *pd) | 694 | static void __ip_vs_tcp_exit(struct net *net, struct ip_vs_proto_data *pd) |
diff --git a/net/netfilter/ipvs/ip_vs_proto_udp.c b/net/netfilter/ipvs/ip_vs_proto_udp.c index f4b7262896bb..2fedb2dcb3d1 100644 --- a/net/netfilter/ipvs/ip_vs_proto_udp.c +++ b/net/netfilter/ipvs/ip_vs_proto_udp.c | |||
| @@ -467,7 +467,7 @@ udp_state_transition(struct ip_vs_conn *cp, int direction, | |||
| 467 | cp->timeout = pd->timeout_table[IP_VS_UDP_S_NORMAL]; | 467 | cp->timeout = pd->timeout_table[IP_VS_UDP_S_NORMAL]; |
| 468 | } | 468 | } |
| 469 | 469 | ||
| 470 | static void __udp_init(struct net *net, struct ip_vs_proto_data *pd) | 470 | static int __udp_init(struct net *net, struct ip_vs_proto_data *pd) |
| 471 | { | 471 | { |
| 472 | struct netns_ipvs *ipvs = net_ipvs(net); | 472 | struct netns_ipvs *ipvs = net_ipvs(net); |
| 473 | 473 | ||
| @@ -475,6 +475,9 @@ static void __udp_init(struct net *net, struct ip_vs_proto_data *pd) | |||
| 475 | spin_lock_init(&ipvs->udp_app_lock); | 475 | spin_lock_init(&ipvs->udp_app_lock); |
| 476 | pd->timeout_table = ip_vs_create_timeout_table((int *)udp_timeouts, | 476 | pd->timeout_table = ip_vs_create_timeout_table((int *)udp_timeouts, |
| 477 | sizeof(udp_timeouts)); | 477 | sizeof(udp_timeouts)); |
| 478 | if (!pd->timeout_table) | ||
| 479 | return -ENOMEM; | ||
| 480 | return 0; | ||
| 478 | } | 481 | } |
| 479 | 482 | ||
| 480 | static void __udp_exit(struct net *net, struct ip_vs_proto_data *pd) | 483 | static void __udp_exit(struct net *net, struct ip_vs_proto_data *pd) |
diff --git a/net/netfilter/xt_CT.c b/net/netfilter/xt_CT.c index 59530e93fa58..3746d8b9a478 100644 --- a/net/netfilter/xt_CT.c +++ b/net/netfilter/xt_CT.c | |||
| @@ -227,7 +227,7 @@ static int xt_ct_tg_check_v1(const struct xt_tgchk_param *par) | |||
| 227 | } | 227 | } |
| 228 | 228 | ||
| 229 | #ifdef CONFIG_NF_CONNTRACK_TIMEOUT | 229 | #ifdef CONFIG_NF_CONNTRACK_TIMEOUT |
| 230 | if (info->timeout) { | 230 | if (info->timeout[0]) { |
| 231 | typeof(nf_ct_timeout_find_get_hook) timeout_find_get; | 231 | typeof(nf_ct_timeout_find_get_hook) timeout_find_get; |
| 232 | struct nf_conn_timeout *timeout_ext; | 232 | struct nf_conn_timeout *timeout_ext; |
| 233 | 233 | ||
diff --git a/net/phonet/pn_dev.c b/net/phonet/pn_dev.c index 9b9a85ecc4c7..bf5cf69c820a 100644 --- a/net/phonet/pn_dev.c +++ b/net/phonet/pn_dev.c | |||
| @@ -331,23 +331,6 @@ static int __net_init phonet_init_net(struct net *net) | |||
| 331 | 331 | ||
| 332 | static void __net_exit phonet_exit_net(struct net *net) | 332 | static void __net_exit phonet_exit_net(struct net *net) |
| 333 | { | 333 | { |
| 334 | struct phonet_net *pnn = phonet_pernet(net); | ||
| 335 | struct net_device *dev; | ||
| 336 | unsigned i; | ||
| 337 | |||
| 338 | rtnl_lock(); | ||
| 339 | for_each_netdev(net, dev) | ||
| 340 | phonet_device_destroy(dev); | ||
| 341 | |||
| 342 | for (i = 0; i < 64; i++) { | ||
| 343 | dev = pnn->routes.table[i]; | ||
| 344 | if (dev) { | ||
| 345 | rtm_phonet_notify(RTM_DELROUTE, dev, i); | ||
| 346 | dev_put(dev); | ||
| 347 | } | ||
| 348 | } | ||
| 349 | rtnl_unlock(); | ||
| 350 | |||
| 351 | proc_net_remove(net, "phonet"); | 334 | proc_net_remove(net, "phonet"); |
| 352 | } | 335 | } |
| 353 | 336 | ||
| @@ -361,7 +344,7 @@ static struct pernet_operations phonet_net_ops = { | |||
| 361 | /* Initialize Phonet devices list */ | 344 | /* Initialize Phonet devices list */ |
| 362 | int __init phonet_device_init(void) | 345 | int __init phonet_device_init(void) |
| 363 | { | 346 | { |
| 364 | int err = register_pernet_device(&phonet_net_ops); | 347 | int err = register_pernet_subsys(&phonet_net_ops); |
| 365 | if (err) | 348 | if (err) |
| 366 | return err; | 349 | return err; |
| 367 | 350 | ||
| @@ -377,7 +360,7 @@ void phonet_device_exit(void) | |||
| 377 | { | 360 | { |
| 378 | rtnl_unregister_all(PF_PHONET); | 361 | rtnl_unregister_all(PF_PHONET); |
| 379 | unregister_netdevice_notifier(&phonet_device_notifier); | 362 | unregister_netdevice_notifier(&phonet_device_notifier); |
| 380 | unregister_pernet_device(&phonet_net_ops); | 363 | unregister_pernet_subsys(&phonet_net_ops); |
| 381 | proc_net_remove(&init_net, "pnresource"); | 364 | proc_net_remove(&init_net, "pnresource"); |
| 382 | } | 365 | } |
| 383 | 366 | ||
diff --git a/net/sched/sch_gred.c b/net/sched/sch_gred.c index 0b15236be7b6..8179494c269a 100644 --- a/net/sched/sch_gred.c +++ b/net/sched/sch_gred.c | |||
| @@ -565,11 +565,8 @@ static int gred_dump(struct Qdisc *sch, struct sk_buff *skb) | |||
| 565 | opt.packets = q->packetsin; | 565 | opt.packets = q->packetsin; |
| 566 | opt.bytesin = q->bytesin; | 566 | opt.bytesin = q->bytesin; |
| 567 | 567 | ||
| 568 | if (gred_wred_mode(table)) { | 568 | if (gred_wred_mode(table)) |
| 569 | q->vars.qidlestart = | 569 | gred_load_wred_set(table, q); |
| 570 | table->tab[table->def]->vars.qidlestart; | ||
| 571 | q->vars.qavg = table->tab[table->def]->vars.qavg; | ||
| 572 | } | ||
| 573 | 570 | ||
| 574 | opt.qave = red_calc_qavg(&q->parms, &q->vars, q->vars.qavg); | 571 | opt.qave = red_calc_qavg(&q->parms, &q->vars, q->vars.qavg); |
| 575 | 572 | ||
diff --git a/net/sched/sch_netem.c b/net/sched/sch_netem.c index 5da548fa7ae9..ebd22966f748 100644 --- a/net/sched/sch_netem.c +++ b/net/sched/sch_netem.c | |||
| @@ -408,10 +408,8 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch) | |||
| 408 | if (q->corrupt && q->corrupt >= get_crandom(&q->corrupt_cor)) { | 408 | if (q->corrupt && q->corrupt >= get_crandom(&q->corrupt_cor)) { |
| 409 | if (!(skb = skb_unshare(skb, GFP_ATOMIC)) || | 409 | if (!(skb = skb_unshare(skb, GFP_ATOMIC)) || |
| 410 | (skb->ip_summed == CHECKSUM_PARTIAL && | 410 | (skb->ip_summed == CHECKSUM_PARTIAL && |
| 411 | skb_checksum_help(skb))) { | 411 | skb_checksum_help(skb))) |
| 412 | sch->qstats.drops++; | 412 | return qdisc_drop(skb, sch); |
| 413 | return NET_XMIT_DROP; | ||
| 414 | } | ||
| 415 | 413 | ||
| 416 | skb->data[net_random() % skb_headlen(skb)] ^= 1<<(net_random() % 8); | 414 | skb->data[net_random() % skb_headlen(skb)] ^= 1<<(net_random() % 8); |
| 417 | } | 415 | } |
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c index 67972462a543..adf2990acebf 100644 --- a/net/sunrpc/clnt.c +++ b/net/sunrpc/clnt.c | |||
| @@ -176,16 +176,22 @@ rpc_setup_pipedir(struct rpc_clnt *clnt, const char *dir_name) | |||
| 176 | return 0; | 176 | return 0; |
| 177 | } | 177 | } |
| 178 | 178 | ||
| 179 | static int __rpc_pipefs_event(struct rpc_clnt *clnt, unsigned long event, | 179 | static inline int rpc_clnt_skip_event(struct rpc_clnt *clnt, unsigned long event) |
| 180 | struct super_block *sb) | 180 | { |
| 181 | if (((event == RPC_PIPEFS_MOUNT) && clnt->cl_dentry) || | ||
| 182 | ((event == RPC_PIPEFS_UMOUNT) && !clnt->cl_dentry)) | ||
| 183 | return 1; | ||
| 184 | return 0; | ||
| 185 | } | ||
| 186 | |||
| 187 | static int __rpc_clnt_handle_event(struct rpc_clnt *clnt, unsigned long event, | ||
| 188 | struct super_block *sb) | ||
| 181 | { | 189 | { |
| 182 | struct dentry *dentry; | 190 | struct dentry *dentry; |
| 183 | int err = 0; | 191 | int err = 0; |
| 184 | 192 | ||
| 185 | switch (event) { | 193 | switch (event) { |
| 186 | case RPC_PIPEFS_MOUNT: | 194 | case RPC_PIPEFS_MOUNT: |
| 187 | if (clnt->cl_program->pipe_dir_name == NULL) | ||
| 188 | break; | ||
| 189 | dentry = rpc_setup_pipedir_sb(sb, clnt, | 195 | dentry = rpc_setup_pipedir_sb(sb, clnt, |
| 190 | clnt->cl_program->pipe_dir_name); | 196 | clnt->cl_program->pipe_dir_name); |
| 191 | BUG_ON(dentry == NULL); | 197 | BUG_ON(dentry == NULL); |
| @@ -208,6 +214,20 @@ static int __rpc_pipefs_event(struct rpc_clnt *clnt, unsigned long event, | |||
| 208 | return err; | 214 | return err; |
| 209 | } | 215 | } |
| 210 | 216 | ||
| 217 | static int __rpc_pipefs_event(struct rpc_clnt *clnt, unsigned long event, | ||
| 218 | struct super_block *sb) | ||
| 219 | { | ||
| 220 | int error = 0; | ||
| 221 | |||
| 222 | for (;; clnt = clnt->cl_parent) { | ||
| 223 | if (!rpc_clnt_skip_event(clnt, event)) | ||
| 224 | error = __rpc_clnt_handle_event(clnt, event, sb); | ||
| 225 | if (error || clnt == clnt->cl_parent) | ||
| 226 | break; | ||
| 227 | } | ||
| 228 | return error; | ||
| 229 | } | ||
| 230 | |||
| 211 | static struct rpc_clnt *rpc_get_client_for_event(struct net *net, int event) | 231 | static struct rpc_clnt *rpc_get_client_for_event(struct net *net, int event) |
| 212 | { | 232 | { |
| 213 | struct sunrpc_net *sn = net_generic(net, sunrpc_net_id); | 233 | struct sunrpc_net *sn = net_generic(net, sunrpc_net_id); |
| @@ -215,10 +235,12 @@ static struct rpc_clnt *rpc_get_client_for_event(struct net *net, int event) | |||
| 215 | 235 | ||
| 216 | spin_lock(&sn->rpc_client_lock); | 236 | spin_lock(&sn->rpc_client_lock); |
| 217 | list_for_each_entry(clnt, &sn->all_clients, cl_clients) { | 237 | list_for_each_entry(clnt, &sn->all_clients, cl_clients) { |
| 218 | if (((event == RPC_PIPEFS_MOUNT) && clnt->cl_dentry) || | 238 | if (clnt->cl_program->pipe_dir_name == NULL) |
| 219 | ((event == RPC_PIPEFS_UMOUNT) && !clnt->cl_dentry)) | 239 | break; |
| 240 | if (rpc_clnt_skip_event(clnt, event)) | ||
| 241 | continue; | ||
| 242 | if (atomic_inc_not_zero(&clnt->cl_count) == 0) | ||
| 220 | continue; | 243 | continue; |
| 221 | atomic_inc(&clnt->cl_count); | ||
| 222 | spin_unlock(&sn->rpc_client_lock); | 244 | spin_unlock(&sn->rpc_client_lock); |
| 223 | return clnt; | 245 | return clnt; |
| 224 | } | 246 | } |
| @@ -257,6 +279,14 @@ void rpc_clients_notifier_unregister(void) | |||
| 257 | return rpc_pipefs_notifier_unregister(&rpc_clients_block); | 279 | return rpc_pipefs_notifier_unregister(&rpc_clients_block); |
| 258 | } | 280 | } |
| 259 | 281 | ||
| 282 | static void rpc_clnt_set_nodename(struct rpc_clnt *clnt, const char *nodename) | ||
| 283 | { | ||
| 284 | clnt->cl_nodelen = strlen(nodename); | ||
| 285 | if (clnt->cl_nodelen > UNX_MAXNODENAME) | ||
| 286 | clnt->cl_nodelen = UNX_MAXNODENAME; | ||
| 287 | memcpy(clnt->cl_nodename, nodename, clnt->cl_nodelen); | ||
| 288 | } | ||
| 289 | |||
| 260 | static struct rpc_clnt * rpc_new_client(const struct rpc_create_args *args, struct rpc_xprt *xprt) | 290 | static struct rpc_clnt * rpc_new_client(const struct rpc_create_args *args, struct rpc_xprt *xprt) |
| 261 | { | 291 | { |
| 262 | const struct rpc_program *program = args->program; | 292 | const struct rpc_program *program = args->program; |
| @@ -337,10 +367,7 @@ static struct rpc_clnt * rpc_new_client(const struct rpc_create_args *args, stru | |||
| 337 | } | 367 | } |
| 338 | 368 | ||
| 339 | /* save the nodename */ | 369 | /* save the nodename */ |
| 340 | clnt->cl_nodelen = strlen(init_utsname()->nodename); | 370 | rpc_clnt_set_nodename(clnt, utsname()->nodename); |
| 341 | if (clnt->cl_nodelen > UNX_MAXNODENAME) | ||
| 342 | clnt->cl_nodelen = UNX_MAXNODENAME; | ||
| 343 | memcpy(clnt->cl_nodename, init_utsname()->nodename, clnt->cl_nodelen); | ||
| 344 | rpc_register_client(clnt); | 371 | rpc_register_client(clnt); |
| 345 | return clnt; | 372 | return clnt; |
| 346 | 373 | ||
| @@ -499,6 +526,7 @@ rpc_clone_client(struct rpc_clnt *clnt) | |||
| 499 | err = rpc_setup_pipedir(new, clnt->cl_program->pipe_dir_name); | 526 | err = rpc_setup_pipedir(new, clnt->cl_program->pipe_dir_name); |
| 500 | if (err != 0) | 527 | if (err != 0) |
| 501 | goto out_no_path; | 528 | goto out_no_path; |
| 529 | rpc_clnt_set_nodename(new, utsname()->nodename); | ||
| 502 | if (new->cl_auth) | 530 | if (new->cl_auth) |
| 503 | atomic_inc(&new->cl_auth->au_count); | 531 | atomic_inc(&new->cl_auth->au_count); |
| 504 | atomic_inc(&clnt->cl_count); | 532 | atomic_inc(&clnt->cl_count); |
diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c index 0af37fc46818..3b62cf288031 100644 --- a/net/sunrpc/rpc_pipe.c +++ b/net/sunrpc/rpc_pipe.c | |||
| @@ -1126,19 +1126,20 @@ rpc_fill_super(struct super_block *sb, void *data, int silent) | |||
| 1126 | return -ENOMEM; | 1126 | return -ENOMEM; |
| 1127 | dprintk("RPC: sending pipefs MOUNT notification for net %p%s\n", net, | 1127 | dprintk("RPC: sending pipefs MOUNT notification for net %p%s\n", net, |
| 1128 | NET_NAME(net)); | 1128 | NET_NAME(net)); |
| 1129 | sn->pipefs_sb = sb; | ||
| 1129 | err = blocking_notifier_call_chain(&rpc_pipefs_notifier_list, | 1130 | err = blocking_notifier_call_chain(&rpc_pipefs_notifier_list, |
| 1130 | RPC_PIPEFS_MOUNT, | 1131 | RPC_PIPEFS_MOUNT, |
| 1131 | sb); | 1132 | sb); |
| 1132 | if (err) | 1133 | if (err) |
| 1133 | goto err_depopulate; | 1134 | goto err_depopulate; |
| 1134 | sb->s_fs_info = get_net(net); | 1135 | sb->s_fs_info = get_net(net); |
| 1135 | sn->pipefs_sb = sb; | ||
| 1136 | return 0; | 1136 | return 0; |
| 1137 | 1137 | ||
| 1138 | err_depopulate: | 1138 | err_depopulate: |
| 1139 | blocking_notifier_call_chain(&rpc_pipefs_notifier_list, | 1139 | blocking_notifier_call_chain(&rpc_pipefs_notifier_list, |
| 1140 | RPC_PIPEFS_UMOUNT, | 1140 | RPC_PIPEFS_UMOUNT, |
| 1141 | sb); | 1141 | sb); |
| 1142 | sn->pipefs_sb = NULL; | ||
| 1142 | __rpc_depopulate(root, files, RPCAUTH_lockd, RPCAUTH_RootEOF); | 1143 | __rpc_depopulate(root, files, RPCAUTH_lockd, RPCAUTH_RootEOF); |
| 1143 | return err; | 1144 | return err; |
| 1144 | } | 1145 | } |
diff --git a/net/sunrpc/sunrpc_syms.c b/net/sunrpc/sunrpc_syms.c index 8adfc88e793a..3d6498af9adc 100644 --- a/net/sunrpc/sunrpc_syms.c +++ b/net/sunrpc/sunrpc_syms.c | |||
| @@ -75,20 +75,21 @@ static struct pernet_operations sunrpc_net_ops = { | |||
| 75 | static int __init | 75 | static int __init |
| 76 | init_sunrpc(void) | 76 | init_sunrpc(void) |
| 77 | { | 77 | { |
| 78 | int err = register_rpc_pipefs(); | 78 | int err = rpc_init_mempool(); |
| 79 | if (err) | 79 | if (err) |
| 80 | goto out; | 80 | goto out; |
| 81 | err = rpc_init_mempool(); | ||
| 82 | if (err) | ||
| 83 | goto out2; | ||
| 84 | err = rpcauth_init_module(); | 81 | err = rpcauth_init_module(); |
| 85 | if (err) | 82 | if (err) |
| 86 | goto out3; | 83 | goto out2; |
| 87 | 84 | ||
| 88 | cache_initialize(); | 85 | cache_initialize(); |
| 89 | 86 | ||
| 90 | err = register_pernet_subsys(&sunrpc_net_ops); | 87 | err = register_pernet_subsys(&sunrpc_net_ops); |
| 91 | if (err) | 88 | if (err) |
| 89 | goto out3; | ||
| 90 | |||
| 91 | err = register_rpc_pipefs(); | ||
| 92 | if (err) | ||
| 92 | goto out4; | 93 | goto out4; |
| 93 | #ifdef RPC_DEBUG | 94 | #ifdef RPC_DEBUG |
| 94 | rpc_register_sysctl(); | 95 | rpc_register_sysctl(); |
| @@ -98,11 +99,11 @@ init_sunrpc(void) | |||
| 98 | return 0; | 99 | return 0; |
| 99 | 100 | ||
| 100 | out4: | 101 | out4: |
| 101 | rpcauth_remove_module(); | 102 | unregister_pernet_subsys(&sunrpc_net_ops); |
| 102 | out3: | 103 | out3: |
| 103 | rpc_destroy_mempool(); | 104 | rpcauth_remove_module(); |
| 104 | out2: | 105 | out2: |
| 105 | unregister_rpc_pipefs(); | 106 | rpc_destroy_mempool(); |
| 106 | out: | 107 | out: |
| 107 | return err; | 108 | return err; |
| 108 | } | 109 | } |
diff --git a/net/wireless/util.c b/net/wireless/util.c index 1b7a08df933c..957f25621617 100644 --- a/net/wireless/util.c +++ b/net/wireless/util.c | |||
| @@ -989,7 +989,7 @@ int cfg80211_can_change_interface(struct cfg80211_registered_device *rdev, | |||
| 989 | if (rdev->wiphy.software_iftypes & BIT(iftype)) | 989 | if (rdev->wiphy.software_iftypes & BIT(iftype)) |
| 990 | continue; | 990 | continue; |
| 991 | for (j = 0; j < c->n_limits; j++) { | 991 | for (j = 0; j < c->n_limits; j++) { |
| 992 | if (!(limits[j].types & iftype)) | 992 | if (!(limits[j].types & BIT(iftype))) |
| 993 | continue; | 993 | continue; |
| 994 | if (limits[j].max < num[iftype]) | 994 | if (limits[j].max < num[iftype]) |
| 995 | goto cont; | 995 | goto cont; |
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index de639eeeed50..faea0ec612bf 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl | |||
| @@ -1869,12 +1869,6 @@ sub process { | |||
| 1869 | "No space is necessary after a cast\n" . $hereprev); | 1869 | "No space is necessary after a cast\n" . $hereprev); |
| 1870 | } | 1870 | } |
| 1871 | 1871 | ||
| 1872 | if ($rawline =~ /^\+[ \t]*\/\*[ \t]*$/ && | ||
| 1873 | $prevrawline =~ /^\+[ \t]*$/) { | ||
| 1874 | CHK("BLOCK_COMMENT_STYLE", | ||
| 1875 | "Don't begin block comments with only a /* line, use /* comment...\n" . $hereprev); | ||
| 1876 | } | ||
| 1877 | |||
| 1878 | # check for spaces at the beginning of a line. | 1872 | # check for spaces at the beginning of a line. |
| 1879 | # Exceptions: | 1873 | # Exceptions: |
| 1880 | # 1) within comments | 1874 | # 1) within comments |
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c index 8e730ccc3f2b..44ddaa542db6 100644 --- a/scripts/mod/file2alias.c +++ b/scripts/mod/file2alias.c | |||
| @@ -1100,6 +1100,10 @@ void handle_moddevtable(struct module *mod, struct elf_info *info, | |||
| 1100 | if (!sym->st_shndx || get_secindex(info, sym) >= info->num_sections) | 1100 | if (!sym->st_shndx || get_secindex(info, sym) >= info->num_sections) |
| 1101 | return; | 1101 | return; |
| 1102 | 1102 | ||
| 1103 | /* We're looking for an object */ | ||
| 1104 | if (ELF_ST_TYPE(sym->st_info) != STT_OBJECT) | ||
| 1105 | return; | ||
| 1106 | |||
| 1103 | /* All our symbols are of form <prefix>__mod_XXX_device_table. */ | 1107 | /* All our symbols are of form <prefix>__mod_XXX_device_table. */ |
| 1104 | name = strstr(symname, "__mod_"); | 1108 | name = strstr(symname, "__mod_"); |
| 1105 | if (!name) | 1109 | if (!name) |
diff --git a/scripts/xz_wrap.sh b/scripts/xz_wrap.sh index 17a5798c29da..7a2d372f4885 100644 --- a/scripts/xz_wrap.sh +++ b/scripts/xz_wrap.sh | |||
| @@ -12,8 +12,8 @@ | |||
| 12 | BCJ= | 12 | BCJ= |
| 13 | LZMA2OPTS= | 13 | LZMA2OPTS= |
| 14 | 14 | ||
| 15 | case $ARCH in | 15 | case $SRCARCH in |
| 16 | x86|x86_64) BCJ=--x86 ;; | 16 | x86) BCJ=--x86 ;; |
| 17 | powerpc) BCJ=--powerpc ;; | 17 | powerpc) BCJ=--powerpc ;; |
| 18 | ia64) BCJ=--ia64; LZMA2OPTS=pb=4 ;; | 18 | ia64) BCJ=--ia64; LZMA2OPTS=pb=4 ;; |
| 19 | arm) BCJ=--arm ;; | 19 | arm) BCJ=--arm ;; |
diff --git a/security/commoncap.c b/security/commoncap.c index 0cf4b53480a7..71a166a05975 100644 --- a/security/commoncap.c +++ b/security/commoncap.c | |||
| @@ -29,6 +29,7 @@ | |||
| 29 | #include <linux/securebits.h> | 29 | #include <linux/securebits.h> |
| 30 | #include <linux/user_namespace.h> | 30 | #include <linux/user_namespace.h> |
| 31 | #include <linux/binfmts.h> | 31 | #include <linux/binfmts.h> |
| 32 | #include <linux/personality.h> | ||
| 32 | 33 | ||
| 33 | /* | 34 | /* |
| 34 | * If a non-root user executes a setuid-root binary in | 35 | * If a non-root user executes a setuid-root binary in |
| @@ -505,6 +506,11 @@ int cap_bprm_set_creds(struct linux_binprm *bprm) | |||
| 505 | } | 506 | } |
| 506 | skip: | 507 | skip: |
| 507 | 508 | ||
| 509 | /* if we have fs caps, clear dangerous personality flags */ | ||
| 510 | if (!cap_issubset(new->cap_permitted, old->cap_permitted)) | ||
| 511 | bprm->per_clear |= PER_CLEAR_ON_SETID; | ||
| 512 | |||
| 513 | |||
| 508 | /* Don't let someone trace a set[ug]id/setpcap binary with the revised | 514 | /* Don't let someone trace a set[ug]id/setpcap binary with the revised |
| 509 | * credentials unless they have the appropriate permit | 515 | * credentials unless they have the appropriate permit |
| 510 | */ | 516 | */ |
diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c index 10056f2f6df3..45c32f074166 100644 --- a/security/smack/smack_lsm.c +++ b/security/smack/smack_lsm.c | |||
| @@ -3640,8 +3640,38 @@ struct security_operations smack_ops = { | |||
| 3640 | }; | 3640 | }; |
| 3641 | 3641 | ||
| 3642 | 3642 | ||
| 3643 | static __init void init_smack_know_list(void) | 3643 | static __init void init_smack_known_list(void) |
| 3644 | { | 3644 | { |
| 3645 | /* | ||
| 3646 | * Initialize CIPSO locks | ||
| 3647 | */ | ||
| 3648 | spin_lock_init(&smack_known_huh.smk_cipsolock); | ||
| 3649 | spin_lock_init(&smack_known_hat.smk_cipsolock); | ||
| 3650 | spin_lock_init(&smack_known_star.smk_cipsolock); | ||
| 3651 | spin_lock_init(&smack_known_floor.smk_cipsolock); | ||
| 3652 | spin_lock_init(&smack_known_invalid.smk_cipsolock); | ||
| 3653 | spin_lock_init(&smack_known_web.smk_cipsolock); | ||
| 3654 | /* | ||
| 3655 | * Initialize rule list locks | ||
| 3656 | */ | ||
| 3657 | mutex_init(&smack_known_huh.smk_rules_lock); | ||
| 3658 | mutex_init(&smack_known_hat.smk_rules_lock); | ||
| 3659 | mutex_init(&smack_known_floor.smk_rules_lock); | ||
| 3660 | mutex_init(&smack_known_star.smk_rules_lock); | ||
| 3661 | mutex_init(&smack_known_invalid.smk_rules_lock); | ||
| 3662 | mutex_init(&smack_known_web.smk_rules_lock); | ||
| 3663 | /* | ||
| 3664 | * Initialize rule lists | ||
| 3665 | */ | ||
| 3666 | INIT_LIST_HEAD(&smack_known_huh.smk_rules); | ||
| 3667 | INIT_LIST_HEAD(&smack_known_hat.smk_rules); | ||
| 3668 | INIT_LIST_HEAD(&smack_known_star.smk_rules); | ||
| 3669 | INIT_LIST_HEAD(&smack_known_floor.smk_rules); | ||
| 3670 | INIT_LIST_HEAD(&smack_known_invalid.smk_rules); | ||
| 3671 | INIT_LIST_HEAD(&smack_known_web.smk_rules); | ||
| 3672 | /* | ||
| 3673 | * Create the known labels list | ||
| 3674 | */ | ||
| 3645 | list_add(&smack_known_huh.list, &smack_known_list); | 3675 | list_add(&smack_known_huh.list, &smack_known_list); |
| 3646 | list_add(&smack_known_hat.list, &smack_known_list); | 3676 | list_add(&smack_known_hat.list, &smack_known_list); |
| 3647 | list_add(&smack_known_star.list, &smack_known_list); | 3677 | list_add(&smack_known_star.list, &smack_known_list); |
| @@ -3676,16 +3706,8 @@ static __init int smack_init(void) | |||
| 3676 | cred = (struct cred *) current->cred; | 3706 | cred = (struct cred *) current->cred; |
| 3677 | cred->security = tsp; | 3707 | cred->security = tsp; |
| 3678 | 3708 | ||
| 3679 | /* initialize the smack_know_list */ | 3709 | /* initialize the smack_known_list */ |
| 3680 | init_smack_know_list(); | 3710 | init_smack_known_list(); |
| 3681 | /* | ||
| 3682 | * Initialize locks | ||
| 3683 | */ | ||
| 3684 | spin_lock_init(&smack_known_huh.smk_cipsolock); | ||
| 3685 | spin_lock_init(&smack_known_hat.smk_cipsolock); | ||
| 3686 | spin_lock_init(&smack_known_star.smk_cipsolock); | ||
| 3687 | spin_lock_init(&smack_known_floor.smk_cipsolock); | ||
| 3688 | spin_lock_init(&smack_known_invalid.smk_cipsolock); | ||
| 3689 | 3711 | ||
| 3690 | /* | 3712 | /* |
| 3691 | * Register with LSM | 3713 | * Register with LSM |
diff --git a/security/smack/smackfs.c b/security/smack/smackfs.c index 5c32f36ff706..038811cb7e62 100644 --- a/security/smack/smackfs.c +++ b/security/smack/smackfs.c | |||
| @@ -1614,20 +1614,6 @@ static int __init init_smk_fs(void) | |||
| 1614 | smk_cipso_doi(); | 1614 | smk_cipso_doi(); |
| 1615 | smk_unlbl_ambient(NULL); | 1615 | smk_unlbl_ambient(NULL); |
| 1616 | 1616 | ||
| 1617 | mutex_init(&smack_known_floor.smk_rules_lock); | ||
| 1618 | mutex_init(&smack_known_hat.smk_rules_lock); | ||
| 1619 | mutex_init(&smack_known_huh.smk_rules_lock); | ||
| 1620 | mutex_init(&smack_known_invalid.smk_rules_lock); | ||
| 1621 | mutex_init(&smack_known_star.smk_rules_lock); | ||
| 1622 | mutex_init(&smack_known_web.smk_rules_lock); | ||
| 1623 | |||
| 1624 | INIT_LIST_HEAD(&smack_known_floor.smk_rules); | ||
| 1625 | INIT_LIST_HEAD(&smack_known_hat.smk_rules); | ||
| 1626 | INIT_LIST_HEAD(&smack_known_huh.smk_rules); | ||
| 1627 | INIT_LIST_HEAD(&smack_known_invalid.smk_rules); | ||
| 1628 | INIT_LIST_HEAD(&smack_known_star.smk_rules); | ||
| 1629 | INIT_LIST_HEAD(&smack_known_web.smk_rules); | ||
| 1630 | |||
| 1631 | return err; | 1617 | return err; |
| 1632 | } | 1618 | } |
| 1633 | 1619 | ||
diff --git a/sound/core/vmaster.c b/sound/core/vmaster.c index 14a286a7bf2b..857586135d18 100644 --- a/sound/core/vmaster.c +++ b/sound/core/vmaster.c | |||
| @@ -419,6 +419,7 @@ EXPORT_SYMBOL(snd_ctl_make_virtual_master); | |||
| 419 | * snd_ctl_add_vmaster_hook - Add a hook to a vmaster control | 419 | * snd_ctl_add_vmaster_hook - Add a hook to a vmaster control |
| 420 | * @kcontrol: vmaster kctl element | 420 | * @kcontrol: vmaster kctl element |
| 421 | * @hook: the hook function | 421 | * @hook: the hook function |
| 422 | * @private_data: the private_data pointer to be saved | ||
| 422 | * | 423 | * |
| 423 | * Adds the given hook to the vmaster control element so that it's called | 424 | * Adds the given hook to the vmaster control element so that it's called |
| 424 | * at each time when the value is changed. | 425 | * at each time when the value is changed. |
diff --git a/sound/last.c b/sound/last.c index bdd0857b8871..7ffc182e0844 100644 --- a/sound/last.c +++ b/sound/last.c | |||
| @@ -38,4 +38,4 @@ static int __init alsa_sound_last_init(void) | |||
| 38 | return 0; | 38 | return 0; |
| 39 | } | 39 | } |
| 40 | 40 | ||
| 41 | __initcall(alsa_sound_last_init); | 41 | late_initcall_sync(alsa_sound_last_init); |
diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c index a36488d94aaa..d906c5b74cf0 100644 --- a/sound/pci/hda/patch_conexant.c +++ b/sound/pci/hda/patch_conexant.c | |||
| @@ -3971,9 +3971,14 @@ static void cx_auto_init_output(struct hda_codec *codec) | |||
| 3971 | int i; | 3971 | int i; |
| 3972 | 3972 | ||
| 3973 | mute_outputs(codec, spec->multiout.num_dacs, spec->multiout.dac_nids); | 3973 | mute_outputs(codec, spec->multiout.num_dacs, spec->multiout.dac_nids); |
| 3974 | for (i = 0; i < cfg->hp_outs; i++) | 3974 | for (i = 0; i < cfg->hp_outs; i++) { |
| 3975 | unsigned int val = PIN_OUT; | ||
| 3976 | if (snd_hda_query_pin_caps(codec, cfg->hp_pins[i]) & | ||
| 3977 | AC_PINCAP_HP_DRV) | ||
| 3978 | val |= AC_PINCTL_HP_EN; | ||
| 3975 | snd_hda_codec_write(codec, cfg->hp_pins[i], 0, | 3979 | snd_hda_codec_write(codec, cfg->hp_pins[i], 0, |
| 3976 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP); | 3980 | AC_VERB_SET_PIN_WIDGET_CONTROL, val); |
| 3981 | } | ||
| 3977 | mute_outputs(codec, cfg->hp_outs, cfg->hp_pins); | 3982 | mute_outputs(codec, cfg->hp_outs, cfg->hp_pins); |
| 3978 | mute_outputs(codec, cfg->line_outs, cfg->line_out_pins); | 3983 | mute_outputs(codec, cfg->line_outs, cfg->line_out_pins); |
| 3979 | mute_outputs(codec, cfg->speaker_outs, cfg->speaker_pins); | 3984 | mute_outputs(codec, cfg->speaker_outs, cfg->speaker_pins); |
| @@ -4391,8 +4396,10 @@ static void apply_pin_fixup(struct hda_codec *codec, | |||
| 4391 | 4396 | ||
| 4392 | enum { | 4397 | enum { |
| 4393 | CXT_PINCFG_LENOVO_X200, | 4398 | CXT_PINCFG_LENOVO_X200, |
| 4399 | CXT_PINCFG_LENOVO_TP410, | ||
| 4394 | }; | 4400 | }; |
| 4395 | 4401 | ||
| 4402 | /* ThinkPad X200 & co with cxt5051 */ | ||
| 4396 | static const struct cxt_pincfg cxt_pincfg_lenovo_x200[] = { | 4403 | static const struct cxt_pincfg cxt_pincfg_lenovo_x200[] = { |
| 4397 | { 0x16, 0x042140ff }, /* HP (seq# overridden) */ | 4404 | { 0x16, 0x042140ff }, /* HP (seq# overridden) */ |
| 4398 | { 0x17, 0x21a11000 }, /* dock-mic */ | 4405 | { 0x17, 0x21a11000 }, /* dock-mic */ |
| @@ -4401,15 +4408,33 @@ static const struct cxt_pincfg cxt_pincfg_lenovo_x200[] = { | |||
| 4401 | {} | 4408 | {} |
| 4402 | }; | 4409 | }; |
| 4403 | 4410 | ||
| 4411 | /* ThinkPad 410/420/510/520, X201 & co with cxt5066 */ | ||
| 4412 | static const struct cxt_pincfg cxt_pincfg_lenovo_tp410[] = { | ||
| 4413 | { 0x19, 0x042110ff }, /* HP (seq# overridden) */ | ||
| 4414 | { 0x1a, 0x21a190f0 }, /* dock-mic */ | ||
| 4415 | { 0x1c, 0x212140ff }, /* dock-HP */ | ||
| 4416 | {} | ||
| 4417 | }; | ||
| 4418 | |||
| 4404 | static const struct cxt_pincfg *cxt_pincfg_tbl[] = { | 4419 | static const struct cxt_pincfg *cxt_pincfg_tbl[] = { |
| 4405 | [CXT_PINCFG_LENOVO_X200] = cxt_pincfg_lenovo_x200, | 4420 | [CXT_PINCFG_LENOVO_X200] = cxt_pincfg_lenovo_x200, |
| 4421 | [CXT_PINCFG_LENOVO_TP410] = cxt_pincfg_lenovo_tp410, | ||
| 4406 | }; | 4422 | }; |
| 4407 | 4423 | ||
| 4408 | static const struct snd_pci_quirk cxt_fixups[] = { | 4424 | static const struct snd_pci_quirk cxt5051_fixups[] = { |
| 4409 | SND_PCI_QUIRK(0x17aa, 0x20f2, "Lenovo X200", CXT_PINCFG_LENOVO_X200), | 4425 | SND_PCI_QUIRK(0x17aa, 0x20f2, "Lenovo X200", CXT_PINCFG_LENOVO_X200), |
| 4410 | {} | 4426 | {} |
| 4411 | }; | 4427 | }; |
| 4412 | 4428 | ||
| 4429 | static const struct snd_pci_quirk cxt5066_fixups[] = { | ||
| 4430 | SND_PCI_QUIRK(0x17aa, 0x20f2, "Lenovo T400", CXT_PINCFG_LENOVO_TP410), | ||
| 4431 | SND_PCI_QUIRK(0x17aa, 0x215e, "Lenovo T410", CXT_PINCFG_LENOVO_TP410), | ||
| 4432 | SND_PCI_QUIRK(0x17aa, 0x215f, "Lenovo T510", CXT_PINCFG_LENOVO_TP410), | ||
| 4433 | SND_PCI_QUIRK(0x17aa, 0x21ce, "Lenovo T420", CXT_PINCFG_LENOVO_TP410), | ||
| 4434 | SND_PCI_QUIRK(0x17aa, 0x21cf, "Lenovo T520", CXT_PINCFG_LENOVO_TP410), | ||
| 4435 | {} | ||
| 4436 | }; | ||
| 4437 | |||
| 4413 | /* add "fake" mute amp-caps to DACs on cx5051 so that mixer mute switches | 4438 | /* add "fake" mute amp-caps to DACs on cx5051 so that mixer mute switches |
| 4414 | * can be created (bko#42825) | 4439 | * can be created (bko#42825) |
| 4415 | */ | 4440 | */ |
| @@ -4446,13 +4471,13 @@ static int patch_conexant_auto(struct hda_codec *codec) | |||
| 4446 | case 0x14f15051: | 4471 | case 0x14f15051: |
| 4447 | add_cx5051_fake_mutes(codec); | 4472 | add_cx5051_fake_mutes(codec); |
| 4448 | codec->pin_amp_workaround = 1; | 4473 | codec->pin_amp_workaround = 1; |
| 4474 | apply_pin_fixup(codec, cxt5051_fixups, cxt_pincfg_tbl); | ||
| 4449 | break; | 4475 | break; |
| 4450 | default: | 4476 | default: |
| 4451 | codec->pin_amp_workaround = 1; | 4477 | codec->pin_amp_workaround = 1; |
| 4478 | apply_pin_fixup(codec, cxt5066_fixups, cxt_pincfg_tbl); | ||
| 4452 | } | 4479 | } |
| 4453 | 4480 | ||
| 4454 | apply_pin_fixup(codec, cxt_fixups, cxt_pincfg_tbl); | ||
| 4455 | |||
| 4456 | /* Show mute-led control only on HP laptops | 4481 | /* Show mute-led control only on HP laptops |
| 4457 | * This is a sort of white-list: on HP laptops, EAPD corresponds | 4482 | * This is a sort of white-list: on HP laptops, EAPD corresponds |
| 4458 | * only to the mute-LED without actualy amp function. Meanwhile, | 4483 | * only to the mute-LED without actualy amp function. Meanwhile, |
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 2508f8109f11..818f90bc7d57 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
| @@ -1445,6 +1445,13 @@ enum { | |||
| 1445 | ALC_FIXUP_ACT_BUILD, | 1445 | ALC_FIXUP_ACT_BUILD, |
| 1446 | }; | 1446 | }; |
| 1447 | 1447 | ||
| 1448 | static void alc_apply_pincfgs(struct hda_codec *codec, | ||
| 1449 | const struct alc_pincfg *cfg) | ||
| 1450 | { | ||
| 1451 | for (; cfg->nid; cfg++) | ||
| 1452 | snd_hda_codec_set_pincfg(codec, cfg->nid, cfg->val); | ||
| 1453 | } | ||
| 1454 | |||
| 1448 | static void alc_apply_fixup(struct hda_codec *codec, int action) | 1455 | static void alc_apply_fixup(struct hda_codec *codec, int action) |
| 1449 | { | 1456 | { |
| 1450 | struct alc_spec *spec = codec->spec; | 1457 | struct alc_spec *spec = codec->spec; |
| @@ -1478,9 +1485,7 @@ static void alc_apply_fixup(struct hda_codec *codec, int action) | |||
| 1478 | snd_printdd(KERN_INFO "hda_codec: %s: " | 1485 | snd_printdd(KERN_INFO "hda_codec: %s: " |
| 1479 | "Apply pincfg for %s\n", | 1486 | "Apply pincfg for %s\n", |
| 1480 | codec->chip_name, modelname); | 1487 | codec->chip_name, modelname); |
| 1481 | for (; cfg->nid; cfg++) | 1488 | alc_apply_pincfgs(codec, cfg); |
| 1482 | snd_hda_codec_set_pincfg(codec, cfg->nid, | ||
| 1483 | cfg->val); | ||
| 1484 | break; | 1489 | break; |
| 1485 | case ALC_FIXUP_VERBS: | 1490 | case ALC_FIXUP_VERBS: |
| 1486 | if (action != ALC_FIXUP_ACT_PROBE || !fix->v.verbs) | 1491 | if (action != ALC_FIXUP_ACT_PROBE || !fix->v.verbs) |
| @@ -4861,6 +4866,7 @@ enum { | |||
| 4861 | ALC260_FIXUP_GPIO1_TOGGLE, | 4866 | ALC260_FIXUP_GPIO1_TOGGLE, |
| 4862 | ALC260_FIXUP_REPLACER, | 4867 | ALC260_FIXUP_REPLACER, |
| 4863 | ALC260_FIXUP_HP_B1900, | 4868 | ALC260_FIXUP_HP_B1900, |
| 4869 | ALC260_FIXUP_KN1, | ||
| 4864 | }; | 4870 | }; |
| 4865 | 4871 | ||
| 4866 | static void alc260_gpio1_automute(struct hda_codec *codec) | 4872 | static void alc260_gpio1_automute(struct hda_codec *codec) |
| @@ -4888,6 +4894,36 @@ static void alc260_fixup_gpio1_toggle(struct hda_codec *codec, | |||
| 4888 | } | 4894 | } |
| 4889 | } | 4895 | } |
| 4890 | 4896 | ||
| 4897 | static void alc260_fixup_kn1(struct hda_codec *codec, | ||
| 4898 | const struct alc_fixup *fix, int action) | ||
| 4899 | { | ||
| 4900 | struct alc_spec *spec = codec->spec; | ||
| 4901 | static const struct alc_pincfg pincfgs[] = { | ||
| 4902 | { 0x0f, 0x02214000 }, /* HP/speaker */ | ||
| 4903 | { 0x12, 0x90a60160 }, /* int mic */ | ||
| 4904 | { 0x13, 0x02a19000 }, /* ext mic */ | ||
| 4905 | { 0x18, 0x01446000 }, /* SPDIF out */ | ||
| 4906 | /* disable bogus I/O pins */ | ||
| 4907 | { 0x10, 0x411111f0 }, | ||
| 4908 | { 0x11, 0x411111f0 }, | ||
| 4909 | { 0x14, 0x411111f0 }, | ||
| 4910 | { 0x15, 0x411111f0 }, | ||
| 4911 | { 0x16, 0x411111f0 }, | ||
| 4912 | { 0x17, 0x411111f0 }, | ||
| 4913 | { 0x19, 0x411111f0 }, | ||
| 4914 | { } | ||
| 4915 | }; | ||
| 4916 | |||
| 4917 | switch (action) { | ||
| 4918 | case ALC_FIXUP_ACT_PRE_PROBE: | ||
| 4919 | alc_apply_pincfgs(codec, pincfgs); | ||
| 4920 | break; | ||
| 4921 | case ALC_FIXUP_ACT_PROBE: | ||
| 4922 | spec->init_amp = ALC_INIT_NONE; | ||
| 4923 | break; | ||
| 4924 | } | ||
| 4925 | } | ||
| 4926 | |||
| 4891 | static const struct alc_fixup alc260_fixups[] = { | 4927 | static const struct alc_fixup alc260_fixups[] = { |
| 4892 | [ALC260_FIXUP_HP_DC5750] = { | 4928 | [ALC260_FIXUP_HP_DC5750] = { |
| 4893 | .type = ALC_FIXUP_PINS, | 4929 | .type = ALC_FIXUP_PINS, |
| @@ -4938,7 +4974,11 @@ static const struct alc_fixup alc260_fixups[] = { | |||
| 4938 | .v.func = alc260_fixup_gpio1_toggle, | 4974 | .v.func = alc260_fixup_gpio1_toggle, |
| 4939 | .chained = true, | 4975 | .chained = true, |
| 4940 | .chain_id = ALC260_FIXUP_COEF, | 4976 | .chain_id = ALC260_FIXUP_COEF, |
| 4941 | } | 4977 | }, |
| 4978 | [ALC260_FIXUP_KN1] = { | ||
| 4979 | .type = ALC_FIXUP_FUNC, | ||
| 4980 | .v.func = alc260_fixup_kn1, | ||
| 4981 | }, | ||
| 4942 | }; | 4982 | }; |
| 4943 | 4983 | ||
| 4944 | static const struct snd_pci_quirk alc260_fixup_tbl[] = { | 4984 | static const struct snd_pci_quirk alc260_fixup_tbl[] = { |
| @@ -4948,6 +4988,7 @@ static const struct snd_pci_quirk alc260_fixup_tbl[] = { | |||
| 4948 | SND_PCI_QUIRK(0x103c, 0x280a, "HP dc5750", ALC260_FIXUP_HP_DC5750), | 4988 | SND_PCI_QUIRK(0x103c, 0x280a, "HP dc5750", ALC260_FIXUP_HP_DC5750), |
| 4949 | SND_PCI_QUIRK(0x103c, 0x30ba, "HP Presario B1900", ALC260_FIXUP_HP_B1900), | 4989 | SND_PCI_QUIRK(0x103c, 0x30ba, "HP Presario B1900", ALC260_FIXUP_HP_B1900), |
| 4950 | SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FIXUP_GPIO1), | 4990 | SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FIXUP_GPIO1), |
| 4991 | SND_PCI_QUIRK(0x152d, 0x0729, "Quanta KN1", ALC260_FIXUP_KN1), | ||
| 4951 | SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_FIXUP_REPLACER), | 4992 | SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_FIXUP_REPLACER), |
| 4952 | SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_FIXUP_COEF), | 4993 | SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_FIXUP_COEF), |
| 4953 | {} | 4994 | {} |
| @@ -6068,6 +6109,7 @@ static const struct alc_fixup alc269_fixups[] = { | |||
| 6068 | 6109 | ||
| 6069 | static const struct snd_pci_quirk alc269_fixup_tbl[] = { | 6110 | static const struct snd_pci_quirk alc269_fixup_tbl[] = { |
| 6070 | SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_MIC2_MUTE_LED), | 6111 | SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_MIC2_MUTE_LED), |
| 6112 | SND_PCI_QUIRK(0x1043, 0x1427, "Asus Zenbook UX31E", ALC269VB_FIXUP_DMIC), | ||
| 6071 | SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW), | 6113 | SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW), |
| 6072 | SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_FIXUP_STEREO_DMIC), | 6114 | SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_FIXUP_STEREO_DMIC), |
| 6073 | SND_PCI_QUIRK(0x1043, 0x831a, "ASUS P901", ALC269_FIXUP_STEREO_DMIC), | 6115 | SND_PCI_QUIRK(0x1043, 0x831a, "ASUS P901", ALC269_FIXUP_STEREO_DMIC), |
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index 33a9946b492c..4742cac26aa9 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c | |||
| @@ -5063,12 +5063,11 @@ static void stac92xx_update_led_status(struct hda_codec *codec, int enabled) | |||
| 5063 | if (spec->gpio_led_polarity) | 5063 | if (spec->gpio_led_polarity) |
| 5064 | muted = !muted; | 5064 | muted = !muted; |
| 5065 | 5065 | ||
| 5066 | /*polarity defines *not* muted state level*/ | ||
| 5067 | if (!spec->vref_mute_led_nid) { | 5066 | if (!spec->vref_mute_led_nid) { |
| 5068 | if (muted) | 5067 | if (muted) |
| 5069 | spec->gpio_data &= ~spec->gpio_led; /* orange */ | 5068 | spec->gpio_data |= spec->gpio_led; |
| 5070 | else | 5069 | else |
| 5071 | spec->gpio_data |= spec->gpio_led; /* white */ | 5070 | spec->gpio_data &= ~spec->gpio_led; |
| 5072 | stac_gpio_set(codec, spec->gpio_mask, | 5071 | stac_gpio_set(codec, spec->gpio_mask, |
| 5073 | spec->gpio_dir, spec->gpio_data); | 5072 | spec->gpio_dir, spec->gpio_data); |
| 5074 | } else { | 5073 | } else { |
diff --git a/sound/soc/blackfin/bf5xx-ssm2602.c b/sound/soc/blackfin/bf5xx-ssm2602.c index df3ac73f8778..b39ad356b92b 100644 --- a/sound/soc/blackfin/bf5xx-ssm2602.c +++ b/sound/soc/blackfin/bf5xx-ssm2602.c | |||
| @@ -99,6 +99,7 @@ static struct snd_soc_dai_link bf5xx_ssm2602_dai[] = { | |||
| 99 | .platform_name = "bfin-i2s-pcm-audio", | 99 | .platform_name = "bfin-i2s-pcm-audio", |
| 100 | .codec_name = "ssm2602.0-001b", | 100 | .codec_name = "ssm2602.0-001b", |
| 101 | .ops = &bf5xx_ssm2602_ops, | 101 | .ops = &bf5xx_ssm2602_ops, |
| 102 | .dai_fmt = BF5XX_SSM2602_DAIFMT, | ||
| 102 | }, | 103 | }, |
| 103 | { | 104 | { |
| 104 | .name = "ssm2602", | 105 | .name = "ssm2602", |
| @@ -108,6 +109,7 @@ static struct snd_soc_dai_link bf5xx_ssm2602_dai[] = { | |||
| 108 | .platform_name = "bfin-i2s-pcm-audio", | 109 | .platform_name = "bfin-i2s-pcm-audio", |
| 109 | .codec_name = "ssm2602.0-001b", | 110 | .codec_name = "ssm2602.0-001b", |
| 110 | .ops = &bf5xx_ssm2602_ops, | 111 | .ops = &bf5xx_ssm2602_ops, |
| 112 | .dai_fmt = BF5XX_SSM2602_DAIFMT, | ||
| 111 | }, | 113 | }, |
| 112 | }; | 114 | }; |
| 113 | 115 | ||
diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig index 6508e8b790bb..59d8efaa17e9 100644 --- a/sound/soc/codecs/Kconfig +++ b/sound/soc/codecs/Kconfig | |||
| @@ -57,7 +57,7 @@ config SND_SOC_ALL_CODECS | |||
| 57 | select SND_SOC_TPA6130A2 if I2C | 57 | select SND_SOC_TPA6130A2 if I2C |
| 58 | select SND_SOC_TLV320DAC33 if I2C | 58 | select SND_SOC_TLV320DAC33 if I2C |
| 59 | select SND_SOC_TWL4030 if TWL4030_CORE | 59 | select SND_SOC_TWL4030 if TWL4030_CORE |
| 60 | select SND_SOC_TWL6040 if TWL4030_CORE | 60 | select SND_SOC_TWL6040 if TWL6040_CORE |
| 61 | select SND_SOC_UDA134X | 61 | select SND_SOC_UDA134X |
| 62 | select SND_SOC_UDA1380 if I2C | 62 | select SND_SOC_UDA1380 if I2C |
| 63 | select SND_SOC_WL1273 if MFD_WL1273_CORE | 63 | select SND_SOC_WL1273 if MFD_WL1273_CORE |
| @@ -276,7 +276,6 @@ config SND_SOC_TWL4030 | |||
| 276 | tristate | 276 | tristate |
| 277 | 277 | ||
| 278 | config SND_SOC_TWL6040 | 278 | config SND_SOC_TWL6040 |
| 279 | select TWL6040_CORE | ||
| 280 | tristate | 279 | tristate |
| 281 | 280 | ||
| 282 | config SND_SOC_UDA134X | 281 | config SND_SOC_UDA134X |
diff --git a/sound/soc/codecs/cs42l73.c b/sound/soc/codecs/cs42l73.c index 78979b3e0e95..07c44b71f096 100644 --- a/sound/soc/codecs/cs42l73.c +++ b/sound/soc/codecs/cs42l73.c | |||
| @@ -929,6 +929,8 @@ static int cs42l73_set_mclk(struct snd_soc_dai *dai, unsigned int freq) | |||
| 929 | 929 | ||
| 930 | /* MCLKX -> MCLK */ | 930 | /* MCLKX -> MCLK */ |
| 931 | mclkx_coeff = cs42l73_get_mclkx_coeff(freq); | 931 | mclkx_coeff = cs42l73_get_mclkx_coeff(freq); |
| 932 | if (mclkx_coeff < 0) | ||
| 933 | return mclkx_coeff; | ||
| 932 | 934 | ||
| 933 | mclk = cs42l73_mclkx_coeffs[mclkx_coeff].mclkx / | 935 | mclk = cs42l73_mclkx_coeffs[mclkx_coeff].mclkx / |
| 934 | cs42l73_mclkx_coeffs[mclkx_coeff].ratio; | 936 | cs42l73_mclkx_coeffs[mclkx_coeff].ratio; |
diff --git a/sound/soc/codecs/tlv320aic23.c b/sound/soc/codecs/tlv320aic23.c index 16d55f91a653..df1e07ffac32 100644 --- a/sound/soc/codecs/tlv320aic23.c +++ b/sound/soc/codecs/tlv320aic23.c | |||
| @@ -472,7 +472,7 @@ static int tlv320aic23_set_dai_sysclk(struct snd_soc_dai *codec_dai, | |||
| 472 | static int tlv320aic23_set_bias_level(struct snd_soc_codec *codec, | 472 | static int tlv320aic23_set_bias_level(struct snd_soc_codec *codec, |
| 473 | enum snd_soc_bias_level level) | 473 | enum snd_soc_bias_level level) |
| 474 | { | 474 | { |
| 475 | u16 reg = snd_soc_read(codec, TLV320AIC23_PWR) & 0xff7f; | 475 | u16 reg = snd_soc_read(codec, TLV320AIC23_PWR) & 0x17f; |
| 476 | 476 | ||
| 477 | switch (level) { | 477 | switch (level) { |
| 478 | case SND_SOC_BIAS_ON: | 478 | case SND_SOC_BIAS_ON: |
| @@ -491,7 +491,7 @@ static int tlv320aic23_set_bias_level(struct snd_soc_codec *codec, | |||
| 491 | case SND_SOC_BIAS_OFF: | 491 | case SND_SOC_BIAS_OFF: |
| 492 | /* everything off, dac mute, inactive */ | 492 | /* everything off, dac mute, inactive */ |
| 493 | snd_soc_write(codec, TLV320AIC23_ACTIVE, 0x0); | 493 | snd_soc_write(codec, TLV320AIC23_ACTIVE, 0x0); |
| 494 | snd_soc_write(codec, TLV320AIC23_PWR, 0xffff); | 494 | snd_soc_write(codec, TLV320AIC23_PWR, 0x1ff); |
| 495 | break; | 495 | break; |
| 496 | } | 496 | } |
| 497 | codec->dapm.bias_level = level; | 497 | codec->dapm.bias_level = level; |
diff --git a/sound/soc/codecs/twl6040.c b/sound/soc/codecs/twl6040.c index 2d8c6b825e57..dc7509b9d53a 100644 --- a/sound/soc/codecs/twl6040.c +++ b/sound/soc/codecs/twl6040.c | |||
| @@ -26,7 +26,6 @@ | |||
| 26 | #include <linux/pm.h> | 26 | #include <linux/pm.h> |
| 27 | #include <linux/platform_device.h> | 27 | #include <linux/platform_device.h> |
| 28 | #include <linux/slab.h> | 28 | #include <linux/slab.h> |
| 29 | #include <linux/i2c/twl.h> | ||
| 30 | #include <linux/mfd/twl6040.h> | 29 | #include <linux/mfd/twl6040.h> |
| 31 | 30 | ||
| 32 | #include <sound/core.h> | 31 | #include <sound/core.h> |
| @@ -1528,7 +1527,7 @@ static int twl6040_resume(struct snd_soc_codec *codec) | |||
| 1528 | static int twl6040_probe(struct snd_soc_codec *codec) | 1527 | static int twl6040_probe(struct snd_soc_codec *codec) |
| 1529 | { | 1528 | { |
| 1530 | struct twl6040_data *priv; | 1529 | struct twl6040_data *priv; |
| 1531 | struct twl4030_codec_data *pdata = dev_get_platdata(codec->dev); | 1530 | struct twl6040_codec_data *pdata = dev_get_platdata(codec->dev); |
| 1532 | struct platform_device *pdev = container_of(codec->dev, | 1531 | struct platform_device *pdev = container_of(codec->dev, |
| 1533 | struct platform_device, dev); | 1532 | struct platform_device, dev); |
| 1534 | int ret = 0; | 1533 | int ret = 0; |
diff --git a/sound/soc/codecs/wm8350.c b/sound/soc/codecs/wm8350.c index 8c4c9591ec05..aa12c6b6beeb 100644 --- a/sound/soc/codecs/wm8350.c +++ b/sound/soc/codecs/wm8350.c | |||
| @@ -60,7 +60,7 @@ struct wm8350_jack_data { | |||
| 60 | }; | 60 | }; |
| 61 | 61 | ||
| 62 | struct wm8350_data { | 62 | struct wm8350_data { |
| 63 | struct snd_soc_codec codec; | 63 | struct wm8350 *wm8350; |
| 64 | struct wm8350_output out1; | 64 | struct wm8350_output out1; |
| 65 | struct wm8350_output out2; | 65 | struct wm8350_output out2; |
| 66 | struct wm8350_jack_data hpl; | 66 | struct wm8350_jack_data hpl; |
| @@ -1309,7 +1309,7 @@ static void wm8350_hp_work(struct wm8350_data *priv, | |||
| 1309 | struct wm8350_jack_data *jack, | 1309 | struct wm8350_jack_data *jack, |
| 1310 | u16 mask) | 1310 | u16 mask) |
| 1311 | { | 1311 | { |
| 1312 | struct wm8350 *wm8350 = priv->codec.control_data; | 1312 | struct wm8350 *wm8350 = priv->wm8350; |
| 1313 | u16 reg; | 1313 | u16 reg; |
| 1314 | int report; | 1314 | int report; |
| 1315 | 1315 | ||
| @@ -1342,7 +1342,7 @@ static void wm8350_hpr_work(struct work_struct *work) | |||
| 1342 | static irqreturn_t wm8350_hp_jack_handler(int irq, void *data) | 1342 | static irqreturn_t wm8350_hp_jack_handler(int irq, void *data) |
| 1343 | { | 1343 | { |
| 1344 | struct wm8350_data *priv = data; | 1344 | struct wm8350_data *priv = data; |
| 1345 | struct wm8350 *wm8350 = priv->codec.control_data; | 1345 | struct wm8350 *wm8350 = priv->wm8350; |
| 1346 | struct wm8350_jack_data *jack = NULL; | 1346 | struct wm8350_jack_data *jack = NULL; |
| 1347 | 1347 | ||
| 1348 | switch (irq - wm8350->irq_base) { | 1348 | switch (irq - wm8350->irq_base) { |
| @@ -1427,7 +1427,7 @@ EXPORT_SYMBOL_GPL(wm8350_hp_jack_detect); | |||
| 1427 | static irqreturn_t wm8350_mic_handler(int irq, void *data) | 1427 | static irqreturn_t wm8350_mic_handler(int irq, void *data) |
| 1428 | { | 1428 | { |
| 1429 | struct wm8350_data *priv = data; | 1429 | struct wm8350_data *priv = data; |
| 1430 | struct wm8350 *wm8350 = priv->codec.control_data; | 1430 | struct wm8350 *wm8350 = priv->wm8350; |
| 1431 | u16 reg; | 1431 | u16 reg; |
| 1432 | int report = 0; | 1432 | int report = 0; |
| 1433 | 1433 | ||
| @@ -1536,6 +1536,8 @@ static int wm8350_codec_probe(struct snd_soc_codec *codec) | |||
| 1536 | return -ENOMEM; | 1536 | return -ENOMEM; |
| 1537 | snd_soc_codec_set_drvdata(codec, priv); | 1537 | snd_soc_codec_set_drvdata(codec, priv); |
| 1538 | 1538 | ||
| 1539 | priv->wm8350 = wm8350; | ||
| 1540 | |||
| 1539 | for (i = 0; i < ARRAY_SIZE(supply_names); i++) | 1541 | for (i = 0; i < ARRAY_SIZE(supply_names); i++) |
| 1540 | priv->supplies[i].supply = supply_names[i]; | 1542 | priv->supplies[i].supply = supply_names[i]; |
| 1541 | 1543 | ||
| @@ -1544,7 +1546,6 @@ static int wm8350_codec_probe(struct snd_soc_codec *codec) | |||
| 1544 | if (ret != 0) | 1546 | if (ret != 0) |
| 1545 | return ret; | 1547 | return ret; |
| 1546 | 1548 | ||
| 1547 | wm8350->codec.codec = codec; | ||
| 1548 | codec->control_data = wm8350; | 1549 | codec->control_data = wm8350; |
| 1549 | 1550 | ||
| 1550 | /* Put the codec into reset if it wasn't already */ | 1551 | /* Put the codec into reset if it wasn't already */ |
diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c index 7c49642af052..6c1fe3afd4b5 100644 --- a/sound/soc/codecs/wm8994.c +++ b/sound/soc/codecs/wm8994.c | |||
| @@ -1000,61 +1000,170 @@ static void wm8994_update_class_w(struct snd_soc_codec *codec) | |||
| 1000 | } | 1000 | } |
| 1001 | } | 1001 | } |
| 1002 | 1002 | ||
| 1003 | static int late_enable_ev(struct snd_soc_dapm_widget *w, | 1003 | static int aif1clk_ev(struct snd_soc_dapm_widget *w, |
| 1004 | struct snd_kcontrol *kcontrol, int event) | 1004 | struct snd_kcontrol *kcontrol, int event) |
| 1005 | { | 1005 | { |
| 1006 | struct snd_soc_codec *codec = w->codec; | 1006 | struct snd_soc_codec *codec = w->codec; |
| 1007 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); | 1007 | struct wm8994 *control = codec->control_data; |
| 1008 | int mask = WM8994_AIF1DAC1L_ENA | WM8994_AIF1DAC1R_ENA; | ||
| 1009 | int dac; | ||
| 1010 | int adc; | ||
| 1011 | int val; | ||
| 1012 | |||
| 1013 | switch (control->type) { | ||
| 1014 | case WM8994: | ||
| 1015 | case WM8958: | ||
| 1016 | mask |= WM8994_AIF1DAC2L_ENA | WM8994_AIF1DAC2R_ENA; | ||
| 1017 | break; | ||
| 1018 | default: | ||
| 1019 | break; | ||
| 1020 | } | ||
| 1008 | 1021 | ||
| 1009 | switch (event) { | 1022 | switch (event) { |
| 1010 | case SND_SOC_DAPM_PRE_PMU: | 1023 | case SND_SOC_DAPM_PRE_PMU: |
| 1011 | if (wm8994->aif1clk_enable) { | 1024 | val = snd_soc_read(codec, WM8994_AIF1_CONTROL_1); |
| 1012 | snd_soc_update_bits(codec, WM8994_AIF1_CLOCKING_1, | 1025 | if ((val & WM8994_AIF1ADCL_SRC) && |
| 1013 | WM8994_AIF1CLK_ENA_MASK, | 1026 | (val & WM8994_AIF1ADCR_SRC)) |
| 1014 | WM8994_AIF1CLK_ENA); | 1027 | adc = WM8994_AIF1ADC1R_ENA | WM8994_AIF1ADC2R_ENA; |
| 1015 | wm8994->aif1clk_enable = 0; | 1028 | else if (!(val & WM8994_AIF1ADCL_SRC) && |
| 1016 | } | 1029 | !(val & WM8994_AIF1ADCR_SRC)) |
| 1017 | if (wm8994->aif2clk_enable) { | 1030 | adc = WM8994_AIF1ADC1L_ENA | WM8994_AIF1ADC2L_ENA; |
| 1018 | snd_soc_update_bits(codec, WM8994_AIF2_CLOCKING_1, | 1031 | else |
| 1019 | WM8994_AIF2CLK_ENA_MASK, | 1032 | adc = WM8994_AIF1ADC1R_ENA | WM8994_AIF1ADC2R_ENA | |
| 1020 | WM8994_AIF2CLK_ENA); | 1033 | WM8994_AIF1ADC1L_ENA | WM8994_AIF1ADC2L_ENA; |
| 1021 | wm8994->aif2clk_enable = 0; | 1034 | |
| 1022 | } | 1035 | val = snd_soc_read(codec, WM8994_AIF1_CONTROL_2); |
| 1036 | if ((val & WM8994_AIF1DACL_SRC) && | ||
| 1037 | (val & WM8994_AIF1DACR_SRC)) | ||
| 1038 | dac = WM8994_AIF1DAC1R_ENA | WM8994_AIF1DAC2R_ENA; | ||
| 1039 | else if (!(val & WM8994_AIF1DACL_SRC) && | ||
| 1040 | !(val & WM8994_AIF1DACR_SRC)) | ||
| 1041 | dac = WM8994_AIF1DAC1L_ENA | WM8994_AIF1DAC2L_ENA; | ||
| 1042 | else | ||
| 1043 | dac = WM8994_AIF1DAC1R_ENA | WM8994_AIF1DAC2R_ENA | | ||
| 1044 | WM8994_AIF1DAC1L_ENA | WM8994_AIF1DAC2L_ENA; | ||
| 1045 | |||
| 1046 | snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_4, | ||
| 1047 | mask, adc); | ||
| 1048 | snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_5, | ||
| 1049 | mask, dac); | ||
| 1050 | snd_soc_update_bits(codec, WM8994_CLOCKING_1, | ||
| 1051 | WM8994_AIF1DSPCLK_ENA | | ||
| 1052 | WM8994_SYSDSPCLK_ENA, | ||
| 1053 | WM8994_AIF1DSPCLK_ENA | | ||
| 1054 | WM8994_SYSDSPCLK_ENA); | ||
| 1055 | snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_4, mask, | ||
| 1056 | WM8994_AIF1ADC1R_ENA | | ||
| 1057 | WM8994_AIF1ADC1L_ENA | | ||
| 1058 | WM8994_AIF1ADC2R_ENA | | ||
| 1059 | WM8994_AIF1ADC2L_ENA); | ||
| 1060 | snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_5, mask, | ||
| 1061 | WM8994_AIF1DAC1R_ENA | | ||
| 1062 | WM8994_AIF1DAC1L_ENA | | ||
| 1063 | WM8994_AIF1DAC2R_ENA | | ||
| 1064 | WM8994_AIF1DAC2L_ENA); | ||
| 1023 | break; | 1065 | break; |
| 1024 | } | ||
| 1025 | 1066 | ||
| 1026 | /* We may also have postponed startup of DSP, handle that. */ | 1067 | case SND_SOC_DAPM_PRE_PMD: |
| 1027 | wm8958_aif_ev(w, kcontrol, event); | 1068 | case SND_SOC_DAPM_POST_PMD: |
| 1069 | snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_5, | ||
| 1070 | mask, 0); | ||
| 1071 | snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_4, | ||
| 1072 | mask, 0); | ||
| 1073 | |||
| 1074 | val = snd_soc_read(codec, WM8994_CLOCKING_1); | ||
| 1075 | if (val & WM8994_AIF2DSPCLK_ENA) | ||
| 1076 | val = WM8994_SYSDSPCLK_ENA; | ||
| 1077 | else | ||
| 1078 | val = 0; | ||
| 1079 | snd_soc_update_bits(codec, WM8994_CLOCKING_1, | ||
| 1080 | WM8994_SYSDSPCLK_ENA | | ||
| 1081 | WM8994_AIF1DSPCLK_ENA, val); | ||
| 1082 | break; | ||
| 1083 | } | ||
| 1028 | 1084 | ||
| 1029 | return 0; | 1085 | return 0; |
| 1030 | } | 1086 | } |
| 1031 | 1087 | ||
| 1032 | static int late_disable_ev(struct snd_soc_dapm_widget *w, | 1088 | static int aif2clk_ev(struct snd_soc_dapm_widget *w, |
| 1033 | struct snd_kcontrol *kcontrol, int event) | 1089 | struct snd_kcontrol *kcontrol, int event) |
| 1034 | { | 1090 | { |
| 1035 | struct snd_soc_codec *codec = w->codec; | 1091 | struct snd_soc_codec *codec = w->codec; |
| 1036 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); | 1092 | int dac; |
| 1093 | int adc; | ||
| 1094 | int val; | ||
| 1037 | 1095 | ||
| 1038 | switch (event) { | 1096 | switch (event) { |
| 1097 | case SND_SOC_DAPM_PRE_PMU: | ||
| 1098 | val = snd_soc_read(codec, WM8994_AIF2_CONTROL_1); | ||
| 1099 | if ((val & WM8994_AIF2ADCL_SRC) && | ||
| 1100 | (val & WM8994_AIF2ADCR_SRC)) | ||
| 1101 | adc = WM8994_AIF2ADCR_ENA; | ||
| 1102 | else if (!(val & WM8994_AIF2ADCL_SRC) && | ||
| 1103 | !(val & WM8994_AIF2ADCR_SRC)) | ||
| 1104 | adc = WM8994_AIF2ADCL_ENA; | ||
| 1105 | else | ||
| 1106 | adc = WM8994_AIF2ADCL_ENA | WM8994_AIF2ADCR_ENA; | ||
| 1107 | |||
| 1108 | |||
| 1109 | val = snd_soc_read(codec, WM8994_AIF2_CONTROL_2); | ||
| 1110 | if ((val & WM8994_AIF2DACL_SRC) && | ||
| 1111 | (val & WM8994_AIF2DACR_SRC)) | ||
| 1112 | dac = WM8994_AIF2DACR_ENA; | ||
| 1113 | else if (!(val & WM8994_AIF2DACL_SRC) && | ||
| 1114 | !(val & WM8994_AIF2DACR_SRC)) | ||
| 1115 | dac = WM8994_AIF2DACL_ENA; | ||
| 1116 | else | ||
| 1117 | dac = WM8994_AIF2DACL_ENA | WM8994_AIF2DACR_ENA; | ||
| 1118 | |||
| 1119 | snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_4, | ||
| 1120 | WM8994_AIF2ADCL_ENA | | ||
| 1121 | WM8994_AIF2ADCR_ENA, adc); | ||
| 1122 | snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_5, | ||
| 1123 | WM8994_AIF2DACL_ENA | | ||
| 1124 | WM8994_AIF2DACR_ENA, dac); | ||
| 1125 | snd_soc_update_bits(codec, WM8994_CLOCKING_1, | ||
| 1126 | WM8994_AIF2DSPCLK_ENA | | ||
| 1127 | WM8994_SYSDSPCLK_ENA, | ||
| 1128 | WM8994_AIF2DSPCLK_ENA | | ||
| 1129 | WM8994_SYSDSPCLK_ENA); | ||
| 1130 | snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_4, | ||
| 1131 | WM8994_AIF2ADCL_ENA | | ||
| 1132 | WM8994_AIF2ADCR_ENA, | ||
| 1133 | WM8994_AIF2ADCL_ENA | | ||
| 1134 | WM8994_AIF2ADCR_ENA); | ||
| 1135 | snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_5, | ||
| 1136 | WM8994_AIF2DACL_ENA | | ||
| 1137 | WM8994_AIF2DACR_ENA, | ||
| 1138 | WM8994_AIF2DACL_ENA | | ||
| 1139 | WM8994_AIF2DACR_ENA); | ||
| 1140 | break; | ||
| 1141 | |||
| 1142 | case SND_SOC_DAPM_PRE_PMD: | ||
| 1039 | case SND_SOC_DAPM_POST_PMD: | 1143 | case SND_SOC_DAPM_POST_PMD: |
| 1040 | if (wm8994->aif1clk_disable) { | 1144 | snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_5, |
| 1041 | snd_soc_update_bits(codec, WM8994_AIF1_CLOCKING_1, | 1145 | WM8994_AIF2DACL_ENA | |
| 1042 | WM8994_AIF1CLK_ENA_MASK, 0); | 1146 | WM8994_AIF2DACR_ENA, 0); |
| 1043 | wm8994->aif1clk_disable = 0; | 1147 | snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_5, |
| 1044 | } | 1148 | WM8994_AIF2ADCL_ENA | |
| 1045 | if (wm8994->aif2clk_disable) { | 1149 | WM8994_AIF2ADCR_ENA, 0); |
| 1046 | snd_soc_update_bits(codec, WM8994_AIF2_CLOCKING_1, | 1150 | |
| 1047 | WM8994_AIF2CLK_ENA_MASK, 0); | 1151 | val = snd_soc_read(codec, WM8994_CLOCKING_1); |
| 1048 | wm8994->aif2clk_disable = 0; | 1152 | if (val & WM8994_AIF1DSPCLK_ENA) |
| 1049 | } | 1153 | val = WM8994_SYSDSPCLK_ENA; |
| 1154 | else | ||
| 1155 | val = 0; | ||
| 1156 | snd_soc_update_bits(codec, WM8994_CLOCKING_1, | ||
| 1157 | WM8994_SYSDSPCLK_ENA | | ||
| 1158 | WM8994_AIF2DSPCLK_ENA, val); | ||
| 1050 | break; | 1159 | break; |
| 1051 | } | 1160 | } |
| 1052 | 1161 | ||
| 1053 | return 0; | 1162 | return 0; |
| 1054 | } | 1163 | } |
| 1055 | 1164 | ||
| 1056 | static int aif1clk_ev(struct snd_soc_dapm_widget *w, | 1165 | static int aif1clk_late_ev(struct snd_soc_dapm_widget *w, |
| 1057 | struct snd_kcontrol *kcontrol, int event) | 1166 | struct snd_kcontrol *kcontrol, int event) |
| 1058 | { | 1167 | { |
| 1059 | struct snd_soc_codec *codec = w->codec; | 1168 | struct snd_soc_codec *codec = w->codec; |
| 1060 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); | 1169 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); |
| @@ -1071,8 +1180,8 @@ static int aif1clk_ev(struct snd_soc_dapm_widget *w, | |||
| 1071 | return 0; | 1180 | return 0; |
| 1072 | } | 1181 | } |
| 1073 | 1182 | ||
| 1074 | static int aif2clk_ev(struct snd_soc_dapm_widget *w, | 1183 | static int aif2clk_late_ev(struct snd_soc_dapm_widget *w, |
| 1075 | struct snd_kcontrol *kcontrol, int event) | 1184 | struct snd_kcontrol *kcontrol, int event) |
| 1076 | { | 1185 | { |
| 1077 | struct snd_soc_codec *codec = w->codec; | 1186 | struct snd_soc_codec *codec = w->codec; |
| 1078 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); | 1187 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); |
| @@ -1089,6 +1198,63 @@ static int aif2clk_ev(struct snd_soc_dapm_widget *w, | |||
| 1089 | return 0; | 1198 | return 0; |
| 1090 | } | 1199 | } |
| 1091 | 1200 | ||
| 1201 | static int late_enable_ev(struct snd_soc_dapm_widget *w, | ||
| 1202 | struct snd_kcontrol *kcontrol, int event) | ||
| 1203 | { | ||
| 1204 | struct snd_soc_codec *codec = w->codec; | ||
| 1205 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); | ||
| 1206 | |||
| 1207 | switch (event) { | ||
| 1208 | case SND_SOC_DAPM_PRE_PMU: | ||
| 1209 | if (wm8994->aif1clk_enable) { | ||
| 1210 | aif1clk_ev(w, kcontrol, event); | ||
| 1211 | snd_soc_update_bits(codec, WM8994_AIF1_CLOCKING_1, | ||
| 1212 | WM8994_AIF1CLK_ENA_MASK, | ||
| 1213 | WM8994_AIF1CLK_ENA); | ||
| 1214 | wm8994->aif1clk_enable = 0; | ||
| 1215 | } | ||
| 1216 | if (wm8994->aif2clk_enable) { | ||
| 1217 | aif2clk_ev(w, kcontrol, event); | ||
| 1218 | snd_soc_update_bits(codec, WM8994_AIF2_CLOCKING_1, | ||
| 1219 | WM8994_AIF2CLK_ENA_MASK, | ||
| 1220 | WM8994_AIF2CLK_ENA); | ||
| 1221 | wm8994->aif2clk_enable = 0; | ||
| 1222 | } | ||
| 1223 | break; | ||
| 1224 | } | ||
| 1225 | |||
| 1226 | /* We may also have postponed startup of DSP, handle that. */ | ||
| 1227 | wm8958_aif_ev(w, kcontrol, event); | ||
| 1228 | |||
| 1229 | return 0; | ||
| 1230 | } | ||
| 1231 | |||
| 1232 | static int late_disable_ev(struct snd_soc_dapm_widget *w, | ||
| 1233 | struct snd_kcontrol *kcontrol, int event) | ||
| 1234 | { | ||
| 1235 | struct snd_soc_codec *codec = w->codec; | ||
| 1236 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); | ||
| 1237 | |||
| 1238 | switch (event) { | ||
| 1239 | case SND_SOC_DAPM_POST_PMD: | ||
| 1240 | if (wm8994->aif1clk_disable) { | ||
| 1241 | snd_soc_update_bits(codec, WM8994_AIF1_CLOCKING_1, | ||
| 1242 | WM8994_AIF1CLK_ENA_MASK, 0); | ||
| 1243 | aif1clk_ev(w, kcontrol, event); | ||
| 1244 | wm8994->aif1clk_disable = 0; | ||
| 1245 | } | ||
| 1246 | if (wm8994->aif2clk_disable) { | ||
| 1247 | snd_soc_update_bits(codec, WM8994_AIF2_CLOCKING_1, | ||
| 1248 | WM8994_AIF2CLK_ENA_MASK, 0); | ||
| 1249 | aif2clk_ev(w, kcontrol, event); | ||
| 1250 | wm8994->aif2clk_disable = 0; | ||
| 1251 | } | ||
| 1252 | break; | ||
| 1253 | } | ||
| 1254 | |||
| 1255 | return 0; | ||
| 1256 | } | ||
| 1257 | |||
| 1092 | static int adc_mux_ev(struct snd_soc_dapm_widget *w, | 1258 | static int adc_mux_ev(struct snd_soc_dapm_widget *w, |
| 1093 | struct snd_kcontrol *kcontrol, int event) | 1259 | struct snd_kcontrol *kcontrol, int event) |
| 1094 | { | 1260 | { |
| @@ -1385,9 +1551,9 @@ static const struct snd_kcontrol_new aif2dacr_src_mux = | |||
| 1385 | SOC_DAPM_ENUM("AIF2DACR Mux", aif2dacr_src_enum); | 1551 | SOC_DAPM_ENUM("AIF2DACR Mux", aif2dacr_src_enum); |
| 1386 | 1552 | ||
| 1387 | static const struct snd_soc_dapm_widget wm8994_lateclk_revd_widgets[] = { | 1553 | static const struct snd_soc_dapm_widget wm8994_lateclk_revd_widgets[] = { |
| 1388 | SND_SOC_DAPM_SUPPLY("AIF1CLK", SND_SOC_NOPM, 0, 0, aif1clk_ev, | 1554 | SND_SOC_DAPM_SUPPLY("AIF1CLK", SND_SOC_NOPM, 0, 0, aif1clk_late_ev, |
| 1389 | SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD), | 1555 | SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD), |
| 1390 | SND_SOC_DAPM_SUPPLY("AIF2CLK", SND_SOC_NOPM, 0, 0, aif2clk_ev, | 1556 | SND_SOC_DAPM_SUPPLY("AIF2CLK", SND_SOC_NOPM, 0, 0, aif2clk_late_ev, |
| 1391 | SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD), | 1557 | SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD), |
| 1392 | 1558 | ||
| 1393 | SND_SOC_DAPM_PGA_E("Late DAC1L Enable PGA", SND_SOC_NOPM, 0, 0, NULL, 0, | 1559 | SND_SOC_DAPM_PGA_E("Late DAC1L Enable PGA", SND_SOC_NOPM, 0, 0, NULL, 0, |
| @@ -1416,8 +1582,10 @@ SND_SOC_DAPM_POST("Late Disable PGA", late_disable_ev) | |||
| 1416 | }; | 1582 | }; |
| 1417 | 1583 | ||
| 1418 | static const struct snd_soc_dapm_widget wm8994_lateclk_widgets[] = { | 1584 | static const struct snd_soc_dapm_widget wm8994_lateclk_widgets[] = { |
| 1419 | SND_SOC_DAPM_SUPPLY("AIF1CLK", WM8994_AIF1_CLOCKING_1, 0, 0, NULL, 0), | 1585 | SND_SOC_DAPM_SUPPLY("AIF1CLK", WM8994_AIF1_CLOCKING_1, 0, 0, aif1clk_ev, |
| 1420 | SND_SOC_DAPM_SUPPLY("AIF2CLK", WM8994_AIF2_CLOCKING_1, 0, 0, NULL, 0), | 1586 | SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_PRE_PMD), |
| 1587 | SND_SOC_DAPM_SUPPLY("AIF2CLK", WM8994_AIF2_CLOCKING_1, 0, 0, aif2clk_ev, | ||
| 1588 | SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_PRE_PMD), | ||
| 1421 | SND_SOC_DAPM_PGA("Direct Voice", SND_SOC_NOPM, 0, 0, NULL, 0), | 1589 | SND_SOC_DAPM_PGA("Direct Voice", SND_SOC_NOPM, 0, 0, NULL, 0), |
| 1422 | SND_SOC_DAPM_MIXER("SPKL", WM8994_POWER_MANAGEMENT_3, 8, 0, | 1590 | SND_SOC_DAPM_MIXER("SPKL", WM8994_POWER_MANAGEMENT_3, 8, 0, |
| 1423 | left_speaker_mixer, ARRAY_SIZE(left_speaker_mixer)), | 1591 | left_speaker_mixer, ARRAY_SIZE(left_speaker_mixer)), |
| @@ -1470,30 +1638,30 @@ SND_SOC_DAPM_SUPPLY("VMID", SND_SOC_NOPM, 0, 0, vmid_event, | |||
| 1470 | SND_SOC_DAPM_SUPPLY("CLK_SYS", SND_SOC_NOPM, 0, 0, clk_sys_event, | 1638 | SND_SOC_DAPM_SUPPLY("CLK_SYS", SND_SOC_NOPM, 0, 0, clk_sys_event, |
| 1471 | SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD), | 1639 | SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD), |
| 1472 | 1640 | ||
| 1473 | SND_SOC_DAPM_SUPPLY("DSP1CLK", WM8994_CLOCKING_1, 3, 0, NULL, 0), | 1641 | SND_SOC_DAPM_SUPPLY("DSP1CLK", SND_SOC_NOPM, 3, 0, NULL, 0), |
| 1474 | SND_SOC_DAPM_SUPPLY("DSP2CLK", WM8994_CLOCKING_1, 2, 0, NULL, 0), | 1642 | SND_SOC_DAPM_SUPPLY("DSP2CLK", SND_SOC_NOPM, 2, 0, NULL, 0), |
| 1475 | SND_SOC_DAPM_SUPPLY("DSPINTCLK", WM8994_CLOCKING_1, 1, 0, NULL, 0), | 1643 | SND_SOC_DAPM_SUPPLY("DSPINTCLK", SND_SOC_NOPM, 1, 0, NULL, 0), |
| 1476 | 1644 | ||
| 1477 | SND_SOC_DAPM_AIF_OUT("AIF1ADC1L", NULL, | 1645 | SND_SOC_DAPM_AIF_OUT("AIF1ADC1L", NULL, |
| 1478 | 0, WM8994_POWER_MANAGEMENT_4, 9, 0), | 1646 | 0, SND_SOC_NOPM, 9, 0), |
| 1479 | SND_SOC_DAPM_AIF_OUT("AIF1ADC1R", NULL, | 1647 | SND_SOC_DAPM_AIF_OUT("AIF1ADC1R", NULL, |
| 1480 | 0, WM8994_POWER_MANAGEMENT_4, 8, 0), | 1648 | 0, SND_SOC_NOPM, 8, 0), |
| 1481 | SND_SOC_DAPM_AIF_IN_E("AIF1DAC1L", NULL, 0, | 1649 | SND_SOC_DAPM_AIF_IN_E("AIF1DAC1L", NULL, 0, |
| 1482 | WM8994_POWER_MANAGEMENT_5, 9, 0, wm8958_aif_ev, | 1650 | SND_SOC_NOPM, 9, 0, wm8958_aif_ev, |
| 1483 | SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD), | 1651 | SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD), |
| 1484 | SND_SOC_DAPM_AIF_IN_E("AIF1DAC1R", NULL, 0, | 1652 | SND_SOC_DAPM_AIF_IN_E("AIF1DAC1R", NULL, 0, |
| 1485 | WM8994_POWER_MANAGEMENT_5, 8, 0, wm8958_aif_ev, | 1653 | SND_SOC_NOPM, 8, 0, wm8958_aif_ev, |
| 1486 | SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD), | 1654 | SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD), |
| 1487 | 1655 | ||
| 1488 | SND_SOC_DAPM_AIF_OUT("AIF1ADC2L", NULL, | 1656 | SND_SOC_DAPM_AIF_OUT("AIF1ADC2L", NULL, |
| 1489 | 0, WM8994_POWER_MANAGEMENT_4, 11, 0), | 1657 | 0, SND_SOC_NOPM, 11, 0), |
| 1490 | SND_SOC_DAPM_AIF_OUT("AIF1ADC2R", NULL, | 1658 | SND_SOC_DAPM_AIF_OUT("AIF1ADC2R", NULL, |
| 1491 | 0, WM8994_POWER_MANAGEMENT_4, 10, 0), | 1659 | 0, SND_SOC_NOPM, 10, 0), |
| 1492 | SND_SOC_DAPM_AIF_IN_E("AIF1DAC2L", NULL, 0, | 1660 | SND_SOC_DAPM_AIF_IN_E("AIF1DAC2L", NULL, 0, |
| 1493 | WM8994_POWER_MANAGEMENT_5, 11, 0, wm8958_aif_ev, | 1661 | SND_SOC_NOPM, 11, 0, wm8958_aif_ev, |
| 1494 | SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD), | 1662 | SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD), |
| 1495 | SND_SOC_DAPM_AIF_IN_E("AIF1DAC2R", NULL, 0, | 1663 | SND_SOC_DAPM_AIF_IN_E("AIF1DAC2R", NULL, 0, |
| 1496 | WM8994_POWER_MANAGEMENT_5, 10, 0, wm8958_aif_ev, | 1664 | SND_SOC_NOPM, 10, 0, wm8958_aif_ev, |
| 1497 | SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD), | 1665 | SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD), |
| 1498 | 1666 | ||
| 1499 | SND_SOC_DAPM_MIXER("AIF1ADC1L Mixer", SND_SOC_NOPM, 0, 0, | 1667 | SND_SOC_DAPM_MIXER("AIF1ADC1L Mixer", SND_SOC_NOPM, 0, 0, |
| @@ -1520,14 +1688,14 @@ SND_SOC_DAPM_MIXER("DAC1R Mixer", SND_SOC_NOPM, 0, 0, | |||
| 1520 | dac1r_mix, ARRAY_SIZE(dac1r_mix)), | 1688 | dac1r_mix, ARRAY_SIZE(dac1r_mix)), |
| 1521 | 1689 | ||
| 1522 | SND_SOC_DAPM_AIF_OUT("AIF2ADCL", NULL, 0, | 1690 | SND_SOC_DAPM_AIF_OUT("AIF2ADCL", NULL, 0, |
| 1523 | WM8994_POWER_MANAGEMENT_4, 13, 0), | 1691 | SND_SOC_NOPM, 13, 0), |
| 1524 | SND_SOC_DAPM_AIF_OUT("AIF2ADCR", NULL, 0, | 1692 | SND_SOC_DAPM_AIF_OUT("AIF2ADCR", NULL, 0, |
| 1525 | WM8994_POWER_MANAGEMENT_4, 12, 0), | 1693 | SND_SOC_NOPM, 12, 0), |
| 1526 | SND_SOC_DAPM_AIF_IN_E("AIF2DACL", NULL, 0, | 1694 | SND_SOC_DAPM_AIF_IN_E("AIF2DACL", NULL, 0, |
| 1527 | WM8994_POWER_MANAGEMENT_5, 13, 0, wm8958_aif_ev, | 1695 | SND_SOC_NOPM, 13, 0, wm8958_aif_ev, |
| 1528 | SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD), | 1696 | SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD), |
| 1529 | SND_SOC_DAPM_AIF_IN_E("AIF2DACR", NULL, 0, | 1697 | SND_SOC_DAPM_AIF_IN_E("AIF2DACR", NULL, 0, |
| 1530 | WM8994_POWER_MANAGEMENT_5, 12, 0, wm8958_aif_ev, | 1698 | SND_SOC_NOPM, 12, 0, wm8958_aif_ev, |
| 1531 | SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD), | 1699 | SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD), |
| 1532 | 1700 | ||
| 1533 | SND_SOC_DAPM_AIF_IN("AIF1DACDAT", NULL, 0, SND_SOC_NOPM, 0, 0), | 1701 | SND_SOC_DAPM_AIF_IN("AIF1DACDAT", NULL, 0, SND_SOC_NOPM, 0, 0), |
diff --git a/sound/soc/codecs/wm_hubs.c b/sound/soc/codecs/wm_hubs.c index f13f2886339c..6c028c470601 100644 --- a/sound/soc/codecs/wm_hubs.c +++ b/sound/soc/codecs/wm_hubs.c | |||
| @@ -1035,7 +1035,7 @@ void wm_hubs_set_bias_level(struct snd_soc_codec *codec, | |||
| 1035 | enum snd_soc_bias_level level) | 1035 | enum snd_soc_bias_level level) |
| 1036 | { | 1036 | { |
| 1037 | struct wm_hubs_data *hubs = snd_soc_codec_get_drvdata(codec); | 1037 | struct wm_hubs_data *hubs = snd_soc_codec_get_drvdata(codec); |
| 1038 | int val; | 1038 | int mask, val; |
| 1039 | 1039 | ||
| 1040 | switch (level) { | 1040 | switch (level) { |
| 1041 | case SND_SOC_BIAS_STANDBY: | 1041 | case SND_SOC_BIAS_STANDBY: |
| @@ -1047,6 +1047,13 @@ void wm_hubs_set_bias_level(struct snd_soc_codec *codec, | |||
| 1047 | case SND_SOC_BIAS_ON: | 1047 | case SND_SOC_BIAS_ON: |
| 1048 | /* Turn off any unneded single ended outputs */ | 1048 | /* Turn off any unneded single ended outputs */ |
| 1049 | val = 0; | 1049 | val = 0; |
| 1050 | mask = 0; | ||
| 1051 | |||
| 1052 | if (hubs->lineout1_se) | ||
| 1053 | mask |= WM8993_LINEOUT1N_ENA | WM8993_LINEOUT1P_ENA; | ||
| 1054 | |||
| 1055 | if (hubs->lineout2_se) | ||
| 1056 | mask |= WM8993_LINEOUT2N_ENA | WM8993_LINEOUT2P_ENA; | ||
| 1050 | 1057 | ||
| 1051 | if (hubs->lineout1_se && hubs->lineout1n_ena) | 1058 | if (hubs->lineout1_se && hubs->lineout1n_ena) |
| 1052 | val |= WM8993_LINEOUT1N_ENA; | 1059 | val |= WM8993_LINEOUT1N_ENA; |
| @@ -1061,11 +1068,7 @@ void wm_hubs_set_bias_level(struct snd_soc_codec *codec, | |||
| 1061 | val |= WM8993_LINEOUT2P_ENA; | 1068 | val |= WM8993_LINEOUT2P_ENA; |
| 1062 | 1069 | ||
| 1063 | snd_soc_update_bits(codec, WM8993_POWER_MANAGEMENT_3, | 1070 | snd_soc_update_bits(codec, WM8993_POWER_MANAGEMENT_3, |
| 1064 | WM8993_LINEOUT1N_ENA | | 1071 | mask, val); |
| 1065 | WM8993_LINEOUT1P_ENA | | ||
| 1066 | WM8993_LINEOUT2N_ENA | | ||
| 1067 | WM8993_LINEOUT2P_ENA, | ||
| 1068 | val); | ||
| 1069 | 1072 | ||
| 1070 | /* Remove the input clamps */ | 1073 | /* Remove the input clamps */ |
| 1071 | snd_soc_update_bits(codec, WM8993_INPUTS_CLAMP_REG, | 1074 | snd_soc_update_bits(codec, WM8993_INPUTS_CLAMP_REG, |
diff --git a/sound/soc/omap/Kconfig b/sound/soc/omap/Kconfig index e00dd0b1139c..deafbfaacdbf 100644 --- a/sound/soc/omap/Kconfig +++ b/sound/soc/omap/Kconfig | |||
| @@ -97,7 +97,7 @@ config SND_OMAP_SOC_SDP3430 | |||
| 97 | 97 | ||
| 98 | config SND_OMAP_SOC_OMAP_ABE_TWL6040 | 98 | config SND_OMAP_SOC_OMAP_ABE_TWL6040 |
| 99 | tristate "SoC Audio support for OMAP boards using ABE and twl6040 codec" | 99 | tristate "SoC Audio support for OMAP boards using ABE and twl6040 codec" |
| 100 | depends on TWL4030_CORE && SND_OMAP_SOC && ARCH_OMAP4 | 100 | depends on TWL6040_CORE && SND_OMAP_SOC && ARCH_OMAP4 |
| 101 | select SND_OMAP_SOC_DMIC | 101 | select SND_OMAP_SOC_DMIC |
| 102 | select SND_OMAP_SOC_MCPDM | 102 | select SND_OMAP_SOC_MCPDM |
| 103 | select SND_SOC_TWL6040 | 103 | select SND_SOC_TWL6040 |
diff --git a/sound/soc/omap/omap-pcm.c b/sound/soc/omap/omap-pcm.c index a59bd352d342..5a649da9122a 100644 --- a/sound/soc/omap/omap-pcm.c +++ b/sound/soc/omap/omap-pcm.c | |||
| @@ -401,6 +401,10 @@ static int omap_pcm_new(struct snd_soc_pcm_runtime *rtd) | |||
| 401 | } | 401 | } |
| 402 | 402 | ||
| 403 | out: | 403 | out: |
| 404 | /* free preallocated buffers in case of error */ | ||
| 405 | if (ret) | ||
| 406 | omap_pcm_free_dma_buffers(pcm); | ||
| 407 | |||
| 404 | return ret; | 408 | return ret; |
| 405 | } | 409 | } |
| 406 | 410 | ||
diff --git a/sound/soc/samsung/s3c2412-i2s.c b/sound/soc/samsung/s3c2412-i2s.c index 72185078ddf8..79fbeea99d46 100644 --- a/sound/soc/samsung/s3c2412-i2s.c +++ b/sound/soc/samsung/s3c2412-i2s.c | |||
| @@ -166,7 +166,7 @@ static struct snd_soc_dai_driver s3c2412_i2s_dai = { | |||
| 166 | 166 | ||
| 167 | static __devinit int s3c2412_iis_dev_probe(struct platform_device *pdev) | 167 | static __devinit int s3c2412_iis_dev_probe(struct platform_device *pdev) |
| 168 | { | 168 | { |
| 169 | return snd_soc_register_dai(&pdev->dev, &s3c2412_i2s_dai); | 169 | return s3c_i2sv2_register_dai(&pdev->dev, -1, &s3c2412_i2s_dai); |
| 170 | } | 170 | } |
| 171 | 171 | ||
| 172 | static __devexit int s3c2412_iis_dev_remove(struct platform_device *pdev) | 172 | static __devexit int s3c2412_iis_dev_remove(struct platform_device *pdev) |
diff --git a/sound/soc/sh/fsi.c b/sound/soc/sh/fsi.c index 378cc5b056d7..74ed2dffbffd 100644 --- a/sound/soc/sh/fsi.c +++ b/sound/soc/sh/fsi.c | |||
| @@ -1001,11 +1001,10 @@ static void fsi_dma_do_tasklet(unsigned long data) | |||
| 1001 | sg_dma_address(&sg) = buf; | 1001 | sg_dma_address(&sg) = buf; |
| 1002 | sg_dma_len(&sg) = len; | 1002 | sg_dma_len(&sg) = len; |
| 1003 | 1003 | ||
| 1004 | desc = chan->device->device_prep_slave_sg(chan, &sg, 1, dir, | 1004 | desc = dmaengine_prep_slave_sg(chan, &sg, 1, dir, |
| 1005 | DMA_PREP_INTERRUPT | | 1005 | DMA_PREP_INTERRUPT | DMA_CTRL_ACK); |
| 1006 | DMA_CTRL_ACK); | ||
| 1007 | if (!desc) { | 1006 | if (!desc) { |
| 1008 | dev_err(dai->dev, "device_prep_slave_sg() fail\n"); | 1007 | dev_err(dai->dev, "dmaengine_prep_slave_sg() fail\n"); |
| 1009 | return; | 1008 | return; |
| 1010 | } | 1009 | } |
| 1011 | 1010 | ||
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index accdcb7d4d9d..c88d9741b9e7 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c | |||
| @@ -3113,6 +3113,7 @@ int snd_soc_register_card(struct snd_soc_card *card) | |||
| 3113 | GFP_KERNEL); | 3113 | GFP_KERNEL); |
| 3114 | if (card->rtd == NULL) | 3114 | if (card->rtd == NULL) |
| 3115 | return -ENOMEM; | 3115 | return -ENOMEM; |
| 3116 | card->num_rtd = 0; | ||
| 3116 | card->rtd_aux = &card->rtd[card->num_links]; | 3117 | card->rtd_aux = &card->rtd[card->num_links]; |
| 3117 | 3118 | ||
| 3118 | for (i = 0; i < card->num_links; i++) | 3119 | for (i = 0; i < card->num_links; i++) |
| @@ -3624,10 +3625,10 @@ int snd_soc_of_parse_audio_routing(struct snd_soc_card *card, | |||
| 3624 | int i, ret; | 3625 | int i, ret; |
| 3625 | 3626 | ||
| 3626 | num_routes = of_property_count_strings(np, propname); | 3627 | num_routes = of_property_count_strings(np, propname); |
| 3627 | if (num_routes & 1) { | 3628 | if (num_routes < 0 || num_routes & 1) { |
| 3628 | dev_err(card->dev, | 3629 | dev_err(card->dev, |
| 3629 | "Property '%s's length is not even\n", | 3630 | "Property '%s' does not exist or its length is not even\n", |
| 3630 | propname); | 3631 | propname); |
| 3631 | return -EINVAL; | 3632 | return -EINVAL; |
| 3632 | } | 3633 | } |
| 3633 | num_routes /= 2; | 3634 | num_routes /= 2; |
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index 5cbd2d7623b8..1bb6d4a63cd8 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c | |||
| @@ -67,6 +67,7 @@ static int dapm_up_seq[] = { | |||
| 67 | [snd_soc_dapm_out_drv] = 10, | 67 | [snd_soc_dapm_out_drv] = 10, |
| 68 | [snd_soc_dapm_hp] = 10, | 68 | [snd_soc_dapm_hp] = 10, |
| 69 | [snd_soc_dapm_spk] = 10, | 69 | [snd_soc_dapm_spk] = 10, |
| 70 | [snd_soc_dapm_line] = 10, | ||
| 70 | [snd_soc_dapm_post] = 11, | 71 | [snd_soc_dapm_post] = 11, |
| 71 | }; | 72 | }; |
| 72 | 73 | ||
| @@ -75,6 +76,7 @@ static int dapm_down_seq[] = { | |||
| 75 | [snd_soc_dapm_adc] = 1, | 76 | [snd_soc_dapm_adc] = 1, |
| 76 | [snd_soc_dapm_hp] = 2, | 77 | [snd_soc_dapm_hp] = 2, |
| 77 | [snd_soc_dapm_spk] = 2, | 78 | [snd_soc_dapm_spk] = 2, |
| 79 | [snd_soc_dapm_line] = 2, | ||
| 78 | [snd_soc_dapm_out_drv] = 2, | 80 | [snd_soc_dapm_out_drv] = 2, |
| 79 | [snd_soc_dapm_pga] = 4, | 81 | [snd_soc_dapm_pga] = 4, |
| 80 | [snd_soc_dapm_mixer_named_ctl] = 5, | 82 | [snd_soc_dapm_mixer_named_ctl] = 5, |
diff --git a/tools/perf/.gitignore b/tools/perf/.gitignore index 416684be0ad3..26b823b61aa1 100644 --- a/tools/perf/.gitignore +++ b/tools/perf/.gitignore | |||
| @@ -19,3 +19,5 @@ TAGS | |||
| 19 | cscope* | 19 | cscope* |
| 20 | config.mak | 20 | config.mak |
| 21 | config.mak.autogen | 21 | config.mak.autogen |
| 22 | *-bison.* | ||
| 23 | *-flex.* | ||
diff --git a/tools/perf/Makefile b/tools/perf/Makefile index 820371f10d1b..9bf3fc759344 100644 --- a/tools/perf/Makefile +++ b/tools/perf/Makefile | |||
| @@ -234,24 +234,23 @@ endif | |||
| 234 | 234 | ||
| 235 | export PERL_PATH | 235 | export PERL_PATH |
| 236 | 236 | ||
| 237 | FLEX = $(CROSS_COMPILE)flex | 237 | FLEX = flex |
| 238 | BISON= $(CROSS_COMPILE)bison | 238 | BISON= bison |
| 239 | 239 | ||
| 240 | event-parser: | 240 | $(OUTPUT)util/parse-events-flex.c: util/parse-events.l |
| 241 | $(QUIET_BISON)$(BISON) -v util/parse-events.y -d -o $(OUTPUT)util/parse-events-bison.c | ||
| 242 | $(QUIET_FLEX)$(FLEX) --header-file=$(OUTPUT)util/parse-events-flex.h -t util/parse-events.l > $(OUTPUT)util/parse-events-flex.c | 241 | $(QUIET_FLEX)$(FLEX) --header-file=$(OUTPUT)util/parse-events-flex.h -t util/parse-events.l > $(OUTPUT)util/parse-events-flex.c |
| 243 | 242 | ||
| 244 | $(OUTPUT)util/parse-events-flex.c: event-parser | 243 | $(OUTPUT)util/parse-events-bison.c: util/parse-events.y |
| 245 | $(OUTPUT)util/parse-events-bison.c: event-parser | 244 | $(QUIET_BISON)$(BISON) -v util/parse-events.y -d -o $(OUTPUT)util/parse-events-bison.c |
| 246 | 245 | ||
| 247 | pmu-parser: | 246 | $(OUTPUT)util/pmu-flex.c: util/pmu.l |
| 248 | $(QUIET_BISON)$(BISON) -v util/pmu.y -d -o $(OUTPUT)util/pmu-bison.c | ||
| 249 | $(QUIET_FLEX)$(FLEX) --header-file=$(OUTPUT)util/pmu-flex.h -t util/pmu.l > $(OUTPUT)util/pmu-flex.c | 247 | $(QUIET_FLEX)$(FLEX) --header-file=$(OUTPUT)util/pmu-flex.h -t util/pmu.l > $(OUTPUT)util/pmu-flex.c |
| 250 | 248 | ||
| 251 | $(OUTPUT)util/pmu-flex.c: pmu-parser | 249 | $(OUTPUT)util/pmu-bison.c: util/pmu.y |
| 252 | $(OUTPUT)util/pmu-bison.c: pmu-parser | 250 | $(QUIET_BISON)$(BISON) -v util/pmu.y -d -o $(OUTPUT)util/pmu-bison.c |
| 253 | 251 | ||
| 254 | $(OUTPUT)util/parse-events.o: event-parser pmu-parser | 252 | $(OUTPUT)util/parse-events.o: $(OUTPUT)util/parse-events-flex.c $(OUTPUT)util/parse-events-bison.c |
| 253 | $(OUTPUT)util/pmu.o: $(OUTPUT)util/pmu-flex.c $(OUTPUT)util/pmu-bison.c | ||
| 255 | 254 | ||
| 256 | LIB_FILE=$(OUTPUT)libperf.a | 255 | LIB_FILE=$(OUTPUT)libperf.a |
| 257 | 256 | ||
| @@ -527,7 +526,7 @@ else | |||
| 527 | endif | 526 | endif |
| 528 | 527 | ||
| 529 | ifdef NO_GTK2 | 528 | ifdef NO_GTK2 |
| 530 | BASIC_CFLAGS += -DNO_GTK2 | 529 | BASIC_CFLAGS += -DNO_GTK2_SUPPORT |
| 531 | else | 530 | else |
| 532 | FLAGS_GTK2=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) $(shell pkg-config --libs --cflags gtk+-2.0) | 531 | FLAGS_GTK2=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) $(shell pkg-config --libs --cflags gtk+-2.0) |
| 533 | ifneq ($(call try-cc,$(SOURCE_GTK2),$(FLAGS_GTK2)),y) | 532 | ifneq ($(call try-cc,$(SOURCE_GTK2),$(FLAGS_GTK2)),y) |
| @@ -852,8 +851,6 @@ help: | |||
| 852 | @echo ' html - make html documentation' | 851 | @echo ' html - make html documentation' |
| 853 | @echo ' info - make GNU info documentation (access with info <foo>)' | 852 | @echo ' info - make GNU info documentation (access with info <foo>)' |
| 854 | @echo ' pdf - make pdf documentation' | 853 | @echo ' pdf - make pdf documentation' |
| 855 | @echo ' event-parser - make event parser code' | ||
| 856 | @echo ' pmu-parser - make pmu format parser code' | ||
| 857 | @echo ' TAGS - use etags to make tag information for source browsing' | 854 | @echo ' TAGS - use etags to make tag information for source browsing' |
| 858 | @echo ' tags - use ctags to make tag information for source browsing' | 855 | @echo ' tags - use ctags to make tag information for source browsing' |
| 859 | @echo ' cscope - use cscope to make interactive browsing database' | 856 | @echo ' cscope - use cscope to make interactive browsing database' |
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c index 2e317438980b..cdae9b2db1cc 100644 --- a/tools/perf/builtin-report.c +++ b/tools/perf/builtin-report.c | |||
| @@ -374,16 +374,23 @@ static int __cmd_report(struct perf_report *rep) | |||
| 374 | (kernel_map->dso->hit && | 374 | (kernel_map->dso->hit && |
| 375 | (kernel_kmap->ref_reloc_sym == NULL || | 375 | (kernel_kmap->ref_reloc_sym == NULL || |
| 376 | kernel_kmap->ref_reloc_sym->addr == 0))) { | 376 | kernel_kmap->ref_reloc_sym->addr == 0))) { |
| 377 | const struct dso *kdso = kernel_map->dso; | 377 | const char *desc = |
| 378 | "As no suitable kallsyms nor vmlinux was found, kernel samples\n" | ||
| 379 | "can't be resolved."; | ||
| 380 | |||
| 381 | if (kernel_map) { | ||
| 382 | const struct dso *kdso = kernel_map->dso; | ||
| 383 | if (!RB_EMPTY_ROOT(&kdso->symbols[MAP__FUNCTION])) { | ||
| 384 | desc = "If some relocation was applied (e.g. " | ||
| 385 | "kexec) symbols may be misresolved."; | ||
| 386 | } | ||
| 387 | } | ||
| 378 | 388 | ||
| 379 | ui__warning( | 389 | ui__warning( |
| 380 | "Kernel address maps (/proc/{kallsyms,modules}) were restricted.\n\n" | 390 | "Kernel address maps (/proc/{kallsyms,modules}) were restricted.\n\n" |
| 381 | "Check /proc/sys/kernel/kptr_restrict before running 'perf record'.\n\n%s\n\n" | 391 | "Check /proc/sys/kernel/kptr_restrict before running 'perf record'.\n\n%s\n\n" |
| 382 | "Samples in kernel modules can't be resolved as well.\n\n", | 392 | "Samples in kernel modules can't be resolved as well.\n\n", |
| 383 | RB_EMPTY_ROOT(&kdso->symbols[MAP__FUNCTION]) ? | 393 | desc); |
| 384 | "As no suitable kallsyms nor vmlinux was found, kernel samples\n" | ||
| 385 | "can't be resolved." : | ||
| 386 | "If some relocation was applied (e.g. kexec) symbols may be misresolved."); | ||
| 387 | } | 394 | } |
| 388 | 395 | ||
| 389 | if (dump_trace) { | 396 | if (dump_trace) { |
diff --git a/tools/perf/builtin-test.c b/tools/perf/builtin-test.c index 1c5b9801ac61..223ffdcc0fd8 100644 --- a/tools/perf/builtin-test.c +++ b/tools/perf/builtin-test.c | |||
| @@ -851,6 +851,28 @@ static int test__checkevent_symbolic_name_modifier(struct perf_evlist *evlist) | |||
| 851 | return test__checkevent_symbolic_name(evlist); | 851 | return test__checkevent_symbolic_name(evlist); |
| 852 | } | 852 | } |
| 853 | 853 | ||
| 854 | static int test__checkevent_exclude_host_modifier(struct perf_evlist *evlist) | ||
| 855 | { | ||
| 856 | struct perf_evsel *evsel = list_entry(evlist->entries.next, | ||
| 857 | struct perf_evsel, node); | ||
| 858 | |||
| 859 | TEST_ASSERT_VAL("wrong exclude guest", !evsel->attr.exclude_guest); | ||
| 860 | TEST_ASSERT_VAL("wrong exclude host", evsel->attr.exclude_host); | ||
| 861 | |||
| 862 | return test__checkevent_symbolic_name(evlist); | ||
| 863 | } | ||
| 864 | |||
| 865 | static int test__checkevent_exclude_guest_modifier(struct perf_evlist *evlist) | ||
| 866 | { | ||
| 867 | struct perf_evsel *evsel = list_entry(evlist->entries.next, | ||
| 868 | struct perf_evsel, node); | ||
| 869 | |||
| 870 | TEST_ASSERT_VAL("wrong exclude guest", evsel->attr.exclude_guest); | ||
| 871 | TEST_ASSERT_VAL("wrong exclude host", !evsel->attr.exclude_host); | ||
| 872 | |||
| 873 | return test__checkevent_symbolic_name(evlist); | ||
| 874 | } | ||
| 875 | |||
| 854 | static int test__checkevent_symbolic_alias_modifier(struct perf_evlist *evlist) | 876 | static int test__checkevent_symbolic_alias_modifier(struct perf_evlist *evlist) |
| 855 | { | 877 | { |
| 856 | struct perf_evsel *evsel = list_entry(evlist->entries.next, | 878 | struct perf_evsel *evsel = list_entry(evlist->entries.next, |
| @@ -1091,6 +1113,14 @@ static struct test__event_st { | |||
| 1091 | .name = "r1,syscalls:sys_enter_open:k,1:1:hp", | 1113 | .name = "r1,syscalls:sys_enter_open:k,1:1:hp", |
| 1092 | .check = test__checkevent_list, | 1114 | .check = test__checkevent_list, |
| 1093 | }, | 1115 | }, |
| 1116 | { | ||
| 1117 | .name = "instructions:G", | ||
| 1118 | .check = test__checkevent_exclude_host_modifier, | ||
| 1119 | }, | ||
| 1120 | { | ||
| 1121 | .name = "instructions:H", | ||
| 1122 | .check = test__checkevent_exclude_guest_modifier, | ||
| 1123 | }, | ||
| 1094 | }; | 1124 | }; |
| 1095 | 1125 | ||
| 1096 | #define TEST__EVENTS_CNT (sizeof(test__events) / sizeof(struct test__event_st)) | 1126 | #define TEST__EVENTS_CNT (sizeof(test__events) / sizeof(struct test__event_st)) |
diff --git a/tools/perf/perf-archive.sh b/tools/perf/perf-archive.sh index 677e59d62a8d..95b6f8b6177a 100644 --- a/tools/perf/perf-archive.sh +++ b/tools/perf/perf-archive.sh | |||
| @@ -29,13 +29,14 @@ if [ ! -s $BUILDIDS ] ; then | |||
| 29 | fi | 29 | fi |
| 30 | 30 | ||
| 31 | MANIFEST=$(mktemp /tmp/perf-archive-manifest.XXXXXX) | 31 | MANIFEST=$(mktemp /tmp/perf-archive-manifest.XXXXXX) |
| 32 | PERF_BUILDID_LINKDIR=$(readlink -f $PERF_BUILDID_DIR)/ | ||
| 32 | 33 | ||
| 33 | cut -d ' ' -f 1 $BUILDIDS | \ | 34 | cut -d ' ' -f 1 $BUILDIDS | \ |
| 34 | while read build_id ; do | 35 | while read build_id ; do |
| 35 | linkname=$PERF_BUILDID_DIR.build-id/${build_id:0:2}/${build_id:2} | 36 | linkname=$PERF_BUILDID_DIR.build-id/${build_id:0:2}/${build_id:2} |
| 36 | filename=$(readlink -f $linkname) | 37 | filename=$(readlink -f $linkname) |
| 37 | echo ${linkname#$PERF_BUILDID_DIR} >> $MANIFEST | 38 | echo ${linkname#$PERF_BUILDID_DIR} >> $MANIFEST |
| 38 | echo ${filename#$PERF_BUILDID_DIR} >> $MANIFEST | 39 | echo ${filename#$PERF_BUILDID_LINKDIR} >> $MANIFEST |
| 39 | done | 40 | done |
| 40 | 41 | ||
| 41 | tar cfj $PERF_DATA.tar.bz2 -C $PERF_BUILDID_DIR -T $MANIFEST | 42 | tar cfj $PERF_DATA.tar.bz2 -C $PERF_BUILDID_DIR -T $MANIFEST |
diff --git a/tools/perf/util/parse-events.l b/tools/perf/util/parse-events.l index 05d766e3ecb5..1fcf1bbc5458 100644 --- a/tools/perf/util/parse-events.l +++ b/tools/perf/util/parse-events.l | |||
| @@ -54,7 +54,7 @@ num_dec [0-9]+ | |||
| 54 | num_hex 0x[a-fA-F0-9]+ | 54 | num_hex 0x[a-fA-F0-9]+ |
| 55 | num_raw_hex [a-fA-F0-9]+ | 55 | num_raw_hex [a-fA-F0-9]+ |
| 56 | name [a-zA-Z_*?][a-zA-Z0-9_*?]* | 56 | name [a-zA-Z_*?][a-zA-Z0-9_*?]* |
| 57 | modifier_event [ukhp]{1,5} | 57 | modifier_event [ukhpGH]{1,8} |
| 58 | modifier_bp [rwx] | 58 | modifier_bp [rwx] |
| 59 | 59 | ||
| 60 | %% | 60 | %% |
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c index 00923cda4d9c..1efd3bee6336 100644 --- a/tools/perf/util/session.c +++ b/tools/perf/util/session.c | |||
| @@ -876,11 +876,11 @@ static int perf_session_deliver_event(struct perf_session *session, | |||
| 876 | dump_sample(session, event, sample); | 876 | dump_sample(session, event, sample); |
| 877 | if (evsel == NULL) { | 877 | if (evsel == NULL) { |
| 878 | ++session->hists.stats.nr_unknown_id; | 878 | ++session->hists.stats.nr_unknown_id; |
| 879 | return -1; | 879 | return 0; |
| 880 | } | 880 | } |
| 881 | if (machine == NULL) { | 881 | if (machine == NULL) { |
| 882 | ++session->hists.stats.nr_unprocessable_samples; | 882 | ++session->hists.stats.nr_unprocessable_samples; |
| 883 | return -1; | 883 | return 0; |
| 884 | } | 884 | } |
| 885 | return tool->sample(tool, event, sample, evsel, machine); | 885 | return tool->sample(tool, event, sample, evsel, machine); |
| 886 | case PERF_RECORD_MMAP: | 886 | case PERF_RECORD_MMAP: |
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c index c0a028c3ebaf..ab9867b2b433 100644 --- a/tools/perf/util/symbol.c +++ b/tools/perf/util/symbol.c | |||
| @@ -977,8 +977,9 @@ static Elf_Scn *elf_section_by_name(Elf *elf, GElf_Ehdr *ep, | |||
| 977 | * And always look at the original dso, not at debuginfo packages, that | 977 | * And always look at the original dso, not at debuginfo packages, that |
| 978 | * have the PLT data stripped out (shdr_rel_plt.sh_type == SHT_NOBITS). | 978 | * have the PLT data stripped out (shdr_rel_plt.sh_type == SHT_NOBITS). |
| 979 | */ | 979 | */ |
| 980 | static int dso__synthesize_plt_symbols(struct dso *dso, struct map *map, | 980 | static int |
| 981 | symbol_filter_t filter) | 981 | dso__synthesize_plt_symbols(struct dso *dso, char *name, struct map *map, |
| 982 | symbol_filter_t filter) | ||
| 982 | { | 983 | { |
| 983 | uint32_t nr_rel_entries, idx; | 984 | uint32_t nr_rel_entries, idx; |
| 984 | GElf_Sym sym; | 985 | GElf_Sym sym; |
| @@ -993,10 +994,7 @@ static int dso__synthesize_plt_symbols(struct dso *dso, struct map *map, | |||
| 993 | char sympltname[1024]; | 994 | char sympltname[1024]; |
| 994 | Elf *elf; | 995 | Elf *elf; |
| 995 | int nr = 0, symidx, fd, err = 0; | 996 | int nr = 0, symidx, fd, err = 0; |
| 996 | char name[PATH_MAX]; | ||
| 997 | 997 | ||
| 998 | snprintf(name, sizeof(name), "%s%s", | ||
| 999 | symbol_conf.symfs, dso->long_name); | ||
| 1000 | fd = open(name, O_RDONLY); | 998 | fd = open(name, O_RDONLY); |
| 1001 | if (fd < 0) | 999 | if (fd < 0) |
| 1002 | goto out; | 1000 | goto out; |
| @@ -1703,8 +1701,9 @@ restart: | |||
| 1703 | continue; | 1701 | continue; |
| 1704 | 1702 | ||
| 1705 | if (ret > 0) { | 1703 | if (ret > 0) { |
| 1706 | int nr_plt = dso__synthesize_plt_symbols(dso, map, | 1704 | int nr_plt; |
| 1707 | filter); | 1705 | |
| 1706 | nr_plt = dso__synthesize_plt_symbols(dso, name, map, filter); | ||
| 1708 | if (nr_plt > 0) | 1707 | if (nr_plt > 0) |
| 1709 | ret += nr_plt; | 1708 | ret += nr_plt; |
| 1710 | break; | 1709 | break; |
diff --git a/tools/testing/ktest/ktest.pl b/tools/testing/ktest/ktest.pl index 95d6a6f7c33a..4915408f6a98 100755 --- a/tools/testing/ktest/ktest.pl +++ b/tools/testing/ktest/ktest.pl | |||
| @@ -183,6 +183,9 @@ my %force_config; | |||
| 183 | # do not force reboots on config problems | 183 | # do not force reboots on config problems |
| 184 | my $no_reboot = 1; | 184 | my $no_reboot = 1; |
| 185 | 185 | ||
| 186 | # reboot on success | ||
| 187 | my $reboot_success = 0; | ||
| 188 | |||
| 186 | my %option_map = ( | 189 | my %option_map = ( |
| 187 | "MACHINE" => \$machine, | 190 | "MACHINE" => \$machine, |
| 188 | "SSH_USER" => \$ssh_user, | 191 | "SSH_USER" => \$ssh_user, |
| @@ -2192,7 +2195,7 @@ sub run_bisect { | |||
| 2192 | } | 2195 | } |
| 2193 | 2196 | ||
| 2194 | # Are we looking for where it worked, not failed? | 2197 | # Are we looking for where it worked, not failed? |
| 2195 | if ($reverse_bisect) { | 2198 | if ($reverse_bisect && $ret >= 0) { |
| 2196 | $ret = !$ret; | 2199 | $ret = !$ret; |
| 2197 | } | 2200 | } |
| 2198 | 2201 | ||
| @@ -3469,6 +3472,7 @@ for (my $i = 1; $i <= $opt{"NUM_TESTS"}; $i++) { | |||
| 3469 | 3472 | ||
| 3470 | # Do not reboot on failing test options | 3473 | # Do not reboot on failing test options |
| 3471 | $no_reboot = 1; | 3474 | $no_reboot = 1; |
| 3475 | $reboot_success = 0; | ||
| 3472 | 3476 | ||
| 3473 | $iteration = $i; | 3477 | $iteration = $i; |
| 3474 | 3478 | ||
| @@ -3554,9 +3558,11 @@ for (my $i = 1; $i <= $opt{"NUM_TESTS"}; $i++) { | |||
| 3554 | die "failed to checkout $checkout"; | 3558 | die "failed to checkout $checkout"; |
| 3555 | } | 3559 | } |
| 3556 | 3560 | ||
| 3561 | $no_reboot = 0; | ||
| 3562 | |||
| 3557 | # A test may opt to not reboot the box | 3563 | # A test may opt to not reboot the box |
| 3558 | if ($reboot_on_success) { | 3564 | if ($reboot_on_success) { |
| 3559 | $no_reboot = 0; | 3565 | $reboot_success = 1; |
| 3560 | } | 3566 | } |
| 3561 | 3567 | ||
| 3562 | if ($test_type eq "bisect") { | 3568 | if ($test_type eq "bisect") { |
| @@ -3600,7 +3606,7 @@ for (my $i = 1; $i <= $opt{"NUM_TESTS"}; $i++) { | |||
| 3600 | 3606 | ||
| 3601 | if ($opt{"POWEROFF_ON_SUCCESS"}) { | 3607 | if ($opt{"POWEROFF_ON_SUCCESS"}) { |
| 3602 | halt; | 3608 | halt; |
| 3603 | } elsif ($opt{"REBOOT_ON_SUCCESS"} && !do_not_reboot) { | 3609 | } elsif ($opt{"REBOOT_ON_SUCCESS"} && !do_not_reboot && $reboot_success) { |
| 3604 | reboot_to_good; | 3610 | reboot_to_good; |
| 3605 | } elsif (defined($switch_to_good)) { | 3611 | } elsif (defined($switch_to_good)) { |
| 3606 | # still need to get to the good kernel | 3612 | # still need to get to the good kernel |
diff --git a/virt/kvm/iommu.c b/virt/kvm/iommu.c index a457d2138f49..e9fff9830bf0 100644 --- a/virt/kvm/iommu.c +++ b/virt/kvm/iommu.c | |||
| @@ -240,9 +240,13 @@ int kvm_iommu_map_guest(struct kvm *kvm) | |||
| 240 | return -ENODEV; | 240 | return -ENODEV; |
| 241 | } | 241 | } |
| 242 | 242 | ||
| 243 | mutex_lock(&kvm->slots_lock); | ||
| 244 | |||
| 243 | kvm->arch.iommu_domain = iommu_domain_alloc(&pci_bus_type); | 245 | kvm->arch.iommu_domain = iommu_domain_alloc(&pci_bus_type); |
| 244 | if (!kvm->arch.iommu_domain) | 246 | if (!kvm->arch.iommu_domain) { |
| 245 | return -ENOMEM; | 247 | r = -ENOMEM; |
| 248 | goto out_unlock; | ||
| 249 | } | ||
| 246 | 250 | ||
| 247 | if (!allow_unsafe_assigned_interrupts && | 251 | if (!allow_unsafe_assigned_interrupts && |
| 248 | !iommu_domain_has_cap(kvm->arch.iommu_domain, | 252 | !iommu_domain_has_cap(kvm->arch.iommu_domain, |
| @@ -253,17 +257,16 @@ int kvm_iommu_map_guest(struct kvm *kvm) | |||
| 253 | " module option.\n", __func__); | 257 | " module option.\n", __func__); |
| 254 | iommu_domain_free(kvm->arch.iommu_domain); | 258 | iommu_domain_free(kvm->arch.iommu_domain); |
| 255 | kvm->arch.iommu_domain = NULL; | 259 | kvm->arch.iommu_domain = NULL; |
| 256 | return -EPERM; | 260 | r = -EPERM; |
| 261 | goto out_unlock; | ||
| 257 | } | 262 | } |
| 258 | 263 | ||
| 259 | r = kvm_iommu_map_memslots(kvm); | 264 | r = kvm_iommu_map_memslots(kvm); |
| 260 | if (r) | 265 | if (r) |
| 261 | goto out_unmap; | 266 | kvm_iommu_unmap_memslots(kvm); |
| 262 | |||
| 263 | return 0; | ||
| 264 | 267 | ||
| 265 | out_unmap: | 268 | out_unlock: |
| 266 | kvm_iommu_unmap_memslots(kvm); | 269 | mutex_unlock(&kvm->slots_lock); |
| 267 | return r; | 270 | return r; |
| 268 | } | 271 | } |
| 269 | 272 | ||
| @@ -310,6 +313,11 @@ static void kvm_iommu_put_pages(struct kvm *kvm, | |||
| 310 | } | 313 | } |
| 311 | } | 314 | } |
| 312 | 315 | ||
| 316 | void kvm_iommu_unmap_pages(struct kvm *kvm, struct kvm_memory_slot *slot) | ||
| 317 | { | ||
| 318 | kvm_iommu_put_pages(kvm, slot->base_gfn, slot->npages); | ||
| 319 | } | ||
| 320 | |||
| 313 | static int kvm_iommu_unmap_memslots(struct kvm *kvm) | 321 | static int kvm_iommu_unmap_memslots(struct kvm *kvm) |
| 314 | { | 322 | { |
| 315 | int idx; | 323 | int idx; |
| @@ -320,7 +328,7 @@ static int kvm_iommu_unmap_memslots(struct kvm *kvm) | |||
| 320 | slots = kvm_memslots(kvm); | 328 | slots = kvm_memslots(kvm); |
| 321 | 329 | ||
| 322 | kvm_for_each_memslot(memslot, slots) | 330 | kvm_for_each_memslot(memslot, slots) |
| 323 | kvm_iommu_put_pages(kvm, memslot->base_gfn, memslot->npages); | 331 | kvm_iommu_unmap_pages(kvm, memslot); |
| 324 | 332 | ||
| 325 | srcu_read_unlock(&kvm->srcu, idx); | 333 | srcu_read_unlock(&kvm->srcu, idx); |
| 326 | 334 | ||
| @@ -335,7 +343,11 @@ int kvm_iommu_unmap_guest(struct kvm *kvm) | |||
| 335 | if (!domain) | 343 | if (!domain) |
| 336 | return 0; | 344 | return 0; |
| 337 | 345 | ||
| 346 | mutex_lock(&kvm->slots_lock); | ||
| 338 | kvm_iommu_unmap_memslots(kvm); | 347 | kvm_iommu_unmap_memslots(kvm); |
| 348 | kvm->arch.iommu_domain = NULL; | ||
| 349 | mutex_unlock(&kvm->slots_lock); | ||
| 350 | |||
| 339 | iommu_domain_free(domain); | 351 | iommu_domain_free(domain); |
| 340 | return 0; | 352 | return 0; |
| 341 | } | 353 | } |
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index 42b73930a6de..9739b533ca2e 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c | |||
| @@ -808,12 +808,13 @@ int __kvm_set_memory_region(struct kvm *kvm, | |||
| 808 | if (r) | 808 | if (r) |
| 809 | goto out_free; | 809 | goto out_free; |
| 810 | 810 | ||
| 811 | /* map the pages in iommu page table */ | 811 | /* map/unmap the pages in iommu page table */ |
| 812 | if (npages) { | 812 | if (npages) { |
| 813 | r = kvm_iommu_map_pages(kvm, &new); | 813 | r = kvm_iommu_map_pages(kvm, &new); |
| 814 | if (r) | 814 | if (r) |
| 815 | goto out_free; | 815 | goto out_free; |
| 816 | } | 816 | } else |
| 817 | kvm_iommu_unmap_pages(kvm, &old); | ||
| 817 | 818 | ||
| 818 | r = -ENOMEM; | 819 | r = -ENOMEM; |
| 819 | slots = kmemdup(kvm->memslots, sizeof(struct kvm_memslots), | 820 | slots = kmemdup(kvm->memslots, sizeof(struct kvm_memslots), |
