diff options
648 files changed, 8573 insertions, 5197 deletions
diff --git a/Documentation/00-INDEX b/Documentation/00-INDEX index f54273e2ac97..ceb1ff735469 100644 --- a/Documentation/00-INDEX +++ b/Documentation/00-INDEX | |||
@@ -210,6 +210,8 @@ local_ops.txt | |||
210 | - semantics and behavior of local atomic operations. | 210 | - semantics and behavior of local atomic operations. |
211 | lockdep-design.txt | 211 | lockdep-design.txt |
212 | - documentation on the runtime locking correctness validator. | 212 | - documentation on the runtime locking correctness validator. |
213 | lockup-watchdogs.txt | ||
214 | - info on soft and hard lockup detectors (aka nmi_watchdog). | ||
213 | logo.gif | 215 | logo.gif |
214 | - full colour GIF image of Linux logo (penguin - Tux). | 216 | - full colour GIF image of Linux logo (penguin - Tux). |
215 | logo.txt | 217 | logo.txt |
@@ -240,8 +242,6 @@ netlabel/ | |||
240 | - directory with information on the NetLabel subsystem. | 242 | - directory with information on the NetLabel subsystem. |
241 | networking/ | 243 | networking/ |
242 | - directory with info on various aspects of networking with Linux. | 244 | - directory with info on various aspects of networking with Linux. |
243 | nmi_watchdog.txt | ||
244 | - info on NMI watchdog for SMP systems. | ||
245 | nommu-mmap.txt | 245 | nommu-mmap.txt |
246 | - documentation about no-mmu memory mapping support. | 246 | - documentation about no-mmu memory mapping support. |
247 | numastat.txt | 247 | numastat.txt |
diff --git a/Documentation/devicetree/bindings/arm/atmel-at91.txt b/Documentation/devicetree/bindings/arm/atmel-at91.txt index ecc81e368715..d187e9f7cf1c 100644 --- a/Documentation/devicetree/bindings/arm/atmel-at91.txt +++ b/Documentation/devicetree/bindings/arm/atmel-at91.txt | |||
@@ -8,7 +8,7 @@ PIT Timer required properties: | |||
8 | shared across all System Controller members. | 8 | shared across all System Controller members. |
9 | 9 | ||
10 | TC/TCLIB Timer required properties: | 10 | TC/TCLIB Timer required properties: |
11 | - compatible: Should be "atmel,<chip>-pit". | 11 | - compatible: Should be "atmel,<chip>-tcb". |
12 | <chip> can be "at91rm9200" or "at91sam9x5" | 12 | <chip> can be "at91rm9200" or "at91sam9x5" |
13 | - reg: Should contain registers location and length | 13 | - reg: Should contain registers location and length |
14 | - interrupts: Should contain all interrupts for the TC block | 14 | - interrupts: Should contain all interrupts for the TC block |
diff --git a/Documentation/devicetree/bindings/input/touchscreen/egalax-ts.txt b/Documentation/devicetree/bindings/input/touchscreen/egalax-ts.txt new file mode 100644 index 000000000000..df70318a617f --- /dev/null +++ b/Documentation/devicetree/bindings/input/touchscreen/egalax-ts.txt | |||
@@ -0,0 +1,19 @@ | |||
1 | * EETI eGalax Multiple Touch Controller | ||
2 | |||
3 | Required properties: | ||
4 | - compatible: must be "eeti,egalax_ts" | ||
5 | - reg: i2c slave address | ||
6 | - interrupt-parent: the phandle for the interrupt controller | ||
7 | - interrupts: touch controller interrupt | ||
8 | - wakeup-gpios: the gpio pin to be used for waking up the controller | ||
9 | as well as uased as irq pin | ||
10 | |||
11 | Example: | ||
12 | |||
13 | egalax_ts@04 { | ||
14 | compatible = "eeti,egalax_ts"; | ||
15 | reg = <0x04>; | ||
16 | interrupt-parent = <&gpio1>; | ||
17 | interrupts = <9 2>; | ||
18 | wakeup-gpios = <&gpio1 9 0>; | ||
19 | }; | ||
diff --git a/Documentation/devicetree/bindings/pinctrl/nvidia,tegra20-pinmux.txt b/Documentation/devicetree/bindings/pinctrl/nvidia,tegra20-pinmux.txt index c8e578263ce2..683fde93c4fb 100644 --- a/Documentation/devicetree/bindings/pinctrl/nvidia,tegra20-pinmux.txt +++ b/Documentation/devicetree/bindings/pinctrl/nvidia,tegra20-pinmux.txt | |||
@@ -93,7 +93,7 @@ Valid values for pin and group names are: | |||
93 | 93 | ||
94 | With some exceptions, these support nvidia,high-speed-mode, | 94 | With some exceptions, these support nvidia,high-speed-mode, |
95 | nvidia,schmitt, nvidia,low-power-mode, nvidia,pull-down-strength, | 95 | nvidia,schmitt, nvidia,low-power-mode, nvidia,pull-down-strength, |
96 | nvidia,pull-up-strength, nvidia,slew_rate-rising, nvidia,slew_rate-falling. | 96 | nvidia,pull-up-strength, nvidia,slew-rate-rising, nvidia,slew-rate-falling. |
97 | 97 | ||
98 | drive_ao1, drive_ao2, drive_at1, drive_at2, drive_cdev1, drive_cdev2, | 98 | drive_ao1, drive_ao2, drive_at1, drive_at2, drive_cdev1, drive_cdev2, |
99 | drive_csus, drive_dap1, drive_dap2, drive_dap3, drive_dap4, drive_dbg, | 99 | drive_csus, drive_dap1, drive_dap2, drive_dap3, drive_dap4, drive_dbg, |
diff --git a/Documentation/devicetree/bindings/pinctrl/nvidia,tegra30-pinmux.txt b/Documentation/devicetree/bindings/pinctrl/nvidia,tegra30-pinmux.txt index c275b70349c1..6f426ed7009e 100644 --- a/Documentation/devicetree/bindings/pinctrl/nvidia,tegra30-pinmux.txt +++ b/Documentation/devicetree/bindings/pinctrl/nvidia,tegra30-pinmux.txt | |||
@@ -83,7 +83,7 @@ Valid values for pin and group names are: | |||
83 | drive groups: | 83 | drive groups: |
84 | 84 | ||
85 | These all support nvidia,pull-down-strength, nvidia,pull-up-strength, | 85 | These all support nvidia,pull-down-strength, nvidia,pull-up-strength, |
86 | nvidia,slew_rate-rising, nvidia,slew_rate-falling. Most but not all | 86 | nvidia,slew-rate-rising, nvidia,slew-rate-falling. Most but not all |
87 | support nvidia,high-speed-mode, nvidia,schmitt, nvidia,low-power-mode. | 87 | support nvidia,high-speed-mode, nvidia,schmitt, nvidia,low-power-mode. |
88 | 88 | ||
89 | ao1, ao2, at1, at2, at3, at4, at5, cdev1, cdev2, cec, crt, csus, dap1, | 89 | ao1, ao2, at1, at2, at3, at4, at5, cdev1, cdev2, cec, crt, csus, dap1, |
diff --git a/Documentation/firmware_class/README b/Documentation/firmware_class/README index 7eceaff63f5f..815b711bcd85 100644 --- a/Documentation/firmware_class/README +++ b/Documentation/firmware_class/README | |||
@@ -18,32 +18,40 @@ | |||
18 | High level behavior (mixed): | 18 | High level behavior (mixed): |
19 | ============================ | 19 | ============================ |
20 | 20 | ||
21 | kernel(driver): calls request_firmware(&fw_entry, $FIRMWARE, device) | 21 | 1), kernel(driver): |
22 | 22 | - calls request_firmware(&fw_entry, $FIRMWARE, device) | |
23 | userspace: | 23 | - kernel searchs the fimware image with name $FIRMWARE directly |
24 | in the below search path of root filesystem: | ||
25 | "/lib/firmware/updates/" UTS_RELEASE, | ||
26 | "/lib/firmware/updates", | ||
27 | "/lib/firmware/" UTS_RELEASE, | ||
28 | "/lib/firmware" | ||
29 | - If found, goto 7), else goto 2) | ||
30 | |||
31 | 2), userspace: | ||
24 | - /sys/class/firmware/xxx/{loading,data} appear. | 32 | - /sys/class/firmware/xxx/{loading,data} appear. |
25 | - hotplug gets called with a firmware identifier in $FIRMWARE | 33 | - hotplug gets called with a firmware identifier in $FIRMWARE |
26 | and the usual hotplug environment. | 34 | and the usual hotplug environment. |
27 | - hotplug: echo 1 > /sys/class/firmware/xxx/loading | 35 | - hotplug: echo 1 > /sys/class/firmware/xxx/loading |
28 | 36 | ||
29 | kernel: Discard any previous partial load. | 37 | 3), kernel: Discard any previous partial load. |
30 | 38 | ||
31 | userspace: | 39 | 4), userspace: |
32 | - hotplug: cat appropriate_firmware_image > \ | 40 | - hotplug: cat appropriate_firmware_image > \ |
33 | /sys/class/firmware/xxx/data | 41 | /sys/class/firmware/xxx/data |
34 | 42 | ||
35 | kernel: grows a buffer in PAGE_SIZE increments to hold the image as it | 43 | 5), kernel: grows a buffer in PAGE_SIZE increments to hold the image as it |
36 | comes in. | 44 | comes in. |
37 | 45 | ||
38 | userspace: | 46 | 6), userspace: |
39 | - hotplug: echo 0 > /sys/class/firmware/xxx/loading | 47 | - hotplug: echo 0 > /sys/class/firmware/xxx/loading |
40 | 48 | ||
41 | kernel: request_firmware() returns and the driver has the firmware | 49 | 7), kernel: request_firmware() returns and the driver has the firmware |
42 | image in fw_entry->{data,size}. If something went wrong | 50 | image in fw_entry->{data,size}. If something went wrong |
43 | request_firmware() returns non-zero and fw_entry is set to | 51 | request_firmware() returns non-zero and fw_entry is set to |
44 | NULL. | 52 | NULL. |
45 | 53 | ||
46 | kernel(driver): Driver code calls release_firmware(fw_entry) releasing | 54 | 8), kernel(driver): Driver code calls release_firmware(fw_entry) releasing |
47 | the firmware image and any related resource. | 55 | the firmware image and any related resource. |
48 | 56 | ||
49 | High level behavior (driver code): | 57 | High level behavior (driver code): |
diff --git a/Documentation/hwmon/fam15h_power b/Documentation/hwmon/fam15h_power index a92918e0bd69..80654813d04a 100644 --- a/Documentation/hwmon/fam15h_power +++ b/Documentation/hwmon/fam15h_power | |||
@@ -10,7 +10,7 @@ Supported chips: | |||
10 | BIOS and Kernel Developer's Guide (BKDG) For AMD Family 15h Processors | 10 | BIOS and Kernel Developer's Guide (BKDG) For AMD Family 15h Processors |
11 | (not yet published) | 11 | (not yet published) |
12 | 12 | ||
13 | Author: Andreas Herrmann <andreas.herrmann3@amd.com> | 13 | Author: Andreas Herrmann <herrmann.der.user@googlemail.com> |
14 | 14 | ||
15 | Description | 15 | Description |
16 | ----------- | 16 | ----------- |
diff --git a/Documentation/zh_CN/IRQ.txt b/Documentation/zh_CN/IRQ.txt new file mode 100644 index 000000000000..956026d5cf82 --- /dev/null +++ b/Documentation/zh_CN/IRQ.txt | |||
@@ -0,0 +1,39 @@ | |||
1 | Chinese translated version of Documentation/IRQ.txt | ||
2 | |||
3 | If you have any comment or update to the content, please contact the | ||
4 | original document maintainer directly. However, if you have a problem | ||
5 | communicating in English you can also ask the Chinese maintainer for | ||
6 | help. Contact the Chinese maintainer if this translation is outdated | ||
7 | or if there is a problem with the translation. | ||
8 | |||
9 | Maintainer: Eric W. Biederman <ebiederman@xmission.com> | ||
10 | Chinese maintainer: Fu Wei <tekkamanninja@gmail.com> | ||
11 | --------------------------------------------------------------------- | ||
12 | Documentation/IRQ.txt 的中文翻译 | ||
13 | |||
14 | 如果想评论或更新本文的内容,请直接联系原文档的维护者。如果你使用英文 | ||
15 | 交流有困难的话,也可以向中文版维护者求助。如果本翻译更新不及时或者翻 | ||
16 | 译存在问题,请联系中文版维护者。 | ||
17 | 英文版维护者: Eric W. Biederman <ebiederman@xmission.com> | ||
18 | 中文版维护者: 傅炜 Fu Wei <tekkamanninja@gmail.com> | ||
19 | 中文版翻译者: 傅炜 Fu Wei <tekkamanninja@gmail.com> | ||
20 | 中文版校译者: 傅炜 Fu Wei <tekkamanninja@gmail.com> | ||
21 | |||
22 | |||
23 | 以下为正文 | ||
24 | --------------------------------------------------------------------- | ||
25 | 何为 IRQ? | ||
26 | |||
27 | 一个 IRQ 是来自某个设备的一个中断请求。目前,它们可以来自一个硬件引脚, | ||
28 | 或来自一个数据包。多个设备可能连接到同个硬件引脚,从而共享一个 IRQ。 | ||
29 | |||
30 | 一个 IRQ 编号是用于告知硬件中断源的内核标识。通常情况下,这是一个 | ||
31 | 全局 irq_desc 数组的索引,但是除了在 linux/interrupt.h 中的实现, | ||
32 | 具体的细节是体系结构特定的。 | ||
33 | |||
34 | 一个 IRQ 编号是设备上某个可能的中断源的枚举。通常情况下,枚举的编号是 | ||
35 | 该引脚在系统内中断控制器的所有输入引脚中的编号。对于 ISA 总线中的情况, | ||
36 | 枚举的是在两个 i8259 中断控制器中 16 个输入引脚。 | ||
37 | |||
38 | 架构可以对 IRQ 编号指定额外的含义,在硬件涉及任何手工配置的情况下, | ||
39 | 是被提倡的。ISA 的 IRQ 是一个分配这类额外含义的典型例子。 | ||
diff --git a/Documentation/zh_CN/arm64/booting.txt b/Documentation/zh_CN/arm64/booting.txt new file mode 100644 index 000000000000..28fa325b7461 --- /dev/null +++ b/Documentation/zh_CN/arm64/booting.txt | |||
@@ -0,0 +1,156 @@ | |||
1 | Chinese translated version of Documentation/arm64/booting.txt | ||
2 | |||
3 | If you have any comment or update to the content, please contact the | ||
4 | original document maintainer directly. However, if you have a problem | ||
5 | communicating in English you can also ask the Chinese maintainer for | ||
6 | help. Contact the Chinese maintainer if this translation is outdated | ||
7 | or if there is a problem with the translation. | ||
8 | |||
9 | Maintainer: Will Deacon <will.deacon@arm.com> | ||
10 | Chinese maintainer: Fu Wei <tekkamanninja@gmail.com> | ||
11 | --------------------------------------------------------------------- | ||
12 | Documentation/arm64/booting.txt 的中文翻译 | ||
13 | |||
14 | 如果想评论或更新本文的内容,请直接联系原文档的维护者。如果你使用英文 | ||
15 | 交流有困难的话,也可以向中文版维护者求助。如果本翻译更新不及时或者翻 | ||
16 | 译存在问题,请联系中文版维护者。 | ||
17 | |||
18 | 英文版维护者: Will Deacon <will.deacon@arm.com> | ||
19 | 中文版维护者: 傅炜 Fu Wei <tekkamanninja@gmail.com> | ||
20 | 中文版翻译者: 傅炜 Fu Wei <tekkamanninja@gmail.com> | ||
21 | 中文版校译者: 傅炜 Fu Wei <tekkamanninja@gmail.com> | ||
22 | |||
23 | 以下为正文 | ||
24 | --------------------------------------------------------------------- | ||
25 | 启动 AArch64 Linux | ||
26 | ================== | ||
27 | |||
28 | 作者: Will Deacon <will.deacon@arm.com> | ||
29 | 日期: 2012 年 09 月 07 日 | ||
30 | |||
31 | 本文档基于 Russell King 的 ARM 启动文档,且适用于所有公开发布的 | ||
32 | AArch64 Linux 内核代码。 | ||
33 | |||
34 | AArch64 异常模型由多个异常级别(EL0 - EL3)组成,对于 EL0 和 EL1 | ||
35 | 异常级有对应的安全和非安全模式。EL2 是系统管理级,且仅存在于 | ||
36 | 非安全模式下。EL3 是最高特权级,且仅存在于安全模式下。 | ||
37 | |||
38 | 基于本文档的目的,我们将简单地使用‘引导装载程序’(‘boot loader’) | ||
39 | 这个术语来定义在将控制权交给 Linux 内核前 CPU 上执行的所有软件。 | ||
40 | 这可能包含安全监控和系统管理代码,或者它可能只是一些用于准备最小启动 | ||
41 | 环境的指令。 | ||
42 | |||
43 | 基本上,引导装载程序(至少)应实现以下操作: | ||
44 | |||
45 | 1、设置和初始化 RAM | ||
46 | 2、设置设备树数据 | ||
47 | 3、解压内核映像 | ||
48 | 4、调用内核映像 | ||
49 | |||
50 | |||
51 | 1、设置和初始化 RAM | ||
52 | ----------------- | ||
53 | |||
54 | 必要性: 强制 | ||
55 | |||
56 | 引导装载程序应该找到并初始化系统中所有内核用于保持系统变量数据的 RAM。 | ||
57 | 这个操作的执行是设备依赖的。(它可能使用内部算法来自动定位和计算所有 | ||
58 | RAM,或可能使用对这个设备已知的 RAM 信息,还可能使用任何引导装载程序 | ||
59 | 设计者想到的匹配方法。) | ||
60 | |||
61 | |||
62 | 2、设置设备树数据 | ||
63 | --------------- | ||
64 | |||
65 | 必要性: 强制 | ||
66 | |||
67 | 设备树数据块(dtb)大小必须不大于 2 MB,且位于从内核映像起始算起第一个 | ||
68 | 512MB 内的 2MB 边界上。这使得内核可以通过初始页表中的单个节描述符来 | ||
69 | 映射此数据块。 | ||
70 | |||
71 | |||
72 | 3、解压内核映像 | ||
73 | ------------- | ||
74 | |||
75 | 必要性: 可选 | ||
76 | |||
77 | AArch64 内核当前没有提供自解压代码,因此如果使用了压缩内核映像文件 | ||
78 | (比如 Image.gz),则需要通过引导装载程序(使用 gzip 等)来进行解压。 | ||
79 | 若引导装载程序没有实现这个需求,就要使用非压缩内核映像文件。 | ||
80 | |||
81 | |||
82 | 4、调用内核映像 | ||
83 | ------------- | ||
84 | |||
85 | 必要性: 强制 | ||
86 | |||
87 | 已解压的内核映像包含一个 32 字节的头,内容如下: | ||
88 | |||
89 | u32 magic = 0x14000008; /* 跳转到 stext, 小端 */ | ||
90 | u32 res0 = 0; /* 保留 */ | ||
91 | u64 text_offset; /* 映像装载偏移 */ | ||
92 | u64 res1 = 0; /* 保留 */ | ||
93 | u64 res2 = 0; /* 保留 */ | ||
94 | |||
95 | 映像必须位于系统 RAM 起始处的特定偏移(当前是 0x80000)。系统 RAM | ||
96 | 的起始地址必须是以 2MB 对齐的。 | ||
97 | |||
98 | 在跳转入内核前,必须符合以下状态: | ||
99 | |||
100 | - 停止所有 DMA 设备,这样内存数据就不会因为虚假网络包或磁盘数据而 | ||
101 | 被破坏。这可能可以节省你许多的调试时间。 | ||
102 | |||
103 | - 主 CPU 通用寄存器设置 | ||
104 | x0 = 系统 RAM 中设备树数据块(dtb)的物理地址。 | ||
105 | x1 = 0 (保留,将来可能使用) | ||
106 | x2 = 0 (保留,将来可能使用) | ||
107 | x3 = 0 (保留,将来可能使用) | ||
108 | |||
109 | - CPU 模式 | ||
110 | 所有形式的中断必须在 PSTATE.DAIF 中被屏蔽(Debug、SError、IRQ | ||
111 | 和 FIQ)。 | ||
112 | CPU 必须处于 EL2(推荐,可访问虚拟化扩展)或非安全 EL1 模式下。 | ||
113 | |||
114 | - 高速缓存、MMU | ||
115 | MMU 必须关闭。 | ||
116 | 指令缓存开启或关闭都可以。 | ||
117 | 数据缓存必须关闭且无效。 | ||
118 | 外部高速缓存(如果存在)必须配置并禁用。 | ||
119 | |||
120 | - 架构计时器 | ||
121 | CNTFRQ 必须设定为计时器的频率。 | ||
122 | 如果在 EL1 模式下进入内核,则 CNTHCTL_EL2 中的 EL1PCTEN (bit 0) | ||
123 | 必须置位。 | ||
124 | |||
125 | - 一致性 | ||
126 | 通过内核启动的所有 CPU 在内核入口地址上必须处于相同的一致性域中。 | ||
127 | 这可能要根据具体实现来定义初始化过程,以使能每个CPU上对维护操作的 | ||
128 | 接收。 | ||
129 | |||
130 | - 系统寄存器 | ||
131 | 在进入内核映像的异常级中,所有构架中可写的系统寄存器必须通过软件 | ||
132 | 在一个更高的异常级别下初始化,以防止在 未知 状态下运行。 | ||
133 | |||
134 | 引导装载程序必须在每个 CPU 处于以下状态时跳入内核入口: | ||
135 | |||
136 | - 主 CPU 必须直接跳入内核映像的第一条指令。通过此 CPU 传递的设备树 | ||
137 | 数据块必须在每个 CPU 节点中包含以下内容: | ||
138 | |||
139 | 1、‘enable-method’属性。目前,此字段支持的值仅为字符串“spin-table”。 | ||
140 | |||
141 | 2、‘cpu-release-addr’标识一个 64-bit、初始化为零的内存位置。 | ||
142 | |||
143 | 引导装载程序必须生成这些设备树属性,并在跳入内核入口之前将其插入 | ||
144 | 数据块。 | ||
145 | |||
146 | - 任何辅助 CPU 必须在内存保留区(通过设备树中的 /memreserve/ 域传递 | ||
147 | 给内核)中自旋于内核之外,轮询它们的 cpu-release-addr 位置(必须 | ||
148 | 包含在保留区中)。可通过插入 wfe 指令来降低忙循环开销,而主 CPU 将 | ||
149 | 发出 sev 指令。当对 cpu-release-addr 所指位置的读取操作返回非零值 | ||
150 | 时,CPU 必须直接跳入此值所指向的地址。 | ||
151 | |||
152 | - 辅助 CPU 通用寄存器设置 | ||
153 | x0 = 0 (保留,将来可能使用) | ||
154 | x1 = 0 (保留,将来可能使用) | ||
155 | x2 = 0 (保留,将来可能使用) | ||
156 | x3 = 0 (保留,将来可能使用) | ||
diff --git a/Documentation/zh_CN/arm64/memory.txt b/Documentation/zh_CN/arm64/memory.txt new file mode 100644 index 000000000000..83b519314706 --- /dev/null +++ b/Documentation/zh_CN/arm64/memory.txt | |||
@@ -0,0 +1,93 @@ | |||
1 | Chinese translated version of Documentation/arm64/memory.txt | ||
2 | |||
3 | If you have any comment or update to the content, please contact the | ||
4 | original document maintainer directly. However, if you have a problem | ||
5 | communicating in English you can also ask the Chinese maintainer for | ||
6 | help. Contact the Chinese maintainer if this translation is outdated | ||
7 | or if there is a problem with the translation. | ||
8 | |||
9 | Maintainer: Catalin Marinas <catalin.marinas@arm.com> | ||
10 | Chinese maintainer: Fu Wei <tekkamanninja@gmail.com> | ||
11 | --------------------------------------------------------------------- | ||
12 | Documentation/arm64/memory.txt 的中文翻译 | ||
13 | |||
14 | 如果想评论或更新本文的内容,请直接联系原文档的维护者。如果你使用英文 | ||
15 | 交流有困难的话,也可以向中文版维护者求助。如果本翻译更新不及时或者翻 | ||
16 | 译存在问题,请联系中文版维护者。 | ||
17 | |||
18 | 英文版维护者: Catalin Marinas <catalin.marinas@arm.com> | ||
19 | 中文版维护者: 傅炜 Fu Wei <tekkamanninja@gmail.com> | ||
20 | 中文版翻译者: 傅炜 Fu Wei <tekkamanninja@gmail.com> | ||
21 | 中文版校译者: 傅炜 Fu Wei <tekkamanninja@gmail.com> | ||
22 | |||
23 | 以下为正文 | ||
24 | --------------------------------------------------------------------- | ||
25 | Linux 在 AArch64 中的内存布局 | ||
26 | =========================== | ||
27 | |||
28 | 作者: Catalin Marinas <catalin.marinas@arm.com> | ||
29 | 日期: 2012 年 02 月 20 日 | ||
30 | |||
31 | 本文档描述 AArch64 Linux 内核所使用的虚拟内存布局。此构架可以实现 | ||
32 | 页大小为 4KB 的 4 级转换表和页大小为 64KB 的 3 级转换表。 | ||
33 | |||
34 | AArch64 Linux 使用页大小为 4KB 的 3 级转换表配置,对于用户和内核 | ||
35 | 都有 39-bit (512GB) 的虚拟地址空间。对于页大小为 64KB的配置,仅 | ||
36 | 使用 2 级转换表,但内存布局相同。 | ||
37 | |||
38 | 用户地址空间的 63:39 位为 0,而内核地址空间的相应位为 1。TTBRx 的 | ||
39 | 选择由虚拟地址的 63 位给出。swapper_pg_dir 仅包含内核(全局)映射, | ||
40 | 而用户 pgd 仅包含用户(非全局)映射。swapper_pgd_dir 地址被写入 | ||
41 | TTBR1 中,且从不写入 TTBR0。 | ||
42 | |||
43 | |||
44 | AArch64 Linux 内存布局: | ||
45 | |||
46 | 起始地址 结束地址 大小 用途 | ||
47 | ----------------------------------------------------------------------- | ||
48 | 0000000000000000 0000007fffffffff 512GB 用户空间 | ||
49 | |||
50 | ffffff8000000000 ffffffbbfffcffff ~240GB vmalloc | ||
51 | |||
52 | ffffffbbfffd0000 ffffffbcfffdffff 64KB [防护页] | ||
53 | |||
54 | ffffffbbfffe0000 ffffffbcfffeffff 64KB PCI I/O 空间 | ||
55 | |||
56 | ffffffbbffff0000 ffffffbcffffffff 64KB [防护页] | ||
57 | |||
58 | ffffffbc00000000 ffffffbdffffffff 8GB vmemmap | ||
59 | |||
60 | ffffffbe00000000 ffffffbffbffffff ~8GB [防护页,未来用于 vmmemap] | ||
61 | |||
62 | ffffffbffc000000 ffffffbfffffffff 64MB 模块 | ||
63 | |||
64 | ffffffc000000000 ffffffffffffffff 256GB 内存空间 | ||
65 | |||
66 | |||
67 | 4KB 页大小的转换表查找: | ||
68 | |||
69 | +--------+--------+--------+--------+--------+--------+--------+--------+ | ||
70 | |63 56|55 48|47 40|39 32|31 24|23 16|15 8|7 0| | ||
71 | +--------+--------+--------+--------+--------+--------+--------+--------+ | ||
72 | | | | | | | | ||
73 | | | | | | v | ||
74 | | | | | | [11:0] 页内偏移 | ||
75 | | | | | +-> [20:12] L3 索引 | ||
76 | | | | +-----------> [29:21] L2 索引 | ||
77 | | | +---------------------> [38:30] L1 索引 | ||
78 | | +-------------------------------> [47:39] L0 索引 (未使用) | ||
79 | +-------------------------------------------------> [63] TTBR0/1 | ||
80 | |||
81 | |||
82 | 64KB 页大小的转换表查找: | ||
83 | |||
84 | +--------+--------+--------+--------+--------+--------+--------+--------+ | ||
85 | |63 56|55 48|47 40|39 32|31 24|23 16|15 8|7 0| | ||
86 | +--------+--------+--------+--------+--------+--------+--------+--------+ | ||
87 | | | | | | | ||
88 | | | | | v | ||
89 | | | | | [15:0] 页内偏移 | ||
90 | | | | +----------> [28:16] L3 索引 | ||
91 | | | +--------------------------> [41:29] L2 索引 (仅使用 38:29 ) | ||
92 | | +-------------------------------> [47:42] L1 索引 (未使用) | ||
93 | +-------------------------------------------------> [63] TTBR0/1 | ||
diff --git a/MAINTAINERS b/MAINTAINERS index 027ec2bfa135..59203e77ce9e 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
@@ -503,7 +503,7 @@ F: include/linux/altera_uart.h | |||
503 | F: include/linux/altera_jtaguart.h | 503 | F: include/linux/altera_jtaguart.h |
504 | 504 | ||
505 | AMD FAM15H PROCESSOR POWER MONITORING DRIVER | 505 | AMD FAM15H PROCESSOR POWER MONITORING DRIVER |
506 | M: Andreas Herrmann <andreas.herrmann3@amd.com> | 506 | M: Andreas Herrmann <herrmann.der.user@googlemail.com> |
507 | L: lm-sensors@lm-sensors.org | 507 | L: lm-sensors@lm-sensors.org |
508 | S: Maintained | 508 | S: Maintained |
509 | F: Documentation/hwmon/fam15h_power | 509 | F: Documentation/hwmon/fam15h_power |
@@ -637,6 +637,13 @@ W: http://www.arm.linux.org.uk/ | |||
637 | S: Maintained | 637 | S: Maintained |
638 | F: arch/arm/ | 638 | F: arch/arm/ |
639 | 639 | ||
640 | ARM SUB-ARCHITECTURES | ||
641 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) | ||
642 | S: MAINTAINED | ||
643 | F: arch/arm/mach-*/ | ||
644 | F: arch/arm/plat-*/ | ||
645 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc.git | ||
646 | |||
640 | ARM PRIMECELL AACI PL041 DRIVER | 647 | ARM PRIMECELL AACI PL041 DRIVER |
641 | M: Russell King <linux@arm.linux.org.uk> | 648 | M: Russell King <linux@arm.linux.org.uk> |
642 | S: Maintained | 649 | S: Maintained |
@@ -2500,6 +2507,7 @@ M: Joonyoung Shim <jy0922.shim@samsung.com> | |||
2500 | M: Seung-Woo Kim <sw0312.kim@samsung.com> | 2507 | M: Seung-Woo Kim <sw0312.kim@samsung.com> |
2501 | M: Kyungmin Park <kyungmin.park@samsung.com> | 2508 | M: Kyungmin Park <kyungmin.park@samsung.com> |
2502 | L: dri-devel@lists.freedesktop.org | 2509 | L: dri-devel@lists.freedesktop.org |
2510 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/daeinki/drm-exynos.git | ||
2503 | S: Supported | 2511 | S: Supported |
2504 | F: drivers/gpu/drm/exynos | 2512 | F: drivers/gpu/drm/exynos |
2505 | F: include/drm/exynos* | 2513 | F: include/drm/exynos* |
@@ -2802,6 +2810,7 @@ F: sound/usb/misc/ua101.c | |||
2802 | EXTENSIBLE FIRMWARE INTERFACE (EFI) | 2810 | EXTENSIBLE FIRMWARE INTERFACE (EFI) |
2803 | M: Matt Fleming <matt.fleming@intel.com> | 2811 | M: Matt Fleming <matt.fleming@intel.com> |
2804 | L: linux-efi@vger.kernel.org | 2812 | L: linux-efi@vger.kernel.org |
2813 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/mfleming/efi.git | ||
2805 | S: Maintained | 2814 | S: Maintained |
2806 | F: Documentation/x86/efi-stub.txt | 2815 | F: Documentation/x86/efi-stub.txt |
2807 | F: arch/ia64/kernel/efi.c | 2816 | F: arch/ia64/kernel/efi.c |
@@ -5061,7 +5070,13 @@ T: git git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git | |||
5061 | S: Odd Fixes | 5070 | S: Odd Fixes |
5062 | F: drivers/net/ | 5071 | F: drivers/net/ |
5063 | F: include/linux/if_* | 5072 | F: include/linux/if_* |
5064 | F: include/linux/*device.h | 5073 | F: include/linux/netdevice.h |
5074 | F: include/linux/arcdevice.h | ||
5075 | F: include/linux/etherdevice.h | ||
5076 | F: include/linux/fcdevice.h | ||
5077 | F: include/linux/fddidevice.h | ||
5078 | F: include/linux/hippidevice.h | ||
5079 | F: include/linux/inetdevice.h | ||
5065 | 5080 | ||
5066 | NETXEN (1/10) GbE SUPPORT | 5081 | NETXEN (1/10) GbE SUPPORT |
5067 | M: Sony Chacko <sony.chacko@qlogic.com> | 5082 | M: Sony Chacko <sony.chacko@qlogic.com> |
@@ -5633,7 +5648,7 @@ S: Maintained | |||
5633 | F: drivers/pinctrl/spear/ | 5648 | F: drivers/pinctrl/spear/ |
5634 | 5649 | ||
5635 | PKTCDVD DRIVER | 5650 | PKTCDVD DRIVER |
5636 | M: Peter Osterlund <petero2@telia.com> | 5651 | M: Jiri Kosina <jkosina@suse.cz> |
5637 | S: Maintained | 5652 | S: Maintained |
5638 | F: drivers/block/pktcdvd.c | 5653 | F: drivers/block/pktcdvd.c |
5639 | F: include/linux/pktcdvd.h | 5654 | F: include/linux/pktcdvd.h |
@@ -1,7 +1,7 @@ | |||
1 | VERSION = 3 | 1 | VERSION = 3 |
2 | PATCHLEVEL = 7 | 2 | PATCHLEVEL = 7 |
3 | SUBLEVEL = 0 | 3 | SUBLEVEL = 0 |
4 | EXTRAVERSION = -rc2 | 4 | EXTRAVERSION = -rc4 |
5 | NAME = Terrified Chipmunk | 5 | NAME = Terrified Chipmunk |
6 | 6 | ||
7 | # *DOCUMENTATION* | 7 | # *DOCUMENTATION* |
diff --git a/arch/alpha/include/asm/thread_info.h b/arch/alpha/include/asm/thread_info.h index 4554ecbff7c6..1f8c72959fb6 100644 --- a/arch/alpha/include/asm/thread_info.h +++ b/arch/alpha/include/asm/thread_info.h | |||
@@ -7,6 +7,7 @@ | |||
7 | #include <asm/processor.h> | 7 | #include <asm/processor.h> |
8 | #include <asm/types.h> | 8 | #include <asm/types.h> |
9 | #include <asm/hwrpb.h> | 9 | #include <asm/hwrpb.h> |
10 | #include <asm/sysinfo.h> | ||
10 | #endif | 11 | #endif |
11 | 12 | ||
12 | #ifndef __ASSEMBLY__ | 13 | #ifndef __ASSEMBLY__ |
@@ -21,6 +22,7 @@ struct thread_info { | |||
21 | mm_segment_t addr_limit; /* thread address space */ | 22 | mm_segment_t addr_limit; /* thread address space */ |
22 | unsigned cpu; /* current CPU */ | 23 | unsigned cpu; /* current CPU */ |
23 | int preempt_count; /* 0 => preemptable, <0 => BUG */ | 24 | int preempt_count; /* 0 => preemptable, <0 => BUG */ |
25 | unsigned int status; /* thread-synchronous flags */ | ||
24 | 26 | ||
25 | int bpt_nsaved; | 27 | int bpt_nsaved; |
26 | unsigned long bpt_addr[2]; /* breakpoint handling */ | 28 | unsigned long bpt_addr[2]; /* breakpoint handling */ |
@@ -63,8 +65,6 @@ register struct thread_info *__current_thread_info __asm__("$8"); | |||
63 | * - these are process state flags and used from assembly | 65 | * - these are process state flags and used from assembly |
64 | * - pending work-to-be-done flags come first and must be assigned to be | 66 | * - pending work-to-be-done flags come first and must be assigned to be |
65 | * within bits 0 to 7 to fit in and immediate operand. | 67 | * within bits 0 to 7 to fit in and immediate operand. |
66 | * - ALPHA_UAC_SHIFT below must be kept consistent with the unaligned | ||
67 | * control flags. | ||
68 | * | 68 | * |
69 | * TIF_SYSCALL_TRACE is known to be 0 via blbs. | 69 | * TIF_SYSCALL_TRACE is known to be 0 via blbs. |
70 | */ | 70 | */ |
@@ -72,18 +72,12 @@ register struct thread_info *__current_thread_info __asm__("$8"); | |||
72 | #define TIF_NOTIFY_RESUME 1 /* callback before returning to user */ | 72 | #define TIF_NOTIFY_RESUME 1 /* callback before returning to user */ |
73 | #define TIF_SIGPENDING 2 /* signal pending */ | 73 | #define TIF_SIGPENDING 2 /* signal pending */ |
74 | #define TIF_NEED_RESCHED 3 /* rescheduling necessary */ | 74 | #define TIF_NEED_RESCHED 3 /* rescheduling necessary */ |
75 | #define TIF_POLLING_NRFLAG 8 /* poll_idle is polling NEED_RESCHED */ | ||
76 | #define TIF_DIE_IF_KERNEL 9 /* dik recursion lock */ | 75 | #define TIF_DIE_IF_KERNEL 9 /* dik recursion lock */ |
77 | #define TIF_UAC_NOPRINT 10 /* ! Preserve sequence of following */ | ||
78 | #define TIF_UAC_NOFIX 11 /* ! flags as they match */ | ||
79 | #define TIF_UAC_SIGBUS 12 /* ! userspace part of 'osf_sysinfo' */ | ||
80 | #define TIF_MEMDIE 13 /* is terminating due to OOM killer */ | 76 | #define TIF_MEMDIE 13 /* is terminating due to OOM killer */ |
81 | #define TIF_RESTORE_SIGMASK 14 /* restore signal mask in do_signal */ | ||
82 | 77 | ||
83 | #define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE) | 78 | #define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE) |
84 | #define _TIF_SIGPENDING (1<<TIF_SIGPENDING) | 79 | #define _TIF_SIGPENDING (1<<TIF_SIGPENDING) |
85 | #define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED) | 80 | #define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED) |
86 | #define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG) | ||
87 | #define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME) | 81 | #define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME) |
88 | 82 | ||
89 | /* Work to do on interrupt/exception return. */ | 83 | /* Work to do on interrupt/exception return. */ |
@@ -94,29 +88,63 @@ register struct thread_info *__current_thread_info __asm__("$8"); | |||
94 | #define _TIF_ALLWORK_MASK (_TIF_WORK_MASK \ | 88 | #define _TIF_ALLWORK_MASK (_TIF_WORK_MASK \ |
95 | | _TIF_SYSCALL_TRACE) | 89 | | _TIF_SYSCALL_TRACE) |
96 | 90 | ||
97 | #define ALPHA_UAC_SHIFT TIF_UAC_NOPRINT | 91 | #define TS_UAC_NOPRINT 0x0001 /* ! Preserve the following three */ |
98 | #define ALPHA_UAC_MASK (1 << TIF_UAC_NOPRINT | 1 << TIF_UAC_NOFIX | \ | 92 | #define TS_UAC_NOFIX 0x0002 /* ! flags as they match */ |
99 | 1 << TIF_UAC_SIGBUS) | 93 | #define TS_UAC_SIGBUS 0x0004 /* ! userspace part of 'osf_sysinfo' */ |
94 | #define TS_RESTORE_SIGMASK 0x0008 /* restore signal mask in do_signal() */ | ||
95 | #define TS_POLLING 0x0010 /* idle task polling need_resched, | ||
96 | skip sending interrupt */ | ||
100 | 97 | ||
101 | #define SET_UNALIGN_CTL(task,value) ({ \ | 98 | #define tsk_is_polling(t) (task_thread_info(t)->status & TS_POLLING) |
102 | task_thread_info(task)->flags = ((task_thread_info(task)->flags & \ | 99 | |
103 | ~ALPHA_UAC_MASK) \ | 100 | #ifndef __ASSEMBLY__ |
104 | | (((value) << ALPHA_UAC_SHIFT) & (1<<TIF_UAC_NOPRINT))\ | 101 | #define HAVE_SET_RESTORE_SIGMASK 1 |
105 | | (((value) << (ALPHA_UAC_SHIFT + 1)) & (1<<TIF_UAC_SIGBUS)) \ | 102 | static inline void set_restore_sigmask(void) |
106 | | (((value) << (ALPHA_UAC_SHIFT - 1)) & (1<<TIF_UAC_NOFIX)));\ | 103 | { |
104 | struct thread_info *ti = current_thread_info(); | ||
105 | ti->status |= TS_RESTORE_SIGMASK; | ||
106 | WARN_ON(!test_bit(TIF_SIGPENDING, (unsigned long *)&ti->flags)); | ||
107 | } | ||
108 | static inline void clear_restore_sigmask(void) | ||
109 | { | ||
110 | current_thread_info()->status &= ~TS_RESTORE_SIGMASK; | ||
111 | } | ||
112 | static inline bool test_restore_sigmask(void) | ||
113 | { | ||
114 | return current_thread_info()->status & TS_RESTORE_SIGMASK; | ||
115 | } | ||
116 | static inline bool test_and_clear_restore_sigmask(void) | ||
117 | { | ||
118 | struct thread_info *ti = current_thread_info(); | ||
119 | if (!(ti->status & TS_RESTORE_SIGMASK)) | ||
120 | return false; | ||
121 | ti->status &= ~TS_RESTORE_SIGMASK; | ||
122 | return true; | ||
123 | } | ||
124 | #endif | ||
125 | |||
126 | #define SET_UNALIGN_CTL(task,value) ({ \ | ||
127 | __u32 status = task_thread_info(task)->status & ~UAC_BITMASK; \ | ||
128 | if (value & PR_UNALIGN_NOPRINT) \ | ||
129 | status |= TS_UAC_NOPRINT; \ | ||
130 | if (value & PR_UNALIGN_SIGBUS) \ | ||
131 | status |= TS_UAC_SIGBUS; \ | ||
132 | if (value & 4) /* alpha-specific */ \ | ||
133 | status |= TS_UAC_NOFIX; \ | ||
134 | task_thread_info(task)->status = status; \ | ||
107 | 0; }) | 135 | 0; }) |
108 | 136 | ||
109 | #define GET_UNALIGN_CTL(task,value) ({ \ | 137 | #define GET_UNALIGN_CTL(task,value) ({ \ |
110 | put_user((task_thread_info(task)->flags & (1 << TIF_UAC_NOPRINT))\ | 138 | __u32 status = task_thread_info(task)->status & ~UAC_BITMASK; \ |
111 | >> ALPHA_UAC_SHIFT \ | 139 | __u32 res = 0; \ |
112 | | (task_thread_info(task)->flags & (1 << TIF_UAC_SIGBUS))\ | 140 | if (status & TS_UAC_NOPRINT) \ |
113 | >> (ALPHA_UAC_SHIFT + 1) \ | 141 | res |= PR_UNALIGN_NOPRINT; \ |
114 | | (task_thread_info(task)->flags & (1 << TIF_UAC_NOFIX))\ | 142 | if (status & TS_UAC_SIGBUS) \ |
115 | >> (ALPHA_UAC_SHIFT - 1), \ | 143 | res |= PR_UNALIGN_SIGBUS; \ |
116 | (int __user *)(value)); \ | 144 | if (status & TS_UAC_NOFIX) \ |
145 | res |= 4; \ | ||
146 | put_user(res, (int __user *)(value)); \ | ||
117 | }) | 147 | }) |
118 | 148 | ||
119 | #define tsk_is_polling(t) test_tsk_thread_flag(t, TIF_POLLING_NRFLAG) | ||
120 | |||
121 | #endif /* __KERNEL__ */ | 149 | #endif /* __KERNEL__ */ |
122 | #endif /* _ALPHA_THREAD_INFO_H */ | 150 | #endif /* _ALPHA_THREAD_INFO_H */ |
diff --git a/arch/alpha/kernel/osf_sys.c b/arch/alpha/kernel/osf_sys.c index 9eb090582cf1..1e6956a90608 100644 --- a/arch/alpha/kernel/osf_sys.c +++ b/arch/alpha/kernel/osf_sys.c | |||
@@ -793,8 +793,7 @@ SYSCALL_DEFINE5(osf_getsysinfo, unsigned long, op, void __user *, buffer, | |||
793 | case GSI_UACPROC: | 793 | case GSI_UACPROC: |
794 | if (nbytes < sizeof(unsigned int)) | 794 | if (nbytes < sizeof(unsigned int)) |
795 | return -EINVAL; | 795 | return -EINVAL; |
796 | w = (current_thread_info()->flags >> ALPHA_UAC_SHIFT) & | 796 | w = current_thread_info()->status & UAC_BITMASK; |
797 | UAC_BITMASK; | ||
798 | if (put_user(w, (unsigned int __user *)buffer)) | 797 | if (put_user(w, (unsigned int __user *)buffer)) |
799 | return -EFAULT; | 798 | return -EFAULT; |
800 | return 1; | 799 | return 1; |
@@ -904,24 +903,20 @@ SYSCALL_DEFINE5(osf_setsysinfo, unsigned long, op, void __user *, buffer, | |||
904 | break; | 903 | break; |
905 | 904 | ||
906 | case SSI_NVPAIRS: { | 905 | case SSI_NVPAIRS: { |
907 | unsigned long v, w, i; | 906 | unsigned __user *p = buffer; |
908 | unsigned int old, new; | 907 | unsigned i; |
909 | 908 | ||
910 | for (i = 0; i < nbytes; ++i) { | 909 | for (i = 0, p = buffer; i < nbytes; ++i, p += 2) { |
910 | unsigned v, w, status; | ||
911 | 911 | ||
912 | if (get_user(v, 2*i + (unsigned int __user *)buffer)) | 912 | if (get_user(v, p) || get_user(w, p + 1)) |
913 | return -EFAULT; | ||
914 | if (get_user(w, 2*i + 1 + (unsigned int __user *)buffer)) | ||
915 | return -EFAULT; | 913 | return -EFAULT; |
916 | switch (v) { | 914 | switch (v) { |
917 | case SSIN_UACPROC: | 915 | case SSIN_UACPROC: |
918 | again: | 916 | w &= UAC_BITMASK; |
919 | old = current_thread_info()->flags; | 917 | status = current_thread_info()->status; |
920 | new = old & ~(UAC_BITMASK << ALPHA_UAC_SHIFT); | 918 | status = (status & ~UAC_BITMASK) | w; |
921 | new = new | (w & UAC_BITMASK) << ALPHA_UAC_SHIFT; | 919 | current_thread_info()->status = status; |
922 | if (cmpxchg(¤t_thread_info()->flags, | ||
923 | old, new) != old) | ||
924 | goto again; | ||
925 | break; | 920 | break; |
926 | 921 | ||
927 | default: | 922 | default: |
diff --git a/arch/alpha/kernel/process.c b/arch/alpha/kernel/process.c index 4054e0ffe2b2..51987dcf79b8 100644 --- a/arch/alpha/kernel/process.c +++ b/arch/alpha/kernel/process.c | |||
@@ -49,7 +49,7 @@ EXPORT_SYMBOL(pm_power_off); | |||
49 | void | 49 | void |
50 | cpu_idle(void) | 50 | cpu_idle(void) |
51 | { | 51 | { |
52 | set_thread_flag(TIF_POLLING_NRFLAG); | 52 | current_thread_info()->status |= TS_POLLING; |
53 | 53 | ||
54 | while (1) { | 54 | while (1) { |
55 | /* FIXME -- EV6 and LCA45 know how to power down | 55 | /* FIXME -- EV6 and LCA45 know how to power down |
diff --git a/arch/alpha/kernel/traps.c b/arch/alpha/kernel/traps.c index 80d987c0e9aa..272666d006df 100644 --- a/arch/alpha/kernel/traps.c +++ b/arch/alpha/kernel/traps.c | |||
@@ -780,17 +780,17 @@ do_entUnaUser(void __user * va, unsigned long opcode, | |||
780 | /* Check the UAC bits to decide what the user wants us to do | 780 | /* Check the UAC bits to decide what the user wants us to do |
781 | with the unaliged access. */ | 781 | with the unaliged access. */ |
782 | 782 | ||
783 | if (!test_thread_flag (TIF_UAC_NOPRINT)) { | 783 | if (!(current_thread_info()->status & TS_UAC_NOPRINT)) { |
784 | if (__ratelimit(&ratelimit)) { | 784 | if (__ratelimit(&ratelimit)) { |
785 | printk("%s(%d): unaligned trap at %016lx: %p %lx %ld\n", | 785 | printk("%s(%d): unaligned trap at %016lx: %p %lx %ld\n", |
786 | current->comm, task_pid_nr(current), | 786 | current->comm, task_pid_nr(current), |
787 | regs->pc - 4, va, opcode, reg); | 787 | regs->pc - 4, va, opcode, reg); |
788 | } | 788 | } |
789 | } | 789 | } |
790 | if (test_thread_flag (TIF_UAC_SIGBUS)) | 790 | if ((current_thread_info()->status & TS_UAC_SIGBUS)) |
791 | goto give_sigbus; | 791 | goto give_sigbus; |
792 | /* Not sure why you'd want to use this, but... */ | 792 | /* Not sure why you'd want to use this, but... */ |
793 | if (test_thread_flag (TIF_UAC_NOFIX)) | 793 | if ((current_thread_info()->status & TS_UAC_NOFIX)) |
794 | return; | 794 | return; |
795 | 795 | ||
796 | /* Don't bother reading ds in the access check since we already | 796 | /* Don't bother reading ds in the access check since we already |
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 73067efd4845..ade7e924bef5 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig | |||
@@ -1603,8 +1603,8 @@ config NR_CPUS | |||
1603 | default "4" | 1603 | default "4" |
1604 | 1604 | ||
1605 | config HOTPLUG_CPU | 1605 | config HOTPLUG_CPU |
1606 | bool "Support for hot-pluggable CPUs (EXPERIMENTAL)" | 1606 | bool "Support for hot-pluggable CPUs" |
1607 | depends on SMP && HOTPLUG && EXPERIMENTAL | 1607 | depends on SMP && HOTPLUG |
1608 | help | 1608 | help |
1609 | Say Y here to experiment with turning CPUs off and on. CPUs | 1609 | Say Y here to experiment with turning CPUs off and on. CPUs |
1610 | can be controlled through /sys/devices/system/cpu. | 1610 | can be controlled through /sys/devices/system/cpu. |
@@ -1645,8 +1645,8 @@ config HZ | |||
1645 | default 100 | 1645 | default 100 |
1646 | 1646 | ||
1647 | config THUMB2_KERNEL | 1647 | config THUMB2_KERNEL |
1648 | bool "Compile the kernel in Thumb-2 mode (EXPERIMENTAL)" | 1648 | bool "Compile the kernel in Thumb-2 mode" |
1649 | depends on CPU_V7 && !CPU_V6 && !CPU_V6K && EXPERIMENTAL | 1649 | depends on CPU_V7 && !CPU_V6 && !CPU_V6K |
1650 | select AEABI | 1650 | select AEABI |
1651 | select ARM_ASM_UNIFIED | 1651 | select ARM_ASM_UNIFIED |
1652 | select ARM_UNWIND | 1652 | select ARM_UNWIND |
@@ -1850,6 +1850,7 @@ config XEN_DOM0 | |||
1850 | config XEN | 1850 | config XEN |
1851 | bool "Xen guest support on ARM (EXPERIMENTAL)" | 1851 | bool "Xen guest support on ARM (EXPERIMENTAL)" |
1852 | depends on EXPERIMENTAL && ARM && OF | 1852 | depends on EXPERIMENTAL && ARM && OF |
1853 | depends on CPU_V7 && !CPU_V6 | ||
1853 | help | 1854 | help |
1854 | Say Y if you want to run Linux in a Virtual Machine on Xen on ARM. | 1855 | Say Y if you want to run Linux in a Virtual Machine on Xen on ARM. |
1855 | 1856 | ||
diff --git a/arch/arm/Makefile b/arch/arm/Makefile index f023e3acdfbd..5f914fca911b 100644 --- a/arch/arm/Makefile +++ b/arch/arm/Makefile | |||
@@ -21,8 +21,6 @@ endif | |||
21 | OBJCOPYFLAGS :=-O binary -R .comment -S | 21 | OBJCOPYFLAGS :=-O binary -R .comment -S |
22 | GZFLAGS :=-9 | 22 | GZFLAGS :=-9 |
23 | #KBUILD_CFLAGS +=-pipe | 23 | #KBUILD_CFLAGS +=-pipe |
24 | # Explicitly specifiy 32-bit ARM ISA since toolchain default can be -mthumb: | ||
25 | KBUILD_CFLAGS +=$(call cc-option,-marm,) | ||
26 | 24 | ||
27 | # Never generate .eh_frame | 25 | # Never generate .eh_frame |
28 | KBUILD_CFLAGS += $(call cc-option,-fno-dwarf2-cfi-asm) | 26 | KBUILD_CFLAGS += $(call cc-option,-fno-dwarf2-cfi-asm) |
@@ -105,17 +103,20 @@ endif | |||
105 | ifeq ($(CONFIG_THUMB2_KERNEL),y) | 103 | ifeq ($(CONFIG_THUMB2_KERNEL),y) |
106 | AFLAGS_AUTOIT :=$(call as-option,-Wa$(comma)-mimplicit-it=always,-Wa$(comma)-mauto-it) | 104 | AFLAGS_AUTOIT :=$(call as-option,-Wa$(comma)-mimplicit-it=always,-Wa$(comma)-mauto-it) |
107 | AFLAGS_NOWARN :=$(call as-option,-Wa$(comma)-mno-warn-deprecated,-Wa$(comma)-W) | 105 | AFLAGS_NOWARN :=$(call as-option,-Wa$(comma)-mno-warn-deprecated,-Wa$(comma)-W) |
108 | CFLAGS_THUMB2 :=-mthumb $(AFLAGS_AUTOIT) $(AFLAGS_NOWARN) | 106 | CFLAGS_ISA :=-mthumb $(AFLAGS_AUTOIT) $(AFLAGS_NOWARN) |
109 | AFLAGS_THUMB2 :=$(CFLAGS_THUMB2) -Wa$(comma)-mthumb | 107 | AFLAGS_ISA :=$(CFLAGS_ISA) -Wa$(comma)-mthumb |
110 | # Work around buggy relocation from gas if requested: | 108 | # Work around buggy relocation from gas if requested: |
111 | ifeq ($(CONFIG_THUMB2_AVOID_R_ARM_THM_JUMP11),y) | 109 | ifeq ($(CONFIG_THUMB2_AVOID_R_ARM_THM_JUMP11),y) |
112 | CFLAGS_MODULE +=-fno-optimize-sibling-calls | 110 | CFLAGS_MODULE +=-fno-optimize-sibling-calls |
113 | endif | 111 | endif |
112 | else | ||
113 | CFLAGS_ISA :=$(call cc-option,-marm,) | ||
114 | AFLAGS_ISA :=$(CFLAGS_ISA) | ||
114 | endif | 115 | endif |
115 | 116 | ||
116 | # Need -Uarm for gcc < 3.x | 117 | # Need -Uarm for gcc < 3.x |
117 | KBUILD_CFLAGS +=$(CFLAGS_ABI) $(CFLAGS_THUMB2) $(arch-y) $(tune-y) $(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,)) -msoft-float -Uarm | 118 | KBUILD_CFLAGS +=$(CFLAGS_ABI) $(CFLAGS_ISA) $(arch-y) $(tune-y) $(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,)) -msoft-float -Uarm |
118 | KBUILD_AFLAGS +=$(CFLAGS_ABI) $(AFLAGS_THUMB2) $(arch-y) $(tune-y) -include asm/unified.h -msoft-float | 119 | KBUILD_AFLAGS +=$(CFLAGS_ABI) $(AFLAGS_ISA) $(arch-y) $(tune-y) -include asm/unified.h -msoft-float |
119 | 120 | ||
120 | CHECKFLAGS += -D__arm__ | 121 | CHECKFLAGS += -D__arm__ |
121 | 122 | ||
diff --git a/arch/arm/boot/Makefile b/arch/arm/boot/Makefile index 3fdab016aa5c..f2aa09eb658e 100644 --- a/arch/arm/boot/Makefile +++ b/arch/arm/boot/Makefile | |||
@@ -33,7 +33,7 @@ ifeq ($(CONFIG_XIP_KERNEL),y) | |||
33 | 33 | ||
34 | $(obj)/xipImage: vmlinux FORCE | 34 | $(obj)/xipImage: vmlinux FORCE |
35 | $(call if_changed,objcopy) | 35 | $(call if_changed,objcopy) |
36 | @echo ' Kernel: $@ is ready (physical address: $(CONFIG_XIP_PHYS_ADDR))' | 36 | $(kecho) ' Kernel: $@ is ready (physical address: $(CONFIG_XIP_PHYS_ADDR))' |
37 | 37 | ||
38 | $(obj)/Image $(obj)/zImage: FORCE | 38 | $(obj)/Image $(obj)/zImage: FORCE |
39 | @echo 'Kernel configured for XIP (CONFIG_XIP_KERNEL=y)' | 39 | @echo 'Kernel configured for XIP (CONFIG_XIP_KERNEL=y)' |
@@ -48,14 +48,14 @@ $(obj)/xipImage: FORCE | |||
48 | 48 | ||
49 | $(obj)/Image: vmlinux FORCE | 49 | $(obj)/Image: vmlinux FORCE |
50 | $(call if_changed,objcopy) | 50 | $(call if_changed,objcopy) |
51 | @echo ' Kernel: $@ is ready' | 51 | $(kecho) ' Kernel: $@ is ready' |
52 | 52 | ||
53 | $(obj)/compressed/vmlinux: $(obj)/Image FORCE | 53 | $(obj)/compressed/vmlinux: $(obj)/Image FORCE |
54 | $(Q)$(MAKE) $(build)=$(obj)/compressed $@ | 54 | $(Q)$(MAKE) $(build)=$(obj)/compressed $@ |
55 | 55 | ||
56 | $(obj)/zImage: $(obj)/compressed/vmlinux FORCE | 56 | $(obj)/zImage: $(obj)/compressed/vmlinux FORCE |
57 | $(call if_changed,objcopy) | 57 | $(call if_changed,objcopy) |
58 | @echo ' Kernel: $@ is ready' | 58 | $(kecho) ' Kernel: $@ is ready' |
59 | 59 | ||
60 | endif | 60 | endif |
61 | 61 | ||
@@ -90,7 +90,7 @@ fi | |||
90 | $(obj)/uImage: $(obj)/zImage FORCE | 90 | $(obj)/uImage: $(obj)/zImage FORCE |
91 | @$(check_for_multiple_loadaddr) | 91 | @$(check_for_multiple_loadaddr) |
92 | $(call if_changed,uimage) | 92 | $(call if_changed,uimage) |
93 | @echo ' Image $@ is ready' | 93 | $(kecho) ' Image $@ is ready' |
94 | 94 | ||
95 | $(obj)/bootp/bootp: $(obj)/zImage initrd FORCE | 95 | $(obj)/bootp/bootp: $(obj)/zImage initrd FORCE |
96 | $(Q)$(MAKE) $(build)=$(obj)/bootp $@ | 96 | $(Q)$(MAKE) $(build)=$(obj)/bootp $@ |
@@ -98,7 +98,7 @@ $(obj)/bootp/bootp: $(obj)/zImage initrd FORCE | |||
98 | 98 | ||
99 | $(obj)/bootpImage: $(obj)/bootp/bootp FORCE | 99 | $(obj)/bootpImage: $(obj)/bootp/bootp FORCE |
100 | $(call if_changed,objcopy) | 100 | $(call if_changed,objcopy) |
101 | @echo ' Kernel: $@ is ready' | 101 | $(kecho) ' Kernel: $@ is ready' |
102 | 102 | ||
103 | PHONY += initrd FORCE | 103 | PHONY += initrd FORCE |
104 | initrd: | 104 | initrd: |
diff --git a/arch/arm/boot/dts/at91sam9g20ek_common.dtsi b/arch/arm/boot/dts/at91sam9g20ek_common.dtsi index b06c0db273b1..e6391a4e6649 100644 --- a/arch/arm/boot/dts/at91sam9g20ek_common.dtsi +++ b/arch/arm/boot/dts/at91sam9g20ek_common.dtsi | |||
@@ -126,14 +126,14 @@ | |||
126 | #size-cells = <0>; | 126 | #size-cells = <0>; |
127 | 127 | ||
128 | btn3 { | 128 | btn3 { |
129 | label = "Buttin 3"; | 129 | label = "Button 3"; |
130 | gpios = <&pioA 30 1>; | 130 | gpios = <&pioA 30 1>; |
131 | linux,code = <0x103>; | 131 | linux,code = <0x103>; |
132 | gpio-key,wakeup; | 132 | gpio-key,wakeup; |
133 | }; | 133 | }; |
134 | 134 | ||
135 | btn4 { | 135 | btn4 { |
136 | label = "Buttin 4"; | 136 | label = "Button 4"; |
137 | gpios = <&pioA 31 1>; | 137 | gpios = <&pioA 31 1>; |
138 | linux,code = <0x104>; | 138 | linux,code = <0x104>; |
139 | gpio-key,wakeup; | 139 | gpio-key,wakeup; |
diff --git a/arch/arm/boot/dts/dbx5x0.dtsi b/arch/arm/boot/dts/dbx5x0.dtsi index 748ba7aa746c..4b0e0ca08f40 100644 --- a/arch/arm/boot/dts/dbx5x0.dtsi +++ b/arch/arm/boot/dts/dbx5x0.dtsi | |||
@@ -483,6 +483,8 @@ | |||
483 | compatible = "stericsson,db8500-i2c", "st,nomadik-i2c", "arm,primecell"; | 483 | compatible = "stericsson,db8500-i2c", "st,nomadik-i2c", "arm,primecell"; |
484 | reg = <0x80004000 0x1000>; | 484 | reg = <0x80004000 0x1000>; |
485 | interrupts = <0 21 0x4>; | 485 | interrupts = <0 21 0x4>; |
486 | arm,primecell-periphid = <0x180024>; | ||
487 | |||
486 | #address-cells = <1>; | 488 | #address-cells = <1>; |
487 | #size-cells = <0>; | 489 | #size-cells = <0>; |
488 | v-i2c-supply = <&db8500_vape_reg>; | 490 | v-i2c-supply = <&db8500_vape_reg>; |
@@ -494,6 +496,8 @@ | |||
494 | compatible = "stericsson,db8500-i2c", "st,nomadik-i2c", "arm,primecell"; | 496 | compatible = "stericsson,db8500-i2c", "st,nomadik-i2c", "arm,primecell"; |
495 | reg = <0x80122000 0x1000>; | 497 | reg = <0x80122000 0x1000>; |
496 | interrupts = <0 22 0x4>; | 498 | interrupts = <0 22 0x4>; |
499 | arm,primecell-periphid = <0x180024>; | ||
500 | |||
497 | #address-cells = <1>; | 501 | #address-cells = <1>; |
498 | #size-cells = <0>; | 502 | #size-cells = <0>; |
499 | v-i2c-supply = <&db8500_vape_reg>; | 503 | v-i2c-supply = <&db8500_vape_reg>; |
@@ -505,6 +509,8 @@ | |||
505 | compatible = "stericsson,db8500-i2c", "st,nomadik-i2c", "arm,primecell"; | 509 | compatible = "stericsson,db8500-i2c", "st,nomadik-i2c", "arm,primecell"; |
506 | reg = <0x80128000 0x1000>; | 510 | reg = <0x80128000 0x1000>; |
507 | interrupts = <0 55 0x4>; | 511 | interrupts = <0 55 0x4>; |
512 | arm,primecell-periphid = <0x180024>; | ||
513 | |||
508 | #address-cells = <1>; | 514 | #address-cells = <1>; |
509 | #size-cells = <0>; | 515 | #size-cells = <0>; |
510 | v-i2c-supply = <&db8500_vape_reg>; | 516 | v-i2c-supply = <&db8500_vape_reg>; |
@@ -516,6 +522,8 @@ | |||
516 | compatible = "stericsson,db8500-i2c", "st,nomadik-i2c", "arm,primecell"; | 522 | compatible = "stericsson,db8500-i2c", "st,nomadik-i2c", "arm,primecell"; |
517 | reg = <0x80110000 0x1000>; | 523 | reg = <0x80110000 0x1000>; |
518 | interrupts = <0 12 0x4>; | 524 | interrupts = <0 12 0x4>; |
525 | arm,primecell-periphid = <0x180024>; | ||
526 | |||
519 | #address-cells = <1>; | 527 | #address-cells = <1>; |
520 | #size-cells = <0>; | 528 | #size-cells = <0>; |
521 | v-i2c-supply = <&db8500_vape_reg>; | 529 | v-i2c-supply = <&db8500_vape_reg>; |
@@ -527,6 +535,8 @@ | |||
527 | compatible = "stericsson,db8500-i2c", "st,nomadik-i2c", "arm,primecell"; | 535 | compatible = "stericsson,db8500-i2c", "st,nomadik-i2c", "arm,primecell"; |
528 | reg = <0x8012a000 0x1000>; | 536 | reg = <0x8012a000 0x1000>; |
529 | interrupts = <0 51 0x4>; | 537 | interrupts = <0 51 0x4>; |
538 | arm,primecell-periphid = <0x180024>; | ||
539 | |||
530 | #address-cells = <1>; | 540 | #address-cells = <1>; |
531 | #size-cells = <0>; | 541 | #size-cells = <0>; |
532 | v-i2c-supply = <&db8500_vape_reg>; | 542 | v-i2c-supply = <&db8500_vape_reg>; |
@@ -573,33 +583,38 @@ | |||
573 | interrupts = <0 60 0x4>; | 583 | interrupts = <0 60 0x4>; |
574 | status = "disabled"; | 584 | status = "disabled"; |
575 | }; | 585 | }; |
586 | |||
576 | sdi@80118000 { | 587 | sdi@80118000 { |
577 | compatible = "arm,pl18x", "arm,primecell"; | 588 | compatible = "arm,pl18x", "arm,primecell"; |
578 | reg = <0x80118000 0x1000>; | 589 | reg = <0x80118000 0x1000>; |
579 | interrupts = <0 50 0x4>; | 590 | interrupts = <0 50 0x4>; |
580 | status = "disabled"; | 591 | status = "disabled"; |
581 | }; | 592 | }; |
593 | |||
582 | sdi@80005000 { | 594 | sdi@80005000 { |
583 | compatible = "arm,pl18x", "arm,primecell"; | 595 | compatible = "arm,pl18x", "arm,primecell"; |
584 | reg = <0x80005000 0x1000>; | 596 | reg = <0x80005000 0x1000>; |
585 | interrupts = <0 41 0x4>; | 597 | interrupts = <0 41 0x4>; |
586 | status = "disabled"; | 598 | status = "disabled"; |
587 | }; | 599 | }; |
600 | |||
588 | sdi@80119000 { | 601 | sdi@80119000 { |
589 | compatible = "arm,pl18x", "arm,primecell"; | 602 | compatible = "arm,pl18x", "arm,primecell"; |
590 | reg = <0x80119000 0x1000>; | 603 | reg = <0x80119000 0x1000>; |
591 | interrupts = <0 59 0x4>; | 604 | interrupts = <0 59 0x4>; |
592 | status = "disabled"; | 605 | status = "disabled"; |
593 | }; | 606 | }; |
607 | |||
594 | sdi@80114000 { | 608 | sdi@80114000 { |
595 | compatible = "arm,pl18x", "arm,primecell"; | 609 | compatible = "arm,pl18x", "arm,primecell"; |
596 | reg = <0x80114000 0x1000>; | 610 | reg = <0x80114000 0x1000>; |
597 | interrupts = <0 99 0x4>; | 611 | interrupts = <0 99 0x4>; |
598 | status = "disabled"; | 612 | status = "disabled"; |
599 | }; | 613 | }; |
614 | |||
600 | sdi@80008000 { | 615 | sdi@80008000 { |
601 | compatible = "arm,pl18x", "arm,primecell"; | 616 | compatible = "arm,pl18x", "arm,primecell"; |
602 | reg = <0x80114000 0x1000>; | 617 | reg = <0x80008000 0x1000>; |
603 | interrupts = <0 100 0x4>; | 618 | interrupts = <0 100 0x4>; |
604 | status = "disabled"; | 619 | status = "disabled"; |
605 | }; | 620 | }; |
diff --git a/arch/arm/boot/dts/exynos4210-trats.dts b/arch/arm/boot/dts/exynos4210-trats.dts index 73567b843e72..a21511c14071 100644 --- a/arch/arm/boot/dts/exynos4210-trats.dts +++ b/arch/arm/boot/dts/exynos4210-trats.dts | |||
@@ -20,8 +20,10 @@ | |||
20 | compatible = "samsung,trats", "samsung,exynos4210"; | 20 | compatible = "samsung,trats", "samsung,exynos4210"; |
21 | 21 | ||
22 | memory { | 22 | memory { |
23 | reg = <0x40000000 0x20000000 | 23 | reg = <0x40000000 0x10000000 |
24 | 0x60000000 0x20000000>; | 24 | 0x50000000 0x10000000 |
25 | 0x60000000 0x10000000 | ||
26 | 0x70000000 0x10000000>; | ||
25 | }; | 27 | }; |
26 | 28 | ||
27 | chosen { | 29 | chosen { |
diff --git a/arch/arm/boot/dts/imx23.dtsi b/arch/arm/boot/dts/imx23.dtsi index 9ca4ca70c1bc..6d31aa383460 100644 --- a/arch/arm/boot/dts/imx23.dtsi +++ b/arch/arm/boot/dts/imx23.dtsi | |||
@@ -69,6 +69,7 @@ | |||
69 | interrupts = <13>, <56>; | 69 | interrupts = <13>, <56>; |
70 | interrupt-names = "gpmi-dma", "bch"; | 70 | interrupt-names = "gpmi-dma", "bch"; |
71 | clocks = <&clks 34>; | 71 | clocks = <&clks 34>; |
72 | clock-names = "gpmi_io"; | ||
72 | fsl,gpmi-dma-channel = <4>; | 73 | fsl,gpmi-dma-channel = <4>; |
73 | status = "disabled"; | 74 | status = "disabled"; |
74 | }; | 75 | }; |
diff --git a/arch/arm/boot/dts/imx28.dtsi b/arch/arm/boot/dts/imx28.dtsi index e16d63155480..55c57ea6169e 100644 --- a/arch/arm/boot/dts/imx28.dtsi +++ b/arch/arm/boot/dts/imx28.dtsi | |||
@@ -85,6 +85,7 @@ | |||
85 | interrupts = <88>, <41>; | 85 | interrupts = <88>, <41>; |
86 | interrupt-names = "gpmi-dma", "bch"; | 86 | interrupt-names = "gpmi-dma", "bch"; |
87 | clocks = <&clks 50>; | 87 | clocks = <&clks 50>; |
88 | clock-names = "gpmi_io"; | ||
88 | fsl,gpmi-dma-channel = <4>; | 89 | fsl,gpmi-dma-channel = <4>; |
89 | status = "disabled"; | 90 | status = "disabled"; |
90 | }; | 91 | }; |
diff --git a/arch/arm/boot/dts/omap3.dtsi b/arch/arm/boot/dts/omap3.dtsi index f38ea8771b44..696e929d0304 100644 --- a/arch/arm/boot/dts/omap3.dtsi +++ b/arch/arm/boot/dts/omap3.dtsi | |||
@@ -257,7 +257,7 @@ | |||
257 | interrupt-names = "common", "tx", "rx", "sidetone"; | 257 | interrupt-names = "common", "tx", "rx", "sidetone"; |
258 | interrupt-parent = <&intc>; | 258 | interrupt-parent = <&intc>; |
259 | ti,buffer-size = <1280>; | 259 | ti,buffer-size = <1280>; |
260 | ti,hwmods = "mcbsp2"; | 260 | ti,hwmods = "mcbsp2", "mcbsp2_sidetone"; |
261 | }; | 261 | }; |
262 | 262 | ||
263 | mcbsp3: mcbsp@49024000 { | 263 | mcbsp3: mcbsp@49024000 { |
@@ -272,7 +272,7 @@ | |||
272 | interrupt-names = "common", "tx", "rx", "sidetone"; | 272 | interrupt-names = "common", "tx", "rx", "sidetone"; |
273 | interrupt-parent = <&intc>; | 273 | interrupt-parent = <&intc>; |
274 | ti,buffer-size = <128>; | 274 | ti,buffer-size = <128>; |
275 | ti,hwmods = "mcbsp3"; | 275 | ti,hwmods = "mcbsp3", "mcbsp3_sidetone"; |
276 | }; | 276 | }; |
277 | 277 | ||
278 | mcbsp4: mcbsp@49026000 { | 278 | mcbsp4: mcbsp@49026000 { |
diff --git a/arch/arm/configs/imx_v6_v7_defconfig b/arch/arm/configs/imx_v6_v7_defconfig index 66aa7a6db884..394ded624e37 100644 --- a/arch/arm/configs/imx_v6_v7_defconfig +++ b/arch/arm/configs/imx_v6_v7_defconfig | |||
@@ -139,6 +139,7 @@ CONFIG_I2C_IMX=y | |||
139 | CONFIG_SPI=y | 139 | CONFIG_SPI=y |
140 | CONFIG_SPI_IMX=y | 140 | CONFIG_SPI_IMX=y |
141 | CONFIG_GPIO_SYSFS=y | 141 | CONFIG_GPIO_SYSFS=y |
142 | CONFIG_GPIO_MC9S08DZ60=y | ||
142 | # CONFIG_HWMON is not set | 143 | # CONFIG_HWMON is not set |
143 | CONFIG_WATCHDOG=y | 144 | CONFIG_WATCHDOG=y |
144 | CONFIG_IMX2_WDT=y | 145 | CONFIG_IMX2_WDT=y |
@@ -155,6 +156,7 @@ CONFIG_SOC_CAMERA=y | |||
155 | CONFIG_SOC_CAMERA_OV2640=y | 156 | CONFIG_SOC_CAMERA_OV2640=y |
156 | CONFIG_VIDEO_MX3=y | 157 | CONFIG_VIDEO_MX3=y |
157 | CONFIG_FB=y | 158 | CONFIG_FB=y |
159 | CONFIG_LCD_PLATFORM=y | ||
158 | CONFIG_BACKLIGHT_LCD_SUPPORT=y | 160 | CONFIG_BACKLIGHT_LCD_SUPPORT=y |
159 | CONFIG_LCD_CLASS_DEVICE=y | 161 | CONFIG_LCD_CLASS_DEVICE=y |
160 | CONFIG_LCD_L4F00242T03=y | 162 | CONFIG_LCD_L4F00242T03=y |
diff --git a/arch/arm/configs/mvebu_defconfig b/arch/arm/configs/mvebu_defconfig index 7bcf850eddcd..3458752c4bb2 100644 --- a/arch/arm/configs/mvebu_defconfig +++ b/arch/arm/configs/mvebu_defconfig | |||
@@ -1,6 +1,6 @@ | |||
1 | CONFIG_EXPERIMENTAL=y | 1 | CONFIG_EXPERIMENTAL=y |
2 | CONFIG_SYSVIPC=y | 2 | CONFIG_SYSVIPC=y |
3 | CONFIG_NO_HZ=y | 3 | CONFIG_IRQ_DOMAIN_DEBUG=y |
4 | CONFIG_HIGH_RES_TIMERS=y | 4 | CONFIG_HIGH_RES_TIMERS=y |
5 | CONFIG_LOG_BUF_SHIFT=14 | 5 | CONFIG_LOG_BUF_SHIFT=14 |
6 | CONFIG_BLK_DEV_INITRD=y | 6 | CONFIG_BLK_DEV_INITRD=y |
@@ -9,10 +9,12 @@ CONFIG_SLAB=y | |||
9 | CONFIG_MODULES=y | 9 | CONFIG_MODULES=y |
10 | CONFIG_MODULE_UNLOAD=y | 10 | CONFIG_MODULE_UNLOAD=y |
11 | CONFIG_ARCH_MVEBU=y | 11 | CONFIG_ARCH_MVEBU=y |
12 | CONFIG_MACH_ARMADA_370_XP=y | 12 | CONFIG_MACH_ARMADA_370=y |
13 | CONFIG_MACH_ARMADA_XP=y | ||
14 | # CONFIG_CACHE_L2X0 is not set | ||
13 | CONFIG_AEABI=y | 15 | CONFIG_AEABI=y |
14 | CONFIG_HIGHMEM=y | 16 | CONFIG_HIGHMEM=y |
15 | CONFIG_USE_OF=y | 17 | # CONFIG_COMPACTION is not set |
16 | CONFIG_ZBOOT_ROM_TEXT=0x0 | 18 | CONFIG_ZBOOT_ROM_TEXT=0x0 |
17 | CONFIG_ZBOOT_ROM_BSS=0x0 | 19 | CONFIG_ZBOOT_ROM_BSS=0x0 |
18 | CONFIG_ARM_APPENDED_DTB=y | 20 | CONFIG_ARM_APPENDED_DTB=y |
@@ -23,6 +25,8 @@ CONFIG_SERIAL_8250_CONSOLE=y | |||
23 | CONFIG_SERIAL_OF_PLATFORM=y | 25 | CONFIG_SERIAL_OF_PLATFORM=y |
24 | CONFIG_GPIOLIB=y | 26 | CONFIG_GPIOLIB=y |
25 | CONFIG_GPIO_SYSFS=y | 27 | CONFIG_GPIO_SYSFS=y |
28 | # CONFIG_USB_SUPPORT is not set | ||
29 | # CONFIG_IOMMU_SUPPORT is not set | ||
26 | CONFIG_EXT2_FS=y | 30 | CONFIG_EXT2_FS=y |
27 | CONFIG_EXT3_FS=y | 31 | CONFIG_EXT3_FS=y |
28 | # CONFIG_EXT3_FS_XATTR is not set | 32 | # CONFIG_EXT3_FS_XATTR is not set |
diff --git a/arch/arm/configs/versatile_defconfig b/arch/arm/configs/versatile_defconfig index cdd4d2bd3962..2ba9e63d0f17 100644 --- a/arch/arm/configs/versatile_defconfig +++ b/arch/arm/configs/versatile_defconfig | |||
@@ -1,3 +1,4 @@ | |||
1 | CONFIG_ARCH_VERSATILE=y | ||
1 | CONFIG_EXPERIMENTAL=y | 2 | CONFIG_EXPERIMENTAL=y |
2 | # CONFIG_LOCALVERSION_AUTO is not set | 3 | # CONFIG_LOCALVERSION_AUTO is not set |
3 | CONFIG_SYSVIPC=y | 4 | CONFIG_SYSVIPC=y |
diff --git a/arch/arm/include/asm/flat.h b/arch/arm/include/asm/flat.h index 59426a4595c9..e847d23351ed 100644 --- a/arch/arm/include/asm/flat.h +++ b/arch/arm/include/asm/flat.h | |||
@@ -8,7 +8,7 @@ | |||
8 | #define flat_argvp_envp_on_stack() 1 | 8 | #define flat_argvp_envp_on_stack() 1 |
9 | #define flat_old_ram_flag(flags) (flags) | 9 | #define flat_old_ram_flag(flags) (flags) |
10 | #define flat_reloc_valid(reloc, size) ((reloc) <= (size)) | 10 | #define flat_reloc_valid(reloc, size) ((reloc) <= (size)) |
11 | #define flat_get_addr_from_rp(rp, relval, flags, persistent) get_unaligned(rp) | 11 | #define flat_get_addr_from_rp(rp, relval, flags, persistent) ((void)persistent,get_unaligned(rp)) |
12 | #define flat_put_addr_at_rp(rp, val, relval) put_unaligned(val,rp) | 12 | #define flat_put_addr_at_rp(rp, val, relval) put_unaligned(val,rp) |
13 | #define flat_get_relocate_addr(rel) (rel) | 13 | #define flat_get_relocate_addr(rel) (rel) |
14 | #define flat_set_persistent(relval, p) 0 | 14 | #define flat_set_persistent(relval, p) 0 |
diff --git a/arch/arm/include/asm/uaccess.h b/arch/arm/include/asm/uaccess.h index 77bd79f2ffdb..7e1f76027f66 100644 --- a/arch/arm/include/asm/uaccess.h +++ b/arch/arm/include/asm/uaccess.h | |||
@@ -200,8 +200,8 @@ extern int __put_user_8(void *, unsigned long long); | |||
200 | #define USER_DS KERNEL_DS | 200 | #define USER_DS KERNEL_DS |
201 | 201 | ||
202 | #define segment_eq(a,b) (1) | 202 | #define segment_eq(a,b) (1) |
203 | #define __addr_ok(addr) (1) | 203 | #define __addr_ok(addr) ((void)(addr),1) |
204 | #define __range_ok(addr,size) (0) | 204 | #define __range_ok(addr,size) ((void)(addr),0) |
205 | #define get_fs() (KERNEL_DS) | 205 | #define get_fs() (KERNEL_DS) |
206 | 206 | ||
207 | static inline void set_fs(mm_segment_t fs) | 207 | static inline void set_fs(mm_segment_t fs) |
diff --git a/arch/arm/include/asm/xen/interface.h b/arch/arm/include/asm/xen/interface.h index ae05e56dd17d..5000397134b4 100644 --- a/arch/arm/include/asm/xen/interface.h +++ b/arch/arm/include/asm/xen/interface.h | |||
@@ -29,16 +29,22 @@ | |||
29 | 29 | ||
30 | #ifndef __ASSEMBLY__ | 30 | #ifndef __ASSEMBLY__ |
31 | /* Explicitly size integers that represent pfns in the interface with | 31 | /* Explicitly size integers that represent pfns in the interface with |
32 | * Xen so that we can have one ABI that works for 32 and 64 bit guests. */ | 32 | * Xen so that we can have one ABI that works for 32 and 64 bit guests. |
33 | * Note that this means that the xen_pfn_t type may be capable of | ||
34 | * representing pfn's which the guest cannot represent in its own pfn | ||
35 | * type. However since pfn space is controlled by the guest this is | ||
36 | * fine since it simply wouldn't be able to create any sure pfns in | ||
37 | * the first place. | ||
38 | */ | ||
33 | typedef uint64_t xen_pfn_t; | 39 | typedef uint64_t xen_pfn_t; |
40 | #define PRI_xen_pfn "llx" | ||
34 | typedef uint64_t xen_ulong_t; | 41 | typedef uint64_t xen_ulong_t; |
42 | #define PRI_xen_ulong "llx" | ||
35 | /* Guest handles for primitive C types. */ | 43 | /* Guest handles for primitive C types. */ |
36 | __DEFINE_GUEST_HANDLE(uchar, unsigned char); | 44 | __DEFINE_GUEST_HANDLE(uchar, unsigned char); |
37 | __DEFINE_GUEST_HANDLE(uint, unsigned int); | 45 | __DEFINE_GUEST_HANDLE(uint, unsigned int); |
38 | __DEFINE_GUEST_HANDLE(ulong, unsigned long); | ||
39 | DEFINE_GUEST_HANDLE(char); | 46 | DEFINE_GUEST_HANDLE(char); |
40 | DEFINE_GUEST_HANDLE(int); | 47 | DEFINE_GUEST_HANDLE(int); |
41 | DEFINE_GUEST_HANDLE(long); | ||
42 | DEFINE_GUEST_HANDLE(void); | 48 | DEFINE_GUEST_HANDLE(void); |
43 | DEFINE_GUEST_HANDLE(uint64_t); | 49 | DEFINE_GUEST_HANDLE(uint64_t); |
44 | DEFINE_GUEST_HANDLE(uint32_t); | 50 | DEFINE_GUEST_HANDLE(uint32_t); |
diff --git a/arch/arm/include/asm/xen/page.h b/arch/arm/include/asm/xen/page.h index 174202318dff..c6b9096cef95 100644 --- a/arch/arm/include/asm/xen/page.h +++ b/arch/arm/include/asm/xen/page.h | |||
@@ -10,7 +10,7 @@ | |||
10 | #include <xen/interface/grant_table.h> | 10 | #include <xen/interface/grant_table.h> |
11 | 11 | ||
12 | #define pfn_to_mfn(pfn) (pfn) | 12 | #define pfn_to_mfn(pfn) (pfn) |
13 | #define phys_to_machine_mapping_valid (1) | 13 | #define phys_to_machine_mapping_valid(pfn) (1) |
14 | #define mfn_to_pfn(mfn) (mfn) | 14 | #define mfn_to_pfn(mfn) (mfn) |
15 | #define mfn_to_virt(m) (__va(mfn_to_pfn(m) << PAGE_SHIFT)) | 15 | #define mfn_to_virt(m) (__va(mfn_to_pfn(m) << PAGE_SHIFT)) |
16 | 16 | ||
@@ -30,6 +30,8 @@ typedef struct xpaddr { | |||
30 | #define XMADDR(x) ((xmaddr_t) { .maddr = (x) }) | 30 | #define XMADDR(x) ((xmaddr_t) { .maddr = (x) }) |
31 | #define XPADDR(x) ((xpaddr_t) { .paddr = (x) }) | 31 | #define XPADDR(x) ((xpaddr_t) { .paddr = (x) }) |
32 | 32 | ||
33 | #define INVALID_P2M_ENTRY (~0UL) | ||
34 | |||
33 | static inline xmaddr_t phys_to_machine(xpaddr_t phys) | 35 | static inline xmaddr_t phys_to_machine(xpaddr_t phys) |
34 | { | 36 | { |
35 | unsigned offset = phys.paddr & ~PAGE_MASK; | 37 | unsigned offset = phys.paddr & ~PAGE_MASK; |
@@ -74,9 +76,14 @@ static inline int m2p_remove_override(struct page *page, bool clear_pte) | |||
74 | return 0; | 76 | return 0; |
75 | } | 77 | } |
76 | 78 | ||
79 | static inline bool __set_phys_to_machine(unsigned long pfn, unsigned long mfn) | ||
80 | { | ||
81 | BUG_ON(pfn != mfn && mfn != INVALID_P2M_ENTRY); | ||
82 | return true; | ||
83 | } | ||
84 | |||
77 | static inline bool set_phys_to_machine(unsigned long pfn, unsigned long mfn) | 85 | static inline bool set_phys_to_machine(unsigned long pfn, unsigned long mfn) |
78 | { | 86 | { |
79 | BUG(); | 87 | return __set_phys_to_machine(pfn, mfn); |
80 | return false; | ||
81 | } | 88 | } |
82 | #endif /* _ASM_ARM_XEN_PAGE_H */ | 89 | #endif /* _ASM_ARM_XEN_PAGE_H */ |
diff --git a/arch/arm/include/debug/8250_32.S b/arch/arm/include/debug/8250_32.S new file mode 100644 index 000000000000..8db01eeabbb4 --- /dev/null +++ b/arch/arm/include/debug/8250_32.S | |||
@@ -0,0 +1,27 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2011 Picochip Ltd., Jamie Iles | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License version 2 as | ||
6 | * published by the Free Software Foundation. | ||
7 | * | ||
8 | * Derived from arch/arm/mach-davinci/include/mach/debug-macro.S to use 32-bit | ||
9 | * accesses to the 8250. | ||
10 | */ | ||
11 | |||
12 | #include <linux/serial_reg.h> | ||
13 | |||
14 | .macro senduart,rd,rx | ||
15 | str \rd, [\rx, #UART_TX << UART_SHIFT] | ||
16 | .endm | ||
17 | |||
18 | .macro busyuart,rd,rx | ||
19 | 1002: ldr \rd, [\rx, #UART_LSR << UART_SHIFT] | ||
20 | and \rd, \rd, #UART_LSR_TEMT | UART_LSR_THRE | ||
21 | teq \rd, #UART_LSR_TEMT | UART_LSR_THRE | ||
22 | bne 1002b | ||
23 | .endm | ||
24 | |||
25 | /* The UART's don't have any flow control IO's wired up. */ | ||
26 | .macro waituart,rd,rx | ||
27 | .endm | ||
diff --git a/arch/arm/include/debug/picoxcell.S b/arch/arm/include/debug/picoxcell.S index 7419deb1b948..bc1f07c49cd4 100644 --- a/arch/arm/include/debug/picoxcell.S +++ b/arch/arm/include/debug/picoxcell.S | |||
@@ -5,10 +5,7 @@ | |||
5 | * it under the terms of the GNU General Public License version 2 as | 5 | * it under the terms of the GNU General Public License version 2 as |
6 | * published by the Free Software Foundation. | 6 | * published by the Free Software Foundation. |
7 | * | 7 | * |
8 | * Derived from arch/arm/mach-davinci/include/mach/debug-macro.S to use 32-bit | ||
9 | * accesses to the 8250. | ||
10 | */ | 8 | */ |
11 | #include <linux/serial_reg.h> | ||
12 | 9 | ||
13 | #define UART_SHIFT 2 | 10 | #define UART_SHIFT 2 |
14 | #define PICOXCELL_UART1_BASE 0x80230000 | 11 | #define PICOXCELL_UART1_BASE 0x80230000 |
@@ -19,17 +16,4 @@ | |||
19 | ldr \rp, =PICOXCELL_UART1_BASE | 16 | ldr \rp, =PICOXCELL_UART1_BASE |
20 | .endm | 17 | .endm |
21 | 18 | ||
22 | .macro senduart,rd,rx | 19 | #include "8250_32.S" |
23 | str \rd, [\rx, #UART_TX << UART_SHIFT] | ||
24 | .endm | ||
25 | |||
26 | .macro busyuart,rd,rx | ||
27 | 1002: ldr \rd, [\rx, #UART_LSR << UART_SHIFT] | ||
28 | and \rd, \rd, #UART_LSR_TEMT | UART_LSR_THRE | ||
29 | teq \rd, #UART_LSR_TEMT | UART_LSR_THRE | ||
30 | bne 1002b | ||
31 | .endm | ||
32 | |||
33 | /* The UART's don't have any flow control IO's wired up. */ | ||
34 | .macro waituart,rd,rx | ||
35 | .endm | ||
diff --git a/arch/arm/include/debug/socfpga.S b/arch/arm/include/debug/socfpga.S index d6f26d23374f..966b2f994946 100644 --- a/arch/arm/include/debug/socfpga.S +++ b/arch/arm/include/debug/socfpga.S | |||
@@ -7,6 +7,9 @@ | |||
7 | * published by the Free Software Foundation. | 7 | * published by the Free Software Foundation. |
8 | */ | 8 | */ |
9 | 9 | ||
10 | #define UART_SHIFT 2 | ||
11 | #define DEBUG_LL_UART_OFFSET 0x00002000 | ||
12 | |||
10 | .macro addruart, rp, rv, tmp | 13 | .macro addruart, rp, rv, tmp |
11 | mov \rp, #DEBUG_LL_UART_OFFSET | 14 | mov \rp, #DEBUG_LL_UART_OFFSET |
12 | orr \rp, \rp, #0x00c00000 | 15 | orr \rp, \rp, #0x00c00000 |
@@ -14,3 +17,5 @@ | |||
14 | orr \rp, \rp, #0xff000000 @ physical base | 17 | orr \rp, \rp, #0xff000000 @ physical base |
15 | .endm | 18 | .endm |
16 | 19 | ||
20 | #include "8250_32.S" | ||
21 | |||
diff --git a/arch/arm/kernel/irq.c b/arch/arm/kernel/irq.c index 16cedb42c0c3..896165096d6a 100644 --- a/arch/arm/kernel/irq.c +++ b/arch/arm/kernel/irq.c | |||
@@ -34,6 +34,7 @@ | |||
34 | #include <linux/list.h> | 34 | #include <linux/list.h> |
35 | #include <linux/kallsyms.h> | 35 | #include <linux/kallsyms.h> |
36 | #include <linux/proc_fs.h> | 36 | #include <linux/proc_fs.h> |
37 | #include <linux/export.h> | ||
37 | 38 | ||
38 | #include <asm/exception.h> | 39 | #include <asm/exception.h> |
39 | #include <asm/mach/arch.h> | 40 | #include <asm/mach/arch.h> |
@@ -109,6 +110,7 @@ void set_irq_flags(unsigned int irq, unsigned int iflags) | |||
109 | /* Order is clear bits in "clr" then set bits in "set" */ | 110 | /* Order is clear bits in "clr" then set bits in "set" */ |
110 | irq_modify_status(irq, clr, set & ~clr); | 111 | irq_modify_status(irq, clr, set & ~clr); |
111 | } | 112 | } |
113 | EXPORT_SYMBOL_GPL(set_irq_flags); | ||
112 | 114 | ||
113 | void __init init_IRQ(void) | 115 | void __init init_IRQ(void) |
114 | { | 116 | { |
diff --git a/arch/arm/kernel/kprobes-test-arm.c b/arch/arm/kernel/kprobes-test-arm.c index 38c1a3b103a0..839312905067 100644 --- a/arch/arm/kernel/kprobes-test-arm.c +++ b/arch/arm/kernel/kprobes-test-arm.c | |||
@@ -366,7 +366,9 @@ void kprobe_arm_test_cases(void) | |||
366 | TEST_UNSUPPORTED(".word 0xe04f0392 @ umaal r0, pc, r2, r3") | 366 | TEST_UNSUPPORTED(".word 0xe04f0392 @ umaal r0, pc, r2, r3") |
367 | TEST_UNSUPPORTED(".word 0xe0500090 @ undef") | 367 | TEST_UNSUPPORTED(".word 0xe0500090 @ undef") |
368 | TEST_UNSUPPORTED(".word 0xe05fff9f @ undef") | 368 | TEST_UNSUPPORTED(".word 0xe05fff9f @ undef") |
369 | #endif | ||
369 | 370 | ||
371 | #if __LINUX_ARM_ARCH__ >= 7 | ||
370 | TEST_RRR( "mls r0, r",1, VAL1,", r",2, VAL2,", r",3, VAL3,"") | 372 | TEST_RRR( "mls r0, r",1, VAL1,", r",2, VAL2,", r",3, VAL3,"") |
371 | TEST_RRR( "mlshi r7, r",8, VAL3,", r",9, VAL1,", r",10, VAL2,"") | 373 | TEST_RRR( "mlshi r7, r",8, VAL3,", r",9, VAL1,", r",10, VAL2,"") |
372 | TEST_RR( "mls lr, r",1, VAL2,", r",2, VAL3,", r13") | 374 | TEST_RR( "mls lr, r",1, VAL2,", r",2, VAL3,", r13") |
@@ -456,6 +458,8 @@ void kprobe_arm_test_cases(void) | |||
456 | TEST_UNSUPPORTED(".word 0xe1700090") /* Unallocated space */ | 458 | TEST_UNSUPPORTED(".word 0xe1700090") /* Unallocated space */ |
457 | #if __LINUX_ARM_ARCH__ >= 6 | 459 | #if __LINUX_ARM_ARCH__ >= 6 |
458 | TEST_UNSUPPORTED("ldrex r2, [sp]") | 460 | TEST_UNSUPPORTED("ldrex r2, [sp]") |
461 | #endif | ||
462 | #if (__LINUX_ARM_ARCH__ >= 7) || defined(CONFIG_CPU_32v6K) | ||
459 | TEST_UNSUPPORTED("strexd r0, r2, r3, [sp]") | 463 | TEST_UNSUPPORTED("strexd r0, r2, r3, [sp]") |
460 | TEST_UNSUPPORTED("ldrexd r2, r3, [sp]") | 464 | TEST_UNSUPPORTED("ldrexd r2, r3, [sp]") |
461 | TEST_UNSUPPORTED("strexb r0, r2, [sp]") | 465 | TEST_UNSUPPORTED("strexb r0, r2, [sp]") |
diff --git a/arch/arm/kernel/machine_kexec.c b/arch/arm/kernel/machine_kexec.c index e29c3337ca81..8ef8c9337809 100644 --- a/arch/arm/kernel/machine_kexec.c +++ b/arch/arm/kernel/machine_kexec.c | |||
@@ -45,10 +45,9 @@ int machine_kexec_prepare(struct kimage *image) | |||
45 | for (i = 0; i < image->nr_segments; i++) { | 45 | for (i = 0; i < image->nr_segments; i++) { |
46 | current_segment = &image->segment[i]; | 46 | current_segment = &image->segment[i]; |
47 | 47 | ||
48 | err = memblock_is_region_memory(current_segment->mem, | 48 | if (!memblock_is_region_memory(current_segment->mem, |
49 | current_segment->memsz); | 49 | current_segment->memsz)) |
50 | if (err) | 50 | return -EINVAL; |
51 | return - EINVAL; | ||
52 | 51 | ||
53 | err = get_user(header, (__be32*)current_segment->buf); | 52 | err = get_user(header, (__be32*)current_segment->buf); |
54 | if (err) | 53 | if (err) |
diff --git a/arch/arm/kernel/perf_event.c b/arch/arm/kernel/perf_event.c index 93971b1a4f0b..53c0304b734a 100644 --- a/arch/arm/kernel/perf_event.c +++ b/arch/arm/kernel/perf_event.c | |||
@@ -96,6 +96,10 @@ armpmu_event_set_period(struct perf_event *event, | |||
96 | s64 period = hwc->sample_period; | 96 | s64 period = hwc->sample_period; |
97 | int ret = 0; | 97 | int ret = 0; |
98 | 98 | ||
99 | /* The period may have been changed by PERF_EVENT_IOC_PERIOD */ | ||
100 | if (unlikely(period != hwc->last_period)) | ||
101 | left = period - (hwc->last_period - left); | ||
102 | |||
99 | if (unlikely(left <= -period)) { | 103 | if (unlikely(left <= -period)) { |
100 | left = period; | 104 | left = period; |
101 | local64_set(&hwc->period_left, left); | 105 | local64_set(&hwc->period_left, left); |
diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c index 8e20754dd31d..fbc8b2623d82 100644 --- a/arch/arm/kernel/smp.c +++ b/arch/arm/kernel/smp.c | |||
@@ -294,18 +294,24 @@ static void percpu_timer_setup(void); | |||
294 | asmlinkage void __cpuinit secondary_start_kernel(void) | 294 | asmlinkage void __cpuinit secondary_start_kernel(void) |
295 | { | 295 | { |
296 | struct mm_struct *mm = &init_mm; | 296 | struct mm_struct *mm = &init_mm; |
297 | unsigned int cpu = smp_processor_id(); | 297 | unsigned int cpu; |
298 | |||
299 | /* | ||
300 | * The identity mapping is uncached (strongly ordered), so | ||
301 | * switch away from it before attempting any exclusive accesses. | ||
302 | */ | ||
303 | cpu_switch_mm(mm->pgd, mm); | ||
304 | enter_lazy_tlb(mm, current); | ||
305 | local_flush_tlb_all(); | ||
298 | 306 | ||
299 | /* | 307 | /* |
300 | * All kernel threads share the same mm context; grab a | 308 | * All kernel threads share the same mm context; grab a |
301 | * reference and switch to it. | 309 | * reference and switch to it. |
302 | */ | 310 | */ |
311 | cpu = smp_processor_id(); | ||
303 | atomic_inc(&mm->mm_count); | 312 | atomic_inc(&mm->mm_count); |
304 | current->active_mm = mm; | 313 | current->active_mm = mm; |
305 | cpumask_set_cpu(cpu, mm_cpumask(mm)); | 314 | cpumask_set_cpu(cpu, mm_cpumask(mm)); |
306 | cpu_switch_mm(mm->pgd, mm); | ||
307 | enter_lazy_tlb(mm, current); | ||
308 | local_flush_tlb_all(); | ||
309 | 315 | ||
310 | printk("CPU%u: Booted secondary processor\n", cpu); | 316 | printk("CPU%u: Booted secondary processor\n", cpu); |
311 | 317 | ||
diff --git a/arch/arm/kernel/smp_twd.c b/arch/arm/kernel/smp_twd.c index e1f906989bb8..b22d700fea27 100644 --- a/arch/arm/kernel/smp_twd.c +++ b/arch/arm/kernel/smp_twd.c | |||
@@ -42,10 +42,10 @@ static void twd_set_mode(enum clock_event_mode mode, | |||
42 | 42 | ||
43 | switch (mode) { | 43 | switch (mode) { |
44 | case CLOCK_EVT_MODE_PERIODIC: | 44 | case CLOCK_EVT_MODE_PERIODIC: |
45 | /* timer load already set up */ | ||
46 | ctrl = TWD_TIMER_CONTROL_ENABLE | TWD_TIMER_CONTROL_IT_ENABLE | 45 | ctrl = TWD_TIMER_CONTROL_ENABLE | TWD_TIMER_CONTROL_IT_ENABLE |
47 | | TWD_TIMER_CONTROL_PERIODIC; | 46 | | TWD_TIMER_CONTROL_PERIODIC; |
48 | __raw_writel(twd_timer_rate / HZ, twd_base + TWD_TIMER_LOAD); | 47 | __raw_writel(DIV_ROUND_CLOSEST(twd_timer_rate, HZ), |
48 | twd_base + TWD_TIMER_LOAD); | ||
49 | break; | 49 | break; |
50 | case CLOCK_EVT_MODE_ONESHOT: | 50 | case CLOCK_EVT_MODE_ONESHOT: |
51 | /* period set, and timer enabled in 'next_event' hook */ | 51 | /* period set, and timer enabled in 'next_event' hook */ |
diff --git a/arch/arm/lib/delay.c b/arch/arm/lib/delay.c index 9d0a30032d7f..0dc53854a5d8 100644 --- a/arch/arm/lib/delay.c +++ b/arch/arm/lib/delay.c | |||
@@ -45,6 +45,7 @@ int read_current_timer(unsigned long *timer_val) | |||
45 | *timer_val = delay_timer->read_current_timer(); | 45 | *timer_val = delay_timer->read_current_timer(); |
46 | return 0; | 46 | return 0; |
47 | } | 47 | } |
48 | EXPORT_SYMBOL_GPL(read_current_timer); | ||
48 | 49 | ||
49 | static void __timer_delay(unsigned long cycles) | 50 | static void __timer_delay(unsigned long cycles) |
50 | { | 51 | { |
diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig index b14207101938..043624219b55 100644 --- a/arch/arm/mach-at91/Kconfig +++ b/arch/arm/mach-at91/Kconfig | |||
@@ -21,19 +21,13 @@ config SOC_AT91SAM9 | |||
21 | bool | 21 | bool |
22 | select CPU_ARM926T | 22 | select CPU_ARM926T |
23 | select GENERIC_CLOCKEVENTS | 23 | select GENERIC_CLOCKEVENTS |
24 | select MULTI_IRQ_HANDLER | ||
25 | select SPARSE_IRQ | ||
24 | 26 | ||
25 | menu "Atmel AT91 System-on-Chip" | 27 | menu "Atmel AT91 System-on-Chip" |
26 | 28 | ||
27 | comment "Atmel AT91 Processor" | 29 | comment "Atmel AT91 Processor" |
28 | 30 | ||
29 | config SOC_AT91SAM9 | ||
30 | bool | ||
31 | select AT91_SAM9_SMC | ||
32 | select AT91_SAM9_TIME | ||
33 | select CPU_ARM926T | ||
34 | select MULTI_IRQ_HANDLER | ||
35 | select SPARSE_IRQ | ||
36 | |||
37 | config SOC_AT91RM9200 | 31 | config SOC_AT91RM9200 |
38 | bool "AT91RM9200" | 32 | bool "AT91RM9200" |
39 | select CPU_ARM920T | 33 | select CPU_ARM920T |
diff --git a/arch/arm/mach-at91/at91rm9200.c b/arch/arm/mach-at91/at91rm9200.c index b4f0565aff63..5269825194a8 100644 --- a/arch/arm/mach-at91/at91rm9200.c +++ b/arch/arm/mach-at91/at91rm9200.c | |||
@@ -187,7 +187,7 @@ static struct clk_lookup periph_clocks_lookups[] = { | |||
187 | CLKDEV_CON_DEV_ID("pclk", "ssc.0", &ssc0_clk), | 187 | CLKDEV_CON_DEV_ID("pclk", "ssc.0", &ssc0_clk), |
188 | CLKDEV_CON_DEV_ID("pclk", "ssc.1", &ssc1_clk), | 188 | CLKDEV_CON_DEV_ID("pclk", "ssc.1", &ssc1_clk), |
189 | CLKDEV_CON_DEV_ID("pclk", "ssc.2", &ssc2_clk), | 189 | CLKDEV_CON_DEV_ID("pclk", "ssc.2", &ssc2_clk), |
190 | CLKDEV_CON_DEV_ID(NULL, "i2c-at91rm9200", &twi_clk), | 190 | CLKDEV_CON_DEV_ID(NULL, "i2c-at91rm9200.0", &twi_clk), |
191 | /* fake hclk clock */ | 191 | /* fake hclk clock */ |
192 | CLKDEV_CON_DEV_ID("hclk", "at91_ohci", &ohci_clk), | 192 | CLKDEV_CON_DEV_ID("hclk", "at91_ohci", &ohci_clk), |
193 | CLKDEV_CON_ID("pioA", &pioA_clk), | 193 | CLKDEV_CON_ID("pioA", &pioA_clk), |
diff --git a/arch/arm/mach-at91/at91rm9200_devices.c b/arch/arm/mach-at91/at91rm9200_devices.c index a563189cdfc3..1e122bcd7845 100644 --- a/arch/arm/mach-at91/at91rm9200_devices.c +++ b/arch/arm/mach-at91/at91rm9200_devices.c | |||
@@ -479,7 +479,7 @@ static struct i2c_gpio_platform_data pdata = { | |||
479 | 479 | ||
480 | static struct platform_device at91rm9200_twi_device = { | 480 | static struct platform_device at91rm9200_twi_device = { |
481 | .name = "i2c-gpio", | 481 | .name = "i2c-gpio", |
482 | .id = -1, | 482 | .id = 0, |
483 | .dev.platform_data = &pdata, | 483 | .dev.platform_data = &pdata, |
484 | }; | 484 | }; |
485 | 485 | ||
@@ -512,7 +512,7 @@ static struct resource twi_resources[] = { | |||
512 | 512 | ||
513 | static struct platform_device at91rm9200_twi_device = { | 513 | static struct platform_device at91rm9200_twi_device = { |
514 | .name = "i2c-at91rm9200", | 514 | .name = "i2c-at91rm9200", |
515 | .id = -1, | 515 | .id = 0, |
516 | .resource = twi_resources, | 516 | .resource = twi_resources, |
517 | .num_resources = ARRAY_SIZE(twi_resources), | 517 | .num_resources = ARRAY_SIZE(twi_resources), |
518 | }; | 518 | }; |
diff --git a/arch/arm/mach-at91/at91sam9260.c b/arch/arm/mach-at91/at91sam9260.c index ad29f93f20ca..f8202615f4a8 100644 --- a/arch/arm/mach-at91/at91sam9260.c +++ b/arch/arm/mach-at91/at91sam9260.c | |||
@@ -211,8 +211,8 @@ static struct clk_lookup periph_clocks_lookups[] = { | |||
211 | CLKDEV_CON_DEV_ID("t1_clk", "atmel_tcb.1", &tc4_clk), | 211 | CLKDEV_CON_DEV_ID("t1_clk", "atmel_tcb.1", &tc4_clk), |
212 | CLKDEV_CON_DEV_ID("t2_clk", "atmel_tcb.1", &tc5_clk), | 212 | CLKDEV_CON_DEV_ID("t2_clk", "atmel_tcb.1", &tc5_clk), |
213 | CLKDEV_CON_DEV_ID("pclk", "ssc.0", &ssc_clk), | 213 | CLKDEV_CON_DEV_ID("pclk", "ssc.0", &ssc_clk), |
214 | CLKDEV_CON_DEV_ID(NULL, "i2c-at91sam9260", &twi_clk), | 214 | CLKDEV_CON_DEV_ID(NULL, "i2c-at91sam9260.0", &twi_clk), |
215 | CLKDEV_CON_DEV_ID(NULL, "i2c-at91sam9g20", &twi_clk), | 215 | CLKDEV_CON_DEV_ID(NULL, "i2c-at91sam9g20.0", &twi_clk), |
216 | /* more usart lookup table for DT entries */ | 216 | /* more usart lookup table for DT entries */ |
217 | CLKDEV_CON_DEV_ID("usart", "fffff200.serial", &mck), | 217 | CLKDEV_CON_DEV_ID("usart", "fffff200.serial", &mck), |
218 | CLKDEV_CON_DEV_ID("usart", "fffb0000.serial", &usart0_clk), | 218 | CLKDEV_CON_DEV_ID("usart", "fffb0000.serial", &usart0_clk), |
diff --git a/arch/arm/mach-at91/at91sam9260_devices.c b/arch/arm/mach-at91/at91sam9260_devices.c index a76b8684f52d..aa1e58729885 100644 --- a/arch/arm/mach-at91/at91sam9260_devices.c +++ b/arch/arm/mach-at91/at91sam9260_devices.c | |||
@@ -389,7 +389,7 @@ static struct i2c_gpio_platform_data pdata = { | |||
389 | 389 | ||
390 | static struct platform_device at91sam9260_twi_device = { | 390 | static struct platform_device at91sam9260_twi_device = { |
391 | .name = "i2c-gpio", | 391 | .name = "i2c-gpio", |
392 | .id = -1, | 392 | .id = 0, |
393 | .dev.platform_data = &pdata, | 393 | .dev.platform_data = &pdata, |
394 | }; | 394 | }; |
395 | 395 | ||
@@ -421,7 +421,7 @@ static struct resource twi_resources[] = { | |||
421 | }; | 421 | }; |
422 | 422 | ||
423 | static struct platform_device at91sam9260_twi_device = { | 423 | static struct platform_device at91sam9260_twi_device = { |
424 | .id = -1, | 424 | .id = 0, |
425 | .resource = twi_resources, | 425 | .resource = twi_resources, |
426 | .num_resources = ARRAY_SIZE(twi_resources), | 426 | .num_resources = ARRAY_SIZE(twi_resources), |
427 | }; | 427 | }; |
diff --git a/arch/arm/mach-at91/at91sam9261.c b/arch/arm/mach-at91/at91sam9261.c index 8d999eb1a137..04295c04b3e0 100644 --- a/arch/arm/mach-at91/at91sam9261.c +++ b/arch/arm/mach-at91/at91sam9261.c | |||
@@ -178,8 +178,8 @@ static struct clk_lookup periph_clocks_lookups[] = { | |||
178 | CLKDEV_CON_DEV_ID("pclk", "ssc.1", &ssc1_clk), | 178 | CLKDEV_CON_DEV_ID("pclk", "ssc.1", &ssc1_clk), |
179 | CLKDEV_CON_DEV_ID("pclk", "ssc.2", &ssc2_clk), | 179 | CLKDEV_CON_DEV_ID("pclk", "ssc.2", &ssc2_clk), |
180 | CLKDEV_CON_DEV_ID("hclk", "at91_ohci", &hck0), | 180 | CLKDEV_CON_DEV_ID("hclk", "at91_ohci", &hck0), |
181 | CLKDEV_CON_DEV_ID(NULL, "i2c-at91sam9261", &twi_clk), | 181 | CLKDEV_CON_DEV_ID(NULL, "i2c-at91sam9261.0", &twi_clk), |
182 | CLKDEV_CON_DEV_ID(NULL, "i2c-at91sam9g10", &twi_clk), | 182 | CLKDEV_CON_DEV_ID(NULL, "i2c-at91sam9g10.0", &twi_clk), |
183 | CLKDEV_CON_ID("pioA", &pioA_clk), | 183 | CLKDEV_CON_ID("pioA", &pioA_clk), |
184 | CLKDEV_CON_ID("pioB", &pioB_clk), | 184 | CLKDEV_CON_ID("pioB", &pioB_clk), |
185 | CLKDEV_CON_ID("pioC", &pioC_clk), | 185 | CLKDEV_CON_ID("pioC", &pioC_clk), |
diff --git a/arch/arm/mach-at91/at91sam9261_devices.c b/arch/arm/mach-at91/at91sam9261_devices.c index 9752f17efba9..b9487696b7be 100644 --- a/arch/arm/mach-at91/at91sam9261_devices.c +++ b/arch/arm/mach-at91/at91sam9261_devices.c | |||
@@ -285,7 +285,7 @@ static struct i2c_gpio_platform_data pdata = { | |||
285 | 285 | ||
286 | static struct platform_device at91sam9261_twi_device = { | 286 | static struct platform_device at91sam9261_twi_device = { |
287 | .name = "i2c-gpio", | 287 | .name = "i2c-gpio", |
288 | .id = -1, | 288 | .id = 0, |
289 | .dev.platform_data = &pdata, | 289 | .dev.platform_data = &pdata, |
290 | }; | 290 | }; |
291 | 291 | ||
@@ -317,7 +317,7 @@ static struct resource twi_resources[] = { | |||
317 | }; | 317 | }; |
318 | 318 | ||
319 | static struct platform_device at91sam9261_twi_device = { | 319 | static struct platform_device at91sam9261_twi_device = { |
320 | .id = -1, | 320 | .id = 0, |
321 | .resource = twi_resources, | 321 | .resource = twi_resources, |
322 | .num_resources = ARRAY_SIZE(twi_resources), | 322 | .num_resources = ARRAY_SIZE(twi_resources), |
323 | }; | 323 | }; |
diff --git a/arch/arm/mach-at91/at91sam9263.c b/arch/arm/mach-at91/at91sam9263.c index 6a01d0360dfb..d6f9c23927c4 100644 --- a/arch/arm/mach-at91/at91sam9263.c +++ b/arch/arm/mach-at91/at91sam9263.c | |||
@@ -193,7 +193,7 @@ static struct clk_lookup periph_clocks_lookups[] = { | |||
193 | CLKDEV_CON_DEV_ID("spi_clk", "atmel_spi.0", &spi0_clk), | 193 | CLKDEV_CON_DEV_ID("spi_clk", "atmel_spi.0", &spi0_clk), |
194 | CLKDEV_CON_DEV_ID("spi_clk", "atmel_spi.1", &spi1_clk), | 194 | CLKDEV_CON_DEV_ID("spi_clk", "atmel_spi.1", &spi1_clk), |
195 | CLKDEV_CON_DEV_ID("t0_clk", "atmel_tcb.0", &tcb_clk), | 195 | CLKDEV_CON_DEV_ID("t0_clk", "atmel_tcb.0", &tcb_clk), |
196 | CLKDEV_CON_DEV_ID(NULL, "i2c-at91sam9260", &twi_clk), | 196 | CLKDEV_CON_DEV_ID(NULL, "i2c-at91sam9260.0", &twi_clk), |
197 | /* fake hclk clock */ | 197 | /* fake hclk clock */ |
198 | CLKDEV_CON_DEV_ID("hclk", "at91_ohci", &ohci_clk), | 198 | CLKDEV_CON_DEV_ID("hclk", "at91_ohci", &ohci_clk), |
199 | CLKDEV_CON_ID("pioA", &pioA_clk), | 199 | CLKDEV_CON_ID("pioA", &pioA_clk), |
diff --git a/arch/arm/mach-at91/at91sam9263_devices.c b/arch/arm/mach-at91/at91sam9263_devices.c index 8dde220b42b6..cb85da2eccea 100644 --- a/arch/arm/mach-at91/at91sam9263_devices.c +++ b/arch/arm/mach-at91/at91sam9263_devices.c | |||
@@ -567,7 +567,7 @@ static struct i2c_gpio_platform_data pdata = { | |||
567 | 567 | ||
568 | static struct platform_device at91sam9263_twi_device = { | 568 | static struct platform_device at91sam9263_twi_device = { |
569 | .name = "i2c-gpio", | 569 | .name = "i2c-gpio", |
570 | .id = -1, | 570 | .id = 0, |
571 | .dev.platform_data = &pdata, | 571 | .dev.platform_data = &pdata, |
572 | }; | 572 | }; |
573 | 573 | ||
@@ -600,7 +600,7 @@ static struct resource twi_resources[] = { | |||
600 | 600 | ||
601 | static struct platform_device at91sam9263_twi_device = { | 601 | static struct platform_device at91sam9263_twi_device = { |
602 | .name = "i2c-at91sam9260", | 602 | .name = "i2c-at91sam9260", |
603 | .id = -1, | 603 | .id = 0, |
604 | .resource = twi_resources, | 604 | .resource = twi_resources, |
605 | .num_resources = ARRAY_SIZE(twi_resources), | 605 | .num_resources = ARRAY_SIZE(twi_resources), |
606 | }; | 606 | }; |
diff --git a/arch/arm/mach-at91/at91sam9rl_devices.c b/arch/arm/mach-at91/at91sam9rl_devices.c index d6ca0543ce8d..5047bdc92adf 100644 --- a/arch/arm/mach-at91/at91sam9rl_devices.c +++ b/arch/arm/mach-at91/at91sam9rl_devices.c | |||
@@ -314,7 +314,7 @@ static struct i2c_gpio_platform_data pdata = { | |||
314 | 314 | ||
315 | static struct platform_device at91sam9rl_twi_device = { | 315 | static struct platform_device at91sam9rl_twi_device = { |
316 | .name = "i2c-gpio", | 316 | .name = "i2c-gpio", |
317 | .id = -1, | 317 | .id = 0, |
318 | .dev.platform_data = &pdata, | 318 | .dev.platform_data = &pdata, |
319 | }; | 319 | }; |
320 | 320 | ||
@@ -347,7 +347,7 @@ static struct resource twi_resources[] = { | |||
347 | 347 | ||
348 | static struct platform_device at91sam9rl_twi_device = { | 348 | static struct platform_device at91sam9rl_twi_device = { |
349 | .name = "i2c-at91sam9g20", | 349 | .name = "i2c-at91sam9g20", |
350 | .id = -1, | 350 | .id = 0, |
351 | .resource = twi_resources, | 351 | .resource = twi_resources, |
352 | .num_resources = ARRAY_SIZE(twi_resources), | 352 | .num_resources = ARRAY_SIZE(twi_resources), |
353 | }; | 353 | }; |
diff --git a/arch/arm/mach-at91/at91x40.c b/arch/arm/mach-at91/at91x40.c index 6bd7300a2bc5..bb7f54474b92 100644 --- a/arch/arm/mach-at91/at91x40.c +++ b/arch/arm/mach-at91/at91x40.c | |||
@@ -88,6 +88,6 @@ void __init at91x40_init_interrupts(unsigned int priority[NR_AIC_IRQS]) | |||
88 | if (!priority) | 88 | if (!priority) |
89 | priority = at91x40_default_irq_priority; | 89 | priority = at91x40_default_irq_priority; |
90 | 90 | ||
91 | at91_aic_init(priority); | 91 | at91_aic_init(priority, at91_extern_irq); |
92 | } | 92 | } |
93 | 93 | ||
diff --git a/arch/arm/mach-at91/board-neocore926.c b/arch/arm/mach-at91/board-neocore926.c index 9cda3fd346ae..6960778af4c2 100644 --- a/arch/arm/mach-at91/board-neocore926.c +++ b/arch/arm/mach-at91/board-neocore926.c | |||
@@ -129,7 +129,7 @@ static struct spi_board_info neocore926_spi_devices[] = { | |||
129 | .max_speed_hz = 125000 * 16, | 129 | .max_speed_hz = 125000 * 16, |
130 | .bus_num = 0, | 130 | .bus_num = 0, |
131 | .platform_data = &ads_info, | 131 | .platform_data = &ads_info, |
132 | .irq = AT91SAM9263_ID_IRQ1, | 132 | .irq = NR_IRQS_LEGACY + AT91SAM9263_ID_IRQ1, |
133 | }, | 133 | }, |
134 | #endif | 134 | #endif |
135 | }; | 135 | }; |
diff --git a/arch/arm/mach-at91/board-sam9261ek.c b/arch/arm/mach-at91/board-sam9261ek.c index 27b3af1a3047..a9167dd45f96 100644 --- a/arch/arm/mach-at91/board-sam9261ek.c +++ b/arch/arm/mach-at91/board-sam9261ek.c | |||
@@ -309,7 +309,7 @@ static struct spi_board_info ek_spi_devices[] = { | |||
309 | .max_speed_hz = 125000 * 26, /* (max sample rate @ 3V) * (cmd + data + overhead) */ | 309 | .max_speed_hz = 125000 * 26, /* (max sample rate @ 3V) * (cmd + data + overhead) */ |
310 | .bus_num = 0, | 310 | .bus_num = 0, |
311 | .platform_data = &ads_info, | 311 | .platform_data = &ads_info, |
312 | .irq = AT91SAM9261_ID_IRQ0, | 312 | .irq = NR_IRQS_LEGACY + AT91SAM9261_ID_IRQ0, |
313 | .controller_data = (void *) AT91_PIN_PA28, /* CS pin */ | 313 | .controller_data = (void *) AT91_PIN_PA28, /* CS pin */ |
314 | }, | 314 | }, |
315 | #endif | 315 | #endif |
diff --git a/arch/arm/mach-at91/board-sam9263ek.c b/arch/arm/mach-at91/board-sam9263ek.c index 073e17403d98..b87dbe2be0d6 100644 --- a/arch/arm/mach-at91/board-sam9263ek.c +++ b/arch/arm/mach-at91/board-sam9263ek.c | |||
@@ -132,7 +132,7 @@ static struct spi_board_info ek_spi_devices[] = { | |||
132 | .max_speed_hz = 125000 * 26, /* (max sample rate @ 3V) * (cmd + data + overhead) */ | 132 | .max_speed_hz = 125000 * 26, /* (max sample rate @ 3V) * (cmd + data + overhead) */ |
133 | .bus_num = 0, | 133 | .bus_num = 0, |
134 | .platform_data = &ads_info, | 134 | .platform_data = &ads_info, |
135 | .irq = AT91SAM9263_ID_IRQ1, | 135 | .irq = NR_IRQS_LEGACY + AT91SAM9263_ID_IRQ1, |
136 | }, | 136 | }, |
137 | #endif | 137 | #endif |
138 | }; | 138 | }; |
diff --git a/arch/arm/mach-at91/generic.h b/arch/arm/mach-at91/generic.h index f49650677653..b62f560e6c75 100644 --- a/arch/arm/mach-at91/generic.h +++ b/arch/arm/mach-at91/generic.h | |||
@@ -26,7 +26,8 @@ extern void __init at91_dt_initialize(void); | |||
26 | extern void __init at91_init_irq_default(void); | 26 | extern void __init at91_init_irq_default(void); |
27 | extern void __init at91_init_interrupts(unsigned int priority[]); | 27 | extern void __init at91_init_interrupts(unsigned int priority[]); |
28 | extern void __init at91x40_init_interrupts(unsigned int priority[]); | 28 | extern void __init at91x40_init_interrupts(unsigned int priority[]); |
29 | extern void __init at91_aic_init(unsigned int priority[]); | 29 | extern void __init at91_aic_init(unsigned int priority[], |
30 | unsigned int ext_irq_mask); | ||
30 | extern int __init at91_aic_of_init(struct device_node *node, | 31 | extern int __init at91_aic_of_init(struct device_node *node, |
31 | struct device_node *parent); | 32 | struct device_node *parent); |
32 | extern int __init at91_aic5_of_init(struct device_node *node, | 33 | extern int __init at91_aic5_of_init(struct device_node *node, |
diff --git a/arch/arm/mach-at91/irq.c b/arch/arm/mach-at91/irq.c index 1e02c0e49dcc..febc2ee901a5 100644 --- a/arch/arm/mach-at91/irq.c +++ b/arch/arm/mach-at91/irq.c | |||
@@ -502,14 +502,19 @@ int __init at91_aic5_of_init(struct device_node *node, | |||
502 | /* | 502 | /* |
503 | * Initialize the AIC interrupt controller. | 503 | * Initialize the AIC interrupt controller. |
504 | */ | 504 | */ |
505 | void __init at91_aic_init(unsigned int *priority) | 505 | void __init at91_aic_init(unsigned int *priority, unsigned int ext_irq_mask) |
506 | { | 506 | { |
507 | unsigned int i; | 507 | unsigned int i; |
508 | int irq_base; | 508 | int irq_base; |
509 | 509 | ||
510 | if (at91_aic_pm_init()) | 510 | at91_extern_irq = kzalloc(BITS_TO_LONGS(n_irqs) |
511 | * sizeof(*at91_extern_irq), GFP_KERNEL); | ||
512 | |||
513 | if (at91_aic_pm_init() || at91_extern_irq == NULL) | ||
511 | panic("Unable to allocate bit maps\n"); | 514 | panic("Unable to allocate bit maps\n"); |
512 | 515 | ||
516 | *at91_extern_irq = ext_irq_mask; | ||
517 | |||
513 | at91_aic_base = ioremap(AT91_AIC, 512); | 518 | at91_aic_base = ioremap(AT91_AIC, 512); |
514 | if (!at91_aic_base) | 519 | if (!at91_aic_base) |
515 | panic("Unable to ioremap AIC registers\n"); | 520 | panic("Unable to ioremap AIC registers\n"); |
diff --git a/arch/arm/mach-at91/setup.c b/arch/arm/mach-at91/setup.c index da9881b161e1..0b32c81730a5 100644 --- a/arch/arm/mach-at91/setup.c +++ b/arch/arm/mach-at91/setup.c | |||
@@ -47,7 +47,7 @@ void __init at91_init_irq_default(void) | |||
47 | void __init at91_init_interrupts(unsigned int *priority) | 47 | void __init at91_init_interrupts(unsigned int *priority) |
48 | { | 48 | { |
49 | /* Initialize the AIC interrupt controller */ | 49 | /* Initialize the AIC interrupt controller */ |
50 | at91_aic_init(priority); | 50 | at91_aic_init(priority, at91_extern_irq); |
51 | 51 | ||
52 | /* Enable GPIO interrupts */ | 52 | /* Enable GPIO interrupts */ |
53 | at91_gpio_irq_setup(); | 53 | at91_gpio_irq_setup(); |
@@ -151,7 +151,7 @@ static void __init soc_detect(u32 dbgu_base) | |||
151 | } | 151 | } |
152 | 152 | ||
153 | /* at91sam9g10 */ | 153 | /* at91sam9g10 */ |
154 | if ((cidr & ~AT91_CIDR_EXT) == ARCH_ID_AT91SAM9G10) { | 154 | if ((socid & ~AT91_CIDR_EXT) == ARCH_ID_AT91SAM9G10) { |
155 | at91_soc_initdata.type = AT91_SOC_SAM9G10; | 155 | at91_soc_initdata.type = AT91_SOC_SAM9G10; |
156 | at91_boot_soc = at91sam9261_soc; | 156 | at91_boot_soc = at91sam9261_soc; |
157 | } | 157 | } |
diff --git a/arch/arm/mach-exynos/common.c b/arch/arm/mach-exynos/common.c index 715b690e5009..1947be8e5f5b 100644 --- a/arch/arm/mach-exynos/common.c +++ b/arch/arm/mach-exynos/common.c | |||
@@ -47,6 +47,7 @@ | |||
47 | #include <plat/fimc-core.h> | 47 | #include <plat/fimc-core.h> |
48 | #include <plat/iic-core.h> | 48 | #include <plat/iic-core.h> |
49 | #include <plat/tv-core.h> | 49 | #include <plat/tv-core.h> |
50 | #include <plat/spi-core.h> | ||
50 | #include <plat/regs-serial.h> | 51 | #include <plat/regs-serial.h> |
51 | 52 | ||
52 | #include "common.h" | 53 | #include "common.h" |
@@ -346,6 +347,8 @@ static void __init exynos4_map_io(void) | |||
346 | 347 | ||
347 | s5p_fb_setname(0, "exynos4-fb"); | 348 | s5p_fb_setname(0, "exynos4-fb"); |
348 | s5p_hdmi_setname("exynos4-hdmi"); | 349 | s5p_hdmi_setname("exynos4-hdmi"); |
350 | |||
351 | s3c64xx_spi_setname("exynos4210-spi"); | ||
349 | } | 352 | } |
350 | 353 | ||
351 | static void __init exynos5_map_io(void) | 354 | static void __init exynos5_map_io(void) |
@@ -366,6 +369,8 @@ static void __init exynos5_map_io(void) | |||
366 | s3c_i2c0_setname("s3c2440-i2c"); | 369 | s3c_i2c0_setname("s3c2440-i2c"); |
367 | s3c_i2c1_setname("s3c2440-i2c"); | 370 | s3c_i2c1_setname("s3c2440-i2c"); |
368 | s3c_i2c2_setname("s3c2440-i2c"); | 371 | s3c_i2c2_setname("s3c2440-i2c"); |
372 | |||
373 | s3c64xx_spi_setname("exynos4210-spi"); | ||
369 | } | 374 | } |
370 | 375 | ||
371 | static void __init exynos4_init_clocks(int xtal) | 376 | static void __init exynos4_init_clocks(int xtal) |
diff --git a/arch/arm/mach-exynos/mach-exynos4-dt.c b/arch/arm/mach-exynos/mach-exynos4-dt.c index e58d786faf78..eadf4b59e7d2 100644 --- a/arch/arm/mach-exynos/mach-exynos4-dt.c +++ b/arch/arm/mach-exynos/mach-exynos4-dt.c | |||
@@ -99,6 +99,7 @@ static char const *exynos4_dt_compat[] __initdata = { | |||
99 | 99 | ||
100 | DT_MACHINE_START(EXYNOS4210_DT, "Samsung Exynos4 (Flattened Device Tree)") | 100 | DT_MACHINE_START(EXYNOS4210_DT, "Samsung Exynos4 (Flattened Device Tree)") |
101 | /* Maintainer: Thomas Abraham <thomas.abraham@linaro.org> */ | 101 | /* Maintainer: Thomas Abraham <thomas.abraham@linaro.org> */ |
102 | .smp = smp_ops(exynos_smp_ops), | ||
102 | .init_irq = exynos4_init_irq, | 103 | .init_irq = exynos4_init_irq, |
103 | .map_io = exynos4_dt_map_io, | 104 | .map_io = exynos4_dt_map_io, |
104 | .handle_irq = gic_handle_irq, | 105 | .handle_irq = gic_handle_irq, |
diff --git a/arch/arm/mach-imx/clk-busy.c b/arch/arm/mach-imx/clk-busy.c index 1a7a8dd045a1..1ab91b5209e6 100644 --- a/arch/arm/mach-imx/clk-busy.c +++ b/arch/arm/mach-imx/clk-busy.c | |||
@@ -108,7 +108,7 @@ struct clk *imx_clk_busy_divider(const char *name, const char *parent_name, | |||
108 | busy->div.hw.init = &init; | 108 | busy->div.hw.init = &init; |
109 | 109 | ||
110 | clk = clk_register(NULL, &busy->div.hw); | 110 | clk = clk_register(NULL, &busy->div.hw); |
111 | if (!clk) | 111 | if (IS_ERR(clk)) |
112 | kfree(busy); | 112 | kfree(busy); |
113 | 113 | ||
114 | return clk; | 114 | return clk; |
diff --git a/arch/arm/mach-imx/clk-imx25.c b/arch/arm/mach-imx/clk-imx25.c index d20d4795f4ea..01e2f843bf2e 100644 --- a/arch/arm/mach-imx/clk-imx25.c +++ b/arch/arm/mach-imx/clk-imx25.c | |||
@@ -127,8 +127,8 @@ int __init mx25_clocks_init(void) | |||
127 | clk[esdhc2_ipg_per] = imx_clk_gate("esdhc2_ipg_per", "per4", ccm(CCM_CGCR0), 4); | 127 | clk[esdhc2_ipg_per] = imx_clk_gate("esdhc2_ipg_per", "per4", ccm(CCM_CGCR0), 4); |
128 | clk[gpt_ipg_per] = imx_clk_gate("gpt_ipg_per", "per5", ccm(CCM_CGCR0), 5); | 128 | clk[gpt_ipg_per] = imx_clk_gate("gpt_ipg_per", "per5", ccm(CCM_CGCR0), 5); |
129 | clk[i2c_ipg_per] = imx_clk_gate("i2c_ipg_per", "per6", ccm(CCM_CGCR0), 6); | 129 | clk[i2c_ipg_per] = imx_clk_gate("i2c_ipg_per", "per6", ccm(CCM_CGCR0), 6); |
130 | clk[lcdc_ipg_per] = imx_clk_gate("lcdc_ipg_per", "per8", ccm(CCM_CGCR0), 7); | 130 | clk[lcdc_ipg_per] = imx_clk_gate("lcdc_ipg_per", "per7", ccm(CCM_CGCR0), 7); |
131 | clk[nfc_ipg_per] = imx_clk_gate("nfc_ipg_per", "ipg_per", ccm(CCM_CGCR0), 8); | 131 | clk[nfc_ipg_per] = imx_clk_gate("nfc_ipg_per", "per8", ccm(CCM_CGCR0), 8); |
132 | clk[ssi1_ipg_per] = imx_clk_gate("ssi1_ipg_per", "per13", ccm(CCM_CGCR0), 13); | 132 | clk[ssi1_ipg_per] = imx_clk_gate("ssi1_ipg_per", "per13", ccm(CCM_CGCR0), 13); |
133 | clk[ssi2_ipg_per] = imx_clk_gate("ssi2_ipg_per", "per14", ccm(CCM_CGCR0), 14); | 133 | clk[ssi2_ipg_per] = imx_clk_gate("ssi2_ipg_per", "per14", ccm(CCM_CGCR0), 14); |
134 | clk[uart_ipg_per] = imx_clk_gate("uart_ipg_per", "per15", ccm(CCM_CGCR0), 15); | 134 | clk[uart_ipg_per] = imx_clk_gate("uart_ipg_per", "per15", ccm(CCM_CGCR0), 15); |
diff --git a/arch/arm/mach-imx/clk-imx27.c b/arch/arm/mach-imx/clk-imx27.c index 3b6b640eed24..366e5d59d886 100644 --- a/arch/arm/mach-imx/clk-imx27.c +++ b/arch/arm/mach-imx/clk-imx27.c | |||
@@ -109,7 +109,7 @@ int __init mx27_clocks_init(unsigned long fref) | |||
109 | clk[per3_div] = imx_clk_divider("per3_div", "mpll_main2", CCM_PCDR1, 16, 6); | 109 | clk[per3_div] = imx_clk_divider("per3_div", "mpll_main2", CCM_PCDR1, 16, 6); |
110 | clk[per4_div] = imx_clk_divider("per4_div", "mpll_main2", CCM_PCDR1, 24, 6); | 110 | clk[per4_div] = imx_clk_divider("per4_div", "mpll_main2", CCM_PCDR1, 24, 6); |
111 | clk[vpu_sel] = imx_clk_mux("vpu_sel", CCM_CSCR, 21, 1, vpu_sel_clks, ARRAY_SIZE(vpu_sel_clks)); | 111 | clk[vpu_sel] = imx_clk_mux("vpu_sel", CCM_CSCR, 21, 1, vpu_sel_clks, ARRAY_SIZE(vpu_sel_clks)); |
112 | clk[vpu_div] = imx_clk_divider("vpu_div", "vpu_sel", CCM_PCDR0, 10, 3); | 112 | clk[vpu_div] = imx_clk_divider("vpu_div", "vpu_sel", CCM_PCDR0, 10, 6); |
113 | clk[usb_div] = imx_clk_divider("usb_div", "spll", CCM_CSCR, 28, 3); | 113 | clk[usb_div] = imx_clk_divider("usb_div", "spll", CCM_CSCR, 28, 3); |
114 | clk[cpu_sel] = imx_clk_mux("cpu_sel", CCM_CSCR, 15, 1, cpu_sel_clks, ARRAY_SIZE(cpu_sel_clks)); | 114 | clk[cpu_sel] = imx_clk_mux("cpu_sel", CCM_CSCR, 15, 1, cpu_sel_clks, ARRAY_SIZE(cpu_sel_clks)); |
115 | clk[clko_sel] = imx_clk_mux("clko_sel", CCM_CCSR, 0, 5, clko_sel_clks, ARRAY_SIZE(clko_sel_clks)); | 115 | clk[clko_sel] = imx_clk_mux("clko_sel", CCM_CCSR, 0, 5, clko_sel_clks, ARRAY_SIZE(clko_sel_clks)); |
@@ -121,7 +121,7 @@ int __init mx27_clocks_init(unsigned long fref) | |||
121 | clk[ssi1_sel] = imx_clk_mux("ssi1_sel", CCM_CSCR, 22, 1, ssi_sel_clks, ARRAY_SIZE(ssi_sel_clks)); | 121 | clk[ssi1_sel] = imx_clk_mux("ssi1_sel", CCM_CSCR, 22, 1, ssi_sel_clks, ARRAY_SIZE(ssi_sel_clks)); |
122 | clk[ssi2_sel] = imx_clk_mux("ssi2_sel", CCM_CSCR, 23, 1, ssi_sel_clks, ARRAY_SIZE(ssi_sel_clks)); | 122 | clk[ssi2_sel] = imx_clk_mux("ssi2_sel", CCM_CSCR, 23, 1, ssi_sel_clks, ARRAY_SIZE(ssi_sel_clks)); |
123 | clk[ssi1_div] = imx_clk_divider("ssi1_div", "ssi1_sel", CCM_PCDR0, 16, 6); | 123 | clk[ssi1_div] = imx_clk_divider("ssi1_div", "ssi1_sel", CCM_PCDR0, 16, 6); |
124 | clk[ssi2_div] = imx_clk_divider("ssi2_div", "ssi2_sel", CCM_PCDR0, 26, 3); | 124 | clk[ssi2_div] = imx_clk_divider("ssi2_div", "ssi2_sel", CCM_PCDR0, 26, 6); |
125 | clk[clko_en] = imx_clk_gate("clko_en", "clko_div", CCM_PCCR0, 0); | 125 | clk[clko_en] = imx_clk_gate("clko_en", "clko_div", CCM_PCCR0, 0); |
126 | clk[ssi2_ipg_gate] = imx_clk_gate("ssi2_ipg_gate", "ipg", CCM_PCCR0, 0); | 126 | clk[ssi2_ipg_gate] = imx_clk_gate("ssi2_ipg_gate", "ipg", CCM_PCCR0, 0); |
127 | clk[ssi1_ipg_gate] = imx_clk_gate("ssi1_ipg_gate", "ipg", CCM_PCCR0, 1); | 127 | clk[ssi1_ipg_gate] = imx_clk_gate("ssi1_ipg_gate", "ipg", CCM_PCCR0, 1); |
diff --git a/arch/arm/mach-imx/mm-imx3.c b/arch/arm/mach-imx/mm-imx3.c index 9d2c843bde02..b5deb0554552 100644 --- a/arch/arm/mach-imx/mm-imx3.c +++ b/arch/arm/mach-imx/mm-imx3.c | |||
@@ -108,9 +108,8 @@ void __init imx3_init_l2x0(void) | |||
108 | } | 108 | } |
109 | 109 | ||
110 | l2x0_base = ioremap(MX3x_L2CC_BASE_ADDR, 4096); | 110 | l2x0_base = ioremap(MX3x_L2CC_BASE_ADDR, 4096); |
111 | if (IS_ERR(l2x0_base)) { | 111 | if (!l2x0_base) { |
112 | printk(KERN_ERR "remapping L2 cache area failed with %ld\n", | 112 | printk(KERN_ERR "remapping L2 cache area failed\n"); |
113 | PTR_ERR(l2x0_base)); | ||
114 | return; | 113 | return; |
115 | } | 114 | } |
116 | 115 | ||
diff --git a/arch/arm/mach-omap2/Kconfig b/arch/arm/mach-omap2/Kconfig index 2a1a898c7f90..d669e227e00c 100644 --- a/arch/arm/mach-omap2/Kconfig +++ b/arch/arm/mach-omap2/Kconfig | |||
@@ -11,7 +11,6 @@ config ARCH_OMAP2PLUS_TYPICAL | |||
11 | select I2C_OMAP | 11 | select I2C_OMAP |
12 | select MENELAUS if ARCH_OMAP2 | 12 | select MENELAUS if ARCH_OMAP2 |
13 | select NEON if ARCH_OMAP3 || ARCH_OMAP4 || SOC_OMAP5 | 13 | select NEON if ARCH_OMAP3 || ARCH_OMAP4 || SOC_OMAP5 |
14 | select PINCTRL | ||
15 | select PM_RUNTIME | 14 | select PM_RUNTIME |
16 | select REGULATOR | 15 | select REGULATOR |
17 | select SERIAL_OMAP | 16 | select SERIAL_OMAP |
diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c index 8471c279ecd8..22c483d5dfa8 100644 --- a/arch/arm/mach-omap2/board-omap3beagle.c +++ b/arch/arm/mach-omap2/board-omap3beagle.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/input.h> | 24 | #include <linux/input.h> |
25 | #include <linux/gpio_keys.h> | 25 | #include <linux/gpio_keys.h> |
26 | #include <linux/opp.h> | 26 | #include <linux/opp.h> |
27 | #include <linux/cpu.h> | ||
27 | 28 | ||
28 | #include <linux/mtd/mtd.h> | 29 | #include <linux/mtd/mtd.h> |
29 | #include <linux/mtd/partitions.h> | 30 | #include <linux/mtd/partitions.h> |
@@ -447,27 +448,31 @@ static struct omap_board_mux board_mux[] __initdata = { | |||
447 | }; | 448 | }; |
448 | #endif | 449 | #endif |
449 | 450 | ||
450 | static void __init beagle_opp_init(void) | 451 | static int __init beagle_opp_init(void) |
451 | { | 452 | { |
452 | int r = 0; | 453 | int r = 0; |
453 | 454 | ||
454 | /* Initialize the omap3 opp table */ | 455 | if (!machine_is_omap3_beagle()) |
455 | if (omap3_opp_init()) { | 456 | return 0; |
457 | |||
458 | /* Initialize the omap3 opp table if not already created. */ | ||
459 | r = omap3_opp_init(); | ||
460 | if (IS_ERR_VALUE(r) && (r != -EEXIST)) { | ||
456 | pr_err("%s: opp default init failed\n", __func__); | 461 | pr_err("%s: opp default init failed\n", __func__); |
457 | return; | 462 | return r; |
458 | } | 463 | } |
459 | 464 | ||
460 | /* Custom OPP enabled for all xM versions */ | 465 | /* Custom OPP enabled for all xM versions */ |
461 | if (cpu_is_omap3630()) { | 466 | if (cpu_is_omap3630()) { |
462 | struct device *mpu_dev, *iva_dev; | 467 | struct device *mpu_dev, *iva_dev; |
463 | 468 | ||
464 | mpu_dev = omap_device_get_by_hwmod_name("mpu"); | 469 | mpu_dev = get_cpu_device(0); |
465 | iva_dev = omap_device_get_by_hwmod_name("iva"); | 470 | iva_dev = omap_device_get_by_hwmod_name("iva"); |
466 | 471 | ||
467 | if (IS_ERR(mpu_dev) || IS_ERR(iva_dev)) { | 472 | if (IS_ERR(mpu_dev) || IS_ERR(iva_dev)) { |
468 | pr_err("%s: Aiee.. no mpu/dsp devices? %p %p\n", | 473 | pr_err("%s: Aiee.. no mpu/dsp devices? %p %p\n", |
469 | __func__, mpu_dev, iva_dev); | 474 | __func__, mpu_dev, iva_dev); |
470 | return; | 475 | return -ENODEV; |
471 | } | 476 | } |
472 | /* Enable MPU 1GHz and lower opps */ | 477 | /* Enable MPU 1GHz and lower opps */ |
473 | r = opp_enable(mpu_dev, 800000000); | 478 | r = opp_enable(mpu_dev, 800000000); |
@@ -487,8 +492,9 @@ static void __init beagle_opp_init(void) | |||
487 | opp_disable(iva_dev, 660000000); | 492 | opp_disable(iva_dev, 660000000); |
488 | } | 493 | } |
489 | } | 494 | } |
490 | return; | 495 | return 0; |
491 | } | 496 | } |
497 | device_initcall(beagle_opp_init); | ||
492 | 498 | ||
493 | static void __init omap3_beagle_init(void) | 499 | static void __init omap3_beagle_init(void) |
494 | { | 500 | { |
@@ -526,8 +532,6 @@ static void __init omap3_beagle_init(void) | |||
526 | /* Ensure SDRC pins are mux'd for self-refresh */ | 532 | /* Ensure SDRC pins are mux'd for self-refresh */ |
527 | omap_mux_init_signal("sdrc_cke0", OMAP_PIN_OUTPUT); | 533 | omap_mux_init_signal("sdrc_cke0", OMAP_PIN_OUTPUT); |
528 | omap_mux_init_signal("sdrc_cke1", OMAP_PIN_OUTPUT); | 534 | omap_mux_init_signal("sdrc_cke1", OMAP_PIN_OUTPUT); |
529 | |||
530 | beagle_opp_init(); | ||
531 | } | 535 | } |
532 | 536 | ||
533 | MACHINE_START(OMAP3_BEAGLE, "OMAP3 Beagle Board") | 537 | MACHINE_START(OMAP3_BEAGLE, "OMAP3 Beagle Board") |
diff --git a/arch/arm/mach-omap2/clock33xx_data.c b/arch/arm/mach-omap2/clock33xx_data.c index 1cb79cc58089..2f26fa961da5 100644 --- a/arch/arm/mach-omap2/clock33xx_data.c +++ b/arch/arm/mach-omap2/clock33xx_data.c | |||
@@ -547,16 +547,16 @@ static struct clk mcasp1_fck = { | |||
547 | .recalc = &followparent_recalc, | 547 | .recalc = &followparent_recalc, |
548 | }; | 548 | }; |
549 | 549 | ||
550 | static struct clk smartreflex0_fck = { | 550 | static struct clk smartreflex_mpu_fck = { |
551 | .name = "smartreflex0_fck", | 551 | .name = "smartreflex_mpu_fck", |
552 | .clkdm_name = "l4_wkup_clkdm", | 552 | .clkdm_name = "l4_wkup_clkdm", |
553 | .parent = &sys_clkin_ck, | 553 | .parent = &sys_clkin_ck, |
554 | .ops = &clkops_null, | 554 | .ops = &clkops_null, |
555 | .recalc = &followparent_recalc, | 555 | .recalc = &followparent_recalc, |
556 | }; | 556 | }; |
557 | 557 | ||
558 | static struct clk smartreflex1_fck = { | 558 | static struct clk smartreflex_core_fck = { |
559 | .name = "smartreflex1_fck", | 559 | .name = "smartreflex_core_fck", |
560 | .clkdm_name = "l4_wkup_clkdm", | 560 | .clkdm_name = "l4_wkup_clkdm", |
561 | .parent = &sys_clkin_ck, | 561 | .parent = &sys_clkin_ck, |
562 | .ops = &clkops_null, | 562 | .ops = &clkops_null, |
@@ -1038,8 +1038,8 @@ static struct omap_clk am33xx_clks[] = { | |||
1038 | CLK(NULL, "mcasp1_fck", &mcasp1_fck, CK_AM33XX), | 1038 | CLK(NULL, "mcasp1_fck", &mcasp1_fck, CK_AM33XX), |
1039 | CLK("NULL", "mmc2_fck", &mmc2_fck, CK_AM33XX), | 1039 | CLK("NULL", "mmc2_fck", &mmc2_fck, CK_AM33XX), |
1040 | CLK(NULL, "mmu_fck", &mmu_fck, CK_AM33XX), | 1040 | CLK(NULL, "mmu_fck", &mmu_fck, CK_AM33XX), |
1041 | CLK(NULL, "smartreflex0_fck", &smartreflex0_fck, CK_AM33XX), | 1041 | CLK(NULL, "smartreflex_mpu_fck", &smartreflex_mpu_fck, CK_AM33XX), |
1042 | CLK(NULL, "smartreflex1_fck", &smartreflex1_fck, CK_AM33XX), | 1042 | CLK(NULL, "smartreflex_core_fck", &smartreflex_core_fck, CK_AM33XX), |
1043 | CLK(NULL, "timer1_fck", &timer1_fck, CK_AM33XX), | 1043 | CLK(NULL, "timer1_fck", &timer1_fck, CK_AM33XX), |
1044 | CLK(NULL, "timer2_fck", &timer2_fck, CK_AM33XX), | 1044 | CLK(NULL, "timer2_fck", &timer2_fck, CK_AM33XX), |
1045 | CLK(NULL, "timer3_fck", &timer3_fck, CK_AM33XX), | 1045 | CLK(NULL, "timer3_fck", &timer3_fck, CK_AM33XX), |
@@ -1072,6 +1072,8 @@ static struct omap_clk am33xx_clks[] = { | |||
1072 | CLK(NULL, "gfx_fck_div_ck", &gfx_fck_div_ck, CK_AM33XX), | 1072 | CLK(NULL, "gfx_fck_div_ck", &gfx_fck_div_ck, CK_AM33XX), |
1073 | CLK(NULL, "sysclkout_pre_ck", &sysclkout_pre_ck, CK_AM33XX), | 1073 | CLK(NULL, "sysclkout_pre_ck", &sysclkout_pre_ck, CK_AM33XX), |
1074 | CLK(NULL, "clkout2_ck", &clkout2_ck, CK_AM33XX), | 1074 | CLK(NULL, "clkout2_ck", &clkout2_ck, CK_AM33XX), |
1075 | CLK(NULL, "timer_32k_ck", &clkdiv32k_ick, CK_AM33XX), | ||
1076 | CLK(NULL, "timer_sys_ck", &sys_clkin_ck, CK_AM33XX), | ||
1075 | }; | 1077 | }; |
1076 | 1078 | ||
1077 | int __init am33xx_clk_init(void) | 1079 | int __init am33xx_clk_init(void) |
diff --git a/arch/arm/mach-omap2/clock3xxx_data.c b/arch/arm/mach-omap2/clock3xxx_data.c index 6cca19953950..a1dc872fd3ef 100644 --- a/arch/arm/mach-omap2/clock3xxx_data.c +++ b/arch/arm/mach-omap2/clock3xxx_data.c | |||
@@ -3048,8 +3048,8 @@ static struct clk traceclk_fck = { | |||
3048 | /* SR clocks */ | 3048 | /* SR clocks */ |
3049 | 3049 | ||
3050 | /* SmartReflex fclk (VDD1) */ | 3050 | /* SmartReflex fclk (VDD1) */ |
3051 | static struct clk sr1_fck = { | 3051 | static struct clk smartreflex_mpu_iva_fck = { |
3052 | .name = "sr1_fck", | 3052 | .name = "smartreflex_mpu_iva_fck", |
3053 | .ops = &clkops_omap2_dflt_wait, | 3053 | .ops = &clkops_omap2_dflt_wait, |
3054 | .parent = &sys_ck, | 3054 | .parent = &sys_ck, |
3055 | .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN), | 3055 | .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN), |
@@ -3059,8 +3059,8 @@ static struct clk sr1_fck = { | |||
3059 | }; | 3059 | }; |
3060 | 3060 | ||
3061 | /* SmartReflex fclk (VDD2) */ | 3061 | /* SmartReflex fclk (VDD2) */ |
3062 | static struct clk sr2_fck = { | 3062 | static struct clk smartreflex_core_fck = { |
3063 | .name = "sr2_fck", | 3063 | .name = "smartreflex_core_fck", |
3064 | .ops = &clkops_omap2_dflt_wait, | 3064 | .ops = &clkops_omap2_dflt_wait, |
3065 | .parent = &sys_ck, | 3065 | .parent = &sys_ck, |
3066 | .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN), | 3066 | .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN), |
@@ -3476,8 +3476,8 @@ static struct omap_clk omap3xxx_clks[] = { | |||
3476 | CLK(NULL, "atclk_fck", &atclk_fck, CK_3XXX), | 3476 | CLK(NULL, "atclk_fck", &atclk_fck, CK_3XXX), |
3477 | CLK(NULL, "traceclk_src_fck", &traceclk_src_fck, CK_3XXX), | 3477 | CLK(NULL, "traceclk_src_fck", &traceclk_src_fck, CK_3XXX), |
3478 | CLK(NULL, "traceclk_fck", &traceclk_fck, CK_3XXX), | 3478 | CLK(NULL, "traceclk_fck", &traceclk_fck, CK_3XXX), |
3479 | CLK(NULL, "sr1_fck", &sr1_fck, CK_34XX | CK_36XX), | 3479 | CLK(NULL, "smartreflex_mpu_iva_fck", &smartreflex_mpu_iva_fck, CK_34XX | CK_36XX), |
3480 | CLK(NULL, "sr2_fck", &sr2_fck, CK_34XX | CK_36XX), | 3480 | CLK(NULL, "smartreflex_core_fck", &smartreflex_core_fck, CK_34XX | CK_36XX), |
3481 | CLK(NULL, "sr_l4_ick", &sr_l4_ick, CK_34XX | CK_36XX), | 3481 | CLK(NULL, "sr_l4_ick", &sr_l4_ick, CK_34XX | CK_36XX), |
3482 | CLK(NULL, "secure_32k_fck", &secure_32k_fck, CK_3XXX), | 3482 | CLK(NULL, "secure_32k_fck", &secure_32k_fck, CK_3XXX), |
3483 | CLK(NULL, "gpt12_fck", &gpt12_fck, CK_3XXX), | 3483 | CLK(NULL, "gpt12_fck", &gpt12_fck, CK_3XXX), |
diff --git a/arch/arm/mach-omap2/clock44xx_data.c b/arch/arm/mach-omap2/clock44xx_data.c index 2a450c9b9a7b..531ba1dd0050 100644 --- a/arch/arm/mach-omap2/clock44xx_data.c +++ b/arch/arm/mach-omap2/clock44xx_data.c | |||
@@ -3224,9 +3224,9 @@ static struct omap_clk omap44xx_clks[] = { | |||
3224 | CLK(NULL, "slimbus2_fclk_0", &slimbus2_fclk_0, CK_443X), | 3224 | CLK(NULL, "slimbus2_fclk_0", &slimbus2_fclk_0, CK_443X), |
3225 | CLK(NULL, "slimbus2_slimbus_clk", &slimbus2_slimbus_clk, CK_443X), | 3225 | CLK(NULL, "slimbus2_slimbus_clk", &slimbus2_slimbus_clk, CK_443X), |
3226 | CLK(NULL, "slimbus2_fck", &slimbus2_fck, CK_443X), | 3226 | CLK(NULL, "slimbus2_fck", &slimbus2_fck, CK_443X), |
3227 | CLK(NULL, "smartreflex_core_fck", &smartreflex_core_fck, CK_443X), | 3227 | CLK(NULL, "smartreflex_core_fck", &smartreflex_core_fck, CK_443X), |
3228 | CLK(NULL, "smartreflex_iva_fck", &smartreflex_iva_fck, CK_443X), | 3228 | CLK(NULL, "smartreflex_iva_fck", &smartreflex_iva_fck, CK_443X), |
3229 | CLK(NULL, "smartreflex_mpu_fck", &smartreflex_mpu_fck, CK_443X), | 3229 | CLK(NULL, "smartreflex_mpu_fck", &smartreflex_mpu_fck, CK_443X), |
3230 | CLK(NULL, "timer1_fck", &timer1_fck, CK_443X), | 3230 | CLK(NULL, "timer1_fck", &timer1_fck, CK_443X), |
3231 | CLK(NULL, "timer10_fck", &timer10_fck, CK_443X), | 3231 | CLK(NULL, "timer10_fck", &timer10_fck, CK_443X), |
3232 | CLK(NULL, "timer11_fck", &timer11_fck, CK_443X), | 3232 | CLK(NULL, "timer11_fck", &timer11_fck, CK_443X), |
diff --git a/arch/arm/mach-omap2/control.h b/arch/arm/mach-omap2/control.h index 4ca8747b3cc9..3d944d3263d2 100644 --- a/arch/arm/mach-omap2/control.h +++ b/arch/arm/mach-omap2/control.h | |||
@@ -201,6 +201,7 @@ | |||
201 | #define OMAP44XX_CONTROL_FUSE_MPU_OPPNITRO 0x249 | 201 | #define OMAP44XX_CONTROL_FUSE_MPU_OPPNITRO 0x249 |
202 | #define OMAP44XX_CONTROL_FUSE_CORE_OPP50 0x254 | 202 | #define OMAP44XX_CONTROL_FUSE_CORE_OPP50 0x254 |
203 | #define OMAP44XX_CONTROL_FUSE_CORE_OPP100 0x257 | 203 | #define OMAP44XX_CONTROL_FUSE_CORE_OPP100 0x257 |
204 | #define OMAP44XX_CONTROL_FUSE_CORE_OPP100OV 0x25A | ||
204 | 205 | ||
205 | /* AM35XX only CONTROL_GENERAL register offsets */ | 206 | /* AM35XX only CONTROL_GENERAL register offsets */ |
206 | #define AM35XX_CONTROL_MSUSPENDMUX_6 (OMAP2_CONTROL_GENERAL + 0x0038) | 207 | #define AM35XX_CONTROL_MSUSPENDMUX_6 (OMAP2_CONTROL_GENERAL + 0x0038) |
diff --git a/arch/arm/mach-omap2/mux34xx.c b/arch/arm/mach-omap2/mux34xx.c index 17f80e4ab162..c47140bbbec4 100644 --- a/arch/arm/mach-omap2/mux34xx.c +++ b/arch/arm/mach-omap2/mux34xx.c | |||
@@ -614,16 +614,16 @@ static struct omap_mux __initdata omap3_muxmodes[] = { | |||
614 | "sys_off_mode", NULL, NULL, NULL, | 614 | "sys_off_mode", NULL, NULL, NULL, |
615 | "gpio_9", NULL, NULL, "safe_mode"), | 615 | "gpio_9", NULL, NULL, "safe_mode"), |
616 | _OMAP3_MUXENTRY(UART1_CTS, 150, | 616 | _OMAP3_MUXENTRY(UART1_CTS, 150, |
617 | "uart1_cts", NULL, NULL, NULL, | 617 | "uart1_cts", "ssi1_rdy_tx", NULL, NULL, |
618 | "gpio_150", "hsusb3_tll_clk", NULL, "safe_mode"), | 618 | "gpio_150", "hsusb3_tll_clk", NULL, "safe_mode"), |
619 | _OMAP3_MUXENTRY(UART1_RTS, 149, | 619 | _OMAP3_MUXENTRY(UART1_RTS, 149, |
620 | "uart1_rts", NULL, NULL, NULL, | 620 | "uart1_rts", "ssi1_flag_tx", NULL, NULL, |
621 | "gpio_149", NULL, NULL, "safe_mode"), | 621 | "gpio_149", NULL, NULL, "safe_mode"), |
622 | _OMAP3_MUXENTRY(UART1_RX, 151, | 622 | _OMAP3_MUXENTRY(UART1_RX, 151, |
623 | "uart1_rx", NULL, "mcbsp1_clkr", "mcspi4_clk", | 623 | "uart1_rx", "ss1_wake_tx", "mcbsp1_clkr", "mcspi4_clk", |
624 | "gpio_151", NULL, NULL, "safe_mode"), | 624 | "gpio_151", NULL, NULL, "safe_mode"), |
625 | _OMAP3_MUXENTRY(UART1_TX, 148, | 625 | _OMAP3_MUXENTRY(UART1_TX, 148, |
626 | "uart1_tx", NULL, NULL, NULL, | 626 | "uart1_tx", "ssi1_dat_tx", NULL, NULL, |
627 | "gpio_148", NULL, NULL, "safe_mode"), | 627 | "gpio_148", NULL, NULL, "safe_mode"), |
628 | _OMAP3_MUXENTRY(UART2_CTS, 144, | 628 | _OMAP3_MUXENTRY(UART2_CTS, 144, |
629 | "uart2_cts", "mcbsp3_dx", "gpt9_pwm_evt", NULL, | 629 | "uart2_cts", "mcbsp3_dx", "gpt9_pwm_evt", NULL, |
diff --git a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c index abe66ced903f..53621fc98496 100644 --- a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c | |||
@@ -1410,7 +1410,7 @@ static struct omap_hwmod_irq_info omap3_smartreflex_mpu_irqs[] = { | |||
1410 | static struct omap_hwmod omap34xx_sr1_hwmod = { | 1410 | static struct omap_hwmod omap34xx_sr1_hwmod = { |
1411 | .name = "smartreflex_mpu_iva", | 1411 | .name = "smartreflex_mpu_iva", |
1412 | .class = &omap34xx_smartreflex_hwmod_class, | 1412 | .class = &omap34xx_smartreflex_hwmod_class, |
1413 | .main_clk = "sr1_fck", | 1413 | .main_clk = "smartreflex_mpu_iva_fck", |
1414 | .prcm = { | 1414 | .prcm = { |
1415 | .omap2 = { | 1415 | .omap2 = { |
1416 | .prcm_reg_id = 1, | 1416 | .prcm_reg_id = 1, |
@@ -1428,7 +1428,7 @@ static struct omap_hwmod omap34xx_sr1_hwmod = { | |||
1428 | static struct omap_hwmod omap36xx_sr1_hwmod = { | 1428 | static struct omap_hwmod omap36xx_sr1_hwmod = { |
1429 | .name = "smartreflex_mpu_iva", | 1429 | .name = "smartreflex_mpu_iva", |
1430 | .class = &omap36xx_smartreflex_hwmod_class, | 1430 | .class = &omap36xx_smartreflex_hwmod_class, |
1431 | .main_clk = "sr1_fck", | 1431 | .main_clk = "smartreflex_mpu_iva_fck", |
1432 | .prcm = { | 1432 | .prcm = { |
1433 | .omap2 = { | 1433 | .omap2 = { |
1434 | .prcm_reg_id = 1, | 1434 | .prcm_reg_id = 1, |
@@ -1455,7 +1455,7 @@ static struct omap_hwmod_irq_info omap3_smartreflex_core_irqs[] = { | |||
1455 | static struct omap_hwmod omap34xx_sr2_hwmod = { | 1455 | static struct omap_hwmod omap34xx_sr2_hwmod = { |
1456 | .name = "smartreflex_core", | 1456 | .name = "smartreflex_core", |
1457 | .class = &omap34xx_smartreflex_hwmod_class, | 1457 | .class = &omap34xx_smartreflex_hwmod_class, |
1458 | .main_clk = "sr2_fck", | 1458 | .main_clk = "smartreflex_core_fck", |
1459 | .prcm = { | 1459 | .prcm = { |
1460 | .omap2 = { | 1460 | .omap2 = { |
1461 | .prcm_reg_id = 1, | 1461 | .prcm_reg_id = 1, |
@@ -1473,7 +1473,7 @@ static struct omap_hwmod omap34xx_sr2_hwmod = { | |||
1473 | static struct omap_hwmod omap36xx_sr2_hwmod = { | 1473 | static struct omap_hwmod omap36xx_sr2_hwmod = { |
1474 | .name = "smartreflex_core", | 1474 | .name = "smartreflex_core", |
1475 | .class = &omap36xx_smartreflex_hwmod_class, | 1475 | .class = &omap36xx_smartreflex_hwmod_class, |
1476 | .main_clk = "sr2_fck", | 1476 | .main_clk = "smartreflex_core_fck", |
1477 | .prcm = { | 1477 | .prcm = { |
1478 | .omap2 = { | 1478 | .omap2 = { |
1479 | .prcm_reg_id = 1, | 1479 | .prcm_reg_id = 1, |
diff --git a/arch/arm/mach-omap2/omap_opp_data.h b/arch/arm/mach-omap2/omap_opp_data.h index 7e437bf6024c..336fdfcf88bb 100644 --- a/arch/arm/mach-omap2/omap_opp_data.h +++ b/arch/arm/mach-omap2/omap_opp_data.h | |||
@@ -89,8 +89,11 @@ extern struct omap_volt_data omap34xx_vddcore_volt_data[]; | |||
89 | extern struct omap_volt_data omap36xx_vddmpu_volt_data[]; | 89 | extern struct omap_volt_data omap36xx_vddmpu_volt_data[]; |
90 | extern struct omap_volt_data omap36xx_vddcore_volt_data[]; | 90 | extern struct omap_volt_data omap36xx_vddcore_volt_data[]; |
91 | 91 | ||
92 | extern struct omap_volt_data omap44xx_vdd_mpu_volt_data[]; | 92 | extern struct omap_volt_data omap443x_vdd_mpu_volt_data[]; |
93 | extern struct omap_volt_data omap44xx_vdd_iva_volt_data[]; | 93 | extern struct omap_volt_data omap443x_vdd_iva_volt_data[]; |
94 | extern struct omap_volt_data omap44xx_vdd_core_volt_data[]; | 94 | extern struct omap_volt_data omap443x_vdd_core_volt_data[]; |
95 | extern struct omap_volt_data omap446x_vdd_mpu_volt_data[]; | ||
96 | extern struct omap_volt_data omap446x_vdd_iva_volt_data[]; | ||
97 | extern struct omap_volt_data omap446x_vdd_core_volt_data[]; | ||
95 | 98 | ||
96 | #endif /* __ARCH_ARM_MACH_OMAP2_OMAP_OPP_DATA_H */ | 99 | #endif /* __ARCH_ARM_MACH_OMAP2_OMAP_OPP_DATA_H */ |
diff --git a/arch/arm/mach-omap2/omap_twl.c b/arch/arm/mach-omap2/omap_twl.c index 2bf35dc091be..fefd40166624 100644 --- a/arch/arm/mach-omap2/omap_twl.c +++ b/arch/arm/mach-omap2/omap_twl.c | |||
@@ -31,16 +31,6 @@ | |||
31 | #define OMAP3_VP_VSTEPMAX_VSTEPMAX 0x04 | 31 | #define OMAP3_VP_VSTEPMAX_VSTEPMAX 0x04 |
32 | #define OMAP3_VP_VLIMITTO_TIMEOUT_US 200 | 32 | #define OMAP3_VP_VLIMITTO_TIMEOUT_US 200 |
33 | 33 | ||
34 | #define OMAP3430_VP1_VLIMITTO_VDDMIN 0x14 | ||
35 | #define OMAP3430_VP1_VLIMITTO_VDDMAX 0x42 | ||
36 | #define OMAP3430_VP2_VLIMITTO_VDDMIN 0x18 | ||
37 | #define OMAP3430_VP2_VLIMITTO_VDDMAX 0x2c | ||
38 | |||
39 | #define OMAP3630_VP1_VLIMITTO_VDDMIN 0x18 | ||
40 | #define OMAP3630_VP1_VLIMITTO_VDDMAX 0x3c | ||
41 | #define OMAP3630_VP2_VLIMITTO_VDDMIN 0x18 | ||
42 | #define OMAP3630_VP2_VLIMITTO_VDDMAX 0x30 | ||
43 | |||
44 | #define OMAP4_SRI2C_SLAVE_ADDR 0x12 | 34 | #define OMAP4_SRI2C_SLAVE_ADDR 0x12 |
45 | #define OMAP4_VDD_MPU_SR_VOLT_REG 0x55 | 35 | #define OMAP4_VDD_MPU_SR_VOLT_REG 0x55 |
46 | #define OMAP4_VDD_MPU_SR_CMD_REG 0x56 | 36 | #define OMAP4_VDD_MPU_SR_CMD_REG 0x56 |
@@ -54,13 +44,6 @@ | |||
54 | #define OMAP4_VP_VSTEPMAX_VSTEPMAX 0x04 | 44 | #define OMAP4_VP_VSTEPMAX_VSTEPMAX 0x04 |
55 | #define OMAP4_VP_VLIMITTO_TIMEOUT_US 200 | 45 | #define OMAP4_VP_VLIMITTO_TIMEOUT_US 200 |
56 | 46 | ||
57 | #define OMAP4_VP_MPU_VLIMITTO_VDDMIN 0xA | ||
58 | #define OMAP4_VP_MPU_VLIMITTO_VDDMAX 0x39 | ||
59 | #define OMAP4_VP_IVA_VLIMITTO_VDDMIN 0xA | ||
60 | #define OMAP4_VP_IVA_VLIMITTO_VDDMAX 0x2D | ||
61 | #define OMAP4_VP_CORE_VLIMITTO_VDDMIN 0xA | ||
62 | #define OMAP4_VP_CORE_VLIMITTO_VDDMAX 0x28 | ||
63 | |||
64 | static bool is_offset_valid; | 47 | static bool is_offset_valid; |
65 | static u8 smps_offset; | 48 | static u8 smps_offset; |
66 | /* | 49 | /* |
@@ -159,16 +142,11 @@ static u8 twl6030_uv_to_vsel(unsigned long uv) | |||
159 | static struct omap_voltdm_pmic omap3_mpu_pmic = { | 142 | static struct omap_voltdm_pmic omap3_mpu_pmic = { |
160 | .slew_rate = 4000, | 143 | .slew_rate = 4000, |
161 | .step_size = 12500, | 144 | .step_size = 12500, |
162 | .on_volt = 1200000, | ||
163 | .onlp_volt = 1000000, | ||
164 | .ret_volt = 975000, | ||
165 | .off_volt = 600000, | ||
166 | .volt_setup_time = 0xfff, | ||
167 | .vp_erroroffset = OMAP3_VP_CONFIG_ERROROFFSET, | 145 | .vp_erroroffset = OMAP3_VP_CONFIG_ERROROFFSET, |
168 | .vp_vstepmin = OMAP3_VP_VSTEPMIN_VSTEPMIN, | 146 | .vp_vstepmin = OMAP3_VP_VSTEPMIN_VSTEPMIN, |
169 | .vp_vstepmax = OMAP3_VP_VSTEPMAX_VSTEPMAX, | 147 | .vp_vstepmax = OMAP3_VP_VSTEPMAX_VSTEPMAX, |
170 | .vp_vddmin = OMAP3430_VP1_VLIMITTO_VDDMIN, | 148 | .vddmin = 600000, |
171 | .vp_vddmax = OMAP3430_VP1_VLIMITTO_VDDMAX, | 149 | .vddmax = 1450000, |
172 | .vp_timeout_us = OMAP3_VP_VLIMITTO_TIMEOUT_US, | 150 | .vp_timeout_us = OMAP3_VP_VLIMITTO_TIMEOUT_US, |
173 | .i2c_slave_addr = OMAP3_SRI2C_SLAVE_ADDR, | 151 | .i2c_slave_addr = OMAP3_SRI2C_SLAVE_ADDR, |
174 | .volt_reg_addr = OMAP3_VDD_MPU_SR_CONTROL_REG, | 152 | .volt_reg_addr = OMAP3_VDD_MPU_SR_CONTROL_REG, |
@@ -180,16 +158,11 @@ static struct omap_voltdm_pmic omap3_mpu_pmic = { | |||
180 | static struct omap_voltdm_pmic omap3_core_pmic = { | 158 | static struct omap_voltdm_pmic omap3_core_pmic = { |
181 | .slew_rate = 4000, | 159 | .slew_rate = 4000, |
182 | .step_size = 12500, | 160 | .step_size = 12500, |
183 | .on_volt = 1200000, | ||
184 | .onlp_volt = 1000000, | ||
185 | .ret_volt = 975000, | ||
186 | .off_volt = 600000, | ||
187 | .volt_setup_time = 0xfff, | ||
188 | .vp_erroroffset = OMAP3_VP_CONFIG_ERROROFFSET, | 161 | .vp_erroroffset = OMAP3_VP_CONFIG_ERROROFFSET, |
189 | .vp_vstepmin = OMAP3_VP_VSTEPMIN_VSTEPMIN, | 162 | .vp_vstepmin = OMAP3_VP_VSTEPMIN_VSTEPMIN, |
190 | .vp_vstepmax = OMAP3_VP_VSTEPMAX_VSTEPMAX, | 163 | .vp_vstepmax = OMAP3_VP_VSTEPMAX_VSTEPMAX, |
191 | .vp_vddmin = OMAP3430_VP2_VLIMITTO_VDDMIN, | 164 | .vddmin = 600000, |
192 | .vp_vddmax = OMAP3430_VP2_VLIMITTO_VDDMAX, | 165 | .vddmax = 1450000, |
193 | .vp_timeout_us = OMAP3_VP_VLIMITTO_TIMEOUT_US, | 166 | .vp_timeout_us = OMAP3_VP_VLIMITTO_TIMEOUT_US, |
194 | .i2c_slave_addr = OMAP3_SRI2C_SLAVE_ADDR, | 167 | .i2c_slave_addr = OMAP3_SRI2C_SLAVE_ADDR, |
195 | .volt_reg_addr = OMAP3_VDD_CORE_SR_CONTROL_REG, | 168 | .volt_reg_addr = OMAP3_VDD_CORE_SR_CONTROL_REG, |
@@ -201,21 +174,17 @@ static struct omap_voltdm_pmic omap3_core_pmic = { | |||
201 | static struct omap_voltdm_pmic omap4_mpu_pmic = { | 174 | static struct omap_voltdm_pmic omap4_mpu_pmic = { |
202 | .slew_rate = 4000, | 175 | .slew_rate = 4000, |
203 | .step_size = 12660, | 176 | .step_size = 12660, |
204 | .on_volt = 1375000, | ||
205 | .onlp_volt = 1375000, | ||
206 | .ret_volt = 830000, | ||
207 | .off_volt = 0, | ||
208 | .volt_setup_time = 0, | ||
209 | .vp_erroroffset = OMAP4_VP_CONFIG_ERROROFFSET, | 177 | .vp_erroroffset = OMAP4_VP_CONFIG_ERROROFFSET, |
210 | .vp_vstepmin = OMAP4_VP_VSTEPMIN_VSTEPMIN, | 178 | .vp_vstepmin = OMAP4_VP_VSTEPMIN_VSTEPMIN, |
211 | .vp_vstepmax = OMAP4_VP_VSTEPMAX_VSTEPMAX, | 179 | .vp_vstepmax = OMAP4_VP_VSTEPMAX_VSTEPMAX, |
212 | .vp_vddmin = OMAP4_VP_MPU_VLIMITTO_VDDMIN, | 180 | .vddmin = 0, |
213 | .vp_vddmax = OMAP4_VP_MPU_VLIMITTO_VDDMAX, | 181 | .vddmax = 2100000, |
214 | .vp_timeout_us = OMAP4_VP_VLIMITTO_TIMEOUT_US, | 182 | .vp_timeout_us = OMAP4_VP_VLIMITTO_TIMEOUT_US, |
215 | .i2c_slave_addr = OMAP4_SRI2C_SLAVE_ADDR, | 183 | .i2c_slave_addr = OMAP4_SRI2C_SLAVE_ADDR, |
216 | .volt_reg_addr = OMAP4_VDD_MPU_SR_VOLT_REG, | 184 | .volt_reg_addr = OMAP4_VDD_MPU_SR_VOLT_REG, |
217 | .cmd_reg_addr = OMAP4_VDD_MPU_SR_CMD_REG, | 185 | .cmd_reg_addr = OMAP4_VDD_MPU_SR_CMD_REG, |
218 | .i2c_high_speed = true, | 186 | .i2c_high_speed = true, |
187 | .i2c_pad_load = 3, | ||
219 | .vsel_to_uv = twl6030_vsel_to_uv, | 188 | .vsel_to_uv = twl6030_vsel_to_uv, |
220 | .uv_to_vsel = twl6030_uv_to_vsel, | 189 | .uv_to_vsel = twl6030_uv_to_vsel, |
221 | }; | 190 | }; |
@@ -223,21 +192,17 @@ static struct omap_voltdm_pmic omap4_mpu_pmic = { | |||
223 | static struct omap_voltdm_pmic omap4_iva_pmic = { | 192 | static struct omap_voltdm_pmic omap4_iva_pmic = { |
224 | .slew_rate = 4000, | 193 | .slew_rate = 4000, |
225 | .step_size = 12660, | 194 | .step_size = 12660, |
226 | .on_volt = 1188000, | ||
227 | .onlp_volt = 1188000, | ||
228 | .ret_volt = 830000, | ||
229 | .off_volt = 0, | ||
230 | .volt_setup_time = 0, | ||
231 | .vp_erroroffset = OMAP4_VP_CONFIG_ERROROFFSET, | 195 | .vp_erroroffset = OMAP4_VP_CONFIG_ERROROFFSET, |
232 | .vp_vstepmin = OMAP4_VP_VSTEPMIN_VSTEPMIN, | 196 | .vp_vstepmin = OMAP4_VP_VSTEPMIN_VSTEPMIN, |
233 | .vp_vstepmax = OMAP4_VP_VSTEPMAX_VSTEPMAX, | 197 | .vp_vstepmax = OMAP4_VP_VSTEPMAX_VSTEPMAX, |
234 | .vp_vddmin = OMAP4_VP_IVA_VLIMITTO_VDDMIN, | 198 | .vddmin = 0, |
235 | .vp_vddmax = OMAP4_VP_IVA_VLIMITTO_VDDMAX, | 199 | .vddmax = 2100000, |
236 | .vp_timeout_us = OMAP4_VP_VLIMITTO_TIMEOUT_US, | 200 | .vp_timeout_us = OMAP4_VP_VLIMITTO_TIMEOUT_US, |
237 | .i2c_slave_addr = OMAP4_SRI2C_SLAVE_ADDR, | 201 | .i2c_slave_addr = OMAP4_SRI2C_SLAVE_ADDR, |
238 | .volt_reg_addr = OMAP4_VDD_IVA_SR_VOLT_REG, | 202 | .volt_reg_addr = OMAP4_VDD_IVA_SR_VOLT_REG, |
239 | .cmd_reg_addr = OMAP4_VDD_IVA_SR_CMD_REG, | 203 | .cmd_reg_addr = OMAP4_VDD_IVA_SR_CMD_REG, |
240 | .i2c_high_speed = true, | 204 | .i2c_high_speed = true, |
205 | .i2c_pad_load = 3, | ||
241 | .vsel_to_uv = twl6030_vsel_to_uv, | 206 | .vsel_to_uv = twl6030_vsel_to_uv, |
242 | .uv_to_vsel = twl6030_uv_to_vsel, | 207 | .uv_to_vsel = twl6030_uv_to_vsel, |
243 | }; | 208 | }; |
@@ -245,20 +210,17 @@ static struct omap_voltdm_pmic omap4_iva_pmic = { | |||
245 | static struct omap_voltdm_pmic omap4_core_pmic = { | 210 | static struct omap_voltdm_pmic omap4_core_pmic = { |
246 | .slew_rate = 4000, | 211 | .slew_rate = 4000, |
247 | .step_size = 12660, | 212 | .step_size = 12660, |
248 | .on_volt = 1200000, | ||
249 | .onlp_volt = 1200000, | ||
250 | .ret_volt = 830000, | ||
251 | .off_volt = 0, | ||
252 | .volt_setup_time = 0, | ||
253 | .vp_erroroffset = OMAP4_VP_CONFIG_ERROROFFSET, | 213 | .vp_erroroffset = OMAP4_VP_CONFIG_ERROROFFSET, |
254 | .vp_vstepmin = OMAP4_VP_VSTEPMIN_VSTEPMIN, | 214 | .vp_vstepmin = OMAP4_VP_VSTEPMIN_VSTEPMIN, |
255 | .vp_vstepmax = OMAP4_VP_VSTEPMAX_VSTEPMAX, | 215 | .vp_vstepmax = OMAP4_VP_VSTEPMAX_VSTEPMAX, |
256 | .vp_vddmin = OMAP4_VP_CORE_VLIMITTO_VDDMIN, | 216 | .vddmin = 0, |
257 | .vp_vddmax = OMAP4_VP_CORE_VLIMITTO_VDDMAX, | 217 | .vddmax = 2100000, |
258 | .vp_timeout_us = OMAP4_VP_VLIMITTO_TIMEOUT_US, | 218 | .vp_timeout_us = OMAP4_VP_VLIMITTO_TIMEOUT_US, |
259 | .i2c_slave_addr = OMAP4_SRI2C_SLAVE_ADDR, | 219 | .i2c_slave_addr = OMAP4_SRI2C_SLAVE_ADDR, |
260 | .volt_reg_addr = OMAP4_VDD_CORE_SR_VOLT_REG, | 220 | .volt_reg_addr = OMAP4_VDD_CORE_SR_VOLT_REG, |
261 | .cmd_reg_addr = OMAP4_VDD_CORE_SR_CMD_REG, | 221 | .cmd_reg_addr = OMAP4_VDD_CORE_SR_CMD_REG, |
222 | .i2c_high_speed = true, | ||
223 | .i2c_pad_load = 3, | ||
262 | .vsel_to_uv = twl6030_vsel_to_uv, | 224 | .vsel_to_uv = twl6030_vsel_to_uv, |
263 | .uv_to_vsel = twl6030_uv_to_vsel, | 225 | .uv_to_vsel = twl6030_uv_to_vsel, |
264 | }; | 226 | }; |
@@ -289,13 +251,6 @@ int __init omap3_twl_init(void) | |||
289 | if (!cpu_is_omap34xx()) | 251 | if (!cpu_is_omap34xx()) |
290 | return -ENODEV; | 252 | return -ENODEV; |
291 | 253 | ||
292 | if (cpu_is_omap3630()) { | ||
293 | omap3_mpu_pmic.vp_vddmin = OMAP3630_VP1_VLIMITTO_VDDMIN; | ||
294 | omap3_mpu_pmic.vp_vddmax = OMAP3630_VP1_VLIMITTO_VDDMAX; | ||
295 | omap3_core_pmic.vp_vddmin = OMAP3630_VP2_VLIMITTO_VDDMIN; | ||
296 | omap3_core_pmic.vp_vddmax = OMAP3630_VP2_VLIMITTO_VDDMAX; | ||
297 | } | ||
298 | |||
299 | /* | 254 | /* |
300 | * The smartreflex bit on twl4030 specifies if the setting of voltage | 255 | * The smartreflex bit on twl4030 specifies if the setting of voltage |
301 | * is done over the I2C_SR path. Since this setting is independent of | 256 | * is done over the I2C_SR path. Since this setting is independent of |
diff --git a/arch/arm/mach-omap2/opp4xxx_data.c b/arch/arm/mach-omap2/opp4xxx_data.c index a9fd6d5fe79e..d470b728e720 100644 --- a/arch/arm/mach-omap2/opp4xxx_data.c +++ b/arch/arm/mach-omap2/opp4xxx_data.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * OMAP4 OPP table definitions. | 2 | * OMAP4 OPP table definitions. |
3 | * | 3 | * |
4 | * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/ | 4 | * Copyright (C) 2010-2012 Texas Instruments Incorporated - http://www.ti.com/ |
5 | * Nishanth Menon | 5 | * Nishanth Menon |
6 | * Kevin Hilman | 6 | * Kevin Hilman |
7 | * Thara Gopinath | 7 | * Thara Gopinath |
@@ -35,7 +35,7 @@ | |||
35 | #define OMAP4430_VDD_MPU_OPPTURBO_UV 1313000 | 35 | #define OMAP4430_VDD_MPU_OPPTURBO_UV 1313000 |
36 | #define OMAP4430_VDD_MPU_OPPNITRO_UV 1375000 | 36 | #define OMAP4430_VDD_MPU_OPPNITRO_UV 1375000 |
37 | 37 | ||
38 | struct omap_volt_data omap44xx_vdd_mpu_volt_data[] = { | 38 | struct omap_volt_data omap443x_vdd_mpu_volt_data[] = { |
39 | VOLT_DATA_DEFINE(OMAP4430_VDD_MPU_OPP50_UV, OMAP44XX_CONTROL_FUSE_MPU_OPP50, 0xf4, 0x0c), | 39 | VOLT_DATA_DEFINE(OMAP4430_VDD_MPU_OPP50_UV, OMAP44XX_CONTROL_FUSE_MPU_OPP50, 0xf4, 0x0c), |
40 | VOLT_DATA_DEFINE(OMAP4430_VDD_MPU_OPP100_UV, OMAP44XX_CONTROL_FUSE_MPU_OPP100, 0xf9, 0x16), | 40 | VOLT_DATA_DEFINE(OMAP4430_VDD_MPU_OPP100_UV, OMAP44XX_CONTROL_FUSE_MPU_OPP100, 0xf9, 0x16), |
41 | VOLT_DATA_DEFINE(OMAP4430_VDD_MPU_OPPTURBO_UV, OMAP44XX_CONTROL_FUSE_MPU_OPPTURBO, 0xfa, 0x23), | 41 | VOLT_DATA_DEFINE(OMAP4430_VDD_MPU_OPPTURBO_UV, OMAP44XX_CONTROL_FUSE_MPU_OPPTURBO, 0xfa, 0x23), |
@@ -47,7 +47,7 @@ struct omap_volt_data omap44xx_vdd_mpu_volt_data[] = { | |||
47 | #define OMAP4430_VDD_IVA_OPP100_UV 1188000 | 47 | #define OMAP4430_VDD_IVA_OPP100_UV 1188000 |
48 | #define OMAP4430_VDD_IVA_OPPTURBO_UV 1300000 | 48 | #define OMAP4430_VDD_IVA_OPPTURBO_UV 1300000 |
49 | 49 | ||
50 | struct omap_volt_data omap44xx_vdd_iva_volt_data[] = { | 50 | struct omap_volt_data omap443x_vdd_iva_volt_data[] = { |
51 | VOLT_DATA_DEFINE(OMAP4430_VDD_IVA_OPP50_UV, OMAP44XX_CONTROL_FUSE_IVA_OPP50, 0xf4, 0x0c), | 51 | VOLT_DATA_DEFINE(OMAP4430_VDD_IVA_OPP50_UV, OMAP44XX_CONTROL_FUSE_IVA_OPP50, 0xf4, 0x0c), |
52 | VOLT_DATA_DEFINE(OMAP4430_VDD_IVA_OPP100_UV, OMAP44XX_CONTROL_FUSE_IVA_OPP100, 0xf9, 0x16), | 52 | VOLT_DATA_DEFINE(OMAP4430_VDD_IVA_OPP100_UV, OMAP44XX_CONTROL_FUSE_IVA_OPP100, 0xf9, 0x16), |
53 | VOLT_DATA_DEFINE(OMAP4430_VDD_IVA_OPPTURBO_UV, OMAP44XX_CONTROL_FUSE_IVA_OPPTURBO, 0xfa, 0x23), | 53 | VOLT_DATA_DEFINE(OMAP4430_VDD_IVA_OPPTURBO_UV, OMAP44XX_CONTROL_FUSE_IVA_OPPTURBO, 0xfa, 0x23), |
@@ -57,14 +57,14 @@ struct omap_volt_data omap44xx_vdd_iva_volt_data[] = { | |||
57 | #define OMAP4430_VDD_CORE_OPP50_UV 1025000 | 57 | #define OMAP4430_VDD_CORE_OPP50_UV 1025000 |
58 | #define OMAP4430_VDD_CORE_OPP100_UV 1200000 | 58 | #define OMAP4430_VDD_CORE_OPP100_UV 1200000 |
59 | 59 | ||
60 | struct omap_volt_data omap44xx_vdd_core_volt_data[] = { | 60 | struct omap_volt_data omap443x_vdd_core_volt_data[] = { |
61 | VOLT_DATA_DEFINE(OMAP4430_VDD_CORE_OPP50_UV, OMAP44XX_CONTROL_FUSE_CORE_OPP50, 0xf4, 0x0c), | 61 | VOLT_DATA_DEFINE(OMAP4430_VDD_CORE_OPP50_UV, OMAP44XX_CONTROL_FUSE_CORE_OPP50, 0xf4, 0x0c), |
62 | VOLT_DATA_DEFINE(OMAP4430_VDD_CORE_OPP100_UV, OMAP44XX_CONTROL_FUSE_CORE_OPP100, 0xf9, 0x16), | 62 | VOLT_DATA_DEFINE(OMAP4430_VDD_CORE_OPP100_UV, OMAP44XX_CONTROL_FUSE_CORE_OPP100, 0xf9, 0x16), |
63 | VOLT_DATA_DEFINE(0, 0, 0, 0), | 63 | VOLT_DATA_DEFINE(0, 0, 0, 0), |
64 | }; | 64 | }; |
65 | 65 | ||
66 | 66 | ||
67 | static struct omap_opp_def __initdata omap44xx_opp_def_list[] = { | 67 | static struct omap_opp_def __initdata omap443x_opp_def_list[] = { |
68 | /* MPU OPP1 - OPP50 */ | 68 | /* MPU OPP1 - OPP50 */ |
69 | OPP_INITIALIZER("mpu", true, 300000000, OMAP4430_VDD_MPU_OPP50_UV), | 69 | OPP_INITIALIZER("mpu", true, 300000000, OMAP4430_VDD_MPU_OPP50_UV), |
70 | /* MPU OPP2 - OPP100 */ | 70 | /* MPU OPP2 - OPP100 */ |
@@ -86,6 +86,82 @@ static struct omap_opp_def __initdata omap44xx_opp_def_list[] = { | |||
86 | /* TODO: add DSP, aess, fdif, gpu */ | 86 | /* TODO: add DSP, aess, fdif, gpu */ |
87 | }; | 87 | }; |
88 | 88 | ||
89 | #define OMAP4460_VDD_MPU_OPP50_UV 1025000 | ||
90 | #define OMAP4460_VDD_MPU_OPP100_UV 1200000 | ||
91 | #define OMAP4460_VDD_MPU_OPPTURBO_UV 1313000 | ||
92 | #define OMAP4460_VDD_MPU_OPPNITRO_UV 1375000 | ||
93 | |||
94 | struct omap_volt_data omap446x_vdd_mpu_volt_data[] = { | ||
95 | VOLT_DATA_DEFINE(OMAP4460_VDD_MPU_OPP50_UV, OMAP44XX_CONTROL_FUSE_MPU_OPP50, 0xf4, 0x0c), | ||
96 | VOLT_DATA_DEFINE(OMAP4460_VDD_MPU_OPP100_UV, OMAP44XX_CONTROL_FUSE_MPU_OPP100, 0xf9, 0x16), | ||
97 | VOLT_DATA_DEFINE(OMAP4460_VDD_MPU_OPPTURBO_UV, OMAP44XX_CONTROL_FUSE_MPU_OPPTURBO, 0xfa, 0x23), | ||
98 | VOLT_DATA_DEFINE(OMAP4460_VDD_MPU_OPPNITRO_UV, OMAP44XX_CONTROL_FUSE_MPU_OPPNITRO, 0xfa, 0x27), | ||
99 | VOLT_DATA_DEFINE(0, 0, 0, 0), | ||
100 | }; | ||
101 | |||
102 | #define OMAP4460_VDD_IVA_OPP50_UV 1025000 | ||
103 | #define OMAP4460_VDD_IVA_OPP100_UV 1200000 | ||
104 | #define OMAP4460_VDD_IVA_OPPTURBO_UV 1313000 | ||
105 | #define OMAP4460_VDD_IVA_OPPNITRO_UV 1375000 | ||
106 | |||
107 | struct omap_volt_data omap446x_vdd_iva_volt_data[] = { | ||
108 | VOLT_DATA_DEFINE(OMAP4460_VDD_IVA_OPP50_UV, OMAP44XX_CONTROL_FUSE_IVA_OPP50, 0xf4, 0x0c), | ||
109 | VOLT_DATA_DEFINE(OMAP4460_VDD_IVA_OPP100_UV, OMAP44XX_CONTROL_FUSE_IVA_OPP100, 0xf9, 0x16), | ||
110 | VOLT_DATA_DEFINE(OMAP4460_VDD_IVA_OPPTURBO_UV, OMAP44XX_CONTROL_FUSE_IVA_OPPTURBO, 0xfa, 0x23), | ||
111 | VOLT_DATA_DEFINE(OMAP4460_VDD_IVA_OPPNITRO_UV, OMAP44XX_CONTROL_FUSE_IVA_OPPNITRO, 0xfa, 0x23), | ||
112 | VOLT_DATA_DEFINE(0, 0, 0, 0), | ||
113 | }; | ||
114 | |||
115 | #define OMAP4460_VDD_CORE_OPP50_UV 1025000 | ||
116 | #define OMAP4460_VDD_CORE_OPP100_UV 1200000 | ||
117 | #define OMAP4460_VDD_CORE_OPP100_OV_UV 1250000 | ||
118 | |||
119 | struct omap_volt_data omap446x_vdd_core_volt_data[] = { | ||
120 | VOLT_DATA_DEFINE(OMAP4460_VDD_CORE_OPP50_UV, OMAP44XX_CONTROL_FUSE_CORE_OPP50, 0xf4, 0x0c), | ||
121 | VOLT_DATA_DEFINE(OMAP4460_VDD_CORE_OPP100_UV, OMAP44XX_CONTROL_FUSE_CORE_OPP100, 0xf9, 0x16), | ||
122 | VOLT_DATA_DEFINE(OMAP4460_VDD_CORE_OPP100_OV_UV, OMAP44XX_CONTROL_FUSE_CORE_OPP100OV, 0xf9, 0x16), | ||
123 | VOLT_DATA_DEFINE(0, 0, 0, 0), | ||
124 | }; | ||
125 | |||
126 | static struct omap_opp_def __initdata omap446x_opp_def_list[] = { | ||
127 | /* MPU OPP1 - OPP50 */ | ||
128 | OPP_INITIALIZER("mpu", true, 350000000, OMAP4460_VDD_MPU_OPP50_UV), | ||
129 | /* MPU OPP2 - OPP100 */ | ||
130 | OPP_INITIALIZER("mpu", true, 700000000, OMAP4460_VDD_MPU_OPP100_UV), | ||
131 | /* MPU OPP3 - OPP-Turbo */ | ||
132 | OPP_INITIALIZER("mpu", true, 920000000, OMAP4460_VDD_MPU_OPPTURBO_UV), | ||
133 | /* | ||
134 | * MPU OPP4 - OPP-Nitro + Disabled as the reference schematics | ||
135 | * recommends TPS623631 - confirm and enable the opp in board file | ||
136 | * XXX: May be we should enable these based on mpu capability and | ||
137 | * Exception board files disable it... | ||
138 | */ | ||
139 | OPP_INITIALIZER("mpu", false, 1200000000, OMAP4460_VDD_MPU_OPPNITRO_UV), | ||
140 | /* MPU OPP4 - OPP-Nitro SpeedBin */ | ||
141 | OPP_INITIALIZER("mpu", false, 1500000000, OMAP4460_VDD_MPU_OPPNITRO_UV), | ||
142 | /* L3 OPP1 - OPP50 */ | ||
143 | OPP_INITIALIZER("l3_main_1", true, 100000000, OMAP4460_VDD_CORE_OPP50_UV), | ||
144 | /* L3 OPP2 - OPP100 */ | ||
145 | OPP_INITIALIZER("l3_main_1", true, 200000000, OMAP4460_VDD_CORE_OPP100_UV), | ||
146 | /* IVA OPP1 - OPP50 */ | ||
147 | OPP_INITIALIZER("iva", true, 133000000, OMAP4460_VDD_IVA_OPP50_UV), | ||
148 | /* IVA OPP2 - OPP100 */ | ||
149 | OPP_INITIALIZER("iva", true, 266100000, OMAP4460_VDD_IVA_OPP100_UV), | ||
150 | /* | ||
151 | * IVA OPP3 - OPP-Turbo + Disabled as the reference schematics | ||
152 | * recommends Phoenix VCORE2 which can supply only 600mA - so the ones | ||
153 | * above this OPP frequency, even though OMAP is capable, should be | ||
154 | * enabled by board file which is sure of the chip power capability | ||
155 | */ | ||
156 | OPP_INITIALIZER("iva", false, 332000000, OMAP4460_VDD_IVA_OPPTURBO_UV), | ||
157 | /* IVA OPP4 - OPP-Nitro */ | ||
158 | OPP_INITIALIZER("iva", false, 430000000, OMAP4460_VDD_IVA_OPPNITRO_UV), | ||
159 | /* IVA OPP5 - OPP-Nitro SpeedBin*/ | ||
160 | OPP_INITIALIZER("iva", false, 500000000, OMAP4460_VDD_IVA_OPPNITRO_UV), | ||
161 | |||
162 | /* TODO: add DSP, aess, fdif, gpu */ | ||
163 | }; | ||
164 | |||
89 | /** | 165 | /** |
90 | * omap4_opp_init() - initialize omap4 opp table | 166 | * omap4_opp_init() - initialize omap4 opp table |
91 | */ | 167 | */ |
@@ -93,12 +169,12 @@ int __init omap4_opp_init(void) | |||
93 | { | 169 | { |
94 | int r = -ENODEV; | 170 | int r = -ENODEV; |
95 | 171 | ||
96 | if (!cpu_is_omap443x()) | 172 | if (cpu_is_omap443x()) |
97 | return r; | 173 | r = omap_init_opp_table(omap443x_opp_def_list, |
98 | 174 | ARRAY_SIZE(omap443x_opp_def_list)); | |
99 | r = omap_init_opp_table(omap44xx_opp_def_list, | 175 | else if (cpu_is_omap446x()) |
100 | ARRAY_SIZE(omap44xx_opp_def_list)); | 176 | r = omap_init_opp_table(omap446x_opp_def_list, |
101 | 177 | ARRAY_SIZE(omap446x_opp_def_list)); | |
102 | return r; | 178 | return r; |
103 | } | 179 | } |
104 | device_initcall(omap4_opp_init); | 180 | device_initcall(omap4_opp_init); |
diff --git a/arch/arm/mach-omap2/pm.c b/arch/arm/mach-omap2/pm.c index 331478f9b864..e5a4c3a0accd 100644 --- a/arch/arm/mach-omap2/pm.c +++ b/arch/arm/mach-omap2/pm.c | |||
@@ -40,6 +40,36 @@ static struct omap_device_pm_latency *pm_lats; | |||
40 | */ | 40 | */ |
41 | int (*omap_pm_suspend)(void); | 41 | int (*omap_pm_suspend)(void); |
42 | 42 | ||
43 | /** | ||
44 | * struct omap2_oscillator - Describe the board main oscillator latencies | ||
45 | * @startup_time: oscillator startup latency | ||
46 | * @shutdown_time: oscillator shutdown latency | ||
47 | */ | ||
48 | struct omap2_oscillator { | ||
49 | u32 startup_time; | ||
50 | u32 shutdown_time; | ||
51 | }; | ||
52 | |||
53 | static struct omap2_oscillator oscillator = { | ||
54 | .startup_time = ULONG_MAX, | ||
55 | .shutdown_time = ULONG_MAX, | ||
56 | }; | ||
57 | |||
58 | void omap_pm_setup_oscillator(u32 tstart, u32 tshut) | ||
59 | { | ||
60 | oscillator.startup_time = tstart; | ||
61 | oscillator.shutdown_time = tshut; | ||
62 | } | ||
63 | |||
64 | void omap_pm_get_oscillator(u32 *tstart, u32 *tshut) | ||
65 | { | ||
66 | if (!tstart || !tshut) | ||
67 | return; | ||
68 | |||
69 | *tstart = oscillator.startup_time; | ||
70 | *tshut = oscillator.shutdown_time; | ||
71 | } | ||
72 | |||
43 | static int __init _init_omap_device(char *name) | 73 | static int __init _init_omap_device(char *name) |
44 | { | 74 | { |
45 | struct omap_hwmod *oh; | 75 | struct omap_hwmod *oh; |
diff --git a/arch/arm/mach-omap2/pm.h b/arch/arm/mach-omap2/pm.h index 686137d164da..4db7b238a0d5 100644 --- a/arch/arm/mach-omap2/pm.h +++ b/arch/arm/mach-omap2/pm.h | |||
@@ -91,6 +91,7 @@ extern void omap3_save_scratchpad_contents(void); | |||
91 | 91 | ||
92 | #define PM_RTA_ERRATUM_i608 (1 << 0) | 92 | #define PM_RTA_ERRATUM_i608 (1 << 0) |
93 | #define PM_SDRC_WAKEUP_ERRATUM_i583 (1 << 1) | 93 | #define PM_SDRC_WAKEUP_ERRATUM_i583 (1 << 1) |
94 | #define PM_PER_MEMORIES_ERRATUM_i582 (1 << 2) | ||
94 | 95 | ||
95 | #if defined(CONFIG_PM) && defined(CONFIG_ARCH_OMAP3) | 96 | #if defined(CONFIG_PM) && defined(CONFIG_ARCH_OMAP3) |
96 | extern u16 pm34xx_errata; | 97 | extern u16 pm34xx_errata; |
@@ -128,4 +129,14 @@ static inline int omap4_twl_init(void) | |||
128 | } | 129 | } |
129 | #endif | 130 | #endif |
130 | 131 | ||
132 | #ifdef CONFIG_PM | ||
133 | extern void omap_pm_setup_oscillator(u32 tstart, u32 tshut); | ||
134 | extern void omap_pm_get_oscillator(u32 *tstart, u32 *tshut); | ||
135 | extern void omap_pm_setup_sr_i2c_pcb_length(u32 mm); | ||
136 | #else | ||
137 | static inline void omap_pm_setup_oscillator(u32 tstart, u32 tshut) { } | ||
138 | static inline void omap_pm_get_oscillator(u32 *tstart, u32 *tshut) { } | ||
139 | static inline void omap_pm_setup_sr_i2c_pcb_length(u32 mm) { } | ||
140 | #endif | ||
141 | |||
131 | #endif | 142 | #endif |
diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c index aa701d76efda..a9b8da1629bf 100644 --- a/arch/arm/mach-omap2/pm34xx.c +++ b/arch/arm/mach-omap2/pm34xx.c | |||
@@ -651,14 +651,17 @@ static void __init pm_errata_configure(void) | |||
651 | /* Enable the l2 cache toggling in sleep logic */ | 651 | /* Enable the l2 cache toggling in sleep logic */ |
652 | enable_omap3630_toggle_l2_on_restore(); | 652 | enable_omap3630_toggle_l2_on_restore(); |
653 | if (omap_rev() < OMAP3630_REV_ES1_2) | 653 | if (omap_rev() < OMAP3630_REV_ES1_2) |
654 | pm34xx_errata |= PM_SDRC_WAKEUP_ERRATUM_i583; | 654 | pm34xx_errata |= (PM_SDRC_WAKEUP_ERRATUM_i583 | |
655 | PM_PER_MEMORIES_ERRATUM_i582); | ||
656 | } else if (cpu_is_omap34xx()) { | ||
657 | pm34xx_errata |= PM_PER_MEMORIES_ERRATUM_i582; | ||
655 | } | 658 | } |
656 | } | 659 | } |
657 | 660 | ||
658 | int __init omap3_pm_init(void) | 661 | int __init omap3_pm_init(void) |
659 | { | 662 | { |
660 | struct power_state *pwrst, *tmp; | 663 | struct power_state *pwrst, *tmp; |
661 | struct clockdomain *neon_clkdm, *mpu_clkdm; | 664 | struct clockdomain *neon_clkdm, *mpu_clkdm, *per_clkdm, *wkup_clkdm; |
662 | int ret; | 665 | int ret; |
663 | 666 | ||
664 | if (!omap3_has_io_chain_ctrl()) | 667 | if (!omap3_has_io_chain_ctrl()) |
@@ -710,6 +713,8 @@ int __init omap3_pm_init(void) | |||
710 | 713 | ||
711 | neon_clkdm = clkdm_lookup("neon_clkdm"); | 714 | neon_clkdm = clkdm_lookup("neon_clkdm"); |
712 | mpu_clkdm = clkdm_lookup("mpu_clkdm"); | 715 | mpu_clkdm = clkdm_lookup("mpu_clkdm"); |
716 | per_clkdm = clkdm_lookup("per_clkdm"); | ||
717 | wkup_clkdm = clkdm_lookup("wkup_clkdm"); | ||
713 | 718 | ||
714 | #ifdef CONFIG_SUSPEND | 719 | #ifdef CONFIG_SUSPEND |
715 | omap_pm_suspend = omap3_pm_suspend; | 720 | omap_pm_suspend = omap3_pm_suspend; |
@@ -726,6 +731,27 @@ int __init omap3_pm_init(void) | |||
726 | if (IS_PM34XX_ERRATUM(PM_RTA_ERRATUM_i608)) | 731 | if (IS_PM34XX_ERRATUM(PM_RTA_ERRATUM_i608)) |
727 | omap3630_ctrl_disable_rta(); | 732 | omap3630_ctrl_disable_rta(); |
728 | 733 | ||
734 | /* | ||
735 | * The UART3/4 FIFO and the sidetone memory in McBSP2/3 are | ||
736 | * not correctly reset when the PER powerdomain comes back | ||
737 | * from OFF or OSWR when the CORE powerdomain is kept active. | ||
738 | * See OMAP36xx Erratum i582 "PER Domain reset issue after | ||
739 | * Domain-OFF/OSWR Wakeup". This wakeup dependency is not a | ||
740 | * complete workaround. The kernel must also prevent the PER | ||
741 | * powerdomain from going to OSWR/OFF while the CORE | ||
742 | * powerdomain is not going to OSWR/OFF. And if PER last | ||
743 | * power state was off while CORE last power state was ON, the | ||
744 | * UART3/4 and McBSP2/3 SIDETONE devices need to run a | ||
745 | * self-test using their loopback tests; if that fails, those | ||
746 | * devices are unusable until the PER/CORE can complete a transition | ||
747 | * from ON to OSWR/OFF and then back to ON. | ||
748 | * | ||
749 | * XXX Technically this workaround is only needed if off-mode | ||
750 | * or OSWR is enabled. | ||
751 | */ | ||
752 | if (IS_PM34XX_ERRATUM(PM_PER_MEMORIES_ERRATUM_i582)) | ||
753 | clkdm_add_wkdep(per_clkdm, wkup_clkdm); | ||
754 | |||
729 | clkdm_add_wkdep(neon_clkdm, mpu_clkdm); | 755 | clkdm_add_wkdep(neon_clkdm, mpu_clkdm); |
730 | if (omap_type() != OMAP2_DEVICE_TYPE_GP) { | 756 | if (omap_type() != OMAP2_DEVICE_TYPE_GP) { |
731 | omap3_secure_ram_storage = | 757 | omap3_secure_ram_storage = |
diff --git a/arch/arm/mach-omap2/serial.c b/arch/arm/mach-omap2/serial.c index 812976eac536..aa30a3c20883 100644 --- a/arch/arm/mach-omap2/serial.c +++ b/arch/arm/mach-omap2/serial.c | |||
@@ -330,6 +330,11 @@ void __init omap_serial_init_port(struct omap_board_data *bdata, | |||
330 | 330 | ||
331 | oh->mux = omap_hwmod_mux_init(bdata->pads, bdata->pads_cnt); | 331 | oh->mux = omap_hwmod_mux_init(bdata->pads, bdata->pads_cnt); |
332 | 332 | ||
333 | if (console_uart_id == bdata->id) { | ||
334 | omap_device_enable(pdev); | ||
335 | pm_runtime_set_active(&pdev->dev); | ||
336 | } | ||
337 | |||
333 | oh->dev_attr = uart; | 338 | oh->dev_attr = uart; |
334 | 339 | ||
335 | if (((cpu_is_omap34xx() || cpu_is_omap44xx()) && bdata->pads) | 340 | if (((cpu_is_omap34xx() || cpu_is_omap44xx()) && bdata->pads) |
diff --git a/arch/arm/mach-omap2/sr_device.c b/arch/arm/mach-omap2/sr_device.c index b0e77a407047..b9753fe27232 100644 --- a/arch/arm/mach-omap2/sr_device.c +++ b/arch/arm/mach-omap2/sr_device.c | |||
@@ -121,6 +121,19 @@ static int __init sr_dev_init(struct omap_hwmod *oh, void *user) | |||
121 | sr_data->senn_mod = 0x1; | 121 | sr_data->senn_mod = 0x1; |
122 | sr_data->senp_mod = 0x1; | 122 | sr_data->senp_mod = 0x1; |
123 | 123 | ||
124 | if (cpu_is_omap34xx() || cpu_is_omap44xx()) { | ||
125 | sr_data->err_weight = OMAP3430_SR_ERRWEIGHT; | ||
126 | sr_data->err_maxlimit = OMAP3430_SR_ERRMAXLIMIT; | ||
127 | sr_data->accum_data = OMAP3430_SR_ACCUMDATA; | ||
128 | if (!(strcmp(sr_data->name, "smartreflex_mpu"))) { | ||
129 | sr_data->senn_avgweight = OMAP3430_SR1_SENNAVGWEIGHT; | ||
130 | sr_data->senp_avgweight = OMAP3430_SR1_SENPAVGWEIGHT; | ||
131 | } else { | ||
132 | sr_data->senn_avgweight = OMAP3430_SR2_SENNAVGWEIGHT; | ||
133 | sr_data->senp_avgweight = OMAP3430_SR2_SENPAVGWEIGHT; | ||
134 | } | ||
135 | } | ||
136 | |||
124 | sr_data->voltdm = voltdm_lookup(sr_dev_attr->sensor_voltdm_name); | 137 | sr_data->voltdm = voltdm_lookup(sr_dev_attr->sensor_voltdm_name); |
125 | if (!sr_data->voltdm) { | 138 | if (!sr_data->voltdm) { |
126 | pr_err("%s: Unable to get voltage domain pointer for VDD %s\n", | 139 | pr_err("%s: Unable to get voltage domain pointer for VDD %s\n", |
diff --git a/arch/arm/mach-omap2/vc.c b/arch/arm/mach-omap2/vc.c index 880249b17012..687aa86c0d5e 100644 --- a/arch/arm/mach-omap2/vc.c +++ b/arch/arm/mach-omap2/vc.c | |||
@@ -11,13 +11,20 @@ | |||
11 | #include <linux/delay.h> | 11 | #include <linux/delay.h> |
12 | #include <linux/init.h> | 12 | #include <linux/init.h> |
13 | #include <linux/bug.h> | 13 | #include <linux/bug.h> |
14 | #include <linux/io.h> | ||
14 | 15 | ||
16 | #include <asm/div64.h> | ||
17 | |||
18 | #include "iomap.h" | ||
15 | #include "soc.h" | 19 | #include "soc.h" |
16 | #include "voltage.h" | 20 | #include "voltage.h" |
17 | #include "vc.h" | 21 | #include "vc.h" |
18 | #include "prm-regbits-34xx.h" | 22 | #include "prm-regbits-34xx.h" |
19 | #include "prm-regbits-44xx.h" | 23 | #include "prm-regbits-44xx.h" |
20 | #include "prm44xx.h" | 24 | #include "prm44xx.h" |
25 | #include "pm.h" | ||
26 | #include "scrm44xx.h" | ||
27 | #include "control.h" | ||
21 | 28 | ||
22 | /** | 29 | /** |
23 | * struct omap_vc_channel_cfg - describe the cfg_channel bitfield | 30 | * struct omap_vc_channel_cfg - describe the cfg_channel bitfield |
@@ -63,6 +70,9 @@ static struct omap_vc_channel_cfg vc_mutant_channel_cfg = { | |||
63 | }; | 70 | }; |
64 | 71 | ||
65 | static struct omap_vc_channel_cfg *vc_cfg_bits; | 72 | static struct omap_vc_channel_cfg *vc_cfg_bits; |
73 | |||
74 | /* Default I2C trace length on pcb, 6.3cm. Used for capacitance calculations. */ | ||
75 | static u32 sr_i2c_pcb_length = 63; | ||
66 | #define CFG_CHANNEL_MASK 0x1f | 76 | #define CFG_CHANNEL_MASK 0x1f |
67 | 77 | ||
68 | /** | 78 | /** |
@@ -135,6 +145,8 @@ int omap_vc_pre_scale(struct voltagedomain *voltdm, | |||
135 | vc_cmdval |= (*target_vsel << vc->common->cmd_on_shift); | 145 | vc_cmdval |= (*target_vsel << vc->common->cmd_on_shift); |
136 | voltdm->write(vc_cmdval, vc->cmdval_reg); | 146 | voltdm->write(vc_cmdval, vc->cmdval_reg); |
137 | 147 | ||
148 | voltdm->vc_param->on = target_volt; | ||
149 | |||
138 | omap_vp_update_errorgain(voltdm, target_volt); | 150 | omap_vp_update_errorgain(voltdm, target_volt); |
139 | 151 | ||
140 | return 0; | 152 | return 0; |
@@ -202,46 +214,389 @@ int omap_vc_bypass_scale(struct voltagedomain *voltdm, | |||
202 | return 0; | 214 | return 0; |
203 | } | 215 | } |
204 | 216 | ||
205 | static void __init omap3_vfsm_init(struct voltagedomain *voltdm) | 217 | /* Convert microsecond value to number of 32kHz clock cycles */ |
218 | static inline u32 omap_usec_to_32k(u32 usec) | ||
219 | { | ||
220 | return DIV_ROUND_UP_ULL(32768ULL * (u64)usec, 1000000ULL); | ||
221 | } | ||
222 | |||
223 | /* Set oscillator setup time for omap3 */ | ||
224 | static void omap3_set_clksetup(u32 usec, struct voltagedomain *voltdm) | ||
225 | { | ||
226 | voltdm->write(omap_usec_to_32k(usec), OMAP3_PRM_CLKSETUP_OFFSET); | ||
227 | } | ||
228 | |||
229 | /** | ||
230 | * omap3_set_i2c_timings - sets i2c sleep timings for a channel | ||
231 | * @voltdm: channel to configure | ||
232 | * @off_mode: select whether retention or off mode values used | ||
233 | * | ||
234 | * Calculates and sets up voltage controller to use I2C based | ||
235 | * voltage scaling for sleep modes. This can be used for either off mode | ||
236 | * or retention. Off mode has additionally an option to use sys_off_mode | ||
237 | * pad, which uses a global signal to program the whole power IC to | ||
238 | * off-mode. | ||
239 | */ | ||
240 | static void omap3_set_i2c_timings(struct voltagedomain *voltdm, bool off_mode) | ||
206 | { | 241 | { |
242 | unsigned long voltsetup1; | ||
243 | u32 tgt_volt; | ||
244 | |||
245 | /* | ||
246 | * Oscillator is shut down only if we are using sys_off_mode pad, | ||
247 | * thus we set a minimal setup time here | ||
248 | */ | ||
249 | omap3_set_clksetup(1, voltdm); | ||
250 | |||
251 | if (off_mode) | ||
252 | tgt_volt = voltdm->vc_param->off; | ||
253 | else | ||
254 | tgt_volt = voltdm->vc_param->ret; | ||
255 | |||
256 | voltsetup1 = (voltdm->vc_param->on - tgt_volt) / | ||
257 | voltdm->pmic->slew_rate; | ||
258 | |||
259 | voltsetup1 = voltsetup1 * voltdm->sys_clk.rate / 8 / 1000000 + 1; | ||
260 | |||
261 | voltdm->rmw(voltdm->vfsm->voltsetup_mask, | ||
262 | voltsetup1 << __ffs(voltdm->vfsm->voltsetup_mask), | ||
263 | voltdm->vfsm->voltsetup_reg); | ||
264 | |||
207 | /* | 265 | /* |
208 | * Voltage Manager FSM parameters init | 266 | * pmic is not controlling the voltage scaling during retention, |
209 | * XXX This data should be passed in from the board file | 267 | * thus set voltsetup2 to 0 |
210 | */ | 268 | */ |
211 | voltdm->write(OMAP3_CLKSETUP, OMAP3_PRM_CLKSETUP_OFFSET); | 269 | voltdm->write(0, OMAP3_PRM_VOLTSETUP2_OFFSET); |
212 | voltdm->write(OMAP3_VOLTOFFSET, OMAP3_PRM_VOLTOFFSET_OFFSET); | ||
213 | voltdm->write(OMAP3_VOLTSETUP2, OMAP3_PRM_VOLTSETUP2_OFFSET); | ||
214 | } | 270 | } |
215 | 271 | ||
216 | static void __init omap3_vc_init_channel(struct voltagedomain *voltdm) | 272 | /** |
273 | * omap3_set_off_timings - sets off-mode timings for a channel | ||
274 | * @voltdm: channel to configure | ||
275 | * | ||
276 | * Calculates and sets up off-mode timings for a channel. Off-mode | ||
277 | * can use either I2C based voltage scaling, or alternatively | ||
278 | * sys_off_mode pad can be used to send a global command to power IC. | ||
279 | * This function first checks which mode is being used, and calls | ||
280 | * omap3_set_i2c_timings() if the system is using I2C control mode. | ||
281 | * sys_off_mode has the additional benefit that voltages can be | ||
282 | * scaled to zero volt level with TWL4030 / TWL5030, I2C can only | ||
283 | * scale to 600mV. | ||
284 | */ | ||
285 | static void omap3_set_off_timings(struct voltagedomain *voltdm) | ||
217 | { | 286 | { |
218 | static bool is_initialized; | 287 | unsigned long clksetup; |
288 | unsigned long voltsetup2; | ||
289 | unsigned long voltsetup2_old; | ||
290 | u32 val; | ||
291 | u32 tstart, tshut; | ||
219 | 292 | ||
220 | if (is_initialized) | 293 | /* check if sys_off_mode is used to control off-mode voltages */ |
294 | val = voltdm->read(OMAP3_PRM_VOLTCTRL_OFFSET); | ||
295 | if (!(val & OMAP3430_SEL_OFF_MASK)) { | ||
296 | /* No, omap is controlling them over I2C */ | ||
297 | omap3_set_i2c_timings(voltdm, true); | ||
221 | return; | 298 | return; |
299 | } | ||
300 | |||
301 | omap_pm_get_oscillator(&tstart, &tshut); | ||
302 | omap3_set_clksetup(tstart, voltdm); | ||
303 | |||
304 | clksetup = voltdm->read(OMAP3_PRM_CLKSETUP_OFFSET); | ||
305 | |||
306 | /* voltsetup 2 in us */ | ||
307 | voltsetup2 = voltdm->vc_param->on / voltdm->pmic->slew_rate; | ||
308 | |||
309 | /* convert to 32k clk cycles */ | ||
310 | voltsetup2 = DIV_ROUND_UP(voltsetup2 * 32768, 1000000); | ||
311 | |||
312 | voltsetup2_old = voltdm->read(OMAP3_PRM_VOLTSETUP2_OFFSET); | ||
313 | |||
314 | /* | ||
315 | * Update voltsetup2 if higher than current value (needed because | ||
316 | * we have multiple channels with different ramp times), also | ||
317 | * update voltoffset always to value recommended by TRM | ||
318 | */ | ||
319 | if (voltsetup2 > voltsetup2_old) { | ||
320 | voltdm->write(voltsetup2, OMAP3_PRM_VOLTSETUP2_OFFSET); | ||
321 | voltdm->write(clksetup - voltsetup2, | ||
322 | OMAP3_PRM_VOLTOFFSET_OFFSET); | ||
323 | } else | ||
324 | voltdm->write(clksetup - voltsetup2_old, | ||
325 | OMAP3_PRM_VOLTOFFSET_OFFSET); | ||
326 | |||
327 | /* | ||
328 | * omap is not controlling voltage scaling during off-mode, | ||
329 | * thus set voltsetup1 to 0 | ||
330 | */ | ||
331 | voltdm->rmw(voltdm->vfsm->voltsetup_mask, 0, | ||
332 | voltdm->vfsm->voltsetup_reg); | ||
333 | |||
334 | /* voltoffset must be clksetup minus voltsetup2 according to TRM */ | ||
335 | voltdm->write(clksetup - voltsetup2, OMAP3_PRM_VOLTOFFSET_OFFSET); | ||
336 | } | ||
337 | |||
338 | static void __init omap3_vc_init_channel(struct voltagedomain *voltdm) | ||
339 | { | ||
340 | omap3_set_off_timings(voltdm); | ||
341 | } | ||
342 | |||
343 | /** | ||
344 | * omap4_calc_volt_ramp - calculates voltage ramping delays on omap4 | ||
345 | * @voltdm: channel to calculate values for | ||
346 | * @voltage_diff: voltage difference in microvolts | ||
347 | * | ||
348 | * Calculates voltage ramp prescaler + counter values for a voltage | ||
349 | * difference on omap4. Returns a field value suitable for writing to | ||
350 | * VOLTSETUP register for a channel in following format: | ||
351 | * bits[8:9] prescaler ... bits[0:5] counter. See OMAP4 TRM for reference. | ||
352 | */ | ||
353 | static u32 omap4_calc_volt_ramp(struct voltagedomain *voltdm, u32 voltage_diff) | ||
354 | { | ||
355 | u32 prescaler; | ||
356 | u32 cycles; | ||
357 | u32 time; | ||
358 | |||
359 | time = voltage_diff / voltdm->pmic->slew_rate; | ||
360 | |||
361 | cycles = voltdm->sys_clk.rate / 1000 * time / 1000; | ||
362 | |||
363 | cycles /= 64; | ||
364 | prescaler = 0; | ||
365 | |||
366 | /* shift to next prescaler until no overflow */ | ||
367 | |||
368 | /* scale for div 256 = 64 * 4 */ | ||
369 | if (cycles > 63) { | ||
370 | cycles /= 4; | ||
371 | prescaler++; | ||
372 | } | ||
373 | |||
374 | /* scale for div 512 = 256 * 2 */ | ||
375 | if (cycles > 63) { | ||
376 | cycles /= 2; | ||
377 | prescaler++; | ||
378 | } | ||
379 | |||
380 | /* scale for div 2048 = 512 * 4 */ | ||
381 | if (cycles > 63) { | ||
382 | cycles /= 4; | ||
383 | prescaler++; | ||
384 | } | ||
385 | |||
386 | /* check for overflow => invalid ramp time */ | ||
387 | if (cycles > 63) { | ||
388 | pr_warn("%s: invalid setuptime for vdd_%s\n", __func__, | ||
389 | voltdm->name); | ||
390 | return 0; | ||
391 | } | ||
392 | |||
393 | cycles++; | ||
222 | 394 | ||
223 | omap3_vfsm_init(voltdm); | 395 | return (prescaler << OMAP4430_RAMP_UP_PRESCAL_SHIFT) | |
396 | (cycles << OMAP4430_RAMP_UP_COUNT_SHIFT); | ||
397 | } | ||
398 | |||
399 | /** | ||
400 | * omap4_usec_to_val_scrm - convert microsecond value to SCRM module bitfield | ||
401 | * @usec: microseconds | ||
402 | * @shift: number of bits to shift left | ||
403 | * @mask: bitfield mask | ||
404 | * | ||
405 | * Converts microsecond value to OMAP4 SCRM bitfield. Bitfield is | ||
406 | * shifted to requested position, and checked agains the mask value. | ||
407 | * If larger, forced to the max value of the field (i.e. the mask itself.) | ||
408 | * Returns the SCRM bitfield value. | ||
409 | */ | ||
410 | static u32 omap4_usec_to_val_scrm(u32 usec, int shift, u32 mask) | ||
411 | { | ||
412 | u32 val; | ||
413 | |||
414 | val = omap_usec_to_32k(usec) << shift; | ||
224 | 415 | ||
225 | is_initialized = true; | 416 | /* Check for overflow, if yes, force to max value */ |
417 | if (val > mask) | ||
418 | val = mask; | ||
419 | |||
420 | return val; | ||
226 | } | 421 | } |
227 | 422 | ||
423 | /** | ||
424 | * omap4_set_timings - set voltage ramp timings for a channel | ||
425 | * @voltdm: channel to configure | ||
426 | * @off_mode: whether off-mode values are used | ||
427 | * | ||
428 | * Calculates and sets the voltage ramp up / down values for a channel. | ||
429 | */ | ||
430 | static void omap4_set_timings(struct voltagedomain *voltdm, bool off_mode) | ||
431 | { | ||
432 | u32 val; | ||
433 | u32 ramp; | ||
434 | int offset; | ||
435 | u32 tstart, tshut; | ||
436 | |||
437 | if (off_mode) { | ||
438 | ramp = omap4_calc_volt_ramp(voltdm, | ||
439 | voltdm->vc_param->on - voltdm->vc_param->off); | ||
440 | offset = voltdm->vfsm->voltsetup_off_reg; | ||
441 | } else { | ||
442 | ramp = omap4_calc_volt_ramp(voltdm, | ||
443 | voltdm->vc_param->on - voltdm->vc_param->ret); | ||
444 | offset = voltdm->vfsm->voltsetup_reg; | ||
445 | } | ||
446 | |||
447 | if (!ramp) | ||
448 | return; | ||
449 | |||
450 | val = voltdm->read(offset); | ||
451 | |||
452 | val |= ramp << OMAP4430_RAMP_DOWN_COUNT_SHIFT; | ||
453 | |||
454 | val |= ramp << OMAP4430_RAMP_UP_COUNT_SHIFT; | ||
455 | |||
456 | voltdm->write(val, offset); | ||
457 | |||
458 | omap_pm_get_oscillator(&tstart, &tshut); | ||
459 | |||
460 | val = omap4_usec_to_val_scrm(tstart, OMAP4_SETUPTIME_SHIFT, | ||
461 | OMAP4_SETUPTIME_MASK); | ||
462 | val |= omap4_usec_to_val_scrm(tshut, OMAP4_DOWNTIME_SHIFT, | ||
463 | OMAP4_DOWNTIME_MASK); | ||
464 | |||
465 | __raw_writel(val, OMAP4_SCRM_CLKSETUPTIME); | ||
466 | } | ||
228 | 467 | ||
229 | /* OMAP4 specific voltage init functions */ | 468 | /* OMAP4 specific voltage init functions */ |
230 | static void __init omap4_vc_init_channel(struct voltagedomain *voltdm) | 469 | static void __init omap4_vc_init_channel(struct voltagedomain *voltdm) |
231 | { | 470 | { |
232 | static bool is_initialized; | 471 | omap4_set_timings(voltdm, true); |
233 | u32 vc_val; | 472 | omap4_set_timings(voltdm, false); |
473 | } | ||
474 | |||
475 | struct i2c_init_data { | ||
476 | u8 loadbits; | ||
477 | u8 load; | ||
478 | u8 hsscll_38_4; | ||
479 | u8 hsscll_26; | ||
480 | u8 hsscll_19_2; | ||
481 | u8 hsscll_16_8; | ||
482 | u8 hsscll_12; | ||
483 | }; | ||
234 | 484 | ||
235 | if (is_initialized) | 485 | static const __initdata struct i2c_init_data omap4_i2c_timing_data[] = { |
486 | { | ||
487 | .load = 50, | ||
488 | .loadbits = 0x3, | ||
489 | .hsscll_38_4 = 13, | ||
490 | .hsscll_26 = 11, | ||
491 | .hsscll_19_2 = 9, | ||
492 | .hsscll_16_8 = 9, | ||
493 | .hsscll_12 = 8, | ||
494 | }, | ||
495 | { | ||
496 | .load = 25, | ||
497 | .loadbits = 0x2, | ||
498 | .hsscll_38_4 = 13, | ||
499 | .hsscll_26 = 11, | ||
500 | .hsscll_19_2 = 9, | ||
501 | .hsscll_16_8 = 9, | ||
502 | .hsscll_12 = 8, | ||
503 | }, | ||
504 | { | ||
505 | .load = 12, | ||
506 | .loadbits = 0x1, | ||
507 | .hsscll_38_4 = 11, | ||
508 | .hsscll_26 = 10, | ||
509 | .hsscll_19_2 = 9, | ||
510 | .hsscll_16_8 = 9, | ||
511 | .hsscll_12 = 8, | ||
512 | }, | ||
513 | { | ||
514 | .load = 0, | ||
515 | .loadbits = 0x0, | ||
516 | .hsscll_38_4 = 12, | ||
517 | .hsscll_26 = 10, | ||
518 | .hsscll_19_2 = 9, | ||
519 | .hsscll_16_8 = 8, | ||
520 | .hsscll_12 = 8, | ||
521 | }, | ||
522 | }; | ||
523 | |||
524 | /** | ||
525 | * omap4_vc_i2c_timing_init - sets up board I2C timing parameters | ||
526 | * @voltdm: voltagedomain pointer to get data from | ||
527 | * | ||
528 | * Use PMIC + board supplied settings for calculating the total I2C | ||
529 | * channel capacitance and set the timing parameters based on this. | ||
530 | * Pre-calculated values are provided in data tables, as it is not | ||
531 | * too straightforward to calculate these runtime. | ||
532 | */ | ||
533 | static void __init omap4_vc_i2c_timing_init(struct voltagedomain *voltdm) | ||
534 | { | ||
535 | u32 capacitance; | ||
536 | u32 val; | ||
537 | u16 hsscll; | ||
538 | const struct i2c_init_data *i2c_data; | ||
539 | |||
540 | if (!voltdm->pmic->i2c_high_speed) { | ||
541 | pr_warn("%s: only high speed supported!\n", __func__); | ||
236 | return; | 542 | return; |
543 | } | ||
544 | |||
545 | /* PCB trace capacitance, 0.125pF / mm => mm / 8 */ | ||
546 | capacitance = DIV_ROUND_UP(sr_i2c_pcb_length, 8); | ||
547 | |||
548 | /* OMAP pad capacitance */ | ||
549 | capacitance += 4; | ||
550 | |||
551 | /* PMIC pad capacitance */ | ||
552 | capacitance += voltdm->pmic->i2c_pad_load; | ||
553 | |||
554 | /* Search for capacitance match in the table */ | ||
555 | i2c_data = omap4_i2c_timing_data; | ||
556 | |||
557 | while (i2c_data->load > capacitance) | ||
558 | i2c_data++; | ||
559 | |||
560 | /* Select proper values based on sysclk frequency */ | ||
561 | switch (voltdm->sys_clk.rate) { | ||
562 | case 38400000: | ||
563 | hsscll = i2c_data->hsscll_38_4; | ||
564 | break; | ||
565 | case 26000000: | ||
566 | hsscll = i2c_data->hsscll_26; | ||
567 | break; | ||
568 | case 19200000: | ||
569 | hsscll = i2c_data->hsscll_19_2; | ||
570 | break; | ||
571 | case 16800000: | ||
572 | hsscll = i2c_data->hsscll_16_8; | ||
573 | break; | ||
574 | case 12000000: | ||
575 | hsscll = i2c_data->hsscll_12; | ||
576 | break; | ||
577 | default: | ||
578 | pr_warn("%s: unsupported sysclk rate: %d!\n", __func__, | ||
579 | voltdm->sys_clk.rate); | ||
580 | return; | ||
581 | } | ||
237 | 582 | ||
238 | /* XXX These are magic numbers and do not belong! */ | 583 | /* Loadbits define pull setup for the I2C channels */ |
239 | vc_val = (0x60 << OMAP4430_SCLL_SHIFT | 0x26 << OMAP4430_SCLH_SHIFT); | 584 | val = i2c_data->loadbits << 25 | i2c_data->loadbits << 29; |
240 | voltdm->write(vc_val, OMAP4_PRM_VC_CFG_I2C_CLK_OFFSET); | ||
241 | 585 | ||
242 | is_initialized = true; | 586 | /* Write to SYSCTRL_PADCONF_WKUP_CTRL_I2C_2 to setup I2C pull */ |
587 | __raw_writel(val, OMAP2_L4_IO_ADDRESS(OMAP4_CTRL_MODULE_PAD_WKUP + | ||
588 | OMAP4_CTRL_MODULE_PAD_WKUP_CONTROL_I2C_2)); | ||
589 | |||
590 | /* HSSCLH can always be zero */ | ||
591 | val = hsscll << OMAP4430_HSSCLL_SHIFT; | ||
592 | val |= (0x28 << OMAP4430_SCLL_SHIFT | 0x2c << OMAP4430_SCLH_SHIFT); | ||
593 | |||
594 | /* Write setup times to I2C config register */ | ||
595 | voltdm->write(val, OMAP4_PRM_VC_CFG_I2C_CLK_OFFSET); | ||
243 | } | 596 | } |
244 | 597 | ||
598 | |||
599 | |||
245 | /** | 600 | /** |
246 | * omap_vc_i2c_init - initialize I2C interface to PMIC | 601 | * omap_vc_i2c_init - initialize I2C interface to PMIC |
247 | * @voltdm: voltage domain containing VC data | 602 | * @voltdm: voltage domain containing VC data |
@@ -281,9 +636,49 @@ static void __init omap_vc_i2c_init(struct voltagedomain *voltdm) | |||
281 | mcode << __ffs(vc->common->i2c_mcode_mask), | 636 | mcode << __ffs(vc->common->i2c_mcode_mask), |
282 | vc->common->i2c_cfg_reg); | 637 | vc->common->i2c_cfg_reg); |
283 | 638 | ||
639 | if (cpu_is_omap44xx()) | ||
640 | omap4_vc_i2c_timing_init(voltdm); | ||
641 | |||
284 | initialized = true; | 642 | initialized = true; |
285 | } | 643 | } |
286 | 644 | ||
645 | /** | ||
646 | * omap_vc_calc_vsel - calculate vsel value for a channel | ||
647 | * @voltdm: channel to calculate value for | ||
648 | * @uvolt: microvolt value to convert to vsel | ||
649 | * | ||
650 | * Converts a microvolt value to vsel value for the used PMIC. | ||
651 | * This checks whether the microvolt value is out of bounds, and | ||
652 | * adjusts the value accordingly. If unsupported value detected, | ||
653 | * warning is thrown. | ||
654 | */ | ||
655 | static u8 omap_vc_calc_vsel(struct voltagedomain *voltdm, u32 uvolt) | ||
656 | { | ||
657 | if (voltdm->pmic->vddmin > uvolt) | ||
658 | uvolt = voltdm->pmic->vddmin; | ||
659 | if (voltdm->pmic->vddmax < uvolt) { | ||
660 | WARN(1, "%s: voltage not supported by pmic: %u vs max %u\n", | ||
661 | __func__, uvolt, voltdm->pmic->vddmax); | ||
662 | /* Lets try maximum value anyway */ | ||
663 | uvolt = voltdm->pmic->vddmax; | ||
664 | } | ||
665 | |||
666 | return voltdm->pmic->uv_to_vsel(uvolt); | ||
667 | } | ||
668 | |||
669 | /** | ||
670 | * omap_pm_setup_sr_i2c_pcb_length - set length of SR I2C traces on PCB | ||
671 | * @mm: length of the PCB trace in millimetres | ||
672 | * | ||
673 | * Sets the PCB trace length for the I2C channel. By default uses 63mm. | ||
674 | * This is needed for properly calculating the capacitance value for | ||
675 | * the PCB trace, and for setting the SR I2C channel timing parameters. | ||
676 | */ | ||
677 | void __init omap_pm_setup_sr_i2c_pcb_length(u32 mm) | ||
678 | { | ||
679 | sr_i2c_pcb_length = mm; | ||
680 | } | ||
681 | |||
287 | void __init omap_vc_init_channel(struct voltagedomain *voltdm) | 682 | void __init omap_vc_init_channel(struct voltagedomain *voltdm) |
288 | { | 683 | { |
289 | struct omap_vc_channel *vc = voltdm->vc; | 684 | struct omap_vc_channel *vc = voltdm->vc; |
@@ -311,7 +706,6 @@ void __init omap_vc_init_channel(struct voltagedomain *voltdm) | |||
311 | vc->i2c_slave_addr = voltdm->pmic->i2c_slave_addr; | 706 | vc->i2c_slave_addr = voltdm->pmic->i2c_slave_addr; |
312 | vc->volt_reg_addr = voltdm->pmic->volt_reg_addr; | 707 | vc->volt_reg_addr = voltdm->pmic->volt_reg_addr; |
313 | vc->cmd_reg_addr = voltdm->pmic->cmd_reg_addr; | 708 | vc->cmd_reg_addr = voltdm->pmic->cmd_reg_addr; |
314 | vc->setup_time = voltdm->pmic->volt_setup_time; | ||
315 | 709 | ||
316 | /* Configure the i2c slave address for this VC */ | 710 | /* Configure the i2c slave address for this VC */ |
317 | voltdm->rmw(vc->smps_sa_mask, | 711 | voltdm->rmw(vc->smps_sa_mask, |
@@ -331,14 +725,18 @@ void __init omap_vc_init_channel(struct voltagedomain *voltdm) | |||
331 | voltdm->rmw(vc->smps_cmdra_mask, | 725 | voltdm->rmw(vc->smps_cmdra_mask, |
332 | vc->cmd_reg_addr << __ffs(vc->smps_cmdra_mask), | 726 | vc->cmd_reg_addr << __ffs(vc->smps_cmdra_mask), |
333 | vc->smps_cmdra_reg); | 727 | vc->smps_cmdra_reg); |
334 | vc->cfg_channel |= vc_cfg_bits->rac | vc_cfg_bits->racen; | 728 | vc->cfg_channel |= vc_cfg_bits->rac; |
335 | } | 729 | } |
336 | 730 | ||
731 | if (vc->cmd_reg_addr == vc->volt_reg_addr) | ||
732 | vc->cfg_channel |= vc_cfg_bits->racen; | ||
733 | |||
337 | /* Set up the on, inactive, retention and off voltage */ | 734 | /* Set up the on, inactive, retention and off voltage */ |
338 | on_vsel = voltdm->pmic->uv_to_vsel(voltdm->pmic->on_volt); | 735 | on_vsel = omap_vc_calc_vsel(voltdm, voltdm->vc_param->on); |
339 | onlp_vsel = voltdm->pmic->uv_to_vsel(voltdm->pmic->onlp_volt); | 736 | onlp_vsel = omap_vc_calc_vsel(voltdm, voltdm->vc_param->onlp); |
340 | ret_vsel = voltdm->pmic->uv_to_vsel(voltdm->pmic->ret_volt); | 737 | ret_vsel = omap_vc_calc_vsel(voltdm, voltdm->vc_param->ret); |
341 | off_vsel = voltdm->pmic->uv_to_vsel(voltdm->pmic->off_volt); | 738 | off_vsel = omap_vc_calc_vsel(voltdm, voltdm->vc_param->off); |
739 | |||
342 | val = ((on_vsel << vc->common->cmd_on_shift) | | 740 | val = ((on_vsel << vc->common->cmd_on_shift) | |
343 | (onlp_vsel << vc->common->cmd_onlp_shift) | | 741 | (onlp_vsel << vc->common->cmd_onlp_shift) | |
344 | (ret_vsel << vc->common->cmd_ret_shift) | | 742 | (ret_vsel << vc->common->cmd_ret_shift) | |
@@ -349,11 +747,6 @@ void __init omap_vc_init_channel(struct voltagedomain *voltdm) | |||
349 | /* Channel configuration */ | 747 | /* Channel configuration */ |
350 | omap_vc_config_channel(voltdm); | 748 | omap_vc_config_channel(voltdm); |
351 | 749 | ||
352 | /* Configure the setup times */ | ||
353 | voltdm->rmw(voltdm->vfsm->voltsetup_mask, | ||
354 | vc->setup_time << __ffs(voltdm->vfsm->voltsetup_mask), | ||
355 | voltdm->vfsm->voltsetup_reg); | ||
356 | |||
357 | omap_vc_i2c_init(voltdm); | 750 | omap_vc_i2c_init(voltdm); |
358 | 751 | ||
359 | if (cpu_is_omap34xx()) | 752 | if (cpu_is_omap34xx()) |
diff --git a/arch/arm/mach-omap2/vc.h b/arch/arm/mach-omap2/vc.h index 478bf6b432c4..91c8d75bf2ea 100644 --- a/arch/arm/mach-omap2/vc.h +++ b/arch/arm/mach-omap2/vc.h | |||
@@ -86,7 +86,6 @@ struct omap_vc_channel { | |||
86 | u16 i2c_slave_addr; | 86 | u16 i2c_slave_addr; |
87 | u16 volt_reg_addr; | 87 | u16 volt_reg_addr; |
88 | u16 cmd_reg_addr; | 88 | u16 cmd_reg_addr; |
89 | u16 setup_time; | ||
90 | u8 cfg_channel; | 89 | u8 cfg_channel; |
91 | bool i2c_high_speed; | 90 | bool i2c_high_speed; |
92 | 91 | ||
@@ -111,6 +110,13 @@ extern struct omap_vc_channel omap4_vc_mpu; | |||
111 | extern struct omap_vc_channel omap4_vc_iva; | 110 | extern struct omap_vc_channel omap4_vc_iva; |
112 | extern struct omap_vc_channel omap4_vc_core; | 111 | extern struct omap_vc_channel omap4_vc_core; |
113 | 112 | ||
113 | extern struct omap_vc_param omap3_mpu_vc_data; | ||
114 | extern struct omap_vc_param omap3_core_vc_data; | ||
115 | |||
116 | extern struct omap_vc_param omap4_mpu_vc_data; | ||
117 | extern struct omap_vc_param omap4_iva_vc_data; | ||
118 | extern struct omap_vc_param omap4_core_vc_data; | ||
119 | |||
114 | void omap_vc_init_channel(struct voltagedomain *voltdm); | 120 | void omap_vc_init_channel(struct voltagedomain *voltdm); |
115 | int omap_vc_pre_scale(struct voltagedomain *voltdm, | 121 | int omap_vc_pre_scale(struct voltagedomain *voltdm, |
116 | unsigned long target_volt, | 122 | unsigned long target_volt, |
diff --git a/arch/arm/mach-omap2/vc3xxx_data.c b/arch/arm/mach-omap2/vc3xxx_data.c index 5d8eaf31569c..75bc4aa22b3a 100644 --- a/arch/arm/mach-omap2/vc3xxx_data.c +++ b/arch/arm/mach-omap2/vc3xxx_data.c | |||
@@ -71,3 +71,25 @@ struct omap_vc_channel omap3_vc_core = { | |||
71 | .smps_cmdra_mask = OMAP3430_CMDRA1_MASK, | 71 | .smps_cmdra_mask = OMAP3430_CMDRA1_MASK, |
72 | .cfg_channel_sa_shift = OMAP3430_PRM_VC_SMPS_SA_SA1_SHIFT, | 72 | .cfg_channel_sa_shift = OMAP3430_PRM_VC_SMPS_SA_SA1_SHIFT, |
73 | }; | 73 | }; |
74 | |||
75 | /* | ||
76 | * Voltage levels for different operating modes: on, sleep, retention and off | ||
77 | */ | ||
78 | #define OMAP3_ON_VOLTAGE_UV 1200000 | ||
79 | #define OMAP3_ONLP_VOLTAGE_UV 1000000 | ||
80 | #define OMAP3_RET_VOLTAGE_UV 975000 | ||
81 | #define OMAP3_OFF_VOLTAGE_UV 600000 | ||
82 | |||
83 | struct omap_vc_param omap3_mpu_vc_data = { | ||
84 | .on = OMAP3_ON_VOLTAGE_UV, | ||
85 | .onlp = OMAP3_ONLP_VOLTAGE_UV, | ||
86 | .ret = OMAP3_RET_VOLTAGE_UV, | ||
87 | .off = OMAP3_OFF_VOLTAGE_UV, | ||
88 | }; | ||
89 | |||
90 | struct omap_vc_param omap3_core_vc_data = { | ||
91 | .on = OMAP3_ON_VOLTAGE_UV, | ||
92 | .onlp = OMAP3_ONLP_VOLTAGE_UV, | ||
93 | .ret = OMAP3_RET_VOLTAGE_UV, | ||
94 | .off = OMAP3_OFF_VOLTAGE_UV, | ||
95 | }; | ||
diff --git a/arch/arm/mach-omap2/vc44xx_data.c b/arch/arm/mach-omap2/vc44xx_data.c index d70b930f2739..085e5d6a04fd 100644 --- a/arch/arm/mach-omap2/vc44xx_data.c +++ b/arch/arm/mach-omap2/vc44xx_data.c | |||
@@ -87,3 +87,31 @@ struct omap_vc_channel omap4_vc_core = { | |||
87 | .cfg_channel_sa_shift = OMAP4430_SA_VDD_CORE_L_SHIFT, | 87 | .cfg_channel_sa_shift = OMAP4430_SA_VDD_CORE_L_SHIFT, |
88 | }; | 88 | }; |
89 | 89 | ||
90 | /* | ||
91 | * Voltage levels for different operating modes: on, sleep, retention and off | ||
92 | */ | ||
93 | #define OMAP4_ON_VOLTAGE_UV 1375000 | ||
94 | #define OMAP4_ONLP_VOLTAGE_UV 1375000 | ||
95 | #define OMAP4_RET_VOLTAGE_UV 837500 | ||
96 | #define OMAP4_OFF_VOLTAGE_UV 0 | ||
97 | |||
98 | struct omap_vc_param omap4_mpu_vc_data = { | ||
99 | .on = OMAP4_ON_VOLTAGE_UV, | ||
100 | .onlp = OMAP4_ONLP_VOLTAGE_UV, | ||
101 | .ret = OMAP4_RET_VOLTAGE_UV, | ||
102 | .off = OMAP4_OFF_VOLTAGE_UV, | ||
103 | }; | ||
104 | |||
105 | struct omap_vc_param omap4_iva_vc_data = { | ||
106 | .on = OMAP4_ON_VOLTAGE_UV, | ||
107 | .onlp = OMAP4_ONLP_VOLTAGE_UV, | ||
108 | .ret = OMAP4_RET_VOLTAGE_UV, | ||
109 | .off = OMAP4_OFF_VOLTAGE_UV, | ||
110 | }; | ||
111 | |||
112 | struct omap_vc_param omap4_core_vc_data = { | ||
113 | .on = OMAP4_ON_VOLTAGE_UV, | ||
114 | .onlp = OMAP4_ONLP_VOLTAGE_UV, | ||
115 | .ret = OMAP4_RET_VOLTAGE_UV, | ||
116 | .off = OMAP4_OFF_VOLTAGE_UV, | ||
117 | }; | ||
diff --git a/arch/arm/mach-omap2/voltage.h b/arch/arm/mach-omap2/voltage.h index 7283b7ed7de8..a0ce4f10ff13 100644 --- a/arch/arm/mach-omap2/voltage.h +++ b/arch/arm/mach-omap2/voltage.h | |||
@@ -40,12 +40,14 @@ struct powerdomain; | |||
40 | * data | 40 | * data |
41 | * @voltsetup_mask: SETUP_TIME* bitmask in the PRM_VOLTSETUP* register | 41 | * @voltsetup_mask: SETUP_TIME* bitmask in the PRM_VOLTSETUP* register |
42 | * @voltsetup_reg: register offset of PRM_VOLTSETUP from PRM base | 42 | * @voltsetup_reg: register offset of PRM_VOLTSETUP from PRM base |
43 | * @voltsetup_off_reg: register offset of PRM_VOLTSETUP_OFF from PRM base | ||
43 | * | 44 | * |
44 | * XXX What about VOLTOFFSET/VOLTCTRL? | 45 | * XXX What about VOLTOFFSET/VOLTCTRL? |
45 | */ | 46 | */ |
46 | struct omap_vfsm_instance { | 47 | struct omap_vfsm_instance { |
47 | u32 voltsetup_mask; | 48 | u32 voltsetup_mask; |
48 | u8 voltsetup_reg; | 49 | u8 voltsetup_reg; |
50 | u8 voltsetup_off_reg; | ||
49 | }; | 51 | }; |
50 | 52 | ||
51 | /** | 53 | /** |
@@ -74,6 +76,8 @@ struct voltagedomain { | |||
74 | const struct omap_vfsm_instance *vfsm; | 76 | const struct omap_vfsm_instance *vfsm; |
75 | struct omap_vp_instance *vp; | 77 | struct omap_vp_instance *vp; |
76 | struct omap_voltdm_pmic *pmic; | 78 | struct omap_voltdm_pmic *pmic; |
79 | struct omap_vp_param *vp_param; | ||
80 | struct omap_vc_param *vc_param; | ||
77 | 81 | ||
78 | /* VC/VP register access functions: SoC specific */ | 82 | /* VC/VP register access functions: SoC specific */ |
79 | u32 (*read) (u8 offset); | 83 | u32 (*read) (u8 offset); |
@@ -92,6 +96,24 @@ struct voltagedomain { | |||
92 | struct omap_volt_data *volt_data; | 96 | struct omap_volt_data *volt_data; |
93 | }; | 97 | }; |
94 | 98 | ||
99 | /* Min and max voltages from OMAP perspective */ | ||
100 | #define OMAP3430_VP1_VLIMITTO_VDDMIN 850000 | ||
101 | #define OMAP3430_VP1_VLIMITTO_VDDMAX 1425000 | ||
102 | #define OMAP3430_VP2_VLIMITTO_VDDMIN 900000 | ||
103 | #define OMAP3430_VP2_VLIMITTO_VDDMAX 1150000 | ||
104 | |||
105 | #define OMAP3630_VP1_VLIMITTO_VDDMIN 900000 | ||
106 | #define OMAP3630_VP1_VLIMITTO_VDDMAX 1350000 | ||
107 | #define OMAP3630_VP2_VLIMITTO_VDDMIN 900000 | ||
108 | #define OMAP3630_VP2_VLIMITTO_VDDMAX 1200000 | ||
109 | |||
110 | #define OMAP4_VP_MPU_VLIMITTO_VDDMIN 830000 | ||
111 | #define OMAP4_VP_MPU_VLIMITTO_VDDMAX 1410000 | ||
112 | #define OMAP4_VP_IVA_VLIMITTO_VDDMIN 830000 | ||
113 | #define OMAP4_VP_IVA_VLIMITTO_VDDMAX 1260000 | ||
114 | #define OMAP4_VP_CORE_VLIMITTO_VDDMIN 830000 | ||
115 | #define OMAP4_VP_CORE_VLIMITTO_VDDMAX 1200000 | ||
116 | |||
95 | /** | 117 | /** |
96 | * struct omap_voltdm_pmic - PMIC specific data required by voltage driver. | 118 | * struct omap_voltdm_pmic - PMIC specific data required by voltage driver. |
97 | * @slew_rate: PMIC slew rate (in uv/us) | 119 | * @slew_rate: PMIC slew rate (in uv/us) |
@@ -107,26 +129,34 @@ struct voltagedomain { | |||
107 | struct omap_voltdm_pmic { | 129 | struct omap_voltdm_pmic { |
108 | int slew_rate; | 130 | int slew_rate; |
109 | int step_size; | 131 | int step_size; |
110 | u32 on_volt; | ||
111 | u32 onlp_volt; | ||
112 | u32 ret_volt; | ||
113 | u32 off_volt; | ||
114 | u16 volt_setup_time; | ||
115 | u16 i2c_slave_addr; | 132 | u16 i2c_slave_addr; |
116 | u16 volt_reg_addr; | 133 | u16 volt_reg_addr; |
117 | u16 cmd_reg_addr; | 134 | u16 cmd_reg_addr; |
118 | u8 vp_erroroffset; | 135 | u8 vp_erroroffset; |
119 | u8 vp_vstepmin; | 136 | u8 vp_vstepmin; |
120 | u8 vp_vstepmax; | 137 | u8 vp_vstepmax; |
121 | u8 vp_vddmin; | 138 | u32 vddmin; |
122 | u8 vp_vddmax; | 139 | u32 vddmax; |
123 | u8 vp_timeout_us; | 140 | u8 vp_timeout_us; |
124 | bool i2c_high_speed; | 141 | bool i2c_high_speed; |
142 | u32 i2c_pad_load; | ||
125 | u8 i2c_mcode; | 143 | u8 i2c_mcode; |
126 | unsigned long (*vsel_to_uv) (const u8 vsel); | 144 | unsigned long (*vsel_to_uv) (const u8 vsel); |
127 | u8 (*uv_to_vsel) (unsigned long uV); | 145 | u8 (*uv_to_vsel) (unsigned long uV); |
128 | }; | 146 | }; |
129 | 147 | ||
148 | struct omap_vp_param { | ||
149 | u32 vddmax; | ||
150 | u32 vddmin; | ||
151 | }; | ||
152 | |||
153 | struct omap_vc_param { | ||
154 | u32 on; | ||
155 | u32 onlp; | ||
156 | u32 ret; | ||
157 | u32 off; | ||
158 | }; | ||
159 | |||
130 | void omap_voltage_get_volttable(struct voltagedomain *voltdm, | 160 | void omap_voltage_get_volttable(struct voltagedomain *voltdm, |
131 | struct omap_volt_data **volt_data); | 161 | struct omap_volt_data **volt_data); |
132 | struct omap_volt_data *omap_voltage_get_voltdata(struct voltagedomain *voltdm, | 162 | struct omap_volt_data *omap_voltage_get_voltdata(struct voltagedomain *voltdm, |
diff --git a/arch/arm/mach-omap2/voltagedomains3xxx_data.c b/arch/arm/mach-omap2/voltagedomains3xxx_data.c index 63afbfed3cbc..261bb7cb4e60 100644 --- a/arch/arm/mach-omap2/voltagedomains3xxx_data.c +++ b/arch/arm/mach-omap2/voltagedomains3xxx_data.c | |||
@@ -117,6 +117,11 @@ void __init omap3xxx_voltagedomains_init(void) | |||
117 | } | 117 | } |
118 | #endif | 118 | #endif |
119 | 119 | ||
120 | omap3_voltdm_mpu.vp_param = &omap3_mpu_vp_data; | ||
121 | omap3_voltdm_core.vp_param = &omap3_core_vp_data; | ||
122 | omap3_voltdm_mpu.vc_param = &omap3_mpu_vc_data; | ||
123 | omap3_voltdm_core.vc_param = &omap3_core_vc_data; | ||
124 | |||
120 | if (soc_is_am35xx()) | 125 | if (soc_is_am35xx()) |
121 | voltdms = voltagedomains_am35xx; | 126 | voltdms = voltagedomains_am35xx; |
122 | else | 127 | else |
diff --git a/arch/arm/mach-omap2/voltagedomains44xx_data.c b/arch/arm/mach-omap2/voltagedomains44xx_data.c index c3115f6853d4..48b22a0a0c88 100644 --- a/arch/arm/mach-omap2/voltagedomains44xx_data.c +++ b/arch/arm/mach-omap2/voltagedomains44xx_data.c | |||
@@ -22,7 +22,7 @@ | |||
22 | #include <linux/init.h> | 22 | #include <linux/init.h> |
23 | 23 | ||
24 | #include "common.h" | 24 | #include "common.h" |
25 | 25 | #include "soc.h" | |
26 | #include "prm-regbits-44xx.h" | 26 | #include "prm-regbits-44xx.h" |
27 | #include "prm44xx.h" | 27 | #include "prm44xx.h" |
28 | #include "prcm44xx.h" | 28 | #include "prcm44xx.h" |
@@ -34,14 +34,17 @@ | |||
34 | 34 | ||
35 | static const struct omap_vfsm_instance omap4_vdd_mpu_vfsm = { | 35 | static const struct omap_vfsm_instance omap4_vdd_mpu_vfsm = { |
36 | .voltsetup_reg = OMAP4_PRM_VOLTSETUP_MPU_RET_SLEEP_OFFSET, | 36 | .voltsetup_reg = OMAP4_PRM_VOLTSETUP_MPU_RET_SLEEP_OFFSET, |
37 | .voltsetup_off_reg = OMAP4_PRM_VOLTSETUP_MPU_OFF_OFFSET, | ||
37 | }; | 38 | }; |
38 | 39 | ||
39 | static const struct omap_vfsm_instance omap4_vdd_iva_vfsm = { | 40 | static const struct omap_vfsm_instance omap4_vdd_iva_vfsm = { |
40 | .voltsetup_reg = OMAP4_PRM_VOLTSETUP_IVA_RET_SLEEP_OFFSET, | 41 | .voltsetup_reg = OMAP4_PRM_VOLTSETUP_IVA_RET_SLEEP_OFFSET, |
42 | .voltsetup_off_reg = OMAP4_PRM_VOLTSETUP_IVA_OFF_OFFSET, | ||
41 | }; | 43 | }; |
42 | 44 | ||
43 | static const struct omap_vfsm_instance omap4_vdd_core_vfsm = { | 45 | static const struct omap_vfsm_instance omap4_vdd_core_vfsm = { |
44 | .voltsetup_reg = OMAP4_PRM_VOLTSETUP_CORE_RET_SLEEP_OFFSET, | 46 | .voltsetup_reg = OMAP4_PRM_VOLTSETUP_CORE_RET_SLEEP_OFFSET, |
47 | .voltsetup_off_reg = OMAP4_PRM_VOLTSETUP_CORE_OFF_OFFSET, | ||
45 | }; | 48 | }; |
46 | 49 | ||
47 | static struct voltagedomain omap4_voltdm_mpu = { | 50 | static struct voltagedomain omap4_voltdm_mpu = { |
@@ -101,11 +104,25 @@ void __init omap44xx_voltagedomains_init(void) | |||
101 | * for the currently-running IC | 104 | * for the currently-running IC |
102 | */ | 105 | */ |
103 | #ifdef CONFIG_PM_OPP | 106 | #ifdef CONFIG_PM_OPP |
104 | omap4_voltdm_mpu.volt_data = omap44xx_vdd_mpu_volt_data; | 107 | if (cpu_is_omap443x()) { |
105 | omap4_voltdm_iva.volt_data = omap44xx_vdd_iva_volt_data; | 108 | omap4_voltdm_mpu.volt_data = omap443x_vdd_mpu_volt_data; |
106 | omap4_voltdm_core.volt_data = omap44xx_vdd_core_volt_data; | 109 | omap4_voltdm_iva.volt_data = omap443x_vdd_iva_volt_data; |
110 | omap4_voltdm_core.volt_data = omap443x_vdd_core_volt_data; | ||
111 | } else if (cpu_is_omap446x()) { | ||
112 | omap4_voltdm_mpu.volt_data = omap446x_vdd_mpu_volt_data; | ||
113 | omap4_voltdm_iva.volt_data = omap446x_vdd_iva_volt_data; | ||
114 | omap4_voltdm_core.volt_data = omap446x_vdd_core_volt_data; | ||
115 | } | ||
107 | #endif | 116 | #endif |
108 | 117 | ||
118 | omap4_voltdm_mpu.vp_param = &omap4_mpu_vp_data; | ||
119 | omap4_voltdm_iva.vp_param = &omap4_iva_vp_data; | ||
120 | omap4_voltdm_core.vp_param = &omap4_core_vp_data; | ||
121 | |||
122 | omap4_voltdm_mpu.vc_param = &omap4_mpu_vc_data; | ||
123 | omap4_voltdm_iva.vc_param = &omap4_iva_vc_data; | ||
124 | omap4_voltdm_core.vc_param = &omap4_core_vc_data; | ||
125 | |||
109 | for (i = 0; voltdm = voltagedomains_omap4[i], voltdm; i++) | 126 | for (i = 0; voltdm = voltagedomains_omap4[i], voltdm; i++) |
110 | voltdm->sys_clk.name = sys_clk_name; | 127 | voltdm->sys_clk.name = sys_clk_name; |
111 | 128 | ||
diff --git a/arch/arm/mach-omap2/vp.c b/arch/arm/mach-omap2/vp.c index 85241b828c02..a3c30655aa30 100644 --- a/arch/arm/mach-omap2/vp.c +++ b/arch/arm/mach-omap2/vp.c | |||
@@ -58,8 +58,10 @@ void __init omap_vp_init(struct voltagedomain *voltdm) | |||
58 | sys_clk_rate = voltdm->sys_clk.rate / 1000; | 58 | sys_clk_rate = voltdm->sys_clk.rate / 1000; |
59 | 59 | ||
60 | timeout = (sys_clk_rate * voltdm->pmic->vp_timeout_us) / 1000; | 60 | timeout = (sys_clk_rate * voltdm->pmic->vp_timeout_us) / 1000; |
61 | vddmin = voltdm->pmic->vp_vddmin; | 61 | vddmin = max(voltdm->vp_param->vddmin, voltdm->pmic->vddmin); |
62 | vddmax = voltdm->pmic->vp_vddmax; | 62 | vddmax = min(voltdm->vp_param->vddmax, voltdm->pmic->vddmax); |
63 | vddmin = voltdm->pmic->uv_to_vsel(vddmin); | ||
64 | vddmax = voltdm->pmic->uv_to_vsel(vddmax); | ||
63 | 65 | ||
64 | waittime = DIV_ROUND_UP(voltdm->pmic->step_size * sys_clk_rate, | 66 | waittime = DIV_ROUND_UP(voltdm->pmic->step_size * sys_clk_rate, |
65 | 1000 * voltdm->pmic->slew_rate); | 67 | 1000 * voltdm->pmic->slew_rate); |
@@ -138,7 +140,7 @@ int omap_vp_forceupdate_scale(struct voltagedomain *voltdm, | |||
138 | udelay(1); | 140 | udelay(1); |
139 | } | 141 | } |
140 | if (timeout >= VP_TRANXDONE_TIMEOUT) { | 142 | if (timeout >= VP_TRANXDONE_TIMEOUT) { |
141 | pr_warn("%s: vdd_%s TRANXDONE timeout exceeded. Voltage change aborted", | 143 | pr_warn("%s: vdd_%s TRANXDONE timeout exceeded. Voltage change aborted\n", |
142 | __func__, voltdm->name); | 144 | __func__, voltdm->name); |
143 | return -ETIMEDOUT; | 145 | return -ETIMEDOUT; |
144 | } | 146 | } |
@@ -197,7 +199,7 @@ void omap_vp_enable(struct voltagedomain *voltdm) | |||
197 | u32 vpconfig, volt; | 199 | u32 vpconfig, volt; |
198 | 200 | ||
199 | if (!voltdm || IS_ERR(voltdm)) { | 201 | if (!voltdm || IS_ERR(voltdm)) { |
200 | pr_warning("%s: VDD specified does not exist!\n", __func__); | 202 | pr_warn("%s: VDD specified does not exist!\n", __func__); |
201 | return; | 203 | return; |
202 | } | 204 | } |
203 | 205 | ||
@@ -214,8 +216,8 @@ void omap_vp_enable(struct voltagedomain *voltdm) | |||
214 | 216 | ||
215 | volt = voltdm_get_voltage(voltdm); | 217 | volt = voltdm_get_voltage(voltdm); |
216 | if (!volt) { | 218 | if (!volt) { |
217 | pr_warning("%s: unable to find current voltage for %s\n", | 219 | pr_warn("%s: unable to find current voltage for %s\n", |
218 | __func__, voltdm->name); | 220 | __func__, voltdm->name); |
219 | return; | 221 | return; |
220 | } | 222 | } |
221 | 223 | ||
@@ -242,7 +244,7 @@ void omap_vp_disable(struct voltagedomain *voltdm) | |||
242 | int timeout; | 244 | int timeout; |
243 | 245 | ||
244 | if (!voltdm || IS_ERR(voltdm)) { | 246 | if (!voltdm || IS_ERR(voltdm)) { |
245 | pr_warning("%s: VDD specified does not exist!\n", __func__); | 247 | pr_warn("%s: VDD specified does not exist!\n", __func__); |
246 | return; | 248 | return; |
247 | } | 249 | } |
248 | 250 | ||
@@ -272,8 +274,7 @@ void omap_vp_disable(struct voltagedomain *voltdm) | |||
272 | VP_IDLE_TIMEOUT, timeout); | 274 | VP_IDLE_TIMEOUT, timeout); |
273 | 275 | ||
274 | if (timeout >= VP_IDLE_TIMEOUT) | 276 | if (timeout >= VP_IDLE_TIMEOUT) |
275 | pr_warning("%s: vdd_%s idle timedout\n", | 277 | pr_warn("%s: vdd_%s idle timedout\n", __func__, voltdm->name); |
276 | __func__, voltdm->name); | ||
277 | 278 | ||
278 | vp->enabled = false; | 279 | vp->enabled = false; |
279 | 280 | ||
diff --git a/arch/arm/mach-omap2/vp.h b/arch/arm/mach-omap2/vp.h index 7c155d248aa3..0fdf7080e4a6 100644 --- a/arch/arm/mach-omap2/vp.h +++ b/arch/arm/mach-omap2/vp.h | |||
@@ -117,6 +117,13 @@ extern struct omap_vp_instance omap4_vp_mpu; | |||
117 | extern struct omap_vp_instance omap4_vp_iva; | 117 | extern struct omap_vp_instance omap4_vp_iva; |
118 | extern struct omap_vp_instance omap4_vp_core; | 118 | extern struct omap_vp_instance omap4_vp_core; |
119 | 119 | ||
120 | extern struct omap_vp_param omap3_mpu_vp_data; | ||
121 | extern struct omap_vp_param omap3_core_vp_data; | ||
122 | |||
123 | extern struct omap_vp_param omap4_mpu_vp_data; | ||
124 | extern struct omap_vp_param omap4_iva_vp_data; | ||
125 | extern struct omap_vp_param omap4_core_vp_data; | ||
126 | |||
120 | void omap_vp_init(struct voltagedomain *voltdm); | 127 | void omap_vp_init(struct voltagedomain *voltdm); |
121 | void omap_vp_enable(struct voltagedomain *voltdm); | 128 | void omap_vp_enable(struct voltagedomain *voltdm); |
122 | void omap_vp_disable(struct voltagedomain *voltdm); | 129 | void omap_vp_disable(struct voltagedomain *voltdm); |
diff --git a/arch/arm/mach-omap2/vp3xxx_data.c b/arch/arm/mach-omap2/vp3xxx_data.c index bd89f80089f5..1914e026245e 100644 --- a/arch/arm/mach-omap2/vp3xxx_data.c +++ b/arch/arm/mach-omap2/vp3xxx_data.c | |||
@@ -77,3 +77,13 @@ struct omap_vp_instance omap3_vp_core = { | |||
77 | .vstatus = OMAP3_PRM_VP2_STATUS_OFFSET, | 77 | .vstatus = OMAP3_PRM_VP2_STATUS_OFFSET, |
78 | .voltage = OMAP3_PRM_VP2_VOLTAGE_OFFSET, | 78 | .voltage = OMAP3_PRM_VP2_VOLTAGE_OFFSET, |
79 | }; | 79 | }; |
80 | |||
81 | struct omap_vp_param omap3_mpu_vp_data = { | ||
82 | .vddmin = OMAP3430_VP1_VLIMITTO_VDDMIN, | ||
83 | .vddmax = OMAP3430_VP1_VLIMITTO_VDDMAX, | ||
84 | }; | ||
85 | |||
86 | struct omap_vp_param omap3_core_vp_data = { | ||
87 | .vddmin = OMAP3430_VP2_VLIMITTO_VDDMIN, | ||
88 | .vddmax = OMAP3430_VP2_VLIMITTO_VDDMAX, | ||
89 | }; | ||
diff --git a/arch/arm/mach-omap2/vp44xx_data.c b/arch/arm/mach-omap2/vp44xx_data.c index 8c031d16879e..e62f6b018beb 100644 --- a/arch/arm/mach-omap2/vp44xx_data.c +++ b/arch/arm/mach-omap2/vp44xx_data.c | |||
@@ -87,3 +87,18 @@ struct omap_vp_instance omap4_vp_core = { | |||
87 | .vstatus = OMAP4_PRM_VP_CORE_STATUS_OFFSET, | 87 | .vstatus = OMAP4_PRM_VP_CORE_STATUS_OFFSET, |
88 | .voltage = OMAP4_PRM_VP_CORE_VOLTAGE_OFFSET, | 88 | .voltage = OMAP4_PRM_VP_CORE_VOLTAGE_OFFSET, |
89 | }; | 89 | }; |
90 | |||
91 | struct omap_vp_param omap4_mpu_vp_data = { | ||
92 | .vddmin = OMAP4_VP_MPU_VLIMITTO_VDDMIN, | ||
93 | .vddmax = OMAP4_VP_MPU_VLIMITTO_VDDMAX, | ||
94 | }; | ||
95 | |||
96 | struct omap_vp_param omap4_iva_vp_data = { | ||
97 | .vddmin = OMAP4_VP_IVA_VLIMITTO_VDDMIN, | ||
98 | .vddmax = OMAP4_VP_IVA_VLIMITTO_VDDMAX, | ||
99 | }; | ||
100 | |||
101 | struct omap_vp_param omap4_core_vp_data = { | ||
102 | .vddmin = OMAP4_VP_CORE_VLIMITTO_VDDMIN, | ||
103 | .vddmax = OMAP4_VP_CORE_VLIMITTO_VDDMAX, | ||
104 | }; | ||
diff --git a/arch/arm/mach-s3c24xx/s3c2416.c b/arch/arm/mach-s3c24xx/s3c2416.c index ed5a95ece9eb..77ee0b732237 100644 --- a/arch/arm/mach-s3c24xx/s3c2416.c +++ b/arch/arm/mach-s3c24xx/s3c2416.c | |||
@@ -61,6 +61,7 @@ | |||
61 | #include <plat/nand-core.h> | 61 | #include <plat/nand-core.h> |
62 | #include <plat/adc-core.h> | 62 | #include <plat/adc-core.h> |
63 | #include <plat/rtc-core.h> | 63 | #include <plat/rtc-core.h> |
64 | #include <plat/spi-core.h> | ||
64 | 65 | ||
65 | static struct map_desc s3c2416_iodesc[] __initdata = { | 66 | static struct map_desc s3c2416_iodesc[] __initdata = { |
66 | IODESC_ENT(WATCHDOG), | 67 | IODESC_ENT(WATCHDOG), |
@@ -132,6 +133,7 @@ void __init s3c2416_map_io(void) | |||
132 | /* initialize device information early */ | 133 | /* initialize device information early */ |
133 | s3c2416_default_sdhci0(); | 134 | s3c2416_default_sdhci0(); |
134 | s3c2416_default_sdhci1(); | 135 | s3c2416_default_sdhci1(); |
136 | s3c64xx_spi_setname("s3c2443-spi"); | ||
135 | 137 | ||
136 | iotable_init(s3c2416_iodesc, ARRAY_SIZE(s3c2416_iodesc)); | 138 | iotable_init(s3c2416_iodesc, ARRAY_SIZE(s3c2416_iodesc)); |
137 | } | 139 | } |
diff --git a/arch/arm/mach-s3c24xx/s3c2443.c b/arch/arm/mach-s3c24xx/s3c2443.c index ab648ad8fa50..165b6a6b3daa 100644 --- a/arch/arm/mach-s3c24xx/s3c2443.c +++ b/arch/arm/mach-s3c24xx/s3c2443.c | |||
@@ -43,6 +43,7 @@ | |||
43 | #include <plat/nand-core.h> | 43 | #include <plat/nand-core.h> |
44 | #include <plat/adc-core.h> | 44 | #include <plat/adc-core.h> |
45 | #include <plat/rtc-core.h> | 45 | #include <plat/rtc-core.h> |
46 | #include <plat/spi-core.h> | ||
46 | 47 | ||
47 | static struct map_desc s3c2443_iodesc[] __initdata = { | 48 | static struct map_desc s3c2443_iodesc[] __initdata = { |
48 | IODESC_ENT(WATCHDOG), | 49 | IODESC_ENT(WATCHDOG), |
@@ -100,6 +101,9 @@ void __init s3c2443_map_io(void) | |||
100 | s3c24xx_gpiocfg_default.set_pull = s3c2443_gpio_setpull; | 101 | s3c24xx_gpiocfg_default.set_pull = s3c2443_gpio_setpull; |
101 | s3c24xx_gpiocfg_default.get_pull = s3c2443_gpio_getpull; | 102 | s3c24xx_gpiocfg_default.get_pull = s3c2443_gpio_getpull; |
102 | 103 | ||
104 | /* initialize device information early */ | ||
105 | s3c64xx_spi_setname("s3c2443-spi"); | ||
106 | |||
103 | iotable_init(s3c2443_iodesc, ARRAY_SIZE(s3c2443_iodesc)); | 107 | iotable_init(s3c2443_iodesc, ARRAY_SIZE(s3c2443_iodesc)); |
104 | } | 108 | } |
105 | 109 | ||
diff --git a/arch/arm/mach-s5p64x0/common.c b/arch/arm/mach-s5p64x0/common.c index 6e6a0a9d6778..111e404a81fd 100644 --- a/arch/arm/mach-s5p64x0/common.c +++ b/arch/arm/mach-s5p64x0/common.c | |||
@@ -44,6 +44,7 @@ | |||
44 | #include <plat/sdhci.h> | 44 | #include <plat/sdhci.h> |
45 | #include <plat/adc-core.h> | 45 | #include <plat/adc-core.h> |
46 | #include <plat/fb-core.h> | 46 | #include <plat/fb-core.h> |
47 | #include <plat/spi-core.h> | ||
47 | #include <plat/gpio-cfg.h> | 48 | #include <plat/gpio-cfg.h> |
48 | #include <plat/regs-irqtype.h> | 49 | #include <plat/regs-irqtype.h> |
49 | #include <plat/regs-serial.h> | 50 | #include <plat/regs-serial.h> |
@@ -179,6 +180,7 @@ void __init s5p6440_map_io(void) | |||
179 | /* initialize any device information early */ | 180 | /* initialize any device information early */ |
180 | s3c_adc_setname("s3c64xx-adc"); | 181 | s3c_adc_setname("s3c64xx-adc"); |
181 | s3c_fb_setname("s5p64x0-fb"); | 182 | s3c_fb_setname("s5p64x0-fb"); |
183 | s3c64xx_spi_setname("s5p64x0-spi"); | ||
182 | 184 | ||
183 | s5p64x0_default_sdhci0(); | 185 | s5p64x0_default_sdhci0(); |
184 | s5p64x0_default_sdhci1(); | 186 | s5p64x0_default_sdhci1(); |
@@ -193,6 +195,7 @@ void __init s5p6450_map_io(void) | |||
193 | /* initialize any device information early */ | 195 | /* initialize any device information early */ |
194 | s3c_adc_setname("s3c64xx-adc"); | 196 | s3c_adc_setname("s3c64xx-adc"); |
195 | s3c_fb_setname("s5p64x0-fb"); | 197 | s3c_fb_setname("s5p64x0-fb"); |
198 | s3c64xx_spi_setname("s5p64x0-spi"); | ||
196 | 199 | ||
197 | s5p64x0_default_sdhci0(); | 200 | s5p64x0_default_sdhci0(); |
198 | s5p64x0_default_sdhci1(); | 201 | s5p64x0_default_sdhci1(); |
diff --git a/arch/arm/mach-s5pc100/common.c b/arch/arm/mach-s5pc100/common.c index 621908658861..cc6e561c9958 100644 --- a/arch/arm/mach-s5pc100/common.c +++ b/arch/arm/mach-s5pc100/common.c | |||
@@ -45,6 +45,7 @@ | |||
45 | #include <plat/fb-core.h> | 45 | #include <plat/fb-core.h> |
46 | #include <plat/iic-core.h> | 46 | #include <plat/iic-core.h> |
47 | #include <plat/onenand-core.h> | 47 | #include <plat/onenand-core.h> |
48 | #include <plat/spi-core.h> | ||
48 | #include <plat/regs-serial.h> | 49 | #include <plat/regs-serial.h> |
49 | #include <plat/watchdog-reset.h> | 50 | #include <plat/watchdog-reset.h> |
50 | 51 | ||
@@ -165,6 +166,8 @@ void __init s5pc100_map_io(void) | |||
165 | s3c_onenand_setname("s5pc100-onenand"); | 166 | s3c_onenand_setname("s5pc100-onenand"); |
166 | s3c_fb_setname("s5pc100-fb"); | 167 | s3c_fb_setname("s5pc100-fb"); |
167 | s3c_cfcon_setname("s5pc100-pata"); | 168 | s3c_cfcon_setname("s5pc100-pata"); |
169 | |||
170 | s3c64xx_spi_setname("s5pc100-spi"); | ||
168 | } | 171 | } |
169 | 172 | ||
170 | void __init s5pc100_init_clocks(int xtal) | 173 | void __init s5pc100_init_clocks(int xtal) |
diff --git a/arch/arm/mach-s5pv210/common.c b/arch/arm/mach-s5pv210/common.c index 4c9e9027df9a..a0c50efe8145 100644 --- a/arch/arm/mach-s5pv210/common.c +++ b/arch/arm/mach-s5pv210/common.c | |||
@@ -43,6 +43,7 @@ | |||
43 | #include <plat/iic-core.h> | 43 | #include <plat/iic-core.h> |
44 | #include <plat/keypad-core.h> | 44 | #include <plat/keypad-core.h> |
45 | #include <plat/tv-core.h> | 45 | #include <plat/tv-core.h> |
46 | #include <plat/spi-core.h> | ||
46 | #include <plat/regs-serial.h> | 47 | #include <plat/regs-serial.h> |
47 | 48 | ||
48 | #include "common.h" | 49 | #include "common.h" |
@@ -196,6 +197,8 @@ void __init s5pv210_map_io(void) | |||
196 | 197 | ||
197 | /* setup TV devices */ | 198 | /* setup TV devices */ |
198 | s5p_hdmi_setname("s5pv210-hdmi"); | 199 | s5p_hdmi_setname("s5pv210-hdmi"); |
200 | |||
201 | s3c64xx_spi_setname("s5pv210-spi"); | ||
199 | } | 202 | } |
200 | 203 | ||
201 | void __init s5pv210_init_clocks(int xtal) | 204 | void __init s5pv210_init_clocks(int xtal) |
diff --git a/arch/arm/mach-shmobile/setup-r8a7779.c b/arch/arm/mach-shmobile/setup-r8a7779.c index 2917668f0091..ebbffc25f24f 100644 --- a/arch/arm/mach-shmobile/setup-r8a7779.c +++ b/arch/arm/mach-shmobile/setup-r8a7779.c | |||
@@ -247,7 +247,7 @@ void __init r8a7779_add_standard_devices(void) | |||
247 | { | 247 | { |
248 | #ifdef CONFIG_CACHE_L2X0 | 248 | #ifdef CONFIG_CACHE_L2X0 |
249 | /* Early BRESP enable, Shared attribute override enable, 64K*16way */ | 249 | /* Early BRESP enable, Shared attribute override enable, 64K*16way */ |
250 | l2x0_init((void __iomem __force *)(0xf0100000), 0x40470000, 0x82000fff); | 250 | l2x0_init(IOMEM(0xf0100000), 0x40470000, 0x82000fff); |
251 | #endif | 251 | #endif |
252 | r8a7779_pm_init(); | 252 | r8a7779_pm_init(); |
253 | 253 | ||
diff --git a/arch/arm/mach-spear13xx/include/mach/spear1310_misc_regs.h b/arch/arm/mach-spear13xx/include/mach/spear1310_misc_regs.h deleted file mode 100644 index e69de29bb2d1..000000000000 --- a/arch/arm/mach-spear13xx/include/mach/spear1310_misc_regs.h +++ /dev/null | |||
diff --git a/arch/arm/mach-spear13xx/include/mach/spear1340_misc_regs.h b/arch/arm/mach-spear13xx/include/mach/spear1340_misc_regs.h deleted file mode 100644 index e69de29bb2d1..000000000000 --- a/arch/arm/mach-spear13xx/include/mach/spear1340_misc_regs.h +++ /dev/null | |||
diff --git a/arch/arm/mach-ux500/cpu.c b/arch/arm/mach-ux500/cpu.c index 2236cbd03cd7..1f3fbc2bb776 100644 --- a/arch/arm/mach-ux500/cpu.c +++ b/arch/arm/mach-ux500/cpu.c | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <linux/stat.h> | 16 | #include <linux/stat.h> |
17 | #include <linux/of.h> | 17 | #include <linux/of.h> |
18 | #include <linux/of_irq.h> | 18 | #include <linux/of_irq.h> |
19 | #include <linux/irq.h> | ||
19 | #include <linux/platform_data/clk-ux500.h> | 20 | #include <linux/platform_data/clk-ux500.h> |
20 | 21 | ||
21 | #include <asm/hardware/gic.h> | 22 | #include <asm/hardware/gic.h> |
diff --git a/arch/arm/mm/alignment.c b/arch/arm/mm/alignment.c index b9f60ebe3bc4..023f443784ec 100644 --- a/arch/arm/mm/alignment.c +++ b/arch/arm/mm/alignment.c | |||
@@ -856,8 +856,10 @@ do_alignment(unsigned long addr, unsigned int fsr, struct pt_regs *regs) | |||
856 | if (thumb2_32b) { | 856 | if (thumb2_32b) { |
857 | offset.un = 0; | 857 | offset.un = 0; |
858 | handler = do_alignment_t32_to_handler(&instr, regs, &offset); | 858 | handler = do_alignment_t32_to_handler(&instr, regs, &offset); |
859 | } else | 859 | } else { |
860 | offset.un = 0; | ||
860 | handler = do_alignment_ldmstm; | 861 | handler = do_alignment_ldmstm; |
862 | } | ||
861 | break; | 863 | break; |
862 | 864 | ||
863 | default: | 865 | default: |
diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c index 477a2d23ddf1..58bc3e4d3bd0 100644 --- a/arch/arm/mm/dma-mapping.c +++ b/arch/arm/mm/dma-mapping.c | |||
@@ -610,7 +610,7 @@ static void *__dma_alloc(struct device *dev, size_t size, dma_addr_t *handle, | |||
610 | gfp_t gfp, pgprot_t prot, bool is_coherent, const void *caller) | 610 | gfp_t gfp, pgprot_t prot, bool is_coherent, const void *caller) |
611 | { | 611 | { |
612 | u64 mask = get_coherent_dma_mask(dev); | 612 | u64 mask = get_coherent_dma_mask(dev); |
613 | struct page *page; | 613 | struct page *page = NULL; |
614 | void *addr; | 614 | void *addr; |
615 | 615 | ||
616 | #ifdef CONFIG_DMA_API_DEBUG | 616 | #ifdef CONFIG_DMA_API_DEBUG |
diff --git a/arch/arm/mm/vmregion.h b/arch/arm/mm/vmregion.h index bf312c354a21..0f5a5f2a2c7b 100644 --- a/arch/arm/mm/vmregion.h +++ b/arch/arm/mm/vmregion.h | |||
@@ -17,7 +17,6 @@ struct arm_vmregion { | |||
17 | struct list_head vm_list; | 17 | struct list_head vm_list; |
18 | unsigned long vm_start; | 18 | unsigned long vm_start; |
19 | unsigned long vm_end; | 19 | unsigned long vm_end; |
20 | void *priv; | ||
21 | int vm_active; | 20 | int vm_active; |
22 | const void *caller; | 21 | const void *caller; |
23 | }; | 22 | }; |
diff --git a/arch/arm/plat-mxc/devices/platform-mxc-mmc.c b/arch/arm/plat-mxc/devices/platform-mxc-mmc.c index 540d3a7d92df..e7b920b58675 100644 --- a/arch/arm/plat-mxc/devices/platform-mxc-mmc.c +++ b/arch/arm/plat-mxc/devices/platform-mxc-mmc.c | |||
@@ -55,7 +55,7 @@ struct platform_device *__init imx_add_mxc_mmc( | |||
55 | struct resource res[] = { | 55 | struct resource res[] = { |
56 | { | 56 | { |
57 | .start = data->iobase, | 57 | .start = data->iobase, |
58 | .end = data->iobase + SZ_4K - 1, | 58 | .end = data->iobase + data->iosize - 1, |
59 | .flags = IORESOURCE_MEM, | 59 | .flags = IORESOURCE_MEM, |
60 | }, { | 60 | }, { |
61 | .start = data->irq, | 61 | .start = data->irq, |
diff --git a/arch/arm/plat-omap/Kconfig b/arch/arm/plat-omap/Kconfig index 7cd56ed5cd94..82fcb206b5b2 100644 --- a/arch/arm/plat-omap/Kconfig +++ b/arch/arm/plat-omap/Kconfig | |||
@@ -26,6 +26,7 @@ config ARCH_OMAP2PLUS | |||
26 | select CLKDEV_LOOKUP | 26 | select CLKDEV_LOOKUP |
27 | select GENERIC_IRQ_CHIP | 27 | select GENERIC_IRQ_CHIP |
28 | select OMAP_DM_TIMER | 28 | select OMAP_DM_TIMER |
29 | select PINCTRL | ||
29 | select PROC_DEVICETREE if PROC_FS | 30 | select PROC_DEVICETREE if PROC_FS |
30 | select SPARSE_IRQ | 31 | select SPARSE_IRQ |
31 | select USE_OF | 32 | select USE_OF |
diff --git a/arch/arm/plat-omap/include/plat/omap-serial.h b/arch/arm/plat-omap/include/plat/omap-serial.h index f4a4cd014795..1957a8516e93 100644 --- a/arch/arm/plat-omap/include/plat/omap-serial.h +++ b/arch/arm/plat-omap/include/plat/omap-serial.h | |||
@@ -40,10 +40,10 @@ | |||
40 | #define OMAP_UART_WER_MOD_WKUP 0X7F | 40 | #define OMAP_UART_WER_MOD_WKUP 0X7F |
41 | 41 | ||
42 | /* Enable XON/XOFF flow control on output */ | 42 | /* Enable XON/XOFF flow control on output */ |
43 | #define OMAP_UART_SW_TX 0x8 | 43 | #define OMAP_UART_SW_TX 0x04 |
44 | 44 | ||
45 | /* Enable XON/XOFF flow control on input */ | 45 | /* Enable XON/XOFF flow control on input */ |
46 | #define OMAP_UART_SW_RX 0x2 | 46 | #define OMAP_UART_SW_RX 0x04 |
47 | 47 | ||
48 | #define OMAP_UART_SYSC_RESET 0X07 | 48 | #define OMAP_UART_SYSC_RESET 0X07 |
49 | #define OMAP_UART_TCR_TRIG 0X0F | 49 | #define OMAP_UART_TCR_TRIG 0X0F |
diff --git a/arch/arm/plat-samsung/include/plat/spi-core.h b/arch/arm/plat-samsung/include/plat/spi-core.h new file mode 100644 index 000000000000..0b9428ab3fc3 --- /dev/null +++ b/arch/arm/plat-samsung/include/plat/spi-core.h | |||
@@ -0,0 +1,30 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2012 Heiko Stuebner <heiko@sntech.de> | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License version 2 as | ||
6 | * published by the Free Software Foundation. | ||
7 | */ | ||
8 | |||
9 | #ifndef __PLAT_S3C_SPI_CORE_H | ||
10 | #define __PLAT_S3C_SPI_CORE_H | ||
11 | |||
12 | /* These functions are only for use with the core support code, such as | ||
13 | * the cpu specific initialisation code | ||
14 | */ | ||
15 | |||
16 | /* re-define device name depending on support. */ | ||
17 | static inline void s3c64xx_spi_setname(char *name) | ||
18 | { | ||
19 | #ifdef CONFIG_S3C64XX_DEV_SPI0 | ||
20 | s3c64xx_device_spi0.name = name; | ||
21 | #endif | ||
22 | #ifdef CONFIG_S3C64XX_DEV_SPI1 | ||
23 | s3c64xx_device_spi1.name = name; | ||
24 | #endif | ||
25 | #ifdef CONFIG_S3C64XX_DEV_SPI2 | ||
26 | s3c64xx_device_spi2.name = name; | ||
27 | #endif | ||
28 | } | ||
29 | |||
30 | #endif /* __PLAT_S3C_SPI_CORE_H */ | ||
diff --git a/arch/arm/tools/Makefile b/arch/arm/tools/Makefile index 635cb1865e4d..cd60a81163e9 100644 --- a/arch/arm/tools/Makefile +++ b/arch/arm/tools/Makefile | |||
@@ -5,6 +5,6 @@ | |||
5 | # | 5 | # |
6 | 6 | ||
7 | include/generated/mach-types.h: $(src)/gen-mach-types $(src)/mach-types | 7 | include/generated/mach-types.h: $(src)/gen-mach-types $(src)/mach-types |
8 | @echo ' Generating $@' | 8 | $(kecho) ' Generating $@' |
9 | @mkdir -p $(dir $@) | 9 | @mkdir -p $(dir $@) |
10 | $(Q)$(AWK) -f $^ > $@ || { rm -f $@; /bin/false; } | 10 | $(Q)$(AWK) -f $^ > $@ || { rm -f $@; /bin/false; } |
diff --git a/arch/arm/xen/grant-table.c b/arch/arm/xen/grant-table.c index dbd1330c0196..859a9bb002d5 100644 --- a/arch/arm/xen/grant-table.c +++ b/arch/arm/xen/grant-table.c | |||
@@ -33,7 +33,7 @@ | |||
33 | #include <xen/page.h> | 33 | #include <xen/page.h> |
34 | #include <xen/grant_table.h> | 34 | #include <xen/grant_table.h> |
35 | 35 | ||
36 | int arch_gnttab_map_shared(unsigned long *frames, unsigned long nr_gframes, | 36 | int arch_gnttab_map_shared(xen_pfn_t *frames, unsigned long nr_gframes, |
37 | unsigned long max_nr_gframes, | 37 | unsigned long max_nr_gframes, |
38 | void **__shared) | 38 | void **__shared) |
39 | { | 39 | { |
diff --git a/arch/arm/xen/hypercall.S b/arch/arm/xen/hypercall.S index 074f5ed101b9..71f723984cbd 100644 --- a/arch/arm/xen/hypercall.S +++ b/arch/arm/xen/hypercall.S | |||
@@ -48,20 +48,16 @@ | |||
48 | 48 | ||
49 | #include <linux/linkage.h> | 49 | #include <linux/linkage.h> |
50 | #include <asm/assembler.h> | 50 | #include <asm/assembler.h> |
51 | #include <asm/opcodes-virt.h> | ||
51 | #include <xen/interface/xen.h> | 52 | #include <xen/interface/xen.h> |
52 | 53 | ||
53 | 54 | ||
54 | /* HVC 0xEA1 */ | 55 | #define XEN_IMM 0xEA1 |
55 | #ifdef CONFIG_THUMB2_KERNEL | ||
56 | #define xen_hvc .word 0xf7e08ea1 | ||
57 | #else | ||
58 | #define xen_hvc .word 0xe140ea71 | ||
59 | #endif | ||
60 | 56 | ||
61 | #define HYPERCALL_SIMPLE(hypercall) \ | 57 | #define HYPERCALL_SIMPLE(hypercall) \ |
62 | ENTRY(HYPERVISOR_##hypercall) \ | 58 | ENTRY(HYPERVISOR_##hypercall) \ |
63 | mov r12, #__HYPERVISOR_##hypercall; \ | 59 | mov r12, #__HYPERVISOR_##hypercall; \ |
64 | xen_hvc; \ | 60 | __HVC(XEN_IMM); \ |
65 | mov pc, lr; \ | 61 | mov pc, lr; \ |
66 | ENDPROC(HYPERVISOR_##hypercall) | 62 | ENDPROC(HYPERVISOR_##hypercall) |
67 | 63 | ||
@@ -76,7 +72,7 @@ ENTRY(HYPERVISOR_##hypercall) \ | |||
76 | stmdb sp!, {r4} \ | 72 | stmdb sp!, {r4} \ |
77 | ldr r4, [sp, #4] \ | 73 | ldr r4, [sp, #4] \ |
78 | mov r12, #__HYPERVISOR_##hypercall; \ | 74 | mov r12, #__HYPERVISOR_##hypercall; \ |
79 | xen_hvc \ | 75 | __HVC(XEN_IMM); \ |
80 | ldm sp!, {r4} \ | 76 | ldm sp!, {r4} \ |
81 | mov pc, lr \ | 77 | mov pc, lr \ |
82 | ENDPROC(HYPERVISOR_##hypercall) | 78 | ENDPROC(HYPERVISOR_##hypercall) |
@@ -100,7 +96,7 @@ ENTRY(privcmd_call) | |||
100 | mov r2, r3 | 96 | mov r2, r3 |
101 | ldr r3, [sp, #8] | 97 | ldr r3, [sp, #8] |
102 | ldr r4, [sp, #4] | 98 | ldr r4, [sp, #4] |
103 | xen_hvc | 99 | __HVC(XEN_IMM) |
104 | ldm sp!, {r4} | 100 | ldm sp!, {r4} |
105 | mov pc, lr | 101 | mov pc, lr |
106 | ENDPROC(privcmd_call); | 102 | ENDPROC(privcmd_call); |
diff --git a/arch/frv/Kconfig b/arch/frv/Kconfig index b7412504f08a..df2eb4bd9fa2 100644 --- a/arch/frv/Kconfig +++ b/arch/frv/Kconfig | |||
@@ -13,6 +13,7 @@ config FRV | |||
13 | select GENERIC_CPU_DEVICES | 13 | select GENERIC_CPU_DEVICES |
14 | select ARCH_WANT_IPC_PARSE_VERSION | 14 | select ARCH_WANT_IPC_PARSE_VERSION |
15 | select GENERIC_KERNEL_THREAD | 15 | select GENERIC_KERNEL_THREAD |
16 | select GENERIC_KERNEL_EXECVE | ||
16 | 17 | ||
17 | config ZONE_DMA | 18 | config ZONE_DMA |
18 | bool | 19 | bool |
diff --git a/arch/frv/boot/Makefile b/arch/frv/boot/Makefile index 6ae3254da019..636d5bbcd53f 100644 --- a/arch/frv/boot/Makefile +++ b/arch/frv/boot/Makefile | |||
@@ -17,6 +17,8 @@ PARAMS_PHYS = 0x0207c000 | |||
17 | INITRD_PHYS = 0x02180000 | 17 | INITRD_PHYS = 0x02180000 |
18 | INITRD_VIRT = 0x02180000 | 18 | INITRD_VIRT = 0x02180000 |
19 | 19 | ||
20 | OBJCOPYFLAGS :=-O binary -R .note -R .note.gnu.build-id -R .comment | ||
21 | |||
20 | # | 22 | # |
21 | # If you don't define ZRELADDR above, | 23 | # If you don't define ZRELADDR above, |
22 | # then it defaults to ZTEXTADDR | 24 | # then it defaults to ZTEXTADDR |
@@ -32,18 +34,18 @@ Image: $(obj)/Image | |||
32 | targets: $(obj)/Image | 34 | targets: $(obj)/Image |
33 | 35 | ||
34 | $(obj)/Image: vmlinux FORCE | 36 | $(obj)/Image: vmlinux FORCE |
35 | $(OBJCOPY) -O binary -R .note -R .comment -S vmlinux $@ | 37 | $(OBJCOPY) $(OBJCOPYFLAGS) -S vmlinux $@ |
36 | 38 | ||
37 | #$(obj)/Image: $(CONFIGURE) $(SYSTEM) | 39 | #$(obj)/Image: $(CONFIGURE) $(SYSTEM) |
38 | # $(OBJCOPY) -O binary -R .note -R .comment -g -S $(SYSTEM) $@ | 40 | # $(OBJCOPY) $(OBJCOPYFLAGS) -g -S $(SYSTEM) $@ |
39 | 41 | ||
40 | bzImage: zImage | 42 | bzImage: zImage |
41 | 43 | ||
42 | zImage: $(CONFIGURE) compressed/$(LINUX) | 44 | zImage: $(CONFIGURE) compressed/$(LINUX) |
43 | $(OBJCOPY) -O binary -R .note -R .comment -S compressed/$(LINUX) $@ | 45 | $(OBJCOPY) $(OBJCOPYFLAGS) -S compressed/$(LINUX) $@ |
44 | 46 | ||
45 | bootpImage: bootp/bootp | 47 | bootpImage: bootp/bootp |
46 | $(OBJCOPY) -O binary -R .note -R .comment -S bootp/bootp $@ | 48 | $(OBJCOPY) $(OBJCOPYFLAGS) -S bootp/bootp $@ |
47 | 49 | ||
48 | compressed/$(LINUX): $(LINUX) dep | 50 | compressed/$(LINUX): $(LINUX) dep |
49 | @$(MAKE) -C compressed $(LINUX) | 51 | @$(MAKE) -C compressed $(LINUX) |
diff --git a/arch/frv/include/asm/unistd.h b/arch/frv/include/asm/unistd.h index 266a5b25a0c1..2358634cacca 100644 --- a/arch/frv/include/asm/unistd.h +++ b/arch/frv/include/asm/unistd.h | |||
@@ -30,7 +30,6 @@ | |||
30 | #define __ARCH_WANT_SYS_RT_SIGACTION | 30 | #define __ARCH_WANT_SYS_RT_SIGACTION |
31 | #define __ARCH_WANT_SYS_RT_SIGSUSPEND | 31 | #define __ARCH_WANT_SYS_RT_SIGSUSPEND |
32 | #define __ARCH_WANT_SYS_EXECVE | 32 | #define __ARCH_WANT_SYS_EXECVE |
33 | #define __ARCH_WANT_KERNEL_EXECVE | ||
34 | 33 | ||
35 | /* | 34 | /* |
36 | * "Conditional" syscalls | 35 | * "Conditional" syscalls |
diff --git a/arch/frv/kernel/entry.S b/arch/frv/kernel/entry.S index ee0beb354e4d..dfcd263c0517 100644 --- a/arch/frv/kernel/entry.S +++ b/arch/frv/kernel/entry.S | |||
@@ -869,11 +869,6 @@ ret_from_kernel_thread: | |||
869 | call schedule_tail | 869 | call schedule_tail |
870 | calll.p @(gr21,gr0) | 870 | calll.p @(gr21,gr0) |
871 | or gr20,gr20,gr8 | 871 | or gr20,gr20,gr8 |
872 | bra sys_exit | ||
873 | |||
874 | .globl ret_from_kernel_execve | ||
875 | ret_from_kernel_execve: | ||
876 | ori gr28,0,sp | ||
877 | bra __syscall_exit | 872 | bra __syscall_exit |
878 | 873 | ||
879 | ################################################################################################### | 874 | ################################################################################################### |
@@ -1080,27 +1075,10 @@ __entry_return_from_kernel_interrupt: | |||
1080 | subicc gr5,#0,gr0,icc0 | 1075 | subicc gr5,#0,gr0,icc0 |
1081 | beq icc0,#0,__entry_return_direct | 1076 | beq icc0,#0,__entry_return_direct |
1082 | 1077 | ||
1083 | __entry_preempt_need_resched: | 1078 | subcc gr0,gr0,gr0,icc2 /* set Z and clear C */ |
1084 | ldi @(gr15,#TI_FLAGS),gr4 | 1079 | call preempt_schedule_irq |
1085 | andicc gr4,#_TIF_NEED_RESCHED,gr0,icc0 | ||
1086 | beq icc0,#1,__entry_return_direct | ||
1087 | |||
1088 | setlos #PREEMPT_ACTIVE,gr5 | ||
1089 | sti gr5,@(gr15,#TI_FLAGS) | ||
1090 | |||
1091 | andi gr23,#~PSR_PIL,gr23 | ||
1092 | movgs gr23,psr | ||
1093 | |||
1094 | call schedule | ||
1095 | sti gr0,@(gr15,#TI_PRE_COUNT) | ||
1096 | |||
1097 | movsg psr,gr23 | ||
1098 | ori gr23,#PSR_PIL_14,gr23 | ||
1099 | movgs gr23,psr | ||
1100 | bra __entry_preempt_need_resched | ||
1101 | #else | ||
1102 | bra __entry_return_direct | ||
1103 | #endif | 1080 | #endif |
1081 | bra __entry_return_direct | ||
1104 | 1082 | ||
1105 | 1083 | ||
1106 | ############################################################################### | 1084 | ############################################################################### |
diff --git a/arch/frv/kernel/process.c b/arch/frv/kernel/process.c index e1e3aa196aa4..7e33215f1d8f 100644 --- a/arch/frv/kernel/process.c +++ b/arch/frv/kernel/process.c | |||
@@ -181,6 +181,9 @@ int copy_thread(unsigned long clone_flags, | |||
181 | childregs = (struct pt_regs *) | 181 | childregs = (struct pt_regs *) |
182 | (task_stack_page(p) + THREAD_SIZE - FRV_FRAME0_SIZE); | 182 | (task_stack_page(p) + THREAD_SIZE - FRV_FRAME0_SIZE); |
183 | 183 | ||
184 | /* set up the userspace frame (the only place that the USP is stored) */ | ||
185 | *childregs = *__kernel_frame0_ptr; | ||
186 | |||
184 | p->set_child_tid = p->clear_child_tid = NULL; | 187 | p->set_child_tid = p->clear_child_tid = NULL; |
185 | 188 | ||
186 | p->thread.frame = childregs; | 189 | p->thread.frame = childregs; |
@@ -191,10 +194,8 @@ int copy_thread(unsigned long clone_flags, | |||
191 | p->thread.frame0 = childregs; | 194 | p->thread.frame0 = childregs; |
192 | 195 | ||
193 | if (unlikely(!regs)) { | 196 | if (unlikely(!regs)) { |
194 | memset(childregs, 0, sizeof(struct pt_regs)); | ||
195 | childregs->gr9 = usp; /* function */ | 197 | childregs->gr9 = usp; /* function */ |
196 | childregs->gr8 = arg; | 198 | childregs->gr8 = arg; |
197 | childregs->psr = PSR_S; | ||
198 | p->thread.pc = (unsigned long) ret_from_kernel_thread; | 199 | p->thread.pc = (unsigned long) ret_from_kernel_thread; |
199 | save_user_regs(p->thread.user); | 200 | save_user_regs(p->thread.user); |
200 | return 0; | 201 | return 0; |
diff --git a/arch/frv/mb93090-mb00/pci-dma-nommu.c b/arch/frv/mb93090-mb00/pci-dma-nommu.c index e47857f889b6..b99c2a7cc7a4 100644 --- a/arch/frv/mb93090-mb00/pci-dma-nommu.c +++ b/arch/frv/mb93090-mb00/pci-dma-nommu.c | |||
@@ -11,6 +11,7 @@ | |||
11 | 11 | ||
12 | #include <linux/types.h> | 12 | #include <linux/types.h> |
13 | #include <linux/slab.h> | 13 | #include <linux/slab.h> |
14 | #include <linux/export.h> | ||
14 | #include <linux/dma-mapping.h> | 15 | #include <linux/dma-mapping.h> |
15 | #include <linux/list.h> | 16 | #include <linux/list.h> |
16 | #include <linux/pci.h> | 17 | #include <linux/pci.h> |
diff --git a/arch/ia64/include/asm/Kbuild b/arch/ia64/include/asm/Kbuild index 4a159da23633..dd02f09b6eda 100644 --- a/arch/ia64/include/asm/Kbuild +++ b/arch/ia64/include/asm/Kbuild | |||
@@ -1,3 +1,4 @@ | |||
1 | 1 | ||
2 | generic-y += clkdev.h | 2 | generic-y += clkdev.h |
3 | generic-y += exec.h | 3 | generic-y += exec.h |
4 | generic-y += kvm_para.h | ||
diff --git a/arch/ia64/include/asm/kvm_para.h b/arch/ia64/include/asm/kvm_para.h deleted file mode 100644 index 47c00f910434..000000000000 --- a/arch/ia64/include/asm/kvm_para.h +++ /dev/null | |||
@@ -1,34 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2007 Xiantao Zhang <xiantao.zhang@intel.com> | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify it | ||
5 | * under the terms and conditions of the GNU General Public License, | ||
6 | * version 2, as published by the Free Software Foundation. | ||
7 | * | ||
8 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
11 | * more details. | ||
12 | * | ||
13 | * You should have received a copy of the GNU General Public License along with | ||
14 | * this program; if not, write to the Free Software Foundation, Inc., 59 Temple | ||
15 | * Place - Suite 330, Boston, MA 02111-1307 USA. | ||
16 | * | ||
17 | */ | ||
18 | #ifndef __IA64_KVM_PARA_H | ||
19 | #define __IA64_KVM_PARA_H | ||
20 | |||
21 | #include <uapi/asm/kvm_para.h> | ||
22 | |||
23 | |||
24 | static inline unsigned int kvm_arch_para_features(void) | ||
25 | { | ||
26 | return 0; | ||
27 | } | ||
28 | |||
29 | static inline bool kvm_check_and_clear_guest_paused(void) | ||
30 | { | ||
31 | return false; | ||
32 | } | ||
33 | |||
34 | #endif | ||
diff --git a/arch/m68k/include/asm/Kbuild b/arch/m68k/include/asm/Kbuild index ecb540810ab3..88fa3ac86fae 100644 --- a/arch/m68k/include/asm/Kbuild +++ b/arch/m68k/include/asm/Kbuild | |||
@@ -1,5 +1,3 @@ | |||
1 | include include/asm-generic/Kbuild.asm | ||
2 | header-y += cachectl.h | ||
3 | 1 | ||
4 | generic-y += bitsperlong.h | 2 | generic-y += bitsperlong.h |
5 | generic-y += clkdev.h | 3 | generic-y += clkdev.h |
diff --git a/arch/m68k/include/asm/ptrace.h b/arch/m68k/include/asm/ptrace.h index 5e08b597f012..0f717045bdde 100644 --- a/arch/m68k/include/asm/ptrace.h +++ b/arch/m68k/include/asm/ptrace.h | |||
@@ -1,82 +1,10 @@ | |||
1 | #ifndef _M68K_PTRACE_H | 1 | #ifndef _M68K_PTRACE_H |
2 | #define _M68K_PTRACE_H | 2 | #define _M68K_PTRACE_H |
3 | 3 | ||
4 | #define PT_D1 0 | 4 | #include <uapi/asm/ptrace.h> |
5 | #define PT_D2 1 | ||
6 | #define PT_D3 2 | ||
7 | #define PT_D4 3 | ||
8 | #define PT_D5 4 | ||
9 | #define PT_D6 5 | ||
10 | #define PT_D7 6 | ||
11 | #define PT_A0 7 | ||
12 | #define PT_A1 8 | ||
13 | #define PT_A2 9 | ||
14 | #define PT_A3 10 | ||
15 | #define PT_A4 11 | ||
16 | #define PT_A5 12 | ||
17 | #define PT_A6 13 | ||
18 | #define PT_D0 14 | ||
19 | #define PT_USP 15 | ||
20 | #define PT_ORIG_D0 16 | ||
21 | #define PT_SR 17 | ||
22 | #define PT_PC 18 | ||
23 | 5 | ||
24 | #ifndef __ASSEMBLY__ | 6 | #ifndef __ASSEMBLY__ |
25 | 7 | ||
26 | /* this struct defines the way the registers are stored on the | ||
27 | stack during a system call. */ | ||
28 | |||
29 | struct pt_regs { | ||
30 | long d1; | ||
31 | long d2; | ||
32 | long d3; | ||
33 | long d4; | ||
34 | long d5; | ||
35 | long a0; | ||
36 | long a1; | ||
37 | long a2; | ||
38 | long d0; | ||
39 | long orig_d0; | ||
40 | long stkadj; | ||
41 | #ifdef CONFIG_COLDFIRE | ||
42 | unsigned format : 4; /* frame format specifier */ | ||
43 | unsigned vector : 12; /* vector offset */ | ||
44 | unsigned short sr; | ||
45 | unsigned long pc; | ||
46 | #else | ||
47 | unsigned short sr; | ||
48 | unsigned long pc; | ||
49 | unsigned format : 4; /* frame format specifier */ | ||
50 | unsigned vector : 12; /* vector offset */ | ||
51 | #endif | ||
52 | }; | ||
53 | |||
54 | /* | ||
55 | * This is the extended stack used by signal handlers and the context | ||
56 | * switcher: it's pushed after the normal "struct pt_regs". | ||
57 | */ | ||
58 | struct switch_stack { | ||
59 | unsigned long d6; | ||
60 | unsigned long d7; | ||
61 | unsigned long a3; | ||
62 | unsigned long a4; | ||
63 | unsigned long a5; | ||
64 | unsigned long a6; | ||
65 | unsigned long retpc; | ||
66 | }; | ||
67 | |||
68 | /* Arbitrarily choose the same ptrace numbers as used by the Sparc code. */ | ||
69 | #define PTRACE_GETREGS 12 | ||
70 | #define PTRACE_SETREGS 13 | ||
71 | #define PTRACE_GETFPREGS 14 | ||
72 | #define PTRACE_SETFPREGS 15 | ||
73 | |||
74 | #define PTRACE_GET_THREAD_AREA 25 | ||
75 | |||
76 | #define PTRACE_SINGLEBLOCK 33 /* resume execution until next branch */ | ||
77 | |||
78 | #ifdef __KERNEL__ | ||
79 | |||
80 | #ifndef PS_S | 8 | #ifndef PS_S |
81 | #define PS_S (0x2000) | 9 | #define PS_S (0x2000) |
82 | #define PS_M (0x1000) | 10 | #define PS_M (0x1000) |
@@ -94,6 +22,5 @@ struct switch_stack { | |||
94 | #define arch_has_block_step() (1) | 22 | #define arch_has_block_step() (1) |
95 | #endif | 23 | #endif |
96 | 24 | ||
97 | #endif /* __KERNEL__ */ | ||
98 | #endif /* __ASSEMBLY__ */ | 25 | #endif /* __ASSEMBLY__ */ |
99 | #endif /* _M68K_PTRACE_H */ | 26 | #endif /* _M68K_PTRACE_H */ |
diff --git a/arch/m68k/include/asm/setup.h b/arch/m68k/include/asm/setup.h index 00c2c5397d37..65e78a2dad64 100644 --- a/arch/m68k/include/asm/setup.h +++ b/arch/m68k/include/asm/setup.h | |||
@@ -19,33 +19,12 @@ | |||
19 | ** Redesign of the boot information structure; moved boot information | 19 | ** Redesign of the boot information structure; moved boot information |
20 | ** structure to bootinfo.h | 20 | ** structure to bootinfo.h |
21 | */ | 21 | */ |
22 | |||
23 | #ifndef _M68K_SETUP_H | 22 | #ifndef _M68K_SETUP_H |
24 | #define _M68K_SETUP_H | 23 | #define _M68K_SETUP_H |
25 | 24 | ||
25 | #include <uapi/asm/setup.h> | ||
26 | 26 | ||
27 | 27 | ||
28 | /* | ||
29 | * Linux/m68k Architectures | ||
30 | */ | ||
31 | |||
32 | #define MACH_AMIGA 1 | ||
33 | #define MACH_ATARI 2 | ||
34 | #define MACH_MAC 3 | ||
35 | #define MACH_APOLLO 4 | ||
36 | #define MACH_SUN3 5 | ||
37 | #define MACH_MVME147 6 | ||
38 | #define MACH_MVME16x 7 | ||
39 | #define MACH_BVME6000 8 | ||
40 | #define MACH_HP300 9 | ||
41 | #define MACH_Q40 10 | ||
42 | #define MACH_SUN3X 11 | ||
43 | #define MACH_M54XX 12 | ||
44 | |||
45 | #define COMMAND_LINE_SIZE 256 | ||
46 | |||
47 | #ifdef __KERNEL__ | ||
48 | |||
49 | #define CL_SIZE COMMAND_LINE_SIZE | 28 | #define CL_SIZE COMMAND_LINE_SIZE |
50 | 29 | ||
51 | #ifndef __ASSEMBLY__ | 30 | #ifndef __ASSEMBLY__ |
@@ -194,63 +173,6 @@ extern unsigned long m68k_machtype; | |||
194 | # define MACH_TYPE (m68k_machtype) | 173 | # define MACH_TYPE (m68k_machtype) |
195 | #endif | 174 | #endif |
196 | 175 | ||
197 | #endif /* __KERNEL__ */ | ||
198 | |||
199 | |||
200 | /* | ||
201 | * CPU, FPU and MMU types | ||
202 | * | ||
203 | * Note: we may rely on the following equalities: | ||
204 | * | ||
205 | * CPU_68020 == MMU_68851 | ||
206 | * CPU_68030 == MMU_68030 | ||
207 | * CPU_68040 == FPU_68040 == MMU_68040 | ||
208 | * CPU_68060 == FPU_68060 == MMU_68060 | ||
209 | */ | ||
210 | |||
211 | #define CPUB_68020 0 | ||
212 | #define CPUB_68030 1 | ||
213 | #define CPUB_68040 2 | ||
214 | #define CPUB_68060 3 | ||
215 | #define CPUB_COLDFIRE 4 | ||
216 | |||
217 | #define CPU_68020 (1<<CPUB_68020) | ||
218 | #define CPU_68030 (1<<CPUB_68030) | ||
219 | #define CPU_68040 (1<<CPUB_68040) | ||
220 | #define CPU_68060 (1<<CPUB_68060) | ||
221 | #define CPU_COLDFIRE (1<<CPUB_COLDFIRE) | ||
222 | |||
223 | #define FPUB_68881 0 | ||
224 | #define FPUB_68882 1 | ||
225 | #define FPUB_68040 2 /* Internal FPU */ | ||
226 | #define FPUB_68060 3 /* Internal FPU */ | ||
227 | #define FPUB_SUNFPA 4 /* Sun-3 FPA */ | ||
228 | #define FPUB_COLDFIRE 5 /* ColdFire FPU */ | ||
229 | |||
230 | #define FPU_68881 (1<<FPUB_68881) | ||
231 | #define FPU_68882 (1<<FPUB_68882) | ||
232 | #define FPU_68040 (1<<FPUB_68040) | ||
233 | #define FPU_68060 (1<<FPUB_68060) | ||
234 | #define FPU_SUNFPA (1<<FPUB_SUNFPA) | ||
235 | #define FPU_COLDFIRE (1<<FPUB_COLDFIRE) | ||
236 | |||
237 | #define MMUB_68851 0 | ||
238 | #define MMUB_68030 1 /* Internal MMU */ | ||
239 | #define MMUB_68040 2 /* Internal MMU */ | ||
240 | #define MMUB_68060 3 /* Internal MMU */ | ||
241 | #define MMUB_APOLLO 4 /* Custom Apollo */ | ||
242 | #define MMUB_SUN3 5 /* Custom Sun-3 */ | ||
243 | #define MMUB_COLDFIRE 6 /* Internal MMU */ | ||
244 | |||
245 | #define MMU_68851 (1<<MMUB_68851) | ||
246 | #define MMU_68030 (1<<MMUB_68030) | ||
247 | #define MMU_68040 (1<<MMUB_68040) | ||
248 | #define MMU_68060 (1<<MMUB_68060) | ||
249 | #define MMU_SUN3 (1<<MMUB_SUN3) | ||
250 | #define MMU_APOLLO (1<<MMUB_APOLLO) | ||
251 | #define MMU_COLDFIRE (1<<MMUB_COLDFIRE) | ||
252 | |||
253 | #ifdef __KERNEL__ | ||
254 | 176 | ||
255 | #ifndef __ASSEMBLY__ | 177 | #ifndef __ASSEMBLY__ |
256 | extern unsigned long m68k_cputype; | 178 | extern unsigned long m68k_cputype; |
@@ -385,6 +307,4 @@ extern int m68k_realnum_memory; /* real # of memory blocks found */ | |||
385 | extern struct mem_info m68k_memory[NUM_MEMINFO];/* memory description */ | 307 | extern struct mem_info m68k_memory[NUM_MEMINFO];/* memory description */ |
386 | #endif | 308 | #endif |
387 | 309 | ||
388 | #endif /* __KERNEL__ */ | ||
389 | |||
390 | #endif /* _M68K_SETUP_H */ | 310 | #endif /* _M68K_SETUP_H */ |
diff --git a/arch/m68k/include/asm/signal.h b/arch/m68k/include/asm/signal.h index 60e88660169c..67e489d8d1bd 100644 --- a/arch/m68k/include/asm/signal.h +++ b/arch/m68k/include/asm/signal.h | |||
@@ -1,12 +1,8 @@ | |||
1 | #ifndef _M68K_SIGNAL_H | 1 | #ifndef _M68K_SIGNAL_H |
2 | #define _M68K_SIGNAL_H | 2 | #define _M68K_SIGNAL_H |
3 | 3 | ||
4 | #include <linux/types.h> | 4 | #include <uapi/asm/signal.h> |
5 | 5 | ||
6 | /* Avoid too many header ordering problems. */ | ||
7 | struct siginfo; | ||
8 | |||
9 | #ifdef __KERNEL__ | ||
10 | /* Most things should be clean enough to redefine this at will, if care | 6 | /* Most things should be clean enough to redefine this at will, if care |
11 | is taken to make libc match. */ | 7 | is taken to make libc match. */ |
12 | 8 | ||
@@ -20,92 +16,6 @@ typedef struct { | |||
20 | unsigned long sig[_NSIG_WORDS]; | 16 | unsigned long sig[_NSIG_WORDS]; |
21 | } sigset_t; | 17 | } sigset_t; |
22 | 18 | ||
23 | #else | ||
24 | /* Here we must cater to libcs that poke about in kernel headers. */ | ||
25 | |||
26 | #define NSIG 32 | ||
27 | typedef unsigned long sigset_t; | ||
28 | |||
29 | #endif /* __KERNEL__ */ | ||
30 | |||
31 | #define SIGHUP 1 | ||
32 | #define SIGINT 2 | ||
33 | #define SIGQUIT 3 | ||
34 | #define SIGILL 4 | ||
35 | #define SIGTRAP 5 | ||
36 | #define SIGABRT 6 | ||
37 | #define SIGIOT 6 | ||
38 | #define SIGBUS 7 | ||
39 | #define SIGFPE 8 | ||
40 | #define SIGKILL 9 | ||
41 | #define SIGUSR1 10 | ||
42 | #define SIGSEGV 11 | ||
43 | #define SIGUSR2 12 | ||
44 | #define SIGPIPE 13 | ||
45 | #define SIGALRM 14 | ||
46 | #define SIGTERM 15 | ||
47 | #define SIGSTKFLT 16 | ||
48 | #define SIGCHLD 17 | ||
49 | #define SIGCONT 18 | ||
50 | #define SIGSTOP 19 | ||
51 | #define SIGTSTP 20 | ||
52 | #define SIGTTIN 21 | ||
53 | #define SIGTTOU 22 | ||
54 | #define SIGURG 23 | ||
55 | #define SIGXCPU 24 | ||
56 | #define SIGXFSZ 25 | ||
57 | #define SIGVTALRM 26 | ||
58 | #define SIGPROF 27 | ||
59 | #define SIGWINCH 28 | ||
60 | #define SIGIO 29 | ||
61 | #define SIGPOLL SIGIO | ||
62 | /* | ||
63 | #define SIGLOST 29 | ||
64 | */ | ||
65 | #define SIGPWR 30 | ||
66 | #define SIGSYS 31 | ||
67 | #define SIGUNUSED 31 | ||
68 | |||
69 | /* These should not be considered constants from userland. */ | ||
70 | #define SIGRTMIN 32 | ||
71 | #define SIGRTMAX _NSIG | ||
72 | |||
73 | /* | ||
74 | * SA_FLAGS values: | ||
75 | * | ||
76 | * SA_ONSTACK indicates that a registered stack_t will be used. | ||
77 | * SA_RESTART flag to get restarting signals (which were the default long ago) | ||
78 | * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop. | ||
79 | * SA_RESETHAND clears the handler when the signal is delivered. | ||
80 | * SA_NOCLDWAIT flag on SIGCHLD to inhibit zombies. | ||
81 | * SA_NODEFER prevents the current signal from being masked in the handler. | ||
82 | * | ||
83 | * SA_ONESHOT and SA_NOMASK are the historical Linux names for the Single | ||
84 | * Unix names RESETHAND and NODEFER respectively. | ||
85 | */ | ||
86 | #define SA_NOCLDSTOP 0x00000001 | ||
87 | #define SA_NOCLDWAIT 0x00000002 | ||
88 | #define SA_SIGINFO 0x00000004 | ||
89 | #define SA_ONSTACK 0x08000000 | ||
90 | #define SA_RESTART 0x10000000 | ||
91 | #define SA_NODEFER 0x40000000 | ||
92 | #define SA_RESETHAND 0x80000000 | ||
93 | |||
94 | #define SA_NOMASK SA_NODEFER | ||
95 | #define SA_ONESHOT SA_RESETHAND | ||
96 | |||
97 | /* | ||
98 | * sigaltstack controls | ||
99 | */ | ||
100 | #define SS_ONSTACK 1 | ||
101 | #define SS_DISABLE 2 | ||
102 | |||
103 | #define MINSIGSTKSZ 2048 | ||
104 | #define SIGSTKSZ 8192 | ||
105 | |||
106 | #include <asm-generic/signal-defs.h> | ||
107 | |||
108 | #ifdef __KERNEL__ | ||
109 | struct old_sigaction { | 19 | struct old_sigaction { |
110 | __sighandler_t sa_handler; | 20 | __sighandler_t sa_handler; |
111 | old_sigset_t sa_mask; | 21 | old_sigset_t sa_mask; |
@@ -123,31 +33,6 @@ struct sigaction { | |||
123 | struct k_sigaction { | 33 | struct k_sigaction { |
124 | struct sigaction sa; | 34 | struct sigaction sa; |
125 | }; | 35 | }; |
126 | #else | ||
127 | /* Here we must cater to libcs that poke about in kernel headers. */ | ||
128 | |||
129 | struct sigaction { | ||
130 | union { | ||
131 | __sighandler_t _sa_handler; | ||
132 | void (*_sa_sigaction)(int, struct siginfo *, void *); | ||
133 | } _u; | ||
134 | sigset_t sa_mask; | ||
135 | unsigned long sa_flags; | ||
136 | void (*sa_restorer)(void); | ||
137 | }; | ||
138 | |||
139 | #define sa_handler _u._sa_handler | ||
140 | #define sa_sigaction _u._sa_sigaction | ||
141 | |||
142 | #endif /* __KERNEL__ */ | ||
143 | |||
144 | typedef struct sigaltstack { | ||
145 | void __user *ss_sp; | ||
146 | int ss_flags; | ||
147 | size_t ss_size; | ||
148 | } stack_t; | ||
149 | |||
150 | #ifdef __KERNEL__ | ||
151 | #include <asm/sigcontext.h> | 36 | #include <asm/sigcontext.h> |
152 | 37 | ||
153 | #ifndef CONFIG_CPU_HAS_NO_BITFIELDS | 38 | #ifndef CONFIG_CPU_HAS_NO_BITFIELDS |
@@ -208,5 +93,4 @@ struct pt_regs; | |||
208 | extern void ptrace_signal_deliver(struct pt_regs *regs, void *cookie); | 93 | extern void ptrace_signal_deliver(struct pt_regs *regs, void *cookie); |
209 | #endif /* __uClinux__ */ | 94 | #endif /* __uClinux__ */ |
210 | 95 | ||
211 | #endif /* __KERNEL__ */ | ||
212 | #endif /* _M68K_SIGNAL_H */ | 96 | #endif /* _M68K_SIGNAL_H */ |
diff --git a/arch/m68k/include/asm/termios.h b/arch/m68k/include/asm/termios.h index 0823032e4045..ad8efb098663 100644 --- a/arch/m68k/include/asm/termios.h +++ b/arch/m68k/include/asm/termios.h | |||
@@ -1,27 +1,8 @@ | |||
1 | #ifndef _M68K_TERMIOS_H | 1 | #ifndef _M68K_TERMIOS_H |
2 | #define _M68K_TERMIOS_H | 2 | #define _M68K_TERMIOS_H |
3 | 3 | ||
4 | #include <asm/termbits.h> | 4 | #include <uapi/asm/termios.h> |
5 | #include <asm/ioctls.h> | ||
6 | 5 | ||
7 | struct winsize { | ||
8 | unsigned short ws_row; | ||
9 | unsigned short ws_col; | ||
10 | unsigned short ws_xpixel; | ||
11 | unsigned short ws_ypixel; | ||
12 | }; | ||
13 | |||
14 | #define NCC 8 | ||
15 | struct termio { | ||
16 | unsigned short c_iflag; /* input mode flags */ | ||
17 | unsigned short c_oflag; /* output mode flags */ | ||
18 | unsigned short c_cflag; /* control mode flags */ | ||
19 | unsigned short c_lflag; /* local mode flags */ | ||
20 | unsigned char c_line; /* line discipline */ | ||
21 | unsigned char c_cc[NCC]; /* control characters */ | ||
22 | }; | ||
23 | |||
24 | #ifdef __KERNEL__ | ||
25 | /* intr=^C quit=^| erase=del kill=^U | 6 | /* intr=^C quit=^| erase=del kill=^U |
26 | eof=^D vtime=\0 vmin=\1 sxtc=\0 | 7 | eof=^D vtime=\0 vmin=\1 sxtc=\0 |
27 | start=^Q stop=^S susp=^Z eol=\0 | 8 | start=^Q stop=^S susp=^Z eol=\0 |
@@ -29,27 +10,6 @@ struct termio { | |||
29 | eol2=\0 | 10 | eol2=\0 |
30 | */ | 11 | */ |
31 | #define INIT_C_CC "\003\034\177\025\004\0\1\0\021\023\032\0\022\017\027\026\0" | 12 | #define INIT_C_CC "\003\034\177\025\004\0\1\0\021\023\032\0\022\017\027\026\0" |
32 | #endif | ||
33 | |||
34 | /* modem lines */ | ||
35 | #define TIOCM_LE 0x001 | ||
36 | #define TIOCM_DTR 0x002 | ||
37 | #define TIOCM_RTS 0x004 | ||
38 | #define TIOCM_ST 0x008 | ||
39 | #define TIOCM_SR 0x010 | ||
40 | #define TIOCM_CTS 0x020 | ||
41 | #define TIOCM_CAR 0x040 | ||
42 | #define TIOCM_RNG 0x080 | ||
43 | #define TIOCM_DSR 0x100 | ||
44 | #define TIOCM_CD TIOCM_CAR | ||
45 | #define TIOCM_RI TIOCM_RNG | ||
46 | #define TIOCM_OUT1 0x2000 | ||
47 | #define TIOCM_OUT2 0x4000 | ||
48 | #define TIOCM_LOOP 0x8000 | ||
49 | |||
50 | /* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */ | ||
51 | |||
52 | #ifdef __KERNEL__ | ||
53 | 13 | ||
54 | /* | 14 | /* |
55 | * Translate a "termio" structure into a "termios". Ugh. | 15 | * Translate a "termio" structure into a "termios". Ugh. |
@@ -87,6 +47,4 @@ struct termio { | |||
87 | #define user_termios_to_kernel_termios_1(k, u) copy_from_user(k, u, sizeof(struct termios)) | 47 | #define user_termios_to_kernel_termios_1(k, u) copy_from_user(k, u, sizeof(struct termios)) |
88 | #define kernel_termios_to_user_termios_1(u, k) copy_to_user(u, k, sizeof(struct termios)) | 48 | #define kernel_termios_to_user_termios_1(u, k) copy_to_user(u, k, sizeof(struct termios)) |
89 | 49 | ||
90 | #endif /* __KERNEL__ */ | ||
91 | |||
92 | #endif /* _M68K_TERMIOS_H */ | 50 | #endif /* _M68K_TERMIOS_H */ |
diff --git a/arch/m68k/include/asm/unistd.h b/arch/m68k/include/asm/unistd.h index c702ad716791..5fc7f7bec1c8 100644 --- a/arch/m68k/include/asm/unistd.h +++ b/arch/m68k/include/asm/unistd.h | |||
@@ -1,361 +1,10 @@ | |||
1 | #ifndef _ASM_M68K_UNISTD_H_ | 1 | #ifndef _ASM_M68K_UNISTD_H_ |
2 | #define _ASM_M68K_UNISTD_H_ | 2 | #define _ASM_M68K_UNISTD_H_ |
3 | 3 | ||
4 | /* | 4 | #include <uapi/asm/unistd.h> |
5 | * This file contains the system call numbers. | ||
6 | */ | ||
7 | |||
8 | #define __NR_restart_syscall 0 | ||
9 | #define __NR_exit 1 | ||
10 | #define __NR_fork 2 | ||
11 | #define __NR_read 3 | ||
12 | #define __NR_write 4 | ||
13 | #define __NR_open 5 | ||
14 | #define __NR_close 6 | ||
15 | #define __NR_waitpid 7 | ||
16 | #define __NR_creat 8 | ||
17 | #define __NR_link 9 | ||
18 | #define __NR_unlink 10 | ||
19 | #define __NR_execve 11 | ||
20 | #define __NR_chdir 12 | ||
21 | #define __NR_time 13 | ||
22 | #define __NR_mknod 14 | ||
23 | #define __NR_chmod 15 | ||
24 | #define __NR_chown 16 | ||
25 | /*#define __NR_break 17*/ | ||
26 | #define __NR_oldstat 18 | ||
27 | #define __NR_lseek 19 | ||
28 | #define __NR_getpid 20 | ||
29 | #define __NR_mount 21 | ||
30 | #define __NR_umount 22 | ||
31 | #define __NR_setuid 23 | ||
32 | #define __NR_getuid 24 | ||
33 | #define __NR_stime 25 | ||
34 | #define __NR_ptrace 26 | ||
35 | #define __NR_alarm 27 | ||
36 | #define __NR_oldfstat 28 | ||
37 | #define __NR_pause 29 | ||
38 | #define __NR_utime 30 | ||
39 | /*#define __NR_stty 31*/ | ||
40 | /*#define __NR_gtty 32*/ | ||
41 | #define __NR_access 33 | ||
42 | #define __NR_nice 34 | ||
43 | /*#define __NR_ftime 35*/ | ||
44 | #define __NR_sync 36 | ||
45 | #define __NR_kill 37 | ||
46 | #define __NR_rename 38 | ||
47 | #define __NR_mkdir 39 | ||
48 | #define __NR_rmdir 40 | ||
49 | #define __NR_dup 41 | ||
50 | #define __NR_pipe 42 | ||
51 | #define __NR_times 43 | ||
52 | /*#define __NR_prof 44*/ | ||
53 | #define __NR_brk 45 | ||
54 | #define __NR_setgid 46 | ||
55 | #define __NR_getgid 47 | ||
56 | #define __NR_signal 48 | ||
57 | #define __NR_geteuid 49 | ||
58 | #define __NR_getegid 50 | ||
59 | #define __NR_acct 51 | ||
60 | #define __NR_umount2 52 | ||
61 | /*#define __NR_lock 53*/ | ||
62 | #define __NR_ioctl 54 | ||
63 | #define __NR_fcntl 55 | ||
64 | /*#define __NR_mpx 56*/ | ||
65 | #define __NR_setpgid 57 | ||
66 | /*#define __NR_ulimit 58*/ | ||
67 | /*#define __NR_oldolduname 59*/ | ||
68 | #define __NR_umask 60 | ||
69 | #define __NR_chroot 61 | ||
70 | #define __NR_ustat 62 | ||
71 | #define __NR_dup2 63 | ||
72 | #define __NR_getppid 64 | ||
73 | #define __NR_getpgrp 65 | ||
74 | #define __NR_setsid 66 | ||
75 | #define __NR_sigaction 67 | ||
76 | #define __NR_sgetmask 68 | ||
77 | #define __NR_ssetmask 69 | ||
78 | #define __NR_setreuid 70 | ||
79 | #define __NR_setregid 71 | ||
80 | #define __NR_sigsuspend 72 | ||
81 | #define __NR_sigpending 73 | ||
82 | #define __NR_sethostname 74 | ||
83 | #define __NR_setrlimit 75 | ||
84 | #define __NR_getrlimit 76 | ||
85 | #define __NR_getrusage 77 | ||
86 | #define __NR_gettimeofday 78 | ||
87 | #define __NR_settimeofday 79 | ||
88 | #define __NR_getgroups 80 | ||
89 | #define __NR_setgroups 81 | ||
90 | #define __NR_select 82 | ||
91 | #define __NR_symlink 83 | ||
92 | #define __NR_oldlstat 84 | ||
93 | #define __NR_readlink 85 | ||
94 | #define __NR_uselib 86 | ||
95 | #define __NR_swapon 87 | ||
96 | #define __NR_reboot 88 | ||
97 | #define __NR_readdir 89 | ||
98 | #define __NR_mmap 90 | ||
99 | #define __NR_munmap 91 | ||
100 | #define __NR_truncate 92 | ||
101 | #define __NR_ftruncate 93 | ||
102 | #define __NR_fchmod 94 | ||
103 | #define __NR_fchown 95 | ||
104 | #define __NR_getpriority 96 | ||
105 | #define __NR_setpriority 97 | ||
106 | /*#define __NR_profil 98*/ | ||
107 | #define __NR_statfs 99 | ||
108 | #define __NR_fstatfs 100 | ||
109 | /*#define __NR_ioperm 101*/ | ||
110 | #define __NR_socketcall 102 | ||
111 | #define __NR_syslog 103 | ||
112 | #define __NR_setitimer 104 | ||
113 | #define __NR_getitimer 105 | ||
114 | #define __NR_stat 106 | ||
115 | #define __NR_lstat 107 | ||
116 | #define __NR_fstat 108 | ||
117 | /*#define __NR_olduname 109*/ | ||
118 | /*#define __NR_iopl 110*/ /* not supported */ | ||
119 | #define __NR_vhangup 111 | ||
120 | /*#define __NR_idle 112*/ /* Obsolete */ | ||
121 | /*#define __NR_vm86 113*/ /* not supported */ | ||
122 | #define __NR_wait4 114 | ||
123 | #define __NR_swapoff 115 | ||
124 | #define __NR_sysinfo 116 | ||
125 | #define __NR_ipc 117 | ||
126 | #define __NR_fsync 118 | ||
127 | #define __NR_sigreturn 119 | ||
128 | #define __NR_clone 120 | ||
129 | #define __NR_setdomainname 121 | ||
130 | #define __NR_uname 122 | ||
131 | #define __NR_cacheflush 123 | ||
132 | #define __NR_adjtimex 124 | ||
133 | #define __NR_mprotect 125 | ||
134 | #define __NR_sigprocmask 126 | ||
135 | #define __NR_create_module 127 | ||
136 | #define __NR_init_module 128 | ||
137 | #define __NR_delete_module 129 | ||
138 | #define __NR_get_kernel_syms 130 | ||
139 | #define __NR_quotactl 131 | ||
140 | #define __NR_getpgid 132 | ||
141 | #define __NR_fchdir 133 | ||
142 | #define __NR_bdflush 134 | ||
143 | #define __NR_sysfs 135 | ||
144 | #define __NR_personality 136 | ||
145 | /*#define __NR_afs_syscall 137*/ /* Syscall for Andrew File System */ | ||
146 | #define __NR_setfsuid 138 | ||
147 | #define __NR_setfsgid 139 | ||
148 | #define __NR__llseek 140 | ||
149 | #define __NR_getdents 141 | ||
150 | #define __NR__newselect 142 | ||
151 | #define __NR_flock 143 | ||
152 | #define __NR_msync 144 | ||
153 | #define __NR_readv 145 | ||
154 | #define __NR_writev 146 | ||
155 | #define __NR_getsid 147 | ||
156 | #define __NR_fdatasync 148 | ||
157 | #define __NR__sysctl 149 | ||
158 | #define __NR_mlock 150 | ||
159 | #define __NR_munlock 151 | ||
160 | #define __NR_mlockall 152 | ||
161 | #define __NR_munlockall 153 | ||
162 | #define __NR_sched_setparam 154 | ||
163 | #define __NR_sched_getparam 155 | ||
164 | #define __NR_sched_setscheduler 156 | ||
165 | #define __NR_sched_getscheduler 157 | ||
166 | #define __NR_sched_yield 158 | ||
167 | #define __NR_sched_get_priority_max 159 | ||
168 | #define __NR_sched_get_priority_min 160 | ||
169 | #define __NR_sched_rr_get_interval 161 | ||
170 | #define __NR_nanosleep 162 | ||
171 | #define __NR_mremap 163 | ||
172 | #define __NR_setresuid 164 | ||
173 | #define __NR_getresuid 165 | ||
174 | #define __NR_getpagesize 166 | ||
175 | #define __NR_query_module 167 | ||
176 | #define __NR_poll 168 | ||
177 | #define __NR_nfsservctl 169 | ||
178 | #define __NR_setresgid 170 | ||
179 | #define __NR_getresgid 171 | ||
180 | #define __NR_prctl 172 | ||
181 | #define __NR_rt_sigreturn 173 | ||
182 | #define __NR_rt_sigaction 174 | ||
183 | #define __NR_rt_sigprocmask 175 | ||
184 | #define __NR_rt_sigpending 176 | ||
185 | #define __NR_rt_sigtimedwait 177 | ||
186 | #define __NR_rt_sigqueueinfo 178 | ||
187 | #define __NR_rt_sigsuspend 179 | ||
188 | #define __NR_pread64 180 | ||
189 | #define __NR_pwrite64 181 | ||
190 | #define __NR_lchown 182 | ||
191 | #define __NR_getcwd 183 | ||
192 | #define __NR_capget 184 | ||
193 | #define __NR_capset 185 | ||
194 | #define __NR_sigaltstack 186 | ||
195 | #define __NR_sendfile 187 | ||
196 | #define __NR_getpmsg 188 /* some people actually want streams */ | ||
197 | #define __NR_putpmsg 189 /* some people actually want streams */ | ||
198 | #define __NR_vfork 190 | ||
199 | #define __NR_ugetrlimit 191 | ||
200 | #define __NR_mmap2 192 | ||
201 | #define __NR_truncate64 193 | ||
202 | #define __NR_ftruncate64 194 | ||
203 | #define __NR_stat64 195 | ||
204 | #define __NR_lstat64 196 | ||
205 | #define __NR_fstat64 197 | ||
206 | #define __NR_chown32 198 | ||
207 | #define __NR_getuid32 199 | ||
208 | #define __NR_getgid32 200 | ||
209 | #define __NR_geteuid32 201 | ||
210 | #define __NR_getegid32 202 | ||
211 | #define __NR_setreuid32 203 | ||
212 | #define __NR_setregid32 204 | ||
213 | #define __NR_getgroups32 205 | ||
214 | #define __NR_setgroups32 206 | ||
215 | #define __NR_fchown32 207 | ||
216 | #define __NR_setresuid32 208 | ||
217 | #define __NR_getresuid32 209 | ||
218 | #define __NR_setresgid32 210 | ||
219 | #define __NR_getresgid32 211 | ||
220 | #define __NR_lchown32 212 | ||
221 | #define __NR_setuid32 213 | ||
222 | #define __NR_setgid32 214 | ||
223 | #define __NR_setfsuid32 215 | ||
224 | #define __NR_setfsgid32 216 | ||
225 | #define __NR_pivot_root 217 | ||
226 | /* 218*/ | ||
227 | /* 219*/ | ||
228 | #define __NR_getdents64 220 | ||
229 | #define __NR_gettid 221 | ||
230 | #define __NR_tkill 222 | ||
231 | #define __NR_setxattr 223 | ||
232 | #define __NR_lsetxattr 224 | ||
233 | #define __NR_fsetxattr 225 | ||
234 | #define __NR_getxattr 226 | ||
235 | #define __NR_lgetxattr 227 | ||
236 | #define __NR_fgetxattr 228 | ||
237 | #define __NR_listxattr 229 | ||
238 | #define __NR_llistxattr 230 | ||
239 | #define __NR_flistxattr 231 | ||
240 | #define __NR_removexattr 232 | ||
241 | #define __NR_lremovexattr 233 | ||
242 | #define __NR_fremovexattr 234 | ||
243 | #define __NR_futex 235 | ||
244 | #define __NR_sendfile64 236 | ||
245 | #define __NR_mincore 237 | ||
246 | #define __NR_madvise 238 | ||
247 | #define __NR_fcntl64 239 | ||
248 | #define __NR_readahead 240 | ||
249 | #define __NR_io_setup 241 | ||
250 | #define __NR_io_destroy 242 | ||
251 | #define __NR_io_getevents 243 | ||
252 | #define __NR_io_submit 244 | ||
253 | #define __NR_io_cancel 245 | ||
254 | #define __NR_fadvise64 246 | ||
255 | #define __NR_exit_group 247 | ||
256 | #define __NR_lookup_dcookie 248 | ||
257 | #define __NR_epoll_create 249 | ||
258 | #define __NR_epoll_ctl 250 | ||
259 | #define __NR_epoll_wait 251 | ||
260 | #define __NR_remap_file_pages 252 | ||
261 | #define __NR_set_tid_address 253 | ||
262 | #define __NR_timer_create 254 | ||
263 | #define __NR_timer_settime 255 | ||
264 | #define __NR_timer_gettime 256 | ||
265 | #define __NR_timer_getoverrun 257 | ||
266 | #define __NR_timer_delete 258 | ||
267 | #define __NR_clock_settime 259 | ||
268 | #define __NR_clock_gettime 260 | ||
269 | #define __NR_clock_getres 261 | ||
270 | #define __NR_clock_nanosleep 262 | ||
271 | #define __NR_statfs64 263 | ||
272 | #define __NR_fstatfs64 264 | ||
273 | #define __NR_tgkill 265 | ||
274 | #define __NR_utimes 266 | ||
275 | #define __NR_fadvise64_64 267 | ||
276 | #define __NR_mbind 268 | ||
277 | #define __NR_get_mempolicy 269 | ||
278 | #define __NR_set_mempolicy 270 | ||
279 | #define __NR_mq_open 271 | ||
280 | #define __NR_mq_unlink 272 | ||
281 | #define __NR_mq_timedsend 273 | ||
282 | #define __NR_mq_timedreceive 274 | ||
283 | #define __NR_mq_notify 275 | ||
284 | #define __NR_mq_getsetattr 276 | ||
285 | #define __NR_waitid 277 | ||
286 | /*#define __NR_vserver 278*/ | ||
287 | #define __NR_add_key 279 | ||
288 | #define __NR_request_key 280 | ||
289 | #define __NR_keyctl 281 | ||
290 | #define __NR_ioprio_set 282 | ||
291 | #define __NR_ioprio_get 283 | ||
292 | #define __NR_inotify_init 284 | ||
293 | #define __NR_inotify_add_watch 285 | ||
294 | #define __NR_inotify_rm_watch 286 | ||
295 | #define __NR_migrate_pages 287 | ||
296 | #define __NR_openat 288 | ||
297 | #define __NR_mkdirat 289 | ||
298 | #define __NR_mknodat 290 | ||
299 | #define __NR_fchownat 291 | ||
300 | #define __NR_futimesat 292 | ||
301 | #define __NR_fstatat64 293 | ||
302 | #define __NR_unlinkat 294 | ||
303 | #define __NR_renameat 295 | ||
304 | #define __NR_linkat 296 | ||
305 | #define __NR_symlinkat 297 | ||
306 | #define __NR_readlinkat 298 | ||
307 | #define __NR_fchmodat 299 | ||
308 | #define __NR_faccessat 300 | ||
309 | #define __NR_pselect6 301 | ||
310 | #define __NR_ppoll 302 | ||
311 | #define __NR_unshare 303 | ||
312 | #define __NR_set_robust_list 304 | ||
313 | #define __NR_get_robust_list 305 | ||
314 | #define __NR_splice 306 | ||
315 | #define __NR_sync_file_range 307 | ||
316 | #define __NR_tee 308 | ||
317 | #define __NR_vmsplice 309 | ||
318 | #define __NR_move_pages 310 | ||
319 | #define __NR_sched_setaffinity 311 | ||
320 | #define __NR_sched_getaffinity 312 | ||
321 | #define __NR_kexec_load 313 | ||
322 | #define __NR_getcpu 314 | ||
323 | #define __NR_epoll_pwait 315 | ||
324 | #define __NR_utimensat 316 | ||
325 | #define __NR_signalfd 317 | ||
326 | #define __NR_timerfd_create 318 | ||
327 | #define __NR_eventfd 319 | ||
328 | #define __NR_fallocate 320 | ||
329 | #define __NR_timerfd_settime 321 | ||
330 | #define __NR_timerfd_gettime 322 | ||
331 | #define __NR_signalfd4 323 | ||
332 | #define __NR_eventfd2 324 | ||
333 | #define __NR_epoll_create1 325 | ||
334 | #define __NR_dup3 326 | ||
335 | #define __NR_pipe2 327 | ||
336 | #define __NR_inotify_init1 328 | ||
337 | #define __NR_preadv 329 | ||
338 | #define __NR_pwritev 330 | ||
339 | #define __NR_rt_tgsigqueueinfo 331 | ||
340 | #define __NR_perf_event_open 332 | ||
341 | #define __NR_get_thread_area 333 | ||
342 | #define __NR_set_thread_area 334 | ||
343 | #define __NR_atomic_cmpxchg_32 335 | ||
344 | #define __NR_atomic_barrier 336 | ||
345 | #define __NR_fanotify_init 337 | ||
346 | #define __NR_fanotify_mark 338 | ||
347 | #define __NR_prlimit64 339 | ||
348 | #define __NR_name_to_handle_at 340 | ||
349 | #define __NR_open_by_handle_at 341 | ||
350 | #define __NR_clock_adjtime 342 | ||
351 | #define __NR_syncfs 343 | ||
352 | #define __NR_setns 344 | ||
353 | #define __NR_process_vm_readv 345 | ||
354 | #define __NR_process_vm_writev 346 | ||
355 | 5 | ||
356 | #ifdef __KERNEL__ | ||
357 | 6 | ||
358 | #define NR_syscalls 347 | 7 | #define NR_syscalls 348 |
359 | 8 | ||
360 | #define __ARCH_WANT_OLD_READDIR | 9 | #define __ARCH_WANT_OLD_READDIR |
361 | #define __ARCH_WANT_OLD_STAT | 10 | #define __ARCH_WANT_OLD_STAT |
@@ -393,5 +42,4 @@ | |||
393 | */ | 42 | */ |
394 | #define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall") | 43 | #define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall") |
395 | 44 | ||
396 | #endif /* __KERNEL__ */ | ||
397 | #endif /* _ASM_M68K_UNISTD_H_ */ | 45 | #endif /* _ASM_M68K_UNISTD_H_ */ |
diff --git a/arch/m68k/include/uapi/asm/Kbuild b/arch/m68k/include/uapi/asm/Kbuild index baebb3da1d44..972bce120e1e 100644 --- a/arch/m68k/include/uapi/asm/Kbuild +++ b/arch/m68k/include/uapi/asm/Kbuild | |||
@@ -1,3 +1,26 @@ | |||
1 | # UAPI Header export list | 1 | # UAPI Header export list |
2 | include include/uapi/asm-generic/Kbuild.asm | 2 | include include/uapi/asm-generic/Kbuild.asm |
3 | 3 | ||
4 | header-y += a.out.h | ||
5 | header-y += auxvec.h | ||
6 | header-y += byteorder.h | ||
7 | header-y += cachectl.h | ||
8 | header-y += fcntl.h | ||
9 | header-y += ioctls.h | ||
10 | header-y += msgbuf.h | ||
11 | header-y += param.h | ||
12 | header-y += poll.h | ||
13 | header-y += posix_types.h | ||
14 | header-y += ptrace.h | ||
15 | header-y += sembuf.h | ||
16 | header-y += setup.h | ||
17 | header-y += shmbuf.h | ||
18 | header-y += sigcontext.h | ||
19 | header-y += signal.h | ||
20 | header-y += socket.h | ||
21 | header-y += sockios.h | ||
22 | header-y += stat.h | ||
23 | header-y += swab.h | ||
24 | header-y += termbits.h | ||
25 | header-y += termios.h | ||
26 | header-y += unistd.h | ||
diff --git a/arch/m68k/include/asm/a.out.h b/arch/m68k/include/uapi/asm/a.out.h index 3885fe43432a..3885fe43432a 100644 --- a/arch/m68k/include/asm/a.out.h +++ b/arch/m68k/include/uapi/asm/a.out.h | |||
diff --git a/arch/m68k/include/asm/auxvec.h b/arch/m68k/include/uapi/asm/auxvec.h index 844d6d52204b..844d6d52204b 100644 --- a/arch/m68k/include/asm/auxvec.h +++ b/arch/m68k/include/uapi/asm/auxvec.h | |||
diff --git a/arch/m68k/include/asm/byteorder.h b/arch/m68k/include/uapi/asm/byteorder.h index 31b260a88803..31b260a88803 100644 --- a/arch/m68k/include/asm/byteorder.h +++ b/arch/m68k/include/uapi/asm/byteorder.h | |||
diff --git a/arch/m68k/include/asm/cachectl.h b/arch/m68k/include/uapi/asm/cachectl.h index 525978e959e3..525978e959e3 100644 --- a/arch/m68k/include/asm/cachectl.h +++ b/arch/m68k/include/uapi/asm/cachectl.h | |||
diff --git a/arch/m68k/include/asm/fcntl.h b/arch/m68k/include/uapi/asm/fcntl.h index 1c369b20dc45..1c369b20dc45 100644 --- a/arch/m68k/include/asm/fcntl.h +++ b/arch/m68k/include/uapi/asm/fcntl.h | |||
diff --git a/arch/m68k/include/asm/ioctls.h b/arch/m68k/include/uapi/asm/ioctls.h index 1332bb4ca5b0..1332bb4ca5b0 100644 --- a/arch/m68k/include/asm/ioctls.h +++ b/arch/m68k/include/uapi/asm/ioctls.h | |||
diff --git a/arch/m68k/include/asm/msgbuf.h b/arch/m68k/include/uapi/asm/msgbuf.h index 243cb798de8f..243cb798de8f 100644 --- a/arch/m68k/include/asm/msgbuf.h +++ b/arch/m68k/include/uapi/asm/msgbuf.h | |||
diff --git a/arch/m68k/include/asm/param.h b/arch/m68k/include/uapi/asm/param.h index 36265ccf5c7b..36265ccf5c7b 100644 --- a/arch/m68k/include/asm/param.h +++ b/arch/m68k/include/uapi/asm/param.h | |||
diff --git a/arch/m68k/include/asm/poll.h b/arch/m68k/include/uapi/asm/poll.h index f080fcdb61bf..f080fcdb61bf 100644 --- a/arch/m68k/include/asm/poll.h +++ b/arch/m68k/include/uapi/asm/poll.h | |||
diff --git a/arch/m68k/include/asm/posix_types.h b/arch/m68k/include/uapi/asm/posix_types.h index cf4dbf70fdc7..cf4dbf70fdc7 100644 --- a/arch/m68k/include/asm/posix_types.h +++ b/arch/m68k/include/uapi/asm/posix_types.h | |||
diff --git a/arch/m68k/include/uapi/asm/ptrace.h b/arch/m68k/include/uapi/asm/ptrace.h new file mode 100644 index 000000000000..caf92fd34939 --- /dev/null +++ b/arch/m68k/include/uapi/asm/ptrace.h | |||
@@ -0,0 +1,79 @@ | |||
1 | #ifndef _UAPI_M68K_PTRACE_H | ||
2 | #define _UAPI_M68K_PTRACE_H | ||
3 | |||
4 | #define PT_D1 0 | ||
5 | #define PT_D2 1 | ||
6 | #define PT_D3 2 | ||
7 | #define PT_D4 3 | ||
8 | #define PT_D5 4 | ||
9 | #define PT_D6 5 | ||
10 | #define PT_D7 6 | ||
11 | #define PT_A0 7 | ||
12 | #define PT_A1 8 | ||
13 | #define PT_A2 9 | ||
14 | #define PT_A3 10 | ||
15 | #define PT_A4 11 | ||
16 | #define PT_A5 12 | ||
17 | #define PT_A6 13 | ||
18 | #define PT_D0 14 | ||
19 | #define PT_USP 15 | ||
20 | #define PT_ORIG_D0 16 | ||
21 | #define PT_SR 17 | ||
22 | #define PT_PC 18 | ||
23 | |||
24 | #ifndef __ASSEMBLY__ | ||
25 | |||
26 | /* this struct defines the way the registers are stored on the | ||
27 | stack during a system call. */ | ||
28 | |||
29 | struct pt_regs { | ||
30 | long d1; | ||
31 | long d2; | ||
32 | long d3; | ||
33 | long d4; | ||
34 | long d5; | ||
35 | long a0; | ||
36 | long a1; | ||
37 | long a2; | ||
38 | long d0; | ||
39 | long orig_d0; | ||
40 | long stkadj; | ||
41 | #ifdef CONFIG_COLDFIRE | ||
42 | unsigned format : 4; /* frame format specifier */ | ||
43 | unsigned vector : 12; /* vector offset */ | ||
44 | unsigned short sr; | ||
45 | unsigned long pc; | ||
46 | #else | ||
47 | unsigned short sr; | ||
48 | unsigned long pc; | ||
49 | unsigned format : 4; /* frame format specifier */ | ||
50 | unsigned vector : 12; /* vector offset */ | ||
51 | #endif | ||
52 | }; | ||
53 | |||
54 | /* | ||
55 | * This is the extended stack used by signal handlers and the context | ||
56 | * switcher: it's pushed after the normal "struct pt_regs". | ||
57 | */ | ||
58 | struct switch_stack { | ||
59 | unsigned long d6; | ||
60 | unsigned long d7; | ||
61 | unsigned long a3; | ||
62 | unsigned long a4; | ||
63 | unsigned long a5; | ||
64 | unsigned long a6; | ||
65 | unsigned long retpc; | ||
66 | }; | ||
67 | |||
68 | /* Arbitrarily choose the same ptrace numbers as used by the Sparc code. */ | ||
69 | #define PTRACE_GETREGS 12 | ||
70 | #define PTRACE_SETREGS 13 | ||
71 | #define PTRACE_GETFPREGS 14 | ||
72 | #define PTRACE_SETFPREGS 15 | ||
73 | |||
74 | #define PTRACE_GET_THREAD_AREA 25 | ||
75 | |||
76 | #define PTRACE_SINGLEBLOCK 33 /* resume execution until next branch */ | ||
77 | |||
78 | #endif /* __ASSEMBLY__ */ | ||
79 | #endif /* _UAPI_M68K_PTRACE_H */ | ||
diff --git a/arch/m68k/include/asm/sembuf.h b/arch/m68k/include/uapi/asm/sembuf.h index 2308052a8c24..2308052a8c24 100644 --- a/arch/m68k/include/asm/sembuf.h +++ b/arch/m68k/include/uapi/asm/sembuf.h | |||
diff --git a/arch/m68k/include/uapi/asm/setup.h b/arch/m68k/include/uapi/asm/setup.h new file mode 100644 index 000000000000..85579bff455c --- /dev/null +++ b/arch/m68k/include/uapi/asm/setup.h | |||
@@ -0,0 +1,103 @@ | |||
1 | /* | ||
2 | ** asm/setup.h -- Definition of the Linux/m68k setup information | ||
3 | ** | ||
4 | ** Copyright 1992 by Greg Harp | ||
5 | ** | ||
6 | ** This file is subject to the terms and conditions of the GNU General Public | ||
7 | ** License. See the file COPYING in the main directory of this archive | ||
8 | ** for more details. | ||
9 | ** | ||
10 | ** Created 09/29/92 by Greg Harp | ||
11 | ** | ||
12 | ** 5/2/94 Roman Hodek: | ||
13 | ** Added bi_atari part of the machine dependent union bi_un; for now it | ||
14 | ** contains just a model field to distinguish between TT and Falcon. | ||
15 | ** 26/7/96 Roman Zippel: | ||
16 | ** Renamed to setup.h; added some useful macros to allow gcc some | ||
17 | ** optimizations if possible. | ||
18 | ** 5/10/96 Geert Uytterhoeven: | ||
19 | ** Redesign of the boot information structure; moved boot information | ||
20 | ** structure to bootinfo.h | ||
21 | */ | ||
22 | |||
23 | #ifndef _UAPI_M68K_SETUP_H | ||
24 | #define _UAPI_M68K_SETUP_H | ||
25 | |||
26 | |||
27 | |||
28 | /* | ||
29 | * Linux/m68k Architectures | ||
30 | */ | ||
31 | |||
32 | #define MACH_AMIGA 1 | ||
33 | #define MACH_ATARI 2 | ||
34 | #define MACH_MAC 3 | ||
35 | #define MACH_APOLLO 4 | ||
36 | #define MACH_SUN3 5 | ||
37 | #define MACH_MVME147 6 | ||
38 | #define MACH_MVME16x 7 | ||
39 | #define MACH_BVME6000 8 | ||
40 | #define MACH_HP300 9 | ||
41 | #define MACH_Q40 10 | ||
42 | #define MACH_SUN3X 11 | ||
43 | #define MACH_M54XX 12 | ||
44 | |||
45 | #define COMMAND_LINE_SIZE 256 | ||
46 | |||
47 | |||
48 | |||
49 | /* | ||
50 | * CPU, FPU and MMU types | ||
51 | * | ||
52 | * Note: we may rely on the following equalities: | ||
53 | * | ||
54 | * CPU_68020 == MMU_68851 | ||
55 | * CPU_68030 == MMU_68030 | ||
56 | * CPU_68040 == FPU_68040 == MMU_68040 | ||
57 | * CPU_68060 == FPU_68060 == MMU_68060 | ||
58 | */ | ||
59 | |||
60 | #define CPUB_68020 0 | ||
61 | #define CPUB_68030 1 | ||
62 | #define CPUB_68040 2 | ||
63 | #define CPUB_68060 3 | ||
64 | #define CPUB_COLDFIRE 4 | ||
65 | |||
66 | #define CPU_68020 (1<<CPUB_68020) | ||
67 | #define CPU_68030 (1<<CPUB_68030) | ||
68 | #define CPU_68040 (1<<CPUB_68040) | ||
69 | #define CPU_68060 (1<<CPUB_68060) | ||
70 | #define CPU_COLDFIRE (1<<CPUB_COLDFIRE) | ||
71 | |||
72 | #define FPUB_68881 0 | ||
73 | #define FPUB_68882 1 | ||
74 | #define FPUB_68040 2 /* Internal FPU */ | ||
75 | #define FPUB_68060 3 /* Internal FPU */ | ||
76 | #define FPUB_SUNFPA 4 /* Sun-3 FPA */ | ||
77 | #define FPUB_COLDFIRE 5 /* ColdFire FPU */ | ||
78 | |||
79 | #define FPU_68881 (1<<FPUB_68881) | ||
80 | #define FPU_68882 (1<<FPUB_68882) | ||
81 | #define FPU_68040 (1<<FPUB_68040) | ||
82 | #define FPU_68060 (1<<FPUB_68060) | ||
83 | #define FPU_SUNFPA (1<<FPUB_SUNFPA) | ||
84 | #define FPU_COLDFIRE (1<<FPUB_COLDFIRE) | ||
85 | |||
86 | #define MMUB_68851 0 | ||
87 | #define MMUB_68030 1 /* Internal MMU */ | ||
88 | #define MMUB_68040 2 /* Internal MMU */ | ||
89 | #define MMUB_68060 3 /* Internal MMU */ | ||
90 | #define MMUB_APOLLO 4 /* Custom Apollo */ | ||
91 | #define MMUB_SUN3 5 /* Custom Sun-3 */ | ||
92 | #define MMUB_COLDFIRE 6 /* Internal MMU */ | ||
93 | |||
94 | #define MMU_68851 (1<<MMUB_68851) | ||
95 | #define MMU_68030 (1<<MMUB_68030) | ||
96 | #define MMU_68040 (1<<MMUB_68040) | ||
97 | #define MMU_68060 (1<<MMUB_68060) | ||
98 | #define MMU_SUN3 (1<<MMUB_SUN3) | ||
99 | #define MMU_APOLLO (1<<MMUB_APOLLO) | ||
100 | #define MMU_COLDFIRE (1<<MMUB_COLDFIRE) | ||
101 | |||
102 | |||
103 | #endif /* _UAPI_M68K_SETUP_H */ | ||
diff --git a/arch/m68k/include/asm/shmbuf.h b/arch/m68k/include/uapi/asm/shmbuf.h index f8928d62f1b7..f8928d62f1b7 100644 --- a/arch/m68k/include/asm/shmbuf.h +++ b/arch/m68k/include/uapi/asm/shmbuf.h | |||
diff --git a/arch/m68k/include/asm/sigcontext.h b/arch/m68k/include/uapi/asm/sigcontext.h index 523db2a51cf3..523db2a51cf3 100644 --- a/arch/m68k/include/asm/sigcontext.h +++ b/arch/m68k/include/uapi/asm/sigcontext.h | |||
diff --git a/arch/m68k/include/uapi/asm/signal.h b/arch/m68k/include/uapi/asm/signal.h new file mode 100644 index 000000000000..2b450f311bd9 --- /dev/null +++ b/arch/m68k/include/uapi/asm/signal.h | |||
@@ -0,0 +1,118 @@ | |||
1 | #ifndef _UAPI_M68K_SIGNAL_H | ||
2 | #define _UAPI_M68K_SIGNAL_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | |||
6 | /* Avoid too many header ordering problems. */ | ||
7 | struct siginfo; | ||
8 | |||
9 | #ifndef __KERNEL__ | ||
10 | /* Here we must cater to libcs that poke about in kernel headers. */ | ||
11 | |||
12 | #define NSIG 32 | ||
13 | typedef unsigned long sigset_t; | ||
14 | |||
15 | #endif /* __KERNEL__ */ | ||
16 | |||
17 | #define SIGHUP 1 | ||
18 | #define SIGINT 2 | ||
19 | #define SIGQUIT 3 | ||
20 | #define SIGILL 4 | ||
21 | #define SIGTRAP 5 | ||
22 | #define SIGABRT 6 | ||
23 | #define SIGIOT 6 | ||
24 | #define SIGBUS 7 | ||
25 | #define SIGFPE 8 | ||
26 | #define SIGKILL 9 | ||
27 | #define SIGUSR1 10 | ||
28 | #define SIGSEGV 11 | ||
29 | #define SIGUSR2 12 | ||
30 | #define SIGPIPE 13 | ||
31 | #define SIGALRM 14 | ||
32 | #define SIGTERM 15 | ||
33 | #define SIGSTKFLT 16 | ||
34 | #define SIGCHLD 17 | ||
35 | #define SIGCONT 18 | ||
36 | #define SIGSTOP 19 | ||
37 | #define SIGTSTP 20 | ||
38 | #define SIGTTIN 21 | ||
39 | #define SIGTTOU 22 | ||
40 | #define SIGURG 23 | ||
41 | #define SIGXCPU 24 | ||
42 | #define SIGXFSZ 25 | ||
43 | #define SIGVTALRM 26 | ||
44 | #define SIGPROF 27 | ||
45 | #define SIGWINCH 28 | ||
46 | #define SIGIO 29 | ||
47 | #define SIGPOLL SIGIO | ||
48 | /* | ||
49 | #define SIGLOST 29 | ||
50 | */ | ||
51 | #define SIGPWR 30 | ||
52 | #define SIGSYS 31 | ||
53 | #define SIGUNUSED 31 | ||
54 | |||
55 | /* These should not be considered constants from userland. */ | ||
56 | #define SIGRTMIN 32 | ||
57 | #define SIGRTMAX _NSIG | ||
58 | |||
59 | /* | ||
60 | * SA_FLAGS values: | ||
61 | * | ||
62 | * SA_ONSTACK indicates that a registered stack_t will be used. | ||
63 | * SA_RESTART flag to get restarting signals (which were the default long ago) | ||
64 | * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop. | ||
65 | * SA_RESETHAND clears the handler when the signal is delivered. | ||
66 | * SA_NOCLDWAIT flag on SIGCHLD to inhibit zombies. | ||
67 | * SA_NODEFER prevents the current signal from being masked in the handler. | ||
68 | * | ||
69 | * SA_ONESHOT and SA_NOMASK are the historical Linux names for the Single | ||
70 | * Unix names RESETHAND and NODEFER respectively. | ||
71 | */ | ||
72 | #define SA_NOCLDSTOP 0x00000001 | ||
73 | #define SA_NOCLDWAIT 0x00000002 | ||
74 | #define SA_SIGINFO 0x00000004 | ||
75 | #define SA_ONSTACK 0x08000000 | ||
76 | #define SA_RESTART 0x10000000 | ||
77 | #define SA_NODEFER 0x40000000 | ||
78 | #define SA_RESETHAND 0x80000000 | ||
79 | |||
80 | #define SA_NOMASK SA_NODEFER | ||
81 | #define SA_ONESHOT SA_RESETHAND | ||
82 | |||
83 | /* | ||
84 | * sigaltstack controls | ||
85 | */ | ||
86 | #define SS_ONSTACK 1 | ||
87 | #define SS_DISABLE 2 | ||
88 | |||
89 | #define MINSIGSTKSZ 2048 | ||
90 | #define SIGSTKSZ 8192 | ||
91 | |||
92 | #include <asm-generic/signal-defs.h> | ||
93 | |||
94 | #ifndef __KERNEL__ | ||
95 | /* Here we must cater to libcs that poke about in kernel headers. */ | ||
96 | |||
97 | struct sigaction { | ||
98 | union { | ||
99 | __sighandler_t _sa_handler; | ||
100 | void (*_sa_sigaction)(int, struct siginfo *, void *); | ||
101 | } _u; | ||
102 | sigset_t sa_mask; | ||
103 | unsigned long sa_flags; | ||
104 | void (*sa_restorer)(void); | ||
105 | }; | ||
106 | |||
107 | #define sa_handler _u._sa_handler | ||
108 | #define sa_sigaction _u._sa_sigaction | ||
109 | |||
110 | #endif /* __KERNEL__ */ | ||
111 | |||
112 | typedef struct sigaltstack { | ||
113 | void __user *ss_sp; | ||
114 | int ss_flags; | ||
115 | size_t ss_size; | ||
116 | } stack_t; | ||
117 | |||
118 | #endif /* _UAPI_M68K_SIGNAL_H */ | ||
diff --git a/arch/m68k/include/asm/socket.h b/arch/m68k/include/uapi/asm/socket.h index d1be684edf97..d1be684edf97 100644 --- a/arch/m68k/include/asm/socket.h +++ b/arch/m68k/include/uapi/asm/socket.h | |||
diff --git a/arch/m68k/include/asm/sockios.h b/arch/m68k/include/uapi/asm/sockios.h index c04a23943cb7..c04a23943cb7 100644 --- a/arch/m68k/include/asm/sockios.h +++ b/arch/m68k/include/uapi/asm/sockios.h | |||
diff --git a/arch/m68k/include/asm/stat.h b/arch/m68k/include/uapi/asm/stat.h index dd38bc2e9f98..dd38bc2e9f98 100644 --- a/arch/m68k/include/asm/stat.h +++ b/arch/m68k/include/uapi/asm/stat.h | |||
diff --git a/arch/m68k/include/asm/swab.h b/arch/m68k/include/uapi/asm/swab.h index b7b37a40defc..b7b37a40defc 100644 --- a/arch/m68k/include/asm/swab.h +++ b/arch/m68k/include/uapi/asm/swab.h | |||
diff --git a/arch/m68k/include/asm/termbits.h b/arch/m68k/include/uapi/asm/termbits.h index aea1e37b765a..aea1e37b765a 100644 --- a/arch/m68k/include/asm/termbits.h +++ b/arch/m68k/include/uapi/asm/termbits.h | |||
diff --git a/arch/m68k/include/uapi/asm/termios.h b/arch/m68k/include/uapi/asm/termios.h new file mode 100644 index 000000000000..ce2142c9ac1d --- /dev/null +++ b/arch/m68k/include/uapi/asm/termios.h | |||
@@ -0,0 +1,44 @@ | |||
1 | #ifndef _UAPI_M68K_TERMIOS_H | ||
2 | #define _UAPI_M68K_TERMIOS_H | ||
3 | |||
4 | #include <asm/termbits.h> | ||
5 | #include <asm/ioctls.h> | ||
6 | |||
7 | struct winsize { | ||
8 | unsigned short ws_row; | ||
9 | unsigned short ws_col; | ||
10 | unsigned short ws_xpixel; | ||
11 | unsigned short ws_ypixel; | ||
12 | }; | ||
13 | |||
14 | #define NCC 8 | ||
15 | struct termio { | ||
16 | unsigned short c_iflag; /* input mode flags */ | ||
17 | unsigned short c_oflag; /* output mode flags */ | ||
18 | unsigned short c_cflag; /* control mode flags */ | ||
19 | unsigned short c_lflag; /* local mode flags */ | ||
20 | unsigned char c_line; /* line discipline */ | ||
21 | unsigned char c_cc[NCC]; /* control characters */ | ||
22 | }; | ||
23 | |||
24 | |||
25 | /* modem lines */ | ||
26 | #define TIOCM_LE 0x001 | ||
27 | #define TIOCM_DTR 0x002 | ||
28 | #define TIOCM_RTS 0x004 | ||
29 | #define TIOCM_ST 0x008 | ||
30 | #define TIOCM_SR 0x010 | ||
31 | #define TIOCM_CTS 0x020 | ||
32 | #define TIOCM_CAR 0x040 | ||
33 | #define TIOCM_RNG 0x080 | ||
34 | #define TIOCM_DSR 0x100 | ||
35 | #define TIOCM_CD TIOCM_CAR | ||
36 | #define TIOCM_RI TIOCM_RNG | ||
37 | #define TIOCM_OUT1 0x2000 | ||
38 | #define TIOCM_OUT2 0x4000 | ||
39 | #define TIOCM_LOOP 0x8000 | ||
40 | |||
41 | /* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */ | ||
42 | |||
43 | |||
44 | #endif /* _UAPI_M68K_TERMIOS_H */ | ||
diff --git a/arch/m68k/include/uapi/asm/unistd.h b/arch/m68k/include/uapi/asm/unistd.h new file mode 100644 index 000000000000..b94bfbf90705 --- /dev/null +++ b/arch/m68k/include/uapi/asm/unistd.h | |||
@@ -0,0 +1,357 @@ | |||
1 | #ifndef _UAPI_ASM_M68K_UNISTD_H_ | ||
2 | #define _UAPI_ASM_M68K_UNISTD_H_ | ||
3 | |||
4 | /* | ||
5 | * This file contains the system call numbers. | ||
6 | */ | ||
7 | |||
8 | #define __NR_restart_syscall 0 | ||
9 | #define __NR_exit 1 | ||
10 | #define __NR_fork 2 | ||
11 | #define __NR_read 3 | ||
12 | #define __NR_write 4 | ||
13 | #define __NR_open 5 | ||
14 | #define __NR_close 6 | ||
15 | #define __NR_waitpid 7 | ||
16 | #define __NR_creat 8 | ||
17 | #define __NR_link 9 | ||
18 | #define __NR_unlink 10 | ||
19 | #define __NR_execve 11 | ||
20 | #define __NR_chdir 12 | ||
21 | #define __NR_time 13 | ||
22 | #define __NR_mknod 14 | ||
23 | #define __NR_chmod 15 | ||
24 | #define __NR_chown 16 | ||
25 | /*#define __NR_break 17*/ | ||
26 | #define __NR_oldstat 18 | ||
27 | #define __NR_lseek 19 | ||
28 | #define __NR_getpid 20 | ||
29 | #define __NR_mount 21 | ||
30 | #define __NR_umount 22 | ||
31 | #define __NR_setuid 23 | ||
32 | #define __NR_getuid 24 | ||
33 | #define __NR_stime 25 | ||
34 | #define __NR_ptrace 26 | ||
35 | #define __NR_alarm 27 | ||
36 | #define __NR_oldfstat 28 | ||
37 | #define __NR_pause 29 | ||
38 | #define __NR_utime 30 | ||
39 | /*#define __NR_stty 31*/ | ||
40 | /*#define __NR_gtty 32*/ | ||
41 | #define __NR_access 33 | ||
42 | #define __NR_nice 34 | ||
43 | /*#define __NR_ftime 35*/ | ||
44 | #define __NR_sync 36 | ||
45 | #define __NR_kill 37 | ||
46 | #define __NR_rename 38 | ||
47 | #define __NR_mkdir 39 | ||
48 | #define __NR_rmdir 40 | ||
49 | #define __NR_dup 41 | ||
50 | #define __NR_pipe 42 | ||
51 | #define __NR_times 43 | ||
52 | /*#define __NR_prof 44*/ | ||
53 | #define __NR_brk 45 | ||
54 | #define __NR_setgid 46 | ||
55 | #define __NR_getgid 47 | ||
56 | #define __NR_signal 48 | ||
57 | #define __NR_geteuid 49 | ||
58 | #define __NR_getegid 50 | ||
59 | #define __NR_acct 51 | ||
60 | #define __NR_umount2 52 | ||
61 | /*#define __NR_lock 53*/ | ||
62 | #define __NR_ioctl 54 | ||
63 | #define __NR_fcntl 55 | ||
64 | /*#define __NR_mpx 56*/ | ||
65 | #define __NR_setpgid 57 | ||
66 | /*#define __NR_ulimit 58*/ | ||
67 | /*#define __NR_oldolduname 59*/ | ||
68 | #define __NR_umask 60 | ||
69 | #define __NR_chroot 61 | ||
70 | #define __NR_ustat 62 | ||
71 | #define __NR_dup2 63 | ||
72 | #define __NR_getppid 64 | ||
73 | #define __NR_getpgrp 65 | ||
74 | #define __NR_setsid 66 | ||
75 | #define __NR_sigaction 67 | ||
76 | #define __NR_sgetmask 68 | ||
77 | #define __NR_ssetmask 69 | ||
78 | #define __NR_setreuid 70 | ||
79 | #define __NR_setregid 71 | ||
80 | #define __NR_sigsuspend 72 | ||
81 | #define __NR_sigpending 73 | ||
82 | #define __NR_sethostname 74 | ||
83 | #define __NR_setrlimit 75 | ||
84 | #define __NR_getrlimit 76 | ||
85 | #define __NR_getrusage 77 | ||
86 | #define __NR_gettimeofday 78 | ||
87 | #define __NR_settimeofday 79 | ||
88 | #define __NR_getgroups 80 | ||
89 | #define __NR_setgroups 81 | ||
90 | #define __NR_select 82 | ||
91 | #define __NR_symlink 83 | ||
92 | #define __NR_oldlstat 84 | ||
93 | #define __NR_readlink 85 | ||
94 | #define __NR_uselib 86 | ||
95 | #define __NR_swapon 87 | ||
96 | #define __NR_reboot 88 | ||
97 | #define __NR_readdir 89 | ||
98 | #define __NR_mmap 90 | ||
99 | #define __NR_munmap 91 | ||
100 | #define __NR_truncate 92 | ||
101 | #define __NR_ftruncate 93 | ||
102 | #define __NR_fchmod 94 | ||
103 | #define __NR_fchown 95 | ||
104 | #define __NR_getpriority 96 | ||
105 | #define __NR_setpriority 97 | ||
106 | /*#define __NR_profil 98*/ | ||
107 | #define __NR_statfs 99 | ||
108 | #define __NR_fstatfs 100 | ||
109 | /*#define __NR_ioperm 101*/ | ||
110 | #define __NR_socketcall 102 | ||
111 | #define __NR_syslog 103 | ||
112 | #define __NR_setitimer 104 | ||
113 | #define __NR_getitimer 105 | ||
114 | #define __NR_stat 106 | ||
115 | #define __NR_lstat 107 | ||
116 | #define __NR_fstat 108 | ||
117 | /*#define __NR_olduname 109*/ | ||
118 | /*#define __NR_iopl 110*/ /* not supported */ | ||
119 | #define __NR_vhangup 111 | ||
120 | /*#define __NR_idle 112*/ /* Obsolete */ | ||
121 | /*#define __NR_vm86 113*/ /* not supported */ | ||
122 | #define __NR_wait4 114 | ||
123 | #define __NR_swapoff 115 | ||
124 | #define __NR_sysinfo 116 | ||
125 | #define __NR_ipc 117 | ||
126 | #define __NR_fsync 118 | ||
127 | #define __NR_sigreturn 119 | ||
128 | #define __NR_clone 120 | ||
129 | #define __NR_setdomainname 121 | ||
130 | #define __NR_uname 122 | ||
131 | #define __NR_cacheflush 123 | ||
132 | #define __NR_adjtimex 124 | ||
133 | #define __NR_mprotect 125 | ||
134 | #define __NR_sigprocmask 126 | ||
135 | #define __NR_create_module 127 | ||
136 | #define __NR_init_module 128 | ||
137 | #define __NR_delete_module 129 | ||
138 | #define __NR_get_kernel_syms 130 | ||
139 | #define __NR_quotactl 131 | ||
140 | #define __NR_getpgid 132 | ||
141 | #define __NR_fchdir 133 | ||
142 | #define __NR_bdflush 134 | ||
143 | #define __NR_sysfs 135 | ||
144 | #define __NR_personality 136 | ||
145 | /*#define __NR_afs_syscall 137*/ /* Syscall for Andrew File System */ | ||
146 | #define __NR_setfsuid 138 | ||
147 | #define __NR_setfsgid 139 | ||
148 | #define __NR__llseek 140 | ||
149 | #define __NR_getdents 141 | ||
150 | #define __NR__newselect 142 | ||
151 | #define __NR_flock 143 | ||
152 | #define __NR_msync 144 | ||
153 | #define __NR_readv 145 | ||
154 | #define __NR_writev 146 | ||
155 | #define __NR_getsid 147 | ||
156 | #define __NR_fdatasync 148 | ||
157 | #define __NR__sysctl 149 | ||
158 | #define __NR_mlock 150 | ||
159 | #define __NR_munlock 151 | ||
160 | #define __NR_mlockall 152 | ||
161 | #define __NR_munlockall 153 | ||
162 | #define __NR_sched_setparam 154 | ||
163 | #define __NR_sched_getparam 155 | ||
164 | #define __NR_sched_setscheduler 156 | ||
165 | #define __NR_sched_getscheduler 157 | ||
166 | #define __NR_sched_yield 158 | ||
167 | #define __NR_sched_get_priority_max 159 | ||
168 | #define __NR_sched_get_priority_min 160 | ||
169 | #define __NR_sched_rr_get_interval 161 | ||
170 | #define __NR_nanosleep 162 | ||
171 | #define __NR_mremap 163 | ||
172 | #define __NR_setresuid 164 | ||
173 | #define __NR_getresuid 165 | ||
174 | #define __NR_getpagesize 166 | ||
175 | #define __NR_query_module 167 | ||
176 | #define __NR_poll 168 | ||
177 | #define __NR_nfsservctl 169 | ||
178 | #define __NR_setresgid 170 | ||
179 | #define __NR_getresgid 171 | ||
180 | #define __NR_prctl 172 | ||
181 | #define __NR_rt_sigreturn 173 | ||
182 | #define __NR_rt_sigaction 174 | ||
183 | #define __NR_rt_sigprocmask 175 | ||
184 | #define __NR_rt_sigpending 176 | ||
185 | #define __NR_rt_sigtimedwait 177 | ||
186 | #define __NR_rt_sigqueueinfo 178 | ||
187 | #define __NR_rt_sigsuspend 179 | ||
188 | #define __NR_pread64 180 | ||
189 | #define __NR_pwrite64 181 | ||
190 | #define __NR_lchown 182 | ||
191 | #define __NR_getcwd 183 | ||
192 | #define __NR_capget 184 | ||
193 | #define __NR_capset 185 | ||
194 | #define __NR_sigaltstack 186 | ||
195 | #define __NR_sendfile 187 | ||
196 | #define __NR_getpmsg 188 /* some people actually want streams */ | ||
197 | #define __NR_putpmsg 189 /* some people actually want streams */ | ||
198 | #define __NR_vfork 190 | ||
199 | #define __NR_ugetrlimit 191 | ||
200 | #define __NR_mmap2 192 | ||
201 | #define __NR_truncate64 193 | ||
202 | #define __NR_ftruncate64 194 | ||
203 | #define __NR_stat64 195 | ||
204 | #define __NR_lstat64 196 | ||
205 | #define __NR_fstat64 197 | ||
206 | #define __NR_chown32 198 | ||
207 | #define __NR_getuid32 199 | ||
208 | #define __NR_getgid32 200 | ||
209 | #define __NR_geteuid32 201 | ||
210 | #define __NR_getegid32 202 | ||
211 | #define __NR_setreuid32 203 | ||
212 | #define __NR_setregid32 204 | ||
213 | #define __NR_getgroups32 205 | ||
214 | #define __NR_setgroups32 206 | ||
215 | #define __NR_fchown32 207 | ||
216 | #define __NR_setresuid32 208 | ||
217 | #define __NR_getresuid32 209 | ||
218 | #define __NR_setresgid32 210 | ||
219 | #define __NR_getresgid32 211 | ||
220 | #define __NR_lchown32 212 | ||
221 | #define __NR_setuid32 213 | ||
222 | #define __NR_setgid32 214 | ||
223 | #define __NR_setfsuid32 215 | ||
224 | #define __NR_setfsgid32 216 | ||
225 | #define __NR_pivot_root 217 | ||
226 | /* 218*/ | ||
227 | /* 219*/ | ||
228 | #define __NR_getdents64 220 | ||
229 | #define __NR_gettid 221 | ||
230 | #define __NR_tkill 222 | ||
231 | #define __NR_setxattr 223 | ||
232 | #define __NR_lsetxattr 224 | ||
233 | #define __NR_fsetxattr 225 | ||
234 | #define __NR_getxattr 226 | ||
235 | #define __NR_lgetxattr 227 | ||
236 | #define __NR_fgetxattr 228 | ||
237 | #define __NR_listxattr 229 | ||
238 | #define __NR_llistxattr 230 | ||
239 | #define __NR_flistxattr 231 | ||
240 | #define __NR_removexattr 232 | ||
241 | #define __NR_lremovexattr 233 | ||
242 | #define __NR_fremovexattr 234 | ||
243 | #define __NR_futex 235 | ||
244 | #define __NR_sendfile64 236 | ||
245 | #define __NR_mincore 237 | ||
246 | #define __NR_madvise 238 | ||
247 | #define __NR_fcntl64 239 | ||
248 | #define __NR_readahead 240 | ||
249 | #define __NR_io_setup 241 | ||
250 | #define __NR_io_destroy 242 | ||
251 | #define __NR_io_getevents 243 | ||
252 | #define __NR_io_submit 244 | ||
253 | #define __NR_io_cancel 245 | ||
254 | #define __NR_fadvise64 246 | ||
255 | #define __NR_exit_group 247 | ||
256 | #define __NR_lookup_dcookie 248 | ||
257 | #define __NR_epoll_create 249 | ||
258 | #define __NR_epoll_ctl 250 | ||
259 | #define __NR_epoll_wait 251 | ||
260 | #define __NR_remap_file_pages 252 | ||
261 | #define __NR_set_tid_address 253 | ||
262 | #define __NR_timer_create 254 | ||
263 | #define __NR_timer_settime 255 | ||
264 | #define __NR_timer_gettime 256 | ||
265 | #define __NR_timer_getoverrun 257 | ||
266 | #define __NR_timer_delete 258 | ||
267 | #define __NR_clock_settime 259 | ||
268 | #define __NR_clock_gettime 260 | ||
269 | #define __NR_clock_getres 261 | ||
270 | #define __NR_clock_nanosleep 262 | ||
271 | #define __NR_statfs64 263 | ||
272 | #define __NR_fstatfs64 264 | ||
273 | #define __NR_tgkill 265 | ||
274 | #define __NR_utimes 266 | ||
275 | #define __NR_fadvise64_64 267 | ||
276 | #define __NR_mbind 268 | ||
277 | #define __NR_get_mempolicy 269 | ||
278 | #define __NR_set_mempolicy 270 | ||
279 | #define __NR_mq_open 271 | ||
280 | #define __NR_mq_unlink 272 | ||
281 | #define __NR_mq_timedsend 273 | ||
282 | #define __NR_mq_timedreceive 274 | ||
283 | #define __NR_mq_notify 275 | ||
284 | #define __NR_mq_getsetattr 276 | ||
285 | #define __NR_waitid 277 | ||
286 | /*#define __NR_vserver 278*/ | ||
287 | #define __NR_add_key 279 | ||
288 | #define __NR_request_key 280 | ||
289 | #define __NR_keyctl 281 | ||
290 | #define __NR_ioprio_set 282 | ||
291 | #define __NR_ioprio_get 283 | ||
292 | #define __NR_inotify_init 284 | ||
293 | #define __NR_inotify_add_watch 285 | ||
294 | #define __NR_inotify_rm_watch 286 | ||
295 | #define __NR_migrate_pages 287 | ||
296 | #define __NR_openat 288 | ||
297 | #define __NR_mkdirat 289 | ||
298 | #define __NR_mknodat 290 | ||
299 | #define __NR_fchownat 291 | ||
300 | #define __NR_futimesat 292 | ||
301 | #define __NR_fstatat64 293 | ||
302 | #define __NR_unlinkat 294 | ||
303 | #define __NR_renameat 295 | ||
304 | #define __NR_linkat 296 | ||
305 | #define __NR_symlinkat 297 | ||
306 | #define __NR_readlinkat 298 | ||
307 | #define __NR_fchmodat 299 | ||
308 | #define __NR_faccessat 300 | ||
309 | #define __NR_pselect6 301 | ||
310 | #define __NR_ppoll 302 | ||
311 | #define __NR_unshare 303 | ||
312 | #define __NR_set_robust_list 304 | ||
313 | #define __NR_get_robust_list 305 | ||
314 | #define __NR_splice 306 | ||
315 | #define __NR_sync_file_range 307 | ||
316 | #define __NR_tee 308 | ||
317 | #define __NR_vmsplice 309 | ||
318 | #define __NR_move_pages 310 | ||
319 | #define __NR_sched_setaffinity 311 | ||
320 | #define __NR_sched_getaffinity 312 | ||
321 | #define __NR_kexec_load 313 | ||
322 | #define __NR_getcpu 314 | ||
323 | #define __NR_epoll_pwait 315 | ||
324 | #define __NR_utimensat 316 | ||
325 | #define __NR_signalfd 317 | ||
326 | #define __NR_timerfd_create 318 | ||
327 | #define __NR_eventfd 319 | ||
328 | #define __NR_fallocate 320 | ||
329 | #define __NR_timerfd_settime 321 | ||
330 | #define __NR_timerfd_gettime 322 | ||
331 | #define __NR_signalfd4 323 | ||
332 | #define __NR_eventfd2 324 | ||
333 | #define __NR_epoll_create1 325 | ||
334 | #define __NR_dup3 326 | ||
335 | #define __NR_pipe2 327 | ||
336 | #define __NR_inotify_init1 328 | ||
337 | #define __NR_preadv 329 | ||
338 | #define __NR_pwritev 330 | ||
339 | #define __NR_rt_tgsigqueueinfo 331 | ||
340 | #define __NR_perf_event_open 332 | ||
341 | #define __NR_get_thread_area 333 | ||
342 | #define __NR_set_thread_area 334 | ||
343 | #define __NR_atomic_cmpxchg_32 335 | ||
344 | #define __NR_atomic_barrier 336 | ||
345 | #define __NR_fanotify_init 337 | ||
346 | #define __NR_fanotify_mark 338 | ||
347 | #define __NR_prlimit64 339 | ||
348 | #define __NR_name_to_handle_at 340 | ||
349 | #define __NR_open_by_handle_at 341 | ||
350 | #define __NR_clock_adjtime 342 | ||
351 | #define __NR_syncfs 343 | ||
352 | #define __NR_setns 344 | ||
353 | #define __NR_process_vm_readv 345 | ||
354 | #define __NR_process_vm_writev 346 | ||
355 | #define __NR_kcmp 347 | ||
356 | |||
357 | #endif /* _UAPI_ASM_M68K_UNISTD_H_ */ | ||
diff --git a/arch/m68k/kernel/syscalltable.S b/arch/m68k/kernel/syscalltable.S index ce827b376110..4fc2e29b771b 100644 --- a/arch/m68k/kernel/syscalltable.S +++ b/arch/m68k/kernel/syscalltable.S | |||
@@ -367,4 +367,5 @@ ENTRY(sys_call_table) | |||
367 | .long sys_setns | 367 | .long sys_setns |
368 | .long sys_process_vm_readv /* 345 */ | 368 | .long sys_process_vm_readv /* 345 */ |
369 | .long sys_process_vm_writev | 369 | .long sys_process_vm_writev |
370 | .long sys_kcmp | ||
370 | 371 | ||
diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig index 3f3d9ca7a5b6..5dba755a43e6 100644 --- a/arch/s390/Kconfig +++ b/arch/s390/Kconfig | |||
@@ -130,6 +130,7 @@ config S390 | |||
130 | select ARCH_INLINE_WRITE_UNLOCK_IRQRESTORE | 130 | select ARCH_INLINE_WRITE_UNLOCK_IRQRESTORE |
131 | select HAVE_UID16 if 32BIT | 131 | select HAVE_UID16 if 32BIT |
132 | select ARCH_WANT_IPC_PARSE_VERSION | 132 | select ARCH_WANT_IPC_PARSE_VERSION |
133 | select HAVE_ARCH_TRANSPARENT_HUGEPAGE if 64BIT | ||
133 | select GENERIC_SMP_IDLE_THREAD | 134 | select GENERIC_SMP_IDLE_THREAD |
134 | select GENERIC_TIME_VSYSCALL_OLD | 135 | select GENERIC_TIME_VSYSCALL_OLD |
135 | select GENERIC_CLOCKEVENTS | 136 | select GENERIC_CLOCKEVENTS |
diff --git a/arch/s390/boot/compressed/vmlinux.lds.S b/arch/s390/boot/compressed/vmlinux.lds.S index d80f79d8dd9c..8e1fb8239287 100644 --- a/arch/s390/boot/compressed/vmlinux.lds.S +++ b/arch/s390/boot/compressed/vmlinux.lds.S | |||
@@ -5,7 +5,7 @@ OUTPUT_FORMAT("elf64-s390", "elf64-s390", "elf64-s390") | |||
5 | OUTPUT_ARCH(s390:64-bit) | 5 | OUTPUT_ARCH(s390:64-bit) |
6 | #else | 6 | #else |
7 | OUTPUT_FORMAT("elf32-s390", "elf32-s390", "elf32-s390") | 7 | OUTPUT_FORMAT("elf32-s390", "elf32-s390", "elf32-s390") |
8 | OUTPUT_ARCH(s390) | 8 | OUTPUT_ARCH(s390:31-bit) |
9 | #endif | 9 | #endif |
10 | 10 | ||
11 | ENTRY(startup) | 11 | ENTRY(startup) |
diff --git a/arch/s390/include/asm/perf_event.h b/arch/s390/include/asm/perf_event.h index 7941968e12b4..5f0173a31693 100644 --- a/arch/s390/include/asm/perf_event.h +++ b/arch/s390/include/asm/perf_event.h | |||
@@ -9,7 +9,7 @@ | |||
9 | #include <asm/cpu_mf.h> | 9 | #include <asm/cpu_mf.h> |
10 | 10 | ||
11 | /* CPU-measurement counter facility */ | 11 | /* CPU-measurement counter facility */ |
12 | #define PERF_CPUM_CF_MAX_CTR 160 | 12 | #define PERF_CPUM_CF_MAX_CTR 256 |
13 | 13 | ||
14 | /* Per-CPU flags for PMU states */ | 14 | /* Per-CPU flags for PMU states */ |
15 | #define PMU_F_RESERVED 0x1000 | 15 | #define PMU_F_RESERVED 0x1000 |
diff --git a/arch/s390/include/uapi/asm/Kbuild b/arch/s390/include/uapi/asm/Kbuild index 59b67ed423b4..7bf68fff7c5d 100644 --- a/arch/s390/include/uapi/asm/Kbuild +++ b/arch/s390/include/uapi/asm/Kbuild | |||
@@ -1,8 +1,6 @@ | |||
1 | # UAPI Header export list | 1 | # UAPI Header export list |
2 | include include/uapi/asm-generic/Kbuild.asm | 2 | include include/uapi/asm-generic/Kbuild.asm |
3 | 3 | ||
4 | generic-y += kvm_para.h | ||
5 | |||
6 | header-y += auxvec.h | 4 | header-y += auxvec.h |
7 | header-y += bitsperlong.h | 5 | header-y += bitsperlong.h |
8 | header-y += byteorder.h | 6 | header-y += byteorder.h |
diff --git a/arch/s390/include/uapi/asm/chpid.h b/arch/s390/include/uapi/asm/chpid.h index 581992dfae27..6b4fb29cc197 100644 --- a/arch/s390/include/uapi/asm/chpid.h +++ b/arch/s390/include/uapi/asm/chpid.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright IBM Corp. 2007 | 2 | * Copyright IBM Corp. 2007, 2012 |
3 | * Author(s): Peter Oberparleiter <peter.oberparleiter@de.ibm.com> | 3 | * Author(s): Peter Oberparleiter <peter.oberparleiter@de.ibm.com> |
4 | */ | 4 | */ |
5 | 5 | ||
@@ -12,10 +12,10 @@ | |||
12 | #define __MAX_CHPID 255 | 12 | #define __MAX_CHPID 255 |
13 | 13 | ||
14 | struct chp_id { | 14 | struct chp_id { |
15 | u8 reserved1; | 15 | __u8 reserved1; |
16 | u8 cssid; | 16 | __u8 cssid; |
17 | u8 reserved2; | 17 | __u8 reserved2; |
18 | u8 id; | 18 | __u8 id; |
19 | } __attribute__((packed)); | 19 | } __attribute__((packed)); |
20 | 20 | ||
21 | 21 | ||
diff --git a/arch/s390/include/uapi/asm/kvm_para.h b/arch/s390/include/uapi/asm/kvm_para.h new file mode 100644 index 000000000000..ff1f4e7b3015 --- /dev/null +++ b/arch/s390/include/uapi/asm/kvm_para.h | |||
@@ -0,0 +1,11 @@ | |||
1 | /* | ||
2 | * User API definitions for paravirtual devices on s390 | ||
3 | * | ||
4 | * Copyright IBM Corp. 2008 | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License (version 2 only) | ||
8 | * as published by the Free Software Foundation. | ||
9 | * | ||
10 | * Author(s): Christian Borntraeger <borntraeger@de.ibm.com> | ||
11 | */ | ||
diff --git a/arch/s390/kernel/cache.c b/arch/s390/kernel/cache.c index 8df8d8a19c98..64b24650e4f8 100644 --- a/arch/s390/kernel/cache.c +++ b/arch/s390/kernel/cache.c | |||
@@ -59,8 +59,8 @@ enum { | |||
59 | 59 | ||
60 | enum { | 60 | enum { |
61 | CACHE_TI_UNIFIED = 0, | 61 | CACHE_TI_UNIFIED = 0, |
62 | CACHE_TI_INSTRUCTION = 0, | 62 | CACHE_TI_DATA = 0, |
63 | CACHE_TI_DATA, | 63 | CACHE_TI_INSTRUCTION, |
64 | }; | 64 | }; |
65 | 65 | ||
66 | struct cache_info { | 66 | struct cache_info { |
@@ -121,7 +121,10 @@ static int __init cache_add(int level, int private, int type) | |||
121 | cache = kzalloc(sizeof(*cache), GFP_KERNEL); | 121 | cache = kzalloc(sizeof(*cache), GFP_KERNEL); |
122 | if (!cache) | 122 | if (!cache) |
123 | return -ENOMEM; | 123 | return -ENOMEM; |
124 | ti = type == CACHE_TYPE_DATA ? CACHE_TI_DATA : CACHE_TI_UNIFIED; | 124 | if (type == CACHE_TYPE_INSTRUCTION) |
125 | ti = CACHE_TI_INSTRUCTION; | ||
126 | else | ||
127 | ti = CACHE_TI_UNIFIED; | ||
125 | cache->size = ecag(EXTRACT_SIZE, level, ti); | 128 | cache->size = ecag(EXTRACT_SIZE, level, ti); |
126 | cache->line_size = ecag(EXTRACT_LINE_SIZE, level, ti); | 129 | cache->line_size = ecag(EXTRACT_LINE_SIZE, level, ti); |
127 | cache->associativity = ecag(EXTRACT_ASSOCIATIVITY, level, ti); | 130 | cache->associativity = ecag(EXTRACT_ASSOCIATIVITY, level, ti); |
diff --git a/arch/s390/kernel/head_kdump.S b/arch/s390/kernel/head_kdump.S index acaaaf4b7055..085a95eb315f 100644 --- a/arch/s390/kernel/head_kdump.S +++ b/arch/s390/kernel/head_kdump.S | |||
@@ -85,16 +85,10 @@ | |||
85 | .align 2 | 85 | .align 2 |
86 | startup_kdump_relocated: | 86 | startup_kdump_relocated: |
87 | basr %r13,0 | 87 | basr %r13,0 |
88 | 0: | 88 | 0: lpswe .Lrestart_psw-0b(%r13) # Start new kernel... |
89 | mvc 0(8,%r0),.Lrestart_psw-0b(%r13) # Setup restart PSW | ||
90 | sam31 # Switch to 31 bit addr mode | ||
91 | sr %r1,%r1 # Erase register r1 | ||
92 | sr %r2,%r2 # Erase register r2 | ||
93 | sigp %r1,%r2,SIGP_SET_ARCHITECTURE # Switch to 31 bit arch mode | ||
94 | lpsw 0 # Start new kernel... | ||
95 | .align 8 | 89 | .align 8 |
96 | .Lrestart_psw: | 90 | .Lrestart_psw: |
97 | .long 0x00080000,0x80000000 + startup | 91 | .quad 0x0000000080000000,0x0000000000000000 + startup |
98 | #else | 92 | #else |
99 | .align 2 | 93 | .align 2 |
100 | .Lep_startup_kdump: | 94 | .Lep_startup_kdump: |
diff --git a/arch/s390/kernel/perf_cpum_cf.c b/arch/s390/kernel/perf_cpum_cf.c index 9871b1971ed7..c4e7269d4a09 100644 --- a/arch/s390/kernel/perf_cpum_cf.c +++ b/arch/s390/kernel/perf_cpum_cf.c | |||
@@ -94,7 +94,7 @@ static int get_counter_set(u64 event) | |||
94 | set = CPUMF_CTR_SET_USER; | 94 | set = CPUMF_CTR_SET_USER; |
95 | else if (event < 128) | 95 | else if (event < 128) |
96 | set = CPUMF_CTR_SET_CRYPTO; | 96 | set = CPUMF_CTR_SET_CRYPTO; |
97 | else if (event < 160) | 97 | else if (event < 256) |
98 | set = CPUMF_CTR_SET_EXT; | 98 | set = CPUMF_CTR_SET_EXT; |
99 | 99 | ||
100 | return set; | 100 | return set; |
@@ -138,6 +138,10 @@ static int validate_ctr_version(const struct hw_perf_event *hwc) | |||
138 | case CPUMF_CTR_SET_EXT: | 138 | case CPUMF_CTR_SET_EXT: |
139 | if (cpuhw->info.csvn < 1) | 139 | if (cpuhw->info.csvn < 1) |
140 | err = -EOPNOTSUPP; | 140 | err = -EOPNOTSUPP; |
141 | if ((cpuhw->info.csvn == 1 && hwc->config > 159) || | ||
142 | (cpuhw->info.csvn == 2 && hwc->config > 175) || | ||
143 | (cpuhw->info.csvn > 2 && hwc->config > 255)) | ||
144 | err = -EOPNOTSUPP; | ||
141 | break; | 145 | break; |
142 | } | 146 | } |
143 | 147 | ||
diff --git a/arch/s390/kernel/vmlinux.lds.S b/arch/s390/kernel/vmlinux.lds.S index de8fa9bbd35e..79cb51adc741 100644 --- a/arch/s390/kernel/vmlinux.lds.S +++ b/arch/s390/kernel/vmlinux.lds.S | |||
@@ -8,7 +8,7 @@ | |||
8 | 8 | ||
9 | #ifndef CONFIG_64BIT | 9 | #ifndef CONFIG_64BIT |
10 | OUTPUT_FORMAT("elf32-s390", "elf32-s390", "elf32-s390") | 10 | OUTPUT_FORMAT("elf32-s390", "elf32-s390", "elf32-s390") |
11 | OUTPUT_ARCH(s390) | 11 | OUTPUT_ARCH(s390:31-bit) |
12 | ENTRY(startup) | 12 | ENTRY(startup) |
13 | jiffies = jiffies_64 + 4; | 13 | jiffies = jiffies_64 + 4; |
14 | #else | 14 | #else |
diff --git a/arch/tile/Makefile b/arch/tile/Makefile index 55640cf92597..3d15364c6071 100644 --- a/arch/tile/Makefile +++ b/arch/tile/Makefile | |||
@@ -26,6 +26,10 @@ $(error Set TILERA_ROOT or CROSS_COMPILE when building $(ARCH) on $(HOST_ARCH)) | |||
26 | endif | 26 | endif |
27 | endif | 27 | endif |
28 | 28 | ||
29 | # The tile compiler may emit .eh_frame information for backtracing. | ||
30 | # In kernel modules, this causes load failures due to unsupported relocations. | ||
31 | KBUILD_CFLAGS += -fno-asynchronous-unwind-tables | ||
32 | |||
29 | ifneq ($(CONFIG_DEBUG_EXTRA_FLAGS),"") | 33 | ifneq ($(CONFIG_DEBUG_EXTRA_FLAGS),"") |
30 | KBUILD_CFLAGS += $(CONFIG_DEBUG_EXTRA_FLAGS) | 34 | KBUILD_CFLAGS += $(CONFIG_DEBUG_EXTRA_FLAGS) |
31 | endif | 35 | endif |
diff --git a/arch/tile/kernel/module.c b/arch/tile/kernel/module.c index 001cbfa10ac6..243ffebe38d6 100644 --- a/arch/tile/kernel/module.c +++ b/arch/tile/kernel/module.c | |||
@@ -24,16 +24,6 @@ | |||
24 | #include <asm/homecache.h> | 24 | #include <asm/homecache.h> |
25 | #include <arch/opcode.h> | 25 | #include <arch/opcode.h> |
26 | 26 | ||
27 | #ifdef __tilegx__ | ||
28 | # define Elf_Rela Elf64_Rela | ||
29 | # define ELF_R_SYM ELF64_R_SYM | ||
30 | # define ELF_R_TYPE ELF64_R_TYPE | ||
31 | #else | ||
32 | # define Elf_Rela Elf32_Rela | ||
33 | # define ELF_R_SYM ELF32_R_SYM | ||
34 | # define ELF_R_TYPE ELF32_R_TYPE | ||
35 | #endif | ||
36 | |||
37 | #ifdef MODULE_DEBUG | 27 | #ifdef MODULE_DEBUG |
38 | #define DEBUGP printk | 28 | #define DEBUGP printk |
39 | #else | 29 | #else |
diff --git a/arch/x86/include/asm/efi.h b/arch/x86/include/asm/efi.h index c9dcc181d4d1..6e8fdf5ad113 100644 --- a/arch/x86/include/asm/efi.h +++ b/arch/x86/include/asm/efi.h | |||
@@ -35,7 +35,7 @@ extern unsigned long asmlinkage efi_call_phys(void *, ...); | |||
35 | #define efi_call_virt6(f, a1, a2, a3, a4, a5, a6) \ | 35 | #define efi_call_virt6(f, a1, a2, a3, a4, a5, a6) \ |
36 | efi_call_virt(f, a1, a2, a3, a4, a5, a6) | 36 | efi_call_virt(f, a1, a2, a3, a4, a5, a6) |
37 | 37 | ||
38 | #define efi_ioremap(addr, size, type) ioremap_cache(addr, size) | 38 | #define efi_ioremap(addr, size, type, attr) ioremap_cache(addr, size) |
39 | 39 | ||
40 | #else /* !CONFIG_X86_32 */ | 40 | #else /* !CONFIG_X86_32 */ |
41 | 41 | ||
@@ -89,7 +89,7 @@ extern u64 efi_call6(void *fp, u64 arg1, u64 arg2, u64 arg3, | |||
89 | (u64)(a3), (u64)(a4), (u64)(a5), (u64)(a6)) | 89 | (u64)(a3), (u64)(a4), (u64)(a5), (u64)(a6)) |
90 | 90 | ||
91 | extern void __iomem *efi_ioremap(unsigned long addr, unsigned long size, | 91 | extern void __iomem *efi_ioremap(unsigned long addr, unsigned long size, |
92 | u32 type); | 92 | u32 type, u64 attribute); |
93 | 93 | ||
94 | #endif /* CONFIG_X86_32 */ | 94 | #endif /* CONFIG_X86_32 */ |
95 | 95 | ||
@@ -98,6 +98,8 @@ extern void efi_set_executable(efi_memory_desc_t *md, bool executable); | |||
98 | extern int efi_memblock_x86_reserve_range(void); | 98 | extern int efi_memblock_x86_reserve_range(void); |
99 | extern void efi_call_phys_prelog(void); | 99 | extern void efi_call_phys_prelog(void); |
100 | extern void efi_call_phys_epilog(void); | 100 | extern void efi_call_phys_epilog(void); |
101 | extern void efi_unmap_memmap(void); | ||
102 | extern void efi_memory_uc(u64 addr, unsigned long size); | ||
101 | 103 | ||
102 | #ifndef CONFIG_EFI | 104 | #ifndef CONFIG_EFI |
103 | /* | 105 | /* |
diff --git a/arch/x86/include/asm/xen/hypervisor.h b/arch/x86/include/asm/xen/hypervisor.h index 66d0fff1ee84..125f344f06a9 100644 --- a/arch/x86/include/asm/xen/hypervisor.h +++ b/arch/x86/include/asm/xen/hypervisor.h | |||
@@ -33,7 +33,6 @@ | |||
33 | #ifndef _ASM_X86_XEN_HYPERVISOR_H | 33 | #ifndef _ASM_X86_XEN_HYPERVISOR_H |
34 | #define _ASM_X86_XEN_HYPERVISOR_H | 34 | #define _ASM_X86_XEN_HYPERVISOR_H |
35 | 35 | ||
36 | /* arch/i386/kernel/setup.c */ | ||
37 | extern struct shared_info *HYPERVISOR_shared_info; | 36 | extern struct shared_info *HYPERVISOR_shared_info; |
38 | extern struct start_info *xen_start_info; | 37 | extern struct start_info *xen_start_info; |
39 | 38 | ||
diff --git a/arch/x86/include/asm/xen/interface.h b/arch/x86/include/asm/xen/interface.h index 6d2f75a82a14..54d52ff1304a 100644 --- a/arch/x86/include/asm/xen/interface.h +++ b/arch/x86/include/asm/xen/interface.h | |||
@@ -51,14 +51,14 @@ | |||
51 | * with Xen so that on ARM we can have one ABI that works for 32 and 64 | 51 | * with Xen so that on ARM we can have one ABI that works for 32 and 64 |
52 | * bit guests. */ | 52 | * bit guests. */ |
53 | typedef unsigned long xen_pfn_t; | 53 | typedef unsigned long xen_pfn_t; |
54 | #define PRI_xen_pfn "lx" | ||
54 | typedef unsigned long xen_ulong_t; | 55 | typedef unsigned long xen_ulong_t; |
56 | #define PRI_xen_ulong "lx" | ||
55 | /* Guest handles for primitive C types. */ | 57 | /* Guest handles for primitive C types. */ |
56 | __DEFINE_GUEST_HANDLE(uchar, unsigned char); | 58 | __DEFINE_GUEST_HANDLE(uchar, unsigned char); |
57 | __DEFINE_GUEST_HANDLE(uint, unsigned int); | 59 | __DEFINE_GUEST_HANDLE(uint, unsigned int); |
58 | __DEFINE_GUEST_HANDLE(ulong, unsigned long); | ||
59 | DEFINE_GUEST_HANDLE(char); | 60 | DEFINE_GUEST_HANDLE(char); |
60 | DEFINE_GUEST_HANDLE(int); | 61 | DEFINE_GUEST_HANDLE(int); |
61 | DEFINE_GUEST_HANDLE(long); | ||
62 | DEFINE_GUEST_HANDLE(void); | 62 | DEFINE_GUEST_HANDLE(void); |
63 | DEFINE_GUEST_HANDLE(uint64_t); | 63 | DEFINE_GUEST_HANDLE(uint64_t); |
64 | DEFINE_GUEST_HANDLE(uint32_t); | 64 | DEFINE_GUEST_HANDLE(uint32_t); |
diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c index c265593ec2cd..1817fa911024 100644 --- a/arch/x86/kernel/apic/io_apic.c +++ b/arch/x86/kernel/apic/io_apic.c | |||
@@ -2257,6 +2257,9 @@ asmlinkage void smp_irq_move_cleanup_interrupt(void) | |||
2257 | continue; | 2257 | continue; |
2258 | 2258 | ||
2259 | cfg = irq_cfg(irq); | 2259 | cfg = irq_cfg(irq); |
2260 | if (!cfg) | ||
2261 | continue; | ||
2262 | |||
2260 | raw_spin_lock(&desc->lock); | 2263 | raw_spin_lock(&desc->lock); |
2261 | 2264 | ||
2262 | /* | 2265 | /* |
diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c index 3373f84d1397..4a3374e61a93 100644 --- a/arch/x86/kernel/cpu/perf_event.c +++ b/arch/x86/kernel/cpu/perf_event.c | |||
@@ -208,12 +208,14 @@ static bool check_hw_exists(void) | |||
208 | } | 208 | } |
209 | 209 | ||
210 | /* | 210 | /* |
211 | * Now write a value and read it back to see if it matches, | 211 | * Read the current value, change it and read it back to see if it |
212 | * this is needed to detect certain hardware emulators (qemu/kvm) | 212 | * matches, this is needed to detect certain hardware emulators |
213 | * that don't trap on the MSR access and always return 0s. | 213 | * (qemu/kvm) that don't trap on the MSR access and always return 0s. |
214 | */ | 214 | */ |
215 | val = 0xabcdUL; | ||
216 | reg = x86_pmu_event_addr(0); | 215 | reg = x86_pmu_event_addr(0); |
216 | if (rdmsrl_safe(reg, &val)) | ||
217 | goto msr_fail; | ||
218 | val ^= 0xffffUL; | ||
217 | ret = wrmsrl_safe(reg, val); | 219 | ret = wrmsrl_safe(reg, val); |
218 | ret |= rdmsrl_safe(reg, &val_new); | 220 | ret |= rdmsrl_safe(reg, &val_new); |
219 | if (ret || val != val_new) | 221 | if (ret || val != val_new) |
diff --git a/arch/x86/kernel/cpu/perf_event_intel_uncore.c b/arch/x86/kernel/cpu/perf_event_intel_uncore.c index 99d96a4978b5..3cf3d97cce3a 100644 --- a/arch/x86/kernel/cpu/perf_event_intel_uncore.c +++ b/arch/x86/kernel/cpu/perf_event_intel_uncore.c | |||
@@ -118,22 +118,24 @@ static void snbep_uncore_pci_disable_box(struct intel_uncore_box *box) | |||
118 | { | 118 | { |
119 | struct pci_dev *pdev = box->pci_dev; | 119 | struct pci_dev *pdev = box->pci_dev; |
120 | int box_ctl = uncore_pci_box_ctl(box); | 120 | int box_ctl = uncore_pci_box_ctl(box); |
121 | u32 config; | 121 | u32 config = 0; |
122 | 122 | ||
123 | pci_read_config_dword(pdev, box_ctl, &config); | 123 | if (!pci_read_config_dword(pdev, box_ctl, &config)) { |
124 | config |= SNBEP_PMON_BOX_CTL_FRZ; | 124 | config |= SNBEP_PMON_BOX_CTL_FRZ; |
125 | pci_write_config_dword(pdev, box_ctl, config); | 125 | pci_write_config_dword(pdev, box_ctl, config); |
126 | } | ||
126 | } | 127 | } |
127 | 128 | ||
128 | static void snbep_uncore_pci_enable_box(struct intel_uncore_box *box) | 129 | static void snbep_uncore_pci_enable_box(struct intel_uncore_box *box) |
129 | { | 130 | { |
130 | struct pci_dev *pdev = box->pci_dev; | 131 | struct pci_dev *pdev = box->pci_dev; |
131 | int box_ctl = uncore_pci_box_ctl(box); | 132 | int box_ctl = uncore_pci_box_ctl(box); |
132 | u32 config; | 133 | u32 config = 0; |
133 | 134 | ||
134 | pci_read_config_dword(pdev, box_ctl, &config); | 135 | if (!pci_read_config_dword(pdev, box_ctl, &config)) { |
135 | config &= ~SNBEP_PMON_BOX_CTL_FRZ; | 136 | config &= ~SNBEP_PMON_BOX_CTL_FRZ; |
136 | pci_write_config_dword(pdev, box_ctl, config); | 137 | pci_write_config_dword(pdev, box_ctl, config); |
138 | } | ||
137 | } | 139 | } |
138 | 140 | ||
139 | static void snbep_uncore_pci_enable_event(struct intel_uncore_box *box, struct perf_event *event) | 141 | static void snbep_uncore_pci_enable_event(struct intel_uncore_box *box, struct perf_event *event) |
@@ -156,7 +158,7 @@ static u64 snbep_uncore_pci_read_counter(struct intel_uncore_box *box, struct pe | |||
156 | { | 158 | { |
157 | struct pci_dev *pdev = box->pci_dev; | 159 | struct pci_dev *pdev = box->pci_dev; |
158 | struct hw_perf_event *hwc = &event->hw; | 160 | struct hw_perf_event *hwc = &event->hw; |
159 | u64 count; | 161 | u64 count = 0; |
160 | 162 | ||
161 | pci_read_config_dword(pdev, hwc->event_base, (u32 *)&count); | 163 | pci_read_config_dword(pdev, hwc->event_base, (u32 *)&count); |
162 | pci_read_config_dword(pdev, hwc->event_base + 4, (u32 *)&count + 1); | 164 | pci_read_config_dword(pdev, hwc->event_base + 4, (u32 *)&count + 1); |
@@ -603,11 +605,12 @@ static struct pci_driver snbep_uncore_pci_driver = { | |||
603 | /* | 605 | /* |
604 | * build pci bus to socket mapping | 606 | * build pci bus to socket mapping |
605 | */ | 607 | */ |
606 | static void snbep_pci2phy_map_init(void) | 608 | static int snbep_pci2phy_map_init(void) |
607 | { | 609 | { |
608 | struct pci_dev *ubox_dev = NULL; | 610 | struct pci_dev *ubox_dev = NULL; |
609 | int i, bus, nodeid; | 611 | int i, bus, nodeid; |
610 | u32 config; | 612 | int err = 0; |
613 | u32 config = 0; | ||
611 | 614 | ||
612 | while (1) { | 615 | while (1) { |
613 | /* find the UBOX device */ | 616 | /* find the UBOX device */ |
@@ -618,10 +621,14 @@ static void snbep_pci2phy_map_init(void) | |||
618 | break; | 621 | break; |
619 | bus = ubox_dev->bus->number; | 622 | bus = ubox_dev->bus->number; |
620 | /* get the Node ID of the local register */ | 623 | /* get the Node ID of the local register */ |
621 | pci_read_config_dword(ubox_dev, 0x40, &config); | 624 | err = pci_read_config_dword(ubox_dev, 0x40, &config); |
625 | if (err) | ||
626 | break; | ||
622 | nodeid = config; | 627 | nodeid = config; |
623 | /* get the Node ID mapping */ | 628 | /* get the Node ID mapping */ |
624 | pci_read_config_dword(ubox_dev, 0x54, &config); | 629 | err = pci_read_config_dword(ubox_dev, 0x54, &config); |
630 | if (err) | ||
631 | break; | ||
625 | /* | 632 | /* |
626 | * every three bits in the Node ID mapping register maps | 633 | * every three bits in the Node ID mapping register maps |
627 | * to a particular node. | 634 | * to a particular node. |
@@ -633,7 +640,11 @@ static void snbep_pci2phy_map_init(void) | |||
633 | } | 640 | } |
634 | } | 641 | } |
635 | }; | 642 | }; |
636 | return; | 643 | |
644 | if (ubox_dev) | ||
645 | pci_dev_put(ubox_dev); | ||
646 | |||
647 | return err ? pcibios_err_to_errno(err) : 0; | ||
637 | } | 648 | } |
638 | /* end of Sandy Bridge-EP uncore support */ | 649 | /* end of Sandy Bridge-EP uncore support */ |
639 | 650 | ||
@@ -1547,7 +1558,6 @@ void nhmex_rbox_alter_er(struct intel_uncore_box *box, struct perf_event *event) | |||
1547 | { | 1558 | { |
1548 | struct hw_perf_event *hwc = &event->hw; | 1559 | struct hw_perf_event *hwc = &event->hw; |
1549 | struct hw_perf_event_extra *reg1 = &hwc->extra_reg; | 1560 | struct hw_perf_event_extra *reg1 = &hwc->extra_reg; |
1550 | int port; | ||
1551 | 1561 | ||
1552 | /* adjust the main event selector and extra register index */ | 1562 | /* adjust the main event selector and extra register index */ |
1553 | if (reg1->idx % 2) { | 1563 | if (reg1->idx % 2) { |
@@ -1559,7 +1569,6 @@ void nhmex_rbox_alter_er(struct intel_uncore_box *box, struct perf_event *event) | |||
1559 | } | 1569 | } |
1560 | 1570 | ||
1561 | /* adjust extra register config */ | 1571 | /* adjust extra register config */ |
1562 | port = reg1->idx / 6 + box->pmu->pmu_idx * 4; | ||
1563 | switch (reg1->idx % 6) { | 1572 | switch (reg1->idx % 6) { |
1564 | case 2: | 1573 | case 2: |
1565 | /* shift the 8~15 bits to the 0~7 bits */ | 1574 | /* shift the 8~15 bits to the 0~7 bits */ |
@@ -2578,9 +2587,11 @@ static int __init uncore_pci_init(void) | |||
2578 | 2587 | ||
2579 | switch (boot_cpu_data.x86_model) { | 2588 | switch (boot_cpu_data.x86_model) { |
2580 | case 45: /* Sandy Bridge-EP */ | 2589 | case 45: /* Sandy Bridge-EP */ |
2590 | ret = snbep_pci2phy_map_init(); | ||
2591 | if (ret) | ||
2592 | return ret; | ||
2581 | pci_uncores = snbep_pci_uncores; | 2593 | pci_uncores = snbep_pci_uncores; |
2582 | uncore_pci_driver = &snbep_uncore_pci_driver; | 2594 | uncore_pci_driver = &snbep_uncore_pci_driver; |
2583 | snbep_pci2phy_map_init(); | ||
2584 | break; | 2595 | break; |
2585 | default: | 2596 | default: |
2586 | return 0; | 2597 | return 0; |
@@ -2926,6 +2937,9 @@ static int __init intel_uncore_init(void) | |||
2926 | if (boot_cpu_data.x86_vendor != X86_VENDOR_INTEL) | 2937 | if (boot_cpu_data.x86_vendor != X86_VENDOR_INTEL) |
2927 | return -ENODEV; | 2938 | return -ENODEV; |
2928 | 2939 | ||
2940 | if (cpu_has_hypervisor) | ||
2941 | return -ENODEV; | ||
2942 | |||
2929 | ret = uncore_pci_init(); | 2943 | ret = uncore_pci_init(); |
2930 | if (ret) | 2944 | if (ret) |
2931 | goto fail; | 2945 | goto fail; |
diff --git a/arch/x86/kernel/cpu/perf_event_knc.c b/arch/x86/kernel/cpu/perf_event_knc.c index 7c46bfdbc373..4b7731bf23a8 100644 --- a/arch/x86/kernel/cpu/perf_event_knc.c +++ b/arch/x86/kernel/cpu/perf_event_knc.c | |||
@@ -3,6 +3,8 @@ | |||
3 | #include <linux/perf_event.h> | 3 | #include <linux/perf_event.h> |
4 | #include <linux/types.h> | 4 | #include <linux/types.h> |
5 | 5 | ||
6 | #include <asm/hardirq.h> | ||
7 | |||
6 | #include "perf_event.h" | 8 | #include "perf_event.h" |
7 | 9 | ||
8 | static const u64 knc_perfmon_event_map[] = | 10 | static const u64 knc_perfmon_event_map[] = |
@@ -173,30 +175,100 @@ static void knc_pmu_enable_all(int added) | |||
173 | static inline void | 175 | static inline void |
174 | knc_pmu_disable_event(struct perf_event *event) | 176 | knc_pmu_disable_event(struct perf_event *event) |
175 | { | 177 | { |
176 | struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events); | ||
177 | struct hw_perf_event *hwc = &event->hw; | 178 | struct hw_perf_event *hwc = &event->hw; |
178 | u64 val; | 179 | u64 val; |
179 | 180 | ||
180 | val = hwc->config; | 181 | val = hwc->config; |
181 | if (cpuc->enabled) | 182 | val &= ~ARCH_PERFMON_EVENTSEL_ENABLE; |
182 | val &= ~ARCH_PERFMON_EVENTSEL_ENABLE; | ||
183 | 183 | ||
184 | (void)wrmsrl_safe(hwc->config_base + hwc->idx, val); | 184 | (void)wrmsrl_safe(hwc->config_base + hwc->idx, val); |
185 | } | 185 | } |
186 | 186 | ||
187 | static void knc_pmu_enable_event(struct perf_event *event) | 187 | static void knc_pmu_enable_event(struct perf_event *event) |
188 | { | 188 | { |
189 | struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events); | ||
190 | struct hw_perf_event *hwc = &event->hw; | 189 | struct hw_perf_event *hwc = &event->hw; |
191 | u64 val; | 190 | u64 val; |
192 | 191 | ||
193 | val = hwc->config; | 192 | val = hwc->config; |
194 | if (cpuc->enabled) | 193 | val |= ARCH_PERFMON_EVENTSEL_ENABLE; |
195 | val |= ARCH_PERFMON_EVENTSEL_ENABLE; | ||
196 | 194 | ||
197 | (void)wrmsrl_safe(hwc->config_base + hwc->idx, val); | 195 | (void)wrmsrl_safe(hwc->config_base + hwc->idx, val); |
198 | } | 196 | } |
199 | 197 | ||
198 | static inline u64 knc_pmu_get_status(void) | ||
199 | { | ||
200 | u64 status; | ||
201 | |||
202 | rdmsrl(MSR_KNC_IA32_PERF_GLOBAL_STATUS, status); | ||
203 | |||
204 | return status; | ||
205 | } | ||
206 | |||
207 | static inline void knc_pmu_ack_status(u64 ack) | ||
208 | { | ||
209 | wrmsrl(MSR_KNC_IA32_PERF_GLOBAL_OVF_CONTROL, ack); | ||
210 | } | ||
211 | |||
212 | static int knc_pmu_handle_irq(struct pt_regs *regs) | ||
213 | { | ||
214 | struct perf_sample_data data; | ||
215 | struct cpu_hw_events *cpuc; | ||
216 | int handled = 0; | ||
217 | int bit, loops; | ||
218 | u64 status; | ||
219 | |||
220 | cpuc = &__get_cpu_var(cpu_hw_events); | ||
221 | |||
222 | knc_pmu_disable_all(); | ||
223 | |||
224 | status = knc_pmu_get_status(); | ||
225 | if (!status) { | ||
226 | knc_pmu_enable_all(0); | ||
227 | return handled; | ||
228 | } | ||
229 | |||
230 | loops = 0; | ||
231 | again: | ||
232 | knc_pmu_ack_status(status); | ||
233 | if (++loops > 100) { | ||
234 | WARN_ONCE(1, "perf: irq loop stuck!\n"); | ||
235 | perf_event_print_debug(); | ||
236 | goto done; | ||
237 | } | ||
238 | |||
239 | inc_irq_stat(apic_perf_irqs); | ||
240 | |||
241 | for_each_set_bit(bit, (unsigned long *)&status, X86_PMC_IDX_MAX) { | ||
242 | struct perf_event *event = cpuc->events[bit]; | ||
243 | |||
244 | handled++; | ||
245 | |||
246 | if (!test_bit(bit, cpuc->active_mask)) | ||
247 | continue; | ||
248 | |||
249 | if (!intel_pmu_save_and_restart(event)) | ||
250 | continue; | ||
251 | |||
252 | perf_sample_data_init(&data, 0, event->hw.last_period); | ||
253 | |||
254 | if (perf_event_overflow(event, &data, regs)) | ||
255 | x86_pmu_stop(event, 0); | ||
256 | } | ||
257 | |||
258 | /* | ||
259 | * Repeat if there is more work to be done: | ||
260 | */ | ||
261 | status = knc_pmu_get_status(); | ||
262 | if (status) | ||
263 | goto again; | ||
264 | |||
265 | done: | ||
266 | knc_pmu_enable_all(0); | ||
267 | |||
268 | return handled; | ||
269 | } | ||
270 | |||
271 | |||
200 | PMU_FORMAT_ATTR(event, "config:0-7" ); | 272 | PMU_FORMAT_ATTR(event, "config:0-7" ); |
201 | PMU_FORMAT_ATTR(umask, "config:8-15" ); | 273 | PMU_FORMAT_ATTR(umask, "config:8-15" ); |
202 | PMU_FORMAT_ATTR(edge, "config:18" ); | 274 | PMU_FORMAT_ATTR(edge, "config:18" ); |
@@ -214,7 +286,7 @@ static struct attribute *intel_knc_formats_attr[] = { | |||
214 | 286 | ||
215 | static __initconst struct x86_pmu knc_pmu = { | 287 | static __initconst struct x86_pmu knc_pmu = { |
216 | .name = "knc", | 288 | .name = "knc", |
217 | .handle_irq = x86_pmu_handle_irq, | 289 | .handle_irq = knc_pmu_handle_irq, |
218 | .disable_all = knc_pmu_disable_all, | 290 | .disable_all = knc_pmu_disable_all, |
219 | .enable_all = knc_pmu_enable_all, | 291 | .enable_all = knc_pmu_enable_all, |
220 | .enable = knc_pmu_enable_event, | 292 | .enable = knc_pmu_enable_event, |
@@ -226,12 +298,11 @@ static __initconst struct x86_pmu knc_pmu = { | |||
226 | .event_map = knc_pmu_event_map, | 298 | .event_map = knc_pmu_event_map, |
227 | .max_events = ARRAY_SIZE(knc_perfmon_event_map), | 299 | .max_events = ARRAY_SIZE(knc_perfmon_event_map), |
228 | .apic = 1, | 300 | .apic = 1, |
229 | .max_period = (1ULL << 31) - 1, | 301 | .max_period = (1ULL << 39) - 1, |
230 | .version = 0, | 302 | .version = 0, |
231 | .num_counters = 2, | 303 | .num_counters = 2, |
232 | /* in theory 40 bits, early silicon is buggy though */ | 304 | .cntval_bits = 40, |
233 | .cntval_bits = 32, | 305 | .cntval_mask = (1ULL << 40) - 1, |
234 | .cntval_mask = (1ULL << 32) - 1, | ||
235 | .get_event_constraints = x86_get_event_constraints, | 306 | .get_event_constraints = x86_get_event_constraints, |
236 | .event_constraints = knc_event_constraints, | 307 | .event_constraints = knc_event_constraints, |
237 | .format_attrs = intel_knc_formats_attr, | 308 | .format_attrs = intel_knc_formats_attr, |
diff --git a/arch/x86/kernel/cpu/perf_event_p6.c b/arch/x86/kernel/cpu/perf_event_p6.c index e4dd0f7a0453..7d0270bd793e 100644 --- a/arch/x86/kernel/cpu/perf_event_p6.c +++ b/arch/x86/kernel/cpu/perf_event_p6.c | |||
@@ -8,13 +8,106 @@ | |||
8 | */ | 8 | */ |
9 | static const u64 p6_perfmon_event_map[] = | 9 | static const u64 p6_perfmon_event_map[] = |
10 | { | 10 | { |
11 | [PERF_COUNT_HW_CPU_CYCLES] = 0x0079, | 11 | [PERF_COUNT_HW_CPU_CYCLES] = 0x0079, /* CPU_CLK_UNHALTED */ |
12 | [PERF_COUNT_HW_INSTRUCTIONS] = 0x00c0, | 12 | [PERF_COUNT_HW_INSTRUCTIONS] = 0x00c0, /* INST_RETIRED */ |
13 | [PERF_COUNT_HW_CACHE_REFERENCES] = 0x0f2e, | 13 | [PERF_COUNT_HW_CACHE_REFERENCES] = 0x0f2e, /* L2_RQSTS:M:E:S:I */ |
14 | [PERF_COUNT_HW_CACHE_MISSES] = 0x012e, | 14 | [PERF_COUNT_HW_CACHE_MISSES] = 0x012e, /* L2_RQSTS:I */ |
15 | [PERF_COUNT_HW_BRANCH_INSTRUCTIONS] = 0x00c4, | 15 | [PERF_COUNT_HW_BRANCH_INSTRUCTIONS] = 0x00c4, /* BR_INST_RETIRED */ |
16 | [PERF_COUNT_HW_BRANCH_MISSES] = 0x00c5, | 16 | [PERF_COUNT_HW_BRANCH_MISSES] = 0x00c5, /* BR_MISS_PRED_RETIRED */ |
17 | [PERF_COUNT_HW_BUS_CYCLES] = 0x0062, | 17 | [PERF_COUNT_HW_BUS_CYCLES] = 0x0062, /* BUS_DRDY_CLOCKS */ |
18 | [PERF_COUNT_HW_STALLED_CYCLES_FRONTEND] = 0x00a2, /* RESOURCE_STALLS */ | ||
19 | |||
20 | }; | ||
21 | |||
22 | static __initconst u64 p6_hw_cache_event_ids | ||
23 | [PERF_COUNT_HW_CACHE_MAX] | ||
24 | [PERF_COUNT_HW_CACHE_OP_MAX] | ||
25 | [PERF_COUNT_HW_CACHE_RESULT_MAX] = | ||
26 | { | ||
27 | [ C(L1D) ] = { | ||
28 | [ C(OP_READ) ] = { | ||
29 | [ C(RESULT_ACCESS) ] = 0x0043, /* DATA_MEM_REFS */ | ||
30 | [ C(RESULT_MISS) ] = 0x0045, /* DCU_LINES_IN */ | ||
31 | }, | ||
32 | [ C(OP_WRITE) ] = { | ||
33 | [ C(RESULT_ACCESS) ] = 0, | ||
34 | [ C(RESULT_MISS) ] = 0x0f29, /* L2_LD:M:E:S:I */ | ||
35 | }, | ||
36 | [ C(OP_PREFETCH) ] = { | ||
37 | [ C(RESULT_ACCESS) ] = 0, | ||
38 | [ C(RESULT_MISS) ] = 0, | ||
39 | }, | ||
40 | }, | ||
41 | [ C(L1I ) ] = { | ||
42 | [ C(OP_READ) ] = { | ||
43 | [ C(RESULT_ACCESS) ] = 0x0080, /* IFU_IFETCH */ | ||
44 | [ C(RESULT_MISS) ] = 0x0f28, /* L2_IFETCH:M:E:S:I */ | ||
45 | }, | ||
46 | [ C(OP_WRITE) ] = { | ||
47 | [ C(RESULT_ACCESS) ] = -1, | ||
48 | [ C(RESULT_MISS) ] = -1, | ||
49 | }, | ||
50 | [ C(OP_PREFETCH) ] = { | ||
51 | [ C(RESULT_ACCESS) ] = 0, | ||
52 | [ C(RESULT_MISS) ] = 0, | ||
53 | }, | ||
54 | }, | ||
55 | [ C(LL ) ] = { | ||
56 | [ C(OP_READ) ] = { | ||
57 | [ C(RESULT_ACCESS) ] = 0, | ||
58 | [ C(RESULT_MISS) ] = 0, | ||
59 | }, | ||
60 | [ C(OP_WRITE) ] = { | ||
61 | [ C(RESULT_ACCESS) ] = 0, | ||
62 | [ C(RESULT_MISS) ] = 0x0025, /* L2_M_LINES_INM */ | ||
63 | }, | ||
64 | [ C(OP_PREFETCH) ] = { | ||
65 | [ C(RESULT_ACCESS) ] = 0, | ||
66 | [ C(RESULT_MISS) ] = 0, | ||
67 | }, | ||
68 | }, | ||
69 | [ C(DTLB) ] = { | ||
70 | [ C(OP_READ) ] = { | ||
71 | [ C(RESULT_ACCESS) ] = 0x0043, /* DATA_MEM_REFS */ | ||
72 | [ C(RESULT_MISS) ] = 0, | ||
73 | }, | ||
74 | [ C(OP_WRITE) ] = { | ||
75 | [ C(RESULT_ACCESS) ] = 0, | ||
76 | [ C(RESULT_MISS) ] = 0, | ||
77 | }, | ||
78 | [ C(OP_PREFETCH) ] = { | ||
79 | [ C(RESULT_ACCESS) ] = 0, | ||
80 | [ C(RESULT_MISS) ] = 0, | ||
81 | }, | ||
82 | }, | ||
83 | [ C(ITLB) ] = { | ||
84 | [ C(OP_READ) ] = { | ||
85 | [ C(RESULT_ACCESS) ] = 0x0080, /* IFU_IFETCH */ | ||
86 | [ C(RESULT_MISS) ] = 0x0085, /* ITLB_MISS */ | ||
87 | }, | ||
88 | [ C(OP_WRITE) ] = { | ||
89 | [ C(RESULT_ACCESS) ] = -1, | ||
90 | [ C(RESULT_MISS) ] = -1, | ||
91 | }, | ||
92 | [ C(OP_PREFETCH) ] = { | ||
93 | [ C(RESULT_ACCESS) ] = -1, | ||
94 | [ C(RESULT_MISS) ] = -1, | ||
95 | }, | ||
96 | }, | ||
97 | [ C(BPU ) ] = { | ||
98 | [ C(OP_READ) ] = { | ||
99 | [ C(RESULT_ACCESS) ] = 0x00c4, /* BR_INST_RETIRED */ | ||
100 | [ C(RESULT_MISS) ] = 0x00c5, /* BR_MISS_PRED_RETIRED */ | ||
101 | }, | ||
102 | [ C(OP_WRITE) ] = { | ||
103 | [ C(RESULT_ACCESS) ] = -1, | ||
104 | [ C(RESULT_MISS) ] = -1, | ||
105 | }, | ||
106 | [ C(OP_PREFETCH) ] = { | ||
107 | [ C(RESULT_ACCESS) ] = -1, | ||
108 | [ C(RESULT_MISS) ] = -1, | ||
109 | }, | ||
110 | }, | ||
18 | }; | 111 | }; |
19 | 112 | ||
20 | static u64 p6_pmu_event_map(int hw_event) | 113 | static u64 p6_pmu_event_map(int hw_event) |
@@ -34,7 +127,7 @@ static struct event_constraint p6_event_constraints[] = | |||
34 | { | 127 | { |
35 | INTEL_EVENT_CONSTRAINT(0xc1, 0x1), /* FLOPS */ | 128 | INTEL_EVENT_CONSTRAINT(0xc1, 0x1), /* FLOPS */ |
36 | INTEL_EVENT_CONSTRAINT(0x10, 0x1), /* FP_COMP_OPS_EXE */ | 129 | INTEL_EVENT_CONSTRAINT(0x10, 0x1), /* FP_COMP_OPS_EXE */ |
37 | INTEL_EVENT_CONSTRAINT(0x11, 0x1), /* FP_ASSIST */ | 130 | INTEL_EVENT_CONSTRAINT(0x11, 0x2), /* FP_ASSIST */ |
38 | INTEL_EVENT_CONSTRAINT(0x12, 0x2), /* MUL */ | 131 | INTEL_EVENT_CONSTRAINT(0x12, 0x2), /* MUL */ |
39 | INTEL_EVENT_CONSTRAINT(0x13, 0x2), /* DIV */ | 132 | INTEL_EVENT_CONSTRAINT(0x13, 0x2), /* DIV */ |
40 | INTEL_EVENT_CONSTRAINT(0x14, 0x1), /* CYCLES_DIV_BUSY */ | 133 | INTEL_EVENT_CONSTRAINT(0x14, 0x1), /* CYCLES_DIV_BUSY */ |
@@ -64,25 +157,25 @@ static void p6_pmu_enable_all(int added) | |||
64 | static inline void | 157 | static inline void |
65 | p6_pmu_disable_event(struct perf_event *event) | 158 | p6_pmu_disable_event(struct perf_event *event) |
66 | { | 159 | { |
67 | struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events); | ||
68 | struct hw_perf_event *hwc = &event->hw; | 160 | struct hw_perf_event *hwc = &event->hw; |
69 | u64 val = P6_NOP_EVENT; | 161 | u64 val = P6_NOP_EVENT; |
70 | 162 | ||
71 | if (cpuc->enabled) | ||
72 | val |= ARCH_PERFMON_EVENTSEL_ENABLE; | ||
73 | |||
74 | (void)wrmsrl_safe(hwc->config_base, val); | 163 | (void)wrmsrl_safe(hwc->config_base, val); |
75 | } | 164 | } |
76 | 165 | ||
77 | static void p6_pmu_enable_event(struct perf_event *event) | 166 | static void p6_pmu_enable_event(struct perf_event *event) |
78 | { | 167 | { |
79 | struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events); | ||
80 | struct hw_perf_event *hwc = &event->hw; | 168 | struct hw_perf_event *hwc = &event->hw; |
81 | u64 val; | 169 | u64 val; |
82 | 170 | ||
83 | val = hwc->config; | 171 | val = hwc->config; |
84 | if (cpuc->enabled) | 172 | |
85 | val |= ARCH_PERFMON_EVENTSEL_ENABLE; | 173 | /* |
174 | * p6 only has a global event enable, set on PerfEvtSel0 | ||
175 | * We "disable" events by programming P6_NOP_EVENT | ||
176 | * and we rely on p6_pmu_enable_all() being called | ||
177 | * to actually enable the events. | ||
178 | */ | ||
86 | 179 | ||
87 | (void)wrmsrl_safe(hwc->config_base, val); | 180 | (void)wrmsrl_safe(hwc->config_base, val); |
88 | } | 181 | } |
@@ -158,5 +251,9 @@ __init int p6_pmu_init(void) | |||
158 | 251 | ||
159 | x86_pmu = p6_pmu; | 252 | x86_pmu = p6_pmu; |
160 | 253 | ||
254 | memcpy(hw_cache_event_ids, p6_hw_cache_event_ids, | ||
255 | sizeof(hw_cache_event_ids)); | ||
256 | |||
257 | |||
161 | return 0; | 258 | return 0; |
162 | } | 259 | } |
diff --git a/arch/x86/kernel/e820.c b/arch/x86/kernel/e820.c index ed858e9e9a74..df06ade26bef 100644 --- a/arch/x86/kernel/e820.c +++ b/arch/x86/kernel/e820.c | |||
@@ -1077,6 +1077,9 @@ void __init memblock_x86_fill(void) | |||
1077 | memblock_add(ei->addr, ei->size); | 1077 | memblock_add(ei->addr, ei->size); |
1078 | } | 1078 | } |
1079 | 1079 | ||
1080 | /* throw away partial pages */ | ||
1081 | memblock_trim_memory(PAGE_SIZE); | ||
1082 | |||
1080 | memblock_dump_all(); | 1083 | memblock_dump_all(); |
1081 | } | 1084 | } |
1082 | 1085 | ||
diff --git a/arch/x86/kernel/entry_32.S b/arch/x86/kernel/entry_32.S index a1193aef6d7d..88b725aa1d52 100644 --- a/arch/x86/kernel/entry_32.S +++ b/arch/x86/kernel/entry_32.S | |||
@@ -1035,7 +1035,7 @@ ENTRY(xen_sysenter_target) | |||
1035 | 1035 | ||
1036 | ENTRY(xen_hypervisor_callback) | 1036 | ENTRY(xen_hypervisor_callback) |
1037 | CFI_STARTPROC | 1037 | CFI_STARTPROC |
1038 | pushl_cfi $0 | 1038 | pushl_cfi $-1 /* orig_ax = -1 => not a system call */ |
1039 | SAVE_ALL | 1039 | SAVE_ALL |
1040 | TRACE_IRQS_OFF | 1040 | TRACE_IRQS_OFF |
1041 | 1041 | ||
@@ -1077,14 +1077,16 @@ ENTRY(xen_failsafe_callback) | |||
1077 | 2: mov 8(%esp),%es | 1077 | 2: mov 8(%esp),%es |
1078 | 3: mov 12(%esp),%fs | 1078 | 3: mov 12(%esp),%fs |
1079 | 4: mov 16(%esp),%gs | 1079 | 4: mov 16(%esp),%gs |
1080 | /* EAX == 0 => Category 1 (Bad segment) | ||
1081 | EAX != 0 => Category 2 (Bad IRET) */ | ||
1080 | testl %eax,%eax | 1082 | testl %eax,%eax |
1081 | popl_cfi %eax | 1083 | popl_cfi %eax |
1082 | lea 16(%esp),%esp | 1084 | lea 16(%esp),%esp |
1083 | CFI_ADJUST_CFA_OFFSET -16 | 1085 | CFI_ADJUST_CFA_OFFSET -16 |
1084 | jz 5f | 1086 | jz 5f |
1085 | addl $16,%esp | 1087 | addl $16,%esp |
1086 | jmp iret_exc # EAX != 0 => Category 2 (Bad IRET) | 1088 | jmp iret_exc |
1087 | 5: pushl_cfi $0 # EAX == 0 => Category 1 (Bad segment) | 1089 | 5: pushl_cfi $-1 /* orig_ax = -1 => not a system call */ |
1088 | SAVE_ALL | 1090 | SAVE_ALL |
1089 | jmp ret_from_exception | 1091 | jmp ret_from_exception |
1090 | CFI_ENDPROC | 1092 | CFI_ENDPROC |
diff --git a/arch/x86/kernel/entry_64.S b/arch/x86/kernel/entry_64.S index 0c58952d64e8..b51b2c7ee51f 100644 --- a/arch/x86/kernel/entry_64.S +++ b/arch/x86/kernel/entry_64.S | |||
@@ -1435,7 +1435,7 @@ ENTRY(xen_failsafe_callback) | |||
1435 | CFI_RESTORE r11 | 1435 | CFI_RESTORE r11 |
1436 | addq $0x30,%rsp | 1436 | addq $0x30,%rsp |
1437 | CFI_ADJUST_CFA_OFFSET -0x30 | 1437 | CFI_ADJUST_CFA_OFFSET -0x30 |
1438 | pushq_cfi $0 | 1438 | pushq_cfi $-1 /* orig_ax = -1 => not a system call */ |
1439 | SAVE_ALL | 1439 | SAVE_ALL |
1440 | jmp error_exit | 1440 | jmp error_exit |
1441 | CFI_ENDPROC | 1441 | CFI_ENDPROC |
diff --git a/arch/x86/kernel/kvm.c b/arch/x86/kernel/kvm.c index b3e5e51bc907..4180a874c764 100644 --- a/arch/x86/kernel/kvm.c +++ b/arch/x86/kernel/kvm.c | |||
@@ -247,7 +247,10 @@ do_async_page_fault(struct pt_regs *regs, unsigned long error_code) | |||
247 | break; | 247 | break; |
248 | case KVM_PV_REASON_PAGE_NOT_PRESENT: | 248 | case KVM_PV_REASON_PAGE_NOT_PRESENT: |
249 | /* page is swapped out by the host. */ | 249 | /* page is swapped out by the host. */ |
250 | rcu_irq_enter(); | ||
251 | exit_idle(); | ||
250 | kvm_async_pf_task_wait((u32)read_cr2()); | 252 | kvm_async_pf_task_wait((u32)read_cr2()); |
253 | rcu_irq_exit(); | ||
251 | break; | 254 | break; |
252 | case KVM_PV_REASON_PAGE_READY: | 255 | case KVM_PV_REASON_PAGE_READY: |
253 | rcu_irq_enter(); | 256 | rcu_irq_enter(); |
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c index 468e98dfd44e..ca45696f30fb 100644 --- a/arch/x86/kernel/setup.c +++ b/arch/x86/kernel/setup.c | |||
@@ -921,18 +921,19 @@ void __init setup_arch(char **cmdline_p) | |||
921 | #ifdef CONFIG_X86_64 | 921 | #ifdef CONFIG_X86_64 |
922 | if (max_pfn > max_low_pfn) { | 922 | if (max_pfn > max_low_pfn) { |
923 | int i; | 923 | int i; |
924 | for (i = 0; i < e820.nr_map; i++) { | 924 | unsigned long start, end; |
925 | struct e820entry *ei = &e820.map[i]; | 925 | unsigned long start_pfn, end_pfn; |
926 | 926 | ||
927 | if (ei->addr + ei->size <= 1UL << 32) | 927 | for_each_mem_pfn_range(i, MAX_NUMNODES, &start_pfn, &end_pfn, |
928 | continue; | 928 | NULL) { |
929 | 929 | ||
930 | if (ei->type == E820_RESERVED) | 930 | end = PFN_PHYS(end_pfn); |
931 | if (end <= (1UL<<32)) | ||
931 | continue; | 932 | continue; |
932 | 933 | ||
934 | start = PFN_PHYS(start_pfn); | ||
933 | max_pfn_mapped = init_memory_mapping( | 935 | max_pfn_mapped = init_memory_mapping( |
934 | ei->addr < 1UL << 32 ? 1UL << 32 : ei->addr, | 936 | max((1UL<<32), start), end); |
935 | ei->addr + ei->size); | ||
936 | } | 937 | } |
937 | 938 | ||
938 | /* can we preseve max_low_pfn ?*/ | 939 | /* can we preseve max_low_pfn ?*/ |
@@ -1048,6 +1049,18 @@ void __init setup_arch(char **cmdline_p) | |||
1048 | arch_init_ideal_nops(); | 1049 | arch_init_ideal_nops(); |
1049 | 1050 | ||
1050 | register_refined_jiffies(CLOCK_TICK_RATE); | 1051 | register_refined_jiffies(CLOCK_TICK_RATE); |
1052 | |||
1053 | #ifdef CONFIG_EFI | ||
1054 | /* Once setup is done above, disable efi_enabled on mismatched | ||
1055 | * firmware/kernel archtectures since there is no support for | ||
1056 | * runtime services. | ||
1057 | */ | ||
1058 | if (efi_enabled && IS_ENABLED(CONFIG_X86_64) != efi_64bit) { | ||
1059 | pr_info("efi: Setup done, disabling due to 32/64-bit mismatch\n"); | ||
1060 | efi_unmap_memmap(); | ||
1061 | efi_enabled = 0; | ||
1062 | } | ||
1063 | #endif | ||
1051 | } | 1064 | } |
1052 | 1065 | ||
1053 | #ifdef CONFIG_X86_32 | 1066 | #ifdef CONFIG_X86_32 |
diff --git a/arch/x86/kernel/signal.c b/arch/x86/kernel/signal.c index 29ad351804e9..70b27ee6118e 100644 --- a/arch/x86/kernel/signal.c +++ b/arch/x86/kernel/signal.c | |||
@@ -824,10 +824,8 @@ do_notify_resume(struct pt_regs *regs, void *unused, __u32 thread_info_flags) | |||
824 | mce_notify_process(); | 824 | mce_notify_process(); |
825 | #endif /* CONFIG_X86_64 && CONFIG_X86_MCE */ | 825 | #endif /* CONFIG_X86_64 && CONFIG_X86_MCE */ |
826 | 826 | ||
827 | if (thread_info_flags & _TIF_UPROBE) { | 827 | if (thread_info_flags & _TIF_UPROBE) |
828 | clear_thread_flag(TIF_UPROBE); | ||
829 | uprobe_notify_resume(regs); | 828 | uprobe_notify_resume(regs); |
830 | } | ||
831 | 829 | ||
832 | /* deal with pending signal delivery */ | 830 | /* deal with pending signal delivery */ |
833 | if (thread_info_flags & _TIF_SIGPENDING) | 831 | if (thread_info_flags & _TIF_SIGPENDING) |
diff --git a/arch/x86/kernel/uprobes.c b/arch/x86/kernel/uprobes.c index 9538f00827a9..aafa5557b396 100644 --- a/arch/x86/kernel/uprobes.c +++ b/arch/x86/kernel/uprobes.c | |||
@@ -651,31 +651,19 @@ void arch_uprobe_abort_xol(struct arch_uprobe *auprobe, struct pt_regs *regs) | |||
651 | 651 | ||
652 | /* | 652 | /* |
653 | * Skip these instructions as per the currently known x86 ISA. | 653 | * Skip these instructions as per the currently known x86 ISA. |
654 | * 0x66* { 0x90 | 0x0f 0x1f | 0x0f 0x19 | 0x87 0xc0 } | 654 | * rep=0x66*; nop=0x90 |
655 | */ | 655 | */ |
656 | static bool __skip_sstep(struct arch_uprobe *auprobe, struct pt_regs *regs) | 656 | static bool __skip_sstep(struct arch_uprobe *auprobe, struct pt_regs *regs) |
657 | { | 657 | { |
658 | int i; | 658 | int i; |
659 | 659 | ||
660 | for (i = 0; i < MAX_UINSN_BYTES; i++) { | 660 | for (i = 0; i < MAX_UINSN_BYTES; i++) { |
661 | if ((auprobe->insn[i] == 0x66)) | 661 | if (auprobe->insn[i] == 0x66) |
662 | continue; | 662 | continue; |
663 | 663 | ||
664 | if (auprobe->insn[i] == 0x90) | 664 | if (auprobe->insn[i] == 0x90) |
665 | return true; | 665 | return true; |
666 | 666 | ||
667 | if (i == (MAX_UINSN_BYTES - 1)) | ||
668 | break; | ||
669 | |||
670 | if ((auprobe->insn[i] == 0x0f) && (auprobe->insn[i+1] == 0x1f)) | ||
671 | return true; | ||
672 | |||
673 | if ((auprobe->insn[i] == 0x0f) && (auprobe->insn[i+1] == 0x19)) | ||
674 | return true; | ||
675 | |||
676 | if ((auprobe->insn[i] == 0x87) && (auprobe->insn[i+1] == 0xc0)) | ||
677 | return true; | ||
678 | |||
679 | break; | 667 | break; |
680 | } | 668 | } |
681 | return false; | 669 | return false; |
diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c index c6e6b721b6ee..43e9fadca5d0 100644 --- a/arch/x86/kvm/lapic.c +++ b/arch/x86/kvm/lapic.c | |||
@@ -1311,7 +1311,7 @@ void kvm_lapic_set_base(struct kvm_vcpu *vcpu, u64 value) | |||
1311 | vcpu->arch.apic_base = value; | 1311 | vcpu->arch.apic_base = value; |
1312 | if (apic_x2apic_mode(apic)) { | 1312 | if (apic_x2apic_mode(apic)) { |
1313 | u32 id = kvm_apic_id(apic); | 1313 | u32 id = kvm_apic_id(apic); |
1314 | u32 ldr = ((id & ~0xf) << 16) | (1 << (id & 0xf)); | 1314 | u32 ldr = ((id >> 4) << 16) | (1 << (id & 0xf)); |
1315 | kvm_apic_set_ldr(apic, ldr); | 1315 | kvm_apic_set_ldr(apic, ldr); |
1316 | } | 1316 | } |
1317 | apic->base_address = apic->vcpu->arch.apic_base & | 1317 | apic->base_address = apic->vcpu->arch.apic_base & |
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index d289fee1ffb8..6f85fe0bf958 100644 --- a/arch/x86/kvm/mmu.c +++ b/arch/x86/kvm/mmu.c | |||
@@ -2497,8 +2497,7 @@ static void mmu_set_spte(struct kvm_vcpu *vcpu, u64 *sptep, | |||
2497 | } | 2497 | } |
2498 | } | 2498 | } |
2499 | 2499 | ||
2500 | if (!is_error_pfn(pfn)) | 2500 | kvm_release_pfn_clean(pfn); |
2501 | kvm_release_pfn_clean(pfn); | ||
2502 | } | 2501 | } |
2503 | 2502 | ||
2504 | static void nonpaging_new_cr3(struct kvm_vcpu *vcpu) | 2503 | static void nonpaging_new_cr3(struct kvm_vcpu *vcpu) |
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 1eefebe5d727..224a7e78cb6c 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c | |||
@@ -3779,7 +3779,7 @@ static int write_exit_mmio(struct kvm_vcpu *vcpu, gpa_t gpa, | |||
3779 | { | 3779 | { |
3780 | struct kvm_mmio_fragment *frag = &vcpu->mmio_fragments[0]; | 3780 | struct kvm_mmio_fragment *frag = &vcpu->mmio_fragments[0]; |
3781 | 3781 | ||
3782 | memcpy(vcpu->run->mmio.data, frag->data, frag->len); | 3782 | memcpy(vcpu->run->mmio.data, frag->data, min(8u, frag->len)); |
3783 | return X86EMUL_CONTINUE; | 3783 | return X86EMUL_CONTINUE; |
3784 | } | 3784 | } |
3785 | 3785 | ||
@@ -3832,18 +3832,11 @@ mmio: | |||
3832 | bytes -= handled; | 3832 | bytes -= handled; |
3833 | val += handled; | 3833 | val += handled; |
3834 | 3834 | ||
3835 | while (bytes) { | 3835 | WARN_ON(vcpu->mmio_nr_fragments >= KVM_MAX_MMIO_FRAGMENTS); |
3836 | unsigned now = min(bytes, 8U); | 3836 | frag = &vcpu->mmio_fragments[vcpu->mmio_nr_fragments++]; |
3837 | 3837 | frag->gpa = gpa; | |
3838 | frag = &vcpu->mmio_fragments[vcpu->mmio_nr_fragments++]; | 3838 | frag->data = val; |
3839 | frag->gpa = gpa; | 3839 | frag->len = bytes; |
3840 | frag->data = val; | ||
3841 | frag->len = now; | ||
3842 | |||
3843 | gpa += now; | ||
3844 | val += now; | ||
3845 | bytes -= now; | ||
3846 | } | ||
3847 | return X86EMUL_CONTINUE; | 3840 | return X86EMUL_CONTINUE; |
3848 | } | 3841 | } |
3849 | 3842 | ||
@@ -3890,7 +3883,7 @@ int emulator_read_write(struct x86_emulate_ctxt *ctxt, unsigned long addr, | |||
3890 | vcpu->mmio_needed = 1; | 3883 | vcpu->mmio_needed = 1; |
3891 | vcpu->mmio_cur_fragment = 0; | 3884 | vcpu->mmio_cur_fragment = 0; |
3892 | 3885 | ||
3893 | vcpu->run->mmio.len = vcpu->mmio_fragments[0].len; | 3886 | vcpu->run->mmio.len = min(8u, vcpu->mmio_fragments[0].len); |
3894 | vcpu->run->mmio.is_write = vcpu->mmio_is_write = ops->write; | 3887 | vcpu->run->mmio.is_write = vcpu->mmio_is_write = ops->write; |
3895 | vcpu->run->exit_reason = KVM_EXIT_MMIO; | 3888 | vcpu->run->exit_reason = KVM_EXIT_MMIO; |
3896 | vcpu->run->mmio.phys_addr = gpa; | 3889 | vcpu->run->mmio.phys_addr = gpa; |
@@ -5522,28 +5515,44 @@ static int complete_emulated_pio(struct kvm_vcpu *vcpu) | |||
5522 | * | 5515 | * |
5523 | * read: | 5516 | * read: |
5524 | * for each fragment | 5517 | * for each fragment |
5525 | * write gpa, len | 5518 | * for each mmio piece in the fragment |
5526 | * exit | 5519 | * write gpa, len |
5527 | * copy data | 5520 | * exit |
5521 | * copy data | ||
5528 | * execute insn | 5522 | * execute insn |
5529 | * | 5523 | * |
5530 | * write: | 5524 | * write: |
5531 | * for each fragment | 5525 | * for each fragment |
5532 | * write gpa, len | 5526 | * for each mmio piece in the fragment |
5533 | * copy data | 5527 | * write gpa, len |
5534 | * exit | 5528 | * copy data |
5529 | * exit | ||
5535 | */ | 5530 | */ |
5536 | static int complete_emulated_mmio(struct kvm_vcpu *vcpu) | 5531 | static int complete_emulated_mmio(struct kvm_vcpu *vcpu) |
5537 | { | 5532 | { |
5538 | struct kvm_run *run = vcpu->run; | 5533 | struct kvm_run *run = vcpu->run; |
5539 | struct kvm_mmio_fragment *frag; | 5534 | struct kvm_mmio_fragment *frag; |
5535 | unsigned len; | ||
5540 | 5536 | ||
5541 | BUG_ON(!vcpu->mmio_needed); | 5537 | BUG_ON(!vcpu->mmio_needed); |
5542 | 5538 | ||
5543 | /* Complete previous fragment */ | 5539 | /* Complete previous fragment */ |
5544 | frag = &vcpu->mmio_fragments[vcpu->mmio_cur_fragment++]; | 5540 | frag = &vcpu->mmio_fragments[vcpu->mmio_cur_fragment]; |
5541 | len = min(8u, frag->len); | ||
5545 | if (!vcpu->mmio_is_write) | 5542 | if (!vcpu->mmio_is_write) |
5546 | memcpy(frag->data, run->mmio.data, frag->len); | 5543 | memcpy(frag->data, run->mmio.data, len); |
5544 | |||
5545 | if (frag->len <= 8) { | ||
5546 | /* Switch to the next fragment. */ | ||
5547 | frag++; | ||
5548 | vcpu->mmio_cur_fragment++; | ||
5549 | } else { | ||
5550 | /* Go forward to the next mmio piece. */ | ||
5551 | frag->data += len; | ||
5552 | frag->gpa += len; | ||
5553 | frag->len -= len; | ||
5554 | } | ||
5555 | |||
5547 | if (vcpu->mmio_cur_fragment == vcpu->mmio_nr_fragments) { | 5556 | if (vcpu->mmio_cur_fragment == vcpu->mmio_nr_fragments) { |
5548 | vcpu->mmio_needed = 0; | 5557 | vcpu->mmio_needed = 0; |
5549 | if (vcpu->mmio_is_write) | 5558 | if (vcpu->mmio_is_write) |
@@ -5551,13 +5560,12 @@ static int complete_emulated_mmio(struct kvm_vcpu *vcpu) | |||
5551 | vcpu->mmio_read_completed = 1; | 5560 | vcpu->mmio_read_completed = 1; |
5552 | return complete_emulated_io(vcpu); | 5561 | return complete_emulated_io(vcpu); |
5553 | } | 5562 | } |
5554 | /* Initiate next fragment */ | 5563 | |
5555 | ++frag; | ||
5556 | run->exit_reason = KVM_EXIT_MMIO; | 5564 | run->exit_reason = KVM_EXIT_MMIO; |
5557 | run->mmio.phys_addr = frag->gpa; | 5565 | run->mmio.phys_addr = frag->gpa; |
5558 | if (vcpu->mmio_is_write) | 5566 | if (vcpu->mmio_is_write) |
5559 | memcpy(run->mmio.data, frag->data, frag->len); | 5567 | memcpy(run->mmio.data, frag->data, min(8u, frag->len)); |
5560 | run->mmio.len = frag->len; | 5568 | run->mmio.len = min(8u, frag->len); |
5561 | run->mmio.is_write = vcpu->mmio_is_write; | 5569 | run->mmio.is_write = vcpu->mmio_is_write; |
5562 | vcpu->arch.complete_userspace_io = complete_emulated_mmio; | 5570 | vcpu->arch.complete_userspace_io = complete_emulated_mmio; |
5563 | return 0; | 5571 | return 0; |
diff --git a/arch/x86/mm/init.c b/arch/x86/mm/init.c index ab1f6a93b527..d7aea41563b3 100644 --- a/arch/x86/mm/init.c +++ b/arch/x86/mm/init.c | |||
@@ -35,40 +35,44 @@ struct map_range { | |||
35 | unsigned page_size_mask; | 35 | unsigned page_size_mask; |
36 | }; | 36 | }; |
37 | 37 | ||
38 | static void __init find_early_table_space(struct map_range *mr, unsigned long end, | 38 | /* |
39 | int use_pse, int use_gbpages) | 39 | * First calculate space needed for kernel direct mapping page tables to cover |
40 | * mr[0].start to mr[nr_range - 1].end, while accounting for possible 2M and 1GB | ||
41 | * pages. Then find enough contiguous space for those page tables. | ||
42 | */ | ||
43 | static void __init find_early_table_space(struct map_range *mr, int nr_range) | ||
40 | { | 44 | { |
41 | unsigned long puds, pmds, ptes, tables, start = 0, good_end = end; | 45 | int i; |
46 | unsigned long puds = 0, pmds = 0, ptes = 0, tables; | ||
47 | unsigned long start = 0, good_end; | ||
42 | phys_addr_t base; | 48 | phys_addr_t base; |
43 | 49 | ||
44 | puds = (end + PUD_SIZE - 1) >> PUD_SHIFT; | 50 | for (i = 0; i < nr_range; i++) { |
45 | tables = roundup(puds * sizeof(pud_t), PAGE_SIZE); | 51 | unsigned long range, extra; |
46 | |||
47 | if (use_gbpages) { | ||
48 | unsigned long extra; | ||
49 | |||
50 | extra = end - ((end>>PUD_SHIFT) << PUD_SHIFT); | ||
51 | pmds = (extra + PMD_SIZE - 1) >> PMD_SHIFT; | ||
52 | } else | ||
53 | pmds = (end + PMD_SIZE - 1) >> PMD_SHIFT; | ||
54 | 52 | ||
55 | tables += roundup(pmds * sizeof(pmd_t), PAGE_SIZE); | 53 | range = mr[i].end - mr[i].start; |
54 | puds += (range + PUD_SIZE - 1) >> PUD_SHIFT; | ||
56 | 55 | ||
57 | if (use_pse) { | 56 | if (mr[i].page_size_mask & (1 << PG_LEVEL_1G)) { |
58 | unsigned long extra; | 57 | extra = range - ((range >> PUD_SHIFT) << PUD_SHIFT); |
58 | pmds += (extra + PMD_SIZE - 1) >> PMD_SHIFT; | ||
59 | } else { | ||
60 | pmds += (range + PMD_SIZE - 1) >> PMD_SHIFT; | ||
61 | } | ||
59 | 62 | ||
60 | extra = end - ((end>>PMD_SHIFT) << PMD_SHIFT); | 63 | if (mr[i].page_size_mask & (1 << PG_LEVEL_2M)) { |
64 | extra = range - ((range >> PMD_SHIFT) << PMD_SHIFT); | ||
61 | #ifdef CONFIG_X86_32 | 65 | #ifdef CONFIG_X86_32 |
62 | extra += PMD_SIZE; | 66 | extra += PMD_SIZE; |
63 | #endif | 67 | #endif |
64 | /* The first 2/4M doesn't use large pages. */ | 68 | ptes += (extra + PAGE_SIZE - 1) >> PAGE_SHIFT; |
65 | if (mr->start < PMD_SIZE) | 69 | } else { |
66 | extra += mr->end - mr->start; | 70 | ptes += (range + PAGE_SIZE - 1) >> PAGE_SHIFT; |
67 | 71 | } | |
68 | ptes = (extra + PAGE_SIZE - 1) >> PAGE_SHIFT; | 72 | } |
69 | } else | ||
70 | ptes = (end + PAGE_SIZE - 1) >> PAGE_SHIFT; | ||
71 | 73 | ||
74 | tables = roundup(puds * sizeof(pud_t), PAGE_SIZE); | ||
75 | tables += roundup(pmds * sizeof(pmd_t), PAGE_SIZE); | ||
72 | tables += roundup(ptes * sizeof(pte_t), PAGE_SIZE); | 76 | tables += roundup(ptes * sizeof(pte_t), PAGE_SIZE); |
73 | 77 | ||
74 | #ifdef CONFIG_X86_32 | 78 | #ifdef CONFIG_X86_32 |
@@ -86,7 +90,7 @@ static void __init find_early_table_space(struct map_range *mr, unsigned long en | |||
86 | pgt_buf_top = pgt_buf_start + (tables >> PAGE_SHIFT); | 90 | pgt_buf_top = pgt_buf_start + (tables >> PAGE_SHIFT); |
87 | 91 | ||
88 | printk(KERN_DEBUG "kernel direct mapping tables up to %#lx @ [mem %#010lx-%#010lx]\n", | 92 | printk(KERN_DEBUG "kernel direct mapping tables up to %#lx @ [mem %#010lx-%#010lx]\n", |
89 | end - 1, pgt_buf_start << PAGE_SHIFT, | 93 | mr[nr_range - 1].end - 1, pgt_buf_start << PAGE_SHIFT, |
90 | (pgt_buf_top << PAGE_SHIFT) - 1); | 94 | (pgt_buf_top << PAGE_SHIFT) - 1); |
91 | } | 95 | } |
92 | 96 | ||
@@ -267,7 +271,7 @@ unsigned long __init_refok init_memory_mapping(unsigned long start, | |||
267 | * nodes are discovered. | 271 | * nodes are discovered. |
268 | */ | 272 | */ |
269 | if (!after_bootmem) | 273 | if (!after_bootmem) |
270 | find_early_table_space(&mr[0], end, use_pse, use_gbpages); | 274 | find_early_table_space(mr, nr_range); |
271 | 275 | ||
272 | for (i = 0; i < nr_range; i++) | 276 | for (i = 0; i < nr_range; i++) |
273 | ret = kernel_physical_mapping_init(mr[i].start, mr[i].end, | 277 | ret = kernel_physical_mapping_init(mr[i].start, mr[i].end, |
diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c index 2b6b4a3c8beb..3baff255adac 100644 --- a/arch/x86/mm/init_64.c +++ b/arch/x86/mm/init_64.c | |||
@@ -386,7 +386,8 @@ phys_pte_init(pte_t *pte_page, unsigned long addr, unsigned long end, | |||
386 | * these mappings are more intelligent. | 386 | * these mappings are more intelligent. |
387 | */ | 387 | */ |
388 | if (pte_val(*pte)) { | 388 | if (pte_val(*pte)) { |
389 | pages++; | 389 | if (!after_bootmem) |
390 | pages++; | ||
390 | continue; | 391 | continue; |
391 | } | 392 | } |
392 | 393 | ||
@@ -451,6 +452,8 @@ phys_pmd_init(pmd_t *pmd_page, unsigned long address, unsigned long end, | |||
451 | * attributes. | 452 | * attributes. |
452 | */ | 453 | */ |
453 | if (page_size_mask & (1 << PG_LEVEL_2M)) { | 454 | if (page_size_mask & (1 << PG_LEVEL_2M)) { |
455 | if (!after_bootmem) | ||
456 | pages++; | ||
454 | last_map_addr = next; | 457 | last_map_addr = next; |
455 | continue; | 458 | continue; |
456 | } | 459 | } |
@@ -526,6 +529,8 @@ phys_pud_init(pud_t *pud_page, unsigned long addr, unsigned long end, | |||
526 | * attributes. | 529 | * attributes. |
527 | */ | 530 | */ |
528 | if (page_size_mask & (1 << PG_LEVEL_1G)) { | 531 | if (page_size_mask & (1 << PG_LEVEL_1G)) { |
532 | if (!after_bootmem) | ||
533 | pages++; | ||
529 | last_map_addr = next; | 534 | last_map_addr = next; |
530 | continue; | 535 | continue; |
531 | } | 536 | } |
diff --git a/arch/x86/oprofile/nmi_int.c b/arch/x86/oprofile/nmi_int.c index 26b8a8514ee5..48768df2471a 100644 --- a/arch/x86/oprofile/nmi_int.c +++ b/arch/x86/oprofile/nmi_int.c | |||
@@ -55,7 +55,7 @@ u64 op_x86_get_ctrl(struct op_x86_model_spec const *model, | |||
55 | val |= counter_config->extra; | 55 | val |= counter_config->extra; |
56 | event &= model->event_mask ? model->event_mask : 0xFF; | 56 | event &= model->event_mask ? model->event_mask : 0xFF; |
57 | val |= event & 0xFF; | 57 | val |= event & 0xFF; |
58 | val |= (event & 0x0F00) << 24; | 58 | val |= (u64)(event & 0x0F00) << 24; |
59 | 59 | ||
60 | return val; | 60 | return val; |
61 | } | 61 | } |
diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c index aded2a91162a..ad4439145f85 100644 --- a/arch/x86/platform/efi/efi.c +++ b/arch/x86/platform/efi/efi.c | |||
@@ -70,11 +70,15 @@ EXPORT_SYMBOL(efi); | |||
70 | struct efi_memory_map memmap; | 70 | struct efi_memory_map memmap; |
71 | 71 | ||
72 | bool efi_64bit; | 72 | bool efi_64bit; |
73 | static bool efi_native; | ||
74 | 73 | ||
75 | static struct efi efi_phys __initdata; | 74 | static struct efi efi_phys __initdata; |
76 | static efi_system_table_t efi_systab __initdata; | 75 | static efi_system_table_t efi_systab __initdata; |
77 | 76 | ||
77 | static inline bool efi_is_native(void) | ||
78 | { | ||
79 | return IS_ENABLED(CONFIG_X86_64) == efi_64bit; | ||
80 | } | ||
81 | |||
78 | static int __init setup_noefi(char *arg) | 82 | static int __init setup_noefi(char *arg) |
79 | { | 83 | { |
80 | efi_enabled = 0; | 84 | efi_enabled = 0; |
@@ -420,7 +424,7 @@ void __init efi_reserve_boot_services(void) | |||
420 | } | 424 | } |
421 | } | 425 | } |
422 | 426 | ||
423 | static void __init efi_unmap_memmap(void) | 427 | void __init efi_unmap_memmap(void) |
424 | { | 428 | { |
425 | if (memmap.map) { | 429 | if (memmap.map) { |
426 | early_iounmap(memmap.map, memmap.nr_map * memmap.desc_size); | 430 | early_iounmap(memmap.map, memmap.nr_map * memmap.desc_size); |
@@ -432,7 +436,7 @@ void __init efi_free_boot_services(void) | |||
432 | { | 436 | { |
433 | void *p; | 437 | void *p; |
434 | 438 | ||
435 | if (!efi_native) | 439 | if (!efi_is_native()) |
436 | return; | 440 | return; |
437 | 441 | ||
438 | for (p = memmap.map; p < memmap.map_end; p += memmap.desc_size) { | 442 | for (p = memmap.map; p < memmap.map_end; p += memmap.desc_size) { |
@@ -684,12 +688,10 @@ void __init efi_init(void) | |||
684 | return; | 688 | return; |
685 | } | 689 | } |
686 | efi_phys.systab = (efi_system_table_t *)boot_params.efi_info.efi_systab; | 690 | efi_phys.systab = (efi_system_table_t *)boot_params.efi_info.efi_systab; |
687 | efi_native = !efi_64bit; | ||
688 | #else | 691 | #else |
689 | efi_phys.systab = (efi_system_table_t *) | 692 | efi_phys.systab = (efi_system_table_t *) |
690 | (boot_params.efi_info.efi_systab | | 693 | (boot_params.efi_info.efi_systab | |
691 | ((__u64)boot_params.efi_info.efi_systab_hi<<32)); | 694 | ((__u64)boot_params.efi_info.efi_systab_hi<<32)); |
692 | efi_native = efi_64bit; | ||
693 | #endif | 695 | #endif |
694 | 696 | ||
695 | if (efi_systab_init(efi_phys.systab)) { | 697 | if (efi_systab_init(efi_phys.systab)) { |
@@ -723,7 +725,7 @@ void __init efi_init(void) | |||
723 | * that doesn't match the kernel 32/64-bit mode. | 725 | * that doesn't match the kernel 32/64-bit mode. |
724 | */ | 726 | */ |
725 | 727 | ||
726 | if (!efi_native) | 728 | if (!efi_is_native()) |
727 | pr_info("No EFI runtime due to 32/64-bit mismatch with kernel\n"); | 729 | pr_info("No EFI runtime due to 32/64-bit mismatch with kernel\n"); |
728 | else if (efi_runtime_init()) { | 730 | else if (efi_runtime_init()) { |
729 | efi_enabled = 0; | 731 | efi_enabled = 0; |
@@ -735,7 +737,7 @@ void __init efi_init(void) | |||
735 | return; | 737 | return; |
736 | } | 738 | } |
737 | #ifdef CONFIG_X86_32 | 739 | #ifdef CONFIG_X86_32 |
738 | if (efi_native) { | 740 | if (efi_is_native()) { |
739 | x86_platform.get_wallclock = efi_get_time; | 741 | x86_platform.get_wallclock = efi_get_time; |
740 | x86_platform.set_wallclock = efi_set_rtc_mmss; | 742 | x86_platform.set_wallclock = efi_set_rtc_mmss; |
741 | } | 743 | } |
@@ -810,6 +812,16 @@ void __iomem *efi_lookup_mapped_addr(u64 phys_addr) | |||
810 | return NULL; | 812 | return NULL; |
811 | } | 813 | } |
812 | 814 | ||
815 | void efi_memory_uc(u64 addr, unsigned long size) | ||
816 | { | ||
817 | unsigned long page_shift = 1UL << EFI_PAGE_SHIFT; | ||
818 | u64 npages; | ||
819 | |||
820 | npages = round_up(size, page_shift) / page_shift; | ||
821 | memrange_efi_to_native(&addr, &npages); | ||
822 | set_memory_uc(addr, npages); | ||
823 | } | ||
824 | |||
813 | /* | 825 | /* |
814 | * This function will switch the EFI runtime services to virtual mode. | 826 | * This function will switch the EFI runtime services to virtual mode. |
815 | * Essentially, look through the EFI memmap and map every region that | 827 | * Essentially, look through the EFI memmap and map every region that |
@@ -823,7 +835,7 @@ void __init efi_enter_virtual_mode(void) | |||
823 | efi_memory_desc_t *md, *prev_md = NULL; | 835 | efi_memory_desc_t *md, *prev_md = NULL; |
824 | efi_status_t status; | 836 | efi_status_t status; |
825 | unsigned long size; | 837 | unsigned long size; |
826 | u64 end, systab, addr, npages, end_pfn; | 838 | u64 end, systab, end_pfn; |
827 | void *p, *va, *new_memmap = NULL; | 839 | void *p, *va, *new_memmap = NULL; |
828 | int count = 0; | 840 | int count = 0; |
829 | 841 | ||
@@ -834,7 +846,7 @@ void __init efi_enter_virtual_mode(void) | |||
834 | * non-native EFI | 846 | * non-native EFI |
835 | */ | 847 | */ |
836 | 848 | ||
837 | if (!efi_native) { | 849 | if (!efi_is_native()) { |
838 | efi_unmap_memmap(); | 850 | efi_unmap_memmap(); |
839 | return; | 851 | return; |
840 | } | 852 | } |
@@ -879,10 +891,14 @@ void __init efi_enter_virtual_mode(void) | |||
879 | end_pfn = PFN_UP(end); | 891 | end_pfn = PFN_UP(end); |
880 | if (end_pfn <= max_low_pfn_mapped | 892 | if (end_pfn <= max_low_pfn_mapped |
881 | || (end_pfn > (1UL << (32 - PAGE_SHIFT)) | 893 | || (end_pfn > (1UL << (32 - PAGE_SHIFT)) |
882 | && end_pfn <= max_pfn_mapped)) | 894 | && end_pfn <= max_pfn_mapped)) { |
883 | va = __va(md->phys_addr); | 895 | va = __va(md->phys_addr); |
884 | else | 896 | |
885 | va = efi_ioremap(md->phys_addr, size, md->type); | 897 | if (!(md->attribute & EFI_MEMORY_WB)) |
898 | efi_memory_uc((u64)(unsigned long)va, size); | ||
899 | } else | ||
900 | va = efi_ioremap(md->phys_addr, size, | ||
901 | md->type, md->attribute); | ||
886 | 902 | ||
887 | md->virt_addr = (u64) (unsigned long) va; | 903 | md->virt_addr = (u64) (unsigned long) va; |
888 | 904 | ||
@@ -892,13 +908,6 @@ void __init efi_enter_virtual_mode(void) | |||
892 | continue; | 908 | continue; |
893 | } | 909 | } |
894 | 910 | ||
895 | if (!(md->attribute & EFI_MEMORY_WB)) { | ||
896 | addr = md->virt_addr; | ||
897 | npages = md->num_pages; | ||
898 | memrange_efi_to_native(&addr, &npages); | ||
899 | set_memory_uc(addr, npages); | ||
900 | } | ||
901 | |||
902 | systab = (u64) (unsigned long) efi_phys.systab; | 911 | systab = (u64) (unsigned long) efi_phys.systab; |
903 | if (md->phys_addr <= systab && systab < end) { | 912 | if (md->phys_addr <= systab && systab < end) { |
904 | systab += md->virt_addr - md->phys_addr; | 913 | systab += md->virt_addr - md->phys_addr; |
diff --git a/arch/x86/platform/efi/efi_64.c b/arch/x86/platform/efi/efi_64.c index ac3aa54e2654..95fd505dfeb6 100644 --- a/arch/x86/platform/efi/efi_64.c +++ b/arch/x86/platform/efi/efi_64.c | |||
@@ -82,7 +82,7 @@ void __init efi_call_phys_epilog(void) | |||
82 | } | 82 | } |
83 | 83 | ||
84 | void __iomem *__init efi_ioremap(unsigned long phys_addr, unsigned long size, | 84 | void __iomem *__init efi_ioremap(unsigned long phys_addr, unsigned long size, |
85 | u32 type) | 85 | u32 type, u64 attribute) |
86 | { | 86 | { |
87 | unsigned long last_map_pfn; | 87 | unsigned long last_map_pfn; |
88 | 88 | ||
@@ -92,8 +92,11 @@ void __iomem *__init efi_ioremap(unsigned long phys_addr, unsigned long size, | |||
92 | last_map_pfn = init_memory_mapping(phys_addr, phys_addr + size); | 92 | last_map_pfn = init_memory_mapping(phys_addr, phys_addr + size); |
93 | if ((last_map_pfn << PAGE_SHIFT) < phys_addr + size) { | 93 | if ((last_map_pfn << PAGE_SHIFT) < phys_addr + size) { |
94 | unsigned long top = last_map_pfn << PAGE_SHIFT; | 94 | unsigned long top = last_map_pfn << PAGE_SHIFT; |
95 | efi_ioremap(top, size - (top - phys_addr), type); | 95 | efi_ioremap(top, size - (top - phys_addr), type, attribute); |
96 | } | 96 | } |
97 | 97 | ||
98 | if (!(attribute & EFI_MEMORY_WB)) | ||
99 | efi_memory_uc((u64)(unsigned long)__va(phys_addr), size); | ||
100 | |||
98 | return (void __iomem *)__va(phys_addr); | 101 | return (void __iomem *)__va(phys_addr); |
99 | } | 102 | } |
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c index e3497f240eab..586d83812b67 100644 --- a/arch/x86/xen/enlighten.c +++ b/arch/x86/xen/enlighten.c | |||
@@ -81,8 +81,6 @@ | |||
81 | #include "smp.h" | 81 | #include "smp.h" |
82 | #include "multicalls.h" | 82 | #include "multicalls.h" |
83 | 83 | ||
84 | #include <xen/events.h> | ||
85 | |||
86 | EXPORT_SYMBOL_GPL(hypercall_page); | 84 | EXPORT_SYMBOL_GPL(hypercall_page); |
87 | 85 | ||
88 | DEFINE_PER_CPU(struct vcpu_info *, xen_vcpu); | 86 | DEFINE_PER_CPU(struct vcpu_info *, xen_vcpu); |
diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c index 6226c99729b9..dcf5f2dd91ec 100644 --- a/arch/x86/xen/mmu.c +++ b/arch/x86/xen/mmu.c | |||
@@ -1288,6 +1288,25 @@ unsigned long xen_read_cr2_direct(void) | |||
1288 | return this_cpu_read(xen_vcpu_info.arch.cr2); | 1288 | return this_cpu_read(xen_vcpu_info.arch.cr2); |
1289 | } | 1289 | } |
1290 | 1290 | ||
1291 | void xen_flush_tlb_all(void) | ||
1292 | { | ||
1293 | struct mmuext_op *op; | ||
1294 | struct multicall_space mcs; | ||
1295 | |||
1296 | trace_xen_mmu_flush_tlb_all(0); | ||
1297 | |||
1298 | preempt_disable(); | ||
1299 | |||
1300 | mcs = xen_mc_entry(sizeof(*op)); | ||
1301 | |||
1302 | op = mcs.args; | ||
1303 | op->cmd = MMUEXT_TLB_FLUSH_ALL; | ||
1304 | MULTI_mmuext_op(mcs.mc, op, 1, NULL, DOMID_SELF); | ||
1305 | |||
1306 | xen_mc_issue(PARAVIRT_LAZY_MMU); | ||
1307 | |||
1308 | preempt_enable(); | ||
1309 | } | ||
1291 | static void xen_flush_tlb(void) | 1310 | static void xen_flush_tlb(void) |
1292 | { | 1311 | { |
1293 | struct mmuext_op *op; | 1312 | struct mmuext_op *op; |
@@ -2518,7 +2537,7 @@ int xen_remap_domain_mfn_range(struct vm_area_struct *vma, | |||
2518 | err = 0; | 2537 | err = 0; |
2519 | out: | 2538 | out: |
2520 | 2539 | ||
2521 | flush_tlb_all(); | 2540 | xen_flush_tlb_all(); |
2522 | 2541 | ||
2523 | return err; | 2542 | return err; |
2524 | } | 2543 | } |
diff --git a/arch/xtensa/Kconfig b/arch/xtensa/Kconfig index cdcb48adee4c..0d1f36a22c98 100644 --- a/arch/xtensa/Kconfig +++ b/arch/xtensa/Kconfig | |||
@@ -13,6 +13,8 @@ config XTENSA | |||
13 | select GENERIC_CPU_DEVICES | 13 | select GENERIC_CPU_DEVICES |
14 | select MODULES_USE_ELF_RELA | 14 | select MODULES_USE_ELF_RELA |
15 | select GENERIC_PCI_IOMAP | 15 | select GENERIC_PCI_IOMAP |
16 | select GENERIC_KERNEL_THREAD | ||
17 | select GENERIC_KERNEL_EXECVE | ||
16 | select ARCH_WANT_OPTIONAL_GPIOLIB | 18 | select ARCH_WANT_OPTIONAL_GPIOLIB |
17 | help | 19 | help |
18 | Xtensa processors are 32-bit RISC machines designed by Tensilica | 20 | Xtensa processors are 32-bit RISC machines designed by Tensilica |
diff --git a/arch/xtensa/include/asm/io.h b/arch/xtensa/include/asm/io.h index e6be5b9091c2..700c2e6f2d25 100644 --- a/arch/xtensa/include/asm/io.h +++ b/arch/xtensa/include/asm/io.h | |||
@@ -62,6 +62,10 @@ static inline void __iomem *ioremap(unsigned long offset, unsigned long size) | |||
62 | static inline void iounmap(volatile void __iomem *addr) | 62 | static inline void iounmap(volatile void __iomem *addr) |
63 | { | 63 | { |
64 | } | 64 | } |
65 | |||
66 | #define virt_to_bus virt_to_phys | ||
67 | #define bus_to_virt phys_to_virt | ||
68 | |||
65 | #endif /* CONFIG_MMU */ | 69 | #endif /* CONFIG_MMU */ |
66 | 70 | ||
67 | /* | 71 | /* |
diff --git a/arch/xtensa/include/asm/processor.h b/arch/xtensa/include/asm/processor.h index 5c371d8d4528..2d630e7399ca 100644 --- a/arch/xtensa/include/asm/processor.h +++ b/arch/xtensa/include/asm/processor.h | |||
@@ -152,6 +152,7 @@ struct thread_struct { | |||
152 | 152 | ||
153 | /* Clearing a0 terminates the backtrace. */ | 153 | /* Clearing a0 terminates the backtrace. */ |
154 | #define start_thread(regs, new_pc, new_sp) \ | 154 | #define start_thread(regs, new_pc, new_sp) \ |
155 | memset(regs, 0, sizeof(*regs)); \ | ||
155 | regs->pc = new_pc; \ | 156 | regs->pc = new_pc; \ |
156 | regs->ps = USER_PS_VALUE; \ | 157 | regs->ps = USER_PS_VALUE; \ |
157 | regs->areg[1] = new_sp; \ | 158 | regs->areg[1] = new_sp; \ |
@@ -168,9 +169,6 @@ struct mm_struct; | |||
168 | /* Free all resources held by a thread. */ | 169 | /* Free all resources held by a thread. */ |
169 | #define release_thread(thread) do { } while(0) | 170 | #define release_thread(thread) do { } while(0) |
170 | 171 | ||
171 | /* Create a kernel thread without removing it from tasklists */ | ||
172 | extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags); | ||
173 | |||
174 | /* Copy and release all segment info associated with a VM */ | 172 | /* Copy and release all segment info associated with a VM */ |
175 | #define copy_segments(p, mm) do { } while(0) | 173 | #define copy_segments(p, mm) do { } while(0) |
176 | #define release_segments(mm) do { } while(0) | 174 | #define release_segments(mm) do { } while(0) |
diff --git a/arch/xtensa/include/asm/syscall.h b/arch/xtensa/include/asm/syscall.h index c1dacca312f3..124aeee0d381 100644 --- a/arch/xtensa/include/asm/syscall.h +++ b/arch/xtensa/include/asm/syscall.h | |||
@@ -10,7 +10,7 @@ | |||
10 | 10 | ||
11 | struct pt_regs; | 11 | struct pt_regs; |
12 | struct sigaction; | 12 | struct sigaction; |
13 | asmlinkage long xtensa_execve(char*, char**, char**, struct pt_regs*); | 13 | asmlinkage long sys_execve(char*, char**, char**, struct pt_regs*); |
14 | asmlinkage long xtensa_clone(unsigned long, unsigned long, struct pt_regs*); | 14 | asmlinkage long xtensa_clone(unsigned long, unsigned long, struct pt_regs*); |
15 | asmlinkage long xtensa_ptrace(long, long, long, long); | 15 | asmlinkage long xtensa_ptrace(long, long, long, long); |
16 | asmlinkage long xtensa_sigreturn(struct pt_regs*); | 16 | asmlinkage long xtensa_sigreturn(struct pt_regs*); |
diff --git a/arch/xtensa/include/asm/unistd.h b/arch/xtensa/include/asm/unistd.h index 9ef1c31d2c83..f4e6eaa40d1c 100644 --- a/arch/xtensa/include/asm/unistd.h +++ b/arch/xtensa/include/asm/unistd.h | |||
@@ -1,16 +1,9 @@ | |||
1 | /* | 1 | #ifndef _XTENSA_UNISTD_H |
2 | * include/asm-xtensa/unistd.h | 2 | #define _XTENSA_UNISTD_H |
3 | * | ||
4 | * This file is subject to the terms and conditions of the GNU General Public | ||
5 | * License. See the file "COPYING" in the main directory of this archive | ||
6 | * for more details. | ||
7 | * | ||
8 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
9 | */ | ||
10 | 3 | ||
4 | #define __ARCH_WANT_SYS_EXECVE | ||
11 | #include <uapi/asm/unistd.h> | 5 | #include <uapi/asm/unistd.h> |
12 | 6 | ||
13 | |||
14 | /* | 7 | /* |
15 | * "Conditional" syscalls | 8 | * "Conditional" syscalls |
16 | * | 9 | * |
@@ -37,3 +30,5 @@ | |||
37 | #define __IGNORE_mmap /* use mmap2 */ | 30 | #define __IGNORE_mmap /* use mmap2 */ |
38 | #define __IGNORE_vfork /* use clone */ | 31 | #define __IGNORE_vfork /* use clone */ |
39 | #define __IGNORE_fadvise64 /* use fadvise64_64 */ | 32 | #define __IGNORE_fadvise64 /* use fadvise64_64 */ |
33 | |||
34 | #endif /* _XTENSA_UNISTD_H */ | ||
diff --git a/arch/xtensa/include/uapi/asm/unistd.h b/arch/xtensa/include/uapi/asm/unistd.h index 479abaea5aae..9f36d0e3e0ac 100644 --- a/arch/xtensa/include/uapi/asm/unistd.h +++ b/arch/xtensa/include/uapi/asm/unistd.h | |||
@@ -1,14 +1,4 @@ | |||
1 | /* | 1 | #if !defined(_UAPI_XTENSA_UNISTD_H) || defined(__SYSCALL) |
2 | * include/asm-xtensa/unistd.h | ||
3 | * | ||
4 | * This file is subject to the terms and conditions of the GNU General Public | ||
5 | * License. See the file "COPYING" in the main directory of this archive | ||
6 | * for more details. | ||
7 | * | ||
8 | * Copyright (C) 2001 - 2012 Tensilica Inc. | ||
9 | */ | ||
10 | |||
11 | #ifndef _UAPI_XTENSA_UNISTD_H | ||
12 | #define _UAPI_XTENSA_UNISTD_H | 2 | #define _UAPI_XTENSA_UNISTD_H |
13 | 3 | ||
14 | #ifndef __SYSCALL | 4 | #ifndef __SYSCALL |
@@ -272,7 +262,7 @@ __SYSCALL(115, sys_sendmmsg, 4) | |||
272 | #define __NR_clone 116 | 262 | #define __NR_clone 116 |
273 | __SYSCALL(116, xtensa_clone, 5) | 263 | __SYSCALL(116, xtensa_clone, 5) |
274 | #define __NR_execve 117 | 264 | #define __NR_execve 117 |
275 | __SYSCALL(117, xtensa_execve, 3) | 265 | __SYSCALL(117, sys_execve, 3) |
276 | #define __NR_exit 118 | 266 | #define __NR_exit 118 |
277 | __SYSCALL(118, sys_exit, 1) | 267 | __SYSCALL(118, sys_exit, 1) |
278 | #define __NR_exit_group 119 | 268 | #define __NR_exit_group 119 |
@@ -759,4 +749,6 @@ __SYSCALL(331, sys_kcmp, 5) | |||
759 | 749 | ||
760 | #define SYS_XTENSA_COUNT 5 /* count */ | 750 | #define SYS_XTENSA_COUNT 5 /* count */ |
761 | 751 | ||
752 | #undef __SYSCALL | ||
753 | |||
762 | #endif /* _UAPI_XTENSA_UNISTD_H */ | 754 | #endif /* _UAPI_XTENSA_UNISTD_H */ |
diff --git a/arch/xtensa/kernel/entry.S b/arch/xtensa/kernel/entry.S index 18453067c258..90bfc1dbc13d 100644 --- a/arch/xtensa/kernel/entry.S +++ b/arch/xtensa/kernel/entry.S | |||
@@ -1833,50 +1833,6 @@ ENTRY(system_call) | |||
1833 | 1833 | ||
1834 | 1834 | ||
1835 | /* | 1835 | /* |
1836 | * Create a kernel thread | ||
1837 | * | ||
1838 | * int kernel_thread(int (*fn)(void *), void *arg, unsigned long flags) | ||
1839 | * a2 a2 a3 a4 | ||
1840 | */ | ||
1841 | |||
1842 | ENTRY(kernel_thread) | ||
1843 | entry a1, 16 | ||
1844 | |||
1845 | mov a5, a2 # preserve fn over syscall | ||
1846 | mov a7, a3 # preserve args over syscall | ||
1847 | |||
1848 | movi a3, _CLONE_VM | _CLONE_UNTRACED | ||
1849 | movi a2, __NR_clone | ||
1850 | or a6, a4, a3 # arg0: flags | ||
1851 | mov a3, a1 # arg1: sp | ||
1852 | syscall | ||
1853 | |||
1854 | beq a3, a1, 1f # branch if parent | ||
1855 | mov a6, a7 # args | ||
1856 | callx4 a5 # fn(args) | ||
1857 | |||
1858 | movi a2, __NR_exit | ||
1859 | syscall # return value of fn(args) still in a6 | ||
1860 | |||
1861 | 1: retw | ||
1862 | |||
1863 | /* | ||
1864 | * Do a system call from kernel instead of calling sys_execve, so we end up | ||
1865 | * with proper pt_regs. | ||
1866 | * | ||
1867 | * int kernel_execve(const char *fname, char *const argv[], charg *const envp[]) | ||
1868 | * a2 a2 a3 a4 | ||
1869 | */ | ||
1870 | |||
1871 | ENTRY(kernel_execve) | ||
1872 | entry a1, 16 | ||
1873 | mov a6, a2 # arg0 is in a6 | ||
1874 | movi a2, __NR_execve | ||
1875 | syscall | ||
1876 | |||
1877 | retw | ||
1878 | |||
1879 | /* | ||
1880 | * Task switch. | 1836 | * Task switch. |
1881 | * | 1837 | * |
1882 | * struct task* _switch_to (struct task* prev, struct task* next) | 1838 | * struct task* _switch_to (struct task* prev, struct task* next) |
@@ -1958,3 +1914,16 @@ ENTRY(ret_from_fork) | |||
1958 | 1914 | ||
1959 | j common_exception_return | 1915 | j common_exception_return |
1960 | 1916 | ||
1917 | /* | ||
1918 | * Kernel thread creation helper | ||
1919 | * On entry, set up by copy_thread: a2 = thread_fn, a3 = thread_fn arg | ||
1920 | * left from _switch_to: a6 = prev | ||
1921 | */ | ||
1922 | ENTRY(ret_from_kernel_thread) | ||
1923 | |||
1924 | call4 schedule_tail | ||
1925 | mov a6, a3 | ||
1926 | callx4 a2 | ||
1927 | j common_exception_return | ||
1928 | |||
1929 | ENDPROC(ret_from_kernel_thread) | ||
diff --git a/arch/xtensa/kernel/process.c b/arch/xtensa/kernel/process.c index 1908f6642d31..09ae7bfab9a7 100644 --- a/arch/xtensa/kernel/process.c +++ b/arch/xtensa/kernel/process.c | |||
@@ -45,6 +45,7 @@ | |||
45 | #include <asm/regs.h> | 45 | #include <asm/regs.h> |
46 | 46 | ||
47 | extern void ret_from_fork(void); | 47 | extern void ret_from_fork(void); |
48 | extern void ret_from_kernel_thread(void); | ||
48 | 49 | ||
49 | struct task_struct *current_set[NR_CPUS] = {&init_task, }; | 50 | struct task_struct *current_set[NR_CPUS] = {&init_task, }; |
50 | 51 | ||
@@ -158,18 +159,30 @@ int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src) | |||
158 | /* | 159 | /* |
159 | * Copy thread. | 160 | * Copy thread. |
160 | * | 161 | * |
162 | * There are two modes in which this function is called: | ||
163 | * 1) Userspace thread creation, | ||
164 | * regs != NULL, usp_thread_fn is userspace stack pointer. | ||
165 | * It is expected to copy parent regs (in case CLONE_VM is not set | ||
166 | * in the clone_flags) and set up passed usp in the childregs. | ||
167 | * 2) Kernel thread creation, | ||
168 | * regs == NULL, usp_thread_fn is the function to run in the new thread | ||
169 | * and thread_fn_arg is its parameter. | ||
170 | * childregs are not used for the kernel threads. | ||
171 | * | ||
161 | * The stack layout for the new thread looks like this: | 172 | * The stack layout for the new thread looks like this: |
162 | * | 173 | * |
163 | * +------------------------+ <- sp in childregs (= tos) | 174 | * +------------------------+ |
164 | * | childregs | | 175 | * | childregs | |
165 | * +------------------------+ <- thread.sp = sp in dummy-frame | 176 | * +------------------------+ <- thread.sp = sp in dummy-frame |
166 | * | dummy-frame | (saved in dummy-frame spill-area) | 177 | * | dummy-frame | (saved in dummy-frame spill-area) |
167 | * +------------------------+ | 178 | * +------------------------+ |
168 | * | 179 | * |
169 | * We create a dummy frame to return to ret_from_fork: | 180 | * We create a dummy frame to return to either ret_from_fork or |
170 | * a0 points to ret_from_fork (simulating a call4) | 181 | * ret_from_kernel_thread: |
182 | * a0 points to ret_from_fork/ret_from_kernel_thread (simulating a call4) | ||
171 | * sp points to itself (thread.sp) | 183 | * sp points to itself (thread.sp) |
172 | * a2, a3 are unused. | 184 | * a2, a3 are unused for userspace threads, |
185 | * a2 points to thread_fn, a3 holds thread_fn arg for kernel threads. | ||
173 | * | 186 | * |
174 | * Note: This is a pristine frame, so we don't need any spill region on top of | 187 | * Note: This is a pristine frame, so we don't need any spill region on top of |
175 | * childregs. | 188 | * childregs. |
@@ -185,43 +198,63 @@ int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src) | |||
185 | * involved. Much simpler to just not copy those live frames across. | 198 | * involved. Much simpler to just not copy those live frames across. |
186 | */ | 199 | */ |
187 | 200 | ||
188 | int copy_thread(unsigned long clone_flags, unsigned long usp, | 201 | int copy_thread(unsigned long clone_flags, unsigned long usp_thread_fn, |
189 | unsigned long unused, | 202 | unsigned long thread_fn_arg, |
190 | struct task_struct * p, struct pt_regs * regs) | 203 | struct task_struct *p, struct pt_regs *unused) |
191 | { | 204 | { |
192 | struct pt_regs *childregs; | 205 | struct pt_regs *childregs = task_pt_regs(p); |
193 | unsigned long tos; | ||
194 | int user_mode = user_mode(regs); | ||
195 | 206 | ||
196 | #if (XTENSA_HAVE_COPROCESSORS || XTENSA_HAVE_IO_PORTS) | 207 | #if (XTENSA_HAVE_COPROCESSORS || XTENSA_HAVE_IO_PORTS) |
197 | struct thread_info *ti; | 208 | struct thread_info *ti; |
198 | #endif | 209 | #endif |
199 | 210 | ||
200 | /* Set up new TSS. */ | ||
201 | tos = (unsigned long)task_stack_page(p) + THREAD_SIZE; | ||
202 | if (user_mode) | ||
203 | childregs = (struct pt_regs*)(tos - PT_USER_SIZE); | ||
204 | else | ||
205 | childregs = (struct pt_regs*)tos - 1; | ||
206 | |||
207 | /* This does not copy all the regs. In a bout of brilliance or madness, | ||
208 | ARs beyond a0-a15 exist past the end of the struct. */ | ||
209 | *childregs = *regs; | ||
210 | |||
211 | /* Create a call4 dummy-frame: a0 = 0, a1 = childregs. */ | 211 | /* Create a call4 dummy-frame: a0 = 0, a1 = childregs. */ |
212 | *((int*)childregs - 3) = (unsigned long)childregs; | 212 | *((int*)childregs - 3) = (unsigned long)childregs; |
213 | *((int*)childregs - 4) = 0; | 213 | *((int*)childregs - 4) = 0; |
214 | 214 | ||
215 | childregs->areg[2] = 0; | ||
216 | p->set_child_tid = p->clear_child_tid = NULL; | ||
217 | p->thread.ra = MAKE_RA_FOR_CALL((unsigned long)ret_from_fork, 0x1); | ||
218 | p->thread.sp = (unsigned long)childregs; | 215 | p->thread.sp = (unsigned long)childregs; |
219 | 216 | ||
220 | if (user_mode(regs)) { | 217 | if (!(p->flags & PF_KTHREAD)) { |
218 | struct pt_regs *regs = current_pt_regs(); | ||
219 | unsigned long usp = usp_thread_fn ? | ||
220 | usp_thread_fn : regs->areg[1]; | ||
221 | 221 | ||
222 | p->thread.ra = MAKE_RA_FOR_CALL( | ||
223 | (unsigned long)ret_from_fork, 0x1); | ||
224 | |||
225 | /* This does not copy all the regs. | ||
226 | * In a bout of brilliance or madness, | ||
227 | * ARs beyond a0-a15 exist past the end of the struct. | ||
228 | */ | ||
229 | *childregs = *regs; | ||
222 | childregs->areg[1] = usp; | 230 | childregs->areg[1] = usp; |
231 | childregs->areg[2] = 0; | ||
232 | |||
233 | /* When sharing memory with the parent thread, the child | ||
234 | usually starts on a pristine stack, so we have to reset | ||
235 | windowbase, windowstart and wmask. | ||
236 | (Note that such a new thread is required to always create | ||
237 | an initial call4 frame) | ||
238 | The exception is vfork, where the new thread continues to | ||
239 | run on the parent's stack until it calls execve. This could | ||
240 | be a call8 or call12, which requires a legal stack frame | ||
241 | of the previous caller for the overflow handlers to work. | ||
242 | (Note that it's always legal to overflow live registers). | ||
243 | In this case, ensure to spill at least the stack pointer | ||
244 | of that frame. */ | ||
245 | |||
223 | if (clone_flags & CLONE_VM) { | 246 | if (clone_flags & CLONE_VM) { |
224 | childregs->wmask = 1; /* can't share live windows */ | 247 | /* check that caller window is live and same stack */ |
248 | int len = childregs->wmask & ~0xf; | ||
249 | if (regs->areg[1] == usp && len != 0) { | ||
250 | int callinc = (regs->areg[0] >> 30) & 3; | ||
251 | int caller_ars = XCHAL_NUM_AREGS - callinc * 4; | ||
252 | put_user(regs->areg[caller_ars+1], | ||
253 | (unsigned __user*)(usp - 12)); | ||
254 | } | ||
255 | childregs->wmask = 1; | ||
256 | childregs->windowstart = 1; | ||
257 | childregs->windowbase = 0; | ||
225 | } else { | 258 | } else { |
226 | int len = childregs->wmask & ~0xf; | 259 | int len = childregs->wmask & ~0xf; |
227 | memcpy(&childregs->areg[XCHAL_NUM_AREGS - len/4], | 260 | memcpy(&childregs->areg[XCHAL_NUM_AREGS - len/4], |
@@ -230,11 +263,19 @@ int copy_thread(unsigned long clone_flags, unsigned long usp, | |||
230 | // FIXME: we need to set THREADPTR in thread_info... | 263 | // FIXME: we need to set THREADPTR in thread_info... |
231 | if (clone_flags & CLONE_SETTLS) | 264 | if (clone_flags & CLONE_SETTLS) |
232 | childregs->areg[2] = childregs->areg[6]; | 265 | childregs->areg[2] = childregs->areg[6]; |
233 | |||
234 | } else { | 266 | } else { |
235 | /* In kernel space, we start a new thread with a new stack. */ | 267 | p->thread.ra = MAKE_RA_FOR_CALL( |
236 | childregs->wmask = 1; | 268 | (unsigned long)ret_from_kernel_thread, 1); |
237 | childregs->areg[1] = tos; | 269 | |
270 | /* pass parameters to ret_from_kernel_thread: | ||
271 | * a2 = thread_fn, a3 = thread_fn arg | ||
272 | */ | ||
273 | *((int *)childregs - 1) = thread_fn_arg; | ||
274 | *((int *)childregs - 2) = usp_thread_fn; | ||
275 | |||
276 | /* Childregs are only used when we're going to userspace | ||
277 | * in which case start_thread will set them up. | ||
278 | */ | ||
238 | } | 279 | } |
239 | 280 | ||
240 | #if (XTENSA_HAVE_COPROCESSORS || XTENSA_HAVE_IO_PORTS) | 281 | #if (XTENSA_HAVE_COPROCESSORS || XTENSA_HAVE_IO_PORTS) |
@@ -330,32 +371,5 @@ long xtensa_clone(unsigned long clone_flags, unsigned long newsp, | |||
330 | void __user *child_tid, long a5, | 371 | void __user *child_tid, long a5, |
331 | struct pt_regs *regs) | 372 | struct pt_regs *regs) |
332 | { | 373 | { |
333 | if (!newsp) | ||
334 | newsp = regs->areg[1]; | ||
335 | return do_fork(clone_flags, newsp, regs, 0, parent_tid, child_tid); | 374 | return do_fork(clone_flags, newsp, regs, 0, parent_tid, child_tid); |
336 | } | 375 | } |
337 | |||
338 | /* | ||
339 | * xtensa_execve() executes a new program. | ||
340 | */ | ||
341 | |||
342 | asmlinkage | ||
343 | long xtensa_execve(const char __user *name, | ||
344 | const char __user *const __user *argv, | ||
345 | const char __user *const __user *envp, | ||
346 | long a3, long a4, long a5, | ||
347 | struct pt_regs *regs) | ||
348 | { | ||
349 | long error; | ||
350 | struct filename *filename; | ||
351 | |||
352 | filename = getname(name); | ||
353 | error = PTR_ERR(filename); | ||
354 | if (IS_ERR(filename)) | ||
355 | goto out; | ||
356 | error = do_execve(filename->name, argv, envp, regs); | ||
357 | putname(filename); | ||
358 | out: | ||
359 | return error; | ||
360 | } | ||
361 | |||
diff --git a/arch/xtensa/kernel/syscall.c b/arch/xtensa/kernel/syscall.c index a5c01e74d5d5..5702065f472a 100644 --- a/arch/xtensa/kernel/syscall.c +++ b/arch/xtensa/kernel/syscall.c | |||
@@ -32,10 +32,8 @@ typedef void (*syscall_t)(void); | |||
32 | syscall_t sys_call_table[__NR_syscall_count] /* FIXME __cacheline_aligned */= { | 32 | syscall_t sys_call_table[__NR_syscall_count] /* FIXME __cacheline_aligned */= { |
33 | [0 ... __NR_syscall_count - 1] = (syscall_t)&sys_ni_syscall, | 33 | [0 ... __NR_syscall_count - 1] = (syscall_t)&sys_ni_syscall, |
34 | 34 | ||
35 | #undef __SYSCALL | ||
36 | #define __SYSCALL(nr,symbol,nargs) [ nr ] = (syscall_t)symbol, | 35 | #define __SYSCALL(nr,symbol,nargs) [ nr ] = (syscall_t)symbol, |
37 | #undef __KERNEL_SYSCALLS__ | 36 | #include <uapi/asm/unistd.h> |
38 | #include <asm/unistd.h> | ||
39 | }; | 37 | }; |
40 | 38 | ||
41 | asmlinkage long xtensa_shmat(int shmid, char __user *shmaddr, int shmflg) | 39 | asmlinkage long xtensa_shmat(int shmid, char __user *shmaddr, int shmflg) |
@@ -49,7 +47,8 @@ asmlinkage long xtensa_shmat(int shmid, char __user *shmaddr, int shmflg) | |||
49 | return (long)ret; | 47 | return (long)ret; |
50 | } | 48 | } |
51 | 49 | ||
52 | asmlinkage long xtensa_fadvise64_64(int fd, int advice, unsigned long long offset, unsigned long long len) | 50 | asmlinkage long xtensa_fadvise64_64(int fd, int advice, |
51 | unsigned long long offset, unsigned long long len) | ||
53 | { | 52 | { |
54 | return sys_fadvise64_64(fd, offset, len, advice); | 53 | return sys_fadvise64_64(fd, offset, len, advice); |
55 | } | 54 | } |
diff --git a/arch/xtensa/kernel/xtensa_ksyms.c b/arch/xtensa/kernel/xtensa_ksyms.c index a8b9f1fd1e17..afe058b24e6e 100644 --- a/arch/xtensa/kernel/xtensa_ksyms.c +++ b/arch/xtensa/kernel/xtensa_ksyms.c | |||
@@ -43,7 +43,6 @@ EXPORT_SYMBOL(__strncpy_user); | |||
43 | EXPORT_SYMBOL(clear_page); | 43 | EXPORT_SYMBOL(clear_page); |
44 | EXPORT_SYMBOL(copy_page); | 44 | EXPORT_SYMBOL(copy_page); |
45 | 45 | ||
46 | EXPORT_SYMBOL(kernel_thread); | ||
47 | EXPORT_SYMBOL(empty_zero_page); | 46 | EXPORT_SYMBOL(empty_zero_page); |
48 | 47 | ||
49 | /* | 48 | /* |
diff --git a/block/Kconfig b/block/Kconfig index 09acf1b39905..a7e40a7c8214 100644 --- a/block/Kconfig +++ b/block/Kconfig | |||
@@ -89,7 +89,7 @@ config BLK_DEV_INTEGRITY | |||
89 | 89 | ||
90 | config BLK_DEV_THROTTLING | 90 | config BLK_DEV_THROTTLING |
91 | bool "Block layer bio throttling support" | 91 | bool "Block layer bio throttling support" |
92 | depends on BLK_CGROUP=y && EXPERIMENTAL | 92 | depends on BLK_CGROUP=y |
93 | default n | 93 | default n |
94 | ---help--- | 94 | ---help--- |
95 | Block layer bio throttling support. It can be used to limit | 95 | Block layer bio throttling support. It can be used to limit |
diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c index cafcd7431189..d0b770391ad4 100644 --- a/block/blk-cgroup.c +++ b/block/blk-cgroup.c | |||
@@ -285,6 +285,13 @@ static void blkg_destroy_all(struct request_queue *q) | |||
285 | blkg_destroy(blkg); | 285 | blkg_destroy(blkg); |
286 | spin_unlock(&blkcg->lock); | 286 | spin_unlock(&blkcg->lock); |
287 | } | 287 | } |
288 | |||
289 | /* | ||
290 | * root blkg is destroyed. Just clear the pointer since | ||
291 | * root_rl does not take reference on root blkg. | ||
292 | */ | ||
293 | q->root_blkg = NULL; | ||
294 | q->root_rl.blkg = NULL; | ||
288 | } | 295 | } |
289 | 296 | ||
290 | static void blkg_rcu_free(struct rcu_head *rcu_head) | 297 | static void blkg_rcu_free(struct rcu_head *rcu_head) |
@@ -326,6 +333,9 @@ struct request_list *__blk_queue_next_rl(struct request_list *rl, | |||
326 | */ | 333 | */ |
327 | if (rl == &q->root_rl) { | 334 | if (rl == &q->root_rl) { |
328 | ent = &q->blkg_list; | 335 | ent = &q->blkg_list; |
336 | /* There are no more block groups, hence no request lists */ | ||
337 | if (list_empty(ent)) | ||
338 | return NULL; | ||
329 | } else { | 339 | } else { |
330 | blkg = container_of(rl, struct blkcg_gq, rl); | 340 | blkg = container_of(rl, struct blkcg_gq, rl); |
331 | ent = &blkg->q_node; | 341 | ent = &blkg->q_node; |
diff --git a/block/blk-core.c b/block/blk-core.c index a33870b1847b..3c95c4d6e31a 100644 --- a/block/blk-core.c +++ b/block/blk-core.c | |||
@@ -2868,7 +2868,8 @@ static int plug_rq_cmp(void *priv, struct list_head *a, struct list_head *b) | |||
2868 | struct request *rqa = container_of(a, struct request, queuelist); | 2868 | struct request *rqa = container_of(a, struct request, queuelist); |
2869 | struct request *rqb = container_of(b, struct request, queuelist); | 2869 | struct request *rqb = container_of(b, struct request, queuelist); |
2870 | 2870 | ||
2871 | return !(rqa->q <= rqb->q); | 2871 | return !(rqa->q < rqb->q || |
2872 | (rqa->q == rqb->q && blk_rq_pos(rqa) < blk_rq_pos(rqb))); | ||
2872 | } | 2873 | } |
2873 | 2874 | ||
2874 | /* | 2875 | /* |
diff --git a/drivers/acpi/glue.c b/drivers/acpi/glue.c index d1a2d74033e9..08373086cd7e 100644 --- a/drivers/acpi/glue.c +++ b/drivers/acpi/glue.c | |||
@@ -159,6 +159,7 @@ static int acpi_bind_one(struct device *dev, acpi_handle handle) | |||
159 | if (physical_node->node_id >= ACPI_MAX_PHYSICAL_NODE) { | 159 | if (physical_node->node_id >= ACPI_MAX_PHYSICAL_NODE) { |
160 | retval = -ENOSPC; | 160 | retval = -ENOSPC; |
161 | mutex_unlock(&acpi_dev->physical_node_lock); | 161 | mutex_unlock(&acpi_dev->physical_node_lock); |
162 | kfree(physical_node); | ||
162 | goto err; | 163 | goto err; |
163 | } | 164 | } |
164 | 165 | ||
diff --git a/drivers/acpi/processor_driver.c b/drivers/acpi/processor_driver.c index e78c2a52ea46..bd4e5dca3ff7 100644 --- a/drivers/acpi/processor_driver.c +++ b/drivers/acpi/processor_driver.c | |||
@@ -409,6 +409,7 @@ static void acpi_processor_notify(struct acpi_device *device, u32 event) | |||
409 | acpi_bus_generate_proc_event(device, event, 0); | 409 | acpi_bus_generate_proc_event(device, event, 0); |
410 | acpi_bus_generate_netlink_event(device->pnp.device_class, | 410 | acpi_bus_generate_netlink_event(device->pnp.device_class, |
411 | dev_name(&device->dev), event, 0); | 411 | dev_name(&device->dev), event, 0); |
412 | break; | ||
412 | default: | 413 | default: |
413 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 414 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
414 | "Unsupported event [0x%x]\n", event)); | 415 | "Unsupported event [0x%x]\n", event)); |
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index f94d4c818fc7..0230cb6cbb3a 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c | |||
@@ -1345,12 +1345,15 @@ static int | |||
1345 | acpi_video_bus_get_devices(struct acpi_video_bus *video, | 1345 | acpi_video_bus_get_devices(struct acpi_video_bus *video, |
1346 | struct acpi_device *device) | 1346 | struct acpi_device *device) |
1347 | { | 1347 | { |
1348 | int status; | 1348 | int status = 0; |
1349 | struct acpi_device *dev; | 1349 | struct acpi_device *dev; |
1350 | 1350 | ||
1351 | status = acpi_video_device_enumerate(video); | 1351 | /* |
1352 | if (status) | 1352 | * There are systems where video module known to work fine regardless |
1353 | return status; | 1353 | * of broken _DOD and ignoring returned value here doesn't cause |
1354 | * any issues later. | ||
1355 | */ | ||
1356 | acpi_video_device_enumerate(video); | ||
1354 | 1357 | ||
1355 | list_for_each_entry(dev, &device->children, node) { | 1358 | list_for_each_entry(dev, &device->children, node) { |
1356 | 1359 | ||
diff --git a/drivers/base/Kconfig b/drivers/base/Kconfig index 08b4c5209384..b34b5cda5ae1 100644 --- a/drivers/base/Kconfig +++ b/drivers/base/Kconfig | |||
@@ -236,7 +236,7 @@ config CMA_SIZE_PERCENTAGE | |||
236 | 236 | ||
237 | choice | 237 | choice |
238 | prompt "Selected region size" | 238 | prompt "Selected region size" |
239 | default CMA_SIZE_SEL_ABSOLUTE | 239 | default CMA_SIZE_SEL_MBYTES |
240 | 240 | ||
241 | config CMA_SIZE_SEL_MBYTES | 241 | config CMA_SIZE_SEL_MBYTES |
242 | bool "Use mega bytes value only" | 242 | bool "Use mega bytes value only" |
diff --git a/drivers/base/dma-coherent.c b/drivers/base/dma-coherent.c index 560a7173f810..bc256b641027 100644 --- a/drivers/base/dma-coherent.c +++ b/drivers/base/dma-coherent.c | |||
@@ -191,9 +191,8 @@ EXPORT_SYMBOL(dma_release_from_coherent); | |||
191 | * This checks whether the memory was allocated from the per-device | 191 | * This checks whether the memory was allocated from the per-device |
192 | * coherent memory pool and if so, maps that memory to the provided vma. | 192 | * coherent memory pool and if so, maps that memory to the provided vma. |
193 | * | 193 | * |
194 | * Returns 1 if we correctly mapped the memory, or 0 if | 194 | * Returns 1 if we correctly mapped the memory, or 0 if the caller should |
195 | * dma_release_coherent() should proceed with mapping memory from | 195 | * proceed with mapping memory from generic pools. |
196 | * generic pools. | ||
197 | */ | 196 | */ |
198 | int dma_mmap_from_coherent(struct device *dev, struct vm_area_struct *vma, | 197 | int dma_mmap_from_coherent(struct device *dev, struct vm_area_struct *vma, |
199 | void *vaddr, size_t size, int *ret) | 198 | void *vaddr, size_t size, int *ret) |
diff --git a/drivers/base/dma-contiguous.c b/drivers/base/dma-contiguous.c index 9a1469474f55..612afcc5a938 100644 --- a/drivers/base/dma-contiguous.c +++ b/drivers/base/dma-contiguous.c | |||
@@ -27,15 +27,12 @@ | |||
27 | #include <linux/mm.h> | 27 | #include <linux/mm.h> |
28 | #include <linux/mutex.h> | 28 | #include <linux/mutex.h> |
29 | #include <linux/page-isolation.h> | 29 | #include <linux/page-isolation.h> |
30 | #include <linux/sizes.h> | ||
30 | #include <linux/slab.h> | 31 | #include <linux/slab.h> |
31 | #include <linux/swap.h> | 32 | #include <linux/swap.h> |
32 | #include <linux/mm_types.h> | 33 | #include <linux/mm_types.h> |
33 | #include <linux/dma-contiguous.h> | 34 | #include <linux/dma-contiguous.h> |
34 | 35 | ||
35 | #ifndef SZ_1M | ||
36 | #define SZ_1M (1 << 20) | ||
37 | #endif | ||
38 | |||
39 | struct cma { | 36 | struct cma { |
40 | unsigned long base_pfn; | 37 | unsigned long base_pfn; |
41 | unsigned long count; | 38 | unsigned long count; |
diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c index 81541452887b..8945f4e489ed 100644 --- a/drivers/base/firmware_class.c +++ b/drivers/base/firmware_class.c | |||
@@ -36,68 +36,6 @@ MODULE_AUTHOR("Manuel Estrada Sainz"); | |||
36 | MODULE_DESCRIPTION("Multi purpose firmware loading support"); | 36 | MODULE_DESCRIPTION("Multi purpose firmware loading support"); |
37 | MODULE_LICENSE("GPL"); | 37 | MODULE_LICENSE("GPL"); |
38 | 38 | ||
39 | static const char *fw_path[] = { | ||
40 | "/lib/firmware/updates/" UTS_RELEASE, | ||
41 | "/lib/firmware/updates", | ||
42 | "/lib/firmware/" UTS_RELEASE, | ||
43 | "/lib/firmware" | ||
44 | }; | ||
45 | |||
46 | /* Don't inline this: 'struct kstat' is biggish */ | ||
47 | static noinline long fw_file_size(struct file *file) | ||
48 | { | ||
49 | struct kstat st; | ||
50 | if (vfs_getattr(file->f_path.mnt, file->f_path.dentry, &st)) | ||
51 | return -1; | ||
52 | if (!S_ISREG(st.mode)) | ||
53 | return -1; | ||
54 | if (st.size != (long)st.size) | ||
55 | return -1; | ||
56 | return st.size; | ||
57 | } | ||
58 | |||
59 | static bool fw_read_file_contents(struct file *file, struct firmware *fw) | ||
60 | { | ||
61 | long size; | ||
62 | char *buf; | ||
63 | |||
64 | size = fw_file_size(file); | ||
65 | if (size < 0) | ||
66 | return false; | ||
67 | buf = vmalloc(size); | ||
68 | if (!buf) | ||
69 | return false; | ||
70 | if (kernel_read(file, 0, buf, size) != size) { | ||
71 | vfree(buf); | ||
72 | return false; | ||
73 | } | ||
74 | fw->data = buf; | ||
75 | fw->size = size; | ||
76 | return true; | ||
77 | } | ||
78 | |||
79 | static bool fw_get_filesystem_firmware(struct firmware *fw, const char *name) | ||
80 | { | ||
81 | int i; | ||
82 | bool success = false; | ||
83 | char *path = __getname(); | ||
84 | |||
85 | for (i = 0; i < ARRAY_SIZE(fw_path); i++) { | ||
86 | struct file *file; | ||
87 | snprintf(path, PATH_MAX, "%s/%s", fw_path[i], name); | ||
88 | |||
89 | file = filp_open(path, O_RDONLY, 0); | ||
90 | if (IS_ERR(file)) | ||
91 | continue; | ||
92 | success = fw_read_file_contents(file, fw); | ||
93 | fput(file); | ||
94 | if (success) | ||
95 | break; | ||
96 | } | ||
97 | __putname(path); | ||
98 | return success; | ||
99 | } | ||
100 | |||
101 | /* Builtin firmware support */ | 39 | /* Builtin firmware support */ |
102 | 40 | ||
103 | #ifdef CONFIG_FW_LOADER | 41 | #ifdef CONFIG_FW_LOADER |
@@ -150,6 +88,11 @@ enum { | |||
150 | FW_STATUS_ABORT, | 88 | FW_STATUS_ABORT, |
151 | }; | 89 | }; |
152 | 90 | ||
91 | enum fw_buf_fmt { | ||
92 | VMALLOC_BUF, /* used in direct loading */ | ||
93 | PAGE_BUF, /* used in loading via userspace */ | ||
94 | }; | ||
95 | |||
153 | static int loading_timeout = 60; /* In seconds */ | 96 | static int loading_timeout = 60; /* In seconds */ |
154 | 97 | ||
155 | static inline long firmware_loading_timeout(void) | 98 | static inline long firmware_loading_timeout(void) |
@@ -173,8 +116,6 @@ struct firmware_cache { | |||
173 | spinlock_t name_lock; | 116 | spinlock_t name_lock; |
174 | struct list_head fw_names; | 117 | struct list_head fw_names; |
175 | 118 | ||
176 | wait_queue_head_t wait_queue; | ||
177 | int cnt; | ||
178 | struct delayed_work work; | 119 | struct delayed_work work; |
179 | 120 | ||
180 | struct notifier_block pm_notify; | 121 | struct notifier_block pm_notify; |
@@ -187,6 +128,7 @@ struct firmware_buf { | |||
187 | struct completion completion; | 128 | struct completion completion; |
188 | struct firmware_cache *fwc; | 129 | struct firmware_cache *fwc; |
189 | unsigned long status; | 130 | unsigned long status; |
131 | enum fw_buf_fmt fmt; | ||
190 | void *data; | 132 | void *data; |
191 | size_t size; | 133 | size_t size; |
192 | struct page **pages; | 134 | struct page **pages; |
@@ -240,6 +182,7 @@ static struct firmware_buf *__allocate_fw_buf(const char *fw_name, | |||
240 | strcpy(buf->fw_id, fw_name); | 182 | strcpy(buf->fw_id, fw_name); |
241 | buf->fwc = fwc; | 183 | buf->fwc = fwc; |
242 | init_completion(&buf->completion); | 184 | init_completion(&buf->completion); |
185 | buf->fmt = VMALLOC_BUF; | ||
243 | 186 | ||
244 | pr_debug("%s: fw-%s buf=%p\n", __func__, fw_name, buf); | 187 | pr_debug("%s: fw-%s buf=%p\n", __func__, fw_name, buf); |
245 | 188 | ||
@@ -307,10 +250,14 @@ static void __fw_free_buf(struct kref *ref) | |||
307 | list_del(&buf->list); | 250 | list_del(&buf->list); |
308 | spin_unlock(&fwc->lock); | 251 | spin_unlock(&fwc->lock); |
309 | 252 | ||
310 | vunmap(buf->data); | 253 | |
311 | for (i = 0; i < buf->nr_pages; i++) | 254 | if (buf->fmt == PAGE_BUF) { |
312 | __free_page(buf->pages[i]); | 255 | vunmap(buf->data); |
313 | kfree(buf->pages); | 256 | for (i = 0; i < buf->nr_pages; i++) |
257 | __free_page(buf->pages[i]); | ||
258 | kfree(buf->pages); | ||
259 | } else | ||
260 | vfree(buf->data); | ||
314 | kfree(buf); | 261 | kfree(buf); |
315 | } | 262 | } |
316 | 263 | ||
@@ -319,6 +266,69 @@ static void fw_free_buf(struct firmware_buf *buf) | |||
319 | kref_put(&buf->ref, __fw_free_buf); | 266 | kref_put(&buf->ref, __fw_free_buf); |
320 | } | 267 | } |
321 | 268 | ||
269 | /* direct firmware loading support */ | ||
270 | static const char *fw_path[] = { | ||
271 | "/lib/firmware/updates/" UTS_RELEASE, | ||
272 | "/lib/firmware/updates", | ||
273 | "/lib/firmware/" UTS_RELEASE, | ||
274 | "/lib/firmware" | ||
275 | }; | ||
276 | |||
277 | /* Don't inline this: 'struct kstat' is biggish */ | ||
278 | static noinline long fw_file_size(struct file *file) | ||
279 | { | ||
280 | struct kstat st; | ||
281 | if (vfs_getattr(file->f_path.mnt, file->f_path.dentry, &st)) | ||
282 | return -1; | ||
283 | if (!S_ISREG(st.mode)) | ||
284 | return -1; | ||
285 | if (st.size != (long)st.size) | ||
286 | return -1; | ||
287 | return st.size; | ||
288 | } | ||
289 | |||
290 | static bool fw_read_file_contents(struct file *file, struct firmware_buf *fw_buf) | ||
291 | { | ||
292 | long size; | ||
293 | char *buf; | ||
294 | |||
295 | size = fw_file_size(file); | ||
296 | if (size < 0) | ||
297 | return false; | ||
298 | buf = vmalloc(size); | ||
299 | if (!buf) | ||
300 | return false; | ||
301 | if (kernel_read(file, 0, buf, size) != size) { | ||
302 | vfree(buf); | ||
303 | return false; | ||
304 | } | ||
305 | fw_buf->data = buf; | ||
306 | fw_buf->size = size; | ||
307 | return true; | ||
308 | } | ||
309 | |||
310 | static bool fw_get_filesystem_firmware(struct firmware_buf *buf) | ||
311 | { | ||
312 | int i; | ||
313 | bool success = false; | ||
314 | char *path = __getname(); | ||
315 | |||
316 | for (i = 0; i < ARRAY_SIZE(fw_path); i++) { | ||
317 | struct file *file; | ||
318 | snprintf(path, PATH_MAX, "%s/%s", fw_path[i], buf->fw_id); | ||
319 | |||
320 | file = filp_open(path, O_RDONLY, 0); | ||
321 | if (IS_ERR(file)) | ||
322 | continue; | ||
323 | success = fw_read_file_contents(file, buf); | ||
324 | fput(file); | ||
325 | if (success) | ||
326 | break; | ||
327 | } | ||
328 | __putname(path); | ||
329 | return success; | ||
330 | } | ||
331 | |||
322 | static struct firmware_priv *to_firmware_priv(struct device *dev) | 332 | static struct firmware_priv *to_firmware_priv(struct device *dev) |
323 | { | 333 | { |
324 | return container_of(dev, struct firmware_priv, dev); | 334 | return container_of(dev, struct firmware_priv, dev); |
@@ -423,6 +433,21 @@ static void firmware_free_data(const struct firmware *fw) | |||
423 | #ifndef PAGE_KERNEL_RO | 433 | #ifndef PAGE_KERNEL_RO |
424 | #define PAGE_KERNEL_RO PAGE_KERNEL | 434 | #define PAGE_KERNEL_RO PAGE_KERNEL |
425 | #endif | 435 | #endif |
436 | |||
437 | /* one pages buffer should be mapped/unmapped only once */ | ||
438 | static int fw_map_pages_buf(struct firmware_buf *buf) | ||
439 | { | ||
440 | if (buf->fmt != PAGE_BUF) | ||
441 | return 0; | ||
442 | |||
443 | if (buf->data) | ||
444 | vunmap(buf->data); | ||
445 | buf->data = vmap(buf->pages, buf->nr_pages, 0, PAGE_KERNEL_RO); | ||
446 | if (!buf->data) | ||
447 | return -ENOMEM; | ||
448 | return 0; | ||
449 | } | ||
450 | |||
426 | /** | 451 | /** |
427 | * firmware_loading_store - set value in the 'loading' control file | 452 | * firmware_loading_store - set value in the 'loading' control file |
428 | * @dev: device pointer | 453 | * @dev: device pointer |
@@ -467,6 +492,14 @@ static ssize_t firmware_loading_store(struct device *dev, | |||
467 | if (test_bit(FW_STATUS_LOADING, &fw_buf->status)) { | 492 | if (test_bit(FW_STATUS_LOADING, &fw_buf->status)) { |
468 | set_bit(FW_STATUS_DONE, &fw_buf->status); | 493 | set_bit(FW_STATUS_DONE, &fw_buf->status); |
469 | clear_bit(FW_STATUS_LOADING, &fw_buf->status); | 494 | clear_bit(FW_STATUS_LOADING, &fw_buf->status); |
495 | |||
496 | /* | ||
497 | * Several loading requests may be pending on | ||
498 | * one same firmware buf, so let all requests | ||
499 | * see the mapped 'buf->data' once the loading | ||
500 | * is completed. | ||
501 | * */ | ||
502 | fw_map_pages_buf(fw_buf); | ||
470 | complete_all(&fw_buf->completion); | 503 | complete_all(&fw_buf->completion); |
471 | break; | 504 | break; |
472 | } | 505 | } |
@@ -670,15 +703,6 @@ exit: | |||
670 | return fw_priv; | 703 | return fw_priv; |
671 | } | 704 | } |
672 | 705 | ||
673 | /* one pages buffer is mapped/unmapped only once */ | ||
674 | static int fw_map_pages_buf(struct firmware_buf *buf) | ||
675 | { | ||
676 | buf->data = vmap(buf->pages, buf->nr_pages, 0, PAGE_KERNEL_RO); | ||
677 | if (!buf->data) | ||
678 | return -ENOMEM; | ||
679 | return 0; | ||
680 | } | ||
681 | |||
682 | /* store the pages buffer info firmware from buf */ | 706 | /* store the pages buffer info firmware from buf */ |
683 | static void fw_set_page_data(struct firmware_buf *buf, struct firmware *fw) | 707 | static void fw_set_page_data(struct firmware_buf *buf, struct firmware *fw) |
684 | { | 708 | { |
@@ -778,11 +802,6 @@ _request_firmware_prepare(const struct firmware **firmware_p, const char *name, | |||
778 | return NULL; | 802 | return NULL; |
779 | } | 803 | } |
780 | 804 | ||
781 | if (fw_get_filesystem_firmware(firmware, name)) { | ||
782 | dev_dbg(device, "firmware: direct-loading firmware %s\n", name); | ||
783 | return NULL; | ||
784 | } | ||
785 | |||
786 | ret = fw_lookup_and_allocate_buf(name, &fw_cache, &buf); | 805 | ret = fw_lookup_and_allocate_buf(name, &fw_cache, &buf); |
787 | if (!ret) | 806 | if (!ret) |
788 | fw_priv = fw_create_instance(firmware, name, device, | 807 | fw_priv = fw_create_instance(firmware, name, device, |
@@ -832,6 +851,21 @@ static int _request_firmware_load(struct firmware_priv *fw_priv, bool uevent, | |||
832 | struct device *f_dev = &fw_priv->dev; | 851 | struct device *f_dev = &fw_priv->dev; |
833 | struct firmware_buf *buf = fw_priv->buf; | 852 | struct firmware_buf *buf = fw_priv->buf; |
834 | struct firmware_cache *fwc = &fw_cache; | 853 | struct firmware_cache *fwc = &fw_cache; |
854 | int direct_load = 0; | ||
855 | |||
856 | /* try direct loading from fs first */ | ||
857 | if (fw_get_filesystem_firmware(buf)) { | ||
858 | dev_dbg(f_dev->parent, "firmware: direct-loading" | ||
859 | " firmware %s\n", buf->fw_id); | ||
860 | |||
861 | set_bit(FW_STATUS_DONE, &buf->status); | ||
862 | complete_all(&buf->completion); | ||
863 | direct_load = 1; | ||
864 | goto handle_fw; | ||
865 | } | ||
866 | |||
867 | /* fall back on userspace loading */ | ||
868 | buf->fmt = PAGE_BUF; | ||
835 | 869 | ||
836 | dev_set_uevent_suppress(f_dev, true); | 870 | dev_set_uevent_suppress(f_dev, true); |
837 | 871 | ||
@@ -870,6 +904,7 @@ static int _request_firmware_load(struct firmware_priv *fw_priv, bool uevent, | |||
870 | 904 | ||
871 | del_timer_sync(&fw_priv->timeout); | 905 | del_timer_sync(&fw_priv->timeout); |
872 | 906 | ||
907 | handle_fw: | ||
873 | mutex_lock(&fw_lock); | 908 | mutex_lock(&fw_lock); |
874 | if (!buf->size || test_bit(FW_STATUS_ABORT, &buf->status)) | 909 | if (!buf->size || test_bit(FW_STATUS_ABORT, &buf->status)) |
875 | retval = -ENOENT; | 910 | retval = -ENOENT; |
@@ -884,9 +919,6 @@ static int _request_firmware_load(struct firmware_priv *fw_priv, bool uevent, | |||
884 | if (!retval && f_dev->parent) | 919 | if (!retval && f_dev->parent) |
885 | fw_add_devm_name(f_dev->parent, buf->fw_id); | 920 | fw_add_devm_name(f_dev->parent, buf->fw_id); |
886 | 921 | ||
887 | if (!retval) | ||
888 | retval = fw_map_pages_buf(buf); | ||
889 | |||
890 | /* | 922 | /* |
891 | * After caching firmware image is started, let it piggyback | 923 | * After caching firmware image is started, let it piggyback |
892 | * on request firmware. | 924 | * on request firmware. |
@@ -902,6 +934,9 @@ static int _request_firmware_load(struct firmware_priv *fw_priv, bool uevent, | |||
902 | fw_priv->buf = NULL; | 934 | fw_priv->buf = NULL; |
903 | mutex_unlock(&fw_lock); | 935 | mutex_unlock(&fw_lock); |
904 | 936 | ||
937 | if (direct_load) | ||
938 | goto err_put_dev; | ||
939 | |||
905 | device_remove_file(f_dev, &dev_attr_loading); | 940 | device_remove_file(f_dev, &dev_attr_loading); |
906 | err_del_bin_attr: | 941 | err_del_bin_attr: |
907 | device_remove_bin_file(f_dev, &firmware_attr_data); | 942 | device_remove_bin_file(f_dev, &firmware_attr_data); |
@@ -1129,6 +1164,8 @@ int uncache_firmware(const char *fw_name) | |||
1129 | } | 1164 | } |
1130 | 1165 | ||
1131 | #ifdef CONFIG_PM_SLEEP | 1166 | #ifdef CONFIG_PM_SLEEP |
1167 | static ASYNC_DOMAIN_EXCLUSIVE(fw_cache_domain); | ||
1168 | |||
1132 | static struct fw_cache_entry *alloc_fw_cache_entry(const char *name) | 1169 | static struct fw_cache_entry *alloc_fw_cache_entry(const char *name) |
1133 | { | 1170 | { |
1134 | struct fw_cache_entry *fce; | 1171 | struct fw_cache_entry *fce; |
@@ -1142,17 +1179,27 @@ exit: | |||
1142 | return fce; | 1179 | return fce; |
1143 | } | 1180 | } |
1144 | 1181 | ||
1145 | static int fw_cache_piggyback_on_request(const char *name) | 1182 | static int __fw_entry_found(const char *name) |
1146 | { | 1183 | { |
1147 | struct firmware_cache *fwc = &fw_cache; | 1184 | struct firmware_cache *fwc = &fw_cache; |
1148 | struct fw_cache_entry *fce; | 1185 | struct fw_cache_entry *fce; |
1149 | int ret = 0; | ||
1150 | 1186 | ||
1151 | spin_lock(&fwc->name_lock); | ||
1152 | list_for_each_entry(fce, &fwc->fw_names, list) { | 1187 | list_for_each_entry(fce, &fwc->fw_names, list) { |
1153 | if (!strcmp(fce->name, name)) | 1188 | if (!strcmp(fce->name, name)) |
1154 | goto found; | 1189 | return 1; |
1155 | } | 1190 | } |
1191 | return 0; | ||
1192 | } | ||
1193 | |||
1194 | static int fw_cache_piggyback_on_request(const char *name) | ||
1195 | { | ||
1196 | struct firmware_cache *fwc = &fw_cache; | ||
1197 | struct fw_cache_entry *fce; | ||
1198 | int ret = 0; | ||
1199 | |||
1200 | spin_lock(&fwc->name_lock); | ||
1201 | if (__fw_entry_found(name)) | ||
1202 | goto found; | ||
1156 | 1203 | ||
1157 | fce = alloc_fw_cache_entry(name); | 1204 | fce = alloc_fw_cache_entry(name); |
1158 | if (fce) { | 1205 | if (fce) { |
@@ -1185,12 +1232,6 @@ static void __async_dev_cache_fw_image(void *fw_entry, | |||
1185 | 1232 | ||
1186 | free_fw_cache_entry(fce); | 1233 | free_fw_cache_entry(fce); |
1187 | } | 1234 | } |
1188 | |||
1189 | spin_lock(&fwc->name_lock); | ||
1190 | fwc->cnt--; | ||
1191 | spin_unlock(&fwc->name_lock); | ||
1192 | |||
1193 | wake_up(&fwc->wait_queue); | ||
1194 | } | 1235 | } |
1195 | 1236 | ||
1196 | /* called with dev->devres_lock held */ | 1237 | /* called with dev->devres_lock held */ |
@@ -1229,11 +1270,19 @@ static void dev_cache_fw_image(struct device *dev, void *data) | |||
1229 | list_del(&fce->list); | 1270 | list_del(&fce->list); |
1230 | 1271 | ||
1231 | spin_lock(&fwc->name_lock); | 1272 | spin_lock(&fwc->name_lock); |
1232 | fwc->cnt++; | 1273 | /* only one cache entry for one firmware */ |
1233 | list_add(&fce->list, &fwc->fw_names); | 1274 | if (!__fw_entry_found(fce->name)) { |
1275 | list_add(&fce->list, &fwc->fw_names); | ||
1276 | } else { | ||
1277 | free_fw_cache_entry(fce); | ||
1278 | fce = NULL; | ||
1279 | } | ||
1234 | spin_unlock(&fwc->name_lock); | 1280 | spin_unlock(&fwc->name_lock); |
1235 | 1281 | ||
1236 | async_schedule(__async_dev_cache_fw_image, (void *)fce); | 1282 | if (fce) |
1283 | async_schedule_domain(__async_dev_cache_fw_image, | ||
1284 | (void *)fce, | ||
1285 | &fw_cache_domain); | ||
1237 | } | 1286 | } |
1238 | } | 1287 | } |
1239 | 1288 | ||
@@ -1275,6 +1324,9 @@ static void device_cache_fw_images(void) | |||
1275 | 1324 | ||
1276 | pr_debug("%s\n", __func__); | 1325 | pr_debug("%s\n", __func__); |
1277 | 1326 | ||
1327 | /* cancel uncache work */ | ||
1328 | cancel_delayed_work_sync(&fwc->work); | ||
1329 | |||
1278 | /* | 1330 | /* |
1279 | * use small loading timeout for caching devices' firmware | 1331 | * use small loading timeout for caching devices' firmware |
1280 | * because all these firmware images have been loaded | 1332 | * because all these firmware images have been loaded |
@@ -1292,21 +1344,7 @@ static void device_cache_fw_images(void) | |||
1292 | mutex_unlock(&fw_lock); | 1344 | mutex_unlock(&fw_lock); |
1293 | 1345 | ||
1294 | /* wait for completion of caching firmware for all devices */ | 1346 | /* wait for completion of caching firmware for all devices */ |
1295 | spin_lock(&fwc->name_lock); | 1347 | async_synchronize_full_domain(&fw_cache_domain); |
1296 | for (;;) { | ||
1297 | prepare_to_wait(&fwc->wait_queue, &wait, | ||
1298 | TASK_UNINTERRUPTIBLE); | ||
1299 | if (!fwc->cnt) | ||
1300 | break; | ||
1301 | |||
1302 | spin_unlock(&fwc->name_lock); | ||
1303 | |||
1304 | schedule(); | ||
1305 | |||
1306 | spin_lock(&fwc->name_lock); | ||
1307 | } | ||
1308 | spin_unlock(&fwc->name_lock); | ||
1309 | finish_wait(&fwc->wait_queue, &wait); | ||
1310 | 1348 | ||
1311 | loading_timeout = old_timeout; | 1349 | loading_timeout = old_timeout; |
1312 | } | 1350 | } |
@@ -1394,9 +1432,7 @@ static void __init fw_cache_init(void) | |||
1394 | #ifdef CONFIG_PM_SLEEP | 1432 | #ifdef CONFIG_PM_SLEEP |
1395 | spin_lock_init(&fw_cache.name_lock); | 1433 | spin_lock_init(&fw_cache.name_lock); |
1396 | INIT_LIST_HEAD(&fw_cache.fw_names); | 1434 | INIT_LIST_HEAD(&fw_cache.fw_names); |
1397 | fw_cache.cnt = 0; | ||
1398 | 1435 | ||
1399 | init_waitqueue_head(&fw_cache.wait_queue); | ||
1400 | INIT_DELAYED_WORK(&fw_cache.work, | 1436 | INIT_DELAYED_WORK(&fw_cache.work, |
1401 | device_uncache_fw_images_work); | 1437 | device_uncache_fw_images_work); |
1402 | 1438 | ||
diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c index c22b869245d9..96b71b6536d6 100644 --- a/drivers/base/power/domain.c +++ b/drivers/base/power/domain.c | |||
@@ -1862,7 +1862,7 @@ int pm_genpd_attach_cpuidle(struct generic_pm_domain *genpd, int state) | |||
1862 | cpuidle_drv = cpuidle_driver_ref(); | 1862 | cpuidle_drv = cpuidle_driver_ref(); |
1863 | if (!cpuidle_drv) { | 1863 | if (!cpuidle_drv) { |
1864 | ret = -ENODEV; | 1864 | ret = -ENODEV; |
1865 | goto out; | 1865 | goto err_drv; |
1866 | } | 1866 | } |
1867 | if (cpuidle_drv->state_count <= state) { | 1867 | if (cpuidle_drv->state_count <= state) { |
1868 | ret = -EINVAL; | 1868 | ret = -EINVAL; |
@@ -1884,6 +1884,9 @@ int pm_genpd_attach_cpuidle(struct generic_pm_domain *genpd, int state) | |||
1884 | 1884 | ||
1885 | err: | 1885 | err: |
1886 | cpuidle_driver_unref(); | 1886 | cpuidle_driver_unref(); |
1887 | |||
1888 | err_drv: | ||
1889 | kfree(cpu_data); | ||
1887 | goto out; | 1890 | goto out; |
1888 | } | 1891 | } |
1889 | 1892 | ||
diff --git a/drivers/base/regmap/Kconfig b/drivers/base/regmap/Kconfig index 6be390bd8bd1..f0d30543fcce 100644 --- a/drivers/base/regmap/Kconfig +++ b/drivers/base/regmap/Kconfig | |||
@@ -3,7 +3,7 @@ | |||
3 | # subsystems should select the appropriate symbols. | 3 | # subsystems should select the appropriate symbols. |
4 | 4 | ||
5 | config REGMAP | 5 | config REGMAP |
6 | default y if (REGMAP_I2C || REGMAP_SPI) | 6 | default y if (REGMAP_I2C || REGMAP_SPI || REGMAP_MMIO || REGMAP_IRQ) |
7 | select LZO_COMPRESS | 7 | select LZO_COMPRESS |
8 | select LZO_DECOMPRESS | 8 | select LZO_DECOMPRESS |
9 | select IRQ_DOMAIN if REGMAP_IRQ | 9 | select IRQ_DOMAIN if REGMAP_IRQ |
diff --git a/drivers/bcma/main.c b/drivers/bcma/main.c index 432aeeedfd5e..d865470bc951 100644 --- a/drivers/bcma/main.c +++ b/drivers/bcma/main.c | |||
@@ -158,9 +158,10 @@ static int bcma_register_cores(struct bcma_bus *bus) | |||
158 | 158 | ||
159 | static void bcma_unregister_cores(struct bcma_bus *bus) | 159 | static void bcma_unregister_cores(struct bcma_bus *bus) |
160 | { | 160 | { |
161 | struct bcma_device *core; | 161 | struct bcma_device *core, *tmp; |
162 | 162 | ||
163 | list_for_each_entry(core, &bus->cores, list) { | 163 | list_for_each_entry_safe(core, tmp, &bus->cores, list) { |
164 | list_del(&core->list); | ||
164 | if (core->dev_registered) | 165 | if (core->dev_registered) |
165 | device_unregister(&core->dev); | 166 | device_unregister(&core->dev); |
166 | } | 167 | } |
diff --git a/drivers/block/Kconfig b/drivers/block/Kconfig index f529407db93f..824e09c4d0d7 100644 --- a/drivers/block/Kconfig +++ b/drivers/block/Kconfig | |||
@@ -131,6 +131,7 @@ config BLK_CPQ_DA | |||
131 | config BLK_CPQ_CISS_DA | 131 | config BLK_CPQ_CISS_DA |
132 | tristate "Compaq Smart Array 5xxx support" | 132 | tristate "Compaq Smart Array 5xxx support" |
133 | depends on PCI | 133 | depends on PCI |
134 | select CHECK_SIGNATURE | ||
134 | help | 135 | help |
135 | This is the driver for Compaq Smart Array 5xxx controllers. | 136 | This is the driver for Compaq Smart Array 5xxx controllers. |
136 | Everyone using these boards should say Y here. | 137 | Everyone using these boards should say Y here. |
@@ -166,8 +167,8 @@ config BLK_DEV_DAC960 | |||
166 | module will be called DAC960. | 167 | module will be called DAC960. |
167 | 168 | ||
168 | config BLK_DEV_UMEM | 169 | config BLK_DEV_UMEM |
169 | tristate "Micro Memory MM5415 Battery Backed RAM support (EXPERIMENTAL)" | 170 | tristate "Micro Memory MM5415 Battery Backed RAM support" |
170 | depends on PCI && EXPERIMENTAL | 171 | depends on PCI |
171 | ---help--- | 172 | ---help--- |
172 | Saying Y here will include support for the MM5415 family of | 173 | Saying Y here will include support for the MM5415 family of |
173 | battery backed (Non-volatile) RAM cards. | 174 | battery backed (Non-volatile) RAM cards. |
@@ -430,8 +431,8 @@ config CDROM_PKTCDVD_BUFFERS | |||
430 | a disc is opened for writing. | 431 | a disc is opened for writing. |
431 | 432 | ||
432 | config CDROM_PKTCDVD_WCACHE | 433 | config CDROM_PKTCDVD_WCACHE |
433 | bool "Enable write caching (EXPERIMENTAL)" | 434 | bool "Enable write caching" |
434 | depends on CDROM_PKTCDVD && EXPERIMENTAL | 435 | depends on CDROM_PKTCDVD |
435 | help | 436 | help |
436 | If enabled, write caching will be set for the CD-R/W device. For now | 437 | If enabled, write caching will be set for the CD-R/W device. For now |
437 | this option is dangerous unless the CD-RW media is known good, as we | 438 | this option is dangerous unless the CD-RW media is known good, as we |
@@ -508,8 +509,8 @@ config XEN_BLKDEV_BACKEND | |||
508 | 509 | ||
509 | 510 | ||
510 | config VIRTIO_BLK | 511 | config VIRTIO_BLK |
511 | tristate "Virtio block driver (EXPERIMENTAL)" | 512 | tristate "Virtio block driver" |
512 | depends on EXPERIMENTAL && VIRTIO | 513 | depends on VIRTIO |
513 | ---help--- | 514 | ---help--- |
514 | This is the virtual block driver for virtio. It can be used with | 515 | This is the virtual block driver for virtio. It can be used with |
515 | lguest or QEMU based VMMs (like KVM or Xen). Say Y or M. | 516 | lguest or QEMU based VMMs (like KVM or Xen). Say Y or M. |
@@ -528,7 +529,7 @@ config BLK_DEV_HD | |||
528 | 529 | ||
529 | config BLK_DEV_RBD | 530 | config BLK_DEV_RBD |
530 | tristate "Rados block device (RBD)" | 531 | tristate "Rados block device (RBD)" |
531 | depends on INET && EXPERIMENTAL && BLOCK | 532 | depends on INET && BLOCK |
532 | select CEPH_LIB | 533 | select CEPH_LIB |
533 | select LIBCRC32C | 534 | select LIBCRC32C |
534 | select CRYPTO_AES | 535 | select CRYPTO_AES |
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c index b0f553b26d0f..ca83f96756ad 100644 --- a/drivers/block/cciss.c +++ b/drivers/block/cciss.c | |||
@@ -5205,7 +5205,6 @@ static void cciss_shutdown(struct pci_dev *pdev) | |||
5205 | return; | 5205 | return; |
5206 | } | 5206 | } |
5207 | /* write all data in the battery backed cache to disk */ | 5207 | /* write all data in the battery backed cache to disk */ |
5208 | memset(flush_buf, 0, 4); | ||
5209 | return_code = sendcmd_withirq(h, CCISS_CACHE_FLUSH, flush_buf, | 5208 | return_code = sendcmd_withirq(h, CCISS_CACHE_FLUSH, flush_buf, |
5210 | 4, 0, CTLR_LUNID, TYPE_CMD); | 5209 | 4, 0, CTLR_LUNID, TYPE_CMD); |
5211 | kfree(flush_buf); | 5210 | kfree(flush_buf); |
diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c index 17c675c52295..1c49d7173966 100644 --- a/drivers/block/floppy.c +++ b/drivers/block/floppy.c | |||
@@ -4109,12 +4109,19 @@ static struct platform_driver floppy_driver = { | |||
4109 | 4109 | ||
4110 | static struct platform_device floppy_device[N_DRIVE]; | 4110 | static struct platform_device floppy_device[N_DRIVE]; |
4111 | 4111 | ||
4112 | static bool floppy_available(int drive) | ||
4113 | { | ||
4114 | if (!(allowed_drive_mask & (1 << drive))) | ||
4115 | return false; | ||
4116 | if (fdc_state[FDC(drive)].version == FDC_NONE) | ||
4117 | return false; | ||
4118 | return true; | ||
4119 | } | ||
4120 | |||
4112 | static struct kobject *floppy_find(dev_t dev, int *part, void *data) | 4121 | static struct kobject *floppy_find(dev_t dev, int *part, void *data) |
4113 | { | 4122 | { |
4114 | int drive = (*part & 3) | ((*part & 0x80) >> 5); | 4123 | int drive = (*part & 3) | ((*part & 0x80) >> 5); |
4115 | if (drive >= N_DRIVE || | 4124 | if (drive >= N_DRIVE || !floppy_available(drive)) |
4116 | !(allowed_drive_mask & (1 << drive)) || | ||
4117 | fdc_state[FDC(drive)].version == FDC_NONE) | ||
4118 | return NULL; | 4125 | return NULL; |
4119 | if (((*part >> 2) & 0x1f) >= ARRAY_SIZE(floppy_type)) | 4126 | if (((*part >> 2) & 0x1f) >= ARRAY_SIZE(floppy_type)) |
4120 | return NULL; | 4127 | return NULL; |
@@ -4124,8 +4131,7 @@ static struct kobject *floppy_find(dev_t dev, int *part, void *data) | |||
4124 | 4131 | ||
4125 | static int __init do_floppy_init(void) | 4132 | static int __init do_floppy_init(void) |
4126 | { | 4133 | { |
4127 | int i, unit, drive; | 4134 | int i, unit, drive, err; |
4128 | int err, dr; | ||
4129 | 4135 | ||
4130 | set_debugt(); | 4136 | set_debugt(); |
4131 | interruptjiffies = resultjiffies = jiffies; | 4137 | interruptjiffies = resultjiffies = jiffies; |
@@ -4137,34 +4143,32 @@ static int __init do_floppy_init(void) | |||
4137 | 4143 | ||
4138 | raw_cmd = NULL; | 4144 | raw_cmd = NULL; |
4139 | 4145 | ||
4140 | for (dr = 0; dr < N_DRIVE; dr++) { | 4146 | floppy_wq = alloc_ordered_workqueue("floppy", 0); |
4141 | disks[dr] = alloc_disk(1); | 4147 | if (!floppy_wq) |
4142 | if (!disks[dr]) { | 4148 | return -ENOMEM; |
4143 | err = -ENOMEM; | ||
4144 | goto out_put_disk; | ||
4145 | } | ||
4146 | 4149 | ||
4147 | floppy_wq = alloc_ordered_workqueue("floppy", 0); | 4150 | for (drive = 0; drive < N_DRIVE; drive++) { |
4148 | if (!floppy_wq) { | 4151 | disks[drive] = alloc_disk(1); |
4152 | if (!disks[drive]) { | ||
4149 | err = -ENOMEM; | 4153 | err = -ENOMEM; |
4150 | goto out_put_disk; | 4154 | goto out_put_disk; |
4151 | } | 4155 | } |
4152 | 4156 | ||
4153 | disks[dr]->queue = blk_init_queue(do_fd_request, &floppy_lock); | 4157 | disks[drive]->queue = blk_init_queue(do_fd_request, &floppy_lock); |
4154 | if (!disks[dr]->queue) { | 4158 | if (!disks[drive]->queue) { |
4155 | err = -ENOMEM; | 4159 | err = -ENOMEM; |
4156 | goto out_destroy_workq; | 4160 | goto out_put_disk; |
4157 | } | 4161 | } |
4158 | 4162 | ||
4159 | blk_queue_max_hw_sectors(disks[dr]->queue, 64); | 4163 | blk_queue_max_hw_sectors(disks[drive]->queue, 64); |
4160 | disks[dr]->major = FLOPPY_MAJOR; | 4164 | disks[drive]->major = FLOPPY_MAJOR; |
4161 | disks[dr]->first_minor = TOMINOR(dr); | 4165 | disks[drive]->first_minor = TOMINOR(drive); |
4162 | disks[dr]->fops = &floppy_fops; | 4166 | disks[drive]->fops = &floppy_fops; |
4163 | sprintf(disks[dr]->disk_name, "fd%d", dr); | 4167 | sprintf(disks[drive]->disk_name, "fd%d", drive); |
4164 | 4168 | ||
4165 | init_timer(&motor_off_timer[dr]); | 4169 | init_timer(&motor_off_timer[drive]); |
4166 | motor_off_timer[dr].data = dr; | 4170 | motor_off_timer[drive].data = drive; |
4167 | motor_off_timer[dr].function = motor_off_callback; | 4171 | motor_off_timer[drive].function = motor_off_callback; |
4168 | } | 4172 | } |
4169 | 4173 | ||
4170 | err = register_blkdev(FLOPPY_MAJOR, "fd"); | 4174 | err = register_blkdev(FLOPPY_MAJOR, "fd"); |
@@ -4282,9 +4286,7 @@ static int __init do_floppy_init(void) | |||
4282 | } | 4286 | } |
4283 | 4287 | ||
4284 | for (drive = 0; drive < N_DRIVE; drive++) { | 4288 | for (drive = 0; drive < N_DRIVE; drive++) { |
4285 | if (!(allowed_drive_mask & (1 << drive))) | 4289 | if (!floppy_available(drive)) |
4286 | continue; | ||
4287 | if (fdc_state[FDC(drive)].version == FDC_NONE) | ||
4288 | continue; | 4290 | continue; |
4289 | 4291 | ||
4290 | floppy_device[drive].name = floppy_device_name; | 4292 | floppy_device[drive].name = floppy_device_name; |
@@ -4293,7 +4295,7 @@ static int __init do_floppy_init(void) | |||
4293 | 4295 | ||
4294 | err = platform_device_register(&floppy_device[drive]); | 4296 | err = platform_device_register(&floppy_device[drive]); |
4295 | if (err) | 4297 | if (err) |
4296 | goto out_release_dma; | 4298 | goto out_remove_drives; |
4297 | 4299 | ||
4298 | err = device_create_file(&floppy_device[drive].dev, | 4300 | err = device_create_file(&floppy_device[drive].dev, |
4299 | &dev_attr_cmos); | 4301 | &dev_attr_cmos); |
@@ -4311,29 +4313,34 @@ static int __init do_floppy_init(void) | |||
4311 | 4313 | ||
4312 | out_unreg_platform_dev: | 4314 | out_unreg_platform_dev: |
4313 | platform_device_unregister(&floppy_device[drive]); | 4315 | platform_device_unregister(&floppy_device[drive]); |
4316 | out_remove_drives: | ||
4317 | while (drive--) { | ||
4318 | if (floppy_available(drive)) { | ||
4319 | del_gendisk(disks[drive]); | ||
4320 | device_remove_file(&floppy_device[drive].dev, &dev_attr_cmos); | ||
4321 | platform_device_unregister(&floppy_device[drive]); | ||
4322 | } | ||
4323 | } | ||
4314 | out_release_dma: | 4324 | out_release_dma: |
4315 | if (atomic_read(&usage_count)) | 4325 | if (atomic_read(&usage_count)) |
4316 | floppy_release_irq_and_dma(); | 4326 | floppy_release_irq_and_dma(); |
4317 | out_unreg_region: | 4327 | out_unreg_region: |
4318 | blk_unregister_region(MKDEV(FLOPPY_MAJOR, 0), 256); | 4328 | blk_unregister_region(MKDEV(FLOPPY_MAJOR, 0), 256); |
4319 | platform_driver_unregister(&floppy_driver); | 4329 | platform_driver_unregister(&floppy_driver); |
4320 | out_destroy_workq: | ||
4321 | destroy_workqueue(floppy_wq); | ||
4322 | out_unreg_blkdev: | 4330 | out_unreg_blkdev: |
4323 | unregister_blkdev(FLOPPY_MAJOR, "fd"); | 4331 | unregister_blkdev(FLOPPY_MAJOR, "fd"); |
4324 | out_put_disk: | 4332 | out_put_disk: |
4325 | while (dr--) { | 4333 | for (drive = 0; drive < N_DRIVE; drive++) { |
4326 | del_timer_sync(&motor_off_timer[dr]); | 4334 | if (!disks[drive]) |
4327 | if (disks[dr]->queue) { | 4335 | break; |
4328 | blk_cleanup_queue(disks[dr]->queue); | 4336 | if (disks[drive]->queue) { |
4329 | /* | 4337 | del_timer_sync(&motor_off_timer[drive]); |
4330 | * put_disk() is not paired with add_disk() and | 4338 | blk_cleanup_queue(disks[drive]->queue); |
4331 | * will put queue reference one extra time. fix it. | 4339 | disks[drive]->queue = NULL; |
4332 | */ | ||
4333 | disks[dr]->queue = NULL; | ||
4334 | } | 4340 | } |
4335 | put_disk(disks[dr]); | 4341 | put_disk(disks[drive]); |
4336 | } | 4342 | } |
4343 | destroy_workqueue(floppy_wq); | ||
4337 | return err; | 4344 | return err; |
4338 | } | 4345 | } |
4339 | 4346 | ||
@@ -4551,8 +4558,7 @@ static void __exit floppy_module_exit(void) | |||
4551 | for (drive = 0; drive < N_DRIVE; drive++) { | 4558 | for (drive = 0; drive < N_DRIVE; drive++) { |
4552 | del_timer_sync(&motor_off_timer[drive]); | 4559 | del_timer_sync(&motor_off_timer[drive]); |
4553 | 4560 | ||
4554 | if ((allowed_drive_mask & (1 << drive)) && | 4561 | if (floppy_available(drive)) { |
4555 | fdc_state[FDC(drive)].version != FDC_NONE) { | ||
4556 | del_gendisk(disks[drive]); | 4562 | del_gendisk(disks[drive]); |
4557 | device_remove_file(&floppy_device[drive].dev, &dev_attr_cmos); | 4563 | device_remove_file(&floppy_device[drive].dev, &dev_attr_cmos); |
4558 | platform_device_unregister(&floppy_device[drive]); | 4564 | platform_device_unregister(&floppy_device[drive]); |
diff --git a/drivers/block/loop.c b/drivers/block/loop.c index e9d594fd12cb..54046e51160a 100644 --- a/drivers/block/loop.c +++ b/drivers/block/loop.c | |||
@@ -976,8 +976,21 @@ static int loop_clr_fd(struct loop_device *lo) | |||
976 | if (lo->lo_state != Lo_bound) | 976 | if (lo->lo_state != Lo_bound) |
977 | return -ENXIO; | 977 | return -ENXIO; |
978 | 978 | ||
979 | if (lo->lo_refcnt > 1) /* we needed one fd for the ioctl */ | 979 | /* |
980 | return -EBUSY; | 980 | * If we've explicitly asked to tear down the loop device, |
981 | * and it has an elevated reference count, set it for auto-teardown when | ||
982 | * the last reference goes away. This stops $!~#$@ udev from | ||
983 | * preventing teardown because it decided that it needs to run blkid on | ||
984 | * the loopback device whenever they appear. xfstests is notorious for | ||
985 | * failing tests because blkid via udev races with a losetup | ||
986 | * <dev>/do something like mkfs/losetup -d <dev> causing the losetup -d | ||
987 | * command to fail with EBUSY. | ||
988 | */ | ||
989 | if (lo->lo_refcnt > 1) { | ||
990 | lo->lo_flags |= LO_FLAGS_AUTOCLEAR; | ||
991 | mutex_unlock(&lo->lo_ctl_mutex); | ||
992 | return 0; | ||
993 | } | ||
981 | 994 | ||
982 | if (filp == NULL) | 995 | if (filp == NULL) |
983 | return -EINVAL; | 996 | return -EINVAL; |
diff --git a/drivers/block/mtip32xx/mtip32xx.c b/drivers/block/mtip32xx/mtip32xx.c index f946d31d6917..adc6f36564cf 100644 --- a/drivers/block/mtip32xx/mtip32xx.c +++ b/drivers/block/mtip32xx/mtip32xx.c | |||
@@ -2035,8 +2035,9 @@ static unsigned int implicit_sector(unsigned char command, | |||
2035 | } | 2035 | } |
2036 | return rv; | 2036 | return rv; |
2037 | } | 2037 | } |
2038 | 2038 | static void mtip_set_timeout(struct driver_data *dd, | |
2039 | static void mtip_set_timeout(struct host_to_dev_fis *fis, unsigned int *timeout) | 2039 | struct host_to_dev_fis *fis, |
2040 | unsigned int *timeout, u8 erasemode) | ||
2040 | { | 2041 | { |
2041 | switch (fis->command) { | 2042 | switch (fis->command) { |
2042 | case ATA_CMD_DOWNLOAD_MICRO: | 2043 | case ATA_CMD_DOWNLOAD_MICRO: |
@@ -2044,7 +2045,10 @@ static void mtip_set_timeout(struct host_to_dev_fis *fis, unsigned int *timeout) | |||
2044 | break; | 2045 | break; |
2045 | case ATA_CMD_SEC_ERASE_UNIT: | 2046 | case ATA_CMD_SEC_ERASE_UNIT: |
2046 | case 0xFC: | 2047 | case 0xFC: |
2047 | *timeout = 240000; /* 4 minutes */ | 2048 | if (erasemode) |
2049 | *timeout = ((*(dd->port->identify + 90) * 2) * 60000); | ||
2050 | else | ||
2051 | *timeout = ((*(dd->port->identify + 89) * 2) * 60000); | ||
2048 | break; | 2052 | break; |
2049 | case ATA_CMD_STANDBYNOW1: | 2053 | case ATA_CMD_STANDBYNOW1: |
2050 | *timeout = 120000; /* 2 minutes */ | 2054 | *timeout = 120000; /* 2 minutes */ |
@@ -2087,6 +2091,7 @@ static int exec_drive_taskfile(struct driver_data *dd, | |||
2087 | unsigned int transfer_size; | 2091 | unsigned int transfer_size; |
2088 | unsigned long task_file_data; | 2092 | unsigned long task_file_data; |
2089 | int intotal = outtotal + req_task->out_size; | 2093 | int intotal = outtotal + req_task->out_size; |
2094 | int erasemode = 0; | ||
2090 | 2095 | ||
2091 | taskout = req_task->out_size; | 2096 | taskout = req_task->out_size; |
2092 | taskin = req_task->in_size; | 2097 | taskin = req_task->in_size; |
@@ -2212,7 +2217,13 @@ static int exec_drive_taskfile(struct driver_data *dd, | |||
2212 | fis.lba_hi, | 2217 | fis.lba_hi, |
2213 | fis.device); | 2218 | fis.device); |
2214 | 2219 | ||
2215 | mtip_set_timeout(&fis, &timeout); | 2220 | /* check for erase mode support during secure erase.*/ |
2221 | if ((fis.command == ATA_CMD_SEC_ERASE_UNIT) | ||
2222 | && (outbuf[0] & MTIP_SEC_ERASE_MODE)) { | ||
2223 | erasemode = 1; | ||
2224 | } | ||
2225 | |||
2226 | mtip_set_timeout(dd, &fis, &timeout, erasemode); | ||
2216 | 2227 | ||
2217 | /* Determine the correct transfer size.*/ | 2228 | /* Determine the correct transfer size.*/ |
2218 | if (force_single_sector) | 2229 | if (force_single_sector) |
diff --git a/drivers/block/mtip32xx/mtip32xx.h b/drivers/block/mtip32xx/mtip32xx.h index 18627a1d04c5..5f4a917bd8bb 100644 --- a/drivers/block/mtip32xx/mtip32xx.h +++ b/drivers/block/mtip32xx/mtip32xx.h | |||
@@ -33,6 +33,9 @@ | |||
33 | /* offset of Device Control register in PCIe extended capabilites space */ | 33 | /* offset of Device Control register in PCIe extended capabilites space */ |
34 | #define PCIE_CONFIG_EXT_DEVICE_CONTROL_OFFSET 0x48 | 34 | #define PCIE_CONFIG_EXT_DEVICE_CONTROL_OFFSET 0x48 |
35 | 35 | ||
36 | /* check for erase mode support during secure erase */ | ||
37 | #define MTIP_SEC_ERASE_MODE 0x3 | ||
38 | |||
36 | /* # of times to retry timed out/failed IOs */ | 39 | /* # of times to retry timed out/failed IOs */ |
37 | #define MTIP_MAX_RETRIES 2 | 40 | #define MTIP_MAX_RETRIES 2 |
38 | 41 | ||
diff --git a/drivers/block/xen-blkback/common.h b/drivers/block/xen-blkback/common.h index 9ad3b5ec1dc1..9a54623e52d7 100644 --- a/drivers/block/xen-blkback/common.h +++ b/drivers/block/xen-blkback/common.h | |||
@@ -158,8 +158,8 @@ struct xen_vbd { | |||
158 | struct block_device *bdev; | 158 | struct block_device *bdev; |
159 | /* Cached size parameter. */ | 159 | /* Cached size parameter. */ |
160 | sector_t size; | 160 | sector_t size; |
161 | bool flush_support; | 161 | unsigned int flush_support:1; |
162 | bool discard_secure; | 162 | unsigned int discard_secure:1; |
163 | }; | 163 | }; |
164 | 164 | ||
165 | struct backend_info; | 165 | struct backend_info; |
diff --git a/drivers/block/xen-blkback/xenbus.c b/drivers/block/xen-blkback/xenbus.c index 4f66171c6683..f58434c2617c 100644 --- a/drivers/block/xen-blkback/xenbus.c +++ b/drivers/block/xen-blkback/xenbus.c | |||
@@ -105,11 +105,10 @@ static struct xen_blkif *xen_blkif_alloc(domid_t domid) | |||
105 | { | 105 | { |
106 | struct xen_blkif *blkif; | 106 | struct xen_blkif *blkif; |
107 | 107 | ||
108 | blkif = kmem_cache_alloc(xen_blkif_cachep, GFP_KERNEL); | 108 | blkif = kmem_cache_zalloc(xen_blkif_cachep, GFP_KERNEL); |
109 | if (!blkif) | 109 | if (!blkif) |
110 | return ERR_PTR(-ENOMEM); | 110 | return ERR_PTR(-ENOMEM); |
111 | 111 | ||
112 | memset(blkif, 0, sizeof(*blkif)); | ||
113 | blkif->domid = domid; | 112 | blkif->domid = domid; |
114 | spin_lock_init(&blkif->blk_ring_lock); | 113 | spin_lock_init(&blkif->blk_ring_lock); |
115 | atomic_set(&blkif->refcnt, 1); | 114 | atomic_set(&blkif->refcnt, 1); |
@@ -196,7 +195,7 @@ static void xen_blkif_disconnect(struct xen_blkif *blkif) | |||
196 | } | 195 | } |
197 | } | 196 | } |
198 | 197 | ||
199 | void xen_blkif_free(struct xen_blkif *blkif) | 198 | static void xen_blkif_free(struct xen_blkif *blkif) |
200 | { | 199 | { |
201 | if (!atomic_dec_and_test(&blkif->refcnt)) | 200 | if (!atomic_dec_and_test(&blkif->refcnt)) |
202 | BUG(); | 201 | BUG(); |
@@ -257,7 +256,7 @@ static struct attribute_group xen_vbdstat_group = { | |||
257 | VBD_SHOW(physical_device, "%x:%x\n", be->major, be->minor); | 256 | VBD_SHOW(physical_device, "%x:%x\n", be->major, be->minor); |
258 | VBD_SHOW(mode, "%s\n", be->mode); | 257 | VBD_SHOW(mode, "%s\n", be->mode); |
259 | 258 | ||
260 | int xenvbd_sysfs_addif(struct xenbus_device *dev) | 259 | static int xenvbd_sysfs_addif(struct xenbus_device *dev) |
261 | { | 260 | { |
262 | int error; | 261 | int error; |
263 | 262 | ||
@@ -281,7 +280,7 @@ fail1: device_remove_file(&dev->dev, &dev_attr_physical_device); | |||
281 | return error; | 280 | return error; |
282 | } | 281 | } |
283 | 282 | ||
284 | void xenvbd_sysfs_delif(struct xenbus_device *dev) | 283 | static void xenvbd_sysfs_delif(struct xenbus_device *dev) |
285 | { | 284 | { |
286 | sysfs_remove_group(&dev->dev.kobj, &xen_vbdstat_group); | 285 | sysfs_remove_group(&dev->dev.kobj, &xen_vbdstat_group); |
287 | device_remove_file(&dev->dev, &dev_attr_mode); | 286 | device_remove_file(&dev->dev, &dev_attr_mode); |
diff --git a/drivers/char/sonypi.c b/drivers/char/sonypi.c index 320debbe32fa..9b4f0116ff21 100644 --- a/drivers/char/sonypi.c +++ b/drivers/char/sonypi.c | |||
@@ -1456,7 +1456,7 @@ static int __devexit sonypi_remove(struct platform_device *dev) | |||
1456 | return 0; | 1456 | return 0; |
1457 | } | 1457 | } |
1458 | 1458 | ||
1459 | #ifdef CONFIG_PM | 1459 | #ifdef CONFIG_PM_SLEEP |
1460 | static int old_camera_power; | 1460 | static int old_camera_power; |
1461 | 1461 | ||
1462 | static int sonypi_suspend(struct device *dev) | 1462 | static int sonypi_suspend(struct device *dev) |
diff --git a/drivers/cpufreq/cpufreq_stats.c b/drivers/cpufreq/cpufreq_stats.c index b40ee1403be9..399831690fed 100644 --- a/drivers/cpufreq/cpufreq_stats.c +++ b/drivers/cpufreq/cpufreq_stats.c | |||
@@ -328,6 +328,7 @@ static int __cpuinit cpufreq_stat_cpu_callback(struct notifier_block *nfb, | |||
328 | cpufreq_update_policy(cpu); | 328 | cpufreq_update_policy(cpu); |
329 | break; | 329 | break; |
330 | case CPU_DOWN_PREPARE: | 330 | case CPU_DOWN_PREPARE: |
331 | case CPU_DOWN_PREPARE_FROZEN: | ||
331 | cpufreq_stats_free_sysfs(cpu); | 332 | cpufreq_stats_free_sysfs(cpu); |
332 | break; | 333 | break; |
333 | case CPU_DEAD: | 334 | case CPU_DEAD: |
diff --git a/drivers/cpufreq/powernow-k8.c b/drivers/cpufreq/powernow-k8.c index 129e80bfff22..e3ebb4fa2c3e 100644 --- a/drivers/cpufreq/powernow-k8.c +++ b/drivers/cpufreq/powernow-k8.c | |||
@@ -5,7 +5,7 @@ | |||
5 | * http://www.gnu.org/licenses/gpl.html | 5 | * http://www.gnu.org/licenses/gpl.html |
6 | * | 6 | * |
7 | * Maintainer: | 7 | * Maintainer: |
8 | * Andreas Herrmann <andreas.herrmann3@amd.com> | 8 | * Andreas Herrmann <herrmann.der.user@googlemail.com> |
9 | * | 9 | * |
10 | * Based on the powernow-k7.c module written by Dave Jones. | 10 | * Based on the powernow-k7.c module written by Dave Jones. |
11 | * (C) 2003 Dave Jones on behalf of SuSE Labs | 11 | * (C) 2003 Dave Jones on behalf of SuSE Labs |
@@ -1052,14 +1052,7 @@ static int powernowk8_target(struct cpufreq_policy *pol, | |||
1052 | struct powernowk8_target_arg pta = { .pol = pol, .targfreq = targfreq, | 1052 | struct powernowk8_target_arg pta = { .pol = pol, .targfreq = targfreq, |
1053 | .relation = relation }; | 1053 | .relation = relation }; |
1054 | 1054 | ||
1055 | /* | 1055 | return work_on_cpu(pol->cpu, powernowk8_target_fn, &pta); |
1056 | * Must run on @pol->cpu. cpufreq core is responsible for ensuring | ||
1057 | * that we're bound to the current CPU and pol->cpu stays online. | ||
1058 | */ | ||
1059 | if (smp_processor_id() == pol->cpu) | ||
1060 | return powernowk8_target_fn(&pta); | ||
1061 | else | ||
1062 | return work_on_cpu(pol->cpu, powernowk8_target_fn, &pta); | ||
1063 | } | 1056 | } |
1064 | 1057 | ||
1065 | /* Driver entry point to verify the policy and range of frequencies */ | 1058 | /* Driver entry point to verify the policy and range of frequencies */ |
diff --git a/drivers/dma/Kconfig b/drivers/dma/Kconfig index 677cd6e4e1a1..d4c12180c654 100644 --- a/drivers/dma/Kconfig +++ b/drivers/dma/Kconfig | |||
@@ -90,6 +90,17 @@ config DW_DMAC | |||
90 | Support the Synopsys DesignWare AHB DMA controller. This | 90 | Support the Synopsys DesignWare AHB DMA controller. This |
91 | can be integrated in chips such as the Atmel AT32ap7000. | 91 | can be integrated in chips such as the Atmel AT32ap7000. |
92 | 92 | ||
93 | config DW_DMAC_BIG_ENDIAN_IO | ||
94 | bool "Use big endian I/O register access" | ||
95 | default y if AVR32 | ||
96 | depends on DW_DMAC | ||
97 | help | ||
98 | Say yes here to use big endian I/O access when reading and writing | ||
99 | to the DMA controller registers. This is needed on some platforms, | ||
100 | like the Atmel AVR32 architecture. | ||
101 | |||
102 | If unsure, use the default setting. | ||
103 | |||
93 | config AT_HDMAC | 104 | config AT_HDMAC |
94 | tristate "Atmel AHB DMA support" | 105 | tristate "Atmel AHB DMA support" |
95 | depends on ARCH_AT91 | 106 | depends on ARCH_AT91 |
diff --git a/drivers/dma/dw_dmac_regs.h b/drivers/dma/dw_dmac_regs.h index ff39fa6cd2bc..88965597b7d0 100644 --- a/drivers/dma/dw_dmac_regs.h +++ b/drivers/dma/dw_dmac_regs.h | |||
@@ -98,9 +98,17 @@ struct dw_dma_regs { | |||
98 | u32 DW_PARAMS; | 98 | u32 DW_PARAMS; |
99 | }; | 99 | }; |
100 | 100 | ||
101 | #ifdef CONFIG_DW_DMAC_BIG_ENDIAN_IO | ||
102 | #define dma_readl_native ioread32be | ||
103 | #define dma_writel_native iowrite32be | ||
104 | #else | ||
105 | #define dma_readl_native readl | ||
106 | #define dma_writel_native writel | ||
107 | #endif | ||
108 | |||
101 | /* To access the registers in early stage of probe */ | 109 | /* To access the registers in early stage of probe */ |
102 | #define dma_read_byaddr(addr, name) \ | 110 | #define dma_read_byaddr(addr, name) \ |
103 | readl((addr) + offsetof(struct dw_dma_regs, name)) | 111 | dma_readl_native((addr) + offsetof(struct dw_dma_regs, name)) |
104 | 112 | ||
105 | /* Bitfields in DW_PARAMS */ | 113 | /* Bitfields in DW_PARAMS */ |
106 | #define DW_PARAMS_NR_CHAN 8 /* number of channels */ | 114 | #define DW_PARAMS_NR_CHAN 8 /* number of channels */ |
@@ -216,9 +224,9 @@ __dwc_regs(struct dw_dma_chan *dwc) | |||
216 | } | 224 | } |
217 | 225 | ||
218 | #define channel_readl(dwc, name) \ | 226 | #define channel_readl(dwc, name) \ |
219 | readl(&(__dwc_regs(dwc)->name)) | 227 | dma_readl_native(&(__dwc_regs(dwc)->name)) |
220 | #define channel_writel(dwc, name, val) \ | 228 | #define channel_writel(dwc, name, val) \ |
221 | writel((val), &(__dwc_regs(dwc)->name)) | 229 | dma_writel_native((val), &(__dwc_regs(dwc)->name)) |
222 | 230 | ||
223 | static inline struct dw_dma_chan *to_dw_dma_chan(struct dma_chan *chan) | 231 | static inline struct dw_dma_chan *to_dw_dma_chan(struct dma_chan *chan) |
224 | { | 232 | { |
@@ -246,9 +254,9 @@ static inline struct dw_dma_regs __iomem *__dw_regs(struct dw_dma *dw) | |||
246 | } | 254 | } |
247 | 255 | ||
248 | #define dma_readl(dw, name) \ | 256 | #define dma_readl(dw, name) \ |
249 | readl(&(__dw_regs(dw)->name)) | 257 | dma_readl_native(&(__dw_regs(dw)->name)) |
250 | #define dma_writel(dw, name, val) \ | 258 | #define dma_writel(dw, name, val) \ |
251 | writel((val), &(__dw_regs(dw)->name)) | 259 | dma_writel_native((val), &(__dw_regs(dw)->name)) |
252 | 260 | ||
253 | #define channel_set_bit(dw, reg, mask) \ | 261 | #define channel_set_bit(dw, reg, mask) \ |
254 | dma_writel(dw, reg, ((mask) << 8) | (mask)) | 262 | dma_writel(dw, reg, ((mask) << 8) | (mask)) |
diff --git a/drivers/dma/imx-dma.c b/drivers/dma/imx-dma.c index f11b5b2b1a1c..7d9554cc4976 100644 --- a/drivers/dma/imx-dma.c +++ b/drivers/dma/imx-dma.c | |||
@@ -474,8 +474,10 @@ static int imxdma_xfer_desc(struct imxdma_desc *d) | |||
474 | slot = i; | 474 | slot = i; |
475 | break; | 475 | break; |
476 | } | 476 | } |
477 | if (slot < 0) | 477 | if (slot < 0) { |
478 | spin_unlock_irqrestore(&imxdma->lock, flags); | ||
478 | return -EBUSY; | 479 | return -EBUSY; |
480 | } | ||
479 | 481 | ||
480 | imxdma->slots_2d[slot].xsr = d->x; | 482 | imxdma->slots_2d[slot].xsr = d->x; |
481 | imxdma->slots_2d[slot].ysr = d->y; | 483 | imxdma->slots_2d[slot].ysr = d->y; |
diff --git a/drivers/dma/sirf-dma.c b/drivers/dma/sirf-dma.c index 64385cde044b..d451caace806 100644 --- a/drivers/dma/sirf-dma.c +++ b/drivers/dma/sirf-dma.c | |||
@@ -109,7 +109,7 @@ static void sirfsoc_dma_execute(struct sirfsoc_dma_chan *schan) | |||
109 | sdesc = list_first_entry(&schan->queued, struct sirfsoc_dma_desc, | 109 | sdesc = list_first_entry(&schan->queued, struct sirfsoc_dma_desc, |
110 | node); | 110 | node); |
111 | /* Move the first queued descriptor to active list */ | 111 | /* Move the first queued descriptor to active list */ |
112 | list_move_tail(&schan->queued, &schan->active); | 112 | list_move_tail(&sdesc->node, &schan->active); |
113 | 113 | ||
114 | /* Start the DMA transfer */ | 114 | /* Start the DMA transfer */ |
115 | writel_relaxed(sdesc->width, sdma->base + SIRFSOC_DMA_WIDTH_0 + | 115 | writel_relaxed(sdesc->width, sdma->base + SIRFSOC_DMA_WIDTH_0 + |
@@ -428,7 +428,7 @@ static struct dma_async_tx_descriptor *sirfsoc_dma_prep_interleaved( | |||
428 | unsigned long iflags; | 428 | unsigned long iflags; |
429 | int ret; | 429 | int ret; |
430 | 430 | ||
431 | if ((xt->dir != DMA_MEM_TO_DEV) || (xt->dir != DMA_DEV_TO_MEM)) { | 431 | if ((xt->dir != DMA_MEM_TO_DEV) && (xt->dir != DMA_DEV_TO_MEM)) { |
432 | ret = -EINVAL; | 432 | ret = -EINVAL; |
433 | goto err_dir; | 433 | goto err_dir; |
434 | } | 434 | } |
diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c index 5a297a26211d..cc8e7c78a23c 100644 --- a/drivers/edac/amd64_edac.c +++ b/drivers/edac/amd64_edac.c | |||
@@ -170,8 +170,11 @@ static int __amd64_set_scrub_rate(struct pci_dev *ctl, u32 new_bw, u32 min_rate) | |||
170 | * memory controller and apply to register. Search for the first | 170 | * memory controller and apply to register. Search for the first |
171 | * bandwidth entry that is greater or equal than the setting requested | 171 | * bandwidth entry that is greater or equal than the setting requested |
172 | * and program that. If at last entry, turn off DRAM scrubbing. | 172 | * and program that. If at last entry, turn off DRAM scrubbing. |
173 | * | ||
174 | * If no suitable bandwidth is found, turn off DRAM scrubbing entirely | ||
175 | * by falling back to the last element in scrubrates[]. | ||
173 | */ | 176 | */ |
174 | for (i = 0; i < ARRAY_SIZE(scrubrates); i++) { | 177 | for (i = 0; i < ARRAY_SIZE(scrubrates) - 1; i++) { |
175 | /* | 178 | /* |
176 | * skip scrub rates which aren't recommended | 179 | * skip scrub rates which aren't recommended |
177 | * (see F10 BKDG, F3x58) | 180 | * (see F10 BKDG, F3x58) |
@@ -181,12 +184,6 @@ static int __amd64_set_scrub_rate(struct pci_dev *ctl, u32 new_bw, u32 min_rate) | |||
181 | 184 | ||
182 | if (scrubrates[i].bandwidth <= new_bw) | 185 | if (scrubrates[i].bandwidth <= new_bw) |
183 | break; | 186 | break; |
184 | |||
185 | /* | ||
186 | * if no suitable bandwidth found, turn off DRAM scrubbing | ||
187 | * entirely by falling back to the last element in the | ||
188 | * scrubrates array. | ||
189 | */ | ||
190 | } | 187 | } |
191 | 188 | ||
192 | scrubval = scrubrates[i].scrubval; | 189 | scrubval = scrubrates[i].scrubval; |
diff --git a/drivers/extcon/extcon-adc-jack.c b/drivers/extcon/extcon-adc-jack.c index 725eb5aa8d8c..e87196f6d2d2 100644 --- a/drivers/extcon/extcon-adc-jack.c +++ b/drivers/extcon/extcon-adc-jack.c | |||
@@ -14,6 +14,7 @@ | |||
14 | * | 14 | * |
15 | */ | 15 | */ |
16 | 16 | ||
17 | #include <linux/module.h> | ||
17 | #include <linux/slab.h> | 18 | #include <linux/slab.h> |
18 | #include <linux/device.h> | 19 | #include <linux/device.h> |
19 | #include <linux/platform_device.h> | 20 | #include <linux/platform_device.h> |
@@ -161,13 +162,12 @@ static int __devinit adc_jack_probe(struct platform_device *pdev) | |||
161 | err = request_any_context_irq(data->irq, adc_jack_irq_thread, | 162 | err = request_any_context_irq(data->irq, adc_jack_irq_thread, |
162 | pdata->irq_flags, pdata->name, data); | 163 | pdata->irq_flags, pdata->name, data); |
163 | 164 | ||
164 | if (err) { | 165 | if (err < 0) { |
165 | dev_err(&pdev->dev, "error: irq %d\n", data->irq); | 166 | dev_err(&pdev->dev, "error: irq %d\n", data->irq); |
166 | err = -EINVAL; | ||
167 | goto err_irq; | 167 | goto err_irq; |
168 | } | 168 | } |
169 | 169 | ||
170 | goto out; | 170 | return 0; |
171 | 171 | ||
172 | err_irq: | 172 | err_irq: |
173 | extcon_dev_unregister(&data->edev); | 173 | extcon_dev_unregister(&data->edev); |
@@ -196,3 +196,7 @@ static struct platform_driver adc_jack_driver = { | |||
196 | }; | 196 | }; |
197 | 197 | ||
198 | module_platform_driver(adc_jack_driver); | 198 | module_platform_driver(adc_jack_driver); |
199 | |||
200 | MODULE_AUTHOR("MyungJoo Ham <myungjoo.ham@samsung.com>"); | ||
201 | MODULE_DESCRIPTION("ADC Jack extcon driver"); | ||
202 | MODULE_LICENSE("GPL v2"); | ||
diff --git a/drivers/extcon/extcon-class.c b/drivers/extcon/extcon-class.c index 946a3188b2b7..d398821097f3 100644 --- a/drivers/extcon/extcon-class.c +++ b/drivers/extcon/extcon-class.c | |||
@@ -41,7 +41,7 @@ | |||
41 | * every single port-type of the following cable names. Please choose cable | 41 | * every single port-type of the following cable names. Please choose cable |
42 | * names that are actually used in your extcon device. | 42 | * names that are actually used in your extcon device. |
43 | */ | 43 | */ |
44 | const char *extcon_cable_name[] = { | 44 | const char extcon_cable_name[][CABLE_NAME_MAX + 1] = { |
45 | [EXTCON_USB] = "USB", | 45 | [EXTCON_USB] = "USB", |
46 | [EXTCON_USB_HOST] = "USB-Host", | 46 | [EXTCON_USB_HOST] = "USB-Host", |
47 | [EXTCON_TA] = "TA", | 47 | [EXTCON_TA] = "TA", |
@@ -62,8 +62,6 @@ const char *extcon_cable_name[] = { | |||
62 | [EXTCON_VIDEO_IN] = "Video-in", | 62 | [EXTCON_VIDEO_IN] = "Video-in", |
63 | [EXTCON_VIDEO_OUT] = "Video-out", | 63 | [EXTCON_VIDEO_OUT] = "Video-out", |
64 | [EXTCON_MECHANICAL] = "Mechanical", | 64 | [EXTCON_MECHANICAL] = "Mechanical", |
65 | |||
66 | NULL, | ||
67 | }; | 65 | }; |
68 | 66 | ||
69 | static struct class *extcon_class; | 67 | static struct class *extcon_class; |
@@ -91,17 +89,13 @@ static int check_mutually_exclusive(struct extcon_dev *edev, u32 new_state) | |||
91 | return 0; | 89 | return 0; |
92 | 90 | ||
93 | for (i = 0; edev->mutually_exclusive[i]; i++) { | 91 | for (i = 0; edev->mutually_exclusive[i]; i++) { |
94 | int count = 0, j; | 92 | int weight; |
95 | u32 correspondants = new_state & edev->mutually_exclusive[i]; | 93 | u32 correspondants = new_state & edev->mutually_exclusive[i]; |
96 | u32 exp = 1; | 94 | |
97 | 95 | /* calculate the total number of bits set */ | |
98 | for (j = 0; j < 32; j++) { | 96 | weight = hweight32(correspondants); |
99 | if (exp & correspondants) | 97 | if (weight > 1) |
100 | count++; | 98 | return i + 1; |
101 | if (count > 1) | ||
102 | return i + 1; | ||
103 | exp <<= 1; | ||
104 | } | ||
105 | } | 99 | } |
106 | 100 | ||
107 | return 0; | 101 | return 0; |
@@ -362,7 +356,7 @@ int extcon_get_cable_state(struct extcon_dev *edev, const char *cable_name) | |||
362 | EXPORT_SYMBOL_GPL(extcon_get_cable_state); | 356 | EXPORT_SYMBOL_GPL(extcon_get_cable_state); |
363 | 357 | ||
364 | /** | 358 | /** |
365 | * extcon_get_cable_state_() - Set the status of a specific cable. | 359 | * extcon_set_cable_state_() - Set the status of a specific cable. |
366 | * @edev: the extcon device that has the cable. | 360 | * @edev: the extcon device that has the cable. |
367 | * @index: cable index that can be retrieved by extcon_find_cable_index(). | 361 | * @index: cable index that can be retrieved by extcon_find_cable_index(). |
368 | * @cable_state: the new cable status. The default semantics is | 362 | * @cable_state: the new cable status. The default semantics is |
@@ -382,7 +376,7 @@ int extcon_set_cable_state_(struct extcon_dev *edev, | |||
382 | EXPORT_SYMBOL_GPL(extcon_set_cable_state_); | 376 | EXPORT_SYMBOL_GPL(extcon_set_cable_state_); |
383 | 377 | ||
384 | /** | 378 | /** |
385 | * extcon_get_cable_state() - Set the status of a specific cable. | 379 | * extcon_set_cable_state() - Set the status of a specific cable. |
386 | * @edev: the extcon device that has the cable. | 380 | * @edev: the extcon device that has the cable. |
387 | * @cable_name: cable name. | 381 | * @cable_name: cable name. |
388 | * @cable_state: the new cable status. The default semantics is | 382 | * @cable_state: the new cable status. The default semantics is |
@@ -447,6 +441,8 @@ static int _call_per_cable(struct notifier_block *nb, unsigned long val, | |||
447 | * extcon device. | 441 | * extcon device. |
448 | * @obj: an empty extcon_specific_cable_nb object to be returned. | 442 | * @obj: an empty extcon_specific_cable_nb object to be returned. |
449 | * @extcon_name: the name of extcon device. | 443 | * @extcon_name: the name of extcon device. |
444 | * if NULL, extcon_register_interest will register | ||
445 | * every cable with the target cable_name given. | ||
450 | * @cable_name: the target cable name. | 446 | * @cable_name: the target cable name. |
451 | * @nb: the notifier block to get notified. | 447 | * @nb: the notifier block to get notified. |
452 | * | 448 | * |
@@ -466,22 +462,44 @@ int extcon_register_interest(struct extcon_specific_cable_nb *obj, | |||
466 | const char *extcon_name, const char *cable_name, | 462 | const char *extcon_name, const char *cable_name, |
467 | struct notifier_block *nb) | 463 | struct notifier_block *nb) |
468 | { | 464 | { |
469 | if (!obj || !extcon_name || !cable_name || !nb) | 465 | if (!obj || !cable_name || !nb) |
470 | return -EINVAL; | 466 | return -EINVAL; |
471 | 467 | ||
472 | obj->edev = extcon_get_extcon_dev(extcon_name); | 468 | if (extcon_name) { |
473 | if (!obj->edev) | 469 | obj->edev = extcon_get_extcon_dev(extcon_name); |
474 | return -ENODEV; | 470 | if (!obj->edev) |
471 | return -ENODEV; | ||
475 | 472 | ||
476 | obj->cable_index = extcon_find_cable_index(obj->edev, cable_name); | 473 | obj->cable_index = extcon_find_cable_index(obj->edev, cable_name); |
477 | if (obj->cable_index < 0) | 474 | if (obj->cable_index < 0) |
478 | return -ENODEV; | 475 | return -ENODEV; |
476 | |||
477 | obj->user_nb = nb; | ||
479 | 478 | ||
480 | obj->user_nb = nb; | 479 | obj->internal_nb.notifier_call = _call_per_cable; |
481 | 480 | ||
482 | obj->internal_nb.notifier_call = _call_per_cable; | 481 | return raw_notifier_chain_register(&obj->edev->nh, &obj->internal_nb); |
482 | } else { | ||
483 | struct class_dev_iter iter; | ||
484 | struct extcon_dev *extd; | ||
485 | struct device *dev; | ||
486 | |||
487 | if (!extcon_class) | ||
488 | return -ENODEV; | ||
489 | class_dev_iter_init(&iter, extcon_class, NULL, NULL); | ||
490 | while ((dev = class_dev_iter_next(&iter))) { | ||
491 | extd = (struct extcon_dev *)dev_get_drvdata(dev); | ||
492 | |||
493 | if (extcon_find_cable_index(extd, cable_name) < 0) | ||
494 | continue; | ||
495 | |||
496 | class_dev_iter_exit(&iter); | ||
497 | return extcon_register_interest(obj, extd->name, | ||
498 | cable_name, nb); | ||
499 | } | ||
483 | 500 | ||
484 | return raw_notifier_chain_register(&obj->edev->nh, &obj->internal_nb); | 501 | return -ENODEV; |
502 | } | ||
485 | } | 503 | } |
486 | 504 | ||
487 | /** | 505 | /** |
@@ -551,43 +569,9 @@ static int create_extcon_class(void) | |||
551 | return 0; | 569 | return 0; |
552 | } | 570 | } |
553 | 571 | ||
554 | static void extcon_cleanup(struct extcon_dev *edev, bool skip) | ||
555 | { | ||
556 | mutex_lock(&extcon_dev_list_lock); | ||
557 | list_del(&edev->entry); | ||
558 | mutex_unlock(&extcon_dev_list_lock); | ||
559 | |||
560 | if (!skip && get_device(edev->dev)) { | ||
561 | int index; | ||
562 | |||
563 | if (edev->mutually_exclusive && edev->max_supported) { | ||
564 | for (index = 0; edev->mutually_exclusive[index]; | ||
565 | index++) | ||
566 | kfree(edev->d_attrs_muex[index].attr.name); | ||
567 | kfree(edev->d_attrs_muex); | ||
568 | kfree(edev->attrs_muex); | ||
569 | } | ||
570 | |||
571 | for (index = 0; index < edev->max_supported; index++) | ||
572 | kfree(edev->cables[index].attr_g.name); | ||
573 | |||
574 | if (edev->max_supported) { | ||
575 | kfree(edev->extcon_dev_type.groups); | ||
576 | kfree(edev->cables); | ||
577 | } | ||
578 | |||
579 | device_unregister(edev->dev); | ||
580 | put_device(edev->dev); | ||
581 | } | ||
582 | |||
583 | kfree(edev->dev); | ||
584 | } | ||
585 | |||
586 | static void extcon_dev_release(struct device *dev) | 572 | static void extcon_dev_release(struct device *dev) |
587 | { | 573 | { |
588 | struct extcon_dev *edev = (struct extcon_dev *) dev_get_drvdata(dev); | 574 | kfree(dev); |
589 | |||
590 | extcon_cleanup(edev, true); | ||
591 | } | 575 | } |
592 | 576 | ||
593 | static const char *muex_name = "mutually_exclusive"; | 577 | static const char *muex_name = "mutually_exclusive"; |
@@ -813,7 +797,40 @@ EXPORT_SYMBOL_GPL(extcon_dev_register); | |||
813 | */ | 797 | */ |
814 | void extcon_dev_unregister(struct extcon_dev *edev) | 798 | void extcon_dev_unregister(struct extcon_dev *edev) |
815 | { | 799 | { |
816 | extcon_cleanup(edev, false); | 800 | int index; |
801 | |||
802 | mutex_lock(&extcon_dev_list_lock); | ||
803 | list_del(&edev->entry); | ||
804 | mutex_unlock(&extcon_dev_list_lock); | ||
805 | |||
806 | if (IS_ERR_OR_NULL(get_device(edev->dev))) { | ||
807 | dev_err(edev->dev, "Failed to unregister extcon_dev (%s)\n", | ||
808 | dev_name(edev->dev)); | ||
809 | return; | ||
810 | } | ||
811 | |||
812 | if (edev->mutually_exclusive && edev->max_supported) { | ||
813 | for (index = 0; edev->mutually_exclusive[index]; | ||
814 | index++) | ||
815 | kfree(edev->d_attrs_muex[index].attr.name); | ||
816 | kfree(edev->d_attrs_muex); | ||
817 | kfree(edev->attrs_muex); | ||
818 | } | ||
819 | |||
820 | for (index = 0; index < edev->max_supported; index++) | ||
821 | kfree(edev->cables[index].attr_g.name); | ||
822 | |||
823 | if (edev->max_supported) { | ||
824 | kfree(edev->extcon_dev_type.groups); | ||
825 | kfree(edev->cables); | ||
826 | } | ||
827 | |||
828 | #if defined(CONFIG_ANDROID) | ||
829 | if (switch_class) | ||
830 | class_compat_remove_link(switch_class, edev->dev, NULL); | ||
831 | #endif | ||
832 | device_unregister(edev->dev); | ||
833 | put_device(edev->dev); | ||
817 | } | 834 | } |
818 | EXPORT_SYMBOL_GPL(extcon_dev_unregister); | 835 | EXPORT_SYMBOL_GPL(extcon_dev_unregister); |
819 | 836 | ||
@@ -825,6 +842,9 @@ module_init(extcon_class_init); | |||
825 | 842 | ||
826 | static void __exit extcon_class_exit(void) | 843 | static void __exit extcon_class_exit(void) |
827 | { | 844 | { |
845 | #if defined(CONFIG_ANDROID) | ||
846 | class_compat_unregister(switch_class); | ||
847 | #endif | ||
828 | class_destroy(extcon_class); | 848 | class_destroy(extcon_class); |
829 | } | 849 | } |
830 | module_exit(extcon_class_exit); | 850 | module_exit(extcon_class_exit); |
diff --git a/drivers/extcon/extcon-gpio.c b/drivers/extcon/extcon-gpio.c index 3cc152e690b0..71d3ab7b3d8d 100644 --- a/drivers/extcon/extcon-gpio.c +++ b/drivers/extcon/extcon-gpio.c | |||
@@ -26,7 +26,6 @@ | |||
26 | #include <linux/interrupt.h> | 26 | #include <linux/interrupt.h> |
27 | #include <linux/platform_device.h> | 27 | #include <linux/platform_device.h> |
28 | #include <linux/slab.h> | 28 | #include <linux/slab.h> |
29 | #include <linux/extcon.h> | ||
30 | #include <linux/workqueue.h> | 29 | #include <linux/workqueue.h> |
31 | #include <linux/gpio.h> | 30 | #include <linux/gpio.h> |
32 | #include <linux/extcon.h> | 31 | #include <linux/extcon.h> |
diff --git a/drivers/extcon/extcon-max77693.c b/drivers/extcon/extcon-max77693.c index e21387e2da5c..a17d0d91ada2 100644 --- a/drivers/extcon/extcon-max77693.c +++ b/drivers/extcon/extcon-max77693.c | |||
@@ -239,25 +239,19 @@ const char *max77693_extcon_cable[] = { | |||
239 | static int max77693_muic_set_debounce_time(struct max77693_muic_info *info, | 239 | static int max77693_muic_set_debounce_time(struct max77693_muic_info *info, |
240 | enum max77693_muic_adc_debounce_time time) | 240 | enum max77693_muic_adc_debounce_time time) |
241 | { | 241 | { |
242 | int ret = 0; | 242 | int ret; |
243 | u8 ctrl3; | ||
244 | 243 | ||
245 | switch (time) { | 244 | switch (time) { |
246 | case ADC_DEBOUNCE_TIME_5MS: | 245 | case ADC_DEBOUNCE_TIME_5MS: |
247 | case ADC_DEBOUNCE_TIME_10MS: | 246 | case ADC_DEBOUNCE_TIME_10MS: |
248 | case ADC_DEBOUNCE_TIME_25MS: | 247 | case ADC_DEBOUNCE_TIME_25MS: |
249 | case ADC_DEBOUNCE_TIME_38_62MS: | 248 | case ADC_DEBOUNCE_TIME_38_62MS: |
250 | ret = max77693_read_reg(info->max77693->regmap_muic, | 249 | ret = max77693_update_reg(info->max77693->regmap_muic, |
251 | MAX77693_MUIC_REG_CTRL3, &ctrl3); | 250 | MAX77693_MUIC_REG_CTRL3, |
252 | ctrl3 &= ~CONTROL3_ADCDBSET_MASK; | 251 | time << CONTROL3_ADCDBSET_SHIFT, |
253 | ctrl3 |= (time << CONTROL3_ADCDBSET_SHIFT); | 252 | CONTROL3_ADCDBSET_MASK); |
254 | 253 | if (ret) | |
255 | ret = max77693_write_reg(info->max77693->regmap_muic, | ||
256 | MAX77693_MUIC_REG_CTRL3, ctrl3); | ||
257 | if (ret) { | ||
258 | dev_err(info->dev, "failed to set ADC debounce time\n"); | 254 | dev_err(info->dev, "failed to set ADC debounce time\n"); |
259 | ret = -EINVAL; | ||
260 | } | ||
261 | break; | 255 | break; |
262 | default: | 256 | default: |
263 | dev_err(info->dev, "invalid ADC debounce time\n"); | 257 | dev_err(info->dev, "invalid ADC debounce time\n"); |
@@ -657,6 +651,8 @@ out: | |||
657 | static int __devinit max77693_muic_probe(struct platform_device *pdev) | 651 | static int __devinit max77693_muic_probe(struct platform_device *pdev) |
658 | { | 652 | { |
659 | struct max77693_dev *max77693 = dev_get_drvdata(pdev->dev.parent); | 653 | struct max77693_dev *max77693 = dev_get_drvdata(pdev->dev.parent); |
654 | struct max77693_platform_data *pdata = dev_get_platdata(max77693->dev); | ||
655 | struct max77693_muic_platform_data *muic_pdata = pdata->muic_data; | ||
660 | struct max77693_muic_info *info; | 656 | struct max77693_muic_info *info; |
661 | int ret, i; | 657 | int ret, i; |
662 | u8 id; | 658 | u8 id; |
@@ -727,6 +723,31 @@ static int __devinit max77693_muic_probe(struct platform_device *pdev) | |||
727 | goto err_extcon; | 723 | goto err_extcon; |
728 | } | 724 | } |
729 | 725 | ||
726 | /* Initialize MUIC register by using platform data */ | ||
727 | for (i = 0 ; i < muic_pdata->num_init_data ; i++) { | ||
728 | enum max77693_irq_source irq_src = MAX77693_IRQ_GROUP_NR; | ||
729 | |||
730 | max77693_write_reg(info->max77693->regmap_muic, | ||
731 | muic_pdata->init_data[i].addr, | ||
732 | muic_pdata->init_data[i].data); | ||
733 | |||
734 | switch (muic_pdata->init_data[i].addr) { | ||
735 | case MAX77693_MUIC_REG_INTMASK1: | ||
736 | irq_src = MUIC_INT1; | ||
737 | break; | ||
738 | case MAX77693_MUIC_REG_INTMASK2: | ||
739 | irq_src = MUIC_INT2; | ||
740 | break; | ||
741 | case MAX77693_MUIC_REG_INTMASK3: | ||
742 | irq_src = MUIC_INT3; | ||
743 | break; | ||
744 | } | ||
745 | |||
746 | if (irq_src < MAX77693_IRQ_GROUP_NR) | ||
747 | info->max77693->irq_masks_cur[irq_src] | ||
748 | = muic_pdata->init_data[i].data; | ||
749 | } | ||
750 | |||
730 | /* Check revision number of MUIC device*/ | 751 | /* Check revision number of MUIC device*/ |
731 | ret = max77693_read_reg(info->max77693->regmap_muic, | 752 | ret = max77693_read_reg(info->max77693->regmap_muic, |
732 | MAX77693_MUIC_REG_ID, &id); | 753 | MAX77693_MUIC_REG_ID, &id); |
@@ -762,6 +783,7 @@ static int __devexit max77693_muic_remove(struct platform_device *pdev) | |||
762 | free_irq(muic_irqs[i].virq, info); | 783 | free_irq(muic_irqs[i].virq, info); |
763 | cancel_work_sync(&info->irq_work); | 784 | cancel_work_sync(&info->irq_work); |
764 | extcon_dev_unregister(info->edev); | 785 | extcon_dev_unregister(info->edev); |
786 | kfree(info->edev); | ||
765 | kfree(info); | 787 | kfree(info); |
766 | 788 | ||
767 | return 0; | 789 | return 0; |
diff --git a/drivers/extcon/extcon-max8997.c b/drivers/extcon/extcon-max8997.c index ef9090a4271d..77b66b0cc8f5 100644 --- a/drivers/extcon/extcon-max8997.c +++ b/drivers/extcon/extcon-max8997.c | |||
@@ -271,8 +271,6 @@ out: | |||
271 | static int max8997_muic_handle_charger_type_detach( | 271 | static int max8997_muic_handle_charger_type_detach( |
272 | struct max8997_muic_info *info) | 272 | struct max8997_muic_info *info) |
273 | { | 273 | { |
274 | int ret = 0; | ||
275 | |||
276 | switch (info->pre_charger_type) { | 274 | switch (info->pre_charger_type) { |
277 | case MAX8997_CHARGER_TYPE_USB: | 275 | case MAX8997_CHARGER_TYPE_USB: |
278 | extcon_set_cable_state(info->edev, "USB", false); | 276 | extcon_set_cable_state(info->edev, "USB", false); |
@@ -290,11 +288,11 @@ static int max8997_muic_handle_charger_type_detach( | |||
290 | extcon_set_cable_state(info->edev, "Fast-charger", false); | 288 | extcon_set_cable_state(info->edev, "Fast-charger", false); |
291 | break; | 289 | break; |
292 | default: | 290 | default: |
293 | ret = -EINVAL; | 291 | return -EINVAL; |
294 | break; | 292 | break; |
295 | } | 293 | } |
296 | 294 | ||
297 | return ret; | 295 | return 0; |
298 | } | 296 | } |
299 | 297 | ||
300 | static int max8997_muic_handle_charger_type(struct max8997_muic_info *info, | 298 | static int max8997_muic_handle_charger_type(struct max8997_muic_info *info, |
diff --git a/drivers/gpio/gpio-74x164.c b/drivers/gpio/gpio-74x164.c index ed3e55161bdc..f05e54258ffb 100644 --- a/drivers/gpio/gpio-74x164.c +++ b/drivers/gpio/gpio-74x164.c | |||
@@ -153,7 +153,7 @@ static int __devinit gen_74x164_probe(struct spi_device *spi) | |||
153 | } | 153 | } |
154 | 154 | ||
155 | chip->gpio_chip.ngpio = GEN_74X164_NUMBER_GPIOS * chip->registers; | 155 | chip->gpio_chip.ngpio = GEN_74X164_NUMBER_GPIOS * chip->registers; |
156 | chip->buffer = devm_kzalloc(&spi->dev, chip->gpio_chip.ngpio, GFP_KERNEL); | 156 | chip->buffer = devm_kzalloc(&spi->dev, chip->registers, GFP_KERNEL); |
157 | if (!chip->buffer) { | 157 | if (!chip->buffer) { |
158 | ret = -ENOMEM; | 158 | ret = -ENOMEM; |
159 | goto exit_destroy; | 159 | goto exit_destroy; |
diff --git a/drivers/gpio/gpio-mvebu.c b/drivers/gpio/gpio-mvebu.c index 7a874129e5d8..cf7afb9eb61a 100644 --- a/drivers/gpio/gpio-mvebu.c +++ b/drivers/gpio/gpio-mvebu.c | |||
@@ -244,6 +244,8 @@ static int mvebu_gpio_direction_output(struct gpio_chip *chip, unsigned pin, | |||
244 | if (ret) | 244 | if (ret) |
245 | return ret; | 245 | return ret; |
246 | 246 | ||
247 | mvebu_gpio_set(chip, pin, value); | ||
248 | |||
247 | spin_lock_irqsave(&mvchip->lock, flags); | 249 | spin_lock_irqsave(&mvchip->lock, flags); |
248 | u = readl_relaxed(mvebu_gpioreg_io_conf(mvchip)); | 250 | u = readl_relaxed(mvebu_gpioreg_io_conf(mvchip)); |
249 | u &= ~(1 << pin); | 251 | u &= ~(1 << pin); |
@@ -644,7 +646,7 @@ static int __devinit mvebu_gpio_probe(struct platform_device *pdev) | |||
644 | ct->handler = handle_edge_irq; | 646 | ct->handler = handle_edge_irq; |
645 | ct->chip.name = mvchip->chip.label; | 647 | ct->chip.name = mvchip->chip.label; |
646 | 648 | ||
647 | irq_setup_generic_chip(gc, IRQ_MSK(ngpios), IRQ_GC_INIT_MASK_CACHE, | 649 | irq_setup_generic_chip(gc, IRQ_MSK(ngpios), 0, |
648 | IRQ_NOREQUEST, IRQ_LEVEL | IRQ_NOPROBE); | 650 | IRQ_NOREQUEST, IRQ_LEVEL | IRQ_NOPROBE); |
649 | 651 | ||
650 | /* Setup irq domain on top of the generic chip. */ | 652 | /* Setup irq domain on top of the generic chip. */ |
diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c index 94cbc842fbc3..d335af1d4d85 100644 --- a/drivers/gpio/gpio-omap.c +++ b/drivers/gpio/gpio-omap.c | |||
@@ -251,6 +251,40 @@ static void _set_gpio_debounce(struct gpio_bank *bank, unsigned gpio, | |||
251 | } | 251 | } |
252 | } | 252 | } |
253 | 253 | ||
254 | /** | ||
255 | * _clear_gpio_debounce - clear debounce settings for a gpio | ||
256 | * @bank: the gpio bank we're acting upon | ||
257 | * @gpio: the gpio number on this @gpio | ||
258 | * | ||
259 | * If a gpio is using debounce, then clear the debounce enable bit and if | ||
260 | * this is the only gpio in this bank using debounce, then clear the debounce | ||
261 | * time too. The debounce clock will also be disabled when calling this function | ||
262 | * if this is the only gpio in the bank using debounce. | ||
263 | */ | ||
264 | static void _clear_gpio_debounce(struct gpio_bank *bank, unsigned gpio) | ||
265 | { | ||
266 | u32 gpio_bit = GPIO_BIT(bank, gpio); | ||
267 | |||
268 | if (!bank->dbck_flag) | ||
269 | return; | ||
270 | |||
271 | if (!(bank->dbck_enable_mask & gpio_bit)) | ||
272 | return; | ||
273 | |||
274 | bank->dbck_enable_mask &= ~gpio_bit; | ||
275 | bank->context.debounce_en &= ~gpio_bit; | ||
276 | __raw_writel(bank->context.debounce_en, | ||
277 | bank->base + bank->regs->debounce_en); | ||
278 | |||
279 | if (!bank->dbck_enable_mask) { | ||
280 | bank->context.debounce = 0; | ||
281 | __raw_writel(bank->context.debounce, bank->base + | ||
282 | bank->regs->debounce); | ||
283 | clk_disable(bank->dbck); | ||
284 | bank->dbck_enabled = false; | ||
285 | } | ||
286 | } | ||
287 | |||
254 | static inline void set_gpio_trigger(struct gpio_bank *bank, int gpio, | 288 | static inline void set_gpio_trigger(struct gpio_bank *bank, int gpio, |
255 | unsigned trigger) | 289 | unsigned trigger) |
256 | { | 290 | { |
@@ -539,6 +573,7 @@ static void _reset_gpio(struct gpio_bank *bank, int gpio) | |||
539 | _set_gpio_irqenable(bank, gpio, 0); | 573 | _set_gpio_irqenable(bank, gpio, 0); |
540 | _clear_gpio_irqstatus(bank, gpio); | 574 | _clear_gpio_irqstatus(bank, gpio); |
541 | _set_gpio_triggering(bank, GPIO_INDEX(bank, gpio), IRQ_TYPE_NONE); | 575 | _set_gpio_triggering(bank, GPIO_INDEX(bank, gpio), IRQ_TYPE_NONE); |
576 | _clear_gpio_debounce(bank, gpio); | ||
542 | } | 577 | } |
543 | 578 | ||
544 | /* Use disable_irq_wake() and enable_irq_wake() functions from drivers */ | 579 | /* Use disable_irq_wake() and enable_irq_wake() functions from drivers */ |
diff --git a/drivers/gpio/gpio-timberdale.c b/drivers/gpio/gpio-timberdale.c index 031c6adf5b65..1a3e2b9b4772 100644 --- a/drivers/gpio/gpio-timberdale.c +++ b/drivers/gpio/gpio-timberdale.c | |||
@@ -116,7 +116,7 @@ static void timbgpio_irq_disable(struct irq_data *d) | |||
116 | unsigned long flags; | 116 | unsigned long flags; |
117 | 117 | ||
118 | spin_lock_irqsave(&tgpio->lock, flags); | 118 | spin_lock_irqsave(&tgpio->lock, flags); |
119 | tgpio->last_ier &= ~(1 << offset); | 119 | tgpio->last_ier &= ~(1UL << offset); |
120 | iowrite32(tgpio->last_ier, tgpio->membase + TGPIO_IER); | 120 | iowrite32(tgpio->last_ier, tgpio->membase + TGPIO_IER); |
121 | spin_unlock_irqrestore(&tgpio->lock, flags); | 121 | spin_unlock_irqrestore(&tgpio->lock, flags); |
122 | } | 122 | } |
@@ -128,7 +128,7 @@ static void timbgpio_irq_enable(struct irq_data *d) | |||
128 | unsigned long flags; | 128 | unsigned long flags; |
129 | 129 | ||
130 | spin_lock_irqsave(&tgpio->lock, flags); | 130 | spin_lock_irqsave(&tgpio->lock, flags); |
131 | tgpio->last_ier |= 1 << offset; | 131 | tgpio->last_ier |= 1UL << offset; |
132 | iowrite32(tgpio->last_ier, tgpio->membase + TGPIO_IER); | 132 | iowrite32(tgpio->last_ier, tgpio->membase + TGPIO_IER); |
133 | spin_unlock_irqrestore(&tgpio->lock, flags); | 133 | spin_unlock_irqrestore(&tgpio->lock, flags); |
134 | } | 134 | } |
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index 5d6c71edc739..1c8d9e3380e1 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c | |||
@@ -623,9 +623,11 @@ static ssize_t export_store(struct class *class, | |||
623 | */ | 623 | */ |
624 | 624 | ||
625 | status = gpio_request(gpio, "sysfs"); | 625 | status = gpio_request(gpio, "sysfs"); |
626 | if (status < 0) | 626 | if (status < 0) { |
627 | if (status == -EPROBE_DEFER) | ||
628 | status = -ENODEV; | ||
627 | goto done; | 629 | goto done; |
628 | 630 | } | |
629 | status = gpio_export(gpio, true); | 631 | status = gpio_export(gpio, true); |
630 | if (status < 0) | 632 | if (status < 0) |
631 | gpio_free(gpio); | 633 | gpio_free(gpio); |
@@ -1191,8 +1193,10 @@ int gpio_request(unsigned gpio, const char *label) | |||
1191 | 1193 | ||
1192 | spin_lock_irqsave(&gpio_lock, flags); | 1194 | spin_lock_irqsave(&gpio_lock, flags); |
1193 | 1195 | ||
1194 | if (!gpio_is_valid(gpio)) | 1196 | if (!gpio_is_valid(gpio)) { |
1197 | status = -EINVAL; | ||
1195 | goto done; | 1198 | goto done; |
1199 | } | ||
1196 | desc = &gpio_desc[gpio]; | 1200 | desc = &gpio_desc[gpio]; |
1197 | chip = desc->chip; | 1201 | chip = desc->chip; |
1198 | if (chip == NULL) | 1202 | if (chip == NULL) |
diff --git a/drivers/gpu/drm/drm_fb_cma_helper.c b/drivers/gpu/drm/drm_fb_cma_helper.c index 09e11a5d921a..fd9d0af4d536 100644 --- a/drivers/gpu/drm/drm_fb_cma_helper.c +++ b/drivers/gpu/drm/drm_fb_cma_helper.c | |||
@@ -206,7 +206,7 @@ static int drm_fbdev_cma_create(struct drm_fb_helper *helper, | |||
206 | size_t size; | 206 | size_t size; |
207 | int ret; | 207 | int ret; |
208 | 208 | ||
209 | DRM_DEBUG_KMS("surface width(%d), height(%d) and bpp(%d\n", | 209 | DRM_DEBUG_KMS("surface width(%d), height(%d) and bpp(%d)\n", |
210 | sizes->surface_width, sizes->surface_height, | 210 | sizes->surface_width, sizes->surface_height, |
211 | sizes->surface_bpp); | 211 | sizes->surface_bpp); |
212 | 212 | ||
@@ -220,7 +220,7 @@ static int drm_fbdev_cma_create(struct drm_fb_helper *helper, | |||
220 | 220 | ||
221 | size = mode_cmd.pitches[0] * mode_cmd.height; | 221 | size = mode_cmd.pitches[0] * mode_cmd.height; |
222 | obj = drm_gem_cma_create(dev, size); | 222 | obj = drm_gem_cma_create(dev, size); |
223 | if (!obj) | 223 | if (IS_ERR(obj)) |
224 | return -ENOMEM; | 224 | return -ENOMEM; |
225 | 225 | ||
226 | fbi = framebuffer_alloc(0, dev->dev); | 226 | fbi = framebuffer_alloc(0, dev->dev); |
diff --git a/drivers/gpu/drm/drm_info.c b/drivers/gpu/drm/drm_info.c index 441ebc1bdbef..d4b20ceda3fb 100644 --- a/drivers/gpu/drm/drm_info.c +++ b/drivers/gpu/drm/drm_info.c | |||
@@ -205,8 +205,6 @@ static int drm_gem_one_name_info(int id, void *ptr, void *data) | |||
205 | struct drm_gem_object *obj = ptr; | 205 | struct drm_gem_object *obj = ptr; |
206 | struct seq_file *m = data; | 206 | struct seq_file *m = data; |
207 | 207 | ||
208 | seq_printf(m, "name %d size %zd\n", obj->name, obj->size); | ||
209 | |||
210 | seq_printf(m, "%6d %8zd %7d %8d\n", | 208 | seq_printf(m, "%6d %8zd %7d %8d\n", |
211 | obj->name, obj->size, | 209 | obj->name, obj->size, |
212 | atomic_read(&obj->handle_count), | 210 | atomic_read(&obj->handle_count), |
diff --git a/drivers/gpu/drm/drm_platform.c b/drivers/gpu/drm/drm_platform.c index aaeb6f8d69ce..b8a282ea8751 100644 --- a/drivers/gpu/drm/drm_platform.c +++ b/drivers/gpu/drm/drm_platform.c | |||
@@ -64,7 +64,6 @@ int drm_get_platform_dev(struct platform_device *platdev, | |||
64 | } | 64 | } |
65 | 65 | ||
66 | if (drm_core_check_feature(dev, DRIVER_MODESET)) { | 66 | if (drm_core_check_feature(dev, DRIVER_MODESET)) { |
67 | dev_set_drvdata(&platdev->dev, dev); | ||
68 | ret = drm_get_minor(dev, &dev->control, DRM_MINOR_CONTROL); | 67 | ret = drm_get_minor(dev, &dev->control, DRM_MINOR_CONTROL); |
69 | if (ret) | 68 | if (ret) |
70 | goto err_g1; | 69 | goto err_g1; |
diff --git a/drivers/gpu/drm/exynos/Kconfig b/drivers/gpu/drm/exynos/Kconfig index 59a26e577b57..fc345d4ebb03 100644 --- a/drivers/gpu/drm/exynos/Kconfig +++ b/drivers/gpu/drm/exynos/Kconfig | |||
@@ -1,6 +1,6 @@ | |||
1 | config DRM_EXYNOS | 1 | config DRM_EXYNOS |
2 | tristate "DRM Support for Samsung SoC EXYNOS Series" | 2 | tristate "DRM Support for Samsung SoC EXYNOS Series" |
3 | depends on DRM && PLAT_SAMSUNG | 3 | depends on DRM && (PLAT_SAMSUNG || ARCH_MULTIPLATFORM) |
4 | select DRM_KMS_HELPER | 4 | select DRM_KMS_HELPER |
5 | select FB_CFB_FILLRECT | 5 | select FB_CFB_FILLRECT |
6 | select FB_CFB_COPYAREA | 6 | select FB_CFB_COPYAREA |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_connector.c b/drivers/gpu/drm/exynos/exynos_drm_connector.c index 18c271862ca8..0f68a2872673 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_connector.c +++ b/drivers/gpu/drm/exynos/exynos_drm_connector.c | |||
@@ -374,6 +374,7 @@ struct drm_connector *exynos_drm_connector_create(struct drm_device *dev, | |||
374 | exynos_connector->encoder_id = encoder->base.id; | 374 | exynos_connector->encoder_id = encoder->base.id; |
375 | exynos_connector->manager = manager; | 375 | exynos_connector->manager = manager; |
376 | exynos_connector->dpms = DRM_MODE_DPMS_OFF; | 376 | exynos_connector->dpms = DRM_MODE_DPMS_OFF; |
377 | connector->dpms = DRM_MODE_DPMS_OFF; | ||
377 | connector->encoder = encoder; | 378 | connector->encoder = encoder; |
378 | 379 | ||
379 | err = drm_mode_connector_attach_encoder(connector, encoder); | 380 | err = drm_mode_connector_attach_encoder(connector, encoder); |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_encoder.c b/drivers/gpu/drm/exynos/exynos_drm_encoder.c index e51503fbaf2b..241ad1eeec64 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_encoder.c +++ b/drivers/gpu/drm/exynos/exynos_drm_encoder.c | |||
@@ -43,12 +43,14 @@ | |||
43 | * @manager: specific encoder has its own manager to control a hardware | 43 | * @manager: specific encoder has its own manager to control a hardware |
44 | * appropriately and we can access a hardware drawing on this manager. | 44 | * appropriately and we can access a hardware drawing on this manager. |
45 | * @dpms: store the encoder dpms value. | 45 | * @dpms: store the encoder dpms value. |
46 | * @updated: indicate whether overlay data updating is needed or not. | ||
46 | */ | 47 | */ |
47 | struct exynos_drm_encoder { | 48 | struct exynos_drm_encoder { |
48 | struct drm_crtc *old_crtc; | 49 | struct drm_crtc *old_crtc; |
49 | struct drm_encoder drm_encoder; | 50 | struct drm_encoder drm_encoder; |
50 | struct exynos_drm_manager *manager; | 51 | struct exynos_drm_manager *manager; |
51 | int dpms; | 52 | int dpms; |
53 | bool updated; | ||
52 | }; | 54 | }; |
53 | 55 | ||
54 | static void exynos_drm_connector_power(struct drm_encoder *encoder, int mode) | 56 | static void exynos_drm_connector_power(struct drm_encoder *encoder, int mode) |
@@ -85,7 +87,9 @@ static void exynos_drm_encoder_dpms(struct drm_encoder *encoder, int mode) | |||
85 | switch (mode) { | 87 | switch (mode) { |
86 | case DRM_MODE_DPMS_ON: | 88 | case DRM_MODE_DPMS_ON: |
87 | if (manager_ops && manager_ops->apply) | 89 | if (manager_ops && manager_ops->apply) |
88 | manager_ops->apply(manager->dev); | 90 | if (!exynos_encoder->updated) |
91 | manager_ops->apply(manager->dev); | ||
92 | |||
89 | exynos_drm_connector_power(encoder, mode); | 93 | exynos_drm_connector_power(encoder, mode); |
90 | exynos_encoder->dpms = mode; | 94 | exynos_encoder->dpms = mode; |
91 | break; | 95 | break; |
@@ -94,6 +98,7 @@ static void exynos_drm_encoder_dpms(struct drm_encoder *encoder, int mode) | |||
94 | case DRM_MODE_DPMS_OFF: | 98 | case DRM_MODE_DPMS_OFF: |
95 | exynos_drm_connector_power(encoder, mode); | 99 | exynos_drm_connector_power(encoder, mode); |
96 | exynos_encoder->dpms = mode; | 100 | exynos_encoder->dpms = mode; |
101 | exynos_encoder->updated = false; | ||
97 | break; | 102 | break; |
98 | default: | 103 | default: |
99 | DRM_ERROR("unspecified mode %d\n", mode); | 104 | DRM_ERROR("unspecified mode %d\n", mode); |
@@ -205,13 +210,22 @@ static void exynos_drm_encoder_prepare(struct drm_encoder *encoder) | |||
205 | 210 | ||
206 | static void exynos_drm_encoder_commit(struct drm_encoder *encoder) | 211 | static void exynos_drm_encoder_commit(struct drm_encoder *encoder) |
207 | { | 212 | { |
208 | struct exynos_drm_manager *manager = exynos_drm_get_manager(encoder); | 213 | struct exynos_drm_encoder *exynos_encoder = to_exynos_encoder(encoder); |
214 | struct exynos_drm_manager *manager = exynos_encoder->manager; | ||
209 | struct exynos_drm_manager_ops *manager_ops = manager->ops; | 215 | struct exynos_drm_manager_ops *manager_ops = manager->ops; |
210 | 216 | ||
211 | DRM_DEBUG_KMS("%s\n", __FILE__); | 217 | DRM_DEBUG_KMS("%s\n", __FILE__); |
212 | 218 | ||
213 | if (manager_ops && manager_ops->commit) | 219 | if (manager_ops && manager_ops->commit) |
214 | manager_ops->commit(manager->dev); | 220 | manager_ops->commit(manager->dev); |
221 | |||
222 | /* | ||
223 | * this will avoid one issue that overlay data is updated to | ||
224 | * real hardware two times. | ||
225 | * And this variable will be used to check if the data was | ||
226 | * already updated or not by exynos_drm_encoder_dpms function. | ||
227 | */ | ||
228 | exynos_encoder->updated = true; | ||
215 | } | 229 | } |
216 | 230 | ||
217 | static void exynos_drm_encoder_disable(struct drm_encoder *encoder) | 231 | static void exynos_drm_encoder_disable(struct drm_encoder *encoder) |
@@ -401,19 +415,6 @@ void exynos_drm_encoder_crtc_dpms(struct drm_encoder *encoder, void *data) | |||
401 | manager_ops->dpms(manager->dev, mode); | 415 | manager_ops->dpms(manager->dev, mode); |
402 | 416 | ||
403 | /* | 417 | /* |
404 | * set current mode to new one so that data aren't updated into | ||
405 | * registers by drm_helper_connector_dpms two times. | ||
406 | * | ||
407 | * in case that drm_crtc_helper_set_mode() is called, | ||
408 | * overlay_ops->commit() and manager_ops->commit() callbacks | ||
409 | * can be called two times, first at drm_crtc_helper_set_mode() | ||
410 | * and second at drm_helper_connector_dpms(). | ||
411 | * so with this setting, when drm_helper_connector_dpms() is called | ||
412 | * encoder->funcs->dpms() will be ignored. | ||
413 | */ | ||
414 | exynos_encoder->dpms = mode; | ||
415 | |||
416 | /* | ||
417 | * if this condition is ok then it means that the crtc is already | 418 | * if this condition is ok then it means that the crtc is already |
418 | * detached from encoder and last function for detaching is properly | 419 | * detached from encoder and last function for detaching is properly |
419 | * done, so clear pipe from manager to prevent repeated call. | 420 | * done, so clear pipe from manager to prevent repeated call. |
diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c b/drivers/gpu/drm/exynos/exynos_mixer.c index 614b2e9ac462..e7fbb823fd8e 100644 --- a/drivers/gpu/drm/exynos/exynos_mixer.c +++ b/drivers/gpu/drm/exynos/exynos_mixer.c | |||
@@ -1142,7 +1142,7 @@ static int __devinit mixer_probe(struct platform_device *pdev) | |||
1142 | const struct of_device_id *match; | 1142 | const struct of_device_id *match; |
1143 | match = of_match_node(of_match_ptr(mixer_match_types), | 1143 | match = of_match_node(of_match_ptr(mixer_match_types), |
1144 | pdev->dev.of_node); | 1144 | pdev->dev.of_node); |
1145 | drv = match->data; | 1145 | drv = (struct mixer_drv_data *)match->data; |
1146 | } else { | 1146 | } else { |
1147 | drv = (struct mixer_drv_data *) | 1147 | drv = (struct mixer_drv_data *) |
1148 | platform_get_device_id(pdev)->driver_data; | 1148 | platform_get_device_id(pdev)->driver_data; |
diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c index c9bfd83dde64..61ae104dca8c 100644 --- a/drivers/gpu/drm/i915/i915_dma.c +++ b/drivers/gpu/drm/i915/i915_dma.c | |||
@@ -1505,7 +1505,8 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags) | |||
1505 | goto put_gmch; | 1505 | goto put_gmch; |
1506 | } | 1506 | } |
1507 | 1507 | ||
1508 | i915_kick_out_firmware_fb(dev_priv); | 1508 | if (drm_core_check_feature(dev, DRIVER_MODESET)) |
1509 | i915_kick_out_firmware_fb(dev_priv); | ||
1509 | 1510 | ||
1510 | pci_set_master(dev->pdev); | 1511 | pci_set_master(dev->pdev); |
1511 | 1512 | ||
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c index aac4e5e1a5b9..6770ee6084b4 100644 --- a/drivers/gpu/drm/i915/i915_drv.c +++ b/drivers/gpu/drm/i915/i915_drv.c | |||
@@ -118,6 +118,13 @@ module_param_named(i915_enable_ppgtt, i915_enable_ppgtt, int, 0600); | |||
118 | MODULE_PARM_DESC(i915_enable_ppgtt, | 118 | MODULE_PARM_DESC(i915_enable_ppgtt, |
119 | "Enable PPGTT (default: true)"); | 119 | "Enable PPGTT (default: true)"); |
120 | 120 | ||
121 | unsigned int i915_preliminary_hw_support __read_mostly = 0; | ||
122 | module_param_named(preliminary_hw_support, i915_preliminary_hw_support, int, 0600); | ||
123 | MODULE_PARM_DESC(preliminary_hw_support, | ||
124 | "Enable preliminary hardware support. " | ||
125 | "Enable Haswell and ValleyView Support. " | ||
126 | "(default: false)"); | ||
127 | |||
121 | static struct drm_driver driver; | 128 | static struct drm_driver driver; |
122 | extern int intel_agp_enabled; | 129 | extern int intel_agp_enabled; |
123 | 130 | ||
@@ -826,6 +833,12 @@ i915_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
826 | struct intel_device_info *intel_info = | 833 | struct intel_device_info *intel_info = |
827 | (struct intel_device_info *) ent->driver_data; | 834 | (struct intel_device_info *) ent->driver_data; |
828 | 835 | ||
836 | if (intel_info->is_haswell || intel_info->is_valleyview) | ||
837 | if(!i915_preliminary_hw_support) { | ||
838 | DRM_ERROR("Preliminary hardware support disabled\n"); | ||
839 | return -ENODEV; | ||
840 | } | ||
841 | |||
829 | /* Only bind to function 0 of the device. Early generations | 842 | /* Only bind to function 0 of the device. Early generations |
830 | * used function 1 as a placeholder for multi-head. This causes | 843 | * used function 1 as a placeholder for multi-head. This causes |
831 | * us confusion instead, especially on the systems where both | 844 | * us confusion instead, especially on the systems where both |
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index b84f7861e438..f511fa2f4168 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h | |||
@@ -1217,6 +1217,7 @@ extern int i915_enable_rc6 __read_mostly; | |||
1217 | extern int i915_enable_fbc __read_mostly; | 1217 | extern int i915_enable_fbc __read_mostly; |
1218 | extern bool i915_enable_hangcheck __read_mostly; | 1218 | extern bool i915_enable_hangcheck __read_mostly; |
1219 | extern int i915_enable_ppgtt __read_mostly; | 1219 | extern int i915_enable_ppgtt __read_mostly; |
1220 | extern unsigned int i915_preliminary_hw_support __read_mostly; | ||
1220 | 1221 | ||
1221 | extern int i915_suspend(struct drm_device *dev, pm_message_t state); | 1222 | extern int i915_suspend(struct drm_device *dev, pm_message_t state); |
1222 | extern int i915_resume(struct drm_device *dev); | 1223 | extern int i915_resume(struct drm_device *dev); |
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index d33d02d13c96..107f09befe92 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c | |||
@@ -1407,8 +1407,10 @@ out: | |||
1407 | return VM_FAULT_NOPAGE; | 1407 | return VM_FAULT_NOPAGE; |
1408 | case -ENOMEM: | 1408 | case -ENOMEM: |
1409 | return VM_FAULT_OOM; | 1409 | return VM_FAULT_OOM; |
1410 | case -ENOSPC: | ||
1411 | return VM_FAULT_SIGBUS; | ||
1410 | default: | 1412 | default: |
1411 | WARN_ON_ONCE(ret); | 1413 | WARN_ONCE(ret, "unhandled error in i915_gem_fault: %i\n", ret); |
1412 | return VM_FAULT_SIGBUS; | 1414 | return VM_FAULT_SIGBUS; |
1413 | } | 1415 | } |
1414 | } | 1416 | } |
@@ -1822,10 +1824,11 @@ i915_gem_object_get_pages_gtt(struct drm_i915_gem_object *obj) | |||
1822 | sg_set_page(sg, page, PAGE_SIZE, 0); | 1824 | sg_set_page(sg, page, PAGE_SIZE, 0); |
1823 | } | 1825 | } |
1824 | 1826 | ||
1827 | obj->pages = st; | ||
1828 | |||
1825 | if (i915_gem_object_needs_bit17_swizzle(obj)) | 1829 | if (i915_gem_object_needs_bit17_swizzle(obj)) |
1826 | i915_gem_object_do_bit_17_swizzle(obj); | 1830 | i915_gem_object_do_bit_17_swizzle(obj); |
1827 | 1831 | ||
1828 | obj->pages = st; | ||
1829 | return 0; | 1832 | return 0; |
1830 | 1833 | ||
1831 | err_pages: | 1834 | err_pages: |
diff --git a/drivers/gpu/drm/i915/intel_crt.c b/drivers/gpu/drm/i915/intel_crt.c index 893f30164b7e..b726b478a4f5 100644 --- a/drivers/gpu/drm/i915/intel_crt.c +++ b/drivers/gpu/drm/i915/intel_crt.c | |||
@@ -219,20 +219,7 @@ static void intel_crt_mode_set(struct drm_encoder *encoder, | |||
219 | intel_encoder_to_crt(to_intel_encoder(encoder)); | 219 | intel_encoder_to_crt(to_intel_encoder(encoder)); |
220 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); | 220 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); |
221 | struct drm_i915_private *dev_priv = dev->dev_private; | 221 | struct drm_i915_private *dev_priv = dev->dev_private; |
222 | int dpll_md_reg; | 222 | u32 adpa; |
223 | u32 adpa, dpll_md; | ||
224 | |||
225 | dpll_md_reg = DPLL_MD(intel_crtc->pipe); | ||
226 | |||
227 | /* | ||
228 | * Disable separate mode multiplier used when cloning SDVO to CRT | ||
229 | * XXX this needs to be adjusted when we really are cloning | ||
230 | */ | ||
231 | if (INTEL_INFO(dev)->gen >= 4 && !HAS_PCH_SPLIT(dev)) { | ||
232 | dpll_md = I915_READ(dpll_md_reg); | ||
233 | I915_WRITE(dpll_md_reg, | ||
234 | dpll_md & ~DPLL_MD_UDI_MULTIPLIER_MASK); | ||
235 | } | ||
236 | 223 | ||
237 | adpa = ADPA_HOTPLUG_BITS; | 224 | adpa = ADPA_HOTPLUG_BITS; |
238 | if (adjusted_mode->flags & DRM_MODE_FLAG_PHSYNC) | 225 | if (adjusted_mode->flags & DRM_MODE_FLAG_PHSYNC) |
@@ -742,7 +729,7 @@ void intel_crt_init(struct drm_device *dev) | |||
742 | 729 | ||
743 | crt->base.type = INTEL_OUTPUT_ANALOG; | 730 | crt->base.type = INTEL_OUTPUT_ANALOG; |
744 | crt->base.cloneable = true; | 731 | crt->base.cloneable = true; |
745 | if (IS_HASWELL(dev)) | 732 | if (IS_HASWELL(dev) || IS_I830(dev)) |
746 | crt->base.crtc_mask = (1 << 0); | 733 | crt->base.crtc_mask = (1 << 0); |
747 | else | 734 | else |
748 | crt->base.crtc_mask = (1 << 0) | (1 << 1) | (1 << 2); | 735 | crt->base.crtc_mask = (1 << 0) | (1 << 1) | (1 << 2); |
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 682bd3729baf..461a637f1ef7 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
@@ -7892,6 +7892,34 @@ struct intel_quirk { | |||
7892 | void (*hook)(struct drm_device *dev); | 7892 | void (*hook)(struct drm_device *dev); |
7893 | }; | 7893 | }; |
7894 | 7894 | ||
7895 | /* For systems that don't have a meaningful PCI subdevice/subvendor ID */ | ||
7896 | struct intel_dmi_quirk { | ||
7897 | void (*hook)(struct drm_device *dev); | ||
7898 | const struct dmi_system_id (*dmi_id_list)[]; | ||
7899 | }; | ||
7900 | |||
7901 | static int intel_dmi_reverse_brightness(const struct dmi_system_id *id) | ||
7902 | { | ||
7903 | DRM_INFO("Backlight polarity reversed on %s\n", id->ident); | ||
7904 | return 1; | ||
7905 | } | ||
7906 | |||
7907 | static const struct intel_dmi_quirk intel_dmi_quirks[] = { | ||
7908 | { | ||
7909 | .dmi_id_list = &(const struct dmi_system_id[]) { | ||
7910 | { | ||
7911 | .callback = intel_dmi_reverse_brightness, | ||
7912 | .ident = "NCR Corporation", | ||
7913 | .matches = {DMI_MATCH(DMI_SYS_VENDOR, "NCR Corporation"), | ||
7914 | DMI_MATCH(DMI_PRODUCT_NAME, ""), | ||
7915 | }, | ||
7916 | }, | ||
7917 | { } /* terminating entry */ | ||
7918 | }, | ||
7919 | .hook = quirk_invert_brightness, | ||
7920 | }, | ||
7921 | }; | ||
7922 | |||
7895 | static struct intel_quirk intel_quirks[] = { | 7923 | static struct intel_quirk intel_quirks[] = { |
7896 | /* HP Mini needs pipe A force quirk (LP: #322104) */ | 7924 | /* HP Mini needs pipe A force quirk (LP: #322104) */ |
7897 | { 0x27ae, 0x103c, 0x361a, quirk_pipea_force }, | 7925 | { 0x27ae, 0x103c, 0x361a, quirk_pipea_force }, |
@@ -7931,6 +7959,10 @@ static void intel_init_quirks(struct drm_device *dev) | |||
7931 | q->subsystem_device == PCI_ANY_ID)) | 7959 | q->subsystem_device == PCI_ANY_ID)) |
7932 | q->hook(dev); | 7960 | q->hook(dev); |
7933 | } | 7961 | } |
7962 | for (i = 0; i < ARRAY_SIZE(intel_dmi_quirks); i++) { | ||
7963 | if (dmi_check_system(*intel_dmi_quirks[i].dmi_id_list) != 0) | ||
7964 | intel_dmi_quirks[i].hook(dev); | ||
7965 | } | ||
7934 | } | 7966 | } |
7935 | 7967 | ||
7936 | /* Disable the VGA plane that we never use */ | 7968 | /* Disable the VGA plane that we never use */ |
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index 1b727a5c9ee5..368ed8ef1600 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c | |||
@@ -1797,7 +1797,8 @@ intel_dp_start_link_train(struct intel_dp *intel_dp) | |||
1797 | if ((intel_dp->train_set[i] & DP_TRAIN_MAX_SWING_REACHED) == 0) | 1797 | if ((intel_dp->train_set[i] & DP_TRAIN_MAX_SWING_REACHED) == 0) |
1798 | break; | 1798 | break; |
1799 | if (i == intel_dp->lane_count && voltage_tries == 5) { | 1799 | if (i == intel_dp->lane_count && voltage_tries == 5) { |
1800 | if (++loop_tries == 5) { | 1800 | ++loop_tries; |
1801 | if (loop_tries == 5) { | ||
1801 | DRM_DEBUG_KMS("too many full retries, give up\n"); | 1802 | DRM_DEBUG_KMS("too many full retries, give up\n"); |
1802 | break; | 1803 | break; |
1803 | } | 1804 | } |
@@ -1807,11 +1808,15 @@ intel_dp_start_link_train(struct intel_dp *intel_dp) | |||
1807 | } | 1808 | } |
1808 | 1809 | ||
1809 | /* Check to see if we've tried the same voltage 5 times */ | 1810 | /* Check to see if we've tried the same voltage 5 times */ |
1810 | if ((intel_dp->train_set[0] & DP_TRAIN_VOLTAGE_SWING_MASK) != voltage) { | 1811 | if ((intel_dp->train_set[0] & DP_TRAIN_VOLTAGE_SWING_MASK) == voltage) { |
1811 | voltage = intel_dp->train_set[0] & DP_TRAIN_VOLTAGE_SWING_MASK; | ||
1812 | voltage_tries = 0; | ||
1813 | } else | ||
1814 | ++voltage_tries; | 1812 | ++voltage_tries; |
1813 | if (voltage_tries == 5) { | ||
1814 | DRM_DEBUG_KMS("too many voltage retries, give up\n"); | ||
1815 | break; | ||
1816 | } | ||
1817 | } else | ||
1818 | voltage_tries = 0; | ||
1819 | voltage = intel_dp->train_set[0] & DP_TRAIN_VOLTAGE_SWING_MASK; | ||
1815 | 1820 | ||
1816 | /* Compute new intel_dp->train_set as requested by target */ | 1821 | /* Compute new intel_dp->train_set as requested by target */ |
1817 | intel_get_adjust_train(intel_dp, link_status); | 1822 | intel_get_adjust_train(intel_dp, link_status); |
diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c index e3166df55daa..edba93b3474b 100644 --- a/drivers/gpu/drm/i915/intel_lvds.c +++ b/drivers/gpu/drm/i915/intel_lvds.c | |||
@@ -777,6 +777,14 @@ static const struct dmi_system_id intel_no_lvds[] = { | |||
777 | DMI_MATCH(DMI_BOARD_NAME, "D525TUD"), | 777 | DMI_MATCH(DMI_BOARD_NAME, "D525TUD"), |
778 | }, | 778 | }, |
779 | }, | 779 | }, |
780 | { | ||
781 | .callback = intel_no_lvds_dmi_callback, | ||
782 | .ident = "Supermicro X7SPA-H", | ||
783 | .matches = { | ||
784 | DMI_MATCH(DMI_SYS_VENDOR, "Supermicro"), | ||
785 | DMI_MATCH(DMI_PRODUCT_NAME, "X7SPA-H"), | ||
786 | }, | ||
787 | }, | ||
780 | 788 | ||
781 | { } /* terminating entry */ | 789 | { } /* terminating entry */ |
782 | }; | 790 | }; |
diff --git a/drivers/gpu/drm/i915/intel_overlay.c b/drivers/gpu/drm/i915/intel_overlay.c index 495625914e4a..d7bc817f51a0 100644 --- a/drivers/gpu/drm/i915/intel_overlay.c +++ b/drivers/gpu/drm/i915/intel_overlay.c | |||
@@ -341,9 +341,17 @@ static int intel_overlay_off(struct intel_overlay *overlay) | |||
341 | intel_ring_emit(ring, flip_addr); | 341 | intel_ring_emit(ring, flip_addr); |
342 | intel_ring_emit(ring, MI_WAIT_FOR_EVENT | MI_WAIT_FOR_OVERLAY_FLIP); | 342 | intel_ring_emit(ring, MI_WAIT_FOR_EVENT | MI_WAIT_FOR_OVERLAY_FLIP); |
343 | /* turn overlay off */ | 343 | /* turn overlay off */ |
344 | intel_ring_emit(ring, MI_OVERLAY_FLIP | MI_OVERLAY_OFF); | 344 | if (IS_I830(dev)) { |
345 | intel_ring_emit(ring, flip_addr); | 345 | /* Workaround: Don't disable the overlay fully, since otherwise |
346 | intel_ring_emit(ring, MI_WAIT_FOR_EVENT | MI_WAIT_FOR_OVERLAY_FLIP); | 346 | * it dies on the next OVERLAY_ON cmd. */ |
347 | intel_ring_emit(ring, MI_NOOP); | ||
348 | intel_ring_emit(ring, MI_NOOP); | ||
349 | intel_ring_emit(ring, MI_NOOP); | ||
350 | } else { | ||
351 | intel_ring_emit(ring, MI_OVERLAY_FLIP | MI_OVERLAY_OFF); | ||
352 | intel_ring_emit(ring, flip_addr); | ||
353 | intel_ring_emit(ring, MI_WAIT_FOR_EVENT | MI_WAIT_FOR_OVERLAY_FLIP); | ||
354 | } | ||
347 | intel_ring_advance(ring); | 355 | intel_ring_advance(ring); |
348 | 356 | ||
349 | return intel_overlay_do_wait_request(overlay, intel_overlay_off_tail); | 357 | return intel_overlay_do_wait_request(overlay, intel_overlay_off_tail); |
diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c index e019b2369861..e2aacd329545 100644 --- a/drivers/gpu/drm/i915/intel_panel.c +++ b/drivers/gpu/drm/i915/intel_panel.c | |||
@@ -435,7 +435,7 @@ int intel_panel_setup_backlight(struct drm_device *dev) | |||
435 | props.type = BACKLIGHT_RAW; | 435 | props.type = BACKLIGHT_RAW; |
436 | props.max_brightness = _intel_panel_get_max_backlight(dev); | 436 | props.max_brightness = _intel_panel_get_max_backlight(dev); |
437 | if (props.max_brightness == 0) { | 437 | if (props.max_brightness == 0) { |
438 | DRM_ERROR("Failed to get maximum backlight value\n"); | 438 | DRM_DEBUG_DRIVER("Failed to get maximum backlight value\n"); |
439 | return -ENODEV; | 439 | return -ENODEV; |
440 | } | 440 | } |
441 | dev_priv->backlight = | 441 | dev_priv->backlight = |
diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c index 0007a4d9bf6e..79d308da29ff 100644 --- a/drivers/gpu/drm/i915/intel_sdvo.c +++ b/drivers/gpu/drm/i915/intel_sdvo.c | |||
@@ -139,6 +139,11 @@ struct intel_sdvo { | |||
139 | 139 | ||
140 | /* DDC bus used by this SDVO encoder */ | 140 | /* DDC bus used by this SDVO encoder */ |
141 | uint8_t ddc_bus; | 141 | uint8_t ddc_bus; |
142 | |||
143 | /* | ||
144 | * the sdvo flag gets lost in round trip: dtd->adjusted_mode->dtd | ||
145 | */ | ||
146 | uint8_t dtd_sdvo_flags; | ||
142 | }; | 147 | }; |
143 | 148 | ||
144 | struct intel_sdvo_connector { | 149 | struct intel_sdvo_connector { |
@@ -889,6 +894,45 @@ static void intel_sdvo_dump_hdmi_buf(struct intel_sdvo *intel_sdvo) | |||
889 | } | 894 | } |
890 | #endif | 895 | #endif |
891 | 896 | ||
897 | static bool intel_sdvo_write_infoframe(struct intel_sdvo *intel_sdvo, | ||
898 | unsigned if_index, uint8_t tx_rate, | ||
899 | uint8_t *data, unsigned length) | ||
900 | { | ||
901 | uint8_t set_buf_index[2] = { if_index, 0 }; | ||
902 | uint8_t hbuf_size, tmp[8]; | ||
903 | int i; | ||
904 | |||
905 | if (!intel_sdvo_set_value(intel_sdvo, | ||
906 | SDVO_CMD_SET_HBUF_INDEX, | ||
907 | set_buf_index, 2)) | ||
908 | return false; | ||
909 | |||
910 | if (!intel_sdvo_get_value(intel_sdvo, SDVO_CMD_GET_HBUF_INFO, | ||
911 | &hbuf_size, 1)) | ||
912 | return false; | ||
913 | |||
914 | /* Buffer size is 0 based, hooray! */ | ||
915 | hbuf_size++; | ||
916 | |||
917 | DRM_DEBUG_KMS("writing sdvo hbuf: %i, hbuf_size %i, hbuf_size: %i\n", | ||
918 | if_index, length, hbuf_size); | ||
919 | |||
920 | for (i = 0; i < hbuf_size; i += 8) { | ||
921 | memset(tmp, 0, 8); | ||
922 | if (i < length) | ||
923 | memcpy(tmp, data + i, min_t(unsigned, 8, length - i)); | ||
924 | |||
925 | if (!intel_sdvo_set_value(intel_sdvo, | ||
926 | SDVO_CMD_SET_HBUF_DATA, | ||
927 | tmp, 8)) | ||
928 | return false; | ||
929 | } | ||
930 | |||
931 | return intel_sdvo_set_value(intel_sdvo, | ||
932 | SDVO_CMD_SET_HBUF_TXRATE, | ||
933 | &tx_rate, 1); | ||
934 | } | ||
935 | |||
892 | static bool intel_sdvo_set_avi_infoframe(struct intel_sdvo *intel_sdvo) | 936 | static bool intel_sdvo_set_avi_infoframe(struct intel_sdvo *intel_sdvo) |
893 | { | 937 | { |
894 | struct dip_infoframe avi_if = { | 938 | struct dip_infoframe avi_if = { |
@@ -896,11 +940,7 @@ static bool intel_sdvo_set_avi_infoframe(struct intel_sdvo *intel_sdvo) | |||
896 | .ver = DIP_VERSION_AVI, | 940 | .ver = DIP_VERSION_AVI, |
897 | .len = DIP_LEN_AVI, | 941 | .len = DIP_LEN_AVI, |
898 | }; | 942 | }; |
899 | uint8_t tx_rate = SDVO_HBUF_TX_VSYNC; | ||
900 | uint8_t set_buf_index[2] = { 1, 0 }; | ||
901 | uint8_t sdvo_data[4 + sizeof(avi_if.body.avi)]; | 943 | uint8_t sdvo_data[4 + sizeof(avi_if.body.avi)]; |
902 | uint64_t *data = (uint64_t *)sdvo_data; | ||
903 | unsigned i; | ||
904 | 944 | ||
905 | intel_dip_infoframe_csum(&avi_if); | 945 | intel_dip_infoframe_csum(&avi_if); |
906 | 946 | ||
@@ -910,22 +950,9 @@ static bool intel_sdvo_set_avi_infoframe(struct intel_sdvo *intel_sdvo) | |||
910 | sdvo_data[3] = avi_if.checksum; | 950 | sdvo_data[3] = avi_if.checksum; |
911 | memcpy(&sdvo_data[4], &avi_if.body, sizeof(avi_if.body.avi)); | 951 | memcpy(&sdvo_data[4], &avi_if.body, sizeof(avi_if.body.avi)); |
912 | 952 | ||
913 | if (!intel_sdvo_set_value(intel_sdvo, | 953 | return intel_sdvo_write_infoframe(intel_sdvo, SDVO_HBUF_INDEX_AVI_IF, |
914 | SDVO_CMD_SET_HBUF_INDEX, | 954 | SDVO_HBUF_TX_VSYNC, |
915 | set_buf_index, 2)) | 955 | sdvo_data, sizeof(sdvo_data)); |
916 | return false; | ||
917 | |||
918 | for (i = 0; i < sizeof(sdvo_data); i += 8) { | ||
919 | if (!intel_sdvo_set_value(intel_sdvo, | ||
920 | SDVO_CMD_SET_HBUF_DATA, | ||
921 | data, 8)) | ||
922 | return false; | ||
923 | data++; | ||
924 | } | ||
925 | |||
926 | return intel_sdvo_set_value(intel_sdvo, | ||
927 | SDVO_CMD_SET_HBUF_TXRATE, | ||
928 | &tx_rate, 1); | ||
929 | } | 956 | } |
930 | 957 | ||
931 | static bool intel_sdvo_set_tv_format(struct intel_sdvo *intel_sdvo) | 958 | static bool intel_sdvo_set_tv_format(struct intel_sdvo *intel_sdvo) |
@@ -984,6 +1011,7 @@ intel_sdvo_get_preferred_input_mode(struct intel_sdvo *intel_sdvo, | |||
984 | return false; | 1011 | return false; |
985 | 1012 | ||
986 | intel_sdvo_get_mode_from_dtd(adjusted_mode, &input_dtd); | 1013 | intel_sdvo_get_mode_from_dtd(adjusted_mode, &input_dtd); |
1014 | intel_sdvo->dtd_sdvo_flags = input_dtd.part2.sdvo_flags; | ||
987 | 1015 | ||
988 | return true; | 1016 | return true; |
989 | } | 1017 | } |
@@ -1092,6 +1120,8 @@ static void intel_sdvo_mode_set(struct drm_encoder *encoder, | |||
1092 | * adjusted_mode. | 1120 | * adjusted_mode. |
1093 | */ | 1121 | */ |
1094 | intel_sdvo_get_dtd_from_mode(&input_dtd, adjusted_mode); | 1122 | intel_sdvo_get_dtd_from_mode(&input_dtd, adjusted_mode); |
1123 | if (intel_sdvo->is_tv || intel_sdvo->is_lvds) | ||
1124 | input_dtd.part2.sdvo_flags = intel_sdvo->dtd_sdvo_flags; | ||
1095 | if (!intel_sdvo_set_input_timing(intel_sdvo, &input_dtd)) | 1125 | if (!intel_sdvo_set_input_timing(intel_sdvo, &input_dtd)) |
1096 | DRM_INFO("Setting input timings on %s failed\n", | 1126 | DRM_INFO("Setting input timings on %s failed\n", |
1097 | SDVO_NAME(intel_sdvo)); | 1127 | SDVO_NAME(intel_sdvo)); |
@@ -2277,10 +2307,8 @@ intel_sdvo_lvds_init(struct intel_sdvo *intel_sdvo, int device) | |||
2277 | intel_sdvo_connector->output_flag = SDVO_OUTPUT_LVDS1; | 2307 | intel_sdvo_connector->output_flag = SDVO_OUTPUT_LVDS1; |
2278 | } | 2308 | } |
2279 | 2309 | ||
2280 | /* SDVO LVDS is cloneable because the SDVO encoder does the upscaling, | 2310 | /* SDVO LVDS is not cloneable because the input mode gets adjusted by the encoder */ |
2281 | * as opposed to native LVDS, where we upscale with the panel-fitter | 2311 | intel_sdvo->base.cloneable = false; |
2282 | * (and hence only the native LVDS resolution could be cloned). */ | ||
2283 | intel_sdvo->base.cloneable = true; | ||
2284 | 2312 | ||
2285 | intel_sdvo_connector_init(intel_sdvo_connector, intel_sdvo); | 2313 | intel_sdvo_connector_init(intel_sdvo_connector, intel_sdvo); |
2286 | if (!intel_sdvo_create_enhance_property(intel_sdvo, intel_sdvo_connector)) | 2314 | if (!intel_sdvo_create_enhance_property(intel_sdvo, intel_sdvo_connector)) |
diff --git a/drivers/gpu/drm/i915/intel_sdvo_regs.h b/drivers/gpu/drm/i915/intel_sdvo_regs.h index 9d030142ee43..770bdd6ecd9f 100644 --- a/drivers/gpu/drm/i915/intel_sdvo_regs.h +++ b/drivers/gpu/drm/i915/intel_sdvo_regs.h | |||
@@ -708,6 +708,8 @@ struct intel_sdvo_enhancements_arg { | |||
708 | #define SDVO_CMD_SET_AUDIO_STAT 0x91 | 708 | #define SDVO_CMD_SET_AUDIO_STAT 0x91 |
709 | #define SDVO_CMD_GET_AUDIO_STAT 0x92 | 709 | #define SDVO_CMD_GET_AUDIO_STAT 0x92 |
710 | #define SDVO_CMD_SET_HBUF_INDEX 0x93 | 710 | #define SDVO_CMD_SET_HBUF_INDEX 0x93 |
711 | #define SDVO_HBUF_INDEX_ELD 0 | ||
712 | #define SDVO_HBUF_INDEX_AVI_IF 1 | ||
711 | #define SDVO_CMD_GET_HBUF_INDEX 0x94 | 713 | #define SDVO_CMD_GET_HBUF_INDEX 0x94 |
712 | #define SDVO_CMD_GET_HBUF_INFO 0x95 | 714 | #define SDVO_CMD_GET_HBUF_INFO 0x95 |
713 | #define SDVO_CMD_SET_HBUF_AV_SPLIT 0x96 | 715 | #define SDVO_CMD_SET_HBUF_AV_SPLIT 0x96 |
diff --git a/drivers/gpu/drm/nouveau/core/core/gpuobj.c b/drivers/gpu/drm/nouveau/core/core/gpuobj.c index 1f34549aff18..70586fde69cf 100644 --- a/drivers/gpu/drm/nouveau/core/core/gpuobj.c +++ b/drivers/gpu/drm/nouveau/core/core/gpuobj.c | |||
@@ -39,6 +39,11 @@ nouveau_gpuobj_destroy(struct nouveau_gpuobj *gpuobj) | |||
39 | nv_wo32(gpuobj, i, 0x00000000); | 39 | nv_wo32(gpuobj, i, 0x00000000); |
40 | } | 40 | } |
41 | 41 | ||
42 | if (gpuobj->node) { | ||
43 | nouveau_mm_free(&nv_gpuobj(gpuobj->parent)->heap, | ||
44 | &gpuobj->node); | ||
45 | } | ||
46 | |||
42 | if (gpuobj->heap.block_size) | 47 | if (gpuobj->heap.block_size) |
43 | nouveau_mm_fini(&gpuobj->heap); | 48 | nouveau_mm_fini(&gpuobj->heap); |
44 | 49 | ||
diff --git a/drivers/gpu/drm/nouveau/core/core/mm.c b/drivers/gpu/drm/nouveau/core/core/mm.c index bfddf87926dd..a6d3cd6490f7 100644 --- a/drivers/gpu/drm/nouveau/core/core/mm.c +++ b/drivers/gpu/drm/nouveau/core/core/mm.c | |||
@@ -218,13 +218,16 @@ nouveau_mm_init(struct nouveau_mm *mm, u32 offset, u32 length, u32 block) | |||
218 | node = kzalloc(sizeof(*node), GFP_KERNEL); | 218 | node = kzalloc(sizeof(*node), GFP_KERNEL); |
219 | if (!node) | 219 | if (!node) |
220 | return -ENOMEM; | 220 | return -ENOMEM; |
221 | node->offset = roundup(offset, mm->block_size); | 221 | |
222 | node->length = rounddown(offset + length, mm->block_size) - node->offset; | 222 | if (length) { |
223 | node->offset = roundup(offset, mm->block_size); | ||
224 | node->length = rounddown(offset + length, mm->block_size); | ||
225 | node->length -= node->offset; | ||
226 | } | ||
223 | 227 | ||
224 | list_add_tail(&node->nl_entry, &mm->nodes); | 228 | list_add_tail(&node->nl_entry, &mm->nodes); |
225 | list_add_tail(&node->fl_entry, &mm->free); | 229 | list_add_tail(&node->fl_entry, &mm->free); |
226 | mm->heap_nodes++; | 230 | mm->heap_nodes++; |
227 | mm->heap_size += length; | ||
228 | return 0; | 231 | return 0; |
229 | } | 232 | } |
230 | 233 | ||
@@ -236,7 +239,7 @@ nouveau_mm_fini(struct nouveau_mm *mm) | |||
236 | int nodes = 0; | 239 | int nodes = 0; |
237 | 240 | ||
238 | list_for_each_entry(node, &mm->nodes, nl_entry) { | 241 | list_for_each_entry(node, &mm->nodes, nl_entry) { |
239 | if (nodes++ == mm->heap_nodes) | 242 | if (WARN_ON(nodes++ == mm->heap_nodes)) |
240 | return -EBUSY; | 243 | return -EBUSY; |
241 | } | 244 | } |
242 | 245 | ||
diff --git a/drivers/gpu/drm/nouveau/core/include/core/mm.h b/drivers/gpu/drm/nouveau/core/include/core/mm.h index 9ee9bf4028ca..975137ba34a6 100644 --- a/drivers/gpu/drm/nouveau/core/include/core/mm.h +++ b/drivers/gpu/drm/nouveau/core/include/core/mm.h | |||
@@ -19,7 +19,6 @@ struct nouveau_mm { | |||
19 | 19 | ||
20 | u32 block_size; | 20 | u32 block_size; |
21 | int heap_nodes; | 21 | int heap_nodes; |
22 | u32 heap_size; | ||
23 | }; | 22 | }; |
24 | 23 | ||
25 | int nouveau_mm_init(struct nouveau_mm *, u32 offset, u32 length, u32 block); | 24 | int nouveau_mm_init(struct nouveau_mm *, u32 offset, u32 length, u32 block); |
diff --git a/drivers/gpu/drm/nouveau/core/subdev/bios/base.c b/drivers/gpu/drm/nouveau/core/subdev/bios/base.c index dcb5c2befc92..70ca7d5a1aa1 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/bios/base.c +++ b/drivers/gpu/drm/nouveau/core/subdev/bios/base.c | |||
@@ -72,7 +72,7 @@ nouveau_bios_shadow_of(struct nouveau_bios *bios) | |||
72 | } | 72 | } |
73 | 73 | ||
74 | data = of_get_property(dn, "NVDA,BMP", &size); | 74 | data = of_get_property(dn, "NVDA,BMP", &size); |
75 | if (data) { | 75 | if (data && size) { |
76 | bios->size = size; | 76 | bios->size = size; |
77 | bios->data = kmalloc(bios->size, GFP_KERNEL); | 77 | bios->data = kmalloc(bios->size, GFP_KERNEL); |
78 | if (bios->data) | 78 | if (bios->data) |
@@ -104,6 +104,9 @@ nouveau_bios_shadow_pramin(struct nouveau_bios *bios) | |||
104 | goto out; | 104 | goto out; |
105 | 105 | ||
106 | bios->size = nv_rd08(bios, 0x700002) * 512; | 106 | bios->size = nv_rd08(bios, 0x700002) * 512; |
107 | if (!bios->size) | ||
108 | goto out; | ||
109 | |||
107 | bios->data = kmalloc(bios->size, GFP_KERNEL); | 110 | bios->data = kmalloc(bios->size, GFP_KERNEL); |
108 | if (bios->data) { | 111 | if (bios->data) { |
109 | for (i = 0; i < bios->size; i++) | 112 | for (i = 0; i < bios->size; i++) |
@@ -155,6 +158,9 @@ nouveau_bios_shadow_prom(struct nouveau_bios *bios) | |||
155 | 158 | ||
156 | /* read entire bios image to system memory */ | 159 | /* read entire bios image to system memory */ |
157 | bios->size = nv_rd08(bios, 0x300002) * 512; | 160 | bios->size = nv_rd08(bios, 0x300002) * 512; |
161 | if (!bios->size) | ||
162 | goto out; | ||
163 | |||
158 | bios->data = kmalloc(bios->size, GFP_KERNEL); | 164 | bios->data = kmalloc(bios->size, GFP_KERNEL); |
159 | if (bios->data) { | 165 | if (bios->data) { |
160 | for (i = 0; i < bios->size; i++) | 166 | for (i = 0; i < bios->size; i++) |
@@ -186,14 +192,22 @@ nouveau_bios_shadow_acpi(struct nouveau_bios *bios) | |||
186 | { | 192 | { |
187 | struct pci_dev *pdev = nv_device(bios)->pdev; | 193 | struct pci_dev *pdev = nv_device(bios)->pdev; |
188 | int ret, cnt, i; | 194 | int ret, cnt, i; |
189 | u8 data[3]; | ||
190 | 195 | ||
191 | if (!nouveau_acpi_rom_supported(pdev)) | 196 | if (!nouveau_acpi_rom_supported(pdev)) { |
197 | bios->data = NULL; | ||
192 | return; | 198 | return; |
199 | } | ||
193 | 200 | ||
194 | bios->size = 0; | 201 | bios->size = 0; |
195 | if (nouveau_acpi_get_bios_chunk(data, 0, 3) == 3) | 202 | bios->data = kmalloc(4096, GFP_KERNEL); |
196 | bios->size = data[2] * 512; | 203 | if (bios->data) { |
204 | if (nouveau_acpi_get_bios_chunk(bios->data, 0, 4096) == 4096) | ||
205 | bios->size = bios->data[2] * 512; | ||
206 | kfree(bios->data); | ||
207 | } | ||
208 | |||
209 | if (!bios->size) | ||
210 | return; | ||
197 | 211 | ||
198 | bios->data = kmalloc(bios->size, GFP_KERNEL); | 212 | bios->data = kmalloc(bios->size, GFP_KERNEL); |
199 | for (i = 0; bios->data && i < bios->size; i += cnt) { | 213 | for (i = 0; bios->data && i < bios->size; i += cnt) { |
@@ -229,12 +243,14 @@ nouveau_bios_shadow_pci(struct nouveau_bios *bios) | |||
229 | static int | 243 | static int |
230 | nouveau_bios_score(struct nouveau_bios *bios, const bool writeable) | 244 | nouveau_bios_score(struct nouveau_bios *bios, const bool writeable) |
231 | { | 245 | { |
232 | if (!bios->data || bios->data[0] != 0x55 || bios->data[1] != 0xAA) { | 246 | if (bios->size < 3 || !bios->data || bios->data[0] != 0x55 || |
247 | bios->data[1] != 0xAA) { | ||
233 | nv_info(bios, "... signature not found\n"); | 248 | nv_info(bios, "... signature not found\n"); |
234 | return 0; | 249 | return 0; |
235 | } | 250 | } |
236 | 251 | ||
237 | if (nvbios_checksum(bios->data, bios->data[2] * 512)) { | 252 | if (nvbios_checksum(bios->data, |
253 | min_t(u32, bios->data[2] * 512, bios->size))) { | ||
238 | nv_info(bios, "... checksum invalid\n"); | 254 | nv_info(bios, "... checksum invalid\n"); |
239 | /* if a ro image is somewhat bad, it's probably all rubbish */ | 255 | /* if a ro image is somewhat bad, it's probably all rubbish */ |
240 | return writeable ? 2 : 1; | 256 | return writeable ? 2 : 1; |
diff --git a/drivers/gpu/drm/nouveau/core/subdev/bios/pll.c b/drivers/gpu/drm/nouveau/core/subdev/bios/pll.c index 5e5f4cddae3c..f835501203e5 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/bios/pll.c +++ b/drivers/gpu/drm/nouveau/core/subdev/bios/pll.c | |||
@@ -157,11 +157,10 @@ pll_map_reg(struct nouveau_bios *bios, u32 reg, u32 *type, u8 *ver, u8 *len) | |||
157 | while (map->reg) { | 157 | while (map->reg) { |
158 | if (map->reg == reg && *ver >= 0x20) { | 158 | if (map->reg == reg && *ver >= 0x20) { |
159 | u16 addr = (data += hdr); | 159 | u16 addr = (data += hdr); |
160 | *type = map->type; | ||
160 | while (cnt--) { | 161 | while (cnt--) { |
161 | if (nv_ro32(bios, data) == map->reg) { | 162 | if (nv_ro32(bios, data) == map->reg) |
162 | *type = map->type; | ||
163 | return data; | 163 | return data; |
164 | } | ||
165 | data += *len; | 164 | data += *len; |
166 | } | 165 | } |
167 | return addr; | 166 | return addr; |
@@ -200,11 +199,10 @@ pll_map_type(struct nouveau_bios *bios, u8 type, u32 *reg, u8 *ver, u8 *len) | |||
200 | while (map->reg) { | 199 | while (map->reg) { |
201 | if (map->type == type && *ver >= 0x20) { | 200 | if (map->type == type && *ver >= 0x20) { |
202 | u16 addr = (data += hdr); | 201 | u16 addr = (data += hdr); |
202 | *reg = map->reg; | ||
203 | while (cnt--) { | 203 | while (cnt--) { |
204 | if (nv_ro32(bios, data) == map->reg) { | 204 | if (nv_ro32(bios, data) == map->reg) |
205 | *reg = map->reg; | ||
206 | return data; | 205 | return data; |
207 | } | ||
208 | data += *len; | 206 | data += *len; |
209 | } | 207 | } |
210 | return addr; | 208 | return addr; |
diff --git a/drivers/gpu/drm/nouveau/core/subdev/fb/nv50.c b/drivers/gpu/drm/nouveau/core/subdev/fb/nv50.c index 42d7539e6525..5f570806143a 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/fb/nv50.c +++ b/drivers/gpu/drm/nouveau/core/subdev/fb/nv50.c | |||
@@ -219,13 +219,11 @@ nv50_fb_ctor(struct nouveau_object *parent, struct nouveau_object *engine, | |||
219 | ((priv->base.ram.size & 0x000000ff) << 32); | 219 | ((priv->base.ram.size & 0x000000ff) << 32); |
220 | 220 | ||
221 | tags = nv_rd32(priv, 0x100320); | 221 | tags = nv_rd32(priv, 0x100320); |
222 | if (tags) { | 222 | ret = nouveau_mm_init(&priv->base.tags, 0, tags, 1); |
223 | ret = nouveau_mm_init(&priv->base.tags, 0, tags, 1); | 223 | if (ret) |
224 | if (ret) | 224 | return ret; |
225 | return ret; | ||
226 | 225 | ||
227 | nv_debug(priv, "%d compression tags\n", tags); | 226 | nv_debug(priv, "%d compression tags\n", tags); |
228 | } | ||
229 | 227 | ||
230 | size = (priv->base.ram.size >> 12) - rsvd_head - rsvd_tail; | 228 | size = (priv->base.ram.size >> 12) - rsvd_head - rsvd_tail; |
231 | switch (device->chipset) { | 229 | switch (device->chipset) { |
@@ -237,6 +235,7 @@ nv50_fb_ctor(struct nouveau_object *parent, struct nouveau_object *engine, | |||
237 | return ret; | 235 | return ret; |
238 | 236 | ||
239 | priv->base.ram.stolen = (u64)nv_rd32(priv, 0x100e10) << 12; | 237 | priv->base.ram.stolen = (u64)nv_rd32(priv, 0x100e10) << 12; |
238 | priv->base.ram.type = NV_MEM_TYPE_STOLEN; | ||
240 | break; | 239 | break; |
241 | default: | 240 | default: |
242 | ret = nouveau_mm_init(&priv->base.vram, rsvd_head, size, | 241 | ret = nouveau_mm_init(&priv->base.vram, rsvd_head, size, |
diff --git a/drivers/gpu/drm/nouveau/core/subdev/i2c/base.c b/drivers/gpu/drm/nouveau/core/subdev/i2c/base.c index 3d2c88310f98..dbfc2abf0cfe 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/i2c/base.c +++ b/drivers/gpu/drm/nouveau/core/subdev/i2c/base.c | |||
@@ -292,7 +292,7 @@ nouveau_i2c_ctor(struct nouveau_object *parent, struct nouveau_object *engine, | |||
292 | case DCB_I2C_NVIO_BIT: | 292 | case DCB_I2C_NVIO_BIT: |
293 | port->drive = info.drive & 0x0f; | 293 | port->drive = info.drive & 0x0f; |
294 | if (device->card_type < NV_D0) { | 294 | if (device->card_type < NV_D0) { |
295 | if (info.drive >= ARRAY_SIZE(nv50_i2c_port)) | 295 | if (port->drive >= ARRAY_SIZE(nv50_i2c_port)) |
296 | break; | 296 | break; |
297 | port->drive = nv50_i2c_port[port->drive]; | 297 | port->drive = nv50_i2c_port[port->drive]; |
298 | port->sense = port->drive; | 298 | port->sense = port->drive; |
diff --git a/drivers/gpu/drm/nouveau/core/subdev/vm/nv41.c b/drivers/gpu/drm/nouveau/core/subdev/vm/nv41.c index 0203e1e12caa..49050d991e75 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/vm/nv41.c +++ b/drivers/gpu/drm/nouveau/core/subdev/vm/nv41.c | |||
@@ -92,7 +92,8 @@ nv41_vmmgr_ctor(struct nouveau_object *parent, struct nouveau_object *engine, | |||
92 | struct nv04_vmmgr_priv *priv; | 92 | struct nv04_vmmgr_priv *priv; |
93 | int ret; | 93 | int ret; |
94 | 94 | ||
95 | if (!nouveau_boolopt(device->cfgopt, "NvPCIE", true)) { | 95 | if (pci_find_capability(device->pdev, PCI_CAP_ID_AGP) || |
96 | !nouveau_boolopt(device->cfgopt, "NvPCIE", true)) { | ||
96 | return nouveau_object_ctor(parent, engine, &nv04_vmmgr_oclass, | 97 | return nouveau_object_ctor(parent, engine, &nv04_vmmgr_oclass, |
97 | data, size, pobject); | 98 | data, size, pobject); |
98 | } | 99 | } |
diff --git a/drivers/gpu/drm/nouveau/core/subdev/vm/nv44.c b/drivers/gpu/drm/nouveau/core/subdev/vm/nv44.c index 0ac18d05a146..aa8131436e3d 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/vm/nv44.c +++ b/drivers/gpu/drm/nouveau/core/subdev/vm/nv44.c | |||
@@ -163,7 +163,8 @@ nv44_vmmgr_ctor(struct nouveau_object *parent, struct nouveau_object *engine, | |||
163 | struct nv04_vmmgr_priv *priv; | 163 | struct nv04_vmmgr_priv *priv; |
164 | int ret; | 164 | int ret; |
165 | 165 | ||
166 | if (!nouveau_boolopt(device->cfgopt, "NvPCIE", true)) { | 166 | if (pci_find_capability(device->pdev, PCI_CAP_ID_AGP) || |
167 | !nouveau_boolopt(device->cfgopt, "NvPCIE", true)) { | ||
167 | return nouveau_object_ctor(parent, engine, &nv04_vmmgr_oclass, | 168 | return nouveau_object_ctor(parent, engine, &nv04_vmmgr_oclass, |
168 | data, size, pobject); | 169 | data, size, pobject); |
169 | } | 170 | } |
diff --git a/drivers/gpu/drm/nouveau/nouveau_display.c b/drivers/gpu/drm/nouveau/nouveau_display.c index 8f98e5a8c488..86124b131f4f 100644 --- a/drivers/gpu/drm/nouveau/nouveau_display.c +++ b/drivers/gpu/drm/nouveau/nouveau_display.c | |||
@@ -290,6 +290,7 @@ nouveau_display_create(struct drm_device *dev) | |||
290 | struct nouveau_drm *drm = nouveau_drm(dev); | 290 | struct nouveau_drm *drm = nouveau_drm(dev); |
291 | struct nouveau_disp *pdisp = nouveau_disp(drm->device); | 291 | struct nouveau_disp *pdisp = nouveau_disp(drm->device); |
292 | struct nouveau_display *disp; | 292 | struct nouveau_display *disp; |
293 | u32 pclass = dev->pdev->class >> 8; | ||
293 | int ret, gen; | 294 | int ret, gen; |
294 | 295 | ||
295 | disp = drm->display = kzalloc(sizeof(*disp), GFP_KERNEL); | 296 | disp = drm->display = kzalloc(sizeof(*disp), GFP_KERNEL); |
@@ -360,23 +361,27 @@ nouveau_display_create(struct drm_device *dev) | |||
360 | drm_kms_helper_poll_init(dev); | 361 | drm_kms_helper_poll_init(dev); |
361 | drm_kms_helper_poll_disable(dev); | 362 | drm_kms_helper_poll_disable(dev); |
362 | 363 | ||
363 | if (nv_device(drm->device)->card_type < NV_50) | 364 | if (nouveau_modeset == 1 || |
364 | ret = nv04_display_create(dev); | 365 | (nouveau_modeset < 0 && pclass == PCI_CLASS_DISPLAY_VGA)) { |
365 | else | 366 | if (nv_device(drm->device)->card_type < NV_50) |
366 | if (nv_device(drm->device)->card_type < NV_D0) | 367 | ret = nv04_display_create(dev); |
367 | ret = nv50_display_create(dev); | 368 | else |
368 | else | 369 | if (nv_device(drm->device)->card_type < NV_D0) |
369 | ret = nvd0_display_create(dev); | 370 | ret = nv50_display_create(dev); |
370 | if (ret) | 371 | else |
371 | goto disp_create_err; | 372 | ret = nvd0_display_create(dev); |
372 | |||
373 | if (dev->mode_config.num_crtc) { | ||
374 | ret = drm_vblank_init(dev, dev->mode_config.num_crtc); | ||
375 | if (ret) | 373 | if (ret) |
376 | goto vblank_err; | 374 | goto disp_create_err; |
375 | |||
376 | if (dev->mode_config.num_crtc) { | ||
377 | ret = drm_vblank_init(dev, dev->mode_config.num_crtc); | ||
378 | if (ret) | ||
379 | goto vblank_err; | ||
380 | } | ||
381 | |||
382 | nouveau_backlight_init(dev); | ||
377 | } | 383 | } |
378 | 384 | ||
379 | nouveau_backlight_init(dev); | ||
380 | return 0; | 385 | return 0; |
381 | 386 | ||
382 | vblank_err: | 387 | vblank_err: |
@@ -395,7 +400,8 @@ nouveau_display_destroy(struct drm_device *dev) | |||
395 | nouveau_backlight_exit(dev); | 400 | nouveau_backlight_exit(dev); |
396 | drm_vblank_cleanup(dev); | 401 | drm_vblank_cleanup(dev); |
397 | 402 | ||
398 | disp->dtor(dev); | 403 | if (disp->dtor) |
404 | disp->dtor(dev); | ||
399 | 405 | ||
400 | drm_kms_helper_poll_fini(dev); | 406 | drm_kms_helper_poll_fini(dev); |
401 | drm_mode_config_cleanup(dev); | 407 | drm_mode_config_cleanup(dev); |
@@ -530,9 +536,11 @@ nouveau_page_flip_reserve(struct nouveau_bo *old_bo, | |||
530 | if (ret) | 536 | if (ret) |
531 | goto fail; | 537 | goto fail; |
532 | 538 | ||
533 | ret = ttm_bo_reserve(&old_bo->bo, false, false, false, 0); | 539 | if (likely(old_bo != new_bo)) { |
534 | if (ret) | 540 | ret = ttm_bo_reserve(&old_bo->bo, false, false, false, 0); |
535 | goto fail_unreserve; | 541 | if (ret) |
542 | goto fail_unreserve; | ||
543 | } | ||
536 | 544 | ||
537 | return 0; | 545 | return 0; |
538 | 546 | ||
@@ -551,8 +559,10 @@ nouveau_page_flip_unreserve(struct nouveau_bo *old_bo, | |||
551 | nouveau_bo_fence(new_bo, fence); | 559 | nouveau_bo_fence(new_bo, fence); |
552 | ttm_bo_unreserve(&new_bo->bo); | 560 | ttm_bo_unreserve(&new_bo->bo); |
553 | 561 | ||
554 | nouveau_bo_fence(old_bo, fence); | 562 | if (likely(old_bo != new_bo)) { |
555 | ttm_bo_unreserve(&old_bo->bo); | 563 | nouveau_bo_fence(old_bo, fence); |
564 | ttm_bo_unreserve(&old_bo->bo); | ||
565 | } | ||
556 | 566 | ||
557 | nouveau_bo_unpin(old_bo); | 567 | nouveau_bo_unpin(old_bo); |
558 | } | 568 | } |
diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c index ccae8c26ae2b..0910125cbbc3 100644 --- a/drivers/gpu/drm/nouveau/nouveau_drm.c +++ b/drivers/gpu/drm/nouveau/nouveau_drm.c | |||
@@ -63,8 +63,9 @@ MODULE_PARM_DESC(noaccel, "disable kernel/abi16 acceleration"); | |||
63 | static int nouveau_noaccel = 0; | 63 | static int nouveau_noaccel = 0; |
64 | module_param_named(noaccel, nouveau_noaccel, int, 0400); | 64 | module_param_named(noaccel, nouveau_noaccel, int, 0400); |
65 | 65 | ||
66 | MODULE_PARM_DESC(modeset, "enable driver"); | 66 | MODULE_PARM_DESC(modeset, "enable driver (default: auto, " |
67 | static int nouveau_modeset = -1; | 67 | "0 = disabled, 1 = enabled, 2 = headless)"); |
68 | int nouveau_modeset = -1; | ||
68 | module_param_named(modeset, nouveau_modeset, int, 0400); | 69 | module_param_named(modeset, nouveau_modeset, int, 0400); |
69 | 70 | ||
70 | static struct drm_driver driver; | 71 | static struct drm_driver driver; |
@@ -363,7 +364,8 @@ nouveau_drm_unload(struct drm_device *dev) | |||
363 | 364 | ||
364 | nouveau_pm_fini(dev); | 365 | nouveau_pm_fini(dev); |
365 | 366 | ||
366 | nouveau_display_fini(dev); | 367 | if (dev->mode_config.num_crtc) |
368 | nouveau_display_fini(dev); | ||
367 | nouveau_display_destroy(dev); | 369 | nouveau_display_destroy(dev); |
368 | 370 | ||
369 | nouveau_irq_fini(dev); | 371 | nouveau_irq_fini(dev); |
@@ -403,13 +405,15 @@ nouveau_drm_suspend(struct pci_dev *pdev, pm_message_t pm_state) | |||
403 | pm_state.event == PM_EVENT_PRETHAW) | 405 | pm_state.event == PM_EVENT_PRETHAW) |
404 | return 0; | 406 | return 0; |
405 | 407 | ||
406 | NV_INFO(drm, "suspending fbcon...\n"); | 408 | if (dev->mode_config.num_crtc) { |
407 | nouveau_fbcon_set_suspend(dev, 1); | 409 | NV_INFO(drm, "suspending fbcon...\n"); |
410 | nouveau_fbcon_set_suspend(dev, 1); | ||
408 | 411 | ||
409 | NV_INFO(drm, "suspending display...\n"); | 412 | NV_INFO(drm, "suspending display...\n"); |
410 | ret = nouveau_display_suspend(dev); | 413 | ret = nouveau_display_suspend(dev); |
411 | if (ret) | 414 | if (ret) |
412 | return ret; | 415 | return ret; |
416 | } | ||
413 | 417 | ||
414 | NV_INFO(drm, "evicting buffers...\n"); | 418 | NV_INFO(drm, "evicting buffers...\n"); |
415 | ttm_bo_evict_mm(&drm->ttm.bdev, TTM_PL_VRAM); | 419 | ttm_bo_evict_mm(&drm->ttm.bdev, TTM_PL_VRAM); |
@@ -445,8 +449,10 @@ fail_client: | |||
445 | nouveau_client_init(&cli->base); | 449 | nouveau_client_init(&cli->base); |
446 | } | 450 | } |
447 | 451 | ||
448 | NV_INFO(drm, "resuming display...\n"); | 452 | if (dev->mode_config.num_crtc) { |
449 | nouveau_display_resume(dev); | 453 | NV_INFO(drm, "resuming display...\n"); |
454 | nouveau_display_resume(dev); | ||
455 | } | ||
450 | return ret; | 456 | return ret; |
451 | } | 457 | } |
452 | 458 | ||
@@ -486,8 +492,10 @@ nouveau_drm_resume(struct pci_dev *pdev) | |||
486 | nouveau_irq_postinstall(dev); | 492 | nouveau_irq_postinstall(dev); |
487 | nouveau_pm_resume(dev); | 493 | nouveau_pm_resume(dev); |
488 | 494 | ||
489 | NV_INFO(drm, "resuming display...\n"); | 495 | if (dev->mode_config.num_crtc) { |
490 | nouveau_display_resume(dev); | 496 | NV_INFO(drm, "resuming display...\n"); |
497 | nouveau_display_resume(dev); | ||
498 | } | ||
491 | return 0; | 499 | return 0; |
492 | } | 500 | } |
493 | 501 | ||
@@ -662,9 +670,7 @@ nouveau_drm_init(void) | |||
662 | #ifdef CONFIG_VGA_CONSOLE | 670 | #ifdef CONFIG_VGA_CONSOLE |
663 | if (vgacon_text_force()) | 671 | if (vgacon_text_force()) |
664 | nouveau_modeset = 0; | 672 | nouveau_modeset = 0; |
665 | else | ||
666 | #endif | 673 | #endif |
667 | nouveau_modeset = 1; | ||
668 | } | 674 | } |
669 | 675 | ||
670 | if (!nouveau_modeset) | 676 | if (!nouveau_modeset) |
diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.h b/drivers/gpu/drm/nouveau/nouveau_drm.h index 819471217546..a10169927086 100644 --- a/drivers/gpu/drm/nouveau/nouveau_drm.h +++ b/drivers/gpu/drm/nouveau/nouveau_drm.h | |||
@@ -141,4 +141,6 @@ int nouveau_drm_resume(struct pci_dev *); | |||
141 | nv_info((cli), fmt, ##args); \ | 141 | nv_info((cli), fmt, ##args); \ |
142 | } while (0) | 142 | } while (0) |
143 | 143 | ||
144 | extern int nouveau_modeset; | ||
145 | |||
144 | #endif | 146 | #endif |
diff --git a/drivers/gpu/drm/nouveau/nouveau_irq.c b/drivers/gpu/drm/nouveau/nouveau_irq.c index 9ca8afdb5549..1d8cb506a28a 100644 --- a/drivers/gpu/drm/nouveau/nouveau_irq.c +++ b/drivers/gpu/drm/nouveau/nouveau_irq.c | |||
@@ -61,13 +61,15 @@ nouveau_irq_handler(DRM_IRQ_ARGS) | |||
61 | 61 | ||
62 | nv_subdev(pmc)->intr(nv_subdev(pmc)); | 62 | nv_subdev(pmc)->intr(nv_subdev(pmc)); |
63 | 63 | ||
64 | if (device->card_type >= NV_D0) { | 64 | if (dev->mode_config.num_crtc) { |
65 | if (nv_rd32(device, 0x000100) & 0x04000000) | 65 | if (device->card_type >= NV_D0) { |
66 | nvd0_display_intr(dev); | 66 | if (nv_rd32(device, 0x000100) & 0x04000000) |
67 | } else | 67 | nvd0_display_intr(dev); |
68 | if (device->card_type >= NV_50) { | 68 | } else |
69 | if (nv_rd32(device, 0x000100) & 0x04000000) | 69 | if (device->card_type >= NV_50) { |
70 | nv50_display_intr(dev); | 70 | if (nv_rd32(device, 0x000100) & 0x04000000) |
71 | nv50_display_intr(dev); | ||
72 | } | ||
71 | } | 73 | } |
72 | 74 | ||
73 | return IRQ_HANDLED; | 75 | return IRQ_HANDLED; |
diff --git a/drivers/gpu/drm/nouveau/nv04_dac.c b/drivers/gpu/drm/nouveau/nv04_dac.c index 347a3bd78d04..64f7020fb605 100644 --- a/drivers/gpu/drm/nouveau/nv04_dac.c +++ b/drivers/gpu/drm/nouveau/nv04_dac.c | |||
@@ -220,7 +220,7 @@ out: | |||
220 | NVWriteVgaCrtc(dev, 0, NV_CIO_CR_MODE_INDEX, saved_cr_mode); | 220 | NVWriteVgaCrtc(dev, 0, NV_CIO_CR_MODE_INDEX, saved_cr_mode); |
221 | 221 | ||
222 | if (blue == 0x18) { | 222 | if (blue == 0x18) { |
223 | NV_INFO(drm, "Load detected on head A\n"); | 223 | NV_DEBUG(drm, "Load detected on head A\n"); |
224 | return connector_status_connected; | 224 | return connector_status_connected; |
225 | } | 225 | } |
226 | 226 | ||
@@ -338,8 +338,8 @@ nv17_dac_detect(struct drm_encoder *encoder, struct drm_connector *connector) | |||
338 | 338 | ||
339 | if (nv17_dac_sample_load(encoder) & | 339 | if (nv17_dac_sample_load(encoder) & |
340 | NV_PRAMDAC_TEST_CONTROL_SENSEB_ALLHI) { | 340 | NV_PRAMDAC_TEST_CONTROL_SENSEB_ALLHI) { |
341 | NV_INFO(drm, "Load detected on output %c\n", | 341 | NV_DEBUG(drm, "Load detected on output %c\n", |
342 | '@' + ffs(dcb->or)); | 342 | '@' + ffs(dcb->or)); |
343 | return connector_status_connected; | 343 | return connector_status_connected; |
344 | } else { | 344 | } else { |
345 | return connector_status_disconnected; | 345 | return connector_status_disconnected; |
@@ -413,9 +413,9 @@ static void nv04_dac_commit(struct drm_encoder *encoder) | |||
413 | 413 | ||
414 | helper->dpms(encoder, DRM_MODE_DPMS_ON); | 414 | helper->dpms(encoder, DRM_MODE_DPMS_ON); |
415 | 415 | ||
416 | NV_INFO(drm, "Output %s is running on CRTC %d using output %c\n", | 416 | NV_DEBUG(drm, "Output %s is running on CRTC %d using output %c\n", |
417 | drm_get_connector_name(&nouveau_encoder_connector_get(nv_encoder)->base), | 417 | drm_get_connector_name(&nouveau_encoder_connector_get(nv_encoder)->base), |
418 | nv_crtc->index, '@' + ffs(nv_encoder->dcb->or)); | 418 | nv_crtc->index, '@' + ffs(nv_encoder->dcb->or)); |
419 | } | 419 | } |
420 | 420 | ||
421 | void nv04_dac_update_dacclk(struct drm_encoder *encoder, bool enable) | 421 | void nv04_dac_update_dacclk(struct drm_encoder *encoder, bool enable) |
@@ -461,8 +461,8 @@ static void nv04_dac_dpms(struct drm_encoder *encoder, int mode) | |||
461 | return; | 461 | return; |
462 | nv_encoder->last_dpms = mode; | 462 | nv_encoder->last_dpms = mode; |
463 | 463 | ||
464 | NV_INFO(drm, "Setting dpms mode %d on vga encoder (output %d)\n", | 464 | NV_DEBUG(drm, "Setting dpms mode %d on vga encoder (output %d)\n", |
465 | mode, nv_encoder->dcb->index); | 465 | mode, nv_encoder->dcb->index); |
466 | 466 | ||
467 | nv04_dac_update_dacclk(encoder, mode == DRM_MODE_DPMS_ON); | 467 | nv04_dac_update_dacclk(encoder, mode == DRM_MODE_DPMS_ON); |
468 | } | 468 | } |
diff --git a/drivers/gpu/drm/nouveau/nv04_dfp.c b/drivers/gpu/drm/nouveau/nv04_dfp.c index da55d7642c8c..184cdf806761 100644 --- a/drivers/gpu/drm/nouveau/nv04_dfp.c +++ b/drivers/gpu/drm/nouveau/nv04_dfp.c | |||
@@ -476,9 +476,9 @@ static void nv04_dfp_commit(struct drm_encoder *encoder) | |||
476 | 476 | ||
477 | helper->dpms(encoder, DRM_MODE_DPMS_ON); | 477 | helper->dpms(encoder, DRM_MODE_DPMS_ON); |
478 | 478 | ||
479 | NV_INFO(drm, "Output %s is running on CRTC %d using output %c\n", | 479 | NV_DEBUG(drm, "Output %s is running on CRTC %d using output %c\n", |
480 | drm_get_connector_name(&nouveau_encoder_connector_get(nv_encoder)->base), | 480 | drm_get_connector_name(&nouveau_encoder_connector_get(nv_encoder)->base), |
481 | nv_crtc->index, '@' + ffs(nv_encoder->dcb->or)); | 481 | nv_crtc->index, '@' + ffs(nv_encoder->dcb->or)); |
482 | } | 482 | } |
483 | 483 | ||
484 | static void nv04_dfp_update_backlight(struct drm_encoder *encoder, int mode) | 484 | static void nv04_dfp_update_backlight(struct drm_encoder *encoder, int mode) |
@@ -520,8 +520,8 @@ static void nv04_lvds_dpms(struct drm_encoder *encoder, int mode) | |||
520 | return; | 520 | return; |
521 | nv_encoder->last_dpms = mode; | 521 | nv_encoder->last_dpms = mode; |
522 | 522 | ||
523 | NV_INFO(drm, "Setting dpms mode %d on lvds encoder (output %d)\n", | 523 | NV_DEBUG(drm, "Setting dpms mode %d on lvds encoder (output %d)\n", |
524 | mode, nv_encoder->dcb->index); | 524 | mode, nv_encoder->dcb->index); |
525 | 525 | ||
526 | if (was_powersaving && is_powersaving_dpms(mode)) | 526 | if (was_powersaving && is_powersaving_dpms(mode)) |
527 | return; | 527 | return; |
@@ -565,8 +565,8 @@ static void nv04_tmds_dpms(struct drm_encoder *encoder, int mode) | |||
565 | return; | 565 | return; |
566 | nv_encoder->last_dpms = mode; | 566 | nv_encoder->last_dpms = mode; |
567 | 567 | ||
568 | NV_INFO(drm, "Setting dpms mode %d on tmds encoder (output %d)\n", | 568 | NV_DEBUG(drm, "Setting dpms mode %d on tmds encoder (output %d)\n", |
569 | mode, nv_encoder->dcb->index); | 569 | mode, nv_encoder->dcb->index); |
570 | 570 | ||
571 | nv04_dfp_update_backlight(encoder, mode); | 571 | nv04_dfp_update_backlight(encoder, mode); |
572 | nv04_dfp_update_fp_control(encoder, mode); | 572 | nv04_dfp_update_fp_control(encoder, mode); |
diff --git a/drivers/gpu/drm/nouveau/nv04_tv.c b/drivers/gpu/drm/nouveau/nv04_tv.c index 099fbeda6e2e..62e826a139b3 100644 --- a/drivers/gpu/drm/nouveau/nv04_tv.c +++ b/drivers/gpu/drm/nouveau/nv04_tv.c | |||
@@ -75,8 +75,8 @@ static void nv04_tv_dpms(struct drm_encoder *encoder, int mode) | |||
75 | struct nv04_mode_state *state = &nv04_display(dev)->mode_reg; | 75 | struct nv04_mode_state *state = &nv04_display(dev)->mode_reg; |
76 | uint8_t crtc1A; | 76 | uint8_t crtc1A; |
77 | 77 | ||
78 | NV_INFO(drm, "Setting dpms mode %d on TV encoder (output %d)\n", | 78 | NV_DEBUG(drm, "Setting dpms mode %d on TV encoder (output %d)\n", |
79 | mode, nv_encoder->dcb->index); | 79 | mode, nv_encoder->dcb->index); |
80 | 80 | ||
81 | state->pllsel &= ~(PLLSEL_TV_CRTC1_MASK | PLLSEL_TV_CRTC2_MASK); | 81 | state->pllsel &= ~(PLLSEL_TV_CRTC1_MASK | PLLSEL_TV_CRTC2_MASK); |
82 | 82 | ||
@@ -167,9 +167,8 @@ static void nv04_tv_commit(struct drm_encoder *encoder) | |||
167 | 167 | ||
168 | helper->dpms(encoder, DRM_MODE_DPMS_ON); | 168 | helper->dpms(encoder, DRM_MODE_DPMS_ON); |
169 | 169 | ||
170 | NV_INFO(drm, "Output %s is running on CRTC %d using output %c\n", | 170 | NV_DEBUG(drm, "Output %s is running on CRTC %d using output %c\n", |
171 | drm_get_connector_name(&nouveau_encoder_connector_get(nv_encoder)->base), nv_crtc->index, | 171 | drm_get_connector_name(&nouveau_encoder_connector_get(nv_encoder)->base), nv_crtc->index, '@' + ffs(nv_encoder->dcb->or)); |
172 | '@' + ffs(nv_encoder->dcb->or)); | ||
173 | } | 172 | } |
174 | 173 | ||
175 | static void nv04_tv_destroy(struct drm_encoder *encoder) | 174 | static void nv04_tv_destroy(struct drm_encoder *encoder) |
diff --git a/drivers/gpu/drm/radeon/atombios_encoders.c b/drivers/gpu/drm/radeon/atombios_encoders.c index 49cbb3795a10..ba498f8e47a2 100644 --- a/drivers/gpu/drm/radeon/atombios_encoders.c +++ b/drivers/gpu/drm/radeon/atombios_encoders.c | |||
@@ -184,6 +184,7 @@ void radeon_atom_backlight_init(struct radeon_encoder *radeon_encoder, | |||
184 | struct radeon_backlight_privdata *pdata; | 184 | struct radeon_backlight_privdata *pdata; |
185 | struct radeon_encoder_atom_dig *dig; | 185 | struct radeon_encoder_atom_dig *dig; |
186 | u8 backlight_level; | 186 | u8 backlight_level; |
187 | char bl_name[16]; | ||
187 | 188 | ||
188 | if (!radeon_encoder->enc_priv) | 189 | if (!radeon_encoder->enc_priv) |
189 | return; | 190 | return; |
@@ -203,7 +204,9 @@ void radeon_atom_backlight_init(struct radeon_encoder *radeon_encoder, | |||
203 | memset(&props, 0, sizeof(props)); | 204 | memset(&props, 0, sizeof(props)); |
204 | props.max_brightness = RADEON_MAX_BL_LEVEL; | 205 | props.max_brightness = RADEON_MAX_BL_LEVEL; |
205 | props.type = BACKLIGHT_RAW; | 206 | props.type = BACKLIGHT_RAW; |
206 | bd = backlight_device_register("radeon_bl", &drm_connector->kdev, | 207 | snprintf(bl_name, sizeof(bl_name), |
208 | "radeon_bl%d", dev->primary->index); | ||
209 | bd = backlight_device_register(bl_name, &drm_connector->kdev, | ||
207 | pdata, &radeon_atom_backlight_ops, &props); | 210 | pdata, &radeon_atom_backlight_ops, &props); |
208 | if (IS_ERR(bd)) { | 211 | if (IS_ERR(bd)) { |
209 | DRM_ERROR("Backlight registration failed\n"); | 212 | DRM_ERROR("Backlight registration failed\n"); |
diff --git a/drivers/gpu/drm/radeon/evergreen_cs.c b/drivers/gpu/drm/radeon/evergreen_cs.c index 573ed1bc6cf7..95e6318b6268 100644 --- a/drivers/gpu/drm/radeon/evergreen_cs.c +++ b/drivers/gpu/drm/radeon/evergreen_cs.c | |||
@@ -264,7 +264,7 @@ static int evergreen_surface_check_2d(struct radeon_cs_parser *p, | |||
264 | /* macro tile width & height */ | 264 | /* macro tile width & height */ |
265 | palign = (8 * surf->bankw * track->npipes) * surf->mtilea; | 265 | palign = (8 * surf->bankw * track->npipes) * surf->mtilea; |
266 | halign = (8 * surf->bankh * surf->nbanks) / surf->mtilea; | 266 | halign = (8 * surf->bankh * surf->nbanks) / surf->mtilea; |
267 | mtileb = (palign / 8) * (halign / 8) * tileb;; | 267 | mtileb = (palign / 8) * (halign / 8) * tileb; |
268 | mtile_pr = surf->nbx / palign; | 268 | mtile_pr = surf->nbx / palign; |
269 | mtile_ps = (mtile_pr * surf->nby) / halign; | 269 | mtile_ps = (mtile_pr * surf->nby) / halign; |
270 | surf->layer_size = mtile_ps * mtileb * slice_pt; | 270 | surf->layer_size = mtile_ps * mtileb * slice_pt; |
@@ -2829,6 +2829,7 @@ static bool evergreen_vm_reg_valid(u32 reg) | |||
2829 | case CAYMAN_SQ_EX_ALLOC_TABLE_SLOTS: | 2829 | case CAYMAN_SQ_EX_ALLOC_TABLE_SLOTS: |
2830 | return true; | 2830 | return true; |
2831 | default: | 2831 | default: |
2832 | DRM_ERROR("Invalid register 0x%x in CS\n", reg); | ||
2832 | return false; | 2833 | return false; |
2833 | } | 2834 | } |
2834 | } | 2835 | } |
diff --git a/drivers/gpu/drm/radeon/ni.c b/drivers/gpu/drm/radeon/ni.c index 8c74c729586d..81e6a568c29d 100644 --- a/drivers/gpu/drm/radeon/ni.c +++ b/drivers/gpu/drm/radeon/ni.c | |||
@@ -1538,26 +1538,31 @@ void cayman_vm_set_page(struct radeon_device *rdev, uint64_t pe, | |||
1538 | { | 1538 | { |
1539 | struct radeon_ring *ring = &rdev->ring[rdev->asic->vm.pt_ring_index]; | 1539 | struct radeon_ring *ring = &rdev->ring[rdev->asic->vm.pt_ring_index]; |
1540 | uint32_t r600_flags = cayman_vm_page_flags(rdev, flags); | 1540 | uint32_t r600_flags = cayman_vm_page_flags(rdev, flags); |
1541 | int i; | ||
1542 | 1541 | ||
1543 | radeon_ring_write(ring, PACKET3(PACKET3_ME_WRITE, 1 + count * 2)); | 1542 | while (count) { |
1544 | radeon_ring_write(ring, pe); | 1543 | unsigned ndw = 1 + count * 2; |
1545 | radeon_ring_write(ring, upper_32_bits(pe) & 0xff); | 1544 | if (ndw > 0x3FFF) |
1546 | for (i = 0; i < count; ++i) { | 1545 | ndw = 0x3FFF; |
1547 | uint64_t value = 0; | 1546 | |
1548 | if (flags & RADEON_VM_PAGE_SYSTEM) { | 1547 | radeon_ring_write(ring, PACKET3(PACKET3_ME_WRITE, ndw)); |
1549 | value = radeon_vm_map_gart(rdev, addr); | 1548 | radeon_ring_write(ring, pe); |
1550 | value &= 0xFFFFFFFFFFFFF000ULL; | 1549 | radeon_ring_write(ring, upper_32_bits(pe) & 0xff); |
1551 | addr += incr; | 1550 | for (; ndw > 1; ndw -= 2, --count, pe += 8) { |
1552 | 1551 | uint64_t value = 0; | |
1553 | } else if (flags & RADEON_VM_PAGE_VALID) { | 1552 | if (flags & RADEON_VM_PAGE_SYSTEM) { |
1554 | value = addr; | 1553 | value = radeon_vm_map_gart(rdev, addr); |
1555 | addr += incr; | 1554 | value &= 0xFFFFFFFFFFFFF000ULL; |
1556 | } | 1555 | addr += incr; |
1556 | |||
1557 | } else if (flags & RADEON_VM_PAGE_VALID) { | ||
1558 | value = addr; | ||
1559 | addr += incr; | ||
1560 | } | ||
1557 | 1561 | ||
1558 | value |= r600_flags; | 1562 | value |= r600_flags; |
1559 | radeon_ring_write(ring, value); | 1563 | radeon_ring_write(ring, value); |
1560 | radeon_ring_write(ring, upper_32_bits(value)); | 1564 | radeon_ring_write(ring, upper_32_bits(value)); |
1565 | } | ||
1561 | } | 1566 | } |
1562 | } | 1567 | } |
1563 | 1568 | ||
@@ -1586,4 +1591,8 @@ void cayman_vm_flush(struct radeon_device *rdev, int ridx, struct radeon_vm *vm) | |||
1586 | /* bits 0-7 are the VM contexts0-7 */ | 1591 | /* bits 0-7 are the VM contexts0-7 */ |
1587 | radeon_ring_write(ring, PACKET0(VM_INVALIDATE_REQUEST, 0)); | 1592 | radeon_ring_write(ring, PACKET0(VM_INVALIDATE_REQUEST, 0)); |
1588 | radeon_ring_write(ring, 1 << vm->id); | 1593 | radeon_ring_write(ring, 1 << vm->id); |
1594 | |||
1595 | /* sync PFP to ME, otherwise we might get invalid PFP reads */ | ||
1596 | radeon_ring_write(ring, PACKET3(PACKET3_PFP_SYNC_ME, 0)); | ||
1597 | radeon_ring_write(ring, 0x0); | ||
1589 | } | 1598 | } |
diff --git a/drivers/gpu/drm/radeon/nid.h b/drivers/gpu/drm/radeon/nid.h index 2423d1b5d385..cbef6815907a 100644 --- a/drivers/gpu/drm/radeon/nid.h +++ b/drivers/gpu/drm/radeon/nid.h | |||
@@ -502,6 +502,7 @@ | |||
502 | #define PACKET3_MPEG_INDEX 0x3A | 502 | #define PACKET3_MPEG_INDEX 0x3A |
503 | #define PACKET3_WAIT_REG_MEM 0x3C | 503 | #define PACKET3_WAIT_REG_MEM 0x3C |
504 | #define PACKET3_MEM_WRITE 0x3D | 504 | #define PACKET3_MEM_WRITE 0x3D |
505 | #define PACKET3_PFP_SYNC_ME 0x42 | ||
505 | #define PACKET3_SURFACE_SYNC 0x43 | 506 | #define PACKET3_SURFACE_SYNC 0x43 |
506 | # define PACKET3_CB0_DEST_BASE_ENA (1 << 6) | 507 | # define PACKET3_CB0_DEST_BASE_ENA (1 << 6) |
507 | # define PACKET3_CB1_DEST_BASE_ENA (1 << 7) | 508 | # define PACKET3_CB1_DEST_BASE_ENA (1 << 7) |
diff --git a/drivers/gpu/drm/radeon/radeon_atpx_handler.c b/drivers/gpu/drm/radeon/radeon_atpx_handler.c index 1aa3f910b993..15f5ded65e0c 100644 --- a/drivers/gpu/drm/radeon/radeon_atpx_handler.c +++ b/drivers/gpu/drm/radeon/radeon_atpx_handler.c | |||
@@ -87,7 +87,7 @@ static union acpi_object *radeon_atpx_call(acpi_handle handle, int function, | |||
87 | atpx_arg_elements[1].integer.value = 0; | 87 | atpx_arg_elements[1].integer.value = 0; |
88 | } | 88 | } |
89 | 89 | ||
90 | status = acpi_evaluate_object(handle, "ATPX", &atpx_arg, &buffer); | 90 | status = acpi_evaluate_object(handle, NULL, &atpx_arg, &buffer); |
91 | 91 | ||
92 | /* Fail only if calling the method fails and ATPX is supported */ | 92 | /* Fail only if calling the method fails and ATPX is supported */ |
93 | if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) { | 93 | if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) { |
@@ -352,9 +352,9 @@ static int radeon_atpx_switchto(enum vga_switcheroo_client_id id) | |||
352 | } | 352 | } |
353 | 353 | ||
354 | /** | 354 | /** |
355 | * radeon_atpx_switchto - switch to the requested GPU | 355 | * radeon_atpx_power_state - power down/up the requested GPU |
356 | * | 356 | * |
357 | * @id: GPU to switch to | 357 | * @id: GPU to power down/up |
358 | * @state: requested power state (0 = off, 1 = on) | 358 | * @state: requested power state (0 = off, 1 = on) |
359 | * | 359 | * |
360 | * Execute the necessary ATPX function to power down/up the discrete GPU | 360 | * Execute the necessary ATPX function to power down/up the discrete GPU |
@@ -373,11 +373,11 @@ static int radeon_atpx_power_state(enum vga_switcheroo_client_id id, | |||
373 | } | 373 | } |
374 | 374 | ||
375 | /** | 375 | /** |
376 | * radeon_atpx_pci_probe_handle - look up the ATRM and ATPX handles | 376 | * radeon_atpx_pci_probe_handle - look up the ATPX handle |
377 | * | 377 | * |
378 | * @pdev: pci device | 378 | * @pdev: pci device |
379 | * | 379 | * |
380 | * Look up the ATPX and ATRM handles (all asics). | 380 | * Look up the ATPX handles (all asics). |
381 | * Returns true if the handles are found, false if not. | 381 | * Returns true if the handles are found, false if not. |
382 | */ | 382 | */ |
383 | static bool radeon_atpx_pci_probe_handle(struct pci_dev *pdev) | 383 | static bool radeon_atpx_pci_probe_handle(struct pci_dev *pdev) |
diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c b/drivers/gpu/drm/radeon/radeon_connectors.c index 67cfc1795ecd..b884c362a8c2 100644 --- a/drivers/gpu/drm/radeon/radeon_connectors.c +++ b/drivers/gpu/drm/radeon/radeon_connectors.c | |||
@@ -941,7 +941,7 @@ radeon_dvi_detect(struct drm_connector *connector, bool force) | |||
941 | struct drm_mode_object *obj; | 941 | struct drm_mode_object *obj; |
942 | int i; | 942 | int i; |
943 | enum drm_connector_status ret = connector_status_disconnected; | 943 | enum drm_connector_status ret = connector_status_disconnected; |
944 | bool dret = false; | 944 | bool dret = false, broken_edid = false; |
945 | 945 | ||
946 | if (!force && radeon_check_hpd_status_unchanged(connector)) | 946 | if (!force && radeon_check_hpd_status_unchanged(connector)) |
947 | return connector->status; | 947 | return connector->status; |
@@ -965,6 +965,9 @@ radeon_dvi_detect(struct drm_connector *connector, bool force) | |||
965 | ret = connector_status_disconnected; | 965 | ret = connector_status_disconnected; |
966 | DRM_ERROR("%s: detected RS690 floating bus bug, stopping ddc detect\n", drm_get_connector_name(connector)); | 966 | DRM_ERROR("%s: detected RS690 floating bus bug, stopping ddc detect\n", drm_get_connector_name(connector)); |
967 | radeon_connector->ddc_bus = NULL; | 967 | radeon_connector->ddc_bus = NULL; |
968 | } else { | ||
969 | ret = connector_status_connected; | ||
970 | broken_edid = true; /* defer use_digital to later */ | ||
968 | } | 971 | } |
969 | } else { | 972 | } else { |
970 | radeon_connector->use_digital = !!(radeon_connector->edid->input & DRM_EDID_INPUT_DIGITAL); | 973 | radeon_connector->use_digital = !!(radeon_connector->edid->input & DRM_EDID_INPUT_DIGITAL); |
@@ -1047,13 +1050,24 @@ radeon_dvi_detect(struct drm_connector *connector, bool force) | |||
1047 | 1050 | ||
1048 | encoder_funcs = encoder->helper_private; | 1051 | encoder_funcs = encoder->helper_private; |
1049 | if (encoder_funcs->detect) { | 1052 | if (encoder_funcs->detect) { |
1050 | if (ret != connector_status_connected) { | 1053 | if (!broken_edid) { |
1051 | ret = encoder_funcs->detect(encoder, connector); | 1054 | if (ret != connector_status_connected) { |
1052 | if (ret == connector_status_connected) { | 1055 | /* deal with analog monitors without DDC */ |
1053 | radeon_connector->use_digital = false; | 1056 | ret = encoder_funcs->detect(encoder, connector); |
1057 | if (ret == connector_status_connected) { | ||
1058 | radeon_connector->use_digital = false; | ||
1059 | } | ||
1060 | if (ret != connector_status_disconnected) | ||
1061 | radeon_connector->detected_by_load = true; | ||
1054 | } | 1062 | } |
1055 | if (ret != connector_status_disconnected) | 1063 | } else { |
1056 | radeon_connector->detected_by_load = true; | 1064 | enum drm_connector_status lret; |
1065 | /* assume digital unless load detected otherwise */ | ||
1066 | radeon_connector->use_digital = true; | ||
1067 | lret = encoder_funcs->detect(encoder, connector); | ||
1068 | DRM_DEBUG_KMS("load_detect %x returned: %x\n",encoder->encoder_type,lret); | ||
1069 | if (lret == connector_status_connected) | ||
1070 | radeon_connector->use_digital = false; | ||
1057 | } | 1071 | } |
1058 | break; | 1072 | break; |
1059 | } | 1073 | } |
diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c index bd13ca09eb62..e2f5f888c374 100644 --- a/drivers/gpu/drm/radeon/radeon_device.c +++ b/drivers/gpu/drm/radeon/radeon_device.c | |||
@@ -355,6 +355,8 @@ int radeon_wb_init(struct radeon_device *rdev) | |||
355 | */ | 355 | */ |
356 | void radeon_vram_location(struct radeon_device *rdev, struct radeon_mc *mc, u64 base) | 356 | void radeon_vram_location(struct radeon_device *rdev, struct radeon_mc *mc, u64 base) |
357 | { | 357 | { |
358 | uint64_t limit = (uint64_t)radeon_vram_limit << 20; | ||
359 | |||
358 | mc->vram_start = base; | 360 | mc->vram_start = base; |
359 | if (mc->mc_vram_size > (0xFFFFFFFF - base + 1)) { | 361 | if (mc->mc_vram_size > (0xFFFFFFFF - base + 1)) { |
360 | dev_warn(rdev->dev, "limiting VRAM to PCI aperture size\n"); | 362 | dev_warn(rdev->dev, "limiting VRAM to PCI aperture size\n"); |
@@ -368,8 +370,8 @@ void radeon_vram_location(struct radeon_device *rdev, struct radeon_mc *mc, u64 | |||
368 | mc->mc_vram_size = mc->aper_size; | 370 | mc->mc_vram_size = mc->aper_size; |
369 | } | 371 | } |
370 | mc->vram_end = mc->vram_start + mc->mc_vram_size - 1; | 372 | mc->vram_end = mc->vram_start + mc->mc_vram_size - 1; |
371 | if (radeon_vram_limit && radeon_vram_limit < mc->real_vram_size) | 373 | if (limit && limit < mc->real_vram_size) |
372 | mc->real_vram_size = radeon_vram_limit; | 374 | mc->real_vram_size = limit; |
373 | dev_info(rdev->dev, "VRAM: %lluM 0x%016llX - 0x%016llX (%lluM used)\n", | 375 | dev_info(rdev->dev, "VRAM: %lluM 0x%016llX - 0x%016llX (%lluM used)\n", |
374 | mc->mc_vram_size >> 20, mc->vram_start, | 376 | mc->mc_vram_size >> 20, mc->vram_start, |
375 | mc->vram_end, mc->real_vram_size >> 20); | 377 | mc->vram_end, mc->real_vram_size >> 20); |
@@ -835,6 +837,19 @@ static unsigned int radeon_vga_set_decode(void *cookie, bool state) | |||
835 | } | 837 | } |
836 | 838 | ||
837 | /** | 839 | /** |
840 | * radeon_check_pot_argument - check that argument is a power of two | ||
841 | * | ||
842 | * @arg: value to check | ||
843 | * | ||
844 | * Validates that a certain argument is a power of two (all asics). | ||
845 | * Returns true if argument is valid. | ||
846 | */ | ||
847 | static bool radeon_check_pot_argument(int arg) | ||
848 | { | ||
849 | return (arg & (arg - 1)) == 0; | ||
850 | } | ||
851 | |||
852 | /** | ||
838 | * radeon_check_arguments - validate module params | 853 | * radeon_check_arguments - validate module params |
839 | * | 854 | * |
840 | * @rdev: radeon_device pointer | 855 | * @rdev: radeon_device pointer |
@@ -845,52 +860,25 @@ static unsigned int radeon_vga_set_decode(void *cookie, bool state) | |||
845 | static void radeon_check_arguments(struct radeon_device *rdev) | 860 | static void radeon_check_arguments(struct radeon_device *rdev) |
846 | { | 861 | { |
847 | /* vramlimit must be a power of two */ | 862 | /* vramlimit must be a power of two */ |
848 | switch (radeon_vram_limit) { | 863 | if (!radeon_check_pot_argument(radeon_vram_limit)) { |
849 | case 0: | ||
850 | case 4: | ||
851 | case 8: | ||
852 | case 16: | ||
853 | case 32: | ||
854 | case 64: | ||
855 | case 128: | ||
856 | case 256: | ||
857 | case 512: | ||
858 | case 1024: | ||
859 | case 2048: | ||
860 | case 4096: | ||
861 | break; | ||
862 | default: | ||
863 | dev_warn(rdev->dev, "vram limit (%d) must be a power of 2\n", | 864 | dev_warn(rdev->dev, "vram limit (%d) must be a power of 2\n", |
864 | radeon_vram_limit); | 865 | radeon_vram_limit); |
865 | radeon_vram_limit = 0; | 866 | radeon_vram_limit = 0; |
866 | break; | ||
867 | } | 867 | } |
868 | radeon_vram_limit = radeon_vram_limit << 20; | 868 | |
869 | /* gtt size must be power of two and greater or equal to 32M */ | 869 | /* gtt size must be power of two and greater or equal to 32M */ |
870 | switch (radeon_gart_size) { | 870 | if (radeon_gart_size < 32) { |
871 | case 4: | ||
872 | case 8: | ||
873 | case 16: | ||
874 | dev_warn(rdev->dev, "gart size (%d) too small forcing to 512M\n", | 871 | dev_warn(rdev->dev, "gart size (%d) too small forcing to 512M\n", |
875 | radeon_gart_size); | 872 | radeon_gart_size); |
876 | radeon_gart_size = 512; | 873 | radeon_gart_size = 512; |
877 | break; | 874 | |
878 | case 32: | 875 | } else if (!radeon_check_pot_argument(radeon_gart_size)) { |
879 | case 64: | ||
880 | case 128: | ||
881 | case 256: | ||
882 | case 512: | ||
883 | case 1024: | ||
884 | case 2048: | ||
885 | case 4096: | ||
886 | break; | ||
887 | default: | ||
888 | dev_warn(rdev->dev, "gart size (%d) must be a power of 2\n", | 876 | dev_warn(rdev->dev, "gart size (%d) must be a power of 2\n", |
889 | radeon_gart_size); | 877 | radeon_gart_size); |
890 | radeon_gart_size = 512; | 878 | radeon_gart_size = 512; |
891 | break; | ||
892 | } | 879 | } |
893 | rdev->mc.gtt_size = radeon_gart_size * 1024 * 1024; | 880 | rdev->mc.gtt_size = (uint64_t)radeon_gart_size << 20; |
881 | |||
894 | /* AGP mode can only be -1, 1, 2, 4, 8 */ | 882 | /* AGP mode can only be -1, 1, 2, 4, 8 */ |
895 | switch (radeon_agpmode) { | 883 | switch (radeon_agpmode) { |
896 | case -1: | 884 | case -1: |
diff --git a/drivers/gpu/drm/radeon/radeon_gart.c b/drivers/gpu/drm/radeon/radeon_gart.c index a7677dd1ce98..4debd60e5aa6 100644 --- a/drivers/gpu/drm/radeon/radeon_gart.c +++ b/drivers/gpu/drm/radeon/radeon_gart.c | |||
@@ -355,14 +355,13 @@ int radeon_gart_init(struct radeon_device *rdev) | |||
355 | DRM_INFO("GART: num cpu pages %u, num gpu pages %u\n", | 355 | DRM_INFO("GART: num cpu pages %u, num gpu pages %u\n", |
356 | rdev->gart.num_cpu_pages, rdev->gart.num_gpu_pages); | 356 | rdev->gart.num_cpu_pages, rdev->gart.num_gpu_pages); |
357 | /* Allocate pages table */ | 357 | /* Allocate pages table */ |
358 | rdev->gart.pages = kzalloc(sizeof(void *) * rdev->gart.num_cpu_pages, | 358 | rdev->gart.pages = vzalloc(sizeof(void *) * rdev->gart.num_cpu_pages); |
359 | GFP_KERNEL); | ||
360 | if (rdev->gart.pages == NULL) { | 359 | if (rdev->gart.pages == NULL) { |
361 | radeon_gart_fini(rdev); | 360 | radeon_gart_fini(rdev); |
362 | return -ENOMEM; | 361 | return -ENOMEM; |
363 | } | 362 | } |
364 | rdev->gart.pages_addr = kzalloc(sizeof(dma_addr_t) * | 363 | rdev->gart.pages_addr = vzalloc(sizeof(dma_addr_t) * |
365 | rdev->gart.num_cpu_pages, GFP_KERNEL); | 364 | rdev->gart.num_cpu_pages); |
366 | if (rdev->gart.pages_addr == NULL) { | 365 | if (rdev->gart.pages_addr == NULL) { |
367 | radeon_gart_fini(rdev); | 366 | radeon_gart_fini(rdev); |
368 | return -ENOMEM; | 367 | return -ENOMEM; |
@@ -388,8 +387,8 @@ void radeon_gart_fini(struct radeon_device *rdev) | |||
388 | radeon_gart_unbind(rdev, 0, rdev->gart.num_cpu_pages); | 387 | radeon_gart_unbind(rdev, 0, rdev->gart.num_cpu_pages); |
389 | } | 388 | } |
390 | rdev->gart.ready = false; | 389 | rdev->gart.ready = false; |
391 | kfree(rdev->gart.pages); | 390 | vfree(rdev->gart.pages); |
392 | kfree(rdev->gart.pages_addr); | 391 | vfree(rdev->gart.pages_addr); |
393 | rdev->gart.pages = NULL; | 392 | rdev->gart.pages = NULL; |
394 | rdev->gart.pages_addr = NULL; | 393 | rdev->gart.pages_addr = NULL; |
395 | 394 | ||
@@ -577,7 +576,7 @@ void radeon_vm_manager_fini(struct radeon_device *rdev) | |||
577 | * | 576 | * |
578 | * Global and local mutex must be locked! | 577 | * Global and local mutex must be locked! |
579 | */ | 578 | */ |
580 | int radeon_vm_evict(struct radeon_device *rdev, struct radeon_vm *vm) | 579 | static int radeon_vm_evict(struct radeon_device *rdev, struct radeon_vm *vm) |
581 | { | 580 | { |
582 | struct radeon_vm *vm_evict; | 581 | struct radeon_vm *vm_evict; |
583 | 582 | ||
@@ -1036,8 +1035,7 @@ static void radeon_vm_update_ptes(struct radeon_device *rdev, | |||
1036 | pte = radeon_sa_bo_gpu_addr(vm->page_tables[pt_idx]); | 1035 | pte = radeon_sa_bo_gpu_addr(vm->page_tables[pt_idx]); |
1037 | pte += (addr & mask) * 8; | 1036 | pte += (addr & mask) * 8; |
1038 | 1037 | ||
1039 | if (((last_pte + 8 * count) != pte) || | 1038 | if ((last_pte + 8 * count) != pte) { |
1040 | ((count + nptes) > 1 << 11)) { | ||
1041 | 1039 | ||
1042 | if (count) { | 1040 | if (count) { |
1043 | radeon_asic_vm_set_page(rdev, last_pte, | 1041 | radeon_asic_vm_set_page(rdev, last_pte, |
@@ -1148,17 +1146,17 @@ int radeon_vm_bo_update_pte(struct radeon_device *rdev, | |||
1148 | 1146 | ||
1149 | if (RADEON_VM_BLOCK_SIZE > 11) | 1147 | if (RADEON_VM_BLOCK_SIZE > 11) |
1150 | /* reserve space for one header for every 2k dwords */ | 1148 | /* reserve space for one header for every 2k dwords */ |
1151 | ndw += (nptes >> 11) * 3; | 1149 | ndw += (nptes >> 11) * 4; |
1152 | else | 1150 | else |
1153 | /* reserve space for one header for | 1151 | /* reserve space for one header for |
1154 | every (1 << BLOCK_SIZE) entries */ | 1152 | every (1 << BLOCK_SIZE) entries */ |
1155 | ndw += (nptes >> RADEON_VM_BLOCK_SIZE) * 3; | 1153 | ndw += (nptes >> RADEON_VM_BLOCK_SIZE) * 4; |
1156 | 1154 | ||
1157 | /* reserve space for pte addresses */ | 1155 | /* reserve space for pte addresses */ |
1158 | ndw += nptes * 2; | 1156 | ndw += nptes * 2; |
1159 | 1157 | ||
1160 | /* reserve space for one header for every 2k dwords */ | 1158 | /* reserve space for one header for every 2k dwords */ |
1161 | ndw += (npdes >> 11) * 3; | 1159 | ndw += (npdes >> 11) * 4; |
1162 | 1160 | ||
1163 | /* reserve space for pde addresses */ | 1161 | /* reserve space for pde addresses */ |
1164 | ndw += npdes * 2; | 1162 | ndw += npdes * 2; |
diff --git a/drivers/gpu/drm/radeon/radeon_gem.c b/drivers/gpu/drm/radeon/radeon_gem.c index f38fbcc46935..fe5c1f6b7957 100644 --- a/drivers/gpu/drm/radeon/radeon_gem.c +++ b/drivers/gpu/drm/radeon/radeon_gem.c | |||
@@ -53,6 +53,7 @@ int radeon_gem_object_create(struct radeon_device *rdev, int size, | |||
53 | struct drm_gem_object **obj) | 53 | struct drm_gem_object **obj) |
54 | { | 54 | { |
55 | struct radeon_bo *robj; | 55 | struct radeon_bo *robj; |
56 | unsigned long max_size; | ||
56 | int r; | 57 | int r; |
57 | 58 | ||
58 | *obj = NULL; | 59 | *obj = NULL; |
@@ -60,11 +61,26 @@ int radeon_gem_object_create(struct radeon_device *rdev, int size, | |||
60 | if (alignment < PAGE_SIZE) { | 61 | if (alignment < PAGE_SIZE) { |
61 | alignment = PAGE_SIZE; | 62 | alignment = PAGE_SIZE; |
62 | } | 63 | } |
64 | |||
65 | /* maximun bo size is the minimun btw visible vram and gtt size */ | ||
66 | max_size = min(rdev->mc.visible_vram_size, rdev->mc.gtt_size); | ||
67 | if (size > max_size) { | ||
68 | printk(KERN_WARNING "%s:%d alloc size %dMb bigger than %ldMb limit\n", | ||
69 | __func__, __LINE__, size >> 20, max_size >> 20); | ||
70 | return -ENOMEM; | ||
71 | } | ||
72 | |||
73 | retry: | ||
63 | r = radeon_bo_create(rdev, size, alignment, kernel, initial_domain, NULL, &robj); | 74 | r = radeon_bo_create(rdev, size, alignment, kernel, initial_domain, NULL, &robj); |
64 | if (r) { | 75 | if (r) { |
65 | if (r != -ERESTARTSYS) | 76 | if (r != -ERESTARTSYS) { |
77 | if (initial_domain == RADEON_GEM_DOMAIN_VRAM) { | ||
78 | initial_domain |= RADEON_GEM_DOMAIN_GTT; | ||
79 | goto retry; | ||
80 | } | ||
66 | DRM_ERROR("Failed to allocate GEM object (%d, %d, %u, %d)\n", | 81 | DRM_ERROR("Failed to allocate GEM object (%d, %d, %u, %d)\n", |
67 | size, initial_domain, alignment, r); | 82 | size, initial_domain, alignment, r); |
83 | } | ||
68 | return r; | 84 | return r; |
69 | } | 85 | } |
70 | *obj = &robj->gem_base; | 86 | *obj = &robj->gem_base; |
diff --git a/drivers/gpu/drm/radeon/radeon_legacy_crtc.c b/drivers/gpu/drm/radeon/radeon_legacy_crtc.c index 5677a424b585..6857cb4efb76 100644 --- a/drivers/gpu/drm/radeon/radeon_legacy_crtc.c +++ b/drivers/gpu/drm/radeon/radeon_legacy_crtc.c | |||
@@ -295,6 +295,7 @@ static void radeon_crtc_dpms(struct drm_crtc *crtc, int mode) | |||
295 | struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc); | 295 | struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc); |
296 | struct drm_device *dev = crtc->dev; | 296 | struct drm_device *dev = crtc->dev; |
297 | struct radeon_device *rdev = dev->dev_private; | 297 | struct radeon_device *rdev = dev->dev_private; |
298 | uint32_t crtc_ext_cntl = 0; | ||
298 | uint32_t mask; | 299 | uint32_t mask; |
299 | 300 | ||
300 | if (radeon_crtc->crtc_id) | 301 | if (radeon_crtc->crtc_id) |
@@ -307,6 +308,16 @@ static void radeon_crtc_dpms(struct drm_crtc *crtc, int mode) | |||
307 | RADEON_CRTC_VSYNC_DIS | | 308 | RADEON_CRTC_VSYNC_DIS | |
308 | RADEON_CRTC_HSYNC_DIS); | 309 | RADEON_CRTC_HSYNC_DIS); |
309 | 310 | ||
311 | /* | ||
312 | * On all dual CRTC GPUs this bit controls the CRTC of the primary DAC. | ||
313 | * Therefore it is set in the DAC DMPS function. | ||
314 | * This is different for GPU's with a single CRTC but a primary and a | ||
315 | * TV DAC: here it controls the single CRTC no matter where it is | ||
316 | * routed. Therefore we set it here. | ||
317 | */ | ||
318 | if (rdev->flags & RADEON_SINGLE_CRTC) | ||
319 | crtc_ext_cntl = RADEON_CRTC_CRT_ON; | ||
320 | |||
310 | switch (mode) { | 321 | switch (mode) { |
311 | case DRM_MODE_DPMS_ON: | 322 | case DRM_MODE_DPMS_ON: |
312 | radeon_crtc->enabled = true; | 323 | radeon_crtc->enabled = true; |
@@ -317,7 +328,7 @@ static void radeon_crtc_dpms(struct drm_crtc *crtc, int mode) | |||
317 | else { | 328 | else { |
318 | WREG32_P(RADEON_CRTC_GEN_CNTL, RADEON_CRTC_EN, ~(RADEON_CRTC_EN | | 329 | WREG32_P(RADEON_CRTC_GEN_CNTL, RADEON_CRTC_EN, ~(RADEON_CRTC_EN | |
319 | RADEON_CRTC_DISP_REQ_EN_B)); | 330 | RADEON_CRTC_DISP_REQ_EN_B)); |
320 | WREG32_P(RADEON_CRTC_EXT_CNTL, 0, ~mask); | 331 | WREG32_P(RADEON_CRTC_EXT_CNTL, crtc_ext_cntl, ~(mask | crtc_ext_cntl)); |
321 | } | 332 | } |
322 | drm_vblank_post_modeset(dev, radeon_crtc->crtc_id); | 333 | drm_vblank_post_modeset(dev, radeon_crtc->crtc_id); |
323 | radeon_crtc_load_lut(crtc); | 334 | radeon_crtc_load_lut(crtc); |
@@ -331,7 +342,7 @@ static void radeon_crtc_dpms(struct drm_crtc *crtc, int mode) | |||
331 | else { | 342 | else { |
332 | WREG32_P(RADEON_CRTC_GEN_CNTL, RADEON_CRTC_DISP_REQ_EN_B, ~(RADEON_CRTC_EN | | 343 | WREG32_P(RADEON_CRTC_GEN_CNTL, RADEON_CRTC_DISP_REQ_EN_B, ~(RADEON_CRTC_EN | |
333 | RADEON_CRTC_DISP_REQ_EN_B)); | 344 | RADEON_CRTC_DISP_REQ_EN_B)); |
334 | WREG32_P(RADEON_CRTC_EXT_CNTL, mask, ~mask); | 345 | WREG32_P(RADEON_CRTC_EXT_CNTL, mask, ~(mask | crtc_ext_cntl)); |
335 | } | 346 | } |
336 | radeon_crtc->enabled = false; | 347 | radeon_crtc->enabled = false; |
337 | /* adjust pm to dpms changes AFTER disabling crtcs */ | 348 | /* adjust pm to dpms changes AFTER disabling crtcs */ |
diff --git a/drivers/gpu/drm/radeon/radeon_legacy_encoders.c b/drivers/gpu/drm/radeon/radeon_legacy_encoders.c index a13ad9d707cf..f5ba2241dacc 100644 --- a/drivers/gpu/drm/radeon/radeon_legacy_encoders.c +++ b/drivers/gpu/drm/radeon/radeon_legacy_encoders.c | |||
@@ -370,6 +370,7 @@ void radeon_legacy_backlight_init(struct radeon_encoder *radeon_encoder, | |||
370 | struct backlight_properties props; | 370 | struct backlight_properties props; |
371 | struct radeon_backlight_privdata *pdata; | 371 | struct radeon_backlight_privdata *pdata; |
372 | uint8_t backlight_level; | 372 | uint8_t backlight_level; |
373 | char bl_name[16]; | ||
373 | 374 | ||
374 | if (!radeon_encoder->enc_priv) | 375 | if (!radeon_encoder->enc_priv) |
375 | return; | 376 | return; |
@@ -389,7 +390,9 @@ void radeon_legacy_backlight_init(struct radeon_encoder *radeon_encoder, | |||
389 | memset(&props, 0, sizeof(props)); | 390 | memset(&props, 0, sizeof(props)); |
390 | props.max_brightness = RADEON_MAX_BL_LEVEL; | 391 | props.max_brightness = RADEON_MAX_BL_LEVEL; |
391 | props.type = BACKLIGHT_RAW; | 392 | props.type = BACKLIGHT_RAW; |
392 | bd = backlight_device_register("radeon_bl", &drm_connector->kdev, | 393 | snprintf(bl_name, sizeof(bl_name), |
394 | "radeon_bl%d", dev->primary->index); | ||
395 | bd = backlight_device_register(bl_name, &drm_connector->kdev, | ||
393 | pdata, &radeon_backlight_ops, &props); | 396 | pdata, &radeon_backlight_ops, &props); |
394 | if (IS_ERR(bd)) { | 397 | if (IS_ERR(bd)) { |
395 | DRM_ERROR("Backlight registration failed\n"); | 398 | DRM_ERROR("Backlight registration failed\n"); |
@@ -534,7 +537,9 @@ static void radeon_legacy_primary_dac_dpms(struct drm_encoder *encoder, int mode | |||
534 | break; | 537 | break; |
535 | } | 538 | } |
536 | 539 | ||
537 | WREG32(RADEON_CRTC_EXT_CNTL, crtc_ext_cntl); | 540 | /* handled in radeon_crtc_dpms() */ |
541 | if (!(rdev->flags & RADEON_SINGLE_CRTC)) | ||
542 | WREG32(RADEON_CRTC_EXT_CNTL, crtc_ext_cntl); | ||
538 | WREG32(RADEON_DAC_CNTL, dac_cntl); | 543 | WREG32(RADEON_DAC_CNTL, dac_cntl); |
539 | WREG32(RADEON_DAC_MACRO_CNTL, dac_macro_cntl); | 544 | WREG32(RADEON_DAC_MACRO_CNTL, dac_macro_cntl); |
540 | 545 | ||
@@ -659,6 +664,8 @@ static enum drm_connector_status radeon_legacy_primary_dac_detect(struct drm_enc | |||
659 | 664 | ||
660 | if (ASIC_IS_R300(rdev)) | 665 | if (ASIC_IS_R300(rdev)) |
661 | tmp |= (0x1b6 << RADEON_DAC_FORCE_DATA_SHIFT); | 666 | tmp |= (0x1b6 << RADEON_DAC_FORCE_DATA_SHIFT); |
667 | else if (ASIC_IS_RV100(rdev)) | ||
668 | tmp |= (0x1ac << RADEON_DAC_FORCE_DATA_SHIFT); | ||
662 | else | 669 | else |
663 | tmp |= (0x180 << RADEON_DAC_FORCE_DATA_SHIFT); | 670 | tmp |= (0x180 << RADEON_DAC_FORCE_DATA_SHIFT); |
664 | 671 | ||
@@ -668,6 +675,7 @@ static enum drm_connector_status radeon_legacy_primary_dac_detect(struct drm_enc | |||
668 | tmp |= RADEON_DAC_RANGE_CNTL_PS2 | RADEON_DAC_CMP_EN; | 675 | tmp |= RADEON_DAC_RANGE_CNTL_PS2 | RADEON_DAC_CMP_EN; |
669 | WREG32(RADEON_DAC_CNTL, tmp); | 676 | WREG32(RADEON_DAC_CNTL, tmp); |
670 | 677 | ||
678 | tmp = dac_macro_cntl; | ||
671 | tmp &= ~(RADEON_DAC_PDWN_R | | 679 | tmp &= ~(RADEON_DAC_PDWN_R | |
672 | RADEON_DAC_PDWN_G | | 680 | RADEON_DAC_PDWN_G | |
673 | RADEON_DAC_PDWN_B); | 681 | RADEON_DAC_PDWN_B); |
@@ -1089,7 +1097,8 @@ static void radeon_legacy_tv_dac_dpms(struct drm_encoder *encoder, int mode) | |||
1089 | } else { | 1097 | } else { |
1090 | if (is_tv) | 1098 | if (is_tv) |
1091 | WREG32(RADEON_TV_MASTER_CNTL, tv_master_cntl); | 1099 | WREG32(RADEON_TV_MASTER_CNTL, tv_master_cntl); |
1092 | else | 1100 | /* handled in radeon_crtc_dpms() */ |
1101 | else if (!(rdev->flags & RADEON_SINGLE_CRTC)) | ||
1093 | WREG32(RADEON_CRTC2_GEN_CNTL, crtc2_gen_cntl); | 1102 | WREG32(RADEON_CRTC2_GEN_CNTL, crtc2_gen_cntl); |
1094 | WREG32(RADEON_TV_DAC_CNTL, tv_dac_cntl); | 1103 | WREG32(RADEON_TV_DAC_CNTL, tv_dac_cntl); |
1095 | } | 1104 | } |
@@ -1413,13 +1422,104 @@ static bool radeon_legacy_tv_detect(struct drm_encoder *encoder, | |||
1413 | return found; | 1422 | return found; |
1414 | } | 1423 | } |
1415 | 1424 | ||
1425 | static bool radeon_legacy_ext_dac_detect(struct drm_encoder *encoder, | ||
1426 | struct drm_connector *connector) | ||
1427 | { | ||
1428 | struct drm_device *dev = encoder->dev; | ||
1429 | struct radeon_device *rdev = dev->dev_private; | ||
1430 | uint32_t gpio_monid, fp2_gen_cntl, disp_output_cntl, crtc2_gen_cntl; | ||
1431 | uint32_t disp_lin_trans_grph_a, disp_lin_trans_grph_b, disp_lin_trans_grph_c; | ||
1432 | uint32_t disp_lin_trans_grph_d, disp_lin_trans_grph_e, disp_lin_trans_grph_f; | ||
1433 | uint32_t tmp, crtc2_h_total_disp, crtc2_v_total_disp; | ||
1434 | uint32_t crtc2_h_sync_strt_wid, crtc2_v_sync_strt_wid; | ||
1435 | bool found = false; | ||
1436 | int i; | ||
1437 | |||
1438 | /* save the regs we need */ | ||
1439 | gpio_monid = RREG32(RADEON_GPIO_MONID); | ||
1440 | fp2_gen_cntl = RREG32(RADEON_FP2_GEN_CNTL); | ||
1441 | disp_output_cntl = RREG32(RADEON_DISP_OUTPUT_CNTL); | ||
1442 | crtc2_gen_cntl = RREG32(RADEON_CRTC2_GEN_CNTL); | ||
1443 | disp_lin_trans_grph_a = RREG32(RADEON_DISP_LIN_TRANS_GRPH_A); | ||
1444 | disp_lin_trans_grph_b = RREG32(RADEON_DISP_LIN_TRANS_GRPH_B); | ||
1445 | disp_lin_trans_grph_c = RREG32(RADEON_DISP_LIN_TRANS_GRPH_C); | ||
1446 | disp_lin_trans_grph_d = RREG32(RADEON_DISP_LIN_TRANS_GRPH_D); | ||
1447 | disp_lin_trans_grph_e = RREG32(RADEON_DISP_LIN_TRANS_GRPH_E); | ||
1448 | disp_lin_trans_grph_f = RREG32(RADEON_DISP_LIN_TRANS_GRPH_F); | ||
1449 | crtc2_h_total_disp = RREG32(RADEON_CRTC2_H_TOTAL_DISP); | ||
1450 | crtc2_v_total_disp = RREG32(RADEON_CRTC2_V_TOTAL_DISP); | ||
1451 | crtc2_h_sync_strt_wid = RREG32(RADEON_CRTC2_H_SYNC_STRT_WID); | ||
1452 | crtc2_v_sync_strt_wid = RREG32(RADEON_CRTC2_V_SYNC_STRT_WID); | ||
1453 | |||
1454 | tmp = RREG32(RADEON_GPIO_MONID); | ||
1455 | tmp &= ~RADEON_GPIO_A_0; | ||
1456 | WREG32(RADEON_GPIO_MONID, tmp); | ||
1457 | |||
1458 | WREG32(RADEON_FP2_GEN_CNTL, (RADEON_FP2_ON | | ||
1459 | RADEON_FP2_PANEL_FORMAT | | ||
1460 | R200_FP2_SOURCE_SEL_TRANS_UNIT | | ||
1461 | RADEON_FP2_DVO_EN | | ||
1462 | R200_FP2_DVO_RATE_SEL_SDR)); | ||
1463 | |||
1464 | WREG32(RADEON_DISP_OUTPUT_CNTL, (RADEON_DISP_DAC_SOURCE_RMX | | ||
1465 | RADEON_DISP_TRANS_MATRIX_GRAPHICS)); | ||
1466 | |||
1467 | WREG32(RADEON_CRTC2_GEN_CNTL, (RADEON_CRTC2_EN | | ||
1468 | RADEON_CRTC2_DISP_REQ_EN_B)); | ||
1469 | |||
1470 | WREG32(RADEON_DISP_LIN_TRANS_GRPH_A, 0x00000000); | ||
1471 | WREG32(RADEON_DISP_LIN_TRANS_GRPH_B, 0x000003f0); | ||
1472 | WREG32(RADEON_DISP_LIN_TRANS_GRPH_C, 0x00000000); | ||
1473 | WREG32(RADEON_DISP_LIN_TRANS_GRPH_D, 0x000003f0); | ||
1474 | WREG32(RADEON_DISP_LIN_TRANS_GRPH_E, 0x00000000); | ||
1475 | WREG32(RADEON_DISP_LIN_TRANS_GRPH_F, 0x000003f0); | ||
1476 | |||
1477 | WREG32(RADEON_CRTC2_H_TOTAL_DISP, 0x01000008); | ||
1478 | WREG32(RADEON_CRTC2_H_SYNC_STRT_WID, 0x00000800); | ||
1479 | WREG32(RADEON_CRTC2_V_TOTAL_DISP, 0x00080001); | ||
1480 | WREG32(RADEON_CRTC2_V_SYNC_STRT_WID, 0x00000080); | ||
1481 | |||
1482 | for (i = 0; i < 200; i++) { | ||
1483 | tmp = RREG32(RADEON_GPIO_MONID); | ||
1484 | if (tmp & RADEON_GPIO_Y_0) | ||
1485 | found = true; | ||
1486 | |||
1487 | if (found) | ||
1488 | break; | ||
1489 | |||
1490 | if (!drm_can_sleep()) | ||
1491 | mdelay(1); | ||
1492 | else | ||
1493 | msleep(1); | ||
1494 | } | ||
1495 | |||
1496 | /* restore the regs we used */ | ||
1497 | WREG32(RADEON_DISP_LIN_TRANS_GRPH_A, disp_lin_trans_grph_a); | ||
1498 | WREG32(RADEON_DISP_LIN_TRANS_GRPH_B, disp_lin_trans_grph_b); | ||
1499 | WREG32(RADEON_DISP_LIN_TRANS_GRPH_C, disp_lin_trans_grph_c); | ||
1500 | WREG32(RADEON_DISP_LIN_TRANS_GRPH_D, disp_lin_trans_grph_d); | ||
1501 | WREG32(RADEON_DISP_LIN_TRANS_GRPH_E, disp_lin_trans_grph_e); | ||
1502 | WREG32(RADEON_DISP_LIN_TRANS_GRPH_F, disp_lin_trans_grph_f); | ||
1503 | WREG32(RADEON_CRTC2_H_TOTAL_DISP, crtc2_h_total_disp); | ||
1504 | WREG32(RADEON_CRTC2_V_TOTAL_DISP, crtc2_v_total_disp); | ||
1505 | WREG32(RADEON_CRTC2_H_SYNC_STRT_WID, crtc2_h_sync_strt_wid); | ||
1506 | WREG32(RADEON_CRTC2_V_SYNC_STRT_WID, crtc2_v_sync_strt_wid); | ||
1507 | WREG32(RADEON_CRTC2_GEN_CNTL, crtc2_gen_cntl); | ||
1508 | WREG32(RADEON_DISP_OUTPUT_CNTL, disp_output_cntl); | ||
1509 | WREG32(RADEON_FP2_GEN_CNTL, fp2_gen_cntl); | ||
1510 | WREG32(RADEON_GPIO_MONID, gpio_monid); | ||
1511 | |||
1512 | return found; | ||
1513 | } | ||
1514 | |||
1416 | static enum drm_connector_status radeon_legacy_tv_dac_detect(struct drm_encoder *encoder, | 1515 | static enum drm_connector_status radeon_legacy_tv_dac_detect(struct drm_encoder *encoder, |
1417 | struct drm_connector *connector) | 1516 | struct drm_connector *connector) |
1418 | { | 1517 | { |
1419 | struct drm_device *dev = encoder->dev; | 1518 | struct drm_device *dev = encoder->dev; |
1420 | struct radeon_device *rdev = dev->dev_private; | 1519 | struct radeon_device *rdev = dev->dev_private; |
1421 | uint32_t crtc2_gen_cntl, tv_dac_cntl, dac_cntl2, dac_ext_cntl; | 1520 | uint32_t crtc2_gen_cntl = 0, tv_dac_cntl, dac_cntl2, dac_ext_cntl; |
1422 | uint32_t disp_hw_debug, disp_output_cntl, gpiopad_a, pixclks_cntl, tmp; | 1521 | uint32_t gpiopad_a = 0, pixclks_cntl, tmp; |
1522 | uint32_t disp_output_cntl = 0, disp_hw_debug = 0, crtc_ext_cntl = 0; | ||
1423 | enum drm_connector_status found = connector_status_disconnected; | 1523 | enum drm_connector_status found = connector_status_disconnected; |
1424 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); | 1524 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); |
1425 | struct radeon_encoder_tv_dac *tv_dac = radeon_encoder->enc_priv; | 1525 | struct radeon_encoder_tv_dac *tv_dac = radeon_encoder->enc_priv; |
@@ -1456,12 +1556,27 @@ static enum drm_connector_status radeon_legacy_tv_dac_detect(struct drm_encoder | |||
1456 | return connector_status_disconnected; | 1556 | return connector_status_disconnected; |
1457 | } | 1557 | } |
1458 | 1558 | ||
1559 | /* R200 uses an external DAC for secondary DAC */ | ||
1560 | if (rdev->family == CHIP_R200) { | ||
1561 | if (radeon_legacy_ext_dac_detect(encoder, connector)) | ||
1562 | found = connector_status_connected; | ||
1563 | return found; | ||
1564 | } | ||
1565 | |||
1459 | /* save the regs we need */ | 1566 | /* save the regs we need */ |
1460 | pixclks_cntl = RREG32_PLL(RADEON_PIXCLKS_CNTL); | 1567 | pixclks_cntl = RREG32_PLL(RADEON_PIXCLKS_CNTL); |
1461 | gpiopad_a = ASIC_IS_R300(rdev) ? RREG32(RADEON_GPIOPAD_A) : 0; | 1568 | |
1462 | disp_output_cntl = ASIC_IS_R300(rdev) ? RREG32(RADEON_DISP_OUTPUT_CNTL) : 0; | 1569 | if (rdev->flags & RADEON_SINGLE_CRTC) { |
1463 | disp_hw_debug = ASIC_IS_R300(rdev) ? 0 : RREG32(RADEON_DISP_HW_DEBUG); | 1570 | crtc_ext_cntl = RREG32(RADEON_CRTC_EXT_CNTL); |
1464 | crtc2_gen_cntl = RREG32(RADEON_CRTC2_GEN_CNTL); | 1571 | } else { |
1572 | if (ASIC_IS_R300(rdev)) { | ||
1573 | gpiopad_a = RREG32(RADEON_GPIOPAD_A); | ||
1574 | disp_output_cntl = RREG32(RADEON_DISP_OUTPUT_CNTL); | ||
1575 | } else { | ||
1576 | disp_hw_debug = RREG32(RADEON_DISP_HW_DEBUG); | ||
1577 | } | ||
1578 | crtc2_gen_cntl = RREG32(RADEON_CRTC2_GEN_CNTL); | ||
1579 | } | ||
1465 | tv_dac_cntl = RREG32(RADEON_TV_DAC_CNTL); | 1580 | tv_dac_cntl = RREG32(RADEON_TV_DAC_CNTL); |
1466 | dac_ext_cntl = RREG32(RADEON_DAC_EXT_CNTL); | 1581 | dac_ext_cntl = RREG32(RADEON_DAC_EXT_CNTL); |
1467 | dac_cntl2 = RREG32(RADEON_DAC_CNTL2); | 1582 | dac_cntl2 = RREG32(RADEON_DAC_CNTL2); |
@@ -1470,22 +1585,24 @@ static enum drm_connector_status radeon_legacy_tv_dac_detect(struct drm_encoder | |||
1470 | | RADEON_PIX2CLK_DAC_ALWAYS_ONb); | 1585 | | RADEON_PIX2CLK_DAC_ALWAYS_ONb); |
1471 | WREG32_PLL(RADEON_PIXCLKS_CNTL, tmp); | 1586 | WREG32_PLL(RADEON_PIXCLKS_CNTL, tmp); |
1472 | 1587 | ||
1473 | if (ASIC_IS_R300(rdev)) | 1588 | if (rdev->flags & RADEON_SINGLE_CRTC) { |
1474 | WREG32_P(RADEON_GPIOPAD_A, 1, ~1); | 1589 | tmp = crtc_ext_cntl | RADEON_CRTC_CRT_ON; |
1475 | 1590 | WREG32(RADEON_CRTC_EXT_CNTL, tmp); | |
1476 | tmp = crtc2_gen_cntl & ~RADEON_CRTC2_PIX_WIDTH_MASK; | ||
1477 | tmp |= RADEON_CRTC2_CRT2_ON | | ||
1478 | (2 << RADEON_CRTC2_PIX_WIDTH_SHIFT); | ||
1479 | |||
1480 | WREG32(RADEON_CRTC2_GEN_CNTL, tmp); | ||
1481 | |||
1482 | if (ASIC_IS_R300(rdev)) { | ||
1483 | tmp = disp_output_cntl & ~RADEON_DISP_TVDAC_SOURCE_MASK; | ||
1484 | tmp |= RADEON_DISP_TVDAC_SOURCE_CRTC2; | ||
1485 | WREG32(RADEON_DISP_OUTPUT_CNTL, tmp); | ||
1486 | } else { | 1591 | } else { |
1487 | tmp = disp_hw_debug & ~RADEON_CRT2_DISP1_SEL; | 1592 | tmp = crtc2_gen_cntl & ~RADEON_CRTC2_PIX_WIDTH_MASK; |
1488 | WREG32(RADEON_DISP_HW_DEBUG, tmp); | 1593 | tmp |= RADEON_CRTC2_CRT2_ON | |
1594 | (2 << RADEON_CRTC2_PIX_WIDTH_SHIFT); | ||
1595 | WREG32(RADEON_CRTC2_GEN_CNTL, tmp); | ||
1596 | |||
1597 | if (ASIC_IS_R300(rdev)) { | ||
1598 | WREG32_P(RADEON_GPIOPAD_A, 1, ~1); | ||
1599 | tmp = disp_output_cntl & ~RADEON_DISP_TVDAC_SOURCE_MASK; | ||
1600 | tmp |= RADEON_DISP_TVDAC_SOURCE_CRTC2; | ||
1601 | WREG32(RADEON_DISP_OUTPUT_CNTL, tmp); | ||
1602 | } else { | ||
1603 | tmp = disp_hw_debug & ~RADEON_CRT2_DISP1_SEL; | ||
1604 | WREG32(RADEON_DISP_HW_DEBUG, tmp); | ||
1605 | } | ||
1489 | } | 1606 | } |
1490 | 1607 | ||
1491 | tmp = RADEON_TV_DAC_NBLANK | | 1608 | tmp = RADEON_TV_DAC_NBLANK | |
@@ -1527,14 +1644,19 @@ static enum drm_connector_status radeon_legacy_tv_dac_detect(struct drm_encoder | |||
1527 | WREG32(RADEON_DAC_CNTL2, dac_cntl2); | 1644 | WREG32(RADEON_DAC_CNTL2, dac_cntl2); |
1528 | WREG32(RADEON_DAC_EXT_CNTL, dac_ext_cntl); | 1645 | WREG32(RADEON_DAC_EXT_CNTL, dac_ext_cntl); |
1529 | WREG32(RADEON_TV_DAC_CNTL, tv_dac_cntl); | 1646 | WREG32(RADEON_TV_DAC_CNTL, tv_dac_cntl); |
1530 | WREG32(RADEON_CRTC2_GEN_CNTL, crtc2_gen_cntl); | ||
1531 | 1647 | ||
1532 | if (ASIC_IS_R300(rdev)) { | 1648 | if (rdev->flags & RADEON_SINGLE_CRTC) { |
1533 | WREG32(RADEON_DISP_OUTPUT_CNTL, disp_output_cntl); | 1649 | WREG32(RADEON_CRTC_EXT_CNTL, crtc_ext_cntl); |
1534 | WREG32_P(RADEON_GPIOPAD_A, gpiopad_a, ~1); | ||
1535 | } else { | 1650 | } else { |
1536 | WREG32(RADEON_DISP_HW_DEBUG, disp_hw_debug); | 1651 | WREG32(RADEON_CRTC2_GEN_CNTL, crtc2_gen_cntl); |
1652 | if (ASIC_IS_R300(rdev)) { | ||
1653 | WREG32(RADEON_DISP_OUTPUT_CNTL, disp_output_cntl); | ||
1654 | WREG32_P(RADEON_GPIOPAD_A, gpiopad_a, ~1); | ||
1655 | } else { | ||
1656 | WREG32(RADEON_DISP_HW_DEBUG, disp_hw_debug); | ||
1657 | } | ||
1537 | } | 1658 | } |
1659 | |||
1538 | WREG32_PLL(RADEON_PIXCLKS_CNTL, pixclks_cntl); | 1660 | WREG32_PLL(RADEON_PIXCLKS_CNTL, pixclks_cntl); |
1539 | 1661 | ||
1540 | return found; | 1662 | return found; |
diff --git a/drivers/gpu/drm/radeon/radeon_object.c b/drivers/gpu/drm/radeon/radeon_object.c index 8b27dd6e3144..b91118ccef86 100644 --- a/drivers/gpu/drm/radeon/radeon_object.c +++ b/drivers/gpu/drm/radeon/radeon_object.c | |||
@@ -105,7 +105,6 @@ int radeon_bo_create(struct radeon_device *rdev, | |||
105 | struct radeon_bo *bo; | 105 | struct radeon_bo *bo; |
106 | enum ttm_bo_type type; | 106 | enum ttm_bo_type type; |
107 | unsigned long page_align = roundup(byte_align, PAGE_SIZE) >> PAGE_SHIFT; | 107 | unsigned long page_align = roundup(byte_align, PAGE_SIZE) >> PAGE_SHIFT; |
108 | unsigned long max_size = 0; | ||
109 | size_t acc_size; | 108 | size_t acc_size; |
110 | int r; | 109 | int r; |
111 | 110 | ||
@@ -121,18 +120,9 @@ int radeon_bo_create(struct radeon_device *rdev, | |||
121 | } | 120 | } |
122 | *bo_ptr = NULL; | 121 | *bo_ptr = NULL; |
123 | 122 | ||
124 | /* maximun bo size is the minimun btw visible vram and gtt size */ | ||
125 | max_size = min(rdev->mc.visible_vram_size, rdev->mc.gtt_size); | ||
126 | if ((page_align << PAGE_SHIFT) >= max_size) { | ||
127 | printk(KERN_WARNING "%s:%d alloc size %ldM bigger than %ldMb limit\n", | ||
128 | __func__, __LINE__, page_align >> (20 - PAGE_SHIFT), max_size >> 20); | ||
129 | return -ENOMEM; | ||
130 | } | ||
131 | |||
132 | acc_size = ttm_bo_dma_acc_size(&rdev->mman.bdev, size, | 123 | acc_size = ttm_bo_dma_acc_size(&rdev->mman.bdev, size, |
133 | sizeof(struct radeon_bo)); | 124 | sizeof(struct radeon_bo)); |
134 | 125 | ||
135 | retry: | ||
136 | bo = kzalloc(sizeof(struct radeon_bo), GFP_KERNEL); | 126 | bo = kzalloc(sizeof(struct radeon_bo), GFP_KERNEL); |
137 | if (bo == NULL) | 127 | if (bo == NULL) |
138 | return -ENOMEM; | 128 | return -ENOMEM; |
@@ -154,15 +144,6 @@ retry: | |||
154 | acc_size, sg, &radeon_ttm_bo_destroy); | 144 | acc_size, sg, &radeon_ttm_bo_destroy); |
155 | up_read(&rdev->pm.mclk_lock); | 145 | up_read(&rdev->pm.mclk_lock); |
156 | if (unlikely(r != 0)) { | 146 | if (unlikely(r != 0)) { |
157 | if (r != -ERESTARTSYS) { | ||
158 | if (domain == RADEON_GEM_DOMAIN_VRAM) { | ||
159 | domain |= RADEON_GEM_DOMAIN_GTT; | ||
160 | goto retry; | ||
161 | } | ||
162 | dev_err(rdev->dev, | ||
163 | "object_init failed for (%lu, 0x%08X)\n", | ||
164 | size, domain); | ||
165 | } | ||
166 | return r; | 147 | return r; |
167 | } | 148 | } |
168 | *bo_ptr = bo; | 149 | *bo_ptr = bo; |
diff --git a/drivers/gpu/drm/radeon/si.c b/drivers/gpu/drm/radeon/si.c index df8dd7701643..b0db712060fb 100644 --- a/drivers/gpu/drm/radeon/si.c +++ b/drivers/gpu/drm/radeon/si.c | |||
@@ -2808,26 +2808,31 @@ void si_vm_set_page(struct radeon_device *rdev, uint64_t pe, | |||
2808 | { | 2808 | { |
2809 | struct radeon_ring *ring = &rdev->ring[rdev->asic->vm.pt_ring_index]; | 2809 | struct radeon_ring *ring = &rdev->ring[rdev->asic->vm.pt_ring_index]; |
2810 | uint32_t r600_flags = cayman_vm_page_flags(rdev, flags); | 2810 | uint32_t r600_flags = cayman_vm_page_flags(rdev, flags); |
2811 | int i; | ||
2812 | uint64_t value; | ||
2813 | 2811 | ||
2814 | radeon_ring_write(ring, PACKET3(PACKET3_WRITE_DATA, 2 + count * 2)); | 2812 | while (count) { |
2815 | radeon_ring_write(ring, (WRITE_DATA_ENGINE_SEL(0) | | 2813 | unsigned ndw = 2 + count * 2; |
2816 | WRITE_DATA_DST_SEL(1))); | 2814 | if (ndw > 0x3FFE) |
2817 | radeon_ring_write(ring, pe); | 2815 | ndw = 0x3FFE; |
2818 | radeon_ring_write(ring, upper_32_bits(pe)); | 2816 | |
2819 | for (i = 0; i < count; ++i) { | 2817 | radeon_ring_write(ring, PACKET3(PACKET3_WRITE_DATA, ndw)); |
2820 | if (flags & RADEON_VM_PAGE_SYSTEM) { | 2818 | radeon_ring_write(ring, (WRITE_DATA_ENGINE_SEL(0) | |
2821 | value = radeon_vm_map_gart(rdev, addr); | 2819 | WRITE_DATA_DST_SEL(1))); |
2822 | value &= 0xFFFFFFFFFFFFF000ULL; | 2820 | radeon_ring_write(ring, pe); |
2823 | } else if (flags & RADEON_VM_PAGE_VALID) | 2821 | radeon_ring_write(ring, upper_32_bits(pe)); |
2824 | value = addr; | 2822 | for (; ndw > 2; ndw -= 2, --count, pe += 8) { |
2825 | else | 2823 | uint64_t value; |
2826 | value = 0; | 2824 | if (flags & RADEON_VM_PAGE_SYSTEM) { |
2827 | addr += incr; | 2825 | value = radeon_vm_map_gart(rdev, addr); |
2828 | value |= r600_flags; | 2826 | value &= 0xFFFFFFFFFFFFF000ULL; |
2829 | radeon_ring_write(ring, value); | 2827 | } else if (flags & RADEON_VM_PAGE_VALID) |
2830 | radeon_ring_write(ring, upper_32_bits(value)); | 2828 | value = addr; |
2829 | else | ||
2830 | value = 0; | ||
2831 | addr += incr; | ||
2832 | value |= r600_flags; | ||
2833 | radeon_ring_write(ring, value); | ||
2834 | radeon_ring_write(ring, upper_32_bits(value)); | ||
2835 | } | ||
2831 | } | 2836 | } |
2832 | } | 2837 | } |
2833 | 2838 | ||
@@ -2868,6 +2873,10 @@ void si_vm_flush(struct radeon_device *rdev, int ridx, struct radeon_vm *vm) | |||
2868 | radeon_ring_write(ring, VM_INVALIDATE_REQUEST >> 2); | 2873 | radeon_ring_write(ring, VM_INVALIDATE_REQUEST >> 2); |
2869 | radeon_ring_write(ring, 0); | 2874 | radeon_ring_write(ring, 0); |
2870 | radeon_ring_write(ring, 1 << vm->id); | 2875 | radeon_ring_write(ring, 1 << vm->id); |
2876 | |||
2877 | /* sync PFP to ME, otherwise we might get invalid PFP reads */ | ||
2878 | radeon_ring_write(ring, PACKET3(PACKET3_PFP_SYNC_ME, 0)); | ||
2879 | radeon_ring_write(ring, 0x0); | ||
2871 | } | 2880 | } |
2872 | 2881 | ||
2873 | /* | 2882 | /* |
diff --git a/drivers/gpu/drm/shmobile/shmob_drm_drv.c b/drivers/gpu/drm/shmobile/shmob_drm_drv.c index c71d493fd0c5..1c350fc4e449 100644 --- a/drivers/gpu/drm/shmobile/shmob_drm_drv.c +++ b/drivers/gpu/drm/shmobile/shmob_drm_drv.c | |||
@@ -201,6 +201,8 @@ static int shmob_drm_load(struct drm_device *dev, unsigned long flags) | |||
201 | goto done; | 201 | goto done; |
202 | } | 202 | } |
203 | 203 | ||
204 | platform_set_drvdata(pdev, sdev); | ||
205 | |||
204 | done: | 206 | done: |
205 | if (ret) | 207 | if (ret) |
206 | shmob_drm_unload(dev); | 208 | shmob_drm_unload(dev); |
@@ -299,11 +301,9 @@ static struct drm_driver shmob_drm_driver = { | |||
299 | #if CONFIG_PM_SLEEP | 301 | #if CONFIG_PM_SLEEP |
300 | static int shmob_drm_pm_suspend(struct device *dev) | 302 | static int shmob_drm_pm_suspend(struct device *dev) |
301 | { | 303 | { |
302 | struct platform_device *pdev = to_platform_device(dev); | 304 | struct shmob_drm_device *sdev = dev_get_drvdata(dev); |
303 | struct drm_device *ddev = platform_get_drvdata(pdev); | ||
304 | struct shmob_drm_device *sdev = ddev->dev_private; | ||
305 | 305 | ||
306 | drm_kms_helper_poll_disable(ddev); | 306 | drm_kms_helper_poll_disable(sdev->ddev); |
307 | shmob_drm_crtc_suspend(&sdev->crtc); | 307 | shmob_drm_crtc_suspend(&sdev->crtc); |
308 | 308 | ||
309 | return 0; | 309 | return 0; |
@@ -311,9 +311,7 @@ static int shmob_drm_pm_suspend(struct device *dev) | |||
311 | 311 | ||
312 | static int shmob_drm_pm_resume(struct device *dev) | 312 | static int shmob_drm_pm_resume(struct device *dev) |
313 | { | 313 | { |
314 | struct platform_device *pdev = to_platform_device(dev); | 314 | struct shmob_drm_device *sdev = dev_get_drvdata(dev); |
315 | struct drm_device *ddev = platform_get_drvdata(pdev); | ||
316 | struct shmob_drm_device *sdev = ddev->dev_private; | ||
317 | 315 | ||
318 | mutex_lock(&sdev->ddev->mode_config.mutex); | 316 | mutex_lock(&sdev->ddev->mode_config.mutex); |
319 | shmob_drm_crtc_resume(&sdev->crtc); | 317 | shmob_drm_crtc_resume(&sdev->crtc); |
diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c index 402ab69f9f99..bf6e4b5a73b5 100644 --- a/drivers/gpu/drm/ttm/ttm_bo.c +++ b/drivers/gpu/drm/ttm/ttm_bo.c | |||
@@ -580,6 +580,7 @@ retry: | |||
580 | if (unlikely(ret != 0)) | 580 | if (unlikely(ret != 0)) |
581 | return ret; | 581 | return ret; |
582 | 582 | ||
583 | retry_reserve: | ||
583 | spin_lock(&glob->lru_lock); | 584 | spin_lock(&glob->lru_lock); |
584 | 585 | ||
585 | if (unlikely(list_empty(&bo->ddestroy))) { | 586 | if (unlikely(list_empty(&bo->ddestroy))) { |
@@ -587,14 +588,20 @@ retry: | |||
587 | return 0; | 588 | return 0; |
588 | } | 589 | } |
589 | 590 | ||
590 | ret = ttm_bo_reserve_locked(bo, interruptible, | 591 | ret = ttm_bo_reserve_locked(bo, false, true, false, 0); |
591 | no_wait_reserve, false, 0); | ||
592 | 592 | ||
593 | if (unlikely(ret != 0)) { | 593 | if (unlikely(ret == -EBUSY)) { |
594 | spin_unlock(&glob->lru_lock); | 594 | spin_unlock(&glob->lru_lock); |
595 | return ret; | 595 | if (likely(!no_wait_reserve)) |
596 | ret = ttm_bo_wait_unreserved(bo, interruptible); | ||
597 | if (unlikely(ret != 0)) | ||
598 | return ret; | ||
599 | |||
600 | goto retry_reserve; | ||
596 | } | 601 | } |
597 | 602 | ||
603 | BUG_ON(ret != 0); | ||
604 | |||
598 | /** | 605 | /** |
599 | * We can re-check for sync object without taking | 606 | * We can re-check for sync object without taking |
600 | * the bo::lock since setting the sync object requires | 607 | * the bo::lock since setting the sync object requires |
@@ -811,17 +818,14 @@ retry: | |||
811 | no_wait_reserve, no_wait_gpu); | 818 | no_wait_reserve, no_wait_gpu); |
812 | kref_put(&bo->list_kref, ttm_bo_release_list); | 819 | kref_put(&bo->list_kref, ttm_bo_release_list); |
813 | 820 | ||
814 | if (likely(ret == 0 || ret == -ERESTARTSYS)) | 821 | return ret; |
815 | return ret; | ||
816 | |||
817 | goto retry; | ||
818 | } | 822 | } |
819 | 823 | ||
820 | ret = ttm_bo_reserve_locked(bo, false, no_wait_reserve, false, 0); | 824 | ret = ttm_bo_reserve_locked(bo, false, true, false, 0); |
821 | 825 | ||
822 | if (unlikely(ret == -EBUSY)) { | 826 | if (unlikely(ret == -EBUSY)) { |
823 | spin_unlock(&glob->lru_lock); | 827 | spin_unlock(&glob->lru_lock); |
824 | if (likely(!no_wait_gpu)) | 828 | if (likely(!no_wait_reserve)) |
825 | ret = ttm_bo_wait_unreserved(bo, interruptible); | 829 | ret = ttm_bo_wait_unreserved(bo, interruptible); |
826 | 830 | ||
827 | kref_put(&bo->list_kref, ttm_bo_release_list); | 831 | kref_put(&bo->list_kref, ttm_bo_release_list); |
diff --git a/drivers/gpu/drm/udl/udl_drv.h b/drivers/gpu/drm/udl/udl_drv.h index fccd361f7b50..87aa5f5d3c88 100644 --- a/drivers/gpu/drm/udl/udl_drv.h +++ b/drivers/gpu/drm/udl/udl_drv.h | |||
@@ -104,7 +104,7 @@ udl_fb_user_fb_create(struct drm_device *dev, | |||
104 | 104 | ||
105 | int udl_render_hline(struct drm_device *dev, int bpp, struct urb **urb_ptr, | 105 | int udl_render_hline(struct drm_device *dev, int bpp, struct urb **urb_ptr, |
106 | const char *front, char **urb_buf_ptr, | 106 | const char *front, char **urb_buf_ptr, |
107 | u32 byte_offset, u32 byte_width, | 107 | u32 byte_offset, u32 device_byte_offset, u32 byte_width, |
108 | int *ident_ptr, int *sent_ptr); | 108 | int *ident_ptr, int *sent_ptr); |
109 | 109 | ||
110 | int udl_dumb_create(struct drm_file *file_priv, | 110 | int udl_dumb_create(struct drm_file *file_priv, |
diff --git a/drivers/gpu/drm/udl/udl_fb.c b/drivers/gpu/drm/udl/udl_fb.c index 69a2b16f42a6..d4ab3beaada0 100644 --- a/drivers/gpu/drm/udl/udl_fb.c +++ b/drivers/gpu/drm/udl/udl_fb.c | |||
@@ -114,9 +114,10 @@ static void udlfb_dpy_deferred_io(struct fb_info *info, | |||
114 | list_for_each_entry(cur, &fbdefio->pagelist, lru) { | 114 | list_for_each_entry(cur, &fbdefio->pagelist, lru) { |
115 | 115 | ||
116 | if (udl_render_hline(dev, (ufbdev->ufb.base.bits_per_pixel / 8), | 116 | if (udl_render_hline(dev, (ufbdev->ufb.base.bits_per_pixel / 8), |
117 | &urb, (char *) info->fix.smem_start, | 117 | &urb, (char *) info->fix.smem_start, |
118 | &cmd, cur->index << PAGE_SHIFT, | 118 | &cmd, cur->index << PAGE_SHIFT, |
119 | PAGE_SIZE, &bytes_identical, &bytes_sent)) | 119 | cur->index << PAGE_SHIFT, |
120 | PAGE_SIZE, &bytes_identical, &bytes_sent)) | ||
120 | goto error; | 121 | goto error; |
121 | bytes_rendered += PAGE_SIZE; | 122 | bytes_rendered += PAGE_SIZE; |
122 | } | 123 | } |
@@ -187,10 +188,11 @@ int udl_handle_damage(struct udl_framebuffer *fb, int x, int y, | |||
187 | for (i = y; i < y + height ; i++) { | 188 | for (i = y; i < y + height ; i++) { |
188 | const int line_offset = fb->base.pitches[0] * i; | 189 | const int line_offset = fb->base.pitches[0] * i; |
189 | const int byte_offset = line_offset + (x * bpp); | 190 | const int byte_offset = line_offset + (x * bpp); |
190 | 191 | const int dev_byte_offset = (fb->base.width * bpp * i) + (x * bpp); | |
191 | if (udl_render_hline(dev, bpp, &urb, | 192 | if (udl_render_hline(dev, bpp, &urb, |
192 | (char *) fb->obj->vmapping, | 193 | (char *) fb->obj->vmapping, |
193 | &cmd, byte_offset, width * bpp, | 194 | &cmd, byte_offset, dev_byte_offset, |
195 | width * bpp, | ||
194 | &bytes_identical, &bytes_sent)) | 196 | &bytes_identical, &bytes_sent)) |
195 | goto error; | 197 | goto error; |
196 | } | 198 | } |
diff --git a/drivers/gpu/drm/udl/udl_transfer.c b/drivers/gpu/drm/udl/udl_transfer.c index dc095526ffb7..142fee5f983f 100644 --- a/drivers/gpu/drm/udl/udl_transfer.c +++ b/drivers/gpu/drm/udl/udl_transfer.c | |||
@@ -213,11 +213,12 @@ static void udl_compress_hline16( | |||
213 | */ | 213 | */ |
214 | int udl_render_hline(struct drm_device *dev, int bpp, struct urb **urb_ptr, | 214 | int udl_render_hline(struct drm_device *dev, int bpp, struct urb **urb_ptr, |
215 | const char *front, char **urb_buf_ptr, | 215 | const char *front, char **urb_buf_ptr, |
216 | u32 byte_offset, u32 byte_width, | 216 | u32 byte_offset, u32 device_byte_offset, |
217 | u32 byte_width, | ||
217 | int *ident_ptr, int *sent_ptr) | 218 | int *ident_ptr, int *sent_ptr) |
218 | { | 219 | { |
219 | const u8 *line_start, *line_end, *next_pixel; | 220 | const u8 *line_start, *line_end, *next_pixel; |
220 | u32 base16 = 0 + (byte_offset / bpp) * 2; | 221 | u32 base16 = 0 + (device_byte_offset / bpp) * 2; |
221 | struct urb *urb = *urb_ptr; | 222 | struct urb *urb = *urb_ptr; |
222 | u8 *cmd = *urb_buf_ptr; | 223 | u8 *cmd = *urb_buf_ptr; |
223 | u8 *cmd_end = (u8 *) urb->transfer_buffer + urb->transfer_buffer_length; | 224 | u8 *cmd_end = (u8 *) urb->transfer_buffer + urb->transfer_buffer_length; |
diff --git a/drivers/hid/hid-apple.c b/drivers/hid/hid-apple.c index 06ebdbb6ea02..fd7722aecf77 100644 --- a/drivers/hid/hid-apple.c +++ b/drivers/hid/hid-apple.c | |||
@@ -522,6 +522,12 @@ static const struct hid_device_id apple_devices[] = { | |||
522 | .driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD }, | 522 | .driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD }, |
523 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7_JIS), | 523 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7_JIS), |
524 | .driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS }, | 524 | .driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS }, |
525 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7A_ANSI), | ||
526 | .driver_data = APPLE_HAS_FN }, | ||
527 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7A_ISO), | ||
528 | .driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD }, | ||
529 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7A_JIS), | ||
530 | .driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS }, | ||
525 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI), | 531 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI), |
526 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN }, | 532 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN }, |
527 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO), | 533 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO), |
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c index bd3971bf31bf..f4109fd657ff 100644 --- a/drivers/hid/hid-core.c +++ b/drivers/hid/hid-core.c | |||
@@ -1532,6 +1532,9 @@ static const struct hid_device_id hid_have_special_driver[] = { | |||
1532 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7_ANSI) }, | 1532 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7_ANSI) }, |
1533 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7_ISO) }, | 1533 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7_ISO) }, |
1534 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7_JIS) }, | 1534 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7_JIS) }, |
1535 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7A_ANSI) }, | ||
1536 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7A_ISO) }, | ||
1537 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7A_JIS) }, | ||
1535 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI) }, | 1538 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI) }, |
1536 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO) }, | 1539 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO) }, |
1537 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_JIS) }, | 1540 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_JIS) }, |
@@ -2139,6 +2142,9 @@ static const struct hid_device_id hid_mouse_ignore_list[] = { | |||
2139 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7_ANSI) }, | 2142 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7_ANSI) }, |
2140 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7_ISO) }, | 2143 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7_ISO) }, |
2141 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7_JIS) }, | 2144 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7_JIS) }, |
2145 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7A_ANSI) }, | ||
2146 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7A_ISO) }, | ||
2147 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7A_JIS) }, | ||
2142 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY) }, | 2148 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY) }, |
2143 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY) }, | 2149 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY) }, |
2144 | { } | 2150 | { } |
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h index 269b50912a4a..9d7a42857ea1 100644 --- a/drivers/hid/hid-ids.h +++ b/drivers/hid/hid-ids.h | |||
@@ -118,6 +118,9 @@ | |||
118 | #define USB_DEVICE_ID_APPLE_WELLSPRING5A_ANSI 0x0252 | 118 | #define USB_DEVICE_ID_APPLE_WELLSPRING5A_ANSI 0x0252 |
119 | #define USB_DEVICE_ID_APPLE_WELLSPRING5A_ISO 0x0253 | 119 | #define USB_DEVICE_ID_APPLE_WELLSPRING5A_ISO 0x0253 |
120 | #define USB_DEVICE_ID_APPLE_WELLSPRING5A_JIS 0x0254 | 120 | #define USB_DEVICE_ID_APPLE_WELLSPRING5A_JIS 0x0254 |
121 | #define USB_DEVICE_ID_APPLE_WELLSPRING7A_ANSI 0x0259 | ||
122 | #define USB_DEVICE_ID_APPLE_WELLSPRING7A_ISO 0x025a | ||
123 | #define USB_DEVICE_ID_APPLE_WELLSPRING7A_JIS 0x025b | ||
121 | #define USB_DEVICE_ID_APPLE_WELLSPRING6A_ANSI 0x0249 | 124 | #define USB_DEVICE_ID_APPLE_WELLSPRING6A_ANSI 0x0249 |
122 | #define USB_DEVICE_ID_APPLE_WELLSPRING6A_ISO 0x024a | 125 | #define USB_DEVICE_ID_APPLE_WELLSPRING6A_ISO 0x024a |
123 | #define USB_DEVICE_ID_APPLE_WELLSPRING6A_JIS 0x024b | 126 | #define USB_DEVICE_ID_APPLE_WELLSPRING6A_JIS 0x024b |
diff --git a/drivers/hid/hid-microsoft.c b/drivers/hid/hid-microsoft.c index 3acdcfcc17df..f676c01bb471 100644 --- a/drivers/hid/hid-microsoft.c +++ b/drivers/hid/hid-microsoft.c | |||
@@ -28,22 +28,30 @@ | |||
28 | #define MS_RDESC 0x08 | 28 | #define MS_RDESC 0x08 |
29 | #define MS_NOGET 0x10 | 29 | #define MS_NOGET 0x10 |
30 | #define MS_DUPLICATE_USAGES 0x20 | 30 | #define MS_DUPLICATE_USAGES 0x20 |
31 | #define MS_RDESC_3K 0x40 | ||
31 | 32 | ||
32 | /* | ||
33 | * Microsoft Wireless Desktop Receiver (Model 1028) has | ||
34 | * 'Usage Min/Max' where it ought to have 'Physical Min/Max' | ||
35 | */ | ||
36 | static __u8 *ms_report_fixup(struct hid_device *hdev, __u8 *rdesc, | 33 | static __u8 *ms_report_fixup(struct hid_device *hdev, __u8 *rdesc, |
37 | unsigned int *rsize) | 34 | unsigned int *rsize) |
38 | { | 35 | { |
39 | unsigned long quirks = (unsigned long)hid_get_drvdata(hdev); | 36 | unsigned long quirks = (unsigned long)hid_get_drvdata(hdev); |
40 | 37 | ||
38 | /* | ||
39 | * Microsoft Wireless Desktop Receiver (Model 1028) has | ||
40 | * 'Usage Min/Max' where it ought to have 'Physical Min/Max' | ||
41 | */ | ||
41 | if ((quirks & MS_RDESC) && *rsize == 571 && rdesc[557] == 0x19 && | 42 | if ((quirks & MS_RDESC) && *rsize == 571 && rdesc[557] == 0x19 && |
42 | rdesc[559] == 0x29) { | 43 | rdesc[559] == 0x29) { |
43 | hid_info(hdev, "fixing up Microsoft Wireless Receiver Model 1028 report descriptor\n"); | 44 | hid_info(hdev, "fixing up Microsoft Wireless Receiver Model 1028 report descriptor\n"); |
44 | rdesc[557] = 0x35; | 45 | rdesc[557] = 0x35; |
45 | rdesc[559] = 0x45; | 46 | rdesc[559] = 0x45; |
46 | } | 47 | } |
48 | /* the same as above (s/usage/physical/) */ | ||
49 | if ((quirks & MS_RDESC_3K) && *rsize == 106 && | ||
50 | !memcmp((char []){ 0x19, 0x00, 0x29, 0xff }, | ||
51 | &rdesc[94], 4)) { | ||
52 | rdesc[94] = 0x35; | ||
53 | rdesc[96] = 0x45; | ||
54 | } | ||
47 | return rdesc; | 55 | return rdesc; |
48 | } | 56 | } |
49 | 57 | ||
@@ -192,7 +200,7 @@ static const struct hid_device_id ms_devices[] = { | |||
192 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_PRESENTER_8K_USB), | 200 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_PRESENTER_8K_USB), |
193 | .driver_data = MS_PRESENTER }, | 201 | .driver_data = MS_PRESENTER }, |
194 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_DIGITAL_MEDIA_3K), | 202 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_DIGITAL_MEDIA_3K), |
195 | .driver_data = MS_ERGONOMY }, | 203 | .driver_data = MS_ERGONOMY | MS_RDESC_3K }, |
196 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_WIRELESS_OPTICAL_DESKTOP_3_0), | 204 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_WIRELESS_OPTICAL_DESKTOP_3_0), |
197 | .driver_data = MS_NOGET }, | 205 | .driver_data = MS_NOGET }, |
198 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_COMFORT_MOUSE_4500), | 206 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_COMFORT_MOUSE_4500), |
diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c index 3eb02b94fc87..7867d69f0efe 100644 --- a/drivers/hid/hid-multitouch.c +++ b/drivers/hid/hid-multitouch.c | |||
@@ -210,8 +210,7 @@ static struct mt_class mt_classes[] = { | |||
210 | }, | 210 | }, |
211 | { .name = MT_CLS_GENERALTOUCH_PWT_TENFINGERS, | 211 | { .name = MT_CLS_GENERALTOUCH_PWT_TENFINGERS, |
212 | .quirks = MT_QUIRK_NOT_SEEN_MEANS_UP | | 212 | .quirks = MT_QUIRK_NOT_SEEN_MEANS_UP | |
213 | MT_QUIRK_SLOT_IS_CONTACTNUMBER, | 213 | MT_QUIRK_SLOT_IS_CONTACTNUMBER |
214 | .maxcontacts = 10 | ||
215 | }, | 214 | }, |
216 | 215 | ||
217 | { .name = MT_CLS_FLATFROG, | 216 | { .name = MT_CLS_FLATFROG, |
@@ -421,11 +420,11 @@ static int mt_input_mapping(struct hid_device *hdev, struct hid_input *hi, | |||
421 | * contact max are global to the report */ | 420 | * contact max are global to the report */ |
422 | td->last_field_index = field->index; | 421 | td->last_field_index = field->index; |
423 | return -1; | 422 | return -1; |
424 | } | ||
425 | case HID_DG_TOUCH: | 423 | case HID_DG_TOUCH: |
426 | /* Legacy devices use TIPSWITCH and not TOUCH. | 424 | /* Legacy devices use TIPSWITCH and not TOUCH. |
427 | * Let's just ignore this field. */ | 425 | * Let's just ignore this field. */ |
428 | return -1; | 426 | return -1; |
427 | } | ||
429 | /* let hid-input decide for the others */ | 428 | /* let hid-input decide for the others */ |
430 | return 0; | 429 | return 0; |
431 | 430 | ||
diff --git a/drivers/hv/channel.c b/drivers/hv/channel.c index 406537420fff..f4c3d28cd1fc 100644 --- a/drivers/hv/channel.c +++ b/drivers/hv/channel.c | |||
@@ -146,14 +146,14 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size, | |||
146 | 146 | ||
147 | if (ret != 0) { | 147 | if (ret != 0) { |
148 | err = ret; | 148 | err = ret; |
149 | goto errorout; | 149 | goto error0; |
150 | } | 150 | } |
151 | 151 | ||
152 | ret = hv_ringbuffer_init( | 152 | ret = hv_ringbuffer_init( |
153 | &newchannel->inbound, in, recv_ringbuffer_size); | 153 | &newchannel->inbound, in, recv_ringbuffer_size); |
154 | if (ret != 0) { | 154 | if (ret != 0) { |
155 | err = ret; | 155 | err = ret; |
156 | goto errorout; | 156 | goto error0; |
157 | } | 157 | } |
158 | 158 | ||
159 | 159 | ||
@@ -168,7 +168,7 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size, | |||
168 | 168 | ||
169 | if (ret != 0) { | 169 | if (ret != 0) { |
170 | err = ret; | 170 | err = ret; |
171 | goto errorout; | 171 | goto error0; |
172 | } | 172 | } |
173 | 173 | ||
174 | /* Create and init the channel open message */ | 174 | /* Create and init the channel open message */ |
@@ -177,7 +177,7 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size, | |||
177 | GFP_KERNEL); | 177 | GFP_KERNEL); |
178 | if (!open_info) { | 178 | if (!open_info) { |
179 | err = -ENOMEM; | 179 | err = -ENOMEM; |
180 | goto errorout; | 180 | goto error0; |
181 | } | 181 | } |
182 | 182 | ||
183 | init_completion(&open_info->waitevent); | 183 | init_completion(&open_info->waitevent); |
@@ -193,7 +193,7 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size, | |||
193 | 193 | ||
194 | if (userdatalen > MAX_USER_DEFINED_BYTES) { | 194 | if (userdatalen > MAX_USER_DEFINED_BYTES) { |
195 | err = -EINVAL; | 195 | err = -EINVAL; |
196 | goto errorout; | 196 | goto error0; |
197 | } | 197 | } |
198 | 198 | ||
199 | if (userdatalen) | 199 | if (userdatalen) |
@@ -208,19 +208,18 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size, | |||
208 | sizeof(struct vmbus_channel_open_channel)); | 208 | sizeof(struct vmbus_channel_open_channel)); |
209 | 209 | ||
210 | if (ret != 0) | 210 | if (ret != 0) |
211 | goto cleanup; | 211 | goto error1; |
212 | 212 | ||
213 | t = wait_for_completion_timeout(&open_info->waitevent, 5*HZ); | 213 | t = wait_for_completion_timeout(&open_info->waitevent, 5*HZ); |
214 | if (t == 0) { | 214 | if (t == 0) { |
215 | err = -ETIMEDOUT; | 215 | err = -ETIMEDOUT; |
216 | goto errorout; | 216 | goto error1; |
217 | } | 217 | } |
218 | 218 | ||
219 | 219 | ||
220 | if (open_info->response.open_result.status) | 220 | if (open_info->response.open_result.status) |
221 | err = open_info->response.open_result.status; | 221 | err = open_info->response.open_result.status; |
222 | 222 | ||
223 | cleanup: | ||
224 | spin_lock_irqsave(&vmbus_connection.channelmsg_lock, flags); | 223 | spin_lock_irqsave(&vmbus_connection.channelmsg_lock, flags); |
225 | list_del(&open_info->msglistentry); | 224 | list_del(&open_info->msglistentry); |
226 | spin_unlock_irqrestore(&vmbus_connection.channelmsg_lock, flags); | 225 | spin_unlock_irqrestore(&vmbus_connection.channelmsg_lock, flags); |
@@ -228,9 +227,12 @@ cleanup: | |||
228 | kfree(open_info); | 227 | kfree(open_info); |
229 | return err; | 228 | return err; |
230 | 229 | ||
231 | errorout: | 230 | error1: |
232 | hv_ringbuffer_cleanup(&newchannel->outbound); | 231 | spin_lock_irqsave(&vmbus_connection.channelmsg_lock, flags); |
233 | hv_ringbuffer_cleanup(&newchannel->inbound); | 232 | list_del(&open_info->msglistentry); |
233 | spin_unlock_irqrestore(&vmbus_connection.channelmsg_lock, flags); | ||
234 | |||
235 | error0: | ||
234 | free_pages((unsigned long)out, | 236 | free_pages((unsigned long)out, |
235 | get_order(send_ringbuffer_size + recv_ringbuffer_size)); | 237 | get_order(send_ringbuffer_size + recv_ringbuffer_size)); |
236 | kfree(open_info); | 238 | kfree(open_info); |
diff --git a/drivers/hwmon/fam15h_power.c b/drivers/hwmon/fam15h_power.c index 68ad7d255512..4f4110407387 100644 --- a/drivers/hwmon/fam15h_power.c +++ b/drivers/hwmon/fam15h_power.c | |||
@@ -2,7 +2,7 @@ | |||
2 | * fam15h_power.c - AMD Family 15h processor power monitoring | 2 | * fam15h_power.c - AMD Family 15h processor power monitoring |
3 | * | 3 | * |
4 | * Copyright (c) 2011 Advanced Micro Devices, Inc. | 4 | * Copyright (c) 2011 Advanced Micro Devices, Inc. |
5 | * Author: Andreas Herrmann <andreas.herrmann3@amd.com> | 5 | * Author: Andreas Herrmann <herrmann.der.user@googlemail.com> |
6 | * | 6 | * |
7 | * | 7 | * |
8 | * This driver is free software; you can redistribute it and/or | 8 | * This driver is free software; you can redistribute it and/or |
@@ -28,7 +28,7 @@ | |||
28 | #include <asm/processor.h> | 28 | #include <asm/processor.h> |
29 | 29 | ||
30 | MODULE_DESCRIPTION("AMD Family 15h CPU processor power monitor"); | 30 | MODULE_DESCRIPTION("AMD Family 15h CPU processor power monitor"); |
31 | MODULE_AUTHOR("Andreas Herrmann <andreas.herrmann3@amd.com>"); | 31 | MODULE_AUTHOR("Andreas Herrmann <herrmann.der.user@googlemail.com>"); |
32 | MODULE_LICENSE("GPL"); | 32 | MODULE_LICENSE("GPL"); |
33 | 33 | ||
34 | /* D18F3 */ | 34 | /* D18F3 */ |
diff --git a/drivers/hwmon/gpio-fan.c b/drivers/hwmon/gpio-fan.c index 36509ae32083..1381a2e3bbd4 100644 --- a/drivers/hwmon/gpio-fan.c +++ b/drivers/hwmon/gpio-fan.c | |||
@@ -630,7 +630,9 @@ static struct platform_driver gpio_fan_driver = { | |||
630 | .driver = { | 630 | .driver = { |
631 | .name = "gpio-fan", | 631 | .name = "gpio-fan", |
632 | .pm = GPIO_FAN_PM, | 632 | .pm = GPIO_FAN_PM, |
633 | #ifdef CONFIG_OF_GPIO | ||
633 | .of_match_table = of_match_ptr(of_gpio_fan_match), | 634 | .of_match_table = of_match_ptr(of_gpio_fan_match), |
635 | #endif | ||
634 | }, | 636 | }, |
635 | }; | 637 | }; |
636 | 638 | ||
diff --git a/drivers/i2c/Makefile b/drivers/i2c/Makefile index beee6b2d361d..1722f50f2473 100644 --- a/drivers/i2c/Makefile +++ b/drivers/i2c/Makefile | |||
@@ -8,6 +8,7 @@ obj-$(CONFIG_I2C_SMBUS) += i2c-smbus.o | |||
8 | obj-$(CONFIG_I2C_CHARDEV) += i2c-dev.o | 8 | obj-$(CONFIG_I2C_CHARDEV) += i2c-dev.o |
9 | obj-$(CONFIG_I2C_MUX) += i2c-mux.o | 9 | obj-$(CONFIG_I2C_MUX) += i2c-mux.o |
10 | obj-y += algos/ busses/ muxes/ | 10 | obj-y += algos/ busses/ muxes/ |
11 | obj-$(CONFIG_I2C_STUB) += i2c-stub.o | ||
11 | 12 | ||
12 | ccflags-$(CONFIG_I2C_DEBUG_CORE) := -DDEBUG | 13 | ccflags-$(CONFIG_I2C_DEBUG_CORE) := -DDEBUG |
13 | CFLAGS_i2c-core.o := -Wno-deprecated-declarations | 14 | CFLAGS_i2c-core.o := -Wno-deprecated-declarations |
diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig index 65dd599a0262..e9df4612b7eb 100644 --- a/drivers/i2c/busses/Kconfig +++ b/drivers/i2c/busses/Kconfig | |||
@@ -81,7 +81,6 @@ config I2C_I801 | |||
81 | tristate "Intel 82801 (ICH/PCH)" | 81 | tristate "Intel 82801 (ICH/PCH)" |
82 | depends on PCI | 82 | depends on PCI |
83 | select CHECK_SIGNATURE if X86 && DMI | 83 | select CHECK_SIGNATURE if X86 && DMI |
84 | select GPIOLIB if I2C_MUX | ||
85 | help | 84 | help |
86 | If you say yes to this option, support will be included for the Intel | 85 | If you say yes to this option, support will be included for the Intel |
87 | 801 family of mainboard I2C interfaces. Specifically, the following | 86 | 801 family of mainboard I2C interfaces. Specifically, the following |
diff --git a/drivers/i2c/busses/Makefile b/drivers/i2c/busses/Makefile index 2d33d62952c1..395b516ffa08 100644 --- a/drivers/i2c/busses/Makefile +++ b/drivers/i2c/busses/Makefile | |||
@@ -85,7 +85,6 @@ obj-$(CONFIG_I2C_ACORN) += i2c-acorn.o | |||
85 | obj-$(CONFIG_I2C_ELEKTOR) += i2c-elektor.o | 85 | obj-$(CONFIG_I2C_ELEKTOR) += i2c-elektor.o |
86 | obj-$(CONFIG_I2C_PCA_ISA) += i2c-pca-isa.o | 86 | obj-$(CONFIG_I2C_PCA_ISA) += i2c-pca-isa.o |
87 | obj-$(CONFIG_I2C_SIBYTE) += i2c-sibyte.o | 87 | obj-$(CONFIG_I2C_SIBYTE) += i2c-sibyte.o |
88 | obj-$(CONFIG_I2C_STUB) += i2c-stub.o | ||
89 | obj-$(CONFIG_SCx200_ACB) += scx200_acb.o | 88 | obj-$(CONFIG_SCx200_ACB) += scx200_acb.o |
90 | obj-$(CONFIG_SCx200_I2C) += scx200_i2c.o | 89 | obj-$(CONFIG_SCx200_I2C) += scx200_i2c.o |
91 | 90 | ||
diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c index 37793156bd93..6abc00d59881 100644 --- a/drivers/i2c/busses/i2c-i801.c +++ b/drivers/i2c/busses/i2c-i801.c | |||
@@ -82,7 +82,8 @@ | |||
82 | #include <linux/wait.h> | 82 | #include <linux/wait.h> |
83 | #include <linux/err.h> | 83 | #include <linux/err.h> |
84 | 84 | ||
85 | #if defined CONFIG_I2C_MUX || defined CONFIG_I2C_MUX_MODULE | 85 | #if (defined CONFIG_I2C_MUX_GPIO || defined CONFIG_I2C_MUX_GPIO_MODULE) && \ |
86 | defined CONFIG_DMI | ||
86 | #include <linux/gpio.h> | 87 | #include <linux/gpio.h> |
87 | #include <linux/i2c-mux-gpio.h> | 88 | #include <linux/i2c-mux-gpio.h> |
88 | #include <linux/platform_device.h> | 89 | #include <linux/platform_device.h> |
@@ -192,7 +193,8 @@ struct i801_priv { | |||
192 | int len; | 193 | int len; |
193 | u8 *data; | 194 | u8 *data; |
194 | 195 | ||
195 | #if defined CONFIG_I2C_MUX || defined CONFIG_I2C_MUX_MODULE | 196 | #if (defined CONFIG_I2C_MUX_GPIO || defined CONFIG_I2C_MUX_GPIO_MODULE) && \ |
197 | defined CONFIG_DMI | ||
196 | const struct i801_mux_config *mux_drvdata; | 198 | const struct i801_mux_config *mux_drvdata; |
197 | struct platform_device *mux_pdev; | 199 | struct platform_device *mux_pdev; |
198 | #endif | 200 | #endif |
@@ -921,7 +923,8 @@ static void __init input_apanel_init(void) {} | |||
921 | static void __devinit i801_probe_optional_slaves(struct i801_priv *priv) {} | 923 | static void __devinit i801_probe_optional_slaves(struct i801_priv *priv) {} |
922 | #endif /* CONFIG_X86 && CONFIG_DMI */ | 924 | #endif /* CONFIG_X86 && CONFIG_DMI */ |
923 | 925 | ||
924 | #if defined CONFIG_I2C_MUX || defined CONFIG_I2C_MUX_MODULE | 926 | #if (defined CONFIG_I2C_MUX_GPIO || defined CONFIG_I2C_MUX_GPIO_MODULE) && \ |
927 | defined CONFIG_DMI | ||
925 | static struct i801_mux_config i801_mux_config_asus_z8_d12 = { | 928 | static struct i801_mux_config i801_mux_config_asus_z8_d12 = { |
926 | .gpio_chip = "gpio_ich", | 929 | .gpio_chip = "gpio_ich", |
927 | .values = { 0x02, 0x03 }, | 930 | .values = { 0x02, 0x03 }, |
@@ -1059,7 +1062,7 @@ static unsigned int __devinit i801_get_adapter_class(struct i801_priv *priv) | |||
1059 | 1062 | ||
1060 | id = dmi_first_match(mux_dmi_table); | 1063 | id = dmi_first_match(mux_dmi_table); |
1061 | if (id) { | 1064 | if (id) { |
1062 | /* Remove from branch classes from trunk */ | 1065 | /* Remove branch classes from trunk */ |
1063 | mux_config = id->driver_data; | 1066 | mux_config = id->driver_data; |
1064 | for (i = 0; i < mux_config->n_values; i++) | 1067 | for (i = 0; i < mux_config->n_values; i++) |
1065 | class &= ~mux_config->classes[i]; | 1068 | class &= ~mux_config->classes[i]; |
diff --git a/drivers/i2c/busses/i2c-mxs.c b/drivers/i2c/busses/i2c-mxs.c index 1f58197062cf..286ca1917820 100644 --- a/drivers/i2c/busses/i2c-mxs.c +++ b/drivers/i2c/busses/i2c-mxs.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * Freescale MXS I2C bus driver | 2 | * Freescale MXS I2C bus driver |
3 | * | 3 | * |
4 | * Copyright (C) 2011 Wolfram Sang, Pengutronix e.K. | 4 | * Copyright (C) 2011-2012 Wolfram Sang, Pengutronix e.K. |
5 | * | 5 | * |
6 | * based on a (non-working) driver which was: | 6 | * based on a (non-working) driver which was: |
7 | * | 7 | * |
@@ -35,10 +35,6 @@ | |||
35 | 35 | ||
36 | #define DRIVER_NAME "mxs-i2c" | 36 | #define DRIVER_NAME "mxs-i2c" |
37 | 37 | ||
38 | static bool use_pioqueue; | ||
39 | module_param(use_pioqueue, bool, 0); | ||
40 | MODULE_PARM_DESC(use_pioqueue, "Use PIOQUEUE mode for transfer instead of DMA"); | ||
41 | |||
42 | #define MXS_I2C_CTRL0 (0x00) | 38 | #define MXS_I2C_CTRL0 (0x00) |
43 | #define MXS_I2C_CTRL0_SET (0x04) | 39 | #define MXS_I2C_CTRL0_SET (0x04) |
44 | 40 | ||
@@ -75,23 +71,6 @@ MODULE_PARM_DESC(use_pioqueue, "Use PIOQUEUE mode for transfer instead of DMA"); | |||
75 | MXS_I2C_CTRL1_SLAVE_STOP_IRQ | \ | 71 | MXS_I2C_CTRL1_SLAVE_STOP_IRQ | \ |
76 | MXS_I2C_CTRL1_SLAVE_IRQ) | 72 | MXS_I2C_CTRL1_SLAVE_IRQ) |
77 | 73 | ||
78 | #define MXS_I2C_QUEUECTRL (0x60) | ||
79 | #define MXS_I2C_QUEUECTRL_SET (0x64) | ||
80 | #define MXS_I2C_QUEUECTRL_CLR (0x68) | ||
81 | |||
82 | #define MXS_I2C_QUEUECTRL_QUEUE_RUN 0x20 | ||
83 | #define MXS_I2C_QUEUECTRL_PIO_QUEUE_MODE 0x04 | ||
84 | |||
85 | #define MXS_I2C_QUEUESTAT (0x70) | ||
86 | #define MXS_I2C_QUEUESTAT_RD_QUEUE_EMPTY 0x00002000 | ||
87 | #define MXS_I2C_QUEUESTAT_WRITE_QUEUE_CNT_MASK 0x0000001F | ||
88 | |||
89 | #define MXS_I2C_QUEUECMD (0x80) | ||
90 | |||
91 | #define MXS_I2C_QUEUEDATA (0x90) | ||
92 | |||
93 | #define MXS_I2C_DATA (0xa0) | ||
94 | |||
95 | 74 | ||
96 | #define MXS_CMD_I2C_SELECT (MXS_I2C_CTRL0_RETAIN_CLOCK | \ | 75 | #define MXS_CMD_I2C_SELECT (MXS_I2C_CTRL0_RETAIN_CLOCK | \ |
97 | MXS_I2C_CTRL0_PRE_SEND_START | \ | 76 | MXS_I2C_CTRL0_PRE_SEND_START | \ |
@@ -153,7 +132,6 @@ struct mxs_i2c_dev { | |||
153 | const struct mxs_i2c_speed_config *speed; | 132 | const struct mxs_i2c_speed_config *speed; |
154 | 133 | ||
155 | /* DMA support components */ | 134 | /* DMA support components */ |
156 | bool dma_mode; | ||
157 | int dma_channel; | 135 | int dma_channel; |
158 | struct dma_chan *dmach; | 136 | struct dma_chan *dmach; |
159 | struct mxs_dma_data dma_data; | 137 | struct mxs_dma_data dma_data; |
@@ -172,99 +150,6 @@ static void mxs_i2c_reset(struct mxs_i2c_dev *i2c) | |||
172 | writel(i2c->speed->timing2, i2c->regs + MXS_I2C_TIMING2); | 150 | writel(i2c->speed->timing2, i2c->regs + MXS_I2C_TIMING2); |
173 | 151 | ||
174 | writel(MXS_I2C_IRQ_MASK << 8, i2c->regs + MXS_I2C_CTRL1_SET); | 152 | writel(MXS_I2C_IRQ_MASK << 8, i2c->regs + MXS_I2C_CTRL1_SET); |
175 | if (i2c->dma_mode) | ||
176 | writel(MXS_I2C_QUEUECTRL_PIO_QUEUE_MODE, | ||
177 | i2c->regs + MXS_I2C_QUEUECTRL_CLR); | ||
178 | else | ||
179 | writel(MXS_I2C_QUEUECTRL_PIO_QUEUE_MODE, | ||
180 | i2c->regs + MXS_I2C_QUEUECTRL_SET); | ||
181 | } | ||
182 | |||
183 | static void mxs_i2c_pioq_setup_read(struct mxs_i2c_dev *i2c, u8 addr, int len, | ||
184 | int flags) | ||
185 | { | ||
186 | u32 data; | ||
187 | |||
188 | writel(MXS_CMD_I2C_SELECT, i2c->regs + MXS_I2C_QUEUECMD); | ||
189 | |||
190 | data = (addr << 1) | I2C_SMBUS_READ; | ||
191 | writel(data, i2c->regs + MXS_I2C_DATA); | ||
192 | |||
193 | data = MXS_CMD_I2C_READ | MXS_I2C_CTRL0_XFER_COUNT(len) | flags; | ||
194 | writel(data, i2c->regs + MXS_I2C_QUEUECMD); | ||
195 | } | ||
196 | |||
197 | static void mxs_i2c_pioq_setup_write(struct mxs_i2c_dev *i2c, | ||
198 | u8 addr, u8 *buf, int len, int flags) | ||
199 | { | ||
200 | u32 data; | ||
201 | int i, shifts_left; | ||
202 | |||
203 | data = MXS_CMD_I2C_WRITE | MXS_I2C_CTRL0_XFER_COUNT(len + 1) | flags; | ||
204 | writel(data, i2c->regs + MXS_I2C_QUEUECMD); | ||
205 | |||
206 | /* | ||
207 | * We have to copy the slave address (u8) and buffer (arbitrary number | ||
208 | * of u8) into the data register (u32). To achieve that, the u8 are put | ||
209 | * into the MSBs of 'data' which is then shifted for the next u8. When | ||
210 | * appropriate, 'data' is written to MXS_I2C_DATA. So, the first u32 | ||
211 | * looks like this: | ||
212 | * | ||
213 | * 3 2 1 0 | ||
214 | * 10987654|32109876|54321098|76543210 | ||
215 | * --------+--------+--------+-------- | ||
216 | * buffer+2|buffer+1|buffer+0|slave_addr | ||
217 | */ | ||
218 | |||
219 | data = ((addr << 1) | I2C_SMBUS_WRITE) << 24; | ||
220 | |||
221 | for (i = 0; i < len; i++) { | ||
222 | data >>= 8; | ||
223 | data |= buf[i] << 24; | ||
224 | if ((i & 3) == 2) | ||
225 | writel(data, i2c->regs + MXS_I2C_DATA); | ||
226 | } | ||
227 | |||
228 | /* Write out the remaining bytes if any */ | ||
229 | shifts_left = 24 - (i & 3) * 8; | ||
230 | if (shifts_left) | ||
231 | writel(data >> shifts_left, i2c->regs + MXS_I2C_DATA); | ||
232 | } | ||
233 | |||
234 | /* | ||
235 | * TODO: should be replaceable with a waitqueue and RD_QUEUE_IRQ (setting the | ||
236 | * rd_threshold to 1). Couldn't get this to work, though. | ||
237 | */ | ||
238 | static int mxs_i2c_wait_for_data(struct mxs_i2c_dev *i2c) | ||
239 | { | ||
240 | unsigned long timeout = jiffies + msecs_to_jiffies(1000); | ||
241 | |||
242 | while (readl(i2c->regs + MXS_I2C_QUEUESTAT) | ||
243 | & MXS_I2C_QUEUESTAT_RD_QUEUE_EMPTY) { | ||
244 | if (time_after(jiffies, timeout)) | ||
245 | return -ETIMEDOUT; | ||
246 | cond_resched(); | ||
247 | } | ||
248 | |||
249 | return 0; | ||
250 | } | ||
251 | |||
252 | static int mxs_i2c_finish_read(struct mxs_i2c_dev *i2c, u8 *buf, int len) | ||
253 | { | ||
254 | u32 uninitialized_var(data); | ||
255 | int i; | ||
256 | |||
257 | for (i = 0; i < len; i++) { | ||
258 | if ((i & 3) == 0) { | ||
259 | if (mxs_i2c_wait_for_data(i2c)) | ||
260 | return -ETIMEDOUT; | ||
261 | data = readl(i2c->regs + MXS_I2C_QUEUEDATA); | ||
262 | } | ||
263 | buf[i] = data & 0xff; | ||
264 | data >>= 8; | ||
265 | } | ||
266 | |||
267 | return 0; | ||
268 | } | 153 | } |
269 | 154 | ||
270 | static void mxs_i2c_dma_finish(struct mxs_i2c_dev *i2c) | 155 | static void mxs_i2c_dma_finish(struct mxs_i2c_dev *i2c) |
@@ -432,39 +317,17 @@ static int mxs_i2c_xfer_msg(struct i2c_adapter *adap, struct i2c_msg *msg, | |||
432 | init_completion(&i2c->cmd_complete); | 317 | init_completion(&i2c->cmd_complete); |
433 | i2c->cmd_err = 0; | 318 | i2c->cmd_err = 0; |
434 | 319 | ||
435 | if (i2c->dma_mode) { | 320 | ret = mxs_i2c_dma_setup_xfer(adap, msg, flags); |
436 | ret = mxs_i2c_dma_setup_xfer(adap, msg, flags); | 321 | if (ret) |
437 | if (ret) | 322 | return ret; |
438 | return ret; | ||
439 | } else { | ||
440 | if (msg->flags & I2C_M_RD) { | ||
441 | mxs_i2c_pioq_setup_read(i2c, msg->addr, | ||
442 | msg->len, flags); | ||
443 | } else { | ||
444 | mxs_i2c_pioq_setup_write(i2c, msg->addr, msg->buf, | ||
445 | msg->len, flags); | ||
446 | } | ||
447 | |||
448 | writel(MXS_I2C_QUEUECTRL_QUEUE_RUN, | ||
449 | i2c->regs + MXS_I2C_QUEUECTRL_SET); | ||
450 | } | ||
451 | 323 | ||
452 | ret = wait_for_completion_timeout(&i2c->cmd_complete, | 324 | ret = wait_for_completion_timeout(&i2c->cmd_complete, |
453 | msecs_to_jiffies(1000)); | 325 | msecs_to_jiffies(1000)); |
454 | if (ret == 0) | 326 | if (ret == 0) |
455 | goto timeout; | 327 | goto timeout; |
456 | 328 | ||
457 | if (!i2c->dma_mode && !i2c->cmd_err && (msg->flags & I2C_M_RD)) { | ||
458 | ret = mxs_i2c_finish_read(i2c, msg->buf, msg->len); | ||
459 | if (ret) | ||
460 | goto timeout; | ||
461 | } | ||
462 | |||
463 | if (i2c->cmd_err == -ENXIO) | 329 | if (i2c->cmd_err == -ENXIO) |
464 | mxs_i2c_reset(i2c); | 330 | mxs_i2c_reset(i2c); |
465 | else | ||
466 | writel(MXS_I2C_QUEUECTRL_QUEUE_RUN, | ||
467 | i2c->regs + MXS_I2C_QUEUECTRL_CLR); | ||
468 | 331 | ||
469 | dev_dbg(i2c->dev, "Done with err=%d\n", i2c->cmd_err); | 332 | dev_dbg(i2c->dev, "Done with err=%d\n", i2c->cmd_err); |
470 | 333 | ||
@@ -472,8 +335,7 @@ static int mxs_i2c_xfer_msg(struct i2c_adapter *adap, struct i2c_msg *msg, | |||
472 | 335 | ||
473 | timeout: | 336 | timeout: |
474 | dev_dbg(i2c->dev, "Timeout!\n"); | 337 | dev_dbg(i2c->dev, "Timeout!\n"); |
475 | if (i2c->dma_mode) | 338 | mxs_i2c_dma_finish(i2c); |
476 | mxs_i2c_dma_finish(i2c); | ||
477 | mxs_i2c_reset(i2c); | 339 | mxs_i2c_reset(i2c); |
478 | return -ETIMEDOUT; | 340 | return -ETIMEDOUT; |
479 | } | 341 | } |
@@ -502,7 +364,6 @@ static irqreturn_t mxs_i2c_isr(int this_irq, void *dev_id) | |||
502 | { | 364 | { |
503 | struct mxs_i2c_dev *i2c = dev_id; | 365 | struct mxs_i2c_dev *i2c = dev_id; |
504 | u32 stat = readl(i2c->regs + MXS_I2C_CTRL1) & MXS_I2C_IRQ_MASK; | 366 | u32 stat = readl(i2c->regs + MXS_I2C_CTRL1) & MXS_I2C_IRQ_MASK; |
505 | bool is_last_cmd; | ||
506 | 367 | ||
507 | if (!stat) | 368 | if (!stat) |
508 | return IRQ_NONE; | 369 | return IRQ_NONE; |
@@ -515,14 +376,6 @@ static irqreturn_t mxs_i2c_isr(int this_irq, void *dev_id) | |||
515 | /* MXS_I2C_CTRL1_OVERSIZE_XFER_TERM_IRQ is only for slaves */ | 376 | /* MXS_I2C_CTRL1_OVERSIZE_XFER_TERM_IRQ is only for slaves */ |
516 | i2c->cmd_err = -EIO; | 377 | i2c->cmd_err = -EIO; |
517 | 378 | ||
518 | if (!i2c->dma_mode) { | ||
519 | is_last_cmd = (readl(i2c->regs + MXS_I2C_QUEUESTAT) & | ||
520 | MXS_I2C_QUEUESTAT_WRITE_QUEUE_CNT_MASK) == 0; | ||
521 | |||
522 | if (is_last_cmd || i2c->cmd_err) | ||
523 | complete(&i2c->cmd_complete); | ||
524 | } | ||
525 | |||
526 | writel(stat, i2c->regs + MXS_I2C_CTRL1_CLR); | 379 | writel(stat, i2c->regs + MXS_I2C_CTRL1_CLR); |
527 | 380 | ||
528 | return IRQ_HANDLED; | 381 | return IRQ_HANDLED; |
@@ -556,23 +409,14 @@ static int mxs_i2c_get_ofdata(struct mxs_i2c_dev *i2c) | |||
556 | int ret; | 409 | int ret; |
557 | 410 | ||
558 | /* | 411 | /* |
559 | * The MXS I2C DMA mode is prefered and enabled by default. | ||
560 | * The PIO mode is still supported, but should be used only | ||
561 | * for debuging purposes etc. | ||
562 | */ | ||
563 | i2c->dma_mode = !use_pioqueue; | ||
564 | if (!i2c->dma_mode) | ||
565 | dev_info(dev, "Using PIOQUEUE mode for I2C transfers!\n"); | ||
566 | |||
567 | /* | ||
568 | * TODO: This is a temporary solution and should be changed | 412 | * TODO: This is a temporary solution and should be changed |
569 | * to use generic DMA binding later when the helpers get in. | 413 | * to use generic DMA binding later when the helpers get in. |
570 | */ | 414 | */ |
571 | ret = of_property_read_u32(node, "fsl,i2c-dma-channel", | 415 | ret = of_property_read_u32(node, "fsl,i2c-dma-channel", |
572 | &i2c->dma_channel); | 416 | &i2c->dma_channel); |
573 | if (ret) { | 417 | if (ret) { |
574 | dev_warn(dev, "Failed to get DMA channel, using PIOQUEUE!\n"); | 418 | dev_err(dev, "Failed to get DMA channel!\n"); |
575 | i2c->dma_mode = 0; | 419 | return -ENODEV; |
576 | } | 420 | } |
577 | 421 | ||
578 | ret = of_property_read_u32(node, "clock-frequency", &speed); | 422 | ret = of_property_read_u32(node, "clock-frequency", &speed); |
@@ -634,15 +478,13 @@ static int __devinit mxs_i2c_probe(struct platform_device *pdev) | |||
634 | } | 478 | } |
635 | 479 | ||
636 | /* Setup the DMA */ | 480 | /* Setup the DMA */ |
637 | if (i2c->dma_mode) { | 481 | dma_cap_zero(mask); |
638 | dma_cap_zero(mask); | 482 | dma_cap_set(DMA_SLAVE, mask); |
639 | dma_cap_set(DMA_SLAVE, mask); | 483 | i2c->dma_data.chan_irq = dmairq; |
640 | i2c->dma_data.chan_irq = dmairq; | 484 | i2c->dmach = dma_request_channel(mask, mxs_i2c_dma_filter, i2c); |
641 | i2c->dmach = dma_request_channel(mask, mxs_i2c_dma_filter, i2c); | 485 | if (!i2c->dmach) { |
642 | if (!i2c->dmach) { | 486 | dev_err(dev, "Failed to request dma\n"); |
643 | dev_err(dev, "Failed to request dma\n"); | 487 | return -ENODEV; |
644 | return -ENODEV; | ||
645 | } | ||
646 | } | 488 | } |
647 | 489 | ||
648 | platform_set_drvdata(pdev, i2c); | 490 | platform_set_drvdata(pdev, i2c); |
diff --git a/drivers/i2c/busses/i2c-nomadik.c b/drivers/i2c/busses/i2c-nomadik.c index 698d7acb0f08..02c3115a2dfa 100644 --- a/drivers/i2c/busses/i2c-nomadik.c +++ b/drivers/i2c/busses/i2c-nomadik.c | |||
@@ -644,7 +644,11 @@ static int nmk_i2c_xfer(struct i2c_adapter *i2c_adap, | |||
644 | 644 | ||
645 | pm_runtime_get_sync(&dev->adev->dev); | 645 | pm_runtime_get_sync(&dev->adev->dev); |
646 | 646 | ||
647 | clk_enable(dev->clk); | 647 | status = clk_prepare_enable(dev->clk); |
648 | if (status) { | ||
649 | dev_err(&dev->adev->dev, "can't prepare_enable clock\n"); | ||
650 | goto out_clk; | ||
651 | } | ||
648 | 652 | ||
649 | status = init_hw(dev); | 653 | status = init_hw(dev); |
650 | if (status) | 654 | if (status) |
@@ -671,7 +675,8 @@ static int nmk_i2c_xfer(struct i2c_adapter *i2c_adap, | |||
671 | } | 675 | } |
672 | 676 | ||
673 | out: | 677 | out: |
674 | clk_disable(dev->clk); | 678 | clk_disable_unprepare(dev->clk); |
679 | out_clk: | ||
675 | pm_runtime_put_sync(&dev->adev->dev); | 680 | pm_runtime_put_sync(&dev->adev->dev); |
676 | 681 | ||
677 | dev->busy = false; | 682 | dev->busy = false; |
diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c index f981ac4e6783..dcea77bf6f50 100644 --- a/drivers/i2c/busses/i2c-tegra.c +++ b/drivers/i2c/busses/i2c-tegra.c | |||
@@ -742,7 +742,7 @@ static int __devinit tegra_i2c_probe(struct platform_device *pdev) | |||
742 | } | 742 | } |
743 | 743 | ||
744 | ret = devm_request_irq(&pdev->dev, i2c_dev->irq, | 744 | ret = devm_request_irq(&pdev->dev, i2c_dev->irq, |
745 | tegra_i2c_isr, 0, pdev->name, i2c_dev); | 745 | tegra_i2c_isr, 0, dev_name(&pdev->dev), i2c_dev); |
746 | if (ret) { | 746 | if (ret) { |
747 | dev_err(&pdev->dev, "Failed to request irq %i\n", i2c_dev->irq); | 747 | dev_err(&pdev->dev, "Failed to request irq %i\n", i2c_dev->irq); |
748 | return ret; | 748 | return ret; |
diff --git a/drivers/i2c/busses/i2c-stub.c b/drivers/i2c/i2c-stub.c index b1b3447942c9..d0a9c590c3cd 100644 --- a/drivers/i2c/busses/i2c-stub.c +++ b/drivers/i2c/i2c-stub.c | |||
@@ -2,7 +2,7 @@ | |||
2 | i2c-stub.c - I2C/SMBus chip emulator | 2 | i2c-stub.c - I2C/SMBus chip emulator |
3 | 3 | ||
4 | Copyright (c) 2004 Mark M. Hoffman <mhoffman@lightlink.com> | 4 | Copyright (c) 2004 Mark M. Hoffman <mhoffman@lightlink.com> |
5 | Copyright (C) 2007 Jean Delvare <khali@linux-fr.org> | 5 | Copyright (C) 2007, 2012 Jean Delvare <khali@linux-fr.org> |
6 | 6 | ||
7 | This program is free software; you can redistribute it and/or modify | 7 | This program is free software; you can redistribute it and/or modify |
8 | it under the terms of the GNU General Public License as published by | 8 | it under the terms of the GNU General Public License as published by |
@@ -51,8 +51,8 @@ struct stub_chip { | |||
51 | static struct stub_chip *stub_chips; | 51 | static struct stub_chip *stub_chips; |
52 | 52 | ||
53 | /* Return negative errno on error. */ | 53 | /* Return negative errno on error. */ |
54 | static s32 stub_xfer(struct i2c_adapter * adap, u16 addr, unsigned short flags, | 54 | static s32 stub_xfer(struct i2c_adapter *adap, u16 addr, unsigned short flags, |
55 | char read_write, u8 command, int size, union i2c_smbus_data * data) | 55 | char read_write, u8 command, int size, union i2c_smbus_data *data) |
56 | { | 56 | { |
57 | s32 ret; | 57 | s32 ret; |
58 | int i, len; | 58 | int i, len; |
@@ -78,14 +78,14 @@ static s32 stub_xfer(struct i2c_adapter * adap, u16 addr, unsigned short flags, | |||
78 | case I2C_SMBUS_BYTE: | 78 | case I2C_SMBUS_BYTE: |
79 | if (read_write == I2C_SMBUS_WRITE) { | 79 | if (read_write == I2C_SMBUS_WRITE) { |
80 | chip->pointer = command; | 80 | chip->pointer = command; |
81 | dev_dbg(&adap->dev, "smbus byte - addr 0x%02x, " | 81 | dev_dbg(&adap->dev, |
82 | "wrote 0x%02x.\n", | 82 | "smbus byte - addr 0x%02x, wrote 0x%02x.\n", |
83 | addr, command); | 83 | addr, command); |
84 | } else { | 84 | } else { |
85 | data->byte = chip->words[chip->pointer++] & 0xff; | 85 | data->byte = chip->words[chip->pointer++] & 0xff; |
86 | dev_dbg(&adap->dev, "smbus byte - addr 0x%02x, " | 86 | dev_dbg(&adap->dev, |
87 | "read 0x%02x.\n", | 87 | "smbus byte - addr 0x%02x, read 0x%02x.\n", |
88 | addr, data->byte); | 88 | addr, data->byte); |
89 | } | 89 | } |
90 | 90 | ||
91 | ret = 0; | 91 | ret = 0; |
@@ -95,14 +95,14 @@ static s32 stub_xfer(struct i2c_adapter * adap, u16 addr, unsigned short flags, | |||
95 | if (read_write == I2C_SMBUS_WRITE) { | 95 | if (read_write == I2C_SMBUS_WRITE) { |
96 | chip->words[command] &= 0xff00; | 96 | chip->words[command] &= 0xff00; |
97 | chip->words[command] |= data->byte; | 97 | chip->words[command] |= data->byte; |
98 | dev_dbg(&adap->dev, "smbus byte data - addr 0x%02x, " | 98 | dev_dbg(&adap->dev, |
99 | "wrote 0x%02x at 0x%02x.\n", | 99 | "smbus byte data - addr 0x%02x, wrote 0x%02x at 0x%02x.\n", |
100 | addr, data->byte, command); | 100 | addr, data->byte, command); |
101 | } else { | 101 | } else { |
102 | data->byte = chip->words[command] & 0xff; | 102 | data->byte = chip->words[command] & 0xff; |
103 | dev_dbg(&adap->dev, "smbus byte data - addr 0x%02x, " | 103 | dev_dbg(&adap->dev, |
104 | "read 0x%02x at 0x%02x.\n", | 104 | "smbus byte data - addr 0x%02x, read 0x%02x at 0x%02x.\n", |
105 | addr, data->byte, command); | 105 | addr, data->byte, command); |
106 | } | 106 | } |
107 | chip->pointer = command + 1; | 107 | chip->pointer = command + 1; |
108 | 108 | ||
@@ -112,14 +112,14 @@ static s32 stub_xfer(struct i2c_adapter * adap, u16 addr, unsigned short flags, | |||
112 | case I2C_SMBUS_WORD_DATA: | 112 | case I2C_SMBUS_WORD_DATA: |
113 | if (read_write == I2C_SMBUS_WRITE) { | 113 | if (read_write == I2C_SMBUS_WRITE) { |
114 | chip->words[command] = data->word; | 114 | chip->words[command] = data->word; |
115 | dev_dbg(&adap->dev, "smbus word data - addr 0x%02x, " | 115 | dev_dbg(&adap->dev, |
116 | "wrote 0x%04x at 0x%02x.\n", | 116 | "smbus word data - addr 0x%02x, wrote 0x%04x at 0x%02x.\n", |
117 | addr, data->word, command); | 117 | addr, data->word, command); |
118 | } else { | 118 | } else { |
119 | data->word = chip->words[command]; | 119 | data->word = chip->words[command]; |
120 | dev_dbg(&adap->dev, "smbus word data - addr 0x%02x, " | 120 | dev_dbg(&adap->dev, |
121 | "read 0x%04x at 0x%02x.\n", | 121 | "smbus word data - addr 0x%02x, read 0x%04x at 0x%02x.\n", |
122 | addr, data->word, command); | 122 | addr, data->word, command); |
123 | } | 123 | } |
124 | 124 | ||
125 | ret = 0; | 125 | ret = 0; |
@@ -132,17 +132,17 @@ static s32 stub_xfer(struct i2c_adapter * adap, u16 addr, unsigned short flags, | |||
132 | chip->words[command + i] &= 0xff00; | 132 | chip->words[command + i] &= 0xff00; |
133 | chip->words[command + i] |= data->block[1 + i]; | 133 | chip->words[command + i] |= data->block[1 + i]; |
134 | } | 134 | } |
135 | dev_dbg(&adap->dev, "i2c block data - addr 0x%02x, " | 135 | dev_dbg(&adap->dev, |
136 | "wrote %d bytes at 0x%02x.\n", | 136 | "i2c block data - addr 0x%02x, wrote %d bytes at 0x%02x.\n", |
137 | addr, len, command); | 137 | addr, len, command); |
138 | } else { | 138 | } else { |
139 | for (i = 0; i < len; i++) { | 139 | for (i = 0; i < len; i++) { |
140 | data->block[1 + i] = | 140 | data->block[1 + i] = |
141 | chip->words[command + i] & 0xff; | 141 | chip->words[command + i] & 0xff; |
142 | } | 142 | } |
143 | dev_dbg(&adap->dev, "i2c block data - addr 0x%02x, " | 143 | dev_dbg(&adap->dev, |
144 | "read %d bytes at 0x%02x.\n", | 144 | "i2c block data - addr 0x%02x, read %d bytes at 0x%02x.\n", |
145 | addr, len, command); | 145 | addr, len, command); |
146 | } | 146 | } |
147 | 147 | ||
148 | ret = 0; | 148 | ret = 0; |
@@ -179,25 +179,24 @@ static int __init i2c_stub_init(void) | |||
179 | int i, ret; | 179 | int i, ret; |
180 | 180 | ||
181 | if (!chip_addr[0]) { | 181 | if (!chip_addr[0]) { |
182 | printk(KERN_ERR "i2c-stub: Please specify a chip address\n"); | 182 | pr_err("i2c-stub: Please specify a chip address\n"); |
183 | return -ENODEV; | 183 | return -ENODEV; |
184 | } | 184 | } |
185 | 185 | ||
186 | for (i = 0; i < MAX_CHIPS && chip_addr[i]; i++) { | 186 | for (i = 0; i < MAX_CHIPS && chip_addr[i]; i++) { |
187 | if (chip_addr[i] < 0x03 || chip_addr[i] > 0x77) { | 187 | if (chip_addr[i] < 0x03 || chip_addr[i] > 0x77) { |
188 | printk(KERN_ERR "i2c-stub: Invalid chip address " | 188 | pr_err("i2c-stub: Invalid chip address 0x%02x\n", |
189 | "0x%02x\n", chip_addr[i]); | 189 | chip_addr[i]); |
190 | return -EINVAL; | 190 | return -EINVAL; |
191 | } | 191 | } |
192 | 192 | ||
193 | printk(KERN_INFO "i2c-stub: Virtual chip at 0x%02x\n", | 193 | pr_info("i2c-stub: Virtual chip at 0x%02x\n", chip_addr[i]); |
194 | chip_addr[i]); | ||
195 | } | 194 | } |
196 | 195 | ||
197 | /* Allocate memory for all chips at once */ | 196 | /* Allocate memory for all chips at once */ |
198 | stub_chips = kzalloc(i * sizeof(struct stub_chip), GFP_KERNEL); | 197 | stub_chips = kzalloc(i * sizeof(struct stub_chip), GFP_KERNEL); |
199 | if (!stub_chips) { | 198 | if (!stub_chips) { |
200 | printk(KERN_ERR "i2c-stub: Out of memory\n"); | 199 | pr_err("i2c-stub: Out of memory\n"); |
201 | return -ENOMEM; | 200 | return -ENOMEM; |
202 | } | 201 | } |
203 | 202 | ||
@@ -219,4 +218,3 @@ MODULE_LICENSE("GPL"); | |||
219 | 218 | ||
220 | module_init(i2c_stub_init); | 219 | module_init(i2c_stub_init); |
221 | module_exit(i2c_stub_exit); | 220 | module_exit(i2c_stub_exit); |
222 | |||
diff --git a/drivers/iio/Kconfig b/drivers/iio/Kconfig index 6e3f143fc71d..fc937aca71fb 100644 --- a/drivers/iio/Kconfig +++ b/drivers/iio/Kconfig | |||
@@ -62,7 +62,6 @@ source "drivers/iio/frequency/Kconfig" | |||
62 | source "drivers/iio/dac/Kconfig" | 62 | source "drivers/iio/dac/Kconfig" |
63 | source "drivers/iio/common/Kconfig" | 63 | source "drivers/iio/common/Kconfig" |
64 | source "drivers/iio/gyro/Kconfig" | 64 | source "drivers/iio/gyro/Kconfig" |
65 | source "drivers/iio/light/Kconfig" | ||
66 | source "drivers/iio/magnetometer/Kconfig" | 65 | source "drivers/iio/magnetometer/Kconfig" |
67 | 66 | ||
68 | endif # IIO | 67 | endif # IIO |
diff --git a/drivers/iio/Makefile b/drivers/iio/Makefile index f7fa3c0867b4..761f2b65ac52 100644 --- a/drivers/iio/Makefile +++ b/drivers/iio/Makefile | |||
@@ -18,5 +18,4 @@ obj-y += frequency/ | |||
18 | obj-y += dac/ | 18 | obj-y += dac/ |
19 | obj-y += common/ | 19 | obj-y += common/ |
20 | obj-y += gyro/ | 20 | obj-y += gyro/ |
21 | obj-y += light/ | ||
22 | obj-y += magnetometer/ | 21 | obj-y += magnetometer/ |
diff --git a/drivers/infiniband/hw/cxgb4/mem.c b/drivers/infiniband/hw/cxgb4/mem.c index 57e07c61ace2..afd81790ab3c 100644 --- a/drivers/infiniband/hw/cxgb4/mem.c +++ b/drivers/infiniband/hw/cxgb4/mem.c | |||
@@ -468,7 +468,7 @@ struct ib_mr *c4iw_register_phys_mem(struct ib_pd *pd, | |||
468 | ret = alloc_pbl(mhp, npages); | 468 | ret = alloc_pbl(mhp, npages); |
469 | if (ret) { | 469 | if (ret) { |
470 | kfree(page_list); | 470 | kfree(page_list); |
471 | goto err_pbl; | 471 | goto err; |
472 | } | 472 | } |
473 | 473 | ||
474 | ret = write_pbl(&mhp->rhp->rdev, page_list, mhp->attr.pbl_addr, | 474 | ret = write_pbl(&mhp->rhp->rdev, page_list, mhp->attr.pbl_addr, |
diff --git a/drivers/infiniband/hw/mlx4/alias_GUID.c b/drivers/infiniband/hw/mlx4/alias_GUID.c index d2fb38d43571..2f215b93db6b 100644 --- a/drivers/infiniband/hw/mlx4/alias_GUID.c +++ b/drivers/infiniband/hw/mlx4/alias_GUID.c | |||
@@ -107,7 +107,7 @@ static __be64 get_cached_alias_guid(struct mlx4_ib_dev *dev, int port, int index | |||
107 | { | 107 | { |
108 | if (index >= NUM_ALIAS_GUID_PER_PORT) { | 108 | if (index >= NUM_ALIAS_GUID_PER_PORT) { |
109 | pr_err("%s: ERROR: asked for index:%d\n", __func__, index); | 109 | pr_err("%s: ERROR: asked for index:%d\n", __func__, index); |
110 | return (__force __be64) ((u64) 0xFFFFFFFFFFFFFFFFUL); | 110 | return (__force __be64) -1; |
111 | } | 111 | } |
112 | return *(__be64 *)&dev->sriov.demux[port - 1].guid_cache[index]; | 112 | return *(__be64 *)&dev->sriov.demux[port - 1].guid_cache[index]; |
113 | } | 113 | } |
diff --git a/drivers/infiniband/hw/mlx4/mad.c b/drivers/infiniband/hw/mlx4/mad.c index 21a794152d15..0a903c129f0a 100644 --- a/drivers/infiniband/hw/mlx4/mad.c +++ b/drivers/infiniband/hw/mlx4/mad.c | |||
@@ -409,38 +409,45 @@ int mlx4_ib_find_real_gid(struct ib_device *ibdev, u8 port, __be64 guid) | |||
409 | } | 409 | } |
410 | 410 | ||
411 | 411 | ||
412 | static int get_pkey_phys_indices(struct mlx4_ib_dev *ibdev, u8 port, u8 ph_pkey_ix, | 412 | static int find_slave_port_pkey_ix(struct mlx4_ib_dev *dev, int slave, |
413 | u8 *full_pk_ix, u8 *partial_pk_ix, | 413 | u8 port, u16 pkey, u16 *ix) |
414 | int *is_full_member) | ||
415 | { | 414 | { |
416 | u16 search_pkey; | 415 | int i, ret; |
417 | int fm; | 416 | u8 unassigned_pkey_ix, pkey_ix, partial_ix = 0xFF; |
418 | int err = 0; | 417 | u16 slot_pkey; |
419 | u16 pk; | ||
420 | 418 | ||
421 | err = ib_get_cached_pkey(&ibdev->ib_dev, port, ph_pkey_ix, &search_pkey); | 419 | if (slave == mlx4_master_func_num(dev->dev)) |
422 | if (err) | 420 | return ib_find_cached_pkey(&dev->ib_dev, port, pkey, ix); |
423 | return err; | ||
424 | 421 | ||
425 | fm = (search_pkey & 0x8000) ? 1 : 0; | 422 | unassigned_pkey_ix = dev->dev->phys_caps.pkey_phys_table_len[port] - 1; |
426 | if (fm) { | ||
427 | *full_pk_ix = ph_pkey_ix; | ||
428 | search_pkey &= 0x7FFF; | ||
429 | } else { | ||
430 | *partial_pk_ix = ph_pkey_ix; | ||
431 | search_pkey |= 0x8000; | ||
432 | } | ||
433 | 423 | ||
434 | if (ib_find_exact_cached_pkey(&ibdev->ib_dev, port, search_pkey, &pk)) | 424 | for (i = 0; i < dev->dev->caps.pkey_table_len[port]; i++) { |
435 | pk = 0xFFFF; | 425 | if (dev->pkeys.virt2phys_pkey[slave][port - 1][i] == unassigned_pkey_ix) |
426 | continue; | ||
436 | 427 | ||
437 | if (fm) | 428 | pkey_ix = dev->pkeys.virt2phys_pkey[slave][port - 1][i]; |
438 | *partial_pk_ix = (pk & 0xFF); | ||
439 | else | ||
440 | *full_pk_ix = (pk & 0xFF); | ||
441 | 429 | ||
442 | *is_full_member = fm; | 430 | ret = ib_get_cached_pkey(&dev->ib_dev, port, pkey_ix, &slot_pkey); |
443 | return err; | 431 | if (ret) |
432 | continue; | ||
433 | if ((slot_pkey & 0x7FFF) == (pkey & 0x7FFF)) { | ||
434 | if (slot_pkey & 0x8000) { | ||
435 | *ix = (u16) pkey_ix; | ||
436 | return 0; | ||
437 | } else { | ||
438 | /* take first partial pkey index found */ | ||
439 | if (partial_ix == 0xFF) | ||
440 | partial_ix = pkey_ix; | ||
441 | } | ||
442 | } | ||
443 | } | ||
444 | |||
445 | if (partial_ix < 0xFF) { | ||
446 | *ix = (u16) partial_ix; | ||
447 | return 0; | ||
448 | } | ||
449 | |||
450 | return -EINVAL; | ||
444 | } | 451 | } |
445 | 452 | ||
446 | int mlx4_ib_send_to_slave(struct mlx4_ib_dev *dev, int slave, u8 port, | 453 | int mlx4_ib_send_to_slave(struct mlx4_ib_dev *dev, int slave, u8 port, |
@@ -458,10 +465,8 @@ int mlx4_ib_send_to_slave(struct mlx4_ib_dev *dev, int slave, u8 port, | |||
458 | unsigned tun_tx_ix = 0; | 465 | unsigned tun_tx_ix = 0; |
459 | int dqpn; | 466 | int dqpn; |
460 | int ret = 0; | 467 | int ret = 0; |
461 | int i; | ||
462 | int is_full_member = 0; | ||
463 | u16 tun_pkey_ix; | 468 | u16 tun_pkey_ix; |
464 | u8 ph_pkey_ix, full_pk_ix = 0, partial_pk_ix = 0; | 469 | u16 cached_pkey; |
465 | 470 | ||
466 | if (dest_qpt > IB_QPT_GSI) | 471 | if (dest_qpt > IB_QPT_GSI) |
467 | return -EINVAL; | 472 | return -EINVAL; |
@@ -481,27 +486,17 @@ int mlx4_ib_send_to_slave(struct mlx4_ib_dev *dev, int slave, u8 port, | |||
481 | else | 486 | else |
482 | tun_qp = &tun_ctx->qp[1]; | 487 | tun_qp = &tun_ctx->qp[1]; |
483 | 488 | ||
484 | /* compute pkey index for slave */ | 489 | /* compute P_Key index to put in tunnel header for slave */ |
485 | /* get physical pkey -- virtualized Dom0 pkey to phys*/ | ||
486 | if (dest_qpt) { | 490 | if (dest_qpt) { |
487 | ph_pkey_ix = | 491 | u16 pkey_ix; |
488 | dev->pkeys.virt2phys_pkey[mlx4_master_func_num(dev->dev)][port - 1][wc->pkey_index]; | 492 | ret = ib_get_cached_pkey(&dev->ib_dev, port, wc->pkey_index, &cached_pkey); |
489 | |||
490 | /* now, translate this to the slave pkey index */ | ||
491 | ret = get_pkey_phys_indices(dev, port, ph_pkey_ix, &full_pk_ix, | ||
492 | &partial_pk_ix, &is_full_member); | ||
493 | if (ret) | 493 | if (ret) |
494 | return -EINVAL; | 494 | return -EINVAL; |
495 | 495 | ||
496 | for (i = 0; i < dev->dev->caps.pkey_table_len[port]; i++) { | 496 | ret = find_slave_port_pkey_ix(dev, slave, port, cached_pkey, &pkey_ix); |
497 | if ((dev->pkeys.virt2phys_pkey[slave][port - 1][i] == full_pk_ix) || | 497 | if (ret) |
498 | (is_full_member && | ||
499 | (dev->pkeys.virt2phys_pkey[slave][port - 1][i] == partial_pk_ix))) | ||
500 | break; | ||
501 | } | ||
502 | if (i == dev->dev->caps.pkey_table_len[port]) | ||
503 | return -EINVAL; | 498 | return -EINVAL; |
504 | tun_pkey_ix = i; | 499 | tun_pkey_ix = pkey_ix; |
505 | } else | 500 | } else |
506 | tun_pkey_ix = dev->pkeys.virt2phys_pkey[slave][port - 1][0]; | 501 | tun_pkey_ix = dev->pkeys.virt2phys_pkey[slave][port - 1][0]; |
507 | 502 | ||
diff --git a/drivers/infiniband/hw/mlx4/mcg.c b/drivers/infiniband/hw/mlx4/mcg.c index 3c3b54c3fdd9..25b2cdff00f8 100644 --- a/drivers/infiniband/hw/mlx4/mcg.c +++ b/drivers/infiniband/hw/mlx4/mcg.c | |||
@@ -233,7 +233,8 @@ static int send_mad_to_slave(int slave, struct mlx4_ib_demux_ctx *ctx, | |||
233 | 233 | ||
234 | ib_query_ah(dev->sm_ah[ctx->port - 1], &ah_attr); | 234 | ib_query_ah(dev->sm_ah[ctx->port - 1], &ah_attr); |
235 | 235 | ||
236 | wc.pkey_index = 0; | 236 | if (ib_find_cached_pkey(&dev->ib_dev, ctx->port, IB_DEFAULT_PKEY_FULL, &wc.pkey_index)) |
237 | return -EINVAL; | ||
237 | wc.sl = 0; | 238 | wc.sl = 0; |
238 | wc.dlid_path_bits = 0; | 239 | wc.dlid_path_bits = 0; |
239 | wc.port_num = ctx->port; | 240 | wc.port_num = ctx->port; |
@@ -1074,10 +1075,6 @@ static void _mlx4_ib_mcg_port_cleanup(struct mlx4_ib_demux_ctx *ctx, int destroy | |||
1074 | unsigned long end; | 1075 | unsigned long end; |
1075 | int count; | 1076 | int count; |
1076 | 1077 | ||
1077 | if (ctx->flushing) | ||
1078 | return; | ||
1079 | |||
1080 | ctx->flushing = 1; | ||
1081 | for (i = 0; i < MAX_VFS; ++i) | 1078 | for (i = 0; i < MAX_VFS; ++i) |
1082 | clean_vf_mcast(ctx, i); | 1079 | clean_vf_mcast(ctx, i); |
1083 | 1080 | ||
@@ -1107,9 +1104,6 @@ static void _mlx4_ib_mcg_port_cleanup(struct mlx4_ib_demux_ctx *ctx, int destroy | |||
1107 | force_clean_group(group); | 1104 | force_clean_group(group); |
1108 | } | 1105 | } |
1109 | mutex_unlock(&ctx->mcg_table_lock); | 1106 | mutex_unlock(&ctx->mcg_table_lock); |
1110 | |||
1111 | if (!destroy_wq) | ||
1112 | ctx->flushing = 0; | ||
1113 | } | 1107 | } |
1114 | 1108 | ||
1115 | struct clean_work { | 1109 | struct clean_work { |
@@ -1123,6 +1117,7 @@ static void mcg_clean_task(struct work_struct *work) | |||
1123 | struct clean_work *cw = container_of(work, struct clean_work, work); | 1117 | struct clean_work *cw = container_of(work, struct clean_work, work); |
1124 | 1118 | ||
1125 | _mlx4_ib_mcg_port_cleanup(cw->ctx, cw->destroy_wq); | 1119 | _mlx4_ib_mcg_port_cleanup(cw->ctx, cw->destroy_wq); |
1120 | cw->ctx->flushing = 0; | ||
1126 | kfree(cw); | 1121 | kfree(cw); |
1127 | } | 1122 | } |
1128 | 1123 | ||
@@ -1130,13 +1125,20 @@ void mlx4_ib_mcg_port_cleanup(struct mlx4_ib_demux_ctx *ctx, int destroy_wq) | |||
1130 | { | 1125 | { |
1131 | struct clean_work *work; | 1126 | struct clean_work *work; |
1132 | 1127 | ||
1128 | if (ctx->flushing) | ||
1129 | return; | ||
1130 | |||
1131 | ctx->flushing = 1; | ||
1132 | |||
1133 | if (destroy_wq) { | 1133 | if (destroy_wq) { |
1134 | _mlx4_ib_mcg_port_cleanup(ctx, destroy_wq); | 1134 | _mlx4_ib_mcg_port_cleanup(ctx, destroy_wq); |
1135 | ctx->flushing = 0; | ||
1135 | return; | 1136 | return; |
1136 | } | 1137 | } |
1137 | 1138 | ||
1138 | work = kmalloc(sizeof *work, GFP_KERNEL); | 1139 | work = kmalloc(sizeof *work, GFP_KERNEL); |
1139 | if (!work) { | 1140 | if (!work) { |
1141 | ctx->flushing = 0; | ||
1140 | mcg_warn("failed allocating work for cleanup\n"); | 1142 | mcg_warn("failed allocating work for cleanup\n"); |
1141 | return; | 1143 | return; |
1142 | } | 1144 | } |
diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c index 6ae2ac47c9c8..f0f8928b3c8a 100644 --- a/drivers/input/evdev.c +++ b/drivers/input/evdev.c | |||
@@ -292,7 +292,6 @@ static int evdev_release(struct inode *inode, struct file *file) | |||
292 | kfree(client); | 292 | kfree(client); |
293 | 293 | ||
294 | evdev_close_device(evdev); | 294 | evdev_close_device(evdev); |
295 | put_device(&evdev->dev); | ||
296 | 295 | ||
297 | return 0; | 296 | return 0; |
298 | } | 297 | } |
@@ -331,7 +330,6 @@ static int evdev_open(struct inode *inode, struct file *file) | |||
331 | file->private_data = client; | 330 | file->private_data = client; |
332 | nonseekable_open(inode, file); | 331 | nonseekable_open(inode, file); |
333 | 332 | ||
334 | get_device(&evdev->dev); | ||
335 | return 0; | 333 | return 0; |
336 | 334 | ||
337 | err_free_client: | 335 | err_free_client: |
@@ -1001,6 +999,7 @@ static int evdev_connect(struct input_handler *handler, struct input_dev *dev, | |||
1001 | goto err_free_evdev; | 999 | goto err_free_evdev; |
1002 | 1000 | ||
1003 | cdev_init(&evdev->cdev, &evdev_fops); | 1001 | cdev_init(&evdev->cdev, &evdev_fops); |
1002 | evdev->cdev.kobj.parent = &evdev->dev.kobj; | ||
1004 | error = cdev_add(&evdev->cdev, evdev->dev.devt, 1); | 1003 | error = cdev_add(&evdev->cdev, evdev->dev.devt, 1); |
1005 | if (error) | 1004 | if (error) |
1006 | goto err_unregister_handle; | 1005 | goto err_unregister_handle; |
diff --git a/drivers/input/joydev.c b/drivers/input/joydev.c index b62b5891f399..f362883c94e3 100644 --- a/drivers/input/joydev.c +++ b/drivers/input/joydev.c | |||
@@ -243,7 +243,6 @@ static int joydev_release(struct inode *inode, struct file *file) | |||
243 | kfree(client); | 243 | kfree(client); |
244 | 244 | ||
245 | joydev_close_device(joydev); | 245 | joydev_close_device(joydev); |
246 | put_device(&joydev->dev); | ||
247 | 246 | ||
248 | return 0; | 247 | return 0; |
249 | } | 248 | } |
@@ -270,7 +269,6 @@ static int joydev_open(struct inode *inode, struct file *file) | |||
270 | file->private_data = client; | 269 | file->private_data = client; |
271 | nonseekable_open(inode, file); | 270 | nonseekable_open(inode, file); |
272 | 271 | ||
273 | get_device(&joydev->dev); | ||
274 | return 0; | 272 | return 0; |
275 | 273 | ||
276 | err_free_client: | 274 | err_free_client: |
@@ -858,6 +856,7 @@ static int joydev_connect(struct input_handler *handler, struct input_dev *dev, | |||
858 | goto err_free_joydev; | 856 | goto err_free_joydev; |
859 | 857 | ||
860 | cdev_init(&joydev->cdev, &joydev_fops); | 858 | cdev_init(&joydev->cdev, &joydev_fops); |
859 | joydev->cdev.kobj.parent = &joydev->dev.kobj; | ||
861 | error = cdev_add(&joydev->cdev, joydev->dev.devt, 1); | 860 | error = cdev_add(&joydev->cdev, joydev->dev.devt, 1); |
862 | if (error) | 861 | if (error) |
863 | goto err_unregister_handle; | 862 | goto err_unregister_handle; |
diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig index b4b65af8612a..de0874054e9f 100644 --- a/drivers/input/keyboard/Kconfig +++ b/drivers/input/keyboard/Kconfig | |||
@@ -335,6 +335,7 @@ config KEYBOARD_LOCOMO | |||
335 | config KEYBOARD_LPC32XX | 335 | config KEYBOARD_LPC32XX |
336 | tristate "LPC32XX matrix key scanner support" | 336 | tristate "LPC32XX matrix key scanner support" |
337 | depends on ARCH_LPC32XX && OF | 337 | depends on ARCH_LPC32XX && OF |
338 | select INPUT_MATRIXKMAP | ||
338 | help | 339 | help |
339 | Say Y here if you want to use NXP LPC32XX SoC key scanner interface, | 340 | Say Y here if you want to use NXP LPC32XX SoC key scanner interface, |
340 | connected to a key matrix. | 341 | connected to a key matrix. |
diff --git a/drivers/input/keyboard/pxa27x_keypad.c b/drivers/input/keyboard/pxa27x_keypad.c index 803ff6fe021e..cad9d5dd5973 100644 --- a/drivers/input/keyboard/pxa27x_keypad.c +++ b/drivers/input/keyboard/pxa27x_keypad.c | |||
@@ -368,6 +368,9 @@ static void pxa27x_keypad_config(struct pxa27x_keypad *keypad) | |||
368 | unsigned int mask = 0, direct_key_num = 0; | 368 | unsigned int mask = 0, direct_key_num = 0; |
369 | unsigned long kpc = 0; | 369 | unsigned long kpc = 0; |
370 | 370 | ||
371 | /* clear pending interrupt bit */ | ||
372 | keypad_readl(KPC); | ||
373 | |||
371 | /* enable matrix keys with automatic scan */ | 374 | /* enable matrix keys with automatic scan */ |
372 | if (pdata->matrix_key_rows && pdata->matrix_key_cols) { | 375 | if (pdata->matrix_key_rows && pdata->matrix_key_cols) { |
373 | kpc |= KPC_ASACT | KPC_MIE | KPC_ME | KPC_MS_ALL; | 376 | kpc |= KPC_ASACT | KPC_MIE | KPC_ME | KPC_MS_ALL; |
diff --git a/drivers/input/misc/xen-kbdfront.c b/drivers/input/misc/xen-kbdfront.c index 02ca8680ea5b..6f7d99013031 100644 --- a/drivers/input/misc/xen-kbdfront.c +++ b/drivers/input/misc/xen-kbdfront.c | |||
@@ -311,7 +311,6 @@ static void xenkbd_backend_changed(struct xenbus_device *dev, | |||
311 | case XenbusStateReconfiguring: | 311 | case XenbusStateReconfiguring: |
312 | case XenbusStateReconfigured: | 312 | case XenbusStateReconfigured: |
313 | case XenbusStateUnknown: | 313 | case XenbusStateUnknown: |
314 | case XenbusStateClosed: | ||
315 | break; | 314 | break; |
316 | 315 | ||
317 | case XenbusStateInitWait: | 316 | case XenbusStateInitWait: |
@@ -350,6 +349,10 @@ InitWait: | |||
350 | 349 | ||
351 | break; | 350 | break; |
352 | 351 | ||
352 | case XenbusStateClosed: | ||
353 | if (dev->state == XenbusStateClosed) | ||
354 | break; | ||
355 | /* Missed the backend's CLOSING state -- fallthrough */ | ||
353 | case XenbusStateClosing: | 356 | case XenbusStateClosing: |
354 | xenbus_frontend_closed(dev); | 357 | xenbus_frontend_closed(dev); |
355 | break; | 358 | break; |
diff --git a/drivers/input/mouse/bcm5974.c b/drivers/input/mouse/bcm5974.c index 3a78f235fa3e..2baff1b79a55 100644 --- a/drivers/input/mouse/bcm5974.c +++ b/drivers/input/mouse/bcm5974.c | |||
@@ -84,6 +84,10 @@ | |||
84 | #define USB_DEVICE_ID_APPLE_WELLSPRING7_ANSI 0x0262 | 84 | #define USB_DEVICE_ID_APPLE_WELLSPRING7_ANSI 0x0262 |
85 | #define USB_DEVICE_ID_APPLE_WELLSPRING7_ISO 0x0263 | 85 | #define USB_DEVICE_ID_APPLE_WELLSPRING7_ISO 0x0263 |
86 | #define USB_DEVICE_ID_APPLE_WELLSPRING7_JIS 0x0264 | 86 | #define USB_DEVICE_ID_APPLE_WELLSPRING7_JIS 0x0264 |
87 | /* MacbookPro10,2 (unibody, October 2012) */ | ||
88 | #define USB_DEVICE_ID_APPLE_WELLSPRING7A_ANSI 0x0259 | ||
89 | #define USB_DEVICE_ID_APPLE_WELLSPRING7A_ISO 0x025a | ||
90 | #define USB_DEVICE_ID_APPLE_WELLSPRING7A_JIS 0x025b | ||
87 | 91 | ||
88 | #define BCM5974_DEVICE(prod) { \ | 92 | #define BCM5974_DEVICE(prod) { \ |
89 | .match_flags = (USB_DEVICE_ID_MATCH_DEVICE | \ | 93 | .match_flags = (USB_DEVICE_ID_MATCH_DEVICE | \ |
@@ -137,6 +141,10 @@ static const struct usb_device_id bcm5974_table[] = { | |||
137 | BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING7_ANSI), | 141 | BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING7_ANSI), |
138 | BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING7_ISO), | 142 | BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING7_ISO), |
139 | BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING7_JIS), | 143 | BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING7_JIS), |
144 | /* MacbookPro10,2 */ | ||
145 | BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING7A_ANSI), | ||
146 | BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING7A_ISO), | ||
147 | BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING7A_JIS), | ||
140 | /* Terminating entry */ | 148 | /* Terminating entry */ |
141 | {} | 149 | {} |
142 | }; | 150 | }; |
@@ -379,6 +387,19 @@ static const struct bcm5974_config bcm5974_config_table[] = { | |||
379 | { SN_COORD, -150, 6730 }, | 387 | { SN_COORD, -150, 6730 }, |
380 | { SN_ORIENT, -MAX_FINGER_ORIENTATION, MAX_FINGER_ORIENTATION } | 388 | { SN_ORIENT, -MAX_FINGER_ORIENTATION, MAX_FINGER_ORIENTATION } |
381 | }, | 389 | }, |
390 | { | ||
391 | USB_DEVICE_ID_APPLE_WELLSPRING7A_ANSI, | ||
392 | USB_DEVICE_ID_APPLE_WELLSPRING7A_ISO, | ||
393 | USB_DEVICE_ID_APPLE_WELLSPRING7A_JIS, | ||
394 | HAS_INTEGRATED_BUTTON, | ||
395 | 0x84, sizeof(struct bt_data), | ||
396 | 0x81, TYPE2, FINGER_TYPE2, FINGER_TYPE2 + SIZEOF_ALL_FINGERS, | ||
397 | { SN_PRESSURE, 0, 300 }, | ||
398 | { SN_WIDTH, 0, 2048 }, | ||
399 | { SN_COORD, -4750, 5280 }, | ||
400 | { SN_COORD, -150, 6730 }, | ||
401 | { SN_ORIENT, -MAX_FINGER_ORIENTATION, MAX_FINGER_ORIENTATION } | ||
402 | }, | ||
382 | {} | 403 | {} |
383 | }; | 404 | }; |
384 | 405 | ||
diff --git a/drivers/input/mousedev.c b/drivers/input/mousedev.c index a1b4c37956b2..8f02e3d0e712 100644 --- a/drivers/input/mousedev.c +++ b/drivers/input/mousedev.c | |||
@@ -523,7 +523,6 @@ static int mousedev_release(struct inode *inode, struct file *file) | |||
523 | kfree(client); | 523 | kfree(client); |
524 | 524 | ||
525 | mousedev_close_device(mousedev); | 525 | mousedev_close_device(mousedev); |
526 | put_device(&mousedev->dev); | ||
527 | 526 | ||
528 | return 0; | 527 | return 0; |
529 | } | 528 | } |
@@ -558,7 +557,6 @@ static int mousedev_open(struct inode *inode, struct file *file) | |||
558 | file->private_data = client; | 557 | file->private_data = client; |
559 | nonseekable_open(inode, file); | 558 | nonseekable_open(inode, file); |
560 | 559 | ||
561 | get_device(&mousedev->dev); | ||
562 | return 0; | 560 | return 0; |
563 | 561 | ||
564 | err_free_client: | 562 | err_free_client: |
@@ -892,6 +890,7 @@ static struct mousedev *mousedev_create(struct input_dev *dev, | |||
892 | } | 890 | } |
893 | 891 | ||
894 | cdev_init(&mousedev->cdev, &mousedev_fops); | 892 | cdev_init(&mousedev->cdev, &mousedev_fops); |
893 | mousedev->cdev.kobj.parent = &mousedev->dev.kobj; | ||
895 | error = cdev_add(&mousedev->cdev, mousedev->dev.devt, 1); | 894 | error = cdev_add(&mousedev->cdev, mousedev->dev.devt, 1); |
896 | if (error) | 895 | if (error) |
897 | goto err_unregister_handle; | 896 | goto err_unregister_handle; |
diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c index 9edf9806cff9..858ad446de91 100644 --- a/drivers/input/tablet/wacom_sys.c +++ b/drivers/input/tablet/wacom_sys.c | |||
@@ -391,7 +391,7 @@ static int wacom_parse_hid(struct usb_interface *intf, | |||
391 | features->pktlen = WACOM_PKGLEN_TPC2FG; | 391 | features->pktlen = WACOM_PKGLEN_TPC2FG; |
392 | } | 392 | } |
393 | 393 | ||
394 | if (features->type == MTSCREEN) | 394 | if (features->type == MTSCREEN || features->type == WACOM_24HDT) |
395 | features->pktlen = WACOM_PKGLEN_MTOUCH; | 395 | features->pktlen = WACOM_PKGLEN_MTOUCH; |
396 | 396 | ||
397 | if (features->type == BAMBOO_PT) { | 397 | if (features->type == BAMBOO_PT) { |
@@ -402,6 +402,14 @@ static int wacom_parse_hid(struct usb_interface *intf, | |||
402 | features->x_max = | 402 | features->x_max = |
403 | get_unaligned_le16(&report[i + 8]); | 403 | get_unaligned_le16(&report[i + 8]); |
404 | i += 15; | 404 | i += 15; |
405 | } else if (features->type == WACOM_24HDT) { | ||
406 | features->x_max = | ||
407 | get_unaligned_le16(&report[i + 3]); | ||
408 | features->x_phy = | ||
409 | get_unaligned_le16(&report[i + 8]); | ||
410 | features->unit = report[i - 1]; | ||
411 | features->unitExpo = report[i - 3]; | ||
412 | i += 12; | ||
405 | } else { | 413 | } else { |
406 | features->x_max = | 414 | features->x_max = |
407 | get_unaligned_le16(&report[i + 3]); | 415 | get_unaligned_le16(&report[i + 3]); |
@@ -434,6 +442,12 @@ static int wacom_parse_hid(struct usb_interface *intf, | |||
434 | features->y_phy = | 442 | features->y_phy = |
435 | get_unaligned_le16(&report[i + 6]); | 443 | get_unaligned_le16(&report[i + 6]); |
436 | i += 7; | 444 | i += 7; |
445 | } else if (type == WACOM_24HDT) { | ||
446 | features->y_max = | ||
447 | get_unaligned_le16(&report[i + 3]); | ||
448 | features->y_phy = | ||
449 | get_unaligned_le16(&report[i - 2]); | ||
450 | i += 7; | ||
437 | } else if (type == BAMBOO_PT) { | 451 | } else if (type == BAMBOO_PT) { |
438 | features->y_phy = | 452 | features->y_phy = |
439 | get_unaligned_le16(&report[i + 3]); | 453 | get_unaligned_le16(&report[i + 3]); |
@@ -541,6 +555,9 @@ static int wacom_query_tablet_data(struct usb_interface *intf, struct wacom_feat | |||
541 | /* MT Tablet PC touch */ | 555 | /* MT Tablet PC touch */ |
542 | return wacom_set_device_mode(intf, 3, 4, 4); | 556 | return wacom_set_device_mode(intf, 3, 4, 4); |
543 | } | 557 | } |
558 | else if (features->type == WACOM_24HDT) { | ||
559 | return wacom_set_device_mode(intf, 18, 3, 2); | ||
560 | } | ||
544 | } else if (features->device_type == BTN_TOOL_PEN) { | 561 | } else if (features->device_type == BTN_TOOL_PEN) { |
545 | if (features->type <= BAMBOO_PT && features->type != WIRELESS) { | 562 | if (features->type <= BAMBOO_PT && features->type != WIRELESS) { |
546 | return wacom_set_device_mode(intf, 2, 2, 2); | 563 | return wacom_set_device_mode(intf, 2, 2, 2); |
@@ -613,6 +630,30 @@ struct wacom_usbdev_data { | |||
613 | static LIST_HEAD(wacom_udev_list); | 630 | static LIST_HEAD(wacom_udev_list); |
614 | static DEFINE_MUTEX(wacom_udev_list_lock); | 631 | static DEFINE_MUTEX(wacom_udev_list_lock); |
615 | 632 | ||
633 | static struct usb_device *wacom_get_sibling(struct usb_device *dev, int vendor, int product) | ||
634 | { | ||
635 | int port1; | ||
636 | struct usb_device *sibling; | ||
637 | |||
638 | if (vendor == 0 && product == 0) | ||
639 | return dev; | ||
640 | |||
641 | if (dev->parent == NULL) | ||
642 | return NULL; | ||
643 | |||
644 | usb_hub_for_each_child(dev->parent, port1, sibling) { | ||
645 | struct usb_device_descriptor *d; | ||
646 | if (sibling == NULL) | ||
647 | continue; | ||
648 | |||
649 | d = &sibling->descriptor; | ||
650 | if (d->idVendor == vendor && d->idProduct == product) | ||
651 | return sibling; | ||
652 | } | ||
653 | |||
654 | return NULL; | ||
655 | } | ||
656 | |||
616 | static struct wacom_usbdev_data *wacom_get_usbdev_data(struct usb_device *dev) | 657 | static struct wacom_usbdev_data *wacom_get_usbdev_data(struct usb_device *dev) |
617 | { | 658 | { |
618 | struct wacom_usbdev_data *data; | 659 | struct wacom_usbdev_data *data; |
@@ -1257,13 +1298,19 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i | |||
1257 | strlcpy(wacom_wac->name, features->name, sizeof(wacom_wac->name)); | 1298 | strlcpy(wacom_wac->name, features->name, sizeof(wacom_wac->name)); |
1258 | 1299 | ||
1259 | if (features->quirks & WACOM_QUIRK_MULTI_INPUT) { | 1300 | if (features->quirks & WACOM_QUIRK_MULTI_INPUT) { |
1301 | struct usb_device *other_dev; | ||
1302 | |||
1260 | /* Append the device type to the name */ | 1303 | /* Append the device type to the name */ |
1261 | strlcat(wacom_wac->name, | 1304 | strlcat(wacom_wac->name, |
1262 | features->device_type == BTN_TOOL_PEN ? | 1305 | features->device_type == BTN_TOOL_PEN ? |
1263 | " Pen" : " Finger", | 1306 | " Pen" : " Finger", |
1264 | sizeof(wacom_wac->name)); | 1307 | sizeof(wacom_wac->name)); |
1265 | 1308 | ||
1266 | error = wacom_add_shared_data(wacom_wac, dev); | 1309 | |
1310 | other_dev = wacom_get_sibling(dev, features->oVid, features->oPid); | ||
1311 | if (other_dev == NULL || wacom_get_usbdev_data(other_dev) == NULL) | ||
1312 | other_dev = dev; | ||
1313 | error = wacom_add_shared_data(wacom_wac, other_dev); | ||
1267 | if (error) | 1314 | if (error) |
1268 | goto fail3; | 1315 | goto fail3; |
1269 | } | 1316 | } |
diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c index c3468c8dbd89..0a67031ffc13 100644 --- a/drivers/input/tablet/wacom_wac.c +++ b/drivers/input/tablet/wacom_wac.c | |||
@@ -806,6 +806,70 @@ static int find_slot_from_contactid(struct wacom_wac *wacom, int contactid) | |||
806 | return -1; | 806 | return -1; |
807 | } | 807 | } |
808 | 808 | ||
809 | static int int_dist(int x1, int y1, int x2, int y2) | ||
810 | { | ||
811 | int x = x2 - x1; | ||
812 | int y = y2 - y1; | ||
813 | |||
814 | return int_sqrt(x*x + y*y); | ||
815 | } | ||
816 | |||
817 | static int wacom_24hdt_irq(struct wacom_wac *wacom) | ||
818 | { | ||
819 | struct input_dev *input = wacom->input; | ||
820 | char *data = wacom->data; | ||
821 | int i; | ||
822 | int current_num_contacts = data[61]; | ||
823 | int contacts_to_send = 0; | ||
824 | |||
825 | /* | ||
826 | * First packet resets the counter since only the first | ||
827 | * packet in series will have non-zero current_num_contacts. | ||
828 | */ | ||
829 | if (current_num_contacts) | ||
830 | wacom->num_contacts_left = current_num_contacts; | ||
831 | |||
832 | /* There are at most 4 contacts per packet */ | ||
833 | contacts_to_send = min(4, wacom->num_contacts_left); | ||
834 | |||
835 | for (i = 0; i < contacts_to_send; i++) { | ||
836 | int offset = (WACOM_BYTES_PER_24HDT_PACKET * i) + 1; | ||
837 | bool touch = data[offset] & 0x1 && !wacom->shared->stylus_in_proximity; | ||
838 | int id = data[offset + 1]; | ||
839 | int slot = find_slot_from_contactid(wacom, id); | ||
840 | |||
841 | if (slot < 0) | ||
842 | continue; | ||
843 | input_mt_slot(input, slot); | ||
844 | input_mt_report_slot_state(input, MT_TOOL_FINGER, touch); | ||
845 | |||
846 | if (touch) { | ||
847 | int t_x = le16_to_cpup((__le16 *)&data[offset + 2]); | ||
848 | int c_x = le16_to_cpup((__le16 *)&data[offset + 4]); | ||
849 | int t_y = le16_to_cpup((__le16 *)&data[offset + 6]); | ||
850 | int c_y = le16_to_cpup((__le16 *)&data[offset + 8]); | ||
851 | int w = le16_to_cpup((__le16 *)&data[offset + 10]); | ||
852 | int h = le16_to_cpup((__le16 *)&data[offset + 12]); | ||
853 | |||
854 | input_report_abs(input, ABS_MT_POSITION_X, t_x); | ||
855 | input_report_abs(input, ABS_MT_POSITION_Y, t_y); | ||
856 | input_report_abs(input, ABS_MT_TOUCH_MAJOR, min(w,h)); | ||
857 | input_report_abs(input, ABS_MT_WIDTH_MAJOR, min(w, h) + int_dist(t_x, t_y, c_x, c_y)); | ||
858 | input_report_abs(input, ABS_MT_WIDTH_MINOR, min(w, h)); | ||
859 | input_report_abs(input, ABS_MT_ORIENTATION, w > h); | ||
860 | } | ||
861 | wacom->slots[slot] = touch ? id : -1; | ||
862 | } | ||
863 | |||
864 | input_mt_report_pointer_emulation(input, true); | ||
865 | |||
866 | wacom->num_contacts_left -= contacts_to_send; | ||
867 | if (wacom->num_contacts_left <= 0) | ||
868 | wacom->num_contacts_left = 0; | ||
869 | |||
870 | return 1; | ||
871 | } | ||
872 | |||
809 | static int wacom_mt_touch(struct wacom_wac *wacom) | 873 | static int wacom_mt_touch(struct wacom_wac *wacom) |
810 | { | 874 | { |
811 | struct input_dev *input = wacom->input; | 875 | struct input_dev *input = wacom->input; |
@@ -1255,6 +1319,10 @@ void wacom_wac_irq(struct wacom_wac *wacom_wac, size_t len) | |||
1255 | sync = wacom_intuos_irq(wacom_wac); | 1319 | sync = wacom_intuos_irq(wacom_wac); |
1256 | break; | 1320 | break; |
1257 | 1321 | ||
1322 | case WACOM_24HDT: | ||
1323 | sync = wacom_24hdt_irq(wacom_wac); | ||
1324 | break; | ||
1325 | |||
1258 | case INTUOS5S: | 1326 | case INTUOS5S: |
1259 | case INTUOS5: | 1327 | case INTUOS5: |
1260 | case INTUOS5L: | 1328 | case INTUOS5L: |
@@ -1340,7 +1408,8 @@ void wacom_setup_device_quirks(struct wacom_features *features) | |||
1340 | 1408 | ||
1341 | /* these device have multiple inputs */ | 1409 | /* these device have multiple inputs */ |
1342 | if (features->type >= WIRELESS || | 1410 | if (features->type >= WIRELESS || |
1343 | (features->type >= INTUOS5S && features->type <= INTUOS5L)) | 1411 | (features->type >= INTUOS5S && features->type <= INTUOS5L) || |
1412 | (features->oVid && features->oPid)) | ||
1344 | features->quirks |= WACOM_QUIRK_MULTI_INPUT; | 1413 | features->quirks |= WACOM_QUIRK_MULTI_INPUT; |
1345 | 1414 | ||
1346 | /* quirk for bamboo touch with 2 low res touches */ | 1415 | /* quirk for bamboo touch with 2 low res touches */ |
@@ -1449,6 +1518,9 @@ int wacom_setup_input_capabilities(struct input_dev *input_dev, | |||
1449 | 1518 | ||
1450 | input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0); | 1519 | input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0); |
1451 | input_set_abs_params(input_dev, ABS_THROTTLE, 0, 71, 0, 0); | 1520 | input_set_abs_params(input_dev, ABS_THROTTLE, 0, 71, 0, 0); |
1521 | |||
1522 | __set_bit(INPUT_PROP_DIRECT, input_dev->propbit); | ||
1523 | |||
1452 | wacom_setup_cintiq(wacom_wac); | 1524 | wacom_setup_cintiq(wacom_wac); |
1453 | break; | 1525 | break; |
1454 | 1526 | ||
@@ -1575,6 +1647,15 @@ int wacom_setup_input_capabilities(struct input_dev *input_dev, | |||
1575 | __set_bit(INPUT_PROP_POINTER, input_dev->propbit); | 1647 | __set_bit(INPUT_PROP_POINTER, input_dev->propbit); |
1576 | break; | 1648 | break; |
1577 | 1649 | ||
1650 | case WACOM_24HDT: | ||
1651 | if (features->device_type == BTN_TOOL_FINGER) { | ||
1652 | input_set_abs_params(input_dev, ABS_MT_TOUCH_MAJOR, 0, features->x_max, 0, 0); | ||
1653 | input_set_abs_params(input_dev, ABS_MT_WIDTH_MAJOR, 0, features->x_max, 0, 0); | ||
1654 | input_set_abs_params(input_dev, ABS_MT_WIDTH_MINOR, 0, features->y_max, 0, 0); | ||
1655 | input_set_abs_params(input_dev, ABS_MT_ORIENTATION, 0, 1, 0, 0); | ||
1656 | } | ||
1657 | /* fall through */ | ||
1658 | |||
1578 | case MTSCREEN: | 1659 | case MTSCREEN: |
1579 | if (features->device_type == BTN_TOOL_FINGER) { | 1660 | if (features->device_type == BTN_TOOL_FINGER) { |
1580 | wacom_wac->slots = kmalloc(features->touch_max * | 1661 | wacom_wac->slots = kmalloc(features->touch_max * |
@@ -1869,8 +1950,11 @@ static const struct wacom_features wacom_features_0xF4 = | |||
1869 | { "Wacom Cintiq 24HD", WACOM_PKGLEN_INTUOS, 104480, 65600, 2047, | 1950 | { "Wacom Cintiq 24HD", WACOM_PKGLEN_INTUOS, 104480, 65600, 2047, |
1870 | 63, WACOM_24HD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; | 1951 | 63, WACOM_24HD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; |
1871 | static const struct wacom_features wacom_features_0xF8 = | 1952 | static const struct wacom_features wacom_features_0xF8 = |
1872 | { "Wacom Cintiq 24HD touch", WACOM_PKGLEN_INTUOS, 104480, 65600, 2047, | 1953 | { "Wacom Cintiq 24HD touch", WACOM_PKGLEN_INTUOS, 104480, 65600, 2047, /* Pen */ |
1873 | 63, WACOM_24HD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; | 1954 | 63, WACOM_24HD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, .oVid = USB_VENDOR_ID_WACOM, .oPid = 0xf6 }; |
1955 | static const struct wacom_features wacom_features_0xF6 = | ||
1956 | { "Wacom Cintiq 24HD touch", .type = WACOM_24HDT, /* Touch */ | ||
1957 | .oVid = USB_VENDOR_ID_WACOM, .oPid = 0xf8, .touch_max = 10 }; | ||
1874 | static const struct wacom_features wacom_features_0x3F = | 1958 | static const struct wacom_features wacom_features_0x3F = |
1875 | { "Wacom Cintiq 21UX", WACOM_PKGLEN_INTUOS, 87200, 65600, 1023, | 1959 | { "Wacom Cintiq 21UX", WACOM_PKGLEN_INTUOS, 87200, 65600, 1023, |
1876 | 63, CINTIQ, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; | 1960 | 63, CINTIQ, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; |
@@ -2113,6 +2197,7 @@ const struct usb_device_id wacom_ids[] = { | |||
2113 | { USB_DEVICE_WACOM(0x47) }, | 2197 | { USB_DEVICE_WACOM(0x47) }, |
2114 | { USB_DEVICE_WACOM(0xF4) }, | 2198 | { USB_DEVICE_WACOM(0xF4) }, |
2115 | { USB_DEVICE_WACOM(0xF8) }, | 2199 | { USB_DEVICE_WACOM(0xF8) }, |
2200 | { USB_DEVICE_WACOM(0xF6) }, | ||
2116 | { USB_DEVICE_WACOM(0xFA) }, | 2201 | { USB_DEVICE_WACOM(0xFA) }, |
2117 | { USB_DEVICE_LENOVO(0x6004) }, | 2202 | { USB_DEVICE_LENOVO(0x6004) }, |
2118 | { } | 2203 | { } |
diff --git a/drivers/input/tablet/wacom_wac.h b/drivers/input/tablet/wacom_wac.h index 96c185cc301e..345f1e76975e 100644 --- a/drivers/input/tablet/wacom_wac.h +++ b/drivers/input/tablet/wacom_wac.h | |||
@@ -29,6 +29,7 @@ | |||
29 | 29 | ||
30 | /* wacom data size per MT contact */ | 30 | /* wacom data size per MT contact */ |
31 | #define WACOM_BYTES_PER_MT_PACKET 11 | 31 | #define WACOM_BYTES_PER_MT_PACKET 11 |
32 | #define WACOM_BYTES_PER_24HDT_PACKET 14 | ||
32 | 33 | ||
33 | /* device IDs */ | 34 | /* device IDs */ |
34 | #define STYLUS_DEVICE_ID 0x02 | 35 | #define STYLUS_DEVICE_ID 0x02 |
@@ -49,6 +50,7 @@ | |||
49 | #define WACOM_REPORT_TPCHID 15 | 50 | #define WACOM_REPORT_TPCHID 15 |
50 | #define WACOM_REPORT_TPCST 16 | 51 | #define WACOM_REPORT_TPCST 16 |
51 | #define WACOM_REPORT_TPC1FGE 18 | 52 | #define WACOM_REPORT_TPC1FGE 18 |
53 | #define WACOM_REPORT_24HDT 1 | ||
52 | 54 | ||
53 | /* device quirks */ | 55 | /* device quirks */ |
54 | #define WACOM_QUIRK_MULTI_INPUT 0x0001 | 56 | #define WACOM_QUIRK_MULTI_INPUT 0x0001 |
@@ -81,6 +83,7 @@ enum { | |||
81 | WACOM_MO, | 83 | WACOM_MO, |
82 | WIRELESS, | 84 | WIRELESS, |
83 | BAMBOO_PT, | 85 | BAMBOO_PT, |
86 | WACOM_24HDT, | ||
84 | TABLETPC, /* add new TPC below */ | 87 | TABLETPC, /* add new TPC below */ |
85 | TABLETPCE, | 88 | TABLETPCE, |
86 | TABLETPC2FG, | 89 | TABLETPC2FG, |
@@ -109,6 +112,8 @@ struct wacom_features { | |||
109 | int distance_fuzz; | 112 | int distance_fuzz; |
110 | unsigned quirks; | 113 | unsigned quirks; |
111 | unsigned touch_max; | 114 | unsigned touch_max; |
115 | int oVid; | ||
116 | int oPid; | ||
112 | }; | 117 | }; |
113 | 118 | ||
114 | struct wacom_shared { | 119 | struct wacom_shared { |
diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig index 1ba232cbc09d..f7668b24c378 100644 --- a/drivers/input/touchscreen/Kconfig +++ b/drivers/input/touchscreen/Kconfig | |||
@@ -239,7 +239,7 @@ config TOUCHSCREEN_EETI | |||
239 | 239 | ||
240 | config TOUCHSCREEN_EGALAX | 240 | config TOUCHSCREEN_EGALAX |
241 | tristate "EETI eGalax multi-touch panel support" | 241 | tristate "EETI eGalax multi-touch panel support" |
242 | depends on I2C | 242 | depends on I2C && OF |
243 | help | 243 | help |
244 | Say Y here to enable support for I2C connected EETI | 244 | Say Y here to enable support for I2C connected EETI |
245 | eGalax multi-touch panels. | 245 | eGalax multi-touch panels. |
diff --git a/drivers/input/touchscreen/egalax_ts.c b/drivers/input/touchscreen/egalax_ts.c index c1e3460f1195..13fa62fdfb0b 100644 --- a/drivers/input/touchscreen/egalax_ts.c +++ b/drivers/input/touchscreen/egalax_ts.c | |||
@@ -28,6 +28,7 @@ | |||
28 | #include <linux/slab.h> | 28 | #include <linux/slab.h> |
29 | #include <linux/bitops.h> | 29 | #include <linux/bitops.h> |
30 | #include <linux/input/mt.h> | 30 | #include <linux/input/mt.h> |
31 | #include <linux/of_gpio.h> | ||
31 | 32 | ||
32 | /* | 33 | /* |
33 | * Mouse Mode: some panel may configure the controller to mouse mode, | 34 | * Mouse Mode: some panel may configure the controller to mouse mode, |
@@ -122,9 +123,17 @@ static irqreturn_t egalax_ts_interrupt(int irq, void *dev_id) | |||
122 | /* wake up controller by an falling edge of interrupt gpio. */ | 123 | /* wake up controller by an falling edge of interrupt gpio. */ |
123 | static int egalax_wake_up_device(struct i2c_client *client) | 124 | static int egalax_wake_up_device(struct i2c_client *client) |
124 | { | 125 | { |
125 | int gpio = irq_to_gpio(client->irq); | 126 | struct device_node *np = client->dev.of_node; |
127 | int gpio; | ||
126 | int ret; | 128 | int ret; |
127 | 129 | ||
130 | if (!np) | ||
131 | return -ENODEV; | ||
132 | |||
133 | gpio = of_get_named_gpio(np, "wakeup-gpios", 0); | ||
134 | if (!gpio_is_valid(gpio)) | ||
135 | return -ENODEV; | ||
136 | |||
128 | ret = gpio_request(gpio, "egalax_irq"); | 137 | ret = gpio_request(gpio, "egalax_irq"); |
129 | if (ret < 0) { | 138 | if (ret < 0) { |
130 | dev_err(&client->dev, | 139 | dev_err(&client->dev, |
@@ -181,7 +190,11 @@ static int __devinit egalax_ts_probe(struct i2c_client *client, | |||
181 | ts->input_dev = input_dev; | 190 | ts->input_dev = input_dev; |
182 | 191 | ||
183 | /* controller may be in sleep, wake it up. */ | 192 | /* controller may be in sleep, wake it up. */ |
184 | egalax_wake_up_device(client); | 193 | error = egalax_wake_up_device(client); |
194 | if (error) { | ||
195 | dev_err(&client->dev, "Failed to wake up the controller\n"); | ||
196 | goto err_free_dev; | ||
197 | } | ||
185 | 198 | ||
186 | ret = egalax_firmware_version(client); | 199 | ret = egalax_firmware_version(client); |
187 | if (ret < 0) { | 200 | if (ret < 0) { |
@@ -274,11 +287,17 @@ static int egalax_ts_resume(struct device *dev) | |||
274 | 287 | ||
275 | static SIMPLE_DEV_PM_OPS(egalax_ts_pm_ops, egalax_ts_suspend, egalax_ts_resume); | 288 | static SIMPLE_DEV_PM_OPS(egalax_ts_pm_ops, egalax_ts_suspend, egalax_ts_resume); |
276 | 289 | ||
290 | static struct of_device_id egalax_ts_dt_ids[] = { | ||
291 | { .compatible = "eeti,egalax_ts" }, | ||
292 | { /* sentinel */ } | ||
293 | }; | ||
294 | |||
277 | static struct i2c_driver egalax_ts_driver = { | 295 | static struct i2c_driver egalax_ts_driver = { |
278 | .driver = { | 296 | .driver = { |
279 | .name = "egalax_ts", | 297 | .name = "egalax_ts", |
280 | .owner = THIS_MODULE, | 298 | .owner = THIS_MODULE, |
281 | .pm = &egalax_ts_pm_ops, | 299 | .pm = &egalax_ts_pm_ops, |
300 | .of_match_table = of_match_ptr(egalax_ts_dt_ids), | ||
282 | }, | 301 | }, |
283 | .id_table = egalax_ts_id, | 302 | .id_table = egalax_ts_id, |
284 | .probe = egalax_ts_probe, | 303 | .probe = egalax_ts_probe, |
diff --git a/drivers/input/touchscreen/tsc40.c b/drivers/input/touchscreen/tsc40.c index 63209aaa55f0..eb96f168fb9d 100644 --- a/drivers/input/touchscreen/tsc40.c +++ b/drivers/input/touchscreen/tsc40.c | |||
@@ -107,7 +107,6 @@ static int tsc_connect(struct serio *serio, struct serio_driver *drv) | |||
107 | __set_bit(BTN_TOUCH, input_dev->keybit); | 107 | __set_bit(BTN_TOUCH, input_dev->keybit); |
108 | input_set_abs_params(ptsc->dev, ABS_X, 0, 0x3ff, 0, 0); | 108 | input_set_abs_params(ptsc->dev, ABS_X, 0, 0x3ff, 0, 0); |
109 | input_set_abs_params(ptsc->dev, ABS_Y, 0, 0x3ff, 0, 0); | 109 | input_set_abs_params(ptsc->dev, ABS_Y, 0, 0x3ff, 0, 0); |
110 | input_set_abs_params(ptsc->dev, ABS_PRESSURE, 0, 0, 0, 0); | ||
111 | 110 | ||
112 | serio_set_drvdata(serio, ptsc); | 111 | serio_set_drvdata(serio, ptsc); |
113 | 112 | ||
diff --git a/drivers/iommu/amd_iommu_init.c b/drivers/iommu/amd_iommu_init.c index 18b0d99bd4d6..81837b0710a9 100644 --- a/drivers/iommu/amd_iommu_init.c +++ b/drivers/iommu/amd_iommu_init.c | |||
@@ -1599,21 +1599,46 @@ static void __init free_on_init_error(void) | |||
1599 | #endif | 1599 | #endif |
1600 | } | 1600 | } |
1601 | 1601 | ||
1602 | /* SB IOAPIC is always on this device in AMD systems */ | ||
1603 | #define IOAPIC_SB_DEVID ((0x00 << 8) | PCI_DEVFN(0x14, 0)) | ||
1604 | |||
1602 | static bool __init check_ioapic_information(void) | 1605 | static bool __init check_ioapic_information(void) |
1603 | { | 1606 | { |
1607 | bool ret, has_sb_ioapic; | ||
1604 | int idx; | 1608 | int idx; |
1605 | 1609 | ||
1606 | for (idx = 0; idx < nr_ioapics; idx++) { | 1610 | has_sb_ioapic = false; |
1607 | int id = mpc_ioapic_id(idx); | 1611 | ret = false; |
1608 | 1612 | ||
1609 | if (get_ioapic_devid(id) < 0) { | 1613 | for (idx = 0; idx < nr_ioapics; idx++) { |
1610 | pr_err(FW_BUG "AMD-Vi: IO-APIC[%d] not in IVRS table\n", id); | 1614 | int devid, id = mpc_ioapic_id(idx); |
1611 | pr_err("AMD-Vi: Disabling interrupt remapping due to BIOS Bug\n"); | 1615 | |
1612 | return false; | 1616 | devid = get_ioapic_devid(id); |
1617 | if (devid < 0) { | ||
1618 | pr_err(FW_BUG "AMD-Vi: IOAPIC[%d] not in IVRS table\n", id); | ||
1619 | ret = false; | ||
1620 | } else if (devid == IOAPIC_SB_DEVID) { | ||
1621 | has_sb_ioapic = true; | ||
1622 | ret = true; | ||
1613 | } | 1623 | } |
1614 | } | 1624 | } |
1615 | 1625 | ||
1616 | return true; | 1626 | if (!has_sb_ioapic) { |
1627 | /* | ||
1628 | * We expect the SB IOAPIC to be listed in the IVRS | ||
1629 | * table. The system timer is connected to the SB IOAPIC | ||
1630 | * and if we don't have it in the list the system will | ||
1631 | * panic at boot time. This situation usually happens | ||
1632 | * when the BIOS is buggy and provides us the wrong | ||
1633 | * device id for the IOAPIC in the system. | ||
1634 | */ | ||
1635 | pr_err(FW_BUG "AMD-Vi: No southbridge IOAPIC found in IVRS table\n"); | ||
1636 | } | ||
1637 | |||
1638 | if (!ret) | ||
1639 | pr_err("AMD-Vi: Disabling interrupt remapping due to BIOS Bug(s)\n"); | ||
1640 | |||
1641 | return ret; | ||
1617 | } | 1642 | } |
1618 | 1643 | ||
1619 | static void __init free_dma_resources(void) | 1644 | static void __init free_dma_resources(void) |
diff --git a/drivers/iommu/tegra-smmu.c b/drivers/iommu/tegra-smmu.c index 0b4d62e0c645..a649f146d17b 100644 --- a/drivers/iommu/tegra-smmu.c +++ b/drivers/iommu/tegra-smmu.c | |||
@@ -200,7 +200,7 @@ enum { | |||
200 | 200 | ||
201 | #define SMMU_ADDR_TO_PFN(addr) ((addr) >> 12) | 201 | #define SMMU_ADDR_TO_PFN(addr) ((addr) >> 12) |
202 | #define SMMU_ADDR_TO_PDN(addr) ((addr) >> 22) | 202 | #define SMMU_ADDR_TO_PDN(addr) ((addr) >> 22) |
203 | #define SMMU_PDN_TO_ADDR(addr) ((pdn) << 22) | 203 | #define SMMU_PDN_TO_ADDR(pdn) ((pdn) << 22) |
204 | 204 | ||
205 | #define _READABLE (1 << SMMU_PTB_DATA_ASID_READABLE_SHIFT) | 205 | #define _READABLE (1 << SMMU_PTB_DATA_ASID_READABLE_SHIFT) |
206 | #define _WRITABLE (1 << SMMU_PTB_DATA_ASID_WRITABLE_SHIFT) | 206 | #define _WRITABLE (1 << SMMU_PTB_DATA_ASID_WRITABLE_SHIFT) |
diff --git a/drivers/isdn/gigaset/bas-gigaset.c b/drivers/isdn/gigaset/bas-gigaset.c index 527588708948..c44950d3eb7b 100644 --- a/drivers/isdn/gigaset/bas-gigaset.c +++ b/drivers/isdn/gigaset/bas-gigaset.c | |||
@@ -617,7 +617,13 @@ static void int_in_work(struct work_struct *work) | |||
617 | if (rc == 0) | 617 | if (rc == 0) |
618 | /* success, resubmit interrupt read URB */ | 618 | /* success, resubmit interrupt read URB */ |
619 | rc = usb_submit_urb(urb, GFP_ATOMIC); | 619 | rc = usb_submit_urb(urb, GFP_ATOMIC); |
620 | if (rc != 0 && rc != -ENODEV) { | 620 | |
621 | switch (rc) { | ||
622 | case 0: /* success */ | ||
623 | case -ENODEV: /* device gone */ | ||
624 | case -EINVAL: /* URB already resubmitted, or terminal badness */ | ||
625 | break; | ||
626 | default: /* failure: try to recover by resetting the device */ | ||
621 | dev_err(cs->dev, "clear halt failed: %s\n", get_usb_rcmsg(rc)); | 627 | dev_err(cs->dev, "clear halt failed: %s\n", get_usb_rcmsg(rc)); |
622 | rc = usb_lock_device_for_reset(ucs->udev, ucs->interface); | 628 | rc = usb_lock_device_for_reset(ucs->udev, ucs->interface); |
623 | if (rc == 0) { | 629 | if (rc == 0) { |
@@ -2442,7 +2448,9 @@ static void gigaset_disconnect(struct usb_interface *interface) | |||
2442 | } | 2448 | } |
2443 | 2449 | ||
2444 | /* gigaset_suspend | 2450 | /* gigaset_suspend |
2445 | * This function is called before the USB connection is suspended. | 2451 | * This function is called before the USB connection is suspended |
2452 | * or before the USB device is reset. | ||
2453 | * In the latter case, message == PMSG_ON. | ||
2446 | */ | 2454 | */ |
2447 | static int gigaset_suspend(struct usb_interface *intf, pm_message_t message) | 2455 | static int gigaset_suspend(struct usb_interface *intf, pm_message_t message) |
2448 | { | 2456 | { |
@@ -2498,7 +2506,12 @@ static int gigaset_suspend(struct usb_interface *intf, pm_message_t message) | |||
2498 | del_timer_sync(&ucs->timer_atrdy); | 2506 | del_timer_sync(&ucs->timer_atrdy); |
2499 | del_timer_sync(&ucs->timer_cmd_in); | 2507 | del_timer_sync(&ucs->timer_cmd_in); |
2500 | del_timer_sync(&ucs->timer_int_in); | 2508 | del_timer_sync(&ucs->timer_int_in); |
2501 | cancel_work_sync(&ucs->int_in_wq); | 2509 | |
2510 | /* don't try to cancel int_in_wq from within reset as it | ||
2511 | * might be the one requesting the reset | ||
2512 | */ | ||
2513 | if (message.event != PM_EVENT_ON) | ||
2514 | cancel_work_sync(&ucs->int_in_wq); | ||
2502 | 2515 | ||
2503 | gig_dbg(DEBUG_SUSPEND, "suspend complete"); | 2516 | gig_dbg(DEBUG_SUSPEND, "suspend complete"); |
2504 | return 0; | 2517 | return 0; |
diff --git a/drivers/md/faulty.c b/drivers/md/faulty.c index 45135f69509c..5e7dc772f5de 100644 --- a/drivers/md/faulty.c +++ b/drivers/md/faulty.c | |||
@@ -315,8 +315,11 @@ static int run(struct mddev *mddev) | |||
315 | } | 315 | } |
316 | conf->nfaults = 0; | 316 | conf->nfaults = 0; |
317 | 317 | ||
318 | rdev_for_each(rdev, mddev) | 318 | rdev_for_each(rdev, mddev) { |
319 | conf->rdev = rdev; | 319 | conf->rdev = rdev; |
320 | disk_stack_limits(mddev->gendisk, rdev->bdev, | ||
321 | rdev->data_offset << 9); | ||
322 | } | ||
320 | 323 | ||
321 | md_set_array_sectors(mddev, faulty_size(mddev, 0, 0)); | 324 | md_set_array_sectors(mddev, faulty_size(mddev, 0, 0)); |
322 | mddev->private = conf; | 325 | mddev->private = conf; |
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index 8034fbd6190c..636bae0405e8 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c | |||
@@ -2710,7 +2710,7 @@ static struct r1conf *setup_conf(struct mddev *mddev) | |||
2710 | || disk_idx < 0) | 2710 | || disk_idx < 0) |
2711 | continue; | 2711 | continue; |
2712 | if (test_bit(Replacement, &rdev->flags)) | 2712 | if (test_bit(Replacement, &rdev->flags)) |
2713 | disk = conf->mirrors + conf->raid_disks + disk_idx; | 2713 | disk = conf->mirrors + mddev->raid_disks + disk_idx; |
2714 | else | 2714 | else |
2715 | disk = conf->mirrors + disk_idx; | 2715 | disk = conf->mirrors + disk_idx; |
2716 | 2716 | ||
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c index 906ccbd0f7dc..d1295aff4173 100644 --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c | |||
@@ -1783,7 +1783,7 @@ static int raid10_add_disk(struct mddev *mddev, struct md_rdev *rdev) | |||
1783 | clear_bit(Unmerged, &rdev->flags); | 1783 | clear_bit(Unmerged, &rdev->flags); |
1784 | } | 1784 | } |
1785 | md_integrity_add_rdev(rdev, mddev); | 1785 | md_integrity_add_rdev(rdev, mddev); |
1786 | if (blk_queue_discard(bdev_get_queue(rdev->bdev))) | 1786 | if (mddev->queue && blk_queue_discard(bdev_get_queue(rdev->bdev))) |
1787 | queue_flag_set_unlocked(QUEUE_FLAG_DISCARD, mddev->queue); | 1787 | queue_flag_set_unlocked(QUEUE_FLAG_DISCARD, mddev->queue); |
1788 | 1788 | ||
1789 | print_conf(conf); | 1789 | print_conf(conf); |
@@ -3613,11 +3613,14 @@ static int run(struct mddev *mddev) | |||
3613 | discard_supported = true; | 3613 | discard_supported = true; |
3614 | } | 3614 | } |
3615 | 3615 | ||
3616 | if (discard_supported) | 3616 | if (mddev->queue) { |
3617 | queue_flag_set_unlocked(QUEUE_FLAG_DISCARD, mddev->queue); | 3617 | if (discard_supported) |
3618 | else | 3618 | queue_flag_set_unlocked(QUEUE_FLAG_DISCARD, |
3619 | queue_flag_clear_unlocked(QUEUE_FLAG_DISCARD, mddev->queue); | 3619 | mddev->queue); |
3620 | 3620 | else | |
3621 | queue_flag_clear_unlocked(QUEUE_FLAG_DISCARD, | ||
3622 | mddev->queue); | ||
3623 | } | ||
3621 | /* need to check that every block has at least one working mirror */ | 3624 | /* need to check that every block has at least one working mirror */ |
3622 | if (!enough(conf, -1)) { | 3625 | if (!enough(conf, -1)) { |
3623 | printk(KERN_ERR "md/raid10:%s: not enough operational mirrors.\n", | 3626 | printk(KERN_ERR "md/raid10:%s: not enough operational mirrors.\n", |
diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c index dc15d248443f..ef8d2a080d17 100644 --- a/drivers/net/bonding/bond_sysfs.c +++ b/drivers/net/bonding/bond_sysfs.c | |||
@@ -1060,7 +1060,7 @@ static ssize_t bonding_store_primary(struct device *d, | |||
1060 | goto out; | 1060 | goto out; |
1061 | } | 1061 | } |
1062 | 1062 | ||
1063 | sscanf(buf, "%16s", ifname); /* IFNAMSIZ */ | 1063 | sscanf(buf, "%15s", ifname); /* IFNAMSIZ */ |
1064 | 1064 | ||
1065 | /* check to see if we are clearing primary */ | 1065 | /* check to see if we are clearing primary */ |
1066 | if (!strlen(ifname) || buf[0] == '\n') { | 1066 | if (!strlen(ifname) || buf[0] == '\n') { |
@@ -1237,7 +1237,7 @@ static ssize_t bonding_store_active_slave(struct device *d, | |||
1237 | goto out; | 1237 | goto out; |
1238 | } | 1238 | } |
1239 | 1239 | ||
1240 | sscanf(buf, "%16s", ifname); /* IFNAMSIZ */ | 1240 | sscanf(buf, "%15s", ifname); /* IFNAMSIZ */ |
1241 | 1241 | ||
1242 | /* check to see if we are clearing active */ | 1242 | /* check to see if we are clearing active */ |
1243 | if (!strlen(ifname) || buf[0] == '\n') { | 1243 | if (!strlen(ifname) || buf[0] == '\n') { |
diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c index c78ecfca1e45..a412bf6d73ef 100644 --- a/drivers/net/can/flexcan.c +++ b/drivers/net/can/flexcan.c | |||
@@ -144,9 +144,22 @@ | |||
144 | 144 | ||
145 | #define FLEXCAN_MB_CODE_MASK (0xf0ffffff) | 145 | #define FLEXCAN_MB_CODE_MASK (0xf0ffffff) |
146 | 146 | ||
147 | /* FLEXCAN hardware feature flags */ | 147 | /* |
148 | * FLEXCAN hardware feature flags | ||
149 | * | ||
150 | * Below is some version info we got: | ||
151 | * SOC Version IP-Version Glitch- [TR]WRN_INT | ||
152 | * Filter? connected? | ||
153 | * MX25 FlexCAN2 03.00.00.00 no no | ||
154 | * MX28 FlexCAN2 03.00.04.00 yes yes | ||
155 | * MX35 FlexCAN2 03.00.00.00 no no | ||
156 | * MX53 FlexCAN2 03.00.00.00 yes no | ||
157 | * MX6s FlexCAN3 10.00.12.00 yes yes | ||
158 | * | ||
159 | * Some SOCs do not have the RX_WARN & TX_WARN interrupt line connected. | ||
160 | */ | ||
148 | #define FLEXCAN_HAS_V10_FEATURES BIT(1) /* For core version >= 10 */ | 161 | #define FLEXCAN_HAS_V10_FEATURES BIT(1) /* For core version >= 10 */ |
149 | #define FLEXCAN_HAS_BROKEN_ERR_STATE BIT(2) /* Broken error state handling */ | 162 | #define FLEXCAN_HAS_BROKEN_ERR_STATE BIT(2) /* [TR]WRN_INT not connected */ |
150 | 163 | ||
151 | /* Structure of the message buffer */ | 164 | /* Structure of the message buffer */ |
152 | struct flexcan_mb { | 165 | struct flexcan_mb { |
@@ -205,7 +218,7 @@ static struct flexcan_devtype_data fsl_p1010_devtype_data = { | |||
205 | }; | 218 | }; |
206 | static struct flexcan_devtype_data fsl_imx28_devtype_data; | 219 | static struct flexcan_devtype_data fsl_imx28_devtype_data; |
207 | static struct flexcan_devtype_data fsl_imx6q_devtype_data = { | 220 | static struct flexcan_devtype_data fsl_imx6q_devtype_data = { |
208 | .features = FLEXCAN_HAS_V10_FEATURES | FLEXCAN_HAS_BROKEN_ERR_STATE, | 221 | .features = FLEXCAN_HAS_V10_FEATURES, |
209 | }; | 222 | }; |
210 | 223 | ||
211 | static const struct can_bittiming_const flexcan_bittiming_const = { | 224 | static const struct can_bittiming_const flexcan_bittiming_const = { |
diff --git a/drivers/net/can/sja1000/peak_pci.c b/drivers/net/can/sja1000/peak_pci.c index f5b82aeb2540..6525dbcca4e3 100644 --- a/drivers/net/can/sja1000/peak_pci.c +++ b/drivers/net/can/sja1000/peak_pci.c | |||
@@ -30,9 +30,10 @@ | |||
30 | 30 | ||
31 | #include "sja1000.h" | 31 | #include "sja1000.h" |
32 | 32 | ||
33 | MODULE_AUTHOR("Wolfgang Grandegger <wg@grandegger.com>"); | 33 | MODULE_AUTHOR("Stephane Grosjean <s.grosjean@peak-system.com>"); |
34 | MODULE_DESCRIPTION("Socket-CAN driver for PEAK PCAN PCI family cards"); | 34 | MODULE_DESCRIPTION("Socket-CAN driver for PEAK PCAN PCI family cards"); |
35 | MODULE_SUPPORTED_DEVICE("PEAK PCAN PCI/PCIe/PCIeC miniPCI CAN cards"); | 35 | MODULE_SUPPORTED_DEVICE("PEAK PCAN PCI/PCIe/PCIeC miniPCI CAN cards"); |
36 | MODULE_SUPPORTED_DEVICE("PEAK PCAN miniPCIe/cPCI PC/104+ PCI/104e CAN Cards"); | ||
36 | MODULE_LICENSE("GPL v2"); | 37 | MODULE_LICENSE("GPL v2"); |
37 | 38 | ||
38 | #define DRV_NAME "peak_pci" | 39 | #define DRV_NAME "peak_pci" |
@@ -64,7 +65,11 @@ struct peak_pci_chan { | |||
64 | #define PEAK_PCI_DEVICE_ID 0x0001 /* for PCI/PCIe slot cards */ | 65 | #define PEAK_PCI_DEVICE_ID 0x0001 /* for PCI/PCIe slot cards */ |
65 | #define PEAK_PCIEC_DEVICE_ID 0x0002 /* for ExpressCard slot cards */ | 66 | #define PEAK_PCIEC_DEVICE_ID 0x0002 /* for ExpressCard slot cards */ |
66 | #define PEAK_PCIE_DEVICE_ID 0x0003 /* for nextgen PCIe slot cards */ | 67 | #define PEAK_PCIE_DEVICE_ID 0x0003 /* for nextgen PCIe slot cards */ |
67 | #define PEAK_MPCI_DEVICE_ID 0x0008 /* The miniPCI slot cards */ | 68 | #define PEAK_CPCI_DEVICE_ID 0x0004 /* for nextgen cPCI slot cards */ |
69 | #define PEAK_MPCI_DEVICE_ID 0x0005 /* for nextgen miniPCI slot cards */ | ||
70 | #define PEAK_PC_104P_DEVICE_ID 0x0006 /* PCAN-PC/104+ cards */ | ||
71 | #define PEAK_PCI_104E_DEVICE_ID 0x0007 /* PCAN-PCI/104 Express cards */ | ||
72 | #define PEAK_MPCIE_DEVICE_ID 0x0008 /* The miniPCIe slot cards */ | ||
68 | 73 | ||
69 | #define PEAK_PCI_CHAN_MAX 4 | 74 | #define PEAK_PCI_CHAN_MAX 4 |
70 | 75 | ||
@@ -76,6 +81,10 @@ static DEFINE_PCI_DEVICE_TABLE(peak_pci_tbl) = { | |||
76 | {PEAK_PCI_VENDOR_ID, PEAK_PCI_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID,}, | 81 | {PEAK_PCI_VENDOR_ID, PEAK_PCI_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID,}, |
77 | {PEAK_PCI_VENDOR_ID, PEAK_PCIE_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID,}, | 82 | {PEAK_PCI_VENDOR_ID, PEAK_PCIE_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID,}, |
78 | {PEAK_PCI_VENDOR_ID, PEAK_MPCI_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID,}, | 83 | {PEAK_PCI_VENDOR_ID, PEAK_MPCI_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID,}, |
84 | {PEAK_PCI_VENDOR_ID, PEAK_MPCIE_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID,}, | ||
85 | {PEAK_PCI_VENDOR_ID, PEAK_PC_104P_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID,}, | ||
86 | {PEAK_PCI_VENDOR_ID, PEAK_PCI_104E_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID,}, | ||
87 | {PEAK_PCI_VENDOR_ID, PEAK_CPCI_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID,}, | ||
79 | #ifdef CONFIG_CAN_PEAK_PCIEC | 88 | #ifdef CONFIG_CAN_PEAK_PCIEC |
80 | {PEAK_PCI_VENDOR_ID, PEAK_PCIEC_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID,}, | 89 | {PEAK_PCI_VENDOR_ID, PEAK_PCIEC_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID,}, |
81 | #endif | 90 | #endif |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c index e2e45ee5df33..6dd0dd076cc5 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c | |||
@@ -137,7 +137,16 @@ | |||
137 | #define LINK_20GTFD LINK_STATUS_SPEED_AND_DUPLEX_20GTFD | 137 | #define LINK_20GTFD LINK_STATUS_SPEED_AND_DUPLEX_20GTFD |
138 | #define LINK_20GXFD LINK_STATUS_SPEED_AND_DUPLEX_20GXFD | 138 | #define LINK_20GXFD LINK_STATUS_SPEED_AND_DUPLEX_20GXFD |
139 | 139 | ||
140 | 140 | #define LINK_UPDATE_MASK \ | |
141 | (LINK_STATUS_SPEED_AND_DUPLEX_MASK | \ | ||
142 | LINK_STATUS_LINK_UP | \ | ||
143 | LINK_STATUS_PHYSICAL_LINK_FLAG | \ | ||
144 | LINK_STATUS_AUTO_NEGOTIATE_COMPLETE | \ | ||
145 | LINK_STATUS_RX_FLOW_CONTROL_FLAG_MASK | \ | ||
146 | LINK_STATUS_TX_FLOW_CONTROL_FLAG_MASK | \ | ||
147 | LINK_STATUS_PARALLEL_DETECTION_FLAG_MASK | \ | ||
148 | LINK_STATUS_LINK_PARTNER_SYMMETRIC_PAUSE | \ | ||
149 | LINK_STATUS_LINK_PARTNER_ASYMMETRIC_PAUSE) | ||
141 | 150 | ||
142 | #define SFP_EEPROM_CON_TYPE_ADDR 0x2 | 151 | #define SFP_EEPROM_CON_TYPE_ADDR 0x2 |
143 | #define SFP_EEPROM_CON_TYPE_VAL_LC 0x7 | 152 | #define SFP_EEPROM_CON_TYPE_VAL_LC 0x7 |
@@ -3295,6 +3304,21 @@ static void bnx2x_serdes_deassert(struct bnx2x *bp, u8 port) | |||
3295 | DEFAULT_PHY_DEV_ADDR); | 3304 | DEFAULT_PHY_DEV_ADDR); |
3296 | } | 3305 | } |
3297 | 3306 | ||
3307 | static void bnx2x_xgxs_specific_func(struct bnx2x_phy *phy, | ||
3308 | struct link_params *params, | ||
3309 | u32 action) | ||
3310 | { | ||
3311 | struct bnx2x *bp = params->bp; | ||
3312 | switch (action) { | ||
3313 | case PHY_INIT: | ||
3314 | /* Set correct devad */ | ||
3315 | REG_WR(bp, NIG_REG_XGXS0_CTRL_MD_ST + params->port*0x18, 0); | ||
3316 | REG_WR(bp, NIG_REG_XGXS0_CTRL_MD_DEVAD + params->port*0x18, | ||
3317 | phy->def_md_devad); | ||
3318 | break; | ||
3319 | } | ||
3320 | } | ||
3321 | |||
3298 | static void bnx2x_xgxs_deassert(struct link_params *params) | 3322 | static void bnx2x_xgxs_deassert(struct link_params *params) |
3299 | { | 3323 | { |
3300 | struct bnx2x *bp = params->bp; | 3324 | struct bnx2x *bp = params->bp; |
@@ -3309,10 +3333,8 @@ static void bnx2x_xgxs_deassert(struct link_params *params) | |||
3309 | REG_WR(bp, GRCBASE_MISC + MISC_REGISTERS_RESET_REG_3_CLEAR, val); | 3333 | REG_WR(bp, GRCBASE_MISC + MISC_REGISTERS_RESET_REG_3_CLEAR, val); |
3310 | udelay(500); | 3334 | udelay(500); |
3311 | REG_WR(bp, GRCBASE_MISC + MISC_REGISTERS_RESET_REG_3_SET, val); | 3335 | REG_WR(bp, GRCBASE_MISC + MISC_REGISTERS_RESET_REG_3_SET, val); |
3312 | 3336 | bnx2x_xgxs_specific_func(¶ms->phy[INT_PHY], params, | |
3313 | REG_WR(bp, NIG_REG_XGXS0_CTRL_MD_ST + port*0x18, 0); | 3337 | PHY_INIT); |
3314 | REG_WR(bp, NIG_REG_XGXS0_CTRL_MD_DEVAD + port*0x18, | ||
3315 | params->phy[INT_PHY].def_md_devad); | ||
3316 | } | 3338 | } |
3317 | 3339 | ||
3318 | static void bnx2x_calc_ieee_aneg_adv(struct bnx2x_phy *phy, | 3340 | static void bnx2x_calc_ieee_aneg_adv(struct bnx2x_phy *phy, |
@@ -3545,14 +3567,11 @@ static void bnx2x_warpcore_set_lpi_passthrough(struct bnx2x_phy *phy, | |||
3545 | static void bnx2x_warpcore_enable_AN_KR(struct bnx2x_phy *phy, | 3567 | static void bnx2x_warpcore_enable_AN_KR(struct bnx2x_phy *phy, |
3546 | struct link_params *params, | 3568 | struct link_params *params, |
3547 | struct link_vars *vars) { | 3569 | struct link_vars *vars) { |
3548 | u16 val16 = 0, lane, i; | 3570 | u16 lane, i, cl72_ctrl, an_adv = 0; |
3571 | u16 ucode_ver; | ||
3549 | struct bnx2x *bp = params->bp; | 3572 | struct bnx2x *bp = params->bp; |
3550 | static struct bnx2x_reg_set reg_set[] = { | 3573 | static struct bnx2x_reg_set reg_set[] = { |
3551 | {MDIO_WC_DEVAD, MDIO_WC_REG_SERDESDIGITAL_CONTROL1000X2, 0x7}, | 3574 | {MDIO_WC_DEVAD, MDIO_WC_REG_SERDESDIGITAL_CONTROL1000X2, 0x7}, |
3552 | {MDIO_AN_DEVAD, MDIO_WC_REG_PAR_DET_10G_CTRL, 0}, | ||
3553 | {MDIO_WC_DEVAD, MDIO_WC_REG_CL72_USERB0_CL72_MISC1_CONTROL, 0}, | ||
3554 | {MDIO_WC_DEVAD, MDIO_WC_REG_XGXSBLK1_LANECTRL0, 0xff}, | ||
3555 | {MDIO_WC_DEVAD, MDIO_WC_REG_XGXSBLK1_LANECTRL1, 0x5555}, | ||
3556 | {MDIO_PMA_DEVAD, MDIO_WC_REG_IEEE0BLK_AUTONEGNP, 0x0}, | 3575 | {MDIO_PMA_DEVAD, MDIO_WC_REG_IEEE0BLK_AUTONEGNP, 0x0}, |
3557 | {MDIO_WC_DEVAD, MDIO_WC_REG_RX66_CONTROL, 0x7415}, | 3576 | {MDIO_WC_DEVAD, MDIO_WC_REG_RX66_CONTROL, 0x7415}, |
3558 | {MDIO_WC_DEVAD, MDIO_WC_REG_SERDESDIGITAL_MISC2, 0x6190}, | 3577 | {MDIO_WC_DEVAD, MDIO_WC_REG_SERDESDIGITAL_MISC2, 0x6190}, |
@@ -3565,12 +3584,19 @@ static void bnx2x_warpcore_enable_AN_KR(struct bnx2x_phy *phy, | |||
3565 | bnx2x_cl45_write(bp, phy, reg_set[i].devad, reg_set[i].reg, | 3584 | bnx2x_cl45_write(bp, phy, reg_set[i].devad, reg_set[i].reg, |
3566 | reg_set[i].val); | 3585 | reg_set[i].val); |
3567 | 3586 | ||
3587 | bnx2x_cl45_read(bp, phy, MDIO_WC_DEVAD, | ||
3588 | MDIO_WC_REG_CL72_USERB0_CL72_MISC1_CONTROL, &cl72_ctrl); | ||
3589 | cl72_ctrl &= 0xf8ff; | ||
3590 | cl72_ctrl |= 0x3800; | ||
3591 | bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD, | ||
3592 | MDIO_WC_REG_CL72_USERB0_CL72_MISC1_CONTROL, cl72_ctrl); | ||
3593 | |||
3568 | /* Check adding advertisement for 1G KX */ | 3594 | /* Check adding advertisement for 1G KX */ |
3569 | if (((vars->line_speed == SPEED_AUTO_NEG) && | 3595 | if (((vars->line_speed == SPEED_AUTO_NEG) && |
3570 | (phy->speed_cap_mask & PORT_HW_CFG_SPEED_CAPABILITY_D0_1G)) || | 3596 | (phy->speed_cap_mask & PORT_HW_CFG_SPEED_CAPABILITY_D0_1G)) || |
3571 | (vars->line_speed == SPEED_1000)) { | 3597 | (vars->line_speed == SPEED_1000)) { |
3572 | u32 addr = MDIO_WC_REG_SERDESDIGITAL_CONTROL1000X2; | 3598 | u32 addr = MDIO_WC_REG_SERDESDIGITAL_CONTROL1000X2; |
3573 | val16 |= (1<<5); | 3599 | an_adv |= (1<<5); |
3574 | 3600 | ||
3575 | /* Enable CL37 1G Parallel Detect */ | 3601 | /* Enable CL37 1G Parallel Detect */ |
3576 | bnx2x_cl45_read_or_write(bp, phy, MDIO_WC_DEVAD, addr, 0x1); | 3602 | bnx2x_cl45_read_or_write(bp, phy, MDIO_WC_DEVAD, addr, 0x1); |
@@ -3580,11 +3606,14 @@ static void bnx2x_warpcore_enable_AN_KR(struct bnx2x_phy *phy, | |||
3580 | (phy->speed_cap_mask & PORT_HW_CFG_SPEED_CAPABILITY_D0_10G)) || | 3606 | (phy->speed_cap_mask & PORT_HW_CFG_SPEED_CAPABILITY_D0_10G)) || |
3581 | (vars->line_speed == SPEED_10000)) { | 3607 | (vars->line_speed == SPEED_10000)) { |
3582 | /* Check adding advertisement for 10G KR */ | 3608 | /* Check adding advertisement for 10G KR */ |
3583 | val16 |= (1<<7); | 3609 | an_adv |= (1<<7); |
3584 | /* Enable 10G Parallel Detect */ | 3610 | /* Enable 10G Parallel Detect */ |
3611 | CL22_WR_OVER_CL45(bp, phy, MDIO_REG_BANK_AER_BLOCK, | ||
3612 | MDIO_AER_BLOCK_AER_REG, 0); | ||
3613 | |||
3585 | bnx2x_cl45_write(bp, phy, MDIO_AN_DEVAD, | 3614 | bnx2x_cl45_write(bp, phy, MDIO_AN_DEVAD, |
3586 | MDIO_WC_REG_PAR_DET_10G_CTRL, 1); | 3615 | MDIO_WC_REG_PAR_DET_10G_CTRL, 1); |
3587 | 3616 | bnx2x_set_aer_mmd(params, phy); | |
3588 | DP(NETIF_MSG_LINK, "Advertize 10G\n"); | 3617 | DP(NETIF_MSG_LINK, "Advertize 10G\n"); |
3589 | } | 3618 | } |
3590 | 3619 | ||
@@ -3604,7 +3633,7 @@ static void bnx2x_warpcore_enable_AN_KR(struct bnx2x_phy *phy, | |||
3604 | 3633 | ||
3605 | /* Advertised speeds */ | 3634 | /* Advertised speeds */ |
3606 | bnx2x_cl45_write(bp, phy, MDIO_AN_DEVAD, | 3635 | bnx2x_cl45_write(bp, phy, MDIO_AN_DEVAD, |
3607 | MDIO_WC_REG_AN_IEEE1BLK_AN_ADVERTISEMENT1, val16); | 3636 | MDIO_WC_REG_AN_IEEE1BLK_AN_ADVERTISEMENT1, an_adv); |
3608 | 3637 | ||
3609 | /* Advertised and set FEC (Forward Error Correction) */ | 3638 | /* Advertised and set FEC (Forward Error Correction) */ |
3610 | bnx2x_cl45_write(bp, phy, MDIO_AN_DEVAD, | 3639 | bnx2x_cl45_write(bp, phy, MDIO_AN_DEVAD, |
@@ -3628,9 +3657,10 @@ static void bnx2x_warpcore_enable_AN_KR(struct bnx2x_phy *phy, | |||
3628 | /* Set KR Autoneg Work-Around flag for Warpcore version older than D108 | 3657 | /* Set KR Autoneg Work-Around flag for Warpcore version older than D108 |
3629 | */ | 3658 | */ |
3630 | bnx2x_cl45_read(bp, phy, MDIO_WC_DEVAD, | 3659 | bnx2x_cl45_read(bp, phy, MDIO_WC_DEVAD, |
3631 | MDIO_WC_REG_UC_INFO_B1_VERSION, &val16); | 3660 | MDIO_WC_REG_UC_INFO_B1_VERSION, &ucode_ver); |
3632 | if (val16 < 0xd108) { | 3661 | if (ucode_ver < 0xd108) { |
3633 | DP(NETIF_MSG_LINK, "Enable AN KR work-around\n"); | 3662 | DP(NETIF_MSG_LINK, "Enable AN KR work-around. WC ver:0x%x\n", |
3663 | ucode_ver); | ||
3634 | vars->rx_tx_asic_rst = MAX_KR_LINK_RETRY; | 3664 | vars->rx_tx_asic_rst = MAX_KR_LINK_RETRY; |
3635 | } | 3665 | } |
3636 | bnx2x_cl45_read_or_write(bp, phy, MDIO_WC_DEVAD, | 3666 | bnx2x_cl45_read_or_write(bp, phy, MDIO_WC_DEVAD, |
@@ -3651,21 +3681,16 @@ static void bnx2x_warpcore_set_10G_KR(struct bnx2x_phy *phy, | |||
3651 | struct link_vars *vars) | 3681 | struct link_vars *vars) |
3652 | { | 3682 | { |
3653 | struct bnx2x *bp = params->bp; | 3683 | struct bnx2x *bp = params->bp; |
3654 | u16 i; | 3684 | u16 val16, i, lane; |
3655 | static struct bnx2x_reg_set reg_set[] = { | 3685 | static struct bnx2x_reg_set reg_set[] = { |
3656 | /* Disable Autoneg */ | 3686 | /* Disable Autoneg */ |
3657 | {MDIO_WC_DEVAD, MDIO_WC_REG_SERDESDIGITAL_CONTROL1000X2, 0x7}, | 3687 | {MDIO_WC_DEVAD, MDIO_WC_REG_SERDESDIGITAL_CONTROL1000X2, 0x7}, |
3658 | {MDIO_AN_DEVAD, MDIO_WC_REG_PAR_DET_10G_CTRL, 0}, | ||
3659 | {MDIO_WC_DEVAD, MDIO_WC_REG_CL72_USERB0_CL72_MISC1_CONTROL, | 3688 | {MDIO_WC_DEVAD, MDIO_WC_REG_CL72_USERB0_CL72_MISC1_CONTROL, |
3660 | 0x3f00}, | 3689 | 0x3f00}, |
3661 | {MDIO_AN_DEVAD, MDIO_WC_REG_AN_IEEE1BLK_AN_ADVERTISEMENT1, 0}, | 3690 | {MDIO_AN_DEVAD, MDIO_WC_REG_AN_IEEE1BLK_AN_ADVERTISEMENT1, 0}, |
3662 | {MDIO_AN_DEVAD, MDIO_WC_REG_IEEE0BLK_MIICNTL, 0x0}, | 3691 | {MDIO_AN_DEVAD, MDIO_WC_REG_IEEE0BLK_MIICNTL, 0x0}, |
3663 | {MDIO_WC_DEVAD, MDIO_WC_REG_DIGITAL3_UP1, 0x1}, | 3692 | {MDIO_WC_DEVAD, MDIO_WC_REG_DIGITAL3_UP1, 0x1}, |
3664 | {MDIO_WC_DEVAD, MDIO_WC_REG_DIGITAL5_MISC7, 0xa}, | 3693 | {MDIO_WC_DEVAD, MDIO_WC_REG_DIGITAL5_MISC7, 0xa}, |
3665 | /* Disable CL36 PCS Tx */ | ||
3666 | {MDIO_WC_DEVAD, MDIO_WC_REG_XGXSBLK1_LANECTRL0, 0x0}, | ||
3667 | /* Double Wide Single Data Rate @ pll rate */ | ||
3668 | {MDIO_WC_DEVAD, MDIO_WC_REG_XGXSBLK1_LANECTRL1, 0xFFFF}, | ||
3669 | /* Leave cl72 training enable, needed for KR */ | 3694 | /* Leave cl72 training enable, needed for KR */ |
3670 | {MDIO_PMA_DEVAD, | 3695 | {MDIO_PMA_DEVAD, |
3671 | MDIO_WC_REG_PMD_IEEE9BLK_TENGBASE_KR_PMD_CONTROL_REGISTER_150, | 3696 | MDIO_WC_REG_PMD_IEEE9BLK_TENGBASE_KR_PMD_CONTROL_REGISTER_150, |
@@ -3676,11 +3701,24 @@ static void bnx2x_warpcore_set_10G_KR(struct bnx2x_phy *phy, | |||
3676 | bnx2x_cl45_write(bp, phy, reg_set[i].devad, reg_set[i].reg, | 3701 | bnx2x_cl45_write(bp, phy, reg_set[i].devad, reg_set[i].reg, |
3677 | reg_set[i].val); | 3702 | reg_set[i].val); |
3678 | 3703 | ||
3679 | /* Leave CL72 enabled */ | 3704 | lane = bnx2x_get_warpcore_lane(phy, params); |
3680 | bnx2x_cl45_read_or_write(bp, phy, MDIO_WC_DEVAD, | 3705 | /* Global registers */ |
3681 | MDIO_WC_REG_CL72_USERB0_CL72_MISC1_CONTROL, | 3706 | CL22_WR_OVER_CL45(bp, phy, MDIO_REG_BANK_AER_BLOCK, |
3682 | 0x3800); | 3707 | MDIO_AER_BLOCK_AER_REG, 0); |
3708 | /* Disable CL36 PCS Tx */ | ||
3709 | bnx2x_cl45_read(bp, phy, MDIO_WC_DEVAD, | ||
3710 | MDIO_WC_REG_XGXSBLK1_LANECTRL0, &val16); | ||
3711 | val16 &= ~(0x0011 << lane); | ||
3712 | bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD, | ||
3713 | MDIO_WC_REG_XGXSBLK1_LANECTRL0, val16); | ||
3683 | 3714 | ||
3715 | bnx2x_cl45_read(bp, phy, MDIO_WC_DEVAD, | ||
3716 | MDIO_WC_REG_XGXSBLK1_LANECTRL1, &val16); | ||
3717 | val16 |= (0x0303 << (lane << 1)); | ||
3718 | bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD, | ||
3719 | MDIO_WC_REG_XGXSBLK1_LANECTRL1, val16); | ||
3720 | /* Restore AER */ | ||
3721 | bnx2x_set_aer_mmd(params, phy); | ||
3684 | /* Set speed via PMA/PMD register */ | 3722 | /* Set speed via PMA/PMD register */ |
3685 | bnx2x_cl45_write(bp, phy, MDIO_PMA_DEVAD, | 3723 | bnx2x_cl45_write(bp, phy, MDIO_PMA_DEVAD, |
3686 | MDIO_WC_REG_IEEE0BLK_MIICNTL, 0x2040); | 3724 | MDIO_WC_REG_IEEE0BLK_MIICNTL, 0x2040); |
@@ -4303,7 +4341,7 @@ static void bnx2x_warpcore_link_reset(struct bnx2x_phy *phy, | |||
4303 | struct link_params *params) | 4341 | struct link_params *params) |
4304 | { | 4342 | { |
4305 | struct bnx2x *bp = params->bp; | 4343 | struct bnx2x *bp = params->bp; |
4306 | u16 val16; | 4344 | u16 val16, lane; |
4307 | bnx2x_sfp_e3_set_transmitter(params, phy, 0); | 4345 | bnx2x_sfp_e3_set_transmitter(params, phy, 0); |
4308 | bnx2x_set_mdio_clk(bp, params->chip_id, params->port); | 4346 | bnx2x_set_mdio_clk(bp, params->chip_id, params->port); |
4309 | bnx2x_set_aer_mmd(params, phy); | 4347 | bnx2x_set_aer_mmd(params, phy); |
@@ -4340,6 +4378,30 @@ static void bnx2x_warpcore_link_reset(struct bnx2x_phy *phy, | |||
4340 | MDIO_WC_REG_XGXSBLK1_LANECTRL2, | 4378 | MDIO_WC_REG_XGXSBLK1_LANECTRL2, |
4341 | val16 & 0xff00); | 4379 | val16 & 0xff00); |
4342 | 4380 | ||
4381 | lane = bnx2x_get_warpcore_lane(phy, params); | ||
4382 | /* Disable CL36 PCS Tx */ | ||
4383 | bnx2x_cl45_read(bp, phy, MDIO_WC_DEVAD, | ||
4384 | MDIO_WC_REG_XGXSBLK1_LANECTRL0, &val16); | ||
4385 | val16 |= (0x11 << lane); | ||
4386 | if (phy->flags & FLAGS_WC_DUAL_MODE) | ||
4387 | val16 |= (0x22 << lane); | ||
4388 | bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD, | ||
4389 | MDIO_WC_REG_XGXSBLK1_LANECTRL0, val16); | ||
4390 | |||
4391 | bnx2x_cl45_read(bp, phy, MDIO_WC_DEVAD, | ||
4392 | MDIO_WC_REG_XGXSBLK1_LANECTRL1, &val16); | ||
4393 | val16 &= ~(0x0303 << (lane << 1)); | ||
4394 | val16 |= (0x0101 << (lane << 1)); | ||
4395 | if (phy->flags & FLAGS_WC_DUAL_MODE) { | ||
4396 | val16 &= ~(0x0c0c << (lane << 1)); | ||
4397 | val16 |= (0x0404 << (lane << 1)); | ||
4398 | } | ||
4399 | |||
4400 | bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD, | ||
4401 | MDIO_WC_REG_XGXSBLK1_LANECTRL1, val16); | ||
4402 | /* Restore AER */ | ||
4403 | bnx2x_set_aer_mmd(params, phy); | ||
4404 | |||
4343 | } | 4405 | } |
4344 | 4406 | ||
4345 | static void bnx2x_set_warpcore_loopback(struct bnx2x_phy *phy, | 4407 | static void bnx2x_set_warpcore_loopback(struct bnx2x_phy *phy, |
@@ -6296,15 +6358,7 @@ static int bnx2x_update_link_down(struct link_params *params, | |||
6296 | vars->mac_type = MAC_TYPE_NONE; | 6358 | vars->mac_type = MAC_TYPE_NONE; |
6297 | 6359 | ||
6298 | /* Update shared memory */ | 6360 | /* Update shared memory */ |
6299 | vars->link_status &= ~(LINK_STATUS_SPEED_AND_DUPLEX_MASK | | 6361 | vars->link_status &= ~LINK_UPDATE_MASK; |
6300 | LINK_STATUS_LINK_UP | | ||
6301 | LINK_STATUS_PHYSICAL_LINK_FLAG | | ||
6302 | LINK_STATUS_AUTO_NEGOTIATE_COMPLETE | | ||
6303 | LINK_STATUS_RX_FLOW_CONTROL_FLAG_MASK | | ||
6304 | LINK_STATUS_TX_FLOW_CONTROL_FLAG_MASK | | ||
6305 | LINK_STATUS_PARALLEL_DETECTION_FLAG_MASK | | ||
6306 | LINK_STATUS_LINK_PARTNER_SYMMETRIC_PAUSE | | ||
6307 | LINK_STATUS_LINK_PARTNER_ASYMMETRIC_PAUSE); | ||
6308 | vars->line_speed = 0; | 6362 | vars->line_speed = 0; |
6309 | bnx2x_update_mng(params, vars->link_status); | 6363 | bnx2x_update_mng(params, vars->link_status); |
6310 | 6364 | ||
@@ -6452,6 +6506,7 @@ int bnx2x_link_update(struct link_params *params, struct link_vars *vars) | |||
6452 | u16 ext_phy_line_speed = 0, prev_line_speed = vars->line_speed; | 6506 | u16 ext_phy_line_speed = 0, prev_line_speed = vars->line_speed; |
6453 | u8 active_external_phy = INT_PHY; | 6507 | u8 active_external_phy = INT_PHY; |
6454 | vars->phy_flags &= ~PHY_HALF_OPEN_CONN_FLAG; | 6508 | vars->phy_flags &= ~PHY_HALF_OPEN_CONN_FLAG; |
6509 | vars->link_status &= ~LINK_UPDATE_MASK; | ||
6455 | for (phy_index = INT_PHY; phy_index < params->num_phys; | 6510 | for (phy_index = INT_PHY; phy_index < params->num_phys; |
6456 | phy_index++) { | 6511 | phy_index++) { |
6457 | phy_vars[phy_index].flow_ctrl = 0; | 6512 | phy_vars[phy_index].flow_ctrl = 0; |
@@ -7579,7 +7634,7 @@ static void bnx2x_warpcore_power_module(struct link_params *params, | |||
7579 | static int bnx2x_warpcore_read_sfp_module_eeprom(struct bnx2x_phy *phy, | 7634 | static int bnx2x_warpcore_read_sfp_module_eeprom(struct bnx2x_phy *phy, |
7580 | struct link_params *params, | 7635 | struct link_params *params, |
7581 | u16 addr, u8 byte_cnt, | 7636 | u16 addr, u8 byte_cnt, |
7582 | u8 *o_buf) | 7637 | u8 *o_buf, u8 is_init) |
7583 | { | 7638 | { |
7584 | int rc = 0; | 7639 | int rc = 0; |
7585 | u8 i, j = 0, cnt = 0; | 7640 | u8 i, j = 0, cnt = 0; |
@@ -7596,10 +7651,10 @@ static int bnx2x_warpcore_read_sfp_module_eeprom(struct bnx2x_phy *phy, | |||
7596 | /* 4 byte aligned address */ | 7651 | /* 4 byte aligned address */ |
7597 | addr32 = addr & (~0x3); | 7652 | addr32 = addr & (~0x3); |
7598 | do { | 7653 | do { |
7599 | if (cnt == I2C_WA_PWR_ITER) { | 7654 | if ((!is_init) && (cnt == I2C_WA_PWR_ITER)) { |
7600 | bnx2x_warpcore_power_module(params, phy, 0); | 7655 | bnx2x_warpcore_power_module(params, phy, 0); |
7601 | /* Note that 100us are not enough here */ | 7656 | /* Note that 100us are not enough here */ |
7602 | usleep_range(1000,1000); | 7657 | usleep_range(1000, 2000); |
7603 | bnx2x_warpcore_power_module(params, phy, 1); | 7658 | bnx2x_warpcore_power_module(params, phy, 1); |
7604 | } | 7659 | } |
7605 | rc = bnx2x_bsc_read(params, phy, 0xa0, addr32, 0, byte_cnt, | 7660 | rc = bnx2x_bsc_read(params, phy, 0xa0, addr32, 0, byte_cnt, |
@@ -7719,7 +7774,7 @@ int bnx2x_read_sfp_module_eeprom(struct bnx2x_phy *phy, | |||
7719 | break; | 7774 | break; |
7720 | case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_DIRECT: | 7775 | case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_DIRECT: |
7721 | rc = bnx2x_warpcore_read_sfp_module_eeprom(phy, params, addr, | 7776 | rc = bnx2x_warpcore_read_sfp_module_eeprom(phy, params, addr, |
7722 | byte_cnt, o_buf); | 7777 | byte_cnt, o_buf, 0); |
7723 | break; | 7778 | break; |
7724 | } | 7779 | } |
7725 | return rc; | 7780 | return rc; |
@@ -7923,6 +7978,7 @@ static int bnx2x_wait_for_sfp_module_initialized(struct bnx2x_phy *phy, | |||
7923 | 7978 | ||
7924 | { | 7979 | { |
7925 | u8 val; | 7980 | u8 val; |
7981 | int rc; | ||
7926 | struct bnx2x *bp = params->bp; | 7982 | struct bnx2x *bp = params->bp; |
7927 | u16 timeout; | 7983 | u16 timeout; |
7928 | /* Initialization time after hot-plug may take up to 300ms for | 7984 | /* Initialization time after hot-plug may take up to 300ms for |
@@ -7930,8 +7986,14 @@ static int bnx2x_wait_for_sfp_module_initialized(struct bnx2x_phy *phy, | |||
7930 | */ | 7986 | */ |
7931 | 7987 | ||
7932 | for (timeout = 0; timeout < 60; timeout++) { | 7988 | for (timeout = 0; timeout < 60; timeout++) { |
7933 | if (bnx2x_read_sfp_module_eeprom(phy, params, 1, 1, &val) | 7989 | if (phy->type == PORT_HW_CFG_XGXS_EXT_PHY_TYPE_DIRECT) |
7934 | == 0) { | 7990 | rc = bnx2x_warpcore_read_sfp_module_eeprom(phy, |
7991 | params, 1, | ||
7992 | 1, &val, 1); | ||
7993 | else | ||
7994 | rc = bnx2x_read_sfp_module_eeprom(phy, params, 1, 1, | ||
7995 | &val); | ||
7996 | if (rc == 0) { | ||
7935 | DP(NETIF_MSG_LINK, | 7997 | DP(NETIF_MSG_LINK, |
7936 | "SFP+ module initialization took %d ms\n", | 7998 | "SFP+ module initialization took %d ms\n", |
7937 | timeout * 5); | 7999 | timeout * 5); |
@@ -7939,7 +8001,8 @@ static int bnx2x_wait_for_sfp_module_initialized(struct bnx2x_phy *phy, | |||
7939 | } | 8001 | } |
7940 | usleep_range(5000, 10000); | 8002 | usleep_range(5000, 10000); |
7941 | } | 8003 | } |
7942 | return -EINVAL; | 8004 | rc = bnx2x_read_sfp_module_eeprom(phy, params, 1, 1, &val); |
8005 | return rc; | ||
7943 | } | 8006 | } |
7944 | 8007 | ||
7945 | static void bnx2x_8727_power_module(struct bnx2x *bp, | 8008 | static void bnx2x_8727_power_module(struct bnx2x *bp, |
@@ -10993,7 +11056,7 @@ static struct bnx2x_phy phy_xgxs = { | |||
10993 | .format_fw_ver = (format_fw_ver_t)NULL, | 11056 | .format_fw_ver = (format_fw_ver_t)NULL, |
10994 | .hw_reset = (hw_reset_t)NULL, | 11057 | .hw_reset = (hw_reset_t)NULL, |
10995 | .set_link_led = (set_link_led_t)NULL, | 11058 | .set_link_led = (set_link_led_t)NULL, |
10996 | .phy_specific_func = (phy_specific_func_t)NULL | 11059 | .phy_specific_func = (phy_specific_func_t)bnx2x_xgxs_specific_func |
10997 | }; | 11060 | }; |
10998 | static struct bnx2x_phy phy_warpcore = { | 11061 | static struct bnx2x_phy phy_warpcore = { |
10999 | .type = PORT_HW_CFG_XGXS_EXT_PHY_TYPE_DIRECT, | 11062 | .type = PORT_HW_CFG_XGXS_EXT_PHY_TYPE_DIRECT, |
@@ -11465,6 +11528,11 @@ static int bnx2x_populate_int_phy(struct bnx2x *bp, u32 shmem_base, u8 port, | |||
11465 | phy->media_type = ETH_PHY_BASE_T; | 11528 | phy->media_type = ETH_PHY_BASE_T; |
11466 | break; | 11529 | break; |
11467 | case PORT_HW_CFG_NET_SERDES_IF_XFI: | 11530 | case PORT_HW_CFG_NET_SERDES_IF_XFI: |
11531 | phy->supported &= (SUPPORTED_1000baseT_Full | | ||
11532 | SUPPORTED_10000baseT_Full | | ||
11533 | SUPPORTED_FIBRE | | ||
11534 | SUPPORTED_Pause | | ||
11535 | SUPPORTED_Asym_Pause); | ||
11468 | phy->media_type = ETH_PHY_XFP_FIBER; | 11536 | phy->media_type = ETH_PHY_XFP_FIBER; |
11469 | break; | 11537 | break; |
11470 | case PORT_HW_CFG_NET_SERDES_IF_SFI: | 11538 | case PORT_HW_CFG_NET_SERDES_IF_SFI: |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c index d5648fc666bd..bd1fd3d87c24 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | |||
@@ -6794,8 +6794,9 @@ static int bnx2x_init_hw_port(struct bnx2x *bp) | |||
6794 | 6794 | ||
6795 | bnx2x_init_block(bp, BLOCK_DORQ, init_phase); | 6795 | bnx2x_init_block(bp, BLOCK_DORQ, init_phase); |
6796 | 6796 | ||
6797 | bnx2x_init_block(bp, BLOCK_BRB1, init_phase); | ||
6798 | |||
6797 | if (CHIP_IS_E1(bp) || CHIP_IS_E1H(bp)) { | 6799 | if (CHIP_IS_E1(bp) || CHIP_IS_E1H(bp)) { |
6798 | bnx2x_init_block(bp, BLOCK_BRB1, init_phase); | ||
6799 | 6800 | ||
6800 | if (IS_MF(bp)) | 6801 | if (IS_MF(bp)) |
6801 | low = ((bp->flags & ONE_PORT_FLAG) ? 160 : 246); | 6802 | low = ((bp->flags & ONE_PORT_FLAG) ? 160 : 246); |
@@ -11902,7 +11903,15 @@ static int __devinit bnx2x_init_one(struct pci_dev *pdev, | |||
11902 | /* disable FCOE L2 queue for E1x */ | 11903 | /* disable FCOE L2 queue for E1x */ |
11903 | if (CHIP_IS_E1x(bp)) | 11904 | if (CHIP_IS_E1x(bp)) |
11904 | bp->flags |= NO_FCOE_FLAG; | 11905 | bp->flags |= NO_FCOE_FLAG; |
11905 | 11906 | /* disable FCOE for 57840 device, until FW supports it */ | |
11907 | switch (ent->driver_data) { | ||
11908 | case BCM57840_O: | ||
11909 | case BCM57840_4_10: | ||
11910 | case BCM57840_2_20: | ||
11911 | case BCM57840_MFO: | ||
11912 | case BCM57840_MF: | ||
11913 | bp->flags |= NO_FCOE_FLAG; | ||
11914 | } | ||
11906 | #endif | 11915 | #endif |
11907 | 11916 | ||
11908 | 11917 | ||
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h b/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h index a4da893ac1e1..378988b5709a 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h | |||
@@ -251,6 +251,8 @@ struct adapter_params { | |||
251 | unsigned char rev; /* chip revision */ | 251 | unsigned char rev; /* chip revision */ |
252 | unsigned char offload; | 252 | unsigned char offload; |
253 | 253 | ||
254 | unsigned char bypass; | ||
255 | |||
254 | unsigned int ofldq_wr_cred; | 256 | unsigned int ofldq_wr_cred; |
255 | }; | 257 | }; |
256 | 258 | ||
@@ -642,6 +644,23 @@ extern int dbfifo_int_thresh; | |||
642 | #define for_each_port(adapter, iter) \ | 644 | #define for_each_port(adapter, iter) \ |
643 | for (iter = 0; iter < (adapter)->params.nports; ++iter) | 645 | for (iter = 0; iter < (adapter)->params.nports; ++iter) |
644 | 646 | ||
647 | static inline int is_bypass(struct adapter *adap) | ||
648 | { | ||
649 | return adap->params.bypass; | ||
650 | } | ||
651 | |||
652 | static inline int is_bypass_device(int device) | ||
653 | { | ||
654 | /* this should be set based upon device capabilities */ | ||
655 | switch (device) { | ||
656 | case 0x440b: | ||
657 | case 0x440c: | ||
658 | return 1; | ||
659 | default: | ||
660 | return 0; | ||
661 | } | ||
662 | } | ||
663 | |||
645 | static inline unsigned int core_ticks_per_usec(const struct adapter *adap) | 664 | static inline unsigned int core_ticks_per_usec(const struct adapter *adap) |
646 | { | 665 | { |
647 | return adap->params.vpd.cclk / 1000; | 666 | return adap->params.vpd.cclk / 1000; |
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c index 604f4f87f550..0df1284df497 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c | |||
@@ -3416,16 +3416,6 @@ static int adap_init0_config(struct adapter *adapter, int reset) | |||
3416 | finicsum, cfcsum); | 3416 | finicsum, cfcsum); |
3417 | 3417 | ||
3418 | /* | 3418 | /* |
3419 | * If we're a pure NIC driver then disable all offloading facilities. | ||
3420 | * This will allow the firmware to optimize aspects of the hardware | ||
3421 | * configuration which will result in improved performance. | ||
3422 | */ | ||
3423 | caps_cmd.ofldcaps = 0; | ||
3424 | caps_cmd.iscsicaps = 0; | ||
3425 | caps_cmd.rdmacaps = 0; | ||
3426 | caps_cmd.fcoecaps = 0; | ||
3427 | |||
3428 | /* | ||
3429 | * And now tell the firmware to use the configuration we just loaded. | 3419 | * And now tell the firmware to use the configuration we just loaded. |
3430 | */ | 3420 | */ |
3431 | caps_cmd.op_to_write = | 3421 | caps_cmd.op_to_write = |
@@ -3513,18 +3503,6 @@ static int adap_init0_no_config(struct adapter *adapter, int reset) | |||
3513 | if (ret < 0) | 3503 | if (ret < 0) |
3514 | goto bye; | 3504 | goto bye; |
3515 | 3505 | ||
3516 | #ifndef CONFIG_CHELSIO_T4_OFFLOAD | ||
3517 | /* | ||
3518 | * If we're a pure NIC driver then disable all offloading facilities. | ||
3519 | * This will allow the firmware to optimize aspects of the hardware | ||
3520 | * configuration which will result in improved performance. | ||
3521 | */ | ||
3522 | caps_cmd.ofldcaps = 0; | ||
3523 | caps_cmd.iscsicaps = 0; | ||
3524 | caps_cmd.rdmacaps = 0; | ||
3525 | caps_cmd.fcoecaps = 0; | ||
3526 | #endif | ||
3527 | |||
3528 | if (caps_cmd.niccaps & htons(FW_CAPS_CONFIG_NIC_VM)) { | 3506 | if (caps_cmd.niccaps & htons(FW_CAPS_CONFIG_NIC_VM)) { |
3529 | if (!vf_acls) | 3507 | if (!vf_acls) |
3530 | caps_cmd.niccaps ^= htons(FW_CAPS_CONFIG_NIC_VM); | 3508 | caps_cmd.niccaps ^= htons(FW_CAPS_CONFIG_NIC_VM); |
@@ -3745,6 +3723,7 @@ static int adap_init0(struct adapter *adap) | |||
3745 | u32 v, port_vec; | 3723 | u32 v, port_vec; |
3746 | enum dev_state state; | 3724 | enum dev_state state; |
3747 | u32 params[7], val[7]; | 3725 | u32 params[7], val[7]; |
3726 | struct fw_caps_config_cmd caps_cmd; | ||
3748 | int reset = 1, j; | 3727 | int reset = 1, j; |
3749 | 3728 | ||
3750 | /* | 3729 | /* |
@@ -3898,6 +3877,9 @@ static int adap_init0(struct adapter *adap) | |||
3898 | goto bye; | 3877 | goto bye; |
3899 | } | 3878 | } |
3900 | 3879 | ||
3880 | if (is_bypass_device(adap->pdev->device)) | ||
3881 | adap->params.bypass = 1; | ||
3882 | |||
3901 | /* | 3883 | /* |
3902 | * Grab some of our basic fundamental operating parameters. | 3884 | * Grab some of our basic fundamental operating parameters. |
3903 | */ | 3885 | */ |
@@ -3940,13 +3922,12 @@ static int adap_init0(struct adapter *adap) | |||
3940 | adap->tids.aftid_end = val[1]; | 3922 | adap->tids.aftid_end = val[1]; |
3941 | } | 3923 | } |
3942 | 3924 | ||
3943 | #ifdef CONFIG_CHELSIO_T4_OFFLOAD | ||
3944 | /* | 3925 | /* |
3945 | * Get device capabilities so we can determine what resources we need | 3926 | * Get device capabilities so we can determine what resources we need |
3946 | * to manage. | 3927 | * to manage. |
3947 | */ | 3928 | */ |
3948 | memset(&caps_cmd, 0, sizeof(caps_cmd)); | 3929 | memset(&caps_cmd, 0, sizeof(caps_cmd)); |
3949 | caps_cmd.op_to_write = htonl(V_FW_CMD_OP(FW_CAPS_CONFIG_CMD) | | 3930 | caps_cmd.op_to_write = htonl(FW_CMD_OP(FW_CAPS_CONFIG_CMD) | |
3950 | FW_CMD_REQUEST | FW_CMD_READ); | 3931 | FW_CMD_REQUEST | FW_CMD_READ); |
3951 | caps_cmd.retval_len16 = htonl(FW_LEN16(caps_cmd)); | 3932 | caps_cmd.retval_len16 = htonl(FW_LEN16(caps_cmd)); |
3952 | ret = t4_wr_mbox(adap, adap->mbox, &caps_cmd, sizeof(caps_cmd), | 3933 | ret = t4_wr_mbox(adap, adap->mbox, &caps_cmd, sizeof(caps_cmd), |
@@ -3991,15 +3972,6 @@ static int adap_init0(struct adapter *adap) | |||
3991 | adap->vres.ddp.size = val[4] - val[3] + 1; | 3972 | adap->vres.ddp.size = val[4] - val[3] + 1; |
3992 | adap->params.ofldq_wr_cred = val[5]; | 3973 | adap->params.ofldq_wr_cred = val[5]; |
3993 | 3974 | ||
3994 | params[0] = FW_PARAM_PFVF(ETHOFLD_START); | ||
3995 | params[1] = FW_PARAM_PFVF(ETHOFLD_END); | ||
3996 | ret = t4_query_params(adap, adap->mbox, adap->fn, 0, 2, | ||
3997 | params, val); | ||
3998 | if ((val[0] != val[1]) && (ret >= 0)) { | ||
3999 | adap->tids.uotid_base = val[0]; | ||
4000 | adap->tids.nuotids = val[1] - val[0] + 1; | ||
4001 | } | ||
4002 | |||
4003 | adap->params.offload = 1; | 3975 | adap->params.offload = 1; |
4004 | } | 3976 | } |
4005 | if (caps_cmd.rdmacaps) { | 3977 | if (caps_cmd.rdmacaps) { |
@@ -4048,7 +4020,6 @@ static int adap_init0(struct adapter *adap) | |||
4048 | } | 4020 | } |
4049 | #undef FW_PARAM_PFVF | 4021 | #undef FW_PARAM_PFVF |
4050 | #undef FW_PARAM_DEV | 4022 | #undef FW_PARAM_DEV |
4051 | #endif /* CONFIG_CHELSIO_T4_OFFLOAD */ | ||
4052 | 4023 | ||
4053 | /* | 4024 | /* |
4054 | * These are finalized by FW initialization, load their values now. | 4025 | * These are finalized by FW initialization, load their values now. |
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.h b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.h index 1b899fea1a91..39bec73ff87c 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.h +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.h | |||
@@ -102,6 +102,9 @@ struct tid_info { | |||
102 | unsigned int ftid_base; | 102 | unsigned int ftid_base; |
103 | unsigned int aftid_base; | 103 | unsigned int aftid_base; |
104 | unsigned int aftid_end; | 104 | unsigned int aftid_end; |
105 | /* Server filter region */ | ||
106 | unsigned int sftid_base; | ||
107 | unsigned int nsftids; | ||
105 | 108 | ||
106 | spinlock_t atid_lock ____cacheline_aligned_in_smp; | 109 | spinlock_t atid_lock ____cacheline_aligned_in_smp; |
107 | union aopen_entry *afree; | 110 | union aopen_entry *afree; |
diff --git a/drivers/net/ethernet/freescale/gianfar_ptp.c b/drivers/net/ethernet/freescale/gianfar_ptp.c index b9db0e040563..2e5daee0438a 100644 --- a/drivers/net/ethernet/freescale/gianfar_ptp.c +++ b/drivers/net/ethernet/freescale/gianfar_ptp.c | |||
@@ -478,7 +478,7 @@ static int gianfar_ptp_probe(struct platform_device *dev) | |||
478 | pr_err("no resource\n"); | 478 | pr_err("no resource\n"); |
479 | goto no_resource; | 479 | goto no_resource; |
480 | } | 480 | } |
481 | if (request_resource(&ioport_resource, etsects->rsrc)) { | 481 | if (request_resource(&iomem_resource, etsects->rsrc)) { |
482 | pr_err("resource busy\n"); | 482 | pr_err("resource busy\n"); |
483 | goto no_resource; | 483 | goto no_resource; |
484 | } | 484 | } |
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c index 56b20d17d0e4..116f0e901bee 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c | |||
@@ -2673,6 +2673,9 @@ static int ixgbe_get_ts_info(struct net_device *dev, | |||
2673 | case ixgbe_mac_X540: | 2673 | case ixgbe_mac_X540: |
2674 | case ixgbe_mac_82599EB: | 2674 | case ixgbe_mac_82599EB: |
2675 | info->so_timestamping = | 2675 | info->so_timestamping = |
2676 | SOF_TIMESTAMPING_TX_SOFTWARE | | ||
2677 | SOF_TIMESTAMPING_RX_SOFTWARE | | ||
2678 | SOF_TIMESTAMPING_SOFTWARE | | ||
2676 | SOF_TIMESTAMPING_TX_HARDWARE | | 2679 | SOF_TIMESTAMPING_TX_HARDWARE | |
2677 | SOF_TIMESTAMPING_RX_HARDWARE | | 2680 | SOF_TIMESTAMPING_RX_HARDWARE | |
2678 | SOF_TIMESTAMPING_RAW_HARDWARE; | 2681 | SOF_TIMESTAMPING_RAW_HARDWARE; |
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_tx.c b/drivers/net/ethernet/mellanox/mlx4/en_tx.c index c10e3a6de09f..b35094c590ba 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_tx.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_tx.c | |||
@@ -143,7 +143,6 @@ void mlx4_en_destroy_tx_ring(struct mlx4_en_priv *priv, | |||
143 | mlx4_bf_free(mdev->dev, &ring->bf); | 143 | mlx4_bf_free(mdev->dev, &ring->bf); |
144 | mlx4_qp_remove(mdev->dev, &ring->qp); | 144 | mlx4_qp_remove(mdev->dev, &ring->qp); |
145 | mlx4_qp_free(mdev->dev, &ring->qp); | 145 | mlx4_qp_free(mdev->dev, &ring->qp); |
146 | mlx4_qp_release_range(mdev->dev, ring->qpn, 1); | ||
147 | mlx4_en_unmap_buffer(&ring->wqres.buf); | 146 | mlx4_en_unmap_buffer(&ring->wqres.buf); |
148 | mlx4_free_hwq_res(mdev->dev, &ring->wqres, ring->buf_size); | 147 | mlx4_free_hwq_res(mdev->dev, &ring->wqres, ring->buf_size); |
149 | kfree(ring->bounce_buf); | 148 | kfree(ring->bounce_buf); |
@@ -712,7 +711,7 @@ netdev_tx_t mlx4_en_xmit(struct sk_buff *skb, struct net_device *dev) | |||
712 | if (bounce) | 711 | if (bounce) |
713 | tx_desc = mlx4_en_bounce_to_desc(priv, ring, index, desc_size); | 712 | tx_desc = mlx4_en_bounce_to_desc(priv, ring, index, desc_size); |
714 | 713 | ||
715 | if (ring->bf_enabled && desc_size <= MAX_BF && !bounce && !vlan_tag) { | 714 | if (ring->bf_enabled && desc_size <= MAX_BF && !bounce && !vlan_tx_tag_present(skb)) { |
716 | *(__be32 *) (&tx_desc->ctrl.vlan_tag) |= cpu_to_be32(ring->doorbell_qpn); | 715 | *(__be32 *) (&tx_desc->ctrl.vlan_tag) |= cpu_to_be32(ring->doorbell_qpn); |
717 | op_own |= htonl((bf_index & 0xffff) << 8); | 716 | op_own |= htonl((bf_index & 0xffff) << 8); |
718 | /* Ensure new descirptor hits memory | 717 | /* Ensure new descirptor hits memory |
diff --git a/drivers/net/ethernet/mellanox/mlx4/eq.c b/drivers/net/ethernet/mellanox/mlx4/eq.c index 51c764901ad2..b84a88bc44dc 100644 --- a/drivers/net/ethernet/mellanox/mlx4/eq.c +++ b/drivers/net/ethernet/mellanox/mlx4/eq.c | |||
@@ -329,9 +329,6 @@ int set_and_calc_slave_port_state(struct mlx4_dev *dev, int slave, | |||
329 | ctx = &priv->mfunc.master.slave_state[slave]; | 329 | ctx = &priv->mfunc.master.slave_state[slave]; |
330 | spin_lock_irqsave(&ctx->lock, flags); | 330 | spin_lock_irqsave(&ctx->lock, flags); |
331 | 331 | ||
332 | mlx4_dbg(dev, "%s: slave: %d, current state: %d new event :%d\n", | ||
333 | __func__, slave, cur_state, event); | ||
334 | |||
335 | switch (cur_state) { | 332 | switch (cur_state) { |
336 | case SLAVE_PORT_DOWN: | 333 | case SLAVE_PORT_DOWN: |
337 | if (MLX4_PORT_STATE_DEV_EVENT_PORT_UP == event) | 334 | if (MLX4_PORT_STATE_DEV_EVENT_PORT_UP == event) |
@@ -366,9 +363,6 @@ int set_and_calc_slave_port_state(struct mlx4_dev *dev, int slave, | |||
366 | goto out; | 363 | goto out; |
367 | } | 364 | } |
368 | ret = mlx4_get_slave_port_state(dev, slave, port); | 365 | ret = mlx4_get_slave_port_state(dev, slave, port); |
369 | mlx4_dbg(dev, "%s: slave: %d, current state: %d new event" | ||
370 | " :%d gen_event: %d\n", | ||
371 | __func__, slave, cur_state, event, *gen_event); | ||
372 | 366 | ||
373 | out: | 367 | out: |
374 | spin_unlock_irqrestore(&ctx->lock, flags); | 368 | spin_unlock_irqrestore(&ctx->lock, flags); |
@@ -843,6 +837,18 @@ static void __iomem *mlx4_get_eq_uar(struct mlx4_dev *dev, struct mlx4_eq *eq) | |||
843 | return priv->eq_table.uar_map[index] + 0x800 + 8 * (eq->eqn % 4); | 837 | return priv->eq_table.uar_map[index] + 0x800 + 8 * (eq->eqn % 4); |
844 | } | 838 | } |
845 | 839 | ||
840 | static void mlx4_unmap_uar(struct mlx4_dev *dev) | ||
841 | { | ||
842 | struct mlx4_priv *priv = mlx4_priv(dev); | ||
843 | int i; | ||
844 | |||
845 | for (i = 0; i < mlx4_num_eq_uar(dev); ++i) | ||
846 | if (priv->eq_table.uar_map[i]) { | ||
847 | iounmap(priv->eq_table.uar_map[i]); | ||
848 | priv->eq_table.uar_map[i] = NULL; | ||
849 | } | ||
850 | } | ||
851 | |||
846 | static int mlx4_create_eq(struct mlx4_dev *dev, int nent, | 852 | static int mlx4_create_eq(struct mlx4_dev *dev, int nent, |
847 | u8 intr, struct mlx4_eq *eq) | 853 | u8 intr, struct mlx4_eq *eq) |
848 | { | 854 | { |
@@ -1207,6 +1213,7 @@ err_out_unmap: | |||
1207 | mlx4_free_irqs(dev); | 1213 | mlx4_free_irqs(dev); |
1208 | 1214 | ||
1209 | err_out_bitmap: | 1215 | err_out_bitmap: |
1216 | mlx4_unmap_uar(dev); | ||
1210 | mlx4_bitmap_cleanup(&priv->eq_table.bitmap); | 1217 | mlx4_bitmap_cleanup(&priv->eq_table.bitmap); |
1211 | 1218 | ||
1212 | err_out_free: | 1219 | err_out_free: |
@@ -1231,10 +1238,7 @@ void mlx4_cleanup_eq_table(struct mlx4_dev *dev) | |||
1231 | if (!mlx4_is_slave(dev)) | 1238 | if (!mlx4_is_slave(dev)) |
1232 | mlx4_unmap_clr_int(dev); | 1239 | mlx4_unmap_clr_int(dev); |
1233 | 1240 | ||
1234 | for (i = 0; i < mlx4_num_eq_uar(dev); ++i) | 1241 | mlx4_unmap_uar(dev); |
1235 | if (priv->eq_table.uar_map[i]) | ||
1236 | iounmap(priv->eq_table.uar_map[i]); | ||
1237 | |||
1238 | mlx4_bitmap_cleanup(&priv->eq_table.bitmap); | 1242 | mlx4_bitmap_cleanup(&priv->eq_table.bitmap); |
1239 | 1243 | ||
1240 | kfree(priv->eq_table.uar_map); | 1244 | kfree(priv->eq_table.uar_map); |
diff --git a/drivers/net/ethernet/mellanox/mlx4/main.c b/drivers/net/ethernet/mellanox/mlx4/main.c index 80df2ab0177c..2aa80afd98d2 100644 --- a/drivers/net/ethernet/mellanox/mlx4/main.c +++ b/drivers/net/ethernet/mellanox/mlx4/main.c | |||
@@ -1405,7 +1405,10 @@ unmap_bf: | |||
1405 | unmap_bf_area(dev); | 1405 | unmap_bf_area(dev); |
1406 | 1406 | ||
1407 | err_close: | 1407 | err_close: |
1408 | mlx4_close_hca(dev); | 1408 | if (mlx4_is_slave(dev)) |
1409 | mlx4_slave_exit(dev); | ||
1410 | else | ||
1411 | mlx4_CLOSE_HCA(dev, 0); | ||
1409 | 1412 | ||
1410 | err_free_icm: | 1413 | err_free_icm: |
1411 | if (!mlx4_is_slave(dev)) | 1414 | if (!mlx4_is_slave(dev)) |
diff --git a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c index 926c911c0ac4..b05705f50f0f 100644 --- a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c +++ b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c | |||
@@ -330,9 +330,6 @@ static void update_pkey_index(struct mlx4_dev *dev, int slave, | |||
330 | 330 | ||
331 | new_index = priv->virt2phys_pkey[slave][port - 1][orig_index]; | 331 | new_index = priv->virt2phys_pkey[slave][port - 1][orig_index]; |
332 | *(u8 *)(inbox->buf + 35) = new_index; | 332 | *(u8 *)(inbox->buf + 35) = new_index; |
333 | |||
334 | mlx4_dbg(dev, "port = %d, orig pkey index = %d, " | ||
335 | "new pkey index = %d\n", port, orig_index, new_index); | ||
336 | } | 333 | } |
337 | 334 | ||
338 | static void update_gid(struct mlx4_dev *dev, struct mlx4_cmd_mailbox *inbox, | 335 | static void update_gid(struct mlx4_dev *dev, struct mlx4_cmd_mailbox *inbox, |
@@ -351,9 +348,6 @@ static void update_gid(struct mlx4_dev *dev, struct mlx4_cmd_mailbox *inbox, | |||
351 | if (optpar & MLX4_QP_OPTPAR_ALT_ADDR_PATH) | 348 | if (optpar & MLX4_QP_OPTPAR_ALT_ADDR_PATH) |
352 | qp_ctx->alt_path.mgid_index = slave & 0x7F; | 349 | qp_ctx->alt_path.mgid_index = slave & 0x7F; |
353 | } | 350 | } |
354 | |||
355 | mlx4_dbg(dev, "slave %d, new gid index: 0x%x ", | ||
356 | slave, qp_ctx->pri_path.mgid_index); | ||
357 | } | 351 | } |
358 | 352 | ||
359 | static int mpt_mask(struct mlx4_dev *dev) | 353 | static int mpt_mask(struct mlx4_dev *dev) |
diff --git a/drivers/net/ethernet/nxp/lpc_eth.c b/drivers/net/ethernet/nxp/lpc_eth.c index 53743f7a2ca9..af8b4142088c 100644 --- a/drivers/net/ethernet/nxp/lpc_eth.c +++ b/drivers/net/ethernet/nxp/lpc_eth.c | |||
@@ -1524,6 +1524,7 @@ static int lpc_eth_drv_remove(struct platform_device *pdev) | |||
1524 | pldat->dma_buff_base_p); | 1524 | pldat->dma_buff_base_p); |
1525 | free_irq(ndev->irq, ndev); | 1525 | free_irq(ndev->irq, ndev); |
1526 | iounmap(pldat->net_base); | 1526 | iounmap(pldat->net_base); |
1527 | mdiobus_unregister(pldat->mii_bus); | ||
1527 | mdiobus_free(pldat->mii_bus); | 1528 | mdiobus_free(pldat->mii_bus); |
1528 | clk_disable(pldat->clk); | 1529 | clk_disable(pldat->clk); |
1529 | clk_put(pldat->clk); | 1530 | clk_put(pldat->clk); |
diff --git a/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c b/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c index b2a94d02a521..4c4fe5b1a29a 100644 --- a/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c +++ b/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c | |||
@@ -339,26 +339,6 @@ static void pch_gbe_wait_clr_bit(void *reg, u32 bit) | |||
339 | } | 339 | } |
340 | 340 | ||
341 | /** | 341 | /** |
342 | * pch_gbe_wait_clr_bit_irq - Wait to clear a bit for interrupt context | ||
343 | * @reg: Pointer of register | ||
344 | * @busy: Busy bit | ||
345 | */ | ||
346 | static int pch_gbe_wait_clr_bit_irq(void *reg, u32 bit) | ||
347 | { | ||
348 | u32 tmp; | ||
349 | int ret = -1; | ||
350 | /* wait busy */ | ||
351 | tmp = 20; | ||
352 | while ((ioread32(reg) & bit) && --tmp) | ||
353 | udelay(5); | ||
354 | if (!tmp) | ||
355 | pr_err("Error: busy bit is not cleared\n"); | ||
356 | else | ||
357 | ret = 0; | ||
358 | return ret; | ||
359 | } | ||
360 | |||
361 | /** | ||
362 | * pch_gbe_mac_mar_set - Set MAC address register | 342 | * pch_gbe_mac_mar_set - Set MAC address register |
363 | * @hw: Pointer to the HW structure | 343 | * @hw: Pointer to the HW structure |
364 | * @addr: Pointer to the MAC address | 344 | * @addr: Pointer to the MAC address |
@@ -409,15 +389,20 @@ static void pch_gbe_mac_reset_hw(struct pch_gbe_hw *hw) | |||
409 | return; | 389 | return; |
410 | } | 390 | } |
411 | 391 | ||
412 | static void pch_gbe_mac_reset_rx(struct pch_gbe_hw *hw) | 392 | static void pch_gbe_disable_mac_rx(struct pch_gbe_hw *hw) |
413 | { | 393 | { |
414 | /* Read the MAC addresses. and store to the private data */ | 394 | u32 rctl; |
415 | pch_gbe_mac_read_mac_addr(hw); | 395 | /* Disables Receive MAC */ |
416 | iowrite32(PCH_GBE_RX_RST, &hw->reg->RESET); | 396 | rctl = ioread32(&hw->reg->MAC_RX_EN); |
417 | pch_gbe_wait_clr_bit_irq(&hw->reg->RESET, PCH_GBE_RX_RST); | 397 | iowrite32((rctl & ~PCH_GBE_MRE_MAC_RX_EN), &hw->reg->MAC_RX_EN); |
418 | /* Setup the MAC addresses */ | 398 | } |
419 | pch_gbe_mac_mar_set(hw, hw->mac.addr, 0); | 399 | |
420 | return; | 400 | static void pch_gbe_enable_mac_rx(struct pch_gbe_hw *hw) |
401 | { | ||
402 | u32 rctl; | ||
403 | /* Enables Receive MAC */ | ||
404 | rctl = ioread32(&hw->reg->MAC_RX_EN); | ||
405 | iowrite32((rctl | PCH_GBE_MRE_MAC_RX_EN), &hw->reg->MAC_RX_EN); | ||
421 | } | 406 | } |
422 | 407 | ||
423 | /** | 408 | /** |
@@ -913,7 +898,7 @@ static void pch_gbe_setup_rctl(struct pch_gbe_adapter *adapter) | |||
913 | static void pch_gbe_configure_rx(struct pch_gbe_adapter *adapter) | 898 | static void pch_gbe_configure_rx(struct pch_gbe_adapter *adapter) |
914 | { | 899 | { |
915 | struct pch_gbe_hw *hw = &adapter->hw; | 900 | struct pch_gbe_hw *hw = &adapter->hw; |
916 | u32 rdba, rdlen, rctl, rxdma; | 901 | u32 rdba, rdlen, rxdma; |
917 | 902 | ||
918 | pr_debug("dma adr = 0x%08llx size = 0x%08x\n", | 903 | pr_debug("dma adr = 0x%08llx size = 0x%08x\n", |
919 | (unsigned long long)adapter->rx_ring->dma, | 904 | (unsigned long long)adapter->rx_ring->dma, |
@@ -921,9 +906,7 @@ static void pch_gbe_configure_rx(struct pch_gbe_adapter *adapter) | |||
921 | 906 | ||
922 | pch_gbe_mac_force_mac_fc(hw); | 907 | pch_gbe_mac_force_mac_fc(hw); |
923 | 908 | ||
924 | /* Disables Receive MAC */ | 909 | pch_gbe_disable_mac_rx(hw); |
925 | rctl = ioread32(&hw->reg->MAC_RX_EN); | ||
926 | iowrite32((rctl & ~PCH_GBE_MRE_MAC_RX_EN), &hw->reg->MAC_RX_EN); | ||
927 | 910 | ||
928 | /* Disables Receive DMA */ | 911 | /* Disables Receive DMA */ |
929 | rxdma = ioread32(&hw->reg->DMA_CTRL); | 912 | rxdma = ioread32(&hw->reg->DMA_CTRL); |
@@ -1316,38 +1299,17 @@ void pch_gbe_update_stats(struct pch_gbe_adapter *adapter) | |||
1316 | spin_unlock_irqrestore(&adapter->stats_lock, flags); | 1299 | spin_unlock_irqrestore(&adapter->stats_lock, flags); |
1317 | } | 1300 | } |
1318 | 1301 | ||
1319 | static void pch_gbe_stop_receive(struct pch_gbe_adapter *adapter) | 1302 | static void pch_gbe_disable_dma_rx(struct pch_gbe_hw *hw) |
1320 | { | 1303 | { |
1321 | struct pch_gbe_hw *hw = &adapter->hw; | ||
1322 | u32 rxdma; | 1304 | u32 rxdma; |
1323 | u16 value; | ||
1324 | int ret; | ||
1325 | 1305 | ||
1326 | /* Disable Receive DMA */ | 1306 | /* Disable Receive DMA */ |
1327 | rxdma = ioread32(&hw->reg->DMA_CTRL); | 1307 | rxdma = ioread32(&hw->reg->DMA_CTRL); |
1328 | rxdma &= ~PCH_GBE_RX_DMA_EN; | 1308 | rxdma &= ~PCH_GBE_RX_DMA_EN; |
1329 | iowrite32(rxdma, &hw->reg->DMA_CTRL); | 1309 | iowrite32(rxdma, &hw->reg->DMA_CTRL); |
1330 | /* Wait Rx DMA BUS is IDLE */ | ||
1331 | ret = pch_gbe_wait_clr_bit_irq(&hw->reg->RX_DMA_ST, PCH_GBE_IDLE_CHECK); | ||
1332 | if (ret) { | ||
1333 | /* Disable Bus master */ | ||
1334 | pci_read_config_word(adapter->pdev, PCI_COMMAND, &value); | ||
1335 | value &= ~PCI_COMMAND_MASTER; | ||
1336 | pci_write_config_word(adapter->pdev, PCI_COMMAND, value); | ||
1337 | /* Stop Receive */ | ||
1338 | pch_gbe_mac_reset_rx(hw); | ||
1339 | /* Enable Bus master */ | ||
1340 | value |= PCI_COMMAND_MASTER; | ||
1341 | pci_write_config_word(adapter->pdev, PCI_COMMAND, value); | ||
1342 | } else { | ||
1343 | /* Stop Receive */ | ||
1344 | pch_gbe_mac_reset_rx(hw); | ||
1345 | } | ||
1346 | /* reprogram multicast address register after reset */ | ||
1347 | pch_gbe_set_multi(adapter->netdev); | ||
1348 | } | 1310 | } |
1349 | 1311 | ||
1350 | static void pch_gbe_start_receive(struct pch_gbe_hw *hw) | 1312 | static void pch_gbe_enable_dma_rx(struct pch_gbe_hw *hw) |
1351 | { | 1313 | { |
1352 | u32 rxdma; | 1314 | u32 rxdma; |
1353 | 1315 | ||
@@ -1355,9 +1317,6 @@ static void pch_gbe_start_receive(struct pch_gbe_hw *hw) | |||
1355 | rxdma = ioread32(&hw->reg->DMA_CTRL); | 1317 | rxdma = ioread32(&hw->reg->DMA_CTRL); |
1356 | rxdma |= PCH_GBE_RX_DMA_EN; | 1318 | rxdma |= PCH_GBE_RX_DMA_EN; |
1357 | iowrite32(rxdma, &hw->reg->DMA_CTRL); | 1319 | iowrite32(rxdma, &hw->reg->DMA_CTRL); |
1358 | /* Enables Receive */ | ||
1359 | iowrite32(PCH_GBE_MRE_MAC_RX_EN, &hw->reg->MAC_RX_EN); | ||
1360 | return; | ||
1361 | } | 1320 | } |
1362 | 1321 | ||
1363 | /** | 1322 | /** |
@@ -1393,7 +1352,7 @@ static irqreturn_t pch_gbe_intr(int irq, void *data) | |||
1393 | int_en = ioread32(&hw->reg->INT_EN); | 1352 | int_en = ioread32(&hw->reg->INT_EN); |
1394 | iowrite32((int_en & ~PCH_GBE_INT_RX_FIFO_ERR), | 1353 | iowrite32((int_en & ~PCH_GBE_INT_RX_FIFO_ERR), |
1395 | &hw->reg->INT_EN); | 1354 | &hw->reg->INT_EN); |
1396 | pch_gbe_stop_receive(adapter); | 1355 | pch_gbe_disable_dma_rx(&adapter->hw); |
1397 | int_st |= ioread32(&hw->reg->INT_ST); | 1356 | int_st |= ioread32(&hw->reg->INT_ST); |
1398 | int_st = int_st & ioread32(&hw->reg->INT_EN); | 1357 | int_st = int_st & ioread32(&hw->reg->INT_EN); |
1399 | } | 1358 | } |
@@ -1971,12 +1930,12 @@ int pch_gbe_up(struct pch_gbe_adapter *adapter) | |||
1971 | struct net_device *netdev = adapter->netdev; | 1930 | struct net_device *netdev = adapter->netdev; |
1972 | struct pch_gbe_tx_ring *tx_ring = adapter->tx_ring; | 1931 | struct pch_gbe_tx_ring *tx_ring = adapter->tx_ring; |
1973 | struct pch_gbe_rx_ring *rx_ring = adapter->rx_ring; | 1932 | struct pch_gbe_rx_ring *rx_ring = adapter->rx_ring; |
1974 | int err; | 1933 | int err = -EINVAL; |
1975 | 1934 | ||
1976 | /* Ensure we have a valid MAC */ | 1935 | /* Ensure we have a valid MAC */ |
1977 | if (!is_valid_ether_addr(adapter->hw.mac.addr)) { | 1936 | if (!is_valid_ether_addr(adapter->hw.mac.addr)) { |
1978 | pr_err("Error: Invalid MAC address\n"); | 1937 | pr_err("Error: Invalid MAC address\n"); |
1979 | return -EINVAL; | 1938 | goto out; |
1980 | } | 1939 | } |
1981 | 1940 | ||
1982 | /* hardware has been reset, we need to reload some things */ | 1941 | /* hardware has been reset, we need to reload some things */ |
@@ -1989,18 +1948,19 @@ int pch_gbe_up(struct pch_gbe_adapter *adapter) | |||
1989 | 1948 | ||
1990 | err = pch_gbe_request_irq(adapter); | 1949 | err = pch_gbe_request_irq(adapter); |
1991 | if (err) { | 1950 | if (err) { |
1992 | pr_err("Error: can't bring device up\n"); | 1951 | pr_err("Error: can't bring device up - irq request failed\n"); |
1993 | return err; | 1952 | goto out; |
1994 | } | 1953 | } |
1995 | err = pch_gbe_alloc_rx_buffers_pool(adapter, rx_ring, rx_ring->count); | 1954 | err = pch_gbe_alloc_rx_buffers_pool(adapter, rx_ring, rx_ring->count); |
1996 | if (err) { | 1955 | if (err) { |
1997 | pr_err("Error: can't bring device up\n"); | 1956 | pr_err("Error: can't bring device up - alloc rx buffers pool failed\n"); |
1998 | return err; | 1957 | goto freeirq; |
1999 | } | 1958 | } |
2000 | pch_gbe_alloc_tx_buffers(adapter, tx_ring); | 1959 | pch_gbe_alloc_tx_buffers(adapter, tx_ring); |
2001 | pch_gbe_alloc_rx_buffers(adapter, rx_ring, rx_ring->count); | 1960 | pch_gbe_alloc_rx_buffers(adapter, rx_ring, rx_ring->count); |
2002 | adapter->tx_queue_len = netdev->tx_queue_len; | 1961 | adapter->tx_queue_len = netdev->tx_queue_len; |
2003 | pch_gbe_start_receive(&adapter->hw); | 1962 | pch_gbe_enable_dma_rx(&adapter->hw); |
1963 | pch_gbe_enable_mac_rx(&adapter->hw); | ||
2004 | 1964 | ||
2005 | mod_timer(&adapter->watchdog_timer, jiffies); | 1965 | mod_timer(&adapter->watchdog_timer, jiffies); |
2006 | 1966 | ||
@@ -2009,6 +1969,11 @@ int pch_gbe_up(struct pch_gbe_adapter *adapter) | |||
2009 | netif_start_queue(adapter->netdev); | 1969 | netif_start_queue(adapter->netdev); |
2010 | 1970 | ||
2011 | return 0; | 1971 | return 0; |
1972 | |||
1973 | freeirq: | ||
1974 | pch_gbe_free_irq(adapter); | ||
1975 | out: | ||
1976 | return err; | ||
2012 | } | 1977 | } |
2013 | 1978 | ||
2014 | /** | 1979 | /** |
@@ -2405,7 +2370,6 @@ static int pch_gbe_napi_poll(struct napi_struct *napi, int budget) | |||
2405 | int work_done = 0; | 2370 | int work_done = 0; |
2406 | bool poll_end_flag = false; | 2371 | bool poll_end_flag = false; |
2407 | bool cleaned = false; | 2372 | bool cleaned = false; |
2408 | u32 int_en; | ||
2409 | 2373 | ||
2410 | pr_debug("budget : %d\n", budget); | 2374 | pr_debug("budget : %d\n", budget); |
2411 | 2375 | ||
@@ -2422,19 +2386,13 @@ static int pch_gbe_napi_poll(struct napi_struct *napi, int budget) | |||
2422 | 2386 | ||
2423 | if (poll_end_flag) { | 2387 | if (poll_end_flag) { |
2424 | napi_complete(napi); | 2388 | napi_complete(napi); |
2425 | if (adapter->rx_stop_flag) { | ||
2426 | adapter->rx_stop_flag = false; | ||
2427 | pch_gbe_start_receive(&adapter->hw); | ||
2428 | } | ||
2429 | pch_gbe_irq_enable(adapter); | 2389 | pch_gbe_irq_enable(adapter); |
2430 | } else | 2390 | } |
2431 | if (adapter->rx_stop_flag) { | 2391 | |
2432 | adapter->rx_stop_flag = false; | 2392 | if (adapter->rx_stop_flag) { |
2433 | pch_gbe_start_receive(&adapter->hw); | 2393 | adapter->rx_stop_flag = false; |
2434 | int_en = ioread32(&adapter->hw.reg->INT_EN); | 2394 | pch_gbe_enable_dma_rx(&adapter->hw); |
2435 | iowrite32((int_en | PCH_GBE_INT_RX_FIFO_ERR), | 2395 | } |
2436 | &adapter->hw.reg->INT_EN); | ||
2437 | } | ||
2438 | 2396 | ||
2439 | pr_debug("poll_end_flag : %d work_done : %d budget : %d\n", | 2397 | pr_debug("poll_end_flag : %d work_done : %d budget : %d\n", |
2440 | poll_end_flag, work_done, budget); | 2398 | poll_end_flag, work_done, budget); |
diff --git a/drivers/net/ethernet/qlogic/qla3xxx.c b/drivers/net/ethernet/qlogic/qla3xxx.c index df09b1cb742f..6407d0d77e81 100644 --- a/drivers/net/ethernet/qlogic/qla3xxx.c +++ b/drivers/net/ethernet/qlogic/qla3xxx.c | |||
@@ -2525,6 +2525,13 @@ static int ql_alloc_net_req_rsp_queues(struct ql3_adapter *qdev) | |||
2525 | qdev->req_q_size = | 2525 | qdev->req_q_size = |
2526 | (u32) (NUM_REQ_Q_ENTRIES * sizeof(struct ob_mac_iocb_req)); | 2526 | (u32) (NUM_REQ_Q_ENTRIES * sizeof(struct ob_mac_iocb_req)); |
2527 | 2527 | ||
2528 | qdev->rsp_q_size = NUM_RSP_Q_ENTRIES * sizeof(struct net_rsp_iocb); | ||
2529 | |||
2530 | /* The barrier is required to ensure request and response queue | ||
2531 | * addr writes to the registers. | ||
2532 | */ | ||
2533 | wmb(); | ||
2534 | |||
2528 | qdev->req_q_virt_addr = | 2535 | qdev->req_q_virt_addr = |
2529 | pci_alloc_consistent(qdev->pdev, | 2536 | pci_alloc_consistent(qdev->pdev, |
2530 | (size_t) qdev->req_q_size, | 2537 | (size_t) qdev->req_q_size, |
@@ -2536,8 +2543,6 @@ static int ql_alloc_net_req_rsp_queues(struct ql3_adapter *qdev) | |||
2536 | return -ENOMEM; | 2543 | return -ENOMEM; |
2537 | } | 2544 | } |
2538 | 2545 | ||
2539 | qdev->rsp_q_size = NUM_RSP_Q_ENTRIES * sizeof(struct net_rsp_iocb); | ||
2540 | |||
2541 | qdev->rsp_q_virt_addr = | 2546 | qdev->rsp_q_virt_addr = |
2542 | pci_alloc_consistent(qdev->pdev, | 2547 | pci_alloc_consistent(qdev->pdev, |
2543 | (size_t) qdev->rsp_q_size, | 2548 | (size_t) qdev->rsp_q_size, |
diff --git a/drivers/net/ethernet/ti/Kconfig b/drivers/net/ethernet/ti/Kconfig index b26cbda5efa9..2c41894d5472 100644 --- a/drivers/net/ethernet/ti/Kconfig +++ b/drivers/net/ethernet/ti/Kconfig | |||
@@ -5,7 +5,7 @@ | |||
5 | config NET_VENDOR_TI | 5 | config NET_VENDOR_TI |
6 | bool "Texas Instruments (TI) devices" | 6 | bool "Texas Instruments (TI) devices" |
7 | default y | 7 | default y |
8 | depends on PCI || EISA || AR7 || (ARM && (ARCH_DAVINCI || ARCH_OMAP3)) | 8 | depends on PCI || EISA || AR7 || (ARM && (ARCH_DAVINCI || ARCH_OMAP3 || SOC_AM33XX)) |
9 | ---help--- | 9 | ---help--- |
10 | If you have a network (Ethernet) card belonging to this class, say Y | 10 | If you have a network (Ethernet) card belonging to this class, say Y |
11 | and read the Ethernet-HOWTO, available from | 11 | and read the Ethernet-HOWTO, available from |
diff --git a/drivers/net/ethernet/tile/tilegx.c b/drivers/net/ethernet/tile/tilegx.c index 4e2a1628484d..4e9810013850 100644 --- a/drivers/net/ethernet/tile/tilegx.c +++ b/drivers/net/ethernet/tile/tilegx.c | |||
@@ -1334,11 +1334,11 @@ static int tso_count_edescs(struct sk_buff *skb) | |||
1334 | { | 1334 | { |
1335 | struct skb_shared_info *sh = skb_shinfo(skb); | 1335 | struct skb_shared_info *sh = skb_shinfo(skb); |
1336 | unsigned int sh_len = skb_transport_offset(skb) + tcp_hdrlen(skb); | 1336 | unsigned int sh_len = skb_transport_offset(skb) + tcp_hdrlen(skb); |
1337 | unsigned int data_len = skb->data_len + skb->hdr_len - sh_len; | 1337 | unsigned int data_len = skb->len - sh_len; |
1338 | unsigned int p_len = sh->gso_size; | 1338 | unsigned int p_len = sh->gso_size; |
1339 | long f_id = -1; /* id of the current fragment */ | 1339 | long f_id = -1; /* id of the current fragment */ |
1340 | long f_size = skb->hdr_len; /* size of the current fragment */ | 1340 | long f_size = skb_headlen(skb) - sh_len; /* current fragment size */ |
1341 | long f_used = sh_len; /* bytes used from the current fragment */ | 1341 | long f_used = 0; /* bytes used from the current fragment */ |
1342 | long n; /* size of the current piece of payload */ | 1342 | long n; /* size of the current piece of payload */ |
1343 | int num_edescs = 0; | 1343 | int num_edescs = 0; |
1344 | int segment; | 1344 | int segment; |
@@ -1353,7 +1353,7 @@ static int tso_count_edescs(struct sk_buff *skb) | |||
1353 | /* Advance as needed. */ | 1353 | /* Advance as needed. */ |
1354 | while (f_used >= f_size) { | 1354 | while (f_used >= f_size) { |
1355 | f_id++; | 1355 | f_id++; |
1356 | f_size = sh->frags[f_id].size; | 1356 | f_size = skb_frag_size(&sh->frags[f_id]); |
1357 | f_used = 0; | 1357 | f_used = 0; |
1358 | } | 1358 | } |
1359 | 1359 | ||
@@ -1384,13 +1384,13 @@ static void tso_headers_prepare(struct sk_buff *skb, unsigned char *headers, | |||
1384 | struct iphdr *ih; | 1384 | struct iphdr *ih; |
1385 | struct tcphdr *th; | 1385 | struct tcphdr *th; |
1386 | unsigned int sh_len = skb_transport_offset(skb) + tcp_hdrlen(skb); | 1386 | unsigned int sh_len = skb_transport_offset(skb) + tcp_hdrlen(skb); |
1387 | unsigned int data_len = skb->data_len + skb->hdr_len - sh_len; | 1387 | unsigned int data_len = skb->len - sh_len; |
1388 | unsigned char *data = skb->data; | 1388 | unsigned char *data = skb->data; |
1389 | unsigned int ih_off, th_off, p_len; | 1389 | unsigned int ih_off, th_off, p_len; |
1390 | unsigned int isum_seed, tsum_seed, id, seq; | 1390 | unsigned int isum_seed, tsum_seed, id, seq; |
1391 | long f_id = -1; /* id of the current fragment */ | 1391 | long f_id = -1; /* id of the current fragment */ |
1392 | long f_size = skb->hdr_len; /* size of the current fragment */ | 1392 | long f_size = skb_headlen(skb) - sh_len; /* current fragment size */ |
1393 | long f_used = sh_len; /* bytes used from the current fragment */ | 1393 | long f_used = 0; /* bytes used from the current fragment */ |
1394 | long n; /* size of the current piece of payload */ | 1394 | long n; /* size of the current piece of payload */ |
1395 | int segment; | 1395 | int segment; |
1396 | 1396 | ||
@@ -1405,7 +1405,7 @@ static void tso_headers_prepare(struct sk_buff *skb, unsigned char *headers, | |||
1405 | isum_seed = ((0xFFFF - ih->check) + | 1405 | isum_seed = ((0xFFFF - ih->check) + |
1406 | (0xFFFF - ih->tot_len) + | 1406 | (0xFFFF - ih->tot_len) + |
1407 | (0xFFFF - ih->id)); | 1407 | (0xFFFF - ih->id)); |
1408 | tsum_seed = th->check + (0xFFFF ^ htons(sh_len + data_len)); | 1408 | tsum_seed = th->check + (0xFFFF ^ htons(skb->len)); |
1409 | id = ntohs(ih->id); | 1409 | id = ntohs(ih->id); |
1410 | seq = ntohl(th->seq); | 1410 | seq = ntohl(th->seq); |
1411 | 1411 | ||
@@ -1444,7 +1444,7 @@ static void tso_headers_prepare(struct sk_buff *skb, unsigned char *headers, | |||
1444 | /* Advance as needed. */ | 1444 | /* Advance as needed. */ |
1445 | while (f_used >= f_size) { | 1445 | while (f_used >= f_size) { |
1446 | f_id++; | 1446 | f_id++; |
1447 | f_size = sh->frags[f_id].size; | 1447 | f_size = skb_frag_size(&sh->frags[f_id]); |
1448 | f_used = 0; | 1448 | f_used = 0; |
1449 | } | 1449 | } |
1450 | 1450 | ||
@@ -1478,14 +1478,14 @@ static void tso_egress(struct net_device *dev, gxio_mpipe_equeue_t *equeue, | |||
1478 | struct tile_net_priv *priv = netdev_priv(dev); | 1478 | struct tile_net_priv *priv = netdev_priv(dev); |
1479 | struct skb_shared_info *sh = skb_shinfo(skb); | 1479 | struct skb_shared_info *sh = skb_shinfo(skb); |
1480 | unsigned int sh_len = skb_transport_offset(skb) + tcp_hdrlen(skb); | 1480 | unsigned int sh_len = skb_transport_offset(skb) + tcp_hdrlen(skb); |
1481 | unsigned int data_len = skb->data_len + skb->hdr_len - sh_len; | 1481 | unsigned int data_len = skb->len - sh_len; |
1482 | unsigned int p_len = sh->gso_size; | 1482 | unsigned int p_len = sh->gso_size; |
1483 | gxio_mpipe_edesc_t edesc_head = { { 0 } }; | 1483 | gxio_mpipe_edesc_t edesc_head = { { 0 } }; |
1484 | gxio_mpipe_edesc_t edesc_body = { { 0 } }; | 1484 | gxio_mpipe_edesc_t edesc_body = { { 0 } }; |
1485 | long f_id = -1; /* id of the current fragment */ | 1485 | long f_id = -1; /* id of the current fragment */ |
1486 | long f_size = skb->hdr_len; /* size of the current fragment */ | 1486 | long f_size = skb_headlen(skb) - sh_len; /* current fragment size */ |
1487 | long f_used = sh_len; /* bytes used from the current fragment */ | 1487 | long f_used = 0; /* bytes used from the current fragment */ |
1488 | void *f_data = skb->data; | 1488 | void *f_data = skb->data + sh_len; |
1489 | long n; /* size of the current piece of payload */ | 1489 | long n; /* size of the current piece of payload */ |
1490 | unsigned long tx_packets = 0, tx_bytes = 0; | 1490 | unsigned long tx_packets = 0, tx_bytes = 0; |
1491 | unsigned int csum_start; | 1491 | unsigned int csum_start; |
@@ -1516,15 +1516,18 @@ static void tso_egress(struct net_device *dev, gxio_mpipe_equeue_t *equeue, | |||
1516 | 1516 | ||
1517 | /* Egress the payload. */ | 1517 | /* Egress the payload. */ |
1518 | while (p_used < p_len) { | 1518 | while (p_used < p_len) { |
1519 | void *va; | ||
1519 | 1520 | ||
1520 | /* Advance as needed. */ | 1521 | /* Advance as needed. */ |
1521 | while (f_used >= f_size) { | 1522 | while (f_used >= f_size) { |
1522 | f_id++; | 1523 | f_id++; |
1523 | f_size = sh->frags[f_id].size; | 1524 | f_size = skb_frag_size(&sh->frags[f_id]); |
1524 | f_used = 0; | ||
1525 | f_data = tile_net_frag_buf(&sh->frags[f_id]); | 1525 | f_data = tile_net_frag_buf(&sh->frags[f_id]); |
1526 | f_used = 0; | ||
1526 | } | 1527 | } |
1527 | 1528 | ||
1529 | va = f_data + f_used; | ||
1530 | |||
1528 | /* Use bytes from the current fragment. */ | 1531 | /* Use bytes from the current fragment. */ |
1529 | n = p_len - p_used; | 1532 | n = p_len - p_used; |
1530 | if (n > f_size - f_used) | 1533 | if (n > f_size - f_used) |
@@ -1533,7 +1536,7 @@ static void tso_egress(struct net_device *dev, gxio_mpipe_equeue_t *equeue, | |||
1533 | p_used += n; | 1536 | p_used += n; |
1534 | 1537 | ||
1535 | /* Egress a piece of the payload. */ | 1538 | /* Egress a piece of the payload. */ |
1536 | edesc_body.va = va_to_tile_io_addr(f_data) + f_used; | 1539 | edesc_body.va = va_to_tile_io_addr(va); |
1537 | edesc_body.xfer_size = n; | 1540 | edesc_body.xfer_size = n; |
1538 | edesc_body.bound = !(p_used < p_len); | 1541 | edesc_body.bound = !(p_used < p_len); |
1539 | gxio_mpipe_equeue_put_at(equeue, edesc_body, slot); | 1542 | gxio_mpipe_equeue_put_at(equeue, edesc_body, slot); |
diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig index 983bbf4d5ef6..961f0b293913 100644 --- a/drivers/net/phy/Kconfig +++ b/drivers/net/phy/Kconfig | |||
@@ -15,6 +15,11 @@ if PHYLIB | |||
15 | 15 | ||
16 | comment "MII PHY device drivers" | 16 | comment "MII PHY device drivers" |
17 | 17 | ||
18 | config AT803X_PHY | ||
19 | tristate "Drivers for Atheros AT803X PHYs" | ||
20 | ---help--- | ||
21 | Currently supports the AT8030 and AT8035 model | ||
22 | |||
18 | config AMD_PHY | 23 | config AMD_PHY |
19 | tristate "Drivers for the AMD PHYs" | 24 | tristate "Drivers for the AMD PHYs" |
20 | ---help--- | 25 | ---help--- |
diff --git a/drivers/net/phy/Makefile b/drivers/net/phy/Makefile index 426674debae4..9645e389a58d 100644 --- a/drivers/net/phy/Makefile +++ b/drivers/net/phy/Makefile | |||
@@ -25,6 +25,7 @@ obj-$(CONFIG_STE10XP) += ste10Xp.o | |||
25 | obj-$(CONFIG_MICREL_PHY) += micrel.o | 25 | obj-$(CONFIG_MICREL_PHY) += micrel.o |
26 | obj-$(CONFIG_MDIO_OCTEON) += mdio-octeon.o | 26 | obj-$(CONFIG_MDIO_OCTEON) += mdio-octeon.o |
27 | obj-$(CONFIG_MICREL_KS8995MA) += spi_ks8995.o | 27 | obj-$(CONFIG_MICREL_KS8995MA) += spi_ks8995.o |
28 | obj-$(CONFIG_AT803X_PHY) += at803x.o | ||
28 | obj-$(CONFIG_AMD_PHY) += amd.o | 29 | obj-$(CONFIG_AMD_PHY) += amd.o |
29 | obj-$(CONFIG_MDIO_BUS_MUX) += mdio-mux.o | 30 | obj-$(CONFIG_MDIO_BUS_MUX) += mdio-mux.o |
30 | obj-$(CONFIG_MDIO_BUS_MUX_GPIO) += mdio-mux-gpio.o | 31 | obj-$(CONFIG_MDIO_BUS_MUX_GPIO) += mdio-mux-gpio.o |
diff --git a/drivers/net/phy/at803x.c b/drivers/net/phy/at803x.c new file mode 100644 index 000000000000..45cbc10de01c --- /dev/null +++ b/drivers/net/phy/at803x.c | |||
@@ -0,0 +1,176 @@ | |||
1 | /* | ||
2 | * drivers/net/phy/at803x.c | ||
3 | * | ||
4 | * Driver for Atheros 803x PHY | ||
5 | * | ||
6 | * Author: Matus Ujhelyi <ujhelyi.m@gmail.com> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify it | ||
9 | * under the terms of the GNU General Public License as published by the | ||
10 | * Free Software Foundation; either version 2 of the License, or (at your | ||
11 | * option) any later version. | ||
12 | */ | ||
13 | |||
14 | #include <linux/phy.h> | ||
15 | #include <linux/module.h> | ||
16 | #include <linux/string.h> | ||
17 | #include <linux/netdevice.h> | ||
18 | #include <linux/etherdevice.h> | ||
19 | |||
20 | #define AT803X_INTR_ENABLE 0x12 | ||
21 | #define AT803X_INTR_STATUS 0x13 | ||
22 | #define AT803X_WOL_ENABLE 0x01 | ||
23 | #define AT803X_DEVICE_ADDR 0x03 | ||
24 | #define AT803X_LOC_MAC_ADDR_0_15_OFFSET 0x804C | ||
25 | #define AT803X_LOC_MAC_ADDR_16_31_OFFSET 0x804B | ||
26 | #define AT803X_LOC_MAC_ADDR_32_47_OFFSET 0x804A | ||
27 | #define AT803X_MMD_ACCESS_CONTROL 0x0D | ||
28 | #define AT803X_MMD_ACCESS_CONTROL_DATA 0x0E | ||
29 | #define AT803X_FUNC_DATA 0x4003 | ||
30 | |||
31 | MODULE_DESCRIPTION("Atheros 803x PHY driver"); | ||
32 | MODULE_AUTHOR("Matus Ujhelyi"); | ||
33 | MODULE_LICENSE("GPL"); | ||
34 | |||
35 | static void at803x_set_wol_mac_addr(struct phy_device *phydev) | ||
36 | { | ||
37 | struct net_device *ndev = phydev->attached_dev; | ||
38 | const u8 *mac; | ||
39 | unsigned int i, offsets[] = { | ||
40 | AT803X_LOC_MAC_ADDR_32_47_OFFSET, | ||
41 | AT803X_LOC_MAC_ADDR_16_31_OFFSET, | ||
42 | AT803X_LOC_MAC_ADDR_0_15_OFFSET, | ||
43 | }; | ||
44 | |||
45 | if (!ndev) | ||
46 | return; | ||
47 | |||
48 | mac = (const u8 *) ndev->dev_addr; | ||
49 | |||
50 | if (!is_valid_ether_addr(mac)) | ||
51 | return; | ||
52 | |||
53 | for (i = 0; i < 3; i++) { | ||
54 | phy_write(phydev, AT803X_MMD_ACCESS_CONTROL, | ||
55 | AT803X_DEVICE_ADDR); | ||
56 | phy_write(phydev, AT803X_MMD_ACCESS_CONTROL_DATA, | ||
57 | offsets[i]); | ||
58 | phy_write(phydev, AT803X_MMD_ACCESS_CONTROL, | ||
59 | AT803X_FUNC_DATA); | ||
60 | phy_write(phydev, AT803X_MMD_ACCESS_CONTROL_DATA, | ||
61 | mac[(i * 2) + 1] | (mac[(i * 2)] << 8)); | ||
62 | } | ||
63 | } | ||
64 | |||
65 | static int at803x_config_init(struct phy_device *phydev) | ||
66 | { | ||
67 | int val; | ||
68 | u32 features; | ||
69 | int status; | ||
70 | |||
71 | features = SUPPORTED_TP | SUPPORTED_MII | SUPPORTED_AUI | | ||
72 | SUPPORTED_FIBRE | SUPPORTED_BNC; | ||
73 | |||
74 | val = phy_read(phydev, MII_BMSR); | ||
75 | if (val < 0) | ||
76 | return val; | ||
77 | |||
78 | if (val & BMSR_ANEGCAPABLE) | ||
79 | features |= SUPPORTED_Autoneg; | ||
80 | if (val & BMSR_100FULL) | ||
81 | features |= SUPPORTED_100baseT_Full; | ||
82 | if (val & BMSR_100HALF) | ||
83 | features |= SUPPORTED_100baseT_Half; | ||
84 | if (val & BMSR_10FULL) | ||
85 | features |= SUPPORTED_10baseT_Full; | ||
86 | if (val & BMSR_10HALF) | ||
87 | features |= SUPPORTED_10baseT_Half; | ||
88 | |||
89 | if (val & BMSR_ESTATEN) { | ||
90 | val = phy_read(phydev, MII_ESTATUS); | ||
91 | if (val < 0) | ||
92 | return val; | ||
93 | |||
94 | if (val & ESTATUS_1000_TFULL) | ||
95 | features |= SUPPORTED_1000baseT_Full; | ||
96 | if (val & ESTATUS_1000_THALF) | ||
97 | features |= SUPPORTED_1000baseT_Half; | ||
98 | } | ||
99 | |||
100 | phydev->supported = features; | ||
101 | phydev->advertising = features; | ||
102 | |||
103 | /* enable WOL */ | ||
104 | at803x_set_wol_mac_addr(phydev); | ||
105 | status = phy_write(phydev, AT803X_INTR_ENABLE, AT803X_WOL_ENABLE); | ||
106 | status = phy_read(phydev, AT803X_INTR_STATUS); | ||
107 | |||
108 | return 0; | ||
109 | } | ||
110 | |||
111 | /* ATHEROS 8035 */ | ||
112 | static struct phy_driver at8035_driver = { | ||
113 | .phy_id = 0x004dd072, | ||
114 | .name = "Atheros 8035 ethernet", | ||
115 | .phy_id_mask = 0xffffffef, | ||
116 | .config_init = at803x_config_init, | ||
117 | .features = PHY_GBIT_FEATURES, | ||
118 | .flags = PHY_HAS_INTERRUPT, | ||
119 | .config_aneg = &genphy_config_aneg, | ||
120 | .read_status = &genphy_read_status, | ||
121 | .driver = { | ||
122 | .owner = THIS_MODULE, | ||
123 | }, | ||
124 | }; | ||
125 | |||
126 | /* ATHEROS 8030 */ | ||
127 | static struct phy_driver at8030_driver = { | ||
128 | .phy_id = 0x004dd076, | ||
129 | .name = "Atheros 8030 ethernet", | ||
130 | .phy_id_mask = 0xffffffef, | ||
131 | .config_init = at803x_config_init, | ||
132 | .features = PHY_GBIT_FEATURES, | ||
133 | .flags = PHY_HAS_INTERRUPT, | ||
134 | .config_aneg = &genphy_config_aneg, | ||
135 | .read_status = &genphy_read_status, | ||
136 | .driver = { | ||
137 | .owner = THIS_MODULE, | ||
138 | }, | ||
139 | }; | ||
140 | |||
141 | static int __init atheros_init(void) | ||
142 | { | ||
143 | int ret; | ||
144 | |||
145 | ret = phy_driver_register(&at8035_driver); | ||
146 | if (ret) | ||
147 | goto err1; | ||
148 | |||
149 | ret = phy_driver_register(&at8030_driver); | ||
150 | if (ret) | ||
151 | goto err2; | ||
152 | |||
153 | return 0; | ||
154 | |||
155 | err2: | ||
156 | phy_driver_unregister(&at8035_driver); | ||
157 | err1: | ||
158 | return ret; | ||
159 | } | ||
160 | |||
161 | static void __exit atheros_exit(void) | ||
162 | { | ||
163 | phy_driver_unregister(&at8035_driver); | ||
164 | phy_driver_unregister(&at8030_driver); | ||
165 | } | ||
166 | |||
167 | module_init(atheros_init); | ||
168 | module_exit(atheros_exit); | ||
169 | |||
170 | static struct mdio_device_id __maybe_unused atheros_tbl[] = { | ||
171 | { 0x004dd076, 0xffffffef }, | ||
172 | { 0x004dd072, 0xffffffef }, | ||
173 | { } | ||
174 | }; | ||
175 | |||
176 | MODULE_DEVICE_TABLE(mdio, atheros_tbl); | ||
diff --git a/drivers/net/phy/mdio-bitbang.c b/drivers/net/phy/mdio-bitbang.c index daec9b05d168..6428fcbbdd4b 100644 --- a/drivers/net/phy/mdio-bitbang.c +++ b/drivers/net/phy/mdio-bitbang.c | |||
@@ -234,6 +234,7 @@ void free_mdio_bitbang(struct mii_bus *bus) | |||
234 | struct mdiobb_ctrl *ctrl = bus->priv; | 234 | struct mdiobb_ctrl *ctrl = bus->priv; |
235 | 235 | ||
236 | module_put(ctrl->ops->owner); | 236 | module_put(ctrl->ops->owner); |
237 | mdiobus_unregister(bus); | ||
237 | mdiobus_free(bus); | 238 | mdiobus_free(bus); |
238 | } | 239 | } |
239 | EXPORT_SYMBOL(free_mdio_bitbang); | 240 | EXPORT_SYMBOL(free_mdio_bitbang); |
diff --git a/drivers/net/usb/cdc_ether.c b/drivers/net/usb/cdc_ether.c index a03de7197049..d0129827602b 100644 --- a/drivers/net/usb/cdc_ether.c +++ b/drivers/net/usb/cdc_ether.c | |||
@@ -592,6 +592,32 @@ static const struct usb_device_id products [] = { | |||
592 | .driver_info = 0, | 592 | .driver_info = 0, |
593 | }, | 593 | }, |
594 | 594 | ||
595 | /* Novatel USB551L and MC551 - handled by qmi_wwan */ | ||
596 | { | ||
597 | .match_flags = USB_DEVICE_ID_MATCH_VENDOR | ||
598 | | USB_DEVICE_ID_MATCH_PRODUCT | ||
599 | | USB_DEVICE_ID_MATCH_INT_INFO, | ||
600 | .idVendor = NOVATEL_VENDOR_ID, | ||
601 | .idProduct = 0xB001, | ||
602 | .bInterfaceClass = USB_CLASS_COMM, | ||
603 | .bInterfaceSubClass = USB_CDC_SUBCLASS_ETHERNET, | ||
604 | .bInterfaceProtocol = USB_CDC_PROTO_NONE, | ||
605 | .driver_info = 0, | ||
606 | }, | ||
607 | |||
608 | /* Novatel E362 - handled by qmi_wwan */ | ||
609 | { | ||
610 | .match_flags = USB_DEVICE_ID_MATCH_VENDOR | ||
611 | | USB_DEVICE_ID_MATCH_PRODUCT | ||
612 | | USB_DEVICE_ID_MATCH_INT_INFO, | ||
613 | .idVendor = NOVATEL_VENDOR_ID, | ||
614 | .idProduct = 0x9010, | ||
615 | .bInterfaceClass = USB_CLASS_COMM, | ||
616 | .bInterfaceSubClass = USB_CDC_SUBCLASS_ETHERNET, | ||
617 | .bInterfaceProtocol = USB_CDC_PROTO_NONE, | ||
618 | .driver_info = 0, | ||
619 | }, | ||
620 | |||
595 | /* | 621 | /* |
596 | * WHITELIST!!! | 622 | * WHITELIST!!! |
597 | * | 623 | * |
@@ -604,21 +630,6 @@ static const struct usb_device_id products [] = { | |||
604 | * because of bugs/quirks in a given product (like Zaurus, above). | 630 | * because of bugs/quirks in a given product (like Zaurus, above). |
605 | */ | 631 | */ |
606 | { | 632 | { |
607 | /* Novatel USB551L */ | ||
608 | /* This match must come *before* the generic CDC-ETHER match so that | ||
609 | * we get FLAG_WWAN set on the device, since it's descriptors are | ||
610 | * generic CDC-ETHER. | ||
611 | */ | ||
612 | .match_flags = USB_DEVICE_ID_MATCH_VENDOR | ||
613 | | USB_DEVICE_ID_MATCH_PRODUCT | ||
614 | | USB_DEVICE_ID_MATCH_INT_INFO, | ||
615 | .idVendor = NOVATEL_VENDOR_ID, | ||
616 | .idProduct = 0xB001, | ||
617 | .bInterfaceClass = USB_CLASS_COMM, | ||
618 | .bInterfaceSubClass = USB_CDC_SUBCLASS_ETHERNET, | ||
619 | .bInterfaceProtocol = USB_CDC_PROTO_NONE, | ||
620 | .driver_info = (unsigned long)&wwan_info, | ||
621 | }, { | ||
622 | /* ZTE (Vodafone) K3805-Z */ | 633 | /* ZTE (Vodafone) K3805-Z */ |
623 | .match_flags = USB_DEVICE_ID_MATCH_VENDOR | 634 | .match_flags = USB_DEVICE_ID_MATCH_VENDOR |
624 | | USB_DEVICE_ID_MATCH_PRODUCT | 635 | | USB_DEVICE_ID_MATCH_PRODUCT |
diff --git a/drivers/net/usb/ipheth.c b/drivers/net/usb/ipheth.c index a28a983d465e..534d8becbbdc 100644 --- a/drivers/net/usb/ipheth.c +++ b/drivers/net/usb/ipheth.c | |||
@@ -62,6 +62,7 @@ | |||
62 | #define USB_PRODUCT_IPAD 0x129a | 62 | #define USB_PRODUCT_IPAD 0x129a |
63 | #define USB_PRODUCT_IPHONE_4_VZW 0x129c | 63 | #define USB_PRODUCT_IPHONE_4_VZW 0x129c |
64 | #define USB_PRODUCT_IPHONE_4S 0x12a0 | 64 | #define USB_PRODUCT_IPHONE_4S 0x12a0 |
65 | #define USB_PRODUCT_IPHONE_5 0x12a8 | ||
65 | 66 | ||
66 | #define IPHETH_USBINTF_CLASS 255 | 67 | #define IPHETH_USBINTF_CLASS 255 |
67 | #define IPHETH_USBINTF_SUBCLASS 253 | 68 | #define IPHETH_USBINTF_SUBCLASS 253 |
@@ -113,6 +114,10 @@ static struct usb_device_id ipheth_table[] = { | |||
113 | USB_VENDOR_APPLE, USB_PRODUCT_IPHONE_4S, | 114 | USB_VENDOR_APPLE, USB_PRODUCT_IPHONE_4S, |
114 | IPHETH_USBINTF_CLASS, IPHETH_USBINTF_SUBCLASS, | 115 | IPHETH_USBINTF_CLASS, IPHETH_USBINTF_SUBCLASS, |
115 | IPHETH_USBINTF_PROTO) }, | 116 | IPHETH_USBINTF_PROTO) }, |
117 | { USB_DEVICE_AND_INTERFACE_INFO( | ||
118 | USB_VENDOR_APPLE, USB_PRODUCT_IPHONE_5, | ||
119 | IPHETH_USBINTF_CLASS, IPHETH_USBINTF_SUBCLASS, | ||
120 | IPHETH_USBINTF_PROTO) }, | ||
116 | { } | 121 | { } |
117 | }; | 122 | }; |
118 | MODULE_DEVICE_TABLE(usb, ipheth_table); | 123 | MODULE_DEVICE_TABLE(usb, ipheth_table); |
diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c index 6883c371c59f..3b566fa0f8e6 100644 --- a/drivers/net/usb/qmi_wwan.c +++ b/drivers/net/usb/qmi_wwan.c | |||
@@ -369,18 +369,73 @@ static const struct usb_device_id products[] = { | |||
369 | USB_VENDOR_AND_INTERFACE_INFO(0x106c, USB_CLASS_VENDOR_SPEC, 0xf1, 0xff), | 369 | USB_VENDOR_AND_INTERFACE_INFO(0x106c, USB_CLASS_VENDOR_SPEC, 0xf1, 0xff), |
370 | .driver_info = (unsigned long)&qmi_wwan_info, | 370 | .driver_info = (unsigned long)&qmi_wwan_info, |
371 | }, | 371 | }, |
372 | { /* Novatel USB551L and MC551 */ | ||
373 | USB_DEVICE_AND_INTERFACE_INFO(0x1410, 0xb001, | ||
374 | USB_CLASS_COMM, | ||
375 | USB_CDC_SUBCLASS_ETHERNET, | ||
376 | USB_CDC_PROTO_NONE), | ||
377 | .driver_info = (unsigned long)&qmi_wwan_info, | ||
378 | }, | ||
379 | { /* Novatel E362 */ | ||
380 | USB_DEVICE_AND_INTERFACE_INFO(0x1410, 0x9010, | ||
381 | USB_CLASS_COMM, | ||
382 | USB_CDC_SUBCLASS_ETHERNET, | ||
383 | USB_CDC_PROTO_NONE), | ||
384 | .driver_info = (unsigned long)&qmi_wwan_info, | ||
385 | }, | ||
372 | 386 | ||
373 | /* 3. Combined interface devices matching on interface number */ | 387 | /* 3. Combined interface devices matching on interface number */ |
388 | {QMI_FIXED_INTF(0x19d2, 0x0002, 1)}, | ||
389 | {QMI_FIXED_INTF(0x19d2, 0x0012, 1)}, | ||
390 | {QMI_FIXED_INTF(0x19d2, 0x0017, 3)}, | ||
391 | {QMI_FIXED_INTF(0x19d2, 0x0021, 4)}, | ||
392 | {QMI_FIXED_INTF(0x19d2, 0x0025, 1)}, | ||
393 | {QMI_FIXED_INTF(0x19d2, 0x0031, 4)}, | ||
394 | {QMI_FIXED_INTF(0x19d2, 0x0042, 4)}, | ||
395 | {QMI_FIXED_INTF(0x19d2, 0x0049, 5)}, | ||
396 | {QMI_FIXED_INTF(0x19d2, 0x0052, 4)}, | ||
374 | {QMI_FIXED_INTF(0x19d2, 0x0055, 1)}, /* ZTE (Vodafone) K3520-Z */ | 397 | {QMI_FIXED_INTF(0x19d2, 0x0055, 1)}, /* ZTE (Vodafone) K3520-Z */ |
398 | {QMI_FIXED_INTF(0x19d2, 0x0058, 4)}, | ||
375 | {QMI_FIXED_INTF(0x19d2, 0x0063, 4)}, /* ZTE (Vodafone) K3565-Z */ | 399 | {QMI_FIXED_INTF(0x19d2, 0x0063, 4)}, /* ZTE (Vodafone) K3565-Z */ |
376 | {QMI_FIXED_INTF(0x19d2, 0x0104, 4)}, /* ZTE (Vodafone) K4505-Z */ | 400 | {QMI_FIXED_INTF(0x19d2, 0x0104, 4)}, /* ZTE (Vodafone) K4505-Z */ |
401 | {QMI_FIXED_INTF(0x19d2, 0x0113, 5)}, | ||
402 | {QMI_FIXED_INTF(0x19d2, 0x0118, 5)}, | ||
403 | {QMI_FIXED_INTF(0x19d2, 0x0121, 5)}, | ||
404 | {QMI_FIXED_INTF(0x19d2, 0x0123, 4)}, | ||
405 | {QMI_FIXED_INTF(0x19d2, 0x0124, 5)}, | ||
406 | {QMI_FIXED_INTF(0x19d2, 0x0125, 6)}, | ||
407 | {QMI_FIXED_INTF(0x19d2, 0x0126, 5)}, | ||
408 | {QMI_FIXED_INTF(0x19d2, 0x0130, 1)}, | ||
409 | {QMI_FIXED_INTF(0x19d2, 0x0133, 3)}, | ||
410 | {QMI_FIXED_INTF(0x19d2, 0x0141, 5)}, | ||
377 | {QMI_FIXED_INTF(0x19d2, 0x0157, 5)}, /* ZTE MF683 */ | 411 | {QMI_FIXED_INTF(0x19d2, 0x0157, 5)}, /* ZTE MF683 */ |
412 | {QMI_FIXED_INTF(0x19d2, 0x0158, 3)}, | ||
378 | {QMI_FIXED_INTF(0x19d2, 0x0167, 4)}, /* ZTE MF820D */ | 413 | {QMI_FIXED_INTF(0x19d2, 0x0167, 4)}, /* ZTE MF820D */ |
414 | {QMI_FIXED_INTF(0x19d2, 0x0168, 4)}, | ||
415 | {QMI_FIXED_INTF(0x19d2, 0x0176, 3)}, | ||
416 | {QMI_FIXED_INTF(0x19d2, 0x0178, 3)}, | ||
417 | {QMI_FIXED_INTF(0x19d2, 0x0191, 4)}, /* ZTE EuFi890 */ | ||
418 | {QMI_FIXED_INTF(0x19d2, 0x0199, 1)}, /* ZTE MF820S */ | ||
419 | {QMI_FIXED_INTF(0x19d2, 0x0200, 1)}, | ||
420 | {QMI_FIXED_INTF(0x19d2, 0x0257, 3)}, /* ZTE MF821 */ | ||
379 | {QMI_FIXED_INTF(0x19d2, 0x0326, 4)}, /* ZTE MF821D */ | 421 | {QMI_FIXED_INTF(0x19d2, 0x0326, 4)}, /* ZTE MF821D */ |
380 | {QMI_FIXED_INTF(0x19d2, 0x1008, 4)}, /* ZTE (Vodafone) K3570-Z */ | 422 | {QMI_FIXED_INTF(0x19d2, 0x1008, 4)}, /* ZTE (Vodafone) K3570-Z */ |
381 | {QMI_FIXED_INTF(0x19d2, 0x1010, 4)}, /* ZTE (Vodafone) K3571-Z */ | 423 | {QMI_FIXED_INTF(0x19d2, 0x1010, 4)}, /* ZTE (Vodafone) K3571-Z */ |
424 | {QMI_FIXED_INTF(0x19d2, 0x1012, 4)}, | ||
382 | {QMI_FIXED_INTF(0x19d2, 0x1018, 3)}, /* ZTE (Vodafone) K5006-Z */ | 425 | {QMI_FIXED_INTF(0x19d2, 0x1018, 3)}, /* ZTE (Vodafone) K5006-Z */ |
426 | {QMI_FIXED_INTF(0x19d2, 0x1021, 2)}, | ||
427 | {QMI_FIXED_INTF(0x19d2, 0x1245, 4)}, | ||
428 | {QMI_FIXED_INTF(0x19d2, 0x1247, 4)}, | ||
429 | {QMI_FIXED_INTF(0x19d2, 0x1252, 4)}, | ||
430 | {QMI_FIXED_INTF(0x19d2, 0x1254, 4)}, | ||
431 | {QMI_FIXED_INTF(0x19d2, 0x1255, 3)}, | ||
432 | {QMI_FIXED_INTF(0x19d2, 0x1255, 4)}, | ||
433 | {QMI_FIXED_INTF(0x19d2, 0x1256, 4)}, | ||
434 | {QMI_FIXED_INTF(0x19d2, 0x1401, 2)}, | ||
383 | {QMI_FIXED_INTF(0x19d2, 0x1402, 2)}, /* ZTE MF60 */ | 435 | {QMI_FIXED_INTF(0x19d2, 0x1402, 2)}, /* ZTE MF60 */ |
436 | {QMI_FIXED_INTF(0x19d2, 0x1424, 2)}, | ||
437 | {QMI_FIXED_INTF(0x19d2, 0x1425, 2)}, | ||
438 | {QMI_FIXED_INTF(0x19d2, 0x1426, 2)}, /* ZTE MF91 */ | ||
384 | {QMI_FIXED_INTF(0x19d2, 0x2002, 4)}, /* ZTE (Vodafone) K3765-Z */ | 439 | {QMI_FIXED_INTF(0x19d2, 0x2002, 4)}, /* ZTE (Vodafone) K3765-Z */ |
385 | {QMI_FIXED_INTF(0x0f3d, 0x68a2, 8)}, /* Sierra Wireless MC7700 */ | 440 | {QMI_FIXED_INTF(0x0f3d, 0x68a2, 8)}, /* Sierra Wireless MC7700 */ |
386 | {QMI_FIXED_INTF(0x114f, 0x68a2, 8)}, /* Sierra Wireless MC7750 */ | 441 | {QMI_FIXED_INTF(0x114f, 0x68a2, 8)}, /* Sierra Wireless MC7750 */ |
diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c index f9819d10b1f9..cb04f900cc46 100644 --- a/drivers/net/usb/usbnet.c +++ b/drivers/net/usb/usbnet.c | |||
@@ -1158,6 +1158,7 @@ netdev_tx_t usbnet_start_xmit (struct sk_buff *skb, | |||
1158 | usb_anchor_urb(urb, &dev->deferred); | 1158 | usb_anchor_urb(urb, &dev->deferred); |
1159 | /* no use to process more packets */ | 1159 | /* no use to process more packets */ |
1160 | netif_stop_queue(net); | 1160 | netif_stop_queue(net); |
1161 | usb_put_urb(urb); | ||
1161 | spin_unlock_irqrestore(&dev->txq.lock, flags); | 1162 | spin_unlock_irqrestore(&dev->txq.lock, flags); |
1162 | netdev_dbg(dev->net, "Delaying transmission for resumption\n"); | 1163 | netdev_dbg(dev->net, "Delaying transmission for resumption\n"); |
1163 | goto deferred; | 1164 | goto deferred; |
@@ -1310,6 +1311,8 @@ void usbnet_disconnect (struct usb_interface *intf) | |||
1310 | 1311 | ||
1311 | cancel_work_sync(&dev->kevent); | 1312 | cancel_work_sync(&dev->kevent); |
1312 | 1313 | ||
1314 | usb_scuttle_anchored_urbs(&dev->deferred); | ||
1315 | |||
1313 | if (dev->driver_info->unbind) | 1316 | if (dev->driver_info->unbind) |
1314 | dev->driver_info->unbind (dev, intf); | 1317 | dev->driver_info->unbind (dev, intf); |
1315 | 1318 | ||
diff --git a/drivers/net/vmxnet3/vmxnet3_drv.c b/drivers/net/vmxnet3/vmxnet3_drv.c index ce9d4f2c9776..0ae1bcc6da73 100644 --- a/drivers/net/vmxnet3/vmxnet3_drv.c +++ b/drivers/net/vmxnet3/vmxnet3_drv.c | |||
@@ -744,28 +744,43 @@ vmxnet3_map_pkt(struct sk_buff *skb, struct vmxnet3_tx_ctx *ctx, | |||
744 | 744 | ||
745 | for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) { | 745 | for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) { |
746 | const struct skb_frag_struct *frag = &skb_shinfo(skb)->frags[i]; | 746 | const struct skb_frag_struct *frag = &skb_shinfo(skb)->frags[i]; |
747 | u32 buf_size; | ||
747 | 748 | ||
748 | tbi = tq->buf_info + tq->tx_ring.next2fill; | 749 | buf_offset = 0; |
749 | tbi->map_type = VMXNET3_MAP_PAGE; | 750 | len = skb_frag_size(frag); |
750 | tbi->dma_addr = skb_frag_dma_map(&adapter->pdev->dev, frag, | 751 | while (len) { |
751 | 0, skb_frag_size(frag), | 752 | tbi = tq->buf_info + tq->tx_ring.next2fill; |
752 | DMA_TO_DEVICE); | 753 | if (len < VMXNET3_MAX_TX_BUF_SIZE) { |
754 | buf_size = len; | ||
755 | dw2 |= len; | ||
756 | } else { | ||
757 | buf_size = VMXNET3_MAX_TX_BUF_SIZE; | ||
758 | /* spec says that for TxDesc.len, 0 == 2^14 */ | ||
759 | } | ||
760 | tbi->map_type = VMXNET3_MAP_PAGE; | ||
761 | tbi->dma_addr = skb_frag_dma_map(&adapter->pdev->dev, frag, | ||
762 | buf_offset, buf_size, | ||
763 | DMA_TO_DEVICE); | ||
753 | 764 | ||
754 | tbi->len = skb_frag_size(frag); | 765 | tbi->len = buf_size; |
755 | 766 | ||
756 | gdesc = tq->tx_ring.base + tq->tx_ring.next2fill; | 767 | gdesc = tq->tx_ring.base + tq->tx_ring.next2fill; |
757 | BUG_ON(gdesc->txd.gen == tq->tx_ring.gen); | 768 | BUG_ON(gdesc->txd.gen == tq->tx_ring.gen); |
758 | 769 | ||
759 | gdesc->txd.addr = cpu_to_le64(tbi->dma_addr); | 770 | gdesc->txd.addr = cpu_to_le64(tbi->dma_addr); |
760 | gdesc->dword[2] = cpu_to_le32(dw2 | skb_frag_size(frag)); | 771 | gdesc->dword[2] = cpu_to_le32(dw2); |
761 | gdesc->dword[3] = 0; | 772 | gdesc->dword[3] = 0; |
762 | 773 | ||
763 | dev_dbg(&adapter->netdev->dev, | 774 | dev_dbg(&adapter->netdev->dev, |
764 | "txd[%u]: 0x%llu %u %u\n", | 775 | "txd[%u]: 0x%llu %u %u\n", |
765 | tq->tx_ring.next2fill, le64_to_cpu(gdesc->txd.addr), | 776 | tq->tx_ring.next2fill, le64_to_cpu(gdesc->txd.addr), |
766 | le32_to_cpu(gdesc->dword[2]), gdesc->dword[3]); | 777 | le32_to_cpu(gdesc->dword[2]), gdesc->dword[3]); |
767 | vmxnet3_cmd_ring_adv_next2fill(&tq->tx_ring); | 778 | vmxnet3_cmd_ring_adv_next2fill(&tq->tx_ring); |
768 | dw2 = tq->tx_ring.gen << VMXNET3_TXD_GEN_SHIFT; | 779 | dw2 = tq->tx_ring.gen << VMXNET3_TXD_GEN_SHIFT; |
780 | |||
781 | len -= buf_size; | ||
782 | buf_offset += buf_size; | ||
783 | } | ||
769 | } | 784 | } |
770 | 785 | ||
771 | ctx->eop_txd = gdesc; | 786 | ctx->eop_txd = gdesc; |
@@ -886,6 +901,18 @@ vmxnet3_prepare_tso(struct sk_buff *skb, | |||
886 | } | 901 | } |
887 | } | 902 | } |
888 | 903 | ||
904 | static int txd_estimate(const struct sk_buff *skb) | ||
905 | { | ||
906 | int count = VMXNET3_TXD_NEEDED(skb_headlen(skb)) + 1; | ||
907 | int i; | ||
908 | |||
909 | for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) { | ||
910 | const struct skb_frag_struct *frag = &skb_shinfo(skb)->frags[i]; | ||
911 | |||
912 | count += VMXNET3_TXD_NEEDED(skb_frag_size(frag)); | ||
913 | } | ||
914 | return count; | ||
915 | } | ||
889 | 916 | ||
890 | /* | 917 | /* |
891 | * Transmits a pkt thru a given tq | 918 | * Transmits a pkt thru a given tq |
@@ -914,9 +941,7 @@ vmxnet3_tq_xmit(struct sk_buff *skb, struct vmxnet3_tx_queue *tq, | |||
914 | union Vmxnet3_GenericDesc tempTxDesc; | 941 | union Vmxnet3_GenericDesc tempTxDesc; |
915 | #endif | 942 | #endif |
916 | 943 | ||
917 | /* conservatively estimate # of descriptors to use */ | 944 | count = txd_estimate(skb); |
918 | count = VMXNET3_TXD_NEEDED(skb_headlen(skb)) + | ||
919 | skb_shinfo(skb)->nr_frags + 1; | ||
920 | 945 | ||
921 | ctx.ipv4 = (vlan_get_protocol(skb) == cpu_to_be16(ETH_P_IP)); | 946 | ctx.ipv4 = (vlan_get_protocol(skb) == cpu_to_be16(ETH_P_IP)); |
922 | 947 | ||
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c index 607976c00162..7b4adde93c01 100644 --- a/drivers/net/vxlan.c +++ b/drivers/net/vxlan.c | |||
@@ -816,7 +816,7 @@ static void vxlan_cleanup(unsigned long arg) | |||
816 | = container_of(p, struct vxlan_fdb, hlist); | 816 | = container_of(p, struct vxlan_fdb, hlist); |
817 | unsigned long timeout; | 817 | unsigned long timeout; |
818 | 818 | ||
819 | if (f->state == NUD_PERMANENT) | 819 | if (f->state & NUD_PERMANENT) |
820 | continue; | 820 | continue; |
821 | 821 | ||
822 | timeout = f->used + vxlan->age_interval * HZ; | 822 | timeout = f->used + vxlan->age_interval * HZ; |
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_2p2_initvals.h b/drivers/net/wireless/ath/ath9k/ar9003_2p2_initvals.h index 89bf94d4d8a1..6f7cf49eff4d 100644 --- a/drivers/net/wireless/ath/ath9k/ar9003_2p2_initvals.h +++ b/drivers/net/wireless/ath/ath9k/ar9003_2p2_initvals.h | |||
@@ -534,107 +534,107 @@ static const u32 ar9300_2p2_baseband_core[][2] = { | |||
534 | 534 | ||
535 | static const u32 ar9300Modes_high_power_tx_gain_table_2p2[][5] = { | 535 | static const u32 ar9300Modes_high_power_tx_gain_table_2p2[][5] = { |
536 | /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ | 536 | /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ |
537 | {0x0000a2dc, 0x000cfff0, 0x000cfff0, 0x03aaa352, 0x03aaa352}, | 537 | {0x0000a2dc, 0x00033800, 0x00033800, 0x03aaa352, 0x03aaa352}, |
538 | {0x0000a2e0, 0x000f0000, 0x000f0000, 0x03ccc584, 0x03ccc584}, | 538 | {0x0000a2e0, 0x0003c000, 0x0003c000, 0x03ccc584, 0x03ccc584}, |
539 | {0x0000a2e4, 0x03f00000, 0x03f00000, 0x03f0f800, 0x03f0f800}, | 539 | {0x0000a2e4, 0x03fc0000, 0x03fc0000, 0x03f0f800, 0x03f0f800}, |
540 | {0x0000a2e8, 0x00000000, 0x00000000, 0x03ff0000, 0x03ff0000}, | 540 | {0x0000a2e8, 0x00000000, 0x00000000, 0x03ff0000, 0x03ff0000}, |
541 | {0x0000a410, 0x000050d9, 0x000050d9, 0x000050d9, 0x000050d9}, | 541 | {0x0000a410, 0x000050d9, 0x000050d9, 0x000050d9, 0x000050d9}, |
542 | {0x0000a500, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | 542 | {0x0000a500, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, |
543 | {0x0000a504, 0x06000003, 0x06000003, 0x04000002, 0x04000002}, | 543 | {0x0000a504, 0x06000003, 0x06000003, 0x04000002, 0x04000002}, |
544 | {0x0000a508, 0x0a000020, 0x0a000020, 0x08000004, 0x08000004}, | 544 | {0x0000a508, 0x0a000020, 0x0a000020, 0x08000004, 0x08000004}, |
545 | {0x0000a50c, 0x10000023, 0x10000023, 0x0b000200, 0x0b000200}, | 545 | {0x0000a50c, 0x10000023, 0x10000023, 0x0b000200, 0x0b000200}, |
546 | {0x0000a510, 0x15000028, 0x15000028, 0x0f000202, 0x0f000202}, | 546 | {0x0000a510, 0x16000220, 0x16000220, 0x0f000202, 0x0f000202}, |
547 | {0x0000a514, 0x1b00002b, 0x1b00002b, 0x12000400, 0x12000400}, | 547 | {0x0000a514, 0x1c000223, 0x1c000223, 0x12000400, 0x12000400}, |
548 | {0x0000a518, 0x1f020028, 0x1f020028, 0x16000402, 0x16000402}, | 548 | {0x0000a518, 0x21002220, 0x21002220, 0x16000402, 0x16000402}, |
549 | {0x0000a51c, 0x2502002b, 0x2502002b, 0x19000404, 0x19000404}, | 549 | {0x0000a51c, 0x27002223, 0x27002223, 0x19000404, 0x19000404}, |
550 | {0x0000a520, 0x2a04002a, 0x2a04002a, 0x1c000603, 0x1c000603}, | 550 | {0x0000a520, 0x2b022220, 0x2b022220, 0x1c000603, 0x1c000603}, |
551 | {0x0000a524, 0x2e06002a, 0x2e06002a, 0x21000a02, 0x21000a02}, | 551 | {0x0000a524, 0x2f022222, 0x2f022222, 0x21000a02, 0x21000a02}, |
552 | {0x0000a528, 0x3302202d, 0x3302202d, 0x25000a04, 0x25000a04}, | 552 | {0x0000a528, 0x34022225, 0x34022225, 0x25000a04, 0x25000a04}, |
553 | {0x0000a52c, 0x3804202c, 0x3804202c, 0x28000a20, 0x28000a20}, | 553 | {0x0000a52c, 0x3a02222a, 0x3a02222a, 0x28000a20, 0x28000a20}, |
554 | {0x0000a530, 0x3c06202c, 0x3c06202c, 0x2c000e20, 0x2c000e20}, | 554 | {0x0000a530, 0x3e02222c, 0x3e02222c, 0x2c000e20, 0x2c000e20}, |
555 | {0x0000a534, 0x4108202d, 0x4108202d, 0x30000e22, 0x30000e22}, | 555 | {0x0000a534, 0x4202242a, 0x4202242a, 0x30000e22, 0x30000e22}, |
556 | {0x0000a538, 0x4506402d, 0x4506402d, 0x34000e24, 0x34000e24}, | 556 | {0x0000a538, 0x4702244a, 0x4702244a, 0x34000e24, 0x34000e24}, |
557 | {0x0000a53c, 0x4906222d, 0x4906222d, 0x38001640, 0x38001640}, | 557 | {0x0000a53c, 0x4b02244c, 0x4b02244c, 0x38001640, 0x38001640}, |
558 | {0x0000a540, 0x4d062231, 0x4d062231, 0x3c001660, 0x3c001660}, | 558 | {0x0000a540, 0x4e02246c, 0x4e02246c, 0x3c001660, 0x3c001660}, |
559 | {0x0000a544, 0x50082231, 0x50082231, 0x3f001861, 0x3f001861}, | 559 | {0x0000a544, 0x52022470, 0x52022470, 0x3f001861, 0x3f001861}, |
560 | {0x0000a548, 0x5608422e, 0x5608422e, 0x43001a81, 0x43001a81}, | 560 | {0x0000a548, 0x55022490, 0x55022490, 0x43001a81, 0x43001a81}, |
561 | {0x0000a54c, 0x5a08442e, 0x5a08442e, 0x47001a83, 0x47001a83}, | 561 | {0x0000a54c, 0x59022492, 0x59022492, 0x47001a83, 0x47001a83}, |
562 | {0x0000a550, 0x5e0a4431, 0x5e0a4431, 0x4a001c84, 0x4a001c84}, | 562 | {0x0000a550, 0x5d022692, 0x5d022692, 0x4a001c84, 0x4a001c84}, |
563 | {0x0000a554, 0x640a4432, 0x640a4432, 0x4e001ce3, 0x4e001ce3}, | 563 | {0x0000a554, 0x61022892, 0x61022892, 0x4e001ce3, 0x4e001ce3}, |
564 | {0x0000a558, 0x680a4434, 0x680a4434, 0x52001ce5, 0x52001ce5}, | 564 | {0x0000a558, 0x65024890, 0x65024890, 0x52001ce5, 0x52001ce5}, |
565 | {0x0000a55c, 0x6c0a6434, 0x6c0a6434, 0x56001ce9, 0x56001ce9}, | 565 | {0x0000a55c, 0x69024892, 0x69024892, 0x56001ce9, 0x56001ce9}, |
566 | {0x0000a560, 0x6f0a6633, 0x6f0a6633, 0x5a001ceb, 0x5a001ceb}, | 566 | {0x0000a560, 0x6e024c92, 0x6e024c92, 0x5a001ceb, 0x5a001ceb}, |
567 | {0x0000a564, 0x730c6634, 0x730c6634, 0x5d001eec, 0x5d001eec}, | 567 | {0x0000a564, 0x74026e92, 0x74026e92, 0x5d001eec, 0x5d001eec}, |
568 | {0x0000a568, 0x730c6634, 0x730c6634, 0x5d001eec, 0x5d001eec}, | 568 | {0x0000a568, 0x74026e92, 0x74026e92, 0x5d001eec, 0x5d001eec}, |
569 | {0x0000a56c, 0x730c6634, 0x730c6634, 0x5d001eec, 0x5d001eec}, | 569 | {0x0000a56c, 0x74026e92, 0x74026e92, 0x5d001eec, 0x5d001eec}, |
570 | {0x0000a570, 0x730c6634, 0x730c6634, 0x5d001eec, 0x5d001eec}, | 570 | {0x0000a570, 0x74026e92, 0x74026e92, 0x5d001eec, 0x5d001eec}, |
571 | {0x0000a574, 0x730c6634, 0x730c6634, 0x5d001eec, 0x5d001eec}, | 571 | {0x0000a574, 0x74026e92, 0x74026e92, 0x5d001eec, 0x5d001eec}, |
572 | {0x0000a578, 0x730c6634, 0x730c6634, 0x5d001eec, 0x5d001eec}, | 572 | {0x0000a578, 0x74026e92, 0x74026e92, 0x5d001eec, 0x5d001eec}, |
573 | {0x0000a57c, 0x730c6634, 0x730c6634, 0x5d001eec, 0x5d001eec}, | 573 | {0x0000a57c, 0x74026e92, 0x74026e92, 0x5d001eec, 0x5d001eec}, |
574 | {0x0000a580, 0x00800000, 0x00800000, 0x00800000, 0x00800000}, | 574 | {0x0000a580, 0x00800000, 0x00800000, 0x00800000, 0x00800000}, |
575 | {0x0000a584, 0x06800003, 0x06800003, 0x04800002, 0x04800002}, | 575 | {0x0000a584, 0x06800003, 0x06800003, 0x04800002, 0x04800002}, |
576 | {0x0000a588, 0x0a800020, 0x0a800020, 0x08800004, 0x08800004}, | 576 | {0x0000a588, 0x0a800020, 0x0a800020, 0x08800004, 0x08800004}, |
577 | {0x0000a58c, 0x10800023, 0x10800023, 0x0b800200, 0x0b800200}, | 577 | {0x0000a58c, 0x10800023, 0x10800023, 0x0b800200, 0x0b800200}, |
578 | {0x0000a590, 0x15800028, 0x15800028, 0x0f800202, 0x0f800202}, | 578 | {0x0000a590, 0x16800220, 0x16800220, 0x0f800202, 0x0f800202}, |
579 | {0x0000a594, 0x1b80002b, 0x1b80002b, 0x12800400, 0x12800400}, | 579 | {0x0000a594, 0x1c800223, 0x1c800223, 0x12800400, 0x12800400}, |
580 | {0x0000a598, 0x1f820028, 0x1f820028, 0x16800402, 0x16800402}, | 580 | {0x0000a598, 0x21802220, 0x21802220, 0x16800402, 0x16800402}, |
581 | {0x0000a59c, 0x2582002b, 0x2582002b, 0x19800404, 0x19800404}, | 581 | {0x0000a59c, 0x27802223, 0x27802223, 0x19800404, 0x19800404}, |
582 | {0x0000a5a0, 0x2a84002a, 0x2a84002a, 0x1c800603, 0x1c800603}, | 582 | {0x0000a5a0, 0x2b822220, 0x2b822220, 0x1c800603, 0x1c800603}, |
583 | {0x0000a5a4, 0x2e86002a, 0x2e86002a, 0x21800a02, 0x21800a02}, | 583 | {0x0000a5a4, 0x2f822222, 0x2f822222, 0x21800a02, 0x21800a02}, |
584 | {0x0000a5a8, 0x3382202d, 0x3382202d, 0x25800a04, 0x25800a04}, | 584 | {0x0000a5a8, 0x34822225, 0x34822225, 0x25800a04, 0x25800a04}, |
585 | {0x0000a5ac, 0x3884202c, 0x3884202c, 0x28800a20, 0x28800a20}, | 585 | {0x0000a5ac, 0x3a82222a, 0x3a82222a, 0x28800a20, 0x28800a20}, |
586 | {0x0000a5b0, 0x3c86202c, 0x3c86202c, 0x2c800e20, 0x2c800e20}, | 586 | {0x0000a5b0, 0x3e82222c, 0x3e82222c, 0x2c800e20, 0x2c800e20}, |
587 | {0x0000a5b4, 0x4188202d, 0x4188202d, 0x30800e22, 0x30800e22}, | 587 | {0x0000a5b4, 0x4282242a, 0x4282242a, 0x30800e22, 0x30800e22}, |
588 | {0x0000a5b8, 0x4586402d, 0x4586402d, 0x34800e24, 0x34800e24}, | 588 | {0x0000a5b8, 0x4782244a, 0x4782244a, 0x34800e24, 0x34800e24}, |
589 | {0x0000a5bc, 0x4986222d, 0x4986222d, 0x38801640, 0x38801640}, | 589 | {0x0000a5bc, 0x4b82244c, 0x4b82244c, 0x38801640, 0x38801640}, |
590 | {0x0000a5c0, 0x4d862231, 0x4d862231, 0x3c801660, 0x3c801660}, | 590 | {0x0000a5c0, 0x4e82246c, 0x4e82246c, 0x3c801660, 0x3c801660}, |
591 | {0x0000a5c4, 0x50882231, 0x50882231, 0x3f801861, 0x3f801861}, | 591 | {0x0000a5c4, 0x52822470, 0x52822470, 0x3f801861, 0x3f801861}, |
592 | {0x0000a5c8, 0x5688422e, 0x5688422e, 0x43801a81, 0x43801a81}, | 592 | {0x0000a5c8, 0x55822490, 0x55822490, 0x43801a81, 0x43801a81}, |
593 | {0x0000a5cc, 0x5a88442e, 0x5a88442e, 0x47801a83, 0x47801a83}, | 593 | {0x0000a5cc, 0x59822492, 0x59822492, 0x47801a83, 0x47801a83}, |
594 | {0x0000a5d0, 0x5e8a4431, 0x5e8a4431, 0x4a801c84, 0x4a801c84}, | 594 | {0x0000a5d0, 0x5d822692, 0x5d822692, 0x4a801c84, 0x4a801c84}, |
595 | {0x0000a5d4, 0x648a4432, 0x648a4432, 0x4e801ce3, 0x4e801ce3}, | 595 | {0x0000a5d4, 0x61822892, 0x61822892, 0x4e801ce3, 0x4e801ce3}, |
596 | {0x0000a5d8, 0x688a4434, 0x688a4434, 0x52801ce5, 0x52801ce5}, | 596 | {0x0000a5d8, 0x65824890, 0x65824890, 0x52801ce5, 0x52801ce5}, |
597 | {0x0000a5dc, 0x6c8a6434, 0x6c8a6434, 0x56801ce9, 0x56801ce9}, | 597 | {0x0000a5dc, 0x69824892, 0x69824892, 0x56801ce9, 0x56801ce9}, |
598 | {0x0000a5e0, 0x6f8a6633, 0x6f8a6633, 0x5a801ceb, 0x5a801ceb}, | 598 | {0x0000a5e0, 0x6e824c92, 0x6e824c92, 0x5a801ceb, 0x5a801ceb}, |
599 | {0x0000a5e4, 0x738c6634, 0x738c6634, 0x5d801eec, 0x5d801eec}, | 599 | {0x0000a5e4, 0x74826e92, 0x74826e92, 0x5d801eec, 0x5d801eec}, |
600 | {0x0000a5e8, 0x738c6634, 0x738c6634, 0x5d801eec, 0x5d801eec}, | 600 | {0x0000a5e8, 0x74826e92, 0x74826e92, 0x5d801eec, 0x5d801eec}, |
601 | {0x0000a5ec, 0x738c6634, 0x738c6634, 0x5d801eec, 0x5d801eec}, | 601 | {0x0000a5ec, 0x74826e92, 0x74826e92, 0x5d801eec, 0x5d801eec}, |
602 | {0x0000a5f0, 0x738c6634, 0x738c6634, 0x5d801eec, 0x5d801eec}, | 602 | {0x0000a5f0, 0x74826e92, 0x74826e92, 0x5d801eec, 0x5d801eec}, |
603 | {0x0000a5f4, 0x738c6634, 0x738c6634, 0x5d801eec, 0x5d801eec}, | 603 | {0x0000a5f4, 0x74826e92, 0x74826e92, 0x5d801eec, 0x5d801eec}, |
604 | {0x0000a5f8, 0x738c6634, 0x738c6634, 0x5d801eec, 0x5d801eec}, | 604 | {0x0000a5f8, 0x74826e92, 0x74826e92, 0x5d801eec, 0x5d801eec}, |
605 | {0x0000a5fc, 0x738c6634, 0x738c6634, 0x5d801eec, 0x5d801eec}, | 605 | {0x0000a5fc, 0x74826e92, 0x74826e92, 0x5d801eec, 0x5d801eec}, |
606 | {0x0000a600, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | 606 | {0x0000a600, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, |
607 | {0x0000a604, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | 607 | {0x0000a604, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, |
608 | {0x0000a608, 0x01804601, 0x01804601, 0x00000000, 0x00000000}, | 608 | {0x0000a608, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, |
609 | {0x0000a60c, 0x01804601, 0x01804601, 0x00000000, 0x00000000}, | 609 | {0x0000a60c, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, |
610 | {0x0000a610, 0x01804601, 0x01804601, 0x00000000, 0x00000000}, | 610 | {0x0000a610, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, |
611 | {0x0000a614, 0x01804601, 0x01804601, 0x01404000, 0x01404000}, | 611 | {0x0000a614, 0x02004000, 0x02004000, 0x01404000, 0x01404000}, |
612 | {0x0000a618, 0x01804601, 0x01804601, 0x01404501, 0x01404501}, | 612 | {0x0000a618, 0x02004801, 0x02004801, 0x01404501, 0x01404501}, |
613 | {0x0000a61c, 0x01804601, 0x01804601, 0x02008501, 0x02008501}, | 613 | {0x0000a61c, 0x02808a02, 0x02808a02, 0x02008501, 0x02008501}, |
614 | {0x0000a620, 0x03408d02, 0x03408d02, 0x0280ca03, 0x0280ca03}, | 614 | {0x0000a620, 0x0380ce03, 0x0380ce03, 0x0280ca03, 0x0280ca03}, |
615 | {0x0000a624, 0x0300cc03, 0x0300cc03, 0x03010c04, 0x03010c04}, | 615 | {0x0000a624, 0x04411104, 0x04411104, 0x03010c04, 0x03010c04}, |
616 | {0x0000a628, 0x03410d04, 0x03410d04, 0x04014c04, 0x04014c04}, | 616 | {0x0000a628, 0x04411104, 0x04411104, 0x04014c04, 0x04014c04}, |
617 | {0x0000a62c, 0x03410d04, 0x03410d04, 0x04015005, 0x04015005}, | 617 | {0x0000a62c, 0x04411104, 0x04411104, 0x04015005, 0x04015005}, |
618 | {0x0000a630, 0x03410d04, 0x03410d04, 0x04015005, 0x04015005}, | 618 | {0x0000a630, 0x04411104, 0x04411104, 0x04015005, 0x04015005}, |
619 | {0x0000a634, 0x03410d04, 0x03410d04, 0x04015005, 0x04015005}, | 619 | {0x0000a634, 0x04411104, 0x04411104, 0x04015005, 0x04015005}, |
620 | {0x0000a638, 0x03410d04, 0x03410d04, 0x04015005, 0x04015005}, | 620 | {0x0000a638, 0x04411104, 0x04411104, 0x04015005, 0x04015005}, |
621 | {0x0000a63c, 0x03410d04, 0x03410d04, 0x04015005, 0x04015005}, | 621 | {0x0000a63c, 0x04411104, 0x04411104, 0x04015005, 0x04015005}, |
622 | {0x0000b2dc, 0x000cfff0, 0x000cfff0, 0x03aaa352, 0x03aaa352}, | 622 | {0x0000b2dc, 0x00033800, 0x00033800, 0x03aaa352, 0x03aaa352}, |
623 | {0x0000b2e0, 0x000f0000, 0x000f0000, 0x03ccc584, 0x03ccc584}, | 623 | {0x0000b2e0, 0x0003c000, 0x0003c000, 0x03ccc584, 0x03ccc584}, |
624 | {0x0000b2e4, 0x03f00000, 0x03f00000, 0x03f0f800, 0x03f0f800}, | 624 | {0x0000b2e4, 0x03fc0000, 0x03fc0000, 0x03f0f800, 0x03f0f800}, |
625 | {0x0000b2e8, 0x00000000, 0x00000000, 0x03ff0000, 0x03ff0000}, | 625 | {0x0000b2e8, 0x00000000, 0x00000000, 0x03ff0000, 0x03ff0000}, |
626 | {0x0000c2dc, 0x000cfff0, 0x000cfff0, 0x03aaa352, 0x03aaa352}, | 626 | {0x0000c2dc, 0x00033800, 0x00033800, 0x03aaa352, 0x03aaa352}, |
627 | {0x0000c2e0, 0x000f0000, 0x000f0000, 0x03ccc584, 0x03ccc584}, | 627 | {0x0000c2e0, 0x0003c000, 0x0003c000, 0x03ccc584, 0x03ccc584}, |
628 | {0x0000c2e4, 0x03f00000, 0x03f00000, 0x03f0f800, 0x03f0f800}, | 628 | {0x0000c2e4, 0x03fc0000, 0x03fc0000, 0x03f0f800, 0x03f0f800}, |
629 | {0x0000c2e8, 0x00000000, 0x00000000, 0x03ff0000, 0x03ff0000}, | 629 | {0x0000c2e8, 0x00000000, 0x00000000, 0x03ff0000, 0x03ff0000}, |
630 | {0x00016044, 0x012492d4, 0x012492d4, 0x012492d4, 0x012492d4}, | 630 | {0x00016044, 0x012492d4, 0x012492d4, 0x012492d4, 0x012492d4}, |
631 | {0x00016048, 0x61200001, 0x61200001, 0x66480001, 0x66480001}, | 631 | {0x00016048, 0x66480001, 0x66480001, 0x66480001, 0x66480001}, |
632 | {0x00016068, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c}, | 632 | {0x00016068, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c}, |
633 | {0x00016444, 0x012492d4, 0x012492d4, 0x012492d4, 0x012492d4}, | 633 | {0x00016444, 0x012492d4, 0x012492d4, 0x012492d4, 0x012492d4}, |
634 | {0x00016448, 0x61200001, 0x61200001, 0x66480001, 0x66480001}, | 634 | {0x00016448, 0x66480001, 0x66480001, 0x66480001, 0x66480001}, |
635 | {0x00016468, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c}, | 635 | {0x00016468, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c}, |
636 | {0x00016844, 0x012492d4, 0x012492d4, 0x012492d4, 0x012492d4}, | 636 | {0x00016844, 0x012492d4, 0x012492d4, 0x012492d4, 0x012492d4}, |
637 | {0x00016848, 0x61200001, 0x61200001, 0x66480001, 0x66480001}, | 637 | {0x00016848, 0x66480001, 0x66480001, 0x66480001, 0x66480001}, |
638 | {0x00016868, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c}, | 638 | {0x00016868, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c}, |
639 | }; | 639 | }; |
640 | 640 | ||
diff --git a/drivers/net/wireless/ath/ath9k/hif_usb.c b/drivers/net/wireless/ath/ath9k/hif_usb.c index 924c4616c3d9..f5dda84176c3 100644 --- a/drivers/net/wireless/ath/ath9k/hif_usb.c +++ b/drivers/net/wireless/ath/ath9k/hif_usb.c | |||
@@ -38,6 +38,7 @@ static struct usb_device_id ath9k_hif_usb_ids[] = { | |||
38 | { USB_DEVICE(0x04CA, 0x4605) }, /* Liteon */ | 38 | { USB_DEVICE(0x04CA, 0x4605) }, /* Liteon */ |
39 | { USB_DEVICE(0x040D, 0x3801) }, /* VIA */ | 39 | { USB_DEVICE(0x040D, 0x3801) }, /* VIA */ |
40 | { USB_DEVICE(0x0cf3, 0xb003) }, /* Ubiquiti WifiStation Ext */ | 40 | { USB_DEVICE(0x0cf3, 0xb003) }, /* Ubiquiti WifiStation Ext */ |
41 | { USB_DEVICE(0x0cf3, 0xb002) }, /* Ubiquiti WifiStation */ | ||
41 | { USB_DEVICE(0x057c, 0x8403) }, /* AVM FRITZ!WLAN 11N v2 USB */ | 42 | { USB_DEVICE(0x057c, 0x8403) }, /* AVM FRITZ!WLAN 11N v2 USB */ |
42 | 43 | ||
43 | { USB_DEVICE(0x0cf3, 0x7015), | 44 | { USB_DEVICE(0x0cf3, 0x7015), |
diff --git a/drivers/net/wireless/ath/ath9k/xmit.c b/drivers/net/wireless/ath/ath9k/xmit.c index 378bd70256b2..741918a2027b 100644 --- a/drivers/net/wireless/ath/ath9k/xmit.c +++ b/drivers/net/wireless/ath/ath9k/xmit.c | |||
@@ -312,6 +312,7 @@ static struct ath_buf *ath_tx_get_buffer(struct ath_softc *sc) | |||
312 | } | 312 | } |
313 | 313 | ||
314 | bf = list_first_entry(&sc->tx.txbuf, struct ath_buf, list); | 314 | bf = list_first_entry(&sc->tx.txbuf, struct ath_buf, list); |
315 | bf->bf_next = NULL; | ||
315 | list_del(&bf->list); | 316 | list_del(&bf->list); |
316 | 317 | ||
317 | spin_unlock_bh(&sc->tx.txbuflock); | 318 | spin_unlock_bh(&sc->tx.txbuflock); |
@@ -393,7 +394,7 @@ static void ath_tx_complete_aggr(struct ath_softc *sc, struct ath_txq *txq, | |||
393 | u16 seq_st = 0, acked_cnt = 0, txfail_cnt = 0, seq_first; | 394 | u16 seq_st = 0, acked_cnt = 0, txfail_cnt = 0, seq_first; |
394 | u32 ba[WME_BA_BMP_SIZE >> 5]; | 395 | u32 ba[WME_BA_BMP_SIZE >> 5]; |
395 | int isaggr, txfail, txpending, sendbar = 0, needreset = 0, nbad = 0; | 396 | int isaggr, txfail, txpending, sendbar = 0, needreset = 0, nbad = 0; |
396 | bool rc_update = true; | 397 | bool rc_update = true, isba; |
397 | struct ieee80211_tx_rate rates[4]; | 398 | struct ieee80211_tx_rate rates[4]; |
398 | struct ath_frame_info *fi; | 399 | struct ath_frame_info *fi; |
399 | int nframes; | 400 | int nframes; |
@@ -437,13 +438,17 @@ static void ath_tx_complete_aggr(struct ath_softc *sc, struct ath_txq *txq, | |||
437 | tidno = ieee80211_get_qos_ctl(hdr)[0] & IEEE80211_QOS_CTL_TID_MASK; | 438 | tidno = ieee80211_get_qos_ctl(hdr)[0] & IEEE80211_QOS_CTL_TID_MASK; |
438 | tid = ATH_AN_2_TID(an, tidno); | 439 | tid = ATH_AN_2_TID(an, tidno); |
439 | seq_first = tid->seq_start; | 440 | seq_first = tid->seq_start; |
441 | isba = ts->ts_flags & ATH9K_TX_BA; | ||
440 | 442 | ||
441 | /* | 443 | /* |
442 | * The hardware occasionally sends a tx status for the wrong TID. | 444 | * The hardware occasionally sends a tx status for the wrong TID. |
443 | * In this case, the BA status cannot be considered valid and all | 445 | * In this case, the BA status cannot be considered valid and all |
444 | * subframes need to be retransmitted | 446 | * subframes need to be retransmitted |
447 | * | ||
448 | * Only BlockAcks have a TID and therefore normal Acks cannot be | ||
449 | * checked | ||
445 | */ | 450 | */ |
446 | if (tidno != ts->tid) | 451 | if (isba && tidno != ts->tid) |
447 | txok = false; | 452 | txok = false; |
448 | 453 | ||
449 | isaggr = bf_isaggr(bf); | 454 | isaggr = bf_isaggr(bf); |
@@ -1774,6 +1779,7 @@ static void ath_tx_send_normal(struct ath_softc *sc, struct ath_txq *txq, | |||
1774 | list_add_tail(&bf->list, &bf_head); | 1779 | list_add_tail(&bf->list, &bf_head); |
1775 | bf->bf_state.bf_type = 0; | 1780 | bf->bf_state.bf_type = 0; |
1776 | 1781 | ||
1782 | bf->bf_next = NULL; | ||
1777 | bf->bf_lastbf = bf; | 1783 | bf->bf_lastbf = bf; |
1778 | ath_tx_fill_desc(sc, bf, txq, fi->framelen); | 1784 | ath_tx_fill_desc(sc, bf, txq, fi->framelen); |
1779 | ath_tx_txqaddbuf(sc, txq, &bf_head, false); | 1785 | ath_tx_txqaddbuf(sc, txq, &bf_head, false); |
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c index 73730e94e0ac..c5a99c8c8168 100644 --- a/drivers/net/wireless/b43/main.c +++ b/drivers/net/wireless/b43/main.c | |||
@@ -5404,6 +5404,8 @@ static void b43_bcma_remove(struct bcma_device *core) | |||
5404 | cancel_work_sync(&wldev->restart_work); | 5404 | cancel_work_sync(&wldev->restart_work); |
5405 | 5405 | ||
5406 | B43_WARN_ON(!wl); | 5406 | B43_WARN_ON(!wl); |
5407 | if (!wldev->fw.ucode.data) | ||
5408 | return; /* NULL if firmware never loaded */ | ||
5407 | if (wl->current_dev == wldev && wl->hw_registred) { | 5409 | if (wl->current_dev == wldev && wl->hw_registred) { |
5408 | b43_leds_stop(wldev); | 5410 | b43_leds_stop(wldev); |
5409 | ieee80211_unregister_hw(wl->hw); | 5411 | ieee80211_unregister_hw(wl->hw); |
@@ -5478,6 +5480,8 @@ static void b43_ssb_remove(struct ssb_device *sdev) | |||
5478 | cancel_work_sync(&wldev->restart_work); | 5480 | cancel_work_sync(&wldev->restart_work); |
5479 | 5481 | ||
5480 | B43_WARN_ON(!wl); | 5482 | B43_WARN_ON(!wl); |
5483 | if (!wldev->fw.ucode.data) | ||
5484 | return; /* NULL if firmware never loaded */ | ||
5481 | if (wl->current_dev == wldev && wl->hw_registred) { | 5485 | if (wl->current_dev == wldev && wl->hw_registred) { |
5482 | b43_leds_stop(wldev); | 5486 | b43_leds_stop(wldev); |
5483 | ieee80211_unregister_hw(wl->hw); | 5487 | ieee80211_unregister_hw(wl->hw); |
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/usb.c b/drivers/net/wireless/brcm80211/brcmfmac/usb.c index a2b4b1e71017..7a6dfdc67b6c 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/usb.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/usb.c | |||
@@ -1339,7 +1339,7 @@ static int brcmf_usb_probe_cb(struct brcmf_usbdev_info *devinfo, | |||
1339 | } | 1339 | } |
1340 | 1340 | ||
1341 | ret = brcmf_bus_start(dev); | 1341 | ret = brcmf_bus_start(dev); |
1342 | if (ret == -ENOLINK) { | 1342 | if (ret) { |
1343 | brcmf_dbg(ERROR, "dongle is not responding\n"); | 1343 | brcmf_dbg(ERROR, "dongle is not responding\n"); |
1344 | brcmf_detach(dev); | 1344 | brcmf_detach(dev); |
1345 | goto fail; | 1345 | goto fail; |
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c index c1abaa6db59e..a6f1e8166008 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c | |||
@@ -3569,7 +3569,7 @@ brcmf_cfg80211_sched_scan_start(struct wiphy *wiphy, | |||
3569 | 3569 | ||
3570 | if (!request || !request->n_ssids || !request->n_match_sets) { | 3570 | if (!request || !request->n_ssids || !request->n_match_sets) { |
3571 | WL_ERR("Invalid sched scan req!! n_ssids:%d\n", | 3571 | WL_ERR("Invalid sched scan req!! n_ssids:%d\n", |
3572 | request->n_ssids); | 3572 | request ? request->n_ssids : 0); |
3573 | return -EINVAL; | 3573 | return -EINVAL; |
3574 | } | 3574 | } |
3575 | 3575 | ||
@@ -3972,7 +3972,7 @@ brcmf_set_management_ie(struct brcmf_cfg80211_info *cfg, | |||
3972 | u8 *iovar_ie_buf; | 3972 | u8 *iovar_ie_buf; |
3973 | u8 *curr_ie_buf; | 3973 | u8 *curr_ie_buf; |
3974 | u8 *mgmt_ie_buf = NULL; | 3974 | u8 *mgmt_ie_buf = NULL; |
3975 | u32 mgmt_ie_buf_len = 0; | 3975 | int mgmt_ie_buf_len; |
3976 | u32 *mgmt_ie_len = 0; | 3976 | u32 *mgmt_ie_len = 0; |
3977 | u32 del_add_ie_buf_len = 0; | 3977 | u32 del_add_ie_buf_len = 0; |
3978 | u32 total_ie_buf_len = 0; | 3978 | u32 total_ie_buf_len = 0; |
@@ -3982,7 +3982,7 @@ brcmf_set_management_ie(struct brcmf_cfg80211_info *cfg, | |||
3982 | struct parsed_vndr_ie_info *vndrie_info; | 3982 | struct parsed_vndr_ie_info *vndrie_info; |
3983 | s32 i; | 3983 | s32 i; |
3984 | u8 *ptr; | 3984 | u8 *ptr; |
3985 | u32 remained_buf_len; | 3985 | int remained_buf_len; |
3986 | 3986 | ||
3987 | WL_TRACE("bssidx %d, pktflag : 0x%02X\n", bssidx, pktflag); | 3987 | WL_TRACE("bssidx %d, pktflag : 0x%02X\n", bssidx, pktflag); |
3988 | iovar_ie_buf = kzalloc(WL_EXTRA_BUF_MAX, GFP_KERNEL); | 3988 | iovar_ie_buf = kzalloc(WL_EXTRA_BUF_MAX, GFP_KERNEL); |
@@ -4606,12 +4606,13 @@ brcmf_bss_roaming_done(struct brcmf_cfg80211_info *cfg, | |||
4606 | struct brcmf_cfg80211_profile *profile = cfg->profile; | 4606 | struct brcmf_cfg80211_profile *profile = cfg->profile; |
4607 | struct brcmf_cfg80211_connect_info *conn_info = cfg_to_conn(cfg); | 4607 | struct brcmf_cfg80211_connect_info *conn_info = cfg_to_conn(cfg); |
4608 | struct wiphy *wiphy = cfg_to_wiphy(cfg); | 4608 | struct wiphy *wiphy = cfg_to_wiphy(cfg); |
4609 | struct brcmf_channel_info_le channel_le; | 4609 | struct ieee80211_channel *notify_channel = NULL; |
4610 | struct ieee80211_channel *notify_channel; | ||
4611 | struct ieee80211_supported_band *band; | 4610 | struct ieee80211_supported_band *band; |
4611 | struct brcmf_bss_info_le *bi; | ||
4612 | u32 freq; | 4612 | u32 freq; |
4613 | s32 err = 0; | 4613 | s32 err = 0; |
4614 | u32 target_channel; | 4614 | u32 target_channel; |
4615 | u8 *buf; | ||
4615 | 4616 | ||
4616 | WL_TRACE("Enter\n"); | 4617 | WL_TRACE("Enter\n"); |
4617 | 4618 | ||
@@ -4619,11 +4620,22 @@ brcmf_bss_roaming_done(struct brcmf_cfg80211_info *cfg, | |||
4619 | memcpy(profile->bssid, e->addr, ETH_ALEN); | 4620 | memcpy(profile->bssid, e->addr, ETH_ALEN); |
4620 | brcmf_update_bss_info(cfg); | 4621 | brcmf_update_bss_info(cfg); |
4621 | 4622 | ||
4622 | brcmf_exec_dcmd(ndev, BRCMF_C_GET_CHANNEL, &channel_le, | 4623 | buf = kzalloc(WL_BSS_INFO_MAX, GFP_KERNEL); |
4623 | sizeof(channel_le)); | 4624 | if (buf == NULL) { |
4625 | err = -ENOMEM; | ||
4626 | goto done; | ||
4627 | } | ||
4628 | |||
4629 | /* data sent to dongle has to be little endian */ | ||
4630 | *(__le32 *)buf = cpu_to_le32(WL_BSS_INFO_MAX); | ||
4631 | err = brcmf_exec_dcmd(ndev, BRCMF_C_GET_BSS_INFO, buf, WL_BSS_INFO_MAX); | ||
4632 | |||
4633 | if (err) | ||
4634 | goto done; | ||
4624 | 4635 | ||
4625 | target_channel = le32_to_cpu(channel_le.target_channel); | 4636 | bi = (struct brcmf_bss_info_le *)(buf + 4); |
4626 | WL_CONN("Roamed to channel %d\n", target_channel); | 4637 | target_channel = bi->ctl_ch ? bi->ctl_ch : |
4638 | CHSPEC_CHANNEL(le16_to_cpu(bi->chanspec)); | ||
4627 | 4639 | ||
4628 | if (target_channel <= CH_MAX_2G_CHANNEL) | 4640 | if (target_channel <= CH_MAX_2G_CHANNEL) |
4629 | band = wiphy->bands[IEEE80211_BAND_2GHZ]; | 4641 | band = wiphy->bands[IEEE80211_BAND_2GHZ]; |
@@ -4633,6 +4645,8 @@ brcmf_bss_roaming_done(struct brcmf_cfg80211_info *cfg, | |||
4633 | freq = ieee80211_channel_to_frequency(target_channel, band->band); | 4645 | freq = ieee80211_channel_to_frequency(target_channel, band->band); |
4634 | notify_channel = ieee80211_get_channel(wiphy, freq); | 4646 | notify_channel = ieee80211_get_channel(wiphy, freq); |
4635 | 4647 | ||
4648 | done: | ||
4649 | kfree(buf); | ||
4636 | cfg80211_roamed(ndev, notify_channel, (u8 *)profile->bssid, | 4650 | cfg80211_roamed(ndev, notify_channel, (u8 *)profile->bssid, |
4637 | conn_info->req_ie, conn_info->req_ie_len, | 4651 | conn_info->req_ie, conn_info->req_ie_len, |
4638 | conn_info->resp_ie, conn_info->resp_ie_len, GFP_KERNEL); | 4652 | conn_info->resp_ie, conn_info->resp_ie_len, GFP_KERNEL); |
@@ -5186,41 +5200,6 @@ brcmf_cfg80211_event(struct net_device *ndev, | |||
5186 | schedule_work(&cfg->event_work); | 5200 | schedule_work(&cfg->event_work); |
5187 | } | 5201 | } |
5188 | 5202 | ||
5189 | static s32 brcmf_dongle_mode(struct net_device *ndev, s32 iftype) | ||
5190 | { | ||
5191 | s32 infra = 0; | ||
5192 | s32 err = 0; | ||
5193 | |||
5194 | switch (iftype) { | ||
5195 | case NL80211_IFTYPE_MONITOR: | ||
5196 | case NL80211_IFTYPE_WDS: | ||
5197 | WL_ERR("type (%d) : currently we do not support this mode\n", | ||
5198 | iftype); | ||
5199 | err = -EINVAL; | ||
5200 | return err; | ||
5201 | case NL80211_IFTYPE_ADHOC: | ||
5202 | infra = 0; | ||
5203 | break; | ||
5204 | case NL80211_IFTYPE_STATION: | ||
5205 | infra = 1; | ||
5206 | break; | ||
5207 | case NL80211_IFTYPE_AP: | ||
5208 | infra = 1; | ||
5209 | break; | ||
5210 | default: | ||
5211 | err = -EINVAL; | ||
5212 | WL_ERR("invalid type (%d)\n", iftype); | ||
5213 | return err; | ||
5214 | } | ||
5215 | err = brcmf_exec_dcmd_u32(ndev, BRCMF_C_SET_INFRA, &infra); | ||
5216 | if (err) { | ||
5217 | WL_ERR("WLC_SET_INFRA error (%d)\n", err); | ||
5218 | return err; | ||
5219 | } | ||
5220 | |||
5221 | return 0; | ||
5222 | } | ||
5223 | |||
5224 | static s32 brcmf_dongle_eventmsg(struct net_device *ndev) | 5203 | static s32 brcmf_dongle_eventmsg(struct net_device *ndev) |
5225 | { | 5204 | { |
5226 | /* Room for "event_msgs" + '\0' + bitvec */ | 5205 | /* Room for "event_msgs" + '\0' + bitvec */ |
@@ -5439,7 +5418,8 @@ static s32 brcmf_config_dongle(struct brcmf_cfg80211_info *cfg) | |||
5439 | WL_BEACON_TIMEOUT); | 5418 | WL_BEACON_TIMEOUT); |
5440 | if (err) | 5419 | if (err) |
5441 | goto default_conf_out; | 5420 | goto default_conf_out; |
5442 | err = brcmf_dongle_mode(ndev, wdev->iftype); | 5421 | err = brcmf_cfg80211_change_iface(wdev->wiphy, ndev, wdev->iftype, |
5422 | NULL, NULL); | ||
5443 | if (err && err != -EINPROGRESS) | 5423 | if (err && err != -EINPROGRESS) |
5444 | goto default_conf_out; | 5424 | goto default_conf_out; |
5445 | err = brcmf_dongle_probecap(cfg); | 5425 | err = brcmf_dongle_probecap(cfg); |
diff --git a/drivers/net/wireless/ipw2x00/ipw2200.c b/drivers/net/wireless/ipw2x00/ipw2200.c index 935120fc8c93..768bf612533e 100644 --- a/drivers/net/wireless/ipw2x00/ipw2200.c +++ b/drivers/net/wireless/ipw2x00/ipw2200.c | |||
@@ -10472,7 +10472,7 @@ static void ipw_handle_promiscuous_tx(struct ipw_priv *priv, | |||
10472 | } else | 10472 | } else |
10473 | len = src->len; | 10473 | len = src->len; |
10474 | 10474 | ||
10475 | dst = alloc_skb(len + sizeof(*rt_hdr), GFP_ATOMIC); | 10475 | dst = alloc_skb(len + sizeof(*rt_hdr) + sizeof(u16)*2, GFP_ATOMIC); |
10476 | if (!dst) | 10476 | if (!dst) |
10477 | continue; | 10477 | continue; |
10478 | 10478 | ||
diff --git a/drivers/net/wireless/iwlwifi/dvm/devices.c b/drivers/net/wireless/iwlwifi/dvm/devices.c index 349c205d5f62..da5862064195 100644 --- a/drivers/net/wireless/iwlwifi/dvm/devices.c +++ b/drivers/net/wireless/iwlwifi/dvm/devices.c | |||
@@ -518,7 +518,7 @@ static int iwl6000_hw_channel_switch(struct iwl_priv *priv, | |||
518 | * See iwlagn_mac_channel_switch. | 518 | * See iwlagn_mac_channel_switch. |
519 | */ | 519 | */ |
520 | struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; | 520 | struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; |
521 | struct iwl6000_channel_switch_cmd cmd; | 521 | struct iwl6000_channel_switch_cmd *cmd; |
522 | u32 switch_time_in_usec, ucode_switch_time; | 522 | u32 switch_time_in_usec, ucode_switch_time; |
523 | u16 ch; | 523 | u16 ch; |
524 | u32 tsf_low; | 524 | u32 tsf_low; |
@@ -527,18 +527,25 @@ static int iwl6000_hw_channel_switch(struct iwl_priv *priv, | |||
527 | struct ieee80211_vif *vif = ctx->vif; | 527 | struct ieee80211_vif *vif = ctx->vif; |
528 | struct iwl_host_cmd hcmd = { | 528 | struct iwl_host_cmd hcmd = { |
529 | .id = REPLY_CHANNEL_SWITCH, | 529 | .id = REPLY_CHANNEL_SWITCH, |
530 | .len = { sizeof(cmd), }, | 530 | .len = { sizeof(*cmd), }, |
531 | .flags = CMD_SYNC, | 531 | .flags = CMD_SYNC, |
532 | .data = { &cmd, }, | 532 | .dataflags[0] = IWL_HCMD_DFL_NOCOPY, |
533 | }; | 533 | }; |
534 | int err; | ||
534 | 535 | ||
535 | cmd.band = priv->band == IEEE80211_BAND_2GHZ; | 536 | cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); |
537 | if (!cmd) | ||
538 | return -ENOMEM; | ||
539 | |||
540 | hcmd.data[0] = cmd; | ||
541 | |||
542 | cmd->band = priv->band == IEEE80211_BAND_2GHZ; | ||
536 | ch = ch_switch->channel->hw_value; | 543 | ch = ch_switch->channel->hw_value; |
537 | IWL_DEBUG_11H(priv, "channel switch from %u to %u\n", | 544 | IWL_DEBUG_11H(priv, "channel switch from %u to %u\n", |
538 | ctx->active.channel, ch); | 545 | ctx->active.channel, ch); |
539 | cmd.channel = cpu_to_le16(ch); | 546 | cmd->channel = cpu_to_le16(ch); |
540 | cmd.rxon_flags = ctx->staging.flags; | 547 | cmd->rxon_flags = ctx->staging.flags; |
541 | cmd.rxon_filter_flags = ctx->staging.filter_flags; | 548 | cmd->rxon_filter_flags = ctx->staging.filter_flags; |
542 | switch_count = ch_switch->count; | 549 | switch_count = ch_switch->count; |
543 | tsf_low = ch_switch->timestamp & 0x0ffffffff; | 550 | tsf_low = ch_switch->timestamp & 0x0ffffffff; |
544 | /* | 551 | /* |
@@ -554,23 +561,25 @@ static int iwl6000_hw_channel_switch(struct iwl_priv *priv, | |||
554 | switch_count = 0; | 561 | switch_count = 0; |
555 | } | 562 | } |
556 | if (switch_count <= 1) | 563 | if (switch_count <= 1) |
557 | cmd.switch_time = cpu_to_le32(priv->ucode_beacon_time); | 564 | cmd->switch_time = cpu_to_le32(priv->ucode_beacon_time); |
558 | else { | 565 | else { |
559 | switch_time_in_usec = | 566 | switch_time_in_usec = |
560 | vif->bss_conf.beacon_int * switch_count * TIME_UNIT; | 567 | vif->bss_conf.beacon_int * switch_count * TIME_UNIT; |
561 | ucode_switch_time = iwl_usecs_to_beacons(priv, | 568 | ucode_switch_time = iwl_usecs_to_beacons(priv, |
562 | switch_time_in_usec, | 569 | switch_time_in_usec, |
563 | beacon_interval); | 570 | beacon_interval); |
564 | cmd.switch_time = iwl_add_beacon_time(priv, | 571 | cmd->switch_time = iwl_add_beacon_time(priv, |
565 | priv->ucode_beacon_time, | 572 | priv->ucode_beacon_time, |
566 | ucode_switch_time, | 573 | ucode_switch_time, |
567 | beacon_interval); | 574 | beacon_interval); |
568 | } | 575 | } |
569 | IWL_DEBUG_11H(priv, "uCode time for the switch is 0x%x\n", | 576 | IWL_DEBUG_11H(priv, "uCode time for the switch is 0x%x\n", |
570 | cmd.switch_time); | 577 | cmd->switch_time); |
571 | cmd.expect_beacon = ch_switch->channel->flags & IEEE80211_CHAN_RADAR; | 578 | cmd->expect_beacon = ch_switch->channel->flags & IEEE80211_CHAN_RADAR; |
572 | 579 | ||
573 | return iwl_dvm_send_cmd(priv, &hcmd); | 580 | err = iwl_dvm_send_cmd(priv, &hcmd); |
581 | kfree(cmd); | ||
582 | return err; | ||
574 | } | 583 | } |
575 | 584 | ||
576 | struct iwl_lib_ops iwl6000_lib = { | 585 | struct iwl_lib_ops iwl6000_lib = { |
diff --git a/drivers/net/wireless/mwifiex/cfg80211.c b/drivers/net/wireless/mwifiex/cfg80211.c index 0679458a1bac..780d3e168297 100644 --- a/drivers/net/wireless/mwifiex/cfg80211.c +++ b/drivers/net/wireless/mwifiex/cfg80211.c | |||
@@ -1825,8 +1825,6 @@ mwifiex_cfg80211_scan(struct wiphy *wiphy, | |||
1825 | return -EBUSY; | 1825 | return -EBUSY; |
1826 | } | 1826 | } |
1827 | 1827 | ||
1828 | priv->scan_request = request; | ||
1829 | |||
1830 | priv->user_scan_cfg = kzalloc(sizeof(struct mwifiex_user_scan_cfg), | 1828 | priv->user_scan_cfg = kzalloc(sizeof(struct mwifiex_user_scan_cfg), |
1831 | GFP_KERNEL); | 1829 | GFP_KERNEL); |
1832 | if (!priv->user_scan_cfg) { | 1830 | if (!priv->user_scan_cfg) { |
@@ -1834,6 +1832,8 @@ mwifiex_cfg80211_scan(struct wiphy *wiphy, | |||
1834 | return -ENOMEM; | 1832 | return -ENOMEM; |
1835 | } | 1833 | } |
1836 | 1834 | ||
1835 | priv->scan_request = request; | ||
1836 | |||
1837 | priv->user_scan_cfg->num_ssids = request->n_ssids; | 1837 | priv->user_scan_cfg->num_ssids = request->n_ssids; |
1838 | priv->user_scan_cfg->ssid_list = request->ssids; | 1838 | priv->user_scan_cfg->ssid_list = request->ssids; |
1839 | 1839 | ||
@@ -1870,6 +1870,9 @@ mwifiex_cfg80211_scan(struct wiphy *wiphy, | |||
1870 | ret = mwifiex_scan_networks(priv, priv->user_scan_cfg); | 1870 | ret = mwifiex_scan_networks(priv, priv->user_scan_cfg); |
1871 | if (ret) { | 1871 | if (ret) { |
1872 | dev_err(priv->adapter->dev, "scan failed: %d\n", ret); | 1872 | dev_err(priv->adapter->dev, "scan failed: %d\n", ret); |
1873 | priv->scan_request = NULL; | ||
1874 | kfree(priv->user_scan_cfg); | ||
1875 | priv->user_scan_cfg = NULL; | ||
1873 | return ret; | 1876 | return ret; |
1874 | } | 1877 | } |
1875 | 1878 | ||
diff --git a/drivers/net/wireless/mwifiex/scan.c b/drivers/net/wireless/mwifiex/scan.c index 00b658d3b6ec..9171aaedbccd 100644 --- a/drivers/net/wireless/mwifiex/scan.c +++ b/drivers/net/wireless/mwifiex/scan.c | |||
@@ -1843,21 +1843,18 @@ static int mwifiex_scan_specific_ssid(struct mwifiex_private *priv, | |||
1843 | struct cfg80211_ssid *req_ssid) | 1843 | struct cfg80211_ssid *req_ssid) |
1844 | { | 1844 | { |
1845 | struct mwifiex_adapter *adapter = priv->adapter; | 1845 | struct mwifiex_adapter *adapter = priv->adapter; |
1846 | int ret = 0; | 1846 | int ret; |
1847 | struct mwifiex_user_scan_cfg *scan_cfg; | 1847 | struct mwifiex_user_scan_cfg *scan_cfg; |
1848 | 1848 | ||
1849 | if (!req_ssid) | ||
1850 | return -1; | ||
1851 | |||
1852 | if (adapter->scan_processing) { | 1849 | if (adapter->scan_processing) { |
1853 | dev_dbg(adapter->dev, "cmd: Scan already in process...\n"); | 1850 | dev_err(adapter->dev, "cmd: Scan already in process...\n"); |
1854 | return ret; | 1851 | return -EBUSY; |
1855 | } | 1852 | } |
1856 | 1853 | ||
1857 | if (priv->scan_block) { | 1854 | if (priv->scan_block) { |
1858 | dev_dbg(adapter->dev, | 1855 | dev_err(adapter->dev, |
1859 | "cmd: Scan is blocked during association...\n"); | 1856 | "cmd: Scan is blocked during association...\n"); |
1860 | return ret; | 1857 | return -EBUSY; |
1861 | } | 1858 | } |
1862 | 1859 | ||
1863 | scan_cfg = kzalloc(sizeof(struct mwifiex_user_scan_cfg), GFP_KERNEL); | 1860 | scan_cfg = kzalloc(sizeof(struct mwifiex_user_scan_cfg), GFP_KERNEL); |
diff --git a/drivers/net/wireless/rt2x00/rt2500usb.c b/drivers/net/wireless/rt2x00/rt2500usb.c index a12e84f892be..6b2e1e431dd2 100644 --- a/drivers/net/wireless/rt2x00/rt2500usb.c +++ b/drivers/net/wireless/rt2x00/rt2500usb.c | |||
@@ -1988,6 +1988,7 @@ static struct usb_driver rt2500usb_driver = { | |||
1988 | .disconnect = rt2x00usb_disconnect, | 1988 | .disconnect = rt2x00usb_disconnect, |
1989 | .suspend = rt2x00usb_suspend, | 1989 | .suspend = rt2x00usb_suspend, |
1990 | .resume = rt2x00usb_resume, | 1990 | .resume = rt2x00usb_resume, |
1991 | .reset_resume = rt2x00usb_resume, | ||
1991 | .disable_hub_initiated_lpm = 1, | 1992 | .disable_hub_initiated_lpm = 1, |
1992 | }; | 1993 | }; |
1993 | 1994 | ||
diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c index 01dc8891070c..59474ae0aec0 100644 --- a/drivers/net/wireless/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/rt2x00/rt2800lib.c | |||
@@ -2449,7 +2449,7 @@ static int rt2800_get_gain_calibration_delta(struct rt2x00_dev *rt2x00dev) | |||
2449 | /* | 2449 | /* |
2450 | * Check if temperature compensation is supported. | 2450 | * Check if temperature compensation is supported. |
2451 | */ | 2451 | */ |
2452 | if (tssi_bounds[4] == 0xff) | 2452 | if (tssi_bounds[4] == 0xff || step == 0xff) |
2453 | return 0; | 2453 | return 0; |
2454 | 2454 | ||
2455 | /* | 2455 | /* |
diff --git a/drivers/net/wireless/rt2x00/rt2800usb.c b/drivers/net/wireless/rt2x00/rt2800usb.c index c9e9370eb789..3b8fb5a603f2 100644 --- a/drivers/net/wireless/rt2x00/rt2800usb.c +++ b/drivers/net/wireless/rt2x00/rt2800usb.c | |||
@@ -1282,6 +1282,7 @@ static struct usb_driver rt2800usb_driver = { | |||
1282 | .disconnect = rt2x00usb_disconnect, | 1282 | .disconnect = rt2x00usb_disconnect, |
1283 | .suspend = rt2x00usb_suspend, | 1283 | .suspend = rt2x00usb_suspend, |
1284 | .resume = rt2x00usb_resume, | 1284 | .resume = rt2x00usb_resume, |
1285 | .reset_resume = rt2x00usb_resume, | ||
1285 | .disable_hub_initiated_lpm = 1, | 1286 | .disable_hub_initiated_lpm = 1, |
1286 | }; | 1287 | }; |
1287 | 1288 | ||
diff --git a/drivers/net/wireless/rt2x00/rt73usb.c b/drivers/net/wireless/rt2x00/rt73usb.c index e5eb43b3eee7..24eec66e9fd2 100644 --- a/drivers/net/wireless/rt2x00/rt73usb.c +++ b/drivers/net/wireless/rt2x00/rt73usb.c | |||
@@ -2535,6 +2535,7 @@ static struct usb_driver rt73usb_driver = { | |||
2535 | .disconnect = rt2x00usb_disconnect, | 2535 | .disconnect = rt2x00usb_disconnect, |
2536 | .suspend = rt2x00usb_suspend, | 2536 | .suspend = rt2x00usb_suspend, |
2537 | .resume = rt2x00usb_resume, | 2537 | .resume = rt2x00usb_resume, |
2538 | .reset_resume = rt2x00usb_resume, | ||
2538 | .disable_hub_initiated_lpm = 1, | 2539 | .disable_hub_initiated_lpm = 1, |
2539 | }; | 2540 | }; |
2540 | 2541 | ||
diff --git a/drivers/net/wireless/rtlwifi/usb.c b/drivers/net/wireless/rtlwifi/usb.c index 030beb45d8b0..e3ea4b346889 100644 --- a/drivers/net/wireless/rtlwifi/usb.c +++ b/drivers/net/wireless/rtlwifi/usb.c | |||
@@ -673,7 +673,7 @@ static int rtl_usb_start(struct ieee80211_hw *hw) | |||
673 | set_hal_start(rtlhal); | 673 | set_hal_start(rtlhal); |
674 | 674 | ||
675 | /* Start bulk IN */ | 675 | /* Start bulk IN */ |
676 | _rtl_usb_receive(hw); | 676 | err = _rtl_usb_receive(hw); |
677 | } | 677 | } |
678 | 678 | ||
679 | return err; | 679 | return err; |
diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c index 0f1ec9e8ff14..2e39c04fc16b 100644 --- a/drivers/pinctrl/core.c +++ b/drivers/pinctrl/core.c | |||
@@ -1061,8 +1061,10 @@ static int pinctrl_groups_show(struct seq_file *s, void *what) | |||
1061 | seq_printf(s, "group: %s\n", gname); | 1061 | seq_printf(s, "group: %s\n", gname); |
1062 | for (i = 0; i < num_pins; i++) { | 1062 | for (i = 0; i < num_pins; i++) { |
1063 | pname = pin_get_name(pctldev, pins[i]); | 1063 | pname = pin_get_name(pctldev, pins[i]); |
1064 | if (WARN_ON(!pname)) | 1064 | if (WARN_ON(!pname)) { |
1065 | mutex_unlock(&pinctrl_mutex); | ||
1065 | return -EINVAL; | 1066 | return -EINVAL; |
1067 | } | ||
1066 | seq_printf(s, "pin %d (%s)\n", pins[i], pname); | 1068 | seq_printf(s, "pin %d (%s)\n", pins[i], pname); |
1067 | } | 1069 | } |
1068 | seq_puts(s, "\n"); | 1070 | seq_puts(s, "\n"); |
diff --git a/drivers/pinctrl/pinconf.c b/drivers/pinctrl/pinconf.c index 43f474cdc110..baee2cc46a17 100644 --- a/drivers/pinctrl/pinconf.c +++ b/drivers/pinctrl/pinconf.c | |||
@@ -537,8 +537,6 @@ static int pinconf_groups_show(struct seq_file *s, void *what) | |||
537 | seq_puts(s, "Pin config settings per pin group\n"); | 537 | seq_puts(s, "Pin config settings per pin group\n"); |
538 | seq_puts(s, "Format: group (name): configs\n"); | 538 | seq_puts(s, "Format: group (name): configs\n"); |
539 | 539 | ||
540 | mutex_lock(&pinctrl_mutex); | ||
541 | |||
542 | while (selector < ngroups) { | 540 | while (selector < ngroups) { |
543 | const char *gname = pctlops->get_group_name(pctldev, selector); | 541 | const char *gname = pctlops->get_group_name(pctldev, selector); |
544 | 542 | ||
@@ -549,8 +547,6 @@ static int pinconf_groups_show(struct seq_file *s, void *what) | |||
549 | selector++; | 547 | selector++; |
550 | } | 548 | } |
551 | 549 | ||
552 | mutex_unlock(&pinctrl_mutex); | ||
553 | |||
554 | return 0; | 550 | return 0; |
555 | } | 551 | } |
556 | 552 | ||
diff --git a/drivers/pinctrl/pinctrl-nomadik.c b/drivers/pinctrl/pinctrl-nomadik.c index 01aea1c3b5fa..cf82d9ce4dee 100644 --- a/drivers/pinctrl/pinctrl-nomadik.c +++ b/drivers/pinctrl/pinctrl-nomadik.c | |||
@@ -1056,7 +1056,7 @@ static int nmk_gpio_to_irq(struct gpio_chip *chip, unsigned offset) | |||
1056 | struct nmk_gpio_chip *nmk_chip = | 1056 | struct nmk_gpio_chip *nmk_chip = |
1057 | container_of(chip, struct nmk_gpio_chip, chip); | 1057 | container_of(chip, struct nmk_gpio_chip, chip); |
1058 | 1058 | ||
1059 | return irq_find_mapping(nmk_chip->domain, offset); | 1059 | return irq_create_mapping(nmk_chip->domain, offset); |
1060 | } | 1060 | } |
1061 | 1061 | ||
1062 | #ifdef CONFIG_DEBUG_FS | 1062 | #ifdef CONFIG_DEBUG_FS |
@@ -1281,7 +1281,7 @@ static int __devinit nmk_gpio_probe(struct platform_device *dev) | |||
1281 | struct clk *clk; | 1281 | struct clk *clk; |
1282 | int secondary_irq; | 1282 | int secondary_irq; |
1283 | void __iomem *base; | 1283 | void __iomem *base; |
1284 | int irq_start = -1; | 1284 | int irq_start = 0; |
1285 | int irq; | 1285 | int irq; |
1286 | int ret; | 1286 | int ret; |
1287 | 1287 | ||
@@ -1387,7 +1387,7 @@ static int __devinit nmk_gpio_probe(struct platform_device *dev) | |||
1387 | 1387 | ||
1388 | if (!np) | 1388 | if (!np) |
1389 | irq_start = NOMADIK_GPIO_TO_IRQ(pdata->first_gpio); | 1389 | irq_start = NOMADIK_GPIO_TO_IRQ(pdata->first_gpio); |
1390 | nmk_chip->domain = irq_domain_add_simple(NULL, | 1390 | nmk_chip->domain = irq_domain_add_simple(np, |
1391 | NMK_GPIO_PER_CHIP, irq_start, | 1391 | NMK_GPIO_PER_CHIP, irq_start, |
1392 | &nmk_gpio_irq_simple_ops, nmk_chip); | 1392 | &nmk_gpio_irq_simple_ops, nmk_chip); |
1393 | if (!nmk_chip->domain) { | 1393 | if (!nmk_chip->domain) { |
diff --git a/drivers/pinctrl/pinctrl-tegra.c b/drivers/pinctrl/pinctrl-tegra.c index 729b686c3ad2..7da0b371fd65 100644 --- a/drivers/pinctrl/pinctrl-tegra.c +++ b/drivers/pinctrl/pinctrl-tegra.c | |||
@@ -464,7 +464,7 @@ static int tegra_pinconf_reg(struct tegra_pmx *pmx, | |||
464 | *bank = g->drv_bank; | 464 | *bank = g->drv_bank; |
465 | *reg = g->drv_reg; | 465 | *reg = g->drv_reg; |
466 | *bit = g->lpmd_bit; | 466 | *bit = g->lpmd_bit; |
467 | *width = 1; | 467 | *width = 2; |
468 | break; | 468 | break; |
469 | case TEGRA_PINCONF_PARAM_DRIVE_DOWN_STRENGTH: | 469 | case TEGRA_PINCONF_PARAM_DRIVE_DOWN_STRENGTH: |
470 | *bank = g->drv_bank; | 470 | *bank = g->drv_bank; |
diff --git a/drivers/pinctrl/pinctrl-tegra30.c b/drivers/pinctrl/pinctrl-tegra30.c index 0386fdf0da16..7894f14c7059 100644 --- a/drivers/pinctrl/pinctrl-tegra30.c +++ b/drivers/pinctrl/pinctrl-tegra30.c | |||
@@ -3345,10 +3345,10 @@ static const struct tegra_function tegra30_functions[] = { | |||
3345 | FUNCTION(vi_alt3), | 3345 | FUNCTION(vi_alt3), |
3346 | }; | 3346 | }; |
3347 | 3347 | ||
3348 | #define MUXCTL_REG_A 0x3000 | 3348 | #define DRV_PINGROUP_REG_A 0x868 /* bank 0 */ |
3349 | #define PINGROUP_REG_A 0x868 | 3349 | #define PINGROUP_REG_A 0x3000 /* bank 1 */ |
3350 | 3350 | ||
3351 | #define PINGROUP_REG_Y(r) ((r) - MUXCTL_REG_A) | 3351 | #define PINGROUP_REG_Y(r) ((r) - PINGROUP_REG_A) |
3352 | #define PINGROUP_REG_N(r) -1 | 3352 | #define PINGROUP_REG_N(r) -1 |
3353 | 3353 | ||
3354 | #define PINGROUP(pg_name, f0, f1, f2, f3, f_safe, r, od, ior) \ | 3354 | #define PINGROUP(pg_name, f0, f1, f2, f3, f_safe, r, od, ior) \ |
@@ -3364,25 +3364,25 @@ static const struct tegra_function tegra30_functions[] = { | |||
3364 | }, \ | 3364 | }, \ |
3365 | .func_safe = TEGRA_MUX_ ## f_safe, \ | 3365 | .func_safe = TEGRA_MUX_ ## f_safe, \ |
3366 | .mux_reg = PINGROUP_REG_Y(r), \ | 3366 | .mux_reg = PINGROUP_REG_Y(r), \ |
3367 | .mux_bank = 0, \ | 3367 | .mux_bank = 1, \ |
3368 | .mux_bit = 0, \ | 3368 | .mux_bit = 0, \ |
3369 | .pupd_reg = PINGROUP_REG_Y(r), \ | 3369 | .pupd_reg = PINGROUP_REG_Y(r), \ |
3370 | .pupd_bank = 0, \ | 3370 | .pupd_bank = 1, \ |
3371 | .pupd_bit = 2, \ | 3371 | .pupd_bit = 2, \ |
3372 | .tri_reg = PINGROUP_REG_Y(r), \ | 3372 | .tri_reg = PINGROUP_REG_Y(r), \ |
3373 | .tri_bank = 0, \ | 3373 | .tri_bank = 1, \ |
3374 | .tri_bit = 4, \ | 3374 | .tri_bit = 4, \ |
3375 | .einput_reg = PINGROUP_REG_Y(r), \ | 3375 | .einput_reg = PINGROUP_REG_Y(r), \ |
3376 | .einput_bank = 0, \ | 3376 | .einput_bank = 1, \ |
3377 | .einput_bit = 5, \ | 3377 | .einput_bit = 5, \ |
3378 | .odrain_reg = PINGROUP_REG_##od(r), \ | 3378 | .odrain_reg = PINGROUP_REG_##od(r), \ |
3379 | .odrain_bank = 0, \ | 3379 | .odrain_bank = 1, \ |
3380 | .odrain_bit = 6, \ | 3380 | .odrain_bit = 6, \ |
3381 | .lock_reg = PINGROUP_REG_Y(r), \ | 3381 | .lock_reg = PINGROUP_REG_Y(r), \ |
3382 | .lock_bank = 0, \ | 3382 | .lock_bank = 1, \ |
3383 | .lock_bit = 7, \ | 3383 | .lock_bit = 7, \ |
3384 | .ioreset_reg = PINGROUP_REG_##ior(r), \ | 3384 | .ioreset_reg = PINGROUP_REG_##ior(r), \ |
3385 | .ioreset_bank = 0, \ | 3385 | .ioreset_bank = 1, \ |
3386 | .ioreset_bit = 8, \ | 3386 | .ioreset_bit = 8, \ |
3387 | .drv_reg = -1, \ | 3387 | .drv_reg = -1, \ |
3388 | } | 3388 | } |
@@ -3401,8 +3401,8 @@ static const struct tegra_function tegra30_functions[] = { | |||
3401 | .odrain_reg = -1, \ | 3401 | .odrain_reg = -1, \ |
3402 | .lock_reg = -1, \ | 3402 | .lock_reg = -1, \ |
3403 | .ioreset_reg = -1, \ | 3403 | .ioreset_reg = -1, \ |
3404 | .drv_reg = ((r) - PINGROUP_REG_A), \ | 3404 | .drv_reg = ((r) - DRV_PINGROUP_REG_A), \ |
3405 | .drv_bank = 1, \ | 3405 | .drv_bank = 0, \ |
3406 | .hsm_bit = hsm_b, \ | 3406 | .hsm_bit = hsm_b, \ |
3407 | .schmitt_bit = schmitt_b, \ | 3407 | .schmitt_bit = schmitt_b, \ |
3408 | .lpmd_bit = lpmd_b, \ | 3408 | .lpmd_bit = lpmd_b, \ |
diff --git a/drivers/power/avs/smartreflex.c b/drivers/power/avs/smartreflex.c index 24768a27e1d8..4c4519e59be4 100644 --- a/drivers/power/avs/smartreflex.c +++ b/drivers/power/avs/smartreflex.c | |||
@@ -130,24 +130,21 @@ static irqreturn_t sr_interrupt(int irq, void *data) | |||
130 | 130 | ||
131 | static void sr_set_clk_length(struct omap_sr *sr) | 131 | static void sr_set_clk_length(struct omap_sr *sr) |
132 | { | 132 | { |
133 | struct clk *sys_ck; | 133 | struct clk *fck; |
134 | u32 sys_clk_speed; | 134 | u32 fclk_speed; |
135 | 135 | ||
136 | if (cpu_is_omap34xx()) | 136 | fck = clk_get(&sr->pdev->dev, "fck"); |
137 | sys_ck = clk_get(NULL, "sys_ck"); | ||
138 | else | ||
139 | sys_ck = clk_get(NULL, "sys_clkin_ck"); | ||
140 | 137 | ||
141 | if (IS_ERR(sys_ck)) { | 138 | if (IS_ERR(fck)) { |
142 | dev_err(&sr->pdev->dev, "%s: unable to get sys clk\n", | 139 | dev_err(&sr->pdev->dev, "%s: unable to get fck for device %s\n", |
143 | __func__); | 140 | __func__, dev_name(&sr->pdev->dev)); |
144 | return; | 141 | return; |
145 | } | 142 | } |
146 | 143 | ||
147 | sys_clk_speed = clk_get_rate(sys_ck); | 144 | fclk_speed = clk_get_rate(fck); |
148 | clk_put(sys_ck); | 145 | clk_put(fck); |
149 | 146 | ||
150 | switch (sys_clk_speed) { | 147 | switch (fclk_speed) { |
151 | case 12000000: | 148 | case 12000000: |
152 | sr->clk_length = SRCLKLENGTH_12MHZ_SYSCLK; | 149 | sr->clk_length = SRCLKLENGTH_12MHZ_SYSCLK; |
153 | break; | 150 | break; |
@@ -164,34 +161,12 @@ static void sr_set_clk_length(struct omap_sr *sr) | |||
164 | sr->clk_length = SRCLKLENGTH_38MHZ_SYSCLK; | 161 | sr->clk_length = SRCLKLENGTH_38MHZ_SYSCLK; |
165 | break; | 162 | break; |
166 | default: | 163 | default: |
167 | dev_err(&sr->pdev->dev, "%s: Invalid sysclk value: %d\n", | 164 | dev_err(&sr->pdev->dev, "%s: Invalid fclk rate: %d\n", |
168 | __func__, sys_clk_speed); | 165 | __func__, fclk_speed); |
169 | break; | 166 | break; |
170 | } | 167 | } |
171 | } | 168 | } |
172 | 169 | ||
173 | static void sr_set_regfields(struct omap_sr *sr) | ||
174 | { | ||
175 | /* | ||
176 | * For time being these values are defined in smartreflex.h | ||
177 | * and populated during init. May be they can be moved to board | ||
178 | * file or pmic specific data structure. In that case these structure | ||
179 | * fields will have to be populated using the pdata or pmic structure. | ||
180 | */ | ||
181 | if (cpu_is_omap34xx() || cpu_is_omap44xx()) { | ||
182 | sr->err_weight = OMAP3430_SR_ERRWEIGHT; | ||
183 | sr->err_maxlimit = OMAP3430_SR_ERRMAXLIMIT; | ||
184 | sr->accum_data = OMAP3430_SR_ACCUMDATA; | ||
185 | if (!(strcmp(sr->name, "smartreflex_mpu_iva"))) { | ||
186 | sr->senn_avgweight = OMAP3430_SR1_SENNAVGWEIGHT; | ||
187 | sr->senp_avgweight = OMAP3430_SR1_SENPAVGWEIGHT; | ||
188 | } else { | ||
189 | sr->senn_avgweight = OMAP3430_SR2_SENNAVGWEIGHT; | ||
190 | sr->senp_avgweight = OMAP3430_SR2_SENPAVGWEIGHT; | ||
191 | } | ||
192 | } | ||
193 | } | ||
194 | |||
195 | static void sr_start_vddautocomp(struct omap_sr *sr) | 170 | static void sr_start_vddautocomp(struct omap_sr *sr) |
196 | { | 171 | { |
197 | if (!sr_class || !(sr_class->enable) || !(sr_class->configure)) { | 172 | if (!sr_class || !(sr_class->enable) || !(sr_class->configure)) { |
@@ -924,8 +899,14 @@ static int __init omap_sr_probe(struct platform_device *pdev) | |||
924 | sr_info->nvalue_count = pdata->nvalue_count; | 899 | sr_info->nvalue_count = pdata->nvalue_count; |
925 | sr_info->senn_mod = pdata->senn_mod; | 900 | sr_info->senn_mod = pdata->senn_mod; |
926 | sr_info->senp_mod = pdata->senp_mod; | 901 | sr_info->senp_mod = pdata->senp_mod; |
902 | sr_info->err_weight = pdata->err_weight; | ||
903 | sr_info->err_maxlimit = pdata->err_maxlimit; | ||
904 | sr_info->accum_data = pdata->accum_data; | ||
905 | sr_info->senn_avgweight = pdata->senn_avgweight; | ||
906 | sr_info->senp_avgweight = pdata->senp_avgweight; | ||
927 | sr_info->autocomp_active = false; | 907 | sr_info->autocomp_active = false; |
928 | sr_info->ip_type = pdata->ip_type; | 908 | sr_info->ip_type = pdata->ip_type; |
909 | |||
929 | sr_info->base = ioremap(mem->start, resource_size(mem)); | 910 | sr_info->base = ioremap(mem->start, resource_size(mem)); |
930 | if (!sr_info->base) { | 911 | if (!sr_info->base) { |
931 | dev_err(&pdev->dev, "%s: ioremap fail\n", __func__); | 912 | dev_err(&pdev->dev, "%s: ioremap fail\n", __func__); |
@@ -937,7 +918,6 @@ static int __init omap_sr_probe(struct platform_device *pdev) | |||
937 | sr_info->irq = irq->start; | 918 | sr_info->irq = irq->start; |
938 | 919 | ||
939 | sr_set_clk_length(sr_info); | 920 | sr_set_clk_length(sr_info); |
940 | sr_set_regfields(sr_info); | ||
941 | 921 | ||
942 | list_add(&sr_info->node, &sr_list); | 922 | list_add(&sr_info->node, &sr_list); |
943 | 923 | ||
diff --git a/drivers/rtc/rtc-imxdi.c b/drivers/rtc/rtc-imxdi.c index 891cd6c61d0a..4eed51044c5d 100644 --- a/drivers/rtc/rtc-imxdi.c +++ b/drivers/rtc/rtc-imxdi.c | |||
@@ -392,6 +392,8 @@ static int dryice_rtc_probe(struct platform_device *pdev) | |||
392 | if (imxdi->ioaddr == NULL) | 392 | if (imxdi->ioaddr == NULL) |
393 | return -ENOMEM; | 393 | return -ENOMEM; |
394 | 394 | ||
395 | spin_lock_init(&imxdi->irq_lock); | ||
396 | |||
395 | imxdi->irq = platform_get_irq(pdev, 0); | 397 | imxdi->irq = platform_get_irq(pdev, 0); |
396 | if (imxdi->irq < 0) | 398 | if (imxdi->irq < 0) |
397 | return imxdi->irq; | 399 | return imxdi->irq; |
diff --git a/drivers/s390/cio/css.c b/drivers/s390/cio/css.c index b4d572f65f07..fd00afd8b850 100644 --- a/drivers/s390/cio/css.c +++ b/drivers/s390/cio/css.c | |||
@@ -377,7 +377,11 @@ static int css_evaluate_new_subchannel(struct subchannel_id schid, int slow) | |||
377 | /* Will be done on the slow path. */ | 377 | /* Will be done on the slow path. */ |
378 | return -EAGAIN; | 378 | return -EAGAIN; |
379 | } | 379 | } |
380 | if (stsch_err(schid, &schib) || !css_sch_is_valid(&schib)) { | 380 | if (stsch_err(schid, &schib)) { |
381 | /* Subchannel is not provided. */ | ||
382 | return -ENXIO; | ||
383 | } | ||
384 | if (!css_sch_is_valid(&schib)) { | ||
381 | /* Unusable - ignore. */ | 385 | /* Unusable - ignore. */ |
382 | return 0; | 386 | return 0; |
383 | } | 387 | } |
@@ -536,6 +540,7 @@ static int slow_eval_unknown_fn(struct subchannel_id schid, void *data) | |||
536 | case -ENOMEM: | 540 | case -ENOMEM: |
537 | case -EIO: | 541 | case -EIO: |
538 | /* These should abort looping */ | 542 | /* These should abort looping */ |
543 | idset_sch_del_subseq(slow_subchannel_set, schid); | ||
539 | break; | 544 | break; |
540 | default: | 545 | default: |
541 | rc = 0; | 546 | rc = 0; |
diff --git a/drivers/s390/cio/idset.c b/drivers/s390/cio/idset.c index e6d5f8c49524..199bc6791177 100644 --- a/drivers/s390/cio/idset.c +++ b/drivers/s390/cio/idset.c | |||
@@ -1,9 +1,10 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright IBM Corp. 2007 | 2 | * Copyright IBM Corp. 2007, 2012 |
3 | * Author(s): Peter Oberparleiter <peter.oberparleiter@de.ibm.com> | 3 | * Author(s): Peter Oberparleiter <peter.oberparleiter@de.ibm.com> |
4 | */ | 4 | */ |
5 | 5 | ||
6 | #include <linux/vmalloc.h> | 6 | #include <linux/vmalloc.h> |
7 | #include <linux/bitmap.h> | ||
7 | #include <linux/bitops.h> | 8 | #include <linux/bitops.h> |
8 | #include "idset.h" | 9 | #include "idset.h" |
9 | #include "css.h" | 10 | #include "css.h" |
@@ -89,6 +90,14 @@ void idset_sch_del(struct idset *set, struct subchannel_id schid) | |||
89 | idset_del(set, schid.ssid, schid.sch_no); | 90 | idset_del(set, schid.ssid, schid.sch_no); |
90 | } | 91 | } |
91 | 92 | ||
93 | /* Clear ids starting from @schid up to end of subchannel set. */ | ||
94 | void idset_sch_del_subseq(struct idset *set, struct subchannel_id schid) | ||
95 | { | ||
96 | int pos = schid.ssid * set->num_id + schid.sch_no; | ||
97 | |||
98 | bitmap_clear(set->bitmap, pos, set->num_id - schid.sch_no); | ||
99 | } | ||
100 | |||
92 | int idset_sch_contains(struct idset *set, struct subchannel_id schid) | 101 | int idset_sch_contains(struct idset *set, struct subchannel_id schid) |
93 | { | 102 | { |
94 | return idset_contains(set, schid.ssid, schid.sch_no); | 103 | return idset_contains(set, schid.ssid, schid.sch_no); |
@@ -111,20 +120,13 @@ int idset_sch_get_first(struct idset *set, struct subchannel_id *schid) | |||
111 | 120 | ||
112 | int idset_is_empty(struct idset *set) | 121 | int idset_is_empty(struct idset *set) |
113 | { | 122 | { |
114 | int bitnum; | 123 | return bitmap_empty(set->bitmap, set->num_ssid * set->num_id); |
115 | |||
116 | bitnum = find_first_bit(set->bitmap, set->num_ssid * set->num_id); | ||
117 | if (bitnum >= set->num_ssid * set->num_id) | ||
118 | return 1; | ||
119 | return 0; | ||
120 | } | 124 | } |
121 | 125 | ||
122 | void idset_add_set(struct idset *to, struct idset *from) | 126 | void idset_add_set(struct idset *to, struct idset *from) |
123 | { | 127 | { |
124 | unsigned long i, len; | 128 | int len = min(__BITOPS_WORDS(to->num_ssid * to->num_id), |
129 | __BITOPS_WORDS(from->num_ssid * from->num_id)); | ||
125 | 130 | ||
126 | len = min(__BITOPS_WORDS(to->num_ssid * to->num_id), | 131 | bitmap_or(to->bitmap, to->bitmap, from->bitmap, len); |
127 | __BITOPS_WORDS(from->num_ssid * from->num_id)); | ||
128 | for (i = 0; i < len ; i++) | ||
129 | to->bitmap[i] |= from->bitmap[i]; | ||
130 | } | 132 | } |
diff --git a/drivers/s390/cio/idset.h b/drivers/s390/cio/idset.h index 3d943f03591e..06d3bc01bb09 100644 --- a/drivers/s390/cio/idset.h +++ b/drivers/s390/cio/idset.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright IBM Corp. 2007 | 2 | * Copyright IBM Corp. 2007, 2012 |
3 | * Author(s): Peter Oberparleiter <peter.oberparleiter@de.ibm.com> | 3 | * Author(s): Peter Oberparleiter <peter.oberparleiter@de.ibm.com> |
4 | */ | 4 | */ |
5 | 5 | ||
@@ -17,6 +17,7 @@ void idset_fill(struct idset *set); | |||
17 | struct idset *idset_sch_new(void); | 17 | struct idset *idset_sch_new(void); |
18 | void idset_sch_add(struct idset *set, struct subchannel_id id); | 18 | void idset_sch_add(struct idset *set, struct subchannel_id id); |
19 | void idset_sch_del(struct idset *set, struct subchannel_id id); | 19 | void idset_sch_del(struct idset *set, struct subchannel_id id); |
20 | void idset_sch_del_subseq(struct idset *set, struct subchannel_id schid); | ||
20 | int idset_sch_contains(struct idset *set, struct subchannel_id id); | 21 | int idset_sch_contains(struct idset *set, struct subchannel_id id); |
21 | int idset_sch_get_first(struct idset *set, struct subchannel_id *id); | 22 | int idset_sch_get_first(struct idset *set, struct subchannel_id *id); |
22 | int idset_is_empty(struct idset *set); | 23 | int idset_is_empty(struct idset *set); |
diff --git a/drivers/scsi/qla2xxx/qla_mid.c b/drivers/scsi/qla2xxx/qla_mid.c index bd4708a422cd..20fd974f903a 100644 --- a/drivers/scsi/qla2xxx/qla_mid.c +++ b/drivers/scsi/qla2xxx/qla_mid.c | |||
@@ -149,6 +149,7 @@ qla2x00_mark_vp_devices_dead(scsi_qla_host_t *vha) | |||
149 | int | 149 | int |
150 | qla24xx_disable_vp(scsi_qla_host_t *vha) | 150 | qla24xx_disable_vp(scsi_qla_host_t *vha) |
151 | { | 151 | { |
152 | unsigned long flags; | ||
152 | int ret; | 153 | int ret; |
153 | 154 | ||
154 | ret = qla24xx_control_vp(vha, VCE_COMMAND_DISABLE_VPS_LOGO_ALL); | 155 | ret = qla24xx_control_vp(vha, VCE_COMMAND_DISABLE_VPS_LOGO_ALL); |
@@ -156,7 +157,9 @@ qla24xx_disable_vp(scsi_qla_host_t *vha) | |||
156 | atomic_set(&vha->loop_down_timer, LOOP_DOWN_TIME); | 157 | atomic_set(&vha->loop_down_timer, LOOP_DOWN_TIME); |
157 | 158 | ||
158 | /* Remove port id from vp target map */ | 159 | /* Remove port id from vp target map */ |
160 | spin_lock_irqsave(&vha->hw->vport_slock, flags); | ||
159 | qlt_update_vp_map(vha, RESET_AL_PA); | 161 | qlt_update_vp_map(vha, RESET_AL_PA); |
162 | spin_unlock_irqrestore(&vha->hw->vport_slock, flags); | ||
160 | 163 | ||
161 | qla2x00_mark_vp_devices_dead(vha); | 164 | qla2x00_mark_vp_devices_dead(vha); |
162 | atomic_set(&vha->vp_state, VP_FAILED); | 165 | atomic_set(&vha->vp_state, VP_FAILED); |
diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c index 0e09d8f433d1..62aa5584f644 100644 --- a/drivers/scsi/qla2xxx/qla_target.c +++ b/drivers/scsi/qla2xxx/qla_target.c | |||
@@ -557,6 +557,7 @@ static bool qlt_check_fcport_exist(struct scsi_qla_host *vha, | |||
557 | int pmap_len; | 557 | int pmap_len; |
558 | fc_port_t *fcport; | 558 | fc_port_t *fcport; |
559 | int global_resets; | 559 | int global_resets; |
560 | unsigned long flags; | ||
560 | 561 | ||
561 | retry: | 562 | retry: |
562 | global_resets = atomic_read(&ha->tgt.qla_tgt->tgt_global_resets_count); | 563 | global_resets = atomic_read(&ha->tgt.qla_tgt->tgt_global_resets_count); |
@@ -625,10 +626,10 @@ retry: | |||
625 | sess->s_id.b.area, sess->loop_id, fcport->d_id.b.domain, | 626 | sess->s_id.b.area, sess->loop_id, fcport->d_id.b.domain, |
626 | fcport->d_id.b.al_pa, fcport->d_id.b.area, fcport->loop_id); | 627 | fcport->d_id.b.al_pa, fcport->d_id.b.area, fcport->loop_id); |
627 | 628 | ||
628 | sess->s_id = fcport->d_id; | 629 | spin_lock_irqsave(&ha->hardware_lock, flags); |
629 | sess->loop_id = fcport->loop_id; | 630 | ha->tgt.tgt_ops->update_sess(sess, fcport->d_id, fcport->loop_id, |
630 | sess->conf_compl_supported = !!(fcport->flags & | 631 | (fcport->flags & FCF_CONF_COMP_SUPPORTED)); |
631 | FCF_CONF_COMP_SUPPORTED); | 632 | spin_unlock_irqrestore(&ha->hardware_lock, flags); |
632 | 633 | ||
633 | res = true; | 634 | res = true; |
634 | 635 | ||
@@ -740,10 +741,9 @@ static struct qla_tgt_sess *qlt_create_sess( | |||
740 | qlt_undelete_sess(sess); | 741 | qlt_undelete_sess(sess); |
741 | 742 | ||
742 | kref_get(&sess->se_sess->sess_kref); | 743 | kref_get(&sess->se_sess->sess_kref); |
743 | sess->s_id = fcport->d_id; | 744 | ha->tgt.tgt_ops->update_sess(sess, fcport->d_id, fcport->loop_id, |
744 | sess->loop_id = fcport->loop_id; | 745 | (fcport->flags & FCF_CONF_COMP_SUPPORTED)); |
745 | sess->conf_compl_supported = !!(fcport->flags & | 746 | |
746 | FCF_CONF_COMP_SUPPORTED); | ||
747 | if (sess->local && !local) | 747 | if (sess->local && !local) |
748 | sess->local = 0; | 748 | sess->local = 0; |
749 | spin_unlock_irqrestore(&ha->hardware_lock, flags); | 749 | spin_unlock_irqrestore(&ha->hardware_lock, flags); |
@@ -796,8 +796,7 @@ static struct qla_tgt_sess *qlt_create_sess( | |||
796 | */ | 796 | */ |
797 | kref_get(&sess->se_sess->sess_kref); | 797 | kref_get(&sess->se_sess->sess_kref); |
798 | 798 | ||
799 | sess->conf_compl_supported = !!(fcport->flags & | 799 | sess->conf_compl_supported = (fcport->flags & FCF_CONF_COMP_SUPPORTED); |
800 | FCF_CONF_COMP_SUPPORTED); | ||
801 | BUILD_BUG_ON(sizeof(sess->port_name) != sizeof(fcport->port_name)); | 800 | BUILD_BUG_ON(sizeof(sess->port_name) != sizeof(fcport->port_name)); |
802 | memcpy(sess->port_name, fcport->port_name, sizeof(sess->port_name)); | 801 | memcpy(sess->port_name, fcport->port_name, sizeof(sess->port_name)); |
803 | 802 | ||
@@ -869,10 +868,8 @@ void qlt_fc_port_added(struct scsi_qla_host *vha, fc_port_t *fcport) | |||
869 | ql_dbg(ql_dbg_tgt_mgt, vha, 0xf007, | 868 | ql_dbg(ql_dbg_tgt_mgt, vha, 0xf007, |
870 | "Reappeared sess %p\n", sess); | 869 | "Reappeared sess %p\n", sess); |
871 | } | 870 | } |
872 | sess->s_id = fcport->d_id; | 871 | ha->tgt.tgt_ops->update_sess(sess, fcport->d_id, fcport->loop_id, |
873 | sess->loop_id = fcport->loop_id; | 872 | (fcport->flags & FCF_CONF_COMP_SUPPORTED)); |
874 | sess->conf_compl_supported = !!(fcport->flags & | ||
875 | FCF_CONF_COMP_SUPPORTED); | ||
876 | } | 873 | } |
877 | 874 | ||
878 | if (sess && sess->local) { | 875 | if (sess && sess->local) { |
diff --git a/drivers/scsi/qla2xxx/qla_target.h b/drivers/scsi/qla2xxx/qla_target.h index 170af1571214..bad749561ec2 100644 --- a/drivers/scsi/qla2xxx/qla_target.h +++ b/drivers/scsi/qla2xxx/qla_target.h | |||
@@ -648,6 +648,7 @@ struct qla_tgt_func_tmpl { | |||
648 | 648 | ||
649 | int (*check_initiator_node_acl)(struct scsi_qla_host *, unsigned char *, | 649 | int (*check_initiator_node_acl)(struct scsi_qla_host *, unsigned char *, |
650 | void *, uint8_t *, uint16_t); | 650 | void *, uint8_t *, uint16_t); |
651 | void (*update_sess)(struct qla_tgt_sess *, port_id_t, uint16_t, bool); | ||
651 | struct qla_tgt_sess *(*find_sess_by_loop_id)(struct scsi_qla_host *, | 652 | struct qla_tgt_sess *(*find_sess_by_loop_id)(struct scsi_qla_host *, |
652 | const uint16_t); | 653 | const uint16_t); |
653 | struct qla_tgt_sess *(*find_sess_by_s_id)(struct scsi_qla_host *, | 654 | struct qla_tgt_sess *(*find_sess_by_s_id)(struct scsi_qla_host *, |
diff --git a/drivers/scsi/qla2xxx/tcm_qla2xxx.c b/drivers/scsi/qla2xxx/tcm_qla2xxx.c index 2358c16c4c8e..3d74f2f39ae1 100644 --- a/drivers/scsi/qla2xxx/tcm_qla2xxx.c +++ b/drivers/scsi/qla2xxx/tcm_qla2xxx.c | |||
@@ -237,7 +237,7 @@ static char *tcm_qla2xxx_get_fabric_wwn(struct se_portal_group *se_tpg) | |||
237 | struct tcm_qla2xxx_tpg, se_tpg); | 237 | struct tcm_qla2xxx_tpg, se_tpg); |
238 | struct tcm_qla2xxx_lport *lport = tpg->lport; | 238 | struct tcm_qla2xxx_lport *lport = tpg->lport; |
239 | 239 | ||
240 | return &lport->lport_name[0]; | 240 | return lport->lport_naa_name; |
241 | } | 241 | } |
242 | 242 | ||
243 | static char *tcm_qla2xxx_npiv_get_fabric_wwn(struct se_portal_group *se_tpg) | 243 | static char *tcm_qla2xxx_npiv_get_fabric_wwn(struct se_portal_group *se_tpg) |
@@ -1457,6 +1457,78 @@ static int tcm_qla2xxx_check_initiator_node_acl( | |||
1457 | return 0; | 1457 | return 0; |
1458 | } | 1458 | } |
1459 | 1459 | ||
1460 | static void tcm_qla2xxx_update_sess(struct qla_tgt_sess *sess, port_id_t s_id, | ||
1461 | uint16_t loop_id, bool conf_compl_supported) | ||
1462 | { | ||
1463 | struct qla_tgt *tgt = sess->tgt; | ||
1464 | struct qla_hw_data *ha = tgt->ha; | ||
1465 | struct tcm_qla2xxx_lport *lport = ha->tgt.target_lport_ptr; | ||
1466 | struct se_node_acl *se_nacl = sess->se_sess->se_node_acl; | ||
1467 | struct tcm_qla2xxx_nacl *nacl = container_of(se_nacl, | ||
1468 | struct tcm_qla2xxx_nacl, se_node_acl); | ||
1469 | u32 key; | ||
1470 | |||
1471 | |||
1472 | if (sess->loop_id != loop_id || sess->s_id.b24 != s_id.b24) | ||
1473 | pr_info("Updating session %p from port %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x loop_id %d -> %d s_id %x:%x:%x -> %x:%x:%x\n", | ||
1474 | sess, | ||
1475 | sess->port_name[0], sess->port_name[1], | ||
1476 | sess->port_name[2], sess->port_name[3], | ||
1477 | sess->port_name[4], sess->port_name[5], | ||
1478 | sess->port_name[6], sess->port_name[7], | ||
1479 | sess->loop_id, loop_id, | ||
1480 | sess->s_id.b.domain, sess->s_id.b.area, sess->s_id.b.al_pa, | ||
1481 | s_id.b.domain, s_id.b.area, s_id.b.al_pa); | ||
1482 | |||
1483 | if (sess->loop_id != loop_id) { | ||
1484 | /* | ||
1485 | * Because we can shuffle loop IDs around and we | ||
1486 | * update different sessions non-atomically, we might | ||
1487 | * have overwritten this session's old loop ID | ||
1488 | * already, and we might end up overwriting some other | ||
1489 | * session that will be updated later. So we have to | ||
1490 | * be extra careful and we can't warn about those things... | ||
1491 | */ | ||
1492 | if (lport->lport_loopid_map[sess->loop_id].se_nacl == se_nacl) | ||
1493 | lport->lport_loopid_map[sess->loop_id].se_nacl = NULL; | ||
1494 | |||
1495 | lport->lport_loopid_map[loop_id].se_nacl = se_nacl; | ||
1496 | |||
1497 | sess->loop_id = loop_id; | ||
1498 | } | ||
1499 | |||
1500 | if (sess->s_id.b24 != s_id.b24) { | ||
1501 | key = (((u32) sess->s_id.b.domain << 16) | | ||
1502 | ((u32) sess->s_id.b.area << 8) | | ||
1503 | ((u32) sess->s_id.b.al_pa)); | ||
1504 | |||
1505 | if (btree_lookup32(&lport->lport_fcport_map, key)) | ||
1506 | WARN(btree_remove32(&lport->lport_fcport_map, key) != se_nacl, | ||
1507 | "Found wrong se_nacl when updating s_id %x:%x:%x\n", | ||
1508 | sess->s_id.b.domain, sess->s_id.b.area, sess->s_id.b.al_pa); | ||
1509 | else | ||
1510 | WARN(1, "No lport_fcport_map entry for s_id %x:%x:%x\n", | ||
1511 | sess->s_id.b.domain, sess->s_id.b.area, sess->s_id.b.al_pa); | ||
1512 | |||
1513 | key = (((u32) s_id.b.domain << 16) | | ||
1514 | ((u32) s_id.b.area << 8) | | ||
1515 | ((u32) s_id.b.al_pa)); | ||
1516 | |||
1517 | if (btree_lookup32(&lport->lport_fcport_map, key)) { | ||
1518 | WARN(1, "Already have lport_fcport_map entry for s_id %x:%x:%x\n", | ||
1519 | s_id.b.domain, s_id.b.area, s_id.b.al_pa); | ||
1520 | btree_update32(&lport->lport_fcport_map, key, se_nacl); | ||
1521 | } else { | ||
1522 | btree_insert32(&lport->lport_fcport_map, key, se_nacl, GFP_ATOMIC); | ||
1523 | } | ||
1524 | |||
1525 | sess->s_id = s_id; | ||
1526 | nacl->nport_id = key; | ||
1527 | } | ||
1528 | |||
1529 | sess->conf_compl_supported = conf_compl_supported; | ||
1530 | } | ||
1531 | |||
1460 | /* | 1532 | /* |
1461 | * Calls into tcm_qla2xxx used by qla2xxx LLD I/O path. | 1533 | * Calls into tcm_qla2xxx used by qla2xxx LLD I/O path. |
1462 | */ | 1534 | */ |
@@ -1467,6 +1539,7 @@ static struct qla_tgt_func_tmpl tcm_qla2xxx_template = { | |||
1467 | .free_cmd = tcm_qla2xxx_free_cmd, | 1539 | .free_cmd = tcm_qla2xxx_free_cmd, |
1468 | .free_mcmd = tcm_qla2xxx_free_mcmd, | 1540 | .free_mcmd = tcm_qla2xxx_free_mcmd, |
1469 | .free_session = tcm_qla2xxx_free_session, | 1541 | .free_session = tcm_qla2xxx_free_session, |
1542 | .update_sess = tcm_qla2xxx_update_sess, | ||
1470 | .check_initiator_node_acl = tcm_qla2xxx_check_initiator_node_acl, | 1543 | .check_initiator_node_acl = tcm_qla2xxx_check_initiator_node_acl, |
1471 | .find_sess_by_s_id = tcm_qla2xxx_find_sess_by_s_id, | 1544 | .find_sess_by_s_id = tcm_qla2xxx_find_sess_by_s_id, |
1472 | .find_sess_by_loop_id = tcm_qla2xxx_find_sess_by_loop_id, | 1545 | .find_sess_by_loop_id = tcm_qla2xxx_find_sess_by_loop_id, |
@@ -1534,6 +1607,7 @@ static struct se_wwn *tcm_qla2xxx_make_lport( | |||
1534 | lport->lport_wwpn = wwpn; | 1607 | lport->lport_wwpn = wwpn; |
1535 | tcm_qla2xxx_format_wwn(&lport->lport_name[0], TCM_QLA2XXX_NAMELEN, | 1608 | tcm_qla2xxx_format_wwn(&lport->lport_name[0], TCM_QLA2XXX_NAMELEN, |
1536 | wwpn); | 1609 | wwpn); |
1610 | sprintf(lport->lport_naa_name, "naa.%016llx", (unsigned long long) wwpn); | ||
1537 | 1611 | ||
1538 | ret = tcm_qla2xxx_init_lport(lport); | 1612 | ret = tcm_qla2xxx_init_lport(lport); |
1539 | if (ret != 0) | 1613 | if (ret != 0) |
@@ -1601,6 +1675,7 @@ static struct se_wwn *tcm_qla2xxx_npiv_make_lport( | |||
1601 | lport->lport_npiv_wwnn = npiv_wwnn; | 1675 | lport->lport_npiv_wwnn = npiv_wwnn; |
1602 | tcm_qla2xxx_npiv_format_wwn(&lport->lport_npiv_name[0], | 1676 | tcm_qla2xxx_npiv_format_wwn(&lport->lport_npiv_name[0], |
1603 | TCM_QLA2XXX_NAMELEN, npiv_wwpn, npiv_wwnn); | 1677 | TCM_QLA2XXX_NAMELEN, npiv_wwpn, npiv_wwnn); |
1678 | sprintf(lport->lport_naa_name, "naa.%016llx", (unsigned long long) npiv_wwpn); | ||
1604 | 1679 | ||
1605 | /* FIXME: tcm_qla2xxx_npiv_make_lport */ | 1680 | /* FIXME: tcm_qla2xxx_npiv_make_lport */ |
1606 | ret = -ENOSYS; | 1681 | ret = -ENOSYS; |
diff --git a/drivers/scsi/qla2xxx/tcm_qla2xxx.h b/drivers/scsi/qla2xxx/tcm_qla2xxx.h index 825498103352..9ba075fe9781 100644 --- a/drivers/scsi/qla2xxx/tcm_qla2xxx.h +++ b/drivers/scsi/qla2xxx/tcm_qla2xxx.h | |||
@@ -61,6 +61,8 @@ struct tcm_qla2xxx_lport { | |||
61 | u64 lport_npiv_wwnn; | 61 | u64 lport_npiv_wwnn; |
62 | /* ASCII formatted WWPN for FC Target Lport */ | 62 | /* ASCII formatted WWPN for FC Target Lport */ |
63 | char lport_name[TCM_QLA2XXX_NAMELEN]; | 63 | char lport_name[TCM_QLA2XXX_NAMELEN]; |
64 | /* ASCII formatted naa WWPN for VPD page 83 etc */ | ||
65 | char lport_naa_name[TCM_QLA2XXX_NAMELEN]; | ||
64 | /* ASCII formatted WWPN+WWNN for NPIV FC Target Lport */ | 66 | /* ASCII formatted WWPN+WWNN for NPIV FC Target Lport */ |
65 | char lport_npiv_name[TCM_QLA2XXX_NPIV_NAMELEN]; | 67 | char lport_npiv_name[TCM_QLA2XXX_NPIV_NAMELEN]; |
66 | /* map for fc_port pointers in 24-bit FC Port ID space */ | 68 | /* map for fc_port pointers in 24-bit FC Port ID space */ |
diff --git a/drivers/spi/spi-mxs.c b/drivers/spi/spi-mxs.c index edf1360ab09e..86dd04d6bc87 100644 --- a/drivers/spi/spi-mxs.c +++ b/drivers/spi/spi-mxs.c | |||
@@ -323,6 +323,7 @@ static int mxs_spi_txrx_dma(struct mxs_spi *spi, int cs, | |||
323 | if (!ret) { | 323 | if (!ret) { |
324 | dev_err(ssp->dev, "DMA transfer timeout\n"); | 324 | dev_err(ssp->dev, "DMA transfer timeout\n"); |
325 | ret = -ETIMEDOUT; | 325 | ret = -ETIMEDOUT; |
326 | dmaengine_terminate_all(ssp->dmach); | ||
326 | goto err_vmalloc; | 327 | goto err_vmalloc; |
327 | } | 328 | } |
328 | 329 | ||
@@ -480,7 +481,7 @@ static int mxs_spi_transfer_one(struct spi_master *master, | |||
480 | first = last = 0; | 481 | first = last = 0; |
481 | } | 482 | } |
482 | 483 | ||
483 | m->status = 0; | 484 | m->status = status; |
484 | spi_finalize_current_message(master); | 485 | spi_finalize_current_message(master); |
485 | 486 | ||
486 | return status; | 487 | return status; |
diff --git a/drivers/spi/spi-pl022.c b/drivers/spi/spi-pl022.c index 919464102d33..a1db91a99b89 100644 --- a/drivers/spi/spi-pl022.c +++ b/drivers/spi/spi-pl022.c | |||
@@ -2186,8 +2186,6 @@ pl022_probe(struct amba_device *adev, const struct amba_id *id) | |||
2186 | printk(KERN_INFO "pl022: mapped registers from 0x%08x to %p\n", | 2186 | printk(KERN_INFO "pl022: mapped registers from 0x%08x to %p\n", |
2187 | adev->res.start, pl022->virtbase); | 2187 | adev->res.start, pl022->virtbase); |
2188 | 2188 | ||
2189 | pm_runtime_resume(dev); | ||
2190 | |||
2191 | pl022->clk = devm_clk_get(&adev->dev, NULL); | 2189 | pl022->clk = devm_clk_get(&adev->dev, NULL); |
2192 | if (IS_ERR(pl022->clk)) { | 2190 | if (IS_ERR(pl022->clk)) { |
2193 | status = PTR_ERR(pl022->clk); | 2191 | status = PTR_ERR(pl022->clk); |
@@ -2292,7 +2290,6 @@ pl022_remove(struct amba_device *adev) | |||
2292 | 2290 | ||
2293 | clk_disable(pl022->clk); | 2291 | clk_disable(pl022->clk); |
2294 | clk_unprepare(pl022->clk); | 2292 | clk_unprepare(pl022->clk); |
2295 | pm_runtime_disable(&adev->dev); | ||
2296 | amba_release_regions(adev); | 2293 | amba_release_regions(adev); |
2297 | tasklet_disable(&pl022->pump_transfers); | 2294 | tasklet_disable(&pl022->pump_transfers); |
2298 | spi_unregister_master(pl022->master); | 2295 | spi_unregister_master(pl022->master); |
diff --git a/drivers/spi/spi-rspi.c b/drivers/spi/spi-rspi.c index 4894bde4bbff..30faf6d4ab91 100644 --- a/drivers/spi/spi-rspi.c +++ b/drivers/spi/spi-rspi.c | |||
@@ -147,8 +147,6 @@ struct rspi_data { | |||
147 | unsigned char spsr; | 147 | unsigned char spsr; |
148 | 148 | ||
149 | /* for dmaengine */ | 149 | /* for dmaengine */ |
150 | struct sh_dmae_slave dma_tx; | ||
151 | struct sh_dmae_slave dma_rx; | ||
152 | struct dma_chan *chan_tx; | 150 | struct dma_chan *chan_tx; |
153 | struct dma_chan *chan_rx; | 151 | struct dma_chan *chan_rx; |
154 | int irq; | 152 | int irq; |
@@ -663,20 +661,16 @@ static irqreturn_t rspi_irq(int irq, void *_sr) | |||
663 | return ret; | 661 | return ret; |
664 | } | 662 | } |
665 | 663 | ||
666 | static bool rspi_filter(struct dma_chan *chan, void *filter_param) | 664 | static int __devinit rspi_request_dma(struct rspi_data *rspi, |
667 | { | 665 | struct platform_device *pdev) |
668 | chan->private = filter_param; | ||
669 | return true; | ||
670 | } | ||
671 | |||
672 | static void __devinit rspi_request_dma(struct rspi_data *rspi, | ||
673 | struct platform_device *pdev) | ||
674 | { | 666 | { |
675 | struct rspi_plat_data *rspi_pd = pdev->dev.platform_data; | 667 | struct rspi_plat_data *rspi_pd = pdev->dev.platform_data; |
676 | dma_cap_mask_t mask; | 668 | dma_cap_mask_t mask; |
669 | struct dma_slave_config cfg; | ||
670 | int ret; | ||
677 | 671 | ||
678 | if (!rspi_pd) | 672 | if (!rspi_pd) |
679 | return; | 673 | return 0; /* The driver assumes no error. */ |
680 | 674 | ||
681 | rspi->dma_width_16bit = rspi_pd->dma_width_16bit; | 675 | rspi->dma_width_16bit = rspi_pd->dma_width_16bit; |
682 | 676 | ||
@@ -684,21 +678,35 @@ static void __devinit rspi_request_dma(struct rspi_data *rspi, | |||
684 | if (rspi_pd->dma_rx_id && rspi_pd->dma_tx_id) { | 678 | if (rspi_pd->dma_rx_id && rspi_pd->dma_tx_id) { |
685 | dma_cap_zero(mask); | 679 | dma_cap_zero(mask); |
686 | dma_cap_set(DMA_SLAVE, mask); | 680 | dma_cap_set(DMA_SLAVE, mask); |
687 | rspi->dma_rx.slave_id = rspi_pd->dma_rx_id; | 681 | rspi->chan_rx = dma_request_channel(mask, shdma_chan_filter, |
688 | rspi->chan_rx = dma_request_channel(mask, rspi_filter, | 682 | (void *)rspi_pd->dma_rx_id); |
689 | &rspi->dma_rx); | 683 | if (rspi->chan_rx) { |
690 | if (rspi->chan_rx) | 684 | cfg.slave_id = rspi_pd->dma_rx_id; |
691 | dev_info(&pdev->dev, "Use DMA when rx.\n"); | 685 | cfg.direction = DMA_DEV_TO_MEM; |
686 | ret = dmaengine_slave_config(rspi->chan_rx, &cfg); | ||
687 | if (!ret) | ||
688 | dev_info(&pdev->dev, "Use DMA when rx.\n"); | ||
689 | else | ||
690 | return ret; | ||
691 | } | ||
692 | } | 692 | } |
693 | if (rspi_pd->dma_tx_id) { | 693 | if (rspi_pd->dma_tx_id) { |
694 | dma_cap_zero(mask); | 694 | dma_cap_zero(mask); |
695 | dma_cap_set(DMA_SLAVE, mask); | 695 | dma_cap_set(DMA_SLAVE, mask); |
696 | rspi->dma_tx.slave_id = rspi_pd->dma_tx_id; | 696 | rspi->chan_tx = dma_request_channel(mask, shdma_chan_filter, |
697 | rspi->chan_tx = dma_request_channel(mask, rspi_filter, | 697 | (void *)rspi_pd->dma_tx_id); |
698 | &rspi->dma_tx); | 698 | if (rspi->chan_tx) { |
699 | if (rspi->chan_tx) | 699 | cfg.slave_id = rspi_pd->dma_tx_id; |
700 | dev_info(&pdev->dev, "Use DMA when tx\n"); | 700 | cfg.direction = DMA_MEM_TO_DEV; |
701 | ret = dmaengine_slave_config(rspi->chan_tx, &cfg); | ||
702 | if (!ret) | ||
703 | dev_info(&pdev->dev, "Use DMA when tx\n"); | ||
704 | else | ||
705 | return ret; | ||
706 | } | ||
701 | } | 707 | } |
708 | |||
709 | return 0; | ||
702 | } | 710 | } |
703 | 711 | ||
704 | static void __devexit rspi_release_dma(struct rspi_data *rspi) | 712 | static void __devexit rspi_release_dma(struct rspi_data *rspi) |
@@ -788,7 +796,11 @@ static int __devinit rspi_probe(struct platform_device *pdev) | |||
788 | } | 796 | } |
789 | 797 | ||
790 | rspi->irq = irq; | 798 | rspi->irq = irq; |
791 | rspi_request_dma(rspi, pdev); | 799 | ret = rspi_request_dma(rspi, pdev); |
800 | if (ret < 0) { | ||
801 | dev_err(&pdev->dev, "rspi_request_dma failed.\n"); | ||
802 | goto error4; | ||
803 | } | ||
792 | 804 | ||
793 | ret = spi_register_master(master); | 805 | ret = spi_register_master(master); |
794 | if (ret < 0) { | 806 | if (ret < 0) { |
diff --git a/drivers/staging/android/binder.c b/drivers/staging/android/binder.c index 7b0ba92e7e46..5d4610babd8a 100644 --- a/drivers/staging/android/binder.c +++ b/drivers/staging/android/binder.c | |||
@@ -567,7 +567,7 @@ static int binder_update_page_range(struct binder_proc *proc, int allocate, | |||
567 | page = &proc->pages[(page_addr - proc->buffer) / PAGE_SIZE]; | 567 | page = &proc->pages[(page_addr - proc->buffer) / PAGE_SIZE]; |
568 | 568 | ||
569 | BUG_ON(*page); | 569 | BUG_ON(*page); |
570 | *page = alloc_page(GFP_KERNEL | __GFP_ZERO); | 570 | *page = alloc_page(GFP_KERNEL | __GFP_HIGHMEM | __GFP_ZERO); |
571 | if (*page == NULL) { | 571 | if (*page == NULL) { |
572 | pr_err("binder: %d: binder_alloc_buf failed " | 572 | pr_err("binder: %d: binder_alloc_buf failed " |
573 | "for page at %p\n", proc->pid, page_addr); | 573 | "for page at %p\n", proc->pid, page_addr); |
@@ -2419,14 +2419,38 @@ static void binder_release_work(struct list_head *list) | |||
2419 | struct binder_transaction *t; | 2419 | struct binder_transaction *t; |
2420 | 2420 | ||
2421 | t = container_of(w, struct binder_transaction, work); | 2421 | t = container_of(w, struct binder_transaction, work); |
2422 | if (t->buffer->target_node && !(t->flags & TF_ONE_WAY)) | 2422 | if (t->buffer->target_node && |
2423 | !(t->flags & TF_ONE_WAY)) { | ||
2423 | binder_send_failed_reply(t, BR_DEAD_REPLY); | 2424 | binder_send_failed_reply(t, BR_DEAD_REPLY); |
2425 | } else { | ||
2426 | binder_debug(BINDER_DEBUG_DEAD_TRANSACTION, | ||
2427 | "binder: undelivered transaction %d\n", | ||
2428 | t->debug_id); | ||
2429 | t->buffer->transaction = NULL; | ||
2430 | kfree(t); | ||
2431 | binder_stats_deleted(BINDER_STAT_TRANSACTION); | ||
2432 | } | ||
2424 | } break; | 2433 | } break; |
2425 | case BINDER_WORK_TRANSACTION_COMPLETE: { | 2434 | case BINDER_WORK_TRANSACTION_COMPLETE: { |
2435 | binder_debug(BINDER_DEBUG_DEAD_TRANSACTION, | ||
2436 | "binder: undelivered TRANSACTION_COMPLETE\n"); | ||
2426 | kfree(w); | 2437 | kfree(w); |
2427 | binder_stats_deleted(BINDER_STAT_TRANSACTION_COMPLETE); | 2438 | binder_stats_deleted(BINDER_STAT_TRANSACTION_COMPLETE); |
2428 | } break; | 2439 | } break; |
2440 | case BINDER_WORK_DEAD_BINDER_AND_CLEAR: | ||
2441 | case BINDER_WORK_CLEAR_DEATH_NOTIFICATION: { | ||
2442 | struct binder_ref_death *death; | ||
2443 | |||
2444 | death = container_of(w, struct binder_ref_death, work); | ||
2445 | binder_debug(BINDER_DEBUG_DEAD_TRANSACTION, | ||
2446 | "binder: undelivered death notification, %p\n", | ||
2447 | death->cookie); | ||
2448 | kfree(death); | ||
2449 | binder_stats_deleted(BINDER_STAT_DEATH); | ||
2450 | } break; | ||
2429 | default: | 2451 | default: |
2452 | pr_err("binder: unexpected work type, %d, not freed\n", | ||
2453 | w->type); | ||
2430 | break; | 2454 | break; |
2431 | } | 2455 | } |
2432 | } | 2456 | } |
@@ -2899,6 +2923,7 @@ static void binder_deferred_release(struct binder_proc *proc) | |||
2899 | nodes++; | 2923 | nodes++; |
2900 | rb_erase(&node->rb_node, &proc->nodes); | 2924 | rb_erase(&node->rb_node, &proc->nodes); |
2901 | list_del_init(&node->work.entry); | 2925 | list_del_init(&node->work.entry); |
2926 | binder_release_work(&node->async_todo); | ||
2902 | if (hlist_empty(&node->refs)) { | 2927 | if (hlist_empty(&node->refs)) { |
2903 | kfree(node); | 2928 | kfree(node); |
2904 | binder_stats_deleted(BINDER_STAT_NODE); | 2929 | binder_stats_deleted(BINDER_STAT_NODE); |
@@ -2937,6 +2962,7 @@ static void binder_deferred_release(struct binder_proc *proc) | |||
2937 | binder_delete_ref(ref); | 2962 | binder_delete_ref(ref); |
2938 | } | 2963 | } |
2939 | binder_release_work(&proc->todo); | 2964 | binder_release_work(&proc->todo); |
2965 | binder_release_work(&proc->delivered_death); | ||
2940 | buffers = 0; | 2966 | buffers = 0; |
2941 | 2967 | ||
2942 | while ((n = rb_first(&proc->allocated_buffers))) { | 2968 | while ((n = rb_first(&proc->allocated_buffers))) { |
diff --git a/drivers/staging/comedi/drivers/8255_pci.c b/drivers/staging/comedi/drivers/8255_pci.c index 7dff3c01dc29..d00aff6671df 100644 --- a/drivers/staging/comedi/drivers/8255_pci.c +++ b/drivers/staging/comedi/drivers/8255_pci.c | |||
@@ -289,6 +289,8 @@ static void pci_8255_detach(struct comedi_device *dev) | |||
289 | struct comedi_subdevice *s; | 289 | struct comedi_subdevice *s; |
290 | int i; | 290 | int i; |
291 | 291 | ||
292 | if (!board || !devpriv) | ||
293 | return; | ||
292 | if (dev->subdevices) { | 294 | if (dev->subdevices) { |
293 | for (i = 0; i < board->n_8255; i++) { | 295 | for (i = 0; i < board->n_8255; i++) { |
294 | s = &dev->subdevices[i]; | 296 | s = &dev->subdevices[i]; |
diff --git a/drivers/staging/comedi/drivers/amplc_dio200.c b/drivers/staging/comedi/drivers/amplc_dio200.c index 08f305210a69..29eb52d11d2f 100644 --- a/drivers/staging/comedi/drivers/amplc_dio200.c +++ b/drivers/staging/comedi/drivers/amplc_dio200.c | |||
@@ -1410,6 +1410,8 @@ static void dio200_detach(struct comedi_device *dev) | |||
1410 | const struct dio200_layout_struct *layout; | 1410 | const struct dio200_layout_struct *layout; |
1411 | unsigned n; | 1411 | unsigned n; |
1412 | 1412 | ||
1413 | if (!thisboard) | ||
1414 | return; | ||
1413 | if (dev->irq) | 1415 | if (dev->irq) |
1414 | free_irq(dev->irq, dev); | 1416 | free_irq(dev->irq, dev); |
1415 | if (dev->subdevices) { | 1417 | if (dev->subdevices) { |
diff --git a/drivers/staging/comedi/drivers/amplc_pc236.c b/drivers/staging/comedi/drivers/amplc_pc236.c index eacb5e4735d7..4e4f3c15df87 100644 --- a/drivers/staging/comedi/drivers/amplc_pc236.c +++ b/drivers/staging/comedi/drivers/amplc_pc236.c | |||
@@ -573,9 +573,10 @@ static int __devinit pc236_attach_pci(struct comedi_device *dev, | |||
573 | static void pc236_detach(struct comedi_device *dev) | 573 | static void pc236_detach(struct comedi_device *dev) |
574 | { | 574 | { |
575 | const struct pc236_board *thisboard = comedi_board(dev); | 575 | const struct pc236_board *thisboard = comedi_board(dev); |
576 | struct pc236_private *devpriv = dev->private; | ||
577 | 576 | ||
578 | if (devpriv) | 577 | if (!thisboard) |
578 | return; | ||
579 | if (dev->iobase) | ||
579 | pc236_intr_disable(dev); | 580 | pc236_intr_disable(dev); |
580 | if (dev->irq) | 581 | if (dev->irq) |
581 | free_irq(dev->irq, dev); | 582 | free_irq(dev->irq, dev); |
diff --git a/drivers/staging/comedi/drivers/amplc_pc263.c b/drivers/staging/comedi/drivers/amplc_pc263.c index 60830ccfb903..d0a4c441228b 100644 --- a/drivers/staging/comedi/drivers/amplc_pc263.c +++ b/drivers/staging/comedi/drivers/amplc_pc263.c | |||
@@ -323,6 +323,8 @@ static void pc263_detach(struct comedi_device *dev) | |||
323 | { | 323 | { |
324 | const struct pc263_board *thisboard = comedi_board(dev); | 324 | const struct pc263_board *thisboard = comedi_board(dev); |
325 | 325 | ||
326 | if (!thisboard) | ||
327 | return; | ||
326 | if (is_isa_board(thisboard)) { | 328 | if (is_isa_board(thisboard)) { |
327 | if (dev->iobase) | 329 | if (dev->iobase) |
328 | release_region(dev->iobase, PC263_IO_SIZE); | 330 | release_region(dev->iobase, PC263_IO_SIZE); |
diff --git a/drivers/staging/comedi/drivers/das08.c b/drivers/staging/comedi/drivers/das08.c index 5fd21fa6c1c7..c304528cfb13 100644 --- a/drivers/staging/comedi/drivers/das08.c +++ b/drivers/staging/comedi/drivers/das08.c | |||
@@ -846,6 +846,8 @@ static void __maybe_unused das08_detach(struct comedi_device *dev) | |||
846 | { | 846 | { |
847 | const struct das08_board_struct *thisboard = comedi_board(dev); | 847 | const struct das08_board_struct *thisboard = comedi_board(dev); |
848 | 848 | ||
849 | if (!thisboard) | ||
850 | return; | ||
849 | das08_common_detach(dev); | 851 | das08_common_detach(dev); |
850 | if (is_isa_board(thisboard)) { | 852 | if (is_isa_board(thisboard)) { |
851 | if (dev->iobase) | 853 | if (dev->iobase) |
diff --git a/drivers/staging/comedi/drivers/ni_daq_700.c b/drivers/staging/comedi/drivers/ni_daq_700.c index 2ba0ade45c64..68d7c6a5db7d 100644 --- a/drivers/staging/comedi/drivers/ni_daq_700.c +++ b/drivers/staging/comedi/drivers/ni_daq_700.c | |||
@@ -95,7 +95,7 @@ static int daq700_dio_insn_bits(struct comedi_device *dev, | |||
95 | } | 95 | } |
96 | 96 | ||
97 | data[1] = s->state & 0xff; | 97 | data[1] = s->state & 0xff; |
98 | data[1] |= inb(dev->iobase + DIO_R); | 98 | data[1] |= inb(dev->iobase + DIO_R) << 8; |
99 | 99 | ||
100 | return insn->n; | 100 | return insn->n; |
101 | } | 101 | } |
diff --git a/drivers/staging/comedi/drivers/ni_labpc.c b/drivers/staging/comedi/drivers/ni_labpc.c index 28b91a6c3789..b5a19a0863fb 100644 --- a/drivers/staging/comedi/drivers/ni_labpc.c +++ b/drivers/staging/comedi/drivers/ni_labpc.c | |||
@@ -772,6 +772,8 @@ void labpc_common_detach(struct comedi_device *dev) | |||
772 | { | 772 | { |
773 | struct comedi_subdevice *s; | 773 | struct comedi_subdevice *s; |
774 | 774 | ||
775 | if (!thisboard) | ||
776 | return; | ||
775 | if (dev->subdevices) { | 777 | if (dev->subdevices) { |
776 | s = &dev->subdevices[2]; | 778 | s = &dev->subdevices[2]; |
777 | subdev_8255_cleanup(dev, s); | 779 | subdev_8255_cleanup(dev, s); |
diff --git a/drivers/staging/iio/accel/adis16201_core.c b/drivers/staging/iio/accel/adis16201_core.c index 8e37d6e04277..b12ca68cd9e4 100644 --- a/drivers/staging/iio/accel/adis16201_core.c +++ b/drivers/staging/iio/accel/adis16201_core.c | |||
@@ -310,30 +310,32 @@ static int adis16201_read_raw(struct iio_dev *indio_dev, | |||
310 | case IIO_CHAN_INFO_SCALE: | 310 | case IIO_CHAN_INFO_SCALE: |
311 | switch (chan->type) { | 311 | switch (chan->type) { |
312 | case IIO_VOLTAGE: | 312 | case IIO_VOLTAGE: |
313 | *val = 0; | 313 | if (chan->channel == 0) { |
314 | if (chan->channel == 0) | 314 | *val = 1; |
315 | *val2 = 1220; | 315 | *val2 = 220000; /* 1.22 mV */ |
316 | else | 316 | } else { |
317 | *val2 = 610; | 317 | *val = 0; |
318 | *val2 = 610000; /* 0.610 mV */ | ||
319 | } | ||
318 | return IIO_VAL_INT_PLUS_MICRO; | 320 | return IIO_VAL_INT_PLUS_MICRO; |
319 | case IIO_TEMP: | 321 | case IIO_TEMP: |
320 | *val = 0; | 322 | *val = -470; /* 0.47 C */ |
321 | *val2 = -470000; | 323 | *val2 = 0; |
322 | return IIO_VAL_INT_PLUS_MICRO; | 324 | return IIO_VAL_INT_PLUS_MICRO; |
323 | case IIO_ACCEL: | 325 | case IIO_ACCEL: |
324 | *val = 0; | 326 | *val = 0; |
325 | *val2 = 462500; | 327 | *val2 = IIO_G_TO_M_S_2(462400); /* 0.4624 mg */ |
326 | return IIO_VAL_INT_PLUS_MICRO; | 328 | return IIO_VAL_INT_PLUS_NANO; |
327 | case IIO_INCLI: | 329 | case IIO_INCLI: |
328 | *val = 0; | 330 | *val = 0; |
329 | *val2 = 100000; | 331 | *val2 = 100000; /* 0.1 degree */ |
330 | return IIO_VAL_INT_PLUS_MICRO; | 332 | return IIO_VAL_INT_PLUS_MICRO; |
331 | default: | 333 | default: |
332 | return -EINVAL; | 334 | return -EINVAL; |
333 | } | 335 | } |
334 | break; | 336 | break; |
335 | case IIO_CHAN_INFO_OFFSET: | 337 | case IIO_CHAN_INFO_OFFSET: |
336 | *val = 25; | 338 | *val = 25000 / -470 - 1278; /* 25 C = 1278 */ |
337 | return IIO_VAL_INT; | 339 | return IIO_VAL_INT; |
338 | case IIO_CHAN_INFO_CALIBBIAS: | 340 | case IIO_CHAN_INFO_CALIBBIAS: |
339 | switch (chan->type) { | 341 | switch (chan->type) { |
diff --git a/drivers/staging/iio/accel/adis16203_core.c b/drivers/staging/iio/accel/adis16203_core.c index 002fa9dfc375..e7b3441115ae 100644 --- a/drivers/staging/iio/accel/adis16203_core.c +++ b/drivers/staging/iio/accel/adis16203_core.c | |||
@@ -316,25 +316,27 @@ static int adis16203_read_raw(struct iio_dev *indio_dev, | |||
316 | case IIO_CHAN_INFO_SCALE: | 316 | case IIO_CHAN_INFO_SCALE: |
317 | switch (chan->type) { | 317 | switch (chan->type) { |
318 | case IIO_VOLTAGE: | 318 | case IIO_VOLTAGE: |
319 | *val = 0; | 319 | if (chan->channel == 0) { |
320 | if (chan->channel == 0) | 320 | *val = 1; |
321 | *val2 = 1220; | 321 | *val2 = 220000; /* 1.22 mV */ |
322 | else | 322 | } else { |
323 | *val2 = 610; | 323 | *val = 0; |
324 | *val2 = 610000; /* 0.61 mV */ | ||
325 | } | ||
324 | return IIO_VAL_INT_PLUS_MICRO; | 326 | return IIO_VAL_INT_PLUS_MICRO; |
325 | case IIO_TEMP: | 327 | case IIO_TEMP: |
326 | *val = 0; | 328 | *val = -470; /* -0.47 C */ |
327 | *val2 = -470000; | 329 | *val2 = 0; |
328 | return IIO_VAL_INT_PLUS_MICRO; | 330 | return IIO_VAL_INT_PLUS_MICRO; |
329 | case IIO_INCLI: | 331 | case IIO_INCLI: |
330 | *val = 0; | 332 | *val = 0; |
331 | *val2 = 25000; | 333 | *val2 = 25000; /* 0.025 degree */ |
332 | return IIO_VAL_INT_PLUS_MICRO; | 334 | return IIO_VAL_INT_PLUS_MICRO; |
333 | default: | 335 | default: |
334 | return -EINVAL; | 336 | return -EINVAL; |
335 | } | 337 | } |
336 | case IIO_CHAN_INFO_OFFSET: | 338 | case IIO_CHAN_INFO_OFFSET: |
337 | *val = 25; | 339 | *val = 25000 / -470 - 1278; /* 25 C = 1278 */ |
338 | return IIO_VAL_INT; | 340 | return IIO_VAL_INT; |
339 | case IIO_CHAN_INFO_CALIBBIAS: | 341 | case IIO_CHAN_INFO_CALIBBIAS: |
340 | bits = 14; | 342 | bits = 14; |
diff --git a/drivers/staging/iio/accel/adis16204_core.c b/drivers/staging/iio/accel/adis16204_core.c index 05bdb7c2c8e3..c6234c2f46aa 100644 --- a/drivers/staging/iio/accel/adis16204_core.c +++ b/drivers/staging/iio/accel/adis16204_core.c | |||
@@ -317,26 +317,28 @@ static int adis16204_read_raw(struct iio_dev *indio_dev, | |||
317 | case IIO_CHAN_INFO_SCALE: | 317 | case IIO_CHAN_INFO_SCALE: |
318 | switch (chan->type) { | 318 | switch (chan->type) { |
319 | case IIO_VOLTAGE: | 319 | case IIO_VOLTAGE: |
320 | *val = 0; | 320 | if (chan->channel == 0) { |
321 | if (chan->channel == 0) | 321 | *val = 1; |
322 | *val2 = 1220; | 322 | *val2 = 220000; /* 1.22 mV */ |
323 | else | 323 | } else { |
324 | *val2 = 610; | 324 | *val = 0; |
325 | *val2 = 610000; /* 0.61 mV */ | ||
326 | } | ||
325 | return IIO_VAL_INT_PLUS_MICRO; | 327 | return IIO_VAL_INT_PLUS_MICRO; |
326 | case IIO_TEMP: | 328 | case IIO_TEMP: |
327 | *val = 0; | 329 | *val = -470; /* 0.47 C */ |
328 | *val2 = -470000; | 330 | *val2 = 0; |
329 | return IIO_VAL_INT_PLUS_MICRO; | 331 | return IIO_VAL_INT_PLUS_MICRO; |
330 | case IIO_ACCEL: | 332 | case IIO_ACCEL: |
331 | *val = 0; | 333 | *val = 0; |
332 | switch (chan->channel2) { | 334 | switch (chan->channel2) { |
333 | case IIO_MOD_X: | 335 | case IIO_MOD_X: |
334 | case IIO_MOD_ROOT_SUM_SQUARED_X_Y: | 336 | case IIO_MOD_ROOT_SUM_SQUARED_X_Y: |
335 | *val2 = 17125; | 337 | *val2 = IIO_G_TO_M_S_2(17125); /* 17.125 mg */ |
336 | break; | 338 | break; |
337 | case IIO_MOD_Y: | 339 | case IIO_MOD_Y: |
338 | case IIO_MOD_Z: | 340 | case IIO_MOD_Z: |
339 | *val2 = 8407; | 341 | *val2 = IIO_G_TO_M_S_2(8407); /* 8.407 mg */ |
340 | break; | 342 | break; |
341 | } | 343 | } |
342 | return IIO_VAL_INT_PLUS_MICRO; | 344 | return IIO_VAL_INT_PLUS_MICRO; |
@@ -345,7 +347,7 @@ static int adis16204_read_raw(struct iio_dev *indio_dev, | |||
345 | } | 347 | } |
346 | break; | 348 | break; |
347 | case IIO_CHAN_INFO_OFFSET: | 349 | case IIO_CHAN_INFO_OFFSET: |
348 | *val = 25; | 350 | *val = 25000 / -470 - 1278; /* 25 C = 1278 */ |
349 | return IIO_VAL_INT; | 351 | return IIO_VAL_INT; |
350 | case IIO_CHAN_INFO_CALIBBIAS: | 352 | case IIO_CHAN_INFO_CALIBBIAS: |
351 | case IIO_CHAN_INFO_PEAK: | 353 | case IIO_CHAN_INFO_PEAK: |
diff --git a/drivers/staging/iio/accel/adis16209_core.c b/drivers/staging/iio/accel/adis16209_core.c index b7333bfe0b2f..7ee974b45d7d 100644 --- a/drivers/staging/iio/accel/adis16209_core.c +++ b/drivers/staging/iio/accel/adis16209_core.c | |||
@@ -343,28 +343,29 @@ static int adis16209_read_raw(struct iio_dev *indio_dev, | |||
343 | case IIO_VOLTAGE: | 343 | case IIO_VOLTAGE: |
344 | *val = 0; | 344 | *val = 0; |
345 | if (chan->channel == 0) | 345 | if (chan->channel == 0) |
346 | *val2 = 305180; | 346 | *val2 = 305180; /* 0.30518 mV */ |
347 | else | 347 | else |
348 | *val2 = 610500; | 348 | *val2 = 610500; /* 0.6105 mV */ |
349 | return IIO_VAL_INT_PLUS_MICRO; | 349 | return IIO_VAL_INT_PLUS_MICRO; |
350 | case IIO_TEMP: | 350 | case IIO_TEMP: |
351 | *val = 0; | 351 | *val = -470; /* -0.47 C */ |
352 | *val2 = -470000; | 352 | *val2 = 0; |
353 | return IIO_VAL_INT_PLUS_MICRO; | 353 | return IIO_VAL_INT_PLUS_MICRO; |
354 | case IIO_ACCEL: | 354 | case IIO_ACCEL: |
355 | *val = 0; | 355 | *val = 0; |
356 | *val2 = 2394; | 356 | *val2 = IIO_G_TO_M_S_2(244140); /* 0.244140 mg */ |
357 | return IIO_VAL_INT_PLUS_MICRO; | 357 | return IIO_VAL_INT_PLUS_NANO; |
358 | case IIO_INCLI: | 358 | case IIO_INCLI: |
359 | case IIO_ROT: | ||
359 | *val = 0; | 360 | *val = 0; |
360 | *val2 = 436; | 361 | *val2 = 25000; /* 0.025 degree */ |
361 | return IIO_VAL_INT_PLUS_MICRO; | 362 | return IIO_VAL_INT_PLUS_MICRO; |
362 | default: | 363 | default: |
363 | return -EINVAL; | 364 | return -EINVAL; |
364 | } | 365 | } |
365 | break; | 366 | break; |
366 | case IIO_CHAN_INFO_OFFSET: | 367 | case IIO_CHAN_INFO_OFFSET: |
367 | *val = 25; | 368 | *val = 25000 / -470 - 0x4FE; /* 25 C = 0x4FE */ |
368 | return IIO_VAL_INT; | 369 | return IIO_VAL_INT; |
369 | case IIO_CHAN_INFO_CALIBBIAS: | 370 | case IIO_CHAN_INFO_CALIBBIAS: |
370 | switch (chan->type) { | 371 | switch (chan->type) { |
@@ -491,6 +492,7 @@ static const struct iio_chan_spec adis16209_channels[] = { | |||
491 | .modified = 1, | 492 | .modified = 1, |
492 | .channel2 = IIO_MOD_X, | 493 | .channel2 = IIO_MOD_X, |
493 | .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT, | 494 | .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT, |
495 | IIO_CHAN_INFO_SCALE_SHARED_BIT, | ||
494 | .address = rot, | 496 | .address = rot, |
495 | .scan_index = ADIS16209_SCAN_ROT, | 497 | .scan_index = ADIS16209_SCAN_ROT, |
496 | .scan_type = { | 498 | .scan_type = { |
diff --git a/drivers/staging/iio/accel/adis16220_core.c b/drivers/staging/iio/accel/adis16220_core.c index c755089c7117..eaadd9df3f78 100644 --- a/drivers/staging/iio/accel/adis16220_core.c +++ b/drivers/staging/iio/accel/adis16220_core.c | |||
@@ -486,7 +486,7 @@ static int adis16220_read_raw(struct iio_dev *indio_dev, | |||
486 | break; | 486 | break; |
487 | case IIO_CHAN_INFO_OFFSET: | 487 | case IIO_CHAN_INFO_OFFSET: |
488 | if (chan->type == IIO_TEMP) { | 488 | if (chan->type == IIO_TEMP) { |
489 | *val = 25; | 489 | *val = 25000 / -470 - 1278; /* 25 C = 1278 */ |
490 | return IIO_VAL_INT; | 490 | return IIO_VAL_INT; |
491 | } | 491 | } |
492 | addrind = 1; | 492 | addrind = 1; |
@@ -495,19 +495,22 @@ static int adis16220_read_raw(struct iio_dev *indio_dev, | |||
495 | addrind = 2; | 495 | addrind = 2; |
496 | break; | 496 | break; |
497 | case IIO_CHAN_INFO_SCALE: | 497 | case IIO_CHAN_INFO_SCALE: |
498 | *val = 0; | ||
499 | switch (chan->type) { | 498 | switch (chan->type) { |
500 | case IIO_TEMP: | 499 | case IIO_TEMP: |
501 | *val2 = -470000; | 500 | *val = -470; /* -0.47 C */ |
501 | *val2 = 0; | ||
502 | return IIO_VAL_INT_PLUS_MICRO; | 502 | return IIO_VAL_INT_PLUS_MICRO; |
503 | case IIO_ACCEL: | 503 | case IIO_ACCEL: |
504 | *val2 = 1887042; | 504 | *val2 = IIO_G_TO_M_S_2(19073); /* 19.073 g */ |
505 | return IIO_VAL_INT_PLUS_MICRO; | 505 | return IIO_VAL_INT_PLUS_MICRO; |
506 | case IIO_VOLTAGE: | 506 | case IIO_VOLTAGE: |
507 | if (chan->channel == 0) | 507 | if (chan->channel == 0) { |
508 | *val2 = 0012221; | 508 | *val = 1; |
509 | else /* Should really be dependent on VDD */ | 509 | *val2 = 220700; /* 1.2207 mV */ |
510 | *val2 = 305; | 510 | } else { |
511 | /* Should really be dependent on VDD */ | ||
512 | *val2 = 305180; /* 305.18 uV */ | ||
513 | } | ||
511 | return IIO_VAL_INT_PLUS_MICRO; | 514 | return IIO_VAL_INT_PLUS_MICRO; |
512 | default: | 515 | default: |
513 | return -EINVAL; | 516 | return -EINVAL; |
diff --git a/drivers/staging/iio/accel/adis16240_core.c b/drivers/staging/iio/accel/adis16240_core.c index 0fc26a49d681..35e093973d5c 100644 --- a/drivers/staging/iio/accel/adis16240_core.c +++ b/drivers/staging/iio/accel/adis16240_core.c | |||
@@ -373,30 +373,31 @@ static int adis16240_read_raw(struct iio_dev *indio_dev, | |||
373 | case IIO_CHAN_INFO_SCALE: | 373 | case IIO_CHAN_INFO_SCALE: |
374 | switch (chan->type) { | 374 | switch (chan->type) { |
375 | case IIO_VOLTAGE: | 375 | case IIO_VOLTAGE: |
376 | *val = 0; | 376 | if (chan->channel == 0) { |
377 | if (chan->channel == 0) | 377 | *val = 4; |
378 | *val2 = 4880; | 378 | *val2 = 880000; /* 4.88 mV */ |
379 | else | 379 | return IIO_VAL_INT_PLUS_MICRO; |
380 | } else { | ||
380 | return -EINVAL; | 381 | return -EINVAL; |
381 | return IIO_VAL_INT_PLUS_MICRO; | 382 | } |
382 | case IIO_TEMP: | 383 | case IIO_TEMP: |
383 | *val = 0; | 384 | *val = 244; /* 0.244 C */ |
384 | *val2 = 244000; | 385 | *val2 = 0; |
385 | return IIO_VAL_INT_PLUS_MICRO; | 386 | return IIO_VAL_INT_PLUS_MICRO; |
386 | case IIO_ACCEL: | 387 | case IIO_ACCEL: |
387 | *val = 0; | 388 | *val = 0; |
388 | *val2 = 504062; | 389 | *val2 = IIO_G_TO_M_S_2(51400); /* 51.4 mg */ |
389 | return IIO_VAL_INT_PLUS_MICRO; | 390 | return IIO_VAL_INT_PLUS_MICRO; |
390 | default: | 391 | default: |
391 | return -EINVAL; | 392 | return -EINVAL; |
392 | } | 393 | } |
393 | break; | 394 | break; |
394 | case IIO_CHAN_INFO_PEAK_SCALE: | 395 | case IIO_CHAN_INFO_PEAK_SCALE: |
395 | *val = 6; | 396 | *val = 0; |
396 | *val2 = 629295; | 397 | *val2 = IIO_G_TO_M_S_2(51400); /* 51.4 mg */ |
397 | return IIO_VAL_INT_PLUS_MICRO; | 398 | return IIO_VAL_INT_PLUS_MICRO; |
398 | case IIO_CHAN_INFO_OFFSET: | 399 | case IIO_CHAN_INFO_OFFSET: |
399 | *val = 25; | 400 | *val = 25000 / 244 - 0x133; /* 25 C = 0x133 */ |
400 | return IIO_VAL_INT; | 401 | return IIO_VAL_INT; |
401 | case IIO_CHAN_INFO_CALIBBIAS: | 402 | case IIO_CHAN_INFO_CALIBBIAS: |
402 | bits = 10; | 403 | bits = 10; |
diff --git a/drivers/staging/iio/gyro/adis16260_core.c b/drivers/staging/iio/gyro/adis16260_core.c index 9571c03aa4cc..aa964a2d8290 100644 --- a/drivers/staging/iio/gyro/adis16260_core.c +++ b/drivers/staging/iio/gyro/adis16260_core.c | |||
@@ -498,28 +498,33 @@ static int adis16260_read_raw(struct iio_dev *indio_dev, | |||
498 | switch (chan->type) { | 498 | switch (chan->type) { |
499 | case IIO_ANGL_VEL: | 499 | case IIO_ANGL_VEL: |
500 | *val = 0; | 500 | *val = 0; |
501 | if (spi_get_device_id(st->us)->driver_data) | 501 | if (spi_get_device_id(st->us)->driver_data) { |
502 | *val2 = 320; | 502 | /* 0.01832 degree / sec */ |
503 | else | 503 | *val2 = IIO_DEGREE_TO_RAD(18320); |
504 | *val2 = 1278; | 504 | } else { |
505 | /* 0.07326 degree / sec */ | ||
506 | *val2 = IIO_DEGREE_TO_RAD(73260); | ||
507 | } | ||
505 | return IIO_VAL_INT_PLUS_MICRO; | 508 | return IIO_VAL_INT_PLUS_MICRO; |
506 | case IIO_VOLTAGE: | 509 | case IIO_VOLTAGE: |
507 | *val = 0; | 510 | if (chan->channel == 0) { |
508 | if (chan->channel == 0) | 511 | *val = 1; |
509 | *val2 = 18315; | 512 | *val2 = 831500; /* 1.8315 mV */ |
510 | else | 513 | } else { |
511 | *val2 = 610500; | 514 | *val = 0; |
515 | *val2 = 610500; /* 610.5 uV */ | ||
516 | } | ||
512 | return IIO_VAL_INT_PLUS_MICRO; | 517 | return IIO_VAL_INT_PLUS_MICRO; |
513 | case IIO_TEMP: | 518 | case IIO_TEMP: |
514 | *val = 0; | 519 | *val = 145; |
515 | *val2 = 145300; | 520 | *val2 = 300000; /* 0.1453 C */ |
516 | return IIO_VAL_INT_PLUS_MICRO; | 521 | return IIO_VAL_INT_PLUS_MICRO; |
517 | default: | 522 | default: |
518 | return -EINVAL; | 523 | return -EINVAL; |
519 | } | 524 | } |
520 | break; | 525 | break; |
521 | case IIO_CHAN_INFO_OFFSET: | 526 | case IIO_CHAN_INFO_OFFSET: |
522 | *val = 25; | 527 | *val = 250000 / 1453; /* 25 C = 0x00 */ |
523 | return IIO_VAL_INT; | 528 | return IIO_VAL_INT; |
524 | case IIO_CHAN_INFO_CALIBBIAS: | 529 | case IIO_CHAN_INFO_CALIBBIAS: |
525 | switch (chan->type) { | 530 | switch (chan->type) { |
diff --git a/drivers/staging/iio/imu/adis16400.h b/drivers/staging/iio/imu/adis16400.h index d59d7ac856a9..77c601da1846 100644 --- a/drivers/staging/iio/imu/adis16400.h +++ b/drivers/staging/iio/imu/adis16400.h | |||
@@ -139,6 +139,8 @@ struct adis16400_chip_info { | |||
139 | const long flags; | 139 | const long flags; |
140 | unsigned int gyro_scale_micro; | 140 | unsigned int gyro_scale_micro; |
141 | unsigned int accel_scale_micro; | 141 | unsigned int accel_scale_micro; |
142 | int temp_scale_nano; | ||
143 | int temp_offset; | ||
142 | unsigned long default_scan_mask; | 144 | unsigned long default_scan_mask; |
143 | }; | 145 | }; |
144 | 146 | ||
diff --git a/drivers/staging/iio/imu/adis16400_core.c b/drivers/staging/iio/imu/adis16400_core.c index b302c9ba2712..3144a7b1e1c4 100644 --- a/drivers/staging/iio/imu/adis16400_core.c +++ b/drivers/staging/iio/imu/adis16400_core.c | |||
@@ -553,10 +553,13 @@ static int adis16400_read_raw(struct iio_dev *indio_dev, | |||
553 | return IIO_VAL_INT_PLUS_MICRO; | 553 | return IIO_VAL_INT_PLUS_MICRO; |
554 | case IIO_VOLTAGE: | 554 | case IIO_VOLTAGE: |
555 | *val = 0; | 555 | *val = 0; |
556 | if (chan->channel == 0) | 556 | if (chan->channel == 0) { |
557 | *val2 = 2418; | 557 | *val = 2; |
558 | else | 558 | *val2 = 418000; /* 2.418 mV */ |
559 | *val2 = 806; | 559 | } else { |
560 | *val = 0; | ||
561 | *val2 = 805800; /* 805.8 uV */ | ||
562 | } | ||
560 | return IIO_VAL_INT_PLUS_MICRO; | 563 | return IIO_VAL_INT_PLUS_MICRO; |
561 | case IIO_ACCEL: | 564 | case IIO_ACCEL: |
562 | *val = 0; | 565 | *val = 0; |
@@ -564,11 +567,11 @@ static int adis16400_read_raw(struct iio_dev *indio_dev, | |||
564 | return IIO_VAL_INT_PLUS_MICRO; | 567 | return IIO_VAL_INT_PLUS_MICRO; |
565 | case IIO_MAGN: | 568 | case IIO_MAGN: |
566 | *val = 0; | 569 | *val = 0; |
567 | *val2 = 500; | 570 | *val2 = 500; /* 0.5 mgauss */ |
568 | return IIO_VAL_INT_PLUS_MICRO; | 571 | return IIO_VAL_INT_PLUS_MICRO; |
569 | case IIO_TEMP: | 572 | case IIO_TEMP: |
570 | *val = 0; | 573 | *val = st->variant->temp_scale_nano / 1000000; |
571 | *val2 = 140000; | 574 | *val2 = (st->variant->temp_scale_nano % 1000000); |
572 | return IIO_VAL_INT_PLUS_MICRO; | 575 | return IIO_VAL_INT_PLUS_MICRO; |
573 | default: | 576 | default: |
574 | return -EINVAL; | 577 | return -EINVAL; |
@@ -586,9 +589,8 @@ static int adis16400_read_raw(struct iio_dev *indio_dev, | |||
586 | return IIO_VAL_INT; | 589 | return IIO_VAL_INT; |
587 | case IIO_CHAN_INFO_OFFSET: | 590 | case IIO_CHAN_INFO_OFFSET: |
588 | /* currently only temperature */ | 591 | /* currently only temperature */ |
589 | *val = 198; | 592 | *val = st->variant->temp_offset; |
590 | *val2 = 160000; | 593 | return IIO_VAL_INT; |
591 | return IIO_VAL_INT_PLUS_MICRO; | ||
592 | case IIO_CHAN_INFO_LOW_PASS_FILTER_3DB_FREQUENCY: | 594 | case IIO_CHAN_INFO_LOW_PASS_FILTER_3DB_FREQUENCY: |
593 | mutex_lock(&indio_dev->mlock); | 595 | mutex_lock(&indio_dev->mlock); |
594 | /* Need both the number of taps and the sampling frequency */ | 596 | /* Need both the number of taps and the sampling frequency */ |
@@ -1035,7 +1037,7 @@ static const struct iio_chan_spec adis16334_channels[] = { | |||
1035 | .indexed = 1, | 1037 | .indexed = 1, |
1036 | .channel = 0, | 1038 | .channel = 0, |
1037 | .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT | | 1039 | .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT | |
1038 | IIO_CHAN_INFO_CALIBBIAS_SEPARATE_BIT | | 1040 | IIO_CHAN_INFO_OFFSET_SEPARATE_BIT | |
1039 | IIO_CHAN_INFO_SCALE_SHARED_BIT, | 1041 | IIO_CHAN_INFO_SCALE_SHARED_BIT, |
1040 | .address = temp0, | 1042 | .address = temp0, |
1041 | .scan_index = ADIS16400_SCAN_TEMP, | 1043 | .scan_index = ADIS16400_SCAN_TEMP, |
@@ -1058,8 +1060,10 @@ static struct adis16400_chip_info adis16400_chips[] = { | |||
1058 | [ADIS16300] = { | 1060 | [ADIS16300] = { |
1059 | .channels = adis16300_channels, | 1061 | .channels = adis16300_channels, |
1060 | .num_channels = ARRAY_SIZE(adis16300_channels), | 1062 | .num_channels = ARRAY_SIZE(adis16300_channels), |
1061 | .gyro_scale_micro = 873, | 1063 | .gyro_scale_micro = IIO_DEGREE_TO_RAD(50000), /* 0.05 deg/s */ |
1062 | .accel_scale_micro = 5884, | 1064 | .accel_scale_micro = 5884, |
1065 | .temp_scale_nano = 140000000, /* 0.14 C */ | ||
1066 | .temp_offset = 25000000 / 140000, /* 25 C = 0x00 */ | ||
1063 | .default_scan_mask = (1 << ADIS16400_SCAN_SUPPLY) | | 1067 | .default_scan_mask = (1 << ADIS16400_SCAN_SUPPLY) | |
1064 | (1 << ADIS16400_SCAN_GYRO_X) | (1 << ADIS16400_SCAN_ACC_X) | | 1068 | (1 << ADIS16400_SCAN_GYRO_X) | (1 << ADIS16400_SCAN_ACC_X) | |
1065 | (1 << ADIS16400_SCAN_ACC_Y) | (1 << ADIS16400_SCAN_ACC_Z) | | 1069 | (1 << ADIS16400_SCAN_ACC_Y) | (1 << ADIS16400_SCAN_ACC_Z) | |
@@ -1070,8 +1074,10 @@ static struct adis16400_chip_info adis16400_chips[] = { | |||
1070 | [ADIS16334] = { | 1074 | [ADIS16334] = { |
1071 | .channels = adis16334_channels, | 1075 | .channels = adis16334_channels, |
1072 | .num_channels = ARRAY_SIZE(adis16334_channels), | 1076 | .num_channels = ARRAY_SIZE(adis16334_channels), |
1073 | .gyro_scale_micro = 873, | 1077 | .gyro_scale_micro = IIO_DEGREE_TO_RAD(50000), /* 0.05 deg/s */ |
1074 | .accel_scale_micro = 981, | 1078 | .accel_scale_micro = IIO_G_TO_M_S_2(1000), /* 1 mg */ |
1079 | .temp_scale_nano = 67850000, /* 0.06785 C */ | ||
1080 | .temp_offset = 25000000 / 67850, /* 25 C = 0x00 */ | ||
1075 | .default_scan_mask = (1 << ADIS16400_SCAN_GYRO_X) | | 1081 | .default_scan_mask = (1 << ADIS16400_SCAN_GYRO_X) | |
1076 | (1 << ADIS16400_SCAN_GYRO_Y) | (1 << ADIS16400_SCAN_GYRO_Z) | | 1082 | (1 << ADIS16400_SCAN_GYRO_Y) | (1 << ADIS16400_SCAN_GYRO_Z) | |
1077 | (1 << ADIS16400_SCAN_ACC_X) | (1 << ADIS16400_SCAN_ACC_Y) | | 1083 | (1 << ADIS16400_SCAN_ACC_X) | (1 << ADIS16400_SCAN_ACC_Y) | |
@@ -1080,8 +1086,10 @@ static struct adis16400_chip_info adis16400_chips[] = { | |||
1080 | [ADIS16350] = { | 1086 | [ADIS16350] = { |
1081 | .channels = adis16350_channels, | 1087 | .channels = adis16350_channels, |
1082 | .num_channels = ARRAY_SIZE(adis16350_channels), | 1088 | .num_channels = ARRAY_SIZE(adis16350_channels), |
1083 | .gyro_scale_micro = 872664, | 1089 | .gyro_scale_micro = IIO_DEGREE_TO_RAD(73260), /* 0.07326 deg/s */ |
1084 | .accel_scale_micro = 24732, | 1090 | .accel_scale_micro = IIO_G_TO_M_S_2(2522), /* 0.002522 g */ |
1091 | .temp_scale_nano = 145300000, /* 0.1453 C */ | ||
1092 | .temp_offset = 25000000 / 145300, /* 25 C = 0x00 */ | ||
1085 | .default_scan_mask = 0x7FF, | 1093 | .default_scan_mask = 0x7FF, |
1086 | .flags = ADIS16400_NO_BURST, | 1094 | .flags = ADIS16400_NO_BURST, |
1087 | }, | 1095 | }, |
@@ -1090,8 +1098,10 @@ static struct adis16400_chip_info adis16400_chips[] = { | |||
1090 | .num_channels = ARRAY_SIZE(adis16350_channels), | 1098 | .num_channels = ARRAY_SIZE(adis16350_channels), |
1091 | .flags = ADIS16400_HAS_PROD_ID, | 1099 | .flags = ADIS16400_HAS_PROD_ID, |
1092 | .product_id = 0x3FE8, | 1100 | .product_id = 0x3FE8, |
1093 | .gyro_scale_micro = 1279, | 1101 | .gyro_scale_micro = IIO_DEGREE_TO_RAD(50000), /* 0.05 deg/s */ |
1094 | .accel_scale_micro = 24732, | 1102 | .accel_scale_micro = IIO_G_TO_M_S_2(3333), /* 3.333 mg */ |
1103 | .temp_scale_nano = 136000000, /* 0.136 C */ | ||
1104 | .temp_offset = 25000000 / 136000, /* 25 C = 0x00 */ | ||
1095 | .default_scan_mask = 0x7FF, | 1105 | .default_scan_mask = 0x7FF, |
1096 | }, | 1106 | }, |
1097 | [ADIS16362] = { | 1107 | [ADIS16362] = { |
@@ -1099,8 +1109,10 @@ static struct adis16400_chip_info adis16400_chips[] = { | |||
1099 | .num_channels = ARRAY_SIZE(adis16350_channels), | 1109 | .num_channels = ARRAY_SIZE(adis16350_channels), |
1100 | .flags = ADIS16400_HAS_PROD_ID, | 1110 | .flags = ADIS16400_HAS_PROD_ID, |
1101 | .product_id = 0x3FEA, | 1111 | .product_id = 0x3FEA, |
1102 | .gyro_scale_micro = 1279, | 1112 | .gyro_scale_micro = IIO_DEGREE_TO_RAD(50000), /* 0.05 deg/s */ |
1103 | .accel_scale_micro = 24732, | 1113 | .accel_scale_micro = IIO_G_TO_M_S_2(333), /* 0.333 mg */ |
1114 | .temp_scale_nano = 136000000, /* 0.136 C */ | ||
1115 | .temp_offset = 25000000 / 136000, /* 25 C = 0x00 */ | ||
1104 | .default_scan_mask = 0x7FF, | 1116 | .default_scan_mask = 0x7FF, |
1105 | }, | 1117 | }, |
1106 | [ADIS16364] = { | 1118 | [ADIS16364] = { |
@@ -1108,8 +1120,10 @@ static struct adis16400_chip_info adis16400_chips[] = { | |||
1108 | .num_channels = ARRAY_SIZE(adis16350_channels), | 1120 | .num_channels = ARRAY_SIZE(adis16350_channels), |
1109 | .flags = ADIS16400_HAS_PROD_ID, | 1121 | .flags = ADIS16400_HAS_PROD_ID, |
1110 | .product_id = 0x3FEC, | 1122 | .product_id = 0x3FEC, |
1111 | .gyro_scale_micro = 1279, | 1123 | .gyro_scale_micro = IIO_DEGREE_TO_RAD(50000), /* 0.05 deg/s */ |
1112 | .accel_scale_micro = 24732, | 1124 | .accel_scale_micro = IIO_G_TO_M_S_2(1000), /* 1 mg */ |
1125 | .temp_scale_nano = 136000000, /* 0.136 C */ | ||
1126 | .temp_offset = 25000000 / 136000, /* 25 C = 0x00 */ | ||
1113 | .default_scan_mask = 0x7FF, | 1127 | .default_scan_mask = 0x7FF, |
1114 | }, | 1128 | }, |
1115 | [ADIS16365] = { | 1129 | [ADIS16365] = { |
@@ -1117,8 +1131,10 @@ static struct adis16400_chip_info adis16400_chips[] = { | |||
1117 | .num_channels = ARRAY_SIZE(adis16350_channels), | 1131 | .num_channels = ARRAY_SIZE(adis16350_channels), |
1118 | .flags = ADIS16400_HAS_PROD_ID, | 1132 | .flags = ADIS16400_HAS_PROD_ID, |
1119 | .product_id = 0x3FED, | 1133 | .product_id = 0x3FED, |
1120 | .gyro_scale_micro = 1279, | 1134 | .gyro_scale_micro = IIO_DEGREE_TO_RAD(50000), /* 0.05 deg/s */ |
1121 | .accel_scale_micro = 24732, | 1135 | .accel_scale_micro = IIO_G_TO_M_S_2(1000), /* 1 mg */ |
1136 | .temp_scale_nano = 136000000, /* 0.136 C */ | ||
1137 | .temp_offset = 25000000 / 136000, /* 25 C = 0x00 */ | ||
1122 | .default_scan_mask = 0x7FF, | 1138 | .default_scan_mask = 0x7FF, |
1123 | }, | 1139 | }, |
1124 | [ADIS16400] = { | 1140 | [ADIS16400] = { |
@@ -1126,9 +1142,11 @@ static struct adis16400_chip_info adis16400_chips[] = { | |||
1126 | .num_channels = ARRAY_SIZE(adis16400_channels), | 1142 | .num_channels = ARRAY_SIZE(adis16400_channels), |
1127 | .flags = ADIS16400_HAS_PROD_ID, | 1143 | .flags = ADIS16400_HAS_PROD_ID, |
1128 | .product_id = 0x4015, | 1144 | .product_id = 0x4015, |
1129 | .gyro_scale_micro = 873, | 1145 | .gyro_scale_micro = IIO_DEGREE_TO_RAD(50000), /* 0.05 deg/s */ |
1130 | .accel_scale_micro = 32656, | 1146 | .accel_scale_micro = IIO_G_TO_M_S_2(3333), /* 3.333 mg */ |
1131 | .default_scan_mask = 0xFFF, | 1147 | .default_scan_mask = 0xFFF, |
1148 | .temp_scale_nano = 140000000, /* 0.14 C */ | ||
1149 | .temp_offset = 25000000 / 140000, /* 25 C = 0x00 */ | ||
1132 | } | 1150 | } |
1133 | }; | 1151 | }; |
1134 | 1152 | ||
diff --git a/drivers/staging/ipack/bridges/tpci200.c b/drivers/staging/ipack/bridges/tpci200.c index bb8aa70281cd..46d6657280b8 100644 --- a/drivers/staging/ipack/bridges/tpci200.c +++ b/drivers/staging/ipack/bridges/tpci200.c | |||
@@ -12,6 +12,7 @@ | |||
12 | */ | 12 | */ |
13 | 13 | ||
14 | #include <linux/module.h> | 14 | #include <linux/module.h> |
15 | #include <linux/slab.h> | ||
15 | #include "tpci200.h" | 16 | #include "tpci200.h" |
16 | 17 | ||
17 | static u16 tpci200_status_timeout[] = { | 18 | static u16 tpci200_status_timeout[] = { |
diff --git a/drivers/staging/omapdrm/omap_gem.c b/drivers/staging/omapdrm/omap_gem.c index 3434e6ec0142..66e2c2f8a239 100644 --- a/drivers/staging/omapdrm/omap_gem.c +++ b/drivers/staging/omapdrm/omap_gem.c | |||
@@ -246,7 +246,7 @@ static int omap_gem_attach_pages(struct drm_gem_object *obj) | |||
246 | * DSS, GPU, etc. are not cache coherent: | 246 | * DSS, GPU, etc. are not cache coherent: |
247 | */ | 247 | */ |
248 | if (omap_obj->flags & (OMAP_BO_WC|OMAP_BO_UNCACHED)) { | 248 | if (omap_obj->flags & (OMAP_BO_WC|OMAP_BO_UNCACHED)) { |
249 | addrs = kmalloc(npages * sizeof(addrs), GFP_KERNEL); | 249 | addrs = kmalloc(npages * sizeof(*addrs), GFP_KERNEL); |
250 | if (!addrs) { | 250 | if (!addrs) { |
251 | ret = -ENOMEM; | 251 | ret = -ENOMEM; |
252 | goto free_pages; | 252 | goto free_pages; |
@@ -257,7 +257,7 @@ static int omap_gem_attach_pages(struct drm_gem_object *obj) | |||
257 | 0, PAGE_SIZE, DMA_BIDIRECTIONAL); | 257 | 0, PAGE_SIZE, DMA_BIDIRECTIONAL); |
258 | } | 258 | } |
259 | } else { | 259 | } else { |
260 | addrs = kzalloc(npages * sizeof(addrs), GFP_KERNEL); | 260 | addrs = kzalloc(npages * sizeof(*addrs), GFP_KERNEL); |
261 | if (!addrs) { | 261 | if (!addrs) { |
262 | ret = -ENOMEM; | 262 | ret = -ENOMEM; |
263 | goto free_pages; | 263 | goto free_pages; |
diff --git a/drivers/staging/ramster/Kconfig b/drivers/staging/ramster/Kconfig index 843c54101438..3abf6619dace 100644 --- a/drivers/staging/ramster/Kconfig +++ b/drivers/staging/ramster/Kconfig | |||
@@ -18,6 +18,7 @@ config ZCACHE2 | |||
18 | config RAMSTER | 18 | config RAMSTER |
19 | bool "Cross-machine RAM capacity sharing, aka peer-to-peer tmem" | 19 | bool "Cross-machine RAM capacity sharing, aka peer-to-peer tmem" |
20 | depends on CONFIGFS_FS=y && SYSFS=y && !HIGHMEM && ZCACHE2=y | 20 | depends on CONFIGFS_FS=y && SYSFS=y && !HIGHMEM && ZCACHE2=y |
21 | depends on NET | ||
21 | # must ensure struct page is 8-byte aligned | 22 | # must ensure struct page is 8-byte aligned |
22 | select HAVE_ALIGNED_STRUCT_PAGE if !64_BIT | 23 | select HAVE_ALIGNED_STRUCT_PAGE if !64_BIT |
23 | default n | 24 | default n |
diff --git a/drivers/staging/tidspbridge/core/tiomap3430.c b/drivers/staging/tidspbridge/core/tiomap3430.c index 066a3ceec65e..f619fb3c56d2 100644 --- a/drivers/staging/tidspbridge/core/tiomap3430.c +++ b/drivers/staging/tidspbridge/core/tiomap3430.c | |||
@@ -126,7 +126,8 @@ static int mem_map_vmalloc(struct bridge_dev_context *dev_context, | |||
126 | u32 ul_num_bytes, | 126 | u32 ul_num_bytes, |
127 | struct hw_mmu_map_attrs_t *hw_attrs); | 127 | struct hw_mmu_map_attrs_t *hw_attrs); |
128 | 128 | ||
129 | bool wait_for_start(struct bridge_dev_context *dev_context, u32 dw_sync_addr); | 129 | bool wait_for_start(struct bridge_dev_context *dev_context, |
130 | void __iomem *sync_addr); | ||
130 | 131 | ||
131 | /* ----------------------------------- Globals */ | 132 | /* ----------------------------------- Globals */ |
132 | 133 | ||
@@ -363,10 +364,11 @@ static int bridge_brd_start(struct bridge_dev_context *dev_ctxt, | |||
363 | { | 364 | { |
364 | int status = 0; | 365 | int status = 0; |
365 | struct bridge_dev_context *dev_context = dev_ctxt; | 366 | struct bridge_dev_context *dev_context = dev_ctxt; |
366 | u32 dw_sync_addr = 0; | 367 | void __iomem *sync_addr; |
367 | u32 ul_shm_base; /* Gpp Phys SM base addr(byte) */ | 368 | u32 ul_shm_base; /* Gpp Phys SM base addr(byte) */ |
368 | u32 ul_shm_base_virt; /* Dsp Virt SM base addr */ | 369 | u32 ul_shm_base_virt; /* Dsp Virt SM base addr */ |
369 | u32 ul_tlb_base_virt; /* Base of MMU TLB entry */ | 370 | u32 ul_tlb_base_virt; /* Base of MMU TLB entry */ |
371 | u32 shm_sync_pa; | ||
370 | /* Offset of shm_base_virt from tlb_base_virt */ | 372 | /* Offset of shm_base_virt from tlb_base_virt */ |
371 | u32 ul_shm_offset_virt; | 373 | u32 ul_shm_offset_virt; |
372 | s32 entry_ndx; | 374 | s32 entry_ndx; |
@@ -397,15 +399,22 @@ static int bridge_brd_start(struct bridge_dev_context *dev_ctxt, | |||
397 | /* Kernel logical address */ | 399 | /* Kernel logical address */ |
398 | ul_shm_base = dev_context->atlb_entry[0].gpp_va + ul_shm_offset_virt; | 400 | ul_shm_base = dev_context->atlb_entry[0].gpp_va + ul_shm_offset_virt; |
399 | 401 | ||
402 | /* SHM physical sync address */ | ||
403 | shm_sync_pa = dev_context->atlb_entry[0].gpp_pa + ul_shm_offset_virt + | ||
404 | SHMSYNCOFFSET; | ||
405 | |||
400 | /* 2nd wd is used as sync field */ | 406 | /* 2nd wd is used as sync field */ |
401 | dw_sync_addr = ul_shm_base + SHMSYNCOFFSET; | 407 | sync_addr = ioremap(shm_sync_pa, SZ_32); |
408 | if (!sync_addr) | ||
409 | return -ENOMEM; | ||
410 | |||
402 | /* Write a signature into the shm base + offset; this will | 411 | /* Write a signature into the shm base + offset; this will |
403 | * get cleared when the DSP program starts. */ | 412 | * get cleared when the DSP program starts. */ |
404 | if ((ul_shm_base_virt == 0) || (ul_shm_base == 0)) { | 413 | if ((ul_shm_base_virt == 0) || (ul_shm_base == 0)) { |
405 | pr_err("%s: Illegal SM base\n", __func__); | 414 | pr_err("%s: Illegal SM base\n", __func__); |
406 | status = -EPERM; | 415 | status = -EPERM; |
407 | } else | 416 | } else |
408 | __raw_writel(0xffffffff, dw_sync_addr); | 417 | __raw_writel(0xffffffff, sync_addr); |
409 | 418 | ||
410 | if (!status) { | 419 | if (!status) { |
411 | resources = dev_context->resources; | 420 | resources = dev_context->resources; |
@@ -419,8 +428,10 @@ static int bridge_brd_start(struct bridge_dev_context *dev_ctxt, | |||
419 | * function is made available. | 428 | * function is made available. |
420 | */ | 429 | */ |
421 | void __iomem *ctrl = ioremap(0x48002000, SZ_4K); | 430 | void __iomem *ctrl = ioremap(0x48002000, SZ_4K); |
422 | if (!ctrl) | 431 | if (!ctrl) { |
432 | iounmap(sync_addr); | ||
423 | return -ENOMEM; | 433 | return -ENOMEM; |
434 | } | ||
424 | 435 | ||
425 | (*pdata->dsp_prm_rmw_bits)(OMAP3430_RST1_IVA2_MASK, | 436 | (*pdata->dsp_prm_rmw_bits)(OMAP3430_RST1_IVA2_MASK, |
426 | OMAP3430_RST1_IVA2_MASK, OMAP3430_IVA2_MOD, | 437 | OMAP3430_RST1_IVA2_MASK, OMAP3430_IVA2_MOD, |
@@ -588,15 +599,15 @@ static int bridge_brd_start(struct bridge_dev_context *dev_ctxt, | |||
588 | (*pdata->dsp_prm_rmw_bits)(OMAP3430_RST1_IVA2_MASK, 0, | 599 | (*pdata->dsp_prm_rmw_bits)(OMAP3430_RST1_IVA2_MASK, 0, |
589 | OMAP3430_IVA2_MOD, OMAP2_RM_RSTCTRL); | 600 | OMAP3430_IVA2_MOD, OMAP2_RM_RSTCTRL); |
590 | 601 | ||
591 | dev_dbg(bridge, "Waiting for Sync @ 0x%x\n", dw_sync_addr); | 602 | dev_dbg(bridge, "Waiting for Sync @ 0x%x\n", *(u32 *)sync_addr); |
592 | dev_dbg(bridge, "DSP c_int00 Address = 0x%x\n", dsp_addr); | 603 | dev_dbg(bridge, "DSP c_int00 Address = 0x%x\n", dsp_addr); |
593 | if (dsp_debug) | 604 | if (dsp_debug) |
594 | while (__raw_readw(dw_sync_addr)) | 605 | while (__raw_readw(sync_addr)) |
595 | ; | 606 | ; |
596 | 607 | ||
597 | /* Wait for DSP to clear word in shared memory */ | 608 | /* Wait for DSP to clear word in shared memory */ |
598 | /* Read the Location */ | 609 | /* Read the Location */ |
599 | if (!wait_for_start(dev_context, dw_sync_addr)) | 610 | if (!wait_for_start(dev_context, sync_addr)) |
600 | status = -ETIMEDOUT; | 611 | status = -ETIMEDOUT; |
601 | 612 | ||
602 | dev_get_symbol(dev_context->dev_obj, "_WDT_enable", &wdt_en); | 613 | dev_get_symbol(dev_context->dev_obj, "_WDT_enable", &wdt_en); |
@@ -612,7 +623,7 @@ static int bridge_brd_start(struct bridge_dev_context *dev_ctxt, | |||
612 | /* Write the synchronization bit to indicate the | 623 | /* Write the synchronization bit to indicate the |
613 | * completion of OPP table update to DSP | 624 | * completion of OPP table update to DSP |
614 | */ | 625 | */ |
615 | __raw_writel(0XCAFECAFE, dw_sync_addr); | 626 | __raw_writel(0XCAFECAFE, sync_addr); |
616 | 627 | ||
617 | /* update board state */ | 628 | /* update board state */ |
618 | dev_context->brd_state = BRD_RUNNING; | 629 | dev_context->brd_state = BRD_RUNNING; |
@@ -621,6 +632,9 @@ static int bridge_brd_start(struct bridge_dev_context *dev_ctxt, | |||
621 | dev_context->brd_state = BRD_UNKNOWN; | 632 | dev_context->brd_state = BRD_UNKNOWN; |
622 | } | 633 | } |
623 | } | 634 | } |
635 | |||
636 | iounmap(sync_addr); | ||
637 | |||
624 | return status; | 638 | return status; |
625 | } | 639 | } |
626 | 640 | ||
@@ -1796,12 +1810,13 @@ static int mem_map_vmalloc(struct bridge_dev_context *dev_context, | |||
1796 | * ======== wait_for_start ======== | 1810 | * ======== wait_for_start ======== |
1797 | * Wait for the singal from DSP that it has started, or time out. | 1811 | * Wait for the singal from DSP that it has started, or time out. |
1798 | */ | 1812 | */ |
1799 | bool wait_for_start(struct bridge_dev_context *dev_context, u32 dw_sync_addr) | 1813 | bool wait_for_start(struct bridge_dev_context *dev_context, |
1814 | void __iomem *sync_addr) | ||
1800 | { | 1815 | { |
1801 | u16 timeout = TIHELEN_ACKTIMEOUT; | 1816 | u16 timeout = TIHELEN_ACKTIMEOUT; |
1802 | 1817 | ||
1803 | /* Wait for response from board */ | 1818 | /* Wait for response from board */ |
1804 | while (__raw_readw(dw_sync_addr) && --timeout) | 1819 | while (__raw_readw(sync_addr) && --timeout) |
1805 | udelay(10); | 1820 | udelay(10); |
1806 | 1821 | ||
1807 | /* If timed out: return false */ | 1822 | /* If timed out: return false */ |
diff --git a/drivers/staging/tidspbridge/hw/hw_mmu.c b/drivers/staging/tidspbridge/hw/hw_mmu.c index 71cb82293649..50244a474178 100644 --- a/drivers/staging/tidspbridge/hw/hw_mmu.c +++ b/drivers/staging/tidspbridge/hw/hw_mmu.c | |||
@@ -48,37 +48,12 @@ enum hw_mmu_page_size_t { | |||
48 | }; | 48 | }; |
49 | 49 | ||
50 | /* | 50 | /* |
51 | * FUNCTION : mmu_flush_entry | ||
52 | * | ||
53 | * INPUTS: | ||
54 | * | ||
55 | * Identifier : base_address | ||
56 | * Type : const u32 | ||
57 | * Description : Base Address of instance of MMU module | ||
58 | * | ||
59 | * RETURNS: | ||
60 | * | ||
61 | * Type : hw_status | ||
62 | * Description : 0 -- No errors occurred | ||
63 | * RET_BAD_NULL_PARAM -- A Pointer | ||
64 | * Parameter was set to NULL | ||
65 | * | ||
66 | * PURPOSE: : Flush the TLB entry pointed by the | ||
67 | * lock counter register | ||
68 | * even if this entry is set protected | ||
69 | * | ||
70 | * METHOD: : Check the Input parameter and Flush a | ||
71 | * single entry in the TLB. | ||
72 | */ | ||
73 | static hw_status mmu_flush_entry(const void __iomem *base_address); | ||
74 | |||
75 | /* | ||
76 | * FUNCTION : mmu_set_cam_entry | 51 | * FUNCTION : mmu_set_cam_entry |
77 | * | 52 | * |
78 | * INPUTS: | 53 | * INPUTS: |
79 | * | 54 | * |
80 | * Identifier : base_address | 55 | * Identifier : base_address |
81 | * TypE : const u32 | 56 | * Type : void __iomem * |
82 | * Description : Base Address of instance of MMU module | 57 | * Description : Base Address of instance of MMU module |
83 | * | 58 | * |
84 | * Identifier : page_sz | 59 | * Identifier : page_sz |
@@ -112,7 +87,7 @@ static hw_status mmu_flush_entry(const void __iomem *base_address); | |||
112 | * | 87 | * |
113 | * METHOD: : Check the Input parameters and set the CAM entry. | 88 | * METHOD: : Check the Input parameters and set the CAM entry. |
114 | */ | 89 | */ |
115 | static hw_status mmu_set_cam_entry(const void __iomem *base_address, | 90 | static hw_status mmu_set_cam_entry(void __iomem *base_address, |
116 | const u32 page_sz, | 91 | const u32 page_sz, |
117 | const u32 preserved_bit, | 92 | const u32 preserved_bit, |
118 | const u32 valid_bit, | 93 | const u32 valid_bit, |
@@ -124,7 +99,7 @@ static hw_status mmu_set_cam_entry(const void __iomem *base_address, | |||
124 | * INPUTS: | 99 | * INPUTS: |
125 | * | 100 | * |
126 | * Identifier : base_address | 101 | * Identifier : base_address |
127 | * Type : const u32 | 102 | * Type : void __iomem * |
128 | * Description : Base Address of instance of MMU module | 103 | * Description : Base Address of instance of MMU module |
129 | * | 104 | * |
130 | * Identifier : physical_addr | 105 | * Identifier : physical_addr |
@@ -157,7 +132,7 @@ static hw_status mmu_set_cam_entry(const void __iomem *base_address, | |||
157 | * | 132 | * |
158 | * METHOD: : Check the Input parameters and set the RAM entry. | 133 | * METHOD: : Check the Input parameters and set the RAM entry. |
159 | */ | 134 | */ |
160 | static hw_status mmu_set_ram_entry(const void __iomem *base_address, | 135 | static hw_status mmu_set_ram_entry(void __iomem *base_address, |
161 | const u32 physical_addr, | 136 | const u32 physical_addr, |
162 | enum hw_endianism_t endianism, | 137 | enum hw_endianism_t endianism, |
163 | enum hw_element_size_t element_size, | 138 | enum hw_element_size_t element_size, |
@@ -165,7 +140,7 @@ static hw_status mmu_set_ram_entry(const void __iomem *base_address, | |||
165 | 140 | ||
166 | /* HW FUNCTIONS */ | 141 | /* HW FUNCTIONS */ |
167 | 142 | ||
168 | hw_status hw_mmu_enable(const void __iomem *base_address) | 143 | hw_status hw_mmu_enable(void __iomem *base_address) |
169 | { | 144 | { |
170 | hw_status status = 0; | 145 | hw_status status = 0; |
171 | 146 | ||
@@ -174,7 +149,7 @@ hw_status hw_mmu_enable(const void __iomem *base_address) | |||
174 | return status; | 149 | return status; |
175 | } | 150 | } |
176 | 151 | ||
177 | hw_status hw_mmu_disable(const void __iomem *base_address) | 152 | hw_status hw_mmu_disable(void __iomem *base_address) |
178 | { | 153 | { |
179 | hw_status status = 0; | 154 | hw_status status = 0; |
180 | 155 | ||
@@ -183,7 +158,7 @@ hw_status hw_mmu_disable(const void __iomem *base_address) | |||
183 | return status; | 158 | return status; |
184 | } | 159 | } |
185 | 160 | ||
186 | hw_status hw_mmu_num_locked_set(const void __iomem *base_address, | 161 | hw_status hw_mmu_num_locked_set(void __iomem *base_address, |
187 | u32 num_locked_entries) | 162 | u32 num_locked_entries) |
188 | { | 163 | { |
189 | hw_status status = 0; | 164 | hw_status status = 0; |
@@ -193,7 +168,7 @@ hw_status hw_mmu_num_locked_set(const void __iomem *base_address, | |||
193 | return status; | 168 | return status; |
194 | } | 169 | } |
195 | 170 | ||
196 | hw_status hw_mmu_victim_num_set(const void __iomem *base_address, | 171 | hw_status hw_mmu_victim_num_set(void __iomem *base_address, |
197 | u32 victim_entry_num) | 172 | u32 victim_entry_num) |
198 | { | 173 | { |
199 | hw_status status = 0; | 174 | hw_status status = 0; |
@@ -203,7 +178,7 @@ hw_status hw_mmu_victim_num_set(const void __iomem *base_address, | |||
203 | return status; | 178 | return status; |
204 | } | 179 | } |
205 | 180 | ||
206 | hw_status hw_mmu_event_ack(const void __iomem *base_address, u32 irq_mask) | 181 | hw_status hw_mmu_event_ack(void __iomem *base_address, u32 irq_mask) |
207 | { | 182 | { |
208 | hw_status status = 0; | 183 | hw_status status = 0; |
209 | 184 | ||
@@ -212,7 +187,7 @@ hw_status hw_mmu_event_ack(const void __iomem *base_address, u32 irq_mask) | |||
212 | return status; | 187 | return status; |
213 | } | 188 | } |
214 | 189 | ||
215 | hw_status hw_mmu_event_disable(const void __iomem *base_address, u32 irq_mask) | 190 | hw_status hw_mmu_event_disable(void __iomem *base_address, u32 irq_mask) |
216 | { | 191 | { |
217 | hw_status status = 0; | 192 | hw_status status = 0; |
218 | u32 irq_reg; | 193 | u32 irq_reg; |
@@ -224,7 +199,7 @@ hw_status hw_mmu_event_disable(const void __iomem *base_address, u32 irq_mask) | |||
224 | return status; | 199 | return status; |
225 | } | 200 | } |
226 | 201 | ||
227 | hw_status hw_mmu_event_enable(const void __iomem *base_address, u32 irq_mask) | 202 | hw_status hw_mmu_event_enable(void __iomem *base_address, u32 irq_mask) |
228 | { | 203 | { |
229 | hw_status status = 0; | 204 | hw_status status = 0; |
230 | u32 irq_reg; | 205 | u32 irq_reg; |
@@ -236,7 +211,7 @@ hw_status hw_mmu_event_enable(const void __iomem *base_address, u32 irq_mask) | |||
236 | return status; | 211 | return status; |
237 | } | 212 | } |
238 | 213 | ||
239 | hw_status hw_mmu_event_status(const void __iomem *base_address, u32 *irq_mask) | 214 | hw_status hw_mmu_event_status(void __iomem *base_address, u32 *irq_mask) |
240 | { | 215 | { |
241 | hw_status status = 0; | 216 | hw_status status = 0; |
242 | 217 | ||
@@ -245,7 +220,7 @@ hw_status hw_mmu_event_status(const void __iomem *base_address, u32 *irq_mask) | |||
245 | return status; | 220 | return status; |
246 | } | 221 | } |
247 | 222 | ||
248 | hw_status hw_mmu_fault_addr_read(const void __iomem *base_address, u32 *addr) | 223 | hw_status hw_mmu_fault_addr_read(void __iomem *base_address, u32 *addr) |
249 | { | 224 | { |
250 | hw_status status = 0; | 225 | hw_status status = 0; |
251 | 226 | ||
@@ -255,7 +230,7 @@ hw_status hw_mmu_fault_addr_read(const void __iomem *base_address, u32 *addr) | |||
255 | return status; | 230 | return status; |
256 | } | 231 | } |
257 | 232 | ||
258 | hw_status hw_mmu_ttb_set(const void __iomem *base_address, u32 ttb_phys_addr) | 233 | hw_status hw_mmu_ttb_set(void __iomem *base_address, u32 ttb_phys_addr) |
259 | { | 234 | { |
260 | hw_status status = 0; | 235 | hw_status status = 0; |
261 | u32 load_ttb; | 236 | u32 load_ttb; |
@@ -267,7 +242,7 @@ hw_status hw_mmu_ttb_set(const void __iomem *base_address, u32 ttb_phys_addr) | |||
267 | return status; | 242 | return status; |
268 | } | 243 | } |
269 | 244 | ||
270 | hw_status hw_mmu_twl_enable(const void __iomem *base_address) | 245 | hw_status hw_mmu_twl_enable(void __iomem *base_address) |
271 | { | 246 | { |
272 | hw_status status = 0; | 247 | hw_status status = 0; |
273 | 248 | ||
@@ -276,7 +251,7 @@ hw_status hw_mmu_twl_enable(const void __iomem *base_address) | |||
276 | return status; | 251 | return status; |
277 | } | 252 | } |
278 | 253 | ||
279 | hw_status hw_mmu_twl_disable(const void __iomem *base_address) | 254 | hw_status hw_mmu_twl_disable(void __iomem *base_address) |
280 | { | 255 | { |
281 | hw_status status = 0; | 256 | hw_status status = 0; |
282 | 257 | ||
@@ -285,45 +260,7 @@ hw_status hw_mmu_twl_disable(const void __iomem *base_address) | |||
285 | return status; | 260 | return status; |
286 | } | 261 | } |
287 | 262 | ||
288 | hw_status hw_mmu_tlb_flush(const void __iomem *base_address, u32 virtual_addr, | 263 | hw_status hw_mmu_tlb_add(void __iomem *base_address, |
289 | u32 page_sz) | ||
290 | { | ||
291 | hw_status status = 0; | ||
292 | u32 virtual_addr_tag; | ||
293 | enum hw_mmu_page_size_t pg_size_bits; | ||
294 | |||
295 | switch (page_sz) { | ||
296 | case HW_PAGE_SIZE4KB: | ||
297 | pg_size_bits = HW_MMU_SMALL_PAGE; | ||
298 | break; | ||
299 | |||
300 | case HW_PAGE_SIZE64KB: | ||
301 | pg_size_bits = HW_MMU_LARGE_PAGE; | ||
302 | break; | ||
303 | |||
304 | case HW_PAGE_SIZE1MB: | ||
305 | pg_size_bits = HW_MMU_SECTION; | ||
306 | break; | ||
307 | |||
308 | case HW_PAGE_SIZE16MB: | ||
309 | pg_size_bits = HW_MMU_SUPERSECTION; | ||
310 | break; | ||
311 | |||
312 | default: | ||
313 | return -EINVAL; | ||
314 | } | ||
315 | |||
316 | /* Generate the 20-bit tag from virtual address */ | ||
317 | virtual_addr_tag = ((virtual_addr & MMU_ADDR_MASK) >> 12); | ||
318 | |||
319 | mmu_set_cam_entry(base_address, pg_size_bits, 0, 0, virtual_addr_tag); | ||
320 | |||
321 | mmu_flush_entry(base_address); | ||
322 | |||
323 | return status; | ||
324 | } | ||
325 | |||
326 | hw_status hw_mmu_tlb_add(const void __iomem *base_address, | ||
327 | u32 physical_addr, | 264 | u32 physical_addr, |
328 | u32 virtual_addr, | 265 | u32 virtual_addr, |
329 | u32 page_sz, | 266 | u32 page_sz, |
@@ -503,20 +440,8 @@ hw_status hw_mmu_pte_clear(const u32 pg_tbl_va, u32 virtual_addr, u32 page_size) | |||
503 | return status; | 440 | return status; |
504 | } | 441 | } |
505 | 442 | ||
506 | /* mmu_flush_entry */ | ||
507 | static hw_status mmu_flush_entry(const void __iomem *base_address) | ||
508 | { | ||
509 | hw_status status = 0; | ||
510 | u32 flush_entry_data = 0x1; | ||
511 | |||
512 | /* write values to register */ | ||
513 | MMUMMU_FLUSH_ENTRY_WRITE_REGISTER32(base_address, flush_entry_data); | ||
514 | |||
515 | return status; | ||
516 | } | ||
517 | |||
518 | /* mmu_set_cam_entry */ | 443 | /* mmu_set_cam_entry */ |
519 | static hw_status mmu_set_cam_entry(const void __iomem *base_address, | 444 | static hw_status mmu_set_cam_entry(void __iomem *base_address, |
520 | const u32 page_sz, | 445 | const u32 page_sz, |
521 | const u32 preserved_bit, | 446 | const u32 preserved_bit, |
522 | const u32 valid_bit, | 447 | const u32 valid_bit, |
@@ -536,7 +461,7 @@ static hw_status mmu_set_cam_entry(const void __iomem *base_address, | |||
536 | } | 461 | } |
537 | 462 | ||
538 | /* mmu_set_ram_entry */ | 463 | /* mmu_set_ram_entry */ |
539 | static hw_status mmu_set_ram_entry(const void __iomem *base_address, | 464 | static hw_status mmu_set_ram_entry(void __iomem *base_address, |
540 | const u32 physical_addr, | 465 | const u32 physical_addr, |
541 | enum hw_endianism_t endianism, | 466 | enum hw_endianism_t endianism, |
542 | enum hw_element_size_t element_size, | 467 | enum hw_element_size_t element_size, |
@@ -556,7 +481,7 @@ static hw_status mmu_set_ram_entry(const void __iomem *base_address, | |||
556 | 481 | ||
557 | } | 482 | } |
558 | 483 | ||
559 | void hw_mmu_tlb_flush_all(const void __iomem *base) | 484 | void hw_mmu_tlb_flush_all(void __iomem *base) |
560 | { | 485 | { |
561 | __raw_writel(1, base + MMU_GFLUSH); | 486 | __raw_writel(1, base + MMU_GFLUSH); |
562 | } | 487 | } |
diff --git a/drivers/staging/tidspbridge/hw/hw_mmu.h b/drivers/staging/tidspbridge/hw/hw_mmu.h index 1458a2c6027b..1c50bb36edfe 100644 --- a/drivers/staging/tidspbridge/hw/hw_mmu.h +++ b/drivers/staging/tidspbridge/hw/hw_mmu.h | |||
@@ -42,44 +42,41 @@ struct hw_mmu_map_attrs_t { | |||
42 | bool donotlockmpupage; | 42 | bool donotlockmpupage; |
43 | }; | 43 | }; |
44 | 44 | ||
45 | extern hw_status hw_mmu_enable(const void __iomem *base_address); | 45 | extern hw_status hw_mmu_enable(void __iomem *base_address); |
46 | 46 | ||
47 | extern hw_status hw_mmu_disable(const void __iomem *base_address); | 47 | extern hw_status hw_mmu_disable(void __iomem *base_address); |
48 | 48 | ||
49 | extern hw_status hw_mmu_num_locked_set(const void __iomem *base_address, | 49 | extern hw_status hw_mmu_num_locked_set(void __iomem *base_address, |
50 | u32 num_locked_entries); | 50 | u32 num_locked_entries); |
51 | 51 | ||
52 | extern hw_status hw_mmu_victim_num_set(const void __iomem *base_address, | 52 | extern hw_status hw_mmu_victim_num_set(void __iomem *base_address, |
53 | u32 victim_entry_num); | 53 | u32 victim_entry_num); |
54 | 54 | ||
55 | /* For MMU faults */ | 55 | /* For MMU faults */ |
56 | extern hw_status hw_mmu_event_ack(const void __iomem *base_address, | 56 | extern hw_status hw_mmu_event_ack(void __iomem *base_address, |
57 | u32 irq_mask); | 57 | u32 irq_mask); |
58 | 58 | ||
59 | extern hw_status hw_mmu_event_disable(const void __iomem *base_address, | 59 | extern hw_status hw_mmu_event_disable(void __iomem *base_address, |
60 | u32 irq_mask); | 60 | u32 irq_mask); |
61 | 61 | ||
62 | extern hw_status hw_mmu_event_enable(const void __iomem *base_address, | 62 | extern hw_status hw_mmu_event_enable(void __iomem *base_address, |
63 | u32 irq_mask); | 63 | u32 irq_mask); |
64 | 64 | ||
65 | extern hw_status hw_mmu_event_status(const void __iomem *base_address, | 65 | extern hw_status hw_mmu_event_status(void __iomem *base_address, |
66 | u32 *irq_mask); | 66 | u32 *irq_mask); |
67 | 67 | ||
68 | extern hw_status hw_mmu_fault_addr_read(const void __iomem *base_address, | 68 | extern hw_status hw_mmu_fault_addr_read(void __iomem *base_address, |
69 | u32 *addr); | 69 | u32 *addr); |
70 | 70 | ||
71 | /* Set the TT base address */ | 71 | /* Set the TT base address */ |
72 | extern hw_status hw_mmu_ttb_set(const void __iomem *base_address, | 72 | extern hw_status hw_mmu_ttb_set(void __iomem *base_address, |
73 | u32 ttb_phys_addr); | 73 | u32 ttb_phys_addr); |
74 | 74 | ||
75 | extern hw_status hw_mmu_twl_enable(const void __iomem *base_address); | 75 | extern hw_status hw_mmu_twl_enable(void __iomem *base_address); |
76 | 76 | ||
77 | extern hw_status hw_mmu_twl_disable(const void __iomem *base_address); | 77 | extern hw_status hw_mmu_twl_disable(void __iomem *base_address); |
78 | 78 | ||
79 | extern hw_status hw_mmu_tlb_flush(const void __iomem *base_address, | 79 | extern hw_status hw_mmu_tlb_add(void __iomem *base_address, |
80 | u32 virtual_addr, u32 page_sz); | ||
81 | |||
82 | extern hw_status hw_mmu_tlb_add(const void __iomem *base_address, | ||
83 | u32 physical_addr, | 80 | u32 physical_addr, |
84 | u32 virtual_addr, | 81 | u32 virtual_addr, |
85 | u32 page_sz, | 82 | u32 page_sz, |
@@ -97,7 +94,7 @@ extern hw_status hw_mmu_pte_set(const u32 pg_tbl_va, | |||
97 | extern hw_status hw_mmu_pte_clear(const u32 pg_tbl_va, | 94 | extern hw_status hw_mmu_pte_clear(const u32 pg_tbl_va, |
98 | u32 virtual_addr, u32 page_size); | 95 | u32 virtual_addr, u32 page_size); |
99 | 96 | ||
100 | void hw_mmu_tlb_flush_all(const void __iomem *base); | 97 | void hw_mmu_tlb_flush_all(void __iomem *base); |
101 | 98 | ||
102 | static inline u32 hw_mmu_pte_addr_l1(u32 l1_base, u32 va) | 99 | static inline u32 hw_mmu_pte_addr_l1(u32 l1_base, u32 va) |
103 | { | 100 | { |
diff --git a/drivers/staging/tidspbridge/include/dspbridge/cfgdefs.h b/drivers/staging/tidspbridge/include/dspbridge/cfgdefs.h index 60a278136bdf..b32c75673ab4 100644 --- a/drivers/staging/tidspbridge/include/dspbridge/cfgdefs.h +++ b/drivers/staging/tidspbridge/include/dspbridge/cfgdefs.h | |||
@@ -53,8 +53,8 @@ struct cfg_hostres { | |||
53 | u32 chnl_buf_size; | 53 | u32 chnl_buf_size; |
54 | u32 num_chnls; | 54 | u32 num_chnls; |
55 | void __iomem *per_base; | 55 | void __iomem *per_base; |
56 | u32 per_pm_base; | 56 | void __iomem *per_pm_base; |
57 | u32 core_pm_base; | 57 | void __iomem *core_pm_base; |
58 | void __iomem *dmmu_base; | 58 | void __iomem *dmmu_base; |
59 | }; | 59 | }; |
60 | 60 | ||
diff --git a/drivers/staging/tidspbridge/include/dspbridge/host_os.h b/drivers/staging/tidspbridge/include/dspbridge/host_os.h index 896f1579d5d7..7f3a1db31619 100644 --- a/drivers/staging/tidspbridge/include/dspbridge/host_os.h +++ b/drivers/staging/tidspbridge/include/dspbridge/host_os.h | |||
@@ -46,8 +46,8 @@ | |||
46 | #include <asm/cacheflush.h> | 46 | #include <asm/cacheflush.h> |
47 | #include <linux/dma-mapping.h> | 47 | #include <linux/dma-mapping.h> |
48 | 48 | ||
49 | /* TODO -- Remove, once BP defines them */ | 49 | /* TODO -- Remove, once omap-iommu is used */ |
50 | #define INT_DSP_MMU_IRQ 28 | 50 | #define INT_DSP_MMU_IRQ (28 + NR_IRQS) |
51 | 51 | ||
52 | #define PRCM_VDD1 1 | 52 | #define PRCM_VDD1 1 |
53 | 53 | ||
diff --git a/drivers/staging/tidspbridge/rmgr/drv.c b/drivers/staging/tidspbridge/rmgr/drv.c index 6795205b0155..db1da28cecba 100644 --- a/drivers/staging/tidspbridge/rmgr/drv.c +++ b/drivers/staging/tidspbridge/rmgr/drv.c | |||
@@ -667,10 +667,10 @@ int drv_request_bridge_res_dsp(void **phost_resources) | |||
667 | OMAP_DSP_MEM3_SIZE); | 667 | OMAP_DSP_MEM3_SIZE); |
668 | host_res->per_base = ioremap(OMAP_PER_CM_BASE, | 668 | host_res->per_base = ioremap(OMAP_PER_CM_BASE, |
669 | OMAP_PER_CM_SIZE); | 669 | OMAP_PER_CM_SIZE); |
670 | host_res->per_pm_base = (u32) ioremap(OMAP_PER_PRM_BASE, | 670 | host_res->per_pm_base = ioremap(OMAP_PER_PRM_BASE, |
671 | OMAP_PER_PRM_SIZE); | 671 | OMAP_PER_PRM_SIZE); |
672 | host_res->core_pm_base = (u32) ioremap(OMAP_CORE_PRM_BASE, | 672 | host_res->core_pm_base = ioremap(OMAP_CORE_PRM_BASE, |
673 | OMAP_CORE_PRM_SIZE); | 673 | OMAP_CORE_PRM_SIZE); |
674 | host_res->dmmu_base = ioremap(OMAP_DMMU_BASE, | 674 | host_res->dmmu_base = ioremap(OMAP_DMMU_BASE, |
675 | OMAP_DMMU_SIZE); | 675 | OMAP_DMMU_SIZE); |
676 | 676 | ||
diff --git a/drivers/staging/tidspbridge/rmgr/node.c b/drivers/staging/tidspbridge/rmgr/node.c index c2fc6137c770..294e9b40f516 100644 --- a/drivers/staging/tidspbridge/rmgr/node.c +++ b/drivers/staging/tidspbridge/rmgr/node.c | |||
@@ -304,8 +304,7 @@ int node_allocate(struct proc_object *hprocessor, | |||
304 | u32 pul_value; | 304 | u32 pul_value; |
305 | u32 dynext_base; | 305 | u32 dynext_base; |
306 | u32 off_set = 0; | 306 | u32 off_set = 0; |
307 | u32 ul_stack_seg_addr, ul_stack_seg_val; | 307 | u32 ul_stack_seg_val; |
308 | u32 ul_gpp_mem_base; | ||
309 | struct cfg_hostres *host_res; | 308 | struct cfg_hostres *host_res; |
310 | struct bridge_dev_context *pbridge_context; | 309 | struct bridge_dev_context *pbridge_context; |
311 | u32 mapped_addr = 0; | 310 | u32 mapped_addr = 0; |
@@ -581,6 +580,9 @@ func_cont: | |||
581 | if (strcmp((char *) | 580 | if (strcmp((char *) |
582 | pnode->dcd_props.obj_data.node_obj.ndb_props. | 581 | pnode->dcd_props.obj_data.node_obj.ndb_props. |
583 | stack_seg_name, STACKSEGLABEL) == 0) { | 582 | stack_seg_name, STACKSEGLABEL) == 0) { |
583 | void __iomem *stack_seg; | ||
584 | u32 stack_seg_pa; | ||
585 | |||
584 | status = | 586 | status = |
585 | hnode_mgr->nldr_fxns. | 587 | hnode_mgr->nldr_fxns. |
586 | get_fxn_addr(pnode->nldr_node_obj, "DYNEXT_BEG", | 588 | get_fxn_addr(pnode->nldr_node_obj, "DYNEXT_BEG", |
@@ -608,14 +610,21 @@ func_cont: | |||
608 | goto func_end; | 610 | goto func_end; |
609 | } | 611 | } |
610 | 612 | ||
611 | ul_gpp_mem_base = (u32) host_res->mem_base[1]; | ||
612 | off_set = pul_value - dynext_base; | 613 | off_set = pul_value - dynext_base; |
613 | ul_stack_seg_addr = ul_gpp_mem_base + off_set; | 614 | stack_seg_pa = host_res->mem_phys[1] + off_set; |
614 | ul_stack_seg_val = readl(ul_stack_seg_addr); | 615 | stack_seg = ioremap(stack_seg_pa, SZ_32); |
616 | if (!stack_seg) { | ||
617 | status = -ENOMEM; | ||
618 | goto func_end; | ||
619 | } | ||
620 | |||
621 | ul_stack_seg_val = readl(stack_seg); | ||
622 | |||
623 | iounmap(stack_seg); | ||
615 | 624 | ||
616 | dev_dbg(bridge, "%s: StackSegVal = 0x%x, StackSegAddr =" | 625 | dev_dbg(bridge, "%s: StackSegVal = 0x%x, StackSegAddr =" |
617 | " 0x%x\n", __func__, ul_stack_seg_val, | 626 | " 0x%x\n", __func__, ul_stack_seg_val, |
618 | ul_stack_seg_addr); | 627 | host_res->mem_base[1] + off_set); |
619 | 628 | ||
620 | pnode->create_args.asa.task_arg_obj.stack_seg = | 629 | pnode->create_args.asa.task_arg_obj.stack_seg = |
621 | ul_stack_seg_val; | 630 | ul_stack_seg_val; |
diff --git a/drivers/staging/zram/zram_drv.c b/drivers/staging/zram/zram_drv.c index 653b074035f7..6edefde23722 100644 --- a/drivers/staging/zram/zram_drv.c +++ b/drivers/staging/zram/zram_drv.c | |||
@@ -223,8 +223,13 @@ static int zram_bvec_read(struct zram *zram, struct bio_vec *bvec, | |||
223 | cmem = zs_map_object(zram->mem_pool, zram->table[index].handle, | 223 | cmem = zs_map_object(zram->mem_pool, zram->table[index].handle, |
224 | ZS_MM_RO); | 224 | ZS_MM_RO); |
225 | 225 | ||
226 | ret = lzo1x_decompress_safe(cmem, zram->table[index].size, | 226 | if (zram->table[index].size == PAGE_SIZE) { |
227 | memcpy(uncmem, cmem, PAGE_SIZE); | ||
228 | ret = LZO_E_OK; | ||
229 | } else { | ||
230 | ret = lzo1x_decompress_safe(cmem, zram->table[index].size, | ||
227 | uncmem, &clen); | 231 | uncmem, &clen); |
232 | } | ||
228 | 233 | ||
229 | if (is_partial_io(bvec)) { | 234 | if (is_partial_io(bvec)) { |
230 | memcpy(user_mem + bvec->bv_offset, uncmem + offset, | 235 | memcpy(user_mem + bvec->bv_offset, uncmem + offset, |
@@ -342,8 +347,11 @@ static int zram_bvec_write(struct zram *zram, struct bio_vec *bvec, u32 index, | |||
342 | goto out; | 347 | goto out; |
343 | } | 348 | } |
344 | 349 | ||
345 | if (unlikely(clen > max_zpage_size)) | 350 | if (unlikely(clen > max_zpage_size)) { |
346 | zram_stat_inc(&zram->stats.bad_compress); | 351 | zram_stat_inc(&zram->stats.bad_compress); |
352 | src = uncmem; | ||
353 | clen = PAGE_SIZE; | ||
354 | } | ||
347 | 355 | ||
348 | handle = zs_malloc(zram->mem_pool, clen); | 356 | handle = zs_malloc(zram->mem_pool, clen); |
349 | if (!handle) { | 357 | if (!handle) { |
diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c index d6ce2182e672..035c2c762537 100644 --- a/drivers/target/iscsi/iscsi_target.c +++ b/drivers/target/iscsi/iscsi_target.c | |||
@@ -3719,7 +3719,9 @@ restart: | |||
3719 | */ | 3719 | */ |
3720 | iscsit_thread_check_cpumask(conn, current, 1); | 3720 | iscsit_thread_check_cpumask(conn, current, 1); |
3721 | 3721 | ||
3722 | schedule_timeout_interruptible(MAX_SCHEDULE_TIMEOUT); | 3722 | wait_event_interruptible(conn->queues_wq, |
3723 | !iscsit_conn_all_queues_empty(conn) || | ||
3724 | ts->status == ISCSI_THREAD_SET_RESET); | ||
3723 | 3725 | ||
3724 | if ((ts->status == ISCSI_THREAD_SET_RESET) || | 3726 | if ((ts->status == ISCSI_THREAD_SET_RESET) || |
3725 | signal_pending(current)) | 3727 | signal_pending(current)) |
diff --git a/drivers/target/iscsi/iscsi_target_core.h b/drivers/target/iscsi/iscsi_target_core.h index 2ba9f9b9435c..21048dbf7d13 100644 --- a/drivers/target/iscsi/iscsi_target_core.h +++ b/drivers/target/iscsi/iscsi_target_core.h | |||
@@ -486,6 +486,7 @@ struct iscsi_tmr_req { | |||
486 | }; | 486 | }; |
487 | 487 | ||
488 | struct iscsi_conn { | 488 | struct iscsi_conn { |
489 | wait_queue_head_t queues_wq; | ||
489 | /* Authentication Successful for this connection */ | 490 | /* Authentication Successful for this connection */ |
490 | u8 auth_complete; | 491 | u8 auth_complete; |
491 | /* State connection is currently in */ | 492 | /* State connection is currently in */ |
diff --git a/drivers/target/iscsi/iscsi_target_login.c b/drivers/target/iscsi/iscsi_target_login.c index cdc8a10939c3..f8dbec05d5e5 100644 --- a/drivers/target/iscsi/iscsi_target_login.c +++ b/drivers/target/iscsi/iscsi_target_login.c | |||
@@ -41,6 +41,7 @@ | |||
41 | 41 | ||
42 | static int iscsi_login_init_conn(struct iscsi_conn *conn) | 42 | static int iscsi_login_init_conn(struct iscsi_conn *conn) |
43 | { | 43 | { |
44 | init_waitqueue_head(&conn->queues_wq); | ||
44 | INIT_LIST_HEAD(&conn->conn_list); | 45 | INIT_LIST_HEAD(&conn->conn_list); |
45 | INIT_LIST_HEAD(&conn->conn_cmd_list); | 46 | INIT_LIST_HEAD(&conn->conn_cmd_list); |
46 | INIT_LIST_HEAD(&conn->immed_queue_list); | 47 | INIT_LIST_HEAD(&conn->immed_queue_list); |
diff --git a/drivers/target/iscsi/iscsi_target_util.c b/drivers/target/iscsi/iscsi_target_util.c index afd98ccd40ae..1a91195ab619 100644 --- a/drivers/target/iscsi/iscsi_target_util.c +++ b/drivers/target/iscsi/iscsi_target_util.c | |||
@@ -488,7 +488,7 @@ void iscsit_add_cmd_to_immediate_queue( | |||
488 | atomic_set(&conn->check_immediate_queue, 1); | 488 | atomic_set(&conn->check_immediate_queue, 1); |
489 | spin_unlock_bh(&conn->immed_queue_lock); | 489 | spin_unlock_bh(&conn->immed_queue_lock); |
490 | 490 | ||
491 | wake_up_process(conn->thread_set->tx_thread); | 491 | wake_up(&conn->queues_wq); |
492 | } | 492 | } |
493 | 493 | ||
494 | struct iscsi_queue_req *iscsit_get_cmd_from_immediate_queue(struct iscsi_conn *conn) | 494 | struct iscsi_queue_req *iscsit_get_cmd_from_immediate_queue(struct iscsi_conn *conn) |
@@ -562,7 +562,7 @@ void iscsit_add_cmd_to_response_queue( | |||
562 | atomic_inc(&cmd->response_queue_count); | 562 | atomic_inc(&cmd->response_queue_count); |
563 | spin_unlock_bh(&conn->response_queue_lock); | 563 | spin_unlock_bh(&conn->response_queue_lock); |
564 | 564 | ||
565 | wake_up_process(conn->thread_set->tx_thread); | 565 | wake_up(&conn->queues_wq); |
566 | } | 566 | } |
567 | 567 | ||
568 | struct iscsi_queue_req *iscsit_get_cmd_from_response_queue(struct iscsi_conn *conn) | 568 | struct iscsi_queue_req *iscsit_get_cmd_from_response_queue(struct iscsi_conn *conn) |
@@ -616,6 +616,24 @@ static void iscsit_remove_cmd_from_response_queue( | |||
616 | } | 616 | } |
617 | } | 617 | } |
618 | 618 | ||
619 | bool iscsit_conn_all_queues_empty(struct iscsi_conn *conn) | ||
620 | { | ||
621 | bool empty; | ||
622 | |||
623 | spin_lock_bh(&conn->immed_queue_lock); | ||
624 | empty = list_empty(&conn->immed_queue_list); | ||
625 | spin_unlock_bh(&conn->immed_queue_lock); | ||
626 | |||
627 | if (!empty) | ||
628 | return empty; | ||
629 | |||
630 | spin_lock_bh(&conn->response_queue_lock); | ||
631 | empty = list_empty(&conn->response_queue_list); | ||
632 | spin_unlock_bh(&conn->response_queue_lock); | ||
633 | |||
634 | return empty; | ||
635 | } | ||
636 | |||
619 | void iscsit_free_queue_reqs_for_conn(struct iscsi_conn *conn) | 637 | void iscsit_free_queue_reqs_for_conn(struct iscsi_conn *conn) |
620 | { | 638 | { |
621 | struct iscsi_queue_req *qr, *qr_tmp; | 639 | struct iscsi_queue_req *qr, *qr_tmp; |
diff --git a/drivers/target/iscsi/iscsi_target_util.h b/drivers/target/iscsi/iscsi_target_util.h index 44054bd35437..894d0f837924 100644 --- a/drivers/target/iscsi/iscsi_target_util.h +++ b/drivers/target/iscsi/iscsi_target_util.h | |||
@@ -25,6 +25,7 @@ extern struct iscsi_queue_req *iscsit_get_cmd_from_immediate_queue(struct iscsi_ | |||
25 | extern void iscsit_add_cmd_to_response_queue(struct iscsi_cmd *, struct iscsi_conn *, u8); | 25 | extern void iscsit_add_cmd_to_response_queue(struct iscsi_cmd *, struct iscsi_conn *, u8); |
26 | extern struct iscsi_queue_req *iscsit_get_cmd_from_response_queue(struct iscsi_conn *); | 26 | extern struct iscsi_queue_req *iscsit_get_cmd_from_response_queue(struct iscsi_conn *); |
27 | extern void iscsit_remove_cmd_from_tx_queues(struct iscsi_cmd *, struct iscsi_conn *); | 27 | extern void iscsit_remove_cmd_from_tx_queues(struct iscsi_cmd *, struct iscsi_conn *); |
28 | extern bool iscsit_conn_all_queues_empty(struct iscsi_conn *); | ||
28 | extern void iscsit_free_queue_reqs_for_conn(struct iscsi_conn *); | 29 | extern void iscsit_free_queue_reqs_for_conn(struct iscsi_conn *); |
29 | extern void iscsit_release_cmd(struct iscsi_cmd *); | 30 | extern void iscsit_release_cmd(struct iscsi_cmd *); |
30 | extern void iscsit_free_cmd(struct iscsi_cmd *); | 31 | extern void iscsit_free_cmd(struct iscsi_cmd *); |
diff --git a/drivers/target/target_core_configfs.c b/drivers/target/target_core_configfs.c index 015f5be27bf6..c123327499a3 100644 --- a/drivers/target/target_core_configfs.c +++ b/drivers/target/target_core_configfs.c | |||
@@ -3206,7 +3206,8 @@ static int __init target_core_init_configfs(void) | |||
3206 | if (ret < 0) | 3206 | if (ret < 0) |
3207 | goto out; | 3207 | goto out; |
3208 | 3208 | ||
3209 | if (core_dev_setup_virtual_lun0() < 0) | 3209 | ret = core_dev_setup_virtual_lun0(); |
3210 | if (ret < 0) | ||
3210 | goto out; | 3211 | goto out; |
3211 | 3212 | ||
3212 | return 0; | 3213 | return 0; |
diff --git a/drivers/target/target_core_device.c b/drivers/target/target_core_device.c index 8d774da16320..9abef9f8eb76 100644 --- a/drivers/target/target_core_device.c +++ b/drivers/target/target_core_device.c | |||
@@ -850,20 +850,20 @@ int se_dev_check_shutdown(struct se_device *dev) | |||
850 | 850 | ||
851 | static u32 se_dev_align_max_sectors(u32 max_sectors, u32 block_size) | 851 | static u32 se_dev_align_max_sectors(u32 max_sectors, u32 block_size) |
852 | { | 852 | { |
853 | u32 tmp, aligned_max_sectors; | 853 | u32 aligned_max_sectors; |
854 | u32 alignment; | ||
854 | /* | 855 | /* |
855 | * Limit max_sectors to a PAGE_SIZE aligned value for modern | 856 | * Limit max_sectors to a PAGE_SIZE aligned value for modern |
856 | * transport_allocate_data_tasks() operation. | 857 | * transport_allocate_data_tasks() operation. |
857 | */ | 858 | */ |
858 | tmp = rounddown((max_sectors * block_size), PAGE_SIZE); | 859 | alignment = max(1ul, PAGE_SIZE / block_size); |
859 | aligned_max_sectors = (tmp / block_size); | 860 | aligned_max_sectors = rounddown(max_sectors, alignment); |
860 | if (max_sectors != aligned_max_sectors) { | 861 | |
861 | printk(KERN_INFO "Rounding down aligned max_sectors from %u" | 862 | if (max_sectors != aligned_max_sectors) |
862 | " to %u\n", max_sectors, aligned_max_sectors); | 863 | pr_info("Rounding down aligned max_sectors from %u to %u\n", |
863 | return aligned_max_sectors; | 864 | max_sectors, aligned_max_sectors); |
864 | } | ||
865 | 865 | ||
866 | return max_sectors; | 866 | return aligned_max_sectors; |
867 | } | 867 | } |
868 | 868 | ||
869 | void se_dev_set_default_attribs( | 869 | void se_dev_set_default_attribs( |
diff --git a/drivers/target/target_core_sbc.c b/drivers/target/target_core_sbc.c index 868f8aa04f13..a6e27d967c7b 100644 --- a/drivers/target/target_core_sbc.c +++ b/drivers/target/target_core_sbc.c | |||
@@ -135,6 +135,12 @@ static int sbc_emulate_verify(struct se_cmd *cmd) | |||
135 | return 0; | 135 | return 0; |
136 | } | 136 | } |
137 | 137 | ||
138 | static int sbc_emulate_noop(struct se_cmd *cmd) | ||
139 | { | ||
140 | target_complete_cmd(cmd, GOOD); | ||
141 | return 0; | ||
142 | } | ||
143 | |||
138 | static inline u32 sbc_get_size(struct se_cmd *cmd, u32 sectors) | 144 | static inline u32 sbc_get_size(struct se_cmd *cmd, u32 sectors) |
139 | { | 145 | { |
140 | return cmd->se_dev->se_sub_dev->se_dev_attrib.block_size * sectors; | 146 | return cmd->se_dev->se_sub_dev->se_dev_attrib.block_size * sectors; |
@@ -531,6 +537,18 @@ int sbc_parse_cdb(struct se_cmd *cmd, struct spc_ops *ops) | |||
531 | size = 0; | 537 | size = 0; |
532 | cmd->execute_cmd = sbc_emulate_verify; | 538 | cmd->execute_cmd = sbc_emulate_verify; |
533 | break; | 539 | break; |
540 | case REZERO_UNIT: | ||
541 | case SEEK_6: | ||
542 | case SEEK_10: | ||
543 | /* | ||
544 | * There are still clients out there which use these old SCSI-2 | ||
545 | * commands. This mainly happens when running VMs with legacy | ||
546 | * guest systems, connected via SCSI command pass-through to | ||
547 | * iSCSI targets. Make them happy and return status GOOD. | ||
548 | */ | ||
549 | size = 0; | ||
550 | cmd->execute_cmd = sbc_emulate_noop; | ||
551 | break; | ||
534 | default: | 552 | default: |
535 | ret = spc_parse_cdb(cmd, &size); | 553 | ret = spc_parse_cdb(cmd, &size); |
536 | if (ret) | 554 | if (ret) |
diff --git a/drivers/target/target_core_spc.c b/drivers/target/target_core_spc.c index 9229bd9ad61b..6fd434d3d7e4 100644 --- a/drivers/target/target_core_spc.c +++ b/drivers/target/target_core_spc.c | |||
@@ -605,6 +605,8 @@ static int spc_emulate_inquiry(struct se_cmd *cmd) | |||
605 | unsigned char buf[SE_INQUIRY_BUF]; | 605 | unsigned char buf[SE_INQUIRY_BUF]; |
606 | int p, ret; | 606 | int p, ret; |
607 | 607 | ||
608 | memset(buf, 0, SE_INQUIRY_BUF); | ||
609 | |||
608 | if (dev == tpg->tpg_virt_lun0.lun_se_dev) | 610 | if (dev == tpg->tpg_virt_lun0.lun_se_dev) |
609 | buf[0] = 0x3f; /* Not connected */ | 611 | buf[0] = 0x3f; /* Not connected */ |
610 | else | 612 | else |
diff --git a/drivers/target/target_core_tmr.c b/drivers/target/target_core_tmr.c index 1c59a3c23b2c..be75c4331a92 100644 --- a/drivers/target/target_core_tmr.c +++ b/drivers/target/target_core_tmr.c | |||
@@ -140,15 +140,15 @@ void core_tmr_abort_task( | |||
140 | printk("ABORT_TASK: Found referenced %s task_tag: %u\n", | 140 | printk("ABORT_TASK: Found referenced %s task_tag: %u\n", |
141 | se_cmd->se_tfo->get_fabric_name(), ref_tag); | 141 | se_cmd->se_tfo->get_fabric_name(), ref_tag); |
142 | 142 | ||
143 | spin_lock_irq(&se_cmd->t_state_lock); | 143 | spin_lock(&se_cmd->t_state_lock); |
144 | if (se_cmd->transport_state & CMD_T_COMPLETE) { | 144 | if (se_cmd->transport_state & CMD_T_COMPLETE) { |
145 | printk("ABORT_TASK: ref_tag: %u already complete, skipping\n", ref_tag); | 145 | printk("ABORT_TASK: ref_tag: %u already complete, skipping\n", ref_tag); |
146 | spin_unlock_irq(&se_cmd->t_state_lock); | 146 | spin_unlock(&se_cmd->t_state_lock); |
147 | spin_unlock_irqrestore(&se_sess->sess_cmd_lock, flags); | 147 | spin_unlock_irqrestore(&se_sess->sess_cmd_lock, flags); |
148 | goto out; | 148 | goto out; |
149 | } | 149 | } |
150 | se_cmd->transport_state |= CMD_T_ABORTED; | 150 | se_cmd->transport_state |= CMD_T_ABORTED; |
151 | spin_unlock_irq(&se_cmd->t_state_lock); | 151 | spin_unlock(&se_cmd->t_state_lock); |
152 | 152 | ||
153 | list_del_init(&se_cmd->se_cmd_list); | 153 | list_del_init(&se_cmd->se_cmd_list); |
154 | kref_get(&se_cmd->cmd_kref); | 154 | kref_get(&se_cmd->cmd_kref); |
diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c index c33baff86aa6..9097155e9ebe 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c | |||
@@ -1616,7 +1616,6 @@ static void target_complete_tmr_failure(struct work_struct *work) | |||
1616 | 1616 | ||
1617 | se_cmd->se_tmr_req->response = TMR_LUN_DOES_NOT_EXIST; | 1617 | se_cmd->se_tmr_req->response = TMR_LUN_DOES_NOT_EXIST; |
1618 | se_cmd->se_tfo->queue_tm_rsp(se_cmd); | 1618 | se_cmd->se_tfo->queue_tm_rsp(se_cmd); |
1619 | transport_generic_free_cmd(se_cmd, 0); | ||
1620 | } | 1619 | } |
1621 | 1620 | ||
1622 | /** | 1621 | /** |
diff --git a/drivers/thermal/exynos_thermal.c b/drivers/thermal/exynos_thermal.c index fd03e8581afc..6dd29e4ce36b 100644 --- a/drivers/thermal/exynos_thermal.c +++ b/drivers/thermal/exynos_thermal.c | |||
@@ -815,7 +815,7 @@ static struct platform_device_id exynos_tmu_driver_ids[] = { | |||
815 | }, | 815 | }, |
816 | { }, | 816 | { }, |
817 | }; | 817 | }; |
818 | MODULE_DEVICE_TABLE(platform, exynos4_tmu_driver_ids); | 818 | MODULE_DEVICE_TABLE(platform, exynos_tmu_driver_ids); |
819 | 819 | ||
820 | static inline struct exynos_tmu_platform_data *exynos_get_driver_data( | 820 | static inline struct exynos_tmu_platform_data *exynos_get_driver_data( |
821 | struct platform_device *pdev) | 821 | struct platform_device *pdev) |
diff --git a/drivers/thermal/rcar_thermal.c b/drivers/thermal/rcar_thermal.c index d4452716aaab..f7a1b574a304 100644 --- a/drivers/thermal/rcar_thermal.c +++ b/drivers/thermal/rcar_thermal.c | |||
@@ -210,7 +210,7 @@ static int rcar_thermal_probe(struct platform_device *pdev) | |||
210 | goto error_free_priv; | 210 | goto error_free_priv; |
211 | } | 211 | } |
212 | 212 | ||
213 | zone = thermal_zone_device_register("rcar_thermal", 0, priv, | 213 | zone = thermal_zone_device_register("rcar_thermal", 0, 0, priv, |
214 | &rcar_thermal_zone_ops, 0, 0); | 214 | &rcar_thermal_zone_ops, 0, 0); |
215 | if (IS_ERR(zone)) { | 215 | if (IS_ERR(zone)) { |
216 | dev_err(&pdev->dev, "thermal zone device is NULL\n"); | 216 | dev_err(&pdev->dev, "thermal zone device is NULL\n"); |
diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c index 6ede6fd92b4c..6d3d26a607b9 100644 --- a/drivers/tty/serial/omap-serial.c +++ b/drivers/tty/serial/omap-serial.c | |||
@@ -671,19 +671,19 @@ serial_omap_configure_xonxoff | |||
671 | 671 | ||
672 | /* | 672 | /* |
673 | * IXON Flag: | 673 | * IXON Flag: |
674 | * Flow control for OMAP.TX | 674 | * Enable XON/XOFF flow control on output. |
675 | * OMAP.RX should listen for XON/XOFF | 675 | * Transmit XON1, XOFF1 |
676 | */ | 676 | */ |
677 | if (termios->c_iflag & IXON) | 677 | if (termios->c_iflag & IXON) |
678 | up->efr |= OMAP_UART_SW_RX; | 678 | up->efr |= OMAP_UART_SW_TX; |
679 | 679 | ||
680 | /* | 680 | /* |
681 | * IXOFF Flag: | 681 | * IXOFF Flag: |
682 | * Flow control for OMAP.RX | 682 | * Enable XON/XOFF flow control on input. |
683 | * OMAP.TX should send XON/XOFF | 683 | * Receiver compares XON1, XOFF1. |
684 | */ | 684 | */ |
685 | if (termios->c_iflag & IXOFF) | 685 | if (termios->c_iflag & IXOFF) |
686 | up->efr |= OMAP_UART_SW_TX; | 686 | up->efr |= OMAP_UART_SW_RX; |
687 | 687 | ||
688 | serial_out(up, UART_EFR, up->efr | UART_EFR_ECB); | 688 | serial_out(up, UART_EFR, up->efr | UART_EFR_ECB); |
689 | serial_out(up, UART_LCR, UART_LCR_CONF_MODE_A); | 689 | serial_out(up, UART_LCR, UART_LCR_CONF_MODE_A); |
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 64854d76f529..1af04bdeaf0c 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c | |||
@@ -739,13 +739,16 @@ static void hub_tt_work(struct work_struct *work) | |||
739 | int limit = 100; | 739 | int limit = 100; |
740 | 740 | ||
741 | spin_lock_irqsave (&hub->tt.lock, flags); | 741 | spin_lock_irqsave (&hub->tt.lock, flags); |
742 | while (--limit && !list_empty (&hub->tt.clear_list)) { | 742 | while (!list_empty(&hub->tt.clear_list)) { |
743 | struct list_head *next; | 743 | struct list_head *next; |
744 | struct usb_tt_clear *clear; | 744 | struct usb_tt_clear *clear; |
745 | struct usb_device *hdev = hub->hdev; | 745 | struct usb_device *hdev = hub->hdev; |
746 | const struct hc_driver *drv; | 746 | const struct hc_driver *drv; |
747 | int status; | 747 | int status; |
748 | 748 | ||
749 | if (!hub->quiescing && --limit < 0) | ||
750 | break; | ||
751 | |||
749 | next = hub->tt.clear_list.next; | 752 | next = hub->tt.clear_list.next; |
750 | clear = list_entry (next, struct usb_tt_clear, clear_list); | 753 | clear = list_entry (next, struct usb_tt_clear, clear_list); |
751 | list_del (&clear->clear_list); | 754 | list_del (&clear->clear_list); |
@@ -1210,7 +1213,7 @@ static void hub_quiesce(struct usb_hub *hub, enum hub_quiescing_type type) | |||
1210 | if (hub->has_indicators) | 1213 | if (hub->has_indicators) |
1211 | cancel_delayed_work_sync(&hub->leds); | 1214 | cancel_delayed_work_sync(&hub->leds); |
1212 | if (hub->tt.hub) | 1215 | if (hub->tt.hub) |
1213 | cancel_work_sync(&hub->tt.clear_work); | 1216 | flush_work(&hub->tt.clear_work); |
1214 | } | 1217 | } |
1215 | 1218 | ||
1216 | /* caller has locked the hub device */ | 1219 | /* caller has locked the hub device */ |
diff --git a/drivers/usb/gadget/net2272.c b/drivers/usb/gadget/net2272.c index 43ac7482fa91..c009263a47e3 100644 --- a/drivers/usb/gadget/net2272.c +++ b/drivers/usb/gadget/net2272.c | |||
@@ -2069,8 +2069,10 @@ static irqreturn_t net2272_irq(int irq, void *_dev) | |||
2069 | #if defined(PLX_PCI_RDK2) | 2069 | #if defined(PLX_PCI_RDK2) |
2070 | /* see if PCI int for us by checking irqstat */ | 2070 | /* see if PCI int for us by checking irqstat */ |
2071 | intcsr = readl(dev->rdk2.fpga_base_addr + RDK2_IRQSTAT); | 2071 | intcsr = readl(dev->rdk2.fpga_base_addr + RDK2_IRQSTAT); |
2072 | if (!intcsr & (1 << NET2272_PCI_IRQ)) | 2072 | if (!intcsr & (1 << NET2272_PCI_IRQ)) { |
2073 | spin_unlock(&dev->lock); | ||
2073 | return IRQ_NONE; | 2074 | return IRQ_NONE; |
2075 | } | ||
2074 | /* check dma interrupts */ | 2076 | /* check dma interrupts */ |
2075 | #endif | 2077 | #endif |
2076 | /* Platform/devcice interrupt handler */ | 2078 | /* Platform/devcice interrupt handler */ |
diff --git a/drivers/usb/host/pci-quirks.c b/drivers/usb/host/pci-quirks.c index 966d1484ee79..39f9e4a9a2d3 100644 --- a/drivers/usb/host/pci-quirks.c +++ b/drivers/usb/host/pci-quirks.c | |||
@@ -545,7 +545,14 @@ static const struct dmi_system_id __devinitconst ehci_dmi_nohandoff_table[] = { | |||
545 | /* Pegatron Lucid (Ordissimo AIRIS) */ | 545 | /* Pegatron Lucid (Ordissimo AIRIS) */ |
546 | .matches = { | 546 | .matches = { |
547 | DMI_MATCH(DMI_BOARD_NAME, "M11JB"), | 547 | DMI_MATCH(DMI_BOARD_NAME, "M11JB"), |
548 | DMI_MATCH(DMI_BIOS_VERSION, "Lucid-GE-133"), | 548 | DMI_MATCH(DMI_BIOS_VERSION, "Lucid-"), |
549 | }, | ||
550 | }, | ||
551 | { | ||
552 | /* Pegatron Lucid (Ordissimo) */ | ||
553 | .matches = { | ||
554 | DMI_MATCH(DMI_BOARD_NAME, "Ordissimo"), | ||
555 | DMI_MATCH(DMI_BIOS_VERSION, "Lucid-"), | ||
549 | }, | 556 | }, |
550 | }, | 557 | }, |
551 | { } | 558 | { } |
diff --git a/drivers/usb/host/xhci-dbg.c b/drivers/usb/host/xhci-dbg.c index 4b436f5a4171..5f3a7c74aa8d 100644 --- a/drivers/usb/host/xhci-dbg.c +++ b/drivers/usb/host/xhci-dbg.c | |||
@@ -544,7 +544,6 @@ void xhci_dbg_ctx(struct xhci_hcd *xhci, | |||
544 | int i; | 544 | int i; |
545 | /* Fields are 32 bits wide, DMA addresses are in bytes */ | 545 | /* Fields are 32 bits wide, DMA addresses are in bytes */ |
546 | int field_size = 32 / 8; | 546 | int field_size = 32 / 8; |
547 | struct xhci_slot_ctx *slot_ctx; | ||
548 | dma_addr_t dma = ctx->dma; | 547 | dma_addr_t dma = ctx->dma; |
549 | int csz = HCC_64BYTE_CONTEXT(xhci->hcc_params); | 548 | int csz = HCC_64BYTE_CONTEXT(xhci->hcc_params); |
550 | 549 | ||
@@ -570,7 +569,6 @@ void xhci_dbg_ctx(struct xhci_hcd *xhci, | |||
570 | dbg_rsvd64(xhci, (u64 *)ctrl_ctx, dma); | 569 | dbg_rsvd64(xhci, (u64 *)ctrl_ctx, dma); |
571 | } | 570 | } |
572 | 571 | ||
573 | slot_ctx = xhci_get_slot_ctx(xhci, ctx); | ||
574 | xhci_dbg_slot_ctx(xhci, ctx); | 572 | xhci_dbg_slot_ctx(xhci, ctx); |
575 | xhci_dbg_ep_ctx(xhci, ctx, last_ep); | 573 | xhci_dbg_ep_ctx(xhci, ctx, last_ep); |
576 | } | 574 | } |
diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c index aa90ad4d4fd5..a686cf4905bb 100644 --- a/drivers/usb/host/xhci-hub.c +++ b/drivers/usb/host/xhci-hub.c | |||
@@ -151,9 +151,8 @@ static void xhci_usb3_hub_descriptor(struct usb_hcd *hcd, struct xhci_hcd *xhci, | |||
151 | if (portsc & PORT_DEV_REMOVE) | 151 | if (portsc & PORT_DEV_REMOVE) |
152 | port_removable |= 1 << (i + 1); | 152 | port_removable |= 1 << (i + 1); |
153 | } | 153 | } |
154 | memset(&desc->u.ss.DeviceRemovable, | 154 | |
155 | (__force __u16) cpu_to_le16(port_removable), | 155 | desc->u.ss.DeviceRemovable = cpu_to_le16(port_removable); |
156 | sizeof(__u16)); | ||
157 | } | 156 | } |
158 | 157 | ||
159 | static void xhci_hub_descriptor(struct usb_hcd *hcd, struct xhci_hcd *xhci, | 158 | static void xhci_hub_descriptor(struct usb_hcd *hcd, struct xhci_hcd *xhci, |
@@ -809,11 +808,13 @@ int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, | |||
809 | temp = xhci_readl(xhci, port_array[wIndex]); | 808 | temp = xhci_readl(xhci, port_array[wIndex]); |
810 | xhci_dbg(xhci, "set port power, actual port %d status = 0x%x\n", wIndex, temp); | 809 | xhci_dbg(xhci, "set port power, actual port %d status = 0x%x\n", wIndex, temp); |
811 | 810 | ||
811 | spin_unlock_irqrestore(&xhci->lock, flags); | ||
812 | temp = usb_acpi_power_manageable(hcd->self.root_hub, | 812 | temp = usb_acpi_power_manageable(hcd->self.root_hub, |
813 | wIndex); | 813 | wIndex); |
814 | if (temp) | 814 | if (temp) |
815 | usb_acpi_set_power_state(hcd->self.root_hub, | 815 | usb_acpi_set_power_state(hcd->self.root_hub, |
816 | wIndex, true); | 816 | wIndex, true); |
817 | spin_lock_irqsave(&xhci->lock, flags); | ||
817 | break; | 818 | break; |
818 | case USB_PORT_FEAT_RESET: | 819 | case USB_PORT_FEAT_RESET: |
819 | temp = (temp | PORT_RESET); | 820 | temp = (temp | PORT_RESET); |
@@ -917,11 +918,13 @@ int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, | |||
917 | xhci_writel(xhci, temp & ~PORT_POWER, | 918 | xhci_writel(xhci, temp & ~PORT_POWER, |
918 | port_array[wIndex]); | 919 | port_array[wIndex]); |
919 | 920 | ||
921 | spin_unlock_irqrestore(&xhci->lock, flags); | ||
920 | temp = usb_acpi_power_manageable(hcd->self.root_hub, | 922 | temp = usb_acpi_power_manageable(hcd->self.root_hub, |
921 | wIndex); | 923 | wIndex); |
922 | if (temp) | 924 | if (temp) |
923 | usb_acpi_set_power_state(hcd->self.root_hub, | 925 | usb_acpi_set_power_state(hcd->self.root_hub, |
924 | wIndex, false); | 926 | wIndex, false); |
927 | spin_lock_irqsave(&xhci->lock, flags); | ||
925 | break; | 928 | break; |
926 | default: | 929 | default: |
927 | goto error; | 930 | goto error; |
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index c6ebb176dc4f..4e1a8946b8d1 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c | |||
@@ -1228,6 +1228,17 @@ static void xhci_cmd_to_noop(struct xhci_hcd *xhci, struct xhci_cd *cur_cd) | |||
1228 | cur_seg = find_trb_seg(xhci->cmd_ring->first_seg, | 1228 | cur_seg = find_trb_seg(xhci->cmd_ring->first_seg, |
1229 | xhci->cmd_ring->dequeue, &cycle_state); | 1229 | xhci->cmd_ring->dequeue, &cycle_state); |
1230 | 1230 | ||
1231 | if (!cur_seg) { | ||
1232 | xhci_warn(xhci, "Command ring mismatch, dequeue = %p %llx (dma)\n", | ||
1233 | xhci->cmd_ring->dequeue, | ||
1234 | (unsigned long long) | ||
1235 | xhci_trb_virt_to_dma(xhci->cmd_ring->deq_seg, | ||
1236 | xhci->cmd_ring->dequeue)); | ||
1237 | xhci_debug_ring(xhci, xhci->cmd_ring); | ||
1238 | xhci_dbg_ring_ptrs(xhci, xhci->cmd_ring); | ||
1239 | return; | ||
1240 | } | ||
1241 | |||
1231 | /* find the command trb matched by cd from command ring */ | 1242 | /* find the command trb matched by cd from command ring */ |
1232 | for (cmd_trb = xhci->cmd_ring->dequeue; | 1243 | for (cmd_trb = xhci->cmd_ring->dequeue; |
1233 | cmd_trb != xhci->cmd_ring->enqueue; | 1244 | cmd_trb != xhci->cmd_ring->enqueue; |
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index 7d462bf20092..c9e419f29b74 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c | |||
@@ -1627,7 +1627,6 @@ int xhci_add_endpoint(struct usb_hcd *hcd, struct usb_device *udev, | |||
1627 | struct xhci_hcd *xhci; | 1627 | struct xhci_hcd *xhci; |
1628 | struct xhci_container_ctx *in_ctx, *out_ctx; | 1628 | struct xhci_container_ctx *in_ctx, *out_ctx; |
1629 | unsigned int ep_index; | 1629 | unsigned int ep_index; |
1630 | struct xhci_ep_ctx *ep_ctx; | ||
1631 | struct xhci_slot_ctx *slot_ctx; | 1630 | struct xhci_slot_ctx *slot_ctx; |
1632 | struct xhci_input_control_ctx *ctrl_ctx; | 1631 | struct xhci_input_control_ctx *ctrl_ctx; |
1633 | u32 added_ctxs; | 1632 | u32 added_ctxs; |
@@ -1663,7 +1662,6 @@ int xhci_add_endpoint(struct usb_hcd *hcd, struct usb_device *udev, | |||
1663 | out_ctx = virt_dev->out_ctx; | 1662 | out_ctx = virt_dev->out_ctx; |
1664 | ctrl_ctx = xhci_get_input_control_ctx(xhci, in_ctx); | 1663 | ctrl_ctx = xhci_get_input_control_ctx(xhci, in_ctx); |
1665 | ep_index = xhci_get_endpoint_index(&ep->desc); | 1664 | ep_index = xhci_get_endpoint_index(&ep->desc); |
1666 | ep_ctx = xhci_get_ep_ctx(xhci, out_ctx, ep_index); | ||
1667 | 1665 | ||
1668 | /* If this endpoint is already in use, and the upper layers are trying | 1666 | /* If this endpoint is already in use, and the upper layers are trying |
1669 | * to add it again without dropping it, reject the addition. | 1667 | * to add it again without dropping it, reject the addition. |
@@ -1817,6 +1815,8 @@ static int xhci_evaluate_context_result(struct xhci_hcd *xhci, | |||
1817 | case COMP_EBADSLT: | 1815 | case COMP_EBADSLT: |
1818 | dev_warn(&udev->dev, "WARN: slot not enabled for" | 1816 | dev_warn(&udev->dev, "WARN: slot not enabled for" |
1819 | "evaluate context command.\n"); | 1817 | "evaluate context command.\n"); |
1818 | ret = -EINVAL; | ||
1819 | break; | ||
1820 | case COMP_CTX_STATE: | 1820 | case COMP_CTX_STATE: |
1821 | dev_warn(&udev->dev, "WARN: invalid context state for " | 1821 | dev_warn(&udev->dev, "WARN: invalid context state for " |
1822 | "evaluate context command.\n"); | 1822 | "evaluate context command.\n"); |
@@ -4021,7 +4021,7 @@ int xhci_update_device(struct usb_hcd *hcd, struct usb_device *udev) | |||
4021 | static unsigned long long xhci_service_interval_to_ns( | 4021 | static unsigned long long xhci_service_interval_to_ns( |
4022 | struct usb_endpoint_descriptor *desc) | 4022 | struct usb_endpoint_descriptor *desc) |
4023 | { | 4023 | { |
4024 | return (1 << (desc->bInterval - 1)) * 125 * 1000; | 4024 | return (1ULL << (desc->bInterval - 1)) * 125 * 1000; |
4025 | } | 4025 | } |
4026 | 4026 | ||
4027 | static u16 xhci_get_timeout_no_hub_lpm(struct usb_device *udev, | 4027 | static u16 xhci_get_timeout_no_hub_lpm(struct usb_device *udev, |
@@ -4142,7 +4142,7 @@ static u16 xhci_calculate_intel_u2_timeout(struct usb_device *udev, | |||
4142 | (xhci_service_interval_to_ns(desc) > timeout_ns)) | 4142 | (xhci_service_interval_to_ns(desc) > timeout_ns)) |
4143 | timeout_ns = xhci_service_interval_to_ns(desc); | 4143 | timeout_ns = xhci_service_interval_to_ns(desc); |
4144 | 4144 | ||
4145 | u2_del_ns = udev->bos->ss_cap->bU2DevExitLat * 1000; | 4145 | u2_del_ns = le16_to_cpu(udev->bos->ss_cap->bU2DevExitLat) * 1000ULL; |
4146 | if (u2_del_ns > timeout_ns) | 4146 | if (u2_del_ns > timeout_ns) |
4147 | timeout_ns = u2_del_ns; | 4147 | timeout_ns = u2_del_ns; |
4148 | 4148 | ||
diff --git a/drivers/usb/misc/ezusb.c b/drivers/usb/misc/ezusb.c index 4223d761223d..6589268a6515 100644 --- a/drivers/usb/misc/ezusb.c +++ b/drivers/usb/misc/ezusb.c | |||
@@ -158,3 +158,4 @@ int ezusb_fx2_ihex_firmware_download(struct usb_device *dev, | |||
158 | } | 158 | } |
159 | EXPORT_SYMBOL_GPL(ezusb_fx2_ihex_firmware_download); | 159 | EXPORT_SYMBOL_GPL(ezusb_fx2_ihex_firmware_download); |
160 | 160 | ||
161 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c index a67af21c1460..aa34f22181c1 100644 --- a/drivers/usb/musb/musb_dsps.c +++ b/drivers/usb/musb/musb_dsps.c | |||
@@ -457,11 +457,11 @@ static int __devinit dsps_create_musb_pdev(struct dsps_glue *glue, u8 id) | |||
457 | struct platform_device *musb; | 457 | struct platform_device *musb; |
458 | struct resource *res; | 458 | struct resource *res; |
459 | struct resource resources[2]; | 459 | struct resource resources[2]; |
460 | char res_name[10]; | 460 | char res_name[11]; |
461 | int ret, musbid; | 461 | int ret, musbid; |
462 | 462 | ||
463 | /* get memory resource */ | 463 | /* get memory resource */ |
464 | sprintf(res_name, "musb%d", id); | 464 | snprintf(res_name, sizeof(res_name), "musb%d", id); |
465 | res = platform_get_resource_byname(pdev, IORESOURCE_MEM, res_name); | 465 | res = platform_get_resource_byname(pdev, IORESOURCE_MEM, res_name); |
466 | if (!res) { | 466 | if (!res) { |
467 | dev_err(dev, "%s get mem resource failed\n", res_name); | 467 | dev_err(dev, "%s get mem resource failed\n", res_name); |
@@ -472,7 +472,7 @@ static int __devinit dsps_create_musb_pdev(struct dsps_glue *glue, u8 id) | |||
472 | resources[0] = *res; | 472 | resources[0] = *res; |
473 | 473 | ||
474 | /* get irq resource */ | 474 | /* get irq resource */ |
475 | sprintf(res_name, "musb%d-irq", id); | 475 | snprintf(res_name, sizeof(res_name), "musb%d-irq", id); |
476 | res = platform_get_resource_byname(pdev, IORESOURCE_IRQ, res_name); | 476 | res = platform_get_resource_byname(pdev, IORESOURCE_IRQ, res_name); |
477 | if (!res) { | 477 | if (!res) { |
478 | dev_err(dev, "%s get irq resource failed\n", res_name); | 478 | dev_err(dev, "%s get irq resource failed\n", res_name); |
@@ -529,7 +529,7 @@ static int __devinit dsps_create_musb_pdev(struct dsps_glue *glue, u8 id) | |||
529 | 529 | ||
530 | of_property_read_u32(np, "num-eps", (u32 *)&config->num_eps); | 530 | of_property_read_u32(np, "num-eps", (u32 *)&config->num_eps); |
531 | of_property_read_u32(np, "ram-bits", (u32 *)&config->ram_bits); | 531 | of_property_read_u32(np, "ram-bits", (u32 *)&config->ram_bits); |
532 | sprintf(res_name, "port%d-mode", id); | 532 | snprintf(res_name, sizeof(res_name), "port%d-mode", id); |
533 | of_property_read_u32(np, res_name, (u32 *)&pdata->mode); | 533 | of_property_read_u32(np, res_name, (u32 *)&pdata->mode); |
534 | of_property_read_u32(np, "power", (u32 *)&pdata->power); | 534 | of_property_read_u32(np, "power", (u32 *)&pdata->power); |
535 | config->multipoint = of_property_read_bool(np, "multipoint"); | 535 | config->multipoint = of_property_read_bool(np, "multipoint"); |
diff --git a/drivers/usb/renesas_usbhs/fifo.c b/drivers/usb/renesas_usbhs/fifo.c index 143c4e9e1be4..c021b202c0f3 100644 --- a/drivers/usb/renesas_usbhs/fifo.c +++ b/drivers/usb/renesas_usbhs/fifo.c | |||
@@ -795,6 +795,7 @@ static void xfer_work(struct work_struct *work) | |||
795 | dev_dbg(dev, " %s %d (%d/ %d)\n", | 795 | dev_dbg(dev, " %s %d (%d/ %d)\n", |
796 | fifo->name, usbhs_pipe_number(pipe), pkt->length, pkt->zero); | 796 | fifo->name, usbhs_pipe_number(pipe), pkt->length, pkt->zero); |
797 | 797 | ||
798 | usbhs_pipe_enable(pipe); | ||
798 | usbhsf_dma_start(pipe, fifo); | 799 | usbhsf_dma_start(pipe, fifo); |
799 | dma_async_issue_pending(chan); | 800 | dma_async_issue_pending(chan); |
800 | } | 801 | } |
diff --git a/drivers/usb/renesas_usbhs/mod_host.c b/drivers/usb/renesas_usbhs/mod_host.c index 9b69a1323294..069cd765400c 100644 --- a/drivers/usb/renesas_usbhs/mod_host.c +++ b/drivers/usb/renesas_usbhs/mod_host.c | |||
@@ -334,6 +334,11 @@ static void usbhsh_pipe_detach(struct usbhsh_hpriv *hpriv, | |||
334 | struct device *dev = usbhs_priv_to_dev(priv); | 334 | struct device *dev = usbhs_priv_to_dev(priv); |
335 | unsigned long flags; | 335 | unsigned long flags; |
336 | 336 | ||
337 | if (unlikely(!uep)) { | ||
338 | dev_err(dev, "no uep\n"); | ||
339 | return; | ||
340 | } | ||
341 | |||
337 | /******************** spin lock ********************/ | 342 | /******************** spin lock ********************/ |
338 | usbhs_lock(priv, flags); | 343 | usbhs_lock(priv, flags); |
339 | 344 | ||
diff --git a/drivers/usb/serial/ch341.c b/drivers/usb/serial/ch341.c index e9c7046ae355..d255f66e708e 100644 --- a/drivers/usb/serial/ch341.c +++ b/drivers/usb/serial/ch341.c | |||
@@ -242,13 +242,11 @@ out: kfree(buffer); | |||
242 | return r; | 242 | return r; |
243 | } | 243 | } |
244 | 244 | ||
245 | /* allocate private data */ | 245 | static int ch341_port_probe(struct usb_serial_port *port) |
246 | static int ch341_attach(struct usb_serial *serial) | ||
247 | { | 246 | { |
248 | struct ch341_private *priv; | 247 | struct ch341_private *priv; |
249 | int r; | 248 | int r; |
250 | 249 | ||
251 | /* private data */ | ||
252 | priv = kzalloc(sizeof(struct ch341_private), GFP_KERNEL); | 250 | priv = kzalloc(sizeof(struct ch341_private), GFP_KERNEL); |
253 | if (!priv) | 251 | if (!priv) |
254 | return -ENOMEM; | 252 | return -ENOMEM; |
@@ -258,17 +256,27 @@ static int ch341_attach(struct usb_serial *serial) | |||
258 | priv->baud_rate = DEFAULT_BAUD_RATE; | 256 | priv->baud_rate = DEFAULT_BAUD_RATE; |
259 | priv->line_control = CH341_BIT_RTS | CH341_BIT_DTR; | 257 | priv->line_control = CH341_BIT_RTS | CH341_BIT_DTR; |
260 | 258 | ||
261 | r = ch341_configure(serial->dev, priv); | 259 | r = ch341_configure(port->serial->dev, priv); |
262 | if (r < 0) | 260 | if (r < 0) |
263 | goto error; | 261 | goto error; |
264 | 262 | ||
265 | usb_set_serial_port_data(serial->port[0], priv); | 263 | usb_set_serial_port_data(port, priv); |
266 | return 0; | 264 | return 0; |
267 | 265 | ||
268 | error: kfree(priv); | 266 | error: kfree(priv); |
269 | return r; | 267 | return r; |
270 | } | 268 | } |
271 | 269 | ||
270 | static int ch341_port_remove(struct usb_serial_port *port) | ||
271 | { | ||
272 | struct ch341_private *priv; | ||
273 | |||
274 | priv = usb_get_serial_port_data(port); | ||
275 | kfree(priv); | ||
276 | |||
277 | return 0; | ||
278 | } | ||
279 | |||
272 | static int ch341_carrier_raised(struct usb_serial_port *port) | 280 | static int ch341_carrier_raised(struct usb_serial_port *port) |
273 | { | 281 | { |
274 | struct ch341_private *priv = usb_get_serial_port_data(port); | 282 | struct ch341_private *priv = usb_get_serial_port_data(port); |
@@ -304,7 +312,7 @@ static void ch341_close(struct usb_serial_port *port) | |||
304 | static int ch341_open(struct tty_struct *tty, struct usb_serial_port *port) | 312 | static int ch341_open(struct tty_struct *tty, struct usb_serial_port *port) |
305 | { | 313 | { |
306 | struct usb_serial *serial = port->serial; | 314 | struct usb_serial *serial = port->serial; |
307 | struct ch341_private *priv = usb_get_serial_port_data(serial->port[0]); | 315 | struct ch341_private *priv = usb_get_serial_port_data(port); |
308 | int r; | 316 | int r; |
309 | 317 | ||
310 | priv->baud_rate = DEFAULT_BAUD_RATE; | 318 | priv->baud_rate = DEFAULT_BAUD_RATE; |
@@ -608,7 +616,8 @@ static struct usb_serial_driver ch341_device = { | |||
608 | .tiocmget = ch341_tiocmget, | 616 | .tiocmget = ch341_tiocmget, |
609 | .tiocmset = ch341_tiocmset, | 617 | .tiocmset = ch341_tiocmset, |
610 | .read_int_callback = ch341_read_int_callback, | 618 | .read_int_callback = ch341_read_int_callback, |
611 | .attach = ch341_attach, | 619 | .port_probe = ch341_port_probe, |
620 | .port_remove = ch341_port_remove, | ||
612 | .reset_resume = ch341_reset_resume, | 621 | .reset_resume = ch341_reset_resume, |
613 | }; | 622 | }; |
614 | 623 | ||
diff --git a/drivers/usb/serial/digi_acceleport.c b/drivers/usb/serial/digi_acceleport.c index c86f68c6b078..b50fa1c6d885 100644 --- a/drivers/usb/serial/digi_acceleport.c +++ b/drivers/usb/serial/digi_acceleport.c | |||
@@ -244,6 +244,8 @@ static int digi_startup_device(struct usb_serial *serial); | |||
244 | static int digi_startup(struct usb_serial *serial); | 244 | static int digi_startup(struct usb_serial *serial); |
245 | static void digi_disconnect(struct usb_serial *serial); | 245 | static void digi_disconnect(struct usb_serial *serial); |
246 | static void digi_release(struct usb_serial *serial); | 246 | static void digi_release(struct usb_serial *serial); |
247 | static int digi_port_probe(struct usb_serial_port *port); | ||
248 | static int digi_port_remove(struct usb_serial_port *port); | ||
247 | static void digi_read_bulk_callback(struct urb *urb); | 249 | static void digi_read_bulk_callback(struct urb *urb); |
248 | static int digi_read_inb_callback(struct urb *urb); | 250 | static int digi_read_inb_callback(struct urb *urb); |
249 | static int digi_read_oob_callback(struct urb *urb); | 251 | static int digi_read_oob_callback(struct urb *urb); |
@@ -294,6 +296,8 @@ static struct usb_serial_driver digi_acceleport_2_device = { | |||
294 | .attach = digi_startup, | 296 | .attach = digi_startup, |
295 | .disconnect = digi_disconnect, | 297 | .disconnect = digi_disconnect, |
296 | .release = digi_release, | 298 | .release = digi_release, |
299 | .port_probe = digi_port_probe, | ||
300 | .port_remove = digi_port_remove, | ||
297 | }; | 301 | }; |
298 | 302 | ||
299 | static struct usb_serial_driver digi_acceleport_4_device = { | 303 | static struct usb_serial_driver digi_acceleport_4_device = { |
@@ -320,6 +324,8 @@ static struct usb_serial_driver digi_acceleport_4_device = { | |||
320 | .attach = digi_startup, | 324 | .attach = digi_startup, |
321 | .disconnect = digi_disconnect, | 325 | .disconnect = digi_disconnect, |
322 | .release = digi_release, | 326 | .release = digi_release, |
327 | .port_probe = digi_port_probe, | ||
328 | .port_remove = digi_port_remove, | ||
323 | }; | 329 | }; |
324 | 330 | ||
325 | static struct usb_serial_driver * const serial_drivers[] = { | 331 | static struct usb_serial_driver * const serial_drivers[] = { |
@@ -1240,59 +1246,50 @@ static int digi_startup_device(struct usb_serial *serial) | |||
1240 | return ret; | 1246 | return ret; |
1241 | } | 1247 | } |
1242 | 1248 | ||
1243 | 1249 | static int digi_port_init(struct usb_serial_port *port, unsigned port_num) | |
1244 | static int digi_startup(struct usb_serial *serial) | ||
1245 | { | 1250 | { |
1246 | |||
1247 | int i; | ||
1248 | struct digi_port *priv; | 1251 | struct digi_port *priv; |
1249 | struct digi_serial *serial_priv; | ||
1250 | 1252 | ||
1251 | /* allocate the private data structures for all ports */ | 1253 | priv = kzalloc(sizeof(*priv), GFP_KERNEL); |
1252 | /* number of regular ports + 1 for the out-of-band port */ | 1254 | if (!priv) |
1253 | for (i = 0; i < serial->type->num_ports + 1; i++) { | 1255 | return -ENOMEM; |
1254 | /* allocate port private structure */ | ||
1255 | priv = kmalloc(sizeof(struct digi_port), GFP_KERNEL); | ||
1256 | if (priv == NULL) { | ||
1257 | while (--i >= 0) | ||
1258 | kfree(usb_get_serial_port_data(serial->port[i])); | ||
1259 | return 1; /* error */ | ||
1260 | } | ||
1261 | 1256 | ||
1262 | /* initialize port private structure */ | 1257 | spin_lock_init(&priv->dp_port_lock); |
1263 | spin_lock_init(&priv->dp_port_lock); | 1258 | priv->dp_port_num = port_num; |
1264 | priv->dp_port_num = i; | 1259 | init_waitqueue_head(&priv->dp_modem_change_wait); |
1265 | priv->dp_out_buf_len = 0; | 1260 | init_waitqueue_head(&priv->dp_transmit_idle_wait); |
1266 | priv->dp_write_urb_in_use = 0; | 1261 | init_waitqueue_head(&priv->dp_flush_wait); |
1267 | priv->dp_modem_signals = 0; | 1262 | init_waitqueue_head(&priv->dp_close_wait); |
1268 | init_waitqueue_head(&priv->dp_modem_change_wait); | 1263 | INIT_WORK(&priv->dp_wakeup_work, digi_wakeup_write_lock); |
1269 | priv->dp_transmit_idle = 0; | 1264 | priv->dp_port = port; |
1270 | init_waitqueue_head(&priv->dp_transmit_idle_wait); | ||
1271 | priv->dp_throttled = 0; | ||
1272 | priv->dp_throttle_restart = 0; | ||
1273 | init_waitqueue_head(&priv->dp_flush_wait); | ||
1274 | init_waitqueue_head(&priv->dp_close_wait); | ||
1275 | INIT_WORK(&priv->dp_wakeup_work, digi_wakeup_write_lock); | ||
1276 | priv->dp_port = serial->port[i]; | ||
1277 | /* initialize write wait queue for this port */ | ||
1278 | init_waitqueue_head(&serial->port[i]->write_wait); | ||
1279 | |||
1280 | usb_set_serial_port_data(serial->port[i], priv); | ||
1281 | } | ||
1282 | 1265 | ||
1283 | /* allocate serial private structure */ | 1266 | init_waitqueue_head(&port->write_wait); |
1284 | serial_priv = kmalloc(sizeof(struct digi_serial), GFP_KERNEL); | 1267 | |
1285 | if (serial_priv == NULL) { | 1268 | usb_set_serial_port_data(port, priv); |
1286 | for (i = 0; i < serial->type->num_ports + 1; i++) | 1269 | |
1287 | kfree(usb_get_serial_port_data(serial->port[i])); | 1270 | return 0; |
1288 | return 1; /* error */ | 1271 | } |
1289 | } | 1272 | |
1273 | static int digi_startup(struct usb_serial *serial) | ||
1274 | { | ||
1275 | struct digi_serial *serial_priv; | ||
1276 | int ret; | ||
1277 | |||
1278 | serial_priv = kzalloc(sizeof(*serial_priv), GFP_KERNEL); | ||
1279 | if (!serial_priv) | ||
1280 | return -ENOMEM; | ||
1290 | 1281 | ||
1291 | /* initialize serial private structure */ | ||
1292 | spin_lock_init(&serial_priv->ds_serial_lock); | 1282 | spin_lock_init(&serial_priv->ds_serial_lock); |
1293 | serial_priv->ds_oob_port_num = serial->type->num_ports; | 1283 | serial_priv->ds_oob_port_num = serial->type->num_ports; |
1294 | serial_priv->ds_oob_port = serial->port[serial_priv->ds_oob_port_num]; | 1284 | serial_priv->ds_oob_port = serial->port[serial_priv->ds_oob_port_num]; |
1295 | serial_priv->ds_device_started = 0; | 1285 | |
1286 | ret = digi_port_init(serial_priv->ds_oob_port, | ||
1287 | serial_priv->ds_oob_port_num); | ||
1288 | if (ret) { | ||
1289 | kfree(serial_priv); | ||
1290 | return ret; | ||
1291 | } | ||
1292 | |||
1296 | usb_set_serial_data(serial, serial_priv); | 1293 | usb_set_serial_data(serial, serial_priv); |
1297 | 1294 | ||
1298 | return 0; | 1295 | return 0; |
@@ -1313,15 +1310,35 @@ static void digi_disconnect(struct usb_serial *serial) | |||
1313 | 1310 | ||
1314 | static void digi_release(struct usb_serial *serial) | 1311 | static void digi_release(struct usb_serial *serial) |
1315 | { | 1312 | { |
1316 | int i; | 1313 | struct digi_serial *serial_priv; |
1314 | struct digi_port *priv; | ||
1315 | |||
1316 | serial_priv = usb_get_serial_data(serial); | ||
1317 | |||
1318 | priv = usb_get_serial_port_data(serial_priv->ds_oob_port); | ||
1319 | kfree(priv); | ||
1317 | 1320 | ||
1318 | /* free the private data structures for all ports */ | 1321 | kfree(serial_priv); |
1319 | /* number of regular ports + 1 for the out-of-band port */ | ||
1320 | for (i = 0; i < serial->type->num_ports + 1; i++) | ||
1321 | kfree(usb_get_serial_port_data(serial->port[i])); | ||
1322 | kfree(usb_get_serial_data(serial)); | ||
1323 | } | 1322 | } |
1324 | 1323 | ||
1324 | static int digi_port_probe(struct usb_serial_port *port) | ||
1325 | { | ||
1326 | unsigned port_num; | ||
1327 | |||
1328 | port_num = port->number - port->serial->minor; | ||
1329 | |||
1330 | return digi_port_init(port, port_num); | ||
1331 | } | ||
1332 | |||
1333 | static int digi_port_remove(struct usb_serial_port *port) | ||
1334 | { | ||
1335 | struct digi_port *priv; | ||
1336 | |||
1337 | priv = usb_get_serial_port_data(port); | ||
1338 | kfree(priv); | ||
1339 | |||
1340 | return 0; | ||
1341 | } | ||
1325 | 1342 | ||
1326 | static void digi_read_bulk_callback(struct urb *urb) | 1343 | static void digi_read_bulk_callback(struct urb *urb) |
1327 | { | 1344 | { |
diff --git a/drivers/usb/serial/ipw.c b/drivers/usb/serial/ipw.c index 20a132ec39e2..4264821a3b34 100644 --- a/drivers/usb/serial/ipw.c +++ b/drivers/usb/serial/ipw.c | |||
@@ -203,8 +203,7 @@ static int ipw_open(struct tty_struct *tty, struct usb_serial_port *port) | |||
203 | return 0; | 203 | return 0; |
204 | } | 204 | } |
205 | 205 | ||
206 | /* fake probe - only to allocate data structures */ | 206 | static int ipw_attach(struct usb_serial *serial) |
207 | static int ipw_probe(struct usb_serial *serial, const struct usb_device_id *id) | ||
208 | { | 207 | { |
209 | struct usb_wwan_intf_private *data; | 208 | struct usb_wwan_intf_private *data; |
210 | 209 | ||
@@ -303,9 +302,9 @@ static struct usb_serial_driver ipw_device = { | |||
303 | .num_ports = 1, | 302 | .num_ports = 1, |
304 | .open = ipw_open, | 303 | .open = ipw_open, |
305 | .close = ipw_close, | 304 | .close = ipw_close, |
306 | .probe = ipw_probe, | 305 | .attach = ipw_attach, |
307 | .attach = usb_wwan_startup, | ||
308 | .release = ipw_release, | 306 | .release = ipw_release, |
307 | .port_probe = usb_wwan_port_probe, | ||
309 | .port_remove = usb_wwan_port_remove, | 308 | .port_remove = usb_wwan_port_remove, |
310 | .dtr_rts = ipw_dtr_rts, | 309 | .dtr_rts = ipw_dtr_rts, |
311 | .write = usb_wwan_write, | 310 | .write = usb_wwan_write, |
diff --git a/drivers/usb/serial/keyspan.c b/drivers/usb/serial/keyspan.c index 29c943d737d0..7179b0c5f814 100644 --- a/drivers/usb/serial/keyspan.c +++ b/drivers/usb/serial/keyspan.c | |||
@@ -1374,13 +1374,9 @@ static struct callbacks { | |||
1374 | data in device_details */ | 1374 | data in device_details */ |
1375 | static void keyspan_setup_urbs(struct usb_serial *serial) | 1375 | static void keyspan_setup_urbs(struct usb_serial *serial) |
1376 | { | 1376 | { |
1377 | int i, j; | ||
1378 | struct keyspan_serial_private *s_priv; | 1377 | struct keyspan_serial_private *s_priv; |
1379 | const struct keyspan_device_details *d_details; | 1378 | const struct keyspan_device_details *d_details; |
1380 | struct usb_serial_port *port; | ||
1381 | struct keyspan_port_private *p_priv; | ||
1382 | struct callbacks *cback; | 1379 | struct callbacks *cback; |
1383 | int endp; | ||
1384 | 1380 | ||
1385 | s_priv = usb_get_serial_data(serial); | 1381 | s_priv = usb_get_serial_data(serial); |
1386 | d_details = s_priv->device_details; | 1382 | d_details = s_priv->device_details; |
@@ -1404,45 +1400,6 @@ static void keyspan_setup_urbs(struct usb_serial *serial) | |||
1404 | (serial, d_details->glocont_endpoint, USB_DIR_OUT, | 1400 | (serial, d_details->glocont_endpoint, USB_DIR_OUT, |
1405 | serial, s_priv->glocont_buf, GLOCONT_BUFLEN, | 1401 | serial, s_priv->glocont_buf, GLOCONT_BUFLEN, |
1406 | cback->glocont_callback); | 1402 | cback->glocont_callback); |
1407 | |||
1408 | /* Setup endpoints for each port specific thing */ | ||
1409 | for (i = 0; i < d_details->num_ports; i++) { | ||
1410 | port = serial->port[i]; | ||
1411 | p_priv = usb_get_serial_port_data(port); | ||
1412 | |||
1413 | /* Do indat endpoints first, once for each flip */ | ||
1414 | endp = d_details->indat_endpoints[i]; | ||
1415 | for (j = 0; j <= d_details->indat_endp_flip; ++j, ++endp) { | ||
1416 | p_priv->in_urbs[j] = keyspan_setup_urb | ||
1417 | (serial, endp, USB_DIR_IN, port, | ||
1418 | p_priv->in_buffer[j], 64, | ||
1419 | cback->indat_callback); | ||
1420 | } | ||
1421 | for (; j < 2; ++j) | ||
1422 | p_priv->in_urbs[j] = NULL; | ||
1423 | |||
1424 | /* outdat endpoints also have flip */ | ||
1425 | endp = d_details->outdat_endpoints[i]; | ||
1426 | for (j = 0; j <= d_details->outdat_endp_flip; ++j, ++endp) { | ||
1427 | p_priv->out_urbs[j] = keyspan_setup_urb | ||
1428 | (serial, endp, USB_DIR_OUT, port, | ||
1429 | p_priv->out_buffer[j], 64, | ||
1430 | cback->outdat_callback); | ||
1431 | } | ||
1432 | for (; j < 2; ++j) | ||
1433 | p_priv->out_urbs[j] = NULL; | ||
1434 | |||
1435 | /* inack endpoint */ | ||
1436 | p_priv->inack_urb = keyspan_setup_urb | ||
1437 | (serial, d_details->inack_endpoints[i], USB_DIR_IN, | ||
1438 | port, p_priv->inack_buffer, 1, cback->inack_callback); | ||
1439 | |||
1440 | /* outcont endpoint */ | ||
1441 | p_priv->outcont_urb = keyspan_setup_urb | ||
1442 | (serial, d_details->outcont_endpoints[i], USB_DIR_OUT, | ||
1443 | port, p_priv->outcont_buffer, 64, | ||
1444 | cback->outcont_callback); | ||
1445 | } | ||
1446 | } | 1403 | } |
1447 | 1404 | ||
1448 | /* usa19 function doesn't require prescaler */ | 1405 | /* usa19 function doesn't require prescaler */ |
@@ -2407,9 +2364,7 @@ static void keyspan_send_setup(struct usb_serial_port *port, int reset_port) | |||
2407 | static int keyspan_startup(struct usb_serial *serial) | 2364 | static int keyspan_startup(struct usb_serial *serial) |
2408 | { | 2365 | { |
2409 | int i, err; | 2366 | int i, err; |
2410 | struct usb_serial_port *port; | ||
2411 | struct keyspan_serial_private *s_priv; | 2367 | struct keyspan_serial_private *s_priv; |
2412 | struct keyspan_port_private *p_priv; | ||
2413 | const struct keyspan_device_details *d_details; | 2368 | const struct keyspan_device_details *d_details; |
2414 | 2369 | ||
2415 | for (i = 0; (d_details = keyspan_devices[i]) != NULL; ++i) | 2370 | for (i = 0; (d_details = keyspan_devices[i]) != NULL; ++i) |
@@ -2432,19 +2387,6 @@ static int keyspan_startup(struct usb_serial *serial) | |||
2432 | s_priv->device_details = d_details; | 2387 | s_priv->device_details = d_details; |
2433 | usb_set_serial_data(serial, s_priv); | 2388 | usb_set_serial_data(serial, s_priv); |
2434 | 2389 | ||
2435 | /* Now setup per port private data */ | ||
2436 | for (i = 0; i < serial->num_ports; i++) { | ||
2437 | port = serial->port[i]; | ||
2438 | p_priv = kzalloc(sizeof(struct keyspan_port_private), | ||
2439 | GFP_KERNEL); | ||
2440 | if (!p_priv) { | ||
2441 | dev_dbg(&port->dev, "%s - kmalloc for keyspan_port_private (%d) failed!.\n", __func__, i); | ||
2442 | return 1; | ||
2443 | } | ||
2444 | p_priv->device_details = d_details; | ||
2445 | usb_set_serial_port_data(port, p_priv); | ||
2446 | } | ||
2447 | |||
2448 | keyspan_setup_urbs(serial); | 2390 | keyspan_setup_urbs(serial); |
2449 | 2391 | ||
2450 | if (s_priv->instat_urb != NULL) { | 2392 | if (s_priv->instat_urb != NULL) { |
@@ -2463,59 +2405,112 @@ static int keyspan_startup(struct usb_serial *serial) | |||
2463 | 2405 | ||
2464 | static void keyspan_disconnect(struct usb_serial *serial) | 2406 | static void keyspan_disconnect(struct usb_serial *serial) |
2465 | { | 2407 | { |
2466 | int i, j; | 2408 | struct keyspan_serial_private *s_priv; |
2467 | struct usb_serial_port *port; | ||
2468 | struct keyspan_serial_private *s_priv; | ||
2469 | struct keyspan_port_private *p_priv; | ||
2470 | 2409 | ||
2471 | s_priv = usb_get_serial_data(serial); | 2410 | s_priv = usb_get_serial_data(serial); |
2472 | 2411 | ||
2473 | /* Stop reading/writing urbs */ | ||
2474 | stop_urb(s_priv->instat_urb); | 2412 | stop_urb(s_priv->instat_urb); |
2475 | stop_urb(s_priv->glocont_urb); | 2413 | stop_urb(s_priv->glocont_urb); |
2476 | stop_urb(s_priv->indat_urb); | 2414 | stop_urb(s_priv->indat_urb); |
2477 | for (i = 0; i < serial->num_ports; ++i) { | 2415 | } |
2478 | port = serial->port[i]; | 2416 | |
2479 | p_priv = usb_get_serial_port_data(port); | 2417 | static void keyspan_release(struct usb_serial *serial) |
2480 | stop_urb(p_priv->inack_urb); | 2418 | { |
2481 | stop_urb(p_priv->outcont_urb); | 2419 | struct keyspan_serial_private *s_priv; |
2482 | for (j = 0; j < 2; j++) { | 2420 | |
2483 | stop_urb(p_priv->in_urbs[j]); | 2421 | s_priv = usb_get_serial_data(serial); |
2484 | stop_urb(p_priv->out_urbs[j]); | ||
2485 | } | ||
2486 | } | ||
2487 | 2422 | ||
2488 | /* Now free them */ | ||
2489 | usb_free_urb(s_priv->instat_urb); | 2423 | usb_free_urb(s_priv->instat_urb); |
2490 | usb_free_urb(s_priv->indat_urb); | 2424 | usb_free_urb(s_priv->indat_urb); |
2491 | usb_free_urb(s_priv->glocont_urb); | 2425 | usb_free_urb(s_priv->glocont_urb); |
2492 | for (i = 0; i < serial->num_ports; ++i) { | 2426 | |
2493 | port = serial->port[i]; | 2427 | kfree(s_priv); |
2494 | p_priv = usb_get_serial_port_data(port); | ||
2495 | usb_free_urb(p_priv->inack_urb); | ||
2496 | usb_free_urb(p_priv->outcont_urb); | ||
2497 | for (j = 0; j < 2; j++) { | ||
2498 | usb_free_urb(p_priv->in_urbs[j]); | ||
2499 | usb_free_urb(p_priv->out_urbs[j]); | ||
2500 | } | ||
2501 | } | ||
2502 | } | 2428 | } |
2503 | 2429 | ||
2504 | static void keyspan_release(struct usb_serial *serial) | 2430 | static int keyspan_port_probe(struct usb_serial_port *port) |
2505 | { | 2431 | { |
2506 | int i; | 2432 | struct usb_serial *serial = port->serial; |
2507 | struct usb_serial_port *port; | 2433 | struct keyspan_port_private *s_priv; |
2508 | struct keyspan_serial_private *s_priv; | 2434 | struct keyspan_port_private *p_priv; |
2435 | const struct keyspan_device_details *d_details; | ||
2436 | struct callbacks *cback; | ||
2437 | int endp; | ||
2438 | int port_num; | ||
2439 | int i; | ||
2509 | 2440 | ||
2510 | s_priv = usb_get_serial_data(serial); | 2441 | s_priv = usb_get_serial_data(serial); |
2442 | d_details = s_priv->device_details; | ||
2511 | 2443 | ||
2512 | kfree(s_priv); | 2444 | p_priv = kzalloc(sizeof(*p_priv), GFP_KERNEL); |
2445 | if (!p_priv) | ||
2446 | return -ENOMEM; | ||
2513 | 2447 | ||
2514 | /* Now free per port private data */ | 2448 | s_priv = usb_get_serial_data(port->serial); |
2515 | for (i = 0; i < serial->num_ports; i++) { | 2449 | p_priv->device_details = d_details; |
2516 | port = serial->port[i]; | 2450 | |
2517 | kfree(usb_get_serial_port_data(port)); | 2451 | /* Setup values for the various callback routines */ |
2452 | cback = &keyspan_callbacks[d_details->msg_format]; | ||
2453 | |||
2454 | port_num = port->number - port->serial->minor; | ||
2455 | |||
2456 | /* Do indat endpoints first, once for each flip */ | ||
2457 | endp = d_details->indat_endpoints[port_num]; | ||
2458 | for (i = 0; i <= d_details->indat_endp_flip; ++i, ++endp) { | ||
2459 | p_priv->in_urbs[i] = keyspan_setup_urb(serial, endp, | ||
2460 | USB_DIR_IN, port, | ||
2461 | p_priv->in_buffer[i], 64, | ||
2462 | cback->indat_callback); | ||
2463 | } | ||
2464 | /* outdat endpoints also have flip */ | ||
2465 | endp = d_details->outdat_endpoints[port_num]; | ||
2466 | for (i = 0; i <= d_details->outdat_endp_flip; ++i, ++endp) { | ||
2467 | p_priv->out_urbs[i] = keyspan_setup_urb(serial, endp, | ||
2468 | USB_DIR_OUT, port, | ||
2469 | p_priv->out_buffer[i], 64, | ||
2470 | cback->outdat_callback); | ||
2471 | } | ||
2472 | /* inack endpoint */ | ||
2473 | p_priv->inack_urb = keyspan_setup_urb(serial, | ||
2474 | d_details->inack_endpoints[port_num], | ||
2475 | USB_DIR_IN, port, | ||
2476 | p_priv->inack_buffer, 1, | ||
2477 | cback->inack_callback); | ||
2478 | /* outcont endpoint */ | ||
2479 | p_priv->outcont_urb = keyspan_setup_urb(serial, | ||
2480 | d_details->outcont_endpoints[port_num], | ||
2481 | USB_DIR_OUT, port, | ||
2482 | p_priv->outcont_buffer, 64, | ||
2483 | cback->outcont_callback); | ||
2484 | |||
2485 | usb_set_serial_port_data(port, p_priv); | ||
2486 | |||
2487 | return 0; | ||
2488 | } | ||
2489 | |||
2490 | static int keyspan_port_remove(struct usb_serial_port *port) | ||
2491 | { | ||
2492 | struct keyspan_port_private *p_priv; | ||
2493 | int i; | ||
2494 | |||
2495 | p_priv = usb_get_serial_port_data(port); | ||
2496 | |||
2497 | stop_urb(p_priv->inack_urb); | ||
2498 | stop_urb(p_priv->outcont_urb); | ||
2499 | for (i = 0; i < 2; i++) { | ||
2500 | stop_urb(p_priv->in_urbs[i]); | ||
2501 | stop_urb(p_priv->out_urbs[i]); | ||
2502 | } | ||
2503 | |||
2504 | usb_free_urb(p_priv->inack_urb); | ||
2505 | usb_free_urb(p_priv->outcont_urb); | ||
2506 | for (i = 0; i < 2; i++) { | ||
2507 | usb_free_urb(p_priv->in_urbs[i]); | ||
2508 | usb_free_urb(p_priv->out_urbs[i]); | ||
2518 | } | 2509 | } |
2510 | |||
2511 | kfree(p_priv); | ||
2512 | |||
2513 | return 0; | ||
2519 | } | 2514 | } |
2520 | 2515 | ||
2521 | MODULE_AUTHOR(DRIVER_AUTHOR); | 2516 | MODULE_AUTHOR(DRIVER_AUTHOR); |
diff --git a/drivers/usb/serial/keyspan.h b/drivers/usb/serial/keyspan.h index 0a8a40b5711e..0273dda303a4 100644 --- a/drivers/usb/serial/keyspan.h +++ b/drivers/usb/serial/keyspan.h | |||
@@ -42,6 +42,8 @@ static void keyspan_dtr_rts (struct usb_serial_port *port, int on); | |||
42 | static int keyspan_startup (struct usb_serial *serial); | 42 | static int keyspan_startup (struct usb_serial *serial); |
43 | static void keyspan_disconnect (struct usb_serial *serial); | 43 | static void keyspan_disconnect (struct usb_serial *serial); |
44 | static void keyspan_release (struct usb_serial *serial); | 44 | static void keyspan_release (struct usb_serial *serial); |
45 | static int keyspan_port_probe(struct usb_serial_port *port); | ||
46 | static int keyspan_port_remove(struct usb_serial_port *port); | ||
45 | static int keyspan_write_room (struct tty_struct *tty); | 47 | static int keyspan_write_room (struct tty_struct *tty); |
46 | 48 | ||
47 | static int keyspan_write (struct tty_struct *tty, | 49 | static int keyspan_write (struct tty_struct *tty, |
@@ -567,6 +569,8 @@ static struct usb_serial_driver keyspan_1port_device = { | |||
567 | .attach = keyspan_startup, | 569 | .attach = keyspan_startup, |
568 | .disconnect = keyspan_disconnect, | 570 | .disconnect = keyspan_disconnect, |
569 | .release = keyspan_release, | 571 | .release = keyspan_release, |
572 | .port_probe = keyspan_port_probe, | ||
573 | .port_remove = keyspan_port_remove, | ||
570 | }; | 574 | }; |
571 | 575 | ||
572 | static struct usb_serial_driver keyspan_2port_device = { | 576 | static struct usb_serial_driver keyspan_2port_device = { |
@@ -589,6 +593,8 @@ static struct usb_serial_driver keyspan_2port_device = { | |||
589 | .attach = keyspan_startup, | 593 | .attach = keyspan_startup, |
590 | .disconnect = keyspan_disconnect, | 594 | .disconnect = keyspan_disconnect, |
591 | .release = keyspan_release, | 595 | .release = keyspan_release, |
596 | .port_probe = keyspan_port_probe, | ||
597 | .port_remove = keyspan_port_remove, | ||
592 | }; | 598 | }; |
593 | 599 | ||
594 | static struct usb_serial_driver keyspan_4port_device = { | 600 | static struct usb_serial_driver keyspan_4port_device = { |
@@ -611,6 +617,8 @@ static struct usb_serial_driver keyspan_4port_device = { | |||
611 | .attach = keyspan_startup, | 617 | .attach = keyspan_startup, |
612 | .disconnect = keyspan_disconnect, | 618 | .disconnect = keyspan_disconnect, |
613 | .release = keyspan_release, | 619 | .release = keyspan_release, |
620 | .port_probe = keyspan_port_probe, | ||
621 | .port_remove = keyspan_port_remove, | ||
614 | }; | 622 | }; |
615 | 623 | ||
616 | static struct usb_serial_driver * const serial_drivers[] = { | 624 | static struct usb_serial_driver * const serial_drivers[] = { |
diff --git a/drivers/usb/serial/mct_u232.c b/drivers/usb/serial/mct_u232.c index f3947712e137..8a2081004107 100644 --- a/drivers/usb/serial/mct_u232.c +++ b/drivers/usb/serial/mct_u232.c | |||
@@ -49,7 +49,8 @@ | |||
49 | * Function prototypes | 49 | * Function prototypes |
50 | */ | 50 | */ |
51 | static int mct_u232_startup(struct usb_serial *serial); | 51 | static int mct_u232_startup(struct usb_serial *serial); |
52 | static void mct_u232_release(struct usb_serial *serial); | 52 | static int mct_u232_port_probe(struct usb_serial_port *port); |
53 | static int mct_u232_port_remove(struct usb_serial_port *remove); | ||
53 | static int mct_u232_open(struct tty_struct *tty, struct usb_serial_port *port); | 54 | static int mct_u232_open(struct tty_struct *tty, struct usb_serial_port *port); |
54 | static void mct_u232_close(struct usb_serial_port *port); | 55 | static void mct_u232_close(struct usb_serial_port *port); |
55 | static void mct_u232_dtr_rts(struct usb_serial_port *port, int on); | 56 | static void mct_u232_dtr_rts(struct usb_serial_port *port, int on); |
@@ -99,7 +100,8 @@ static struct usb_serial_driver mct_u232_device = { | |||
99 | .tiocmget = mct_u232_tiocmget, | 100 | .tiocmget = mct_u232_tiocmget, |
100 | .tiocmset = mct_u232_tiocmset, | 101 | .tiocmset = mct_u232_tiocmset, |
101 | .attach = mct_u232_startup, | 102 | .attach = mct_u232_startup, |
102 | .release = mct_u232_release, | 103 | .port_probe = mct_u232_port_probe, |
104 | .port_remove = mct_u232_port_remove, | ||
103 | .ioctl = mct_u232_ioctl, | 105 | .ioctl = mct_u232_ioctl, |
104 | .get_icount = mct_u232_get_icount, | 106 | .get_icount = mct_u232_get_icount, |
105 | }; | 107 | }; |
@@ -388,18 +390,8 @@ static void mct_u232_msr_to_state(struct usb_serial_port *port, | |||
388 | 390 | ||
389 | static int mct_u232_startup(struct usb_serial *serial) | 391 | static int mct_u232_startup(struct usb_serial *serial) |
390 | { | 392 | { |
391 | struct mct_u232_private *priv; | ||
392 | struct usb_serial_port *port, *rport; | 393 | struct usb_serial_port *port, *rport; |
393 | 394 | ||
394 | priv = kzalloc(sizeof(struct mct_u232_private), GFP_KERNEL); | ||
395 | if (!priv) | ||
396 | return -ENOMEM; | ||
397 | spin_lock_init(&priv->lock); | ||
398 | init_waitqueue_head(&priv->msr_wait); | ||
399 | usb_set_serial_port_data(serial->port[0], priv); | ||
400 | |||
401 | init_waitqueue_head(&serial->port[0]->write_wait); | ||
402 | |||
403 | /* Puh, that's dirty */ | 395 | /* Puh, that's dirty */ |
404 | port = serial->port[0]; | 396 | port = serial->port[0]; |
405 | rport = serial->port[1]; | 397 | rport = serial->port[1]; |
@@ -412,18 +404,31 @@ static int mct_u232_startup(struct usb_serial *serial) | |||
412 | return 0; | 404 | return 0; |
413 | } /* mct_u232_startup */ | 405 | } /* mct_u232_startup */ |
414 | 406 | ||
407 | static int mct_u232_port_probe(struct usb_serial_port *port) | ||
408 | { | ||
409 | struct mct_u232_private *priv; | ||
410 | |||
411 | priv = kzalloc(sizeof(*priv), GFP_KERNEL); | ||
412 | if (!priv) | ||
413 | return -ENOMEM; | ||
414 | |||
415 | spin_lock_init(&priv->lock); | ||
416 | init_waitqueue_head(&priv->msr_wait); | ||
417 | |||
418 | usb_set_serial_port_data(port, priv); | ||
415 | 419 | ||
416 | static void mct_u232_release(struct usb_serial *serial) | 420 | return 0; |
421 | } | ||
422 | |||
423 | static int mct_u232_port_remove(struct usb_serial_port *port) | ||
417 | { | 424 | { |
418 | struct mct_u232_private *priv; | 425 | struct mct_u232_private *priv; |
419 | int i; | ||
420 | 426 | ||
421 | for (i = 0; i < serial->num_ports; ++i) { | 427 | priv = usb_get_serial_port_data(port); |
422 | /* My special items, the standard routines free my urbs */ | 428 | kfree(priv); |
423 | priv = usb_get_serial_port_data(serial->port[i]); | 429 | |
424 | kfree(priv); | 430 | return 0; |
425 | } | 431 | } |
426 | } /* mct_u232_release */ | ||
427 | 432 | ||
428 | static int mct_u232_open(struct tty_struct *tty, struct usb_serial_port *port) | 433 | static int mct_u232_open(struct tty_struct *tty, struct usb_serial_port *port) |
429 | { | 434 | { |
@@ -515,12 +520,14 @@ static void mct_u232_dtr_rts(struct usb_serial_port *port, int on) | |||
515 | 520 | ||
516 | static void mct_u232_close(struct usb_serial_port *port) | 521 | static void mct_u232_close(struct usb_serial_port *port) |
517 | { | 522 | { |
518 | if (port->serial->dev) { | 523 | /* |
519 | /* shutdown our urbs */ | 524 | * Must kill the read urb as it is actually an interrupt urb, which |
520 | usb_kill_urb(port->write_urb); | 525 | * generic close thus fails to kill. |
521 | usb_kill_urb(port->read_urb); | 526 | */ |
522 | usb_kill_urb(port->interrupt_in_urb); | 527 | usb_kill_urb(port->read_urb); |
523 | } | 528 | usb_kill_urb(port->interrupt_in_urb); |
529 | |||
530 | usb_serial_generic_close(port); | ||
524 | } /* mct_u232_close */ | 531 | } /* mct_u232_close */ |
525 | 532 | ||
526 | 533 | ||
diff --git a/drivers/usb/serial/metro-usb.c b/drivers/usb/serial/metro-usb.c index 0b257ddffbdb..6f29c74eb769 100644 --- a/drivers/usb/serial/metro-usb.c +++ b/drivers/usb/serial/metro-usb.c | |||
@@ -179,16 +179,13 @@ static void metrousb_cleanup(struct usb_serial_port *port) | |||
179 | { | 179 | { |
180 | dev_dbg(&port->dev, "%s\n", __func__); | 180 | dev_dbg(&port->dev, "%s\n", __func__); |
181 | 181 | ||
182 | if (port->serial->dev) { | 182 | usb_unlink_urb(port->interrupt_in_urb); |
183 | /* Shutdown any interrupt in urbs. */ | 183 | usb_kill_urb(port->interrupt_in_urb); |
184 | if (port->interrupt_in_urb) { | 184 | |
185 | usb_unlink_urb(port->interrupt_in_urb); | 185 | mutex_lock(&port->serial->disc_mutex); |
186 | usb_kill_urb(port->interrupt_in_urb); | 186 | if (!port->serial->disconnected) |
187 | } | ||
188 | |||
189 | /* Send deactivate cmd to device */ | ||
190 | metrousb_send_unidirectional_cmd(UNI_CMD_CLOSE, port); | 187 | metrousb_send_unidirectional_cmd(UNI_CMD_CLOSE, port); |
191 | } | 188 | mutex_unlock(&port->serial->disc_mutex); |
192 | } | 189 | } |
193 | 190 | ||
194 | static int metrousb_open(struct tty_struct *tty, struct usb_serial_port *port) | 191 | static int metrousb_open(struct tty_struct *tty, struct usb_serial_port *port) |
@@ -271,51 +268,27 @@ static int metrousb_set_modem_ctrl(struct usb_serial *serial, unsigned int contr | |||
271 | return retval; | 268 | return retval; |
272 | } | 269 | } |
273 | 270 | ||
274 | static void metrousb_shutdown(struct usb_serial *serial) | 271 | static int metrousb_port_probe(struct usb_serial_port *port) |
275 | { | 272 | { |
276 | int i = 0; | 273 | struct metrousb_private *metro_priv; |
277 | 274 | ||
278 | dev_dbg(&serial->dev->dev, "%s\n", __func__); | 275 | metro_priv = kzalloc(sizeof(*metro_priv), GFP_KERNEL); |
276 | if (!metro_priv) | ||
277 | return -ENOMEM; | ||
279 | 278 | ||
280 | /* Stop reading and writing on all ports. */ | 279 | spin_lock_init(&metro_priv->lock); |
281 | for (i = 0; i < serial->num_ports; ++i) { | ||
282 | /* Close any open urbs. */ | ||
283 | metrousb_cleanup(serial->port[i]); | ||
284 | 280 | ||
285 | /* Free memory. */ | 281 | usb_set_serial_port_data(port, metro_priv); |
286 | kfree(usb_get_serial_port_data(serial->port[i])); | ||
287 | usb_set_serial_port_data(serial->port[i], NULL); | ||
288 | 282 | ||
289 | dev_dbg(&serial->dev->dev, "%s - freed port number=%d\n", | 283 | return 0; |
290 | __func__, serial->port[i]->number); | ||
291 | } | ||
292 | } | 284 | } |
293 | 285 | ||
294 | static int metrousb_startup(struct usb_serial *serial) | 286 | static int metrousb_port_remove(struct usb_serial_port *port) |
295 | { | 287 | { |
296 | struct metrousb_private *metro_priv; | 288 | struct metrousb_private *metro_priv; |
297 | struct usb_serial_port *port; | ||
298 | int i = 0; | ||
299 | 289 | ||
300 | dev_dbg(&serial->dev->dev, "%s\n", __func__); | 290 | metro_priv = usb_get_serial_port_data(port); |
301 | 291 | kfree(metro_priv); | |
302 | /* Loop through the serial ports setting up the private structures. | ||
303 | * Currently we only use one port. */ | ||
304 | for (i = 0; i < serial->num_ports; ++i) { | ||
305 | port = serial->port[i]; | ||
306 | |||
307 | /* Declare memory. */ | ||
308 | metro_priv = kzalloc(sizeof(struct metrousb_private), GFP_KERNEL); | ||
309 | if (!metro_priv) | ||
310 | return -ENOMEM; | ||
311 | |||
312 | /* Initialize memory. */ | ||
313 | spin_lock_init(&metro_priv->lock); | ||
314 | usb_set_serial_port_data(port, metro_priv); | ||
315 | |||
316 | dev_dbg(&serial->dev->dev, "%s - port number=%d\n ", | ||
317 | __func__, port->number); | ||
318 | } | ||
319 | 292 | ||
320 | return 0; | 293 | return 0; |
321 | } | 294 | } |
@@ -414,8 +387,8 @@ static struct usb_serial_driver metrousb_device = { | |||
414 | .close = metrousb_cleanup, | 387 | .close = metrousb_cleanup, |
415 | .read_int_callback = metrousb_read_int_callback, | 388 | .read_int_callback = metrousb_read_int_callback, |
416 | .write_int_callback = metrousb_write_int_callback, | 389 | .write_int_callback = metrousb_write_int_callback, |
417 | .attach = metrousb_startup, | 390 | .port_probe = metrousb_port_probe, |
418 | .release = metrousb_shutdown, | 391 | .port_remove = metrousb_port_remove, |
419 | .throttle = metrousb_throttle, | 392 | .throttle = metrousb_throttle, |
420 | .unthrottle = metrousb_unthrottle, | 393 | .unthrottle = metrousb_unthrottle, |
421 | .tiocmget = metrousb_tiocmget, | 394 | .tiocmget = metrousb_tiocmget, |
diff --git a/drivers/usb/serial/mos7720.c b/drivers/usb/serial/mos7720.c index 1bf1ad066666..75267421aad8 100644 --- a/drivers/usb/serial/mos7720.c +++ b/drivers/usb/serial/mos7720.c | |||
@@ -1966,9 +1966,7 @@ static int mos7720_ioctl(struct tty_struct *tty, | |||
1966 | 1966 | ||
1967 | static int mos7720_startup(struct usb_serial *serial) | 1967 | static int mos7720_startup(struct usb_serial *serial) |
1968 | { | 1968 | { |
1969 | struct moschip_port *mos7720_port; | ||
1970 | struct usb_device *dev; | 1969 | struct usb_device *dev; |
1971 | int i; | ||
1972 | char data; | 1970 | char data; |
1973 | u16 product; | 1971 | u16 product; |
1974 | int ret_val; | 1972 | int ret_val; |
@@ -1999,29 +1997,6 @@ static int mos7720_startup(struct usb_serial *serial) | |||
1999 | serial->port[1]->interrupt_in_buffer = NULL; | 1997 | serial->port[1]->interrupt_in_buffer = NULL; |
2000 | } | 1998 | } |
2001 | 1999 | ||
2002 | |||
2003 | /* set up serial port private structures */ | ||
2004 | for (i = 0; i < serial->num_ports; ++i) { | ||
2005 | mos7720_port = kzalloc(sizeof(struct moschip_port), GFP_KERNEL); | ||
2006 | if (mos7720_port == NULL) { | ||
2007 | dev_err(&dev->dev, "%s - Out of memory\n", __func__); | ||
2008 | return -ENOMEM; | ||
2009 | } | ||
2010 | |||
2011 | /* Initialize all port interrupt end point to port 0 int | ||
2012 | * endpoint. Our device has only one interrupt endpoint | ||
2013 | * common to all ports */ | ||
2014 | serial->port[i]->interrupt_in_endpointAddress = | ||
2015 | serial->port[0]->interrupt_in_endpointAddress; | ||
2016 | |||
2017 | mos7720_port->port = serial->port[i]; | ||
2018 | usb_set_serial_port_data(serial->port[i], mos7720_port); | ||
2019 | |||
2020 | dev_dbg(&dev->dev, "port number is %d\n", serial->port[i]->number); | ||
2021 | dev_dbg(&dev->dev, "serial number is %d\n", serial->minor); | ||
2022 | } | ||
2023 | |||
2024 | |||
2025 | /* setting configuration feature to one */ | 2000 | /* setting configuration feature to one */ |
2026 | usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0), | 2001 | usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0), |
2027 | (__u8)0x03, 0x00, 0x01, 0x00, NULL, 0x00, 5*HZ); | 2002 | (__u8)0x03, 0x00, 0x01, 0x00, NULL, 0x00, 5*HZ); |
@@ -2049,8 +2024,6 @@ static int mos7720_startup(struct usb_serial *serial) | |||
2049 | 2024 | ||
2050 | static void mos7720_release(struct usb_serial *serial) | 2025 | static void mos7720_release(struct usb_serial *serial) |
2051 | { | 2026 | { |
2052 | int i; | ||
2053 | |||
2054 | #ifdef CONFIG_USB_SERIAL_MOS7715_PARPORT | 2027 | #ifdef CONFIG_USB_SERIAL_MOS7715_PARPORT |
2055 | /* close the parallel port */ | 2028 | /* close the parallel port */ |
2056 | 2029 | ||
@@ -2089,9 +2062,36 @@ static void mos7720_release(struct usb_serial *serial) | |||
2089 | kref_put(&mos_parport->ref_count, destroy_mos_parport); | 2062 | kref_put(&mos_parport->ref_count, destroy_mos_parport); |
2090 | } | 2063 | } |
2091 | #endif | 2064 | #endif |
2092 | /* free private structure allocated for serial port */ | 2065 | } |
2093 | for (i = 0; i < serial->num_ports; ++i) | 2066 | |
2094 | kfree(usb_get_serial_port_data(serial->port[i])); | 2067 | static int mos7720_port_probe(struct usb_serial_port *port) |
2068 | { | ||
2069 | struct moschip_port *mos7720_port; | ||
2070 | |||
2071 | mos7720_port = kzalloc(sizeof(*mos7720_port), GFP_KERNEL); | ||
2072 | if (!mos7720_port) | ||
2073 | return -ENOMEM; | ||
2074 | |||
2075 | /* Initialize all port interrupt end point to port 0 int endpoint. | ||
2076 | * Our device has only one interrupt endpoint common to all ports. | ||
2077 | */ | ||
2078 | port->interrupt_in_endpointAddress = | ||
2079 | port->serial->port[0]->interrupt_in_endpointAddress; | ||
2080 | mos7720_port->port = port; | ||
2081 | |||
2082 | usb_set_serial_port_data(port, mos7720_port); | ||
2083 | |||
2084 | return 0; | ||
2085 | } | ||
2086 | |||
2087 | static int mos7720_port_remove(struct usb_serial_port *port) | ||
2088 | { | ||
2089 | struct moschip_port *mos7720_port; | ||
2090 | |||
2091 | mos7720_port = usb_get_serial_port_data(port); | ||
2092 | kfree(mos7720_port); | ||
2093 | |||
2094 | return 0; | ||
2095 | } | 2095 | } |
2096 | 2096 | ||
2097 | static struct usb_serial_driver moschip7720_2port_driver = { | 2097 | static struct usb_serial_driver moschip7720_2port_driver = { |
@@ -2109,6 +2109,8 @@ static struct usb_serial_driver moschip7720_2port_driver = { | |||
2109 | .probe = mos77xx_probe, | 2109 | .probe = mos77xx_probe, |
2110 | .attach = mos7720_startup, | 2110 | .attach = mos7720_startup, |
2111 | .release = mos7720_release, | 2111 | .release = mos7720_release, |
2112 | .port_probe = mos7720_port_probe, | ||
2113 | .port_remove = mos7720_port_remove, | ||
2112 | .ioctl = mos7720_ioctl, | 2114 | .ioctl = mos7720_ioctl, |
2113 | .tiocmget = mos7720_tiocmget, | 2115 | .tiocmget = mos7720_tiocmget, |
2114 | .tiocmset = mos7720_tiocmset, | 2116 | .tiocmset = mos7720_tiocmset, |
diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c index d6d4eeca8c68..1cf3375ec1af 100644 --- a/drivers/usb/serial/mos7840.c +++ b/drivers/usb/serial/mos7840.c | |||
@@ -218,12 +218,10 @@ struct moschip_port { | |||
218 | int port_num; /*Actual port number in the device(1,2,etc) */ | 218 | int port_num; /*Actual port number in the device(1,2,etc) */ |
219 | struct urb *write_urb; /* write URB for this port */ | 219 | struct urb *write_urb; /* write URB for this port */ |
220 | struct urb *read_urb; /* read URB for this port */ | 220 | struct urb *read_urb; /* read URB for this port */ |
221 | struct urb *int_urb; | ||
222 | __u8 shadowLCR; /* last LCR value received */ | 221 | __u8 shadowLCR; /* last LCR value received */ |
223 | __u8 shadowMCR; /* last MCR value received */ | 222 | __u8 shadowMCR; /* last MCR value received */ |
224 | char open; | 223 | char open; |
225 | char open_ports; | 224 | char open_ports; |
226 | char zombie; | ||
227 | wait_queue_head_t wait_chase; /* for handling sleeping while waiting for chase to finish */ | 225 | wait_queue_head_t wait_chase; /* for handling sleeping while waiting for chase to finish */ |
228 | wait_queue_head_t delta_msr_wait; /* for handling sleeping while waiting for msr change to happen */ | 226 | wait_queue_head_t delta_msr_wait; /* for handling sleeping while waiting for msr change to happen */ |
229 | int delta_msr_cond; | 227 | int delta_msr_cond; |
@@ -478,7 +476,6 @@ static void mos7840_control_callback(struct urb *urb) | |||
478 | struct moschip_port *mos7840_port; | 476 | struct moschip_port *mos7840_port; |
479 | struct device *dev = &urb->dev->dev; | 477 | struct device *dev = &urb->dev->dev; |
480 | __u8 regval = 0x0; | 478 | __u8 regval = 0x0; |
481 | int result = 0; | ||
482 | int status = urb->status; | 479 | int status = urb->status; |
483 | 480 | ||
484 | mos7840_port = urb->context; | 481 | mos7840_port = urb->context; |
@@ -495,7 +492,7 @@ static void mos7840_control_callback(struct urb *urb) | |||
495 | return; | 492 | return; |
496 | default: | 493 | default: |
497 | dev_dbg(dev, "%s - nonzero urb status received: %d\n", __func__, status); | 494 | dev_dbg(dev, "%s - nonzero urb status received: %d\n", __func__, status); |
498 | goto exit; | 495 | return; |
499 | } | 496 | } |
500 | 497 | ||
501 | dev_dbg(dev, "%s urb buffer size is %d\n", __func__, urb->actual_length); | 498 | dev_dbg(dev, "%s urb buffer size is %d\n", __func__, urb->actual_length); |
@@ -508,16 +505,6 @@ static void mos7840_control_callback(struct urb *urb) | |||
508 | mos7840_handle_new_msr(mos7840_port, regval); | 505 | mos7840_handle_new_msr(mos7840_port, regval); |
509 | else if (mos7840_port->MsrLsr == 1) | 506 | else if (mos7840_port->MsrLsr == 1) |
510 | mos7840_handle_new_lsr(mos7840_port, regval); | 507 | mos7840_handle_new_lsr(mos7840_port, regval); |
511 | |||
512 | exit: | ||
513 | spin_lock(&mos7840_port->pool_lock); | ||
514 | if (!mos7840_port->zombie) | ||
515 | result = usb_submit_urb(mos7840_port->int_urb, GFP_ATOMIC); | ||
516 | spin_unlock(&mos7840_port->pool_lock); | ||
517 | if (result) { | ||
518 | dev_err(dev, "%s - Error %d submitting interrupt urb\n", | ||
519 | __func__, result); | ||
520 | } | ||
521 | } | 508 | } |
522 | 509 | ||
523 | static int mos7840_get_reg(struct moschip_port *mcs, __u16 Wval, __u16 reg, | 510 | static int mos7840_get_reg(struct moschip_port *mcs, __u16 Wval, __u16 reg, |
@@ -686,14 +673,7 @@ static void mos7840_interrupt_callback(struct urb *urb) | |||
686 | wreg = MODEM_STATUS_REGISTER; | 673 | wreg = MODEM_STATUS_REGISTER; |
687 | break; | 674 | break; |
688 | } | 675 | } |
689 | spin_lock(&mos7840_port->pool_lock); | 676 | rv = mos7840_get_reg(mos7840_port, wval, wreg, &Data); |
690 | if (!mos7840_port->zombie) { | ||
691 | rv = mos7840_get_reg(mos7840_port, wval, wreg, &Data); | ||
692 | } else { | ||
693 | spin_unlock(&mos7840_port->pool_lock); | ||
694 | return; | ||
695 | } | ||
696 | spin_unlock(&mos7840_port->pool_lock); | ||
697 | } | 677 | } |
698 | } | 678 | } |
699 | } | 679 | } |
@@ -2347,309 +2327,249 @@ static int mos7840_calc_num_ports(struct usb_serial *serial) | |||
2347 | return mos7840_num_ports; | 2327 | return mos7840_num_ports; |
2348 | } | 2328 | } |
2349 | 2329 | ||
2350 | /**************************************************************************** | 2330 | static int mos7840_port_probe(struct usb_serial_port *port) |
2351 | * mos7840_startup | ||
2352 | ****************************************************************************/ | ||
2353 | |||
2354 | static int mos7840_startup(struct usb_serial *serial) | ||
2355 | { | 2331 | { |
2332 | struct usb_serial *serial = port->serial; | ||
2356 | struct moschip_port *mos7840_port; | 2333 | struct moschip_port *mos7840_port; |
2357 | struct usb_device *dev; | 2334 | int status; |
2358 | int i, status; | 2335 | int pnum; |
2359 | __u16 Data; | 2336 | __u16 Data; |
2360 | 2337 | ||
2361 | dev = serial->dev; | ||
2362 | |||
2363 | /* we set up the pointers to the endpoints in the mos7840_open * | 2338 | /* we set up the pointers to the endpoints in the mos7840_open * |
2364 | * function, as the structures aren't created yet. */ | 2339 | * function, as the structures aren't created yet. */ |
2365 | 2340 | ||
2366 | /* set up port private structures */ | 2341 | pnum = port->number - serial->minor; |
2367 | for (i = 0; i < serial->num_ports; ++i) { | ||
2368 | dev_dbg(&dev->dev, "mos7840_startup: configuring port %d............\n", i); | ||
2369 | mos7840_port = kzalloc(sizeof(struct moschip_port), GFP_KERNEL); | ||
2370 | if (mos7840_port == NULL) { | ||
2371 | dev_err(&dev->dev, "%s - Out of memory\n", __func__); | ||
2372 | status = -ENOMEM; | ||
2373 | i--; /* don't follow NULL pointer cleaning up */ | ||
2374 | goto error; | ||
2375 | } | ||
2376 | |||
2377 | /* Initialize all port interrupt end point to port 0 int | ||
2378 | * endpoint. Our device has only one interrupt end point | ||
2379 | * common to all port */ | ||
2380 | |||
2381 | mos7840_port->port = serial->port[i]; | ||
2382 | mos7840_set_port_private(serial->port[i], mos7840_port); | ||
2383 | spin_lock_init(&mos7840_port->pool_lock); | ||
2384 | |||
2385 | /* minor is not initialised until later by | ||
2386 | * usb-serial.c:get_free_serial() and cannot therefore be used | ||
2387 | * to index device instances */ | ||
2388 | mos7840_port->port_num = i + 1; | ||
2389 | dev_dbg(&dev->dev, "serial->port[i]->number = %d\n", serial->port[i]->number); | ||
2390 | dev_dbg(&dev->dev, "serial->port[i]->serial->minor = %d\n", serial->port[i]->serial->minor); | ||
2391 | dev_dbg(&dev->dev, "mos7840_port->port_num = %d\n", mos7840_port->port_num); | ||
2392 | dev_dbg(&dev->dev, "serial->minor = %d\n", serial->minor); | ||
2393 | |||
2394 | if (mos7840_port->port_num == 1) { | ||
2395 | mos7840_port->SpRegOffset = 0x0; | ||
2396 | mos7840_port->ControlRegOffset = 0x1; | ||
2397 | mos7840_port->DcrRegOffset = 0x4; | ||
2398 | } else if ((mos7840_port->port_num == 2) | ||
2399 | && (serial->num_ports == 4)) { | ||
2400 | mos7840_port->SpRegOffset = 0x8; | ||
2401 | mos7840_port->ControlRegOffset = 0x9; | ||
2402 | mos7840_port->DcrRegOffset = 0x16; | ||
2403 | } else if ((mos7840_port->port_num == 2) | ||
2404 | && (serial->num_ports == 2)) { | ||
2405 | mos7840_port->SpRegOffset = 0xa; | ||
2406 | mos7840_port->ControlRegOffset = 0xb; | ||
2407 | mos7840_port->DcrRegOffset = 0x19; | ||
2408 | } else if ((mos7840_port->port_num == 3) | ||
2409 | && (serial->num_ports == 4)) { | ||
2410 | mos7840_port->SpRegOffset = 0xa; | ||
2411 | mos7840_port->ControlRegOffset = 0xb; | ||
2412 | mos7840_port->DcrRegOffset = 0x19; | ||
2413 | } else if ((mos7840_port->port_num == 4) | ||
2414 | && (serial->num_ports == 4)) { | ||
2415 | mos7840_port->SpRegOffset = 0xc; | ||
2416 | mos7840_port->ControlRegOffset = 0xd; | ||
2417 | mos7840_port->DcrRegOffset = 0x1c; | ||
2418 | } | ||
2419 | mos7840_dump_serial_port(serial->port[i], mos7840_port); | ||
2420 | mos7840_set_port_private(serial->port[i], mos7840_port); | ||
2421 | 2342 | ||
2422 | /* enable rx_disable bit in control register */ | 2343 | dev_dbg(&port->dev, "mos7840_startup: configuring port %d\n", pnum); |
2423 | status = mos7840_get_reg_sync(serial->port[i], | 2344 | mos7840_port = kzalloc(sizeof(struct moschip_port), GFP_KERNEL); |
2424 | mos7840_port->ControlRegOffset, &Data); | 2345 | if (mos7840_port == NULL) { |
2425 | if (status < 0) { | 2346 | dev_err(&port->dev, "%s - Out of memory\n", __func__); |
2426 | dev_dbg(&dev->dev, "Reading ControlReg failed status-0x%x\n", status); | 2347 | return -ENOMEM; |
2427 | break; | 2348 | } |
2428 | } else | ||
2429 | dev_dbg(&dev->dev, "ControlReg Reading success val is %x, status%d\n", Data, status); | ||
2430 | Data |= 0x08; /* setting driver done bit */ | ||
2431 | Data |= 0x04; /* sp1_bit to have cts change reflect in | ||
2432 | modem status reg */ | ||
2433 | |||
2434 | /* Data |= 0x20; //rx_disable bit */ | ||
2435 | status = mos7840_set_reg_sync(serial->port[i], | ||
2436 | mos7840_port->ControlRegOffset, Data); | ||
2437 | if (status < 0) { | ||
2438 | dev_dbg(&dev->dev, "Writing ControlReg failed(rx_disable) status-0x%x\n", status); | ||
2439 | break; | ||
2440 | } else | ||
2441 | dev_dbg(&dev->dev, "ControlReg Writing success(rx_disable) status%d\n", status); | ||
2442 | 2349 | ||
2443 | /* Write default values in DCR (i.e 0x01 in DCR0, 0x05 in DCR2 | 2350 | /* Initialize all port interrupt end point to port 0 int |
2444 | and 0x24 in DCR3 */ | 2351 | * endpoint. Our device has only one interrupt end point |
2445 | Data = 0x01; | 2352 | * common to all port */ |
2446 | status = mos7840_set_reg_sync(serial->port[i], | 2353 | |
2447 | (__u16) (mos7840_port->DcrRegOffset + 0), Data); | 2354 | mos7840_port->port = port; |
2448 | if (status < 0) { | 2355 | mos7840_set_port_private(port, mos7840_port); |
2449 | dev_dbg(&dev->dev, "Writing DCR0 failed status-0x%x\n", status); | 2356 | spin_lock_init(&mos7840_port->pool_lock); |
2450 | break; | 2357 | |
2451 | } else | 2358 | /* minor is not initialised until later by |
2452 | dev_dbg(&dev->dev, "DCR0 Writing success status%d\n", status); | 2359 | * usb-serial.c:get_free_serial() and cannot therefore be used |
2360 | * to index device instances */ | ||
2361 | mos7840_port->port_num = pnum + 1; | ||
2362 | dev_dbg(&port->dev, "port->number = %d\n", port->number); | ||
2363 | dev_dbg(&port->dev, "port->serial->minor = %d\n", port->serial->minor); | ||
2364 | dev_dbg(&port->dev, "mos7840_port->port_num = %d\n", mos7840_port->port_num); | ||
2365 | dev_dbg(&port->dev, "serial->minor = %d\n", serial->minor); | ||
2366 | |||
2367 | if (mos7840_port->port_num == 1) { | ||
2368 | mos7840_port->SpRegOffset = 0x0; | ||
2369 | mos7840_port->ControlRegOffset = 0x1; | ||
2370 | mos7840_port->DcrRegOffset = 0x4; | ||
2371 | } else if ((mos7840_port->port_num == 2) && (serial->num_ports == 4)) { | ||
2372 | mos7840_port->SpRegOffset = 0x8; | ||
2373 | mos7840_port->ControlRegOffset = 0x9; | ||
2374 | mos7840_port->DcrRegOffset = 0x16; | ||
2375 | } else if ((mos7840_port->port_num == 2) && (serial->num_ports == 2)) { | ||
2376 | mos7840_port->SpRegOffset = 0xa; | ||
2377 | mos7840_port->ControlRegOffset = 0xb; | ||
2378 | mos7840_port->DcrRegOffset = 0x19; | ||
2379 | } else if ((mos7840_port->port_num == 3) && (serial->num_ports == 4)) { | ||
2380 | mos7840_port->SpRegOffset = 0xa; | ||
2381 | mos7840_port->ControlRegOffset = 0xb; | ||
2382 | mos7840_port->DcrRegOffset = 0x19; | ||
2383 | } else if ((mos7840_port->port_num == 4) && (serial->num_ports == 4)) { | ||
2384 | mos7840_port->SpRegOffset = 0xc; | ||
2385 | mos7840_port->ControlRegOffset = 0xd; | ||
2386 | mos7840_port->DcrRegOffset = 0x1c; | ||
2387 | } | ||
2388 | mos7840_dump_serial_port(port, mos7840_port); | ||
2389 | mos7840_set_port_private(port, mos7840_port); | ||
2390 | |||
2391 | /* enable rx_disable bit in control register */ | ||
2392 | status = mos7840_get_reg_sync(port, | ||
2393 | mos7840_port->ControlRegOffset, &Data); | ||
2394 | if (status < 0) { | ||
2395 | dev_dbg(&port->dev, "Reading ControlReg failed status-0x%x\n", status); | ||
2396 | goto out; | ||
2397 | } else | ||
2398 | dev_dbg(&port->dev, "ControlReg Reading success val is %x, status%d\n", Data, status); | ||
2399 | Data |= 0x08; /* setting driver done bit */ | ||
2400 | Data |= 0x04; /* sp1_bit to have cts change reflect in | ||
2401 | modem status reg */ | ||
2453 | 2402 | ||
2454 | Data = 0x05; | 2403 | /* Data |= 0x20; //rx_disable bit */ |
2455 | status = mos7840_set_reg_sync(serial->port[i], | 2404 | status = mos7840_set_reg_sync(port, |
2456 | (__u16) (mos7840_port->DcrRegOffset + 1), Data); | 2405 | mos7840_port->ControlRegOffset, Data); |
2457 | if (status < 0) { | 2406 | if (status < 0) { |
2458 | dev_dbg(&dev->dev, "Writing DCR1 failed status-0x%x\n", status); | 2407 | dev_dbg(&port->dev, "Writing ControlReg failed(rx_disable) status-0x%x\n", status); |
2459 | break; | 2408 | goto out; |
2460 | } else | 2409 | } else |
2461 | dev_dbg(&dev->dev, "DCR1 Writing success status%d\n", status); | 2410 | dev_dbg(&port->dev, "ControlReg Writing success(rx_disable) status%d\n", status); |
2462 | 2411 | ||
2463 | Data = 0x24; | 2412 | /* Write default values in DCR (i.e 0x01 in DCR0, 0x05 in DCR2 |
2464 | status = mos7840_set_reg_sync(serial->port[i], | 2413 | and 0x24 in DCR3 */ |
2465 | (__u16) (mos7840_port->DcrRegOffset + 2), Data); | 2414 | Data = 0x01; |
2466 | if (status < 0) { | 2415 | status = mos7840_set_reg_sync(port, |
2467 | dev_dbg(&dev->dev, "Writing DCR2 failed status-0x%x\n", status); | 2416 | (__u16) (mos7840_port->DcrRegOffset + 0), Data); |
2468 | break; | 2417 | if (status < 0) { |
2469 | } else | 2418 | dev_dbg(&port->dev, "Writing DCR0 failed status-0x%x\n", status); |
2470 | dev_dbg(&dev->dev, "DCR2 Writing success status%d\n", status); | 2419 | goto out; |
2420 | } else | ||
2421 | dev_dbg(&port->dev, "DCR0 Writing success status%d\n", status); | ||
2471 | 2422 | ||
2472 | /* write values in clkstart0x0 and clkmulti 0x20 */ | 2423 | Data = 0x05; |
2473 | Data = 0x0; | 2424 | status = mos7840_set_reg_sync(port, |
2474 | status = mos7840_set_reg_sync(serial->port[i], | 2425 | (__u16) (mos7840_port->DcrRegOffset + 1), Data); |
2475 | CLK_START_VALUE_REGISTER, Data); | 2426 | if (status < 0) { |
2476 | if (status < 0) { | 2427 | dev_dbg(&port->dev, "Writing DCR1 failed status-0x%x\n", status); |
2477 | dev_dbg(&dev->dev, "Writing CLK_START_VALUE_REGISTER failed status-0x%x\n", status); | 2428 | goto out; |
2478 | break; | 2429 | } else |
2479 | } else | 2430 | dev_dbg(&port->dev, "DCR1 Writing success status%d\n", status); |
2480 | dev_dbg(&dev->dev, "CLK_START_VALUE_REGISTER Writing success status%d\n", status); | ||
2481 | 2431 | ||
2482 | Data = 0x20; | 2432 | Data = 0x24; |
2483 | status = mos7840_set_reg_sync(serial->port[i], | 2433 | status = mos7840_set_reg_sync(port, |
2484 | CLK_MULTI_REGISTER, Data); | 2434 | (__u16) (mos7840_port->DcrRegOffset + 2), Data); |
2485 | if (status < 0) { | 2435 | if (status < 0) { |
2486 | dev_dbg(&dev->dev, "Writing CLK_MULTI_REGISTER failed status-0x%x\n", status); | 2436 | dev_dbg(&port->dev, "Writing DCR2 failed status-0x%x\n", status); |
2487 | goto error; | 2437 | goto out; |
2488 | } else | 2438 | } else |
2489 | dev_dbg(&dev->dev, "CLK_MULTI_REGISTER Writing success status%d\n", status); | 2439 | dev_dbg(&port->dev, "DCR2 Writing success status%d\n", status); |
2490 | 2440 | ||
2491 | /* write value 0x0 to scratchpad register */ | 2441 | /* write values in clkstart0x0 and clkmulti 0x20 */ |
2492 | Data = 0x00; | 2442 | Data = 0x0; |
2493 | status = mos7840_set_uart_reg(serial->port[i], | 2443 | status = mos7840_set_reg_sync(port, CLK_START_VALUE_REGISTER, Data); |
2494 | SCRATCH_PAD_REGISTER, Data); | 2444 | if (status < 0) { |
2495 | if (status < 0) { | 2445 | dev_dbg(&port->dev, "Writing CLK_START_VALUE_REGISTER failed status-0x%x\n", status); |
2496 | dev_dbg(&dev->dev, "Writing SCRATCH_PAD_REGISTER failed status-0x%x\n", status); | 2446 | goto out; |
2497 | break; | 2447 | } else |
2498 | } else | 2448 | dev_dbg(&port->dev, "CLK_START_VALUE_REGISTER Writing success status%d\n", status); |
2499 | dev_dbg(&dev->dev, "SCRATCH_PAD_REGISTER Writing success status%d\n", status); | ||
2500 | 2449 | ||
2501 | /* Zero Length flag register */ | 2450 | Data = 0x20; |
2502 | if ((mos7840_port->port_num != 1) | 2451 | status = mos7840_set_reg_sync(port, CLK_MULTI_REGISTER, Data); |
2503 | && (serial->num_ports == 2)) { | 2452 | if (status < 0) { |
2453 | dev_dbg(&port->dev, "Writing CLK_MULTI_REGISTER failed status-0x%x\n", status); | ||
2454 | goto error; | ||
2455 | } else | ||
2456 | dev_dbg(&port->dev, "CLK_MULTI_REGISTER Writing success status%d\n", status); | ||
2504 | 2457 | ||
2505 | Data = 0xff; | 2458 | /* write value 0x0 to scratchpad register */ |
2506 | status = mos7840_set_reg_sync(serial->port[i], | 2459 | Data = 0x00; |
2507 | (__u16) (ZLP_REG1 + | 2460 | status = mos7840_set_uart_reg(port, SCRATCH_PAD_REGISTER, Data); |
2508 | ((__u16)mos7840_port->port_num)), Data); | 2461 | if (status < 0) { |
2509 | dev_dbg(&dev->dev, "ZLIP offset %x\n", | 2462 | dev_dbg(&port->dev, "Writing SCRATCH_PAD_REGISTER failed status-0x%x\n", status); |
2463 | goto out; | ||
2464 | } else | ||
2465 | dev_dbg(&port->dev, "SCRATCH_PAD_REGISTER Writing success status%d\n", status); | ||
2466 | |||
2467 | /* Zero Length flag register */ | ||
2468 | if ((mos7840_port->port_num != 1) && (serial->num_ports == 2)) { | ||
2469 | Data = 0xff; | ||
2470 | status = mos7840_set_reg_sync(port, | ||
2471 | (__u16) (ZLP_REG1 + | ||
2472 | ((__u16)mos7840_port->port_num)), Data); | ||
2473 | dev_dbg(&port->dev, "ZLIP offset %x\n", | ||
2510 | (__u16)(ZLP_REG1 + ((__u16) mos7840_port->port_num))); | 2474 | (__u16)(ZLP_REG1 + ((__u16) mos7840_port->port_num))); |
2511 | if (status < 0) { | 2475 | if (status < 0) { |
2512 | dev_dbg(&dev->dev, "Writing ZLP_REG%d failed status-0x%x\n", i + 2, status); | 2476 | dev_dbg(&port->dev, "Writing ZLP_REG%d failed status-0x%x\n", pnum + 2, status); |
2513 | break; | 2477 | goto out; |
2514 | } else | 2478 | } else |
2515 | dev_dbg(&dev->dev, "ZLP_REG%d Writing success status%d\n", i + 2, status); | 2479 | dev_dbg(&port->dev, "ZLP_REG%d Writing success status%d\n", pnum + 2, status); |
2516 | } else { | 2480 | } else { |
2517 | Data = 0xff; | 2481 | Data = 0xff; |
2518 | status = mos7840_set_reg_sync(serial->port[i], | 2482 | status = mos7840_set_reg_sync(port, |
2519 | (__u16) (ZLP_REG1 + | 2483 | (__u16) (ZLP_REG1 + |
2520 | ((__u16)mos7840_port->port_num) - 0x1), Data); | 2484 | ((__u16)mos7840_port->port_num) - 0x1), Data); |
2521 | dev_dbg(&dev->dev, "ZLIP offset %x\n", | 2485 | dev_dbg(&port->dev, "ZLIP offset %x\n", |
2522 | (__u16)(ZLP_REG1 + ((__u16) mos7840_port->port_num) - 0x1)); | 2486 | (__u16)(ZLP_REG1 + ((__u16) mos7840_port->port_num) - 0x1)); |
2523 | if (status < 0) { | 2487 | if (status < 0) { |
2524 | dev_dbg(&dev->dev, "Writing ZLP_REG%d failed status-0x%x\n", i + 1, status); | 2488 | dev_dbg(&port->dev, "Writing ZLP_REG%d failed status-0x%x\n", pnum + 1, status); |
2525 | break; | 2489 | goto out; |
2526 | } else | 2490 | } else |
2527 | dev_dbg(&dev->dev, "ZLP_REG%d Writing success status%d\n", i + 1, status); | 2491 | dev_dbg(&port->dev, "ZLP_REG%d Writing success status%d\n", pnum + 1, status); |
2528 | 2492 | ||
2529 | } | 2493 | } |
2530 | mos7840_port->control_urb = usb_alloc_urb(0, GFP_KERNEL); | 2494 | mos7840_port->control_urb = usb_alloc_urb(0, GFP_KERNEL); |
2531 | mos7840_port->ctrl_buf = kmalloc(16, GFP_KERNEL); | 2495 | mos7840_port->ctrl_buf = kmalloc(16, GFP_KERNEL); |
2532 | mos7840_port->dr = kmalloc(sizeof(struct usb_ctrlrequest), | 2496 | mos7840_port->dr = kmalloc(sizeof(struct usb_ctrlrequest), |
2533 | GFP_KERNEL); | 2497 | GFP_KERNEL); |
2534 | if (!mos7840_port->control_urb || !mos7840_port->ctrl_buf || | 2498 | if (!mos7840_port->control_urb || !mos7840_port->ctrl_buf || |
2535 | !mos7840_port->dr) { | 2499 | !mos7840_port->dr) { |
2536 | status = -ENOMEM; | 2500 | status = -ENOMEM; |
2537 | goto error; | 2501 | goto error; |
2538 | } | 2502 | } |
2539 | 2503 | ||
2540 | mos7840_port->has_led = false; | 2504 | mos7840_port->has_led = false; |
2541 | 2505 | ||
2542 | /* Initialize LED timers */ | 2506 | /* Initialize LED timers */ |
2543 | if (device_type == MOSCHIP_DEVICE_ID_7810) { | 2507 | if (device_type == MOSCHIP_DEVICE_ID_7810) { |
2544 | mos7840_port->has_led = true; | 2508 | mos7840_port->has_led = true; |
2545 | 2509 | ||
2546 | init_timer(&mos7840_port->led_timer1); | 2510 | init_timer(&mos7840_port->led_timer1); |
2547 | mos7840_port->led_timer1.function = mos7840_led_off; | 2511 | mos7840_port->led_timer1.function = mos7840_led_off; |
2548 | mos7840_port->led_timer1.expires = | 2512 | mos7840_port->led_timer1.expires = |
2549 | jiffies + msecs_to_jiffies(LED_ON_MS); | 2513 | jiffies + msecs_to_jiffies(LED_ON_MS); |
2550 | mos7840_port->led_timer1.data = | 2514 | mos7840_port->led_timer1.data = (unsigned long)mos7840_port; |
2551 | (unsigned long)mos7840_port; | ||
2552 | 2515 | ||
2553 | init_timer(&mos7840_port->led_timer2); | 2516 | init_timer(&mos7840_port->led_timer2); |
2554 | mos7840_port->led_timer2.function = | 2517 | mos7840_port->led_timer2.function = mos7840_led_flag_off; |
2555 | mos7840_led_flag_off; | 2518 | mos7840_port->led_timer2.expires = |
2556 | mos7840_port->led_timer2.expires = | 2519 | jiffies + msecs_to_jiffies(LED_OFF_MS); |
2557 | jiffies + msecs_to_jiffies(LED_OFF_MS); | 2520 | mos7840_port->led_timer2.data = (unsigned long)mos7840_port; |
2558 | mos7840_port->led_timer2.data = | ||
2559 | (unsigned long)mos7840_port; | ||
2560 | 2521 | ||
2561 | mos7840_port->led_flag = false; | 2522 | mos7840_port->led_flag = false; |
2562 | 2523 | ||
2563 | /* Turn off LED */ | 2524 | /* Turn off LED */ |
2564 | mos7840_set_led_sync(serial->port[i], | 2525 | mos7840_set_led_sync(port, MODEM_CONTROL_REGISTER, 0x0300); |
2565 | MODEM_CONTROL_REGISTER, 0x0300); | ||
2566 | } | ||
2567 | } | 2526 | } |
2527 | out: | ||
2528 | if (pnum == serial->num_ports - 1) { | ||
2529 | /* Zero Length flag enable */ | ||
2530 | Data = 0x0f; | ||
2531 | status = mos7840_set_reg_sync(serial->port[0], ZLP_REG5, Data); | ||
2532 | if (status < 0) { | ||
2533 | dev_dbg(&port->dev, "Writing ZLP_REG5 failed status-0x%x\n", status); | ||
2534 | goto error; | ||
2535 | } else | ||
2536 | dev_dbg(&port->dev, "ZLP_REG5 Writing success status%d\n", status); | ||
2568 | 2537 | ||
2569 | /* Zero Length flag enable */ | 2538 | /* setting configuration feature to one */ |
2570 | Data = 0x0f; | 2539 | usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0), |
2571 | status = mos7840_set_reg_sync(serial->port[0], ZLP_REG5, Data); | 2540 | 0x03, 0x00, 0x01, 0x00, NULL, 0x00, |
2572 | if (status < 0) { | 2541 | MOS_WDR_TIMEOUT); |
2573 | dev_dbg(&dev->dev, "Writing ZLP_REG5 failed status-0x%x\n", status); | 2542 | } |
2574 | goto error; | ||
2575 | } else | ||
2576 | dev_dbg(&dev->dev, "ZLP_REG5 Writing success status%d\n", status); | ||
2577 | |||
2578 | /* setting configuration feature to one */ | ||
2579 | usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0), | ||
2580 | (__u8) 0x03, 0x00, 0x01, 0x00, NULL, 0x00, MOS_WDR_TIMEOUT); | ||
2581 | return 0; | 2543 | return 0; |
2582 | error: | 2544 | error: |
2583 | for (/* nothing */; i >= 0; i--) { | 2545 | kfree(mos7840_port->dr); |
2584 | mos7840_port = mos7840_get_port_private(serial->port[i]); | 2546 | kfree(mos7840_port->ctrl_buf); |
2547 | usb_free_urb(mos7840_port->control_urb); | ||
2548 | kfree(mos7840_port); | ||
2585 | 2549 | ||
2586 | kfree(mos7840_port->dr); | ||
2587 | kfree(mos7840_port->ctrl_buf); | ||
2588 | usb_free_urb(mos7840_port->control_urb); | ||
2589 | kfree(mos7840_port); | ||
2590 | serial->port[i] = NULL; | ||
2591 | } | ||
2592 | return status; | 2550 | return status; |
2593 | } | 2551 | } |
2594 | 2552 | ||
2595 | /**************************************************************************** | 2553 | static int mos7840_port_remove(struct usb_serial_port *port) |
2596 | * mos7840_disconnect | ||
2597 | * This function is called whenever the device is removed from the usb bus. | ||
2598 | ****************************************************************************/ | ||
2599 | |||
2600 | static void mos7840_disconnect(struct usb_serial *serial) | ||
2601 | { | 2554 | { |
2602 | int i; | ||
2603 | unsigned long flags; | ||
2604 | struct moschip_port *mos7840_port; | 2555 | struct moschip_port *mos7840_port; |
2605 | 2556 | ||
2606 | /* check for the ports to be closed,close the ports and disconnect */ | 2557 | mos7840_port = mos7840_get_port_private(port); |
2607 | 2558 | ||
2608 | /* free private structure allocated for serial port * | 2559 | if (mos7840_port->has_led) { |
2609 | * stop reads and writes on all ports */ | 2560 | /* Turn off LED */ |
2561 | mos7840_set_led_sync(port, MODEM_CONTROL_REGISTER, 0x0300); | ||
2610 | 2562 | ||
2611 | for (i = 0; i < serial->num_ports; ++i) { | 2563 | del_timer_sync(&mos7840_port->led_timer1); |
2612 | mos7840_port = mos7840_get_port_private(serial->port[i]); | 2564 | del_timer_sync(&mos7840_port->led_timer2); |
2613 | if (mos7840_port) { | ||
2614 | spin_lock_irqsave(&mos7840_port->pool_lock, flags); | ||
2615 | mos7840_port->zombie = 1; | ||
2616 | spin_unlock_irqrestore(&mos7840_port->pool_lock, flags); | ||
2617 | usb_kill_urb(mos7840_port->control_urb); | ||
2618 | } | ||
2619 | } | 2565 | } |
2620 | } | 2566 | usb_kill_urb(mos7840_port->control_urb); |
2621 | 2567 | usb_free_urb(mos7840_port->control_urb); | |
2622 | /**************************************************************************** | 2568 | kfree(mos7840_port->ctrl_buf); |
2623 | * mos7840_release | 2569 | kfree(mos7840_port->dr); |
2624 | * This function is called when the usb_serial structure is freed. | 2570 | kfree(mos7840_port); |
2625 | ****************************************************************************/ | ||
2626 | |||
2627 | static void mos7840_release(struct usb_serial *serial) | ||
2628 | { | ||
2629 | int i; | ||
2630 | struct moschip_port *mos7840_port; | ||
2631 | |||
2632 | /* check for the ports to be closed,close the ports and disconnect */ | ||
2633 | 2571 | ||
2634 | /* free private structure allocated for serial port * | 2572 | return 0; |
2635 | * stop reads and writes on all ports */ | ||
2636 | |||
2637 | for (i = 0; i < serial->num_ports; ++i) { | ||
2638 | mos7840_port = mos7840_get_port_private(serial->port[i]); | ||
2639 | if (mos7840_port) { | ||
2640 | if (mos7840_port->has_led) { | ||
2641 | /* Turn off LED */ | ||
2642 | mos7840_set_led_sync(mos7840_port->port, | ||
2643 | MODEM_CONTROL_REGISTER, 0x0300); | ||
2644 | |||
2645 | del_timer_sync(&mos7840_port->led_timer1); | ||
2646 | del_timer_sync(&mos7840_port->led_timer2); | ||
2647 | } | ||
2648 | kfree(mos7840_port->ctrl_buf); | ||
2649 | kfree(mos7840_port->dr); | ||
2650 | kfree(mos7840_port); | ||
2651 | } | ||
2652 | } | ||
2653 | } | 2573 | } |
2654 | 2574 | ||
2655 | static struct usb_serial_driver moschip7840_4port_device = { | 2575 | static struct usb_serial_driver moschip7840_4port_device = { |
@@ -2677,9 +2597,8 @@ static struct usb_serial_driver moschip7840_4port_device = { | |||
2677 | .tiocmget = mos7840_tiocmget, | 2597 | .tiocmget = mos7840_tiocmget, |
2678 | .tiocmset = mos7840_tiocmset, | 2598 | .tiocmset = mos7840_tiocmset, |
2679 | .get_icount = mos7840_get_icount, | 2599 | .get_icount = mos7840_get_icount, |
2680 | .attach = mos7840_startup, | 2600 | .port_probe = mos7840_port_probe, |
2681 | .disconnect = mos7840_disconnect, | 2601 | .port_remove = mos7840_port_remove, |
2682 | .release = mos7840_release, | ||
2683 | .read_bulk_callback = mos7840_bulk_in_callback, | 2602 | .read_bulk_callback = mos7840_bulk_in_callback, |
2684 | .read_int_callback = mos7840_interrupt_callback, | 2603 | .read_int_callback = mos7840_interrupt_callback, |
2685 | }; | 2604 | }; |
diff --git a/drivers/usb/serial/omninet.c b/drivers/usb/serial/omninet.c index 6def58b79382..9ab73d295774 100644 --- a/drivers/usb/serial/omninet.c +++ b/drivers/usb/serial/omninet.c | |||
@@ -44,8 +44,8 @@ static int omninet_write(struct tty_struct *tty, struct usb_serial_port *port, | |||
44 | const unsigned char *buf, int count); | 44 | const unsigned char *buf, int count); |
45 | static int omninet_write_room(struct tty_struct *tty); | 45 | static int omninet_write_room(struct tty_struct *tty); |
46 | static void omninet_disconnect(struct usb_serial *serial); | 46 | static void omninet_disconnect(struct usb_serial *serial); |
47 | static void omninet_release(struct usb_serial *serial); | 47 | static int omninet_port_probe(struct usb_serial_port *port); |
48 | static int omninet_attach(struct usb_serial *serial); | 48 | static int omninet_port_remove(struct usb_serial_port *port); |
49 | 49 | ||
50 | static const struct usb_device_id id_table[] = { | 50 | static const struct usb_device_id id_table[] = { |
51 | { USB_DEVICE(ZYXEL_VENDOR_ID, ZYXEL_OMNINET_ID) }, | 51 | { USB_DEVICE(ZYXEL_VENDOR_ID, ZYXEL_OMNINET_ID) }, |
@@ -62,7 +62,8 @@ static struct usb_serial_driver zyxel_omninet_device = { | |||
62 | .description = "ZyXEL - omni.net lcd plus usb", | 62 | .description = "ZyXEL - omni.net lcd plus usb", |
63 | .id_table = id_table, | 63 | .id_table = id_table, |
64 | .num_ports = 1, | 64 | .num_ports = 1, |
65 | .attach = omninet_attach, | 65 | .port_probe = omninet_port_probe, |
66 | .port_remove = omninet_port_remove, | ||
66 | .open = omninet_open, | 67 | .open = omninet_open, |
67 | .close = omninet_close, | 68 | .close = omninet_close, |
68 | .write = omninet_write, | 69 | .write = omninet_write, |
@@ -70,7 +71,6 @@ static struct usb_serial_driver zyxel_omninet_device = { | |||
70 | .read_bulk_callback = omninet_read_bulk_callback, | 71 | .read_bulk_callback = omninet_read_bulk_callback, |
71 | .write_bulk_callback = omninet_write_bulk_callback, | 72 | .write_bulk_callback = omninet_write_bulk_callback, |
72 | .disconnect = omninet_disconnect, | 73 | .disconnect = omninet_disconnect, |
73 | .release = omninet_release, | ||
74 | }; | 74 | }; |
75 | 75 | ||
76 | static struct usb_serial_driver * const serial_drivers[] = { | 76 | static struct usb_serial_driver * const serial_drivers[] = { |
@@ -112,18 +112,26 @@ struct omninet_data { | |||
112 | __u8 od_outseq; /* Sequence number for bulk_out URBs */ | 112 | __u8 od_outseq; /* Sequence number for bulk_out URBs */ |
113 | }; | 113 | }; |
114 | 114 | ||
115 | static int omninet_attach(struct usb_serial *serial) | 115 | static int omninet_port_probe(struct usb_serial_port *port) |
116 | { | 116 | { |
117 | struct omninet_data *od; | 117 | struct omninet_data *od; |
118 | struct usb_serial_port *port = serial->port[0]; | ||
119 | 118 | ||
120 | od = kmalloc(sizeof(struct omninet_data), GFP_KERNEL); | 119 | od = kmalloc(sizeof(struct omninet_data), GFP_KERNEL); |
121 | if (!od) { | 120 | if (!od) |
122 | dev_err(&port->dev, "%s- kmalloc(%Zd) failed.\n", | ||
123 | __func__, sizeof(struct omninet_data)); | ||
124 | return -ENOMEM; | 121 | return -ENOMEM; |
125 | } | 122 | |
126 | usb_set_serial_port_data(port, od); | 123 | usb_set_serial_port_data(port, od); |
124 | |||
125 | return 0; | ||
126 | } | ||
127 | |||
128 | static int omninet_port_remove(struct usb_serial_port *port) | ||
129 | { | ||
130 | struct omninet_data *od; | ||
131 | |||
132 | od = usb_get_serial_port_data(port); | ||
133 | kfree(od); | ||
134 | |||
127 | return 0; | 135 | return 0; |
128 | } | 136 | } |
129 | 137 | ||
@@ -279,14 +287,6 @@ static void omninet_disconnect(struct usb_serial *serial) | |||
279 | usb_kill_urb(wport->write_urb); | 287 | usb_kill_urb(wport->write_urb); |
280 | } | 288 | } |
281 | 289 | ||
282 | |||
283 | static void omninet_release(struct usb_serial *serial) | ||
284 | { | ||
285 | struct usb_serial_port *port = serial->port[0]; | ||
286 | |||
287 | kfree(usb_get_serial_port_data(port)); | ||
288 | } | ||
289 | |||
290 | module_usb_serial_driver(serial_drivers, id_table); | 290 | module_usb_serial_driver(serial_drivers, id_table); |
291 | 291 | ||
292 | MODULE_AUTHOR(DRIVER_AUTHOR); | 292 | MODULE_AUTHOR(DRIVER_AUTHOR); |
diff --git a/drivers/usb/serial/opticon.c b/drivers/usb/serial/opticon.c index 41b1647306eb..6aba731d4864 100644 --- a/drivers/usb/serial/opticon.c +++ b/drivers/usb/serial/opticon.c | |||
@@ -155,7 +155,11 @@ static int send_control_msg(struct usb_serial_port *port, u8 requesttype, | |||
155 | { | 155 | { |
156 | struct usb_serial *serial = port->serial; | 156 | struct usb_serial *serial = port->serial; |
157 | int retval; | 157 | int retval; |
158 | u8 buffer[2]; | 158 | u8 *buffer; |
159 | |||
160 | buffer = kzalloc(1, GFP_KERNEL); | ||
161 | if (!buffer) | ||
162 | return -ENOMEM; | ||
159 | 163 | ||
160 | buffer[0] = val; | 164 | buffer[0] = val; |
161 | /* Send the message to the vendor control endpoint | 165 | /* Send the message to the vendor control endpoint |
@@ -164,6 +168,7 @@ static int send_control_msg(struct usb_serial_port *port, u8 requesttype, | |||
164 | requesttype, | 168 | requesttype, |
165 | USB_DIR_OUT|USB_TYPE_VENDOR|USB_RECIP_INTERFACE, | 169 | USB_DIR_OUT|USB_TYPE_VENDOR|USB_RECIP_INTERFACE, |
166 | 0, 0, buffer, 1, 0); | 170 | 0, 0, buffer, 1, 0); |
171 | kfree(buffer); | ||
167 | 172 | ||
168 | return retval; | 173 | return retval; |
169 | } | 174 | } |
@@ -281,7 +286,7 @@ static int opticon_write(struct tty_struct *tty, struct usb_serial_port *port, | |||
281 | if (!dr) { | 286 | if (!dr) { |
282 | dev_err(&port->dev, "out of memory\n"); | 287 | dev_err(&port->dev, "out of memory\n"); |
283 | count = -ENOMEM; | 288 | count = -ENOMEM; |
284 | goto error; | 289 | goto error_no_dr; |
285 | } | 290 | } |
286 | 291 | ||
287 | dr->bRequestType = USB_TYPE_VENDOR | USB_RECIP_INTERFACE | USB_DIR_OUT; | 292 | dr->bRequestType = USB_TYPE_VENDOR | USB_RECIP_INTERFACE | USB_DIR_OUT; |
@@ -311,6 +316,8 @@ static int opticon_write(struct tty_struct *tty, struct usb_serial_port *port, | |||
311 | 316 | ||
312 | return count; | 317 | return count; |
313 | error: | 318 | error: |
319 | kfree(dr); | ||
320 | error_no_dr: | ||
314 | usb_free_urb(urb); | 321 | usb_free_urb(urb); |
315 | error_no_urb: | 322 | error_no_urb: |
316 | kfree(buffer); | 323 | kfree(buffer); |
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c index 54d4148d01d1..5dee7d61241e 100644 --- a/drivers/usb/serial/option.c +++ b/drivers/usb/serial/option.c | |||
@@ -47,6 +47,7 @@ | |||
47 | /* Function prototypes */ | 47 | /* Function prototypes */ |
48 | static int option_probe(struct usb_serial *serial, | 48 | static int option_probe(struct usb_serial *serial, |
49 | const struct usb_device_id *id); | 49 | const struct usb_device_id *id); |
50 | static int option_attach(struct usb_serial *serial); | ||
50 | static void option_release(struct usb_serial *serial); | 51 | static void option_release(struct usb_serial *serial); |
51 | static int option_send_setup(struct usb_serial_port *port); | 52 | static int option_send_setup(struct usb_serial_port *port); |
52 | static void option_instat_callback(struct urb *urb); | 53 | static void option_instat_callback(struct urb *urb); |
@@ -1288,8 +1289,9 @@ static struct usb_serial_driver option_1port_device = { | |||
1288 | .tiocmget = usb_wwan_tiocmget, | 1289 | .tiocmget = usb_wwan_tiocmget, |
1289 | .tiocmset = usb_wwan_tiocmset, | 1290 | .tiocmset = usb_wwan_tiocmset, |
1290 | .ioctl = usb_wwan_ioctl, | 1291 | .ioctl = usb_wwan_ioctl, |
1291 | .attach = usb_wwan_startup, | 1292 | .attach = option_attach, |
1292 | .release = option_release, | 1293 | .release = option_release, |
1294 | .port_probe = usb_wwan_port_probe, | ||
1293 | .port_remove = usb_wwan_port_remove, | 1295 | .port_remove = usb_wwan_port_remove, |
1294 | .read_int_callback = option_instat_callback, | 1296 | .read_int_callback = option_instat_callback, |
1295 | #ifdef CONFIG_PM | 1297 | #ifdef CONFIG_PM |
@@ -1335,8 +1337,6 @@ static bool is_blacklisted(const u8 ifnum, enum option_blacklist_reason reason, | |||
1335 | static int option_probe(struct usb_serial *serial, | 1337 | static int option_probe(struct usb_serial *serial, |
1336 | const struct usb_device_id *id) | 1338 | const struct usb_device_id *id) |
1337 | { | 1339 | { |
1338 | struct usb_wwan_intf_private *data; | ||
1339 | struct option_private *priv; | ||
1340 | struct usb_interface_descriptor *iface_desc = | 1340 | struct usb_interface_descriptor *iface_desc = |
1341 | &serial->interface->cur_altsetting->desc; | 1341 | &serial->interface->cur_altsetting->desc; |
1342 | struct usb_device_descriptor *dev_desc = &serial->dev->descriptor; | 1342 | struct usb_device_descriptor *dev_desc = &serial->dev->descriptor; |
@@ -1374,6 +1374,19 @@ static int option_probe(struct usb_serial *serial, | |||
1374 | iface_desc->bInterfaceClass != USB_CLASS_CDC_DATA) | 1374 | iface_desc->bInterfaceClass != USB_CLASS_CDC_DATA) |
1375 | return -ENODEV; | 1375 | return -ENODEV; |
1376 | 1376 | ||
1377 | /* Store device id so we can use it during attach. */ | ||
1378 | usb_set_serial_data(serial, (void *)id); | ||
1379 | |||
1380 | return 0; | ||
1381 | } | ||
1382 | |||
1383 | static int option_attach(struct usb_serial *serial) | ||
1384 | { | ||
1385 | struct usb_interface_descriptor *iface_desc; | ||
1386 | const struct usb_device_id *id; | ||
1387 | struct usb_wwan_intf_private *data; | ||
1388 | struct option_private *priv; | ||
1389 | |||
1377 | data = kzalloc(sizeof(struct usb_wwan_intf_private), GFP_KERNEL); | 1390 | data = kzalloc(sizeof(struct usb_wwan_intf_private), GFP_KERNEL); |
1378 | if (!data) | 1391 | if (!data) |
1379 | return -ENOMEM; | 1392 | return -ENOMEM; |
@@ -1384,6 +1397,10 @@ static int option_probe(struct usb_serial *serial, | |||
1384 | return -ENOMEM; | 1397 | return -ENOMEM; |
1385 | } | 1398 | } |
1386 | 1399 | ||
1400 | /* Retrieve device id stored at probe. */ | ||
1401 | id = usb_get_serial_data(serial); | ||
1402 | iface_desc = &serial->interface->cur_altsetting->desc; | ||
1403 | |||
1387 | priv->bInterfaceNumber = iface_desc->bInterfaceNumber; | 1404 | priv->bInterfaceNumber = iface_desc->bInterfaceNumber; |
1388 | data->private = priv; | 1405 | data->private = priv; |
1389 | 1406 | ||
diff --git a/drivers/usb/serial/qcserial.c b/drivers/usb/serial/qcserial.c index c3ddb65c05f2..aa148c21ea40 100644 --- a/drivers/usb/serial/qcserial.c +++ b/drivers/usb/serial/qcserial.c | |||
@@ -138,7 +138,6 @@ MODULE_DEVICE_TABLE(usb, id_table); | |||
138 | 138 | ||
139 | static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id) | 139 | static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id) |
140 | { | 140 | { |
141 | struct usb_wwan_intf_private *data; | ||
142 | struct usb_host_interface *intf = serial->interface->cur_altsetting; | 141 | struct usb_host_interface *intf = serial->interface->cur_altsetting; |
143 | struct device *dev = &serial->dev->dev; | 142 | struct device *dev = &serial->dev->dev; |
144 | int retval = -ENODEV; | 143 | int retval = -ENODEV; |
@@ -154,13 +153,6 @@ static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id) | |||
154 | ifnum = intf->desc.bInterfaceNumber; | 153 | ifnum = intf->desc.bInterfaceNumber; |
155 | dev_dbg(dev, "This Interface = %d\n", ifnum); | 154 | dev_dbg(dev, "This Interface = %d\n", ifnum); |
156 | 155 | ||
157 | data = kzalloc(sizeof(struct usb_wwan_intf_private), | ||
158 | GFP_KERNEL); | ||
159 | if (!data) | ||
160 | return -ENOMEM; | ||
161 | |||
162 | spin_lock_init(&data->susp_lock); | ||
163 | |||
164 | if (nintf == 1) { | 156 | if (nintf == 1) { |
165 | /* QDL mode */ | 157 | /* QDL mode */ |
166 | /* Gobi 2000 has a single altsetting, older ones have two */ | 158 | /* Gobi 2000 has a single altsetting, older ones have two */ |
@@ -253,20 +245,28 @@ done: | |||
253 | } | 245 | } |
254 | } | 246 | } |
255 | 247 | ||
256 | /* Set serial->private if not returning error */ | ||
257 | if (retval == 0) | ||
258 | usb_set_serial_data(serial, data); | ||
259 | else | ||
260 | kfree(data); | ||
261 | |||
262 | return retval; | 248 | return retval; |
263 | } | 249 | } |
264 | 250 | ||
251 | static int qc_attach(struct usb_serial *serial) | ||
252 | { | ||
253 | struct usb_wwan_intf_private *data; | ||
254 | |||
255 | data = kzalloc(sizeof(*data), GFP_KERNEL); | ||
256 | if (!data) | ||
257 | return -ENOMEM; | ||
258 | |||
259 | spin_lock_init(&data->susp_lock); | ||
260 | |||
261 | usb_set_serial_data(serial, data); | ||
262 | |||
263 | return 0; | ||
264 | } | ||
265 | |||
265 | static void qc_release(struct usb_serial *serial) | 266 | static void qc_release(struct usb_serial *serial) |
266 | { | 267 | { |
267 | struct usb_wwan_intf_private *priv = usb_get_serial_data(serial); | 268 | struct usb_wwan_intf_private *priv = usb_get_serial_data(serial); |
268 | 269 | ||
269 | /* Free the private data allocated in qcprobe */ | ||
270 | usb_set_serial_data(serial, NULL); | 270 | usb_set_serial_data(serial, NULL); |
271 | kfree(priv); | 271 | kfree(priv); |
272 | } | 272 | } |
@@ -285,8 +285,9 @@ static struct usb_serial_driver qcdevice = { | |||
285 | .write = usb_wwan_write, | 285 | .write = usb_wwan_write, |
286 | .write_room = usb_wwan_write_room, | 286 | .write_room = usb_wwan_write_room, |
287 | .chars_in_buffer = usb_wwan_chars_in_buffer, | 287 | .chars_in_buffer = usb_wwan_chars_in_buffer, |
288 | .attach = usb_wwan_startup, | 288 | .attach = qc_attach, |
289 | .release = qc_release, | 289 | .release = qc_release, |
290 | .port_probe = usb_wwan_port_probe, | ||
290 | .port_remove = usb_wwan_port_remove, | 291 | .port_remove = usb_wwan_port_remove, |
291 | #ifdef CONFIG_PM | 292 | #ifdef CONFIG_PM |
292 | .suspend = usb_wwan_suspend, | 293 | .suspend = usb_wwan_suspend, |
diff --git a/drivers/usb/serial/quatech2.c b/drivers/usb/serial/quatech2.c index 2cdfdcc90b37..ffcfc962ab10 100644 --- a/drivers/usb/serial/quatech2.c +++ b/drivers/usb/serial/quatech2.c | |||
@@ -143,12 +143,12 @@ static void qt2_read_bulk_callback(struct urb *urb); | |||
143 | 143 | ||
144 | static void qt2_release(struct usb_serial *serial) | 144 | static void qt2_release(struct usb_serial *serial) |
145 | { | 145 | { |
146 | int i; | 146 | struct qt2_serial_private *serial_priv; |
147 | 147 | ||
148 | kfree(usb_get_serial_data(serial)); | 148 | serial_priv = usb_get_serial_data(serial); |
149 | 149 | ||
150 | for (i = 0; i < serial->num_ports; i++) | 150 | usb_free_urb(serial_priv->read_urb); |
151 | kfree(usb_get_serial_port_data(serial->port[i])); | 151 | kfree(serial_priv); |
152 | } | 152 | } |
153 | 153 | ||
154 | static inline int calc_baud_divisor(int baudrate) | 154 | static inline int calc_baud_divisor(int baudrate) |
@@ -423,11 +423,16 @@ static void qt2_close(struct usb_serial_port *port) | |||
423 | port_priv->is_open = false; | 423 | port_priv->is_open = false; |
424 | 424 | ||
425 | spin_lock_irqsave(&port_priv->urb_lock, flags); | 425 | spin_lock_irqsave(&port_priv->urb_lock, flags); |
426 | if (port_priv->write_urb->status == -EINPROGRESS) | 426 | usb_kill_urb(port_priv->write_urb); |
427 | usb_kill_urb(port_priv->write_urb); | ||
428 | port_priv->urb_in_use = false; | 427 | port_priv->urb_in_use = false; |
429 | spin_unlock_irqrestore(&port_priv->urb_lock, flags); | 428 | spin_unlock_irqrestore(&port_priv->urb_lock, flags); |
430 | 429 | ||
430 | mutex_lock(&port->serial->disc_mutex); | ||
431 | if (port->serial->disconnected) { | ||
432 | mutex_unlock(&port->serial->disc_mutex); | ||
433 | return; | ||
434 | } | ||
435 | |||
431 | /* flush the port transmit buffer */ | 436 | /* flush the port transmit buffer */ |
432 | i = usb_control_msg(serial->dev, | 437 | i = usb_control_msg(serial->dev, |
433 | usb_rcvctrlpipe(serial->dev, 0), | 438 | usb_rcvctrlpipe(serial->dev, 0), |
@@ -459,26 +464,14 @@ static void qt2_close(struct usb_serial_port *port) | |||
459 | dev_err(&port->dev, "%s - close port failed %i\n", | 464 | dev_err(&port->dev, "%s - close port failed %i\n", |
460 | __func__, i); | 465 | __func__, i); |
461 | 466 | ||
467 | mutex_unlock(&port->serial->disc_mutex); | ||
462 | } | 468 | } |
463 | 469 | ||
464 | static void qt2_disconnect(struct usb_serial *serial) | 470 | static void qt2_disconnect(struct usb_serial *serial) |
465 | { | 471 | { |
466 | struct qt2_serial_private *serial_priv = usb_get_serial_data(serial); | 472 | struct qt2_serial_private *serial_priv = usb_get_serial_data(serial); |
467 | struct qt2_port_private *port_priv; | ||
468 | int i; | ||
469 | |||
470 | if (serial_priv->read_urb->status == -EINPROGRESS) | ||
471 | usb_kill_urb(serial_priv->read_urb); | ||
472 | |||
473 | usb_free_urb(serial_priv->read_urb); | ||
474 | 473 | ||
475 | for (i = 0; i < serial->num_ports; i++) { | 474 | usb_kill_urb(serial_priv->read_urb); |
476 | port_priv = usb_get_serial_port_data(serial->port[i]); | ||
477 | |||
478 | if (port_priv->write_urb->status == -EINPROGRESS) | ||
479 | usb_kill_urb(port_priv->write_urb); | ||
480 | usb_free_urb(port_priv->write_urb); | ||
481 | } | ||
482 | } | 475 | } |
483 | 476 | ||
484 | static int get_serial_info(struct usb_serial_port *port, | 477 | static int get_serial_info(struct usb_serial_port *port, |
@@ -773,11 +766,9 @@ static void qt2_read_bulk_callback(struct urb *urb) | |||
773 | 766 | ||
774 | static int qt2_setup_urbs(struct usb_serial *serial) | 767 | static int qt2_setup_urbs(struct usb_serial *serial) |
775 | { | 768 | { |
776 | struct usb_serial_port *port; | ||
777 | struct usb_serial_port *port0; | 769 | struct usb_serial_port *port0; |
778 | struct qt2_serial_private *serial_priv; | 770 | struct qt2_serial_private *serial_priv; |
779 | struct qt2_port_private *port_priv; | 771 | int status; |
780 | int pcount, status; | ||
781 | 772 | ||
782 | port0 = serial->port[0]; | 773 | port0 = serial->port[0]; |
783 | 774 | ||
@@ -795,46 +786,21 @@ static int qt2_setup_urbs(struct usb_serial *serial) | |||
795 | sizeof(serial_priv->read_buffer), | 786 | sizeof(serial_priv->read_buffer), |
796 | qt2_read_bulk_callback, serial); | 787 | qt2_read_bulk_callback, serial); |
797 | 788 | ||
798 | /* setup write_urb for each port */ | ||
799 | for (pcount = 0; pcount < serial->num_ports; pcount++) { | ||
800 | |||
801 | port = serial->port[pcount]; | ||
802 | port_priv = usb_get_serial_port_data(port); | ||
803 | |||
804 | port_priv->write_urb = usb_alloc_urb(0, GFP_KERNEL); | ||
805 | if (!port_priv->write_urb) { | ||
806 | dev_err(&serial->dev->dev, | ||
807 | "failed to alloc write_urb for port %i\n", | ||
808 | pcount); | ||
809 | return -ENOMEM; | ||
810 | } | ||
811 | |||
812 | usb_fill_bulk_urb(port_priv->write_urb, | ||
813 | serial->dev, | ||
814 | usb_sndbulkpipe(serial->dev, | ||
815 | port0-> | ||
816 | bulk_out_endpointAddress), | ||
817 | port_priv->write_buffer, | ||
818 | sizeof(port_priv->write_buffer), | ||
819 | qt2_write_bulk_callback, port); | ||
820 | } | ||
821 | |||
822 | status = usb_submit_urb(serial_priv->read_urb, GFP_KERNEL); | 789 | status = usb_submit_urb(serial_priv->read_urb, GFP_KERNEL); |
823 | if (status != 0) { | 790 | if (status != 0) { |
824 | dev_err(&serial->dev->dev, | 791 | dev_err(&serial->dev->dev, |
825 | "%s - submit read urb failed %i\n", __func__, status); | 792 | "%s - submit read urb failed %i\n", __func__, status); |
793 | usb_free_urb(serial_priv->read_urb); | ||
826 | return status; | 794 | return status; |
827 | } | 795 | } |
828 | 796 | ||
829 | return 0; | 797 | return 0; |
830 | |||
831 | } | 798 | } |
832 | 799 | ||
833 | static int qt2_attach(struct usb_serial *serial) | 800 | static int qt2_attach(struct usb_serial *serial) |
834 | { | 801 | { |
835 | struct qt2_serial_private *serial_priv; | 802 | struct qt2_serial_private *serial_priv; |
836 | struct qt2_port_private *port_priv; | 803 | int status; |
837 | int status, pcount; | ||
838 | 804 | ||
839 | /* power on unit */ | 805 | /* power on unit */ |
840 | status = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0), | 806 | status = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0), |
@@ -854,26 +820,6 @@ static int qt2_attach(struct usb_serial *serial) | |||
854 | 820 | ||
855 | usb_set_serial_data(serial, serial_priv); | 821 | usb_set_serial_data(serial, serial_priv); |
856 | 822 | ||
857 | for (pcount = 0; pcount < serial->num_ports; pcount++) { | ||
858 | port_priv = kzalloc(sizeof(*port_priv), GFP_KERNEL); | ||
859 | if (!port_priv) { | ||
860 | dev_err(&serial->dev->dev, | ||
861 | "%s- kmalloc(%Zd) failed.\n", __func__, | ||
862 | sizeof(*port_priv)); | ||
863 | pcount--; | ||
864 | status = -ENOMEM; | ||
865 | goto attach_failed; | ||
866 | } | ||
867 | |||
868 | spin_lock_init(&port_priv->lock); | ||
869 | spin_lock_init(&port_priv->urb_lock); | ||
870 | init_waitqueue_head(&port_priv->delta_msr_wait); | ||
871 | |||
872 | port_priv->port = serial->port[pcount]; | ||
873 | |||
874 | usb_set_serial_port_data(serial->port[pcount], port_priv); | ||
875 | } | ||
876 | |||
877 | status = qt2_setup_urbs(serial); | 823 | status = qt2_setup_urbs(serial); |
878 | if (status != 0) | 824 | if (status != 0) |
879 | goto attach_failed; | 825 | goto attach_failed; |
@@ -881,14 +827,53 @@ static int qt2_attach(struct usb_serial *serial) | |||
881 | return 0; | 827 | return 0; |
882 | 828 | ||
883 | attach_failed: | 829 | attach_failed: |
884 | for (/* empty */; pcount >= 0; pcount--) { | ||
885 | port_priv = usb_get_serial_port_data(serial->port[pcount]); | ||
886 | kfree(port_priv); | ||
887 | } | ||
888 | kfree(serial_priv); | 830 | kfree(serial_priv); |
889 | return status; | 831 | return status; |
890 | } | 832 | } |
891 | 833 | ||
834 | static int qt2_port_probe(struct usb_serial_port *port) | ||
835 | { | ||
836 | struct usb_serial *serial = port->serial; | ||
837 | struct qt2_port_private *port_priv; | ||
838 | u8 bEndpointAddress; | ||
839 | |||
840 | port_priv = kzalloc(sizeof(*port_priv), GFP_KERNEL); | ||
841 | if (!port_priv) | ||
842 | return -ENOMEM; | ||
843 | |||
844 | spin_lock_init(&port_priv->lock); | ||
845 | spin_lock_init(&port_priv->urb_lock); | ||
846 | init_waitqueue_head(&port_priv->delta_msr_wait); | ||
847 | port_priv->port = port; | ||
848 | |||
849 | port_priv->write_urb = usb_alloc_urb(0, GFP_KERNEL); | ||
850 | if (!port_priv->write_urb) { | ||
851 | kfree(port_priv); | ||
852 | return -ENOMEM; | ||
853 | } | ||
854 | bEndpointAddress = serial->port[0]->bulk_out_endpointAddress; | ||
855 | usb_fill_bulk_urb(port_priv->write_urb, serial->dev, | ||
856 | usb_sndbulkpipe(serial->dev, bEndpointAddress), | ||
857 | port_priv->write_buffer, | ||
858 | sizeof(port_priv->write_buffer), | ||
859 | qt2_write_bulk_callback, port); | ||
860 | |||
861 | usb_set_serial_port_data(port, port_priv); | ||
862 | |||
863 | return 0; | ||
864 | } | ||
865 | |||
866 | static int qt2_port_remove(struct usb_serial_port *port) | ||
867 | { | ||
868 | struct qt2_port_private *port_priv; | ||
869 | |||
870 | port_priv = usb_get_serial_port_data(port); | ||
871 | usb_free_urb(port_priv->write_urb); | ||
872 | kfree(port_priv); | ||
873 | |||
874 | return 0; | ||
875 | } | ||
876 | |||
892 | static int qt2_tiocmget(struct tty_struct *tty) | 877 | static int qt2_tiocmget(struct tty_struct *tty) |
893 | { | 878 | { |
894 | struct usb_serial_port *port = tty->driver_data; | 879 | struct usb_serial_port *port = tty->driver_data; |
@@ -1127,6 +1112,8 @@ static struct usb_serial_driver qt2_device = { | |||
1127 | .attach = qt2_attach, | 1112 | .attach = qt2_attach, |
1128 | .release = qt2_release, | 1113 | .release = qt2_release, |
1129 | .disconnect = qt2_disconnect, | 1114 | .disconnect = qt2_disconnect, |
1115 | .port_probe = qt2_port_probe, | ||
1116 | .port_remove = qt2_port_remove, | ||
1130 | .dtr_rts = qt2_dtr_rts, | 1117 | .dtr_rts = qt2_dtr_rts, |
1131 | .break_ctl = qt2_break_ctl, | 1118 | .break_ctl = qt2_break_ctl, |
1132 | .tiocmget = qt2_tiocmget, | 1119 | .tiocmget = qt2_tiocmget, |
diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c index 01d882cf3775..270860f6bb2a 100644 --- a/drivers/usb/serial/sierra.c +++ b/drivers/usb/serial/sierra.c | |||
@@ -161,7 +161,6 @@ static int sierra_probe(struct usb_serial *serial, | |||
161 | { | 161 | { |
162 | int result = 0; | 162 | int result = 0; |
163 | struct usb_device *udev; | 163 | struct usb_device *udev; |
164 | struct sierra_intf_private *data; | ||
165 | u8 ifnum; | 164 | u8 ifnum; |
166 | 165 | ||
167 | udev = serial->dev; | 166 | udev = serial->dev; |
@@ -188,11 +187,6 @@ static int sierra_probe(struct usb_serial *serial, | |||
188 | return -ENODEV; | 187 | return -ENODEV; |
189 | } | 188 | } |
190 | 189 | ||
191 | data = serial->private = kzalloc(sizeof(struct sierra_intf_private), GFP_KERNEL); | ||
192 | if (!data) | ||
193 | return -ENOMEM; | ||
194 | spin_lock_init(&data->susp_lock); | ||
195 | |||
196 | return result; | 190 | return result; |
197 | } | 191 | } |
198 | 192 | ||
@@ -884,11 +878,15 @@ static void sierra_dtr_rts(struct usb_serial_port *port, int on) | |||
884 | 878 | ||
885 | static int sierra_startup(struct usb_serial *serial) | 879 | static int sierra_startup(struct usb_serial *serial) |
886 | { | 880 | { |
887 | struct usb_serial_port *port; | 881 | struct sierra_intf_private *intfdata; |
888 | struct sierra_port_private *portdata; | 882 | |
889 | struct sierra_iface_info *himemoryp = NULL; | 883 | intfdata = kzalloc(sizeof(*intfdata), GFP_KERNEL); |
890 | int i; | 884 | if (!intfdata) |
891 | u8 ifnum; | 885 | return -ENOMEM; |
886 | |||
887 | spin_lock_init(&intfdata->susp_lock); | ||
888 | |||
889 | usb_set_serial_data(serial, intfdata); | ||
892 | 890 | ||
893 | /* Set Device mode to D0 */ | 891 | /* Set Device mode to D0 */ |
894 | sierra_set_power_state(serial->dev, 0x0000); | 892 | sierra_set_power_state(serial->dev, 0x0000); |
@@ -897,68 +895,71 @@ static int sierra_startup(struct usb_serial *serial) | |||
897 | if (nmea) | 895 | if (nmea) |
898 | sierra_vsc_set_nmea(serial->dev, 1); | 896 | sierra_vsc_set_nmea(serial->dev, 1); |
899 | 897 | ||
900 | /* Now setup per port private data */ | ||
901 | for (i = 0; i < serial->num_ports; i++) { | ||
902 | port = serial->port[i]; | ||
903 | portdata = kzalloc(sizeof(*portdata), GFP_KERNEL); | ||
904 | if (!portdata) { | ||
905 | dev_dbg(&port->dev, "%s: kmalloc for " | ||
906 | "sierra_port_private (%d) failed!\n", | ||
907 | __func__, i); | ||
908 | return -ENOMEM; | ||
909 | } | ||
910 | spin_lock_init(&portdata->lock); | ||
911 | init_usb_anchor(&portdata->active); | ||
912 | init_usb_anchor(&portdata->delayed); | ||
913 | ifnum = i; | ||
914 | /* Assume low memory requirements */ | ||
915 | portdata->num_out_urbs = N_OUT_URB; | ||
916 | portdata->num_in_urbs = N_IN_URB; | ||
917 | |||
918 | /* Determine actual memory requirements */ | ||
919 | if (serial->num_ports == 1) { | ||
920 | /* Get interface number for composite device */ | ||
921 | ifnum = sierra_calc_interface(serial); | ||
922 | himemoryp = | ||
923 | (struct sierra_iface_info *)&typeB_interface_list; | ||
924 | if (is_himemory(ifnum, himemoryp)) { | ||
925 | portdata->num_out_urbs = N_OUT_URB_HM; | ||
926 | portdata->num_in_urbs = N_IN_URB_HM; | ||
927 | } | ||
928 | } | ||
929 | else { | ||
930 | himemoryp = | ||
931 | (struct sierra_iface_info *)&typeA_interface_list; | ||
932 | if (is_himemory(i, himemoryp)) { | ||
933 | portdata->num_out_urbs = N_OUT_URB_HM; | ||
934 | portdata->num_in_urbs = N_IN_URB_HM; | ||
935 | } | ||
936 | } | ||
937 | dev_dbg(&serial->dev->dev, | ||
938 | "Memory usage (urbs) interface #%d, in=%d, out=%d\n", | ||
939 | ifnum,portdata->num_in_urbs, portdata->num_out_urbs ); | ||
940 | /* Set the port private data pointer */ | ||
941 | usb_set_serial_port_data(port, portdata); | ||
942 | } | ||
943 | |||
944 | return 0; | 898 | return 0; |
945 | } | 899 | } |
946 | 900 | ||
947 | static void sierra_release(struct usb_serial *serial) | 901 | static void sierra_release(struct usb_serial *serial) |
948 | { | 902 | { |
949 | int i; | 903 | struct sierra_intf_private *intfdata; |
950 | struct usb_serial_port *port; | 904 | |
905 | intfdata = usb_get_serial_data(serial); | ||
906 | kfree(intfdata); | ||
907 | } | ||
908 | |||
909 | static int sierra_port_probe(struct usb_serial_port *port) | ||
910 | { | ||
911 | struct usb_serial *serial = port->serial; | ||
951 | struct sierra_port_private *portdata; | 912 | struct sierra_port_private *portdata; |
913 | const struct sierra_iface_info *himemoryp; | ||
914 | u8 ifnum; | ||
952 | 915 | ||
953 | for (i = 0; i < serial->num_ports; ++i) { | 916 | portdata = kzalloc(sizeof(*portdata), GFP_KERNEL); |
954 | port = serial->port[i]; | 917 | if (!portdata) |
955 | if (!port) | 918 | return -ENOMEM; |
956 | continue; | 919 | |
957 | portdata = usb_get_serial_port_data(port); | 920 | spin_lock_init(&portdata->lock); |
958 | if (!portdata) | 921 | init_usb_anchor(&portdata->active); |
959 | continue; | 922 | init_usb_anchor(&portdata->delayed); |
960 | kfree(portdata); | 923 | |
924 | /* Assume low memory requirements */ | ||
925 | portdata->num_out_urbs = N_OUT_URB; | ||
926 | portdata->num_in_urbs = N_IN_URB; | ||
927 | |||
928 | /* Determine actual memory requirements */ | ||
929 | if (serial->num_ports == 1) { | ||
930 | /* Get interface number for composite device */ | ||
931 | ifnum = sierra_calc_interface(serial); | ||
932 | himemoryp = &typeB_interface_list; | ||
933 | } else { | ||
934 | /* This is really the usb-serial port number of the interface | ||
935 | * rather than the interface number. | ||
936 | */ | ||
937 | ifnum = port->number - serial->minor; | ||
938 | himemoryp = &typeA_interface_list; | ||
961 | } | 939 | } |
940 | |||
941 | if (is_himemory(ifnum, himemoryp)) { | ||
942 | portdata->num_out_urbs = N_OUT_URB_HM; | ||
943 | portdata->num_in_urbs = N_IN_URB_HM; | ||
944 | } | ||
945 | |||
946 | dev_dbg(&port->dev, | ||
947 | "Memory usage (urbs) interface #%d, in=%d, out=%d\n", | ||
948 | ifnum, portdata->num_in_urbs, portdata->num_out_urbs); | ||
949 | |||
950 | usb_set_serial_port_data(port, portdata); | ||
951 | |||
952 | return 0; | ||
953 | } | ||
954 | |||
955 | static int sierra_port_remove(struct usb_serial_port *port) | ||
956 | { | ||
957 | struct sierra_port_private *portdata; | ||
958 | |||
959 | portdata = usb_get_serial_port_data(port); | ||
960 | kfree(portdata); | ||
961 | |||
962 | return 0; | ||
962 | } | 963 | } |
963 | 964 | ||
964 | #ifdef CONFIG_PM | 965 | #ifdef CONFIG_PM |
@@ -1062,6 +1063,8 @@ static struct usb_serial_driver sierra_device = { | |||
1062 | .tiocmset = sierra_tiocmset, | 1063 | .tiocmset = sierra_tiocmset, |
1063 | .attach = sierra_startup, | 1064 | .attach = sierra_startup, |
1064 | .release = sierra_release, | 1065 | .release = sierra_release, |
1066 | .port_probe = sierra_port_probe, | ||
1067 | .port_remove = sierra_port_remove, | ||
1065 | .suspend = sierra_suspend, | 1068 | .suspend = sierra_suspend, |
1066 | .resume = sierra_resume, | 1069 | .resume = sierra_resume, |
1067 | .read_int_callback = sierra_instat_callback, | 1070 | .read_int_callback = sierra_instat_callback, |
diff --git a/drivers/usb/serial/usb-wwan.h b/drivers/usb/serial/usb-wwan.h index 1f034d2397c6..684739b8efd0 100644 --- a/drivers/usb/serial/usb-wwan.h +++ b/drivers/usb/serial/usb-wwan.h | |||
@@ -8,7 +8,7 @@ | |||
8 | extern void usb_wwan_dtr_rts(struct usb_serial_port *port, int on); | 8 | extern void usb_wwan_dtr_rts(struct usb_serial_port *port, int on); |
9 | extern int usb_wwan_open(struct tty_struct *tty, struct usb_serial_port *port); | 9 | extern int usb_wwan_open(struct tty_struct *tty, struct usb_serial_port *port); |
10 | extern void usb_wwan_close(struct usb_serial_port *port); | 10 | extern void usb_wwan_close(struct usb_serial_port *port); |
11 | extern int usb_wwan_startup(struct usb_serial *serial); | 11 | extern int usb_wwan_port_probe(struct usb_serial_port *port); |
12 | extern int usb_wwan_port_remove(struct usb_serial_port *port); | 12 | extern int usb_wwan_port_remove(struct usb_serial_port *port); |
13 | extern int usb_wwan_write_room(struct tty_struct *tty); | 13 | extern int usb_wwan_write_room(struct tty_struct *tty); |
14 | extern void usb_wwan_set_termios(struct tty_struct *tty, | 14 | extern void usb_wwan_set_termios(struct tty_struct *tty, |
diff --git a/drivers/usb/serial/usb_wwan.c b/drivers/usb/serial/usb_wwan.c index e42aa398ed37..61a73ad1a187 100644 --- a/drivers/usb/serial/usb_wwan.c +++ b/drivers/usb/serial/usb_wwan.c | |||
@@ -447,10 +447,12 @@ void usb_wwan_close(struct usb_serial_port *port) | |||
447 | EXPORT_SYMBOL(usb_wwan_close); | 447 | EXPORT_SYMBOL(usb_wwan_close); |
448 | 448 | ||
449 | /* Helper functions used by usb_wwan_setup_urbs */ | 449 | /* Helper functions used by usb_wwan_setup_urbs */ |
450 | static struct urb *usb_wwan_setup_urb(struct usb_serial *serial, int endpoint, | 450 | static struct urb *usb_wwan_setup_urb(struct usb_serial_port *port, |
451 | int endpoint, | ||
451 | int dir, void *ctx, char *buf, int len, | 452 | int dir, void *ctx, char *buf, int len, |
452 | void (*callback) (struct urb *)) | 453 | void (*callback) (struct urb *)) |
453 | { | 454 | { |
455 | struct usb_serial *serial = port->serial; | ||
454 | struct urb *urb; | 456 | struct urb *urb; |
455 | 457 | ||
456 | if (endpoint == -1) | 458 | if (endpoint == -1) |
@@ -472,101 +474,75 @@ static struct urb *usb_wwan_setup_urb(struct usb_serial *serial, int endpoint, | |||
472 | return urb; | 474 | return urb; |
473 | } | 475 | } |
474 | 476 | ||
475 | /* Setup urbs */ | 477 | int usb_wwan_port_probe(struct usb_serial_port *port) |
476 | static void usb_wwan_setup_urbs(struct usb_serial *serial) | ||
477 | { | 478 | { |
478 | int i, j; | ||
479 | struct usb_serial_port *port; | ||
480 | struct usb_wwan_port_private *portdata; | 479 | struct usb_wwan_port_private *portdata; |
480 | struct urb *urb; | ||
481 | u8 *buffer; | ||
482 | int err; | ||
483 | int i; | ||
481 | 484 | ||
482 | for (i = 0; i < serial->num_ports; i++) { | 485 | portdata = kzalloc(sizeof(*portdata), GFP_KERNEL); |
483 | port = serial->port[i]; | 486 | if (!portdata) |
484 | portdata = usb_get_serial_port_data(port); | 487 | return -ENOMEM; |
485 | 488 | ||
486 | /* Do indat endpoints first */ | 489 | init_usb_anchor(&portdata->delayed); |
487 | for (j = 0; j < N_IN_URB; ++j) { | ||
488 | portdata->in_urbs[j] = usb_wwan_setup_urb(serial, | ||
489 | port-> | ||
490 | bulk_in_endpointAddress, | ||
491 | USB_DIR_IN, | ||
492 | port, | ||
493 | portdata-> | ||
494 | in_buffer[j], | ||
495 | IN_BUFLEN, | ||
496 | usb_wwan_indat_callback); | ||
497 | } | ||
498 | 490 | ||
499 | /* outdat endpoints */ | 491 | for (i = 0; i < N_IN_URB; i++) { |
500 | for (j = 0; j < N_OUT_URB; ++j) { | 492 | buffer = (u8 *)__get_free_page(GFP_KERNEL); |
501 | portdata->out_urbs[j] = usb_wwan_setup_urb(serial, | 493 | if (!buffer) |
502 | port-> | 494 | goto bail_out_error; |
503 | bulk_out_endpointAddress, | 495 | portdata->in_buffer[i] = buffer; |
504 | USB_DIR_OUT, | 496 | |
505 | port, | 497 | urb = usb_wwan_setup_urb(port, port->bulk_in_endpointAddress, |
506 | portdata-> | 498 | USB_DIR_IN, port, |
507 | out_buffer | 499 | buffer, IN_BUFLEN, |
508 | [j], | 500 | usb_wwan_indat_callback); |
509 | OUT_BUFLEN, | 501 | portdata->in_urbs[i] = urb; |
510 | usb_wwan_outdat_callback); | ||
511 | } | ||
512 | } | 502 | } |
513 | } | ||
514 | |||
515 | int usb_wwan_startup(struct usb_serial *serial) | ||
516 | { | ||
517 | int i, j, err; | ||
518 | struct usb_serial_port *port; | ||
519 | struct usb_wwan_port_private *portdata; | ||
520 | u8 *buffer; | ||
521 | 503 | ||
522 | /* Now setup per port private data */ | 504 | for (i = 0; i < N_OUT_URB; i++) { |
523 | for (i = 0; i < serial->num_ports; i++) { | 505 | if (port->bulk_out_endpointAddress == -1) |
524 | port = serial->port[i]; | 506 | continue; |
525 | portdata = kzalloc(sizeof(*portdata), GFP_KERNEL); | ||
526 | if (!portdata) { | ||
527 | dev_dbg(&port->dev, "%s: kmalloc for usb_wwan_port_private (%d) failed!.\n", | ||
528 | __func__, i); | ||
529 | return 1; | ||
530 | } | ||
531 | init_usb_anchor(&portdata->delayed); | ||
532 | 507 | ||
533 | for (j = 0; j < N_IN_URB; j++) { | 508 | buffer = kmalloc(OUT_BUFLEN, GFP_KERNEL); |
534 | buffer = (u8 *) __get_free_page(GFP_KERNEL); | 509 | if (!buffer) |
535 | if (!buffer) | 510 | goto bail_out_error2; |
536 | goto bail_out_error; | 511 | portdata->out_buffer[i] = buffer; |
537 | portdata->in_buffer[j] = buffer; | ||
538 | } | ||
539 | 512 | ||
540 | for (j = 0; j < N_OUT_URB; j++) { | 513 | urb = usb_wwan_setup_urb(port, port->bulk_out_endpointAddress, |
541 | buffer = kmalloc(OUT_BUFLEN, GFP_KERNEL); | 514 | USB_DIR_OUT, port, |
542 | if (!buffer) | 515 | buffer, OUT_BUFLEN, |
543 | goto bail_out_error2; | 516 | usb_wwan_outdat_callback); |
544 | portdata->out_buffer[j] = buffer; | 517 | portdata->out_urbs[i] = urb; |
545 | } | 518 | } |
546 | 519 | ||
547 | usb_set_serial_port_data(port, portdata); | 520 | usb_set_serial_port_data(port, portdata); |
548 | 521 | ||
549 | if (!port->interrupt_in_urb) | 522 | if (port->interrupt_in_urb) { |
550 | continue; | ||
551 | err = usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL); | 523 | err = usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL); |
552 | if (err) | 524 | if (err) |
553 | dev_dbg(&port->dev, "%s: submit irq_in urb failed %d\n", | 525 | dev_dbg(&port->dev, "%s: submit irq_in urb failed %d\n", |
554 | __func__, err); | 526 | __func__, err); |
555 | } | 527 | } |
556 | usb_wwan_setup_urbs(serial); | 528 | |
557 | return 0; | 529 | return 0; |
558 | 530 | ||
559 | bail_out_error2: | 531 | bail_out_error2: |
560 | for (j = 0; j < N_OUT_URB; j++) | 532 | for (i = 0; i < N_OUT_URB; i++) { |
561 | kfree(portdata->out_buffer[j]); | 533 | usb_free_urb(portdata->out_urbs[i]); |
534 | kfree(portdata->out_buffer[i]); | ||
535 | } | ||
562 | bail_out_error: | 536 | bail_out_error: |
563 | for (j = 0; j < N_IN_URB; j++) | 537 | for (i = 0; i < N_IN_URB; i++) { |
564 | if (portdata->in_buffer[j]) | 538 | usb_free_urb(portdata->in_urbs[i]); |
565 | free_page((unsigned long)portdata->in_buffer[j]); | 539 | free_page((unsigned long)portdata->in_buffer[i]); |
540 | } | ||
566 | kfree(portdata); | 541 | kfree(portdata); |
567 | return 1; | 542 | |
543 | return -ENOMEM; | ||
568 | } | 544 | } |
569 | EXPORT_SYMBOL(usb_wwan_startup); | 545 | EXPORT_SYMBOL_GPL(usb_wwan_port_probe); |
570 | 546 | ||
571 | int usb_wwan_port_remove(struct usb_serial_port *port) | 547 | int usb_wwan_port_remove(struct usb_serial_port *port) |
572 | { | 548 | { |
diff --git a/drivers/usb/serial/whiteheat.c b/drivers/usb/serial/whiteheat.c index 346c7efc20b0..b9fca3586d74 100644 --- a/drivers/usb/serial/whiteheat.c +++ b/drivers/usb/serial/whiteheat.c | |||
@@ -83,6 +83,8 @@ static int whiteheat_firmware_attach(struct usb_serial *serial); | |||
83 | /* function prototypes for the Connect Tech WhiteHEAT serial converter */ | 83 | /* function prototypes for the Connect Tech WhiteHEAT serial converter */ |
84 | static int whiteheat_attach(struct usb_serial *serial); | 84 | static int whiteheat_attach(struct usb_serial *serial); |
85 | static void whiteheat_release(struct usb_serial *serial); | 85 | static void whiteheat_release(struct usb_serial *serial); |
86 | static int whiteheat_port_probe(struct usb_serial_port *port); | ||
87 | static int whiteheat_port_remove(struct usb_serial_port *port); | ||
86 | static int whiteheat_open(struct tty_struct *tty, | 88 | static int whiteheat_open(struct tty_struct *tty, |
87 | struct usb_serial_port *port); | 89 | struct usb_serial_port *port); |
88 | static void whiteheat_close(struct usb_serial_port *port); | 90 | static void whiteheat_close(struct usb_serial_port *port); |
@@ -117,6 +119,8 @@ static struct usb_serial_driver whiteheat_device = { | |||
117 | .num_ports = 4, | 119 | .num_ports = 4, |
118 | .attach = whiteheat_attach, | 120 | .attach = whiteheat_attach, |
119 | .release = whiteheat_release, | 121 | .release = whiteheat_release, |
122 | .port_probe = whiteheat_port_probe, | ||
123 | .port_remove = whiteheat_port_remove, | ||
120 | .open = whiteheat_open, | 124 | .open = whiteheat_open, |
121 | .close = whiteheat_close, | 125 | .close = whiteheat_close, |
122 | .ioctl = whiteheat_ioctl, | 126 | .ioctl = whiteheat_ioctl, |
@@ -218,15 +222,12 @@ static int whiteheat_attach(struct usb_serial *serial) | |||
218 | { | 222 | { |
219 | struct usb_serial_port *command_port; | 223 | struct usb_serial_port *command_port; |
220 | struct whiteheat_command_private *command_info; | 224 | struct whiteheat_command_private *command_info; |
221 | struct usb_serial_port *port; | ||
222 | struct whiteheat_private *info; | ||
223 | struct whiteheat_hw_info *hw_info; | 225 | struct whiteheat_hw_info *hw_info; |
224 | int pipe; | 226 | int pipe; |
225 | int ret; | 227 | int ret; |
226 | int alen; | 228 | int alen; |
227 | __u8 *command; | 229 | __u8 *command; |
228 | __u8 *result; | 230 | __u8 *result; |
229 | int i; | ||
230 | 231 | ||
231 | command_port = serial->port[COMMAND_PORT]; | 232 | command_port = serial->port[COMMAND_PORT]; |
232 | 233 | ||
@@ -285,22 +286,6 @@ static int whiteheat_attach(struct usb_serial *serial) | |||
285 | serial->type->description, | 286 | serial->type->description, |
286 | hw_info->sw_major_rev, hw_info->sw_minor_rev); | 287 | hw_info->sw_major_rev, hw_info->sw_minor_rev); |
287 | 288 | ||
288 | for (i = 0; i < serial->num_ports; i++) { | ||
289 | port = serial->port[i]; | ||
290 | |||
291 | info = kmalloc(sizeof(struct whiteheat_private), GFP_KERNEL); | ||
292 | if (info == NULL) { | ||
293 | dev_err(&port->dev, | ||
294 | "%s: Out of memory for port structures\n", | ||
295 | serial->type->description); | ||
296 | goto no_private; | ||
297 | } | ||
298 | |||
299 | info->mcr = 0; | ||
300 | |||
301 | usb_set_serial_port_data(port, info); | ||
302 | } | ||
303 | |||
304 | command_info = kmalloc(sizeof(struct whiteheat_command_private), | 289 | command_info = kmalloc(sizeof(struct whiteheat_command_private), |
305 | GFP_KERNEL); | 290 | GFP_KERNEL); |
306 | if (command_info == NULL) { | 291 | if (command_info == NULL) { |
@@ -333,16 +318,10 @@ no_firmware: | |||
333 | "%s: please contact support@connecttech.com\n", | 318 | "%s: please contact support@connecttech.com\n", |
334 | serial->type->description); | 319 | serial->type->description); |
335 | kfree(result); | 320 | kfree(result); |
321 | kfree(command); | ||
336 | return -ENODEV; | 322 | return -ENODEV; |
337 | 323 | ||
338 | no_command_private: | 324 | no_command_private: |
339 | for (i = serial->num_ports - 1; i >= 0; i--) { | ||
340 | port = serial->port[i]; | ||
341 | info = usb_get_serial_port_data(port); | ||
342 | kfree(info); | ||
343 | no_private: | ||
344 | ; | ||
345 | } | ||
346 | kfree(result); | 325 | kfree(result); |
347 | no_result_buffer: | 326 | no_result_buffer: |
348 | kfree(command); | 327 | kfree(command); |
@@ -350,21 +329,36 @@ no_command_buffer: | |||
350 | return -ENOMEM; | 329 | return -ENOMEM; |
351 | } | 330 | } |
352 | 331 | ||
353 | |||
354 | static void whiteheat_release(struct usb_serial *serial) | 332 | static void whiteheat_release(struct usb_serial *serial) |
355 | { | 333 | { |
356 | struct usb_serial_port *command_port; | 334 | struct usb_serial_port *command_port; |
357 | struct whiteheat_private *info; | ||
358 | int i; | ||
359 | 335 | ||
360 | /* free up our private data for our command port */ | 336 | /* free up our private data for our command port */ |
361 | command_port = serial->port[COMMAND_PORT]; | 337 | command_port = serial->port[COMMAND_PORT]; |
362 | kfree(usb_get_serial_port_data(command_port)); | 338 | kfree(usb_get_serial_port_data(command_port)); |
339 | } | ||
363 | 340 | ||
364 | for (i = 0; i < serial->num_ports; i++) { | 341 | static int whiteheat_port_probe(struct usb_serial_port *port) |
365 | info = usb_get_serial_port_data(serial->port[i]); | 342 | { |
366 | kfree(info); | 343 | struct whiteheat_private *info; |
367 | } | 344 | |
345 | info = kzalloc(sizeof(*info), GFP_KERNEL); | ||
346 | if (!info) | ||
347 | return -ENOMEM; | ||
348 | |||
349 | usb_set_serial_port_data(port, info); | ||
350 | |||
351 | return 0; | ||
352 | } | ||
353 | |||
354 | static int whiteheat_port_remove(struct usb_serial_port *port) | ||
355 | { | ||
356 | struct whiteheat_private *info; | ||
357 | |||
358 | info = usb_get_serial_port_data(port); | ||
359 | kfree(info); | ||
360 | |||
361 | return 0; | ||
368 | } | 362 | } |
369 | 363 | ||
370 | static int whiteheat_open(struct tty_struct *tty, struct usb_serial_port *port) | 364 | static int whiteheat_open(struct tty_struct *tty, struct usb_serial_port *port) |
diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h index 779cd954abcb..d305a5aa3a5d 100644 --- a/drivers/usb/storage/unusual_devs.h +++ b/drivers/usb/storage/unusual_devs.h | |||
@@ -1004,6 +1004,12 @@ UNUSUAL_DEV( 0x07cf, 0x1001, 0x1000, 0x9999, | |||
1004 | USB_SC_8070, USB_PR_CB, NULL, | 1004 | USB_SC_8070, USB_PR_CB, NULL, |
1005 | US_FL_NEED_OVERRIDE | US_FL_FIX_INQUIRY ), | 1005 | US_FL_NEED_OVERRIDE | US_FL_FIX_INQUIRY ), |
1006 | 1006 | ||
1007 | /* Submitted by Oleksandr Chumachenko <ledest@gmail.com> */ | ||
1008 | UNUSUAL_DEV( 0x07cf, 0x1167, 0x0100, 0x0100, | ||
1009 | "Casio", | ||
1010 | "EX-N1 DigitalCamera", | ||
1011 | USB_SC_8070, USB_PR_DEVICE, NULL, 0), | ||
1012 | |||
1007 | /* Submitted by Hartmut Wahl <hwahl@hwahl.de>*/ | 1013 | /* Submitted by Hartmut Wahl <hwahl@hwahl.de>*/ |
1008 | UNUSUAL_DEV( 0x0839, 0x000a, 0x0001, 0x0001, | 1014 | UNUSUAL_DEV( 0x0839, 0x000a, 0x0001, 0x0001, |
1009 | "Samsung", | 1015 | "Samsung", |
diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c index 072cbbadbc36..7f93f34b7f91 100644 --- a/drivers/vhost/net.c +++ b/drivers/vhost/net.c | |||
@@ -379,7 +379,8 @@ static void handle_rx(struct vhost_net *net) | |||
379 | .hdr.gso_type = VIRTIO_NET_HDR_GSO_NONE | 379 | .hdr.gso_type = VIRTIO_NET_HDR_GSO_NONE |
380 | }; | 380 | }; |
381 | size_t total_len = 0; | 381 | size_t total_len = 0; |
382 | int err, headcount, mergeable; | 382 | int err, mergeable; |
383 | s16 headcount; | ||
383 | size_t vhost_hlen, sock_hlen; | 384 | size_t vhost_hlen, sock_hlen; |
384 | size_t vhost_len, sock_len; | 385 | size_t vhost_len, sock_len; |
385 | /* TODO: check that we are running from vhost_worker? */ | 386 | /* TODO: check that we are running from vhost_worker? */ |
diff --git a/drivers/video/backlight/Kconfig b/drivers/video/backlight/Kconfig index c101697a4ba7..765a945f8ea1 100644 --- a/drivers/video/backlight/Kconfig +++ b/drivers/video/backlight/Kconfig | |||
@@ -60,7 +60,8 @@ config LCD_LTV350QV | |||
60 | The LTV350QV panel is present on all ATSTK1000 boards. | 60 | The LTV350QV panel is present on all ATSTK1000 boards. |
61 | 61 | ||
62 | config LCD_ILI9320 | 62 | config LCD_ILI9320 |
63 | tristate | 63 | tristate "ILI Technology ILI9320 controller support" |
64 | depends on SPI | ||
64 | help | 65 | help |
65 | If you have a panel based on the ILI9320 controller chip | 66 | If you have a panel based on the ILI9320 controller chip |
66 | then say y to include a power driver for it. | 67 | then say y to include a power driver for it. |
diff --git a/drivers/video/xen-fbfront.c b/drivers/video/xen-fbfront.c index b7f5173ff9e9..917bb5681684 100644 --- a/drivers/video/xen-fbfront.c +++ b/drivers/video/xen-fbfront.c | |||
@@ -641,7 +641,6 @@ static void xenfb_backend_changed(struct xenbus_device *dev, | |||
641 | case XenbusStateReconfiguring: | 641 | case XenbusStateReconfiguring: |
642 | case XenbusStateReconfigured: | 642 | case XenbusStateReconfigured: |
643 | case XenbusStateUnknown: | 643 | case XenbusStateUnknown: |
644 | case XenbusStateClosed: | ||
645 | break; | 644 | break; |
646 | 645 | ||
647 | case XenbusStateInitWait: | 646 | case XenbusStateInitWait: |
@@ -670,6 +669,10 @@ InitWait: | |||
670 | info->feature_resize = val; | 669 | info->feature_resize = val; |
671 | break; | 670 | break; |
672 | 671 | ||
672 | case XenbusStateClosed: | ||
673 | if (dev->state == XenbusStateClosed) | ||
674 | break; | ||
675 | /* Missed the backend's CLOSING state -- fallthrough */ | ||
673 | case XenbusStateClosing: | 676 | case XenbusStateClosing: |
674 | xenbus_frontend_closed(dev); | 677 | xenbus_frontend_closed(dev); |
675 | break; | 678 | break; |
diff --git a/drivers/xen/Kconfig b/drivers/xen/Kconfig index d4dffcd52873..126d8ce591ce 100644 --- a/drivers/xen/Kconfig +++ b/drivers/xen/Kconfig | |||
@@ -3,6 +3,7 @@ menu "Xen driver support" | |||
3 | 3 | ||
4 | config XEN_BALLOON | 4 | config XEN_BALLOON |
5 | bool "Xen memory balloon driver" | 5 | bool "Xen memory balloon driver" |
6 | depends on !ARM | ||
6 | default y | 7 | default y |
7 | help | 8 | help |
8 | The balloon driver allows the Xen domain to request more memory from | 9 | The balloon driver allows the Xen domain to request more memory from |
@@ -145,6 +146,7 @@ config SWIOTLB_XEN | |||
145 | 146 | ||
146 | config XEN_TMEM | 147 | config XEN_TMEM |
147 | bool | 148 | bool |
149 | depends on !ARM | ||
148 | default y if (CLEANCACHE || FRONTSWAP) | 150 | default y if (CLEANCACHE || FRONTSWAP) |
149 | help | 151 | help |
150 | Shim to interface in-kernel Transcendent Memory hooks | 152 | Shim to interface in-kernel Transcendent Memory hooks |
diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c index 31ab82fda38a..d6886d90ccfd 100644 --- a/drivers/xen/balloon.c +++ b/drivers/xen/balloon.c | |||
@@ -55,7 +55,6 @@ | |||
55 | #include <asm/pgalloc.h> | 55 | #include <asm/pgalloc.h> |
56 | #include <asm/pgtable.h> | 56 | #include <asm/pgtable.h> |
57 | #include <asm/tlb.h> | 57 | #include <asm/tlb.h> |
58 | #include <asm/e820.h> | ||
59 | 58 | ||
60 | #include <asm/xen/hypervisor.h> | 59 | #include <asm/xen/hypervisor.h> |
61 | #include <asm/xen/hypercall.h> | 60 | #include <asm/xen/hypercall.h> |
@@ -88,7 +87,7 @@ struct balloon_stats balloon_stats; | |||
88 | EXPORT_SYMBOL_GPL(balloon_stats); | 87 | EXPORT_SYMBOL_GPL(balloon_stats); |
89 | 88 | ||
90 | /* We increase/decrease in batches which fit in a page */ | 89 | /* We increase/decrease in batches which fit in a page */ |
91 | static unsigned long frame_list[PAGE_SIZE / sizeof(unsigned long)]; | 90 | static xen_pfn_t frame_list[PAGE_SIZE / sizeof(unsigned long)]; |
92 | 91 | ||
93 | #ifdef CONFIG_HIGHMEM | 92 | #ifdef CONFIG_HIGHMEM |
94 | #define inc_totalhigh_pages() (totalhigh_pages++) | 93 | #define inc_totalhigh_pages() (totalhigh_pages++) |
diff --git a/drivers/xen/dbgp.c b/drivers/xen/dbgp.c index 42569c77ccc8..f3ccc80a455f 100644 --- a/drivers/xen/dbgp.c +++ b/drivers/xen/dbgp.c | |||
@@ -8,7 +8,9 @@ | |||
8 | 8 | ||
9 | static int xen_dbgp_op(struct usb_hcd *hcd, int op) | 9 | static int xen_dbgp_op(struct usb_hcd *hcd, int op) |
10 | { | 10 | { |
11 | #ifdef CONFIG_PCI | ||
11 | const struct device *ctrlr = hcd_to_bus(hcd)->controller; | 12 | const struct device *ctrlr = hcd_to_bus(hcd)->controller; |
13 | #endif | ||
12 | struct physdev_dbgp_op dbgp; | 14 | struct physdev_dbgp_op dbgp; |
13 | 15 | ||
14 | if (!xen_initial_domain()) | 16 | if (!xen_initial_domain()) |
diff --git a/drivers/xen/events.c b/drivers/xen/events.c index 59e10a1286d5..912ac81b6dbf 100644 --- a/drivers/xen/events.c +++ b/drivers/xen/events.c | |||
@@ -115,7 +115,9 @@ struct irq_info { | |||
115 | #define PIRQ_SHAREABLE (1 << 1) | 115 | #define PIRQ_SHAREABLE (1 << 1) |
116 | 116 | ||
117 | static int *evtchn_to_irq; | 117 | static int *evtchn_to_irq; |
118 | #ifdef CONFIG_X86 | ||
118 | static unsigned long *pirq_eoi_map; | 119 | static unsigned long *pirq_eoi_map; |
120 | #endif | ||
119 | static bool (*pirq_needs_eoi)(unsigned irq); | 121 | static bool (*pirq_needs_eoi)(unsigned irq); |
120 | 122 | ||
121 | static DEFINE_PER_CPU(unsigned long [NR_EVENT_CHANNELS/BITS_PER_LONG], | 123 | static DEFINE_PER_CPU(unsigned long [NR_EVENT_CHANNELS/BITS_PER_LONG], |
@@ -277,10 +279,12 @@ static unsigned int cpu_from_evtchn(unsigned int evtchn) | |||
277 | return ret; | 279 | return ret; |
278 | } | 280 | } |
279 | 281 | ||
282 | #ifdef CONFIG_X86 | ||
280 | static bool pirq_check_eoi_map(unsigned irq) | 283 | static bool pirq_check_eoi_map(unsigned irq) |
281 | { | 284 | { |
282 | return test_bit(pirq_from_irq(irq), pirq_eoi_map); | 285 | return test_bit(pirq_from_irq(irq), pirq_eoi_map); |
283 | } | 286 | } |
287 | #endif | ||
284 | 288 | ||
285 | static bool pirq_needs_eoi_flag(unsigned irq) | 289 | static bool pirq_needs_eoi_flag(unsigned irq) |
286 | { | 290 | { |
diff --git a/drivers/xen/gntdev.c b/drivers/xen/gntdev.c index 610bfc6be177..2e22df2f7a3f 100644 --- a/drivers/xen/gntdev.c +++ b/drivers/xen/gntdev.c | |||
@@ -105,6 +105,21 @@ static void gntdev_print_maps(struct gntdev_priv *priv, | |||
105 | #endif | 105 | #endif |
106 | } | 106 | } |
107 | 107 | ||
108 | static void gntdev_free_map(struct grant_map *map) | ||
109 | { | ||
110 | if (map == NULL) | ||
111 | return; | ||
112 | |||
113 | if (map->pages) | ||
114 | free_xenballooned_pages(map->count, map->pages); | ||
115 | kfree(map->pages); | ||
116 | kfree(map->grants); | ||
117 | kfree(map->map_ops); | ||
118 | kfree(map->unmap_ops); | ||
119 | kfree(map->kmap_ops); | ||
120 | kfree(map); | ||
121 | } | ||
122 | |||
108 | static struct grant_map *gntdev_alloc_map(struct gntdev_priv *priv, int count) | 123 | static struct grant_map *gntdev_alloc_map(struct gntdev_priv *priv, int count) |
109 | { | 124 | { |
110 | struct grant_map *add; | 125 | struct grant_map *add; |
@@ -142,12 +157,7 @@ static struct grant_map *gntdev_alloc_map(struct gntdev_priv *priv, int count) | |||
142 | return add; | 157 | return add; |
143 | 158 | ||
144 | err: | 159 | err: |
145 | kfree(add->pages); | 160 | gntdev_free_map(add); |
146 | kfree(add->grants); | ||
147 | kfree(add->map_ops); | ||
148 | kfree(add->unmap_ops); | ||
149 | kfree(add->kmap_ops); | ||
150 | kfree(add); | ||
151 | return NULL; | 161 | return NULL; |
152 | } | 162 | } |
153 | 163 | ||
@@ -198,17 +208,9 @@ static void gntdev_put_map(struct grant_map *map) | |||
198 | evtchn_put(map->notify.event); | 208 | evtchn_put(map->notify.event); |
199 | } | 209 | } |
200 | 210 | ||
201 | if (map->pages) { | 211 | if (map->pages && !use_ptemod) |
202 | if (!use_ptemod) | 212 | unmap_grant_pages(map, 0, map->count); |
203 | unmap_grant_pages(map, 0, map->count); | 213 | gntdev_free_map(map); |
204 | |||
205 | free_xenballooned_pages(map->count, map->pages); | ||
206 | } | ||
207 | kfree(map->pages); | ||
208 | kfree(map->grants); | ||
209 | kfree(map->map_ops); | ||
210 | kfree(map->unmap_ops); | ||
211 | kfree(map); | ||
212 | } | 214 | } |
213 | 215 | ||
214 | /* ------------------------------------------------------------------ */ | 216 | /* ------------------------------------------------------------------ */ |
diff --git a/drivers/xen/grant-table.c b/drivers/xen/grant-table.c index b2b0a375b348..b91f14e83164 100644 --- a/drivers/xen/grant-table.c +++ b/drivers/xen/grant-table.c | |||
@@ -84,7 +84,7 @@ struct gnttab_ops { | |||
84 | * nr_gframes is the number of frames to map grant table. Returning | 84 | * nr_gframes is the number of frames to map grant table. Returning |
85 | * GNTST_okay means success and negative value means failure. | 85 | * GNTST_okay means success and negative value means failure. |
86 | */ | 86 | */ |
87 | int (*map_frames)(unsigned long *frames, unsigned int nr_gframes); | 87 | int (*map_frames)(xen_pfn_t *frames, unsigned int nr_gframes); |
88 | /* | 88 | /* |
89 | * Release a list of frames which are mapped in map_frames for grant | 89 | * Release a list of frames which are mapped in map_frames for grant |
90 | * entry status. | 90 | * entry status. |
@@ -960,7 +960,7 @@ static unsigned nr_status_frames(unsigned nr_grant_frames) | |||
960 | return (nr_grant_frames * GREFS_PER_GRANT_FRAME + SPP - 1) / SPP; | 960 | return (nr_grant_frames * GREFS_PER_GRANT_FRAME + SPP - 1) / SPP; |
961 | } | 961 | } |
962 | 962 | ||
963 | static int gnttab_map_frames_v1(unsigned long *frames, unsigned int nr_gframes) | 963 | static int gnttab_map_frames_v1(xen_pfn_t *frames, unsigned int nr_gframes) |
964 | { | 964 | { |
965 | int rc; | 965 | int rc; |
966 | 966 | ||
@@ -977,7 +977,7 @@ static void gnttab_unmap_frames_v1(void) | |||
977 | arch_gnttab_unmap(gnttab_shared.addr, nr_grant_frames); | 977 | arch_gnttab_unmap(gnttab_shared.addr, nr_grant_frames); |
978 | } | 978 | } |
979 | 979 | ||
980 | static int gnttab_map_frames_v2(unsigned long *frames, unsigned int nr_gframes) | 980 | static int gnttab_map_frames_v2(xen_pfn_t *frames, unsigned int nr_gframes) |
981 | { | 981 | { |
982 | uint64_t *sframes; | 982 | uint64_t *sframes; |
983 | unsigned int nr_sframes; | 983 | unsigned int nr_sframes; |
@@ -1029,7 +1029,7 @@ static void gnttab_unmap_frames_v2(void) | |||
1029 | static int gnttab_map(unsigned int start_idx, unsigned int end_idx) | 1029 | static int gnttab_map(unsigned int start_idx, unsigned int end_idx) |
1030 | { | 1030 | { |
1031 | struct gnttab_setup_table setup; | 1031 | struct gnttab_setup_table setup; |
1032 | unsigned long *frames; | 1032 | xen_pfn_t *frames; |
1033 | unsigned int nr_gframes = end_idx + 1; | 1033 | unsigned int nr_gframes = end_idx + 1; |
1034 | int rc; | 1034 | int rc; |
1035 | 1035 | ||
diff --git a/drivers/xen/sys-hypervisor.c b/drivers/xen/sys-hypervisor.c index 5e5ad7e28858..96453f8a85c5 100644 --- a/drivers/xen/sys-hypervisor.c +++ b/drivers/xen/sys-hypervisor.c | |||
@@ -11,6 +11,7 @@ | |||
11 | #include <linux/kernel.h> | 11 | #include <linux/kernel.h> |
12 | #include <linux/module.h> | 12 | #include <linux/module.h> |
13 | #include <linux/kobject.h> | 13 | #include <linux/kobject.h> |
14 | #include <linux/err.h> | ||
14 | 15 | ||
15 | #include <asm/xen/hypervisor.h> | 16 | #include <asm/xen/hypervisor.h> |
16 | #include <asm/xen/hypercall.h> | 17 | #include <asm/xen/hypercall.h> |
@@ -284,7 +285,8 @@ static ssize_t virtual_start_show(struct hyp_sysfs_attr *attr, char *buffer) | |||
284 | ret = HYPERVISOR_xen_version(XENVER_platform_parameters, | 285 | ret = HYPERVISOR_xen_version(XENVER_platform_parameters, |
285 | parms); | 286 | parms); |
286 | if (!ret) | 287 | if (!ret) |
287 | ret = sprintf(buffer, "%lx\n", parms->virt_start); | 288 | ret = sprintf(buffer, "%"PRI_xen_ulong"\n", |
289 | parms->virt_start); | ||
288 | kfree(parms); | 290 | kfree(parms); |
289 | } | 291 | } |
290 | 292 | ||
diff --git a/drivers/xen/xen-pciback/vpci.c b/drivers/xen/xen-pciback/vpci.c index 46d140baebd8..0f478ac483cd 100644 --- a/drivers/xen/xen-pciback/vpci.c +++ b/drivers/xen/xen-pciback/vpci.c | |||
@@ -89,9 +89,15 @@ static int __xen_pcibk_add_pci_dev(struct xen_pcibk_device *pdev, | |||
89 | 89 | ||
90 | mutex_lock(&vpci_dev->lock); | 90 | mutex_lock(&vpci_dev->lock); |
91 | 91 | ||
92 | /* Keep multi-function devices together on the virtual PCI bus */ | 92 | /* |
93 | for (slot = 0; slot < PCI_SLOT_MAX; slot++) { | 93 | * Keep multi-function devices together on the virtual PCI bus, except |
94 | if (!list_empty(&vpci_dev->dev_list[slot])) { | 94 | * virtual functions. |
95 | */ | ||
96 | if (!dev->is_virtfn) { | ||
97 | for (slot = 0; slot < PCI_SLOT_MAX; slot++) { | ||
98 | if (list_empty(&vpci_dev->dev_list[slot])) | ||
99 | continue; | ||
100 | |||
95 | t = list_entry(list_first(&vpci_dev->dev_list[slot]), | 101 | t = list_entry(list_first(&vpci_dev->dev_list[slot]), |
96 | struct pci_dev_entry, list); | 102 | struct pci_dev_entry, list); |
97 | 103 | ||
@@ -116,7 +122,7 @@ static int __xen_pcibk_add_pci_dev(struct xen_pcibk_device *pdev, | |||
116 | pci_name(dev), slot); | 122 | pci_name(dev), slot); |
117 | list_add_tail(&dev_entry->list, | 123 | list_add_tail(&dev_entry->list, |
118 | &vpci_dev->dev_list[slot]); | 124 | &vpci_dev->dev_list[slot]); |
119 | func = PCI_FUNC(dev->devfn); | 125 | func = dev->is_virtfn ? 0 : PCI_FUNC(dev->devfn); |
120 | goto unlock; | 126 | goto unlock; |
121 | } | 127 | } |
122 | } | 128 | } |
diff --git a/drivers/xen/xenbus/xenbus_dev_frontend.c b/drivers/xen/xenbus/xenbus_dev_frontend.c index 89f76252a16f..ac727028e658 100644 --- a/drivers/xen/xenbus/xenbus_dev_frontend.c +++ b/drivers/xen/xenbus/xenbus_dev_frontend.c | |||
@@ -458,7 +458,7 @@ static ssize_t xenbus_file_write(struct file *filp, | |||
458 | goto out; | 458 | goto out; |
459 | 459 | ||
460 | /* Can't write a xenbus message larger we can buffer */ | 460 | /* Can't write a xenbus message larger we can buffer */ |
461 | if ((len + u->len) > sizeof(u->u.buffer)) { | 461 | if (len > sizeof(u->u.buffer) - u->len) { |
462 | /* On error, dump existing buffer */ | 462 | /* On error, dump existing buffer */ |
463 | u->len = 0; | 463 | u->len = 0; |
464 | rc = -EINVAL; | 464 | rc = -EINVAL; |
diff --git a/drivers/xen/xenbus/xenbus_xs.c b/drivers/xen/xenbus/xenbus_xs.c index f5dda83ad7a5..acedeabe589c 100644 --- a/drivers/xen/xenbus/xenbus_xs.c +++ b/drivers/xen/xenbus/xenbus_xs.c | |||
@@ -627,6 +627,7 @@ static struct xenbus_watch *find_watch(const char *token) | |||
627 | */ | 627 | */ |
628 | static bool xen_strict_xenbus_quirk(void) | 628 | static bool xen_strict_xenbus_quirk(void) |
629 | { | 629 | { |
630 | #ifdef CONFIG_X86 | ||
630 | uint32_t eax, ebx, ecx, edx, base; | 631 | uint32_t eax, ebx, ecx, edx, base; |
631 | 632 | ||
632 | base = xen_cpuid_base(); | 633 | base = xen_cpuid_base(); |
@@ -634,6 +635,7 @@ static bool xen_strict_xenbus_quirk(void) | |||
634 | 635 | ||
635 | if ((eax >> 16) < 4) | 636 | if ((eax >> 16) < 4) |
636 | return true; | 637 | return true; |
638 | #endif | ||
637 | return false; | 639 | return false; |
638 | 640 | ||
639 | } | 641 | } |
@@ -75,6 +75,7 @@ static struct kmem_cache *bio_find_or_create_slab(unsigned int extra_size) | |||
75 | unsigned int sz = sizeof(struct bio) + extra_size; | 75 | unsigned int sz = sizeof(struct bio) + extra_size; |
76 | struct kmem_cache *slab = NULL; | 76 | struct kmem_cache *slab = NULL; |
77 | struct bio_slab *bslab, *new_bio_slabs; | 77 | struct bio_slab *bslab, *new_bio_slabs; |
78 | unsigned int new_bio_slab_max; | ||
78 | unsigned int i, entry = -1; | 79 | unsigned int i, entry = -1; |
79 | 80 | ||
80 | mutex_lock(&bio_slab_lock); | 81 | mutex_lock(&bio_slab_lock); |
@@ -97,12 +98,13 @@ static struct kmem_cache *bio_find_or_create_slab(unsigned int extra_size) | |||
97 | goto out_unlock; | 98 | goto out_unlock; |
98 | 99 | ||
99 | if (bio_slab_nr == bio_slab_max && entry == -1) { | 100 | if (bio_slab_nr == bio_slab_max && entry == -1) { |
100 | bio_slab_max <<= 1; | 101 | new_bio_slab_max = bio_slab_max << 1; |
101 | new_bio_slabs = krealloc(bio_slabs, | 102 | new_bio_slabs = krealloc(bio_slabs, |
102 | bio_slab_max * sizeof(struct bio_slab), | 103 | new_bio_slab_max * sizeof(struct bio_slab), |
103 | GFP_KERNEL); | 104 | GFP_KERNEL); |
104 | if (!new_bio_slabs) | 105 | if (!new_bio_slabs) |
105 | goto out_unlock; | 106 | goto out_unlock; |
107 | bio_slab_max = new_bio_slab_max; | ||
106 | bio_slabs = new_bio_slabs; | 108 | bio_slabs = new_bio_slabs; |
107 | } | 109 | } |
108 | if (entry == -1) | 110 | if (entry == -1) |
diff --git a/fs/block_dev.c b/fs/block_dev.c index b3c1d3dae77d..1a1e5e3b1eaf 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c | |||
@@ -1661,6 +1661,39 @@ static int blkdev_mmap(struct file *file, struct vm_area_struct *vma) | |||
1661 | return ret; | 1661 | return ret; |
1662 | } | 1662 | } |
1663 | 1663 | ||
1664 | static ssize_t blkdev_splice_read(struct file *file, loff_t *ppos, | ||
1665 | struct pipe_inode_info *pipe, size_t len, | ||
1666 | unsigned int flags) | ||
1667 | { | ||
1668 | ssize_t ret; | ||
1669 | struct block_device *bdev = I_BDEV(file->f_mapping->host); | ||
1670 | |||
1671 | percpu_down_read(&bdev->bd_block_size_semaphore); | ||
1672 | |||
1673 | ret = generic_file_splice_read(file, ppos, pipe, len, flags); | ||
1674 | |||
1675 | percpu_up_read(&bdev->bd_block_size_semaphore); | ||
1676 | |||
1677 | return ret; | ||
1678 | } | ||
1679 | |||
1680 | static ssize_t blkdev_splice_write(struct pipe_inode_info *pipe, | ||
1681 | struct file *file, loff_t *ppos, size_t len, | ||
1682 | unsigned int flags) | ||
1683 | { | ||
1684 | ssize_t ret; | ||
1685 | struct block_device *bdev = I_BDEV(file->f_mapping->host); | ||
1686 | |||
1687 | percpu_down_read(&bdev->bd_block_size_semaphore); | ||
1688 | |||
1689 | ret = generic_file_splice_write(pipe, file, ppos, len, flags); | ||
1690 | |||
1691 | percpu_up_read(&bdev->bd_block_size_semaphore); | ||
1692 | |||
1693 | return ret; | ||
1694 | } | ||
1695 | |||
1696 | |||
1664 | /* | 1697 | /* |
1665 | * Try to release a page associated with block device when the system | 1698 | * Try to release a page associated with block device when the system |
1666 | * is under memory pressure. | 1699 | * is under memory pressure. |
@@ -1699,8 +1732,8 @@ const struct file_operations def_blk_fops = { | |||
1699 | #ifdef CONFIG_COMPAT | 1732 | #ifdef CONFIG_COMPAT |
1700 | .compat_ioctl = compat_blkdev_ioctl, | 1733 | .compat_ioctl = compat_blkdev_ioctl, |
1701 | #endif | 1734 | #endif |
1702 | .splice_read = generic_file_splice_read, | 1735 | .splice_read = blkdev_splice_read, |
1703 | .splice_write = generic_file_splice_write, | 1736 | .splice_write = blkdev_splice_write, |
1704 | }; | 1737 | }; |
1705 | 1738 | ||
1706 | int ioctl_by_bdev(struct block_device *bdev, unsigned cmd, unsigned long arg) | 1739 | int ioctl_by_bdev(struct block_device *bdev, unsigned cmd, unsigned long arg) |
diff --git a/fs/btrfs/backref.c b/fs/btrfs/backref.c index f3187938e081..208d8aa5b07e 100644 --- a/fs/btrfs/backref.c +++ b/fs/btrfs/backref.c | |||
@@ -283,9 +283,7 @@ static int __resolve_indirect_ref(struct btrfs_fs_info *fs_info, | |||
283 | goto out; | 283 | goto out; |
284 | } | 284 | } |
285 | 285 | ||
286 | rcu_read_lock(); | 286 | root_level = btrfs_old_root_level(root, time_seq); |
287 | root_level = btrfs_header_level(root->node); | ||
288 | rcu_read_unlock(); | ||
289 | 287 | ||
290 | if (root_level + 1 == level) | 288 | if (root_level + 1 == level) |
291 | goto out; | 289 | goto out; |
@@ -1177,16 +1175,15 @@ int btrfs_find_one_extref(struct btrfs_root *root, u64 inode_objectid, | |||
1177 | return ret; | 1175 | return ret; |
1178 | } | 1176 | } |
1179 | 1177 | ||
1180 | static char *ref_to_path(struct btrfs_root *fs_root, | 1178 | char *btrfs_ref_to_path(struct btrfs_root *fs_root, struct btrfs_path *path, |
1181 | struct btrfs_path *path, | 1179 | u32 name_len, unsigned long name_off, |
1182 | u32 name_len, unsigned long name_off, | 1180 | struct extent_buffer *eb_in, u64 parent, |
1183 | struct extent_buffer *eb_in, u64 parent, | 1181 | char *dest, u32 size) |
1184 | char *dest, u32 size) | ||
1185 | { | 1182 | { |
1186 | int slot; | 1183 | int slot; |
1187 | u64 next_inum; | 1184 | u64 next_inum; |
1188 | int ret; | 1185 | int ret; |
1189 | s64 bytes_left = size - 1; | 1186 | s64 bytes_left = ((s64)size) - 1; |
1190 | struct extent_buffer *eb = eb_in; | 1187 | struct extent_buffer *eb = eb_in; |
1191 | struct btrfs_key found_key; | 1188 | struct btrfs_key found_key; |
1192 | int leave_spinning = path->leave_spinning; | 1189 | int leave_spinning = path->leave_spinning; |
@@ -1266,10 +1263,10 @@ char *btrfs_iref_to_path(struct btrfs_root *fs_root, | |||
1266 | struct extent_buffer *eb_in, u64 parent, | 1263 | struct extent_buffer *eb_in, u64 parent, |
1267 | char *dest, u32 size) | 1264 | char *dest, u32 size) |
1268 | { | 1265 | { |
1269 | return ref_to_path(fs_root, path, | 1266 | return btrfs_ref_to_path(fs_root, path, |
1270 | btrfs_inode_ref_name_len(eb_in, iref), | 1267 | btrfs_inode_ref_name_len(eb_in, iref), |
1271 | (unsigned long)(iref + 1), | 1268 | (unsigned long)(iref + 1), |
1272 | eb_in, parent, dest, size); | 1269 | eb_in, parent, dest, size); |
1273 | } | 1270 | } |
1274 | 1271 | ||
1275 | /* | 1272 | /* |
@@ -1715,9 +1712,8 @@ static int inode_to_path(u64 inum, u32 name_len, unsigned long name_off, | |||
1715 | ipath->fspath->bytes_left - s_ptr : 0; | 1712 | ipath->fspath->bytes_left - s_ptr : 0; |
1716 | 1713 | ||
1717 | fspath_min = (char *)ipath->fspath->val + (i + 1) * s_ptr; | 1714 | fspath_min = (char *)ipath->fspath->val + (i + 1) * s_ptr; |
1718 | fspath = ref_to_path(ipath->fs_root, ipath->btrfs_path, name_len, | 1715 | fspath = btrfs_ref_to_path(ipath->fs_root, ipath->btrfs_path, name_len, |
1719 | name_off, eb, inum, fspath_min, | 1716 | name_off, eb, inum, fspath_min, bytes_left); |
1720 | bytes_left); | ||
1721 | if (IS_ERR(fspath)) | 1717 | if (IS_ERR(fspath)) |
1722 | return PTR_ERR(fspath); | 1718 | return PTR_ERR(fspath); |
1723 | 1719 | ||
diff --git a/fs/btrfs/backref.h b/fs/btrfs/backref.h index e75533043a5f..d61feca79455 100644 --- a/fs/btrfs/backref.h +++ b/fs/btrfs/backref.h | |||
@@ -62,6 +62,10 @@ int btrfs_find_all_roots(struct btrfs_trans_handle *trans, | |||
62 | char *btrfs_iref_to_path(struct btrfs_root *fs_root, struct btrfs_path *path, | 62 | char *btrfs_iref_to_path(struct btrfs_root *fs_root, struct btrfs_path *path, |
63 | struct btrfs_inode_ref *iref, struct extent_buffer *eb, | 63 | struct btrfs_inode_ref *iref, struct extent_buffer *eb, |
64 | u64 parent, char *dest, u32 size); | 64 | u64 parent, char *dest, u32 size); |
65 | char *btrfs_ref_to_path(struct btrfs_root *fs_root, struct btrfs_path *path, | ||
66 | u32 name_len, unsigned long name_off, | ||
67 | struct extent_buffer *eb_in, u64 parent, | ||
68 | char *dest, u32 size); | ||
65 | 69 | ||
66 | struct btrfs_data_container *init_data_container(u32 total_bytes); | 70 | struct btrfs_data_container *init_data_container(u32 total_bytes); |
67 | struct inode_fs_paths *init_ipath(s32 total_bytes, struct btrfs_root *fs_root, | 71 | struct inode_fs_paths *init_ipath(s32 total_bytes, struct btrfs_root *fs_root, |
diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c index b33436211000..cdfb4c49a806 100644 --- a/fs/btrfs/ctree.c +++ b/fs/btrfs/ctree.c | |||
@@ -596,6 +596,11 @@ tree_mod_log_insert_move(struct btrfs_fs_info *fs_info, | |||
596 | if (tree_mod_dont_log(fs_info, eb)) | 596 | if (tree_mod_dont_log(fs_info, eb)) |
597 | return 0; | 597 | return 0; |
598 | 598 | ||
599 | /* | ||
600 | * When we override something during the move, we log these removals. | ||
601 | * This can only happen when we move towards the beginning of the | ||
602 | * buffer, i.e. dst_slot < src_slot. | ||
603 | */ | ||
599 | for (i = 0; i + dst_slot < src_slot && i < nr_items; i++) { | 604 | for (i = 0; i + dst_slot < src_slot && i < nr_items; i++) { |
600 | ret = tree_mod_log_insert_key_locked(fs_info, eb, i + dst_slot, | 605 | ret = tree_mod_log_insert_key_locked(fs_info, eb, i + dst_slot, |
601 | MOD_LOG_KEY_REMOVE_WHILE_MOVING); | 606 | MOD_LOG_KEY_REMOVE_WHILE_MOVING); |
@@ -647,8 +652,6 @@ tree_mod_log_insert_root(struct btrfs_fs_info *fs_info, | |||
647 | if (tree_mod_dont_log(fs_info, NULL)) | 652 | if (tree_mod_dont_log(fs_info, NULL)) |
648 | return 0; | 653 | return 0; |
649 | 654 | ||
650 | __tree_mod_log_free_eb(fs_info, old_root); | ||
651 | |||
652 | ret = tree_mod_alloc(fs_info, flags, &tm); | 655 | ret = tree_mod_alloc(fs_info, flags, &tm); |
653 | if (ret < 0) | 656 | if (ret < 0) |
654 | goto out; | 657 | goto out; |
@@ -926,12 +929,7 @@ static noinline int update_ref_for_cow(struct btrfs_trans_handle *trans, | |||
926 | ret = btrfs_dec_ref(trans, root, buf, 1, 1); | 929 | ret = btrfs_dec_ref(trans, root, buf, 1, 1); |
927 | BUG_ON(ret); /* -ENOMEM */ | 930 | BUG_ON(ret); /* -ENOMEM */ |
928 | } | 931 | } |
929 | /* | 932 | tree_mod_log_free_eb(root->fs_info, buf); |
930 | * don't log freeing in case we're freeing the root node, this | ||
931 | * is done by tree_mod_log_set_root_pointer later | ||
932 | */ | ||
933 | if (buf != root->node && btrfs_header_level(buf) != 0) | ||
934 | tree_mod_log_free_eb(root->fs_info, buf); | ||
935 | clean_tree_block(trans, root, buf); | 933 | clean_tree_block(trans, root, buf); |
936 | *last_ref = 1; | 934 | *last_ref = 1; |
937 | } | 935 | } |
@@ -1225,6 +1223,8 @@ tree_mod_log_rewind(struct btrfs_fs_info *fs_info, struct extent_buffer *eb, | |||
1225 | free_extent_buffer(eb); | 1223 | free_extent_buffer(eb); |
1226 | 1224 | ||
1227 | __tree_mod_log_rewind(eb_rewin, time_seq, tm); | 1225 | __tree_mod_log_rewind(eb_rewin, time_seq, tm); |
1226 | WARN_ON(btrfs_header_nritems(eb_rewin) > | ||
1227 | BTRFS_NODEPTRS_PER_BLOCK(fs_info->fs_root)); | ||
1228 | 1228 | ||
1229 | return eb_rewin; | 1229 | return eb_rewin; |
1230 | } | 1230 | } |
@@ -1241,9 +1241,11 @@ get_old_root(struct btrfs_root *root, u64 time_seq) | |||
1241 | { | 1241 | { |
1242 | struct tree_mod_elem *tm; | 1242 | struct tree_mod_elem *tm; |
1243 | struct extent_buffer *eb; | 1243 | struct extent_buffer *eb; |
1244 | struct extent_buffer *old; | ||
1244 | struct tree_mod_root *old_root = NULL; | 1245 | struct tree_mod_root *old_root = NULL; |
1245 | u64 old_generation = 0; | 1246 | u64 old_generation = 0; |
1246 | u64 logical; | 1247 | u64 logical; |
1248 | u32 blocksize; | ||
1247 | 1249 | ||
1248 | eb = btrfs_read_lock_root_node(root); | 1250 | eb = btrfs_read_lock_root_node(root); |
1249 | tm = __tree_mod_log_oldest_root(root->fs_info, root, time_seq); | 1251 | tm = __tree_mod_log_oldest_root(root->fs_info, root, time_seq); |
@@ -1259,14 +1261,32 @@ get_old_root(struct btrfs_root *root, u64 time_seq) | |||
1259 | } | 1261 | } |
1260 | 1262 | ||
1261 | tm = tree_mod_log_search(root->fs_info, logical, time_seq); | 1263 | tm = tree_mod_log_search(root->fs_info, logical, time_seq); |
1262 | if (old_root) | 1264 | if (old_root && tm && tm->op != MOD_LOG_KEY_REMOVE_WHILE_FREEING) { |
1265 | btrfs_tree_read_unlock(root->node); | ||
1266 | free_extent_buffer(root->node); | ||
1267 | blocksize = btrfs_level_size(root, old_root->level); | ||
1268 | old = read_tree_block(root, logical, blocksize, 0); | ||
1269 | if (!old) { | ||
1270 | pr_warn("btrfs: failed to read tree block %llu from get_old_root\n", | ||
1271 | logical); | ||
1272 | WARN_ON(1); | ||
1273 | } else { | ||
1274 | eb = btrfs_clone_extent_buffer(old); | ||
1275 | free_extent_buffer(old); | ||
1276 | } | ||
1277 | } else if (old_root) { | ||
1278 | btrfs_tree_read_unlock(root->node); | ||
1279 | free_extent_buffer(root->node); | ||
1263 | eb = alloc_dummy_extent_buffer(logical, root->nodesize); | 1280 | eb = alloc_dummy_extent_buffer(logical, root->nodesize); |
1264 | else | 1281 | } else { |
1265 | eb = btrfs_clone_extent_buffer(root->node); | 1282 | eb = btrfs_clone_extent_buffer(root->node); |
1266 | btrfs_tree_read_unlock(root->node); | 1283 | btrfs_tree_read_unlock(root->node); |
1267 | free_extent_buffer(root->node); | 1284 | free_extent_buffer(root->node); |
1285 | } | ||
1286 | |||
1268 | if (!eb) | 1287 | if (!eb) |
1269 | return NULL; | 1288 | return NULL; |
1289 | extent_buffer_get(eb); | ||
1270 | btrfs_tree_read_lock(eb); | 1290 | btrfs_tree_read_lock(eb); |
1271 | if (old_root) { | 1291 | if (old_root) { |
1272 | btrfs_set_header_bytenr(eb, eb->start); | 1292 | btrfs_set_header_bytenr(eb, eb->start); |
@@ -1279,11 +1299,28 @@ get_old_root(struct btrfs_root *root, u64 time_seq) | |||
1279 | __tree_mod_log_rewind(eb, time_seq, tm); | 1299 | __tree_mod_log_rewind(eb, time_seq, tm); |
1280 | else | 1300 | else |
1281 | WARN_ON(btrfs_header_level(eb) != 0); | 1301 | WARN_ON(btrfs_header_level(eb) != 0); |
1282 | extent_buffer_get(eb); | 1302 | WARN_ON(btrfs_header_nritems(eb) > BTRFS_NODEPTRS_PER_BLOCK(root)); |
1283 | 1303 | ||
1284 | return eb; | 1304 | return eb; |
1285 | } | 1305 | } |
1286 | 1306 | ||
1307 | int btrfs_old_root_level(struct btrfs_root *root, u64 time_seq) | ||
1308 | { | ||
1309 | struct tree_mod_elem *tm; | ||
1310 | int level; | ||
1311 | |||
1312 | tm = __tree_mod_log_oldest_root(root->fs_info, root, time_seq); | ||
1313 | if (tm && tm->op == MOD_LOG_ROOT_REPLACE) { | ||
1314 | level = tm->old_root.level; | ||
1315 | } else { | ||
1316 | rcu_read_lock(); | ||
1317 | level = btrfs_header_level(root->node); | ||
1318 | rcu_read_unlock(); | ||
1319 | } | ||
1320 | |||
1321 | return level; | ||
1322 | } | ||
1323 | |||
1287 | static inline int should_cow_block(struct btrfs_trans_handle *trans, | 1324 | static inline int should_cow_block(struct btrfs_trans_handle *trans, |
1288 | struct btrfs_root *root, | 1325 | struct btrfs_root *root, |
1289 | struct extent_buffer *buf) | 1326 | struct extent_buffer *buf) |
@@ -1725,6 +1762,7 @@ static noinline int balance_level(struct btrfs_trans_handle *trans, | |||
1725 | goto enospc; | 1762 | goto enospc; |
1726 | } | 1763 | } |
1727 | 1764 | ||
1765 | tree_mod_log_free_eb(root->fs_info, root->node); | ||
1728 | tree_mod_log_set_root_pointer(root, child); | 1766 | tree_mod_log_set_root_pointer(root, child); |
1729 | rcu_assign_pointer(root->node, child); | 1767 | rcu_assign_pointer(root->node, child); |
1730 | 1768 | ||
@@ -2970,8 +3008,10 @@ static int push_node_left(struct btrfs_trans_handle *trans, | |||
2970 | push_items * sizeof(struct btrfs_key_ptr)); | 3008 | push_items * sizeof(struct btrfs_key_ptr)); |
2971 | 3009 | ||
2972 | if (push_items < src_nritems) { | 3010 | if (push_items < src_nritems) { |
2973 | tree_mod_log_eb_move(root->fs_info, src, 0, push_items, | 3011 | /* |
2974 | src_nritems - push_items); | 3012 | * don't call tree_mod_log_eb_move here, key removal was already |
3013 | * fully logged by tree_mod_log_eb_copy above. | ||
3014 | */ | ||
2975 | memmove_extent_buffer(src, btrfs_node_key_ptr_offset(0), | 3015 | memmove_extent_buffer(src, btrfs_node_key_ptr_offset(0), |
2976 | btrfs_node_key_ptr_offset(push_items), | 3016 | btrfs_node_key_ptr_offset(push_items), |
2977 | (src_nritems - push_items) * | 3017 | (src_nritems - push_items) * |
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index 926c9ffc66d9..c72ead869507 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h | |||
@@ -3120,6 +3120,7 @@ static inline u64 btrfs_inc_tree_mod_seq(struct btrfs_fs_info *fs_info) | |||
3120 | { | 3120 | { |
3121 | return atomic_inc_return(&fs_info->tree_mod_seq); | 3121 | return atomic_inc_return(&fs_info->tree_mod_seq); |
3122 | } | 3122 | } |
3123 | int btrfs_old_root_level(struct btrfs_root *root, u64 time_seq); | ||
3123 | 3124 | ||
3124 | /* root-item.c */ | 3125 | /* root-item.c */ |
3125 | int btrfs_find_root_ref(struct btrfs_root *tree_root, | 3126 | int btrfs_find_root_ref(struct btrfs_root *tree_root, |
@@ -3338,6 +3339,8 @@ struct extent_map *btrfs_get_extent(struct inode *inode, struct page *page, | |||
3338 | int btrfs_update_inode(struct btrfs_trans_handle *trans, | 3339 | int btrfs_update_inode(struct btrfs_trans_handle *trans, |
3339 | struct btrfs_root *root, | 3340 | struct btrfs_root *root, |
3340 | struct inode *inode); | 3341 | struct inode *inode); |
3342 | int btrfs_update_inode_fallback(struct btrfs_trans_handle *trans, | ||
3343 | struct btrfs_root *root, struct inode *inode); | ||
3341 | int btrfs_orphan_add(struct btrfs_trans_handle *trans, struct inode *inode); | 3344 | int btrfs_orphan_add(struct btrfs_trans_handle *trans, struct inode *inode); |
3342 | int btrfs_orphan_del(struct btrfs_trans_handle *trans, struct inode *inode); | 3345 | int btrfs_orphan_del(struct btrfs_trans_handle *trans, struct inode *inode); |
3343 | int btrfs_orphan_cleanup(struct btrfs_root *root); | 3346 | int btrfs_orphan_cleanup(struct btrfs_root *root); |
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index 8036d3a84853..472873a94d96 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c | |||
@@ -4110,8 +4110,8 @@ struct extent_buffer *alloc_dummy_extent_buffer(u64 start, unsigned long len) | |||
4110 | 4110 | ||
4111 | return eb; | 4111 | return eb; |
4112 | err: | 4112 | err: |
4113 | for (i--; i >= 0; i--) | 4113 | for (; i > 0; i--) |
4114 | __free_page(eb->pages[i]); | 4114 | __free_page(eb->pages[i - 1]); |
4115 | __free_extent_buffer(eb); | 4115 | __free_extent_buffer(eb); |
4116 | return NULL; | 4116 | return NULL; |
4117 | } | 4117 | } |
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 85a1e5053fe6..95542a1b3dfc 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
@@ -94,8 +94,6 @@ static noinline int cow_file_range(struct inode *inode, | |||
94 | struct page *locked_page, | 94 | struct page *locked_page, |
95 | u64 start, u64 end, int *page_started, | 95 | u64 start, u64 end, int *page_started, |
96 | unsigned long *nr_written, int unlock); | 96 | unsigned long *nr_written, int unlock); |
97 | static noinline int btrfs_update_inode_fallback(struct btrfs_trans_handle *trans, | ||
98 | struct btrfs_root *root, struct inode *inode); | ||
99 | 97 | ||
100 | static int btrfs_init_inode_security(struct btrfs_trans_handle *trans, | 98 | static int btrfs_init_inode_security(struct btrfs_trans_handle *trans, |
101 | struct inode *inode, struct inode *dir, | 99 | struct inode *inode, struct inode *dir, |
@@ -2746,8 +2744,9 @@ noinline int btrfs_update_inode(struct btrfs_trans_handle *trans, | |||
2746 | return btrfs_update_inode_item(trans, root, inode); | 2744 | return btrfs_update_inode_item(trans, root, inode); |
2747 | } | 2745 | } |
2748 | 2746 | ||
2749 | static noinline int btrfs_update_inode_fallback(struct btrfs_trans_handle *trans, | 2747 | noinline int btrfs_update_inode_fallback(struct btrfs_trans_handle *trans, |
2750 | struct btrfs_root *root, struct inode *inode) | 2748 | struct btrfs_root *root, |
2749 | struct inode *inode) | ||
2751 | { | 2750 | { |
2752 | int ret; | 2751 | int ret; |
2753 | 2752 | ||
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index 61168805f175..8fcf9a59c28d 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c | |||
@@ -343,7 +343,8 @@ static noinline int btrfs_ioctl_fitrim(struct file *file, void __user *arg) | |||
343 | return -EOPNOTSUPP; | 343 | return -EOPNOTSUPP; |
344 | if (copy_from_user(&range, arg, sizeof(range))) | 344 | if (copy_from_user(&range, arg, sizeof(range))) |
345 | return -EFAULT; | 345 | return -EFAULT; |
346 | if (range.start > total_bytes) | 346 | if (range.start > total_bytes || |
347 | range.len < fs_info->sb->s_blocksize) | ||
347 | return -EINVAL; | 348 | return -EINVAL; |
348 | 349 | ||
349 | range.len = min(range.len, total_bytes - range.start); | 350 | range.len = min(range.len, total_bytes - range.start); |
@@ -570,7 +571,8 @@ static int create_snapshot(struct btrfs_root *root, struct dentry *dentry, | |||
570 | ret = btrfs_commit_transaction(trans, | 571 | ret = btrfs_commit_transaction(trans, |
571 | root->fs_info->extent_root); | 572 | root->fs_info->extent_root); |
572 | } | 573 | } |
573 | BUG_ON(ret); | 574 | if (ret) |
575 | goto fail; | ||
574 | 576 | ||
575 | ret = pending_snapshot->error; | 577 | ret = pending_snapshot->error; |
576 | if (ret) | 578 | if (ret) |
diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c index 5039686df6ae..fe9d02c45f8e 100644 --- a/fs/btrfs/qgroup.c +++ b/fs/btrfs/qgroup.c | |||
@@ -790,8 +790,10 @@ int btrfs_quota_enable(struct btrfs_trans_handle *trans, | |||
790 | } | 790 | } |
791 | 791 | ||
792 | path = btrfs_alloc_path(); | 792 | path = btrfs_alloc_path(); |
793 | if (!path) | 793 | if (!path) { |
794 | return -ENOMEM; | 794 | ret = -ENOMEM; |
795 | goto out_free_root; | ||
796 | } | ||
795 | 797 | ||
796 | key.objectid = 0; | 798 | key.objectid = 0; |
797 | key.type = BTRFS_QGROUP_STATUS_KEY; | 799 | key.type = BTRFS_QGROUP_STATUS_KEY; |
@@ -800,7 +802,7 @@ int btrfs_quota_enable(struct btrfs_trans_handle *trans, | |||
800 | ret = btrfs_insert_empty_item(trans, quota_root, path, &key, | 802 | ret = btrfs_insert_empty_item(trans, quota_root, path, &key, |
801 | sizeof(*ptr)); | 803 | sizeof(*ptr)); |
802 | if (ret) | 804 | if (ret) |
803 | goto out; | 805 | goto out_free_path; |
804 | 806 | ||
805 | leaf = path->nodes[0]; | 807 | leaf = path->nodes[0]; |
806 | ptr = btrfs_item_ptr(leaf, path->slots[0], | 808 | ptr = btrfs_item_ptr(leaf, path->slots[0], |
@@ -818,8 +820,15 @@ int btrfs_quota_enable(struct btrfs_trans_handle *trans, | |||
818 | fs_info->quota_root = quota_root; | 820 | fs_info->quota_root = quota_root; |
819 | fs_info->pending_quota_state = 1; | 821 | fs_info->pending_quota_state = 1; |
820 | spin_unlock(&fs_info->qgroup_lock); | 822 | spin_unlock(&fs_info->qgroup_lock); |
821 | out: | 823 | out_free_path: |
822 | btrfs_free_path(path); | 824 | btrfs_free_path(path); |
825 | out_free_root: | ||
826 | if (ret) { | ||
827 | free_extent_buffer(quota_root->node); | ||
828 | free_extent_buffer(quota_root->commit_root); | ||
829 | kfree(quota_root); | ||
830 | } | ||
831 | out: | ||
823 | return ret; | 832 | return ret; |
824 | } | 833 | } |
825 | 834 | ||
diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c index c7beb543a4a8..e78b297b0b00 100644 --- a/fs/btrfs/send.c +++ b/fs/btrfs/send.c | |||
@@ -745,31 +745,36 @@ typedef int (*iterate_inode_ref_t)(int num, u64 dir, int index, | |||
745 | void *ctx); | 745 | void *ctx); |
746 | 746 | ||
747 | /* | 747 | /* |
748 | * Helper function to iterate the entries in ONE btrfs_inode_ref. | 748 | * Helper function to iterate the entries in ONE btrfs_inode_ref or |
749 | * btrfs_inode_extref. | ||
749 | * The iterate callback may return a non zero value to stop iteration. This can | 750 | * The iterate callback may return a non zero value to stop iteration. This can |
750 | * be a negative value for error codes or 1 to simply stop it. | 751 | * be a negative value for error codes or 1 to simply stop it. |
751 | * | 752 | * |
752 | * path must point to the INODE_REF when called. | 753 | * path must point to the INODE_REF or INODE_EXTREF when called. |
753 | */ | 754 | */ |
754 | static int iterate_inode_ref(struct send_ctx *sctx, | 755 | static int iterate_inode_ref(struct send_ctx *sctx, |
755 | struct btrfs_root *root, struct btrfs_path *path, | 756 | struct btrfs_root *root, struct btrfs_path *path, |
756 | struct btrfs_key *found_key, int resolve, | 757 | struct btrfs_key *found_key, int resolve, |
757 | iterate_inode_ref_t iterate, void *ctx) | 758 | iterate_inode_ref_t iterate, void *ctx) |
758 | { | 759 | { |
759 | struct extent_buffer *eb; | 760 | struct extent_buffer *eb = path->nodes[0]; |
760 | struct btrfs_item *item; | 761 | struct btrfs_item *item; |
761 | struct btrfs_inode_ref *iref; | 762 | struct btrfs_inode_ref *iref; |
763 | struct btrfs_inode_extref *extref; | ||
762 | struct btrfs_path *tmp_path; | 764 | struct btrfs_path *tmp_path; |
763 | struct fs_path *p; | 765 | struct fs_path *p; |
764 | u32 cur; | 766 | u32 cur = 0; |
765 | u32 len; | ||
766 | u32 total; | 767 | u32 total; |
767 | int slot; | 768 | int slot = path->slots[0]; |
768 | u32 name_len; | 769 | u32 name_len; |
769 | char *start; | 770 | char *start; |
770 | int ret = 0; | 771 | int ret = 0; |
771 | int num; | 772 | int num = 0; |
772 | int index; | 773 | int index; |
774 | u64 dir; | ||
775 | unsigned long name_off; | ||
776 | unsigned long elem_size; | ||
777 | unsigned long ptr; | ||
773 | 778 | ||
774 | p = fs_path_alloc_reversed(sctx); | 779 | p = fs_path_alloc_reversed(sctx); |
775 | if (!p) | 780 | if (!p) |
@@ -781,24 +786,40 @@ static int iterate_inode_ref(struct send_ctx *sctx, | |||
781 | return -ENOMEM; | 786 | return -ENOMEM; |
782 | } | 787 | } |
783 | 788 | ||
784 | eb = path->nodes[0]; | ||
785 | slot = path->slots[0]; | ||
786 | item = btrfs_item_nr(eb, slot); | ||
787 | iref = btrfs_item_ptr(eb, slot, struct btrfs_inode_ref); | ||
788 | cur = 0; | ||
789 | len = 0; | ||
790 | total = btrfs_item_size(eb, item); | ||
791 | 789 | ||
792 | num = 0; | 790 | if (found_key->type == BTRFS_INODE_REF_KEY) { |
791 | ptr = (unsigned long)btrfs_item_ptr(eb, slot, | ||
792 | struct btrfs_inode_ref); | ||
793 | item = btrfs_item_nr(eb, slot); | ||
794 | total = btrfs_item_size(eb, item); | ||
795 | elem_size = sizeof(*iref); | ||
796 | } else { | ||
797 | ptr = btrfs_item_ptr_offset(eb, slot); | ||
798 | total = btrfs_item_size_nr(eb, slot); | ||
799 | elem_size = sizeof(*extref); | ||
800 | } | ||
801 | |||
793 | while (cur < total) { | 802 | while (cur < total) { |
794 | fs_path_reset(p); | 803 | fs_path_reset(p); |
795 | 804 | ||
796 | name_len = btrfs_inode_ref_name_len(eb, iref); | 805 | if (found_key->type == BTRFS_INODE_REF_KEY) { |
797 | index = btrfs_inode_ref_index(eb, iref); | 806 | iref = (struct btrfs_inode_ref *)(ptr + cur); |
807 | name_len = btrfs_inode_ref_name_len(eb, iref); | ||
808 | name_off = (unsigned long)(iref + 1); | ||
809 | index = btrfs_inode_ref_index(eb, iref); | ||
810 | dir = found_key->offset; | ||
811 | } else { | ||
812 | extref = (struct btrfs_inode_extref *)(ptr + cur); | ||
813 | name_len = btrfs_inode_extref_name_len(eb, extref); | ||
814 | name_off = (unsigned long)&extref->name; | ||
815 | index = btrfs_inode_extref_index(eb, extref); | ||
816 | dir = btrfs_inode_extref_parent(eb, extref); | ||
817 | } | ||
818 | |||
798 | if (resolve) { | 819 | if (resolve) { |
799 | start = btrfs_iref_to_path(root, tmp_path, iref, eb, | 820 | start = btrfs_ref_to_path(root, tmp_path, name_len, |
800 | found_key->offset, p->buf, | 821 | name_off, eb, dir, |
801 | p->buf_len); | 822 | p->buf, p->buf_len); |
802 | if (IS_ERR(start)) { | 823 | if (IS_ERR(start)) { |
803 | ret = PTR_ERR(start); | 824 | ret = PTR_ERR(start); |
804 | goto out; | 825 | goto out; |
@@ -809,9 +830,10 @@ static int iterate_inode_ref(struct send_ctx *sctx, | |||
809 | p->buf_len + p->buf - start); | 830 | p->buf_len + p->buf - start); |
810 | if (ret < 0) | 831 | if (ret < 0) |
811 | goto out; | 832 | goto out; |
812 | start = btrfs_iref_to_path(root, tmp_path, iref, | 833 | start = btrfs_ref_to_path(root, tmp_path, |
813 | eb, found_key->offset, p->buf, | 834 | name_len, name_off, |
814 | p->buf_len); | 835 | eb, dir, |
836 | p->buf, p->buf_len); | ||
815 | if (IS_ERR(start)) { | 837 | if (IS_ERR(start)) { |
816 | ret = PTR_ERR(start); | 838 | ret = PTR_ERR(start); |
817 | goto out; | 839 | goto out; |
@@ -820,21 +842,16 @@ static int iterate_inode_ref(struct send_ctx *sctx, | |||
820 | } | 842 | } |
821 | p->start = start; | 843 | p->start = start; |
822 | } else { | 844 | } else { |
823 | ret = fs_path_add_from_extent_buffer(p, eb, | 845 | ret = fs_path_add_from_extent_buffer(p, eb, name_off, |
824 | (unsigned long)(iref + 1), name_len); | 846 | name_len); |
825 | if (ret < 0) | 847 | if (ret < 0) |
826 | goto out; | 848 | goto out; |
827 | } | 849 | } |
828 | 850 | ||
829 | 851 | cur += elem_size + name_len; | |
830 | len = sizeof(*iref) + name_len; | 852 | ret = iterate(num, dir, index, p, ctx); |
831 | iref = (struct btrfs_inode_ref *)((char *)iref + len); | ||
832 | cur += len; | ||
833 | |||
834 | ret = iterate(num, found_key->offset, index, p, ctx); | ||
835 | if (ret) | 853 | if (ret) |
836 | goto out; | 854 | goto out; |
837 | |||
838 | num++; | 855 | num++; |
839 | } | 856 | } |
840 | 857 | ||
@@ -998,7 +1015,8 @@ static int get_inode_path(struct send_ctx *sctx, struct btrfs_root *root, | |||
998 | } | 1015 | } |
999 | btrfs_item_key_to_cpu(p->nodes[0], &found_key, p->slots[0]); | 1016 | btrfs_item_key_to_cpu(p->nodes[0], &found_key, p->slots[0]); |
1000 | if (found_key.objectid != ino || | 1017 | if (found_key.objectid != ino || |
1001 | found_key.type != BTRFS_INODE_REF_KEY) { | 1018 | (found_key.type != BTRFS_INODE_REF_KEY && |
1019 | found_key.type != BTRFS_INODE_EXTREF_KEY)) { | ||
1002 | ret = -ENOENT; | 1020 | ret = -ENOENT; |
1003 | goto out; | 1021 | goto out; |
1004 | } | 1022 | } |
@@ -1551,8 +1569,8 @@ static int get_first_ref(struct send_ctx *sctx, | |||
1551 | struct btrfs_key key; | 1569 | struct btrfs_key key; |
1552 | struct btrfs_key found_key; | 1570 | struct btrfs_key found_key; |
1553 | struct btrfs_path *path; | 1571 | struct btrfs_path *path; |
1554 | struct btrfs_inode_ref *iref; | ||
1555 | int len; | 1572 | int len; |
1573 | u64 parent_dir; | ||
1556 | 1574 | ||
1557 | path = alloc_path_for_send(); | 1575 | path = alloc_path_for_send(); |
1558 | if (!path) | 1576 | if (!path) |
@@ -1568,27 +1586,41 @@ static int get_first_ref(struct send_ctx *sctx, | |||
1568 | if (!ret) | 1586 | if (!ret) |
1569 | btrfs_item_key_to_cpu(path->nodes[0], &found_key, | 1587 | btrfs_item_key_to_cpu(path->nodes[0], &found_key, |
1570 | path->slots[0]); | 1588 | path->slots[0]); |
1571 | if (ret || found_key.objectid != key.objectid || | 1589 | if (ret || found_key.objectid != ino || |
1572 | found_key.type != key.type) { | 1590 | (found_key.type != BTRFS_INODE_REF_KEY && |
1591 | found_key.type != BTRFS_INODE_EXTREF_KEY)) { | ||
1573 | ret = -ENOENT; | 1592 | ret = -ENOENT; |
1574 | goto out; | 1593 | goto out; |
1575 | } | 1594 | } |
1576 | 1595 | ||
1577 | iref = btrfs_item_ptr(path->nodes[0], path->slots[0], | 1596 | if (key.type == BTRFS_INODE_REF_KEY) { |
1578 | struct btrfs_inode_ref); | 1597 | struct btrfs_inode_ref *iref; |
1579 | len = btrfs_inode_ref_name_len(path->nodes[0], iref); | 1598 | iref = btrfs_item_ptr(path->nodes[0], path->slots[0], |
1580 | ret = fs_path_add_from_extent_buffer(name, path->nodes[0], | 1599 | struct btrfs_inode_ref); |
1581 | (unsigned long)(iref + 1), len); | 1600 | len = btrfs_inode_ref_name_len(path->nodes[0], iref); |
1601 | ret = fs_path_add_from_extent_buffer(name, path->nodes[0], | ||
1602 | (unsigned long)(iref + 1), | ||
1603 | len); | ||
1604 | parent_dir = found_key.offset; | ||
1605 | } else { | ||
1606 | struct btrfs_inode_extref *extref; | ||
1607 | extref = btrfs_item_ptr(path->nodes[0], path->slots[0], | ||
1608 | struct btrfs_inode_extref); | ||
1609 | len = btrfs_inode_extref_name_len(path->nodes[0], extref); | ||
1610 | ret = fs_path_add_from_extent_buffer(name, path->nodes[0], | ||
1611 | (unsigned long)&extref->name, len); | ||
1612 | parent_dir = btrfs_inode_extref_parent(path->nodes[0], extref); | ||
1613 | } | ||
1582 | if (ret < 0) | 1614 | if (ret < 0) |
1583 | goto out; | 1615 | goto out; |
1584 | btrfs_release_path(path); | 1616 | btrfs_release_path(path); |
1585 | 1617 | ||
1586 | ret = get_inode_info(root, found_key.offset, NULL, dir_gen, NULL, NULL, | 1618 | ret = get_inode_info(root, parent_dir, NULL, dir_gen, NULL, NULL, |
1587 | NULL, NULL); | 1619 | NULL, NULL); |
1588 | if (ret < 0) | 1620 | if (ret < 0) |
1589 | goto out; | 1621 | goto out; |
1590 | 1622 | ||
1591 | *dir = found_key.offset; | 1623 | *dir = parent_dir; |
1592 | 1624 | ||
1593 | out: | 1625 | out: |
1594 | btrfs_free_path(path); | 1626 | btrfs_free_path(path); |
@@ -2430,7 +2462,8 @@ verbose_printk("btrfs: send_create_inode %llu\n", ino); | |||
2430 | TLV_PUT_PATH(sctx, BTRFS_SEND_A_PATH_LINK, p); | 2462 | TLV_PUT_PATH(sctx, BTRFS_SEND_A_PATH_LINK, p); |
2431 | } else if (S_ISCHR(mode) || S_ISBLK(mode) || | 2463 | } else if (S_ISCHR(mode) || S_ISBLK(mode) || |
2432 | S_ISFIFO(mode) || S_ISSOCK(mode)) { | 2464 | S_ISFIFO(mode) || S_ISSOCK(mode)) { |
2433 | TLV_PUT_U64(sctx, BTRFS_SEND_A_RDEV, rdev); | 2465 | TLV_PUT_U64(sctx, BTRFS_SEND_A_RDEV, new_encode_dev(rdev)); |
2466 | TLV_PUT_U64(sctx, BTRFS_SEND_A_MODE, mode); | ||
2434 | } | 2467 | } |
2435 | 2468 | ||
2436 | ret = send_cmd(sctx); | 2469 | ret = send_cmd(sctx); |
@@ -3226,7 +3259,8 @@ static int process_all_refs(struct send_ctx *sctx, | |||
3226 | btrfs_item_key_to_cpu(eb, &found_key, slot); | 3259 | btrfs_item_key_to_cpu(eb, &found_key, slot); |
3227 | 3260 | ||
3228 | if (found_key.objectid != key.objectid || | 3261 | if (found_key.objectid != key.objectid || |
3229 | found_key.type != key.type) | 3262 | (found_key.type != BTRFS_INODE_REF_KEY && |
3263 | found_key.type != BTRFS_INODE_EXTREF_KEY)) | ||
3230 | break; | 3264 | break; |
3231 | 3265 | ||
3232 | ret = iterate_inode_ref(sctx, root, path, &found_key, 0, cb, | 3266 | ret = iterate_inode_ref(sctx, root, path, &found_key, 0, cb, |
@@ -3987,7 +4021,7 @@ static int process_recorded_refs_if_needed(struct send_ctx *sctx, int at_end) | |||
3987 | if (sctx->cur_ino == 0) | 4021 | if (sctx->cur_ino == 0) |
3988 | goto out; | 4022 | goto out; |
3989 | if (!at_end && sctx->cur_ino == sctx->cmp_key->objectid && | 4023 | if (!at_end && sctx->cur_ino == sctx->cmp_key->objectid && |
3990 | sctx->cmp_key->type <= BTRFS_INODE_REF_KEY) | 4024 | sctx->cmp_key->type <= BTRFS_INODE_EXTREF_KEY) |
3991 | goto out; | 4025 | goto out; |
3992 | if (list_empty(&sctx->new_refs) && list_empty(&sctx->deleted_refs)) | 4026 | if (list_empty(&sctx->new_refs) && list_empty(&sctx->deleted_refs)) |
3993 | goto out; | 4027 | goto out; |
@@ -4033,22 +4067,21 @@ static int finish_inode_if_needed(struct send_ctx *sctx, int at_end) | |||
4033 | if (ret < 0) | 4067 | if (ret < 0) |
4034 | goto out; | 4068 | goto out; |
4035 | 4069 | ||
4036 | if (!S_ISLNK(sctx->cur_inode_mode)) { | 4070 | if (!sctx->parent_root || sctx->cur_inode_new) { |
4037 | if (!sctx->parent_root || sctx->cur_inode_new) { | 4071 | need_chown = 1; |
4072 | if (!S_ISLNK(sctx->cur_inode_mode)) | ||
4038 | need_chmod = 1; | 4073 | need_chmod = 1; |
4039 | need_chown = 1; | 4074 | } else { |
4040 | } else { | 4075 | ret = get_inode_info(sctx->parent_root, sctx->cur_ino, |
4041 | ret = get_inode_info(sctx->parent_root, sctx->cur_ino, | 4076 | NULL, NULL, &right_mode, &right_uid, |
4042 | NULL, NULL, &right_mode, &right_uid, | 4077 | &right_gid, NULL); |
4043 | &right_gid, NULL); | 4078 | if (ret < 0) |
4044 | if (ret < 0) | 4079 | goto out; |
4045 | goto out; | ||
4046 | 4080 | ||
4047 | if (left_uid != right_uid || left_gid != right_gid) | 4081 | if (left_uid != right_uid || left_gid != right_gid) |
4048 | need_chown = 1; | 4082 | need_chown = 1; |
4049 | if (left_mode != right_mode) | 4083 | if (!S_ISLNK(sctx->cur_inode_mode) && left_mode != right_mode) |
4050 | need_chmod = 1; | 4084 | need_chmod = 1; |
4051 | } | ||
4052 | } | 4085 | } |
4053 | 4086 | ||
4054 | if (S_ISREG(sctx->cur_inode_mode)) { | 4087 | if (S_ISREG(sctx->cur_inode_mode)) { |
@@ -4335,7 +4368,8 @@ static int changed_cb(struct btrfs_root *left_root, | |||
4335 | 4368 | ||
4336 | if (key->type == BTRFS_INODE_ITEM_KEY) | 4369 | if (key->type == BTRFS_INODE_ITEM_KEY) |
4337 | ret = changed_inode(sctx, result); | 4370 | ret = changed_inode(sctx, result); |
4338 | else if (key->type == BTRFS_INODE_REF_KEY) | 4371 | else if (key->type == BTRFS_INODE_REF_KEY || |
4372 | key->type == BTRFS_INODE_EXTREF_KEY) | ||
4339 | ret = changed_ref(sctx, result); | 4373 | ret = changed_ref(sctx, result); |
4340 | else if (key->type == BTRFS_XATTR_ITEM_KEY) | 4374 | else if (key->type == BTRFS_XATTR_ITEM_KEY) |
4341 | ret = changed_xattr(sctx, result); | 4375 | ret = changed_xattr(sctx, result); |
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c index 77db875b5116..04bbfb1052eb 100644 --- a/fs/btrfs/transaction.c +++ b/fs/btrfs/transaction.c | |||
@@ -1200,7 +1200,7 @@ static noinline int create_pending_snapshot(struct btrfs_trans_handle *trans, | |||
1200 | btrfs_i_size_write(parent_inode, parent_inode->i_size + | 1200 | btrfs_i_size_write(parent_inode, parent_inode->i_size + |
1201 | dentry->d_name.len * 2); | 1201 | dentry->d_name.len * 2); |
1202 | parent_inode->i_mtime = parent_inode->i_ctime = CURRENT_TIME; | 1202 | parent_inode->i_mtime = parent_inode->i_ctime = CURRENT_TIME; |
1203 | ret = btrfs_update_inode(trans, parent_root, parent_inode); | 1203 | ret = btrfs_update_inode_fallback(trans, parent_root, parent_inode); |
1204 | if (ret) | 1204 | if (ret) |
1205 | btrfs_abort_transaction(trans, root, ret); | 1205 | btrfs_abort_transaction(trans, root, ret); |
1206 | fail: | 1206 | fail: |
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 029b903a4ae3..0f5ebb72a5ea 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c | |||
@@ -1819,6 +1819,13 @@ int btrfs_init_new_device(struct btrfs_root *root, char *device_path) | |||
1819 | "Failed to relocate sys chunks after " | 1819 | "Failed to relocate sys chunks after " |
1820 | "device initialization. This can be fixed " | 1820 | "device initialization. This can be fixed " |
1821 | "using the \"btrfs balance\" command."); | 1821 | "using the \"btrfs balance\" command."); |
1822 | trans = btrfs_attach_transaction(root); | ||
1823 | if (IS_ERR(trans)) { | ||
1824 | if (PTR_ERR(trans) == -ENOENT) | ||
1825 | return 0; | ||
1826 | return PTR_ERR(trans); | ||
1827 | } | ||
1828 | ret = btrfs_commit_transaction(trans, root); | ||
1822 | } | 1829 | } |
1823 | 1830 | ||
1824 | return ret; | 1831 | return ret; |
diff --git a/fs/ceph/export.c b/fs/ceph/export.c index 02ce90972d81..9349bb37a2fe 100644 --- a/fs/ceph/export.c +++ b/fs/ceph/export.c | |||
@@ -90,6 +90,8 @@ static int ceph_encode_fh(struct inode *inode, u32 *rawfh, int *max_len, | |||
90 | *max_len = handle_length; | 90 | *max_len = handle_length; |
91 | type = 255; | 91 | type = 255; |
92 | } | 92 | } |
93 | if (dentry) | ||
94 | dput(dentry); | ||
93 | return type; | 95 | return type; |
94 | } | 96 | } |
95 | 97 | ||
diff --git a/fs/char_dev.c b/fs/char_dev.c index 3f152b92a94a..afc2bb691780 100644 --- a/fs/char_dev.c +++ b/fs/char_dev.c | |||
@@ -471,9 +471,19 @@ static int exact_lock(dev_t dev, void *data) | |||
471 | */ | 471 | */ |
472 | int cdev_add(struct cdev *p, dev_t dev, unsigned count) | 472 | int cdev_add(struct cdev *p, dev_t dev, unsigned count) |
473 | { | 473 | { |
474 | int error; | ||
475 | |||
474 | p->dev = dev; | 476 | p->dev = dev; |
475 | p->count = count; | 477 | p->count = count; |
476 | return kobj_map(cdev_map, dev, count, NULL, exact_match, exact_lock, p); | 478 | |
479 | error = kobj_map(cdev_map, dev, count, NULL, | ||
480 | exact_match, exact_lock, p); | ||
481 | if (error) | ||
482 | return error; | ||
483 | |||
484 | kobject_get(p->kobj.parent); | ||
485 | |||
486 | return 0; | ||
477 | } | 487 | } |
478 | 488 | ||
479 | static void cdev_unmap(dev_t dev, unsigned count) | 489 | static void cdev_unmap(dev_t dev, unsigned count) |
@@ -498,14 +508,20 @@ void cdev_del(struct cdev *p) | |||
498 | static void cdev_default_release(struct kobject *kobj) | 508 | static void cdev_default_release(struct kobject *kobj) |
499 | { | 509 | { |
500 | struct cdev *p = container_of(kobj, struct cdev, kobj); | 510 | struct cdev *p = container_of(kobj, struct cdev, kobj); |
511 | struct kobject *parent = kobj->parent; | ||
512 | |||
501 | cdev_purge(p); | 513 | cdev_purge(p); |
514 | kobject_put(parent); | ||
502 | } | 515 | } |
503 | 516 | ||
504 | static void cdev_dynamic_release(struct kobject *kobj) | 517 | static void cdev_dynamic_release(struct kobject *kobj) |
505 | { | 518 | { |
506 | struct cdev *p = container_of(kobj, struct cdev, kobj); | 519 | struct cdev *p = container_of(kobj, struct cdev, kobj); |
520 | struct kobject *parent = kobj->parent; | ||
521 | |||
507 | cdev_purge(p); | 522 | cdev_purge(p); |
508 | kfree(p); | 523 | kfree(p); |
524 | kobject_put(parent); | ||
509 | } | 525 | } |
510 | 526 | ||
511 | static struct kobj_type ktype_cdev_default = { | 527 | static struct kobj_type ktype_cdev_default = { |
diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c index f5054025f9da..4c6285fff598 100644 --- a/fs/compat_ioctl.c +++ b/fs/compat_ioctl.c | |||
@@ -210,6 +210,8 @@ static int do_video_set_spu_palette(unsigned int fd, unsigned int cmd, | |||
210 | 210 | ||
211 | err = get_user(palp, &up->palette); | 211 | err = get_user(palp, &up->palette); |
212 | err |= get_user(length, &up->length); | 212 | err |= get_user(length, &up->length); |
213 | if (err) | ||
214 | return -EFAULT; | ||
213 | 215 | ||
214 | up_native = compat_alloc_user_space(sizeof(struct video_spu_palette)); | 216 | up_native = compat_alloc_user_space(sizeof(struct video_spu_palette)); |
215 | err = put_user(compat_ptr(palp), &up_native->palette); | 217 | err = put_user(compat_ptr(palp), &up_native->palette); |
@@ -1083,7 +1083,8 @@ int flush_old_exec(struct linux_binprm * bprm) | |||
1083 | bprm->mm = NULL; /* We're using it now */ | 1083 | bprm->mm = NULL; /* We're using it now */ |
1084 | 1084 | ||
1085 | set_fs(USER_DS); | 1085 | set_fs(USER_DS); |
1086 | current->flags &= ~(PF_RANDOMIZE | PF_FORKNOEXEC | PF_KTHREAD); | 1086 | current->flags &= |
1087 | ~(PF_RANDOMIZE | PF_FORKNOEXEC | PF_KTHREAD | PF_NOFREEZE); | ||
1087 | flush_thread(); | 1088 | flush_thread(); |
1088 | current->personality &= ~bprm->per_clear; | 1089 | current->personality &= ~bprm->per_clear; |
1089 | 1090 | ||
diff --git a/fs/ext4/balloc.c b/fs/ext4/balloc.c index 1b5089067d01..cf1821784a16 100644 --- a/fs/ext4/balloc.c +++ b/fs/ext4/balloc.c | |||
@@ -174,8 +174,7 @@ void ext4_init_block_bitmap(struct super_block *sb, struct buffer_head *bh, | |||
174 | ext4_free_inodes_set(sb, gdp, 0); | 174 | ext4_free_inodes_set(sb, gdp, 0); |
175 | ext4_itable_unused_set(sb, gdp, 0); | 175 | ext4_itable_unused_set(sb, gdp, 0); |
176 | memset(bh->b_data, 0xff, sb->s_blocksize); | 176 | memset(bh->b_data, 0xff, sb->s_blocksize); |
177 | ext4_block_bitmap_csum_set(sb, block_group, gdp, bh, | 177 | ext4_block_bitmap_csum_set(sb, block_group, gdp, bh); |
178 | EXT4_BLOCKS_PER_GROUP(sb) / 8); | ||
179 | return; | 178 | return; |
180 | } | 179 | } |
181 | memset(bh->b_data, 0, sb->s_blocksize); | 180 | memset(bh->b_data, 0, sb->s_blocksize); |
@@ -212,8 +211,7 @@ void ext4_init_block_bitmap(struct super_block *sb, struct buffer_head *bh, | |||
212 | */ | 211 | */ |
213 | ext4_mark_bitmap_end(num_clusters_in_group(sb, block_group), | 212 | ext4_mark_bitmap_end(num_clusters_in_group(sb, block_group), |
214 | sb->s_blocksize * 8, bh->b_data); | 213 | sb->s_blocksize * 8, bh->b_data); |
215 | ext4_block_bitmap_csum_set(sb, block_group, gdp, bh, | 214 | ext4_block_bitmap_csum_set(sb, block_group, gdp, bh); |
216 | EXT4_BLOCKS_PER_GROUP(sb) / 8); | ||
217 | ext4_group_desc_csum_set(sb, block_group, gdp); | 215 | ext4_group_desc_csum_set(sb, block_group, gdp); |
218 | } | 216 | } |
219 | 217 | ||
@@ -350,7 +348,7 @@ void ext4_validate_block_bitmap(struct super_block *sb, | |||
350 | return; | 348 | return; |
351 | } | 349 | } |
352 | if (unlikely(!ext4_block_bitmap_csum_verify(sb, block_group, | 350 | if (unlikely(!ext4_block_bitmap_csum_verify(sb, block_group, |
353 | desc, bh, EXT4_BLOCKS_PER_GROUP(sb) / 8))) { | 351 | desc, bh))) { |
354 | ext4_unlock_group(sb, block_group); | 352 | ext4_unlock_group(sb, block_group); |
355 | ext4_error(sb, "bg %u: bad block bitmap checksum", block_group); | 353 | ext4_error(sb, "bg %u: bad block bitmap checksum", block_group); |
356 | return; | 354 | return; |
diff --git a/fs/ext4/bitmap.c b/fs/ext4/bitmap.c index 5c2d1813ebe9..3285aa5a706a 100644 --- a/fs/ext4/bitmap.c +++ b/fs/ext4/bitmap.c | |||
@@ -58,11 +58,12 @@ void ext4_inode_bitmap_csum_set(struct super_block *sb, ext4_group_t group, | |||
58 | 58 | ||
59 | int ext4_block_bitmap_csum_verify(struct super_block *sb, ext4_group_t group, | 59 | int ext4_block_bitmap_csum_verify(struct super_block *sb, ext4_group_t group, |
60 | struct ext4_group_desc *gdp, | 60 | struct ext4_group_desc *gdp, |
61 | struct buffer_head *bh, int sz) | 61 | struct buffer_head *bh) |
62 | { | 62 | { |
63 | __u32 hi; | 63 | __u32 hi; |
64 | __u32 provided, calculated; | 64 | __u32 provided, calculated; |
65 | struct ext4_sb_info *sbi = EXT4_SB(sb); | 65 | struct ext4_sb_info *sbi = EXT4_SB(sb); |
66 | int sz = EXT4_CLUSTERS_PER_GROUP(sb) / 8; | ||
66 | 67 | ||
67 | if (!EXT4_HAS_RO_COMPAT_FEATURE(sb, | 68 | if (!EXT4_HAS_RO_COMPAT_FEATURE(sb, |
68 | EXT4_FEATURE_RO_COMPAT_METADATA_CSUM)) | 69 | EXT4_FEATURE_RO_COMPAT_METADATA_CSUM)) |
@@ -84,8 +85,9 @@ int ext4_block_bitmap_csum_verify(struct super_block *sb, ext4_group_t group, | |||
84 | 85 | ||
85 | void ext4_block_bitmap_csum_set(struct super_block *sb, ext4_group_t group, | 86 | void ext4_block_bitmap_csum_set(struct super_block *sb, ext4_group_t group, |
86 | struct ext4_group_desc *gdp, | 87 | struct ext4_group_desc *gdp, |
87 | struct buffer_head *bh, int sz) | 88 | struct buffer_head *bh) |
88 | { | 89 | { |
90 | int sz = EXT4_CLUSTERS_PER_GROUP(sb) / 8; | ||
89 | __u32 csum; | 91 | __u32 csum; |
90 | struct ext4_sb_info *sbi = EXT4_SB(sb); | 92 | struct ext4_sb_info *sbi = EXT4_SB(sb); |
91 | 93 | ||
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h index 3ab2539b7b2e..3c20de1d59d0 100644 --- a/fs/ext4/ext4.h +++ b/fs/ext4/ext4.h | |||
@@ -1882,10 +1882,10 @@ int ext4_inode_bitmap_csum_verify(struct super_block *sb, ext4_group_t group, | |||
1882 | struct buffer_head *bh, int sz); | 1882 | struct buffer_head *bh, int sz); |
1883 | void ext4_block_bitmap_csum_set(struct super_block *sb, ext4_group_t group, | 1883 | void ext4_block_bitmap_csum_set(struct super_block *sb, ext4_group_t group, |
1884 | struct ext4_group_desc *gdp, | 1884 | struct ext4_group_desc *gdp, |
1885 | struct buffer_head *bh, int sz); | 1885 | struct buffer_head *bh); |
1886 | int ext4_block_bitmap_csum_verify(struct super_block *sb, ext4_group_t group, | 1886 | int ext4_block_bitmap_csum_verify(struct super_block *sb, ext4_group_t group, |
1887 | struct ext4_group_desc *gdp, | 1887 | struct ext4_group_desc *gdp, |
1888 | struct buffer_head *bh, int sz); | 1888 | struct buffer_head *bh); |
1889 | 1889 | ||
1890 | /* balloc.c */ | 1890 | /* balloc.c */ |
1891 | extern void ext4_validate_block_bitmap(struct super_block *sb, | 1891 | extern void ext4_validate_block_bitmap(struct super_block *sb, |
@@ -2063,8 +2063,7 @@ extern int ext4_resize_fs(struct super_block *sb, ext4_fsblk_t n_blocks_count); | |||
2063 | extern int ext4_calculate_overhead(struct super_block *sb); | 2063 | extern int ext4_calculate_overhead(struct super_block *sb); |
2064 | extern int ext4_superblock_csum_verify(struct super_block *sb, | 2064 | extern int ext4_superblock_csum_verify(struct super_block *sb, |
2065 | struct ext4_super_block *es); | 2065 | struct ext4_super_block *es); |
2066 | extern void ext4_superblock_csum_set(struct super_block *sb, | 2066 | extern void ext4_superblock_csum_set(struct super_block *sb); |
2067 | struct ext4_super_block *es); | ||
2068 | extern void *ext4_kvmalloc(size_t size, gfp_t flags); | 2067 | extern void *ext4_kvmalloc(size_t size, gfp_t flags); |
2069 | extern void *ext4_kvzalloc(size_t size, gfp_t flags); | 2068 | extern void *ext4_kvzalloc(size_t size, gfp_t flags); |
2070 | extern void ext4_kvfree(void *ptr); | 2069 | extern void ext4_kvfree(void *ptr); |
diff --git a/fs/ext4/ext4_jbd2.c b/fs/ext4/ext4_jbd2.c index bfa65b49d424..b4323ba846b5 100644 --- a/fs/ext4/ext4_jbd2.c +++ b/fs/ext4/ext4_jbd2.c | |||
@@ -143,17 +143,13 @@ int __ext4_handle_dirty_super(const char *where, unsigned int line, | |||
143 | struct buffer_head *bh = EXT4_SB(sb)->s_sbh; | 143 | struct buffer_head *bh = EXT4_SB(sb)->s_sbh; |
144 | int err = 0; | 144 | int err = 0; |
145 | 145 | ||
146 | ext4_superblock_csum_set(sb); | ||
146 | if (ext4_handle_valid(handle)) { | 147 | if (ext4_handle_valid(handle)) { |
147 | ext4_superblock_csum_set(sb, | ||
148 | (struct ext4_super_block *)bh->b_data); | ||
149 | err = jbd2_journal_dirty_metadata(handle, bh); | 148 | err = jbd2_journal_dirty_metadata(handle, bh); |
150 | if (err) | 149 | if (err) |
151 | ext4_journal_abort_handle(where, line, __func__, | 150 | ext4_journal_abort_handle(where, line, __func__, |
152 | bh, handle, err); | 151 | bh, handle, err); |
153 | } else { | 152 | } else |
154 | ext4_superblock_csum_set(sb, | ||
155 | (struct ext4_super_block *)bh->b_data); | ||
156 | mark_buffer_dirty(bh); | 153 | mark_buffer_dirty(bh); |
157 | } | ||
158 | return err; | 154 | return err; |
159 | } | 155 | } |
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c index 1c94cca35ed1..7011ac967208 100644 --- a/fs/ext4/extents.c +++ b/fs/ext4/extents.c | |||
@@ -52,6 +52,9 @@ | |||
52 | #define EXT4_EXT_MARK_UNINIT1 0x2 /* mark first half uninitialized */ | 52 | #define EXT4_EXT_MARK_UNINIT1 0x2 /* mark first half uninitialized */ |
53 | #define EXT4_EXT_MARK_UNINIT2 0x4 /* mark second half uninitialized */ | 53 | #define EXT4_EXT_MARK_UNINIT2 0x4 /* mark second half uninitialized */ |
54 | 54 | ||
55 | #define EXT4_EXT_DATA_VALID1 0x8 /* first half contains valid data */ | ||
56 | #define EXT4_EXT_DATA_VALID2 0x10 /* second half contains valid data */ | ||
57 | |||
55 | static __le32 ext4_extent_block_csum(struct inode *inode, | 58 | static __le32 ext4_extent_block_csum(struct inode *inode, |
56 | struct ext4_extent_header *eh) | 59 | struct ext4_extent_header *eh) |
57 | { | 60 | { |
@@ -2914,6 +2917,9 @@ static int ext4_split_extent_at(handle_t *handle, | |||
2914 | unsigned int ee_len, depth; | 2917 | unsigned int ee_len, depth; |
2915 | int err = 0; | 2918 | int err = 0; |
2916 | 2919 | ||
2920 | BUG_ON((split_flag & (EXT4_EXT_DATA_VALID1 | EXT4_EXT_DATA_VALID2)) == | ||
2921 | (EXT4_EXT_DATA_VALID1 | EXT4_EXT_DATA_VALID2)); | ||
2922 | |||
2917 | ext_debug("ext4_split_extents_at: inode %lu, logical" | 2923 | ext_debug("ext4_split_extents_at: inode %lu, logical" |
2918 | "block %llu\n", inode->i_ino, (unsigned long long)split); | 2924 | "block %llu\n", inode->i_ino, (unsigned long long)split); |
2919 | 2925 | ||
@@ -2972,7 +2978,14 @@ static int ext4_split_extent_at(handle_t *handle, | |||
2972 | 2978 | ||
2973 | err = ext4_ext_insert_extent(handle, inode, path, &newex, flags); | 2979 | err = ext4_ext_insert_extent(handle, inode, path, &newex, flags); |
2974 | if (err == -ENOSPC && (EXT4_EXT_MAY_ZEROOUT & split_flag)) { | 2980 | if (err == -ENOSPC && (EXT4_EXT_MAY_ZEROOUT & split_flag)) { |
2975 | err = ext4_ext_zeroout(inode, &orig_ex); | 2981 | if (split_flag & (EXT4_EXT_DATA_VALID1|EXT4_EXT_DATA_VALID2)) { |
2982 | if (split_flag & EXT4_EXT_DATA_VALID1) | ||
2983 | err = ext4_ext_zeroout(inode, ex2); | ||
2984 | else | ||
2985 | err = ext4_ext_zeroout(inode, ex); | ||
2986 | } else | ||
2987 | err = ext4_ext_zeroout(inode, &orig_ex); | ||
2988 | |||
2976 | if (err) | 2989 | if (err) |
2977 | goto fix_extent_len; | 2990 | goto fix_extent_len; |
2978 | /* update the extent length and mark as initialized */ | 2991 | /* update the extent length and mark as initialized */ |
@@ -3025,12 +3038,13 @@ static int ext4_split_extent(handle_t *handle, | |||
3025 | uninitialized = ext4_ext_is_uninitialized(ex); | 3038 | uninitialized = ext4_ext_is_uninitialized(ex); |
3026 | 3039 | ||
3027 | if (map->m_lblk + map->m_len < ee_block + ee_len) { | 3040 | if (map->m_lblk + map->m_len < ee_block + ee_len) { |
3028 | split_flag1 = split_flag & EXT4_EXT_MAY_ZEROOUT ? | 3041 | split_flag1 = split_flag & EXT4_EXT_MAY_ZEROOUT; |
3029 | EXT4_EXT_MAY_ZEROOUT : 0; | ||
3030 | flags1 = flags | EXT4_GET_BLOCKS_PRE_IO; | 3042 | flags1 = flags | EXT4_GET_BLOCKS_PRE_IO; |
3031 | if (uninitialized) | 3043 | if (uninitialized) |
3032 | split_flag1 |= EXT4_EXT_MARK_UNINIT1 | | 3044 | split_flag1 |= EXT4_EXT_MARK_UNINIT1 | |
3033 | EXT4_EXT_MARK_UNINIT2; | 3045 | EXT4_EXT_MARK_UNINIT2; |
3046 | if (split_flag & EXT4_EXT_DATA_VALID2) | ||
3047 | split_flag1 |= EXT4_EXT_DATA_VALID1; | ||
3034 | err = ext4_split_extent_at(handle, inode, path, | 3048 | err = ext4_split_extent_at(handle, inode, path, |
3035 | map->m_lblk + map->m_len, split_flag1, flags1); | 3049 | map->m_lblk + map->m_len, split_flag1, flags1); |
3036 | if (err) | 3050 | if (err) |
@@ -3043,8 +3057,8 @@ static int ext4_split_extent(handle_t *handle, | |||
3043 | return PTR_ERR(path); | 3057 | return PTR_ERR(path); |
3044 | 3058 | ||
3045 | if (map->m_lblk >= ee_block) { | 3059 | if (map->m_lblk >= ee_block) { |
3046 | split_flag1 = split_flag & EXT4_EXT_MAY_ZEROOUT ? | 3060 | split_flag1 = split_flag & (EXT4_EXT_MAY_ZEROOUT | |
3047 | EXT4_EXT_MAY_ZEROOUT : 0; | 3061 | EXT4_EXT_DATA_VALID2); |
3048 | if (uninitialized) | 3062 | if (uninitialized) |
3049 | split_flag1 |= EXT4_EXT_MARK_UNINIT1; | 3063 | split_flag1 |= EXT4_EXT_MARK_UNINIT1; |
3050 | if (split_flag & EXT4_EXT_MARK_UNINIT2) | 3064 | if (split_flag & EXT4_EXT_MARK_UNINIT2) |
@@ -3323,26 +3337,47 @@ static int ext4_split_unwritten_extents(handle_t *handle, | |||
3323 | 3337 | ||
3324 | split_flag |= ee_block + ee_len <= eof_block ? EXT4_EXT_MAY_ZEROOUT : 0; | 3338 | split_flag |= ee_block + ee_len <= eof_block ? EXT4_EXT_MAY_ZEROOUT : 0; |
3325 | split_flag |= EXT4_EXT_MARK_UNINIT2; | 3339 | split_flag |= EXT4_EXT_MARK_UNINIT2; |
3326 | 3340 | if (flags & EXT4_GET_BLOCKS_CONVERT) | |
3341 | split_flag |= EXT4_EXT_DATA_VALID2; | ||
3327 | flags |= EXT4_GET_BLOCKS_PRE_IO; | 3342 | flags |= EXT4_GET_BLOCKS_PRE_IO; |
3328 | return ext4_split_extent(handle, inode, path, map, split_flag, flags); | 3343 | return ext4_split_extent(handle, inode, path, map, split_flag, flags); |
3329 | } | 3344 | } |
3330 | 3345 | ||
3331 | static int ext4_convert_unwritten_extents_endio(handle_t *handle, | 3346 | static int ext4_convert_unwritten_extents_endio(handle_t *handle, |
3332 | struct inode *inode, | 3347 | struct inode *inode, |
3333 | struct ext4_ext_path *path) | 3348 | struct ext4_map_blocks *map, |
3349 | struct ext4_ext_path *path) | ||
3334 | { | 3350 | { |
3335 | struct ext4_extent *ex; | 3351 | struct ext4_extent *ex; |
3352 | ext4_lblk_t ee_block; | ||
3353 | unsigned int ee_len; | ||
3336 | int depth; | 3354 | int depth; |
3337 | int err = 0; | 3355 | int err = 0; |
3338 | 3356 | ||
3339 | depth = ext_depth(inode); | 3357 | depth = ext_depth(inode); |
3340 | ex = path[depth].p_ext; | 3358 | ex = path[depth].p_ext; |
3359 | ee_block = le32_to_cpu(ex->ee_block); | ||
3360 | ee_len = ext4_ext_get_actual_len(ex); | ||
3341 | 3361 | ||
3342 | ext_debug("ext4_convert_unwritten_extents_endio: inode %lu, logical" | 3362 | ext_debug("ext4_convert_unwritten_extents_endio: inode %lu, logical" |
3343 | "block %llu, max_blocks %u\n", inode->i_ino, | 3363 | "block %llu, max_blocks %u\n", inode->i_ino, |
3344 | (unsigned long long)le32_to_cpu(ex->ee_block), | 3364 | (unsigned long long)ee_block, ee_len); |
3345 | ext4_ext_get_actual_len(ex)); | 3365 | |
3366 | /* If extent is larger than requested then split is required */ | ||
3367 | if (ee_block != map->m_lblk || ee_len > map->m_len) { | ||
3368 | err = ext4_split_unwritten_extents(handle, inode, map, path, | ||
3369 | EXT4_GET_BLOCKS_CONVERT); | ||
3370 | if (err < 0) | ||
3371 | goto out; | ||
3372 | ext4_ext_drop_refs(path); | ||
3373 | path = ext4_ext_find_extent(inode, map->m_lblk, path); | ||
3374 | if (IS_ERR(path)) { | ||
3375 | err = PTR_ERR(path); | ||
3376 | goto out; | ||
3377 | } | ||
3378 | depth = ext_depth(inode); | ||
3379 | ex = path[depth].p_ext; | ||
3380 | } | ||
3346 | 3381 | ||
3347 | err = ext4_ext_get_access(handle, inode, path + depth); | 3382 | err = ext4_ext_get_access(handle, inode, path + depth); |
3348 | if (err) | 3383 | if (err) |
@@ -3652,7 +3687,7 @@ ext4_ext_handle_uninitialized_extents(handle_t *handle, struct inode *inode, | |||
3652 | } | 3687 | } |
3653 | /* IO end_io complete, convert the filled extent to written */ | 3688 | /* IO end_io complete, convert the filled extent to written */ |
3654 | if ((flags & EXT4_GET_BLOCKS_CONVERT)) { | 3689 | if ((flags & EXT4_GET_BLOCKS_CONVERT)) { |
3655 | ret = ext4_convert_unwritten_extents_endio(handle, inode, | 3690 | ret = ext4_convert_unwritten_extents_endio(handle, inode, map, |
3656 | path); | 3691 | path); |
3657 | if (ret >= 0) { | 3692 | if (ret >= 0) { |
3658 | ext4_update_inode_fsync_trans(handle, inode, 1); | 3693 | ext4_update_inode_fsync_trans(handle, inode, 1); |
@@ -4428,6 +4463,9 @@ long ext4_fallocate(struct file *file, int mode, loff_t offset, loff_t len) | |||
4428 | */ | 4463 | */ |
4429 | if (len <= EXT_UNINIT_MAX_LEN << blkbits) | 4464 | if (len <= EXT_UNINIT_MAX_LEN << blkbits) |
4430 | flags |= EXT4_GET_BLOCKS_NO_NORMALIZE; | 4465 | flags |= EXT4_GET_BLOCKS_NO_NORMALIZE; |
4466 | |||
4467 | /* Prevent race condition between unwritten */ | ||
4468 | ext4_flush_unwritten_io(inode); | ||
4431 | retry: | 4469 | retry: |
4432 | while (ret >= 0 && ret < max_blocks) { | 4470 | while (ret >= 0 && ret < max_blocks) { |
4433 | map.m_lblk = map.m_lblk + ret; | 4471 | map.m_lblk = map.m_lblk + ret; |
diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c index fa36372f3fdf..3a100e7a62a8 100644 --- a/fs/ext4/ialloc.c +++ b/fs/ext4/ialloc.c | |||
@@ -725,6 +725,10 @@ repeat_in_this_group: | |||
725 | "inode=%lu", ino + 1); | 725 | "inode=%lu", ino + 1); |
726 | continue; | 726 | continue; |
727 | } | 727 | } |
728 | BUFFER_TRACE(inode_bitmap_bh, "get_write_access"); | ||
729 | err = ext4_journal_get_write_access(handle, inode_bitmap_bh); | ||
730 | if (err) | ||
731 | goto fail; | ||
728 | ext4_lock_group(sb, group); | 732 | ext4_lock_group(sb, group); |
729 | ret2 = ext4_test_and_set_bit(ino, inode_bitmap_bh->b_data); | 733 | ret2 = ext4_test_and_set_bit(ino, inode_bitmap_bh->b_data); |
730 | ext4_unlock_group(sb, group); | 734 | ext4_unlock_group(sb, group); |
@@ -738,6 +742,11 @@ repeat_in_this_group: | |||
738 | goto out; | 742 | goto out; |
739 | 743 | ||
740 | got: | 744 | got: |
745 | BUFFER_TRACE(inode_bitmap_bh, "call ext4_handle_dirty_metadata"); | ||
746 | err = ext4_handle_dirty_metadata(handle, NULL, inode_bitmap_bh); | ||
747 | if (err) | ||
748 | goto fail; | ||
749 | |||
741 | /* We may have to initialize the block bitmap if it isn't already */ | 750 | /* We may have to initialize the block bitmap if it isn't already */ |
742 | if (ext4_has_group_desc_csum(sb) && | 751 | if (ext4_has_group_desc_csum(sb) && |
743 | gdp->bg_flags & cpu_to_le16(EXT4_BG_BLOCK_UNINIT)) { | 752 | gdp->bg_flags & cpu_to_le16(EXT4_BG_BLOCK_UNINIT)) { |
@@ -762,9 +771,7 @@ got: | |||
762 | ext4_free_group_clusters_set(sb, gdp, | 771 | ext4_free_group_clusters_set(sb, gdp, |
763 | ext4_free_clusters_after_init(sb, group, gdp)); | 772 | ext4_free_clusters_after_init(sb, group, gdp)); |
764 | ext4_block_bitmap_csum_set(sb, group, gdp, | 773 | ext4_block_bitmap_csum_set(sb, group, gdp, |
765 | block_bitmap_bh, | 774 | block_bitmap_bh); |
766 | EXT4_BLOCKS_PER_GROUP(sb) / | ||
767 | 8); | ||
768 | ext4_group_desc_csum_set(sb, group, gdp); | 775 | ext4_group_desc_csum_set(sb, group, gdp); |
769 | } | 776 | } |
770 | ext4_unlock_group(sb, group); | 777 | ext4_unlock_group(sb, group); |
@@ -773,11 +780,6 @@ got: | |||
773 | goto fail; | 780 | goto fail; |
774 | } | 781 | } |
775 | 782 | ||
776 | BUFFER_TRACE(inode_bitmap_bh, "get_write_access"); | ||
777 | err = ext4_journal_get_write_access(handle, inode_bitmap_bh); | ||
778 | if (err) | ||
779 | goto fail; | ||
780 | |||
781 | BUFFER_TRACE(group_desc_bh, "get_write_access"); | 783 | BUFFER_TRACE(group_desc_bh, "get_write_access"); |
782 | err = ext4_journal_get_write_access(handle, group_desc_bh); | 784 | err = ext4_journal_get_write_access(handle, group_desc_bh); |
783 | if (err) | 785 | if (err) |
@@ -825,11 +827,6 @@ got: | |||
825 | } | 827 | } |
826 | ext4_unlock_group(sb, group); | 828 | ext4_unlock_group(sb, group); |
827 | 829 | ||
828 | BUFFER_TRACE(inode_bitmap_bh, "call ext4_handle_dirty_metadata"); | ||
829 | err = ext4_handle_dirty_metadata(handle, NULL, inode_bitmap_bh); | ||
830 | if (err) | ||
831 | goto fail; | ||
832 | |||
833 | BUFFER_TRACE(group_desc_bh, "call ext4_handle_dirty_metadata"); | 830 | BUFFER_TRACE(group_desc_bh, "call ext4_handle_dirty_metadata"); |
834 | err = ext4_handle_dirty_metadata(handle, NULL, group_desc_bh); | 831 | err = ext4_handle_dirty_metadata(handle, NULL, group_desc_bh); |
835 | if (err) | 832 | if (err) |
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c index f8b27bf80aca..526e55358606 100644 --- a/fs/ext4/mballoc.c +++ b/fs/ext4/mballoc.c | |||
@@ -2805,8 +2805,7 @@ ext4_mb_mark_diskspace_used(struct ext4_allocation_context *ac, | |||
2805 | } | 2805 | } |
2806 | len = ext4_free_group_clusters(sb, gdp) - ac->ac_b_ex.fe_len; | 2806 | len = ext4_free_group_clusters(sb, gdp) - ac->ac_b_ex.fe_len; |
2807 | ext4_free_group_clusters_set(sb, gdp, len); | 2807 | ext4_free_group_clusters_set(sb, gdp, len); |
2808 | ext4_block_bitmap_csum_set(sb, ac->ac_b_ex.fe_group, gdp, bitmap_bh, | 2808 | ext4_block_bitmap_csum_set(sb, ac->ac_b_ex.fe_group, gdp, bitmap_bh); |
2809 | EXT4_BLOCKS_PER_GROUP(sb) / 8); | ||
2810 | ext4_group_desc_csum_set(sb, ac->ac_b_ex.fe_group, gdp); | 2809 | ext4_group_desc_csum_set(sb, ac->ac_b_ex.fe_group, gdp); |
2811 | 2810 | ||
2812 | ext4_unlock_group(sb, ac->ac_b_ex.fe_group); | 2811 | ext4_unlock_group(sb, ac->ac_b_ex.fe_group); |
@@ -4666,8 +4665,7 @@ do_more: | |||
4666 | 4665 | ||
4667 | ret = ext4_free_group_clusters(sb, gdp) + count_clusters; | 4666 | ret = ext4_free_group_clusters(sb, gdp) + count_clusters; |
4668 | ext4_free_group_clusters_set(sb, gdp, ret); | 4667 | ext4_free_group_clusters_set(sb, gdp, ret); |
4669 | ext4_block_bitmap_csum_set(sb, block_group, gdp, bitmap_bh, | 4668 | ext4_block_bitmap_csum_set(sb, block_group, gdp, bitmap_bh); |
4670 | EXT4_BLOCKS_PER_GROUP(sb) / 8); | ||
4671 | ext4_group_desc_csum_set(sb, block_group, gdp); | 4669 | ext4_group_desc_csum_set(sb, block_group, gdp); |
4672 | ext4_unlock_group(sb, block_group); | 4670 | ext4_unlock_group(sb, block_group); |
4673 | percpu_counter_add(&sbi->s_freeclusters_counter, count_clusters); | 4671 | percpu_counter_add(&sbi->s_freeclusters_counter, count_clusters); |
@@ -4811,8 +4809,7 @@ int ext4_group_add_blocks(handle_t *handle, struct super_block *sb, | |||
4811 | mb_free_blocks(NULL, &e4b, bit, count); | 4809 | mb_free_blocks(NULL, &e4b, bit, count); |
4812 | blk_free_count = blocks_freed + ext4_free_group_clusters(sb, desc); | 4810 | blk_free_count = blocks_freed + ext4_free_group_clusters(sb, desc); |
4813 | ext4_free_group_clusters_set(sb, desc, blk_free_count); | 4811 | ext4_free_group_clusters_set(sb, desc, blk_free_count); |
4814 | ext4_block_bitmap_csum_set(sb, block_group, desc, bitmap_bh, | 4812 | ext4_block_bitmap_csum_set(sb, block_group, desc, bitmap_bh); |
4815 | EXT4_BLOCKS_PER_GROUP(sb) / 8); | ||
4816 | ext4_group_desc_csum_set(sb, block_group, desc); | 4813 | ext4_group_desc_csum_set(sb, block_group, desc); |
4817 | ext4_unlock_group(sb, block_group); | 4814 | ext4_unlock_group(sb, block_group); |
4818 | percpu_counter_add(&sbi->s_freeclusters_counter, | 4815 | percpu_counter_add(&sbi->s_freeclusters_counter, |
@@ -4993,8 +4990,9 @@ int ext4_trim_fs(struct super_block *sb, struct fstrim_range *range) | |||
4993 | minlen = EXT4_NUM_B2C(EXT4_SB(sb), | 4990 | minlen = EXT4_NUM_B2C(EXT4_SB(sb), |
4994 | range->minlen >> sb->s_blocksize_bits); | 4991 | range->minlen >> sb->s_blocksize_bits); |
4995 | 4992 | ||
4996 | if (unlikely(minlen > EXT4_CLUSTERS_PER_GROUP(sb)) || | 4993 | if (minlen > EXT4_CLUSTERS_PER_GROUP(sb) || |
4997 | unlikely(start >= max_blks)) | 4994 | start >= max_blks || |
4995 | range->len < sb->s_blocksize) | ||
4998 | return -EINVAL; | 4996 | return -EINVAL; |
4999 | if (end >= max_blks) | 4997 | if (end >= max_blks) |
5000 | end = max_blks - 1; | 4998 | end = max_blks - 1; |
diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c index 7a75e1086961..47bf06a2765d 100644 --- a/fs/ext4/resize.c +++ b/fs/ext4/resize.c | |||
@@ -1212,8 +1212,7 @@ static int ext4_set_bitmap_checksums(struct super_block *sb, | |||
1212 | bh = ext4_get_bitmap(sb, group_data->block_bitmap); | 1212 | bh = ext4_get_bitmap(sb, group_data->block_bitmap); |
1213 | if (!bh) | 1213 | if (!bh) |
1214 | return -EIO; | 1214 | return -EIO; |
1215 | ext4_block_bitmap_csum_set(sb, group, gdp, bh, | 1215 | ext4_block_bitmap_csum_set(sb, group, gdp, bh); |
1216 | EXT4_BLOCKS_PER_GROUP(sb) / 8); | ||
1217 | brelse(bh); | 1216 | brelse(bh); |
1218 | 1217 | ||
1219 | return 0; | 1218 | return 0; |
diff --git a/fs/ext4/super.c b/fs/ext4/super.c index 7265a0367476..80928f716850 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c | |||
@@ -143,9 +143,10 @@ int ext4_superblock_csum_verify(struct super_block *sb, | |||
143 | return es->s_checksum == ext4_superblock_csum(sb, es); | 143 | return es->s_checksum == ext4_superblock_csum(sb, es); |
144 | } | 144 | } |
145 | 145 | ||
146 | void ext4_superblock_csum_set(struct super_block *sb, | 146 | void ext4_superblock_csum_set(struct super_block *sb) |
147 | struct ext4_super_block *es) | ||
148 | { | 147 | { |
148 | struct ext4_super_block *es = EXT4_SB(sb)->s_es; | ||
149 | |||
149 | if (!EXT4_HAS_RO_COMPAT_FEATURE(sb, | 150 | if (!EXT4_HAS_RO_COMPAT_FEATURE(sb, |
150 | EXT4_FEATURE_RO_COMPAT_METADATA_CSUM)) | 151 | EXT4_FEATURE_RO_COMPAT_METADATA_CSUM)) |
151 | return; | 152 | return; |
@@ -1963,7 +1964,7 @@ static int ext4_fill_flex_info(struct super_block *sb) | |||
1963 | sbi->s_log_groups_per_flex = 0; | 1964 | sbi->s_log_groups_per_flex = 0; |
1964 | return 1; | 1965 | return 1; |
1965 | } | 1966 | } |
1966 | groups_per_flex = 1 << sbi->s_log_groups_per_flex; | 1967 | groups_per_flex = 1U << sbi->s_log_groups_per_flex; |
1967 | 1968 | ||
1968 | err = ext4_alloc_flex_bg_array(sb, sbi->s_groups_count); | 1969 | err = ext4_alloc_flex_bg_array(sb, sbi->s_groups_count); |
1969 | if (err) | 1970 | if (err) |
@@ -4381,7 +4382,7 @@ static int ext4_commit_super(struct super_block *sb, int sync) | |||
4381 | cpu_to_le32(percpu_counter_sum_positive( | 4382 | cpu_to_le32(percpu_counter_sum_positive( |
4382 | &EXT4_SB(sb)->s_freeinodes_counter)); | 4383 | &EXT4_SB(sb)->s_freeinodes_counter)); |
4383 | BUFFER_TRACE(sbh, "marking dirty"); | 4384 | BUFFER_TRACE(sbh, "marking dirty"); |
4384 | ext4_superblock_csum_set(sb, es); | 4385 | ext4_superblock_csum_set(sb); |
4385 | mark_buffer_dirty(sbh); | 4386 | mark_buffer_dirty(sbh); |
4386 | if (sync) { | 4387 | if (sync) { |
4387 | error = sync_dirty_buffer(sbh); | 4388 | error = sync_dirty_buffer(sbh); |
@@ -900,7 +900,7 @@ int replace_fd(unsigned fd, struct file *file, unsigned flags) | |||
900 | return __close_fd(files, fd); | 900 | return __close_fd(files, fd); |
901 | 901 | ||
902 | if (fd >= rlimit(RLIMIT_NOFILE)) | 902 | if (fd >= rlimit(RLIMIT_NOFILE)) |
903 | return -EMFILE; | 903 | return -EBADF; |
904 | 904 | ||
905 | spin_lock(&files->file_lock); | 905 | spin_lock(&files->file_lock); |
906 | err = expand_files(files, fd); | 906 | err = expand_files(files, fd); |
@@ -926,7 +926,7 @@ SYSCALL_DEFINE3(dup3, unsigned int, oldfd, unsigned int, newfd, int, flags) | |||
926 | return -EINVAL; | 926 | return -EINVAL; |
927 | 927 | ||
928 | if (newfd >= rlimit(RLIMIT_NOFILE)) | 928 | if (newfd >= rlimit(RLIMIT_NOFILE)) |
929 | return -EMFILE; | 929 | return -EBADF; |
930 | 930 | ||
931 | spin_lock(&files->file_lock); | 931 | spin_lock(&files->file_lock); |
932 | err = expand_files(files, newfd); | 932 | err = expand_files(files, newfd); |
diff --git a/fs/jfs/jfs_discard.c b/fs/jfs/jfs_discard.c index 9947563e4175..dfcd50304559 100644 --- a/fs/jfs/jfs_discard.c +++ b/fs/jfs/jfs_discard.c | |||
@@ -83,7 +83,7 @@ int jfs_ioc_trim(struct inode *ip, struct fstrim_range *range) | |||
83 | struct bmap *bmp = JFS_SBI(ip->i_sb)->bmap; | 83 | struct bmap *bmp = JFS_SBI(ip->i_sb)->bmap; |
84 | struct super_block *sb = ipbmap->i_sb; | 84 | struct super_block *sb = ipbmap->i_sb; |
85 | int agno, agno_end; | 85 | int agno, agno_end; |
86 | s64 start, end, minlen; | 86 | u64 start, end, minlen; |
87 | u64 trimmed = 0; | 87 | u64 trimmed = 0; |
88 | 88 | ||
89 | /** | 89 | /** |
@@ -93,15 +93,19 @@ int jfs_ioc_trim(struct inode *ip, struct fstrim_range *range) | |||
93 | * minlen: minimum extent length in Bytes | 93 | * minlen: minimum extent length in Bytes |
94 | */ | 94 | */ |
95 | start = range->start >> sb->s_blocksize_bits; | 95 | start = range->start >> sb->s_blocksize_bits; |
96 | if (start < 0) | ||
97 | start = 0; | ||
98 | end = start + (range->len >> sb->s_blocksize_bits) - 1; | 96 | end = start + (range->len >> sb->s_blocksize_bits) - 1; |
99 | if (end >= bmp->db_mapsize) | ||
100 | end = bmp->db_mapsize - 1; | ||
101 | minlen = range->minlen >> sb->s_blocksize_bits; | 97 | minlen = range->minlen >> sb->s_blocksize_bits; |
102 | if (minlen <= 0) | 98 | if (minlen == 0) |
103 | minlen = 1; | 99 | minlen = 1; |
104 | 100 | ||
101 | if (minlen > bmp->db_agsize || | ||
102 | start >= bmp->db_mapsize || | ||
103 | range->len < sb->s_blocksize) | ||
104 | return -EINVAL; | ||
105 | |||
106 | if (end >= bmp->db_mapsize) | ||
107 | end = bmp->db_mapsize - 1; | ||
108 | |||
105 | /** | 109 | /** |
106 | * we trim all ag's within the range | 110 | * we trim all ag's within the range |
107 | */ | 111 | */ |
diff --git a/fs/lockd/mon.c b/fs/lockd/mon.c index e4fb3ba5a58a..3d7e09bcc0e9 100644 --- a/fs/lockd/mon.c +++ b/fs/lockd/mon.c | |||
@@ -85,29 +85,38 @@ static struct rpc_clnt *nsm_create(struct net *net) | |||
85 | return rpc_create(&args); | 85 | return rpc_create(&args); |
86 | } | 86 | } |
87 | 87 | ||
88 | static struct rpc_clnt *nsm_client_set(struct lockd_net *ln, | ||
89 | struct rpc_clnt *clnt) | ||
90 | { | ||
91 | spin_lock(&ln->nsm_clnt_lock); | ||
92 | if (ln->nsm_users == 0) { | ||
93 | if (clnt == NULL) | ||
94 | goto out; | ||
95 | ln->nsm_clnt = clnt; | ||
96 | } | ||
97 | clnt = ln->nsm_clnt; | ||
98 | ln->nsm_users++; | ||
99 | out: | ||
100 | spin_unlock(&ln->nsm_clnt_lock); | ||
101 | return clnt; | ||
102 | } | ||
103 | |||
88 | static struct rpc_clnt *nsm_client_get(struct net *net) | 104 | static struct rpc_clnt *nsm_client_get(struct net *net) |
89 | { | 105 | { |
90 | static DEFINE_MUTEX(nsm_create_mutex); | 106 | struct rpc_clnt *clnt, *new; |
91 | struct rpc_clnt *clnt; | ||
92 | struct lockd_net *ln = net_generic(net, lockd_net_id); | 107 | struct lockd_net *ln = net_generic(net, lockd_net_id); |
93 | 108 | ||
94 | spin_lock(&ln->nsm_clnt_lock); | 109 | clnt = nsm_client_set(ln, NULL); |
95 | if (ln->nsm_users) { | 110 | if (clnt != NULL) |
96 | ln->nsm_users++; | ||
97 | clnt = ln->nsm_clnt; | ||
98 | spin_unlock(&ln->nsm_clnt_lock); | ||
99 | goto out; | 111 | goto out; |
100 | } | ||
101 | spin_unlock(&ln->nsm_clnt_lock); | ||
102 | 112 | ||
103 | mutex_lock(&nsm_create_mutex); | 113 | clnt = new = nsm_create(net); |
104 | clnt = nsm_create(net); | 114 | if (IS_ERR(clnt)) |
105 | if (!IS_ERR(clnt)) { | 115 | goto out; |
106 | ln->nsm_clnt = clnt; | 116 | |
107 | smp_wmb(); | 117 | clnt = nsm_client_set(ln, new); |
108 | ln->nsm_users = 1; | 118 | if (clnt != new) |
109 | } | 119 | rpc_shutdown_client(new); |
110 | mutex_unlock(&nsm_create_mutex); | ||
111 | out: | 120 | out: |
112 | return clnt; | 121 | return clnt; |
113 | } | 122 | } |
@@ -115,18 +124,16 @@ out: | |||
115 | static void nsm_client_put(struct net *net) | 124 | static void nsm_client_put(struct net *net) |
116 | { | 125 | { |
117 | struct lockd_net *ln = net_generic(net, lockd_net_id); | 126 | struct lockd_net *ln = net_generic(net, lockd_net_id); |
118 | struct rpc_clnt *clnt = ln->nsm_clnt; | 127 | struct rpc_clnt *clnt = NULL; |
119 | int shutdown = 0; | ||
120 | 128 | ||
121 | spin_lock(&ln->nsm_clnt_lock); | 129 | spin_lock(&ln->nsm_clnt_lock); |
122 | if (ln->nsm_users) { | 130 | ln->nsm_users--; |
123 | if (--ln->nsm_users) | 131 | if (ln->nsm_users == 0) { |
124 | ln->nsm_clnt = NULL; | 132 | clnt = ln->nsm_clnt; |
125 | shutdown = !ln->nsm_users; | 133 | ln->nsm_clnt = NULL; |
126 | } | 134 | } |
127 | spin_unlock(&ln->nsm_clnt_lock); | 135 | spin_unlock(&ln->nsm_clnt_lock); |
128 | 136 | if (clnt != NULL) | |
129 | if (shutdown) | ||
130 | rpc_shutdown_client(clnt); | 137 | rpc_shutdown_client(clnt); |
131 | } | 138 | } |
132 | 139 | ||
diff --git a/fs/namei.c b/fs/namei.c index d1895f308156..937f9d50c84b 100644 --- a/fs/namei.c +++ b/fs/namei.c | |||
@@ -705,8 +705,8 @@ static inline void put_link(struct nameidata *nd, struct path *link, void *cooki | |||
705 | path_put(link); | 705 | path_put(link); |
706 | } | 706 | } |
707 | 707 | ||
708 | int sysctl_protected_symlinks __read_mostly = 1; | 708 | int sysctl_protected_symlinks __read_mostly = 0; |
709 | int sysctl_protected_hardlinks __read_mostly = 1; | 709 | int sysctl_protected_hardlinks __read_mostly = 0; |
710 | 710 | ||
711 | /** | 711 | /** |
712 | * may_follow_link - Check symlink following for unsafe situations | 712 | * may_follow_link - Check symlink following for unsafe situations |
diff --git a/fs/nfs/callback.c b/fs/nfs/callback.c index 9a521fb39869..5088b57b078a 100644 --- a/fs/nfs/callback.c +++ b/fs/nfs/callback.c | |||
@@ -241,7 +241,7 @@ static int nfs_callback_start_svc(int minorversion, struct rpc_xprt *xprt, | |||
241 | svc_exit_thread(cb_info->rqst); | 241 | svc_exit_thread(cb_info->rqst); |
242 | cb_info->rqst = NULL; | 242 | cb_info->rqst = NULL; |
243 | cb_info->task = NULL; | 243 | cb_info->task = NULL; |
244 | return PTR_ERR(cb_info->task); | 244 | return ret; |
245 | } | 245 | } |
246 | dprintk("nfs_callback_up: service started\n"); | 246 | dprintk("nfs_callback_up: service started\n"); |
247 | return 0; | 247 | return 0; |
diff --git a/fs/nfs/dns_resolve.c b/fs/nfs/dns_resolve.c index 31c26c4dcc23..ca4b11ec87a2 100644 --- a/fs/nfs/dns_resolve.c +++ b/fs/nfs/dns_resolve.c | |||
@@ -217,7 +217,7 @@ static int nfs_dns_parse(struct cache_detail *cd, char *buf, int buflen) | |||
217 | { | 217 | { |
218 | char buf1[NFS_DNS_HOSTNAME_MAXLEN+1]; | 218 | char buf1[NFS_DNS_HOSTNAME_MAXLEN+1]; |
219 | struct nfs_dns_ent key, *item; | 219 | struct nfs_dns_ent key, *item; |
220 | unsigned long ttl; | 220 | unsigned int ttl; |
221 | ssize_t len; | 221 | ssize_t len; |
222 | int ret = -EINVAL; | 222 | int ret = -EINVAL; |
223 | 223 | ||
@@ -240,7 +240,8 @@ static int nfs_dns_parse(struct cache_detail *cd, char *buf, int buflen) | |||
240 | key.namelen = len; | 240 | key.namelen = len; |
241 | memset(&key.h, 0, sizeof(key.h)); | 241 | memset(&key.h, 0, sizeof(key.h)); |
242 | 242 | ||
243 | ttl = get_expiry(&buf); | 243 | if (get_uint(&buf, &ttl) < 0) |
244 | goto out; | ||
244 | if (ttl == 0) | 245 | if (ttl == 0) |
245 | goto out; | 246 | goto out; |
246 | key.h.expiry_time = ttl + seconds_since_boot(); | 247 | key.h.expiry_time = ttl + seconds_since_boot(); |
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c index 5c7325c5c5e6..6fa01aea2488 100644 --- a/fs/nfs/inode.c +++ b/fs/nfs/inode.c | |||
@@ -685,7 +685,10 @@ static void __put_nfs_open_context(struct nfs_open_context *ctx, int is_sync) | |||
685 | if (ctx->cred != NULL) | 685 | if (ctx->cred != NULL) |
686 | put_rpccred(ctx->cred); | 686 | put_rpccred(ctx->cred); |
687 | dput(ctx->dentry); | 687 | dput(ctx->dentry); |
688 | nfs_sb_deactive(sb); | 688 | if (is_sync) |
689 | nfs_sb_deactive(sb); | ||
690 | else | ||
691 | nfs_sb_deactive_async(sb); | ||
689 | kfree(ctx->mdsthreshold); | 692 | kfree(ctx->mdsthreshold); |
690 | kfree(ctx); | 693 | kfree(ctx); |
691 | } | 694 | } |
diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h index 59b133c5d652..05521cadac2e 100644 --- a/fs/nfs/internal.h +++ b/fs/nfs/internal.h | |||
@@ -351,10 +351,12 @@ extern int __init register_nfs_fs(void); | |||
351 | extern void __exit unregister_nfs_fs(void); | 351 | extern void __exit unregister_nfs_fs(void); |
352 | extern void nfs_sb_active(struct super_block *sb); | 352 | extern void nfs_sb_active(struct super_block *sb); |
353 | extern void nfs_sb_deactive(struct super_block *sb); | 353 | extern void nfs_sb_deactive(struct super_block *sb); |
354 | extern void nfs_sb_deactive_async(struct super_block *sb); | ||
354 | 355 | ||
355 | /* namespace.c */ | 356 | /* namespace.c */ |
357 | #define NFS_PATH_CANONICAL 1 | ||
356 | extern char *nfs_path(char **p, struct dentry *dentry, | 358 | extern char *nfs_path(char **p, struct dentry *dentry, |
357 | char *buffer, ssize_t buflen); | 359 | char *buffer, ssize_t buflen, unsigned flags); |
358 | extern struct vfsmount *nfs_d_automount(struct path *path); | 360 | extern struct vfsmount *nfs_d_automount(struct path *path); |
359 | struct vfsmount *nfs_submount(struct nfs_server *, struct dentry *, | 361 | struct vfsmount *nfs_submount(struct nfs_server *, struct dentry *, |
360 | struct nfs_fh *, struct nfs_fattr *); | 362 | struct nfs_fh *, struct nfs_fattr *); |
@@ -498,7 +500,7 @@ static inline char *nfs_devname(struct dentry *dentry, | |||
498 | char *buffer, ssize_t buflen) | 500 | char *buffer, ssize_t buflen) |
499 | { | 501 | { |
500 | char *dummy; | 502 | char *dummy; |
501 | return nfs_path(&dummy, dentry, buffer, buflen); | 503 | return nfs_path(&dummy, dentry, buffer, buflen, NFS_PATH_CANONICAL); |
502 | } | 504 | } |
503 | 505 | ||
504 | /* | 506 | /* |
diff --git a/fs/nfs/mount_clnt.c b/fs/nfs/mount_clnt.c index 8e65c7f1f87c..015f71f8f62c 100644 --- a/fs/nfs/mount_clnt.c +++ b/fs/nfs/mount_clnt.c | |||
@@ -181,7 +181,7 @@ int nfs_mount(struct nfs_mount_request *info) | |||
181 | else | 181 | else |
182 | msg.rpc_proc = &mnt_clnt->cl_procinfo[MOUNTPROC_MNT]; | 182 | msg.rpc_proc = &mnt_clnt->cl_procinfo[MOUNTPROC_MNT]; |
183 | 183 | ||
184 | status = rpc_call_sync(mnt_clnt, &msg, 0); | 184 | status = rpc_call_sync(mnt_clnt, &msg, RPC_TASK_SOFT|RPC_TASK_TIMEOUT); |
185 | rpc_shutdown_client(mnt_clnt); | 185 | rpc_shutdown_client(mnt_clnt); |
186 | 186 | ||
187 | if (status < 0) | 187 | if (status < 0) |
diff --git a/fs/nfs/namespace.c b/fs/nfs/namespace.c index 655925373b91..dd057bc6b65b 100644 --- a/fs/nfs/namespace.c +++ b/fs/nfs/namespace.c | |||
@@ -33,6 +33,7 @@ int nfs_mountpoint_expiry_timeout = 500 * HZ; | |||
33 | * @dentry - pointer to dentry | 33 | * @dentry - pointer to dentry |
34 | * @buffer - result buffer | 34 | * @buffer - result buffer |
35 | * @buflen - length of buffer | 35 | * @buflen - length of buffer |
36 | * @flags - options (see below) | ||
36 | * | 37 | * |
37 | * Helper function for constructing the server pathname | 38 | * Helper function for constructing the server pathname |
38 | * by arbitrary hashed dentry. | 39 | * by arbitrary hashed dentry. |
@@ -40,8 +41,14 @@ int nfs_mountpoint_expiry_timeout = 500 * HZ; | |||
40 | * This is mainly for use in figuring out the path on the | 41 | * This is mainly for use in figuring out the path on the |
41 | * server side when automounting on top of an existing partition | 42 | * server side when automounting on top of an existing partition |
42 | * and in generating /proc/mounts and friends. | 43 | * and in generating /proc/mounts and friends. |
44 | * | ||
45 | * Supported flags: | ||
46 | * NFS_PATH_CANONICAL: ensure there is exactly one slash after | ||
47 | * the original device (export) name | ||
48 | * (if unset, the original name is returned verbatim) | ||
43 | */ | 49 | */ |
44 | char *nfs_path(char **p, struct dentry *dentry, char *buffer, ssize_t buflen) | 50 | char *nfs_path(char **p, struct dentry *dentry, char *buffer, ssize_t buflen, |
51 | unsigned flags) | ||
45 | { | 52 | { |
46 | char *end; | 53 | char *end; |
47 | int namelen; | 54 | int namelen; |
@@ -74,7 +81,7 @@ rename_retry: | |||
74 | rcu_read_unlock(); | 81 | rcu_read_unlock(); |
75 | goto rename_retry; | 82 | goto rename_retry; |
76 | } | 83 | } |
77 | if (*end != '/') { | 84 | if ((flags & NFS_PATH_CANONICAL) && *end != '/') { |
78 | if (--buflen < 0) { | 85 | if (--buflen < 0) { |
79 | spin_unlock(&dentry->d_lock); | 86 | spin_unlock(&dentry->d_lock); |
80 | rcu_read_unlock(); | 87 | rcu_read_unlock(); |
@@ -91,9 +98,11 @@ rename_retry: | |||
91 | return end; | 98 | return end; |
92 | } | 99 | } |
93 | namelen = strlen(base); | 100 | namelen = strlen(base); |
94 | /* Strip off excess slashes in base string */ | 101 | if (flags & NFS_PATH_CANONICAL) { |
95 | while (namelen > 0 && base[namelen - 1] == '/') | 102 | /* Strip off excess slashes in base string */ |
96 | namelen--; | 103 | while (namelen > 0 && base[namelen - 1] == '/') |
104 | namelen--; | ||
105 | } | ||
97 | buflen -= namelen; | 106 | buflen -= namelen; |
98 | if (buflen < 0) { | 107 | if (buflen < 0) { |
99 | spin_unlock(&dentry->d_lock); | 108 | spin_unlock(&dentry->d_lock); |
diff --git a/fs/nfs/nfs4filelayout.c b/fs/nfs/nfs4filelayout.c index 52d847212066..2e45fd9c02a3 100644 --- a/fs/nfs/nfs4filelayout.c +++ b/fs/nfs/nfs4filelayout.c | |||
@@ -122,12 +122,21 @@ static void filelayout_reset_read(struct nfs_read_data *data) | |||
122 | } | 122 | } |
123 | } | 123 | } |
124 | 124 | ||
125 | static void filelayout_fenceme(struct inode *inode, struct pnfs_layout_hdr *lo) | ||
126 | { | ||
127 | if (!test_and_clear_bit(NFS_LAYOUT_RETURN, &lo->plh_flags)) | ||
128 | return; | ||
129 | clear_bit(NFS_INO_LAYOUTCOMMIT, &NFS_I(inode)->flags); | ||
130 | pnfs_return_layout(inode); | ||
131 | } | ||
132 | |||
125 | static int filelayout_async_handle_error(struct rpc_task *task, | 133 | static int filelayout_async_handle_error(struct rpc_task *task, |
126 | struct nfs4_state *state, | 134 | struct nfs4_state *state, |
127 | struct nfs_client *clp, | 135 | struct nfs_client *clp, |
128 | struct pnfs_layout_segment *lseg) | 136 | struct pnfs_layout_segment *lseg) |
129 | { | 137 | { |
130 | struct inode *inode = lseg->pls_layout->plh_inode; | 138 | struct pnfs_layout_hdr *lo = lseg->pls_layout; |
139 | struct inode *inode = lo->plh_inode; | ||
131 | struct nfs_server *mds_server = NFS_SERVER(inode); | 140 | struct nfs_server *mds_server = NFS_SERVER(inode); |
132 | struct nfs4_deviceid_node *devid = FILELAYOUT_DEVID_NODE(lseg); | 141 | struct nfs4_deviceid_node *devid = FILELAYOUT_DEVID_NODE(lseg); |
133 | struct nfs_client *mds_client = mds_server->nfs_client; | 142 | struct nfs_client *mds_client = mds_server->nfs_client; |
@@ -204,10 +213,8 @@ static int filelayout_async_handle_error(struct rpc_task *task, | |||
204 | dprintk("%s DS connection error %d\n", __func__, | 213 | dprintk("%s DS connection error %d\n", __func__, |
205 | task->tk_status); | 214 | task->tk_status); |
206 | nfs4_mark_deviceid_unavailable(devid); | 215 | nfs4_mark_deviceid_unavailable(devid); |
207 | clear_bit(NFS_INO_LAYOUTCOMMIT, &NFS_I(inode)->flags); | 216 | set_bit(NFS_LAYOUT_RETURN, &lo->plh_flags); |
208 | _pnfs_return_layout(inode); | ||
209 | rpc_wake_up(&tbl->slot_tbl_waitq); | 217 | rpc_wake_up(&tbl->slot_tbl_waitq); |
210 | nfs4_ds_disconnect(clp); | ||
211 | /* fall through */ | 218 | /* fall through */ |
212 | default: | 219 | default: |
213 | reset: | 220 | reset: |
@@ -331,7 +338,9 @@ static void filelayout_read_count_stats(struct rpc_task *task, void *data) | |||
331 | static void filelayout_read_release(void *data) | 338 | static void filelayout_read_release(void *data) |
332 | { | 339 | { |
333 | struct nfs_read_data *rdata = data; | 340 | struct nfs_read_data *rdata = data; |
341 | struct pnfs_layout_hdr *lo = rdata->header->lseg->pls_layout; | ||
334 | 342 | ||
343 | filelayout_fenceme(lo->plh_inode, lo); | ||
335 | nfs_put_client(rdata->ds_clp); | 344 | nfs_put_client(rdata->ds_clp); |
336 | rdata->header->mds_ops->rpc_release(data); | 345 | rdata->header->mds_ops->rpc_release(data); |
337 | } | 346 | } |
@@ -429,7 +438,9 @@ static void filelayout_write_count_stats(struct rpc_task *task, void *data) | |||
429 | static void filelayout_write_release(void *data) | 438 | static void filelayout_write_release(void *data) |
430 | { | 439 | { |
431 | struct nfs_write_data *wdata = data; | 440 | struct nfs_write_data *wdata = data; |
441 | struct pnfs_layout_hdr *lo = wdata->header->lseg->pls_layout; | ||
432 | 442 | ||
443 | filelayout_fenceme(lo->plh_inode, lo); | ||
433 | nfs_put_client(wdata->ds_clp); | 444 | nfs_put_client(wdata->ds_clp); |
434 | wdata->header->mds_ops->rpc_release(data); | 445 | wdata->header->mds_ops->rpc_release(data); |
435 | } | 446 | } |
@@ -739,7 +750,7 @@ filelayout_decode_layout(struct pnfs_layout_hdr *flo, | |||
739 | goto out_err; | 750 | goto out_err; |
740 | 751 | ||
741 | if (fl->num_fh > 0) { | 752 | if (fl->num_fh > 0) { |
742 | fl->fh_array = kzalloc(fl->num_fh * sizeof(struct nfs_fh *), | 753 | fl->fh_array = kcalloc(fl->num_fh, sizeof(fl->fh_array[0]), |
743 | gfp_flags); | 754 | gfp_flags); |
744 | if (!fl->fh_array) | 755 | if (!fl->fh_array) |
745 | goto out_err; | 756 | goto out_err; |
diff --git a/fs/nfs/nfs4filelayout.h b/fs/nfs/nfs4filelayout.h index dca47d786710..8c07241fe52b 100644 --- a/fs/nfs/nfs4filelayout.h +++ b/fs/nfs/nfs4filelayout.h | |||
@@ -149,6 +149,5 @@ extern void nfs4_fl_put_deviceid(struct nfs4_file_layout_dsaddr *dsaddr); | |||
149 | extern void nfs4_fl_free_deviceid(struct nfs4_file_layout_dsaddr *dsaddr); | 149 | extern void nfs4_fl_free_deviceid(struct nfs4_file_layout_dsaddr *dsaddr); |
150 | struct nfs4_file_layout_dsaddr * | 150 | struct nfs4_file_layout_dsaddr * |
151 | filelayout_get_device_info(struct inode *inode, struct nfs4_deviceid *dev_id, gfp_t gfp_flags); | 151 | filelayout_get_device_info(struct inode *inode, struct nfs4_deviceid *dev_id, gfp_t gfp_flags); |
152 | void nfs4_ds_disconnect(struct nfs_client *clp); | ||
153 | 152 | ||
154 | #endif /* FS_NFS_NFS4FILELAYOUT_H */ | 153 | #endif /* FS_NFS_NFS4FILELAYOUT_H */ |
diff --git a/fs/nfs/nfs4filelayoutdev.c b/fs/nfs/nfs4filelayoutdev.c index 3336d5eaf879..a8eaa9b7bb0f 100644 --- a/fs/nfs/nfs4filelayoutdev.c +++ b/fs/nfs/nfs4filelayoutdev.c | |||
@@ -149,28 +149,6 @@ _data_server_lookup_locked(const struct list_head *dsaddrs) | |||
149 | } | 149 | } |
150 | 150 | ||
151 | /* | 151 | /* |
152 | * Lookup DS by nfs_client pointer. Zero data server client pointer | ||
153 | */ | ||
154 | void nfs4_ds_disconnect(struct nfs_client *clp) | ||
155 | { | ||
156 | struct nfs4_pnfs_ds *ds; | ||
157 | struct nfs_client *found = NULL; | ||
158 | |||
159 | dprintk("%s clp %p\n", __func__, clp); | ||
160 | spin_lock(&nfs4_ds_cache_lock); | ||
161 | list_for_each_entry(ds, &nfs4_data_server_cache, ds_node) | ||
162 | if (ds->ds_clp && ds->ds_clp == clp) { | ||
163 | found = ds->ds_clp; | ||
164 | ds->ds_clp = NULL; | ||
165 | } | ||
166 | spin_unlock(&nfs4_ds_cache_lock); | ||
167 | if (found) { | ||
168 | set_bit(NFS_CS_STOP_RENEW, &clp->cl_res_state); | ||
169 | nfs_put_client(clp); | ||
170 | } | ||
171 | } | ||
172 | |||
173 | /* | ||
174 | * Create an rpc connection to the nfs4_pnfs_ds data server | 152 | * Create an rpc connection to the nfs4_pnfs_ds data server |
175 | * Currently only supports IPv4 and IPv6 addresses | 153 | * Currently only supports IPv4 and IPv6 addresses |
176 | */ | 154 | */ |
diff --git a/fs/nfs/nfs4getroot.c b/fs/nfs/nfs4getroot.c index 6a83780e0ce6..549462e5b9b0 100644 --- a/fs/nfs/nfs4getroot.c +++ b/fs/nfs/nfs4getroot.c | |||
@@ -5,6 +5,7 @@ | |||
5 | 5 | ||
6 | #include <linux/nfs_fs.h> | 6 | #include <linux/nfs_fs.h> |
7 | #include "nfs4_fs.h" | 7 | #include "nfs4_fs.h" |
8 | #include "internal.h" | ||
8 | 9 | ||
9 | #define NFSDBG_FACILITY NFSDBG_CLIENT | 10 | #define NFSDBG_FACILITY NFSDBG_CLIENT |
10 | 11 | ||
diff --git a/fs/nfs/nfs4namespace.c b/fs/nfs/nfs4namespace.c index 79fbb61ce202..1e09eb78543b 100644 --- a/fs/nfs/nfs4namespace.c +++ b/fs/nfs/nfs4namespace.c | |||
@@ -81,7 +81,8 @@ static char *nfs_path_component(const char *nfspath, const char *end) | |||
81 | static char *nfs4_path(struct dentry *dentry, char *buffer, ssize_t buflen) | 81 | static char *nfs4_path(struct dentry *dentry, char *buffer, ssize_t buflen) |
82 | { | 82 | { |
83 | char *limit; | 83 | char *limit; |
84 | char *path = nfs_path(&limit, dentry, buffer, buflen); | 84 | char *path = nfs_path(&limit, dentry, buffer, buflen, |
85 | NFS_PATH_CANONICAL); | ||
85 | if (!IS_ERR(path)) { | 86 | if (!IS_ERR(path)) { |
86 | char *path_component = nfs_path_component(path, limit); | 87 | char *path_component = nfs_path_component(path, limit); |
87 | if (path_component) | 88 | if (path_component) |
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 68b21d81b7ac..5eec4429970c 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
@@ -339,8 +339,7 @@ static int nfs4_handle_exception(struct nfs_server *server, int errorcode, struc | |||
339 | dprintk("%s ERROR: %d Reset session\n", __func__, | 339 | dprintk("%s ERROR: %d Reset session\n", __func__, |
340 | errorcode); | 340 | errorcode); |
341 | nfs4_schedule_session_recovery(clp->cl_session, errorcode); | 341 | nfs4_schedule_session_recovery(clp->cl_session, errorcode); |
342 | exception->retry = 1; | 342 | goto wait_on_recovery; |
343 | break; | ||
344 | #endif /* defined(CONFIG_NFS_V4_1) */ | 343 | #endif /* defined(CONFIG_NFS_V4_1) */ |
345 | case -NFS4ERR_FILE_OPEN: | 344 | case -NFS4ERR_FILE_OPEN: |
346 | if (exception->timeout > HZ) { | 345 | if (exception->timeout > HZ) { |
@@ -1572,9 +1571,11 @@ static void nfs4_open_prepare(struct rpc_task *task, void *calldata) | |||
1572 | data->timestamp = jiffies; | 1571 | data->timestamp = jiffies; |
1573 | if (nfs4_setup_sequence(data->o_arg.server, | 1572 | if (nfs4_setup_sequence(data->o_arg.server, |
1574 | &data->o_arg.seq_args, | 1573 | &data->o_arg.seq_args, |
1575 | &data->o_res.seq_res, task)) | 1574 | &data->o_res.seq_res, |
1576 | return; | 1575 | task) != 0) |
1577 | rpc_call_start(task); | 1576 | nfs_release_seqid(data->o_arg.seqid); |
1577 | else | ||
1578 | rpc_call_start(task); | ||
1578 | return; | 1579 | return; |
1579 | unlock_no_action: | 1580 | unlock_no_action: |
1580 | rcu_read_unlock(); | 1581 | rcu_read_unlock(); |
@@ -1748,7 +1749,7 @@ static int nfs4_opendata_access(struct rpc_cred *cred, | |||
1748 | 1749 | ||
1749 | /* even though OPEN succeeded, access is denied. Close the file */ | 1750 | /* even though OPEN succeeded, access is denied. Close the file */ |
1750 | nfs4_close_state(state, fmode); | 1751 | nfs4_close_state(state, fmode); |
1751 | return -NFS4ERR_ACCESS; | 1752 | return -EACCES; |
1752 | } | 1753 | } |
1753 | 1754 | ||
1754 | /* | 1755 | /* |
@@ -2196,7 +2197,7 @@ static void nfs4_free_closedata(void *data) | |||
2196 | nfs4_put_open_state(calldata->state); | 2197 | nfs4_put_open_state(calldata->state); |
2197 | nfs_free_seqid(calldata->arg.seqid); | 2198 | nfs_free_seqid(calldata->arg.seqid); |
2198 | nfs4_put_state_owner(sp); | 2199 | nfs4_put_state_owner(sp); |
2199 | nfs_sb_deactive(sb); | 2200 | nfs_sb_deactive_async(sb); |
2200 | kfree(calldata); | 2201 | kfree(calldata); |
2201 | } | 2202 | } |
2202 | 2203 | ||
@@ -2296,9 +2297,10 @@ static void nfs4_close_prepare(struct rpc_task *task, void *data) | |||
2296 | if (nfs4_setup_sequence(NFS_SERVER(inode), | 2297 | if (nfs4_setup_sequence(NFS_SERVER(inode), |
2297 | &calldata->arg.seq_args, | 2298 | &calldata->arg.seq_args, |
2298 | &calldata->res.seq_res, | 2299 | &calldata->res.seq_res, |
2299 | task)) | 2300 | task) != 0) |
2300 | goto out; | 2301 | nfs_release_seqid(calldata->arg.seqid); |
2301 | rpc_call_start(task); | 2302 | else |
2303 | rpc_call_start(task); | ||
2302 | out: | 2304 | out: |
2303 | dprintk("%s: done!\n", __func__); | 2305 | dprintk("%s: done!\n", __func__); |
2304 | } | 2306 | } |
@@ -4529,6 +4531,7 @@ static void nfs4_locku_done(struct rpc_task *task, void *data) | |||
4529 | if (nfs4_async_handle_error(task, calldata->server, NULL) == -EAGAIN) | 4531 | if (nfs4_async_handle_error(task, calldata->server, NULL) == -EAGAIN) |
4530 | rpc_restart_call_prepare(task); | 4532 | rpc_restart_call_prepare(task); |
4531 | } | 4533 | } |
4534 | nfs_release_seqid(calldata->arg.seqid); | ||
4532 | } | 4535 | } |
4533 | 4536 | ||
4534 | static void nfs4_locku_prepare(struct rpc_task *task, void *data) | 4537 | static void nfs4_locku_prepare(struct rpc_task *task, void *data) |
@@ -4545,9 +4548,11 @@ static void nfs4_locku_prepare(struct rpc_task *task, void *data) | |||
4545 | calldata->timestamp = jiffies; | 4548 | calldata->timestamp = jiffies; |
4546 | if (nfs4_setup_sequence(calldata->server, | 4549 | if (nfs4_setup_sequence(calldata->server, |
4547 | &calldata->arg.seq_args, | 4550 | &calldata->arg.seq_args, |
4548 | &calldata->res.seq_res, task)) | 4551 | &calldata->res.seq_res, |
4549 | return; | 4552 | task) != 0) |
4550 | rpc_call_start(task); | 4553 | nfs_release_seqid(calldata->arg.seqid); |
4554 | else | ||
4555 | rpc_call_start(task); | ||
4551 | } | 4556 | } |
4552 | 4557 | ||
4553 | static const struct rpc_call_ops nfs4_locku_ops = { | 4558 | static const struct rpc_call_ops nfs4_locku_ops = { |
@@ -4692,7 +4697,7 @@ static void nfs4_lock_prepare(struct rpc_task *task, void *calldata) | |||
4692 | /* Do we need to do an open_to_lock_owner? */ | 4697 | /* Do we need to do an open_to_lock_owner? */ |
4693 | if (!(data->arg.lock_seqid->sequence->flags & NFS_SEQID_CONFIRMED)) { | 4698 | if (!(data->arg.lock_seqid->sequence->flags & NFS_SEQID_CONFIRMED)) { |
4694 | if (nfs_wait_on_sequence(data->arg.open_seqid, task) != 0) | 4699 | if (nfs_wait_on_sequence(data->arg.open_seqid, task) != 0) |
4695 | return; | 4700 | goto out_release_lock_seqid; |
4696 | data->arg.open_stateid = &state->stateid; | 4701 | data->arg.open_stateid = &state->stateid; |
4697 | data->arg.new_lock_owner = 1; | 4702 | data->arg.new_lock_owner = 1; |
4698 | data->res.open_seqid = data->arg.open_seqid; | 4703 | data->res.open_seqid = data->arg.open_seqid; |
@@ -4701,10 +4706,15 @@ static void nfs4_lock_prepare(struct rpc_task *task, void *calldata) | |||
4701 | data->timestamp = jiffies; | 4706 | data->timestamp = jiffies; |
4702 | if (nfs4_setup_sequence(data->server, | 4707 | if (nfs4_setup_sequence(data->server, |
4703 | &data->arg.seq_args, | 4708 | &data->arg.seq_args, |
4704 | &data->res.seq_res, task)) | 4709 | &data->res.seq_res, |
4710 | task) == 0) { | ||
4711 | rpc_call_start(task); | ||
4705 | return; | 4712 | return; |
4706 | rpc_call_start(task); | 4713 | } |
4707 | dprintk("%s: done!, ret = %d\n", __func__, data->rpc_status); | 4714 | nfs_release_seqid(data->arg.open_seqid); |
4715 | out_release_lock_seqid: | ||
4716 | nfs_release_seqid(data->arg.lock_seqid); | ||
4717 | dprintk("%s: done!, ret = %d\n", __func__, task->tk_status); | ||
4708 | } | 4718 | } |
4709 | 4719 | ||
4710 | static void nfs4_recover_lock_prepare(struct rpc_task *task, void *calldata) | 4720 | static void nfs4_recover_lock_prepare(struct rpc_task *task, void *calldata) |
@@ -5667,7 +5677,7 @@ static void nfs4_add_and_init_slots(struct nfs4_slot_table *tbl, | |||
5667 | tbl->slots = new; | 5677 | tbl->slots = new; |
5668 | tbl->max_slots = max_slots; | 5678 | tbl->max_slots = max_slots; |
5669 | } | 5679 | } |
5670 | tbl->highest_used_slotid = -1; /* no slot is currently used */ | 5680 | tbl->highest_used_slotid = NFS4_NO_SLOT; |
5671 | for (i = 0; i < tbl->max_slots; i++) | 5681 | for (i = 0; i < tbl->max_slots; i++) |
5672 | tbl->slots[i].seq_nr = ivalue; | 5682 | tbl->slots[i].seq_nr = ivalue; |
5673 | spin_unlock(&tbl->slot_tbl_lock); | 5683 | spin_unlock(&tbl->slot_tbl_lock); |
diff --git a/fs/nfs/objlayout/objio_osd.c b/fs/nfs/objlayout/objio_osd.c index be731e6b7b9c..c6f990656f89 100644 --- a/fs/nfs/objlayout/objio_osd.c +++ b/fs/nfs/objlayout/objio_osd.c | |||
@@ -369,7 +369,7 @@ void objio_free_result(struct objlayout_io_res *oir) | |||
369 | kfree(objios); | 369 | kfree(objios); |
370 | } | 370 | } |
371 | 371 | ||
372 | enum pnfs_osd_errno osd_pri_2_pnfs_err(enum osd_err_priority oep) | 372 | static enum pnfs_osd_errno osd_pri_2_pnfs_err(enum osd_err_priority oep) |
373 | { | 373 | { |
374 | switch (oep) { | 374 | switch (oep) { |
375 | case OSD_ERR_PRI_NO_ERROR: | 375 | case OSD_ERR_PRI_NO_ERROR: |
@@ -574,7 +574,7 @@ static bool objio_pg_test(struct nfs_pageio_descriptor *pgio, | |||
574 | (unsigned long)pgio->pg_layout_private; | 574 | (unsigned long)pgio->pg_layout_private; |
575 | } | 575 | } |
576 | 576 | ||
577 | void objio_init_read(struct nfs_pageio_descriptor *pgio, struct nfs_page *req) | 577 | static void objio_init_read(struct nfs_pageio_descriptor *pgio, struct nfs_page *req) |
578 | { | 578 | { |
579 | pnfs_generic_pg_init_read(pgio, req); | 579 | pnfs_generic_pg_init_read(pgio, req); |
580 | if (unlikely(pgio->pg_lseg == NULL)) | 580 | if (unlikely(pgio->pg_lseg == NULL)) |
@@ -604,7 +604,7 @@ static bool aligned_on_raid_stripe(u64 offset, struct ore_layout *layout, | |||
604 | return false; | 604 | return false; |
605 | } | 605 | } |
606 | 606 | ||
607 | void objio_init_write(struct nfs_pageio_descriptor *pgio, struct nfs_page *req) | 607 | static void objio_init_write(struct nfs_pageio_descriptor *pgio, struct nfs_page *req) |
608 | { | 608 | { |
609 | unsigned long stripe_end = 0; | 609 | unsigned long stripe_end = 0; |
610 | u64 wb_size; | 610 | u64 wb_size; |
diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c index fe624c91bd00..2878f97bd78d 100644 --- a/fs/nfs/pnfs.c +++ b/fs/nfs/pnfs.c | |||
@@ -925,8 +925,8 @@ pnfs_find_alloc_layout(struct inode *ino, | |||
925 | if (likely(nfsi->layout == NULL)) { /* Won the race? */ | 925 | if (likely(nfsi->layout == NULL)) { /* Won the race? */ |
926 | nfsi->layout = new; | 926 | nfsi->layout = new; |
927 | return new; | 927 | return new; |
928 | } | 928 | } else if (new != NULL) |
929 | pnfs_free_layout_hdr(new); | 929 | pnfs_free_layout_hdr(new); |
930 | out_existing: | 930 | out_existing: |
931 | pnfs_get_layout_hdr(nfsi->layout); | 931 | pnfs_get_layout_hdr(nfsi->layout); |
932 | return nfsi->layout; | 932 | return nfsi->layout; |
diff --git a/fs/nfs/pnfs.h b/fs/nfs/pnfs.h index 2d722dba1111..dbf7bba52da0 100644 --- a/fs/nfs/pnfs.h +++ b/fs/nfs/pnfs.h | |||
@@ -62,6 +62,7 @@ enum { | |||
62 | NFS_LAYOUT_RW_FAILED, /* get rw layout failed stop trying */ | 62 | NFS_LAYOUT_RW_FAILED, /* get rw layout failed stop trying */ |
63 | NFS_LAYOUT_BULK_RECALL, /* bulk recall affecting layout */ | 63 | NFS_LAYOUT_BULK_RECALL, /* bulk recall affecting layout */ |
64 | NFS_LAYOUT_ROC, /* some lseg had roc bit set */ | 64 | NFS_LAYOUT_ROC, /* some lseg had roc bit set */ |
65 | NFS_LAYOUT_RETURN, /* Return this layout ASAP */ | ||
65 | }; | 66 | }; |
66 | 67 | ||
67 | enum layoutdriver_policy_flags { | 68 | enum layoutdriver_policy_flags { |
diff --git a/fs/nfs/super.c b/fs/nfs/super.c index e831bce49766..652d3f7176a9 100644 --- a/fs/nfs/super.c +++ b/fs/nfs/super.c | |||
@@ -54,6 +54,7 @@ | |||
54 | #include <linux/parser.h> | 54 | #include <linux/parser.h> |
55 | #include <linux/nsproxy.h> | 55 | #include <linux/nsproxy.h> |
56 | #include <linux/rcupdate.h> | 56 | #include <linux/rcupdate.h> |
57 | #include <linux/kthread.h> | ||
57 | 58 | ||
58 | #include <asm/uaccess.h> | 59 | #include <asm/uaccess.h> |
59 | 60 | ||
@@ -415,6 +416,54 @@ void nfs_sb_deactive(struct super_block *sb) | |||
415 | } | 416 | } |
416 | EXPORT_SYMBOL_GPL(nfs_sb_deactive); | 417 | EXPORT_SYMBOL_GPL(nfs_sb_deactive); |
417 | 418 | ||
419 | static int nfs_deactivate_super_async_work(void *ptr) | ||
420 | { | ||
421 | struct super_block *sb = ptr; | ||
422 | |||
423 | deactivate_super(sb); | ||
424 | module_put_and_exit(0); | ||
425 | return 0; | ||
426 | } | ||
427 | |||
428 | /* | ||
429 | * same effect as deactivate_super, but will do final unmount in kthread | ||
430 | * context | ||
431 | */ | ||
432 | static void nfs_deactivate_super_async(struct super_block *sb) | ||
433 | { | ||
434 | struct task_struct *task; | ||
435 | char buf[INET6_ADDRSTRLEN + 1]; | ||
436 | struct nfs_server *server = NFS_SB(sb); | ||
437 | struct nfs_client *clp = server->nfs_client; | ||
438 | |||
439 | if (!atomic_add_unless(&sb->s_active, -1, 1)) { | ||
440 | rcu_read_lock(); | ||
441 | snprintf(buf, sizeof(buf), | ||
442 | rpc_peeraddr2str(clp->cl_rpcclient, RPC_DISPLAY_ADDR)); | ||
443 | rcu_read_unlock(); | ||
444 | |||
445 | __module_get(THIS_MODULE); | ||
446 | task = kthread_run(nfs_deactivate_super_async_work, sb, | ||
447 | "%s-deactivate-super", buf); | ||
448 | if (IS_ERR(task)) { | ||
449 | pr_err("%s: kthread_run: %ld\n", | ||
450 | __func__, PTR_ERR(task)); | ||
451 | /* make synchronous call and hope for the best */ | ||
452 | deactivate_super(sb); | ||
453 | module_put(THIS_MODULE); | ||
454 | } | ||
455 | } | ||
456 | } | ||
457 | |||
458 | void nfs_sb_deactive_async(struct super_block *sb) | ||
459 | { | ||
460 | struct nfs_server *server = NFS_SB(sb); | ||
461 | |||
462 | if (atomic_dec_and_test(&server->active)) | ||
463 | nfs_deactivate_super_async(sb); | ||
464 | } | ||
465 | EXPORT_SYMBOL_GPL(nfs_sb_deactive_async); | ||
466 | |||
418 | /* | 467 | /* |
419 | * Deliver file system statistics to userspace | 468 | * Deliver file system statistics to userspace |
420 | */ | 469 | */ |
@@ -771,7 +820,7 @@ int nfs_show_devname(struct seq_file *m, struct dentry *root) | |||
771 | int err = 0; | 820 | int err = 0; |
772 | if (!page) | 821 | if (!page) |
773 | return -ENOMEM; | 822 | return -ENOMEM; |
774 | devname = nfs_path(&dummy, root, page, PAGE_SIZE); | 823 | devname = nfs_path(&dummy, root, page, PAGE_SIZE, 0); |
775 | if (IS_ERR(devname)) | 824 | if (IS_ERR(devname)) |
776 | err = PTR_ERR(devname); | 825 | err = PTR_ERR(devname); |
777 | else | 826 | else |
diff --git a/fs/nfs/unlink.c b/fs/nfs/unlink.c index 13cea637eff8..3f79c77153b8 100644 --- a/fs/nfs/unlink.c +++ b/fs/nfs/unlink.c | |||
@@ -95,7 +95,7 @@ static void nfs_async_unlink_release(void *calldata) | |||
95 | 95 | ||
96 | nfs_dec_sillycount(data->dir); | 96 | nfs_dec_sillycount(data->dir); |
97 | nfs_free_unlinkdata(data); | 97 | nfs_free_unlinkdata(data); |
98 | nfs_sb_deactive(sb); | 98 | nfs_sb_deactive_async(sb); |
99 | } | 99 | } |
100 | 100 | ||
101 | static void nfs_unlink_prepare(struct rpc_task *task, void *calldata) | 101 | static void nfs_unlink_prepare(struct rpc_task *task, void *calldata) |
diff --git a/fs/proc/stat.c b/fs/proc/stat.c index 64c3b3172367..e296572c73ed 100644 --- a/fs/proc/stat.c +++ b/fs/proc/stat.c | |||
@@ -45,10 +45,13 @@ static cputime64_t get_iowait_time(int cpu) | |||
45 | 45 | ||
46 | static u64 get_idle_time(int cpu) | 46 | static u64 get_idle_time(int cpu) |
47 | { | 47 | { |
48 | u64 idle, idle_time = get_cpu_idle_time_us(cpu, NULL); | 48 | u64 idle, idle_time = -1ULL; |
49 | |||
50 | if (cpu_online(cpu)) | ||
51 | idle_time = get_cpu_idle_time_us(cpu, NULL); | ||
49 | 52 | ||
50 | if (idle_time == -1ULL) | 53 | if (idle_time == -1ULL) |
51 | /* !NO_HZ so we can rely on cpustat.idle */ | 54 | /* !NO_HZ or cpu offline so we can rely on cpustat.idle */ |
52 | idle = kcpustat_cpu(cpu).cpustat[CPUTIME_IDLE]; | 55 | idle = kcpustat_cpu(cpu).cpustat[CPUTIME_IDLE]; |
53 | else | 56 | else |
54 | idle = usecs_to_cputime64(idle_time); | 57 | idle = usecs_to_cputime64(idle_time); |
@@ -58,10 +61,13 @@ static u64 get_idle_time(int cpu) | |||
58 | 61 | ||
59 | static u64 get_iowait_time(int cpu) | 62 | static u64 get_iowait_time(int cpu) |
60 | { | 63 | { |
61 | u64 iowait, iowait_time = get_cpu_iowait_time_us(cpu, NULL); | 64 | u64 iowait, iowait_time = -1ULL; |
65 | |||
66 | if (cpu_online(cpu)) | ||
67 | iowait_time = get_cpu_iowait_time_us(cpu, NULL); | ||
62 | 68 | ||
63 | if (iowait_time == -1ULL) | 69 | if (iowait_time == -1ULL) |
64 | /* !NO_HZ so we can rely on cpustat.iowait */ | 70 | /* !NO_HZ or cpu offline so we can rely on cpustat.iowait */ |
65 | iowait = kcpustat_cpu(cpu).cpustat[CPUTIME_IOWAIT]; | 71 | iowait = kcpustat_cpu(cpu).cpustat[CPUTIME_IOWAIT]; |
66 | else | 72 | else |
67 | iowait = usecs_to_cputime64(iowait_time); | 73 | iowait = usecs_to_cputime64(iowait_time); |
diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c index 6b0bb00d4d2b..2fbdff6be25c 100644 --- a/fs/sysfs/dir.c +++ b/fs/sysfs/dir.c | |||
@@ -485,20 +485,18 @@ int __sysfs_add_one(struct sysfs_addrm_cxt *acxt, struct sysfs_dirent *sd) | |||
485 | /** | 485 | /** |
486 | * sysfs_pathname - return full path to sysfs dirent | 486 | * sysfs_pathname - return full path to sysfs dirent |
487 | * @sd: sysfs_dirent whose path we want | 487 | * @sd: sysfs_dirent whose path we want |
488 | * @path: caller allocated buffer | 488 | * @path: caller allocated buffer of size PATH_MAX |
489 | * | 489 | * |
490 | * Gives the name "/" to the sysfs_root entry; any path returned | 490 | * Gives the name "/" to the sysfs_root entry; any path returned |
491 | * is relative to wherever sysfs is mounted. | 491 | * is relative to wherever sysfs is mounted. |
492 | * | ||
493 | * XXX: does no error checking on @path size | ||
494 | */ | 492 | */ |
495 | static char *sysfs_pathname(struct sysfs_dirent *sd, char *path) | 493 | static char *sysfs_pathname(struct sysfs_dirent *sd, char *path) |
496 | { | 494 | { |
497 | if (sd->s_parent) { | 495 | if (sd->s_parent) { |
498 | sysfs_pathname(sd->s_parent, path); | 496 | sysfs_pathname(sd->s_parent, path); |
499 | strcat(path, "/"); | 497 | strlcat(path, "/", PATH_MAX); |
500 | } | 498 | } |
501 | strcat(path, sd->s_name); | 499 | strlcat(path, sd->s_name, PATH_MAX); |
502 | return path; | 500 | return path; |
503 | } | 501 | } |
504 | 502 | ||
@@ -531,9 +529,11 @@ int sysfs_add_one(struct sysfs_addrm_cxt *acxt, struct sysfs_dirent *sd) | |||
531 | char *path = kzalloc(PATH_MAX, GFP_KERNEL); | 529 | char *path = kzalloc(PATH_MAX, GFP_KERNEL); |
532 | WARN(1, KERN_WARNING | 530 | WARN(1, KERN_WARNING |
533 | "sysfs: cannot create duplicate filename '%s'\n", | 531 | "sysfs: cannot create duplicate filename '%s'\n", |
534 | (path == NULL) ? sd->s_name : | 532 | (path == NULL) ? sd->s_name |
535 | strcat(strcat(sysfs_pathname(acxt->parent_sd, path), "/"), | 533 | : (sysfs_pathname(acxt->parent_sd, path), |
536 | sd->s_name)); | 534 | strlcat(path, "/", PATH_MAX), |
535 | strlcat(path, sd->s_name, PATH_MAX), | ||
536 | path)); | ||
537 | kfree(path); | 537 | kfree(path); |
538 | } | 538 | } |
539 | 539 | ||
diff --git a/include/drm/drm_pciids.h b/include/drm/drm_pciids.h index c78bb997e2c6..af1cbaf535ed 100644 --- a/include/drm/drm_pciids.h +++ b/include/drm/drm_pciids.h | |||
@@ -205,6 +205,8 @@ | |||
205 | {0x1002, 0x6788, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI|RADEON_NEW_MEMMAP}, \ | 205 | {0x1002, 0x6788, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI|RADEON_NEW_MEMMAP}, \ |
206 | {0x1002, 0x678A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI|RADEON_NEW_MEMMAP}, \ | 206 | {0x1002, 0x678A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI|RADEON_NEW_MEMMAP}, \ |
207 | {0x1002, 0x6790, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI|RADEON_NEW_MEMMAP}, \ | 207 | {0x1002, 0x6790, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI|RADEON_NEW_MEMMAP}, \ |
208 | {0x1002, 0x6791, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI|RADEON_NEW_MEMMAP}, \ | ||
209 | {0x1002, 0x6792, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI|RADEON_NEW_MEMMAP}, \ | ||
208 | {0x1002, 0x6798, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI|RADEON_NEW_MEMMAP}, \ | 210 | {0x1002, 0x6798, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI|RADEON_NEW_MEMMAP}, \ |
209 | {0x1002, 0x6799, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI|RADEON_NEW_MEMMAP}, \ | 211 | {0x1002, 0x6799, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI|RADEON_NEW_MEMMAP}, \ |
210 | {0x1002, 0x679A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI|RADEON_NEW_MEMMAP}, \ | 212 | {0x1002, 0x679A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI|RADEON_NEW_MEMMAP}, \ |
@@ -217,6 +219,7 @@ | |||
217 | {0x1002, 0x6808, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PITCAIRN|RADEON_NEW_MEMMAP}, \ | 219 | {0x1002, 0x6808, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PITCAIRN|RADEON_NEW_MEMMAP}, \ |
218 | {0x1002, 0x6809, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PITCAIRN|RADEON_NEW_MEMMAP}, \ | 220 | {0x1002, 0x6809, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PITCAIRN|RADEON_NEW_MEMMAP}, \ |
219 | {0x1002, 0x6810, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PITCAIRN|RADEON_NEW_MEMMAP}, \ | 221 | {0x1002, 0x6810, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PITCAIRN|RADEON_NEW_MEMMAP}, \ |
222 | {0x1002, 0x6811, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PITCAIRN|RADEON_NEW_MEMMAP}, \ | ||
220 | {0x1002, 0x6816, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PITCAIRN|RADEON_NEW_MEMMAP}, \ | 223 | {0x1002, 0x6816, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PITCAIRN|RADEON_NEW_MEMMAP}, \ |
221 | {0x1002, 0x6817, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PITCAIRN|RADEON_NEW_MEMMAP}, \ | 224 | {0x1002, 0x6817, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PITCAIRN|RADEON_NEW_MEMMAP}, \ |
222 | {0x1002, 0x6818, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PITCAIRN|RADEON_NEW_MEMMAP}, \ | 225 | {0x1002, 0x6818, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PITCAIRN|RADEON_NEW_MEMMAP}, \ |
diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h index c18257b0fa72..6dd4787a798a 100644 --- a/include/linux/dynamic_debug.h +++ b/include/linux/dynamic_debug.h | |||
@@ -61,7 +61,7 @@ int __dynamic_netdev_dbg(struct _ddebug *descriptor, | |||
61 | const char *fmt, ...); | 61 | const char *fmt, ...); |
62 | 62 | ||
63 | #define DEFINE_DYNAMIC_DEBUG_METADATA(name, fmt) \ | 63 | #define DEFINE_DYNAMIC_DEBUG_METADATA(name, fmt) \ |
64 | static struct _ddebug __used __aligned(8) \ | 64 | static struct _ddebug __aligned(8) \ |
65 | __attribute__((section("__verbose"))) name = { \ | 65 | __attribute__((section("__verbose"))) name = { \ |
66 | .modname = KBUILD_MODNAME, \ | 66 | .modname = KBUILD_MODNAME, \ |
67 | .function = __func__, \ | 67 | .function = __func__, \ |
diff --git a/include/linux/extcon.h b/include/linux/extcon.h index 7443a560c9d0..2c26c14cd710 100644 --- a/include/linux/extcon.h +++ b/include/linux/extcon.h | |||
@@ -68,7 +68,7 @@ enum extcon_cable_name { | |||
68 | EXTCON_VIDEO_OUT, | 68 | EXTCON_VIDEO_OUT, |
69 | EXTCON_MECHANICAL, | 69 | EXTCON_MECHANICAL, |
70 | }; | 70 | }; |
71 | extern const char *extcon_cable_name[]; | 71 | extern const char extcon_cable_name[][CABLE_NAME_MAX + 1]; |
72 | 72 | ||
73 | struct extcon_cable; | 73 | struct extcon_cable; |
74 | 74 | ||
diff --git a/include/linux/hashtable.h b/include/linux/hashtable.h new file mode 100644 index 000000000000..227c62424f3c --- /dev/null +++ b/include/linux/hashtable.h | |||
@@ -0,0 +1,192 @@ | |||
1 | /* | ||
2 | * Statically sized hash table implementation | ||
3 | * (C) 2012 Sasha Levin <levinsasha928@gmail.com> | ||
4 | */ | ||
5 | |||
6 | #ifndef _LINUX_HASHTABLE_H | ||
7 | #define _LINUX_HASHTABLE_H | ||
8 | |||
9 | #include <linux/list.h> | ||
10 | #include <linux/types.h> | ||
11 | #include <linux/kernel.h> | ||
12 | #include <linux/hash.h> | ||
13 | #include <linux/rculist.h> | ||
14 | |||
15 | #define DEFINE_HASHTABLE(name, bits) \ | ||
16 | struct hlist_head name[1 << (bits)] = \ | ||
17 | { [0 ... ((1 << (bits)) - 1)] = HLIST_HEAD_INIT } | ||
18 | |||
19 | #define DECLARE_HASHTABLE(name, bits) \ | ||
20 | struct hlist_head name[1 << (bits)] | ||
21 | |||
22 | #define HASH_SIZE(name) (ARRAY_SIZE(name)) | ||
23 | #define HASH_BITS(name) ilog2(HASH_SIZE(name)) | ||
24 | |||
25 | /* Use hash_32 when possible to allow for fast 32bit hashing in 64bit kernels. */ | ||
26 | #define hash_min(val, bits) \ | ||
27 | (sizeof(val) <= 4 ? hash_32(val, bits) : hash_long(val, bits)) | ||
28 | |||
29 | static inline void __hash_init(struct hlist_head *ht, unsigned int sz) | ||
30 | { | ||
31 | unsigned int i; | ||
32 | |||
33 | for (i = 0; i < sz; i++) | ||
34 | INIT_HLIST_HEAD(&ht[i]); | ||
35 | } | ||
36 | |||
37 | /** | ||
38 | * hash_init - initialize a hash table | ||
39 | * @hashtable: hashtable to be initialized | ||
40 | * | ||
41 | * Calculates the size of the hashtable from the given parameter, otherwise | ||
42 | * same as hash_init_size. | ||
43 | * | ||
44 | * This has to be a macro since HASH_BITS() will not work on pointers since | ||
45 | * it calculates the size during preprocessing. | ||
46 | */ | ||
47 | #define hash_init(hashtable) __hash_init(hashtable, HASH_SIZE(hashtable)) | ||
48 | |||
49 | /** | ||
50 | * hash_add - add an object to a hashtable | ||
51 | * @hashtable: hashtable to add to | ||
52 | * @node: the &struct hlist_node of the object to be added | ||
53 | * @key: the key of the object to be added | ||
54 | */ | ||
55 | #define hash_add(hashtable, node, key) \ | ||
56 | hlist_add_head(node, &hashtable[hash_min(key, HASH_BITS(hashtable))]) | ||
57 | |||
58 | /** | ||
59 | * hash_add_rcu - add an object to a rcu enabled hashtable | ||
60 | * @hashtable: hashtable to add to | ||
61 | * @node: the &struct hlist_node of the object to be added | ||
62 | * @key: the key of the object to be added | ||
63 | */ | ||
64 | #define hash_add_rcu(hashtable, node, key) \ | ||
65 | hlist_add_head_rcu(node, &hashtable[hash_min(key, HASH_BITS(hashtable))]) | ||
66 | |||
67 | /** | ||
68 | * hash_hashed - check whether an object is in any hashtable | ||
69 | * @node: the &struct hlist_node of the object to be checked | ||
70 | */ | ||
71 | static inline bool hash_hashed(struct hlist_node *node) | ||
72 | { | ||
73 | return !hlist_unhashed(node); | ||
74 | } | ||
75 | |||
76 | static inline bool __hash_empty(struct hlist_head *ht, unsigned int sz) | ||
77 | { | ||
78 | unsigned int i; | ||
79 | |||
80 | for (i = 0; i < sz; i++) | ||
81 | if (!hlist_empty(&ht[i])) | ||
82 | return false; | ||
83 | |||
84 | return true; | ||
85 | } | ||
86 | |||
87 | /** | ||
88 | * hash_empty - check whether a hashtable is empty | ||
89 | * @hashtable: hashtable to check | ||
90 | * | ||
91 | * This has to be a macro since HASH_BITS() will not work on pointers since | ||
92 | * it calculates the size during preprocessing. | ||
93 | */ | ||
94 | #define hash_empty(hashtable) __hash_empty(hashtable, HASH_SIZE(hashtable)) | ||
95 | |||
96 | /** | ||
97 | * hash_del - remove an object from a hashtable | ||
98 | * @node: &struct hlist_node of the object to remove | ||
99 | */ | ||
100 | static inline void hash_del(struct hlist_node *node) | ||
101 | { | ||
102 | hlist_del_init(node); | ||
103 | } | ||
104 | |||
105 | /** | ||
106 | * hash_del_rcu - remove an object from a rcu enabled hashtable | ||
107 | * @node: &struct hlist_node of the object to remove | ||
108 | */ | ||
109 | static inline void hash_del_rcu(struct hlist_node *node) | ||
110 | { | ||
111 | hlist_del_init_rcu(node); | ||
112 | } | ||
113 | |||
114 | /** | ||
115 | * hash_for_each - iterate over a hashtable | ||
116 | * @name: hashtable to iterate | ||
117 | * @bkt: integer to use as bucket loop cursor | ||
118 | * @node: the &struct list_head to use as a loop cursor for each entry | ||
119 | * @obj: the type * to use as a loop cursor for each entry | ||
120 | * @member: the name of the hlist_node within the struct | ||
121 | */ | ||
122 | #define hash_for_each(name, bkt, node, obj, member) \ | ||
123 | for ((bkt) = 0, node = NULL; node == NULL && (bkt) < HASH_SIZE(name); (bkt)++)\ | ||
124 | hlist_for_each_entry(obj, node, &name[bkt], member) | ||
125 | |||
126 | /** | ||
127 | * hash_for_each_rcu - iterate over a rcu enabled hashtable | ||
128 | * @name: hashtable to iterate | ||
129 | * @bkt: integer to use as bucket loop cursor | ||
130 | * @node: the &struct list_head to use as a loop cursor for each entry | ||
131 | * @obj: the type * to use as a loop cursor for each entry | ||
132 | * @member: the name of the hlist_node within the struct | ||
133 | */ | ||
134 | #define hash_for_each_rcu(name, bkt, node, obj, member) \ | ||
135 | for ((bkt) = 0, node = NULL; node == NULL && (bkt) < HASH_SIZE(name); (bkt)++)\ | ||
136 | hlist_for_each_entry_rcu(obj, node, &name[bkt], member) | ||
137 | |||
138 | /** | ||
139 | * hash_for_each_safe - iterate over a hashtable safe against removal of | ||
140 | * hash entry | ||
141 | * @name: hashtable to iterate | ||
142 | * @bkt: integer to use as bucket loop cursor | ||
143 | * @node: the &struct list_head to use as a loop cursor for each entry | ||
144 | * @tmp: a &struct used for temporary storage | ||
145 | * @obj: the type * to use as a loop cursor for each entry | ||
146 | * @member: the name of the hlist_node within the struct | ||
147 | */ | ||
148 | #define hash_for_each_safe(name, bkt, node, tmp, obj, member) \ | ||
149 | for ((bkt) = 0, node = NULL; node == NULL && (bkt) < HASH_SIZE(name); (bkt)++)\ | ||
150 | hlist_for_each_entry_safe(obj, node, tmp, &name[bkt], member) | ||
151 | |||
152 | /** | ||
153 | * hash_for_each_possible - iterate over all possible objects hashing to the | ||
154 | * same bucket | ||
155 | * @name: hashtable to iterate | ||
156 | * @obj: the type * to use as a loop cursor for each entry | ||
157 | * @node: the &struct list_head to use as a loop cursor for each entry | ||
158 | * @member: the name of the hlist_node within the struct | ||
159 | * @key: the key of the objects to iterate over | ||
160 | */ | ||
161 | #define hash_for_each_possible(name, obj, node, member, key) \ | ||
162 | hlist_for_each_entry(obj, node, &name[hash_min(key, HASH_BITS(name))], member) | ||
163 | |||
164 | /** | ||
165 | * hash_for_each_possible_rcu - iterate over all possible objects hashing to the | ||
166 | * same bucket in an rcu enabled hashtable | ||
167 | * in a rcu enabled hashtable | ||
168 | * @name: hashtable to iterate | ||
169 | * @obj: the type * to use as a loop cursor for each entry | ||
170 | * @node: the &struct list_head to use as a loop cursor for each entry | ||
171 | * @member: the name of the hlist_node within the struct | ||
172 | * @key: the key of the objects to iterate over | ||
173 | */ | ||
174 | #define hash_for_each_possible_rcu(name, obj, node, member, key) \ | ||
175 | hlist_for_each_entry_rcu(obj, node, &name[hash_min(key, HASH_BITS(name))], member) | ||
176 | |||
177 | /** | ||
178 | * hash_for_each_possible_safe - iterate over all possible objects hashing to the | ||
179 | * same bucket safe against removals | ||
180 | * @name: hashtable to iterate | ||
181 | * @obj: the type * to use as a loop cursor for each entry | ||
182 | * @node: the &struct list_head to use as a loop cursor for each entry | ||
183 | * @tmp: a &struct used for temporary storage | ||
184 | * @member: the name of the hlist_node within the struct | ||
185 | * @key: the key of the objects to iterate over | ||
186 | */ | ||
187 | #define hash_for_each_possible_safe(name, obj, node, tmp, member, key) \ | ||
188 | hlist_for_each_entry_safe(obj, node, tmp, \ | ||
189 | &name[hash_min(key, HASH_BITS(name))], member) | ||
190 | |||
191 | |||
192 | #endif | ||
diff --git a/include/linux/iio/iio.h b/include/linux/iio/iio.h index c0ae76ac4e0b..7806c24e5bc8 100644 --- a/include/linux/iio/iio.h +++ b/include/linux/iio/iio.h | |||
@@ -618,4 +618,20 @@ static inline struct dentry *iio_get_debugfs_dentry(struct iio_dev *indio_dev) | |||
618 | }; | 618 | }; |
619 | #endif | 619 | #endif |
620 | 620 | ||
621 | /** | ||
622 | * IIO_DEGREE_TO_RAD() - Convert degree to rad | ||
623 | * @deg: A value in degree | ||
624 | * | ||
625 | * Returns the given value converted from degree to rad | ||
626 | */ | ||
627 | #define IIO_DEGREE_TO_RAD(deg) (((deg) * 314159ULL + 9000000ULL) / 18000000ULL) | ||
628 | |||
629 | /** | ||
630 | * IIO_G_TO_M_S_2() - Convert g to meter / second**2 | ||
631 | * @g: A value in g | ||
632 | * | ||
633 | * Returns the given value converted from g to meter / second**2 | ||
634 | */ | ||
635 | #define IIO_G_TO_M_S_2(g) ((g) * 980665ULL / 100000ULL) | ||
636 | |||
621 | #endif /* _INDUSTRIAL_IO_H_ */ | 637 | #endif /* _INDUSTRIAL_IO_H_ */ |
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h index 93bfc9f9815c..ecc554374e44 100644 --- a/include/linux/kvm_host.h +++ b/include/linux/kvm_host.h | |||
@@ -42,19 +42,8 @@ | |||
42 | */ | 42 | */ |
43 | #define KVM_MEMSLOT_INVALID (1UL << 16) | 43 | #define KVM_MEMSLOT_INVALID (1UL << 16) |
44 | 44 | ||
45 | /* | 45 | /* Two fragments for cross MMIO pages. */ |
46 | * If we support unaligned MMIO, at most one fragment will be split into two: | 46 | #define KVM_MAX_MMIO_FRAGMENTS 2 |
47 | */ | ||
48 | #ifdef KVM_UNALIGNED_MMIO | ||
49 | # define KVM_EXTRA_MMIO_FRAGMENTS 1 | ||
50 | #else | ||
51 | # define KVM_EXTRA_MMIO_FRAGMENTS 0 | ||
52 | #endif | ||
53 | |||
54 | #define KVM_USER_MMIO_SIZE 8 | ||
55 | |||
56 | #define KVM_MAX_MMIO_FRAGMENTS \ | ||
57 | (KVM_MMIO_SIZE / KVM_USER_MMIO_SIZE + KVM_EXTRA_MMIO_FRAGMENTS) | ||
58 | 47 | ||
59 | /* | 48 | /* |
60 | * For the normal pfn, the highest 12 bits should be zero, | 49 | * For the normal pfn, the highest 12 bits should be zero, |
diff --git a/include/linux/memblock.h b/include/linux/memblock.h index 569d67d4243e..d452ee191066 100644 --- a/include/linux/memblock.h +++ b/include/linux/memblock.h | |||
@@ -57,6 +57,7 @@ int memblock_add(phys_addr_t base, phys_addr_t size); | |||
57 | int memblock_remove(phys_addr_t base, phys_addr_t size); | 57 | int memblock_remove(phys_addr_t base, phys_addr_t size); |
58 | int memblock_free(phys_addr_t base, phys_addr_t size); | 58 | int memblock_free(phys_addr_t base, phys_addr_t size); |
59 | int memblock_reserve(phys_addr_t base, phys_addr_t size); | 59 | int memblock_reserve(phys_addr_t base, phys_addr_t size); |
60 | void memblock_trim_memory(phys_addr_t align); | ||
60 | 61 | ||
61 | #ifdef CONFIG_HAVE_MEMBLOCK_NODE_MAP | 62 | #ifdef CONFIG_HAVE_MEMBLOCK_NODE_MAP |
62 | void __next_mem_pfn_range(int *idx, int nid, unsigned long *out_start_pfn, | 63 | void __next_mem_pfn_range(int *idx, int nid, unsigned long *out_start_pfn, |
diff --git a/include/linux/mfd/max77693.h b/include/linux/mfd/max77693.h index 1d28ae90384e..fe03b2d35d4f 100644 --- a/include/linux/mfd/max77693.h +++ b/include/linux/mfd/max77693.h | |||
@@ -30,7 +30,20 @@ | |||
30 | #ifndef __LINUX_MFD_MAX77693_H | 30 | #ifndef __LINUX_MFD_MAX77693_H |
31 | #define __LINUX_MFD_MAX77693_H | 31 | #define __LINUX_MFD_MAX77693_H |
32 | 32 | ||
33 | struct max77693_reg_data { | ||
34 | u8 addr; | ||
35 | u8 data; | ||
36 | }; | ||
37 | |||
38 | struct max77693_muic_platform_data { | ||
39 | struct max77693_reg_data *init_data; | ||
40 | int num_init_data; | ||
41 | }; | ||
42 | |||
33 | struct max77693_platform_data { | 43 | struct max77693_platform_data { |
34 | int wakeup; | 44 | int wakeup; |
45 | |||
46 | /* muic data */ | ||
47 | struct max77693_muic_platform_data *muic_data; | ||
35 | }; | 48 | }; |
36 | #endif /* __LINUX_MFD_MAX77693_H */ | 49 | #endif /* __LINUX_MFD_MAX77693_H */ |
diff --git a/include/linux/percpu-rwsem.h b/include/linux/percpu-rwsem.h index cf80f7e5277f..250a4acddb2b 100644 --- a/include/linux/percpu-rwsem.h +++ b/include/linux/percpu-rwsem.h | |||
@@ -12,34 +12,27 @@ struct percpu_rw_semaphore { | |||
12 | struct mutex mtx; | 12 | struct mutex mtx; |
13 | }; | 13 | }; |
14 | 14 | ||
15 | #define light_mb() barrier() | ||
16 | #define heavy_mb() synchronize_sched() | ||
17 | |||
15 | static inline void percpu_down_read(struct percpu_rw_semaphore *p) | 18 | static inline void percpu_down_read(struct percpu_rw_semaphore *p) |
16 | { | 19 | { |
17 | rcu_read_lock(); | 20 | rcu_read_lock_sched(); |
18 | if (unlikely(p->locked)) { | 21 | if (unlikely(p->locked)) { |
19 | rcu_read_unlock(); | 22 | rcu_read_unlock_sched(); |
20 | mutex_lock(&p->mtx); | 23 | mutex_lock(&p->mtx); |
21 | this_cpu_inc(*p->counters); | 24 | this_cpu_inc(*p->counters); |
22 | mutex_unlock(&p->mtx); | 25 | mutex_unlock(&p->mtx); |
23 | return; | 26 | return; |
24 | } | 27 | } |
25 | this_cpu_inc(*p->counters); | 28 | this_cpu_inc(*p->counters); |
26 | rcu_read_unlock(); | 29 | rcu_read_unlock_sched(); |
30 | light_mb(); /* A, between read of p->locked and read of data, paired with D */ | ||
27 | } | 31 | } |
28 | 32 | ||
29 | static inline void percpu_up_read(struct percpu_rw_semaphore *p) | 33 | static inline void percpu_up_read(struct percpu_rw_semaphore *p) |
30 | { | 34 | { |
31 | /* | 35 | light_mb(); /* B, between read of the data and write to p->counter, paired with C */ |
32 | * On X86, write operation in this_cpu_dec serves as a memory unlock | ||
33 | * barrier (i.e. memory accesses may be moved before the write, but | ||
34 | * no memory accesses are moved past the write). | ||
35 | * On other architectures this may not be the case, so we need smp_mb() | ||
36 | * there. | ||
37 | */ | ||
38 | #if defined(CONFIG_X86) && (!defined(CONFIG_X86_PPRO_FENCE) && !defined(CONFIG_X86_OOSTORE)) | ||
39 | barrier(); | ||
40 | #else | ||
41 | smp_mb(); | ||
42 | #endif | ||
43 | this_cpu_dec(*p->counters); | 36 | this_cpu_dec(*p->counters); |
44 | } | 37 | } |
45 | 38 | ||
@@ -58,14 +51,15 @@ static inline void percpu_down_write(struct percpu_rw_semaphore *p) | |||
58 | { | 51 | { |
59 | mutex_lock(&p->mtx); | 52 | mutex_lock(&p->mtx); |
60 | p->locked = true; | 53 | p->locked = true; |
61 | synchronize_rcu(); | 54 | synchronize_sched(); /* make sure that all readers exit the rcu_read_lock_sched region */ |
62 | while (__percpu_count(p->counters)) | 55 | while (__percpu_count(p->counters)) |
63 | msleep(1); | 56 | msleep(1); |
64 | smp_rmb(); /* paired with smp_mb() in percpu_sem_up_read() */ | 57 | heavy_mb(); /* C, between read of p->counter and write to data, paired with B */ |
65 | } | 58 | } |
66 | 59 | ||
67 | static inline void percpu_up_write(struct percpu_rw_semaphore *p) | 60 | static inline void percpu_up_write(struct percpu_rw_semaphore *p) |
68 | { | 61 | { |
62 | heavy_mb(); /* D, between write to data and write to p->locked, paired with A */ | ||
69 | p->locked = false; | 63 | p->locked = false; |
70 | mutex_unlock(&p->mtx); | 64 | mutex_unlock(&p->mtx); |
71 | } | 65 | } |
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h index 2e902359aee5..6bfb2faa0b19 100644 --- a/include/linux/perf_event.h +++ b/include/linux/perf_event.h | |||
@@ -803,12 +803,16 @@ static inline void perf_event_task_tick(void) { } | |||
803 | do { \ | 803 | do { \ |
804 | static struct notifier_block fn##_nb __cpuinitdata = \ | 804 | static struct notifier_block fn##_nb __cpuinitdata = \ |
805 | { .notifier_call = fn, .priority = CPU_PRI_PERF }; \ | 805 | { .notifier_call = fn, .priority = CPU_PRI_PERF }; \ |
806 | unsigned long cpu = smp_processor_id(); \ | ||
807 | unsigned long flags; \ | ||
806 | fn(&fn##_nb, (unsigned long)CPU_UP_PREPARE, \ | 808 | fn(&fn##_nb, (unsigned long)CPU_UP_PREPARE, \ |
807 | (void *)(unsigned long)smp_processor_id()); \ | 809 | (void *)(unsigned long)cpu); \ |
810 | local_irq_save(flags); \ | ||
808 | fn(&fn##_nb, (unsigned long)CPU_STARTING, \ | 811 | fn(&fn##_nb, (unsigned long)CPU_STARTING, \ |
809 | (void *)(unsigned long)smp_processor_id()); \ | 812 | (void *)(unsigned long)cpu); \ |
813 | local_irq_restore(flags); \ | ||
810 | fn(&fn##_nb, (unsigned long)CPU_ONLINE, \ | 814 | fn(&fn##_nb, (unsigned long)CPU_ONLINE, \ |
811 | (void *)(unsigned long)smp_processor_id()); \ | 815 | (void *)(unsigned long)cpu); \ |
812 | register_cpu_notifier(&fn##_nb); \ | 816 | register_cpu_notifier(&fn##_nb); \ |
813 | } while (0) | 817 | } while (0) |
814 | 818 | ||
diff --git a/include/linux/power/smartreflex.h b/include/linux/power/smartreflex.h index 4a496ebc7d73..c0f44c2b006d 100644 --- a/include/linux/power/smartreflex.h +++ b/include/linux/power/smartreflex.h | |||
@@ -260,8 +260,13 @@ struct omap_sr_nvalue_table { | |||
260 | * | 260 | * |
261 | * @name: instance name | 261 | * @name: instance name |
262 | * @ip_type: Smartreflex IP type. | 262 | * @ip_type: Smartreflex IP type. |
263 | * @senp_mod: SENPENABLE value for the sr | 263 | * @senp_mod: SENPENABLE value of the sr CONFIG register |
264 | * @senn_mod: SENNENABLE value for sr | 264 | * @senn_mod: SENNENABLE value for sr CONFIG register |
265 | * @err_weight ERRWEIGHT value of the sr ERRCONFIG register | ||
266 | * @err_maxlimit ERRMAXLIMIT value of the sr ERRCONFIG register | ||
267 | * @accum_data ACCUMDATA value of the sr CONFIG register | ||
268 | * @senn_avgweight SENNAVGWEIGHT value of the sr AVGWEIGHT register | ||
269 | * @senp_avgweight SENPAVGWEIGHT value of the sr AVGWEIGHT register | ||
265 | * @nvalue_count: Number of distinct nvalues in the nvalue table | 270 | * @nvalue_count: Number of distinct nvalues in the nvalue table |
266 | * @enable_on_init: whether this sr module needs to enabled at | 271 | * @enable_on_init: whether this sr module needs to enabled at |
267 | * boot up or not. | 272 | * boot up or not. |
@@ -274,6 +279,11 @@ struct omap_sr_data { | |||
274 | int ip_type; | 279 | int ip_type; |
275 | u32 senp_mod; | 280 | u32 senp_mod; |
276 | u32 senn_mod; | 281 | u32 senn_mod; |
282 | u32 err_weight; | ||
283 | u32 err_maxlimit; | ||
284 | u32 accum_data; | ||
285 | u32 senn_avgweight; | ||
286 | u32 senp_avgweight; | ||
277 | int nvalue_count; | 287 | int nvalue_count; |
278 | bool enable_on_init; | 288 | bool enable_on_init; |
279 | struct omap_sr_nvalue_table *nvalue_table; | 289 | struct omap_sr_nvalue_table *nvalue_table; |
diff --git a/include/linux/raid/Kbuild b/include/linux/raid/Kbuild index 2415a64c5e51..e69de29bb2d1 100644 --- a/include/linux/raid/Kbuild +++ b/include/linux/raid/Kbuild | |||
@@ -1,2 +0,0 @@ | |||
1 | header-y += md_p.h | ||
2 | header-y += md_u.h | ||
diff --git a/include/linux/raid/md_u.h b/include/linux/raid/md_u.h index fb1abb3367e9..358c04bfbe2a 100644 --- a/include/linux/raid/md_u.h +++ b/include/linux/raid/md_u.h | |||
@@ -11,149 +11,10 @@ | |||
11 | (for example /usr/src/linux/COPYING); if not, write to the Free | 11 | (for example /usr/src/linux/COPYING); if not, write to the Free |
12 | Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 12 | Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
13 | */ | 13 | */ |
14 | |||
15 | #ifndef _MD_U_H | 14 | #ifndef _MD_U_H |
16 | #define _MD_U_H | 15 | #define _MD_U_H |
17 | 16 | ||
18 | /* | 17 | #include <uapi/linux/raid/md_u.h> |
19 | * Different major versions are not compatible. | ||
20 | * Different minor versions are only downward compatible. | ||
21 | * Different patchlevel versions are downward and upward compatible. | ||
22 | */ | ||
23 | #define MD_MAJOR_VERSION 0 | ||
24 | #define MD_MINOR_VERSION 90 | ||
25 | /* | ||
26 | * MD_PATCHLEVEL_VERSION indicates kernel functionality. | ||
27 | * >=1 means different superblock formats are selectable using SET_ARRAY_INFO | ||
28 | * and major_version/minor_version accordingly | ||
29 | * >=2 means that Internal bitmaps are supported by setting MD_SB_BITMAP_PRESENT | ||
30 | * in the super status byte | ||
31 | * >=3 means that bitmap superblock version 4 is supported, which uses | ||
32 | * little-ending representation rather than host-endian | ||
33 | */ | ||
34 | #define MD_PATCHLEVEL_VERSION 3 | ||
35 | |||
36 | /* ioctls */ | ||
37 | |||
38 | /* status */ | ||
39 | #define RAID_VERSION _IOR (MD_MAJOR, 0x10, mdu_version_t) | ||
40 | #define GET_ARRAY_INFO _IOR (MD_MAJOR, 0x11, mdu_array_info_t) | ||
41 | #define GET_DISK_INFO _IOR (MD_MAJOR, 0x12, mdu_disk_info_t) | ||
42 | #define PRINT_RAID_DEBUG _IO (MD_MAJOR, 0x13) | ||
43 | #define RAID_AUTORUN _IO (MD_MAJOR, 0x14) | ||
44 | #define GET_BITMAP_FILE _IOR (MD_MAJOR, 0x15, mdu_bitmap_file_t) | ||
45 | |||
46 | /* configuration */ | ||
47 | #define CLEAR_ARRAY _IO (MD_MAJOR, 0x20) | ||
48 | #define ADD_NEW_DISK _IOW (MD_MAJOR, 0x21, mdu_disk_info_t) | ||
49 | #define HOT_REMOVE_DISK _IO (MD_MAJOR, 0x22) | ||
50 | #define SET_ARRAY_INFO _IOW (MD_MAJOR, 0x23, mdu_array_info_t) | ||
51 | #define SET_DISK_INFO _IO (MD_MAJOR, 0x24) | ||
52 | #define WRITE_RAID_INFO _IO (MD_MAJOR, 0x25) | ||
53 | #define UNPROTECT_ARRAY _IO (MD_MAJOR, 0x26) | ||
54 | #define PROTECT_ARRAY _IO (MD_MAJOR, 0x27) | ||
55 | #define HOT_ADD_DISK _IO (MD_MAJOR, 0x28) | ||
56 | #define SET_DISK_FAULTY _IO (MD_MAJOR, 0x29) | ||
57 | #define HOT_GENERATE_ERROR _IO (MD_MAJOR, 0x2a) | ||
58 | #define SET_BITMAP_FILE _IOW (MD_MAJOR, 0x2b, int) | ||
59 | 18 | ||
60 | /* usage */ | ||
61 | #define RUN_ARRAY _IOW (MD_MAJOR, 0x30, mdu_param_t) | ||
62 | /* 0x31 was START_ARRAY */ | ||
63 | #define STOP_ARRAY _IO (MD_MAJOR, 0x32) | ||
64 | #define STOP_ARRAY_RO _IO (MD_MAJOR, 0x33) | ||
65 | #define RESTART_ARRAY_RW _IO (MD_MAJOR, 0x34) | ||
66 | |||
67 | /* 63 partitions with the alternate major number (mdp) */ | ||
68 | #define MdpMinorShift 6 | ||
69 | #ifdef __KERNEL__ | ||
70 | extern int mdp_major; | 19 | extern int mdp_major; |
71 | #endif | ||
72 | |||
73 | typedef struct mdu_version_s { | ||
74 | int major; | ||
75 | int minor; | ||
76 | int patchlevel; | ||
77 | } mdu_version_t; | ||
78 | |||
79 | typedef struct mdu_array_info_s { | ||
80 | /* | ||
81 | * Generic constant information | ||
82 | */ | ||
83 | int major_version; | ||
84 | int minor_version; | ||
85 | int patch_version; | ||
86 | int ctime; | ||
87 | int level; | ||
88 | int size; | ||
89 | int nr_disks; | ||
90 | int raid_disks; | ||
91 | int md_minor; | ||
92 | int not_persistent; | ||
93 | |||
94 | /* | ||
95 | * Generic state information | ||
96 | */ | ||
97 | int utime; /* 0 Superblock update time */ | ||
98 | int state; /* 1 State bits (clean, ...) */ | ||
99 | int active_disks; /* 2 Number of currently active disks */ | ||
100 | int working_disks; /* 3 Number of working disks */ | ||
101 | int failed_disks; /* 4 Number of failed disks */ | ||
102 | int spare_disks; /* 5 Number of spare disks */ | ||
103 | |||
104 | /* | ||
105 | * Personality information | ||
106 | */ | ||
107 | int layout; /* 0 the array's physical layout */ | ||
108 | int chunk_size; /* 1 chunk size in bytes */ | ||
109 | |||
110 | } mdu_array_info_t; | ||
111 | |||
112 | /* non-obvious values for 'level' */ | ||
113 | #define LEVEL_MULTIPATH (-4) | ||
114 | #define LEVEL_LINEAR (-1) | ||
115 | #define LEVEL_FAULTY (-5) | ||
116 | |||
117 | /* we need a value for 'no level specified' and 0 | ||
118 | * means 'raid0', so we need something else. This is | ||
119 | * for internal use only | ||
120 | */ | ||
121 | #define LEVEL_NONE (-1000000) | ||
122 | |||
123 | typedef struct mdu_disk_info_s { | ||
124 | /* | ||
125 | * configuration/status of one particular disk | ||
126 | */ | ||
127 | int number; | ||
128 | int major; | ||
129 | int minor; | ||
130 | int raid_disk; | ||
131 | int state; | ||
132 | |||
133 | } mdu_disk_info_t; | ||
134 | |||
135 | typedef struct mdu_start_info_s { | ||
136 | /* | ||
137 | * configuration/status of one particular disk | ||
138 | */ | ||
139 | int major; | ||
140 | int minor; | ||
141 | int raid_disk; | ||
142 | int state; | ||
143 | |||
144 | } mdu_start_info_t; | ||
145 | |||
146 | typedef struct mdu_bitmap_file_s | ||
147 | { | ||
148 | char pathname[4096]; | ||
149 | } mdu_bitmap_file_t; | ||
150 | |||
151 | typedef struct mdu_param_s | ||
152 | { | ||
153 | int personality; /* 1,2,3,4 */ | ||
154 | int chunk_size; /* in bytes */ | ||
155 | int max_fault; /* unused for now */ | ||
156 | } mdu_param_t; | ||
157 | |||
158 | #endif | 20 | #endif |
159 | |||
diff --git a/include/linux/rbtree_augmented.h b/include/linux/rbtree_augmented.h index 214caa33433b..2ac60c9cf644 100644 --- a/include/linux/rbtree_augmented.h +++ b/include/linux/rbtree_augmented.h | |||
@@ -24,6 +24,7 @@ | |||
24 | #ifndef _LINUX_RBTREE_AUGMENTED_H | 24 | #ifndef _LINUX_RBTREE_AUGMENTED_H |
25 | #define _LINUX_RBTREE_AUGMENTED_H | 25 | #define _LINUX_RBTREE_AUGMENTED_H |
26 | 26 | ||
27 | #include <linux/compiler.h> | ||
27 | #include <linux/rbtree.h> | 28 | #include <linux/rbtree.h> |
28 | 29 | ||
29 | /* | 30 | /* |
diff --git a/include/linux/spi/tsc2005.h b/include/linux/spi/tsc2005.h index d9b0c84220c7..8f721e465e05 100644 --- a/include/linux/spi/tsc2005.h +++ b/include/linux/spi/tsc2005.h | |||
@@ -3,8 +3,6 @@ | |||
3 | * | 3 | * |
4 | * Copyright (C) 2009-2010 Nokia Corporation | 4 | * Copyright (C) 2009-2010 Nokia Corporation |
5 | * | 5 | * |
6 | * Contact: Aaro Koskinen <aaro.koskinen@nokia.com> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | 6 | * This program is free software; you can redistribute it and/or modify |
9 | * it under the terms of the GNU General Public License as published by | 7 | * it under the terms of the GNU General Public License as published by |
10 | * the Free Software Foundation; either version 2 of the License, or | 8 | * the Free Software Foundation; either version 2 of the License, or |
diff --git a/include/linux/tcp.h b/include/linux/tcp.h index 8a7fc4be2d75..60b7aac15e0e 100644 --- a/include/linux/tcp.h +++ b/include/linux/tcp.h | |||
@@ -191,7 +191,8 @@ struct tcp_sock { | |||
191 | u8 do_early_retrans:1,/* Enable RFC5827 early-retransmit */ | 191 | u8 do_early_retrans:1,/* Enable RFC5827 early-retransmit */ |
192 | early_retrans_delayed:1, /* Delayed ER timer installed */ | 192 | early_retrans_delayed:1, /* Delayed ER timer installed */ |
193 | syn_data:1, /* SYN includes data */ | 193 | syn_data:1, /* SYN includes data */ |
194 | syn_fastopen:1; /* SYN includes Fast Open option */ | 194 | syn_fastopen:1, /* SYN includes Fast Open option */ |
195 | syn_data_acked:1;/* data in SYN is acked by SYN-ACK */ | ||
195 | 196 | ||
196 | /* RTT measurement */ | 197 | /* RTT measurement */ |
197 | u32 srtt; /* smoothed round trip time << 3 */ | 198 | u32 srtt; /* smoothed round trip time << 3 */ |
diff --git a/include/linux/uprobes.h b/include/linux/uprobes.h index e6f0331e3d45..24594571c5a3 100644 --- a/include/linux/uprobes.h +++ b/include/linux/uprobes.h | |||
@@ -35,16 +35,6 @@ struct inode; | |||
35 | # include <asm/uprobes.h> | 35 | # include <asm/uprobes.h> |
36 | #endif | 36 | #endif |
37 | 37 | ||
38 | /* flags that denote/change uprobes behaviour */ | ||
39 | |||
40 | /* Have a copy of original instruction */ | ||
41 | #define UPROBE_COPY_INSN 0x1 | ||
42 | |||
43 | /* Dont run handlers when first register/ last unregister in progress*/ | ||
44 | #define UPROBE_RUN_HANDLER 0x2 | ||
45 | /* Can skip singlestep */ | ||
46 | #define UPROBE_SKIP_SSTEP 0x4 | ||
47 | |||
48 | struct uprobe_consumer { | 38 | struct uprobe_consumer { |
49 | int (*handler)(struct uprobe_consumer *self, struct pt_regs *regs); | 39 | int (*handler)(struct uprobe_consumer *self, struct pt_regs *regs); |
50 | /* | 40 | /* |
@@ -59,7 +49,6 @@ struct uprobe_consumer { | |||
59 | #ifdef CONFIG_UPROBES | 49 | #ifdef CONFIG_UPROBES |
60 | enum uprobe_task_state { | 50 | enum uprobe_task_state { |
61 | UTASK_RUNNING, | 51 | UTASK_RUNNING, |
62 | UTASK_BP_HIT, | ||
63 | UTASK_SSTEP, | 52 | UTASK_SSTEP, |
64 | UTASK_SSTEP_ACK, | 53 | UTASK_SSTEP_ACK, |
65 | UTASK_SSTEP_TRAPPED, | 54 | UTASK_SSTEP_TRAPPED, |
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index 1b4989082244..7d5b6000378b 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h | |||
@@ -1218,6 +1218,7 @@ struct cfg80211_deauth_request { | |||
1218 | const u8 *ie; | 1218 | const u8 *ie; |
1219 | size_t ie_len; | 1219 | size_t ie_len; |
1220 | u16 reason_code; | 1220 | u16 reason_code; |
1221 | bool local_state_change; | ||
1221 | }; | 1222 | }; |
1222 | 1223 | ||
1223 | /** | 1224 | /** |
@@ -2651,6 +2652,15 @@ unsigned int ieee80211_get_hdrlen_from_skb(const struct sk_buff *skb); | |||
2651 | unsigned int __attribute_const__ ieee80211_hdrlen(__le16 fc); | 2652 | unsigned int __attribute_const__ ieee80211_hdrlen(__le16 fc); |
2652 | 2653 | ||
2653 | /** | 2654 | /** |
2655 | * ieee80211_get_mesh_hdrlen - get mesh extension header length | ||
2656 | * @meshhdr: the mesh extension header, only the flags field | ||
2657 | * (first byte) will be accessed | ||
2658 | * Returns the length of the extension header, which is always at | ||
2659 | * least 6 bytes and at most 18 if address 5 and 6 are present. | ||
2660 | */ | ||
2661 | unsigned int ieee80211_get_mesh_hdrlen(struct ieee80211s_hdr *meshhdr); | ||
2662 | |||
2663 | /** | ||
2654 | * DOC: Data path helpers | 2664 | * DOC: Data path helpers |
2655 | * | 2665 | * |
2656 | * In addition to generic utilities, cfg80211 also offers | 2666 | * In addition to generic utilities, cfg80211 also offers |
diff --git a/include/sound/core.h b/include/sound/core.h index bc056687f647..93896ad1fcdd 100644 --- a/include/sound/core.h +++ b/include/sound/core.h | |||
@@ -132,6 +132,7 @@ struct snd_card { | |||
132 | int shutdown; /* this card is going down */ | 132 | int shutdown; /* this card is going down */ |
133 | int free_on_last_close; /* free in context of file_release */ | 133 | int free_on_last_close; /* free in context of file_release */ |
134 | wait_queue_head_t shutdown_sleep; | 134 | wait_queue_head_t shutdown_sleep; |
135 | atomic_t refcount; /* refcount for disconnection */ | ||
135 | struct device *dev; /* device assigned to this card */ | 136 | struct device *dev; /* device assigned to this card */ |
136 | struct device *card_dev; /* cardX object for sysfs */ | 137 | struct device *card_dev; /* cardX object for sysfs */ |
137 | 138 | ||
@@ -189,6 +190,7 @@ struct snd_minor { | |||
189 | const struct file_operations *f_ops; /* file operations */ | 190 | const struct file_operations *f_ops; /* file operations */ |
190 | void *private_data; /* private data for f_ops->open */ | 191 | void *private_data; /* private data for f_ops->open */ |
191 | struct device *dev; /* device for sysfs */ | 192 | struct device *dev; /* device for sysfs */ |
193 | struct snd_card *card_ptr; /* assigned card instance */ | ||
192 | }; | 194 | }; |
193 | 195 | ||
194 | /* return a device pointer linked to each sound device as a parent */ | 196 | /* return a device pointer linked to each sound device as a parent */ |
@@ -295,6 +297,7 @@ int snd_card_info_done(void); | |||
295 | int snd_component_add(struct snd_card *card, const char *component); | 297 | int snd_component_add(struct snd_card *card, const char *component); |
296 | int snd_card_file_add(struct snd_card *card, struct file *file); | 298 | int snd_card_file_add(struct snd_card *card, struct file *file); |
297 | int snd_card_file_remove(struct snd_card *card, struct file *file); | 299 | int snd_card_file_remove(struct snd_card *card, struct file *file); |
300 | void snd_card_unref(struct snd_card *card); | ||
298 | 301 | ||
299 | #define snd_card_set_dev(card, devptr) ((card)->dev = (devptr)) | 302 | #define snd_card_set_dev(card, devptr) ((card)->dev = (devptr)) |
300 | 303 | ||
diff --git a/include/trace/events/xen.h b/include/trace/events/xen.h index 15ba03bdd7c6..d06b6da5c1e3 100644 --- a/include/trace/events/xen.h +++ b/include/trace/events/xen.h | |||
@@ -377,6 +377,14 @@ DECLARE_EVENT_CLASS(xen_mmu_pgd, | |||
377 | DEFINE_XEN_MMU_PGD_EVENT(xen_mmu_pgd_pin); | 377 | DEFINE_XEN_MMU_PGD_EVENT(xen_mmu_pgd_pin); |
378 | DEFINE_XEN_MMU_PGD_EVENT(xen_mmu_pgd_unpin); | 378 | DEFINE_XEN_MMU_PGD_EVENT(xen_mmu_pgd_unpin); |
379 | 379 | ||
380 | TRACE_EVENT(xen_mmu_flush_tlb_all, | ||
381 | TP_PROTO(int x), | ||
382 | TP_ARGS(x), | ||
383 | TP_STRUCT__entry(__array(char, x, 0)), | ||
384 | TP_fast_assign((void)x), | ||
385 | TP_printk("%s", "") | ||
386 | ); | ||
387 | |||
380 | TRACE_EVENT(xen_mmu_flush_tlb, | 388 | TRACE_EVENT(xen_mmu_flush_tlb, |
381 | TP_PROTO(int x), | 389 | TP_PROTO(int x), |
382 | TP_ARGS(x), | 390 | TP_ARGS(x), |
diff --git a/include/uapi/linux/raid/Kbuild b/include/uapi/linux/raid/Kbuild index aafaa5aa54d4..e2c3d25405d7 100644 --- a/include/uapi/linux/raid/Kbuild +++ b/include/uapi/linux/raid/Kbuild | |||
@@ -1 +1,3 @@ | |||
1 | # UAPI Header export list | 1 | # UAPI Header export list |
2 | header-y += md_p.h | ||
3 | header-y += md_u.h | ||
diff --git a/include/linux/raid/md_p.h b/include/uapi/linux/raid/md_p.h index ee753536ab70..ee753536ab70 100644 --- a/include/linux/raid/md_p.h +++ b/include/uapi/linux/raid/md_p.h | |||
diff --git a/include/uapi/linux/raid/md_u.h b/include/uapi/linux/raid/md_u.h new file mode 100644 index 000000000000..4133e744e4e6 --- /dev/null +++ b/include/uapi/linux/raid/md_u.h | |||
@@ -0,0 +1,155 @@ | |||
1 | /* | ||
2 | md_u.h : user <=> kernel API between Linux raidtools and RAID drivers | ||
3 | Copyright (C) 1998 Ingo Molnar | ||
4 | |||
5 | This program is free software; you can redistribute it and/or modify | ||
6 | it under the terms of the GNU General Public License as published by | ||
7 | the Free Software Foundation; either version 2, or (at your option) | ||
8 | any later version. | ||
9 | |||
10 | You should have received a copy of the GNU General Public License | ||
11 | (for example /usr/src/linux/COPYING); if not, write to the Free | ||
12 | Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
13 | */ | ||
14 | |||
15 | #ifndef _UAPI_MD_U_H | ||
16 | #define _UAPI_MD_U_H | ||
17 | |||
18 | /* | ||
19 | * Different major versions are not compatible. | ||
20 | * Different minor versions are only downward compatible. | ||
21 | * Different patchlevel versions are downward and upward compatible. | ||
22 | */ | ||
23 | #define MD_MAJOR_VERSION 0 | ||
24 | #define MD_MINOR_VERSION 90 | ||
25 | /* | ||
26 | * MD_PATCHLEVEL_VERSION indicates kernel functionality. | ||
27 | * >=1 means different superblock formats are selectable using SET_ARRAY_INFO | ||
28 | * and major_version/minor_version accordingly | ||
29 | * >=2 means that Internal bitmaps are supported by setting MD_SB_BITMAP_PRESENT | ||
30 | * in the super status byte | ||
31 | * >=3 means that bitmap superblock version 4 is supported, which uses | ||
32 | * little-ending representation rather than host-endian | ||
33 | */ | ||
34 | #define MD_PATCHLEVEL_VERSION 3 | ||
35 | |||
36 | /* ioctls */ | ||
37 | |||
38 | /* status */ | ||
39 | #define RAID_VERSION _IOR (MD_MAJOR, 0x10, mdu_version_t) | ||
40 | #define GET_ARRAY_INFO _IOR (MD_MAJOR, 0x11, mdu_array_info_t) | ||
41 | #define GET_DISK_INFO _IOR (MD_MAJOR, 0x12, mdu_disk_info_t) | ||
42 | #define PRINT_RAID_DEBUG _IO (MD_MAJOR, 0x13) | ||
43 | #define RAID_AUTORUN _IO (MD_MAJOR, 0x14) | ||
44 | #define GET_BITMAP_FILE _IOR (MD_MAJOR, 0x15, mdu_bitmap_file_t) | ||
45 | |||
46 | /* configuration */ | ||
47 | #define CLEAR_ARRAY _IO (MD_MAJOR, 0x20) | ||
48 | #define ADD_NEW_DISK _IOW (MD_MAJOR, 0x21, mdu_disk_info_t) | ||
49 | #define HOT_REMOVE_DISK _IO (MD_MAJOR, 0x22) | ||
50 | #define SET_ARRAY_INFO _IOW (MD_MAJOR, 0x23, mdu_array_info_t) | ||
51 | #define SET_DISK_INFO _IO (MD_MAJOR, 0x24) | ||
52 | #define WRITE_RAID_INFO _IO (MD_MAJOR, 0x25) | ||
53 | #define UNPROTECT_ARRAY _IO (MD_MAJOR, 0x26) | ||
54 | #define PROTECT_ARRAY _IO (MD_MAJOR, 0x27) | ||
55 | #define HOT_ADD_DISK _IO (MD_MAJOR, 0x28) | ||
56 | #define SET_DISK_FAULTY _IO (MD_MAJOR, 0x29) | ||
57 | #define HOT_GENERATE_ERROR _IO (MD_MAJOR, 0x2a) | ||
58 | #define SET_BITMAP_FILE _IOW (MD_MAJOR, 0x2b, int) | ||
59 | |||
60 | /* usage */ | ||
61 | #define RUN_ARRAY _IOW (MD_MAJOR, 0x30, mdu_param_t) | ||
62 | /* 0x31 was START_ARRAY */ | ||
63 | #define STOP_ARRAY _IO (MD_MAJOR, 0x32) | ||
64 | #define STOP_ARRAY_RO _IO (MD_MAJOR, 0x33) | ||
65 | #define RESTART_ARRAY_RW _IO (MD_MAJOR, 0x34) | ||
66 | |||
67 | /* 63 partitions with the alternate major number (mdp) */ | ||
68 | #define MdpMinorShift 6 | ||
69 | |||
70 | typedef struct mdu_version_s { | ||
71 | int major; | ||
72 | int minor; | ||
73 | int patchlevel; | ||
74 | } mdu_version_t; | ||
75 | |||
76 | typedef struct mdu_array_info_s { | ||
77 | /* | ||
78 | * Generic constant information | ||
79 | */ | ||
80 | int major_version; | ||
81 | int minor_version; | ||
82 | int patch_version; | ||
83 | int ctime; | ||
84 | int level; | ||
85 | int size; | ||
86 | int nr_disks; | ||
87 | int raid_disks; | ||
88 | int md_minor; | ||
89 | int not_persistent; | ||
90 | |||
91 | /* | ||
92 | * Generic state information | ||
93 | */ | ||
94 | int utime; /* 0 Superblock update time */ | ||
95 | int state; /* 1 State bits (clean, ...) */ | ||
96 | int active_disks; /* 2 Number of currently active disks */ | ||
97 | int working_disks; /* 3 Number of working disks */ | ||
98 | int failed_disks; /* 4 Number of failed disks */ | ||
99 | int spare_disks; /* 5 Number of spare disks */ | ||
100 | |||
101 | /* | ||
102 | * Personality information | ||
103 | */ | ||
104 | int layout; /* 0 the array's physical layout */ | ||
105 | int chunk_size; /* 1 chunk size in bytes */ | ||
106 | |||
107 | } mdu_array_info_t; | ||
108 | |||
109 | /* non-obvious values for 'level' */ | ||
110 | #define LEVEL_MULTIPATH (-4) | ||
111 | #define LEVEL_LINEAR (-1) | ||
112 | #define LEVEL_FAULTY (-5) | ||
113 | |||
114 | /* we need a value for 'no level specified' and 0 | ||
115 | * means 'raid0', so we need something else. This is | ||
116 | * for internal use only | ||
117 | */ | ||
118 | #define LEVEL_NONE (-1000000) | ||
119 | |||
120 | typedef struct mdu_disk_info_s { | ||
121 | /* | ||
122 | * configuration/status of one particular disk | ||
123 | */ | ||
124 | int number; | ||
125 | int major; | ||
126 | int minor; | ||
127 | int raid_disk; | ||
128 | int state; | ||
129 | |||
130 | } mdu_disk_info_t; | ||
131 | |||
132 | typedef struct mdu_start_info_s { | ||
133 | /* | ||
134 | * configuration/status of one particular disk | ||
135 | */ | ||
136 | int major; | ||
137 | int minor; | ||
138 | int raid_disk; | ||
139 | int state; | ||
140 | |||
141 | } mdu_start_info_t; | ||
142 | |||
143 | typedef struct mdu_bitmap_file_s | ||
144 | { | ||
145 | char pathname[4096]; | ||
146 | } mdu_bitmap_file_t; | ||
147 | |||
148 | typedef struct mdu_param_s | ||
149 | { | ||
150 | int personality; /* 1,2,3,4 */ | ||
151 | int chunk_size; /* in bytes */ | ||
152 | int max_fault; /* unused for now */ | ||
153 | } mdu_param_t; | ||
154 | |||
155 | #endif /* _UAPI_MD_U_H */ | ||
diff --git a/include/uapi/linux/tcp.h b/include/uapi/linux/tcp.h index c4b89a5cb7df..e962faa5ab0d 100644 --- a/include/uapi/linux/tcp.h +++ b/include/uapi/linux/tcp.h | |||
@@ -130,6 +130,7 @@ enum { | |||
130 | #define TCPI_OPT_WSCALE 4 | 130 | #define TCPI_OPT_WSCALE 4 |
131 | #define TCPI_OPT_ECN 8 /* ECN was negociated at TCP session init */ | 131 | #define TCPI_OPT_ECN 8 /* ECN was negociated at TCP session init */ |
132 | #define TCPI_OPT_ECN_SEEN 16 /* we received at least one packet with ECT */ | 132 | #define TCPI_OPT_ECN_SEEN 16 /* we received at least one packet with ECT */ |
133 | #define TCPI_OPT_SYN_DATA 32 /* SYN-ACK acked data in SYN sent or rcvd */ | ||
133 | 134 | ||
134 | enum tcp_ca_state { | 135 | enum tcp_ca_state { |
135 | TCP_CA_Open = 0, | 136 | TCP_CA_Open = 0, |
diff --git a/include/xen/grant_table.h b/include/xen/grant_table.h index aecee9d112cb..694dcaf266e6 100644 --- a/include/xen/grant_table.h +++ b/include/xen/grant_table.h | |||
@@ -170,7 +170,7 @@ gnttab_set_unmap_op(struct gnttab_unmap_grant_ref *unmap, phys_addr_t addr, | |||
170 | unmap->dev_bus_addr = 0; | 170 | unmap->dev_bus_addr = 0; |
171 | } | 171 | } |
172 | 172 | ||
173 | int arch_gnttab_map_shared(unsigned long *frames, unsigned long nr_gframes, | 173 | int arch_gnttab_map_shared(xen_pfn_t *frames, unsigned long nr_gframes, |
174 | unsigned long max_nr_gframes, | 174 | unsigned long max_nr_gframes, |
175 | void **__shared); | 175 | void **__shared); |
176 | int arch_gnttab_map_status(uint64_t *frames, unsigned long nr_gframes, | 176 | int arch_gnttab_map_status(uint64_t *frames, unsigned long nr_gframes, |
diff --git a/include/xen/interface/grant_table.h b/include/xen/interface/grant_table.h index f9f8b975ae74..e40fae9bf11a 100644 --- a/include/xen/interface/grant_table.h +++ b/include/xen/interface/grant_table.h | |||
@@ -310,7 +310,7 @@ struct gnttab_setup_table { | |||
310 | uint32_t nr_frames; | 310 | uint32_t nr_frames; |
311 | /* OUT parameters. */ | 311 | /* OUT parameters. */ |
312 | int16_t status; /* GNTST_* */ | 312 | int16_t status; /* GNTST_* */ |
313 | GUEST_HANDLE(ulong) frame_list; | 313 | GUEST_HANDLE(xen_pfn_t) frame_list; |
314 | }; | 314 | }; |
315 | DEFINE_GUEST_HANDLE_STRUCT(gnttab_setup_table); | 315 | DEFINE_GUEST_HANDLE_STRUCT(gnttab_setup_table); |
316 | 316 | ||
diff --git a/include/xen/interface/memory.h b/include/xen/interface/memory.h index b66d04ce6957..90712e2072d5 100644 --- a/include/xen/interface/memory.h +++ b/include/xen/interface/memory.h | |||
@@ -179,28 +179,8 @@ struct xen_add_to_physmap { | |||
179 | }; | 179 | }; |
180 | DEFINE_GUEST_HANDLE_STRUCT(xen_add_to_physmap); | 180 | DEFINE_GUEST_HANDLE_STRUCT(xen_add_to_physmap); |
181 | 181 | ||
182 | /* | 182 | /*** REMOVED ***/ |
183 | * Translates a list of domain-specific GPFNs into MFNs. Returns a -ve error | 183 | /*#define XENMEM_translate_gpfn_list 8*/ |
184 | * code on failure. This call only works for auto-translated guests. | ||
185 | */ | ||
186 | #define XENMEM_translate_gpfn_list 8 | ||
187 | struct xen_translate_gpfn_list { | ||
188 | /* Which domain to translate for? */ | ||
189 | domid_t domid; | ||
190 | |||
191 | /* Length of list. */ | ||
192 | xen_ulong_t nr_gpfns; | ||
193 | |||
194 | /* List of GPFNs to translate. */ | ||
195 | GUEST_HANDLE(ulong) gpfn_list; | ||
196 | |||
197 | /* | ||
198 | * Output list to contain MFN translations. May be the same as the input | ||
199 | * list (in which case each input GPFN is overwritten with the output MFN). | ||
200 | */ | ||
201 | GUEST_HANDLE(ulong) mfn_list; | ||
202 | }; | ||
203 | DEFINE_GUEST_HANDLE_STRUCT(xen_translate_gpfn_list); | ||
204 | 184 | ||
205 | /* | 185 | /* |
206 | * Returns the pseudo-physical memory map as it was when the domain | 186 | * Returns the pseudo-physical memory map as it was when the domain |
diff --git a/init/main.c b/init/main.c index 9cf77ab138a6..e33e09df3cbc 100644 --- a/init/main.c +++ b/init/main.c | |||
@@ -442,9 +442,11 @@ void __init __weak smp_setup_processor_id(void) | |||
442 | { | 442 | { |
443 | } | 443 | } |
444 | 444 | ||
445 | # if THREAD_SIZE >= PAGE_SIZE | ||
445 | void __init __weak thread_info_cache_init(void) | 446 | void __init __weak thread_info_cache_init(void) |
446 | { | 447 | { |
447 | } | 448 | } |
449 | #endif | ||
448 | 450 | ||
449 | /* | 451 | /* |
450 | * Set up kernel memory allocators | 452 | * Set up kernel memory allocators |
diff --git a/kernel/Makefile b/kernel/Makefile index 0dfeca4324ee..86e3285ae7e5 100644 --- a/kernel/Makefile +++ b/kernel/Makefile | |||
@@ -174,10 +174,8 @@ signing_key.priv signing_key.x509: x509.genkey | |||
174 | @echo "###" | 174 | @echo "###" |
175 | @echo "### If this takes a long time, you might wish to run rngd in the" | 175 | @echo "### If this takes a long time, you might wish to run rngd in the" |
176 | @echo "### background to keep the supply of entropy topped up. It" | 176 | @echo "### background to keep the supply of entropy topped up. It" |
177 | @echo "### needs to be run as root, and should use a hardware random" | 177 | @echo "### needs to be run as root, and uses a hardware random" |
178 | @echo "### number generator if one is available, eg:" | 178 | @echo "### number generator if one is available." |
179 | @echo "###" | ||
180 | @echo "### rngd -r /dev/hwrandom" | ||
181 | @echo "###" | 179 | @echo "###" |
182 | openssl req -new -nodes -utf8 $(sign_key_with_hash) -days 36500 -batch \ | 180 | openssl req -new -nodes -utf8 $(sign_key_with_hash) -days 36500 -batch \ |
183 | -x509 -config x509.genkey \ | 181 | -x509 -config x509.genkey \ |
diff --git a/kernel/cgroup.c b/kernel/cgroup.c index 13774b3b39aa..f24f724620dd 100644 --- a/kernel/cgroup.c +++ b/kernel/cgroup.c | |||
@@ -1962,9 +1962,8 @@ static void cgroup_task_migrate(struct cgroup *cgrp, struct cgroup *oldcgrp, | |||
1962 | * trading it for newcg is protected by cgroup_mutex, we're safe to drop | 1962 | * trading it for newcg is protected by cgroup_mutex, we're safe to drop |
1963 | * it here; it will be freed under RCU. | 1963 | * it here; it will be freed under RCU. |
1964 | */ | 1964 | */ |
1965 | put_css_set(oldcg); | ||
1966 | |||
1967 | set_bit(CGRP_RELEASABLE, &oldcgrp->flags); | 1965 | set_bit(CGRP_RELEASABLE, &oldcgrp->flags); |
1966 | put_css_set(oldcg); | ||
1968 | } | 1967 | } |
1969 | 1968 | ||
1970 | /** | 1969 | /** |
@@ -4815,31 +4814,20 @@ static const struct file_operations proc_cgroupstats_operations = { | |||
4815 | * | 4814 | * |
4816 | * A pointer to the shared css_set was automatically copied in | 4815 | * A pointer to the shared css_set was automatically copied in |
4817 | * fork.c by dup_task_struct(). However, we ignore that copy, since | 4816 | * fork.c by dup_task_struct(). However, we ignore that copy, since |
4818 | * it was not made under the protection of RCU, cgroup_mutex or | 4817 | * it was not made under the protection of RCU or cgroup_mutex, so |
4819 | * threadgroup_change_begin(), so it might no longer be a valid | 4818 | * might no longer be a valid cgroup pointer. cgroup_attach_task() might |
4820 | * cgroup pointer. cgroup_attach_task() might have already changed | 4819 | * have already changed current->cgroups, allowing the previously |
4821 | * current->cgroups, allowing the previously referenced cgroup | 4820 | * referenced cgroup group to be removed and freed. |
4822 | * group to be removed and freed. | ||
4823 | * | ||
4824 | * Outside the pointer validity we also need to process the css_set | ||
4825 | * inheritance between threadgoup_change_begin() and | ||
4826 | * threadgoup_change_end(), this way there is no leak in any process | ||
4827 | * wide migration performed by cgroup_attach_proc() that could otherwise | ||
4828 | * miss a thread because it is too early or too late in the fork stage. | ||
4829 | * | 4821 | * |
4830 | * At the point that cgroup_fork() is called, 'current' is the parent | 4822 | * At the point that cgroup_fork() is called, 'current' is the parent |
4831 | * task, and the passed argument 'child' points to the child task. | 4823 | * task, and the passed argument 'child' points to the child task. |
4832 | */ | 4824 | */ |
4833 | void cgroup_fork(struct task_struct *child) | 4825 | void cgroup_fork(struct task_struct *child) |
4834 | { | 4826 | { |
4835 | /* | 4827 | task_lock(current); |
4836 | * We don't need to task_lock() current because current->cgroups | ||
4837 | * can't be changed concurrently here. The parent obviously hasn't | ||
4838 | * exited and called cgroup_exit(), and we are synchronized against | ||
4839 | * cgroup migration through threadgroup_change_begin(). | ||
4840 | */ | ||
4841 | child->cgroups = current->cgroups; | 4828 | child->cgroups = current->cgroups; |
4842 | get_css_set(child->cgroups); | 4829 | get_css_set(child->cgroups); |
4830 | task_unlock(current); | ||
4843 | INIT_LIST_HEAD(&child->cg_list); | 4831 | INIT_LIST_HEAD(&child->cg_list); |
4844 | } | 4832 | } |
4845 | 4833 | ||
@@ -4895,19 +4883,10 @@ void cgroup_post_fork(struct task_struct *child) | |||
4895 | */ | 4883 | */ |
4896 | if (use_task_css_set_links) { | 4884 | if (use_task_css_set_links) { |
4897 | write_lock(&css_set_lock); | 4885 | write_lock(&css_set_lock); |
4898 | if (list_empty(&child->cg_list)) { | 4886 | task_lock(child); |
4899 | /* | 4887 | if (list_empty(&child->cg_list)) |
4900 | * It's safe to use child->cgroups without task_lock() | ||
4901 | * here because we are protected through | ||
4902 | * threadgroup_change_begin() against concurrent | ||
4903 | * css_set change in cgroup_task_migrate(). Also | ||
4904 | * the task can't exit at that point until | ||
4905 | * wake_up_new_task() is called, so we are protected | ||
4906 | * against cgroup_exit() setting child->cgroup to | ||
4907 | * init_css_set. | ||
4908 | */ | ||
4909 | list_add(&child->cg_list, &child->cgroups->tasks); | 4888 | list_add(&child->cg_list, &child->cgroups->tasks); |
4910 | } | 4889 | task_unlock(child); |
4911 | write_unlock(&css_set_lock); | 4890 | write_unlock(&css_set_lock); |
4912 | } | 4891 | } |
4913 | } | 4892 | } |
diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c index 98256bc71ee1..5cc4e7e42e68 100644 --- a/kernel/events/uprobes.c +++ b/kernel/events/uprobes.c | |||
@@ -78,15 +78,23 @@ static struct mutex uprobes_mmap_mutex[UPROBES_HASH_SZ]; | |||
78 | */ | 78 | */ |
79 | static atomic_t uprobe_events = ATOMIC_INIT(0); | 79 | static atomic_t uprobe_events = ATOMIC_INIT(0); |
80 | 80 | ||
81 | /* Have a copy of original instruction */ | ||
82 | #define UPROBE_COPY_INSN 0 | ||
83 | /* Dont run handlers when first register/ last unregister in progress*/ | ||
84 | #define UPROBE_RUN_HANDLER 1 | ||
85 | /* Can skip singlestep */ | ||
86 | #define UPROBE_SKIP_SSTEP 2 | ||
87 | |||
81 | struct uprobe { | 88 | struct uprobe { |
82 | struct rb_node rb_node; /* node in the rb tree */ | 89 | struct rb_node rb_node; /* node in the rb tree */ |
83 | atomic_t ref; | 90 | atomic_t ref; |
84 | struct rw_semaphore consumer_rwsem; | 91 | struct rw_semaphore consumer_rwsem; |
92 | struct mutex copy_mutex; /* TODO: kill me and UPROBE_COPY_INSN */ | ||
85 | struct list_head pending_list; | 93 | struct list_head pending_list; |
86 | struct uprobe_consumer *consumers; | 94 | struct uprobe_consumer *consumers; |
87 | struct inode *inode; /* Also hold a ref to inode */ | 95 | struct inode *inode; /* Also hold a ref to inode */ |
88 | loff_t offset; | 96 | loff_t offset; |
89 | int flags; | 97 | unsigned long flags; |
90 | struct arch_uprobe arch; | 98 | struct arch_uprobe arch; |
91 | }; | 99 | }; |
92 | 100 | ||
@@ -100,17 +108,12 @@ struct uprobe { | |||
100 | */ | 108 | */ |
101 | static bool valid_vma(struct vm_area_struct *vma, bool is_register) | 109 | static bool valid_vma(struct vm_area_struct *vma, bool is_register) |
102 | { | 110 | { |
103 | if (!vma->vm_file) | 111 | vm_flags_t flags = VM_HUGETLB | VM_MAYEXEC | VM_SHARED; |
104 | return false; | ||
105 | |||
106 | if (!is_register) | ||
107 | return true; | ||
108 | 112 | ||
109 | if ((vma->vm_flags & (VM_HUGETLB|VM_READ|VM_WRITE|VM_EXEC|VM_SHARED)) | 113 | if (is_register) |
110 | == (VM_READ|VM_EXEC)) | 114 | flags |= VM_WRITE; |
111 | return true; | ||
112 | 115 | ||
113 | return false; | 116 | return vma->vm_file && (vma->vm_flags & flags) == VM_MAYEXEC; |
114 | } | 117 | } |
115 | 118 | ||
116 | static unsigned long offset_to_vaddr(struct vm_area_struct *vma, loff_t offset) | 119 | static unsigned long offset_to_vaddr(struct vm_area_struct *vma, loff_t offset) |
@@ -193,19 +196,44 @@ bool __weak is_swbp_insn(uprobe_opcode_t *insn) | |||
193 | return *insn == UPROBE_SWBP_INSN; | 196 | return *insn == UPROBE_SWBP_INSN; |
194 | } | 197 | } |
195 | 198 | ||
199 | static void copy_opcode(struct page *page, unsigned long vaddr, uprobe_opcode_t *opcode) | ||
200 | { | ||
201 | void *kaddr = kmap_atomic(page); | ||
202 | memcpy(opcode, kaddr + (vaddr & ~PAGE_MASK), UPROBE_SWBP_INSN_SIZE); | ||
203 | kunmap_atomic(kaddr); | ||
204 | } | ||
205 | |||
206 | static int verify_opcode(struct page *page, unsigned long vaddr, uprobe_opcode_t *new_opcode) | ||
207 | { | ||
208 | uprobe_opcode_t old_opcode; | ||
209 | bool is_swbp; | ||
210 | |||
211 | copy_opcode(page, vaddr, &old_opcode); | ||
212 | is_swbp = is_swbp_insn(&old_opcode); | ||
213 | |||
214 | if (is_swbp_insn(new_opcode)) { | ||
215 | if (is_swbp) /* register: already installed? */ | ||
216 | return 0; | ||
217 | } else { | ||
218 | if (!is_swbp) /* unregister: was it changed by us? */ | ||
219 | return 0; | ||
220 | } | ||
221 | |||
222 | return 1; | ||
223 | } | ||
224 | |||
196 | /* | 225 | /* |
197 | * NOTE: | 226 | * NOTE: |
198 | * Expect the breakpoint instruction to be the smallest size instruction for | 227 | * Expect the breakpoint instruction to be the smallest size instruction for |
199 | * the architecture. If an arch has variable length instruction and the | 228 | * the architecture. If an arch has variable length instruction and the |
200 | * breakpoint instruction is not of the smallest length instruction | 229 | * breakpoint instruction is not of the smallest length instruction |
201 | * supported by that architecture then we need to modify read_opcode / | 230 | * supported by that architecture then we need to modify is_swbp_at_addr and |
202 | * write_opcode accordingly. This would never be a problem for archs that | 231 | * write_opcode accordingly. This would never be a problem for archs that |
203 | * have fixed length instructions. | 232 | * have fixed length instructions. |
204 | */ | 233 | */ |
205 | 234 | ||
206 | /* | 235 | /* |
207 | * write_opcode - write the opcode at a given virtual address. | 236 | * write_opcode - write the opcode at a given virtual address. |
208 | * @auprobe: arch breakpointing information. | ||
209 | * @mm: the probed process address space. | 237 | * @mm: the probed process address space. |
210 | * @vaddr: the virtual address to store the opcode. | 238 | * @vaddr: the virtual address to store the opcode. |
211 | * @opcode: opcode to be written at @vaddr. | 239 | * @opcode: opcode to be written at @vaddr. |
@@ -216,8 +244,8 @@ bool __weak is_swbp_insn(uprobe_opcode_t *insn) | |||
216 | * For mm @mm, write the opcode at @vaddr. | 244 | * For mm @mm, write the opcode at @vaddr. |
217 | * Return 0 (success) or a negative errno. | 245 | * Return 0 (success) or a negative errno. |
218 | */ | 246 | */ |
219 | static int write_opcode(struct arch_uprobe *auprobe, struct mm_struct *mm, | 247 | static int write_opcode(struct mm_struct *mm, unsigned long vaddr, |
220 | unsigned long vaddr, uprobe_opcode_t opcode) | 248 | uprobe_opcode_t opcode) |
221 | { | 249 | { |
222 | struct page *old_page, *new_page; | 250 | struct page *old_page, *new_page; |
223 | void *vaddr_old, *vaddr_new; | 251 | void *vaddr_old, *vaddr_new; |
@@ -226,10 +254,14 @@ static int write_opcode(struct arch_uprobe *auprobe, struct mm_struct *mm, | |||
226 | 254 | ||
227 | retry: | 255 | retry: |
228 | /* Read the page with vaddr into memory */ | 256 | /* Read the page with vaddr into memory */ |
229 | ret = get_user_pages(NULL, mm, vaddr, 1, 0, 0, &old_page, &vma); | 257 | ret = get_user_pages(NULL, mm, vaddr, 1, 0, 1, &old_page, &vma); |
230 | if (ret <= 0) | 258 | if (ret <= 0) |
231 | return ret; | 259 | return ret; |
232 | 260 | ||
261 | ret = verify_opcode(old_page, vaddr, &opcode); | ||
262 | if (ret <= 0) | ||
263 | goto put_old; | ||
264 | |||
233 | ret = -ENOMEM; | 265 | ret = -ENOMEM; |
234 | new_page = alloc_page_vma(GFP_HIGHUSER_MOVABLE, vma, vaddr); | 266 | new_page = alloc_page_vma(GFP_HIGHUSER_MOVABLE, vma, vaddr); |
235 | if (!new_page) | 267 | if (!new_page) |
@@ -264,63 +296,6 @@ put_old: | |||
264 | } | 296 | } |
265 | 297 | ||
266 | /** | 298 | /** |
267 | * read_opcode - read the opcode at a given virtual address. | ||
268 | * @mm: the probed process address space. | ||
269 | * @vaddr: the virtual address to read the opcode. | ||
270 | * @opcode: location to store the read opcode. | ||
271 | * | ||
272 | * Called with mm->mmap_sem held (for read and with a reference to | ||
273 | * mm. | ||
274 | * | ||
275 | * For mm @mm, read the opcode at @vaddr and store it in @opcode. | ||
276 | * Return 0 (success) or a negative errno. | ||
277 | */ | ||
278 | static int read_opcode(struct mm_struct *mm, unsigned long vaddr, uprobe_opcode_t *opcode) | ||
279 | { | ||
280 | struct page *page; | ||
281 | void *vaddr_new; | ||
282 | int ret; | ||
283 | |||
284 | ret = get_user_pages(NULL, mm, vaddr, 1, 0, 1, &page, NULL); | ||
285 | if (ret <= 0) | ||
286 | return ret; | ||
287 | |||
288 | vaddr_new = kmap_atomic(page); | ||
289 | vaddr &= ~PAGE_MASK; | ||
290 | memcpy(opcode, vaddr_new + vaddr, UPROBE_SWBP_INSN_SIZE); | ||
291 | kunmap_atomic(vaddr_new); | ||
292 | |||
293 | put_page(page); | ||
294 | |||
295 | return 0; | ||
296 | } | ||
297 | |||
298 | static int is_swbp_at_addr(struct mm_struct *mm, unsigned long vaddr) | ||
299 | { | ||
300 | uprobe_opcode_t opcode; | ||
301 | int result; | ||
302 | |||
303 | if (current->mm == mm) { | ||
304 | pagefault_disable(); | ||
305 | result = __copy_from_user_inatomic(&opcode, (void __user*)vaddr, | ||
306 | sizeof(opcode)); | ||
307 | pagefault_enable(); | ||
308 | |||
309 | if (likely(result == 0)) | ||
310 | goto out; | ||
311 | } | ||
312 | |||
313 | result = read_opcode(mm, vaddr, &opcode); | ||
314 | if (result) | ||
315 | return result; | ||
316 | out: | ||
317 | if (is_swbp_insn(&opcode)) | ||
318 | return 1; | ||
319 | |||
320 | return 0; | ||
321 | } | ||
322 | |||
323 | /** | ||
324 | * set_swbp - store breakpoint at a given address. | 299 | * set_swbp - store breakpoint at a given address. |
325 | * @auprobe: arch specific probepoint information. | 300 | * @auprobe: arch specific probepoint information. |
326 | * @mm: the probed process address space. | 301 | * @mm: the probed process address space. |
@@ -331,18 +306,7 @@ out: | |||
331 | */ | 306 | */ |
332 | int __weak set_swbp(struct arch_uprobe *auprobe, struct mm_struct *mm, unsigned long vaddr) | 307 | int __weak set_swbp(struct arch_uprobe *auprobe, struct mm_struct *mm, unsigned long vaddr) |
333 | { | 308 | { |
334 | int result; | 309 | return write_opcode(mm, vaddr, UPROBE_SWBP_INSN); |
335 | /* | ||
336 | * See the comment near uprobes_hash(). | ||
337 | */ | ||
338 | result = is_swbp_at_addr(mm, vaddr); | ||
339 | if (result == 1) | ||
340 | return 0; | ||
341 | |||
342 | if (result) | ||
343 | return result; | ||
344 | |||
345 | return write_opcode(auprobe, mm, vaddr, UPROBE_SWBP_INSN); | ||
346 | } | 310 | } |
347 | 311 | ||
348 | /** | 312 | /** |
@@ -357,16 +321,7 @@ int __weak set_swbp(struct arch_uprobe *auprobe, struct mm_struct *mm, unsigned | |||
357 | int __weak | 321 | int __weak |
358 | set_orig_insn(struct arch_uprobe *auprobe, struct mm_struct *mm, unsigned long vaddr) | 322 | set_orig_insn(struct arch_uprobe *auprobe, struct mm_struct *mm, unsigned long vaddr) |
359 | { | 323 | { |
360 | int result; | 324 | return write_opcode(mm, vaddr, *(uprobe_opcode_t *)auprobe->insn); |
361 | |||
362 | result = is_swbp_at_addr(mm, vaddr); | ||
363 | if (!result) | ||
364 | return -EINVAL; | ||
365 | |||
366 | if (result != 1) | ||
367 | return result; | ||
368 | |||
369 | return write_opcode(auprobe, mm, vaddr, *(uprobe_opcode_t *)auprobe->insn); | ||
370 | } | 325 | } |
371 | 326 | ||
372 | static int match_uprobe(struct uprobe *l, struct uprobe *r) | 327 | static int match_uprobe(struct uprobe *l, struct uprobe *r) |
@@ -473,7 +428,7 @@ static struct uprobe *insert_uprobe(struct uprobe *uprobe) | |||
473 | spin_unlock(&uprobes_treelock); | 428 | spin_unlock(&uprobes_treelock); |
474 | 429 | ||
475 | /* For now assume that the instruction need not be single-stepped */ | 430 | /* For now assume that the instruction need not be single-stepped */ |
476 | uprobe->flags |= UPROBE_SKIP_SSTEP; | 431 | __set_bit(UPROBE_SKIP_SSTEP, &uprobe->flags); |
477 | 432 | ||
478 | return u; | 433 | return u; |
479 | } | 434 | } |
@@ -495,6 +450,7 @@ static struct uprobe *alloc_uprobe(struct inode *inode, loff_t offset) | |||
495 | uprobe->inode = igrab(inode); | 450 | uprobe->inode = igrab(inode); |
496 | uprobe->offset = offset; | 451 | uprobe->offset = offset; |
497 | init_rwsem(&uprobe->consumer_rwsem); | 452 | init_rwsem(&uprobe->consumer_rwsem); |
453 | mutex_init(&uprobe->copy_mutex); | ||
498 | 454 | ||
499 | /* add to uprobes_tree, sorted on inode:offset */ | 455 | /* add to uprobes_tree, sorted on inode:offset */ |
500 | cur_uprobe = insert_uprobe(uprobe); | 456 | cur_uprobe = insert_uprobe(uprobe); |
@@ -515,7 +471,7 @@ static void handler_chain(struct uprobe *uprobe, struct pt_regs *regs) | |||
515 | { | 471 | { |
516 | struct uprobe_consumer *uc; | 472 | struct uprobe_consumer *uc; |
517 | 473 | ||
518 | if (!(uprobe->flags & UPROBE_RUN_HANDLER)) | 474 | if (!test_bit(UPROBE_RUN_HANDLER, &uprobe->flags)) |
519 | return; | 475 | return; |
520 | 476 | ||
521 | down_read(&uprobe->consumer_rwsem); | 477 | down_read(&uprobe->consumer_rwsem); |
@@ -621,29 +577,43 @@ static int copy_insn(struct uprobe *uprobe, struct file *filp) | |||
621 | return __copy_insn(mapping, filp, uprobe->arch.insn, bytes, uprobe->offset); | 577 | return __copy_insn(mapping, filp, uprobe->arch.insn, bytes, uprobe->offset); |
622 | } | 578 | } |
623 | 579 | ||
624 | /* | 580 | static int prepare_uprobe(struct uprobe *uprobe, struct file *file, |
625 | * How mm->uprobes_state.count gets updated | 581 | struct mm_struct *mm, unsigned long vaddr) |
626 | * uprobe_mmap() increments the count if | 582 | { |
627 | * - it successfully adds a breakpoint. | 583 | int ret = 0; |
628 | * - it cannot add a breakpoint, but sees that there is a underlying | 584 | |
629 | * breakpoint (via a is_swbp_at_addr()). | 585 | if (test_bit(UPROBE_COPY_INSN, &uprobe->flags)) |
630 | * | 586 | return ret; |
631 | * uprobe_munmap() decrements the count if | 587 | |
632 | * - it sees a underlying breakpoint, (via is_swbp_at_addr) | 588 | mutex_lock(&uprobe->copy_mutex); |
633 | * (Subsequent uprobe_unregister wouldnt find the breakpoint | 589 | if (test_bit(UPROBE_COPY_INSN, &uprobe->flags)) |
634 | * unless a uprobe_mmap kicks in, since the old vma would be | 590 | goto out; |
635 | * dropped just after uprobe_munmap.) | 591 | |
636 | * | 592 | ret = copy_insn(uprobe, file); |
637 | * uprobe_register increments the count if: | 593 | if (ret) |
638 | * - it successfully adds a breakpoint. | 594 | goto out; |
639 | * | 595 | |
640 | * uprobe_unregister decrements the count if: | 596 | ret = -ENOTSUPP; |
641 | * - it sees a underlying breakpoint and removes successfully. | 597 | if (is_swbp_insn((uprobe_opcode_t *)uprobe->arch.insn)) |
642 | * (via is_swbp_at_addr) | 598 | goto out; |
643 | * (Subsequent uprobe_munmap wouldnt find the breakpoint | 599 | |
644 | * since there is no underlying breakpoint after the | 600 | ret = arch_uprobe_analyze_insn(&uprobe->arch, mm, vaddr); |
645 | * breakpoint removal.) | 601 | if (ret) |
646 | */ | 602 | goto out; |
603 | |||
604 | /* write_opcode() assumes we don't cross page boundary */ | ||
605 | BUG_ON((uprobe->offset & ~PAGE_MASK) + | ||
606 | UPROBE_SWBP_INSN_SIZE > PAGE_SIZE); | ||
607 | |||
608 | smp_wmb(); /* pairs with rmb() in find_active_uprobe() */ | ||
609 | set_bit(UPROBE_COPY_INSN, &uprobe->flags); | ||
610 | |||
611 | out: | ||
612 | mutex_unlock(&uprobe->copy_mutex); | ||
613 | |||
614 | return ret; | ||
615 | } | ||
616 | |||
647 | static int | 617 | static int |
648 | install_breakpoint(struct uprobe *uprobe, struct mm_struct *mm, | 618 | install_breakpoint(struct uprobe *uprobe, struct mm_struct *mm, |
649 | struct vm_area_struct *vma, unsigned long vaddr) | 619 | struct vm_area_struct *vma, unsigned long vaddr) |
@@ -661,24 +631,9 @@ install_breakpoint(struct uprobe *uprobe, struct mm_struct *mm, | |||
661 | if (!uprobe->consumers) | 631 | if (!uprobe->consumers) |
662 | return 0; | 632 | return 0; |
663 | 633 | ||
664 | if (!(uprobe->flags & UPROBE_COPY_INSN)) { | 634 | ret = prepare_uprobe(uprobe, vma->vm_file, mm, vaddr); |
665 | ret = copy_insn(uprobe, vma->vm_file); | 635 | if (ret) |
666 | if (ret) | 636 | return ret; |
667 | return ret; | ||
668 | |||
669 | if (is_swbp_insn((uprobe_opcode_t *)uprobe->arch.insn)) | ||
670 | return -ENOTSUPP; | ||
671 | |||
672 | ret = arch_uprobe_analyze_insn(&uprobe->arch, mm, vaddr); | ||
673 | if (ret) | ||
674 | return ret; | ||
675 | |||
676 | /* write_opcode() assumes we don't cross page boundary */ | ||
677 | BUG_ON((uprobe->offset & ~PAGE_MASK) + | ||
678 | UPROBE_SWBP_INSN_SIZE > PAGE_SIZE); | ||
679 | |||
680 | uprobe->flags |= UPROBE_COPY_INSN; | ||
681 | } | ||
682 | 637 | ||
683 | /* | 638 | /* |
684 | * set MMF_HAS_UPROBES in advance for uprobe_pre_sstep_notifier(), | 639 | * set MMF_HAS_UPROBES in advance for uprobe_pre_sstep_notifier(), |
@@ -697,15 +652,15 @@ install_breakpoint(struct uprobe *uprobe, struct mm_struct *mm, | |||
697 | return ret; | 652 | return ret; |
698 | } | 653 | } |
699 | 654 | ||
700 | static void | 655 | static int |
701 | remove_breakpoint(struct uprobe *uprobe, struct mm_struct *mm, unsigned long vaddr) | 656 | remove_breakpoint(struct uprobe *uprobe, struct mm_struct *mm, unsigned long vaddr) |
702 | { | 657 | { |
703 | /* can happen if uprobe_register() fails */ | 658 | /* can happen if uprobe_register() fails */ |
704 | if (!test_bit(MMF_HAS_UPROBES, &mm->flags)) | 659 | if (!test_bit(MMF_HAS_UPROBES, &mm->flags)) |
705 | return; | 660 | return 0; |
706 | 661 | ||
707 | set_bit(MMF_RECALC_UPROBES, &mm->flags); | 662 | set_bit(MMF_RECALC_UPROBES, &mm->flags); |
708 | set_orig_insn(&uprobe->arch, mm, vaddr); | 663 | return set_orig_insn(&uprobe->arch, mm, vaddr); |
709 | } | 664 | } |
710 | 665 | ||
711 | /* | 666 | /* |
@@ -820,7 +775,7 @@ static int register_for_each_vma(struct uprobe *uprobe, bool is_register) | |||
820 | struct mm_struct *mm = info->mm; | 775 | struct mm_struct *mm = info->mm; |
821 | struct vm_area_struct *vma; | 776 | struct vm_area_struct *vma; |
822 | 777 | ||
823 | if (err) | 778 | if (err && is_register) |
824 | goto free; | 779 | goto free; |
825 | 780 | ||
826 | down_write(&mm->mmap_sem); | 781 | down_write(&mm->mmap_sem); |
@@ -836,7 +791,7 @@ static int register_for_each_vma(struct uprobe *uprobe, bool is_register) | |||
836 | if (is_register) | 791 | if (is_register) |
837 | err = install_breakpoint(uprobe, mm, vma, info->vaddr); | 792 | err = install_breakpoint(uprobe, mm, vma, info->vaddr); |
838 | else | 793 | else |
839 | remove_breakpoint(uprobe, mm, info->vaddr); | 794 | err |= remove_breakpoint(uprobe, mm, info->vaddr); |
840 | 795 | ||
841 | unlock: | 796 | unlock: |
842 | up_write(&mm->mmap_sem); | 797 | up_write(&mm->mmap_sem); |
@@ -893,13 +848,15 @@ int uprobe_register(struct inode *inode, loff_t offset, struct uprobe_consumer * | |||
893 | mutex_lock(uprobes_hash(inode)); | 848 | mutex_lock(uprobes_hash(inode)); |
894 | uprobe = alloc_uprobe(inode, offset); | 849 | uprobe = alloc_uprobe(inode, offset); |
895 | 850 | ||
896 | if (uprobe && !consumer_add(uprobe, uc)) { | 851 | if (!uprobe) { |
852 | ret = -ENOMEM; | ||
853 | } else if (!consumer_add(uprobe, uc)) { | ||
897 | ret = __uprobe_register(uprobe); | 854 | ret = __uprobe_register(uprobe); |
898 | if (ret) { | 855 | if (ret) { |
899 | uprobe->consumers = NULL; | 856 | uprobe->consumers = NULL; |
900 | __uprobe_unregister(uprobe); | 857 | __uprobe_unregister(uprobe); |
901 | } else { | 858 | } else { |
902 | uprobe->flags |= UPROBE_RUN_HANDLER; | 859 | set_bit(UPROBE_RUN_HANDLER, &uprobe->flags); |
903 | } | 860 | } |
904 | } | 861 | } |
905 | 862 | ||
@@ -932,7 +889,7 @@ void uprobe_unregister(struct inode *inode, loff_t offset, struct uprobe_consume | |||
932 | if (consumer_del(uprobe, uc)) { | 889 | if (consumer_del(uprobe, uc)) { |
933 | if (!uprobe->consumers) { | 890 | if (!uprobe->consumers) { |
934 | __uprobe_unregister(uprobe); | 891 | __uprobe_unregister(uprobe); |
935 | uprobe->flags &= ~UPROBE_RUN_HANDLER; | 892 | clear_bit(UPROBE_RUN_HANDLER, &uprobe->flags); |
936 | } | 893 | } |
937 | } | 894 | } |
938 | 895 | ||
@@ -1393,10 +1350,11 @@ bool uprobe_deny_signal(void) | |||
1393 | */ | 1350 | */ |
1394 | static bool can_skip_sstep(struct uprobe *uprobe, struct pt_regs *regs) | 1351 | static bool can_skip_sstep(struct uprobe *uprobe, struct pt_regs *regs) |
1395 | { | 1352 | { |
1396 | if (arch_uprobe_skip_sstep(&uprobe->arch, regs)) | 1353 | if (test_bit(UPROBE_SKIP_SSTEP, &uprobe->flags)) { |
1397 | return true; | 1354 | if (arch_uprobe_skip_sstep(&uprobe->arch, regs)) |
1398 | 1355 | return true; | |
1399 | uprobe->flags &= ~UPROBE_SKIP_SSTEP; | 1356 | clear_bit(UPROBE_SKIP_SSTEP, &uprobe->flags); |
1357 | } | ||
1400 | return false; | 1358 | return false; |
1401 | } | 1359 | } |
1402 | 1360 | ||
@@ -1419,6 +1377,30 @@ static void mmf_recalc_uprobes(struct mm_struct *mm) | |||
1419 | clear_bit(MMF_HAS_UPROBES, &mm->flags); | 1377 | clear_bit(MMF_HAS_UPROBES, &mm->flags); |
1420 | } | 1378 | } |
1421 | 1379 | ||
1380 | static int is_swbp_at_addr(struct mm_struct *mm, unsigned long vaddr) | ||
1381 | { | ||
1382 | struct page *page; | ||
1383 | uprobe_opcode_t opcode; | ||
1384 | int result; | ||
1385 | |||
1386 | pagefault_disable(); | ||
1387 | result = __copy_from_user_inatomic(&opcode, (void __user*)vaddr, | ||
1388 | sizeof(opcode)); | ||
1389 | pagefault_enable(); | ||
1390 | |||
1391 | if (likely(result == 0)) | ||
1392 | goto out; | ||
1393 | |||
1394 | result = get_user_pages(NULL, mm, vaddr, 1, 0, 1, &page, NULL); | ||
1395 | if (result < 0) | ||
1396 | return result; | ||
1397 | |||
1398 | copy_opcode(page, vaddr, &opcode); | ||
1399 | put_page(page); | ||
1400 | out: | ||
1401 | return is_swbp_insn(&opcode); | ||
1402 | } | ||
1403 | |||
1422 | static struct uprobe *find_active_uprobe(unsigned long bp_vaddr, int *is_swbp) | 1404 | static struct uprobe *find_active_uprobe(unsigned long bp_vaddr, int *is_swbp) |
1423 | { | 1405 | { |
1424 | struct mm_struct *mm = current->mm; | 1406 | struct mm_struct *mm = current->mm; |
@@ -1489,38 +1471,41 @@ static void handle_swbp(struct pt_regs *regs) | |||
1489 | } | 1471 | } |
1490 | return; | 1472 | return; |
1491 | } | 1473 | } |
1474 | /* | ||
1475 | * TODO: move copy_insn/etc into _register and remove this hack. | ||
1476 | * After we hit the bp, _unregister + _register can install the | ||
1477 | * new and not-yet-analyzed uprobe at the same address, restart. | ||
1478 | */ | ||
1479 | smp_rmb(); /* pairs with wmb() in install_breakpoint() */ | ||
1480 | if (unlikely(!test_bit(UPROBE_COPY_INSN, &uprobe->flags))) | ||
1481 | goto restart; | ||
1492 | 1482 | ||
1493 | utask = current->utask; | 1483 | utask = current->utask; |
1494 | if (!utask) { | 1484 | if (!utask) { |
1495 | utask = add_utask(); | 1485 | utask = add_utask(); |
1496 | /* Cannot allocate; re-execute the instruction. */ | 1486 | /* Cannot allocate; re-execute the instruction. */ |
1497 | if (!utask) | 1487 | if (!utask) |
1498 | goto cleanup_ret; | 1488 | goto restart; |
1499 | } | 1489 | } |
1500 | utask->active_uprobe = uprobe; | 1490 | |
1501 | handler_chain(uprobe, regs); | 1491 | handler_chain(uprobe, regs); |
1502 | if (uprobe->flags & UPROBE_SKIP_SSTEP && can_skip_sstep(uprobe, regs)) | 1492 | if (can_skip_sstep(uprobe, regs)) |
1503 | goto cleanup_ret; | 1493 | goto out; |
1504 | 1494 | ||
1505 | utask->state = UTASK_SSTEP; | ||
1506 | if (!pre_ssout(uprobe, regs, bp_vaddr)) { | 1495 | if (!pre_ssout(uprobe, regs, bp_vaddr)) { |
1507 | arch_uprobe_enable_step(&uprobe->arch); | 1496 | arch_uprobe_enable_step(&uprobe->arch); |
1497 | utask->active_uprobe = uprobe; | ||
1498 | utask->state = UTASK_SSTEP; | ||
1508 | return; | 1499 | return; |
1509 | } | 1500 | } |
1510 | 1501 | ||
1511 | cleanup_ret: | 1502 | restart: |
1512 | if (utask) { | 1503 | /* |
1513 | utask->active_uprobe = NULL; | 1504 | * cannot singlestep; cannot skip instruction; |
1514 | utask->state = UTASK_RUNNING; | 1505 | * re-execute the instruction. |
1515 | } | 1506 | */ |
1516 | if (!(uprobe->flags & UPROBE_SKIP_SSTEP)) | 1507 | instruction_pointer_set(regs, bp_vaddr); |
1517 | 1508 | out: | |
1518 | /* | ||
1519 | * cannot singlestep; cannot skip instruction; | ||
1520 | * re-execute the instruction. | ||
1521 | */ | ||
1522 | instruction_pointer_set(regs, bp_vaddr); | ||
1523 | |||
1524 | put_uprobe(uprobe); | 1509 | put_uprobe(uprobe); |
1525 | } | 1510 | } |
1526 | 1511 | ||
@@ -1552,13 +1537,12 @@ static void handle_singlestep(struct uprobe_task *utask, struct pt_regs *regs) | |||
1552 | } | 1537 | } |
1553 | 1538 | ||
1554 | /* | 1539 | /* |
1555 | * On breakpoint hit, breakpoint notifier sets the TIF_UPROBE flag. (and on | 1540 | * On breakpoint hit, breakpoint notifier sets the TIF_UPROBE flag and |
1556 | * subsequent probe hits on the thread sets the state to UTASK_BP_HIT) and | 1541 | * allows the thread to return from interrupt. After that handle_swbp() |
1557 | * allows the thread to return from interrupt. | 1542 | * sets utask->active_uprobe. |
1558 | * | 1543 | * |
1559 | * On singlestep exception, singlestep notifier sets the TIF_UPROBE flag and | 1544 | * On singlestep exception, singlestep notifier sets the TIF_UPROBE flag |
1560 | * also sets the state to UTASK_SSTEP_ACK and allows the thread to return from | 1545 | * and allows the thread to return from interrupt. |
1561 | * interrupt. | ||
1562 | * | 1546 | * |
1563 | * While returning to userspace, thread notices the TIF_UPROBE flag and calls | 1547 | * While returning to userspace, thread notices the TIF_UPROBE flag and calls |
1564 | * uprobe_notify_resume(). | 1548 | * uprobe_notify_resume(). |
@@ -1567,11 +1551,13 @@ void uprobe_notify_resume(struct pt_regs *regs) | |||
1567 | { | 1551 | { |
1568 | struct uprobe_task *utask; | 1552 | struct uprobe_task *utask; |
1569 | 1553 | ||
1554 | clear_thread_flag(TIF_UPROBE); | ||
1555 | |||
1570 | utask = current->utask; | 1556 | utask = current->utask; |
1571 | if (!utask || utask->state == UTASK_BP_HIT) | 1557 | if (utask && utask->active_uprobe) |
1572 | handle_swbp(regs); | ||
1573 | else | ||
1574 | handle_singlestep(utask, regs); | 1558 | handle_singlestep(utask, regs); |
1559 | else | ||
1560 | handle_swbp(regs); | ||
1575 | } | 1561 | } |
1576 | 1562 | ||
1577 | /* | 1563 | /* |
@@ -1580,17 +1566,10 @@ void uprobe_notify_resume(struct pt_regs *regs) | |||
1580 | */ | 1566 | */ |
1581 | int uprobe_pre_sstep_notifier(struct pt_regs *regs) | 1567 | int uprobe_pre_sstep_notifier(struct pt_regs *regs) |
1582 | { | 1568 | { |
1583 | struct uprobe_task *utask; | ||
1584 | |||
1585 | if (!current->mm || !test_bit(MMF_HAS_UPROBES, ¤t->mm->flags)) | 1569 | if (!current->mm || !test_bit(MMF_HAS_UPROBES, ¤t->mm->flags)) |
1586 | return 0; | 1570 | return 0; |
1587 | 1571 | ||
1588 | utask = current->utask; | ||
1589 | if (utask) | ||
1590 | utask->state = UTASK_BP_HIT; | ||
1591 | |||
1592 | set_thread_flag(TIF_UPROBE); | 1572 | set_thread_flag(TIF_UPROBE); |
1593 | |||
1594 | return 1; | 1573 | return 1; |
1595 | } | 1574 | } |
1596 | 1575 | ||
diff --git a/kernel/module_signing.c b/kernel/module_signing.c index d492a23df99c..ea1b1df5dbb0 100644 --- a/kernel/module_signing.c +++ b/kernel/module_signing.c | |||
@@ -192,7 +192,7 @@ int mod_verify_sig(const void *mod, unsigned long *_modlen) | |||
192 | size_t modlen = *_modlen, sig_len; | 192 | size_t modlen = *_modlen, sig_len; |
193 | int ret; | 193 | int ret; |
194 | 194 | ||
195 | pr_devel("==>%s(,%lu)\n", __func__, modlen); | 195 | pr_devel("==>%s(,%zu)\n", __func__, modlen); |
196 | 196 | ||
197 | if (modlen <= sizeof(ms)) | 197 | if (modlen <= sizeof(ms)) |
198 | return -EBADMSG; | 198 | return -EBADMSG; |
diff --git a/kernel/pid_namespace.c b/kernel/pid_namespace.c index eb00be205811..7b07cc0dfb75 100644 --- a/kernel/pid_namespace.c +++ b/kernel/pid_namespace.c | |||
@@ -71,12 +71,22 @@ err_alloc: | |||
71 | return NULL; | 71 | return NULL; |
72 | } | 72 | } |
73 | 73 | ||
74 | /* MAX_PID_NS_LEVEL is needed for limiting size of 'struct pid' */ | ||
75 | #define MAX_PID_NS_LEVEL 32 | ||
76 | |||
74 | static struct pid_namespace *create_pid_namespace(struct pid_namespace *parent_pid_ns) | 77 | static struct pid_namespace *create_pid_namespace(struct pid_namespace *parent_pid_ns) |
75 | { | 78 | { |
76 | struct pid_namespace *ns; | 79 | struct pid_namespace *ns; |
77 | unsigned int level = parent_pid_ns->level + 1; | 80 | unsigned int level = parent_pid_ns->level + 1; |
78 | int i, err = -ENOMEM; | 81 | int i; |
82 | int err; | ||
83 | |||
84 | if (level > MAX_PID_NS_LEVEL) { | ||
85 | err = -EINVAL; | ||
86 | goto out; | ||
87 | } | ||
79 | 88 | ||
89 | err = -ENOMEM; | ||
80 | ns = kmem_cache_zalloc(pid_ns_cachep, GFP_KERNEL); | 90 | ns = kmem_cache_zalloc(pid_ns_cachep, GFP_KERNEL); |
81 | if (ns == NULL) | 91 | if (ns == NULL) |
82 | goto out; | 92 | goto out; |
diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c index b32ed0e385a5..b979426d16c6 100644 --- a/kernel/trace/ring_buffer.c +++ b/kernel/trace/ring_buffer.c | |||
@@ -1567,6 +1567,10 @@ int ring_buffer_resize(struct ring_buffer *buffer, unsigned long size, | |||
1567 | 1567 | ||
1568 | put_online_cpus(); | 1568 | put_online_cpus(); |
1569 | } else { | 1569 | } else { |
1570 | /* Make sure this CPU has been intitialized */ | ||
1571 | if (!cpumask_test_cpu(cpu_id, buffer->cpumask)) | ||
1572 | goto out; | ||
1573 | |||
1570 | cpu_buffer = buffer->buffers[cpu_id]; | 1574 | cpu_buffer = buffer->buffers[cpu_id]; |
1571 | 1575 | ||
1572 | if (nr_pages == cpu_buffer->nr_pages) | 1576 | if (nr_pages == cpu_buffer->nr_pages) |
diff --git a/kernel/workqueue.c b/kernel/workqueue.c index d951daa0ca9a..042d221d33cc 100644 --- a/kernel/workqueue.c +++ b/kernel/workqueue.c | |||
@@ -2982,7 +2982,7 @@ bool cancel_delayed_work(struct delayed_work *dwork) | |||
2982 | 2982 | ||
2983 | set_work_cpu_and_clear_pending(&dwork->work, work_cpu(&dwork->work)); | 2983 | set_work_cpu_and_clear_pending(&dwork->work, work_cpu(&dwork->work)); |
2984 | local_irq_restore(flags); | 2984 | local_irq_restore(flags); |
2985 | return true; | 2985 | return ret; |
2986 | } | 2986 | } |
2987 | EXPORT_SYMBOL(cancel_delayed_work); | 2987 | EXPORT_SYMBOL(cancel_delayed_work); |
2988 | 2988 | ||
diff --git a/lib/genalloc.c b/lib/genalloc.c index ca208a92628c..54920433705a 100644 --- a/lib/genalloc.c +++ b/lib/genalloc.c | |||
@@ -178,7 +178,7 @@ int gen_pool_add_virt(struct gen_pool *pool, unsigned long virt, phys_addr_t phy | |||
178 | struct gen_pool_chunk *chunk; | 178 | struct gen_pool_chunk *chunk; |
179 | int nbits = size >> pool->min_alloc_order; | 179 | int nbits = size >> pool->min_alloc_order; |
180 | int nbytes = sizeof(struct gen_pool_chunk) + | 180 | int nbytes = sizeof(struct gen_pool_chunk) + |
181 | (nbits + BITS_PER_BYTE - 1) / BITS_PER_BYTE; | 181 | BITS_TO_LONGS(nbits) * sizeof(long); |
182 | 182 | ||
183 | chunk = kmalloc_node(nbytes, GFP_KERNEL | __GFP_ZERO, nid); | 183 | chunk = kmalloc_node(nbytes, GFP_KERNEL | __GFP_ZERO, nid); |
184 | if (unlikely(chunk == NULL)) | 184 | if (unlikely(chunk == NULL)) |
diff --git a/mm/memblock.c b/mm/memblock.c index 931eef145af5..625905523c2a 100644 --- a/mm/memblock.c +++ b/mm/memblock.c | |||
@@ -930,6 +930,30 @@ int __init_memblock memblock_is_region_reserved(phys_addr_t base, phys_addr_t si | |||
930 | return memblock_overlaps_region(&memblock.reserved, base, size) >= 0; | 930 | return memblock_overlaps_region(&memblock.reserved, base, size) >= 0; |
931 | } | 931 | } |
932 | 932 | ||
933 | void __init_memblock memblock_trim_memory(phys_addr_t align) | ||
934 | { | ||
935 | int i; | ||
936 | phys_addr_t start, end, orig_start, orig_end; | ||
937 | struct memblock_type *mem = &memblock.memory; | ||
938 | |||
939 | for (i = 0; i < mem->cnt; i++) { | ||
940 | orig_start = mem->regions[i].base; | ||
941 | orig_end = mem->regions[i].base + mem->regions[i].size; | ||
942 | start = round_up(orig_start, align); | ||
943 | end = round_down(orig_end, align); | ||
944 | |||
945 | if (start == orig_start && end == orig_end) | ||
946 | continue; | ||
947 | |||
948 | if (start < end) { | ||
949 | mem->regions[i].base = start; | ||
950 | mem->regions[i].size = end - start; | ||
951 | } else { | ||
952 | memblock_remove_region(mem, i); | ||
953 | i--; | ||
954 | } | ||
955 | } | ||
956 | } | ||
933 | 957 | ||
934 | void __init_memblock memblock_set_current_limit(phys_addr_t limit) | 958 | void __init_memblock memblock_set_current_limit(phys_addr_t limit) |
935 | { | 959 | { |
diff --git a/mm/mmu_notifier.c b/mm/mmu_notifier.c index 479a1e751a73..8a5ac8c686b0 100644 --- a/mm/mmu_notifier.c +++ b/mm/mmu_notifier.c | |||
@@ -196,28 +196,28 @@ static int do_mmu_notifier_register(struct mmu_notifier *mn, | |||
196 | BUG_ON(atomic_read(&mm->mm_users) <= 0); | 196 | BUG_ON(atomic_read(&mm->mm_users) <= 0); |
197 | 197 | ||
198 | /* | 198 | /* |
199 | * Verify that mmu_notifier_init() already run and the global srcu is | 199 | * Verify that mmu_notifier_init() already run and the global srcu is |
200 | * initialized. | 200 | * initialized. |
201 | */ | 201 | */ |
202 | BUG_ON(!srcu.per_cpu_ref); | 202 | BUG_ON(!srcu.per_cpu_ref); |
203 | 203 | ||
204 | ret = -ENOMEM; | ||
205 | mmu_notifier_mm = kmalloc(sizeof(struct mmu_notifier_mm), GFP_KERNEL); | ||
206 | if (unlikely(!mmu_notifier_mm)) | ||
207 | goto out; | ||
208 | |||
204 | if (take_mmap_sem) | 209 | if (take_mmap_sem) |
205 | down_write(&mm->mmap_sem); | 210 | down_write(&mm->mmap_sem); |
206 | ret = mm_take_all_locks(mm); | 211 | ret = mm_take_all_locks(mm); |
207 | if (unlikely(ret)) | 212 | if (unlikely(ret)) |
208 | goto out; | 213 | goto out_clean; |
209 | 214 | ||
210 | if (!mm_has_notifiers(mm)) { | 215 | if (!mm_has_notifiers(mm)) { |
211 | mmu_notifier_mm = kmalloc(sizeof(struct mmu_notifier_mm), | ||
212 | GFP_KERNEL); | ||
213 | if (unlikely(!mmu_notifier_mm)) { | ||
214 | ret = -ENOMEM; | ||
215 | goto out_of_mem; | ||
216 | } | ||
217 | INIT_HLIST_HEAD(&mmu_notifier_mm->list); | 216 | INIT_HLIST_HEAD(&mmu_notifier_mm->list); |
218 | spin_lock_init(&mmu_notifier_mm->lock); | 217 | spin_lock_init(&mmu_notifier_mm->lock); |
219 | 218 | ||
220 | mm->mmu_notifier_mm = mmu_notifier_mm; | 219 | mm->mmu_notifier_mm = mmu_notifier_mm; |
220 | mmu_notifier_mm = NULL; | ||
221 | } | 221 | } |
222 | atomic_inc(&mm->mm_count); | 222 | atomic_inc(&mm->mm_count); |
223 | 223 | ||
@@ -233,12 +233,12 @@ static int do_mmu_notifier_register(struct mmu_notifier *mn, | |||
233 | hlist_add_head(&mn->hlist, &mm->mmu_notifier_mm->list); | 233 | hlist_add_head(&mn->hlist, &mm->mmu_notifier_mm->list); |
234 | spin_unlock(&mm->mmu_notifier_mm->lock); | 234 | spin_unlock(&mm->mmu_notifier_mm->lock); |
235 | 235 | ||
236 | out_of_mem: | ||
237 | mm_drop_all_locks(mm); | 236 | mm_drop_all_locks(mm); |
238 | out: | 237 | out_clean: |
239 | if (take_mmap_sem) | 238 | if (take_mmap_sem) |
240 | up_write(&mm->mmap_sem); | 239 | up_write(&mm->mmap_sem); |
241 | 240 | kfree(mmu_notifier_mm); | |
241 | out: | ||
242 | BUG_ON(atomic_read(&mm->mm_users) <= 0); | 242 | BUG_ON(atomic_read(&mm->mm_users) <= 0); |
243 | return ret; | 243 | return ret; |
244 | } | 244 | } |
diff --git a/mm/page_alloc.c b/mm/page_alloc.c index bb90971182bd..5b74de6702e0 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c | |||
@@ -1809,10 +1809,10 @@ static void __paginginit init_zone_allows_reclaim(int nid) | |||
1809 | int i; | 1809 | int i; |
1810 | 1810 | ||
1811 | for_each_online_node(i) | 1811 | for_each_online_node(i) |
1812 | if (node_distance(nid, i) <= RECLAIM_DISTANCE) { | 1812 | if (node_distance(nid, i) <= RECLAIM_DISTANCE) |
1813 | node_set(i, NODE_DATA(nid)->reclaim_nodes); | 1813 | node_set(i, NODE_DATA(nid)->reclaim_nodes); |
1814 | else | ||
1814 | zone_reclaim_mode = 1; | 1815 | zone_reclaim_mode = 1; |
1815 | } | ||
1816 | } | 1816 | } |
1817 | 1817 | ||
1818 | #else /* CONFIG_NUMA */ | 1818 | #else /* CONFIG_NUMA */ |
@@ -5825,7 +5825,7 @@ int alloc_contig_range(unsigned long start, unsigned long end, | |||
5825 | ret = start_isolate_page_range(pfn_max_align_down(start), | 5825 | ret = start_isolate_page_range(pfn_max_align_down(start), |
5826 | pfn_max_align_up(end), migratetype); | 5826 | pfn_max_align_up(end), migratetype); |
5827 | if (ret) | 5827 | if (ret) |
5828 | goto done; | 5828 | return ret; |
5829 | 5829 | ||
5830 | ret = __alloc_contig_migrate_range(&cc, start, end); | 5830 | ret = __alloc_contig_migrate_range(&cc, start, end); |
5831 | if (ret) | 5831 | if (ret) |
@@ -56,6 +56,7 @@ | |||
56 | #include <linux/mmu_notifier.h> | 56 | #include <linux/mmu_notifier.h> |
57 | #include <linux/migrate.h> | 57 | #include <linux/migrate.h> |
58 | #include <linux/hugetlb.h> | 58 | #include <linux/hugetlb.h> |
59 | #include <linux/backing-dev.h> | ||
59 | 60 | ||
60 | #include <asm/tlbflush.h> | 61 | #include <asm/tlbflush.h> |
61 | 62 | ||
@@ -926,11 +927,8 @@ int page_mkclean(struct page *page) | |||
926 | 927 | ||
927 | if (page_mapped(page)) { | 928 | if (page_mapped(page)) { |
928 | struct address_space *mapping = page_mapping(page); | 929 | struct address_space *mapping = page_mapping(page); |
929 | if (mapping) { | 930 | if (mapping) |
930 | ret = page_mkclean_file(mapping, page); | 931 | ret = page_mkclean_file(mapping, page); |
931 | if (page_test_and_clear_dirty(page_to_pfn(page), 1)) | ||
932 | ret = 1; | ||
933 | } | ||
934 | } | 932 | } |
935 | 933 | ||
936 | return ret; | 934 | return ret; |
@@ -1116,6 +1114,7 @@ void page_add_file_rmap(struct page *page) | |||
1116 | */ | 1114 | */ |
1117 | void page_remove_rmap(struct page *page) | 1115 | void page_remove_rmap(struct page *page) |
1118 | { | 1116 | { |
1117 | struct address_space *mapping = page_mapping(page); | ||
1119 | bool anon = PageAnon(page); | 1118 | bool anon = PageAnon(page); |
1120 | bool locked; | 1119 | bool locked; |
1121 | unsigned long flags; | 1120 | unsigned long flags; |
@@ -1138,8 +1137,19 @@ void page_remove_rmap(struct page *page) | |||
1138 | * this if the page is anon, so about to be freed; but perhaps | 1137 | * this if the page is anon, so about to be freed; but perhaps |
1139 | * not if it's in swapcache - there might be another pte slot | 1138 | * not if it's in swapcache - there might be another pte slot |
1140 | * containing the swap entry, but page not yet written to swap. | 1139 | * containing the swap entry, but page not yet written to swap. |
1140 | * | ||
1141 | * And we can skip it on file pages, so long as the filesystem | ||
1142 | * participates in dirty tracking; but need to catch shm and tmpfs | ||
1143 | * and ramfs pages which have been modified since creation by read | ||
1144 | * fault. | ||
1145 | * | ||
1146 | * Note that mapping must be decided above, before decrementing | ||
1147 | * mapcount (which luckily provides a barrier): once page is unmapped, | ||
1148 | * it could be truncated and page->mapping reset to NULL at any moment. | ||
1149 | * Note also that we are relying on page_mapping(page) to set mapping | ||
1150 | * to &swapper_space when PageSwapCache(page). | ||
1141 | */ | 1151 | */ |
1142 | if ((!anon || PageSwapCache(page)) && | 1152 | if (mapping && !mapping_cap_account_dirty(mapping) && |
1143 | page_test_and_clear_dirty(page_to_pfn(page), 1)) | 1153 | page_test_and_clear_dirty(page_to_pfn(page), 1)) |
1144 | set_page_dirty(page); | 1154 | set_page_dirty(page); |
1145 | /* | 1155 | /* |
diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c index 9096bcb08132..ee070722a3a3 100644 --- a/net/8021q/vlan.c +++ b/net/8021q/vlan.c | |||
@@ -463,7 +463,9 @@ static int vlan_device_event(struct notifier_block *unused, unsigned long event, | |||
463 | 463 | ||
464 | case NETDEV_PRE_TYPE_CHANGE: | 464 | case NETDEV_PRE_TYPE_CHANGE: |
465 | /* Forbid underlaying device to change its type. */ | 465 | /* Forbid underlaying device to change its type. */ |
466 | return NOTIFY_BAD; | 466 | if (vlan_uses_dev(dev)) |
467 | return NOTIFY_BAD; | ||
468 | break; | ||
467 | 469 | ||
468 | case NETDEV_NOTIFY_PEERS: | 470 | case NETDEV_NOTIFY_PEERS: |
469 | case NETDEV_BONDING_FAILOVER: | 471 | case NETDEV_BONDING_FAILOVER: |
diff --git a/net/batman-adv/bridge_loop_avoidance.c b/net/batman-adv/bridge_loop_avoidance.c index 0a9084ad19a6..fd8d5afec0dd 100644 --- a/net/batman-adv/bridge_loop_avoidance.c +++ b/net/batman-adv/bridge_loop_avoidance.c | |||
@@ -1167,6 +1167,8 @@ int batadv_bla_init(struct batadv_priv *bat_priv) | |||
1167 | uint16_t crc; | 1167 | uint16_t crc; |
1168 | unsigned long entrytime; | 1168 | unsigned long entrytime; |
1169 | 1169 | ||
1170 | spin_lock_init(&bat_priv->bla.bcast_duplist_lock); | ||
1171 | |||
1170 | batadv_dbg(BATADV_DBG_BLA, bat_priv, "bla hash registering\n"); | 1172 | batadv_dbg(BATADV_DBG_BLA, bat_priv, "bla hash registering\n"); |
1171 | 1173 | ||
1172 | /* setting claim destination address */ | 1174 | /* setting claim destination address */ |
@@ -1210,8 +1212,8 @@ int batadv_bla_init(struct batadv_priv *bat_priv) | |||
1210 | /** | 1212 | /** |
1211 | * batadv_bla_check_bcast_duplist | 1213 | * batadv_bla_check_bcast_duplist |
1212 | * @bat_priv: the bat priv with all the soft interface information | 1214 | * @bat_priv: the bat priv with all the soft interface information |
1213 | * @bcast_packet: originator mac address | 1215 | * @bcast_packet: encapsulated broadcast frame plus batman header |
1214 | * @hdr_size: maximum length of the frame | 1216 | * @bcast_packet_len: length of encapsulated broadcast frame plus batman header |
1215 | * | 1217 | * |
1216 | * check if it is on our broadcast list. Another gateway might | 1218 | * check if it is on our broadcast list. Another gateway might |
1217 | * have sent the same packet because it is connected to the same backbone, | 1219 | * have sent the same packet because it is connected to the same backbone, |
@@ -1224,20 +1226,22 @@ int batadv_bla_init(struct batadv_priv *bat_priv) | |||
1224 | */ | 1226 | */ |
1225 | int batadv_bla_check_bcast_duplist(struct batadv_priv *bat_priv, | 1227 | int batadv_bla_check_bcast_duplist(struct batadv_priv *bat_priv, |
1226 | struct batadv_bcast_packet *bcast_packet, | 1228 | struct batadv_bcast_packet *bcast_packet, |
1227 | int hdr_size) | 1229 | int bcast_packet_len) |
1228 | { | 1230 | { |
1229 | int i, length, curr; | 1231 | int i, length, curr, ret = 0; |
1230 | uint8_t *content; | 1232 | uint8_t *content; |
1231 | uint16_t crc; | 1233 | uint16_t crc; |
1232 | struct batadv_bcast_duplist_entry *entry; | 1234 | struct batadv_bcast_duplist_entry *entry; |
1233 | 1235 | ||
1234 | length = hdr_size - sizeof(*bcast_packet); | 1236 | length = bcast_packet_len - sizeof(*bcast_packet); |
1235 | content = (uint8_t *)bcast_packet; | 1237 | content = (uint8_t *)bcast_packet; |
1236 | content += sizeof(*bcast_packet); | 1238 | content += sizeof(*bcast_packet); |
1237 | 1239 | ||
1238 | /* calculate the crc ... */ | 1240 | /* calculate the crc ... */ |
1239 | crc = crc16(0, content, length); | 1241 | crc = crc16(0, content, length); |
1240 | 1242 | ||
1243 | spin_lock_bh(&bat_priv->bla.bcast_duplist_lock); | ||
1244 | |||
1241 | for (i = 0; i < BATADV_DUPLIST_SIZE; i++) { | 1245 | for (i = 0; i < BATADV_DUPLIST_SIZE; i++) { |
1242 | curr = (bat_priv->bla.bcast_duplist_curr + i); | 1246 | curr = (bat_priv->bla.bcast_duplist_curr + i); |
1243 | curr %= BATADV_DUPLIST_SIZE; | 1247 | curr %= BATADV_DUPLIST_SIZE; |
@@ -1259,9 +1263,12 @@ int batadv_bla_check_bcast_duplist(struct batadv_priv *bat_priv, | |||
1259 | /* this entry seems to match: same crc, not too old, | 1263 | /* this entry seems to match: same crc, not too old, |
1260 | * and from another gw. therefore return 1 to forbid it. | 1264 | * and from another gw. therefore return 1 to forbid it. |
1261 | */ | 1265 | */ |
1262 | return 1; | 1266 | ret = 1; |
1267 | goto out; | ||
1263 | } | 1268 | } |
1264 | /* not found, add a new entry (overwrite the oldest entry) */ | 1269 | /* not found, add a new entry (overwrite the oldest entry) |
1270 | * and allow it, its the first occurence. | ||
1271 | */ | ||
1265 | curr = (bat_priv->bla.bcast_duplist_curr + BATADV_DUPLIST_SIZE - 1); | 1272 | curr = (bat_priv->bla.bcast_duplist_curr + BATADV_DUPLIST_SIZE - 1); |
1266 | curr %= BATADV_DUPLIST_SIZE; | 1273 | curr %= BATADV_DUPLIST_SIZE; |
1267 | entry = &bat_priv->bla.bcast_duplist[curr]; | 1274 | entry = &bat_priv->bla.bcast_duplist[curr]; |
@@ -1270,8 +1277,10 @@ int batadv_bla_check_bcast_duplist(struct batadv_priv *bat_priv, | |||
1270 | memcpy(entry->orig, bcast_packet->orig, ETH_ALEN); | 1277 | memcpy(entry->orig, bcast_packet->orig, ETH_ALEN); |
1271 | bat_priv->bla.bcast_duplist_curr = curr; | 1278 | bat_priv->bla.bcast_duplist_curr = curr; |
1272 | 1279 | ||
1273 | /* allow it, its the first occurence. */ | 1280 | out: |
1274 | return 0; | 1281 | spin_unlock_bh(&bat_priv->bla.bcast_duplist_lock); |
1282 | |||
1283 | return ret; | ||
1275 | } | 1284 | } |
1276 | 1285 | ||
1277 | 1286 | ||
diff --git a/net/batman-adv/routing.c b/net/batman-adv/routing.c index 939fc01371df..376b4cc6ca82 100644 --- a/net/batman-adv/routing.c +++ b/net/batman-adv/routing.c | |||
@@ -1124,8 +1124,14 @@ int batadv_recv_bcast_packet(struct sk_buff *skb, | |||
1124 | 1124 | ||
1125 | spin_unlock_bh(&orig_node->bcast_seqno_lock); | 1125 | spin_unlock_bh(&orig_node->bcast_seqno_lock); |
1126 | 1126 | ||
1127 | /* keep skb linear for crc calculation */ | ||
1128 | if (skb_linearize(skb) < 0) | ||
1129 | goto out; | ||
1130 | |||
1131 | bcast_packet = (struct batadv_bcast_packet *)skb->data; | ||
1132 | |||
1127 | /* check whether this has been sent by another originator before */ | 1133 | /* check whether this has been sent by another originator before */ |
1128 | if (batadv_bla_check_bcast_duplist(bat_priv, bcast_packet, hdr_size)) | 1134 | if (batadv_bla_check_bcast_duplist(bat_priv, bcast_packet, skb->len)) |
1129 | goto out; | 1135 | goto out; |
1130 | 1136 | ||
1131 | /* rebroadcast packet */ | 1137 | /* rebroadcast packet */ |
diff --git a/net/batman-adv/types.h b/net/batman-adv/types.h index 2ed82caacdca..ac1e07a80454 100644 --- a/net/batman-adv/types.h +++ b/net/batman-adv/types.h | |||
@@ -205,6 +205,8 @@ struct batadv_priv_bla { | |||
205 | struct batadv_hashtable *backbone_hash; | 205 | struct batadv_hashtable *backbone_hash; |
206 | struct batadv_bcast_duplist_entry bcast_duplist[BATADV_DUPLIST_SIZE]; | 206 | struct batadv_bcast_duplist_entry bcast_duplist[BATADV_DUPLIST_SIZE]; |
207 | int bcast_duplist_curr; | 207 | int bcast_duplist_curr; |
208 | /* protects bcast_duplist and bcast_duplist_curr */ | ||
209 | spinlock_t bcast_duplist_lock; | ||
208 | struct batadv_bla_claim_dst claim_dest; | 210 | struct batadv_bla_claim_dst claim_dest; |
209 | struct delayed_work work; | 211 | struct delayed_work work; |
210 | }; | 212 | }; |
diff --git a/net/bluetooth/smp.c b/net/bluetooth/smp.c index 8c225ef349cd..2ac8d50861e0 100644 --- a/net/bluetooth/smp.c +++ b/net/bluetooth/smp.c | |||
@@ -32,6 +32,8 @@ | |||
32 | 32 | ||
33 | #define SMP_TIMEOUT msecs_to_jiffies(30000) | 33 | #define SMP_TIMEOUT msecs_to_jiffies(30000) |
34 | 34 | ||
35 | #define AUTH_REQ_MASK 0x07 | ||
36 | |||
35 | static inline void swap128(u8 src[16], u8 dst[16]) | 37 | static inline void swap128(u8 src[16], u8 dst[16]) |
36 | { | 38 | { |
37 | int i; | 39 | int i; |
@@ -230,7 +232,7 @@ static void build_pairing_cmd(struct l2cap_conn *conn, | |||
230 | req->max_key_size = SMP_MAX_ENC_KEY_SIZE; | 232 | req->max_key_size = SMP_MAX_ENC_KEY_SIZE; |
231 | req->init_key_dist = 0; | 233 | req->init_key_dist = 0; |
232 | req->resp_key_dist = dist_keys; | 234 | req->resp_key_dist = dist_keys; |
233 | req->auth_req = authreq; | 235 | req->auth_req = (authreq & AUTH_REQ_MASK); |
234 | return; | 236 | return; |
235 | } | 237 | } |
236 | 238 | ||
@@ -239,7 +241,7 @@ static void build_pairing_cmd(struct l2cap_conn *conn, | |||
239 | rsp->max_key_size = SMP_MAX_ENC_KEY_SIZE; | 241 | rsp->max_key_size = SMP_MAX_ENC_KEY_SIZE; |
240 | rsp->init_key_dist = 0; | 242 | rsp->init_key_dist = 0; |
241 | rsp->resp_key_dist = req->resp_key_dist & dist_keys; | 243 | rsp->resp_key_dist = req->resp_key_dist & dist_keys; |
242 | rsp->auth_req = authreq; | 244 | rsp->auth_req = (authreq & AUTH_REQ_MASK); |
243 | } | 245 | } |
244 | 246 | ||
245 | static u8 check_enc_key_size(struct l2cap_conn *conn, __u8 max_key_size) | 247 | static u8 check_enc_key_size(struct l2cap_conn *conn, __u8 max_key_size) |
diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c index 159aa8bef9e7..3ef1759403b4 100644 --- a/net/ceph/messenger.c +++ b/net/ceph/messenger.c | |||
@@ -2300,10 +2300,11 @@ restart: | |||
2300 | mutex_unlock(&con->mutex); | 2300 | mutex_unlock(&con->mutex); |
2301 | return; | 2301 | return; |
2302 | } else { | 2302 | } else { |
2303 | con->ops->put(con); | ||
2304 | dout("con_work %p FAILED to back off %lu\n", con, | 2303 | dout("con_work %p FAILED to back off %lu\n", con, |
2305 | con->delay); | 2304 | con->delay); |
2305 | set_bit(CON_FLAG_BACKOFF, &con->flags); | ||
2306 | } | 2306 | } |
2307 | goto done; | ||
2307 | } | 2308 | } |
2308 | 2309 | ||
2309 | if (con->state == CON_STATE_STANDBY) { | 2310 | if (con->state == CON_STATE_STANDBY) { |
@@ -2749,7 +2750,8 @@ static int ceph_con_in_msg_alloc(struct ceph_connection *con, int *skip) | |||
2749 | msg = con->ops->alloc_msg(con, hdr, skip); | 2750 | msg = con->ops->alloc_msg(con, hdr, skip); |
2750 | mutex_lock(&con->mutex); | 2751 | mutex_lock(&con->mutex); |
2751 | if (con->state != CON_STATE_OPEN) { | 2752 | if (con->state != CON_STATE_OPEN) { |
2752 | ceph_msg_put(msg); | 2753 | if (msg) |
2754 | ceph_msg_put(msg); | ||
2753 | return -EAGAIN; | 2755 | return -EAGAIN; |
2754 | } | 2756 | } |
2755 | con->in_msg = msg; | 2757 | con->in_msg = msg; |
diff --git a/net/core/skbuff.c b/net/core/skbuff.c index 6e04b1fa11f2..4007c1437fda 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c | |||
@@ -3379,10 +3379,12 @@ EXPORT_SYMBOL(__skb_warn_lro_forwarding); | |||
3379 | 3379 | ||
3380 | void kfree_skb_partial(struct sk_buff *skb, bool head_stolen) | 3380 | void kfree_skb_partial(struct sk_buff *skb, bool head_stolen) |
3381 | { | 3381 | { |
3382 | if (head_stolen) | 3382 | if (head_stolen) { |
3383 | skb_release_head_state(skb); | ||
3383 | kmem_cache_free(skbuff_head_cache, skb); | 3384 | kmem_cache_free(skbuff_head_cache, skb); |
3384 | else | 3385 | } else { |
3385 | __kfree_skb(skb); | 3386 | __kfree_skb(skb); |
3387 | } | ||
3386 | } | 3388 | } |
3387 | EXPORT_SYMBOL(kfree_skb_partial); | 3389 | EXPORT_SYMBOL(kfree_skb_partial); |
3388 | 3390 | ||
diff --git a/net/ipv4/netfilter/iptable_nat.c b/net/ipv4/netfilter/iptable_nat.c index 9e0ffaf1d942..a82047282dbb 100644 --- a/net/ipv4/netfilter/iptable_nat.c +++ b/net/ipv4/netfilter/iptable_nat.c | |||
@@ -184,7 +184,8 @@ nf_nat_ipv4_out(unsigned int hooknum, | |||
184 | 184 | ||
185 | if ((ct->tuplehash[dir].tuple.src.u3.ip != | 185 | if ((ct->tuplehash[dir].tuple.src.u3.ip != |
186 | ct->tuplehash[!dir].tuple.dst.u3.ip) || | 186 | ct->tuplehash[!dir].tuple.dst.u3.ip) || |
187 | (ct->tuplehash[dir].tuple.src.u.all != | 187 | (ct->tuplehash[dir].tuple.dst.protonum != IPPROTO_ICMP && |
188 | ct->tuplehash[dir].tuple.src.u.all != | ||
188 | ct->tuplehash[!dir].tuple.dst.u.all)) | 189 | ct->tuplehash[!dir].tuple.dst.u.all)) |
189 | if (nf_xfrm_me_harder(skb, AF_INET) < 0) | 190 | if (nf_xfrm_me_harder(skb, AF_INET) < 0) |
190 | ret = NF_DROP; | 191 | ret = NF_DROP; |
@@ -221,6 +222,7 @@ nf_nat_ipv4_local_fn(unsigned int hooknum, | |||
221 | } | 222 | } |
222 | #ifdef CONFIG_XFRM | 223 | #ifdef CONFIG_XFRM |
223 | else if (!(IPCB(skb)->flags & IPSKB_XFRM_TRANSFORMED) && | 224 | else if (!(IPCB(skb)->flags & IPSKB_XFRM_TRANSFORMED) && |
225 | ct->tuplehash[dir].tuple.dst.protonum != IPPROTO_ICMP && | ||
224 | ct->tuplehash[dir].tuple.dst.u.all != | 226 | ct->tuplehash[dir].tuple.dst.u.all != |
225 | ct->tuplehash[!dir].tuple.src.u.all) | 227 | ct->tuplehash[!dir].tuple.src.u.all) |
226 | if (nf_xfrm_me_harder(skb, AF_INET) < 0) | 228 | if (nf_xfrm_me_harder(skb, AF_INET) < 0) |
diff --git a/net/ipv4/route.c b/net/ipv4/route.c index 432f4bb77238..a8c651216fa6 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c | |||
@@ -1163,8 +1163,12 @@ static bool rt_bind_exception(struct rtable *rt, struct fib_nh_exception *fnhe, | |||
1163 | spin_lock_bh(&fnhe_lock); | 1163 | spin_lock_bh(&fnhe_lock); |
1164 | 1164 | ||
1165 | if (daddr == fnhe->fnhe_daddr) { | 1165 | if (daddr == fnhe->fnhe_daddr) { |
1166 | struct rtable *orig; | 1166 | struct rtable *orig = rcu_dereference(fnhe->fnhe_rth); |
1167 | 1167 | if (orig && rt_is_expired(orig)) { | |
1168 | fnhe->fnhe_gw = 0; | ||
1169 | fnhe->fnhe_pmtu = 0; | ||
1170 | fnhe->fnhe_expires = 0; | ||
1171 | } | ||
1168 | if (fnhe->fnhe_pmtu) { | 1172 | if (fnhe->fnhe_pmtu) { |
1169 | unsigned long expires = fnhe->fnhe_expires; | 1173 | unsigned long expires = fnhe->fnhe_expires; |
1170 | unsigned long diff = expires - jiffies; | 1174 | unsigned long diff = expires - jiffies; |
@@ -1181,7 +1185,6 @@ static bool rt_bind_exception(struct rtable *rt, struct fib_nh_exception *fnhe, | |||
1181 | } else if (!rt->rt_gateway) | 1185 | } else if (!rt->rt_gateway) |
1182 | rt->rt_gateway = daddr; | 1186 | rt->rt_gateway = daddr; |
1183 | 1187 | ||
1184 | orig = rcu_dereference(fnhe->fnhe_rth); | ||
1185 | rcu_assign_pointer(fnhe->fnhe_rth, rt); | 1188 | rcu_assign_pointer(fnhe->fnhe_rth, rt); |
1186 | if (orig) | 1189 | if (orig) |
1187 | rt_free(orig); | 1190 | rt_free(orig); |
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index f32c02e2a543..197c0008503c 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c | |||
@@ -549,14 +549,12 @@ int tcp_ioctl(struct sock *sk, int cmd, unsigned long arg) | |||
549 | !tp->urg_data || | 549 | !tp->urg_data || |
550 | before(tp->urg_seq, tp->copied_seq) || | 550 | before(tp->urg_seq, tp->copied_seq) || |
551 | !before(tp->urg_seq, tp->rcv_nxt)) { | 551 | !before(tp->urg_seq, tp->rcv_nxt)) { |
552 | struct sk_buff *skb; | ||
553 | 552 | ||
554 | answ = tp->rcv_nxt - tp->copied_seq; | 553 | answ = tp->rcv_nxt - tp->copied_seq; |
555 | 554 | ||
556 | /* Subtract 1, if FIN is in queue. */ | 555 | /* Subtract 1, if FIN was received */ |
557 | skb = skb_peek_tail(&sk->sk_receive_queue); | 556 | if (answ && sock_flag(sk, SOCK_DONE)) |
558 | if (answ && skb) | 557 | answ--; |
559 | answ -= tcp_hdr(skb)->fin; | ||
560 | } else | 558 | } else |
561 | answ = tp->urg_seq - tp->copied_seq; | 559 | answ = tp->urg_seq - tp->copied_seq; |
562 | release_sock(sk); | 560 | release_sock(sk); |
@@ -2766,6 +2764,8 @@ void tcp_get_info(const struct sock *sk, struct tcp_info *info) | |||
2766 | info->tcpi_options |= TCPI_OPT_ECN; | 2764 | info->tcpi_options |= TCPI_OPT_ECN; |
2767 | if (tp->ecn_flags & TCP_ECN_SEEN) | 2765 | if (tp->ecn_flags & TCP_ECN_SEEN) |
2768 | info->tcpi_options |= TCPI_OPT_ECN_SEEN; | 2766 | info->tcpi_options |= TCPI_OPT_ECN_SEEN; |
2767 | if (tp->syn_data_acked) | ||
2768 | info->tcpi_options |= TCPI_OPT_SYN_DATA; | ||
2769 | 2769 | ||
2770 | info->tcpi_rto = jiffies_to_usecs(icsk->icsk_rto); | 2770 | info->tcpi_rto = jiffies_to_usecs(icsk->icsk_rto); |
2771 | info->tcpi_ato = jiffies_to_usecs(icsk->icsk_ack.ato); | 2771 | info->tcpi_ato = jiffies_to_usecs(icsk->icsk_ack.ato); |
diff --git a/net/ipv4/tcp_illinois.c b/net/ipv4/tcp_illinois.c index 813b43a76fec..834857f3c871 100644 --- a/net/ipv4/tcp_illinois.c +++ b/net/ipv4/tcp_illinois.c | |||
@@ -313,11 +313,13 @@ static void tcp_illinois_info(struct sock *sk, u32 ext, | |||
313 | .tcpv_rttcnt = ca->cnt_rtt, | 313 | .tcpv_rttcnt = ca->cnt_rtt, |
314 | .tcpv_minrtt = ca->base_rtt, | 314 | .tcpv_minrtt = ca->base_rtt, |
315 | }; | 315 | }; |
316 | u64 t = ca->sum_rtt; | ||
317 | 316 | ||
318 | do_div(t, ca->cnt_rtt); | 317 | if (info.tcpv_rttcnt > 0) { |
319 | info.tcpv_rtt = t; | 318 | u64 t = ca->sum_rtt; |
320 | 319 | ||
320 | do_div(t, info.tcpv_rttcnt); | ||
321 | info.tcpv_rtt = t; | ||
322 | } | ||
321 | nla_put(skb, INET_DIAG_VEGASINFO, sizeof(info), &info); | 323 | nla_put(skb, INET_DIAG_VEGASINFO, sizeof(info), &info); |
322 | } | 324 | } |
323 | } | 325 | } |
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index 432c36649db3..2c2b13a999ea 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c | |||
@@ -4529,6 +4529,9 @@ int tcp_send_rcvq(struct sock *sk, struct msghdr *msg, size_t size) | |||
4529 | struct tcphdr *th; | 4529 | struct tcphdr *th; |
4530 | bool fragstolen; | 4530 | bool fragstolen; |
4531 | 4531 | ||
4532 | if (size == 0) | ||
4533 | return 0; | ||
4534 | |||
4532 | skb = alloc_skb(size + sizeof(*th), sk->sk_allocation); | 4535 | skb = alloc_skb(size + sizeof(*th), sk->sk_allocation); |
4533 | if (!skb) | 4536 | if (!skb) |
4534 | goto err; | 4537 | goto err; |
@@ -5646,6 +5649,7 @@ static bool tcp_rcv_fastopen_synack(struct sock *sk, struct sk_buff *synack, | |||
5646 | tcp_rearm_rto(sk); | 5649 | tcp_rearm_rto(sk); |
5647 | return true; | 5650 | return true; |
5648 | } | 5651 | } |
5652 | tp->syn_data_acked = tp->syn_data; | ||
5649 | return false; | 5653 | return false; |
5650 | } | 5654 | } |
5651 | 5655 | ||
@@ -5963,7 +5967,7 @@ int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb, | |||
5963 | 5967 | ||
5964 | req = tp->fastopen_rsk; | 5968 | req = tp->fastopen_rsk; |
5965 | if (req != NULL) { | 5969 | if (req != NULL) { |
5966 | BUG_ON(sk->sk_state != TCP_SYN_RECV && | 5970 | WARN_ON_ONCE(sk->sk_state != TCP_SYN_RECV && |
5967 | sk->sk_state != TCP_FIN_WAIT1); | 5971 | sk->sk_state != TCP_FIN_WAIT1); |
5968 | 5972 | ||
5969 | if (tcp_check_req(sk, skb, req, NULL, true) == NULL) | 5973 | if (tcp_check_req(sk, skb, req, NULL, true) == NULL) |
@@ -6052,7 +6056,15 @@ int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb, | |||
6052 | * ACK we have received, this would have acknowledged | 6056 | * ACK we have received, this would have acknowledged |
6053 | * our SYNACK so stop the SYNACK timer. | 6057 | * our SYNACK so stop the SYNACK timer. |
6054 | */ | 6058 | */ |
6055 | if (acceptable && req != NULL) { | 6059 | if (req != NULL) { |
6060 | /* Return RST if ack_seq is invalid. | ||
6061 | * Note that RFC793 only says to generate a | ||
6062 | * DUPACK for it but for TCP Fast Open it seems | ||
6063 | * better to treat this case like TCP_SYN_RECV | ||
6064 | * above. | ||
6065 | */ | ||
6066 | if (!acceptable) | ||
6067 | return 1; | ||
6056 | /* We no longer need the request sock. */ | 6068 | /* We no longer need the request sock. */ |
6057 | reqsk_fastopen_remove(sk, req, false); | 6069 | reqsk_fastopen_remove(sk, req, false); |
6058 | tcp_rearm_rto(sk); | 6070 | tcp_rearm_rto(sk); |
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index ef998b008a57..0c4a64355603 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c | |||
@@ -1461,6 +1461,7 @@ static int tcp_v4_conn_req_fastopen(struct sock *sk, | |||
1461 | skb_set_owner_r(skb, child); | 1461 | skb_set_owner_r(skb, child); |
1462 | __skb_queue_tail(&child->sk_receive_queue, skb); | 1462 | __skb_queue_tail(&child->sk_receive_queue, skb); |
1463 | tp->rcv_nxt = TCP_SKB_CB(skb)->end_seq; | 1463 | tp->rcv_nxt = TCP_SKB_CB(skb)->end_seq; |
1464 | tp->syn_data_acked = 1; | ||
1464 | } | 1465 | } |
1465 | sk->sk_data_ready(sk, 0); | 1466 | sk->sk_data_ready(sk, 0); |
1466 | bh_unlock_sock(child); | 1467 | bh_unlock_sock(child); |
diff --git a/net/ipv4/tcp_metrics.c b/net/ipv4/tcp_metrics.c index 4c752a6e0bcd..53bc5847bfa8 100644 --- a/net/ipv4/tcp_metrics.c +++ b/net/ipv4/tcp_metrics.c | |||
@@ -864,7 +864,7 @@ static int parse_nl_addr(struct genl_info *info, struct inetpeer_addr *addr, | |||
864 | } | 864 | } |
865 | a = info->attrs[TCP_METRICS_ATTR_ADDR_IPV6]; | 865 | a = info->attrs[TCP_METRICS_ATTR_ADDR_IPV6]; |
866 | if (a) { | 866 | if (a) { |
867 | if (nla_len(a) != sizeof(sizeof(struct in6_addr))) | 867 | if (nla_len(a) != sizeof(struct in6_addr)) |
868 | return -EINVAL; | 868 | return -EINVAL; |
869 | addr->family = AF_INET6; | 869 | addr->family = AF_INET6; |
870 | memcpy(addr->addr.a6, nla_data(a), sizeof(addr->addr.a6)); | 870 | memcpy(addr->addr.a6, nla_data(a), sizeof(addr->addr.a6)); |
diff --git a/net/ipv4/tcp_minisocks.c b/net/ipv4/tcp_minisocks.c index 27536ba16c9d..a7302d974f32 100644 --- a/net/ipv4/tcp_minisocks.c +++ b/net/ipv4/tcp_minisocks.c | |||
@@ -510,6 +510,7 @@ struct sock *tcp_create_openreq_child(struct sock *sk, struct request_sock *req, | |||
510 | newtp->rx_opt.mss_clamp = req->mss; | 510 | newtp->rx_opt.mss_clamp = req->mss; |
511 | TCP_ECN_openreq_child(newtp, req); | 511 | TCP_ECN_openreq_child(newtp, req); |
512 | newtp->fastopen_rsk = NULL; | 512 | newtp->fastopen_rsk = NULL; |
513 | newtp->syn_data_acked = 0; | ||
513 | 514 | ||
514 | TCP_INC_STATS_BH(sock_net(sk), TCP_MIB_PASSIVEOPENS); | 515 | TCP_INC_STATS_BH(sock_net(sk), TCP_MIB_PASSIVEOPENS); |
515 | } | 516 | } |
diff --git a/net/ipv4/tcp_timer.c b/net/ipv4/tcp_timer.c index fc04711e80c8..d47c1b4421a3 100644 --- a/net/ipv4/tcp_timer.c +++ b/net/ipv4/tcp_timer.c | |||
@@ -347,8 +347,8 @@ void tcp_retransmit_timer(struct sock *sk) | |||
347 | return; | 347 | return; |
348 | } | 348 | } |
349 | if (tp->fastopen_rsk) { | 349 | if (tp->fastopen_rsk) { |
350 | BUG_ON(sk->sk_state != TCP_SYN_RECV && | 350 | WARN_ON_ONCE(sk->sk_state != TCP_SYN_RECV && |
351 | sk->sk_state != TCP_FIN_WAIT1); | 351 | sk->sk_state != TCP_FIN_WAIT1); |
352 | tcp_fastopen_synack_timer(sk); | 352 | tcp_fastopen_synack_timer(sk); |
353 | /* Before we receive ACK to our SYN-ACK don't retransmit | 353 | /* Before we receive ACK to our SYN-ACK don't retransmit |
354 | * anything else (e.g., data or FIN segments). | 354 | * anything else (e.g., data or FIN segments). |
diff --git a/net/ipv6/netfilter/ip6table_nat.c b/net/ipv6/netfilter/ip6table_nat.c index e418bd6350a4..d57dab17a182 100644 --- a/net/ipv6/netfilter/ip6table_nat.c +++ b/net/ipv6/netfilter/ip6table_nat.c | |||
@@ -186,7 +186,8 @@ nf_nat_ipv6_out(unsigned int hooknum, | |||
186 | 186 | ||
187 | if (!nf_inet_addr_cmp(&ct->tuplehash[dir].tuple.src.u3, | 187 | if (!nf_inet_addr_cmp(&ct->tuplehash[dir].tuple.src.u3, |
188 | &ct->tuplehash[!dir].tuple.dst.u3) || | 188 | &ct->tuplehash[!dir].tuple.dst.u3) || |
189 | (ct->tuplehash[dir].tuple.src.u.all != | 189 | (ct->tuplehash[dir].tuple.dst.protonum != IPPROTO_ICMPV6 && |
190 | ct->tuplehash[dir].tuple.src.u.all != | ||
190 | ct->tuplehash[!dir].tuple.dst.u.all)) | 191 | ct->tuplehash[!dir].tuple.dst.u.all)) |
191 | if (nf_xfrm_me_harder(skb, AF_INET6) < 0) | 192 | if (nf_xfrm_me_harder(skb, AF_INET6) < 0) |
192 | ret = NF_DROP; | 193 | ret = NF_DROP; |
@@ -222,6 +223,7 @@ nf_nat_ipv6_local_fn(unsigned int hooknum, | |||
222 | } | 223 | } |
223 | #ifdef CONFIG_XFRM | 224 | #ifdef CONFIG_XFRM |
224 | else if (!(IP6CB(skb)->flags & IP6SKB_XFRM_TRANSFORMED) && | 225 | else if (!(IP6CB(skb)->flags & IP6SKB_XFRM_TRANSFORMED) && |
226 | ct->tuplehash[dir].tuple.dst.protonum != IPPROTO_ICMPV6 && | ||
225 | ct->tuplehash[dir].tuple.dst.u.all != | 227 | ct->tuplehash[dir].tuple.dst.u.all != |
226 | ct->tuplehash[!dir].tuple.src.u.all) | 228 | ct->tuplehash[!dir].tuple.src.u.all) |
227 | if (nf_xfrm_me_harder(skb, AF_INET6)) | 229 | if (nf_xfrm_me_harder(skb, AF_INET6)) |
diff --git a/net/ipv6/netfilter/nf_conntrack_reasm.c b/net/ipv6/netfilter/nf_conntrack_reasm.c index 18bd9bbbd1c6..22c8ea951185 100644 --- a/net/ipv6/netfilter/nf_conntrack_reasm.c +++ b/net/ipv6/netfilter/nf_conntrack_reasm.c | |||
@@ -85,7 +85,7 @@ static struct ctl_table nf_ct_frag6_sysctl_table[] = { | |||
85 | { } | 85 | { } |
86 | }; | 86 | }; |
87 | 87 | ||
88 | static int __net_init nf_ct_frag6_sysctl_register(struct net *net) | 88 | static int nf_ct_frag6_sysctl_register(struct net *net) |
89 | { | 89 | { |
90 | struct ctl_table *table; | 90 | struct ctl_table *table; |
91 | struct ctl_table_header *hdr; | 91 | struct ctl_table_header *hdr; |
@@ -127,7 +127,7 @@ static void __net_exit nf_ct_frags6_sysctl_unregister(struct net *net) | |||
127 | } | 127 | } |
128 | 128 | ||
129 | #else | 129 | #else |
130 | static int __net_init nf_ct_frag6_sysctl_register(struct net *net) | 130 | static int nf_ct_frag6_sysctl_register(struct net *net) |
131 | { | 131 | { |
132 | return 0; | 132 | return 0; |
133 | } | 133 | } |
diff --git a/net/ipv6/route.c b/net/ipv6/route.c index 7c7e963260e1..b1e6cf0b95fd 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c | |||
@@ -219,7 +219,7 @@ static struct dst_ops ip6_dst_blackhole_ops = { | |||
219 | }; | 219 | }; |
220 | 220 | ||
221 | static const u32 ip6_template_metrics[RTAX_MAX] = { | 221 | static const u32 ip6_template_metrics[RTAX_MAX] = { |
222 | [RTAX_HOPLIMIT - 1] = 255, | 222 | [RTAX_HOPLIMIT - 1] = 0, |
223 | }; | 223 | }; |
224 | 224 | ||
225 | static const struct rt6_info ip6_null_entry_template = { | 225 | static const struct rt6_info ip6_null_entry_template = { |
@@ -1232,7 +1232,7 @@ struct dst_entry *icmp6_dst_alloc(struct net_device *dev, | |||
1232 | rt->rt6i_dst.addr = fl6->daddr; | 1232 | rt->rt6i_dst.addr = fl6->daddr; |
1233 | rt->rt6i_dst.plen = 128; | 1233 | rt->rt6i_dst.plen = 128; |
1234 | rt->rt6i_idev = idev; | 1234 | rt->rt6i_idev = idev; |
1235 | dst_metric_set(&rt->dst, RTAX_HOPLIMIT, 255); | 1235 | dst_metric_set(&rt->dst, RTAX_HOPLIMIT, 0); |
1236 | 1236 | ||
1237 | spin_lock_bh(&icmp6_dst_lock); | 1237 | spin_lock_bh(&icmp6_dst_lock); |
1238 | rt->dst.next = icmp6_dst_gc_list; | 1238 | rt->dst.next = icmp6_dst_gc_list; |
diff --git a/net/l2tp/l2tp_eth.c b/net/l2tp/l2tp_eth.c index 37b8b8ba31f7..76125c57ee6d 100644 --- a/net/l2tp/l2tp_eth.c +++ b/net/l2tp/l2tp_eth.c | |||
@@ -291,6 +291,7 @@ static int l2tp_eth_create(struct net *net, u32 tunnel_id, u32 session_id, u32 p | |||
291 | 291 | ||
292 | out_del_dev: | 292 | out_del_dev: |
293 | free_netdev(dev); | 293 | free_netdev(dev); |
294 | spriv->dev = NULL; | ||
294 | out_del_session: | 295 | out_del_session: |
295 | l2tp_session_delete(session); | 296 | l2tp_session_delete(session); |
296 | out: | 297 | out: |
diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c index 5f3620f0bc0a..bf87c70ac6c5 100644 --- a/net/mac80211/ibss.c +++ b/net/mac80211/ibss.c | |||
@@ -1108,7 +1108,7 @@ int ieee80211_ibss_join(struct ieee80211_sub_if_data *sdata, | |||
1108 | sdata->u.ibss.state = IEEE80211_IBSS_MLME_SEARCH; | 1108 | sdata->u.ibss.state = IEEE80211_IBSS_MLME_SEARCH; |
1109 | sdata->u.ibss.ibss_join_req = jiffies; | 1109 | sdata->u.ibss.ibss_join_req = jiffies; |
1110 | 1110 | ||
1111 | memcpy(sdata->u.ibss.ssid, params->ssid, IEEE80211_MAX_SSID_LEN); | 1111 | memcpy(sdata->u.ibss.ssid, params->ssid, params->ssid_len); |
1112 | sdata->u.ibss.ssid_len = params->ssid_len; | 1112 | sdata->u.ibss.ssid_len = params->ssid_len; |
1113 | 1113 | ||
1114 | mutex_unlock(&sdata->u.ibss.mtx); | 1114 | mutex_unlock(&sdata->u.ibss.mtx); |
diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c index 6f8a73c64fb3..7de7717ad67d 100644 --- a/net/mac80211/iface.c +++ b/net/mac80211/iface.c | |||
@@ -853,7 +853,7 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata, | |||
853 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); | 853 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); |
854 | if (info->control.vif == &sdata->vif) { | 854 | if (info->control.vif == &sdata->vif) { |
855 | __skb_unlink(skb, &local->pending[i]); | 855 | __skb_unlink(skb, &local->pending[i]); |
856 | dev_kfree_skb_irq(skb); | 856 | ieee80211_free_txskb(&local->hw, skb); |
857 | } | 857 | } |
858 | } | 858 | } |
859 | } | 859 | } |
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c index e714ed8bb198..1b7eed252fe9 100644 --- a/net/mac80211/mlme.c +++ b/net/mac80211/mlme.c | |||
@@ -3099,22 +3099,32 @@ static int ieee80211_prep_channel(struct ieee80211_sub_if_data *sdata, | |||
3099 | ht_cfreq, ht_oper->primary_chan, | 3099 | ht_cfreq, ht_oper->primary_chan, |
3100 | cbss->channel->band); | 3100 | cbss->channel->band); |
3101 | ht_oper = NULL; | 3101 | ht_oper = NULL; |
3102 | } else { | ||
3103 | channel_type = NL80211_CHAN_HT20; | ||
3102 | } | 3104 | } |
3103 | } | 3105 | } |
3104 | 3106 | ||
3105 | if (ht_oper) { | 3107 | if (ht_oper && sband->ht_cap.cap & IEEE80211_HT_CAP_SUP_WIDTH_20_40) { |
3106 | channel_type = NL80211_CHAN_HT20; | 3108 | /* |
3109 | * cfg80211 already verified that the channel itself can | ||
3110 | * be used, but it didn't check that we can do the right | ||
3111 | * HT type, so do that here as well. If HT40 isn't allowed | ||
3112 | * on this channel, disable 40 MHz operation. | ||
3113 | */ | ||
3107 | 3114 | ||
3108 | if (sband->ht_cap.cap & IEEE80211_HT_CAP_SUP_WIDTH_20_40) { | 3115 | switch (ht_oper->ht_param & IEEE80211_HT_PARAM_CHA_SEC_OFFSET) { |
3109 | switch (ht_oper->ht_param & | 3116 | case IEEE80211_HT_PARAM_CHA_SEC_ABOVE: |
3110 | IEEE80211_HT_PARAM_CHA_SEC_OFFSET) { | 3117 | if (cbss->channel->flags & IEEE80211_CHAN_NO_HT40PLUS) |
3111 | case IEEE80211_HT_PARAM_CHA_SEC_ABOVE: | 3118 | ifmgd->flags |= IEEE80211_STA_DISABLE_40MHZ; |
3119 | else | ||
3112 | channel_type = NL80211_CHAN_HT40PLUS; | 3120 | channel_type = NL80211_CHAN_HT40PLUS; |
3113 | break; | 3121 | break; |
3114 | case IEEE80211_HT_PARAM_CHA_SEC_BELOW: | 3122 | case IEEE80211_HT_PARAM_CHA_SEC_BELOW: |
3123 | if (cbss->channel->flags & IEEE80211_CHAN_NO_HT40MINUS) | ||
3124 | ifmgd->flags |= IEEE80211_STA_DISABLE_40MHZ; | ||
3125 | else | ||
3115 | channel_type = NL80211_CHAN_HT40MINUS; | 3126 | channel_type = NL80211_CHAN_HT40MINUS; |
3116 | break; | 3127 | break; |
3117 | } | ||
3118 | } | 3128 | } |
3119 | } | 3129 | } |
3120 | 3130 | ||
@@ -3549,6 +3559,7 @@ int ieee80211_mgd_deauth(struct ieee80211_sub_if_data *sdata, | |||
3549 | { | 3559 | { |
3550 | struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; | 3560 | struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; |
3551 | u8 frame_buf[IEEE80211_DEAUTH_FRAME_LEN]; | 3561 | u8 frame_buf[IEEE80211_DEAUTH_FRAME_LEN]; |
3562 | bool tx = !req->local_state_change; | ||
3552 | 3563 | ||
3553 | mutex_lock(&ifmgd->mtx); | 3564 | mutex_lock(&ifmgd->mtx); |
3554 | 3565 | ||
@@ -3565,12 +3576,12 @@ int ieee80211_mgd_deauth(struct ieee80211_sub_if_data *sdata, | |||
3565 | if (ifmgd->associated && | 3576 | if (ifmgd->associated && |
3566 | ether_addr_equal(ifmgd->associated->bssid, req->bssid)) { | 3577 | ether_addr_equal(ifmgd->associated->bssid, req->bssid)) { |
3567 | ieee80211_set_disassoc(sdata, IEEE80211_STYPE_DEAUTH, | 3578 | ieee80211_set_disassoc(sdata, IEEE80211_STYPE_DEAUTH, |
3568 | req->reason_code, true, frame_buf); | 3579 | req->reason_code, tx, frame_buf); |
3569 | } else { | 3580 | } else { |
3570 | drv_mgd_prepare_tx(sdata->local, sdata); | 3581 | drv_mgd_prepare_tx(sdata->local, sdata); |
3571 | ieee80211_send_deauth_disassoc(sdata, req->bssid, | 3582 | ieee80211_send_deauth_disassoc(sdata, req->bssid, |
3572 | IEEE80211_STYPE_DEAUTH, | 3583 | IEEE80211_STYPE_DEAUTH, |
3573 | req->reason_code, true, | 3584 | req->reason_code, tx, |
3574 | frame_buf); | 3585 | frame_buf); |
3575 | } | 3586 | } |
3576 | 3587 | ||
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c index 61c621e9273f..00ade7feb2e3 100644 --- a/net/mac80211/rx.c +++ b/net/mac80211/rx.c | |||
@@ -531,6 +531,11 @@ ieee80211_rx_mesh_check(struct ieee80211_rx_data *rx) | |||
531 | 531 | ||
532 | if (ieee80211_is_action(hdr->frame_control)) { | 532 | if (ieee80211_is_action(hdr->frame_control)) { |
533 | u8 category; | 533 | u8 category; |
534 | |||
535 | /* make sure category field is present */ | ||
536 | if (rx->skb->len < IEEE80211_MIN_ACTION_SIZE) | ||
537 | return RX_DROP_MONITOR; | ||
538 | |||
534 | mgmt = (struct ieee80211_mgmt *)hdr; | 539 | mgmt = (struct ieee80211_mgmt *)hdr; |
535 | category = mgmt->u.action.category; | 540 | category = mgmt->u.action.category; |
536 | if (category != WLAN_CATEGORY_MESH_ACTION && | 541 | if (category != WLAN_CATEGORY_MESH_ACTION && |
@@ -883,14 +888,16 @@ ieee80211_rx_h_check(struct ieee80211_rx_data *rx) | |||
883 | */ | 888 | */ |
884 | if (rx->sta && rx->sdata->vif.type == NL80211_IFTYPE_STATION && | 889 | if (rx->sta && rx->sdata->vif.type == NL80211_IFTYPE_STATION && |
885 | ieee80211_is_data_present(hdr->frame_control)) { | 890 | ieee80211_is_data_present(hdr->frame_control)) { |
886 | u16 ethertype; | 891 | unsigned int hdrlen; |
887 | u8 *payload; | 892 | __be16 ethertype; |
888 | 893 | ||
889 | payload = rx->skb->data + | 894 | hdrlen = ieee80211_hdrlen(hdr->frame_control); |
890 | ieee80211_hdrlen(hdr->frame_control); | 895 | |
891 | ethertype = (payload[6] << 8) | payload[7]; | 896 | if (rx->skb->len < hdrlen + 8) |
892 | if (cpu_to_be16(ethertype) == | 897 | return RX_DROP_MONITOR; |
893 | rx->sdata->control_port_protocol) | 898 | |
899 | skb_copy_bits(rx->skb, hdrlen + 6, ðertype, 2); | ||
900 | if (ethertype == rx->sdata->control_port_protocol) | ||
894 | return RX_CONTINUE; | 901 | return RX_CONTINUE; |
895 | } | 902 | } |
896 | 903 | ||
@@ -1462,11 +1469,14 @@ ieee80211_rx_h_defragment(struct ieee80211_rx_data *rx) | |||
1462 | 1469 | ||
1463 | hdr = (struct ieee80211_hdr *)rx->skb->data; | 1470 | hdr = (struct ieee80211_hdr *)rx->skb->data; |
1464 | fc = hdr->frame_control; | 1471 | fc = hdr->frame_control; |
1472 | |||
1473 | if (ieee80211_is_ctl(fc)) | ||
1474 | return RX_CONTINUE; | ||
1475 | |||
1465 | sc = le16_to_cpu(hdr->seq_ctrl); | 1476 | sc = le16_to_cpu(hdr->seq_ctrl); |
1466 | frag = sc & IEEE80211_SCTL_FRAG; | 1477 | frag = sc & IEEE80211_SCTL_FRAG; |
1467 | 1478 | ||
1468 | if (likely((!ieee80211_has_morefrags(fc) && frag == 0) || | 1479 | if (likely((!ieee80211_has_morefrags(fc) && frag == 0) || |
1469 | (rx->skb)->len < 24 || | ||
1470 | is_multicast_ether_addr(hdr->addr1))) { | 1480 | is_multicast_ether_addr(hdr->addr1))) { |
1471 | /* not fragmented */ | 1481 | /* not fragmented */ |
1472 | goto out; | 1482 | goto out; |
@@ -1889,6 +1899,20 @@ ieee80211_rx_h_mesh_fwding(struct ieee80211_rx_data *rx) | |||
1889 | 1899 | ||
1890 | hdr = (struct ieee80211_hdr *) skb->data; | 1900 | hdr = (struct ieee80211_hdr *) skb->data; |
1891 | hdrlen = ieee80211_hdrlen(hdr->frame_control); | 1901 | hdrlen = ieee80211_hdrlen(hdr->frame_control); |
1902 | |||
1903 | /* make sure fixed part of mesh header is there, also checks skb len */ | ||
1904 | if (!pskb_may_pull(rx->skb, hdrlen + 6)) | ||
1905 | return RX_DROP_MONITOR; | ||
1906 | |||
1907 | mesh_hdr = (struct ieee80211s_hdr *) (skb->data + hdrlen); | ||
1908 | |||
1909 | /* make sure full mesh header is there, also checks skb len */ | ||
1910 | if (!pskb_may_pull(rx->skb, | ||
1911 | hdrlen + ieee80211_get_mesh_hdrlen(mesh_hdr))) | ||
1912 | return RX_DROP_MONITOR; | ||
1913 | |||
1914 | /* reload pointers */ | ||
1915 | hdr = (struct ieee80211_hdr *) skb->data; | ||
1892 | mesh_hdr = (struct ieee80211s_hdr *) (skb->data + hdrlen); | 1916 | mesh_hdr = (struct ieee80211s_hdr *) (skb->data + hdrlen); |
1893 | 1917 | ||
1894 | /* frame is in RMC, don't forward */ | 1918 | /* frame is in RMC, don't forward */ |
@@ -1897,7 +1921,8 @@ ieee80211_rx_h_mesh_fwding(struct ieee80211_rx_data *rx) | |||
1897 | mesh_rmc_check(hdr->addr3, mesh_hdr, rx->sdata)) | 1921 | mesh_rmc_check(hdr->addr3, mesh_hdr, rx->sdata)) |
1898 | return RX_DROP_MONITOR; | 1922 | return RX_DROP_MONITOR; |
1899 | 1923 | ||
1900 | if (!ieee80211_is_data(hdr->frame_control)) | 1924 | if (!ieee80211_is_data(hdr->frame_control) || |
1925 | !(status->rx_flags & IEEE80211_RX_RA_MATCH)) | ||
1901 | return RX_CONTINUE; | 1926 | return RX_CONTINUE; |
1902 | 1927 | ||
1903 | if (!mesh_hdr->ttl) | 1928 | if (!mesh_hdr->ttl) |
@@ -1911,9 +1936,12 @@ ieee80211_rx_h_mesh_fwding(struct ieee80211_rx_data *rx) | |||
1911 | if (is_multicast_ether_addr(hdr->addr1)) { | 1936 | if (is_multicast_ether_addr(hdr->addr1)) { |
1912 | mpp_addr = hdr->addr3; | 1937 | mpp_addr = hdr->addr3; |
1913 | proxied_addr = mesh_hdr->eaddr1; | 1938 | proxied_addr = mesh_hdr->eaddr1; |
1914 | } else { | 1939 | } else if (mesh_hdr->flags & MESH_FLAGS_AE_A5_A6) { |
1940 | /* has_a4 already checked in ieee80211_rx_mesh_check */ | ||
1915 | mpp_addr = hdr->addr4; | 1941 | mpp_addr = hdr->addr4; |
1916 | proxied_addr = mesh_hdr->eaddr2; | 1942 | proxied_addr = mesh_hdr->eaddr2; |
1943 | } else { | ||
1944 | return RX_DROP_MONITOR; | ||
1917 | } | 1945 | } |
1918 | 1946 | ||
1919 | rcu_read_lock(); | 1947 | rcu_read_lock(); |
@@ -1941,12 +1969,9 @@ ieee80211_rx_h_mesh_fwding(struct ieee80211_rx_data *rx) | |||
1941 | } | 1969 | } |
1942 | skb_set_queue_mapping(skb, q); | 1970 | skb_set_queue_mapping(skb, q); |
1943 | 1971 | ||
1944 | if (!(status->rx_flags & IEEE80211_RX_RA_MATCH)) | ||
1945 | goto out; | ||
1946 | |||
1947 | if (!--mesh_hdr->ttl) { | 1972 | if (!--mesh_hdr->ttl) { |
1948 | IEEE80211_IFSTA_MESH_CTR_INC(ifmsh, dropped_frames_ttl); | 1973 | IEEE80211_IFSTA_MESH_CTR_INC(ifmsh, dropped_frames_ttl); |
1949 | return RX_DROP_MONITOR; | 1974 | goto out; |
1950 | } | 1975 | } |
1951 | 1976 | ||
1952 | if (!ifmsh->mshcfg.dot11MeshForwarding) | 1977 | if (!ifmsh->mshcfg.dot11MeshForwarding) |
@@ -2353,6 +2378,10 @@ ieee80211_rx_h_action(struct ieee80211_rx_data *rx) | |||
2353 | } | 2378 | } |
2354 | break; | 2379 | break; |
2355 | case WLAN_CATEGORY_SELF_PROTECTED: | 2380 | case WLAN_CATEGORY_SELF_PROTECTED: |
2381 | if (len < (IEEE80211_MIN_ACTION_SIZE + | ||
2382 | sizeof(mgmt->u.action.u.self_prot.action_code))) | ||
2383 | break; | ||
2384 | |||
2356 | switch (mgmt->u.action.u.self_prot.action_code) { | 2385 | switch (mgmt->u.action.u.self_prot.action_code) { |
2357 | case WLAN_SP_MESH_PEERING_OPEN: | 2386 | case WLAN_SP_MESH_PEERING_OPEN: |
2358 | case WLAN_SP_MESH_PEERING_CLOSE: | 2387 | case WLAN_SP_MESH_PEERING_CLOSE: |
@@ -2371,6 +2400,10 @@ ieee80211_rx_h_action(struct ieee80211_rx_data *rx) | |||
2371 | } | 2400 | } |
2372 | break; | 2401 | break; |
2373 | case WLAN_CATEGORY_MESH_ACTION: | 2402 | case WLAN_CATEGORY_MESH_ACTION: |
2403 | if (len < (IEEE80211_MIN_ACTION_SIZE + | ||
2404 | sizeof(mgmt->u.action.u.mesh_action.action_code))) | ||
2405 | break; | ||
2406 | |||
2374 | if (!ieee80211_vif_is_mesh(&sdata->vif)) | 2407 | if (!ieee80211_vif_is_mesh(&sdata->vif)) |
2375 | break; | 2408 | break; |
2376 | if (mesh_action_is_path_sel(mgmt) && | 2409 | if (mesh_action_is_path_sel(mgmt) && |
@@ -2913,10 +2946,15 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw, | |||
2913 | if (ieee80211_is_data(fc) || ieee80211_is_mgmt(fc)) | 2946 | if (ieee80211_is_data(fc) || ieee80211_is_mgmt(fc)) |
2914 | local->dot11ReceivedFragmentCount++; | 2947 | local->dot11ReceivedFragmentCount++; |
2915 | 2948 | ||
2916 | if (ieee80211_is_mgmt(fc)) | 2949 | if (ieee80211_is_mgmt(fc)) { |
2917 | err = skb_linearize(skb); | 2950 | /* drop frame if too short for header */ |
2918 | else | 2951 | if (skb->len < ieee80211_hdrlen(fc)) |
2952 | err = -ENOBUFS; | ||
2953 | else | ||
2954 | err = skb_linearize(skb); | ||
2955 | } else { | ||
2919 | err = !pskb_may_pull(skb, ieee80211_hdrlen(fc)); | 2956 | err = !pskb_may_pull(skb, ieee80211_hdrlen(fc)); |
2957 | } | ||
2920 | 2958 | ||
2921 | if (err) { | 2959 | if (err) { |
2922 | dev_kfree_skb(skb); | 2960 | dev_kfree_skb(skb); |
diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c index 797dd36a220d..0a4e4c04db89 100644 --- a/net/mac80211/sta_info.c +++ b/net/mac80211/sta_info.c | |||
@@ -650,7 +650,7 @@ static bool sta_info_cleanup_expire_buffered_ac(struct ieee80211_local *local, | |||
650 | */ | 650 | */ |
651 | if (!skb) | 651 | if (!skb) |
652 | break; | 652 | break; |
653 | dev_kfree_skb(skb); | 653 | ieee80211_free_txskb(&local->hw, skb); |
654 | } | 654 | } |
655 | 655 | ||
656 | /* | 656 | /* |
@@ -679,7 +679,7 @@ static bool sta_info_cleanup_expire_buffered_ac(struct ieee80211_local *local, | |||
679 | local->total_ps_buffered--; | 679 | local->total_ps_buffered--; |
680 | ps_dbg(sta->sdata, "Buffered frame expired (STA %pM)\n", | 680 | ps_dbg(sta->sdata, "Buffered frame expired (STA %pM)\n", |
681 | sta->sta.addr); | 681 | sta->sta.addr); |
682 | dev_kfree_skb(skb); | 682 | ieee80211_free_txskb(&local->hw, skb); |
683 | } | 683 | } |
684 | 684 | ||
685 | /* | 685 | /* |
diff --git a/net/mac80211/util.c b/net/mac80211/util.c index 22ca35054dd0..239391807ca9 100644 --- a/net/mac80211/util.c +++ b/net/mac80211/util.c | |||
@@ -406,7 +406,7 @@ void ieee80211_add_pending_skb(struct ieee80211_local *local, | |||
406 | int queue = info->hw_queue; | 406 | int queue = info->hw_queue; |
407 | 407 | ||
408 | if (WARN_ON(!info->control.vif)) { | 408 | if (WARN_ON(!info->control.vif)) { |
409 | kfree_skb(skb); | 409 | ieee80211_free_txskb(&local->hw, skb); |
410 | return; | 410 | return; |
411 | } | 411 | } |
412 | 412 | ||
@@ -431,7 +431,7 @@ void ieee80211_add_pending_skbs_fn(struct ieee80211_local *local, | |||
431 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); | 431 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); |
432 | 432 | ||
433 | if (WARN_ON(!info->control.vif)) { | 433 | if (WARN_ON(!info->control.vif)) { |
434 | kfree_skb(skb); | 434 | ieee80211_free_txskb(&local->hw, skb); |
435 | continue; | 435 | continue; |
436 | } | 436 | } |
437 | 437 | ||
@@ -643,13 +643,41 @@ u32 ieee802_11_parse_elems_crc(u8 *start, size_t len, | |||
643 | break; | 643 | break; |
644 | } | 644 | } |
645 | 645 | ||
646 | if (id != WLAN_EID_VENDOR_SPECIFIC && | 646 | switch (id) { |
647 | id != WLAN_EID_QUIET && | 647 | case WLAN_EID_SSID: |
648 | test_bit(id, seen_elems)) { | 648 | case WLAN_EID_SUPP_RATES: |
649 | elems->parse_error = true; | 649 | case WLAN_EID_FH_PARAMS: |
650 | left -= elen; | 650 | case WLAN_EID_DS_PARAMS: |
651 | pos += elen; | 651 | case WLAN_EID_CF_PARAMS: |
652 | continue; | 652 | case WLAN_EID_TIM: |
653 | case WLAN_EID_IBSS_PARAMS: | ||
654 | case WLAN_EID_CHALLENGE: | ||
655 | case WLAN_EID_RSN: | ||
656 | case WLAN_EID_ERP_INFO: | ||
657 | case WLAN_EID_EXT_SUPP_RATES: | ||
658 | case WLAN_EID_HT_CAPABILITY: | ||
659 | case WLAN_EID_HT_OPERATION: | ||
660 | case WLAN_EID_VHT_CAPABILITY: | ||
661 | case WLAN_EID_VHT_OPERATION: | ||
662 | case WLAN_EID_MESH_ID: | ||
663 | case WLAN_EID_MESH_CONFIG: | ||
664 | case WLAN_EID_PEER_MGMT: | ||
665 | case WLAN_EID_PREQ: | ||
666 | case WLAN_EID_PREP: | ||
667 | case WLAN_EID_PERR: | ||
668 | case WLAN_EID_RANN: | ||
669 | case WLAN_EID_CHANNEL_SWITCH: | ||
670 | case WLAN_EID_EXT_CHANSWITCH_ANN: | ||
671 | case WLAN_EID_COUNTRY: | ||
672 | case WLAN_EID_PWR_CONSTRAINT: | ||
673 | case WLAN_EID_TIMEOUT_INTERVAL: | ||
674 | if (test_bit(id, seen_elems)) { | ||
675 | elems->parse_error = true; | ||
676 | left -= elen; | ||
677 | pos += elen; | ||
678 | continue; | ||
679 | } | ||
680 | break; | ||
653 | } | 681 | } |
654 | 682 | ||
655 | if (calc_crc && id < 64 && (filter & (1ULL << id))) | 683 | if (calc_crc && id < 64 && (filter & (1ULL << id))) |
diff --git a/net/mac80211/wpa.c b/net/mac80211/wpa.c index bdb53aba888e..8bd2f5c6a56e 100644 --- a/net/mac80211/wpa.c +++ b/net/mac80211/wpa.c | |||
@@ -106,7 +106,8 @@ ieee80211_rx_h_michael_mic_verify(struct ieee80211_rx_data *rx) | |||
106 | if (status->flag & RX_FLAG_MMIC_ERROR) | 106 | if (status->flag & RX_FLAG_MMIC_ERROR) |
107 | goto mic_fail; | 107 | goto mic_fail; |
108 | 108 | ||
109 | if (!(status->flag & RX_FLAG_IV_STRIPPED) && rx->key) | 109 | if (!(status->flag & RX_FLAG_IV_STRIPPED) && rx->key && |
110 | rx->key->conf.cipher == WLAN_CIPHER_SUITE_TKIP) | ||
110 | goto update_iv; | 111 | goto update_iv; |
111 | 112 | ||
112 | return RX_CONTINUE; | 113 | return RX_CONTINUE; |
@@ -545,14 +546,19 @@ ieee80211_crypto_ccmp_decrypt(struct ieee80211_rx_data *rx) | |||
545 | 546 | ||
546 | static void bip_aad(struct sk_buff *skb, u8 *aad) | 547 | static void bip_aad(struct sk_buff *skb, u8 *aad) |
547 | { | 548 | { |
549 | __le16 mask_fc; | ||
550 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; | ||
551 | |||
548 | /* BIP AAD: FC(masked) || A1 || A2 || A3 */ | 552 | /* BIP AAD: FC(masked) || A1 || A2 || A3 */ |
549 | 553 | ||
550 | /* FC type/subtype */ | 554 | /* FC type/subtype */ |
551 | aad[0] = skb->data[0]; | ||
552 | /* Mask FC Retry, PwrMgt, MoreData flags to zero */ | 555 | /* Mask FC Retry, PwrMgt, MoreData flags to zero */ |
553 | aad[1] = skb->data[1] & ~(BIT(4) | BIT(5) | BIT(6)); | 556 | mask_fc = hdr->frame_control; |
557 | mask_fc &= ~cpu_to_le16(IEEE80211_FCTL_RETRY | IEEE80211_FCTL_PM | | ||
558 | IEEE80211_FCTL_MOREDATA); | ||
559 | put_unaligned(mask_fc, (__le16 *) &aad[0]); | ||
554 | /* A1 || A2 || A3 */ | 560 | /* A1 || A2 || A3 */ |
555 | memcpy(aad + 2, skb->data + 4, 3 * ETH_ALEN); | 561 | memcpy(aad + 2, &hdr->addr1, 3 * ETH_ALEN); |
556 | } | 562 | } |
557 | 563 | ||
558 | 564 | ||
diff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c index 7e7198b51c06..c4ee43710aab 100644 --- a/net/netfilter/ipvs/ip_vs_ctl.c +++ b/net/netfilter/ipvs/ip_vs_ctl.c | |||
@@ -2589,6 +2589,8 @@ __ip_vs_get_timeouts(struct net *net, struct ip_vs_timeout_user *u) | |||
2589 | struct ip_vs_proto_data *pd; | 2589 | struct ip_vs_proto_data *pd; |
2590 | #endif | 2590 | #endif |
2591 | 2591 | ||
2592 | memset(u, 0, sizeof (*u)); | ||
2593 | |||
2592 | #ifdef CONFIG_IP_VS_PROTO_TCP | 2594 | #ifdef CONFIG_IP_VS_PROTO_TCP |
2593 | pd = ip_vs_proto_data_get(net, IPPROTO_TCP); | 2595 | pd = ip_vs_proto_data_get(net, IPPROTO_TCP); |
2594 | u->tcp_timeout = pd->timeout_table[IP_VS_TCP_S_ESTABLISHED] / HZ; | 2596 | u->tcp_timeout = pd->timeout_table[IP_VS_TCP_S_ESTABLISHED] / HZ; |
@@ -2766,7 +2768,6 @@ do_ip_vs_get_ctl(struct sock *sk, int cmd, void __user *user, int *len) | |||
2766 | { | 2768 | { |
2767 | struct ip_vs_timeout_user t; | 2769 | struct ip_vs_timeout_user t; |
2768 | 2770 | ||
2769 | memset(&t, 0, sizeof(t)); | ||
2770 | __ip_vs_get_timeouts(net, &t); | 2771 | __ip_vs_get_timeouts(net, &t); |
2771 | if (copy_to_user(user, &t, sizeof(t)) != 0) | 2772 | if (copy_to_user(user, &t, sizeof(t)) != 0) |
2772 | ret = -EFAULT; | 2773 | ret = -EFAULT; |
diff --git a/net/netfilter/nf_conntrack_h323_main.c b/net/netfilter/nf_conntrack_h323_main.c index 1b30b0dee708..962795e839ab 100644 --- a/net/netfilter/nf_conntrack_h323_main.c +++ b/net/netfilter/nf_conntrack_h323_main.c | |||
@@ -753,7 +753,8 @@ static int callforward_do_filter(const union nf_inet_addr *src, | |||
753 | flowi4_to_flowi(&fl1), false)) { | 753 | flowi4_to_flowi(&fl1), false)) { |
754 | if (!afinfo->route(&init_net, (struct dst_entry **)&rt2, | 754 | if (!afinfo->route(&init_net, (struct dst_entry **)&rt2, |
755 | flowi4_to_flowi(&fl2), false)) { | 755 | flowi4_to_flowi(&fl2), false)) { |
756 | if (rt1->rt_gateway == rt2->rt_gateway && | 756 | if (rt_nexthop(rt1, fl1.daddr) == |
757 | rt_nexthop(rt2, fl2.daddr) && | ||
757 | rt1->dst.dev == rt2->dst.dev) | 758 | rt1->dst.dev == rt2->dst.dev) |
758 | ret = 1; | 759 | ret = 1; |
759 | dst_release(&rt2->dst); | 760 | dst_release(&rt2->dst); |
diff --git a/net/netfilter/xt_CT.c b/net/netfilter/xt_CT.c index 16c712563860..ae7f5daeee43 100644 --- a/net/netfilter/xt_CT.c +++ b/net/netfilter/xt_CT.c | |||
@@ -180,9 +180,9 @@ xt_ct_set_timeout(struct nf_conn *ct, const struct xt_tgchk_param *par, | |||
180 | typeof(nf_ct_timeout_find_get_hook) timeout_find_get; | 180 | typeof(nf_ct_timeout_find_get_hook) timeout_find_get; |
181 | struct ctnl_timeout *timeout; | 181 | struct ctnl_timeout *timeout; |
182 | struct nf_conn_timeout *timeout_ext; | 182 | struct nf_conn_timeout *timeout_ext; |
183 | const struct ipt_entry *e = par->entryinfo; | ||
184 | struct nf_conntrack_l4proto *l4proto; | 183 | struct nf_conntrack_l4proto *l4proto; |
185 | int ret = 0; | 184 | int ret = 0; |
185 | u8 proto; | ||
186 | 186 | ||
187 | rcu_read_lock(); | 187 | rcu_read_lock(); |
188 | timeout_find_get = rcu_dereference(nf_ct_timeout_find_get_hook); | 188 | timeout_find_get = rcu_dereference(nf_ct_timeout_find_get_hook); |
@@ -192,9 +192,11 @@ xt_ct_set_timeout(struct nf_conn *ct, const struct xt_tgchk_param *par, | |||
192 | goto out; | 192 | goto out; |
193 | } | 193 | } |
194 | 194 | ||
195 | if (e->ip.invflags & IPT_INV_PROTO) { | 195 | proto = xt_ct_find_proto(par); |
196 | if (!proto) { | ||
196 | ret = -EINVAL; | 197 | ret = -EINVAL; |
197 | pr_info("You cannot use inversion on L4 protocol\n"); | 198 | pr_info("You must specify a L4 protocol, and not use " |
199 | "inversions on it.\n"); | ||
198 | goto out; | 200 | goto out; |
199 | } | 201 | } |
200 | 202 | ||
@@ -214,7 +216,7 @@ xt_ct_set_timeout(struct nf_conn *ct, const struct xt_tgchk_param *par, | |||
214 | /* Make sure the timeout policy matches any existing protocol tracker, | 216 | /* Make sure the timeout policy matches any existing protocol tracker, |
215 | * otherwise default to generic. | 217 | * otherwise default to generic. |
216 | */ | 218 | */ |
217 | l4proto = __nf_ct_l4proto_find(par->family, e->ip.proto); | 219 | l4proto = __nf_ct_l4proto_find(par->family, proto); |
218 | if (timeout->l4proto->l4proto != l4proto->l4proto) { | 220 | if (timeout->l4proto->l4proto != l4proto->l4proto) { |
219 | ret = -EINVAL; | 221 | ret = -EINVAL; |
220 | pr_info("Timeout policy `%s' can only be used by L4 protocol " | 222 | pr_info("Timeout policy `%s' can only be used by L4 protocol " |
diff --git a/net/netfilter/xt_TEE.c b/net/netfilter/xt_TEE.c index ee2e5bc5a8c7..bd93e51d30ac 100644 --- a/net/netfilter/xt_TEE.c +++ b/net/netfilter/xt_TEE.c | |||
@@ -70,6 +70,7 @@ tee_tg_route4(struct sk_buff *skb, const struct xt_tee_tginfo *info) | |||
70 | fl4.daddr = info->gw.ip; | 70 | fl4.daddr = info->gw.ip; |
71 | fl4.flowi4_tos = RT_TOS(iph->tos); | 71 | fl4.flowi4_tos = RT_TOS(iph->tos); |
72 | fl4.flowi4_scope = RT_SCOPE_UNIVERSE; | 72 | fl4.flowi4_scope = RT_SCOPE_UNIVERSE; |
73 | fl4.flowi4_flags = FLOWI_FLAG_KNOWN_NH; | ||
73 | rt = ip_route_output_key(net, &fl4); | 74 | rt = ip_route_output_key(net, &fl4); |
74 | if (IS_ERR(rt)) | 75 | if (IS_ERR(rt)) |
75 | return false; | 76 | return false; |
diff --git a/net/netfilter/xt_nat.c b/net/netfilter/xt_nat.c index 81aafa8e4fef..bea7464cc43f 100644 --- a/net/netfilter/xt_nat.c +++ b/net/netfilter/xt_nat.c | |||
@@ -111,7 +111,7 @@ static struct xt_target xt_nat_target_reg[] __read_mostly = { | |||
111 | .family = NFPROTO_IPV4, | 111 | .family = NFPROTO_IPV4, |
112 | .table = "nat", | 112 | .table = "nat", |
113 | .hooks = (1 << NF_INET_POST_ROUTING) | | 113 | .hooks = (1 << NF_INET_POST_ROUTING) | |
114 | (1 << NF_INET_LOCAL_OUT), | 114 | (1 << NF_INET_LOCAL_IN), |
115 | .me = THIS_MODULE, | 115 | .me = THIS_MODULE, |
116 | }, | 116 | }, |
117 | { | 117 | { |
@@ -123,7 +123,7 @@ static struct xt_target xt_nat_target_reg[] __read_mostly = { | |||
123 | .family = NFPROTO_IPV4, | 123 | .family = NFPROTO_IPV4, |
124 | .table = "nat", | 124 | .table = "nat", |
125 | .hooks = (1 << NF_INET_PRE_ROUTING) | | 125 | .hooks = (1 << NF_INET_PRE_ROUTING) | |
126 | (1 << NF_INET_LOCAL_IN), | 126 | (1 << NF_INET_LOCAL_OUT), |
127 | .me = THIS_MODULE, | 127 | .me = THIS_MODULE, |
128 | }, | 128 | }, |
129 | { | 129 | { |
@@ -133,7 +133,7 @@ static struct xt_target xt_nat_target_reg[] __read_mostly = { | |||
133 | .targetsize = sizeof(struct nf_nat_range), | 133 | .targetsize = sizeof(struct nf_nat_range), |
134 | .table = "nat", | 134 | .table = "nat", |
135 | .hooks = (1 << NF_INET_POST_ROUTING) | | 135 | .hooks = (1 << NF_INET_POST_ROUTING) | |
136 | (1 << NF_INET_LOCAL_OUT), | 136 | (1 << NF_INET_LOCAL_IN), |
137 | .me = THIS_MODULE, | 137 | .me = THIS_MODULE, |
138 | }, | 138 | }, |
139 | { | 139 | { |
@@ -143,7 +143,7 @@ static struct xt_target xt_nat_target_reg[] __read_mostly = { | |||
143 | .targetsize = sizeof(struct nf_nat_range), | 143 | .targetsize = sizeof(struct nf_nat_range), |
144 | .table = "nat", | 144 | .table = "nat", |
145 | .hooks = (1 << NF_INET_PRE_ROUTING) | | 145 | .hooks = (1 << NF_INET_PRE_ROUTING) | |
146 | (1 << NF_INET_LOCAL_IN), | 146 | (1 << NF_INET_LOCAL_OUT), |
147 | .me = THIS_MODULE, | 147 | .me = THIS_MODULE, |
148 | }, | 148 | }, |
149 | }; | 149 | }; |
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c index 01e944a017a4..4da797fa5ec5 100644 --- a/net/netlink/af_netlink.c +++ b/net/netlink/af_netlink.c | |||
@@ -138,6 +138,8 @@ static int netlink_dump(struct sock *sk); | |||
138 | static DEFINE_RWLOCK(nl_table_lock); | 138 | static DEFINE_RWLOCK(nl_table_lock); |
139 | static atomic_t nl_table_users = ATOMIC_INIT(0); | 139 | static atomic_t nl_table_users = ATOMIC_INIT(0); |
140 | 140 | ||
141 | #define nl_deref_protected(X) rcu_dereference_protected(X, lockdep_is_held(&nl_table_lock)); | ||
142 | |||
141 | static ATOMIC_NOTIFIER_HEAD(netlink_chain); | 143 | static ATOMIC_NOTIFIER_HEAD(netlink_chain); |
142 | 144 | ||
143 | static inline u32 netlink_group_mask(u32 group) | 145 | static inline u32 netlink_group_mask(u32 group) |
@@ -345,6 +347,11 @@ netlink_update_listeners(struct sock *sk) | |||
345 | struct hlist_node *node; | 347 | struct hlist_node *node; |
346 | unsigned long mask; | 348 | unsigned long mask; |
347 | unsigned int i; | 349 | unsigned int i; |
350 | struct listeners *listeners; | ||
351 | |||
352 | listeners = nl_deref_protected(tbl->listeners); | ||
353 | if (!listeners) | ||
354 | return; | ||
348 | 355 | ||
349 | for (i = 0; i < NLGRPLONGS(tbl->groups); i++) { | 356 | for (i = 0; i < NLGRPLONGS(tbl->groups); i++) { |
350 | mask = 0; | 357 | mask = 0; |
@@ -352,7 +359,7 @@ netlink_update_listeners(struct sock *sk) | |||
352 | if (i < NLGRPLONGS(nlk_sk(sk)->ngroups)) | 359 | if (i < NLGRPLONGS(nlk_sk(sk)->ngroups)) |
353 | mask |= nlk_sk(sk)->groups[i]; | 360 | mask |= nlk_sk(sk)->groups[i]; |
354 | } | 361 | } |
355 | tbl->listeners->masks[i] = mask; | 362 | listeners->masks[i] = mask; |
356 | } | 363 | } |
357 | /* this function is only called with the netlink table "grabbed", which | 364 | /* this function is only called with the netlink table "grabbed", which |
358 | * makes sure updates are visible before bind or setsockopt return. */ | 365 | * makes sure updates are visible before bind or setsockopt return. */ |
@@ -536,7 +543,11 @@ static int netlink_release(struct socket *sock) | |||
536 | if (netlink_is_kernel(sk)) { | 543 | if (netlink_is_kernel(sk)) { |
537 | BUG_ON(nl_table[sk->sk_protocol].registered == 0); | 544 | BUG_ON(nl_table[sk->sk_protocol].registered == 0); |
538 | if (--nl_table[sk->sk_protocol].registered == 0) { | 545 | if (--nl_table[sk->sk_protocol].registered == 0) { |
539 | kfree(nl_table[sk->sk_protocol].listeners); | 546 | struct listeners *old; |
547 | |||
548 | old = nl_deref_protected(nl_table[sk->sk_protocol].listeners); | ||
549 | RCU_INIT_POINTER(nl_table[sk->sk_protocol].listeners, NULL); | ||
550 | kfree_rcu(old, rcu); | ||
540 | nl_table[sk->sk_protocol].module = NULL; | 551 | nl_table[sk->sk_protocol].module = NULL; |
541 | nl_table[sk->sk_protocol].bind = NULL; | 552 | nl_table[sk->sk_protocol].bind = NULL; |
542 | nl_table[sk->sk_protocol].flags = 0; | 553 | nl_table[sk->sk_protocol].flags = 0; |
@@ -982,7 +993,7 @@ int netlink_has_listeners(struct sock *sk, unsigned int group) | |||
982 | rcu_read_lock(); | 993 | rcu_read_lock(); |
983 | listeners = rcu_dereference(nl_table[sk->sk_protocol].listeners); | 994 | listeners = rcu_dereference(nl_table[sk->sk_protocol].listeners); |
984 | 995 | ||
985 | if (group - 1 < nl_table[sk->sk_protocol].groups) | 996 | if (listeners && group - 1 < nl_table[sk->sk_protocol].groups) |
986 | res = test_bit(group - 1, listeners->masks); | 997 | res = test_bit(group - 1, listeners->masks); |
987 | 998 | ||
988 | rcu_read_unlock(); | 999 | rcu_read_unlock(); |
@@ -1625,7 +1636,7 @@ int __netlink_change_ngroups(struct sock *sk, unsigned int groups) | |||
1625 | new = kzalloc(sizeof(*new) + NLGRPSZ(groups), GFP_ATOMIC); | 1636 | new = kzalloc(sizeof(*new) + NLGRPSZ(groups), GFP_ATOMIC); |
1626 | if (!new) | 1637 | if (!new) |
1627 | return -ENOMEM; | 1638 | return -ENOMEM; |
1628 | old = rcu_dereference_protected(tbl->listeners, 1); | 1639 | old = nl_deref_protected(tbl->listeners); |
1629 | memcpy(new->masks, old->masks, NLGRPSZ(tbl->groups)); | 1640 | memcpy(new->masks, old->masks, NLGRPSZ(tbl->groups)); |
1630 | rcu_assign_pointer(tbl->listeners, new); | 1641 | rcu_assign_pointer(tbl->listeners, new); |
1631 | 1642 | ||
diff --git a/net/sctp/socket.c b/net/sctp/socket.c index 59d16ea927f0..a60d1f8b41c5 100644 --- a/net/sctp/socket.c +++ b/net/sctp/socket.c | |||
@@ -974,7 +974,7 @@ SCTP_STATIC int sctp_setsockopt_bindx(struct sock* sk, | |||
974 | void *addr_buf; | 974 | void *addr_buf; |
975 | struct sctp_af *af; | 975 | struct sctp_af *af; |
976 | 976 | ||
977 | SCTP_DEBUG_PRINTK("sctp_setsocktopt_bindx: sk %p addrs %p" | 977 | SCTP_DEBUG_PRINTK("sctp_setsockopt_bindx: sk %p addrs %p" |
978 | " addrs_size %d opt %d\n", sk, addrs, addrs_size, op); | 978 | " addrs_size %d opt %d\n", sk, addrs, addrs_size, op); |
979 | 979 | ||
980 | if (unlikely(addrs_size <= 0)) | 980 | if (unlikely(addrs_size <= 0)) |
diff --git a/net/sunrpc/backchannel_rqst.c b/net/sunrpc/backchannel_rqst.c index 5a3d675d2f2f..a9c0bbccad6b 100644 --- a/net/sunrpc/backchannel_rqst.c +++ b/net/sunrpc/backchannel_rqst.c | |||
@@ -172,7 +172,7 @@ out_free: | |||
172 | xprt_free_allocation(req); | 172 | xprt_free_allocation(req); |
173 | 173 | ||
174 | dprintk("RPC: setup backchannel transport failed\n"); | 174 | dprintk("RPC: setup backchannel transport failed\n"); |
175 | return -1; | 175 | return -ENOMEM; |
176 | } | 176 | } |
177 | EXPORT_SYMBOL_GPL(xprt_setup_backchannel); | 177 | EXPORT_SYMBOL_GPL(xprt_setup_backchannel); |
178 | 178 | ||
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c index aaaadfbe36e9..75853cabf4c9 100644 --- a/net/sunrpc/xprtsock.c +++ b/net/sunrpc/xprtsock.c | |||
@@ -254,7 +254,6 @@ struct sock_xprt { | |||
254 | void (*old_data_ready)(struct sock *, int); | 254 | void (*old_data_ready)(struct sock *, int); |
255 | void (*old_state_change)(struct sock *); | 255 | void (*old_state_change)(struct sock *); |
256 | void (*old_write_space)(struct sock *); | 256 | void (*old_write_space)(struct sock *); |
257 | void (*old_error_report)(struct sock *); | ||
258 | }; | 257 | }; |
259 | 258 | ||
260 | /* | 259 | /* |
@@ -737,10 +736,10 @@ static int xs_tcp_send_request(struct rpc_task *task) | |||
737 | dprintk("RPC: sendmsg returned unrecognized error %d\n", | 736 | dprintk("RPC: sendmsg returned unrecognized error %d\n", |
738 | -status); | 737 | -status); |
739 | case -ECONNRESET: | 738 | case -ECONNRESET: |
740 | case -EPIPE: | ||
741 | xs_tcp_shutdown(xprt); | 739 | xs_tcp_shutdown(xprt); |
742 | case -ECONNREFUSED: | 740 | case -ECONNREFUSED: |
743 | case -ENOTCONN: | 741 | case -ENOTCONN: |
742 | case -EPIPE: | ||
744 | clear_bit(SOCK_ASYNC_NOSPACE, &transport->sock->flags); | 743 | clear_bit(SOCK_ASYNC_NOSPACE, &transport->sock->flags); |
745 | } | 744 | } |
746 | 745 | ||
@@ -781,7 +780,6 @@ static void xs_save_old_callbacks(struct sock_xprt *transport, struct sock *sk) | |||
781 | transport->old_data_ready = sk->sk_data_ready; | 780 | transport->old_data_ready = sk->sk_data_ready; |
782 | transport->old_state_change = sk->sk_state_change; | 781 | transport->old_state_change = sk->sk_state_change; |
783 | transport->old_write_space = sk->sk_write_space; | 782 | transport->old_write_space = sk->sk_write_space; |
784 | transport->old_error_report = sk->sk_error_report; | ||
785 | } | 783 | } |
786 | 784 | ||
787 | static void xs_restore_old_callbacks(struct sock_xprt *transport, struct sock *sk) | 785 | static void xs_restore_old_callbacks(struct sock_xprt *transport, struct sock *sk) |
@@ -789,7 +787,6 @@ static void xs_restore_old_callbacks(struct sock_xprt *transport, struct sock *s | |||
789 | sk->sk_data_ready = transport->old_data_ready; | 787 | sk->sk_data_ready = transport->old_data_ready; |
790 | sk->sk_state_change = transport->old_state_change; | 788 | sk->sk_state_change = transport->old_state_change; |
791 | sk->sk_write_space = transport->old_write_space; | 789 | sk->sk_write_space = transport->old_write_space; |
792 | sk->sk_error_report = transport->old_error_report; | ||
793 | } | 790 | } |
794 | 791 | ||
795 | static void xs_reset_transport(struct sock_xprt *transport) | 792 | static void xs_reset_transport(struct sock_xprt *transport) |
@@ -1453,7 +1450,7 @@ static void xs_tcp_cancel_linger_timeout(struct rpc_xprt *xprt) | |||
1453 | xprt_clear_connecting(xprt); | 1450 | xprt_clear_connecting(xprt); |
1454 | } | 1451 | } |
1455 | 1452 | ||
1456 | static void xs_sock_mark_closed(struct rpc_xprt *xprt) | 1453 | static void xs_sock_reset_connection_flags(struct rpc_xprt *xprt) |
1457 | { | 1454 | { |
1458 | smp_mb__before_clear_bit(); | 1455 | smp_mb__before_clear_bit(); |
1459 | clear_bit(XPRT_CONNECTION_ABORT, &xprt->state); | 1456 | clear_bit(XPRT_CONNECTION_ABORT, &xprt->state); |
@@ -1461,6 +1458,11 @@ static void xs_sock_mark_closed(struct rpc_xprt *xprt) | |||
1461 | clear_bit(XPRT_CLOSE_WAIT, &xprt->state); | 1458 | clear_bit(XPRT_CLOSE_WAIT, &xprt->state); |
1462 | clear_bit(XPRT_CLOSING, &xprt->state); | 1459 | clear_bit(XPRT_CLOSING, &xprt->state); |
1463 | smp_mb__after_clear_bit(); | 1460 | smp_mb__after_clear_bit(); |
1461 | } | ||
1462 | |||
1463 | static void xs_sock_mark_closed(struct rpc_xprt *xprt) | ||
1464 | { | ||
1465 | xs_sock_reset_connection_flags(xprt); | ||
1464 | /* Mark transport as closed and wake up all pending tasks */ | 1466 | /* Mark transport as closed and wake up all pending tasks */ |
1465 | xprt_disconnect_done(xprt); | 1467 | xprt_disconnect_done(xprt); |
1466 | } | 1468 | } |
@@ -1516,6 +1518,7 @@ static void xs_tcp_state_change(struct sock *sk) | |||
1516 | case TCP_CLOSE_WAIT: | 1518 | case TCP_CLOSE_WAIT: |
1517 | /* The server initiated a shutdown of the socket */ | 1519 | /* The server initiated a shutdown of the socket */ |
1518 | xprt->connect_cookie++; | 1520 | xprt->connect_cookie++; |
1521 | clear_bit(XPRT_CONNECTED, &xprt->state); | ||
1519 | xs_tcp_force_close(xprt); | 1522 | xs_tcp_force_close(xprt); |
1520 | case TCP_CLOSING: | 1523 | case TCP_CLOSING: |
1521 | /* | 1524 | /* |
@@ -1540,25 +1543,6 @@ static void xs_tcp_state_change(struct sock *sk) | |||
1540 | read_unlock_bh(&sk->sk_callback_lock); | 1543 | read_unlock_bh(&sk->sk_callback_lock); |
1541 | } | 1544 | } |
1542 | 1545 | ||
1543 | /** | ||
1544 | * xs_error_report - callback mainly for catching socket errors | ||
1545 | * @sk: socket | ||
1546 | */ | ||
1547 | static void xs_error_report(struct sock *sk) | ||
1548 | { | ||
1549 | struct rpc_xprt *xprt; | ||
1550 | |||
1551 | read_lock_bh(&sk->sk_callback_lock); | ||
1552 | if (!(xprt = xprt_from_sock(sk))) | ||
1553 | goto out; | ||
1554 | dprintk("RPC: %s client %p...\n" | ||
1555 | "RPC: error %d\n", | ||
1556 | __func__, xprt, sk->sk_err); | ||
1557 | xprt_wake_pending_tasks(xprt, -EAGAIN); | ||
1558 | out: | ||
1559 | read_unlock_bh(&sk->sk_callback_lock); | ||
1560 | } | ||
1561 | |||
1562 | static void xs_write_space(struct sock *sk) | 1546 | static void xs_write_space(struct sock *sk) |
1563 | { | 1547 | { |
1564 | struct socket *sock; | 1548 | struct socket *sock; |
@@ -1858,7 +1842,6 @@ static int xs_local_finish_connecting(struct rpc_xprt *xprt, | |||
1858 | sk->sk_user_data = xprt; | 1842 | sk->sk_user_data = xprt; |
1859 | sk->sk_data_ready = xs_local_data_ready; | 1843 | sk->sk_data_ready = xs_local_data_ready; |
1860 | sk->sk_write_space = xs_udp_write_space; | 1844 | sk->sk_write_space = xs_udp_write_space; |
1861 | sk->sk_error_report = xs_error_report; | ||
1862 | sk->sk_allocation = GFP_ATOMIC; | 1845 | sk->sk_allocation = GFP_ATOMIC; |
1863 | 1846 | ||
1864 | xprt_clear_connected(xprt); | 1847 | xprt_clear_connected(xprt); |
@@ -1983,7 +1966,6 @@ static void xs_udp_finish_connecting(struct rpc_xprt *xprt, struct socket *sock) | |||
1983 | sk->sk_user_data = xprt; | 1966 | sk->sk_user_data = xprt; |
1984 | sk->sk_data_ready = xs_udp_data_ready; | 1967 | sk->sk_data_ready = xs_udp_data_ready; |
1985 | sk->sk_write_space = xs_udp_write_space; | 1968 | sk->sk_write_space = xs_udp_write_space; |
1986 | sk->sk_error_report = xs_error_report; | ||
1987 | sk->sk_no_check = UDP_CSUM_NORCV; | 1969 | sk->sk_no_check = UDP_CSUM_NORCV; |
1988 | sk->sk_allocation = GFP_ATOMIC; | 1970 | sk->sk_allocation = GFP_ATOMIC; |
1989 | 1971 | ||
@@ -2050,10 +2032,8 @@ static void xs_abort_connection(struct sock_xprt *transport) | |||
2050 | any.sa_family = AF_UNSPEC; | 2032 | any.sa_family = AF_UNSPEC; |
2051 | result = kernel_connect(transport->sock, &any, sizeof(any), 0); | 2033 | result = kernel_connect(transport->sock, &any, sizeof(any), 0); |
2052 | if (!result) | 2034 | if (!result) |
2053 | xs_sock_mark_closed(&transport->xprt); | 2035 | xs_sock_reset_connection_flags(&transport->xprt); |
2054 | else | 2036 | dprintk("RPC: AF_UNSPEC connect return code %d\n", result); |
2055 | dprintk("RPC: AF_UNSPEC connect return code %d\n", | ||
2056 | result); | ||
2057 | } | 2037 | } |
2058 | 2038 | ||
2059 | static void xs_tcp_reuse_connection(struct sock_xprt *transport) | 2039 | static void xs_tcp_reuse_connection(struct sock_xprt *transport) |
@@ -2098,7 +2078,6 @@ static int xs_tcp_finish_connecting(struct rpc_xprt *xprt, struct socket *sock) | |||
2098 | sk->sk_data_ready = xs_tcp_data_ready; | 2078 | sk->sk_data_ready = xs_tcp_data_ready; |
2099 | sk->sk_state_change = xs_tcp_state_change; | 2079 | sk->sk_state_change = xs_tcp_state_change; |
2100 | sk->sk_write_space = xs_tcp_write_space; | 2080 | sk->sk_write_space = xs_tcp_write_space; |
2101 | sk->sk_error_report = xs_error_report; | ||
2102 | sk->sk_allocation = GFP_ATOMIC; | 2081 | sk->sk_allocation = GFP_ATOMIC; |
2103 | 2082 | ||
2104 | /* socket options */ | 2083 | /* socket options */ |
diff --git a/net/wireless/core.c b/net/wireless/core.c index 443d4d7deea2..3f7253052088 100644 --- a/net/wireless/core.c +++ b/net/wireless/core.c | |||
@@ -526,8 +526,7 @@ int wiphy_register(struct wiphy *wiphy) | |||
526 | for (i = 0; i < sband->n_channels; i++) { | 526 | for (i = 0; i < sband->n_channels; i++) { |
527 | sband->channels[i].orig_flags = | 527 | sband->channels[i].orig_flags = |
528 | sband->channels[i].flags; | 528 | sband->channels[i].flags; |
529 | sband->channels[i].orig_mag = | 529 | sband->channels[i].orig_mag = INT_MAX; |
530 | sband->channels[i].max_antenna_gain; | ||
531 | sband->channels[i].orig_mpwr = | 530 | sband->channels[i].orig_mpwr = |
532 | sband->channels[i].max_power; | 531 | sband->channels[i].max_power; |
533 | sband->channels[i].band = band; | 532 | sband->channels[i].band = band; |
diff --git a/net/wireless/mlme.c b/net/wireless/mlme.c index 8016fee0752b..904a7f368325 100644 --- a/net/wireless/mlme.c +++ b/net/wireless/mlme.c | |||
@@ -457,20 +457,14 @@ int __cfg80211_mlme_deauth(struct cfg80211_registered_device *rdev, | |||
457 | .reason_code = reason, | 457 | .reason_code = reason, |
458 | .ie = ie, | 458 | .ie = ie, |
459 | .ie_len = ie_len, | 459 | .ie_len = ie_len, |
460 | .local_state_change = local_state_change, | ||
460 | }; | 461 | }; |
461 | 462 | ||
462 | ASSERT_WDEV_LOCK(wdev); | 463 | ASSERT_WDEV_LOCK(wdev); |
463 | 464 | ||
464 | if (local_state_change) { | 465 | if (local_state_change && (!wdev->current_bss || |
465 | if (wdev->current_bss && | 466 | !ether_addr_equal(wdev->current_bss->pub.bssid, bssid))) |
466 | ether_addr_equal(wdev->current_bss->pub.bssid, bssid)) { | ||
467 | cfg80211_unhold_bss(wdev->current_bss); | ||
468 | cfg80211_put_bss(&wdev->current_bss->pub); | ||
469 | wdev->current_bss = NULL; | ||
470 | } | ||
471 | |||
472 | return 0; | 467 | return 0; |
473 | } | ||
474 | 468 | ||
475 | return rdev->ops->deauth(&rdev->wiphy, dev, &req); | 469 | return rdev->ops->deauth(&rdev->wiphy, dev, &req); |
476 | } | 470 | } |
diff --git a/net/wireless/reg.c b/net/wireless/reg.c index 3b8cbbc214db..bcc7d7ee5a51 100644 --- a/net/wireless/reg.c +++ b/net/wireless/reg.c | |||
@@ -908,7 +908,7 @@ static void handle_channel(struct wiphy *wiphy, | |||
908 | map_regdom_flags(reg_rule->flags) | bw_flags; | 908 | map_regdom_flags(reg_rule->flags) | bw_flags; |
909 | chan->max_antenna_gain = chan->orig_mag = | 909 | chan->max_antenna_gain = chan->orig_mag = |
910 | (int) MBI_TO_DBI(power_rule->max_antenna_gain); | 910 | (int) MBI_TO_DBI(power_rule->max_antenna_gain); |
911 | chan->max_power = chan->orig_mpwr = | 911 | chan->max_reg_power = chan->max_power = chan->orig_mpwr = |
912 | (int) MBM_TO_DBM(power_rule->max_eirp); | 912 | (int) MBM_TO_DBM(power_rule->max_eirp); |
913 | return; | 913 | return; |
914 | } | 914 | } |
@@ -1331,7 +1331,8 @@ static void handle_channel_custom(struct wiphy *wiphy, | |||
1331 | 1331 | ||
1332 | chan->flags |= map_regdom_flags(reg_rule->flags) | bw_flags; | 1332 | chan->flags |= map_regdom_flags(reg_rule->flags) | bw_flags; |
1333 | chan->max_antenna_gain = (int) MBI_TO_DBI(power_rule->max_antenna_gain); | 1333 | chan->max_antenna_gain = (int) MBI_TO_DBI(power_rule->max_antenna_gain); |
1334 | chan->max_power = (int) MBM_TO_DBM(power_rule->max_eirp); | 1334 | chan->max_reg_power = chan->max_power = |
1335 | (int) MBM_TO_DBM(power_rule->max_eirp); | ||
1335 | } | 1336 | } |
1336 | 1337 | ||
1337 | static void handle_band_custom(struct wiphy *wiphy, enum ieee80211_band band, | 1338 | static void handle_band_custom(struct wiphy *wiphy, enum ieee80211_band band, |
diff --git a/net/wireless/util.c b/net/wireless/util.c index ef35f4ef2aa6..2762e8329986 100644 --- a/net/wireless/util.c +++ b/net/wireless/util.c | |||
@@ -309,23 +309,21 @@ unsigned int ieee80211_get_hdrlen_from_skb(const struct sk_buff *skb) | |||
309 | } | 309 | } |
310 | EXPORT_SYMBOL(ieee80211_get_hdrlen_from_skb); | 310 | EXPORT_SYMBOL(ieee80211_get_hdrlen_from_skb); |
311 | 311 | ||
312 | static int ieee80211_get_mesh_hdrlen(struct ieee80211s_hdr *meshhdr) | 312 | unsigned int ieee80211_get_mesh_hdrlen(struct ieee80211s_hdr *meshhdr) |
313 | { | 313 | { |
314 | int ae = meshhdr->flags & MESH_FLAGS_AE; | 314 | int ae = meshhdr->flags & MESH_FLAGS_AE; |
315 | /* 7.1.3.5a.2 */ | 315 | /* 802.11-2012, 8.2.4.7.3 */ |
316 | switch (ae) { | 316 | switch (ae) { |
317 | default: | ||
317 | case 0: | 318 | case 0: |
318 | return 6; | 319 | return 6; |
319 | case MESH_FLAGS_AE_A4: | 320 | case MESH_FLAGS_AE_A4: |
320 | return 12; | 321 | return 12; |
321 | case MESH_FLAGS_AE_A5_A6: | 322 | case MESH_FLAGS_AE_A5_A6: |
322 | return 18; | 323 | return 18; |
323 | case (MESH_FLAGS_AE_A4 | MESH_FLAGS_AE_A5_A6): | ||
324 | return 24; | ||
325 | default: | ||
326 | return 6; | ||
327 | } | 324 | } |
328 | } | 325 | } |
326 | EXPORT_SYMBOL(ieee80211_get_mesh_hdrlen); | ||
329 | 327 | ||
330 | int ieee80211_data_to_8023(struct sk_buff *skb, const u8 *addr, | 328 | int ieee80211_data_to_8023(struct sk_buff *skb, const u8 *addr, |
331 | enum nl80211_iftype iftype) | 329 | enum nl80211_iftype iftype) |
@@ -373,6 +371,8 @@ int ieee80211_data_to_8023(struct sk_buff *skb, const u8 *addr, | |||
373 | /* make sure meshdr->flags is on the linear part */ | 371 | /* make sure meshdr->flags is on the linear part */ |
374 | if (!pskb_may_pull(skb, hdrlen + 1)) | 372 | if (!pskb_may_pull(skb, hdrlen + 1)) |
375 | return -1; | 373 | return -1; |
374 | if (meshdr->flags & MESH_FLAGS_AE_A4) | ||
375 | return -1; | ||
376 | if (meshdr->flags & MESH_FLAGS_AE_A5_A6) { | 376 | if (meshdr->flags & MESH_FLAGS_AE_A5_A6) { |
377 | skb_copy_bits(skb, hdrlen + | 377 | skb_copy_bits(skb, hdrlen + |
378 | offsetof(struct ieee80211s_hdr, eaddr1), | 378 | offsetof(struct ieee80211s_hdr, eaddr1), |
@@ -397,6 +397,8 @@ int ieee80211_data_to_8023(struct sk_buff *skb, const u8 *addr, | |||
397 | /* make sure meshdr->flags is on the linear part */ | 397 | /* make sure meshdr->flags is on the linear part */ |
398 | if (!pskb_may_pull(skb, hdrlen + 1)) | 398 | if (!pskb_may_pull(skb, hdrlen + 1)) |
399 | return -1; | 399 | return -1; |
400 | if (meshdr->flags & MESH_FLAGS_AE_A5_A6) | ||
401 | return -1; | ||
400 | if (meshdr->flags & MESH_FLAGS_AE_A4) | 402 | if (meshdr->flags & MESH_FLAGS_AE_A4) |
401 | skb_copy_bits(skb, hdrlen + | 403 | skb_copy_bits(skb, hdrlen + |
402 | offsetof(struct ieee80211s_hdr, eaddr1), | 404 | offsetof(struct ieee80211s_hdr, eaddr1), |
diff --git a/security/apparmor/policy.c b/security/apparmor/policy.c index cf5fd220309b..813200384d97 100644 --- a/security/apparmor/policy.c +++ b/security/apparmor/policy.c | |||
@@ -724,6 +724,8 @@ fail: | |||
724 | */ | 724 | */ |
725 | static void free_profile(struct aa_profile *profile) | 725 | static void free_profile(struct aa_profile *profile) |
726 | { | 726 | { |
727 | struct aa_profile *p; | ||
728 | |||
727 | AA_DEBUG("%s(%p)\n", __func__, profile); | 729 | AA_DEBUG("%s(%p)\n", __func__, profile); |
728 | 730 | ||
729 | if (!profile) | 731 | if (!profile) |
@@ -751,7 +753,27 @@ static void free_profile(struct aa_profile *profile) | |||
751 | aa_put_dfa(profile->xmatch); | 753 | aa_put_dfa(profile->xmatch); |
752 | aa_put_dfa(profile->policy.dfa); | 754 | aa_put_dfa(profile->policy.dfa); |
753 | 755 | ||
754 | aa_put_profile(profile->replacedby); | 756 | /* put the profile reference for replacedby, but not via |
757 | * put_profile(kref_put). | ||
758 | * replacedby can form a long chain that can result in cascading | ||
759 | * frees that blows the stack because kref_put makes a nested fn | ||
760 | * call (it looks like recursion, with free_profile calling | ||
761 | * free_profile) for each profile in the chain lp#1056078. | ||
762 | */ | ||
763 | for (p = profile->replacedby; p; ) { | ||
764 | if (atomic_dec_and_test(&p->base.count.refcount)) { | ||
765 | /* no more refs on p, grab its replacedby */ | ||
766 | struct aa_profile *next = p->replacedby; | ||
767 | /* break the chain */ | ||
768 | p->replacedby = NULL; | ||
769 | /* now free p, chain is broken */ | ||
770 | free_profile(p); | ||
771 | |||
772 | /* follow up with next profile in the chain */ | ||
773 | p = next; | ||
774 | } else | ||
775 | break; | ||
776 | } | ||
755 | 777 | ||
756 | kzfree(profile); | 778 | kzfree(profile); |
757 | } | 779 | } |
diff --git a/security/device_cgroup.c b/security/device_cgroup.c index 44dfc415a379..842c254396db 100644 --- a/security/device_cgroup.c +++ b/security/device_cgroup.c | |||
@@ -42,7 +42,10 @@ struct dev_exception_item { | |||
42 | struct dev_cgroup { | 42 | struct dev_cgroup { |
43 | struct cgroup_subsys_state css; | 43 | struct cgroup_subsys_state css; |
44 | struct list_head exceptions; | 44 | struct list_head exceptions; |
45 | bool deny_all; | 45 | enum { |
46 | DEVCG_DEFAULT_ALLOW, | ||
47 | DEVCG_DEFAULT_DENY, | ||
48 | } behavior; | ||
46 | }; | 49 | }; |
47 | 50 | ||
48 | static inline struct dev_cgroup *css_to_devcgroup(struct cgroup_subsys_state *s) | 51 | static inline struct dev_cgroup *css_to_devcgroup(struct cgroup_subsys_state *s) |
@@ -182,13 +185,13 @@ static struct cgroup_subsys_state *devcgroup_create(struct cgroup *cgroup) | |||
182 | parent_cgroup = cgroup->parent; | 185 | parent_cgroup = cgroup->parent; |
183 | 186 | ||
184 | if (parent_cgroup == NULL) | 187 | if (parent_cgroup == NULL) |
185 | dev_cgroup->deny_all = false; | 188 | dev_cgroup->behavior = DEVCG_DEFAULT_ALLOW; |
186 | else { | 189 | else { |
187 | parent_dev_cgroup = cgroup_to_devcgroup(parent_cgroup); | 190 | parent_dev_cgroup = cgroup_to_devcgroup(parent_cgroup); |
188 | mutex_lock(&devcgroup_mutex); | 191 | mutex_lock(&devcgroup_mutex); |
189 | ret = dev_exceptions_copy(&dev_cgroup->exceptions, | 192 | ret = dev_exceptions_copy(&dev_cgroup->exceptions, |
190 | &parent_dev_cgroup->exceptions); | 193 | &parent_dev_cgroup->exceptions); |
191 | dev_cgroup->deny_all = parent_dev_cgroup->deny_all; | 194 | dev_cgroup->behavior = parent_dev_cgroup->behavior; |
192 | mutex_unlock(&devcgroup_mutex); | 195 | mutex_unlock(&devcgroup_mutex); |
193 | if (ret) { | 196 | if (ret) { |
194 | kfree(dev_cgroup); | 197 | kfree(dev_cgroup); |
@@ -260,7 +263,7 @@ static int devcgroup_seq_read(struct cgroup *cgroup, struct cftype *cft, | |||
260 | * - List the exceptions in case the default policy is to deny | 263 | * - List the exceptions in case the default policy is to deny |
261 | * This way, the file remains as a "whitelist of devices" | 264 | * This way, the file remains as a "whitelist of devices" |
262 | */ | 265 | */ |
263 | if (devcgroup->deny_all == false) { | 266 | if (devcgroup->behavior == DEVCG_DEFAULT_ALLOW) { |
264 | set_access(acc, ACC_MASK); | 267 | set_access(acc, ACC_MASK); |
265 | set_majmin(maj, ~0); | 268 | set_majmin(maj, ~0); |
266 | set_majmin(min, ~0); | 269 | set_majmin(min, ~0); |
@@ -314,12 +317,12 @@ static int may_access(struct dev_cgroup *dev_cgroup, | |||
314 | * In two cases we'll consider this new exception valid: | 317 | * In two cases we'll consider this new exception valid: |
315 | * - the dev cgroup has its default policy to allow + exception list: | 318 | * - the dev cgroup has its default policy to allow + exception list: |
316 | * the new exception should *not* match any of the exceptions | 319 | * the new exception should *not* match any of the exceptions |
317 | * (!deny_all, !match) | 320 | * (behavior == DEVCG_DEFAULT_ALLOW, !match) |
318 | * - the dev cgroup has its default policy to deny + exception list: | 321 | * - the dev cgroup has its default policy to deny + exception list: |
319 | * the new exception *should* match the exceptions | 322 | * the new exception *should* match the exceptions |
320 | * (deny_all, match) | 323 | * (behavior == DEVCG_DEFAULT_DENY, match) |
321 | */ | 324 | */ |
322 | if (dev_cgroup->deny_all == match) | 325 | if ((dev_cgroup->behavior == DEVCG_DEFAULT_DENY) == match) |
323 | return 1; | 326 | return 1; |
324 | return 0; | 327 | return 0; |
325 | } | 328 | } |
@@ -341,6 +344,17 @@ static int parent_has_perm(struct dev_cgroup *childcg, | |||
341 | return may_access(parent, ex); | 344 | return may_access(parent, ex); |
342 | } | 345 | } |
343 | 346 | ||
347 | /** | ||
348 | * may_allow_all - checks if it's possible to change the behavior to | ||
349 | * allow based on parent's rules. | ||
350 | * @parent: device cgroup's parent | ||
351 | * returns: != 0 in case it's allowed, 0 otherwise | ||
352 | */ | ||
353 | static inline int may_allow_all(struct dev_cgroup *parent) | ||
354 | { | ||
355 | return parent->behavior == DEVCG_DEFAULT_ALLOW; | ||
356 | } | ||
357 | |||
344 | /* | 358 | /* |
345 | * Modify the exception list using allow/deny rules. | 359 | * Modify the exception list using allow/deny rules. |
346 | * CAP_SYS_ADMIN is needed for this. It's at least separate from CAP_MKNOD | 360 | * CAP_SYS_ADMIN is needed for this. It's at least separate from CAP_MKNOD |
@@ -358,9 +372,11 @@ static int devcgroup_update_access(struct dev_cgroup *devcgroup, | |||
358 | int filetype, const char *buffer) | 372 | int filetype, const char *buffer) |
359 | { | 373 | { |
360 | const char *b; | 374 | const char *b; |
361 | char *endp; | 375 | char temp[12]; /* 11 + 1 characters needed for a u32 */ |
362 | int count; | 376 | int count, rc; |
363 | struct dev_exception_item ex; | 377 | struct dev_exception_item ex; |
378 | struct cgroup *p = devcgroup->css.cgroup; | ||
379 | struct dev_cgroup *parent = cgroup_to_devcgroup(p->parent); | ||
364 | 380 | ||
365 | if (!capable(CAP_SYS_ADMIN)) | 381 | if (!capable(CAP_SYS_ADMIN)) |
366 | return -EPERM; | 382 | return -EPERM; |
@@ -372,14 +388,18 @@ static int devcgroup_update_access(struct dev_cgroup *devcgroup, | |||
372 | case 'a': | 388 | case 'a': |
373 | switch (filetype) { | 389 | switch (filetype) { |
374 | case DEVCG_ALLOW: | 390 | case DEVCG_ALLOW: |
375 | if (!parent_has_perm(devcgroup, &ex)) | 391 | if (!may_allow_all(parent)) |
376 | return -EPERM; | 392 | return -EPERM; |
377 | dev_exception_clean(devcgroup); | 393 | dev_exception_clean(devcgroup); |
378 | devcgroup->deny_all = false; | 394 | rc = dev_exceptions_copy(&devcgroup->exceptions, |
395 | &parent->exceptions); | ||
396 | if (rc) | ||
397 | return rc; | ||
398 | devcgroup->behavior = DEVCG_DEFAULT_ALLOW; | ||
379 | break; | 399 | break; |
380 | case DEVCG_DENY: | 400 | case DEVCG_DENY: |
381 | dev_exception_clean(devcgroup); | 401 | dev_exception_clean(devcgroup); |
382 | devcgroup->deny_all = true; | 402 | devcgroup->behavior = DEVCG_DEFAULT_DENY; |
383 | break; | 403 | break; |
384 | default: | 404 | default: |
385 | return -EINVAL; | 405 | return -EINVAL; |
@@ -402,8 +422,16 @@ static int devcgroup_update_access(struct dev_cgroup *devcgroup, | |||
402 | ex.major = ~0; | 422 | ex.major = ~0; |
403 | b++; | 423 | b++; |
404 | } else if (isdigit(*b)) { | 424 | } else if (isdigit(*b)) { |
405 | ex.major = simple_strtoul(b, &endp, 10); | 425 | memset(temp, 0, sizeof(temp)); |
406 | b = endp; | 426 | for (count = 0; count < sizeof(temp) - 1; count++) { |
427 | temp[count] = *b; | ||
428 | b++; | ||
429 | if (!isdigit(*b)) | ||
430 | break; | ||
431 | } | ||
432 | rc = kstrtou32(temp, 10, &ex.major); | ||
433 | if (rc) | ||
434 | return -EINVAL; | ||
407 | } else { | 435 | } else { |
408 | return -EINVAL; | 436 | return -EINVAL; |
409 | } | 437 | } |
@@ -416,8 +444,16 @@ static int devcgroup_update_access(struct dev_cgroup *devcgroup, | |||
416 | ex.minor = ~0; | 444 | ex.minor = ~0; |
417 | b++; | 445 | b++; |
418 | } else if (isdigit(*b)) { | 446 | } else if (isdigit(*b)) { |
419 | ex.minor = simple_strtoul(b, &endp, 10); | 447 | memset(temp, 0, sizeof(temp)); |
420 | b = endp; | 448 | for (count = 0; count < sizeof(temp) - 1; count++) { |
449 | temp[count] = *b; | ||
450 | b++; | ||
451 | if (!isdigit(*b)) | ||
452 | break; | ||
453 | } | ||
454 | rc = kstrtou32(temp, 10, &ex.minor); | ||
455 | if (rc) | ||
456 | return -EINVAL; | ||
421 | } else { | 457 | } else { |
422 | return -EINVAL; | 458 | return -EINVAL; |
423 | } | 459 | } |
@@ -452,7 +488,7 @@ static int devcgroup_update_access(struct dev_cgroup *devcgroup, | |||
452 | * an matching exception instead. And be silent about it: we | 488 | * an matching exception instead. And be silent about it: we |
453 | * don't want to break compatibility | 489 | * don't want to break compatibility |
454 | */ | 490 | */ |
455 | if (devcgroup->deny_all == false) { | 491 | if (devcgroup->behavior == DEVCG_DEFAULT_ALLOW) { |
456 | dev_exception_rm(devcgroup, &ex); | 492 | dev_exception_rm(devcgroup, &ex); |
457 | return 0; | 493 | return 0; |
458 | } | 494 | } |
@@ -463,7 +499,7 @@ static int devcgroup_update_access(struct dev_cgroup *devcgroup, | |||
463 | * an matching exception instead. And be silent about it: we | 499 | * an matching exception instead. And be silent about it: we |
464 | * don't want to break compatibility | 500 | * don't want to break compatibility |
465 | */ | 501 | */ |
466 | if (devcgroup->deny_all == true) { | 502 | if (devcgroup->behavior == DEVCG_DEFAULT_DENY) { |
467 | dev_exception_rm(devcgroup, &ex); | 503 | dev_exception_rm(devcgroup, &ex); |
468 | return 0; | 504 | return 0; |
469 | } | 505 | } |
@@ -533,10 +569,10 @@ struct cgroup_subsys devices_subsys = { | |||
533 | * | 569 | * |
534 | * returns 0 on success, -EPERM case the operation is not permitted | 570 | * returns 0 on success, -EPERM case the operation is not permitted |
535 | */ | 571 | */ |
536 | static int __devcgroup_check_permission(struct dev_cgroup *dev_cgroup, | 572 | static int __devcgroup_check_permission(short type, u32 major, u32 minor, |
537 | short type, u32 major, u32 minor, | ||
538 | short access) | 573 | short access) |
539 | { | 574 | { |
575 | struct dev_cgroup *dev_cgroup; | ||
540 | struct dev_exception_item ex; | 576 | struct dev_exception_item ex; |
541 | int rc; | 577 | int rc; |
542 | 578 | ||
@@ -547,6 +583,7 @@ static int __devcgroup_check_permission(struct dev_cgroup *dev_cgroup, | |||
547 | ex.access = access; | 583 | ex.access = access; |
548 | 584 | ||
549 | rcu_read_lock(); | 585 | rcu_read_lock(); |
586 | dev_cgroup = task_devcgroup(current); | ||
550 | rc = may_access(dev_cgroup, &ex); | 587 | rc = may_access(dev_cgroup, &ex); |
551 | rcu_read_unlock(); | 588 | rcu_read_unlock(); |
552 | 589 | ||
@@ -558,7 +595,6 @@ static int __devcgroup_check_permission(struct dev_cgroup *dev_cgroup, | |||
558 | 595 | ||
559 | int __devcgroup_inode_permission(struct inode *inode, int mask) | 596 | int __devcgroup_inode_permission(struct inode *inode, int mask) |
560 | { | 597 | { |
561 | struct dev_cgroup *dev_cgroup = task_devcgroup(current); | ||
562 | short type, access = 0; | 598 | short type, access = 0; |
563 | 599 | ||
564 | if (S_ISBLK(inode->i_mode)) | 600 | if (S_ISBLK(inode->i_mode)) |
@@ -570,13 +606,12 @@ int __devcgroup_inode_permission(struct inode *inode, int mask) | |||
570 | if (mask & MAY_READ) | 606 | if (mask & MAY_READ) |
571 | access |= ACC_READ; | 607 | access |= ACC_READ; |
572 | 608 | ||
573 | return __devcgroup_check_permission(dev_cgroup, type, imajor(inode), | 609 | return __devcgroup_check_permission(type, imajor(inode), iminor(inode), |
574 | iminor(inode), access); | 610 | access); |
575 | } | 611 | } |
576 | 612 | ||
577 | int devcgroup_inode_mknod(int mode, dev_t dev) | 613 | int devcgroup_inode_mknod(int mode, dev_t dev) |
578 | { | 614 | { |
579 | struct dev_cgroup *dev_cgroup = task_devcgroup(current); | ||
580 | short type; | 615 | short type; |
581 | 616 | ||
582 | if (!S_ISBLK(mode) && !S_ISCHR(mode)) | 617 | if (!S_ISBLK(mode) && !S_ISCHR(mode)) |
@@ -587,7 +622,7 @@ int devcgroup_inode_mknod(int mode, dev_t dev) | |||
587 | else | 622 | else |
588 | type = DEV_CHAR; | 623 | type = DEV_CHAR; |
589 | 624 | ||
590 | return __devcgroup_check_permission(dev_cgroup, type, MAJOR(dev), | 625 | return __devcgroup_check_permission(type, MAJOR(dev), MINOR(dev), |
591 | MINOR(dev), ACC_MKNOD); | 626 | ACC_MKNOD); |
592 | 627 | ||
593 | } | 628 | } |
diff --git a/sound/core/compress_offload.c b/sound/core/compress_offload.c index c40ae573346d..ad11dc994792 100644 --- a/sound/core/compress_offload.c +++ b/sound/core/compress_offload.c | |||
@@ -100,12 +100,15 @@ static int snd_compr_open(struct inode *inode, struct file *f) | |||
100 | 100 | ||
101 | if (dirn != compr->direction) { | 101 | if (dirn != compr->direction) { |
102 | pr_err("this device doesn't support this direction\n"); | 102 | pr_err("this device doesn't support this direction\n"); |
103 | snd_card_unref(compr->card); | ||
103 | return -EINVAL; | 104 | return -EINVAL; |
104 | } | 105 | } |
105 | 106 | ||
106 | data = kzalloc(sizeof(*data), GFP_KERNEL); | 107 | data = kzalloc(sizeof(*data), GFP_KERNEL); |
107 | if (!data) | 108 | if (!data) { |
109 | snd_card_unref(compr->card); | ||
108 | return -ENOMEM; | 110 | return -ENOMEM; |
111 | } | ||
109 | data->stream.ops = compr->ops; | 112 | data->stream.ops = compr->ops; |
110 | data->stream.direction = dirn; | 113 | data->stream.direction = dirn; |
111 | data->stream.private_data = compr->private_data; | 114 | data->stream.private_data = compr->private_data; |
@@ -113,6 +116,7 @@ static int snd_compr_open(struct inode *inode, struct file *f) | |||
113 | runtime = kzalloc(sizeof(*runtime), GFP_KERNEL); | 116 | runtime = kzalloc(sizeof(*runtime), GFP_KERNEL); |
114 | if (!runtime) { | 117 | if (!runtime) { |
115 | kfree(data); | 118 | kfree(data); |
119 | snd_card_unref(compr->card); | ||
116 | return -ENOMEM; | 120 | return -ENOMEM; |
117 | } | 121 | } |
118 | runtime->state = SNDRV_PCM_STATE_OPEN; | 122 | runtime->state = SNDRV_PCM_STATE_OPEN; |
@@ -126,7 +130,8 @@ static int snd_compr_open(struct inode *inode, struct file *f) | |||
126 | kfree(runtime); | 130 | kfree(runtime); |
127 | kfree(data); | 131 | kfree(data); |
128 | } | 132 | } |
129 | return ret; | 133 | snd_card_unref(compr->card); |
134 | return 0; | ||
130 | } | 135 | } |
131 | 136 | ||
132 | static int snd_compr_free(struct inode *inode, struct file *f) | 137 | static int snd_compr_free(struct inode *inode, struct file *f) |
diff --git a/sound/core/control.c b/sound/core/control.c index 7e86a5b9f3b5..8c7c2c9bba61 100644 --- a/sound/core/control.c +++ b/sound/core/control.c | |||
@@ -86,6 +86,7 @@ static int snd_ctl_open(struct inode *inode, struct file *file) | |||
86 | write_lock_irqsave(&card->ctl_files_rwlock, flags); | 86 | write_lock_irqsave(&card->ctl_files_rwlock, flags); |
87 | list_add_tail(&ctl->list, &card->ctl_files); | 87 | list_add_tail(&ctl->list, &card->ctl_files); |
88 | write_unlock_irqrestore(&card->ctl_files_rwlock, flags); | 88 | write_unlock_irqrestore(&card->ctl_files_rwlock, flags); |
89 | snd_card_unref(card); | ||
89 | return 0; | 90 | return 0; |
90 | 91 | ||
91 | __error: | 92 | __error: |
@@ -93,6 +94,8 @@ static int snd_ctl_open(struct inode *inode, struct file *file) | |||
93 | __error2: | 94 | __error2: |
94 | snd_card_file_remove(card, file); | 95 | snd_card_file_remove(card, file); |
95 | __error1: | 96 | __error1: |
97 | if (card) | ||
98 | snd_card_unref(card); | ||
96 | return err; | 99 | return err; |
97 | } | 100 | } |
98 | 101 | ||
@@ -1434,6 +1437,8 @@ static ssize_t snd_ctl_read(struct file *file, char __user *buffer, | |||
1434 | spin_unlock_irq(&ctl->read_lock); | 1437 | spin_unlock_irq(&ctl->read_lock); |
1435 | schedule(); | 1438 | schedule(); |
1436 | remove_wait_queue(&ctl->change_sleep, &wait); | 1439 | remove_wait_queue(&ctl->change_sleep, &wait); |
1440 | if (ctl->card->shutdown) | ||
1441 | return -ENODEV; | ||
1437 | if (signal_pending(current)) | 1442 | if (signal_pending(current)) |
1438 | return -ERESTARTSYS; | 1443 | return -ERESTARTSYS; |
1439 | spin_lock_irq(&ctl->read_lock); | 1444 | spin_lock_irq(&ctl->read_lock); |
diff --git a/sound/core/hwdep.c b/sound/core/hwdep.c index 75ea16f35b1a..3f7f6628cf7b 100644 --- a/sound/core/hwdep.c +++ b/sound/core/hwdep.c | |||
@@ -100,8 +100,10 @@ static int snd_hwdep_open(struct inode *inode, struct file * file) | |||
100 | if (hw == NULL) | 100 | if (hw == NULL) |
101 | return -ENODEV; | 101 | return -ENODEV; |
102 | 102 | ||
103 | if (!try_module_get(hw->card->module)) | 103 | if (!try_module_get(hw->card->module)) { |
104 | snd_card_unref(hw->card); | ||
104 | return -EFAULT; | 105 | return -EFAULT; |
106 | } | ||
105 | 107 | ||
106 | init_waitqueue_entry(&wait, current); | 108 | init_waitqueue_entry(&wait, current); |
107 | add_wait_queue(&hw->open_wait, &wait); | 109 | add_wait_queue(&hw->open_wait, &wait); |
@@ -129,6 +131,10 @@ static int snd_hwdep_open(struct inode *inode, struct file * file) | |||
129 | mutex_unlock(&hw->open_mutex); | 131 | mutex_unlock(&hw->open_mutex); |
130 | schedule(); | 132 | schedule(); |
131 | mutex_lock(&hw->open_mutex); | 133 | mutex_lock(&hw->open_mutex); |
134 | if (hw->card->shutdown) { | ||
135 | err = -ENODEV; | ||
136 | break; | ||
137 | } | ||
132 | if (signal_pending(current)) { | 138 | if (signal_pending(current)) { |
133 | err = -ERESTARTSYS; | 139 | err = -ERESTARTSYS; |
134 | break; | 140 | break; |
@@ -148,6 +154,7 @@ static int snd_hwdep_open(struct inode *inode, struct file * file) | |||
148 | mutex_unlock(&hw->open_mutex); | 154 | mutex_unlock(&hw->open_mutex); |
149 | if (err < 0) | 155 | if (err < 0) |
150 | module_put(hw->card->module); | 156 | module_put(hw->card->module); |
157 | snd_card_unref(hw->card); | ||
151 | return err; | 158 | return err; |
152 | } | 159 | } |
153 | 160 | ||
@@ -459,12 +466,15 @@ static int snd_hwdep_dev_disconnect(struct snd_device *device) | |||
459 | mutex_unlock(®ister_mutex); | 466 | mutex_unlock(®ister_mutex); |
460 | return -EINVAL; | 467 | return -EINVAL; |
461 | } | 468 | } |
469 | mutex_lock(&hwdep->open_mutex); | ||
470 | wake_up(&hwdep->open_wait); | ||
462 | #ifdef CONFIG_SND_OSSEMUL | 471 | #ifdef CONFIG_SND_OSSEMUL |
463 | if (hwdep->ossreg) | 472 | if (hwdep->ossreg) |
464 | snd_unregister_oss_device(hwdep->oss_type, hwdep->card, hwdep->device); | 473 | snd_unregister_oss_device(hwdep->oss_type, hwdep->card, hwdep->device); |
465 | #endif | 474 | #endif |
466 | snd_unregister_device(SNDRV_DEVICE_TYPE_HWDEP, hwdep->card, hwdep->device); | 475 | snd_unregister_device(SNDRV_DEVICE_TYPE_HWDEP, hwdep->card, hwdep->device); |
467 | list_del_init(&hwdep->list); | 476 | list_del_init(&hwdep->list); |
477 | mutex_unlock(&hwdep->open_mutex); | ||
468 | mutex_unlock(®ister_mutex); | 478 | mutex_unlock(®ister_mutex); |
469 | return 0; | 479 | return 0; |
470 | } | 480 | } |
diff --git a/sound/core/init.c b/sound/core/init.c index d8ec849af128..7b012d15c2cf 100644 --- a/sound/core/init.c +++ b/sound/core/init.c | |||
@@ -213,6 +213,7 @@ int snd_card_create(int idx, const char *xid, | |||
213 | spin_lock_init(&card->files_lock); | 213 | spin_lock_init(&card->files_lock); |
214 | INIT_LIST_HEAD(&card->files_list); | 214 | INIT_LIST_HEAD(&card->files_list); |
215 | init_waitqueue_head(&card->shutdown_sleep); | 215 | init_waitqueue_head(&card->shutdown_sleep); |
216 | atomic_set(&card->refcount, 0); | ||
216 | #ifdef CONFIG_PM | 217 | #ifdef CONFIG_PM |
217 | mutex_init(&card->power_lock); | 218 | mutex_init(&card->power_lock); |
218 | init_waitqueue_head(&card->power_sleep); | 219 | init_waitqueue_head(&card->power_sleep); |
@@ -446,21 +447,36 @@ static int snd_card_do_free(struct snd_card *card) | |||
446 | return 0; | 447 | return 0; |
447 | } | 448 | } |
448 | 449 | ||
450 | /** | ||
451 | * snd_card_unref - release the reference counter | ||
452 | * @card: the card instance | ||
453 | * | ||
454 | * Decrements the reference counter. When it reaches to zero, wake up | ||
455 | * the sleeper and call the destructor if needed. | ||
456 | */ | ||
457 | void snd_card_unref(struct snd_card *card) | ||
458 | { | ||
459 | if (atomic_dec_and_test(&card->refcount)) { | ||
460 | wake_up(&card->shutdown_sleep); | ||
461 | if (card->free_on_last_close) | ||
462 | snd_card_do_free(card); | ||
463 | } | ||
464 | } | ||
465 | EXPORT_SYMBOL(snd_card_unref); | ||
466 | |||
449 | int snd_card_free_when_closed(struct snd_card *card) | 467 | int snd_card_free_when_closed(struct snd_card *card) |
450 | { | 468 | { |
451 | int free_now = 0; | 469 | int ret; |
452 | int ret = snd_card_disconnect(card); | ||
453 | if (ret) | ||
454 | return ret; | ||
455 | 470 | ||
456 | spin_lock(&card->files_lock); | 471 | atomic_inc(&card->refcount); |
457 | if (list_empty(&card->files_list)) | 472 | ret = snd_card_disconnect(card); |
458 | free_now = 1; | 473 | if (ret) { |
459 | else | 474 | atomic_dec(&card->refcount); |
460 | card->free_on_last_close = 1; | 475 | return ret; |
461 | spin_unlock(&card->files_lock); | 476 | } |
462 | 477 | ||
463 | if (free_now) | 478 | card->free_on_last_close = 1; |
479 | if (atomic_dec_and_test(&card->refcount)) | ||
464 | snd_card_do_free(card); | 480 | snd_card_do_free(card); |
465 | return 0; | 481 | return 0; |
466 | } | 482 | } |
@@ -474,7 +490,7 @@ int snd_card_free(struct snd_card *card) | |||
474 | return ret; | 490 | return ret; |
475 | 491 | ||
476 | /* wait, until all devices are ready for the free operation */ | 492 | /* wait, until all devices are ready for the free operation */ |
477 | wait_event(card->shutdown_sleep, list_empty(&card->files_list)); | 493 | wait_event(card->shutdown_sleep, !atomic_read(&card->refcount)); |
478 | snd_card_do_free(card); | 494 | snd_card_do_free(card); |
479 | return 0; | 495 | return 0; |
480 | } | 496 | } |
@@ -886,6 +902,7 @@ int snd_card_file_add(struct snd_card *card, struct file *file) | |||
886 | return -ENODEV; | 902 | return -ENODEV; |
887 | } | 903 | } |
888 | list_add(&mfile->list, &card->files_list); | 904 | list_add(&mfile->list, &card->files_list); |
905 | atomic_inc(&card->refcount); | ||
889 | spin_unlock(&card->files_lock); | 906 | spin_unlock(&card->files_lock); |
890 | return 0; | 907 | return 0; |
891 | } | 908 | } |
@@ -908,7 +925,6 @@ EXPORT_SYMBOL(snd_card_file_add); | |||
908 | int snd_card_file_remove(struct snd_card *card, struct file *file) | 925 | int snd_card_file_remove(struct snd_card *card, struct file *file) |
909 | { | 926 | { |
910 | struct snd_monitor_file *mfile, *found = NULL; | 927 | struct snd_monitor_file *mfile, *found = NULL; |
911 | int last_close = 0; | ||
912 | 928 | ||
913 | spin_lock(&card->files_lock); | 929 | spin_lock(&card->files_lock); |
914 | list_for_each_entry(mfile, &card->files_list, list) { | 930 | list_for_each_entry(mfile, &card->files_list, list) { |
@@ -923,19 +939,13 @@ int snd_card_file_remove(struct snd_card *card, struct file *file) | |||
923 | break; | 939 | break; |
924 | } | 940 | } |
925 | } | 941 | } |
926 | if (list_empty(&card->files_list)) | ||
927 | last_close = 1; | ||
928 | spin_unlock(&card->files_lock); | 942 | spin_unlock(&card->files_lock); |
929 | if (last_close) { | ||
930 | wake_up(&card->shutdown_sleep); | ||
931 | if (card->free_on_last_close) | ||
932 | snd_card_do_free(card); | ||
933 | } | ||
934 | if (!found) { | 943 | if (!found) { |
935 | snd_printk(KERN_ERR "ALSA card file remove problem (%p)\n", file); | 944 | snd_printk(KERN_ERR "ALSA card file remove problem (%p)\n", file); |
936 | return -ENOENT; | 945 | return -ENOENT; |
937 | } | 946 | } |
938 | kfree(found); | 947 | kfree(found); |
948 | snd_card_unref(card); | ||
939 | return 0; | 949 | return 0; |
940 | } | 950 | } |
941 | 951 | ||
diff --git a/sound/core/oss/mixer_oss.c b/sound/core/oss/mixer_oss.c index 29f6ded02555..a9a2e63c0222 100644 --- a/sound/core/oss/mixer_oss.c +++ b/sound/core/oss/mixer_oss.c | |||
@@ -52,14 +52,19 @@ static int snd_mixer_oss_open(struct inode *inode, struct file *file) | |||
52 | SNDRV_OSS_DEVICE_TYPE_MIXER); | 52 | SNDRV_OSS_DEVICE_TYPE_MIXER); |
53 | if (card == NULL) | 53 | if (card == NULL) |
54 | return -ENODEV; | 54 | return -ENODEV; |
55 | if (card->mixer_oss == NULL) | 55 | if (card->mixer_oss == NULL) { |
56 | snd_card_unref(card); | ||
56 | return -ENODEV; | 57 | return -ENODEV; |
58 | } | ||
57 | err = snd_card_file_add(card, file); | 59 | err = snd_card_file_add(card, file); |
58 | if (err < 0) | 60 | if (err < 0) { |
61 | snd_card_unref(card); | ||
59 | return err; | 62 | return err; |
63 | } | ||
60 | fmixer = kzalloc(sizeof(*fmixer), GFP_KERNEL); | 64 | fmixer = kzalloc(sizeof(*fmixer), GFP_KERNEL); |
61 | if (fmixer == NULL) { | 65 | if (fmixer == NULL) { |
62 | snd_card_file_remove(card, file); | 66 | snd_card_file_remove(card, file); |
67 | snd_card_unref(card); | ||
63 | return -ENOMEM; | 68 | return -ENOMEM; |
64 | } | 69 | } |
65 | fmixer->card = card; | 70 | fmixer->card = card; |
@@ -68,6 +73,7 @@ static int snd_mixer_oss_open(struct inode *inode, struct file *file) | |||
68 | if (!try_module_get(card->module)) { | 73 | if (!try_module_get(card->module)) { |
69 | kfree(fmixer); | 74 | kfree(fmixer); |
70 | snd_card_file_remove(card, file); | 75 | snd_card_file_remove(card, file); |
76 | snd_card_unref(card); | ||
71 | return -EFAULT; | 77 | return -EFAULT; |
72 | } | 78 | } |
73 | return 0; | 79 | return 0; |
diff --git a/sound/core/oss/pcm_oss.c b/sound/core/oss/pcm_oss.c index 08fde0060fd9..f337b66a020b 100644 --- a/sound/core/oss/pcm_oss.c +++ b/sound/core/oss/pcm_oss.c | |||
@@ -2441,6 +2441,10 @@ static int snd_pcm_oss_open(struct inode *inode, struct file *file) | |||
2441 | mutex_unlock(&pcm->open_mutex); | 2441 | mutex_unlock(&pcm->open_mutex); |
2442 | schedule(); | 2442 | schedule(); |
2443 | mutex_lock(&pcm->open_mutex); | 2443 | mutex_lock(&pcm->open_mutex); |
2444 | if (pcm->card->shutdown) { | ||
2445 | err = -ENODEV; | ||
2446 | break; | ||
2447 | } | ||
2444 | if (signal_pending(current)) { | 2448 | if (signal_pending(current)) { |
2445 | err = -ERESTARTSYS; | 2449 | err = -ERESTARTSYS; |
2446 | break; | 2450 | break; |
@@ -2457,6 +2461,8 @@ static int snd_pcm_oss_open(struct inode *inode, struct file *file) | |||
2457 | __error2: | 2461 | __error2: |
2458 | snd_card_file_remove(pcm->card, file); | 2462 | snd_card_file_remove(pcm->card, file); |
2459 | __error1: | 2463 | __error1: |
2464 | if (pcm) | ||
2465 | snd_card_unref(pcm->card); | ||
2460 | return err; | 2466 | return err; |
2461 | } | 2467 | } |
2462 | 2468 | ||
diff --git a/sound/core/pcm.c b/sound/core/pcm.c index f2991940b271..030102caeee9 100644 --- a/sound/core/pcm.c +++ b/sound/core/pcm.c | |||
@@ -1086,11 +1086,19 @@ static int snd_pcm_dev_disconnect(struct snd_device *device) | |||
1086 | if (list_empty(&pcm->list)) | 1086 | if (list_empty(&pcm->list)) |
1087 | goto unlock; | 1087 | goto unlock; |
1088 | 1088 | ||
1089 | mutex_lock(&pcm->open_mutex); | ||
1090 | wake_up(&pcm->open_wait); | ||
1089 | list_del_init(&pcm->list); | 1091 | list_del_init(&pcm->list); |
1090 | for (cidx = 0; cidx < 2; cidx++) | 1092 | for (cidx = 0; cidx < 2; cidx++) |
1091 | for (substream = pcm->streams[cidx].substream; substream; substream = substream->next) | 1093 | for (substream = pcm->streams[cidx].substream; substream; substream = substream->next) { |
1092 | if (substream->runtime) | 1094 | snd_pcm_stream_lock_irq(substream); |
1095 | if (substream->runtime) { | ||
1093 | substream->runtime->status->state = SNDRV_PCM_STATE_DISCONNECTED; | 1096 | substream->runtime->status->state = SNDRV_PCM_STATE_DISCONNECTED; |
1097 | wake_up(&substream->runtime->sleep); | ||
1098 | wake_up(&substream->runtime->tsleep); | ||
1099 | } | ||
1100 | snd_pcm_stream_unlock_irq(substream); | ||
1101 | } | ||
1094 | list_for_each_entry(notify, &snd_pcm_notify_list, list) { | 1102 | list_for_each_entry(notify, &snd_pcm_notify_list, list) { |
1095 | notify->n_disconnect(pcm); | 1103 | notify->n_disconnect(pcm); |
1096 | } | 1104 | } |
@@ -1110,6 +1118,7 @@ static int snd_pcm_dev_disconnect(struct snd_device *device) | |||
1110 | pcm->streams[cidx].chmap_kctl = NULL; | 1118 | pcm->streams[cidx].chmap_kctl = NULL; |
1111 | } | 1119 | } |
1112 | } | 1120 | } |
1121 | mutex_unlock(&pcm->open_mutex); | ||
1113 | unlock: | 1122 | unlock: |
1114 | mutex_unlock(®ister_mutex); | 1123 | mutex_unlock(®ister_mutex); |
1115 | return 0; | 1124 | return 0; |
diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c index 5e12e5bacbba..6e8872de5ba0 100644 --- a/sound/core/pcm_native.c +++ b/sound/core/pcm_native.c | |||
@@ -369,6 +369,14 @@ static int period_to_usecs(struct snd_pcm_runtime *runtime) | |||
369 | return usecs; | 369 | return usecs; |
370 | } | 370 | } |
371 | 371 | ||
372 | static void snd_pcm_set_state(struct snd_pcm_substream *substream, int state) | ||
373 | { | ||
374 | snd_pcm_stream_lock_irq(substream); | ||
375 | if (substream->runtime->status->state != SNDRV_PCM_STATE_DISCONNECTED) | ||
376 | substream->runtime->status->state = state; | ||
377 | snd_pcm_stream_unlock_irq(substream); | ||
378 | } | ||
379 | |||
372 | static int snd_pcm_hw_params(struct snd_pcm_substream *substream, | 380 | static int snd_pcm_hw_params(struct snd_pcm_substream *substream, |
373 | struct snd_pcm_hw_params *params) | 381 | struct snd_pcm_hw_params *params) |
374 | { | 382 | { |
@@ -452,7 +460,7 @@ static int snd_pcm_hw_params(struct snd_pcm_substream *substream, | |||
452 | runtime->boundary *= 2; | 460 | runtime->boundary *= 2; |
453 | 461 | ||
454 | snd_pcm_timer_resolution_change(substream); | 462 | snd_pcm_timer_resolution_change(substream); |
455 | runtime->status->state = SNDRV_PCM_STATE_SETUP; | 463 | snd_pcm_set_state(substream, SNDRV_PCM_STATE_SETUP); |
456 | 464 | ||
457 | if (pm_qos_request_active(&substream->latency_pm_qos_req)) | 465 | if (pm_qos_request_active(&substream->latency_pm_qos_req)) |
458 | pm_qos_remove_request(&substream->latency_pm_qos_req); | 466 | pm_qos_remove_request(&substream->latency_pm_qos_req); |
@@ -464,7 +472,7 @@ static int snd_pcm_hw_params(struct snd_pcm_substream *substream, | |||
464 | /* hardware might be unusable from this time, | 472 | /* hardware might be unusable from this time, |
465 | so we force application to retry to set | 473 | so we force application to retry to set |
466 | the correct hardware parameter settings */ | 474 | the correct hardware parameter settings */ |
467 | runtime->status->state = SNDRV_PCM_STATE_OPEN; | 475 | snd_pcm_set_state(substream, SNDRV_PCM_STATE_OPEN); |
468 | if (substream->ops->hw_free != NULL) | 476 | if (substream->ops->hw_free != NULL) |
469 | substream->ops->hw_free(substream); | 477 | substream->ops->hw_free(substream); |
470 | return err; | 478 | return err; |
@@ -512,7 +520,7 @@ static int snd_pcm_hw_free(struct snd_pcm_substream *substream) | |||
512 | return -EBADFD; | 520 | return -EBADFD; |
513 | if (substream->ops->hw_free) | 521 | if (substream->ops->hw_free) |
514 | result = substream->ops->hw_free(substream); | 522 | result = substream->ops->hw_free(substream); |
515 | runtime->status->state = SNDRV_PCM_STATE_OPEN; | 523 | snd_pcm_set_state(substream, SNDRV_PCM_STATE_OPEN); |
516 | pm_qos_remove_request(&substream->latency_pm_qos_req); | 524 | pm_qos_remove_request(&substream->latency_pm_qos_req); |
517 | return result; | 525 | return result; |
518 | } | 526 | } |
@@ -1320,7 +1328,7 @@ static void snd_pcm_post_prepare(struct snd_pcm_substream *substream, int state) | |||
1320 | { | 1328 | { |
1321 | struct snd_pcm_runtime *runtime = substream->runtime; | 1329 | struct snd_pcm_runtime *runtime = substream->runtime; |
1322 | runtime->control->appl_ptr = runtime->status->hw_ptr; | 1330 | runtime->control->appl_ptr = runtime->status->hw_ptr; |
1323 | runtime->status->state = SNDRV_PCM_STATE_PREPARED; | 1331 | snd_pcm_set_state(substream, SNDRV_PCM_STATE_PREPARED); |
1324 | } | 1332 | } |
1325 | 1333 | ||
1326 | static struct action_ops snd_pcm_action_prepare = { | 1334 | static struct action_ops snd_pcm_action_prepare = { |
@@ -1510,6 +1518,10 @@ static int snd_pcm_drain(struct snd_pcm_substream *substream, | |||
1510 | down_read(&snd_pcm_link_rwsem); | 1518 | down_read(&snd_pcm_link_rwsem); |
1511 | snd_pcm_stream_lock_irq(substream); | 1519 | snd_pcm_stream_lock_irq(substream); |
1512 | remove_wait_queue(&to_check->sleep, &wait); | 1520 | remove_wait_queue(&to_check->sleep, &wait); |
1521 | if (card->shutdown) { | ||
1522 | result = -ENODEV; | ||
1523 | break; | ||
1524 | } | ||
1513 | if (tout == 0) { | 1525 | if (tout == 0) { |
1514 | if (substream->runtime->status->state == SNDRV_PCM_STATE_SUSPENDED) | 1526 | if (substream->runtime->status->state == SNDRV_PCM_STATE_SUSPENDED) |
1515 | result = -ESTRPIPE; | 1527 | result = -ESTRPIPE; |
@@ -1634,6 +1646,7 @@ static int snd_pcm_link(struct snd_pcm_substream *substream, int fd) | |||
1634 | write_unlock_irq(&snd_pcm_link_rwlock); | 1646 | write_unlock_irq(&snd_pcm_link_rwlock); |
1635 | up_write(&snd_pcm_link_rwsem); | 1647 | up_write(&snd_pcm_link_rwsem); |
1636 | _nolock: | 1648 | _nolock: |
1649 | snd_card_unref(substream1->pcm->card); | ||
1637 | fput_light(file, fput_needed); | 1650 | fput_light(file, fput_needed); |
1638 | if (res < 0) | 1651 | if (res < 0) |
1639 | kfree(group); | 1652 | kfree(group); |
@@ -2108,7 +2121,9 @@ static int snd_pcm_playback_open(struct inode *inode, struct file *file) | |||
2108 | return err; | 2121 | return err; |
2109 | pcm = snd_lookup_minor_data(iminor(inode), | 2122 | pcm = snd_lookup_minor_data(iminor(inode), |
2110 | SNDRV_DEVICE_TYPE_PCM_PLAYBACK); | 2123 | SNDRV_DEVICE_TYPE_PCM_PLAYBACK); |
2111 | return snd_pcm_open(file, pcm, SNDRV_PCM_STREAM_PLAYBACK); | 2124 | err = snd_pcm_open(file, pcm, SNDRV_PCM_STREAM_PLAYBACK); |
2125 | snd_card_unref(pcm->card); | ||
2126 | return err; | ||
2112 | } | 2127 | } |
2113 | 2128 | ||
2114 | static int snd_pcm_capture_open(struct inode *inode, struct file *file) | 2129 | static int snd_pcm_capture_open(struct inode *inode, struct file *file) |
@@ -2119,7 +2134,9 @@ static int snd_pcm_capture_open(struct inode *inode, struct file *file) | |||
2119 | return err; | 2134 | return err; |
2120 | pcm = snd_lookup_minor_data(iminor(inode), | 2135 | pcm = snd_lookup_minor_data(iminor(inode), |
2121 | SNDRV_DEVICE_TYPE_PCM_CAPTURE); | 2136 | SNDRV_DEVICE_TYPE_PCM_CAPTURE); |
2122 | return snd_pcm_open(file, pcm, SNDRV_PCM_STREAM_CAPTURE); | 2137 | err = snd_pcm_open(file, pcm, SNDRV_PCM_STREAM_CAPTURE); |
2138 | snd_card_unref(pcm->card); | ||
2139 | return err; | ||
2123 | } | 2140 | } |
2124 | 2141 | ||
2125 | static int snd_pcm_open(struct file *file, struct snd_pcm *pcm, int stream) | 2142 | static int snd_pcm_open(struct file *file, struct snd_pcm *pcm, int stream) |
@@ -2156,6 +2173,10 @@ static int snd_pcm_open(struct file *file, struct snd_pcm *pcm, int stream) | |||
2156 | mutex_unlock(&pcm->open_mutex); | 2173 | mutex_unlock(&pcm->open_mutex); |
2157 | schedule(); | 2174 | schedule(); |
2158 | mutex_lock(&pcm->open_mutex); | 2175 | mutex_lock(&pcm->open_mutex); |
2176 | if (pcm->card->shutdown) { | ||
2177 | err = -ENODEV; | ||
2178 | break; | ||
2179 | } | ||
2159 | if (signal_pending(current)) { | 2180 | if (signal_pending(current)) { |
2160 | err = -ERESTARTSYS; | 2181 | err = -ERESTARTSYS; |
2161 | break; | 2182 | break; |
diff --git a/sound/core/rawmidi.c b/sound/core/rawmidi.c index ebf6e49ad3d4..1bb95aeea084 100644 --- a/sound/core/rawmidi.c +++ b/sound/core/rawmidi.c | |||
@@ -379,8 +379,10 @@ static int snd_rawmidi_open(struct inode *inode, struct file *file) | |||
379 | if (rmidi == NULL) | 379 | if (rmidi == NULL) |
380 | return -ENODEV; | 380 | return -ENODEV; |
381 | 381 | ||
382 | if (!try_module_get(rmidi->card->module)) | 382 | if (!try_module_get(rmidi->card->module)) { |
383 | snd_card_unref(rmidi->card); | ||
383 | return -ENXIO; | 384 | return -ENXIO; |
385 | } | ||
384 | 386 | ||
385 | mutex_lock(&rmidi->open_mutex); | 387 | mutex_lock(&rmidi->open_mutex); |
386 | card = rmidi->card; | 388 | card = rmidi->card; |
@@ -422,6 +424,10 @@ static int snd_rawmidi_open(struct inode *inode, struct file *file) | |||
422 | mutex_unlock(&rmidi->open_mutex); | 424 | mutex_unlock(&rmidi->open_mutex); |
423 | schedule(); | 425 | schedule(); |
424 | mutex_lock(&rmidi->open_mutex); | 426 | mutex_lock(&rmidi->open_mutex); |
427 | if (rmidi->card->shutdown) { | ||
428 | err = -ENODEV; | ||
429 | break; | ||
430 | } | ||
425 | if (signal_pending(current)) { | 431 | if (signal_pending(current)) { |
426 | err = -ERESTARTSYS; | 432 | err = -ERESTARTSYS; |
427 | break; | 433 | break; |
@@ -440,6 +446,7 @@ static int snd_rawmidi_open(struct inode *inode, struct file *file) | |||
440 | #endif | 446 | #endif |
441 | file->private_data = rawmidi_file; | 447 | file->private_data = rawmidi_file; |
442 | mutex_unlock(&rmidi->open_mutex); | 448 | mutex_unlock(&rmidi->open_mutex); |
449 | snd_card_unref(rmidi->card); | ||
443 | return 0; | 450 | return 0; |
444 | 451 | ||
445 | __error: | 452 | __error: |
@@ -447,6 +454,7 @@ static int snd_rawmidi_open(struct inode *inode, struct file *file) | |||
447 | __error_card: | 454 | __error_card: |
448 | mutex_unlock(&rmidi->open_mutex); | 455 | mutex_unlock(&rmidi->open_mutex); |
449 | module_put(rmidi->card->module); | 456 | module_put(rmidi->card->module); |
457 | snd_card_unref(rmidi->card); | ||
450 | return err; | 458 | return err; |
451 | } | 459 | } |
452 | 460 | ||
@@ -991,6 +999,8 @@ static ssize_t snd_rawmidi_read(struct file *file, char __user *buf, size_t coun | |||
991 | spin_unlock_irq(&runtime->lock); | 999 | spin_unlock_irq(&runtime->lock); |
992 | schedule(); | 1000 | schedule(); |
993 | remove_wait_queue(&runtime->sleep, &wait); | 1001 | remove_wait_queue(&runtime->sleep, &wait); |
1002 | if (rfile->rmidi->card->shutdown) | ||
1003 | return -ENODEV; | ||
994 | if (signal_pending(current)) | 1004 | if (signal_pending(current)) |
995 | return result > 0 ? result : -ERESTARTSYS; | 1005 | return result > 0 ? result : -ERESTARTSYS; |
996 | if (!runtime->avail) | 1006 | if (!runtime->avail) |
@@ -1234,6 +1244,8 @@ static ssize_t snd_rawmidi_write(struct file *file, const char __user *buf, | |||
1234 | spin_unlock_irq(&runtime->lock); | 1244 | spin_unlock_irq(&runtime->lock); |
1235 | timeout = schedule_timeout(30 * HZ); | 1245 | timeout = schedule_timeout(30 * HZ); |
1236 | remove_wait_queue(&runtime->sleep, &wait); | 1246 | remove_wait_queue(&runtime->sleep, &wait); |
1247 | if (rfile->rmidi->card->shutdown) | ||
1248 | return -ENODEV; | ||
1237 | if (signal_pending(current)) | 1249 | if (signal_pending(current)) |
1238 | return result > 0 ? result : -ERESTARTSYS; | 1250 | return result > 0 ? result : -ERESTARTSYS; |
1239 | if (!runtime->avail && !timeout) | 1251 | if (!runtime->avail && !timeout) |
@@ -1609,9 +1621,20 @@ static int snd_rawmidi_dev_register(struct snd_device *device) | |||
1609 | static int snd_rawmidi_dev_disconnect(struct snd_device *device) | 1621 | static int snd_rawmidi_dev_disconnect(struct snd_device *device) |
1610 | { | 1622 | { |
1611 | struct snd_rawmidi *rmidi = device->device_data; | 1623 | struct snd_rawmidi *rmidi = device->device_data; |
1624 | int dir; | ||
1612 | 1625 | ||
1613 | mutex_lock(®ister_mutex); | 1626 | mutex_lock(®ister_mutex); |
1627 | mutex_lock(&rmidi->open_mutex); | ||
1628 | wake_up(&rmidi->open_wait); | ||
1614 | list_del_init(&rmidi->list); | 1629 | list_del_init(&rmidi->list); |
1630 | for (dir = 0; dir < 2; dir++) { | ||
1631 | struct snd_rawmidi_substream *s; | ||
1632 | list_for_each_entry(s, &rmidi->streams[dir].substreams, list) { | ||
1633 | if (s->runtime) | ||
1634 | wake_up(&s->runtime->sleep); | ||
1635 | } | ||
1636 | } | ||
1637 | |||
1615 | #ifdef CONFIG_SND_OSSEMUL | 1638 | #ifdef CONFIG_SND_OSSEMUL |
1616 | if (rmidi->ossreg) { | 1639 | if (rmidi->ossreg) { |
1617 | if ((int)rmidi->device == midi_map[rmidi->card->number]) { | 1640 | if ((int)rmidi->device == midi_map[rmidi->card->number]) { |
@@ -1626,6 +1649,7 @@ static int snd_rawmidi_dev_disconnect(struct snd_device *device) | |||
1626 | } | 1649 | } |
1627 | #endif /* CONFIG_SND_OSSEMUL */ | 1650 | #endif /* CONFIG_SND_OSSEMUL */ |
1628 | snd_unregister_device(SNDRV_DEVICE_TYPE_RAWMIDI, rmidi->card, rmidi->device); | 1651 | snd_unregister_device(SNDRV_DEVICE_TYPE_RAWMIDI, rmidi->card, rmidi->device); |
1652 | mutex_unlock(&rmidi->open_mutex); | ||
1629 | mutex_unlock(®ister_mutex); | 1653 | mutex_unlock(®ister_mutex); |
1630 | return 0; | 1654 | return 0; |
1631 | } | 1655 | } |
diff --git a/sound/core/sound.c b/sound/core/sound.c index 643976000ce8..89780c323f19 100644 --- a/sound/core/sound.c +++ b/sound/core/sound.c | |||
@@ -98,6 +98,10 @@ static void snd_request_other(int minor) | |||
98 | * | 98 | * |
99 | * Checks that a minor device with the specified type is registered, and returns | 99 | * Checks that a minor device with the specified type is registered, and returns |
100 | * its user data pointer. | 100 | * its user data pointer. |
101 | * | ||
102 | * This function increments the reference counter of the card instance | ||
103 | * if an associated instance with the given minor number and type is found. | ||
104 | * The caller must call snd_card_unref() appropriately later. | ||
101 | */ | 105 | */ |
102 | void *snd_lookup_minor_data(unsigned int minor, int type) | 106 | void *snd_lookup_minor_data(unsigned int minor, int type) |
103 | { | 107 | { |
@@ -108,9 +112,11 @@ void *snd_lookup_minor_data(unsigned int minor, int type) | |||
108 | return NULL; | 112 | return NULL; |
109 | mutex_lock(&sound_mutex); | 113 | mutex_lock(&sound_mutex); |
110 | mreg = snd_minors[minor]; | 114 | mreg = snd_minors[minor]; |
111 | if (mreg && mreg->type == type) | 115 | if (mreg && mreg->type == type) { |
112 | private_data = mreg->private_data; | 116 | private_data = mreg->private_data; |
113 | else | 117 | if (mreg->card_ptr) |
118 | atomic_inc(&mreg->card_ptr->refcount); | ||
119 | } else | ||
114 | private_data = NULL; | 120 | private_data = NULL; |
115 | mutex_unlock(&sound_mutex); | 121 | mutex_unlock(&sound_mutex); |
116 | return private_data; | 122 | return private_data; |
@@ -275,6 +281,7 @@ int snd_register_device_for_dev(int type, struct snd_card *card, int dev, | |||
275 | preg->device = dev; | 281 | preg->device = dev; |
276 | preg->f_ops = f_ops; | 282 | preg->f_ops = f_ops; |
277 | preg->private_data = private_data; | 283 | preg->private_data = private_data; |
284 | preg->card_ptr = card; | ||
278 | mutex_lock(&sound_mutex); | 285 | mutex_lock(&sound_mutex); |
279 | #ifdef CONFIG_SND_DYNAMIC_MINORS | 286 | #ifdef CONFIG_SND_DYNAMIC_MINORS |
280 | minor = snd_find_free_minor(type); | 287 | minor = snd_find_free_minor(type); |
diff --git a/sound/core/sound_oss.c b/sound/core/sound_oss.c index e9528333e36d..e1d79ee35906 100644 --- a/sound/core/sound_oss.c +++ b/sound/core/sound_oss.c | |||
@@ -40,6 +40,9 @@ | |||
40 | static struct snd_minor *snd_oss_minors[SNDRV_OSS_MINORS]; | 40 | static struct snd_minor *snd_oss_minors[SNDRV_OSS_MINORS]; |
41 | static DEFINE_MUTEX(sound_oss_mutex); | 41 | static DEFINE_MUTEX(sound_oss_mutex); |
42 | 42 | ||
43 | /* NOTE: This function increments the refcount of the associated card like | ||
44 | * snd_lookup_minor_data(); the caller must call snd_card_unref() appropriately | ||
45 | */ | ||
43 | void *snd_lookup_oss_minor_data(unsigned int minor, int type) | 46 | void *snd_lookup_oss_minor_data(unsigned int minor, int type) |
44 | { | 47 | { |
45 | struct snd_minor *mreg; | 48 | struct snd_minor *mreg; |
@@ -49,9 +52,11 @@ void *snd_lookup_oss_minor_data(unsigned int minor, int type) | |||
49 | return NULL; | 52 | return NULL; |
50 | mutex_lock(&sound_oss_mutex); | 53 | mutex_lock(&sound_oss_mutex); |
51 | mreg = snd_oss_minors[minor]; | 54 | mreg = snd_oss_minors[minor]; |
52 | if (mreg && mreg->type == type) | 55 | if (mreg && mreg->type == type) { |
53 | private_data = mreg->private_data; | 56 | private_data = mreg->private_data; |
54 | else | 57 | if (mreg->card_ptr) |
58 | atomic_inc(&mreg->card_ptr->refcount); | ||
59 | } else | ||
55 | private_data = NULL; | 60 | private_data = NULL; |
56 | mutex_unlock(&sound_oss_mutex); | 61 | mutex_unlock(&sound_oss_mutex); |
57 | return private_data; | 62 | return private_data; |
@@ -123,6 +128,7 @@ int snd_register_oss_device(int type, struct snd_card *card, int dev, | |||
123 | preg->device = dev; | 128 | preg->device = dev; |
124 | preg->f_ops = f_ops; | 129 | preg->f_ops = f_ops; |
125 | preg->private_data = private_data; | 130 | preg->private_data = private_data; |
131 | preg->card_ptr = card; | ||
126 | mutex_lock(&sound_oss_mutex); | 132 | mutex_lock(&sound_oss_mutex); |
127 | snd_oss_minors[minor] = preg; | 133 | snd_oss_minors[minor] = preg; |
128 | minor_unit = SNDRV_MINOR_OSS_DEVICE(minor); | 134 | minor_unit = SNDRV_MINOR_OSS_DEVICE(minor); |
diff --git a/sound/isa/opti9xx/miro.c b/sound/isa/opti9xx/miro.c index 3d1afb612b35..4a7ff4e8985b 100644 --- a/sound/isa/opti9xx/miro.c +++ b/sound/isa/opti9xx/miro.c | |||
@@ -1286,7 +1286,6 @@ static int __devinit snd_miro_probe(struct snd_card *card) | |||
1286 | 1286 | ||
1287 | error = snd_card_miro_aci_detect(card, miro); | 1287 | error = snd_card_miro_aci_detect(card, miro); |
1288 | if (error < 0) { | 1288 | if (error < 0) { |
1289 | snd_card_free(card); | ||
1290 | snd_printk(KERN_ERR "unable to detect aci chip\n"); | 1289 | snd_printk(KERN_ERR "unable to detect aci chip\n"); |
1291 | return -ENODEV; | 1290 | return -ENODEV; |
1292 | } | 1291 | } |
diff --git a/sound/pci/als300.c b/sound/pci/als300.c index 00f157a2cf64..5af3cb6b0c18 100644 --- a/sound/pci/als300.c +++ b/sound/pci/als300.c | |||
@@ -394,6 +394,8 @@ static int snd_als300_playback_open(struct snd_pcm_substream *substream) | |||
394 | struct snd_als300_substream_data *data = kzalloc(sizeof(*data), | 394 | struct snd_als300_substream_data *data = kzalloc(sizeof(*data), |
395 | GFP_KERNEL); | 395 | GFP_KERNEL); |
396 | 396 | ||
397 | if (!data) | ||
398 | return -ENOMEM; | ||
397 | snd_als300_dbgcallenter(); | 399 | snd_als300_dbgcallenter(); |
398 | chip->playback_substream = substream; | 400 | chip->playback_substream = substream; |
399 | runtime->hw = snd_als300_playback_hw; | 401 | runtime->hw = snd_als300_playback_hw; |
@@ -425,6 +427,8 @@ static int snd_als300_capture_open(struct snd_pcm_substream *substream) | |||
425 | struct snd_als300_substream_data *data = kzalloc(sizeof(*data), | 427 | struct snd_als300_substream_data *data = kzalloc(sizeof(*data), |
426 | GFP_KERNEL); | 428 | GFP_KERNEL); |
427 | 429 | ||
430 | if (!data) | ||
431 | return -ENOMEM; | ||
428 | snd_als300_dbgcallenter(); | 432 | snd_als300_dbgcallenter(); |
429 | chip->capture_substream = substream; | 433 | chip->capture_substream = substream; |
430 | runtime->hw = snd_als300_capture_hw; | 434 | runtime->hw = snd_als300_capture_hw; |
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 48d9d609f89b..f7397ad02a0d 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
@@ -5677,6 +5677,7 @@ static const struct hda_verb alc268_beep_init_verbs[] = { | |||
5677 | 5677 | ||
5678 | enum { | 5678 | enum { |
5679 | ALC268_FIXUP_INV_DMIC, | 5679 | ALC268_FIXUP_INV_DMIC, |
5680 | ALC268_FIXUP_HP_EAPD, | ||
5680 | }; | 5681 | }; |
5681 | 5682 | ||
5682 | static const struct alc_fixup alc268_fixups[] = { | 5683 | static const struct alc_fixup alc268_fixups[] = { |
@@ -5684,10 +5685,26 @@ static const struct alc_fixup alc268_fixups[] = { | |||
5684 | .type = ALC_FIXUP_FUNC, | 5685 | .type = ALC_FIXUP_FUNC, |
5685 | .v.func = alc_fixup_inv_dmic_0x12, | 5686 | .v.func = alc_fixup_inv_dmic_0x12, |
5686 | }, | 5687 | }, |
5688 | [ALC268_FIXUP_HP_EAPD] = { | ||
5689 | .type = ALC_FIXUP_VERBS, | ||
5690 | .v.verbs = (const struct hda_verb[]) { | ||
5691 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 0}, | ||
5692 | {} | ||
5693 | } | ||
5694 | }, | ||
5687 | }; | 5695 | }; |
5688 | 5696 | ||
5689 | static const struct alc_model_fixup alc268_fixup_models[] = { | 5697 | static const struct alc_model_fixup alc268_fixup_models[] = { |
5690 | {.id = ALC268_FIXUP_INV_DMIC, .name = "inv-dmic"}, | 5698 | {.id = ALC268_FIXUP_INV_DMIC, .name = "inv-dmic"}, |
5699 | {.id = ALC268_FIXUP_HP_EAPD, .name = "hp-eapd"}, | ||
5700 | {} | ||
5701 | }; | ||
5702 | |||
5703 | static const struct snd_pci_quirk alc268_fixup_tbl[] = { | ||
5704 | /* below is codec SSID since multiple Toshiba laptops have the | ||
5705 | * same PCI SSID 1179:ff00 | ||
5706 | */ | ||
5707 | SND_PCI_QUIRK(0x1179, 0xff06, "Toshiba P200", ALC268_FIXUP_HP_EAPD), | ||
5691 | {} | 5708 | {} |
5692 | }; | 5709 | }; |
5693 | 5710 | ||
@@ -5722,7 +5739,7 @@ static int patch_alc268(struct hda_codec *codec) | |||
5722 | 5739 | ||
5723 | spec = codec->spec; | 5740 | spec = codec->spec; |
5724 | 5741 | ||
5725 | alc_pick_fixup(codec, alc268_fixup_models, NULL, alc268_fixups); | 5742 | alc_pick_fixup(codec, alc268_fixup_models, alc268_fixup_tbl, alc268_fixups); |
5726 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE); | 5743 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE); |
5727 | 5744 | ||
5728 | /* automatic parse from the BIOS config */ | 5745 | /* automatic parse from the BIOS config */ |
@@ -6188,6 +6205,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { | |||
6188 | SND_PCI_QUIRK(0x17aa, 0x21e9, "Thinkpad Edge 15", ALC269_FIXUP_SKU_IGNORE), | 6205 | SND_PCI_QUIRK(0x17aa, 0x21e9, "Thinkpad Edge 15", ALC269_FIXUP_SKU_IGNORE), |
6189 | SND_PCI_QUIRK(0x17aa, 0x21f6, "Thinkpad T530", ALC269_FIXUP_LENOVO_DOCK), | 6206 | SND_PCI_QUIRK(0x17aa, 0x21f6, "Thinkpad T530", ALC269_FIXUP_LENOVO_DOCK), |
6190 | SND_PCI_QUIRK(0x17aa, 0x21fa, "Thinkpad X230", ALC269_FIXUP_LENOVO_DOCK), | 6207 | SND_PCI_QUIRK(0x17aa, 0x21fa, "Thinkpad X230", ALC269_FIXUP_LENOVO_DOCK), |
6208 | SND_PCI_QUIRK(0x17aa, 0x21f3, "Thinkpad T430", ALC269_FIXUP_LENOVO_DOCK), | ||
6191 | SND_PCI_QUIRK(0x17aa, 0x21fb, "Thinkpad T430s", ALC269_FIXUP_LENOVO_DOCK), | 6209 | SND_PCI_QUIRK(0x17aa, 0x21fb, "Thinkpad T430s", ALC269_FIXUP_LENOVO_DOCK), |
6192 | SND_PCI_QUIRK(0x17aa, 0x2203, "Thinkpad X230 Tablet", ALC269_FIXUP_LENOVO_DOCK), | 6210 | SND_PCI_QUIRK(0x17aa, 0x2203, "Thinkpad X230 Tablet", ALC269_FIXUP_LENOVO_DOCK), |
6193 | SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_PCM_44K), | 6211 | SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_PCM_44K), |
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index 770013ff556f..9ba8af056170 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c | |||
@@ -1763,6 +1763,8 @@ static const struct snd_pci_quirk stac92hd83xxx_cfg_tbl[] = { | |||
1763 | "HP", STAC_HP_ZEPHYR), | 1763 | "HP", STAC_HP_ZEPHYR), |
1764 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3660, | 1764 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3660, |
1765 | "HP Mini", STAC_92HD83XXX_HP_LED), | 1765 | "HP Mini", STAC_92HD83XXX_HP_LED), |
1766 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x144E, | ||
1767 | "HP Pavilion dv5", STAC_92HD83XXX_HP_INV_LED), | ||
1766 | {} /* terminator */ | 1768 | {} /* terminator */ |
1767 | }; | 1769 | }; |
1768 | 1770 | ||
diff --git a/sound/pci/ice1712/ice1724.c b/sound/pci/ice1712/ice1724.c index 3050a5279253..245d874891ba 100644 --- a/sound/pci/ice1712/ice1724.c +++ b/sound/pci/ice1712/ice1724.c | |||
@@ -2859,7 +2859,12 @@ static int snd_vt1724_resume(struct device *dev) | |||
2859 | ice->set_spdif_clock(ice, 0); | 2859 | ice->set_spdif_clock(ice, 0); |
2860 | } else { | 2860 | } else { |
2861 | /* internal on-card clock */ | 2861 | /* internal on-card clock */ |
2862 | snd_vt1724_set_pro_rate(ice, ice->pro_rate_default, 1); | 2862 | int rate; |
2863 | if (ice->cur_rate) | ||
2864 | rate = ice->cur_rate; | ||
2865 | else | ||
2866 | rate = ice->pro_rate_default; | ||
2867 | snd_vt1724_set_pro_rate(ice, rate, 1); | ||
2863 | } | 2868 | } |
2864 | 2869 | ||
2865 | update_spdif_bits(ice, ice->pm_saved_spdif_ctrl); | 2870 | update_spdif_bits(ice, ice->pm_saved_spdif_ctrl); |
diff --git a/sound/pci/rme9652/hdspm.c b/sound/pci/rme9652/hdspm.c index b12308b5ba2a..f1cd1e387801 100644 --- a/sound/pci/rme9652/hdspm.c +++ b/sound/pci/rme9652/hdspm.c | |||
@@ -971,6 +971,7 @@ static inline void snd_hdspm_initialize_midi_flush(struct hdspm *hdspm); | |||
971 | static int hdspm_update_simple_mixer_controls(struct hdspm *hdspm); | 971 | static int hdspm_update_simple_mixer_controls(struct hdspm *hdspm); |
972 | static int hdspm_autosync_ref(struct hdspm *hdspm); | 972 | static int hdspm_autosync_ref(struct hdspm *hdspm); |
973 | static int snd_hdspm_set_defaults(struct hdspm *hdspm); | 973 | static int snd_hdspm_set_defaults(struct hdspm *hdspm); |
974 | static int hdspm_system_clock_mode(struct hdspm *hdspm); | ||
974 | static void hdspm_set_sgbuf(struct hdspm *hdspm, | 975 | static void hdspm_set_sgbuf(struct hdspm *hdspm, |
975 | struct snd_pcm_substream *substream, | 976 | struct snd_pcm_substream *substream, |
976 | unsigned int reg, int channels); | 977 | unsigned int reg, int channels); |
@@ -1989,10 +1990,14 @@ static int hdspm_get_system_sample_rate(struct hdspm *hdspm) | |||
1989 | rate = hdspm_calc_dds_value(hdspm, period); | 1990 | rate = hdspm_calc_dds_value(hdspm, period); |
1990 | 1991 | ||
1991 | if (rate > 207000) { | 1992 | if (rate > 207000) { |
1992 | /* Unreasonable high sample rate as seen on PCI MADI cards. | 1993 | /* Unreasonable high sample rate as seen on PCI MADI cards. */ |
1993 | * Use the cached value instead. | 1994 | if (0 == hdspm_system_clock_mode(hdspm)) { |
1994 | */ | 1995 | /* master mode, return internal sample rate */ |
1995 | rate = hdspm->system_sample_rate; | 1996 | rate = hdspm->system_sample_rate; |
1997 | } else { | ||
1998 | /* slave mode, return external sample rate */ | ||
1999 | rate = hdspm_external_sample_rate(hdspm); | ||
2000 | } | ||
1996 | } | 2001 | } |
1997 | 2002 | ||
1998 | return rate; | 2003 | return rate; |
@@ -2000,12 +2005,14 @@ static int hdspm_get_system_sample_rate(struct hdspm *hdspm) | |||
2000 | 2005 | ||
2001 | 2006 | ||
2002 | #define HDSPM_SYSTEM_SAMPLE_RATE(xname, xindex) \ | 2007 | #define HDSPM_SYSTEM_SAMPLE_RATE(xname, xindex) \ |
2003 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ | 2008 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
2004 | .name = xname, \ | 2009 | .name = xname, \ |
2005 | .index = xindex, \ | 2010 | .index = xindex, \ |
2006 | .access = SNDRV_CTL_ELEM_ACCESS_READ, \ | 2011 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE |\ |
2007 | .info = snd_hdspm_info_system_sample_rate, \ | 2012 | SNDRV_CTL_ELEM_ACCESS_VOLATILE, \ |
2008 | .get = snd_hdspm_get_system_sample_rate \ | 2013 | .info = snd_hdspm_info_system_sample_rate, \ |
2014 | .put = snd_hdspm_put_system_sample_rate, \ | ||
2015 | .get = snd_hdspm_get_system_sample_rate \ | ||
2009 | } | 2016 | } |
2010 | 2017 | ||
2011 | static int snd_hdspm_info_system_sample_rate(struct snd_kcontrol *kcontrol, | 2018 | static int snd_hdspm_info_system_sample_rate(struct snd_kcontrol *kcontrol, |
@@ -2030,6 +2037,16 @@ static int snd_hdspm_get_system_sample_rate(struct snd_kcontrol *kcontrol, | |||
2030 | return 0; | 2037 | return 0; |
2031 | } | 2038 | } |
2032 | 2039 | ||
2040 | static int snd_hdspm_put_system_sample_rate(struct snd_kcontrol *kcontrol, | ||
2041 | struct snd_ctl_elem_value * | ||
2042 | ucontrol) | ||
2043 | { | ||
2044 | struct hdspm *hdspm = snd_kcontrol_chip(kcontrol); | ||
2045 | |||
2046 | hdspm_set_dds_value(hdspm, ucontrol->value.enumerated.item[0]); | ||
2047 | return 0; | ||
2048 | } | ||
2049 | |||
2033 | 2050 | ||
2034 | /** | 2051 | /** |
2035 | * Returns the WordClock sample rate class for the given card. | 2052 | * Returns the WordClock sample rate class for the given card. |
@@ -2163,6 +2180,7 @@ static int snd_hdspm_get_autosync_sample_rate(struct snd_kcontrol *kcontrol, | |||
2163 | hdspm_get_s1_sample_rate(hdspm, | 2180 | hdspm_get_s1_sample_rate(hdspm, |
2164 | kcontrol->private_value-1); | 2181 | kcontrol->private_value-1); |
2165 | } | 2182 | } |
2183 | break; | ||
2166 | 2184 | ||
2167 | case AIO: | 2185 | case AIO: |
2168 | switch (kcontrol->private_value) { | 2186 | switch (kcontrol->private_value) { |
@@ -2183,6 +2201,7 @@ static int snd_hdspm_get_autosync_sample_rate(struct snd_kcontrol *kcontrol, | |||
2183 | hdspm_get_s1_sample_rate(hdspm, | 2201 | hdspm_get_s1_sample_rate(hdspm, |
2184 | ucontrol->id.index-1); | 2202 | ucontrol->id.index-1); |
2185 | } | 2203 | } |
2204 | break; | ||
2186 | 2205 | ||
2187 | case AES32: | 2206 | case AES32: |
2188 | 2207 | ||
@@ -2204,8 +2223,23 @@ static int snd_hdspm_get_autosync_sample_rate(struct snd_kcontrol *kcontrol, | |||
2204 | hdspm_get_s1_sample_rate(hdspm, | 2223 | hdspm_get_s1_sample_rate(hdspm, |
2205 | kcontrol->private_value-1); | 2224 | kcontrol->private_value-1); |
2206 | break; | 2225 | break; |
2226 | } | ||
2227 | break; | ||
2207 | 2228 | ||
2229 | case MADI: | ||
2230 | case MADIface: | ||
2231 | { | ||
2232 | int rate = hdspm_external_sample_rate(hdspm); | ||
2233 | int i, selected_rate = 0; | ||
2234 | for (i = 1; i < 10; i++) | ||
2235 | if (HDSPM_bit2freq(i) == rate) { | ||
2236 | selected_rate = i; | ||
2237 | break; | ||
2238 | } | ||
2239 | ucontrol->value.enumerated.item[0] = selected_rate; | ||
2208 | } | 2240 | } |
2241 | break; | ||
2242 | |||
2209 | default: | 2243 | default: |
2210 | break; | 2244 | break; |
2211 | } | 2245 | } |
@@ -2430,7 +2464,7 @@ static int snd_hdspm_put_clock_source(struct snd_kcontrol *kcontrol, | |||
2430 | 2464 | ||
2431 | 2465 | ||
2432 | #define HDSPM_PREF_SYNC_REF(xname, xindex) \ | 2466 | #define HDSPM_PREF_SYNC_REF(xname, xindex) \ |
2433 | {.iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ | 2467 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
2434 | .name = xname, \ | 2468 | .name = xname, \ |
2435 | .index = xindex, \ | 2469 | .index = xindex, \ |
2436 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE |\ | 2470 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE |\ |
@@ -2766,12 +2800,12 @@ static int snd_hdspm_put_pref_sync_ref(struct snd_kcontrol *kcontrol, | |||
2766 | 2800 | ||
2767 | 2801 | ||
2768 | #define HDSPM_AUTOSYNC_REF(xname, xindex) \ | 2802 | #define HDSPM_AUTOSYNC_REF(xname, xindex) \ |
2769 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ | 2803 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
2770 | .name = xname, \ | 2804 | .name = xname, \ |
2771 | .index = xindex, \ | 2805 | .index = xindex, \ |
2772 | .access = SNDRV_CTL_ELEM_ACCESS_READ, \ | 2806 | .access = SNDRV_CTL_ELEM_ACCESS_READ, \ |
2773 | .info = snd_hdspm_info_autosync_ref, \ | 2807 | .info = snd_hdspm_info_autosync_ref, \ |
2774 | .get = snd_hdspm_get_autosync_ref, \ | 2808 | .get = snd_hdspm_get_autosync_ref, \ |
2775 | } | 2809 | } |
2776 | 2810 | ||
2777 | static int hdspm_autosync_ref(struct hdspm *hdspm) | 2811 | static int hdspm_autosync_ref(struct hdspm *hdspm) |
@@ -2855,12 +2889,12 @@ static int snd_hdspm_get_autosync_ref(struct snd_kcontrol *kcontrol, | |||
2855 | 2889 | ||
2856 | 2890 | ||
2857 | #define HDSPM_LINE_OUT(xname, xindex) \ | 2891 | #define HDSPM_LINE_OUT(xname, xindex) \ |
2858 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ | 2892 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
2859 | .name = xname, \ | 2893 | .name = xname, \ |
2860 | .index = xindex, \ | 2894 | .index = xindex, \ |
2861 | .info = snd_hdspm_info_line_out, \ | 2895 | .info = snd_hdspm_info_line_out, \ |
2862 | .get = snd_hdspm_get_line_out, \ | 2896 | .get = snd_hdspm_get_line_out, \ |
2863 | .put = snd_hdspm_put_line_out \ | 2897 | .put = snd_hdspm_put_line_out \ |
2864 | } | 2898 | } |
2865 | 2899 | ||
2866 | static int hdspm_line_out(struct hdspm * hdspm) | 2900 | static int hdspm_line_out(struct hdspm * hdspm) |
@@ -2912,12 +2946,12 @@ static int snd_hdspm_put_line_out(struct snd_kcontrol *kcontrol, | |||
2912 | 2946 | ||
2913 | 2947 | ||
2914 | #define HDSPM_TX_64(xname, xindex) \ | 2948 | #define HDSPM_TX_64(xname, xindex) \ |
2915 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ | 2949 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
2916 | .name = xname, \ | 2950 | .name = xname, \ |
2917 | .index = xindex, \ | 2951 | .index = xindex, \ |
2918 | .info = snd_hdspm_info_tx_64, \ | 2952 | .info = snd_hdspm_info_tx_64, \ |
2919 | .get = snd_hdspm_get_tx_64, \ | 2953 | .get = snd_hdspm_get_tx_64, \ |
2920 | .put = snd_hdspm_put_tx_64 \ | 2954 | .put = snd_hdspm_put_tx_64 \ |
2921 | } | 2955 | } |
2922 | 2956 | ||
2923 | static int hdspm_tx_64(struct hdspm * hdspm) | 2957 | static int hdspm_tx_64(struct hdspm * hdspm) |
@@ -2968,12 +3002,12 @@ static int snd_hdspm_put_tx_64(struct snd_kcontrol *kcontrol, | |||
2968 | 3002 | ||
2969 | 3003 | ||
2970 | #define HDSPM_C_TMS(xname, xindex) \ | 3004 | #define HDSPM_C_TMS(xname, xindex) \ |
2971 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ | 3005 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
2972 | .name = xname, \ | 3006 | .name = xname, \ |
2973 | .index = xindex, \ | 3007 | .index = xindex, \ |
2974 | .info = snd_hdspm_info_c_tms, \ | 3008 | .info = snd_hdspm_info_c_tms, \ |
2975 | .get = snd_hdspm_get_c_tms, \ | 3009 | .get = snd_hdspm_get_c_tms, \ |
2976 | .put = snd_hdspm_put_c_tms \ | 3010 | .put = snd_hdspm_put_c_tms \ |
2977 | } | 3011 | } |
2978 | 3012 | ||
2979 | static int hdspm_c_tms(struct hdspm * hdspm) | 3013 | static int hdspm_c_tms(struct hdspm * hdspm) |
@@ -3024,12 +3058,12 @@ static int snd_hdspm_put_c_tms(struct snd_kcontrol *kcontrol, | |||
3024 | 3058 | ||
3025 | 3059 | ||
3026 | #define HDSPM_SAFE_MODE(xname, xindex) \ | 3060 | #define HDSPM_SAFE_MODE(xname, xindex) \ |
3027 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ | 3061 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
3028 | .name = xname, \ | 3062 | .name = xname, \ |
3029 | .index = xindex, \ | 3063 | .index = xindex, \ |
3030 | .info = snd_hdspm_info_safe_mode, \ | 3064 | .info = snd_hdspm_info_safe_mode, \ |
3031 | .get = snd_hdspm_get_safe_mode, \ | 3065 | .get = snd_hdspm_get_safe_mode, \ |
3032 | .put = snd_hdspm_put_safe_mode \ | 3066 | .put = snd_hdspm_put_safe_mode \ |
3033 | } | 3067 | } |
3034 | 3068 | ||
3035 | static int hdspm_safe_mode(struct hdspm * hdspm) | 3069 | static int hdspm_safe_mode(struct hdspm * hdspm) |
@@ -3080,12 +3114,12 @@ static int snd_hdspm_put_safe_mode(struct snd_kcontrol *kcontrol, | |||
3080 | 3114 | ||
3081 | 3115 | ||
3082 | #define HDSPM_EMPHASIS(xname, xindex) \ | 3116 | #define HDSPM_EMPHASIS(xname, xindex) \ |
3083 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ | 3117 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
3084 | .name = xname, \ | 3118 | .name = xname, \ |
3085 | .index = xindex, \ | 3119 | .index = xindex, \ |
3086 | .info = snd_hdspm_info_emphasis, \ | 3120 | .info = snd_hdspm_info_emphasis, \ |
3087 | .get = snd_hdspm_get_emphasis, \ | 3121 | .get = snd_hdspm_get_emphasis, \ |
3088 | .put = snd_hdspm_put_emphasis \ | 3122 | .put = snd_hdspm_put_emphasis \ |
3089 | } | 3123 | } |
3090 | 3124 | ||
3091 | static int hdspm_emphasis(struct hdspm * hdspm) | 3125 | static int hdspm_emphasis(struct hdspm * hdspm) |
@@ -3136,12 +3170,12 @@ static int snd_hdspm_put_emphasis(struct snd_kcontrol *kcontrol, | |||
3136 | 3170 | ||
3137 | 3171 | ||
3138 | #define HDSPM_DOLBY(xname, xindex) \ | 3172 | #define HDSPM_DOLBY(xname, xindex) \ |
3139 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ | 3173 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
3140 | .name = xname, \ | 3174 | .name = xname, \ |
3141 | .index = xindex, \ | 3175 | .index = xindex, \ |
3142 | .info = snd_hdspm_info_dolby, \ | 3176 | .info = snd_hdspm_info_dolby, \ |
3143 | .get = snd_hdspm_get_dolby, \ | 3177 | .get = snd_hdspm_get_dolby, \ |
3144 | .put = snd_hdspm_put_dolby \ | 3178 | .put = snd_hdspm_put_dolby \ |
3145 | } | 3179 | } |
3146 | 3180 | ||
3147 | static int hdspm_dolby(struct hdspm * hdspm) | 3181 | static int hdspm_dolby(struct hdspm * hdspm) |
@@ -3192,12 +3226,12 @@ static int snd_hdspm_put_dolby(struct snd_kcontrol *kcontrol, | |||
3192 | 3226 | ||
3193 | 3227 | ||
3194 | #define HDSPM_PROFESSIONAL(xname, xindex) \ | 3228 | #define HDSPM_PROFESSIONAL(xname, xindex) \ |
3195 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ | 3229 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
3196 | .name = xname, \ | 3230 | .name = xname, \ |
3197 | .index = xindex, \ | 3231 | .index = xindex, \ |
3198 | .info = snd_hdspm_info_professional, \ | 3232 | .info = snd_hdspm_info_professional, \ |
3199 | .get = snd_hdspm_get_professional, \ | 3233 | .get = snd_hdspm_get_professional, \ |
3200 | .put = snd_hdspm_put_professional \ | 3234 | .put = snd_hdspm_put_professional \ |
3201 | } | 3235 | } |
3202 | 3236 | ||
3203 | static int hdspm_professional(struct hdspm * hdspm) | 3237 | static int hdspm_professional(struct hdspm * hdspm) |
@@ -3247,12 +3281,12 @@ static int snd_hdspm_put_professional(struct snd_kcontrol *kcontrol, | |||
3247 | } | 3281 | } |
3248 | 3282 | ||
3249 | #define HDSPM_INPUT_SELECT(xname, xindex) \ | 3283 | #define HDSPM_INPUT_SELECT(xname, xindex) \ |
3250 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ | 3284 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
3251 | .name = xname, \ | 3285 | .name = xname, \ |
3252 | .index = xindex, \ | 3286 | .index = xindex, \ |
3253 | .info = snd_hdspm_info_input_select, \ | 3287 | .info = snd_hdspm_info_input_select, \ |
3254 | .get = snd_hdspm_get_input_select, \ | 3288 | .get = snd_hdspm_get_input_select, \ |
3255 | .put = snd_hdspm_put_input_select \ | 3289 | .put = snd_hdspm_put_input_select \ |
3256 | } | 3290 | } |
3257 | 3291 | ||
3258 | static int hdspm_input_select(struct hdspm * hdspm) | 3292 | static int hdspm_input_select(struct hdspm * hdspm) |
@@ -3319,12 +3353,12 @@ static int snd_hdspm_put_input_select(struct snd_kcontrol *kcontrol, | |||
3319 | 3353 | ||
3320 | 3354 | ||
3321 | #define HDSPM_DS_WIRE(xname, xindex) \ | 3355 | #define HDSPM_DS_WIRE(xname, xindex) \ |
3322 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ | 3356 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
3323 | .name = xname, \ | 3357 | .name = xname, \ |
3324 | .index = xindex, \ | 3358 | .index = xindex, \ |
3325 | .info = snd_hdspm_info_ds_wire, \ | 3359 | .info = snd_hdspm_info_ds_wire, \ |
3326 | .get = snd_hdspm_get_ds_wire, \ | 3360 | .get = snd_hdspm_get_ds_wire, \ |
3327 | .put = snd_hdspm_put_ds_wire \ | 3361 | .put = snd_hdspm_put_ds_wire \ |
3328 | } | 3362 | } |
3329 | 3363 | ||
3330 | static int hdspm_ds_wire(struct hdspm * hdspm) | 3364 | static int hdspm_ds_wire(struct hdspm * hdspm) |
@@ -3391,12 +3425,12 @@ static int snd_hdspm_put_ds_wire(struct snd_kcontrol *kcontrol, | |||
3391 | 3425 | ||
3392 | 3426 | ||
3393 | #define HDSPM_QS_WIRE(xname, xindex) \ | 3427 | #define HDSPM_QS_WIRE(xname, xindex) \ |
3394 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ | 3428 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
3395 | .name = xname, \ | 3429 | .name = xname, \ |
3396 | .index = xindex, \ | 3430 | .index = xindex, \ |
3397 | .info = snd_hdspm_info_qs_wire, \ | 3431 | .info = snd_hdspm_info_qs_wire, \ |
3398 | .get = snd_hdspm_get_qs_wire, \ | 3432 | .get = snd_hdspm_get_qs_wire, \ |
3399 | .put = snd_hdspm_put_qs_wire \ | 3433 | .put = snd_hdspm_put_qs_wire \ |
3400 | } | 3434 | } |
3401 | 3435 | ||
3402 | static int hdspm_qs_wire(struct hdspm * hdspm) | 3436 | static int hdspm_qs_wire(struct hdspm * hdspm) |
@@ -3563,15 +3597,15 @@ static int snd_hdspm_put_madi_speedmode(struct snd_kcontrol *kcontrol, | |||
3563 | } | 3597 | } |
3564 | 3598 | ||
3565 | #define HDSPM_MIXER(xname, xindex) \ | 3599 | #define HDSPM_MIXER(xname, xindex) \ |
3566 | { .iface = SNDRV_CTL_ELEM_IFACE_HWDEP, \ | 3600 | { .iface = SNDRV_CTL_ELEM_IFACE_HWDEP, \ |
3567 | .name = xname, \ | 3601 | .name = xname, \ |
3568 | .index = xindex, \ | 3602 | .index = xindex, \ |
3569 | .device = 0, \ | 3603 | .device = 0, \ |
3570 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | \ | 3604 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | \ |
3571 | SNDRV_CTL_ELEM_ACCESS_VOLATILE, \ | 3605 | SNDRV_CTL_ELEM_ACCESS_VOLATILE, \ |
3572 | .info = snd_hdspm_info_mixer, \ | 3606 | .info = snd_hdspm_info_mixer, \ |
3573 | .get = snd_hdspm_get_mixer, \ | 3607 | .get = snd_hdspm_get_mixer, \ |
3574 | .put = snd_hdspm_put_mixer \ | 3608 | .put = snd_hdspm_put_mixer \ |
3575 | } | 3609 | } |
3576 | 3610 | ||
3577 | static int snd_hdspm_info_mixer(struct snd_kcontrol *kcontrol, | 3611 | static int snd_hdspm_info_mixer(struct snd_kcontrol *kcontrol, |
@@ -3670,12 +3704,12 @@ static int snd_hdspm_put_mixer(struct snd_kcontrol *kcontrol, | |||
3670 | */ | 3704 | */ |
3671 | 3705 | ||
3672 | #define HDSPM_PLAYBACK_MIXER \ | 3706 | #define HDSPM_PLAYBACK_MIXER \ |
3673 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ | 3707 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
3674 | .access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_WRITE | \ | 3708 | .access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_WRITE | \ |
3675 | SNDRV_CTL_ELEM_ACCESS_VOLATILE, \ | 3709 | SNDRV_CTL_ELEM_ACCESS_VOLATILE, \ |
3676 | .info = snd_hdspm_info_playback_mixer, \ | 3710 | .info = snd_hdspm_info_playback_mixer, \ |
3677 | .get = snd_hdspm_get_playback_mixer, \ | 3711 | .get = snd_hdspm_get_playback_mixer, \ |
3678 | .put = snd_hdspm_put_playback_mixer \ | 3712 | .put = snd_hdspm_put_playback_mixer \ |
3679 | } | 3713 | } |
3680 | 3714 | ||
3681 | static int snd_hdspm_info_playback_mixer(struct snd_kcontrol *kcontrol, | 3715 | static int snd_hdspm_info_playback_mixer(struct snd_kcontrol *kcontrol, |
@@ -3851,12 +3885,17 @@ static int hdspm_sync_in_sync_check(struct hdspm *hdspm) | |||
3851 | break; | 3885 | break; |
3852 | 3886 | ||
3853 | case MADI: | 3887 | case MADI: |
3854 | case AES32: | 3888 | status = hdspm_read(hdspm, HDSPM_statusRegister); |
3855 | status = hdspm_read(hdspm, HDSPM_statusRegister2); | ||
3856 | lock = (status & HDSPM_syncInLock) ? 1 : 0; | 3889 | lock = (status & HDSPM_syncInLock) ? 1 : 0; |
3857 | sync = (status & HDSPM_syncInSync) ? 1 : 0; | 3890 | sync = (status & HDSPM_syncInSync) ? 1 : 0; |
3858 | break; | 3891 | break; |
3859 | 3892 | ||
3893 | case AES32: | ||
3894 | status = hdspm_read(hdspm, HDSPM_statusRegister2); | ||
3895 | lock = (status & 0x100000) ? 1 : 0; | ||
3896 | sync = (status & 0x200000) ? 1 : 0; | ||
3897 | break; | ||
3898 | |||
3860 | case MADIface: | 3899 | case MADIface: |
3861 | break; | 3900 | break; |
3862 | } | 3901 | } |
@@ -3942,6 +3981,7 @@ static int snd_hdspm_get_sync_check(struct snd_kcontrol *kcontrol, | |||
3942 | default: | 3981 | default: |
3943 | val = hdspm_s1_sync_check(hdspm, ucontrol->id.index-1); | 3982 | val = hdspm_s1_sync_check(hdspm, ucontrol->id.index-1); |
3944 | } | 3983 | } |
3984 | break; | ||
3945 | 3985 | ||
3946 | case AIO: | 3986 | case AIO: |
3947 | switch (kcontrol->private_value) { | 3987 | switch (kcontrol->private_value) { |
@@ -3954,6 +3994,7 @@ static int snd_hdspm_get_sync_check(struct snd_kcontrol *kcontrol, | |||
3954 | default: | 3994 | default: |
3955 | val = hdspm_s1_sync_check(hdspm, ucontrol->id.index-1); | 3995 | val = hdspm_s1_sync_check(hdspm, ucontrol->id.index-1); |
3956 | } | 3996 | } |
3997 | break; | ||
3957 | 3998 | ||
3958 | case MADI: | 3999 | case MADI: |
3959 | switch (kcontrol->private_value) { | 4000 | switch (kcontrol->private_value) { |
@@ -3966,6 +4007,7 @@ static int snd_hdspm_get_sync_check(struct snd_kcontrol *kcontrol, | |||
3966 | case 3: /* SYNC_IN */ | 4007 | case 3: /* SYNC_IN */ |
3967 | val = hdspm_sync_in_sync_check(hdspm); break; | 4008 | val = hdspm_sync_in_sync_check(hdspm); break; |
3968 | } | 4009 | } |
4010 | break; | ||
3969 | 4011 | ||
3970 | case MADIface: | 4012 | case MADIface: |
3971 | val = hdspm_madi_sync_check(hdspm); /* MADI */ | 4013 | val = hdspm_madi_sync_check(hdspm); /* MADI */ |
@@ -3983,6 +4025,7 @@ static int snd_hdspm_get_sync_check(struct snd_kcontrol *kcontrol, | |||
3983 | val = hdspm_aes_sync_check(hdspm, | 4025 | val = hdspm_aes_sync_check(hdspm, |
3984 | kcontrol->private_value-1); | 4026 | kcontrol->private_value-1); |
3985 | } | 4027 | } |
4028 | break; | ||
3986 | 4029 | ||
3987 | } | 4030 | } |
3988 | 4031 | ||
@@ -4427,9 +4470,10 @@ static struct snd_kcontrol_new snd_hdspm_controls_madi[] = { | |||
4427 | HDSPM_PREF_SYNC_REF("Preferred Sync Reference", 0), | 4470 | HDSPM_PREF_SYNC_REF("Preferred Sync Reference", 0), |
4428 | HDSPM_AUTOSYNC_REF("AutoSync Reference", 0), | 4471 | HDSPM_AUTOSYNC_REF("AutoSync Reference", 0), |
4429 | HDSPM_SYSTEM_SAMPLE_RATE("System Sample Rate", 0), | 4472 | HDSPM_SYSTEM_SAMPLE_RATE("System Sample Rate", 0), |
4473 | HDSPM_AUTOSYNC_SAMPLE_RATE("External Rate", 0), | ||
4430 | HDSPM_SYNC_CHECK("WC SyncCheck", 0), | 4474 | HDSPM_SYNC_CHECK("WC SyncCheck", 0), |
4431 | HDSPM_SYNC_CHECK("MADI SyncCheck", 1), | 4475 | HDSPM_SYNC_CHECK("MADI SyncCheck", 1), |
4432 | HDSPM_SYNC_CHECK("TCO SyncCHeck", 2), | 4476 | HDSPM_SYNC_CHECK("TCO SyncCheck", 2), |
4433 | HDSPM_SYNC_CHECK("SYNC IN SyncCheck", 3), | 4477 | HDSPM_SYNC_CHECK("SYNC IN SyncCheck", 3), |
4434 | HDSPM_LINE_OUT("Line Out", 0), | 4478 | HDSPM_LINE_OUT("Line Out", 0), |
4435 | HDSPM_TX_64("TX 64 channels mode", 0), | 4479 | HDSPM_TX_64("TX 64 channels mode", 0), |
diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c index 2b2dadc54dac..3fddc7ad1127 100644 --- a/sound/soc/codecs/wm8994.c +++ b/sound/soc/codecs/wm8994.c | |||
@@ -1045,6 +1045,7 @@ static int aif1clk_ev(struct snd_soc_dapm_widget *w, | |||
1045 | struct snd_kcontrol *kcontrol, int event) | 1045 | struct snd_kcontrol *kcontrol, int event) |
1046 | { | 1046 | { |
1047 | struct snd_soc_codec *codec = w->codec; | 1047 | struct snd_soc_codec *codec = w->codec; |
1048 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); | ||
1048 | struct wm8994 *control = codec->control_data; | 1049 | struct wm8994 *control = codec->control_data; |
1049 | int mask = WM8994_AIF1DAC1L_ENA | WM8994_AIF1DAC1R_ENA; | 1050 | int mask = WM8994_AIF1DAC1L_ENA | WM8994_AIF1DAC1R_ENA; |
1050 | int i; | 1051 | int i; |
@@ -1063,6 +1064,10 @@ static int aif1clk_ev(struct snd_soc_dapm_widget *w, | |||
1063 | 1064 | ||
1064 | switch (event) { | 1065 | switch (event) { |
1065 | case SND_SOC_DAPM_PRE_PMU: | 1066 | case SND_SOC_DAPM_PRE_PMU: |
1067 | /* Don't enable timeslot 2 if not in use */ | ||
1068 | if (wm8994->channels[0] <= 2) | ||
1069 | mask &= ~(WM8994_AIF1DAC2L_ENA | WM8994_AIF1DAC2R_ENA); | ||
1070 | |||
1066 | val = snd_soc_read(codec, WM8994_AIF1_CONTROL_1); | 1071 | val = snd_soc_read(codec, WM8994_AIF1_CONTROL_1); |
1067 | if ((val & WM8994_AIF1ADCL_SRC) && | 1072 | if ((val & WM8994_AIF1ADCL_SRC) && |
1068 | (val & WM8994_AIF1ADCR_SRC)) | 1073 | (val & WM8994_AIF1ADCR_SRC)) |
@@ -2687,7 +2692,7 @@ static int wm8994_hw_params(struct snd_pcm_substream *substream, | |||
2687 | return -EINVAL; | 2692 | return -EINVAL; |
2688 | } | 2693 | } |
2689 | 2694 | ||
2690 | bclk_rate = params_rate(params) * 4; | 2695 | bclk_rate = params_rate(params); |
2691 | switch (params_format(params)) { | 2696 | switch (params_format(params)) { |
2692 | case SNDRV_PCM_FORMAT_S16_LE: | 2697 | case SNDRV_PCM_FORMAT_S16_LE: |
2693 | bclk_rate *= 16; | 2698 | bclk_rate *= 16; |
@@ -2708,6 +2713,17 @@ static int wm8994_hw_params(struct snd_pcm_substream *substream, | |||
2708 | return -EINVAL; | 2713 | return -EINVAL; |
2709 | } | 2714 | } |
2710 | 2715 | ||
2716 | wm8994->channels[id] = params_channels(params); | ||
2717 | switch (params_channels(params)) { | ||
2718 | case 1: | ||
2719 | case 2: | ||
2720 | bclk_rate *= 2; | ||
2721 | break; | ||
2722 | default: | ||
2723 | bclk_rate *= 4; | ||
2724 | break; | ||
2725 | } | ||
2726 | |||
2711 | /* Try to find an appropriate sample rate; look for an exact match. */ | 2727 | /* Try to find an appropriate sample rate; look for an exact match. */ |
2712 | for (i = 0; i < ARRAY_SIZE(srs); i++) | 2728 | for (i = 0; i < ARRAY_SIZE(srs); i++) |
2713 | if (srs[i].rate == params_rate(params)) | 2729 | if (srs[i].rate == params_rate(params)) |
diff --git a/sound/soc/codecs/wm8994.h b/sound/soc/codecs/wm8994.h index f142ec198db3..ccbce5791e95 100644 --- a/sound/soc/codecs/wm8994.h +++ b/sound/soc/codecs/wm8994.h | |||
@@ -77,6 +77,7 @@ struct wm8994_priv { | |||
77 | int sysclk_rate[2]; | 77 | int sysclk_rate[2]; |
78 | int mclk[2]; | 78 | int mclk[2]; |
79 | int aifclk[2]; | 79 | int aifclk[2]; |
80 | int channels[2]; | ||
80 | struct wm8994_fll_config fll[2], fll_suspend[2]; | 81 | struct wm8994_fll_config fll[2], fll_suspend[2]; |
81 | struct completion fll_locked[2]; | 82 | struct completion fll_locked[2]; |
82 | bool fll_locked_irq; | 83 | bool fll_locked_irq; |
diff --git a/sound/soc/omap/omap-dmic.c b/sound/soc/omap/omap-dmic.c index 68f2cd1a9206..5a6aeaf552a8 100644 --- a/sound/soc/omap/omap-dmic.c +++ b/sound/soc/omap/omap-dmic.c | |||
@@ -464,9 +464,9 @@ static __devinit int asoc_dmic_probe(struct platform_device *pdev) | |||
464 | 464 | ||
465 | mutex_init(&dmic->mutex); | 465 | mutex_init(&dmic->mutex); |
466 | 466 | ||
467 | dmic->fclk = clk_get(dmic->dev, "dmic_fck"); | 467 | dmic->fclk = clk_get(dmic->dev, "fck"); |
468 | if (IS_ERR(dmic->fclk)) { | 468 | if (IS_ERR(dmic->fclk)) { |
469 | dev_err(dmic->dev, "cant get dmic_fck\n"); | 469 | dev_err(dmic->dev, "cant get fck\n"); |
470 | return -ENODEV; | 470 | return -ENODEV; |
471 | } | 471 | } |
472 | 472 | ||
diff --git a/sound/soc/omap/zoom2.c b/sound/soc/omap/zoom2.c index 677b567935f8..1ff6bb9ade5c 100644 --- a/sound/soc/omap/zoom2.c +++ b/sound/soc/omap/zoom2.c | |||
@@ -21,15 +21,14 @@ | |||
21 | 21 | ||
22 | #include <linux/clk.h> | 22 | #include <linux/clk.h> |
23 | #include <linux/platform_device.h> | 23 | #include <linux/platform_device.h> |
24 | #include <linux/gpio.h> | ||
24 | #include <sound/core.h> | 25 | #include <sound/core.h> |
25 | #include <sound/pcm.h> | 26 | #include <sound/pcm.h> |
26 | #include <sound/soc.h> | 27 | #include <sound/soc.h> |
27 | 28 | ||
28 | #include <asm/mach-types.h> | 29 | #include <asm/mach-types.h> |
29 | #include <mach/hardware.h> | ||
30 | #include <mach/gpio.h> | ||
31 | #include <mach/board-zoom.h> | ||
32 | #include <linux/platform_data/asoc-ti-mcbsp.h> | 30 | #include <linux/platform_data/asoc-ti-mcbsp.h> |
31 | #include <linux/platform_data/gpio-omap.h> | ||
33 | 32 | ||
34 | /* Register descriptions for twl4030 codec part */ | 33 | /* Register descriptions for twl4030 codec part */ |
35 | #include <linux/mfd/twl4030-audio.h> | 34 | #include <linux/mfd/twl4030-audio.h> |
diff --git a/sound/soc/ux500/mop500.c b/sound/soc/ux500/mop500.c index 356611d9654d..54f7e25b6f7d 100644 --- a/sound/soc/ux500/mop500.c +++ b/sound/soc/ux500/mop500.c | |||
@@ -57,6 +57,20 @@ static struct snd_soc_card mop500_card = { | |||
57 | .num_links = ARRAY_SIZE(mop500_dai_links), | 57 | .num_links = ARRAY_SIZE(mop500_dai_links), |
58 | }; | 58 | }; |
59 | 59 | ||
60 | static void mop500_of_node_put(void) | ||
61 | { | ||
62 | int i; | ||
63 | |||
64 | for (i = 0; i < 2; i++) { | ||
65 | if (mop500_dai_links[i].cpu_of_node) | ||
66 | of_node_put((struct device_node *) | ||
67 | mop500_dai_links[i].cpu_of_node); | ||
68 | if (mop500_dai_links[i].codec_of_node) | ||
69 | of_node_put((struct device_node *) | ||
70 | mop500_dai_links[i].codec_of_node); | ||
71 | } | ||
72 | } | ||
73 | |||
60 | static int __devinit mop500_of_probe(struct platform_device *pdev, | 74 | static int __devinit mop500_of_probe(struct platform_device *pdev, |
61 | struct device_node *np) | 75 | struct device_node *np) |
62 | { | 76 | { |
@@ -69,6 +83,7 @@ static int __devinit mop500_of_probe(struct platform_device *pdev, | |||
69 | 83 | ||
70 | if (!(msp_np[0] && msp_np[1] && codec_np)) { | 84 | if (!(msp_np[0] && msp_np[1] && codec_np)) { |
71 | dev_err(&pdev->dev, "Phandle missing or invalid\n"); | 85 | dev_err(&pdev->dev, "Phandle missing or invalid\n"); |
86 | mop500_of_node_put(); | ||
72 | return -EINVAL; | 87 | return -EINVAL; |
73 | } | 88 | } |
74 | 89 | ||
@@ -83,6 +98,7 @@ static int __devinit mop500_of_probe(struct platform_device *pdev, | |||
83 | 98 | ||
84 | return 0; | 99 | return 0; |
85 | } | 100 | } |
101 | |||
86 | static int __devinit mop500_probe(struct platform_device *pdev) | 102 | static int __devinit mop500_probe(struct platform_device *pdev) |
87 | { | 103 | { |
88 | struct device_node *np = pdev->dev.of_node; | 104 | struct device_node *np = pdev->dev.of_node; |
@@ -128,6 +144,7 @@ static int __devexit mop500_remove(struct platform_device *pdev) | |||
128 | 144 | ||
129 | snd_soc_unregister_card(mop500_card); | 145 | snd_soc_unregister_card(mop500_card); |
130 | mop500_ab8500_remove(mop500_card); | 146 | mop500_ab8500_remove(mop500_card); |
147 | mop500_of_node_put(); | ||
131 | 148 | ||
132 | return 0; | 149 | return 0; |
133 | } | 150 | } |
diff --git a/sound/soc/ux500/ux500_msp_i2s.c b/sound/soc/ux500/ux500_msp_i2s.c index b7c996e77570..a26c6bf0a29b 100644 --- a/sound/soc/ux500/ux500_msp_i2s.c +++ b/sound/soc/ux500/ux500_msp_i2s.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/pinctrl/consumer.h> | 18 | #include <linux/pinctrl/consumer.h> |
19 | #include <linux/delay.h> | 19 | #include <linux/delay.h> |
20 | #include <linux/slab.h> | 20 | #include <linux/slab.h> |
21 | #include <linux/io.h> | ||
21 | #include <linux/of.h> | 22 | #include <linux/of.h> |
22 | 23 | ||
23 | #include <mach/hardware.h> | 24 | #include <mach/hardware.h> |
@@ -697,14 +698,11 @@ int ux500_msp_i2s_init_msp(struct platform_device *pdev, | |||
697 | platform_data = devm_kzalloc(&pdev->dev, | 698 | platform_data = devm_kzalloc(&pdev->dev, |
698 | sizeof(struct msp_i2s_platform_data), GFP_KERNEL); | 699 | sizeof(struct msp_i2s_platform_data), GFP_KERNEL); |
699 | if (!platform_data) | 700 | if (!platform_data) |
700 | ret = -ENOMEM; | 701 | return -ENOMEM; |
701 | } | 702 | } |
702 | } else | 703 | } else |
703 | if (!platform_data) | 704 | if (!platform_data) |
704 | ret = -EINVAL; | 705 | return -EINVAL; |
705 | |||
706 | if (ret) | ||
707 | goto err_res; | ||
708 | 706 | ||
709 | dev_dbg(&pdev->dev, "%s: Enter (name: %s, id: %d).\n", __func__, | 707 | dev_dbg(&pdev->dev, "%s: Enter (name: %s, id: %d).\n", __func__, |
710 | pdev->name, platform_data->id); | 708 | pdev->name, platform_data->id); |
diff --git a/sound/usb/card.c b/sound/usb/card.c index 561bb74fd364..282f0fc9fed1 100644 --- a/sound/usb/card.c +++ b/sound/usb/card.c | |||
@@ -339,7 +339,7 @@ static int snd_usb_audio_create(struct usb_device *dev, int idx, | |||
339 | } | 339 | } |
340 | 340 | ||
341 | mutex_init(&chip->mutex); | 341 | mutex_init(&chip->mutex); |
342 | mutex_init(&chip->shutdown_mutex); | 342 | init_rwsem(&chip->shutdown_rwsem); |
343 | chip->index = idx; | 343 | chip->index = idx; |
344 | chip->dev = dev; | 344 | chip->dev = dev; |
345 | chip->card = card; | 345 | chip->card = card; |
@@ -560,7 +560,7 @@ static void snd_usb_audio_disconnect(struct usb_device *dev, | |||
560 | 560 | ||
561 | card = chip->card; | 561 | card = chip->card; |
562 | mutex_lock(®ister_mutex); | 562 | mutex_lock(®ister_mutex); |
563 | mutex_lock(&chip->shutdown_mutex); | 563 | down_write(&chip->shutdown_rwsem); |
564 | chip->shutdown = 1; | 564 | chip->shutdown = 1; |
565 | chip->num_interfaces--; | 565 | chip->num_interfaces--; |
566 | if (chip->num_interfaces <= 0) { | 566 | if (chip->num_interfaces <= 0) { |
@@ -582,11 +582,11 @@ static void snd_usb_audio_disconnect(struct usb_device *dev, | |||
582 | snd_usb_mixer_disconnect(p); | 582 | snd_usb_mixer_disconnect(p); |
583 | } | 583 | } |
584 | usb_chip[chip->index] = NULL; | 584 | usb_chip[chip->index] = NULL; |
585 | mutex_unlock(&chip->shutdown_mutex); | 585 | up_write(&chip->shutdown_rwsem); |
586 | mutex_unlock(®ister_mutex); | 586 | mutex_unlock(®ister_mutex); |
587 | snd_card_free_when_closed(card); | 587 | snd_card_free_when_closed(card); |
588 | } else { | 588 | } else { |
589 | mutex_unlock(&chip->shutdown_mutex); | 589 | up_write(&chip->shutdown_rwsem); |
590 | mutex_unlock(®ister_mutex); | 590 | mutex_unlock(®ister_mutex); |
591 | } | 591 | } |
592 | } | 592 | } |
@@ -618,16 +618,20 @@ int snd_usb_autoresume(struct snd_usb_audio *chip) | |||
618 | { | 618 | { |
619 | int err = -ENODEV; | 619 | int err = -ENODEV; |
620 | 620 | ||
621 | down_read(&chip->shutdown_rwsem); | ||
621 | if (!chip->shutdown && !chip->probing) | 622 | if (!chip->shutdown && !chip->probing) |
622 | err = usb_autopm_get_interface(chip->pm_intf); | 623 | err = usb_autopm_get_interface(chip->pm_intf); |
624 | up_read(&chip->shutdown_rwsem); | ||
623 | 625 | ||
624 | return err; | 626 | return err; |
625 | } | 627 | } |
626 | 628 | ||
627 | void snd_usb_autosuspend(struct snd_usb_audio *chip) | 629 | void snd_usb_autosuspend(struct snd_usb_audio *chip) |
628 | { | 630 | { |
631 | down_read(&chip->shutdown_rwsem); | ||
629 | if (!chip->shutdown && !chip->probing) | 632 | if (!chip->shutdown && !chip->probing) |
630 | usb_autopm_put_interface(chip->pm_intf); | 633 | usb_autopm_put_interface(chip->pm_intf); |
634 | up_read(&chip->shutdown_rwsem); | ||
631 | } | 635 | } |
632 | 636 | ||
633 | static int usb_audio_suspend(struct usb_interface *intf, pm_message_t message) | 637 | static int usb_audio_suspend(struct usb_interface *intf, pm_message_t message) |
diff --git a/sound/usb/card.h b/sound/usb/card.h index afa4f9e9b27a..814cb357ff88 100644 --- a/sound/usb/card.h +++ b/sound/usb/card.h | |||
@@ -126,6 +126,7 @@ struct snd_usb_substream { | |||
126 | struct snd_usb_endpoint *sync_endpoint; | 126 | struct snd_usb_endpoint *sync_endpoint; |
127 | unsigned long flags; | 127 | unsigned long flags; |
128 | bool need_setup_ep; /* (re)configure EP at prepare? */ | 128 | bool need_setup_ep; /* (re)configure EP at prepare? */ |
129 | unsigned int speed; /* USB_SPEED_XXX */ | ||
129 | 130 | ||
130 | u64 formats; /* format bitmasks (all or'ed) */ | 131 | u64 formats; /* format bitmasks (all or'ed) */ |
131 | unsigned int num_formats; /* number of supported audio formats (list) */ | 132 | unsigned int num_formats; /* number of supported audio formats (list) */ |
diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c index fe56c9da38e9..298070e8f2d4 100644 --- a/sound/usb/mixer.c +++ b/sound/usb/mixer.c | |||
@@ -287,25 +287,32 @@ static int get_ctl_value_v1(struct usb_mixer_elem_info *cval, int request, int v | |||
287 | unsigned char buf[2]; | 287 | unsigned char buf[2]; |
288 | int val_len = cval->val_type >= USB_MIXER_S16 ? 2 : 1; | 288 | int val_len = cval->val_type >= USB_MIXER_S16 ? 2 : 1; |
289 | int timeout = 10; | 289 | int timeout = 10; |
290 | int err; | 290 | int idx = 0, err; |
291 | 291 | ||
292 | err = snd_usb_autoresume(cval->mixer->chip); | 292 | err = snd_usb_autoresume(cval->mixer->chip); |
293 | if (err < 0) | 293 | if (err < 0) |
294 | return -EIO; | 294 | return -EIO; |
295 | down_read(&chip->shutdown_rwsem); | ||
295 | while (timeout-- > 0) { | 296 | while (timeout-- > 0) { |
297 | if (chip->shutdown) | ||
298 | break; | ||
299 | idx = snd_usb_ctrl_intf(chip) | (cval->id << 8); | ||
296 | if (snd_usb_ctl_msg(chip->dev, usb_rcvctrlpipe(chip->dev, 0), request, | 300 | if (snd_usb_ctl_msg(chip->dev, usb_rcvctrlpipe(chip->dev, 0), request, |
297 | USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_IN, | 301 | USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_IN, |
298 | validx, snd_usb_ctrl_intf(chip) | (cval->id << 8), | 302 | validx, idx, buf, val_len) >= val_len) { |
299 | buf, val_len) >= val_len) { | ||
300 | *value_ret = convert_signed_value(cval, snd_usb_combine_bytes(buf, val_len)); | 303 | *value_ret = convert_signed_value(cval, snd_usb_combine_bytes(buf, val_len)); |
301 | snd_usb_autosuspend(cval->mixer->chip); | 304 | err = 0; |
302 | return 0; | 305 | goto out; |
303 | } | 306 | } |
304 | } | 307 | } |
305 | snd_usb_autosuspend(cval->mixer->chip); | ||
306 | snd_printdd(KERN_ERR "cannot get ctl value: req = %#x, wValue = %#x, wIndex = %#x, type = %d\n", | 308 | snd_printdd(KERN_ERR "cannot get ctl value: req = %#x, wValue = %#x, wIndex = %#x, type = %d\n", |
307 | request, validx, snd_usb_ctrl_intf(chip) | (cval->id << 8), cval->val_type); | 309 | request, validx, idx, cval->val_type); |
308 | return -EINVAL; | 310 | err = -EINVAL; |
311 | |||
312 | out: | ||
313 | up_read(&chip->shutdown_rwsem); | ||
314 | snd_usb_autosuspend(cval->mixer->chip); | ||
315 | return err; | ||
309 | } | 316 | } |
310 | 317 | ||
311 | static int get_ctl_value_v2(struct usb_mixer_elem_info *cval, int request, int validx, int *value_ret) | 318 | static int get_ctl_value_v2(struct usb_mixer_elem_info *cval, int request, int validx, int *value_ret) |
@@ -313,7 +320,7 @@ static int get_ctl_value_v2(struct usb_mixer_elem_info *cval, int request, int v | |||
313 | struct snd_usb_audio *chip = cval->mixer->chip; | 320 | struct snd_usb_audio *chip = cval->mixer->chip; |
314 | unsigned char buf[2 + 3*sizeof(__u16)]; /* enough space for one range */ | 321 | unsigned char buf[2 + 3*sizeof(__u16)]; /* enough space for one range */ |
315 | unsigned char *val; | 322 | unsigned char *val; |
316 | int ret, size; | 323 | int idx = 0, ret, size; |
317 | __u8 bRequest; | 324 | __u8 bRequest; |
318 | 325 | ||
319 | if (request == UAC_GET_CUR) { | 326 | if (request == UAC_GET_CUR) { |
@@ -330,16 +337,22 @@ static int get_ctl_value_v2(struct usb_mixer_elem_info *cval, int request, int v | |||
330 | if (ret) | 337 | if (ret) |
331 | goto error; | 338 | goto error; |
332 | 339 | ||
333 | ret = snd_usb_ctl_msg(chip->dev, usb_rcvctrlpipe(chip->dev, 0), bRequest, | 340 | down_read(&chip->shutdown_rwsem); |
341 | if (chip->shutdown) | ||
342 | ret = -ENODEV; | ||
343 | else { | ||
344 | idx = snd_usb_ctrl_intf(chip) | (cval->id << 8); | ||
345 | ret = snd_usb_ctl_msg(chip->dev, usb_rcvctrlpipe(chip->dev, 0), bRequest, | ||
334 | USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_IN, | 346 | USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_IN, |
335 | validx, snd_usb_ctrl_intf(chip) | (cval->id << 8), | 347 | validx, idx, buf, size); |
336 | buf, size); | 348 | } |
349 | up_read(&chip->shutdown_rwsem); | ||
337 | snd_usb_autosuspend(chip); | 350 | snd_usb_autosuspend(chip); |
338 | 351 | ||
339 | if (ret < 0) { | 352 | if (ret < 0) { |
340 | error: | 353 | error: |
341 | snd_printk(KERN_ERR "cannot get ctl value: req = %#x, wValue = %#x, wIndex = %#x, type = %d\n", | 354 | snd_printk(KERN_ERR "cannot get ctl value: req = %#x, wValue = %#x, wIndex = %#x, type = %d\n", |
342 | request, validx, snd_usb_ctrl_intf(chip) | (cval->id << 8), cval->val_type); | 355 | request, validx, idx, cval->val_type); |
343 | return ret; | 356 | return ret; |
344 | } | 357 | } |
345 | 358 | ||
@@ -417,7 +430,7 @@ int snd_usb_mixer_set_ctl_value(struct usb_mixer_elem_info *cval, | |||
417 | { | 430 | { |
418 | struct snd_usb_audio *chip = cval->mixer->chip; | 431 | struct snd_usb_audio *chip = cval->mixer->chip; |
419 | unsigned char buf[2]; | 432 | unsigned char buf[2]; |
420 | int val_len, err, timeout = 10; | 433 | int idx = 0, val_len, err, timeout = 10; |
421 | 434 | ||
422 | if (cval->mixer->protocol == UAC_VERSION_1) { | 435 | if (cval->mixer->protocol == UAC_VERSION_1) { |
423 | val_len = cval->val_type >= USB_MIXER_S16 ? 2 : 1; | 436 | val_len = cval->val_type >= USB_MIXER_S16 ? 2 : 1; |
@@ -440,19 +453,27 @@ int snd_usb_mixer_set_ctl_value(struct usb_mixer_elem_info *cval, | |||
440 | err = snd_usb_autoresume(chip); | 453 | err = snd_usb_autoresume(chip); |
441 | if (err < 0) | 454 | if (err < 0) |
442 | return -EIO; | 455 | return -EIO; |
443 | while (timeout-- > 0) | 456 | down_read(&chip->shutdown_rwsem); |
457 | while (timeout-- > 0) { | ||
458 | if (chip->shutdown) | ||
459 | break; | ||
460 | idx = snd_usb_ctrl_intf(chip) | (cval->id << 8); | ||
444 | if (snd_usb_ctl_msg(chip->dev, | 461 | if (snd_usb_ctl_msg(chip->dev, |
445 | usb_sndctrlpipe(chip->dev, 0), request, | 462 | usb_sndctrlpipe(chip->dev, 0), request, |
446 | USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_OUT, | 463 | USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_OUT, |
447 | validx, snd_usb_ctrl_intf(chip) | (cval->id << 8), | 464 | validx, idx, buf, val_len) >= 0) { |
448 | buf, val_len) >= 0) { | 465 | err = 0; |
449 | snd_usb_autosuspend(chip); | 466 | goto out; |
450 | return 0; | ||
451 | } | 467 | } |
452 | snd_usb_autosuspend(chip); | 468 | } |
453 | snd_printdd(KERN_ERR "cannot set ctl value: req = %#x, wValue = %#x, wIndex = %#x, type = %d, data = %#x/%#x\n", | 469 | snd_printdd(KERN_ERR "cannot set ctl value: req = %#x, wValue = %#x, wIndex = %#x, type = %d, data = %#x/%#x\n", |
454 | request, validx, snd_usb_ctrl_intf(chip) | (cval->id << 8), cval->val_type, buf[0], buf[1]); | 470 | request, validx, idx, cval->val_type, buf[0], buf[1]); |
455 | return -EINVAL; | 471 | err = -EINVAL; |
472 | |||
473 | out: | ||
474 | up_read(&chip->shutdown_rwsem); | ||
475 | snd_usb_autosuspend(chip); | ||
476 | return err; | ||
456 | } | 477 | } |
457 | 478 | ||
458 | static int set_cur_ctl_value(struct usb_mixer_elem_info *cval, int validx, int value) | 479 | static int set_cur_ctl_value(struct usb_mixer_elem_info *cval, int validx, int value) |
diff --git a/sound/usb/mixer_quirks.c b/sound/usb/mixer_quirks.c index 690000db0ec0..ae2b71435220 100644 --- a/sound/usb/mixer_quirks.c +++ b/sound/usb/mixer_quirks.c | |||
@@ -283,6 +283,11 @@ static int snd_audigy2nx_led_put(struct snd_kcontrol *kcontrol, struct snd_ctl_e | |||
283 | if (value > 1) | 283 | if (value > 1) |
284 | return -EINVAL; | 284 | return -EINVAL; |
285 | changed = value != mixer->audigy2nx_leds[index]; | 285 | changed = value != mixer->audigy2nx_leds[index]; |
286 | down_read(&mixer->chip->shutdown_rwsem); | ||
287 | if (mixer->chip->shutdown) { | ||
288 | err = -ENODEV; | ||
289 | goto out; | ||
290 | } | ||
286 | if (mixer->chip->usb_id == USB_ID(0x041e, 0x3042)) | 291 | if (mixer->chip->usb_id == USB_ID(0x041e, 0x3042)) |
287 | err = snd_usb_ctl_msg(mixer->chip->dev, | 292 | err = snd_usb_ctl_msg(mixer->chip->dev, |
288 | usb_sndctrlpipe(mixer->chip->dev, 0), 0x24, | 293 | usb_sndctrlpipe(mixer->chip->dev, 0), 0x24, |
@@ -299,6 +304,8 @@ static int snd_audigy2nx_led_put(struct snd_kcontrol *kcontrol, struct snd_ctl_e | |||
299 | usb_sndctrlpipe(mixer->chip->dev, 0), 0x24, | 304 | usb_sndctrlpipe(mixer->chip->dev, 0), 0x24, |
300 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_OTHER, | 305 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_OTHER, |
301 | value, index + 2, NULL, 0); | 306 | value, index + 2, NULL, 0); |
307 | out: | ||
308 | up_read(&mixer->chip->shutdown_rwsem); | ||
302 | if (err < 0) | 309 | if (err < 0) |
303 | return err; | 310 | return err; |
304 | mixer->audigy2nx_leds[index] = value; | 311 | mixer->audigy2nx_leds[index] = value; |
@@ -392,11 +399,16 @@ static void snd_audigy2nx_proc_read(struct snd_info_entry *entry, | |||
392 | 399 | ||
393 | for (i = 0; jacks[i].name; ++i) { | 400 | for (i = 0; jacks[i].name; ++i) { |
394 | snd_iprintf(buffer, "%s: ", jacks[i].name); | 401 | snd_iprintf(buffer, "%s: ", jacks[i].name); |
395 | err = snd_usb_ctl_msg(mixer->chip->dev, | 402 | down_read(&mixer->chip->shutdown_rwsem); |
403 | if (mixer->chip->shutdown) | ||
404 | err = 0; | ||
405 | else | ||
406 | err = snd_usb_ctl_msg(mixer->chip->dev, | ||
396 | usb_rcvctrlpipe(mixer->chip->dev, 0), | 407 | usb_rcvctrlpipe(mixer->chip->dev, 0), |
397 | UAC_GET_MEM, USB_DIR_IN | USB_TYPE_CLASS | | 408 | UAC_GET_MEM, USB_DIR_IN | USB_TYPE_CLASS | |
398 | USB_RECIP_INTERFACE, 0, | 409 | USB_RECIP_INTERFACE, 0, |
399 | jacks[i].unitid << 8, buf, 3); | 410 | jacks[i].unitid << 8, buf, 3); |
411 | up_read(&mixer->chip->shutdown_rwsem); | ||
400 | if (err == 3 && (buf[0] == 3 || buf[0] == 6)) | 412 | if (err == 3 && (buf[0] == 3 || buf[0] == 6)) |
401 | snd_iprintf(buffer, "%02x %02x\n", buf[1], buf[2]); | 413 | snd_iprintf(buffer, "%02x %02x\n", buf[1], buf[2]); |
402 | else | 414 | else |
@@ -426,10 +438,15 @@ static int snd_xonar_u1_switch_put(struct snd_kcontrol *kcontrol, | |||
426 | else | 438 | else |
427 | new_status = old_status & ~0x02; | 439 | new_status = old_status & ~0x02; |
428 | changed = new_status != old_status; | 440 | changed = new_status != old_status; |
429 | err = snd_usb_ctl_msg(mixer->chip->dev, | 441 | down_read(&mixer->chip->shutdown_rwsem); |
442 | if (mixer->chip->shutdown) | ||
443 | err = -ENODEV; | ||
444 | else | ||
445 | err = snd_usb_ctl_msg(mixer->chip->dev, | ||
430 | usb_sndctrlpipe(mixer->chip->dev, 0), 0x08, | 446 | usb_sndctrlpipe(mixer->chip->dev, 0), 0x08, |
431 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_OTHER, | 447 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_OTHER, |
432 | 50, 0, &new_status, 1); | 448 | 50, 0, &new_status, 1); |
449 | up_read(&mixer->chip->shutdown_rwsem); | ||
433 | if (err < 0) | 450 | if (err < 0) |
434 | return err; | 451 | return err; |
435 | mixer->xonar_u1_status = new_status; | 452 | mixer->xonar_u1_status = new_status; |
@@ -468,11 +485,17 @@ static int snd_nativeinstruments_control_get(struct snd_kcontrol *kcontrol, | |||
468 | u8 bRequest = (kcontrol->private_value >> 16) & 0xff; | 485 | u8 bRequest = (kcontrol->private_value >> 16) & 0xff; |
469 | u16 wIndex = kcontrol->private_value & 0xffff; | 486 | u16 wIndex = kcontrol->private_value & 0xffff; |
470 | u8 tmp; | 487 | u8 tmp; |
488 | int ret; | ||
471 | 489 | ||
472 | int ret = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), bRequest, | 490 | down_read(&mixer->chip->shutdown_rwsem); |
491 | if (mixer->chip->shutdown) | ||
492 | ret = -ENODEV; | ||
493 | else | ||
494 | ret = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), bRequest, | ||
473 | USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, | 495 | USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, |
474 | 0, cpu_to_le16(wIndex), | 496 | 0, cpu_to_le16(wIndex), |
475 | &tmp, sizeof(tmp), 1000); | 497 | &tmp, sizeof(tmp), 1000); |
498 | up_read(&mixer->chip->shutdown_rwsem); | ||
476 | 499 | ||
477 | if (ret < 0) { | 500 | if (ret < 0) { |
478 | snd_printk(KERN_ERR | 501 | snd_printk(KERN_ERR |
@@ -493,11 +516,17 @@ static int snd_nativeinstruments_control_put(struct snd_kcontrol *kcontrol, | |||
493 | u8 bRequest = (kcontrol->private_value >> 16) & 0xff; | 516 | u8 bRequest = (kcontrol->private_value >> 16) & 0xff; |
494 | u16 wIndex = kcontrol->private_value & 0xffff; | 517 | u16 wIndex = kcontrol->private_value & 0xffff; |
495 | u16 wValue = ucontrol->value.integer.value[0]; | 518 | u16 wValue = ucontrol->value.integer.value[0]; |
519 | int ret; | ||
496 | 520 | ||
497 | int ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), bRequest, | 521 | down_read(&mixer->chip->shutdown_rwsem); |
522 | if (mixer->chip->shutdown) | ||
523 | ret = -ENODEV; | ||
524 | else | ||
525 | ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), bRequest, | ||
498 | USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_OUT, | 526 | USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_OUT, |
499 | cpu_to_le16(wValue), cpu_to_le16(wIndex), | 527 | cpu_to_le16(wValue), cpu_to_le16(wIndex), |
500 | NULL, 0, 1000); | 528 | NULL, 0, 1000); |
529 | up_read(&mixer->chip->shutdown_rwsem); | ||
501 | 530 | ||
502 | if (ret < 0) { | 531 | if (ret < 0) { |
503 | snd_printk(KERN_ERR | 532 | snd_printk(KERN_ERR |
@@ -656,11 +685,16 @@ static int snd_ftu_eff_switch_get(struct snd_kcontrol *kctl, | |||
656 | return -EINVAL; | 685 | return -EINVAL; |
657 | 686 | ||
658 | 687 | ||
659 | err = snd_usb_ctl_msg(chip->dev, | 688 | down_read(&mixer->chip->shutdown_rwsem); |
689 | if (mixer->chip->shutdown) | ||
690 | err = -ENODEV; | ||
691 | else | ||
692 | err = snd_usb_ctl_msg(chip->dev, | ||
660 | usb_rcvctrlpipe(chip->dev, 0), UAC_GET_CUR, | 693 | usb_rcvctrlpipe(chip->dev, 0), UAC_GET_CUR, |
661 | USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_IN, | 694 | USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_IN, |
662 | validx << 8, snd_usb_ctrl_intf(chip) | (id << 8), | 695 | validx << 8, snd_usb_ctrl_intf(chip) | (id << 8), |
663 | value, val_len); | 696 | value, val_len); |
697 | up_read(&mixer->chip->shutdown_rwsem); | ||
664 | if (err < 0) | 698 | if (err < 0) |
665 | return err; | 699 | return err; |
666 | 700 | ||
@@ -703,11 +737,16 @@ static int snd_ftu_eff_switch_put(struct snd_kcontrol *kctl, | |||
703 | 737 | ||
704 | if (!pval->is_cached) { | 738 | if (!pval->is_cached) { |
705 | /* Read current value */ | 739 | /* Read current value */ |
706 | err = snd_usb_ctl_msg(chip->dev, | 740 | down_read(&mixer->chip->shutdown_rwsem); |
741 | if (mixer->chip->shutdown) | ||
742 | err = -ENODEV; | ||
743 | else | ||
744 | err = snd_usb_ctl_msg(chip->dev, | ||
707 | usb_rcvctrlpipe(chip->dev, 0), UAC_GET_CUR, | 745 | usb_rcvctrlpipe(chip->dev, 0), UAC_GET_CUR, |
708 | USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_IN, | 746 | USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_IN, |
709 | validx << 8, snd_usb_ctrl_intf(chip) | (id << 8), | 747 | validx << 8, snd_usb_ctrl_intf(chip) | (id << 8), |
710 | value, val_len); | 748 | value, val_len); |
749 | up_read(&mixer->chip->shutdown_rwsem); | ||
711 | if (err < 0) | 750 | if (err < 0) |
712 | return err; | 751 | return err; |
713 | 752 | ||
@@ -719,11 +758,16 @@ static int snd_ftu_eff_switch_put(struct snd_kcontrol *kctl, | |||
719 | if (cur_val != new_val) { | 758 | if (cur_val != new_val) { |
720 | value[0] = new_val; | 759 | value[0] = new_val; |
721 | value[1] = 0; | 760 | value[1] = 0; |
722 | err = snd_usb_ctl_msg(chip->dev, | 761 | down_read(&mixer->chip->shutdown_rwsem); |
762 | if (mixer->chip->shutdown) | ||
763 | err = -ENODEV; | ||
764 | else | ||
765 | err = snd_usb_ctl_msg(chip->dev, | ||
723 | usb_sndctrlpipe(chip->dev, 0), UAC_SET_CUR, | 766 | usb_sndctrlpipe(chip->dev, 0), UAC_SET_CUR, |
724 | USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_OUT, | 767 | USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_OUT, |
725 | validx << 8, snd_usb_ctrl_intf(chip) | (id << 8), | 768 | validx << 8, snd_usb_ctrl_intf(chip) | (id << 8), |
726 | value, val_len); | 769 | value, val_len); |
770 | up_read(&mixer->chip->shutdown_rwsem); | ||
727 | if (err < 0) | 771 | if (err < 0) |
728 | return err; | 772 | return err; |
729 | 773 | ||
diff --git a/sound/usb/pcm.c b/sound/usb/pcm.c index 55e19e1b80ec..37428f74dbb6 100644 --- a/sound/usb/pcm.c +++ b/sound/usb/pcm.c | |||
@@ -71,6 +71,8 @@ static snd_pcm_uframes_t snd_usb_pcm_pointer(struct snd_pcm_substream *substream | |||
71 | unsigned int hwptr_done; | 71 | unsigned int hwptr_done; |
72 | 72 | ||
73 | subs = (struct snd_usb_substream *)substream->runtime->private_data; | 73 | subs = (struct snd_usb_substream *)substream->runtime->private_data; |
74 | if (subs->stream->chip->shutdown) | ||
75 | return SNDRV_PCM_POS_XRUN; | ||
74 | spin_lock(&subs->lock); | 76 | spin_lock(&subs->lock); |
75 | hwptr_done = subs->hwptr_done; | 77 | hwptr_done = subs->hwptr_done; |
76 | substream->runtime->delay = snd_usb_pcm_delay(subs, | 78 | substream->runtime->delay = snd_usb_pcm_delay(subs, |
@@ -444,7 +446,6 @@ static int configure_endpoint(struct snd_usb_substream *subs) | |||
444 | { | 446 | { |
445 | int ret; | 447 | int ret; |
446 | 448 | ||
447 | mutex_lock(&subs->stream->chip->shutdown_mutex); | ||
448 | /* format changed */ | 449 | /* format changed */ |
449 | stop_endpoints(subs, 0, 0, 0); | 450 | stop_endpoints(subs, 0, 0, 0); |
450 | ret = snd_usb_endpoint_set_params(subs->data_endpoint, | 451 | ret = snd_usb_endpoint_set_params(subs->data_endpoint, |
@@ -455,7 +456,7 @@ static int configure_endpoint(struct snd_usb_substream *subs) | |||
455 | subs->cur_audiofmt, | 456 | subs->cur_audiofmt, |
456 | subs->sync_endpoint); | 457 | subs->sync_endpoint); |
457 | if (ret < 0) | 458 | if (ret < 0) |
458 | goto unlock; | 459 | return ret; |
459 | 460 | ||
460 | if (subs->sync_endpoint) | 461 | if (subs->sync_endpoint) |
461 | ret = snd_usb_endpoint_set_params(subs->data_endpoint, | 462 | ret = snd_usb_endpoint_set_params(subs->data_endpoint, |
@@ -465,9 +466,6 @@ static int configure_endpoint(struct snd_usb_substream *subs) | |||
465 | subs->cur_rate, | 466 | subs->cur_rate, |
466 | subs->cur_audiofmt, | 467 | subs->cur_audiofmt, |
467 | NULL); | 468 | NULL); |
468 | |||
469 | unlock: | ||
470 | mutex_unlock(&subs->stream->chip->shutdown_mutex); | ||
471 | return ret; | 469 | return ret; |
472 | } | 470 | } |
473 | 471 | ||
@@ -505,7 +503,13 @@ static int snd_usb_hw_params(struct snd_pcm_substream *substream, | |||
505 | return -EINVAL; | 503 | return -EINVAL; |
506 | } | 504 | } |
507 | 505 | ||
508 | if ((ret = set_format(subs, fmt)) < 0) | 506 | down_read(&subs->stream->chip->shutdown_rwsem); |
507 | if (subs->stream->chip->shutdown) | ||
508 | ret = -ENODEV; | ||
509 | else | ||
510 | ret = set_format(subs, fmt); | ||
511 | up_read(&subs->stream->chip->shutdown_rwsem); | ||
512 | if (ret < 0) | ||
509 | return ret; | 513 | return ret; |
510 | 514 | ||
511 | subs->interface = fmt->iface; | 515 | subs->interface = fmt->iface; |
@@ -527,10 +531,12 @@ static int snd_usb_hw_free(struct snd_pcm_substream *substream) | |||
527 | subs->cur_audiofmt = NULL; | 531 | subs->cur_audiofmt = NULL; |
528 | subs->cur_rate = 0; | 532 | subs->cur_rate = 0; |
529 | subs->period_bytes = 0; | 533 | subs->period_bytes = 0; |
530 | mutex_lock(&subs->stream->chip->shutdown_mutex); | 534 | down_read(&subs->stream->chip->shutdown_rwsem); |
531 | stop_endpoints(subs, 0, 1, 1); | 535 | if (!subs->stream->chip->shutdown) { |
532 | deactivate_endpoints(subs); | 536 | stop_endpoints(subs, 0, 1, 1); |
533 | mutex_unlock(&subs->stream->chip->shutdown_mutex); | 537 | deactivate_endpoints(subs); |
538 | } | ||
539 | up_read(&subs->stream->chip->shutdown_rwsem); | ||
534 | return snd_pcm_lib_free_vmalloc_buffer(substream); | 540 | return snd_pcm_lib_free_vmalloc_buffer(substream); |
535 | } | 541 | } |
536 | 542 | ||
@@ -552,12 +558,19 @@ static int snd_usb_pcm_prepare(struct snd_pcm_substream *substream) | |||
552 | return -ENXIO; | 558 | return -ENXIO; |
553 | } | 559 | } |
554 | 560 | ||
555 | if (snd_BUG_ON(!subs->data_endpoint)) | 561 | down_read(&subs->stream->chip->shutdown_rwsem); |
556 | return -EIO; | 562 | if (subs->stream->chip->shutdown) { |
563 | ret = -ENODEV; | ||
564 | goto unlock; | ||
565 | } | ||
566 | if (snd_BUG_ON(!subs->data_endpoint)) { | ||
567 | ret = -EIO; | ||
568 | goto unlock; | ||
569 | } | ||
557 | 570 | ||
558 | ret = set_format(subs, subs->cur_audiofmt); | 571 | ret = set_format(subs, subs->cur_audiofmt); |
559 | if (ret < 0) | 572 | if (ret < 0) |
560 | return ret; | 573 | goto unlock; |
561 | 574 | ||
562 | iface = usb_ifnum_to_if(subs->dev, subs->cur_audiofmt->iface); | 575 | iface = usb_ifnum_to_if(subs->dev, subs->cur_audiofmt->iface); |
563 | alts = &iface->altsetting[subs->cur_audiofmt->altset_idx]; | 576 | alts = &iface->altsetting[subs->cur_audiofmt->altset_idx]; |
@@ -567,12 +580,12 @@ static int snd_usb_pcm_prepare(struct snd_pcm_substream *substream) | |||
567 | subs->cur_audiofmt, | 580 | subs->cur_audiofmt, |
568 | subs->cur_rate); | 581 | subs->cur_rate); |
569 | if (ret < 0) | 582 | if (ret < 0) |
570 | return ret; | 583 | goto unlock; |
571 | 584 | ||
572 | if (subs->need_setup_ep) { | 585 | if (subs->need_setup_ep) { |
573 | ret = configure_endpoint(subs); | 586 | ret = configure_endpoint(subs); |
574 | if (ret < 0) | 587 | if (ret < 0) |
575 | return ret; | 588 | goto unlock; |
576 | subs->need_setup_ep = false; | 589 | subs->need_setup_ep = false; |
577 | } | 590 | } |
578 | 591 | ||
@@ -592,9 +605,11 @@ static int snd_usb_pcm_prepare(struct snd_pcm_substream *substream) | |||
592 | /* for playback, submit the URBs now; otherwise, the first hwptr_done | 605 | /* for playback, submit the URBs now; otherwise, the first hwptr_done |
593 | * updates for all URBs would happen at the same time when starting */ | 606 | * updates for all URBs would happen at the same time when starting */ |
594 | if (subs->direction == SNDRV_PCM_STREAM_PLAYBACK) | 607 | if (subs->direction == SNDRV_PCM_STREAM_PLAYBACK) |
595 | return start_endpoints(subs, 1); | 608 | ret = start_endpoints(subs, 1); |
596 | 609 | ||
597 | return 0; | 610 | unlock: |
611 | up_read(&subs->stream->chip->shutdown_rwsem); | ||
612 | return ret; | ||
598 | } | 613 | } |
599 | 614 | ||
600 | static struct snd_pcm_hardware snd_usb_hardware = | 615 | static struct snd_pcm_hardware snd_usb_hardware = |
@@ -647,7 +662,7 @@ static int hw_check_valid_format(struct snd_usb_substream *subs, | |||
647 | return 0; | 662 | return 0; |
648 | } | 663 | } |
649 | /* check whether the period time is >= the data packet interval */ | 664 | /* check whether the period time is >= the data packet interval */ |
650 | if (snd_usb_get_speed(subs->dev) != USB_SPEED_FULL) { | 665 | if (subs->speed != USB_SPEED_FULL) { |
651 | ptime = 125 * (1 << fp->datainterval); | 666 | ptime = 125 * (1 << fp->datainterval); |
652 | if (ptime > pt->max || (ptime == pt->max && pt->openmax)) { | 667 | if (ptime > pt->max || (ptime == pt->max && pt->openmax)) { |
653 | hwc_debug(" > check: ptime %u > max %u\n", ptime, pt->max); | 668 | hwc_debug(" > check: ptime %u > max %u\n", ptime, pt->max); |
@@ -925,7 +940,7 @@ static int setup_hw_info(struct snd_pcm_runtime *runtime, struct snd_usb_substre | |||
925 | return err; | 940 | return err; |
926 | 941 | ||
927 | param_period_time_if_needed = SNDRV_PCM_HW_PARAM_PERIOD_TIME; | 942 | param_period_time_if_needed = SNDRV_PCM_HW_PARAM_PERIOD_TIME; |
928 | if (snd_usb_get_speed(subs->dev) == USB_SPEED_FULL) | 943 | if (subs->speed == USB_SPEED_FULL) |
929 | /* full speed devices have fixed data packet interval */ | 944 | /* full speed devices have fixed data packet interval */ |
930 | ptmin = 1000; | 945 | ptmin = 1000; |
931 | if (ptmin == 1000) | 946 | if (ptmin == 1000) |
diff --git a/sound/usb/proc.c b/sound/usb/proc.c index ebc1a5b5b3f1..d218f763501f 100644 --- a/sound/usb/proc.c +++ b/sound/usb/proc.c | |||
@@ -108,7 +108,7 @@ static void proc_dump_substream_formats(struct snd_usb_substream *subs, struct s | |||
108 | } | 108 | } |
109 | snd_iprintf(buffer, "\n"); | 109 | snd_iprintf(buffer, "\n"); |
110 | } | 110 | } |
111 | if (snd_usb_get_speed(subs->dev) != USB_SPEED_FULL) | 111 | if (subs->speed != USB_SPEED_FULL) |
112 | snd_iprintf(buffer, " Data packet interval: %d us\n", | 112 | snd_iprintf(buffer, " Data packet interval: %d us\n", |
113 | 125 * (1 << fp->datainterval)); | 113 | 125 * (1 << fp->datainterval)); |
114 | // snd_iprintf(buffer, " Max Packet Size = %d\n", fp->maxpacksize); | 114 | // snd_iprintf(buffer, " Max Packet Size = %d\n", fp->maxpacksize); |
@@ -124,7 +124,7 @@ static void proc_dump_ep_status(struct snd_usb_substream *subs, | |||
124 | return; | 124 | return; |
125 | snd_iprintf(buffer, " Packet Size = %d\n", ep->curpacksize); | 125 | snd_iprintf(buffer, " Packet Size = %d\n", ep->curpacksize); |
126 | snd_iprintf(buffer, " Momentary freq = %u Hz (%#x.%04x)\n", | 126 | snd_iprintf(buffer, " Momentary freq = %u Hz (%#x.%04x)\n", |
127 | snd_usb_get_speed(subs->dev) == USB_SPEED_FULL | 127 | subs->speed == USB_SPEED_FULL |
128 | ? get_full_speed_hz(ep->freqm) | 128 | ? get_full_speed_hz(ep->freqm) |
129 | : get_high_speed_hz(ep->freqm), | 129 | : get_high_speed_hz(ep->freqm), |
130 | ep->freqm >> 16, ep->freqm & 0xffff); | 130 | ep->freqm >> 16, ep->freqm & 0xffff); |
diff --git a/sound/usb/stream.c b/sound/usb/stream.c index 083ed81160e5..1de0c8c002a8 100644 --- a/sound/usb/stream.c +++ b/sound/usb/stream.c | |||
@@ -90,6 +90,7 @@ static void snd_usb_init_substream(struct snd_usb_stream *as, | |||
90 | subs->direction = stream; | 90 | subs->direction = stream; |
91 | subs->dev = as->chip->dev; | 91 | subs->dev = as->chip->dev; |
92 | subs->txfr_quirk = as->chip->txfr_quirk; | 92 | subs->txfr_quirk = as->chip->txfr_quirk; |
93 | subs->speed = snd_usb_get_speed(subs->dev); | ||
93 | 94 | ||
94 | snd_usb_set_pcm_ops(as->pcm, stream); | 95 | snd_usb_set_pcm_ops(as->pcm, stream); |
95 | 96 | ||
diff --git a/sound/usb/usbaudio.h b/sound/usb/usbaudio.h index b8233ebe250f..ef42797f56fb 100644 --- a/sound/usb/usbaudio.h +++ b/sound/usb/usbaudio.h | |||
@@ -37,7 +37,7 @@ struct snd_usb_audio { | |||
37 | struct usb_interface *pm_intf; | 37 | struct usb_interface *pm_intf; |
38 | u32 usb_id; | 38 | u32 usb_id; |
39 | struct mutex mutex; | 39 | struct mutex mutex; |
40 | struct mutex shutdown_mutex; | 40 | struct rw_semaphore shutdown_rwsem; |
41 | unsigned int shutdown:1; | 41 | unsigned int shutdown:1; |
42 | unsigned int probing:1; | 42 | unsigned int probing:1; |
43 | unsigned int autosuspended:1; | 43 | unsigned int autosuspended:1; |
diff --git a/tools/perf/builtin-help.c b/tools/perf/builtin-help.c index 411ee5664e98..178b88ae3d2f 100644 --- a/tools/perf/builtin-help.c +++ b/tools/perf/builtin-help.c | |||
@@ -414,7 +414,7 @@ static int show_html_page(const char *perf_cmd) | |||
414 | int cmd_help(int argc, const char **argv, const char *prefix __maybe_unused) | 414 | int cmd_help(int argc, const char **argv, const char *prefix __maybe_unused) |
415 | { | 415 | { |
416 | bool show_all = false; | 416 | bool show_all = false; |
417 | enum help_format help_format = HELP_FORMAT_NONE; | 417 | enum help_format help_format = HELP_FORMAT_MAN; |
418 | struct option builtin_help_options[] = { | 418 | struct option builtin_help_options[] = { |
419 | OPT_BOOLEAN('a', "all", &show_all, "print all available commands"), | 419 | OPT_BOOLEAN('a', "all", &show_all, "print all available commands"), |
420 | OPT_SET_UINT('m', "man", &help_format, "show man page", HELP_FORMAT_MAN), | 420 | OPT_SET_UINT('m', "man", &help_format, "show man page", HELP_FORMAT_MAN), |
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c index dec8ced61fb0..7aaee39f6774 100644 --- a/tools/perf/builtin-trace.c +++ b/tools/perf/builtin-trace.c | |||
@@ -56,6 +56,10 @@ static int trace__read_syscall_info(struct trace *trace, int id) | |||
56 | { | 56 | { |
57 | char tp_name[128]; | 57 | char tp_name[128]; |
58 | struct syscall *sc; | 58 | struct syscall *sc; |
59 | const char *name = audit_syscall_to_name(id, trace->audit_machine); | ||
60 | |||
61 | if (name == NULL) | ||
62 | return -1; | ||
59 | 63 | ||
60 | if (id > trace->syscalls.max) { | 64 | if (id > trace->syscalls.max) { |
61 | struct syscall *nsyscalls = realloc(trace->syscalls.table, (id + 1) * sizeof(*sc)); | 65 | struct syscall *nsyscalls = realloc(trace->syscalls.table, (id + 1) * sizeof(*sc)); |
@@ -75,11 +79,8 @@ static int trace__read_syscall_info(struct trace *trace, int id) | |||
75 | } | 79 | } |
76 | 80 | ||
77 | sc = trace->syscalls.table + id; | 81 | sc = trace->syscalls.table + id; |
78 | sc->name = audit_syscall_to_name(id, trace->audit_machine); | 82 | sc->name = name; |
79 | if (sc->name == NULL) | 83 | sc->fmt = syscall_fmt__find(sc->name); |
80 | return -1; | ||
81 | |||
82 | sc->fmt = syscall_fmt__find(sc->name); | ||
83 | 84 | ||
84 | snprintf(tp_name, sizeof(tp_name), "sys_enter_%s", sc->name); | 85 | snprintf(tp_name, sizeof(tp_name), "sys_enter_%s", sc->name); |
85 | sc->tp_format = event_format__new("syscalls", tp_name); | 86 | sc->tp_format = event_format__new("syscalls", tp_name); |
@@ -267,6 +268,13 @@ again: | |||
267 | if (evlist->threads->map[0] == -1 || evlist->threads->nr > 1) | 268 | if (evlist->threads->map[0] == -1 || evlist->threads->nr > 1) |
268 | printf("%d ", sample.tid); | 269 | printf("%d ", sample.tid); |
269 | 270 | ||
271 | if (sample.raw_data == NULL) { | ||
272 | printf("%s sample with no payload for tid: %d, cpu %d, raw_size=%d, skipping...\n", | ||
273 | perf_evsel__name(evsel), sample.tid, | ||
274 | sample.cpu, sample.raw_size); | ||
275 | continue; | ||
276 | } | ||
277 | |||
270 | handler = evsel->handler.func; | 278 | handler = evsel->handler.func; |
271 | handler(trace, evsel, &sample); | 279 | handler(trace, evsel, &sample); |
272 | } | 280 | } |
diff --git a/tools/perf/util/parse-events-test.c b/tools/perf/util/parse-events-test.c index 28c18d1d52c3..516ecd9ddd6e 100644 --- a/tools/perf/util/parse-events-test.c +++ b/tools/perf/util/parse-events-test.c | |||
@@ -513,7 +513,8 @@ static int test__group1(struct perf_evlist *evlist) | |||
513 | TEST_ASSERT_VAL("wrong exclude_user", !evsel->attr.exclude_user); | 513 | TEST_ASSERT_VAL("wrong exclude_user", !evsel->attr.exclude_user); |
514 | TEST_ASSERT_VAL("wrong exclude_kernel", evsel->attr.exclude_kernel); | 514 | TEST_ASSERT_VAL("wrong exclude_kernel", evsel->attr.exclude_kernel); |
515 | TEST_ASSERT_VAL("wrong exclude_hv", evsel->attr.exclude_hv); | 515 | TEST_ASSERT_VAL("wrong exclude_hv", evsel->attr.exclude_hv); |
516 | TEST_ASSERT_VAL("wrong exclude guest", !evsel->attr.exclude_guest); | 516 | /* use of precise requires exclude_guest */ |
517 | TEST_ASSERT_VAL("wrong exclude guest", evsel->attr.exclude_guest); | ||
517 | TEST_ASSERT_VAL("wrong exclude host", !evsel->attr.exclude_host); | 518 | TEST_ASSERT_VAL("wrong exclude host", !evsel->attr.exclude_host); |
518 | TEST_ASSERT_VAL("wrong precise_ip", evsel->attr.precise_ip == 2); | 519 | TEST_ASSERT_VAL("wrong precise_ip", evsel->attr.precise_ip == 2); |
519 | TEST_ASSERT_VAL("wrong leader", evsel->leader == leader); | 520 | TEST_ASSERT_VAL("wrong leader", evsel->leader == leader); |
@@ -599,7 +600,8 @@ static int test__group3(struct perf_evlist *evlist __maybe_unused) | |||
599 | TEST_ASSERT_VAL("wrong exclude_user", evsel->attr.exclude_user); | 600 | TEST_ASSERT_VAL("wrong exclude_user", evsel->attr.exclude_user); |
600 | TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->attr.exclude_kernel); | 601 | TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->attr.exclude_kernel); |
601 | TEST_ASSERT_VAL("wrong exclude_hv", evsel->attr.exclude_hv); | 602 | TEST_ASSERT_VAL("wrong exclude_hv", evsel->attr.exclude_hv); |
602 | TEST_ASSERT_VAL("wrong exclude guest", !evsel->attr.exclude_guest); | 603 | /* use of precise requires exclude_guest */ |
604 | TEST_ASSERT_VAL("wrong exclude guest", evsel->attr.exclude_guest); | ||
603 | TEST_ASSERT_VAL("wrong exclude host", !evsel->attr.exclude_host); | 605 | TEST_ASSERT_VAL("wrong exclude host", !evsel->attr.exclude_host); |
604 | TEST_ASSERT_VAL("wrong precise_ip", evsel->attr.precise_ip == 3); | 606 | TEST_ASSERT_VAL("wrong precise_ip", evsel->attr.precise_ip == 3); |
605 | TEST_ASSERT_VAL("wrong leader", evsel->leader == leader); | 607 | TEST_ASSERT_VAL("wrong leader", evsel->leader == leader); |
@@ -662,7 +664,8 @@ static int test__group4(struct perf_evlist *evlist __maybe_unused) | |||
662 | TEST_ASSERT_VAL("wrong exclude_user", !evsel->attr.exclude_user); | 664 | TEST_ASSERT_VAL("wrong exclude_user", !evsel->attr.exclude_user); |
663 | TEST_ASSERT_VAL("wrong exclude_kernel", evsel->attr.exclude_kernel); | 665 | TEST_ASSERT_VAL("wrong exclude_kernel", evsel->attr.exclude_kernel); |
664 | TEST_ASSERT_VAL("wrong exclude_hv", evsel->attr.exclude_hv); | 666 | TEST_ASSERT_VAL("wrong exclude_hv", evsel->attr.exclude_hv); |
665 | TEST_ASSERT_VAL("wrong exclude guest", !evsel->attr.exclude_guest); | 667 | /* use of precise requires exclude_guest */ |
668 | TEST_ASSERT_VAL("wrong exclude guest", evsel->attr.exclude_guest); | ||
666 | TEST_ASSERT_VAL("wrong exclude host", !evsel->attr.exclude_host); | 669 | TEST_ASSERT_VAL("wrong exclude host", !evsel->attr.exclude_host); |
667 | TEST_ASSERT_VAL("wrong precise_ip", evsel->attr.precise_ip == 1); | 670 | TEST_ASSERT_VAL("wrong precise_ip", evsel->attr.precise_ip == 1); |
668 | TEST_ASSERT_VAL("wrong group name", !evsel->group_name); | 671 | TEST_ASSERT_VAL("wrong group name", !evsel->group_name); |
@@ -676,7 +679,8 @@ static int test__group4(struct perf_evlist *evlist __maybe_unused) | |||
676 | TEST_ASSERT_VAL("wrong exclude_user", evsel->attr.exclude_user); | 679 | TEST_ASSERT_VAL("wrong exclude_user", evsel->attr.exclude_user); |
677 | TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->attr.exclude_kernel); | 680 | TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->attr.exclude_kernel); |
678 | TEST_ASSERT_VAL("wrong exclude_hv", evsel->attr.exclude_hv); | 681 | TEST_ASSERT_VAL("wrong exclude_hv", evsel->attr.exclude_hv); |
679 | TEST_ASSERT_VAL("wrong exclude guest", !evsel->attr.exclude_guest); | 682 | /* use of precise requires exclude_guest */ |
683 | TEST_ASSERT_VAL("wrong exclude guest", evsel->attr.exclude_guest); | ||
680 | TEST_ASSERT_VAL("wrong exclude host", !evsel->attr.exclude_host); | 684 | TEST_ASSERT_VAL("wrong exclude host", !evsel->attr.exclude_host); |
681 | TEST_ASSERT_VAL("wrong precise_ip", evsel->attr.precise_ip == 2); | 685 | TEST_ASSERT_VAL("wrong precise_ip", evsel->attr.precise_ip == 2); |
682 | TEST_ASSERT_VAL("wrong leader", evsel->leader == leader); | 686 | TEST_ASSERT_VAL("wrong leader", evsel->leader == leader); |
diff --git a/tools/perf/util/thread.c b/tools/perf/util/thread.c index fb4b7ea6752f..8b3e5939afb6 100644 --- a/tools/perf/util/thread.c +++ b/tools/perf/util/thread.c | |||
@@ -39,7 +39,6 @@ int thread__set_comm(struct thread *self, const char *comm) | |||
39 | err = self->comm == NULL ? -ENOMEM : 0; | 39 | err = self->comm == NULL ? -ENOMEM : 0; |
40 | if (!err) { | 40 | if (!err) { |
41 | self->comm_set = true; | 41 | self->comm_set = true; |
42 | map_groups__flush(&self->mg); | ||
43 | } | 42 | } |
44 | return err; | 43 | return err; |
45 | } | 44 | } |
diff --git a/tools/testing/ktest/ktest.pl b/tools/testing/ktest/ktest.pl index b51d787176d3..c7ba7614061b 100755 --- a/tools/testing/ktest/ktest.pl +++ b/tools/testing/ktest/ktest.pl | |||
@@ -1740,8 +1740,10 @@ sub install { | |||
1740 | open(IN, "$output_config") or dodie("Can't read config file"); | 1740 | open(IN, "$output_config") or dodie("Can't read config file"); |
1741 | while (<IN>) { | 1741 | while (<IN>) { |
1742 | if (/CONFIG_MODULES(=y)?/) { | 1742 | if (/CONFIG_MODULES(=y)?/) { |
1743 | $install_mods = 1 if (defined($1)); | 1743 | if (defined($1)) { |
1744 | last; | 1744 | $install_mods = 1; |
1745 | last; | ||
1746 | } | ||
1745 | } | 1747 | } |
1746 | } | 1748 | } |
1747 | close(IN); | 1749 | close(IN); |
diff --git a/tools/testing/selftests/epoll/test_epoll.c b/tools/testing/selftests/epoll/test_epoll.c index e0fcff1e8331..f7525392ce84 100644 --- a/tools/testing/selftests/epoll/test_epoll.c +++ b/tools/testing/selftests/epoll/test_epoll.c | |||
@@ -162,14 +162,14 @@ void *write_thread_function(void *function_data) | |||
162 | int index; | 162 | int index; |
163 | struct write_thread_data *thread_data = | 163 | struct write_thread_data *thread_data = |
164 | (struct write_thread_data *)function_data; | 164 | (struct write_thread_data *)function_data; |
165 | while (!write_thread_data->stop) | 165 | while (!thread_data->stop) |
166 | for (index = 0; | 166 | for (index = 0; |
167 | !thread_data->stop && (index < thread_data->n_fds); | 167 | !thread_data->stop && (index < thread_data->n_fds); |
168 | ++index) | 168 | ++index) |
169 | if ((write(thread_data->fds[index], &data, 1) < 1) && | 169 | if ((write(thread_data->fds[index], &data, 1) < 1) && |
170 | (errno != EAGAIN) && | 170 | (errno != EAGAIN) && |
171 | (errno != EWOULDBLOCK)) { | 171 | (errno != EWOULDBLOCK)) { |
172 | write_thread_data->status = errno; | 172 | thread_data->status = errno; |
173 | return; | 173 | return; |
174 | } | 174 | } |
175 | } | 175 | } |
diff --git a/tools/vm/page-types.c b/tools/vm/page-types.c index cd1b03e80899..b76edf2f8333 100644 --- a/tools/vm/page-types.c +++ b/tools/vm/page-types.c | |||
@@ -35,7 +35,7 @@ | |||
35 | #include <sys/mount.h> | 35 | #include <sys/mount.h> |
36 | #include <sys/statfs.h> | 36 | #include <sys/statfs.h> |
37 | #include "../../include/uapi/linux/magic.h" | 37 | #include "../../include/uapi/linux/magic.h" |
38 | #include "../../include/linux/kernel-page-flags.h" | 38 | #include "../../include/uapi/linux/kernel-page-flags.h" |
39 | 39 | ||
40 | 40 | ||
41 | #ifndef MAX_PATH | 41 | #ifndef MAX_PATH |
diff --git a/usr/gen_init_cpio.c b/usr/gen_init_cpio.c index af0f22fb1ef7..aca6edcbbc6f 100644 --- a/usr/gen_init_cpio.c +++ b/usr/gen_init_cpio.c | |||
@@ -303,7 +303,7 @@ static int cpio_mkfile(const char *name, const char *location, | |||
303 | int retval; | 303 | int retval; |
304 | int rc = -1; | 304 | int rc = -1; |
305 | int namesize; | 305 | int namesize; |
306 | int i; | 306 | unsigned int i; |
307 | 307 | ||
308 | mode |= S_IFREG; | 308 | mode |= S_IFREG; |
309 | 309 | ||
@@ -381,25 +381,28 @@ error: | |||
381 | 381 | ||
382 | static char *cpio_replace_env(char *new_location) | 382 | static char *cpio_replace_env(char *new_location) |
383 | { | 383 | { |
384 | char expanded[PATH_MAX + 1]; | 384 | char expanded[PATH_MAX + 1]; |
385 | char env_var[PATH_MAX + 1]; | 385 | char env_var[PATH_MAX + 1]; |
386 | char *start; | 386 | char *start; |
387 | char *end; | 387 | char *end; |
388 | 388 | ||
389 | for (start = NULL; (start = strstr(new_location, "${")); ) { | 389 | for (start = NULL; (start = strstr(new_location, "${")); ) { |
390 | end = strchr(start, '}'); | 390 | end = strchr(start, '}'); |
391 | if (start < end) { | 391 | if (start < end) { |
392 | *env_var = *expanded = '\0'; | 392 | *env_var = *expanded = '\0'; |
393 | strncat(env_var, start + 2, end - start - 2); | 393 | strncat(env_var, start + 2, end - start - 2); |
394 | strncat(expanded, new_location, start - new_location); | 394 | strncat(expanded, new_location, start - new_location); |
395 | strncat(expanded, getenv(env_var), PATH_MAX); | 395 | strncat(expanded, getenv(env_var), |
396 | strncat(expanded, end + 1, PATH_MAX); | 396 | PATH_MAX - strlen(expanded)); |
397 | strncpy(new_location, expanded, PATH_MAX); | 397 | strncat(expanded, end + 1, |
398 | } else | 398 | PATH_MAX - strlen(expanded)); |
399 | break; | 399 | strncpy(new_location, expanded, PATH_MAX); |
400 | } | 400 | new_location[PATH_MAX] = 0; |
401 | 401 | } else | |
402 | return new_location; | 402 | break; |
403 | } | ||
404 | |||
405 | return new_location; | ||
403 | } | 406 | } |
404 | 407 | ||
405 | 408 | ||
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index e59bb63cb089..be70035fd42a 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c | |||
@@ -1322,9 +1322,7 @@ EXPORT_SYMBOL_GPL(kvm_release_page_clean); | |||
1322 | 1322 | ||
1323 | void kvm_release_pfn_clean(pfn_t pfn) | 1323 | void kvm_release_pfn_clean(pfn_t pfn) |
1324 | { | 1324 | { |
1325 | WARN_ON(is_error_pfn(pfn)); | 1325 | if (!is_error_pfn(pfn) && !kvm_is_mmio_pfn(pfn)) |
1326 | |||
1327 | if (!kvm_is_mmio_pfn(pfn)) | ||
1328 | put_page(pfn_to_page(pfn)); | 1326 | put_page(pfn_to_page(pfn)); |
1329 | } | 1327 | } |
1330 | EXPORT_SYMBOL_GPL(kvm_release_pfn_clean); | 1328 | EXPORT_SYMBOL_GPL(kvm_release_pfn_clean); |