diff options
365 files changed, 4291 insertions, 2677 deletions
diff --git a/Documentation/devicetree/bindings/vendor-prefixes.txt b/Documentation/devicetree/bindings/vendor-prefixes.txt index e8552782b440..874921e97802 100644 --- a/Documentation/devicetree/bindings/vendor-prefixes.txt +++ b/Documentation/devicetree/bindings/vendor-prefixes.txt | |||
| @@ -33,6 +33,7 @@ qcom Qualcomm, Inc. | |||
| 33 | ramtron Ramtron International | 33 | ramtron Ramtron International |
| 34 | samsung Samsung Semiconductor | 34 | samsung Samsung Semiconductor |
| 35 | schindler Schindler | 35 | schindler Schindler |
| 36 | sil Silicon Image | ||
| 36 | simtek | 37 | simtek |
| 37 | sirf SiRF Technology, Inc. | 38 | sirf SiRF Technology, Inc. |
| 38 | stericsson ST-Ericsson | 39 | stericsson ST-Ericsson |
diff --git a/Documentation/filesystems/btrfs.txt b/Documentation/filesystems/btrfs.txt index 64087c34327f..7671352216f1 100644 --- a/Documentation/filesystems/btrfs.txt +++ b/Documentation/filesystems/btrfs.txt | |||
| @@ -63,8 +63,8 @@ IRC network. | |||
| 63 | Userspace tools for creating and manipulating Btrfs file systems are | 63 | Userspace tools for creating and manipulating Btrfs file systems are |
| 64 | available from the git repository at the following location: | 64 | available from the git repository at the following location: |
| 65 | 65 | ||
| 66 | http://git.kernel.org/?p=linux/kernel/git/mason/btrfs-progs-unstable.git | 66 | http://git.kernel.org/?p=linux/kernel/git/mason/btrfs-progs.git |
| 67 | git://git.kernel.org/pub/scm/linux/kernel/git/mason/btrfs-progs-unstable.git | 67 | git://git.kernel.org/pub/scm/linux/kernel/git/mason/btrfs-progs.git |
| 68 | 68 | ||
| 69 | These include the following tools: | 69 | These include the following tools: |
| 70 | 70 | ||
diff --git a/Documentation/power/devices.txt b/Documentation/power/devices.txt index 646a89e0c07d..3139fb505dce 100644 --- a/Documentation/power/devices.txt +++ b/Documentation/power/devices.txt | |||
| @@ -123,9 +123,10 @@ please refer directly to the source code for more information about it. | |||
| 123 | Subsystem-Level Methods | 123 | Subsystem-Level Methods |
| 124 | ----------------------- | 124 | ----------------------- |
| 125 | The core methods to suspend and resume devices reside in struct dev_pm_ops | 125 | The core methods to suspend and resume devices reside in struct dev_pm_ops |
| 126 | pointed to by the pm member of struct bus_type, struct device_type and | 126 | pointed to by the ops member of struct dev_pm_domain, or by the pm member of |
| 127 | struct class. They are mostly of interest to the people writing infrastructure | 127 | struct bus_type, struct device_type and struct class. They are mostly of |
| 128 | for buses, like PCI or USB, or device type and device class drivers. | 128 | interest to the people writing infrastructure for platforms and buses, like PCI |
| 129 | or USB, or device type and device class drivers. | ||
| 129 | 130 | ||
| 130 | Bus drivers implement these methods as appropriate for the hardware and the | 131 | Bus drivers implement these methods as appropriate for the hardware and the |
| 131 | drivers using it; PCI works differently from USB, and so on. Not many people | 132 | drivers using it; PCI works differently from USB, and so on. Not many people |
| @@ -139,41 +140,57 @@ sequencing in the driver model tree. | |||
| 139 | 140 | ||
| 140 | /sys/devices/.../power/wakeup files | 141 | /sys/devices/.../power/wakeup files |
| 141 | ----------------------------------- | 142 | ----------------------------------- |
| 142 | All devices in the driver model have two flags to control handling of wakeup | 143 | All device objects in the driver model contain fields that control the handling |
| 143 | events (hardware signals that can force the device and/or system out of a low | 144 | of system wakeup events (hardware signals that can force the system out of a |
| 144 | power state). These flags are initialized by bus or device driver code using | 145 | sleep state). These fields are initialized by bus or device driver code using |
| 145 | device_set_wakeup_capable() and device_set_wakeup_enable(), defined in | 146 | device_set_wakeup_capable() and device_set_wakeup_enable(), defined in |
| 146 | include/linux/pm_wakeup.h. | 147 | include/linux/pm_wakeup.h. |
| 147 | 148 | ||
| 148 | The "can_wakeup" flag just records whether the device (and its driver) can | 149 | The "power.can_wakeup" flag just records whether the device (and its driver) can |
| 149 | physically support wakeup events. The device_set_wakeup_capable() routine | 150 | physically support wakeup events. The device_set_wakeup_capable() routine |
| 150 | affects this flag. The "should_wakeup" flag controls whether the device should | 151 | affects this flag. The "power.wakeup" field is a pointer to an object of type |
| 151 | try to use its wakeup mechanism. device_set_wakeup_enable() affects this flag; | 152 | struct wakeup_source used for controlling whether or not the device should use |
| 152 | for the most part drivers should not change its value. The initial value of | 153 | its system wakeup mechanism and for notifying the PM core of system wakeup |
| 153 | should_wakeup is supposed to be false for the majority of devices; the major | 154 | events signaled by the device. This object is only present for wakeup-capable |
| 154 | exceptions are power buttons, keyboards, and Ethernet adapters whose WoL | 155 | devices (i.e. devices whose "can_wakeup" flags are set) and is created (or |
| 155 | (wake-on-LAN) feature has been set up with ethtool. It should also default | 156 | removed) by device_set_wakeup_capable(). |
| 156 | to true for devices that don't generate wakeup requests on their own but merely | ||
| 157 | forward wakeup requests from one bus to another (like PCI bridges). | ||
| 158 | 157 | ||
| 159 | Whether or not a device is capable of issuing wakeup events is a hardware | 158 | Whether or not a device is capable of issuing wakeup events is a hardware |
| 160 | matter, and the kernel is responsible for keeping track of it. By contrast, | 159 | matter, and the kernel is responsible for keeping track of it. By contrast, |
| 161 | whether or not a wakeup-capable device should issue wakeup events is a policy | 160 | whether or not a wakeup-capable device should issue wakeup events is a policy |
| 162 | decision, and it is managed by user space through a sysfs attribute: the | 161 | decision, and it is managed by user space through a sysfs attribute: the |
| 163 | power/wakeup file. User space can write the strings "enabled" or "disabled" to | 162 | "power/wakeup" file. User space can write the strings "enabled" or "disabled" |
| 164 | set or clear the "should_wakeup" flag, respectively. This file is only present | 163 | to it to indicate whether or not, respectively, the device is supposed to signal |
| 165 | for wakeup-capable devices (i.e. devices whose "can_wakeup" flags are set) | 164 | system wakeup. This file is only present if the "power.wakeup" object exists |
| 166 | and is created (or removed) by device_set_wakeup_capable(). Reads from the | 165 | for the given device and is created (or removed) along with that object, by |
| 167 | file will return the corresponding string. | 166 | device_set_wakeup_capable(). Reads from the file will return the corresponding |
| 168 | 167 | string. | |
| 169 | The device_may_wakeup() routine returns true only if both flags are set. | 168 | |
| 169 | The "power/wakeup" file is supposed to contain the "disabled" string initially | ||
| 170 | for the majority of devices; the major exceptions are power buttons, keyboards, | ||
| 171 | and Ethernet adapters whose WoL (wake-on-LAN) feature has been set up with | ||
| 172 | ethtool. It should also default to "enabled" for devices that don't generate | ||
| 173 | wakeup requests on their own but merely forward wakeup requests from one bus to | ||
| 174 | another (like PCI Express ports). | ||
| 175 | |||
| 176 | The device_may_wakeup() routine returns true only if the "power.wakeup" object | ||
| 177 | exists and the corresponding "power/wakeup" file contains the string "enabled". | ||
| 170 | This information is used by subsystems, like the PCI bus type code, to see | 178 | This information is used by subsystems, like the PCI bus type code, to see |
| 171 | whether or not to enable the devices' wakeup mechanisms. If device wakeup | 179 | whether or not to enable the devices' wakeup mechanisms. If device wakeup |
| 172 | mechanisms are enabled or disabled directly by drivers, they also should use | 180 | mechanisms are enabled or disabled directly by drivers, they also should use |
| 173 | device_may_wakeup() to decide what to do during a system sleep transition. | 181 | device_may_wakeup() to decide what to do during a system sleep transition. |
| 174 | However for runtime power management, wakeup events should be enabled whenever | 182 | Device drivers, however, are not supposed to call device_set_wakeup_enable() |
| 175 | the device and driver both support them, regardless of the should_wakeup flag. | 183 | directly in any case. |
| 176 | 184 | ||
| 185 | It ought to be noted that system wakeup is conceptually different from "remote | ||
| 186 | wakeup" used by runtime power management, although it may be supported by the | ||
| 187 | same physical mechanism. Remote wakeup is a feature allowing devices in | ||
| 188 | low-power states to trigger specific interrupts to signal conditions in which | ||
| 189 | they should be put into the full-power state. Those interrupts may or may not | ||
| 190 | be used to signal system wakeup events, depending on the hardware design. On | ||
| 191 | some systems it is impossible to trigger them from system sleep states. In any | ||
| 192 | case, remote wakeup should always be enabled for runtime power management for | ||
| 193 | all devices and drivers that support it. | ||
| 177 | 194 | ||
| 178 | /sys/devices/.../power/control files | 195 | /sys/devices/.../power/control files |
| 179 | ------------------------------------ | 196 | ------------------------------------ |
| @@ -249,20 +266,31 @@ for every device before the next phase begins. Not all busses or classes | |||
| 249 | support all these callbacks and not all drivers use all the callbacks. The | 266 | support all these callbacks and not all drivers use all the callbacks. The |
| 250 | various phases always run after tasks have been frozen and before they are | 267 | various phases always run after tasks have been frozen and before they are |
| 251 | unfrozen. Furthermore, the *_noirq phases run at a time when IRQ handlers have | 268 | unfrozen. Furthermore, the *_noirq phases run at a time when IRQ handlers have |
| 252 | been disabled (except for those marked with the IRQ_WAKEUP flag). | 269 | been disabled (except for those marked with the IRQF_NO_SUSPEND flag). |
| 253 | 270 | ||
| 254 | All phases use bus, type, or class callbacks (that is, methods defined in | 271 | All phases use PM domain, bus, type, or class callbacks (that is, methods |
| 255 | dev->bus->pm, dev->type->pm, or dev->class->pm). These callbacks are mutually | 272 | defined in dev->pm_domain->ops, dev->bus->pm, dev->type->pm, or dev->class->pm). |
| 256 | exclusive, so if the device type provides a struct dev_pm_ops object pointed to | 273 | These callbacks are regarded by the PM core as mutually exclusive. Moreover, |
| 257 | by its pm field (i.e. both dev->type and dev->type->pm are defined), the | 274 | PM domain callbacks always take precedence over bus, type and class callbacks, |
| 258 | callbacks included in that object (i.e. dev->type->pm) will be used. Otherwise, | 275 | while type callbacks take precedence over bus and class callbacks, and class |
| 259 | if the class provides a struct dev_pm_ops object pointed to by its pm field | 276 | callbacks take precedence over bus callbacks. To be precise, the following |
| 260 | (i.e. both dev->class and dev->class->pm are defined), the PM core will use the | 277 | rules are used to determine which callback to execute in the given phase: |
| 261 | callbacks from that object (i.e. dev->class->pm). Finally, if the pm fields of | 278 | |
| 262 | both the device type and class objects are NULL (or those objects do not exist), | 279 | 1. If dev->pm_domain is present, the PM core will attempt to execute the |
| 263 | the callbacks provided by the bus (that is, the callbacks from dev->bus->pm) | 280 | callback included in dev->pm_domain->ops. If that callback is not |
| 264 | will be used (this allows device types to override callbacks provided by bus | 281 | present, no action will be carried out for the given device. |
| 265 | types or classes if necessary). | 282 | |
| 283 | 2. Otherwise, if both dev->type and dev->type->pm are present, the callback | ||
| 284 | included in dev->type->pm will be executed. | ||
| 285 | |||
| 286 | 3. Otherwise, if both dev->class and dev->class->pm are present, the | ||
| 287 | callback included in dev->class->pm will be executed. | ||
| 288 | |||
| 289 | 4. Otherwise, if both dev->bus and dev->bus->pm are present, the callback | ||
| 290 | included in dev->bus->pm will be executed. | ||
| 291 | |||
| 292 | This allows PM domains and device types to override callbacks provided by bus | ||
| 293 | types or device classes if necessary. | ||
| 266 | 294 | ||
| 267 | These callbacks may in turn invoke device- or driver-specific methods stored in | 295 | These callbacks may in turn invoke device- or driver-specific methods stored in |
| 268 | dev->driver->pm, but they don't have to. | 296 | dev->driver->pm, but they don't have to. |
| @@ -283,9 +311,8 @@ When the system goes into the standby or memory sleep state, the phases are: | |||
| 283 | 311 | ||
| 284 | After the prepare callback method returns, no new children may be | 312 | After the prepare callback method returns, no new children may be |
| 285 | registered below the device. The method may also prepare the device or | 313 | registered below the device. The method may also prepare the device or |
| 286 | driver in some way for the upcoming system power transition (for | 314 | driver in some way for the upcoming system power transition, but it |
| 287 | example, by allocating additional memory required for this purpose), but | 315 | should not put the device into a low-power state. |
| 288 | it should not put the device into a low-power state. | ||
| 289 | 316 | ||
| 290 | 2. The suspend methods should quiesce the device to stop it from performing | 317 | 2. The suspend methods should quiesce the device to stop it from performing |
| 291 | I/O. They also may save the device registers and put it into the | 318 | I/O. They also may save the device registers and put it into the |
diff --git a/Documentation/power/runtime_pm.txt b/Documentation/power/runtime_pm.txt index 5336149f831b..c2ae8bf77d46 100644 --- a/Documentation/power/runtime_pm.txt +++ b/Documentation/power/runtime_pm.txt | |||
| @@ -44,25 +44,33 @@ struct dev_pm_ops { | |||
| 44 | }; | 44 | }; |
| 45 | 45 | ||
| 46 | The ->runtime_suspend(), ->runtime_resume() and ->runtime_idle() callbacks | 46 | The ->runtime_suspend(), ->runtime_resume() and ->runtime_idle() callbacks |
| 47 | are executed by the PM core for either the power domain, or the device type | 47 | are executed by the PM core for the device's subsystem that may be either of |
| 48 | (if the device power domain's struct dev_pm_ops does not exist), or the class | 48 | the following: |
| 49 | (if the device power domain's and type's struct dev_pm_ops object does not | 49 | |
| 50 | exist), or the bus type (if the device power domain's, type's and class' | 50 | 1. PM domain of the device, if the device's PM domain object, dev->pm_domain, |
| 51 | struct dev_pm_ops objects do not exist) of the given device, so the priority | 51 | is present. |
| 52 | order of callbacks from high to low is that power domain callbacks, device | 52 | |
| 53 | type callbacks, class callbacks and bus type callbacks, and the high priority | 53 | 2. Device type of the device, if both dev->type and dev->type->pm are present. |
| 54 | one will take precedence over low priority one. The bus type, device type and | 54 | |
| 55 | class callbacks are referred to as subsystem-level callbacks in what follows, | 55 | 3. Device class of the device, if both dev->class and dev->class->pm are |
| 56 | and generally speaking, the power domain callbacks are used for representing | 56 | present. |
| 57 | power domains within a SoC. | 57 | |
| 58 | 4. Bus type of the device, if both dev->bus and dev->bus->pm are present. | ||
| 59 | |||
| 60 | The PM core always checks which callback to use in the order given above, so the | ||
| 61 | priority order of callbacks from high to low is: PM domain, device type, class | ||
| 62 | and bus type. Moreover, the high-priority one will always take precedence over | ||
| 63 | a low-priority one. The PM domain, bus type, device type and class callbacks | ||
| 64 | are referred to as subsystem-level callbacks in what follows. | ||
| 58 | 65 | ||
| 59 | By default, the callbacks are always invoked in process context with interrupts | 66 | By default, the callbacks are always invoked in process context with interrupts |
| 60 | enabled. However, subsystems can use the pm_runtime_irq_safe() helper function | 67 | enabled. However, subsystems can use the pm_runtime_irq_safe() helper function |
| 61 | to tell the PM core that a device's ->runtime_suspend() and ->runtime_resume() | 68 | to tell the PM core that their ->runtime_suspend(), ->runtime_resume() and |
| 62 | callbacks should be invoked in atomic context with interrupts disabled. | 69 | ->runtime_idle() callbacks may be invoked in atomic context with interrupts |
| 63 | This implies that these callback routines must not block or sleep, but it also | 70 | disabled for a given device. This implies that the callback routines in |
| 64 | means that the synchronous helper functions listed at the end of Section 4 can | 71 | question must not block or sleep, but it also means that the synchronous helper |
| 65 | be used within an interrupt handler or in an atomic context. | 72 | functions listed at the end of Section 4 may be used for that device within an |
| 73 | interrupt handler or generally in an atomic context. | ||
| 66 | 74 | ||
| 67 | The subsystem-level suspend callback is _entirely_ _responsible_ for handling | 75 | The subsystem-level suspend callback is _entirely_ _responsible_ for handling |
| 68 | the suspend of the device as appropriate, which may, but need not include | 76 | the suspend of the device as appropriate, which may, but need not include |
diff --git a/MAINTAINERS b/MAINTAINERS index 3523ab000f1f..447560284996 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
| @@ -789,6 +789,7 @@ L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) | |||
| 789 | S: Maintained | 789 | S: Maintained |
| 790 | T: git git://git.pengutronix.de/git/imx/linux-2.6.git | 790 | T: git git://git.pengutronix.de/git/imx/linux-2.6.git |
| 791 | F: arch/arm/mach-mx*/ | 791 | F: arch/arm/mach-mx*/ |
| 792 | F: arch/arm/mach-imx/ | ||
| 792 | F: arch/arm/plat-mxc/ | 793 | F: arch/arm/plat-mxc/ |
| 793 | 794 | ||
| 794 | ARM/FREESCALE IMX51 | 795 | ARM/FREESCALE IMX51 |
| @@ -804,6 +805,13 @@ S: Maintained | |||
| 804 | T: git git://git.linaro.org/people/shawnguo/linux-2.6.git | 805 | T: git git://git.linaro.org/people/shawnguo/linux-2.6.git |
| 805 | F: arch/arm/mach-imx/*imx6* | 806 | F: arch/arm/mach-imx/*imx6* |
| 806 | 807 | ||
| 808 | ARM/FREESCALE MXS ARM ARCHITECTURE | ||
| 809 | M: Shawn Guo <shawn.guo@linaro.org> | ||
| 810 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) | ||
| 811 | S: Maintained | ||
| 812 | T: git git://git.linaro.org/people/shawnguo/linux-2.6.git | ||
| 813 | F: arch/arm/mach-mxs/ | ||
| 814 | |||
| 807 | ARM/GLOMATION GESBC9312SX MACHINE SUPPORT | 815 | ARM/GLOMATION GESBC9312SX MACHINE SUPPORT |
| 808 | M: Lennert Buytenhek <kernel@wantstofly.org> | 816 | M: Lennert Buytenhek <kernel@wantstofly.org> |
| 809 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) | 817 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) |
| @@ -5667,7 +5675,6 @@ F: drivers/media/video/*7146* | |||
| 5667 | F: include/media/*7146* | 5675 | F: include/media/*7146* |
| 5668 | 5676 | ||
| 5669 | SAMSUNG AUDIO (ASoC) DRIVERS | 5677 | SAMSUNG AUDIO (ASoC) DRIVERS |
| 5670 | M: Jassi Brar <jassisinghbrar@gmail.com> | ||
| 5671 | M: Sangbeom Kim <sbkim73@samsung.com> | 5678 | M: Sangbeom Kim <sbkim73@samsung.com> |
| 5672 | L: alsa-devel@alsa-project.org (moderated for non-subscribers) | 5679 | L: alsa-devel@alsa-project.org (moderated for non-subscribers) |
| 5673 | S: Supported | 5680 | S: Supported |
| @@ -1,7 +1,7 @@ | |||
| 1 | VERSION = 3 | 1 | VERSION = 3 |
| 2 | PATCHLEVEL = 2 | 2 | PATCHLEVEL = 2 |
| 3 | SUBLEVEL = 0 | 3 | SUBLEVEL = 0 |
| 4 | EXTRAVERSION = -rc3 | 4 | EXTRAVERSION = -rc4 |
| 5 | NAME = Saber-toothed Squirrel | 5 | NAME = Saber-toothed Squirrel |
| 6 | 6 | ||
| 7 | # *DOCUMENTATION* | 7 | # *DOCUMENTATION* |
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 44789eff983f..e084b7e981e8 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig | |||
| @@ -1231,7 +1231,7 @@ config ARM_ERRATA_742231 | |||
| 1231 | capabilities of the processor. | 1231 | capabilities of the processor. |
| 1232 | 1232 | ||
| 1233 | config PL310_ERRATA_588369 | 1233 | config PL310_ERRATA_588369 |
| 1234 | bool "Clean & Invalidate maintenance operations do not invalidate clean lines" | 1234 | bool "PL310 errata: Clean & Invalidate maintenance operations do not invalidate clean lines" |
| 1235 | depends on CACHE_L2X0 | 1235 | depends on CACHE_L2X0 |
| 1236 | help | 1236 | help |
| 1237 | The PL310 L2 cache controller implements three types of Clean & | 1237 | The PL310 L2 cache controller implements three types of Clean & |
| @@ -1256,7 +1256,7 @@ config ARM_ERRATA_720789 | |||
| 1256 | entries regardless of the ASID. | 1256 | entries regardless of the ASID. |
| 1257 | 1257 | ||
| 1258 | config PL310_ERRATA_727915 | 1258 | config PL310_ERRATA_727915 |
| 1259 | bool "Background Clean & Invalidate by Way operation can cause data corruption" | 1259 | bool "PL310 errata: Background Clean & Invalidate by Way operation can cause data corruption" |
| 1260 | depends on CACHE_L2X0 | 1260 | depends on CACHE_L2X0 |
| 1261 | help | 1261 | help |
| 1262 | PL310 implements the Clean & Invalidate by Way L2 cache maintenance | 1262 | PL310 implements the Clean & Invalidate by Way L2 cache maintenance |
| @@ -1289,8 +1289,8 @@ config ARM_ERRATA_751472 | |||
| 1289 | operation is received by a CPU before the ICIALLUIS has completed, | 1289 | operation is received by a CPU before the ICIALLUIS has completed, |
| 1290 | potentially leading to corrupted entries in the cache or TLB. | 1290 | potentially leading to corrupted entries in the cache or TLB. |
| 1291 | 1291 | ||
| 1292 | config ARM_ERRATA_753970 | 1292 | config PL310_ERRATA_753970 |
| 1293 | bool "ARM errata: cache sync operation may be faulty" | 1293 | bool "PL310 errata: cache sync operation may be faulty" |
| 1294 | depends on CACHE_PL310 | 1294 | depends on CACHE_PL310 |
| 1295 | help | 1295 | help |
| 1296 | This option enables the workaround for the 753970 PL310 (r3p0) erratum. | 1296 | This option enables the workaround for the 753970 PL310 (r3p0) erratum. |
| @@ -1352,6 +1352,18 @@ config ARM_ERRATA_764369 | |||
| 1352 | relevant cache maintenance functions and sets a specific bit | 1352 | relevant cache maintenance functions and sets a specific bit |
| 1353 | in the diagnostic control register of the SCU. | 1353 | in the diagnostic control register of the SCU. |
| 1354 | 1354 | ||
| 1355 | config PL310_ERRATA_769419 | ||
| 1356 | bool "PL310 errata: no automatic Store Buffer drain" | ||
| 1357 | depends on CACHE_L2X0 | ||
| 1358 | help | ||
| 1359 | On revisions of the PL310 prior to r3p2, the Store Buffer does | ||
| 1360 | not automatically drain. This can cause normal, non-cacheable | ||
| 1361 | writes to be retained when the memory system is idle, leading | ||
| 1362 | to suboptimal I/O performance for drivers using coherent DMA. | ||
| 1363 | This option adds a write barrier to the cpu_idle loop so that, | ||
| 1364 | on systems with an outer cache, the store buffer is drained | ||
| 1365 | explicitly. | ||
| 1366 | |||
| 1355 | endmenu | 1367 | endmenu |
| 1356 | 1368 | ||
| 1357 | source "arch/arm/common/Kconfig" | 1369 | source "arch/arm/common/Kconfig" |
diff --git a/arch/arm/common/gic.c b/arch/arm/common/gic.c index 0e6ae470c94f..410a546060a2 100644 --- a/arch/arm/common/gic.c +++ b/arch/arm/common/gic.c | |||
| @@ -526,7 +526,8 @@ static void __init gic_pm_init(struct gic_chip_data *gic) | |||
| 526 | sizeof(u32)); | 526 | sizeof(u32)); |
| 527 | BUG_ON(!gic->saved_ppi_conf); | 527 | BUG_ON(!gic->saved_ppi_conf); |
| 528 | 528 | ||
| 529 | cpu_pm_register_notifier(&gic_notifier_block); | 529 | if (gic == &gic_data[0]) |
| 530 | cpu_pm_register_notifier(&gic_notifier_block); | ||
| 530 | } | 531 | } |
| 531 | #else | 532 | #else |
| 532 | static void __init gic_pm_init(struct gic_chip_data *gic) | 533 | static void __init gic_pm_init(struct gic_chip_data *gic) |
| @@ -581,13 +582,16 @@ void __init gic_init(unsigned int gic_nr, int irq_start, | |||
| 581 | * For primary GICs, skip over SGIs. | 582 | * For primary GICs, skip over SGIs. |
| 582 | * For secondary GICs, skip over PPIs, too. | 583 | * For secondary GICs, skip over PPIs, too. |
| 583 | */ | 584 | */ |
| 585 | domain->hwirq_base = 32; | ||
| 584 | if (gic_nr == 0) { | 586 | if (gic_nr == 0) { |
| 585 | gic_cpu_base_addr = cpu_base; | 587 | gic_cpu_base_addr = cpu_base; |
| 586 | domain->hwirq_base = 16; | 588 | |
| 587 | if (irq_start > 0) | 589 | if ((irq_start & 31) > 0) { |
| 588 | irq_start = (irq_start & ~31) + 16; | 590 | domain->hwirq_base = 16; |
| 589 | } else | 591 | if (irq_start != -1) |
| 590 | domain->hwirq_base = 32; | 592 | irq_start = (irq_start & ~31) + 16; |
| 593 | } | ||
| 594 | } | ||
| 591 | 595 | ||
| 592 | /* | 596 | /* |
| 593 | * Find out how many interrupts are supported. | 597 | * Find out how many interrupts are supported. |
diff --git a/arch/arm/common/pl330.c b/arch/arm/common/pl330.c index 7129cfbdacd6..f407a6b35d3d 100644 --- a/arch/arm/common/pl330.c +++ b/arch/arm/common/pl330.c | |||
| @@ -1211,8 +1211,8 @@ static inline u32 _prepare_ccr(const struct pl330_reqcfg *rqc) | |||
| 1211 | ccr |= (rqc->brst_size << CC_SRCBRSTSIZE_SHFT); | 1211 | ccr |= (rqc->brst_size << CC_SRCBRSTSIZE_SHFT); |
| 1212 | ccr |= (rqc->brst_size << CC_DSTBRSTSIZE_SHFT); | 1212 | ccr |= (rqc->brst_size << CC_DSTBRSTSIZE_SHFT); |
| 1213 | 1213 | ||
| 1214 | ccr |= (rqc->dcctl << CC_SRCCCTRL_SHFT); | 1214 | ccr |= (rqc->scctl << CC_SRCCCTRL_SHFT); |
| 1215 | ccr |= (rqc->scctl << CC_DSTCCTRL_SHFT); | 1215 | ccr |= (rqc->dcctl << CC_DSTCCTRL_SHFT); |
| 1216 | 1216 | ||
| 1217 | ccr |= (rqc->swap << CC_SWAP_SHFT); | 1217 | ccr |= (rqc->swap << CC_SWAP_SHFT); |
| 1218 | 1218 | ||
| @@ -1623,6 +1623,11 @@ static inline int _alloc_event(struct pl330_thread *thrd) | |||
| 1623 | return -1; | 1623 | return -1; |
| 1624 | } | 1624 | } |
| 1625 | 1625 | ||
| 1626 | static bool _chan_ns(const struct pl330_info *pi, int i) | ||
| 1627 | { | ||
| 1628 | return pi->pcfg.irq_ns & (1 << i); | ||
| 1629 | } | ||
| 1630 | |||
| 1626 | /* Upon success, returns IdentityToken for the | 1631 | /* Upon success, returns IdentityToken for the |
| 1627 | * allocated channel, NULL otherwise. | 1632 | * allocated channel, NULL otherwise. |
| 1628 | */ | 1633 | */ |
| @@ -1647,7 +1652,8 @@ void *pl330_request_channel(const struct pl330_info *pi) | |||
| 1647 | 1652 | ||
| 1648 | for (i = 0; i < chans; i++) { | 1653 | for (i = 0; i < chans; i++) { |
| 1649 | thrd = &pl330->channels[i]; | 1654 | thrd = &pl330->channels[i]; |
| 1650 | if (thrd->free) { | 1655 | if ((thrd->free) && (!_manager_ns(thrd) || |
| 1656 | _chan_ns(pi, i))) { | ||
| 1651 | thrd->ev = _alloc_event(thrd); | 1657 | thrd->ev = _alloc_event(thrd); |
| 1652 | if (thrd->ev >= 0) { | 1658 | if (thrd->ev >= 0) { |
| 1653 | thrd->free = false; | 1659 | thrd->free = false; |
diff --git a/arch/arm/configs/at91cap9adk_defconfig b/arch/arm/configs/at91cap9_defconfig index ffb1edd93363..8826eb218e73 100644 --- a/arch/arm/configs/at91cap9adk_defconfig +++ b/arch/arm/configs/at91cap9_defconfig | |||
| @@ -38,7 +38,6 @@ CONFIG_IP_PNP_RARP=y | |||
| 38 | # CONFIG_IPV6 is not set | 38 | # CONFIG_IPV6 is not set |
| 39 | CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" | 39 | CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" |
| 40 | CONFIG_MTD=y | 40 | CONFIG_MTD=y |
| 41 | CONFIG_MTD_PARTITIONS=y | ||
| 42 | CONFIG_MTD_CMDLINE_PARTS=y | 41 | CONFIG_MTD_CMDLINE_PARTS=y |
| 43 | CONFIG_MTD_CHAR=y | 42 | CONFIG_MTD_CHAR=y |
| 44 | CONFIG_MTD_BLOCK=y | 43 | CONFIG_MTD_BLOCK=y |
| @@ -52,16 +51,12 @@ CONFIG_MTD_NAND_ATMEL=y | |||
| 52 | CONFIG_BLK_DEV_LOOP=y | 51 | CONFIG_BLK_DEV_LOOP=y |
| 53 | CONFIG_BLK_DEV_RAM=y | 52 | CONFIG_BLK_DEV_RAM=y |
| 54 | CONFIG_BLK_DEV_RAM_SIZE=8192 | 53 | CONFIG_BLK_DEV_RAM_SIZE=8192 |
| 55 | CONFIG_ATMEL_SSC=y | ||
| 56 | CONFIG_SCSI=y | 54 | CONFIG_SCSI=y |
| 57 | CONFIG_BLK_DEV_SD=y | 55 | CONFIG_BLK_DEV_SD=y |
| 58 | CONFIG_SCSI_MULTI_LUN=y | 56 | CONFIG_SCSI_MULTI_LUN=y |
| 59 | CONFIG_NETDEVICES=y | 57 | CONFIG_NETDEVICES=y |
| 60 | CONFIG_NET_ETHERNET=y | ||
| 61 | CONFIG_MII=y | 58 | CONFIG_MII=y |
| 62 | CONFIG_MACB=y | 59 | CONFIG_MACB=y |
| 63 | # CONFIG_NETDEV_1000 is not set | ||
| 64 | # CONFIG_NETDEV_10000 is not set | ||
| 65 | # CONFIG_INPUT_MOUSEDEV_PSAUX is not set | 60 | # CONFIG_INPUT_MOUSEDEV_PSAUX is not set |
| 66 | CONFIG_INPUT_EVDEV=y | 61 | CONFIG_INPUT_EVDEV=y |
| 67 | # CONFIG_INPUT_KEYBOARD is not set | 62 | # CONFIG_INPUT_KEYBOARD is not set |
| @@ -81,7 +76,6 @@ CONFIG_WATCHDOG=y | |||
| 81 | CONFIG_WATCHDOG_NOWAYOUT=y | 76 | CONFIG_WATCHDOG_NOWAYOUT=y |
| 82 | CONFIG_FB=y | 77 | CONFIG_FB=y |
| 83 | CONFIG_FB_ATMEL=y | 78 | CONFIG_FB_ATMEL=y |
| 84 | # CONFIG_VGA_CONSOLE is not set | ||
| 85 | CONFIG_LOGO=y | 79 | CONFIG_LOGO=y |
| 86 | # CONFIG_LOGO_LINUX_MONO is not set | 80 | # CONFIG_LOGO_LINUX_MONO is not set |
| 87 | # CONFIG_LOGO_LINUX_CLUT224 is not set | 81 | # CONFIG_LOGO_LINUX_CLUT224 is not set |
| @@ -99,7 +93,6 @@ CONFIG_MMC_AT91=m | |||
| 99 | CONFIG_RTC_CLASS=y | 93 | CONFIG_RTC_CLASS=y |
| 100 | CONFIG_RTC_DRV_AT91SAM9=y | 94 | CONFIG_RTC_DRV_AT91SAM9=y |
| 101 | CONFIG_EXT2_FS=y | 95 | CONFIG_EXT2_FS=y |
| 102 | CONFIG_INOTIFY=y | ||
| 103 | CONFIG_VFAT_FS=y | 96 | CONFIG_VFAT_FS=y |
| 104 | CONFIG_TMPFS=y | 97 | CONFIG_TMPFS=y |
| 105 | CONFIG_JFFS2_FS=y | 98 | CONFIG_JFFS2_FS=y |
diff --git a/arch/arm/configs/at91rm9200_defconfig b/arch/arm/configs/at91rm9200_defconfig index 38cb7c985426..bbe4e1a1f5d8 100644 --- a/arch/arm/configs/at91rm9200_defconfig +++ b/arch/arm/configs/at91rm9200_defconfig | |||
| @@ -5,7 +5,6 @@ CONFIG_SYSVIPC=y | |||
| 5 | CONFIG_IKCONFIG=y | 5 | CONFIG_IKCONFIG=y |
| 6 | CONFIG_IKCONFIG_PROC=y | 6 | CONFIG_IKCONFIG_PROC=y |
| 7 | CONFIG_LOG_BUF_SHIFT=14 | 7 | CONFIG_LOG_BUF_SHIFT=14 |
| 8 | CONFIG_SYSFS_DEPRECATED_V2=y | ||
| 9 | CONFIG_BLK_DEV_INITRD=y | 8 | CONFIG_BLK_DEV_INITRD=y |
| 10 | CONFIG_MODULES=y | 9 | CONFIG_MODULES=y |
| 11 | CONFIG_MODULE_FORCE_LOAD=y | 10 | CONFIG_MODULE_FORCE_LOAD=y |
| @@ -56,7 +55,6 @@ CONFIG_IP_PNP=y | |||
| 56 | CONFIG_IP_PNP_DHCP=y | 55 | CONFIG_IP_PNP_DHCP=y |
| 57 | CONFIG_IP_PNP_BOOTP=y | 56 | CONFIG_IP_PNP_BOOTP=y |
| 58 | CONFIG_NET_IPIP=m | 57 | CONFIG_NET_IPIP=m |
| 59 | CONFIG_NET_IPGRE=m | ||
| 60 | CONFIG_INET_AH=m | 58 | CONFIG_INET_AH=m |
| 61 | CONFIG_INET_ESP=m | 59 | CONFIG_INET_ESP=m |
| 62 | CONFIG_INET_IPCOMP=m | 60 | CONFIG_INET_IPCOMP=m |
| @@ -75,18 +73,8 @@ CONFIG_IPV6_TUNNEL=m | |||
| 75 | CONFIG_BRIDGE=m | 73 | CONFIG_BRIDGE=m |
| 76 | CONFIG_VLAN_8021Q=m | 74 | CONFIG_VLAN_8021Q=m |
| 77 | CONFIG_BT=m | 75 | CONFIG_BT=m |
| 78 | CONFIG_BT_L2CAP=m | ||
| 79 | CONFIG_BT_SCO=m | ||
| 80 | CONFIG_BT_RFCOMM=m | ||
| 81 | CONFIG_BT_RFCOMM_TTY=y | ||
| 82 | CONFIG_BT_BNEP=m | ||
| 83 | CONFIG_BT_BNEP_MC_FILTER=y | ||
| 84 | CONFIG_BT_BNEP_PROTO_FILTER=y | ||
| 85 | CONFIG_BT_HIDP=m | ||
| 86 | CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" | 76 | CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" |
| 87 | CONFIG_MTD=y | 77 | CONFIG_MTD=y |
| 88 | CONFIG_MTD_CONCAT=y | ||
| 89 | CONFIG_MTD_PARTITIONS=y | ||
| 90 | CONFIG_MTD_CMDLINE_PARTS=y | 78 | CONFIG_MTD_CMDLINE_PARTS=y |
| 91 | CONFIG_MTD_AFS_PARTS=y | 79 | CONFIG_MTD_AFS_PARTS=y |
| 92 | CONFIG_MTD_CHAR=y | 80 | CONFIG_MTD_CHAR=y |
| @@ -108,8 +96,6 @@ CONFIG_BLK_DEV_LOOP=y | |||
| 108 | CONFIG_BLK_DEV_NBD=y | 96 | CONFIG_BLK_DEV_NBD=y |
| 109 | CONFIG_BLK_DEV_RAM=y | 97 | CONFIG_BLK_DEV_RAM=y |
| 110 | CONFIG_BLK_DEV_RAM_SIZE=8192 | 98 | CONFIG_BLK_DEV_RAM_SIZE=8192 |
| 111 | CONFIG_ATMEL_TCLIB=y | ||
| 112 | CONFIG_EEPROM_LEGACY=m | ||
| 113 | CONFIG_SCSI=y | 99 | CONFIG_SCSI=y |
| 114 | CONFIG_BLK_DEV_SD=y | 100 | CONFIG_BLK_DEV_SD=y |
| 115 | CONFIG_BLK_DEV_SR=m | 101 | CONFIG_BLK_DEV_SR=m |
| @@ -119,14 +105,23 @@ CONFIG_SCSI_MULTI_LUN=y | |||
| 119 | # CONFIG_SCSI_LOWLEVEL is not set | 105 | # CONFIG_SCSI_LOWLEVEL is not set |
| 120 | CONFIG_NETDEVICES=y | 106 | CONFIG_NETDEVICES=y |
| 121 | CONFIG_TUN=m | 107 | CONFIG_TUN=m |
| 108 | CONFIG_ARM_AT91_ETHER=y | ||
| 122 | CONFIG_PHYLIB=y | 109 | CONFIG_PHYLIB=y |
| 123 | CONFIG_DAVICOM_PHY=y | 110 | CONFIG_DAVICOM_PHY=y |
| 124 | CONFIG_SMSC_PHY=y | 111 | CONFIG_SMSC_PHY=y |
| 125 | CONFIG_MICREL_PHY=y | 112 | CONFIG_MICREL_PHY=y |
| 126 | CONFIG_NET_ETHERNET=y | 113 | CONFIG_PPP=y |
| 127 | CONFIG_ARM_AT91_ETHER=y | 114 | CONFIG_PPP_BSDCOMP=y |
| 128 | # CONFIG_NETDEV_1000 is not set | 115 | CONFIG_PPP_DEFLATE=y |
| 129 | # CONFIG_NETDEV_10000 is not set | 116 | CONFIG_PPP_FILTER=y |
| 117 | CONFIG_PPP_MPPE=m | ||
| 118 | CONFIG_PPP_MULTILINK=y | ||
| 119 | CONFIG_PPPOE=m | ||
| 120 | CONFIG_PPP_ASYNC=y | ||
| 121 | CONFIG_SLIP=m | ||
| 122 | CONFIG_SLIP_COMPRESSED=y | ||
| 123 | CONFIG_SLIP_SMART=y | ||
| 124 | CONFIG_SLIP_MODE_SLIP6=y | ||
| 130 | CONFIG_USB_CATC=m | 125 | CONFIG_USB_CATC=m |
| 131 | CONFIG_USB_KAWETH=m | 126 | CONFIG_USB_KAWETH=m |
| 132 | CONFIG_USB_PEGASUS=m | 127 | CONFIG_USB_PEGASUS=m |
| @@ -139,18 +134,6 @@ CONFIG_USB_NET_RNDIS_HOST=m | |||
| 139 | CONFIG_USB_ALI_M5632=y | 134 | CONFIG_USB_ALI_M5632=y |
| 140 | CONFIG_USB_AN2720=y | 135 | CONFIG_USB_AN2720=y |
| 141 | CONFIG_USB_EPSON2888=y | 136 | CONFIG_USB_EPSON2888=y |
| 142 | CONFIG_PPP=y | ||
| 143 | CONFIG_PPP_MULTILINK=y | ||
| 144 | CONFIG_PPP_FILTER=y | ||
| 145 | CONFIG_PPP_ASYNC=y | ||
| 146 | CONFIG_PPP_DEFLATE=y | ||
| 147 | CONFIG_PPP_BSDCOMP=y | ||
| 148 | CONFIG_PPP_MPPE=m | ||
| 149 | CONFIG_PPPOE=m | ||
| 150 | CONFIG_SLIP=m | ||
| 151 | CONFIG_SLIP_COMPRESSED=y | ||
| 152 | CONFIG_SLIP_SMART=y | ||
| 153 | CONFIG_SLIP_MODE_SLIP6=y | ||
| 154 | # CONFIG_INPUT_MOUSEDEV_PSAUX is not set | 137 | # CONFIG_INPUT_MOUSEDEV_PSAUX is not set |
| 155 | CONFIG_INPUT_MOUSEDEV_SCREEN_X=640 | 138 | CONFIG_INPUT_MOUSEDEV_SCREEN_X=640 |
| 156 | CONFIG_INPUT_MOUSEDEV_SCREEN_Y=480 | 139 | CONFIG_INPUT_MOUSEDEV_SCREEN_Y=480 |
| @@ -158,9 +141,9 @@ CONFIG_INPUT_EVDEV=y | |||
| 158 | CONFIG_KEYBOARD_GPIO=y | 141 | CONFIG_KEYBOARD_GPIO=y |
| 159 | # CONFIG_INPUT_MOUSE is not set | 142 | # CONFIG_INPUT_MOUSE is not set |
| 160 | CONFIG_INPUT_TOUCHSCREEN=y | 143 | CONFIG_INPUT_TOUCHSCREEN=y |
| 144 | CONFIG_LEGACY_PTY_COUNT=32 | ||
| 161 | CONFIG_SERIAL_ATMEL=y | 145 | CONFIG_SERIAL_ATMEL=y |
| 162 | CONFIG_SERIAL_ATMEL_CONSOLE=y | 146 | CONFIG_SERIAL_ATMEL_CONSOLE=y |
| 163 | CONFIG_LEGACY_PTY_COUNT=32 | ||
| 164 | CONFIG_HW_RANDOM=y | 147 | CONFIG_HW_RANDOM=y |
| 165 | CONFIG_I2C=y | 148 | CONFIG_I2C=y |
| 166 | CONFIG_I2C_CHARDEV=y | 149 | CONFIG_I2C_CHARDEV=y |
| @@ -290,7 +273,6 @@ CONFIG_NFS_V3_ACL=y | |||
| 290 | CONFIG_NFS_V4=y | 273 | CONFIG_NFS_V4=y |
| 291 | CONFIG_ROOT_NFS=y | 274 | CONFIG_ROOT_NFS=y |
| 292 | CONFIG_NFSD=y | 275 | CONFIG_NFSD=y |
| 293 | CONFIG_SMB_FS=m | ||
| 294 | CONFIG_CIFS=m | 276 | CONFIG_CIFS=m |
| 295 | CONFIG_PARTITION_ADVANCED=y | 277 | CONFIG_PARTITION_ADVANCED=y |
| 296 | CONFIG_MAC_PARTITION=y | 278 | CONFIG_MAC_PARTITION=y |
| @@ -335,7 +317,6 @@ CONFIG_NLS_UTF8=y | |||
| 335 | CONFIG_MAGIC_SYSRQ=y | 317 | CONFIG_MAGIC_SYSRQ=y |
| 336 | CONFIG_DEBUG_FS=y | 318 | CONFIG_DEBUG_FS=y |
| 337 | CONFIG_DEBUG_KERNEL=y | 319 | CONFIG_DEBUG_KERNEL=y |
| 338 | # CONFIG_RCU_CPU_STALL_DETECTOR is not set | ||
| 339 | # CONFIG_FTRACE is not set | 320 | # CONFIG_FTRACE is not set |
| 340 | CONFIG_CRYPTO_PCBC=y | 321 | CONFIG_CRYPTO_PCBC=y |
| 341 | CONFIG_CRYPTO_SHA1=y | 322 | CONFIG_CRYPTO_SHA1=y |
diff --git a/arch/arm/configs/at91sam9260ek_defconfig b/arch/arm/configs/at91sam9260_defconfig index f8a9226413bf..505b3765f87e 100644 --- a/arch/arm/configs/at91sam9260ek_defconfig +++ b/arch/arm/configs/at91sam9260_defconfig | |||
| @@ -12,11 +12,23 @@ CONFIG_MODULE_UNLOAD=y | |||
| 12 | # CONFIG_IOSCHED_CFQ is not set | 12 | # CONFIG_IOSCHED_CFQ is not set |
| 13 | CONFIG_ARCH_AT91=y | 13 | CONFIG_ARCH_AT91=y |
| 14 | CONFIG_ARCH_AT91SAM9260=y | 14 | CONFIG_ARCH_AT91SAM9260=y |
| 15 | CONFIG_ARCH_AT91SAM9260_SAM9XE=y | ||
| 15 | CONFIG_MACH_AT91SAM9260EK=y | 16 | CONFIG_MACH_AT91SAM9260EK=y |
| 17 | CONFIG_MACH_CAM60=y | ||
| 18 | CONFIG_MACH_SAM9_L9260=y | ||
| 19 | CONFIG_MACH_AFEB9260=y | ||
| 20 | CONFIG_MACH_USB_A9260=y | ||
| 21 | CONFIG_MACH_QIL_A9260=y | ||
| 22 | CONFIG_MACH_CPU9260=y | ||
| 23 | CONFIG_MACH_FLEXIBITY=y | ||
| 24 | CONFIG_MACH_SNAPPER_9260=y | ||
| 25 | CONFIG_MACH_AT91SAM_DT=y | ||
| 16 | CONFIG_AT91_PROGRAMMABLE_CLOCKS=y | 26 | CONFIG_AT91_PROGRAMMABLE_CLOCKS=y |
| 17 | # CONFIG_ARM_THUMB is not set | 27 | # CONFIG_ARM_THUMB is not set |
| 18 | CONFIG_ZBOOT_ROM_TEXT=0x0 | 28 | CONFIG_ZBOOT_ROM_TEXT=0x0 |
| 19 | CONFIG_ZBOOT_ROM_BSS=0x0 | 29 | CONFIG_ZBOOT_ROM_BSS=0x0 |
| 30 | CONFIG_ARM_APPENDED_DTB=y | ||
| 31 | CONFIG_ARM_ATAG_DTB_COMPAT=y | ||
| 20 | CONFIG_CMDLINE="mem=64M console=ttyS0,115200 initrd=0x21100000,3145728 root=/dev/ram0 rw" | 32 | CONFIG_CMDLINE="mem=64M console=ttyS0,115200 initrd=0x21100000,3145728 root=/dev/ram0 rw" |
| 21 | CONFIG_FPE_NWFPE=y | 33 | CONFIG_FPE_NWFPE=y |
| 22 | CONFIG_NET=y | 34 | CONFIG_NET=y |
| @@ -33,12 +45,10 @@ CONFIG_IP_PNP_BOOTP=y | |||
| 33 | CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" | 45 | CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" |
| 34 | CONFIG_BLK_DEV_RAM=y | 46 | CONFIG_BLK_DEV_RAM=y |
| 35 | CONFIG_BLK_DEV_RAM_SIZE=8192 | 47 | CONFIG_BLK_DEV_RAM_SIZE=8192 |
| 36 | CONFIG_ATMEL_SSC=y | ||
| 37 | CONFIG_SCSI=y | 48 | CONFIG_SCSI=y |
| 38 | CONFIG_BLK_DEV_SD=y | 49 | CONFIG_BLK_DEV_SD=y |
| 39 | CONFIG_SCSI_MULTI_LUN=y | 50 | CONFIG_SCSI_MULTI_LUN=y |
| 40 | CONFIG_NETDEVICES=y | 51 | CONFIG_NETDEVICES=y |
| 41 | CONFIG_NET_ETHERNET=y | ||
| 42 | CONFIG_MII=y | 52 | CONFIG_MII=y |
| 43 | CONFIG_MACB=y | 53 | CONFIG_MACB=y |
| 44 | # CONFIG_INPUT_MOUSEDEV_PSAUX is not set | 54 | # CONFIG_INPUT_MOUSEDEV_PSAUX is not set |
| @@ -55,7 +65,6 @@ CONFIG_I2C_GPIO=y | |||
| 55 | CONFIG_WATCHDOG=y | 65 | CONFIG_WATCHDOG=y |
| 56 | CONFIG_WATCHDOG_NOWAYOUT=y | 66 | CONFIG_WATCHDOG_NOWAYOUT=y |
| 57 | CONFIG_AT91SAM9X_WATCHDOG=y | 67 | CONFIG_AT91SAM9X_WATCHDOG=y |
| 58 | # CONFIG_VGA_CONSOLE is not set | ||
| 59 | # CONFIG_USB_HID is not set | 68 | # CONFIG_USB_HID is not set |
| 60 | CONFIG_USB=y | 69 | CONFIG_USB=y |
| 61 | CONFIG_USB_DEVICEFS=y | 70 | CONFIG_USB_DEVICEFS=y |
| @@ -71,7 +80,6 @@ CONFIG_USB_G_SERIAL=m | |||
| 71 | CONFIG_RTC_CLASS=y | 80 | CONFIG_RTC_CLASS=y |
| 72 | CONFIG_RTC_DRV_AT91SAM9=y | 81 | CONFIG_RTC_DRV_AT91SAM9=y |
| 73 | CONFIG_EXT2_FS=y | 82 | CONFIG_EXT2_FS=y |
| 74 | CONFIG_INOTIFY=y | ||
| 75 | CONFIG_VFAT_FS=y | 83 | CONFIG_VFAT_FS=y |
| 76 | CONFIG_TMPFS=y | 84 | CONFIG_TMPFS=y |
| 77 | CONFIG_CRAMFS=y | 85 | CONFIG_CRAMFS=y |
diff --git a/arch/arm/configs/at91sam9g20ek_defconfig b/arch/arm/configs/at91sam9g20_defconfig index 9e90e6d79297..9123568d9a8d 100644 --- a/arch/arm/configs/at91sam9g20ek_defconfig +++ b/arch/arm/configs/at91sam9g20_defconfig | |||
| @@ -14,6 +14,15 @@ CONFIG_ARCH_AT91=y | |||
| 14 | CONFIG_ARCH_AT91SAM9G20=y | 14 | CONFIG_ARCH_AT91SAM9G20=y |
| 15 | CONFIG_MACH_AT91SAM9G20EK=y | 15 | CONFIG_MACH_AT91SAM9G20EK=y |
| 16 | CONFIG_MACH_AT91SAM9G20EK_2MMC=y | 16 | CONFIG_MACH_AT91SAM9G20EK_2MMC=y |
| 17 | CONFIG_MACH_CPU9G20=y | ||
| 18 | CONFIG_MACH_ACMENETUSFOXG20=y | ||
| 19 | CONFIG_MACH_PORTUXG20=y | ||
| 20 | CONFIG_MACH_STAMP9G20=y | ||
| 21 | CONFIG_MACH_PCONTROL_G20=y | ||
| 22 | CONFIG_MACH_GSIA18S=y | ||
| 23 | CONFIG_MACH_USB_A9G20=y | ||
| 24 | CONFIG_MACH_SNAPPER_9260=y | ||
| 25 | CONFIG_MACH_AT91SAM_DT=y | ||
| 17 | CONFIG_AT91_PROGRAMMABLE_CLOCKS=y | 26 | CONFIG_AT91_PROGRAMMABLE_CLOCKS=y |
| 18 | # CONFIG_ARM_THUMB is not set | 27 | # CONFIG_ARM_THUMB is not set |
| 19 | CONFIG_AEABI=y | 28 | CONFIG_AEABI=y |
| @@ -21,9 +30,10 @@ CONFIG_LEDS=y | |||
| 21 | CONFIG_LEDS_CPU=y | 30 | CONFIG_LEDS_CPU=y |
| 22 | CONFIG_ZBOOT_ROM_TEXT=0x0 | 31 | CONFIG_ZBOOT_ROM_TEXT=0x0 |
| 23 | CONFIG_ZBOOT_ROM_BSS=0x0 | 32 | CONFIG_ZBOOT_ROM_BSS=0x0 |
| 33 | CONFIG_ARM_APPENDED_DTB=y | ||
| 34 | CONFIG_ARM_ATAG_DTB_COMPAT=y | ||
| 24 | CONFIG_CMDLINE="mem=64M console=ttyS0,115200 initrd=0x21100000,3145728 root=/dev/ram0 rw" | 35 | CONFIG_CMDLINE="mem=64M console=ttyS0,115200 initrd=0x21100000,3145728 root=/dev/ram0 rw" |
| 25 | CONFIG_FPE_NWFPE=y | 36 | CONFIG_FPE_NWFPE=y |
| 26 | CONFIG_PM=y | ||
| 27 | CONFIG_NET=y | 37 | CONFIG_NET=y |
| 28 | CONFIG_PACKET=y | 38 | CONFIG_PACKET=y |
| 29 | CONFIG_UNIX=y | 39 | CONFIG_UNIX=y |
| @@ -37,8 +47,6 @@ CONFIG_IP_PNP_BOOTP=y | |||
| 37 | # CONFIG_IPV6 is not set | 47 | # CONFIG_IPV6 is not set |
| 38 | CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" | 48 | CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" |
| 39 | CONFIG_MTD=y | 49 | CONFIG_MTD=y |
| 40 | CONFIG_MTD_CONCAT=y | ||
| 41 | CONFIG_MTD_PARTITIONS=y | ||
| 42 | CONFIG_MTD_CMDLINE_PARTS=y | 50 | CONFIG_MTD_CMDLINE_PARTS=y |
| 43 | CONFIG_MTD_CHAR=y | 51 | CONFIG_MTD_CHAR=y |
| 44 | CONFIG_MTD_BLOCK=y | 52 | CONFIG_MTD_BLOCK=y |
| @@ -48,17 +56,13 @@ CONFIG_MTD_NAND_ATMEL=y | |||
| 48 | CONFIG_BLK_DEV_LOOP=y | 56 | CONFIG_BLK_DEV_LOOP=y |
| 49 | CONFIG_BLK_DEV_RAM=y | 57 | CONFIG_BLK_DEV_RAM=y |
| 50 | CONFIG_BLK_DEV_RAM_SIZE=8192 | 58 | CONFIG_BLK_DEV_RAM_SIZE=8192 |
| 51 | CONFIG_ATMEL_SSC=y | ||
| 52 | CONFIG_SCSI=y | 59 | CONFIG_SCSI=y |
| 53 | CONFIG_BLK_DEV_SD=y | 60 | CONFIG_BLK_DEV_SD=y |
| 54 | CONFIG_SCSI_MULTI_LUN=y | 61 | CONFIG_SCSI_MULTI_LUN=y |
| 55 | # CONFIG_SCSI_LOWLEVEL is not set | 62 | # CONFIG_SCSI_LOWLEVEL is not set |
| 56 | CONFIG_NETDEVICES=y | 63 | CONFIG_NETDEVICES=y |
| 57 | CONFIG_NET_ETHERNET=y | ||
| 58 | CONFIG_MII=y | 64 | CONFIG_MII=y |
| 59 | CONFIG_MACB=y | 65 | CONFIG_MACB=y |
| 60 | # CONFIG_NETDEV_1000 is not set | ||
| 61 | # CONFIG_NETDEV_10000 is not set | ||
| 62 | # CONFIG_INPUT_MOUSEDEV_PSAUX is not set | 66 | # CONFIG_INPUT_MOUSEDEV_PSAUX is not set |
| 63 | CONFIG_INPUT_MOUSEDEV_SCREEN_X=320 | 67 | CONFIG_INPUT_MOUSEDEV_SCREEN_X=320 |
| 64 | CONFIG_INPUT_MOUSEDEV_SCREEN_Y=240 | 68 | CONFIG_INPUT_MOUSEDEV_SCREEN_Y=240 |
| @@ -66,15 +70,14 @@ CONFIG_INPUT_EVDEV=y | |||
| 66 | # CONFIG_KEYBOARD_ATKBD is not set | 70 | # CONFIG_KEYBOARD_ATKBD is not set |
| 67 | CONFIG_KEYBOARD_GPIO=y | 71 | CONFIG_KEYBOARD_GPIO=y |
| 68 | # CONFIG_INPUT_MOUSE is not set | 72 | # CONFIG_INPUT_MOUSE is not set |
| 73 | CONFIG_LEGACY_PTY_COUNT=16 | ||
| 69 | CONFIG_SERIAL_ATMEL=y | 74 | CONFIG_SERIAL_ATMEL=y |
| 70 | CONFIG_SERIAL_ATMEL_CONSOLE=y | 75 | CONFIG_SERIAL_ATMEL_CONSOLE=y |
| 71 | CONFIG_LEGACY_PTY_COUNT=16 | ||
| 72 | CONFIG_HW_RANDOM=y | 76 | CONFIG_HW_RANDOM=y |
| 73 | CONFIG_SPI=y | 77 | CONFIG_SPI=y |
| 74 | CONFIG_SPI_ATMEL=y | 78 | CONFIG_SPI_ATMEL=y |
| 75 | CONFIG_SPI_SPIDEV=y | 79 | CONFIG_SPI_SPIDEV=y |
| 76 | # CONFIG_HWMON is not set | 80 | # CONFIG_HWMON is not set |
| 77 | # CONFIG_VGA_CONSOLE is not set | ||
| 78 | CONFIG_SOUND=y | 81 | CONFIG_SOUND=y |
| 79 | CONFIG_SND=y | 82 | CONFIG_SND=y |
| 80 | CONFIG_SND_SEQUENCER=y | 83 | CONFIG_SND_SEQUENCER=y |
| @@ -82,7 +85,6 @@ CONFIG_SND_MIXER_OSS=y | |||
| 82 | CONFIG_SND_PCM_OSS=y | 85 | CONFIG_SND_PCM_OSS=y |
| 83 | CONFIG_SND_SEQUENCER_OSS=y | 86 | CONFIG_SND_SEQUENCER_OSS=y |
| 84 | # CONFIG_SND_VERBOSE_PROCFS is not set | 87 | # CONFIG_SND_VERBOSE_PROCFS is not set |
| 85 | CONFIG_SND_AT73C213=y | ||
| 86 | CONFIG_USB=y | 88 | CONFIG_USB=y |
| 87 | CONFIG_USB_DEVICEFS=y | 89 | CONFIG_USB_DEVICEFS=y |
| 88 | # CONFIG_USB_DEVICE_CLASS is not set | 90 | # CONFIG_USB_DEVICE_CLASS is not set |
| @@ -105,7 +107,6 @@ CONFIG_LEDS_TRIGGER_HEARTBEAT=y | |||
| 105 | CONFIG_RTC_CLASS=y | 107 | CONFIG_RTC_CLASS=y |
| 106 | CONFIG_RTC_DRV_AT91SAM9=y | 108 | CONFIG_RTC_DRV_AT91SAM9=y |
| 107 | CONFIG_EXT2_FS=y | 109 | CONFIG_EXT2_FS=y |
| 108 | CONFIG_INOTIFY=y | ||
| 109 | CONFIG_MSDOS_FS=y | 110 | CONFIG_MSDOS_FS=y |
| 110 | CONFIG_VFAT_FS=y | 111 | CONFIG_VFAT_FS=y |
| 111 | CONFIG_TMPFS=y | 112 | CONFIG_TMPFS=y |
diff --git a/arch/arm/configs/at91sam9g45_defconfig b/arch/arm/configs/at91sam9g45_defconfig index c5876d244f4b..606d48f3b8f8 100644 --- a/arch/arm/configs/at91sam9g45_defconfig +++ b/arch/arm/configs/at91sam9g45_defconfig | |||
| @@ -18,6 +18,7 @@ CONFIG_MODULE_UNLOAD=y | |||
| 18 | CONFIG_ARCH_AT91=y | 18 | CONFIG_ARCH_AT91=y |
| 19 | CONFIG_ARCH_AT91SAM9G45=y | 19 | CONFIG_ARCH_AT91SAM9G45=y |
| 20 | CONFIG_MACH_AT91SAM9M10G45EK=y | 20 | CONFIG_MACH_AT91SAM9M10G45EK=y |
| 21 | CONFIG_MACH_AT91SAM_DT=y | ||
| 21 | CONFIG_AT91_PROGRAMMABLE_CLOCKS=y | 22 | CONFIG_AT91_PROGRAMMABLE_CLOCKS=y |
| 22 | CONFIG_AT91_SLOW_CLOCK=y | 23 | CONFIG_AT91_SLOW_CLOCK=y |
| 23 | CONFIG_AEABI=y | 24 | CONFIG_AEABI=y |
| @@ -73,11 +74,8 @@ CONFIG_SCSI_MULTI_LUN=y | |||
| 73 | # CONFIG_SCSI_LOWLEVEL is not set | 74 | # CONFIG_SCSI_LOWLEVEL is not set |
| 74 | CONFIG_NETDEVICES=y | 75 | CONFIG_NETDEVICES=y |
| 75 | CONFIG_MII=y | 76 | CONFIG_MII=y |
| 76 | CONFIG_DAVICOM_PHY=y | ||
| 77 | CONFIG_NET_ETHERNET=y | ||
| 78 | CONFIG_MACB=y | 77 | CONFIG_MACB=y |
| 79 | # CONFIG_NETDEV_1000 is not set | 78 | CONFIG_DAVICOM_PHY=y |
| 80 | # CONFIG_NETDEV_10000 is not set | ||
| 81 | CONFIG_LIBERTAS_THINFIRM=m | 79 | CONFIG_LIBERTAS_THINFIRM=m |
| 82 | CONFIG_LIBERTAS_THINFIRM_USB=m | 80 | CONFIG_LIBERTAS_THINFIRM_USB=m |
| 83 | CONFIG_AT76C50X_USB=m | 81 | CONFIG_AT76C50X_USB=m |
| @@ -131,7 +129,6 @@ CONFIG_I2C_GPIO=y | |||
| 131 | CONFIG_SPI=y | 129 | CONFIG_SPI=y |
| 132 | CONFIG_SPI_ATMEL=y | 130 | CONFIG_SPI_ATMEL=y |
| 133 | # CONFIG_HWMON is not set | 131 | # CONFIG_HWMON is not set |
| 134 | # CONFIG_MFD_SUPPORT is not set | ||
| 135 | CONFIG_FB=y | 132 | CONFIG_FB=y |
| 136 | CONFIG_FB_ATMEL=y | 133 | CONFIG_FB_ATMEL=y |
| 137 | CONFIG_FB_UDL=m | 134 | CONFIG_FB_UDL=m |
diff --git a/arch/arm/configs/at91sam9rlek_defconfig b/arch/arm/configs/at91sam9rl_defconfig index 75621e4d03fc..ad562ee64209 100644 --- a/arch/arm/configs/at91sam9rlek_defconfig +++ b/arch/arm/configs/at91sam9rl_defconfig | |||
| @@ -23,8 +23,6 @@ CONFIG_NET=y | |||
| 23 | CONFIG_UNIX=y | 23 | CONFIG_UNIX=y |
| 24 | CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" | 24 | CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" |
| 25 | CONFIG_MTD=y | 25 | CONFIG_MTD=y |
| 26 | CONFIG_MTD_CONCAT=y | ||
| 27 | CONFIG_MTD_PARTITIONS=y | ||
| 28 | CONFIG_MTD_CMDLINE_PARTS=y | 26 | CONFIG_MTD_CMDLINE_PARTS=y |
| 29 | CONFIG_MTD_CHAR=y | 27 | CONFIG_MTD_CHAR=y |
| 30 | CONFIG_MTD_BLOCK=y | 28 | CONFIG_MTD_BLOCK=y |
| @@ -35,7 +33,6 @@ CONFIG_BLK_DEV_LOOP=y | |||
| 35 | CONFIG_BLK_DEV_RAM=y | 33 | CONFIG_BLK_DEV_RAM=y |
| 36 | CONFIG_BLK_DEV_RAM_COUNT=4 | 34 | CONFIG_BLK_DEV_RAM_COUNT=4 |
| 37 | CONFIG_BLK_DEV_RAM_SIZE=24576 | 35 | CONFIG_BLK_DEV_RAM_SIZE=24576 |
| 38 | CONFIG_ATMEL_SSC=y | ||
| 39 | CONFIG_SCSI=y | 36 | CONFIG_SCSI=y |
| 40 | CONFIG_BLK_DEV_SD=y | 37 | CONFIG_BLK_DEV_SD=y |
| 41 | CONFIG_SCSI_MULTI_LUN=y | 38 | CONFIG_SCSI_MULTI_LUN=y |
| @@ -62,13 +59,11 @@ CONFIG_WATCHDOG_NOWAYOUT=y | |||
| 62 | CONFIG_AT91SAM9X_WATCHDOG=y | 59 | CONFIG_AT91SAM9X_WATCHDOG=y |
| 63 | CONFIG_FB=y | 60 | CONFIG_FB=y |
| 64 | CONFIG_FB_ATMEL=y | 61 | CONFIG_FB_ATMEL=y |
| 65 | # CONFIG_VGA_CONSOLE is not set | ||
| 66 | CONFIG_MMC=y | 62 | CONFIG_MMC=y |
| 67 | CONFIG_MMC_AT91=m | 63 | CONFIG_MMC_AT91=m |
| 68 | CONFIG_RTC_CLASS=y | 64 | CONFIG_RTC_CLASS=y |
| 69 | CONFIG_RTC_DRV_AT91SAM9=y | 65 | CONFIG_RTC_DRV_AT91SAM9=y |
| 70 | CONFIG_EXT2_FS=y | 66 | CONFIG_EXT2_FS=y |
| 71 | CONFIG_INOTIFY=y | ||
| 72 | CONFIG_MSDOS_FS=y | 67 | CONFIG_MSDOS_FS=y |
| 73 | CONFIG_VFAT_FS=y | 68 | CONFIG_VFAT_FS=y |
| 74 | CONFIG_TMPFS=y | 69 | CONFIG_TMPFS=y |
diff --git a/arch/arm/configs/ezx_defconfig b/arch/arm/configs/ezx_defconfig index 227a477346ed..d95763d5f0d8 100644 --- a/arch/arm/configs/ezx_defconfig +++ b/arch/arm/configs/ezx_defconfig | |||
| @@ -287,7 +287,7 @@ CONFIG_USB=y | |||
| 287 | # CONFIG_USB_DEVICE_CLASS is not set | 287 | # CONFIG_USB_DEVICE_CLASS is not set |
| 288 | CONFIG_USB_OHCI_HCD=y | 288 | CONFIG_USB_OHCI_HCD=y |
| 289 | CONFIG_USB_GADGET=y | 289 | CONFIG_USB_GADGET=y |
| 290 | CONFIG_USB_GADGET_PXA27X=y | 290 | CONFIG_USB_PXA27X=y |
| 291 | CONFIG_USB_ETH=m | 291 | CONFIG_USB_ETH=m |
| 292 | # CONFIG_USB_ETH_RNDIS is not set | 292 | # CONFIG_USB_ETH_RNDIS is not set |
| 293 | CONFIG_MMC=y | 293 | CONFIG_MMC=y |
diff --git a/arch/arm/configs/imote2_defconfig b/arch/arm/configs/imote2_defconfig index 176ec22af034..fd996bb13022 100644 --- a/arch/arm/configs/imote2_defconfig +++ b/arch/arm/configs/imote2_defconfig | |||
| @@ -263,7 +263,7 @@ CONFIG_USB=y | |||
| 263 | # CONFIG_USB_DEVICE_CLASS is not set | 263 | # CONFIG_USB_DEVICE_CLASS is not set |
| 264 | CONFIG_USB_OHCI_HCD=y | 264 | CONFIG_USB_OHCI_HCD=y |
| 265 | CONFIG_USB_GADGET=y | 265 | CONFIG_USB_GADGET=y |
| 266 | CONFIG_USB_GADGET_PXA27X=y | 266 | CONFIG_USB_PXA27X=y |
| 267 | CONFIG_USB_ETH=m | 267 | CONFIG_USB_ETH=m |
| 268 | # CONFIG_USB_ETH_RNDIS is not set | 268 | # CONFIG_USB_ETH_RNDIS is not set |
| 269 | CONFIG_MMC=y | 269 | CONFIG_MMC=y |
diff --git a/arch/arm/configs/magician_defconfig b/arch/arm/configs/magician_defconfig index a88e64d4e9a5..443675d317e6 100644 --- a/arch/arm/configs/magician_defconfig +++ b/arch/arm/configs/magician_defconfig | |||
| @@ -132,7 +132,7 @@ CONFIG_USB_MON=m | |||
| 132 | CONFIG_USB_OHCI_HCD=y | 132 | CONFIG_USB_OHCI_HCD=y |
| 133 | CONFIG_USB_GADGET=y | 133 | CONFIG_USB_GADGET=y |
| 134 | CONFIG_USB_GADGET_VBUS_DRAW=500 | 134 | CONFIG_USB_GADGET_VBUS_DRAW=500 |
| 135 | CONFIG_USB_GADGET_PXA27X=y | 135 | CONFIG_USB_PXA27X=y |
| 136 | CONFIG_USB_ETH=m | 136 | CONFIG_USB_ETH=m |
| 137 | # CONFIG_USB_ETH_RNDIS is not set | 137 | # CONFIG_USB_ETH_RNDIS is not set |
| 138 | CONFIG_USB_GADGETFS=m | 138 | CONFIG_USB_GADGETFS=m |
diff --git a/arch/arm/configs/omap1_defconfig b/arch/arm/configs/omap1_defconfig index 7b63462b349d..a7e777581378 100644 --- a/arch/arm/configs/omap1_defconfig +++ b/arch/arm/configs/omap1_defconfig | |||
| @@ -48,7 +48,6 @@ CONFIG_MACH_SX1=y | |||
| 48 | CONFIG_MACH_NOKIA770=y | 48 | CONFIG_MACH_NOKIA770=y |
| 49 | CONFIG_MACH_AMS_DELTA=y | 49 | CONFIG_MACH_AMS_DELTA=y |
| 50 | CONFIG_MACH_OMAP_GENERIC=y | 50 | CONFIG_MACH_OMAP_GENERIC=y |
| 51 | CONFIG_OMAP_CLOCKS_SET_BY_BOOTLOADER=y | ||
| 52 | CONFIG_OMAP_ARM_216MHZ=y | 51 | CONFIG_OMAP_ARM_216MHZ=y |
| 53 | CONFIG_OMAP_ARM_195MHZ=y | 52 | CONFIG_OMAP_ARM_195MHZ=y |
| 54 | CONFIG_OMAP_ARM_192MHZ=y | 53 | CONFIG_OMAP_ARM_192MHZ=y |
diff --git a/arch/arm/configs/u300_defconfig b/arch/arm/configs/u300_defconfig index 4a5a12681be2..374000ec4e4e 100644 --- a/arch/arm/configs/u300_defconfig +++ b/arch/arm/configs/u300_defconfig | |||
| @@ -14,8 +14,6 @@ CONFIG_MODULE_UNLOAD=y | |||
| 14 | CONFIG_ARCH_U300=y | 14 | CONFIG_ARCH_U300=y |
| 15 | CONFIG_MACH_U300=y | 15 | CONFIG_MACH_U300=y |
| 16 | CONFIG_MACH_U300_BS335=y | 16 | CONFIG_MACH_U300_BS335=y |
| 17 | CONFIG_MACH_U300_DUAL_RAM=y | ||
| 18 | CONFIG_U300_DEBUG=y | ||
| 19 | CONFIG_MACH_U300_SPIDUMMY=y | 17 | CONFIG_MACH_U300_SPIDUMMY=y |
| 20 | CONFIG_NO_HZ=y | 18 | CONFIG_NO_HZ=y |
| 21 | CONFIG_HIGH_RES_TIMERS=y | 19 | CONFIG_HIGH_RES_TIMERS=y |
| @@ -26,19 +24,21 @@ CONFIG_ZBOOT_ROM_BSS=0x0 | |||
| 26 | CONFIG_CMDLINE="root=/dev/ram0 rw rootfstype=rootfs console=ttyAMA0,115200n8 lpj=515072" | 24 | CONFIG_CMDLINE="root=/dev/ram0 rw rootfstype=rootfs console=ttyAMA0,115200n8 lpj=515072" |
| 27 | CONFIG_CPU_IDLE=y | 25 | CONFIG_CPU_IDLE=y |
| 28 | CONFIG_FPE_NWFPE=y | 26 | CONFIG_FPE_NWFPE=y |
| 29 | CONFIG_PM=y | ||
| 30 | # CONFIG_SUSPEND is not set | 27 | # CONFIG_SUSPEND is not set |
| 31 | CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" | 28 | CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" |
| 32 | # CONFIG_PREVENT_FIRMWARE_BUILD is not set | 29 | # CONFIG_PREVENT_FIRMWARE_BUILD is not set |
| 33 | # CONFIG_MISC_DEVICES is not set | 30 | CONFIG_MTD=y |
| 31 | CONFIG_MTD_CMDLINE_PARTS=y | ||
| 32 | CONFIG_MTD_NAND=y | ||
| 33 | CONFIG_MTD_NAND_FSMC=y | ||
| 34 | # CONFIG_INPUT_MOUSEDEV is not set | 34 | # CONFIG_INPUT_MOUSEDEV is not set |
| 35 | CONFIG_INPUT_EVDEV=y | 35 | CONFIG_INPUT_EVDEV=y |
| 36 | # CONFIG_KEYBOARD_ATKBD is not set | 36 | # CONFIG_KEYBOARD_ATKBD is not set |
| 37 | # CONFIG_INPUT_MOUSE is not set | 37 | # CONFIG_INPUT_MOUSE is not set |
| 38 | # CONFIG_SERIO is not set | 38 | # CONFIG_SERIO is not set |
| 39 | CONFIG_LEGACY_PTY_COUNT=16 | ||
| 39 | CONFIG_SERIAL_AMBA_PL011=y | 40 | CONFIG_SERIAL_AMBA_PL011=y |
| 40 | CONFIG_SERIAL_AMBA_PL011_CONSOLE=y | 41 | CONFIG_SERIAL_AMBA_PL011_CONSOLE=y |
| 41 | CONFIG_LEGACY_PTY_COUNT=16 | ||
| 42 | # CONFIG_HW_RANDOM is not set | 42 | # CONFIG_HW_RANDOM is not set |
| 43 | CONFIG_I2C=y | 43 | CONFIG_I2C=y |
| 44 | # CONFIG_HWMON is not set | 44 | # CONFIG_HWMON is not set |
| @@ -51,6 +51,7 @@ CONFIG_BACKLIGHT_CLASS_DEVICE=y | |||
| 51 | # CONFIG_HID_SUPPORT is not set | 51 | # CONFIG_HID_SUPPORT is not set |
| 52 | # CONFIG_USB_SUPPORT is not set | 52 | # CONFIG_USB_SUPPORT is not set |
| 53 | CONFIG_MMC=y | 53 | CONFIG_MMC=y |
| 54 | CONFIG_MMC_CLKGATE=y | ||
| 54 | CONFIG_MMC_ARMMMCI=y | 55 | CONFIG_MMC_ARMMMCI=y |
| 55 | CONFIG_RTC_CLASS=y | 56 | CONFIG_RTC_CLASS=y |
| 56 | # CONFIG_RTC_HCTOSYS is not set | 57 | # CONFIG_RTC_HCTOSYS is not set |
| @@ -65,10 +66,8 @@ CONFIG_NLS_CODEPAGE_437=y | |||
| 65 | CONFIG_NLS_ISO8859_1=y | 66 | CONFIG_NLS_ISO8859_1=y |
| 66 | CONFIG_PRINTK_TIME=y | 67 | CONFIG_PRINTK_TIME=y |
| 67 | CONFIG_DEBUG_FS=y | 68 | CONFIG_DEBUG_FS=y |
| 68 | CONFIG_DEBUG_KERNEL=y | ||
| 69 | # CONFIG_SCHED_DEBUG is not set | 69 | # CONFIG_SCHED_DEBUG is not set |
| 70 | CONFIG_TIMER_STATS=y | 70 | CONFIG_TIMER_STATS=y |
| 71 | # CONFIG_DEBUG_PREEMPT is not set | 71 | # CONFIG_DEBUG_PREEMPT is not set |
| 72 | CONFIG_DEBUG_INFO=y | 72 | CONFIG_DEBUG_INFO=y |
| 73 | # CONFIG_RCU_CPU_STALL_DETECTOR is not set | ||
| 74 | # CONFIG_CRC32 is not set | 73 | # CONFIG_CRC32 is not set |
diff --git a/arch/arm/configs/u8500_defconfig b/arch/arm/configs/u8500_defconfig index 97d31a4663da..2d7b6e7b7271 100644 --- a/arch/arm/configs/u8500_defconfig +++ b/arch/arm/configs/u8500_defconfig | |||
| @@ -10,7 +10,7 @@ CONFIG_MODULE_UNLOAD=y | |||
| 10 | CONFIG_ARCH_U8500=y | 10 | CONFIG_ARCH_U8500=y |
| 11 | CONFIG_UX500_SOC_DB5500=y | 11 | CONFIG_UX500_SOC_DB5500=y |
| 12 | CONFIG_UX500_SOC_DB8500=y | 12 | CONFIG_UX500_SOC_DB8500=y |
| 13 | CONFIG_MACH_U8500=y | 13 | CONFIG_MACH_HREFV60=y |
| 14 | CONFIG_MACH_SNOWBALL=y | 14 | CONFIG_MACH_SNOWBALL=y |
| 15 | CONFIG_MACH_U5500=y | 15 | CONFIG_MACH_U5500=y |
| 16 | CONFIG_NO_HZ=y | 16 | CONFIG_NO_HZ=y |
| @@ -24,6 +24,7 @@ CONFIG_CPU_FREQ=y | |||
| 24 | CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y | 24 | CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y |
| 25 | CONFIG_VFP=y | 25 | CONFIG_VFP=y |
| 26 | CONFIG_NEON=y | 26 | CONFIG_NEON=y |
| 27 | CONFIG_PM_RUNTIME=y | ||
| 27 | CONFIG_NET=y | 28 | CONFIG_NET=y |
| 28 | CONFIG_PACKET=y | 29 | CONFIG_PACKET=y |
| 29 | CONFIG_UNIX=y | 30 | CONFIG_UNIX=y |
| @@ -41,11 +42,8 @@ CONFIG_MISC_DEVICES=y | |||
| 41 | CONFIG_AB8500_PWM=y | 42 | CONFIG_AB8500_PWM=y |
| 42 | CONFIG_SENSORS_BH1780=y | 43 | CONFIG_SENSORS_BH1780=y |
| 43 | CONFIG_NETDEVICES=y | 44 | CONFIG_NETDEVICES=y |
| 44 | CONFIG_SMSC_PHY=y | ||
| 45 | CONFIG_NET_ETHERNET=y | ||
| 46 | CONFIG_SMSC911X=y | 45 | CONFIG_SMSC911X=y |
| 47 | # CONFIG_NETDEV_1000 is not set | 46 | CONFIG_SMSC_PHY=y |
| 48 | # CONFIG_NETDEV_10000 is not set | ||
| 49 | # CONFIG_WLAN is not set | 47 | # CONFIG_WLAN is not set |
| 50 | # CONFIG_INPUT_MOUSEDEV_PSAUX is not set | 48 | # CONFIG_INPUT_MOUSEDEV_PSAUX is not set |
| 51 | CONFIG_INPUT_EVDEV=y | 49 | CONFIG_INPUT_EVDEV=y |
| @@ -72,15 +70,12 @@ CONFIG_SPI=y | |||
| 72 | CONFIG_SPI_PL022=y | 70 | CONFIG_SPI_PL022=y |
| 73 | CONFIG_GPIO_STMPE=y | 71 | CONFIG_GPIO_STMPE=y |
| 74 | CONFIG_GPIO_TC3589X=y | 72 | CONFIG_GPIO_TC3589X=y |
| 75 | # CONFIG_HWMON is not set | ||
| 76 | CONFIG_MFD_STMPE=y | 73 | CONFIG_MFD_STMPE=y |
| 77 | CONFIG_MFD_TC3589X=y | 74 | CONFIG_MFD_TC3589X=y |
| 75 | CONFIG_AB5500_CORE=y | ||
| 78 | CONFIG_AB8500_CORE=y | 76 | CONFIG_AB8500_CORE=y |
| 79 | CONFIG_REGULATOR_AB8500=y | 77 | CONFIG_REGULATOR_AB8500=y |
| 80 | # CONFIG_HID_SUPPORT is not set | 78 | # CONFIG_HID_SUPPORT is not set |
| 81 | CONFIG_USB_MUSB_HDRC=y | ||
| 82 | CONFIG_USB_GADGET_MUSB_HDRC=y | ||
| 83 | CONFIG_MUSB_PIO_ONLY=y | ||
| 84 | CONFIG_USB_GADGET=y | 79 | CONFIG_USB_GADGET=y |
| 85 | CONFIG_AB8500_USB=y | 80 | CONFIG_AB8500_USB=y |
| 86 | CONFIG_MMC=y | 81 | CONFIG_MMC=y |
| @@ -97,6 +92,7 @@ CONFIG_DMADEVICES=y | |||
| 97 | CONFIG_STE_DMA40=y | 92 | CONFIG_STE_DMA40=y |
| 98 | CONFIG_STAGING=y | 93 | CONFIG_STAGING=y |
| 99 | CONFIG_TOUCHSCREEN_SYNAPTICS_I2C_RMI4=y | 94 | CONFIG_TOUCHSCREEN_SYNAPTICS_I2C_RMI4=y |
| 95 | CONFIG_HSEM_U8500=y | ||
| 100 | CONFIG_EXT2_FS=y | 96 | CONFIG_EXT2_FS=y |
| 101 | CONFIG_EXT2_FS_XATTR=y | 97 | CONFIG_EXT2_FS_XATTR=y |
| 102 | CONFIG_EXT2_FS_POSIX_ACL=y | 98 | CONFIG_EXT2_FS_POSIX_ACL=y |
diff --git a/arch/arm/configs/zeus_defconfig b/arch/arm/configs/zeus_defconfig index 59577ad3f4ef..547a3c1e59db 100644 --- a/arch/arm/configs/zeus_defconfig +++ b/arch/arm/configs/zeus_defconfig | |||
| @@ -140,7 +140,7 @@ CONFIG_USB_SERIAL=m | |||
| 140 | CONFIG_USB_SERIAL_GENERIC=y | 140 | CONFIG_USB_SERIAL_GENERIC=y |
| 141 | CONFIG_USB_SERIAL_MCT_U232=m | 141 | CONFIG_USB_SERIAL_MCT_U232=m |
| 142 | CONFIG_USB_GADGET=m | 142 | CONFIG_USB_GADGET=m |
| 143 | CONFIG_USB_GADGET_PXA27X=y | 143 | CONFIG_USB_PXA27X=y |
| 144 | CONFIG_USB_ETH=m | 144 | CONFIG_USB_ETH=m |
| 145 | CONFIG_USB_GADGETFS=m | 145 | CONFIG_USB_GADGETFS=m |
| 146 | CONFIG_USB_FILE_STORAGE=m | 146 | CONFIG_USB_FILE_STORAGE=m |
diff --git a/arch/arm/include/asm/pmu.h b/arch/arm/include/asm/pmu.h index 71d99b83cdb9..0bda22c094a6 100644 --- a/arch/arm/include/asm/pmu.h +++ b/arch/arm/include/asm/pmu.h | |||
| @@ -55,16 +55,6 @@ reserve_pmu(enum arm_pmu_type type); | |||
| 55 | extern void | 55 | extern void |
| 56 | release_pmu(enum arm_pmu_type type); | 56 | release_pmu(enum arm_pmu_type type); |
| 57 | 57 | ||
| 58 | /** | ||
| 59 | * init_pmu() - Initialise the PMU. | ||
| 60 | * | ||
| 61 | * Initialise the system ready for PMU enabling. This should typically set the | ||
| 62 | * IRQ affinity and nothing else. The users (oprofile/perf events etc) will do | ||
| 63 | * the actual hardware initialisation. | ||
| 64 | */ | ||
| 65 | extern int | ||
| 66 | init_pmu(enum arm_pmu_type type); | ||
| 67 | |||
| 68 | #else /* CONFIG_CPU_HAS_PMU */ | 58 | #else /* CONFIG_CPU_HAS_PMU */ |
| 69 | 59 | ||
| 70 | #include <linux/err.h> | 60 | #include <linux/err.h> |
diff --git a/arch/arm/include/asm/topology.h b/arch/arm/include/asm/topology.h index a7e457ed27c3..58b8b84adcd2 100644 --- a/arch/arm/include/asm/topology.h +++ b/arch/arm/include/asm/topology.h | |||
| @@ -25,7 +25,7 @@ extern struct cputopo_arm cpu_topology[NR_CPUS]; | |||
| 25 | 25 | ||
| 26 | void init_cpu_topology(void); | 26 | void init_cpu_topology(void); |
| 27 | void store_cpu_topology(unsigned int cpuid); | 27 | void store_cpu_topology(unsigned int cpuid); |
| 28 | const struct cpumask *cpu_coregroup_mask(unsigned int cpu); | 28 | const struct cpumask *cpu_coregroup_mask(int cpu); |
| 29 | 29 | ||
| 30 | #else | 30 | #else |
| 31 | 31 | ||
diff --git a/arch/arm/kernel/entry-armv.S b/arch/arm/kernel/entry-armv.S index 9ad50c4208ae..b145f16c91bc 100644 --- a/arch/arm/kernel/entry-armv.S +++ b/arch/arm/kernel/entry-armv.S | |||
| @@ -497,7 +497,7 @@ ENDPROC(__und_usr) | |||
| 497 | .popsection | 497 | .popsection |
| 498 | .pushsection __ex_table,"a" | 498 | .pushsection __ex_table,"a" |
| 499 | .long 1b, 4b | 499 | .long 1b, 4b |
| 500 | #if __LINUX_ARM_ARCH__ >= 7 | 500 | #if CONFIG_ARM_THUMB && __LINUX_ARM_ARCH__ >= 6 && CONFIG_CPU_V7 |
| 501 | .long 2b, 4b | 501 | .long 2b, 4b |
| 502 | .long 3b, 4b | 502 | .long 3b, 4b |
| 503 | #endif | 503 | #endif |
diff --git a/arch/arm/kernel/kprobes-arm.c b/arch/arm/kernel/kprobes-arm.c index 9fe8910308af..8a30c89da70e 100644 --- a/arch/arm/kernel/kprobes-arm.c +++ b/arch/arm/kernel/kprobes-arm.c | |||
| @@ -519,10 +519,12 @@ static const union decode_item arm_cccc_0000_____1001_table[] = { | |||
| 519 | static const union decode_item arm_cccc_0001_____1001_table[] = { | 519 | static const union decode_item arm_cccc_0001_____1001_table[] = { |
| 520 | /* Synchronization primitives */ | 520 | /* Synchronization primitives */ |
| 521 | 521 | ||
| 522 | #if __LINUX_ARM_ARCH__ < 6 | ||
| 523 | /* Deprecated on ARMv6 and may be UNDEFINED on v7 */ | ||
| 522 | /* SMP/SWPB cccc 0001 0x00 xxxx xxxx xxxx 1001 xxxx */ | 524 | /* SMP/SWPB cccc 0001 0x00 xxxx xxxx xxxx 1001 xxxx */ |
| 523 | DECODE_EMULATEX (0x0fb000f0, 0x01000090, emulate_rd12rn16rm0_rwflags_nopc, | 525 | DECODE_EMULATEX (0x0fb000f0, 0x01000090, emulate_rd12rn16rm0_rwflags_nopc, |
| 524 | REGS(NOPC, NOPC, 0, 0, NOPC)), | 526 | REGS(NOPC, NOPC, 0, 0, NOPC)), |
| 525 | 527 | #endif | |
| 526 | /* LDREX/STREX{,D,B,H} cccc 0001 1xxx xxxx xxxx xxxx 1001 xxxx */ | 528 | /* LDREX/STREX{,D,B,H} cccc 0001 1xxx xxxx xxxx xxxx 1001 xxxx */ |
| 527 | /* And unallocated instructions... */ | 529 | /* And unallocated instructions... */ |
| 528 | DECODE_END | 530 | DECODE_END |
diff --git a/arch/arm/kernel/kprobes-test-arm.c b/arch/arm/kernel/kprobes-test-arm.c index fc82de8bdcce..ba32b393b3f0 100644 --- a/arch/arm/kernel/kprobes-test-arm.c +++ b/arch/arm/kernel/kprobes-test-arm.c | |||
| @@ -427,18 +427,25 @@ void kprobe_arm_test_cases(void) | |||
| 427 | 427 | ||
| 428 | TEST_GROUP("Synchronization primitives") | 428 | TEST_GROUP("Synchronization primitives") |
| 429 | 429 | ||
| 430 | /* | 430 | #if __LINUX_ARM_ARCH__ < 6 |
| 431 | * Use hard coded constants for SWP instructions to avoid warnings | 431 | TEST_RP("swp lr, r",7,VAL2,", [r",8,0,"]") |
| 432 | * about deprecated instructions. | 432 | TEST_R( "swpvs r0, r",1,VAL1,", [sp]") |
| 433 | */ | 433 | TEST_RP("swp sp, r",14,VAL2,", [r",12,13*4,"]") |
| 434 | TEST_RP( ".word 0xe108e097 @ swp lr, r",7,VAL2,", [r",8,0,"]") | 434 | #else |
| 435 | TEST_R( ".word 0x610d0091 @ swpvs r0, r",1,VAL1,", [sp]") | 435 | TEST_UNSUPPORTED(".word 0xe108e097 @ swp lr, r7, [r8]") |
| 436 | TEST_RP( ".word 0xe10cd09e @ swp sp, r",14,VAL2,", [r",12,13*4,"]") | 436 | TEST_UNSUPPORTED(".word 0x610d0091 @ swpvs r0, r1, [sp]") |
| 437 | TEST_UNSUPPORTED(".word 0xe10cd09e @ swp sp, r14 [r12]") | ||
| 438 | #endif | ||
| 437 | TEST_UNSUPPORTED(".word 0xe102f091 @ swp pc, r1, [r2]") | 439 | TEST_UNSUPPORTED(".word 0xe102f091 @ swp pc, r1, [r2]") |
| 438 | TEST_UNSUPPORTED(".word 0xe102009f @ swp r0, pc, [r2]") | 440 | TEST_UNSUPPORTED(".word 0xe102009f @ swp r0, pc, [r2]") |
| 439 | TEST_UNSUPPORTED(".word 0xe10f0091 @ swp r0, r1, [pc]") | 441 | TEST_UNSUPPORTED(".word 0xe10f0091 @ swp r0, r1, [pc]") |
| 440 | TEST_RP( ".word 0xe148e097 @ swpb lr, r",7,VAL2,", [r",8,0,"]") | 442 | #if __LINUX_ARM_ARCH__ < 6 |
| 441 | TEST_R( ".word 0x614d0091 @ swpvsb r0, r",1,VAL1,", [sp]") | 443 | TEST_RP("swpb lr, r",7,VAL2,", [r",8,0,"]") |
| 444 | TEST_R( "swpvsb r0, r",1,VAL1,", [sp]") | ||
| 445 | #else | ||
| 446 | TEST_UNSUPPORTED(".word 0xe148e097 @ swpb lr, r7, [r8]") | ||
| 447 | TEST_UNSUPPORTED(".word 0x614d0091 @ swpvsb r0, r1, [sp]") | ||
| 448 | #endif | ||
| 442 | TEST_UNSUPPORTED(".word 0xe142f091 @ swpb pc, r1, [r2]") | 449 | TEST_UNSUPPORTED(".word 0xe142f091 @ swpb pc, r1, [r2]") |
| 443 | 450 | ||
| 444 | TEST_UNSUPPORTED(".word 0xe1100090") /* Unallocated space */ | 451 | TEST_UNSUPPORTED(".word 0xe1100090") /* Unallocated space */ |
| @@ -550,7 +557,7 @@ void kprobe_arm_test_cases(void) | |||
| 550 | TEST_RPR( "strccd r",8, VAL2,", [r",13,0, ", r",12,48,"]") | 557 | TEST_RPR( "strccd r",8, VAL2,", [r",13,0, ", r",12,48,"]") |
| 551 | TEST_RPR( "strd r",4, VAL1,", [r",2, 24,", r",3, 48,"]!") | 558 | TEST_RPR( "strd r",4, VAL1,", [r",2, 24,", r",3, 48,"]!") |
| 552 | TEST_RPR( "strcsd r",12,VAL2,", [r",11,48,", -r",10,24,"]!") | 559 | TEST_RPR( "strcsd r",12,VAL2,", [r",11,48,", -r",10,24,"]!") |
| 553 | TEST_RPR( "strd r",2, VAL1,", [r",3, 24,"], r",4,48,"") | 560 | TEST_RPR( "strd r",2, VAL1,", [r",5, 24,"], r",4,48,"") |
| 554 | TEST_RPR( "strd r",10,VAL2,", [r",9, 48,"], -r",7,24,"") | 561 | TEST_RPR( "strd r",10,VAL2,", [r",9, 48,"], -r",7,24,"") |
| 555 | TEST_UNSUPPORTED(".word 0xe1afc0fa @ strd r12, [pc, r10]!") | 562 | TEST_UNSUPPORTED(".word 0xe1afc0fa @ strd r12, [pc, r10]!") |
| 556 | 563 | ||
diff --git a/arch/arm/kernel/kprobes-test-thumb.c b/arch/arm/kernel/kprobes-test-thumb.c index 5e726c31c45a..5d8b85792222 100644 --- a/arch/arm/kernel/kprobes-test-thumb.c +++ b/arch/arm/kernel/kprobes-test-thumb.c | |||
| @@ -222,8 +222,8 @@ void kprobe_thumb16_test_cases(void) | |||
| 222 | DONT_TEST_IN_ITBLOCK( | 222 | DONT_TEST_IN_ITBLOCK( |
| 223 | TEST_BF_R( "cbnz r",0,0, ", 2f") | 223 | TEST_BF_R( "cbnz r",0,0, ", 2f") |
| 224 | TEST_BF_R( "cbz r",2,-1,", 2f") | 224 | TEST_BF_R( "cbz r",2,-1,", 2f") |
| 225 | TEST_BF_RX( "cbnz r",4,1, ", 2f",0x20) | 225 | TEST_BF_RX( "cbnz r",4,1, ", 2f", SPACE_0x20) |
| 226 | TEST_BF_RX( "cbz r",7,0, ", 2f",0x40) | 226 | TEST_BF_RX( "cbz r",7,0, ", 2f", SPACE_0x40) |
| 227 | ) | 227 | ) |
| 228 | TEST_R("sxth r0, r",7, HH1,"") | 228 | TEST_R("sxth r0, r",7, HH1,"") |
| 229 | TEST_R("sxth r7, r",0, HH2,"") | 229 | TEST_R("sxth r7, r",0, HH2,"") |
| @@ -246,7 +246,7 @@ DONT_TEST_IN_ITBLOCK( | |||
| 246 | TESTCASE_START(code) \ | 246 | TESTCASE_START(code) \ |
| 247 | TEST_ARG_PTR(13, offset) \ | 247 | TEST_ARG_PTR(13, offset) \ |
| 248 | TEST_ARG_END("") \ | 248 | TEST_ARG_END("") \ |
| 249 | TEST_BRANCH_F(code,0) \ | 249 | TEST_BRANCH_F(code) \ |
| 250 | TESTCASE_END | 250 | TESTCASE_END |
| 251 | 251 | ||
| 252 | TEST("push {r0}") | 252 | TEST("push {r0}") |
| @@ -319,8 +319,8 @@ CONDITION_INSTRUCTIONS(8, | |||
| 319 | 319 | ||
| 320 | TEST_BF( "b 2f") | 320 | TEST_BF( "b 2f") |
| 321 | TEST_BB( "b 2b") | 321 | TEST_BB( "b 2b") |
| 322 | TEST_BF_X("b 2f", 0x400) | 322 | TEST_BF_X("b 2f", SPACE_0x400) |
| 323 | TEST_BB_X("b 2b", 0x400) | 323 | TEST_BB_X("b 2b", SPACE_0x400) |
| 324 | 324 | ||
| 325 | TEST_GROUP("Testing instructions in IT blocks") | 325 | TEST_GROUP("Testing instructions in IT blocks") |
| 326 | 326 | ||
| @@ -746,7 +746,7 @@ CONDITION_INSTRUCTIONS(22, | |||
| 746 | TEST_BB("bne.w 2b") | 746 | TEST_BB("bne.w 2b") |
| 747 | TEST_BF("bgt.w 2f") | 747 | TEST_BF("bgt.w 2f") |
| 748 | TEST_BB("blt.w 2b") | 748 | TEST_BB("blt.w 2b") |
| 749 | TEST_BF_X("bpl.w 2f",0x1000) | 749 | TEST_BF_X("bpl.w 2f", SPACE_0x1000) |
| 750 | ) | 750 | ) |
| 751 | 751 | ||
| 752 | TEST_UNSUPPORTED("msr cpsr, r0") | 752 | TEST_UNSUPPORTED("msr cpsr, r0") |
| @@ -786,11 +786,11 @@ CONDITION_INSTRUCTIONS(22, | |||
| 786 | 786 | ||
| 787 | TEST_BF( "b.w 2f") | 787 | TEST_BF( "b.w 2f") |
| 788 | TEST_BB( "b.w 2b") | 788 | TEST_BB( "b.w 2b") |
| 789 | TEST_BF_X("b.w 2f", 0x1000) | 789 | TEST_BF_X("b.w 2f", SPACE_0x1000) |
| 790 | 790 | ||
| 791 | TEST_BF( "bl.w 2f") | 791 | TEST_BF( "bl.w 2f") |
| 792 | TEST_BB( "bl.w 2b") | 792 | TEST_BB( "bl.w 2b") |
| 793 | TEST_BB_X("bl.w 2b", 0x1000) | 793 | TEST_BB_X("bl.w 2b", SPACE_0x1000) |
| 794 | 794 | ||
| 795 | TEST_X( "blx __dummy_arm_subroutine", | 795 | TEST_X( "blx __dummy_arm_subroutine", |
| 796 | ".arm \n\t" | 796 | ".arm \n\t" |
diff --git a/arch/arm/kernel/kprobes-test.h b/arch/arm/kernel/kprobes-test.h index 0dc5d77b9356..e28a869b1ae4 100644 --- a/arch/arm/kernel/kprobes-test.h +++ b/arch/arm/kernel/kprobes-test.h | |||
| @@ -149,23 +149,31 @@ struct test_arg_end { | |||
| 149 | "1: "instruction" \n\t" \ | 149 | "1: "instruction" \n\t" \ |
| 150 | " nop \n\t" | 150 | " nop \n\t" |
| 151 | 151 | ||
| 152 | #define TEST_BRANCH_F(instruction, xtra_dist) \ | 152 | #define TEST_BRANCH_F(instruction) \ |
| 153 | TEST_INSTRUCTION(instruction) \ | 153 | TEST_INSTRUCTION(instruction) \ |
| 154 | ".if "#xtra_dist" \n\t" \ | ||
| 155 | " b 99f \n\t" \ | 154 | " b 99f \n\t" \ |
| 156 | ".space "#xtra_dist" \n\t" \ | 155 | "2: nop \n\t" |
| 157 | ".endif \n\t" \ | 156 | |
| 157 | #define TEST_BRANCH_B(instruction) \ | ||
| 158 | " b 50f \n\t" \ | ||
| 159 | " b 99f \n\t" \ | ||
| 160 | "2: nop \n\t" \ | ||
| 161 | " b 99f \n\t" \ | ||
| 162 | TEST_INSTRUCTION(instruction) | ||
| 163 | |||
| 164 | #define TEST_BRANCH_FX(instruction, codex) \ | ||
| 165 | TEST_INSTRUCTION(instruction) \ | ||
| 166 | " b 99f \n\t" \ | ||
| 167 | codex" \n\t" \ | ||
| 158 | " b 99f \n\t" \ | 168 | " b 99f \n\t" \ |
| 159 | "2: nop \n\t" | 169 | "2: nop \n\t" |
| 160 | 170 | ||
| 161 | #define TEST_BRANCH_B(instruction, xtra_dist) \ | 171 | #define TEST_BRANCH_BX(instruction, codex) \ |
| 162 | " b 50f \n\t" \ | 172 | " b 50f \n\t" \ |
| 163 | " b 99f \n\t" \ | 173 | " b 99f \n\t" \ |
| 164 | "2: nop \n\t" \ | 174 | "2: nop \n\t" \ |
| 165 | " b 99f \n\t" \ | 175 | " b 99f \n\t" \ |
| 166 | ".if "#xtra_dist" \n\t" \ | 176 | codex" \n\t" \ |
| 167 | ".space "#xtra_dist" \n\t" \ | ||
| 168 | ".endif \n\t" \ | ||
| 169 | TEST_INSTRUCTION(instruction) | 177 | TEST_INSTRUCTION(instruction) |
| 170 | 178 | ||
| 171 | #define TESTCASE_END \ | 179 | #define TESTCASE_END \ |
| @@ -301,47 +309,60 @@ struct test_arg_end { | |||
| 301 | TESTCASE_START(code1 #reg1 code2) \ | 309 | TESTCASE_START(code1 #reg1 code2) \ |
| 302 | TEST_ARG_PTR(reg1, val1) \ | 310 | TEST_ARG_PTR(reg1, val1) \ |
| 303 | TEST_ARG_END("") \ | 311 | TEST_ARG_END("") \ |
| 304 | TEST_BRANCH_F(code1 #reg1 code2, 0) \ | 312 | TEST_BRANCH_F(code1 #reg1 code2) \ |
| 305 | TESTCASE_END | 313 | TESTCASE_END |
| 306 | 314 | ||
| 307 | #define TEST_BF_X(code, xtra_dist) \ | 315 | #define TEST_BF(code) \ |
| 308 | TESTCASE_START(code) \ | 316 | TESTCASE_START(code) \ |
| 309 | TEST_ARG_END("") \ | 317 | TEST_ARG_END("") \ |
| 310 | TEST_BRANCH_F(code, xtra_dist) \ | 318 | TEST_BRANCH_F(code) \ |
| 311 | TESTCASE_END | 319 | TESTCASE_END |
| 312 | 320 | ||
| 313 | #define TEST_BB_X(code, xtra_dist) \ | 321 | #define TEST_BB(code) \ |
| 314 | TESTCASE_START(code) \ | 322 | TESTCASE_START(code) \ |
| 315 | TEST_ARG_END("") \ | 323 | TEST_ARG_END("") \ |
| 316 | TEST_BRANCH_B(code, xtra_dist) \ | 324 | TEST_BRANCH_B(code) \ |
| 317 | TESTCASE_END | 325 | TESTCASE_END |
| 318 | 326 | ||
| 319 | #define TEST_BF_RX(code1, reg, val, code2, xtra_dist) \ | 327 | #define TEST_BF_R(code1, reg, val, code2) \ |
| 320 | TESTCASE_START(code1 #reg code2) \ | 328 | TESTCASE_START(code1 #reg code2) \ |
| 321 | TEST_ARG_REG(reg, val) \ | 329 | TEST_ARG_REG(reg, val) \ |
| 322 | TEST_ARG_END("") \ | 330 | TEST_ARG_END("") \ |
| 323 | TEST_BRANCH_F(code1 #reg code2, xtra_dist) \ | 331 | TEST_BRANCH_F(code1 #reg code2) \ |
| 324 | TESTCASE_END | 332 | TESTCASE_END |
| 325 | 333 | ||
| 326 | #define TEST_BB_RX(code1, reg, val, code2, xtra_dist) \ | 334 | #define TEST_BB_R(code1, reg, val, code2) \ |
| 327 | TESTCASE_START(code1 #reg code2) \ | 335 | TESTCASE_START(code1 #reg code2) \ |
| 328 | TEST_ARG_REG(reg, val) \ | 336 | TEST_ARG_REG(reg, val) \ |
| 329 | TEST_ARG_END("") \ | 337 | TEST_ARG_END("") \ |
| 330 | TEST_BRANCH_B(code1 #reg code2, xtra_dist) \ | 338 | TEST_BRANCH_B(code1 #reg code2) \ |
| 331 | TESTCASE_END | 339 | TESTCASE_END |
| 332 | 340 | ||
| 333 | #define TEST_BF(code) TEST_BF_X(code, 0) | ||
| 334 | #define TEST_BB(code) TEST_BB_X(code, 0) | ||
| 335 | |||
| 336 | #define TEST_BF_R(code1, reg, val, code2) TEST_BF_RX(code1, reg, val, code2, 0) | ||
| 337 | #define TEST_BB_R(code1, reg, val, code2) TEST_BB_RX(code1, reg, val, code2, 0) | ||
| 338 | |||
| 339 | #define TEST_BF_RR(code1, reg1, val1, code2, reg2, val2, code3) \ | 341 | #define TEST_BF_RR(code1, reg1, val1, code2, reg2, val2, code3) \ |
| 340 | TESTCASE_START(code1 #reg1 code2 #reg2 code3) \ | 342 | TESTCASE_START(code1 #reg1 code2 #reg2 code3) \ |
| 341 | TEST_ARG_REG(reg1, val1) \ | 343 | TEST_ARG_REG(reg1, val1) \ |
| 342 | TEST_ARG_REG(reg2, val2) \ | 344 | TEST_ARG_REG(reg2, val2) \ |
| 343 | TEST_ARG_END("") \ | 345 | TEST_ARG_END("") \ |
| 344 | TEST_BRANCH_F(code1 #reg1 code2 #reg2 code3, 0) \ | 346 | TEST_BRANCH_F(code1 #reg1 code2 #reg2 code3) \ |
| 347 | TESTCASE_END | ||
| 348 | |||
| 349 | #define TEST_BF_X(code, codex) \ | ||
| 350 | TESTCASE_START(code) \ | ||
| 351 | TEST_ARG_END("") \ | ||
| 352 | TEST_BRANCH_FX(code, codex) \ | ||
| 353 | TESTCASE_END | ||
| 354 | |||
| 355 | #define TEST_BB_X(code, codex) \ | ||
| 356 | TESTCASE_START(code) \ | ||
| 357 | TEST_ARG_END("") \ | ||
| 358 | TEST_BRANCH_BX(code, codex) \ | ||
| 359 | TESTCASE_END | ||
| 360 | |||
| 361 | #define TEST_BF_RX(code1, reg, val, code2, codex) \ | ||
| 362 | TESTCASE_START(code1 #reg code2) \ | ||
| 363 | TEST_ARG_REG(reg, val) \ | ||
| 364 | TEST_ARG_END("") \ | ||
| 365 | TEST_BRANCH_FX(code1 #reg code2, codex) \ | ||
| 345 | TESTCASE_END | 366 | TESTCASE_END |
| 346 | 367 | ||
| 347 | #define TEST_X(code, codex) \ | 368 | #define TEST_X(code, codex) \ |
| @@ -372,6 +393,25 @@ struct test_arg_end { | |||
| 372 | TESTCASE_END | 393 | TESTCASE_END |
| 373 | 394 | ||
| 374 | 395 | ||
| 396 | /* | ||
| 397 | * Macros for defining space directives spread over multiple lines. | ||
| 398 | * These are required so the compiler guesses better the length of inline asm | ||
| 399 | * code and will spill the literal pool early enough to avoid generating PC | ||
| 400 | * relative loads with out of range offsets. | ||
| 401 | */ | ||
| 402 | #define TWICE(x) x x | ||
| 403 | #define SPACE_0x8 TWICE(".space 4\n\t") | ||
| 404 | #define SPACE_0x10 TWICE(SPACE_0x8) | ||
| 405 | #define SPACE_0x20 TWICE(SPACE_0x10) | ||
| 406 | #define SPACE_0x40 TWICE(SPACE_0x20) | ||
| 407 | #define SPACE_0x80 TWICE(SPACE_0x40) | ||
| 408 | #define SPACE_0x100 TWICE(SPACE_0x80) | ||
| 409 | #define SPACE_0x200 TWICE(SPACE_0x100) | ||
| 410 | #define SPACE_0x400 TWICE(SPACE_0x200) | ||
| 411 | #define SPACE_0x800 TWICE(SPACE_0x400) | ||
| 412 | #define SPACE_0x1000 TWICE(SPACE_0x800) | ||
| 413 | |||
| 414 | |||
| 375 | /* Various values used in test cases... */ | 415 | /* Various values used in test cases... */ |
| 376 | #define N(val) (val ^ 0xffffffff) | 416 | #define N(val) (val ^ 0xffffffff) |
| 377 | #define VAL1 0x12345678 | 417 | #define VAL1 0x12345678 |
diff --git a/arch/arm/kernel/perf_event.c b/arch/arm/kernel/perf_event.c index 24e2347be6b1..c475379199b1 100644 --- a/arch/arm/kernel/perf_event.c +++ b/arch/arm/kernel/perf_event.c | |||
| @@ -343,8 +343,14 @@ validate_group(struct perf_event *event) | |||
| 343 | { | 343 | { |
| 344 | struct perf_event *sibling, *leader = event->group_leader; | 344 | struct perf_event *sibling, *leader = event->group_leader; |
| 345 | struct pmu_hw_events fake_pmu; | 345 | struct pmu_hw_events fake_pmu; |
| 346 | DECLARE_BITMAP(fake_used_mask, ARMPMU_MAX_HWEVENTS); | ||
| 346 | 347 | ||
| 347 | memset(&fake_pmu, 0, sizeof(fake_pmu)); | 348 | /* |
| 349 | * Initialise the fake PMU. We only need to populate the | ||
| 350 | * used_mask for the purposes of validation. | ||
| 351 | */ | ||
| 352 | memset(fake_used_mask, 0, sizeof(fake_used_mask)); | ||
| 353 | fake_pmu.used_mask = fake_used_mask; | ||
| 348 | 354 | ||
| 349 | if (!validate_event(&fake_pmu, leader)) | 355 | if (!validate_event(&fake_pmu, leader)) |
| 350 | return -ENOSPC; | 356 | return -ENOSPC; |
| @@ -396,6 +402,9 @@ armpmu_reserve_hardware(struct arm_pmu *armpmu) | |||
| 396 | int i, err, irq, irqs; | 402 | int i, err, irq, irqs; |
| 397 | struct platform_device *pmu_device = armpmu->plat_device; | 403 | struct platform_device *pmu_device = armpmu->plat_device; |
| 398 | 404 | ||
| 405 | if (!pmu_device) | ||
| 406 | return -ENODEV; | ||
| 407 | |||
| 399 | err = reserve_pmu(armpmu->type); | 408 | err = reserve_pmu(armpmu->type); |
| 400 | if (err) { | 409 | if (err) { |
| 401 | pr_warning("unable to reserve pmu\n"); | 410 | pr_warning("unable to reserve pmu\n"); |
diff --git a/arch/arm/kernel/pmu.c b/arch/arm/kernel/pmu.c index 2c3407ee8576..2334bf8a650a 100644 --- a/arch/arm/kernel/pmu.c +++ b/arch/arm/kernel/pmu.c | |||
| @@ -33,3 +33,4 @@ release_pmu(enum arm_pmu_type type) | |||
| 33 | { | 33 | { |
| 34 | clear_bit_unlock(type, pmu_lock); | 34 | clear_bit_unlock(type, pmu_lock); |
| 35 | } | 35 | } |
| 36 | EXPORT_SYMBOL_GPL(release_pmu); | ||
diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c index 75316f0dd02a..3d0c6fb74ae4 100644 --- a/arch/arm/kernel/process.c +++ b/arch/arm/kernel/process.c | |||
| @@ -192,6 +192,9 @@ void cpu_idle(void) | |||
| 192 | #endif | 192 | #endif |
| 193 | 193 | ||
| 194 | local_irq_disable(); | 194 | local_irq_disable(); |
| 195 | #ifdef CONFIG_PL310_ERRATA_769419 | ||
| 196 | wmb(); | ||
| 197 | #endif | ||
| 195 | if (hlt_counter) { | 198 | if (hlt_counter) { |
| 196 | local_irq_enable(); | 199 | local_irq_enable(); |
| 197 | cpu_relax(); | 200 | cpu_relax(); |
diff --git a/arch/arm/kernel/topology.c b/arch/arm/kernel/topology.c index 1040c00405d0..8200deaa14f6 100644 --- a/arch/arm/kernel/topology.c +++ b/arch/arm/kernel/topology.c | |||
| @@ -43,7 +43,7 @@ | |||
| 43 | 43 | ||
| 44 | struct cputopo_arm cpu_topology[NR_CPUS]; | 44 | struct cputopo_arm cpu_topology[NR_CPUS]; |
| 45 | 45 | ||
| 46 | const struct cpumask *cpu_coregroup_mask(unsigned int cpu) | 46 | const struct cpumask *cpu_coregroup_mask(int cpu) |
| 47 | { | 47 | { |
| 48 | return &cpu_topology[cpu].core_sibling; | 48 | return &cpu_topology[cpu].core_sibling; |
| 49 | } | 49 | } |
diff --git a/arch/arm/lib/bitops.h b/arch/arm/lib/bitops.h index 10d868a5a481..d6408d1ee543 100644 --- a/arch/arm/lib/bitops.h +++ b/arch/arm/lib/bitops.h | |||
| @@ -1,5 +1,9 @@ | |||
| 1 | #include <asm/unwind.h> | ||
| 2 | |||
| 1 | #if __LINUX_ARM_ARCH__ >= 6 | 3 | #if __LINUX_ARM_ARCH__ >= 6 |
| 2 | .macro bitop, instr | 4 | .macro bitop, name, instr |
| 5 | ENTRY( \name ) | ||
| 6 | UNWIND( .fnstart ) | ||
| 3 | ands ip, r1, #3 | 7 | ands ip, r1, #3 |
| 4 | strneb r1, [ip] @ assert word-aligned | 8 | strneb r1, [ip] @ assert word-aligned |
| 5 | mov r2, #1 | 9 | mov r2, #1 |
| @@ -13,9 +17,13 @@ | |||
| 13 | cmp r0, #0 | 17 | cmp r0, #0 |
| 14 | bne 1b | 18 | bne 1b |
| 15 | bx lr | 19 | bx lr |
| 20 | UNWIND( .fnend ) | ||
| 21 | ENDPROC(\name ) | ||
| 16 | .endm | 22 | .endm |
| 17 | 23 | ||
| 18 | .macro testop, instr, store | 24 | .macro testop, name, instr, store |
| 25 | ENTRY( \name ) | ||
| 26 | UNWIND( .fnstart ) | ||
| 19 | ands ip, r1, #3 | 27 | ands ip, r1, #3 |
| 20 | strneb r1, [ip] @ assert word-aligned | 28 | strneb r1, [ip] @ assert word-aligned |
| 21 | mov r2, #1 | 29 | mov r2, #1 |
| @@ -34,9 +42,13 @@ | |||
| 34 | cmp r0, #0 | 42 | cmp r0, #0 |
| 35 | movne r0, #1 | 43 | movne r0, #1 |
| 36 | 2: bx lr | 44 | 2: bx lr |
| 45 | UNWIND( .fnend ) | ||
| 46 | ENDPROC(\name ) | ||
| 37 | .endm | 47 | .endm |
| 38 | #else | 48 | #else |
| 39 | .macro bitop, instr | 49 | .macro bitop, name, instr |
| 50 | ENTRY( \name ) | ||
| 51 | UNWIND( .fnstart ) | ||
| 40 | ands ip, r1, #3 | 52 | ands ip, r1, #3 |
| 41 | strneb r1, [ip] @ assert word-aligned | 53 | strneb r1, [ip] @ assert word-aligned |
| 42 | and r2, r0, #31 | 54 | and r2, r0, #31 |
| @@ -49,6 +61,8 @@ | |||
| 49 | str r2, [r1, r0, lsl #2] | 61 | str r2, [r1, r0, lsl #2] |
| 50 | restore_irqs ip | 62 | restore_irqs ip |
| 51 | mov pc, lr | 63 | mov pc, lr |
| 64 | UNWIND( .fnend ) | ||
| 65 | ENDPROC(\name ) | ||
| 52 | .endm | 66 | .endm |
| 53 | 67 | ||
| 54 | /** | 68 | /** |
| @@ -59,7 +73,9 @@ | |||
| 59 | * Note: we can trivially conditionalise the store instruction | 73 | * Note: we can trivially conditionalise the store instruction |
| 60 | * to avoid dirtying the data cache. | 74 | * to avoid dirtying the data cache. |
| 61 | */ | 75 | */ |
| 62 | .macro testop, instr, store | 76 | .macro testop, name, instr, store |
| 77 | ENTRY( \name ) | ||
| 78 | UNWIND( .fnstart ) | ||
| 63 | ands ip, r1, #3 | 79 | ands ip, r1, #3 |
| 64 | strneb r1, [ip] @ assert word-aligned | 80 | strneb r1, [ip] @ assert word-aligned |
| 65 | and r3, r0, #31 | 81 | and r3, r0, #31 |
| @@ -73,5 +89,7 @@ | |||
| 73 | moveq r0, #0 | 89 | moveq r0, #0 |
| 74 | restore_irqs ip | 90 | restore_irqs ip |
| 75 | mov pc, lr | 91 | mov pc, lr |
| 92 | UNWIND( .fnend ) | ||
| 93 | ENDPROC(\name ) | ||
| 76 | .endm | 94 | .endm |
| 77 | #endif | 95 | #endif |
diff --git a/arch/arm/lib/changebit.S b/arch/arm/lib/changebit.S index 68ed5b62e839..f4027862172f 100644 --- a/arch/arm/lib/changebit.S +++ b/arch/arm/lib/changebit.S | |||
| @@ -12,6 +12,4 @@ | |||
| 12 | #include "bitops.h" | 12 | #include "bitops.h" |
| 13 | .text | 13 | .text |
| 14 | 14 | ||
| 15 | ENTRY(_change_bit) | 15 | bitop _change_bit, eor |
| 16 | bitop eor | ||
| 17 | ENDPROC(_change_bit) | ||
diff --git a/arch/arm/lib/clearbit.S b/arch/arm/lib/clearbit.S index 4c04c3b51eeb..f6b75fb64d30 100644 --- a/arch/arm/lib/clearbit.S +++ b/arch/arm/lib/clearbit.S | |||
| @@ -12,6 +12,4 @@ | |||
| 12 | #include "bitops.h" | 12 | #include "bitops.h" |
| 13 | .text | 13 | .text |
| 14 | 14 | ||
| 15 | ENTRY(_clear_bit) | 15 | bitop _clear_bit, bic |
| 16 | bitop bic | ||
| 17 | ENDPROC(_clear_bit) | ||
diff --git a/arch/arm/lib/setbit.S b/arch/arm/lib/setbit.S index bbee5c66a23e..618fedae4b37 100644 --- a/arch/arm/lib/setbit.S +++ b/arch/arm/lib/setbit.S | |||
| @@ -12,6 +12,4 @@ | |||
| 12 | #include "bitops.h" | 12 | #include "bitops.h" |
| 13 | .text | 13 | .text |
| 14 | 14 | ||
| 15 | ENTRY(_set_bit) | 15 | bitop _set_bit, orr |
| 16 | bitop orr | ||
| 17 | ENDPROC(_set_bit) | ||
diff --git a/arch/arm/lib/testchangebit.S b/arch/arm/lib/testchangebit.S index 15a4d431f229..4becdc3a59cb 100644 --- a/arch/arm/lib/testchangebit.S +++ b/arch/arm/lib/testchangebit.S | |||
| @@ -12,6 +12,4 @@ | |||
| 12 | #include "bitops.h" | 12 | #include "bitops.h" |
| 13 | .text | 13 | .text |
| 14 | 14 | ||
| 15 | ENTRY(_test_and_change_bit) | 15 | testop _test_and_change_bit, eor, str |
| 16 | testop eor, str | ||
| 17 | ENDPROC(_test_and_change_bit) | ||
diff --git a/arch/arm/lib/testclearbit.S b/arch/arm/lib/testclearbit.S index 521b66b5b95d..918841dcce7a 100644 --- a/arch/arm/lib/testclearbit.S +++ b/arch/arm/lib/testclearbit.S | |||
| @@ -12,6 +12,4 @@ | |||
| 12 | #include "bitops.h" | 12 | #include "bitops.h" |
| 13 | .text | 13 | .text |
| 14 | 14 | ||
| 15 | ENTRY(_test_and_clear_bit) | 15 | testop _test_and_clear_bit, bicne, strne |
| 16 | testop bicne, strne | ||
| 17 | ENDPROC(_test_and_clear_bit) | ||
diff --git a/arch/arm/lib/testsetbit.S b/arch/arm/lib/testsetbit.S index 1c98cc2185bb..8d1b2fe9e487 100644 --- a/arch/arm/lib/testsetbit.S +++ b/arch/arm/lib/testsetbit.S | |||
| @@ -12,6 +12,4 @@ | |||
| 12 | #include "bitops.h" | 12 | #include "bitops.h" |
| 13 | .text | 13 | .text |
| 14 | 14 | ||
| 15 | ENTRY(_test_and_set_bit) | 15 | testop _test_and_set_bit, orreq, streq |
| 16 | testop orreq, streq | ||
| 17 | ENDPROC(_test_and_set_bit) | ||
diff --git a/arch/arm/mach-exynos/cpuidle.c b/arch/arm/mach-exynos/cpuidle.c index 35f6502144ae..4ebb382c5979 100644 --- a/arch/arm/mach-exynos/cpuidle.c +++ b/arch/arm/mach-exynos/cpuidle.c | |||
| @@ -12,6 +12,8 @@ | |||
| 12 | #include <linux/init.h> | 12 | #include <linux/init.h> |
| 13 | #include <linux/cpuidle.h> | 13 | #include <linux/cpuidle.h> |
| 14 | #include <linux/io.h> | 14 | #include <linux/io.h> |
| 15 | #include <linux/export.h> | ||
| 16 | #include <linux/time.h> | ||
| 15 | 17 | ||
| 16 | #include <asm/proc-fns.h> | 18 | #include <asm/proc-fns.h> |
| 17 | 19 | ||
diff --git a/arch/arm/mach-highbank/highbank.c b/arch/arm/mach-highbank/highbank.c index b82dcf08e747..88660d500f5b 100644 --- a/arch/arm/mach-highbank/highbank.c +++ b/arch/arm/mach-highbank/highbank.c | |||
| @@ -22,6 +22,7 @@ | |||
| 22 | #include <linux/of_irq.h> | 22 | #include <linux/of_irq.h> |
| 23 | #include <linux/of_platform.h> | 23 | #include <linux/of_platform.h> |
| 24 | #include <linux/of_address.h> | 24 | #include <linux/of_address.h> |
| 25 | #include <linux/smp.h> | ||
| 25 | 26 | ||
| 26 | #include <asm/cacheflush.h> | 27 | #include <asm/cacheflush.h> |
| 27 | #include <asm/unified.h> | 28 | #include <asm/unified.h> |
| @@ -72,6 +73,9 @@ static void __init highbank_map_io(void) | |||
| 72 | 73 | ||
| 73 | void highbank_set_cpu_jump(int cpu, void *jump_addr) | 74 | void highbank_set_cpu_jump(int cpu, void *jump_addr) |
| 74 | { | 75 | { |
| 76 | #ifdef CONFIG_SMP | ||
| 77 | cpu = cpu_logical_map(cpu); | ||
| 78 | #endif | ||
| 75 | writel(BSYM(virt_to_phys(jump_addr)), HB_JUMP_TABLE_VIRT(cpu)); | 79 | writel(BSYM(virt_to_phys(jump_addr)), HB_JUMP_TABLE_VIRT(cpu)); |
| 76 | __cpuc_flush_dcache_area(HB_JUMP_TABLE_VIRT(cpu), 16); | 80 | __cpuc_flush_dcache_area(HB_JUMP_TABLE_VIRT(cpu), 16); |
| 77 | outer_clean_range(HB_JUMP_TABLE_PHYS(cpu), | 81 | outer_clean_range(HB_JUMP_TABLE_PHYS(cpu), |
diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig index 5f7f9c2a34ae..c44aa974e79c 100644 --- a/arch/arm/mach-imx/Kconfig +++ b/arch/arm/mach-imx/Kconfig | |||
| @@ -10,11 +10,6 @@ config HAVE_IMX_MMDC | |||
| 10 | config HAVE_IMX_SRC | 10 | config HAVE_IMX_SRC |
| 11 | bool | 11 | bool |
| 12 | 12 | ||
| 13 | # | ||
| 14 | # ARCH_MX31 and ARCH_MX35 are left for compatibility | ||
| 15 | # Some usages assume that having one of them implies not having (e.g.) ARCH_MX2. | ||
| 16 | # To easily distinguish good and reviewed from unreviewed usages new (and IMHO | ||
| 17 | # more sensible) names are used: SOC_IMX31 and SOC_IMX35 | ||
| 18 | config ARCH_MX1 | 13 | config ARCH_MX1 |
| 19 | bool | 14 | bool |
| 20 | 15 | ||
| @@ -27,12 +22,6 @@ config ARCH_MX25 | |||
| 27 | config MACH_MX27 | 22 | config MACH_MX27 |
| 28 | bool | 23 | bool |
| 29 | 24 | ||
| 30 | config ARCH_MX31 | ||
| 31 | bool | ||
| 32 | |||
| 33 | config ARCH_MX35 | ||
| 34 | bool | ||
| 35 | |||
| 36 | config SOC_IMX1 | 25 | config SOC_IMX1 |
| 37 | bool | 26 | bool |
| 38 | select ARCH_MX1 | 27 | select ARCH_MX1 |
| @@ -72,7 +61,6 @@ config SOC_IMX31 | |||
| 72 | select CPU_V6 | 61 | select CPU_V6 |
| 73 | select IMX_HAVE_PLATFORM_MXC_RNGA | 62 | select IMX_HAVE_PLATFORM_MXC_RNGA |
| 74 | select ARCH_MXC_AUDMUX_V2 | 63 | select ARCH_MXC_AUDMUX_V2 |
| 75 | select ARCH_MX31 | ||
| 76 | select MXC_AVIC | 64 | select MXC_AVIC |
| 77 | select SMP_ON_UP if SMP | 65 | select SMP_ON_UP if SMP |
| 78 | 66 | ||
| @@ -82,7 +70,6 @@ config SOC_IMX35 | |||
| 82 | select ARCH_MXC_IOMUX_V3 | 70 | select ARCH_MXC_IOMUX_V3 |
| 83 | select ARCH_MXC_AUDMUX_V2 | 71 | select ARCH_MXC_AUDMUX_V2 |
| 84 | select HAVE_EPIT | 72 | select HAVE_EPIT |
| 85 | select ARCH_MX35 | ||
| 86 | select MXC_AVIC | 73 | select MXC_AVIC |
| 87 | select SMP_ON_UP if SMP | 74 | select SMP_ON_UP if SMP |
| 88 | 75 | ||
diff --git a/arch/arm/mach-imx/clock-imx6q.c b/arch/arm/mach-imx/clock-imx6q.c index 613a1b993bff..039a7abb165a 100644 --- a/arch/arm/mach-imx/clock-imx6q.c +++ b/arch/arm/mach-imx/clock-imx6q.c | |||
| @@ -1953,14 +1953,17 @@ static struct map_desc imx6q_clock_desc[] = { | |||
| 1953 | imx_map_entry(MX6Q, ANATOP, MT_DEVICE), | 1953 | imx_map_entry(MX6Q, ANATOP, MT_DEVICE), |
| 1954 | }; | 1954 | }; |
| 1955 | 1955 | ||
| 1956 | void __init imx6q_clock_map_io(void) | ||
| 1957 | { | ||
| 1958 | iotable_init(imx6q_clock_desc, ARRAY_SIZE(imx6q_clock_desc)); | ||
| 1959 | } | ||
| 1960 | |||
| 1956 | int __init mx6q_clocks_init(void) | 1961 | int __init mx6q_clocks_init(void) |
| 1957 | { | 1962 | { |
| 1958 | struct device_node *np; | 1963 | struct device_node *np; |
| 1959 | void __iomem *base; | 1964 | void __iomem *base; |
| 1960 | int i, irq; | 1965 | int i, irq; |
| 1961 | 1966 | ||
| 1962 | iotable_init(imx6q_clock_desc, ARRAY_SIZE(imx6q_clock_desc)); | ||
| 1963 | |||
| 1964 | /* retrieve the freqency of fixed clocks from device tree */ | 1967 | /* retrieve the freqency of fixed clocks from device tree */ |
| 1965 | for_each_compatible_node(np, NULL, "fixed-clock") { | 1968 | for_each_compatible_node(np, NULL, "fixed-clock") { |
| 1966 | u32 rate; | 1969 | u32 rate; |
diff --git a/arch/arm/mach-imx/mach-imx6q.c b/arch/arm/mach-imx/mach-imx6q.c index 8bf5fa349484..9cd860a27af5 100644 --- a/arch/arm/mach-imx/mach-imx6q.c +++ b/arch/arm/mach-imx/mach-imx6q.c | |||
| @@ -34,6 +34,7 @@ static void __init imx6q_map_io(void) | |||
| 34 | { | 34 | { |
| 35 | imx_lluart_map_io(); | 35 | imx_lluart_map_io(); |
| 36 | imx_scu_map_io(); | 36 | imx_scu_map_io(); |
| 37 | imx6q_clock_map_io(); | ||
| 37 | } | 38 | } |
| 38 | 39 | ||
| 39 | static void __init imx6q_gpio_add_irq_domain(struct device_node *np, | 40 | static void __init imx6q_gpio_add_irq_domain(struct device_node *np, |
diff --git a/arch/arm/mach-imx/mm-imx3.c b/arch/arm/mach-imx/mm-imx3.c index 9f0e82ec3398..31807d2a8b7b 100644 --- a/arch/arm/mach-imx/mm-imx3.c +++ b/arch/arm/mach-imx/mm-imx3.c | |||
| @@ -33,29 +33,32 @@ | |||
| 33 | static void imx3_idle(void) | 33 | static void imx3_idle(void) |
| 34 | { | 34 | { |
| 35 | unsigned long reg = 0; | 35 | unsigned long reg = 0; |
| 36 | __asm__ __volatile__( | 36 | |
| 37 | /* disable I and D cache */ | 37 | if (!need_resched()) |
| 38 | "mrc p15, 0, %0, c1, c0, 0\n" | 38 | __asm__ __volatile__( |
| 39 | "bic %0, %0, #0x00001000\n" | 39 | /* disable I and D cache */ |
| 40 | "bic %0, %0, #0x00000004\n" | 40 | "mrc p15, 0, %0, c1, c0, 0\n" |
| 41 | "mcr p15, 0, %0, c1, c0, 0\n" | 41 | "bic %0, %0, #0x00001000\n" |
| 42 | /* invalidate I cache */ | 42 | "bic %0, %0, #0x00000004\n" |
| 43 | "mov %0, #0\n" | 43 | "mcr p15, 0, %0, c1, c0, 0\n" |
| 44 | "mcr p15, 0, %0, c7, c5, 0\n" | 44 | /* invalidate I cache */ |
| 45 | /* clear and invalidate D cache */ | 45 | "mov %0, #0\n" |
| 46 | "mov %0, #0\n" | 46 | "mcr p15, 0, %0, c7, c5, 0\n" |
| 47 | "mcr p15, 0, %0, c7, c14, 0\n" | 47 | /* clear and invalidate D cache */ |
| 48 | /* WFI */ | 48 | "mov %0, #0\n" |
| 49 | "mov %0, #0\n" | 49 | "mcr p15, 0, %0, c7, c14, 0\n" |
| 50 | "mcr p15, 0, %0, c7, c0, 4\n" | 50 | /* WFI */ |
| 51 | "nop\n" "nop\n" "nop\n" "nop\n" | 51 | "mov %0, #0\n" |
| 52 | "nop\n" "nop\n" "nop\n" | 52 | "mcr p15, 0, %0, c7, c0, 4\n" |
| 53 | /* enable I and D cache */ | 53 | "nop\n" "nop\n" "nop\n" "nop\n" |
| 54 | "mrc p15, 0, %0, c1, c0, 0\n" | 54 | "nop\n" "nop\n" "nop\n" |
| 55 | "orr %0, %0, #0x00001000\n" | 55 | /* enable I and D cache */ |
| 56 | "orr %0, %0, #0x00000004\n" | 56 | "mrc p15, 0, %0, c1, c0, 0\n" |
| 57 | "mcr p15, 0, %0, c1, c0, 0\n" | 57 | "orr %0, %0, #0x00001000\n" |
| 58 | : "=r" (reg)); | 58 | "orr %0, %0, #0x00000004\n" |
| 59 | "mcr p15, 0, %0, c1, c0, 0\n" | ||
| 60 | : "=r" (reg)); | ||
| 61 | local_irq_enable(); | ||
| 59 | } | 62 | } |
| 60 | 63 | ||
| 61 | static void __iomem *imx3_ioremap(unsigned long phys_addr, size_t size, | 64 | static void __iomem *imx3_ioremap(unsigned long phys_addr, size_t size, |
| @@ -108,6 +111,7 @@ void imx3_init_l2x0(void) | |||
| 108 | l2x0_init(l2x0_base, 0x00030024, 0x00000000); | 111 | l2x0_init(l2x0_base, 0x00030024, 0x00000000); |
| 109 | } | 112 | } |
| 110 | 113 | ||
| 114 | #ifdef CONFIG_SOC_IMX31 | ||
| 111 | static struct map_desc mx31_io_desc[] __initdata = { | 115 | static struct map_desc mx31_io_desc[] __initdata = { |
| 112 | imx_map_entry(MX31, X_MEMC, MT_DEVICE), | 116 | imx_map_entry(MX31, X_MEMC, MT_DEVICE), |
| 113 | imx_map_entry(MX31, AVIC, MT_DEVICE_NONSHARED), | 117 | imx_map_entry(MX31, AVIC, MT_DEVICE_NONSHARED), |
| @@ -126,33 +130,11 @@ void __init mx31_map_io(void) | |||
| 126 | iotable_init(mx31_io_desc, ARRAY_SIZE(mx31_io_desc)); | 130 | iotable_init(mx31_io_desc, ARRAY_SIZE(mx31_io_desc)); |
| 127 | } | 131 | } |
| 128 | 132 | ||
| 129 | static struct map_desc mx35_io_desc[] __initdata = { | ||
| 130 | imx_map_entry(MX35, X_MEMC, MT_DEVICE), | ||
| 131 | imx_map_entry(MX35, AVIC, MT_DEVICE_NONSHARED), | ||
| 132 | imx_map_entry(MX35, AIPS1, MT_DEVICE_NONSHARED), | ||
| 133 | imx_map_entry(MX35, AIPS2, MT_DEVICE_NONSHARED), | ||
| 134 | imx_map_entry(MX35, SPBA0, MT_DEVICE_NONSHARED), | ||
| 135 | }; | ||
| 136 | |||
| 137 | void __init mx35_map_io(void) | ||
| 138 | { | ||
| 139 | iotable_init(mx35_io_desc, ARRAY_SIZE(mx35_io_desc)); | ||
| 140 | } | ||
| 141 | |||
| 142 | void __init imx31_init_early(void) | 133 | void __init imx31_init_early(void) |
| 143 | { | 134 | { |
| 144 | mxc_set_cpu_type(MXC_CPU_MX31); | 135 | mxc_set_cpu_type(MXC_CPU_MX31); |
| 145 | mxc_arch_reset_init(MX31_IO_ADDRESS(MX31_WDOG_BASE_ADDR)); | 136 | mxc_arch_reset_init(MX31_IO_ADDRESS(MX31_WDOG_BASE_ADDR)); |
| 146 | imx_idle = imx3_idle; | 137 | pm_idle = imx3_idle; |
| 147 | imx_ioremap = imx3_ioremap; | ||
| 148 | } | ||
| 149 | |||
| 150 | void __init imx35_init_early(void) | ||
| 151 | { | ||
| 152 | mxc_set_cpu_type(MXC_CPU_MX35); | ||
| 153 | mxc_iomux_v3_init(MX35_IO_ADDRESS(MX35_IOMUXC_BASE_ADDR)); | ||
| 154 | mxc_arch_reset_init(MX35_IO_ADDRESS(MX35_WDOG_BASE_ADDR)); | ||
| 155 | imx_idle = imx3_idle; | ||
| 156 | imx_ioremap = imx3_ioremap; | 138 | imx_ioremap = imx3_ioremap; |
| 157 | } | 139 | } |
| 158 | 140 | ||
| @@ -161,11 +143,6 @@ void __init mx31_init_irq(void) | |||
| 161 | mxc_init_irq(MX31_IO_ADDRESS(MX31_AVIC_BASE_ADDR)); | 143 | mxc_init_irq(MX31_IO_ADDRESS(MX31_AVIC_BASE_ADDR)); |
| 162 | } | 144 | } |
| 163 | 145 | ||
| 164 | void __init mx35_init_irq(void) | ||
| 165 | { | ||
| 166 | mxc_init_irq(MX35_IO_ADDRESS(MX35_AVIC_BASE_ADDR)); | ||
| 167 | } | ||
| 168 | |||
| 169 | static struct sdma_script_start_addrs imx31_to1_sdma_script __initdata = { | 146 | static struct sdma_script_start_addrs imx31_to1_sdma_script __initdata = { |
| 170 | .per_2_per_addr = 1677, | 147 | .per_2_per_addr = 1677, |
| 171 | }; | 148 | }; |
| @@ -199,6 +176,35 @@ void __init imx31_soc_init(void) | |||
| 199 | 176 | ||
| 200 | imx_add_imx_sdma("imx31-sdma", MX31_SDMA_BASE_ADDR, MX31_INT_SDMA, &imx31_sdma_pdata); | 177 | imx_add_imx_sdma("imx31-sdma", MX31_SDMA_BASE_ADDR, MX31_INT_SDMA, &imx31_sdma_pdata); |
| 201 | } | 178 | } |
| 179 | #endif /* ifdef CONFIG_SOC_IMX31 */ | ||
| 180 | |||
| 181 | #ifdef CONFIG_SOC_IMX35 | ||
| 182 | static struct map_desc mx35_io_desc[] __initdata = { | ||
| 183 | imx_map_entry(MX35, X_MEMC, MT_DEVICE), | ||
| 184 | imx_map_entry(MX35, AVIC, MT_DEVICE_NONSHARED), | ||
| 185 | imx_map_entry(MX35, AIPS1, MT_DEVICE_NONSHARED), | ||
| 186 | imx_map_entry(MX35, AIPS2, MT_DEVICE_NONSHARED), | ||
| 187 | imx_map_entry(MX35, SPBA0, MT_DEVICE_NONSHARED), | ||
| 188 | }; | ||
| 189 | |||
| 190 | void __init mx35_map_io(void) | ||
| 191 | { | ||
| 192 | iotable_init(mx35_io_desc, ARRAY_SIZE(mx35_io_desc)); | ||
| 193 | } | ||
| 194 | |||
| 195 | void __init imx35_init_early(void) | ||
| 196 | { | ||
| 197 | mxc_set_cpu_type(MXC_CPU_MX35); | ||
| 198 | mxc_iomux_v3_init(MX35_IO_ADDRESS(MX35_IOMUXC_BASE_ADDR)); | ||
| 199 | mxc_arch_reset_init(MX35_IO_ADDRESS(MX35_WDOG_BASE_ADDR)); | ||
| 200 | pm_idle = imx3_idle; | ||
| 201 | imx_ioremap = imx3_ioremap; | ||
| 202 | } | ||
| 203 | |||
| 204 | void __init mx35_init_irq(void) | ||
| 205 | { | ||
| 206 | mxc_init_irq(MX35_IO_ADDRESS(MX35_AVIC_BASE_ADDR)); | ||
| 207 | } | ||
| 202 | 208 | ||
| 203 | static struct sdma_script_start_addrs imx35_to1_sdma_script __initdata = { | 209 | static struct sdma_script_start_addrs imx35_to1_sdma_script __initdata = { |
| 204 | .ap_2_ap_addr = 642, | 210 | .ap_2_ap_addr = 642, |
| @@ -254,3 +260,4 @@ void __init imx35_soc_init(void) | |||
| 254 | 260 | ||
| 255 | imx_add_imx_sdma("imx35-sdma", MX35_SDMA_BASE_ADDR, MX35_INT_SDMA, &imx35_sdma_pdata); | 261 | imx_add_imx_sdma("imx35-sdma", MX35_SDMA_BASE_ADDR, MX35_INT_SDMA, &imx35_sdma_pdata); |
| 256 | } | 262 | } |
| 263 | #endif /* ifdef CONFIG_SOC_IMX35 */ | ||
diff --git a/arch/arm/mach-imx/src.c b/arch/arm/mach-imx/src.c index 36cacbd0dcc2..a8e33681b732 100644 --- a/arch/arm/mach-imx/src.c +++ b/arch/arm/mach-imx/src.c | |||
| @@ -14,6 +14,7 @@ | |||
| 14 | #include <linux/io.h> | 14 | #include <linux/io.h> |
| 15 | #include <linux/of.h> | 15 | #include <linux/of.h> |
| 16 | #include <linux/of_address.h> | 16 | #include <linux/of_address.h> |
| 17 | #include <linux/smp.h> | ||
| 17 | #include <asm/unified.h> | 18 | #include <asm/unified.h> |
| 18 | 19 | ||
| 19 | #define SRC_SCR 0x000 | 20 | #define SRC_SCR 0x000 |
| @@ -23,10 +24,15 @@ | |||
| 23 | 24 | ||
| 24 | static void __iomem *src_base; | 25 | static void __iomem *src_base; |
| 25 | 26 | ||
| 27 | #ifndef CONFIG_SMP | ||
| 28 | #define cpu_logical_map(cpu) 0 | ||
| 29 | #endif | ||
| 30 | |||
| 26 | void imx_enable_cpu(int cpu, bool enable) | 31 | void imx_enable_cpu(int cpu, bool enable) |
| 27 | { | 32 | { |
| 28 | u32 mask, val; | 33 | u32 mask, val; |
| 29 | 34 | ||
| 35 | cpu = cpu_logical_map(cpu); | ||
| 30 | mask = 1 << (BP_SRC_SCR_CORE1_ENABLE + cpu - 1); | 36 | mask = 1 << (BP_SRC_SCR_CORE1_ENABLE + cpu - 1); |
| 31 | val = readl_relaxed(src_base + SRC_SCR); | 37 | val = readl_relaxed(src_base + SRC_SCR); |
| 32 | val = enable ? val | mask : val & ~mask; | 38 | val = enable ? val | mask : val & ~mask; |
| @@ -35,6 +41,7 @@ void imx_enable_cpu(int cpu, bool enable) | |||
| 35 | 41 | ||
| 36 | void imx_set_cpu_jump(int cpu, void *jump_addr) | 42 | void imx_set_cpu_jump(int cpu, void *jump_addr) |
| 37 | { | 43 | { |
| 44 | cpu = cpu_logical_map(cpu); | ||
| 38 | writel_relaxed(BSYM(virt_to_phys(jump_addr)), | 45 | writel_relaxed(BSYM(virt_to_phys(jump_addr)), |
| 39 | src_base + SRC_GPR1 + cpu * 8); | 46 | src_base + SRC_GPR1 + cpu * 8); |
| 40 | } | 47 | } |
diff --git a/arch/arm/mach-mmp/gplugd.c b/arch/arm/mach-mmp/gplugd.c index 69156568bc41..4665767a4f79 100644 --- a/arch/arm/mach-mmp/gplugd.c +++ b/arch/arm/mach-mmp/gplugd.c | |||
| @@ -182,7 +182,7 @@ static void __init gplugd_init(void) | |||
| 182 | 182 | ||
| 183 | /* on-chip devices */ | 183 | /* on-chip devices */ |
| 184 | pxa168_add_uart(3); | 184 | pxa168_add_uart(3); |
| 185 | pxa168_add_ssp(0); | 185 | pxa168_add_ssp(1); |
| 186 | pxa168_add_twsi(0, NULL, ARRAY_AND_SIZE(gplugd_i2c_board_info)); | 186 | pxa168_add_twsi(0, NULL, ARRAY_AND_SIZE(gplugd_i2c_board_info)); |
| 187 | 187 | ||
| 188 | pxa168_add_eth(&gplugd_eth_platform_data); | 188 | pxa168_add_eth(&gplugd_eth_platform_data); |
diff --git a/arch/arm/mach-mmp/include/mach/gpio-pxa.h b/arch/arm/mach-mmp/include/mach/gpio-pxa.h index d14eeaf16322..99b4ce1b6562 100644 --- a/arch/arm/mach-mmp/include/mach/gpio-pxa.h +++ b/arch/arm/mach-mmp/include/mach/gpio-pxa.h | |||
| @@ -7,7 +7,7 @@ | |||
| 7 | #define GPIO_REGS_VIRT (APB_VIRT_BASE + 0x19000) | 7 | #define GPIO_REGS_VIRT (APB_VIRT_BASE + 0x19000) |
| 8 | 8 | ||
| 9 | #define BANK_OFF(n) (((n) < 3) ? (n) << 2 : 0x100 + (((n) - 3) << 2)) | 9 | #define BANK_OFF(n) (((n) < 3) ? (n) << 2 : 0x100 + (((n) - 3) << 2)) |
| 10 | #define GPIO_REG(x) (GPIO_REGS_VIRT + (x)) | 10 | #define GPIO_REG(x) (*(volatile u32 *)(GPIO_REGS_VIRT + (x))) |
| 11 | 11 | ||
| 12 | #define NR_BUILTIN_GPIO IRQ_GPIO_NUM | 12 | #define NR_BUILTIN_GPIO IRQ_GPIO_NUM |
| 13 | 13 | ||
diff --git a/arch/arm/mach-mx5/cpu.c b/arch/arm/mach-mx5/cpu.c index 5c5328257dca..5e2e7a843860 100644 --- a/arch/arm/mach-mx5/cpu.c +++ b/arch/arm/mach-mx5/cpu.c | |||
| @@ -16,7 +16,7 @@ | |||
| 16 | #include <linux/init.h> | 16 | #include <linux/init.h> |
| 17 | #include <linux/module.h> | 17 | #include <linux/module.h> |
| 18 | #include <mach/hardware.h> | 18 | #include <mach/hardware.h> |
| 19 | #include <asm/io.h> | 19 | #include <linux/io.h> |
| 20 | 20 | ||
| 21 | static int mx5_cpu_rev = -1; | 21 | static int mx5_cpu_rev = -1; |
| 22 | 22 | ||
| @@ -67,7 +67,8 @@ static int __init mx51_neon_fixup(void) | |||
| 67 | if (!cpu_is_mx51()) | 67 | if (!cpu_is_mx51()) |
| 68 | return 0; | 68 | return 0; |
| 69 | 69 | ||
| 70 | if (mx51_revision() < IMX_CHIP_REVISION_3_0 && (elf_hwcap & HWCAP_NEON)) { | 70 | if (mx51_revision() < IMX_CHIP_REVISION_3_0 && |
| 71 | (elf_hwcap & HWCAP_NEON)) { | ||
| 71 | elf_hwcap &= ~HWCAP_NEON; | 72 | elf_hwcap &= ~HWCAP_NEON; |
| 72 | pr_info("Turning off NEON support, detected broken NEON implementation\n"); | 73 | pr_info("Turning off NEON support, detected broken NEON implementation\n"); |
| 73 | } | 74 | } |
diff --git a/arch/arm/mach-mx5/mm.c b/arch/arm/mach-mx5/mm.c index 26eacc9d0d90..df4a508f240a 100644 --- a/arch/arm/mach-mx5/mm.c +++ b/arch/arm/mach-mx5/mm.c | |||
| @@ -23,7 +23,9 @@ | |||
| 23 | 23 | ||
| 24 | static void imx5_idle(void) | 24 | static void imx5_idle(void) |
| 25 | { | 25 | { |
| 26 | mx5_cpu_lp_set(WAIT_UNCLOCKED_POWER_OFF); | 26 | if (!need_resched()) |
| 27 | mx5_cpu_lp_set(WAIT_UNCLOCKED_POWER_OFF); | ||
| 28 | local_irq_enable(); | ||
| 27 | } | 29 | } |
| 28 | 30 | ||
| 29 | /* | 31 | /* |
| @@ -89,7 +91,7 @@ void __init imx51_init_early(void) | |||
| 89 | mxc_set_cpu_type(MXC_CPU_MX51); | 91 | mxc_set_cpu_type(MXC_CPU_MX51); |
| 90 | mxc_iomux_v3_init(MX51_IO_ADDRESS(MX51_IOMUXC_BASE_ADDR)); | 92 | mxc_iomux_v3_init(MX51_IO_ADDRESS(MX51_IOMUXC_BASE_ADDR)); |
| 91 | mxc_arch_reset_init(MX51_IO_ADDRESS(MX51_WDOG1_BASE_ADDR)); | 93 | mxc_arch_reset_init(MX51_IO_ADDRESS(MX51_WDOG1_BASE_ADDR)); |
| 92 | imx_idle = imx5_idle; | 94 | pm_idle = imx5_idle; |
| 93 | } | 95 | } |
| 94 | 96 | ||
| 95 | void __init imx53_init_early(void) | 97 | void __init imx53_init_early(void) |
diff --git a/arch/arm/mach-mxs/clock-mx28.c b/arch/arm/mach-mxs/clock-mx28.c index 229ae3494216..da6e4aad177c 100644 --- a/arch/arm/mach-mxs/clock-mx28.c +++ b/arch/arm/mach-mxs/clock-mx28.c | |||
| @@ -404,7 +404,7 @@ static int name##_set_rate(struct clk *clk, unsigned long rate) \ | |||
| 404 | reg = __raw_readl(CLKCTRL_BASE_ADDR + HW_CLKCTRL_##dr); \ | 404 | reg = __raw_readl(CLKCTRL_BASE_ADDR + HW_CLKCTRL_##dr); \ |
| 405 | reg &= ~BM_CLKCTRL_##dr##_DIV; \ | 405 | reg &= ~BM_CLKCTRL_##dr##_DIV; \ |
| 406 | reg |= div << BP_CLKCTRL_##dr##_DIV; \ | 406 | reg |= div << BP_CLKCTRL_##dr##_DIV; \ |
| 407 | if (reg | (1 << clk->enable_shift)) { \ | 407 | if (reg & (1 << clk->enable_shift)) { \ |
| 408 | pr_err("%s: clock is gated\n", __func__); \ | 408 | pr_err("%s: clock is gated\n", __func__); \ |
| 409 | return -EINVAL; \ | 409 | return -EINVAL; \ |
| 410 | } \ | 410 | } \ |
diff --git a/arch/arm/mach-omap1/Kconfig b/arch/arm/mach-omap1/Kconfig index e0a028161dde..73f287d6429b 100644 --- a/arch/arm/mach-omap1/Kconfig +++ b/arch/arm/mach-omap1/Kconfig | |||
| @@ -171,14 +171,6 @@ config MACH_OMAP_GENERIC | |||
| 171 | comment "OMAP CPU Speed" | 171 | comment "OMAP CPU Speed" |
| 172 | depends on ARCH_OMAP1 | 172 | depends on ARCH_OMAP1 |
| 173 | 173 | ||
| 174 | config OMAP_CLOCKS_SET_BY_BOOTLOADER | ||
| 175 | bool "OMAP clocks set by bootloader" | ||
| 176 | depends on ARCH_OMAP1 | ||
| 177 | help | ||
| 178 | Enable this option to prevent the kernel from overriding the clock | ||
| 179 | frequencies programmed by bootloader for MPU, DSP, MMUs, TC, | ||
| 180 | internal LCD controller and MPU peripherals. | ||
| 181 | |||
| 182 | config OMAP_ARM_216MHZ | 174 | config OMAP_ARM_216MHZ |
| 183 | bool "OMAP ARM 216 MHz CPU (1710 only)" | 175 | bool "OMAP ARM 216 MHz CPU (1710 only)" |
| 184 | depends on ARCH_OMAP1 && ARCH_OMAP16XX | 176 | depends on ARCH_OMAP1 && ARCH_OMAP16XX |
diff --git a/arch/arm/mach-omap1/board-ams-delta.c b/arch/arm/mach-omap1/board-ams-delta.c index 51bae31cf361..b0f15d234a12 100644 --- a/arch/arm/mach-omap1/board-ams-delta.c +++ b/arch/arm/mach-omap1/board-ams-delta.c | |||
| @@ -302,8 +302,6 @@ static void __init ams_delta_init(void) | |||
| 302 | omap_cfg_reg(J19_1610_CAM_D6); | 302 | omap_cfg_reg(J19_1610_CAM_D6); |
| 303 | omap_cfg_reg(J18_1610_CAM_D7); | 303 | omap_cfg_reg(J18_1610_CAM_D7); |
| 304 | 304 | ||
| 305 | iotable_init(ams_delta_io_desc, ARRAY_SIZE(ams_delta_io_desc)); | ||
| 306 | |||
| 307 | omap_board_config = ams_delta_config; | 305 | omap_board_config = ams_delta_config; |
| 308 | omap_board_config_size = ARRAY_SIZE(ams_delta_config); | 306 | omap_board_config_size = ARRAY_SIZE(ams_delta_config); |
| 309 | omap_serial_init(); | 307 | omap_serial_init(); |
| @@ -373,10 +371,16 @@ static int __init ams_delta_modem_init(void) | |||
| 373 | } | 371 | } |
| 374 | arch_initcall(ams_delta_modem_init); | 372 | arch_initcall(ams_delta_modem_init); |
| 375 | 373 | ||
| 374 | static void __init ams_delta_map_io(void) | ||
| 375 | { | ||
| 376 | omap15xx_map_io(); | ||
| 377 | iotable_init(ams_delta_io_desc, ARRAY_SIZE(ams_delta_io_desc)); | ||
| 378 | } | ||
| 379 | |||
| 376 | MACHINE_START(AMS_DELTA, "Amstrad E3 (Delta)") | 380 | MACHINE_START(AMS_DELTA, "Amstrad E3 (Delta)") |
| 377 | /* Maintainer: Jonathan McDowell <noodles@earth.li> */ | 381 | /* Maintainer: Jonathan McDowell <noodles@earth.li> */ |
| 378 | .atag_offset = 0x100, | 382 | .atag_offset = 0x100, |
| 379 | .map_io = omap15xx_map_io, | 383 | .map_io = ams_delta_map_io, |
| 380 | .init_early = omap1_init_early, | 384 | .init_early = omap1_init_early, |
| 381 | .reserve = omap_reserve, | 385 | .reserve = omap_reserve, |
| 382 | .init_irq = omap1_init_irq, | 386 | .init_irq = omap1_init_irq, |
diff --git a/arch/arm/mach-omap1/clock.h b/arch/arm/mach-omap1/clock.h index eaf09efb91ca..16b1423b454a 100644 --- a/arch/arm/mach-omap1/clock.h +++ b/arch/arm/mach-omap1/clock.h | |||
| @@ -17,7 +17,8 @@ | |||
| 17 | 17 | ||
| 18 | #include <plat/clock.h> | 18 | #include <plat/clock.h> |
| 19 | 19 | ||
| 20 | extern int __init omap1_clk_init(void); | 20 | int omap1_clk_init(void); |
| 21 | void omap1_clk_late_init(void); | ||
| 21 | extern int omap1_clk_enable(struct clk *clk); | 22 | extern int omap1_clk_enable(struct clk *clk); |
| 22 | extern void omap1_clk_disable(struct clk *clk); | 23 | extern void omap1_clk_disable(struct clk *clk); |
| 23 | extern long omap1_clk_round_rate(struct clk *clk, unsigned long rate); | 24 | extern long omap1_clk_round_rate(struct clk *clk, unsigned long rate); |
diff --git a/arch/arm/mach-omap1/clock_data.c b/arch/arm/mach-omap1/clock_data.c index 92400b9eb69f..1297bb58869c 100644 --- a/arch/arm/mach-omap1/clock_data.c +++ b/arch/arm/mach-omap1/clock_data.c | |||
| @@ -767,6 +767,15 @@ static struct clk_functions omap1_clk_functions = { | |||
| 767 | .clk_disable_unused = omap1_clk_disable_unused, | 767 | .clk_disable_unused = omap1_clk_disable_unused, |
| 768 | }; | 768 | }; |
| 769 | 769 | ||
| 770 | static void __init omap1_show_rates(void) | ||
| 771 | { | ||
| 772 | pr_notice("Clocking rate (xtal/DPLL1/MPU): " | ||
| 773 | "%ld.%01ld/%ld.%01ld/%ld.%01ld MHz\n", | ||
| 774 | ck_ref.rate / 1000000, (ck_ref.rate / 100000) % 10, | ||
| 775 | ck_dpll1.rate / 1000000, (ck_dpll1.rate / 100000) % 10, | ||
| 776 | arm_ck.rate / 1000000, (arm_ck.rate / 100000) % 10); | ||
| 777 | } | ||
| 778 | |||
| 770 | int __init omap1_clk_init(void) | 779 | int __init omap1_clk_init(void) |
| 771 | { | 780 | { |
| 772 | struct omap_clk *c; | 781 | struct omap_clk *c; |
| @@ -835,9 +844,12 @@ int __init omap1_clk_init(void) | |||
| 835 | /* We want to be in syncronous scalable mode */ | 844 | /* We want to be in syncronous scalable mode */ |
| 836 | omap_writew(0x1000, ARM_SYSST); | 845 | omap_writew(0x1000, ARM_SYSST); |
| 837 | 846 | ||
| 838 | #ifdef CONFIG_OMAP_CLOCKS_SET_BY_BOOTLOADER | 847 | |
| 839 | /* Use values set by bootloader. Determine PLL rate and recalculate | 848 | /* |
| 840 | * dependent clocks as if kernel had changed PLL or divisors. | 849 | * Initially use the values set by bootloader. Determine PLL rate and |
| 850 | * recalculate dependent clocks as if kernel had changed PLL or | ||
| 851 | * divisors. See also omap1_clk_late_init() that can reprogram dpll1 | ||
| 852 | * after the SRAM is initialized. | ||
| 841 | */ | 853 | */ |
| 842 | { | 854 | { |
| 843 | unsigned pll_ctl_val = omap_readw(DPLL_CTL); | 855 | unsigned pll_ctl_val = omap_readw(DPLL_CTL); |
| @@ -862,25 +874,10 @@ int __init omap1_clk_init(void) | |||
| 862 | } | 874 | } |
| 863 | } | 875 | } |
| 864 | } | 876 | } |
| 865 | #else | ||
| 866 | /* Find the highest supported frequency and enable it */ | ||
| 867 | if (omap1_select_table_rate(&virtual_ck_mpu, ~0)) { | ||
| 868 | printk(KERN_ERR "System frequencies not set. Check your config.\n"); | ||
| 869 | /* Guess sane values (60MHz) */ | ||
| 870 | omap_writew(0x2290, DPLL_CTL); | ||
| 871 | omap_writew(cpu_is_omap7xx() ? 0x3005 : 0x1005, ARM_CKCTL); | ||
| 872 | ck_dpll1.rate = 60000000; | ||
| 873 | } | ||
| 874 | #endif | ||
| 875 | propagate_rate(&ck_dpll1); | 877 | propagate_rate(&ck_dpll1); |
| 876 | /* Cache rates for clocks connected to ck_ref (not dpll1) */ | 878 | /* Cache rates for clocks connected to ck_ref (not dpll1) */ |
| 877 | propagate_rate(&ck_ref); | 879 | propagate_rate(&ck_ref); |
| 878 | printk(KERN_INFO "Clocking rate (xtal/DPLL1/MPU): " | 880 | omap1_show_rates(); |
| 879 | "%ld.%01ld/%ld.%01ld/%ld.%01ld MHz\n", | ||
| 880 | ck_ref.rate / 1000000, (ck_ref.rate / 100000) % 10, | ||
| 881 | ck_dpll1.rate / 1000000, (ck_dpll1.rate / 100000) % 10, | ||
| 882 | arm_ck.rate / 1000000, (arm_ck.rate / 100000) % 10); | ||
| 883 | |||
| 884 | if (machine_is_omap_perseus2() || machine_is_omap_fsample()) { | 881 | if (machine_is_omap_perseus2() || machine_is_omap_fsample()) { |
| 885 | /* Select slicer output as OMAP input clock */ | 882 | /* Select slicer output as OMAP input clock */ |
| 886 | omap_writew(omap_readw(OMAP7XX_PCC_UPLD_CTRL) & ~0x1, | 883 | omap_writew(omap_readw(OMAP7XX_PCC_UPLD_CTRL) & ~0x1, |
| @@ -925,3 +922,21 @@ int __init omap1_clk_init(void) | |||
| 925 | 922 | ||
| 926 | return 0; | 923 | return 0; |
| 927 | } | 924 | } |
| 925 | |||
| 926 | #define OMAP1_DPLL1_SANE_VALUE 60000000 | ||
| 927 | |||
| 928 | void __init omap1_clk_late_init(void) | ||
| 929 | { | ||
| 930 | if (ck_dpll1.rate >= OMAP1_DPLL1_SANE_VALUE) | ||
| 931 | return; | ||
| 932 | |||
| 933 | /* Find the highest supported frequency and enable it */ | ||
| 934 | if (omap1_select_table_rate(&virtual_ck_mpu, ~0)) { | ||
| 935 | pr_err("System frequencies not set, using default. Check your config.\n"); | ||
| 936 | omap_writew(0x2290, DPLL_CTL); | ||
| 937 | omap_writew(cpu_is_omap7xx() ? 0x3005 : 0x1005, ARM_CKCTL); | ||
| 938 | ck_dpll1.rate = OMAP1_DPLL1_SANE_VALUE; | ||
| 939 | } | ||
| 940 | propagate_rate(&ck_dpll1); | ||
| 941 | omap1_show_rates(); | ||
| 942 | } | ||
diff --git a/arch/arm/mach-omap1/devices.c b/arch/arm/mach-omap1/devices.c index 48ef9888e820..475cb2f50d87 100644 --- a/arch/arm/mach-omap1/devices.c +++ b/arch/arm/mach-omap1/devices.c | |||
| @@ -30,6 +30,8 @@ | |||
| 30 | #include <plat/omap7xx.h> | 30 | #include <plat/omap7xx.h> |
| 31 | #include <plat/mcbsp.h> | 31 | #include <plat/mcbsp.h> |
| 32 | 32 | ||
| 33 | #include "clock.h" | ||
| 34 | |||
| 33 | /*-------------------------------------------------------------------------*/ | 35 | /*-------------------------------------------------------------------------*/ |
| 34 | 36 | ||
| 35 | #if defined(CONFIG_RTC_DRV_OMAP) || defined(CONFIG_RTC_DRV_OMAP_MODULE) | 37 | #if defined(CONFIG_RTC_DRV_OMAP) || defined(CONFIG_RTC_DRV_OMAP_MODULE) |
| @@ -293,6 +295,7 @@ static int __init omap1_init_devices(void) | |||
| 293 | return -ENODEV; | 295 | return -ENODEV; |
| 294 | 296 | ||
| 295 | omap_sram_init(); | 297 | omap_sram_init(); |
| 298 | omap1_clk_late_init(); | ||
| 296 | 299 | ||
| 297 | /* please keep these calls, and their implementations above, | 300 | /* please keep these calls, and their implementations above, |
| 298 | * in alphabetical order so they're easier to sort through. | 301 | * in alphabetical order so they're easier to sort through. |
diff --git a/arch/arm/mach-omap2/Kconfig b/arch/arm/mach-omap2/Kconfig index 503414718905..e1293aa513d3 100644 --- a/arch/arm/mach-omap2/Kconfig +++ b/arch/arm/mach-omap2/Kconfig | |||
| @@ -334,6 +334,7 @@ config MACH_OMAP4_PANDA | |||
| 334 | config OMAP3_EMU | 334 | config OMAP3_EMU |
| 335 | bool "OMAP3 debugging peripherals" | 335 | bool "OMAP3 debugging peripherals" |
| 336 | depends on ARCH_OMAP3 | 336 | depends on ARCH_OMAP3 |
| 337 | select ARM_AMBA | ||
| 337 | select OC_ETM | 338 | select OC_ETM |
| 338 | help | 339 | help |
| 339 | Say Y here to enable debugging hardware of omap3 | 340 | Say Y here to enable debugging hardware of omap3 |
diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile index 69ab1c069134..b009f17dee56 100644 --- a/arch/arm/mach-omap2/Makefile +++ b/arch/arm/mach-omap2/Makefile | |||
| @@ -4,7 +4,7 @@ | |||
| 4 | 4 | ||
| 5 | # Common support | 5 | # Common support |
| 6 | obj-y := id.o io.o control.o mux.o devices.o serial.o gpmc.o timer.o pm.o \ | 6 | obj-y := id.o io.o control.o mux.o devices.o serial.o gpmc.o timer.o pm.o \ |
| 7 | common.o gpio.o dma.o wd_timer.o | 7 | common.o gpio.o dma.o wd_timer.o display.o |
| 8 | 8 | ||
| 9 | omap-2-3-common = irq.o sdrc.o | 9 | omap-2-3-common = irq.o sdrc.o |
| 10 | hwmod-common = omap_hwmod.o \ | 10 | hwmod-common = omap_hwmod.o \ |
| @@ -264,7 +264,4 @@ smsc911x-$(CONFIG_SMSC911X) := gpmc-smsc911x.o | |||
| 264 | obj-y += $(smsc911x-m) $(smsc911x-y) | 264 | obj-y += $(smsc911x-m) $(smsc911x-y) |
| 265 | obj-$(CONFIG_ARCH_OMAP4) += hwspinlock.o | 265 | obj-$(CONFIG_ARCH_OMAP4) += hwspinlock.o |
| 266 | 266 | ||
| 267 | disp-$(CONFIG_OMAP2_DSS) := display.o | ||
| 268 | obj-y += $(disp-m) $(disp-y) | ||
| 269 | |||
| 270 | obj-y += common-board-devices.o twl-common.o | 267 | obj-y += common-board-devices.o twl-common.o |
diff --git a/arch/arm/mach-omap2/cpuidle34xx.c b/arch/arm/mach-omap2/cpuidle34xx.c index 1fe35c24fba2..942bb4f19f9f 100644 --- a/arch/arm/mach-omap2/cpuidle34xx.c +++ b/arch/arm/mach-omap2/cpuidle34xx.c | |||
| @@ -24,6 +24,7 @@ | |||
| 24 | 24 | ||
| 25 | #include <linux/sched.h> | 25 | #include <linux/sched.h> |
| 26 | #include <linux/cpuidle.h> | 26 | #include <linux/cpuidle.h> |
| 27 | #include <linux/export.h> | ||
| 27 | 28 | ||
| 28 | #include <plat/prcm.h> | 29 | #include <plat/prcm.h> |
| 29 | #include <plat/irqs.h> | 30 | #include <plat/irqs.h> |
diff --git a/arch/arm/mach-omap2/display.c b/arch/arm/mach-omap2/display.c index adb2756e242f..dce9905d64bb 100644 --- a/arch/arm/mach-omap2/display.c +++ b/arch/arm/mach-omap2/display.c | |||
| @@ -27,8 +27,35 @@ | |||
| 27 | #include <plat/omap_hwmod.h> | 27 | #include <plat/omap_hwmod.h> |
| 28 | #include <plat/omap_device.h> | 28 | #include <plat/omap_device.h> |
| 29 | #include <plat/omap-pm.h> | 29 | #include <plat/omap-pm.h> |
| 30 | #include <plat/common.h> | ||
| 30 | 31 | ||
| 31 | #include "control.h" | 32 | #include "control.h" |
| 33 | #include "display.h" | ||
| 34 | |||
| 35 | #define DISPC_CONTROL 0x0040 | ||
| 36 | #define DISPC_CONTROL2 0x0238 | ||
| 37 | #define DISPC_IRQSTATUS 0x0018 | ||
| 38 | |||
| 39 | #define DSS_SYSCONFIG 0x10 | ||
| 40 | #define DSS_SYSSTATUS 0x14 | ||
| 41 | #define DSS_CONTROL 0x40 | ||
| 42 | #define DSS_SDI_CONTROL 0x44 | ||
| 43 | #define DSS_PLL_CONTROL 0x48 | ||
| 44 | |||
| 45 | #define LCD_EN_MASK (0x1 << 0) | ||
| 46 | #define DIGIT_EN_MASK (0x1 << 1) | ||
| 47 | |||
| 48 | #define FRAMEDONE_IRQ_SHIFT 0 | ||
| 49 | #define EVSYNC_EVEN_IRQ_SHIFT 2 | ||
| 50 | #define EVSYNC_ODD_IRQ_SHIFT 3 | ||
| 51 | #define FRAMEDONE2_IRQ_SHIFT 22 | ||
| 52 | #define FRAMEDONETV_IRQ_SHIFT 24 | ||
| 53 | |||
| 54 | /* | ||
| 55 | * FRAMEDONE_IRQ_TIMEOUT: how long (in milliseconds) to wait during DISPC | ||
| 56 | * reset before deciding that something has gone wrong | ||
| 57 | */ | ||
| 58 | #define FRAMEDONE_IRQ_TIMEOUT 100 | ||
| 32 | 59 | ||
| 33 | static struct platform_device omap_display_device = { | 60 | static struct platform_device omap_display_device = { |
| 34 | .name = "omapdss", | 61 | .name = "omapdss", |
| @@ -172,3 +199,135 @@ int __init omap_display_init(struct omap_dss_board_info *board_data) | |||
| 172 | 199 | ||
| 173 | return r; | 200 | return r; |
| 174 | } | 201 | } |
| 202 | |||
| 203 | static void dispc_disable_outputs(void) | ||
| 204 | { | ||
| 205 | u32 v, irq_mask = 0; | ||
| 206 | bool lcd_en, digit_en, lcd2_en = false; | ||
| 207 | int i; | ||
| 208 | struct omap_dss_dispc_dev_attr *da; | ||
| 209 | struct omap_hwmod *oh; | ||
| 210 | |||
| 211 | oh = omap_hwmod_lookup("dss_dispc"); | ||
| 212 | if (!oh) { | ||
| 213 | WARN(1, "display: could not disable outputs during reset - could not find dss_dispc hwmod\n"); | ||
| 214 | return; | ||
| 215 | } | ||
| 216 | |||
| 217 | if (!oh->dev_attr) { | ||
| 218 | pr_err("display: could not disable outputs during reset due to missing dev_attr\n"); | ||
| 219 | return; | ||
| 220 | } | ||
| 221 | |||
| 222 | da = (struct omap_dss_dispc_dev_attr *)oh->dev_attr; | ||
| 223 | |||
| 224 | /* store value of LCDENABLE and DIGITENABLE bits */ | ||
| 225 | v = omap_hwmod_read(oh, DISPC_CONTROL); | ||
| 226 | lcd_en = v & LCD_EN_MASK; | ||
| 227 | digit_en = v & DIGIT_EN_MASK; | ||
| 228 | |||
| 229 | /* store value of LCDENABLE for LCD2 */ | ||
| 230 | if (da->manager_count > 2) { | ||
| 231 | v = omap_hwmod_read(oh, DISPC_CONTROL2); | ||
| 232 | lcd2_en = v & LCD_EN_MASK; | ||
| 233 | } | ||
| 234 | |||
| 235 | if (!(lcd_en | digit_en | lcd2_en)) | ||
| 236 | return; /* no managers currently enabled */ | ||
| 237 | |||
| 238 | /* | ||
| 239 | * If any manager was enabled, we need to disable it before | ||
| 240 | * DSS clocks are disabled or DISPC module is reset | ||
| 241 | */ | ||
| 242 | if (lcd_en) | ||
| 243 | irq_mask |= 1 << FRAMEDONE_IRQ_SHIFT; | ||
| 244 | |||
| 245 | if (digit_en) { | ||
| 246 | if (da->has_framedonetv_irq) { | ||
| 247 | irq_mask |= 1 << FRAMEDONETV_IRQ_SHIFT; | ||
| 248 | } else { | ||
| 249 | irq_mask |= 1 << EVSYNC_EVEN_IRQ_SHIFT | | ||
| 250 | 1 << EVSYNC_ODD_IRQ_SHIFT; | ||
| 251 | } | ||
| 252 | } | ||
| 253 | |||
| 254 | if (lcd2_en) | ||
| 255 | irq_mask |= 1 << FRAMEDONE2_IRQ_SHIFT; | ||
| 256 | |||
| 257 | /* | ||
| 258 | * clear any previous FRAMEDONE, FRAMEDONETV, | ||
| 259 | * EVSYNC_EVEN/ODD or FRAMEDONE2 interrupts | ||
| 260 | */ | ||
| 261 | omap_hwmod_write(irq_mask, oh, DISPC_IRQSTATUS); | ||
| 262 | |||
| 263 | /* disable LCD and TV managers */ | ||
| 264 | v = omap_hwmod_read(oh, DISPC_CONTROL); | ||
| 265 | v &= ~(LCD_EN_MASK | DIGIT_EN_MASK); | ||
| 266 | omap_hwmod_write(v, oh, DISPC_CONTROL); | ||
| 267 | |||
| 268 | /* disable LCD2 manager */ | ||
| 269 | if (da->manager_count > 2) { | ||
| 270 | v = omap_hwmod_read(oh, DISPC_CONTROL2); | ||
| 271 | v &= ~LCD_EN_MASK; | ||
| 272 | omap_hwmod_write(v, oh, DISPC_CONTROL2); | ||
| 273 | } | ||
| 274 | |||
| 275 | i = 0; | ||
| 276 | while ((omap_hwmod_read(oh, DISPC_IRQSTATUS) & irq_mask) != | ||
| 277 | irq_mask) { | ||
| 278 | i++; | ||
| 279 | if (i > FRAMEDONE_IRQ_TIMEOUT) { | ||
| 280 | pr_err("didn't get FRAMEDONE1/2 or TV interrupt\n"); | ||
| 281 | break; | ||
| 282 | } | ||
| 283 | mdelay(1); | ||
| 284 | } | ||
| 285 | } | ||
| 286 | |||
| 287 | #define MAX_MODULE_SOFTRESET_WAIT 10000 | ||
| 288 | int omap_dss_reset(struct omap_hwmod *oh) | ||
| 289 | { | ||
| 290 | struct omap_hwmod_opt_clk *oc; | ||
| 291 | int c = 0; | ||
| 292 | int i, r; | ||
| 293 | |||
| 294 | if (!(oh->class->sysc->sysc_flags & SYSS_HAS_RESET_STATUS)) { | ||
| 295 | pr_err("dss_core: hwmod data doesn't contain reset data\n"); | ||
| 296 | return -EINVAL; | ||
| 297 | } | ||
| 298 | |||
| 299 | for (i = oh->opt_clks_cnt, oc = oh->opt_clks; i > 0; i--, oc++) | ||
| 300 | if (oc->_clk) | ||
| 301 | clk_enable(oc->_clk); | ||
| 302 | |||
| 303 | dispc_disable_outputs(); | ||
| 304 | |||
| 305 | /* clear SDI registers */ | ||
| 306 | if (cpu_is_omap3430()) { | ||
| 307 | omap_hwmod_write(0x0, oh, DSS_SDI_CONTROL); | ||
| 308 | omap_hwmod_write(0x0, oh, DSS_PLL_CONTROL); | ||
| 309 | } | ||
| 310 | |||
| 311 | /* | ||
| 312 | * clear DSS_CONTROL register to switch DSS clock sources to | ||
| 313 | * PRCM clock, if any | ||
| 314 | */ | ||
| 315 | omap_hwmod_write(0x0, oh, DSS_CONTROL); | ||
| 316 | |||
| 317 | omap_test_timeout((omap_hwmod_read(oh, oh->class->sysc->syss_offs) | ||
| 318 | & SYSS_RESETDONE_MASK), | ||
| 319 | MAX_MODULE_SOFTRESET_WAIT, c); | ||
| 320 | |||
| 321 | if (c == MAX_MODULE_SOFTRESET_WAIT) | ||
| 322 | pr_warning("dss_core: waiting for reset to finish failed\n"); | ||
| 323 | else | ||
| 324 | pr_debug("dss_core: softreset done\n"); | ||
| 325 | |||
| 326 | for (i = oh->opt_clks_cnt, oc = oh->opt_clks; i > 0; i--, oc++) | ||
| 327 | if (oc->_clk) | ||
| 328 | clk_disable(oc->_clk); | ||
| 329 | |||
| 330 | r = (c == MAX_MODULE_SOFTRESET_WAIT) ? -ETIMEDOUT : 0; | ||
| 331 | |||
| 332 | return r; | ||
| 333 | } | ||
diff --git a/arch/arm/mach-omap2/display.h b/arch/arm/mach-omap2/display.h new file mode 100644 index 000000000000..b871b017b352 --- /dev/null +++ b/arch/arm/mach-omap2/display.h | |||
| @@ -0,0 +1,29 @@ | |||
| 1 | /* | ||
| 2 | * display.h - OMAP2+ integration-specific DSS header | ||
| 3 | * | ||
| 4 | * Copyright (C) 2011 Texas Instruments, Inc. | ||
| 5 | * | ||
| 6 | * This program is free software; you can redistribute it and/or modify it | ||
| 7 | * under the terms of the GNU General Public License version 2 as published by | ||
| 8 | * the Free Software Foundation. | ||
| 9 | * | ||
| 10 | * This program is distributed in the hope that it will be useful, but WITHOUT | ||
| 11 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
| 12 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
| 13 | * more details. | ||
| 14 | * | ||
| 15 | * You should have received a copy of the GNU General Public License along with | ||
| 16 | * this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 17 | */ | ||
| 18 | |||
| 19 | #ifndef __ARCH_ARM_MACH_OMAP2_DISPLAY_H | ||
| 20 | #define __ARCH_ARM_MACH_OMAP2_DISPLAY_H | ||
| 21 | |||
| 22 | #include <linux/kernel.h> | ||
| 23 | |||
| 24 | struct omap_dss_dispc_dev_attr { | ||
| 25 | u8 manager_count; | ||
| 26 | bool has_framedonetv_irq; | ||
| 27 | }; | ||
| 28 | |||
| 29 | #endif | ||
diff --git a/arch/arm/mach-omap2/io.h b/arch/arm/mach-omap2/io.h deleted file mode 100644 index e69de29bb2d1..000000000000 --- a/arch/arm/mach-omap2/io.h +++ /dev/null | |||
diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c index 6b3088db83b7..207a2ff9a8c4 100644 --- a/arch/arm/mach-omap2/omap_hwmod.c +++ b/arch/arm/mach-omap2/omap_hwmod.c | |||
| @@ -749,7 +749,7 @@ static int _count_mpu_irqs(struct omap_hwmod *oh) | |||
| 749 | ohii = &oh->mpu_irqs[i++]; | 749 | ohii = &oh->mpu_irqs[i++]; |
| 750 | } while (ohii->irq != -1); | 750 | } while (ohii->irq != -1); |
| 751 | 751 | ||
| 752 | return i; | 752 | return i-1; |
| 753 | } | 753 | } |
| 754 | 754 | ||
| 755 | /** | 755 | /** |
| @@ -772,7 +772,7 @@ static int _count_sdma_reqs(struct omap_hwmod *oh) | |||
| 772 | ohdi = &oh->sdma_reqs[i++]; | 772 | ohdi = &oh->sdma_reqs[i++]; |
| 773 | } while (ohdi->dma_req != -1); | 773 | } while (ohdi->dma_req != -1); |
| 774 | 774 | ||
| 775 | return i; | 775 | return i-1; |
| 776 | } | 776 | } |
| 777 | 777 | ||
| 778 | /** | 778 | /** |
| @@ -795,7 +795,7 @@ static int _count_ocp_if_addr_spaces(struct omap_hwmod_ocp_if *os) | |||
| 795 | mem = &os->addr[i++]; | 795 | mem = &os->addr[i++]; |
| 796 | } while (mem->pa_start != mem->pa_end); | 796 | } while (mem->pa_start != mem->pa_end); |
| 797 | 797 | ||
| 798 | return i; | 798 | return i-1; |
| 799 | } | 799 | } |
| 800 | 800 | ||
| 801 | /** | 801 | /** |
diff --git a/arch/arm/mach-omap2/omap_hwmod_2420_data.c b/arch/arm/mach-omap2/omap_hwmod_2420_data.c index 6d7206213525..a5409ce3f323 100644 --- a/arch/arm/mach-omap2/omap_hwmod_2420_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_2420_data.c | |||
| @@ -875,6 +875,10 @@ static struct omap_hwmod_ocp_if *omap2420_dss_slaves[] = { | |||
| 875 | }; | 875 | }; |
| 876 | 876 | ||
| 877 | static struct omap_hwmod_opt_clk dss_opt_clks[] = { | 877 | static struct omap_hwmod_opt_clk dss_opt_clks[] = { |
| 878 | /* | ||
| 879 | * The DSS HW needs all DSS clocks enabled during reset. The dss_core | ||
| 880 | * driver does not use these clocks. | ||
| 881 | */ | ||
| 878 | { .role = "tv_clk", .clk = "dss_54m_fck" }, | 882 | { .role = "tv_clk", .clk = "dss_54m_fck" }, |
| 879 | { .role = "sys_clk", .clk = "dss2_fck" }, | 883 | { .role = "sys_clk", .clk = "dss2_fck" }, |
| 880 | }; | 884 | }; |
| @@ -899,7 +903,7 @@ static struct omap_hwmod omap2420_dss_core_hwmod = { | |||
| 899 | .slaves_cnt = ARRAY_SIZE(omap2420_dss_slaves), | 903 | .slaves_cnt = ARRAY_SIZE(omap2420_dss_slaves), |
| 900 | .masters = omap2420_dss_masters, | 904 | .masters = omap2420_dss_masters, |
| 901 | .masters_cnt = ARRAY_SIZE(omap2420_dss_masters), | 905 | .masters_cnt = ARRAY_SIZE(omap2420_dss_masters), |
| 902 | .flags = HWMOD_NO_IDLEST, | 906 | .flags = HWMOD_NO_IDLEST | HWMOD_CONTROL_OPT_CLKS_IN_RESET, |
| 903 | }; | 907 | }; |
| 904 | 908 | ||
| 905 | /* l4_core -> dss_dispc */ | 909 | /* l4_core -> dss_dispc */ |
| @@ -939,6 +943,7 @@ static struct omap_hwmod omap2420_dss_dispc_hwmod = { | |||
| 939 | .slaves = omap2420_dss_dispc_slaves, | 943 | .slaves = omap2420_dss_dispc_slaves, |
| 940 | .slaves_cnt = ARRAY_SIZE(omap2420_dss_dispc_slaves), | 944 | .slaves_cnt = ARRAY_SIZE(omap2420_dss_dispc_slaves), |
| 941 | .flags = HWMOD_NO_IDLEST, | 945 | .flags = HWMOD_NO_IDLEST, |
| 946 | .dev_attr = &omap2_3_dss_dispc_dev_attr | ||
| 942 | }; | 947 | }; |
| 943 | 948 | ||
| 944 | /* l4_core -> dss_rfbi */ | 949 | /* l4_core -> dss_rfbi */ |
| @@ -961,6 +966,10 @@ static struct omap_hwmod_ocp_if *omap2420_dss_rfbi_slaves[] = { | |||
| 961 | &omap2420_l4_core__dss_rfbi, | 966 | &omap2420_l4_core__dss_rfbi, |
| 962 | }; | 967 | }; |
| 963 | 968 | ||
| 969 | static struct omap_hwmod_opt_clk dss_rfbi_opt_clks[] = { | ||
| 970 | { .role = "ick", .clk = "dss_ick" }, | ||
| 971 | }; | ||
| 972 | |||
| 964 | static struct omap_hwmod omap2420_dss_rfbi_hwmod = { | 973 | static struct omap_hwmod omap2420_dss_rfbi_hwmod = { |
| 965 | .name = "dss_rfbi", | 974 | .name = "dss_rfbi", |
| 966 | .class = &omap2_rfbi_hwmod_class, | 975 | .class = &omap2_rfbi_hwmod_class, |
| @@ -972,6 +981,8 @@ static struct omap_hwmod omap2420_dss_rfbi_hwmod = { | |||
| 972 | .module_offs = CORE_MOD, | 981 | .module_offs = CORE_MOD, |
| 973 | }, | 982 | }, |
| 974 | }, | 983 | }, |
| 984 | .opt_clks = dss_rfbi_opt_clks, | ||
| 985 | .opt_clks_cnt = ARRAY_SIZE(dss_rfbi_opt_clks), | ||
| 975 | .slaves = omap2420_dss_rfbi_slaves, | 986 | .slaves = omap2420_dss_rfbi_slaves, |
| 976 | .slaves_cnt = ARRAY_SIZE(omap2420_dss_rfbi_slaves), | 987 | .slaves_cnt = ARRAY_SIZE(omap2420_dss_rfbi_slaves), |
| 977 | .flags = HWMOD_NO_IDLEST, | 988 | .flags = HWMOD_NO_IDLEST, |
| @@ -981,7 +992,7 @@ static struct omap_hwmod omap2420_dss_rfbi_hwmod = { | |||
| 981 | static struct omap_hwmod_ocp_if omap2420_l4_core__dss_venc = { | 992 | static struct omap_hwmod_ocp_if omap2420_l4_core__dss_venc = { |
| 982 | .master = &omap2420_l4_core_hwmod, | 993 | .master = &omap2420_l4_core_hwmod, |
| 983 | .slave = &omap2420_dss_venc_hwmod, | 994 | .slave = &omap2420_dss_venc_hwmod, |
| 984 | .clk = "dss_54m_fck", | 995 | .clk = "dss_ick", |
| 985 | .addr = omap2_dss_venc_addrs, | 996 | .addr = omap2_dss_venc_addrs, |
| 986 | .fw = { | 997 | .fw = { |
| 987 | .omap2 = { | 998 | .omap2 = { |
| @@ -1001,7 +1012,7 @@ static struct omap_hwmod_ocp_if *omap2420_dss_venc_slaves[] = { | |||
| 1001 | static struct omap_hwmod omap2420_dss_venc_hwmod = { | 1012 | static struct omap_hwmod omap2420_dss_venc_hwmod = { |
| 1002 | .name = "dss_venc", | 1013 | .name = "dss_venc", |
| 1003 | .class = &omap2_venc_hwmod_class, | 1014 | .class = &omap2_venc_hwmod_class, |
| 1004 | .main_clk = "dss1_fck", | 1015 | .main_clk = "dss_54m_fck", |
| 1005 | .prcm = { | 1016 | .prcm = { |
| 1006 | .omap2 = { | 1017 | .omap2 = { |
| 1007 | .prcm_reg_id = 1, | 1018 | .prcm_reg_id = 1, |
diff --git a/arch/arm/mach-omap2/omap_hwmod_2430_data.c b/arch/arm/mach-omap2/omap_hwmod_2430_data.c index a2580d01c3ff..c4f56cb60d7d 100644 --- a/arch/arm/mach-omap2/omap_hwmod_2430_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_2430_data.c | |||
| @@ -942,6 +942,10 @@ static struct omap_hwmod_ocp_if *omap2430_dss_slaves[] = { | |||
| 942 | }; | 942 | }; |
| 943 | 943 | ||
| 944 | static struct omap_hwmod_opt_clk dss_opt_clks[] = { | 944 | static struct omap_hwmod_opt_clk dss_opt_clks[] = { |
| 945 | /* | ||
| 946 | * The DSS HW needs all DSS clocks enabled during reset. The dss_core | ||
| 947 | * driver does not use these clocks. | ||
| 948 | */ | ||
| 945 | { .role = "tv_clk", .clk = "dss_54m_fck" }, | 949 | { .role = "tv_clk", .clk = "dss_54m_fck" }, |
| 946 | { .role = "sys_clk", .clk = "dss2_fck" }, | 950 | { .role = "sys_clk", .clk = "dss2_fck" }, |
| 947 | }; | 951 | }; |
| @@ -966,7 +970,7 @@ static struct omap_hwmod omap2430_dss_core_hwmod = { | |||
| 966 | .slaves_cnt = ARRAY_SIZE(omap2430_dss_slaves), | 970 | .slaves_cnt = ARRAY_SIZE(omap2430_dss_slaves), |
| 967 | .masters = omap2430_dss_masters, | 971 | .masters = omap2430_dss_masters, |
| 968 | .masters_cnt = ARRAY_SIZE(omap2430_dss_masters), | 972 | .masters_cnt = ARRAY_SIZE(omap2430_dss_masters), |
| 969 | .flags = HWMOD_NO_IDLEST, | 973 | .flags = HWMOD_NO_IDLEST | HWMOD_CONTROL_OPT_CLKS_IN_RESET, |
| 970 | }; | 974 | }; |
| 971 | 975 | ||
| 972 | /* l4_core -> dss_dispc */ | 976 | /* l4_core -> dss_dispc */ |
| @@ -1000,6 +1004,7 @@ static struct omap_hwmod omap2430_dss_dispc_hwmod = { | |||
| 1000 | .slaves = omap2430_dss_dispc_slaves, | 1004 | .slaves = omap2430_dss_dispc_slaves, |
| 1001 | .slaves_cnt = ARRAY_SIZE(omap2430_dss_dispc_slaves), | 1005 | .slaves_cnt = ARRAY_SIZE(omap2430_dss_dispc_slaves), |
| 1002 | .flags = HWMOD_NO_IDLEST, | 1006 | .flags = HWMOD_NO_IDLEST, |
| 1007 | .dev_attr = &omap2_3_dss_dispc_dev_attr | ||
| 1003 | }; | 1008 | }; |
| 1004 | 1009 | ||
| 1005 | /* l4_core -> dss_rfbi */ | 1010 | /* l4_core -> dss_rfbi */ |
| @@ -1016,6 +1021,10 @@ static struct omap_hwmod_ocp_if *omap2430_dss_rfbi_slaves[] = { | |||
| 1016 | &omap2430_l4_core__dss_rfbi, | 1021 | &omap2430_l4_core__dss_rfbi, |
| 1017 | }; | 1022 | }; |
| 1018 | 1023 | ||
| 1024 | static struct omap_hwmod_opt_clk dss_rfbi_opt_clks[] = { | ||
| 1025 | { .role = "ick", .clk = "dss_ick" }, | ||
| 1026 | }; | ||
| 1027 | |||
| 1019 | static struct omap_hwmod omap2430_dss_rfbi_hwmod = { | 1028 | static struct omap_hwmod omap2430_dss_rfbi_hwmod = { |
| 1020 | .name = "dss_rfbi", | 1029 | .name = "dss_rfbi", |
| 1021 | .class = &omap2_rfbi_hwmod_class, | 1030 | .class = &omap2_rfbi_hwmod_class, |
| @@ -1027,6 +1036,8 @@ static struct omap_hwmod omap2430_dss_rfbi_hwmod = { | |||
| 1027 | .module_offs = CORE_MOD, | 1036 | .module_offs = CORE_MOD, |
| 1028 | }, | 1037 | }, |
| 1029 | }, | 1038 | }, |
| 1039 | .opt_clks = dss_rfbi_opt_clks, | ||
| 1040 | .opt_clks_cnt = ARRAY_SIZE(dss_rfbi_opt_clks), | ||
| 1030 | .slaves = omap2430_dss_rfbi_slaves, | 1041 | .slaves = omap2430_dss_rfbi_slaves, |
| 1031 | .slaves_cnt = ARRAY_SIZE(omap2430_dss_rfbi_slaves), | 1042 | .slaves_cnt = ARRAY_SIZE(omap2430_dss_rfbi_slaves), |
| 1032 | .flags = HWMOD_NO_IDLEST, | 1043 | .flags = HWMOD_NO_IDLEST, |
| @@ -1036,7 +1047,7 @@ static struct omap_hwmod omap2430_dss_rfbi_hwmod = { | |||
| 1036 | static struct omap_hwmod_ocp_if omap2430_l4_core__dss_venc = { | 1047 | static struct omap_hwmod_ocp_if omap2430_l4_core__dss_venc = { |
| 1037 | .master = &omap2430_l4_core_hwmod, | 1048 | .master = &omap2430_l4_core_hwmod, |
| 1038 | .slave = &omap2430_dss_venc_hwmod, | 1049 | .slave = &omap2430_dss_venc_hwmod, |
| 1039 | .clk = "dss_54m_fck", | 1050 | .clk = "dss_ick", |
| 1040 | .addr = omap2_dss_venc_addrs, | 1051 | .addr = omap2_dss_venc_addrs, |
| 1041 | .flags = OCPIF_SWSUP_IDLE, | 1052 | .flags = OCPIF_SWSUP_IDLE, |
| 1042 | .user = OCP_USER_MPU | OCP_USER_SDMA, | 1053 | .user = OCP_USER_MPU | OCP_USER_SDMA, |
| @@ -1050,7 +1061,7 @@ static struct omap_hwmod_ocp_if *omap2430_dss_venc_slaves[] = { | |||
| 1050 | static struct omap_hwmod omap2430_dss_venc_hwmod = { | 1061 | static struct omap_hwmod omap2430_dss_venc_hwmod = { |
| 1051 | .name = "dss_venc", | 1062 | .name = "dss_venc", |
| 1052 | .class = &omap2_venc_hwmod_class, | 1063 | .class = &omap2_venc_hwmod_class, |
| 1053 | .main_clk = "dss1_fck", | 1064 | .main_clk = "dss_54m_fck", |
| 1054 | .prcm = { | 1065 | .prcm = { |
| 1055 | .omap2 = { | 1066 | .omap2 = { |
| 1056 | .prcm_reg_id = 1, | 1067 | .prcm_reg_id = 1, |
diff --git a/arch/arm/mach-omap2/omap_hwmod_2xxx_3xxx_ipblock_data.c b/arch/arm/mach-omap2/omap_hwmod_2xxx_3xxx_ipblock_data.c index c451729d289a..c11273da5dcc 100644 --- a/arch/arm/mach-omap2/omap_hwmod_2xxx_3xxx_ipblock_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_2xxx_3xxx_ipblock_data.c | |||
| @@ -11,6 +11,7 @@ | |||
| 11 | #include <plat/omap_hwmod.h> | 11 | #include <plat/omap_hwmod.h> |
| 12 | #include <plat/serial.h> | 12 | #include <plat/serial.h> |
| 13 | #include <plat/dma.h> | 13 | #include <plat/dma.h> |
| 14 | #include <plat/common.h> | ||
| 14 | 15 | ||
| 15 | #include <mach/irqs.h> | 16 | #include <mach/irqs.h> |
| 16 | 17 | ||
| @@ -43,13 +44,15 @@ static struct omap_hwmod_class_sysconfig omap2_dss_sysc = { | |||
| 43 | .rev_offs = 0x0000, | 44 | .rev_offs = 0x0000, |
| 44 | .sysc_offs = 0x0010, | 45 | .sysc_offs = 0x0010, |
| 45 | .syss_offs = 0x0014, | 46 | .syss_offs = 0x0014, |
| 46 | .sysc_flags = (SYSC_HAS_SOFTRESET | SYSC_HAS_AUTOIDLE), | 47 | .sysc_flags = (SYSC_HAS_SOFTRESET | SYSC_HAS_AUTOIDLE | |
| 48 | SYSS_HAS_RESET_STATUS), | ||
| 47 | .sysc_fields = &omap_hwmod_sysc_type1, | 49 | .sysc_fields = &omap_hwmod_sysc_type1, |
| 48 | }; | 50 | }; |
| 49 | 51 | ||
| 50 | struct omap_hwmod_class omap2_dss_hwmod_class = { | 52 | struct omap_hwmod_class omap2_dss_hwmod_class = { |
| 51 | .name = "dss", | 53 | .name = "dss", |
| 52 | .sysc = &omap2_dss_sysc, | 54 | .sysc = &omap2_dss_sysc, |
| 55 | .reset = omap_dss_reset, | ||
| 53 | }; | 56 | }; |
| 54 | 57 | ||
| 55 | /* | 58 | /* |
diff --git a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c index bc9035ec87fc..7f8915ad5099 100644 --- a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c | |||
| @@ -1369,9 +1369,14 @@ static struct omap_hwmod_ocp_if *omap3xxx_dss_slaves[] = { | |||
| 1369 | }; | 1369 | }; |
| 1370 | 1370 | ||
| 1371 | static struct omap_hwmod_opt_clk dss_opt_clks[] = { | 1371 | static struct omap_hwmod_opt_clk dss_opt_clks[] = { |
| 1372 | { .role = "tv_clk", .clk = "dss_tv_fck" }, | 1372 | /* |
| 1373 | { .role = "video_clk", .clk = "dss_96m_fck" }, | 1373 | * The DSS HW needs all DSS clocks enabled during reset. The dss_core |
| 1374 | * driver does not use these clocks. | ||
| 1375 | */ | ||
| 1374 | { .role = "sys_clk", .clk = "dss2_alwon_fck" }, | 1376 | { .role = "sys_clk", .clk = "dss2_alwon_fck" }, |
| 1377 | { .role = "tv_clk", .clk = "dss_tv_fck" }, | ||
| 1378 | /* required only on OMAP3430 */ | ||
| 1379 | { .role = "tv_dac_clk", .clk = "dss_96m_fck" }, | ||
| 1375 | }; | 1380 | }; |
| 1376 | 1381 | ||
| 1377 | static struct omap_hwmod omap3430es1_dss_core_hwmod = { | 1382 | static struct omap_hwmod omap3430es1_dss_core_hwmod = { |
| @@ -1394,11 +1399,12 @@ static struct omap_hwmod omap3430es1_dss_core_hwmod = { | |||
| 1394 | .slaves_cnt = ARRAY_SIZE(omap3430es1_dss_slaves), | 1399 | .slaves_cnt = ARRAY_SIZE(omap3430es1_dss_slaves), |
| 1395 | .masters = omap3xxx_dss_masters, | 1400 | .masters = omap3xxx_dss_masters, |
| 1396 | .masters_cnt = ARRAY_SIZE(omap3xxx_dss_masters), | 1401 | .masters_cnt = ARRAY_SIZE(omap3xxx_dss_masters), |
| 1397 | .flags = HWMOD_NO_IDLEST, | 1402 | .flags = HWMOD_NO_IDLEST | HWMOD_CONTROL_OPT_CLKS_IN_RESET, |
| 1398 | }; | 1403 | }; |
| 1399 | 1404 | ||
| 1400 | static struct omap_hwmod omap3xxx_dss_core_hwmod = { | 1405 | static struct omap_hwmod omap3xxx_dss_core_hwmod = { |
| 1401 | .name = "dss_core", | 1406 | .name = "dss_core", |
| 1407 | .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET, | ||
| 1402 | .class = &omap2_dss_hwmod_class, | 1408 | .class = &omap2_dss_hwmod_class, |
| 1403 | .main_clk = "dss1_alwon_fck", /* instead of dss_fck */ | 1409 | .main_clk = "dss1_alwon_fck", /* instead of dss_fck */ |
| 1404 | .sdma_reqs = omap3xxx_dss_sdma_chs, | 1410 | .sdma_reqs = omap3xxx_dss_sdma_chs, |
| @@ -1456,6 +1462,7 @@ static struct omap_hwmod omap3xxx_dss_dispc_hwmod = { | |||
| 1456 | .slaves = omap3xxx_dss_dispc_slaves, | 1462 | .slaves = omap3xxx_dss_dispc_slaves, |
| 1457 | .slaves_cnt = ARRAY_SIZE(omap3xxx_dss_dispc_slaves), | 1463 | .slaves_cnt = ARRAY_SIZE(omap3xxx_dss_dispc_slaves), |
| 1458 | .flags = HWMOD_NO_IDLEST, | 1464 | .flags = HWMOD_NO_IDLEST, |
| 1465 | .dev_attr = &omap2_3_dss_dispc_dev_attr | ||
| 1459 | }; | 1466 | }; |
| 1460 | 1467 | ||
| 1461 | /* | 1468 | /* |
| @@ -1486,6 +1493,7 @@ static struct omap_hwmod_addr_space omap3xxx_dss_dsi1_addrs[] = { | |||
| 1486 | static struct omap_hwmod_ocp_if omap3xxx_l4_core__dss_dsi1 = { | 1493 | static struct omap_hwmod_ocp_if omap3xxx_l4_core__dss_dsi1 = { |
| 1487 | .master = &omap3xxx_l4_core_hwmod, | 1494 | .master = &omap3xxx_l4_core_hwmod, |
| 1488 | .slave = &omap3xxx_dss_dsi1_hwmod, | 1495 | .slave = &omap3xxx_dss_dsi1_hwmod, |
| 1496 | .clk = "dss_ick", | ||
| 1489 | .addr = omap3xxx_dss_dsi1_addrs, | 1497 | .addr = omap3xxx_dss_dsi1_addrs, |
| 1490 | .fw = { | 1498 | .fw = { |
| 1491 | .omap2 = { | 1499 | .omap2 = { |
| @@ -1502,6 +1510,10 @@ static struct omap_hwmod_ocp_if *omap3xxx_dss_dsi1_slaves[] = { | |||
| 1502 | &omap3xxx_l4_core__dss_dsi1, | 1510 | &omap3xxx_l4_core__dss_dsi1, |
| 1503 | }; | 1511 | }; |
| 1504 | 1512 | ||
| 1513 | static struct omap_hwmod_opt_clk dss_dsi1_opt_clks[] = { | ||
| 1514 | { .role = "sys_clk", .clk = "dss2_alwon_fck" }, | ||
| 1515 | }; | ||
| 1516 | |||
| 1505 | static struct omap_hwmod omap3xxx_dss_dsi1_hwmod = { | 1517 | static struct omap_hwmod omap3xxx_dss_dsi1_hwmod = { |
| 1506 | .name = "dss_dsi1", | 1518 | .name = "dss_dsi1", |
| 1507 | .class = &omap3xxx_dsi_hwmod_class, | 1519 | .class = &omap3xxx_dsi_hwmod_class, |
| @@ -1514,6 +1526,8 @@ static struct omap_hwmod omap3xxx_dss_dsi1_hwmod = { | |||
| 1514 | .module_offs = OMAP3430_DSS_MOD, | 1526 | .module_offs = OMAP3430_DSS_MOD, |
| 1515 | }, | 1527 | }, |
| 1516 | }, | 1528 | }, |
| 1529 | .opt_clks = dss_dsi1_opt_clks, | ||
| 1530 | .opt_clks_cnt = ARRAY_SIZE(dss_dsi1_opt_clks), | ||
| 1517 | .slaves = omap3xxx_dss_dsi1_slaves, | 1531 | .slaves = omap3xxx_dss_dsi1_slaves, |
| 1518 | .slaves_cnt = ARRAY_SIZE(omap3xxx_dss_dsi1_slaves), | 1532 | .slaves_cnt = ARRAY_SIZE(omap3xxx_dss_dsi1_slaves), |
| 1519 | .flags = HWMOD_NO_IDLEST, | 1533 | .flags = HWMOD_NO_IDLEST, |
| @@ -1540,6 +1554,10 @@ static struct omap_hwmod_ocp_if *omap3xxx_dss_rfbi_slaves[] = { | |||
| 1540 | &omap3xxx_l4_core__dss_rfbi, | 1554 | &omap3xxx_l4_core__dss_rfbi, |
| 1541 | }; | 1555 | }; |
| 1542 | 1556 | ||
| 1557 | static struct omap_hwmod_opt_clk dss_rfbi_opt_clks[] = { | ||
| 1558 | { .role = "ick", .clk = "dss_ick" }, | ||
| 1559 | }; | ||
| 1560 | |||
| 1543 | static struct omap_hwmod omap3xxx_dss_rfbi_hwmod = { | 1561 | static struct omap_hwmod omap3xxx_dss_rfbi_hwmod = { |
| 1544 | .name = "dss_rfbi", | 1562 | .name = "dss_rfbi", |
| 1545 | .class = &omap2_rfbi_hwmod_class, | 1563 | .class = &omap2_rfbi_hwmod_class, |
| @@ -1551,6 +1569,8 @@ static struct omap_hwmod omap3xxx_dss_rfbi_hwmod = { | |||
| 1551 | .module_offs = OMAP3430_DSS_MOD, | 1569 | .module_offs = OMAP3430_DSS_MOD, |
| 1552 | }, | 1570 | }, |
| 1553 | }, | 1571 | }, |
| 1572 | .opt_clks = dss_rfbi_opt_clks, | ||
| 1573 | .opt_clks_cnt = ARRAY_SIZE(dss_rfbi_opt_clks), | ||
| 1554 | .slaves = omap3xxx_dss_rfbi_slaves, | 1574 | .slaves = omap3xxx_dss_rfbi_slaves, |
| 1555 | .slaves_cnt = ARRAY_SIZE(omap3xxx_dss_rfbi_slaves), | 1575 | .slaves_cnt = ARRAY_SIZE(omap3xxx_dss_rfbi_slaves), |
| 1556 | .flags = HWMOD_NO_IDLEST, | 1576 | .flags = HWMOD_NO_IDLEST, |
| @@ -1560,7 +1580,7 @@ static struct omap_hwmod omap3xxx_dss_rfbi_hwmod = { | |||
| 1560 | static struct omap_hwmod_ocp_if omap3xxx_l4_core__dss_venc = { | 1580 | static struct omap_hwmod_ocp_if omap3xxx_l4_core__dss_venc = { |
| 1561 | .master = &omap3xxx_l4_core_hwmod, | 1581 | .master = &omap3xxx_l4_core_hwmod, |
| 1562 | .slave = &omap3xxx_dss_venc_hwmod, | 1582 | .slave = &omap3xxx_dss_venc_hwmod, |
| 1563 | .clk = "dss_tv_fck", | 1583 | .clk = "dss_ick", |
| 1564 | .addr = omap2_dss_venc_addrs, | 1584 | .addr = omap2_dss_venc_addrs, |
| 1565 | .fw = { | 1585 | .fw = { |
| 1566 | .omap2 = { | 1586 | .omap2 = { |
| @@ -1578,10 +1598,15 @@ static struct omap_hwmod_ocp_if *omap3xxx_dss_venc_slaves[] = { | |||
| 1578 | &omap3xxx_l4_core__dss_venc, | 1598 | &omap3xxx_l4_core__dss_venc, |
| 1579 | }; | 1599 | }; |
| 1580 | 1600 | ||
| 1601 | static struct omap_hwmod_opt_clk dss_venc_opt_clks[] = { | ||
| 1602 | /* required only on OMAP3430 */ | ||
| 1603 | { .role = "tv_dac_clk", .clk = "dss_96m_fck" }, | ||
| 1604 | }; | ||
| 1605 | |||
| 1581 | static struct omap_hwmod omap3xxx_dss_venc_hwmod = { | 1606 | static struct omap_hwmod omap3xxx_dss_venc_hwmod = { |
| 1582 | .name = "dss_venc", | 1607 | .name = "dss_venc", |
| 1583 | .class = &omap2_venc_hwmod_class, | 1608 | .class = &omap2_venc_hwmod_class, |
| 1584 | .main_clk = "dss1_alwon_fck", | 1609 | .main_clk = "dss_tv_fck", |
| 1585 | .prcm = { | 1610 | .prcm = { |
| 1586 | .omap2 = { | 1611 | .omap2 = { |
| 1587 | .prcm_reg_id = 1, | 1612 | .prcm_reg_id = 1, |
| @@ -1589,6 +1614,8 @@ static struct omap_hwmod omap3xxx_dss_venc_hwmod = { | |||
| 1589 | .module_offs = OMAP3430_DSS_MOD, | 1614 | .module_offs = OMAP3430_DSS_MOD, |
| 1590 | }, | 1615 | }, |
| 1591 | }, | 1616 | }, |
| 1617 | .opt_clks = dss_venc_opt_clks, | ||
| 1618 | .opt_clks_cnt = ARRAY_SIZE(dss_venc_opt_clks), | ||
| 1592 | .slaves = omap3xxx_dss_venc_slaves, | 1619 | .slaves = omap3xxx_dss_venc_slaves, |
| 1593 | .slaves_cnt = ARRAY_SIZE(omap3xxx_dss_venc_slaves), | 1620 | .slaves_cnt = ARRAY_SIZE(omap3xxx_dss_venc_slaves), |
| 1594 | .flags = HWMOD_NO_IDLEST, | 1621 | .flags = HWMOD_NO_IDLEST, |
diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c index 7695e5d43316..daaf165af696 100644 --- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c | |||
| @@ -30,6 +30,7 @@ | |||
| 30 | #include <plat/mmc.h> | 30 | #include <plat/mmc.h> |
| 31 | #include <plat/i2c.h> | 31 | #include <plat/i2c.h> |
| 32 | #include <plat/dmtimer.h> | 32 | #include <plat/dmtimer.h> |
| 33 | #include <plat/common.h> | ||
| 33 | 34 | ||
| 34 | #include "omap_hwmod_common_data.h" | 35 | #include "omap_hwmod_common_data.h" |
| 35 | 36 | ||
| @@ -1187,6 +1188,7 @@ static struct omap_hwmod_class_sysconfig omap44xx_dss_sysc = { | |||
| 1187 | static struct omap_hwmod_class omap44xx_dss_hwmod_class = { | 1188 | static struct omap_hwmod_class omap44xx_dss_hwmod_class = { |
| 1188 | .name = "dss", | 1189 | .name = "dss", |
| 1189 | .sysc = &omap44xx_dss_sysc, | 1190 | .sysc = &omap44xx_dss_sysc, |
| 1191 | .reset = omap_dss_reset, | ||
| 1190 | }; | 1192 | }; |
| 1191 | 1193 | ||
| 1192 | /* dss */ | 1194 | /* dss */ |
| @@ -1240,12 +1242,12 @@ static struct omap_hwmod_ocp_if *omap44xx_dss_slaves[] = { | |||
| 1240 | static struct omap_hwmod_opt_clk dss_opt_clks[] = { | 1242 | static struct omap_hwmod_opt_clk dss_opt_clks[] = { |
| 1241 | { .role = "sys_clk", .clk = "dss_sys_clk" }, | 1243 | { .role = "sys_clk", .clk = "dss_sys_clk" }, |
| 1242 | { .role = "tv_clk", .clk = "dss_tv_clk" }, | 1244 | { .role = "tv_clk", .clk = "dss_tv_clk" }, |
| 1243 | { .role = "dss_clk", .clk = "dss_dss_clk" }, | 1245 | { .role = "hdmi_clk", .clk = "dss_48mhz_clk" }, |
| 1244 | { .role = "video_clk", .clk = "dss_48mhz_clk" }, | ||
| 1245 | }; | 1246 | }; |
| 1246 | 1247 | ||
| 1247 | static struct omap_hwmod omap44xx_dss_hwmod = { | 1248 | static struct omap_hwmod omap44xx_dss_hwmod = { |
| 1248 | .name = "dss_core", | 1249 | .name = "dss_core", |
| 1250 | .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET, | ||
| 1249 | .class = &omap44xx_dss_hwmod_class, | 1251 | .class = &omap44xx_dss_hwmod_class, |
| 1250 | .clkdm_name = "l3_dss_clkdm", | 1252 | .clkdm_name = "l3_dss_clkdm", |
| 1251 | .main_clk = "dss_dss_clk", | 1253 | .main_clk = "dss_dss_clk", |
| @@ -1325,6 +1327,11 @@ static struct omap_hwmod_addr_space omap44xx_dss_dispc_addrs[] = { | |||
| 1325 | { } | 1327 | { } |
| 1326 | }; | 1328 | }; |
| 1327 | 1329 | ||
| 1330 | static struct omap_dss_dispc_dev_attr omap44xx_dss_dispc_dev_attr = { | ||
| 1331 | .manager_count = 3, | ||
| 1332 | .has_framedonetv_irq = 1 | ||
| 1333 | }; | ||
| 1334 | |||
| 1328 | /* l4_per -> dss_dispc */ | 1335 | /* l4_per -> dss_dispc */ |
| 1329 | static struct omap_hwmod_ocp_if omap44xx_l4_per__dss_dispc = { | 1336 | static struct omap_hwmod_ocp_if omap44xx_l4_per__dss_dispc = { |
| 1330 | .master = &omap44xx_l4_per_hwmod, | 1337 | .master = &omap44xx_l4_per_hwmod, |
| @@ -1340,12 +1347,6 @@ static struct omap_hwmod_ocp_if *omap44xx_dss_dispc_slaves[] = { | |||
| 1340 | &omap44xx_l4_per__dss_dispc, | 1347 | &omap44xx_l4_per__dss_dispc, |
| 1341 | }; | 1348 | }; |
| 1342 | 1349 | ||
| 1343 | static struct omap_hwmod_opt_clk dss_dispc_opt_clks[] = { | ||
| 1344 | { .role = "sys_clk", .clk = "dss_sys_clk" }, | ||
| 1345 | { .role = "tv_clk", .clk = "dss_tv_clk" }, | ||
| 1346 | { .role = "hdmi_clk", .clk = "dss_48mhz_clk" }, | ||
| 1347 | }; | ||
| 1348 | |||
| 1349 | static struct omap_hwmod omap44xx_dss_dispc_hwmod = { | 1350 | static struct omap_hwmod omap44xx_dss_dispc_hwmod = { |
| 1350 | .name = "dss_dispc", | 1351 | .name = "dss_dispc", |
| 1351 | .class = &omap44xx_dispc_hwmod_class, | 1352 | .class = &omap44xx_dispc_hwmod_class, |
| @@ -1359,10 +1360,9 @@ static struct omap_hwmod omap44xx_dss_dispc_hwmod = { | |||
| 1359 | .context_offs = OMAP4_RM_DSS_DSS_CONTEXT_OFFSET, | 1360 | .context_offs = OMAP4_RM_DSS_DSS_CONTEXT_OFFSET, |
| 1360 | }, | 1361 | }, |
| 1361 | }, | 1362 | }, |
| 1362 | .opt_clks = dss_dispc_opt_clks, | ||
| 1363 | .opt_clks_cnt = ARRAY_SIZE(dss_dispc_opt_clks), | ||
| 1364 | .slaves = omap44xx_dss_dispc_slaves, | 1363 | .slaves = omap44xx_dss_dispc_slaves, |
| 1365 | .slaves_cnt = ARRAY_SIZE(omap44xx_dss_dispc_slaves), | 1364 | .slaves_cnt = ARRAY_SIZE(omap44xx_dss_dispc_slaves), |
| 1365 | .dev_attr = &omap44xx_dss_dispc_dev_attr | ||
| 1366 | }; | 1366 | }; |
| 1367 | 1367 | ||
| 1368 | /* | 1368 | /* |
| @@ -1624,7 +1624,7 @@ static struct omap_hwmod omap44xx_dss_hdmi_hwmod = { | |||
| 1624 | .clkdm_name = "l3_dss_clkdm", | 1624 | .clkdm_name = "l3_dss_clkdm", |
| 1625 | .mpu_irqs = omap44xx_dss_hdmi_irqs, | 1625 | .mpu_irqs = omap44xx_dss_hdmi_irqs, |
| 1626 | .sdma_reqs = omap44xx_dss_hdmi_sdma_reqs, | 1626 | .sdma_reqs = omap44xx_dss_hdmi_sdma_reqs, |
| 1627 | .main_clk = "dss_dss_clk", | 1627 | .main_clk = "dss_48mhz_clk", |
| 1628 | .prcm = { | 1628 | .prcm = { |
| 1629 | .omap4 = { | 1629 | .omap4 = { |
| 1630 | .clkctrl_offs = OMAP4_CM_DSS_DSS_CLKCTRL_OFFSET, | 1630 | .clkctrl_offs = OMAP4_CM_DSS_DSS_CLKCTRL_OFFSET, |
| @@ -1785,7 +1785,7 @@ static struct omap_hwmod omap44xx_dss_venc_hwmod = { | |||
| 1785 | .name = "dss_venc", | 1785 | .name = "dss_venc", |
| 1786 | .class = &omap44xx_venc_hwmod_class, | 1786 | .class = &omap44xx_venc_hwmod_class, |
| 1787 | .clkdm_name = "l3_dss_clkdm", | 1787 | .clkdm_name = "l3_dss_clkdm", |
| 1788 | .main_clk = "dss_dss_clk", | 1788 | .main_clk = "dss_tv_clk", |
| 1789 | .prcm = { | 1789 | .prcm = { |
| 1790 | .omap4 = { | 1790 | .omap4 = { |
| 1791 | .clkctrl_offs = OMAP4_CM_DSS_DSS_CLKCTRL_OFFSET, | 1791 | .clkctrl_offs = OMAP4_CM_DSS_DSS_CLKCTRL_OFFSET, |
diff --git a/arch/arm/mach-omap2/omap_hwmod_common_data.c b/arch/arm/mach-omap2/omap_hwmod_common_data.c index de832ebc93a9..51e5418899fb 100644 --- a/arch/arm/mach-omap2/omap_hwmod_common_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_common_data.c | |||
| @@ -49,3 +49,7 @@ struct omap_hwmod_sysc_fields omap_hwmod_sysc_type2 = { | |||
| 49 | .srst_shift = SYSC_TYPE2_SOFTRESET_SHIFT, | 49 | .srst_shift = SYSC_TYPE2_SOFTRESET_SHIFT, |
| 50 | }; | 50 | }; |
| 51 | 51 | ||
| 52 | struct omap_dss_dispc_dev_attr omap2_3_dss_dispc_dev_attr = { | ||
| 53 | .manager_count = 2, | ||
| 54 | .has_framedonetv_irq = 0 | ||
| 55 | }; | ||
diff --git a/arch/arm/mach-omap2/omap_hwmod_common_data.h b/arch/arm/mach-omap2/omap_hwmod_common_data.h index 39a7c37f4587..ad5d8f04c0b8 100644 --- a/arch/arm/mach-omap2/omap_hwmod_common_data.h +++ b/arch/arm/mach-omap2/omap_hwmod_common_data.h | |||
| @@ -16,6 +16,8 @@ | |||
| 16 | 16 | ||
| 17 | #include <plat/omap_hwmod.h> | 17 | #include <plat/omap_hwmod.h> |
| 18 | 18 | ||
| 19 | #include "display.h" | ||
| 20 | |||
| 19 | /* Common address space across OMAP2xxx */ | 21 | /* Common address space across OMAP2xxx */ |
| 20 | extern struct omap_hwmod_addr_space omap2xxx_uart1_addr_space[]; | 22 | extern struct omap_hwmod_addr_space omap2xxx_uart1_addr_space[]; |
| 21 | extern struct omap_hwmod_addr_space omap2xxx_uart2_addr_space[]; | 23 | extern struct omap_hwmod_addr_space omap2xxx_uart2_addr_space[]; |
| @@ -111,4 +113,6 @@ extern struct omap_hwmod_class omap2xxx_dma_hwmod_class; | |||
| 111 | extern struct omap_hwmod_class omap2xxx_mailbox_hwmod_class; | 113 | extern struct omap_hwmod_class omap2xxx_mailbox_hwmod_class; |
| 112 | extern struct omap_hwmod_class omap2xxx_mcspi_class; | 114 | extern struct omap_hwmod_class omap2xxx_mcspi_class; |
| 113 | 115 | ||
| 116 | extern struct omap_dss_dispc_dev_attr omap2_3_dss_dispc_dev_attr; | ||
| 117 | |||
| 114 | #endif | 118 | #endif |
diff --git a/arch/arm/mach-omap2/omap_l3_noc.c b/arch/arm/mach-omap2/omap_l3_noc.c index 6a66aa5e2a5b..d15225ff5c49 100644 --- a/arch/arm/mach-omap2/omap_l3_noc.c +++ b/arch/arm/mach-omap2/omap_l3_noc.c | |||
| @@ -237,7 +237,7 @@ static int __devexit omap4_l3_remove(struct platform_device *pdev) | |||
| 237 | static const struct of_device_id l3_noc_match[] = { | 237 | static const struct of_device_id l3_noc_match[] = { |
| 238 | {.compatible = "ti,omap4-l3-noc", }, | 238 | {.compatible = "ti,omap4-l3-noc", }, |
| 239 | {}, | 239 | {}, |
| 240 | } | 240 | }; |
| 241 | MODULE_DEVICE_TABLE(of, l3_noc_match); | 241 | MODULE_DEVICE_TABLE(of, l3_noc_match); |
| 242 | #else | 242 | #else |
| 243 | #define l3_noc_match NULL | 243 | #define l3_noc_match NULL |
diff --git a/arch/arm/mach-omap2/pm.c b/arch/arm/mach-omap2/pm.c index 1e79bdf313e3..00bff46ca48b 100644 --- a/arch/arm/mach-omap2/pm.c +++ b/arch/arm/mach-omap2/pm.c | |||
| @@ -24,6 +24,7 @@ | |||
| 24 | #include "powerdomain.h" | 24 | #include "powerdomain.h" |
| 25 | #include "clockdomain.h" | 25 | #include "clockdomain.h" |
| 26 | #include "pm.h" | 26 | #include "pm.h" |
| 27 | #include "twl-common.h" | ||
| 27 | 28 | ||
| 28 | static struct omap_device_pm_latency *pm_lats; | 29 | static struct omap_device_pm_latency *pm_lats; |
| 29 | 30 | ||
| @@ -226,11 +227,8 @@ postcore_initcall(omap2_common_pm_init); | |||
| 226 | 227 | ||
| 227 | static int __init omap2_common_pm_late_init(void) | 228 | static int __init omap2_common_pm_late_init(void) |
| 228 | { | 229 | { |
| 229 | /* Init the OMAP TWL parameters */ | ||
| 230 | omap3_twl_init(); | ||
| 231 | omap4_twl_init(); | ||
| 232 | |||
| 233 | /* Init the voltage layer */ | 230 | /* Init the voltage layer */ |
| 231 | omap_pmic_late_init(); | ||
| 234 | omap_voltage_late_init(); | 232 | omap_voltage_late_init(); |
| 235 | 233 | ||
| 236 | /* Initialize the voltages */ | 234 | /* Initialize the voltages */ |
diff --git a/arch/arm/mach-omap2/smartreflex.c b/arch/arm/mach-omap2/smartreflex.c index 6a4f6839a7d9..cf246b39bac7 100644 --- a/arch/arm/mach-omap2/smartreflex.c +++ b/arch/arm/mach-omap2/smartreflex.c | |||
| @@ -139,7 +139,7 @@ static irqreturn_t sr_interrupt(int irq, void *data) | |||
| 139 | sr_write_reg(sr_info, ERRCONFIG_V1, status); | 139 | sr_write_reg(sr_info, ERRCONFIG_V1, status); |
| 140 | } else if (sr_info->ip_type == SR_TYPE_V2) { | 140 | } else if (sr_info->ip_type == SR_TYPE_V2) { |
| 141 | /* Read the status bits */ | 141 | /* Read the status bits */ |
| 142 | sr_read_reg(sr_info, IRQSTATUS); | 142 | status = sr_read_reg(sr_info, IRQSTATUS); |
| 143 | 143 | ||
| 144 | /* Clear them by writing back */ | 144 | /* Clear them by writing back */ |
| 145 | sr_write_reg(sr_info, IRQSTATUS, status); | 145 | sr_write_reg(sr_info, IRQSTATUS, status); |
diff --git a/arch/arm/mach-omap2/twl-common.c b/arch/arm/mach-omap2/twl-common.c index 522435772168..10b20c652e5d 100644 --- a/arch/arm/mach-omap2/twl-common.c +++ b/arch/arm/mach-omap2/twl-common.c | |||
| @@ -30,6 +30,7 @@ | |||
| 30 | #include <plat/usb.h> | 30 | #include <plat/usb.h> |
| 31 | 31 | ||
| 32 | #include "twl-common.h" | 32 | #include "twl-common.h" |
| 33 | #include "pm.h" | ||
| 33 | 34 | ||
| 34 | static struct i2c_board_info __initdata pmic_i2c_board_info = { | 35 | static struct i2c_board_info __initdata pmic_i2c_board_info = { |
| 35 | .addr = 0x48, | 36 | .addr = 0x48, |
| @@ -48,6 +49,16 @@ void __init omap_pmic_init(int bus, u32 clkrate, | |||
| 48 | omap_register_i2c_bus(bus, clkrate, &pmic_i2c_board_info, 1); | 49 | omap_register_i2c_bus(bus, clkrate, &pmic_i2c_board_info, 1); |
| 49 | } | 50 | } |
| 50 | 51 | ||
| 52 | void __init omap_pmic_late_init(void) | ||
| 53 | { | ||
| 54 | /* Init the OMAP TWL parameters (if PMIC has been registerd) */ | ||
| 55 | if (!pmic_i2c_board_info.irq) | ||
| 56 | return; | ||
| 57 | |||
| 58 | omap3_twl_init(); | ||
| 59 | omap4_twl_init(); | ||
| 60 | } | ||
| 61 | |||
| 51 | #if defined(CONFIG_ARCH_OMAP3) | 62 | #if defined(CONFIG_ARCH_OMAP3) |
| 52 | static struct twl4030_usb_data omap3_usb_pdata = { | 63 | static struct twl4030_usb_data omap3_usb_pdata = { |
| 53 | .usb_mode = T2_USB_MODE_ULPI, | 64 | .usb_mode = T2_USB_MODE_ULPI, |
diff --git a/arch/arm/mach-omap2/twl-common.h b/arch/arm/mach-omap2/twl-common.h index 5e83a5bd37fb..275dde8cb27a 100644 --- a/arch/arm/mach-omap2/twl-common.h +++ b/arch/arm/mach-omap2/twl-common.h | |||
| @@ -1,6 +1,8 @@ | |||
| 1 | #ifndef __OMAP_PMIC_COMMON__ | 1 | #ifndef __OMAP_PMIC_COMMON__ |
| 2 | #define __OMAP_PMIC_COMMON__ | 2 | #define __OMAP_PMIC_COMMON__ |
| 3 | 3 | ||
| 4 | #include <plat/irqs.h> | ||
| 5 | |||
| 4 | #define TWL_COMMON_PDATA_USB (1 << 0) | 6 | #define TWL_COMMON_PDATA_USB (1 << 0) |
| 5 | #define TWL_COMMON_PDATA_BCI (1 << 1) | 7 | #define TWL_COMMON_PDATA_BCI (1 << 1) |
| 6 | #define TWL_COMMON_PDATA_MADC (1 << 2) | 8 | #define TWL_COMMON_PDATA_MADC (1 << 2) |
| @@ -30,6 +32,7 @@ struct twl4030_platform_data; | |||
| 30 | 32 | ||
| 31 | void omap_pmic_init(int bus, u32 clkrate, const char *pmic_type, int pmic_irq, | 33 | void omap_pmic_init(int bus, u32 clkrate, const char *pmic_type, int pmic_irq, |
| 32 | struct twl4030_platform_data *pmic_data); | 34 | struct twl4030_platform_data *pmic_data); |
| 35 | void omap_pmic_late_init(void); | ||
| 33 | 36 | ||
| 34 | static inline void omap2_pmic_init(const char *pmic_type, | 37 | static inline void omap2_pmic_init(const char *pmic_type, |
| 35 | struct twl4030_platform_data *pmic_data) | 38 | struct twl4030_platform_data *pmic_data) |
diff --git a/arch/arm/mach-pxa/balloon3.c b/arch/arm/mach-pxa/balloon3.c index fc0b8544e174..4b81f59a4cba 100644 --- a/arch/arm/mach-pxa/balloon3.c +++ b/arch/arm/mach-pxa/balloon3.c | |||
| @@ -307,7 +307,7 @@ static inline void balloon3_mmc_init(void) {} | |||
| 307 | /****************************************************************************** | 307 | /****************************************************************************** |
| 308 | * USB Gadget | 308 | * USB Gadget |
| 309 | ******************************************************************************/ | 309 | ******************************************************************************/ |
| 310 | #if defined(CONFIG_USB_GADGET_PXA27X)||defined(CONFIG_USB_GADGET_PXA27X_MODULE) | 310 | #if defined(CONFIG_USB_PXA27X)||defined(CONFIG_USB_PXA27X_MODULE) |
| 311 | static void balloon3_udc_command(int cmd) | 311 | static void balloon3_udc_command(int cmd) |
| 312 | { | 312 | { |
| 313 | if (cmd == PXA2XX_UDC_CMD_CONNECT) | 313 | if (cmd == PXA2XX_UDC_CMD_CONNECT) |
diff --git a/arch/arm/mach-pxa/colibri-pxa320.c b/arch/arm/mach-pxa/colibri-pxa320.c index 692e1ffc5586..d23b92b80488 100644 --- a/arch/arm/mach-pxa/colibri-pxa320.c +++ b/arch/arm/mach-pxa/colibri-pxa320.c | |||
| @@ -146,7 +146,7 @@ static void __init colibri_pxa320_init_eth(void) | |||
| 146 | static inline void __init colibri_pxa320_init_eth(void) {} | 146 | static inline void __init colibri_pxa320_init_eth(void) {} |
| 147 | #endif /* CONFIG_AX88796 */ | 147 | #endif /* CONFIG_AX88796 */ |
| 148 | 148 | ||
| 149 | #if defined(CONFIG_USB_GADGET_PXA27X)||defined(CONFIG_USB_GADGET_PXA27X_MODULE) | 149 | #if defined(CONFIG_USB_PXA27X)||defined(CONFIG_USB_PXA27X_MODULE) |
| 150 | static struct gpio_vbus_mach_info colibri_pxa320_gpio_vbus_info = { | 150 | static struct gpio_vbus_mach_info colibri_pxa320_gpio_vbus_info = { |
| 151 | .gpio_vbus = mfp_to_gpio(MFP_PIN_GPIO96), | 151 | .gpio_vbus = mfp_to_gpio(MFP_PIN_GPIO96), |
| 152 | .gpio_pullup = -1, | 152 | .gpio_pullup = -1, |
diff --git a/arch/arm/mach-pxa/gumstix.c b/arch/arm/mach-pxa/gumstix.c index 9c8208ca0415..ffdd70dad327 100644 --- a/arch/arm/mach-pxa/gumstix.c +++ b/arch/arm/mach-pxa/gumstix.c | |||
| @@ -106,7 +106,7 @@ static void __init gumstix_mmc_init(void) | |||
| 106 | } | 106 | } |
| 107 | #endif | 107 | #endif |
| 108 | 108 | ||
| 109 | #ifdef CONFIG_USB_GADGET_PXA25X | 109 | #ifdef CONFIG_USB_PXA25X |
| 110 | static struct gpio_vbus_mach_info gumstix_udc_info = { | 110 | static struct gpio_vbus_mach_info gumstix_udc_info = { |
| 111 | .gpio_vbus = GPIO_GUMSTIX_USB_GPIOn, | 111 | .gpio_vbus = GPIO_GUMSTIX_USB_GPIOn, |
| 112 | .gpio_pullup = GPIO_GUMSTIX_USB_GPIOx, | 112 | .gpio_pullup = GPIO_GUMSTIX_USB_GPIOx, |
diff --git a/arch/arm/mach-pxa/include/mach/palm27x.h b/arch/arm/mach-pxa/include/mach/palm27x.h index f80bbe246afe..d4eac3d6ffb5 100644 --- a/arch/arm/mach-pxa/include/mach/palm27x.h +++ b/arch/arm/mach-pxa/include/mach/palm27x.h | |||
| @@ -37,8 +37,8 @@ extern void __init palm27x_lcd_init(int power, | |||
| 37 | #define palm27x_lcd_init(power, mode) do {} while (0) | 37 | #define palm27x_lcd_init(power, mode) do {} while (0) |
| 38 | #endif | 38 | #endif |
| 39 | 39 | ||
| 40 | #if defined(CONFIG_USB_GADGET_PXA27X) || \ | 40 | #if defined(CONFIG_USB_PXA27X) || \ |
| 41 | defined(CONFIG_USB_GADGET_PXA27X_MODULE) | 41 | defined(CONFIG_USB_PXA27X_MODULE) |
| 42 | extern void __init palm27x_udc_init(int vbus, int pullup, | 42 | extern void __init palm27x_udc_init(int vbus, int pullup, |
| 43 | int vbus_inverted); | 43 | int vbus_inverted); |
| 44 | #else | 44 | #else |
diff --git a/arch/arm/mach-pxa/palm27x.c b/arch/arm/mach-pxa/palm27x.c index 325c245c0a0d..fbc10d7b95d1 100644 --- a/arch/arm/mach-pxa/palm27x.c +++ b/arch/arm/mach-pxa/palm27x.c | |||
| @@ -164,8 +164,8 @@ void __init palm27x_lcd_init(int power, struct pxafb_mode_info *mode) | |||
| 164 | /****************************************************************************** | 164 | /****************************************************************************** |
| 165 | * USB Gadget | 165 | * USB Gadget |
| 166 | ******************************************************************************/ | 166 | ******************************************************************************/ |
| 167 | #if defined(CONFIG_USB_GADGET_PXA27X) || \ | 167 | #if defined(CONFIG_USB_PXA27X) || \ |
| 168 | defined(CONFIG_USB_GADGET_PXA27X_MODULE) | 168 | defined(CONFIG_USB_PXA27X_MODULE) |
| 169 | static struct gpio_vbus_mach_info palm27x_udc_info = { | 169 | static struct gpio_vbus_mach_info palm27x_udc_info = { |
| 170 | .gpio_vbus_inverted = 1, | 170 | .gpio_vbus_inverted = 1, |
| 171 | }; | 171 | }; |
diff --git a/arch/arm/mach-pxa/palmtc.c b/arch/arm/mach-pxa/palmtc.c index 6ec7caefb37c..2c24c67fd92b 100644 --- a/arch/arm/mach-pxa/palmtc.c +++ b/arch/arm/mach-pxa/palmtc.c | |||
| @@ -338,7 +338,7 @@ static inline void palmtc_mkp_init(void) {} | |||
| 338 | /****************************************************************************** | 338 | /****************************************************************************** |
| 339 | * UDC | 339 | * UDC |
| 340 | ******************************************************************************/ | 340 | ******************************************************************************/ |
| 341 | #if defined(CONFIG_USB_GADGET_PXA25X)||defined(CONFIG_USB_GADGET_PXA25X_MODULE) | 341 | #if defined(CONFIG_USB_PXA25X)||defined(CONFIG_USB_PXA25X_MODULE) |
| 342 | static struct gpio_vbus_mach_info palmtc_udc_info = { | 342 | static struct gpio_vbus_mach_info palmtc_udc_info = { |
| 343 | .gpio_vbus = GPIO_NR_PALMTC_USB_DETECT_N, | 343 | .gpio_vbus = GPIO_NR_PALMTC_USB_DETECT_N, |
| 344 | .gpio_vbus_inverted = 1, | 344 | .gpio_vbus_inverted = 1, |
diff --git a/arch/arm/mach-pxa/vpac270.c b/arch/arm/mach-pxa/vpac270.c index a7539a6ed1ff..ca0c6615028c 100644 --- a/arch/arm/mach-pxa/vpac270.c +++ b/arch/arm/mach-pxa/vpac270.c | |||
| @@ -343,7 +343,7 @@ static inline void vpac270_uhc_init(void) {} | |||
| 343 | /****************************************************************************** | 343 | /****************************************************************************** |
| 344 | * USB Gadget | 344 | * USB Gadget |
| 345 | ******************************************************************************/ | 345 | ******************************************************************************/ |
| 346 | #if defined(CONFIG_USB_GADGET_PXA27X)||defined(CONFIG_USB_GADGET_PXA27X_MODULE) | 346 | #if defined(CONFIG_USB_PXA27X)||defined(CONFIG_USB_PXA27X_MODULE) |
| 347 | static struct gpio_vbus_mach_info vpac270_gpio_vbus_info = { | 347 | static struct gpio_vbus_mach_info vpac270_gpio_vbus_info = { |
| 348 | .gpio_vbus = GPIO41_VPAC270_UDC_DETECT, | 348 | .gpio_vbus = GPIO41_VPAC270_UDC_DETECT, |
| 349 | .gpio_pullup = -1, | 349 | .gpio_pullup = -1, |
diff --git a/arch/arm/mach-s3c64xx/mach-crag6410-module.c b/arch/arm/mach-s3c64xx/mach-crag6410-module.c index 66668565ee75..f208154b1382 100644 --- a/arch/arm/mach-s3c64xx/mach-crag6410-module.c +++ b/arch/arm/mach-s3c64xx/mach-crag6410-module.c | |||
| @@ -8,7 +8,7 @@ | |||
| 8 | * published by the Free Software Foundation. | 8 | * published by the Free Software Foundation. |
| 9 | */ | 9 | */ |
| 10 | 10 | ||
| 11 | #include <linux/module.h> | 11 | #include <linux/export.h> |
| 12 | #include <linux/interrupt.h> | 12 | #include <linux/interrupt.h> |
| 13 | #include <linux/i2c.h> | 13 | #include <linux/i2c.h> |
| 14 | 14 | ||
diff --git a/arch/arm/mm/cache-l2x0.c b/arch/arm/mm/cache-l2x0.c index 8ac9e9f84790..b1e192ba8c24 100644 --- a/arch/arm/mm/cache-l2x0.c +++ b/arch/arm/mm/cache-l2x0.c | |||
| @@ -61,7 +61,7 @@ static inline void cache_sync(void) | |||
| 61 | { | 61 | { |
| 62 | void __iomem *base = l2x0_base; | 62 | void __iomem *base = l2x0_base; |
| 63 | 63 | ||
| 64 | #ifdef CONFIG_ARM_ERRATA_753970 | 64 | #ifdef CONFIG_PL310_ERRATA_753970 |
| 65 | /* write to an unmmapped register */ | 65 | /* write to an unmmapped register */ |
| 66 | writel_relaxed(0, base + L2X0_DUMMY_REG); | 66 | writel_relaxed(0, base + L2X0_DUMMY_REG); |
| 67 | #else | 67 | #else |
diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c index e4e7f6cba1ab..1aa664a1999f 100644 --- a/arch/arm/mm/dma-mapping.c +++ b/arch/arm/mm/dma-mapping.c | |||
| @@ -168,7 +168,7 @@ static int __init consistent_init(void) | |||
| 168 | pte_t *pte; | 168 | pte_t *pte; |
| 169 | int i = 0; | 169 | int i = 0; |
| 170 | unsigned long base = consistent_base; | 170 | unsigned long base = consistent_base; |
| 171 | unsigned long num_ptes = (CONSISTENT_END - base) >> PGDIR_SHIFT; | 171 | unsigned long num_ptes = (CONSISTENT_END - base) >> PMD_SHIFT; |
| 172 | 172 | ||
| 173 | consistent_pte = kmalloc(num_ptes * sizeof(pte_t), GFP_KERNEL); | 173 | consistent_pte = kmalloc(num_ptes * sizeof(pte_t), GFP_KERNEL); |
| 174 | if (!consistent_pte) { | 174 | if (!consistent_pte) { |
| @@ -332,6 +332,15 @@ __dma_alloc(struct device *dev, size_t size, dma_addr_t *handle, gfp_t gfp, | |||
| 332 | struct page *page; | 332 | struct page *page; |
| 333 | void *addr; | 333 | void *addr; |
| 334 | 334 | ||
| 335 | /* | ||
| 336 | * Following is a work-around (a.k.a. hack) to prevent pages | ||
| 337 | * with __GFP_COMP being passed to split_page() which cannot | ||
| 338 | * handle them. The real problem is that this flag probably | ||
| 339 | * should be 0 on ARM as it is not supported on this | ||
| 340 | * platform; see CONFIG_HUGETLBFS. | ||
| 341 | */ | ||
| 342 | gfp &= ~(__GFP_COMP); | ||
| 343 | |||
| 335 | *handle = ~0; | 344 | *handle = ~0; |
| 336 | size = PAGE_ALIGN(size); | 345 | size = PAGE_ALIGN(size); |
| 337 | 346 | ||
diff --git a/arch/arm/mm/mmap.c b/arch/arm/mm/mmap.c index 74be05f3e03a..44b628e4d6ea 100644 --- a/arch/arm/mm/mmap.c +++ b/arch/arm/mm/mmap.c | |||
| @@ -9,8 +9,7 @@ | |||
| 9 | #include <linux/io.h> | 9 | #include <linux/io.h> |
| 10 | #include <linux/personality.h> | 10 | #include <linux/personality.h> |
| 11 | #include <linux/random.h> | 11 | #include <linux/random.h> |
| 12 | #include <asm/cputype.h> | 12 | #include <asm/cachetype.h> |
| 13 | #include <asm/system.h> | ||
| 14 | 13 | ||
| 15 | #define COLOUR_ALIGN(addr,pgoff) \ | 14 | #define COLOUR_ALIGN(addr,pgoff) \ |
| 16 | ((((addr)+SHMLBA-1)&~(SHMLBA-1)) + \ | 15 | ((((addr)+SHMLBA-1)&~(SHMLBA-1)) + \ |
| @@ -32,25 +31,15 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr, | |||
| 32 | struct mm_struct *mm = current->mm; | 31 | struct mm_struct *mm = current->mm; |
| 33 | struct vm_area_struct *vma; | 32 | struct vm_area_struct *vma; |
| 34 | unsigned long start_addr; | 33 | unsigned long start_addr; |
| 35 | #if defined(CONFIG_CPU_V6) || defined(CONFIG_CPU_V6K) | 34 | int do_align = 0; |
| 36 | unsigned int cache_type; | 35 | int aliasing = cache_is_vipt_aliasing(); |
| 37 | int do_align = 0, aliasing = 0; | ||
| 38 | 36 | ||
| 39 | /* | 37 | /* |
| 40 | * We only need to do colour alignment if either the I or D | 38 | * We only need to do colour alignment if either the I or D |
| 41 | * caches alias. This is indicated by bits 9 and 21 of the | 39 | * caches alias. |
| 42 | * cache type register. | ||
| 43 | */ | 40 | */ |
| 44 | cache_type = read_cpuid_cachetype(); | 41 | if (aliasing) |
| 45 | if (cache_type != read_cpuid_id()) { | 42 | do_align = filp || (flags & MAP_SHARED); |
| 46 | aliasing = (cache_type | cache_type >> 12) & (1 << 11); | ||
| 47 | if (aliasing) | ||
| 48 | do_align = filp || flags & MAP_SHARED; | ||
| 49 | } | ||
| 50 | #else | ||
| 51 | #define do_align 0 | ||
| 52 | #define aliasing 0 | ||
| 53 | #endif | ||
| 54 | 43 | ||
| 55 | /* | 44 | /* |
| 56 | * We enforce the MAP_FIXED case. | 45 | * We enforce the MAP_FIXED case. |
diff --git a/arch/arm/plat-mxc/include/mach/common.h b/arch/arm/plat-mxc/include/mach/common.h index 83b745a5e1b7..c75f254abd85 100644 --- a/arch/arm/plat-mxc/include/mach/common.h +++ b/arch/arm/plat-mxc/include/mach/common.h | |||
| @@ -85,7 +85,6 @@ enum mxc_cpu_pwr_mode { | |||
| 85 | }; | 85 | }; |
| 86 | 86 | ||
| 87 | extern void mx5_cpu_lp_set(enum mxc_cpu_pwr_mode mode); | 87 | extern void mx5_cpu_lp_set(enum mxc_cpu_pwr_mode mode); |
| 88 | extern void (*imx_idle)(void); | ||
| 89 | extern void imx_print_silicon_rev(const char *cpu, int srev); | 88 | extern void imx_print_silicon_rev(const char *cpu, int srev); |
| 90 | 89 | ||
| 91 | void avic_handle_irq(struct pt_regs *); | 90 | void avic_handle_irq(struct pt_regs *); |
| @@ -133,4 +132,5 @@ extern void imx53_qsb_common_init(void); | |||
| 133 | extern void imx53_smd_common_init(void); | 132 | extern void imx53_smd_common_init(void); |
| 134 | extern int imx6q_set_lpm(enum mxc_cpu_pwr_mode mode); | 133 | extern int imx6q_set_lpm(enum mxc_cpu_pwr_mode mode); |
| 135 | extern void imx6q_pm_init(void); | 134 | extern void imx6q_pm_init(void); |
| 135 | extern void imx6q_clock_map_io(void); | ||
| 136 | #endif | 136 | #endif |
diff --git a/arch/arm/plat-mxc/include/mach/mxc.h b/arch/arm/plat-mxc/include/mach/mxc.h index 00a78193c681..a4d36d601d55 100644 --- a/arch/arm/plat-mxc/include/mach/mxc.h +++ b/arch/arm/plat-mxc/include/mach/mxc.h | |||
| @@ -50,20 +50,6 @@ | |||
| 50 | #define IMX_CHIP_REVISION_3_3 0x33 | 50 | #define IMX_CHIP_REVISION_3_3 0x33 |
| 51 | #define IMX_CHIP_REVISION_UNKNOWN 0xff | 51 | #define IMX_CHIP_REVISION_UNKNOWN 0xff |
| 52 | 52 | ||
| 53 | #define IMX_CHIP_REVISION_1_0_STRING "1.0" | ||
| 54 | #define IMX_CHIP_REVISION_1_1_STRING "1.1" | ||
| 55 | #define IMX_CHIP_REVISION_1_2_STRING "1.2" | ||
| 56 | #define IMX_CHIP_REVISION_1_3_STRING "1.3" | ||
| 57 | #define IMX_CHIP_REVISION_2_0_STRING "2.0" | ||
| 58 | #define IMX_CHIP_REVISION_2_1_STRING "2.1" | ||
| 59 | #define IMX_CHIP_REVISION_2_2_STRING "2.2" | ||
| 60 | #define IMX_CHIP_REVISION_2_3_STRING "2.3" | ||
| 61 | #define IMX_CHIP_REVISION_3_0_STRING "3.0" | ||
| 62 | #define IMX_CHIP_REVISION_3_1_STRING "3.1" | ||
| 63 | #define IMX_CHIP_REVISION_3_2_STRING "3.2" | ||
| 64 | #define IMX_CHIP_REVISION_3_3_STRING "3.3" | ||
| 65 | #define IMX_CHIP_REVISION_UNKNOWN_STRING "unknown" | ||
| 66 | |||
| 67 | #ifndef __ASSEMBLY__ | 53 | #ifndef __ASSEMBLY__ |
| 68 | extern unsigned int __mxc_cpu_type; | 54 | extern unsigned int __mxc_cpu_type; |
| 69 | #endif | 55 | #endif |
diff --git a/arch/arm/plat-mxc/include/mach/system.h b/arch/arm/plat-mxc/include/mach/system.h index cf88b3593fba..b9895d250167 100644 --- a/arch/arm/plat-mxc/include/mach/system.h +++ b/arch/arm/plat-mxc/include/mach/system.h | |||
| @@ -17,14 +17,9 @@ | |||
| 17 | #ifndef __ASM_ARCH_MXC_SYSTEM_H__ | 17 | #ifndef __ASM_ARCH_MXC_SYSTEM_H__ |
| 18 | #define __ASM_ARCH_MXC_SYSTEM_H__ | 18 | #define __ASM_ARCH_MXC_SYSTEM_H__ |
| 19 | 19 | ||
| 20 | extern void (*imx_idle)(void); | ||
| 21 | |||
| 22 | static inline void arch_idle(void) | 20 | static inline void arch_idle(void) |
| 23 | { | 21 | { |
| 24 | if (imx_idle != NULL) | 22 | cpu_do_idle(); |
| 25 | (imx_idle)(); | ||
| 26 | else | ||
| 27 | cpu_do_idle(); | ||
| 28 | } | 23 | } |
| 29 | 24 | ||
| 30 | void arch_reset(char mode, const char *cmd); | 25 | void arch_reset(char mode, const char *cmd); |
diff --git a/arch/arm/plat-mxc/system.c b/arch/arm/plat-mxc/system.c index 9dad8dcc2ea9..d65fb31a55ca 100644 --- a/arch/arm/plat-mxc/system.c +++ b/arch/arm/plat-mxc/system.c | |||
| @@ -21,6 +21,7 @@ | |||
| 21 | #include <linux/io.h> | 21 | #include <linux/io.h> |
| 22 | #include <linux/err.h> | 22 | #include <linux/err.h> |
| 23 | #include <linux/delay.h> | 23 | #include <linux/delay.h> |
| 24 | #include <linux/module.h> | ||
| 24 | 25 | ||
| 25 | #include <mach/hardware.h> | 26 | #include <mach/hardware.h> |
| 26 | #include <mach/common.h> | 27 | #include <mach/common.h> |
| @@ -28,8 +29,8 @@ | |||
| 28 | #include <asm/system.h> | 29 | #include <asm/system.h> |
| 29 | #include <asm/mach-types.h> | 30 | #include <asm/mach-types.h> |
| 30 | 31 | ||
| 31 | void (*imx_idle)(void) = NULL; | ||
| 32 | void __iomem *(*imx_ioremap)(unsigned long, size_t, unsigned int) = NULL; | 32 | void __iomem *(*imx_ioremap)(unsigned long, size_t, unsigned int) = NULL; |
| 33 | EXPORT_SYMBOL_GPL(imx_ioremap); | ||
| 33 | 34 | ||
| 34 | static void __iomem *wdog_base; | 35 | static void __iomem *wdog_base; |
| 35 | 36 | ||
diff --git a/arch/arm/plat-omap/include/plat/clock.h b/arch/arm/plat-omap/include/plat/clock.h index 197ca03c3f7d..eb73ab40e955 100644 --- a/arch/arm/plat-omap/include/plat/clock.h +++ b/arch/arm/plat-omap/include/plat/clock.h | |||
| @@ -165,8 +165,8 @@ struct dpll_data { | |||
| 165 | u8 auto_recal_bit; | 165 | u8 auto_recal_bit; |
| 166 | u8 recal_en_bit; | 166 | u8 recal_en_bit; |
| 167 | u8 recal_st_bit; | 167 | u8 recal_st_bit; |
| 168 | u8 flags; | ||
| 169 | # endif | 168 | # endif |
| 169 | u8 flags; | ||
| 170 | }; | 170 | }; |
| 171 | 171 | ||
| 172 | #endif | 172 | #endif |
diff --git a/arch/arm/plat-omap/include/plat/common.h b/arch/arm/plat-omap/include/plat/common.h index c50df4814f6f..3ff3e36580f2 100644 --- a/arch/arm/plat-omap/include/plat/common.h +++ b/arch/arm/plat-omap/include/plat/common.h | |||
| @@ -30,6 +30,7 @@ | |||
| 30 | #include <linux/delay.h> | 30 | #include <linux/delay.h> |
| 31 | 31 | ||
| 32 | #include <plat/i2c.h> | 32 | #include <plat/i2c.h> |
| 33 | #include <plat/omap_hwmod.h> | ||
| 33 | 34 | ||
| 34 | struct sys_timer; | 35 | struct sys_timer; |
| 35 | 36 | ||
| @@ -55,6 +56,8 @@ void am35xx_init_early(void); | |||
| 55 | void ti816x_init_early(void); | 56 | void ti816x_init_early(void); |
| 56 | void omap4430_init_early(void); | 57 | void omap4430_init_early(void); |
| 57 | 58 | ||
| 59 | extern int omap_dss_reset(struct omap_hwmod *); | ||
| 60 | |||
| 58 | void omap_sram_init(void); | 61 | void omap_sram_init(void); |
| 59 | 62 | ||
| 60 | /* | 63 | /* |
diff --git a/arch/arm/plat-s3c24xx/cpu-freq-debugfs.c b/arch/arm/plat-s3c24xx/cpu-freq-debugfs.c index a9276667c2fb..c7adad0e8de0 100644 --- a/arch/arm/plat-s3c24xx/cpu-freq-debugfs.c +++ b/arch/arm/plat-s3c24xx/cpu-freq-debugfs.c | |||
| @@ -12,7 +12,7 @@ | |||
| 12 | */ | 12 | */ |
| 13 | 13 | ||
| 14 | #include <linux/init.h> | 14 | #include <linux/init.h> |
| 15 | #include <linux/module.h> | 15 | #include <linux/export.h> |
| 16 | #include <linux/interrupt.h> | 16 | #include <linux/interrupt.h> |
| 17 | #include <linux/ioport.h> | 17 | #include <linux/ioport.h> |
| 18 | #include <linux/cpufreq.h> | 18 | #include <linux/cpufreq.h> |
diff --git a/arch/arm/plat-s5p/sysmmu.c b/arch/arm/plat-s5p/sysmmu.c index e1cbc728c775..c8bec9c7655d 100644 --- a/arch/arm/plat-s5p/sysmmu.c +++ b/arch/arm/plat-s5p/sysmmu.c | |||
| @@ -11,6 +11,7 @@ | |||
| 11 | #include <linux/io.h> | 11 | #include <linux/io.h> |
| 12 | #include <linux/interrupt.h> | 12 | #include <linux/interrupt.h> |
| 13 | #include <linux/platform_device.h> | 13 | #include <linux/platform_device.h> |
| 14 | #include <linux/export.h> | ||
| 14 | 15 | ||
| 15 | #include <asm/pgtable.h> | 16 | #include <asm/pgtable.h> |
| 16 | 17 | ||
diff --git a/arch/arm/plat-samsung/include/plat/gpio-cfg.h b/arch/arm/plat-samsung/include/plat/gpio-cfg.h index d48245bb02b3..df8155b9d4d1 100644 --- a/arch/arm/plat-samsung/include/plat/gpio-cfg.h +++ b/arch/arm/plat-samsung/include/plat/gpio-cfg.h | |||
| @@ -24,6 +24,8 @@ | |||
| 24 | #ifndef __PLAT_GPIO_CFG_H | 24 | #ifndef __PLAT_GPIO_CFG_H |
| 25 | #define __PLAT_GPIO_CFG_H __FILE__ | 25 | #define __PLAT_GPIO_CFG_H __FILE__ |
| 26 | 26 | ||
| 27 | #include<linux/types.h> | ||
| 28 | |||
| 27 | typedef unsigned int __bitwise__ samsung_gpio_pull_t; | 29 | typedef unsigned int __bitwise__ samsung_gpio_pull_t; |
| 28 | typedef unsigned int __bitwise__ s5p_gpio_drvstr_t; | 30 | typedef unsigned int __bitwise__ s5p_gpio_drvstr_t; |
| 29 | 31 | ||
diff --git a/arch/arm/plat-samsung/pd.c b/arch/arm/plat-samsung/pd.c index efe1d564473e..312b510d86b7 100644 --- a/arch/arm/plat-samsung/pd.c +++ b/arch/arm/plat-samsung/pd.c | |||
| @@ -11,7 +11,7 @@ | |||
| 11 | */ | 11 | */ |
| 12 | 12 | ||
| 13 | #include <linux/init.h> | 13 | #include <linux/init.h> |
| 14 | #include <linux/module.h> | 14 | #include <linux/export.h> |
| 15 | #include <linux/platform_device.h> | 15 | #include <linux/platform_device.h> |
| 16 | #include <linux/err.h> | 16 | #include <linux/err.h> |
| 17 | #include <linux/pm_runtime.h> | 17 | #include <linux/pm_runtime.h> |
diff --git a/arch/arm/plat-samsung/pwm.c b/arch/arm/plat-samsung/pwm.c index dc1185dcf80d..c559d8438c70 100644 --- a/arch/arm/plat-samsung/pwm.c +++ b/arch/arm/plat-samsung/pwm.c | |||
| @@ -11,7 +11,7 @@ | |||
| 11 | * the Free Software Foundation; either version 2 of the License. | 11 | * the Free Software Foundation; either version 2 of the License. |
| 12 | */ | 12 | */ |
| 13 | 13 | ||
| 14 | #include <linux/module.h> | 14 | #include <linux/export.h> |
| 15 | #include <linux/kernel.h> | 15 | #include <linux/kernel.h> |
| 16 | #include <linux/platform_device.h> | 16 | #include <linux/platform_device.h> |
| 17 | #include <linux/slab.h> | 17 | #include <linux/slab.h> |
diff --git a/arch/arm/tools/mach-types b/arch/arm/tools/mach-types index 5bdeef969847..ccbe16f47227 100644 --- a/arch/arm/tools/mach-types +++ b/arch/arm/tools/mach-types | |||
| @@ -1123,5 +1123,6 @@ blissc MACH_BLISSC BLISSC 3491 | |||
| 1123 | thales_adc MACH_THALES_ADC THALES_ADC 3492 | 1123 | thales_adc MACH_THALES_ADC THALES_ADC 3492 |
| 1124 | ubisys_p9d_evp MACH_UBISYS_P9D_EVP UBISYS_P9D_EVP 3493 | 1124 | ubisys_p9d_evp MACH_UBISYS_P9D_EVP UBISYS_P9D_EVP 3493 |
| 1125 | atdgp318 MACH_ATDGP318 ATDGP318 3494 | 1125 | atdgp318 MACH_ATDGP318 ATDGP318 3494 |
| 1126 | m28evk MACH_M28EVK M28EVK 3613 | ||
| 1126 | smdk4212 MACH_SMDK4212 SMDK4212 3638 | 1127 | smdk4212 MACH_SMDK4212 SMDK4212 3638 |
| 1127 | smdk4412 MACH_SMDK4412 SMDK4412 3765 | 1128 | smdk4412 MACH_SMDK4412 SMDK4412 3765 |
diff --git a/arch/powerpc/boot/dts/p1023rds.dts b/arch/powerpc/boot/dts/p1023rds.dts index d9b776740a67..d3b478242ea9 100644 --- a/arch/powerpc/boot/dts/p1023rds.dts +++ b/arch/powerpc/boot/dts/p1023rds.dts | |||
| @@ -449,6 +449,7 @@ | |||
| 449 | interrupt-parent = <&mpic>; | 449 | interrupt-parent = <&mpic>; |
| 450 | interrupts = <16 2>; | 450 | interrupts = <16 2>; |
| 451 | interrupt-map-mask = <0xf800 0 0 7>; | 451 | interrupt-map-mask = <0xf800 0 0 7>; |
| 452 | /* IRQ[0:3] are pulled up on board, set to active-low */ | ||
| 452 | interrupt-map = < | 453 | interrupt-map = < |
| 453 | /* IDSEL 0x0 */ | 454 | /* IDSEL 0x0 */ |
| 454 | 0000 0 0 1 &mpic 0 1 | 455 | 0000 0 0 1 &mpic 0 1 |
| @@ -488,11 +489,15 @@ | |||
| 488 | interrupt-parent = <&mpic>; | 489 | interrupt-parent = <&mpic>; |
| 489 | interrupts = <16 2>; | 490 | interrupts = <16 2>; |
| 490 | interrupt-map-mask = <0xf800 0 0 7>; | 491 | interrupt-map-mask = <0xf800 0 0 7>; |
| 492 | /* | ||
| 493 | * IRQ[4:6] only for PCIe, set to active-high, | ||
| 494 | * IRQ[7] is pulled up on board, set to active-low | ||
| 495 | */ | ||
| 491 | interrupt-map = < | 496 | interrupt-map = < |
| 492 | /* IDSEL 0x0 */ | 497 | /* IDSEL 0x0 */ |
| 493 | 0000 0 0 1 &mpic 4 1 | 498 | 0000 0 0 1 &mpic 4 2 |
| 494 | 0000 0 0 2 &mpic 5 1 | 499 | 0000 0 0 2 &mpic 5 2 |
| 495 | 0000 0 0 3 &mpic 6 1 | 500 | 0000 0 0 3 &mpic 6 2 |
| 496 | 0000 0 0 4 &mpic 7 1 | 501 | 0000 0 0 4 &mpic 7 1 |
| 497 | >; | 502 | >; |
| 498 | ranges = <0x2000000 0x0 0xa0000000 | 503 | ranges = <0x2000000 0x0 0xa0000000 |
| @@ -527,12 +532,16 @@ | |||
| 527 | interrupt-parent = <&mpic>; | 532 | interrupt-parent = <&mpic>; |
| 528 | interrupts = <16 2>; | 533 | interrupts = <16 2>; |
| 529 | interrupt-map-mask = <0xf800 0 0 7>; | 534 | interrupt-map-mask = <0xf800 0 0 7>; |
| 535 | /* | ||
| 536 | * IRQ[8:10] are pulled up on board, set to active-low | ||
| 537 | * IRQ[11] only for PCIe, set to active-high, | ||
| 538 | */ | ||
| 530 | interrupt-map = < | 539 | interrupt-map = < |
| 531 | /* IDSEL 0x0 */ | 540 | /* IDSEL 0x0 */ |
| 532 | 0000 0 0 1 &mpic 8 1 | 541 | 0000 0 0 1 &mpic 8 1 |
| 533 | 0000 0 0 2 &mpic 9 1 | 542 | 0000 0 0 2 &mpic 9 1 |
| 534 | 0000 0 0 3 &mpic 10 1 | 543 | 0000 0 0 3 &mpic 10 1 |
| 535 | 0000 0 0 4 &mpic 11 1 | 544 | 0000 0 0 4 &mpic 11 2 |
| 536 | >; | 545 | >; |
| 537 | ranges = <0x2000000 0x0 0x80000000 | 546 | ranges = <0x2000000 0x0 0x80000000 |
| 538 | 0x2000000 0x0 0x80000000 | 547 | 0x2000000 0x0 0x80000000 |
diff --git a/arch/powerpc/configs/ppc44x_defconfig b/arch/powerpc/configs/ppc44x_defconfig index 6cdf1c0d2c8a..3b98d7354341 100644 --- a/arch/powerpc/configs/ppc44x_defconfig +++ b/arch/powerpc/configs/ppc44x_defconfig | |||
| @@ -52,6 +52,8 @@ CONFIG_MTD_CFI=y | |||
| 52 | CONFIG_MTD_JEDECPROBE=y | 52 | CONFIG_MTD_JEDECPROBE=y |
| 53 | CONFIG_MTD_CFI_AMDSTD=y | 53 | CONFIG_MTD_CFI_AMDSTD=y |
| 54 | CONFIG_MTD_PHYSMAP_OF=y | 54 | CONFIG_MTD_PHYSMAP_OF=y |
| 55 | CONFIG_MTD_NAND=m | ||
| 56 | CONFIG_MTD_NAND_NDFC=m | ||
| 55 | CONFIG_MTD_UBI=m | 57 | CONFIG_MTD_UBI=m |
| 56 | CONFIG_MTD_UBI_GLUEBI=m | 58 | CONFIG_MTD_UBI_GLUEBI=m |
| 57 | CONFIG_PROC_DEVICETREE=y | 59 | CONFIG_PROC_DEVICETREE=y |
diff --git a/arch/powerpc/mm/hugetlbpage.c b/arch/powerpc/mm/hugetlbpage.c index 5964371303ac..8558b572e55d 100644 --- a/arch/powerpc/mm/hugetlbpage.c +++ b/arch/powerpc/mm/hugetlbpage.c | |||
| @@ -15,6 +15,7 @@ | |||
| 15 | #include <linux/of_fdt.h> | 15 | #include <linux/of_fdt.h> |
| 16 | #include <linux/memblock.h> | 16 | #include <linux/memblock.h> |
| 17 | #include <linux/bootmem.h> | 17 | #include <linux/bootmem.h> |
| 18 | #include <linux/moduleparam.h> | ||
| 18 | #include <asm/pgtable.h> | 19 | #include <asm/pgtable.h> |
| 19 | #include <asm/pgalloc.h> | 20 | #include <asm/pgalloc.h> |
| 20 | #include <asm/tlb.h> | 21 | #include <asm/tlb.h> |
diff --git a/arch/powerpc/platforms/85xx/Kconfig b/arch/powerpc/platforms/85xx/Kconfig index 45023e26aea3..d7946be298b6 100644 --- a/arch/powerpc/platforms/85xx/Kconfig +++ b/arch/powerpc/platforms/85xx/Kconfig | |||
| @@ -203,7 +203,7 @@ config P3060_QDS | |||
| 203 | select PPC_E500MC | 203 | select PPC_E500MC |
| 204 | select PHYS_64BIT | 204 | select PHYS_64BIT |
| 205 | select SWIOTLB | 205 | select SWIOTLB |
| 206 | select MPC8xxx_GPIO | 206 | select GPIO_MPC8XXX |
| 207 | select HAS_RAPIDIO | 207 | select HAS_RAPIDIO |
| 208 | select PPC_EPAPR_HV_PIC | 208 | select PPC_EPAPR_HV_PIC |
| 209 | help | 209 | help |
diff --git a/arch/powerpc/platforms/85xx/p3060_qds.c b/arch/powerpc/platforms/85xx/p3060_qds.c index 01dcf44871e9..081cf4ac1881 100644 --- a/arch/powerpc/platforms/85xx/p3060_qds.c +++ b/arch/powerpc/platforms/85xx/p3060_qds.c | |||
| @@ -70,7 +70,7 @@ define_machine(p3060_qds) { | |||
| 70 | .power_save = e500_idle, | 70 | .power_save = e500_idle, |
| 71 | }; | 71 | }; |
| 72 | 72 | ||
| 73 | machine_device_initcall(p3060_qds, declare_of_platform_devices); | 73 | machine_device_initcall(p3060_qds, corenet_ds_publish_devices); |
| 74 | 74 | ||
| 75 | #ifdef CONFIG_SWIOTLB | 75 | #ifdef CONFIG_SWIOTLB |
| 76 | machine_arch_initcall(p3060_qds, swiotlb_setup_bus_notifier); | 76 | machine_arch_initcall(p3060_qds, swiotlb_setup_bus_notifier); |
diff --git a/arch/powerpc/sysdev/ehv_pic.c b/arch/powerpc/sysdev/ehv_pic.c index af1a5df46b3e..b6731e4a6646 100644 --- a/arch/powerpc/sysdev/ehv_pic.c +++ b/arch/powerpc/sysdev/ehv_pic.c | |||
| @@ -280,6 +280,7 @@ void __init ehv_pic_init(void) | |||
| 280 | 280 | ||
| 281 | if (!ehv_pic->irqhost) { | 281 | if (!ehv_pic->irqhost) { |
| 282 | of_node_put(np); | 282 | of_node_put(np); |
| 283 | kfree(ehv_pic); | ||
| 283 | return; | 284 | return; |
| 284 | } | 285 | } |
| 285 | 286 | ||
diff --git a/arch/powerpc/sysdev/fsl_lbc.c b/arch/powerpc/sysdev/fsl_lbc.c index c4d96fa32ba5..d5c3c90ee698 100644 --- a/arch/powerpc/sysdev/fsl_lbc.c +++ b/arch/powerpc/sysdev/fsl_lbc.c | |||
| @@ -328,6 +328,7 @@ static int __devinit fsl_lbc_ctrl_probe(struct platform_device *dev) | |||
| 328 | err: | 328 | err: |
| 329 | iounmap(fsl_lbc_ctrl_dev->regs); | 329 | iounmap(fsl_lbc_ctrl_dev->regs); |
| 330 | kfree(fsl_lbc_ctrl_dev); | 330 | kfree(fsl_lbc_ctrl_dev); |
| 331 | fsl_lbc_ctrl_dev = NULL; | ||
| 331 | return ret; | 332 | return ret; |
| 332 | } | 333 | } |
| 333 | 334 | ||
diff --git a/arch/powerpc/sysdev/qe_lib/qe.c b/arch/powerpc/sysdev/qe_lib/qe.c index 3363fbc964f8..ceb09cbd2329 100644 --- a/arch/powerpc/sysdev/qe_lib/qe.c +++ b/arch/powerpc/sysdev/qe_lib/qe.c | |||
| @@ -216,7 +216,7 @@ int qe_setbrg(enum qe_clock brg, unsigned int rate, unsigned int multiplier) | |||
| 216 | /* Errata QE_General4, which affects some MPC832x and MPC836x SOCs, says | 216 | /* Errata QE_General4, which affects some MPC832x and MPC836x SOCs, says |
| 217 | that the BRG divisor must be even if you're not using divide-by-16 | 217 | that the BRG divisor must be even if you're not using divide-by-16 |
| 218 | mode. */ | 218 | mode. */ |
| 219 | if (!div16 && (divisor & 1)) | 219 | if (!div16 && (divisor & 1) && (divisor > 3)) |
| 220 | divisor++; | 220 | divisor++; |
| 221 | 221 | ||
| 222 | tempval = ((divisor - 1) << QE_BRGC_DIVISOR_SHIFT) | | 222 | tempval = ((divisor - 1) << QE_BRGC_DIVISOR_SHIFT) | |
diff --git a/drivers/acpi/apei/erst.c b/drivers/acpi/apei/erst.c index 127408069ca7..631b9477b99c 100644 --- a/drivers/acpi/apei/erst.c +++ b/drivers/acpi/apei/erst.c | |||
| @@ -932,7 +932,8 @@ static int erst_check_table(struct acpi_table_erst *erst_tab) | |||
| 932 | static int erst_open_pstore(struct pstore_info *psi); | 932 | static int erst_open_pstore(struct pstore_info *psi); |
| 933 | static int erst_close_pstore(struct pstore_info *psi); | 933 | static int erst_close_pstore(struct pstore_info *psi); |
| 934 | static ssize_t erst_reader(u64 *id, enum pstore_type_id *type, | 934 | static ssize_t erst_reader(u64 *id, enum pstore_type_id *type, |
| 935 | struct timespec *time, struct pstore_info *psi); | 935 | struct timespec *time, char **buf, |
| 936 | struct pstore_info *psi); | ||
| 936 | static int erst_writer(enum pstore_type_id type, u64 *id, unsigned int part, | 937 | static int erst_writer(enum pstore_type_id type, u64 *id, unsigned int part, |
| 937 | size_t size, struct pstore_info *psi); | 938 | size_t size, struct pstore_info *psi); |
| 938 | static int erst_clearer(enum pstore_type_id type, u64 id, | 939 | static int erst_clearer(enum pstore_type_id type, u64 id, |
| @@ -986,17 +987,23 @@ static int erst_close_pstore(struct pstore_info *psi) | |||
| 986 | } | 987 | } |
| 987 | 988 | ||
| 988 | static ssize_t erst_reader(u64 *id, enum pstore_type_id *type, | 989 | static ssize_t erst_reader(u64 *id, enum pstore_type_id *type, |
| 989 | struct timespec *time, struct pstore_info *psi) | 990 | struct timespec *time, char **buf, |
| 991 | struct pstore_info *psi) | ||
| 990 | { | 992 | { |
| 991 | int rc; | 993 | int rc; |
| 992 | ssize_t len = 0; | 994 | ssize_t len = 0; |
| 993 | u64 record_id; | 995 | u64 record_id; |
| 994 | struct cper_pstore_record *rcd = (struct cper_pstore_record *) | 996 | struct cper_pstore_record *rcd; |
| 995 | (erst_info.buf - sizeof(*rcd)); | 997 | size_t rcd_len = sizeof(*rcd) + erst_info.bufsize; |
| 996 | 998 | ||
| 997 | if (erst_disable) | 999 | if (erst_disable) |
| 998 | return -ENODEV; | 1000 | return -ENODEV; |
| 999 | 1001 | ||
| 1002 | rcd = kmalloc(rcd_len, GFP_KERNEL); | ||
| 1003 | if (!rcd) { | ||
| 1004 | rc = -ENOMEM; | ||
| 1005 | goto out; | ||
| 1006 | } | ||
| 1000 | skip: | 1007 | skip: |
| 1001 | rc = erst_get_record_id_next(&reader_pos, &record_id); | 1008 | rc = erst_get_record_id_next(&reader_pos, &record_id); |
| 1002 | if (rc) | 1009 | if (rc) |
| @@ -1004,22 +1011,27 @@ skip: | |||
| 1004 | 1011 | ||
| 1005 | /* no more record */ | 1012 | /* no more record */ |
| 1006 | if (record_id == APEI_ERST_INVALID_RECORD_ID) { | 1013 | if (record_id == APEI_ERST_INVALID_RECORD_ID) { |
| 1007 | rc = -1; | 1014 | rc = -EINVAL; |
| 1008 | goto out; | 1015 | goto out; |
| 1009 | } | 1016 | } |
| 1010 | 1017 | ||
| 1011 | len = erst_read(record_id, &rcd->hdr, sizeof(*rcd) + | 1018 | len = erst_read(record_id, &rcd->hdr, rcd_len); |
| 1012 | erst_info.bufsize); | ||
| 1013 | /* The record may be cleared by others, try read next record */ | 1019 | /* The record may be cleared by others, try read next record */ |
| 1014 | if (len == -ENOENT) | 1020 | if (len == -ENOENT) |
| 1015 | goto skip; | 1021 | goto skip; |
| 1016 | else if (len < 0) { | 1022 | else if (len < sizeof(*rcd)) { |
| 1017 | rc = -1; | 1023 | rc = -EIO; |
| 1018 | goto out; | 1024 | goto out; |
| 1019 | } | 1025 | } |
| 1020 | if (uuid_le_cmp(rcd->hdr.creator_id, CPER_CREATOR_PSTORE) != 0) | 1026 | if (uuid_le_cmp(rcd->hdr.creator_id, CPER_CREATOR_PSTORE) != 0) |
| 1021 | goto skip; | 1027 | goto skip; |
| 1022 | 1028 | ||
| 1029 | *buf = kmalloc(len, GFP_KERNEL); | ||
| 1030 | if (*buf == NULL) { | ||
| 1031 | rc = -ENOMEM; | ||
| 1032 | goto out; | ||
| 1033 | } | ||
| 1034 | memcpy(*buf, rcd->data, len - sizeof(*rcd)); | ||
| 1023 | *id = record_id; | 1035 | *id = record_id; |
| 1024 | if (uuid_le_cmp(rcd->sec_hdr.section_type, | 1036 | if (uuid_le_cmp(rcd->sec_hdr.section_type, |
| 1025 | CPER_SECTION_TYPE_DMESG) == 0) | 1037 | CPER_SECTION_TYPE_DMESG) == 0) |
| @@ -1037,6 +1049,7 @@ skip: | |||
| 1037 | time->tv_nsec = 0; | 1049 | time->tv_nsec = 0; |
| 1038 | 1050 | ||
| 1039 | out: | 1051 | out: |
| 1052 | kfree(rcd); | ||
| 1040 | return (rc < 0) ? rc : (len - sizeof(*rcd)); | 1053 | return (rc < 0) ? rc : (len - sizeof(*rcd)); |
| 1041 | } | 1054 | } |
| 1042 | 1055 | ||
diff --git a/drivers/crypto/mv_cesa.c b/drivers/crypto/mv_cesa.c index 5c6f56f21443..dcd8babae9eb 100644 --- a/drivers/crypto/mv_cesa.c +++ b/drivers/crypto/mv_cesa.c | |||
| @@ -343,11 +343,13 @@ static void mv_process_hash_current(int first_block) | |||
| 343 | else | 343 | else |
| 344 | op.config |= CFG_MID_FRAG; | 344 | op.config |= CFG_MID_FRAG; |
| 345 | 345 | ||
| 346 | writel(req_ctx->state[0], cpg->reg + DIGEST_INITIAL_VAL_A); | 346 | if (first_block) { |
| 347 | writel(req_ctx->state[1], cpg->reg + DIGEST_INITIAL_VAL_B); | 347 | writel(req_ctx->state[0], cpg->reg + DIGEST_INITIAL_VAL_A); |
| 348 | writel(req_ctx->state[2], cpg->reg + DIGEST_INITIAL_VAL_C); | 348 | writel(req_ctx->state[1], cpg->reg + DIGEST_INITIAL_VAL_B); |
| 349 | writel(req_ctx->state[3], cpg->reg + DIGEST_INITIAL_VAL_D); | 349 | writel(req_ctx->state[2], cpg->reg + DIGEST_INITIAL_VAL_C); |
| 350 | writel(req_ctx->state[4], cpg->reg + DIGEST_INITIAL_VAL_E); | 350 | writel(req_ctx->state[3], cpg->reg + DIGEST_INITIAL_VAL_D); |
| 351 | writel(req_ctx->state[4], cpg->reg + DIGEST_INITIAL_VAL_E); | ||
| 352 | } | ||
| 351 | } | 353 | } |
| 352 | 354 | ||
| 353 | memcpy(cpg->sram + SRAM_CONFIG, &op, sizeof(struct sec_accel_config)); | 355 | memcpy(cpg->sram + SRAM_CONFIG, &op, sizeof(struct sec_accel_config)); |
diff --git a/drivers/edac/mpc85xx_edac.c b/drivers/edac/mpc85xx_edac.c index 8af8e864a9cf..73464a62adf7 100644 --- a/drivers/edac/mpc85xx_edac.c +++ b/drivers/edac/mpc85xx_edac.c | |||
| @@ -1128,7 +1128,7 @@ static struct of_device_id mpc85xx_mc_err_of_match[] = { | |||
| 1128 | { .compatible = "fsl,p1020-memory-controller", }, | 1128 | { .compatible = "fsl,p1020-memory-controller", }, |
| 1129 | { .compatible = "fsl,p1021-memory-controller", }, | 1129 | { .compatible = "fsl,p1021-memory-controller", }, |
| 1130 | { .compatible = "fsl,p2020-memory-controller", }, | 1130 | { .compatible = "fsl,p2020-memory-controller", }, |
| 1131 | { .compatible = "fsl,p4080-memory-controller", }, | 1131 | { .compatible = "fsl,qoriq-memory-controller", }, |
| 1132 | {}, | 1132 | {}, |
| 1133 | }; | 1133 | }; |
| 1134 | MODULE_DEVICE_TABLE(of, mpc85xx_mc_err_of_match); | 1134 | MODULE_DEVICE_TABLE(of, mpc85xx_mc_err_of_match); |
diff --git a/drivers/firmware/efivars.c b/drivers/firmware/efivars.c index 8370f72d87ff..b0a81173a268 100644 --- a/drivers/firmware/efivars.c +++ b/drivers/firmware/efivars.c | |||
| @@ -457,7 +457,8 @@ static int efi_pstore_close(struct pstore_info *psi) | |||
| 457 | } | 457 | } |
| 458 | 458 | ||
| 459 | static ssize_t efi_pstore_read(u64 *id, enum pstore_type_id *type, | 459 | static ssize_t efi_pstore_read(u64 *id, enum pstore_type_id *type, |
| 460 | struct timespec *timespec, struct pstore_info *psi) | 460 | struct timespec *timespec, |
| 461 | char **buf, struct pstore_info *psi) | ||
| 461 | { | 462 | { |
| 462 | efi_guid_t vendor = LINUX_EFI_CRASH_GUID; | 463 | efi_guid_t vendor = LINUX_EFI_CRASH_GUID; |
| 463 | struct efivars *efivars = psi->data; | 464 | struct efivars *efivars = psi->data; |
| @@ -478,7 +479,11 @@ static ssize_t efi_pstore_read(u64 *id, enum pstore_type_id *type, | |||
| 478 | timespec->tv_nsec = 0; | 479 | timespec->tv_nsec = 0; |
| 479 | get_var_data_locked(efivars, &efivars->walk_entry->var); | 480 | get_var_data_locked(efivars, &efivars->walk_entry->var); |
| 480 | size = efivars->walk_entry->var.DataSize; | 481 | size = efivars->walk_entry->var.DataSize; |
| 481 | memcpy(psi->buf, efivars->walk_entry->var.Data, size); | 482 | *buf = kmalloc(size, GFP_KERNEL); |
| 483 | if (*buf == NULL) | ||
| 484 | return -ENOMEM; | ||
| 485 | memcpy(*buf, efivars->walk_entry->var.Data, | ||
| 486 | size); | ||
| 482 | efivars->walk_entry = list_entry(efivars->walk_entry->list.next, | 487 | efivars->walk_entry = list_entry(efivars->walk_entry->list.next, |
| 483 | struct efivar_entry, list); | 488 | struct efivar_entry, list); |
| 484 | return size; | 489 | return size; |
| @@ -576,7 +581,8 @@ static int efi_pstore_close(struct pstore_info *psi) | |||
| 576 | } | 581 | } |
| 577 | 582 | ||
| 578 | static ssize_t efi_pstore_read(u64 *id, enum pstore_type_id *type, | 583 | static ssize_t efi_pstore_read(u64 *id, enum pstore_type_id *type, |
| 579 | struct timespec *time, struct pstore_info *psi) | 584 | struct timespec *timespec, |
| 585 | char **buf, struct pstore_info *psi) | ||
| 580 | { | 586 | { |
| 581 | return -1; | 587 | return -1; |
| 582 | } | 588 | } |
diff --git a/drivers/firmware/sigma.c b/drivers/firmware/sigma.c index f10fc521951b..1eedb6f7fdab 100644 --- a/drivers/firmware/sigma.c +++ b/drivers/firmware/sigma.c | |||
| @@ -14,13 +14,34 @@ | |||
| 14 | #include <linux/module.h> | 14 | #include <linux/module.h> |
| 15 | #include <linux/sigma.h> | 15 | #include <linux/sigma.h> |
| 16 | 16 | ||
| 17 | /* Return: 0==OK, <0==error, =1 ==no more actions */ | 17 | static size_t sigma_action_size(struct sigma_action *sa) |
| 18 | { | ||
| 19 | size_t payload = 0; | ||
| 20 | |||
| 21 | switch (sa->instr) { | ||
| 22 | case SIGMA_ACTION_WRITEXBYTES: | ||
| 23 | case SIGMA_ACTION_WRITESINGLE: | ||
| 24 | case SIGMA_ACTION_WRITESAFELOAD: | ||
| 25 | payload = sigma_action_len(sa); | ||
| 26 | break; | ||
| 27 | default: | ||
| 28 | break; | ||
| 29 | } | ||
| 30 | |||
| 31 | payload = ALIGN(payload, 2); | ||
| 32 | |||
| 33 | return payload + sizeof(struct sigma_action); | ||
| 34 | } | ||
| 35 | |||
| 36 | /* | ||
| 37 | * Returns a negative error value in case of an error, 0 if processing of | ||
| 38 | * the firmware should be stopped after this action, 1 otherwise. | ||
| 39 | */ | ||
| 18 | static int | 40 | static int |
| 19 | process_sigma_action(struct i2c_client *client, struct sigma_firmware *ssfw) | 41 | process_sigma_action(struct i2c_client *client, struct sigma_action *sa) |
| 20 | { | 42 | { |
| 21 | struct sigma_action *sa = (void *)(ssfw->fw->data + ssfw->pos); | ||
| 22 | size_t len = sigma_action_len(sa); | 43 | size_t len = sigma_action_len(sa); |
| 23 | int ret = 0; | 44 | int ret; |
| 24 | 45 | ||
| 25 | pr_debug("%s: instr:%i addr:%#x len:%zu\n", __func__, | 46 | pr_debug("%s: instr:%i addr:%#x len:%zu\n", __func__, |
| 26 | sa->instr, sa->addr, len); | 47 | sa->instr, sa->addr, len); |
| @@ -29,44 +50,50 @@ process_sigma_action(struct i2c_client *client, struct sigma_firmware *ssfw) | |||
| 29 | case SIGMA_ACTION_WRITEXBYTES: | 50 | case SIGMA_ACTION_WRITEXBYTES: |
| 30 | case SIGMA_ACTION_WRITESINGLE: | 51 | case SIGMA_ACTION_WRITESINGLE: |
| 31 | case SIGMA_ACTION_WRITESAFELOAD: | 52 | case SIGMA_ACTION_WRITESAFELOAD: |
| 32 | if (ssfw->fw->size < ssfw->pos + len) | ||
| 33 | return -EINVAL; | ||
| 34 | ret = i2c_master_send(client, (void *)&sa->addr, len); | 53 | ret = i2c_master_send(client, (void *)&sa->addr, len); |
| 35 | if (ret < 0) | 54 | if (ret < 0) |
| 36 | return -EINVAL; | 55 | return -EINVAL; |
| 37 | break; | 56 | break; |
| 38 | |||
| 39 | case SIGMA_ACTION_DELAY: | 57 | case SIGMA_ACTION_DELAY: |
| 40 | ret = 0; | ||
| 41 | udelay(len); | 58 | udelay(len); |
| 42 | len = 0; | 59 | len = 0; |
| 43 | break; | 60 | break; |
| 44 | |||
| 45 | case SIGMA_ACTION_END: | 61 | case SIGMA_ACTION_END: |
| 46 | return 1; | 62 | return 0; |
| 47 | |||
| 48 | default: | 63 | default: |
| 49 | return -EINVAL; | 64 | return -EINVAL; |
| 50 | } | 65 | } |
| 51 | 66 | ||
| 52 | /* when arrive here ret=0 or sent data */ | 67 | return 1; |
| 53 | ssfw->pos += sigma_action_size(sa, len); | ||
| 54 | return ssfw->pos == ssfw->fw->size; | ||
| 55 | } | 68 | } |
| 56 | 69 | ||
| 57 | static int | 70 | static int |
| 58 | process_sigma_actions(struct i2c_client *client, struct sigma_firmware *ssfw) | 71 | process_sigma_actions(struct i2c_client *client, struct sigma_firmware *ssfw) |
| 59 | { | 72 | { |
| 60 | pr_debug("%s: processing %p\n", __func__, ssfw); | 73 | struct sigma_action *sa; |
| 74 | size_t size; | ||
| 75 | int ret; | ||
| 76 | |||
| 77 | while (ssfw->pos + sizeof(*sa) <= ssfw->fw->size) { | ||
| 78 | sa = (struct sigma_action *)(ssfw->fw->data + ssfw->pos); | ||
| 79 | |||
| 80 | size = sigma_action_size(sa); | ||
| 81 | ssfw->pos += size; | ||
| 82 | if (ssfw->pos > ssfw->fw->size || size == 0) | ||
| 83 | break; | ||
| 84 | |||
| 85 | ret = process_sigma_action(client, sa); | ||
| 61 | 86 | ||
| 62 | while (1) { | ||
| 63 | int ret = process_sigma_action(client, ssfw); | ||
| 64 | pr_debug("%s: action returned %i\n", __func__, ret); | 87 | pr_debug("%s: action returned %i\n", __func__, ret); |
| 65 | if (ret == 1) | 88 | |
| 66 | return 0; | 89 | if (ret <= 0) |
| 67 | else if (ret) | ||
| 68 | return ret; | 90 | return ret; |
| 69 | } | 91 | } |
| 92 | |||
| 93 | if (ssfw->pos != ssfw->fw->size) | ||
| 94 | return -EINVAL; | ||
| 95 | |||
| 96 | return 0; | ||
| 70 | } | 97 | } |
| 71 | 98 | ||
| 72 | int process_sigma_firmware(struct i2c_client *client, const char *name) | 99 | int process_sigma_firmware(struct i2c_client *client, const char *name) |
| @@ -89,16 +116,24 @@ int process_sigma_firmware(struct i2c_client *client, const char *name) | |||
| 89 | 116 | ||
| 90 | /* then verify the header */ | 117 | /* then verify the header */ |
| 91 | ret = -EINVAL; | 118 | ret = -EINVAL; |
| 92 | if (fw->size < sizeof(*ssfw_head)) | 119 | |
| 120 | /* | ||
| 121 | * Reject too small or unreasonable large files. The upper limit has been | ||
| 122 | * chosen a bit arbitrarily, but it should be enough for all practical | ||
| 123 | * purposes and having the limit makes it easier to avoid integer | ||
| 124 | * overflows later in the loading process. | ||
| 125 | */ | ||
| 126 | if (fw->size < sizeof(*ssfw_head) || fw->size >= 0x4000000) | ||
| 93 | goto done; | 127 | goto done; |
| 94 | 128 | ||
| 95 | ssfw_head = (void *)fw->data; | 129 | ssfw_head = (void *)fw->data; |
| 96 | if (memcmp(ssfw_head->magic, SIGMA_MAGIC, ARRAY_SIZE(ssfw_head->magic))) | 130 | if (memcmp(ssfw_head->magic, SIGMA_MAGIC, ARRAY_SIZE(ssfw_head->magic))) |
| 97 | goto done; | 131 | goto done; |
| 98 | 132 | ||
| 99 | crc = crc32(0, fw->data, fw->size); | 133 | crc = crc32(0, fw->data + sizeof(*ssfw_head), |
| 134 | fw->size - sizeof(*ssfw_head)); | ||
| 100 | pr_debug("%s: crc=%x\n", __func__, crc); | 135 | pr_debug("%s: crc=%x\n", __func__, crc); |
| 101 | if (crc != ssfw_head->crc) | 136 | if (crc != le32_to_cpu(ssfw_head->crc)) |
| 102 | goto done; | 137 | goto done; |
| 103 | 138 | ||
| 104 | ssfw.pos = sizeof(*ssfw_head); | 139 | ssfw.pos = sizeof(*ssfw_head); |
diff --git a/drivers/gpio/gpio-pca953x.c b/drivers/gpio/gpio-pca953x.c index 147df8ae79db..d3f3e8f54561 100644 --- a/drivers/gpio/gpio-pca953x.c +++ b/drivers/gpio/gpio-pca953x.c | |||
| @@ -546,7 +546,7 @@ static void pca953x_irq_teardown(struct pca953x_chip *chip) | |||
| 546 | * Translate OpenFirmware node properties into platform_data | 546 | * Translate OpenFirmware node properties into platform_data |
| 547 | * WARNING: This is DEPRECATED and will be removed eventually! | 547 | * WARNING: This is DEPRECATED and will be removed eventually! |
| 548 | */ | 548 | */ |
| 549 | void | 549 | static void |
| 550 | pca953x_get_alt_pdata(struct i2c_client *client, int *gpio_base, int *invert) | 550 | pca953x_get_alt_pdata(struct i2c_client *client, int *gpio_base, int *invert) |
| 551 | { | 551 | { |
| 552 | struct device_node *node; | 552 | struct device_node *node; |
| @@ -574,7 +574,7 @@ pca953x_get_alt_pdata(struct i2c_client *client, int *gpio_base, int *invert) | |||
| 574 | *invert = *val; | 574 | *invert = *val; |
| 575 | } | 575 | } |
| 576 | #else | 576 | #else |
| 577 | void | 577 | static void |
| 578 | pca953x_get_alt_pdata(struct i2c_client *client, int *gpio_base, int *invert) | 578 | pca953x_get_alt_pdata(struct i2c_client *client, int *gpio_base, int *invert) |
| 579 | { | 579 | { |
| 580 | *gpio_base = -1; | 580 | *gpio_base = -1; |
diff --git a/drivers/gpu/drm/drm_crtc_helper.c b/drivers/gpu/drm/drm_crtc_helper.c index 3969f7553fe7..d2619d72cece 100644 --- a/drivers/gpu/drm/drm_crtc_helper.c +++ b/drivers/gpu/drm/drm_crtc_helper.c | |||
| @@ -456,6 +456,30 @@ done: | |||
| 456 | EXPORT_SYMBOL(drm_crtc_helper_set_mode); | 456 | EXPORT_SYMBOL(drm_crtc_helper_set_mode); |
| 457 | 457 | ||
| 458 | 458 | ||
| 459 | static int | ||
| 460 | drm_crtc_helper_disable(struct drm_crtc *crtc) | ||
| 461 | { | ||
| 462 | struct drm_device *dev = crtc->dev; | ||
| 463 | struct drm_connector *connector; | ||
| 464 | struct drm_encoder *encoder; | ||
| 465 | |||
| 466 | /* Decouple all encoders and their attached connectors from this crtc */ | ||
| 467 | list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) { | ||
| 468 | if (encoder->crtc != crtc) | ||
| 469 | continue; | ||
| 470 | |||
| 471 | list_for_each_entry(connector, &dev->mode_config.connector_list, head) { | ||
| 472 | if (connector->encoder != encoder) | ||
| 473 | continue; | ||
| 474 | |||
| 475 | connector->encoder = NULL; | ||
| 476 | } | ||
| 477 | } | ||
| 478 | |||
| 479 | drm_helper_disable_unused_functions(dev); | ||
| 480 | return 0; | ||
| 481 | } | ||
| 482 | |||
| 459 | /** | 483 | /** |
| 460 | * drm_crtc_helper_set_config - set a new config from userspace | 484 | * drm_crtc_helper_set_config - set a new config from userspace |
| 461 | * @crtc: CRTC to setup | 485 | * @crtc: CRTC to setup |
| @@ -510,8 +534,7 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set) | |||
| 510 | (int)set->num_connectors, set->x, set->y); | 534 | (int)set->num_connectors, set->x, set->y); |
| 511 | } else { | 535 | } else { |
| 512 | DRM_DEBUG_KMS("[CRTC:%d] [NOFB]\n", set->crtc->base.id); | 536 | DRM_DEBUG_KMS("[CRTC:%d] [NOFB]\n", set->crtc->base.id); |
| 513 | set->mode = NULL; | 537 | return drm_crtc_helper_disable(set->crtc); |
| 514 | set->num_connectors = 0; | ||
| 515 | } | 538 | } |
| 516 | 539 | ||
| 517 | dev = set->crtc->dev; | 540 | dev = set->crtc->dev; |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_buf.c b/drivers/gpu/drm/exynos/exynos_drm_buf.c index 6f8afea94fc9..2bb07bca511a 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_buf.c +++ b/drivers/gpu/drm/exynos/exynos_drm_buf.c | |||
| @@ -27,82 +27,84 @@ | |||
| 27 | #include "drm.h" | 27 | #include "drm.h" |
| 28 | 28 | ||
| 29 | #include "exynos_drm_drv.h" | 29 | #include "exynos_drm_drv.h" |
| 30 | #include "exynos_drm_gem.h" | ||
| 30 | #include "exynos_drm_buf.h" | 31 | #include "exynos_drm_buf.h" |
| 31 | 32 | ||
| 32 | static DEFINE_MUTEX(exynos_drm_buf_lock); | ||
| 33 | |||
| 34 | static int lowlevel_buffer_allocate(struct drm_device *dev, | 33 | static int lowlevel_buffer_allocate(struct drm_device *dev, |
| 35 | struct exynos_drm_buf_entry *entry) | 34 | struct exynos_drm_gem_buf *buffer) |
| 36 | { | 35 | { |
| 37 | DRM_DEBUG_KMS("%s\n", __FILE__); | 36 | DRM_DEBUG_KMS("%s\n", __FILE__); |
| 38 | 37 | ||
| 39 | entry->vaddr = dma_alloc_writecombine(dev->dev, entry->size, | 38 | buffer->kvaddr = dma_alloc_writecombine(dev->dev, buffer->size, |
| 40 | (dma_addr_t *)&entry->paddr, GFP_KERNEL); | 39 | &buffer->dma_addr, GFP_KERNEL); |
| 41 | if (!entry->paddr) { | 40 | if (!buffer->kvaddr) { |
| 42 | DRM_ERROR("failed to allocate buffer.\n"); | 41 | DRM_ERROR("failed to allocate buffer.\n"); |
| 43 | return -ENOMEM; | 42 | return -ENOMEM; |
| 44 | } | 43 | } |
| 45 | 44 | ||
| 46 | DRM_DEBUG_KMS("allocated : vaddr(0x%x), paddr(0x%x), size(0x%x)\n", | 45 | DRM_DEBUG_KMS("vaddr(0x%lx), dma_addr(0x%lx), size(0x%lx)\n", |
| 47 | (unsigned int)entry->vaddr, entry->paddr, entry->size); | 46 | (unsigned long)buffer->kvaddr, |
| 47 | (unsigned long)buffer->dma_addr, | ||
| 48 | buffer->size); | ||
| 48 | 49 | ||
| 49 | return 0; | 50 | return 0; |
| 50 | } | 51 | } |
| 51 | 52 | ||
| 52 | static void lowlevel_buffer_deallocate(struct drm_device *dev, | 53 | static void lowlevel_buffer_deallocate(struct drm_device *dev, |
| 53 | struct exynos_drm_buf_entry *entry) | 54 | struct exynos_drm_gem_buf *buffer) |
| 54 | { | 55 | { |
| 55 | DRM_DEBUG_KMS("%s.\n", __FILE__); | 56 | DRM_DEBUG_KMS("%s.\n", __FILE__); |
| 56 | 57 | ||
| 57 | if (entry->paddr && entry->vaddr && entry->size) | 58 | if (buffer->dma_addr && buffer->size) |
| 58 | dma_free_writecombine(dev->dev, entry->size, entry->vaddr, | 59 | dma_free_writecombine(dev->dev, buffer->size, buffer->kvaddr, |
| 59 | entry->paddr); | 60 | (dma_addr_t)buffer->dma_addr); |
| 60 | else | 61 | else |
| 61 | DRM_DEBUG_KMS("entry data is null.\n"); | 62 | DRM_DEBUG_KMS("buffer data are invalid.\n"); |
| 62 | } | 63 | } |
| 63 | 64 | ||
| 64 | struct exynos_drm_buf_entry *exynos_drm_buf_create(struct drm_device *dev, | 65 | struct exynos_drm_gem_buf *exynos_drm_buf_create(struct drm_device *dev, |
| 65 | unsigned int size) | 66 | unsigned int size) |
| 66 | { | 67 | { |
| 67 | struct exynos_drm_buf_entry *entry; | 68 | struct exynos_drm_gem_buf *buffer; |
| 68 | 69 | ||
| 69 | DRM_DEBUG_KMS("%s.\n", __FILE__); | 70 | DRM_DEBUG_KMS("%s.\n", __FILE__); |
| 71 | DRM_DEBUG_KMS("desired size = 0x%x\n", size); | ||
| 70 | 72 | ||
| 71 | entry = kzalloc(sizeof(*entry), GFP_KERNEL); | 73 | buffer = kzalloc(sizeof(*buffer), GFP_KERNEL); |
| 72 | if (!entry) { | 74 | if (!buffer) { |
| 73 | DRM_ERROR("failed to allocate exynos_drm_buf_entry.\n"); | 75 | DRM_ERROR("failed to allocate exynos_drm_gem_buf.\n"); |
| 74 | return ERR_PTR(-ENOMEM); | 76 | return ERR_PTR(-ENOMEM); |
| 75 | } | 77 | } |
| 76 | 78 | ||
| 77 | entry->size = size; | 79 | buffer->size = size; |
| 78 | 80 | ||
| 79 | /* | 81 | /* |
| 80 | * allocate memory region with size and set the memory information | 82 | * allocate memory region with size and set the memory information |
| 81 | * to vaddr and paddr of a entry object. | 83 | * to vaddr and dma_addr of a buffer object. |
| 82 | */ | 84 | */ |
| 83 | if (lowlevel_buffer_allocate(dev, entry) < 0) { | 85 | if (lowlevel_buffer_allocate(dev, buffer) < 0) { |
| 84 | kfree(entry); | 86 | kfree(buffer); |
| 85 | entry = NULL; | 87 | buffer = NULL; |
| 86 | return ERR_PTR(-ENOMEM); | 88 | return ERR_PTR(-ENOMEM); |
| 87 | } | 89 | } |
| 88 | 90 | ||
| 89 | return entry; | 91 | return buffer; |
| 90 | } | 92 | } |
| 91 | 93 | ||
| 92 | void exynos_drm_buf_destroy(struct drm_device *dev, | 94 | void exynos_drm_buf_destroy(struct drm_device *dev, |
| 93 | struct exynos_drm_buf_entry *entry) | 95 | struct exynos_drm_gem_buf *buffer) |
| 94 | { | 96 | { |
| 95 | DRM_DEBUG_KMS("%s.\n", __FILE__); | 97 | DRM_DEBUG_KMS("%s.\n", __FILE__); |
| 96 | 98 | ||
| 97 | if (!entry) { | 99 | if (!buffer) { |
| 98 | DRM_DEBUG_KMS("entry is null.\n"); | 100 | DRM_DEBUG_KMS("buffer is null.\n"); |
| 99 | return; | 101 | return; |
| 100 | } | 102 | } |
| 101 | 103 | ||
| 102 | lowlevel_buffer_deallocate(dev, entry); | 104 | lowlevel_buffer_deallocate(dev, buffer); |
| 103 | 105 | ||
| 104 | kfree(entry); | 106 | kfree(buffer); |
| 105 | entry = NULL; | 107 | buffer = NULL; |
| 106 | } | 108 | } |
| 107 | 109 | ||
| 108 | MODULE_AUTHOR("Inki Dae <inki.dae@samsung.com>"); | 110 | MODULE_AUTHOR("Inki Dae <inki.dae@samsung.com>"); |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_buf.h b/drivers/gpu/drm/exynos/exynos_drm_buf.h index 045d59eab01a..6e91f9caa5db 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_buf.h +++ b/drivers/gpu/drm/exynos/exynos_drm_buf.h | |||
| @@ -26,28 +26,15 @@ | |||
| 26 | #ifndef _EXYNOS_DRM_BUF_H_ | 26 | #ifndef _EXYNOS_DRM_BUF_H_ |
| 27 | #define _EXYNOS_DRM_BUF_H_ | 27 | #define _EXYNOS_DRM_BUF_H_ |
| 28 | 28 | ||
| 29 | /* | ||
| 30 | * exynos drm buffer entry structure. | ||
| 31 | * | ||
| 32 | * @paddr: physical address of allocated memory. | ||
| 33 | * @vaddr: kernel virtual address of allocated memory. | ||
| 34 | * @size: size of allocated memory. | ||
| 35 | */ | ||
| 36 | struct exynos_drm_buf_entry { | ||
| 37 | dma_addr_t paddr; | ||
| 38 | void __iomem *vaddr; | ||
| 39 | unsigned int size; | ||
| 40 | }; | ||
| 41 | |||
| 42 | /* allocate physical memory. */ | 29 | /* allocate physical memory. */ |
| 43 | struct exynos_drm_buf_entry *exynos_drm_buf_create(struct drm_device *dev, | 30 | struct exynos_drm_gem_buf *exynos_drm_buf_create(struct drm_device *dev, |
| 44 | unsigned int size); | 31 | unsigned int size); |
| 45 | 32 | ||
| 46 | /* get physical memory information of a drm framebuffer. */ | 33 | /* get memory information of a drm framebuffer. */ |
| 47 | struct exynos_drm_buf_entry *exynos_drm_fb_get_buf(struct drm_framebuffer *fb); | 34 | struct exynos_drm_gem_buf *exynos_drm_fb_get_buf(struct drm_framebuffer *fb); |
| 48 | 35 | ||
| 49 | /* remove allocated physical memory. */ | 36 | /* remove allocated physical memory. */ |
| 50 | void exynos_drm_buf_destroy(struct drm_device *dev, | 37 | void exynos_drm_buf_destroy(struct drm_device *dev, |
| 51 | struct exynos_drm_buf_entry *entry); | 38 | struct exynos_drm_gem_buf *buffer); |
| 52 | 39 | ||
| 53 | #endif | 40 | #endif |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_connector.c b/drivers/gpu/drm/exynos/exynos_drm_connector.c index 985d9e768728..d620b0784257 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_connector.c +++ b/drivers/gpu/drm/exynos/exynos_drm_connector.c | |||
| @@ -37,6 +37,8 @@ | |||
| 37 | 37 | ||
| 38 | struct exynos_drm_connector { | 38 | struct exynos_drm_connector { |
| 39 | struct drm_connector drm_connector; | 39 | struct drm_connector drm_connector; |
| 40 | uint32_t encoder_id; | ||
| 41 | struct exynos_drm_manager *manager; | ||
| 40 | }; | 42 | }; |
| 41 | 43 | ||
| 42 | /* convert exynos_video_timings to drm_display_mode */ | 44 | /* convert exynos_video_timings to drm_display_mode */ |
| @@ -47,6 +49,7 @@ convert_to_display_mode(struct drm_display_mode *mode, | |||
| 47 | DRM_DEBUG_KMS("%s\n", __FILE__); | 49 | DRM_DEBUG_KMS("%s\n", __FILE__); |
| 48 | 50 | ||
| 49 | mode->clock = timing->pixclock / 1000; | 51 | mode->clock = timing->pixclock / 1000; |
| 52 | mode->vrefresh = timing->refresh; | ||
| 50 | 53 | ||
| 51 | mode->hdisplay = timing->xres; | 54 | mode->hdisplay = timing->xres; |
| 52 | mode->hsync_start = mode->hdisplay + timing->left_margin; | 55 | mode->hsync_start = mode->hdisplay + timing->left_margin; |
| @@ -57,6 +60,12 @@ convert_to_display_mode(struct drm_display_mode *mode, | |||
| 57 | mode->vsync_start = mode->vdisplay + timing->upper_margin; | 60 | mode->vsync_start = mode->vdisplay + timing->upper_margin; |
| 58 | mode->vsync_end = mode->vsync_start + timing->vsync_len; | 61 | mode->vsync_end = mode->vsync_start + timing->vsync_len; |
| 59 | mode->vtotal = mode->vsync_end + timing->lower_margin; | 62 | mode->vtotal = mode->vsync_end + timing->lower_margin; |
| 63 | |||
| 64 | if (timing->vmode & FB_VMODE_INTERLACED) | ||
| 65 | mode->flags |= DRM_MODE_FLAG_INTERLACE; | ||
| 66 | |||
| 67 | if (timing->vmode & FB_VMODE_DOUBLE) | ||
| 68 | mode->flags |= DRM_MODE_FLAG_DBLSCAN; | ||
| 60 | } | 69 | } |
| 61 | 70 | ||
| 62 | /* convert drm_display_mode to exynos_video_timings */ | 71 | /* convert drm_display_mode to exynos_video_timings */ |
| @@ -69,7 +78,7 @@ convert_to_video_timing(struct fb_videomode *timing, | |||
| 69 | memset(timing, 0, sizeof(*timing)); | 78 | memset(timing, 0, sizeof(*timing)); |
| 70 | 79 | ||
| 71 | timing->pixclock = mode->clock * 1000; | 80 | timing->pixclock = mode->clock * 1000; |
| 72 | timing->refresh = mode->vrefresh; | 81 | timing->refresh = drm_mode_vrefresh(mode); |
| 73 | 82 | ||
| 74 | timing->xres = mode->hdisplay; | 83 | timing->xres = mode->hdisplay; |
| 75 | timing->left_margin = mode->hsync_start - mode->hdisplay; | 84 | timing->left_margin = mode->hsync_start - mode->hdisplay; |
| @@ -92,15 +101,16 @@ convert_to_video_timing(struct fb_videomode *timing, | |||
| 92 | 101 | ||
| 93 | static int exynos_drm_connector_get_modes(struct drm_connector *connector) | 102 | static int exynos_drm_connector_get_modes(struct drm_connector *connector) |
| 94 | { | 103 | { |
| 95 | struct exynos_drm_manager *manager = | 104 | struct exynos_drm_connector *exynos_connector = |
| 96 | exynos_drm_get_manager(connector->encoder); | 105 | to_exynos_connector(connector); |
| 97 | struct exynos_drm_display *display = manager->display; | 106 | struct exynos_drm_manager *manager = exynos_connector->manager; |
| 107 | struct exynos_drm_display_ops *display_ops = manager->display_ops; | ||
| 98 | unsigned int count; | 108 | unsigned int count; |
| 99 | 109 | ||
| 100 | DRM_DEBUG_KMS("%s\n", __FILE__); | 110 | DRM_DEBUG_KMS("%s\n", __FILE__); |
| 101 | 111 | ||
| 102 | if (!display) { | 112 | if (!display_ops) { |
| 103 | DRM_DEBUG_KMS("display is null.\n"); | 113 | DRM_DEBUG_KMS("display_ops is null.\n"); |
| 104 | return 0; | 114 | return 0; |
| 105 | } | 115 | } |
| 106 | 116 | ||
| @@ -112,7 +122,7 @@ static int exynos_drm_connector_get_modes(struct drm_connector *connector) | |||
| 112 | * P.S. in case of lcd panel, count is always 1 if success | 122 | * P.S. in case of lcd panel, count is always 1 if success |
| 113 | * because lcd panel has only one mode. | 123 | * because lcd panel has only one mode. |
| 114 | */ | 124 | */ |
| 115 | if (display->get_edid) { | 125 | if (display_ops->get_edid) { |
| 116 | int ret; | 126 | int ret; |
| 117 | void *edid; | 127 | void *edid; |
| 118 | 128 | ||
| @@ -122,7 +132,7 @@ static int exynos_drm_connector_get_modes(struct drm_connector *connector) | |||
| 122 | return 0; | 132 | return 0; |
| 123 | } | 133 | } |
| 124 | 134 | ||
| 125 | ret = display->get_edid(manager->dev, connector, | 135 | ret = display_ops->get_edid(manager->dev, connector, |
| 126 | edid, MAX_EDID); | 136 | edid, MAX_EDID); |
| 127 | if (ret < 0) { | 137 | if (ret < 0) { |
| 128 | DRM_ERROR("failed to get edid data.\n"); | 138 | DRM_ERROR("failed to get edid data.\n"); |
| @@ -140,8 +150,8 @@ static int exynos_drm_connector_get_modes(struct drm_connector *connector) | |||
| 140 | struct drm_display_mode *mode = drm_mode_create(connector->dev); | 150 | struct drm_display_mode *mode = drm_mode_create(connector->dev); |
| 141 | struct fb_videomode *timing; | 151 | struct fb_videomode *timing; |
| 142 | 152 | ||
| 143 | if (display->get_timing) | 153 | if (display_ops->get_timing) |
| 144 | timing = display->get_timing(manager->dev); | 154 | timing = display_ops->get_timing(manager->dev); |
| 145 | else { | 155 | else { |
| 146 | drm_mode_destroy(connector->dev, mode); | 156 | drm_mode_destroy(connector->dev, mode); |
| 147 | return 0; | 157 | return 0; |
| @@ -162,9 +172,10 @@ static int exynos_drm_connector_get_modes(struct drm_connector *connector) | |||
| 162 | static int exynos_drm_connector_mode_valid(struct drm_connector *connector, | 172 | static int exynos_drm_connector_mode_valid(struct drm_connector *connector, |
| 163 | struct drm_display_mode *mode) | 173 | struct drm_display_mode *mode) |
| 164 | { | 174 | { |
| 165 | struct exynos_drm_manager *manager = | 175 | struct exynos_drm_connector *exynos_connector = |
| 166 | exynos_drm_get_manager(connector->encoder); | 176 | to_exynos_connector(connector); |
| 167 | struct exynos_drm_display *display = manager->display; | 177 | struct exynos_drm_manager *manager = exynos_connector->manager; |
| 178 | struct exynos_drm_display_ops *display_ops = manager->display_ops; | ||
| 168 | struct fb_videomode timing; | 179 | struct fb_videomode timing; |
| 169 | int ret = MODE_BAD; | 180 | int ret = MODE_BAD; |
| 170 | 181 | ||
| @@ -172,8 +183,8 @@ static int exynos_drm_connector_mode_valid(struct drm_connector *connector, | |||
| 172 | 183 | ||
| 173 | convert_to_video_timing(&timing, mode); | 184 | convert_to_video_timing(&timing, mode); |
| 174 | 185 | ||
| 175 | if (display && display->check_timing) | 186 | if (display_ops && display_ops->check_timing) |
| 176 | if (!display->check_timing(manager->dev, (void *)&timing)) | 187 | if (!display_ops->check_timing(manager->dev, (void *)&timing)) |
| 177 | ret = MODE_OK; | 188 | ret = MODE_OK; |
| 178 | 189 | ||
| 179 | return ret; | 190 | return ret; |
| @@ -181,9 +192,25 @@ static int exynos_drm_connector_mode_valid(struct drm_connector *connector, | |||
| 181 | 192 | ||
| 182 | struct drm_encoder *exynos_drm_best_encoder(struct drm_connector *connector) | 193 | struct drm_encoder *exynos_drm_best_encoder(struct drm_connector *connector) |
| 183 | { | 194 | { |
| 195 | struct drm_device *dev = connector->dev; | ||
| 196 | struct exynos_drm_connector *exynos_connector = | ||
| 197 | to_exynos_connector(connector); | ||
| 198 | struct drm_mode_object *obj; | ||
| 199 | struct drm_encoder *encoder; | ||
| 200 | |||
| 184 | DRM_DEBUG_KMS("%s\n", __FILE__); | 201 | DRM_DEBUG_KMS("%s\n", __FILE__); |
| 185 | 202 | ||
| 186 | return connector->encoder; | 203 | obj = drm_mode_object_find(dev, exynos_connector->encoder_id, |
| 204 | DRM_MODE_OBJECT_ENCODER); | ||
| 205 | if (!obj) { | ||
| 206 | DRM_DEBUG_KMS("Unknown ENCODER ID %d\n", | ||
| 207 | exynos_connector->encoder_id); | ||
| 208 | return NULL; | ||
| 209 | } | ||
| 210 | |||
| 211 | encoder = obj_to_encoder(obj); | ||
| 212 | |||
| 213 | return encoder; | ||
| 187 | } | 214 | } |
| 188 | 215 | ||
| 189 | static struct drm_connector_helper_funcs exynos_connector_helper_funcs = { | 216 | static struct drm_connector_helper_funcs exynos_connector_helper_funcs = { |
| @@ -196,15 +223,17 @@ static struct drm_connector_helper_funcs exynos_connector_helper_funcs = { | |||
| 196 | static enum drm_connector_status | 223 | static enum drm_connector_status |
| 197 | exynos_drm_connector_detect(struct drm_connector *connector, bool force) | 224 | exynos_drm_connector_detect(struct drm_connector *connector, bool force) |
| 198 | { | 225 | { |
| 199 | struct exynos_drm_manager *manager = | 226 | struct exynos_drm_connector *exynos_connector = |
| 200 | exynos_drm_get_manager(connector->encoder); | 227 | to_exynos_connector(connector); |
| 201 | struct exynos_drm_display *display = manager->display; | 228 | struct exynos_drm_manager *manager = exynos_connector->manager; |
| 229 | struct exynos_drm_display_ops *display_ops = | ||
| 230 | manager->display_ops; | ||
| 202 | enum drm_connector_status status = connector_status_disconnected; | 231 | enum drm_connector_status status = connector_status_disconnected; |
| 203 | 232 | ||
| 204 | DRM_DEBUG_KMS("%s\n", __FILE__); | 233 | DRM_DEBUG_KMS("%s\n", __FILE__); |
| 205 | 234 | ||
| 206 | if (display && display->is_connected) { | 235 | if (display_ops && display_ops->is_connected) { |
| 207 | if (display->is_connected(manager->dev)) | 236 | if (display_ops->is_connected(manager->dev)) |
| 208 | status = connector_status_connected; | 237 | status = connector_status_connected; |
| 209 | else | 238 | else |
| 210 | status = connector_status_disconnected; | 239 | status = connector_status_disconnected; |
| @@ -251,9 +280,11 @@ struct drm_connector *exynos_drm_connector_create(struct drm_device *dev, | |||
| 251 | 280 | ||
| 252 | connector = &exynos_connector->drm_connector; | 281 | connector = &exynos_connector->drm_connector; |
| 253 | 282 | ||
| 254 | switch (manager->display->type) { | 283 | switch (manager->display_ops->type) { |
| 255 | case EXYNOS_DISPLAY_TYPE_HDMI: | 284 | case EXYNOS_DISPLAY_TYPE_HDMI: |
| 256 | type = DRM_MODE_CONNECTOR_HDMIA; | 285 | type = DRM_MODE_CONNECTOR_HDMIA; |
| 286 | connector->interlace_allowed = true; | ||
| 287 | connector->polled = DRM_CONNECTOR_POLL_HPD; | ||
| 257 | break; | 288 | break; |
| 258 | default: | 289 | default: |
| 259 | type = DRM_MODE_CONNECTOR_Unknown; | 290 | type = DRM_MODE_CONNECTOR_Unknown; |
| @@ -267,7 +298,10 @@ struct drm_connector *exynos_drm_connector_create(struct drm_device *dev, | |||
| 267 | if (err) | 298 | if (err) |
| 268 | goto err_connector; | 299 | goto err_connector; |
| 269 | 300 | ||
| 301 | exynos_connector->encoder_id = encoder->base.id; | ||
| 302 | exynos_connector->manager = manager; | ||
| 270 | connector->encoder = encoder; | 303 | connector->encoder = encoder; |
| 304 | |||
| 271 | err = drm_mode_connector_attach_encoder(connector, encoder); | 305 | err = drm_mode_connector_attach_encoder(connector, encoder); |
| 272 | if (err) { | 306 | if (err) { |
| 273 | DRM_ERROR("failed to attach a connector to a encoder\n"); | 307 | DRM_ERROR("failed to attach a connector to a encoder\n"); |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c b/drivers/gpu/drm/exynos/exynos_drm_crtc.c index 9337e5e2dbb6..ee43cc220853 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c +++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c | |||
| @@ -29,36 +29,17 @@ | |||
| 29 | #include "drmP.h" | 29 | #include "drmP.h" |
| 30 | #include "drm_crtc_helper.h" | 30 | #include "drm_crtc_helper.h" |
| 31 | 31 | ||
| 32 | #include "exynos_drm_crtc.h" | ||
| 32 | #include "exynos_drm_drv.h" | 33 | #include "exynos_drm_drv.h" |
| 33 | #include "exynos_drm_fb.h" | 34 | #include "exynos_drm_fb.h" |
| 34 | #include "exynos_drm_encoder.h" | 35 | #include "exynos_drm_encoder.h" |
| 36 | #include "exynos_drm_gem.h" | ||
| 35 | #include "exynos_drm_buf.h" | 37 | #include "exynos_drm_buf.h" |
| 36 | 38 | ||
| 37 | #define to_exynos_crtc(x) container_of(x, struct exynos_drm_crtc,\ | 39 | #define to_exynos_crtc(x) container_of(x, struct exynos_drm_crtc,\ |
| 38 | drm_crtc) | 40 | drm_crtc) |
| 39 | 41 | ||
| 40 | /* | 42 | /* |
| 41 | * Exynos specific crtc postion structure. | ||
| 42 | * | ||
| 43 | * @fb_x: offset x on a framebuffer to be displyed | ||
| 44 | * - the unit is screen coordinates. | ||
| 45 | * @fb_y: offset y on a framebuffer to be displayed | ||
| 46 | * - the unit is screen coordinates. | ||
| 47 | * @crtc_x: offset x on hardware screen. | ||
| 48 | * @crtc_y: offset y on hardware screen. | ||
| 49 | * @crtc_w: width of hardware screen. | ||
| 50 | * @crtc_h: height of hardware screen. | ||
| 51 | */ | ||
| 52 | struct exynos_drm_crtc_pos { | ||
| 53 | unsigned int fb_x; | ||
| 54 | unsigned int fb_y; | ||
| 55 | unsigned int crtc_x; | ||
| 56 | unsigned int crtc_y; | ||
| 57 | unsigned int crtc_w; | ||
| 58 | unsigned int crtc_h; | ||
| 59 | }; | ||
| 60 | |||
| 61 | /* | ||
| 62 | * Exynos specific crtc structure. | 43 | * Exynos specific crtc structure. |
| 63 | * | 44 | * |
| 64 | * @drm_crtc: crtc object. | 45 | * @drm_crtc: crtc object. |
| @@ -85,30 +66,31 @@ static void exynos_drm_crtc_apply(struct drm_crtc *crtc) | |||
| 85 | 66 | ||
| 86 | exynos_drm_fn_encoder(crtc, overlay, | 67 | exynos_drm_fn_encoder(crtc, overlay, |
| 87 | exynos_drm_encoder_crtc_mode_set); | 68 | exynos_drm_encoder_crtc_mode_set); |
| 88 | exynos_drm_fn_encoder(crtc, NULL, exynos_drm_encoder_crtc_commit); | 69 | exynos_drm_fn_encoder(crtc, &exynos_crtc->pipe, |
| 70 | exynos_drm_encoder_crtc_commit); | ||
| 89 | } | 71 | } |
| 90 | 72 | ||
| 91 | static int exynos_drm_overlay_update(struct exynos_drm_overlay *overlay, | 73 | int exynos_drm_overlay_update(struct exynos_drm_overlay *overlay, |
| 92 | struct drm_framebuffer *fb, | 74 | struct drm_framebuffer *fb, |
| 93 | struct drm_display_mode *mode, | 75 | struct drm_display_mode *mode, |
| 94 | struct exynos_drm_crtc_pos *pos) | 76 | struct exynos_drm_crtc_pos *pos) |
| 95 | { | 77 | { |
| 96 | struct exynos_drm_buf_entry *entry; | 78 | struct exynos_drm_gem_buf *buffer; |
| 97 | unsigned int actual_w; | 79 | unsigned int actual_w; |
| 98 | unsigned int actual_h; | 80 | unsigned int actual_h; |
| 99 | 81 | ||
| 100 | entry = exynos_drm_fb_get_buf(fb); | 82 | buffer = exynos_drm_fb_get_buf(fb); |
| 101 | if (!entry) { | 83 | if (!buffer) { |
| 102 | DRM_LOG_KMS("entry is null.\n"); | 84 | DRM_LOG_KMS("buffer is null.\n"); |
| 103 | return -EFAULT; | 85 | return -EFAULT; |
| 104 | } | 86 | } |
| 105 | 87 | ||
| 106 | overlay->paddr = entry->paddr; | 88 | overlay->dma_addr = buffer->dma_addr; |
| 107 | overlay->vaddr = entry->vaddr; | 89 | overlay->vaddr = buffer->kvaddr; |
| 108 | 90 | ||
| 109 | DRM_DEBUG_KMS("vaddr = 0x%lx, paddr = 0x%lx\n", | 91 | DRM_DEBUG_KMS("vaddr = 0x%lx, dma_addr = 0x%lx\n", |
| 110 | (unsigned long)overlay->vaddr, | 92 | (unsigned long)overlay->vaddr, |
| 111 | (unsigned long)overlay->paddr); | 93 | (unsigned long)overlay->dma_addr); |
| 112 | 94 | ||
| 113 | actual_w = min((mode->hdisplay - pos->crtc_x), pos->crtc_w); | 95 | actual_w = min((mode->hdisplay - pos->crtc_x), pos->crtc_w); |
| 114 | actual_h = min((mode->vdisplay - pos->crtc_y), pos->crtc_h); | 96 | actual_h = min((mode->vdisplay - pos->crtc_y), pos->crtc_h); |
| @@ -171,9 +153,26 @@ static int exynos_drm_crtc_update(struct drm_crtc *crtc) | |||
| 171 | 153 | ||
| 172 | static void exynos_drm_crtc_dpms(struct drm_crtc *crtc, int mode) | 154 | static void exynos_drm_crtc_dpms(struct drm_crtc *crtc, int mode) |
| 173 | { | 155 | { |
| 174 | DRM_DEBUG_KMS("%s\n", __FILE__); | 156 | struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc); |
| 175 | 157 | ||
| 176 | /* TODO */ | 158 | DRM_DEBUG_KMS("crtc[%d] mode[%d]\n", crtc->base.id, mode); |
| 159 | |||
| 160 | switch (mode) { | ||
| 161 | case DRM_MODE_DPMS_ON: | ||
| 162 | exynos_drm_fn_encoder(crtc, &exynos_crtc->pipe, | ||
| 163 | exynos_drm_encoder_crtc_commit); | ||
| 164 | break; | ||
| 165 | case DRM_MODE_DPMS_STANDBY: | ||
| 166 | case DRM_MODE_DPMS_SUSPEND: | ||
| 167 | case DRM_MODE_DPMS_OFF: | ||
| 168 | /* TODO */ | ||
| 169 | exynos_drm_fn_encoder(crtc, NULL, | ||
| 170 | exynos_drm_encoder_crtc_disable); | ||
| 171 | break; | ||
| 172 | default: | ||
| 173 | DRM_DEBUG_KMS("unspecified mode %d\n", mode); | ||
| 174 | break; | ||
| 175 | } | ||
| 177 | } | 176 | } |
| 178 | 177 | ||
| 179 | static void exynos_drm_crtc_prepare(struct drm_crtc *crtc) | 178 | static void exynos_drm_crtc_prepare(struct drm_crtc *crtc) |
| @@ -185,9 +184,12 @@ static void exynos_drm_crtc_prepare(struct drm_crtc *crtc) | |||
| 185 | 184 | ||
| 186 | static void exynos_drm_crtc_commit(struct drm_crtc *crtc) | 185 | static void exynos_drm_crtc_commit(struct drm_crtc *crtc) |
| 187 | { | 186 | { |
| 187 | struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc); | ||
| 188 | |||
| 188 | DRM_DEBUG_KMS("%s\n", __FILE__); | 189 | DRM_DEBUG_KMS("%s\n", __FILE__); |
| 189 | 190 | ||
| 190 | /* drm framework doesn't check NULL. */ | 191 | exynos_drm_fn_encoder(crtc, &exynos_crtc->pipe, |
| 192 | exynos_drm_encoder_crtc_commit); | ||
| 191 | } | 193 | } |
| 192 | 194 | ||
| 193 | static bool | 195 | static bool |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.h b/drivers/gpu/drm/exynos/exynos_drm_crtc.h index c584042d6d2c..25f72a62cb88 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_crtc.h +++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.h | |||
| @@ -35,4 +35,29 @@ int exynos_drm_crtc_create(struct drm_device *dev, unsigned int nr); | |||
| 35 | int exynos_drm_crtc_enable_vblank(struct drm_device *dev, int crtc); | 35 | int exynos_drm_crtc_enable_vblank(struct drm_device *dev, int crtc); |
| 36 | void exynos_drm_crtc_disable_vblank(struct drm_device *dev, int crtc); | 36 | void exynos_drm_crtc_disable_vblank(struct drm_device *dev, int crtc); |
| 37 | 37 | ||
| 38 | /* | ||
| 39 | * Exynos specific crtc postion structure. | ||
| 40 | * | ||
| 41 | * @fb_x: offset x on a framebuffer to be displyed | ||
| 42 | * - the unit is screen coordinates. | ||
| 43 | * @fb_y: offset y on a framebuffer to be displayed | ||
| 44 | * - the unit is screen coordinates. | ||
| 45 | * @crtc_x: offset x on hardware screen. | ||
| 46 | * @crtc_y: offset y on hardware screen. | ||
| 47 | * @crtc_w: width of hardware screen. | ||
| 48 | * @crtc_h: height of hardware screen. | ||
| 49 | */ | ||
| 50 | struct exynos_drm_crtc_pos { | ||
| 51 | unsigned int fb_x; | ||
| 52 | unsigned int fb_y; | ||
| 53 | unsigned int crtc_x; | ||
| 54 | unsigned int crtc_y; | ||
| 55 | unsigned int crtc_w; | ||
| 56 | unsigned int crtc_h; | ||
| 57 | }; | ||
| 58 | |||
| 59 | int exynos_drm_overlay_update(struct exynos_drm_overlay *overlay, | ||
| 60 | struct drm_framebuffer *fb, | ||
| 61 | struct drm_display_mode *mode, | ||
| 62 | struct exynos_drm_crtc_pos *pos); | ||
| 38 | #endif | 63 | #endif |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c b/drivers/gpu/drm/exynos/exynos_drm_drv.c index 83810cbe3c17..53e2216de61d 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_drv.c +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c | |||
| @@ -27,6 +27,7 @@ | |||
| 27 | 27 | ||
| 28 | #include "drmP.h" | 28 | #include "drmP.h" |
| 29 | #include "drm.h" | 29 | #include "drm.h" |
| 30 | #include "drm_crtc_helper.h" | ||
| 30 | 31 | ||
| 31 | #include <drm/exynos_drm.h> | 32 | #include <drm/exynos_drm.h> |
| 32 | 33 | ||
| @@ -61,6 +62,9 @@ static int exynos_drm_load(struct drm_device *dev, unsigned long flags) | |||
| 61 | 62 | ||
| 62 | drm_mode_config_init(dev); | 63 | drm_mode_config_init(dev); |
| 63 | 64 | ||
| 65 | /* init kms poll for handling hpd */ | ||
| 66 | drm_kms_helper_poll_init(dev); | ||
| 67 | |||
| 64 | exynos_drm_mode_config_init(dev); | 68 | exynos_drm_mode_config_init(dev); |
| 65 | 69 | ||
| 66 | /* | 70 | /* |
| @@ -116,6 +120,7 @@ static int exynos_drm_unload(struct drm_device *dev) | |||
| 116 | exynos_drm_fbdev_fini(dev); | 120 | exynos_drm_fbdev_fini(dev); |
| 117 | exynos_drm_device_unregister(dev); | 121 | exynos_drm_device_unregister(dev); |
| 118 | drm_vblank_cleanup(dev); | 122 | drm_vblank_cleanup(dev); |
| 123 | drm_kms_helper_poll_fini(dev); | ||
| 119 | drm_mode_config_cleanup(dev); | 124 | drm_mode_config_cleanup(dev); |
| 120 | kfree(dev->dev_private); | 125 | kfree(dev->dev_private); |
| 121 | 126 | ||
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h b/drivers/gpu/drm/exynos/exynos_drm_drv.h index c03683f2ae72..5e02e6ecc2e0 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_drv.h +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h | |||
| @@ -29,6 +29,7 @@ | |||
| 29 | #ifndef _EXYNOS_DRM_DRV_H_ | 29 | #ifndef _EXYNOS_DRM_DRV_H_ |
| 30 | #define _EXYNOS_DRM_DRV_H_ | 30 | #define _EXYNOS_DRM_DRV_H_ |
| 31 | 31 | ||
| 32 | #include <linux/module.h> | ||
| 32 | #include "drm.h" | 33 | #include "drm.h" |
| 33 | 34 | ||
| 34 | #define MAX_CRTC 2 | 35 | #define MAX_CRTC 2 |
| @@ -79,8 +80,8 @@ struct exynos_drm_overlay_ops { | |||
| 79 | * @scan_flag: interlace or progressive way. | 80 | * @scan_flag: interlace or progressive way. |
| 80 | * (it could be DRM_MODE_FLAG_*) | 81 | * (it could be DRM_MODE_FLAG_*) |
| 81 | * @bpp: pixel size.(in bit) | 82 | * @bpp: pixel size.(in bit) |
| 82 | * @paddr: bus(accessed by dma) physical memory address to this overlay | 83 | * @dma_addr: bus(accessed by dma) address to the memory region allocated |
| 83 | * and this is physically continuous. | 84 | * for a overlay. |
| 84 | * @vaddr: virtual memory addresss to this overlay. | 85 | * @vaddr: virtual memory addresss to this overlay. |
| 85 | * @default_win: a window to be enabled. | 86 | * @default_win: a window to be enabled. |
| 86 | * @color_key: color key on or off. | 87 | * @color_key: color key on or off. |
| @@ -108,7 +109,7 @@ struct exynos_drm_overlay { | |||
| 108 | unsigned int scan_flag; | 109 | unsigned int scan_flag; |
| 109 | unsigned int bpp; | 110 | unsigned int bpp; |
| 110 | unsigned int pitch; | 111 | unsigned int pitch; |
| 111 | dma_addr_t paddr; | 112 | dma_addr_t dma_addr; |
| 112 | void __iomem *vaddr; | 113 | void __iomem *vaddr; |
| 113 | 114 | ||
| 114 | bool default_win; | 115 | bool default_win; |
| @@ -130,7 +131,7 @@ struct exynos_drm_overlay { | |||
| 130 | * @check_timing: check if timing is valid or not. | 131 | * @check_timing: check if timing is valid or not. |
| 131 | * @power_on: display device on or off. | 132 | * @power_on: display device on or off. |
| 132 | */ | 133 | */ |
| 133 | struct exynos_drm_display { | 134 | struct exynos_drm_display_ops { |
| 134 | enum exynos_drm_output_type type; | 135 | enum exynos_drm_output_type type; |
| 135 | bool (*is_connected)(struct device *dev); | 136 | bool (*is_connected)(struct device *dev); |
| 136 | int (*get_edid)(struct device *dev, struct drm_connector *connector, | 137 | int (*get_edid)(struct device *dev, struct drm_connector *connector, |
| @@ -146,12 +147,14 @@ struct exynos_drm_display { | |||
| 146 | * @mode_set: convert drm_display_mode to hw specific display mode and | 147 | * @mode_set: convert drm_display_mode to hw specific display mode and |
| 147 | * would be called by encoder->mode_set(). | 148 | * would be called by encoder->mode_set(). |
| 148 | * @commit: set current hw specific display mode to hw. | 149 | * @commit: set current hw specific display mode to hw. |
| 150 | * @disable: disable hardware specific display mode. | ||
| 149 | * @enable_vblank: specific driver callback for enabling vblank interrupt. | 151 | * @enable_vblank: specific driver callback for enabling vblank interrupt. |
| 150 | * @disable_vblank: specific driver callback for disabling vblank interrupt. | 152 | * @disable_vblank: specific driver callback for disabling vblank interrupt. |
| 151 | */ | 153 | */ |
| 152 | struct exynos_drm_manager_ops { | 154 | struct exynos_drm_manager_ops { |
| 153 | void (*mode_set)(struct device *subdrv_dev, void *mode); | 155 | void (*mode_set)(struct device *subdrv_dev, void *mode); |
| 154 | void (*commit)(struct device *subdrv_dev); | 156 | void (*commit)(struct device *subdrv_dev); |
| 157 | void (*disable)(struct device *subdrv_dev); | ||
| 155 | int (*enable_vblank)(struct device *subdrv_dev); | 158 | int (*enable_vblank)(struct device *subdrv_dev); |
| 156 | void (*disable_vblank)(struct device *subdrv_dev); | 159 | void (*disable_vblank)(struct device *subdrv_dev); |
| 157 | }; | 160 | }; |
| @@ -178,7 +181,7 @@ struct exynos_drm_manager { | |||
| 178 | int pipe; | 181 | int pipe; |
| 179 | struct exynos_drm_manager_ops *ops; | 182 | struct exynos_drm_manager_ops *ops; |
| 180 | struct exynos_drm_overlay_ops *overlay_ops; | 183 | struct exynos_drm_overlay_ops *overlay_ops; |
| 181 | struct exynos_drm_display *display; | 184 | struct exynos_drm_display_ops *display_ops; |
| 182 | }; | 185 | }; |
| 183 | 186 | ||
| 184 | /* | 187 | /* |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_encoder.c b/drivers/gpu/drm/exynos/exynos_drm_encoder.c index 7cf6fa86a67e..153061415baf 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_encoder.c +++ b/drivers/gpu/drm/exynos/exynos_drm_encoder.c | |||
| @@ -53,15 +53,36 @@ static void exynos_drm_encoder_dpms(struct drm_encoder *encoder, int mode) | |||
| 53 | struct drm_device *dev = encoder->dev; | 53 | struct drm_device *dev = encoder->dev; |
| 54 | struct drm_connector *connector; | 54 | struct drm_connector *connector; |
| 55 | struct exynos_drm_manager *manager = exynos_drm_get_manager(encoder); | 55 | struct exynos_drm_manager *manager = exynos_drm_get_manager(encoder); |
| 56 | struct exynos_drm_manager_ops *manager_ops = manager->ops; | ||
| 56 | 57 | ||
| 57 | DRM_DEBUG_KMS("%s, encoder dpms: %d\n", __FILE__, mode); | 58 | DRM_DEBUG_KMS("%s, encoder dpms: %d\n", __FILE__, mode); |
| 58 | 59 | ||
| 60 | switch (mode) { | ||
| 61 | case DRM_MODE_DPMS_ON: | ||
| 62 | if (manager_ops && manager_ops->commit) | ||
| 63 | manager_ops->commit(manager->dev); | ||
| 64 | break; | ||
| 65 | case DRM_MODE_DPMS_STANDBY: | ||
| 66 | case DRM_MODE_DPMS_SUSPEND: | ||
| 67 | case DRM_MODE_DPMS_OFF: | ||
| 68 | /* TODO */ | ||
| 69 | if (manager_ops && manager_ops->disable) | ||
| 70 | manager_ops->disable(manager->dev); | ||
| 71 | break; | ||
| 72 | default: | ||
| 73 | DRM_ERROR("unspecified mode %d\n", mode); | ||
| 74 | break; | ||
| 75 | } | ||
| 76 | |||
| 59 | list_for_each_entry(connector, &dev->mode_config.connector_list, head) { | 77 | list_for_each_entry(connector, &dev->mode_config.connector_list, head) { |
| 60 | if (connector->encoder == encoder) { | 78 | if (connector->encoder == encoder) { |
| 61 | struct exynos_drm_display *display = manager->display; | 79 | struct exynos_drm_display_ops *display_ops = |
| 80 | manager->display_ops; | ||
| 62 | 81 | ||
| 63 | if (display && display->power_on) | 82 | DRM_DEBUG_KMS("connector[%d] dpms[%d]\n", |
| 64 | display->power_on(manager->dev, mode); | 83 | connector->base.id, mode); |
| 84 | if (display_ops && display_ops->power_on) | ||
| 85 | display_ops->power_on(manager->dev, mode); | ||
| 65 | } | 86 | } |
| 66 | } | 87 | } |
| 67 | } | 88 | } |
| @@ -116,15 +137,11 @@ static void exynos_drm_encoder_commit(struct drm_encoder *encoder) | |||
| 116 | { | 137 | { |
| 117 | struct exynos_drm_manager *manager = exynos_drm_get_manager(encoder); | 138 | struct exynos_drm_manager *manager = exynos_drm_get_manager(encoder); |
| 118 | struct exynos_drm_manager_ops *manager_ops = manager->ops; | 139 | struct exynos_drm_manager_ops *manager_ops = manager->ops; |
| 119 | struct exynos_drm_overlay_ops *overlay_ops = manager->overlay_ops; | ||
| 120 | 140 | ||
| 121 | DRM_DEBUG_KMS("%s\n", __FILE__); | 141 | DRM_DEBUG_KMS("%s\n", __FILE__); |
| 122 | 142 | ||
| 123 | if (manager_ops && manager_ops->commit) | 143 | if (manager_ops && manager_ops->commit) |
| 124 | manager_ops->commit(manager->dev); | 144 | manager_ops->commit(manager->dev); |
| 125 | |||
| 126 | if (overlay_ops && overlay_ops->commit) | ||
| 127 | overlay_ops->commit(manager->dev); | ||
| 128 | } | 145 | } |
| 129 | 146 | ||
| 130 | static struct drm_crtc * | 147 | static struct drm_crtc * |
| @@ -208,10 +225,23 @@ void exynos_drm_fn_encoder(struct drm_crtc *crtc, void *data, | |||
| 208 | { | 225 | { |
| 209 | struct drm_device *dev = crtc->dev; | 226 | struct drm_device *dev = crtc->dev; |
| 210 | struct drm_encoder *encoder; | 227 | struct drm_encoder *encoder; |
| 228 | struct exynos_drm_private *private = dev->dev_private; | ||
| 229 | struct exynos_drm_manager *manager; | ||
| 211 | 230 | ||
| 212 | list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) { | 231 | list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) { |
| 213 | if (encoder->crtc != crtc) | 232 | /* |
| 214 | continue; | 233 | * if crtc is detached from encoder, check pipe, |
| 234 | * otherwise check crtc attached to encoder | ||
| 235 | */ | ||
| 236 | if (!encoder->crtc) { | ||
| 237 | manager = to_exynos_encoder(encoder)->manager; | ||
| 238 | if (manager->pipe < 0 || | ||
| 239 | private->crtc[manager->pipe] != crtc) | ||
| 240 | continue; | ||
| 241 | } else { | ||
| 242 | if (encoder->crtc != crtc) | ||
| 243 | continue; | ||
| 244 | } | ||
| 215 | 245 | ||
| 216 | fn(encoder, data); | 246 | fn(encoder, data); |
| 217 | } | 247 | } |
| @@ -250,8 +280,18 @@ void exynos_drm_encoder_crtc_commit(struct drm_encoder *encoder, void *data) | |||
| 250 | struct exynos_drm_manager *manager = | 280 | struct exynos_drm_manager *manager = |
| 251 | to_exynos_encoder(encoder)->manager; | 281 | to_exynos_encoder(encoder)->manager; |
| 252 | struct exynos_drm_overlay_ops *overlay_ops = manager->overlay_ops; | 282 | struct exynos_drm_overlay_ops *overlay_ops = manager->overlay_ops; |
| 283 | int crtc = *(int *)data; | ||
| 284 | |||
| 285 | DRM_DEBUG_KMS("%s\n", __FILE__); | ||
| 286 | |||
| 287 | /* | ||
| 288 | * when crtc is detached from encoder, this pipe is used | ||
| 289 | * to select manager operation | ||
| 290 | */ | ||
| 291 | manager->pipe = crtc; | ||
| 253 | 292 | ||
| 254 | overlay_ops->commit(manager->dev); | 293 | if (overlay_ops && overlay_ops->commit) |
| 294 | overlay_ops->commit(manager->dev); | ||
| 255 | } | 295 | } |
| 256 | 296 | ||
| 257 | void exynos_drm_encoder_crtc_mode_set(struct drm_encoder *encoder, void *data) | 297 | void exynos_drm_encoder_crtc_mode_set(struct drm_encoder *encoder, void *data) |
| @@ -261,7 +301,28 @@ void exynos_drm_encoder_crtc_mode_set(struct drm_encoder *encoder, void *data) | |||
| 261 | struct exynos_drm_overlay_ops *overlay_ops = manager->overlay_ops; | 301 | struct exynos_drm_overlay_ops *overlay_ops = manager->overlay_ops; |
| 262 | struct exynos_drm_overlay *overlay = data; | 302 | struct exynos_drm_overlay *overlay = data; |
| 263 | 303 | ||
| 264 | overlay_ops->mode_set(manager->dev, overlay); | 304 | if (overlay_ops && overlay_ops->mode_set) |
| 305 | overlay_ops->mode_set(manager->dev, overlay); | ||
| 306 | } | ||
| 307 | |||
| 308 | void exynos_drm_encoder_crtc_disable(struct drm_encoder *encoder, void *data) | ||
| 309 | { | ||
| 310 | struct exynos_drm_manager *manager = | ||
| 311 | to_exynos_encoder(encoder)->manager; | ||
| 312 | struct exynos_drm_overlay_ops *overlay_ops = manager->overlay_ops; | ||
| 313 | |||
| 314 | DRM_DEBUG_KMS("\n"); | ||
| 315 | |||
| 316 | if (overlay_ops && overlay_ops->disable) | ||
| 317 | overlay_ops->disable(manager->dev); | ||
| 318 | |||
| 319 | /* | ||
| 320 | * crtc is already detached from encoder and last | ||
| 321 | * function for detaching is properly done, so | ||
| 322 | * clear pipe from manager to prevent repeated call | ||
| 323 | */ | ||
| 324 | if (!encoder->crtc) | ||
| 325 | manager->pipe = -1; | ||
| 265 | } | 326 | } |
| 266 | 327 | ||
| 267 | MODULE_AUTHOR("Inki Dae <inki.dae@samsung.com>"); | 328 | MODULE_AUTHOR("Inki Dae <inki.dae@samsung.com>"); |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_encoder.h b/drivers/gpu/drm/exynos/exynos_drm_encoder.h index 5ecd645d06a9..a22acfbf0e4e 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_encoder.h +++ b/drivers/gpu/drm/exynos/exynos_drm_encoder.h | |||
| @@ -41,5 +41,6 @@ void exynos_drm_enable_vblank(struct drm_encoder *encoder, void *data); | |||
| 41 | void exynos_drm_disable_vblank(struct drm_encoder *encoder, void *data); | 41 | void exynos_drm_disable_vblank(struct drm_encoder *encoder, void *data); |
| 42 | void exynos_drm_encoder_crtc_commit(struct drm_encoder *encoder, void *data); | 42 | void exynos_drm_encoder_crtc_commit(struct drm_encoder *encoder, void *data); |
| 43 | void exynos_drm_encoder_crtc_mode_set(struct drm_encoder *encoder, void *data); | 43 | void exynos_drm_encoder_crtc_mode_set(struct drm_encoder *encoder, void *data); |
| 44 | void exynos_drm_encoder_crtc_disable(struct drm_encoder *encoder, void *data); | ||
| 44 | 45 | ||
| 45 | #endif | 46 | #endif |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fb.c b/drivers/gpu/drm/exynos/exynos_drm_fb.c index 48d29cfd5240..5bf4a1ac7f82 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fb.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fb.c | |||
| @@ -29,7 +29,9 @@ | |||
| 29 | #include "drmP.h" | 29 | #include "drmP.h" |
| 30 | #include "drm_crtc.h" | 30 | #include "drm_crtc.h" |
| 31 | #include "drm_crtc_helper.h" | 31 | #include "drm_crtc_helper.h" |
| 32 | #include "drm_fb_helper.h" | ||
| 32 | 33 | ||
| 34 | #include "exynos_drm_drv.h" | ||
| 33 | #include "exynos_drm_fb.h" | 35 | #include "exynos_drm_fb.h" |
| 34 | #include "exynos_drm_buf.h" | 36 | #include "exynos_drm_buf.h" |
| 35 | #include "exynos_drm_gem.h" | 37 | #include "exynos_drm_gem.h" |
| @@ -41,14 +43,14 @@ | |||
| 41 | * | 43 | * |
| 42 | * @fb: drm framebuffer obejct. | 44 | * @fb: drm framebuffer obejct. |
| 43 | * @exynos_gem_obj: exynos specific gem object containing a gem object. | 45 | * @exynos_gem_obj: exynos specific gem object containing a gem object. |
| 44 | * @entry: pointer to exynos drm buffer entry object. | 46 | * @buffer: pointer to exynos_drm_gem_buffer object. |
| 45 | * - containing only the information to physically continuous memory | 47 | * - contain the memory information to memory region allocated |
| 46 | * region allocated at default framebuffer creation. | 48 | * at default framebuffer creation. |
| 47 | */ | 49 | */ |
| 48 | struct exynos_drm_fb { | 50 | struct exynos_drm_fb { |
| 49 | struct drm_framebuffer fb; | 51 | struct drm_framebuffer fb; |
| 50 | struct exynos_drm_gem_obj *exynos_gem_obj; | 52 | struct exynos_drm_gem_obj *exynos_gem_obj; |
| 51 | struct exynos_drm_buf_entry *entry; | 53 | struct exynos_drm_gem_buf *buffer; |
| 52 | }; | 54 | }; |
| 53 | 55 | ||
| 54 | static void exynos_drm_fb_destroy(struct drm_framebuffer *fb) | 56 | static void exynos_drm_fb_destroy(struct drm_framebuffer *fb) |
| @@ -63,8 +65,8 @@ static void exynos_drm_fb_destroy(struct drm_framebuffer *fb) | |||
| 63 | * default framebuffer has no gem object so | 65 | * default framebuffer has no gem object so |
| 64 | * a buffer of the default framebuffer should be released at here. | 66 | * a buffer of the default framebuffer should be released at here. |
| 65 | */ | 67 | */ |
| 66 | if (!exynos_fb->exynos_gem_obj && exynos_fb->entry) | 68 | if (!exynos_fb->exynos_gem_obj && exynos_fb->buffer) |
| 67 | exynos_drm_buf_destroy(fb->dev, exynos_fb->entry); | 69 | exynos_drm_buf_destroy(fb->dev, exynos_fb->buffer); |
| 68 | 70 | ||
| 69 | kfree(exynos_fb); | 71 | kfree(exynos_fb); |
| 70 | exynos_fb = NULL; | 72 | exynos_fb = NULL; |
| @@ -143,29 +145,29 @@ exynos_drm_fb_init(struct drm_file *file_priv, struct drm_device *dev, | |||
| 143 | */ | 145 | */ |
| 144 | if (!mode_cmd->handle) { | 146 | if (!mode_cmd->handle) { |
| 145 | if (!file_priv) { | 147 | if (!file_priv) { |
| 146 | struct exynos_drm_buf_entry *entry; | 148 | struct exynos_drm_gem_buf *buffer; |
| 147 | 149 | ||
| 148 | /* | 150 | /* |
| 149 | * in case that file_priv is NULL, it allocates | 151 | * in case that file_priv is NULL, it allocates |
| 150 | * only buffer and this buffer would be used | 152 | * only buffer and this buffer would be used |
| 151 | * for default framebuffer. | 153 | * for default framebuffer. |
| 152 | */ | 154 | */ |
| 153 | entry = exynos_drm_buf_create(dev, size); | 155 | buffer = exynos_drm_buf_create(dev, size); |
| 154 | if (IS_ERR(entry)) { | 156 | if (IS_ERR(buffer)) { |
| 155 | ret = PTR_ERR(entry); | 157 | ret = PTR_ERR(buffer); |
| 156 | goto err_buffer; | 158 | goto err_buffer; |
| 157 | } | 159 | } |
| 158 | 160 | ||
| 159 | exynos_fb->entry = entry; | 161 | exynos_fb->buffer = buffer; |
| 160 | 162 | ||
| 161 | DRM_LOG_KMS("default fb: paddr = 0x%lx, size = 0x%x\n", | 163 | DRM_LOG_KMS("default: dma_addr = 0x%lx, size = 0x%x\n", |
| 162 | (unsigned long)entry->paddr, size); | 164 | (unsigned long)buffer->dma_addr, size); |
| 163 | 165 | ||
| 164 | goto out; | 166 | goto out; |
| 165 | } else { | 167 | } else { |
| 166 | exynos_gem_obj = exynos_drm_gem_create(file_priv, dev, | 168 | exynos_gem_obj = exynos_drm_gem_create(dev, file_priv, |
| 167 | size, | 169 | &mode_cmd->handle, |
| 168 | &mode_cmd->handle); | 170 | size); |
| 169 | if (IS_ERR(exynos_gem_obj)) { | 171 | if (IS_ERR(exynos_gem_obj)) { |
| 170 | ret = PTR_ERR(exynos_gem_obj); | 172 | ret = PTR_ERR(exynos_gem_obj); |
| 171 | goto err_buffer; | 173 | goto err_buffer; |
| @@ -189,10 +191,10 @@ exynos_drm_fb_init(struct drm_file *file_priv, struct drm_device *dev, | |||
| 189 | * so that default framebuffer has no its own gem object, | 191 | * so that default framebuffer has no its own gem object, |
| 190 | * only its own buffer object. | 192 | * only its own buffer object. |
| 191 | */ | 193 | */ |
| 192 | exynos_fb->entry = exynos_gem_obj->entry; | 194 | exynos_fb->buffer = exynos_gem_obj->buffer; |
| 193 | 195 | ||
| 194 | DRM_LOG_KMS("paddr = 0x%lx, size = 0x%x, gem object = 0x%x\n", | 196 | DRM_LOG_KMS("dma_addr = 0x%lx, size = 0x%x, gem object = 0x%x\n", |
| 195 | (unsigned long)exynos_fb->entry->paddr, size, | 197 | (unsigned long)exynos_fb->buffer->dma_addr, size, |
| 196 | (unsigned int)&exynos_gem_obj->base); | 198 | (unsigned int)&exynos_gem_obj->base); |
| 197 | 199 | ||
| 198 | out: | 200 | out: |
| @@ -220,26 +222,36 @@ struct drm_framebuffer *exynos_drm_fb_create(struct drm_device *dev, | |||
| 220 | return exynos_drm_fb_init(file_priv, dev, mode_cmd); | 222 | return exynos_drm_fb_init(file_priv, dev, mode_cmd); |
| 221 | } | 223 | } |
| 222 | 224 | ||
| 223 | struct exynos_drm_buf_entry *exynos_drm_fb_get_buf(struct drm_framebuffer *fb) | 225 | struct exynos_drm_gem_buf *exynos_drm_fb_get_buf(struct drm_framebuffer *fb) |
| 224 | { | 226 | { |
| 225 | struct exynos_drm_fb *exynos_fb = to_exynos_fb(fb); | 227 | struct exynos_drm_fb *exynos_fb = to_exynos_fb(fb); |
| 226 | struct exynos_drm_buf_entry *entry; | 228 | struct exynos_drm_gem_buf *buffer; |
| 227 | 229 | ||
| 228 | DRM_DEBUG_KMS("%s\n", __FILE__); | 230 | DRM_DEBUG_KMS("%s\n", __FILE__); |
| 229 | 231 | ||
| 230 | entry = exynos_fb->entry; | 232 | buffer = exynos_fb->buffer; |
| 231 | if (!entry) | 233 | if (!buffer) |
| 232 | return NULL; | 234 | return NULL; |
| 233 | 235 | ||
| 234 | DRM_DEBUG_KMS("vaddr = 0x%lx, paddr = 0x%lx\n", | 236 | DRM_DEBUG_KMS("vaddr = 0x%lx, dma_addr = 0x%lx\n", |
| 235 | (unsigned long)entry->vaddr, | 237 | (unsigned long)buffer->kvaddr, |
| 236 | (unsigned long)entry->paddr); | 238 | (unsigned long)buffer->dma_addr); |
| 237 | 239 | ||
| 238 | return entry; | 240 | return buffer; |
| 241 | } | ||
| 242 | |||
| 243 | static void exynos_drm_output_poll_changed(struct drm_device *dev) | ||
| 244 | { | ||
| 245 | struct exynos_drm_private *private = dev->dev_private; | ||
| 246 | struct drm_fb_helper *fb_helper = private->fb_helper; | ||
| 247 | |||
| 248 | if (fb_helper) | ||
| 249 | drm_fb_helper_hotplug_event(fb_helper); | ||
| 239 | } | 250 | } |
| 240 | 251 | ||
| 241 | static struct drm_mode_config_funcs exynos_drm_mode_config_funcs = { | 252 | static struct drm_mode_config_funcs exynos_drm_mode_config_funcs = { |
| 242 | .fb_create = exynos_drm_fb_create, | 253 | .fb_create = exynos_drm_fb_create, |
| 254 | .output_poll_changed = exynos_drm_output_poll_changed, | ||
| 243 | }; | 255 | }; |
| 244 | 256 | ||
| 245 | void exynos_drm_mode_config_init(struct drm_device *dev) | 257 | void exynos_drm_mode_config_init(struct drm_device *dev) |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c index 1f4b3d1a7713..836f41008187 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c | |||
| @@ -33,6 +33,7 @@ | |||
| 33 | 33 | ||
| 34 | #include "exynos_drm_drv.h" | 34 | #include "exynos_drm_drv.h" |
| 35 | #include "exynos_drm_fb.h" | 35 | #include "exynos_drm_fb.h" |
| 36 | #include "exynos_drm_gem.h" | ||
| 36 | #include "exynos_drm_buf.h" | 37 | #include "exynos_drm_buf.h" |
| 37 | 38 | ||
| 38 | #define MAX_CONNECTOR 4 | 39 | #define MAX_CONNECTOR 4 |
| @@ -85,15 +86,13 @@ static struct fb_ops exynos_drm_fb_ops = { | |||
| 85 | }; | 86 | }; |
| 86 | 87 | ||
| 87 | static int exynos_drm_fbdev_update(struct drm_fb_helper *helper, | 88 | static int exynos_drm_fbdev_update(struct drm_fb_helper *helper, |
| 88 | struct drm_framebuffer *fb, | 89 | struct drm_framebuffer *fb) |
| 89 | unsigned int fb_width, | ||
| 90 | unsigned int fb_height) | ||
| 91 | { | 90 | { |
| 92 | struct fb_info *fbi = helper->fbdev; | 91 | struct fb_info *fbi = helper->fbdev; |
| 93 | struct drm_device *dev = helper->dev; | 92 | struct drm_device *dev = helper->dev; |
| 94 | struct exynos_drm_fbdev *exynos_fb = to_exynos_fbdev(helper); | 93 | struct exynos_drm_fbdev *exynos_fb = to_exynos_fbdev(helper); |
| 95 | struct exynos_drm_buf_entry *entry; | 94 | struct exynos_drm_gem_buf *buffer; |
| 96 | unsigned int size = fb_width * fb_height * (fb->bits_per_pixel >> 3); | 95 | unsigned int size = fb->width * fb->height * (fb->bits_per_pixel >> 3); |
| 97 | unsigned long offset; | 96 | unsigned long offset; |
| 98 | 97 | ||
| 99 | DRM_DEBUG_KMS("%s\n", __FILE__); | 98 | DRM_DEBUG_KMS("%s\n", __FILE__); |
| @@ -101,20 +100,20 @@ static int exynos_drm_fbdev_update(struct drm_fb_helper *helper, | |||
| 101 | exynos_fb->fb = fb; | 100 | exynos_fb->fb = fb; |
| 102 | 101 | ||
| 103 | drm_fb_helper_fill_fix(fbi, fb->pitch, fb->depth); | 102 | drm_fb_helper_fill_fix(fbi, fb->pitch, fb->depth); |
| 104 | drm_fb_helper_fill_var(fbi, helper, fb_width, fb_height); | 103 | drm_fb_helper_fill_var(fbi, helper, fb->width, fb->height); |
| 105 | 104 | ||
| 106 | entry = exynos_drm_fb_get_buf(fb); | 105 | buffer = exynos_drm_fb_get_buf(fb); |
| 107 | if (!entry) { | 106 | if (!buffer) { |
| 108 | DRM_LOG_KMS("entry is null.\n"); | 107 | DRM_LOG_KMS("buffer is null.\n"); |
| 109 | return -EFAULT; | 108 | return -EFAULT; |
| 110 | } | 109 | } |
| 111 | 110 | ||
| 112 | offset = fbi->var.xoffset * (fb->bits_per_pixel >> 3); | 111 | offset = fbi->var.xoffset * (fb->bits_per_pixel >> 3); |
| 113 | offset += fbi->var.yoffset * fb->pitch; | 112 | offset += fbi->var.yoffset * fb->pitch; |
| 114 | 113 | ||
| 115 | dev->mode_config.fb_base = entry->paddr; | 114 | dev->mode_config.fb_base = (resource_size_t)buffer->dma_addr; |
| 116 | fbi->screen_base = entry->vaddr + offset; | 115 | fbi->screen_base = buffer->kvaddr + offset; |
| 117 | fbi->fix.smem_start = entry->paddr + offset; | 116 | fbi->fix.smem_start = (unsigned long)(buffer->dma_addr + offset); |
| 118 | fbi->screen_size = size; | 117 | fbi->screen_size = size; |
| 119 | fbi->fix.smem_len = size; | 118 | fbi->fix.smem_len = size; |
| 120 | 119 | ||
| @@ -171,8 +170,7 @@ static int exynos_drm_fbdev_create(struct drm_fb_helper *helper, | |||
| 171 | goto out; | 170 | goto out; |
| 172 | } | 171 | } |
| 173 | 172 | ||
| 174 | ret = exynos_drm_fbdev_update(helper, helper->fb, sizes->fb_width, | 173 | ret = exynos_drm_fbdev_update(helper, helper->fb); |
| 175 | sizes->fb_height); | ||
| 176 | if (ret < 0) | 174 | if (ret < 0) |
| 177 | fb_dealloc_cmap(&fbi->cmap); | 175 | fb_dealloc_cmap(&fbi->cmap); |
| 178 | 176 | ||
| @@ -235,8 +233,7 @@ static int exynos_drm_fbdev_recreate(struct drm_fb_helper *helper, | |||
| 235 | } | 233 | } |
| 236 | 234 | ||
| 237 | helper->fb = exynos_fbdev->fb; | 235 | helper->fb = exynos_fbdev->fb; |
| 238 | return exynos_drm_fbdev_update(helper, helper->fb, sizes->fb_width, | 236 | return exynos_drm_fbdev_update(helper, helper->fb); |
| 239 | sizes->fb_height); | ||
| 240 | } | 237 | } |
| 241 | 238 | ||
| 242 | static int exynos_drm_fbdev_probe(struct drm_fb_helper *helper, | 239 | static int exynos_drm_fbdev_probe(struct drm_fb_helper *helper, |
| @@ -405,6 +402,18 @@ int exynos_drm_fbdev_reinit(struct drm_device *dev) | |||
| 405 | fb_helper = private->fb_helper; | 402 | fb_helper = private->fb_helper; |
| 406 | 403 | ||
| 407 | if (fb_helper) { | 404 | if (fb_helper) { |
| 405 | struct list_head temp_list; | ||
| 406 | |||
| 407 | INIT_LIST_HEAD(&temp_list); | ||
| 408 | |||
| 409 | /* | ||
| 410 | * fb_helper is reintialized but kernel fb is reused | ||
| 411 | * so kernel_fb_list need to be backuped and restored | ||
| 412 | */ | ||
| 413 | if (!list_empty(&fb_helper->kernel_fb_list)) | ||
| 414 | list_replace_init(&fb_helper->kernel_fb_list, | ||
| 415 | &temp_list); | ||
| 416 | |||
| 408 | drm_fb_helper_fini(fb_helper); | 417 | drm_fb_helper_fini(fb_helper); |
| 409 | 418 | ||
| 410 | ret = drm_fb_helper_init(dev, fb_helper, | 419 | ret = drm_fb_helper_init(dev, fb_helper, |
| @@ -414,6 +423,9 @@ int exynos_drm_fbdev_reinit(struct drm_device *dev) | |||
| 414 | return ret; | 423 | return ret; |
| 415 | } | 424 | } |
| 416 | 425 | ||
| 426 | if (!list_empty(&temp_list)) | ||
| 427 | list_replace(&temp_list, &fb_helper->kernel_fb_list); | ||
| 428 | |||
| 417 | ret = drm_fb_helper_single_add_all_connectors(fb_helper); | 429 | ret = drm_fb_helper_single_add_all_connectors(fb_helper); |
| 418 | if (ret < 0) { | 430 | if (ret < 0) { |
| 419 | DRM_ERROR("failed to add fb helper to connectors\n"); | 431 | DRM_ERROR("failed to add fb helper to connectors\n"); |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c index 4659c88cdd9b..db3b3d9e731d 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c | |||
| @@ -64,7 +64,7 @@ struct fimd_win_data { | |||
| 64 | unsigned int fb_width; | 64 | unsigned int fb_width; |
| 65 | unsigned int fb_height; | 65 | unsigned int fb_height; |
| 66 | unsigned int bpp; | 66 | unsigned int bpp; |
| 67 | dma_addr_t paddr; | 67 | dma_addr_t dma_addr; |
| 68 | void __iomem *vaddr; | 68 | void __iomem *vaddr; |
| 69 | unsigned int buf_offsize; | 69 | unsigned int buf_offsize; |
| 70 | unsigned int line_size; /* bytes */ | 70 | unsigned int line_size; /* bytes */ |
| @@ -124,7 +124,7 @@ static int fimd_display_power_on(struct device *dev, int mode) | |||
| 124 | return 0; | 124 | return 0; |
| 125 | } | 125 | } |
| 126 | 126 | ||
| 127 | static struct exynos_drm_display fimd_display = { | 127 | static struct exynos_drm_display_ops fimd_display_ops = { |
| 128 | .type = EXYNOS_DISPLAY_TYPE_LCD, | 128 | .type = EXYNOS_DISPLAY_TYPE_LCD, |
| 129 | .is_connected = fimd_display_is_connected, | 129 | .is_connected = fimd_display_is_connected, |
| 130 | .get_timing = fimd_get_timing, | 130 | .get_timing = fimd_get_timing, |
| @@ -177,6 +177,40 @@ static void fimd_commit(struct device *dev) | |||
| 177 | writel(val, ctx->regs + VIDCON0); | 177 | writel(val, ctx->regs + VIDCON0); |
| 178 | } | 178 | } |
| 179 | 179 | ||
| 180 | static void fimd_disable(struct device *dev) | ||
| 181 | { | ||
| 182 | struct fimd_context *ctx = get_fimd_context(dev); | ||
| 183 | struct exynos_drm_subdrv *subdrv = &ctx->subdrv; | ||
| 184 | struct drm_device *drm_dev = subdrv->drm_dev; | ||
| 185 | struct exynos_drm_manager *manager = &subdrv->manager; | ||
| 186 | u32 val; | ||
| 187 | |||
| 188 | DRM_DEBUG_KMS("%s\n", __FILE__); | ||
| 189 | |||
| 190 | /* fimd dma off */ | ||
| 191 | val = readl(ctx->regs + VIDCON0); | ||
| 192 | val &= ~(VIDCON0_ENVID | VIDCON0_ENVID_F); | ||
| 193 | writel(val, ctx->regs + VIDCON0); | ||
| 194 | |||
| 195 | /* | ||
| 196 | * if vblank is enabled status with dma off then | ||
| 197 | * it disables vsync interrupt. | ||
| 198 | */ | ||
| 199 | if (drm_dev->vblank_enabled[manager->pipe] && | ||
| 200 | atomic_read(&drm_dev->vblank_refcount[manager->pipe])) { | ||
| 201 | drm_vblank_put(drm_dev, manager->pipe); | ||
| 202 | |||
| 203 | /* | ||
| 204 | * if vblank_disable_allowed is 0 then disable | ||
| 205 | * vsync interrupt right now else the vsync interrupt | ||
| 206 | * would be disabled by drm timer once a current process | ||
| 207 | * gives up ownershop of vblank event. | ||
| 208 | */ | ||
| 209 | if (!drm_dev->vblank_disable_allowed) | ||
| 210 | drm_vblank_off(drm_dev, manager->pipe); | ||
| 211 | } | ||
| 212 | } | ||
| 213 | |||
| 180 | static int fimd_enable_vblank(struct device *dev) | 214 | static int fimd_enable_vblank(struct device *dev) |
| 181 | { | 215 | { |
| 182 | struct fimd_context *ctx = get_fimd_context(dev); | 216 | struct fimd_context *ctx = get_fimd_context(dev); |
| @@ -220,6 +254,7 @@ static void fimd_disable_vblank(struct device *dev) | |||
| 220 | 254 | ||
| 221 | static struct exynos_drm_manager_ops fimd_manager_ops = { | 255 | static struct exynos_drm_manager_ops fimd_manager_ops = { |
| 222 | .commit = fimd_commit, | 256 | .commit = fimd_commit, |
| 257 | .disable = fimd_disable, | ||
| 223 | .enable_vblank = fimd_enable_vblank, | 258 | .enable_vblank = fimd_enable_vblank, |
| 224 | .disable_vblank = fimd_disable_vblank, | 259 | .disable_vblank = fimd_disable_vblank, |
| 225 | }; | 260 | }; |
| @@ -251,7 +286,7 @@ static void fimd_win_mode_set(struct device *dev, | |||
| 251 | win_data->ovl_height = overlay->crtc_height; | 286 | win_data->ovl_height = overlay->crtc_height; |
| 252 | win_data->fb_width = overlay->fb_width; | 287 | win_data->fb_width = overlay->fb_width; |
| 253 | win_data->fb_height = overlay->fb_height; | 288 | win_data->fb_height = overlay->fb_height; |
| 254 | win_data->paddr = overlay->paddr + offset; | 289 | win_data->dma_addr = overlay->dma_addr + offset; |
| 255 | win_data->vaddr = overlay->vaddr + offset; | 290 | win_data->vaddr = overlay->vaddr + offset; |
| 256 | win_data->bpp = overlay->bpp; | 291 | win_data->bpp = overlay->bpp; |
| 257 | win_data->buf_offsize = (overlay->fb_width - overlay->crtc_width) * | 292 | win_data->buf_offsize = (overlay->fb_width - overlay->crtc_width) * |
| @@ -263,7 +298,7 @@ static void fimd_win_mode_set(struct device *dev, | |||
| 263 | DRM_DEBUG_KMS("ovl_width = %d, ovl_height = %d\n", | 298 | DRM_DEBUG_KMS("ovl_width = %d, ovl_height = %d\n", |
| 264 | win_data->ovl_width, win_data->ovl_height); | 299 | win_data->ovl_width, win_data->ovl_height); |
| 265 | DRM_DEBUG_KMS("paddr = 0x%lx, vaddr = 0x%lx\n", | 300 | DRM_DEBUG_KMS("paddr = 0x%lx, vaddr = 0x%lx\n", |
| 266 | (unsigned long)win_data->paddr, | 301 | (unsigned long)win_data->dma_addr, |
| 267 | (unsigned long)win_data->vaddr); | 302 | (unsigned long)win_data->vaddr); |
| 268 | DRM_DEBUG_KMS("fb_width = %d, crtc_width = %d\n", | 303 | DRM_DEBUG_KMS("fb_width = %d, crtc_width = %d\n", |
| 269 | overlay->fb_width, overlay->crtc_width); | 304 | overlay->fb_width, overlay->crtc_width); |
| @@ -376,16 +411,16 @@ static void fimd_win_commit(struct device *dev) | |||
| 376 | writel(val, ctx->regs + SHADOWCON); | 411 | writel(val, ctx->regs + SHADOWCON); |
| 377 | 412 | ||
| 378 | /* buffer start address */ | 413 | /* buffer start address */ |
| 379 | val = win_data->paddr; | 414 | val = (unsigned long)win_data->dma_addr; |
| 380 | writel(val, ctx->regs + VIDWx_BUF_START(win, 0)); | 415 | writel(val, ctx->regs + VIDWx_BUF_START(win, 0)); |
| 381 | 416 | ||
| 382 | /* buffer end address */ | 417 | /* buffer end address */ |
| 383 | size = win_data->fb_width * win_data->ovl_height * (win_data->bpp >> 3); | 418 | size = win_data->fb_width * win_data->ovl_height * (win_data->bpp >> 3); |
| 384 | val = win_data->paddr + size; | 419 | val = (unsigned long)(win_data->dma_addr + size); |
| 385 | writel(val, ctx->regs + VIDWx_BUF_END(win, 0)); | 420 | writel(val, ctx->regs + VIDWx_BUF_END(win, 0)); |
| 386 | 421 | ||
| 387 | DRM_DEBUG_KMS("start addr = 0x%lx, end addr = 0x%lx, size = 0x%lx\n", | 422 | DRM_DEBUG_KMS("start addr = 0x%lx, end addr = 0x%lx, size = 0x%lx\n", |
| 388 | (unsigned long)win_data->paddr, val, size); | 423 | (unsigned long)win_data->dma_addr, val, size); |
| 389 | DRM_DEBUG_KMS("ovl_width = %d, ovl_height = %d\n", | 424 | DRM_DEBUG_KMS("ovl_width = %d, ovl_height = %d\n", |
| 390 | win_data->ovl_width, win_data->ovl_height); | 425 | win_data->ovl_width, win_data->ovl_height); |
| 391 | 426 | ||
| @@ -447,7 +482,6 @@ static void fimd_win_commit(struct device *dev) | |||
| 447 | static void fimd_win_disable(struct device *dev) | 482 | static void fimd_win_disable(struct device *dev) |
| 448 | { | 483 | { |
| 449 | struct fimd_context *ctx = get_fimd_context(dev); | 484 | struct fimd_context *ctx = get_fimd_context(dev); |
| 450 | struct fimd_win_data *win_data; | ||
| 451 | int win = ctx->default_win; | 485 | int win = ctx->default_win; |
| 452 | u32 val; | 486 | u32 val; |
| 453 | 487 | ||
| @@ -456,8 +490,6 @@ static void fimd_win_disable(struct device *dev) | |||
| 456 | if (win < 0 || win > WINDOWS_NR) | 490 | if (win < 0 || win > WINDOWS_NR) |
| 457 | return; | 491 | return; |
| 458 | 492 | ||
| 459 | win_data = &ctx->win_data[win]; | ||
| 460 | |||
| 461 | /* protect windows */ | 493 | /* protect windows */ |
| 462 | val = readl(ctx->regs + SHADOWCON); | 494 | val = readl(ctx->regs + SHADOWCON); |
| 463 | val |= SHADOWCON_WINx_PROTECT(win); | 495 | val |= SHADOWCON_WINx_PROTECT(win); |
| @@ -528,6 +560,16 @@ static irqreturn_t fimd_irq_handler(int irq, void *dev_id) | |||
| 528 | /* VSYNC interrupt */ | 560 | /* VSYNC interrupt */ |
| 529 | writel(VIDINTCON1_INT_FRAME, ctx->regs + VIDINTCON1); | 561 | writel(VIDINTCON1_INT_FRAME, ctx->regs + VIDINTCON1); |
| 530 | 562 | ||
| 563 | /* | ||
| 564 | * in case that vblank_disable_allowed is 1, it could induce | ||
| 565 | * the problem that manager->pipe could be -1 because with | ||
| 566 | * disable callback, vsync interrupt isn't disabled and at this moment, | ||
| 567 | * vsync interrupt could occur. the vsync interrupt would be disabled | ||
| 568 | * by timer handler later. | ||
| 569 | */ | ||
| 570 | if (manager->pipe == -1) | ||
| 571 | return IRQ_HANDLED; | ||
| 572 | |||
| 531 | drm_handle_vblank(drm_dev, manager->pipe); | 573 | drm_handle_vblank(drm_dev, manager->pipe); |
| 532 | fimd_finish_pageflip(drm_dev, manager->pipe); | 574 | fimd_finish_pageflip(drm_dev, manager->pipe); |
| 533 | 575 | ||
| @@ -548,13 +590,6 @@ static int fimd_subdrv_probe(struct drm_device *drm_dev, struct device *dev) | |||
| 548 | */ | 590 | */ |
| 549 | drm_dev->irq_enabled = 1; | 591 | drm_dev->irq_enabled = 1; |
| 550 | 592 | ||
| 551 | /* | ||
| 552 | * with vblank_disable_allowed = 1, vblank interrupt will be disabled | ||
| 553 | * by drm timer once a current process gives up ownership of | ||
| 554 | * vblank event.(drm_vblank_put function was called) | ||
| 555 | */ | ||
| 556 | drm_dev->vblank_disable_allowed = 1; | ||
| 557 | |||
| 558 | return 0; | 593 | return 0; |
| 559 | } | 594 | } |
| 560 | 595 | ||
| @@ -731,7 +766,7 @@ static int __devinit fimd_probe(struct platform_device *pdev) | |||
| 731 | subdrv->manager.pipe = -1; | 766 | subdrv->manager.pipe = -1; |
| 732 | subdrv->manager.ops = &fimd_manager_ops; | 767 | subdrv->manager.ops = &fimd_manager_ops; |
| 733 | subdrv->manager.overlay_ops = &fimd_overlay_ops; | 768 | subdrv->manager.overlay_ops = &fimd_overlay_ops; |
| 734 | subdrv->manager.display = &fimd_display; | 769 | subdrv->manager.display_ops = &fimd_display_ops; |
| 735 | subdrv->manager.dev = dev; | 770 | subdrv->manager.dev = dev; |
| 736 | 771 | ||
| 737 | platform_set_drvdata(pdev, ctx); | 772 | platform_set_drvdata(pdev, ctx); |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_gem.c b/drivers/gpu/drm/exynos/exynos_drm_gem.c index a8e7a88906ed..aba0fe47f7ea 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_gem.c +++ b/drivers/gpu/drm/exynos/exynos_drm_gem.c | |||
| @@ -62,40 +62,28 @@ static unsigned int get_gem_mmap_offset(struct drm_gem_object *obj) | |||
| 62 | return (unsigned int)obj->map_list.hash.key << PAGE_SHIFT; | 62 | return (unsigned int)obj->map_list.hash.key << PAGE_SHIFT; |
| 63 | } | 63 | } |
| 64 | 64 | ||
| 65 | struct exynos_drm_gem_obj *exynos_drm_gem_create(struct drm_file *file_priv, | 65 | static struct exynos_drm_gem_obj |
| 66 | struct drm_device *dev, unsigned int size, | 66 | *exynos_drm_gem_init(struct drm_device *drm_dev, |
| 67 | unsigned int *handle) | 67 | struct drm_file *file_priv, unsigned int *handle, |
| 68 | unsigned int size) | ||
| 68 | { | 69 | { |
| 69 | struct exynos_drm_gem_obj *exynos_gem_obj; | 70 | struct exynos_drm_gem_obj *exynos_gem_obj; |
| 70 | struct exynos_drm_buf_entry *entry; | ||
| 71 | struct drm_gem_object *obj; | 71 | struct drm_gem_object *obj; |
| 72 | int ret; | 72 | int ret; |
| 73 | 73 | ||
| 74 | DRM_DEBUG_KMS("%s\n", __FILE__); | ||
| 75 | |||
| 76 | size = roundup(size, PAGE_SIZE); | ||
| 77 | |||
| 78 | exynos_gem_obj = kzalloc(sizeof(*exynos_gem_obj), GFP_KERNEL); | 74 | exynos_gem_obj = kzalloc(sizeof(*exynos_gem_obj), GFP_KERNEL); |
| 79 | if (!exynos_gem_obj) { | 75 | if (!exynos_gem_obj) { |
| 80 | DRM_ERROR("failed to allocate exynos gem object.\n"); | 76 | DRM_ERROR("failed to allocate exynos gem object.\n"); |
| 81 | return ERR_PTR(-ENOMEM); | 77 | return ERR_PTR(-ENOMEM); |
| 82 | } | 78 | } |
| 83 | 79 | ||
| 84 | /* allocate the new buffer object and memory region. */ | ||
| 85 | entry = exynos_drm_buf_create(dev, size); | ||
| 86 | if (!entry) { | ||
| 87 | kfree(exynos_gem_obj); | ||
| 88 | return ERR_PTR(-ENOMEM); | ||
| 89 | } | ||
| 90 | |||
| 91 | exynos_gem_obj->entry = entry; | ||
| 92 | |||
| 93 | obj = &exynos_gem_obj->base; | 80 | obj = &exynos_gem_obj->base; |
| 94 | 81 | ||
| 95 | ret = drm_gem_object_init(dev, obj, size); | 82 | ret = drm_gem_object_init(drm_dev, obj, size); |
| 96 | if (ret < 0) { | 83 | if (ret < 0) { |
| 97 | DRM_ERROR("failed to initailize gem object.\n"); | 84 | DRM_ERROR("failed to initialize gem object.\n"); |
| 98 | goto err_obj_init; | 85 | ret = -EINVAL; |
| 86 | goto err_object_init; | ||
| 99 | } | 87 | } |
| 100 | 88 | ||
| 101 | DRM_DEBUG_KMS("created file object = 0x%x\n", (unsigned int)obj->filp); | 89 | DRM_DEBUG_KMS("created file object = 0x%x\n", (unsigned int)obj->filp); |
| @@ -127,24 +115,50 @@ err_handle_create: | |||
| 127 | err_create_mmap_offset: | 115 | err_create_mmap_offset: |
| 128 | drm_gem_object_release(obj); | 116 | drm_gem_object_release(obj); |
| 129 | 117 | ||
| 130 | err_obj_init: | 118 | err_object_init: |
| 131 | exynos_drm_buf_destroy(dev, exynos_gem_obj->entry); | ||
| 132 | |||
| 133 | kfree(exynos_gem_obj); | 119 | kfree(exynos_gem_obj); |
| 134 | 120 | ||
| 135 | return ERR_PTR(ret); | 121 | return ERR_PTR(ret); |
| 136 | } | 122 | } |
| 137 | 123 | ||
| 124 | struct exynos_drm_gem_obj *exynos_drm_gem_create(struct drm_device *dev, | ||
| 125 | struct drm_file *file_priv, | ||
| 126 | unsigned int *handle, unsigned long size) | ||
| 127 | { | ||
| 128 | |||
| 129 | struct exynos_drm_gem_obj *exynos_gem_obj = NULL; | ||
| 130 | struct exynos_drm_gem_buf *buffer; | ||
| 131 | |||
| 132 | size = roundup(size, PAGE_SIZE); | ||
| 133 | |||
| 134 | DRM_DEBUG_KMS("%s: size = 0x%lx\n", __FILE__, size); | ||
| 135 | |||
| 136 | buffer = exynos_drm_buf_create(dev, size); | ||
| 137 | if (IS_ERR(buffer)) { | ||
| 138 | return ERR_CAST(buffer); | ||
| 139 | } | ||
| 140 | |||
| 141 | exynos_gem_obj = exynos_drm_gem_init(dev, file_priv, handle, size); | ||
| 142 | if (IS_ERR(exynos_gem_obj)) { | ||
| 143 | exynos_drm_buf_destroy(dev, buffer); | ||
| 144 | return exynos_gem_obj; | ||
| 145 | } | ||
| 146 | |||
| 147 | exynos_gem_obj->buffer = buffer; | ||
| 148 | |||
| 149 | return exynos_gem_obj; | ||
| 150 | } | ||
| 151 | |||
| 138 | int exynos_drm_gem_create_ioctl(struct drm_device *dev, void *data, | 152 | int exynos_drm_gem_create_ioctl(struct drm_device *dev, void *data, |
| 139 | struct drm_file *file_priv) | 153 | struct drm_file *file_priv) |
| 140 | { | 154 | { |
| 141 | struct drm_exynos_gem_create *args = data; | 155 | struct drm_exynos_gem_create *args = data; |
| 142 | struct exynos_drm_gem_obj *exynos_gem_obj; | 156 | struct exynos_drm_gem_obj *exynos_gem_obj = NULL; |
| 143 | 157 | ||
| 144 | DRM_DEBUG_KMS("%s : size = 0x%x\n", __FILE__, args->size); | 158 | DRM_DEBUG_KMS("%s\n", __FILE__); |
| 145 | 159 | ||
| 146 | exynos_gem_obj = exynos_drm_gem_create(file_priv, dev, args->size, | 160 | exynos_gem_obj = exynos_drm_gem_create(dev, file_priv, |
| 147 | &args->handle); | 161 | &args->handle, args->size); |
| 148 | if (IS_ERR(exynos_gem_obj)) | 162 | if (IS_ERR(exynos_gem_obj)) |
| 149 | return PTR_ERR(exynos_gem_obj); | 163 | return PTR_ERR(exynos_gem_obj); |
| 150 | 164 | ||
| @@ -175,7 +189,7 @@ static int exynos_drm_gem_mmap_buffer(struct file *filp, | |||
| 175 | { | 189 | { |
| 176 | struct drm_gem_object *obj = filp->private_data; | 190 | struct drm_gem_object *obj = filp->private_data; |
| 177 | struct exynos_drm_gem_obj *exynos_gem_obj = to_exynos_gem_obj(obj); | 191 | struct exynos_drm_gem_obj *exynos_gem_obj = to_exynos_gem_obj(obj); |
| 178 | struct exynos_drm_buf_entry *entry; | 192 | struct exynos_drm_gem_buf *buffer; |
| 179 | unsigned long pfn, vm_size; | 193 | unsigned long pfn, vm_size; |
| 180 | 194 | ||
| 181 | DRM_DEBUG_KMS("%s\n", __FILE__); | 195 | DRM_DEBUG_KMS("%s\n", __FILE__); |
| @@ -187,20 +201,20 @@ static int exynos_drm_gem_mmap_buffer(struct file *filp, | |||
| 187 | 201 | ||
| 188 | vm_size = vma->vm_end - vma->vm_start; | 202 | vm_size = vma->vm_end - vma->vm_start; |
| 189 | /* | 203 | /* |
| 190 | * a entry contains information to physically continuous memory | 204 | * a buffer contains information to physically continuous memory |
| 191 | * allocated by user request or at framebuffer creation. | 205 | * allocated by user request or at framebuffer creation. |
| 192 | */ | 206 | */ |
| 193 | entry = exynos_gem_obj->entry; | 207 | buffer = exynos_gem_obj->buffer; |
| 194 | 208 | ||
| 195 | /* check if user-requested size is valid. */ | 209 | /* check if user-requested size is valid. */ |
| 196 | if (vm_size > entry->size) | 210 | if (vm_size > buffer->size) |
| 197 | return -EINVAL; | 211 | return -EINVAL; |
| 198 | 212 | ||
| 199 | /* | 213 | /* |
| 200 | * get page frame number to physical memory to be mapped | 214 | * get page frame number to physical memory to be mapped |
| 201 | * to user space. | 215 | * to user space. |
| 202 | */ | 216 | */ |
| 203 | pfn = exynos_gem_obj->entry->paddr >> PAGE_SHIFT; | 217 | pfn = ((unsigned long)exynos_gem_obj->buffer->dma_addr) >> PAGE_SHIFT; |
| 204 | 218 | ||
| 205 | DRM_DEBUG_KMS("pfn = 0x%lx\n", pfn); | 219 | DRM_DEBUG_KMS("pfn = 0x%lx\n", pfn); |
| 206 | 220 | ||
| @@ -281,7 +295,7 @@ void exynos_drm_gem_free_object(struct drm_gem_object *gem_obj) | |||
| 281 | 295 | ||
| 282 | exynos_gem_obj = to_exynos_gem_obj(gem_obj); | 296 | exynos_gem_obj = to_exynos_gem_obj(gem_obj); |
| 283 | 297 | ||
| 284 | exynos_drm_buf_destroy(gem_obj->dev, exynos_gem_obj->entry); | 298 | exynos_drm_buf_destroy(gem_obj->dev, exynos_gem_obj->buffer); |
| 285 | 299 | ||
| 286 | kfree(exynos_gem_obj); | 300 | kfree(exynos_gem_obj); |
| 287 | } | 301 | } |
| @@ -302,8 +316,8 @@ int exynos_drm_gem_dumb_create(struct drm_file *file_priv, | |||
| 302 | args->pitch = args->width * args->bpp >> 3; | 316 | args->pitch = args->width * args->bpp >> 3; |
| 303 | args->size = args->pitch * args->height; | 317 | args->size = args->pitch * args->height; |
| 304 | 318 | ||
| 305 | exynos_gem_obj = exynos_drm_gem_create(file_priv, dev, args->size, | 319 | exynos_gem_obj = exynos_drm_gem_create(dev, file_priv, &args->handle, |
| 306 | &args->handle); | 320 | args->size); |
| 307 | if (IS_ERR(exynos_gem_obj)) | 321 | if (IS_ERR(exynos_gem_obj)) |
| 308 | return PTR_ERR(exynos_gem_obj); | 322 | return PTR_ERR(exynos_gem_obj); |
| 309 | 323 | ||
| @@ -360,7 +374,8 @@ int exynos_drm_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf) | |||
| 360 | 374 | ||
| 361 | mutex_lock(&dev->struct_mutex); | 375 | mutex_lock(&dev->struct_mutex); |
| 362 | 376 | ||
| 363 | pfn = (exynos_gem_obj->entry->paddr >> PAGE_SHIFT) + page_offset; | 377 | pfn = (((unsigned long)exynos_gem_obj->buffer->dma_addr) >> |
| 378 | PAGE_SHIFT) + page_offset; | ||
| 364 | 379 | ||
| 365 | ret = vm_insert_mixed(vma, (unsigned long)vmf->virtual_address, pfn); | 380 | ret = vm_insert_mixed(vma, (unsigned long)vmf->virtual_address, pfn); |
| 366 | 381 | ||
diff --git a/drivers/gpu/drm/exynos/exynos_drm_gem.h b/drivers/gpu/drm/exynos/exynos_drm_gem.h index e5fc0148277b..ef8797334e6d 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_gem.h +++ b/drivers/gpu/drm/exynos/exynos_drm_gem.h | |||
| @@ -30,13 +30,29 @@ | |||
| 30 | struct exynos_drm_gem_obj, base) | 30 | struct exynos_drm_gem_obj, base) |
| 31 | 31 | ||
| 32 | /* | 32 | /* |
| 33 | * exynos drm gem buffer structure. | ||
| 34 | * | ||
| 35 | * @kvaddr: kernel virtual address to allocated memory region. | ||
| 36 | * @dma_addr: bus address(accessed by dma) to allocated memory region. | ||
| 37 | * - this address could be physical address without IOMMU and | ||
| 38 | * device address with IOMMU. | ||
| 39 | * @size: size of allocated memory region. | ||
| 40 | */ | ||
| 41 | struct exynos_drm_gem_buf { | ||
| 42 | void __iomem *kvaddr; | ||
| 43 | dma_addr_t dma_addr; | ||
| 44 | unsigned long size; | ||
| 45 | }; | ||
| 46 | |||
| 47 | /* | ||
| 33 | * exynos drm buffer structure. | 48 | * exynos drm buffer structure. |
| 34 | * | 49 | * |
| 35 | * @base: a gem object. | 50 | * @base: a gem object. |
| 36 | * - a new handle to this gem object would be created | 51 | * - a new handle to this gem object would be created |
| 37 | * by drm_gem_handle_create(). | 52 | * by drm_gem_handle_create(). |
| 38 | * @entry: pointer to exynos drm buffer entry object. | 53 | * @buffer: a pointer to exynos_drm_gem_buffer object. |
| 39 | * - containing the information to physically | 54 | * - contain the information to memory region allocated |
| 55 | * by user request or at framebuffer creation. | ||
| 40 | * continuous memory region allocated by user request | 56 | * continuous memory region allocated by user request |
| 41 | * or at framebuffer creation. | 57 | * or at framebuffer creation. |
| 42 | * | 58 | * |
| @@ -45,13 +61,13 @@ | |||
| 45 | */ | 61 | */ |
| 46 | struct exynos_drm_gem_obj { | 62 | struct exynos_drm_gem_obj { |
| 47 | struct drm_gem_object base; | 63 | struct drm_gem_object base; |
| 48 | struct exynos_drm_buf_entry *entry; | 64 | struct exynos_drm_gem_buf *buffer; |
| 49 | }; | 65 | }; |
| 50 | 66 | ||
| 51 | /* create a new buffer and get a new gem handle. */ | 67 | /* create a new buffer and get a new gem handle. */ |
| 52 | struct exynos_drm_gem_obj *exynos_drm_gem_create(struct drm_file *file_priv, | 68 | struct exynos_drm_gem_obj *exynos_drm_gem_create(struct drm_device *dev, |
| 53 | struct drm_device *dev, unsigned int size, | 69 | struct drm_file *file_priv, |
| 54 | unsigned int *handle); | 70 | unsigned int *handle, unsigned long size); |
| 55 | 71 | ||
| 56 | /* | 72 | /* |
| 57 | * request gem object creation and buffer allocation as the size | 73 | * request gem object creation and buffer allocation as the size |
diff --git a/drivers/gpu/drm/nouveau/nouveau_display.c b/drivers/gpu/drm/nouveau/nouveau_display.c index ddbabefb4273..b12fd2c80812 100644 --- a/drivers/gpu/drm/nouveau/nouveau_display.c +++ b/drivers/gpu/drm/nouveau/nouveau_display.c | |||
| @@ -369,3 +369,48 @@ nouveau_finish_page_flip(struct nouveau_channel *chan, | |||
| 369 | spin_unlock_irqrestore(&dev->event_lock, flags); | 369 | spin_unlock_irqrestore(&dev->event_lock, flags); |
| 370 | return 0; | 370 | return 0; |
| 371 | } | 371 | } |
| 372 | |||
| 373 | int | ||
| 374 | nouveau_display_dumb_create(struct drm_file *file_priv, struct drm_device *dev, | ||
| 375 | struct drm_mode_create_dumb *args) | ||
| 376 | { | ||
| 377 | struct nouveau_bo *bo; | ||
| 378 | int ret; | ||
| 379 | |||
| 380 | args->pitch = roundup(args->width * (args->bpp / 8), 256); | ||
| 381 | args->size = args->pitch * args->height; | ||
| 382 | args->size = roundup(args->size, PAGE_SIZE); | ||
| 383 | |||
| 384 | ret = nouveau_gem_new(dev, args->size, 0, TTM_PL_FLAG_VRAM, 0, 0, &bo); | ||
| 385 | if (ret) | ||
| 386 | return ret; | ||
| 387 | |||
| 388 | ret = drm_gem_handle_create(file_priv, bo->gem, &args->handle); | ||
| 389 | drm_gem_object_unreference_unlocked(bo->gem); | ||
| 390 | return ret; | ||
| 391 | } | ||
| 392 | |||
| 393 | int | ||
| 394 | nouveau_display_dumb_destroy(struct drm_file *file_priv, struct drm_device *dev, | ||
| 395 | uint32_t handle) | ||
| 396 | { | ||
| 397 | return drm_gem_handle_delete(file_priv, handle); | ||
| 398 | } | ||
| 399 | |||
| 400 | int | ||
| 401 | nouveau_display_dumb_map_offset(struct drm_file *file_priv, | ||
| 402 | struct drm_device *dev, | ||
| 403 | uint32_t handle, uint64_t *poffset) | ||
| 404 | { | ||
| 405 | struct drm_gem_object *gem; | ||
| 406 | |||
| 407 | gem = drm_gem_object_lookup(dev, file_priv, handle); | ||
| 408 | if (gem) { | ||
| 409 | struct nouveau_bo *bo = gem->driver_private; | ||
| 410 | *poffset = bo->bo.addr_space_offset; | ||
| 411 | drm_gem_object_unreference_unlocked(gem); | ||
| 412 | return 0; | ||
| 413 | } | ||
| 414 | |||
| 415 | return -ENOENT; | ||
| 416 | } | ||
diff --git a/drivers/gpu/drm/nouveau/nouveau_drv.c b/drivers/gpu/drm/nouveau/nouveau_drv.c index 9f7bb1295262..9791d13c9e3b 100644 --- a/drivers/gpu/drm/nouveau/nouveau_drv.c +++ b/drivers/gpu/drm/nouveau/nouveau_drv.c | |||
| @@ -433,6 +433,10 @@ static struct drm_driver driver = { | |||
| 433 | .gem_open_object = nouveau_gem_object_open, | 433 | .gem_open_object = nouveau_gem_object_open, |
| 434 | .gem_close_object = nouveau_gem_object_close, | 434 | .gem_close_object = nouveau_gem_object_close, |
| 435 | 435 | ||
| 436 | .dumb_create = nouveau_display_dumb_create, | ||
| 437 | .dumb_map_offset = nouveau_display_dumb_map_offset, | ||
| 438 | .dumb_destroy = nouveau_display_dumb_destroy, | ||
| 439 | |||
| 436 | .name = DRIVER_NAME, | 440 | .name = DRIVER_NAME, |
| 437 | .desc = DRIVER_DESC, | 441 | .desc = DRIVER_DESC, |
| 438 | #ifdef GIT_REVISION | 442 | #ifdef GIT_REVISION |
diff --git a/drivers/gpu/drm/nouveau/nouveau_drv.h b/drivers/gpu/drm/nouveau/nouveau_drv.h index 29837da1098b..4c0be3a4ed88 100644 --- a/drivers/gpu/drm/nouveau/nouveau_drv.h +++ b/drivers/gpu/drm/nouveau/nouveau_drv.h | |||
| @@ -1418,6 +1418,12 @@ int nouveau_crtc_page_flip(struct drm_crtc *crtc, struct drm_framebuffer *fb, | |||
| 1418 | struct drm_pending_vblank_event *event); | 1418 | struct drm_pending_vblank_event *event); |
| 1419 | int nouveau_finish_page_flip(struct nouveau_channel *, | 1419 | int nouveau_finish_page_flip(struct nouveau_channel *, |
| 1420 | struct nouveau_page_flip_state *); | 1420 | struct nouveau_page_flip_state *); |
| 1421 | int nouveau_display_dumb_create(struct drm_file *, struct drm_device *, | ||
| 1422 | struct drm_mode_create_dumb *args); | ||
| 1423 | int nouveau_display_dumb_map_offset(struct drm_file *, struct drm_device *, | ||
| 1424 | uint32_t handle, uint64_t *offset); | ||
| 1425 | int nouveau_display_dumb_destroy(struct drm_file *, struct drm_device *, | ||
| 1426 | uint32_t handle); | ||
| 1421 | 1427 | ||
| 1422 | /* nv10_gpio.c */ | 1428 | /* nv10_gpio.c */ |
| 1423 | int nv10_gpio_get(struct drm_device *dev, enum dcb_gpio_tag tag); | 1429 | int nv10_gpio_get(struct drm_device *dev, enum dcb_gpio_tag tag); |
diff --git a/drivers/gpu/drm/nouveau/nouveau_object.c b/drivers/gpu/drm/nouveau/nouveau_object.c index 02222c540aee..960c0ae0c0c3 100644 --- a/drivers/gpu/drm/nouveau/nouveau_object.c +++ b/drivers/gpu/drm/nouveau/nouveau_object.c | |||
| @@ -680,7 +680,7 @@ nouveau_gpuobj_channel_init_pramin(struct nouveau_channel *chan) | |||
| 680 | return ret; | 680 | return ret; |
| 681 | } | 681 | } |
| 682 | 682 | ||
| 683 | ret = drm_mm_init(&chan->ramin_heap, base, size); | 683 | ret = drm_mm_init(&chan->ramin_heap, base, size - base); |
| 684 | if (ret) { | 684 | if (ret) { |
| 685 | NV_ERROR(dev, "Error creating PRAMIN heap: %d\n", ret); | 685 | NV_ERROR(dev, "Error creating PRAMIN heap: %d\n", ret); |
| 686 | nouveau_gpuobj_ref(NULL, &chan->ramin); | 686 | nouveau_gpuobj_ref(NULL, &chan->ramin); |
diff --git a/drivers/gpu/drm/nouveau/nouveau_sgdma.c b/drivers/gpu/drm/nouveau/nouveau_sgdma.c index b75258a9fe44..c8a463b76c89 100644 --- a/drivers/gpu/drm/nouveau/nouveau_sgdma.c +++ b/drivers/gpu/drm/nouveau/nouveau_sgdma.c | |||
| @@ -67,7 +67,10 @@ nouveau_sgdma_clear(struct ttm_backend *be) | |||
| 67 | pci_unmap_page(dev->pdev, nvbe->pages[nvbe->nr_pages], | 67 | pci_unmap_page(dev->pdev, nvbe->pages[nvbe->nr_pages], |
| 68 | PAGE_SIZE, PCI_DMA_BIDIRECTIONAL); | 68 | PAGE_SIZE, PCI_DMA_BIDIRECTIONAL); |
| 69 | } | 69 | } |
| 70 | nvbe->unmap_pages = false; | ||
| 70 | } | 71 | } |
| 72 | |||
| 73 | nvbe->pages = NULL; | ||
| 71 | } | 74 | } |
| 72 | 75 | ||
| 73 | static void | 76 | static void |
diff --git a/drivers/gpu/drm/nouveau/nv50_display.c b/drivers/gpu/drm/nouveau/nv50_display.c index d23ca00e7d62..06de250fe617 100644 --- a/drivers/gpu/drm/nouveau/nv50_display.c +++ b/drivers/gpu/drm/nouveau/nv50_display.c | |||
| @@ -616,7 +616,7 @@ nv50_display_unk10_handler(struct drm_device *dev) | |||
| 616 | struct drm_nouveau_private *dev_priv = dev->dev_private; | 616 | struct drm_nouveau_private *dev_priv = dev->dev_private; |
| 617 | struct nv50_display *disp = nv50_display(dev); | 617 | struct nv50_display *disp = nv50_display(dev); |
| 618 | u32 unk30 = nv_rd32(dev, 0x610030), mc; | 618 | u32 unk30 = nv_rd32(dev, 0x610030), mc; |
| 619 | int i, crtc, or, type = OUTPUT_ANY; | 619 | int i, crtc, or = 0, type = OUTPUT_ANY; |
| 620 | 620 | ||
| 621 | NV_DEBUG_KMS(dev, "0x610030: 0x%08x\n", unk30); | 621 | NV_DEBUG_KMS(dev, "0x610030: 0x%08x\n", unk30); |
| 622 | disp->irq.dcb = NULL; | 622 | disp->irq.dcb = NULL; |
| @@ -708,7 +708,7 @@ nv50_display_unk20_handler(struct drm_device *dev) | |||
| 708 | struct nv50_display *disp = nv50_display(dev); | 708 | struct nv50_display *disp = nv50_display(dev); |
| 709 | u32 unk30 = nv_rd32(dev, 0x610030), tmp, pclk, script, mc = 0; | 709 | u32 unk30 = nv_rd32(dev, 0x610030), tmp, pclk, script, mc = 0; |
| 710 | struct dcb_entry *dcb; | 710 | struct dcb_entry *dcb; |
| 711 | int i, crtc, or, type = OUTPUT_ANY; | 711 | int i, crtc, or = 0, type = OUTPUT_ANY; |
| 712 | 712 | ||
| 713 | NV_DEBUG_KMS(dev, "0x610030: 0x%08x\n", unk30); | 713 | NV_DEBUG_KMS(dev, "0x610030: 0x%08x\n", unk30); |
| 714 | dcb = disp->irq.dcb; | 714 | dcb = disp->irq.dcb; |
diff --git a/drivers/gpu/drm/nouveau/nvc0_graph.c b/drivers/gpu/drm/nouveau/nvc0_graph.c index a74e501afd25..ecfafd70cf0e 100644 --- a/drivers/gpu/drm/nouveau/nvc0_graph.c +++ b/drivers/gpu/drm/nouveau/nvc0_graph.c | |||
| @@ -381,6 +381,8 @@ nvc0_graph_init_gpc_0(struct drm_device *dev) | |||
| 381 | u8 tpnr[GPC_MAX]; | 381 | u8 tpnr[GPC_MAX]; |
| 382 | int i, gpc, tpc; | 382 | int i, gpc, tpc; |
| 383 | 383 | ||
| 384 | nv_wr32(dev, TP_UNIT(0, 0, 0x5c), 1); /* affects TFB offset queries */ | ||
| 385 | |||
| 384 | /* | 386 | /* |
| 385 | * TP ROP UNKVAL(magic_not_rop_nr) | 387 | * TP ROP UNKVAL(magic_not_rop_nr) |
| 386 | * 450: 4/0/0/0 2 3 | 388 | * 450: 4/0/0/0 2 3 |
diff --git a/drivers/gpu/drm/nouveau/nvd0_display.c b/drivers/gpu/drm/nouveau/nvd0_display.c index 23d63b4b3d77..cb006a718e70 100644 --- a/drivers/gpu/drm/nouveau/nvd0_display.c +++ b/drivers/gpu/drm/nouveau/nvd0_display.c | |||
| @@ -780,7 +780,7 @@ nvd0_sor_dpms(struct drm_encoder *encoder, int mode) | |||
| 780 | continue; | 780 | continue; |
| 781 | 781 | ||
| 782 | if (nv_partner != nv_encoder && | 782 | if (nv_partner != nv_encoder && |
| 783 | nv_partner->dcb->or == nv_encoder->or) { | 783 | nv_partner->dcb->or == nv_encoder->dcb->or) { |
| 784 | if (nv_partner->last_dpms == DRM_MODE_DPMS_ON) | 784 | if (nv_partner->last_dpms == DRM_MODE_DPMS_ON) |
| 785 | return; | 785 | return; |
| 786 | break; | 786 | break; |
diff --git a/drivers/gpu/drm/radeon/atombios_crtc.c b/drivers/gpu/drm/radeon/atombios_crtc.c index 87631fede1f8..2b97262e3ab1 100644 --- a/drivers/gpu/drm/radeon/atombios_crtc.c +++ b/drivers/gpu/drm/radeon/atombios_crtc.c | |||
| @@ -1107,9 +1107,40 @@ static int dce4_crtc_do_set_base(struct drm_crtc *crtc, | |||
| 1107 | return -EINVAL; | 1107 | return -EINVAL; |
| 1108 | } | 1108 | } |
| 1109 | 1109 | ||
| 1110 | if (tiling_flags & RADEON_TILING_MACRO) | 1110 | if (tiling_flags & RADEON_TILING_MACRO) { |
| 1111 | if (rdev->family >= CHIP_CAYMAN) | ||
| 1112 | tmp = rdev->config.cayman.tile_config; | ||
| 1113 | else | ||
| 1114 | tmp = rdev->config.evergreen.tile_config; | ||
| 1115 | |||
| 1116 | switch ((tmp & 0xf0) >> 4) { | ||
| 1117 | case 0: /* 4 banks */ | ||
| 1118 | fb_format |= EVERGREEN_GRPH_NUM_BANKS(EVERGREEN_ADDR_SURF_4_BANK); | ||
| 1119 | break; | ||
| 1120 | case 1: /* 8 banks */ | ||
| 1121 | default: | ||
| 1122 | fb_format |= EVERGREEN_GRPH_NUM_BANKS(EVERGREEN_ADDR_SURF_8_BANK); | ||
| 1123 | break; | ||
| 1124 | case 2: /* 16 banks */ | ||
| 1125 | fb_format |= EVERGREEN_GRPH_NUM_BANKS(EVERGREEN_ADDR_SURF_16_BANK); | ||
| 1126 | break; | ||
| 1127 | } | ||
| 1128 | |||
| 1129 | switch ((tmp & 0xf000) >> 12) { | ||
| 1130 | case 0: /* 1KB rows */ | ||
| 1131 | default: | ||
| 1132 | fb_format |= EVERGREEN_GRPH_TILE_SPLIT(EVERGREEN_ADDR_SURF_TILE_SPLIT_1KB); | ||
| 1133 | break; | ||
| 1134 | case 1: /* 2KB rows */ | ||
| 1135 | fb_format |= EVERGREEN_GRPH_TILE_SPLIT(EVERGREEN_ADDR_SURF_TILE_SPLIT_2KB); | ||
| 1136 | break; | ||
| 1137 | case 2: /* 4KB rows */ | ||
| 1138 | fb_format |= EVERGREEN_GRPH_TILE_SPLIT(EVERGREEN_ADDR_SURF_TILE_SPLIT_4KB); | ||
| 1139 | break; | ||
| 1140 | } | ||
| 1141 | |||
| 1111 | fb_format |= EVERGREEN_GRPH_ARRAY_MODE(EVERGREEN_GRPH_ARRAY_2D_TILED_THIN1); | 1142 | fb_format |= EVERGREEN_GRPH_ARRAY_MODE(EVERGREEN_GRPH_ARRAY_2D_TILED_THIN1); |
| 1112 | else if (tiling_flags & RADEON_TILING_MICRO) | 1143 | } else if (tiling_flags & RADEON_TILING_MICRO) |
| 1113 | fb_format |= EVERGREEN_GRPH_ARRAY_MODE(EVERGREEN_GRPH_ARRAY_1D_TILED_THIN1); | 1144 | fb_format |= EVERGREEN_GRPH_ARRAY_MODE(EVERGREEN_GRPH_ARRAY_1D_TILED_THIN1); |
| 1114 | 1145 | ||
| 1115 | switch (radeon_crtc->crtc_id) { | 1146 | switch (radeon_crtc->crtc_id) { |
diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c index 1d603a3335db..5e00d1670aa9 100644 --- a/drivers/gpu/drm/radeon/evergreen.c +++ b/drivers/gpu/drm/radeon/evergreen.c | |||
| @@ -82,6 +82,7 @@ u32 evergreen_page_flip(struct radeon_device *rdev, int crtc_id, u64 crtc_base) | |||
| 82 | { | 82 | { |
| 83 | struct radeon_crtc *radeon_crtc = rdev->mode_info.crtcs[crtc_id]; | 83 | struct radeon_crtc *radeon_crtc = rdev->mode_info.crtcs[crtc_id]; |
| 84 | u32 tmp = RREG32(EVERGREEN_GRPH_UPDATE + radeon_crtc->crtc_offset); | 84 | u32 tmp = RREG32(EVERGREEN_GRPH_UPDATE + radeon_crtc->crtc_offset); |
| 85 | int i; | ||
| 85 | 86 | ||
| 86 | /* Lock the graphics update lock */ | 87 | /* Lock the graphics update lock */ |
| 87 | tmp |= EVERGREEN_GRPH_UPDATE_LOCK; | 88 | tmp |= EVERGREEN_GRPH_UPDATE_LOCK; |
| @@ -99,7 +100,11 @@ u32 evergreen_page_flip(struct radeon_device *rdev, int crtc_id, u64 crtc_base) | |||
| 99 | (u32)crtc_base); | 100 | (u32)crtc_base); |
| 100 | 101 | ||
| 101 | /* Wait for update_pending to go high. */ | 102 | /* Wait for update_pending to go high. */ |
| 102 | while (!(RREG32(EVERGREEN_GRPH_UPDATE + radeon_crtc->crtc_offset) & EVERGREEN_GRPH_SURFACE_UPDATE_PENDING)); | 103 | for (i = 0; i < rdev->usec_timeout; i++) { |
| 104 | if (RREG32(EVERGREEN_GRPH_UPDATE + radeon_crtc->crtc_offset) & EVERGREEN_GRPH_SURFACE_UPDATE_PENDING) | ||
| 105 | break; | ||
| 106 | udelay(1); | ||
| 107 | } | ||
| 103 | DRM_DEBUG("Update pending now high. Unlocking vupdate_lock.\n"); | 108 | DRM_DEBUG("Update pending now high. Unlocking vupdate_lock.\n"); |
| 104 | 109 | ||
| 105 | /* Unlock the lock, so double-buffering can take place inside vblank */ | 110 | /* Unlock the lock, so double-buffering can take place inside vblank */ |
diff --git a/drivers/gpu/drm/radeon/evergreen_cs.c b/drivers/gpu/drm/radeon/evergreen_cs.c index 38e1bda73d33..cd4590aae154 100644 --- a/drivers/gpu/drm/radeon/evergreen_cs.c +++ b/drivers/gpu/drm/radeon/evergreen_cs.c | |||
| @@ -38,6 +38,7 @@ struct evergreen_cs_track { | |||
| 38 | u32 group_size; | 38 | u32 group_size; |
| 39 | u32 nbanks; | 39 | u32 nbanks; |
| 40 | u32 npipes; | 40 | u32 npipes; |
| 41 | u32 row_size; | ||
| 41 | /* value we track */ | 42 | /* value we track */ |
| 42 | u32 nsamples; | 43 | u32 nsamples; |
| 43 | u32 cb_color_base_last[12]; | 44 | u32 cb_color_base_last[12]; |
| @@ -77,6 +78,44 @@ struct evergreen_cs_track { | |||
| 77 | struct radeon_bo *db_s_write_bo; | 78 | struct radeon_bo *db_s_write_bo; |
| 78 | }; | 79 | }; |
| 79 | 80 | ||
| 81 | static u32 evergreen_cs_get_aray_mode(u32 tiling_flags) | ||
| 82 | { | ||
| 83 | if (tiling_flags & RADEON_TILING_MACRO) | ||
| 84 | return ARRAY_2D_TILED_THIN1; | ||
| 85 | else if (tiling_flags & RADEON_TILING_MICRO) | ||
| 86 | return ARRAY_1D_TILED_THIN1; | ||
| 87 | else | ||
| 88 | return ARRAY_LINEAR_GENERAL; | ||
| 89 | } | ||
| 90 | |||
| 91 | static u32 evergreen_cs_get_num_banks(u32 nbanks) | ||
| 92 | { | ||
| 93 | switch (nbanks) { | ||
| 94 | case 2: | ||
| 95 | return ADDR_SURF_2_BANK; | ||
| 96 | case 4: | ||
| 97 | return ADDR_SURF_4_BANK; | ||
| 98 | case 8: | ||
| 99 | default: | ||
| 100 | return ADDR_SURF_8_BANK; | ||
| 101 | case 16: | ||
| 102 | return ADDR_SURF_16_BANK; | ||
| 103 | } | ||
| 104 | } | ||
| 105 | |||
| 106 | static u32 evergreen_cs_get_tile_split(u32 row_size) | ||
| 107 | { | ||
| 108 | switch (row_size) { | ||
| 109 | case 1: | ||
| 110 | default: | ||
| 111 | return ADDR_SURF_TILE_SPLIT_1KB; | ||
| 112 | case 2: | ||
| 113 | return ADDR_SURF_TILE_SPLIT_2KB; | ||
| 114 | case 4: | ||
| 115 | return ADDR_SURF_TILE_SPLIT_4KB; | ||
| 116 | } | ||
| 117 | } | ||
| 118 | |||
| 80 | static void evergreen_cs_track_init(struct evergreen_cs_track *track) | 119 | static void evergreen_cs_track_init(struct evergreen_cs_track *track) |
| 81 | { | 120 | { |
| 82 | int i; | 121 | int i; |
| @@ -490,12 +529,11 @@ static int evergreen_cs_check_reg(struct radeon_cs_parser *p, u32 reg, u32 idx) | |||
| 490 | } | 529 | } |
| 491 | ib[idx] &= ~Z_ARRAY_MODE(0xf); | 530 | ib[idx] &= ~Z_ARRAY_MODE(0xf); |
| 492 | track->db_z_info &= ~Z_ARRAY_MODE(0xf); | 531 | track->db_z_info &= ~Z_ARRAY_MODE(0xf); |
| 532 | ib[idx] |= Z_ARRAY_MODE(evergreen_cs_get_aray_mode(reloc->lobj.tiling_flags)); | ||
| 533 | track->db_z_info |= Z_ARRAY_MODE(evergreen_cs_get_aray_mode(reloc->lobj.tiling_flags)); | ||
| 493 | if (reloc->lobj.tiling_flags & RADEON_TILING_MACRO) { | 534 | if (reloc->lobj.tiling_flags & RADEON_TILING_MACRO) { |
| 494 | ib[idx] |= Z_ARRAY_MODE(ARRAY_2D_TILED_THIN1); | 535 | ib[idx] |= DB_NUM_BANKS(evergreen_cs_get_num_banks(track->nbanks)); |
| 495 | track->db_z_info |= Z_ARRAY_MODE(ARRAY_2D_TILED_THIN1); | 536 | ib[idx] |= DB_TILE_SPLIT(evergreen_cs_get_tile_split(track->row_size)); |
| 496 | } else { | ||
| 497 | ib[idx] |= Z_ARRAY_MODE(ARRAY_1D_TILED_THIN1); | ||
| 498 | track->db_z_info |= Z_ARRAY_MODE(ARRAY_1D_TILED_THIN1); | ||
| 499 | } | 537 | } |
| 500 | } | 538 | } |
| 501 | break; | 539 | break; |
| @@ -618,13 +656,8 @@ static int evergreen_cs_check_reg(struct radeon_cs_parser *p, u32 reg, u32 idx) | |||
| 618 | "0x%04X\n", reg); | 656 | "0x%04X\n", reg); |
| 619 | return -EINVAL; | 657 | return -EINVAL; |
| 620 | } | 658 | } |
| 621 | if (reloc->lobj.tiling_flags & RADEON_TILING_MACRO) { | 659 | ib[idx] |= CB_ARRAY_MODE(evergreen_cs_get_aray_mode(reloc->lobj.tiling_flags)); |
| 622 | ib[idx] |= CB_ARRAY_MODE(ARRAY_2D_TILED_THIN1); | 660 | track->cb_color_info[tmp] |= CB_ARRAY_MODE(evergreen_cs_get_aray_mode(reloc->lobj.tiling_flags)); |
| 623 | track->cb_color_info[tmp] |= CB_ARRAY_MODE(ARRAY_2D_TILED_THIN1); | ||
| 624 | } else if (reloc->lobj.tiling_flags & RADEON_TILING_MICRO) { | ||
| 625 | ib[idx] |= CB_ARRAY_MODE(ARRAY_1D_TILED_THIN1); | ||
| 626 | track->cb_color_info[tmp] |= CB_ARRAY_MODE(ARRAY_1D_TILED_THIN1); | ||
| 627 | } | ||
| 628 | } | 661 | } |
| 629 | break; | 662 | break; |
| 630 | case CB_COLOR8_INFO: | 663 | case CB_COLOR8_INFO: |
| @@ -640,13 +673,8 @@ static int evergreen_cs_check_reg(struct radeon_cs_parser *p, u32 reg, u32 idx) | |||
| 640 | "0x%04X\n", reg); | 673 | "0x%04X\n", reg); |
| 641 | return -EINVAL; | 674 | return -EINVAL; |
| 642 | } | 675 | } |
| 643 | if (reloc->lobj.tiling_flags & RADEON_TILING_MACRO) { | 676 | ib[idx] |= CB_ARRAY_MODE(evergreen_cs_get_aray_mode(reloc->lobj.tiling_flags)); |
| 644 | ib[idx] |= CB_ARRAY_MODE(ARRAY_2D_TILED_THIN1); | 677 | track->cb_color_info[tmp] |= CB_ARRAY_MODE(evergreen_cs_get_aray_mode(reloc->lobj.tiling_flags)); |
| 645 | track->cb_color_info[tmp] |= CB_ARRAY_MODE(ARRAY_2D_TILED_THIN1); | ||
| 646 | } else if (reloc->lobj.tiling_flags & RADEON_TILING_MICRO) { | ||
| 647 | ib[idx] |= CB_ARRAY_MODE(ARRAY_1D_TILED_THIN1); | ||
| 648 | track->cb_color_info[tmp] |= CB_ARRAY_MODE(ARRAY_1D_TILED_THIN1); | ||
| 649 | } | ||
| 650 | } | 678 | } |
| 651 | break; | 679 | break; |
| 652 | case CB_COLOR0_PITCH: | 680 | case CB_COLOR0_PITCH: |
| @@ -701,6 +729,16 @@ static int evergreen_cs_check_reg(struct radeon_cs_parser *p, u32 reg, u32 idx) | |||
| 701 | case CB_COLOR9_ATTRIB: | 729 | case CB_COLOR9_ATTRIB: |
| 702 | case CB_COLOR10_ATTRIB: | 730 | case CB_COLOR10_ATTRIB: |
| 703 | case CB_COLOR11_ATTRIB: | 731 | case CB_COLOR11_ATTRIB: |
| 732 | r = evergreen_cs_packet_next_reloc(p, &reloc); | ||
| 733 | if (r) { | ||
| 734 | dev_warn(p->dev, "bad SET_CONTEXT_REG " | ||
| 735 | "0x%04X\n", reg); | ||
| 736 | return -EINVAL; | ||
| 737 | } | ||
| 738 | if (reloc->lobj.tiling_flags & RADEON_TILING_MACRO) { | ||
| 739 | ib[idx] |= CB_NUM_BANKS(evergreen_cs_get_num_banks(track->nbanks)); | ||
| 740 | ib[idx] |= CB_TILE_SPLIT(evergreen_cs_get_tile_split(track->row_size)); | ||
| 741 | } | ||
| 704 | break; | 742 | break; |
| 705 | case CB_COLOR0_DIM: | 743 | case CB_COLOR0_DIM: |
| 706 | case CB_COLOR1_DIM: | 744 | case CB_COLOR1_DIM: |
| @@ -1318,10 +1356,14 @@ static int evergreen_packet3_check(struct radeon_cs_parser *p, | |||
| 1318 | } | 1356 | } |
| 1319 | ib[idx+1+(i*8)+2] += (u32)((reloc->lobj.gpu_offset >> 8) & 0xffffffff); | 1357 | ib[idx+1+(i*8)+2] += (u32)((reloc->lobj.gpu_offset >> 8) & 0xffffffff); |
| 1320 | if (!p->keep_tiling_flags) { | 1358 | if (!p->keep_tiling_flags) { |
| 1321 | if (reloc->lobj.tiling_flags & RADEON_TILING_MACRO) | 1359 | ib[idx+1+(i*8)+1] |= |
| 1322 | ib[idx+1+(i*8)+1] |= TEX_ARRAY_MODE(ARRAY_2D_TILED_THIN1); | 1360 | TEX_ARRAY_MODE(evergreen_cs_get_aray_mode(reloc->lobj.tiling_flags)); |
| 1323 | else if (reloc->lobj.tiling_flags & RADEON_TILING_MICRO) | 1361 | if (reloc->lobj.tiling_flags & RADEON_TILING_MACRO) { |
| 1324 | ib[idx+1+(i*8)+1] |= TEX_ARRAY_MODE(ARRAY_1D_TILED_THIN1); | 1362 | ib[idx+1+(i*8)+6] |= |
| 1363 | TEX_TILE_SPLIT(evergreen_cs_get_tile_split(track->row_size)); | ||
| 1364 | ib[idx+1+(i*8)+7] |= | ||
| 1365 | TEX_NUM_BANKS(evergreen_cs_get_num_banks(track->nbanks)); | ||
| 1366 | } | ||
| 1325 | } | 1367 | } |
| 1326 | texture = reloc->robj; | 1368 | texture = reloc->robj; |
| 1327 | /* tex mip base */ | 1369 | /* tex mip base */ |
| @@ -1422,6 +1464,7 @@ int evergreen_cs_parse(struct radeon_cs_parser *p) | |||
| 1422 | { | 1464 | { |
| 1423 | struct radeon_cs_packet pkt; | 1465 | struct radeon_cs_packet pkt; |
| 1424 | struct evergreen_cs_track *track; | 1466 | struct evergreen_cs_track *track; |
| 1467 | u32 tmp; | ||
| 1425 | int r; | 1468 | int r; |
| 1426 | 1469 | ||
| 1427 | if (p->track == NULL) { | 1470 | if (p->track == NULL) { |
| @@ -1430,9 +1473,63 @@ int evergreen_cs_parse(struct radeon_cs_parser *p) | |||
| 1430 | if (track == NULL) | 1473 | if (track == NULL) |
| 1431 | return -ENOMEM; | 1474 | return -ENOMEM; |
| 1432 | evergreen_cs_track_init(track); | 1475 | evergreen_cs_track_init(track); |
| 1433 | track->npipes = p->rdev->config.evergreen.tiling_npipes; | 1476 | if (p->rdev->family >= CHIP_CAYMAN) |
| 1434 | track->nbanks = p->rdev->config.evergreen.tiling_nbanks; | 1477 | tmp = p->rdev->config.cayman.tile_config; |
| 1435 | track->group_size = p->rdev->config.evergreen.tiling_group_size; | 1478 | else |
| 1479 | tmp = p->rdev->config.evergreen.tile_config; | ||
| 1480 | |||
| 1481 | switch (tmp & 0xf) { | ||
| 1482 | case 0: | ||
| 1483 | track->npipes = 1; | ||
| 1484 | break; | ||
| 1485 | case 1: | ||
| 1486 | default: | ||
| 1487 | track->npipes = 2; | ||
| 1488 | break; | ||
| 1489 | case 2: | ||
| 1490 | track->npipes = 4; | ||
| 1491 | break; | ||
| 1492 | case 3: | ||
| 1493 | track->npipes = 8; | ||
| 1494 | break; | ||
| 1495 | } | ||
| 1496 | |||
| 1497 | switch ((tmp & 0xf0) >> 4) { | ||
| 1498 | case 0: | ||
| 1499 | track->nbanks = 4; | ||
| 1500 | break; | ||
| 1501 | case 1: | ||
| 1502 | default: | ||
| 1503 | track->nbanks = 8; | ||
| 1504 | break; | ||
| 1505 | case 2: | ||
| 1506 | track->nbanks = 16; | ||
| 1507 | break; | ||
| 1508 | } | ||
| 1509 | |||
| 1510 | switch ((tmp & 0xf00) >> 8) { | ||
| 1511 | case 0: | ||
| 1512 | track->group_size = 256; | ||
| 1513 | break; | ||
| 1514 | case 1: | ||
| 1515 | default: | ||
| 1516 | track->group_size = 512; | ||
| 1517 | break; | ||
| 1518 | } | ||
| 1519 | |||
| 1520 | switch ((tmp & 0xf000) >> 12) { | ||
| 1521 | case 0: | ||
| 1522 | track->row_size = 1; | ||
| 1523 | break; | ||
| 1524 | case 1: | ||
| 1525 | default: | ||
| 1526 | track->row_size = 2; | ||
| 1527 | break; | ||
| 1528 | case 2: | ||
| 1529 | track->row_size = 4; | ||
| 1530 | break; | ||
| 1531 | } | ||
| 1532 | |||
| 1436 | p->track = track; | 1533 | p->track = track; |
| 1437 | } | 1534 | } |
| 1438 | do { | 1535 | do { |
diff --git a/drivers/gpu/drm/radeon/evergreen_reg.h b/drivers/gpu/drm/radeon/evergreen_reg.h index c781c92c3451..7d7f2155e34c 100644 --- a/drivers/gpu/drm/radeon/evergreen_reg.h +++ b/drivers/gpu/drm/radeon/evergreen_reg.h | |||
| @@ -42,6 +42,17 @@ | |||
| 42 | # define EVERGREEN_GRPH_DEPTH_8BPP 0 | 42 | # define EVERGREEN_GRPH_DEPTH_8BPP 0 |
| 43 | # define EVERGREEN_GRPH_DEPTH_16BPP 1 | 43 | # define EVERGREEN_GRPH_DEPTH_16BPP 1 |
| 44 | # define EVERGREEN_GRPH_DEPTH_32BPP 2 | 44 | # define EVERGREEN_GRPH_DEPTH_32BPP 2 |
| 45 | # define EVERGREEN_GRPH_NUM_BANKS(x) (((x) & 0x3) << 2) | ||
| 46 | # define EVERGREEN_ADDR_SURF_2_BANK 0 | ||
| 47 | # define EVERGREEN_ADDR_SURF_4_BANK 1 | ||
| 48 | # define EVERGREEN_ADDR_SURF_8_BANK 2 | ||
| 49 | # define EVERGREEN_ADDR_SURF_16_BANK 3 | ||
| 50 | # define EVERGREEN_GRPH_Z(x) (((x) & 0x3) << 4) | ||
| 51 | # define EVERGREEN_GRPH_BANK_WIDTH(x) (((x) & 0x3) << 6) | ||
| 52 | # define EVERGREEN_ADDR_SURF_BANK_WIDTH_1 0 | ||
| 53 | # define EVERGREEN_ADDR_SURF_BANK_WIDTH_2 1 | ||
| 54 | # define EVERGREEN_ADDR_SURF_BANK_WIDTH_4 2 | ||
| 55 | # define EVERGREEN_ADDR_SURF_BANK_WIDTH_8 3 | ||
| 45 | # define EVERGREEN_GRPH_FORMAT(x) (((x) & 0x7) << 8) | 56 | # define EVERGREEN_GRPH_FORMAT(x) (((x) & 0x7) << 8) |
| 46 | /* 8 BPP */ | 57 | /* 8 BPP */ |
| 47 | # define EVERGREEN_GRPH_FORMAT_INDEXED 0 | 58 | # define EVERGREEN_GRPH_FORMAT_INDEXED 0 |
| @@ -61,6 +72,24 @@ | |||
| 61 | # define EVERGREEN_GRPH_FORMAT_8B_BGRA1010102 5 | 72 | # define EVERGREEN_GRPH_FORMAT_8B_BGRA1010102 5 |
| 62 | # define EVERGREEN_GRPH_FORMAT_RGB111110 6 | 73 | # define EVERGREEN_GRPH_FORMAT_RGB111110 6 |
| 63 | # define EVERGREEN_GRPH_FORMAT_BGR101111 7 | 74 | # define EVERGREEN_GRPH_FORMAT_BGR101111 7 |
| 75 | # define EVERGREEN_GRPH_BANK_HEIGHT(x) (((x) & 0x3) << 11) | ||
| 76 | # define EVERGREEN_ADDR_SURF_BANK_HEIGHT_1 0 | ||
| 77 | # define EVERGREEN_ADDR_SURF_BANK_HEIGHT_2 1 | ||
| 78 | # define EVERGREEN_ADDR_SURF_BANK_HEIGHT_4 2 | ||
| 79 | # define EVERGREEN_ADDR_SURF_BANK_HEIGHT_8 3 | ||
| 80 | # define EVERGREEN_GRPH_TILE_SPLIT(x) (((x) & 0x7) << 13) | ||
| 81 | # define EVERGREEN_ADDR_SURF_TILE_SPLIT_64B 0 | ||
| 82 | # define EVERGREEN_ADDR_SURF_TILE_SPLIT_128B 1 | ||
| 83 | # define EVERGREEN_ADDR_SURF_TILE_SPLIT_256B 2 | ||
| 84 | # define EVERGREEN_ADDR_SURF_TILE_SPLIT_512B 3 | ||
| 85 | # define EVERGREEN_ADDR_SURF_TILE_SPLIT_1KB 4 | ||
| 86 | # define EVERGREEN_ADDR_SURF_TILE_SPLIT_2KB 5 | ||
| 87 | # define EVERGREEN_ADDR_SURF_TILE_SPLIT_4KB 6 | ||
| 88 | # define EVERGREEN_GRPH_MACRO_TILE_ASPECT(x) (((x) & 0x3) << 18) | ||
| 89 | # define EVERGREEN_ADDR_SURF_MACRO_TILE_ASPECT_1 0 | ||
| 90 | # define EVERGREEN_ADDR_SURF_MACRO_TILE_ASPECT_2 1 | ||
| 91 | # define EVERGREEN_ADDR_SURF_MACRO_TILE_ASPECT_4 2 | ||
| 92 | # define EVERGREEN_ADDR_SURF_MACRO_TILE_ASPECT_8 3 | ||
| 64 | # define EVERGREEN_GRPH_ARRAY_MODE(x) (((x) & 0x7) << 20) | 93 | # define EVERGREEN_GRPH_ARRAY_MODE(x) (((x) & 0x7) << 20) |
| 65 | # define EVERGREEN_GRPH_ARRAY_LINEAR_GENERAL 0 | 94 | # define EVERGREEN_GRPH_ARRAY_LINEAR_GENERAL 0 |
| 66 | # define EVERGREEN_GRPH_ARRAY_LINEAR_ALIGNED 1 | 95 | # define EVERGREEN_GRPH_ARRAY_LINEAR_ALIGNED 1 |
diff --git a/drivers/gpu/drm/radeon/evergreend.h b/drivers/gpu/drm/radeon/evergreend.h index b937c49054d9..e00039e59a75 100644 --- a/drivers/gpu/drm/radeon/evergreend.h +++ b/drivers/gpu/drm/radeon/evergreend.h | |||
| @@ -899,6 +899,10 @@ | |||
| 899 | #define DB_HTILE_DATA_BASE 0x28014 | 899 | #define DB_HTILE_DATA_BASE 0x28014 |
| 900 | #define DB_Z_INFO 0x28040 | 900 | #define DB_Z_INFO 0x28040 |
| 901 | # define Z_ARRAY_MODE(x) ((x) << 4) | 901 | # define Z_ARRAY_MODE(x) ((x) << 4) |
| 902 | # define DB_TILE_SPLIT(x) (((x) & 0x7) << 8) | ||
| 903 | # define DB_NUM_BANKS(x) (((x) & 0x3) << 12) | ||
| 904 | # define DB_BANK_WIDTH(x) (((x) & 0x3) << 16) | ||
| 905 | # define DB_BANK_HEIGHT(x) (((x) & 0x3) << 20) | ||
| 902 | #define DB_STENCIL_INFO 0x28044 | 906 | #define DB_STENCIL_INFO 0x28044 |
| 903 | #define DB_Z_READ_BASE 0x28048 | 907 | #define DB_Z_READ_BASE 0x28048 |
| 904 | #define DB_STENCIL_READ_BASE 0x2804c | 908 | #define DB_STENCIL_READ_BASE 0x2804c |
| @@ -951,6 +955,29 @@ | |||
| 951 | # define CB_SF_EXPORT_FULL 0 | 955 | # define CB_SF_EXPORT_FULL 0 |
| 952 | # define CB_SF_EXPORT_NORM 1 | 956 | # define CB_SF_EXPORT_NORM 1 |
| 953 | #define CB_COLOR0_ATTRIB 0x28c74 | 957 | #define CB_COLOR0_ATTRIB 0x28c74 |
| 958 | # define CB_TILE_SPLIT(x) (((x) & 0x7) << 5) | ||
| 959 | # define ADDR_SURF_TILE_SPLIT_64B 0 | ||
| 960 | # define ADDR_SURF_TILE_SPLIT_128B 1 | ||
| 961 | # define ADDR_SURF_TILE_SPLIT_256B 2 | ||
| 962 | # define ADDR_SURF_TILE_SPLIT_512B 3 | ||
| 963 | # define ADDR_SURF_TILE_SPLIT_1KB 4 | ||
| 964 | # define ADDR_SURF_TILE_SPLIT_2KB 5 | ||
| 965 | # define ADDR_SURF_TILE_SPLIT_4KB 6 | ||
| 966 | # define CB_NUM_BANKS(x) (((x) & 0x3) << 10) | ||
| 967 | # define ADDR_SURF_2_BANK 0 | ||
| 968 | # define ADDR_SURF_4_BANK 1 | ||
| 969 | # define ADDR_SURF_8_BANK 2 | ||
| 970 | # define ADDR_SURF_16_BANK 3 | ||
| 971 | # define CB_BANK_WIDTH(x) (((x) & 0x3) << 13) | ||
| 972 | # define ADDR_SURF_BANK_WIDTH_1 0 | ||
| 973 | # define ADDR_SURF_BANK_WIDTH_2 1 | ||
| 974 | # define ADDR_SURF_BANK_WIDTH_4 2 | ||
| 975 | # define ADDR_SURF_BANK_WIDTH_8 3 | ||
| 976 | # define CB_BANK_HEIGHT(x) (((x) & 0x3) << 16) | ||
| 977 | # define ADDR_SURF_BANK_HEIGHT_1 0 | ||
| 978 | # define ADDR_SURF_BANK_HEIGHT_2 1 | ||
| 979 | # define ADDR_SURF_BANK_HEIGHT_4 2 | ||
| 980 | # define ADDR_SURF_BANK_HEIGHT_8 3 | ||
| 954 | #define CB_COLOR0_DIM 0x28c78 | 981 | #define CB_COLOR0_DIM 0x28c78 |
| 955 | /* only CB0-7 blocks have these regs */ | 982 | /* only CB0-7 blocks have these regs */ |
| 956 | #define CB_COLOR0_CMASK 0x28c7c | 983 | #define CB_COLOR0_CMASK 0x28c7c |
| @@ -1137,7 +1164,11 @@ | |||
| 1137 | # define SQ_SEL_1 5 | 1164 | # define SQ_SEL_1 5 |
| 1138 | #define SQ_TEX_RESOURCE_WORD5_0 0x30014 | 1165 | #define SQ_TEX_RESOURCE_WORD5_0 0x30014 |
| 1139 | #define SQ_TEX_RESOURCE_WORD6_0 0x30018 | 1166 | #define SQ_TEX_RESOURCE_WORD6_0 0x30018 |
| 1167 | # define TEX_TILE_SPLIT(x) (((x) & 0x7) << 29) | ||
| 1140 | #define SQ_TEX_RESOURCE_WORD7_0 0x3001c | 1168 | #define SQ_TEX_RESOURCE_WORD7_0 0x3001c |
| 1169 | # define TEX_BANK_WIDTH(x) (((x) & 0x3) << 8) | ||
| 1170 | # define TEX_BANK_HEIGHT(x) (((x) & 0x3) << 10) | ||
| 1171 | # define TEX_NUM_BANKS(x) (((x) & 0x3) << 16) | ||
| 1141 | 1172 | ||
| 1142 | #define SQ_VTX_CONSTANT_WORD0_0 0x30000 | 1173 | #define SQ_VTX_CONSTANT_WORD0_0 0x30000 |
| 1143 | #define SQ_VTX_CONSTANT_WORD1_0 0x30004 | 1174 | #define SQ_VTX_CONSTANT_WORD1_0 0x30004 |
diff --git a/drivers/gpu/drm/radeon/r100.c b/drivers/gpu/drm/radeon/r100.c index ad158ea49901..bfc08f6320f8 100644 --- a/drivers/gpu/drm/radeon/r100.c +++ b/drivers/gpu/drm/radeon/r100.c | |||
| @@ -187,13 +187,18 @@ u32 r100_page_flip(struct radeon_device *rdev, int crtc_id, u64 crtc_base) | |||
| 187 | { | 187 | { |
| 188 | struct radeon_crtc *radeon_crtc = rdev->mode_info.crtcs[crtc_id]; | 188 | struct radeon_crtc *radeon_crtc = rdev->mode_info.crtcs[crtc_id]; |
| 189 | u32 tmp = ((u32)crtc_base) | RADEON_CRTC_OFFSET__OFFSET_LOCK; | 189 | u32 tmp = ((u32)crtc_base) | RADEON_CRTC_OFFSET__OFFSET_LOCK; |
| 190 | int i; | ||
| 190 | 191 | ||
| 191 | /* Lock the graphics update lock */ | 192 | /* Lock the graphics update lock */ |
| 192 | /* update the scanout addresses */ | 193 | /* update the scanout addresses */ |
| 193 | WREG32(RADEON_CRTC_OFFSET + radeon_crtc->crtc_offset, tmp); | 194 | WREG32(RADEON_CRTC_OFFSET + radeon_crtc->crtc_offset, tmp); |
| 194 | 195 | ||
| 195 | /* Wait for update_pending to go high. */ | 196 | /* Wait for update_pending to go high. */ |
| 196 | while (!(RREG32(RADEON_CRTC_OFFSET + radeon_crtc->crtc_offset) & RADEON_CRTC_OFFSET__GUI_TRIG_OFFSET)); | 197 | for (i = 0; i < rdev->usec_timeout; i++) { |
| 198 | if (RREG32(RADEON_CRTC_OFFSET + radeon_crtc->crtc_offset) & RADEON_CRTC_OFFSET__GUI_TRIG_OFFSET) | ||
| 199 | break; | ||
| 200 | udelay(1); | ||
| 201 | } | ||
| 197 | DRM_DEBUG("Update pending now high. Unlocking vupdate_lock.\n"); | 202 | DRM_DEBUG("Update pending now high. Unlocking vupdate_lock.\n"); |
| 198 | 203 | ||
| 199 | /* Unlock the lock, so double-buffering can take place inside vblank */ | 204 | /* Unlock the lock, so double-buffering can take place inside vblank */ |
diff --git a/drivers/gpu/drm/radeon/radeon_acpi.c b/drivers/gpu/drm/radeon/radeon_acpi.c index 3f6636bb2d7f..3516a6081dcf 100644 --- a/drivers/gpu/drm/radeon/radeon_acpi.c +++ b/drivers/gpu/drm/radeon/radeon_acpi.c | |||
| @@ -35,7 +35,8 @@ static int radeon_atif_call(acpi_handle handle) | |||
| 35 | 35 | ||
| 36 | /* Fail only if calling the method fails and ATIF is supported */ | 36 | /* Fail only if calling the method fails and ATIF is supported */ |
| 37 | if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) { | 37 | if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) { |
| 38 | printk(KERN_DEBUG "failed to evaluate ATIF got %s\n", acpi_format_exception(status)); | 38 | DRM_DEBUG_DRIVER("failed to evaluate ATIF got %s\n", |
| 39 | acpi_format_exception(status)); | ||
| 39 | kfree(buffer.pointer); | 40 | kfree(buffer.pointer); |
| 40 | return 1; | 41 | return 1; |
| 41 | } | 42 | } |
| @@ -50,13 +51,13 @@ int radeon_acpi_init(struct radeon_device *rdev) | |||
| 50 | acpi_handle handle; | 51 | acpi_handle handle; |
| 51 | int ret; | 52 | int ret; |
| 52 | 53 | ||
| 53 | /* No need to proceed if we're sure that ATIF is not supported */ | ||
| 54 | if (!ASIC_IS_AVIVO(rdev) || !rdev->bios) | ||
| 55 | return 0; | ||
| 56 | |||
| 57 | /* Get the device handle */ | 54 | /* Get the device handle */ |
| 58 | handle = DEVICE_ACPI_HANDLE(&rdev->pdev->dev); | 55 | handle = DEVICE_ACPI_HANDLE(&rdev->pdev->dev); |
| 59 | 56 | ||
| 57 | /* No need to proceed if we're sure that ATIF is not supported */ | ||
| 58 | if (!ASIC_IS_AVIVO(rdev) || !rdev->bios || !handle) | ||
| 59 | return 0; | ||
| 60 | |||
| 60 | /* Call the ATIF method */ | 61 | /* Call the ATIF method */ |
| 61 | ret = radeon_atif_call(handle); | 62 | ret = radeon_atif_call(handle); |
| 62 | if (ret) | 63 | if (ret) |
diff --git a/drivers/gpu/drm/radeon/rs600.c b/drivers/gpu/drm/radeon/rs600.c index 481b99e89f65..b1053d640423 100644 --- a/drivers/gpu/drm/radeon/rs600.c +++ b/drivers/gpu/drm/radeon/rs600.c | |||
| @@ -62,6 +62,7 @@ u32 rs600_page_flip(struct radeon_device *rdev, int crtc_id, u64 crtc_base) | |||
| 62 | { | 62 | { |
| 63 | struct radeon_crtc *radeon_crtc = rdev->mode_info.crtcs[crtc_id]; | 63 | struct radeon_crtc *radeon_crtc = rdev->mode_info.crtcs[crtc_id]; |
| 64 | u32 tmp = RREG32(AVIVO_D1GRPH_UPDATE + radeon_crtc->crtc_offset); | 64 | u32 tmp = RREG32(AVIVO_D1GRPH_UPDATE + radeon_crtc->crtc_offset); |
| 65 | int i; | ||
| 65 | 66 | ||
| 66 | /* Lock the graphics update lock */ | 67 | /* Lock the graphics update lock */ |
| 67 | tmp |= AVIVO_D1GRPH_UPDATE_LOCK; | 68 | tmp |= AVIVO_D1GRPH_UPDATE_LOCK; |
| @@ -74,7 +75,11 @@ u32 rs600_page_flip(struct radeon_device *rdev, int crtc_id, u64 crtc_base) | |||
| 74 | (u32)crtc_base); | 75 | (u32)crtc_base); |
| 75 | 76 | ||
| 76 | /* Wait for update_pending to go high. */ | 77 | /* Wait for update_pending to go high. */ |
| 77 | while (!(RREG32(AVIVO_D1GRPH_UPDATE + radeon_crtc->crtc_offset) & AVIVO_D1GRPH_SURFACE_UPDATE_PENDING)); | 78 | for (i = 0; i < rdev->usec_timeout; i++) { |
| 79 | if (RREG32(AVIVO_D1GRPH_UPDATE + radeon_crtc->crtc_offset) & AVIVO_D1GRPH_SURFACE_UPDATE_PENDING) | ||
| 80 | break; | ||
| 81 | udelay(1); | ||
| 82 | } | ||
| 78 | DRM_DEBUG("Update pending now high. Unlocking vupdate_lock.\n"); | 83 | DRM_DEBUG("Update pending now high. Unlocking vupdate_lock.\n"); |
| 79 | 84 | ||
| 80 | /* Unlock the lock, so double-buffering can take place inside vblank */ | 85 | /* Unlock the lock, so double-buffering can take place inside vblank */ |
diff --git a/drivers/gpu/drm/radeon/rv770.c b/drivers/gpu/drm/radeon/rv770.c index a983f410ab89..23ae1c60ab3d 100644 --- a/drivers/gpu/drm/radeon/rv770.c +++ b/drivers/gpu/drm/radeon/rv770.c | |||
| @@ -47,6 +47,7 @@ u32 rv770_page_flip(struct radeon_device *rdev, int crtc_id, u64 crtc_base) | |||
| 47 | { | 47 | { |
| 48 | struct radeon_crtc *radeon_crtc = rdev->mode_info.crtcs[crtc_id]; | 48 | struct radeon_crtc *radeon_crtc = rdev->mode_info.crtcs[crtc_id]; |
| 49 | u32 tmp = RREG32(AVIVO_D1GRPH_UPDATE + radeon_crtc->crtc_offset); | 49 | u32 tmp = RREG32(AVIVO_D1GRPH_UPDATE + radeon_crtc->crtc_offset); |
| 50 | int i; | ||
| 50 | 51 | ||
| 51 | /* Lock the graphics update lock */ | 52 | /* Lock the graphics update lock */ |
| 52 | tmp |= AVIVO_D1GRPH_UPDATE_LOCK; | 53 | tmp |= AVIVO_D1GRPH_UPDATE_LOCK; |
| @@ -66,7 +67,11 @@ u32 rv770_page_flip(struct radeon_device *rdev, int crtc_id, u64 crtc_base) | |||
| 66 | (u32)crtc_base); | 67 | (u32)crtc_base); |
| 67 | 68 | ||
| 68 | /* Wait for update_pending to go high. */ | 69 | /* Wait for update_pending to go high. */ |
| 69 | while (!(RREG32(AVIVO_D1GRPH_UPDATE + radeon_crtc->crtc_offset) & AVIVO_D1GRPH_SURFACE_UPDATE_PENDING)); | 70 | for (i = 0; i < rdev->usec_timeout; i++) { |
| 71 | if (RREG32(AVIVO_D1GRPH_UPDATE + radeon_crtc->crtc_offset) & AVIVO_D1GRPH_SURFACE_UPDATE_PENDING) | ||
| 72 | break; | ||
| 73 | udelay(1); | ||
| 74 | } | ||
| 70 | DRM_DEBUG("Update pending now high. Unlocking vupdate_lock.\n"); | 75 | DRM_DEBUG("Update pending now high. Unlocking vupdate_lock.\n"); |
| 71 | 76 | ||
| 72 | /* Unlock the lock, so double-buffering can take place inside vblank */ | 77 | /* Unlock the lock, so double-buffering can take place inside vblank */ |
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c index 880e285d7578..37d40545ed77 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | |||
| @@ -1809,7 +1809,8 @@ int vmw_kms_update_layout_ioctl(struct drm_device *dev, void *data, | |||
| 1809 | } | 1809 | } |
| 1810 | 1810 | ||
| 1811 | rects_size = arg->num_outputs * sizeof(struct drm_vmw_rect); | 1811 | rects_size = arg->num_outputs * sizeof(struct drm_vmw_rect); |
| 1812 | rects = kzalloc(rects_size, GFP_KERNEL); | 1812 | rects = kcalloc(arg->num_outputs, sizeof(struct drm_vmw_rect), |
| 1813 | GFP_KERNEL); | ||
| 1813 | if (unlikely(!rects)) { | 1814 | if (unlikely(!rects)) { |
| 1814 | ret = -ENOMEM; | 1815 | ret = -ENOMEM; |
| 1815 | goto out_unlock; | 1816 | goto out_unlock; |
| @@ -1824,10 +1825,10 @@ int vmw_kms_update_layout_ioctl(struct drm_device *dev, void *data, | |||
| 1824 | } | 1825 | } |
| 1825 | 1826 | ||
| 1826 | for (i = 0; i < arg->num_outputs; ++i) { | 1827 | for (i = 0; i < arg->num_outputs; ++i) { |
| 1827 | if (rects->x < 0 || | 1828 | if (rects[i].x < 0 || |
| 1828 | rects->y < 0 || | 1829 | rects[i].y < 0 || |
| 1829 | rects->x + rects->w > mode_config->max_width || | 1830 | rects[i].x + rects[i].w > mode_config->max_width || |
| 1830 | rects->y + rects->h > mode_config->max_height) { | 1831 | rects[i].y + rects[i].h > mode_config->max_height) { |
| 1831 | DRM_ERROR("Invalid GUI layout.\n"); | 1832 | DRM_ERROR("Invalid GUI layout.\n"); |
| 1832 | ret = -EINVAL; | 1833 | ret = -EINVAL; |
| 1833 | goto out_free; | 1834 | goto out_free; |
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c index 848a56c0279c..af353842f75f 100644 --- a/drivers/hid/hid-core.c +++ b/drivers/hid/hid-core.c | |||
| @@ -1771,8 +1771,8 @@ static const struct hid_device_id hid_ignore_list[] = { | |||
| 1771 | { HID_USB_DEVICE(USB_VENDOR_ID_ESSENTIAL_REALITY, USB_DEVICE_ID_ESSENTIAL_REALITY_P5) }, | 1771 | { HID_USB_DEVICE(USB_VENDOR_ID_ESSENTIAL_REALITY, USB_DEVICE_ID_ESSENTIAL_REALITY_P5) }, |
| 1772 | { HID_USB_DEVICE(USB_VENDOR_ID_ETT, USB_DEVICE_ID_TC5UH) }, | 1772 | { HID_USB_DEVICE(USB_VENDOR_ID_ETT, USB_DEVICE_ID_TC5UH) }, |
| 1773 | { HID_USB_DEVICE(USB_VENDOR_ID_ETT, USB_DEVICE_ID_TC4UM) }, | 1773 | { HID_USB_DEVICE(USB_VENDOR_ID_ETT, USB_DEVICE_ID_TC4UM) }, |
| 1774 | { HID_USB_DEVICE(USB_VENDOR_ID_GENERAL_TOUCH, 0x0001) }, | ||
| 1774 | { HID_USB_DEVICE(USB_VENDOR_ID_GENERAL_TOUCH, 0x0002) }, | 1775 | { HID_USB_DEVICE(USB_VENDOR_ID_GENERAL_TOUCH, 0x0002) }, |
| 1775 | { HID_USB_DEVICE(USB_VENDOR_ID_GENERAL_TOUCH, 0x0003) }, | ||
| 1776 | { HID_USB_DEVICE(USB_VENDOR_ID_GENERAL_TOUCH, 0x0004) }, | 1776 | { HID_USB_DEVICE(USB_VENDOR_ID_GENERAL_TOUCH, 0x0004) }, |
| 1777 | { HID_USB_DEVICE(USB_VENDOR_ID_GLAB, USB_DEVICE_ID_4_PHIDGETSERVO_30) }, | 1777 | { HID_USB_DEVICE(USB_VENDOR_ID_GLAB, USB_DEVICE_ID_4_PHIDGETSERVO_30) }, |
| 1778 | { HID_USB_DEVICE(USB_VENDOR_ID_GLAB, USB_DEVICE_ID_1_PHIDGETSERVO_30) }, | 1778 | { HID_USB_DEVICE(USB_VENDOR_ID_GLAB, USB_DEVICE_ID_1_PHIDGETSERVO_30) }, |
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h index 06ce996b8b65..4a441a6f9967 100644 --- a/drivers/hid/hid-ids.h +++ b/drivers/hid/hid-ids.h | |||
| @@ -266,7 +266,7 @@ | |||
| 266 | #define USB_DEVICE_ID_GAMERON_DUAL_PCS_ADAPTOR 0x0002 | 266 | #define USB_DEVICE_ID_GAMERON_DUAL_PCS_ADAPTOR 0x0002 |
| 267 | 267 | ||
| 268 | #define USB_VENDOR_ID_GENERAL_TOUCH 0x0dfc | 268 | #define USB_VENDOR_ID_GENERAL_TOUCH 0x0dfc |
| 269 | #define USB_DEVICE_ID_GENERAL_TOUCH_WIN7_TWOFINGERS 0x0001 | 269 | #define USB_DEVICE_ID_GENERAL_TOUCH_WIN7_TWOFINGERS 0x0003 |
| 270 | 270 | ||
| 271 | #define USB_VENDOR_ID_GLAB 0x06c2 | 271 | #define USB_VENDOR_ID_GLAB 0x06c2 |
| 272 | #define USB_DEVICE_ID_4_PHIDGETSERVO_30 0x0038 | 272 | #define USB_DEVICE_ID_4_PHIDGETSERVO_30 0x0038 |
diff --git a/drivers/hwmon/ad7314.c b/drivers/hwmon/ad7314.c index 318e38e85376..5d760f3d21c2 100644 --- a/drivers/hwmon/ad7314.c +++ b/drivers/hwmon/ad7314.c | |||
| @@ -160,7 +160,6 @@ MODULE_DEVICE_TABLE(spi, ad7314_id); | |||
| 160 | static struct spi_driver ad7314_driver = { | 160 | static struct spi_driver ad7314_driver = { |
| 161 | .driver = { | 161 | .driver = { |
| 162 | .name = "ad7314", | 162 | .name = "ad7314", |
| 163 | .bus = &spi_bus_type, | ||
| 164 | .owner = THIS_MODULE, | 163 | .owner = THIS_MODULE, |
| 165 | }, | 164 | }, |
| 166 | .probe = ad7314_probe, | 165 | .probe = ad7314_probe, |
diff --git a/drivers/hwmon/ads7871.c b/drivers/hwmon/ads7871.c index 52319340e182..04450f8bf5da 100644 --- a/drivers/hwmon/ads7871.c +++ b/drivers/hwmon/ads7871.c | |||
| @@ -227,7 +227,6 @@ static int __devexit ads7871_remove(struct spi_device *spi) | |||
| 227 | static struct spi_driver ads7871_driver = { | 227 | static struct spi_driver ads7871_driver = { |
| 228 | .driver = { | 228 | .driver = { |
| 229 | .name = DEVICE_NAME, | 229 | .name = DEVICE_NAME, |
| 230 | .bus = &spi_bus_type, | ||
| 231 | .owner = THIS_MODULE, | 230 | .owner = THIS_MODULE, |
| 232 | }, | 231 | }, |
| 233 | 232 | ||
diff --git a/drivers/hwmon/exynos4_tmu.c b/drivers/hwmon/exynos4_tmu.c index faa0884f61f6..f2359a0093bd 100644 --- a/drivers/hwmon/exynos4_tmu.c +++ b/drivers/hwmon/exynos4_tmu.c | |||
| @@ -506,17 +506,7 @@ static struct platform_driver exynos4_tmu_driver = { | |||
| 506 | .resume = exynos4_tmu_resume, | 506 | .resume = exynos4_tmu_resume, |
| 507 | }; | 507 | }; |
| 508 | 508 | ||
| 509 | static int __init exynos4_tmu_driver_init(void) | 509 | module_platform_driver(exynos4_tmu_driver); |
| 510 | { | ||
| 511 | return platform_driver_register(&exynos4_tmu_driver); | ||
| 512 | } | ||
| 513 | module_init(exynos4_tmu_driver_init); | ||
| 514 | |||
| 515 | static void __exit exynos4_tmu_driver_exit(void) | ||
| 516 | { | ||
| 517 | platform_driver_unregister(&exynos4_tmu_driver); | ||
| 518 | } | ||
| 519 | module_exit(exynos4_tmu_driver_exit); | ||
| 520 | 510 | ||
| 521 | MODULE_DESCRIPTION("EXYNOS4 TMU Driver"); | 511 | MODULE_DESCRIPTION("EXYNOS4 TMU Driver"); |
| 522 | MODULE_AUTHOR("Donggeun Kim <dg77.kim@samsung.com>"); | 512 | MODULE_AUTHOR("Donggeun Kim <dg77.kim@samsung.com>"); |
diff --git a/drivers/hwmon/gpio-fan.c b/drivers/hwmon/gpio-fan.c index 89aa9fb743af..9ba38f318ffb 100644 --- a/drivers/hwmon/gpio-fan.c +++ b/drivers/hwmon/gpio-fan.c | |||
| @@ -539,18 +539,7 @@ static struct platform_driver gpio_fan_driver = { | |||
| 539 | }, | 539 | }, |
| 540 | }; | 540 | }; |
| 541 | 541 | ||
| 542 | static int __init gpio_fan_init(void) | 542 | module_platform_driver(gpio_fan_driver); |
| 543 | { | ||
| 544 | return platform_driver_register(&gpio_fan_driver); | ||
| 545 | } | ||
| 546 | |||
| 547 | static void __exit gpio_fan_exit(void) | ||
| 548 | { | ||
| 549 | platform_driver_unregister(&gpio_fan_driver); | ||
| 550 | } | ||
| 551 | |||
| 552 | module_init(gpio_fan_init); | ||
| 553 | module_exit(gpio_fan_exit); | ||
| 554 | 543 | ||
| 555 | MODULE_AUTHOR("Simon Guinot <sguinot@lacie.com>"); | 544 | MODULE_AUTHOR("Simon Guinot <sguinot@lacie.com>"); |
| 556 | MODULE_DESCRIPTION("GPIO FAN driver"); | 545 | MODULE_DESCRIPTION("GPIO FAN driver"); |
diff --git a/drivers/hwmon/jz4740-hwmon.c b/drivers/hwmon/jz4740-hwmon.c index fea292d43407..7a48b1eb4233 100644 --- a/drivers/hwmon/jz4740-hwmon.c +++ b/drivers/hwmon/jz4740-hwmon.c | |||
| @@ -212,17 +212,7 @@ struct platform_driver jz4740_hwmon_driver = { | |||
| 212 | }, | 212 | }, |
| 213 | }; | 213 | }; |
| 214 | 214 | ||
| 215 | static int __init jz4740_hwmon_init(void) | 215 | module_platform_driver(jz4740_hwmon_driver); |
| 216 | { | ||
| 217 | return platform_driver_register(&jz4740_hwmon_driver); | ||
| 218 | } | ||
| 219 | module_init(jz4740_hwmon_init); | ||
| 220 | |||
| 221 | static void __exit jz4740_hwmon_exit(void) | ||
| 222 | { | ||
| 223 | platform_driver_unregister(&jz4740_hwmon_driver); | ||
| 224 | } | ||
| 225 | module_exit(jz4740_hwmon_exit); | ||
| 226 | 216 | ||
| 227 | MODULE_DESCRIPTION("JZ4740 SoC HWMON driver"); | 217 | MODULE_DESCRIPTION("JZ4740 SoC HWMON driver"); |
| 228 | MODULE_AUTHOR("Lars-Peter Clausen <lars@metafoo.de>"); | 218 | MODULE_AUTHOR("Lars-Peter Clausen <lars@metafoo.de>"); |
diff --git a/drivers/hwmon/ntc_thermistor.c b/drivers/hwmon/ntc_thermistor.c index eab11615dced..9b382ec2c3bd 100644 --- a/drivers/hwmon/ntc_thermistor.c +++ b/drivers/hwmon/ntc_thermistor.c | |||
| @@ -432,19 +432,7 @@ static struct platform_driver ntc_thermistor_driver = { | |||
| 432 | .id_table = ntc_thermistor_id, | 432 | .id_table = ntc_thermistor_id, |
| 433 | }; | 433 | }; |
| 434 | 434 | ||
| 435 | static int __init ntc_thermistor_init(void) | 435 | module_platform_driver(ntc_thermistor_driver); |
| 436 | { | ||
| 437 | return platform_driver_register(&ntc_thermistor_driver); | ||
| 438 | } | ||
| 439 | |||
| 440 | module_init(ntc_thermistor_init); | ||
| 441 | |||
| 442 | static void __exit ntc_thermistor_cleanup(void) | ||
| 443 | { | ||
| 444 | platform_driver_unregister(&ntc_thermistor_driver); | ||
| 445 | } | ||
| 446 | |||
| 447 | module_exit(ntc_thermistor_cleanup); | ||
| 448 | 436 | ||
| 449 | MODULE_DESCRIPTION("NTC Thermistor Driver"); | 437 | MODULE_DESCRIPTION("NTC Thermistor Driver"); |
| 450 | MODULE_AUTHOR("MyungJoo Ham <myungjoo.ham@samsung.com>"); | 438 | MODULE_AUTHOR("MyungJoo Ham <myungjoo.ham@samsung.com>"); |
diff --git a/drivers/hwmon/s3c-hwmon.c b/drivers/hwmon/s3c-hwmon.c index b39f52e2752a..f6c26d19f521 100644 --- a/drivers/hwmon/s3c-hwmon.c +++ b/drivers/hwmon/s3c-hwmon.c | |||
| @@ -393,18 +393,7 @@ static struct platform_driver s3c_hwmon_driver = { | |||
| 393 | .remove = __devexit_p(s3c_hwmon_remove), | 393 | .remove = __devexit_p(s3c_hwmon_remove), |
| 394 | }; | 394 | }; |
| 395 | 395 | ||
| 396 | static int __init s3c_hwmon_init(void) | 396 | module_platform_driver(s3c_hwmon_driver); |
| 397 | { | ||
| 398 | return platform_driver_register(&s3c_hwmon_driver); | ||
| 399 | } | ||
| 400 | |||
| 401 | static void __exit s3c_hwmon_exit(void) | ||
| 402 | { | ||
| 403 | platform_driver_unregister(&s3c_hwmon_driver); | ||
| 404 | } | ||
| 405 | |||
| 406 | module_init(s3c_hwmon_init); | ||
| 407 | module_exit(s3c_hwmon_exit); | ||
| 408 | 397 | ||
| 409 | MODULE_AUTHOR("Ben Dooks <ben@simtec.co.uk>"); | 398 | MODULE_AUTHOR("Ben Dooks <ben@simtec.co.uk>"); |
| 410 | MODULE_DESCRIPTION("S3C ADC HWMon driver"); | 399 | MODULE_DESCRIPTION("S3C ADC HWMon driver"); |
diff --git a/drivers/hwmon/sch5627.c b/drivers/hwmon/sch5627.c index e3b5c6039c25..79b6dabe3161 100644 --- a/drivers/hwmon/sch5627.c +++ b/drivers/hwmon/sch5627.c | |||
| @@ -590,19 +590,8 @@ static struct platform_driver sch5627_driver = { | |||
| 590 | .remove = sch5627_remove, | 590 | .remove = sch5627_remove, |
| 591 | }; | 591 | }; |
| 592 | 592 | ||
| 593 | static int __init sch5627_init(void) | 593 | module_platform_driver(sch5627_driver); |
| 594 | { | ||
| 595 | return platform_driver_register(&sch5627_driver); | ||
| 596 | } | ||
| 597 | |||
| 598 | static void __exit sch5627_exit(void) | ||
| 599 | { | ||
| 600 | platform_driver_unregister(&sch5627_driver); | ||
| 601 | } | ||
| 602 | 594 | ||
| 603 | MODULE_DESCRIPTION("SMSC SCH5627 Hardware Monitoring Driver"); | 595 | MODULE_DESCRIPTION("SMSC SCH5627 Hardware Monitoring Driver"); |
| 604 | MODULE_AUTHOR("Hans de Goede <hdegoede@redhat.com>"); | 596 | MODULE_AUTHOR("Hans de Goede <hdegoede@redhat.com>"); |
| 605 | MODULE_LICENSE("GPL"); | 597 | MODULE_LICENSE("GPL"); |
| 606 | |||
| 607 | module_init(sch5627_init); | ||
| 608 | module_exit(sch5627_exit); | ||
diff --git a/drivers/hwmon/sch5636.c b/drivers/hwmon/sch5636.c index 244407aa79fc..9d5236fb09b4 100644 --- a/drivers/hwmon/sch5636.c +++ b/drivers/hwmon/sch5636.c | |||
| @@ -521,19 +521,8 @@ static struct platform_driver sch5636_driver = { | |||
| 521 | .remove = sch5636_remove, | 521 | .remove = sch5636_remove, |
| 522 | }; | 522 | }; |
| 523 | 523 | ||
| 524 | static int __init sch5636_init(void) | 524 | module_platform_driver(sch5636_driver); |
| 525 | { | ||
| 526 | return platform_driver_register(&sch5636_driver); | ||
| 527 | } | ||
| 528 | |||
| 529 | static void __exit sch5636_exit(void) | ||
| 530 | { | ||
| 531 | platform_driver_unregister(&sch5636_driver); | ||
| 532 | } | ||
| 533 | 525 | ||
| 534 | MODULE_DESCRIPTION("SMSC SCH5636 Hardware Monitoring Driver"); | 526 | MODULE_DESCRIPTION("SMSC SCH5636 Hardware Monitoring Driver"); |
| 535 | MODULE_AUTHOR("Hans de Goede <hdegoede@redhat.com>"); | 527 | MODULE_AUTHOR("Hans de Goede <hdegoede@redhat.com>"); |
| 536 | MODULE_LICENSE("GPL"); | 528 | MODULE_LICENSE("GPL"); |
| 537 | |||
| 538 | module_init(sch5636_init); | ||
| 539 | module_exit(sch5636_exit); | ||
diff --git a/drivers/hwmon/twl4030-madc-hwmon.c b/drivers/hwmon/twl4030-madc-hwmon.c index 57240740b161..0018c7dd0097 100644 --- a/drivers/hwmon/twl4030-madc-hwmon.c +++ b/drivers/hwmon/twl4030-madc-hwmon.c | |||
| @@ -136,19 +136,7 @@ static struct platform_driver twl4030_madc_hwmon_driver = { | |||
| 136 | }, | 136 | }, |
| 137 | }; | 137 | }; |
| 138 | 138 | ||
| 139 | static int __init twl4030_madc_hwmon_init(void) | 139 | module_platform_driver(twl4030_madc_hwmon_driver); |
| 140 | { | ||
| 141 | return platform_driver_register(&twl4030_madc_hwmon_driver); | ||
| 142 | } | ||
| 143 | |||
| 144 | module_init(twl4030_madc_hwmon_init); | ||
| 145 | |||
| 146 | static void __exit twl4030_madc_hwmon_exit(void) | ||
| 147 | { | ||
| 148 | platform_driver_unregister(&twl4030_madc_hwmon_driver); | ||
| 149 | } | ||
| 150 | |||
| 151 | module_exit(twl4030_madc_hwmon_exit); | ||
| 152 | 140 | ||
| 153 | MODULE_DESCRIPTION("TWL4030 ADC Hwmon driver"); | 141 | MODULE_DESCRIPTION("TWL4030 ADC Hwmon driver"); |
| 154 | MODULE_LICENSE("GPL"); | 142 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/hwmon/ultra45_env.c b/drivers/hwmon/ultra45_env.c index 3cd07bf42dca..b9a87e89bab4 100644 --- a/drivers/hwmon/ultra45_env.c +++ b/drivers/hwmon/ultra45_env.c | |||
| @@ -309,15 +309,4 @@ static struct platform_driver env_driver = { | |||
| 309 | .remove = __devexit_p(env_remove), | 309 | .remove = __devexit_p(env_remove), |
| 310 | }; | 310 | }; |
| 311 | 311 | ||
| 312 | static int __init env_init(void) | 312 | module_platform_driver(env_driver); |
| 313 | { | ||
| 314 | return platform_driver_register(&env_driver); | ||
| 315 | } | ||
| 316 | |||
| 317 | static void __exit env_exit(void) | ||
| 318 | { | ||
| 319 | platform_driver_unregister(&env_driver); | ||
| 320 | } | ||
| 321 | |||
| 322 | module_init(env_init); | ||
| 323 | module_exit(env_exit); | ||
diff --git a/drivers/hwmon/wm831x-hwmon.c b/drivers/hwmon/wm831x-hwmon.c index 97b1f834a471..9b598ed26020 100644 --- a/drivers/hwmon/wm831x-hwmon.c +++ b/drivers/hwmon/wm831x-hwmon.c | |||
| @@ -209,17 +209,7 @@ static struct platform_driver wm831x_hwmon_driver = { | |||
| 209 | }, | 209 | }, |
| 210 | }; | 210 | }; |
| 211 | 211 | ||
| 212 | static int __init wm831x_hwmon_init(void) | 212 | module_platform_driver(wm831x_hwmon_driver); |
| 213 | { | ||
| 214 | return platform_driver_register(&wm831x_hwmon_driver); | ||
| 215 | } | ||
| 216 | module_init(wm831x_hwmon_init); | ||
| 217 | |||
| 218 | static void __exit wm831x_hwmon_exit(void) | ||
| 219 | { | ||
| 220 | platform_driver_unregister(&wm831x_hwmon_driver); | ||
| 221 | } | ||
| 222 | module_exit(wm831x_hwmon_exit); | ||
| 223 | 213 | ||
| 224 | MODULE_AUTHOR("Mark Brown <broonie@opensource.wolfsonmicro.com>"); | 214 | MODULE_AUTHOR("Mark Brown <broonie@opensource.wolfsonmicro.com>"); |
| 225 | MODULE_DESCRIPTION("WM831x Hardware Monitoring"); | 215 | MODULE_DESCRIPTION("WM831x Hardware Monitoring"); |
diff --git a/drivers/hwmon/wm8350-hwmon.c b/drivers/hwmon/wm8350-hwmon.c index 13290595ca86..3ff67edbdc44 100644 --- a/drivers/hwmon/wm8350-hwmon.c +++ b/drivers/hwmon/wm8350-hwmon.c | |||
| @@ -133,17 +133,7 @@ static struct platform_driver wm8350_hwmon_driver = { | |||
| 133 | }, | 133 | }, |
| 134 | }; | 134 | }; |
| 135 | 135 | ||
| 136 | static int __init wm8350_hwmon_init(void) | 136 | module_platform_driver(wm8350_hwmon_driver); |
| 137 | { | ||
| 138 | return platform_driver_register(&wm8350_hwmon_driver); | ||
| 139 | } | ||
| 140 | module_init(wm8350_hwmon_init); | ||
| 141 | |||
| 142 | static void __exit wm8350_hwmon_exit(void) | ||
| 143 | { | ||
| 144 | platform_driver_unregister(&wm8350_hwmon_driver); | ||
| 145 | } | ||
| 146 | module_exit(wm8350_hwmon_exit); | ||
| 147 | 137 | ||
| 148 | MODULE_AUTHOR("Mark Brown <broonie@opensource.wolfsonmicro.com>"); | 138 | MODULE_AUTHOR("Mark Brown <broonie@opensource.wolfsonmicro.com>"); |
| 149 | MODULE_DESCRIPTION("WM8350 Hardware Monitoring"); | 139 | MODULE_DESCRIPTION("WM8350 Hardware Monitoring"); |
diff --git a/drivers/i2c/busses/i2c-nuc900.c b/drivers/i2c/busses/i2c-nuc900.c index 835e47b39bc2..03b615778887 100644 --- a/drivers/i2c/busses/i2c-nuc900.c +++ b/drivers/i2c/busses/i2c-nuc900.c | |||
| @@ -593,7 +593,7 @@ static int __devinit nuc900_i2c_probe(struct platform_device *pdev) | |||
| 593 | i2c->adap.algo_data = i2c; | 593 | i2c->adap.algo_data = i2c; |
| 594 | i2c->adap.dev.parent = &pdev->dev; | 594 | i2c->adap.dev.parent = &pdev->dev; |
| 595 | 595 | ||
| 596 | mfp_set_groupg(&pdev->dev); | 596 | mfp_set_groupg(&pdev->dev, NULL); |
| 597 | 597 | ||
| 598 | clk_get_rate(i2c->clk); | 598 | clk_get_rate(i2c->clk); |
| 599 | 599 | ||
diff --git a/drivers/infiniband/core/addr.c b/drivers/infiniband/core/addr.c index 691276bafd78..e9cf51b1343b 100644 --- a/drivers/infiniband/core/addr.c +++ b/drivers/infiniband/core/addr.c | |||
| @@ -216,7 +216,9 @@ static int addr4_resolve(struct sockaddr_in *src_in, | |||
| 216 | 216 | ||
| 217 | neigh = neigh_lookup(&arp_tbl, &rt->rt_gateway, rt->dst.dev); | 217 | neigh = neigh_lookup(&arp_tbl, &rt->rt_gateway, rt->dst.dev); |
| 218 | if (!neigh || !(neigh->nud_state & NUD_VALID)) { | 218 | if (!neigh || !(neigh->nud_state & NUD_VALID)) { |
| 219 | rcu_read_lock(); | ||
| 219 | neigh_event_send(dst_get_neighbour(&rt->dst), NULL); | 220 | neigh_event_send(dst_get_neighbour(&rt->dst), NULL); |
| 221 | rcu_read_unlock(); | ||
| 220 | ret = -ENODATA; | 222 | ret = -ENODATA; |
| 221 | if (neigh) | 223 | if (neigh) |
| 222 | goto release; | 224 | goto release; |
| @@ -274,15 +276,16 @@ static int addr6_resolve(struct sockaddr_in6 *src_in, | |||
| 274 | goto put; | 276 | goto put; |
| 275 | } | 277 | } |
| 276 | 278 | ||
| 279 | rcu_read_lock(); | ||
| 277 | neigh = dst_get_neighbour(dst); | 280 | neigh = dst_get_neighbour(dst); |
| 278 | if (!neigh || !(neigh->nud_state & NUD_VALID)) { | 281 | if (!neigh || !(neigh->nud_state & NUD_VALID)) { |
| 279 | if (neigh) | 282 | if (neigh) |
| 280 | neigh_event_send(neigh, NULL); | 283 | neigh_event_send(neigh, NULL); |
| 281 | ret = -ENODATA; | 284 | ret = -ENODATA; |
| 282 | goto put; | 285 | } else { |
| 286 | ret = rdma_copy_addr(addr, dst->dev, neigh->ha); | ||
| 283 | } | 287 | } |
| 284 | 288 | rcu_read_unlock(); | |
| 285 | ret = rdma_copy_addr(addr, dst->dev, neigh->ha); | ||
| 286 | put: | 289 | put: |
| 287 | dst_release(dst); | 290 | dst_release(dst); |
| 288 | return ret; | 291 | return ret; |
diff --git a/drivers/infiniband/hw/cxgb3/iwch_cm.c b/drivers/infiniband/hw/cxgb3/iwch_cm.c index de6d0774e609..c88b12beef25 100644 --- a/drivers/infiniband/hw/cxgb3/iwch_cm.c +++ b/drivers/infiniband/hw/cxgb3/iwch_cm.c | |||
| @@ -1375,8 +1375,10 @@ static int pass_accept_req(struct t3cdev *tdev, struct sk_buff *skb, void *ctx) | |||
| 1375 | goto reject; | 1375 | goto reject; |
| 1376 | } | 1376 | } |
| 1377 | dst = &rt->dst; | 1377 | dst = &rt->dst; |
| 1378 | rcu_read_lock(); | ||
| 1378 | neigh = dst_get_neighbour(dst); | 1379 | neigh = dst_get_neighbour(dst); |
| 1379 | l2t = t3_l2t_get(tdev, neigh, neigh->dev); | 1380 | l2t = t3_l2t_get(tdev, neigh, neigh->dev); |
| 1381 | rcu_read_unlock(); | ||
| 1380 | if (!l2t) { | 1382 | if (!l2t) { |
| 1381 | printk(KERN_ERR MOD "%s - failed to allocate l2t entry!\n", | 1383 | printk(KERN_ERR MOD "%s - failed to allocate l2t entry!\n", |
| 1382 | __func__); | 1384 | __func__); |
| @@ -1946,10 +1948,12 @@ int iwch_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param) | |||
| 1946 | } | 1948 | } |
| 1947 | ep->dst = &rt->dst; | 1949 | ep->dst = &rt->dst; |
| 1948 | 1950 | ||
| 1951 | rcu_read_lock(); | ||
| 1949 | neigh = dst_get_neighbour(ep->dst); | 1952 | neigh = dst_get_neighbour(ep->dst); |
| 1950 | 1953 | ||
| 1951 | /* get a l2t entry */ | 1954 | /* get a l2t entry */ |
| 1952 | ep->l2t = t3_l2t_get(ep->com.tdev, neigh, neigh->dev); | 1955 | ep->l2t = t3_l2t_get(ep->com.tdev, neigh, neigh->dev); |
| 1956 | rcu_read_unlock(); | ||
| 1953 | if (!ep->l2t) { | 1957 | if (!ep->l2t) { |
| 1954 | printk(KERN_ERR MOD "%s - cannot alloc l2e.\n", __func__); | 1958 | printk(KERN_ERR MOD "%s - cannot alloc l2e.\n", __func__); |
| 1955 | err = -ENOMEM; | 1959 | err = -ENOMEM; |
diff --git a/drivers/infiniband/hw/cxgb4/cm.c b/drivers/infiniband/hw/cxgb4/cm.c index b36cdac9c558..0747004313ad 100644 --- a/drivers/infiniband/hw/cxgb4/cm.c +++ b/drivers/infiniband/hw/cxgb4/cm.c | |||
| @@ -542,8 +542,10 @@ static void send_mpa_req(struct c4iw_ep *ep, struct sk_buff *skb, | |||
| 542 | (mpa_rev_to_use == 2 ? MPA_ENHANCED_RDMA_CONN : 0); | 542 | (mpa_rev_to_use == 2 ? MPA_ENHANCED_RDMA_CONN : 0); |
| 543 | mpa->private_data_size = htons(ep->plen); | 543 | mpa->private_data_size = htons(ep->plen); |
| 544 | mpa->revision = mpa_rev_to_use; | 544 | mpa->revision = mpa_rev_to_use; |
| 545 | if (mpa_rev_to_use == 1) | 545 | if (mpa_rev_to_use == 1) { |
| 546 | ep->tried_with_mpa_v1 = 1; | 546 | ep->tried_with_mpa_v1 = 1; |
| 547 | ep->retry_with_mpa_v1 = 0; | ||
| 548 | } | ||
| 547 | 549 | ||
| 548 | if (mpa_rev_to_use == 2) { | 550 | if (mpa_rev_to_use == 2) { |
| 549 | mpa->private_data_size += | 551 | mpa->private_data_size += |
| @@ -1594,6 +1596,7 @@ static int pass_accept_req(struct c4iw_dev *dev, struct sk_buff *skb) | |||
| 1594 | goto reject; | 1596 | goto reject; |
| 1595 | } | 1597 | } |
| 1596 | dst = &rt->dst; | 1598 | dst = &rt->dst; |
| 1599 | rcu_read_lock(); | ||
| 1597 | neigh = dst_get_neighbour(dst); | 1600 | neigh = dst_get_neighbour(dst); |
| 1598 | if (neigh->dev->flags & IFF_LOOPBACK) { | 1601 | if (neigh->dev->flags & IFF_LOOPBACK) { |
| 1599 | pdev = ip_dev_find(&init_net, peer_ip); | 1602 | pdev = ip_dev_find(&init_net, peer_ip); |
| @@ -1620,6 +1623,7 @@ static int pass_accept_req(struct c4iw_dev *dev, struct sk_buff *skb) | |||
| 1620 | rss_qid = dev->rdev.lldi.rxq_ids[ | 1623 | rss_qid = dev->rdev.lldi.rxq_ids[ |
| 1621 | cxgb4_port_idx(neigh->dev) * step]; | 1624 | cxgb4_port_idx(neigh->dev) * step]; |
| 1622 | } | 1625 | } |
| 1626 | rcu_read_unlock(); | ||
| 1623 | if (!l2t) { | 1627 | if (!l2t) { |
| 1624 | printk(KERN_ERR MOD "%s - failed to allocate l2t entry!\n", | 1628 | printk(KERN_ERR MOD "%s - failed to allocate l2t entry!\n", |
| 1625 | __func__); | 1629 | __func__); |
| @@ -1820,6 +1824,7 @@ static int c4iw_reconnect(struct c4iw_ep *ep) | |||
| 1820 | } | 1824 | } |
| 1821 | ep->dst = &rt->dst; | 1825 | ep->dst = &rt->dst; |
| 1822 | 1826 | ||
| 1827 | rcu_read_lock(); | ||
| 1823 | neigh = dst_get_neighbour(ep->dst); | 1828 | neigh = dst_get_neighbour(ep->dst); |
| 1824 | 1829 | ||
| 1825 | /* get a l2t entry */ | 1830 | /* get a l2t entry */ |
| @@ -1856,6 +1861,7 @@ static int c4iw_reconnect(struct c4iw_ep *ep) | |||
| 1856 | ep->rss_qid = ep->com.dev->rdev.lldi.rxq_ids[ | 1861 | ep->rss_qid = ep->com.dev->rdev.lldi.rxq_ids[ |
| 1857 | cxgb4_port_idx(neigh->dev) * step]; | 1862 | cxgb4_port_idx(neigh->dev) * step]; |
| 1858 | } | 1863 | } |
| 1864 | rcu_read_unlock(); | ||
| 1859 | if (!ep->l2t) { | 1865 | if (!ep->l2t) { |
| 1860 | printk(KERN_ERR MOD "%s - cannot alloc l2e.\n", __func__); | 1866 | printk(KERN_ERR MOD "%s - cannot alloc l2e.\n", __func__); |
| 1861 | err = -ENOMEM; | 1867 | err = -ENOMEM; |
| @@ -2301,6 +2307,7 @@ int c4iw_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param) | |||
| 2301 | } | 2307 | } |
| 2302 | ep->dst = &rt->dst; | 2308 | ep->dst = &rt->dst; |
| 2303 | 2309 | ||
| 2310 | rcu_read_lock(); | ||
| 2304 | neigh = dst_get_neighbour(ep->dst); | 2311 | neigh = dst_get_neighbour(ep->dst); |
| 2305 | 2312 | ||
| 2306 | /* get a l2t entry */ | 2313 | /* get a l2t entry */ |
| @@ -2339,6 +2346,7 @@ int c4iw_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param) | |||
| 2339 | ep->retry_with_mpa_v1 = 0; | 2346 | ep->retry_with_mpa_v1 = 0; |
| 2340 | ep->tried_with_mpa_v1 = 0; | 2347 | ep->tried_with_mpa_v1 = 0; |
| 2341 | } | 2348 | } |
| 2349 | rcu_read_unlock(); | ||
| 2342 | if (!ep->l2t) { | 2350 | if (!ep->l2t) { |
| 2343 | printk(KERN_ERR MOD "%s - cannot alloc l2e.\n", __func__); | 2351 | printk(KERN_ERR MOD "%s - cannot alloc l2e.\n", __func__); |
| 2344 | err = -ENOMEM; | 2352 | err = -ENOMEM; |
diff --git a/drivers/infiniband/hw/cxgb4/cq.c b/drivers/infiniband/hw/cxgb4/cq.c index f35a935267e7..0f1607c8325a 100644 --- a/drivers/infiniband/hw/cxgb4/cq.c +++ b/drivers/infiniband/hw/cxgb4/cq.c | |||
| @@ -311,7 +311,7 @@ void c4iw_count_rcqes(struct t4_cq *cq, struct t4_wq *wq, int *count) | |||
| 311 | while (ptr != cq->sw_pidx) { | 311 | while (ptr != cq->sw_pidx) { |
| 312 | cqe = &cq->sw_queue[ptr]; | 312 | cqe = &cq->sw_queue[ptr]; |
| 313 | if (RQ_TYPE(cqe) && (CQE_OPCODE(cqe) != FW_RI_READ_RESP) && | 313 | if (RQ_TYPE(cqe) && (CQE_OPCODE(cqe) != FW_RI_READ_RESP) && |
| 314 | (CQE_QPID(cqe) == wq->rq.qid) && cqe_completes_wr(cqe, wq)) | 314 | (CQE_QPID(cqe) == wq->sq.qid) && cqe_completes_wr(cqe, wq)) |
| 315 | (*count)++; | 315 | (*count)++; |
| 316 | if (++ptr == cq->size) | 316 | if (++ptr == cq->size) |
| 317 | ptr = 0; | 317 | ptr = 0; |
diff --git a/drivers/infiniband/hw/nes/nes_cm.c b/drivers/infiniband/hw/nes/nes_cm.c index dfce9ea98a39..0a52d72371ee 100644 --- a/drivers/infiniband/hw/nes/nes_cm.c +++ b/drivers/infiniband/hw/nes/nes_cm.c | |||
| @@ -1377,9 +1377,11 @@ static int nes_addr_resolve_neigh(struct nes_vnic *nesvnic, u32 dst_ip, int arpi | |||
| 1377 | neigh_release(neigh); | 1377 | neigh_release(neigh); |
| 1378 | } | 1378 | } |
| 1379 | 1379 | ||
| 1380 | if ((neigh == NULL) || (!(neigh->nud_state & NUD_VALID))) | 1380 | if ((neigh == NULL) || (!(neigh->nud_state & NUD_VALID))) { |
| 1381 | rcu_read_lock(); | ||
| 1381 | neigh_event_send(dst_get_neighbour(&rt->dst), NULL); | 1382 | neigh_event_send(dst_get_neighbour(&rt->dst), NULL); |
| 1382 | 1383 | rcu_read_unlock(); | |
| 1384 | } | ||
| 1383 | ip_rt_put(rt); | 1385 | ip_rt_put(rt); |
| 1384 | return rc; | 1386 | return rc; |
| 1385 | } | 1387 | } |
diff --git a/drivers/infiniband/hw/qib/qib_iba7322.c b/drivers/infiniband/hw/qib/qib_iba7322.c index 5bd2162b95dc..1d5895941e19 100644 --- a/drivers/infiniband/hw/qib/qib_iba7322.c +++ b/drivers/infiniband/hw/qib/qib_iba7322.c | |||
| @@ -2307,19 +2307,11 @@ static int qib_7322_bringup_serdes(struct qib_pportdata *ppd) | |||
| 2307 | SYM_LSB(IBCCtrlA_0, MaxPktLen); | 2307 | SYM_LSB(IBCCtrlA_0, MaxPktLen); |
| 2308 | ppd->cpspec->ibcctrl_a = ibc; /* without linkcmd or linkinitcmd! */ | 2308 | ppd->cpspec->ibcctrl_a = ibc; /* without linkcmd or linkinitcmd! */ |
| 2309 | 2309 | ||
| 2310 | /* initially come up waiting for TS1, without sending anything. */ | ||
| 2311 | val = ppd->cpspec->ibcctrl_a | (QLOGIC_IB_IBCC_LINKINITCMD_DISABLE << | ||
| 2312 | QLOGIC_IB_IBCC_LINKINITCMD_SHIFT); | ||
| 2313 | |||
| 2314 | ppd->cpspec->ibcctrl_a = val; | ||
| 2315 | /* | 2310 | /* |
| 2316 | * Reset the PCS interface to the serdes (and also ibc, which is still | 2311 | * Reset the PCS interface to the serdes (and also ibc, which is still |
| 2317 | * in reset from above). Writes new value of ibcctrl_a as last step. | 2312 | * in reset from above). Writes new value of ibcctrl_a as last step. |
| 2318 | */ | 2313 | */ |
| 2319 | qib_7322_mini_pcs_reset(ppd); | 2314 | qib_7322_mini_pcs_reset(ppd); |
| 2320 | qib_write_kreg(dd, kr_scratch, 0ULL); | ||
| 2321 | /* clear the linkinit cmds */ | ||
| 2322 | ppd->cpspec->ibcctrl_a &= ~SYM_MASK(IBCCtrlA_0, LinkInitCmd); | ||
| 2323 | 2315 | ||
| 2324 | if (!ppd->cpspec->ibcctrl_b) { | 2316 | if (!ppd->cpspec->ibcctrl_b) { |
| 2325 | unsigned lse = ppd->link_speed_enabled; | 2317 | unsigned lse = ppd->link_speed_enabled; |
| @@ -2385,6 +2377,14 @@ static int qib_7322_bringup_serdes(struct qib_pportdata *ppd) | |||
| 2385 | ppd->cpspec->ibcctrl_a |= SYM_MASK(IBCCtrlA_0, IBLinkEn); | 2377 | ppd->cpspec->ibcctrl_a |= SYM_MASK(IBCCtrlA_0, IBLinkEn); |
| 2386 | set_vls(ppd); | 2378 | set_vls(ppd); |
| 2387 | 2379 | ||
| 2380 | /* initially come up DISABLED, without sending anything. */ | ||
| 2381 | val = ppd->cpspec->ibcctrl_a | (QLOGIC_IB_IBCC_LINKINITCMD_DISABLE << | ||
| 2382 | QLOGIC_IB_IBCC_LINKINITCMD_SHIFT); | ||
| 2383 | qib_write_kreg_port(ppd, krp_ibcctrl_a, val); | ||
| 2384 | qib_write_kreg(dd, kr_scratch, 0ULL); | ||
| 2385 | /* clear the linkinit cmds */ | ||
| 2386 | ppd->cpspec->ibcctrl_a = val & ~SYM_MASK(IBCCtrlA_0, LinkInitCmd); | ||
| 2387 | |||
| 2388 | /* be paranoid against later code motion, etc. */ | 2388 | /* be paranoid against later code motion, etc. */ |
| 2389 | spin_lock_irqsave(&dd->cspec->rcvmod_lock, flags); | 2389 | spin_lock_irqsave(&dd->cspec->rcvmod_lock, flags); |
| 2390 | ppd->p_rcvctrl |= SYM_MASK(RcvCtrl_0, RcvIBPortEnable); | 2390 | ppd->p_rcvctrl |= SYM_MASK(RcvCtrl_0, RcvIBPortEnable); |
| @@ -5241,7 +5241,7 @@ static int qib_7322_ib_updown(struct qib_pportdata *ppd, int ibup, u64 ibcs) | |||
| 5241 | off */ | 5241 | off */ |
| 5242 | if (ppd->dd->flags & QIB_HAS_QSFP) { | 5242 | if (ppd->dd->flags & QIB_HAS_QSFP) { |
| 5243 | qd->t_insert = get_jiffies_64(); | 5243 | qd->t_insert = get_jiffies_64(); |
| 5244 | schedule_work(&qd->work); | 5244 | queue_work(ib_wq, &qd->work); |
| 5245 | } | 5245 | } |
| 5246 | spin_lock_irqsave(&ppd->sdma_lock, flags); | 5246 | spin_lock_irqsave(&ppd->sdma_lock, flags); |
| 5247 | if (__qib_sdma_running(ppd)) | 5247 | if (__qib_sdma_running(ppd)) |
diff --git a/drivers/infiniband/hw/qib/qib_qsfp.c b/drivers/infiniband/hw/qib/qib_qsfp.c index e06c4ed383f1..fa71b1e666c5 100644 --- a/drivers/infiniband/hw/qib/qib_qsfp.c +++ b/drivers/infiniband/hw/qib/qib_qsfp.c | |||
| @@ -480,18 +480,6 @@ void qib_qsfp_init(struct qib_qsfp_data *qd, | |||
| 480 | udelay(20); /* Generous RST dwell */ | 480 | udelay(20); /* Generous RST dwell */ |
| 481 | 481 | ||
| 482 | dd->f_gpio_mod(dd, mask, mask, mask); | 482 | dd->f_gpio_mod(dd, mask, mask, mask); |
| 483 | /* Spec says module can take up to two seconds! */ | ||
| 484 | mask = QSFP_GPIO_MOD_PRS_N; | ||
| 485 | if (qd->ppd->hw_pidx) | ||
| 486 | mask <<= QSFP_GPIO_PORT2_SHIFT; | ||
| 487 | |||
| 488 | /* Do not try to wait here. Better to let event handle it */ | ||
| 489 | if (!qib_qsfp_mod_present(qd->ppd)) | ||
| 490 | goto bail; | ||
| 491 | /* We see a module, but it may be unwise to look yet. Just schedule */ | ||
| 492 | qd->t_insert = get_jiffies_64(); | ||
| 493 | queue_work(ib_wq, &qd->work); | ||
| 494 | bail: | ||
| 495 | return; | 483 | return; |
| 496 | } | 484 | } |
| 497 | 485 | ||
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_ib.c b/drivers/infiniband/ulp/ipoib/ipoib_ib.c index 0ef9af94997d..4115be54ba3b 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_ib.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_ib.c | |||
| @@ -57,21 +57,24 @@ struct ipoib_ah *ipoib_create_ah(struct net_device *dev, | |||
| 57 | struct ib_pd *pd, struct ib_ah_attr *attr) | 57 | struct ib_pd *pd, struct ib_ah_attr *attr) |
| 58 | { | 58 | { |
| 59 | struct ipoib_ah *ah; | 59 | struct ipoib_ah *ah; |
| 60 | struct ib_ah *vah; | ||
| 60 | 61 | ||
| 61 | ah = kmalloc(sizeof *ah, GFP_KERNEL); | 62 | ah = kmalloc(sizeof *ah, GFP_KERNEL); |
| 62 | if (!ah) | 63 | if (!ah) |
| 63 | return NULL; | 64 | return ERR_PTR(-ENOMEM); |
| 64 | 65 | ||
| 65 | ah->dev = dev; | 66 | ah->dev = dev; |
| 66 | ah->last_send = 0; | 67 | ah->last_send = 0; |
| 67 | kref_init(&ah->ref); | 68 | kref_init(&ah->ref); |
| 68 | 69 | ||
| 69 | ah->ah = ib_create_ah(pd, attr); | 70 | vah = ib_create_ah(pd, attr); |
| 70 | if (IS_ERR(ah->ah)) { | 71 | if (IS_ERR(vah)) { |
| 71 | kfree(ah); | 72 | kfree(ah); |
| 72 | ah = NULL; | 73 | ah = (struct ipoib_ah *)vah; |
| 73 | } else | 74 | } else { |
| 75 | ah->ah = vah; | ||
| 74 | ipoib_dbg(netdev_priv(dev), "Created ah %p\n", ah->ah); | 76 | ipoib_dbg(netdev_priv(dev), "Created ah %p\n", ah->ah); |
| 77 | } | ||
| 75 | 78 | ||
| 76 | return ah; | 79 | return ah; |
| 77 | } | 80 | } |
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c index 7567b6000230..83695b48b010 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_main.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c | |||
| @@ -432,7 +432,7 @@ static void path_rec_completion(int status, | |||
| 432 | 432 | ||
| 433 | spin_lock_irqsave(&priv->lock, flags); | 433 | spin_lock_irqsave(&priv->lock, flags); |
| 434 | 434 | ||
| 435 | if (ah) { | 435 | if (!IS_ERR_OR_NULL(ah)) { |
| 436 | path->pathrec = *pathrec; | 436 | path->pathrec = *pathrec; |
| 437 | 437 | ||
| 438 | old_ah = path->ah; | 438 | old_ah = path->ah; |
| @@ -555,6 +555,7 @@ static int path_rec_start(struct net_device *dev, | |||
| 555 | return 0; | 555 | return 0; |
| 556 | } | 556 | } |
| 557 | 557 | ||
| 558 | /* called with rcu_read_lock */ | ||
| 558 | static void neigh_add_path(struct sk_buff *skb, struct net_device *dev) | 559 | static void neigh_add_path(struct sk_buff *skb, struct net_device *dev) |
| 559 | { | 560 | { |
| 560 | struct ipoib_dev_priv *priv = netdev_priv(dev); | 561 | struct ipoib_dev_priv *priv = netdev_priv(dev); |
| @@ -636,6 +637,7 @@ err_drop: | |||
| 636 | spin_unlock_irqrestore(&priv->lock, flags); | 637 | spin_unlock_irqrestore(&priv->lock, flags); |
| 637 | } | 638 | } |
| 638 | 639 | ||
| 640 | /* called with rcu_read_lock */ | ||
| 639 | static void ipoib_path_lookup(struct sk_buff *skb, struct net_device *dev) | 641 | static void ipoib_path_lookup(struct sk_buff *skb, struct net_device *dev) |
| 640 | { | 642 | { |
| 641 | struct ipoib_dev_priv *priv = netdev_priv(skb->dev); | 643 | struct ipoib_dev_priv *priv = netdev_priv(skb->dev); |
| @@ -720,13 +722,14 @@ static int ipoib_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
| 720 | struct neighbour *n = NULL; | 722 | struct neighbour *n = NULL; |
| 721 | unsigned long flags; | 723 | unsigned long flags; |
| 722 | 724 | ||
| 725 | rcu_read_lock(); | ||
| 723 | if (likely(skb_dst(skb))) | 726 | if (likely(skb_dst(skb))) |
| 724 | n = dst_get_neighbour(skb_dst(skb)); | 727 | n = dst_get_neighbour(skb_dst(skb)); |
| 725 | 728 | ||
| 726 | if (likely(n)) { | 729 | if (likely(n)) { |
| 727 | if (unlikely(!*to_ipoib_neigh(n))) { | 730 | if (unlikely(!*to_ipoib_neigh(n))) { |
| 728 | ipoib_path_lookup(skb, dev); | 731 | ipoib_path_lookup(skb, dev); |
| 729 | return NETDEV_TX_OK; | 732 | goto unlock; |
| 730 | } | 733 | } |
| 731 | 734 | ||
| 732 | neigh = *to_ipoib_neigh(n); | 735 | neigh = *to_ipoib_neigh(n); |
| @@ -749,17 +752,17 @@ static int ipoib_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
| 749 | ipoib_neigh_free(dev, neigh); | 752 | ipoib_neigh_free(dev, neigh); |
| 750 | spin_unlock_irqrestore(&priv->lock, flags); | 753 | spin_unlock_irqrestore(&priv->lock, flags); |
| 751 | ipoib_path_lookup(skb, dev); | 754 | ipoib_path_lookup(skb, dev); |
| 752 | return NETDEV_TX_OK; | 755 | goto unlock; |
| 753 | } | 756 | } |
| 754 | 757 | ||
| 755 | if (ipoib_cm_get(neigh)) { | 758 | if (ipoib_cm_get(neigh)) { |
| 756 | if (ipoib_cm_up(neigh)) { | 759 | if (ipoib_cm_up(neigh)) { |
| 757 | ipoib_cm_send(dev, skb, ipoib_cm_get(neigh)); | 760 | ipoib_cm_send(dev, skb, ipoib_cm_get(neigh)); |
| 758 | return NETDEV_TX_OK; | 761 | goto unlock; |
| 759 | } | 762 | } |
| 760 | } else if (neigh->ah) { | 763 | } else if (neigh->ah) { |
| 761 | ipoib_send(dev, skb, neigh->ah, IPOIB_QPN(n->ha)); | 764 | ipoib_send(dev, skb, neigh->ah, IPOIB_QPN(n->ha)); |
| 762 | return NETDEV_TX_OK; | 765 | goto unlock; |
| 763 | } | 766 | } |
| 764 | 767 | ||
| 765 | if (skb_queue_len(&neigh->queue) < IPOIB_MAX_PATH_REC_QUEUE) { | 768 | if (skb_queue_len(&neigh->queue) < IPOIB_MAX_PATH_REC_QUEUE) { |
| @@ -793,13 +796,14 @@ static int ipoib_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
| 793 | phdr->hwaddr + 4); | 796 | phdr->hwaddr + 4); |
| 794 | dev_kfree_skb_any(skb); | 797 | dev_kfree_skb_any(skb); |
| 795 | ++dev->stats.tx_dropped; | 798 | ++dev->stats.tx_dropped; |
| 796 | return NETDEV_TX_OK; | 799 | goto unlock; |
| 797 | } | 800 | } |
| 798 | 801 | ||
| 799 | unicast_arp_send(skb, dev, phdr); | 802 | unicast_arp_send(skb, dev, phdr); |
| 800 | } | 803 | } |
| 801 | } | 804 | } |
| 802 | 805 | unlock: | |
| 806 | rcu_read_unlock(); | ||
| 803 | return NETDEV_TX_OK; | 807 | return NETDEV_TX_OK; |
| 804 | } | 808 | } |
| 805 | 809 | ||
| @@ -837,7 +841,7 @@ static int ipoib_hard_header(struct sk_buff *skb, | |||
| 837 | dst = skb_dst(skb); | 841 | dst = skb_dst(skb); |
| 838 | n = NULL; | 842 | n = NULL; |
| 839 | if (dst) | 843 | if (dst) |
| 840 | n = dst_get_neighbour(dst); | 844 | n = dst_get_neighbour_raw(dst); |
| 841 | if ((!dst || !n) && daddr) { | 845 | if ((!dst || !n) && daddr) { |
| 842 | struct ipoib_pseudoheader *phdr = | 846 | struct ipoib_pseudoheader *phdr = |
| 843 | (struct ipoib_pseudoheader *) skb_push(skb, sizeof *phdr); | 847 | (struct ipoib_pseudoheader *) skb_push(skb, sizeof *phdr); |
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c index 1b7a97686356..873bff97e69e 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c | |||
| @@ -240,8 +240,11 @@ static int ipoib_mcast_join_finish(struct ipoib_mcast *mcast, | |||
| 240 | av.grh.dgid = mcast->mcmember.mgid; | 240 | av.grh.dgid = mcast->mcmember.mgid; |
| 241 | 241 | ||
| 242 | ah = ipoib_create_ah(dev, priv->pd, &av); | 242 | ah = ipoib_create_ah(dev, priv->pd, &av); |
| 243 | if (!ah) { | 243 | if (IS_ERR(ah)) { |
| 244 | ipoib_warn(priv, "ib_address_create failed\n"); | 244 | ipoib_warn(priv, "ib_address_create failed %ld\n", |
| 245 | -PTR_ERR(ah)); | ||
| 246 | /* use original error */ | ||
| 247 | return PTR_ERR(ah); | ||
| 245 | } else { | 248 | } else { |
| 246 | spin_lock_irq(&priv->lock); | 249 | spin_lock_irq(&priv->lock); |
| 247 | mcast->ah = ah; | 250 | mcast->ah = ah; |
| @@ -266,7 +269,7 @@ static int ipoib_mcast_join_finish(struct ipoib_mcast *mcast, | |||
| 266 | 269 | ||
| 267 | skb->dev = dev; | 270 | skb->dev = dev; |
| 268 | if (dst) | 271 | if (dst) |
| 269 | n = dst_get_neighbour(dst); | 272 | n = dst_get_neighbour_raw(dst); |
| 270 | if (!dst || !n) { | 273 | if (!dst || !n) { |
| 271 | /* put pseudoheader back on for next time */ | 274 | /* put pseudoheader back on for next time */ |
| 272 | skb_push(skb, sizeof (struct ipoib_pseudoheader)); | 275 | skb_push(skb, sizeof (struct ipoib_pseudoheader)); |
| @@ -722,6 +725,8 @@ out: | |||
| 722 | if (mcast && mcast->ah) { | 725 | if (mcast && mcast->ah) { |
| 723 | struct dst_entry *dst = skb_dst(skb); | 726 | struct dst_entry *dst = skb_dst(skb); |
| 724 | struct neighbour *n = NULL; | 727 | struct neighbour *n = NULL; |
| 728 | |||
| 729 | rcu_read_lock(); | ||
| 725 | if (dst) | 730 | if (dst) |
| 726 | n = dst_get_neighbour(dst); | 731 | n = dst_get_neighbour(dst); |
| 727 | if (n && !*to_ipoib_neigh(n)) { | 732 | if (n && !*to_ipoib_neigh(n)) { |
| @@ -734,7 +739,7 @@ out: | |||
| 734 | list_add_tail(&neigh->list, &mcast->neigh_list); | 739 | list_add_tail(&neigh->list, &mcast->neigh_list); |
| 735 | } | 740 | } |
| 736 | } | 741 | } |
| 737 | 742 | rcu_read_unlock(); | |
| 738 | spin_unlock_irqrestore(&priv->lock, flags); | 743 | spin_unlock_irqrestore(&priv->lock, flags); |
| 739 | ipoib_send(dev, skb, mcast->ah, IB_MULTICAST_QPN); | 744 | ipoib_send(dev, skb, mcast->ah, IB_MULTICAST_QPN); |
| 740 | return; | 745 | return; |
diff --git a/drivers/isdn/divert/divert_procfs.c b/drivers/isdn/divert/divert_procfs.c index 33ec9e467772..9021182c4b76 100644 --- a/drivers/isdn/divert/divert_procfs.c +++ b/drivers/isdn/divert/divert_procfs.c | |||
| @@ -242,6 +242,12 @@ static int isdn_divert_ioctl_unlocked(struct file *file, uint cmd, ulong arg) | |||
| 242 | case IIOCDOCFINT: | 242 | case IIOCDOCFINT: |
| 243 | if (!divert_if.drv_to_name(dioctl.cf_ctrl.drvid)) | 243 | if (!divert_if.drv_to_name(dioctl.cf_ctrl.drvid)) |
| 244 | return (-EINVAL); /* invalid driver */ | 244 | return (-EINVAL); /* invalid driver */ |
| 245 | if (strnlen(dioctl.cf_ctrl.msn, sizeof(dioctl.cf_ctrl.msn)) == | ||
| 246 | sizeof(dioctl.cf_ctrl.msn)) | ||
| 247 | return -EINVAL; | ||
| 248 | if (strnlen(dioctl.cf_ctrl.fwd_nr, sizeof(dioctl.cf_ctrl.fwd_nr)) == | ||
| 249 | sizeof(dioctl.cf_ctrl.fwd_nr)) | ||
| 250 | return -EINVAL; | ||
| 245 | if ((i = cf_command(dioctl.cf_ctrl.drvid, | 251 | if ((i = cf_command(dioctl.cf_ctrl.drvid, |
| 246 | (cmd == IIOCDOCFACT) ? 1 : (cmd == IIOCDOCFDIS) ? 0 : 2, | 252 | (cmd == IIOCDOCFACT) ? 1 : (cmd == IIOCDOCFDIS) ? 0 : 2, |
| 247 | dioctl.cf_ctrl.cfproc, | 253 | dioctl.cf_ctrl.cfproc, |
diff --git a/drivers/isdn/i4l/isdn_net.c b/drivers/isdn/i4l/isdn_net.c index 1f73d7f7e024..2339d7396b9e 100644 --- a/drivers/isdn/i4l/isdn_net.c +++ b/drivers/isdn/i4l/isdn_net.c | |||
| @@ -2756,6 +2756,9 @@ isdn_net_setcfg(isdn_net_ioctl_cfg * cfg) | |||
| 2756 | char *c, | 2756 | char *c, |
| 2757 | *e; | 2757 | *e; |
| 2758 | 2758 | ||
| 2759 | if (strnlen(cfg->drvid, sizeof(cfg->drvid)) == | ||
| 2760 | sizeof(cfg->drvid)) | ||
| 2761 | return -EINVAL; | ||
| 2759 | drvidx = -1; | 2762 | drvidx = -1; |
| 2760 | chidx = -1; | 2763 | chidx = -1; |
| 2761 | strcpy(drvid, cfg->drvid); | 2764 | strcpy(drvid, cfg->drvid); |
diff --git a/drivers/net/arcnet/Kconfig b/drivers/net/arcnet/Kconfig index a73d9dc80ff6..84fb6349a59a 100644 --- a/drivers/net/arcnet/Kconfig +++ b/drivers/net/arcnet/Kconfig | |||
| @@ -4,7 +4,7 @@ | |||
| 4 | 4 | ||
| 5 | menuconfig ARCNET | 5 | menuconfig ARCNET |
| 6 | depends on NETDEVICES && (ISA || PCI || PCMCIA) | 6 | depends on NETDEVICES && (ISA || PCI || PCMCIA) |
| 7 | bool "ARCnet support" | 7 | tristate "ARCnet support" |
| 8 | ---help--- | 8 | ---help--- |
| 9 | If you have a network card of this type, say Y and check out the | 9 | If you have a network card of this type, say Y and check out the |
| 10 | (arguably) beautiful poetry in | 10 | (arguably) beautiful poetry in |
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index b0c577256487..7f8756825b8a 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c | |||
| @@ -2553,30 +2553,6 @@ re_arm: | |||
| 2553 | } | 2553 | } |
| 2554 | } | 2554 | } |
| 2555 | 2555 | ||
| 2556 | static __be32 bond_glean_dev_ip(struct net_device *dev) | ||
| 2557 | { | ||
| 2558 | struct in_device *idev; | ||
| 2559 | struct in_ifaddr *ifa; | ||
| 2560 | __be32 addr = 0; | ||
| 2561 | |||
| 2562 | if (!dev) | ||
| 2563 | return 0; | ||
| 2564 | |||
| 2565 | rcu_read_lock(); | ||
| 2566 | idev = __in_dev_get_rcu(dev); | ||
| 2567 | if (!idev) | ||
| 2568 | goto out; | ||
| 2569 | |||
| 2570 | ifa = idev->ifa_list; | ||
| 2571 | if (!ifa) | ||
| 2572 | goto out; | ||
| 2573 | |||
| 2574 | addr = ifa->ifa_local; | ||
| 2575 | out: | ||
| 2576 | rcu_read_unlock(); | ||
| 2577 | return addr; | ||
| 2578 | } | ||
| 2579 | |||
| 2580 | static int bond_has_this_ip(struct bonding *bond, __be32 ip) | 2556 | static int bond_has_this_ip(struct bonding *bond, __be32 ip) |
| 2581 | { | 2557 | { |
| 2582 | struct vlan_entry *vlan; | 2558 | struct vlan_entry *vlan; |
| @@ -3322,6 +3298,10 @@ static int bond_inetaddr_event(struct notifier_block *this, unsigned long event, | |||
| 3322 | struct bonding *bond; | 3298 | struct bonding *bond; |
| 3323 | struct vlan_entry *vlan; | 3299 | struct vlan_entry *vlan; |
| 3324 | 3300 | ||
| 3301 | /* we only care about primary address */ | ||
| 3302 | if(ifa->ifa_flags & IFA_F_SECONDARY) | ||
| 3303 | return NOTIFY_DONE; | ||
| 3304 | |||
| 3325 | list_for_each_entry(bond, &bn->dev_list, bond_list) { | 3305 | list_for_each_entry(bond, &bn->dev_list, bond_list) { |
| 3326 | if (bond->dev == event_dev) { | 3306 | if (bond->dev == event_dev) { |
| 3327 | switch (event) { | 3307 | switch (event) { |
| @@ -3329,7 +3309,7 @@ static int bond_inetaddr_event(struct notifier_block *this, unsigned long event, | |||
| 3329 | bond->master_ip = ifa->ifa_local; | 3309 | bond->master_ip = ifa->ifa_local; |
| 3330 | return NOTIFY_OK; | 3310 | return NOTIFY_OK; |
| 3331 | case NETDEV_DOWN: | 3311 | case NETDEV_DOWN: |
| 3332 | bond->master_ip = bond_glean_dev_ip(bond->dev); | 3312 | bond->master_ip = 0; |
| 3333 | return NOTIFY_OK; | 3313 | return NOTIFY_OK; |
| 3334 | default: | 3314 | default: |
| 3335 | return NOTIFY_DONE; | 3315 | return NOTIFY_DONE; |
| @@ -3345,8 +3325,7 @@ static int bond_inetaddr_event(struct notifier_block *this, unsigned long event, | |||
| 3345 | vlan->vlan_ip = ifa->ifa_local; | 3325 | vlan->vlan_ip = ifa->ifa_local; |
| 3346 | return NOTIFY_OK; | 3326 | return NOTIFY_OK; |
| 3347 | case NETDEV_DOWN: | 3327 | case NETDEV_DOWN: |
| 3348 | vlan->vlan_ip = | 3328 | vlan->vlan_ip = 0; |
| 3349 | bond_glean_dev_ip(vlan_dev); | ||
| 3350 | return NOTIFY_OK; | 3329 | return NOTIFY_OK; |
| 3351 | default: | 3330 | default: |
| 3352 | return NOTIFY_DONE; | 3331 | return NOTIFY_DONE; |
diff --git a/drivers/net/can/sja1000/peak_pci.c b/drivers/net/can/sja1000/peak_pci.c index 905bce0b3a43..2c7f5036f570 100644 --- a/drivers/net/can/sja1000/peak_pci.c +++ b/drivers/net/can/sja1000/peak_pci.c | |||
| @@ -20,7 +20,6 @@ | |||
| 20 | */ | 20 | */ |
| 21 | 21 | ||
| 22 | #include <linux/kernel.h> | 22 | #include <linux/kernel.h> |
| 23 | #include <linux/version.h> | ||
| 24 | #include <linux/module.h> | 23 | #include <linux/module.h> |
| 25 | #include <linux/interrupt.h> | 24 | #include <linux/interrupt.h> |
| 26 | #include <linux/netdevice.h> | 25 | #include <linux/netdevice.h> |
diff --git a/drivers/net/ethernet/broadcom/b44.c b/drivers/net/ethernet/broadcom/b44.c index 4cf835dbc122..3fb66d09ece5 100644 --- a/drivers/net/ethernet/broadcom/b44.c +++ b/drivers/net/ethernet/broadcom/b44.c | |||
| @@ -608,7 +608,7 @@ static void b44_tx(struct b44 *bp) | |||
| 608 | skb->len, | 608 | skb->len, |
| 609 | DMA_TO_DEVICE); | 609 | DMA_TO_DEVICE); |
| 610 | rp->skb = NULL; | 610 | rp->skb = NULL; |
| 611 | dev_kfree_skb(skb); | 611 | dev_kfree_skb_irq(skb); |
| 612 | } | 612 | } |
| 613 | 613 | ||
| 614 | bp->tx_cons = cons; | 614 | bp->tx_cons = cons; |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c index bce203fa4b9e..882f48f0a03c 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c | |||
| @@ -10327,6 +10327,43 @@ static int bnx2x_54618se_config_init(struct bnx2x_phy *phy, | |||
| 10327 | return 0; | 10327 | return 0; |
| 10328 | } | 10328 | } |
| 10329 | 10329 | ||
| 10330 | |||
| 10331 | static void bnx2x_5461x_set_link_led(struct bnx2x_phy *phy, | ||
| 10332 | struct link_params *params, u8 mode) | ||
| 10333 | { | ||
| 10334 | struct bnx2x *bp = params->bp; | ||
| 10335 | u16 temp; | ||
| 10336 | |||
| 10337 | bnx2x_cl22_write(bp, phy, | ||
| 10338 | MDIO_REG_GPHY_SHADOW, | ||
| 10339 | MDIO_REG_GPHY_SHADOW_LED_SEL1); | ||
| 10340 | bnx2x_cl22_read(bp, phy, | ||
| 10341 | MDIO_REG_GPHY_SHADOW, | ||
| 10342 | &temp); | ||
| 10343 | temp &= 0xff00; | ||
| 10344 | |||
| 10345 | DP(NETIF_MSG_LINK, "54618x set link led (mode=%x)\n", mode); | ||
| 10346 | switch (mode) { | ||
| 10347 | case LED_MODE_FRONT_PANEL_OFF: | ||
| 10348 | case LED_MODE_OFF: | ||
| 10349 | temp |= 0x00ee; | ||
| 10350 | break; | ||
| 10351 | case LED_MODE_OPER: | ||
| 10352 | temp |= 0x0001; | ||
| 10353 | break; | ||
| 10354 | case LED_MODE_ON: | ||
| 10355 | temp |= 0x00ff; | ||
| 10356 | break; | ||
| 10357 | default: | ||
| 10358 | break; | ||
| 10359 | } | ||
| 10360 | bnx2x_cl22_write(bp, phy, | ||
| 10361 | MDIO_REG_GPHY_SHADOW, | ||
| 10362 | MDIO_REG_GPHY_SHADOW_WR_ENA | temp); | ||
| 10363 | return; | ||
| 10364 | } | ||
| 10365 | |||
| 10366 | |||
| 10330 | static void bnx2x_54618se_link_reset(struct bnx2x_phy *phy, | 10367 | static void bnx2x_54618se_link_reset(struct bnx2x_phy *phy, |
| 10331 | struct link_params *params) | 10368 | struct link_params *params) |
| 10332 | { | 10369 | { |
| @@ -11103,7 +11140,7 @@ static struct bnx2x_phy phy_54618se = { | |||
| 11103 | .config_loopback = (config_loopback_t)bnx2x_54618se_config_loopback, | 11140 | .config_loopback = (config_loopback_t)bnx2x_54618se_config_loopback, |
| 11104 | .format_fw_ver = (format_fw_ver_t)NULL, | 11141 | .format_fw_ver = (format_fw_ver_t)NULL, |
| 11105 | .hw_reset = (hw_reset_t)NULL, | 11142 | .hw_reset = (hw_reset_t)NULL, |
| 11106 | .set_link_led = (set_link_led_t)NULL, | 11143 | .set_link_led = (set_link_led_t)bnx2x_5461x_set_link_led, |
| 11107 | .phy_specific_func = (phy_specific_func_t)NULL | 11144 | .phy_specific_func = (phy_specific_func_t)NULL |
| 11108 | }; | 11145 | }; |
| 11109 | /*****************************************************************/ | 11146 | /*****************************************************************/ |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_reg.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_reg.h index fc7bd0f23c0b..e58073ef33b4 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_reg.h +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_reg.h | |||
| @@ -6990,6 +6990,7 @@ Theotherbitsarereservedandshouldbezero*/ | |||
| 6990 | #define MDIO_REG_INTR_MASK 0x1b | 6990 | #define MDIO_REG_INTR_MASK 0x1b |
| 6991 | #define MDIO_REG_INTR_MASK_LINK_STATUS (0x1 << 1) | 6991 | #define MDIO_REG_INTR_MASK_LINK_STATUS (0x1 << 1) |
| 6992 | #define MDIO_REG_GPHY_SHADOW 0x1c | 6992 | #define MDIO_REG_GPHY_SHADOW 0x1c |
| 6993 | #define MDIO_REG_GPHY_SHADOW_LED_SEL1 (0x0d << 10) | ||
| 6993 | #define MDIO_REG_GPHY_SHADOW_LED_SEL2 (0x0e << 10) | 6994 | #define MDIO_REG_GPHY_SHADOW_LED_SEL2 (0x0e << 10) |
| 6994 | #define MDIO_REG_GPHY_SHADOW_WR_ENA (0x1 << 15) | 6995 | #define MDIO_REG_GPHY_SHADOW_WR_ENA (0x1 << 15) |
| 6995 | #define MDIO_REG_GPHY_SHADOW_AUTO_DET_MED (0x1e << 10) | 6996 | #define MDIO_REG_GPHY_SHADOW_AUTO_DET_MED (0x1e << 10) |
diff --git a/drivers/net/ethernet/davicom/dm9000.c b/drivers/net/ethernet/davicom/dm9000.c index 438f4580bf66..2a22f5256353 100644 --- a/drivers/net/ethernet/davicom/dm9000.c +++ b/drivers/net/ethernet/davicom/dm9000.c | |||
| @@ -613,7 +613,7 @@ static int dm9000_set_wol(struct net_device *dev, struct ethtool_wolinfo *w) | |||
| 613 | 613 | ||
| 614 | if (!dm->wake_state) | 614 | if (!dm->wake_state) |
| 615 | irq_set_irq_wake(dm->irq_wake, 1); | 615 | irq_set_irq_wake(dm->irq_wake, 1); |
| 616 | else if (dm->wake_state & !opts) | 616 | else if (dm->wake_state && !opts) |
| 617 | irq_set_irq_wake(dm->irq_wake, 0); | 617 | irq_set_irq_wake(dm->irq_wake, 0); |
| 618 | } | 618 | } |
| 619 | 619 | ||
diff --git a/drivers/net/ethernet/freescale/Kconfig b/drivers/net/ethernet/freescale/Kconfig index c520cfd3b298..5272f9d4dda9 100644 --- a/drivers/net/ethernet/freescale/Kconfig +++ b/drivers/net/ethernet/freescale/Kconfig | |||
| @@ -24,6 +24,7 @@ config FEC | |||
| 24 | bool "FEC ethernet controller (of ColdFire and some i.MX CPUs)" | 24 | bool "FEC ethernet controller (of ColdFire and some i.MX CPUs)" |
| 25 | depends on (M523x || M527x || M5272 || M528x || M520x || M532x || \ | 25 | depends on (M523x || M527x || M5272 || M528x || M520x || M532x || \ |
| 26 | ARCH_MXC || ARCH_MXS) | 26 | ARCH_MXC || ARCH_MXS) |
| 27 | default ARCH_MXC || ARCH_MXS if ARM | ||
| 27 | select PHYLIB | 28 | select PHYLIB |
| 28 | ---help--- | 29 | ---help--- |
| 29 | Say Y here if you want to use the built-in 10/100 Fast ethernet | 30 | Say Y here if you want to use the built-in 10/100 Fast ethernet |
diff --git a/drivers/net/ethernet/ibm/ehea/ehea.h b/drivers/net/ethernet/ibm/ehea/ehea.h index 410d6a1984ed..6650068c996c 100644 --- a/drivers/net/ethernet/ibm/ehea/ehea.h +++ b/drivers/net/ethernet/ibm/ehea/ehea.h | |||
| @@ -61,9 +61,9 @@ | |||
| 61 | #ifdef EHEA_SMALL_QUEUES | 61 | #ifdef EHEA_SMALL_QUEUES |
| 62 | #define EHEA_MAX_CQE_COUNT 1023 | 62 | #define EHEA_MAX_CQE_COUNT 1023 |
| 63 | #define EHEA_DEF_ENTRIES_SQ 1023 | 63 | #define EHEA_DEF_ENTRIES_SQ 1023 |
| 64 | #define EHEA_DEF_ENTRIES_RQ1 4095 | 64 | #define EHEA_DEF_ENTRIES_RQ1 1023 |
| 65 | #define EHEA_DEF_ENTRIES_RQ2 1023 | 65 | #define EHEA_DEF_ENTRIES_RQ2 1023 |
| 66 | #define EHEA_DEF_ENTRIES_RQ3 1023 | 66 | #define EHEA_DEF_ENTRIES_RQ3 511 |
| 67 | #else | 67 | #else |
| 68 | #define EHEA_MAX_CQE_COUNT 4080 | 68 | #define EHEA_MAX_CQE_COUNT 4080 |
| 69 | #define EHEA_DEF_ENTRIES_SQ 4080 | 69 | #define EHEA_DEF_ENTRIES_SQ 4080 |
diff --git a/drivers/net/ethernet/ibm/ehea/ehea_main.c b/drivers/net/ethernet/ibm/ehea/ehea_main.c index 37b70f7052b6..bfeccbfde236 100644 --- a/drivers/net/ethernet/ibm/ehea/ehea_main.c +++ b/drivers/net/ethernet/ibm/ehea/ehea_main.c | |||
| @@ -371,7 +371,8 @@ static void ehea_update_stats(struct work_struct *work) | |||
| 371 | out_herr: | 371 | out_herr: |
| 372 | free_page((unsigned long)cb2); | 372 | free_page((unsigned long)cb2); |
| 373 | resched: | 373 | resched: |
| 374 | schedule_delayed_work(&port->stats_work, msecs_to_jiffies(1000)); | 374 | schedule_delayed_work(&port->stats_work, |
| 375 | round_jiffies_relative(msecs_to_jiffies(1000))); | ||
| 375 | } | 376 | } |
| 376 | 377 | ||
| 377 | static void ehea_refill_rq1(struct ehea_port_res *pr, int index, int nr_of_wqes) | 378 | static void ehea_refill_rq1(struct ehea_port_res *pr, int index, int nr_of_wqes) |
| @@ -2434,7 +2435,8 @@ static int ehea_open(struct net_device *dev) | |||
| 2434 | } | 2435 | } |
| 2435 | 2436 | ||
| 2436 | mutex_unlock(&port->port_lock); | 2437 | mutex_unlock(&port->port_lock); |
| 2437 | schedule_delayed_work(&port->stats_work, msecs_to_jiffies(1000)); | 2438 | schedule_delayed_work(&port->stats_work, |
| 2439 | round_jiffies_relative(msecs_to_jiffies(1000))); | ||
| 2438 | 2440 | ||
| 2439 | return ret; | 2441 | return ret; |
| 2440 | } | 2442 | } |
diff --git a/drivers/net/ethernet/ibm/iseries_veth.c b/drivers/net/ethernet/ibm/iseries_veth.c index 4326681df382..acc31af6594a 100644 --- a/drivers/net/ethernet/ibm/iseries_veth.c +++ b/drivers/net/ethernet/ibm/iseries_veth.c | |||
| @@ -1421,7 +1421,7 @@ static void veth_receive(struct veth_lpar_connection *cnx, | |||
| 1421 | 1421 | ||
| 1422 | /* FIXME: do we need this? */ | 1422 | /* FIXME: do we need this? */ |
| 1423 | memset(local_list, 0, sizeof(local_list)); | 1423 | memset(local_list, 0, sizeof(local_list)); |
| 1424 | memset(remote_list, 0, sizeof(VETH_MAX_FRAMES_PER_MSG)); | 1424 | memset(remote_list, 0, sizeof(remote_list)); |
| 1425 | 1425 | ||
| 1426 | /* a 0 address marks the end of the valid entries */ | 1426 | /* a 0 address marks the end of the valid entries */ |
| 1427 | if (senddata->addr[startchunk] == 0) | 1427 | if (senddata->addr[startchunk] == 0) |
diff --git a/drivers/net/ethernet/jme.c b/drivers/net/ethernet/jme.c index 7becff1f387d..76b84573566b 100644 --- a/drivers/net/ethernet/jme.c +++ b/drivers/net/ethernet/jme.c | |||
| @@ -1745,6 +1745,112 @@ jme_phy_off(struct jme_adapter *jme) | |||
| 1745 | } | 1745 | } |
| 1746 | 1746 | ||
| 1747 | static int | 1747 | static int |
| 1748 | jme_phy_specreg_read(struct jme_adapter *jme, u32 specreg) | ||
| 1749 | { | ||
| 1750 | u32 phy_addr; | ||
| 1751 | |||
| 1752 | phy_addr = JM_PHY_SPEC_REG_READ | specreg; | ||
| 1753 | jme_mdio_write(jme->dev, jme->mii_if.phy_id, JM_PHY_SPEC_ADDR_REG, | ||
| 1754 | phy_addr); | ||
| 1755 | return jme_mdio_read(jme->dev, jme->mii_if.phy_id, | ||
| 1756 | JM_PHY_SPEC_DATA_REG); | ||
| 1757 | } | ||
| 1758 | |||
| 1759 | static void | ||
| 1760 | jme_phy_specreg_write(struct jme_adapter *jme, u32 ext_reg, u32 phy_data) | ||
| 1761 | { | ||
| 1762 | u32 phy_addr; | ||
| 1763 | |||
| 1764 | phy_addr = JM_PHY_SPEC_REG_WRITE | ext_reg; | ||
| 1765 | jme_mdio_write(jme->dev, jme->mii_if.phy_id, JM_PHY_SPEC_DATA_REG, | ||
| 1766 | phy_data); | ||
| 1767 | jme_mdio_write(jme->dev, jme->mii_if.phy_id, JM_PHY_SPEC_ADDR_REG, | ||
| 1768 | phy_addr); | ||
| 1769 | } | ||
| 1770 | |||
| 1771 | static int | ||
| 1772 | jme_phy_calibration(struct jme_adapter *jme) | ||
| 1773 | { | ||
| 1774 | u32 ctrl1000, phy_data; | ||
| 1775 | |||
| 1776 | jme_phy_off(jme); | ||
| 1777 | jme_phy_on(jme); | ||
| 1778 | /* Enabel PHY test mode 1 */ | ||
| 1779 | ctrl1000 = jme_mdio_read(jme->dev, jme->mii_if.phy_id, MII_CTRL1000); | ||
| 1780 | ctrl1000 &= ~PHY_GAD_TEST_MODE_MSK; | ||
| 1781 | ctrl1000 |= PHY_GAD_TEST_MODE_1; | ||
| 1782 | jme_mdio_write(jme->dev, jme->mii_if.phy_id, MII_CTRL1000, ctrl1000); | ||
| 1783 | |||
| 1784 | phy_data = jme_phy_specreg_read(jme, JM_PHY_EXT_COMM_2_REG); | ||
| 1785 | phy_data &= ~JM_PHY_EXT_COMM_2_CALI_MODE_0; | ||
| 1786 | phy_data |= JM_PHY_EXT_COMM_2_CALI_LATCH | | ||
| 1787 | JM_PHY_EXT_COMM_2_CALI_ENABLE; | ||
| 1788 | jme_phy_specreg_write(jme, JM_PHY_EXT_COMM_2_REG, phy_data); | ||
| 1789 | msleep(20); | ||
| 1790 | phy_data = jme_phy_specreg_read(jme, JM_PHY_EXT_COMM_2_REG); | ||
| 1791 | phy_data &= ~(JM_PHY_EXT_COMM_2_CALI_ENABLE | | ||
| 1792 | JM_PHY_EXT_COMM_2_CALI_MODE_0 | | ||
| 1793 | JM_PHY_EXT_COMM_2_CALI_LATCH); | ||
| 1794 | jme_phy_specreg_write(jme, JM_PHY_EXT_COMM_2_REG, phy_data); | ||
| 1795 | |||
| 1796 | /* Disable PHY test mode */ | ||
| 1797 | ctrl1000 = jme_mdio_read(jme->dev, jme->mii_if.phy_id, MII_CTRL1000); | ||
| 1798 | ctrl1000 &= ~PHY_GAD_TEST_MODE_MSK; | ||
| 1799 | jme_mdio_write(jme->dev, jme->mii_if.phy_id, MII_CTRL1000, ctrl1000); | ||
| 1800 | return 0; | ||
| 1801 | } | ||
| 1802 | |||
| 1803 | static int | ||
| 1804 | jme_phy_setEA(struct jme_adapter *jme) | ||
| 1805 | { | ||
| 1806 | u32 phy_comm0 = 0, phy_comm1 = 0; | ||
| 1807 | u8 nic_ctrl; | ||
| 1808 | |||
| 1809 | pci_read_config_byte(jme->pdev, PCI_PRIV_SHARE_NICCTRL, &nic_ctrl); | ||
| 1810 | if ((nic_ctrl & 0x3) == JME_FLAG_PHYEA_ENABLE) | ||
| 1811 | return 0; | ||
| 1812 | |||
| 1813 | switch (jme->pdev->device) { | ||
| 1814 | case PCI_DEVICE_ID_JMICRON_JMC250: | ||
| 1815 | if (((jme->chip_main_rev == 5) && | ||
| 1816 | ((jme->chip_sub_rev == 0) || (jme->chip_sub_rev == 1) || | ||
| 1817 | (jme->chip_sub_rev == 3))) || | ||
| 1818 | (jme->chip_main_rev >= 6)) { | ||
| 1819 | phy_comm0 = 0x008A; | ||
| 1820 | phy_comm1 = 0x4109; | ||
| 1821 | } | ||
| 1822 | if ((jme->chip_main_rev == 3) && | ||
| 1823 | ((jme->chip_sub_rev == 1) || (jme->chip_sub_rev == 2))) | ||
| 1824 | phy_comm0 = 0xE088; | ||
| 1825 | break; | ||
| 1826 | case PCI_DEVICE_ID_JMICRON_JMC260: | ||
| 1827 | if (((jme->chip_main_rev == 5) && | ||
| 1828 | ((jme->chip_sub_rev == 0) || (jme->chip_sub_rev == 1) || | ||
| 1829 | (jme->chip_sub_rev == 3))) || | ||
| 1830 | (jme->chip_main_rev >= 6)) { | ||
| 1831 | phy_comm0 = 0x008A; | ||
| 1832 | phy_comm1 = 0x4109; | ||
| 1833 | } | ||
| 1834 | if ((jme->chip_main_rev == 3) && | ||
| 1835 | ((jme->chip_sub_rev == 1) || (jme->chip_sub_rev == 2))) | ||
| 1836 | phy_comm0 = 0xE088; | ||
| 1837 | if ((jme->chip_main_rev == 2) && (jme->chip_sub_rev == 0)) | ||
| 1838 | phy_comm0 = 0x608A; | ||
| 1839 | if ((jme->chip_main_rev == 2) && (jme->chip_sub_rev == 2)) | ||
| 1840 | phy_comm0 = 0x408A; | ||
| 1841 | break; | ||
| 1842 | default: | ||
| 1843 | return -ENODEV; | ||
| 1844 | } | ||
| 1845 | if (phy_comm0) | ||
| 1846 | jme_phy_specreg_write(jme, JM_PHY_EXT_COMM_0_REG, phy_comm0); | ||
| 1847 | if (phy_comm1) | ||
| 1848 | jme_phy_specreg_write(jme, JM_PHY_EXT_COMM_1_REG, phy_comm1); | ||
| 1849 | |||
| 1850 | return 0; | ||
| 1851 | } | ||
| 1852 | |||
| 1853 | static int | ||
| 1748 | jme_open(struct net_device *netdev) | 1854 | jme_open(struct net_device *netdev) |
| 1749 | { | 1855 | { |
| 1750 | struct jme_adapter *jme = netdev_priv(netdev); | 1856 | struct jme_adapter *jme = netdev_priv(netdev); |
| @@ -1769,7 +1875,8 @@ jme_open(struct net_device *netdev) | |||
| 1769 | jme_set_settings(netdev, &jme->old_ecmd); | 1875 | jme_set_settings(netdev, &jme->old_ecmd); |
| 1770 | else | 1876 | else |
| 1771 | jme_reset_phy_processor(jme); | 1877 | jme_reset_phy_processor(jme); |
| 1772 | 1878 | jme_phy_calibration(jme); | |
| 1879 | jme_phy_setEA(jme); | ||
| 1773 | jme_reset_link(jme); | 1880 | jme_reset_link(jme); |
| 1774 | 1881 | ||
| 1775 | return 0; | 1882 | return 0; |
| @@ -3184,7 +3291,8 @@ jme_resume(struct device *dev) | |||
| 3184 | jme_set_settings(netdev, &jme->old_ecmd); | 3291 | jme_set_settings(netdev, &jme->old_ecmd); |
| 3185 | else | 3292 | else |
| 3186 | jme_reset_phy_processor(jme); | 3293 | jme_reset_phy_processor(jme); |
| 3187 | 3294 | jme_phy_calibration(jme); | |
| 3295 | jme_phy_setEA(jme); | ||
| 3188 | jme_start_irq(jme); | 3296 | jme_start_irq(jme); |
| 3189 | netif_device_attach(netdev); | 3297 | netif_device_attach(netdev); |
| 3190 | 3298 | ||
| @@ -3239,4 +3347,3 @@ MODULE_DESCRIPTION("JMicron JMC2x0 PCI Express Ethernet driver"); | |||
| 3239 | MODULE_LICENSE("GPL"); | 3347 | MODULE_LICENSE("GPL"); |
| 3240 | MODULE_VERSION(DRV_VERSION); | 3348 | MODULE_VERSION(DRV_VERSION); |
| 3241 | MODULE_DEVICE_TABLE(pci, jme_pci_tbl); | 3349 | MODULE_DEVICE_TABLE(pci, jme_pci_tbl); |
| 3242 | |||
diff --git a/drivers/net/ethernet/jme.h b/drivers/net/ethernet/jme.h index 02ea27c1dcb5..4304072bd3c5 100644 --- a/drivers/net/ethernet/jme.h +++ b/drivers/net/ethernet/jme.h | |||
| @@ -760,6 +760,25 @@ enum jme_rxmcs_bits { | |||
| 760 | RXMCS_CHECKSUM, | 760 | RXMCS_CHECKSUM, |
| 761 | }; | 761 | }; |
| 762 | 762 | ||
| 763 | /* Extern PHY common register 2 */ | ||
| 764 | |||
| 765 | #define PHY_GAD_TEST_MODE_1 0x00002000 | ||
| 766 | #define PHY_GAD_TEST_MODE_MSK 0x0000E000 | ||
| 767 | #define JM_PHY_SPEC_REG_READ 0x00004000 | ||
| 768 | #define JM_PHY_SPEC_REG_WRITE 0x00008000 | ||
| 769 | #define PHY_CALIBRATION_DELAY 20 | ||
| 770 | #define JM_PHY_SPEC_ADDR_REG 0x1E | ||
| 771 | #define JM_PHY_SPEC_DATA_REG 0x1F | ||
| 772 | |||
| 773 | #define JM_PHY_EXT_COMM_0_REG 0x30 | ||
| 774 | #define JM_PHY_EXT_COMM_1_REG 0x31 | ||
| 775 | #define JM_PHY_EXT_COMM_2_REG 0x32 | ||
| 776 | #define JM_PHY_EXT_COMM_2_CALI_ENABLE 0x01 | ||
| 777 | #define JM_PHY_EXT_COMM_2_CALI_MODE_0 0x02 | ||
| 778 | #define JM_PHY_EXT_COMM_2_CALI_LATCH 0x10 | ||
| 779 | #define PCI_PRIV_SHARE_NICCTRL 0xF5 | ||
| 780 | #define JME_FLAG_PHYEA_ENABLE 0x2 | ||
| 781 | |||
| 763 | /* | 782 | /* |
| 764 | * Wakeup Frame setup interface registers | 783 | * Wakeup Frame setup interface registers |
| 765 | */ | 784 | */ |
diff --git a/drivers/net/ethernet/qlogic/qlge/qlge.h b/drivers/net/ethernet/qlogic/qlge/qlge.h index 8731f79c9efc..b8478aab050e 100644 --- a/drivers/net/ethernet/qlogic/qlge/qlge.h +++ b/drivers/net/ethernet/qlogic/qlge/qlge.h | |||
| @@ -58,10 +58,8 @@ | |||
| 58 | 58 | ||
| 59 | 59 | ||
| 60 | #define TX_DESC_PER_IOCB 8 | 60 | #define TX_DESC_PER_IOCB 8 |
| 61 | /* The maximum number of frags we handle is based | 61 | |
| 62 | * on PAGE_SIZE... | 62 | #if ((MAX_SKB_FRAGS - TX_DESC_PER_IOCB) + 2) > 0 |
| 63 | */ | ||
| 64 | #if (PAGE_SHIFT == 12) || (PAGE_SHIFT == 13) /* 4k & 8k pages */ | ||
| 65 | #define TX_DESC_PER_OAL ((MAX_SKB_FRAGS - TX_DESC_PER_IOCB) + 2) | 63 | #define TX_DESC_PER_OAL ((MAX_SKB_FRAGS - TX_DESC_PER_IOCB) + 2) |
| 66 | #else /* all other page sizes */ | 64 | #else /* all other page sizes */ |
| 67 | #define TX_DESC_PER_OAL 0 | 65 | #define TX_DESC_PER_OAL 0 |
| @@ -1353,7 +1351,7 @@ struct tx_ring_desc { | |||
| 1353 | struct ob_mac_iocb_req *queue_entry; | 1351 | struct ob_mac_iocb_req *queue_entry; |
| 1354 | u32 index; | 1352 | u32 index; |
| 1355 | struct oal oal; | 1353 | struct oal oal; |
| 1356 | struct map_list map[MAX_SKB_FRAGS + 1]; | 1354 | struct map_list map[MAX_SKB_FRAGS + 2]; |
| 1357 | int map_cnt; | 1355 | int map_cnt; |
| 1358 | struct tx_ring_desc *next; | 1356 | struct tx_ring_desc *next; |
| 1359 | }; | 1357 | }; |
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 8ea770a89f25..72cd190b9c1a 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | |||
| @@ -781,10 +781,15 @@ static void stmmac_mmc_setup(struct stmmac_priv *priv) | |||
| 781 | unsigned int mode = MMC_CNTRL_RESET_ON_READ | MMC_CNTRL_COUNTER_RESET | | 781 | unsigned int mode = MMC_CNTRL_RESET_ON_READ | MMC_CNTRL_COUNTER_RESET | |
| 782 | MMC_CNTRL_PRESET | MMC_CNTRL_FULL_HALF_PRESET; | 782 | MMC_CNTRL_PRESET | MMC_CNTRL_FULL_HALF_PRESET; |
| 783 | 783 | ||
| 784 | /* Do not manage MMC IRQ (FIXME) */ | 784 | /* Mask MMC irq, counters are managed in SW and registers |
| 785 | * are cleared on each READ eventually. */ | ||
| 785 | dwmac_mmc_intr_all_mask(priv->ioaddr); | 786 | dwmac_mmc_intr_all_mask(priv->ioaddr); |
| 786 | dwmac_mmc_ctrl(priv->ioaddr, mode); | 787 | |
| 787 | memset(&priv->mmc, 0, sizeof(struct stmmac_counters)); | 788 | if (priv->dma_cap.rmon) { |
| 789 | dwmac_mmc_ctrl(priv->ioaddr, mode); | ||
| 790 | memset(&priv->mmc, 0, sizeof(struct stmmac_counters)); | ||
| 791 | } else | ||
| 792 | pr_info(" No MAC Management Counters available"); | ||
| 788 | } | 793 | } |
| 789 | 794 | ||
| 790 | static u32 stmmac_get_synopsys_id(struct stmmac_priv *priv) | 795 | static u32 stmmac_get_synopsys_id(struct stmmac_priv *priv) |
| @@ -1012,8 +1017,7 @@ static int stmmac_open(struct net_device *dev) | |||
| 1012 | memset(&priv->xstats, 0, sizeof(struct stmmac_extra_stats)); | 1017 | memset(&priv->xstats, 0, sizeof(struct stmmac_extra_stats)); |
| 1013 | priv->xstats.threshold = tc; | 1018 | priv->xstats.threshold = tc; |
| 1014 | 1019 | ||
| 1015 | if (priv->dma_cap.rmon) | 1020 | stmmac_mmc_setup(priv); |
| 1016 | stmmac_mmc_setup(priv); | ||
| 1017 | 1021 | ||
| 1018 | /* Start the ball rolling... */ | 1022 | /* Start the ball rolling... */ |
| 1019 | DBG(probe, DEBUG, "%s: DMA RX/TX processes started...\n", dev->name); | 1023 | DBG(probe, DEBUG, "%s: DMA RX/TX processes started...\n", dev->name); |
diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig index bb88e12101c7..a70244306c94 100644 --- a/drivers/net/phy/Kconfig +++ b/drivers/net/phy/Kconfig | |||
| @@ -3,7 +3,7 @@ | |||
| 3 | # | 3 | # |
| 4 | 4 | ||
| 5 | menuconfig PHYLIB | 5 | menuconfig PHYLIB |
| 6 | bool "PHY Device support and infrastructure" | 6 | tristate "PHY Device support and infrastructure" |
| 7 | depends on !S390 | 7 | depends on !S390 |
| 8 | depends on NETDEVICES | 8 | depends on NETDEVICES |
| 9 | help | 9 | help |
diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c index 2f91acccb7db..8873c6e6fb96 100644 --- a/drivers/net/wireless/ath/ath9k/hw.c +++ b/drivers/net/wireless/ath/ath9k/hw.c | |||
| @@ -1827,7 +1827,8 @@ static void ath9k_set_power_sleep(struct ath_hw *ah, int setChip) | |||
| 1827 | } | 1827 | } |
| 1828 | 1828 | ||
| 1829 | /* Clear Bit 14 of AR_WA after putting chip into Full Sleep mode. */ | 1829 | /* Clear Bit 14 of AR_WA after putting chip into Full Sleep mode. */ |
| 1830 | REG_WRITE(ah, AR_WA, ah->WARegVal & ~AR_WA_D3_L1_DISABLE); | 1830 | if (AR_SREV_9300_20_OR_LATER(ah)) |
| 1831 | REG_WRITE(ah, AR_WA, ah->WARegVal & ~AR_WA_D3_L1_DISABLE); | ||
| 1831 | } | 1832 | } |
| 1832 | 1833 | ||
| 1833 | /* | 1834 | /* |
diff --git a/drivers/net/wireless/p54/p54spi.c b/drivers/net/wireless/p54/p54spi.c index f18df82eeb92..78d0d6988553 100644 --- a/drivers/net/wireless/p54/p54spi.c +++ b/drivers/net/wireless/p54/p54spi.c | |||
| @@ -588,8 +588,6 @@ static void p54spi_op_stop(struct ieee80211_hw *dev) | |||
| 588 | 588 | ||
| 589 | WARN_ON(priv->fw_state != FW_STATE_READY); | 589 | WARN_ON(priv->fw_state != FW_STATE_READY); |
| 590 | 590 | ||
| 591 | cancel_work_sync(&priv->work); | ||
| 592 | |||
| 593 | p54spi_power_off(priv); | 591 | p54spi_power_off(priv); |
| 594 | spin_lock_irqsave(&priv->tx_lock, flags); | 592 | spin_lock_irqsave(&priv->tx_lock, flags); |
| 595 | INIT_LIST_HEAD(&priv->tx_pending); | 593 | INIT_LIST_HEAD(&priv->tx_pending); |
| @@ -597,6 +595,8 @@ static void p54spi_op_stop(struct ieee80211_hw *dev) | |||
| 597 | 595 | ||
| 598 | priv->fw_state = FW_STATE_OFF; | 596 | priv->fw_state = FW_STATE_OFF; |
| 599 | mutex_unlock(&priv->mutex); | 597 | mutex_unlock(&priv->mutex); |
| 598 | |||
| 599 | cancel_work_sync(&priv->work); | ||
| 600 | } | 600 | } |
| 601 | 601 | ||
| 602 | static int __devinit p54spi_probe(struct spi_device *spi) | 602 | static int __devinit p54spi_probe(struct spi_device *spi) |
| @@ -656,6 +656,7 @@ static int __devinit p54spi_probe(struct spi_device *spi) | |||
| 656 | init_completion(&priv->fw_comp); | 656 | init_completion(&priv->fw_comp); |
| 657 | INIT_LIST_HEAD(&priv->tx_pending); | 657 | INIT_LIST_HEAD(&priv->tx_pending); |
| 658 | mutex_init(&priv->mutex); | 658 | mutex_init(&priv->mutex); |
| 659 | spin_lock_init(&priv->tx_lock); | ||
| 659 | SET_IEEE80211_DEV(hw, &spi->dev); | 660 | SET_IEEE80211_DEV(hw, &spi->dev); |
| 660 | priv->common.open = p54spi_op_start; | 661 | priv->common.open = p54spi_op_start; |
| 661 | priv->common.stop = p54spi_op_stop; | 662 | priv->common.stop = p54spi_op_stop; |
diff --git a/drivers/net/wireless/prism54/isl_ioctl.c b/drivers/net/wireless/prism54/isl_ioctl.c index d97a2caf582b..bc2ba80c47bb 100644 --- a/drivers/net/wireless/prism54/isl_ioctl.c +++ b/drivers/net/wireless/prism54/isl_ioctl.c | |||
| @@ -778,7 +778,7 @@ prism54_get_essid(struct net_device *ndev, struct iw_request_info *info, | |||
| 778 | dwrq->flags = 0; | 778 | dwrq->flags = 0; |
| 779 | dwrq->length = 0; | 779 | dwrq->length = 0; |
| 780 | } | 780 | } |
| 781 | essid->octets[essid->length] = '\0'; | 781 | essid->octets[dwrq->length] = '\0'; |
| 782 | memcpy(extra, essid->octets, dwrq->length); | 782 | memcpy(extra, essid->octets, dwrq->length); |
| 783 | kfree(essid); | 783 | kfree(essid); |
| 784 | 784 | ||
diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c index 3f183a15186e..1ba079dffb11 100644 --- a/drivers/net/wireless/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/rt2x00/rt2800lib.c | |||
| @@ -3771,7 +3771,7 @@ static void rt2800_efuse_read(struct rt2x00_dev *rt2x00dev, unsigned int i) | |||
| 3771 | /* Apparently the data is read from end to start */ | 3771 | /* Apparently the data is read from end to start */ |
| 3772 | rt2800_register_read_lock(rt2x00dev, EFUSE_DATA3, ®); | 3772 | rt2800_register_read_lock(rt2x00dev, EFUSE_DATA3, ®); |
| 3773 | /* The returned value is in CPU order, but eeprom is le */ | 3773 | /* The returned value is in CPU order, but eeprom is le */ |
| 3774 | rt2x00dev->eeprom[i] = cpu_to_le32(reg); | 3774 | *(u32 *)&rt2x00dev->eeprom[i] = cpu_to_le32(reg); |
| 3775 | rt2800_register_read_lock(rt2x00dev, EFUSE_DATA2, ®); | 3775 | rt2800_register_read_lock(rt2x00dev, EFUSE_DATA2, ®); |
| 3776 | *(u32 *)&rt2x00dev->eeprom[i + 2] = cpu_to_le32(reg); | 3776 | *(u32 *)&rt2x00dev->eeprom[i + 2] = cpu_to_le32(reg); |
| 3777 | rt2800_register_read_lock(rt2x00dev, EFUSE_DATA1, ®); | 3777 | rt2800_register_read_lock(rt2x00dev, EFUSE_DATA1, ®); |
diff --git a/drivers/net/wireless/rtlwifi/ps.c b/drivers/net/wireless/rtlwifi/ps.c index db5262844543..55c8e50f45fd 100644 --- a/drivers/net/wireless/rtlwifi/ps.c +++ b/drivers/net/wireless/rtlwifi/ps.c | |||
| @@ -395,7 +395,7 @@ void rtl_lps_enter(struct ieee80211_hw *hw) | |||
| 395 | if (mac->link_state != MAC80211_LINKED) | 395 | if (mac->link_state != MAC80211_LINKED) |
| 396 | return; | 396 | return; |
| 397 | 397 | ||
| 398 | spin_lock(&rtlpriv->locks.lps_lock); | 398 | spin_lock_irq(&rtlpriv->locks.lps_lock); |
| 399 | 399 | ||
| 400 | /* Idle for a while if we connect to AP a while ago. */ | 400 | /* Idle for a while if we connect to AP a while ago. */ |
| 401 | if (mac->cnt_after_linked >= 2) { | 401 | if (mac->cnt_after_linked >= 2) { |
| @@ -407,7 +407,7 @@ void rtl_lps_enter(struct ieee80211_hw *hw) | |||
| 407 | } | 407 | } |
| 408 | } | 408 | } |
| 409 | 409 | ||
| 410 | spin_unlock(&rtlpriv->locks.lps_lock); | 410 | spin_unlock_irq(&rtlpriv->locks.lps_lock); |
| 411 | } | 411 | } |
| 412 | 412 | ||
| 413 | /*Leave the leisure power save mode.*/ | 413 | /*Leave the leisure power save mode.*/ |
| @@ -416,8 +416,9 @@ void rtl_lps_leave(struct ieee80211_hw *hw) | |||
| 416 | struct rtl_priv *rtlpriv = rtl_priv(hw); | 416 | struct rtl_priv *rtlpriv = rtl_priv(hw); |
| 417 | struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); | 417 | struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); |
| 418 | struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); | 418 | struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); |
| 419 | unsigned long flags; | ||
| 419 | 420 | ||
| 420 | spin_lock(&rtlpriv->locks.lps_lock); | 421 | spin_lock_irqsave(&rtlpriv->locks.lps_lock, flags); |
| 421 | 422 | ||
| 422 | if (ppsc->fwctrl_lps) { | 423 | if (ppsc->fwctrl_lps) { |
| 423 | if (ppsc->dot11_psmode != EACTIVE) { | 424 | if (ppsc->dot11_psmode != EACTIVE) { |
| @@ -438,7 +439,7 @@ void rtl_lps_leave(struct ieee80211_hw *hw) | |||
| 438 | rtl_lps_set_psmode(hw, EACTIVE); | 439 | rtl_lps_set_psmode(hw, EACTIVE); |
| 439 | } | 440 | } |
| 440 | } | 441 | } |
| 441 | spin_unlock(&rtlpriv->locks.lps_lock); | 442 | spin_unlock_irqrestore(&rtlpriv->locks.lps_lock, flags); |
| 442 | } | 443 | } |
| 443 | 444 | ||
| 444 | /* For sw LPS*/ | 445 | /* For sw LPS*/ |
| @@ -539,9 +540,9 @@ void rtl_swlps_rf_awake(struct ieee80211_hw *hw) | |||
| 539 | RT_CLEAR_PS_LEVEL(ppsc, RT_PS_LEVEL_ASPM); | 540 | RT_CLEAR_PS_LEVEL(ppsc, RT_PS_LEVEL_ASPM); |
| 540 | } | 541 | } |
| 541 | 542 | ||
| 542 | spin_lock(&rtlpriv->locks.lps_lock); | 543 | spin_lock_irq(&rtlpriv->locks.lps_lock); |
| 543 | rtl_ps_set_rf_state(hw, ERFON, RF_CHANGE_BY_PS); | 544 | rtl_ps_set_rf_state(hw, ERFON, RF_CHANGE_BY_PS); |
| 544 | spin_unlock(&rtlpriv->locks.lps_lock); | 545 | spin_unlock_irq(&rtlpriv->locks.lps_lock); |
| 545 | } | 546 | } |
| 546 | 547 | ||
| 547 | void rtl_swlps_rfon_wq_callback(void *data) | 548 | void rtl_swlps_rfon_wq_callback(void *data) |
| @@ -574,9 +575,9 @@ void rtl_swlps_rf_sleep(struct ieee80211_hw *hw) | |||
| 574 | if (rtlpriv->link_info.busytraffic) | 575 | if (rtlpriv->link_info.busytraffic) |
| 575 | return; | 576 | return; |
| 576 | 577 | ||
| 577 | spin_lock(&rtlpriv->locks.lps_lock); | 578 | spin_lock_irq(&rtlpriv->locks.lps_lock); |
| 578 | rtl_ps_set_rf_state(hw, ERFSLEEP, RF_CHANGE_BY_PS); | 579 | rtl_ps_set_rf_state(hw, ERFSLEEP, RF_CHANGE_BY_PS); |
| 579 | spin_unlock(&rtlpriv->locks.lps_lock); | 580 | spin_unlock_irq(&rtlpriv->locks.lps_lock); |
| 580 | 581 | ||
| 581 | if (ppsc->reg_rfps_level & RT_RF_OFF_LEVL_ASPM && | 582 | if (ppsc->reg_rfps_level & RT_RF_OFF_LEVL_ASPM && |
| 582 | !RT_IN_PS_LEVEL(ppsc, RT_PS_LEVEL_ASPM)) { | 583 | !RT_IN_PS_LEVEL(ppsc, RT_PS_LEVEL_ASPM)) { |
diff --git a/drivers/net/xen-netback/netback.c b/drivers/net/xen-netback/netback.c index 0cb594c86090..1ae270eed51a 100644 --- a/drivers/net/xen-netback/netback.c +++ b/drivers/net/xen-netback/netback.c | |||
| @@ -1021,7 +1021,7 @@ static int xen_netbk_tx_check_gop(struct xen_netbk *netbk, | |||
| 1021 | pending_idx = *((u16 *)skb->data); | 1021 | pending_idx = *((u16 *)skb->data); |
| 1022 | xen_netbk_idx_release(netbk, pending_idx); | 1022 | xen_netbk_idx_release(netbk, pending_idx); |
| 1023 | for (j = start; j < i; j++) { | 1023 | for (j = start; j < i; j++) { |
| 1024 | pending_idx = frag_get_pending_idx(&shinfo->frags[i]); | 1024 | pending_idx = frag_get_pending_idx(&shinfo->frags[j]); |
| 1025 | xen_netbk_idx_release(netbk, pending_idx); | 1025 | xen_netbk_idx_release(netbk, pending_idx); |
| 1026 | } | 1026 | } |
| 1027 | 1027 | ||
diff --git a/drivers/of/irq.c b/drivers/of/irq.c index 791270b8bd1c..19c0115092dd 100644 --- a/drivers/of/irq.c +++ b/drivers/of/irq.c | |||
| @@ -424,6 +424,8 @@ void __init of_irq_init(const struct of_device_id *matches) | |||
| 424 | 424 | ||
| 425 | desc->dev = np; | 425 | desc->dev = np; |
| 426 | desc->interrupt_parent = of_irq_find_parent(np); | 426 | desc->interrupt_parent = of_irq_find_parent(np); |
| 427 | if (desc->interrupt_parent == np) | ||
| 428 | desc->interrupt_parent = NULL; | ||
| 427 | list_add_tail(&desc->list, &intc_desc_list); | 429 | list_add_tail(&desc->list, &intc_desc_list); |
| 428 | } | 430 | } |
| 429 | 431 | ||
diff --git a/drivers/regulator/aat2870-regulator.c b/drivers/regulator/aat2870-regulator.c index 5abeb3ac3e8d..298c6c6a2795 100644 --- a/drivers/regulator/aat2870-regulator.c +++ b/drivers/regulator/aat2870-regulator.c | |||
| @@ -160,7 +160,7 @@ static struct aat2870_regulator *aat2870_get_regulator(int id) | |||
| 160 | break; | 160 | break; |
| 161 | } | 161 | } |
| 162 | 162 | ||
| 163 | if (!ri) | 163 | if (i == ARRAY_SIZE(aat2870_regulators)) |
| 164 | return NULL; | 164 | return NULL; |
| 165 | 165 | ||
| 166 | ri->enable_addr = AAT2870_LDO_EN; | 166 | ri->enable_addr = AAT2870_LDO_EN; |
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index 669d02160221..938398f3e869 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c | |||
| @@ -2799,8 +2799,8 @@ void regulator_unregister(struct regulator_dev *rdev) | |||
| 2799 | list_del(&rdev->list); | 2799 | list_del(&rdev->list); |
| 2800 | if (rdev->supply) | 2800 | if (rdev->supply) |
| 2801 | regulator_put(rdev->supply); | 2801 | regulator_put(rdev->supply); |
| 2802 | device_unregister(&rdev->dev); | ||
| 2803 | kfree(rdev->constraints); | 2802 | kfree(rdev->constraints); |
| 2803 | device_unregister(&rdev->dev); | ||
| 2804 | mutex_unlock(®ulator_list_mutex); | 2804 | mutex_unlock(®ulator_list_mutex); |
| 2805 | } | 2805 | } |
| 2806 | EXPORT_SYMBOL_GPL(regulator_unregister); | 2806 | EXPORT_SYMBOL_GPL(regulator_unregister); |
diff --git a/drivers/regulator/twl-regulator.c b/drivers/regulator/twl-regulator.c index ee8747f4fa08..11cc308d66e9 100644 --- a/drivers/regulator/twl-regulator.c +++ b/drivers/regulator/twl-regulator.c | |||
| @@ -71,6 +71,7 @@ struct twlreg_info { | |||
| 71 | #define VREG_TYPE 1 | 71 | #define VREG_TYPE 1 |
| 72 | #define VREG_REMAP 2 | 72 | #define VREG_REMAP 2 |
| 73 | #define VREG_DEDICATED 3 /* LDO control */ | 73 | #define VREG_DEDICATED 3 /* LDO control */ |
| 74 | #define VREG_VOLTAGE_SMPS_4030 9 | ||
| 74 | /* TWL6030 register offsets */ | 75 | /* TWL6030 register offsets */ |
| 75 | #define VREG_TRANS 1 | 76 | #define VREG_TRANS 1 |
| 76 | #define VREG_STATE 2 | 77 | #define VREG_STATE 2 |
| @@ -514,6 +515,32 @@ static struct regulator_ops twl4030ldo_ops = { | |||
| 514 | .get_status = twl4030reg_get_status, | 515 | .get_status = twl4030reg_get_status, |
| 515 | }; | 516 | }; |
| 516 | 517 | ||
| 518 | static int | ||
| 519 | twl4030smps_set_voltage(struct regulator_dev *rdev, int min_uV, int max_uV, | ||
| 520 | unsigned *selector) | ||
| 521 | { | ||
| 522 | struct twlreg_info *info = rdev_get_drvdata(rdev); | ||
| 523 | int vsel = DIV_ROUND_UP(min_uV - 600000, 12500); | ||
| 524 | |||
| 525 | twlreg_write(info, TWL_MODULE_PM_RECEIVER, VREG_VOLTAGE_SMPS_4030, | ||
| 526 | vsel); | ||
| 527 | return 0; | ||
| 528 | } | ||
| 529 | |||
| 530 | static int twl4030smps_get_voltage(struct regulator_dev *rdev) | ||
| 531 | { | ||
| 532 | struct twlreg_info *info = rdev_get_drvdata(rdev); | ||
| 533 | int vsel = twlreg_read(info, TWL_MODULE_PM_RECEIVER, | ||
| 534 | VREG_VOLTAGE_SMPS_4030); | ||
| 535 | |||
| 536 | return vsel * 12500 + 600000; | ||
| 537 | } | ||
| 538 | |||
| 539 | static struct regulator_ops twl4030smps_ops = { | ||
| 540 | .set_voltage = twl4030smps_set_voltage, | ||
| 541 | .get_voltage = twl4030smps_get_voltage, | ||
| 542 | }; | ||
| 543 | |||
| 517 | static int twl6030ldo_list_voltage(struct regulator_dev *rdev, unsigned index) | 544 | static int twl6030ldo_list_voltage(struct regulator_dev *rdev, unsigned index) |
| 518 | { | 545 | { |
| 519 | struct twlreg_info *info = rdev_get_drvdata(rdev); | 546 | struct twlreg_info *info = rdev_get_drvdata(rdev); |
| @@ -856,6 +883,21 @@ static struct regulator_ops twlsmps_ops = { | |||
| 856 | }, \ | 883 | }, \ |
| 857 | } | 884 | } |
| 858 | 885 | ||
| 886 | #define TWL4030_ADJUSTABLE_SMPS(label, offset, num, turnon_delay, remap_conf) \ | ||
| 887 | { \ | ||
| 888 | .base = offset, \ | ||
| 889 | .id = num, \ | ||
| 890 | .delay = turnon_delay, \ | ||
| 891 | .remap = remap_conf, \ | ||
| 892 | .desc = { \ | ||
| 893 | .name = #label, \ | ||
| 894 | .id = TWL4030_REG_##label, \ | ||
| 895 | .ops = &twl4030smps_ops, \ | ||
| 896 | .type = REGULATOR_VOLTAGE, \ | ||
| 897 | .owner = THIS_MODULE, \ | ||
| 898 | }, \ | ||
| 899 | } | ||
| 900 | |||
| 859 | #define TWL6030_ADJUSTABLE_LDO(label, offset, min_mVolts, max_mVolts) { \ | 901 | #define TWL6030_ADJUSTABLE_LDO(label, offset, min_mVolts, max_mVolts) { \ |
| 860 | .base = offset, \ | 902 | .base = offset, \ |
| 861 | .min_mV = min_mVolts, \ | 903 | .min_mV = min_mVolts, \ |
| @@ -947,8 +989,8 @@ static struct twlreg_info twl_regs[] = { | |||
| 947 | TWL4030_ADJUSTABLE_LDO(VINTANA2, 0x43, 12, 100, 0x08), | 989 | TWL4030_ADJUSTABLE_LDO(VINTANA2, 0x43, 12, 100, 0x08), |
| 948 | TWL4030_FIXED_LDO(VINTDIG, 0x47, 1500, 13, 100, 0x08), | 990 | TWL4030_FIXED_LDO(VINTDIG, 0x47, 1500, 13, 100, 0x08), |
| 949 | TWL4030_ADJUSTABLE_LDO(VIO, 0x4b, 14, 1000, 0x08), | 991 | TWL4030_ADJUSTABLE_LDO(VIO, 0x4b, 14, 1000, 0x08), |
| 950 | TWL4030_ADJUSTABLE_LDO(VDD1, 0x55, 15, 1000, 0x08), | 992 | TWL4030_ADJUSTABLE_SMPS(VDD1, 0x55, 15, 1000, 0x08), |
| 951 | TWL4030_ADJUSTABLE_LDO(VDD2, 0x63, 16, 1000, 0x08), | 993 | TWL4030_ADJUSTABLE_SMPS(VDD2, 0x63, 16, 1000, 0x08), |
| 952 | TWL4030_FIXED_LDO(VUSB1V5, 0x71, 1500, 17, 100, 0x08), | 994 | TWL4030_FIXED_LDO(VUSB1V5, 0x71, 1500, 17, 100, 0x08), |
| 953 | TWL4030_FIXED_LDO(VUSB1V8, 0x74, 1800, 18, 100, 0x08), | 995 | TWL4030_FIXED_LDO(VUSB1V8, 0x74, 1800, 18, 100, 0x08), |
| 954 | TWL4030_FIXED_LDO(VUSB3V1, 0x77, 3100, 19, 150, 0x08), | 996 | TWL4030_FIXED_LDO(VUSB3V1, 0x77, 3100, 19, 150, 0x08), |
diff --git a/drivers/spi/spi-nuc900.c b/drivers/spi/spi-nuc900.c index e763254741c2..21c70b2b8311 100644 --- a/drivers/spi/spi-nuc900.c +++ b/drivers/spi/spi-nuc900.c | |||
| @@ -426,7 +426,7 @@ static int __devinit nuc900_spi_probe(struct platform_device *pdev) | |||
| 426 | goto err_clk; | 426 | goto err_clk; |
| 427 | } | 427 | } |
| 428 | 428 | ||
| 429 | mfp_set_groupg(&pdev->dev); | 429 | mfp_set_groupg(&pdev->dev, NULL); |
| 430 | nuc900_init_spi(hw); | 430 | nuc900_init_spi(hw); |
| 431 | 431 | ||
| 432 | err = spi_bitbang_start(&hw->bitbang); | 432 | err = spi_bitbang_start(&hw->bitbang); |
diff --git a/drivers/staging/iio/industrialio-core.c b/drivers/staging/iio/industrialio-core.c index 26564094e33b..aec9311b108c 100644 --- a/drivers/staging/iio/industrialio-core.c +++ b/drivers/staging/iio/industrialio-core.c | |||
| @@ -242,25 +242,24 @@ static const struct file_operations iio_event_chrdev_fileops = { | |||
| 242 | 242 | ||
| 243 | static int iio_event_getfd(struct iio_dev *indio_dev) | 243 | static int iio_event_getfd(struct iio_dev *indio_dev) |
| 244 | { | 244 | { |
| 245 | struct iio_event_interface *ev_int = indio_dev->event_interface; | ||
| 245 | int fd; | 246 | int fd; |
| 246 | 247 | ||
| 247 | if (indio_dev->event_interface == NULL) | 248 | if (ev_int == NULL) |
| 248 | return -ENODEV; | 249 | return -ENODEV; |
| 249 | 250 | ||
| 250 | mutex_lock(&indio_dev->event_interface->event_list_lock); | 251 | mutex_lock(&ev_int->event_list_lock); |
| 251 | if (test_and_set_bit(IIO_BUSY_BIT_POS, | 252 | if (test_and_set_bit(IIO_BUSY_BIT_POS, &ev_int->flags)) { |
| 252 | &indio_dev->event_interface->flags)) { | 253 | mutex_unlock(&ev_int->event_list_lock); |
| 253 | mutex_unlock(&indio_dev->event_interface->event_list_lock); | ||
| 254 | return -EBUSY; | 254 | return -EBUSY; |
| 255 | } | 255 | } |
| 256 | mutex_unlock(&indio_dev->event_interface->event_list_lock); | 256 | mutex_unlock(&ev_int->event_list_lock); |
| 257 | fd = anon_inode_getfd("iio:event", | 257 | fd = anon_inode_getfd("iio:event", |
| 258 | &iio_event_chrdev_fileops, | 258 | &iio_event_chrdev_fileops, ev_int, O_RDONLY); |
| 259 | indio_dev->event_interface, O_RDONLY); | ||
| 260 | if (fd < 0) { | 259 | if (fd < 0) { |
| 261 | mutex_lock(&indio_dev->event_interface->event_list_lock); | 260 | mutex_lock(&ev_int->event_list_lock); |
| 262 | clear_bit(IIO_BUSY_BIT_POS, &ev_int->flags); | 261 | clear_bit(IIO_BUSY_BIT_POS, &ev_int->flags); |
| 263 | mutex_unlock(&indio_dev->event_interface->event_list_lock); | 262 | mutex_unlock(&ev_int->event_list_lock); |
| 264 | } | 263 | } |
| 265 | return fd; | 264 | return fd; |
| 266 | } | 265 | } |
diff --git a/drivers/video/da8xx-fb.c b/drivers/video/da8xx-fb.c index 55f91d9ab00b..29577bf1f559 100644 --- a/drivers/video/da8xx-fb.c +++ b/drivers/video/da8xx-fb.c | |||
| @@ -116,6 +116,7 @@ | |||
| 116 | /* Clock registers available only on Version 2 */ | 116 | /* Clock registers available only on Version 2 */ |
| 117 | #define LCD_CLK_ENABLE_REG 0x6c | 117 | #define LCD_CLK_ENABLE_REG 0x6c |
| 118 | #define LCD_CLK_RESET_REG 0x70 | 118 | #define LCD_CLK_RESET_REG 0x70 |
| 119 | #define LCD_CLK_MAIN_RESET BIT(3) | ||
| 119 | 120 | ||
| 120 | #define LCD_NUM_BUFFERS 2 | 121 | #define LCD_NUM_BUFFERS 2 |
| 121 | 122 | ||
| @@ -244,6 +245,10 @@ static inline void lcd_enable_raster(void) | |||
| 244 | { | 245 | { |
| 245 | u32 reg; | 246 | u32 reg; |
| 246 | 247 | ||
| 248 | /* Bring LCDC out of reset */ | ||
| 249 | if (lcd_revision == LCD_VERSION_2) | ||
| 250 | lcdc_write(0, LCD_CLK_RESET_REG); | ||
| 251 | |||
| 247 | reg = lcdc_read(LCD_RASTER_CTRL_REG); | 252 | reg = lcdc_read(LCD_RASTER_CTRL_REG); |
| 248 | if (!(reg & LCD_RASTER_ENABLE)) | 253 | if (!(reg & LCD_RASTER_ENABLE)) |
| 249 | lcdc_write(reg | LCD_RASTER_ENABLE, LCD_RASTER_CTRL_REG); | 254 | lcdc_write(reg | LCD_RASTER_ENABLE, LCD_RASTER_CTRL_REG); |
| @@ -257,6 +262,10 @@ static inline void lcd_disable_raster(void) | |||
| 257 | reg = lcdc_read(LCD_RASTER_CTRL_REG); | 262 | reg = lcdc_read(LCD_RASTER_CTRL_REG); |
| 258 | if (reg & LCD_RASTER_ENABLE) | 263 | if (reg & LCD_RASTER_ENABLE) |
| 259 | lcdc_write(reg & ~LCD_RASTER_ENABLE, LCD_RASTER_CTRL_REG); | 264 | lcdc_write(reg & ~LCD_RASTER_ENABLE, LCD_RASTER_CTRL_REG); |
| 265 | |||
| 266 | if (lcd_revision == LCD_VERSION_2) | ||
| 267 | /* Write 1 to reset LCDC */ | ||
| 268 | lcdc_write(LCD_CLK_MAIN_RESET, LCD_CLK_RESET_REG); | ||
| 260 | } | 269 | } |
| 261 | 270 | ||
| 262 | static void lcd_blit(int load_mode, struct da8xx_fb_par *par) | 271 | static void lcd_blit(int load_mode, struct da8xx_fb_par *par) |
| @@ -584,8 +593,12 @@ static void lcd_reset(struct da8xx_fb_par *par) | |||
| 584 | lcdc_write(0, LCD_DMA_CTRL_REG); | 593 | lcdc_write(0, LCD_DMA_CTRL_REG); |
| 585 | lcdc_write(0, LCD_RASTER_CTRL_REG); | 594 | lcdc_write(0, LCD_RASTER_CTRL_REG); |
| 586 | 595 | ||
| 587 | if (lcd_revision == LCD_VERSION_2) | 596 | if (lcd_revision == LCD_VERSION_2) { |
| 588 | lcdc_write(0, LCD_INT_ENABLE_SET_REG); | 597 | lcdc_write(0, LCD_INT_ENABLE_SET_REG); |
| 598 | /* Write 1 to reset */ | ||
| 599 | lcdc_write(LCD_CLK_MAIN_RESET, LCD_CLK_RESET_REG); | ||
| 600 | lcdc_write(0, LCD_CLK_RESET_REG); | ||
| 601 | } | ||
| 589 | } | 602 | } |
| 590 | 603 | ||
| 591 | static void lcd_calc_clk_divider(struct da8xx_fb_par *par) | 604 | static void lcd_calc_clk_divider(struct da8xx_fb_par *par) |
diff --git a/drivers/video/omap/dispc.c b/drivers/video/omap/dispc.c index 0ccd7adf47bb..6f61e781f15a 100644 --- a/drivers/video/omap/dispc.c +++ b/drivers/video/omap/dispc.c | |||
| @@ -19,6 +19,7 @@ | |||
| 19 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 19 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 20 | */ | 20 | */ |
| 21 | #include <linux/kernel.h> | 21 | #include <linux/kernel.h> |
| 22 | #include <linux/module.h> | ||
| 22 | #include <linux/dma-mapping.h> | 23 | #include <linux/dma-mapping.h> |
| 23 | #include <linux/mm.h> | 24 | #include <linux/mm.h> |
| 24 | #include <linux/vmalloc.h> | 25 | #include <linux/vmalloc.h> |
diff --git a/drivers/video/omap2/dss/dispc.c b/drivers/video/omap2/dss/dispc.c index 3532782551cb..5c81533eacaa 100644 --- a/drivers/video/omap2/dss/dispc.c +++ b/drivers/video/omap2/dss/dispc.c | |||
| @@ -1720,12 +1720,11 @@ static int dispc_ovl_calc_scaling(enum omap_plane plane, | |||
| 1720 | const int maxdownscale = dss_feat_get_param_max(FEAT_PARAM_DOWNSCALE); | 1720 | const int maxdownscale = dss_feat_get_param_max(FEAT_PARAM_DOWNSCALE); |
| 1721 | unsigned long fclk = 0; | 1721 | unsigned long fclk = 0; |
| 1722 | 1722 | ||
| 1723 | if ((ovl->caps & OMAP_DSS_OVL_CAP_SCALE) == 0) { | 1723 | if (width == out_width && height == out_height) |
| 1724 | if (width != out_width || height != out_height) | 1724 | return 0; |
| 1725 | return -EINVAL; | 1725 | |
| 1726 | else | 1726 | if ((ovl->caps & OMAP_DSS_OVL_CAP_SCALE) == 0) |
| 1727 | return 0; | 1727 | return -EINVAL; |
| 1728 | } | ||
| 1729 | 1728 | ||
| 1730 | if (out_width < width / maxdownscale || | 1729 | if (out_width < width / maxdownscale || |
| 1731 | out_width > width * 8) | 1730 | out_width > width * 8) |
diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c index 3262f0f1fa35..c56378c555b0 100644 --- a/drivers/video/omap2/dss/hdmi.c +++ b/drivers/video/omap2/dss/hdmi.c | |||
| @@ -269,7 +269,7 @@ static void update_hdmi_timings(struct hdmi_config *cfg, | |||
| 269 | unsigned long hdmi_get_pixel_clock(void) | 269 | unsigned long hdmi_get_pixel_clock(void) |
| 270 | { | 270 | { |
| 271 | /* HDMI Pixel Clock in Mhz */ | 271 | /* HDMI Pixel Clock in Mhz */ |
| 272 | return hdmi.ip_data.cfg.timings.timings.pixel_clock * 10000; | 272 | return hdmi.ip_data.cfg.timings.timings.pixel_clock * 1000; |
| 273 | } | 273 | } |
| 274 | 274 | ||
| 275 | static void hdmi_compute_pll(struct omap_dss_device *dssdev, int phy, | 275 | static void hdmi_compute_pll(struct omap_dss_device *dssdev, int phy, |
diff --git a/drivers/video/via/share.h b/drivers/video/via/share.h index 69d882cbe709..c01c1c162726 100644 --- a/drivers/video/via/share.h +++ b/drivers/video/via/share.h | |||
| @@ -559,8 +559,8 @@ | |||
| 559 | #define M1200X720_R60_VSP POSITIVE | 559 | #define M1200X720_R60_VSP POSITIVE |
| 560 | 560 | ||
| 561 | /* 1200x900@60 Sync Polarity (DCON) */ | 561 | /* 1200x900@60 Sync Polarity (DCON) */ |
| 562 | #define M1200X900_R60_HSP NEGATIVE | 562 | #define M1200X900_R60_HSP POSITIVE |
| 563 | #define M1200X900_R60_VSP NEGATIVE | 563 | #define M1200X900_R60_VSP POSITIVE |
| 564 | 564 | ||
| 565 | /* 1280x600@60 Sync Polarity (GTF Mode) */ | 565 | /* 1280x600@60 Sync Polarity (GTF Mode) */ |
| 566 | #define M1280x600_R60_HSP NEGATIVE | 566 | #define M1280x600_R60_HSP NEGATIVE |
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index 04a5dfcee5a1..50634abef9b4 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h | |||
| @@ -2369,6 +2369,9 @@ int btrfs_block_rsv_check(struct btrfs_root *root, | |||
| 2369 | int btrfs_block_rsv_refill(struct btrfs_root *root, | 2369 | int btrfs_block_rsv_refill(struct btrfs_root *root, |
| 2370 | struct btrfs_block_rsv *block_rsv, | 2370 | struct btrfs_block_rsv *block_rsv, |
| 2371 | u64 min_reserved); | 2371 | u64 min_reserved); |
| 2372 | int btrfs_block_rsv_refill_noflush(struct btrfs_root *root, | ||
| 2373 | struct btrfs_block_rsv *block_rsv, | ||
| 2374 | u64 min_reserved); | ||
| 2372 | int btrfs_block_rsv_migrate(struct btrfs_block_rsv *src_rsv, | 2375 | int btrfs_block_rsv_migrate(struct btrfs_block_rsv *src_rsv, |
| 2373 | struct btrfs_block_rsv *dst_rsv, | 2376 | struct btrfs_block_rsv *dst_rsv, |
| 2374 | u64 num_bytes); | 2377 | u64 num_bytes); |
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 930ae8949737..f0d5718d2587 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c | |||
| @@ -3888,9 +3888,9 @@ int btrfs_block_rsv_check(struct btrfs_root *root, | |||
| 3888 | return ret; | 3888 | return ret; |
| 3889 | } | 3889 | } |
| 3890 | 3890 | ||
| 3891 | int btrfs_block_rsv_refill(struct btrfs_root *root, | 3891 | static inline int __btrfs_block_rsv_refill(struct btrfs_root *root, |
| 3892 | struct btrfs_block_rsv *block_rsv, | 3892 | struct btrfs_block_rsv *block_rsv, |
| 3893 | u64 min_reserved) | 3893 | u64 min_reserved, int flush) |
| 3894 | { | 3894 | { |
| 3895 | u64 num_bytes = 0; | 3895 | u64 num_bytes = 0; |
| 3896 | int ret = -ENOSPC; | 3896 | int ret = -ENOSPC; |
| @@ -3909,7 +3909,7 @@ int btrfs_block_rsv_refill(struct btrfs_root *root, | |||
| 3909 | if (!ret) | 3909 | if (!ret) |
| 3910 | return 0; | 3910 | return 0; |
| 3911 | 3911 | ||
| 3912 | ret = reserve_metadata_bytes(root, block_rsv, num_bytes, 1); | 3912 | ret = reserve_metadata_bytes(root, block_rsv, num_bytes, flush); |
| 3913 | if (!ret) { | 3913 | if (!ret) { |
| 3914 | block_rsv_add_bytes(block_rsv, num_bytes, 0); | 3914 | block_rsv_add_bytes(block_rsv, num_bytes, 0); |
| 3915 | return 0; | 3915 | return 0; |
| @@ -3918,6 +3918,20 @@ int btrfs_block_rsv_refill(struct btrfs_root *root, | |||
| 3918 | return ret; | 3918 | return ret; |
| 3919 | } | 3919 | } |
| 3920 | 3920 | ||
| 3921 | int btrfs_block_rsv_refill(struct btrfs_root *root, | ||
| 3922 | struct btrfs_block_rsv *block_rsv, | ||
| 3923 | u64 min_reserved) | ||
| 3924 | { | ||
| 3925 | return __btrfs_block_rsv_refill(root, block_rsv, min_reserved, 1); | ||
| 3926 | } | ||
| 3927 | |||
| 3928 | int btrfs_block_rsv_refill_noflush(struct btrfs_root *root, | ||
| 3929 | struct btrfs_block_rsv *block_rsv, | ||
| 3930 | u64 min_reserved) | ||
| 3931 | { | ||
| 3932 | return __btrfs_block_rsv_refill(root, block_rsv, min_reserved, 0); | ||
| 3933 | } | ||
| 3934 | |||
| 3921 | int btrfs_block_rsv_migrate(struct btrfs_block_rsv *src_rsv, | 3935 | int btrfs_block_rsv_migrate(struct btrfs_block_rsv *src_rsv, |
| 3922 | struct btrfs_block_rsv *dst_rsv, | 3936 | struct btrfs_block_rsv *dst_rsv, |
| 3923 | u64 num_bytes) | 3937 | u64 num_bytes) |
| @@ -5265,7 +5279,7 @@ alloc: | |||
| 5265 | spin_lock(&block_group->free_space_ctl->tree_lock); | 5279 | spin_lock(&block_group->free_space_ctl->tree_lock); |
| 5266 | if (cached && | 5280 | if (cached && |
| 5267 | block_group->free_space_ctl->free_space < | 5281 | block_group->free_space_ctl->free_space < |
| 5268 | num_bytes + empty_size) { | 5282 | num_bytes + empty_cluster + empty_size) { |
| 5269 | spin_unlock(&block_group->free_space_ctl->tree_lock); | 5283 | spin_unlock(&block_group->free_space_ctl->tree_lock); |
| 5270 | goto loop; | 5284 | goto loop; |
| 5271 | } | 5285 | } |
| @@ -5286,12 +5300,10 @@ alloc: | |||
| 5286 | * people trying to start a new cluster | 5300 | * people trying to start a new cluster |
| 5287 | */ | 5301 | */ |
| 5288 | spin_lock(&last_ptr->refill_lock); | 5302 | spin_lock(&last_ptr->refill_lock); |
| 5289 | if (last_ptr->block_group && | 5303 | if (!last_ptr->block_group || |
| 5290 | (last_ptr->block_group->ro || | 5304 | last_ptr->block_group->ro || |
| 5291 | !block_group_bits(last_ptr->block_group, data))) { | 5305 | !block_group_bits(last_ptr->block_group, data)) |
| 5292 | offset = 0; | ||
| 5293 | goto refill_cluster; | 5306 | goto refill_cluster; |
| 5294 | } | ||
| 5295 | 5307 | ||
| 5296 | offset = btrfs_alloc_from_cluster(block_group, last_ptr, | 5308 | offset = btrfs_alloc_from_cluster(block_group, last_ptr, |
| 5297 | num_bytes, search_start); | 5309 | num_bytes, search_start); |
| @@ -5342,7 +5354,7 @@ refill_cluster: | |||
| 5342 | /* allocate a cluster in this block group */ | 5354 | /* allocate a cluster in this block group */ |
| 5343 | ret = btrfs_find_space_cluster(trans, root, | 5355 | ret = btrfs_find_space_cluster(trans, root, |
| 5344 | block_group, last_ptr, | 5356 | block_group, last_ptr, |
| 5345 | offset, num_bytes, | 5357 | search_start, num_bytes, |
| 5346 | empty_cluster + empty_size); | 5358 | empty_cluster + empty_size); |
| 5347 | if (ret == 0) { | 5359 | if (ret == 0) { |
| 5348 | /* | 5360 | /* |
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index 9472d3de5e52..be1bf627a14b 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c | |||
| @@ -2287,14 +2287,20 @@ static void end_bio_extent_readpage(struct bio *bio, int err) | |||
| 2287 | if (!uptodate) { | 2287 | if (!uptodate) { |
| 2288 | int failed_mirror; | 2288 | int failed_mirror; |
| 2289 | failed_mirror = (int)(unsigned long)bio->bi_bdev; | 2289 | failed_mirror = (int)(unsigned long)bio->bi_bdev; |
| 2290 | if (tree->ops && tree->ops->readpage_io_failed_hook) | 2290 | /* |
| 2291 | ret = tree->ops->readpage_io_failed_hook( | 2291 | * The generic bio_readpage_error handles errors the |
| 2292 | bio, page, start, end, | 2292 | * following way: If possible, new read requests are |
| 2293 | failed_mirror, state); | 2293 | * created and submitted and will end up in |
| 2294 | else | 2294 | * end_bio_extent_readpage as well (if we're lucky, not |
| 2295 | ret = bio_readpage_error(bio, page, start, end, | 2295 | * in the !uptodate case). In that case it returns 0 and |
| 2296 | failed_mirror, NULL); | 2296 | * we just go on with the next page in our bio. If it |
| 2297 | * can't handle the error it will return -EIO and we | ||
| 2298 | * remain responsible for that page. | ||
| 2299 | */ | ||
| 2300 | ret = bio_readpage_error(bio, page, start, end, | ||
| 2301 | failed_mirror, NULL); | ||
| 2297 | if (ret == 0) { | 2302 | if (ret == 0) { |
| 2303 | error_handled: | ||
| 2298 | uptodate = | 2304 | uptodate = |
| 2299 | test_bit(BIO_UPTODATE, &bio->bi_flags); | 2305 | test_bit(BIO_UPTODATE, &bio->bi_flags); |
| 2300 | if (err) | 2306 | if (err) |
| @@ -2302,6 +2308,13 @@ static void end_bio_extent_readpage(struct bio *bio, int err) | |||
| 2302 | uncache_state(&cached); | 2308 | uncache_state(&cached); |
| 2303 | continue; | 2309 | continue; |
| 2304 | } | 2310 | } |
| 2311 | if (tree->ops && tree->ops->readpage_io_failed_hook) { | ||
| 2312 | ret = tree->ops->readpage_io_failed_hook( | ||
| 2313 | bio, page, start, end, | ||
| 2314 | failed_mirror, state); | ||
| 2315 | if (ret == 0) | ||
| 2316 | goto error_handled; | ||
| 2317 | } | ||
| 2305 | } | 2318 | } |
| 2306 | 2319 | ||
| 2307 | if (uptodate) { | 2320 | if (uptodate) { |
diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c index 6e5b7e463698..ec23d43d0c35 100644 --- a/fs/btrfs/free-space-cache.c +++ b/fs/btrfs/free-space-cache.c | |||
| @@ -1470,6 +1470,7 @@ static void add_new_bitmap(struct btrfs_free_space_ctl *ctl, | |||
| 1470 | { | 1470 | { |
| 1471 | info->offset = offset_to_bitmap(ctl, offset); | 1471 | info->offset = offset_to_bitmap(ctl, offset); |
| 1472 | info->bytes = 0; | 1472 | info->bytes = 0; |
| 1473 | INIT_LIST_HEAD(&info->list); | ||
| 1473 | link_free_space(ctl, info); | 1474 | link_free_space(ctl, info); |
| 1474 | ctl->total_bitmaps++; | 1475 | ctl->total_bitmaps++; |
| 1475 | 1476 | ||
| @@ -2319,6 +2320,7 @@ again: | |||
| 2319 | 2320 | ||
| 2320 | if (!found) { | 2321 | if (!found) { |
| 2321 | start = i; | 2322 | start = i; |
| 2323 | cluster->max_size = 0; | ||
| 2322 | found = true; | 2324 | found = true; |
| 2323 | } | 2325 | } |
| 2324 | 2326 | ||
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 526dd51a1966..2c984f7d4c2a 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
| @@ -3490,7 +3490,7 @@ void btrfs_evict_inode(struct inode *inode) | |||
| 3490 | * doing the truncate. | 3490 | * doing the truncate. |
| 3491 | */ | 3491 | */ |
| 3492 | while (1) { | 3492 | while (1) { |
| 3493 | ret = btrfs_block_rsv_refill(root, rsv, min_size); | 3493 | ret = btrfs_block_rsv_refill_noflush(root, rsv, min_size); |
| 3494 | 3494 | ||
| 3495 | /* | 3495 | /* |
| 3496 | * Try and steal from the global reserve since we will | 3496 | * Try and steal from the global reserve since we will |
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index a90e749ed6d2..72d461656f60 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c | |||
| @@ -1278,7 +1278,7 @@ static noinline int btrfs_ioctl_resize(struct btrfs_root *root, | |||
| 1278 | } | 1278 | } |
| 1279 | ret = btrfs_grow_device(trans, device, new_size); | 1279 | ret = btrfs_grow_device(trans, device, new_size); |
| 1280 | btrfs_commit_transaction(trans, root); | 1280 | btrfs_commit_transaction(trans, root); |
| 1281 | } else { | 1281 | } else if (new_size < old_size) { |
| 1282 | ret = btrfs_shrink_device(device, new_size); | 1282 | ret = btrfs_shrink_device(device, new_size); |
| 1283 | } | 1283 | } |
| 1284 | 1284 | ||
diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c index fab420db5121..c27bcb67f330 100644 --- a/fs/btrfs/scrub.c +++ b/fs/btrfs/scrub.c | |||
| @@ -256,6 +256,11 @@ static int scrub_print_warning_inode(u64 inum, u64 offset, u64 root, void *ctx) | |||
| 256 | btrfs_release_path(swarn->path); | 256 | btrfs_release_path(swarn->path); |
| 257 | 257 | ||
| 258 | ipath = init_ipath(4096, local_root, swarn->path); | 258 | ipath = init_ipath(4096, local_root, swarn->path); |
| 259 | if (IS_ERR(ipath)) { | ||
| 260 | ret = PTR_ERR(ipath); | ||
| 261 | ipath = NULL; | ||
| 262 | goto err; | ||
| 263 | } | ||
| 259 | ret = paths_from_inode(inum, ipath); | 264 | ret = paths_from_inode(inum, ipath); |
| 260 | 265 | ||
| 261 | if (ret < 0) | 266 | if (ret < 0) |
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index 17ee7fc5e64e..e28ad4baf483 100644 --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c | |||
| @@ -1057,7 +1057,7 @@ static int btrfs_calc_avail_data_space(struct btrfs_root *root, u64 *free_bytes) | |||
| 1057 | int i = 0, nr_devices; | 1057 | int i = 0, nr_devices; |
| 1058 | int ret; | 1058 | int ret; |
| 1059 | 1059 | ||
| 1060 | nr_devices = fs_info->fs_devices->rw_devices; | 1060 | nr_devices = fs_info->fs_devices->open_devices; |
| 1061 | BUG_ON(!nr_devices); | 1061 | BUG_ON(!nr_devices); |
| 1062 | 1062 | ||
| 1063 | devices_info = kmalloc(sizeof(*devices_info) * nr_devices, | 1063 | devices_info = kmalloc(sizeof(*devices_info) * nr_devices, |
| @@ -1079,8 +1079,8 @@ static int btrfs_calc_avail_data_space(struct btrfs_root *root, u64 *free_bytes) | |||
| 1079 | else | 1079 | else |
| 1080 | min_stripe_size = BTRFS_STRIPE_LEN; | 1080 | min_stripe_size = BTRFS_STRIPE_LEN; |
| 1081 | 1081 | ||
| 1082 | list_for_each_entry(device, &fs_devices->alloc_list, dev_alloc_list) { | 1082 | list_for_each_entry(device, &fs_devices->devices, dev_list) { |
| 1083 | if (!device->in_fs_metadata) | 1083 | if (!device->in_fs_metadata || !device->bdev) |
| 1084 | continue; | 1084 | continue; |
| 1085 | 1085 | ||
| 1086 | avail_space = device->total_bytes - device->bytes_used; | 1086 | avail_space = device->total_bytes - device->bytes_used; |
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index fffec40d5996..848f436df29f 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c | |||
| @@ -2807,8 +2807,8 @@ out: | |||
| 2807 | spin_unlock_irqrestore(&ei->i_completed_io_lock, flags); | 2807 | spin_unlock_irqrestore(&ei->i_completed_io_lock, flags); |
| 2808 | 2808 | ||
| 2809 | /* queue the work to convert unwritten extents to written */ | 2809 | /* queue the work to convert unwritten extents to written */ |
| 2810 | queue_work(wq, &io_end->work); | ||
| 2811 | iocb->private = NULL; | 2810 | iocb->private = NULL; |
| 2811 | queue_work(wq, &io_end->work); | ||
| 2812 | 2812 | ||
| 2813 | /* XXX: probably should move into the real I/O completion handler */ | 2813 | /* XXX: probably should move into the real I/O completion handler */ |
| 2814 | inode_dio_done(inode); | 2814 | inode_dio_done(inode); |
diff --git a/fs/ocfs2/alloc.c b/fs/ocfs2/alloc.c index ed553c60de82..3165aebb43c8 100644 --- a/fs/ocfs2/alloc.c +++ b/fs/ocfs2/alloc.c | |||
| @@ -5699,7 +5699,7 @@ int ocfs2_remove_btree_range(struct inode *inode, | |||
| 5699 | OCFS2_JOURNAL_ACCESS_WRITE); | 5699 | OCFS2_JOURNAL_ACCESS_WRITE); |
| 5700 | if (ret) { | 5700 | if (ret) { |
| 5701 | mlog_errno(ret); | 5701 | mlog_errno(ret); |
| 5702 | goto out; | 5702 | goto out_commit; |
| 5703 | } | 5703 | } |
| 5704 | 5704 | ||
| 5705 | dquot_free_space_nodirty(inode, | 5705 | dquot_free_space_nodirty(inode, |
diff --git a/fs/ocfs2/aops.c b/fs/ocfs2/aops.c index c1efe939c774..78b68af3b0e3 100644 --- a/fs/ocfs2/aops.c +++ b/fs/ocfs2/aops.c | |||
| @@ -290,7 +290,15 @@ static int ocfs2_readpage(struct file *file, struct page *page) | |||
| 290 | } | 290 | } |
| 291 | 291 | ||
| 292 | if (down_read_trylock(&oi->ip_alloc_sem) == 0) { | 292 | if (down_read_trylock(&oi->ip_alloc_sem) == 0) { |
| 293 | /* | ||
| 294 | * Unlock the page and cycle ip_alloc_sem so that we don't | ||
| 295 | * busyloop waiting for ip_alloc_sem to unlock | ||
| 296 | */ | ||
| 293 | ret = AOP_TRUNCATED_PAGE; | 297 | ret = AOP_TRUNCATED_PAGE; |
| 298 | unlock_page(page); | ||
| 299 | unlock = 0; | ||
| 300 | down_read(&oi->ip_alloc_sem); | ||
| 301 | up_read(&oi->ip_alloc_sem); | ||
| 294 | goto out_inode_unlock; | 302 | goto out_inode_unlock; |
| 295 | } | 303 | } |
| 296 | 304 | ||
| @@ -563,6 +571,7 @@ static void ocfs2_dio_end_io(struct kiocb *iocb, | |||
| 563 | { | 571 | { |
| 564 | struct inode *inode = iocb->ki_filp->f_path.dentry->d_inode; | 572 | struct inode *inode = iocb->ki_filp->f_path.dentry->d_inode; |
| 565 | int level; | 573 | int level; |
| 574 | wait_queue_head_t *wq = ocfs2_ioend_wq(inode); | ||
| 566 | 575 | ||
| 567 | /* this io's submitter should not have unlocked this before we could */ | 576 | /* this io's submitter should not have unlocked this before we could */ |
| 568 | BUG_ON(!ocfs2_iocb_is_rw_locked(iocb)); | 577 | BUG_ON(!ocfs2_iocb_is_rw_locked(iocb)); |
| @@ -570,6 +579,15 @@ static void ocfs2_dio_end_io(struct kiocb *iocb, | |||
| 570 | if (ocfs2_iocb_is_sem_locked(iocb)) | 579 | if (ocfs2_iocb_is_sem_locked(iocb)) |
| 571 | ocfs2_iocb_clear_sem_locked(iocb); | 580 | ocfs2_iocb_clear_sem_locked(iocb); |
| 572 | 581 | ||
| 582 | if (ocfs2_iocb_is_unaligned_aio(iocb)) { | ||
| 583 | ocfs2_iocb_clear_unaligned_aio(iocb); | ||
| 584 | |||
| 585 | if (atomic_dec_and_test(&OCFS2_I(inode)->ip_unaligned_aio) && | ||
| 586 | waitqueue_active(wq)) { | ||
| 587 | wake_up_all(wq); | ||
| 588 | } | ||
| 589 | } | ||
| 590 | |||
| 573 | ocfs2_iocb_clear_rw_locked(iocb); | 591 | ocfs2_iocb_clear_rw_locked(iocb); |
| 574 | 592 | ||
| 575 | level = ocfs2_iocb_rw_locked_level(iocb); | 593 | level = ocfs2_iocb_rw_locked_level(iocb); |
| @@ -863,6 +881,12 @@ struct ocfs2_write_ctxt { | |||
| 863 | struct page *w_target_page; | 881 | struct page *w_target_page; |
| 864 | 882 | ||
| 865 | /* | 883 | /* |
| 884 | * w_target_locked is used for page_mkwrite path indicating no unlocking | ||
| 885 | * against w_target_page in ocfs2_write_end_nolock. | ||
| 886 | */ | ||
| 887 | unsigned int w_target_locked:1; | ||
| 888 | |||
| 889 | /* | ||
| 866 | * ocfs2_write_end() uses this to know what the real range to | 890 | * ocfs2_write_end() uses this to know what the real range to |
| 867 | * write in the target should be. | 891 | * write in the target should be. |
| 868 | */ | 892 | */ |
| @@ -895,6 +919,24 @@ void ocfs2_unlock_and_free_pages(struct page **pages, int num_pages) | |||
| 895 | 919 | ||
| 896 | static void ocfs2_free_write_ctxt(struct ocfs2_write_ctxt *wc) | 920 | static void ocfs2_free_write_ctxt(struct ocfs2_write_ctxt *wc) |
| 897 | { | 921 | { |
| 922 | int i; | ||
| 923 | |||
| 924 | /* | ||
| 925 | * w_target_locked is only set to true in the page_mkwrite() case. | ||
| 926 | * The intent is to allow us to lock the target page from write_begin() | ||
| 927 | * to write_end(). The caller must hold a ref on w_target_page. | ||
| 928 | */ | ||
| 929 | if (wc->w_target_locked) { | ||
| 930 | BUG_ON(!wc->w_target_page); | ||
| 931 | for (i = 0; i < wc->w_num_pages; i++) { | ||
| 932 | if (wc->w_target_page == wc->w_pages[i]) { | ||
| 933 | wc->w_pages[i] = NULL; | ||
| 934 | break; | ||
| 935 | } | ||
| 936 | } | ||
| 937 | mark_page_accessed(wc->w_target_page); | ||
| 938 | page_cache_release(wc->w_target_page); | ||
| 939 | } | ||
| 898 | ocfs2_unlock_and_free_pages(wc->w_pages, wc->w_num_pages); | 940 | ocfs2_unlock_and_free_pages(wc->w_pages, wc->w_num_pages); |
| 899 | 941 | ||
| 900 | brelse(wc->w_di_bh); | 942 | brelse(wc->w_di_bh); |
| @@ -1132,20 +1174,17 @@ static int ocfs2_grab_pages_for_write(struct address_space *mapping, | |||
| 1132 | */ | 1174 | */ |
| 1133 | lock_page(mmap_page); | 1175 | lock_page(mmap_page); |
| 1134 | 1176 | ||
| 1177 | /* Exit and let the caller retry */ | ||
| 1135 | if (mmap_page->mapping != mapping) { | 1178 | if (mmap_page->mapping != mapping) { |
| 1179 | WARN_ON(mmap_page->mapping); | ||
| 1136 | unlock_page(mmap_page); | 1180 | unlock_page(mmap_page); |
| 1137 | /* | 1181 | ret = -EAGAIN; |
| 1138 | * Sanity check - the locking in | ||
| 1139 | * ocfs2_pagemkwrite() should ensure | ||
| 1140 | * that this code doesn't trigger. | ||
| 1141 | */ | ||
| 1142 | ret = -EINVAL; | ||
| 1143 | mlog_errno(ret); | ||
| 1144 | goto out; | 1182 | goto out; |
| 1145 | } | 1183 | } |
| 1146 | 1184 | ||
| 1147 | page_cache_get(mmap_page); | 1185 | page_cache_get(mmap_page); |
| 1148 | wc->w_pages[i] = mmap_page; | 1186 | wc->w_pages[i] = mmap_page; |
| 1187 | wc->w_target_locked = true; | ||
| 1149 | } else { | 1188 | } else { |
| 1150 | wc->w_pages[i] = find_or_create_page(mapping, index, | 1189 | wc->w_pages[i] = find_or_create_page(mapping, index, |
| 1151 | GFP_NOFS); | 1190 | GFP_NOFS); |
| @@ -1160,6 +1199,8 @@ static int ocfs2_grab_pages_for_write(struct address_space *mapping, | |||
| 1160 | wc->w_target_page = wc->w_pages[i]; | 1199 | wc->w_target_page = wc->w_pages[i]; |
| 1161 | } | 1200 | } |
| 1162 | out: | 1201 | out: |
| 1202 | if (ret) | ||
| 1203 | wc->w_target_locked = false; | ||
| 1163 | return ret; | 1204 | return ret; |
| 1164 | } | 1205 | } |
| 1165 | 1206 | ||
| @@ -1817,11 +1858,23 @@ try_again: | |||
| 1817 | */ | 1858 | */ |
| 1818 | ret = ocfs2_grab_pages_for_write(mapping, wc, wc->w_cpos, pos, len, | 1859 | ret = ocfs2_grab_pages_for_write(mapping, wc, wc->w_cpos, pos, len, |
| 1819 | cluster_of_pages, mmap_page); | 1860 | cluster_of_pages, mmap_page); |
| 1820 | if (ret) { | 1861 | if (ret && ret != -EAGAIN) { |
| 1821 | mlog_errno(ret); | 1862 | mlog_errno(ret); |
| 1822 | goto out_quota; | 1863 | goto out_quota; |
| 1823 | } | 1864 | } |
| 1824 | 1865 | ||
| 1866 | /* | ||
| 1867 | * ocfs2_grab_pages_for_write() returns -EAGAIN if it could not lock | ||
| 1868 | * the target page. In this case, we exit with no error and no target | ||
| 1869 | * page. This will trigger the caller, page_mkwrite(), to re-try | ||
| 1870 | * the operation. | ||
| 1871 | */ | ||
| 1872 | if (ret == -EAGAIN) { | ||
| 1873 | BUG_ON(wc->w_target_page); | ||
| 1874 | ret = 0; | ||
| 1875 | goto out_quota; | ||
| 1876 | } | ||
| 1877 | |||
| 1825 | ret = ocfs2_write_cluster_by_desc(mapping, data_ac, meta_ac, wc, pos, | 1878 | ret = ocfs2_write_cluster_by_desc(mapping, data_ac, meta_ac, wc, pos, |
| 1826 | len); | 1879 | len); |
| 1827 | if (ret) { | 1880 | if (ret) { |
diff --git a/fs/ocfs2/aops.h b/fs/ocfs2/aops.h index 75cf3ad987a6..ffb2da370a99 100644 --- a/fs/ocfs2/aops.h +++ b/fs/ocfs2/aops.h | |||
| @@ -78,6 +78,7 @@ enum ocfs2_iocb_lock_bits { | |||
| 78 | OCFS2_IOCB_RW_LOCK = 0, | 78 | OCFS2_IOCB_RW_LOCK = 0, |
| 79 | OCFS2_IOCB_RW_LOCK_LEVEL, | 79 | OCFS2_IOCB_RW_LOCK_LEVEL, |
| 80 | OCFS2_IOCB_SEM, | 80 | OCFS2_IOCB_SEM, |
| 81 | OCFS2_IOCB_UNALIGNED_IO, | ||
| 81 | OCFS2_IOCB_NUM_LOCKS | 82 | OCFS2_IOCB_NUM_LOCKS |
| 82 | }; | 83 | }; |
| 83 | 84 | ||
| @@ -91,4 +92,17 @@ enum ocfs2_iocb_lock_bits { | |||
| 91 | clear_bit(OCFS2_IOCB_SEM, (unsigned long *)&iocb->private) | 92 | clear_bit(OCFS2_IOCB_SEM, (unsigned long *)&iocb->private) |
| 92 | #define ocfs2_iocb_is_sem_locked(iocb) \ | 93 | #define ocfs2_iocb_is_sem_locked(iocb) \ |
| 93 | test_bit(OCFS2_IOCB_SEM, (unsigned long *)&iocb->private) | 94 | test_bit(OCFS2_IOCB_SEM, (unsigned long *)&iocb->private) |
| 95 | |||
| 96 | #define ocfs2_iocb_set_unaligned_aio(iocb) \ | ||
| 97 | set_bit(OCFS2_IOCB_UNALIGNED_IO, (unsigned long *)&iocb->private) | ||
| 98 | #define ocfs2_iocb_clear_unaligned_aio(iocb) \ | ||
| 99 | clear_bit(OCFS2_IOCB_UNALIGNED_IO, (unsigned long *)&iocb->private) | ||
| 100 | #define ocfs2_iocb_is_unaligned_aio(iocb) \ | ||
| 101 | test_bit(OCFS2_IOCB_UNALIGNED_IO, (unsigned long *)&iocb->private) | ||
| 102 | |||
| 103 | #define OCFS2_IOEND_WQ_HASH_SZ 37 | ||
| 104 | #define ocfs2_ioend_wq(v) (&ocfs2__ioend_wq[((unsigned long)(v)) %\ | ||
| 105 | OCFS2_IOEND_WQ_HASH_SZ]) | ||
| 106 | extern wait_queue_head_t ocfs2__ioend_wq[OCFS2_IOEND_WQ_HASH_SZ]; | ||
| 107 | |||
| 94 | #endif /* OCFS2_FILE_H */ | 108 | #endif /* OCFS2_FILE_H */ |
diff --git a/fs/ocfs2/cluster/heartbeat.c b/fs/ocfs2/cluster/heartbeat.c index 9a3e6bbff27b..a4e855e3690e 100644 --- a/fs/ocfs2/cluster/heartbeat.c +++ b/fs/ocfs2/cluster/heartbeat.c | |||
| @@ -216,6 +216,7 @@ struct o2hb_region { | |||
| 216 | 216 | ||
| 217 | struct list_head hr_all_item; | 217 | struct list_head hr_all_item; |
| 218 | unsigned hr_unclean_stop:1, | 218 | unsigned hr_unclean_stop:1, |
| 219 | hr_aborted_start:1, | ||
| 219 | hr_item_pinned:1, | 220 | hr_item_pinned:1, |
| 220 | hr_item_dropped:1; | 221 | hr_item_dropped:1; |
| 221 | 222 | ||
| @@ -254,6 +255,10 @@ struct o2hb_region { | |||
| 254 | * a more complete api that doesn't lead to this sort of fragility. */ | 255 | * a more complete api that doesn't lead to this sort of fragility. */ |
| 255 | atomic_t hr_steady_iterations; | 256 | atomic_t hr_steady_iterations; |
| 256 | 257 | ||
| 258 | /* terminate o2hb thread if it does not reach steady state | ||
| 259 | * (hr_steady_iterations == 0) within hr_unsteady_iterations */ | ||
| 260 | atomic_t hr_unsteady_iterations; | ||
| 261 | |||
| 257 | char hr_dev_name[BDEVNAME_SIZE]; | 262 | char hr_dev_name[BDEVNAME_SIZE]; |
| 258 | 263 | ||
| 259 | unsigned int hr_timeout_ms; | 264 | unsigned int hr_timeout_ms; |
| @@ -324,6 +329,10 @@ static void o2hb_write_timeout(struct work_struct *work) | |||
| 324 | 329 | ||
| 325 | static void o2hb_arm_write_timeout(struct o2hb_region *reg) | 330 | static void o2hb_arm_write_timeout(struct o2hb_region *reg) |
| 326 | { | 331 | { |
| 332 | /* Arm writeout only after thread reaches steady state */ | ||
| 333 | if (atomic_read(®->hr_steady_iterations) != 0) | ||
| 334 | return; | ||
| 335 | |||
| 327 | mlog(ML_HEARTBEAT, "Queue write timeout for %u ms\n", | 336 | mlog(ML_HEARTBEAT, "Queue write timeout for %u ms\n", |
| 328 | O2HB_MAX_WRITE_TIMEOUT_MS); | 337 | O2HB_MAX_WRITE_TIMEOUT_MS); |
| 329 | 338 | ||
| @@ -537,9 +546,14 @@ static int o2hb_verify_crc(struct o2hb_region *reg, | |||
| 537 | return read == computed; | 546 | return read == computed; |
| 538 | } | 547 | } |
| 539 | 548 | ||
| 540 | /* We want to make sure that nobody is heartbeating on top of us -- | 549 | /* |
| 541 | * this will help detect an invalid configuration. */ | 550 | * Compare the slot data with what we wrote in the last iteration. |
| 542 | static void o2hb_check_last_timestamp(struct o2hb_region *reg) | 551 | * If the match fails, print an appropriate error message. This is to |
| 552 | * detect errors like... another node hearting on the same slot, | ||
| 553 | * flaky device that is losing writes, etc. | ||
| 554 | * Returns 1 if check succeeds, 0 otherwise. | ||
| 555 | */ | ||
| 556 | static int o2hb_check_own_slot(struct o2hb_region *reg) | ||
| 543 | { | 557 | { |
| 544 | struct o2hb_disk_slot *slot; | 558 | struct o2hb_disk_slot *slot; |
| 545 | struct o2hb_disk_heartbeat_block *hb_block; | 559 | struct o2hb_disk_heartbeat_block *hb_block; |
| @@ -548,13 +562,13 @@ static void o2hb_check_last_timestamp(struct o2hb_region *reg) | |||
| 548 | slot = ®->hr_slots[o2nm_this_node()]; | 562 | slot = ®->hr_slots[o2nm_this_node()]; |
| 549 | /* Don't check on our 1st timestamp */ | 563 | /* Don't check on our 1st timestamp */ |
| 550 | if (!slot->ds_last_time) | 564 | if (!slot->ds_last_time) |
| 551 | return; | 565 | return 0; |
| 552 | 566 | ||
| 553 | hb_block = slot->ds_raw_block; | 567 | hb_block = slot->ds_raw_block; |
| 554 | if (le64_to_cpu(hb_block->hb_seq) == slot->ds_last_time && | 568 | if (le64_to_cpu(hb_block->hb_seq) == slot->ds_last_time && |
| 555 | le64_to_cpu(hb_block->hb_generation) == slot->ds_last_generation && | 569 | le64_to_cpu(hb_block->hb_generation) == slot->ds_last_generation && |
| 556 | hb_block->hb_node == slot->ds_node_num) | 570 | hb_block->hb_node == slot->ds_node_num) |
| 557 | return; | 571 | return 1; |
| 558 | 572 | ||
| 559 | #define ERRSTR1 "Another node is heartbeating on device" | 573 | #define ERRSTR1 "Another node is heartbeating on device" |
| 560 | #define ERRSTR2 "Heartbeat generation mismatch on device" | 574 | #define ERRSTR2 "Heartbeat generation mismatch on device" |
| @@ -574,6 +588,8 @@ static void o2hb_check_last_timestamp(struct o2hb_region *reg) | |||
| 574 | (unsigned long long)slot->ds_last_time, hb_block->hb_node, | 588 | (unsigned long long)slot->ds_last_time, hb_block->hb_node, |
| 575 | (unsigned long long)le64_to_cpu(hb_block->hb_generation), | 589 | (unsigned long long)le64_to_cpu(hb_block->hb_generation), |
| 576 | (unsigned long long)le64_to_cpu(hb_block->hb_seq)); | 590 | (unsigned long long)le64_to_cpu(hb_block->hb_seq)); |
| 591 | |||
| 592 | return 0; | ||
| 577 | } | 593 | } |
| 578 | 594 | ||
| 579 | static inline void o2hb_prepare_block(struct o2hb_region *reg, | 595 | static inline void o2hb_prepare_block(struct o2hb_region *reg, |
| @@ -719,17 +735,24 @@ static void o2hb_shutdown_slot(struct o2hb_disk_slot *slot) | |||
| 719 | o2nm_node_put(node); | 735 | o2nm_node_put(node); |
| 720 | } | 736 | } |
| 721 | 737 | ||
| 722 | static void o2hb_set_quorum_device(struct o2hb_region *reg, | 738 | static void o2hb_set_quorum_device(struct o2hb_region *reg) |
| 723 | struct o2hb_disk_slot *slot) | ||
| 724 | { | 739 | { |
| 725 | assert_spin_locked(&o2hb_live_lock); | ||
| 726 | |||
| 727 | if (!o2hb_global_heartbeat_active()) | 740 | if (!o2hb_global_heartbeat_active()) |
| 728 | return; | 741 | return; |
| 729 | 742 | ||
| 730 | if (test_bit(reg->hr_region_num, o2hb_quorum_region_bitmap)) | 743 | /* Prevent race with o2hb_heartbeat_group_drop_item() */ |
| 744 | if (kthread_should_stop()) | ||
| 745 | return; | ||
| 746 | |||
| 747 | /* Tag region as quorum only after thread reaches steady state */ | ||
| 748 | if (atomic_read(®->hr_steady_iterations) != 0) | ||
| 731 | return; | 749 | return; |
| 732 | 750 | ||
| 751 | spin_lock(&o2hb_live_lock); | ||
| 752 | |||
| 753 | if (test_bit(reg->hr_region_num, o2hb_quorum_region_bitmap)) | ||
| 754 | goto unlock; | ||
| 755 | |||
| 733 | /* | 756 | /* |
| 734 | * A region can be added to the quorum only when it sees all | 757 | * A region can be added to the quorum only when it sees all |
| 735 | * live nodes heartbeat on it. In other words, the region has been | 758 | * live nodes heartbeat on it. In other words, the region has been |
| @@ -737,13 +760,10 @@ static void o2hb_set_quorum_device(struct o2hb_region *reg, | |||
| 737 | */ | 760 | */ |
| 738 | if (memcmp(reg->hr_live_node_bitmap, o2hb_live_node_bitmap, | 761 | if (memcmp(reg->hr_live_node_bitmap, o2hb_live_node_bitmap, |
| 739 | sizeof(o2hb_live_node_bitmap))) | 762 | sizeof(o2hb_live_node_bitmap))) |
| 740 | return; | 763 | goto unlock; |
| 741 | |||
| 742 | if (slot->ds_changed_samples < O2HB_LIVE_THRESHOLD) | ||
| 743 | return; | ||
| 744 | 764 | ||
| 745 | printk(KERN_NOTICE "o2hb: Region %s is now a quorum device\n", | 765 | printk(KERN_NOTICE "o2hb: Region %s (%s) is now a quorum device\n", |
| 746 | config_item_name(®->hr_item)); | 766 | config_item_name(®->hr_item), reg->hr_dev_name); |
| 747 | 767 | ||
| 748 | set_bit(reg->hr_region_num, o2hb_quorum_region_bitmap); | 768 | set_bit(reg->hr_region_num, o2hb_quorum_region_bitmap); |
| 749 | 769 | ||
| @@ -754,6 +774,8 @@ static void o2hb_set_quorum_device(struct o2hb_region *reg, | |||
| 754 | if (o2hb_pop_count(&o2hb_quorum_region_bitmap, | 774 | if (o2hb_pop_count(&o2hb_quorum_region_bitmap, |
| 755 | O2NM_MAX_REGIONS) > O2HB_PIN_CUT_OFF) | 775 | O2NM_MAX_REGIONS) > O2HB_PIN_CUT_OFF) |
| 756 | o2hb_region_unpin(NULL); | 776 | o2hb_region_unpin(NULL); |
| 777 | unlock: | ||
| 778 | spin_unlock(&o2hb_live_lock); | ||
| 757 | } | 779 | } |
| 758 | 780 | ||
| 759 | static int o2hb_check_slot(struct o2hb_region *reg, | 781 | static int o2hb_check_slot(struct o2hb_region *reg, |
| @@ -925,8 +947,6 @@ fire_callbacks: | |||
| 925 | slot->ds_equal_samples = 0; | 947 | slot->ds_equal_samples = 0; |
| 926 | } | 948 | } |
| 927 | out: | 949 | out: |
| 928 | o2hb_set_quorum_device(reg, slot); | ||
| 929 | |||
| 930 | spin_unlock(&o2hb_live_lock); | 950 | spin_unlock(&o2hb_live_lock); |
| 931 | 951 | ||
| 932 | o2hb_run_event_list(&event); | 952 | o2hb_run_event_list(&event); |
| @@ -957,7 +977,8 @@ static int o2hb_highest_node(unsigned long *nodes, | |||
| 957 | 977 | ||
| 958 | static int o2hb_do_disk_heartbeat(struct o2hb_region *reg) | 978 | static int o2hb_do_disk_heartbeat(struct o2hb_region *reg) |
| 959 | { | 979 | { |
| 960 | int i, ret, highest_node, change = 0; | 980 | int i, ret, highest_node; |
| 981 | int membership_change = 0, own_slot_ok = 0; | ||
| 961 | unsigned long configured_nodes[BITS_TO_LONGS(O2NM_MAX_NODES)]; | 982 | unsigned long configured_nodes[BITS_TO_LONGS(O2NM_MAX_NODES)]; |
| 962 | unsigned long live_node_bitmap[BITS_TO_LONGS(O2NM_MAX_NODES)]; | 983 | unsigned long live_node_bitmap[BITS_TO_LONGS(O2NM_MAX_NODES)]; |
| 963 | struct o2hb_bio_wait_ctxt write_wc; | 984 | struct o2hb_bio_wait_ctxt write_wc; |
| @@ -966,7 +987,7 @@ static int o2hb_do_disk_heartbeat(struct o2hb_region *reg) | |||
| 966 | sizeof(configured_nodes)); | 987 | sizeof(configured_nodes)); |
| 967 | if (ret) { | 988 | if (ret) { |
| 968 | mlog_errno(ret); | 989 | mlog_errno(ret); |
| 969 | return ret; | 990 | goto bail; |
| 970 | } | 991 | } |
| 971 | 992 | ||
| 972 | /* | 993 | /* |
| @@ -982,8 +1003,9 @@ static int o2hb_do_disk_heartbeat(struct o2hb_region *reg) | |||
| 982 | 1003 | ||
| 983 | highest_node = o2hb_highest_node(configured_nodes, O2NM_MAX_NODES); | 1004 | highest_node = o2hb_highest_node(configured_nodes, O2NM_MAX_NODES); |
| 984 | if (highest_node >= O2NM_MAX_NODES) { | 1005 | if (highest_node >= O2NM_MAX_NODES) { |
| 985 | mlog(ML_NOTICE, "ocfs2_heartbeat: no configured nodes found!\n"); | 1006 | mlog(ML_NOTICE, "o2hb: No configured nodes found!\n"); |
| 986 | return -EINVAL; | 1007 | ret = -EINVAL; |
| 1008 | goto bail; | ||
| 987 | } | 1009 | } |
| 988 | 1010 | ||
| 989 | /* No sense in reading the slots of nodes that don't exist | 1011 | /* No sense in reading the slots of nodes that don't exist |
| @@ -993,29 +1015,27 @@ static int o2hb_do_disk_heartbeat(struct o2hb_region *reg) | |||
| 993 | ret = o2hb_read_slots(reg, highest_node + 1); | 1015 | ret = o2hb_read_slots(reg, highest_node + 1); |
| 994 | if (ret < 0) { | 1016 | if (ret < 0) { |
| 995 | mlog_errno(ret); | 1017 | mlog_errno(ret); |
| 996 | return ret; | 1018 | goto bail; |
| 997 | } | 1019 | } |
| 998 | 1020 | ||
| 999 | /* With an up to date view of the slots, we can check that no | 1021 | /* With an up to date view of the slots, we can check that no |
| 1000 | * other node has been improperly configured to heartbeat in | 1022 | * other node has been improperly configured to heartbeat in |
| 1001 | * our slot. */ | 1023 | * our slot. */ |
| 1002 | o2hb_check_last_timestamp(reg); | 1024 | own_slot_ok = o2hb_check_own_slot(reg); |
| 1003 | 1025 | ||
| 1004 | /* fill in the proper info for our next heartbeat */ | 1026 | /* fill in the proper info for our next heartbeat */ |
| 1005 | o2hb_prepare_block(reg, reg->hr_generation); | 1027 | o2hb_prepare_block(reg, reg->hr_generation); |
| 1006 | 1028 | ||
| 1007 | /* And fire off the write. Note that we don't wait on this I/O | ||
| 1008 | * until later. */ | ||
| 1009 | ret = o2hb_issue_node_write(reg, &write_wc); | 1029 | ret = o2hb_issue_node_write(reg, &write_wc); |
| 1010 | if (ret < 0) { | 1030 | if (ret < 0) { |
| 1011 | mlog_errno(ret); | 1031 | mlog_errno(ret); |
| 1012 | return ret; | 1032 | goto bail; |
| 1013 | } | 1033 | } |
| 1014 | 1034 | ||
| 1015 | i = -1; | 1035 | i = -1; |
| 1016 | while((i = find_next_bit(configured_nodes, | 1036 | while((i = find_next_bit(configured_nodes, |
| 1017 | O2NM_MAX_NODES, i + 1)) < O2NM_MAX_NODES) { | 1037 | O2NM_MAX_NODES, i + 1)) < O2NM_MAX_NODES) { |
| 1018 | change |= o2hb_check_slot(reg, ®->hr_slots[i]); | 1038 | membership_change |= o2hb_check_slot(reg, ®->hr_slots[i]); |
| 1019 | } | 1039 | } |
| 1020 | 1040 | ||
| 1021 | /* | 1041 | /* |
| @@ -1030,18 +1050,39 @@ static int o2hb_do_disk_heartbeat(struct o2hb_region *reg) | |||
| 1030 | * disk */ | 1050 | * disk */ |
| 1031 | mlog(ML_ERROR, "Write error %d on device \"%s\"\n", | 1051 | mlog(ML_ERROR, "Write error %d on device \"%s\"\n", |
| 1032 | write_wc.wc_error, reg->hr_dev_name); | 1052 | write_wc.wc_error, reg->hr_dev_name); |
| 1033 | return write_wc.wc_error; | 1053 | ret = write_wc.wc_error; |
| 1054 | goto bail; | ||
| 1034 | } | 1055 | } |
| 1035 | 1056 | ||
| 1036 | o2hb_arm_write_timeout(reg); | 1057 | /* Skip disarming the timeout if own slot has stale/bad data */ |
| 1058 | if (own_slot_ok) { | ||
| 1059 | o2hb_set_quorum_device(reg); | ||
| 1060 | o2hb_arm_write_timeout(reg); | ||
| 1061 | } | ||
| 1037 | 1062 | ||
| 1063 | bail: | ||
| 1038 | /* let the person who launched us know when things are steady */ | 1064 | /* let the person who launched us know when things are steady */ |
| 1039 | if (!change && (atomic_read(®->hr_steady_iterations) != 0)) { | 1065 | if (atomic_read(®->hr_steady_iterations) != 0) { |
| 1040 | if (atomic_dec_and_test(®->hr_steady_iterations)) | 1066 | if (!ret && own_slot_ok && !membership_change) { |
| 1067 | if (atomic_dec_and_test(®->hr_steady_iterations)) | ||
| 1068 | wake_up(&o2hb_steady_queue); | ||
| 1069 | } | ||
| 1070 | } | ||
| 1071 | |||
| 1072 | if (atomic_read(®->hr_steady_iterations) != 0) { | ||
| 1073 | if (atomic_dec_and_test(®->hr_unsteady_iterations)) { | ||
| 1074 | printk(KERN_NOTICE "o2hb: Unable to stabilize " | ||
| 1075 | "heartbeart on region %s (%s)\n", | ||
| 1076 | config_item_name(®->hr_item), | ||
| 1077 | reg->hr_dev_name); | ||
| 1078 | atomic_set(®->hr_steady_iterations, 0); | ||
| 1079 | reg->hr_aborted_start = 1; | ||
| 1041 | wake_up(&o2hb_steady_queue); | 1080 | wake_up(&o2hb_steady_queue); |
| 1081 | ret = -EIO; | ||
| 1082 | } | ||
| 1042 | } | 1083 | } |
| 1043 | 1084 | ||
| 1044 | return 0; | 1085 | return ret; |
| 1045 | } | 1086 | } |
| 1046 | 1087 | ||
| 1047 | /* Subtract b from a, storing the result in a. a *must* have a larger | 1088 | /* Subtract b from a, storing the result in a. a *must* have a larger |
| @@ -1095,7 +1136,8 @@ static int o2hb_thread(void *data) | |||
| 1095 | /* Pin node */ | 1136 | /* Pin node */ |
| 1096 | o2nm_depend_this_node(); | 1137 | o2nm_depend_this_node(); |
| 1097 | 1138 | ||
| 1098 | while (!kthread_should_stop() && !reg->hr_unclean_stop) { | 1139 | while (!kthread_should_stop() && |
| 1140 | !reg->hr_unclean_stop && !reg->hr_aborted_start) { | ||
| 1099 | /* We track the time spent inside | 1141 | /* We track the time spent inside |
| 1100 | * o2hb_do_disk_heartbeat so that we avoid more than | 1142 | * o2hb_do_disk_heartbeat so that we avoid more than |
| 1101 | * hr_timeout_ms between disk writes. On busy systems | 1143 | * hr_timeout_ms between disk writes. On busy systems |
| @@ -1103,10 +1145,7 @@ static int o2hb_thread(void *data) | |||
| 1103 | * likely to time itself out. */ | 1145 | * likely to time itself out. */ |
| 1104 | do_gettimeofday(&before_hb); | 1146 | do_gettimeofday(&before_hb); |
| 1105 | 1147 | ||
| 1106 | i = 0; | 1148 | ret = o2hb_do_disk_heartbeat(reg); |
| 1107 | do { | ||
| 1108 | ret = o2hb_do_disk_heartbeat(reg); | ||
| 1109 | } while (ret && ++i < 2); | ||
| 1110 | 1149 | ||
| 1111 | do_gettimeofday(&after_hb); | 1150 | do_gettimeofday(&after_hb); |
| 1112 | elapsed_msec = o2hb_elapsed_msecs(&before_hb, &after_hb); | 1151 | elapsed_msec = o2hb_elapsed_msecs(&before_hb, &after_hb); |
| @@ -1117,7 +1156,8 @@ static int o2hb_thread(void *data) | |||
| 1117 | after_hb.tv_sec, (unsigned long) after_hb.tv_usec, | 1156 | after_hb.tv_sec, (unsigned long) after_hb.tv_usec, |
| 1118 | elapsed_msec); | 1157 | elapsed_msec); |
| 1119 | 1158 | ||
| 1120 | if (elapsed_msec < reg->hr_timeout_ms) { | 1159 | if (!kthread_should_stop() && |
| 1160 | elapsed_msec < reg->hr_timeout_ms) { | ||
| 1121 | /* the kthread api has blocked signals for us so no | 1161 | /* the kthread api has blocked signals for us so no |
| 1122 | * need to record the return value. */ | 1162 | * need to record the return value. */ |
| 1123 | msleep_interruptible(reg->hr_timeout_ms - elapsed_msec); | 1163 | msleep_interruptible(reg->hr_timeout_ms - elapsed_msec); |
| @@ -1134,20 +1174,20 @@ static int o2hb_thread(void *data) | |||
| 1134 | * to timeout on this region when we could just as easily | 1174 | * to timeout on this region when we could just as easily |
| 1135 | * write a clear generation - thus indicating to them that | 1175 | * write a clear generation - thus indicating to them that |
| 1136 | * this node has left this region. | 1176 | * this node has left this region. |
| 1137 | * | 1177 | */ |
| 1138 | * XXX: Should we skip this on unclean_stop? */ | 1178 | if (!reg->hr_unclean_stop && !reg->hr_aborted_start) { |
| 1139 | o2hb_prepare_block(reg, 0); | 1179 | o2hb_prepare_block(reg, 0); |
| 1140 | ret = o2hb_issue_node_write(reg, &write_wc); | 1180 | ret = o2hb_issue_node_write(reg, &write_wc); |
| 1141 | if (ret == 0) { | 1181 | if (ret == 0) |
| 1142 | o2hb_wait_on_io(reg, &write_wc); | 1182 | o2hb_wait_on_io(reg, &write_wc); |
| 1143 | } else { | 1183 | else |
| 1144 | mlog_errno(ret); | 1184 | mlog_errno(ret); |
| 1145 | } | 1185 | } |
| 1146 | 1186 | ||
| 1147 | /* Unpin node */ | 1187 | /* Unpin node */ |
| 1148 | o2nm_undepend_this_node(); | 1188 | o2nm_undepend_this_node(); |
| 1149 | 1189 | ||
| 1150 | mlog(ML_HEARTBEAT|ML_KTHREAD, "hb thread exiting\n"); | 1190 | mlog(ML_HEARTBEAT|ML_KTHREAD, "o2hb thread exiting\n"); |
| 1151 | 1191 | ||
| 1152 | return 0; | 1192 | return 0; |
| 1153 | } | 1193 | } |
| @@ -1158,6 +1198,7 @@ static int o2hb_debug_open(struct inode *inode, struct file *file) | |||
| 1158 | struct o2hb_debug_buf *db = inode->i_private; | 1198 | struct o2hb_debug_buf *db = inode->i_private; |
| 1159 | struct o2hb_region *reg; | 1199 | struct o2hb_region *reg; |
| 1160 | unsigned long map[BITS_TO_LONGS(O2NM_MAX_NODES)]; | 1200 | unsigned long map[BITS_TO_LONGS(O2NM_MAX_NODES)]; |
| 1201 | unsigned long lts; | ||
| 1161 | char *buf = NULL; | 1202 | char *buf = NULL; |
| 1162 | int i = -1; | 1203 | int i = -1; |
| 1163 | int out = 0; | 1204 | int out = 0; |
| @@ -1194,9 +1235,11 @@ static int o2hb_debug_open(struct inode *inode, struct file *file) | |||
| 1194 | 1235 | ||
| 1195 | case O2HB_DB_TYPE_REGION_ELAPSED_TIME: | 1236 | case O2HB_DB_TYPE_REGION_ELAPSED_TIME: |
| 1196 | reg = (struct o2hb_region *)db->db_data; | 1237 | reg = (struct o2hb_region *)db->db_data; |
| 1197 | out += snprintf(buf + out, PAGE_SIZE - out, "%u\n", | 1238 | lts = reg->hr_last_timeout_start; |
| 1198 | jiffies_to_msecs(jiffies - | 1239 | /* If 0, it has never been set before */ |
| 1199 | reg->hr_last_timeout_start)); | 1240 | if (lts) |
| 1241 | lts = jiffies_to_msecs(jiffies - lts); | ||
| 1242 | out += snprintf(buf + out, PAGE_SIZE - out, "%lu\n", lts); | ||
| 1200 | goto done; | 1243 | goto done; |
| 1201 | 1244 | ||
| 1202 | case O2HB_DB_TYPE_REGION_PINNED: | 1245 | case O2HB_DB_TYPE_REGION_PINNED: |
| @@ -1426,6 +1469,8 @@ static void o2hb_region_release(struct config_item *item) | |||
| 1426 | struct page *page; | 1469 | struct page *page; |
| 1427 | struct o2hb_region *reg = to_o2hb_region(item); | 1470 | struct o2hb_region *reg = to_o2hb_region(item); |
| 1428 | 1471 | ||
| 1472 | mlog(ML_HEARTBEAT, "hb region release (%s)\n", reg->hr_dev_name); | ||
| 1473 | |||
| 1429 | if (reg->hr_tmp_block) | 1474 | if (reg->hr_tmp_block) |
| 1430 | kfree(reg->hr_tmp_block); | 1475 | kfree(reg->hr_tmp_block); |
| 1431 | 1476 | ||
| @@ -1792,7 +1837,10 @@ static ssize_t o2hb_region_dev_write(struct o2hb_region *reg, | |||
| 1792 | live_threshold <<= 1; | 1837 | live_threshold <<= 1; |
| 1793 | spin_unlock(&o2hb_live_lock); | 1838 | spin_unlock(&o2hb_live_lock); |
| 1794 | } | 1839 | } |
| 1795 | atomic_set(®->hr_steady_iterations, live_threshold + 1); | 1840 | ++live_threshold; |
| 1841 | atomic_set(®->hr_steady_iterations, live_threshold); | ||
| 1842 | /* unsteady_iterations is double the steady_iterations */ | ||
| 1843 | atomic_set(®->hr_unsteady_iterations, (live_threshold << 1)); | ||
| 1796 | 1844 | ||
| 1797 | hb_task = kthread_run(o2hb_thread, reg, "o2hb-%s", | 1845 | hb_task = kthread_run(o2hb_thread, reg, "o2hb-%s", |
| 1798 | reg->hr_item.ci_name); | 1846 | reg->hr_item.ci_name); |
| @@ -1809,14 +1857,12 @@ static ssize_t o2hb_region_dev_write(struct o2hb_region *reg, | |||
| 1809 | ret = wait_event_interruptible(o2hb_steady_queue, | 1857 | ret = wait_event_interruptible(o2hb_steady_queue, |
| 1810 | atomic_read(®->hr_steady_iterations) == 0); | 1858 | atomic_read(®->hr_steady_iterations) == 0); |
| 1811 | if (ret) { | 1859 | if (ret) { |
| 1812 | /* We got interrupted (hello ptrace!). Clean up */ | 1860 | atomic_set(®->hr_steady_iterations, 0); |
| 1813 | spin_lock(&o2hb_live_lock); | 1861 | reg->hr_aborted_start = 1; |
| 1814 | hb_task = reg->hr_task; | 1862 | } |
| 1815 | reg->hr_task = NULL; | ||
| 1816 | spin_unlock(&o2hb_live_lock); | ||
| 1817 | 1863 | ||
| 1818 | if (hb_task) | 1864 | if (reg->hr_aborted_start) { |
| 1819 | kthread_stop(hb_task); | 1865 | ret = -EIO; |
| 1820 | goto out; | 1866 | goto out; |
| 1821 | } | 1867 | } |
| 1822 | 1868 | ||
| @@ -1833,8 +1879,8 @@ static ssize_t o2hb_region_dev_write(struct o2hb_region *reg, | |||
| 1833 | ret = -EIO; | 1879 | ret = -EIO; |
| 1834 | 1880 | ||
| 1835 | if (hb_task && o2hb_global_heartbeat_active()) | 1881 | if (hb_task && o2hb_global_heartbeat_active()) |
| 1836 | printk(KERN_NOTICE "o2hb: Heartbeat started on region %s\n", | 1882 | printk(KERN_NOTICE "o2hb: Heartbeat started on region %s (%s)\n", |
| 1837 | config_item_name(®->hr_item)); | 1883 | config_item_name(®->hr_item), reg->hr_dev_name); |
| 1838 | 1884 | ||
| 1839 | out: | 1885 | out: |
| 1840 | if (filp) | 1886 | if (filp) |
| @@ -2092,13 +2138,6 @@ static void o2hb_heartbeat_group_drop_item(struct config_group *group, | |||
| 2092 | 2138 | ||
| 2093 | /* stop the thread when the user removes the region dir */ | 2139 | /* stop the thread when the user removes the region dir */ |
| 2094 | spin_lock(&o2hb_live_lock); | 2140 | spin_lock(&o2hb_live_lock); |
| 2095 | if (o2hb_global_heartbeat_active()) { | ||
| 2096 | clear_bit(reg->hr_region_num, o2hb_region_bitmap); | ||
| 2097 | clear_bit(reg->hr_region_num, o2hb_live_region_bitmap); | ||
| 2098 | if (test_bit(reg->hr_region_num, o2hb_quorum_region_bitmap)) | ||
| 2099 | quorum_region = 1; | ||
| 2100 | clear_bit(reg->hr_region_num, o2hb_quorum_region_bitmap); | ||
| 2101 | } | ||
| 2102 | hb_task = reg->hr_task; | 2141 | hb_task = reg->hr_task; |
| 2103 | reg->hr_task = NULL; | 2142 | reg->hr_task = NULL; |
| 2104 | reg->hr_item_dropped = 1; | 2143 | reg->hr_item_dropped = 1; |
| @@ -2107,19 +2146,30 @@ static void o2hb_heartbeat_group_drop_item(struct config_group *group, | |||
| 2107 | if (hb_task) | 2146 | if (hb_task) |
| 2108 | kthread_stop(hb_task); | 2147 | kthread_stop(hb_task); |
| 2109 | 2148 | ||
| 2149 | if (o2hb_global_heartbeat_active()) { | ||
| 2150 | spin_lock(&o2hb_live_lock); | ||
| 2151 | clear_bit(reg->hr_region_num, o2hb_region_bitmap); | ||
| 2152 | clear_bit(reg->hr_region_num, o2hb_live_region_bitmap); | ||
| 2153 | if (test_bit(reg->hr_region_num, o2hb_quorum_region_bitmap)) | ||
| 2154 | quorum_region = 1; | ||
| 2155 | clear_bit(reg->hr_region_num, o2hb_quorum_region_bitmap); | ||
| 2156 | spin_unlock(&o2hb_live_lock); | ||
| 2157 | printk(KERN_NOTICE "o2hb: Heartbeat %s on region %s (%s)\n", | ||
| 2158 | ((atomic_read(®->hr_steady_iterations) == 0) ? | ||
| 2159 | "stopped" : "start aborted"), config_item_name(item), | ||
| 2160 | reg->hr_dev_name); | ||
| 2161 | } | ||
| 2162 | |||
| 2110 | /* | 2163 | /* |
| 2111 | * If we're racing a dev_write(), we need to wake them. They will | 2164 | * If we're racing a dev_write(), we need to wake them. They will |
| 2112 | * check reg->hr_task | 2165 | * check reg->hr_task |
| 2113 | */ | 2166 | */ |
| 2114 | if (atomic_read(®->hr_steady_iterations) != 0) { | 2167 | if (atomic_read(®->hr_steady_iterations) != 0) { |
| 2168 | reg->hr_aborted_start = 1; | ||
| 2115 | atomic_set(®->hr_steady_iterations, 0); | 2169 | atomic_set(®->hr_steady_iterations, 0); |
| 2116 | wake_up(&o2hb_steady_queue); | 2170 | wake_up(&o2hb_steady_queue); |
| 2117 | } | 2171 | } |
| 2118 | 2172 | ||
| 2119 | if (o2hb_global_heartbeat_active()) | ||
| 2120 | printk(KERN_NOTICE "o2hb: Heartbeat stopped on region %s\n", | ||
| 2121 | config_item_name(®->hr_item)); | ||
| 2122 | |||
| 2123 | config_item_put(item); | 2173 | config_item_put(item); |
| 2124 | 2174 | ||
| 2125 | if (!o2hb_global_heartbeat_active() || !quorum_region) | 2175 | if (!o2hb_global_heartbeat_active() || !quorum_region) |
diff --git a/fs/ocfs2/cluster/netdebug.c b/fs/ocfs2/cluster/netdebug.c index 3a5835904b3d..dc45deb19e68 100644 --- a/fs/ocfs2/cluster/netdebug.c +++ b/fs/ocfs2/cluster/netdebug.c | |||
| @@ -47,6 +47,7 @@ | |||
| 47 | #define SC_DEBUG_NAME "sock_containers" | 47 | #define SC_DEBUG_NAME "sock_containers" |
| 48 | #define NST_DEBUG_NAME "send_tracking" | 48 | #define NST_DEBUG_NAME "send_tracking" |
| 49 | #define STATS_DEBUG_NAME "stats" | 49 | #define STATS_DEBUG_NAME "stats" |
| 50 | #define NODES_DEBUG_NAME "connected_nodes" | ||
| 50 | 51 | ||
| 51 | #define SHOW_SOCK_CONTAINERS 0 | 52 | #define SHOW_SOCK_CONTAINERS 0 |
| 52 | #define SHOW_SOCK_STATS 1 | 53 | #define SHOW_SOCK_STATS 1 |
| @@ -55,6 +56,7 @@ static struct dentry *o2net_dentry; | |||
| 55 | static struct dentry *sc_dentry; | 56 | static struct dentry *sc_dentry; |
| 56 | static struct dentry *nst_dentry; | 57 | static struct dentry *nst_dentry; |
| 57 | static struct dentry *stats_dentry; | 58 | static struct dentry *stats_dentry; |
| 59 | static struct dentry *nodes_dentry; | ||
| 58 | 60 | ||
| 59 | static DEFINE_SPINLOCK(o2net_debug_lock); | 61 | static DEFINE_SPINLOCK(o2net_debug_lock); |
| 60 | 62 | ||
| @@ -491,53 +493,87 @@ static const struct file_operations sc_seq_fops = { | |||
| 491 | .release = sc_fop_release, | 493 | .release = sc_fop_release, |
| 492 | }; | 494 | }; |
| 493 | 495 | ||
| 494 | int o2net_debugfs_init(void) | 496 | static int o2net_fill_bitmap(char *buf, int len) |
| 495 | { | 497 | { |
| 496 | o2net_dentry = debugfs_create_dir(O2NET_DEBUG_DIR, NULL); | 498 | unsigned long map[BITS_TO_LONGS(O2NM_MAX_NODES)]; |
| 497 | if (!o2net_dentry) { | 499 | int i = -1, out = 0; |
| 498 | mlog_errno(-ENOMEM); | ||
| 499 | goto bail; | ||
| 500 | } | ||
| 501 | 500 | ||
| 502 | nst_dentry = debugfs_create_file(NST_DEBUG_NAME, S_IFREG|S_IRUSR, | 501 | o2net_fill_node_map(map, sizeof(map)); |
| 503 | o2net_dentry, NULL, | ||
| 504 | &nst_seq_fops); | ||
| 505 | if (!nst_dentry) { | ||
| 506 | mlog_errno(-ENOMEM); | ||
| 507 | goto bail; | ||
| 508 | } | ||
| 509 | 502 | ||
| 510 | sc_dentry = debugfs_create_file(SC_DEBUG_NAME, S_IFREG|S_IRUSR, | 503 | while ((i = find_next_bit(map, O2NM_MAX_NODES, i + 1)) < O2NM_MAX_NODES) |
| 511 | o2net_dentry, NULL, | 504 | out += snprintf(buf + out, PAGE_SIZE - out, "%d ", i); |
| 512 | &sc_seq_fops); | 505 | out += snprintf(buf + out, PAGE_SIZE - out, "\n"); |
| 513 | if (!sc_dentry) { | ||
| 514 | mlog_errno(-ENOMEM); | ||
| 515 | goto bail; | ||
| 516 | } | ||
| 517 | 506 | ||
| 518 | stats_dentry = debugfs_create_file(STATS_DEBUG_NAME, S_IFREG|S_IRUSR, | 507 | return out; |
| 519 | o2net_dentry, NULL, | 508 | } |
| 520 | &stats_seq_fops); | 509 | |
| 521 | if (!stats_dentry) { | 510 | static int nodes_fop_open(struct inode *inode, struct file *file) |
| 522 | mlog_errno(-ENOMEM); | 511 | { |
| 523 | goto bail; | 512 | char *buf; |
| 524 | } | 513 | |
| 514 | buf = kmalloc(PAGE_SIZE, GFP_KERNEL); | ||
| 515 | if (!buf) | ||
| 516 | return -ENOMEM; | ||
| 517 | |||
| 518 | i_size_write(inode, o2net_fill_bitmap(buf, PAGE_SIZE)); | ||
| 519 | |||
| 520 | file->private_data = buf; | ||
| 525 | 521 | ||
| 526 | return 0; | 522 | return 0; |
| 527 | bail: | ||
| 528 | debugfs_remove(stats_dentry); | ||
| 529 | debugfs_remove(sc_dentry); | ||
| 530 | debugfs_remove(nst_dentry); | ||
| 531 | debugfs_remove(o2net_dentry); | ||
| 532 | return -ENOMEM; | ||
| 533 | } | 523 | } |
| 534 | 524 | ||
| 525 | static int o2net_debug_release(struct inode *inode, struct file *file) | ||
| 526 | { | ||
| 527 | kfree(file->private_data); | ||
| 528 | return 0; | ||
| 529 | } | ||
| 530 | |||
| 531 | static ssize_t o2net_debug_read(struct file *file, char __user *buf, | ||
| 532 | size_t nbytes, loff_t *ppos) | ||
| 533 | { | ||
| 534 | return simple_read_from_buffer(buf, nbytes, ppos, file->private_data, | ||
| 535 | i_size_read(file->f_mapping->host)); | ||
| 536 | } | ||
| 537 | |||
| 538 | static const struct file_operations nodes_fops = { | ||
| 539 | .open = nodes_fop_open, | ||
| 540 | .release = o2net_debug_release, | ||
| 541 | .read = o2net_debug_read, | ||
| 542 | .llseek = generic_file_llseek, | ||
| 543 | }; | ||
| 544 | |||
| 535 | void o2net_debugfs_exit(void) | 545 | void o2net_debugfs_exit(void) |
| 536 | { | 546 | { |
| 547 | debugfs_remove(nodes_dentry); | ||
| 537 | debugfs_remove(stats_dentry); | 548 | debugfs_remove(stats_dentry); |
| 538 | debugfs_remove(sc_dentry); | 549 | debugfs_remove(sc_dentry); |
| 539 | debugfs_remove(nst_dentry); | 550 | debugfs_remove(nst_dentry); |
| 540 | debugfs_remove(o2net_dentry); | 551 | debugfs_remove(o2net_dentry); |
| 541 | } | 552 | } |
| 542 | 553 | ||
| 554 | int o2net_debugfs_init(void) | ||
| 555 | { | ||
| 556 | mode_t mode = S_IFREG|S_IRUSR; | ||
| 557 | |||
| 558 | o2net_dentry = debugfs_create_dir(O2NET_DEBUG_DIR, NULL); | ||
| 559 | if (o2net_dentry) | ||
| 560 | nst_dentry = debugfs_create_file(NST_DEBUG_NAME, mode, | ||
| 561 | o2net_dentry, NULL, &nst_seq_fops); | ||
| 562 | if (nst_dentry) | ||
| 563 | sc_dentry = debugfs_create_file(SC_DEBUG_NAME, mode, | ||
| 564 | o2net_dentry, NULL, &sc_seq_fops); | ||
| 565 | if (sc_dentry) | ||
| 566 | stats_dentry = debugfs_create_file(STATS_DEBUG_NAME, mode, | ||
| 567 | o2net_dentry, NULL, &stats_seq_fops); | ||
| 568 | if (stats_dentry) | ||
| 569 | nodes_dentry = debugfs_create_file(NODES_DEBUG_NAME, mode, | ||
| 570 | o2net_dentry, NULL, &nodes_fops); | ||
| 571 | if (nodes_dentry) | ||
| 572 | return 0; | ||
| 573 | |||
| 574 | o2net_debugfs_exit(); | ||
| 575 | mlog_errno(-ENOMEM); | ||
| 576 | return -ENOMEM; | ||
| 577 | } | ||
| 578 | |||
| 543 | #endif /* CONFIG_DEBUG_FS */ | 579 | #endif /* CONFIG_DEBUG_FS */ |
diff --git a/fs/ocfs2/cluster/tcp.c b/fs/ocfs2/cluster/tcp.c index ad7d0c155de4..044e7b58d31c 100644 --- a/fs/ocfs2/cluster/tcp.c +++ b/fs/ocfs2/cluster/tcp.c | |||
| @@ -546,7 +546,7 @@ static void o2net_set_nn_state(struct o2net_node *nn, | |||
| 546 | } | 546 | } |
| 547 | 547 | ||
| 548 | if (was_valid && !valid) { | 548 | if (was_valid && !valid) { |
| 549 | printk(KERN_NOTICE "o2net: no longer connected to " | 549 | printk(KERN_NOTICE "o2net: No longer connected to " |
| 550 | SC_NODEF_FMT "\n", SC_NODEF_ARGS(old_sc)); | 550 | SC_NODEF_FMT "\n", SC_NODEF_ARGS(old_sc)); |
| 551 | o2net_complete_nodes_nsw(nn); | 551 | o2net_complete_nodes_nsw(nn); |
| 552 | } | 552 | } |
| @@ -556,7 +556,7 @@ static void o2net_set_nn_state(struct o2net_node *nn, | |||
| 556 | cancel_delayed_work(&nn->nn_connect_expired); | 556 | cancel_delayed_work(&nn->nn_connect_expired); |
| 557 | printk(KERN_NOTICE "o2net: %s " SC_NODEF_FMT "\n", | 557 | printk(KERN_NOTICE "o2net: %s " SC_NODEF_FMT "\n", |
| 558 | o2nm_this_node() > sc->sc_node->nd_num ? | 558 | o2nm_this_node() > sc->sc_node->nd_num ? |
| 559 | "connected to" : "accepted connection from", | 559 | "Connected to" : "Accepted connection from", |
| 560 | SC_NODEF_ARGS(sc)); | 560 | SC_NODEF_ARGS(sc)); |
| 561 | } | 561 | } |
| 562 | 562 | ||
| @@ -644,7 +644,7 @@ static void o2net_state_change(struct sock *sk) | |||
| 644 | o2net_sc_queue_work(sc, &sc->sc_connect_work); | 644 | o2net_sc_queue_work(sc, &sc->sc_connect_work); |
| 645 | break; | 645 | break; |
| 646 | default: | 646 | default: |
| 647 | printk(KERN_INFO "o2net: connection to " SC_NODEF_FMT | 647 | printk(KERN_INFO "o2net: Connection to " SC_NODEF_FMT |
| 648 | " shutdown, state %d\n", | 648 | " shutdown, state %d\n", |
| 649 | SC_NODEF_ARGS(sc), sk->sk_state); | 649 | SC_NODEF_ARGS(sc), sk->sk_state); |
| 650 | o2net_sc_queue_work(sc, &sc->sc_shutdown_work); | 650 | o2net_sc_queue_work(sc, &sc->sc_shutdown_work); |
| @@ -1035,6 +1035,25 @@ static int o2net_tx_can_proceed(struct o2net_node *nn, | |||
| 1035 | return ret; | 1035 | return ret; |
| 1036 | } | 1036 | } |
| 1037 | 1037 | ||
| 1038 | /* Get a map of all nodes to which this node is currently connected to */ | ||
| 1039 | void o2net_fill_node_map(unsigned long *map, unsigned bytes) | ||
| 1040 | { | ||
| 1041 | struct o2net_sock_container *sc; | ||
| 1042 | int node, ret; | ||
| 1043 | |||
| 1044 | BUG_ON(bytes < (BITS_TO_LONGS(O2NM_MAX_NODES) * sizeof(unsigned long))); | ||
| 1045 | |||
| 1046 | memset(map, 0, bytes); | ||
| 1047 | for (node = 0; node < O2NM_MAX_NODES; ++node) { | ||
| 1048 | o2net_tx_can_proceed(o2net_nn_from_num(node), &sc, &ret); | ||
| 1049 | if (!ret) { | ||
| 1050 | set_bit(node, map); | ||
| 1051 | sc_put(sc); | ||
| 1052 | } | ||
| 1053 | } | ||
| 1054 | } | ||
| 1055 | EXPORT_SYMBOL_GPL(o2net_fill_node_map); | ||
| 1056 | |||
| 1038 | int o2net_send_message_vec(u32 msg_type, u32 key, struct kvec *caller_vec, | 1057 | int o2net_send_message_vec(u32 msg_type, u32 key, struct kvec *caller_vec, |
| 1039 | size_t caller_veclen, u8 target_node, int *status) | 1058 | size_t caller_veclen, u8 target_node, int *status) |
| 1040 | { | 1059 | { |
| @@ -1285,11 +1304,11 @@ static int o2net_check_handshake(struct o2net_sock_container *sc) | |||
| 1285 | struct o2net_node *nn = o2net_nn_from_num(sc->sc_node->nd_num); | 1304 | struct o2net_node *nn = o2net_nn_from_num(sc->sc_node->nd_num); |
| 1286 | 1305 | ||
| 1287 | if (hand->protocol_version != cpu_to_be64(O2NET_PROTOCOL_VERSION)) { | 1306 | if (hand->protocol_version != cpu_to_be64(O2NET_PROTOCOL_VERSION)) { |
| 1288 | mlog(ML_NOTICE, SC_NODEF_FMT " advertised net protocol " | 1307 | printk(KERN_NOTICE "o2net: " SC_NODEF_FMT " Advertised net " |
| 1289 | "version %llu but %llu is required, disconnecting\n", | 1308 | "protocol version %llu but %llu is required. " |
| 1290 | SC_NODEF_ARGS(sc), | 1309 | "Disconnecting.\n", SC_NODEF_ARGS(sc), |
| 1291 | (unsigned long long)be64_to_cpu(hand->protocol_version), | 1310 | (unsigned long long)be64_to_cpu(hand->protocol_version), |
| 1292 | O2NET_PROTOCOL_VERSION); | 1311 | O2NET_PROTOCOL_VERSION); |
| 1293 | 1312 | ||
| 1294 | /* don't bother reconnecting if its the wrong version. */ | 1313 | /* don't bother reconnecting if its the wrong version. */ |
| 1295 | o2net_ensure_shutdown(nn, sc, -ENOTCONN); | 1314 | o2net_ensure_shutdown(nn, sc, -ENOTCONN); |
| @@ -1303,33 +1322,33 @@ static int o2net_check_handshake(struct o2net_sock_container *sc) | |||
| 1303 | */ | 1322 | */ |
| 1304 | if (be32_to_cpu(hand->o2net_idle_timeout_ms) != | 1323 | if (be32_to_cpu(hand->o2net_idle_timeout_ms) != |
| 1305 | o2net_idle_timeout()) { | 1324 | o2net_idle_timeout()) { |
| 1306 | mlog(ML_NOTICE, SC_NODEF_FMT " uses a network idle timeout of " | 1325 | printk(KERN_NOTICE "o2net: " SC_NODEF_FMT " uses a network " |
| 1307 | "%u ms, but we use %u ms locally. disconnecting\n", | 1326 | "idle timeout of %u ms, but we use %u ms locally. " |
| 1308 | SC_NODEF_ARGS(sc), | 1327 | "Disconnecting.\n", SC_NODEF_ARGS(sc), |
| 1309 | be32_to_cpu(hand->o2net_idle_timeout_ms), | 1328 | be32_to_cpu(hand->o2net_idle_timeout_ms), |
| 1310 | o2net_idle_timeout()); | 1329 | o2net_idle_timeout()); |
| 1311 | o2net_ensure_shutdown(nn, sc, -ENOTCONN); | 1330 | o2net_ensure_shutdown(nn, sc, -ENOTCONN); |
| 1312 | return -1; | 1331 | return -1; |
| 1313 | } | 1332 | } |
| 1314 | 1333 | ||
| 1315 | if (be32_to_cpu(hand->o2net_keepalive_delay_ms) != | 1334 | if (be32_to_cpu(hand->o2net_keepalive_delay_ms) != |
| 1316 | o2net_keepalive_delay()) { | 1335 | o2net_keepalive_delay()) { |
| 1317 | mlog(ML_NOTICE, SC_NODEF_FMT " uses a keepalive delay of " | 1336 | printk(KERN_NOTICE "o2net: " SC_NODEF_FMT " uses a keepalive " |
| 1318 | "%u ms, but we use %u ms locally. disconnecting\n", | 1337 | "delay of %u ms, but we use %u ms locally. " |
| 1319 | SC_NODEF_ARGS(sc), | 1338 | "Disconnecting.\n", SC_NODEF_ARGS(sc), |
| 1320 | be32_to_cpu(hand->o2net_keepalive_delay_ms), | 1339 | be32_to_cpu(hand->o2net_keepalive_delay_ms), |
| 1321 | o2net_keepalive_delay()); | 1340 | o2net_keepalive_delay()); |
| 1322 | o2net_ensure_shutdown(nn, sc, -ENOTCONN); | 1341 | o2net_ensure_shutdown(nn, sc, -ENOTCONN); |
| 1323 | return -1; | 1342 | return -1; |
| 1324 | } | 1343 | } |
| 1325 | 1344 | ||
| 1326 | if (be32_to_cpu(hand->o2hb_heartbeat_timeout_ms) != | 1345 | if (be32_to_cpu(hand->o2hb_heartbeat_timeout_ms) != |
| 1327 | O2HB_MAX_WRITE_TIMEOUT_MS) { | 1346 | O2HB_MAX_WRITE_TIMEOUT_MS) { |
| 1328 | mlog(ML_NOTICE, SC_NODEF_FMT " uses a heartbeat timeout of " | 1347 | printk(KERN_NOTICE "o2net: " SC_NODEF_FMT " uses a heartbeat " |
| 1329 | "%u ms, but we use %u ms locally. disconnecting\n", | 1348 | "timeout of %u ms, but we use %u ms locally. " |
| 1330 | SC_NODEF_ARGS(sc), | 1349 | "Disconnecting.\n", SC_NODEF_ARGS(sc), |
| 1331 | be32_to_cpu(hand->o2hb_heartbeat_timeout_ms), | 1350 | be32_to_cpu(hand->o2hb_heartbeat_timeout_ms), |
| 1332 | O2HB_MAX_WRITE_TIMEOUT_MS); | 1351 | O2HB_MAX_WRITE_TIMEOUT_MS); |
| 1333 | o2net_ensure_shutdown(nn, sc, -ENOTCONN); | 1352 | o2net_ensure_shutdown(nn, sc, -ENOTCONN); |
| 1334 | return -1; | 1353 | return -1; |
| 1335 | } | 1354 | } |
| @@ -1540,28 +1559,16 @@ static void o2net_idle_timer(unsigned long data) | |||
| 1540 | { | 1559 | { |
| 1541 | struct o2net_sock_container *sc = (struct o2net_sock_container *)data; | 1560 | struct o2net_sock_container *sc = (struct o2net_sock_container *)data; |
| 1542 | struct o2net_node *nn = o2net_nn_from_num(sc->sc_node->nd_num); | 1561 | struct o2net_node *nn = o2net_nn_from_num(sc->sc_node->nd_num); |
| 1543 | |||
| 1544 | #ifdef CONFIG_DEBUG_FS | 1562 | #ifdef CONFIG_DEBUG_FS |
| 1545 | ktime_t now = ktime_get(); | 1563 | unsigned long msecs = ktime_to_ms(ktime_get()) - |
| 1564 | ktime_to_ms(sc->sc_tv_timer); | ||
| 1565 | #else | ||
| 1566 | unsigned long msecs = o2net_idle_timeout(); | ||
| 1546 | #endif | 1567 | #endif |
| 1547 | 1568 | ||
| 1548 | printk(KERN_NOTICE "o2net: connection to " SC_NODEF_FMT " has been idle for %u.%u " | 1569 | printk(KERN_NOTICE "o2net: Connection to " SC_NODEF_FMT " has been " |
| 1549 | "seconds, shutting it down.\n", SC_NODEF_ARGS(sc), | 1570 | "idle for %lu.%lu secs, shutting it down.\n", SC_NODEF_ARGS(sc), |
| 1550 | o2net_idle_timeout() / 1000, | 1571 | msecs / 1000, msecs % 1000); |
| 1551 | o2net_idle_timeout() % 1000); | ||
| 1552 | |||
| 1553 | #ifdef CONFIG_DEBUG_FS | ||
| 1554 | mlog(ML_NOTICE, "Here are some times that might help debug the " | ||
| 1555 | "situation: (Timer: %lld, Now %lld, DataReady %lld, Advance %lld-%lld, " | ||
| 1556 | "Key 0x%08x, Func %u, FuncTime %lld-%lld)\n", | ||
| 1557 | (long long)ktime_to_us(sc->sc_tv_timer), (long long)ktime_to_us(now), | ||
| 1558 | (long long)ktime_to_us(sc->sc_tv_data_ready), | ||
| 1559 | (long long)ktime_to_us(sc->sc_tv_advance_start), | ||
| 1560 | (long long)ktime_to_us(sc->sc_tv_advance_stop), | ||
| 1561 | sc->sc_msg_key, sc->sc_msg_type, | ||
| 1562 | (long long)ktime_to_us(sc->sc_tv_func_start), | ||
| 1563 | (long long)ktime_to_us(sc->sc_tv_func_stop)); | ||
| 1564 | #endif | ||
| 1565 | 1572 | ||
| 1566 | /* | 1573 | /* |
| 1567 | * Initialize the nn_timeout so that the next connection attempt | 1574 | * Initialize the nn_timeout so that the next connection attempt |
| @@ -1694,8 +1701,8 @@ static void o2net_start_connect(struct work_struct *work) | |||
| 1694 | 1701 | ||
| 1695 | out: | 1702 | out: |
| 1696 | if (ret) { | 1703 | if (ret) { |
| 1697 | mlog(ML_NOTICE, "connect attempt to " SC_NODEF_FMT " failed " | 1704 | printk(KERN_NOTICE "o2net: Connect attempt to " SC_NODEF_FMT |
| 1698 | "with errno %d\n", SC_NODEF_ARGS(sc), ret); | 1705 | " failed with errno %d\n", SC_NODEF_ARGS(sc), ret); |
| 1699 | /* 0 err so that another will be queued and attempted | 1706 | /* 0 err so that another will be queued and attempted |
| 1700 | * from set_nn_state */ | 1707 | * from set_nn_state */ |
| 1701 | if (sc) | 1708 | if (sc) |
| @@ -1718,8 +1725,8 @@ static void o2net_connect_expired(struct work_struct *work) | |||
| 1718 | 1725 | ||
| 1719 | spin_lock(&nn->nn_lock); | 1726 | spin_lock(&nn->nn_lock); |
| 1720 | if (!nn->nn_sc_valid) { | 1727 | if (!nn->nn_sc_valid) { |
| 1721 | mlog(ML_ERROR, "no connection established with node %u after " | 1728 | printk(KERN_NOTICE "o2net: No connection established with " |
| 1722 | "%u.%u seconds, giving up and returning errors.\n", | 1729 | "node %u after %u.%u seconds, giving up.\n", |
| 1723 | o2net_num_from_nn(nn), | 1730 | o2net_num_from_nn(nn), |
| 1724 | o2net_idle_timeout() / 1000, | 1731 | o2net_idle_timeout() / 1000, |
| 1725 | o2net_idle_timeout() % 1000); | 1732 | o2net_idle_timeout() % 1000); |
| @@ -1862,21 +1869,21 @@ static int o2net_accept_one(struct socket *sock) | |||
| 1862 | 1869 | ||
| 1863 | node = o2nm_get_node_by_ip(sin.sin_addr.s_addr); | 1870 | node = o2nm_get_node_by_ip(sin.sin_addr.s_addr); |
| 1864 | if (node == NULL) { | 1871 | if (node == NULL) { |
| 1865 | mlog(ML_NOTICE, "attempt to connect from unknown node at %pI4:%d\n", | 1872 | printk(KERN_NOTICE "o2net: Attempt to connect from unknown " |
| 1866 | &sin.sin_addr.s_addr, ntohs(sin.sin_port)); | 1873 | "node at %pI4:%d\n", &sin.sin_addr.s_addr, |
| 1874 | ntohs(sin.sin_port)); | ||
| 1867 | ret = -EINVAL; | 1875 | ret = -EINVAL; |
| 1868 | goto out; | 1876 | goto out; |
| 1869 | } | 1877 | } |
| 1870 | 1878 | ||
| 1871 | if (o2nm_this_node() >= node->nd_num) { | 1879 | if (o2nm_this_node() >= node->nd_num) { |
| 1872 | local_node = o2nm_get_node_by_num(o2nm_this_node()); | 1880 | local_node = o2nm_get_node_by_num(o2nm_this_node()); |
| 1873 | mlog(ML_NOTICE, "unexpected connect attempt seen at node '%s' (" | 1881 | printk(KERN_NOTICE "o2net: Unexpected connect attempt seen " |
| 1874 | "%u, %pI4:%d) from node '%s' (%u, %pI4:%d)\n", | 1882 | "at node '%s' (%u, %pI4:%d) from node '%s' (%u, " |
| 1875 | local_node->nd_name, local_node->nd_num, | 1883 | "%pI4:%d)\n", local_node->nd_name, local_node->nd_num, |
| 1876 | &(local_node->nd_ipv4_address), | 1884 | &(local_node->nd_ipv4_address), |
| 1877 | ntohs(local_node->nd_ipv4_port), | 1885 | ntohs(local_node->nd_ipv4_port), node->nd_name, |
| 1878 | node->nd_name, node->nd_num, &sin.sin_addr.s_addr, | 1886 | node->nd_num, &sin.sin_addr.s_addr, ntohs(sin.sin_port)); |
| 1879 | ntohs(sin.sin_port)); | ||
| 1880 | ret = -EINVAL; | 1887 | ret = -EINVAL; |
| 1881 | goto out; | 1888 | goto out; |
| 1882 | } | 1889 | } |
| @@ -1901,10 +1908,10 @@ static int o2net_accept_one(struct socket *sock) | |||
| 1901 | ret = 0; | 1908 | ret = 0; |
| 1902 | spin_unlock(&nn->nn_lock); | 1909 | spin_unlock(&nn->nn_lock); |
| 1903 | if (ret) { | 1910 | if (ret) { |
| 1904 | mlog(ML_NOTICE, "attempt to connect from node '%s' at " | 1911 | printk(KERN_NOTICE "o2net: Attempt to connect from node '%s' " |
| 1905 | "%pI4:%d but it already has an open connection\n", | 1912 | "at %pI4:%d but it already has an open connection\n", |
| 1906 | node->nd_name, &sin.sin_addr.s_addr, | 1913 | node->nd_name, &sin.sin_addr.s_addr, |
| 1907 | ntohs(sin.sin_port)); | 1914 | ntohs(sin.sin_port)); |
| 1908 | goto out; | 1915 | goto out; |
| 1909 | } | 1916 | } |
| 1910 | 1917 | ||
| @@ -1984,7 +1991,7 @@ static int o2net_open_listening_sock(__be32 addr, __be16 port) | |||
| 1984 | 1991 | ||
| 1985 | ret = sock_create(PF_INET, SOCK_STREAM, IPPROTO_TCP, &sock); | 1992 | ret = sock_create(PF_INET, SOCK_STREAM, IPPROTO_TCP, &sock); |
| 1986 | if (ret < 0) { | 1993 | if (ret < 0) { |
| 1987 | mlog(ML_ERROR, "unable to create socket, ret=%d\n", ret); | 1994 | printk(KERN_ERR "o2net: Error %d while creating socket\n", ret); |
| 1988 | goto out; | 1995 | goto out; |
| 1989 | } | 1996 | } |
| 1990 | 1997 | ||
| @@ -2001,16 +2008,15 @@ static int o2net_open_listening_sock(__be32 addr, __be16 port) | |||
| 2001 | sock->sk->sk_reuse = 1; | 2008 | sock->sk->sk_reuse = 1; |
| 2002 | ret = sock->ops->bind(sock, (struct sockaddr *)&sin, sizeof(sin)); | 2009 | ret = sock->ops->bind(sock, (struct sockaddr *)&sin, sizeof(sin)); |
| 2003 | if (ret < 0) { | 2010 | if (ret < 0) { |
| 2004 | mlog(ML_ERROR, "unable to bind socket at %pI4:%u, " | 2011 | printk(KERN_ERR "o2net: Error %d while binding socket at " |
| 2005 | "ret=%d\n", &addr, ntohs(port), ret); | 2012 | "%pI4:%u\n", ret, &addr, ntohs(port)); |
| 2006 | goto out; | 2013 | goto out; |
| 2007 | } | 2014 | } |
| 2008 | 2015 | ||
| 2009 | ret = sock->ops->listen(sock, 64); | 2016 | ret = sock->ops->listen(sock, 64); |
| 2010 | if (ret < 0) { | 2017 | if (ret < 0) |
| 2011 | mlog(ML_ERROR, "unable to listen on %pI4:%u, ret=%d\n", | 2018 | printk(KERN_ERR "o2net: Error %d while listening on %pI4:%u\n", |
| 2012 | &addr, ntohs(port), ret); | 2019 | ret, &addr, ntohs(port)); |
| 2013 | } | ||
| 2014 | 2020 | ||
| 2015 | out: | 2021 | out: |
| 2016 | if (ret) { | 2022 | if (ret) { |
diff --git a/fs/ocfs2/cluster/tcp.h b/fs/ocfs2/cluster/tcp.h index fd6179eb26d4..5bada2a69b50 100644 --- a/fs/ocfs2/cluster/tcp.h +++ b/fs/ocfs2/cluster/tcp.h | |||
| @@ -106,6 +106,8 @@ int o2net_register_handler(u32 msg_type, u32 key, u32 max_len, | |||
| 106 | struct list_head *unreg_list); | 106 | struct list_head *unreg_list); |
| 107 | void o2net_unregister_handler_list(struct list_head *list); | 107 | void o2net_unregister_handler_list(struct list_head *list); |
| 108 | 108 | ||
| 109 | void o2net_fill_node_map(unsigned long *map, unsigned bytes); | ||
| 110 | |||
| 109 | struct o2nm_node; | 111 | struct o2nm_node; |
| 110 | int o2net_register_hb_callbacks(void); | 112 | int o2net_register_hb_callbacks(void); |
| 111 | void o2net_unregister_hb_callbacks(void); | 113 | void o2net_unregister_hb_callbacks(void); |
diff --git a/fs/ocfs2/dir.c b/fs/ocfs2/dir.c index e2878b5895fb..8fe4e2892ab9 100644 --- a/fs/ocfs2/dir.c +++ b/fs/ocfs2/dir.c | |||
| @@ -1184,8 +1184,7 @@ static int __ocfs2_delete_entry(handle_t *handle, struct inode *dir, | |||
| 1184 | if (pde) | 1184 | if (pde) |
| 1185 | le16_add_cpu(&pde->rec_len, | 1185 | le16_add_cpu(&pde->rec_len, |
| 1186 | le16_to_cpu(de->rec_len)); | 1186 | le16_to_cpu(de->rec_len)); |
| 1187 | else | 1187 | de->inode = 0; |
| 1188 | de->inode = 0; | ||
| 1189 | dir->i_version++; | 1188 | dir->i_version++; |
| 1190 | ocfs2_journal_dirty(handle, bh); | 1189 | ocfs2_journal_dirty(handle, bh); |
| 1191 | goto bail; | 1190 | goto bail; |
diff --git a/fs/ocfs2/dlm/dlmcommon.h b/fs/ocfs2/dlm/dlmcommon.h index d602abb51b61..a5952ceecba5 100644 --- a/fs/ocfs2/dlm/dlmcommon.h +++ b/fs/ocfs2/dlm/dlmcommon.h | |||
| @@ -859,8 +859,8 @@ void dlm_complete_recovery_thread(struct dlm_ctxt *dlm); | |||
| 859 | void dlm_wait_for_recovery(struct dlm_ctxt *dlm); | 859 | void dlm_wait_for_recovery(struct dlm_ctxt *dlm); |
| 860 | void dlm_kick_recovery_thread(struct dlm_ctxt *dlm); | 860 | void dlm_kick_recovery_thread(struct dlm_ctxt *dlm); |
| 861 | int dlm_is_node_dead(struct dlm_ctxt *dlm, u8 node); | 861 | int dlm_is_node_dead(struct dlm_ctxt *dlm, u8 node); |
| 862 | int dlm_wait_for_node_death(struct dlm_ctxt *dlm, u8 node, int timeout); | 862 | void dlm_wait_for_node_death(struct dlm_ctxt *dlm, u8 node, int timeout); |
| 863 | int dlm_wait_for_node_recovery(struct dlm_ctxt *dlm, u8 node, int timeout); | 863 | void dlm_wait_for_node_recovery(struct dlm_ctxt *dlm, u8 node, int timeout); |
| 864 | 864 | ||
| 865 | void dlm_put(struct dlm_ctxt *dlm); | 865 | void dlm_put(struct dlm_ctxt *dlm); |
| 866 | struct dlm_ctxt *dlm_grab(struct dlm_ctxt *dlm); | 866 | struct dlm_ctxt *dlm_grab(struct dlm_ctxt *dlm); |
| @@ -877,9 +877,8 @@ static inline void dlm_lockres_get(struct dlm_lock_resource *res) | |||
| 877 | kref_get(&res->refs); | 877 | kref_get(&res->refs); |
| 878 | } | 878 | } |
| 879 | void dlm_lockres_put(struct dlm_lock_resource *res); | 879 | void dlm_lockres_put(struct dlm_lock_resource *res); |
| 880 | void __dlm_unhash_lockres(struct dlm_lock_resource *res); | 880 | void __dlm_unhash_lockres(struct dlm_ctxt *dlm, struct dlm_lock_resource *res); |
| 881 | void __dlm_insert_lockres(struct dlm_ctxt *dlm, | 881 | void __dlm_insert_lockres(struct dlm_ctxt *dlm, struct dlm_lock_resource *res); |
| 882 | struct dlm_lock_resource *res); | ||
| 883 | struct dlm_lock_resource * __dlm_lookup_lockres_full(struct dlm_ctxt *dlm, | 882 | struct dlm_lock_resource * __dlm_lookup_lockres_full(struct dlm_ctxt *dlm, |
| 884 | const char *name, | 883 | const char *name, |
| 885 | unsigned int len, | 884 | unsigned int len, |
| @@ -902,46 +901,15 @@ struct dlm_lock_resource *dlm_new_lockres(struct dlm_ctxt *dlm, | |||
| 902 | const char *name, | 901 | const char *name, |
| 903 | unsigned int namelen); | 902 | unsigned int namelen); |
| 904 | 903 | ||
| 905 | #define dlm_lockres_set_refmap_bit(bit,res) \ | 904 | void dlm_lockres_set_refmap_bit(struct dlm_ctxt *dlm, |
| 906 | __dlm_lockres_set_refmap_bit(bit,res,__FILE__,__LINE__) | 905 | struct dlm_lock_resource *res, int bit); |
| 907 | #define dlm_lockres_clear_refmap_bit(bit,res) \ | 906 | void dlm_lockres_clear_refmap_bit(struct dlm_ctxt *dlm, |
| 908 | __dlm_lockres_clear_refmap_bit(bit,res,__FILE__,__LINE__) | 907 | struct dlm_lock_resource *res, int bit); |
| 909 | 908 | ||
| 910 | static inline void __dlm_lockres_set_refmap_bit(int bit, | 909 | void dlm_lockres_drop_inflight_ref(struct dlm_ctxt *dlm, |
| 911 | struct dlm_lock_resource *res, | 910 | struct dlm_lock_resource *res); |
| 912 | const char *file, | 911 | void dlm_lockres_grab_inflight_ref(struct dlm_ctxt *dlm, |
| 913 | int line) | 912 | struct dlm_lock_resource *res); |
| 914 | { | ||
| 915 | //printk("%s:%d:%.*s: setting bit %d\n", file, line, | ||
| 916 | // res->lockname.len, res->lockname.name, bit); | ||
| 917 | set_bit(bit, res->refmap); | ||
| 918 | } | ||
| 919 | |||
| 920 | static inline void __dlm_lockres_clear_refmap_bit(int bit, | ||
| 921 | struct dlm_lock_resource *res, | ||
| 922 | const char *file, | ||
| 923 | int line) | ||
| 924 | { | ||
| 925 | //printk("%s:%d:%.*s: clearing bit %d\n", file, line, | ||
| 926 | // res->lockname.len, res->lockname.name, bit); | ||
| 927 | clear_bit(bit, res->refmap); | ||
| 928 | } | ||
| 929 | |||
| 930 | void __dlm_lockres_drop_inflight_ref(struct dlm_ctxt *dlm, | ||
| 931 | struct dlm_lock_resource *res, | ||
| 932 | const char *file, | ||
| 933 | int line); | ||
| 934 | void __dlm_lockres_grab_inflight_ref(struct dlm_ctxt *dlm, | ||
| 935 | struct dlm_lock_resource *res, | ||
| 936 | int new_lockres, | ||
| 937 | const char *file, | ||
| 938 | int line); | ||
| 939 | #define dlm_lockres_drop_inflight_ref(d,r) \ | ||
| 940 | __dlm_lockres_drop_inflight_ref(d,r,__FILE__,__LINE__) | ||
| 941 | #define dlm_lockres_grab_inflight_ref(d,r) \ | ||
| 942 | __dlm_lockres_grab_inflight_ref(d,r,0,__FILE__,__LINE__) | ||
| 943 | #define dlm_lockres_grab_inflight_ref_new(d,r) \ | ||
| 944 | __dlm_lockres_grab_inflight_ref(d,r,1,__FILE__,__LINE__) | ||
| 945 | 913 | ||
| 946 | void dlm_queue_ast(struct dlm_ctxt *dlm, struct dlm_lock *lock); | 914 | void dlm_queue_ast(struct dlm_ctxt *dlm, struct dlm_lock *lock); |
| 947 | void dlm_queue_bast(struct dlm_ctxt *dlm, struct dlm_lock *lock); | 915 | void dlm_queue_bast(struct dlm_ctxt *dlm, struct dlm_lock *lock); |
diff --git a/fs/ocfs2/dlm/dlmdomain.c b/fs/ocfs2/dlm/dlmdomain.c index 6ed6b95dcf93..92f2ead0fab6 100644 --- a/fs/ocfs2/dlm/dlmdomain.c +++ b/fs/ocfs2/dlm/dlmdomain.c | |||
| @@ -157,16 +157,18 @@ static int dlm_protocol_compare(struct dlm_protocol_version *existing, | |||
| 157 | 157 | ||
| 158 | static void dlm_unregister_domain_handlers(struct dlm_ctxt *dlm); | 158 | static void dlm_unregister_domain_handlers(struct dlm_ctxt *dlm); |
| 159 | 159 | ||
| 160 | void __dlm_unhash_lockres(struct dlm_lock_resource *lockres) | 160 | void __dlm_unhash_lockres(struct dlm_ctxt *dlm, struct dlm_lock_resource *res) |
| 161 | { | 161 | { |
| 162 | if (!hlist_unhashed(&lockres->hash_node)) { | 162 | if (hlist_unhashed(&res->hash_node)) |
| 163 | hlist_del_init(&lockres->hash_node); | 163 | return; |
| 164 | dlm_lockres_put(lockres); | 164 | |
| 165 | } | 165 | mlog(0, "%s: Unhash res %.*s\n", dlm->name, res->lockname.len, |
| 166 | res->lockname.name); | ||
| 167 | hlist_del_init(&res->hash_node); | ||
| 168 | dlm_lockres_put(res); | ||
| 166 | } | 169 | } |
| 167 | 170 | ||
| 168 | void __dlm_insert_lockres(struct dlm_ctxt *dlm, | 171 | void __dlm_insert_lockres(struct dlm_ctxt *dlm, struct dlm_lock_resource *res) |
| 169 | struct dlm_lock_resource *res) | ||
| 170 | { | 172 | { |
| 171 | struct hlist_head *bucket; | 173 | struct hlist_head *bucket; |
| 172 | struct qstr *q; | 174 | struct qstr *q; |
| @@ -180,6 +182,9 @@ void __dlm_insert_lockres(struct dlm_ctxt *dlm, | |||
| 180 | dlm_lockres_get(res); | 182 | dlm_lockres_get(res); |
| 181 | 183 | ||
| 182 | hlist_add_head(&res->hash_node, bucket); | 184 | hlist_add_head(&res->hash_node, bucket); |
| 185 | |||
| 186 | mlog(0, "%s: Hash res %.*s\n", dlm->name, res->lockname.len, | ||
| 187 | res->lockname.name); | ||
| 183 | } | 188 | } |
| 184 | 189 | ||
| 185 | struct dlm_lock_resource * __dlm_lookup_lockres_full(struct dlm_ctxt *dlm, | 190 | struct dlm_lock_resource * __dlm_lookup_lockres_full(struct dlm_ctxt *dlm, |
| @@ -539,17 +544,17 @@ again: | |||
| 539 | 544 | ||
| 540 | static void __dlm_print_nodes(struct dlm_ctxt *dlm) | 545 | static void __dlm_print_nodes(struct dlm_ctxt *dlm) |
| 541 | { | 546 | { |
| 542 | int node = -1; | 547 | int node = -1, num = 0; |
| 543 | 548 | ||
| 544 | assert_spin_locked(&dlm->spinlock); | 549 | assert_spin_locked(&dlm->spinlock); |
| 545 | 550 | ||
| 546 | printk(KERN_NOTICE "o2dlm: Nodes in domain %s: ", dlm->name); | 551 | printk("( "); |
| 547 | |||
| 548 | while ((node = find_next_bit(dlm->domain_map, O2NM_MAX_NODES, | 552 | while ((node = find_next_bit(dlm->domain_map, O2NM_MAX_NODES, |
| 549 | node + 1)) < O2NM_MAX_NODES) { | 553 | node + 1)) < O2NM_MAX_NODES) { |
| 550 | printk("%d ", node); | 554 | printk("%d ", node); |
| 555 | ++num; | ||
| 551 | } | 556 | } |
| 552 | printk("\n"); | 557 | printk(") %u nodes\n", num); |
| 553 | } | 558 | } |
| 554 | 559 | ||
| 555 | static int dlm_exit_domain_handler(struct o2net_msg *msg, u32 len, void *data, | 560 | static int dlm_exit_domain_handler(struct o2net_msg *msg, u32 len, void *data, |
| @@ -566,11 +571,10 @@ static int dlm_exit_domain_handler(struct o2net_msg *msg, u32 len, void *data, | |||
| 566 | 571 | ||
| 567 | node = exit_msg->node_idx; | 572 | node = exit_msg->node_idx; |
| 568 | 573 | ||
| 569 | printk(KERN_NOTICE "o2dlm: Node %u leaves domain %s\n", node, dlm->name); | ||
| 570 | |||
| 571 | spin_lock(&dlm->spinlock); | 574 | spin_lock(&dlm->spinlock); |
| 572 | clear_bit(node, dlm->domain_map); | 575 | clear_bit(node, dlm->domain_map); |
| 573 | clear_bit(node, dlm->exit_domain_map); | 576 | clear_bit(node, dlm->exit_domain_map); |
| 577 | printk(KERN_NOTICE "o2dlm: Node %u leaves domain %s ", node, dlm->name); | ||
| 574 | __dlm_print_nodes(dlm); | 578 | __dlm_print_nodes(dlm); |
| 575 | 579 | ||
| 576 | /* notify anything attached to the heartbeat events */ | 580 | /* notify anything attached to the heartbeat events */ |
| @@ -755,6 +759,7 @@ void dlm_unregister_domain(struct dlm_ctxt *dlm) | |||
| 755 | 759 | ||
| 756 | dlm_mark_domain_leaving(dlm); | 760 | dlm_mark_domain_leaving(dlm); |
| 757 | dlm_leave_domain(dlm); | 761 | dlm_leave_domain(dlm); |
| 762 | printk(KERN_NOTICE "o2dlm: Leaving domain %s\n", dlm->name); | ||
| 758 | dlm_force_free_mles(dlm); | 763 | dlm_force_free_mles(dlm); |
| 759 | dlm_complete_dlm_shutdown(dlm); | 764 | dlm_complete_dlm_shutdown(dlm); |
| 760 | } | 765 | } |
| @@ -970,7 +975,7 @@ static int dlm_assert_joined_handler(struct o2net_msg *msg, u32 len, void *data, | |||
| 970 | clear_bit(assert->node_idx, dlm->exit_domain_map); | 975 | clear_bit(assert->node_idx, dlm->exit_domain_map); |
| 971 | __dlm_set_joining_node(dlm, DLM_LOCK_RES_OWNER_UNKNOWN); | 976 | __dlm_set_joining_node(dlm, DLM_LOCK_RES_OWNER_UNKNOWN); |
| 972 | 977 | ||
| 973 | printk(KERN_NOTICE "o2dlm: Node %u joins domain %s\n", | 978 | printk(KERN_NOTICE "o2dlm: Node %u joins domain %s ", |
| 974 | assert->node_idx, dlm->name); | 979 | assert->node_idx, dlm->name); |
| 975 | __dlm_print_nodes(dlm); | 980 | __dlm_print_nodes(dlm); |
| 976 | 981 | ||
| @@ -1701,8 +1706,10 @@ static int dlm_try_to_join_domain(struct dlm_ctxt *dlm) | |||
| 1701 | bail: | 1706 | bail: |
| 1702 | spin_lock(&dlm->spinlock); | 1707 | spin_lock(&dlm->spinlock); |
| 1703 | __dlm_set_joining_node(dlm, DLM_LOCK_RES_OWNER_UNKNOWN); | 1708 | __dlm_set_joining_node(dlm, DLM_LOCK_RES_OWNER_UNKNOWN); |
| 1704 | if (!status) | 1709 | if (!status) { |
| 1710 | printk(KERN_NOTICE "o2dlm: Joining domain %s ", dlm->name); | ||
| 1705 | __dlm_print_nodes(dlm); | 1711 | __dlm_print_nodes(dlm); |
| 1712 | } | ||
| 1706 | spin_unlock(&dlm->spinlock); | 1713 | spin_unlock(&dlm->spinlock); |
| 1707 | 1714 | ||
| 1708 | if (ctxt) { | 1715 | if (ctxt) { |
| @@ -2131,13 +2138,6 @@ struct dlm_ctxt * dlm_register_domain(const char *domain, | |||
| 2131 | goto leave; | 2138 | goto leave; |
| 2132 | } | 2139 | } |
| 2133 | 2140 | ||
| 2134 | if (!o2hb_check_local_node_heartbeating()) { | ||
| 2135 | mlog(ML_ERROR, "the local node has not been configured, or is " | ||
| 2136 | "not heartbeating\n"); | ||
| 2137 | ret = -EPROTO; | ||
| 2138 | goto leave; | ||
| 2139 | } | ||
| 2140 | |||
| 2141 | mlog(0, "register called for domain \"%s\"\n", domain); | 2141 | mlog(0, "register called for domain \"%s\"\n", domain); |
| 2142 | 2142 | ||
| 2143 | retry: | 2143 | retry: |
diff --git a/fs/ocfs2/dlm/dlmlock.c b/fs/ocfs2/dlm/dlmlock.c index 8d39e0fd66f7..975810b98492 100644 --- a/fs/ocfs2/dlm/dlmlock.c +++ b/fs/ocfs2/dlm/dlmlock.c | |||
| @@ -183,10 +183,6 @@ static enum dlm_status dlmlock_master(struct dlm_ctxt *dlm, | |||
| 183 | kick_thread = 1; | 183 | kick_thread = 1; |
| 184 | } | 184 | } |
| 185 | } | 185 | } |
| 186 | /* reduce the inflight count, this may result in the lockres | ||
| 187 | * being purged below during calc_usage */ | ||
| 188 | if (lock->ml.node == dlm->node_num) | ||
| 189 | dlm_lockres_drop_inflight_ref(dlm, res); | ||
| 190 | 186 | ||
| 191 | spin_unlock(&res->spinlock); | 187 | spin_unlock(&res->spinlock); |
| 192 | wake_up(&res->wq); | 188 | wake_up(&res->wq); |
| @@ -231,10 +227,16 @@ static enum dlm_status dlmlock_remote(struct dlm_ctxt *dlm, | |||
| 231 | lock->ml.type, res->lockname.len, | 227 | lock->ml.type, res->lockname.len, |
| 232 | res->lockname.name, flags); | 228 | res->lockname.name, flags); |
| 233 | 229 | ||
| 230 | /* | ||
| 231 | * Wait if resource is getting recovered, remastered, etc. | ||
| 232 | * If the resource was remastered and new owner is self, then exit. | ||
| 233 | */ | ||
| 234 | spin_lock(&res->spinlock); | 234 | spin_lock(&res->spinlock); |
| 235 | |||
| 236 | /* will exit this call with spinlock held */ | ||
| 237 | __dlm_wait_on_lockres(res); | 235 | __dlm_wait_on_lockres(res); |
| 236 | if (res->owner == dlm->node_num) { | ||
| 237 | spin_unlock(&res->spinlock); | ||
| 238 | return DLM_RECOVERING; | ||
| 239 | } | ||
| 238 | res->state |= DLM_LOCK_RES_IN_PROGRESS; | 240 | res->state |= DLM_LOCK_RES_IN_PROGRESS; |
| 239 | 241 | ||
| 240 | /* add lock to local (secondary) queue */ | 242 | /* add lock to local (secondary) queue */ |
| @@ -319,27 +321,23 @@ static enum dlm_status dlm_send_remote_lock_request(struct dlm_ctxt *dlm, | |||
| 319 | tmpret = o2net_send_message(DLM_CREATE_LOCK_MSG, dlm->key, &create, | 321 | tmpret = o2net_send_message(DLM_CREATE_LOCK_MSG, dlm->key, &create, |
| 320 | sizeof(create), res->owner, &status); | 322 | sizeof(create), res->owner, &status); |
| 321 | if (tmpret >= 0) { | 323 | if (tmpret >= 0) { |
| 322 | // successfully sent and received | 324 | ret = status; |
| 323 | ret = status; // this is already a dlm_status | ||
| 324 | if (ret == DLM_REJECTED) { | 325 | if (ret == DLM_REJECTED) { |
| 325 | mlog(ML_ERROR, "%s:%.*s: BUG. this is a stale lockres " | 326 | mlog(ML_ERROR, "%s: res %.*s, Stale lockres no longer " |
| 326 | "no longer owned by %u. that node is coming back " | 327 | "owned by node %u. That node is coming back up " |
| 327 | "up currently.\n", dlm->name, create.namelen, | 328 | "currently.\n", dlm->name, create.namelen, |
| 328 | create.name, res->owner); | 329 | create.name, res->owner); |
| 329 | dlm_print_one_lock_resource(res); | 330 | dlm_print_one_lock_resource(res); |
| 330 | BUG(); | 331 | BUG(); |
| 331 | } | 332 | } |
| 332 | } else { | 333 | } else { |
| 333 | mlog(ML_ERROR, "Error %d when sending message %u (key 0x%x) to " | 334 | mlog(ML_ERROR, "%s: res %.*s, Error %d send CREATE LOCK to " |
| 334 | "node %u\n", tmpret, DLM_CREATE_LOCK_MSG, dlm->key, | 335 | "node %u\n", dlm->name, create.namelen, create.name, |
| 335 | res->owner); | 336 | tmpret, res->owner); |
| 336 | if (dlm_is_host_down(tmpret)) { | 337 | if (dlm_is_host_down(tmpret)) |
| 337 | ret = DLM_RECOVERING; | 338 | ret = DLM_RECOVERING; |
| 338 | mlog(0, "node %u died so returning DLM_RECOVERING " | 339 | else |
| 339 | "from lock message!\n", res->owner); | ||
| 340 | } else { | ||
| 341 | ret = dlm_err_to_dlm_status(tmpret); | 340 | ret = dlm_err_to_dlm_status(tmpret); |
| 342 | } | ||
| 343 | } | 341 | } |
| 344 | 342 | ||
| 345 | return ret; | 343 | return ret; |
| @@ -440,7 +438,7 @@ struct dlm_lock * dlm_new_lock(int type, u8 node, u64 cookie, | |||
| 440 | /* zero memory only if kernel-allocated */ | 438 | /* zero memory only if kernel-allocated */ |
| 441 | lksb = kzalloc(sizeof(*lksb), GFP_NOFS); | 439 | lksb = kzalloc(sizeof(*lksb), GFP_NOFS); |
| 442 | if (!lksb) { | 440 | if (!lksb) { |
| 443 | kfree(lock); | 441 | kmem_cache_free(dlm_lock_cache, lock); |
| 444 | return NULL; | 442 | return NULL; |
| 445 | } | 443 | } |
| 446 | kernel_allocated = 1; | 444 | kernel_allocated = 1; |
| @@ -718,18 +716,10 @@ retry_lock: | |||
| 718 | 716 | ||
| 719 | if (status == DLM_RECOVERING || status == DLM_MIGRATING || | 717 | if (status == DLM_RECOVERING || status == DLM_MIGRATING || |
| 720 | status == DLM_FORWARD) { | 718 | status == DLM_FORWARD) { |
| 721 | mlog(0, "retrying lock with migration/" | ||
| 722 | "recovery/in progress\n"); | ||
| 723 | msleep(100); | 719 | msleep(100); |
| 724 | /* no waiting for dlm_reco_thread */ | ||
| 725 | if (recovery) { | 720 | if (recovery) { |
| 726 | if (status != DLM_RECOVERING) | 721 | if (status != DLM_RECOVERING) |
| 727 | goto retry_lock; | 722 | goto retry_lock; |
| 728 | |||
| 729 | mlog(0, "%s: got RECOVERING " | ||
| 730 | "for $RECOVERY lock, master " | ||
| 731 | "was %u\n", dlm->name, | ||
| 732 | res->owner); | ||
| 733 | /* wait to see the node go down, then | 723 | /* wait to see the node go down, then |
| 734 | * drop down and allow the lockres to | 724 | * drop down and allow the lockres to |
| 735 | * get cleaned up. need to remaster. */ | 725 | * get cleaned up. need to remaster. */ |
| @@ -741,6 +731,14 @@ retry_lock: | |||
| 741 | } | 731 | } |
| 742 | } | 732 | } |
| 743 | 733 | ||
| 734 | /* Inflight taken in dlm_get_lock_resource() is dropped here */ | ||
| 735 | spin_lock(&res->spinlock); | ||
| 736 | dlm_lockres_drop_inflight_ref(dlm, res); | ||
| 737 | spin_unlock(&res->spinlock); | ||
| 738 | |||
| 739 | dlm_lockres_calc_usage(dlm, res); | ||
| 740 | dlm_kick_thread(dlm, res); | ||
| 741 | |||
| 744 | if (status != DLM_NORMAL) { | 742 | if (status != DLM_NORMAL) { |
| 745 | lock->lksb->flags &= ~DLM_LKSB_GET_LVB; | 743 | lock->lksb->flags &= ~DLM_LKSB_GET_LVB; |
| 746 | if (status != DLM_NOTQUEUED) | 744 | if (status != DLM_NOTQUEUED) |
diff --git a/fs/ocfs2/dlm/dlmmaster.c b/fs/ocfs2/dlm/dlmmaster.c index 11eefb8c12e9..005261c333b0 100644 --- a/fs/ocfs2/dlm/dlmmaster.c +++ b/fs/ocfs2/dlm/dlmmaster.c | |||
| @@ -631,39 +631,54 @@ error: | |||
| 631 | return NULL; | 631 | return NULL; |
| 632 | } | 632 | } |
| 633 | 633 | ||
| 634 | void __dlm_lockres_grab_inflight_ref(struct dlm_ctxt *dlm, | 634 | void dlm_lockres_set_refmap_bit(struct dlm_ctxt *dlm, |
| 635 | struct dlm_lock_resource *res, | 635 | struct dlm_lock_resource *res, int bit) |
| 636 | int new_lockres, | ||
| 637 | const char *file, | ||
| 638 | int line) | ||
| 639 | { | 636 | { |
| 640 | if (!new_lockres) | 637 | assert_spin_locked(&res->spinlock); |
| 641 | assert_spin_locked(&res->spinlock); | 638 | |
| 639 | mlog(0, "res %.*s, set node %u, %ps()\n", res->lockname.len, | ||
| 640 | res->lockname.name, bit, __builtin_return_address(0)); | ||
| 641 | |||
| 642 | set_bit(bit, res->refmap); | ||
| 643 | } | ||
| 644 | |||
| 645 | void dlm_lockres_clear_refmap_bit(struct dlm_ctxt *dlm, | ||
| 646 | struct dlm_lock_resource *res, int bit) | ||
| 647 | { | ||
| 648 | assert_spin_locked(&res->spinlock); | ||
| 649 | |||
| 650 | mlog(0, "res %.*s, clr node %u, %ps()\n", res->lockname.len, | ||
| 651 | res->lockname.name, bit, __builtin_return_address(0)); | ||
| 652 | |||
| 653 | clear_bit(bit, res->refmap); | ||
| 654 | } | ||
| 655 | |||
| 656 | |||
| 657 | void dlm_lockres_grab_inflight_ref(struct dlm_ctxt *dlm, | ||
| 658 | struct dlm_lock_resource *res) | ||
| 659 | { | ||
| 660 | assert_spin_locked(&res->spinlock); | ||
| 642 | 661 | ||
| 643 | if (!test_bit(dlm->node_num, res->refmap)) { | ||
| 644 | BUG_ON(res->inflight_locks != 0); | ||
| 645 | dlm_lockres_set_refmap_bit(dlm->node_num, res); | ||
| 646 | } | ||
| 647 | res->inflight_locks++; | 662 | res->inflight_locks++; |
| 648 | mlog(0, "%s:%.*s: inflight++: now %u\n", | 663 | |
| 649 | dlm->name, res->lockname.len, res->lockname.name, | 664 | mlog(0, "%s: res %.*s, inflight++: now %u, %ps()\n", dlm->name, |
| 650 | res->inflight_locks); | 665 | res->lockname.len, res->lockname.name, res->inflight_locks, |
| 666 | __builtin_return_address(0)); | ||
| 651 | } | 667 | } |
| 652 | 668 | ||
| 653 | void __dlm_lockres_drop_inflight_ref(struct dlm_ctxt *dlm, | 669 | void dlm_lockres_drop_inflight_ref(struct dlm_ctxt *dlm, |
| 654 | struct dlm_lock_resource *res, | 670 | struct dlm_lock_resource *res) |
| 655 | const char *file, | ||
| 656 | int line) | ||
| 657 | { | 671 | { |
| 658 | assert_spin_locked(&res->spinlock); | 672 | assert_spin_locked(&res->spinlock); |
| 659 | 673 | ||
| 660 | BUG_ON(res->inflight_locks == 0); | 674 | BUG_ON(res->inflight_locks == 0); |
| 675 | |||
| 661 | res->inflight_locks--; | 676 | res->inflight_locks--; |
| 662 | mlog(0, "%s:%.*s: inflight--: now %u\n", | 677 | |
| 663 | dlm->name, res->lockname.len, res->lockname.name, | 678 | mlog(0, "%s: res %.*s, inflight--: now %u, %ps()\n", dlm->name, |
| 664 | res->inflight_locks); | 679 | res->lockname.len, res->lockname.name, res->inflight_locks, |
| 665 | if (res->inflight_locks == 0) | 680 | __builtin_return_address(0)); |
| 666 | dlm_lockres_clear_refmap_bit(dlm->node_num, res); | 681 | |
| 667 | wake_up(&res->wq); | 682 | wake_up(&res->wq); |
| 668 | } | 683 | } |
| 669 | 684 | ||
| @@ -697,7 +712,6 @@ struct dlm_lock_resource * dlm_get_lock_resource(struct dlm_ctxt *dlm, | |||
| 697 | unsigned int hash; | 712 | unsigned int hash; |
| 698 | int tries = 0; | 713 | int tries = 0; |
| 699 | int bit, wait_on_recovery = 0; | 714 | int bit, wait_on_recovery = 0; |
| 700 | int drop_inflight_if_nonlocal = 0; | ||
| 701 | 715 | ||
| 702 | BUG_ON(!lockid); | 716 | BUG_ON(!lockid); |
| 703 | 717 | ||
| @@ -709,36 +723,33 @@ lookup: | |||
| 709 | spin_lock(&dlm->spinlock); | 723 | spin_lock(&dlm->spinlock); |
| 710 | tmpres = __dlm_lookup_lockres_full(dlm, lockid, namelen, hash); | 724 | tmpres = __dlm_lookup_lockres_full(dlm, lockid, namelen, hash); |
| 711 | if (tmpres) { | 725 | if (tmpres) { |
| 712 | int dropping_ref = 0; | ||
| 713 | |||
| 714 | spin_unlock(&dlm->spinlock); | 726 | spin_unlock(&dlm->spinlock); |
| 715 | |||
| 716 | spin_lock(&tmpres->spinlock); | 727 | spin_lock(&tmpres->spinlock); |
| 717 | /* We wait for the other thread that is mastering the resource */ | 728 | /* Wait on the thread that is mastering the resource */ |
| 718 | if (tmpres->owner == DLM_LOCK_RES_OWNER_UNKNOWN) { | 729 | if (tmpres->owner == DLM_LOCK_RES_OWNER_UNKNOWN) { |
| 719 | __dlm_wait_on_lockres(tmpres); | 730 | __dlm_wait_on_lockres(tmpres); |
| 720 | BUG_ON(tmpres->owner == DLM_LOCK_RES_OWNER_UNKNOWN); | 731 | BUG_ON(tmpres->owner == DLM_LOCK_RES_OWNER_UNKNOWN); |
| 732 | spin_unlock(&tmpres->spinlock); | ||
| 733 | dlm_lockres_put(tmpres); | ||
| 734 | tmpres = NULL; | ||
| 735 | goto lookup; | ||
| 721 | } | 736 | } |
| 722 | 737 | ||
| 723 | if (tmpres->owner == dlm->node_num) { | 738 | /* Wait on the resource purge to complete before continuing */ |
| 724 | BUG_ON(tmpres->state & DLM_LOCK_RES_DROPPING_REF); | 739 | if (tmpres->state & DLM_LOCK_RES_DROPPING_REF) { |
| 725 | dlm_lockres_grab_inflight_ref(dlm, tmpres); | 740 | BUG_ON(tmpres->owner == dlm->node_num); |
| 726 | } else if (tmpres->state & DLM_LOCK_RES_DROPPING_REF) | 741 | __dlm_wait_on_lockres_flags(tmpres, |
| 727 | dropping_ref = 1; | 742 | DLM_LOCK_RES_DROPPING_REF); |
| 728 | spin_unlock(&tmpres->spinlock); | ||
| 729 | |||
| 730 | /* wait until done messaging the master, drop our ref to allow | ||
| 731 | * the lockres to be purged, start over. */ | ||
| 732 | if (dropping_ref) { | ||
| 733 | spin_lock(&tmpres->spinlock); | ||
| 734 | __dlm_wait_on_lockres_flags(tmpres, DLM_LOCK_RES_DROPPING_REF); | ||
| 735 | spin_unlock(&tmpres->spinlock); | 743 | spin_unlock(&tmpres->spinlock); |
| 736 | dlm_lockres_put(tmpres); | 744 | dlm_lockres_put(tmpres); |
| 737 | tmpres = NULL; | 745 | tmpres = NULL; |
| 738 | goto lookup; | 746 | goto lookup; |
| 739 | } | 747 | } |
| 740 | 748 | ||
| 741 | mlog(0, "found in hash!\n"); | 749 | /* Grab inflight ref to pin the resource */ |
| 750 | dlm_lockres_grab_inflight_ref(dlm, tmpres); | ||
| 751 | |||
| 752 | spin_unlock(&tmpres->spinlock); | ||
| 742 | if (res) | 753 | if (res) |
| 743 | dlm_lockres_put(res); | 754 | dlm_lockres_put(res); |
| 744 | res = tmpres; | 755 | res = tmpres; |
| @@ -829,8 +840,8 @@ lookup: | |||
| 829 | * but they might own this lockres. wait on them. */ | 840 | * but they might own this lockres. wait on them. */ |
| 830 | bit = find_next_bit(dlm->recovery_map, O2NM_MAX_NODES, 0); | 841 | bit = find_next_bit(dlm->recovery_map, O2NM_MAX_NODES, 0); |
| 831 | if (bit < O2NM_MAX_NODES) { | 842 | if (bit < O2NM_MAX_NODES) { |
| 832 | mlog(ML_NOTICE, "%s:%.*s: at least one node (%d) to " | 843 | mlog(0, "%s: res %.*s, At least one node (%d) " |
| 833 | "recover before lock mastery can begin\n", | 844 | "to recover before lock mastery can begin\n", |
| 834 | dlm->name, namelen, (char *)lockid, bit); | 845 | dlm->name, namelen, (char *)lockid, bit); |
| 835 | wait_on_recovery = 1; | 846 | wait_on_recovery = 1; |
| 836 | } | 847 | } |
| @@ -843,12 +854,11 @@ lookup: | |||
| 843 | 854 | ||
| 844 | /* finally add the lockres to its hash bucket */ | 855 | /* finally add the lockres to its hash bucket */ |
| 845 | __dlm_insert_lockres(dlm, res); | 856 | __dlm_insert_lockres(dlm, res); |
| 846 | /* since this lockres is new it doesn't not require the spinlock */ | ||
| 847 | dlm_lockres_grab_inflight_ref_new(dlm, res); | ||
| 848 | 857 | ||
| 849 | /* if this node does not become the master make sure to drop | 858 | /* Grab inflight ref to pin the resource */ |
| 850 | * this inflight reference below */ | 859 | spin_lock(&res->spinlock); |
| 851 | drop_inflight_if_nonlocal = 1; | 860 | dlm_lockres_grab_inflight_ref(dlm, res); |
| 861 | spin_unlock(&res->spinlock); | ||
| 852 | 862 | ||
| 853 | /* get an extra ref on the mle in case this is a BLOCK | 863 | /* get an extra ref on the mle in case this is a BLOCK |
| 854 | * if so, the creator of the BLOCK may try to put the last | 864 | * if so, the creator of the BLOCK may try to put the last |
| @@ -864,8 +874,8 @@ redo_request: | |||
| 864 | * dlm spinlock would be detectable be a change on the mle, | 874 | * dlm spinlock would be detectable be a change on the mle, |
| 865 | * so we only need to clear out the recovery map once. */ | 875 | * so we only need to clear out the recovery map once. */ |
| 866 | if (dlm_is_recovery_lock(lockid, namelen)) { | 876 | if (dlm_is_recovery_lock(lockid, namelen)) { |
| 867 | mlog(ML_NOTICE, "%s: recovery map is not empty, but " | 877 | mlog(0, "%s: Recovery map is not empty, but must " |
| 868 | "must master $RECOVERY lock now\n", dlm->name); | 878 | "master $RECOVERY lock now\n", dlm->name); |
| 869 | if (!dlm_pre_master_reco_lockres(dlm, res)) | 879 | if (!dlm_pre_master_reco_lockres(dlm, res)) |
| 870 | wait_on_recovery = 0; | 880 | wait_on_recovery = 0; |
| 871 | else { | 881 | else { |
| @@ -883,8 +893,8 @@ redo_request: | |||
| 883 | spin_lock(&dlm->spinlock); | 893 | spin_lock(&dlm->spinlock); |
| 884 | bit = find_next_bit(dlm->recovery_map, O2NM_MAX_NODES, 0); | 894 | bit = find_next_bit(dlm->recovery_map, O2NM_MAX_NODES, 0); |
| 885 | if (bit < O2NM_MAX_NODES) { | 895 | if (bit < O2NM_MAX_NODES) { |
| 886 | mlog(ML_NOTICE, "%s:%.*s: at least one node (%d) to " | 896 | mlog(0, "%s: res %.*s, At least one node (%d) " |
| 887 | "recover before lock mastery can begin\n", | 897 | "to recover before lock mastery can begin\n", |
| 888 | dlm->name, namelen, (char *)lockid, bit); | 898 | dlm->name, namelen, (char *)lockid, bit); |
| 889 | wait_on_recovery = 1; | 899 | wait_on_recovery = 1; |
| 890 | } else | 900 | } else |
| @@ -913,8 +923,8 @@ redo_request: | |||
| 913 | * yet, keep going until it does. this is how the | 923 | * yet, keep going until it does. this is how the |
| 914 | * master will know that asserts are needed back to | 924 | * master will know that asserts are needed back to |
| 915 | * the lower nodes. */ | 925 | * the lower nodes. */ |
| 916 | mlog(0, "%s:%.*s: requests only up to %u but master " | 926 | mlog(0, "%s: res %.*s, Requests only up to %u but " |
| 917 | "is %u, keep going\n", dlm->name, namelen, | 927 | "master is %u, keep going\n", dlm->name, namelen, |
| 918 | lockid, nodenum, mle->master); | 928 | lockid, nodenum, mle->master); |
| 919 | } | 929 | } |
| 920 | } | 930 | } |
| @@ -924,13 +934,12 @@ wait: | |||
| 924 | ret = dlm_wait_for_lock_mastery(dlm, res, mle, &blocked); | 934 | ret = dlm_wait_for_lock_mastery(dlm, res, mle, &blocked); |
| 925 | if (ret < 0) { | 935 | if (ret < 0) { |
| 926 | wait_on_recovery = 1; | 936 | wait_on_recovery = 1; |
| 927 | mlog(0, "%s:%.*s: node map changed, redo the " | 937 | mlog(0, "%s: res %.*s, Node map changed, redo the master " |
| 928 | "master request now, blocked=%d\n", | 938 | "request now, blocked=%d\n", dlm->name, res->lockname.len, |
| 929 | dlm->name, res->lockname.len, | ||
| 930 | res->lockname.name, blocked); | 939 | res->lockname.name, blocked); |
| 931 | if (++tries > 20) { | 940 | if (++tries > 20) { |
| 932 | mlog(ML_ERROR, "%s:%.*s: spinning on " | 941 | mlog(ML_ERROR, "%s: res %.*s, Spinning on " |
| 933 | "dlm_wait_for_lock_mastery, blocked=%d\n", | 942 | "dlm_wait_for_lock_mastery, blocked = %d\n", |
| 934 | dlm->name, res->lockname.len, | 943 | dlm->name, res->lockname.len, |
| 935 | res->lockname.name, blocked); | 944 | res->lockname.name, blocked); |
| 936 | dlm_print_one_lock_resource(res); | 945 | dlm_print_one_lock_resource(res); |
| @@ -940,7 +949,8 @@ wait: | |||
| 940 | goto redo_request; | 949 | goto redo_request; |
| 941 | } | 950 | } |
| 942 | 951 | ||
| 943 | mlog(0, "lockres mastered by %u\n", res->owner); | 952 | mlog(0, "%s: res %.*s, Mastered by %u\n", dlm->name, res->lockname.len, |
| 953 | res->lockname.name, res->owner); | ||
| 944 | /* make sure we never continue without this */ | 954 | /* make sure we never continue without this */ |
| 945 | BUG_ON(res->owner == O2NM_MAX_NODES); | 955 | BUG_ON(res->owner == O2NM_MAX_NODES); |
| 946 | 956 | ||
| @@ -952,8 +962,6 @@ wait: | |||
| 952 | 962 | ||
| 953 | wake_waiters: | 963 | wake_waiters: |
| 954 | spin_lock(&res->spinlock); | 964 | spin_lock(&res->spinlock); |
| 955 | if (res->owner != dlm->node_num && drop_inflight_if_nonlocal) | ||
| 956 | dlm_lockres_drop_inflight_ref(dlm, res); | ||
| 957 | res->state &= ~DLM_LOCK_RES_IN_PROGRESS; | 965 | res->state &= ~DLM_LOCK_RES_IN_PROGRESS; |
| 958 | spin_unlock(&res->spinlock); | 966 | spin_unlock(&res->spinlock); |
| 959 | wake_up(&res->wq); | 967 | wake_up(&res->wq); |
| @@ -1426,9 +1434,7 @@ way_up_top: | |||
| 1426 | } | 1434 | } |
| 1427 | 1435 | ||
| 1428 | if (res->owner == dlm->node_num) { | 1436 | if (res->owner == dlm->node_num) { |
| 1429 | mlog(0, "%s:%.*s: setting bit %u in refmap\n", | 1437 | dlm_lockres_set_refmap_bit(dlm, res, request->node_idx); |
| 1430 | dlm->name, namelen, name, request->node_idx); | ||
| 1431 | dlm_lockres_set_refmap_bit(request->node_idx, res); | ||
| 1432 | spin_unlock(&res->spinlock); | 1438 | spin_unlock(&res->spinlock); |
| 1433 | response = DLM_MASTER_RESP_YES; | 1439 | response = DLM_MASTER_RESP_YES; |
| 1434 | if (mle) | 1440 | if (mle) |
| @@ -1493,10 +1499,8 @@ way_up_top: | |||
| 1493 | * go back and clean the mles on any | 1499 | * go back and clean the mles on any |
| 1494 | * other nodes */ | 1500 | * other nodes */ |
| 1495 | dispatch_assert = 1; | 1501 | dispatch_assert = 1; |
| 1496 | dlm_lockres_set_refmap_bit(request->node_idx, res); | 1502 | dlm_lockres_set_refmap_bit(dlm, res, |
| 1497 | mlog(0, "%s:%.*s: setting bit %u in refmap\n", | 1503 | request->node_idx); |
| 1498 | dlm->name, namelen, name, | ||
| 1499 | request->node_idx); | ||
| 1500 | } else | 1504 | } else |
| 1501 | response = DLM_MASTER_RESP_NO; | 1505 | response = DLM_MASTER_RESP_NO; |
| 1502 | } else { | 1506 | } else { |
| @@ -1702,7 +1706,7 @@ again: | |||
| 1702 | "lockres, set the bit in the refmap\n", | 1706 | "lockres, set the bit in the refmap\n", |
| 1703 | namelen, lockname, to); | 1707 | namelen, lockname, to); |
| 1704 | spin_lock(&res->spinlock); | 1708 | spin_lock(&res->spinlock); |
| 1705 | dlm_lockres_set_refmap_bit(to, res); | 1709 | dlm_lockres_set_refmap_bit(dlm, res, to); |
| 1706 | spin_unlock(&res->spinlock); | 1710 | spin_unlock(&res->spinlock); |
| 1707 | } | 1711 | } |
| 1708 | } | 1712 | } |
| @@ -2187,8 +2191,6 @@ int dlm_drop_lockres_ref(struct dlm_ctxt *dlm, struct dlm_lock_resource *res) | |||
| 2187 | namelen = res->lockname.len; | 2191 | namelen = res->lockname.len; |
| 2188 | BUG_ON(namelen > O2NM_MAX_NAME_LEN); | 2192 | BUG_ON(namelen > O2NM_MAX_NAME_LEN); |
| 2189 | 2193 | ||
| 2190 | mlog(0, "%s:%.*s: sending deref to %d\n", | ||
| 2191 | dlm->name, namelen, lockname, res->owner); | ||
| 2192 | memset(&deref, 0, sizeof(deref)); | 2194 | memset(&deref, 0, sizeof(deref)); |
| 2193 | deref.node_idx = dlm->node_num; | 2195 | deref.node_idx = dlm->node_num; |
| 2194 | deref.namelen = namelen; | 2196 | deref.namelen = namelen; |
| @@ -2197,14 +2199,12 @@ int dlm_drop_lockres_ref(struct dlm_ctxt *dlm, struct dlm_lock_resource *res) | |||
| 2197 | ret = o2net_send_message(DLM_DEREF_LOCKRES_MSG, dlm->key, | 2199 | ret = o2net_send_message(DLM_DEREF_LOCKRES_MSG, dlm->key, |
| 2198 | &deref, sizeof(deref), res->owner, &r); | 2200 | &deref, sizeof(deref), res->owner, &r); |
| 2199 | if (ret < 0) | 2201 | if (ret < 0) |
| 2200 | mlog(ML_ERROR, "Error %d when sending message %u (key 0x%x) to " | 2202 | mlog(ML_ERROR, "%s: res %.*s, error %d send DEREF to node %u\n", |
| 2201 | "node %u\n", ret, DLM_DEREF_LOCKRES_MSG, dlm->key, | 2203 | dlm->name, namelen, lockname, ret, res->owner); |
| 2202 | res->owner); | ||
| 2203 | else if (r < 0) { | 2204 | else if (r < 0) { |
| 2204 | /* BAD. other node says I did not have a ref. */ | 2205 | /* BAD. other node says I did not have a ref. */ |
| 2205 | mlog(ML_ERROR,"while dropping ref on %s:%.*s " | 2206 | mlog(ML_ERROR, "%s: res %.*s, DEREF to node %u got %d\n", |
| 2206 | "(master=%u) got %d.\n", dlm->name, namelen, | 2207 | dlm->name, namelen, lockname, res->owner, r); |
| 2207 | lockname, res->owner, r); | ||
| 2208 | dlm_print_one_lock_resource(res); | 2208 | dlm_print_one_lock_resource(res); |
| 2209 | BUG(); | 2209 | BUG(); |
| 2210 | } | 2210 | } |
| @@ -2260,7 +2260,7 @@ int dlm_deref_lockres_handler(struct o2net_msg *msg, u32 len, void *data, | |||
| 2260 | else { | 2260 | else { |
| 2261 | BUG_ON(res->state & DLM_LOCK_RES_DROPPING_REF); | 2261 | BUG_ON(res->state & DLM_LOCK_RES_DROPPING_REF); |
| 2262 | if (test_bit(node, res->refmap)) { | 2262 | if (test_bit(node, res->refmap)) { |
| 2263 | dlm_lockres_clear_refmap_bit(node, res); | 2263 | dlm_lockres_clear_refmap_bit(dlm, res, node); |
| 2264 | cleared = 1; | 2264 | cleared = 1; |
| 2265 | } | 2265 | } |
| 2266 | } | 2266 | } |
| @@ -2320,7 +2320,7 @@ static void dlm_deref_lockres_worker(struct dlm_work_item *item, void *data) | |||
| 2320 | BUG_ON(res->state & DLM_LOCK_RES_DROPPING_REF); | 2320 | BUG_ON(res->state & DLM_LOCK_RES_DROPPING_REF); |
| 2321 | if (test_bit(node, res->refmap)) { | 2321 | if (test_bit(node, res->refmap)) { |
| 2322 | __dlm_wait_on_lockres_flags(res, DLM_LOCK_RES_SETREF_INPROG); | 2322 | __dlm_wait_on_lockres_flags(res, DLM_LOCK_RES_SETREF_INPROG); |
| 2323 | dlm_lockres_clear_refmap_bit(node, res); | 2323 | dlm_lockres_clear_refmap_bit(dlm, res, node); |
| 2324 | cleared = 1; | 2324 | cleared = 1; |
| 2325 | } | 2325 | } |
| 2326 | spin_unlock(&res->spinlock); | 2326 | spin_unlock(&res->spinlock); |
| @@ -2802,7 +2802,8 @@ static void dlm_remove_nonlocal_locks(struct dlm_ctxt *dlm, | |||
| 2802 | BUG_ON(!list_empty(&lock->bast_list)); | 2802 | BUG_ON(!list_empty(&lock->bast_list)); |
| 2803 | BUG_ON(lock->ast_pending); | 2803 | BUG_ON(lock->ast_pending); |
| 2804 | BUG_ON(lock->bast_pending); | 2804 | BUG_ON(lock->bast_pending); |
| 2805 | dlm_lockres_clear_refmap_bit(lock->ml.node, res); | 2805 | dlm_lockres_clear_refmap_bit(dlm, res, |
| 2806 | lock->ml.node); | ||
| 2806 | list_del_init(&lock->list); | 2807 | list_del_init(&lock->list); |
| 2807 | dlm_lock_put(lock); | 2808 | dlm_lock_put(lock); |
| 2808 | /* In a normal unlock, we would have added a | 2809 | /* In a normal unlock, we would have added a |
| @@ -2823,7 +2824,7 @@ static void dlm_remove_nonlocal_locks(struct dlm_ctxt *dlm, | |||
| 2823 | mlog(0, "%s:%.*s: node %u had a ref to this " | 2824 | mlog(0, "%s:%.*s: node %u had a ref to this " |
| 2824 | "migrating lockres, clearing\n", dlm->name, | 2825 | "migrating lockres, clearing\n", dlm->name, |
| 2825 | res->lockname.len, res->lockname.name, bit); | 2826 | res->lockname.len, res->lockname.name, bit); |
| 2826 | dlm_lockres_clear_refmap_bit(bit, res); | 2827 | dlm_lockres_clear_refmap_bit(dlm, res, bit); |
| 2827 | } | 2828 | } |
| 2828 | bit++; | 2829 | bit++; |
| 2829 | } | 2830 | } |
| @@ -2916,9 +2917,9 @@ static int dlm_do_migrate_request(struct dlm_ctxt *dlm, | |||
| 2916 | &migrate, sizeof(migrate), nodenum, | 2917 | &migrate, sizeof(migrate), nodenum, |
| 2917 | &status); | 2918 | &status); |
| 2918 | if (ret < 0) { | 2919 | if (ret < 0) { |
| 2919 | mlog(ML_ERROR, "Error %d when sending message %u (key " | 2920 | mlog(ML_ERROR, "%s: res %.*s, Error %d send " |
| 2920 | "0x%x) to node %u\n", ret, DLM_MIGRATE_REQUEST_MSG, | 2921 | "MIGRATE_REQUEST to node %u\n", dlm->name, |
| 2921 | dlm->key, nodenum); | 2922 | migrate.namelen, migrate.name, ret, nodenum); |
| 2922 | if (!dlm_is_host_down(ret)) { | 2923 | if (!dlm_is_host_down(ret)) { |
| 2923 | mlog(ML_ERROR, "unhandled error=%d!\n", ret); | 2924 | mlog(ML_ERROR, "unhandled error=%d!\n", ret); |
| 2924 | BUG(); | 2925 | BUG(); |
| @@ -2937,7 +2938,7 @@ static int dlm_do_migrate_request(struct dlm_ctxt *dlm, | |||
| 2937 | dlm->name, res->lockname.len, res->lockname.name, | 2938 | dlm->name, res->lockname.len, res->lockname.name, |
| 2938 | nodenum); | 2939 | nodenum); |
| 2939 | spin_lock(&res->spinlock); | 2940 | spin_lock(&res->spinlock); |
| 2940 | dlm_lockres_set_refmap_bit(nodenum, res); | 2941 | dlm_lockres_set_refmap_bit(dlm, res, nodenum); |
| 2941 | spin_unlock(&res->spinlock); | 2942 | spin_unlock(&res->spinlock); |
| 2942 | } | 2943 | } |
| 2943 | } | 2944 | } |
| @@ -3271,7 +3272,7 @@ int dlm_finish_migration(struct dlm_ctxt *dlm, struct dlm_lock_resource *res, | |||
| 3271 | * mastery reference here since old_master will briefly have | 3272 | * mastery reference here since old_master will briefly have |
| 3272 | * a reference after the migration completes */ | 3273 | * a reference after the migration completes */ |
| 3273 | spin_lock(&res->spinlock); | 3274 | spin_lock(&res->spinlock); |
| 3274 | dlm_lockres_set_refmap_bit(old_master, res); | 3275 | dlm_lockres_set_refmap_bit(dlm, res, old_master); |
| 3275 | spin_unlock(&res->spinlock); | 3276 | spin_unlock(&res->spinlock); |
| 3276 | 3277 | ||
| 3277 | mlog(0, "now time to do a migrate request to other nodes\n"); | 3278 | mlog(0, "now time to do a migrate request to other nodes\n"); |
diff --git a/fs/ocfs2/dlm/dlmrecovery.c b/fs/ocfs2/dlm/dlmrecovery.c index 7efab6d28a21..01ebfd0bdad7 100644 --- a/fs/ocfs2/dlm/dlmrecovery.c +++ b/fs/ocfs2/dlm/dlmrecovery.c | |||
| @@ -362,40 +362,38 @@ static int dlm_is_node_recovered(struct dlm_ctxt *dlm, u8 node) | |||
| 362 | } | 362 | } |
| 363 | 363 | ||
| 364 | 364 | ||
| 365 | int dlm_wait_for_node_death(struct dlm_ctxt *dlm, u8 node, int timeout) | 365 | void dlm_wait_for_node_death(struct dlm_ctxt *dlm, u8 node, int timeout) |
| 366 | { | 366 | { |
| 367 | if (timeout) { | 367 | if (dlm_is_node_dead(dlm, node)) |
| 368 | mlog(ML_NOTICE, "%s: waiting %dms for notification of " | 368 | return; |
| 369 | "death of node %u\n", dlm->name, timeout, node); | 369 | |
| 370 | printk(KERN_NOTICE "o2dlm: Waiting on the death of node %u in " | ||
| 371 | "domain %s\n", node, dlm->name); | ||
| 372 | |||
| 373 | if (timeout) | ||
| 370 | wait_event_timeout(dlm->dlm_reco_thread_wq, | 374 | wait_event_timeout(dlm->dlm_reco_thread_wq, |
| 371 | dlm_is_node_dead(dlm, node), | 375 | dlm_is_node_dead(dlm, node), |
| 372 | msecs_to_jiffies(timeout)); | 376 | msecs_to_jiffies(timeout)); |
| 373 | } else { | 377 | else |
| 374 | mlog(ML_NOTICE, "%s: waiting indefinitely for notification " | ||
| 375 | "of death of node %u\n", dlm->name, node); | ||
| 376 | wait_event(dlm->dlm_reco_thread_wq, | 378 | wait_event(dlm->dlm_reco_thread_wq, |
| 377 | dlm_is_node_dead(dlm, node)); | 379 | dlm_is_node_dead(dlm, node)); |
| 378 | } | ||
| 379 | /* for now, return 0 */ | ||
| 380 | return 0; | ||
| 381 | } | 380 | } |
| 382 | 381 | ||
| 383 | int dlm_wait_for_node_recovery(struct dlm_ctxt *dlm, u8 node, int timeout) | 382 | void dlm_wait_for_node_recovery(struct dlm_ctxt *dlm, u8 node, int timeout) |
| 384 | { | 383 | { |
| 385 | if (timeout) { | 384 | if (dlm_is_node_recovered(dlm, node)) |
| 386 | mlog(0, "%s: waiting %dms for notification of " | 385 | return; |
| 387 | "recovery of node %u\n", dlm->name, timeout, node); | 386 | |
| 387 | printk(KERN_NOTICE "o2dlm: Waiting on the recovery of node %u in " | ||
| 388 | "domain %s\n", node, dlm->name); | ||
| 389 | |||
| 390 | if (timeout) | ||
| 388 | wait_event_timeout(dlm->dlm_reco_thread_wq, | 391 | wait_event_timeout(dlm->dlm_reco_thread_wq, |
| 389 | dlm_is_node_recovered(dlm, node), | 392 | dlm_is_node_recovered(dlm, node), |
| 390 | msecs_to_jiffies(timeout)); | 393 | msecs_to_jiffies(timeout)); |
| 391 | } else { | 394 | else |
| 392 | mlog(0, "%s: waiting indefinitely for notification " | ||
| 393 | "of recovery of node %u\n", dlm->name, node); | ||
| 394 | wait_event(dlm->dlm_reco_thread_wq, | 395 | wait_event(dlm->dlm_reco_thread_wq, |
| 395 | dlm_is_node_recovered(dlm, node)); | 396 | dlm_is_node_recovered(dlm, node)); |
| 396 | } | ||
| 397 | /* for now, return 0 */ | ||
| 398 | return 0; | ||
| 399 | } | 397 | } |
| 400 | 398 | ||
| 401 | /* callers of the top-level api calls (dlmlock/dlmunlock) should | 399 | /* callers of the top-level api calls (dlmlock/dlmunlock) should |
| @@ -430,6 +428,8 @@ static void dlm_begin_recovery(struct dlm_ctxt *dlm) | |||
| 430 | { | 428 | { |
| 431 | spin_lock(&dlm->spinlock); | 429 | spin_lock(&dlm->spinlock); |
| 432 | BUG_ON(dlm->reco.state & DLM_RECO_STATE_ACTIVE); | 430 | BUG_ON(dlm->reco.state & DLM_RECO_STATE_ACTIVE); |
| 431 | printk(KERN_NOTICE "o2dlm: Begin recovery on domain %s for node %u\n", | ||
| 432 | dlm->name, dlm->reco.dead_node); | ||
| 433 | dlm->reco.state |= DLM_RECO_STATE_ACTIVE; | 433 | dlm->reco.state |= DLM_RECO_STATE_ACTIVE; |
| 434 | spin_unlock(&dlm->spinlock); | 434 | spin_unlock(&dlm->spinlock); |
| 435 | } | 435 | } |
| @@ -440,9 +440,18 @@ static void dlm_end_recovery(struct dlm_ctxt *dlm) | |||
| 440 | BUG_ON(!(dlm->reco.state & DLM_RECO_STATE_ACTIVE)); | 440 | BUG_ON(!(dlm->reco.state & DLM_RECO_STATE_ACTIVE)); |
| 441 | dlm->reco.state &= ~DLM_RECO_STATE_ACTIVE; | 441 | dlm->reco.state &= ~DLM_RECO_STATE_ACTIVE; |
| 442 | spin_unlock(&dlm->spinlock); | 442 | spin_unlock(&dlm->spinlock); |
| 443 | printk(KERN_NOTICE "o2dlm: End recovery on domain %s\n", dlm->name); | ||
| 443 | wake_up(&dlm->reco.event); | 444 | wake_up(&dlm->reco.event); |
| 444 | } | 445 | } |
| 445 | 446 | ||
| 447 | static void dlm_print_recovery_master(struct dlm_ctxt *dlm) | ||
| 448 | { | ||
| 449 | printk(KERN_NOTICE "o2dlm: Node %u (%s) is the Recovery Master for the " | ||
| 450 | "dead node %u in domain %s\n", dlm->reco.new_master, | ||
| 451 | (dlm->node_num == dlm->reco.new_master ? "me" : "he"), | ||
| 452 | dlm->reco.dead_node, dlm->name); | ||
| 453 | } | ||
| 454 | |||
| 446 | static int dlm_do_recovery(struct dlm_ctxt *dlm) | 455 | static int dlm_do_recovery(struct dlm_ctxt *dlm) |
| 447 | { | 456 | { |
| 448 | int status = 0; | 457 | int status = 0; |
| @@ -505,9 +514,8 @@ static int dlm_do_recovery(struct dlm_ctxt *dlm) | |||
| 505 | } | 514 | } |
| 506 | mlog(0, "another node will master this recovery session.\n"); | 515 | mlog(0, "another node will master this recovery session.\n"); |
| 507 | } | 516 | } |
| 508 | mlog(0, "dlm=%s (%d), new_master=%u, this node=%u, dead_node=%u\n", | 517 | |
| 509 | dlm->name, task_pid_nr(dlm->dlm_reco_thread_task), dlm->reco.new_master, | 518 | dlm_print_recovery_master(dlm); |
| 510 | dlm->node_num, dlm->reco.dead_node); | ||
| 511 | 519 | ||
| 512 | /* it is safe to start everything back up here | 520 | /* it is safe to start everything back up here |
| 513 | * because all of the dead node's lock resources | 521 | * because all of the dead node's lock resources |
| @@ -518,15 +526,13 @@ static int dlm_do_recovery(struct dlm_ctxt *dlm) | |||
| 518 | return 0; | 526 | return 0; |
| 519 | 527 | ||
| 520 | master_here: | 528 | master_here: |
| 521 | mlog(ML_NOTICE, "(%d) Node %u is the Recovery Master for the Dead Node " | 529 | dlm_print_recovery_master(dlm); |
| 522 | "%u for Domain %s\n", task_pid_nr(dlm->dlm_reco_thread_task), | ||
| 523 | dlm->node_num, dlm->reco.dead_node, dlm->name); | ||
| 524 | 530 | ||
| 525 | status = dlm_remaster_locks(dlm, dlm->reco.dead_node); | 531 | status = dlm_remaster_locks(dlm, dlm->reco.dead_node); |
| 526 | if (status < 0) { | 532 | if (status < 0) { |
| 527 | /* we should never hit this anymore */ | 533 | /* we should never hit this anymore */ |
| 528 | mlog(ML_ERROR, "error %d remastering locks for node %u, " | 534 | mlog(ML_ERROR, "%s: Error %d remastering locks for node %u, " |
| 529 | "retrying.\n", status, dlm->reco.dead_node); | 535 | "retrying.\n", dlm->name, status, dlm->reco.dead_node); |
| 530 | /* yield a bit to allow any final network messages | 536 | /* yield a bit to allow any final network messages |
| 531 | * to get handled on remaining nodes */ | 537 | * to get handled on remaining nodes */ |
| 532 | msleep(100); | 538 | msleep(100); |
| @@ -567,7 +573,7 @@ static int dlm_remaster_locks(struct dlm_ctxt *dlm, u8 dead_node) | |||
| 567 | BUG_ON(ndata->state != DLM_RECO_NODE_DATA_INIT); | 573 | BUG_ON(ndata->state != DLM_RECO_NODE_DATA_INIT); |
| 568 | ndata->state = DLM_RECO_NODE_DATA_REQUESTING; | 574 | ndata->state = DLM_RECO_NODE_DATA_REQUESTING; |
| 569 | 575 | ||
| 570 | mlog(0, "requesting lock info from node %u\n", | 576 | mlog(0, "%s: Requesting lock info from node %u\n", dlm->name, |
| 571 | ndata->node_num); | 577 | ndata->node_num); |
| 572 | 578 | ||
| 573 | if (ndata->node_num == dlm->node_num) { | 579 | if (ndata->node_num == dlm->node_num) { |
| @@ -640,7 +646,7 @@ static int dlm_remaster_locks(struct dlm_ctxt *dlm, u8 dead_node) | |||
| 640 | spin_unlock(&dlm_reco_state_lock); | 646 | spin_unlock(&dlm_reco_state_lock); |
| 641 | } | 647 | } |
| 642 | 648 | ||
| 643 | mlog(0, "done requesting all lock info\n"); | 649 | mlog(0, "%s: Done requesting all lock info\n", dlm->name); |
| 644 | 650 | ||
| 645 | /* nodes should be sending reco data now | 651 | /* nodes should be sending reco data now |
| 646 | * just need to wait */ | 652 | * just need to wait */ |
| @@ -802,10 +808,9 @@ static int dlm_request_all_locks(struct dlm_ctxt *dlm, u8 request_from, | |||
| 802 | 808 | ||
| 803 | /* negative status is handled by caller */ | 809 | /* negative status is handled by caller */ |
| 804 | if (ret < 0) | 810 | if (ret < 0) |
| 805 | mlog(ML_ERROR, "Error %d when sending message %u (key " | 811 | mlog(ML_ERROR, "%s: Error %d send LOCK_REQUEST to node %u " |
| 806 | "0x%x) to node %u\n", ret, DLM_LOCK_REQUEST_MSG, | 812 | "to recover dead node %u\n", dlm->name, ret, |
| 807 | dlm->key, request_from); | 813 | request_from, dead_node); |
| 808 | |||
| 809 | // return from here, then | 814 | // return from here, then |
| 810 | // sleep until all received or error | 815 | // sleep until all received or error |
| 811 | return ret; | 816 | return ret; |
| @@ -956,9 +961,9 @@ static int dlm_send_all_done_msg(struct dlm_ctxt *dlm, u8 dead_node, u8 send_to) | |||
| 956 | ret = o2net_send_message(DLM_RECO_DATA_DONE_MSG, dlm->key, &done_msg, | 961 | ret = o2net_send_message(DLM_RECO_DATA_DONE_MSG, dlm->key, &done_msg, |
| 957 | sizeof(done_msg), send_to, &tmpret); | 962 | sizeof(done_msg), send_to, &tmpret); |
| 958 | if (ret < 0) { | 963 | if (ret < 0) { |
| 959 | mlog(ML_ERROR, "Error %d when sending message %u (key " | 964 | mlog(ML_ERROR, "%s: Error %d send RECO_DATA_DONE to node %u " |
| 960 | "0x%x) to node %u\n", ret, DLM_RECO_DATA_DONE_MSG, | 965 | "to recover dead node %u\n", dlm->name, ret, send_to, |
| 961 | dlm->key, send_to); | 966 | dead_node); |
| 962 | if (!dlm_is_host_down(ret)) { | 967 | if (!dlm_is_host_down(ret)) { |
| 963 | BUG(); | 968 | BUG(); |
| 964 | } | 969 | } |
| @@ -1127,9 +1132,11 @@ static int dlm_send_mig_lockres_msg(struct dlm_ctxt *dlm, | |||
| 1127 | if (ret < 0) { | 1132 | if (ret < 0) { |
| 1128 | /* XXX: negative status is not handled. | 1133 | /* XXX: negative status is not handled. |
| 1129 | * this will end up killing this node. */ | 1134 | * this will end up killing this node. */ |
| 1130 | mlog(ML_ERROR, "Error %d when sending message %u (key " | 1135 | mlog(ML_ERROR, "%s: res %.*s, Error %d send MIG_LOCKRES to " |
| 1131 | "0x%x) to node %u\n", ret, DLM_MIG_LOCKRES_MSG, | 1136 | "node %u (%s)\n", dlm->name, mres->lockname_len, |
| 1132 | dlm->key, send_to); | 1137 | mres->lockname, ret, send_to, |
| 1138 | (orig_flags & DLM_MRES_MIGRATION ? | ||
| 1139 | "migration" : "recovery")); | ||
| 1133 | } else { | 1140 | } else { |
| 1134 | /* might get an -ENOMEM back here */ | 1141 | /* might get an -ENOMEM back here */ |
| 1135 | ret = status; | 1142 | ret = status; |
| @@ -1767,7 +1774,7 @@ static int dlm_process_recovery_data(struct dlm_ctxt *dlm, | |||
| 1767 | dlm->name, mres->lockname_len, mres->lockname, | 1774 | dlm->name, mres->lockname_len, mres->lockname, |
| 1768 | from); | 1775 | from); |
| 1769 | spin_lock(&res->spinlock); | 1776 | spin_lock(&res->spinlock); |
| 1770 | dlm_lockres_set_refmap_bit(from, res); | 1777 | dlm_lockres_set_refmap_bit(dlm, res, from); |
| 1771 | spin_unlock(&res->spinlock); | 1778 | spin_unlock(&res->spinlock); |
| 1772 | added++; | 1779 | added++; |
| 1773 | break; | 1780 | break; |
| @@ -1965,7 +1972,7 @@ skip_lvb: | |||
| 1965 | mlog(0, "%s:%.*s: added lock for node %u, " | 1972 | mlog(0, "%s:%.*s: added lock for node %u, " |
| 1966 | "setting refmap bit\n", dlm->name, | 1973 | "setting refmap bit\n", dlm->name, |
| 1967 | res->lockname.len, res->lockname.name, ml->node); | 1974 | res->lockname.len, res->lockname.name, ml->node); |
| 1968 | dlm_lockres_set_refmap_bit(ml->node, res); | 1975 | dlm_lockres_set_refmap_bit(dlm, res, ml->node); |
| 1969 | added++; | 1976 | added++; |
| 1970 | } | 1977 | } |
| 1971 | spin_unlock(&res->spinlock); | 1978 | spin_unlock(&res->spinlock); |
| @@ -2084,6 +2091,9 @@ static void dlm_finish_local_lockres_recovery(struct dlm_ctxt *dlm, | |||
| 2084 | 2091 | ||
| 2085 | list_for_each_entry_safe(res, next, &dlm->reco.resources, recovering) { | 2092 | list_for_each_entry_safe(res, next, &dlm->reco.resources, recovering) { |
| 2086 | if (res->owner == dead_node) { | 2093 | if (res->owner == dead_node) { |
| 2094 | mlog(0, "%s: res %.*s, Changing owner from %u to %u\n", | ||
| 2095 | dlm->name, res->lockname.len, res->lockname.name, | ||
| 2096 | res->owner, new_master); | ||
| 2087 | list_del_init(&res->recovering); | 2097 | list_del_init(&res->recovering); |
| 2088 | spin_lock(&res->spinlock); | 2098 | spin_lock(&res->spinlock); |
| 2089 | /* new_master has our reference from | 2099 | /* new_master has our reference from |
| @@ -2105,40 +2115,30 @@ static void dlm_finish_local_lockres_recovery(struct dlm_ctxt *dlm, | |||
| 2105 | for (i = 0; i < DLM_HASH_BUCKETS; i++) { | 2115 | for (i = 0; i < DLM_HASH_BUCKETS; i++) { |
| 2106 | bucket = dlm_lockres_hash(dlm, i); | 2116 | bucket = dlm_lockres_hash(dlm, i); |
| 2107 | hlist_for_each_entry(res, hash_iter, bucket, hash_node) { | 2117 | hlist_for_each_entry(res, hash_iter, bucket, hash_node) { |
| 2108 | if (res->state & DLM_LOCK_RES_RECOVERING) { | 2118 | if (!(res->state & DLM_LOCK_RES_RECOVERING)) |
| 2109 | if (res->owner == dead_node) { | 2119 | continue; |
| 2110 | mlog(0, "(this=%u) res %.*s owner=%u " | ||
| 2111 | "was not on recovering list, but " | ||
| 2112 | "clearing state anyway\n", | ||
| 2113 | dlm->node_num, res->lockname.len, | ||
| 2114 | res->lockname.name, new_master); | ||
| 2115 | } else if (res->owner == dlm->node_num) { | ||
| 2116 | mlog(0, "(this=%u) res %.*s owner=%u " | ||
| 2117 | "was not on recovering list, " | ||
| 2118 | "owner is THIS node, clearing\n", | ||
| 2119 | dlm->node_num, res->lockname.len, | ||
| 2120 | res->lockname.name, new_master); | ||
| 2121 | } else | ||
| 2122 | continue; | ||
| 2123 | 2120 | ||
| 2124 | if (!list_empty(&res->recovering)) { | 2121 | if (res->owner != dead_node && |
| 2125 | mlog(0, "%s:%.*s: lockres was " | 2122 | res->owner != dlm->node_num) |
| 2126 | "marked RECOVERING, owner=%u\n", | 2123 | continue; |
| 2127 | dlm->name, res->lockname.len, | 2124 | |
| 2128 | res->lockname.name, res->owner); | 2125 | if (!list_empty(&res->recovering)) { |
| 2129 | list_del_init(&res->recovering); | 2126 | list_del_init(&res->recovering); |
| 2130 | dlm_lockres_put(res); | 2127 | dlm_lockres_put(res); |
| 2131 | } | ||
| 2132 | spin_lock(&res->spinlock); | ||
| 2133 | /* new_master has our reference from | ||
| 2134 | * the lock state sent during recovery */ | ||
| 2135 | dlm_change_lockres_owner(dlm, res, new_master); | ||
| 2136 | res->state &= ~DLM_LOCK_RES_RECOVERING; | ||
| 2137 | if (__dlm_lockres_has_locks(res)) | ||
| 2138 | __dlm_dirty_lockres(dlm, res); | ||
| 2139 | spin_unlock(&res->spinlock); | ||
| 2140 | wake_up(&res->wq); | ||
| 2141 | } | 2128 | } |
| 2129 | |||
| 2130 | /* new_master has our reference from | ||
| 2131 | * the lock state sent during recovery */ | ||
| 2132 | mlog(0, "%s: res %.*s, Changing owner from %u to %u\n", | ||
| 2133 | dlm->name, res->lockname.len, res->lockname.name, | ||
| 2134 | res->owner, new_master); | ||
| 2135 | spin_lock(&res->spinlock); | ||
| 2136 | dlm_change_lockres_owner(dlm, res, new_master); | ||
| 2137 | res->state &= ~DLM_LOCK_RES_RECOVERING; | ||
| 2138 | if (__dlm_lockres_has_locks(res)) | ||
| 2139 | __dlm_dirty_lockres(dlm, res); | ||
| 2140 | spin_unlock(&res->spinlock); | ||
| 2141 | wake_up(&res->wq); | ||
| 2142 | } | 2142 | } |
| 2143 | } | 2143 | } |
| 2144 | } | 2144 | } |
| @@ -2252,12 +2252,12 @@ static void dlm_free_dead_locks(struct dlm_ctxt *dlm, | |||
| 2252 | res->lockname.len, res->lockname.name, freed, dead_node); | 2252 | res->lockname.len, res->lockname.name, freed, dead_node); |
| 2253 | __dlm_print_one_lock_resource(res); | 2253 | __dlm_print_one_lock_resource(res); |
| 2254 | } | 2254 | } |
| 2255 | dlm_lockres_clear_refmap_bit(dead_node, res); | 2255 | dlm_lockres_clear_refmap_bit(dlm, res, dead_node); |
| 2256 | } else if (test_bit(dead_node, res->refmap)) { | 2256 | } else if (test_bit(dead_node, res->refmap)) { |
| 2257 | mlog(0, "%s:%.*s: dead node %u had a ref, but had " | 2257 | mlog(0, "%s:%.*s: dead node %u had a ref, but had " |
| 2258 | "no locks and had not purged before dying\n", dlm->name, | 2258 | "no locks and had not purged before dying\n", dlm->name, |
| 2259 | res->lockname.len, res->lockname.name, dead_node); | 2259 | res->lockname.len, res->lockname.name, dead_node); |
| 2260 | dlm_lockres_clear_refmap_bit(dead_node, res); | 2260 | dlm_lockres_clear_refmap_bit(dlm, res, dead_node); |
| 2261 | } | 2261 | } |
| 2262 | 2262 | ||
| 2263 | /* do not kick thread yet */ | 2263 | /* do not kick thread yet */ |
| @@ -2324,9 +2324,9 @@ static void dlm_do_local_recovery_cleanup(struct dlm_ctxt *dlm, u8 dead_node) | |||
| 2324 | dlm_revalidate_lvb(dlm, res, dead_node); | 2324 | dlm_revalidate_lvb(dlm, res, dead_node); |
| 2325 | if (res->owner == dead_node) { | 2325 | if (res->owner == dead_node) { |
| 2326 | if (res->state & DLM_LOCK_RES_DROPPING_REF) { | 2326 | if (res->state & DLM_LOCK_RES_DROPPING_REF) { |
| 2327 | mlog(ML_NOTICE, "Ignore %.*s for " | 2327 | mlog(ML_NOTICE, "%s: res %.*s, Skip " |
| 2328 | "recovery as it is being freed\n", | 2328 | "recovery as it is being freed\n", |
| 2329 | res->lockname.len, | 2329 | dlm->name, res->lockname.len, |
| 2330 | res->lockname.name); | 2330 | res->lockname.name); |
| 2331 | } else | 2331 | } else |
| 2332 | dlm_move_lockres_to_recovery_list(dlm, | 2332 | dlm_move_lockres_to_recovery_list(dlm, |
diff --git a/fs/ocfs2/dlm/dlmthread.c b/fs/ocfs2/dlm/dlmthread.c index 1d6d1d22c471..e73c833fc2a1 100644 --- a/fs/ocfs2/dlm/dlmthread.c +++ b/fs/ocfs2/dlm/dlmthread.c | |||
| @@ -94,24 +94,26 @@ int __dlm_lockres_unused(struct dlm_lock_resource *res) | |||
| 94 | { | 94 | { |
| 95 | int bit; | 95 | int bit; |
| 96 | 96 | ||
| 97 | assert_spin_locked(&res->spinlock); | ||
| 98 | |||
| 97 | if (__dlm_lockres_has_locks(res)) | 99 | if (__dlm_lockres_has_locks(res)) |
| 98 | return 0; | 100 | return 0; |
| 99 | 101 | ||
| 102 | /* Locks are in the process of being created */ | ||
| 103 | if (res->inflight_locks) | ||
| 104 | return 0; | ||
| 105 | |||
| 100 | if (!list_empty(&res->dirty) || res->state & DLM_LOCK_RES_DIRTY) | 106 | if (!list_empty(&res->dirty) || res->state & DLM_LOCK_RES_DIRTY) |
| 101 | return 0; | 107 | return 0; |
| 102 | 108 | ||
| 103 | if (res->state & DLM_LOCK_RES_RECOVERING) | 109 | if (res->state & DLM_LOCK_RES_RECOVERING) |
| 104 | return 0; | 110 | return 0; |
| 105 | 111 | ||
| 112 | /* Another node has this resource with this node as the master */ | ||
| 106 | bit = find_next_bit(res->refmap, O2NM_MAX_NODES, 0); | 113 | bit = find_next_bit(res->refmap, O2NM_MAX_NODES, 0); |
| 107 | if (bit < O2NM_MAX_NODES) | 114 | if (bit < O2NM_MAX_NODES) |
| 108 | return 0; | 115 | return 0; |
| 109 | 116 | ||
| 110 | /* | ||
| 111 | * since the bit for dlm->node_num is not set, inflight_locks better | ||
| 112 | * be zero | ||
| 113 | */ | ||
| 114 | BUG_ON(res->inflight_locks != 0); | ||
| 115 | return 1; | 117 | return 1; |
| 116 | } | 118 | } |
| 117 | 119 | ||
| @@ -185,8 +187,6 @@ static void dlm_purge_lockres(struct dlm_ctxt *dlm, | |||
| 185 | /* clear our bit from the master's refmap, ignore errors */ | 187 | /* clear our bit from the master's refmap, ignore errors */ |
| 186 | ret = dlm_drop_lockres_ref(dlm, res); | 188 | ret = dlm_drop_lockres_ref(dlm, res); |
| 187 | if (ret < 0) { | 189 | if (ret < 0) { |
| 188 | mlog(ML_ERROR, "%s: deref %.*s failed %d\n", dlm->name, | ||
| 189 | res->lockname.len, res->lockname.name, ret); | ||
| 190 | if (!dlm_is_host_down(ret)) | 190 | if (!dlm_is_host_down(ret)) |
| 191 | BUG(); | 191 | BUG(); |
| 192 | } | 192 | } |
| @@ -209,7 +209,7 @@ static void dlm_purge_lockres(struct dlm_ctxt *dlm, | |||
| 209 | BUG(); | 209 | BUG(); |
| 210 | } | 210 | } |
| 211 | 211 | ||
| 212 | __dlm_unhash_lockres(res); | 212 | __dlm_unhash_lockres(dlm, res); |
| 213 | 213 | ||
| 214 | /* lockres is not in the hash now. drop the flag and wake up | 214 | /* lockres is not in the hash now. drop the flag and wake up |
| 215 | * any processes waiting in dlm_get_lock_resource. */ | 215 | * any processes waiting in dlm_get_lock_resource. */ |
diff --git a/fs/ocfs2/dlmglue.c b/fs/ocfs2/dlmglue.c index e1ed5e502ff2..81a4cd22f80b 100644 --- a/fs/ocfs2/dlmglue.c +++ b/fs/ocfs2/dlmglue.c | |||
| @@ -1692,7 +1692,7 @@ int ocfs2_open_lock(struct inode *inode) | |||
| 1692 | mlog(0, "inode %llu take PRMODE open lock\n", | 1692 | mlog(0, "inode %llu take PRMODE open lock\n", |
| 1693 | (unsigned long long)OCFS2_I(inode)->ip_blkno); | 1693 | (unsigned long long)OCFS2_I(inode)->ip_blkno); |
| 1694 | 1694 | ||
| 1695 | if (ocfs2_mount_local(osb)) | 1695 | if (ocfs2_is_hard_readonly(osb) || ocfs2_mount_local(osb)) |
| 1696 | goto out; | 1696 | goto out; |
| 1697 | 1697 | ||
| 1698 | lockres = &OCFS2_I(inode)->ip_open_lockres; | 1698 | lockres = &OCFS2_I(inode)->ip_open_lockres; |
| @@ -1718,6 +1718,12 @@ int ocfs2_try_open_lock(struct inode *inode, int write) | |||
| 1718 | (unsigned long long)OCFS2_I(inode)->ip_blkno, | 1718 | (unsigned long long)OCFS2_I(inode)->ip_blkno, |
| 1719 | write ? "EXMODE" : "PRMODE"); | 1719 | write ? "EXMODE" : "PRMODE"); |
| 1720 | 1720 | ||
| 1721 | if (ocfs2_is_hard_readonly(osb)) { | ||
| 1722 | if (write) | ||
| 1723 | status = -EROFS; | ||
| 1724 | goto out; | ||
| 1725 | } | ||
| 1726 | |||
| 1721 | if (ocfs2_mount_local(osb)) | 1727 | if (ocfs2_mount_local(osb)) |
| 1722 | goto out; | 1728 | goto out; |
| 1723 | 1729 | ||
| @@ -2298,7 +2304,7 @@ int ocfs2_inode_lock_full_nested(struct inode *inode, | |||
| 2298 | if (ocfs2_is_hard_readonly(osb)) { | 2304 | if (ocfs2_is_hard_readonly(osb)) { |
| 2299 | if (ex) | 2305 | if (ex) |
| 2300 | status = -EROFS; | 2306 | status = -EROFS; |
| 2301 | goto bail; | 2307 | goto getbh; |
| 2302 | } | 2308 | } |
| 2303 | 2309 | ||
| 2304 | if (ocfs2_mount_local(osb)) | 2310 | if (ocfs2_mount_local(osb)) |
| @@ -2356,7 +2362,7 @@ local: | |||
| 2356 | mlog_errno(status); | 2362 | mlog_errno(status); |
| 2357 | goto bail; | 2363 | goto bail; |
| 2358 | } | 2364 | } |
| 2359 | 2365 | getbh: | |
| 2360 | if (ret_bh) { | 2366 | if (ret_bh) { |
| 2361 | status = ocfs2_assign_bh(inode, ret_bh, local_bh); | 2367 | status = ocfs2_assign_bh(inode, ret_bh, local_bh); |
| 2362 | if (status < 0) { | 2368 | if (status < 0) { |
| @@ -2628,8 +2634,11 @@ int ocfs2_dentry_lock(struct dentry *dentry, int ex) | |||
| 2628 | 2634 | ||
| 2629 | BUG_ON(!dl); | 2635 | BUG_ON(!dl); |
| 2630 | 2636 | ||
| 2631 | if (ocfs2_is_hard_readonly(osb)) | 2637 | if (ocfs2_is_hard_readonly(osb)) { |
| 2632 | return -EROFS; | 2638 | if (ex) |
| 2639 | return -EROFS; | ||
| 2640 | return 0; | ||
| 2641 | } | ||
| 2633 | 2642 | ||
| 2634 | if (ocfs2_mount_local(osb)) | 2643 | if (ocfs2_mount_local(osb)) |
| 2635 | return 0; | 2644 | return 0; |
| @@ -2647,7 +2656,7 @@ void ocfs2_dentry_unlock(struct dentry *dentry, int ex) | |||
| 2647 | struct ocfs2_dentry_lock *dl = dentry->d_fsdata; | 2656 | struct ocfs2_dentry_lock *dl = dentry->d_fsdata; |
| 2648 | struct ocfs2_super *osb = OCFS2_SB(dentry->d_sb); | 2657 | struct ocfs2_super *osb = OCFS2_SB(dentry->d_sb); |
| 2649 | 2658 | ||
| 2650 | if (!ocfs2_mount_local(osb)) | 2659 | if (!ocfs2_is_hard_readonly(osb) && !ocfs2_mount_local(osb)) |
| 2651 | ocfs2_cluster_unlock(osb, &dl->dl_lockres, level); | 2660 | ocfs2_cluster_unlock(osb, &dl->dl_lockres, level); |
| 2652 | } | 2661 | } |
| 2653 | 2662 | ||
diff --git a/fs/ocfs2/extent_map.c b/fs/ocfs2/extent_map.c index 23457b491e8c..2f5b92ef0e53 100644 --- a/fs/ocfs2/extent_map.c +++ b/fs/ocfs2/extent_map.c | |||
| @@ -832,6 +832,102 @@ out: | |||
| 832 | return ret; | 832 | return ret; |
| 833 | } | 833 | } |
| 834 | 834 | ||
| 835 | int ocfs2_seek_data_hole_offset(struct file *file, loff_t *offset, int origin) | ||
| 836 | { | ||
| 837 | struct inode *inode = file->f_mapping->host; | ||
| 838 | int ret; | ||
| 839 | unsigned int is_last = 0, is_data = 0; | ||
| 840 | u16 cs_bits = OCFS2_SB(inode->i_sb)->s_clustersize_bits; | ||
| 841 | u32 cpos, cend, clen, hole_size; | ||
| 842 | u64 extoff, extlen; | ||
| 843 | struct buffer_head *di_bh = NULL; | ||
| 844 | struct ocfs2_extent_rec rec; | ||
| 845 | |||
| 846 | BUG_ON(origin != SEEK_DATA && origin != SEEK_HOLE); | ||
| 847 | |||
| 848 | ret = ocfs2_inode_lock(inode, &di_bh, 0); | ||
| 849 | if (ret) { | ||
| 850 | mlog_errno(ret); | ||
| 851 | goto out; | ||
| 852 | } | ||
| 853 | |||
| 854 | down_read(&OCFS2_I(inode)->ip_alloc_sem); | ||
| 855 | |||
| 856 | if (*offset >= inode->i_size) { | ||
| 857 | ret = -ENXIO; | ||
| 858 | goto out_unlock; | ||
| 859 | } | ||
| 860 | |||
| 861 | if (OCFS2_I(inode)->ip_dyn_features & OCFS2_INLINE_DATA_FL) { | ||
| 862 | if (origin == SEEK_HOLE) | ||
| 863 | *offset = inode->i_size; | ||
| 864 | goto out_unlock; | ||
| 865 | } | ||
| 866 | |||
| 867 | clen = 0; | ||
| 868 | cpos = *offset >> cs_bits; | ||
| 869 | cend = ocfs2_clusters_for_bytes(inode->i_sb, inode->i_size); | ||
| 870 | |||
| 871 | while (cpos < cend && !is_last) { | ||
| 872 | ret = ocfs2_get_clusters_nocache(inode, di_bh, cpos, &hole_size, | ||
| 873 | &rec, &is_last); | ||
| 874 | if (ret) { | ||
| 875 | mlog_errno(ret); | ||
| 876 | goto out_unlock; | ||
| 877 | } | ||
| 878 | |||
| 879 | extoff = cpos; | ||
| 880 | extoff <<= cs_bits; | ||
| 881 | |||
| 882 | if (rec.e_blkno == 0ULL) { | ||
| 883 | clen = hole_size; | ||
| 884 | is_data = 0; | ||
| 885 | } else { | ||
| 886 | clen = le16_to_cpu(rec.e_leaf_clusters) - | ||
| 887 | (cpos - le32_to_cpu(rec.e_cpos)); | ||
| 888 | is_data = (rec.e_flags & OCFS2_EXT_UNWRITTEN) ? 0 : 1; | ||
| 889 | } | ||
| 890 | |||
| 891 | if ((!is_data && origin == SEEK_HOLE) || | ||
| 892 | (is_data && origin == SEEK_DATA)) { | ||
| 893 | if (extoff > *offset) | ||
| 894 | *offset = extoff; | ||
| 895 | goto out_unlock; | ||
| 896 | } | ||
| 897 | |||
| 898 | if (!is_last) | ||
| 899 | cpos += clen; | ||
| 900 | } | ||
| 901 | |||
| 902 | if (origin == SEEK_HOLE) { | ||
| 903 | extoff = cpos; | ||
| 904 | extoff <<= cs_bits; | ||
| 905 | extlen = clen; | ||
| 906 | extlen <<= cs_bits; | ||
| 907 | |||
| 908 | if ((extoff + extlen) > inode->i_size) | ||
| 909 | extlen = inode->i_size - extoff; | ||
| 910 | extoff += extlen; | ||
| 911 | if (extoff > *offset) | ||
| 912 | *offset = extoff; | ||
| 913 | goto out_unlock; | ||
| 914 | } | ||
| 915 | |||
| 916 | ret = -ENXIO; | ||
| 917 | |||
| 918 | out_unlock: | ||
| 919 | |||
| 920 | brelse(di_bh); | ||
| 921 | |||
| 922 | up_read(&OCFS2_I(inode)->ip_alloc_sem); | ||
| 923 | |||
| 924 | ocfs2_inode_unlock(inode, 0); | ||
| 925 | out: | ||
| 926 | if (ret && ret != -ENXIO) | ||
| 927 | ret = -ENXIO; | ||
| 928 | return ret; | ||
| 929 | } | ||
| 930 | |||
| 835 | int ocfs2_read_virt_blocks(struct inode *inode, u64 v_block, int nr, | 931 | int ocfs2_read_virt_blocks(struct inode *inode, u64 v_block, int nr, |
| 836 | struct buffer_head *bhs[], int flags, | 932 | struct buffer_head *bhs[], int flags, |
| 837 | int (*validate)(struct super_block *sb, | 933 | int (*validate)(struct super_block *sb, |
diff --git a/fs/ocfs2/extent_map.h b/fs/ocfs2/extent_map.h index e79d41c2c909..67ea57d2fd59 100644 --- a/fs/ocfs2/extent_map.h +++ b/fs/ocfs2/extent_map.h | |||
| @@ -53,6 +53,8 @@ int ocfs2_extent_map_get_blocks(struct inode *inode, u64 v_blkno, u64 *p_blkno, | |||
| 53 | int ocfs2_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, | 53 | int ocfs2_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, |
| 54 | u64 map_start, u64 map_len); | 54 | u64 map_start, u64 map_len); |
| 55 | 55 | ||
| 56 | int ocfs2_seek_data_hole_offset(struct file *file, loff_t *offset, int origin); | ||
| 57 | |||
| 56 | int ocfs2_xattr_get_clusters(struct inode *inode, u32 v_cluster, | 58 | int ocfs2_xattr_get_clusters(struct inode *inode, u32 v_cluster, |
| 57 | u32 *p_cluster, u32 *num_clusters, | 59 | u32 *p_cluster, u32 *num_clusters, |
| 58 | struct ocfs2_extent_list *el, | 60 | struct ocfs2_extent_list *el, |
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c index de4ea1af041b..6e396683c3d4 100644 --- a/fs/ocfs2/file.c +++ b/fs/ocfs2/file.c | |||
| @@ -1950,6 +1950,9 @@ static int __ocfs2_change_file_space(struct file *file, struct inode *inode, | |||
| 1950 | if (ret < 0) | 1950 | if (ret < 0) |
| 1951 | mlog_errno(ret); | 1951 | mlog_errno(ret); |
| 1952 | 1952 | ||
| 1953 | if (file->f_flags & O_SYNC) | ||
| 1954 | handle->h_sync = 1; | ||
| 1955 | |||
| 1953 | ocfs2_commit_trans(osb, handle); | 1956 | ocfs2_commit_trans(osb, handle); |
| 1954 | 1957 | ||
| 1955 | out_inode_unlock: | 1958 | out_inode_unlock: |
| @@ -2052,6 +2055,23 @@ out: | |||
| 2052 | return ret; | 2055 | return ret; |
| 2053 | } | 2056 | } |
| 2054 | 2057 | ||
| 2058 | static void ocfs2_aiodio_wait(struct inode *inode) | ||
| 2059 | { | ||
| 2060 | wait_queue_head_t *wq = ocfs2_ioend_wq(inode); | ||
| 2061 | |||
| 2062 | wait_event(*wq, (atomic_read(&OCFS2_I(inode)->ip_unaligned_aio) == 0)); | ||
| 2063 | } | ||
| 2064 | |||
| 2065 | static int ocfs2_is_io_unaligned(struct inode *inode, size_t count, loff_t pos) | ||
| 2066 | { | ||
| 2067 | int blockmask = inode->i_sb->s_blocksize - 1; | ||
| 2068 | loff_t final_size = pos + count; | ||
| 2069 | |||
| 2070 | if ((pos & blockmask) || (final_size & blockmask)) | ||
| 2071 | return 1; | ||
| 2072 | return 0; | ||
| 2073 | } | ||
| 2074 | |||
| 2055 | static int ocfs2_prepare_inode_for_refcount(struct inode *inode, | 2075 | static int ocfs2_prepare_inode_for_refcount(struct inode *inode, |
| 2056 | struct file *file, | 2076 | struct file *file, |
| 2057 | loff_t pos, size_t count, | 2077 | loff_t pos, size_t count, |
| @@ -2230,6 +2250,7 @@ static ssize_t ocfs2_file_aio_write(struct kiocb *iocb, | |||
| 2230 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); | 2250 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); |
| 2231 | int full_coherency = !(osb->s_mount_opt & | 2251 | int full_coherency = !(osb->s_mount_opt & |
| 2232 | OCFS2_MOUNT_COHERENCY_BUFFERED); | 2252 | OCFS2_MOUNT_COHERENCY_BUFFERED); |
| 2253 | int unaligned_dio = 0; | ||
| 2233 | 2254 | ||
| 2234 | trace_ocfs2_file_aio_write(inode, file, file->f_path.dentry, | 2255 | trace_ocfs2_file_aio_write(inode, file, file->f_path.dentry, |
| 2235 | (unsigned long long)OCFS2_I(inode)->ip_blkno, | 2256 | (unsigned long long)OCFS2_I(inode)->ip_blkno, |
| @@ -2297,6 +2318,10 @@ relock: | |||
| 2297 | goto out; | 2318 | goto out; |
| 2298 | } | 2319 | } |
| 2299 | 2320 | ||
| 2321 | if (direct_io && !is_sync_kiocb(iocb)) | ||
| 2322 | unaligned_dio = ocfs2_is_io_unaligned(inode, iocb->ki_left, | ||
| 2323 | *ppos); | ||
| 2324 | |||
| 2300 | /* | 2325 | /* |
| 2301 | * We can't complete the direct I/O as requested, fall back to | 2326 | * We can't complete the direct I/O as requested, fall back to |
| 2302 | * buffered I/O. | 2327 | * buffered I/O. |
| @@ -2311,6 +2336,18 @@ relock: | |||
| 2311 | goto relock; | 2336 | goto relock; |
| 2312 | } | 2337 | } |
| 2313 | 2338 | ||
| 2339 | if (unaligned_dio) { | ||
| 2340 | /* | ||
| 2341 | * Wait on previous unaligned aio to complete before | ||
| 2342 | * proceeding. | ||
| 2343 | */ | ||
| 2344 | ocfs2_aiodio_wait(inode); | ||
| 2345 | |||
| 2346 | /* Mark the iocb as needing a decrement in ocfs2_dio_end_io */ | ||
| 2347 | atomic_inc(&OCFS2_I(inode)->ip_unaligned_aio); | ||
| 2348 | ocfs2_iocb_set_unaligned_aio(iocb); | ||
| 2349 | } | ||
| 2350 | |||
| 2314 | /* | 2351 | /* |
| 2315 | * To later detect whether a journal commit for sync writes is | 2352 | * To later detect whether a journal commit for sync writes is |
| 2316 | * necessary, we sample i_size, and cluster count here. | 2353 | * necessary, we sample i_size, and cluster count here. |
| @@ -2382,8 +2419,12 @@ out_dio: | |||
| 2382 | if ((ret == -EIOCBQUEUED) || (!ocfs2_iocb_is_rw_locked(iocb))) { | 2419 | if ((ret == -EIOCBQUEUED) || (!ocfs2_iocb_is_rw_locked(iocb))) { |
| 2383 | rw_level = -1; | 2420 | rw_level = -1; |
| 2384 | have_alloc_sem = 0; | 2421 | have_alloc_sem = 0; |
| 2422 | unaligned_dio = 0; | ||
| 2385 | } | 2423 | } |
| 2386 | 2424 | ||
| 2425 | if (unaligned_dio) | ||
| 2426 | atomic_dec(&OCFS2_I(inode)->ip_unaligned_aio); | ||
| 2427 | |||
| 2387 | out: | 2428 | out: |
| 2388 | if (rw_level != -1) | 2429 | if (rw_level != -1) |
| 2389 | ocfs2_rw_unlock(inode, rw_level); | 2430 | ocfs2_rw_unlock(inode, rw_level); |
| @@ -2591,6 +2632,57 @@ bail: | |||
| 2591 | return ret; | 2632 | return ret; |
| 2592 | } | 2633 | } |
| 2593 | 2634 | ||
| 2635 | /* Refer generic_file_llseek_unlocked() */ | ||
| 2636 | static loff_t ocfs2_file_llseek(struct file *file, loff_t offset, int origin) | ||
| 2637 | { | ||
| 2638 | struct inode *inode = file->f_mapping->host; | ||
| 2639 | int ret = 0; | ||
| 2640 | |||
| 2641 | mutex_lock(&inode->i_mutex); | ||
| 2642 | |||
| 2643 | switch (origin) { | ||
| 2644 | case SEEK_SET: | ||
| 2645 | break; | ||
| 2646 | case SEEK_END: | ||
| 2647 | offset += inode->i_size; | ||
| 2648 | break; | ||
| 2649 | case SEEK_CUR: | ||
| 2650 | if (offset == 0) { | ||
| 2651 | offset = file->f_pos; | ||
| 2652 | goto out; | ||
| 2653 | } | ||
| 2654 | offset += file->f_pos; | ||
| 2655 | break; | ||
| 2656 | case SEEK_DATA: | ||
| 2657 | case SEEK_HOLE: | ||
| 2658 | ret = ocfs2_seek_data_hole_offset(file, &offset, origin); | ||
| 2659 | if (ret) | ||
| 2660 | goto out; | ||
| 2661 | break; | ||
| 2662 | default: | ||
| 2663 | ret = -EINVAL; | ||
| 2664 | goto out; | ||
| 2665 | } | ||
| 2666 | |||
| 2667 | if (offset < 0 && !(file->f_mode & FMODE_UNSIGNED_OFFSET)) | ||
| 2668 | ret = -EINVAL; | ||
| 2669 | if (!ret && offset > inode->i_sb->s_maxbytes) | ||
| 2670 | ret = -EINVAL; | ||
| 2671 | if (ret) | ||
| 2672 | goto out; | ||
| 2673 | |||
| 2674 | if (offset != file->f_pos) { | ||
| 2675 | file->f_pos = offset; | ||
| 2676 | file->f_version = 0; | ||
| 2677 | } | ||
| 2678 | |||
| 2679 | out: | ||
| 2680 | mutex_unlock(&inode->i_mutex); | ||
| 2681 | if (ret) | ||
| 2682 | return ret; | ||
| 2683 | return offset; | ||
| 2684 | } | ||
| 2685 | |||
| 2594 | const struct inode_operations ocfs2_file_iops = { | 2686 | const struct inode_operations ocfs2_file_iops = { |
| 2595 | .setattr = ocfs2_setattr, | 2687 | .setattr = ocfs2_setattr, |
| 2596 | .getattr = ocfs2_getattr, | 2688 | .getattr = ocfs2_getattr, |
| @@ -2615,7 +2707,7 @@ const struct inode_operations ocfs2_special_file_iops = { | |||
| 2615 | * ocfs2_fops_no_plocks and ocfs2_dops_no_plocks! | 2707 | * ocfs2_fops_no_plocks and ocfs2_dops_no_plocks! |
| 2616 | */ | 2708 | */ |
| 2617 | const struct file_operations ocfs2_fops = { | 2709 | const struct file_operations ocfs2_fops = { |
| 2618 | .llseek = generic_file_llseek, | 2710 | .llseek = ocfs2_file_llseek, |
| 2619 | .read = do_sync_read, | 2711 | .read = do_sync_read, |
| 2620 | .write = do_sync_write, | 2712 | .write = do_sync_write, |
| 2621 | .mmap = ocfs2_mmap, | 2713 | .mmap = ocfs2_mmap, |
| @@ -2663,7 +2755,7 @@ const struct file_operations ocfs2_dops = { | |||
| 2663 | * the cluster. | 2755 | * the cluster. |
| 2664 | */ | 2756 | */ |
| 2665 | const struct file_operations ocfs2_fops_no_plocks = { | 2757 | const struct file_operations ocfs2_fops_no_plocks = { |
| 2666 | .llseek = generic_file_llseek, | 2758 | .llseek = ocfs2_file_llseek, |
| 2667 | .read = do_sync_read, | 2759 | .read = do_sync_read, |
| 2668 | .write = do_sync_write, | 2760 | .write = do_sync_write, |
| 2669 | .mmap = ocfs2_mmap, | 2761 | .mmap = ocfs2_mmap, |
diff --git a/fs/ocfs2/inode.c b/fs/ocfs2/inode.c index a22d2c098890..17454a904d7b 100644 --- a/fs/ocfs2/inode.c +++ b/fs/ocfs2/inode.c | |||
| @@ -951,7 +951,7 @@ static void ocfs2_cleanup_delete_inode(struct inode *inode, | |||
| 951 | trace_ocfs2_cleanup_delete_inode( | 951 | trace_ocfs2_cleanup_delete_inode( |
| 952 | (unsigned long long)OCFS2_I(inode)->ip_blkno, sync_data); | 952 | (unsigned long long)OCFS2_I(inode)->ip_blkno, sync_data); |
| 953 | if (sync_data) | 953 | if (sync_data) |
| 954 | write_inode_now(inode, 1); | 954 | filemap_write_and_wait(inode->i_mapping); |
| 955 | truncate_inode_pages(&inode->i_data, 0); | 955 | truncate_inode_pages(&inode->i_data, 0); |
| 956 | } | 956 | } |
| 957 | 957 | ||
diff --git a/fs/ocfs2/inode.h b/fs/ocfs2/inode.h index 1c508b149b3a..88924a3133fa 100644 --- a/fs/ocfs2/inode.h +++ b/fs/ocfs2/inode.h | |||
| @@ -43,6 +43,9 @@ struct ocfs2_inode_info | |||
| 43 | /* protects extended attribute changes on this inode */ | 43 | /* protects extended attribute changes on this inode */ |
| 44 | struct rw_semaphore ip_xattr_sem; | 44 | struct rw_semaphore ip_xattr_sem; |
| 45 | 45 | ||
| 46 | /* Number of outstanding AIO's which are not page aligned */ | ||
| 47 | atomic_t ip_unaligned_aio; | ||
| 48 | |||
| 46 | /* These fields are protected by ip_lock */ | 49 | /* These fields are protected by ip_lock */ |
| 47 | spinlock_t ip_lock; | 50 | spinlock_t ip_lock; |
| 48 | u32 ip_open_count; | 51 | u32 ip_open_count; |
diff --git a/fs/ocfs2/ioctl.c b/fs/ocfs2/ioctl.c index bc91072b7219..726ff265b296 100644 --- a/fs/ocfs2/ioctl.c +++ b/fs/ocfs2/ioctl.c | |||
| @@ -122,7 +122,7 @@ static int ocfs2_set_inode_attr(struct inode *inode, unsigned flags, | |||
| 122 | if ((oldflags & OCFS2_IMMUTABLE_FL) || ((flags ^ oldflags) & | 122 | if ((oldflags & OCFS2_IMMUTABLE_FL) || ((flags ^ oldflags) & |
| 123 | (OCFS2_APPEND_FL | OCFS2_IMMUTABLE_FL))) { | 123 | (OCFS2_APPEND_FL | OCFS2_IMMUTABLE_FL))) { |
| 124 | if (!capable(CAP_LINUX_IMMUTABLE)) | 124 | if (!capable(CAP_LINUX_IMMUTABLE)) |
| 125 | goto bail_unlock; | 125 | goto bail_commit; |
| 126 | } | 126 | } |
| 127 | 127 | ||
| 128 | ocfs2_inode->ip_attr = flags; | 128 | ocfs2_inode->ip_attr = flags; |
| @@ -132,6 +132,7 @@ static int ocfs2_set_inode_attr(struct inode *inode, unsigned flags, | |||
| 132 | if (status < 0) | 132 | if (status < 0) |
| 133 | mlog_errno(status); | 133 | mlog_errno(status); |
| 134 | 134 | ||
| 135 | bail_commit: | ||
| 135 | ocfs2_commit_trans(osb, handle); | 136 | ocfs2_commit_trans(osb, handle); |
| 136 | bail_unlock: | 137 | bail_unlock: |
| 137 | ocfs2_inode_unlock(inode, 1); | 138 | ocfs2_inode_unlock(inode, 1); |
| @@ -381,7 +382,7 @@ int ocfs2_info_handle_freeinode(struct inode *inode, | |||
| 381 | if (!oifi) { | 382 | if (!oifi) { |
| 382 | status = -ENOMEM; | 383 | status = -ENOMEM; |
| 383 | mlog_errno(status); | 384 | mlog_errno(status); |
| 384 | goto bail; | 385 | goto out_err; |
| 385 | } | 386 | } |
| 386 | 387 | ||
| 387 | if (o2info_from_user(*oifi, req)) | 388 | if (o2info_from_user(*oifi, req)) |
| @@ -431,7 +432,7 @@ bail: | |||
| 431 | o2info_set_request_error(&oifi->ifi_req, req); | 432 | o2info_set_request_error(&oifi->ifi_req, req); |
| 432 | 433 | ||
| 433 | kfree(oifi); | 434 | kfree(oifi); |
| 434 | 435 | out_err: | |
| 435 | return status; | 436 | return status; |
| 436 | } | 437 | } |
| 437 | 438 | ||
| @@ -666,7 +667,7 @@ int ocfs2_info_handle_freefrag(struct inode *inode, | |||
| 666 | if (!oiff) { | 667 | if (!oiff) { |
| 667 | status = -ENOMEM; | 668 | status = -ENOMEM; |
| 668 | mlog_errno(status); | 669 | mlog_errno(status); |
| 669 | goto bail; | 670 | goto out_err; |
| 670 | } | 671 | } |
| 671 | 672 | ||
| 672 | if (o2info_from_user(*oiff, req)) | 673 | if (o2info_from_user(*oiff, req)) |
| @@ -716,7 +717,7 @@ bail: | |||
| 716 | o2info_set_request_error(&oiff->iff_req, req); | 717 | o2info_set_request_error(&oiff->iff_req, req); |
| 717 | 718 | ||
| 718 | kfree(oiff); | 719 | kfree(oiff); |
| 719 | 720 | out_err: | |
| 720 | return status; | 721 | return status; |
| 721 | } | 722 | } |
| 722 | 723 | ||
diff --git a/fs/ocfs2/journal.c b/fs/ocfs2/journal.c index 295d56454e8b..0a42ae96dca7 100644 --- a/fs/ocfs2/journal.c +++ b/fs/ocfs2/journal.c | |||
| @@ -1544,9 +1544,9 @@ static int ocfs2_replay_journal(struct ocfs2_super *osb, | |||
| 1544 | /* we need to run complete recovery for offline orphan slots */ | 1544 | /* we need to run complete recovery for offline orphan slots */ |
| 1545 | ocfs2_replay_map_set_state(osb, REPLAY_NEEDED); | 1545 | ocfs2_replay_map_set_state(osb, REPLAY_NEEDED); |
| 1546 | 1546 | ||
| 1547 | mlog(ML_NOTICE, "Recovering node %d from slot %d on device (%u,%u)\n", | 1547 | printk(KERN_NOTICE "ocfs2: Begin replay journal (node %d, slot %d) on "\ |
| 1548 | node_num, slot_num, | 1548 | "device (%u,%u)\n", node_num, slot_num, MAJOR(osb->sb->s_dev), |
| 1549 | MAJOR(osb->sb->s_dev), MINOR(osb->sb->s_dev)); | 1549 | MINOR(osb->sb->s_dev)); |
| 1550 | 1550 | ||
| 1551 | OCFS2_I(inode)->ip_clusters = le32_to_cpu(fe->i_clusters); | 1551 | OCFS2_I(inode)->ip_clusters = le32_to_cpu(fe->i_clusters); |
| 1552 | 1552 | ||
| @@ -1601,6 +1601,9 @@ static int ocfs2_replay_journal(struct ocfs2_super *osb, | |||
| 1601 | 1601 | ||
| 1602 | jbd2_journal_destroy(journal); | 1602 | jbd2_journal_destroy(journal); |
| 1603 | 1603 | ||
| 1604 | printk(KERN_NOTICE "ocfs2: End replay journal (node %d, slot %d) on "\ | ||
| 1605 | "device (%u,%u)\n", node_num, slot_num, MAJOR(osb->sb->s_dev), | ||
| 1606 | MINOR(osb->sb->s_dev)); | ||
| 1604 | done: | 1607 | done: |
| 1605 | /* drop the lock on this nodes journal */ | 1608 | /* drop the lock on this nodes journal */ |
| 1606 | if (got_lock) | 1609 | if (got_lock) |
| @@ -1808,6 +1811,20 @@ static inline unsigned long ocfs2_orphan_scan_timeout(void) | |||
| 1808 | * every slot, queuing a recovery of the slot on the ocfs2_wq thread. This | 1811 | * every slot, queuing a recovery of the slot on the ocfs2_wq thread. This |
| 1809 | * is done to catch any orphans that are left over in orphan directories. | 1812 | * is done to catch any orphans that are left over in orphan directories. |
| 1810 | * | 1813 | * |
| 1814 | * It scans all slots, even ones that are in use. It does so to handle the | ||
| 1815 | * case described below: | ||
| 1816 | * | ||
| 1817 | * Node 1 has an inode it was using. The dentry went away due to memory | ||
| 1818 | * pressure. Node 1 closes the inode, but it's on the free list. The node | ||
| 1819 | * has the open lock. | ||
| 1820 | * Node 2 unlinks the inode. It grabs the dentry lock to notify others, | ||
| 1821 | * but node 1 has no dentry and doesn't get the message. It trylocks the | ||
| 1822 | * open lock, sees that another node has a PR, and does nothing. | ||
| 1823 | * Later node 2 runs its orphan dir. It igets the inode, trylocks the | ||
| 1824 | * open lock, sees the PR still, and does nothing. | ||
| 1825 | * Basically, we have to trigger an orphan iput on node 1. The only way | ||
| 1826 | * for this to happen is if node 1 runs node 2's orphan dir. | ||
| 1827 | * | ||
| 1811 | * ocfs2_queue_orphan_scan gets called every ORPHAN_SCAN_SCHEDULE_TIMEOUT | 1828 | * ocfs2_queue_orphan_scan gets called every ORPHAN_SCAN_SCHEDULE_TIMEOUT |
| 1812 | * seconds. It gets an EX lock on os_lockres and checks sequence number | 1829 | * seconds. It gets an EX lock on os_lockres and checks sequence number |
| 1813 | * stored in LVB. If the sequence number has changed, it means some other | 1830 | * stored in LVB. If the sequence number has changed, it means some other |
diff --git a/fs/ocfs2/journal.h b/fs/ocfs2/journal.h index 68cf2f6d3c6a..a3385b63ff5e 100644 --- a/fs/ocfs2/journal.h +++ b/fs/ocfs2/journal.h | |||
| @@ -441,10 +441,11 @@ static inline int ocfs2_mknod_credits(struct super_block *sb, int is_dir, | |||
| 441 | #define OCFS2_SIMPLE_DIR_EXTEND_CREDITS (2) | 441 | #define OCFS2_SIMPLE_DIR_EXTEND_CREDITS (2) |
| 442 | 442 | ||
| 443 | /* file update (nlink, etc) + directory mtime/ctime + dir entry block + quota | 443 | /* file update (nlink, etc) + directory mtime/ctime + dir entry block + quota |
| 444 | * update on dir + index leaf + dx root update for free list */ | 444 | * update on dir + index leaf + dx root update for free list + |
| 445 | * previous dirblock update in the free list */ | ||
| 445 | static inline int ocfs2_link_credits(struct super_block *sb) | 446 | static inline int ocfs2_link_credits(struct super_block *sb) |
| 446 | { | 447 | { |
| 447 | return 2*OCFS2_INODE_UPDATE_CREDITS + 3 + | 448 | return 2*OCFS2_INODE_UPDATE_CREDITS + 4 + |
| 448 | ocfs2_quota_trans_credits(sb); | 449 | ocfs2_quota_trans_credits(sb); |
| 449 | } | 450 | } |
| 450 | 451 | ||
diff --git a/fs/ocfs2/mmap.c b/fs/ocfs2/mmap.c index 3e9393ca39eb..9cd41083e991 100644 --- a/fs/ocfs2/mmap.c +++ b/fs/ocfs2/mmap.c | |||
| @@ -61,7 +61,7 @@ static int ocfs2_fault(struct vm_area_struct *area, struct vm_fault *vmf) | |||
| 61 | static int __ocfs2_page_mkwrite(struct file *file, struct buffer_head *di_bh, | 61 | static int __ocfs2_page_mkwrite(struct file *file, struct buffer_head *di_bh, |
| 62 | struct page *page) | 62 | struct page *page) |
| 63 | { | 63 | { |
| 64 | int ret; | 64 | int ret = VM_FAULT_NOPAGE; |
| 65 | struct inode *inode = file->f_path.dentry->d_inode; | 65 | struct inode *inode = file->f_path.dentry->d_inode; |
| 66 | struct address_space *mapping = inode->i_mapping; | 66 | struct address_space *mapping = inode->i_mapping; |
| 67 | loff_t pos = page_offset(page); | 67 | loff_t pos = page_offset(page); |
| @@ -71,32 +71,25 @@ static int __ocfs2_page_mkwrite(struct file *file, struct buffer_head *di_bh, | |||
| 71 | void *fsdata; | 71 | void *fsdata; |
| 72 | loff_t size = i_size_read(inode); | 72 | loff_t size = i_size_read(inode); |
| 73 | 73 | ||
| 74 | /* | ||
| 75 | * Another node might have truncated while we were waiting on | ||
| 76 | * cluster locks. | ||
| 77 | * We don't check size == 0 before the shift. This is borrowed | ||
| 78 | * from do_generic_file_read. | ||
| 79 | */ | ||
| 80 | last_index = (size - 1) >> PAGE_CACHE_SHIFT; | 74 | last_index = (size - 1) >> PAGE_CACHE_SHIFT; |
| 81 | if (unlikely(!size || page->index > last_index)) { | ||
| 82 | ret = -EINVAL; | ||
| 83 | goto out; | ||
| 84 | } | ||
| 85 | 75 | ||
| 86 | /* | 76 | /* |
| 87 | * The i_size check above doesn't catch the case where nodes | 77 | * There are cases that lead to the page no longer bebongs to the |
| 88 | * truncated and then re-extended the file. We'll re-check the | 78 | * mapping. |
| 89 | * page mapping after taking the page lock inside of | 79 | * 1) pagecache truncates locally due to memory pressure. |
| 90 | * ocfs2_write_begin_nolock(). | 80 | * 2) pagecache truncates when another is taking EX lock against |
| 81 | * inode lock. see ocfs2_data_convert_worker. | ||
| 82 | * | ||
| 83 | * The i_size check doesn't catch the case where nodes truncated and | ||
| 84 | * then re-extended the file. We'll re-check the page mapping after | ||
| 85 | * taking the page lock inside of ocfs2_write_begin_nolock(). | ||
| 86 | * | ||
| 87 | * Let VM retry with these cases. | ||
| 91 | */ | 88 | */ |
| 92 | if (!PageUptodate(page) || page->mapping != inode->i_mapping) { | 89 | if ((page->mapping != inode->i_mapping) || |
| 93 | /* | 90 | (!PageUptodate(page)) || |
| 94 | * the page has been umapped in ocfs2_data_downconvert_worker. | 91 | (page_offset(page) >= size)) |
| 95 | * So return 0 here and let VFS retry. | ||
| 96 | */ | ||
| 97 | ret = 0; | ||
| 98 | goto out; | 92 | goto out; |
| 99 | } | ||
| 100 | 93 | ||
| 101 | /* | 94 | /* |
| 102 | * Call ocfs2_write_begin() and ocfs2_write_end() to take | 95 | * Call ocfs2_write_begin() and ocfs2_write_end() to take |
| @@ -116,17 +109,21 @@ static int __ocfs2_page_mkwrite(struct file *file, struct buffer_head *di_bh, | |||
| 116 | if (ret) { | 109 | if (ret) { |
| 117 | if (ret != -ENOSPC) | 110 | if (ret != -ENOSPC) |
| 118 | mlog_errno(ret); | 111 | mlog_errno(ret); |
| 112 | if (ret == -ENOMEM) | ||
| 113 | ret = VM_FAULT_OOM; | ||
| 114 | else | ||
| 115 | ret = VM_FAULT_SIGBUS; | ||
| 119 | goto out; | 116 | goto out; |
| 120 | } | 117 | } |
| 121 | 118 | ||
| 122 | ret = ocfs2_write_end_nolock(mapping, pos, len, len, locked_page, | 119 | if (!locked_page) { |
| 123 | fsdata); | 120 | ret = VM_FAULT_NOPAGE; |
| 124 | if (ret < 0) { | ||
| 125 | mlog_errno(ret); | ||
| 126 | goto out; | 121 | goto out; |
| 127 | } | 122 | } |
| 123 | ret = ocfs2_write_end_nolock(mapping, pos, len, len, locked_page, | ||
| 124 | fsdata); | ||
| 128 | BUG_ON(ret != len); | 125 | BUG_ON(ret != len); |
| 129 | ret = 0; | 126 | ret = VM_FAULT_LOCKED; |
| 130 | out: | 127 | out: |
| 131 | return ret; | 128 | return ret; |
| 132 | } | 129 | } |
| @@ -168,8 +165,6 @@ static int ocfs2_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf) | |||
| 168 | 165 | ||
| 169 | out: | 166 | out: |
| 170 | ocfs2_unblock_signals(&oldset); | 167 | ocfs2_unblock_signals(&oldset); |
| 171 | if (ret) | ||
| 172 | ret = VM_FAULT_SIGBUS; | ||
| 173 | return ret; | 168 | return ret; |
| 174 | } | 169 | } |
| 175 | 170 | ||
diff --git a/fs/ocfs2/move_extents.c b/fs/ocfs2/move_extents.c index d53cb706f14c..184c76b8c293 100644 --- a/fs/ocfs2/move_extents.c +++ b/fs/ocfs2/move_extents.c | |||
| @@ -745,7 +745,7 @@ static int ocfs2_move_extent(struct ocfs2_move_extents_context *context, | |||
| 745 | */ | 745 | */ |
| 746 | ocfs2_probe_alloc_group(inode, gd_bh, &goal_bit, len, move_max_hop, | 746 | ocfs2_probe_alloc_group(inode, gd_bh, &goal_bit, len, move_max_hop, |
| 747 | new_phys_cpos); | 747 | new_phys_cpos); |
| 748 | if (!new_phys_cpos) { | 748 | if (!*new_phys_cpos) { |
| 749 | ret = -ENOSPC; | 749 | ret = -ENOSPC; |
| 750 | goto out_commit; | 750 | goto out_commit; |
| 751 | } | 751 | } |
diff --git a/fs/ocfs2/ocfs2.h b/fs/ocfs2/ocfs2.h index 409285854f64..d355e6e36b36 100644 --- a/fs/ocfs2/ocfs2.h +++ b/fs/ocfs2/ocfs2.h | |||
| @@ -836,18 +836,65 @@ static inline unsigned int ocfs2_clusters_to_megabytes(struct super_block *sb, | |||
| 836 | 836 | ||
| 837 | static inline void _ocfs2_set_bit(unsigned int bit, unsigned long *bitmap) | 837 | static inline void _ocfs2_set_bit(unsigned int bit, unsigned long *bitmap) |
| 838 | { | 838 | { |
| 839 | __test_and_set_bit_le(bit, bitmap); | 839 | __set_bit_le(bit, bitmap); |
| 840 | } | 840 | } |
| 841 | #define ocfs2_set_bit(bit, addr) _ocfs2_set_bit((bit), (unsigned long *)(addr)) | 841 | #define ocfs2_set_bit(bit, addr) _ocfs2_set_bit((bit), (unsigned long *)(addr)) |
| 842 | 842 | ||
| 843 | static inline void _ocfs2_clear_bit(unsigned int bit, unsigned long *bitmap) | 843 | static inline void _ocfs2_clear_bit(unsigned int bit, unsigned long *bitmap) |
| 844 | { | 844 | { |
| 845 | __test_and_clear_bit_le(bit, bitmap); | 845 | __clear_bit_le(bit, bitmap); |
| 846 | } | 846 | } |
| 847 | #define ocfs2_clear_bit(bit, addr) _ocfs2_clear_bit((bit), (unsigned long *)(addr)) | 847 | #define ocfs2_clear_bit(bit, addr) _ocfs2_clear_bit((bit), (unsigned long *)(addr)) |
| 848 | 848 | ||
| 849 | #define ocfs2_test_bit test_bit_le | 849 | #define ocfs2_test_bit test_bit_le |
| 850 | #define ocfs2_find_next_zero_bit find_next_zero_bit_le | 850 | #define ocfs2_find_next_zero_bit find_next_zero_bit_le |
| 851 | #define ocfs2_find_next_bit find_next_bit_le | 851 | #define ocfs2_find_next_bit find_next_bit_le |
| 852 | |||
| 853 | static inline void *correct_addr_and_bit_unaligned(int *bit, void *addr) | ||
| 854 | { | ||
| 855 | #if BITS_PER_LONG == 64 | ||
| 856 | *bit += ((unsigned long) addr & 7UL) << 3; | ||
| 857 | addr = (void *) ((unsigned long) addr & ~7UL); | ||
| 858 | #elif BITS_PER_LONG == 32 | ||
| 859 | *bit += ((unsigned long) addr & 3UL) << 3; | ||
| 860 | addr = (void *) ((unsigned long) addr & ~3UL); | ||
| 861 | #else | ||
| 862 | #error "how many bits you are?!" | ||
| 863 | #endif | ||
| 864 | return addr; | ||
| 865 | } | ||
| 866 | |||
| 867 | static inline void ocfs2_set_bit_unaligned(int bit, void *bitmap) | ||
| 868 | { | ||
| 869 | bitmap = correct_addr_and_bit_unaligned(&bit, bitmap); | ||
| 870 | ocfs2_set_bit(bit, bitmap); | ||
| 871 | } | ||
| 872 | |||
| 873 | static inline void ocfs2_clear_bit_unaligned(int bit, void *bitmap) | ||
| 874 | { | ||
| 875 | bitmap = correct_addr_and_bit_unaligned(&bit, bitmap); | ||
| 876 | ocfs2_clear_bit(bit, bitmap); | ||
| 877 | } | ||
| 878 | |||
| 879 | static inline int ocfs2_test_bit_unaligned(int bit, void *bitmap) | ||
| 880 | { | ||
| 881 | bitmap = correct_addr_and_bit_unaligned(&bit, bitmap); | ||
| 882 | return ocfs2_test_bit(bit, bitmap); | ||
| 883 | } | ||
| 884 | |||
| 885 | static inline int ocfs2_find_next_zero_bit_unaligned(void *bitmap, int max, | ||
| 886 | int start) | ||
| 887 | { | ||
| 888 | int fix = 0, ret, tmpmax; | ||
| 889 | bitmap = correct_addr_and_bit_unaligned(&fix, bitmap); | ||
| 890 | tmpmax = max + fix; | ||
| 891 | start += fix; | ||
| 892 | |||
| 893 | ret = ocfs2_find_next_zero_bit(bitmap, tmpmax, start) - fix; | ||
| 894 | if (ret > max) | ||
| 895 | return max; | ||
| 896 | return ret; | ||
| 897 | } | ||
| 898 | |||
| 852 | #endif /* OCFS2_H */ | 899 | #endif /* OCFS2_H */ |
| 853 | 900 | ||
diff --git a/fs/ocfs2/quota_local.c b/fs/ocfs2/quota_local.c index dc8007fc9247..f100bf70a906 100644 --- a/fs/ocfs2/quota_local.c +++ b/fs/ocfs2/quota_local.c | |||
| @@ -404,7 +404,9 @@ struct ocfs2_quota_recovery *ocfs2_begin_quota_recovery( | |||
| 404 | int status = 0; | 404 | int status = 0; |
| 405 | struct ocfs2_quota_recovery *rec; | 405 | struct ocfs2_quota_recovery *rec; |
| 406 | 406 | ||
| 407 | mlog(ML_NOTICE, "Beginning quota recovery in slot %u\n", slot_num); | 407 | printk(KERN_NOTICE "ocfs2: Beginning quota recovery on device (%s) for " |
| 408 | "slot %u\n", osb->dev_str, slot_num); | ||
| 409 | |||
| 408 | rec = ocfs2_alloc_quota_recovery(); | 410 | rec = ocfs2_alloc_quota_recovery(); |
| 409 | if (!rec) | 411 | if (!rec) |
| 410 | return ERR_PTR(-ENOMEM); | 412 | return ERR_PTR(-ENOMEM); |
| @@ -549,8 +551,8 @@ static int ocfs2_recover_local_quota_file(struct inode *lqinode, | |||
| 549 | goto out_commit; | 551 | goto out_commit; |
| 550 | } | 552 | } |
| 551 | lock_buffer(qbh); | 553 | lock_buffer(qbh); |
| 552 | WARN_ON(!ocfs2_test_bit(bit, dchunk->dqc_bitmap)); | 554 | WARN_ON(!ocfs2_test_bit_unaligned(bit, dchunk->dqc_bitmap)); |
| 553 | ocfs2_clear_bit(bit, dchunk->dqc_bitmap); | 555 | ocfs2_clear_bit_unaligned(bit, dchunk->dqc_bitmap); |
| 554 | le32_add_cpu(&dchunk->dqc_free, 1); | 556 | le32_add_cpu(&dchunk->dqc_free, 1); |
| 555 | unlock_buffer(qbh); | 557 | unlock_buffer(qbh); |
| 556 | ocfs2_journal_dirty(handle, qbh); | 558 | ocfs2_journal_dirty(handle, qbh); |
| @@ -596,7 +598,9 @@ int ocfs2_finish_quota_recovery(struct ocfs2_super *osb, | |||
| 596 | struct inode *lqinode; | 598 | struct inode *lqinode; |
| 597 | unsigned int flags; | 599 | unsigned int flags; |
| 598 | 600 | ||
| 599 | mlog(ML_NOTICE, "Finishing quota recovery in slot %u\n", slot_num); | 601 | printk(KERN_NOTICE "ocfs2: Finishing quota recovery on device (%s) for " |
| 602 | "slot %u\n", osb->dev_str, slot_num); | ||
| 603 | |||
| 600 | mutex_lock(&sb_dqopt(sb)->dqonoff_mutex); | 604 | mutex_lock(&sb_dqopt(sb)->dqonoff_mutex); |
| 601 | for (type = 0; type < MAXQUOTAS; type++) { | 605 | for (type = 0; type < MAXQUOTAS; type++) { |
| 602 | if (list_empty(&(rec->r_list[type]))) | 606 | if (list_empty(&(rec->r_list[type]))) |
| @@ -612,8 +616,9 @@ int ocfs2_finish_quota_recovery(struct ocfs2_super *osb, | |||
| 612 | /* Someone else is holding the lock? Then he must be | 616 | /* Someone else is holding the lock? Then he must be |
| 613 | * doing the recovery. Just skip the file... */ | 617 | * doing the recovery. Just skip the file... */ |
| 614 | if (status == -EAGAIN) { | 618 | if (status == -EAGAIN) { |
| 615 | mlog(ML_NOTICE, "skipping quota recovery for slot %d " | 619 | printk(KERN_NOTICE "ocfs2: Skipping quota recovery on " |
| 616 | "because quota file is locked.\n", slot_num); | 620 | "device (%s) for slot %d because quota file is " |
| 621 | "locked.\n", osb->dev_str, slot_num); | ||
| 617 | status = 0; | 622 | status = 0; |
| 618 | goto out_put; | 623 | goto out_put; |
| 619 | } else if (status < 0) { | 624 | } else if (status < 0) { |
| @@ -944,7 +949,7 @@ static struct ocfs2_quota_chunk *ocfs2_find_free_entry(struct super_block *sb, | |||
| 944 | * ol_quota_entries_per_block(sb); | 949 | * ol_quota_entries_per_block(sb); |
| 945 | } | 950 | } |
| 946 | 951 | ||
| 947 | found = ocfs2_find_next_zero_bit(dchunk->dqc_bitmap, len, 0); | 952 | found = ocfs2_find_next_zero_bit_unaligned(dchunk->dqc_bitmap, len, 0); |
| 948 | /* We failed? */ | 953 | /* We failed? */ |
| 949 | if (found == len) { | 954 | if (found == len) { |
| 950 | mlog(ML_ERROR, "Did not find empty entry in chunk %d with %u" | 955 | mlog(ML_ERROR, "Did not find empty entry in chunk %d with %u" |
| @@ -1208,7 +1213,7 @@ static void olq_alloc_dquot(struct buffer_head *bh, void *private) | |||
| 1208 | struct ocfs2_local_disk_chunk *dchunk; | 1213 | struct ocfs2_local_disk_chunk *dchunk; |
| 1209 | 1214 | ||
| 1210 | dchunk = (struct ocfs2_local_disk_chunk *)bh->b_data; | 1215 | dchunk = (struct ocfs2_local_disk_chunk *)bh->b_data; |
| 1211 | ocfs2_set_bit(*offset, dchunk->dqc_bitmap); | 1216 | ocfs2_set_bit_unaligned(*offset, dchunk->dqc_bitmap); |
| 1212 | le32_add_cpu(&dchunk->dqc_free, -1); | 1217 | le32_add_cpu(&dchunk->dqc_free, -1); |
| 1213 | } | 1218 | } |
| 1214 | 1219 | ||
| @@ -1289,7 +1294,7 @@ int ocfs2_local_release_dquot(handle_t *handle, struct dquot *dquot) | |||
| 1289 | (od->dq_chunk->qc_headerbh->b_data); | 1294 | (od->dq_chunk->qc_headerbh->b_data); |
| 1290 | /* Mark structure as freed */ | 1295 | /* Mark structure as freed */ |
| 1291 | lock_buffer(od->dq_chunk->qc_headerbh); | 1296 | lock_buffer(od->dq_chunk->qc_headerbh); |
| 1292 | ocfs2_clear_bit(offset, dchunk->dqc_bitmap); | 1297 | ocfs2_clear_bit_unaligned(offset, dchunk->dqc_bitmap); |
| 1293 | le32_add_cpu(&dchunk->dqc_free, 1); | 1298 | le32_add_cpu(&dchunk->dqc_free, 1); |
| 1294 | unlock_buffer(od->dq_chunk->qc_headerbh); | 1299 | unlock_buffer(od->dq_chunk->qc_headerbh); |
| 1295 | ocfs2_journal_dirty(handle, od->dq_chunk->qc_headerbh); | 1300 | ocfs2_journal_dirty(handle, od->dq_chunk->qc_headerbh); |
diff --git a/fs/ocfs2/slot_map.c b/fs/ocfs2/slot_map.c index 26fc0014d509..1424c151cccc 100644 --- a/fs/ocfs2/slot_map.c +++ b/fs/ocfs2/slot_map.c | |||
| @@ -493,8 +493,8 @@ int ocfs2_find_slot(struct ocfs2_super *osb) | |||
| 493 | goto bail; | 493 | goto bail; |
| 494 | } | 494 | } |
| 495 | } else | 495 | } else |
| 496 | mlog(ML_NOTICE, "slot %d is already allocated to this node!\n", | 496 | printk(KERN_INFO "ocfs2: Slot %d on device (%s) was already " |
| 497 | slot); | 497 | "allocated to this node!\n", slot, osb->dev_str); |
| 498 | 498 | ||
| 499 | ocfs2_set_slot(si, slot, osb->node_num); | 499 | ocfs2_set_slot(si, slot, osb->node_num); |
| 500 | osb->slot_num = slot; | 500 | osb->slot_num = slot; |
diff --git a/fs/ocfs2/stack_o2cb.c b/fs/ocfs2/stack_o2cb.c index 19965b00c43c..94368017edb3 100644 --- a/fs/ocfs2/stack_o2cb.c +++ b/fs/ocfs2/stack_o2cb.c | |||
| @@ -28,6 +28,7 @@ | |||
| 28 | #include "cluster/masklog.h" | 28 | #include "cluster/masklog.h" |
| 29 | #include "cluster/nodemanager.h" | 29 | #include "cluster/nodemanager.h" |
| 30 | #include "cluster/heartbeat.h" | 30 | #include "cluster/heartbeat.h" |
| 31 | #include "cluster/tcp.h" | ||
| 31 | 32 | ||
| 32 | #include "stackglue.h" | 33 | #include "stackglue.h" |
| 33 | 34 | ||
| @@ -256,6 +257,61 @@ static void o2cb_dump_lksb(struct ocfs2_dlm_lksb *lksb) | |||
| 256 | } | 257 | } |
| 257 | 258 | ||
| 258 | /* | 259 | /* |
| 260 | * Check if this node is heartbeating and is connected to all other | ||
| 261 | * heartbeating nodes. | ||
| 262 | */ | ||
| 263 | static int o2cb_cluster_check(void) | ||
| 264 | { | ||
| 265 | u8 node_num; | ||
| 266 | int i; | ||
| 267 | unsigned long hbmap[BITS_TO_LONGS(O2NM_MAX_NODES)]; | ||
| 268 | unsigned long netmap[BITS_TO_LONGS(O2NM_MAX_NODES)]; | ||
| 269 | |||
| 270 | node_num = o2nm_this_node(); | ||
| 271 | if (node_num == O2NM_MAX_NODES) { | ||
| 272 | printk(KERN_ERR "o2cb: This node has not been configured.\n"); | ||
| 273 | return -EINVAL; | ||
| 274 | } | ||
| 275 | |||
| 276 | /* | ||
| 277 | * o2dlm expects o2net sockets to be created. If not, then | ||
| 278 | * dlm_join_domain() fails with a stack of errors which are both cryptic | ||
| 279 | * and incomplete. The idea here is to detect upfront whether we have | ||
| 280 | * managed to connect to all nodes or not. If not, then list the nodes | ||
| 281 | * to allow the user to check the configuration (incorrect IP, firewall, | ||
| 282 | * etc.) Yes, this is racy. But its not the end of the world. | ||
| 283 | */ | ||
| 284 | #define O2CB_MAP_STABILIZE_COUNT 60 | ||
| 285 | for (i = 0; i < O2CB_MAP_STABILIZE_COUNT; ++i) { | ||
| 286 | o2hb_fill_node_map(hbmap, sizeof(hbmap)); | ||
| 287 | if (!test_bit(node_num, hbmap)) { | ||
| 288 | printk(KERN_ERR "o2cb: %s heartbeat has not been " | ||
| 289 | "started.\n", (o2hb_global_heartbeat_active() ? | ||
| 290 | "Global" : "Local")); | ||
| 291 | return -EINVAL; | ||
| 292 | } | ||
| 293 | o2net_fill_node_map(netmap, sizeof(netmap)); | ||
| 294 | /* Force set the current node to allow easy compare */ | ||
| 295 | set_bit(node_num, netmap); | ||
| 296 | if (!memcmp(hbmap, netmap, sizeof(hbmap))) | ||
| 297 | return 0; | ||
| 298 | if (i < O2CB_MAP_STABILIZE_COUNT) | ||
| 299 | msleep(1000); | ||
| 300 | } | ||
| 301 | |||
| 302 | printk(KERN_ERR "o2cb: This node could not connect to nodes:"); | ||
| 303 | i = -1; | ||
| 304 | while ((i = find_next_bit(hbmap, O2NM_MAX_NODES, | ||
| 305 | i + 1)) < O2NM_MAX_NODES) { | ||
| 306 | if (!test_bit(i, netmap)) | ||
| 307 | printk(" %u", i); | ||
| 308 | } | ||
| 309 | printk(".\n"); | ||
| 310 | |||
| 311 | return -ENOTCONN; | ||
| 312 | } | ||
| 313 | |||
| 314 | /* | ||
| 259 | * Called from the dlm when it's about to evict a node. This is how the | 315 | * Called from the dlm when it's about to evict a node. This is how the |
| 260 | * classic stack signals node death. | 316 | * classic stack signals node death. |
| 261 | */ | 317 | */ |
| @@ -263,8 +319,8 @@ static void o2dlm_eviction_cb(int node_num, void *data) | |||
| 263 | { | 319 | { |
| 264 | struct ocfs2_cluster_connection *conn = data; | 320 | struct ocfs2_cluster_connection *conn = data; |
| 265 | 321 | ||
| 266 | mlog(ML_NOTICE, "o2dlm has evicted node %d from group %.*s\n", | 322 | printk(KERN_NOTICE "o2cb: o2dlm has evicted node %d from domain %.*s\n", |
| 267 | node_num, conn->cc_namelen, conn->cc_name); | 323 | node_num, conn->cc_namelen, conn->cc_name); |
| 268 | 324 | ||
| 269 | conn->cc_recovery_handler(node_num, conn->cc_recovery_data); | 325 | conn->cc_recovery_handler(node_num, conn->cc_recovery_data); |
| 270 | } | 326 | } |
| @@ -280,12 +336,11 @@ static int o2cb_cluster_connect(struct ocfs2_cluster_connection *conn) | |||
| 280 | BUG_ON(conn == NULL); | 336 | BUG_ON(conn == NULL); |
| 281 | BUG_ON(conn->cc_proto == NULL); | 337 | BUG_ON(conn->cc_proto == NULL); |
| 282 | 338 | ||
| 283 | /* for now we only have one cluster/node, make sure we see it | 339 | /* Ensure cluster stack is up and all nodes are connected */ |
| 284 | * in the heartbeat universe */ | 340 | rc = o2cb_cluster_check(); |
| 285 | if (!o2hb_check_local_node_heartbeating()) { | 341 | if (rc) { |
| 286 | if (o2hb_global_heartbeat_active()) | 342 | printk(KERN_ERR "o2cb: Cluster check failed. Fix errors " |
| 287 | mlog(ML_ERROR, "Global heartbeat not started\n"); | 343 | "before retrying.\n"); |
| 288 | rc = -EINVAL; | ||
| 289 | goto out; | 344 | goto out; |
| 290 | } | 345 | } |
| 291 | 346 | ||
diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c index 56f61027236b..4994f8b0e604 100644 --- a/fs/ocfs2/super.c +++ b/fs/ocfs2/super.c | |||
| @@ -54,6 +54,7 @@ | |||
| 54 | #include "ocfs1_fs_compat.h" | 54 | #include "ocfs1_fs_compat.h" |
| 55 | 55 | ||
| 56 | #include "alloc.h" | 56 | #include "alloc.h" |
| 57 | #include "aops.h" | ||
| 57 | #include "blockcheck.h" | 58 | #include "blockcheck.h" |
| 58 | #include "dlmglue.h" | 59 | #include "dlmglue.h" |
| 59 | #include "export.h" | 60 | #include "export.h" |
| @@ -1107,9 +1108,9 @@ static int ocfs2_fill_super(struct super_block *sb, void *data, int silent) | |||
| 1107 | 1108 | ||
| 1108 | ocfs2_set_ro_flag(osb, 1); | 1109 | ocfs2_set_ro_flag(osb, 1); |
| 1109 | 1110 | ||
| 1110 | printk(KERN_NOTICE "Readonly device detected. No cluster " | 1111 | printk(KERN_NOTICE "ocfs2: Readonly device (%s) detected. " |
| 1111 | "services will be utilized for this mount. Recovery " | 1112 | "Cluster services will not be used for this mount. " |
| 1112 | "will be skipped.\n"); | 1113 | "Recovery will be skipped.\n", osb->dev_str); |
| 1113 | } | 1114 | } |
| 1114 | 1115 | ||
| 1115 | if (!ocfs2_is_hard_readonly(osb)) { | 1116 | if (!ocfs2_is_hard_readonly(osb)) { |
| @@ -1616,12 +1617,17 @@ static int ocfs2_show_options(struct seq_file *s, struct vfsmount *mnt) | |||
| 1616 | return 0; | 1617 | return 0; |
| 1617 | } | 1618 | } |
| 1618 | 1619 | ||
| 1620 | wait_queue_head_t ocfs2__ioend_wq[OCFS2_IOEND_WQ_HASH_SZ]; | ||
| 1621 | |||
| 1619 | static int __init ocfs2_init(void) | 1622 | static int __init ocfs2_init(void) |
| 1620 | { | 1623 | { |
| 1621 | int status; | 1624 | int status, i; |
| 1622 | 1625 | ||
| 1623 | ocfs2_print_version(); | 1626 | ocfs2_print_version(); |
| 1624 | 1627 | ||
| 1628 | for (i = 0; i < OCFS2_IOEND_WQ_HASH_SZ; i++) | ||
| 1629 | init_waitqueue_head(&ocfs2__ioend_wq[i]); | ||
| 1630 | |||
| 1625 | status = init_ocfs2_uptodate_cache(); | 1631 | status = init_ocfs2_uptodate_cache(); |
| 1626 | if (status < 0) { | 1632 | if (status < 0) { |
| 1627 | mlog_errno(status); | 1633 | mlog_errno(status); |
| @@ -1760,7 +1766,7 @@ static void ocfs2_inode_init_once(void *data) | |||
| 1760 | ocfs2_extent_map_init(&oi->vfs_inode); | 1766 | ocfs2_extent_map_init(&oi->vfs_inode); |
| 1761 | INIT_LIST_HEAD(&oi->ip_io_markers); | 1767 | INIT_LIST_HEAD(&oi->ip_io_markers); |
| 1762 | oi->ip_dir_start_lookup = 0; | 1768 | oi->ip_dir_start_lookup = 0; |
| 1763 | 1769 | atomic_set(&oi->ip_unaligned_aio, 0); | |
| 1764 | init_rwsem(&oi->ip_alloc_sem); | 1770 | init_rwsem(&oi->ip_alloc_sem); |
| 1765 | init_rwsem(&oi->ip_xattr_sem); | 1771 | init_rwsem(&oi->ip_xattr_sem); |
| 1766 | mutex_init(&oi->ip_io_mutex); | 1772 | mutex_init(&oi->ip_io_mutex); |
| @@ -1974,7 +1980,8 @@ static void ocfs2_dismount_volume(struct super_block *sb, int mnt_err) | |||
| 1974 | * If we failed before we got a uuid_str yet, we can't stop | 1980 | * If we failed before we got a uuid_str yet, we can't stop |
| 1975 | * heartbeat. Otherwise, do it. | 1981 | * heartbeat. Otherwise, do it. |
| 1976 | */ | 1982 | */ |
| 1977 | if (!mnt_err && !ocfs2_mount_local(osb) && osb->uuid_str) | 1983 | if (!mnt_err && !ocfs2_mount_local(osb) && osb->uuid_str && |
| 1984 | !ocfs2_is_hard_readonly(osb)) | ||
| 1978 | hangup_needed = 1; | 1985 | hangup_needed = 1; |
| 1979 | 1986 | ||
| 1980 | if (osb->cconn) | 1987 | if (osb->cconn) |
| @@ -2353,7 +2360,7 @@ static int ocfs2_initialize_super(struct super_block *sb, | |||
| 2353 | mlog_errno(status); | 2360 | mlog_errno(status); |
| 2354 | goto bail; | 2361 | goto bail; |
| 2355 | } | 2362 | } |
| 2356 | cleancache_init_shared_fs((char *)&uuid_net_key, sb); | 2363 | cleancache_init_shared_fs((char *)&di->id2.i_super.s_uuid, sb); |
| 2357 | 2364 | ||
| 2358 | bail: | 2365 | bail: |
| 2359 | return status; | 2366 | return status; |
| @@ -2462,8 +2469,8 @@ static int ocfs2_check_volume(struct ocfs2_super *osb) | |||
| 2462 | goto finally; | 2469 | goto finally; |
| 2463 | } | 2470 | } |
| 2464 | } else { | 2471 | } else { |
| 2465 | mlog(ML_NOTICE, "File system was not unmounted cleanly, " | 2472 | printk(KERN_NOTICE "ocfs2: File system on device (%s) was not " |
| 2466 | "recovering volume.\n"); | 2473 | "unmounted cleanly, recovering it.\n", osb->dev_str); |
| 2467 | } | 2474 | } |
| 2468 | 2475 | ||
| 2469 | local = ocfs2_mount_local(osb); | 2476 | local = ocfs2_mount_local(osb); |
diff --git a/fs/ocfs2/xattr.c b/fs/ocfs2/xattr.c index 194fb22ef79d..aa9e8777b09a 100644 --- a/fs/ocfs2/xattr.c +++ b/fs/ocfs2/xattr.c | |||
| @@ -2376,16 +2376,18 @@ static int ocfs2_remove_value_outside(struct inode*inode, | |||
| 2376 | } | 2376 | } |
| 2377 | 2377 | ||
| 2378 | ret = ocfs2_xattr_value_truncate(inode, vb, 0, &ctxt); | 2378 | ret = ocfs2_xattr_value_truncate(inode, vb, 0, &ctxt); |
| 2379 | if (ret < 0) { | ||
| 2380 | mlog_errno(ret); | ||
| 2381 | break; | ||
| 2382 | } | ||
| 2383 | 2379 | ||
| 2384 | ocfs2_commit_trans(osb, ctxt.handle); | 2380 | ocfs2_commit_trans(osb, ctxt.handle); |
| 2385 | if (ctxt.meta_ac) { | 2381 | if (ctxt.meta_ac) { |
| 2386 | ocfs2_free_alloc_context(ctxt.meta_ac); | 2382 | ocfs2_free_alloc_context(ctxt.meta_ac); |
| 2387 | ctxt.meta_ac = NULL; | 2383 | ctxt.meta_ac = NULL; |
| 2388 | } | 2384 | } |
| 2385 | |||
| 2386 | if (ret < 0) { | ||
| 2387 | mlog_errno(ret); | ||
| 2388 | break; | ||
| 2389 | } | ||
| 2390 | |||
| 2389 | } | 2391 | } |
| 2390 | 2392 | ||
| 2391 | if (ctxt.meta_ac) | 2393 | if (ctxt.meta_ac) |
diff --git a/fs/pstore/platform.c b/fs/pstore/platform.c index 2bd620f0d796..57bbf9078ac8 100644 --- a/fs/pstore/platform.c +++ b/fs/pstore/platform.c | |||
| @@ -167,6 +167,7 @@ int pstore_register(struct pstore_info *psi) | |||
| 167 | } | 167 | } |
| 168 | 168 | ||
| 169 | psinfo = psi; | 169 | psinfo = psi; |
| 170 | mutex_init(&psinfo->read_mutex); | ||
| 170 | spin_unlock(&pstore_lock); | 171 | spin_unlock(&pstore_lock); |
| 171 | 172 | ||
| 172 | if (owner && !try_module_get(owner)) { | 173 | if (owner && !try_module_get(owner)) { |
| @@ -195,30 +196,32 @@ EXPORT_SYMBOL_GPL(pstore_register); | |||
| 195 | void pstore_get_records(int quiet) | 196 | void pstore_get_records(int quiet) |
| 196 | { | 197 | { |
| 197 | struct pstore_info *psi = psinfo; | 198 | struct pstore_info *psi = psinfo; |
| 199 | char *buf = NULL; | ||
| 198 | ssize_t size; | 200 | ssize_t size; |
| 199 | u64 id; | 201 | u64 id; |
| 200 | enum pstore_type_id type; | 202 | enum pstore_type_id type; |
| 201 | struct timespec time; | 203 | struct timespec time; |
| 202 | int failed = 0, rc; | 204 | int failed = 0, rc; |
| 203 | unsigned long flags; | ||
| 204 | 205 | ||
| 205 | if (!psi) | 206 | if (!psi) |
| 206 | return; | 207 | return; |
| 207 | 208 | ||
| 208 | spin_lock_irqsave(&psinfo->buf_lock, flags); | 209 | mutex_lock(&psi->read_mutex); |
| 209 | rc = psi->open(psi); | 210 | rc = psi->open(psi); |
| 210 | if (rc) | 211 | if (rc) |
| 211 | goto out; | 212 | goto out; |
| 212 | 213 | ||
| 213 | while ((size = psi->read(&id, &type, &time, psi)) > 0) { | 214 | while ((size = psi->read(&id, &type, &time, &buf, psi)) > 0) { |
| 214 | rc = pstore_mkfile(type, psi->name, id, psi->buf, (size_t)size, | 215 | rc = pstore_mkfile(type, psi->name, id, buf, (size_t)size, |
| 215 | time, psi); | 216 | time, psi); |
| 217 | kfree(buf); | ||
| 218 | buf = NULL; | ||
| 216 | if (rc && (rc != -EEXIST || !quiet)) | 219 | if (rc && (rc != -EEXIST || !quiet)) |
| 217 | failed++; | 220 | failed++; |
| 218 | } | 221 | } |
| 219 | psi->close(psi); | 222 | psi->close(psi); |
| 220 | out: | 223 | out: |
| 221 | spin_unlock_irqrestore(&psinfo->buf_lock, flags); | 224 | mutex_unlock(&psi->read_mutex); |
| 222 | 225 | ||
| 223 | if (failed) | 226 | if (failed) |
| 224 | printk(KERN_WARNING "pstore: failed to load %d record(s) from '%s'\n", | 227 | printk(KERN_WARNING "pstore: failed to load %d record(s) from '%s'\n", |
diff --git a/fs/xfs/xfs_acl.c b/fs/xfs/xfs_acl.c index b6c4b3795c4a..76e4266d2e7e 100644 --- a/fs/xfs/xfs_acl.c +++ b/fs/xfs/xfs_acl.c | |||
| @@ -42,6 +42,8 @@ xfs_acl_from_disk(struct xfs_acl *aclp) | |||
| 42 | int count, i; | 42 | int count, i; |
| 43 | 43 | ||
| 44 | count = be32_to_cpu(aclp->acl_cnt); | 44 | count = be32_to_cpu(aclp->acl_cnt); |
| 45 | if (count > XFS_ACL_MAX_ENTRIES) | ||
| 46 | return ERR_PTR(-EFSCORRUPTED); | ||
| 45 | 47 | ||
| 46 | acl = posix_acl_alloc(count, GFP_KERNEL); | 48 | acl = posix_acl_alloc(count, GFP_KERNEL); |
| 47 | if (!acl) | 49 | if (!acl) |
diff --git a/fs/xfs/xfs_attr_leaf.c b/fs/xfs/xfs_attr_leaf.c index d4906e7c9787..c1b55e596551 100644 --- a/fs/xfs/xfs_attr_leaf.c +++ b/fs/xfs/xfs_attr_leaf.c | |||
| @@ -110,6 +110,7 @@ xfs_attr_namesp_match(int arg_flags, int ondisk_flags) | |||
| 110 | /* | 110 | /* |
| 111 | * Query whether the requested number of additional bytes of extended | 111 | * Query whether the requested number of additional bytes of extended |
| 112 | * attribute space will be able to fit inline. | 112 | * attribute space will be able to fit inline. |
| 113 | * | ||
| 113 | * Returns zero if not, else the di_forkoff fork offset to be used in the | 114 | * Returns zero if not, else the di_forkoff fork offset to be used in the |
| 114 | * literal area for attribute data once the new bytes have been added. | 115 | * literal area for attribute data once the new bytes have been added. |
| 115 | * | 116 | * |
| @@ -122,7 +123,7 @@ xfs_attr_shortform_bytesfit(xfs_inode_t *dp, int bytes) | |||
| 122 | int offset; | 123 | int offset; |
| 123 | int minforkoff; /* lower limit on valid forkoff locations */ | 124 | int minforkoff; /* lower limit on valid forkoff locations */ |
| 124 | int maxforkoff; /* upper limit on valid forkoff locations */ | 125 | int maxforkoff; /* upper limit on valid forkoff locations */ |
| 125 | int dsize; | 126 | int dsize; |
| 126 | xfs_mount_t *mp = dp->i_mount; | 127 | xfs_mount_t *mp = dp->i_mount; |
| 127 | 128 | ||
| 128 | offset = (XFS_LITINO(mp) - bytes) >> 3; /* rounded down */ | 129 | offset = (XFS_LITINO(mp) - bytes) >> 3; /* rounded down */ |
| @@ -136,47 +137,60 @@ xfs_attr_shortform_bytesfit(xfs_inode_t *dp, int bytes) | |||
| 136 | return (offset >= minforkoff) ? minforkoff : 0; | 137 | return (offset >= minforkoff) ? minforkoff : 0; |
| 137 | } | 138 | } |
| 138 | 139 | ||
| 139 | if (!(mp->m_flags & XFS_MOUNT_ATTR2)) { | 140 | /* |
| 140 | if (bytes <= XFS_IFORK_ASIZE(dp)) | 141 | * If the requested numbers of bytes is smaller or equal to the |
| 141 | return dp->i_d.di_forkoff; | 142 | * current attribute fork size we can always proceed. |
| 143 | * | ||
| 144 | * Note that if_bytes in the data fork might actually be larger than | ||
| 145 | * the current data fork size is due to delalloc extents. In that | ||
| 146 | * case either the extent count will go down when they are converted | ||
| 147 | * to real extents, or the delalloc conversion will take care of the | ||
| 148 | * literal area rebalancing. | ||
| 149 | */ | ||
| 150 | if (bytes <= XFS_IFORK_ASIZE(dp)) | ||
| 151 | return dp->i_d.di_forkoff; | ||
| 152 | |||
| 153 | /* | ||
| 154 | * For attr2 we can try to move the forkoff if there is space in the | ||
| 155 | * literal area, but for the old format we are done if there is no | ||
| 156 | * space in the fixed attribute fork. | ||
| 157 | */ | ||
| 158 | if (!(mp->m_flags & XFS_MOUNT_ATTR2)) | ||
| 142 | return 0; | 159 | return 0; |
| 143 | } | ||
| 144 | 160 | ||
| 145 | dsize = dp->i_df.if_bytes; | 161 | dsize = dp->i_df.if_bytes; |
| 146 | 162 | ||
| 147 | switch (dp->i_d.di_format) { | 163 | switch (dp->i_d.di_format) { |
| 148 | case XFS_DINODE_FMT_EXTENTS: | 164 | case XFS_DINODE_FMT_EXTENTS: |
| 149 | /* | 165 | /* |
| 150 | * If there is no attr fork and the data fork is extents, | 166 | * If there is no attr fork and the data fork is extents, |
| 151 | * determine if creating the default attr fork will result | 167 | * determine if creating the default attr fork will result |
| 152 | * in the extents form migrating to btree. If so, the | 168 | * in the extents form migrating to btree. If so, the |
| 153 | * minimum offset only needs to be the space required for | 169 | * minimum offset only needs to be the space required for |
| 154 | * the btree root. | 170 | * the btree root. |
| 155 | */ | 171 | */ |
| 156 | if (!dp->i_d.di_forkoff && dp->i_df.if_bytes > | 172 | if (!dp->i_d.di_forkoff && dp->i_df.if_bytes > |
| 157 | xfs_default_attroffset(dp)) | 173 | xfs_default_attroffset(dp)) |
| 158 | dsize = XFS_BMDR_SPACE_CALC(MINDBTPTRS); | 174 | dsize = XFS_BMDR_SPACE_CALC(MINDBTPTRS); |
| 159 | break; | 175 | break; |
| 160 | |||
| 161 | case XFS_DINODE_FMT_BTREE: | 176 | case XFS_DINODE_FMT_BTREE: |
| 162 | /* | 177 | /* |
| 163 | * If have data btree then keep forkoff if we have one, | 178 | * If we have a data btree then keep forkoff if we have one, |
| 164 | * otherwise we are adding a new attr, so then we set | 179 | * otherwise we are adding a new attr, so then we set |
| 165 | * minforkoff to where the btree root can finish so we have | 180 | * minforkoff to where the btree root can finish so we have |
| 166 | * plenty of room for attrs | 181 | * plenty of room for attrs |
| 167 | */ | 182 | */ |
| 168 | if (dp->i_d.di_forkoff) { | 183 | if (dp->i_d.di_forkoff) { |
| 169 | if (offset < dp->i_d.di_forkoff) | 184 | if (offset < dp->i_d.di_forkoff) |
| 170 | return 0; | 185 | return 0; |
| 171 | else | 186 | return dp->i_d.di_forkoff; |
| 172 | return dp->i_d.di_forkoff; | 187 | } |
| 173 | } else | 188 | dsize = XFS_BMAP_BROOT_SPACE(dp->i_df.if_broot); |
| 174 | dsize = XFS_BMAP_BROOT_SPACE(dp->i_df.if_broot); | ||
| 175 | break; | 189 | break; |
| 176 | } | 190 | } |
| 177 | 191 | ||
| 178 | /* | 192 | /* |
| 179 | * A data fork btree root must have space for at least | 193 | * A data fork btree root must have space for at least |
| 180 | * MINDBTPTRS key/ptr pairs if the data fork is small or empty. | 194 | * MINDBTPTRS key/ptr pairs if the data fork is small or empty. |
| 181 | */ | 195 | */ |
| 182 | minforkoff = MAX(dsize, XFS_BMDR_SPACE_CALC(MINDBTPTRS)); | 196 | minforkoff = MAX(dsize, XFS_BMDR_SPACE_CALC(MINDBTPTRS)); |
| @@ -186,10 +200,10 @@ xfs_attr_shortform_bytesfit(xfs_inode_t *dp, int bytes) | |||
| 186 | maxforkoff = XFS_LITINO(mp) - XFS_BMDR_SPACE_CALC(MINABTPTRS); | 200 | maxforkoff = XFS_LITINO(mp) - XFS_BMDR_SPACE_CALC(MINABTPTRS); |
| 187 | maxforkoff = maxforkoff >> 3; /* rounded down */ | 201 | maxforkoff = maxforkoff >> 3; /* rounded down */ |
| 188 | 202 | ||
| 189 | if (offset >= minforkoff && offset < maxforkoff) | ||
| 190 | return offset; | ||
| 191 | if (offset >= maxforkoff) | 203 | if (offset >= maxforkoff) |
| 192 | return maxforkoff; | 204 | return maxforkoff; |
| 205 | if (offset >= minforkoff) | ||
| 206 | return offset; | ||
| 193 | return 0; | 207 | return 0; |
| 194 | } | 208 | } |
| 195 | 209 | ||
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c index c0237c602f11..755ee8164880 100644 --- a/fs/xfs/xfs_inode.c +++ b/fs/xfs/xfs_inode.c | |||
| @@ -2835,6 +2835,27 @@ corrupt_out: | |||
| 2835 | return XFS_ERROR(EFSCORRUPTED); | 2835 | return XFS_ERROR(EFSCORRUPTED); |
| 2836 | } | 2836 | } |
| 2837 | 2837 | ||
| 2838 | void | ||
| 2839 | xfs_promote_inode( | ||
| 2840 | struct xfs_inode *ip) | ||
| 2841 | { | ||
| 2842 | struct xfs_buf *bp; | ||
| 2843 | |||
| 2844 | ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL|XFS_ILOCK_SHARED)); | ||
| 2845 | |||
| 2846 | bp = xfs_incore(ip->i_mount->m_ddev_targp, ip->i_imap.im_blkno, | ||
| 2847 | ip->i_imap.im_len, XBF_TRYLOCK); | ||
| 2848 | if (!bp) | ||
| 2849 | return; | ||
| 2850 | |||
| 2851 | if (XFS_BUF_ISDELAYWRITE(bp)) { | ||
| 2852 | xfs_buf_delwri_promote(bp); | ||
| 2853 | wake_up_process(ip->i_mount->m_ddev_targp->bt_task); | ||
| 2854 | } | ||
| 2855 | |||
| 2856 | xfs_buf_relse(bp); | ||
| 2857 | } | ||
| 2858 | |||
| 2838 | /* | 2859 | /* |
| 2839 | * Return a pointer to the extent record at file index idx. | 2860 | * Return a pointer to the extent record at file index idx. |
| 2840 | */ | 2861 | */ |
diff --git a/fs/xfs/xfs_inode.h b/fs/xfs/xfs_inode.h index 760140d1dd66..b4cd4739f98e 100644 --- a/fs/xfs/xfs_inode.h +++ b/fs/xfs/xfs_inode.h | |||
| @@ -498,6 +498,7 @@ int xfs_iunlink(struct xfs_trans *, xfs_inode_t *); | |||
| 498 | void xfs_iext_realloc(xfs_inode_t *, int, int); | 498 | void xfs_iext_realloc(xfs_inode_t *, int, int); |
| 499 | void xfs_iunpin_wait(xfs_inode_t *); | 499 | void xfs_iunpin_wait(xfs_inode_t *); |
| 500 | int xfs_iflush(xfs_inode_t *, uint); | 500 | int xfs_iflush(xfs_inode_t *, uint); |
| 501 | void xfs_promote_inode(struct xfs_inode *); | ||
| 501 | void xfs_lock_inodes(xfs_inode_t **, int, uint); | 502 | void xfs_lock_inodes(xfs_inode_t **, int, uint); |
| 502 | void xfs_lock_two_inodes(xfs_inode_t *, xfs_inode_t *, uint); | 503 | void xfs_lock_two_inodes(xfs_inode_t *, xfs_inode_t *, uint); |
| 503 | 504 | ||
diff --git a/fs/xfs/xfs_sync.c b/fs/xfs/xfs_sync.c index aa3dc1a4d53d..be5c51d8f757 100644 --- a/fs/xfs/xfs_sync.c +++ b/fs/xfs/xfs_sync.c | |||
| @@ -770,6 +770,17 @@ restart: | |||
| 770 | if (!xfs_iflock_nowait(ip)) { | 770 | if (!xfs_iflock_nowait(ip)) { |
| 771 | if (!(sync_mode & SYNC_WAIT)) | 771 | if (!(sync_mode & SYNC_WAIT)) |
| 772 | goto out; | 772 | goto out; |
| 773 | |||
| 774 | /* | ||
| 775 | * If we only have a single dirty inode in a cluster there is | ||
| 776 | * a fair chance that the AIL push may have pushed it into | ||
| 777 | * the buffer, but xfsbufd won't touch it until 30 seconds | ||
| 778 | * from now, and thus we will lock up here. | ||
| 779 | * | ||
| 780 | * Promote the inode buffer to the front of the delwri list | ||
| 781 | * and wake up xfsbufd now. | ||
| 782 | */ | ||
| 783 | xfs_promote_inode(ip); | ||
| 773 | xfs_iflock(ip); | 784 | xfs_iflock(ip); |
| 774 | } | 785 | } |
| 775 | 786 | ||
diff --git a/include/drm/drm_pciids.h b/include/drm/drm_pciids.h index f81676f1b310..4e4fbb820e20 100644 --- a/include/drm/drm_pciids.h +++ b/include/drm/drm_pciids.h | |||
| @@ -197,6 +197,14 @@ | |||
| 197 | {0x1002, 0x6770, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_NEW_MEMMAP}, \ | 197 | {0x1002, 0x6770, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_NEW_MEMMAP}, \ |
| 198 | {0x1002, 0x6778, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_NEW_MEMMAP}, \ | 198 | {0x1002, 0x6778, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_NEW_MEMMAP}, \ |
| 199 | {0x1002, 0x6779, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_NEW_MEMMAP}, \ | 199 | {0x1002, 0x6779, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_NEW_MEMMAP}, \ |
| 200 | {0x1002, 0x6840, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | ||
| 201 | {0x1002, 0x6841, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | ||
| 202 | {0x1002, 0x6842, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | ||
| 203 | {0x1002, 0x6843, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | ||
| 204 | {0x1002, 0x6849, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_NEW_MEMMAP}, \ | ||
| 205 | {0x1002, 0x6850, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_NEW_MEMMAP}, \ | ||
| 206 | {0x1002, 0x6858, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_NEW_MEMMAP}, \ | ||
| 207 | {0x1002, 0x6859, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_NEW_MEMMAP}, \ | ||
| 200 | {0x1002, 0x6880, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CYPRESS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | 208 | {0x1002, 0x6880, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CYPRESS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ |
| 201 | {0x1002, 0x6888, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CYPRESS|RADEON_NEW_MEMMAP}, \ | 209 | {0x1002, 0x6888, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CYPRESS|RADEON_NEW_MEMMAP}, \ |
| 202 | {0x1002, 0x6889, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CYPRESS|RADEON_NEW_MEMMAP}, \ | 210 | {0x1002, 0x6889, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CYPRESS|RADEON_NEW_MEMMAP}, \ |
diff --git a/include/drm/exynos_drm.h b/include/drm/exynos_drm.h index 1d161cb3aca5..12050434d57a 100644 --- a/include/drm/exynos_drm.h +++ b/include/drm/exynos_drm.h | |||
| @@ -32,17 +32,16 @@ | |||
| 32 | /** | 32 | /** |
| 33 | * User-desired buffer creation information structure. | 33 | * User-desired buffer creation information structure. |
| 34 | * | 34 | * |
| 35 | * @size: requested size for the object. | 35 | * @size: user-desired memory allocation size. |
| 36 | * - this size value would be page-aligned internally. | 36 | * - this size value would be page-aligned internally. |
| 37 | * @flags: user request for setting memory type or cache attributes. | 37 | * @flags: user request for setting memory type or cache attributes. |
| 38 | * @handle: returned handle for the object. | 38 | * @handle: returned a handle to created gem object. |
| 39 | * @pad: just padding to be 64-bit aligned. | 39 | * - this handle will be set by gem module of kernel side. |
| 40 | */ | 40 | */ |
| 41 | struct drm_exynos_gem_create { | 41 | struct drm_exynos_gem_create { |
| 42 | unsigned int size; | 42 | uint64_t size; |
| 43 | unsigned int flags; | 43 | unsigned int flags; |
| 44 | unsigned int handle; | 44 | unsigned int handle; |
| 45 | unsigned int pad; | ||
| 46 | }; | 45 | }; |
| 47 | 46 | ||
| 48 | /** | 47 | /** |
diff --git a/include/linux/clocksource.h b/include/linux/clocksource.h index 139c4db55f17..c86c940d1de3 100644 --- a/include/linux/clocksource.h +++ b/include/linux/clocksource.h | |||
| @@ -156,6 +156,7 @@ extern u64 timecounter_cyc2time(struct timecounter *tc, | |||
| 156 | * @mult: cycle to nanosecond multiplier | 156 | * @mult: cycle to nanosecond multiplier |
| 157 | * @shift: cycle to nanosecond divisor (power of two) | 157 | * @shift: cycle to nanosecond divisor (power of two) |
| 158 | * @max_idle_ns: max idle time permitted by the clocksource (nsecs) | 158 | * @max_idle_ns: max idle time permitted by the clocksource (nsecs) |
| 159 | * @maxadj maximum adjustment value to mult (~11%) | ||
| 159 | * @flags: flags describing special properties | 160 | * @flags: flags describing special properties |
| 160 | * @archdata: arch-specific data | 161 | * @archdata: arch-specific data |
| 161 | * @suspend: suspend function for the clocksource, if necessary | 162 | * @suspend: suspend function for the clocksource, if necessary |
| @@ -172,7 +173,7 @@ struct clocksource { | |||
| 172 | u32 mult; | 173 | u32 mult; |
| 173 | u32 shift; | 174 | u32 shift; |
| 174 | u64 max_idle_ns; | 175 | u64 max_idle_ns; |
| 175 | 176 | u32 maxadj; | |
| 176 | #ifdef CONFIG_ARCH_CLOCKSOURCE_DATA | 177 | #ifdef CONFIG_ARCH_CLOCKSOURCE_DATA |
| 177 | struct arch_clocksource_data archdata; | 178 | struct arch_clocksource_data archdata; |
| 178 | #endif | 179 | #endif |
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index cbeb5867cff7..a82ad4dd306a 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h | |||
| @@ -2536,6 +2536,8 @@ extern void net_disable_timestamp(void); | |||
| 2536 | extern void *dev_seq_start(struct seq_file *seq, loff_t *pos); | 2536 | extern void *dev_seq_start(struct seq_file *seq, loff_t *pos); |
| 2537 | extern void *dev_seq_next(struct seq_file *seq, void *v, loff_t *pos); | 2537 | extern void *dev_seq_next(struct seq_file *seq, void *v, loff_t *pos); |
| 2538 | extern void dev_seq_stop(struct seq_file *seq, void *v); | 2538 | extern void dev_seq_stop(struct seq_file *seq, void *v); |
| 2539 | extern int dev_seq_open_ops(struct inode *inode, struct file *file, | ||
| 2540 | const struct seq_operations *ops); | ||
| 2539 | #endif | 2541 | #endif |
| 2540 | 2542 | ||
| 2541 | extern int netdev_class_create_file(struct class_attribute *class_attr); | 2543 | extern int netdev_class_create_file(struct class_attribute *class_attr); |
diff --git a/include/linux/pkt_sched.h b/include/linux/pkt_sched.h index c5336705921f..7281d5acf2f9 100644 --- a/include/linux/pkt_sched.h +++ b/include/linux/pkt_sched.h | |||
| @@ -30,7 +30,7 @@ | |||
| 30 | */ | 30 | */ |
| 31 | 31 | ||
| 32 | struct tc_stats { | 32 | struct tc_stats { |
| 33 | __u64 bytes; /* NUmber of enqueues bytes */ | 33 | __u64 bytes; /* Number of enqueued bytes */ |
| 34 | __u32 packets; /* Number of enqueued packets */ | 34 | __u32 packets; /* Number of enqueued packets */ |
| 35 | __u32 drops; /* Packets dropped because of lack of resources */ | 35 | __u32 drops; /* Packets dropped because of lack of resources */ |
| 36 | __u32 overlimits; /* Number of throttle events when this | 36 | __u32 overlimits; /* Number of throttle events when this |
| @@ -297,7 +297,7 @@ struct tc_htb_glob { | |||
| 297 | __u32 debug; /* debug flags */ | 297 | __u32 debug; /* debug flags */ |
| 298 | 298 | ||
| 299 | /* stats */ | 299 | /* stats */ |
| 300 | __u32 direct_pkts; /* count of non shapped packets */ | 300 | __u32 direct_pkts; /* count of non shaped packets */ |
| 301 | }; | 301 | }; |
| 302 | enum { | 302 | enum { |
| 303 | TCA_HTB_UNSPEC, | 303 | TCA_HTB_UNSPEC, |
| @@ -503,7 +503,7 @@ enum { | |||
| 503 | }; | 503 | }; |
| 504 | #define NETEM_LOSS_MAX (__NETEM_LOSS_MAX - 1) | 504 | #define NETEM_LOSS_MAX (__NETEM_LOSS_MAX - 1) |
| 505 | 505 | ||
| 506 | /* State transition probablities for 4 state model */ | 506 | /* State transition probabilities for 4 state model */ |
| 507 | struct tc_netem_gimodel { | 507 | struct tc_netem_gimodel { |
| 508 | __u32 p13; | 508 | __u32 p13; |
| 509 | __u32 p31; | 509 | __u32 p31; |
diff --git a/include/linux/pm.h b/include/linux/pm.h index 5c4c8b18c8b7..3f3ed83a9aa5 100644 --- a/include/linux/pm.h +++ b/include/linux/pm.h | |||
| @@ -54,118 +54,145 @@ typedef struct pm_message { | |||
| 54 | /** | 54 | /** |
| 55 | * struct dev_pm_ops - device PM callbacks | 55 | * struct dev_pm_ops - device PM callbacks |
| 56 | * | 56 | * |
| 57 | * Several driver power state transitions are externally visible, affecting | 57 | * Several device power state transitions are externally visible, affecting |
| 58 | * the state of pending I/O queues and (for drivers that touch hardware) | 58 | * the state of pending I/O queues and (for drivers that touch hardware) |
| 59 | * interrupts, wakeups, DMA, and other hardware state. There may also be | 59 | * interrupts, wakeups, DMA, and other hardware state. There may also be |
| 60 | * internal transitions to various low power modes, which are transparent | 60 | * internal transitions to various low-power modes which are transparent |
| 61 | * to the rest of the driver stack (such as a driver that's ON gating off | 61 | * to the rest of the driver stack (such as a driver that's ON gating off |
| 62 | * clocks which are not in active use). | 62 | * clocks which are not in active use). |
| 63 | * | 63 | * |
| 64 | * The externally visible transitions are handled with the help of the following | 64 | * The externally visible transitions are handled with the help of callbacks |
| 65 | * callbacks included in this structure: | 65 | * included in this structure in such a way that two levels of callbacks are |
| 66 | * | 66 | * involved. First, the PM core executes callbacks provided by PM domains, |
| 67 | * @prepare: Prepare the device for the upcoming transition, but do NOT change | 67 | * device types, classes and bus types. They are the subsystem-level callbacks |
| 68 | * its hardware state. Prevent new children of the device from being | 68 | * supposed to execute callbacks provided by device drivers, although they may |
| 69 | * registered after @prepare() returns (the driver's subsystem and | 69 | * choose not to do that. If the driver callbacks are executed, they have to |
| 70 | * generally the rest of the kernel is supposed to prevent new calls to the | 70 | * collaborate with the subsystem-level callbacks to achieve the goals |
| 71 | * probe method from being made too once @prepare() has succeeded). If | 71 | * appropriate for the given system transition, given transition phase and the |
| 72 | * @prepare() detects a situation it cannot handle (e.g. registration of a | 72 | * subsystem the device belongs to. |
| 73 | * child already in progress), it may return -EAGAIN, so that the PM core | 73 | * |
| 74 | * can execute it once again (e.g. after the new child has been registered) | 74 | * @prepare: The principal role of this callback is to prevent new children of |
| 75 | * to recover from the race condition. This method is executed for all | 75 | * the device from being registered after it has returned (the driver's |
| 76 | * kinds of suspend transitions and is followed by one of the suspend | 76 | * subsystem and generally the rest of the kernel is supposed to prevent |
| 77 | * callbacks: @suspend(), @freeze(), or @poweroff(). | 77 | * new calls to the probe method from being made too once @prepare() has |
| 78 | * The PM core executes @prepare() for all devices before starting to | 78 | * succeeded). If @prepare() detects a situation it cannot handle (e.g. |
| 79 | * execute suspend callbacks for any of them, so drivers may assume all of | 79 | * registration of a child already in progress), it may return -EAGAIN, so |
| 80 | * the other devices to be present and functional while @prepare() is being | 80 | * that the PM core can execute it once again (e.g. after a new child has |
| 81 | * executed. In particular, it is safe to make GFP_KERNEL memory | 81 | * been registered) to recover from the race condition. |
| 82 | * allocations from within @prepare(). However, drivers may NOT assume | 82 | * This method is executed for all kinds of suspend transitions and is |
| 83 | * anything about the availability of the user space at that time and it | 83 | * followed by one of the suspend callbacks: @suspend(), @freeze(), or |
| 84 | * is not correct to request firmware from within @prepare() (it's too | 84 | * @poweroff(). The PM core executes subsystem-level @prepare() for all |
| 85 | * late to do that). [To work around this limitation, drivers may | 85 | * devices before starting to invoke suspend callbacks for any of them, so |
| 86 | * register suspend and hibernation notifiers that are executed before the | 86 | * generally devices may be assumed to be functional or to respond to |
| 87 | * freezing of tasks.] | 87 | * runtime resume requests while @prepare() is being executed. However, |
| 88 | * device drivers may NOT assume anything about the availability of user | ||
| 89 | * space at that time and it is NOT valid to request firmware from within | ||
| 90 | * @prepare() (it's too late to do that). It also is NOT valid to allocate | ||
| 91 | * substantial amounts of memory from @prepare() in the GFP_KERNEL mode. | ||
| 92 | * [To work around these limitations, drivers may register suspend and | ||
| 93 | * hibernation notifiers to be executed before the freezing of tasks.] | ||
| 88 | * | 94 | * |
| 89 | * @complete: Undo the changes made by @prepare(). This method is executed for | 95 | * @complete: Undo the changes made by @prepare(). This method is executed for |
| 90 | * all kinds of resume transitions, following one of the resume callbacks: | 96 | * all kinds of resume transitions, following one of the resume callbacks: |
| 91 | * @resume(), @thaw(), @restore(). Also called if the state transition | 97 | * @resume(), @thaw(), @restore(). Also called if the state transition |
| 92 | * fails before the driver's suspend callback (@suspend(), @freeze(), | 98 | * fails before the driver's suspend callback: @suspend(), @freeze() or |
| 93 | * @poweroff()) can be executed (e.g. if the suspend callback fails for one | 99 | * @poweroff(), can be executed (e.g. if the suspend callback fails for one |
| 94 | * of the other devices that the PM core has unsuccessfully attempted to | 100 | * of the other devices that the PM core has unsuccessfully attempted to |
| 95 | * suspend earlier). | 101 | * suspend earlier). |
| 96 | * The PM core executes @complete() after it has executed the appropriate | 102 | * The PM core executes subsystem-level @complete() after it has executed |
| 97 | * resume callback for all devices. | 103 | * the appropriate resume callbacks for all devices. |
| 98 | * | 104 | * |
| 99 | * @suspend: Executed before putting the system into a sleep state in which the | 105 | * @suspend: Executed before putting the system into a sleep state in which the |
| 100 | * contents of main memory are preserved. Quiesce the device, put it into | 106 | * contents of main memory are preserved. The exact action to perform |
| 101 | * a low power state appropriate for the upcoming system state (such as | 107 | * depends on the device's subsystem (PM domain, device type, class or bus |
| 102 | * PCI_D3hot), and enable wakeup events as appropriate. | 108 | * type), but generally the device must be quiescent after subsystem-level |
| 109 | * @suspend() has returned, so that it doesn't do any I/O or DMA. | ||
| 110 | * Subsystem-level @suspend() is executed for all devices after invoking | ||
| 111 | * subsystem-level @prepare() for all of them. | ||
| 103 | * | 112 | * |
| 104 | * @resume: Executed after waking the system up from a sleep state in which the | 113 | * @resume: Executed after waking the system up from a sleep state in which the |
| 105 | * contents of main memory were preserved. Put the device into the | 114 | * contents of main memory were preserved. The exact action to perform |
| 106 | * appropriate state, according to the information saved in memory by the | 115 | * depends on the device's subsystem, but generally the driver is expected |
| 107 | * preceding @suspend(). The driver starts working again, responding to | 116 | * to start working again, responding to hardware events and software |
| 108 | * hardware events and software requests. The hardware may have gone | 117 | * requests (the device itself may be left in a low-power state, waiting |
| 109 | * through a power-off reset, or it may have maintained state from the | 118 | * for a runtime resume to occur). The state of the device at the time its |
| 110 | * previous suspend() which the driver may rely on while resuming. On most | 119 | * driver's @resume() callback is run depends on the platform and subsystem |
| 111 | * platforms, there are no restrictions on availability of resources like | 120 | * the device belongs to. On most platforms, there are no restrictions on |
| 112 | * clocks during @resume(). | 121 | * availability of resources like clocks during @resume(). |
| 122 | * Subsystem-level @resume() is executed for all devices after invoking | ||
| 123 | * subsystem-level @resume_noirq() for all of them. | ||
| 113 | * | 124 | * |
| 114 | * @freeze: Hibernation-specific, executed before creating a hibernation image. | 125 | * @freeze: Hibernation-specific, executed before creating a hibernation image. |
| 115 | * Quiesce operations so that a consistent image can be created, but do NOT | 126 | * Analogous to @suspend(), but it should not enable the device to signal |
| 116 | * otherwise put the device into a low power device state and do NOT emit | 127 | * wakeup events or change its power state. The majority of subsystems |
| 117 | * system wakeup events. Save in main memory the device settings to be | 128 | * (with the notable exception of the PCI bus type) expect the driver-level |
| 118 | * used by @restore() during the subsequent resume from hibernation or by | 129 | * @freeze() to save the device settings in memory to be used by @restore() |
| 119 | * the subsequent @thaw(), if the creation of the image or the restoration | 130 | * during the subsequent resume from hibernation. |
| 120 | * of main memory contents from it fails. | 131 | * Subsystem-level @freeze() is executed for all devices after invoking |
| 132 | * subsystem-level @prepare() for all of them. | ||
| 121 | * | 133 | * |
| 122 | * @thaw: Hibernation-specific, executed after creating a hibernation image OR | 134 | * @thaw: Hibernation-specific, executed after creating a hibernation image OR |
| 123 | * if the creation of the image fails. Also executed after a failing | 135 | * if the creation of an image has failed. Also executed after a failing |
| 124 | * attempt to restore the contents of main memory from such an image. | 136 | * attempt to restore the contents of main memory from such an image. |
| 125 | * Undo the changes made by the preceding @freeze(), so the device can be | 137 | * Undo the changes made by the preceding @freeze(), so the device can be |
| 126 | * operated in the same way as immediately before the call to @freeze(). | 138 | * operated in the same way as immediately before the call to @freeze(). |
| 139 | * Subsystem-level @thaw() is executed for all devices after invoking | ||
| 140 | * subsystem-level @thaw_noirq() for all of them. It also may be executed | ||
| 141 | * directly after @freeze() in case of a transition error. | ||
| 127 | * | 142 | * |
| 128 | * @poweroff: Hibernation-specific, executed after saving a hibernation image. | 143 | * @poweroff: Hibernation-specific, executed after saving a hibernation image. |
| 129 | * Quiesce the device, put it into a low power state appropriate for the | 144 | * Analogous to @suspend(), but it need not save the device's settings in |
| 130 | * upcoming system state (such as PCI_D3hot), and enable wakeup events as | 145 | * memory. |
| 131 | * appropriate. | 146 | * Subsystem-level @poweroff() is executed for all devices after invoking |
| 147 | * subsystem-level @prepare() for all of them. | ||
| 132 | * | 148 | * |
| 133 | * @restore: Hibernation-specific, executed after restoring the contents of main | 149 | * @restore: Hibernation-specific, executed after restoring the contents of main |
| 134 | * memory from a hibernation image. Driver starts working again, | 150 | * memory from a hibernation image, analogous to @resume(). |
| 135 | * responding to hardware events and software requests. Drivers may NOT | 151 | * |
| 136 | * make ANY assumptions about the hardware state right prior to @restore(). | 152 | * @suspend_noirq: Complete the actions started by @suspend(). Carry out any |
| 137 | * On most platforms, there are no restrictions on availability of | 153 | * additional operations required for suspending the device that might be |
| 138 | * resources like clocks during @restore(). | 154 | * racing with its driver's interrupt handler, which is guaranteed not to |
| 139 | * | 155 | * run while @suspend_noirq() is being executed. |
| 140 | * @suspend_noirq: Complete the operations of ->suspend() by carrying out any | 156 | * It generally is expected that the device will be in a low-power state |
| 141 | * actions required for suspending the device that need interrupts to be | 157 | * (appropriate for the target system sleep state) after subsystem-level |
| 142 | * disabled | 158 | * @suspend_noirq() has returned successfully. If the device can generate |
| 143 | * | 159 | * system wakeup signals and is enabled to wake up the system, it should be |
| 144 | * @resume_noirq: Prepare for the execution of ->resume() by carrying out any | 160 | * configured to do so at that time. However, depending on the platform |
| 145 | * actions required for resuming the device that need interrupts to be | 161 | * and device's subsystem, @suspend() may be allowed to put the device into |
| 146 | * disabled | 162 | * the low-power state and configure it to generate wakeup signals, in |
| 147 | * | 163 | * which case it generally is not necessary to define @suspend_noirq(). |
| 148 | * @freeze_noirq: Complete the operations of ->freeze() by carrying out any | 164 | * |
| 149 | * actions required for freezing the device that need interrupts to be | 165 | * @resume_noirq: Prepare for the execution of @resume() by carrying out any |
| 150 | * disabled | 166 | * operations required for resuming the device that might be racing with |
| 151 | * | 167 | * its driver's interrupt handler, which is guaranteed not to run while |
| 152 | * @thaw_noirq: Prepare for the execution of ->thaw() by carrying out any | 168 | * @resume_noirq() is being executed. |
| 153 | * actions required for thawing the device that need interrupts to be | 169 | * |
| 154 | * disabled | 170 | * @freeze_noirq: Complete the actions started by @freeze(). Carry out any |
| 155 | * | 171 | * additional operations required for freezing the device that might be |
| 156 | * @poweroff_noirq: Complete the operations of ->poweroff() by carrying out any | 172 | * racing with its driver's interrupt handler, which is guaranteed not to |
| 157 | * actions required for handling the device that need interrupts to be | 173 | * run while @freeze_noirq() is being executed. |
| 158 | * disabled | 174 | * The power state of the device should not be changed by either @freeze() |
| 159 | * | 175 | * or @freeze_noirq() and it should not be configured to signal system |
| 160 | * @restore_noirq: Prepare for the execution of ->restore() by carrying out any | 176 | * wakeup by any of these callbacks. |
| 161 | * actions required for restoring the operations of the device that need | 177 | * |
| 162 | * interrupts to be disabled | 178 | * @thaw_noirq: Prepare for the execution of @thaw() by carrying out any |
| 179 | * operations required for thawing the device that might be racing with its | ||
| 180 | * driver's interrupt handler, which is guaranteed not to run while | ||
| 181 | * @thaw_noirq() is being executed. | ||
| 182 | * | ||
| 183 | * @poweroff_noirq: Complete the actions started by @poweroff(). Analogous to | ||
| 184 | * @suspend_noirq(), but it need not save the device's settings in memory. | ||
| 185 | * | ||
| 186 | * @restore_noirq: Prepare for the execution of @restore() by carrying out any | ||
| 187 | * operations required for thawing the device that might be racing with its | ||
| 188 | * driver's interrupt handler, which is guaranteed not to run while | ||
| 189 | * @restore_noirq() is being executed. Analogous to @resume_noirq(). | ||
| 163 | * | 190 | * |
| 164 | * All of the above callbacks, except for @complete(), return error codes. | 191 | * All of the above callbacks, except for @complete(), return error codes. |
| 165 | * However, the error codes returned by the resume operations, @resume(), | 192 | * However, the error codes returned by the resume operations, @resume(), |
| 166 | * @thaw(), @restore(), @resume_noirq(), @thaw_noirq(), and @restore_noirq() do | 193 | * @thaw(), @restore(), @resume_noirq(), @thaw_noirq(), and @restore_noirq(), do |
| 167 | * not cause the PM core to abort the resume transition during which they are | 194 | * not cause the PM core to abort the resume transition during which they are |
| 168 | * returned. The error codes returned in that cases are only printed by the PM | 195 | * returned. The error codes returned in those cases are only printed by the PM |
| 169 | * core to the system logs for debugging purposes. Still, it is recommended | 196 | * core to the system logs for debugging purposes. Still, it is recommended |
| 170 | * that drivers only return error codes from their resume methods in case of an | 197 | * that drivers only return error codes from their resume methods in case of an |
| 171 | * unrecoverable failure (i.e. when the device being handled refuses to resume | 198 | * unrecoverable failure (i.e. when the device being handled refuses to resume |
| @@ -174,31 +201,43 @@ typedef struct pm_message { | |||
| 174 | * their children. | 201 | * their children. |
| 175 | * | 202 | * |
| 176 | * It is allowed to unregister devices while the above callbacks are being | 203 | * It is allowed to unregister devices while the above callbacks are being |
| 177 | * executed. However, it is not allowed to unregister a device from within any | 204 | * executed. However, a callback routine must NOT try to unregister the device |
| 178 | * of its own callbacks. | 205 | * it was called for, although it may unregister children of that device (for |
| 206 | * example, if it detects that a child was unplugged while the system was | ||
| 207 | * asleep). | ||
| 208 | * | ||
| 209 | * Refer to Documentation/power/devices.txt for more information about the role | ||
| 210 | * of the above callbacks in the system suspend process. | ||
| 179 | * | 211 | * |
| 180 | * There also are the following callbacks related to run-time power management | 212 | * There also are callbacks related to runtime power management of devices. |
| 181 | * of devices: | 213 | * Again, these callbacks are executed by the PM core only for subsystems |
| 214 | * (PM domains, device types, classes and bus types) and the subsystem-level | ||
| 215 | * callbacks are supposed to invoke the driver callbacks. Moreover, the exact | ||
| 216 | * actions to be performed by a device driver's callbacks generally depend on | ||
| 217 | * the platform and subsystem the device belongs to. | ||
| 182 | * | 218 | * |
| 183 | * @runtime_suspend: Prepare the device for a condition in which it won't be | 219 | * @runtime_suspend: Prepare the device for a condition in which it won't be |
| 184 | * able to communicate with the CPU(s) and RAM due to power management. | 220 | * able to communicate with the CPU(s) and RAM due to power management. |
| 185 | * This need not mean that the device should be put into a low power state. | 221 | * This need not mean that the device should be put into a low-power state. |
| 186 | * For example, if the device is behind a link which is about to be turned | 222 | * For example, if the device is behind a link which is about to be turned |
| 187 | * off, the device may remain at full power. If the device does go to low | 223 | * off, the device may remain at full power. If the device does go to low |
| 188 | * power and is capable of generating run-time wake-up events, remote | 224 | * power and is capable of generating runtime wakeup events, remote wakeup |
| 189 | * wake-up (i.e., a hardware mechanism allowing the device to request a | 225 | * (i.e., a hardware mechanism allowing the device to request a change of |
| 190 | * change of its power state via a wake-up event, such as PCI PME) should | 226 | * its power state via an interrupt) should be enabled for it. |
| 191 | * be enabled for it. | ||
| 192 | * | 227 | * |
| 193 | * @runtime_resume: Put the device into the fully active state in response to a | 228 | * @runtime_resume: Put the device into the fully active state in response to a |
| 194 | * wake-up event generated by hardware or at the request of software. If | 229 | * wakeup event generated by hardware or at the request of software. If |
| 195 | * necessary, put the device into the full power state and restore its | 230 | * necessary, put the device into the full-power state and restore its |
| 196 | * registers, so that it is fully operational. | 231 | * registers, so that it is fully operational. |
| 197 | * | 232 | * |
| 198 | * @runtime_idle: Device appears to be inactive and it might be put into a low | 233 | * @runtime_idle: Device appears to be inactive and it might be put into a |
| 199 | * power state if all of the necessary conditions are satisfied. Check | 234 | * low-power state if all of the necessary conditions are satisfied. Check |
| 200 | * these conditions and handle the device as appropriate, possibly queueing | 235 | * these conditions and handle the device as appropriate, possibly queueing |
| 201 | * a suspend request for it. The return value is ignored by the PM core. | 236 | * a suspend request for it. The return value is ignored by the PM core. |
| 237 | * | ||
| 238 | * Refer to Documentation/power/runtime_pm.txt for more information about the | ||
| 239 | * role of the above callbacks in device runtime power management. | ||
| 240 | * | ||
| 202 | */ | 241 | */ |
| 203 | 242 | ||
| 204 | struct dev_pm_ops { | 243 | struct dev_pm_ops { |
diff --git a/include/linux/pstore.h b/include/linux/pstore.h index ea567321ae3c..2ca8cde5459d 100644 --- a/include/linux/pstore.h +++ b/include/linux/pstore.h | |||
| @@ -35,10 +35,12 @@ struct pstore_info { | |||
| 35 | spinlock_t buf_lock; /* serialize access to 'buf' */ | 35 | spinlock_t buf_lock; /* serialize access to 'buf' */ |
| 36 | char *buf; | 36 | char *buf; |
| 37 | size_t bufsize; | 37 | size_t bufsize; |
| 38 | struct mutex read_mutex; /* serialize open/read/close */ | ||
| 38 | int (*open)(struct pstore_info *psi); | 39 | int (*open)(struct pstore_info *psi); |
| 39 | int (*close)(struct pstore_info *psi); | 40 | int (*close)(struct pstore_info *psi); |
| 40 | ssize_t (*read)(u64 *id, enum pstore_type_id *type, | 41 | ssize_t (*read)(u64 *id, enum pstore_type_id *type, |
| 41 | struct timespec *time, struct pstore_info *psi); | 42 | struct timespec *time, char **buf, |
| 43 | struct pstore_info *psi); | ||
| 42 | int (*write)(enum pstore_type_id type, u64 *id, | 44 | int (*write)(enum pstore_type_id type, u64 *id, |
| 43 | unsigned int part, size_t size, struct pstore_info *psi); | 45 | unsigned int part, size_t size, struct pstore_info *psi); |
| 44 | int (*erase)(enum pstore_type_id type, u64 id, | 46 | int (*erase)(enum pstore_type_id type, u64 id, |
diff --git a/include/linux/sigma.h b/include/linux/sigma.h index e2accb3164d8..d0de882c0d96 100644 --- a/include/linux/sigma.h +++ b/include/linux/sigma.h | |||
| @@ -24,7 +24,7 @@ struct sigma_firmware { | |||
| 24 | struct sigma_firmware_header { | 24 | struct sigma_firmware_header { |
| 25 | unsigned char magic[7]; | 25 | unsigned char magic[7]; |
| 26 | u8 version; | 26 | u8 version; |
| 27 | u32 crc; | 27 | __le32 crc; |
| 28 | }; | 28 | }; |
| 29 | 29 | ||
| 30 | enum { | 30 | enum { |
| @@ -40,19 +40,14 @@ enum { | |||
| 40 | struct sigma_action { | 40 | struct sigma_action { |
| 41 | u8 instr; | 41 | u8 instr; |
| 42 | u8 len_hi; | 42 | u8 len_hi; |
| 43 | u16 len; | 43 | __le16 len; |
| 44 | u16 addr; | 44 | __be16 addr; |
| 45 | unsigned char payload[]; | 45 | unsigned char payload[]; |
| 46 | }; | 46 | }; |
| 47 | 47 | ||
| 48 | static inline u32 sigma_action_len(struct sigma_action *sa) | 48 | static inline u32 sigma_action_len(struct sigma_action *sa) |
| 49 | { | 49 | { |
| 50 | return (sa->len_hi << 16) | sa->len; | 50 | return (sa->len_hi << 16) | le16_to_cpu(sa->len); |
| 51 | } | ||
| 52 | |||
| 53 | static inline size_t sigma_action_size(struct sigma_action *sa, u32 payload_len) | ||
| 54 | { | ||
| 55 | return sizeof(*sa) + payload_len + (payload_len % 2); | ||
| 56 | } | 51 | } |
| 57 | 52 | ||
| 58 | extern int process_sigma_firmware(struct i2c_client *client, const char *name); | 53 | extern int process_sigma_firmware(struct i2c_client *client, const char *name); |
diff --git a/include/net/dst.h b/include/net/dst.h index 4fb6c4381791..6faec1a60216 100644 --- a/include/net/dst.h +++ b/include/net/dst.h | |||
| @@ -205,12 +205,7 @@ dst_feature(const struct dst_entry *dst, u32 feature) | |||
| 205 | 205 | ||
| 206 | static inline u32 dst_mtu(const struct dst_entry *dst) | 206 | static inline u32 dst_mtu(const struct dst_entry *dst) |
| 207 | { | 207 | { |
| 208 | u32 mtu = dst_metric_raw(dst, RTAX_MTU); | 208 | return dst->ops->mtu(dst); |
| 209 | |||
| 210 | if (!mtu) | ||
| 211 | mtu = dst->ops->default_mtu(dst); | ||
| 212 | |||
| 213 | return mtu; | ||
| 214 | } | 209 | } |
| 215 | 210 | ||
| 216 | /* RTT metrics are stored in milliseconds for user ABI, but used as jiffies */ | 211 | /* RTT metrics are stored in milliseconds for user ABI, but used as jiffies */ |
diff --git a/include/net/dst_ops.h b/include/net/dst_ops.h index 9adb99845a56..e1c2ee0eef47 100644 --- a/include/net/dst_ops.h +++ b/include/net/dst_ops.h | |||
| @@ -17,7 +17,7 @@ struct dst_ops { | |||
| 17 | int (*gc)(struct dst_ops *ops); | 17 | int (*gc)(struct dst_ops *ops); |
| 18 | struct dst_entry * (*check)(struct dst_entry *, __u32 cookie); | 18 | struct dst_entry * (*check)(struct dst_entry *, __u32 cookie); |
| 19 | unsigned int (*default_advmss)(const struct dst_entry *); | 19 | unsigned int (*default_advmss)(const struct dst_entry *); |
| 20 | unsigned int (*default_mtu)(const struct dst_entry *); | 20 | unsigned int (*mtu)(const struct dst_entry *); |
| 21 | u32 * (*cow_metrics)(struct dst_entry *, unsigned long); | 21 | u32 * (*cow_metrics)(struct dst_entry *, unsigned long); |
| 22 | void (*destroy)(struct dst_entry *); | 22 | void (*destroy)(struct dst_entry *); |
| 23 | void (*ifdown)(struct dst_entry *, | 23 | void (*ifdown)(struct dst_entry *, |
diff --git a/include/net/inet_sock.h b/include/net/inet_sock.h index b897d6e6d0a5..f941964a9931 100644 --- a/include/net/inet_sock.h +++ b/include/net/inet_sock.h | |||
| @@ -31,6 +31,7 @@ | |||
| 31 | /** struct ip_options - IP Options | 31 | /** struct ip_options - IP Options |
| 32 | * | 32 | * |
| 33 | * @faddr - Saved first hop address | 33 | * @faddr - Saved first hop address |
| 34 | * @nexthop - Saved nexthop address in LSRR and SSRR | ||
| 34 | * @is_data - Options in __data, rather than skb | 35 | * @is_data - Options in __data, rather than skb |
| 35 | * @is_strictroute - Strict source route | 36 | * @is_strictroute - Strict source route |
| 36 | * @srr_is_hit - Packet destination addr was our one | 37 | * @srr_is_hit - Packet destination addr was our one |
| @@ -41,6 +42,7 @@ | |||
| 41 | */ | 42 | */ |
| 42 | struct ip_options { | 43 | struct ip_options { |
| 43 | __be32 faddr; | 44 | __be32 faddr; |
| 45 | __be32 nexthop; | ||
| 44 | unsigned char optlen; | 46 | unsigned char optlen; |
| 45 | unsigned char srr; | 47 | unsigned char srr; |
| 46 | unsigned char rr; | 48 | unsigned char rr; |
diff --git a/include/net/inetpeer.h b/include/net/inetpeer.h index 78c83e62218f..e9ff3fc5e688 100644 --- a/include/net/inetpeer.h +++ b/include/net/inetpeer.h | |||
| @@ -35,6 +35,7 @@ struct inet_peer { | |||
| 35 | 35 | ||
| 36 | u32 metrics[RTAX_MAX]; | 36 | u32 metrics[RTAX_MAX]; |
| 37 | u32 rate_tokens; /* rate limiting for ICMP */ | 37 | u32 rate_tokens; /* rate limiting for ICMP */ |
| 38 | int redirect_genid; | ||
| 38 | unsigned long rate_last; | 39 | unsigned long rate_last; |
| 39 | unsigned long pmtu_expires; | 40 | unsigned long pmtu_expires; |
| 40 | u32 pmtu_orig; | 41 | u32 pmtu_orig; |
diff --git a/include/net/netfilter/nf_conntrack_ecache.h b/include/net/netfilter/nf_conntrack_ecache.h index 4283508b3e18..a88fb6939387 100644 --- a/include/net/netfilter/nf_conntrack_ecache.h +++ b/include/net/netfilter/nf_conntrack_ecache.h | |||
| @@ -67,18 +67,18 @@ struct nf_ct_event_notifier { | |||
| 67 | int (*fcn)(unsigned int events, struct nf_ct_event *item); | 67 | int (*fcn)(unsigned int events, struct nf_ct_event *item); |
| 68 | }; | 68 | }; |
| 69 | 69 | ||
| 70 | extern struct nf_ct_event_notifier __rcu *nf_conntrack_event_cb; | 70 | extern int nf_conntrack_register_notifier(struct net *net, struct nf_ct_event_notifier *nb); |
| 71 | extern int nf_conntrack_register_notifier(struct nf_ct_event_notifier *nb); | 71 | extern void nf_conntrack_unregister_notifier(struct net *net, struct nf_ct_event_notifier *nb); |
| 72 | extern void nf_conntrack_unregister_notifier(struct nf_ct_event_notifier *nb); | ||
| 73 | 72 | ||
| 74 | extern void nf_ct_deliver_cached_events(struct nf_conn *ct); | 73 | extern void nf_ct_deliver_cached_events(struct nf_conn *ct); |
| 75 | 74 | ||
| 76 | static inline void | 75 | static inline void |
| 77 | nf_conntrack_event_cache(enum ip_conntrack_events event, struct nf_conn *ct) | 76 | nf_conntrack_event_cache(enum ip_conntrack_events event, struct nf_conn *ct) |
| 78 | { | 77 | { |
| 78 | struct net *net = nf_ct_net(ct); | ||
| 79 | struct nf_conntrack_ecache *e; | 79 | struct nf_conntrack_ecache *e; |
| 80 | 80 | ||
| 81 | if (nf_conntrack_event_cb == NULL) | 81 | if (net->ct.nf_conntrack_event_cb == NULL) |
| 82 | return; | 82 | return; |
| 83 | 83 | ||
| 84 | e = nf_ct_ecache_find(ct); | 84 | e = nf_ct_ecache_find(ct); |
| @@ -95,11 +95,12 @@ nf_conntrack_eventmask_report(unsigned int eventmask, | |||
| 95 | int report) | 95 | int report) |
| 96 | { | 96 | { |
| 97 | int ret = 0; | 97 | int ret = 0; |
| 98 | struct net *net = nf_ct_net(ct); | ||
| 98 | struct nf_ct_event_notifier *notify; | 99 | struct nf_ct_event_notifier *notify; |
| 99 | struct nf_conntrack_ecache *e; | 100 | struct nf_conntrack_ecache *e; |
| 100 | 101 | ||
| 101 | rcu_read_lock(); | 102 | rcu_read_lock(); |
| 102 | notify = rcu_dereference(nf_conntrack_event_cb); | 103 | notify = rcu_dereference(net->ct.nf_conntrack_event_cb); |
| 103 | if (notify == NULL) | 104 | if (notify == NULL) |
| 104 | goto out_unlock; | 105 | goto out_unlock; |
| 105 | 106 | ||
| @@ -164,9 +165,8 @@ struct nf_exp_event_notifier { | |||
| 164 | int (*fcn)(unsigned int events, struct nf_exp_event *item); | 165 | int (*fcn)(unsigned int events, struct nf_exp_event *item); |
| 165 | }; | 166 | }; |
| 166 | 167 | ||
| 167 | extern struct nf_exp_event_notifier __rcu *nf_expect_event_cb; | 168 | extern int nf_ct_expect_register_notifier(struct net *net, struct nf_exp_event_notifier *nb); |
| 168 | extern int nf_ct_expect_register_notifier(struct nf_exp_event_notifier *nb); | 169 | extern void nf_ct_expect_unregister_notifier(struct net *net, struct nf_exp_event_notifier *nb); |
| 169 | extern void nf_ct_expect_unregister_notifier(struct nf_exp_event_notifier *nb); | ||
| 170 | 170 | ||
| 171 | static inline void | 171 | static inline void |
| 172 | nf_ct_expect_event_report(enum ip_conntrack_expect_events event, | 172 | nf_ct_expect_event_report(enum ip_conntrack_expect_events event, |
| @@ -174,11 +174,12 @@ nf_ct_expect_event_report(enum ip_conntrack_expect_events event, | |||
| 174 | u32 pid, | 174 | u32 pid, |
| 175 | int report) | 175 | int report) |
| 176 | { | 176 | { |
| 177 | struct net *net = nf_ct_exp_net(exp); | ||
| 177 | struct nf_exp_event_notifier *notify; | 178 | struct nf_exp_event_notifier *notify; |
| 178 | struct nf_conntrack_ecache *e; | 179 | struct nf_conntrack_ecache *e; |
| 179 | 180 | ||
| 180 | rcu_read_lock(); | 181 | rcu_read_lock(); |
| 181 | notify = rcu_dereference(nf_expect_event_cb); | 182 | notify = rcu_dereference(net->ct.nf_expect_event_cb); |
| 182 | if (notify == NULL) | 183 | if (notify == NULL) |
| 183 | goto out_unlock; | 184 | goto out_unlock; |
| 184 | 185 | ||
diff --git a/include/net/netns/conntrack.h b/include/net/netns/conntrack.h index 0249399e51a7..7a911eca0f18 100644 --- a/include/net/netns/conntrack.h +++ b/include/net/netns/conntrack.h | |||
| @@ -18,6 +18,8 @@ struct netns_ct { | |||
| 18 | struct hlist_nulls_head unconfirmed; | 18 | struct hlist_nulls_head unconfirmed; |
| 19 | struct hlist_nulls_head dying; | 19 | struct hlist_nulls_head dying; |
| 20 | struct ip_conntrack_stat __percpu *stat; | 20 | struct ip_conntrack_stat __percpu *stat; |
| 21 | struct nf_ct_event_notifier __rcu *nf_conntrack_event_cb; | ||
| 22 | struct nf_exp_event_notifier __rcu *nf_expect_event_cb; | ||
| 21 | int sysctl_events; | 23 | int sysctl_events; |
| 22 | unsigned int sysctl_events_retry_timeout; | 24 | unsigned int sysctl_events_retry_timeout; |
| 23 | int sysctl_acct; | 25 | int sysctl_acct; |
diff --git a/include/net/red.h b/include/net/red.h index 3319f16b3beb..b72a3b833936 100644 --- a/include/net/red.h +++ b/include/net/red.h | |||
| @@ -116,7 +116,7 @@ struct red_parms { | |||
| 116 | u32 qR; /* Cached random number */ | 116 | u32 qR; /* Cached random number */ |
| 117 | 117 | ||
| 118 | unsigned long qavg; /* Average queue length: A scaled */ | 118 | unsigned long qavg; /* Average queue length: A scaled */ |
| 119 | psched_time_t qidlestart; /* Start of current idle period */ | 119 | ktime_t qidlestart; /* Start of current idle period */ |
| 120 | }; | 120 | }; |
| 121 | 121 | ||
| 122 | static inline u32 red_rmask(u8 Plog) | 122 | static inline u32 red_rmask(u8 Plog) |
| @@ -148,17 +148,17 @@ static inline void red_set_parms(struct red_parms *p, | |||
| 148 | 148 | ||
| 149 | static inline int red_is_idling(struct red_parms *p) | 149 | static inline int red_is_idling(struct red_parms *p) |
| 150 | { | 150 | { |
| 151 | return p->qidlestart != PSCHED_PASTPERFECT; | 151 | return p->qidlestart.tv64 != 0; |
| 152 | } | 152 | } |
| 153 | 153 | ||
| 154 | static inline void red_start_of_idle_period(struct red_parms *p) | 154 | static inline void red_start_of_idle_period(struct red_parms *p) |
| 155 | { | 155 | { |
| 156 | p->qidlestart = psched_get_time(); | 156 | p->qidlestart = ktime_get(); |
| 157 | } | 157 | } |
| 158 | 158 | ||
| 159 | static inline void red_end_of_idle_period(struct red_parms *p) | 159 | static inline void red_end_of_idle_period(struct red_parms *p) |
| 160 | { | 160 | { |
| 161 | p->qidlestart = PSCHED_PASTPERFECT; | 161 | p->qidlestart.tv64 = 0; |
| 162 | } | 162 | } |
| 163 | 163 | ||
| 164 | static inline void red_restart(struct red_parms *p) | 164 | static inline void red_restart(struct red_parms *p) |
| @@ -170,13 +170,10 @@ static inline void red_restart(struct red_parms *p) | |||
| 170 | 170 | ||
| 171 | static inline unsigned long red_calc_qavg_from_idle_time(struct red_parms *p) | 171 | static inline unsigned long red_calc_qavg_from_idle_time(struct red_parms *p) |
| 172 | { | 172 | { |
| 173 | psched_time_t now; | 173 | s64 delta = ktime_us_delta(ktime_get(), p->qidlestart); |
| 174 | long us_idle; | 174 | long us_idle = min_t(s64, delta, p->Scell_max); |
| 175 | int shift; | 175 | int shift; |
| 176 | 176 | ||
| 177 | now = psched_get_time(); | ||
| 178 | us_idle = psched_tdiff_bounded(now, p->qidlestart, p->Scell_max); | ||
| 179 | |||
| 180 | /* | 177 | /* |
| 181 | * The problem: ideally, average length queue recalcultion should | 178 | * The problem: ideally, average length queue recalcultion should |
| 182 | * be done over constant clock intervals. This is too expensive, so | 179 | * be done over constant clock intervals. This is too expensive, so |
diff --git a/include/net/route.h b/include/net/route.h index db7b3432f07c..91855d185b53 100644 --- a/include/net/route.h +++ b/include/net/route.h | |||
| @@ -71,12 +71,12 @@ struct rtable { | |||
| 71 | struct fib_info *fi; /* for client ref to shared metrics */ | 71 | struct fib_info *fi; /* for client ref to shared metrics */ |
| 72 | }; | 72 | }; |
| 73 | 73 | ||
| 74 | static inline bool rt_is_input_route(struct rtable *rt) | 74 | static inline bool rt_is_input_route(const struct rtable *rt) |
| 75 | { | 75 | { |
| 76 | return rt->rt_route_iif != 0; | 76 | return rt->rt_route_iif != 0; |
| 77 | } | 77 | } |
| 78 | 78 | ||
| 79 | static inline bool rt_is_output_route(struct rtable *rt) | 79 | static inline bool rt_is_output_route(const struct rtable *rt) |
| 80 | { | 80 | { |
| 81 | return rt->rt_route_iif == 0; | 81 | return rt->rt_route_iif == 0; |
| 82 | } | 82 | } |
diff --git a/include/video/omapdss.h b/include/video/omapdss.h index b66ebb2032c6..378c7ed6760b 100644 --- a/include/video/omapdss.h +++ b/include/video/omapdss.h | |||
| @@ -307,15 +307,8 @@ struct omap_dss_board_info { | |||
| 307 | void (*dsi_disable_pads)(int dsi_id, unsigned lane_mask); | 307 | void (*dsi_disable_pads)(int dsi_id, unsigned lane_mask); |
| 308 | }; | 308 | }; |
| 309 | 309 | ||
| 310 | #if defined(CONFIG_OMAP2_DSS_MODULE) || defined(CONFIG_OMAP2_DSS) | ||
| 311 | /* Init with the board info */ | 310 | /* Init with the board info */ |
| 312 | extern int omap_display_init(struct omap_dss_board_info *board_data); | 311 | extern int omap_display_init(struct omap_dss_board_info *board_data); |
| 313 | #else | ||
| 314 | static inline int omap_display_init(struct omap_dss_board_info *board_data) | ||
| 315 | { | ||
| 316 | return 0; | ||
| 317 | } | ||
| 318 | #endif | ||
| 319 | 312 | ||
| 320 | struct omap_display_platform_data { | 313 | struct omap_display_platform_data { |
| 321 | struct omap_dss_board_info *board_data; | 314 | struct omap_dss_board_info *board_data; |
diff --git a/kernel/cgroup_freezer.c b/kernel/cgroup_freezer.c index 5e828a2ca8e6..213c0351dad8 100644 --- a/kernel/cgroup_freezer.c +++ b/kernel/cgroup_freezer.c | |||
| @@ -153,6 +153,13 @@ static void freezer_destroy(struct cgroup_subsys *ss, | |||
| 153 | kfree(cgroup_freezer(cgroup)); | 153 | kfree(cgroup_freezer(cgroup)); |
| 154 | } | 154 | } |
| 155 | 155 | ||
| 156 | /* task is frozen or will freeze immediately when next it gets woken */ | ||
| 157 | static bool is_task_frozen_enough(struct task_struct *task) | ||
| 158 | { | ||
| 159 | return frozen(task) || | ||
| 160 | (task_is_stopped_or_traced(task) && freezing(task)); | ||
| 161 | } | ||
| 162 | |||
| 156 | /* | 163 | /* |
| 157 | * The call to cgroup_lock() in the freezer.state write method prevents | 164 | * The call to cgroup_lock() in the freezer.state write method prevents |
| 158 | * a write to that file racing against an attach, and hence the | 165 | * a write to that file racing against an attach, and hence the |
| @@ -231,7 +238,7 @@ static void update_if_frozen(struct cgroup *cgroup, | |||
| 231 | cgroup_iter_start(cgroup, &it); | 238 | cgroup_iter_start(cgroup, &it); |
| 232 | while ((task = cgroup_iter_next(cgroup, &it))) { | 239 | while ((task = cgroup_iter_next(cgroup, &it))) { |
| 233 | ntotal++; | 240 | ntotal++; |
| 234 | if (frozen(task)) | 241 | if (is_task_frozen_enough(task)) |
| 235 | nfrozen++; | 242 | nfrozen++; |
| 236 | } | 243 | } |
| 237 | 244 | ||
| @@ -284,7 +291,7 @@ static int try_to_freeze_cgroup(struct cgroup *cgroup, struct freezer *freezer) | |||
| 284 | while ((task = cgroup_iter_next(cgroup, &it))) { | 291 | while ((task = cgroup_iter_next(cgroup, &it))) { |
| 285 | if (!freeze_task(task, true)) | 292 | if (!freeze_task(task, true)) |
| 286 | continue; | 293 | continue; |
| 287 | if (frozen(task)) | 294 | if (is_task_frozen_enough(task)) |
| 288 | continue; | 295 | continue; |
| 289 | if (!freezing(task) && !freezer_should_skip(task)) | 296 | if (!freezing(task) && !freezer_should_skip(task)) |
| 290 | num_cant_freeze_now++; | 297 | num_cant_freeze_now++; |
diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c index 422e567eecf6..ae34bf51682b 100644 --- a/kernel/hrtimer.c +++ b/kernel/hrtimer.c | |||
| @@ -885,10 +885,13 @@ static void __remove_hrtimer(struct hrtimer *timer, | |||
| 885 | struct hrtimer_clock_base *base, | 885 | struct hrtimer_clock_base *base, |
| 886 | unsigned long newstate, int reprogram) | 886 | unsigned long newstate, int reprogram) |
| 887 | { | 887 | { |
| 888 | struct timerqueue_node *next_timer; | ||
| 888 | if (!(timer->state & HRTIMER_STATE_ENQUEUED)) | 889 | if (!(timer->state & HRTIMER_STATE_ENQUEUED)) |
| 889 | goto out; | 890 | goto out; |
| 890 | 891 | ||
| 891 | if (&timer->node == timerqueue_getnext(&base->active)) { | 892 | next_timer = timerqueue_getnext(&base->active); |
| 893 | timerqueue_del(&base->active, &timer->node); | ||
| 894 | if (&timer->node == next_timer) { | ||
| 892 | #ifdef CONFIG_HIGH_RES_TIMERS | 895 | #ifdef CONFIG_HIGH_RES_TIMERS |
| 893 | /* Reprogram the clock event device. if enabled */ | 896 | /* Reprogram the clock event device. if enabled */ |
| 894 | if (reprogram && hrtimer_hres_active()) { | 897 | if (reprogram && hrtimer_hres_active()) { |
| @@ -901,7 +904,6 @@ static void __remove_hrtimer(struct hrtimer *timer, | |||
| 901 | } | 904 | } |
| 902 | #endif | 905 | #endif |
| 903 | } | 906 | } |
| 904 | timerqueue_del(&base->active, &timer->node); | ||
| 905 | if (!timerqueue_getnext(&base->active)) | 907 | if (!timerqueue_getnext(&base->active)) |
| 906 | base->cpu_base->active_bases &= ~(1 << base->index); | 908 | base->cpu_base->active_bases &= ~(1 << base->index); |
| 907 | out: | 909 | out: |
diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c index 67ce837ae52c..0e2b179bc7b3 100644 --- a/kernel/irq/manage.c +++ b/kernel/irq/manage.c | |||
| @@ -1596,7 +1596,7 @@ int request_percpu_irq(unsigned int irq, irq_handler_t handler, | |||
| 1596 | return -ENOMEM; | 1596 | return -ENOMEM; |
| 1597 | 1597 | ||
| 1598 | action->handler = handler; | 1598 | action->handler = handler; |
| 1599 | action->flags = IRQF_PERCPU; | 1599 | action->flags = IRQF_PERCPU | IRQF_NO_SUSPEND; |
| 1600 | action->name = devname; | 1600 | action->name = devname; |
| 1601 | action->percpu_dev_id = dev_id; | 1601 | action->percpu_dev_id = dev_id; |
| 1602 | 1602 | ||
diff --git a/kernel/irq/spurious.c b/kernel/irq/spurious.c index b5f4742693c0..dc813a948be2 100644 --- a/kernel/irq/spurious.c +++ b/kernel/irq/spurious.c | |||
| @@ -84,7 +84,9 @@ static int try_one_irq(int irq, struct irq_desc *desc, bool force) | |||
| 84 | */ | 84 | */ |
| 85 | action = desc->action; | 85 | action = desc->action; |
| 86 | if (!action || !(action->flags & IRQF_SHARED) || | 86 | if (!action || !(action->flags & IRQF_SHARED) || |
| 87 | (action->flags & __IRQF_TIMER) || !action->next) | 87 | (action->flags & __IRQF_TIMER) || |
| 88 | (action->handler(irq, action->dev_id) == IRQ_HANDLED) || | ||
| 89 | !action->next) | ||
| 88 | goto out; | 90 | goto out; |
| 89 | 91 | ||
| 90 | /* Already running on another processor */ | 92 | /* Already running on another processor */ |
diff --git a/kernel/power/hibernate.c b/kernel/power/hibernate.c index 196c01268ebd..a6b0503574ee 100644 --- a/kernel/power/hibernate.c +++ b/kernel/power/hibernate.c | |||
| @@ -347,7 +347,7 @@ int hibernation_snapshot(int platform_mode) | |||
| 347 | 347 | ||
| 348 | error = freeze_kernel_threads(); | 348 | error = freeze_kernel_threads(); |
| 349 | if (error) | 349 | if (error) |
| 350 | goto Close; | 350 | goto Cleanup; |
| 351 | 351 | ||
| 352 | if (hibernation_test(TEST_FREEZER) || | 352 | if (hibernation_test(TEST_FREEZER) || |
| 353 | hibernation_testmode(HIBERNATION_TESTPROC)) { | 353 | hibernation_testmode(HIBERNATION_TESTPROC)) { |
| @@ -357,12 +357,14 @@ int hibernation_snapshot(int platform_mode) | |||
| 357 | * successful freezer test. | 357 | * successful freezer test. |
| 358 | */ | 358 | */ |
| 359 | freezer_test_done = true; | 359 | freezer_test_done = true; |
| 360 | goto Close; | 360 | goto Cleanup; |
| 361 | } | 361 | } |
| 362 | 362 | ||
| 363 | error = dpm_prepare(PMSG_FREEZE); | 363 | error = dpm_prepare(PMSG_FREEZE); |
| 364 | if (error) | 364 | if (error) { |
| 365 | goto Complete_devices; | 365 | dpm_complete(msg); |
| 366 | goto Cleanup; | ||
| 367 | } | ||
| 366 | 368 | ||
| 367 | suspend_console(); | 369 | suspend_console(); |
| 368 | pm_restrict_gfp_mask(); | 370 | pm_restrict_gfp_mask(); |
| @@ -391,8 +393,6 @@ int hibernation_snapshot(int platform_mode) | |||
| 391 | pm_restore_gfp_mask(); | 393 | pm_restore_gfp_mask(); |
| 392 | 394 | ||
| 393 | resume_console(); | 395 | resume_console(); |
| 394 | |||
| 395 | Complete_devices: | ||
| 396 | dpm_complete(msg); | 396 | dpm_complete(msg); |
| 397 | 397 | ||
| 398 | Close: | 398 | Close: |
| @@ -402,6 +402,10 @@ int hibernation_snapshot(int platform_mode) | |||
| 402 | Recover_platform: | 402 | Recover_platform: |
| 403 | platform_recover(platform_mode); | 403 | platform_recover(platform_mode); |
| 404 | goto Resume_devices; | 404 | goto Resume_devices; |
| 405 | |||
| 406 | Cleanup: | ||
| 407 | swsusp_free(); | ||
| 408 | goto Close; | ||
| 405 | } | 409 | } |
| 406 | 410 | ||
| 407 | /** | 411 | /** |
diff --git a/kernel/time/clocksource.c b/kernel/time/clocksource.c index cf52fda2e096..cfc65e1eb9fb 100644 --- a/kernel/time/clocksource.c +++ b/kernel/time/clocksource.c | |||
| @@ -492,6 +492,22 @@ void clocksource_touch_watchdog(void) | |||
| 492 | } | 492 | } |
| 493 | 493 | ||
| 494 | /** | 494 | /** |
| 495 | * clocksource_max_adjustment- Returns max adjustment amount | ||
| 496 | * @cs: Pointer to clocksource | ||
| 497 | * | ||
| 498 | */ | ||
| 499 | static u32 clocksource_max_adjustment(struct clocksource *cs) | ||
| 500 | { | ||
| 501 | u64 ret; | ||
| 502 | /* | ||
| 503 | * We won't try to correct for more then 11% adjustments (110,000 ppm), | ||
| 504 | */ | ||
| 505 | ret = (u64)cs->mult * 11; | ||
| 506 | do_div(ret,100); | ||
| 507 | return (u32)ret; | ||
| 508 | } | ||
| 509 | |||
| 510 | /** | ||
| 495 | * clocksource_max_deferment - Returns max time the clocksource can be deferred | 511 | * clocksource_max_deferment - Returns max time the clocksource can be deferred |
| 496 | * @cs: Pointer to clocksource | 512 | * @cs: Pointer to clocksource |
| 497 | * | 513 | * |
| @@ -503,25 +519,28 @@ static u64 clocksource_max_deferment(struct clocksource *cs) | |||
| 503 | /* | 519 | /* |
| 504 | * Calculate the maximum number of cycles that we can pass to the | 520 | * Calculate the maximum number of cycles that we can pass to the |
| 505 | * cyc2ns function without overflowing a 64-bit signed result. The | 521 | * cyc2ns function without overflowing a 64-bit signed result. The |
| 506 | * maximum number of cycles is equal to ULLONG_MAX/cs->mult which | 522 | * maximum number of cycles is equal to ULLONG_MAX/(cs->mult+cs->maxadj) |
| 507 | * is equivalent to the below. | 523 | * which is equivalent to the below. |
| 508 | * max_cycles < (2^63)/cs->mult | 524 | * max_cycles < (2^63)/(cs->mult + cs->maxadj) |
| 509 | * max_cycles < 2^(log2((2^63)/cs->mult)) | 525 | * max_cycles < 2^(log2((2^63)/(cs->mult + cs->maxadj))) |
| 510 | * max_cycles < 2^(log2(2^63) - log2(cs->mult)) | 526 | * max_cycles < 2^(log2(2^63) - log2(cs->mult + cs->maxadj)) |
| 511 | * max_cycles < 2^(63 - log2(cs->mult)) | 527 | * max_cycles < 2^(63 - log2(cs->mult + cs->maxadj)) |
| 512 | * max_cycles < 1 << (63 - log2(cs->mult)) | 528 | * max_cycles < 1 << (63 - log2(cs->mult + cs->maxadj)) |
| 513 | * Please note that we add 1 to the result of the log2 to account for | 529 | * Please note that we add 1 to the result of the log2 to account for |
| 514 | * any rounding errors, ensure the above inequality is satisfied and | 530 | * any rounding errors, ensure the above inequality is satisfied and |
| 515 | * no overflow will occur. | 531 | * no overflow will occur. |
| 516 | */ | 532 | */ |
| 517 | max_cycles = 1ULL << (63 - (ilog2(cs->mult) + 1)); | 533 | max_cycles = 1ULL << (63 - (ilog2(cs->mult + cs->maxadj) + 1)); |
| 518 | 534 | ||
| 519 | /* | 535 | /* |
| 520 | * The actual maximum number of cycles we can defer the clocksource is | 536 | * The actual maximum number of cycles we can defer the clocksource is |
| 521 | * determined by the minimum of max_cycles and cs->mask. | 537 | * determined by the minimum of max_cycles and cs->mask. |
| 538 | * Note: Here we subtract the maxadj to make sure we don't sleep for | ||
| 539 | * too long if there's a large negative adjustment. | ||
| 522 | */ | 540 | */ |
| 523 | max_cycles = min_t(u64, max_cycles, (u64) cs->mask); | 541 | max_cycles = min_t(u64, max_cycles, (u64) cs->mask); |
| 524 | max_nsecs = clocksource_cyc2ns(max_cycles, cs->mult, cs->shift); | 542 | max_nsecs = clocksource_cyc2ns(max_cycles, cs->mult - cs->maxadj, |
| 543 | cs->shift); | ||
| 525 | 544 | ||
| 526 | /* | 545 | /* |
| 527 | * To ensure that the clocksource does not wrap whilst we are idle, | 546 | * To ensure that the clocksource does not wrap whilst we are idle, |
| @@ -640,7 +659,6 @@ static void clocksource_enqueue(struct clocksource *cs) | |||
| 640 | void __clocksource_updatefreq_scale(struct clocksource *cs, u32 scale, u32 freq) | 659 | void __clocksource_updatefreq_scale(struct clocksource *cs, u32 scale, u32 freq) |
| 641 | { | 660 | { |
| 642 | u64 sec; | 661 | u64 sec; |
| 643 | |||
| 644 | /* | 662 | /* |
| 645 | * Calc the maximum number of seconds which we can run before | 663 | * Calc the maximum number of seconds which we can run before |
| 646 | * wrapping around. For clocksources which have a mask > 32bit | 664 | * wrapping around. For clocksources which have a mask > 32bit |
| @@ -661,6 +679,20 @@ void __clocksource_updatefreq_scale(struct clocksource *cs, u32 scale, u32 freq) | |||
| 661 | 679 | ||
| 662 | clocks_calc_mult_shift(&cs->mult, &cs->shift, freq, | 680 | clocks_calc_mult_shift(&cs->mult, &cs->shift, freq, |
| 663 | NSEC_PER_SEC / scale, sec * scale); | 681 | NSEC_PER_SEC / scale, sec * scale); |
| 682 | |||
| 683 | /* | ||
| 684 | * for clocksources that have large mults, to avoid overflow. | ||
| 685 | * Since mult may be adjusted by ntp, add an safety extra margin | ||
| 686 | * | ||
| 687 | */ | ||
| 688 | cs->maxadj = clocksource_max_adjustment(cs); | ||
| 689 | while ((cs->mult + cs->maxadj < cs->mult) | ||
| 690 | || (cs->mult - cs->maxadj > cs->mult)) { | ||
| 691 | cs->mult >>= 1; | ||
| 692 | cs->shift--; | ||
| 693 | cs->maxadj = clocksource_max_adjustment(cs); | ||
| 694 | } | ||
| 695 | |||
| 664 | cs->max_idle_ns = clocksource_max_deferment(cs); | 696 | cs->max_idle_ns = clocksource_max_deferment(cs); |
| 665 | } | 697 | } |
| 666 | EXPORT_SYMBOL_GPL(__clocksource_updatefreq_scale); | 698 | EXPORT_SYMBOL_GPL(__clocksource_updatefreq_scale); |
| @@ -701,6 +733,12 @@ EXPORT_SYMBOL_GPL(__clocksource_register_scale); | |||
| 701 | */ | 733 | */ |
| 702 | int clocksource_register(struct clocksource *cs) | 734 | int clocksource_register(struct clocksource *cs) |
| 703 | { | 735 | { |
| 736 | /* calculate max adjustment for given mult/shift */ | ||
| 737 | cs->maxadj = clocksource_max_adjustment(cs); | ||
| 738 | WARN_ONCE(cs->mult + cs->maxadj < cs->mult, | ||
| 739 | "Clocksource %s might overflow on 11%% adjustment\n", | ||
| 740 | cs->name); | ||
| 741 | |||
| 704 | /* calculate max idle time permitted for this clocksource */ | 742 | /* calculate max idle time permitted for this clocksource */ |
| 705 | cs->max_idle_ns = clocksource_max_deferment(cs); | 743 | cs->max_idle_ns = clocksource_max_deferment(cs); |
| 706 | 744 | ||
diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c index 2b021b0e8507..237841378c03 100644 --- a/kernel/time/timekeeping.c +++ b/kernel/time/timekeeping.c | |||
| @@ -249,6 +249,8 @@ ktime_t ktime_get(void) | |||
| 249 | secs = xtime.tv_sec + wall_to_monotonic.tv_sec; | 249 | secs = xtime.tv_sec + wall_to_monotonic.tv_sec; |
| 250 | nsecs = xtime.tv_nsec + wall_to_monotonic.tv_nsec; | 250 | nsecs = xtime.tv_nsec + wall_to_monotonic.tv_nsec; |
| 251 | nsecs += timekeeping_get_ns(); | 251 | nsecs += timekeeping_get_ns(); |
| 252 | /* If arch requires, add in gettimeoffset() */ | ||
| 253 | nsecs += arch_gettimeoffset(); | ||
| 252 | 254 | ||
| 253 | } while (read_seqretry(&xtime_lock, seq)); | 255 | } while (read_seqretry(&xtime_lock, seq)); |
| 254 | /* | 256 | /* |
| @@ -280,6 +282,8 @@ void ktime_get_ts(struct timespec *ts) | |||
| 280 | *ts = xtime; | 282 | *ts = xtime; |
| 281 | tomono = wall_to_monotonic; | 283 | tomono = wall_to_monotonic; |
| 282 | nsecs = timekeeping_get_ns(); | 284 | nsecs = timekeeping_get_ns(); |
| 285 | /* If arch requires, add in gettimeoffset() */ | ||
| 286 | nsecs += arch_gettimeoffset(); | ||
| 283 | 287 | ||
| 284 | } while (read_seqretry(&xtime_lock, seq)); | 288 | } while (read_seqretry(&xtime_lock, seq)); |
| 285 | 289 | ||
| @@ -802,14 +806,44 @@ static void timekeeping_adjust(s64 offset) | |||
| 802 | s64 error, interval = timekeeper.cycle_interval; | 806 | s64 error, interval = timekeeper.cycle_interval; |
| 803 | int adj; | 807 | int adj; |
| 804 | 808 | ||
| 809 | /* | ||
| 810 | * The point of this is to check if the error is greater then half | ||
| 811 | * an interval. | ||
| 812 | * | ||
| 813 | * First we shift it down from NTP_SHIFT to clocksource->shifted nsecs. | ||
| 814 | * | ||
| 815 | * Note we subtract one in the shift, so that error is really error*2. | ||
| 816 | * This "saves" dividing(shifting) intererval twice, but keeps the | ||
| 817 | * (error > interval) comparision as still measuring if error is | ||
| 818 | * larger then half an interval. | ||
| 819 | * | ||
| 820 | * Note: It does not "save" on aggrivation when reading the code. | ||
| 821 | */ | ||
| 805 | error = timekeeper.ntp_error >> (timekeeper.ntp_error_shift - 1); | 822 | error = timekeeper.ntp_error >> (timekeeper.ntp_error_shift - 1); |
| 806 | if (error > interval) { | 823 | if (error > interval) { |
| 824 | /* | ||
| 825 | * We now divide error by 4(via shift), which checks if | ||
| 826 | * the error is greater then twice the interval. | ||
| 827 | * If it is greater, we need a bigadjust, if its smaller, | ||
| 828 | * we can adjust by 1. | ||
| 829 | */ | ||
| 807 | error >>= 2; | 830 | error >>= 2; |
| 831 | /* | ||
| 832 | * XXX - In update_wall_time, we round up to the next | ||
| 833 | * nanosecond, and store the amount rounded up into | ||
| 834 | * the error. This causes the likely below to be unlikely. | ||
| 835 | * | ||
| 836 | * The properfix is to avoid rounding up by using | ||
| 837 | * the high precision timekeeper.xtime_nsec instead of | ||
| 838 | * xtime.tv_nsec everywhere. Fixing this will take some | ||
| 839 | * time. | ||
| 840 | */ | ||
| 808 | if (likely(error <= interval)) | 841 | if (likely(error <= interval)) |
| 809 | adj = 1; | 842 | adj = 1; |
| 810 | else | 843 | else |
| 811 | adj = timekeeping_bigadjust(error, &interval, &offset); | 844 | adj = timekeeping_bigadjust(error, &interval, &offset); |
| 812 | } else if (error < -interval) { | 845 | } else if (error < -interval) { |
| 846 | /* See comment above, this is just switched for the negative */ | ||
| 813 | error >>= 2; | 847 | error >>= 2; |
| 814 | if (likely(error >= -interval)) { | 848 | if (likely(error >= -interval)) { |
| 815 | adj = -1; | 849 | adj = -1; |
| @@ -817,9 +851,65 @@ static void timekeeping_adjust(s64 offset) | |||
| 817 | offset = -offset; | 851 | offset = -offset; |
| 818 | } else | 852 | } else |
| 819 | adj = timekeeping_bigadjust(error, &interval, &offset); | 853 | adj = timekeeping_bigadjust(error, &interval, &offset); |
| 820 | } else | 854 | } else /* No adjustment needed */ |
| 821 | return; | 855 | return; |
| 822 | 856 | ||
| 857 | WARN_ONCE(timekeeper.clock->maxadj && | ||
| 858 | (timekeeper.mult + adj > timekeeper.clock->mult + | ||
| 859 | timekeeper.clock->maxadj), | ||
| 860 | "Adjusting %s more then 11%% (%ld vs %ld)\n", | ||
| 861 | timekeeper.clock->name, (long)timekeeper.mult + adj, | ||
| 862 | (long)timekeeper.clock->mult + | ||
| 863 | timekeeper.clock->maxadj); | ||
| 864 | /* | ||
| 865 | * So the following can be confusing. | ||
| 866 | * | ||
| 867 | * To keep things simple, lets assume adj == 1 for now. | ||
| 868 | * | ||
| 869 | * When adj != 1, remember that the interval and offset values | ||
| 870 | * have been appropriately scaled so the math is the same. | ||
| 871 | * | ||
| 872 | * The basic idea here is that we're increasing the multiplier | ||
| 873 | * by one, this causes the xtime_interval to be incremented by | ||
| 874 | * one cycle_interval. This is because: | ||
| 875 | * xtime_interval = cycle_interval * mult | ||
| 876 | * So if mult is being incremented by one: | ||
| 877 | * xtime_interval = cycle_interval * (mult + 1) | ||
| 878 | * Its the same as: | ||
| 879 | * xtime_interval = (cycle_interval * mult) + cycle_interval | ||
| 880 | * Which can be shortened to: | ||
| 881 | * xtime_interval += cycle_interval | ||
| 882 | * | ||
| 883 | * So offset stores the non-accumulated cycles. Thus the current | ||
| 884 | * time (in shifted nanoseconds) is: | ||
| 885 | * now = (offset * adj) + xtime_nsec | ||
| 886 | * Now, even though we're adjusting the clock frequency, we have | ||
| 887 | * to keep time consistent. In other words, we can't jump back | ||
| 888 | * in time, and we also want to avoid jumping forward in time. | ||
| 889 | * | ||
| 890 | * So given the same offset value, we need the time to be the same | ||
| 891 | * both before and after the freq adjustment. | ||
| 892 | * now = (offset * adj_1) + xtime_nsec_1 | ||
| 893 | * now = (offset * adj_2) + xtime_nsec_2 | ||
| 894 | * So: | ||
| 895 | * (offset * adj_1) + xtime_nsec_1 = | ||
| 896 | * (offset * adj_2) + xtime_nsec_2 | ||
| 897 | * And we know: | ||
| 898 | * adj_2 = adj_1 + 1 | ||
| 899 | * So: | ||
| 900 | * (offset * adj_1) + xtime_nsec_1 = | ||
| 901 | * (offset * (adj_1+1)) + xtime_nsec_2 | ||
| 902 | * (offset * adj_1) + xtime_nsec_1 = | ||
| 903 | * (offset * adj_1) + offset + xtime_nsec_2 | ||
| 904 | * Canceling the sides: | ||
| 905 | * xtime_nsec_1 = offset + xtime_nsec_2 | ||
| 906 | * Which gives us: | ||
| 907 | * xtime_nsec_2 = xtime_nsec_1 - offset | ||
| 908 | * Which simplfies to: | ||
| 909 | * xtime_nsec -= offset | ||
| 910 | * | ||
| 911 | * XXX - TODO: Doc ntp_error calculation. | ||
| 912 | */ | ||
| 823 | timekeeper.mult += adj; | 913 | timekeeper.mult += adj; |
| 824 | timekeeper.xtime_interval += interval; | 914 | timekeeper.xtime_interval += interval; |
| 825 | timekeeper.xtime_nsec -= offset; | 915 | timekeeper.xtime_nsec -= offset; |
diff --git a/mm/percpu-vm.c b/mm/percpu-vm.c index ea534960a04b..12a48a88c0d8 100644 --- a/mm/percpu-vm.c +++ b/mm/percpu-vm.c | |||
| @@ -50,14 +50,13 @@ static struct page **pcpu_get_pages_and_bitmap(struct pcpu_chunk *chunk, | |||
| 50 | 50 | ||
| 51 | if (!pages || !bitmap) { | 51 | if (!pages || !bitmap) { |
| 52 | if (may_alloc && !pages) | 52 | if (may_alloc && !pages) |
| 53 | pages = pcpu_mem_alloc(pages_size); | 53 | pages = pcpu_mem_zalloc(pages_size); |
| 54 | if (may_alloc && !bitmap) | 54 | if (may_alloc && !bitmap) |
| 55 | bitmap = pcpu_mem_alloc(bitmap_size); | 55 | bitmap = pcpu_mem_zalloc(bitmap_size); |
| 56 | if (!pages || !bitmap) | 56 | if (!pages || !bitmap) |
| 57 | return NULL; | 57 | return NULL; |
| 58 | } | 58 | } |
| 59 | 59 | ||
| 60 | memset(pages, 0, pages_size); | ||
| 61 | bitmap_copy(bitmap, chunk->populated, pcpu_unit_pages); | 60 | bitmap_copy(bitmap, chunk->populated, pcpu_unit_pages); |
| 62 | 61 | ||
| 63 | *bitmapp = bitmap; | 62 | *bitmapp = bitmap; |
| @@ -143,8 +142,8 @@ static void pcpu_pre_unmap_flush(struct pcpu_chunk *chunk, | |||
| 143 | int page_start, int page_end) | 142 | int page_start, int page_end) |
| 144 | { | 143 | { |
| 145 | flush_cache_vunmap( | 144 | flush_cache_vunmap( |
| 146 | pcpu_chunk_addr(chunk, pcpu_first_unit_cpu, page_start), | 145 | pcpu_chunk_addr(chunk, pcpu_low_unit_cpu, page_start), |
| 147 | pcpu_chunk_addr(chunk, pcpu_last_unit_cpu, page_end)); | 146 | pcpu_chunk_addr(chunk, pcpu_high_unit_cpu, page_end)); |
| 148 | } | 147 | } |
| 149 | 148 | ||
| 150 | static void __pcpu_unmap_pages(unsigned long addr, int nr_pages) | 149 | static void __pcpu_unmap_pages(unsigned long addr, int nr_pages) |
| @@ -206,8 +205,8 @@ static void pcpu_post_unmap_tlb_flush(struct pcpu_chunk *chunk, | |||
| 206 | int page_start, int page_end) | 205 | int page_start, int page_end) |
| 207 | { | 206 | { |
| 208 | flush_tlb_kernel_range( | 207 | flush_tlb_kernel_range( |
| 209 | pcpu_chunk_addr(chunk, pcpu_first_unit_cpu, page_start), | 208 | pcpu_chunk_addr(chunk, pcpu_low_unit_cpu, page_start), |
| 210 | pcpu_chunk_addr(chunk, pcpu_last_unit_cpu, page_end)); | 209 | pcpu_chunk_addr(chunk, pcpu_high_unit_cpu, page_end)); |
| 211 | } | 210 | } |
| 212 | 211 | ||
| 213 | static int __pcpu_map_pages(unsigned long addr, struct page **pages, | 212 | static int __pcpu_map_pages(unsigned long addr, struct page **pages, |
| @@ -284,8 +283,8 @@ static void pcpu_post_map_flush(struct pcpu_chunk *chunk, | |||
| 284 | int page_start, int page_end) | 283 | int page_start, int page_end) |
| 285 | { | 284 | { |
| 286 | flush_cache_vmap( | 285 | flush_cache_vmap( |
| 287 | pcpu_chunk_addr(chunk, pcpu_first_unit_cpu, page_start), | 286 | pcpu_chunk_addr(chunk, pcpu_low_unit_cpu, page_start), |
| 288 | pcpu_chunk_addr(chunk, pcpu_last_unit_cpu, page_end)); | 287 | pcpu_chunk_addr(chunk, pcpu_high_unit_cpu, page_end)); |
| 289 | } | 288 | } |
| 290 | 289 | ||
| 291 | /** | 290 | /** |
diff --git a/mm/percpu.c b/mm/percpu.c index bf80e55dbed7..3bb810a72006 100644 --- a/mm/percpu.c +++ b/mm/percpu.c | |||
| @@ -116,9 +116,9 @@ static int pcpu_atom_size __read_mostly; | |||
| 116 | static int pcpu_nr_slots __read_mostly; | 116 | static int pcpu_nr_slots __read_mostly; |
| 117 | static size_t pcpu_chunk_struct_size __read_mostly; | 117 | static size_t pcpu_chunk_struct_size __read_mostly; |
| 118 | 118 | ||
| 119 | /* cpus with the lowest and highest unit numbers */ | 119 | /* cpus with the lowest and highest unit addresses */ |
| 120 | static unsigned int pcpu_first_unit_cpu __read_mostly; | 120 | static unsigned int pcpu_low_unit_cpu __read_mostly; |
| 121 | static unsigned int pcpu_last_unit_cpu __read_mostly; | 121 | static unsigned int pcpu_high_unit_cpu __read_mostly; |
| 122 | 122 | ||
| 123 | /* the address of the first chunk which starts with the kernel static area */ | 123 | /* the address of the first chunk which starts with the kernel static area */ |
| 124 | void *pcpu_base_addr __read_mostly; | 124 | void *pcpu_base_addr __read_mostly; |
| @@ -273,11 +273,11 @@ static void __maybe_unused pcpu_next_pop(struct pcpu_chunk *chunk, | |||
| 273 | (rs) = (re) + 1, pcpu_next_pop((chunk), &(rs), &(re), (end))) | 273 | (rs) = (re) + 1, pcpu_next_pop((chunk), &(rs), &(re), (end))) |
| 274 | 274 | ||
| 275 | /** | 275 | /** |
| 276 | * pcpu_mem_alloc - allocate memory | 276 | * pcpu_mem_zalloc - allocate memory |
| 277 | * @size: bytes to allocate | 277 | * @size: bytes to allocate |
| 278 | * | 278 | * |
| 279 | * Allocate @size bytes. If @size is smaller than PAGE_SIZE, | 279 | * Allocate @size bytes. If @size is smaller than PAGE_SIZE, |
| 280 | * kzalloc() is used; otherwise, vmalloc() is used. The returned | 280 | * kzalloc() is used; otherwise, vzalloc() is used. The returned |
| 281 | * memory is always zeroed. | 281 | * memory is always zeroed. |
| 282 | * | 282 | * |
| 283 | * CONTEXT: | 283 | * CONTEXT: |
| @@ -286,7 +286,7 @@ static void __maybe_unused pcpu_next_pop(struct pcpu_chunk *chunk, | |||
| 286 | * RETURNS: | 286 | * RETURNS: |
| 287 | * Pointer to the allocated area on success, NULL on failure. | 287 | * Pointer to the allocated area on success, NULL on failure. |
| 288 | */ | 288 | */ |
| 289 | static void *pcpu_mem_alloc(size_t size) | 289 | static void *pcpu_mem_zalloc(size_t size) |
| 290 | { | 290 | { |
| 291 | if (WARN_ON_ONCE(!slab_is_available())) | 291 | if (WARN_ON_ONCE(!slab_is_available())) |
| 292 | return NULL; | 292 | return NULL; |
| @@ -302,7 +302,7 @@ static void *pcpu_mem_alloc(size_t size) | |||
| 302 | * @ptr: memory to free | 302 | * @ptr: memory to free |
| 303 | * @size: size of the area | 303 | * @size: size of the area |
| 304 | * | 304 | * |
| 305 | * Free @ptr. @ptr should have been allocated using pcpu_mem_alloc(). | 305 | * Free @ptr. @ptr should have been allocated using pcpu_mem_zalloc(). |
| 306 | */ | 306 | */ |
| 307 | static void pcpu_mem_free(void *ptr, size_t size) | 307 | static void pcpu_mem_free(void *ptr, size_t size) |
| 308 | { | 308 | { |
| @@ -384,7 +384,7 @@ static int pcpu_extend_area_map(struct pcpu_chunk *chunk, int new_alloc) | |||
| 384 | size_t old_size = 0, new_size = new_alloc * sizeof(new[0]); | 384 | size_t old_size = 0, new_size = new_alloc * sizeof(new[0]); |
| 385 | unsigned long flags; | 385 | unsigned long flags; |
| 386 | 386 | ||
| 387 | new = pcpu_mem_alloc(new_size); | 387 | new = pcpu_mem_zalloc(new_size); |
| 388 | if (!new) | 388 | if (!new) |
| 389 | return -ENOMEM; | 389 | return -ENOMEM; |
| 390 | 390 | ||
| @@ -604,11 +604,12 @@ static struct pcpu_chunk *pcpu_alloc_chunk(void) | |||
| 604 | { | 604 | { |
| 605 | struct pcpu_chunk *chunk; | 605 | struct pcpu_chunk *chunk; |
| 606 | 606 | ||
| 607 | chunk = pcpu_mem_alloc(pcpu_chunk_struct_size); | 607 | chunk = pcpu_mem_zalloc(pcpu_chunk_struct_size); |
| 608 | if (!chunk) | 608 | if (!chunk) |
| 609 | return NULL; | 609 | return NULL; |
| 610 | 610 | ||
| 611 | chunk->map = pcpu_mem_alloc(PCPU_DFL_MAP_ALLOC * sizeof(chunk->map[0])); | 611 | chunk->map = pcpu_mem_zalloc(PCPU_DFL_MAP_ALLOC * |
| 612 | sizeof(chunk->map[0])); | ||
| 612 | if (!chunk->map) { | 613 | if (!chunk->map) { |
| 613 | kfree(chunk); | 614 | kfree(chunk); |
| 614 | return NULL; | 615 | return NULL; |
| @@ -977,6 +978,17 @@ bool is_kernel_percpu_address(unsigned long addr) | |||
| 977 | * address. The caller is responsible for ensuring @addr stays valid | 978 | * address. The caller is responsible for ensuring @addr stays valid |
| 978 | * until this function finishes. | 979 | * until this function finishes. |
| 979 | * | 980 | * |
| 981 | * percpu allocator has special setup for the first chunk, which currently | ||
| 982 | * supports either embedding in linear address space or vmalloc mapping, | ||
| 983 | * and, from the second one, the backing allocator (currently either vm or | ||
| 984 | * km) provides translation. | ||
| 985 | * | ||
| 986 | * The addr can be tranlated simply without checking if it falls into the | ||
| 987 | * first chunk. But the current code reflects better how percpu allocator | ||
| 988 | * actually works, and the verification can discover both bugs in percpu | ||
| 989 | * allocator itself and per_cpu_ptr_to_phys() callers. So we keep current | ||
| 990 | * code. | ||
| 991 | * | ||
| 980 | * RETURNS: | 992 | * RETURNS: |
| 981 | * The physical address for @addr. | 993 | * The physical address for @addr. |
| 982 | */ | 994 | */ |
| @@ -984,19 +996,19 @@ phys_addr_t per_cpu_ptr_to_phys(void *addr) | |||
| 984 | { | 996 | { |
| 985 | void __percpu *base = __addr_to_pcpu_ptr(pcpu_base_addr); | 997 | void __percpu *base = __addr_to_pcpu_ptr(pcpu_base_addr); |
| 986 | bool in_first_chunk = false; | 998 | bool in_first_chunk = false; |
| 987 | unsigned long first_start, first_end; | 999 | unsigned long first_low, first_high; |
| 988 | unsigned int cpu; | 1000 | unsigned int cpu; |
| 989 | 1001 | ||
| 990 | /* | 1002 | /* |
| 991 | * The following test on first_start/end isn't strictly | 1003 | * The following test on unit_low/high isn't strictly |
| 992 | * necessary but will speed up lookups of addresses which | 1004 | * necessary but will speed up lookups of addresses which |
| 993 | * aren't in the first chunk. | 1005 | * aren't in the first chunk. |
| 994 | */ | 1006 | */ |
| 995 | first_start = pcpu_chunk_addr(pcpu_first_chunk, pcpu_first_unit_cpu, 0); | 1007 | first_low = pcpu_chunk_addr(pcpu_first_chunk, pcpu_low_unit_cpu, 0); |
| 996 | first_end = pcpu_chunk_addr(pcpu_first_chunk, pcpu_last_unit_cpu, | 1008 | first_high = pcpu_chunk_addr(pcpu_first_chunk, pcpu_high_unit_cpu, |
| 997 | pcpu_unit_pages); | 1009 | pcpu_unit_pages); |
| 998 | if ((unsigned long)addr >= first_start && | 1010 | if ((unsigned long)addr >= first_low && |
| 999 | (unsigned long)addr < first_end) { | 1011 | (unsigned long)addr < first_high) { |
| 1000 | for_each_possible_cpu(cpu) { | 1012 | for_each_possible_cpu(cpu) { |
| 1001 | void *start = per_cpu_ptr(base, cpu); | 1013 | void *start = per_cpu_ptr(base, cpu); |
| 1002 | 1014 | ||
| @@ -1233,7 +1245,9 @@ int __init pcpu_setup_first_chunk(const struct pcpu_alloc_info *ai, | |||
| 1233 | 1245 | ||
| 1234 | for (cpu = 0; cpu < nr_cpu_ids; cpu++) | 1246 | for (cpu = 0; cpu < nr_cpu_ids; cpu++) |
| 1235 | unit_map[cpu] = UINT_MAX; | 1247 | unit_map[cpu] = UINT_MAX; |
| 1236 | pcpu_first_unit_cpu = NR_CPUS; | 1248 | |
| 1249 | pcpu_low_unit_cpu = NR_CPUS; | ||
| 1250 | pcpu_high_unit_cpu = NR_CPUS; | ||
| 1237 | 1251 | ||
| 1238 | for (group = 0, unit = 0; group < ai->nr_groups; group++, unit += i) { | 1252 | for (group = 0, unit = 0; group < ai->nr_groups; group++, unit += i) { |
| 1239 | const struct pcpu_group_info *gi = &ai->groups[group]; | 1253 | const struct pcpu_group_info *gi = &ai->groups[group]; |
| @@ -1253,9 +1267,13 @@ int __init pcpu_setup_first_chunk(const struct pcpu_alloc_info *ai, | |||
| 1253 | unit_map[cpu] = unit + i; | 1267 | unit_map[cpu] = unit + i; |
| 1254 | unit_off[cpu] = gi->base_offset + i * ai->unit_size; | 1268 | unit_off[cpu] = gi->base_offset + i * ai->unit_size; |
| 1255 | 1269 | ||
| 1256 | if (pcpu_first_unit_cpu == NR_CPUS) | 1270 | /* determine low/high unit_cpu */ |
| 1257 | pcpu_first_unit_cpu = cpu; | 1271 | if (pcpu_low_unit_cpu == NR_CPUS || |
| 1258 | pcpu_last_unit_cpu = cpu; | 1272 | unit_off[cpu] < unit_off[pcpu_low_unit_cpu]) |
| 1273 | pcpu_low_unit_cpu = cpu; | ||
| 1274 | if (pcpu_high_unit_cpu == NR_CPUS || | ||
| 1275 | unit_off[cpu] > unit_off[pcpu_high_unit_cpu]) | ||
| 1276 | pcpu_high_unit_cpu = cpu; | ||
| 1259 | } | 1277 | } |
| 1260 | } | 1278 | } |
| 1261 | pcpu_nr_units = unit; | 1279 | pcpu_nr_units = unit; |
| @@ -1889,7 +1907,7 @@ void __init percpu_init_late(void) | |||
| 1889 | 1907 | ||
| 1890 | BUILD_BUG_ON(size > PAGE_SIZE); | 1908 | BUILD_BUG_ON(size > PAGE_SIZE); |
| 1891 | 1909 | ||
| 1892 | map = pcpu_mem_alloc(size); | 1910 | map = pcpu_mem_zalloc(size); |
| 1893 | BUG_ON(!map); | 1911 | BUG_ON(!map); |
| 1894 | 1912 | ||
| 1895 | spin_lock_irqsave(&pcpu_lock, flags); | 1913 | spin_lock_irqsave(&pcpu_lock, flags); |
| @@ -1862,7 +1862,7 @@ static void unfreeze_partials(struct kmem_cache *s) | |||
| 1862 | { | 1862 | { |
| 1863 | struct kmem_cache_node *n = NULL; | 1863 | struct kmem_cache_node *n = NULL; |
| 1864 | struct kmem_cache_cpu *c = this_cpu_ptr(s->cpu_slab); | 1864 | struct kmem_cache_cpu *c = this_cpu_ptr(s->cpu_slab); |
| 1865 | struct page *page; | 1865 | struct page *page, *discard_page = NULL; |
| 1866 | 1866 | ||
| 1867 | while ((page = c->partial)) { | 1867 | while ((page = c->partial)) { |
| 1868 | enum slab_modes { M_PARTIAL, M_FREE }; | 1868 | enum slab_modes { M_PARTIAL, M_FREE }; |
| @@ -1904,7 +1904,8 @@ static void unfreeze_partials(struct kmem_cache *s) | |||
| 1904 | if (l == M_PARTIAL) | 1904 | if (l == M_PARTIAL) |
| 1905 | remove_partial(n, page); | 1905 | remove_partial(n, page); |
| 1906 | else | 1906 | else |
| 1907 | add_partial(n, page, 1); | 1907 | add_partial(n, page, |
| 1908 | DEACTIVATE_TO_TAIL); | ||
| 1908 | 1909 | ||
| 1909 | l = m; | 1910 | l = m; |
| 1910 | } | 1911 | } |
| @@ -1915,14 +1916,22 @@ static void unfreeze_partials(struct kmem_cache *s) | |||
| 1915 | "unfreezing slab")); | 1916 | "unfreezing slab")); |
| 1916 | 1917 | ||
| 1917 | if (m == M_FREE) { | 1918 | if (m == M_FREE) { |
| 1918 | stat(s, DEACTIVATE_EMPTY); | 1919 | page->next = discard_page; |
| 1919 | discard_slab(s, page); | 1920 | discard_page = page; |
| 1920 | stat(s, FREE_SLAB); | ||
| 1921 | } | 1921 | } |
| 1922 | } | 1922 | } |
| 1923 | 1923 | ||
| 1924 | if (n) | 1924 | if (n) |
| 1925 | spin_unlock(&n->list_lock); | 1925 | spin_unlock(&n->list_lock); |
| 1926 | |||
| 1927 | while (discard_page) { | ||
| 1928 | page = discard_page; | ||
| 1929 | discard_page = discard_page->next; | ||
| 1930 | |||
| 1931 | stat(s, DEACTIVATE_EMPTY); | ||
| 1932 | discard_slab(s, page); | ||
| 1933 | stat(s, FREE_SLAB); | ||
| 1934 | } | ||
| 1926 | } | 1935 | } |
| 1927 | 1936 | ||
| 1928 | /* | 1937 | /* |
| @@ -1969,7 +1978,7 @@ int put_cpu_partial(struct kmem_cache *s, struct page *page, int drain) | |||
| 1969 | page->pobjects = pobjects; | 1978 | page->pobjects = pobjects; |
| 1970 | page->next = oldpage; | 1979 | page->next = oldpage; |
| 1971 | 1980 | ||
| 1972 | } while (this_cpu_cmpxchg(s->cpu_slab->partial, oldpage, page) != oldpage); | 1981 | } while (irqsafe_cpu_cmpxchg(s->cpu_slab->partial, oldpage, page) != oldpage); |
| 1973 | stat(s, CPU_PARTIAL_FREE); | 1982 | stat(s, CPU_PARTIAL_FREE); |
| 1974 | return pobjects; | 1983 | return pobjects; |
| 1975 | } | 1984 | } |
| @@ -4435,30 +4444,31 @@ static ssize_t show_slab_objects(struct kmem_cache *s, | |||
| 4435 | 4444 | ||
| 4436 | for_each_possible_cpu(cpu) { | 4445 | for_each_possible_cpu(cpu) { |
| 4437 | struct kmem_cache_cpu *c = per_cpu_ptr(s->cpu_slab, cpu); | 4446 | struct kmem_cache_cpu *c = per_cpu_ptr(s->cpu_slab, cpu); |
| 4447 | int node = ACCESS_ONCE(c->node); | ||
| 4438 | struct page *page; | 4448 | struct page *page; |
| 4439 | 4449 | ||
| 4440 | if (!c || c->node < 0) | 4450 | if (node < 0) |
| 4441 | continue; | 4451 | continue; |
| 4442 | 4452 | page = ACCESS_ONCE(c->page); | |
| 4443 | if (c->page) { | 4453 | if (page) { |
| 4444 | if (flags & SO_TOTAL) | 4454 | if (flags & SO_TOTAL) |
| 4445 | x = c->page->objects; | 4455 | x = page->objects; |
| 4446 | else if (flags & SO_OBJECTS) | 4456 | else if (flags & SO_OBJECTS) |
| 4447 | x = c->page->inuse; | 4457 | x = page->inuse; |
| 4448 | else | 4458 | else |
| 4449 | x = 1; | 4459 | x = 1; |
| 4450 | 4460 | ||
| 4451 | total += x; | 4461 | total += x; |
| 4452 | nodes[c->node] += x; | 4462 | nodes[node] += x; |
| 4453 | } | 4463 | } |
| 4454 | page = c->partial; | 4464 | page = c->partial; |
| 4455 | 4465 | ||
| 4456 | if (page) { | 4466 | if (page) { |
| 4457 | x = page->pobjects; | 4467 | x = page->pobjects; |
| 4458 | total += x; | 4468 | total += x; |
| 4459 | nodes[c->node] += x; | 4469 | nodes[node] += x; |
| 4460 | } | 4470 | } |
| 4461 | per_cpu[c->node]++; | 4471 | per_cpu[node]++; |
| 4462 | } | 4472 | } |
| 4463 | } | 4473 | } |
| 4464 | 4474 | ||
diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c index e5f9ece3c9a0..a1daf8227ed1 100644 --- a/net/bridge/br_netlink.c +++ b/net/bridge/br_netlink.c | |||
| @@ -18,6 +18,7 @@ | |||
| 18 | #include <net/sock.h> | 18 | #include <net/sock.h> |
| 19 | 19 | ||
| 20 | #include "br_private.h" | 20 | #include "br_private.h" |
| 21 | #include "br_private_stp.h" | ||
| 21 | 22 | ||
| 22 | static inline size_t br_nlmsg_size(void) | 23 | static inline size_t br_nlmsg_size(void) |
| 23 | { | 24 | { |
| @@ -188,6 +189,11 @@ static int br_rtm_setlink(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg) | |||
| 188 | 189 | ||
| 189 | p->state = new_state; | 190 | p->state = new_state; |
| 190 | br_log_state(p); | 191 | br_log_state(p); |
| 192 | |||
| 193 | spin_lock_bh(&p->br->lock); | ||
| 194 | br_port_state_selection(p->br); | ||
| 195 | spin_unlock_bh(&p->br->lock); | ||
| 196 | |||
| 191 | br_ifinfo_notify(RTM_NEWLINK, p); | 197 | br_ifinfo_notify(RTM_NEWLINK, p); |
| 192 | 198 | ||
| 193 | return 0; | 199 | return 0; |
diff --git a/net/bridge/br_stp.c b/net/bridge/br_stp.c index ad0a3f7cf6cc..dd147d78a588 100644 --- a/net/bridge/br_stp.c +++ b/net/bridge/br_stp.c | |||
| @@ -399,25 +399,24 @@ void br_port_state_selection(struct net_bridge *br) | |||
| 399 | struct net_bridge_port *p; | 399 | struct net_bridge_port *p; |
| 400 | unsigned int liveports = 0; | 400 | unsigned int liveports = 0; |
| 401 | 401 | ||
| 402 | /* Don't change port states if userspace is handling STP */ | ||
| 403 | if (br->stp_enabled == BR_USER_STP) | ||
| 404 | return; | ||
| 405 | |||
| 406 | list_for_each_entry(p, &br->port_list, list) { | 402 | list_for_each_entry(p, &br->port_list, list) { |
| 407 | if (p->state == BR_STATE_DISABLED) | 403 | if (p->state == BR_STATE_DISABLED) |
| 408 | continue; | 404 | continue; |
| 409 | 405 | ||
| 410 | if (p->port_no == br->root_port) { | 406 | /* Don't change port states if userspace is handling STP */ |
| 411 | p->config_pending = 0; | 407 | if (br->stp_enabled != BR_USER_STP) { |
| 412 | p->topology_change_ack = 0; | 408 | if (p->port_no == br->root_port) { |
| 413 | br_make_forwarding(p); | 409 | p->config_pending = 0; |
| 414 | } else if (br_is_designated_port(p)) { | 410 | p->topology_change_ack = 0; |
| 415 | del_timer(&p->message_age_timer); | 411 | br_make_forwarding(p); |
| 416 | br_make_forwarding(p); | 412 | } else if (br_is_designated_port(p)) { |
| 417 | } else { | 413 | del_timer(&p->message_age_timer); |
| 418 | p->config_pending = 0; | 414 | br_make_forwarding(p); |
| 419 | p->topology_change_ack = 0; | 415 | } else { |
| 420 | br_make_blocking(p); | 416 | p->config_pending = 0; |
| 417 | p->topology_change_ack = 0; | ||
| 418 | br_make_blocking(p); | ||
| 419 | } | ||
| 421 | } | 420 | } |
| 422 | 421 | ||
| 423 | if (p->state == BR_STATE_FORWARDING) | 422 | if (p->state == BR_STATE_FORWARDING) |
diff --git a/net/caif/cffrml.c b/net/caif/cffrml.c index f39921171d0d..d3ca87bf23b7 100644 --- a/net/caif/cffrml.c +++ b/net/caif/cffrml.c | |||
| @@ -136,20 +136,21 @@ static int cffrml_receive(struct cflayer *layr, struct cfpkt *pkt) | |||
| 136 | 136 | ||
| 137 | static int cffrml_transmit(struct cflayer *layr, struct cfpkt *pkt) | 137 | static int cffrml_transmit(struct cflayer *layr, struct cfpkt *pkt) |
| 138 | { | 138 | { |
| 139 | int tmp; | ||
| 140 | u16 chks; | 139 | u16 chks; |
| 141 | u16 len; | 140 | u16 len; |
| 141 | __le16 data; | ||
| 142 | |||
| 142 | struct cffrml *this = container_obj(layr); | 143 | struct cffrml *this = container_obj(layr); |
| 143 | if (this->dofcs) { | 144 | if (this->dofcs) { |
| 144 | chks = cfpkt_iterate(pkt, cffrml_checksum, 0xffff); | 145 | chks = cfpkt_iterate(pkt, cffrml_checksum, 0xffff); |
| 145 | tmp = cpu_to_le16(chks); | 146 | data = cpu_to_le16(chks); |
| 146 | cfpkt_add_trail(pkt, &tmp, 2); | 147 | cfpkt_add_trail(pkt, &data, 2); |
| 147 | } else { | 148 | } else { |
| 148 | cfpkt_pad_trail(pkt, 2); | 149 | cfpkt_pad_trail(pkt, 2); |
| 149 | } | 150 | } |
| 150 | len = cfpkt_getlen(pkt); | 151 | len = cfpkt_getlen(pkt); |
| 151 | tmp = cpu_to_le16(len); | 152 | data = cpu_to_le16(len); |
| 152 | cfpkt_add_head(pkt, &tmp, 2); | 153 | cfpkt_add_head(pkt, &data, 2); |
| 153 | cfpkt_info(pkt)->hdr_len += 2; | 154 | cfpkt_info(pkt)->hdr_len += 2; |
| 154 | if (cfpkt_erroneous(pkt)) { | 155 | if (cfpkt_erroneous(pkt)) { |
| 155 | pr_err("Packet is erroneous!\n"); | 156 | pr_err("Packet is erroneous!\n"); |
diff --git a/net/core/dev.c b/net/core/dev.c index 6ba50a1e404c..5a13edfc9f73 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
| @@ -1396,7 +1396,7 @@ rollback: | |||
| 1396 | for_each_net(net) { | 1396 | for_each_net(net) { |
| 1397 | for_each_netdev(net, dev) { | 1397 | for_each_netdev(net, dev) { |
| 1398 | if (dev == last) | 1398 | if (dev == last) |
| 1399 | break; | 1399 | goto outroll; |
| 1400 | 1400 | ||
| 1401 | if (dev->flags & IFF_UP) { | 1401 | if (dev->flags & IFF_UP) { |
| 1402 | nb->notifier_call(nb, NETDEV_GOING_DOWN, dev); | 1402 | nb->notifier_call(nb, NETDEV_GOING_DOWN, dev); |
| @@ -1407,6 +1407,7 @@ rollback: | |||
| 1407 | } | 1407 | } |
| 1408 | } | 1408 | } |
| 1409 | 1409 | ||
| 1410 | outroll: | ||
| 1410 | raw_notifier_chain_unregister(&netdev_chain, nb); | 1411 | raw_notifier_chain_unregister(&netdev_chain, nb); |
| 1411 | goto unlock; | 1412 | goto unlock; |
| 1412 | } | 1413 | } |
| @@ -4282,6 +4283,12 @@ static int dev_seq_open(struct inode *inode, struct file *file) | |||
| 4282 | sizeof(struct dev_iter_state)); | 4283 | sizeof(struct dev_iter_state)); |
| 4283 | } | 4284 | } |
| 4284 | 4285 | ||
| 4286 | int dev_seq_open_ops(struct inode *inode, struct file *file, | ||
| 4287 | const struct seq_operations *ops) | ||
| 4288 | { | ||
| 4289 | return seq_open_net(inode, file, ops, sizeof(struct dev_iter_state)); | ||
| 4290 | } | ||
| 4291 | |||
| 4285 | static const struct file_operations dev_seq_fops = { | 4292 | static const struct file_operations dev_seq_fops = { |
| 4286 | .owner = THIS_MODULE, | 4293 | .owner = THIS_MODULE, |
| 4287 | .open = dev_seq_open, | 4294 | .open = dev_seq_open, |
diff --git a/net/core/dev_addr_lists.c b/net/core/dev_addr_lists.c index 277faef9148d..febba516db62 100644 --- a/net/core/dev_addr_lists.c +++ b/net/core/dev_addr_lists.c | |||
| @@ -696,8 +696,7 @@ static const struct seq_operations dev_mc_seq_ops = { | |||
| 696 | 696 | ||
| 697 | static int dev_mc_seq_open(struct inode *inode, struct file *file) | 697 | static int dev_mc_seq_open(struct inode *inode, struct file *file) |
| 698 | { | 698 | { |
| 699 | return seq_open_net(inode, file, &dev_mc_seq_ops, | 699 | return dev_seq_open_ops(inode, file, &dev_mc_seq_ops); |
| 700 | sizeof(struct seq_net_private)); | ||
| 701 | } | 700 | } |
| 702 | 701 | ||
| 703 | static const struct file_operations dev_mc_seq_fops = { | 702 | static const struct file_operations dev_mc_seq_fops = { |
diff --git a/net/core/neighbour.c b/net/core/neighbour.c index 039d51e6c284..5ac07d31fbc9 100644 --- a/net/core/neighbour.c +++ b/net/core/neighbour.c | |||
| @@ -2397,7 +2397,10 @@ static struct pneigh_entry *pneigh_get_next(struct seq_file *seq, | |||
| 2397 | struct net *net = seq_file_net(seq); | 2397 | struct net *net = seq_file_net(seq); |
| 2398 | struct neigh_table *tbl = state->tbl; | 2398 | struct neigh_table *tbl = state->tbl; |
| 2399 | 2399 | ||
| 2400 | pn = pn->next; | 2400 | do { |
| 2401 | pn = pn->next; | ||
| 2402 | } while (pn && !net_eq(pneigh_net(pn), net)); | ||
| 2403 | |||
| 2401 | while (!pn) { | 2404 | while (!pn) { |
| 2402 | if (++state->bucket > PNEIGH_HASHMASK) | 2405 | if (++state->bucket > PNEIGH_HASHMASK) |
| 2403 | break; | 2406 | break; |
diff --git a/net/core/skbuff.c b/net/core/skbuff.c index 18a3cebb753d..3c30ee4a5710 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c | |||
| @@ -2230,7 +2230,7 @@ static int skb_prepare_for_shift(struct sk_buff *skb) | |||
| 2230 | * @shiftlen: shift up to this many bytes | 2230 | * @shiftlen: shift up to this many bytes |
| 2231 | * | 2231 | * |
| 2232 | * Attempts to shift up to shiftlen worth of bytes, which may be less than | 2232 | * Attempts to shift up to shiftlen worth of bytes, which may be less than |
| 2233 | * the length of the skb, from tgt to skb. Returns number bytes shifted. | 2233 | * the length of the skb, from skb to tgt. Returns number bytes shifted. |
| 2234 | * It's up to caller to free skb if everything was shifted. | 2234 | * It's up to caller to free skb if everything was shifted. |
| 2235 | * | 2235 | * |
| 2236 | * If @tgt runs out of frags, the whole operation is aborted. | 2236 | * If @tgt runs out of frags, the whole operation is aborted. |
diff --git a/net/dccp/ipv4.c b/net/dccp/ipv4.c index 90a919afbed7..3f4e5414c8e5 100644 --- a/net/dccp/ipv4.c +++ b/net/dccp/ipv4.c | |||
| @@ -111,6 +111,7 @@ int dccp_v4_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len) | |||
| 111 | rt = ip_route_newports(fl4, rt, orig_sport, orig_dport, | 111 | rt = ip_route_newports(fl4, rt, orig_sport, orig_dport, |
| 112 | inet->inet_sport, inet->inet_dport, sk); | 112 | inet->inet_sport, inet->inet_dport, sk); |
| 113 | if (IS_ERR(rt)) { | 113 | if (IS_ERR(rt)) { |
| 114 | err = PTR_ERR(rt); | ||
| 114 | rt = NULL; | 115 | rt = NULL; |
| 115 | goto failure; | 116 | goto failure; |
| 116 | } | 117 | } |
diff --git a/net/decnet/dn_route.c b/net/decnet/dn_route.c index a77d16158eb6..94f4ec036669 100644 --- a/net/decnet/dn_route.c +++ b/net/decnet/dn_route.c | |||
| @@ -112,7 +112,7 @@ static unsigned long dn_rt_deadline; | |||
| 112 | static int dn_dst_gc(struct dst_ops *ops); | 112 | static int dn_dst_gc(struct dst_ops *ops); |
| 113 | static struct dst_entry *dn_dst_check(struct dst_entry *, __u32); | 113 | static struct dst_entry *dn_dst_check(struct dst_entry *, __u32); |
| 114 | static unsigned int dn_dst_default_advmss(const struct dst_entry *dst); | 114 | static unsigned int dn_dst_default_advmss(const struct dst_entry *dst); |
| 115 | static unsigned int dn_dst_default_mtu(const struct dst_entry *dst); | 115 | static unsigned int dn_dst_mtu(const struct dst_entry *dst); |
| 116 | static void dn_dst_destroy(struct dst_entry *); | 116 | static void dn_dst_destroy(struct dst_entry *); |
| 117 | static struct dst_entry *dn_dst_negative_advice(struct dst_entry *); | 117 | static struct dst_entry *dn_dst_negative_advice(struct dst_entry *); |
| 118 | static void dn_dst_link_failure(struct sk_buff *); | 118 | static void dn_dst_link_failure(struct sk_buff *); |
| @@ -135,7 +135,7 @@ static struct dst_ops dn_dst_ops = { | |||
| 135 | .gc = dn_dst_gc, | 135 | .gc = dn_dst_gc, |
| 136 | .check = dn_dst_check, | 136 | .check = dn_dst_check, |
| 137 | .default_advmss = dn_dst_default_advmss, | 137 | .default_advmss = dn_dst_default_advmss, |
| 138 | .default_mtu = dn_dst_default_mtu, | 138 | .mtu = dn_dst_mtu, |
| 139 | .cow_metrics = dst_cow_metrics_generic, | 139 | .cow_metrics = dst_cow_metrics_generic, |
| 140 | .destroy = dn_dst_destroy, | 140 | .destroy = dn_dst_destroy, |
| 141 | .negative_advice = dn_dst_negative_advice, | 141 | .negative_advice = dn_dst_negative_advice, |
| @@ -825,9 +825,11 @@ static unsigned int dn_dst_default_advmss(const struct dst_entry *dst) | |||
| 825 | return dn_mss_from_pmtu(dst->dev, dst_mtu(dst)); | 825 | return dn_mss_from_pmtu(dst->dev, dst_mtu(dst)); |
| 826 | } | 826 | } |
| 827 | 827 | ||
| 828 | static unsigned int dn_dst_default_mtu(const struct dst_entry *dst) | 828 | static unsigned int dn_dst_mtu(const struct dst_entry *dst) |
| 829 | { | 829 | { |
| 830 | return dst->dev->mtu; | 830 | unsigned int mtu = dst_metric_raw(dst, RTAX_MTU); |
| 831 | |||
| 832 | return mtu ? : dst->dev->mtu; | ||
| 831 | } | 833 | } |
| 832 | 834 | ||
| 833 | static struct neighbour *dn_dst_neigh_lookup(const struct dst_entry *dst, const void *daddr) | 835 | static struct neighbour *dn_dst_neigh_lookup(const struct dst_entry *dst, const void *daddr) |
diff --git a/net/decnet/dn_timer.c b/net/decnet/dn_timer.c index 67f691bd4acf..d9c150cc59a9 100644 --- a/net/decnet/dn_timer.c +++ b/net/decnet/dn_timer.c | |||
| @@ -36,16 +36,13 @@ static void dn_slow_timer(unsigned long arg); | |||
| 36 | 36 | ||
| 37 | void dn_start_slow_timer(struct sock *sk) | 37 | void dn_start_slow_timer(struct sock *sk) |
| 38 | { | 38 | { |
| 39 | sk->sk_timer.expires = jiffies + SLOW_INTERVAL; | 39 | setup_timer(&sk->sk_timer, dn_slow_timer, (unsigned long)sk); |
| 40 | sk->sk_timer.function = dn_slow_timer; | 40 | sk_reset_timer(sk, &sk->sk_timer, jiffies + SLOW_INTERVAL); |
| 41 | sk->sk_timer.data = (unsigned long)sk; | ||
| 42 | |||
| 43 | add_timer(&sk->sk_timer); | ||
| 44 | } | 41 | } |
| 45 | 42 | ||
| 46 | void dn_stop_slow_timer(struct sock *sk) | 43 | void dn_stop_slow_timer(struct sock *sk) |
| 47 | { | 44 | { |
| 48 | del_timer(&sk->sk_timer); | 45 | sk_stop_timer(sk, &sk->sk_timer); |
| 49 | } | 46 | } |
| 50 | 47 | ||
| 51 | static void dn_slow_timer(unsigned long arg) | 48 | static void dn_slow_timer(unsigned long arg) |
| @@ -53,12 +50,10 @@ static void dn_slow_timer(unsigned long arg) | |||
| 53 | struct sock *sk = (struct sock *)arg; | 50 | struct sock *sk = (struct sock *)arg; |
| 54 | struct dn_scp *scp = DN_SK(sk); | 51 | struct dn_scp *scp = DN_SK(sk); |
| 55 | 52 | ||
| 56 | sock_hold(sk); | ||
| 57 | bh_lock_sock(sk); | 53 | bh_lock_sock(sk); |
| 58 | 54 | ||
| 59 | if (sock_owned_by_user(sk)) { | 55 | if (sock_owned_by_user(sk)) { |
| 60 | sk->sk_timer.expires = jiffies + HZ / 10; | 56 | sk_reset_timer(sk, &sk->sk_timer, jiffies + HZ / 10); |
| 61 | add_timer(&sk->sk_timer); | ||
| 62 | goto out; | 57 | goto out; |
| 63 | } | 58 | } |
| 64 | 59 | ||
| @@ -100,9 +95,7 @@ static void dn_slow_timer(unsigned long arg) | |||
| 100 | scp->keepalive_fxn(sk); | 95 | scp->keepalive_fxn(sk); |
| 101 | } | 96 | } |
| 102 | 97 | ||
| 103 | sk->sk_timer.expires = jiffies + SLOW_INTERVAL; | 98 | sk_reset_timer(sk, &sk->sk_timer, jiffies + SLOW_INTERVAL); |
| 104 | |||
| 105 | add_timer(&sk->sk_timer); | ||
| 106 | out: | 99 | out: |
| 107 | bh_unlock_sock(sk); | 100 | bh_unlock_sock(sk); |
| 108 | sock_put(sk); | 101 | sock_put(sk); |
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c index c6b5092f29a1..65f01dc47565 100644 --- a/net/ipv4/devinet.c +++ b/net/ipv4/devinet.c | |||
| @@ -1490,7 +1490,9 @@ static int devinet_conf_proc(ctl_table *ctl, int write, | |||
| 1490 | void __user *buffer, | 1490 | void __user *buffer, |
| 1491 | size_t *lenp, loff_t *ppos) | 1491 | size_t *lenp, loff_t *ppos) |
| 1492 | { | 1492 | { |
| 1493 | int old_value = *(int *)ctl->data; | ||
| 1493 | int ret = proc_dointvec(ctl, write, buffer, lenp, ppos); | 1494 | int ret = proc_dointvec(ctl, write, buffer, lenp, ppos); |
| 1495 | int new_value = *(int *)ctl->data; | ||
| 1494 | 1496 | ||
| 1495 | if (write) { | 1497 | if (write) { |
| 1496 | struct ipv4_devconf *cnf = ctl->extra1; | 1498 | struct ipv4_devconf *cnf = ctl->extra1; |
| @@ -1501,6 +1503,9 @@ static int devinet_conf_proc(ctl_table *ctl, int write, | |||
| 1501 | 1503 | ||
| 1502 | if (cnf == net->ipv4.devconf_dflt) | 1504 | if (cnf == net->ipv4.devconf_dflt) |
| 1503 | devinet_copy_dflt_conf(net, i); | 1505 | devinet_copy_dflt_conf(net, i); |
| 1506 | if (i == IPV4_DEVCONF_ACCEPT_LOCAL - 1) | ||
| 1507 | if ((new_value == 0) && (old_value != 0)) | ||
| 1508 | rt_cache_flush(net, 0); | ||
| 1504 | } | 1509 | } |
| 1505 | 1510 | ||
| 1506 | return ret; | 1511 | return ret; |
diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c index c7472eff2d51..b2ca095cb9da 100644 --- a/net/ipv4/igmp.c +++ b/net/ipv4/igmp.c | |||
| @@ -1716,7 +1716,8 @@ static int ip_mc_add_src(struct in_device *in_dev, __be32 *pmca, int sfmode, | |||
| 1716 | if (err) { | 1716 | if (err) { |
| 1717 | int j; | 1717 | int j; |
| 1718 | 1718 | ||
| 1719 | pmc->sfcount[sfmode]--; | 1719 | if (!delta) |
| 1720 | pmc->sfcount[sfmode]--; | ||
| 1720 | for (j=0; j<i; j++) | 1721 | for (j=0; j<i; j++) |
| 1721 | (void) ip_mc_del1_src(pmc, sfmode, &psfsrc[j]); | 1722 | (void) ip_mc_del1_src(pmc, sfmode, &psfsrc[j]); |
| 1722 | } else if (isexclude != (pmc->sfcount[MCAST_EXCLUDE] != 0)) { | 1723 | } else if (isexclude != (pmc->sfcount[MCAST_EXCLUDE] != 0)) { |
diff --git a/net/ipv4/inet_diag.c b/net/ipv4/inet_diag.c index 68e8ac514383..ccee270a9b65 100644 --- a/net/ipv4/inet_diag.c +++ b/net/ipv4/inet_diag.c | |||
| @@ -108,9 +108,6 @@ static int inet_csk_diag_fill(struct sock *sk, | |||
| 108 | icsk->icsk_ca_ops->name); | 108 | icsk->icsk_ca_ops->name); |
| 109 | } | 109 | } |
| 110 | 110 | ||
| 111 | if ((ext & (1 << (INET_DIAG_TOS - 1))) && (sk->sk_family != AF_INET6)) | ||
| 112 | RTA_PUT_U8(skb, INET_DIAG_TOS, inet->tos); | ||
| 113 | |||
| 114 | r->idiag_family = sk->sk_family; | 111 | r->idiag_family = sk->sk_family; |
| 115 | r->idiag_state = sk->sk_state; | 112 | r->idiag_state = sk->sk_state; |
| 116 | r->idiag_timer = 0; | 113 | r->idiag_timer = 0; |
| @@ -125,16 +122,23 @@ static int inet_csk_diag_fill(struct sock *sk, | |||
| 125 | r->id.idiag_src[0] = inet->inet_rcv_saddr; | 122 | r->id.idiag_src[0] = inet->inet_rcv_saddr; |
| 126 | r->id.idiag_dst[0] = inet->inet_daddr; | 123 | r->id.idiag_dst[0] = inet->inet_daddr; |
| 127 | 124 | ||
| 125 | /* IPv6 dual-stack sockets use inet->tos for IPv4 connections, | ||
| 126 | * hence this needs to be included regardless of socket family. | ||
| 127 | */ | ||
| 128 | if (ext & (1 << (INET_DIAG_TOS - 1))) | ||
| 129 | RTA_PUT_U8(skb, INET_DIAG_TOS, inet->tos); | ||
| 130 | |||
| 128 | #if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE) | 131 | #if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE) |
| 129 | if (r->idiag_family == AF_INET6) { | 132 | if (r->idiag_family == AF_INET6) { |
| 130 | const struct ipv6_pinfo *np = inet6_sk(sk); | 133 | const struct ipv6_pinfo *np = inet6_sk(sk); |
| 131 | 134 | ||
| 135 | if (ext & (1 << (INET_DIAG_TCLASS - 1))) | ||
| 136 | RTA_PUT_U8(skb, INET_DIAG_TCLASS, np->tclass); | ||
| 137 | |||
| 132 | ipv6_addr_copy((struct in6_addr *)r->id.idiag_src, | 138 | ipv6_addr_copy((struct in6_addr *)r->id.idiag_src, |
| 133 | &np->rcv_saddr); | 139 | &np->rcv_saddr); |
| 134 | ipv6_addr_copy((struct in6_addr *)r->id.idiag_dst, | 140 | ipv6_addr_copy((struct in6_addr *)r->id.idiag_dst, |
| 135 | &np->daddr); | 141 | &np->daddr); |
| 136 | if (ext & (1 << (INET_DIAG_TCLASS - 1))) | ||
| 137 | RTA_PUT_U8(skb, INET_DIAG_TCLASS, np->tclass); | ||
| 138 | } | 142 | } |
| 139 | #endif | 143 | #endif |
| 140 | 144 | ||
diff --git a/net/ipv4/ip_forward.c b/net/ipv4/ip_forward.c index 3b34d1c86270..29a07b6c7168 100644 --- a/net/ipv4/ip_forward.c +++ b/net/ipv4/ip_forward.c | |||
| @@ -84,7 +84,7 @@ int ip_forward(struct sk_buff *skb) | |||
| 84 | 84 | ||
| 85 | rt = skb_rtable(skb); | 85 | rt = skb_rtable(skb); |
| 86 | 86 | ||
| 87 | if (opt->is_strictroute && ip_hdr(skb)->daddr != rt->rt_gateway) | 87 | if (opt->is_strictroute && opt->nexthop != rt->rt_gateway) |
| 88 | goto sr_failed; | 88 | goto sr_failed; |
| 89 | 89 | ||
| 90 | if (unlikely(skb->len > dst_mtu(&rt->dst) && !skb_is_gso(skb) && | 90 | if (unlikely(skb->len > dst_mtu(&rt->dst) && !skb_is_gso(skb) && |
diff --git a/net/ipv4/ip_options.c b/net/ipv4/ip_options.c index 05d20cca9d66..1e60f7679075 100644 --- a/net/ipv4/ip_options.c +++ b/net/ipv4/ip_options.c | |||
| @@ -568,12 +568,13 @@ void ip_forward_options(struct sk_buff *skb) | |||
| 568 | ) { | 568 | ) { |
| 569 | if (srrptr + 3 > srrspace) | 569 | if (srrptr + 3 > srrspace) |
| 570 | break; | 570 | break; |
| 571 | if (memcmp(&ip_hdr(skb)->daddr, &optptr[srrptr-1], 4) == 0) | 571 | if (memcmp(&opt->nexthop, &optptr[srrptr-1], 4) == 0) |
| 572 | break; | 572 | break; |
| 573 | } | 573 | } |
| 574 | if (srrptr + 3 <= srrspace) { | 574 | if (srrptr + 3 <= srrspace) { |
| 575 | opt->is_changed = 1; | 575 | opt->is_changed = 1; |
| 576 | ip_rt_get_source(&optptr[srrptr-1], skb, rt); | 576 | ip_rt_get_source(&optptr[srrptr-1], skb, rt); |
| 577 | ip_hdr(skb)->daddr = opt->nexthop; | ||
| 577 | optptr[2] = srrptr+4; | 578 | optptr[2] = srrptr+4; |
| 578 | } else if (net_ratelimit()) | 579 | } else if (net_ratelimit()) |
| 579 | printk(KERN_CRIT "ip_forward(): Argh! Destination lost!\n"); | 580 | printk(KERN_CRIT "ip_forward(): Argh! Destination lost!\n"); |
| @@ -640,7 +641,7 @@ int ip_options_rcv_srr(struct sk_buff *skb) | |||
| 640 | } | 641 | } |
| 641 | if (srrptr <= srrspace) { | 642 | if (srrptr <= srrspace) { |
| 642 | opt->srr_is_hit = 1; | 643 | opt->srr_is_hit = 1; |
| 643 | iph->daddr = nexthop; | 644 | opt->nexthop = nexthop; |
| 644 | opt->is_changed = 1; | 645 | opt->is_changed = 1; |
| 645 | } | 646 | } |
| 646 | return 0; | 647 | return 0; |
diff --git a/net/ipv4/netfilter.c b/net/ipv4/netfilter.c index 9899619ab9b8..4f47e064e262 100644 --- a/net/ipv4/netfilter.c +++ b/net/ipv4/netfilter.c | |||
| @@ -64,7 +64,8 @@ int ip_route_me_harder(struct sk_buff *skb, unsigned addr_type) | |||
| 64 | /* Change in oif may mean change in hh_len. */ | 64 | /* Change in oif may mean change in hh_len. */ |
| 65 | hh_len = skb_dst(skb)->dev->hard_header_len; | 65 | hh_len = skb_dst(skb)->dev->hard_header_len; |
| 66 | if (skb_headroom(skb) < hh_len && | 66 | if (skb_headroom(skb) < hh_len && |
| 67 | pskb_expand_head(skb, hh_len - skb_headroom(skb), 0, GFP_ATOMIC)) | 67 | pskb_expand_head(skb, HH_DATA_ALIGN(hh_len - skb_headroom(skb)), |
| 68 | 0, GFP_ATOMIC)) | ||
| 68 | return -1; | 69 | return -1; |
| 69 | 70 | ||
| 70 | return 0; | 71 | return 0; |
diff --git a/net/ipv4/netfilter/Kconfig b/net/ipv4/netfilter/Kconfig index 1dfc18a03fd4..f19f2182894c 100644 --- a/net/ipv4/netfilter/Kconfig +++ b/net/ipv4/netfilter/Kconfig | |||
| @@ -325,7 +325,6 @@ config IP_NF_TARGET_TTL | |||
| 325 | # raw + specific targets | 325 | # raw + specific targets |
| 326 | config IP_NF_RAW | 326 | config IP_NF_RAW |
| 327 | tristate 'raw table support (required for NOTRACK/TRACE)' | 327 | tristate 'raw table support (required for NOTRACK/TRACE)' |
| 328 | depends on NETFILTER_ADVANCED | ||
| 329 | help | 328 | help |
| 330 | This option adds a `raw' table to iptables. This table is the very | 329 | This option adds a `raw' table to iptables. This table is the very |
| 331 | first in the netfilter framework and hooks in at the PREROUTING | 330 | first in the netfilter framework and hooks in at the PREROUTING |
diff --git a/net/ipv4/route.c b/net/ipv4/route.c index 0c74da8a0473..ca5e237df029 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c | |||
| @@ -131,6 +131,7 @@ static int ip_rt_mtu_expires __read_mostly = 10 * 60 * HZ; | |||
| 131 | static int ip_rt_min_pmtu __read_mostly = 512 + 20 + 20; | 131 | static int ip_rt_min_pmtu __read_mostly = 512 + 20 + 20; |
| 132 | static int ip_rt_min_advmss __read_mostly = 256; | 132 | static int ip_rt_min_advmss __read_mostly = 256; |
| 133 | static int rt_chain_length_max __read_mostly = 20; | 133 | static int rt_chain_length_max __read_mostly = 20; |
| 134 | static int redirect_genid; | ||
| 134 | 135 | ||
| 135 | /* | 136 | /* |
| 136 | * Interface to generic destination cache. | 137 | * Interface to generic destination cache. |
| @@ -138,7 +139,7 @@ static int rt_chain_length_max __read_mostly = 20; | |||
| 138 | 139 | ||
| 139 | static struct dst_entry *ipv4_dst_check(struct dst_entry *dst, u32 cookie); | 140 | static struct dst_entry *ipv4_dst_check(struct dst_entry *dst, u32 cookie); |
| 140 | static unsigned int ipv4_default_advmss(const struct dst_entry *dst); | 141 | static unsigned int ipv4_default_advmss(const struct dst_entry *dst); |
| 141 | static unsigned int ipv4_default_mtu(const struct dst_entry *dst); | 142 | static unsigned int ipv4_mtu(const struct dst_entry *dst); |
| 142 | static void ipv4_dst_destroy(struct dst_entry *dst); | 143 | static void ipv4_dst_destroy(struct dst_entry *dst); |
| 143 | static struct dst_entry *ipv4_negative_advice(struct dst_entry *dst); | 144 | static struct dst_entry *ipv4_negative_advice(struct dst_entry *dst); |
| 144 | static void ipv4_link_failure(struct sk_buff *skb); | 145 | static void ipv4_link_failure(struct sk_buff *skb); |
| @@ -193,7 +194,7 @@ static struct dst_ops ipv4_dst_ops = { | |||
| 193 | .gc = rt_garbage_collect, | 194 | .gc = rt_garbage_collect, |
| 194 | .check = ipv4_dst_check, | 195 | .check = ipv4_dst_check, |
| 195 | .default_advmss = ipv4_default_advmss, | 196 | .default_advmss = ipv4_default_advmss, |
| 196 | .default_mtu = ipv4_default_mtu, | 197 | .mtu = ipv4_mtu, |
| 197 | .cow_metrics = ipv4_cow_metrics, | 198 | .cow_metrics = ipv4_cow_metrics, |
| 198 | .destroy = ipv4_dst_destroy, | 199 | .destroy = ipv4_dst_destroy, |
| 199 | .ifdown = ipv4_dst_ifdown, | 200 | .ifdown = ipv4_dst_ifdown, |
| @@ -416,9 +417,13 @@ static int rt_cache_seq_show(struct seq_file *seq, void *v) | |||
| 416 | else { | 417 | else { |
| 417 | struct rtable *r = v; | 418 | struct rtable *r = v; |
| 418 | struct neighbour *n; | 419 | struct neighbour *n; |
| 419 | int len; | 420 | int len, HHUptod; |
| 420 | 421 | ||
| 422 | rcu_read_lock(); | ||
| 421 | n = dst_get_neighbour(&r->dst); | 423 | n = dst_get_neighbour(&r->dst); |
| 424 | HHUptod = (n && (n->nud_state & NUD_CONNECTED)) ? 1 : 0; | ||
| 425 | rcu_read_unlock(); | ||
| 426 | |||
| 422 | seq_printf(seq, "%s\t%08X\t%08X\t%8X\t%d\t%u\t%d\t" | 427 | seq_printf(seq, "%s\t%08X\t%08X\t%8X\t%d\t%u\t%d\t" |
| 423 | "%08X\t%d\t%u\t%u\t%02X\t%d\t%1d\t%08X%n", | 428 | "%08X\t%d\t%u\t%u\t%02X\t%d\t%1d\t%08X%n", |
| 424 | r->dst.dev ? r->dst.dev->name : "*", | 429 | r->dst.dev ? r->dst.dev->name : "*", |
| @@ -432,7 +437,7 @@ static int rt_cache_seq_show(struct seq_file *seq, void *v) | |||
| 432 | dst_metric(&r->dst, RTAX_RTTVAR)), | 437 | dst_metric(&r->dst, RTAX_RTTVAR)), |
| 433 | r->rt_key_tos, | 438 | r->rt_key_tos, |
| 434 | -1, | 439 | -1, |
| 435 | (n && (n->nud_state & NUD_CONNECTED)) ? 1 : 0, | 440 | HHUptod, |
| 436 | r->rt_spec_dst, &len); | 441 | r->rt_spec_dst, &len); |
| 437 | 442 | ||
| 438 | seq_printf(seq, "%*s\n", 127 - len, ""); | 443 | seq_printf(seq, "%*s\n", 127 - len, ""); |
| @@ -837,6 +842,7 @@ static void rt_cache_invalidate(struct net *net) | |||
| 837 | 842 | ||
| 838 | get_random_bytes(&shuffle, sizeof(shuffle)); | 843 | get_random_bytes(&shuffle, sizeof(shuffle)); |
| 839 | atomic_add(shuffle + 1U, &net->ipv4.rt_genid); | 844 | atomic_add(shuffle + 1U, &net->ipv4.rt_genid); |
| 845 | redirect_genid++; | ||
| 840 | } | 846 | } |
| 841 | 847 | ||
| 842 | /* | 848 | /* |
| @@ -1391,8 +1397,10 @@ void ip_rt_redirect(__be32 old_gw, __be32 daddr, __be32 new_gw, | |||
| 1391 | 1397 | ||
| 1392 | peer = rt->peer; | 1398 | peer = rt->peer; |
| 1393 | if (peer) { | 1399 | if (peer) { |
| 1394 | if (peer->redirect_learned.a4 != new_gw) { | 1400 | if (peer->redirect_learned.a4 != new_gw || |
| 1401 | peer->redirect_genid != redirect_genid) { | ||
| 1395 | peer->redirect_learned.a4 = new_gw; | 1402 | peer->redirect_learned.a4 = new_gw; |
| 1403 | peer->redirect_genid = redirect_genid; | ||
| 1396 | atomic_inc(&__rt_peer_genid); | 1404 | atomic_inc(&__rt_peer_genid); |
| 1397 | } | 1405 | } |
| 1398 | check_peer_redir(&rt->dst, peer); | 1406 | check_peer_redir(&rt->dst, peer); |
| @@ -1685,12 +1693,8 @@ static void ip_rt_update_pmtu(struct dst_entry *dst, u32 mtu) | |||
| 1685 | } | 1693 | } |
| 1686 | 1694 | ||
| 1687 | 1695 | ||
| 1688 | static struct dst_entry *ipv4_dst_check(struct dst_entry *dst, u32 cookie) | 1696 | static struct rtable *ipv4_validate_peer(struct rtable *rt) |
| 1689 | { | 1697 | { |
| 1690 | struct rtable *rt = (struct rtable *) dst; | ||
| 1691 | |||
| 1692 | if (rt_is_expired(rt)) | ||
| 1693 | return NULL; | ||
| 1694 | if (rt->rt_peer_genid != rt_peer_genid()) { | 1698 | if (rt->rt_peer_genid != rt_peer_genid()) { |
| 1695 | struct inet_peer *peer; | 1699 | struct inet_peer *peer; |
| 1696 | 1700 | ||
| @@ -1699,17 +1703,29 @@ static struct dst_entry *ipv4_dst_check(struct dst_entry *dst, u32 cookie) | |||
| 1699 | 1703 | ||
| 1700 | peer = rt->peer; | 1704 | peer = rt->peer; |
| 1701 | if (peer) { | 1705 | if (peer) { |
| 1702 | check_peer_pmtu(dst, peer); | 1706 | check_peer_pmtu(&rt->dst, peer); |
| 1703 | 1707 | ||
| 1708 | if (peer->redirect_genid != redirect_genid) | ||
| 1709 | peer->redirect_learned.a4 = 0; | ||
| 1704 | if (peer->redirect_learned.a4 && | 1710 | if (peer->redirect_learned.a4 && |
| 1705 | peer->redirect_learned.a4 != rt->rt_gateway) { | 1711 | peer->redirect_learned.a4 != rt->rt_gateway) { |
| 1706 | if (check_peer_redir(dst, peer)) | 1712 | if (check_peer_redir(&rt->dst, peer)) |
| 1707 | return NULL; | 1713 | return NULL; |
| 1708 | } | 1714 | } |
| 1709 | } | 1715 | } |
| 1710 | 1716 | ||
| 1711 | rt->rt_peer_genid = rt_peer_genid(); | 1717 | rt->rt_peer_genid = rt_peer_genid(); |
| 1712 | } | 1718 | } |
| 1719 | return rt; | ||
| 1720 | } | ||
| 1721 | |||
| 1722 | static struct dst_entry *ipv4_dst_check(struct dst_entry *dst, u32 cookie) | ||
| 1723 | { | ||
| 1724 | struct rtable *rt = (struct rtable *) dst; | ||
| 1725 | |||
| 1726 | if (rt_is_expired(rt)) | ||
| 1727 | return NULL; | ||
| 1728 | dst = (struct dst_entry *) ipv4_validate_peer(rt); | ||
| 1713 | return dst; | 1729 | return dst; |
| 1714 | } | 1730 | } |
| 1715 | 1731 | ||
| @@ -1814,12 +1830,17 @@ static unsigned int ipv4_default_advmss(const struct dst_entry *dst) | |||
| 1814 | return advmss; | 1830 | return advmss; |
| 1815 | } | 1831 | } |
| 1816 | 1832 | ||
| 1817 | static unsigned int ipv4_default_mtu(const struct dst_entry *dst) | 1833 | static unsigned int ipv4_mtu(const struct dst_entry *dst) |
| 1818 | { | 1834 | { |
| 1819 | unsigned int mtu = dst->dev->mtu; | 1835 | const struct rtable *rt = (const struct rtable *) dst; |
| 1836 | unsigned int mtu = dst_metric_raw(dst, RTAX_MTU); | ||
| 1837 | |||
| 1838 | if (mtu && rt_is_output_route(rt)) | ||
| 1839 | return mtu; | ||
| 1840 | |||
| 1841 | mtu = dst->dev->mtu; | ||
| 1820 | 1842 | ||
| 1821 | if (unlikely(dst_metric_locked(dst, RTAX_MTU))) { | 1843 | if (unlikely(dst_metric_locked(dst, RTAX_MTU))) { |
| 1822 | const struct rtable *rt = (const struct rtable *) dst; | ||
| 1823 | 1844 | ||
| 1824 | if (rt->rt_gateway != rt->rt_dst && mtu > 576) | 1845 | if (rt->rt_gateway != rt->rt_dst && mtu > 576) |
| 1825 | mtu = 576; | 1846 | mtu = 576; |
| @@ -1852,6 +1873,8 @@ static void rt_init_metrics(struct rtable *rt, const struct flowi4 *fl4, | |||
| 1852 | dst_init_metrics(&rt->dst, peer->metrics, false); | 1873 | dst_init_metrics(&rt->dst, peer->metrics, false); |
| 1853 | 1874 | ||
| 1854 | check_peer_pmtu(&rt->dst, peer); | 1875 | check_peer_pmtu(&rt->dst, peer); |
| 1876 | if (peer->redirect_genid != redirect_genid) | ||
| 1877 | peer->redirect_learned.a4 = 0; | ||
| 1855 | if (peer->redirect_learned.a4 && | 1878 | if (peer->redirect_learned.a4 && |
| 1856 | peer->redirect_learned.a4 != rt->rt_gateway) { | 1879 | peer->redirect_learned.a4 != rt->rt_gateway) { |
| 1857 | rt->rt_gateway = peer->redirect_learned.a4; | 1880 | rt->rt_gateway = peer->redirect_learned.a4; |
| @@ -2357,6 +2380,9 @@ int ip_route_input_common(struct sk_buff *skb, __be32 daddr, __be32 saddr, | |||
| 2357 | rth->rt_mark == skb->mark && | 2380 | rth->rt_mark == skb->mark && |
| 2358 | net_eq(dev_net(rth->dst.dev), net) && | 2381 | net_eq(dev_net(rth->dst.dev), net) && |
| 2359 | !rt_is_expired(rth)) { | 2382 | !rt_is_expired(rth)) { |
| 2383 | rth = ipv4_validate_peer(rth); | ||
| 2384 | if (!rth) | ||
| 2385 | continue; | ||
| 2360 | if (noref) { | 2386 | if (noref) { |
| 2361 | dst_use_noref(&rth->dst, jiffies); | 2387 | dst_use_noref(&rth->dst, jiffies); |
| 2362 | skb_dst_set_noref(skb, &rth->dst); | 2388 | skb_dst_set_noref(skb, &rth->dst); |
| @@ -2732,6 +2758,9 @@ struct rtable *__ip_route_output_key(struct net *net, struct flowi4 *flp4) | |||
| 2732 | (IPTOS_RT_MASK | RTO_ONLINK)) && | 2758 | (IPTOS_RT_MASK | RTO_ONLINK)) && |
| 2733 | net_eq(dev_net(rth->dst.dev), net) && | 2759 | net_eq(dev_net(rth->dst.dev), net) && |
| 2734 | !rt_is_expired(rth)) { | 2760 | !rt_is_expired(rth)) { |
| 2761 | rth = ipv4_validate_peer(rth); | ||
| 2762 | if (!rth) | ||
| 2763 | continue; | ||
| 2735 | dst_use(&rth->dst, jiffies); | 2764 | dst_use(&rth->dst, jiffies); |
| 2736 | RT_CACHE_STAT_INC(out_hit); | 2765 | RT_CACHE_STAT_INC(out_hit); |
| 2737 | rcu_read_unlock_bh(); | 2766 | rcu_read_unlock_bh(); |
| @@ -2755,9 +2784,11 @@ static struct dst_entry *ipv4_blackhole_dst_check(struct dst_entry *dst, u32 coo | |||
| 2755 | return NULL; | 2784 | return NULL; |
| 2756 | } | 2785 | } |
| 2757 | 2786 | ||
| 2758 | static unsigned int ipv4_blackhole_default_mtu(const struct dst_entry *dst) | 2787 | static unsigned int ipv4_blackhole_mtu(const struct dst_entry *dst) |
| 2759 | { | 2788 | { |
| 2760 | return 0; | 2789 | unsigned int mtu = dst_metric_raw(dst, RTAX_MTU); |
| 2790 | |||
| 2791 | return mtu ? : dst->dev->mtu; | ||
| 2761 | } | 2792 | } |
| 2762 | 2793 | ||
| 2763 | static void ipv4_rt_blackhole_update_pmtu(struct dst_entry *dst, u32 mtu) | 2794 | static void ipv4_rt_blackhole_update_pmtu(struct dst_entry *dst, u32 mtu) |
| @@ -2775,7 +2806,7 @@ static struct dst_ops ipv4_dst_blackhole_ops = { | |||
| 2775 | .protocol = cpu_to_be16(ETH_P_IP), | 2806 | .protocol = cpu_to_be16(ETH_P_IP), |
| 2776 | .destroy = ipv4_dst_destroy, | 2807 | .destroy = ipv4_dst_destroy, |
| 2777 | .check = ipv4_blackhole_dst_check, | 2808 | .check = ipv4_blackhole_dst_check, |
| 2778 | .default_mtu = ipv4_blackhole_default_mtu, | 2809 | .mtu = ipv4_blackhole_mtu, |
| 2779 | .default_advmss = ipv4_default_advmss, | 2810 | .default_advmss = ipv4_default_advmss, |
| 2780 | .update_pmtu = ipv4_rt_blackhole_update_pmtu, | 2811 | .update_pmtu = ipv4_rt_blackhole_update_pmtu, |
| 2781 | .cow_metrics = ipv4_rt_blackhole_cow_metrics, | 2812 | .cow_metrics = ipv4_rt_blackhole_cow_metrics, |
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c index ab0966df1e2a..5a65eeac1d29 100644 --- a/net/ipv4/udp.c +++ b/net/ipv4/udp.c | |||
| @@ -1164,7 +1164,7 @@ int udp_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, | |||
| 1164 | struct inet_sock *inet = inet_sk(sk); | 1164 | struct inet_sock *inet = inet_sk(sk); |
| 1165 | struct sockaddr_in *sin = (struct sockaddr_in *)msg->msg_name; | 1165 | struct sockaddr_in *sin = (struct sockaddr_in *)msg->msg_name; |
| 1166 | struct sk_buff *skb; | 1166 | struct sk_buff *skb; |
| 1167 | unsigned int ulen; | 1167 | unsigned int ulen, copied; |
| 1168 | int peeked; | 1168 | int peeked; |
| 1169 | int err; | 1169 | int err; |
| 1170 | int is_udplite = IS_UDPLITE(sk); | 1170 | int is_udplite = IS_UDPLITE(sk); |
| @@ -1186,9 +1186,10 @@ try_again: | |||
| 1186 | goto out; | 1186 | goto out; |
| 1187 | 1187 | ||
| 1188 | ulen = skb->len - sizeof(struct udphdr); | 1188 | ulen = skb->len - sizeof(struct udphdr); |
| 1189 | if (len > ulen) | 1189 | copied = len; |
| 1190 | len = ulen; | 1190 | if (copied > ulen) |
| 1191 | else if (len < ulen) | 1191 | copied = ulen; |
| 1192 | else if (copied < ulen) | ||
| 1192 | msg->msg_flags |= MSG_TRUNC; | 1193 | msg->msg_flags |= MSG_TRUNC; |
| 1193 | 1194 | ||
| 1194 | /* | 1195 | /* |
| @@ -1197,14 +1198,14 @@ try_again: | |||
| 1197 | * coverage checksum (UDP-Lite), do it before the copy. | 1198 | * coverage checksum (UDP-Lite), do it before the copy. |
| 1198 | */ | 1199 | */ |
| 1199 | 1200 | ||
| 1200 | if (len < ulen || UDP_SKB_CB(skb)->partial_cov) { | 1201 | if (copied < ulen || UDP_SKB_CB(skb)->partial_cov) { |
| 1201 | if (udp_lib_checksum_complete(skb)) | 1202 | if (udp_lib_checksum_complete(skb)) |
| 1202 | goto csum_copy_err; | 1203 | goto csum_copy_err; |
| 1203 | } | 1204 | } |
| 1204 | 1205 | ||
| 1205 | if (skb_csum_unnecessary(skb)) | 1206 | if (skb_csum_unnecessary(skb)) |
| 1206 | err = skb_copy_datagram_iovec(skb, sizeof(struct udphdr), | 1207 | err = skb_copy_datagram_iovec(skb, sizeof(struct udphdr), |
| 1207 | msg->msg_iov, len); | 1208 | msg->msg_iov, copied); |
| 1208 | else { | 1209 | else { |
| 1209 | err = skb_copy_and_csum_datagram_iovec(skb, | 1210 | err = skb_copy_and_csum_datagram_iovec(skb, |
| 1210 | sizeof(struct udphdr), | 1211 | sizeof(struct udphdr), |
| @@ -1233,7 +1234,7 @@ try_again: | |||
| 1233 | if (inet->cmsg_flags) | 1234 | if (inet->cmsg_flags) |
| 1234 | ip_cmsg_recv(msg, skb); | 1235 | ip_cmsg_recv(msg, skb); |
| 1235 | 1236 | ||
| 1236 | err = len; | 1237 | err = copied; |
| 1237 | if (flags & MSG_TRUNC) | 1238 | if (flags & MSG_TRUNC) |
| 1238 | err = ulen; | 1239 | err = ulen; |
| 1239 | 1240 | ||
diff --git a/net/ipv6/inet6_connection_sock.c b/net/ipv6/inet6_connection_sock.c index fee46d5a2f12..1567fb120392 100644 --- a/net/ipv6/inet6_connection_sock.c +++ b/net/ipv6/inet6_connection_sock.c | |||
| @@ -85,7 +85,7 @@ struct dst_entry *inet6_csk_route_req(struct sock *sk, | |||
| 85 | * request_sock (formerly open request) hash tables. | 85 | * request_sock (formerly open request) hash tables. |
| 86 | */ | 86 | */ |
| 87 | static u32 inet6_synq_hash(const struct in6_addr *raddr, const __be16 rport, | 87 | static u32 inet6_synq_hash(const struct in6_addr *raddr, const __be16 rport, |
| 88 | const u32 rnd, const u16 synq_hsize) | 88 | const u32 rnd, const u32 synq_hsize) |
| 89 | { | 89 | { |
| 90 | u32 c; | 90 | u32 c; |
| 91 | 91 | ||
diff --git a/net/ipv6/ipv6_sockglue.c b/net/ipv6/ipv6_sockglue.c index c99e3ee9781f..26cb08c84b74 100644 --- a/net/ipv6/ipv6_sockglue.c +++ b/net/ipv6/ipv6_sockglue.c | |||
| @@ -503,7 +503,7 @@ done: | |||
| 503 | goto e_inval; | 503 | goto e_inval; |
| 504 | if (val > 255 || val < -1) | 504 | if (val > 255 || val < -1) |
| 505 | goto e_inval; | 505 | goto e_inval; |
| 506 | np->mcast_hops = val; | 506 | np->mcast_hops = (val == -1 ? IPV6_DEFAULT_MCASTHOPS : val); |
| 507 | retv = 0; | 507 | retv = 0; |
| 508 | break; | 508 | break; |
| 509 | 509 | ||
diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c index 44e5b7f2a6c1..0cb78d7ddaf5 100644 --- a/net/ipv6/ndisc.c +++ b/net/ipv6/ndisc.c | |||
| @@ -1571,7 +1571,7 @@ void ndisc_send_redirect(struct sk_buff *skb, struct neighbour *neigh, | |||
| 1571 | } | 1571 | } |
| 1572 | if (!rt->rt6i_peer) | 1572 | if (!rt->rt6i_peer) |
| 1573 | rt6_bind_peer(rt, 1); | 1573 | rt6_bind_peer(rt, 1); |
| 1574 | if (inet_peer_xrlim_allow(rt->rt6i_peer, 1*HZ)) | 1574 | if (!inet_peer_xrlim_allow(rt->rt6i_peer, 1*HZ)) |
| 1575 | goto release; | 1575 | goto release; |
| 1576 | 1576 | ||
| 1577 | if (dev->addr_len) { | 1577 | if (dev->addr_len) { |
diff --git a/net/ipv6/netfilter/Kconfig b/net/ipv6/netfilter/Kconfig index 448464844a25..f792b34cbe9c 100644 --- a/net/ipv6/netfilter/Kconfig +++ b/net/ipv6/netfilter/Kconfig | |||
| @@ -186,7 +186,6 @@ config IP6_NF_MANGLE | |||
| 186 | 186 | ||
| 187 | config IP6_NF_RAW | 187 | config IP6_NF_RAW |
| 188 | tristate 'raw table support (required for TRACE)' | 188 | tristate 'raw table support (required for TRACE)' |
| 189 | depends on NETFILTER_ADVANCED | ||
| 190 | help | 189 | help |
| 191 | This option adds a `raw' table to ip6tables. This table is the very | 190 | This option adds a `raw' table to ip6tables. This table is the very |
| 192 | first in the netfilter framework and hooks in at the PREROUTING | 191 | first in the netfilter framework and hooks in at the PREROUTING |
diff --git a/net/ipv6/route.c b/net/ipv6/route.c index 8473016bba4a..3399dd326287 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c | |||
| @@ -77,7 +77,7 @@ static struct rt6_info *ip6_rt_copy(const struct rt6_info *ort, | |||
| 77 | const struct in6_addr *dest); | 77 | const struct in6_addr *dest); |
| 78 | static struct dst_entry *ip6_dst_check(struct dst_entry *dst, u32 cookie); | 78 | static struct dst_entry *ip6_dst_check(struct dst_entry *dst, u32 cookie); |
| 79 | static unsigned int ip6_default_advmss(const struct dst_entry *dst); | 79 | static unsigned int ip6_default_advmss(const struct dst_entry *dst); |
| 80 | static unsigned int ip6_default_mtu(const struct dst_entry *dst); | 80 | static unsigned int ip6_mtu(const struct dst_entry *dst); |
| 81 | static struct dst_entry *ip6_negative_advice(struct dst_entry *); | 81 | static struct dst_entry *ip6_negative_advice(struct dst_entry *); |
| 82 | static void ip6_dst_destroy(struct dst_entry *); | 82 | static void ip6_dst_destroy(struct dst_entry *); |
| 83 | static void ip6_dst_ifdown(struct dst_entry *, | 83 | static void ip6_dst_ifdown(struct dst_entry *, |
| @@ -144,7 +144,7 @@ static struct dst_ops ip6_dst_ops_template = { | |||
| 144 | .gc_thresh = 1024, | 144 | .gc_thresh = 1024, |
| 145 | .check = ip6_dst_check, | 145 | .check = ip6_dst_check, |
| 146 | .default_advmss = ip6_default_advmss, | 146 | .default_advmss = ip6_default_advmss, |
| 147 | .default_mtu = ip6_default_mtu, | 147 | .mtu = ip6_mtu, |
| 148 | .cow_metrics = ipv6_cow_metrics, | 148 | .cow_metrics = ipv6_cow_metrics, |
| 149 | .destroy = ip6_dst_destroy, | 149 | .destroy = ip6_dst_destroy, |
| 150 | .ifdown = ip6_dst_ifdown, | 150 | .ifdown = ip6_dst_ifdown, |
| @@ -155,9 +155,11 @@ static struct dst_ops ip6_dst_ops_template = { | |||
| 155 | .neigh_lookup = ip6_neigh_lookup, | 155 | .neigh_lookup = ip6_neigh_lookup, |
| 156 | }; | 156 | }; |
| 157 | 157 | ||
| 158 | static unsigned int ip6_blackhole_default_mtu(const struct dst_entry *dst) | 158 | static unsigned int ip6_blackhole_mtu(const struct dst_entry *dst) |
| 159 | { | 159 | { |
| 160 | return 0; | 160 | unsigned int mtu = dst_metric_raw(dst, RTAX_MTU); |
| 161 | |||
| 162 | return mtu ? : dst->dev->mtu; | ||
| 161 | } | 163 | } |
| 162 | 164 | ||
| 163 | static void ip6_rt_blackhole_update_pmtu(struct dst_entry *dst, u32 mtu) | 165 | static void ip6_rt_blackhole_update_pmtu(struct dst_entry *dst, u32 mtu) |
| @@ -175,7 +177,7 @@ static struct dst_ops ip6_dst_blackhole_ops = { | |||
| 175 | .protocol = cpu_to_be16(ETH_P_IPV6), | 177 | .protocol = cpu_to_be16(ETH_P_IPV6), |
| 176 | .destroy = ip6_dst_destroy, | 178 | .destroy = ip6_dst_destroy, |
| 177 | .check = ip6_dst_check, | 179 | .check = ip6_dst_check, |
| 178 | .default_mtu = ip6_blackhole_default_mtu, | 180 | .mtu = ip6_blackhole_mtu, |
| 179 | .default_advmss = ip6_default_advmss, | 181 | .default_advmss = ip6_default_advmss, |
| 180 | .update_pmtu = ip6_rt_blackhole_update_pmtu, | 182 | .update_pmtu = ip6_rt_blackhole_update_pmtu, |
| 181 | .cow_metrics = ip6_rt_blackhole_cow_metrics, | 183 | .cow_metrics = ip6_rt_blackhole_cow_metrics, |
| @@ -1041,10 +1043,15 @@ static unsigned int ip6_default_advmss(const struct dst_entry *dst) | |||
| 1041 | return mtu; | 1043 | return mtu; |
| 1042 | } | 1044 | } |
| 1043 | 1045 | ||
| 1044 | static unsigned int ip6_default_mtu(const struct dst_entry *dst) | 1046 | static unsigned int ip6_mtu(const struct dst_entry *dst) |
| 1045 | { | 1047 | { |
| 1046 | unsigned int mtu = IPV6_MIN_MTU; | ||
| 1047 | struct inet6_dev *idev; | 1048 | struct inet6_dev *idev; |
| 1049 | unsigned int mtu = dst_metric_raw(dst, RTAX_MTU); | ||
| 1050 | |||
| 1051 | if (mtu) | ||
| 1052 | return mtu; | ||
| 1053 | |||
| 1054 | mtu = IPV6_MIN_MTU; | ||
| 1048 | 1055 | ||
| 1049 | rcu_read_lock(); | 1056 | rcu_read_lock(); |
| 1050 | idev = __in6_dev_get(dst->dev); | 1057 | idev = __in6_dev_get(dst->dev); |
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c index 36131d122a6f..2dea4bb7b54a 100644 --- a/net/ipv6/tcp_ipv6.c +++ b/net/ipv6/tcp_ipv6.c | |||
| @@ -1255,6 +1255,13 @@ static int tcp_v6_conn_request(struct sock *sk, struct sk_buff *skb) | |||
| 1255 | if (!want_cookie || tmp_opt.tstamp_ok) | 1255 | if (!want_cookie || tmp_opt.tstamp_ok) |
| 1256 | TCP_ECN_create_request(req, tcp_hdr(skb)); | 1256 | TCP_ECN_create_request(req, tcp_hdr(skb)); |
| 1257 | 1257 | ||
| 1258 | treq->iif = sk->sk_bound_dev_if; | ||
| 1259 | |||
| 1260 | /* So that link locals have meaning */ | ||
| 1261 | if (!sk->sk_bound_dev_if && | ||
| 1262 | ipv6_addr_type(&treq->rmt_addr) & IPV6_ADDR_LINKLOCAL) | ||
| 1263 | treq->iif = inet6_iif(skb); | ||
| 1264 | |||
| 1258 | if (!isn) { | 1265 | if (!isn) { |
| 1259 | struct inet_peer *peer = NULL; | 1266 | struct inet_peer *peer = NULL; |
| 1260 | 1267 | ||
| @@ -1264,12 +1271,6 @@ static int tcp_v6_conn_request(struct sock *sk, struct sk_buff *skb) | |||
| 1264 | atomic_inc(&skb->users); | 1271 | atomic_inc(&skb->users); |
| 1265 | treq->pktopts = skb; | 1272 | treq->pktopts = skb; |
| 1266 | } | 1273 | } |
| 1267 | treq->iif = sk->sk_bound_dev_if; | ||
| 1268 | |||
| 1269 | /* So that link locals have meaning */ | ||
| 1270 | if (!sk->sk_bound_dev_if && | ||
| 1271 | ipv6_addr_type(&treq->rmt_addr) & IPV6_ADDR_LINKLOCAL) | ||
| 1272 | treq->iif = inet6_iif(skb); | ||
| 1273 | 1274 | ||
| 1274 | if (want_cookie) { | 1275 | if (want_cookie) { |
| 1275 | isn = cookie_v6_init_sequence(sk, skb, &req->mss); | 1276 | isn = cookie_v6_init_sequence(sk, skb, &req->mss); |
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c index 846f4757eb8d..8c2541915183 100644 --- a/net/ipv6/udp.c +++ b/net/ipv6/udp.c | |||
| @@ -340,7 +340,7 @@ int udpv6_recvmsg(struct kiocb *iocb, struct sock *sk, | |||
| 340 | struct ipv6_pinfo *np = inet6_sk(sk); | 340 | struct ipv6_pinfo *np = inet6_sk(sk); |
| 341 | struct inet_sock *inet = inet_sk(sk); | 341 | struct inet_sock *inet = inet_sk(sk); |
| 342 | struct sk_buff *skb; | 342 | struct sk_buff *skb; |
| 343 | unsigned int ulen; | 343 | unsigned int ulen, copied; |
| 344 | int peeked; | 344 | int peeked; |
| 345 | int err; | 345 | int err; |
| 346 | int is_udplite = IS_UDPLITE(sk); | 346 | int is_udplite = IS_UDPLITE(sk); |
| @@ -363,9 +363,10 @@ try_again: | |||
| 363 | goto out; | 363 | goto out; |
| 364 | 364 | ||
| 365 | ulen = skb->len - sizeof(struct udphdr); | 365 | ulen = skb->len - sizeof(struct udphdr); |
| 366 | if (len > ulen) | 366 | copied = len; |
| 367 | len = ulen; | 367 | if (copied > ulen) |
| 368 | else if (len < ulen) | 368 | copied = ulen; |
| 369 | else if (copied < ulen) | ||
| 369 | msg->msg_flags |= MSG_TRUNC; | 370 | msg->msg_flags |= MSG_TRUNC; |
| 370 | 371 | ||
| 371 | is_udp4 = (skb->protocol == htons(ETH_P_IP)); | 372 | is_udp4 = (skb->protocol == htons(ETH_P_IP)); |
| @@ -376,14 +377,14 @@ try_again: | |||
| 376 | * coverage checksum (UDP-Lite), do it before the copy. | 377 | * coverage checksum (UDP-Lite), do it before the copy. |
| 377 | */ | 378 | */ |
| 378 | 379 | ||
| 379 | if (len < ulen || UDP_SKB_CB(skb)->partial_cov) { | 380 | if (copied < ulen || UDP_SKB_CB(skb)->partial_cov) { |
| 380 | if (udp_lib_checksum_complete(skb)) | 381 | if (udp_lib_checksum_complete(skb)) |
| 381 | goto csum_copy_err; | 382 | goto csum_copy_err; |
| 382 | } | 383 | } |
| 383 | 384 | ||
| 384 | if (skb_csum_unnecessary(skb)) | 385 | if (skb_csum_unnecessary(skb)) |
| 385 | err = skb_copy_datagram_iovec(skb, sizeof(struct udphdr), | 386 | err = skb_copy_datagram_iovec(skb, sizeof(struct udphdr), |
| 386 | msg->msg_iov,len); | 387 | msg->msg_iov, copied ); |
| 387 | else { | 388 | else { |
| 388 | err = skb_copy_and_csum_datagram_iovec(skb, sizeof(struct udphdr), msg->msg_iov); | 389 | err = skb_copy_and_csum_datagram_iovec(skb, sizeof(struct udphdr), msg->msg_iov); |
| 389 | if (err == -EINVAL) | 390 | if (err == -EINVAL) |
| @@ -432,7 +433,7 @@ try_again: | |||
| 432 | datagram_recv_ctl(sk, msg, skb); | 433 | datagram_recv_ctl(sk, msg, skb); |
| 433 | } | 434 | } |
| 434 | 435 | ||
| 435 | err = len; | 436 | err = copied; |
| 436 | if (flags & MSG_TRUNC) | 437 | if (flags & MSG_TRUNC) |
| 437 | err = ulen; | 438 | err = ulen; |
| 438 | 439 | ||
diff --git a/net/l2tp/l2tp_core.c b/net/l2tp/l2tp_core.c index cf0f308abf5e..89ff8c67943e 100644 --- a/net/l2tp/l2tp_core.c +++ b/net/l2tp/l2tp_core.c | |||
| @@ -1072,7 +1072,7 @@ int l2tp_xmit_skb(struct l2tp_session *session, struct sk_buff *skb, int hdr_len | |||
| 1072 | 1072 | ||
| 1073 | /* Get routing info from the tunnel socket */ | 1073 | /* Get routing info from the tunnel socket */ |
| 1074 | skb_dst_drop(skb); | 1074 | skb_dst_drop(skb); |
| 1075 | skb_dst_set(skb, dst_clone(__sk_dst_get(sk))); | 1075 | skb_dst_set(skb, dst_clone(__sk_dst_check(sk, 0))); |
| 1076 | 1076 | ||
| 1077 | inet = inet_sk(sk); | 1077 | inet = inet_sk(sk); |
| 1078 | fl = &inet->cork.fl; | 1078 | fl = &inet->cork.fl; |
diff --git a/net/mac80211/agg-tx.c b/net/mac80211/agg-tx.c index b3f65520e7a7..b064e4df12c6 100644 --- a/net/mac80211/agg-tx.c +++ b/net/mac80211/agg-tx.c | |||
| @@ -161,6 +161,12 @@ int ___ieee80211_stop_tx_ba_session(struct sta_info *sta, u16 tid, | |||
| 161 | return -ENOENT; | 161 | return -ENOENT; |
| 162 | } | 162 | } |
| 163 | 163 | ||
| 164 | /* if we're already stopping ignore any new requests to stop */ | ||
| 165 | if (test_bit(HT_AGG_STATE_STOPPING, &tid_tx->state)) { | ||
| 166 | spin_unlock_bh(&sta->lock); | ||
| 167 | return -EALREADY; | ||
| 168 | } | ||
| 169 | |||
| 164 | if (test_bit(HT_AGG_STATE_WANT_START, &tid_tx->state)) { | 170 | if (test_bit(HT_AGG_STATE_WANT_START, &tid_tx->state)) { |
| 165 | /* not even started yet! */ | 171 | /* not even started yet! */ |
| 166 | ieee80211_assign_tid_tx(sta, tid, NULL); | 172 | ieee80211_assign_tid_tx(sta, tid, NULL); |
| @@ -169,6 +175,8 @@ int ___ieee80211_stop_tx_ba_session(struct sta_info *sta, u16 tid, | |||
| 169 | return 0; | 175 | return 0; |
| 170 | } | 176 | } |
| 171 | 177 | ||
| 178 | set_bit(HT_AGG_STATE_STOPPING, &tid_tx->state); | ||
| 179 | |||
| 172 | spin_unlock_bh(&sta->lock); | 180 | spin_unlock_bh(&sta->lock); |
| 173 | 181 | ||
| 174 | #ifdef CONFIG_MAC80211_HT_DEBUG | 182 | #ifdef CONFIG_MAC80211_HT_DEBUG |
| @@ -176,8 +184,6 @@ int ___ieee80211_stop_tx_ba_session(struct sta_info *sta, u16 tid, | |||
| 176 | sta->sta.addr, tid); | 184 | sta->sta.addr, tid); |
| 177 | #endif /* CONFIG_MAC80211_HT_DEBUG */ | 185 | #endif /* CONFIG_MAC80211_HT_DEBUG */ |
| 178 | 186 | ||
| 179 | set_bit(HT_AGG_STATE_STOPPING, &tid_tx->state); | ||
| 180 | |||
| 181 | del_timer_sync(&tid_tx->addba_resp_timer); | 187 | del_timer_sync(&tid_tx->addba_resp_timer); |
| 182 | 188 | ||
| 183 | /* | 189 | /* |
| @@ -187,6 +193,20 @@ int ___ieee80211_stop_tx_ba_session(struct sta_info *sta, u16 tid, | |||
| 187 | */ | 193 | */ |
| 188 | clear_bit(HT_AGG_STATE_OPERATIONAL, &tid_tx->state); | 194 | clear_bit(HT_AGG_STATE_OPERATIONAL, &tid_tx->state); |
| 189 | 195 | ||
| 196 | /* | ||
| 197 | * There might be a few packets being processed right now (on | ||
| 198 | * another CPU) that have already gotten past the aggregation | ||
| 199 | * check when it was still OPERATIONAL and consequently have | ||
| 200 | * IEEE80211_TX_CTL_AMPDU set. In that case, this code might | ||
| 201 | * call into the driver at the same time or even before the | ||
| 202 | * TX paths calls into it, which could confuse the driver. | ||
| 203 | * | ||
| 204 | * Wait for all currently running TX paths to finish before | ||
| 205 | * telling the driver. New packets will not go through since | ||
| 206 | * the aggregation session is no longer OPERATIONAL. | ||
| 207 | */ | ||
| 208 | synchronize_net(); | ||
| 209 | |||
| 190 | tid_tx->stop_initiator = initiator; | 210 | tid_tx->stop_initiator = initiator; |
| 191 | tid_tx->tx_stop = tx; | 211 | tid_tx->tx_stop = tx; |
| 192 | 212 | ||
| @@ -757,11 +777,27 @@ void ieee80211_process_addba_resp(struct ieee80211_local *local, | |||
| 757 | goto out; | 777 | goto out; |
| 758 | } | 778 | } |
| 759 | 779 | ||
| 760 | del_timer(&tid_tx->addba_resp_timer); | 780 | del_timer_sync(&tid_tx->addba_resp_timer); |
| 761 | 781 | ||
| 762 | #ifdef CONFIG_MAC80211_HT_DEBUG | 782 | #ifdef CONFIG_MAC80211_HT_DEBUG |
| 763 | printk(KERN_DEBUG "switched off addBA timer for tid %d\n", tid); | 783 | printk(KERN_DEBUG "switched off addBA timer for tid %d\n", tid); |
| 764 | #endif | 784 | #endif |
| 785 | |||
| 786 | /* | ||
| 787 | * addba_resp_timer may have fired before we got here, and | ||
| 788 | * caused WANT_STOP to be set. If the stop then was already | ||
| 789 | * processed further, STOPPING might be set. | ||
| 790 | */ | ||
| 791 | if (test_bit(HT_AGG_STATE_WANT_STOP, &tid_tx->state) || | ||
| 792 | test_bit(HT_AGG_STATE_STOPPING, &tid_tx->state)) { | ||
| 793 | #ifdef CONFIG_MAC80211_HT_DEBUG | ||
| 794 | printk(KERN_DEBUG | ||
| 795 | "got addBA resp for tid %d but we already gave up\n", | ||
| 796 | tid); | ||
| 797 | #endif | ||
| 798 | goto out; | ||
| 799 | } | ||
| 800 | |||
| 765 | /* | 801 | /* |
| 766 | * IEEE 802.11-2007 7.3.1.14: | 802 | * IEEE 802.11-2007 7.3.1.14: |
| 767 | * In an ADDBA Response frame, when the Status Code field | 803 | * In an ADDBA Response frame, when the Status Code field |
diff --git a/net/mac80211/debugfs_sta.c b/net/mac80211/debugfs_sta.c index c5f341798c16..3110cbdc501b 100644 --- a/net/mac80211/debugfs_sta.c +++ b/net/mac80211/debugfs_sta.c | |||
| @@ -274,9 +274,9 @@ static ssize_t sta_ht_capa_read(struct file *file, char __user *userbuf, | |||
| 274 | 274 | ||
| 275 | PRINT_HT_CAP((htc->cap & BIT(10)), "HT Delayed Block Ack"); | 275 | PRINT_HT_CAP((htc->cap & BIT(10)), "HT Delayed Block Ack"); |
| 276 | 276 | ||
| 277 | PRINT_HT_CAP((htc->cap & BIT(11)), "Max AMSDU length: " | ||
| 278 | "3839 bytes"); | ||
| 279 | PRINT_HT_CAP(!(htc->cap & BIT(11)), "Max AMSDU length: " | 277 | PRINT_HT_CAP(!(htc->cap & BIT(11)), "Max AMSDU length: " |
| 278 | "3839 bytes"); | ||
| 279 | PRINT_HT_CAP((htc->cap & BIT(11)), "Max AMSDU length: " | ||
| 280 | "7935 bytes"); | 280 | "7935 bytes"); |
| 281 | 281 | ||
| 282 | /* | 282 | /* |
diff --git a/net/mac80211/status.c b/net/mac80211/status.c index 80de436eae20..16518f386117 100644 --- a/net/mac80211/status.c +++ b/net/mac80211/status.c | |||
| @@ -260,7 +260,7 @@ static void ieee80211_add_tx_radiotap_header(struct ieee80211_supported_band | |||
| 260 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; | 260 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; |
| 261 | struct ieee80211_radiotap_header *rthdr; | 261 | struct ieee80211_radiotap_header *rthdr; |
| 262 | unsigned char *pos; | 262 | unsigned char *pos; |
| 263 | __le16 txflags; | 263 | u16 txflags; |
| 264 | 264 | ||
| 265 | rthdr = (struct ieee80211_radiotap_header *) skb_push(skb, rtap_len); | 265 | rthdr = (struct ieee80211_radiotap_header *) skb_push(skb, rtap_len); |
| 266 | 266 | ||
| @@ -290,13 +290,13 @@ static void ieee80211_add_tx_radiotap_header(struct ieee80211_supported_band | |||
| 290 | txflags = 0; | 290 | txflags = 0; |
| 291 | if (!(info->flags & IEEE80211_TX_STAT_ACK) && | 291 | if (!(info->flags & IEEE80211_TX_STAT_ACK) && |
| 292 | !is_multicast_ether_addr(hdr->addr1)) | 292 | !is_multicast_ether_addr(hdr->addr1)) |
| 293 | txflags |= cpu_to_le16(IEEE80211_RADIOTAP_F_TX_FAIL); | 293 | txflags |= IEEE80211_RADIOTAP_F_TX_FAIL; |
| 294 | 294 | ||
| 295 | if ((info->status.rates[0].flags & IEEE80211_TX_RC_USE_RTS_CTS) || | 295 | if ((info->status.rates[0].flags & IEEE80211_TX_RC_USE_RTS_CTS) || |
| 296 | (info->status.rates[0].flags & IEEE80211_TX_RC_USE_CTS_PROTECT)) | 296 | (info->status.rates[0].flags & IEEE80211_TX_RC_USE_CTS_PROTECT)) |
| 297 | txflags |= cpu_to_le16(IEEE80211_RADIOTAP_F_TX_CTS); | 297 | txflags |= IEEE80211_RADIOTAP_F_TX_CTS; |
| 298 | else if (info->status.rates[0].flags & IEEE80211_TX_RC_USE_RTS_CTS) | 298 | else if (info->status.rates[0].flags & IEEE80211_TX_RC_USE_RTS_CTS) |
| 299 | txflags |= cpu_to_le16(IEEE80211_RADIOTAP_F_TX_RTS); | 299 | txflags |= IEEE80211_RADIOTAP_F_TX_RTS; |
| 300 | 300 | ||
| 301 | put_unaligned_le16(txflags, pos); | 301 | put_unaligned_le16(txflags, pos); |
| 302 | pos += 2; | 302 | pos += 2; |
diff --git a/net/netfilter/Kconfig b/net/netfilter/Kconfig index 8260b13d93c9..d5597b759ba3 100644 --- a/net/netfilter/Kconfig +++ b/net/netfilter/Kconfig | |||
| @@ -201,7 +201,6 @@ config NF_CONNTRACK_BROADCAST | |||
| 201 | 201 | ||
| 202 | config NF_CONNTRACK_NETBIOS_NS | 202 | config NF_CONNTRACK_NETBIOS_NS |
| 203 | tristate "NetBIOS name service protocol support" | 203 | tristate "NetBIOS name service protocol support" |
| 204 | depends on NETFILTER_ADVANCED | ||
| 205 | select NF_CONNTRACK_BROADCAST | 204 | select NF_CONNTRACK_BROADCAST |
| 206 | help | 205 | help |
| 207 | NetBIOS name service requests are sent as broadcast messages from an | 206 | NetBIOS name service requests are sent as broadcast messages from an |
| @@ -542,7 +541,6 @@ config NETFILTER_XT_TARGET_NOTRACK | |||
| 542 | tristate '"NOTRACK" target support' | 541 | tristate '"NOTRACK" target support' |
| 543 | depends on IP_NF_RAW || IP6_NF_RAW | 542 | depends on IP_NF_RAW || IP6_NF_RAW |
| 544 | depends on NF_CONNTRACK | 543 | depends on NF_CONNTRACK |
| 545 | depends on NETFILTER_ADVANCED | ||
| 546 | help | 544 | help |
| 547 | The NOTRACK target allows a select rule to specify | 545 | The NOTRACK target allows a select rule to specify |
| 548 | which packets *not* to enter the conntrack/NAT | 546 | which packets *not* to enter the conntrack/NAT |
diff --git a/net/netfilter/ipset/ip_set_hash_ipport.c b/net/netfilter/ipset/ip_set_hash_ipport.c index 6ee10f5d59bd..37d667e3f6f8 100644 --- a/net/netfilter/ipset/ip_set_hash_ipport.c +++ b/net/netfilter/ipset/ip_set_hash_ipport.c | |||
| @@ -158,7 +158,7 @@ hash_ipport4_uadt(struct ip_set *set, struct nlattr *tb[], | |||
| 158 | const struct ip_set_hash *h = set->data; | 158 | const struct ip_set_hash *h = set->data; |
| 159 | ipset_adtfn adtfn = set->variant->adt[adt]; | 159 | ipset_adtfn adtfn = set->variant->adt[adt]; |
| 160 | struct hash_ipport4_elem data = { }; | 160 | struct hash_ipport4_elem data = { }; |
| 161 | u32 ip, ip_to, p = 0, port, port_to; | 161 | u32 ip, ip_to = 0, p = 0, port, port_to; |
| 162 | u32 timeout = h->timeout; | 162 | u32 timeout = h->timeout; |
| 163 | bool with_ports = false; | 163 | bool with_ports = false; |
| 164 | int ret; | 164 | int ret; |
diff --git a/net/netfilter/ipset/ip_set_hash_ipportip.c b/net/netfilter/ipset/ip_set_hash_ipportip.c index fb90e344e907..e69e2718fbe1 100644 --- a/net/netfilter/ipset/ip_set_hash_ipportip.c +++ b/net/netfilter/ipset/ip_set_hash_ipportip.c | |||
| @@ -162,7 +162,7 @@ hash_ipportip4_uadt(struct ip_set *set, struct nlattr *tb[], | |||
| 162 | const struct ip_set_hash *h = set->data; | 162 | const struct ip_set_hash *h = set->data; |
| 163 | ipset_adtfn adtfn = set->variant->adt[adt]; | 163 | ipset_adtfn adtfn = set->variant->adt[adt]; |
| 164 | struct hash_ipportip4_elem data = { }; | 164 | struct hash_ipportip4_elem data = { }; |
| 165 | u32 ip, ip_to, p = 0, port, port_to; | 165 | u32 ip, ip_to = 0, p = 0, port, port_to; |
| 166 | u32 timeout = h->timeout; | 166 | u32 timeout = h->timeout; |
| 167 | bool with_ports = false; | 167 | bool with_ports = false; |
| 168 | int ret; | 168 | int ret; |
diff --git a/net/netfilter/ipset/ip_set_hash_ipportnet.c b/net/netfilter/ipset/ip_set_hash_ipportnet.c index deb3e3dfa5fc..64199b4e93c9 100644 --- a/net/netfilter/ipset/ip_set_hash_ipportnet.c +++ b/net/netfilter/ipset/ip_set_hash_ipportnet.c | |||
| @@ -184,7 +184,7 @@ hash_ipportnet4_uadt(struct ip_set *set, struct nlattr *tb[], | |||
| 184 | const struct ip_set_hash *h = set->data; | 184 | const struct ip_set_hash *h = set->data; |
| 185 | ipset_adtfn adtfn = set->variant->adt[adt]; | 185 | ipset_adtfn adtfn = set->variant->adt[adt]; |
| 186 | struct hash_ipportnet4_elem data = { .cidr = HOST_MASK }; | 186 | struct hash_ipportnet4_elem data = { .cidr = HOST_MASK }; |
| 187 | u32 ip, ip_to, p = 0, port, port_to; | 187 | u32 ip, ip_to = 0, p = 0, port, port_to; |
| 188 | u32 ip2_from = 0, ip2_to, ip2_last, ip2; | 188 | u32 ip2_from = 0, ip2_to, ip2_last, ip2; |
| 189 | u32 timeout = h->timeout; | 189 | u32 timeout = h->timeout; |
| 190 | bool with_ports = false; | 190 | bool with_ports = false; |
diff --git a/net/netfilter/nf_conntrack_ecache.c b/net/netfilter/nf_conntrack_ecache.c index 6b368be937c6..b62c4148b921 100644 --- a/net/netfilter/nf_conntrack_ecache.c +++ b/net/netfilter/nf_conntrack_ecache.c | |||
| @@ -27,22 +27,17 @@ | |||
| 27 | 27 | ||
| 28 | static DEFINE_MUTEX(nf_ct_ecache_mutex); | 28 | static DEFINE_MUTEX(nf_ct_ecache_mutex); |
| 29 | 29 | ||
| 30 | struct nf_ct_event_notifier __rcu *nf_conntrack_event_cb __read_mostly; | ||
| 31 | EXPORT_SYMBOL_GPL(nf_conntrack_event_cb); | ||
| 32 | |||
| 33 | struct nf_exp_event_notifier __rcu *nf_expect_event_cb __read_mostly; | ||
| 34 | EXPORT_SYMBOL_GPL(nf_expect_event_cb); | ||
| 35 | |||
| 36 | /* deliver cached events and clear cache entry - must be called with locally | 30 | /* deliver cached events and clear cache entry - must be called with locally |
| 37 | * disabled softirqs */ | 31 | * disabled softirqs */ |
| 38 | void nf_ct_deliver_cached_events(struct nf_conn *ct) | 32 | void nf_ct_deliver_cached_events(struct nf_conn *ct) |
| 39 | { | 33 | { |
| 34 | struct net *net = nf_ct_net(ct); | ||
| 40 | unsigned long events; | 35 | unsigned long events; |
| 41 | struct nf_ct_event_notifier *notify; | 36 | struct nf_ct_event_notifier *notify; |
| 42 | struct nf_conntrack_ecache *e; | 37 | struct nf_conntrack_ecache *e; |
| 43 | 38 | ||
| 44 | rcu_read_lock(); | 39 | rcu_read_lock(); |
| 45 | notify = rcu_dereference(nf_conntrack_event_cb); | 40 | notify = rcu_dereference(net->ct.nf_conntrack_event_cb); |
| 46 | if (notify == NULL) | 41 | if (notify == NULL) |
| 47 | goto out_unlock; | 42 | goto out_unlock; |
| 48 | 43 | ||
| @@ -83,19 +78,20 @@ out_unlock: | |||
| 83 | } | 78 | } |
| 84 | EXPORT_SYMBOL_GPL(nf_ct_deliver_cached_events); | 79 | EXPORT_SYMBOL_GPL(nf_ct_deliver_cached_events); |
| 85 | 80 | ||
| 86 | int nf_conntrack_register_notifier(struct nf_ct_event_notifier *new) | 81 | int nf_conntrack_register_notifier(struct net *net, |
| 82 | struct nf_ct_event_notifier *new) | ||
| 87 | { | 83 | { |
| 88 | int ret = 0; | 84 | int ret = 0; |
| 89 | struct nf_ct_event_notifier *notify; | 85 | struct nf_ct_event_notifier *notify; |
| 90 | 86 | ||
| 91 | mutex_lock(&nf_ct_ecache_mutex); | 87 | mutex_lock(&nf_ct_ecache_mutex); |
| 92 | notify = rcu_dereference_protected(nf_conntrack_event_cb, | 88 | notify = rcu_dereference_protected(net->ct.nf_conntrack_event_cb, |
| 93 | lockdep_is_held(&nf_ct_ecache_mutex)); | 89 | lockdep_is_held(&nf_ct_ecache_mutex)); |
| 94 | if (notify != NULL) { | 90 | if (notify != NULL) { |
| 95 | ret = -EBUSY; | 91 | ret = -EBUSY; |
| 96 | goto out_unlock; | 92 | goto out_unlock; |
| 97 | } | 93 | } |
| 98 | RCU_INIT_POINTER(nf_conntrack_event_cb, new); | 94 | RCU_INIT_POINTER(net->ct.nf_conntrack_event_cb, new); |
| 99 | mutex_unlock(&nf_ct_ecache_mutex); | 95 | mutex_unlock(&nf_ct_ecache_mutex); |
| 100 | return ret; | 96 | return ret; |
| 101 | 97 | ||
| @@ -105,32 +101,34 @@ out_unlock: | |||
| 105 | } | 101 | } |
| 106 | EXPORT_SYMBOL_GPL(nf_conntrack_register_notifier); | 102 | EXPORT_SYMBOL_GPL(nf_conntrack_register_notifier); |
| 107 | 103 | ||
| 108 | void nf_conntrack_unregister_notifier(struct nf_ct_event_notifier *new) | 104 | void nf_conntrack_unregister_notifier(struct net *net, |
| 105 | struct nf_ct_event_notifier *new) | ||
| 109 | { | 106 | { |
| 110 | struct nf_ct_event_notifier *notify; | 107 | struct nf_ct_event_notifier *notify; |
| 111 | 108 | ||
| 112 | mutex_lock(&nf_ct_ecache_mutex); | 109 | mutex_lock(&nf_ct_ecache_mutex); |
| 113 | notify = rcu_dereference_protected(nf_conntrack_event_cb, | 110 | notify = rcu_dereference_protected(net->ct.nf_conntrack_event_cb, |
| 114 | lockdep_is_held(&nf_ct_ecache_mutex)); | 111 | lockdep_is_held(&nf_ct_ecache_mutex)); |
| 115 | BUG_ON(notify != new); | 112 | BUG_ON(notify != new); |
| 116 | RCU_INIT_POINTER(nf_conntrack_event_cb, NULL); | 113 | RCU_INIT_POINTER(net->ct.nf_conntrack_event_cb, NULL); |
| 117 | mutex_unlock(&nf_ct_ecache_mutex); | 114 | mutex_unlock(&nf_ct_ecache_mutex); |
| 118 | } | 115 | } |
| 119 | EXPORT_SYMBOL_GPL(nf_conntrack_unregister_notifier); | 116 | EXPORT_SYMBOL_GPL(nf_conntrack_unregister_notifier); |
| 120 | 117 | ||
| 121 | int nf_ct_expect_register_notifier(struct nf_exp_event_notifier *new) | 118 | int nf_ct_expect_register_notifier(struct net *net, |
| 119 | struct nf_exp_event_notifier *new) | ||
| 122 | { | 120 | { |
| 123 | int ret = 0; | 121 | int ret = 0; |
| 124 | struct nf_exp_event_notifier *notify; | 122 | struct nf_exp_event_notifier *notify; |
| 125 | 123 | ||
| 126 | mutex_lock(&nf_ct_ecache_mutex); | 124 | mutex_lock(&nf_ct_ecache_mutex); |
| 127 | notify = rcu_dereference_protected(nf_expect_event_cb, | 125 | notify = rcu_dereference_protected(net->ct.nf_expect_event_cb, |
| 128 | lockdep_is_held(&nf_ct_ecache_mutex)); | 126 | lockdep_is_held(&nf_ct_ecache_mutex)); |
| 129 | if (notify != NULL) { | 127 | if (notify != NULL) { |
| 130 | ret = -EBUSY; | 128 | ret = -EBUSY; |
| 131 | goto out_unlock; | 129 | goto out_unlock; |
| 132 | } | 130 | } |
| 133 | RCU_INIT_POINTER(nf_expect_event_cb, new); | 131 | RCU_INIT_POINTER(net->ct.nf_expect_event_cb, new); |
| 134 | mutex_unlock(&nf_ct_ecache_mutex); | 132 | mutex_unlock(&nf_ct_ecache_mutex); |
| 135 | return ret; | 133 | return ret; |
| 136 | 134 | ||
| @@ -140,15 +138,16 @@ out_unlock: | |||
| 140 | } | 138 | } |
| 141 | EXPORT_SYMBOL_GPL(nf_ct_expect_register_notifier); | 139 | EXPORT_SYMBOL_GPL(nf_ct_expect_register_notifier); |
| 142 | 140 | ||
| 143 | void nf_ct_expect_unregister_notifier(struct nf_exp_event_notifier *new) | 141 | void nf_ct_expect_unregister_notifier(struct net *net, |
| 142 | struct nf_exp_event_notifier *new) | ||
| 144 | { | 143 | { |
| 145 | struct nf_exp_event_notifier *notify; | 144 | struct nf_exp_event_notifier *notify; |
| 146 | 145 | ||
| 147 | mutex_lock(&nf_ct_ecache_mutex); | 146 | mutex_lock(&nf_ct_ecache_mutex); |
| 148 | notify = rcu_dereference_protected(nf_expect_event_cb, | 147 | notify = rcu_dereference_protected(net->ct.nf_expect_event_cb, |
| 149 | lockdep_is_held(&nf_ct_ecache_mutex)); | 148 | lockdep_is_held(&nf_ct_ecache_mutex)); |
| 150 | BUG_ON(notify != new); | 149 | BUG_ON(notify != new); |
| 151 | RCU_INIT_POINTER(nf_expect_event_cb, NULL); | 150 | RCU_INIT_POINTER(net->ct.nf_expect_event_cb, NULL); |
| 152 | mutex_unlock(&nf_ct_ecache_mutex); | 151 | mutex_unlock(&nf_ct_ecache_mutex); |
| 153 | } | 152 | } |
| 154 | EXPORT_SYMBOL_GPL(nf_ct_expect_unregister_notifier); | 153 | EXPORT_SYMBOL_GPL(nf_ct_expect_unregister_notifier); |
diff --git a/net/netfilter/nf_conntrack_netlink.c b/net/netfilter/nf_conntrack_netlink.c index e58aa9b1fe8a..ef21b221f036 100644 --- a/net/netfilter/nf_conntrack_netlink.c +++ b/net/netfilter/nf_conntrack_netlink.c | |||
| @@ -4,7 +4,7 @@ | |||
| 4 | * (C) 2001 by Jay Schulist <jschlst@samba.org> | 4 | * (C) 2001 by Jay Schulist <jschlst@samba.org> |
| 5 | * (C) 2002-2006 by Harald Welte <laforge@gnumonks.org> | 5 | * (C) 2002-2006 by Harald Welte <laforge@gnumonks.org> |
| 6 | * (C) 2003 by Patrick Mchardy <kaber@trash.net> | 6 | * (C) 2003 by Patrick Mchardy <kaber@trash.net> |
| 7 | * (C) 2005-2008 by Pablo Neira Ayuso <pablo@netfilter.org> | 7 | * (C) 2005-2011 by Pablo Neira Ayuso <pablo@netfilter.org> |
| 8 | * | 8 | * |
| 9 | * Initial connection tracking via netlink development funded and | 9 | * Initial connection tracking via netlink development funded and |
| 10 | * generally made possible by Network Robots, Inc. (www.networkrobots.com) | 10 | * generally made possible by Network Robots, Inc. (www.networkrobots.com) |
| @@ -2163,6 +2163,54 @@ MODULE_ALIAS("ip_conntrack_netlink"); | |||
| 2163 | MODULE_ALIAS_NFNL_SUBSYS(NFNL_SUBSYS_CTNETLINK); | 2163 | MODULE_ALIAS_NFNL_SUBSYS(NFNL_SUBSYS_CTNETLINK); |
| 2164 | MODULE_ALIAS_NFNL_SUBSYS(NFNL_SUBSYS_CTNETLINK_EXP); | 2164 | MODULE_ALIAS_NFNL_SUBSYS(NFNL_SUBSYS_CTNETLINK_EXP); |
| 2165 | 2165 | ||
| 2166 | static int __net_init ctnetlink_net_init(struct net *net) | ||
| 2167 | { | ||
| 2168 | #ifdef CONFIG_NF_CONNTRACK_EVENTS | ||
| 2169 | int ret; | ||
| 2170 | |||
| 2171 | ret = nf_conntrack_register_notifier(net, &ctnl_notifier); | ||
| 2172 | if (ret < 0) { | ||
| 2173 | pr_err("ctnetlink_init: cannot register notifier.\n"); | ||
| 2174 | goto err_out; | ||
| 2175 | } | ||
| 2176 | |||
| 2177 | ret = nf_ct_expect_register_notifier(net, &ctnl_notifier_exp); | ||
| 2178 | if (ret < 0) { | ||
| 2179 | pr_err("ctnetlink_init: cannot expect register notifier.\n"); | ||
| 2180 | goto err_unreg_notifier; | ||
| 2181 | } | ||
| 2182 | #endif | ||
| 2183 | return 0; | ||
| 2184 | |||
| 2185 | #ifdef CONFIG_NF_CONNTRACK_EVENTS | ||
| 2186 | err_unreg_notifier: | ||
| 2187 | nf_conntrack_unregister_notifier(net, &ctnl_notifier); | ||
| 2188 | err_out: | ||
| 2189 | return ret; | ||
| 2190 | #endif | ||
| 2191 | } | ||
| 2192 | |||
| 2193 | static void ctnetlink_net_exit(struct net *net) | ||
| 2194 | { | ||
| 2195 | #ifdef CONFIG_NF_CONNTRACK_EVENTS | ||
| 2196 | nf_ct_expect_unregister_notifier(net, &ctnl_notifier_exp); | ||
| 2197 | nf_conntrack_unregister_notifier(net, &ctnl_notifier); | ||
| 2198 | #endif | ||
| 2199 | } | ||
| 2200 | |||
| 2201 | static void __net_exit ctnetlink_net_exit_batch(struct list_head *net_exit_list) | ||
| 2202 | { | ||
| 2203 | struct net *net; | ||
| 2204 | |||
| 2205 | list_for_each_entry(net, net_exit_list, exit_list) | ||
| 2206 | ctnetlink_net_exit(net); | ||
| 2207 | } | ||
| 2208 | |||
| 2209 | static struct pernet_operations ctnetlink_net_ops = { | ||
| 2210 | .init = ctnetlink_net_init, | ||
| 2211 | .exit_batch = ctnetlink_net_exit_batch, | ||
| 2212 | }; | ||
| 2213 | |||
| 2166 | static int __init ctnetlink_init(void) | 2214 | static int __init ctnetlink_init(void) |
| 2167 | { | 2215 | { |
| 2168 | int ret; | 2216 | int ret; |
| @@ -2180,28 +2228,15 @@ static int __init ctnetlink_init(void) | |||
| 2180 | goto err_unreg_subsys; | 2228 | goto err_unreg_subsys; |
| 2181 | } | 2229 | } |
| 2182 | 2230 | ||
| 2183 | #ifdef CONFIG_NF_CONNTRACK_EVENTS | 2231 | if (register_pernet_subsys(&ctnetlink_net_ops)) { |
| 2184 | ret = nf_conntrack_register_notifier(&ctnl_notifier); | 2232 | pr_err("ctnetlink_init: cannot register pernet operations\n"); |
| 2185 | if (ret < 0) { | ||
| 2186 | pr_err("ctnetlink_init: cannot register notifier.\n"); | ||
| 2187 | goto err_unreg_exp_subsys; | 2233 | goto err_unreg_exp_subsys; |
| 2188 | } | 2234 | } |
| 2189 | 2235 | ||
| 2190 | ret = nf_ct_expect_register_notifier(&ctnl_notifier_exp); | ||
| 2191 | if (ret < 0) { | ||
| 2192 | pr_err("ctnetlink_init: cannot expect register notifier.\n"); | ||
| 2193 | goto err_unreg_notifier; | ||
| 2194 | } | ||
| 2195 | #endif | ||
| 2196 | |||
| 2197 | return 0; | 2236 | return 0; |
| 2198 | 2237 | ||
| 2199 | #ifdef CONFIG_NF_CONNTRACK_EVENTS | ||
| 2200 | err_unreg_notifier: | ||
| 2201 | nf_conntrack_unregister_notifier(&ctnl_notifier); | ||
| 2202 | err_unreg_exp_subsys: | 2238 | err_unreg_exp_subsys: |
| 2203 | nfnetlink_subsys_unregister(&ctnl_exp_subsys); | 2239 | nfnetlink_subsys_unregister(&ctnl_exp_subsys); |
| 2204 | #endif | ||
| 2205 | err_unreg_subsys: | 2240 | err_unreg_subsys: |
| 2206 | nfnetlink_subsys_unregister(&ctnl_subsys); | 2241 | nfnetlink_subsys_unregister(&ctnl_subsys); |
| 2207 | err_out: | 2242 | err_out: |
| @@ -2213,11 +2248,7 @@ static void __exit ctnetlink_exit(void) | |||
| 2213 | pr_info("ctnetlink: unregistering from nfnetlink.\n"); | 2248 | pr_info("ctnetlink: unregistering from nfnetlink.\n"); |
| 2214 | 2249 | ||
| 2215 | nf_ct_remove_userspace_expectations(); | 2250 | nf_ct_remove_userspace_expectations(); |
| 2216 | #ifdef CONFIG_NF_CONNTRACK_EVENTS | 2251 | unregister_pernet_subsys(&ctnetlink_net_ops); |
| 2217 | nf_ct_expect_unregister_notifier(&ctnl_notifier_exp); | ||
| 2218 | nf_conntrack_unregister_notifier(&ctnl_notifier); | ||
| 2219 | #endif | ||
| 2220 | |||
| 2221 | nfnetlink_subsys_unregister(&ctnl_exp_subsys); | 2252 | nfnetlink_subsys_unregister(&ctnl_exp_subsys); |
| 2222 | nfnetlink_subsys_unregister(&ctnl_subsys); | 2253 | nfnetlink_subsys_unregister(&ctnl_subsys); |
| 2223 | } | 2254 | } |
diff --git a/net/netlabel/netlabel_kapi.c b/net/netlabel/netlabel_kapi.c index 9c24de10a657..824f184f7a9b 100644 --- a/net/netlabel/netlabel_kapi.c +++ b/net/netlabel/netlabel_kapi.c | |||
| @@ -111,8 +111,6 @@ int netlbl_cfg_unlbl_map_add(const char *domain, | |||
| 111 | struct netlbl_domaddr_map *addrmap = NULL; | 111 | struct netlbl_domaddr_map *addrmap = NULL; |
| 112 | struct netlbl_domaddr4_map *map4 = NULL; | 112 | struct netlbl_domaddr4_map *map4 = NULL; |
| 113 | struct netlbl_domaddr6_map *map6 = NULL; | 113 | struct netlbl_domaddr6_map *map6 = NULL; |
| 114 | const struct in_addr *addr4, *mask4; | ||
| 115 | const struct in6_addr *addr6, *mask6; | ||
| 116 | 114 | ||
| 117 | entry = kzalloc(sizeof(*entry), GFP_ATOMIC); | 115 | entry = kzalloc(sizeof(*entry), GFP_ATOMIC); |
| 118 | if (entry == NULL) | 116 | if (entry == NULL) |
| @@ -133,9 +131,9 @@ int netlbl_cfg_unlbl_map_add(const char *domain, | |||
| 133 | INIT_LIST_HEAD(&addrmap->list6); | 131 | INIT_LIST_HEAD(&addrmap->list6); |
| 134 | 132 | ||
| 135 | switch (family) { | 133 | switch (family) { |
| 136 | case AF_INET: | 134 | case AF_INET: { |
| 137 | addr4 = addr; | 135 | const struct in_addr *addr4 = addr; |
| 138 | mask4 = mask; | 136 | const struct in_addr *mask4 = mask; |
| 139 | map4 = kzalloc(sizeof(*map4), GFP_ATOMIC); | 137 | map4 = kzalloc(sizeof(*map4), GFP_ATOMIC); |
| 140 | if (map4 == NULL) | 138 | if (map4 == NULL) |
| 141 | goto cfg_unlbl_map_add_failure; | 139 | goto cfg_unlbl_map_add_failure; |
| @@ -148,9 +146,11 @@ int netlbl_cfg_unlbl_map_add(const char *domain, | |||
| 148 | if (ret_val != 0) | 146 | if (ret_val != 0) |
| 149 | goto cfg_unlbl_map_add_failure; | 147 | goto cfg_unlbl_map_add_failure; |
| 150 | break; | 148 | break; |
| 151 | case AF_INET6: | 149 | } |
| 152 | addr6 = addr; | 150 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) |
| 153 | mask6 = mask; | 151 | case AF_INET6: { |
| 152 | const struct in6_addr *addr6 = addr; | ||
| 153 | const struct in6_addr *mask6 = mask; | ||
| 154 | map6 = kzalloc(sizeof(*map6), GFP_ATOMIC); | 154 | map6 = kzalloc(sizeof(*map6), GFP_ATOMIC); |
| 155 | if (map6 == NULL) | 155 | if (map6 == NULL) |
| 156 | goto cfg_unlbl_map_add_failure; | 156 | goto cfg_unlbl_map_add_failure; |
| @@ -162,11 +162,13 @@ int netlbl_cfg_unlbl_map_add(const char *domain, | |||
| 162 | map6->list.addr.s6_addr32[3] &= mask6->s6_addr32[3]; | 162 | map6->list.addr.s6_addr32[3] &= mask6->s6_addr32[3]; |
| 163 | ipv6_addr_copy(&map6->list.mask, mask6); | 163 | ipv6_addr_copy(&map6->list.mask, mask6); |
| 164 | map6->list.valid = 1; | 164 | map6->list.valid = 1; |
| 165 | ret_val = netlbl_af4list_add(&map4->list, | 165 | ret_val = netlbl_af6list_add(&map6->list, |
| 166 | &addrmap->list4); | 166 | &addrmap->list6); |
| 167 | if (ret_val != 0) | 167 | if (ret_val != 0) |
| 168 | goto cfg_unlbl_map_add_failure; | 168 | goto cfg_unlbl_map_add_failure; |
| 169 | break; | 169 | break; |
| 170 | } | ||
| 171 | #endif /* IPv6 */ | ||
| 170 | default: | 172 | default: |
| 171 | goto cfg_unlbl_map_add_failure; | 173 | goto cfg_unlbl_map_add_failure; |
| 172 | break; | 174 | break; |
| @@ -225,9 +227,11 @@ int netlbl_cfg_unlbl_static_add(struct net *net, | |||
| 225 | case AF_INET: | 227 | case AF_INET: |
| 226 | addr_len = sizeof(struct in_addr); | 228 | addr_len = sizeof(struct in_addr); |
| 227 | break; | 229 | break; |
| 230 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) | ||
| 228 | case AF_INET6: | 231 | case AF_INET6: |
| 229 | addr_len = sizeof(struct in6_addr); | 232 | addr_len = sizeof(struct in6_addr); |
| 230 | break; | 233 | break; |
| 234 | #endif /* IPv6 */ | ||
| 231 | default: | 235 | default: |
| 232 | return -EPFNOSUPPORT; | 236 | return -EPFNOSUPPORT; |
| 233 | } | 237 | } |
| @@ -266,9 +270,11 @@ int netlbl_cfg_unlbl_static_del(struct net *net, | |||
| 266 | case AF_INET: | 270 | case AF_INET: |
| 267 | addr_len = sizeof(struct in_addr); | 271 | addr_len = sizeof(struct in_addr); |
| 268 | break; | 272 | break; |
| 273 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) | ||
| 269 | case AF_INET6: | 274 | case AF_INET6: |
| 270 | addr_len = sizeof(struct in6_addr); | 275 | addr_len = sizeof(struct in6_addr); |
| 271 | break; | 276 | break; |
| 277 | #endif /* IPv6 */ | ||
| 272 | default: | 278 | default: |
| 273 | return -EPFNOSUPPORT; | 279 | return -EPFNOSUPPORT; |
| 274 | } | 280 | } |
diff --git a/net/sched/sch_red.c b/net/sched/sch_red.c index 6649463da1b6..d617161f8dd3 100644 --- a/net/sched/sch_red.c +++ b/net/sched/sch_red.c | |||
| @@ -209,8 +209,8 @@ static int red_change(struct Qdisc *sch, struct nlattr *opt) | |||
| 209 | ctl->Plog, ctl->Scell_log, | 209 | ctl->Plog, ctl->Scell_log, |
| 210 | nla_data(tb[TCA_RED_STAB])); | 210 | nla_data(tb[TCA_RED_STAB])); |
| 211 | 211 | ||
| 212 | if (skb_queue_empty(&sch->q)) | 212 | if (!q->qdisc->q.qlen) |
| 213 | red_end_of_idle_period(&q->parms); | 213 | red_start_of_idle_period(&q->parms); |
| 214 | 214 | ||
| 215 | sch_tree_unlock(sch); | 215 | sch_tree_unlock(sch); |
| 216 | return 0; | 216 | return 0; |
diff --git a/net/sched/sch_teql.c b/net/sched/sch_teql.c index a3b7120fcc74..4f4c52c0eeb3 100644 --- a/net/sched/sch_teql.c +++ b/net/sched/sch_teql.c | |||
| @@ -225,11 +225,11 @@ static int teql_qdisc_init(struct Qdisc *sch, struct nlattr *opt) | |||
| 225 | 225 | ||
| 226 | 226 | ||
| 227 | static int | 227 | static int |
| 228 | __teql_resolve(struct sk_buff *skb, struct sk_buff *skb_res, struct net_device *dev) | 228 | __teql_resolve(struct sk_buff *skb, struct sk_buff *skb_res, |
| 229 | struct net_device *dev, struct netdev_queue *txq, | ||
| 230 | struct neighbour *mn) | ||
| 229 | { | 231 | { |
| 230 | struct netdev_queue *dev_queue = netdev_get_tx_queue(dev, 0); | 232 | struct teql_sched_data *q = qdisc_priv(txq->qdisc); |
| 231 | struct teql_sched_data *q = qdisc_priv(dev_queue->qdisc); | ||
| 232 | struct neighbour *mn = dst_get_neighbour(skb_dst(skb)); | ||
| 233 | struct neighbour *n = q->ncache; | 233 | struct neighbour *n = q->ncache; |
| 234 | 234 | ||
| 235 | if (mn->tbl == NULL) | 235 | if (mn->tbl == NULL) |
| @@ -262,17 +262,26 @@ __teql_resolve(struct sk_buff *skb, struct sk_buff *skb_res, struct net_device * | |||
| 262 | } | 262 | } |
| 263 | 263 | ||
| 264 | static inline int teql_resolve(struct sk_buff *skb, | 264 | static inline int teql_resolve(struct sk_buff *skb, |
| 265 | struct sk_buff *skb_res, struct net_device *dev) | 265 | struct sk_buff *skb_res, |
| 266 | struct net_device *dev, | ||
| 267 | struct netdev_queue *txq) | ||
| 266 | { | 268 | { |
| 267 | struct netdev_queue *txq = netdev_get_tx_queue(dev, 0); | 269 | struct dst_entry *dst = skb_dst(skb); |
| 270 | struct neighbour *mn; | ||
| 271 | int res; | ||
| 272 | |||
| 268 | if (txq->qdisc == &noop_qdisc) | 273 | if (txq->qdisc == &noop_qdisc) |
| 269 | return -ENODEV; | 274 | return -ENODEV; |
| 270 | 275 | ||
| 271 | if (dev->header_ops == NULL || | 276 | if (!dev->header_ops || !dst) |
| 272 | skb_dst(skb) == NULL || | ||
| 273 | dst_get_neighbour(skb_dst(skb)) == NULL) | ||
| 274 | return 0; | 277 | return 0; |
| 275 | return __teql_resolve(skb, skb_res, dev); | 278 | |
| 279 | rcu_read_lock(); | ||
| 280 | mn = dst_get_neighbour(dst); | ||
| 281 | res = mn ? __teql_resolve(skb, skb_res, dev, txq, mn) : 0; | ||
| 282 | rcu_read_unlock(); | ||
| 283 | |||
| 284 | return res; | ||
| 276 | } | 285 | } |
| 277 | 286 | ||
| 278 | static netdev_tx_t teql_master_xmit(struct sk_buff *skb, struct net_device *dev) | 287 | static netdev_tx_t teql_master_xmit(struct sk_buff *skb, struct net_device *dev) |
| @@ -307,7 +316,7 @@ restart: | |||
| 307 | continue; | 316 | continue; |
| 308 | } | 317 | } |
| 309 | 318 | ||
| 310 | switch (teql_resolve(skb, skb_res, slave)) { | 319 | switch (teql_resolve(skb, skb_res, slave, slave_txq)) { |
| 311 | case 0: | 320 | case 0: |
| 312 | if (__netif_tx_trylock(slave_txq)) { | 321 | if (__netif_tx_trylock(slave_txq)) { |
| 313 | unsigned int length = qdisc_pkt_len(skb); | 322 | unsigned int length = qdisc_pkt_len(skb); |
diff --git a/net/sctp/auth.c b/net/sctp/auth.c index 865e68fef21c..bf812048cf6f 100644 --- a/net/sctp/auth.c +++ b/net/sctp/auth.c | |||
| @@ -82,7 +82,7 @@ static struct sctp_auth_bytes *sctp_auth_create_key(__u32 key_len, gfp_t gfp) | |||
| 82 | struct sctp_auth_bytes *key; | 82 | struct sctp_auth_bytes *key; |
| 83 | 83 | ||
| 84 | /* Verify that we are not going to overflow INT_MAX */ | 84 | /* Verify that we are not going to overflow INT_MAX */ |
| 85 | if ((INT_MAX - key_len) < sizeof(struct sctp_auth_bytes)) | 85 | if (key_len > (INT_MAX - sizeof(struct sctp_auth_bytes))) |
| 86 | return NULL; | 86 | return NULL; |
| 87 | 87 | ||
| 88 | /* Allocate the shared key */ | 88 | /* Allocate the shared key */ |
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c index 2d78d95955ab..55472c48825e 100644 --- a/net/sunrpc/xprtsock.c +++ b/net/sunrpc/xprtsock.c | |||
| @@ -496,7 +496,7 @@ static int xs_nospace(struct rpc_task *task) | |||
| 496 | struct rpc_rqst *req = task->tk_rqstp; | 496 | struct rpc_rqst *req = task->tk_rqstp; |
| 497 | struct rpc_xprt *xprt = req->rq_xprt; | 497 | struct rpc_xprt *xprt = req->rq_xprt; |
| 498 | struct sock_xprt *transport = container_of(xprt, struct sock_xprt, xprt); | 498 | struct sock_xprt *transport = container_of(xprt, struct sock_xprt, xprt); |
| 499 | int ret = 0; | 499 | int ret = -EAGAIN; |
| 500 | 500 | ||
| 501 | dprintk("RPC: %5u xmit incomplete (%u left of %u)\n", | 501 | dprintk("RPC: %5u xmit incomplete (%u left of %u)\n", |
| 502 | task->tk_pid, req->rq_slen - req->rq_bytes_sent, | 502 | task->tk_pid, req->rq_slen - req->rq_bytes_sent, |
| @@ -508,7 +508,6 @@ static int xs_nospace(struct rpc_task *task) | |||
| 508 | /* Don't race with disconnect */ | 508 | /* Don't race with disconnect */ |
| 509 | if (xprt_connected(xprt)) { | 509 | if (xprt_connected(xprt)) { |
| 510 | if (test_bit(SOCK_ASYNC_NOSPACE, &transport->sock->flags)) { | 510 | if (test_bit(SOCK_ASYNC_NOSPACE, &transport->sock->flags)) { |
| 511 | ret = -EAGAIN; | ||
| 512 | /* | 511 | /* |
| 513 | * Notify TCP that we're limited by the application | 512 | * Notify TCP that we're limited by the application |
| 514 | * window size | 513 | * window size |
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index 466fbcc5cf77..b595a3d8679f 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c | |||
| @@ -1957,6 +1957,7 @@ static int unix_stream_recvmsg(struct kiocb *iocb, struct socket *sock, | |||
| 1957 | if ((UNIXCB(skb).pid != siocb->scm->pid) || | 1957 | if ((UNIXCB(skb).pid != siocb->scm->pid) || |
| 1958 | (UNIXCB(skb).cred != siocb->scm->cred)) { | 1958 | (UNIXCB(skb).cred != siocb->scm->cred)) { |
| 1959 | skb_queue_head(&sk->sk_receive_queue, skb); | 1959 | skb_queue_head(&sk->sk_receive_queue, skb); |
| 1960 | sk->sk_data_ready(sk, skb->len); | ||
| 1960 | break; | 1961 | break; |
| 1961 | } | 1962 | } |
| 1962 | } else { | 1963 | } else { |
| @@ -1974,6 +1975,7 @@ static int unix_stream_recvmsg(struct kiocb *iocb, struct socket *sock, | |||
| 1974 | chunk = min_t(unsigned int, skb->len, size); | 1975 | chunk = min_t(unsigned int, skb->len, size); |
| 1975 | if (memcpy_toiovec(msg->msg_iov, skb->data, chunk)) { | 1976 | if (memcpy_toiovec(msg->msg_iov, skb->data, chunk)) { |
| 1976 | skb_queue_head(&sk->sk_receive_queue, skb); | 1977 | skb_queue_head(&sk->sk_receive_queue, skb); |
| 1978 | sk->sk_data_ready(sk, skb->len); | ||
| 1977 | if (copied == 0) | 1979 | if (copied == 0) |
| 1978 | copied = -EFAULT; | 1980 | copied = -EFAULT; |
| 1979 | break; | 1981 | break; |
| @@ -1991,6 +1993,7 @@ static int unix_stream_recvmsg(struct kiocb *iocb, struct socket *sock, | |||
| 1991 | /* put the skb back if we didn't use it up.. */ | 1993 | /* put the skb back if we didn't use it up.. */ |
| 1992 | if (skb->len) { | 1994 | if (skb->len) { |
| 1993 | skb_queue_head(&sk->sk_receive_queue, skb); | 1995 | skb_queue_head(&sk->sk_receive_queue, skb); |
| 1996 | sk->sk_data_ready(sk, skb->len); | ||
| 1994 | break; | 1997 | break; |
| 1995 | } | 1998 | } |
| 1996 | 1999 | ||
| @@ -2006,6 +2009,7 @@ static int unix_stream_recvmsg(struct kiocb *iocb, struct socket *sock, | |||
| 2006 | 2009 | ||
| 2007 | /* put message back and return */ | 2010 | /* put message back and return */ |
| 2008 | skb_queue_head(&sk->sk_receive_queue, skb); | 2011 | skb_queue_head(&sk->sk_receive_queue, skb); |
| 2012 | sk->sk_data_ready(sk, skb->len); | ||
| 2009 | break; | 2013 | break; |
| 2010 | } | 2014 | } |
| 2011 | } while (size); | 2015 | } while (size); |
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index b3a476fe8272..ffafda5022c2 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c | |||
| @@ -89,8 +89,8 @@ static const struct nla_policy nl80211_policy[NL80211_ATTR_MAX+1] = { | |||
| 89 | [NL80211_ATTR_IFINDEX] = { .type = NLA_U32 }, | 89 | [NL80211_ATTR_IFINDEX] = { .type = NLA_U32 }, |
| 90 | [NL80211_ATTR_IFNAME] = { .type = NLA_NUL_STRING, .len = IFNAMSIZ-1 }, | 90 | [NL80211_ATTR_IFNAME] = { .type = NLA_NUL_STRING, .len = IFNAMSIZ-1 }, |
| 91 | 91 | ||
| 92 | [NL80211_ATTR_MAC] = { .type = NLA_BINARY, .len = ETH_ALEN }, | 92 | [NL80211_ATTR_MAC] = { .len = ETH_ALEN }, |
| 93 | [NL80211_ATTR_PREV_BSSID] = { .type = NLA_BINARY, .len = ETH_ALEN }, | 93 | [NL80211_ATTR_PREV_BSSID] = { .len = ETH_ALEN }, |
| 94 | 94 | ||
| 95 | [NL80211_ATTR_KEY] = { .type = NLA_NESTED, }, | 95 | [NL80211_ATTR_KEY] = { .type = NLA_NESTED, }, |
| 96 | [NL80211_ATTR_KEY_DATA] = { .type = NLA_BINARY, | 96 | [NL80211_ATTR_KEY_DATA] = { .type = NLA_BINARY, |
diff --git a/net/wireless/reg.c b/net/wireless/reg.c index e71f5a66574e..77e926738014 100644 --- a/net/wireless/reg.c +++ b/net/wireless/reg.c | |||
| @@ -2037,6 +2037,10 @@ static int __set_regdom(const struct ieee80211_regdomain *rd) | |||
| 2037 | } | 2037 | } |
| 2038 | 2038 | ||
| 2039 | request_wiphy = wiphy_idx_to_wiphy(last_request->wiphy_idx); | 2039 | request_wiphy = wiphy_idx_to_wiphy(last_request->wiphy_idx); |
| 2040 | if (!request_wiphy) { | ||
| 2041 | reg_set_request_processed(); | ||
| 2042 | return -ENODEV; | ||
| 2043 | } | ||
| 2040 | 2044 | ||
| 2041 | if (!last_request->intersect) { | 2045 | if (!last_request->intersect) { |
| 2042 | int r; | 2046 | int r; |
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c index 552df27dcf53..2118d6446630 100644 --- a/net/xfrm/xfrm_policy.c +++ b/net/xfrm/xfrm_policy.c | |||
| @@ -2382,9 +2382,11 @@ static unsigned int xfrm_default_advmss(const struct dst_entry *dst) | |||
| 2382 | return dst_metric_advmss(dst->path); | 2382 | return dst_metric_advmss(dst->path); |
| 2383 | } | 2383 | } |
| 2384 | 2384 | ||
| 2385 | static unsigned int xfrm_default_mtu(const struct dst_entry *dst) | 2385 | static unsigned int xfrm_mtu(const struct dst_entry *dst) |
| 2386 | { | 2386 | { |
| 2387 | return dst_mtu(dst->path); | 2387 | unsigned int mtu = dst_metric_raw(dst, RTAX_MTU); |
| 2388 | |||
| 2389 | return mtu ? : dst_mtu(dst->path); | ||
| 2388 | } | 2390 | } |
| 2389 | 2391 | ||
| 2390 | static struct neighbour *xfrm_neigh_lookup(const struct dst_entry *dst, const void *daddr) | 2392 | static struct neighbour *xfrm_neigh_lookup(const struct dst_entry *dst, const void *daddr) |
| @@ -2411,8 +2413,8 @@ int xfrm_policy_register_afinfo(struct xfrm_policy_afinfo *afinfo) | |||
| 2411 | dst_ops->check = xfrm_dst_check; | 2413 | dst_ops->check = xfrm_dst_check; |
| 2412 | if (likely(dst_ops->default_advmss == NULL)) | 2414 | if (likely(dst_ops->default_advmss == NULL)) |
| 2413 | dst_ops->default_advmss = xfrm_default_advmss; | 2415 | dst_ops->default_advmss = xfrm_default_advmss; |
| 2414 | if (likely(dst_ops->default_mtu == NULL)) | 2416 | if (likely(dst_ops->mtu == NULL)) |
| 2415 | dst_ops->default_mtu = xfrm_default_mtu; | 2417 | dst_ops->mtu = xfrm_mtu; |
| 2416 | if (likely(dst_ops->negative_advice == NULL)) | 2418 | if (likely(dst_ops->negative_advice == NULL)) |
| 2417 | dst_ops->negative_advice = xfrm_negative_advice; | 2419 | dst_ops->negative_advice = xfrm_negative_advice; |
| 2418 | if (likely(dst_ops->link_failure == NULL)) | 2420 | if (likely(dst_ops->link_failure == NULL)) |
diff --git a/sound/pci/cs5535audio/cs5535audio_pcm.c b/sound/pci/cs5535audio/cs5535audio_pcm.c index e083122ca55a..dbf94b189e75 100644 --- a/sound/pci/cs5535audio/cs5535audio_pcm.c +++ b/sound/pci/cs5535audio/cs5535audio_pcm.c | |||
| @@ -148,7 +148,7 @@ static int cs5535audio_build_dma_packets(struct cs5535audio *cs5535au, | |||
| 148 | struct cs5535audio_dma_desc *desc = | 148 | struct cs5535audio_dma_desc *desc = |
| 149 | &((struct cs5535audio_dma_desc *) dma->desc_buf.area)[i]; | 149 | &((struct cs5535audio_dma_desc *) dma->desc_buf.area)[i]; |
| 150 | desc->addr = cpu_to_le32(addr); | 150 | desc->addr = cpu_to_le32(addr); |
| 151 | desc->size = cpu_to_le32(period_bytes); | 151 | desc->size = cpu_to_le16(period_bytes); |
| 152 | desc->ctlreserved = cpu_to_le16(PRD_EOP); | 152 | desc->ctlreserved = cpu_to_le16(PRD_EOP); |
| 153 | desc_addr += sizeof(struct cs5535audio_dma_desc); | 153 | desc_addr += sizeof(struct cs5535audio_dma_desc); |
| 154 | addr += period_bytes; | 154 | addr += period_bytes; |
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index e44b107fdc75..4562e9de6a1a 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c | |||
| @@ -4046,9 +4046,9 @@ int snd_hda_check_board_codec_sid_config(struct hda_codec *codec, | |||
| 4046 | 4046 | ||
| 4047 | /* Search for codec ID */ | 4047 | /* Search for codec ID */ |
| 4048 | for (q = tbl; q->subvendor; q++) { | 4048 | for (q = tbl; q->subvendor; q++) { |
| 4049 | unsigned long vendorid = (q->subdevice) | (q->subvendor << 16); | 4049 | unsigned int mask = 0xffff0000 | q->subdevice_mask; |
| 4050 | 4050 | unsigned int id = (q->subdevice | (q->subvendor << 16)) & mask; | |
| 4051 | if (vendorid == codec->subsystem_id) | 4051 | if ((codec->subsystem_id & mask) == id) |
| 4052 | break; | 4052 | break; |
| 4053 | } | 4053 | } |
| 4054 | 4054 | ||
diff --git a/sound/pci/hda/hda_eld.c b/sound/pci/hda/hda_eld.c index 7ae7578bdcc0..c1da422e085a 100644 --- a/sound/pci/hda/hda_eld.c +++ b/sound/pci/hda/hda_eld.c | |||
| @@ -347,18 +347,28 @@ int snd_hdmi_get_eld(struct hdmi_eld *eld, | |||
| 347 | 347 | ||
| 348 | for (i = 0; i < size; i++) { | 348 | for (i = 0; i < size; i++) { |
| 349 | unsigned int val = hdmi_get_eld_data(codec, nid, i); | 349 | unsigned int val = hdmi_get_eld_data(codec, nid, i); |
| 350 | /* | ||
| 351 | * Graphics driver might be writing to ELD buffer right now. | ||
| 352 | * Just abort. The caller will repoll after a while. | ||
| 353 | */ | ||
| 350 | if (!(val & AC_ELDD_ELD_VALID)) { | 354 | if (!(val & AC_ELDD_ELD_VALID)) { |
| 351 | if (!i) { | ||
| 352 | snd_printd(KERN_INFO | ||
| 353 | "HDMI: invalid ELD data\n"); | ||
| 354 | ret = -EINVAL; | ||
| 355 | goto error; | ||
| 356 | } | ||
| 357 | snd_printd(KERN_INFO | 355 | snd_printd(KERN_INFO |
| 358 | "HDMI: invalid ELD data byte %d\n", i); | 356 | "HDMI: invalid ELD data byte %d\n", i); |
| 359 | val = 0; | 357 | ret = -EINVAL; |
| 360 | } else | 358 | goto error; |
| 361 | val &= AC_ELDD_ELD_DATA; | 359 | } |
| 360 | val &= AC_ELDD_ELD_DATA; | ||
| 361 | /* | ||
| 362 | * The first byte cannot be zero. This can happen on some DVI | ||
| 363 | * connections. Some Intel chips may also need some 250ms delay | ||
| 364 | * to return non-zero ELD data, even when the graphics driver | ||
| 365 | * correctly writes ELD content before setting ELD_valid bit. | ||
| 366 | */ | ||
| 367 | if (!val && !i) { | ||
| 368 | snd_printdd(KERN_INFO "HDMI: 0 ELD data\n"); | ||
| 369 | ret = -EINVAL; | ||
| 370 | goto error; | ||
| 371 | } | ||
| 362 | buf[i] = val; | 372 | buf[i] = val; |
| 363 | } | 373 | } |
| 364 | 374 | ||
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index 096507d2ca9a..7d98240def0b 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c | |||
| @@ -2508,7 +2508,6 @@ static struct snd_pci_quirk position_fix_list[] __devinitdata = { | |||
| 2508 | SND_PCI_QUIRK(0x1043, 0x81b3, "ASUS", POS_FIX_LPIB), | 2508 | SND_PCI_QUIRK(0x1043, 0x81b3, "ASUS", POS_FIX_LPIB), |
| 2509 | SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS M2V", POS_FIX_LPIB), | 2509 | SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS M2V", POS_FIX_LPIB), |
| 2510 | SND_PCI_QUIRK(0x104d, 0x9069, "Sony VPCS11V9E", POS_FIX_LPIB), | 2510 | SND_PCI_QUIRK(0x104d, 0x9069, "Sony VPCS11V9E", POS_FIX_LPIB), |
| 2511 | SND_PCI_QUIRK(0x1106, 0x3288, "ASUS M2V-MX SE", POS_FIX_LPIB), | ||
| 2512 | SND_PCI_QUIRK(0x1297, 0x3166, "Shuttle", POS_FIX_LPIB), | 2511 | SND_PCI_QUIRK(0x1297, 0x3166, "Shuttle", POS_FIX_LPIB), |
| 2513 | SND_PCI_QUIRK(0x1458, 0xa022, "ga-ma770-ud3", POS_FIX_LPIB), | 2512 | SND_PCI_QUIRK(0x1458, 0xa022, "ga-ma770-ud3", POS_FIX_LPIB), |
| 2514 | SND_PCI_QUIRK(0x1462, 0x1002, "MSI Wind U115", POS_FIX_LPIB), | 2513 | SND_PCI_QUIRK(0x1462, 0x1002, "MSI Wind U115", POS_FIX_LPIB), |
diff --git a/sound/pci/hda/patch_cirrus.c b/sound/pci/hda/patch_cirrus.c index 2fbab8e29576..70a7abda7e22 100644 --- a/sound/pci/hda/patch_cirrus.c +++ b/sound/pci/hda/patch_cirrus.c | |||
| @@ -58,6 +58,8 @@ struct cs_spec { | |||
| 58 | unsigned int gpio_mask; | 58 | unsigned int gpio_mask; |
| 59 | unsigned int gpio_dir; | 59 | unsigned int gpio_dir; |
| 60 | unsigned int gpio_data; | 60 | unsigned int gpio_data; |
| 61 | unsigned int gpio_eapd_hp; /* EAPD GPIO bit for headphones */ | ||
| 62 | unsigned int gpio_eapd_speaker; /* EAPD GPIO bit for speakers */ | ||
| 61 | 63 | ||
| 62 | struct hda_pcm pcm_rec[2]; /* PCM information */ | 64 | struct hda_pcm pcm_rec[2]; /* PCM information */ |
| 63 | 65 | ||
| @@ -76,6 +78,7 @@ enum { | |||
| 76 | CS420X_MBP53, | 78 | CS420X_MBP53, |
| 77 | CS420X_MBP55, | 79 | CS420X_MBP55, |
| 78 | CS420X_IMAC27, | 80 | CS420X_IMAC27, |
| 81 | CS420X_APPLE, | ||
| 79 | CS420X_AUTO, | 82 | CS420X_AUTO, |
| 80 | CS420X_MODELS | 83 | CS420X_MODELS |
| 81 | }; | 84 | }; |
| @@ -928,10 +931,9 @@ static void cs_automute(struct hda_codec *codec) | |||
| 928 | spdif_present ? 0 : PIN_OUT); | 931 | spdif_present ? 0 : PIN_OUT); |
| 929 | } | 932 | } |
| 930 | } | 933 | } |
| 931 | if (spec->board_config == CS420X_MBP53 || | 934 | if (spec->gpio_eapd_hp) { |
| 932 | spec->board_config == CS420X_MBP55 || | 935 | unsigned int gpio = hp_present ? |
| 933 | spec->board_config == CS420X_IMAC27) { | 936 | spec->gpio_eapd_hp : spec->gpio_eapd_speaker; |
| 934 | unsigned int gpio = hp_present ? 0x02 : 0x08; | ||
| 935 | snd_hda_codec_write(codec, 0x01, 0, | 937 | snd_hda_codec_write(codec, 0x01, 0, |
| 936 | AC_VERB_SET_GPIO_DATA, gpio); | 938 | AC_VERB_SET_GPIO_DATA, gpio); |
| 937 | } | 939 | } |
| @@ -1276,6 +1278,7 @@ static const char * const cs420x_models[CS420X_MODELS] = { | |||
| 1276 | [CS420X_MBP53] = "mbp53", | 1278 | [CS420X_MBP53] = "mbp53", |
| 1277 | [CS420X_MBP55] = "mbp55", | 1279 | [CS420X_MBP55] = "mbp55", |
| 1278 | [CS420X_IMAC27] = "imac27", | 1280 | [CS420X_IMAC27] = "imac27", |
| 1281 | [CS420X_APPLE] = "apple", | ||
| 1279 | [CS420X_AUTO] = "auto", | 1282 | [CS420X_AUTO] = "auto", |
| 1280 | }; | 1283 | }; |
| 1281 | 1284 | ||
| @@ -1285,7 +1288,13 @@ static const struct snd_pci_quirk cs420x_cfg_tbl[] = { | |||
| 1285 | SND_PCI_QUIRK(0x10de, 0x0d94, "MacBookAir 3,1(2)", CS420X_MBP55), | 1288 | SND_PCI_QUIRK(0x10de, 0x0d94, "MacBookAir 3,1(2)", CS420X_MBP55), |
| 1286 | SND_PCI_QUIRK(0x10de, 0xcb79, "MacBookPro 5,5", CS420X_MBP55), | 1289 | SND_PCI_QUIRK(0x10de, 0xcb79, "MacBookPro 5,5", CS420X_MBP55), |
| 1287 | SND_PCI_QUIRK(0x10de, 0xcb89, "MacBookPro 7,1", CS420X_MBP55), | 1290 | SND_PCI_QUIRK(0x10de, 0xcb89, "MacBookPro 7,1", CS420X_MBP55), |
| 1288 | SND_PCI_QUIRK(0x8086, 0x7270, "IMac 27 Inch", CS420X_IMAC27), | 1291 | /* this conflicts with too many other models */ |
| 1292 | /*SND_PCI_QUIRK(0x8086, 0x7270, "IMac 27 Inch", CS420X_IMAC27),*/ | ||
| 1293 | {} /* terminator */ | ||
| 1294 | }; | ||
| 1295 | |||
| 1296 | static const struct snd_pci_quirk cs420x_codec_cfg_tbl[] = { | ||
| 1297 | SND_PCI_QUIRK_VENDOR(0x106b, "Apple", CS420X_APPLE), | ||
| 1289 | {} /* terminator */ | 1298 | {} /* terminator */ |
| 1290 | }; | 1299 | }; |
| 1291 | 1300 | ||
| @@ -1367,6 +1376,10 @@ static int patch_cs420x(struct hda_codec *codec) | |||
| 1367 | spec->board_config = | 1376 | spec->board_config = |
| 1368 | snd_hda_check_board_config(codec, CS420X_MODELS, | 1377 | snd_hda_check_board_config(codec, CS420X_MODELS, |
| 1369 | cs420x_models, cs420x_cfg_tbl); | 1378 | cs420x_models, cs420x_cfg_tbl); |
| 1379 | if (spec->board_config < 0) | ||
| 1380 | spec->board_config = | ||
| 1381 | snd_hda_check_board_codec_sid_config(codec, | ||
| 1382 | CS420X_MODELS, NULL, cs420x_codec_cfg_tbl); | ||
| 1370 | if (spec->board_config >= 0) | 1383 | if (spec->board_config >= 0) |
| 1371 | fix_pincfg(codec, spec->board_config, cs_pincfgs); | 1384 | fix_pincfg(codec, spec->board_config, cs_pincfgs); |
| 1372 | 1385 | ||
| @@ -1374,10 +1387,11 @@ static int patch_cs420x(struct hda_codec *codec) | |||
| 1374 | case CS420X_IMAC27: | 1387 | case CS420X_IMAC27: |
| 1375 | case CS420X_MBP53: | 1388 | case CS420X_MBP53: |
| 1376 | case CS420X_MBP55: | 1389 | case CS420X_MBP55: |
| 1377 | /* GPIO1 = headphones */ | 1390 | case CS420X_APPLE: |
| 1378 | /* GPIO3 = speakers */ | 1391 | spec->gpio_eapd_hp = 2; /* GPIO1 = headphones */ |
| 1379 | spec->gpio_mask = 0x0a; | 1392 | spec->gpio_eapd_speaker = 8; /* GPIO3 = speakers */ |
| 1380 | spec->gpio_dir = 0x0a; | 1393 | spec->gpio_mask = spec->gpio_dir = |
| 1394 | spec->gpio_eapd_hp | spec->gpio_eapd_speaker; | ||
| 1381 | break; | 1395 | break; |
| 1382 | } | 1396 | } |
| 1383 | 1397 | ||
diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c index 9850c5b481ea..c505fd5d338c 100644 --- a/sound/pci/hda/patch_hdmi.c +++ b/sound/pci/hda/patch_hdmi.c | |||
| @@ -69,6 +69,7 @@ struct hdmi_spec_per_pin { | |||
| 69 | struct hda_codec *codec; | 69 | struct hda_codec *codec; |
| 70 | struct hdmi_eld sink_eld; | 70 | struct hdmi_eld sink_eld; |
| 71 | struct delayed_work work; | 71 | struct delayed_work work; |
| 72 | int repoll_count; | ||
| 72 | }; | 73 | }; |
| 73 | 74 | ||
| 74 | struct hdmi_spec { | 75 | struct hdmi_spec { |
| @@ -748,7 +749,7 @@ static void hdmi_setup_audio_infoframe(struct hda_codec *codec, int pin_idx, | |||
| 748 | * Unsolicited events | 749 | * Unsolicited events |
| 749 | */ | 750 | */ |
| 750 | 751 | ||
| 751 | static void hdmi_present_sense(struct hdmi_spec_per_pin *per_pin, bool retry); | 752 | static void hdmi_present_sense(struct hdmi_spec_per_pin *per_pin, int repoll); |
| 752 | 753 | ||
| 753 | static void hdmi_intrinsic_event(struct hda_codec *codec, unsigned int res) | 754 | static void hdmi_intrinsic_event(struct hda_codec *codec, unsigned int res) |
| 754 | { | 755 | { |
| @@ -766,7 +767,7 @@ static void hdmi_intrinsic_event(struct hda_codec *codec, unsigned int res) | |||
| 766 | if (pin_idx < 0) | 767 | if (pin_idx < 0) |
| 767 | return; | 768 | return; |
| 768 | 769 | ||
| 769 | hdmi_present_sense(&spec->pins[pin_idx], true); | 770 | hdmi_present_sense(&spec->pins[pin_idx], 1); |
| 770 | } | 771 | } |
| 771 | 772 | ||
| 772 | static void hdmi_non_intrinsic_event(struct hda_codec *codec, unsigned int res) | 773 | static void hdmi_non_intrinsic_event(struct hda_codec *codec, unsigned int res) |
| @@ -960,7 +961,7 @@ static int hdmi_read_pin_conn(struct hda_codec *codec, int pin_idx) | |||
| 960 | return 0; | 961 | return 0; |
| 961 | } | 962 | } |
| 962 | 963 | ||
| 963 | static void hdmi_present_sense(struct hdmi_spec_per_pin *per_pin, bool retry) | 964 | static void hdmi_present_sense(struct hdmi_spec_per_pin *per_pin, int repoll) |
| 964 | { | 965 | { |
| 965 | struct hda_codec *codec = per_pin->codec; | 966 | struct hda_codec *codec = per_pin->codec; |
| 966 | struct hdmi_eld *eld = &per_pin->sink_eld; | 967 | struct hdmi_eld *eld = &per_pin->sink_eld; |
| @@ -989,7 +990,7 @@ static void hdmi_present_sense(struct hdmi_spec_per_pin *per_pin, bool retry) | |||
| 989 | if (eld_valid) { | 990 | if (eld_valid) { |
| 990 | if (!snd_hdmi_get_eld(eld, codec, pin_nid)) | 991 | if (!snd_hdmi_get_eld(eld, codec, pin_nid)) |
| 991 | snd_hdmi_show_eld(eld); | 992 | snd_hdmi_show_eld(eld); |
| 992 | else if (retry) { | 993 | else if (repoll) { |
| 993 | queue_delayed_work(codec->bus->workq, | 994 | queue_delayed_work(codec->bus->workq, |
| 994 | &per_pin->work, | 995 | &per_pin->work, |
| 995 | msecs_to_jiffies(300)); | 996 | msecs_to_jiffies(300)); |
| @@ -1004,7 +1005,10 @@ static void hdmi_repoll_eld(struct work_struct *work) | |||
| 1004 | struct hdmi_spec_per_pin *per_pin = | 1005 | struct hdmi_spec_per_pin *per_pin = |
| 1005 | container_of(to_delayed_work(work), struct hdmi_spec_per_pin, work); | 1006 | container_of(to_delayed_work(work), struct hdmi_spec_per_pin, work); |
| 1006 | 1007 | ||
| 1007 | hdmi_present_sense(per_pin, false); | 1008 | if (per_pin->repoll_count++ > 6) |
| 1009 | per_pin->repoll_count = 0; | ||
| 1010 | |||
| 1011 | hdmi_present_sense(per_pin, per_pin->repoll_count); | ||
| 1008 | } | 1012 | } |
| 1009 | 1013 | ||
| 1010 | static int hdmi_add_pin(struct hda_codec *codec, hda_nid_t pin_nid) | 1014 | static int hdmi_add_pin(struct hda_codec *codec, hda_nid_t pin_nid) |
| @@ -1235,7 +1239,7 @@ static int generic_hdmi_build_jack(struct hda_codec *codec, int pin_idx) | |||
| 1235 | if (err < 0) | 1239 | if (err < 0) |
| 1236 | return err; | 1240 | return err; |
| 1237 | 1241 | ||
| 1238 | hdmi_present_sense(per_pin, false); | 1242 | hdmi_present_sense(per_pin, 0); |
| 1239 | return 0; | 1243 | return 0; |
| 1240 | } | 1244 | } |
| 1241 | 1245 | ||
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 336d14eb72af..cbde019d3d52 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
| @@ -277,6 +277,12 @@ static bool alc_dyn_adc_pcm_resetup(struct hda_codec *codec, int cur) | |||
| 277 | return false; | 277 | return false; |
| 278 | } | 278 | } |
| 279 | 279 | ||
| 280 | static inline hda_nid_t get_capsrc(struct alc_spec *spec, int idx) | ||
| 281 | { | ||
| 282 | return spec->capsrc_nids ? | ||
| 283 | spec->capsrc_nids[idx] : spec->adc_nids[idx]; | ||
| 284 | } | ||
| 285 | |||
| 280 | /* select the given imux item; either unmute exclusively or select the route */ | 286 | /* select the given imux item; either unmute exclusively or select the route */ |
| 281 | static int alc_mux_select(struct hda_codec *codec, unsigned int adc_idx, | 287 | static int alc_mux_select(struct hda_codec *codec, unsigned int adc_idx, |
| 282 | unsigned int idx, bool force) | 288 | unsigned int idx, bool force) |
| @@ -303,8 +309,7 @@ static int alc_mux_select(struct hda_codec *codec, unsigned int adc_idx, | |||
| 303 | adc_idx = spec->dyn_adc_idx[idx]; | 309 | adc_idx = spec->dyn_adc_idx[idx]; |
| 304 | } | 310 | } |
| 305 | 311 | ||
| 306 | nid = spec->capsrc_nids ? | 312 | nid = get_capsrc(spec, adc_idx); |
| 307 | spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx]; | ||
| 308 | 313 | ||
| 309 | /* no selection? */ | 314 | /* no selection? */ |
| 310 | num_conns = snd_hda_get_conn_list(codec, nid, NULL); | 315 | num_conns = snd_hda_get_conn_list(codec, nid, NULL); |
| @@ -1054,8 +1059,19 @@ static bool alc_rebuild_imux_for_auto_mic(struct hda_codec *codec) | |||
| 1054 | spec->imux_pins[2] = spec->dock_mic_pin; | 1059 | spec->imux_pins[2] = spec->dock_mic_pin; |
| 1055 | for (i = 0; i < 3; i++) { | 1060 | for (i = 0; i < 3; i++) { |
| 1056 | strcpy(imux->items[i].label, texts[i]); | 1061 | strcpy(imux->items[i].label, texts[i]); |
| 1057 | if (spec->imux_pins[i]) | 1062 | if (spec->imux_pins[i]) { |
| 1063 | hda_nid_t pin = spec->imux_pins[i]; | ||
| 1064 | int c; | ||
| 1065 | for (c = 0; c < spec->num_adc_nids; c++) { | ||
| 1066 | hda_nid_t cap = get_capsrc(spec, c); | ||
| 1067 | int idx = get_connection_index(codec, cap, pin); | ||
| 1068 | if (idx >= 0) { | ||
| 1069 | imux->items[i].index = idx; | ||
| 1070 | break; | ||
| 1071 | } | ||
| 1072 | } | ||
| 1058 | imux->num_items = i + 1; | 1073 | imux->num_items = i + 1; |
| 1074 | } | ||
| 1059 | } | 1075 | } |
| 1060 | spec->num_mux_defs = 1; | 1076 | spec->num_mux_defs = 1; |
| 1061 | spec->input_mux = imux; | 1077 | spec->input_mux = imux; |
| @@ -1957,10 +1973,8 @@ static int alc_build_controls(struct hda_codec *codec) | |||
| 1957 | if (!kctl) | 1973 | if (!kctl) |
| 1958 | kctl = snd_hda_find_mixer_ctl(codec, "Input Source"); | 1974 | kctl = snd_hda_find_mixer_ctl(codec, "Input Source"); |
| 1959 | for (i = 0; kctl && i < kctl->count; i++) { | 1975 | for (i = 0; kctl && i < kctl->count; i++) { |
| 1960 | const hda_nid_t *nids = spec->capsrc_nids; | 1976 | err = snd_hda_add_nid(codec, kctl, i, |
| 1961 | if (!nids) | 1977 | get_capsrc(spec, i)); |
| 1962 | nids = spec->adc_nids; | ||
| 1963 | err = snd_hda_add_nid(codec, kctl, i, nids[i]); | ||
| 1964 | if (err < 0) | 1978 | if (err < 0) |
| 1965 | return err; | 1979 | return err; |
| 1966 | } | 1980 | } |
| @@ -2747,8 +2761,7 @@ static int alc_auto_create_input_ctls(struct hda_codec *codec) | |||
| 2747 | } | 2761 | } |
| 2748 | 2762 | ||
| 2749 | for (c = 0; c < num_adcs; c++) { | 2763 | for (c = 0; c < num_adcs; c++) { |
| 2750 | hda_nid_t cap = spec->capsrc_nids ? | 2764 | hda_nid_t cap = get_capsrc(spec, c); |
| 2751 | spec->capsrc_nids[c] : spec->adc_nids[c]; | ||
| 2752 | idx = get_connection_index(codec, cap, pin); | 2765 | idx = get_connection_index(codec, cap, pin); |
| 2753 | if (idx >= 0) { | 2766 | if (idx >= 0) { |
| 2754 | spec->imux_pins[imux->num_items] = pin; | 2767 | spec->imux_pins[imux->num_items] = pin; |
| @@ -3694,8 +3707,7 @@ static int init_capsrc_for_pin(struct hda_codec *codec, hda_nid_t pin) | |||
| 3694 | if (!pin) | 3707 | if (!pin) |
| 3695 | return 0; | 3708 | return 0; |
| 3696 | for (i = 0; i < spec->num_adc_nids; i++) { | 3709 | for (i = 0; i < spec->num_adc_nids; i++) { |
| 3697 | hda_nid_t cap = spec->capsrc_nids ? | 3710 | hda_nid_t cap = get_capsrc(spec, i); |
| 3698 | spec->capsrc_nids[i] : spec->adc_nids[i]; | ||
| 3699 | int idx; | 3711 | int idx; |
| 3700 | 3712 | ||
| 3701 | idx = get_connection_index(codec, cap, pin); | 3713 | idx = get_connection_index(codec, cap, pin); |
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index 470f6f286e81..d8d2f9dccd9b 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c | |||
| @@ -1641,6 +1641,8 @@ static const struct snd_pci_quirk stac92hd73xx_codec_id_cfg_tbl[] = { | |||
| 1641 | "Alienware M17x", STAC_ALIENWARE_M17X), | 1641 | "Alienware M17x", STAC_ALIENWARE_M17X), |
| 1642 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x043a, | 1642 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x043a, |
| 1643 | "Alienware M17x", STAC_ALIENWARE_M17X), | 1643 | "Alienware M17x", STAC_ALIENWARE_M17X), |
| 1644 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0490, | ||
| 1645 | "Alienware M17x", STAC_ALIENWARE_M17X), | ||
| 1644 | {} /* terminator */ | 1646 | {} /* terminator */ |
| 1645 | }; | 1647 | }; |
| 1646 | 1648 | ||
| @@ -4439,7 +4441,9 @@ static int stac92xx_init(struct hda_codec *codec) | |||
| 4439 | int pinctl, def_conf; | 4441 | int pinctl, def_conf; |
| 4440 | 4442 | ||
| 4441 | /* power on when no jack detection is available */ | 4443 | /* power on when no jack detection is available */ |
| 4442 | if (!spec->hp_detect) { | 4444 | /* or when the VREF is used for controlling LED */ |
| 4445 | if (!spec->hp_detect || | ||
| 4446 | (spec->gpio_led > 8 && spec->gpio_led == nid)) { | ||
| 4443 | stac_toggle_power_map(codec, nid, 1); | 4447 | stac_toggle_power_map(codec, nid, 1); |
| 4444 | continue; | 4448 | continue; |
| 4445 | } | 4449 | } |
| @@ -5053,20 +5057,6 @@ static int stac92xx_pre_resume(struct hda_codec *codec) | |||
| 5053 | return 0; | 5057 | return 0; |
| 5054 | } | 5058 | } |
| 5055 | 5059 | ||
| 5056 | static int stac92xx_post_suspend(struct hda_codec *codec) | ||
| 5057 | { | ||
| 5058 | struct sigmatel_spec *spec = codec->spec; | ||
| 5059 | if (spec->gpio_led > 8) { | ||
| 5060 | /* with vref-out pin used for mute led control | ||
| 5061 | * codec AFG is prevented from D3 state, but on | ||
| 5062 | * system suspend it can (and should) be used | ||
| 5063 | */ | ||
| 5064 | snd_hda_codec_read(codec, codec->afg, 0, | ||
| 5065 | AC_VERB_SET_POWER_STATE, AC_PWRST_D3); | ||
| 5066 | } | ||
| 5067 | return 0; | ||
| 5068 | } | ||
| 5069 | |||
| 5070 | static void stac92xx_set_power_state(struct hda_codec *codec, hda_nid_t fg, | 5060 | static void stac92xx_set_power_state(struct hda_codec *codec, hda_nid_t fg, |
| 5071 | unsigned int power_state) | 5061 | unsigned int power_state) |
| 5072 | { | 5062 | { |
| @@ -5666,8 +5656,6 @@ again: | |||
| 5666 | } else { | 5656 | } else { |
| 5667 | codec->patch_ops.set_power_state = | 5657 | codec->patch_ops.set_power_state = |
| 5668 | stac92xx_set_power_state; | 5658 | stac92xx_set_power_state; |
| 5669 | codec->patch_ops.post_suspend = | ||
| 5670 | stac92xx_post_suspend; | ||
| 5671 | } | 5659 | } |
| 5672 | codec->patch_ops.pre_resume = stac92xx_pre_resume; | 5660 | codec->patch_ops.pre_resume = stac92xx_pre_resume; |
| 5673 | codec->patch_ops.check_power_status = | 5661 | codec->patch_ops.check_power_status = |
| @@ -5981,8 +5969,6 @@ again: | |||
| 5981 | } else { | 5969 | } else { |
| 5982 | codec->patch_ops.set_power_state = | 5970 | codec->patch_ops.set_power_state = |
| 5983 | stac92xx_set_power_state; | 5971 | stac92xx_set_power_state; |
| 5984 | codec->patch_ops.post_suspend = | ||
| 5985 | stac92xx_post_suspend; | ||
| 5986 | } | 5972 | } |
| 5987 | codec->patch_ops.pre_resume = stac92xx_pre_resume; | 5973 | codec->patch_ops.pre_resume = stac92xx_pre_resume; |
| 5988 | codec->patch_ops.check_power_status = | 5974 | codec->patch_ops.check_power_status = |
diff --git a/sound/pci/hda/patch_via.c b/sound/pci/hda/patch_via.c index 431c0d417eeb..b5137629f8e9 100644 --- a/sound/pci/hda/patch_via.c +++ b/sound/pci/hda/patch_via.c | |||
| @@ -208,6 +208,7 @@ struct via_spec { | |||
| 208 | /* work to check hp jack state */ | 208 | /* work to check hp jack state */ |
| 209 | struct hda_codec *codec; | 209 | struct hda_codec *codec; |
| 210 | struct delayed_work vt1708_hp_work; | 210 | struct delayed_work vt1708_hp_work; |
| 211 | int hp_work_active; | ||
| 211 | int vt1708_jack_detect; | 212 | int vt1708_jack_detect; |
| 212 | int vt1708_hp_present; | 213 | int vt1708_hp_present; |
| 213 | 214 | ||
| @@ -305,27 +306,35 @@ enum { | |||
| 305 | static void analog_low_current_mode(struct hda_codec *codec); | 306 | static void analog_low_current_mode(struct hda_codec *codec); |
| 306 | static bool is_aa_path_mute(struct hda_codec *codec); | 307 | static bool is_aa_path_mute(struct hda_codec *codec); |
| 307 | 308 | ||
| 308 | static void vt1708_start_hp_work(struct via_spec *spec) | 309 | #define hp_detect_with_aa(codec) \ |
| 310 | (snd_hda_get_bool_hint(codec, "analog_loopback_hp_detect") == 1 && \ | ||
| 311 | !is_aa_path_mute(codec)) | ||
| 312 | |||
| 313 | static void vt1708_stop_hp_work(struct via_spec *spec) | ||
| 309 | { | 314 | { |
| 310 | if (spec->codec_type != VT1708 || spec->autocfg.hp_pins[0] == 0) | 315 | if (spec->codec_type != VT1708 || spec->autocfg.hp_pins[0] == 0) |
| 311 | return; | 316 | return; |
| 312 | snd_hda_codec_write(spec->codec, 0x1, 0, 0xf81, | 317 | if (spec->hp_work_active) { |
| 313 | !spec->vt1708_jack_detect); | 318 | snd_hda_codec_write(spec->codec, 0x1, 0, 0xf81, 1); |
| 314 | if (!delayed_work_pending(&spec->vt1708_hp_work)) | 319 | cancel_delayed_work_sync(&spec->vt1708_hp_work); |
| 315 | schedule_delayed_work(&spec->vt1708_hp_work, | 320 | spec->hp_work_active = 0; |
| 316 | msecs_to_jiffies(100)); | 321 | } |
| 317 | } | 322 | } |
| 318 | 323 | ||
| 319 | static void vt1708_stop_hp_work(struct via_spec *spec) | 324 | static void vt1708_update_hp_work(struct via_spec *spec) |
| 320 | { | 325 | { |
| 321 | if (spec->codec_type != VT1708 || spec->autocfg.hp_pins[0] == 0) | 326 | if (spec->codec_type != VT1708 || spec->autocfg.hp_pins[0] == 0) |
| 322 | return; | 327 | return; |
| 323 | if (snd_hda_get_bool_hint(spec->codec, "analog_loopback_hp_detect") == 1 | 328 | if (spec->vt1708_jack_detect && |
| 324 | && !is_aa_path_mute(spec->codec)) | 329 | (spec->active_streams || hp_detect_with_aa(spec->codec))) { |
| 325 | return; | 330 | if (!spec->hp_work_active) { |
| 326 | snd_hda_codec_write(spec->codec, 0x1, 0, 0xf81, | 331 | snd_hda_codec_write(spec->codec, 0x1, 0, 0xf81, 0); |
| 327 | !spec->vt1708_jack_detect); | 332 | schedule_delayed_work(&spec->vt1708_hp_work, |
| 328 | cancel_delayed_work_sync(&spec->vt1708_hp_work); | 333 | msecs_to_jiffies(100)); |
| 334 | spec->hp_work_active = 1; | ||
| 335 | } | ||
| 336 | } else if (!hp_detect_with_aa(spec->codec)) | ||
| 337 | vt1708_stop_hp_work(spec); | ||
| 329 | } | 338 | } |
| 330 | 339 | ||
| 331 | static void set_widgets_power_state(struct hda_codec *codec) | 340 | static void set_widgets_power_state(struct hda_codec *codec) |
| @@ -343,12 +352,7 @@ static int analog_input_switch_put(struct snd_kcontrol *kcontrol, | |||
| 343 | 352 | ||
| 344 | set_widgets_power_state(codec); | 353 | set_widgets_power_state(codec); |
| 345 | analog_low_current_mode(snd_kcontrol_chip(kcontrol)); | 354 | analog_low_current_mode(snd_kcontrol_chip(kcontrol)); |
| 346 | if (snd_hda_get_bool_hint(codec, "analog_loopback_hp_detect") == 1) { | 355 | vt1708_update_hp_work(codec->spec); |
| 347 | if (is_aa_path_mute(codec)) | ||
| 348 | vt1708_start_hp_work(codec->spec); | ||
| 349 | else | ||
| 350 | vt1708_stop_hp_work(codec->spec); | ||
| 351 | } | ||
| 352 | return change; | 356 | return change; |
| 353 | } | 357 | } |
| 354 | 358 | ||
| @@ -1154,7 +1158,7 @@ static int via_playback_multi_pcm_prepare(struct hda_pcm_stream *hinfo, | |||
| 1154 | spec->cur_dac_stream_tag = stream_tag; | 1158 | spec->cur_dac_stream_tag = stream_tag; |
| 1155 | spec->cur_dac_format = format; | 1159 | spec->cur_dac_format = format; |
| 1156 | mutex_unlock(&spec->config_mutex); | 1160 | mutex_unlock(&spec->config_mutex); |
| 1157 | vt1708_start_hp_work(spec); | 1161 | vt1708_update_hp_work(spec); |
| 1158 | return 0; | 1162 | return 0; |
| 1159 | } | 1163 | } |
| 1160 | 1164 | ||
| @@ -1174,7 +1178,7 @@ static int via_playback_hp_pcm_prepare(struct hda_pcm_stream *hinfo, | |||
| 1174 | spec->cur_hp_stream_tag = stream_tag; | 1178 | spec->cur_hp_stream_tag = stream_tag; |
| 1175 | spec->cur_hp_format = format; | 1179 | spec->cur_hp_format = format; |
| 1176 | mutex_unlock(&spec->config_mutex); | 1180 | mutex_unlock(&spec->config_mutex); |
| 1177 | vt1708_start_hp_work(spec); | 1181 | vt1708_update_hp_work(spec); |
| 1178 | return 0; | 1182 | return 0; |
| 1179 | } | 1183 | } |
| 1180 | 1184 | ||
| @@ -1188,7 +1192,7 @@ static int via_playback_multi_pcm_cleanup(struct hda_pcm_stream *hinfo, | |||
| 1188 | snd_hda_multi_out_analog_cleanup(codec, &spec->multiout); | 1192 | snd_hda_multi_out_analog_cleanup(codec, &spec->multiout); |
| 1189 | spec->active_streams &= ~STREAM_MULTI_OUT; | 1193 | spec->active_streams &= ~STREAM_MULTI_OUT; |
| 1190 | mutex_unlock(&spec->config_mutex); | 1194 | mutex_unlock(&spec->config_mutex); |
| 1191 | vt1708_stop_hp_work(spec); | 1195 | vt1708_update_hp_work(spec); |
| 1192 | return 0; | 1196 | return 0; |
| 1193 | } | 1197 | } |
| 1194 | 1198 | ||
| @@ -1203,7 +1207,7 @@ static int via_playback_hp_pcm_cleanup(struct hda_pcm_stream *hinfo, | |||
| 1203 | snd_hda_codec_setup_stream(codec, spec->hp_dac_nid, 0, 0, 0); | 1207 | snd_hda_codec_setup_stream(codec, spec->hp_dac_nid, 0, 0, 0); |
| 1204 | spec->active_streams &= ~STREAM_INDEP_HP; | 1208 | spec->active_streams &= ~STREAM_INDEP_HP; |
| 1205 | mutex_unlock(&spec->config_mutex); | 1209 | mutex_unlock(&spec->config_mutex); |
| 1206 | vt1708_stop_hp_work(spec); | 1210 | vt1708_update_hp_work(spec); |
| 1207 | return 0; | 1211 | return 0; |
| 1208 | } | 1212 | } |
| 1209 | 1213 | ||
| @@ -1645,7 +1649,8 @@ static void via_hp_automute(struct hda_codec *codec) | |||
| 1645 | int nums; | 1649 | int nums; |
| 1646 | struct via_spec *spec = codec->spec; | 1650 | struct via_spec *spec = codec->spec; |
| 1647 | 1651 | ||
| 1648 | if (!spec->hp_independent_mode && spec->autocfg.hp_pins[0]) | 1652 | if (!spec->hp_independent_mode && spec->autocfg.hp_pins[0] && |
| 1653 | (spec->codec_type != VT1708 || spec->vt1708_jack_detect)) | ||
| 1649 | present = snd_hda_jack_detect(codec, spec->autocfg.hp_pins[0]); | 1654 | present = snd_hda_jack_detect(codec, spec->autocfg.hp_pins[0]); |
| 1650 | 1655 | ||
| 1651 | if (spec->smart51_enabled) | 1656 | if (spec->smart51_enabled) |
| @@ -2612,8 +2617,6 @@ static int vt1708_jack_detect_get(struct snd_kcontrol *kcontrol, | |||
| 2612 | 2617 | ||
| 2613 | if (spec->codec_type != VT1708) | 2618 | if (spec->codec_type != VT1708) |
| 2614 | return 0; | 2619 | return 0; |
| 2615 | spec->vt1708_jack_detect = | ||
| 2616 | !((snd_hda_codec_read(codec, 0x1, 0, 0xf84, 0) >> 8) & 0x1); | ||
| 2617 | ucontrol->value.integer.value[0] = spec->vt1708_jack_detect; | 2620 | ucontrol->value.integer.value[0] = spec->vt1708_jack_detect; |
| 2618 | return 0; | 2621 | return 0; |
| 2619 | } | 2622 | } |
| @@ -2623,18 +2626,22 @@ static int vt1708_jack_detect_put(struct snd_kcontrol *kcontrol, | |||
| 2623 | { | 2626 | { |
| 2624 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | 2627 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2625 | struct via_spec *spec = codec->spec; | 2628 | struct via_spec *spec = codec->spec; |
| 2626 | int change; | 2629 | int val; |
| 2627 | 2630 | ||
| 2628 | if (spec->codec_type != VT1708) | 2631 | if (spec->codec_type != VT1708) |
| 2629 | return 0; | 2632 | return 0; |
| 2630 | spec->vt1708_jack_detect = ucontrol->value.integer.value[0]; | 2633 | val = !!ucontrol->value.integer.value[0]; |
| 2631 | change = (0x1 & (snd_hda_codec_read(codec, 0x1, 0, 0xf84, 0) >> 8)) | 2634 | if (spec->vt1708_jack_detect == val) |
| 2632 | == !spec->vt1708_jack_detect; | 2635 | return 0; |
| 2633 | if (spec->vt1708_jack_detect) { | 2636 | spec->vt1708_jack_detect = val; |
| 2637 | if (spec->vt1708_jack_detect && | ||
| 2638 | snd_hda_get_bool_hint(codec, "analog_loopback_hp_detect") != 1) { | ||
| 2634 | mute_aa_path(codec, 1); | 2639 | mute_aa_path(codec, 1); |
| 2635 | notify_aa_path_ctls(codec); | 2640 | notify_aa_path_ctls(codec); |
| 2636 | } | 2641 | } |
| 2637 | return change; | 2642 | via_hp_automute(codec); |
| 2643 | vt1708_update_hp_work(spec); | ||
| 2644 | return 1; | ||
| 2638 | } | 2645 | } |
| 2639 | 2646 | ||
| 2640 | static const struct snd_kcontrol_new vt1708_jack_detect_ctl = { | 2647 | static const struct snd_kcontrol_new vt1708_jack_detect_ctl = { |
| @@ -2771,6 +2778,7 @@ static int via_init(struct hda_codec *codec) | |||
| 2771 | via_auto_init_unsol_event(codec); | 2778 | via_auto_init_unsol_event(codec); |
| 2772 | 2779 | ||
| 2773 | via_hp_automute(codec); | 2780 | via_hp_automute(codec); |
| 2781 | vt1708_update_hp_work(spec); | ||
| 2774 | 2782 | ||
| 2775 | return 0; | 2783 | return 0; |
| 2776 | } | 2784 | } |
| @@ -2787,7 +2795,9 @@ static void vt1708_update_hp_jack_state(struct work_struct *work) | |||
| 2787 | spec->vt1708_hp_present ^= 1; | 2795 | spec->vt1708_hp_present ^= 1; |
| 2788 | via_hp_automute(spec->codec); | 2796 | via_hp_automute(spec->codec); |
| 2789 | } | 2797 | } |
| 2790 | vt1708_start_hp_work(spec); | 2798 | if (spec->vt1708_jack_detect) |
| 2799 | schedule_delayed_work(&spec->vt1708_hp_work, | ||
| 2800 | msecs_to_jiffies(100)); | ||
| 2791 | } | 2801 | } |
| 2792 | 2802 | ||
| 2793 | static int get_mux_nids(struct hda_codec *codec) | 2803 | static int get_mux_nids(struct hda_codec *codec) |
diff --git a/sound/pci/lx6464es/lx_core.c b/sound/pci/lx6464es/lx_core.c index 5c8717e29eeb..8c3e7fcefd99 100644 --- a/sound/pci/lx6464es/lx_core.c +++ b/sound/pci/lx6464es/lx_core.c | |||
| @@ -78,10 +78,15 @@ unsigned long lx_dsp_reg_read(struct lx6464es *chip, int port) | |||
| 78 | return ioread32(address); | 78 | return ioread32(address); |
| 79 | } | 79 | } |
| 80 | 80 | ||
| 81 | void lx_dsp_reg_readbuf(struct lx6464es *chip, int port, u32 *data, u32 len) | 81 | static void lx_dsp_reg_readbuf(struct lx6464es *chip, int port, u32 *data, |
| 82 | u32 len) | ||
| 82 | { | 83 | { |
| 83 | void __iomem *address = lx_dsp_register(chip, port); | 84 | u32 __iomem *address = lx_dsp_register(chip, port); |
| 84 | memcpy_fromio(data, address, len*sizeof(u32)); | 85 | int i; |
| 86 | |||
| 87 | /* we cannot use memcpy_fromio */ | ||
| 88 | for (i = 0; i != len; ++i) | ||
| 89 | data[i] = ioread32(address + i); | ||
| 85 | } | 90 | } |
| 86 | 91 | ||
| 87 | 92 | ||
| @@ -91,11 +96,15 @@ void lx_dsp_reg_write(struct lx6464es *chip, int port, unsigned data) | |||
| 91 | iowrite32(data, address); | 96 | iowrite32(data, address); |
| 92 | } | 97 | } |
| 93 | 98 | ||
| 94 | void lx_dsp_reg_writebuf(struct lx6464es *chip, int port, const u32 *data, | 99 | static void lx_dsp_reg_writebuf(struct lx6464es *chip, int port, |
| 95 | u32 len) | 100 | const u32 *data, u32 len) |
| 96 | { | 101 | { |
| 97 | void __iomem *address = lx_dsp_register(chip, port); | 102 | u32 __iomem *address = lx_dsp_register(chip, port); |
| 98 | memcpy_toio(address, data, len*sizeof(u32)); | 103 | int i; |
| 104 | |||
| 105 | /* we cannot use memcpy_to */ | ||
| 106 | for (i = 0; i != len; ++i) | ||
| 107 | iowrite32(data[i], address + i); | ||
| 99 | } | 108 | } |
| 100 | 109 | ||
| 101 | 110 | ||
diff --git a/sound/pci/lx6464es/lx_core.h b/sound/pci/lx6464es/lx_core.h index 1dd562980b6c..4d7ff797a646 100644 --- a/sound/pci/lx6464es/lx_core.h +++ b/sound/pci/lx6464es/lx_core.h | |||
| @@ -72,10 +72,7 @@ enum { | |||
| 72 | }; | 72 | }; |
| 73 | 73 | ||
| 74 | unsigned long lx_dsp_reg_read(struct lx6464es *chip, int port); | 74 | unsigned long lx_dsp_reg_read(struct lx6464es *chip, int port); |
| 75 | void lx_dsp_reg_readbuf(struct lx6464es *chip, int port, u32 *data, u32 len); | ||
| 76 | void lx_dsp_reg_write(struct lx6464es *chip, int port, unsigned data); | 75 | void lx_dsp_reg_write(struct lx6464es *chip, int port, unsigned data); |
| 77 | void lx_dsp_reg_writebuf(struct lx6464es *chip, int port, const u32 *data, | ||
| 78 | u32 len); | ||
| 79 | 76 | ||
| 80 | /* plx register access */ | 77 | /* plx register access */ |
| 81 | enum { | 78 | enum { |
diff --git a/sound/pci/rme9652/hdspm.c b/sound/pci/rme9652/hdspm.c index e760adad9523..19ee2203cbb5 100644 --- a/sound/pci/rme9652/hdspm.c +++ b/sound/pci/rme9652/hdspm.c | |||
| @@ -6518,7 +6518,7 @@ static int __devinit snd_hdspm_create(struct snd_card *card, | |||
| 6518 | hdspm->io_type = AES32; | 6518 | hdspm->io_type = AES32; |
| 6519 | hdspm->card_name = "RME AES32"; | 6519 | hdspm->card_name = "RME AES32"; |
| 6520 | hdspm->midiPorts = 2; | 6520 | hdspm->midiPorts = 2; |
| 6521 | } else if ((hdspm->firmware_rev == 0xd5) || | 6521 | } else if ((hdspm->firmware_rev == 0xd2) || |
| 6522 | ((hdspm->firmware_rev >= 0xc8) && | 6522 | ((hdspm->firmware_rev >= 0xc8) && |
| 6523 | (hdspm->firmware_rev <= 0xcf))) { | 6523 | (hdspm->firmware_rev <= 0xcf))) { |
| 6524 | hdspm->io_type = MADI; | 6524 | hdspm->io_type = MADI; |
diff --git a/sound/soc/atmel/Kconfig b/sound/soc/atmel/Kconfig index bee3c94f58b0..d1fcc816ce97 100644 --- a/sound/soc/atmel/Kconfig +++ b/sound/soc/atmel/Kconfig | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | config SND_ATMEL_SOC | 1 | config SND_ATMEL_SOC |
| 2 | tristate "SoC Audio for the Atmel System-on-Chip" | 2 | tristate "SoC Audio for the Atmel System-on-Chip" |
| 3 | depends on ARCH_AT91 || AVR32 | 3 | depends on ARCH_AT91 |
| 4 | help | 4 | help |
| 5 | Say Y or M if you want to add support for codecs attached to | 5 | Say Y or M if you want to add support for codecs attached to |
| 6 | the ATMEL SSC interface. You will also need | 6 | the ATMEL SSC interface. You will also need |
| @@ -24,25 +24,6 @@ config SND_AT91_SOC_SAM9G20_WM8731 | |||
| 24 | Say Y if you want to add support for SoC audio on WM8731-based | 24 | Say Y if you want to add support for SoC audio on WM8731-based |
| 25 | AT91sam9g20 evaluation board. | 25 | AT91sam9g20 evaluation board. |
| 26 | 26 | ||
| 27 | config SND_AT32_SOC_PLAYPAQ | ||
| 28 | tristate "SoC Audio support for PlayPaq with WM8510" | ||
| 29 | depends on SND_ATMEL_SOC && BOARD_PLAYPAQ && AT91_PROGRAMMABLE_CLOCKS | ||
| 30 | select SND_ATMEL_SOC_SSC | ||
| 31 | select SND_SOC_WM8510 | ||
| 32 | help | ||
| 33 | Say Y or M here if you want to add support for SoC audio | ||
| 34 | on the LRS PlayPaq. | ||
| 35 | |||
| 36 | config SND_AT32_SOC_PLAYPAQ_SLAVE | ||
| 37 | bool "Run CODEC on PlayPaq in slave mode" | ||
| 38 | depends on SND_AT32_SOC_PLAYPAQ | ||
| 39 | default n | ||
| 40 | help | ||
| 41 | Say Y if you want to run with the AT32 SSC generating the BCLK | ||
| 42 | and FRAME signals on the PlayPaq. Unless you want to play | ||
| 43 | with the AT32 as the SSC master, you probably want to say N here, | ||
| 44 | as this will give you better sound quality. | ||
| 45 | |||
| 46 | config SND_AT91_SOC_AFEB9260 | 27 | config SND_AT91_SOC_AFEB9260 |
| 47 | tristate "SoC Audio support for AFEB9260 board" | 28 | tristate "SoC Audio support for AFEB9260 board" |
| 48 | depends on ARCH_AT91 && MACH_AFEB9260 && SND_ATMEL_SOC | 29 | depends on ARCH_AT91 && MACH_AFEB9260 && SND_ATMEL_SOC |
diff --git a/sound/soc/atmel/Makefile b/sound/soc/atmel/Makefile index e7ea56bd5f82..a5c0bf19da78 100644 --- a/sound/soc/atmel/Makefile +++ b/sound/soc/atmel/Makefile | |||
| @@ -8,9 +8,5 @@ obj-$(CONFIG_SND_ATMEL_SOC_SSC) += snd-soc-atmel_ssc_dai.o | |||
| 8 | # AT91 Machine Support | 8 | # AT91 Machine Support |
| 9 | snd-soc-sam9g20-wm8731-objs := sam9g20_wm8731.o | 9 | snd-soc-sam9g20-wm8731-objs := sam9g20_wm8731.o |
| 10 | 10 | ||
| 11 | # AT32 Machine Support | ||
| 12 | snd-soc-playpaq-objs := playpaq_wm8510.o | ||
| 13 | |||
| 14 | obj-$(CONFIG_SND_AT91_SOC_SAM9G20_WM8731) += snd-soc-sam9g20-wm8731.o | 11 | obj-$(CONFIG_SND_AT91_SOC_SAM9G20_WM8731) += snd-soc-sam9g20-wm8731.o |
| 15 | obj-$(CONFIG_SND_AT32_SOC_PLAYPAQ) += snd-soc-playpaq.o | ||
| 16 | obj-$(CONFIG_SND_AT91_SOC_AFEB9260) += snd-soc-afeb9260.o | 12 | obj-$(CONFIG_SND_AT91_SOC_AFEB9260) += snd-soc-afeb9260.o |
diff --git a/sound/soc/atmel/playpaq_wm8510.c b/sound/soc/atmel/playpaq_wm8510.c deleted file mode 100644 index 73ae99ad4578..000000000000 --- a/sound/soc/atmel/playpaq_wm8510.c +++ /dev/null | |||
| @@ -1,473 +0,0 @@ | |||
| 1 | /* sound/soc/at32/playpaq_wm8510.c | ||
| 2 | * ASoC machine driver for PlayPaq using WM8510 codec | ||
| 3 | * | ||
| 4 | * Copyright (C) 2008 Long Range Systems | ||
| 5 | * Geoffrey Wossum <gwossum@acm.org> | ||
| 6 | * | ||
| 7 | * This program is free software; you can redistribute it and/or modify | ||
| 8 | * it under the terms of the GNU General Public License version 2 as | ||
| 9 | * published by the Free Software Foundation. | ||
| 10 | * | ||
| 11 | * This code is largely inspired by sound/soc/at91/eti_b1_wm8731.c | ||
| 12 | * | ||
| 13 | * NOTE: If you don't have the AT32 enhanced portmux configured (which | ||
| 14 | * isn't currently in the mainline or Atmel patched kernel), you will | ||
| 15 | * need to set the MCLK pin (PA30) to peripheral A in your board initialization | ||
| 16 | * code. Something like: | ||
| 17 | * at32_select_periph(GPIO_PIN_PA(30), GPIO_PERIPH_A, 0); | ||
| 18 | * | ||
| 19 | */ | ||
| 20 | |||
| 21 | /* #define DEBUG */ | ||
| 22 | |||
| 23 | #include <linux/module.h> | ||
| 24 | #include <linux/moduleparam.h> | ||
| 25 | #include <linux/kernel.h> | ||
| 26 | #include <linux/errno.h> | ||
| 27 | #include <linux/clk.h> | ||
| 28 | #include <linux/timer.h> | ||
| 29 | #include <linux/interrupt.h> | ||
| 30 | #include <linux/platform_device.h> | ||
| 31 | |||
| 32 | #include <sound/core.h> | ||
| 33 | #include <sound/pcm.h> | ||
| 34 | #include <sound/pcm_params.h> | ||
| 35 | #include <sound/soc.h> | ||
| 36 | |||
| 37 | #include <mach/at32ap700x.h> | ||
| 38 | #include <mach/portmux.h> | ||
| 39 | |||
| 40 | #include "../codecs/wm8510.h" | ||
| 41 | #include "atmel-pcm.h" | ||
| 42 | #include "atmel_ssc_dai.h" | ||
| 43 | |||
| 44 | |||
| 45 | /*-------------------------------------------------------------------------*\ | ||
| 46 | * constants | ||
| 47 | \*-------------------------------------------------------------------------*/ | ||
| 48 | #define MCLK_PIN GPIO_PIN_PA(30) | ||
| 49 | #define MCLK_PERIPH GPIO_PERIPH_A | ||
| 50 | |||
| 51 | |||
| 52 | /*-------------------------------------------------------------------------*\ | ||
| 53 | * data types | ||
| 54 | \*-------------------------------------------------------------------------*/ | ||
| 55 | /* SSC clocking data */ | ||
| 56 | struct ssc_clock_data { | ||
| 57 | /* CMR div */ | ||
| 58 | unsigned int cmr_div; | ||
| 59 | |||
| 60 | /* Frame period (as needed by xCMR.PERIOD) */ | ||
| 61 | unsigned int period; | ||
| 62 | |||
| 63 | /* The SSC clock rate these settings where calculated for */ | ||
| 64 | unsigned long ssc_rate; | ||
| 65 | }; | ||
| 66 | |||
| 67 | |||
| 68 | /*-------------------------------------------------------------------------*\ | ||
| 69 | * module data | ||
| 70 | \*-------------------------------------------------------------------------*/ | ||
| 71 | static struct clk *_gclk0; | ||
| 72 | static struct clk *_pll0; | ||
| 73 | |||
| 74 | #define CODEC_CLK (_gclk0) | ||
| 75 | |||
| 76 | |||
| 77 | /*-------------------------------------------------------------------------*\ | ||
| 78 | * Sound SOC operations | ||
| 79 | \*-------------------------------------------------------------------------*/ | ||
| 80 | #if defined CONFIG_SND_AT32_SOC_PLAYPAQ_SLAVE | ||
| 81 | static struct ssc_clock_data playpaq_wm8510_calc_ssc_clock( | ||
| 82 | struct snd_pcm_hw_params *params, | ||
| 83 | struct snd_soc_dai *cpu_dai) | ||
| 84 | { | ||
| 85 | struct at32_ssc_info *ssc_p = snd_soc_dai_get_drvdata(cpu_dai); | ||
| 86 | struct ssc_device *ssc = ssc_p->ssc; | ||
| 87 | struct ssc_clock_data cd; | ||
| 88 | unsigned int rate, width_bits, channels; | ||
| 89 | unsigned int bitrate, ssc_div; | ||
| 90 | unsigned actual_rate; | ||
| 91 | |||
| 92 | |||
| 93 | /* | ||
| 94 | * Figure out required bitrate | ||
| 95 | */ | ||
| 96 | rate = params_rate(params); | ||
| 97 | channels = params_channels(params); | ||
| 98 | width_bits = snd_pcm_format_physical_width(params_format(params)); | ||
| 99 | bitrate = rate * width_bits * channels; | ||
| 100 | |||
| 101 | |||
| 102 | /* | ||
| 103 | * Figure out required SSC divider and period for required bitrate | ||
| 104 | */ | ||
| 105 | cd.ssc_rate = clk_get_rate(ssc->clk); | ||
| 106 | ssc_div = cd.ssc_rate / bitrate; | ||
| 107 | cd.cmr_div = ssc_div / 2; | ||
| 108 | if (ssc_div & 1) { | ||
| 109 | /* round cmr_div up */ | ||
| 110 | cd.cmr_div++; | ||
| 111 | } | ||
| 112 | cd.period = width_bits - 1; | ||
| 113 | |||
| 114 | |||
| 115 | /* | ||
| 116 | * Find actual rate, compare to requested rate | ||
| 117 | */ | ||
| 118 | actual_rate = (cd.ssc_rate / (cd.cmr_div * 2)) / (2 * (cd.period + 1)); | ||
| 119 | pr_debug("playpaq_wm8510: Request rate = %u, actual rate = %u\n", | ||
| 120 | rate, actual_rate); | ||
| 121 | |||
| 122 | |||
| 123 | return cd; | ||
| 124 | } | ||
| 125 | #endif /* CONFIG_SND_AT32_SOC_PLAYPAQ_SLAVE */ | ||
| 126 | |||
| 127 | |||
| 128 | |||
| 129 | static int playpaq_wm8510_hw_params(struct snd_pcm_substream *substream, | ||
| 130 | struct snd_pcm_hw_params *params) | ||
| 131 | { | ||
| 132 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | ||
| 133 | struct snd_soc_dai *codec_dai = rtd->codec_dai; | ||
| 134 | struct snd_soc_dai *cpu_dai = rtd->cpu_dai; | ||
| 135 | struct at32_ssc_info *ssc_p = snd_soc_dai_get_drvdata(cpu_dai); | ||
| 136 | struct ssc_device *ssc = ssc_p->ssc; | ||
| 137 | unsigned int pll_out = 0, bclk = 0, mclk_div = 0; | ||
| 138 | int ret; | ||
| 139 | |||
| 140 | |||
| 141 | /* Due to difficulties with getting the correct clocks from the AT32's | ||
| 142 | * PLL0, we're going to let the CODEC be in charge of all the clocks | ||
| 143 | */ | ||
| 144 | #if !defined CONFIG_SND_AT32_SOC_PLAYPAQ_SLAVE | ||
| 145 | const unsigned int fmt = (SND_SOC_DAIFMT_I2S | | ||
| 146 | SND_SOC_DAIFMT_NB_NF | | ||
| 147 | SND_SOC_DAIFMT_CBM_CFM); | ||
| 148 | #else | ||
| 149 | struct ssc_clock_data cd; | ||
| 150 | const unsigned int fmt = (SND_SOC_DAIFMT_I2S | | ||
| 151 | SND_SOC_DAIFMT_NB_NF | | ||
| 152 | SND_SOC_DAIFMT_CBS_CFS); | ||
| 153 | #endif | ||
| 154 | |||
| 155 | if (ssc == NULL) { | ||
| 156 | pr_warning("playpaq_wm8510_hw_params: ssc is NULL!\n"); | ||
| 157 | return -EINVAL; | ||
| 158 | } | ||
| 159 | |||
| 160 | |||
| 161 | /* | ||
| 162 | * Figure out PLL and BCLK dividers for WM8510 | ||
| 163 | */ | ||
| 164 | switch (params_rate(params)) { | ||
| 165 | case 48000: | ||
| 166 | pll_out = 24576000; | ||
| 167 | mclk_div = WM8510_MCLKDIV_2; | ||
| 168 | bclk = WM8510_BCLKDIV_8; | ||
| 169 | break; | ||
| 170 | |||
| 171 | case 44100: | ||
| 172 | pll_out = 22579200; | ||
| 173 | mclk_div = WM8510_MCLKDIV_2; | ||
| 174 | bclk = WM8510_BCLKDIV_8; | ||
| 175 | break; | ||
| 176 | |||
| 177 | case 22050: | ||
| 178 | pll_out = 22579200; | ||
| 179 | mclk_div = WM8510_MCLKDIV_4; | ||
| 180 | bclk = WM8510_BCLKDIV_8; | ||
| 181 | break; | ||
| 182 | |||
| 183 | case 16000: | ||
| 184 | pll_out = 24576000; | ||
| 185 | mclk_div = WM8510_MCLKDIV_6; | ||
| 186 | bclk = WM8510_BCLKDIV_8; | ||
| 187 | break; | ||
| 188 | |||
| 189 | case 11025: | ||
| 190 | pll_out = 22579200; | ||
| 191 | mclk_div = WM8510_MCLKDIV_8; | ||
| 192 | bclk = WM8510_BCLKDIV_8; | ||
| 193 | break; | ||
| 194 | |||
| 195 | case 8000: | ||
| 196 | pll_out = 24576000; | ||
| 197 | mclk_div = WM8510_MCLKDIV_12; | ||
| 198 | bclk = WM8510_BCLKDIV_8; | ||
| 199 | break; | ||
| 200 | |||
| 201 | default: | ||
| 202 | pr_warning("playpaq_wm8510: Unsupported sample rate %d\n", | ||
| 203 | params_rate(params)); | ||
| 204 | return -EINVAL; | ||
| 205 | } | ||
| 206 | |||
| 207 | |||
| 208 | /* | ||
| 209 | * set CPU and CODEC DAI configuration | ||
| 210 | */ | ||
| 211 | ret = snd_soc_dai_set_fmt(codec_dai, fmt); | ||
| 212 | if (ret < 0) { | ||
| 213 | pr_warning("playpaq_wm8510: " | ||
| 214 | "Failed to set CODEC DAI format (%d)\n", | ||
| 215 | ret); | ||
| 216 | return ret; | ||
| 217 | } | ||
| 218 | ret = snd_soc_dai_set_fmt(cpu_dai, fmt); | ||
| 219 | if (ret < 0) { | ||
| 220 | pr_warning("playpaq_wm8510: " | ||
| 221 | "Failed to set CPU DAI format (%d)\n", | ||
| 222 | ret); | ||
| 223 | return ret; | ||
| 224 | } | ||
| 225 | |||
| 226 | |||
| 227 | /* | ||
| 228 | * Set CPU clock configuration | ||
| 229 | */ | ||
| 230 | #if defined CONFIG_SND_AT32_SOC_PLAYPAQ_SLAVE | ||
| 231 | cd = playpaq_wm8510_calc_ssc_clock(params, cpu_dai); | ||
| 232 | pr_debug("playpaq_wm8510: cmr_div = %d, period = %d\n", | ||
| 233 | cd.cmr_div, cd.period); | ||
| 234 | ret = snd_soc_dai_set_clkdiv(cpu_dai, AT32_SSC_CMR_DIV, cd.cmr_div); | ||
| 235 | if (ret < 0) { | ||
| 236 | pr_warning("playpaq_wm8510: Failed to set CPU CMR_DIV (%d)\n", | ||
| 237 | ret); | ||
| 238 | return ret; | ||
| 239 | } | ||
| 240 | ret = snd_soc_dai_set_clkdiv(cpu_dai, AT32_SSC_TCMR_PERIOD, | ||
| 241 | cd.period); | ||
| 242 | if (ret < 0) { | ||
| 243 | pr_warning("playpaq_wm8510: " | ||
| 244 | "Failed to set CPU transmit period (%d)\n", | ||
| 245 | ret); | ||
| 246 | return ret; | ||
| 247 | } | ||
| 248 | #endif /* CONFIG_SND_AT32_SOC_PLAYPAQ_SLAVE */ | ||
| 249 | |||
| 250 | |||
| 251 | /* | ||
| 252 | * Set CODEC clock configuration | ||
| 253 | */ | ||
| 254 | pr_debug("playpaq_wm8510: " | ||
| 255 | "pll_in = %ld, pll_out = %u, bclk = %x, mclk = %x\n", | ||
| 256 | clk_get_rate(CODEC_CLK), pll_out, bclk, mclk_div); | ||
| 257 | |||
| 258 | |||
| 259 | #if !defined CONFIG_SND_AT32_SOC_PLAYPAQ_SLAVE | ||
| 260 | ret = snd_soc_dai_set_clkdiv(codec_dai, WM8510_BCLKDIV, bclk); | ||
| 261 | if (ret < 0) { | ||
| 262 | pr_warning | ||
| 263 | ("playpaq_wm8510: Failed to set CODEC DAI BCLKDIV (%d)\n", | ||
| 264 | ret); | ||
| 265 | return ret; | ||
| 266 | } | ||
| 267 | #endif /* CONFIG_SND_AT32_SOC_PLAYPAQ_SLAVE */ | ||
| 268 | |||
| 269 | |||
| 270 | ret = snd_soc_dai_set_pll(codec_dai, 0, 0, | ||
| 271 | clk_get_rate(CODEC_CLK), pll_out); | ||
| 272 | if (ret < 0) { | ||
| 273 | pr_warning("playpaq_wm8510: Failed to set CODEC DAI PLL (%d)\n", | ||
| 274 | ret); | ||
| 275 | return ret; | ||
| 276 | } | ||
| 277 | |||
| 278 | |||
| 279 | ret = snd_soc_dai_set_clkdiv(codec_dai, WM8510_MCLKDIV, mclk_div); | ||
| 280 | if (ret < 0) { | ||
| 281 | pr_warning("playpaq_wm8510: Failed to set CODEC MCLKDIV (%d)\n", | ||
| 282 | ret); | ||
| 283 | return ret; | ||
| 284 | } | ||
| 285 | |||
| 286 | |||
| 287 | return 0; | ||
| 288 | } | ||
| 289 | |||
| 290 | |||
| 291 | |||
| 292 | static struct snd_soc_ops playpaq_wm8510_ops = { | ||
| 293 | .hw_params = playpaq_wm8510_hw_params, | ||
| 294 | }; | ||
| 295 | |||
| 296 | |||
| 297 | |||
| 298 | static const struct snd_soc_dapm_widget playpaq_dapm_widgets[] = { | ||
| 299 | SND_SOC_DAPM_MIC("Int Mic", NULL), | ||
| 300 | SND_SOC_DAPM_SPK("Ext Spk", NULL), | ||
| 301 | }; | ||
| 302 | |||
| 303 | |||
| 304 | |||
| 305 | static const struct snd_soc_dapm_route intercon[] = { | ||
| 306 | /* speaker connected to SPKOUT */ | ||
| 307 | {"Ext Spk", NULL, "SPKOUTP"}, | ||
| 308 | {"Ext Spk", NULL, "SPKOUTN"}, | ||
| 309 | |||
| 310 | {"Mic Bias", NULL, "Int Mic"}, | ||
| 311 | {"MICN", NULL, "Mic Bias"}, | ||
| 312 | {"MICP", NULL, "Mic Bias"}, | ||
| 313 | }; | ||
| 314 | |||
| 315 | |||
| 316 | |||
| 317 | static int playpaq_wm8510_init(struct snd_soc_pcm_runtime *rtd) | ||
| 318 | { | ||
| 319 | struct snd_soc_codec *codec = rtd->codec; | ||
| 320 | struct snd_soc_dapm_context *dapm = &codec->dapm; | ||
| 321 | int i; | ||
| 322 | |||
| 323 | /* | ||
| 324 | * Add DAPM widgets | ||
| 325 | */ | ||
| 326 | for (i = 0; i < ARRAY_SIZE(playpaq_dapm_widgets); i++) | ||
| 327 | snd_soc_dapm_new_control(dapm, &playpaq_dapm_widgets[i]); | ||
| 328 | |||
| 329 | |||
| 330 | |||
| 331 | /* | ||
| 332 | * Setup audio path interconnects | ||
| 333 | */ | ||
| 334 | snd_soc_dapm_add_routes(dapm, intercon, ARRAY_SIZE(intercon)); | ||
| 335 | |||
| 336 | |||
| 337 | |||
| 338 | /* always connected pins */ | ||
| 339 | snd_soc_dapm_enable_pin(dapm, "Int Mic"); | ||
| 340 | snd_soc_dapm_enable_pin(dapm, "Ext Spk"); | ||
| 341 | |||
| 342 | |||
| 343 | |||
| 344 | /* Make CSB show PLL rate */ | ||
| 345 | snd_soc_dai_set_clkdiv(rtd->codec_dai, WM8510_OPCLKDIV, | ||
| 346 | WM8510_OPCLKDIV_1 | 4); | ||
| 347 | |||
| 348 | return 0; | ||
| 349 | } | ||
| 350 | |||
| 351 | |||
| 352 | |||
| 353 | static struct snd_soc_dai_link playpaq_wm8510_dai = { | ||
| 354 | .name = "WM8510", | ||
| 355 | .stream_name = "WM8510 PCM", | ||
| 356 | .cpu_dai_name= "atmel-ssc-dai.0", | ||
| 357 | .platform_name = "atmel-pcm-audio", | ||
| 358 | .codec_name = "wm8510-codec.0-0x1a", | ||
| 359 | .codec_dai_name = "wm8510-hifi", | ||
| 360 | .init = playpaq_wm8510_init, | ||
| 361 | .ops = &playpaq_wm8510_ops, | ||
| 362 | }; | ||
| 363 | |||
| 364 | |||
| 365 | |||
| 366 | static struct snd_soc_card snd_soc_playpaq = { | ||
| 367 | .name = "LRS_PlayPaq_WM8510", | ||
| 368 | .dai_link = &playpaq_wm8510_dai, | ||
| 369 | .num_links = 1, | ||
| 370 | }; | ||
| 371 | |||
| 372 | static struct platform_device *playpaq_snd_device; | ||
| 373 | |||
| 374 | |||
| 375 | static int __init playpaq_asoc_init(void) | ||
| 376 | { | ||
| 377 | int ret = 0; | ||
| 378 | |||
| 379 | /* | ||
| 380 | * Configure MCLK for WM8510 | ||
| 381 | */ | ||
| 382 | _gclk0 = clk_get(NULL, "gclk0"); | ||
| 383 | if (IS_ERR(_gclk0)) { | ||
| 384 | _gclk0 = NULL; | ||
| 385 | ret = PTR_ERR(_gclk0); | ||
| 386 | goto err_gclk0; | ||
| 387 | } | ||
| 388 | _pll0 = clk_get(NULL, "pll0"); | ||
| 389 | if (IS_ERR(_pll0)) { | ||
| 390 | _pll0 = NULL; | ||
| 391 | ret = PTR_ERR(_pll0); | ||
| 392 | goto err_pll0; | ||
| 393 | } | ||
| 394 | ret = clk_set_parent(_gclk0, _pll0); | ||
| 395 | if (ret) { | ||
| 396 | pr_warning("snd-soc-playpaq: " | ||
| 397 | "Failed to set PLL0 as parent for DAC clock\n"); | ||
| 398 | goto err_set_clk; | ||
| 399 | } | ||
| 400 | clk_set_rate(CODEC_CLK, 12000000); | ||
| 401 | clk_enable(CODEC_CLK); | ||
| 402 | |||
| 403 | #if defined CONFIG_AT32_ENHANCED_PORTMUX | ||
| 404 | at32_select_periph(MCLK_PIN, MCLK_PERIPH, 0); | ||
| 405 | #endif | ||
| 406 | |||
| 407 | |||
| 408 | /* | ||
| 409 | * Create and register platform device | ||
| 410 | */ | ||
| 411 | playpaq_snd_device = platform_device_alloc("soc-audio", 0); | ||
| 412 | if (playpaq_snd_device == NULL) { | ||
| 413 | ret = -ENOMEM; | ||
| 414 | goto err_device_alloc; | ||
| 415 | } | ||
| 416 | |||
| 417 | platform_set_drvdata(playpaq_snd_device, &snd_soc_playpaq); | ||
| 418 | |||
| 419 | ret = platform_device_add(playpaq_snd_device); | ||
| 420 | if (ret) { | ||
| 421 | pr_warning("playpaq_wm8510: platform_device_add failed (%d)\n", | ||
| 422 | ret); | ||
| 423 | goto err_device_add; | ||
| 424 | } | ||
| 425 | |||
| 426 | return 0; | ||
| 427 | |||
| 428 | |||
| 429 | err_device_add: | ||
| 430 | if (playpaq_snd_device != NULL) { | ||
| 431 | platform_device_put(playpaq_snd_device); | ||
| 432 | playpaq_snd_device = NULL; | ||
| 433 | } | ||
| 434 | err_device_alloc: | ||
| 435 | err_set_clk: | ||
| 436 | if (_pll0 != NULL) { | ||
| 437 | clk_put(_pll0); | ||
| 438 | _pll0 = NULL; | ||
| 439 | } | ||
| 440 | err_pll0: | ||
| 441 | if (_gclk0 != NULL) { | ||
| 442 | clk_put(_gclk0); | ||
| 443 | _gclk0 = NULL; | ||
| 444 | } | ||
| 445 | return ret; | ||
| 446 | } | ||
| 447 | |||
| 448 | |||
| 449 | static void __exit playpaq_asoc_exit(void) | ||
| 450 | { | ||
| 451 | if (_gclk0 != NULL) { | ||
| 452 | clk_put(_gclk0); | ||
| 453 | _gclk0 = NULL; | ||
| 454 | } | ||
| 455 | if (_pll0 != NULL) { | ||
| 456 | clk_put(_pll0); | ||
| 457 | _pll0 = NULL; | ||
| 458 | } | ||
| 459 | |||
| 460 | #if defined CONFIG_AT32_ENHANCED_PORTMUX | ||
| 461 | at32_free_pin(MCLK_PIN); | ||
| 462 | #endif | ||
| 463 | |||
| 464 | platform_device_unregister(playpaq_snd_device); | ||
| 465 | playpaq_snd_device = NULL; | ||
| 466 | } | ||
| 467 | |||
| 468 | module_init(playpaq_asoc_init); | ||
| 469 | module_exit(playpaq_asoc_exit); | ||
| 470 | |||
| 471 | MODULE_AUTHOR("Geoffrey Wossum <gwossum@acm.org>"); | ||
| 472 | MODULE_DESCRIPTION("ASoC machine driver for LRS PlayPaq"); | ||
| 473 | MODULE_LICENSE("GPL"); | ||
diff --git a/sound/soc/codecs/ad1836.h b/sound/soc/codecs/ad1836.h index 444747f0db26..dd7be0dbbc58 100644 --- a/sound/soc/codecs/ad1836.h +++ b/sound/soc/codecs/ad1836.h | |||
| @@ -34,7 +34,7 @@ | |||
| 34 | 34 | ||
| 35 | #define AD1836_ADC_CTRL2 13 | 35 | #define AD1836_ADC_CTRL2 13 |
| 36 | #define AD1836_ADC_WORD_LEN_MASK 0x30 | 36 | #define AD1836_ADC_WORD_LEN_MASK 0x30 |
| 37 | #define AD1836_ADC_WORD_OFFSET 5 | 37 | #define AD1836_ADC_WORD_OFFSET 4 |
| 38 | #define AD1836_ADC_SERFMT_MASK (7 << 6) | 38 | #define AD1836_ADC_SERFMT_MASK (7 << 6) |
| 39 | #define AD1836_ADC_SERFMT_PCK256 (0x4 << 6) | 39 | #define AD1836_ADC_SERFMT_PCK256 (0x4 << 6) |
| 40 | #define AD1836_ADC_SERFMT_PCK128 (0x5 << 6) | 40 | #define AD1836_ADC_SERFMT_PCK128 (0x5 << 6) |
diff --git a/sound/soc/codecs/adau1373.c b/sound/soc/codecs/adau1373.c index 1ccf8dd47576..45c63028b40d 100644 --- a/sound/soc/codecs/adau1373.c +++ b/sound/soc/codecs/adau1373.c | |||
| @@ -245,7 +245,7 @@ static const char *adau1373_bass_hpf_cutoff_text[] = { | |||
| 245 | }; | 245 | }; |
| 246 | 246 | ||
| 247 | static const unsigned int adau1373_bass_tlv[] = { | 247 | static const unsigned int adau1373_bass_tlv[] = { |
| 248 | TLV_DB_RANGE_HEAD(4), | 248 | TLV_DB_RANGE_HEAD(3), |
| 249 | 0, 2, TLV_DB_SCALE_ITEM(-600, 600, 1), | 249 | 0, 2, TLV_DB_SCALE_ITEM(-600, 600, 1), |
| 250 | 3, 4, TLV_DB_SCALE_ITEM(950, 250, 0), | 250 | 3, 4, TLV_DB_SCALE_ITEM(950, 250, 0), |
| 251 | 5, 7, TLV_DB_SCALE_ITEM(1400, 150, 0), | 251 | 5, 7, TLV_DB_SCALE_ITEM(1400, 150, 0), |
diff --git a/sound/soc/codecs/cs4270.c b/sound/soc/codecs/cs4270.c index f1f237ecec2a..73f46eb459f1 100644 --- a/sound/soc/codecs/cs4270.c +++ b/sound/soc/codecs/cs4270.c | |||
| @@ -601,7 +601,6 @@ static int cs4270_soc_suspend(struct snd_soc_codec *codec, pm_message_t mesg) | |||
| 601 | static int cs4270_soc_resume(struct snd_soc_codec *codec) | 601 | static int cs4270_soc_resume(struct snd_soc_codec *codec) |
| 602 | { | 602 | { |
| 603 | struct cs4270_private *cs4270 = snd_soc_codec_get_drvdata(codec); | 603 | struct cs4270_private *cs4270 = snd_soc_codec_get_drvdata(codec); |
| 604 | struct i2c_client *i2c_client = to_i2c_client(codec->dev); | ||
| 605 | int reg; | 604 | int reg; |
| 606 | 605 | ||
| 607 | regulator_bulk_enable(ARRAY_SIZE(cs4270->supplies), | 606 | regulator_bulk_enable(ARRAY_SIZE(cs4270->supplies), |
| @@ -612,14 +611,7 @@ static int cs4270_soc_resume(struct snd_soc_codec *codec) | |||
| 612 | ndelay(500); | 611 | ndelay(500); |
| 613 | 612 | ||
| 614 | /* first restore the entire register cache ... */ | 613 | /* first restore the entire register cache ... */ |
| 615 | for (reg = CS4270_FIRSTREG; reg <= CS4270_LASTREG; reg++) { | 614 | snd_soc_cache_sync(codec); |
| 616 | u8 val = snd_soc_read(codec, reg); | ||
| 617 | |||
| 618 | if (i2c_smbus_write_byte_data(i2c_client, reg, val)) { | ||
| 619 | dev_err(codec->dev, "i2c write failed\n"); | ||
| 620 | return -EIO; | ||
| 621 | } | ||
| 622 | } | ||
| 623 | 615 | ||
| 624 | /* ... then disable the power-down bits */ | 616 | /* ... then disable the power-down bits */ |
| 625 | reg = snd_soc_read(codec, CS4270_PWRCTL); | 617 | reg = snd_soc_read(codec, CS4270_PWRCTL); |
diff --git a/sound/soc/codecs/cs4271.c b/sound/soc/codecs/cs4271.c index 23d1bd5dadda..69fde1506fe1 100644 --- a/sound/soc/codecs/cs4271.c +++ b/sound/soc/codecs/cs4271.c | |||
| @@ -434,7 +434,8 @@ static int cs4271_soc_suspend(struct snd_soc_codec *codec, pm_message_t mesg) | |||
| 434 | { | 434 | { |
| 435 | int ret; | 435 | int ret; |
| 436 | /* Set power-down bit */ | 436 | /* Set power-down bit */ |
| 437 | ret = snd_soc_update_bits(codec, CS4271_MODE2, 0, CS4271_MODE2_PDN); | 437 | ret = snd_soc_update_bits(codec, CS4271_MODE2, CS4271_MODE2_PDN, |
| 438 | CS4271_MODE2_PDN); | ||
| 438 | if (ret < 0) | 439 | if (ret < 0) |
| 439 | return ret; | 440 | return ret; |
| 440 | return 0; | 441 | return 0; |
| @@ -501,8 +502,9 @@ static int cs4271_probe(struct snd_soc_codec *codec) | |||
| 501 | return ret; | 502 | return ret; |
| 502 | } | 503 | } |
| 503 | 504 | ||
| 504 | ret = snd_soc_update_bits(codec, CS4271_MODE2, 0, | 505 | ret = snd_soc_update_bits(codec, CS4271_MODE2, |
| 505 | CS4271_MODE2_PDN | CS4271_MODE2_CPEN); | 506 | CS4271_MODE2_PDN | CS4271_MODE2_CPEN, |
| 507 | CS4271_MODE2_PDN | CS4271_MODE2_CPEN); | ||
| 506 | if (ret < 0) | 508 | if (ret < 0) |
| 507 | return ret; | 509 | return ret; |
| 508 | ret = snd_soc_update_bits(codec, CS4271_MODE2, CS4271_MODE2_PDN, 0); | 510 | ret = snd_soc_update_bits(codec, CS4271_MODE2, CS4271_MODE2_PDN, 0); |
diff --git a/sound/soc/codecs/cs42l51.c b/sound/soc/codecs/cs42l51.c index 8c3c8205d19e..1ee66361f61b 100644 --- a/sound/soc/codecs/cs42l51.c +++ b/sound/soc/codecs/cs42l51.c | |||
| @@ -555,7 +555,7 @@ static int cs42l51_probe(struct snd_soc_codec *codec) | |||
| 555 | 555 | ||
| 556 | static struct snd_soc_codec_driver soc_codec_device_cs42l51 = { | 556 | static struct snd_soc_codec_driver soc_codec_device_cs42l51 = { |
| 557 | .probe = cs42l51_probe, | 557 | .probe = cs42l51_probe, |
| 558 | .reg_cache_size = CS42L51_NUMREGS, | 558 | .reg_cache_size = CS42L51_NUMREGS + 1, |
| 559 | .reg_word_size = sizeof(u8), | 559 | .reg_word_size = sizeof(u8), |
| 560 | }; | 560 | }; |
| 561 | 561 | ||
diff --git a/sound/soc/codecs/max9877.c b/sound/soc/codecs/max9877.c index 9e7e964a5fa3..dcf6f2a1600a 100644 --- a/sound/soc/codecs/max9877.c +++ b/sound/soc/codecs/max9877.c | |||
| @@ -106,13 +106,13 @@ static int max9877_set_2reg(struct snd_kcontrol *kcontrol, | |||
| 106 | unsigned int mask = mc->max; | 106 | unsigned int mask = mc->max; |
| 107 | unsigned int val = (ucontrol->value.integer.value[0] & mask); | 107 | unsigned int val = (ucontrol->value.integer.value[0] & mask); |
| 108 | unsigned int val2 = (ucontrol->value.integer.value[1] & mask); | 108 | unsigned int val2 = (ucontrol->value.integer.value[1] & mask); |
| 109 | unsigned int change = 1; | 109 | unsigned int change = 0; |
| 110 | 110 | ||
| 111 | if (((max9877_regs[reg] >> shift) & mask) == val) | 111 | if (((max9877_regs[reg] >> shift) & mask) != val) |
| 112 | change = 0; | 112 | change = 1; |
| 113 | 113 | ||
| 114 | if (((max9877_regs[reg2] >> shift) & mask) == val2) | 114 | if (((max9877_regs[reg2] >> shift) & mask) != val2) |
| 115 | change = 0; | 115 | change = 1; |
| 116 | 116 | ||
| 117 | if (change) { | 117 | if (change) { |
| 118 | max9877_regs[reg] &= ~(mask << shift); | 118 | max9877_regs[reg] &= ~(mask << shift); |
diff --git a/sound/soc/codecs/rt5631.c b/sound/soc/codecs/rt5631.c index 27a078cbb6eb..4646e808b90a 100644 --- a/sound/soc/codecs/rt5631.c +++ b/sound/soc/codecs/rt5631.c | |||
| @@ -177,7 +177,7 @@ static const DECLARE_TLV_DB_SCALE(dac_vol_tlv, -95625, 375, 0); | |||
| 177 | static const DECLARE_TLV_DB_SCALE(in_vol_tlv, -3450, 150, 0); | 177 | static const DECLARE_TLV_DB_SCALE(in_vol_tlv, -3450, 150, 0); |
| 178 | /* {0, +20, +24, +30, +35, +40, +44, +50, +52}dB */ | 178 | /* {0, +20, +24, +30, +35, +40, +44, +50, +52}dB */ |
| 179 | static unsigned int mic_bst_tlv[] = { | 179 | static unsigned int mic_bst_tlv[] = { |
| 180 | TLV_DB_RANGE_HEAD(6), | 180 | TLV_DB_RANGE_HEAD(7), |
| 181 | 0, 0, TLV_DB_SCALE_ITEM(0, 0, 0), | 181 | 0, 0, TLV_DB_SCALE_ITEM(0, 0, 0), |
| 182 | 1, 1, TLV_DB_SCALE_ITEM(2000, 0, 0), | 182 | 1, 1, TLV_DB_SCALE_ITEM(2000, 0, 0), |
| 183 | 2, 2, TLV_DB_SCALE_ITEM(2400, 0, 0), | 183 | 2, 2, TLV_DB_SCALE_ITEM(2400, 0, 0), |
diff --git a/sound/soc/codecs/sgtl5000.c b/sound/soc/codecs/sgtl5000.c index d15695d1c273..bbcf921166f7 100644 --- a/sound/soc/codecs/sgtl5000.c +++ b/sound/soc/codecs/sgtl5000.c | |||
| @@ -365,7 +365,7 @@ static const DECLARE_TLV_DB_SCALE(capture_6db_attenuate, -600, 600, 0); | |||
| 365 | 365 | ||
| 366 | /* tlv for mic gain, 0db 20db 30db 40db */ | 366 | /* tlv for mic gain, 0db 20db 30db 40db */ |
| 367 | static const unsigned int mic_gain_tlv[] = { | 367 | static const unsigned int mic_gain_tlv[] = { |
| 368 | TLV_DB_RANGE_HEAD(4), | 368 | TLV_DB_RANGE_HEAD(2), |
| 369 | 0, 0, TLV_DB_SCALE_ITEM(0, 0, 0), | 369 | 0, 0, TLV_DB_SCALE_ITEM(0, 0, 0), |
| 370 | 1, 3, TLV_DB_SCALE_ITEM(2000, 1000, 0), | 370 | 1, 3, TLV_DB_SCALE_ITEM(2000, 1000, 0), |
| 371 | }; | 371 | }; |
diff --git a/sound/soc/codecs/sta32x.c b/sound/soc/codecs/sta32x.c index bb82408ab8e1..d2f37152f940 100644 --- a/sound/soc/codecs/sta32x.c +++ b/sound/soc/codecs/sta32x.c | |||
| @@ -76,6 +76,8 @@ struct sta32x_priv { | |||
| 76 | 76 | ||
| 77 | unsigned int mclk; | 77 | unsigned int mclk; |
| 78 | unsigned int format; | 78 | unsigned int format; |
| 79 | |||
| 80 | u32 coef_shadow[STA32X_COEF_COUNT]; | ||
| 79 | }; | 81 | }; |
| 80 | 82 | ||
| 81 | static const DECLARE_TLV_DB_SCALE(mvol_tlv, -12700, 50, 1); | 83 | static const DECLARE_TLV_DB_SCALE(mvol_tlv, -12700, 50, 1); |
| @@ -227,6 +229,7 @@ static int sta32x_coefficient_put(struct snd_kcontrol *kcontrol, | |||
| 227 | struct snd_ctl_elem_value *ucontrol) | 229 | struct snd_ctl_elem_value *ucontrol) |
| 228 | { | 230 | { |
| 229 | struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); | 231 | struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); |
| 232 | struct sta32x_priv *sta32x = snd_soc_codec_get_drvdata(codec); | ||
| 230 | int numcoef = kcontrol->private_value >> 16; | 233 | int numcoef = kcontrol->private_value >> 16; |
| 231 | int index = kcontrol->private_value & 0xffff; | 234 | int index = kcontrol->private_value & 0xffff; |
| 232 | unsigned int cfud; | 235 | unsigned int cfud; |
| @@ -239,6 +242,11 @@ static int sta32x_coefficient_put(struct snd_kcontrol *kcontrol, | |||
| 239 | snd_soc_write(codec, STA32X_CFUD, cfud); | 242 | snd_soc_write(codec, STA32X_CFUD, cfud); |
| 240 | 243 | ||
| 241 | snd_soc_write(codec, STA32X_CFADDR2, index); | 244 | snd_soc_write(codec, STA32X_CFADDR2, index); |
| 245 | for (i = 0; i < numcoef && (index + i < STA32X_COEF_COUNT); i++) | ||
| 246 | sta32x->coef_shadow[index + i] = | ||
| 247 | (ucontrol->value.bytes.data[3 * i] << 16) | ||
| 248 | | (ucontrol->value.bytes.data[3 * i + 1] << 8) | ||
| 249 | | (ucontrol->value.bytes.data[3 * i + 2]); | ||
| 242 | for (i = 0; i < 3 * numcoef; i++) | 250 | for (i = 0; i < 3 * numcoef; i++) |
| 243 | snd_soc_write(codec, STA32X_B1CF1 + i, | 251 | snd_soc_write(codec, STA32X_B1CF1 + i, |
| 244 | ucontrol->value.bytes.data[i]); | 252 | ucontrol->value.bytes.data[i]); |
| @@ -252,6 +260,48 @@ static int sta32x_coefficient_put(struct snd_kcontrol *kcontrol, | |||
| 252 | return 0; | 260 | return 0; |
| 253 | } | 261 | } |
| 254 | 262 | ||
| 263 | int sta32x_sync_coef_shadow(struct snd_soc_codec *codec) | ||
| 264 | { | ||
| 265 | struct sta32x_priv *sta32x = snd_soc_codec_get_drvdata(codec); | ||
| 266 | unsigned int cfud; | ||
| 267 | int i; | ||
| 268 | |||
| 269 | /* preserve reserved bits in STA32X_CFUD */ | ||
| 270 | cfud = snd_soc_read(codec, STA32X_CFUD) & 0xf0; | ||
| 271 | |||
| 272 | for (i = 0; i < STA32X_COEF_COUNT; i++) { | ||
| 273 | snd_soc_write(codec, STA32X_CFADDR2, i); | ||
| 274 | snd_soc_write(codec, STA32X_B1CF1, | ||
| 275 | (sta32x->coef_shadow[i] >> 16) & 0xff); | ||
| 276 | snd_soc_write(codec, STA32X_B1CF2, | ||
| 277 | (sta32x->coef_shadow[i] >> 8) & 0xff); | ||
| 278 | snd_soc_write(codec, STA32X_B1CF3, | ||
| 279 | (sta32x->coef_shadow[i]) & 0xff); | ||
| 280 | /* chip documentation does not say if the bits are | ||
| 281 | * self-clearing, so do it explicitly */ | ||
| 282 | snd_soc_write(codec, STA32X_CFUD, cfud); | ||
| 283 | snd_soc_write(codec, STA32X_CFUD, cfud | 0x01); | ||
| 284 | } | ||
| 285 | return 0; | ||
| 286 | } | ||
| 287 | |||
| 288 | int sta32x_cache_sync(struct snd_soc_codec *codec) | ||
| 289 | { | ||
| 290 | unsigned int mute; | ||
| 291 | int rc; | ||
| 292 | |||
| 293 | if (!codec->cache_sync) | ||
| 294 | return 0; | ||
| 295 | |||
| 296 | /* mute during register sync */ | ||
| 297 | mute = snd_soc_read(codec, STA32X_MMUTE); | ||
| 298 | snd_soc_write(codec, STA32X_MMUTE, mute | STA32X_MMUTE_MMUTE); | ||
| 299 | sta32x_sync_coef_shadow(codec); | ||
| 300 | rc = snd_soc_cache_sync(codec); | ||
| 301 | snd_soc_write(codec, STA32X_MMUTE, mute); | ||
| 302 | return rc; | ||
| 303 | } | ||
| 304 | |||
| 255 | #define SINGLE_COEF(xname, index) \ | 305 | #define SINGLE_COEF(xname, index) \ |
| 256 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ | 306 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ |
| 257 | .info = sta32x_coefficient_info, \ | 307 | .info = sta32x_coefficient_info, \ |
| @@ -661,7 +711,7 @@ static int sta32x_set_bias_level(struct snd_soc_codec *codec, | |||
| 661 | return ret; | 711 | return ret; |
| 662 | } | 712 | } |
| 663 | 713 | ||
| 664 | snd_soc_cache_sync(codec); | 714 | sta32x_cache_sync(codec); |
| 665 | } | 715 | } |
| 666 | 716 | ||
| 667 | /* Power up to mute */ | 717 | /* Power up to mute */ |
| @@ -790,6 +840,17 @@ static int sta32x_probe(struct snd_soc_codec *codec) | |||
| 790 | STA32X_CxCFG_OM_MASK, | 840 | STA32X_CxCFG_OM_MASK, |
| 791 | 2 << STA32X_CxCFG_OM_SHIFT); | 841 | 2 << STA32X_CxCFG_OM_SHIFT); |
| 792 | 842 | ||
| 843 | /* initialize coefficient shadow RAM with reset values */ | ||
| 844 | for (i = 4; i <= 49; i += 5) | ||
| 845 | sta32x->coef_shadow[i] = 0x400000; | ||
| 846 | for (i = 50; i <= 54; i++) | ||
| 847 | sta32x->coef_shadow[i] = 0x7fffff; | ||
| 848 | sta32x->coef_shadow[55] = 0x5a9df7; | ||
| 849 | sta32x->coef_shadow[56] = 0x7fffff; | ||
| 850 | sta32x->coef_shadow[59] = 0x7fffff; | ||
| 851 | sta32x->coef_shadow[60] = 0x400000; | ||
| 852 | sta32x->coef_shadow[61] = 0x400000; | ||
| 853 | |||
| 793 | sta32x_set_bias_level(codec, SND_SOC_BIAS_STANDBY); | 854 | sta32x_set_bias_level(codec, SND_SOC_BIAS_STANDBY); |
| 794 | /* Bias level configuration will have done an extra enable */ | 855 | /* Bias level configuration will have done an extra enable */ |
| 795 | regulator_bulk_disable(ARRAY_SIZE(sta32x->supplies), sta32x->supplies); | 856 | regulator_bulk_disable(ARRAY_SIZE(sta32x->supplies), sta32x->supplies); |
diff --git a/sound/soc/codecs/sta32x.h b/sound/soc/codecs/sta32x.h index b97ee5a75667..d8e32a6262ee 100644 --- a/sound/soc/codecs/sta32x.h +++ b/sound/soc/codecs/sta32x.h | |||
| @@ -19,6 +19,7 @@ | |||
| 19 | /* STA326 register addresses */ | 19 | /* STA326 register addresses */ |
| 20 | 20 | ||
| 21 | #define STA32X_REGISTER_COUNT 0x2d | 21 | #define STA32X_REGISTER_COUNT 0x2d |
| 22 | #define STA32X_COEF_COUNT 62 | ||
| 22 | 23 | ||
| 23 | #define STA32X_CONFA 0x00 | 24 | #define STA32X_CONFA 0x00 |
| 24 | #define STA32X_CONFB 0x01 | 25 | #define STA32X_CONFB 0x01 |
diff --git a/sound/soc/codecs/wm8731.c b/sound/soc/codecs/wm8731.c index 7e5ec03f6f8d..a7c9ae17fc7e 100644 --- a/sound/soc/codecs/wm8731.c +++ b/sound/soc/codecs/wm8731.c | |||
| @@ -453,6 +453,7 @@ static int wm8731_set_bias_level(struct snd_soc_codec *codec, | |||
| 453 | snd_soc_write(codec, WM8731_PWR, 0xffff); | 453 | snd_soc_write(codec, WM8731_PWR, 0xffff); |
| 454 | regulator_bulk_disable(ARRAY_SIZE(wm8731->supplies), | 454 | regulator_bulk_disable(ARRAY_SIZE(wm8731->supplies), |
| 455 | wm8731->supplies); | 455 | wm8731->supplies); |
| 456 | codec->cache_sync = 1; | ||
| 456 | break; | 457 | break; |
| 457 | } | 458 | } |
| 458 | codec->dapm.bias_level = level; | 459 | codec->dapm.bias_level = level; |
diff --git a/sound/soc/codecs/wm8753.c b/sound/soc/codecs/wm8753.c index a9504710bb69..3a629d0d690e 100644 --- a/sound/soc/codecs/wm8753.c +++ b/sound/soc/codecs/wm8753.c | |||
| @@ -190,6 +190,9 @@ static int wm8753_set_dai(struct snd_kcontrol *kcontrol, | |||
| 190 | struct wm8753_priv *wm8753 = snd_soc_codec_get_drvdata(codec); | 190 | struct wm8753_priv *wm8753 = snd_soc_codec_get_drvdata(codec); |
| 191 | u16 ioctl; | 191 | u16 ioctl; |
| 192 | 192 | ||
| 193 | if (wm8753->dai_func == ucontrol->value.integer.value[0]) | ||
| 194 | return 0; | ||
| 195 | |||
| 193 | if (codec->active) | 196 | if (codec->active) |
| 194 | return -EBUSY; | 197 | return -EBUSY; |
| 195 | 198 | ||
diff --git a/sound/soc/codecs/wm8962.c b/sound/soc/codecs/wm8962.c index 91d3c6dbeba3..53edd9a8c758 100644 --- a/sound/soc/codecs/wm8962.c +++ b/sound/soc/codecs/wm8962.c | |||
| @@ -1973,7 +1973,7 @@ static int wm8962_reset(struct snd_soc_codec *codec) | |||
| 1973 | static const DECLARE_TLV_DB_SCALE(inpga_tlv, -2325, 75, 0); | 1973 | static const DECLARE_TLV_DB_SCALE(inpga_tlv, -2325, 75, 0); |
| 1974 | static const DECLARE_TLV_DB_SCALE(mixin_tlv, -1500, 300, 0); | 1974 | static const DECLARE_TLV_DB_SCALE(mixin_tlv, -1500, 300, 0); |
| 1975 | static const unsigned int mixinpga_tlv[] = { | 1975 | static const unsigned int mixinpga_tlv[] = { |
| 1976 | TLV_DB_RANGE_HEAD(7), | 1976 | TLV_DB_RANGE_HEAD(5), |
| 1977 | 0, 1, TLV_DB_SCALE_ITEM(0, 600, 0), | 1977 | 0, 1, TLV_DB_SCALE_ITEM(0, 600, 0), |
| 1978 | 2, 2, TLV_DB_SCALE_ITEM(1300, 1300, 0), | 1978 | 2, 2, TLV_DB_SCALE_ITEM(1300, 1300, 0), |
| 1979 | 3, 4, TLV_DB_SCALE_ITEM(1800, 200, 0), | 1979 | 3, 4, TLV_DB_SCALE_ITEM(1800, 200, 0), |
| @@ -1988,7 +1988,7 @@ static const DECLARE_TLV_DB_SCALE(bypass_tlv, -1500, 300, 0); | |||
| 1988 | static const DECLARE_TLV_DB_SCALE(out_tlv, -12100, 100, 1); | 1988 | static const DECLARE_TLV_DB_SCALE(out_tlv, -12100, 100, 1); |
| 1989 | static const DECLARE_TLV_DB_SCALE(hp_tlv, -700, 100, 0); | 1989 | static const DECLARE_TLV_DB_SCALE(hp_tlv, -700, 100, 0); |
| 1990 | static const unsigned int classd_tlv[] = { | 1990 | static const unsigned int classd_tlv[] = { |
| 1991 | TLV_DB_RANGE_HEAD(7), | 1991 | TLV_DB_RANGE_HEAD(2), |
| 1992 | 0, 6, TLV_DB_SCALE_ITEM(0, 150, 0), | 1992 | 0, 6, TLV_DB_SCALE_ITEM(0, 150, 0), |
| 1993 | 7, 7, TLV_DB_SCALE_ITEM(1200, 0, 0), | 1993 | 7, 7, TLV_DB_SCALE_ITEM(1200, 0, 0), |
| 1994 | }; | 1994 | }; |
diff --git a/sound/soc/codecs/wm8993.c b/sound/soc/codecs/wm8993.c index eec8e1435116..d1a142f48b09 100644 --- a/sound/soc/codecs/wm8993.c +++ b/sound/soc/codecs/wm8993.c | |||
| @@ -512,7 +512,7 @@ static const DECLARE_TLV_DB_SCALE(drc_comp_threash, -4500, 75, 0); | |||
| 512 | static const DECLARE_TLV_DB_SCALE(drc_comp_amp, -2250, 75, 0); | 512 | static const DECLARE_TLV_DB_SCALE(drc_comp_amp, -2250, 75, 0); |
| 513 | static const DECLARE_TLV_DB_SCALE(drc_min_tlv, -1800, 600, 0); | 513 | static const DECLARE_TLV_DB_SCALE(drc_min_tlv, -1800, 600, 0); |
| 514 | static const unsigned int drc_max_tlv[] = { | 514 | static const unsigned int drc_max_tlv[] = { |
| 515 | TLV_DB_RANGE_HEAD(4), | 515 | TLV_DB_RANGE_HEAD(2), |
| 516 | 0, 2, TLV_DB_SCALE_ITEM(1200, 600, 0), | 516 | 0, 2, TLV_DB_SCALE_ITEM(1200, 600, 0), |
| 517 | 3, 3, TLV_DB_SCALE_ITEM(3600, 0, 0), | 517 | 3, 3, TLV_DB_SCALE_ITEM(3600, 0, 0), |
| 518 | }; | 518 | }; |
diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c index 9c982e47eb99..6c2988549003 100644 --- a/sound/soc/codecs/wm8994.c +++ b/sound/soc/codecs/wm8994.c | |||
| @@ -2357,6 +2357,11 @@ static int wm8994_hw_params(struct snd_pcm_substream *substream, | |||
| 2357 | bclk |= best << WM8994_AIF1_BCLK_DIV_SHIFT; | 2357 | bclk |= best << WM8994_AIF1_BCLK_DIV_SHIFT; |
| 2358 | 2358 | ||
| 2359 | lrclk = bclk_rate / params_rate(params); | 2359 | lrclk = bclk_rate / params_rate(params); |
| 2360 | if (!lrclk) { | ||
| 2361 | dev_err(dai->dev, "Unable to generate LRCLK from %dHz BCLK\n", | ||
| 2362 | bclk_rate); | ||
| 2363 | return -EINVAL; | ||
| 2364 | } | ||
| 2360 | dev_dbg(dai->dev, "Using LRCLK rate %d for actual LRCLK %dHz\n", | 2365 | dev_dbg(dai->dev, "Using LRCLK rate %d for actual LRCLK %dHz\n", |
| 2361 | lrclk, bclk_rate / lrclk); | 2366 | lrclk, bclk_rate / lrclk); |
| 2362 | 2367 | ||
| @@ -3178,6 +3183,8 @@ static int wm8994_codec_probe(struct snd_soc_codec *codec) | |||
| 3178 | switch (wm8994->revision) { | 3183 | switch (wm8994->revision) { |
| 3179 | case 0: | 3184 | case 0: |
| 3180 | case 1: | 3185 | case 1: |
| 3186 | case 2: | ||
| 3187 | case 3: | ||
| 3181 | wm8994->hubs.dcs_codes_l = -9; | 3188 | wm8994->hubs.dcs_codes_l = -9; |
| 3182 | wm8994->hubs.dcs_codes_r = -5; | 3189 | wm8994->hubs.dcs_codes_r = -5; |
| 3183 | break; | 3190 | break; |
diff --git a/sound/soc/codecs/wm9081.c b/sound/soc/codecs/wm9081.c index 3cd35a02c28c..4a398c3bfe84 100644 --- a/sound/soc/codecs/wm9081.c +++ b/sound/soc/codecs/wm9081.c | |||
| @@ -807,7 +807,6 @@ static int wm9081_set_bias_level(struct snd_soc_codec *codec, | |||
| 807 | mdelay(100); | 807 | mdelay(100); |
| 808 | 808 | ||
| 809 | /* Normal bias enable & soft start off */ | 809 | /* Normal bias enable & soft start off */ |
| 810 | reg |= WM9081_BIAS_ENA; | ||
| 811 | reg &= ~WM9081_VMID_RAMP; | 810 | reg &= ~WM9081_VMID_RAMP; |
| 812 | snd_soc_write(codec, WM9081_VMID_CONTROL, reg); | 811 | snd_soc_write(codec, WM9081_VMID_CONTROL, reg); |
| 813 | 812 | ||
| @@ -818,7 +817,7 @@ static int wm9081_set_bias_level(struct snd_soc_codec *codec, | |||
| 818 | } | 817 | } |
| 819 | 818 | ||
| 820 | /* VMID 2*240k */ | 819 | /* VMID 2*240k */ |
| 821 | reg = snd_soc_read(codec, WM9081_BIAS_CONTROL_1); | 820 | reg = snd_soc_read(codec, WM9081_VMID_CONTROL); |
| 822 | reg &= ~WM9081_VMID_SEL_MASK; | 821 | reg &= ~WM9081_VMID_SEL_MASK; |
| 823 | reg |= 0x04; | 822 | reg |= 0x04; |
| 824 | snd_soc_write(codec, WM9081_VMID_CONTROL, reg); | 823 | snd_soc_write(codec, WM9081_VMID_CONTROL, reg); |
| @@ -830,14 +829,15 @@ static int wm9081_set_bias_level(struct snd_soc_codec *codec, | |||
| 830 | break; | 829 | break; |
| 831 | 830 | ||
| 832 | case SND_SOC_BIAS_OFF: | 831 | case SND_SOC_BIAS_OFF: |
| 833 | /* Startup bias source */ | 832 | /* Startup bias source and disable bias */ |
| 834 | reg = snd_soc_read(codec, WM9081_BIAS_CONTROL_1); | 833 | reg = snd_soc_read(codec, WM9081_BIAS_CONTROL_1); |
| 835 | reg |= WM9081_BIAS_SRC; | 834 | reg |= WM9081_BIAS_SRC; |
| 835 | reg &= ~WM9081_BIAS_ENA; | ||
| 836 | snd_soc_write(codec, WM9081_BIAS_CONTROL_1, reg); | 836 | snd_soc_write(codec, WM9081_BIAS_CONTROL_1, reg); |
| 837 | 837 | ||
| 838 | /* Disable VMID and biases with soft ramping */ | 838 | /* Disable VMID with soft ramping */ |
| 839 | reg = snd_soc_read(codec, WM9081_VMID_CONTROL); | 839 | reg = snd_soc_read(codec, WM9081_VMID_CONTROL); |
| 840 | reg &= ~(WM9081_VMID_SEL_MASK | WM9081_BIAS_ENA); | 840 | reg &= ~WM9081_VMID_SEL_MASK; |
| 841 | reg |= WM9081_VMID_RAMP; | 841 | reg |= WM9081_VMID_RAMP; |
| 842 | snd_soc_write(codec, WM9081_VMID_CONTROL, reg); | 842 | snd_soc_write(codec, WM9081_VMID_CONTROL, reg); |
| 843 | 843 | ||
diff --git a/sound/soc/codecs/wm9090.c b/sound/soc/codecs/wm9090.c index 2b5252c9e377..f94c06057c64 100644 --- a/sound/soc/codecs/wm9090.c +++ b/sound/soc/codecs/wm9090.c | |||
| @@ -177,19 +177,19 @@ static void wait_for_dc_servo(struct snd_soc_codec *codec) | |||
| 177 | } | 177 | } |
| 178 | 178 | ||
| 179 | static const unsigned int in_tlv[] = { | 179 | static const unsigned int in_tlv[] = { |
| 180 | TLV_DB_RANGE_HEAD(6), | 180 | TLV_DB_RANGE_HEAD(3), |
| 181 | 0, 0, TLV_DB_SCALE_ITEM(-600, 0, 0), | 181 | 0, 0, TLV_DB_SCALE_ITEM(-600, 0, 0), |
| 182 | 1, 3, TLV_DB_SCALE_ITEM(-350, 350, 0), | 182 | 1, 3, TLV_DB_SCALE_ITEM(-350, 350, 0), |
| 183 | 4, 6, TLV_DB_SCALE_ITEM(600, 600, 0), | 183 | 4, 6, TLV_DB_SCALE_ITEM(600, 600, 0), |
| 184 | }; | 184 | }; |
| 185 | static const unsigned int mix_tlv[] = { | 185 | static const unsigned int mix_tlv[] = { |
| 186 | TLV_DB_RANGE_HEAD(4), | 186 | TLV_DB_RANGE_HEAD(2), |
| 187 | 0, 2, TLV_DB_SCALE_ITEM(-1200, 300, 0), | 187 | 0, 2, TLV_DB_SCALE_ITEM(-1200, 300, 0), |
| 188 | 3, 3, TLV_DB_SCALE_ITEM(0, 0, 0), | 188 | 3, 3, TLV_DB_SCALE_ITEM(0, 0, 0), |
| 189 | }; | 189 | }; |
| 190 | static const DECLARE_TLV_DB_SCALE(out_tlv, -5700, 100, 0); | 190 | static const DECLARE_TLV_DB_SCALE(out_tlv, -5700, 100, 0); |
| 191 | static const unsigned int spkboost_tlv[] = { | 191 | static const unsigned int spkboost_tlv[] = { |
| 192 | TLV_DB_RANGE_HEAD(7), | 192 | TLV_DB_RANGE_HEAD(2), |
| 193 | 0, 6, TLV_DB_SCALE_ITEM(0, 150, 0), | 193 | 0, 6, TLV_DB_SCALE_ITEM(0, 150, 0), |
| 194 | 7, 7, TLV_DB_SCALE_ITEM(1200, 0, 0), | 194 | 7, 7, TLV_DB_SCALE_ITEM(1200, 0, 0), |
| 195 | }; | 195 | }; |
diff --git a/sound/soc/codecs/wm_hubs.c b/sound/soc/codecs/wm_hubs.c index 84f33d4ea2cd..48e61e912400 100644 --- a/sound/soc/codecs/wm_hubs.c +++ b/sound/soc/codecs/wm_hubs.c | |||
| @@ -40,7 +40,7 @@ static const DECLARE_TLV_DB_SCALE(outmix_tlv, -2100, 300, 0); | |||
| 40 | static const DECLARE_TLV_DB_SCALE(spkmixout_tlv, -1800, 600, 1); | 40 | static const DECLARE_TLV_DB_SCALE(spkmixout_tlv, -1800, 600, 1); |
| 41 | static const DECLARE_TLV_DB_SCALE(outpga_tlv, -5700, 100, 0); | 41 | static const DECLARE_TLV_DB_SCALE(outpga_tlv, -5700, 100, 0); |
| 42 | static const unsigned int spkboost_tlv[] = { | 42 | static const unsigned int spkboost_tlv[] = { |
| 43 | TLV_DB_RANGE_HEAD(7), | 43 | TLV_DB_RANGE_HEAD(2), |
| 44 | 0, 6, TLV_DB_SCALE_ITEM(0, 150, 0), | 44 | 0, 6, TLV_DB_SCALE_ITEM(0, 150, 0), |
| 45 | 7, 7, TLV_DB_SCALE_ITEM(1200, 0, 0), | 45 | 7, 7, TLV_DB_SCALE_ITEM(1200, 0, 0), |
| 46 | }; | 46 | }; |
diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c index 0268cf989736..83c4bd5b2dd7 100644 --- a/sound/soc/fsl/fsl_ssi.c +++ b/sound/soc/fsl/fsl_ssi.c | |||
| @@ -694,6 +694,7 @@ static int __devinit fsl_ssi_probe(struct platform_device *pdev) | |||
| 694 | 694 | ||
| 695 | /* Initialize the the device_attribute structure */ | 695 | /* Initialize the the device_attribute structure */ |
| 696 | dev_attr = &ssi_private->dev_attr; | 696 | dev_attr = &ssi_private->dev_attr; |
| 697 | sysfs_attr_init(&dev_attr->attr); | ||
| 697 | dev_attr->attr.name = "statistics"; | 698 | dev_attr->attr.name = "statistics"; |
| 698 | dev_attr->attr.mode = S_IRUGO; | 699 | dev_attr->attr.mode = S_IRUGO; |
| 699 | dev_attr->show = fsl_sysfs_ssi_show; | 700 | dev_attr->show = fsl_sysfs_ssi_show; |
diff --git a/sound/soc/fsl/mpc8610_hpcd.c b/sound/soc/fsl/mpc8610_hpcd.c index 31af405bda84..ae49f1c78c6d 100644 --- a/sound/soc/fsl/mpc8610_hpcd.c +++ b/sound/soc/fsl/mpc8610_hpcd.c | |||
| @@ -392,7 +392,8 @@ static int mpc8610_hpcd_probe(struct platform_device *pdev) | |||
| 392 | } | 392 | } |
| 393 | 393 | ||
| 394 | if (strcasecmp(sprop, "i2s-slave") == 0) { | 394 | if (strcasecmp(sprop, "i2s-slave") == 0) { |
| 395 | machine_data->dai_format = SND_SOC_DAIFMT_I2S; | 395 | machine_data->dai_format = |
| 396 | SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_CBM_CFM; | ||
| 396 | machine_data->codec_clk_direction = SND_SOC_CLOCK_OUT; | 397 | machine_data->codec_clk_direction = SND_SOC_CLOCK_OUT; |
| 397 | machine_data->cpu_clk_direction = SND_SOC_CLOCK_IN; | 398 | machine_data->cpu_clk_direction = SND_SOC_CLOCK_IN; |
| 398 | 399 | ||
| @@ -409,31 +410,38 @@ static int mpc8610_hpcd_probe(struct platform_device *pdev) | |||
| 409 | } | 410 | } |
| 410 | machine_data->clk_frequency = be32_to_cpup(iprop); | 411 | machine_data->clk_frequency = be32_to_cpup(iprop); |
| 411 | } else if (strcasecmp(sprop, "i2s-master") == 0) { | 412 | } else if (strcasecmp(sprop, "i2s-master") == 0) { |
| 412 | machine_data->dai_format = SND_SOC_DAIFMT_I2S; | 413 | machine_data->dai_format = |
| 414 | SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_CBS_CFS; | ||
| 413 | machine_data->codec_clk_direction = SND_SOC_CLOCK_IN; | 415 | machine_data->codec_clk_direction = SND_SOC_CLOCK_IN; |
| 414 | machine_data->cpu_clk_direction = SND_SOC_CLOCK_OUT; | 416 | machine_data->cpu_clk_direction = SND_SOC_CLOCK_OUT; |
| 415 | } else if (strcasecmp(sprop, "lj-slave") == 0) { | 417 | } else if (strcasecmp(sprop, "lj-slave") == 0) { |
| 416 | machine_data->dai_format = SND_SOC_DAIFMT_LEFT_J; | 418 | machine_data->dai_format = |
| 419 | SND_SOC_DAIFMT_LEFT_J | SND_SOC_DAIFMT_CBM_CFM; | ||
| 417 | machine_data->codec_clk_direction = SND_SOC_CLOCK_OUT; | 420 | machine_data->codec_clk_direction = SND_SOC_CLOCK_OUT; |
| 418 | machine_data->cpu_clk_direction = SND_SOC_CLOCK_IN; | 421 | machine_data->cpu_clk_direction = SND_SOC_CLOCK_IN; |
| 419 | } else if (strcasecmp(sprop, "lj-master") == 0) { | 422 | } else if (strcasecmp(sprop, "lj-master") == 0) { |
| 420 | machine_data->dai_format = SND_SOC_DAIFMT_LEFT_J; | 423 | machine_data->dai_format = |
| 424 | SND_SOC_DAIFMT_LEFT_J | SND_SOC_DAIFMT_CBS_CFS; | ||
| 421 | machine_data->codec_clk_direction = SND_SOC_CLOCK_IN; | 425 | machine_data->codec_clk_direction = SND_SOC_CLOCK_IN; |
| 422 | machine_data->cpu_clk_direction = SND_SOC_CLOCK_OUT; | 426 | machine_data->cpu_clk_direction = SND_SOC_CLOCK_OUT; |
| 423 | } else if (strcasecmp(sprop, "rj-slave") == 0) { | 427 | } else if (strcasecmp(sprop, "rj-slave") == 0) { |
| 424 | machine_data->dai_format = SND_SOC_DAIFMT_RIGHT_J; | 428 | machine_data->dai_format = |
| 429 | SND_SOC_DAIFMT_RIGHT_J | SND_SOC_DAIFMT_CBM_CFM; | ||
| 425 | machine_data->codec_clk_direction = SND_SOC_CLOCK_OUT; | 430 | machine_data->codec_clk_direction = SND_SOC_CLOCK_OUT; |
| 426 | machine_data->cpu_clk_direction = SND_SOC_CLOCK_IN; | 431 | machine_data->cpu_clk_direction = SND_SOC_CLOCK_IN; |
| 427 | } else if (strcasecmp(sprop, "rj-master") == 0) { | 432 | } else if (strcasecmp(sprop, "rj-master") == 0) { |
| 428 | machine_data->dai_format = SND_SOC_DAIFMT_RIGHT_J; | 433 | machine_data->dai_format = |
| 434 | SND_SOC_DAIFMT_RIGHT_J | SND_SOC_DAIFMT_CBS_CFS; | ||
| 429 | machine_data->codec_clk_direction = SND_SOC_CLOCK_IN; | 435 | machine_data->codec_clk_direction = SND_SOC_CLOCK_IN; |
| 430 | machine_data->cpu_clk_direction = SND_SOC_CLOCK_OUT; | 436 | machine_data->cpu_clk_direction = SND_SOC_CLOCK_OUT; |
| 431 | } else if (strcasecmp(sprop, "ac97-slave") == 0) { | 437 | } else if (strcasecmp(sprop, "ac97-slave") == 0) { |
| 432 | machine_data->dai_format = SND_SOC_DAIFMT_AC97; | 438 | machine_data->dai_format = |
| 439 | SND_SOC_DAIFMT_AC97 | SND_SOC_DAIFMT_CBM_CFM; | ||
| 433 | machine_data->codec_clk_direction = SND_SOC_CLOCK_OUT; | 440 | machine_data->codec_clk_direction = SND_SOC_CLOCK_OUT; |
| 434 | machine_data->cpu_clk_direction = SND_SOC_CLOCK_IN; | 441 | machine_data->cpu_clk_direction = SND_SOC_CLOCK_IN; |
| 435 | } else if (strcasecmp(sprop, "ac97-master") == 0) { | 442 | } else if (strcasecmp(sprop, "ac97-master") == 0) { |
| 436 | machine_data->dai_format = SND_SOC_DAIFMT_AC97; | 443 | machine_data->dai_format = |
| 444 | SND_SOC_DAIFMT_AC97 | SND_SOC_DAIFMT_CBS_CFS; | ||
| 437 | machine_data->codec_clk_direction = SND_SOC_CLOCK_IN; | 445 | machine_data->codec_clk_direction = SND_SOC_CLOCK_IN; |
| 438 | machine_data->cpu_clk_direction = SND_SOC_CLOCK_OUT; | 446 | machine_data->cpu_clk_direction = SND_SOC_CLOCK_OUT; |
| 439 | } else { | 447 | } else { |
diff --git a/sound/soc/nuc900/nuc900-ac97.c b/sound/soc/nuc900/nuc900-ac97.c index 9c0edad90d8b..a4e3237956e2 100644 --- a/sound/soc/nuc900/nuc900-ac97.c +++ b/sound/soc/nuc900/nuc900-ac97.c | |||
| @@ -365,7 +365,8 @@ static int __devinit nuc900_ac97_drvprobe(struct platform_device *pdev) | |||
| 365 | if (ret) | 365 | if (ret) |
| 366 | goto out3; | 366 | goto out3; |
| 367 | 367 | ||
| 368 | mfp_set_groupg(nuc900_audio->dev); /* enbale ac97 multifunction pin*/ | 368 | /* enbale ac97 multifunction pin */ |
| 369 | mfp_set_groupg(nuc900_audio->dev, "nuc900-audio"); | ||
| 369 | 370 | ||
| 370 | return 0; | 371 | return 0; |
| 371 | 372 | ||
diff --git a/sound/soc/samsung/smdk_wm8994.c b/sound/soc/samsung/smdk_wm8994.c index f75e43997d5b..ad9ac42522e2 100644 --- a/sound/soc/samsung/smdk_wm8994.c +++ b/sound/soc/samsung/smdk_wm8994.c | |||
| @@ -9,6 +9,7 @@ | |||
| 9 | 9 | ||
| 10 | #include "../codecs/wm8994.h" | 10 | #include "../codecs/wm8994.h" |
| 11 | #include <sound/pcm_params.h> | 11 | #include <sound/pcm_params.h> |
| 12 | #include <linux/module.h> | ||
| 12 | 13 | ||
| 13 | /* | 14 | /* |
| 14 | * Default CFG switch settings to use this driver: | 15 | * Default CFG switch settings to use this driver: |
diff --git a/sound/soc/samsung/speyside.c b/sound/soc/samsung/speyside.c index 85bf541a771d..4b8e35410eb1 100644 --- a/sound/soc/samsung/speyside.c +++ b/sound/soc/samsung/speyside.c | |||
| @@ -191,7 +191,7 @@ static int speyside_late_probe(struct snd_soc_card *card) | |||
| 191 | snd_soc_dapm_ignore_suspend(&card->dapm, "Headset Mic"); | 191 | snd_soc_dapm_ignore_suspend(&card->dapm, "Headset Mic"); |
| 192 | snd_soc_dapm_ignore_suspend(&card->dapm, "Main AMIC"); | 192 | snd_soc_dapm_ignore_suspend(&card->dapm, "Main AMIC"); |
| 193 | snd_soc_dapm_ignore_suspend(&card->dapm, "Main DMIC"); | 193 | snd_soc_dapm_ignore_suspend(&card->dapm, "Main DMIC"); |
| 194 | snd_soc_dapm_ignore_suspend(&card->dapm, "Speaker"); | 194 | snd_soc_dapm_ignore_suspend(&card->dapm, "Main Speaker"); |
| 195 | snd_soc_dapm_ignore_suspend(&card->dapm, "WM1250 Output"); | 195 | snd_soc_dapm_ignore_suspend(&card->dapm, "WM1250 Output"); |
| 196 | snd_soc_dapm_ignore_suspend(&card->dapm, "WM1250 Input"); | 196 | snd_soc_dapm_ignore_suspend(&card->dapm, "WM1250 Input"); |
| 197 | 197 | ||
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index a5d3685a5d38..a25fa63ce9a2 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c | |||
| @@ -709,6 +709,12 @@ int snd_soc_resume(struct device *dev) | |||
| 709 | struct snd_soc_card *card = dev_get_drvdata(dev); | 709 | struct snd_soc_card *card = dev_get_drvdata(dev); |
| 710 | int i, ac97_control = 0; | 710 | int i, ac97_control = 0; |
| 711 | 711 | ||
| 712 | /* If the initialization of this soc device failed, there is no codec | ||
| 713 | * associated with it. Just bail out in this case. | ||
| 714 | */ | ||
| 715 | if (list_empty(&card->codec_dev_list)) | ||
| 716 | return 0; | ||
| 717 | |||
| 712 | /* AC97 devices might have other drivers hanging off them so | 718 | /* AC97 devices might have other drivers hanging off them so |
| 713 | * need to resume immediately. Other drivers don't have that | 719 | * need to resume immediately. Other drivers don't have that |
| 714 | * problem and may take a substantial amount of time to resume | 720 | * problem and may take a substantial amount of time to resume |
diff --git a/sound/usb/quirks-table.h b/sound/usb/quirks-table.h index b61945f3af9e..32d2a21f2e3b 100644 --- a/sound/usb/quirks-table.h +++ b/sound/usb/quirks-table.h | |||
| @@ -1633,6 +1633,37 @@ YAMAHA_DEVICE(0x7010, "UB99"), | |||
| 1633 | } | 1633 | } |
| 1634 | }, | 1634 | }, |
| 1635 | { | 1635 | { |
| 1636 | /* Roland GAIA SH-01 */ | ||
| 1637 | USB_DEVICE(0x0582, 0x0111), | ||
| 1638 | .driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) { | ||
| 1639 | .vendor_name = "Roland", | ||
| 1640 | .product_name = "GAIA", | ||
| 1641 | .ifnum = QUIRK_ANY_INTERFACE, | ||
| 1642 | .type = QUIRK_COMPOSITE, | ||
| 1643 | .data = (const struct snd_usb_audio_quirk[]) { | ||
| 1644 | { | ||
| 1645 | .ifnum = 0, | ||
| 1646 | .type = QUIRK_AUDIO_STANDARD_INTERFACE | ||
| 1647 | }, | ||
| 1648 | { | ||
| 1649 | .ifnum = 1, | ||
| 1650 | .type = QUIRK_AUDIO_STANDARD_INTERFACE | ||
| 1651 | }, | ||
| 1652 | { | ||
| 1653 | .ifnum = 2, | ||
| 1654 | .type = QUIRK_MIDI_FIXED_ENDPOINT, | ||
| 1655 | .data = &(const struct snd_usb_midi_endpoint_info) { | ||
| 1656 | .out_cables = 0x0003, | ||
| 1657 | .in_cables = 0x0003 | ||
| 1658 | } | ||
| 1659 | }, | ||
| 1660 | { | ||
| 1661 | .ifnum = -1 | ||
| 1662 | } | ||
| 1663 | } | ||
| 1664 | } | ||
| 1665 | }, | ||
| 1666 | { | ||
| 1636 | USB_DEVICE(0x0582, 0x0113), | 1667 | USB_DEVICE(0x0582, 0x0113), |
| 1637 | .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { | 1668 | .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { |
| 1638 | /* .vendor_name = "BOSS", */ | 1669 | /* .vendor_name = "BOSS", */ |
