diff options
525 files changed, 7661 insertions, 3011 deletions
diff --git a/Documentation/DMA-attributes.txt b/Documentation/DMA-attributes.txt index b768cc0e402b..5c72eed89563 100644 --- a/Documentation/DMA-attributes.txt +++ b/Documentation/DMA-attributes.txt | |||
@@ -31,3 +31,21 @@ may be weakly ordered, that is that reads and writes may pass each other. | |||
31 | Since it is optional for platforms to implement DMA_ATTR_WEAK_ORDERING, | 31 | Since it is optional for platforms to implement DMA_ATTR_WEAK_ORDERING, |
32 | those that do not will simply ignore the attribute and exhibit default | 32 | those that do not will simply ignore the attribute and exhibit default |
33 | behavior. | 33 | behavior. |
34 | |||
35 | DMA_ATTR_WRITE_COMBINE | ||
36 | ---------------------- | ||
37 | |||
38 | DMA_ATTR_WRITE_COMBINE specifies that writes to the mapping may be | ||
39 | buffered to improve performance. | ||
40 | |||
41 | Since it is optional for platforms to implement DMA_ATTR_WRITE_COMBINE, | ||
42 | those that do not will simply ignore the attribute and exhibit default | ||
43 | behavior. | ||
44 | |||
45 | DMA_ATTR_NON_CONSISTENT | ||
46 | ----------------------- | ||
47 | |||
48 | DMA_ATTR_NON_CONSISTENT lets the platform to choose to return either | ||
49 | consistent or non-consistent memory as it sees fit. By using this API, | ||
50 | you are guaranteeing to the platform that you have all the correct and | ||
51 | necessary sync points for this memory in the driver. | ||
diff --git a/Documentation/DocBook/device-drivers.tmpl b/Documentation/DocBook/device-drivers.tmpl index 9c27e5125dd2..7514dbf0a679 100644 --- a/Documentation/DocBook/device-drivers.tmpl +++ b/Documentation/DocBook/device-drivers.tmpl | |||
@@ -446,4 +446,21 @@ X!Idrivers/video/console/fonts.c | |||
446 | !Edrivers/i2c/i2c-core.c | 446 | !Edrivers/i2c/i2c-core.c |
447 | </chapter> | 447 | </chapter> |
448 | 448 | ||
449 | <chapter id="hsi"> | ||
450 | <title>High Speed Synchronous Serial Interface (HSI)</title> | ||
451 | |||
452 | <para> | ||
453 | High Speed Synchronous Serial Interface (HSI) is a | ||
454 | serial interface mainly used for connecting application | ||
455 | engines (APE) with cellular modem engines (CMT) in cellular | ||
456 | handsets. | ||
457 | |||
458 | HSI provides multiplexing for up to 16 logical channels, | ||
459 | low-latency and full duplex communication. | ||
460 | </para> | ||
461 | |||
462 | !Iinclude/linux/hsi/hsi.h | ||
463 | !Edrivers/hsi/hsi.c | ||
464 | </chapter> | ||
465 | |||
449 | </book> | 466 | </book> |
diff --git a/Documentation/cgroups/cpusets.txt b/Documentation/cgroups/cpusets.txt index 5c51ed406d1d..cefd3d8bbd11 100644 --- a/Documentation/cgroups/cpusets.txt +++ b/Documentation/cgroups/cpusets.txt | |||
@@ -217,7 +217,7 @@ and name space for cpusets, with a minimum of additional kernel code. | |||
217 | 217 | ||
218 | The cpus and mems files in the root (top_cpuset) cpuset are | 218 | The cpus and mems files in the root (top_cpuset) cpuset are |
219 | read-only. The cpus file automatically tracks the value of | 219 | read-only. The cpus file automatically tracks the value of |
220 | cpu_online_map using a CPU hotplug notifier, and the mems file | 220 | cpu_online_mask using a CPU hotplug notifier, and the mems file |
221 | automatically tracks the value of node_states[N_HIGH_MEMORY]--i.e., | 221 | automatically tracks the value of node_states[N_HIGH_MEMORY]--i.e., |
222 | nodes with memory--using the cpuset_track_online_nodes() hook. | 222 | nodes with memory--using the cpuset_track_online_nodes() hook. |
223 | 223 | ||
diff --git a/Documentation/cpu-hotplug.txt b/Documentation/cpu-hotplug.txt index a20bfd415e41..66ef8f35613d 100644 --- a/Documentation/cpu-hotplug.txt +++ b/Documentation/cpu-hotplug.txt | |||
@@ -47,7 +47,7 @@ maxcpus=n Restrict boot time cpus to n. Say if you have 4 cpus, using | |||
47 | other cpus later online, read FAQ's for more info. | 47 | other cpus later online, read FAQ's for more info. |
48 | 48 | ||
49 | additional_cpus=n (*) Use this to limit hotpluggable cpus. This option sets | 49 | additional_cpus=n (*) Use this to limit hotpluggable cpus. This option sets |
50 | cpu_possible_map = cpu_present_map + additional_cpus | 50 | cpu_possible_mask = cpu_present_mask + additional_cpus |
51 | 51 | ||
52 | cede_offline={"off","on"} Use this option to disable/enable putting offlined | 52 | cede_offline={"off","on"} Use this option to disable/enable putting offlined |
53 | processors to an extended H_CEDE state on | 53 | processors to an extended H_CEDE state on |
@@ -64,11 +64,11 @@ should only rely on this to count the # of cpus, but *MUST* not rely | |||
64 | on the apicid values in those tables for disabled apics. In the event | 64 | on the apicid values in those tables for disabled apics. In the event |
65 | BIOS doesn't mark such hot-pluggable cpus as disabled entries, one could | 65 | BIOS doesn't mark such hot-pluggable cpus as disabled entries, one could |
66 | use this parameter "additional_cpus=x" to represent those cpus in the | 66 | use this parameter "additional_cpus=x" to represent those cpus in the |
67 | cpu_possible_map. | 67 | cpu_possible_mask. |
68 | 68 | ||
69 | possible_cpus=n [s390,x86_64] use this to set hotpluggable cpus. | 69 | possible_cpus=n [s390,x86_64] use this to set hotpluggable cpus. |
70 | This option sets possible_cpus bits in | 70 | This option sets possible_cpus bits in |
71 | cpu_possible_map. Thus keeping the numbers of bits set | 71 | cpu_possible_mask. Thus keeping the numbers of bits set |
72 | constant even if the machine gets rebooted. | 72 | constant even if the machine gets rebooted. |
73 | 73 | ||
74 | CPU maps and such | 74 | CPU maps and such |
@@ -76,7 +76,7 @@ CPU maps and such | |||
76 | [More on cpumaps and primitive to manipulate, please check | 76 | [More on cpumaps and primitive to manipulate, please check |
77 | include/linux/cpumask.h that has more descriptive text.] | 77 | include/linux/cpumask.h that has more descriptive text.] |
78 | 78 | ||
79 | cpu_possible_map: Bitmap of possible CPUs that can ever be available in the | 79 | cpu_possible_mask: Bitmap of possible CPUs that can ever be available in the |
80 | system. This is used to allocate some boot time memory for per_cpu variables | 80 | system. This is used to allocate some boot time memory for per_cpu variables |
81 | that aren't designed to grow/shrink as CPUs are made available or removed. | 81 | that aren't designed to grow/shrink as CPUs are made available or removed. |
82 | Once set during boot time discovery phase, the map is static, i.e no bits | 82 | Once set during boot time discovery phase, the map is static, i.e no bits |
@@ -84,13 +84,13 @@ are added or removed anytime. Trimming it accurately for your system needs | |||
84 | upfront can save some boot time memory. See below for how we use heuristics | 84 | upfront can save some boot time memory. See below for how we use heuristics |
85 | in x86_64 case to keep this under check. | 85 | in x86_64 case to keep this under check. |
86 | 86 | ||
87 | cpu_online_map: Bitmap of all CPUs currently online. Its set in __cpu_up() | 87 | cpu_online_mask: Bitmap of all CPUs currently online. Its set in __cpu_up() |
88 | after a cpu is available for kernel scheduling and ready to receive | 88 | after a cpu is available for kernel scheduling and ready to receive |
89 | interrupts from devices. Its cleared when a cpu is brought down using | 89 | interrupts from devices. Its cleared when a cpu is brought down using |
90 | __cpu_disable(), before which all OS services including interrupts are | 90 | __cpu_disable(), before which all OS services including interrupts are |
91 | migrated to another target CPU. | 91 | migrated to another target CPU. |
92 | 92 | ||
93 | cpu_present_map: Bitmap of CPUs currently present in the system. Not all | 93 | cpu_present_mask: Bitmap of CPUs currently present in the system. Not all |
94 | of them may be online. When physical hotplug is processed by the relevant | 94 | of them may be online. When physical hotplug is processed by the relevant |
95 | subsystem (e.g ACPI) can change and new bit either be added or removed | 95 | subsystem (e.g ACPI) can change and new bit either be added or removed |
96 | from the map depending on the event is hot-add/hot-remove. There are currently | 96 | from the map depending on the event is hot-add/hot-remove. There are currently |
@@ -99,22 +99,22 @@ at which time hotplug is disabled. | |||
99 | 99 | ||
100 | You really dont need to manipulate any of the system cpu maps. They should | 100 | You really dont need to manipulate any of the system cpu maps. They should |
101 | be read-only for most use. When setting up per-cpu resources almost always use | 101 | be read-only for most use. When setting up per-cpu resources almost always use |
102 | cpu_possible_map/for_each_possible_cpu() to iterate. | 102 | cpu_possible_mask/for_each_possible_cpu() to iterate. |
103 | 103 | ||
104 | Never use anything other than cpumask_t to represent bitmap of CPUs. | 104 | Never use anything other than cpumask_t to represent bitmap of CPUs. |
105 | 105 | ||
106 | #include <linux/cpumask.h> | 106 | #include <linux/cpumask.h> |
107 | 107 | ||
108 | for_each_possible_cpu - Iterate over cpu_possible_map | 108 | for_each_possible_cpu - Iterate over cpu_possible_mask |
109 | for_each_online_cpu - Iterate over cpu_online_map | 109 | for_each_online_cpu - Iterate over cpu_online_mask |
110 | for_each_present_cpu - Iterate over cpu_present_map | 110 | for_each_present_cpu - Iterate over cpu_present_mask |
111 | for_each_cpu_mask(x,mask) - Iterate over some random collection of cpu mask. | 111 | for_each_cpu_mask(x,mask) - Iterate over some random collection of cpu mask. |
112 | 112 | ||
113 | #include <linux/cpu.h> | 113 | #include <linux/cpu.h> |
114 | get_online_cpus() and put_online_cpus(): | 114 | get_online_cpus() and put_online_cpus(): |
115 | 115 | ||
116 | The above calls are used to inhibit cpu hotplug operations. While the | 116 | The above calls are used to inhibit cpu hotplug operations. While the |
117 | cpu_hotplug.refcount is non zero, the cpu_online_map will not change. | 117 | cpu_hotplug.refcount is non zero, the cpu_online_mask will not change. |
118 | If you merely need to avoid cpus going away, you could also use | 118 | If you merely need to avoid cpus going away, you could also use |
119 | preempt_disable() and preempt_enable() for those sections. | 119 | preempt_disable() and preempt_enable() for those sections. |
120 | Just remember the critical section cannot call any | 120 | Just remember the critical section cannot call any |
diff --git a/Documentation/devicetree/bindings/mtd/atmel-nand.txt b/Documentation/devicetree/bindings/mtd/atmel-nand.txt index 5903ecf6e895..a20069502f5a 100644 --- a/Documentation/devicetree/bindings/mtd/atmel-nand.txt +++ b/Documentation/devicetree/bindings/mtd/atmel-nand.txt | |||
@@ -27,13 +27,13 @@ nand0: nand@40000000,0 { | |||
27 | reg = <0x40000000 0x10000000 | 27 | reg = <0x40000000 0x10000000 |
28 | 0xffffe800 0x200 | 28 | 0xffffe800 0x200 |
29 | >; | 29 | >; |
30 | atmel,nand-addr-offset = <21>; | 30 | atmel,nand-addr-offset = <21>; /* ale */ |
31 | atmel,nand-cmd-offset = <22>; | 31 | atmel,nand-cmd-offset = <22>; /* cle */ |
32 | nand-on-flash-bbt; | 32 | nand-on-flash-bbt; |
33 | nand-ecc-mode = "soft"; | 33 | nand-ecc-mode = "soft"; |
34 | gpios = <&pioC 13 0 | 34 | gpios = <&pioC 13 0 /* rdy */ |
35 | &pioC 14 0 | 35 | &pioC 14 0 /* nce */ |
36 | 0 | 36 | 0 /* cd */ |
37 | >; | 37 | >; |
38 | partition@0 { | 38 | partition@0 { |
39 | ... | 39 | ... |
diff --git a/Documentation/devicetree/bindings/regulator/anatop-regulator.txt b/Documentation/devicetree/bindings/regulator/anatop-regulator.txt new file mode 100644 index 000000000000..357758cb6e92 --- /dev/null +++ b/Documentation/devicetree/bindings/regulator/anatop-regulator.txt | |||
@@ -0,0 +1,29 @@ | |||
1 | Anatop Voltage regulators | ||
2 | |||
3 | Required properties: | ||
4 | - compatible: Must be "fsl,anatop-regulator" | ||
5 | - anatop-reg-offset: Anatop MFD register offset | ||
6 | - anatop-vol-bit-shift: Bit shift for the register | ||
7 | - anatop-vol-bit-width: Number of bits used in the register | ||
8 | - anatop-min-bit-val: Minimum value of this register | ||
9 | - anatop-min-voltage: Minimum voltage of this regulator | ||
10 | - anatop-max-voltage: Maximum voltage of this regulator | ||
11 | |||
12 | Any property defined as part of the core regulator | ||
13 | binding, defined in regulator.txt, can also be used. | ||
14 | |||
15 | Example: | ||
16 | |||
17 | regulator-vddpu { | ||
18 | compatible = "fsl,anatop-regulator"; | ||
19 | regulator-name = "vddpu"; | ||
20 | regulator-min-microvolt = <725000>; | ||
21 | regulator-max-microvolt = <1300000>; | ||
22 | regulator-always-on; | ||
23 | anatop-reg-offset = <0x140>; | ||
24 | anatop-vol-bit-shift = <9>; | ||
25 | anatop-vol-bit-width = <5>; | ||
26 | anatop-min-bit-val = <1>; | ||
27 | anatop-min-voltage = <725000>; | ||
28 | anatop-max-voltage = <1300000>; | ||
29 | }; | ||
diff --git a/Documentation/feature-removal-schedule.txt b/Documentation/feature-removal-schedule.txt index c1be8066ea59..709e08e9a222 100644 --- a/Documentation/feature-removal-schedule.txt +++ b/Documentation/feature-removal-schedule.txt | |||
@@ -6,14 +6,6 @@ be removed from this file. | |||
6 | 6 | ||
7 | --------------------------- | 7 | --------------------------- |
8 | 8 | ||
9 | What: x86 floppy disable_hlt | ||
10 | When: 2012 | ||
11 | Why: ancient workaround of dubious utility clutters the | ||
12 | code used by everybody else. | ||
13 | Who: Len Brown <len.brown@intel.com> | ||
14 | |||
15 | --------------------------- | ||
16 | |||
17 | What: CONFIG_APM_CPU_IDLE, and its ability to call APM BIOS in idle | 9 | What: CONFIG_APM_CPU_IDLE, and its ability to call APM BIOS in idle |
18 | When: 2012 | 10 | When: 2012 |
19 | Why: This optional sub-feature of APM is of dubious reliability, | 11 | Why: This optional sub-feature of APM is of dubious reliability, |
diff --git a/Documentation/hwmon/k10temp b/Documentation/hwmon/k10temp index a10f73624ad3..90956b618025 100644 --- a/Documentation/hwmon/k10temp +++ b/Documentation/hwmon/k10temp | |||
@@ -11,7 +11,7 @@ Supported chips: | |||
11 | Socket S1G2: Athlon (X2), Sempron (X2), Turion X2 (Ultra) | 11 | Socket S1G2: Athlon (X2), Sempron (X2), Turion X2 (Ultra) |
12 | * AMD Family 12h processors: "Llano" (E2/A4/A6/A8-Series) | 12 | * AMD Family 12h processors: "Llano" (E2/A4/A6/A8-Series) |
13 | * AMD Family 14h processors: "Brazos" (C/E/G/Z-Series) | 13 | * AMD Family 14h processors: "Brazos" (C/E/G/Z-Series) |
14 | * AMD Family 15h processors: "Bulldozer" | 14 | * AMD Family 15h processors: "Bulldozer" (FX-Series), "Trinity" |
15 | 15 | ||
16 | Prefix: 'k10temp' | 16 | Prefix: 'k10temp' |
17 | Addresses scanned: PCI space | 17 | Addresses scanned: PCI space |
diff --git a/Documentation/ioctl/ioctl-number.txt b/Documentation/ioctl/ioctl-number.txt index 3b7488fc3373..e34b531dc316 100644 --- a/Documentation/ioctl/ioctl-number.txt +++ b/Documentation/ioctl/ioctl-number.txt | |||
@@ -225,6 +225,7 @@ Code Seq#(hex) Include File Comments | |||
225 | 'j' 00-3F linux/joystick.h | 225 | 'j' 00-3F linux/joystick.h |
226 | 'k' 00-0F linux/spi/spidev.h conflict! | 226 | 'k' 00-0F linux/spi/spidev.h conflict! |
227 | 'k' 00-05 video/kyro.h conflict! | 227 | 'k' 00-05 video/kyro.h conflict! |
228 | 'k' 10-17 linux/hsi/hsi_char.h HSI character device | ||
228 | 'l' 00-3F linux/tcfs_fs.h transparent cryptographic file system | 229 | 'l' 00-3F linux/tcfs_fs.h transparent cryptographic file system |
229 | <http://web.archive.org/web/*/http://mikonos.dia.unisa.it/tcfs> | 230 | <http://web.archive.org/web/*/http://mikonos.dia.unisa.it/tcfs> |
230 | 'l' 40-7F linux/udf_fs_i.h in development: | 231 | 'l' 40-7F linux/udf_fs_i.h in development: |
diff --git a/Documentation/networking/driver.txt b/Documentation/networking/driver.txt index 03283daa64fe..da59e2884130 100644 --- a/Documentation/networking/driver.txt +++ b/Documentation/networking/driver.txt | |||
@@ -2,16 +2,16 @@ Document about softnet driver issues | |||
2 | 2 | ||
3 | Transmit path guidelines: | 3 | Transmit path guidelines: |
4 | 4 | ||
5 | 1) The hard_start_xmit method must never return '1' under any | 5 | 1) The ndo_start_xmit method must not return NETDEV_TX_BUSY under |
6 | normal circumstances. It is considered a hard error unless | 6 | any normal circumstances. It is considered a hard error unless |
7 | there is no way your device can tell ahead of time when it's | 7 | there is no way your device can tell ahead of time when it's |
8 | transmit function will become busy. | 8 | transmit function will become busy. |
9 | 9 | ||
10 | Instead it must maintain the queue properly. For example, | 10 | Instead it must maintain the queue properly. For example, |
11 | for a driver implementing scatter-gather this means: | 11 | for a driver implementing scatter-gather this means: |
12 | 12 | ||
13 | static int drv_hard_start_xmit(struct sk_buff *skb, | 13 | static netdev_tx_t drv_hard_start_xmit(struct sk_buff *skb, |
14 | struct net_device *dev) | 14 | struct net_device *dev) |
15 | { | 15 | { |
16 | struct drv *dp = netdev_priv(dev); | 16 | struct drv *dp = netdev_priv(dev); |
17 | 17 | ||
@@ -23,7 +23,7 @@ Transmit path guidelines: | |||
23 | unlock_tx(dp); | 23 | unlock_tx(dp); |
24 | printk(KERN_ERR PFX "%s: BUG! Tx Ring full when queue awake!\n", | 24 | printk(KERN_ERR PFX "%s: BUG! Tx Ring full when queue awake!\n", |
25 | dev->name); | 25 | dev->name); |
26 | return 1; | 26 | return NETDEV_TX_BUSY; |
27 | } | 27 | } |
28 | 28 | ||
29 | ... queue packet to card ... | 29 | ... queue packet to card ... |
@@ -35,6 +35,7 @@ Transmit path guidelines: | |||
35 | ... | 35 | ... |
36 | unlock_tx(dp); | 36 | unlock_tx(dp); |
37 | ... | 37 | ... |
38 | return NETDEV_TX_OK; | ||
38 | } | 39 | } |
39 | 40 | ||
40 | And then at the end of your TX reclamation event handling: | 41 | And then at the end of your TX reclamation event handling: |
@@ -58,15 +59,12 @@ Transmit path guidelines: | |||
58 | TX_BUFFS_AVAIL(dp) > 0) | 59 | TX_BUFFS_AVAIL(dp) > 0) |
59 | netif_wake_queue(dp->dev); | 60 | netif_wake_queue(dp->dev); |
60 | 61 | ||
61 | 2) Do not forget to update netdev->trans_start to jiffies after | 62 | 2) An ndo_start_xmit method must not modify the shared parts of a |
62 | each new tx packet is given to the hardware. | ||
63 | |||
64 | 3) A hard_start_xmit method must not modify the shared parts of a | ||
65 | cloned SKB. | 63 | cloned SKB. |
66 | 64 | ||
67 | 4) Do not forget that once you return 0 from your hard_start_xmit | 65 | 3) Do not forget that once you return NETDEV_TX_OK from your |
68 | method, it is your driver's responsibility to free up the SKB | 66 | ndo_start_xmit method, it is your driver's responsibility to free |
69 | and in some finite amount of time. | 67 | up the SKB and in some finite amount of time. |
70 | 68 | ||
71 | For example, this means that it is not allowed for your TX | 69 | For example, this means that it is not allowed for your TX |
72 | mitigation scheme to let TX packets "hang out" in the TX | 70 | mitigation scheme to let TX packets "hang out" in the TX |
@@ -74,8 +72,9 @@ Transmit path guidelines: | |||
74 | This error can deadlock sockets waiting for send buffer room | 72 | This error can deadlock sockets waiting for send buffer room |
75 | to be freed up. | 73 | to be freed up. |
76 | 74 | ||
77 | If you return 1 from the hard_start_xmit method, you must not keep | 75 | If you return NETDEV_TX_BUSY from the ndo_start_xmit method, you |
78 | any reference to that SKB and you must not attempt to free it up. | 76 | must not keep any reference to that SKB and you must not attempt |
77 | to free it up. | ||
79 | 78 | ||
80 | Probing guidelines: | 79 | Probing guidelines: |
81 | 80 | ||
@@ -85,10 +84,10 @@ Probing guidelines: | |||
85 | 84 | ||
86 | Close/stop guidelines: | 85 | Close/stop guidelines: |
87 | 86 | ||
88 | 1) After the dev->stop routine has been called, the hardware must | 87 | 1) After the ndo_stop routine has been called, the hardware must |
89 | not receive or transmit any data. All in flight packets must | 88 | not receive or transmit any data. All in flight packets must |
90 | be aborted. If necessary, poll or wait for completion of | 89 | be aborted. If necessary, poll or wait for completion of |
91 | any reset commands. | 90 | any reset commands. |
92 | 91 | ||
93 | 2) The dev->stop routine will be called by unregister_netdevice | 92 | 2) The ndo_stop routine will be called by unregister_netdevice |
94 | if device is still UP. | 93 | if device is still UP. |
diff --git a/Documentation/networking/ip-sysctl.txt b/Documentation/networking/ip-sysctl.txt index ad3e80e17b4f..bd80ba5847d2 100644 --- a/Documentation/networking/ip-sysctl.txt +++ b/Documentation/networking/ip-sysctl.txt | |||
@@ -604,15 +604,8 @@ IP Variables: | |||
604 | ip_local_port_range - 2 INTEGERS | 604 | ip_local_port_range - 2 INTEGERS |
605 | Defines the local port range that is used by TCP and UDP to | 605 | Defines the local port range that is used by TCP and UDP to |
606 | choose the local port. The first number is the first, the | 606 | choose the local port. The first number is the first, the |
607 | second the last local port number. Default value depends on | 607 | second the last local port number. The default values are |
608 | amount of memory available on the system: | 608 | 32768 and 61000 respectively. |
609 | > 128Mb 32768-61000 | ||
610 | < 128Mb 1024-4999 or even less. | ||
611 | This number defines number of active connections, which this | ||
612 | system can issue simultaneously to systems not supporting | ||
613 | TCP extensions (timestamps). With tcp_tw_recycle enabled | ||
614 | (i.e. by default) range 1024-4999 is enough to issue up to | ||
615 | 2000 connections per second to systems supporting timestamps. | ||
616 | 609 | ||
617 | ip_local_reserved_ports - list of comma separated ranges | 610 | ip_local_reserved_ports - list of comma separated ranges |
618 | Specify the ports which are reserved for known third-party | 611 | Specify the ports which are reserved for known third-party |
diff --git a/Documentation/networking/netdevices.txt b/Documentation/networking/netdevices.txt index 89358341682a..c7ecc7080494 100644 --- a/Documentation/networking/netdevices.txt +++ b/Documentation/networking/netdevices.txt | |||
@@ -47,26 +47,25 @@ packets is preferred. | |||
47 | 47 | ||
48 | struct net_device synchronization rules | 48 | struct net_device synchronization rules |
49 | ======================================= | 49 | ======================================= |
50 | dev->open: | 50 | ndo_open: |
51 | Synchronization: rtnl_lock() semaphore. | 51 | Synchronization: rtnl_lock() semaphore. |
52 | Context: process | 52 | Context: process |
53 | 53 | ||
54 | dev->stop: | 54 | ndo_stop: |
55 | Synchronization: rtnl_lock() semaphore. | 55 | Synchronization: rtnl_lock() semaphore. |
56 | Context: process | 56 | Context: process |
57 | Note1: netif_running() is guaranteed false | 57 | Note: netif_running() is guaranteed false |
58 | Note2: dev->poll() is guaranteed to be stopped | ||
59 | 58 | ||
60 | dev->do_ioctl: | 59 | ndo_do_ioctl: |
61 | Synchronization: rtnl_lock() semaphore. | 60 | Synchronization: rtnl_lock() semaphore. |
62 | Context: process | 61 | Context: process |
63 | 62 | ||
64 | dev->get_stats: | 63 | ndo_get_stats: |
65 | Synchronization: dev_base_lock rwlock. | 64 | Synchronization: dev_base_lock rwlock. |
66 | Context: nominally process, but don't sleep inside an rwlock | 65 | Context: nominally process, but don't sleep inside an rwlock |
67 | 66 | ||
68 | dev->hard_start_xmit: | 67 | ndo_start_xmit: |
69 | Synchronization: netif_tx_lock spinlock. | 68 | Synchronization: __netif_tx_lock spinlock. |
70 | 69 | ||
71 | When the driver sets NETIF_F_LLTX in dev->features this will be | 70 | When the driver sets NETIF_F_LLTX in dev->features this will be |
72 | called without holding netif_tx_lock. In this case the driver | 71 | called without holding netif_tx_lock. In this case the driver |
@@ -87,20 +86,20 @@ dev->hard_start_xmit: | |||
87 | o NETDEV_TX_LOCKED Locking failed, please retry quickly. | 86 | o NETDEV_TX_LOCKED Locking failed, please retry quickly. |
88 | Only valid when NETIF_F_LLTX is set. | 87 | Only valid when NETIF_F_LLTX is set. |
89 | 88 | ||
90 | dev->tx_timeout: | 89 | ndo_tx_timeout: |
91 | Synchronization: netif_tx_lock spinlock. | 90 | Synchronization: netif_tx_lock spinlock; all TX queues frozen. |
92 | Context: BHs disabled | 91 | Context: BHs disabled |
93 | Notes: netif_queue_stopped() is guaranteed true | 92 | Notes: netif_queue_stopped() is guaranteed true |
94 | 93 | ||
95 | dev->set_rx_mode: | 94 | ndo_set_rx_mode: |
96 | Synchronization: netif_tx_lock spinlock. | 95 | Synchronization: netif_addr_lock spinlock. |
97 | Context: BHs disabled | 96 | Context: BHs disabled |
98 | 97 | ||
99 | struct napi_struct synchronization rules | 98 | struct napi_struct synchronization rules |
100 | ======================================== | 99 | ======================================== |
101 | napi->poll: | 100 | napi->poll: |
102 | Synchronization: NAPI_STATE_SCHED bit in napi->state. Device | 101 | Synchronization: NAPI_STATE_SCHED bit in napi->state. Device |
103 | driver's dev->close method will invoke napi_disable() on | 102 | driver's ndo_stop method will invoke napi_disable() on |
104 | all NAPI instances which will do a sleeping poll on the | 103 | all NAPI instances which will do a sleeping poll on the |
105 | NAPI_STATE_SCHED napi->state bit, waiting for all pending | 104 | NAPI_STATE_SCHED napi->state bit, waiting for all pending |
106 | NAPI activity to cease. | 105 | NAPI activity to cease. |
diff --git a/MAINTAINERS b/MAINTAINERS index eecf3441ac21..6d05ae236036 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
@@ -1251,7 +1251,6 @@ ATHEROS ATH5K WIRELESS DRIVER | |||
1251 | M: Jiri Slaby <jirislaby@gmail.com> | 1251 | M: Jiri Slaby <jirislaby@gmail.com> |
1252 | M: Nick Kossifidis <mickflemm@gmail.com> | 1252 | M: Nick Kossifidis <mickflemm@gmail.com> |
1253 | M: "Luis R. Rodriguez" <mcgrof@qca.qualcomm.com> | 1253 | M: "Luis R. Rodriguez" <mcgrof@qca.qualcomm.com> |
1254 | M: Bob Copeland <me@bobcopeland.com> | ||
1255 | L: linux-wireless@vger.kernel.org | 1254 | L: linux-wireless@vger.kernel.org |
1256 | L: ath5k-devel@lists.ath5k.org | 1255 | L: ath5k-devel@lists.ath5k.org |
1257 | W: http://wireless.kernel.org/en/users/Drivers/ath5k | 1256 | W: http://wireless.kernel.org/en/users/Drivers/ath5k |
@@ -3557,17 +3556,13 @@ L: linux-pm@vger.kernel.org | |||
3557 | S: Supported | 3556 | S: Supported |
3558 | F: arch/x86/platform/mrst/pmu.* | 3557 | F: arch/x86/platform/mrst/pmu.* |
3559 | 3558 | ||
3560 | INTEL PRO/WIRELESS 2100 NETWORK CONNECTION SUPPORT | 3559 | INTEL PRO/WIRELESS 2100, 2200BG, 2915ABG NETWORK CONNECTION SUPPORT |
3560 | M: Stanislav Yakovlev <stas.yakovlev@gmail.com> | ||
3561 | L: linux-wireless@vger.kernel.org | 3561 | L: linux-wireless@vger.kernel.org |
3562 | S: Orphan | 3562 | S: Maintained |
3563 | F: Documentation/networking/README.ipw2100 | 3563 | F: Documentation/networking/README.ipw2100 |
3564 | F: drivers/net/wireless/ipw2x00/ipw2100.* | ||
3565 | |||
3566 | INTEL PRO/WIRELESS 2915ABG NETWORK CONNECTION SUPPORT | ||
3567 | L: linux-wireless@vger.kernel.org | ||
3568 | S: Orphan | ||
3569 | F: Documentation/networking/README.ipw2200 | 3564 | F: Documentation/networking/README.ipw2200 |
3570 | F: drivers/net/wireless/ipw2x00/ipw2200.* | 3565 | F: drivers/net/wireless/ipw2x00/ |
3571 | 3566 | ||
3572 | INTEL(R) TRUSTED EXECUTION TECHNOLOGY (TXT) | 3567 | INTEL(R) TRUSTED EXECUTION TECHNOLOGY (TXT) |
3573 | M: Joseph Cihula <joseph.cihula@intel.com> | 3568 | M: Joseph Cihula <joseph.cihula@intel.com> |
@@ -4314,6 +4309,13 @@ W: http://www.kernel.org/doc/man-pages | |||
4314 | L: linux-man@vger.kernel.org | 4309 | L: linux-man@vger.kernel.org |
4315 | S: Maintained | 4310 | S: Maintained |
4316 | 4311 | ||
4312 | MARVELL GIGABIT ETHERNET DRIVERS (skge/sky2) | ||
4313 | M: Mirko Lindner <mlindner@marvell.com> | ||
4314 | M: Stephen Hemminger <shemminger@vyatta.com> | ||
4315 | L: netdev@vger.kernel.org | ||
4316 | S: Maintained | ||
4317 | F: drivers/net/ethernet/marvell/sk* | ||
4318 | |||
4317 | MARVELL LIBERTAS WIRELESS DRIVER | 4319 | MARVELL LIBERTAS WIRELESS DRIVER |
4318 | M: Dan Williams <dcbw@redhat.com> | 4320 | M: Dan Williams <dcbw@redhat.com> |
4319 | L: libertas-dev@lists.infradead.org | 4321 | L: libertas-dev@lists.infradead.org |
@@ -4344,12 +4346,6 @@ M: Nicolas Pitre <nico@fluxnic.net> | |||
4344 | S: Odd Fixes | 4346 | S: Odd Fixes |
4345 | F: drivers/mmc/host/mvsdio.* | 4347 | F: drivers/mmc/host/mvsdio.* |
4346 | 4348 | ||
4347 | MARVELL YUKON / SYSKONNECT DRIVER | ||
4348 | M: Mirko Lindner <mlindner@syskonnect.de> | ||
4349 | M: Ralph Roesler <rroesler@syskonnect.de> | ||
4350 | W: http://www.syskonnect.com | ||
4351 | S: Supported | ||
4352 | |||
4353 | MATROX FRAMEBUFFER DRIVER | 4349 | MATROX FRAMEBUFFER DRIVER |
4354 | L: linux-fbdev@vger.kernel.org | 4350 | L: linux-fbdev@vger.kernel.org |
4355 | S: Orphan | 4351 | S: Orphan |
@@ -5642,7 +5638,7 @@ M: Ohad Ben-Cohen <ohad@wizery.com> | |||
5642 | S: Maintained | 5638 | S: Maintained |
5643 | F: drivers/remoteproc/ | 5639 | F: drivers/remoteproc/ |
5644 | F: Documentation/remoteproc.txt | 5640 | F: Documentation/remoteproc.txt |
5645 | F: include/linux/remoteproc.txt | 5641 | F: include/linux/remoteproc.h |
5646 | 5642 | ||
5647 | RFKILL | 5643 | RFKILL |
5648 | M: Johannes Berg <johannes@sipsolutions.net> | 5644 | M: Johannes Berg <johannes@sipsolutions.net> |
@@ -6121,12 +6117,6 @@ W: http://www.winischhofer.at/linuxsisusbvga.shtml | |||
6121 | S: Maintained | 6117 | S: Maintained |
6122 | F: drivers/usb/misc/sisusbvga/ | 6118 | F: drivers/usb/misc/sisusbvga/ |
6123 | 6119 | ||
6124 | SKGE, SKY2 10/100/1000 GIGABIT ETHERNET DRIVERS | ||
6125 | M: Stephen Hemminger <shemminger@vyatta.com> | ||
6126 | L: netdev@vger.kernel.org | ||
6127 | S: Maintained | ||
6128 | F: drivers/net/ethernet/marvell/sk* | ||
6129 | |||
6130 | SLAB ALLOCATOR | 6120 | SLAB ALLOCATOR |
6131 | M: Christoph Lameter <cl@linux-foundation.org> | 6121 | M: Christoph Lameter <cl@linux-foundation.org> |
6132 | M: Pekka Enberg <penberg@kernel.org> | 6122 | M: Pekka Enberg <penberg@kernel.org> |
@@ -6292,6 +6282,15 @@ F: drivers/tty/serial/sunsu.c | |||
6292 | F: drivers/tty/serial/sunzilog.c | 6282 | F: drivers/tty/serial/sunzilog.c |
6293 | F: drivers/tty/serial/sunzilog.h | 6283 | F: drivers/tty/serial/sunzilog.h |
6294 | 6284 | ||
6285 | SPARSE CHECKER | ||
6286 | M: "Christopher Li" <sparse@chrisli.org> | ||
6287 | L: linux-sparse@vger.kernel.org | ||
6288 | W: https://sparse.wiki.kernel.org/ | ||
6289 | T: git git://git.kernel.org/pub/scm/devel/sparse/sparse.git | ||
6290 | T: git git://git.kernel.org/pub/scm/devel/sparse/chrisl/sparse.git | ||
6291 | S: Maintained | ||
6292 | F: include/linux/compiler.h | ||
6293 | |||
6295 | SPEAR PLATFORM SUPPORT | 6294 | SPEAR PLATFORM SUPPORT |
6296 | M: Viresh Kumar <viresh.kumar@st.com> | 6295 | M: Viresh Kumar <viresh.kumar@st.com> |
6297 | L: spear-devel@list.st.com | 6296 | L: spear-devel@list.st.com |
diff --git a/arch/alpha/include/asm/dma-mapping.h b/arch/alpha/include/asm/dma-mapping.h index 4567aca6fdd6..dfa32f061320 100644 --- a/arch/alpha/include/asm/dma-mapping.h +++ b/arch/alpha/include/asm/dma-mapping.h | |||
@@ -12,16 +12,22 @@ static inline struct dma_map_ops *get_dma_ops(struct device *dev) | |||
12 | 12 | ||
13 | #include <asm-generic/dma-mapping-common.h> | 13 | #include <asm-generic/dma-mapping-common.h> |
14 | 14 | ||
15 | static inline void *dma_alloc_coherent(struct device *dev, size_t size, | 15 | #define dma_alloc_coherent(d,s,h,f) dma_alloc_attrs(d,s,h,f,NULL) |
16 | dma_addr_t *dma_handle, gfp_t gfp) | 16 | |
17 | static inline void *dma_alloc_attrs(struct device *dev, size_t size, | ||
18 | dma_addr_t *dma_handle, gfp_t gfp, | ||
19 | struct dma_attrs *attrs) | ||
17 | { | 20 | { |
18 | return get_dma_ops(dev)->alloc_coherent(dev, size, dma_handle, gfp); | 21 | return get_dma_ops(dev)->alloc(dev, size, dma_handle, gfp, attrs); |
19 | } | 22 | } |
20 | 23 | ||
21 | static inline void dma_free_coherent(struct device *dev, size_t size, | 24 | #define dma_free_coherent(d,s,c,h) dma_free_attrs(d,s,c,h,NULL) |
22 | void *vaddr, dma_addr_t dma_handle) | 25 | |
26 | static inline void dma_free_attrs(struct device *dev, size_t size, | ||
27 | void *vaddr, dma_addr_t dma_handle, | ||
28 | struct dma_attrs *attrs) | ||
23 | { | 29 | { |
24 | get_dma_ops(dev)->free_coherent(dev, size, vaddr, dma_handle); | 30 | get_dma_ops(dev)->free(dev, size, vaddr, dma_handle, attrs); |
25 | } | 31 | } |
26 | 32 | ||
27 | static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr) | 33 | static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr) |
diff --git a/arch/alpha/kernel/pci-noop.c b/arch/alpha/kernel/pci-noop.c index 04eea4894ef3..df24b76f9246 100644 --- a/arch/alpha/kernel/pci-noop.c +++ b/arch/alpha/kernel/pci-noop.c | |||
@@ -108,7 +108,8 @@ sys_pciconfig_write(unsigned long bus, unsigned long dfn, | |||
108 | } | 108 | } |
109 | 109 | ||
110 | static void *alpha_noop_alloc_coherent(struct device *dev, size_t size, | 110 | static void *alpha_noop_alloc_coherent(struct device *dev, size_t size, |
111 | dma_addr_t *dma_handle, gfp_t gfp) | 111 | dma_addr_t *dma_handle, gfp_t gfp, |
112 | struct dma_attrs *attrs) | ||
112 | { | 113 | { |
113 | void *ret; | 114 | void *ret; |
114 | 115 | ||
@@ -123,7 +124,8 @@ static void *alpha_noop_alloc_coherent(struct device *dev, size_t size, | |||
123 | } | 124 | } |
124 | 125 | ||
125 | static void alpha_noop_free_coherent(struct device *dev, size_t size, | 126 | static void alpha_noop_free_coherent(struct device *dev, size_t size, |
126 | void *cpu_addr, dma_addr_t dma_addr) | 127 | void *cpu_addr, dma_addr_t dma_addr, |
128 | struct dma_attrs *attrs) | ||
127 | { | 129 | { |
128 | free_pages((unsigned long)cpu_addr, get_order(size)); | 130 | free_pages((unsigned long)cpu_addr, get_order(size)); |
129 | } | 131 | } |
@@ -174,8 +176,8 @@ static int alpha_noop_set_mask(struct device *dev, u64 mask) | |||
174 | } | 176 | } |
175 | 177 | ||
176 | struct dma_map_ops alpha_noop_ops = { | 178 | struct dma_map_ops alpha_noop_ops = { |
177 | .alloc_coherent = alpha_noop_alloc_coherent, | 179 | .alloc = alpha_noop_alloc_coherent, |
178 | .free_coherent = alpha_noop_free_coherent, | 180 | .free = alpha_noop_free_coherent, |
179 | .map_page = alpha_noop_map_page, | 181 | .map_page = alpha_noop_map_page, |
180 | .map_sg = alpha_noop_map_sg, | 182 | .map_sg = alpha_noop_map_sg, |
181 | .mapping_error = alpha_noop_mapping_error, | 183 | .mapping_error = alpha_noop_mapping_error, |
diff --git a/arch/alpha/kernel/pci_iommu.c b/arch/alpha/kernel/pci_iommu.c index 43610804987d..cd634795aa9c 100644 --- a/arch/alpha/kernel/pci_iommu.c +++ b/arch/alpha/kernel/pci_iommu.c | |||
@@ -434,7 +434,8 @@ static void alpha_pci_unmap_page(struct device *dev, dma_addr_t dma_addr, | |||
434 | else DMA_ADDRP is undefined. */ | 434 | else DMA_ADDRP is undefined. */ |
435 | 435 | ||
436 | static void *alpha_pci_alloc_coherent(struct device *dev, size_t size, | 436 | static void *alpha_pci_alloc_coherent(struct device *dev, size_t size, |
437 | dma_addr_t *dma_addrp, gfp_t gfp) | 437 | dma_addr_t *dma_addrp, gfp_t gfp, |
438 | struct dma_attrs *attrs) | ||
438 | { | 439 | { |
439 | struct pci_dev *pdev = alpha_gendev_to_pci(dev); | 440 | struct pci_dev *pdev = alpha_gendev_to_pci(dev); |
440 | void *cpu_addr; | 441 | void *cpu_addr; |
@@ -478,7 +479,8 @@ try_again: | |||
478 | DMA_ADDR past this call are illegal. */ | 479 | DMA_ADDR past this call are illegal. */ |
479 | 480 | ||
480 | static void alpha_pci_free_coherent(struct device *dev, size_t size, | 481 | static void alpha_pci_free_coherent(struct device *dev, size_t size, |
481 | void *cpu_addr, dma_addr_t dma_addr) | 482 | void *cpu_addr, dma_addr_t dma_addr, |
483 | struct dma_attrs *attrs) | ||
482 | { | 484 | { |
483 | struct pci_dev *pdev = alpha_gendev_to_pci(dev); | 485 | struct pci_dev *pdev = alpha_gendev_to_pci(dev); |
484 | pci_unmap_single(pdev, dma_addr, size, PCI_DMA_BIDIRECTIONAL); | 486 | pci_unmap_single(pdev, dma_addr, size, PCI_DMA_BIDIRECTIONAL); |
@@ -952,8 +954,8 @@ static int alpha_pci_set_mask(struct device *dev, u64 mask) | |||
952 | } | 954 | } |
953 | 955 | ||
954 | struct dma_map_ops alpha_pci_ops = { | 956 | struct dma_map_ops alpha_pci_ops = { |
955 | .alloc_coherent = alpha_pci_alloc_coherent, | 957 | .alloc = alpha_pci_alloc_coherent, |
956 | .free_coherent = alpha_pci_free_coherent, | 958 | .free = alpha_pci_free_coherent, |
957 | .map_page = alpha_pci_map_page, | 959 | .map_page = alpha_pci_map_page, |
958 | .unmap_page = alpha_pci_unmap_page, | 960 | .unmap_page = alpha_pci_unmap_page, |
959 | .map_sg = alpha_pci_map_sg, | 961 | .map_sg = alpha_pci_map_sg, |
diff --git a/arch/alpha/kernel/signal.c b/arch/alpha/kernel/signal.c index 6f7feb5db271..35f2ef44de12 100644 --- a/arch/alpha/kernel/signal.c +++ b/arch/alpha/kernel/signal.c | |||
@@ -120,12 +120,13 @@ SYSCALL_DEFINE5(rt_sigaction, int, sig, const struct sigaction __user *, act, | |||
120 | */ | 120 | */ |
121 | SYSCALL_DEFINE1(sigsuspend, old_sigset_t, mask) | 121 | SYSCALL_DEFINE1(sigsuspend, old_sigset_t, mask) |
122 | { | 122 | { |
123 | mask &= _BLOCKABLE; | 123 | sigset_t blocked; |
124 | spin_lock_irq(¤t->sighand->siglock); | 124 | |
125 | current->saved_sigmask = current->blocked; | 125 | current->saved_sigmask = current->blocked; |
126 | siginitset(¤t->blocked, mask); | 126 | |
127 | recalc_sigpending(); | 127 | mask &= _BLOCKABLE; |
128 | spin_unlock_irq(¤t->sighand->siglock); | 128 | siginitset(&blocked, mask); |
129 | set_current_blocked(&blocked); | ||
129 | 130 | ||
130 | current->state = TASK_INTERRUPTIBLE; | 131 | current->state = TASK_INTERRUPTIBLE; |
131 | schedule(); | 132 | schedule(); |
@@ -238,10 +239,7 @@ do_sigreturn(struct sigcontext __user *sc, struct pt_regs *regs, | |||
238 | goto give_sigsegv; | 239 | goto give_sigsegv; |
239 | 240 | ||
240 | sigdelsetmask(&set, ~_BLOCKABLE); | 241 | sigdelsetmask(&set, ~_BLOCKABLE); |
241 | spin_lock_irq(¤t->sighand->siglock); | 242 | set_current_blocked(&set); |
242 | current->blocked = set; | ||
243 | recalc_sigpending(); | ||
244 | spin_unlock_irq(¤t->sighand->siglock); | ||
245 | 243 | ||
246 | if (restore_sigcontext(sc, regs, sw)) | 244 | if (restore_sigcontext(sc, regs, sw)) |
247 | goto give_sigsegv; | 245 | goto give_sigsegv; |
@@ -276,10 +274,7 @@ do_rt_sigreturn(struct rt_sigframe __user *frame, struct pt_regs *regs, | |||
276 | goto give_sigsegv; | 274 | goto give_sigsegv; |
277 | 275 | ||
278 | sigdelsetmask(&set, ~_BLOCKABLE); | 276 | sigdelsetmask(&set, ~_BLOCKABLE); |
279 | spin_lock_irq(¤t->sighand->siglock); | 277 | set_current_blocked(&set); |
280 | current->blocked = set; | ||
281 | recalc_sigpending(); | ||
282 | spin_unlock_irq(¤t->sighand->siglock); | ||
283 | 278 | ||
284 | if (restore_sigcontext(&frame->uc.uc_mcontext, regs, sw)) | 279 | if (restore_sigcontext(&frame->uc.uc_mcontext, regs, sw)) |
285 | goto give_sigsegv; | 280 | goto give_sigsegv; |
@@ -501,14 +496,8 @@ handle_signal(int sig, struct k_sigaction *ka, siginfo_t *info, | |||
501 | else | 496 | else |
502 | ret = setup_frame(sig, ka, oldset, regs, sw); | 497 | ret = setup_frame(sig, ka, oldset, regs, sw); |
503 | 498 | ||
504 | if (ret == 0) { | 499 | if (ret == 0) |
505 | spin_lock_irq(¤t->sighand->siglock); | 500 | block_sigmask(ka, sig); |
506 | sigorsets(¤t->blocked,¤t->blocked,&ka->sa.sa_mask); | ||
507 | if (!(ka->sa.sa_flags & SA_NODEFER)) | ||
508 | sigaddset(¤t->blocked,sig); | ||
509 | recalc_sigpending(); | ||
510 | spin_unlock_irq(¤t->sighand->siglock); | ||
511 | } | ||
512 | 501 | ||
513 | return ret; | 502 | return ret; |
514 | } | 503 | } |
diff --git a/arch/alpha/kernel/smp.c b/arch/alpha/kernel/smp.c index 4087a569b43b..50d438db1f6b 100644 --- a/arch/alpha/kernel/smp.c +++ b/arch/alpha/kernel/smp.c | |||
@@ -450,7 +450,7 @@ setup_smp(void) | |||
450 | smp_num_probed = 1; | 450 | smp_num_probed = 1; |
451 | } | 451 | } |
452 | 452 | ||
453 | printk(KERN_INFO "SMP: %d CPUs probed -- cpu_present_map = %lx\n", | 453 | printk(KERN_INFO "SMP: %d CPUs probed -- cpu_present_mask = %lx\n", |
454 | smp_num_probed, cpumask_bits(cpu_present_mask)[0]); | 454 | smp_num_probed, cpumask_bits(cpu_present_mask)[0]); |
455 | } | 455 | } |
456 | 456 | ||
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 93180845ae16..cf006d40342c 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig | |||
@@ -338,6 +338,7 @@ config ARCH_AT91 | |||
338 | select HAVE_CLK | 338 | select HAVE_CLK |
339 | select CLKDEV_LOOKUP | 339 | select CLKDEV_LOOKUP |
340 | select IRQ_DOMAIN | 340 | select IRQ_DOMAIN |
341 | select NEED_MACH_IO_H if PCCARD | ||
341 | help | 342 | help |
342 | This enables support for systems based on the Atmel AT91RM9200, | 343 | This enables support for systems based on the Atmel AT91RM9200, |
343 | AT91SAM9 processors. | 344 | AT91SAM9 processors. |
diff --git a/arch/arm/boot/dts/at91sam9g20.dtsi b/arch/arm/boot/dts/at91sam9g20.dtsi index 92f36627e7f8..799ad1889b51 100644 --- a/arch/arm/boot/dts/at91sam9g20.dtsi +++ b/arch/arm/boot/dts/at91sam9g20.dtsi | |||
@@ -35,7 +35,7 @@ | |||
35 | }; | 35 | }; |
36 | }; | 36 | }; |
37 | 37 | ||
38 | memory@20000000 { | 38 | memory { |
39 | reg = <0x20000000 0x08000000>; | 39 | reg = <0x20000000 0x08000000>; |
40 | }; | 40 | }; |
41 | 41 | ||
diff --git a/arch/arm/boot/dts/at91sam9g25ek.dts b/arch/arm/boot/dts/at91sam9g25ek.dts index ac0dc0031dda..7829a4d0cb22 100644 --- a/arch/arm/boot/dts/at91sam9g25ek.dts +++ b/arch/arm/boot/dts/at91sam9g25ek.dts | |||
@@ -37,8 +37,8 @@ | |||
37 | usb0: ohci@00600000 { | 37 | usb0: ohci@00600000 { |
38 | status = "okay"; | 38 | status = "okay"; |
39 | num-ports = <2>; | 39 | num-ports = <2>; |
40 | atmel,vbus-gpio = <&pioD 19 0 | 40 | atmel,vbus-gpio = <&pioD 19 1 |
41 | &pioD 20 0 | 41 | &pioD 20 1 |
42 | >; | 42 | >; |
43 | }; | 43 | }; |
44 | 44 | ||
diff --git a/arch/arm/boot/dts/at91sam9g45.dtsi b/arch/arm/boot/dts/at91sam9g45.dtsi index 3d0c32fb218f..9e6eb6ecea0e 100644 --- a/arch/arm/boot/dts/at91sam9g45.dtsi +++ b/arch/arm/boot/dts/at91sam9g45.dtsi | |||
@@ -36,7 +36,7 @@ | |||
36 | }; | 36 | }; |
37 | }; | 37 | }; |
38 | 38 | ||
39 | memory@70000000 { | 39 | memory { |
40 | reg = <0x70000000 0x10000000>; | 40 | reg = <0x70000000 0x10000000>; |
41 | }; | 41 | }; |
42 | 42 | ||
diff --git a/arch/arm/boot/dts/at91sam9m10g45ek.dts b/arch/arm/boot/dts/at91sam9m10g45ek.dts index c4c8ae4123d5..a3633bd13111 100644 --- a/arch/arm/boot/dts/at91sam9m10g45ek.dts +++ b/arch/arm/boot/dts/at91sam9m10g45ek.dts | |||
@@ -17,7 +17,7 @@ | |||
17 | bootargs = "mem=64M console=ttyS0,115200 root=/dev/mtdblock1 rw rootfstype=jffs2"; | 17 | bootargs = "mem=64M console=ttyS0,115200 root=/dev/mtdblock1 rw rootfstype=jffs2"; |
18 | }; | 18 | }; |
19 | 19 | ||
20 | memory@70000000 { | 20 | memory { |
21 | reg = <0x70000000 0x4000000>; | 21 | reg = <0x70000000 0x4000000>; |
22 | }; | 22 | }; |
23 | 23 | ||
@@ -73,8 +73,8 @@ | |||
73 | usb0: ohci@00700000 { | 73 | usb0: ohci@00700000 { |
74 | status = "okay"; | 74 | status = "okay"; |
75 | num-ports = <2>; | 75 | num-ports = <2>; |
76 | atmel,vbus-gpio = <&pioD 1 0 | 76 | atmel,vbus-gpio = <&pioD 1 1 |
77 | &pioD 3 0>; | 77 | &pioD 3 1>; |
78 | }; | 78 | }; |
79 | 79 | ||
80 | usb1: ehci@00800000 { | 80 | usb1: ehci@00800000 { |
diff --git a/arch/arm/boot/dts/at91sam9x5.dtsi b/arch/arm/boot/dts/at91sam9x5.dtsi index c111001f254e..70ab3a4e026f 100644 --- a/arch/arm/boot/dts/at91sam9x5.dtsi +++ b/arch/arm/boot/dts/at91sam9x5.dtsi | |||
@@ -34,7 +34,7 @@ | |||
34 | }; | 34 | }; |
35 | }; | 35 | }; |
36 | 36 | ||
37 | memory@20000000 { | 37 | memory { |
38 | reg = <0x20000000 0x10000000>; | 38 | reg = <0x20000000 0x10000000>; |
39 | }; | 39 | }; |
40 | 40 | ||
@@ -201,8 +201,8 @@ | |||
201 | >; | 201 | >; |
202 | atmel,nand-addr-offset = <21>; | 202 | atmel,nand-addr-offset = <21>; |
203 | atmel,nand-cmd-offset = <22>; | 203 | atmel,nand-cmd-offset = <22>; |
204 | gpios = <&pioC 8 0 | 204 | gpios = <&pioD 5 0 |
205 | &pioC 14 0 | 205 | &pioD 4 0 |
206 | 0 | 206 | 0 |
207 | >; | 207 | >; |
208 | status = "disabled"; | 208 | status = "disabled"; |
diff --git a/arch/arm/boot/dts/at91sam9x5cm.dtsi b/arch/arm/boot/dts/at91sam9x5cm.dtsi index 67936f83c694..31e7be23703d 100644 --- a/arch/arm/boot/dts/at91sam9x5cm.dtsi +++ b/arch/arm/boot/dts/at91sam9x5cm.dtsi | |||
@@ -8,7 +8,7 @@ | |||
8 | */ | 8 | */ |
9 | 9 | ||
10 | / { | 10 | / { |
11 | memory@20000000 { | 11 | memory { |
12 | reg = <0x20000000 0x8000000>; | 12 | reg = <0x20000000 0x8000000>; |
13 | }; | 13 | }; |
14 | 14 | ||
diff --git a/arch/arm/boot/dts/usb_a9g20.dts b/arch/arm/boot/dts/usb_a9g20.dts index 3b3c4e0fa79f..7c2399c532e5 100644 --- a/arch/arm/boot/dts/usb_a9g20.dts +++ b/arch/arm/boot/dts/usb_a9g20.dts | |||
@@ -16,7 +16,7 @@ | |||
16 | bootargs = "mem=64M console=ttyS0,115200 root=/dev/mtdblock5 rw rootfstype=ubifs"; | 16 | bootargs = "mem=64M console=ttyS0,115200 root=/dev/mtdblock5 rw rootfstype=ubifs"; |
17 | }; | 17 | }; |
18 | 18 | ||
19 | memory@20000000 { | 19 | memory { |
20 | reg = <0x20000000 0x4000000>; | 20 | reg = <0x20000000 0x4000000>; |
21 | }; | 21 | }; |
22 | 22 | ||
diff --git a/arch/arm/include/asm/barrier.h b/arch/arm/include/asm/barrier.h index 44f4a09ff37b..05112380dc53 100644 --- a/arch/arm/include/asm/barrier.h +++ b/arch/arm/include/asm/barrier.h | |||
@@ -2,6 +2,7 @@ | |||
2 | #define __ASM_BARRIER_H | 2 | #define __ASM_BARRIER_H |
3 | 3 | ||
4 | #ifndef __ASSEMBLY__ | 4 | #ifndef __ASSEMBLY__ |
5 | #include <asm/outercache.h> | ||
5 | 6 | ||
6 | #define nop() __asm__ __volatile__("mov\tr0,r0\t@ nop\n\t"); | 7 | #define nop() __asm__ __volatile__("mov\tr0,r0\t@ nop\n\t"); |
7 | 8 | ||
@@ -39,7 +40,6 @@ | |||
39 | #ifdef CONFIG_ARCH_HAS_BARRIERS | 40 | #ifdef CONFIG_ARCH_HAS_BARRIERS |
40 | #include <mach/barriers.h> | 41 | #include <mach/barriers.h> |
41 | #elif defined(CONFIG_ARM_DMA_MEM_BUFFERABLE) || defined(CONFIG_SMP) | 42 | #elif defined(CONFIG_ARM_DMA_MEM_BUFFERABLE) || defined(CONFIG_SMP) |
42 | #include <asm/outercache.h> | ||
43 | #define mb() do { dsb(); outer_sync(); } while (0) | 43 | #define mb() do { dsb(); outer_sync(); } while (0) |
44 | #define rmb() dsb() | 44 | #define rmb() dsb() |
45 | #define wmb() mb() | 45 | #define wmb() mb() |
diff --git a/arch/arm/include/asm/io.h b/arch/arm/include/asm/io.h index df0ac0bb39aa..9af5563dd3eb 100644 --- a/arch/arm/include/asm/io.h +++ b/arch/arm/include/asm/io.h | |||
@@ -119,7 +119,7 @@ static inline void __iomem *__typesafe_io(unsigned long addr) | |||
119 | #ifdef CONFIG_NEED_MACH_IO_H | 119 | #ifdef CONFIG_NEED_MACH_IO_H |
120 | #include <mach/io.h> | 120 | #include <mach/io.h> |
121 | #else | 121 | #else |
122 | #define __io(a) ({ (void)(a); __typesafe_io(0); }) | 122 | #define __io(a) __typesafe_io((a) & IO_SPACE_LIMIT) |
123 | #endif | 123 | #endif |
124 | 124 | ||
125 | /* | 125 | /* |
diff --git a/arch/arm/kernel/bios32.c b/arch/arm/kernel/bios32.c index 632df9a66f8c..ede5f7741c42 100644 --- a/arch/arm/kernel/bios32.c +++ b/arch/arm/kernel/bios32.c | |||
@@ -299,7 +299,6 @@ static inline int pdev_bad_for_parity(struct pci_dev *dev) | |||
299 | */ | 299 | */ |
300 | void pcibios_fixup_bus(struct pci_bus *bus) | 300 | void pcibios_fixup_bus(struct pci_bus *bus) |
301 | { | 301 | { |
302 | struct pci_sys_data *root = bus->sysdata; | ||
303 | struct pci_dev *dev; | 302 | struct pci_dev *dev; |
304 | u16 features = PCI_COMMAND_SERR | PCI_COMMAND_PARITY | PCI_COMMAND_FAST_BACK; | 303 | u16 features = PCI_COMMAND_SERR | PCI_COMMAND_PARITY | PCI_COMMAND_FAST_BACK; |
305 | 304 | ||
diff --git a/arch/arm/kernel/insn.c b/arch/arm/kernel/insn.c index ab312e516546..b760340b7014 100644 --- a/arch/arm/kernel/insn.c +++ b/arch/arm/kernel/insn.c | |||
@@ -1,3 +1,4 @@ | |||
1 | #include <linux/bug.h> | ||
1 | #include <linux/kernel.h> | 2 | #include <linux/kernel.h> |
2 | #include <asm/opcodes.h> | 3 | #include <asm/opcodes.h> |
3 | 4 | ||
diff --git a/arch/arm/kernel/kprobes.c b/arch/arm/kernel/kprobes.c index ab1869dac97a..4dd41fc9e235 100644 --- a/arch/arm/kernel/kprobes.c +++ b/arch/arm/kernel/kprobes.c | |||
@@ -152,7 +152,7 @@ int __kprobes __arch_disarm_kprobe(void *p) | |||
152 | 152 | ||
153 | void __kprobes arch_disarm_kprobe(struct kprobe *p) | 153 | void __kprobes arch_disarm_kprobe(struct kprobe *p) |
154 | { | 154 | { |
155 | stop_machine(__arch_disarm_kprobe, p, &cpu_online_map); | 155 | stop_machine(__arch_disarm_kprobe, p, cpu_online_mask); |
156 | } | 156 | } |
157 | 157 | ||
158 | void __kprobes arch_remove_kprobe(struct kprobe *p) | 158 | void __kprobes arch_remove_kprobe(struct kprobe *p) |
diff --git a/arch/arm/kernel/ptrace.c b/arch/arm/kernel/ptrace.c index 45956c9d0ef0..80abafb9bf33 100644 --- a/arch/arm/kernel/ptrace.c +++ b/arch/arm/kernel/ptrace.c | |||
@@ -256,7 +256,7 @@ static int ptrace_read_user(struct task_struct *tsk, unsigned long off, | |||
256 | { | 256 | { |
257 | unsigned long tmp; | 257 | unsigned long tmp; |
258 | 258 | ||
259 | if (off & 3 || off >= sizeof(struct user)) | 259 | if (off & 3) |
260 | return -EIO; | 260 | return -EIO; |
261 | 261 | ||
262 | tmp = 0; | 262 | tmp = 0; |
@@ -268,6 +268,8 @@ static int ptrace_read_user(struct task_struct *tsk, unsigned long off, | |||
268 | tmp = tsk->mm->end_code; | 268 | tmp = tsk->mm->end_code; |
269 | else if (off < sizeof(struct pt_regs)) | 269 | else if (off < sizeof(struct pt_regs)) |
270 | tmp = get_user_reg(tsk, off >> 2); | 270 | tmp = get_user_reg(tsk, off >> 2); |
271 | else if (off >= sizeof(struct user)) | ||
272 | return -EIO; | ||
271 | 273 | ||
272 | return put_user(tmp, ret); | 274 | return put_user(tmp, ret); |
273 | } | 275 | } |
diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c index 2cee7d1eb958..addbbe8028c2 100644 --- a/arch/arm/kernel/smp.c +++ b/arch/arm/kernel/smp.c | |||
@@ -349,7 +349,7 @@ void __init smp_prepare_cpus(unsigned int max_cpus) | |||
349 | * re-initialize the map in platform_smp_prepare_cpus() if | 349 | * re-initialize the map in platform_smp_prepare_cpus() if |
350 | * present != possible (e.g. physical hotplug). | 350 | * present != possible (e.g. physical hotplug). |
351 | */ | 351 | */ |
352 | init_cpu_present(&cpu_possible_map); | 352 | init_cpu_present(cpu_possible_mask); |
353 | 353 | ||
354 | /* | 354 | /* |
355 | * Initialise the SCU if there are more than one CPU | 355 | * Initialise the SCU if there are more than one CPU |
@@ -581,8 +581,9 @@ void smp_send_stop(void) | |||
581 | unsigned long timeout; | 581 | unsigned long timeout; |
582 | 582 | ||
583 | if (num_online_cpus() > 1) { | 583 | if (num_online_cpus() > 1) { |
584 | cpumask_t mask = cpu_online_map; | 584 | struct cpumask mask; |
585 | cpu_clear(smp_processor_id(), mask); | 585 | cpumask_copy(&mask, cpu_online_mask); |
586 | cpumask_clear_cpu(smp_processor_id(), &mask); | ||
586 | 587 | ||
587 | smp_cross_call(&mask, IPI_CPU_STOP); | 588 | smp_cross_call(&mask, IPI_CPU_STOP); |
588 | } | 589 | } |
diff --git a/arch/arm/mach-at91/at91sam9260_devices.c b/arch/arm/mach-at91/at91sam9260_devices.c index 7e5651ee9f85..5652dde4bbe2 100644 --- a/arch/arm/mach-at91/at91sam9260_devices.c +++ b/arch/arm/mach-at91/at91sam9260_devices.c | |||
@@ -598,6 +598,9 @@ void __init at91_add_device_spi(struct spi_board_info *devices, int nr_devices) | |||
598 | else | 598 | else |
599 | cs_pin = spi1_standard_cs[devices[i].chip_select]; | 599 | cs_pin = spi1_standard_cs[devices[i].chip_select]; |
600 | 600 | ||
601 | if (!gpio_is_valid(cs_pin)) | ||
602 | continue; | ||
603 | |||
601 | if (devices[i].bus_num == 0) | 604 | if (devices[i].bus_num == 0) |
602 | enable_spi0 = 1; | 605 | enable_spi0 = 1; |
603 | else | 606 | else |
diff --git a/arch/arm/mach-at91/at91sam9261_devices.c b/arch/arm/mach-at91/at91sam9261_devices.c index 096da87dc00d..4db961a93085 100644 --- a/arch/arm/mach-at91/at91sam9261_devices.c +++ b/arch/arm/mach-at91/at91sam9261_devices.c | |||
@@ -415,6 +415,9 @@ void __init at91_add_device_spi(struct spi_board_info *devices, int nr_devices) | |||
415 | else | 415 | else |
416 | cs_pin = spi1_standard_cs[devices[i].chip_select]; | 416 | cs_pin = spi1_standard_cs[devices[i].chip_select]; |
417 | 417 | ||
418 | if (!gpio_is_valid(cs_pin)) | ||
419 | continue; | ||
420 | |||
418 | if (devices[i].bus_num == 0) | 421 | if (devices[i].bus_num == 0) |
419 | enable_spi0 = 1; | 422 | enable_spi0 = 1; |
420 | else | 423 | else |
diff --git a/arch/arm/mach-at91/at91sam9263_devices.c b/arch/arm/mach-at91/at91sam9263_devices.c index 53688c46f956..fe99206de880 100644 --- a/arch/arm/mach-at91/at91sam9263_devices.c +++ b/arch/arm/mach-at91/at91sam9263_devices.c | |||
@@ -72,7 +72,8 @@ void __init at91_add_device_usbh(struct at91_usbh_data *data) | |||
72 | /* Enable VBus control for UHP ports */ | 72 | /* Enable VBus control for UHP ports */ |
73 | for (i = 0; i < data->ports; i++) { | 73 | for (i = 0; i < data->ports; i++) { |
74 | if (gpio_is_valid(data->vbus_pin[i])) | 74 | if (gpio_is_valid(data->vbus_pin[i])) |
75 | at91_set_gpio_output(data->vbus_pin[i], 0); | 75 | at91_set_gpio_output(data->vbus_pin[i], |
76 | data->vbus_pin_active_low[i]); | ||
76 | } | 77 | } |
77 | 78 | ||
78 | /* Enable overcurrent notification */ | 79 | /* Enable overcurrent notification */ |
@@ -671,6 +672,9 @@ void __init at91_add_device_spi(struct spi_board_info *devices, int nr_devices) | |||
671 | else | 672 | else |
672 | cs_pin = spi1_standard_cs[devices[i].chip_select]; | 673 | cs_pin = spi1_standard_cs[devices[i].chip_select]; |
673 | 674 | ||
675 | if (!gpio_is_valid(cs_pin)) | ||
676 | continue; | ||
677 | |||
674 | if (devices[i].bus_num == 0) | 678 | if (devices[i].bus_num == 0) |
675 | enable_spi0 = 1; | 679 | enable_spi0 = 1; |
676 | else | 680 | else |
diff --git a/arch/arm/mach-at91/at91sam9g45_devices.c b/arch/arm/mach-at91/at91sam9g45_devices.c index 698479f1e197..6b008aee1dff 100644 --- a/arch/arm/mach-at91/at91sam9g45_devices.c +++ b/arch/arm/mach-at91/at91sam9g45_devices.c | |||
@@ -127,12 +127,13 @@ void __init at91_add_device_usbh_ohci(struct at91_usbh_data *data) | |||
127 | /* Enable VBus control for UHP ports */ | 127 | /* Enable VBus control for UHP ports */ |
128 | for (i = 0; i < data->ports; i++) { | 128 | for (i = 0; i < data->ports; i++) { |
129 | if (gpio_is_valid(data->vbus_pin[i])) | 129 | if (gpio_is_valid(data->vbus_pin[i])) |
130 | at91_set_gpio_output(data->vbus_pin[i], 0); | 130 | at91_set_gpio_output(data->vbus_pin[i], |
131 | data->vbus_pin_active_low[i]); | ||
131 | } | 132 | } |
132 | 133 | ||
133 | /* Enable overcurrent notification */ | 134 | /* Enable overcurrent notification */ |
134 | for (i = 0; i < data->ports; i++) { | 135 | for (i = 0; i < data->ports; i++) { |
135 | if (data->overcurrent_pin[i]) | 136 | if (gpio_is_valid(data->overcurrent_pin[i])) |
136 | at91_set_gpio_input(data->overcurrent_pin[i], 1); | 137 | at91_set_gpio_input(data->overcurrent_pin[i], 1); |
137 | } | 138 | } |
138 | 139 | ||
@@ -188,7 +189,8 @@ void __init at91_add_device_usbh_ehci(struct at91_usbh_data *data) | |||
188 | /* Enable VBus control for UHP ports */ | 189 | /* Enable VBus control for UHP ports */ |
189 | for (i = 0; i < data->ports; i++) { | 190 | for (i = 0; i < data->ports; i++) { |
190 | if (gpio_is_valid(data->vbus_pin[i])) | 191 | if (gpio_is_valid(data->vbus_pin[i])) |
191 | at91_set_gpio_output(data->vbus_pin[i], 0); | 192 | at91_set_gpio_output(data->vbus_pin[i], |
193 | data->vbus_pin_active_low[i]); | ||
192 | } | 194 | } |
193 | 195 | ||
194 | usbh_ehci_data = *data; | 196 | usbh_ehci_data = *data; |
@@ -785,6 +787,9 @@ void __init at91_add_device_spi(struct spi_board_info *devices, int nr_devices) | |||
785 | else | 787 | else |
786 | cs_pin = spi1_standard_cs[devices[i].chip_select]; | 788 | cs_pin = spi1_standard_cs[devices[i].chip_select]; |
787 | 789 | ||
790 | if (!gpio_is_valid(cs_pin)) | ||
791 | continue; | ||
792 | |||
788 | if (devices[i].bus_num == 0) | 793 | if (devices[i].bus_num == 0) |
789 | enable_spi0 = 1; | 794 | enable_spi0 = 1; |
790 | else | 795 | else |
diff --git a/arch/arm/mach-at91/at91sam9rl_devices.c b/arch/arm/mach-at91/at91sam9rl_devices.c index eda72e83037d..fe4ae22e8561 100644 --- a/arch/arm/mach-at91/at91sam9rl_devices.c +++ b/arch/arm/mach-at91/at91sam9rl_devices.c | |||
@@ -419,6 +419,9 @@ void __init at91_add_device_spi(struct spi_board_info *devices, int nr_devices) | |||
419 | else | 419 | else |
420 | cs_pin = spi_standard_cs[devices[i].chip_select]; | 420 | cs_pin = spi_standard_cs[devices[i].chip_select]; |
421 | 421 | ||
422 | if (!gpio_is_valid(cs_pin)) | ||
423 | continue; | ||
424 | |||
422 | /* enable chip-select pin */ | 425 | /* enable chip-select pin */ |
423 | at91_set_gpio_output(cs_pin, 1); | 426 | at91_set_gpio_output(cs_pin, 1); |
424 | 427 | ||
diff --git a/arch/arm/mach-at91/at91sam9x5.c b/arch/arm/mach-at91/at91sam9x5.c index b6831eeb7b76..13c8cae60462 100644 --- a/arch/arm/mach-at91/at91sam9x5.c +++ b/arch/arm/mach-at91/at91sam9x5.c | |||
@@ -223,6 +223,8 @@ static struct clk_lookup periph_clocks_lookups[] = { | |||
223 | CLKDEV_CON_DEV_ID("usart", "f8028000.serial", &usart3_clk), | 223 | CLKDEV_CON_DEV_ID("usart", "f8028000.serial", &usart3_clk), |
224 | CLKDEV_CON_DEV_ID("t0_clk", "f8008000.timer", &tcb0_clk), | 224 | CLKDEV_CON_DEV_ID("t0_clk", "f8008000.timer", &tcb0_clk), |
225 | CLKDEV_CON_DEV_ID("t0_clk", "f800c000.timer", &tcb0_clk), | 225 | CLKDEV_CON_DEV_ID("t0_clk", "f800c000.timer", &tcb0_clk), |
226 | CLKDEV_CON_DEV_ID("dma_clk", "ffffec00.dma-controller", &dma0_clk), | ||
227 | CLKDEV_CON_DEV_ID("dma_clk", "ffffee00.dma-controller", &dma1_clk), | ||
226 | CLKDEV_CON_ID("pioA", &pioAB_clk), | 228 | CLKDEV_CON_ID("pioA", &pioAB_clk), |
227 | CLKDEV_CON_ID("pioB", &pioAB_clk), | 229 | CLKDEV_CON_ID("pioB", &pioAB_clk), |
228 | CLKDEV_CON_ID("pioC", &pioCD_clk), | 230 | CLKDEV_CON_ID("pioC", &pioCD_clk), |
diff --git a/arch/arm/mach-at91/board-sam9263ek.c b/arch/arm/mach-at91/board-sam9263ek.c index 66f0ddf4b2ae..2ffe50f3a9e9 100644 --- a/arch/arm/mach-at91/board-sam9263ek.c +++ b/arch/arm/mach-at91/board-sam9263ek.c | |||
@@ -74,6 +74,7 @@ static void __init ek_init_early(void) | |||
74 | static struct at91_usbh_data __initdata ek_usbh_data = { | 74 | static struct at91_usbh_data __initdata ek_usbh_data = { |
75 | .ports = 2, | 75 | .ports = 2, |
76 | .vbus_pin = { AT91_PIN_PA24, AT91_PIN_PA21 }, | 76 | .vbus_pin = { AT91_PIN_PA24, AT91_PIN_PA21 }, |
77 | .vbus_pin_active_low = {1, 1}, | ||
77 | .overcurrent_pin= {-EINVAL, -EINVAL}, | 78 | .overcurrent_pin= {-EINVAL, -EINVAL}, |
78 | }; | 79 | }; |
79 | 80 | ||
diff --git a/arch/arm/mach-at91/board-sam9m10g45ek.c b/arch/arm/mach-at91/board-sam9m10g45ek.c index e1bea73e6b30..c88e908ddd82 100644 --- a/arch/arm/mach-at91/board-sam9m10g45ek.c +++ b/arch/arm/mach-at91/board-sam9m10g45ek.c | |||
@@ -71,6 +71,7 @@ static void __init ek_init_early(void) | |||
71 | static struct at91_usbh_data __initdata ek_usbh_hs_data = { | 71 | static struct at91_usbh_data __initdata ek_usbh_hs_data = { |
72 | .ports = 2, | 72 | .ports = 2, |
73 | .vbus_pin = {AT91_PIN_PD1, AT91_PIN_PD3}, | 73 | .vbus_pin = {AT91_PIN_PD1, AT91_PIN_PD3}, |
74 | .vbus_pin_active_low = {1, 1}, | ||
74 | .overcurrent_pin= {-EINVAL, -EINVAL}, | 75 | .overcurrent_pin= {-EINVAL, -EINVAL}, |
75 | }; | 76 | }; |
76 | 77 | ||
diff --git a/arch/arm/mach-at91/include/mach/board.h b/arch/arm/mach-at91/include/mach/board.h index 544a5d5ce416..49a821192c65 100644 --- a/arch/arm/mach-at91/include/mach/board.h +++ b/arch/arm/mach-at91/include/mach/board.h | |||
@@ -86,14 +86,15 @@ extern void __init at91_add_device_mci(short mmc_id, struct mci_platform_data *d | |||
86 | extern void __init at91_add_device_eth(struct macb_platform_data *data); | 86 | extern void __init at91_add_device_eth(struct macb_platform_data *data); |
87 | 87 | ||
88 | /* USB Host */ | 88 | /* USB Host */ |
89 | #define AT91_MAX_USBH_PORTS 3 | ||
89 | struct at91_usbh_data { | 90 | struct at91_usbh_data { |
90 | u8 ports; /* number of ports on root hub */ | 91 | int vbus_pin[AT91_MAX_USBH_PORTS]; /* port power-control pin */ |
91 | int vbus_pin[2]; /* port power-control pin */ | 92 | int overcurrent_pin[AT91_MAX_USBH_PORTS]; |
92 | u8 vbus_pin_active_low[2]; | 93 | u8 ports; /* number of ports on root hub */ |
93 | u8 overcurrent_supported; | 94 | u8 overcurrent_supported; |
94 | int overcurrent_pin[2]; | 95 | u8 vbus_pin_active_low[AT91_MAX_USBH_PORTS]; |
95 | u8 overcurrent_status[2]; | 96 | u8 overcurrent_status[AT91_MAX_USBH_PORTS]; |
96 | u8 overcurrent_changed[2]; | 97 | u8 overcurrent_changed[AT91_MAX_USBH_PORTS]; |
97 | }; | 98 | }; |
98 | extern void __init at91_add_device_usbh(struct at91_usbh_data *data); | 99 | extern void __init at91_add_device_usbh(struct at91_usbh_data *data); |
99 | extern void __init at91_add_device_usbh_ohci(struct at91_usbh_data *data); | 100 | extern void __init at91_add_device_usbh_ohci(struct at91_usbh_data *data); |
diff --git a/arch/arm/mach-at91/include/mach/io.h b/arch/arm/mach-at91/include/mach/io.h new file mode 100644 index 000000000000..2d9ca0455745 --- /dev/null +++ b/arch/arm/mach-at91/include/mach/io.h | |||
@@ -0,0 +1,27 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-at91/include/mach/io.h | ||
3 | * | ||
4 | * Copyright (C) 2003 SAN People | ||
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 as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License | ||
17 | * along with this program; if not, write to the Free Software | ||
18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
19 | */ | ||
20 | |||
21 | #ifndef __ASM_ARCH_IO_H | ||
22 | #define __ASM_ARCH_IO_H | ||
23 | |||
24 | #define IO_SPACE_LIMIT 0xFFFFFFFF | ||
25 | #define __io(a) __typesafe_io(a) | ||
26 | |||
27 | #endif | ||
diff --git a/arch/arm/mach-exynos/common.c b/arch/arm/mach-exynos/common.c index e6cc50e94a58..8614aab47cc0 100644 --- a/arch/arm/mach-exynos/common.c +++ b/arch/arm/mach-exynos/common.c | |||
@@ -583,10 +583,11 @@ core_initcall(exynos_core_init); | |||
583 | #ifdef CONFIG_CACHE_L2X0 | 583 | #ifdef CONFIG_CACHE_L2X0 |
584 | static int __init exynos4_l2x0_cache_init(void) | 584 | static int __init exynos4_l2x0_cache_init(void) |
585 | { | 585 | { |
586 | int ret; | ||
587 | |||
586 | if (soc_is_exynos5250()) | 588 | if (soc_is_exynos5250()) |
587 | return 0; | 589 | return 0; |
588 | 590 | ||
589 | int ret; | ||
590 | ret = l2x0_of_init(L2_AUX_VAL, L2_AUX_MASK); | 591 | ret = l2x0_of_init(L2_AUX_VAL, L2_AUX_MASK); |
591 | if (!ret) { | 592 | if (!ret) { |
592 | l2x0_regs_phys = virt_to_phys(&l2x0_saved_regs); | 593 | l2x0_regs_phys = virt_to_phys(&l2x0_saved_regs); |
diff --git a/arch/arm/mach-exynos/dma.c b/arch/arm/mach-exynos/dma.c index 3983abee4264..69aaa4503205 100644 --- a/arch/arm/mach-exynos/dma.c +++ b/arch/arm/mach-exynos/dma.c | |||
@@ -35,8 +35,6 @@ | |||
35 | #include <mach/irqs.h> | 35 | #include <mach/irqs.h> |
36 | #include <mach/dma.h> | 36 | #include <mach/dma.h> |
37 | 37 | ||
38 | static u64 dma_dmamask = DMA_BIT_MASK(32); | ||
39 | |||
40 | static u8 exynos4210_pdma0_peri[] = { | 38 | static u8 exynos4210_pdma0_peri[] = { |
41 | DMACH_PCM0_RX, | 39 | DMACH_PCM0_RX, |
42 | DMACH_PCM0_TX, | 40 | DMACH_PCM0_TX, |
diff --git a/arch/arm/mach-exynos/include/mach/debug-macro.S b/arch/arm/mach-exynos/include/mach/debug-macro.S index 6c857ff0b5d8..e0c86ea475e7 100644 --- a/arch/arm/mach-exynos/include/mach/debug-macro.S +++ b/arch/arm/mach-exynos/include/mach/debug-macro.S | |||
@@ -21,10 +21,9 @@ | |||
21 | */ | 21 | */ |
22 | 22 | ||
23 | .macro addruart, rp, rv, tmp | 23 | .macro addruart, rp, rv, tmp |
24 | mov \rp, #0x10000000 | 24 | mrc p15, 0, \tmp, c0, c0, 0 |
25 | ldr \rp, [\rp, #0x0] | 25 | and \tmp, \tmp, #0xf0 |
26 | and \rp, \rp, #0xf00000 | 26 | teq \tmp, #0xf0 @@ A15 |
27 | teq \rp, #0x500000 @@ EXYNOS5 | ||
28 | ldreq \rp, =EXYNOS5_PA_UART | 27 | ldreq \rp, =EXYNOS5_PA_UART |
29 | movne \rp, #EXYNOS4_PA_UART @@ EXYNOS4 | 28 | movne \rp, #EXYNOS4_PA_UART @@ EXYNOS4 |
30 | ldr \rv, =S3C_VA_UART | 29 | ldr \rv, =S3C_VA_UART |
diff --git a/arch/arm/mach-exynos/include/mach/uncompress.h b/arch/arm/mach-exynos/include/mach/uncompress.h index 493f4f365ddf..2979995d5a6a 100644 --- a/arch/arm/mach-exynos/include/mach/uncompress.h +++ b/arch/arm/mach-exynos/include/mach/uncompress.h | |||
@@ -20,9 +20,24 @@ volatile u8 *uart_base; | |||
20 | 20 | ||
21 | #include <plat/uncompress.h> | 21 | #include <plat/uncompress.h> |
22 | 22 | ||
23 | static unsigned int __raw_readl(unsigned int ptr) | ||
24 | { | ||
25 | return *((volatile unsigned int *)ptr); | ||
26 | } | ||
27 | |||
23 | static void arch_detect_cpu(void) | 28 | static void arch_detect_cpu(void) |
24 | { | 29 | { |
25 | if (machine_is_smdk5250()) | 30 | u32 chip_id = __raw_readl(EXYNOS_PA_CHIPID); |
31 | |||
32 | /* | ||
33 | * product_id is bits 31:12 | ||
34 | * bits 23:20 describe the exynosX family | ||
35 | * | ||
36 | */ | ||
37 | chip_id >>= 20; | ||
38 | chip_id &= 0xf; | ||
39 | |||
40 | if (chip_id == 0x5) | ||
26 | uart_base = (volatile u8 *)EXYNOS5_PA_UART + (S3C_UART_OFFSET * CONFIG_S3C_LOWLEVEL_UART_PORT); | 41 | uart_base = (volatile u8 *)EXYNOS5_PA_UART + (S3C_UART_OFFSET * CONFIG_S3C_LOWLEVEL_UART_PORT); |
27 | else | 42 | else |
28 | uart_base = (volatile u8 *)EXYNOS4_PA_UART + (S3C_UART_OFFSET * CONFIG_S3C_LOWLEVEL_UART_PORT); | 43 | uart_base = (volatile u8 *)EXYNOS4_PA_UART + (S3C_UART_OFFSET * CONFIG_S3C_LOWLEVEL_UART_PORT); |
diff --git a/arch/arm/mach-imx/clock-imx27.c b/arch/arm/mach-imx/clock-imx27.c index b9a95ed75553..98e04f5a87dd 100644 --- a/arch/arm/mach-imx/clock-imx27.c +++ b/arch/arm/mach-imx/clock-imx27.c | |||
@@ -662,6 +662,7 @@ static struct clk_lookup lookups[] = { | |||
662 | _REGISTER_CLOCK(NULL, "dma", dma_clk) | 662 | _REGISTER_CLOCK(NULL, "dma", dma_clk) |
663 | _REGISTER_CLOCK(NULL, "rtic", rtic_clk) | 663 | _REGISTER_CLOCK(NULL, "rtic", rtic_clk) |
664 | _REGISTER_CLOCK(NULL, "brom", brom_clk) | 664 | _REGISTER_CLOCK(NULL, "brom", brom_clk) |
665 | _REGISTER_CLOCK(NULL, "emma", emma_clk) | ||
665 | _REGISTER_CLOCK("m2m-emmaprp.0", NULL, emma_clk) | 666 | _REGISTER_CLOCK("m2m-emmaprp.0", NULL, emma_clk) |
666 | _REGISTER_CLOCK(NULL, "slcdc", slcdc_clk) | 667 | _REGISTER_CLOCK(NULL, "slcdc", slcdc_clk) |
667 | _REGISTER_CLOCK("imx27-fec.0", NULL, fec_clk) | 668 | _REGISTER_CLOCK("imx27-fec.0", NULL, fec_clk) |
diff --git a/arch/arm/mach-imx/clock-imx35.c b/arch/arm/mach-imx/clock-imx35.c index 1e279af656ad..e56c1a83eee3 100644 --- a/arch/arm/mach-imx/clock-imx35.c +++ b/arch/arm/mach-imx/clock-imx35.c | |||
@@ -483,7 +483,7 @@ static struct clk_lookup lookups[] = { | |||
483 | _REGISTER_CLOCK("imx2-wdt.0", NULL, wdog_clk) | 483 | _REGISTER_CLOCK("imx2-wdt.0", NULL, wdog_clk) |
484 | _REGISTER_CLOCK(NULL, "max", max_clk) | 484 | _REGISTER_CLOCK(NULL, "max", max_clk) |
485 | _REGISTER_CLOCK(NULL, "audmux", audmux_clk) | 485 | _REGISTER_CLOCK(NULL, "audmux", audmux_clk) |
486 | _REGISTER_CLOCK(NULL, "csi", csi_clk) | 486 | _REGISTER_CLOCK("mx3-camera.0", NULL, csi_clk) |
487 | _REGISTER_CLOCK(NULL, "iim", iim_clk) | 487 | _REGISTER_CLOCK(NULL, "iim", iim_clk) |
488 | _REGISTER_CLOCK(NULL, "gpu2d", gpu2d_clk) | 488 | _REGISTER_CLOCK(NULL, "gpu2d", gpu2d_clk) |
489 | _REGISTER_CLOCK("mxc_nand.0", NULL, nfc_clk) | 489 | _REGISTER_CLOCK("mxc_nand.0", NULL, nfc_clk) |
diff --git a/arch/arm/mach-imx/mach-armadillo5x0.c b/arch/arm/mach-imx/mach-armadillo5x0.c index 27bc27e6ea41..c650145d1646 100644 --- a/arch/arm/mach-imx/mach-armadillo5x0.c +++ b/arch/arm/mach-imx/mach-armadillo5x0.c | |||
@@ -38,6 +38,8 @@ | |||
38 | #include <linux/usb/otg.h> | 38 | #include <linux/usb/otg.h> |
39 | #include <linux/usb/ulpi.h> | 39 | #include <linux/usb/ulpi.h> |
40 | #include <linux/delay.h> | 40 | #include <linux/delay.h> |
41 | #include <linux/regulator/machine.h> | ||
42 | #include <linux/regulator/fixed.h> | ||
41 | 43 | ||
42 | #include <mach/hardware.h> | 44 | #include <mach/hardware.h> |
43 | #include <asm/mach-types.h> | 45 | #include <asm/mach-types.h> |
@@ -479,6 +481,11 @@ static struct platform_device *devices[] __initdata = { | |||
479 | &armadillo5x0_smc911x_device, | 481 | &armadillo5x0_smc911x_device, |
480 | }; | 482 | }; |
481 | 483 | ||
484 | static struct regulator_consumer_supply dummy_supplies[] = { | ||
485 | REGULATOR_SUPPLY("vdd33a", "smsc911x"), | ||
486 | REGULATOR_SUPPLY("vddvario", "smsc911x"), | ||
487 | }; | ||
488 | |||
482 | /* | 489 | /* |
483 | * Perform board specific initializations | 490 | * Perform board specific initializations |
484 | */ | 491 | */ |
@@ -489,6 +496,8 @@ static void __init armadillo5x0_init(void) | |||
489 | mxc_iomux_setup_multiple_pins(armadillo5x0_pins, | 496 | mxc_iomux_setup_multiple_pins(armadillo5x0_pins, |
490 | ARRAY_SIZE(armadillo5x0_pins), "armadillo5x0"); | 497 | ARRAY_SIZE(armadillo5x0_pins), "armadillo5x0"); |
491 | 498 | ||
499 | regulator_register_fixed(0, dummy_supplies, ARRAY_SIZE(dummy_supplies)); | ||
500 | |||
492 | platform_add_devices(devices, ARRAY_SIZE(devices)); | 501 | platform_add_devices(devices, ARRAY_SIZE(devices)); |
493 | imx_add_gpio_keys(&armadillo5x0_button_data); | 502 | imx_add_gpio_keys(&armadillo5x0_button_data); |
494 | imx31_add_imx_i2c1(NULL); | 503 | imx31_add_imx_i2c1(NULL); |
diff --git a/arch/arm/mach-imx/mach-kzm_arm11_01.c b/arch/arm/mach-imx/mach-kzm_arm11_01.c index fc78e8071cd1..15a26e908260 100644 --- a/arch/arm/mach-imx/mach-kzm_arm11_01.c +++ b/arch/arm/mach-imx/mach-kzm_arm11_01.c | |||
@@ -24,6 +24,8 @@ | |||
24 | #include <linux/serial_8250.h> | 24 | #include <linux/serial_8250.h> |
25 | #include <linux/smsc911x.h> | 25 | #include <linux/smsc911x.h> |
26 | #include <linux/types.h> | 26 | #include <linux/types.h> |
27 | #include <linux/regulator/machine.h> | ||
28 | #include <linux/regulator/fixed.h> | ||
27 | 29 | ||
28 | #include <asm/irq.h> | 30 | #include <asm/irq.h> |
29 | #include <asm/mach-types.h> | 31 | #include <asm/mach-types.h> |
@@ -166,6 +168,11 @@ static struct platform_device kzm_smsc9118_device = { | |||
166 | }, | 168 | }, |
167 | }; | 169 | }; |
168 | 170 | ||
171 | static struct regulator_consumer_supply dummy_supplies[] = { | ||
172 | REGULATOR_SUPPLY("vdd33a", "smsc911x"), | ||
173 | REGULATOR_SUPPLY("vddvario", "smsc911x"), | ||
174 | }; | ||
175 | |||
169 | static int __init kzm_init_smsc9118(void) | 176 | static int __init kzm_init_smsc9118(void) |
170 | { | 177 | { |
171 | /* | 178 | /* |
@@ -175,6 +182,8 @@ static int __init kzm_init_smsc9118(void) | |||
175 | gpio_request(IOMUX_TO_GPIO(MX31_PIN_GPIO1_2), "smsc9118-int"); | 182 | gpio_request(IOMUX_TO_GPIO(MX31_PIN_GPIO1_2), "smsc9118-int"); |
176 | gpio_direction_input(IOMUX_TO_GPIO(MX31_PIN_GPIO1_2)); | 183 | gpio_direction_input(IOMUX_TO_GPIO(MX31_PIN_GPIO1_2)); |
177 | 184 | ||
185 | regulator_register_fixed(0, dummy_supplies, ARRAY_SIZE(dummy_supplies)); | ||
186 | |||
178 | return platform_device_register(&kzm_smsc9118_device); | 187 | return platform_device_register(&kzm_smsc9118_device); |
179 | } | 188 | } |
180 | #else | 189 | #else |
diff --git a/arch/arm/mach-imx/mach-mx31lilly.c b/arch/arm/mach-imx/mach-mx31lilly.c index 02401bbd6d53..83714b0cc290 100644 --- a/arch/arm/mach-imx/mach-mx31lilly.c +++ b/arch/arm/mach-imx/mach-mx31lilly.c | |||
@@ -34,6 +34,8 @@ | |||
34 | #include <linux/mfd/mc13783.h> | 34 | #include <linux/mfd/mc13783.h> |
35 | #include <linux/usb/otg.h> | 35 | #include <linux/usb/otg.h> |
36 | #include <linux/usb/ulpi.h> | 36 | #include <linux/usb/ulpi.h> |
37 | #include <linux/regulator/machine.h> | ||
38 | #include <linux/regulator/fixed.h> | ||
37 | 39 | ||
38 | #include <asm/mach-types.h> | 40 | #include <asm/mach-types.h> |
39 | #include <asm/mach/arch.h> | 41 | #include <asm/mach/arch.h> |
@@ -242,6 +244,11 @@ static struct platform_device *devices[] __initdata = { | |||
242 | static int mx31lilly_baseboard; | 244 | static int mx31lilly_baseboard; |
243 | core_param(mx31lilly_baseboard, mx31lilly_baseboard, int, 0444); | 245 | core_param(mx31lilly_baseboard, mx31lilly_baseboard, int, 0444); |
244 | 246 | ||
247 | static struct regulator_consumer_supply dummy_supplies[] = { | ||
248 | REGULATOR_SUPPLY("vdd33a", "smsc911x"), | ||
249 | REGULATOR_SUPPLY("vddvario", "smsc911x"), | ||
250 | }; | ||
251 | |||
245 | static void __init mx31lilly_board_init(void) | 252 | static void __init mx31lilly_board_init(void) |
246 | { | 253 | { |
247 | imx31_soc_init(); | 254 | imx31_soc_init(); |
@@ -280,6 +287,8 @@ static void __init mx31lilly_board_init(void) | |||
280 | imx31_add_spi_imx1(&spi1_pdata); | 287 | imx31_add_spi_imx1(&spi1_pdata); |
281 | spi_register_board_info(&mc13783_dev, 1); | 288 | spi_register_board_info(&mc13783_dev, 1); |
282 | 289 | ||
290 | regulator_register_fixed(0, dummy_supplies, ARRAY_SIZE(dummy_supplies)); | ||
291 | |||
283 | platform_add_devices(devices, ARRAY_SIZE(devices)); | 292 | platform_add_devices(devices, ARRAY_SIZE(devices)); |
284 | 293 | ||
285 | /* USB */ | 294 | /* USB */ |
diff --git a/arch/arm/mach-imx/mach-mx31lite.c b/arch/arm/mach-imx/mach-mx31lite.c index ef80751712e7..0abef5f13df5 100644 --- a/arch/arm/mach-imx/mach-mx31lite.c +++ b/arch/arm/mach-imx/mach-mx31lite.c | |||
@@ -29,6 +29,8 @@ | |||
29 | #include <linux/usb/ulpi.h> | 29 | #include <linux/usb/ulpi.h> |
30 | #include <linux/mtd/physmap.h> | 30 | #include <linux/mtd/physmap.h> |
31 | #include <linux/delay.h> | 31 | #include <linux/delay.h> |
32 | #include <linux/regulator/machine.h> | ||
33 | #include <linux/regulator/fixed.h> | ||
32 | 34 | ||
33 | #include <asm/mach-types.h> | 35 | #include <asm/mach-types.h> |
34 | #include <asm/mach/arch.h> | 36 | #include <asm/mach/arch.h> |
@@ -226,6 +228,11 @@ void __init mx31lite_map_io(void) | |||
226 | static int mx31lite_baseboard; | 228 | static int mx31lite_baseboard; |
227 | core_param(mx31lite_baseboard, mx31lite_baseboard, int, 0444); | 229 | core_param(mx31lite_baseboard, mx31lite_baseboard, int, 0444); |
228 | 230 | ||
231 | static struct regulator_consumer_supply dummy_supplies[] = { | ||
232 | REGULATOR_SUPPLY("vdd33a", "smsc911x"), | ||
233 | REGULATOR_SUPPLY("vddvario", "smsc911x"), | ||
234 | }; | ||
235 | |||
229 | static void __init mx31lite_init(void) | 236 | static void __init mx31lite_init(void) |
230 | { | 237 | { |
231 | int ret; | 238 | int ret; |
@@ -259,6 +266,8 @@ static void __init mx31lite_init(void) | |||
259 | if (usbh2_pdata.otg) | 266 | if (usbh2_pdata.otg) |
260 | imx31_add_mxc_ehci_hs(2, &usbh2_pdata); | 267 | imx31_add_mxc_ehci_hs(2, &usbh2_pdata); |
261 | 268 | ||
269 | regulator_register_fixed(0, dummy_supplies, ARRAY_SIZE(dummy_supplies)); | ||
270 | |||
262 | /* SMSC9117 IRQ pin */ | 271 | /* SMSC9117 IRQ pin */ |
263 | ret = gpio_request(IOMUX_TO_GPIO(MX31_PIN_SFS6), "sms9117-irq"); | 272 | ret = gpio_request(IOMUX_TO_GPIO(MX31_PIN_SFS6), "sms9117-irq"); |
264 | if (ret) | 273 | if (ret) |
diff --git a/arch/arm/mach-imx/mach-mx35_3ds.c b/arch/arm/mach-imx/mach-mx35_3ds.c index e14291d89e4f..6ae51c6b95b7 100644 --- a/arch/arm/mach-imx/mach-mx35_3ds.c +++ b/arch/arm/mach-imx/mach-mx35_3ds.c | |||
@@ -97,7 +97,7 @@ static struct i2c_board_info __initdata i2c_devices_3ds[] = { | |||
97 | static int lcd_power_gpio = -ENXIO; | 97 | static int lcd_power_gpio = -ENXIO; |
98 | 98 | ||
99 | static int mc9s08dz60_gpiochip_match(struct gpio_chip *chip, | 99 | static int mc9s08dz60_gpiochip_match(struct gpio_chip *chip, |
100 | void *data) | 100 | const void *data) |
101 | { | 101 | { |
102 | return !strcmp(chip->label, data); | 102 | return !strcmp(chip->label, data); |
103 | } | 103 | } |
diff --git a/arch/arm/mach-imx/mach-mx53_ard.c b/arch/arm/mach-imx/mach-mx53_ard.c index 753f4fc9ec04..05641980dc5e 100644 --- a/arch/arm/mach-imx/mach-mx53_ard.c +++ b/arch/arm/mach-imx/mach-mx53_ard.c | |||
@@ -23,6 +23,8 @@ | |||
23 | #include <linux/delay.h> | 23 | #include <linux/delay.h> |
24 | #include <linux/gpio.h> | 24 | #include <linux/gpio.h> |
25 | #include <linux/smsc911x.h> | 25 | #include <linux/smsc911x.h> |
26 | #include <linux/regulator/machine.h> | ||
27 | #include <linux/regulator/fixed.h> | ||
26 | 28 | ||
27 | #include <mach/common.h> | 29 | #include <mach/common.h> |
28 | #include <mach/hardware.h> | 30 | #include <mach/hardware.h> |
@@ -214,6 +216,11 @@ static int weim_cs_config(void) | |||
214 | return 0; | 216 | return 0; |
215 | } | 217 | } |
216 | 218 | ||
219 | static struct regulator_consumer_supply dummy_supplies[] = { | ||
220 | REGULATOR_SUPPLY("vdd33a", "smsc911x"), | ||
221 | REGULATOR_SUPPLY("vddvario", "smsc911x"), | ||
222 | }; | ||
223 | |||
217 | void __init imx53_ard_common_init(void) | 224 | void __init imx53_ard_common_init(void) |
218 | { | 225 | { |
219 | mxc_iomux_v3_setup_multiple_pads(mx53_ard_pads, | 226 | mxc_iomux_v3_setup_multiple_pads(mx53_ard_pads, |
@@ -232,6 +239,7 @@ static void __init mx53_ard_board_init(void) | |||
232 | 239 | ||
233 | imx53_ard_common_init(); | 240 | imx53_ard_common_init(); |
234 | mx53_ard_io_init(); | 241 | mx53_ard_io_init(); |
242 | regulator_register_fixed(0, dummy_supplies, ARRAY_SIZE(dummy_supplies)); | ||
235 | platform_add_devices(devices, ARRAY_SIZE(devices)); | 243 | platform_add_devices(devices, ARRAY_SIZE(devices)); |
236 | 244 | ||
237 | imx53_add_sdhci_esdhc_imx(0, &mx53_ard_sd1_data); | 245 | imx53_add_sdhci_esdhc_imx(0, &mx53_ard_sd1_data); |
diff --git a/arch/arm/mach-msm/include/mach/uncompress.h b/arch/arm/mach-msm/include/mach/uncompress.h index 169a84007456..c14011fe832d 100644 --- a/arch/arm/mach-msm/include/mach/uncompress.h +++ b/arch/arm/mach-msm/include/mach/uncompress.h | |||
@@ -16,6 +16,7 @@ | |||
16 | #ifndef __ASM_ARCH_MSM_UNCOMPRESS_H | 16 | #ifndef __ASM_ARCH_MSM_UNCOMPRESS_H |
17 | #define __ASM_ARCH_MSM_UNCOMPRESS_H | 17 | #define __ASM_ARCH_MSM_UNCOMPRESS_H |
18 | 18 | ||
19 | #include <asm/barrier.h> | ||
19 | #include <asm/processor.h> | 20 | #include <asm/processor.h> |
20 | #include <mach/msm_iomap.h> | 21 | #include <mach/msm_iomap.h> |
21 | 22 | ||
diff --git a/arch/arm/mach-msm/smd_debug.c b/arch/arm/mach-msm/smd_debug.c index 0c56a5aaf588..c56df9e932ae 100644 --- a/arch/arm/mach-msm/smd_debug.c +++ b/arch/arm/mach-msm/smd_debug.c | |||
@@ -203,15 +203,9 @@ static ssize_t debug_read(struct file *file, char __user *buf, | |||
203 | return simple_read_from_buffer(buf, count, ppos, debug_buffer, bsize); | 203 | return simple_read_from_buffer(buf, count, ppos, debug_buffer, bsize); |
204 | } | 204 | } |
205 | 205 | ||
206 | static int debug_open(struct inode *inode, struct file *file) | ||
207 | { | ||
208 | file->private_data = inode->i_private; | ||
209 | return 0; | ||
210 | } | ||
211 | |||
212 | static const struct file_operations debug_ops = { | 206 | static const struct file_operations debug_ops = { |
213 | .read = debug_read, | 207 | .read = debug_read, |
214 | .open = debug_open, | 208 | .open = simple_open, |
215 | .llseek = default_llseek, | 209 | .llseek = default_llseek, |
216 | }; | 210 | }; |
217 | 211 | ||
diff --git a/arch/arm/mach-omap1/include/mach/io.h b/arch/arm/mach-omap1/include/mach/io.h new file mode 100644 index 000000000000..ce4f8005b26f --- /dev/null +++ b/arch/arm/mach-omap1/include/mach/io.h | |||
@@ -0,0 +1,45 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-omap1/include/mach/io.h | ||
3 | * | ||
4 | * IO definitions for TI OMAP processors and boards | ||
5 | * | ||
6 | * Copied from arch/arm/mach-sa1100/include/mach/io.h | ||
7 | * Copyright (C) 1997-1999 Russell King | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify it | ||
10 | * under the terms of the GNU General Public License as published by the | ||
11 | * Free Software Foundation; either version 2 of the License, or (at your | ||
12 | * option) any later version. | ||
13 | * | ||
14 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED | ||
15 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
16 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN | ||
17 | * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
18 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
19 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF | ||
20 | * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | ||
21 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||
23 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
24 | * | ||
25 | * You should have received a copy of the GNU General Public License along | ||
26 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
27 | * 675 Mass Ave, Cambridge, MA 02139, USA. | ||
28 | * | ||
29 | * Modifications: | ||
30 | * 06-12-1997 RMK Created. | ||
31 | * 07-04-1999 RMK Major cleanup | ||
32 | */ | ||
33 | |||
34 | #ifndef __ASM_ARM_ARCH_IO_H | ||
35 | #define __ASM_ARM_ARCH_IO_H | ||
36 | |||
37 | #define IO_SPACE_LIMIT 0xffffffff | ||
38 | |||
39 | /* | ||
40 | * We don't actually have real ISA nor PCI buses, but there is so many | ||
41 | * drivers out there that might just work if we fake them... | ||
42 | */ | ||
43 | #define __io(a) __typesafe_io(a) | ||
44 | |||
45 | #endif | ||
diff --git a/arch/arm/mach-omap2/board-cm-t35.c b/arch/arm/mach-omap2/board-cm-t35.c index 41b0a2fe0b04..909a8b91b564 100644 --- a/arch/arm/mach-omap2/board-cm-t35.c +++ b/arch/arm/mach-omap2/board-cm-t35.c | |||
@@ -26,6 +26,7 @@ | |||
26 | 26 | ||
27 | #include <linux/i2c/at24.h> | 27 | #include <linux/i2c/at24.h> |
28 | #include <linux/i2c/twl.h> | 28 | #include <linux/i2c/twl.h> |
29 | #include <linux/regulator/fixed.h> | ||
29 | #include <linux/regulator/machine.h> | 30 | #include <linux/regulator/machine.h> |
30 | #include <linux/mmc/host.h> | 31 | #include <linux/mmc/host.h> |
31 | 32 | ||
@@ -81,8 +82,23 @@ static struct omap_smsc911x_platform_data sb_t35_smsc911x_cfg = { | |||
81 | .flags = SMSC911X_USE_32BIT | SMSC911X_SAVE_MAC_ADDRESS, | 82 | .flags = SMSC911X_USE_32BIT | SMSC911X_SAVE_MAC_ADDRESS, |
82 | }; | 83 | }; |
83 | 84 | ||
85 | static struct regulator_consumer_supply cm_t35_smsc911x_supplies[] = { | ||
86 | REGULATOR_SUPPLY("vddvario", "smsc911x.0"), | ||
87 | REGULATOR_SUPPLY("vdd33a", "smsc911x.0"), | ||
88 | }; | ||
89 | |||
90 | static struct regulator_consumer_supply sb_t35_smsc911x_supplies[] = { | ||
91 | REGULATOR_SUPPLY("vddvario", "smsc911x.1"), | ||
92 | REGULATOR_SUPPLY("vdd33a", "smsc911x.1"), | ||
93 | }; | ||
94 | |||
84 | static void __init cm_t35_init_ethernet(void) | 95 | static void __init cm_t35_init_ethernet(void) |
85 | { | 96 | { |
97 | regulator_register_fixed(0, cm_t35_smsc911x_supplies, | ||
98 | ARRAY_SIZE(cm_t35_smsc911x_supplies)); | ||
99 | regulator_register_fixed(1, sb_t35_smsc911x_supplies, | ||
100 | ARRAY_SIZE(sb_t35_smsc911x_supplies)); | ||
101 | |||
86 | gpmc_smsc911x_init(&cm_t35_smsc911x_cfg); | 102 | gpmc_smsc911x_init(&cm_t35_smsc911x_cfg); |
87 | gpmc_smsc911x_init(&sb_t35_smsc911x_cfg); | 103 | gpmc_smsc911x_init(&sb_t35_smsc911x_cfg); |
88 | } | 104 | } |
diff --git a/arch/arm/mach-omap2/board-igep0020.c b/arch/arm/mach-omap2/board-igep0020.c index e558800adfdf..930c0d380435 100644 --- a/arch/arm/mach-omap2/board-igep0020.c +++ b/arch/arm/mach-omap2/board-igep0020.c | |||
@@ -634,8 +634,14 @@ static void __init igep_wlan_bt_init(void) | |||
634 | static inline void __init igep_wlan_bt_init(void) { } | 634 | static inline void __init igep_wlan_bt_init(void) { } |
635 | #endif | 635 | #endif |
636 | 636 | ||
637 | static struct regulator_consumer_supply dummy_supplies[] = { | ||
638 | REGULATOR_SUPPLY("vddvario", "smsc911x.0"), | ||
639 | REGULATOR_SUPPLY("vdd33a", "smsc911x.0"), | ||
640 | }; | ||
641 | |||
637 | static void __init igep_init(void) | 642 | static void __init igep_init(void) |
638 | { | 643 | { |
644 | regulator_register_fixed(0, dummy_supplies, ARRAY_SIZE(dummy_supplies)); | ||
639 | omap3_mux_init(board_mux, OMAP_PACKAGE_CBB); | 645 | omap3_mux_init(board_mux, OMAP_PACKAGE_CBB); |
640 | 646 | ||
641 | /* Get IGEP2 hardware revision */ | 647 | /* Get IGEP2 hardware revision */ |
diff --git a/arch/arm/mach-omap2/board-ldp.c b/arch/arm/mach-omap2/board-ldp.c index d50a562adfa0..1b6049567ab4 100644 --- a/arch/arm/mach-omap2/board-ldp.c +++ b/arch/arm/mach-omap2/board-ldp.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <linux/err.h> | 22 | #include <linux/err.h> |
23 | #include <linux/clk.h> | 23 | #include <linux/clk.h> |
24 | #include <linux/spi/spi.h> | 24 | #include <linux/spi/spi.h> |
25 | #include <linux/regulator/fixed.h> | ||
25 | #include <linux/regulator/machine.h> | 26 | #include <linux/regulator/machine.h> |
26 | #include <linux/i2c/twl.h> | 27 | #include <linux/i2c/twl.h> |
27 | #include <linux/io.h> | 28 | #include <linux/io.h> |
@@ -410,8 +411,14 @@ static struct mtd_partition ldp_nand_partitions[] = { | |||
410 | 411 | ||
411 | }; | 412 | }; |
412 | 413 | ||
414 | static struct regulator_consumer_supply dummy_supplies[] = { | ||
415 | REGULATOR_SUPPLY("vddvario", "smsc911x.0"), | ||
416 | REGULATOR_SUPPLY("vdd33a", "smsc911x.0"), | ||
417 | }; | ||
418 | |||
413 | static void __init omap_ldp_init(void) | 419 | static void __init omap_ldp_init(void) |
414 | { | 420 | { |
421 | regulator_register_fixed(0, dummy_supplies, ARRAY_SIZE(dummy_supplies)); | ||
415 | omap3_mux_init(board_mux, OMAP_PACKAGE_CBB); | 422 | omap3_mux_init(board_mux, OMAP_PACKAGE_CBB); |
416 | ldp_init_smsc911x(); | 423 | ldp_init_smsc911x(); |
417 | omap_i2c_init(); | 424 | omap_i2c_init(); |
diff --git a/arch/arm/mach-omap2/board-omap3evm.c b/arch/arm/mach-omap2/board-omap3evm.c index 4c90f078abe1..49df12735b41 100644 --- a/arch/arm/mach-omap2/board-omap3evm.c +++ b/arch/arm/mach-omap2/board-omap3evm.c | |||
@@ -114,15 +114,6 @@ static struct omap_smsc911x_platform_data smsc911x_cfg = { | |||
114 | 114 | ||
115 | static inline void __init omap3evm_init_smsc911x(void) | 115 | static inline void __init omap3evm_init_smsc911x(void) |
116 | { | 116 | { |
117 | struct clk *l3ck; | ||
118 | unsigned int rate; | ||
119 | |||
120 | l3ck = clk_get(NULL, "l3_ck"); | ||
121 | if (IS_ERR(l3ck)) | ||
122 | rate = 100000000; | ||
123 | else | ||
124 | rate = clk_get_rate(l3ck); | ||
125 | |||
126 | /* Configure ethernet controller reset gpio */ | 117 | /* Configure ethernet controller reset gpio */ |
127 | if (cpu_is_omap3430()) { | 118 | if (cpu_is_omap3430()) { |
128 | if (get_omap3_evm_rev() == OMAP3EVM_BOARD_GEN_1) | 119 | if (get_omap3_evm_rev() == OMAP3EVM_BOARD_GEN_1) |
@@ -632,9 +623,15 @@ static void __init omap3_evm_wl12xx_init(void) | |||
632 | #endif | 623 | #endif |
633 | } | 624 | } |
634 | 625 | ||
626 | static struct regulator_consumer_supply dummy_supplies[] = { | ||
627 | REGULATOR_SUPPLY("vddvario", "smsc911x.0"), | ||
628 | REGULATOR_SUPPLY("vdd33a", "smsc911x.0"), | ||
629 | }; | ||
630 | |||
635 | static void __init omap3_evm_init(void) | 631 | static void __init omap3_evm_init(void) |
636 | { | 632 | { |
637 | omap3_evm_get_revision(); | 633 | omap3_evm_get_revision(); |
634 | regulator_register_fixed(0, dummy_supplies, ARRAY_SIZE(dummy_supplies)); | ||
638 | 635 | ||
639 | if (cpu_is_omap3630()) | 636 | if (cpu_is_omap3630()) |
640 | omap3_mux_init(omap36x_board_mux, OMAP_PACKAGE_CBB); | 637 | omap3_mux_init(omap36x_board_mux, OMAP_PACKAGE_CBB); |
diff --git a/arch/arm/mach-omap2/board-omap3logic.c b/arch/arm/mach-omap2/board-omap3logic.c index 4a7d8c8a75da..9b3c141ff51b 100644 --- a/arch/arm/mach-omap2/board-omap3logic.c +++ b/arch/arm/mach-omap2/board-omap3logic.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <linux/io.h> | 23 | #include <linux/io.h> |
24 | #include <linux/gpio.h> | 24 | #include <linux/gpio.h> |
25 | 25 | ||
26 | #include <linux/regulator/fixed.h> | ||
26 | #include <linux/regulator/machine.h> | 27 | #include <linux/regulator/machine.h> |
27 | 28 | ||
28 | #include <linux/i2c/twl.h> | 29 | #include <linux/i2c/twl.h> |
@@ -188,8 +189,14 @@ static struct omap_board_mux board_mux[] __initdata = { | |||
188 | }; | 189 | }; |
189 | #endif | 190 | #endif |
190 | 191 | ||
192 | static struct regulator_consumer_supply dummy_supplies[] = { | ||
193 | REGULATOR_SUPPLY("vddvario", "smsc911x.0"), | ||
194 | REGULATOR_SUPPLY("vdd33a", "smsc911x.0"), | ||
195 | }; | ||
196 | |||
191 | static void __init omap3logic_init(void) | 197 | static void __init omap3logic_init(void) |
192 | { | 198 | { |
199 | regulator_register_fixed(0, dummy_supplies, ARRAY_SIZE(dummy_supplies)); | ||
193 | omap3_mux_init(board_mux, OMAP_PACKAGE_CBB); | 200 | omap3_mux_init(board_mux, OMAP_PACKAGE_CBB); |
194 | omap3torpedo_fix_pbias_voltage(); | 201 | omap3torpedo_fix_pbias_voltage(); |
195 | omap3logic_i2c_init(); | 202 | omap3logic_i2c_init(); |
diff --git a/arch/arm/mach-omap2/board-omap3stalker.c b/arch/arm/mach-omap2/board-omap3stalker.c index 641004380795..4dffc95bddd2 100644 --- a/arch/arm/mach-omap2/board-omap3stalker.c +++ b/arch/arm/mach-omap2/board-omap3stalker.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 | 26 | ||
27 | #include <linux/regulator/fixed.h> | ||
27 | #include <linux/regulator/machine.h> | 28 | #include <linux/regulator/machine.h> |
28 | #include <linux/i2c/twl.h> | 29 | #include <linux/i2c/twl.h> |
29 | #include <linux/mmc/host.h> | 30 | #include <linux/mmc/host.h> |
@@ -72,15 +73,6 @@ static struct omap_smsc911x_platform_data smsc911x_cfg = { | |||
72 | 73 | ||
73 | static inline void __init omap3stalker_init_eth(void) | 74 | static inline void __init omap3stalker_init_eth(void) |
74 | { | 75 | { |
75 | struct clk *l3ck; | ||
76 | unsigned int rate; | ||
77 | |||
78 | l3ck = clk_get(NULL, "l3_ck"); | ||
79 | if (IS_ERR(l3ck)) | ||
80 | rate = 100000000; | ||
81 | else | ||
82 | rate = clk_get_rate(l3ck); | ||
83 | |||
84 | omap_mux_init_gpio(19, OMAP_PIN_INPUT_PULLUP); | 76 | omap_mux_init_gpio(19, OMAP_PIN_INPUT_PULLUP); |
85 | gpmc_smsc911x_init(&smsc911x_cfg); | 77 | gpmc_smsc911x_init(&smsc911x_cfg); |
86 | } | 78 | } |
@@ -419,8 +411,14 @@ static struct omap_board_mux board_mux[] __initdata = { | |||
419 | }; | 411 | }; |
420 | #endif | 412 | #endif |
421 | 413 | ||
414 | static struct regulator_consumer_supply dummy_supplies[] = { | ||
415 | REGULATOR_SUPPLY("vddvario", "smsc911x.0"), | ||
416 | REGULATOR_SUPPLY("vdd33a", "smsc911x.0"), | ||
417 | }; | ||
418 | |||
422 | static void __init omap3_stalker_init(void) | 419 | static void __init omap3_stalker_init(void) |
423 | { | 420 | { |
421 | regulator_register_fixed(0, dummy_supplies, ARRAY_SIZE(dummy_supplies)); | ||
424 | omap3_mux_init(board_mux, OMAP_PACKAGE_CUS); | 422 | omap3_mux_init(board_mux, OMAP_PACKAGE_CUS); |
425 | omap_board_config = omap3_stalker_config; | 423 | omap_board_config = omap3_stalker_config; |
426 | omap_board_config_size = ARRAY_SIZE(omap3_stalker_config); | 424 | omap_board_config_size = ARRAY_SIZE(omap3_stalker_config); |
diff --git a/arch/arm/mach-omap2/board-overo.c b/arch/arm/mach-omap2/board-overo.c index 668533e2a379..33aa3910b09e 100644 --- a/arch/arm/mach-omap2/board-overo.c +++ b/arch/arm/mach-omap2/board-overo.c | |||
@@ -498,10 +498,18 @@ static struct gpio overo_bt_gpios[] __initdata = { | |||
498 | { OVERO_GPIO_BT_NRESET, GPIOF_OUT_INIT_HIGH, "lcd bl enable" }, | 498 | { OVERO_GPIO_BT_NRESET, GPIOF_OUT_INIT_HIGH, "lcd bl enable" }, |
499 | }; | 499 | }; |
500 | 500 | ||
501 | static struct regulator_consumer_supply dummy_supplies[] = { | ||
502 | REGULATOR_SUPPLY("vddvario", "smsc911x.0"), | ||
503 | REGULATOR_SUPPLY("vdd33a", "smsc911x.0"), | ||
504 | REGULATOR_SUPPLY("vddvario", "smsc911x.1"), | ||
505 | REGULATOR_SUPPLY("vdd33a", "smsc911x.1"), | ||
506 | }; | ||
507 | |||
501 | static void __init overo_init(void) | 508 | static void __init overo_init(void) |
502 | { | 509 | { |
503 | int ret; | 510 | int ret; |
504 | 511 | ||
512 | regulator_register_fixed(0, dummy_supplies, ARRAY_SIZE(dummy_supplies)); | ||
505 | omap3_mux_init(board_mux, OMAP_PACKAGE_CBB); | 513 | omap3_mux_init(board_mux, OMAP_PACKAGE_CBB); |
506 | omap_hsmmc_init(mmc); | 514 | omap_hsmmc_init(mmc); |
507 | overo_i2c_init(); | 515 | overo_i2c_init(); |
diff --git a/arch/arm/mach-omap2/board-zoom-debugboard.c b/arch/arm/mach-omap2/board-zoom-debugboard.c index 1e8540eabde9..f64f44173061 100644 --- a/arch/arm/mach-omap2/board-zoom-debugboard.c +++ b/arch/arm/mach-omap2/board-zoom-debugboard.c | |||
@@ -14,6 +14,9 @@ | |||
14 | #include <linux/smsc911x.h> | 14 | #include <linux/smsc911x.h> |
15 | #include <linux/interrupt.h> | 15 | #include <linux/interrupt.h> |
16 | 16 | ||
17 | #include <linux/regulator/fixed.h> | ||
18 | #include <linux/regulator/machine.h> | ||
19 | |||
17 | #include <plat/gpmc.h> | 20 | #include <plat/gpmc.h> |
18 | #include <plat/gpmc-smsc911x.h> | 21 | #include <plat/gpmc-smsc911x.h> |
19 | 22 | ||
@@ -117,11 +120,17 @@ static struct platform_device *zoom_devices[] __initdata = { | |||
117 | &zoom_debugboard_serial_device, | 120 | &zoom_debugboard_serial_device, |
118 | }; | 121 | }; |
119 | 122 | ||
123 | static struct regulator_consumer_supply dummy_supplies[] = { | ||
124 | REGULATOR_SUPPLY("vddvario", "smsc911x.0"), | ||
125 | REGULATOR_SUPPLY("vdd33a", "smsc911x.0"), | ||
126 | }; | ||
127 | |||
120 | int __init zoom_debugboard_init(void) | 128 | int __init zoom_debugboard_init(void) |
121 | { | 129 | { |
122 | if (!omap_zoom_debugboard_detect()) | 130 | if (!omap_zoom_debugboard_detect()) |
123 | return 0; | 131 | return 0; |
124 | 132 | ||
133 | regulator_register_fixed(0, dummy_supplies, ARRAY_SIZE(dummy_supplies)); | ||
125 | zoom_init_smsc911x(); | 134 | zoom_init_smsc911x(); |
126 | zoom_init_quaduart(); | 135 | zoom_init_quaduart(); |
127 | return platform_add_devices(zoom_devices, ARRAY_SIZE(zoom_devices)); | 136 | return platform_add_devices(zoom_devices, ARRAY_SIZE(zoom_devices)); |
diff --git a/arch/arm/mach-omap2/clock3xxx_data.c b/arch/arm/mach-omap2/clock3xxx_data.c index 480fb8f09aed..f4a626f7c79e 100644 --- a/arch/arm/mach-omap2/clock3xxx_data.c +++ b/arch/arm/mach-omap2/clock3xxx_data.c | |||
@@ -747,7 +747,7 @@ static struct clk dpll4_m3_ck = { | |||
747 | .parent = &dpll4_ck, | 747 | .parent = &dpll4_ck, |
748 | .init = &omap2_init_clksel_parent, | 748 | .init = &omap2_init_clksel_parent, |
749 | .clksel_reg = OMAP_CM_REGADDR(OMAP3430_DSS_MOD, CM_CLKSEL), | 749 | .clksel_reg = OMAP_CM_REGADDR(OMAP3430_DSS_MOD, CM_CLKSEL), |
750 | .clksel_mask = OMAP3430_CLKSEL_TV_MASK, | 750 | .clksel_mask = OMAP3630_CLKSEL_TV_MASK, |
751 | .clksel = dpll4_clksel, | 751 | .clksel = dpll4_clksel, |
752 | .clkdm_name = "dpll4_clkdm", | 752 | .clkdm_name = "dpll4_clkdm", |
753 | .recalc = &omap2_clksel_recalc, | 753 | .recalc = &omap2_clksel_recalc, |
@@ -832,7 +832,7 @@ static struct clk dpll4_m4_ck = { | |||
832 | .parent = &dpll4_ck, | 832 | .parent = &dpll4_ck, |
833 | .init = &omap2_init_clksel_parent, | 833 | .init = &omap2_init_clksel_parent, |
834 | .clksel_reg = OMAP_CM_REGADDR(OMAP3430_DSS_MOD, CM_CLKSEL), | 834 | .clksel_reg = OMAP_CM_REGADDR(OMAP3430_DSS_MOD, CM_CLKSEL), |
835 | .clksel_mask = OMAP3430_CLKSEL_DSS1_MASK, | 835 | .clksel_mask = OMAP3630_CLKSEL_DSS1_MASK, |
836 | .clksel = dpll4_clksel, | 836 | .clksel = dpll4_clksel, |
837 | .clkdm_name = "dpll4_clkdm", | 837 | .clkdm_name = "dpll4_clkdm", |
838 | .recalc = &omap2_clksel_recalc, | 838 | .recalc = &omap2_clksel_recalc, |
@@ -859,7 +859,7 @@ static struct clk dpll4_m5_ck = { | |||
859 | .parent = &dpll4_ck, | 859 | .parent = &dpll4_ck, |
860 | .init = &omap2_init_clksel_parent, | 860 | .init = &omap2_init_clksel_parent, |
861 | .clksel_reg = OMAP_CM_REGADDR(OMAP3430_CAM_MOD, CM_CLKSEL), | 861 | .clksel_reg = OMAP_CM_REGADDR(OMAP3430_CAM_MOD, CM_CLKSEL), |
862 | .clksel_mask = OMAP3430_CLKSEL_CAM_MASK, | 862 | .clksel_mask = OMAP3630_CLKSEL_CAM_MASK, |
863 | .clksel = dpll4_clksel, | 863 | .clksel = dpll4_clksel, |
864 | .clkdm_name = "dpll4_clkdm", | 864 | .clkdm_name = "dpll4_clkdm", |
865 | .set_rate = &omap2_clksel_set_rate, | 865 | .set_rate = &omap2_clksel_set_rate, |
@@ -886,7 +886,7 @@ static struct clk dpll4_m6_ck = { | |||
886 | .parent = &dpll4_ck, | 886 | .parent = &dpll4_ck, |
887 | .init = &omap2_init_clksel_parent, | 887 | .init = &omap2_init_clksel_parent, |
888 | .clksel_reg = OMAP_CM_REGADDR(OMAP3430_EMU_MOD, CM_CLKSEL1), | 888 | .clksel_reg = OMAP_CM_REGADDR(OMAP3430_EMU_MOD, CM_CLKSEL1), |
889 | .clksel_mask = OMAP3430_DIV_DPLL4_MASK, | 889 | .clksel_mask = OMAP3630_DIV_DPLL4_MASK, |
890 | .clksel = dpll4_clksel, | 890 | .clksel = dpll4_clksel, |
891 | .clkdm_name = "dpll4_clkdm", | 891 | .clkdm_name = "dpll4_clkdm", |
892 | .recalc = &omap2_clksel_recalc, | 892 | .recalc = &omap2_clksel_recalc, |
@@ -1394,6 +1394,7 @@ static struct clk cpefuse_fck = { | |||
1394 | .name = "cpefuse_fck", | 1394 | .name = "cpefuse_fck", |
1395 | .ops = &clkops_omap2_dflt, | 1395 | .ops = &clkops_omap2_dflt, |
1396 | .parent = &sys_ck, | 1396 | .parent = &sys_ck, |
1397 | .clkdm_name = "core_l4_clkdm", | ||
1397 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP3430ES2_CM_FCLKEN3), | 1398 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP3430ES2_CM_FCLKEN3), |
1398 | .enable_bit = OMAP3430ES2_EN_CPEFUSE_SHIFT, | 1399 | .enable_bit = OMAP3430ES2_EN_CPEFUSE_SHIFT, |
1399 | .recalc = &followparent_recalc, | 1400 | .recalc = &followparent_recalc, |
@@ -1403,6 +1404,7 @@ static struct clk ts_fck = { | |||
1403 | .name = "ts_fck", | 1404 | .name = "ts_fck", |
1404 | .ops = &clkops_omap2_dflt, | 1405 | .ops = &clkops_omap2_dflt, |
1405 | .parent = &omap_32k_fck, | 1406 | .parent = &omap_32k_fck, |
1407 | .clkdm_name = "core_l4_clkdm", | ||
1406 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP3430ES2_CM_FCLKEN3), | 1408 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP3430ES2_CM_FCLKEN3), |
1407 | .enable_bit = OMAP3430ES2_EN_TS_SHIFT, | 1409 | .enable_bit = OMAP3430ES2_EN_TS_SHIFT, |
1408 | .recalc = &followparent_recalc, | 1410 | .recalc = &followparent_recalc, |
@@ -1412,6 +1414,7 @@ static struct clk usbtll_fck = { | |||
1412 | .name = "usbtll_fck", | 1414 | .name = "usbtll_fck", |
1413 | .ops = &clkops_omap2_dflt_wait, | 1415 | .ops = &clkops_omap2_dflt_wait, |
1414 | .parent = &dpll5_m2_ck, | 1416 | .parent = &dpll5_m2_ck, |
1417 | .clkdm_name = "core_l4_clkdm", | ||
1415 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP3430ES2_CM_FCLKEN3), | 1418 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP3430ES2_CM_FCLKEN3), |
1416 | .enable_bit = OMAP3430ES2_EN_USBTLL_SHIFT, | 1419 | .enable_bit = OMAP3430ES2_EN_USBTLL_SHIFT, |
1417 | .recalc = &followparent_recalc, | 1420 | .recalc = &followparent_recalc, |
@@ -1617,6 +1620,7 @@ static struct clk fshostusb_fck = { | |||
1617 | .name = "fshostusb_fck", | 1620 | .name = "fshostusb_fck", |
1618 | .ops = &clkops_omap2_dflt_wait, | 1621 | .ops = &clkops_omap2_dflt_wait, |
1619 | .parent = &core_48m_fck, | 1622 | .parent = &core_48m_fck, |
1623 | .clkdm_name = "core_l4_clkdm", | ||
1620 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), | 1624 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), |
1621 | .enable_bit = OMAP3430ES1_EN_FSHOSTUSB_SHIFT, | 1625 | .enable_bit = OMAP3430ES1_EN_FSHOSTUSB_SHIFT, |
1622 | .recalc = &followparent_recalc, | 1626 | .recalc = &followparent_recalc, |
@@ -2043,6 +2047,7 @@ static struct clk omapctrl_ick = { | |||
2043 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), | 2047 | .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), |
2044 | .enable_bit = OMAP3430_EN_OMAPCTRL_SHIFT, | 2048 | .enable_bit = OMAP3430_EN_OMAPCTRL_SHIFT, |
2045 | .flags = ENABLE_ON_INIT, | 2049 | .flags = ENABLE_ON_INIT, |
2050 | .clkdm_name = "core_l4_clkdm", | ||
2046 | .recalc = &followparent_recalc, | 2051 | .recalc = &followparent_recalc, |
2047 | }; | 2052 | }; |
2048 | 2053 | ||
@@ -2094,6 +2099,7 @@ static struct clk usb_l4_ick = { | |||
2094 | .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL), | 2099 | .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL), |
2095 | .clksel_mask = OMAP3430ES1_CLKSEL_FSHOSTUSB_MASK, | 2100 | .clksel_mask = OMAP3430ES1_CLKSEL_FSHOSTUSB_MASK, |
2096 | .clksel = usb_l4_clksel, | 2101 | .clksel = usb_l4_clksel, |
2102 | .clkdm_name = "core_l4_clkdm", | ||
2097 | .recalc = &omap2_clksel_recalc, | 2103 | .recalc = &omap2_clksel_recalc, |
2098 | }; | 2104 | }; |
2099 | 2105 | ||
@@ -3467,8 +3473,8 @@ static struct omap_clk omap3xxx_clks[] = { | |||
3467 | CLK(NULL, "ipss_ick", &ipss_ick, CK_AM35XX), | 3473 | CLK(NULL, "ipss_ick", &ipss_ick, CK_AM35XX), |
3468 | CLK(NULL, "rmii_ck", &rmii_ck, CK_AM35XX), | 3474 | CLK(NULL, "rmii_ck", &rmii_ck, CK_AM35XX), |
3469 | CLK(NULL, "pclk_ck", &pclk_ck, CK_AM35XX), | 3475 | CLK(NULL, "pclk_ck", &pclk_ck, CK_AM35XX), |
3470 | CLK("davinci_emac", "emac_clk", &emac_ick, CK_AM35XX), | 3476 | CLK("davinci_emac", NULL, &emac_ick, CK_AM35XX), |
3471 | CLK("davinci_emac", "phy_clk", &emac_fck, CK_AM35XX), | 3477 | CLK("davinci_mdio.0", NULL, &emac_fck, CK_AM35XX), |
3472 | CLK("vpfe-capture", "master", &vpfe_ick, CK_AM35XX), | 3478 | CLK("vpfe-capture", "master", &vpfe_ick, CK_AM35XX), |
3473 | CLK("vpfe-capture", "slave", &vpfe_fck, CK_AM35XX), | 3479 | CLK("vpfe-capture", "slave", &vpfe_fck, CK_AM35XX), |
3474 | CLK("musb-am35x", "ick", &hsotgusb_ick_am35xx, CK_AM35XX), | 3480 | CLK("musb-am35x", "ick", &hsotgusb_ick_am35xx, CK_AM35XX), |
diff --git a/arch/arm/mach-omap2/clock44xx_data.c b/arch/arm/mach-omap2/clock44xx_data.c index c03c1108468e..fa6ea65ad44b 100644 --- a/arch/arm/mach-omap2/clock44xx_data.c +++ b/arch/arm/mach-omap2/clock44xx_data.c | |||
@@ -957,8 +957,8 @@ static struct dpll_data dpll_usb_dd = { | |||
957 | .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED), | 957 | .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED), |
958 | .autoidle_reg = OMAP4430_CM_AUTOIDLE_DPLL_USB, | 958 | .autoidle_reg = OMAP4430_CM_AUTOIDLE_DPLL_USB, |
959 | .idlest_reg = OMAP4430_CM_IDLEST_DPLL_USB, | 959 | .idlest_reg = OMAP4430_CM_IDLEST_DPLL_USB, |
960 | .mult_mask = OMAP4430_DPLL_MULT_MASK, | 960 | .mult_mask = OMAP4430_DPLL_MULT_USB_MASK, |
961 | .div1_mask = OMAP4430_DPLL_DIV_MASK, | 961 | .div1_mask = OMAP4430_DPLL_DIV_0_7_MASK, |
962 | .enable_mask = OMAP4430_DPLL_EN_MASK, | 962 | .enable_mask = OMAP4430_DPLL_EN_MASK, |
963 | .autoidle_mask = OMAP4430_AUTO_DPLL_MODE_MASK, | 963 | .autoidle_mask = OMAP4430_AUTO_DPLL_MODE_MASK, |
964 | .idlest_mask = OMAP4430_ST_DPLL_CLK_MASK, | 964 | .idlest_mask = OMAP4430_ST_DPLL_CLK_MASK, |
@@ -978,6 +978,7 @@ static struct clk dpll_usb_ck = { | |||
978 | .recalc = &omap3_dpll_recalc, | 978 | .recalc = &omap3_dpll_recalc, |
979 | .round_rate = &omap2_dpll_round_rate, | 979 | .round_rate = &omap2_dpll_round_rate, |
980 | .set_rate = &omap3_noncore_dpll_set_rate, | 980 | .set_rate = &omap3_noncore_dpll_set_rate, |
981 | .clkdm_name = "l3_init_clkdm", | ||
981 | }; | 982 | }; |
982 | 983 | ||
983 | static struct clk dpll_usb_clkdcoldo_ck = { | 984 | static struct clk dpll_usb_clkdcoldo_ck = { |
diff --git a/arch/arm/mach-omap2/clockdomains44xx_data.c b/arch/arm/mach-omap2/clockdomains44xx_data.c index 9299ac291d28..bd7ed13515cc 100644 --- a/arch/arm/mach-omap2/clockdomains44xx_data.c +++ b/arch/arm/mach-omap2/clockdomains44xx_data.c | |||
@@ -390,7 +390,7 @@ static struct clockdomain emu_sys_44xx_clkdm = { | |||
390 | .prcm_partition = OMAP4430_PRM_PARTITION, | 390 | .prcm_partition = OMAP4430_PRM_PARTITION, |
391 | .cm_inst = OMAP4430_PRM_EMU_CM_INST, | 391 | .cm_inst = OMAP4430_PRM_EMU_CM_INST, |
392 | .clkdm_offs = OMAP4430_PRM_EMU_CM_EMU_CDOFFS, | 392 | .clkdm_offs = OMAP4430_PRM_EMU_CM_EMU_CDOFFS, |
393 | .flags = CLKDM_CAN_HWSUP, | 393 | .flags = CLKDM_CAN_ENABLE_AUTO | CLKDM_CAN_FORCE_WAKEUP, |
394 | }; | 394 | }; |
395 | 395 | ||
396 | static struct clockdomain l3_dma_44xx_clkdm = { | 396 | static struct clockdomain l3_dma_44xx_clkdm = { |
diff --git a/arch/arm/mach-omap2/gpmc-smsc911x.c b/arch/arm/mach-omap2/gpmc-smsc911x.c index 5e5880d6d099..b6c77be3e8f7 100644 --- a/arch/arm/mach-omap2/gpmc-smsc911x.c +++ b/arch/arm/mach-omap2/gpmc-smsc911x.c | |||
@@ -19,15 +19,11 @@ | |||
19 | #include <linux/interrupt.h> | 19 | #include <linux/interrupt.h> |
20 | #include <linux/io.h> | 20 | #include <linux/io.h> |
21 | #include <linux/smsc911x.h> | 21 | #include <linux/smsc911x.h> |
22 | #include <linux/regulator/fixed.h> | ||
23 | #include <linux/regulator/machine.h> | ||
24 | 22 | ||
25 | #include <plat/board.h> | 23 | #include <plat/board.h> |
26 | #include <plat/gpmc.h> | 24 | #include <plat/gpmc.h> |
27 | #include <plat/gpmc-smsc911x.h> | 25 | #include <plat/gpmc-smsc911x.h> |
28 | 26 | ||
29 | static struct omap_smsc911x_platform_data *gpmc_cfg; | ||
30 | |||
31 | static struct resource gpmc_smsc911x_resources[] = { | 27 | static struct resource gpmc_smsc911x_resources[] = { |
32 | [0] = { | 28 | [0] = { |
33 | .flags = IORESOURCE_MEM, | 29 | .flags = IORESOURCE_MEM, |
@@ -41,51 +37,6 @@ static struct smsc911x_platform_config gpmc_smsc911x_config = { | |||
41 | .phy_interface = PHY_INTERFACE_MODE_MII, | 37 | .phy_interface = PHY_INTERFACE_MODE_MII, |
42 | .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW, | 38 | .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW, |
43 | .irq_type = SMSC911X_IRQ_TYPE_OPEN_DRAIN, | 39 | .irq_type = SMSC911X_IRQ_TYPE_OPEN_DRAIN, |
44 | .flags = SMSC911X_USE_16BIT, | ||
45 | }; | ||
46 | |||
47 | static struct regulator_consumer_supply gpmc_smsc911x_supply[] = { | ||
48 | REGULATOR_SUPPLY("vddvario", "smsc911x.0"), | ||
49 | REGULATOR_SUPPLY("vdd33a", "smsc911x.0"), | ||
50 | }; | ||
51 | |||
52 | /* Generic regulator definition to satisfy smsc911x */ | ||
53 | static struct regulator_init_data gpmc_smsc911x_reg_init_data = { | ||
54 | .constraints = { | ||
55 | .min_uV = 3300000, | ||
56 | .max_uV = 3300000, | ||
57 | .valid_modes_mask = REGULATOR_MODE_NORMAL | ||
58 | | REGULATOR_MODE_STANDBY, | ||
59 | .valid_ops_mask = REGULATOR_CHANGE_MODE | ||
60 | | REGULATOR_CHANGE_STATUS, | ||
61 | }, | ||
62 | .num_consumer_supplies = ARRAY_SIZE(gpmc_smsc911x_supply), | ||
63 | .consumer_supplies = gpmc_smsc911x_supply, | ||
64 | }; | ||
65 | |||
66 | static struct fixed_voltage_config gpmc_smsc911x_fixed_reg_data = { | ||
67 | .supply_name = "gpmc_smsc911x", | ||
68 | .microvolts = 3300000, | ||
69 | .gpio = -EINVAL, | ||
70 | .startup_delay = 0, | ||
71 | .enable_high = 0, | ||
72 | .enabled_at_boot = 1, | ||
73 | .init_data = &gpmc_smsc911x_reg_init_data, | ||
74 | }; | ||
75 | |||
76 | /* | ||
77 | * Platform device id of 42 is a temporary fix to avoid conflicts | ||
78 | * with other reg-fixed-voltage devices. The real fix should | ||
79 | * involve the driver core providing a way of dynamically | ||
80 | * assigning a unique id on registration for platform devices | ||
81 | * in the same name space. | ||
82 | */ | ||
83 | static struct platform_device gpmc_smsc911x_regulator = { | ||
84 | .name = "reg-fixed-voltage", | ||
85 | .id = 42, | ||
86 | .dev = { | ||
87 | .platform_data = &gpmc_smsc911x_fixed_reg_data, | ||
88 | }, | ||
89 | }; | 40 | }; |
90 | 41 | ||
91 | /* | 42 | /* |
@@ -93,23 +44,12 @@ static struct platform_device gpmc_smsc911x_regulator = { | |||
93 | * assume that pin multiplexing is done in the board-*.c file, | 44 | * assume that pin multiplexing is done in the board-*.c file, |
94 | * or in the bootloader. | 45 | * or in the bootloader. |
95 | */ | 46 | */ |
96 | void __init gpmc_smsc911x_init(struct omap_smsc911x_platform_data *board_data) | 47 | void __init gpmc_smsc911x_init(struct omap_smsc911x_platform_data *gpmc_cfg) |
97 | { | 48 | { |
98 | struct platform_device *pdev; | 49 | struct platform_device *pdev; |
99 | unsigned long cs_mem_base; | 50 | unsigned long cs_mem_base; |
100 | int ret; | 51 | int ret; |
101 | 52 | ||
102 | gpmc_cfg = board_data; | ||
103 | |||
104 | if (!gpmc_cfg->id) { | ||
105 | ret = platform_device_register(&gpmc_smsc911x_regulator); | ||
106 | if (ret < 0) { | ||
107 | pr_err("Unable to register smsc911x regulators: %d\n", | ||
108 | ret); | ||
109 | return; | ||
110 | } | ||
111 | } | ||
112 | |||
113 | if (gpmc_cs_request(gpmc_cfg->cs, SZ_16M, &cs_mem_base) < 0) { | 53 | if (gpmc_cs_request(gpmc_cfg->cs, SZ_16M, &cs_mem_base) < 0) { |
114 | pr_err("Failed to request GPMC mem region\n"); | 54 | pr_err("Failed to request GPMC mem region\n"); |
115 | return; | 55 | return; |
@@ -139,8 +79,7 @@ void __init gpmc_smsc911x_init(struct omap_smsc911x_platform_data *board_data) | |||
139 | gpio_set_value(gpmc_cfg->gpio_reset, 1); | 79 | gpio_set_value(gpmc_cfg->gpio_reset, 1); |
140 | } | 80 | } |
141 | 81 | ||
142 | if (gpmc_cfg->flags) | 82 | gpmc_smsc911x_config.flags = gpmc_cfg->flags ? : SMSC911X_USE_16BIT; |
143 | gpmc_smsc911x_config.flags = gpmc_cfg->flags; | ||
144 | 83 | ||
145 | pdev = platform_device_register_resndata(NULL, "smsc911x", gpmc_cfg->id, | 84 | pdev = platform_device_register_resndata(NULL, "smsc911x", gpmc_cfg->id, |
146 | gpmc_smsc911x_resources, ARRAY_SIZE(gpmc_smsc911x_resources), | 85 | gpmc_smsc911x_resources, ARRAY_SIZE(gpmc_smsc911x_resources), |
diff --git a/arch/arm/mach-omap2/hsmmc.c b/arch/arm/mach-omap2/hsmmc.c index 100db6217f39..b0268eaffe13 100644 --- a/arch/arm/mach-omap2/hsmmc.c +++ b/arch/arm/mach-omap2/hsmmc.c | |||
@@ -506,6 +506,13 @@ static void __init omap_hsmmc_init_one(struct omap2_hsmmc_info *hsmmcinfo, | |||
506 | if (oh->dev_attr != NULL) { | 506 | if (oh->dev_attr != NULL) { |
507 | mmc_dev_attr = oh->dev_attr; | 507 | mmc_dev_attr = oh->dev_attr; |
508 | mmc_data->controller_flags = mmc_dev_attr->flags; | 508 | mmc_data->controller_flags = mmc_dev_attr->flags; |
509 | /* | ||
510 | * erratum 2.1.1.128 doesn't apply if board has | ||
511 | * a transceiver is attached | ||
512 | */ | ||
513 | if (hsmmcinfo->transceiver) | ||
514 | mmc_data->controller_flags &= | ||
515 | ~OMAP_HSMMC_BROKEN_MULTIBLOCK_READ; | ||
509 | } | 516 | } |
510 | 517 | ||
511 | pdev = platform_device_alloc(name, ctrl_nr - 1); | 518 | pdev = platform_device_alloc(name, ctrl_nr - 1); |
diff --git a/arch/arm/mach-omap2/include/mach/barriers.h b/arch/arm/mach-omap2/include/mach/barriers.h index 4fa72c7cc7cd..1c582a8592b9 100644 --- a/arch/arm/mach-omap2/include/mach/barriers.h +++ b/arch/arm/mach-omap2/include/mach/barriers.h | |||
@@ -22,6 +22,8 @@ | |||
22 | #ifndef __MACH_BARRIERS_H | 22 | #ifndef __MACH_BARRIERS_H |
23 | #define __MACH_BARRIERS_H | 23 | #define __MACH_BARRIERS_H |
24 | 24 | ||
25 | #include <asm/outercache.h> | ||
26 | |||
25 | extern void omap_bus_sync(void); | 27 | extern void omap_bus_sync(void); |
26 | 28 | ||
27 | #define rmb() dsb() | 29 | #define rmb() dsb() |
diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c index eba6cd3816f5..2c27fdb61e66 100644 --- a/arch/arm/mach-omap2/omap_hwmod.c +++ b/arch/arm/mach-omap2/omap_hwmod.c | |||
@@ -1395,7 +1395,7 @@ static int _read_hardreset(struct omap_hwmod *oh, const char *name) | |||
1395 | */ | 1395 | */ |
1396 | static int _ocp_softreset(struct omap_hwmod *oh) | 1396 | static int _ocp_softreset(struct omap_hwmod *oh) |
1397 | { | 1397 | { |
1398 | u32 v; | 1398 | u32 v, softrst_mask; |
1399 | int c = 0; | 1399 | int c = 0; |
1400 | int ret = 0; | 1400 | int ret = 0; |
1401 | 1401 | ||
@@ -1427,11 +1427,13 @@ static int _ocp_softreset(struct omap_hwmod *oh) | |||
1427 | oh->class->sysc->syss_offs) | 1427 | oh->class->sysc->syss_offs) |
1428 | & SYSS_RESETDONE_MASK), | 1428 | & SYSS_RESETDONE_MASK), |
1429 | MAX_MODULE_SOFTRESET_WAIT, c); | 1429 | MAX_MODULE_SOFTRESET_WAIT, c); |
1430 | else if (oh->class->sysc->sysc_flags & SYSC_HAS_RESET_STATUS) | 1430 | else if (oh->class->sysc->sysc_flags & SYSC_HAS_RESET_STATUS) { |
1431 | softrst_mask = (0x1 << oh->class->sysc->sysc_fields->srst_shift); | ||
1431 | omap_test_timeout(!(omap_hwmod_read(oh, | 1432 | omap_test_timeout(!(omap_hwmod_read(oh, |
1432 | oh->class->sysc->sysc_offs) | 1433 | oh->class->sysc->sysc_offs) |
1433 | & SYSC_TYPE2_SOFTRESET_MASK), | 1434 | & softrst_mask), |
1434 | MAX_MODULE_SOFTRESET_WAIT, c); | 1435 | MAX_MODULE_SOFTRESET_WAIT, c); |
1436 | } | ||
1435 | 1437 | ||
1436 | if (c == MAX_MODULE_SOFTRESET_WAIT) | 1438 | if (c == MAX_MODULE_SOFTRESET_WAIT) |
1437 | pr_warning("omap_hwmod: %s: softreset failed (waited %d usec)\n", | 1439 | pr_warning("omap_hwmod: %s: softreset failed (waited %d usec)\n", |
@@ -1477,6 +1479,11 @@ static int _reset(struct omap_hwmod *oh) | |||
1477 | 1479 | ||
1478 | ret = (oh->class->reset) ? oh->class->reset(oh) : _ocp_softreset(oh); | 1480 | ret = (oh->class->reset) ? oh->class->reset(oh) : _ocp_softreset(oh); |
1479 | 1481 | ||
1482 | if (oh->class->sysc) { | ||
1483 | _update_sysc_cache(oh); | ||
1484 | _enable_sysc(oh); | ||
1485 | } | ||
1486 | |||
1480 | return ret; | 1487 | return ret; |
1481 | } | 1488 | } |
1482 | 1489 | ||
@@ -1786,20 +1793,9 @@ static int _setup(struct omap_hwmod *oh, void *data) | |||
1786 | return 0; | 1793 | return 0; |
1787 | } | 1794 | } |
1788 | 1795 | ||
1789 | if (!(oh->flags & HWMOD_INIT_NO_RESET)) { | 1796 | if (!(oh->flags & HWMOD_INIT_NO_RESET)) |
1790 | _reset(oh); | 1797 | _reset(oh); |
1791 | 1798 | ||
1792 | /* | ||
1793 | * OCP_SYSCONFIG bits need to be reprogrammed after a softreset. | ||
1794 | * The _enable() function should be split to | ||
1795 | * avoid the rewrite of the OCP_SYSCONFIG register. | ||
1796 | */ | ||
1797 | if (oh->class->sysc) { | ||
1798 | _update_sysc_cache(oh); | ||
1799 | _enable_sysc(oh); | ||
1800 | } | ||
1801 | } | ||
1802 | |||
1803 | postsetup_state = oh->_postsetup_state; | 1799 | postsetup_state = oh->_postsetup_state; |
1804 | if (postsetup_state == _HWMOD_STATE_UNKNOWN) | 1800 | if (postsetup_state == _HWMOD_STATE_UNKNOWN) |
1805 | postsetup_state = _HWMOD_STATE_ENABLED; | 1801 | postsetup_state = _HWMOD_STATE_ENABLED; |
@@ -1907,20 +1903,10 @@ void omap_hwmod_write(u32 v, struct omap_hwmod *oh, u16 reg_offs) | |||
1907 | */ | 1903 | */ |
1908 | int omap_hwmod_softreset(struct omap_hwmod *oh) | 1904 | int omap_hwmod_softreset(struct omap_hwmod *oh) |
1909 | { | 1905 | { |
1910 | u32 v; | 1906 | if (!oh) |
1911 | int ret; | ||
1912 | |||
1913 | if (!oh || !(oh->_sysc_cache)) | ||
1914 | return -EINVAL; | 1907 | return -EINVAL; |
1915 | 1908 | ||
1916 | v = oh->_sysc_cache; | 1909 | return _ocp_softreset(oh); |
1917 | ret = _set_softreset(oh, &v); | ||
1918 | if (ret) | ||
1919 | goto error; | ||
1920 | _write_sysconfig(v, oh); | ||
1921 | |||
1922 | error: | ||
1923 | return ret; | ||
1924 | } | 1910 | } |
1925 | 1911 | ||
1926 | /** | 1912 | /** |
@@ -2463,26 +2449,28 @@ int omap_hwmod_del_initiator_dep(struct omap_hwmod *oh, | |||
2463 | * @oh: struct omap_hwmod * | 2449 | * @oh: struct omap_hwmod * |
2464 | * | 2450 | * |
2465 | * Sets the module OCP socket ENAWAKEUP bit to allow the module to | 2451 | * Sets the module OCP socket ENAWAKEUP bit to allow the module to |
2466 | * send wakeups to the PRCM. Eventually this should sets PRCM wakeup | 2452 | * send wakeups to the PRCM, and enable I/O ring wakeup events for |
2467 | * registers to cause the PRCM to receive wakeup events from the | 2453 | * this IP block if it has dynamic mux entries. Eventually this |
2468 | * module. Does not set any wakeup routing registers beyond this | 2454 | * should set PRCM wakeup registers to cause the PRCM to receive |
2469 | * point - if the module is to wake up any other module or subsystem, | 2455 | * wakeup events from the module. Does not set any wakeup routing |
2470 | * that must be set separately. Called by omap_device code. Returns | 2456 | * registers beyond this point - if the module is to wake up any other |
2471 | * -EINVAL on error or 0 upon success. | 2457 | * module or subsystem, that must be set separately. Called by |
2458 | * omap_device code. Returns -EINVAL on error or 0 upon success. | ||
2472 | */ | 2459 | */ |
2473 | int omap_hwmod_enable_wakeup(struct omap_hwmod *oh) | 2460 | int omap_hwmod_enable_wakeup(struct omap_hwmod *oh) |
2474 | { | 2461 | { |
2475 | unsigned long flags; | 2462 | unsigned long flags; |
2476 | u32 v; | 2463 | u32 v; |
2477 | 2464 | ||
2478 | if (!oh->class->sysc || | ||
2479 | !(oh->class->sysc->sysc_flags & SYSC_HAS_ENAWAKEUP)) | ||
2480 | return -EINVAL; | ||
2481 | |||
2482 | spin_lock_irqsave(&oh->_lock, flags); | 2465 | spin_lock_irqsave(&oh->_lock, flags); |
2483 | v = oh->_sysc_cache; | 2466 | |
2484 | _enable_wakeup(oh, &v); | 2467 | if (oh->class->sysc && |
2485 | _write_sysconfig(v, oh); | 2468 | (oh->class->sysc->sysc_flags & SYSC_HAS_ENAWAKEUP)) { |
2469 | v = oh->_sysc_cache; | ||
2470 | _enable_wakeup(oh, &v); | ||
2471 | _write_sysconfig(v, oh); | ||
2472 | } | ||
2473 | |||
2486 | _set_idle_ioring_wakeup(oh, true); | 2474 | _set_idle_ioring_wakeup(oh, true); |
2487 | spin_unlock_irqrestore(&oh->_lock, flags); | 2475 | spin_unlock_irqrestore(&oh->_lock, flags); |
2488 | 2476 | ||
@@ -2494,26 +2482,28 @@ int omap_hwmod_enable_wakeup(struct omap_hwmod *oh) | |||
2494 | * @oh: struct omap_hwmod * | 2482 | * @oh: struct omap_hwmod * |
2495 | * | 2483 | * |
2496 | * Clears the module OCP socket ENAWAKEUP bit to prevent the module | 2484 | * Clears the module OCP socket ENAWAKEUP bit to prevent the module |
2497 | * from sending wakeups to the PRCM. Eventually this should clear | 2485 | * from sending wakeups to the PRCM, and disable I/O ring wakeup |
2498 | * PRCM wakeup registers to cause the PRCM to ignore wakeup events | 2486 | * events for this IP block if it has dynamic mux entries. Eventually |
2499 | * from the module. Does not set any wakeup routing registers beyond | 2487 | * this should clear PRCM wakeup registers to cause the PRCM to ignore |
2500 | * this point - if the module is to wake up any other module or | 2488 | * wakeup events from the module. Does not set any wakeup routing |
2501 | * subsystem, that must be set separately. Called by omap_device | 2489 | * registers beyond this point - if the module is to wake up any other |
2502 | * code. Returns -EINVAL on error or 0 upon success. | 2490 | * module or subsystem, that must be set separately. Called by |
2491 | * omap_device code. Returns -EINVAL on error or 0 upon success. | ||
2503 | */ | 2492 | */ |
2504 | int omap_hwmod_disable_wakeup(struct omap_hwmod *oh) | 2493 | int omap_hwmod_disable_wakeup(struct omap_hwmod *oh) |
2505 | { | 2494 | { |
2506 | unsigned long flags; | 2495 | unsigned long flags; |
2507 | u32 v; | 2496 | u32 v; |
2508 | 2497 | ||
2509 | if (!oh->class->sysc || | ||
2510 | !(oh->class->sysc->sysc_flags & SYSC_HAS_ENAWAKEUP)) | ||
2511 | return -EINVAL; | ||
2512 | |||
2513 | spin_lock_irqsave(&oh->_lock, flags); | 2498 | spin_lock_irqsave(&oh->_lock, flags); |
2514 | v = oh->_sysc_cache; | 2499 | |
2515 | _disable_wakeup(oh, &v); | 2500 | if (oh->class->sysc && |
2516 | _write_sysconfig(v, oh); | 2501 | (oh->class->sysc->sysc_flags & SYSC_HAS_ENAWAKEUP)) { |
2502 | v = oh->_sysc_cache; | ||
2503 | _disable_wakeup(oh, &v); | ||
2504 | _write_sysconfig(v, oh); | ||
2505 | } | ||
2506 | |||
2517 | _set_idle_ioring_wakeup(oh, false); | 2507 | _set_idle_ioring_wakeup(oh, false); |
2518 | spin_unlock_irqrestore(&oh->_lock, flags); | 2508 | spin_unlock_irqrestore(&oh->_lock, flags); |
2519 | 2509 | ||
diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c index 08daa5e0eb5f..cc9bd106a854 100644 --- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c | |||
@@ -2996,6 +2996,11 @@ static struct omap_hwmod_ocp_if *omap44xx_mcbsp1_slaves[] = { | |||
2996 | &omap44xx_l4_abe__mcbsp1_dma, | 2996 | &omap44xx_l4_abe__mcbsp1_dma, |
2997 | }; | 2997 | }; |
2998 | 2998 | ||
2999 | static struct omap_hwmod_opt_clk mcbsp1_opt_clks[] = { | ||
3000 | { .role = "pad_fck", .clk = "pad_clks_ck" }, | ||
3001 | { .role = "prcm_clk", .clk = "mcbsp1_sync_mux_ck" }, | ||
3002 | }; | ||
3003 | |||
2999 | static struct omap_hwmod omap44xx_mcbsp1_hwmod = { | 3004 | static struct omap_hwmod omap44xx_mcbsp1_hwmod = { |
3000 | .name = "mcbsp1", | 3005 | .name = "mcbsp1", |
3001 | .class = &omap44xx_mcbsp_hwmod_class, | 3006 | .class = &omap44xx_mcbsp_hwmod_class, |
@@ -3012,6 +3017,8 @@ static struct omap_hwmod omap44xx_mcbsp1_hwmod = { | |||
3012 | }, | 3017 | }, |
3013 | .slaves = omap44xx_mcbsp1_slaves, | 3018 | .slaves = omap44xx_mcbsp1_slaves, |
3014 | .slaves_cnt = ARRAY_SIZE(omap44xx_mcbsp1_slaves), | 3019 | .slaves_cnt = ARRAY_SIZE(omap44xx_mcbsp1_slaves), |
3020 | .opt_clks = mcbsp1_opt_clks, | ||
3021 | .opt_clks_cnt = ARRAY_SIZE(mcbsp1_opt_clks), | ||
3015 | }; | 3022 | }; |
3016 | 3023 | ||
3017 | /* mcbsp2 */ | 3024 | /* mcbsp2 */ |
@@ -3071,6 +3078,11 @@ static struct omap_hwmod_ocp_if *omap44xx_mcbsp2_slaves[] = { | |||
3071 | &omap44xx_l4_abe__mcbsp2_dma, | 3078 | &omap44xx_l4_abe__mcbsp2_dma, |
3072 | }; | 3079 | }; |
3073 | 3080 | ||
3081 | static struct omap_hwmod_opt_clk mcbsp2_opt_clks[] = { | ||
3082 | { .role = "pad_fck", .clk = "pad_clks_ck" }, | ||
3083 | { .role = "prcm_clk", .clk = "mcbsp2_sync_mux_ck" }, | ||
3084 | }; | ||
3085 | |||
3074 | static struct omap_hwmod omap44xx_mcbsp2_hwmod = { | 3086 | static struct omap_hwmod omap44xx_mcbsp2_hwmod = { |
3075 | .name = "mcbsp2", | 3087 | .name = "mcbsp2", |
3076 | .class = &omap44xx_mcbsp_hwmod_class, | 3088 | .class = &omap44xx_mcbsp_hwmod_class, |
@@ -3087,6 +3099,8 @@ static struct omap_hwmod omap44xx_mcbsp2_hwmod = { | |||
3087 | }, | 3099 | }, |
3088 | .slaves = omap44xx_mcbsp2_slaves, | 3100 | .slaves = omap44xx_mcbsp2_slaves, |
3089 | .slaves_cnt = ARRAY_SIZE(omap44xx_mcbsp2_slaves), | 3101 | .slaves_cnt = ARRAY_SIZE(omap44xx_mcbsp2_slaves), |
3102 | .opt_clks = mcbsp2_opt_clks, | ||
3103 | .opt_clks_cnt = ARRAY_SIZE(mcbsp2_opt_clks), | ||
3090 | }; | 3104 | }; |
3091 | 3105 | ||
3092 | /* mcbsp3 */ | 3106 | /* mcbsp3 */ |
@@ -3146,6 +3160,11 @@ static struct omap_hwmod_ocp_if *omap44xx_mcbsp3_slaves[] = { | |||
3146 | &omap44xx_l4_abe__mcbsp3_dma, | 3160 | &omap44xx_l4_abe__mcbsp3_dma, |
3147 | }; | 3161 | }; |
3148 | 3162 | ||
3163 | static struct omap_hwmod_opt_clk mcbsp3_opt_clks[] = { | ||
3164 | { .role = "pad_fck", .clk = "pad_clks_ck" }, | ||
3165 | { .role = "prcm_clk", .clk = "mcbsp3_sync_mux_ck" }, | ||
3166 | }; | ||
3167 | |||
3149 | static struct omap_hwmod omap44xx_mcbsp3_hwmod = { | 3168 | static struct omap_hwmod omap44xx_mcbsp3_hwmod = { |
3150 | .name = "mcbsp3", | 3169 | .name = "mcbsp3", |
3151 | .class = &omap44xx_mcbsp_hwmod_class, | 3170 | .class = &omap44xx_mcbsp_hwmod_class, |
@@ -3162,6 +3181,8 @@ static struct omap_hwmod omap44xx_mcbsp3_hwmod = { | |||
3162 | }, | 3181 | }, |
3163 | .slaves = omap44xx_mcbsp3_slaves, | 3182 | .slaves = omap44xx_mcbsp3_slaves, |
3164 | .slaves_cnt = ARRAY_SIZE(omap44xx_mcbsp3_slaves), | 3183 | .slaves_cnt = ARRAY_SIZE(omap44xx_mcbsp3_slaves), |
3184 | .opt_clks = mcbsp3_opt_clks, | ||
3185 | .opt_clks_cnt = ARRAY_SIZE(mcbsp3_opt_clks), | ||
3165 | }; | 3186 | }; |
3166 | 3187 | ||
3167 | /* mcbsp4 */ | 3188 | /* mcbsp4 */ |
@@ -3200,6 +3221,11 @@ static struct omap_hwmod_ocp_if *omap44xx_mcbsp4_slaves[] = { | |||
3200 | &omap44xx_l4_per__mcbsp4, | 3221 | &omap44xx_l4_per__mcbsp4, |
3201 | }; | 3222 | }; |
3202 | 3223 | ||
3224 | static struct omap_hwmod_opt_clk mcbsp4_opt_clks[] = { | ||
3225 | { .role = "pad_fck", .clk = "pad_clks_ck" }, | ||
3226 | { .role = "prcm_clk", .clk = "mcbsp4_sync_mux_ck" }, | ||
3227 | }; | ||
3228 | |||
3203 | static struct omap_hwmod omap44xx_mcbsp4_hwmod = { | 3229 | static struct omap_hwmod omap44xx_mcbsp4_hwmod = { |
3204 | .name = "mcbsp4", | 3230 | .name = "mcbsp4", |
3205 | .class = &omap44xx_mcbsp_hwmod_class, | 3231 | .class = &omap44xx_mcbsp_hwmod_class, |
@@ -3216,6 +3242,8 @@ static struct omap_hwmod omap44xx_mcbsp4_hwmod = { | |||
3216 | }, | 3242 | }, |
3217 | .slaves = omap44xx_mcbsp4_slaves, | 3243 | .slaves = omap44xx_mcbsp4_slaves, |
3218 | .slaves_cnt = ARRAY_SIZE(omap44xx_mcbsp4_slaves), | 3244 | .slaves_cnt = ARRAY_SIZE(omap44xx_mcbsp4_slaves), |
3245 | .opt_clks = mcbsp4_opt_clks, | ||
3246 | .opt_clks_cnt = ARRAY_SIZE(mcbsp4_opt_clks), | ||
3219 | }; | 3247 | }; |
3220 | 3248 | ||
3221 | /* | 3249 | /* |
diff --git a/arch/arm/mach-omap2/opp.c b/arch/arm/mach-omap2/opp.c index 9262a6b47702..de6d46451746 100644 --- a/arch/arm/mach-omap2/opp.c +++ b/arch/arm/mach-omap2/opp.c | |||
@@ -64,10 +64,10 @@ int __init omap_init_opp_table(struct omap_opp_def *opp_def, | |||
64 | } | 64 | } |
65 | oh = omap_hwmod_lookup(opp_def->hwmod_name); | 65 | oh = omap_hwmod_lookup(opp_def->hwmod_name); |
66 | if (!oh || !oh->od) { | 66 | if (!oh || !oh->od) { |
67 | pr_warn("%s: no hwmod or odev for %s, [%d] " | 67 | pr_debug("%s: no hwmod or odev for %s, [%d] " |
68 | "cannot add OPPs.\n", __func__, | 68 | "cannot add OPPs.\n", __func__, |
69 | opp_def->hwmod_name, i); | 69 | opp_def->hwmod_name, i); |
70 | return -EINVAL; | 70 | continue; |
71 | } | 71 | } |
72 | dev = &oh->od->pdev->dev; | 72 | dev = &oh->od->pdev->dev; |
73 | 73 | ||
diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c index 238defc6f6df..703bd1099259 100644 --- a/arch/arm/mach-omap2/pm34xx.c +++ b/arch/arm/mach-omap2/pm34xx.c | |||
@@ -153,8 +153,7 @@ static void omap3_save_secure_ram_context(void) | |||
153 | pwrdm_set_next_pwrst(mpu_pwrdm, mpu_next_state); | 153 | pwrdm_set_next_pwrst(mpu_pwrdm, mpu_next_state); |
154 | /* Following is for error tracking, it should not happen */ | 154 | /* Following is for error tracking, it should not happen */ |
155 | if (ret) { | 155 | if (ret) { |
156 | printk(KERN_ERR "save_secure_sram() returns %08x\n", | 156 | pr_err("save_secure_sram() returns %08x\n", ret); |
157 | ret); | ||
158 | while (1) | 157 | while (1) |
159 | ; | 158 | ; |
160 | } | 159 | } |
@@ -289,7 +288,7 @@ void omap_sram_idle(void) | |||
289 | break; | 288 | break; |
290 | default: | 289 | default: |
291 | /* Invalid state */ | 290 | /* Invalid state */ |
292 | printk(KERN_ERR "Invalid mpu state in sram_idle\n"); | 291 | pr_err("Invalid mpu state in sram_idle\n"); |
293 | return; | 292 | return; |
294 | } | 293 | } |
295 | 294 | ||
@@ -439,18 +438,17 @@ restore: | |||
439 | list_for_each_entry(pwrst, &pwrst_list, node) { | 438 | list_for_each_entry(pwrst, &pwrst_list, node) { |
440 | state = pwrdm_read_prev_pwrst(pwrst->pwrdm); | 439 | state = pwrdm_read_prev_pwrst(pwrst->pwrdm); |
441 | if (state > pwrst->next_state) { | 440 | if (state > pwrst->next_state) { |
442 | printk(KERN_INFO "Powerdomain (%s) didn't enter " | 441 | pr_info("Powerdomain (%s) didn't enter " |
443 | "target state %d\n", | 442 | "target state %d\n", |
444 | pwrst->pwrdm->name, pwrst->next_state); | 443 | pwrst->pwrdm->name, pwrst->next_state); |
445 | ret = -1; | 444 | ret = -1; |
446 | } | 445 | } |
447 | omap_set_pwrdm_state(pwrst->pwrdm, pwrst->saved_state); | 446 | omap_set_pwrdm_state(pwrst->pwrdm, pwrst->saved_state); |
448 | } | 447 | } |
449 | if (ret) | 448 | if (ret) |
450 | printk(KERN_ERR "Could not enter target state in pm_suspend\n"); | 449 | pr_err("Could not enter target state in pm_suspend\n"); |
451 | else | 450 | else |
452 | printk(KERN_INFO "Successfully put all powerdomains " | 451 | pr_info("Successfully put all powerdomains to target state\n"); |
453 | "to target state\n"); | ||
454 | 452 | ||
455 | return ret; | 453 | return ret; |
456 | } | 454 | } |
@@ -734,21 +732,22 @@ static int __init omap3_pm_init(void) | |||
734 | 732 | ||
735 | if (ret) { | 733 | if (ret) { |
736 | pr_err("pm: Failed to request pm_io irq\n"); | 734 | pr_err("pm: Failed to request pm_io irq\n"); |
737 | goto err1; | 735 | goto err2; |
738 | } | 736 | } |
739 | 737 | ||
740 | ret = pwrdm_for_each(pwrdms_setup, NULL); | 738 | ret = pwrdm_for_each(pwrdms_setup, NULL); |
741 | if (ret) { | 739 | if (ret) { |
742 | printk(KERN_ERR "Failed to setup powerdomains\n"); | 740 | pr_err("Failed to setup powerdomains\n"); |
743 | goto err2; | 741 | goto err3; |
744 | } | 742 | } |
745 | 743 | ||
746 | (void) clkdm_for_each(omap_pm_clkdms_setup, NULL); | 744 | (void) clkdm_for_each(omap_pm_clkdms_setup, NULL); |
747 | 745 | ||
748 | mpu_pwrdm = pwrdm_lookup("mpu_pwrdm"); | 746 | mpu_pwrdm = pwrdm_lookup("mpu_pwrdm"); |
749 | if (mpu_pwrdm == NULL) { | 747 | if (mpu_pwrdm == NULL) { |
750 | printk(KERN_ERR "Failed to get mpu_pwrdm\n"); | 748 | pr_err("Failed to get mpu_pwrdm\n"); |
751 | goto err2; | 749 | ret = -EINVAL; |
750 | goto err3; | ||
752 | } | 751 | } |
753 | 752 | ||
754 | neon_pwrdm = pwrdm_lookup("neon_pwrdm"); | 753 | neon_pwrdm = pwrdm_lookup("neon_pwrdm"); |
@@ -781,8 +780,8 @@ static int __init omap3_pm_init(void) | |||
781 | omap3_secure_ram_storage = | 780 | omap3_secure_ram_storage = |
782 | kmalloc(0x803F, GFP_KERNEL); | 781 | kmalloc(0x803F, GFP_KERNEL); |
783 | if (!omap3_secure_ram_storage) | 782 | if (!omap3_secure_ram_storage) |
784 | printk(KERN_ERR "Memory allocation failed when" | 783 | pr_err("Memory allocation failed when " |
785 | "allocating for secure sram context\n"); | 784 | "allocating for secure sram context\n"); |
786 | 785 | ||
787 | local_irq_disable(); | 786 | local_irq_disable(); |
788 | local_fiq_disable(); | 787 | local_fiq_disable(); |
@@ -796,14 +795,17 @@ static int __init omap3_pm_init(void) | |||
796 | } | 795 | } |
797 | 796 | ||
798 | omap3_save_scratchpad_contents(); | 797 | omap3_save_scratchpad_contents(); |
799 | err1: | ||
800 | return ret; | 798 | return ret; |
801 | err2: | 799 | |
802 | free_irq(INT_34XX_PRCM_MPU_IRQ, NULL); | 800 | err3: |
803 | list_for_each_entry_safe(pwrst, tmp, &pwrst_list, node) { | 801 | list_for_each_entry_safe(pwrst, tmp, &pwrst_list, node) { |
804 | list_del(&pwrst->node); | 802 | list_del(&pwrst->node); |
805 | kfree(pwrst); | 803 | kfree(pwrst); |
806 | } | 804 | } |
805 | free_irq(omap_prcm_event_to_irq("io"), omap3_pm_init); | ||
806 | err2: | ||
807 | free_irq(omap_prcm_event_to_irq("wkup"), NULL); | ||
808 | err1: | ||
807 | return ret; | 809 | return ret; |
808 | } | 810 | } |
809 | 811 | ||
diff --git a/arch/arm/mach-omap2/pm44xx.c b/arch/arm/mach-omap2/pm44xx.c index 9ccaadc2cf07..885625352429 100644 --- a/arch/arm/mach-omap2/pm44xx.c +++ b/arch/arm/mach-omap2/pm44xx.c | |||
@@ -144,7 +144,7 @@ static void omap_default_idle(void) | |||
144 | static int __init omap4_pm_init(void) | 144 | static int __init omap4_pm_init(void) |
145 | { | 145 | { |
146 | int ret; | 146 | int ret; |
147 | struct clockdomain *emif_clkdm, *mpuss_clkdm, *l3_1_clkdm; | 147 | struct clockdomain *emif_clkdm, *mpuss_clkdm, *l3_1_clkdm, *l4wkup; |
148 | struct clockdomain *ducati_clkdm, *l3_2_clkdm, *l4_per_clkdm; | 148 | struct clockdomain *ducati_clkdm, *l3_2_clkdm, *l4_per_clkdm; |
149 | 149 | ||
150 | if (!cpu_is_omap44xx()) | 150 | if (!cpu_is_omap44xx()) |
@@ -168,14 +168,19 @@ static int __init omap4_pm_init(void) | |||
168 | * MPUSS -> L4_PER/L3_* and DUCATI -> L3_* doesn't work as | 168 | * MPUSS -> L4_PER/L3_* and DUCATI -> L3_* doesn't work as |
169 | * expected. The hardware recommendation is to enable static | 169 | * expected. The hardware recommendation is to enable static |
170 | * dependencies for these to avoid system lock ups or random crashes. | 170 | * dependencies for these to avoid system lock ups or random crashes. |
171 | * The L4 wakeup depedency is added to workaround the OCP sync hardware | ||
172 | * BUG with 32K synctimer which lead to incorrect timer value read | ||
173 | * from the 32K counter. The BUG applies for GPTIMER1 and WDT2 which | ||
174 | * are part of L4 wakeup clockdomain. | ||
171 | */ | 175 | */ |
172 | mpuss_clkdm = clkdm_lookup("mpuss_clkdm"); | 176 | mpuss_clkdm = clkdm_lookup("mpuss_clkdm"); |
173 | emif_clkdm = clkdm_lookup("l3_emif_clkdm"); | 177 | emif_clkdm = clkdm_lookup("l3_emif_clkdm"); |
174 | l3_1_clkdm = clkdm_lookup("l3_1_clkdm"); | 178 | l3_1_clkdm = clkdm_lookup("l3_1_clkdm"); |
175 | l3_2_clkdm = clkdm_lookup("l3_2_clkdm"); | 179 | l3_2_clkdm = clkdm_lookup("l3_2_clkdm"); |
176 | l4_per_clkdm = clkdm_lookup("l4_per_clkdm"); | 180 | l4_per_clkdm = clkdm_lookup("l4_per_clkdm"); |
181 | l4wkup = clkdm_lookup("l4_wkup_clkdm"); | ||
177 | ducati_clkdm = clkdm_lookup("ducati_clkdm"); | 182 | ducati_clkdm = clkdm_lookup("ducati_clkdm"); |
178 | if ((!mpuss_clkdm) || (!emif_clkdm) || (!l3_1_clkdm) || | 183 | if ((!mpuss_clkdm) || (!emif_clkdm) || (!l3_1_clkdm) || (!l4wkup) || |
179 | (!l3_2_clkdm) || (!ducati_clkdm) || (!l4_per_clkdm)) | 184 | (!l3_2_clkdm) || (!ducati_clkdm) || (!l4_per_clkdm)) |
180 | goto err2; | 185 | goto err2; |
181 | 186 | ||
@@ -183,6 +188,7 @@ static int __init omap4_pm_init(void) | |||
183 | ret |= clkdm_add_wkdep(mpuss_clkdm, l3_1_clkdm); | 188 | ret |= clkdm_add_wkdep(mpuss_clkdm, l3_1_clkdm); |
184 | ret |= clkdm_add_wkdep(mpuss_clkdm, l3_2_clkdm); | 189 | ret |= clkdm_add_wkdep(mpuss_clkdm, l3_2_clkdm); |
185 | ret |= clkdm_add_wkdep(mpuss_clkdm, l4_per_clkdm); | 190 | ret |= clkdm_add_wkdep(mpuss_clkdm, l4_per_clkdm); |
191 | ret |= clkdm_add_wkdep(mpuss_clkdm, l4wkup); | ||
186 | ret |= clkdm_add_wkdep(ducati_clkdm, l3_1_clkdm); | 192 | ret |= clkdm_add_wkdep(ducati_clkdm, l3_1_clkdm); |
187 | ret |= clkdm_add_wkdep(ducati_clkdm, l3_2_clkdm); | 193 | ret |= clkdm_add_wkdep(ducati_clkdm, l3_2_clkdm); |
188 | if (ret) { | 194 | if (ret) { |
diff --git a/arch/arm/mach-omap2/powerdomain.c b/arch/arm/mach-omap2/powerdomain.c index 8a18d1bd61c8..96ad3dbeac34 100644 --- a/arch/arm/mach-omap2/powerdomain.c +++ b/arch/arm/mach-omap2/powerdomain.c | |||
@@ -972,7 +972,13 @@ int pwrdm_wait_transition(struct powerdomain *pwrdm) | |||
972 | 972 | ||
973 | int pwrdm_state_switch(struct powerdomain *pwrdm) | 973 | int pwrdm_state_switch(struct powerdomain *pwrdm) |
974 | { | 974 | { |
975 | return _pwrdm_state_switch(pwrdm, PWRDM_STATE_NOW); | 975 | int ret; |
976 | |||
977 | ret = pwrdm_wait_transition(pwrdm); | ||
978 | if (!ret) | ||
979 | ret = _pwrdm_state_switch(pwrdm, PWRDM_STATE_NOW); | ||
980 | |||
981 | return ret; | ||
976 | } | 982 | } |
977 | 983 | ||
978 | int pwrdm_clkdm_state_switch(struct clockdomain *clkdm) | 984 | int pwrdm_clkdm_state_switch(struct clockdomain *clkdm) |
diff --git a/arch/arm/mach-omap2/prm44xx.c b/arch/arm/mach-omap2/prm44xx.c index eac623c7c3d8..f106d21ff581 100644 --- a/arch/arm/mach-omap2/prm44xx.c +++ b/arch/arm/mach-omap2/prm44xx.c | |||
@@ -147,8 +147,9 @@ static inline u32 _read_pending_irq_reg(u16 irqen_offs, u16 irqst_offs) | |||
147 | u32 mask, st; | 147 | u32 mask, st; |
148 | 148 | ||
149 | /* XXX read mask from RAM? */ | 149 | /* XXX read mask from RAM? */ |
150 | mask = omap4_prm_read_inst_reg(OMAP4430_PRM_DEVICE_INST, irqen_offs); | 150 | mask = omap4_prm_read_inst_reg(OMAP4430_PRM_OCP_SOCKET_INST, |
151 | st = omap4_prm_read_inst_reg(OMAP4430_PRM_DEVICE_INST, irqst_offs); | 151 | irqen_offs); |
152 | st = omap4_prm_read_inst_reg(OMAP4430_PRM_OCP_SOCKET_INST, irqst_offs); | ||
152 | 153 | ||
153 | return mask & st; | 154 | return mask & st; |
154 | } | 155 | } |
@@ -180,7 +181,7 @@ void omap44xx_prm_read_pending_irqs(unsigned long *events) | |||
180 | */ | 181 | */ |
181 | void omap44xx_prm_ocp_barrier(void) | 182 | void omap44xx_prm_ocp_barrier(void) |
182 | { | 183 | { |
183 | omap4_prm_read_inst_reg(OMAP4430_PRM_DEVICE_INST, | 184 | omap4_prm_read_inst_reg(OMAP4430_PRM_OCP_SOCKET_INST, |
184 | OMAP4_REVISION_PRM_OFFSET); | 185 | OMAP4_REVISION_PRM_OFFSET); |
185 | } | 186 | } |
186 | 187 | ||
@@ -198,19 +199,19 @@ void omap44xx_prm_ocp_barrier(void) | |||
198 | void omap44xx_prm_save_and_clear_irqen(u32 *saved_mask) | 199 | void omap44xx_prm_save_and_clear_irqen(u32 *saved_mask) |
199 | { | 200 | { |
200 | saved_mask[0] = | 201 | saved_mask[0] = |
201 | omap4_prm_read_inst_reg(OMAP4430_PRM_DEVICE_INST, | 202 | omap4_prm_read_inst_reg(OMAP4430_PRM_OCP_SOCKET_INST, |
202 | OMAP4_PRM_IRQSTATUS_MPU_OFFSET); | 203 | OMAP4_PRM_IRQSTATUS_MPU_OFFSET); |
203 | saved_mask[1] = | 204 | saved_mask[1] = |
204 | omap4_prm_read_inst_reg(OMAP4430_PRM_DEVICE_INST, | 205 | omap4_prm_read_inst_reg(OMAP4430_PRM_OCP_SOCKET_INST, |
205 | OMAP4_PRM_IRQSTATUS_MPU_2_OFFSET); | 206 | OMAP4_PRM_IRQSTATUS_MPU_2_OFFSET); |
206 | 207 | ||
207 | omap4_prm_write_inst_reg(0, OMAP4430_PRM_DEVICE_INST, | 208 | omap4_prm_write_inst_reg(0, OMAP4430_PRM_OCP_SOCKET_INST, |
208 | OMAP4_PRM_IRQENABLE_MPU_OFFSET); | 209 | OMAP4_PRM_IRQENABLE_MPU_OFFSET); |
209 | omap4_prm_write_inst_reg(0, OMAP4430_PRM_DEVICE_INST, | 210 | omap4_prm_write_inst_reg(0, OMAP4430_PRM_OCP_SOCKET_INST, |
210 | OMAP4_PRM_IRQENABLE_MPU_2_OFFSET); | 211 | OMAP4_PRM_IRQENABLE_MPU_2_OFFSET); |
211 | 212 | ||
212 | /* OCP barrier */ | 213 | /* OCP barrier */ |
213 | omap4_prm_read_inst_reg(OMAP4430_PRM_DEVICE_INST, | 214 | omap4_prm_read_inst_reg(OMAP4430_PRM_OCP_SOCKET_INST, |
214 | OMAP4_REVISION_PRM_OFFSET); | 215 | OMAP4_REVISION_PRM_OFFSET); |
215 | } | 216 | } |
216 | 217 | ||
@@ -226,9 +227,9 @@ void omap44xx_prm_save_and_clear_irqen(u32 *saved_mask) | |||
226 | */ | 227 | */ |
227 | void omap44xx_prm_restore_irqen(u32 *saved_mask) | 228 | void omap44xx_prm_restore_irqen(u32 *saved_mask) |
228 | { | 229 | { |
229 | omap4_prm_write_inst_reg(saved_mask[0], OMAP4430_PRM_DEVICE_INST, | 230 | omap4_prm_write_inst_reg(saved_mask[0], OMAP4430_PRM_OCP_SOCKET_INST, |
230 | OMAP4_PRM_IRQENABLE_MPU_OFFSET); | 231 | OMAP4_PRM_IRQENABLE_MPU_OFFSET); |
231 | omap4_prm_write_inst_reg(saved_mask[1], OMAP4430_PRM_DEVICE_INST, | 232 | omap4_prm_write_inst_reg(saved_mask[1], OMAP4430_PRM_OCP_SOCKET_INST, |
232 | OMAP4_PRM_IRQENABLE_MPU_2_OFFSET); | 233 | OMAP4_PRM_IRQENABLE_MPU_2_OFFSET); |
233 | } | 234 | } |
234 | 235 | ||
diff --git a/arch/arm/mach-omap2/prm_common.c b/arch/arm/mach-omap2/prm_common.c index 873b51d494ea..d28f848897d6 100644 --- a/arch/arm/mach-omap2/prm_common.c +++ b/arch/arm/mach-omap2/prm_common.c | |||
@@ -290,7 +290,7 @@ int omap_prcm_register_chain_handler(struct omap_prcm_irq_setup *irq_setup) | |||
290 | goto err; | 290 | goto err; |
291 | } | 291 | } |
292 | 292 | ||
293 | for (i = 0; i <= irq_setup->nr_regs; i++) { | 293 | for (i = 0; i < irq_setup->nr_regs; i++) { |
294 | gc = irq_alloc_generic_chip("PRCM", 1, | 294 | gc = irq_alloc_generic_chip("PRCM", 1, |
295 | irq_setup->base_irq + i * 32, prm_base, | 295 | irq_setup->base_irq + i * 32, prm_base, |
296 | handle_level_irq); | 296 | handle_level_irq); |
diff --git a/arch/arm/mach-omap2/usb-host.c b/arch/arm/mach-omap2/usb-host.c index f51348dafafd..dde8a11f47d5 100644 --- a/arch/arm/mach-omap2/usb-host.c +++ b/arch/arm/mach-omap2/usb-host.c | |||
@@ -54,7 +54,7 @@ static struct omap_device_pm_latency omap_uhhtll_latency[] = { | |||
54 | /* | 54 | /* |
55 | * setup_ehci_io_mux - initialize IO pad mux for USBHOST | 55 | * setup_ehci_io_mux - initialize IO pad mux for USBHOST |
56 | */ | 56 | */ |
57 | static void setup_ehci_io_mux(const enum usbhs_omap_port_mode *port_mode) | 57 | static void __init setup_ehci_io_mux(const enum usbhs_omap_port_mode *port_mode) |
58 | { | 58 | { |
59 | switch (port_mode[0]) { | 59 | switch (port_mode[0]) { |
60 | case OMAP_EHCI_PORT_MODE_PHY: | 60 | case OMAP_EHCI_PORT_MODE_PHY: |
@@ -197,7 +197,8 @@ static void setup_ehci_io_mux(const enum usbhs_omap_port_mode *port_mode) | |||
197 | return; | 197 | return; |
198 | } | 198 | } |
199 | 199 | ||
200 | static void setup_4430ehci_io_mux(const enum usbhs_omap_port_mode *port_mode) | 200 | static |
201 | void __init setup_4430ehci_io_mux(const enum usbhs_omap_port_mode *port_mode) | ||
201 | { | 202 | { |
202 | switch (port_mode[0]) { | 203 | switch (port_mode[0]) { |
203 | case OMAP_EHCI_PORT_MODE_PHY: | 204 | case OMAP_EHCI_PORT_MODE_PHY: |
@@ -315,7 +316,7 @@ static void setup_4430ehci_io_mux(const enum usbhs_omap_port_mode *port_mode) | |||
315 | } | 316 | } |
316 | } | 317 | } |
317 | 318 | ||
318 | static void setup_ohci_io_mux(const enum usbhs_omap_port_mode *port_mode) | 319 | static void __init setup_ohci_io_mux(const enum usbhs_omap_port_mode *port_mode) |
319 | { | 320 | { |
320 | switch (port_mode[0]) { | 321 | switch (port_mode[0]) { |
321 | case OMAP_OHCI_PORT_MODE_PHY_6PIN_DATSE0: | 322 | case OMAP_OHCI_PORT_MODE_PHY_6PIN_DATSE0: |
@@ -412,7 +413,8 @@ static void setup_ohci_io_mux(const enum usbhs_omap_port_mode *port_mode) | |||
412 | } | 413 | } |
413 | } | 414 | } |
414 | 415 | ||
415 | static void setup_4430ohci_io_mux(const enum usbhs_omap_port_mode *port_mode) | 416 | static |
417 | void __init setup_4430ohci_io_mux(const enum usbhs_omap_port_mode *port_mode) | ||
416 | { | 418 | { |
417 | switch (port_mode[0]) { | 419 | switch (port_mode[0]) { |
418 | case OMAP_OHCI_PORT_MODE_PHY_6PIN_DATSE0: | 420 | case OMAP_OHCI_PORT_MODE_PHY_6PIN_DATSE0: |
diff --git a/arch/arm/mach-pxa/Kconfig b/arch/arm/mach-pxa/Kconfig index 109ccd2a8885..fe2d1f80ef50 100644 --- a/arch/arm/mach-pxa/Kconfig +++ b/arch/arm/mach-pxa/Kconfig | |||
@@ -113,6 +113,7 @@ config MACH_ARMCORE | |||
113 | select IWMMXT | 113 | select IWMMXT |
114 | select PXA25x | 114 | select PXA25x |
115 | select MIGHT_HAVE_PCI | 115 | select MIGHT_HAVE_PCI |
116 | select NEED_MACH_IO_H if PCI | ||
116 | 117 | ||
117 | config MACH_EM_X270 | 118 | config MACH_EM_X270 |
118 | bool "CompuLab EM-x270 platform" | 119 | bool "CompuLab EM-x270 platform" |
diff --git a/arch/arm/mach-pxa/include/mach/io.h b/arch/arm/mach-pxa/include/mach/io.h new file mode 100644 index 000000000000..cd78b7fe3567 --- /dev/null +++ b/arch/arm/mach-pxa/include/mach/io.h | |||
@@ -0,0 +1,17 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-pxa/include/mach/io.h | ||
3 | * | ||
4 | * Copied from asm/arch/sa1100/io.h | ||
5 | */ | ||
6 | #ifndef __ASM_ARM_ARCH_IO_H | ||
7 | #define __ASM_ARM_ARCH_IO_H | ||
8 | |||
9 | #define IO_SPACE_LIMIT 0xffffffff | ||
10 | |||
11 | /* | ||
12 | * We don't actually have real ISA nor PCI buses, but there is so many | ||
13 | * drivers out there that might just work if we fake them... | ||
14 | */ | ||
15 | #define __io(a) __typesafe_io(a) | ||
16 | |||
17 | #endif | ||
diff --git a/arch/arm/mach-s3c24xx/common.h b/arch/arm/mach-s3c24xx/common.h new file mode 100644 index 000000000000..c2f596e7bc2d --- /dev/null +++ b/arch/arm/mach-s3c24xx/common.h | |||
@@ -0,0 +1,18 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2012 Samsung Electronics Co., Ltd. | ||
3 | * http://www.samsung.com | ||
4 | * | ||
5 | * Common Header for S3C24XX SoCs | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License version 2 as | ||
9 | * published by the Free Software Foundation. | ||
10 | */ | ||
11 | |||
12 | #ifndef __ARCH_ARM_MACH_S3C24XX_COMMON_H | ||
13 | #define __ARCH_ARM_MACH_S3C24XX_COMMON_H __FILE__ | ||
14 | |||
15 | void s3c2410_restart(char mode, const char *cmd); | ||
16 | void s3c244x_restart(char mode, const char *cmd); | ||
17 | |||
18 | #endif /* __ARCH_ARM_MACH_S3C24XX_COMMON_H */ | ||
diff --git a/arch/arm/mach-sa1100/collie.c b/arch/arm/mach-sa1100/collie.c index 48885b7efd6b..c7f418b0cde9 100644 --- a/arch/arm/mach-sa1100/collie.c +++ b/arch/arm/mach-sa1100/collie.c | |||
@@ -313,6 +313,10 @@ static struct sa1100fb_mach_info collie_lcd_info = { | |||
313 | 313 | ||
314 | .lccr0 = LCCR0_Color | LCCR0_Sngl | LCCR0_Act, | 314 | .lccr0 = LCCR0_Color | LCCR0_Sngl | LCCR0_Act, |
315 | .lccr3 = LCCR3_OutEnH | LCCR3_PixRsEdg | LCCR3_ACBsDiv(2), | 315 | .lccr3 = LCCR3_OutEnH | LCCR3_PixRsEdg | LCCR3_ACBsDiv(2), |
316 | |||
317 | #ifdef CONFIG_BACKLIGHT_LOCOMO | ||
318 | .lcd_power = locomolcd_power | ||
319 | #endif | ||
316 | }; | 320 | }; |
317 | 321 | ||
318 | static void __init collie_init(void) | 322 | static void __init collie_init(void) |
diff --git a/arch/arm/mach-sa1100/include/mach/collie.h b/arch/arm/mach-sa1100/include/mach/collie.h index 52acda7061b7..f33679d2d3ee 100644 --- a/arch/arm/mach-sa1100/include/mach/collie.h +++ b/arch/arm/mach-sa1100/include/mach/collie.h | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * arch/arm/mach-sa1100/include/mach/collie.h | 2 | * arch/arm/mach-sa1100/include/mach/collie.h |
3 | * | 3 | * |
4 | * This file contains the hardware specific definitions for Assabet | 4 | * This file contains the hardware specific definitions for Collie |
5 | * Only include this file from SA1100-specific files. | 5 | * Only include this file from SA1100-specific files. |
6 | * | 6 | * |
7 | * ChangeLog: | 7 | * ChangeLog: |
@@ -13,6 +13,7 @@ | |||
13 | #ifndef __ASM_ARCH_COLLIE_H | 13 | #ifndef __ASM_ARCH_COLLIE_H |
14 | #define __ASM_ARCH_COLLIE_H | 14 | #define __ASM_ARCH_COLLIE_H |
15 | 15 | ||
16 | extern void locomolcd_power(int on); | ||
16 | 17 | ||
17 | #define COLLIE_SCOOP_GPIO_BASE (GPIO_MAX + 1) | 18 | #define COLLIE_SCOOP_GPIO_BASE (GPIO_MAX + 1) |
18 | #define COLLIE_GPIO_CHARGE_ON (COLLIE_SCOOP_GPIO_BASE + 0) | 19 | #define COLLIE_GPIO_CHARGE_ON (COLLIE_SCOOP_GPIO_BASE + 0) |
diff --git a/arch/arm/mach-versatile/pci.c b/arch/arm/mach-versatile/pci.c index a6e23f464528..d2268be8c34c 100644 --- a/arch/arm/mach-versatile/pci.c +++ b/arch/arm/mach-versatile/pci.c | |||
@@ -190,7 +190,7 @@ static struct resource pre_mem = { | |||
190 | .flags = IORESOURCE_MEM | IORESOURCE_PREFETCH, | 190 | .flags = IORESOURCE_MEM | IORESOURCE_PREFETCH, |
191 | }; | 191 | }; |
192 | 192 | ||
193 | static int __init pci_versatile_setup_resources(struct list_head *resources) | 193 | static int __init pci_versatile_setup_resources(struct pci_sys_data *sys) |
194 | { | 194 | { |
195 | int ret = 0; | 195 | int ret = 0; |
196 | 196 | ||
@@ -218,9 +218,9 @@ static int __init pci_versatile_setup_resources(struct list_head *resources) | |||
218 | * the mem resource for this bus | 218 | * the mem resource for this bus |
219 | * the prefetch mem resource for this bus | 219 | * the prefetch mem resource for this bus |
220 | */ | 220 | */ |
221 | pci_add_resource_offset(resources, &io_mem, sys->io_offset); | 221 | pci_add_resource_offset(&sys->resources, &io_mem, sys->io_offset); |
222 | pci_add_resource_offset(resources, &non_mem, sys->mem_offset); | 222 | pci_add_resource_offset(&sys->resources, &non_mem, sys->mem_offset); |
223 | pci_add_resource_offset(resources, &pre_mem, sys->mem_offset); | 223 | pci_add_resource_offset(&sys->resources, &pre_mem, sys->mem_offset); |
224 | 224 | ||
225 | goto out; | 225 | goto out; |
226 | 226 | ||
@@ -249,7 +249,7 @@ int __init pci_versatile_setup(int nr, struct pci_sys_data *sys) | |||
249 | 249 | ||
250 | if (nr == 0) { | 250 | if (nr == 0) { |
251 | sys->mem_offset = 0; | 251 | sys->mem_offset = 0; |
252 | ret = pci_versatile_setup_resources(&sys->resources); | 252 | ret = pci_versatile_setup_resources(sys); |
253 | if (ret < 0) { | 253 | if (ret < 0) { |
254 | printk("pci_versatile_setup: resources... oops?\n"); | 254 | printk("pci_versatile_setup: resources... oops?\n"); |
255 | goto out; | 255 | goto out; |
diff --git a/arch/arm/plat-mxc/3ds_debugboard.c b/arch/arm/plat-mxc/3ds_debugboard.c index d1e31fa1b0c3..5cac2c540f4f 100644 --- a/arch/arm/plat-mxc/3ds_debugboard.c +++ b/arch/arm/plat-mxc/3ds_debugboard.c | |||
@@ -80,7 +80,7 @@ static struct smsc911x_platform_config smsc911x_config = { | |||
80 | 80 | ||
81 | static struct platform_device smsc_lan9217_device = { | 81 | static struct platform_device smsc_lan9217_device = { |
82 | .name = "smsc911x", | 82 | .name = "smsc911x", |
83 | .id = 0, | 83 | .id = -1, |
84 | .dev = { | 84 | .dev = { |
85 | .platform_data = &smsc911x_config, | 85 | .platform_data = &smsc911x_config, |
86 | }, | 86 | }, |
diff --git a/arch/arm/plat-omap/Kconfig b/arch/arm/plat-omap/Kconfig index ce1e9b96ba1a..ad95c7a5d009 100644 --- a/arch/arm/plat-omap/Kconfig +++ b/arch/arm/plat-omap/Kconfig | |||
@@ -17,6 +17,7 @@ config ARCH_OMAP1 | |||
17 | select IRQ_DOMAIN | 17 | select IRQ_DOMAIN |
18 | select HAVE_IDE | 18 | select HAVE_IDE |
19 | select NEED_MACH_MEMORY_H | 19 | select NEED_MACH_MEMORY_H |
20 | select NEED_MACH_IO_H if PCCARD | ||
20 | help | 21 | help |
21 | "Systems based on omap7xx, omap15xx or omap16xx" | 22 | "Systems based on omap7xx, omap15xx or omap16xx" |
22 | 23 | ||
diff --git a/arch/arm/plat-omap/clock.c b/arch/arm/plat-omap/clock.c index 56b6f8b7053e..8506cbb7fea4 100644 --- a/arch/arm/plat-omap/clock.c +++ b/arch/arm/plat-omap/clock.c | |||
@@ -441,6 +441,8 @@ static int __init clk_disable_unused(void) | |||
441 | return 0; | 441 | return 0; |
442 | 442 | ||
443 | pr_info("clock: disabling unused clocks to save power\n"); | 443 | pr_info("clock: disabling unused clocks to save power\n"); |
444 | |||
445 | spin_lock_irqsave(&clockfw_lock, flags); | ||
444 | list_for_each_entry(ck, &clocks, node) { | 446 | list_for_each_entry(ck, &clocks, node) { |
445 | if (ck->ops == &clkops_null) | 447 | if (ck->ops == &clkops_null) |
446 | continue; | 448 | continue; |
@@ -448,10 +450,9 @@ static int __init clk_disable_unused(void) | |||
448 | if (ck->usecount > 0 || !ck->enable_reg) | 450 | if (ck->usecount > 0 || !ck->enable_reg) |
449 | continue; | 451 | continue; |
450 | 452 | ||
451 | spin_lock_irqsave(&clockfw_lock, flags); | ||
452 | arch_clock->clk_disable_unused(ck); | 453 | arch_clock->clk_disable_unused(ck); |
453 | spin_unlock_irqrestore(&clockfw_lock, flags); | ||
454 | } | 454 | } |
455 | spin_unlock_irqrestore(&clockfw_lock, flags); | ||
455 | 456 | ||
456 | return 0; | 457 | return 0; |
457 | } | 458 | } |
diff --git a/arch/arm/plat-omap/include/plat/omap_hwmod.h b/arch/arm/plat-omap/include/plat/omap_hwmod.h index 9e8e63d52aab..8070145ccb98 100644 --- a/arch/arm/plat-omap/include/plat/omap_hwmod.h +++ b/arch/arm/plat-omap/include/plat/omap_hwmod.h | |||
@@ -47,17 +47,17 @@ extern struct omap_hwmod_sysc_fields omap_hwmod_sysc_type2; | |||
47 | * with the original PRCM protocol defined for OMAP2420 | 47 | * with the original PRCM protocol defined for OMAP2420 |
48 | */ | 48 | */ |
49 | #define SYSC_TYPE1_MIDLEMODE_SHIFT 12 | 49 | #define SYSC_TYPE1_MIDLEMODE_SHIFT 12 |
50 | #define SYSC_TYPE1_MIDLEMODE_MASK (0x3 << SYSC_MIDLEMODE_SHIFT) | 50 | #define SYSC_TYPE1_MIDLEMODE_MASK (0x3 << SYSC_TYPE1_MIDLEMODE_SHIFT) |
51 | #define SYSC_TYPE1_CLOCKACTIVITY_SHIFT 8 | 51 | #define SYSC_TYPE1_CLOCKACTIVITY_SHIFT 8 |
52 | #define SYSC_TYPE1_CLOCKACTIVITY_MASK (0x3 << SYSC_CLOCKACTIVITY_SHIFT) | 52 | #define SYSC_TYPE1_CLOCKACTIVITY_MASK (0x3 << SYSC_TYPE1_CLOCKACTIVITY_SHIFT) |
53 | #define SYSC_TYPE1_SIDLEMODE_SHIFT 3 | 53 | #define SYSC_TYPE1_SIDLEMODE_SHIFT 3 |
54 | #define SYSC_TYPE1_SIDLEMODE_MASK (0x3 << SYSC_SIDLEMODE_SHIFT) | 54 | #define SYSC_TYPE1_SIDLEMODE_MASK (0x3 << SYSC_TYPE1_SIDLEMODE_SHIFT) |
55 | #define SYSC_TYPE1_ENAWAKEUP_SHIFT 2 | 55 | #define SYSC_TYPE1_ENAWAKEUP_SHIFT 2 |
56 | #define SYSC_TYPE1_ENAWAKEUP_MASK (1 << SYSC_ENAWAKEUP_SHIFT) | 56 | #define SYSC_TYPE1_ENAWAKEUP_MASK (1 << SYSC_TYPE1_ENAWAKEUP_SHIFT) |
57 | #define SYSC_TYPE1_SOFTRESET_SHIFT 1 | 57 | #define SYSC_TYPE1_SOFTRESET_SHIFT 1 |
58 | #define SYSC_TYPE1_SOFTRESET_MASK (1 << SYSC_SOFTRESET_SHIFT) | 58 | #define SYSC_TYPE1_SOFTRESET_MASK (1 << SYSC_TYPE1_SOFTRESET_SHIFT) |
59 | #define SYSC_TYPE1_AUTOIDLE_SHIFT 0 | 59 | #define SYSC_TYPE1_AUTOIDLE_SHIFT 0 |
60 | #define SYSC_TYPE1_AUTOIDLE_MASK (1 << SYSC_AUTOIDLE_SHIFT) | 60 | #define SYSC_TYPE1_AUTOIDLE_MASK (1 << SYSC_TYPE1_AUTOIDLE_SHIFT) |
61 | 61 | ||
62 | /* | 62 | /* |
63 | * OCP SYSCONFIG bit shifts/masks TYPE2. These are for IPs compliant | 63 | * OCP SYSCONFIG bit shifts/masks TYPE2. These are for IPs compliant |
diff --git a/arch/avr32/include/asm/barrier.h b/arch/avr32/include/asm/barrier.h index 808001c9cf8c..0961275373db 100644 --- a/arch/avr32/include/asm/barrier.h +++ b/arch/avr32/include/asm/barrier.h | |||
@@ -8,6 +8,8 @@ | |||
8 | #ifndef __ASM_AVR32_BARRIER_H | 8 | #ifndef __ASM_AVR32_BARRIER_H |
9 | #define __ASM_AVR32_BARRIER_H | 9 | #define __ASM_AVR32_BARRIER_H |
10 | 10 | ||
11 | #define nop() asm volatile("nop") | ||
12 | |||
11 | #define mb() asm volatile("" : : : "memory") | 13 | #define mb() asm volatile("" : : : "memory") |
12 | #define rmb() mb() | 14 | #define rmb() mb() |
13 | #define wmb() asm volatile("sync 0" : : : "memory") | 15 | #define wmb() asm volatile("sync 0" : : : "memory") |
diff --git a/arch/avr32/include/asm/special_insns.h b/arch/avr32/include/asm/special_insns.h deleted file mode 100644 index f922218dfaa5..000000000000 --- a/arch/avr32/include/asm/special_insns.h +++ /dev/null | |||
@@ -1,13 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2004-2006 Atmel Corporation | ||
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 | #ifndef __ASM_AVR32_SPECIAL_INSNS_H | ||
9 | #define __ASM_AVR32_SPECIAL_INSNS_H | ||
10 | |||
11 | #define nop() asm volatile("nop") | ||
12 | |||
13 | #endif /* __ASM_AVR32_SPECIAL_INSNS_H */ | ||
diff --git a/arch/avr32/mach-at32ap/include/mach/board.h b/arch/avr32/mach-at32ap/include/mach/board.h index 71733866cb4f..70742ec997f8 100644 --- a/arch/avr32/mach-at32ap/include/mach/board.h +++ b/arch/avr32/mach-at32ap/include/mach/board.h | |||
@@ -7,7 +7,7 @@ | |||
7 | #include <linux/types.h> | 7 | #include <linux/types.h> |
8 | #include <linux/serial.h> | 8 | #include <linux/serial.h> |
9 | #include <linux/platform_data/macb.h> | 9 | #include <linux/platform_data/macb.h> |
10 | #include <linux/platform_data/atmel_nand.h> | 10 | #include <linux/platform_data/atmel.h> |
11 | 11 | ||
12 | #define GPIO_PIN_NONE (-1) | 12 | #define GPIO_PIN_NONE (-1) |
13 | 13 | ||
diff --git a/arch/blackfin/Kconfig b/arch/blackfin/Kconfig index c1269a1085e1..373a6902d8fa 100644 --- a/arch/blackfin/Kconfig +++ b/arch/blackfin/Kconfig | |||
@@ -823,7 +823,7 @@ config CACHELINE_ALIGNED_L1 | |||
823 | bool "Locate cacheline_aligned data to L1 Data Memory" | 823 | bool "Locate cacheline_aligned data to L1 Data Memory" |
824 | default y if !BF54x | 824 | default y if !BF54x |
825 | default n if BF54x | 825 | default n if BF54x |
826 | depends on !SMP && !BF531 | 826 | depends on !SMP && !BF531 && !CRC32 |
827 | help | 827 | help |
828 | If enabled, cacheline_aligned data is linked | 828 | If enabled, cacheline_aligned data is linked |
829 | into L1 data memory. (less latency) | 829 | into L1 data memory. (less latency) |
diff --git a/arch/blackfin/configs/BF527-EZKIT_defconfig b/arch/blackfin/configs/BF527-EZKIT_defconfig index 9ccc18a6b4df..90b175323644 100644 --- a/arch/blackfin/configs/BF527-EZKIT_defconfig +++ b/arch/blackfin/configs/BF527-EZKIT_defconfig | |||
@@ -147,6 +147,7 @@ CONFIG_USB_OTG_BLACKLIST_HUB=y | |||
147 | CONFIG_USB_MON=y | 147 | CONFIG_USB_MON=y |
148 | CONFIG_USB_MUSB_HDRC=y | 148 | CONFIG_USB_MUSB_HDRC=y |
149 | CONFIG_USB_MUSB_BLACKFIN=y | 149 | CONFIG_USB_MUSB_BLACKFIN=y |
150 | CONFIG_MUSB_PIO_ONLY=y | ||
150 | CONFIG_USB_STORAGE=y | 151 | CONFIG_USB_STORAGE=y |
151 | CONFIG_USB_GADGET=y | 152 | CONFIG_USB_GADGET=y |
152 | CONFIG_RTC_CLASS=y | 153 | CONFIG_RTC_CLASS=y |
diff --git a/arch/blackfin/include/asm/cmpxchg.h b/arch/blackfin/include/asm/cmpxchg.h index ba2484f4cb2a..c05868cc61c1 100644 --- a/arch/blackfin/include/asm/cmpxchg.h +++ b/arch/blackfin/include/asm/cmpxchg.h | |||
@@ -122,7 +122,8 @@ static inline unsigned long __xchg(unsigned long x, volatile void *ptr, | |||
122 | (unsigned long)(n), sizeof(*(ptr)))) | 122 | (unsigned long)(n), sizeof(*(ptr)))) |
123 | #define cmpxchg64_local(ptr, o, n) __cmpxchg64_local_generic((ptr), (o), (n)) | 123 | #define cmpxchg64_local(ptr, o, n) __cmpxchg64_local_generic((ptr), (o), (n)) |
124 | 124 | ||
125 | #include <asm-generic/cmpxchg.h> | 125 | #define cmpxchg(ptr, o, n) cmpxchg_local((ptr), (o), (n)) |
126 | #define cmpxchg64(ptr, o, n) cmpxchg64_local((ptr), (o), (n)) | ||
126 | 127 | ||
127 | #endif /* !CONFIG_SMP */ | 128 | #endif /* !CONFIG_SMP */ |
128 | 129 | ||
diff --git a/arch/blackfin/include/asm/gpio.h b/arch/blackfin/include/asm/gpio.h index 5a25856381ff..12d3571b5232 100644 --- a/arch/blackfin/include/asm/gpio.h +++ b/arch/blackfin/include/asm/gpio.h | |||
@@ -244,16 +244,26 @@ static inline int gpio_set_debounce(unsigned gpio, unsigned debounce) | |||
244 | return -EINVAL; | 244 | return -EINVAL; |
245 | } | 245 | } |
246 | 246 | ||
247 | static inline int gpio_get_value(unsigned gpio) | 247 | static inline int __gpio_get_value(unsigned gpio) |
248 | { | 248 | { |
249 | return bfin_gpio_get_value(gpio); | 249 | return bfin_gpio_get_value(gpio); |
250 | } | 250 | } |
251 | 251 | ||
252 | static inline void gpio_set_value(unsigned gpio, int value) | 252 | static inline void __gpio_set_value(unsigned gpio, int value) |
253 | { | 253 | { |
254 | return bfin_gpio_set_value(gpio, value); | 254 | return bfin_gpio_set_value(gpio, value); |
255 | } | 255 | } |
256 | 256 | ||
257 | static inline int gpio_get_value(unsigned gpio) | ||
258 | { | ||
259 | return __gpio_get_value(gpio); | ||
260 | } | ||
261 | |||
262 | static inline void gpio_set_value(unsigned gpio, int value) | ||
263 | { | ||
264 | return __gpio_set_value(gpio, value); | ||
265 | } | ||
266 | |||
257 | static inline int gpio_to_irq(unsigned gpio) | 267 | static inline int gpio_to_irq(unsigned gpio) |
258 | { | 268 | { |
259 | if (likely(gpio < MAX_BLACKFIN_GPIOS)) | 269 | if (likely(gpio < MAX_BLACKFIN_GPIOS)) |
diff --git a/arch/c6x/kernel/signal.c b/arch/c6x/kernel/signal.c index 304f675826e9..3b5a05099989 100644 --- a/arch/c6x/kernel/signal.c +++ b/arch/c6x/kernel/signal.c | |||
@@ -85,10 +85,7 @@ asmlinkage int do_rt_sigreturn(struct pt_regs *regs) | |||
85 | goto badframe; | 85 | goto badframe; |
86 | 86 | ||
87 | sigdelsetmask(&set, ~_BLOCKABLE); | 87 | sigdelsetmask(&set, ~_BLOCKABLE); |
88 | spin_lock_irq(¤t->sighand->siglock); | 88 | set_current_blocked(&set); |
89 | current->blocked = set; | ||
90 | recalc_sigpending(); | ||
91 | spin_unlock_irq(¤t->sighand->siglock); | ||
92 | 89 | ||
93 | if (restore_sigcontext(regs, &frame->uc.uc_mcontext)) | 90 | if (restore_sigcontext(regs, &frame->uc.uc_mcontext)) |
94 | goto badframe; | 91 | goto badframe; |
@@ -279,15 +276,8 @@ static int handle_signal(int sig, | |||
279 | 276 | ||
280 | /* Set up the stack frame */ | 277 | /* Set up the stack frame */ |
281 | ret = setup_rt_frame(sig, ka, info, oldset, regs); | 278 | ret = setup_rt_frame(sig, ka, info, oldset, regs); |
282 | if (ret == 0) { | 279 | if (ret == 0) |
283 | spin_lock_irq(¤t->sighand->siglock); | 280 | block_sigmask(ka, sig); |
284 | sigorsets(¤t->blocked, ¤t->blocked, | ||
285 | &ka->sa.sa_mask); | ||
286 | if (!(ka->sa.sa_flags & SA_NODEFER)) | ||
287 | sigaddset(¤t->blocked, sig); | ||
288 | recalc_sigpending(); | ||
289 | spin_unlock_irq(¤t->sighand->siglock); | ||
290 | } | ||
291 | 281 | ||
292 | return ret; | 282 | return ret; |
293 | } | 283 | } |
diff --git a/arch/frv/mb93090-mb00/pci-dma.c b/arch/frv/mb93090-mb00/pci-dma.c index 41098a3803a2..4f8d8bcdc7de 100644 --- a/arch/frv/mb93090-mb00/pci-dma.c +++ b/arch/frv/mb93090-mb00/pci-dma.c | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <linux/dma-mapping.h> | 13 | #include <linux/dma-mapping.h> |
14 | #include <linux/list.h> | 14 | #include <linux/list.h> |
15 | #include <linux/pci.h> | 15 | #include <linux/pci.h> |
16 | #include <linux/export.h> | ||
16 | #include <linux/highmem.h> | 17 | #include <linux/highmem.h> |
17 | #include <linux/scatterlist.h> | 18 | #include <linux/scatterlist.h> |
18 | #include <asm/io.h> | 19 | #include <asm/io.h> |
diff --git a/arch/hexagon/include/asm/dma-mapping.h b/arch/hexagon/include/asm/dma-mapping.h index 448b224ba4ef..233ed3d2d25e 100644 --- a/arch/hexagon/include/asm/dma-mapping.h +++ b/arch/hexagon/include/asm/dma-mapping.h | |||
@@ -71,29 +71,35 @@ static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr) | |||
71 | return (dma_addr == bad_dma_address); | 71 | return (dma_addr == bad_dma_address); |
72 | } | 72 | } |
73 | 73 | ||
74 | static inline void *dma_alloc_coherent(struct device *dev, size_t size, | 74 | #define dma_alloc_coherent(d,s,h,f) dma_alloc_attrs(d,s,h,f,NULL) |
75 | dma_addr_t *dma_handle, gfp_t flag) | 75 | |
76 | static inline void *dma_alloc_attrs(struct device *dev, size_t size, | ||
77 | dma_addr_t *dma_handle, gfp_t flag, | ||
78 | struct dma_attrs *attrs) | ||
76 | { | 79 | { |
77 | void *ret; | 80 | void *ret; |
78 | struct dma_map_ops *ops = get_dma_ops(dev); | 81 | struct dma_map_ops *ops = get_dma_ops(dev); |
79 | 82 | ||
80 | BUG_ON(!dma_ops); | 83 | BUG_ON(!dma_ops); |
81 | 84 | ||
82 | ret = ops->alloc_coherent(dev, size, dma_handle, flag); | 85 | ret = ops->alloc(dev, size, dma_handle, flag, attrs); |
83 | 86 | ||
84 | debug_dma_alloc_coherent(dev, size, *dma_handle, ret); | 87 | debug_dma_alloc_coherent(dev, size, *dma_handle, ret); |
85 | 88 | ||
86 | return ret; | 89 | return ret; |
87 | } | 90 | } |
88 | 91 | ||
89 | static inline void dma_free_coherent(struct device *dev, size_t size, | 92 | #define dma_free_coherent(d,s,c,h) dma_free_attrs(d,s,c,h,NULL) |
90 | void *cpu_addr, dma_addr_t dma_handle) | 93 | |
94 | static inline void dma_free_attrs(struct device *dev, size_t size, | ||
95 | void *cpu_addr, dma_addr_t dma_handle, | ||
96 | struct dma_attrs *attrs) | ||
91 | { | 97 | { |
92 | struct dma_map_ops *dma_ops = get_dma_ops(dev); | 98 | struct dma_map_ops *dma_ops = get_dma_ops(dev); |
93 | 99 | ||
94 | BUG_ON(!dma_ops); | 100 | BUG_ON(!dma_ops); |
95 | 101 | ||
96 | dma_ops->free_coherent(dev, size, cpu_addr, dma_handle); | 102 | dma_ops->free(dev, size, cpu_addr, dma_handle, attrs); |
97 | 103 | ||
98 | debug_dma_free_coherent(dev, size, cpu_addr, dma_handle); | 104 | debug_dma_free_coherent(dev, size, cpu_addr, dma_handle); |
99 | } | 105 | } |
diff --git a/arch/hexagon/kernel/dma.c b/arch/hexagon/kernel/dma.c index e711ace62fdf..37302218ca4a 100644 --- a/arch/hexagon/kernel/dma.c +++ b/arch/hexagon/kernel/dma.c | |||
@@ -54,7 +54,8 @@ static struct gen_pool *coherent_pool; | |||
54 | /* Allocates from a pool of uncached memory that was reserved at boot time */ | 54 | /* Allocates from a pool of uncached memory that was reserved at boot time */ |
55 | 55 | ||
56 | void *hexagon_dma_alloc_coherent(struct device *dev, size_t size, | 56 | void *hexagon_dma_alloc_coherent(struct device *dev, size_t size, |
57 | dma_addr_t *dma_addr, gfp_t flag) | 57 | dma_addr_t *dma_addr, gfp_t flag, |
58 | struct dma_attrs *attrs) | ||
58 | { | 59 | { |
59 | void *ret; | 60 | void *ret; |
60 | 61 | ||
@@ -81,7 +82,7 @@ void *hexagon_dma_alloc_coherent(struct device *dev, size_t size, | |||
81 | } | 82 | } |
82 | 83 | ||
83 | static void hexagon_free_coherent(struct device *dev, size_t size, void *vaddr, | 84 | static void hexagon_free_coherent(struct device *dev, size_t size, void *vaddr, |
84 | dma_addr_t dma_addr) | 85 | dma_addr_t dma_addr, struct dma_attrs *attrs) |
85 | { | 86 | { |
86 | gen_pool_free(coherent_pool, (unsigned long) vaddr, size); | 87 | gen_pool_free(coherent_pool, (unsigned long) vaddr, size); |
87 | } | 88 | } |
@@ -202,8 +203,8 @@ static void hexagon_sync_single_for_device(struct device *dev, | |||
202 | } | 203 | } |
203 | 204 | ||
204 | struct dma_map_ops hexagon_dma_ops = { | 205 | struct dma_map_ops hexagon_dma_ops = { |
205 | .alloc_coherent = hexagon_dma_alloc_coherent, | 206 | .alloc = hexagon_dma_alloc_coherent, |
206 | .free_coherent = hexagon_free_coherent, | 207 | .free = hexagon_free_coherent, |
207 | .map_sg = hexagon_map_sg, | 208 | .map_sg = hexagon_map_sg, |
208 | .map_page = hexagon_map_page, | 209 | .map_page = hexagon_map_page, |
209 | .sync_single_for_cpu = hexagon_sync_single_for_cpu, | 210 | .sync_single_for_cpu = hexagon_sync_single_for_cpu, |
diff --git a/arch/hexagon/kernel/smp.c b/arch/hexagon/kernel/smp.c index 15d1fd22bbc5..9b44a9e2d05a 100644 --- a/arch/hexagon/kernel/smp.c +++ b/arch/hexagon/kernel/smp.c | |||
@@ -35,7 +35,7 @@ | |||
35 | #define BASE_IPI_IRQ 26 | 35 | #define BASE_IPI_IRQ 26 |
36 | 36 | ||
37 | /* | 37 | /* |
38 | * cpu_possible_map needs to be filled out prior to setup_per_cpu_areas | 38 | * cpu_possible_mask needs to be filled out prior to setup_per_cpu_areas |
39 | * (which is prior to any of our smp_prepare_cpu crap), in order to set | 39 | * (which is prior to any of our smp_prepare_cpu crap), in order to set |
40 | * up the... per_cpu areas. | 40 | * up the... per_cpu areas. |
41 | */ | 41 | */ |
@@ -208,7 +208,7 @@ int __cpuinit __cpu_up(unsigned int cpu) | |||
208 | stack_start = ((void *) thread) + THREAD_SIZE; | 208 | stack_start = ((void *) thread) + THREAD_SIZE; |
209 | __vmstart(start_secondary, stack_start); | 209 | __vmstart(start_secondary, stack_start); |
210 | 210 | ||
211 | while (!cpu_isset(cpu, cpu_online_map)) | 211 | while (!cpu_online(cpu)) |
212 | barrier(); | 212 | barrier(); |
213 | 213 | ||
214 | return 0; | 214 | return 0; |
@@ -229,7 +229,7 @@ void __init smp_prepare_cpus(unsigned int max_cpus) | |||
229 | 229 | ||
230 | /* Right now, let's just fake it. */ | 230 | /* Right now, let's just fake it. */ |
231 | for (i = 0; i < max_cpus; i++) | 231 | for (i = 0; i < max_cpus; i++) |
232 | cpu_set(i, cpu_present_map); | 232 | set_cpu_present(i, true); |
233 | 233 | ||
234 | /* Also need to register the interrupts for IPI */ | 234 | /* Also need to register the interrupts for IPI */ |
235 | if (max_cpus > 1) | 235 | if (max_cpus > 1) |
@@ -269,5 +269,5 @@ void smp_start_cpus(void) | |||
269 | int i; | 269 | int i; |
270 | 270 | ||
271 | for (i = 0; i < NR_CPUS; i++) | 271 | for (i = 0; i < NR_CPUS; i++) |
272 | cpu_set(i, cpu_possible_map); | 272 | set_cpu_possible(i, true); |
273 | } | 273 | } |
diff --git a/arch/ia64/hp/common/sba_iommu.c b/arch/ia64/hp/common/sba_iommu.c index f6ea3a3b4a84..bcda5b2d121a 100644 --- a/arch/ia64/hp/common/sba_iommu.c +++ b/arch/ia64/hp/common/sba_iommu.c | |||
@@ -1129,7 +1129,8 @@ void sba_unmap_single_attrs(struct device *dev, dma_addr_t iova, size_t size, | |||
1129 | * See Documentation/DMA-API-HOWTO.txt | 1129 | * See Documentation/DMA-API-HOWTO.txt |
1130 | */ | 1130 | */ |
1131 | static void * | 1131 | static void * |
1132 | sba_alloc_coherent (struct device *dev, size_t size, dma_addr_t *dma_handle, gfp_t flags) | 1132 | sba_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle, |
1133 | gfp_t flags, struct dma_attrs *attrs) | ||
1133 | { | 1134 | { |
1134 | struct ioc *ioc; | 1135 | struct ioc *ioc; |
1135 | void *addr; | 1136 | void *addr; |
@@ -1191,8 +1192,8 @@ sba_alloc_coherent (struct device *dev, size_t size, dma_addr_t *dma_handle, gfp | |||
1191 | * | 1192 | * |
1192 | * See Documentation/DMA-API-HOWTO.txt | 1193 | * See Documentation/DMA-API-HOWTO.txt |
1193 | */ | 1194 | */ |
1194 | static void sba_free_coherent (struct device *dev, size_t size, void *vaddr, | 1195 | static void sba_free_coherent(struct device *dev, size_t size, void *vaddr, |
1195 | dma_addr_t dma_handle) | 1196 | dma_addr_t dma_handle, struct dma_attrs *attrs) |
1196 | { | 1197 | { |
1197 | sba_unmap_single_attrs(dev, dma_handle, size, 0, NULL); | 1198 | sba_unmap_single_attrs(dev, dma_handle, size, 0, NULL); |
1198 | free_pages((unsigned long) vaddr, get_order(size)); | 1199 | free_pages((unsigned long) vaddr, get_order(size)); |
@@ -2212,8 +2213,8 @@ sba_page_override(char *str) | |||
2212 | __setup("sbapagesize=",sba_page_override); | 2213 | __setup("sbapagesize=",sba_page_override); |
2213 | 2214 | ||
2214 | struct dma_map_ops sba_dma_ops = { | 2215 | struct dma_map_ops sba_dma_ops = { |
2215 | .alloc_coherent = sba_alloc_coherent, | 2216 | .alloc = sba_alloc_coherent, |
2216 | .free_coherent = sba_free_coherent, | 2217 | .free = sba_free_coherent, |
2217 | .map_page = sba_map_page, | 2218 | .map_page = sba_map_page, |
2218 | .unmap_page = sba_unmap_page, | 2219 | .unmap_page = sba_unmap_page, |
2219 | .map_sg = sba_map_sg_attrs, | 2220 | .map_sg = sba_map_sg_attrs, |
diff --git a/arch/ia64/include/asm/dma-mapping.h b/arch/ia64/include/asm/dma-mapping.h index 4336d080b241..4f5e8148440d 100644 --- a/arch/ia64/include/asm/dma-mapping.h +++ b/arch/ia64/include/asm/dma-mapping.h | |||
@@ -23,23 +23,29 @@ extern void machvec_dma_sync_single(struct device *, dma_addr_t, size_t, | |||
23 | extern void machvec_dma_sync_sg(struct device *, struct scatterlist *, int, | 23 | extern void machvec_dma_sync_sg(struct device *, struct scatterlist *, int, |
24 | enum dma_data_direction); | 24 | enum dma_data_direction); |
25 | 25 | ||
26 | static inline void *dma_alloc_coherent(struct device *dev, size_t size, | 26 | #define dma_alloc_coherent(d,s,h,f) dma_alloc_attrs(d,s,h,f,NULL) |
27 | dma_addr_t *daddr, gfp_t gfp) | 27 | |
28 | static inline void *dma_alloc_attrs(struct device *dev, size_t size, | ||
29 | dma_addr_t *daddr, gfp_t gfp, | ||
30 | struct dma_attrs *attrs) | ||
28 | { | 31 | { |
29 | struct dma_map_ops *ops = platform_dma_get_ops(dev); | 32 | struct dma_map_ops *ops = platform_dma_get_ops(dev); |
30 | void *caddr; | 33 | void *caddr; |
31 | 34 | ||
32 | caddr = ops->alloc_coherent(dev, size, daddr, gfp); | 35 | caddr = ops->alloc(dev, size, daddr, gfp, attrs); |
33 | debug_dma_alloc_coherent(dev, size, *daddr, caddr); | 36 | debug_dma_alloc_coherent(dev, size, *daddr, caddr); |
34 | return caddr; | 37 | return caddr; |
35 | } | 38 | } |
36 | 39 | ||
37 | static inline void dma_free_coherent(struct device *dev, size_t size, | 40 | #define dma_free_coherent(d,s,c,h) dma_free_attrs(d,s,c,h,NULL) |
38 | void *caddr, dma_addr_t daddr) | 41 | |
42 | static inline void dma_free_attrs(struct device *dev, size_t size, | ||
43 | void *caddr, dma_addr_t daddr, | ||
44 | struct dma_attrs *attrs) | ||
39 | { | 45 | { |
40 | struct dma_map_ops *ops = platform_dma_get_ops(dev); | 46 | struct dma_map_ops *ops = platform_dma_get_ops(dev); |
41 | debug_dma_free_coherent(dev, size, caddr, daddr); | 47 | debug_dma_free_coherent(dev, size, caddr, daddr); |
42 | ops->free_coherent(dev, size, caddr, daddr); | 48 | ops->free(dev, size, caddr, daddr, attrs); |
43 | } | 49 | } |
44 | 50 | ||
45 | #define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f) | 51 | #define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f) |
diff --git a/arch/ia64/kernel/acpi.c b/arch/ia64/kernel/acpi.c index ac795d311f44..6f38b6120d96 100644 --- a/arch/ia64/kernel/acpi.c +++ b/arch/ia64/kernel/acpi.c | |||
@@ -839,7 +839,7 @@ static __init int setup_additional_cpus(char *s) | |||
839 | early_param("additional_cpus", setup_additional_cpus); | 839 | early_param("additional_cpus", setup_additional_cpus); |
840 | 840 | ||
841 | /* | 841 | /* |
842 | * cpu_possible_map should be static, it cannot change as CPUs | 842 | * cpu_possible_mask should be static, it cannot change as CPUs |
843 | * are onlined, or offlined. The reason is per-cpu data-structures | 843 | * are onlined, or offlined. The reason is per-cpu data-structures |
844 | * are allocated by some modules at init time, and dont expect to | 844 | * are allocated by some modules at init time, and dont expect to |
845 | * do this dynamically on cpu arrival/departure. | 845 | * do this dynamically on cpu arrival/departure. |
diff --git a/arch/ia64/kernel/pci-swiotlb.c b/arch/ia64/kernel/pci-swiotlb.c index d9485d952ed0..939260aeac98 100644 --- a/arch/ia64/kernel/pci-swiotlb.c +++ b/arch/ia64/kernel/pci-swiotlb.c | |||
@@ -15,16 +15,24 @@ int swiotlb __read_mostly; | |||
15 | EXPORT_SYMBOL(swiotlb); | 15 | EXPORT_SYMBOL(swiotlb); |
16 | 16 | ||
17 | static void *ia64_swiotlb_alloc_coherent(struct device *dev, size_t size, | 17 | static void *ia64_swiotlb_alloc_coherent(struct device *dev, size_t size, |
18 | dma_addr_t *dma_handle, gfp_t gfp) | 18 | dma_addr_t *dma_handle, gfp_t gfp, |
19 | struct dma_attrs *attrs) | ||
19 | { | 20 | { |
20 | if (dev->coherent_dma_mask != DMA_BIT_MASK(64)) | 21 | if (dev->coherent_dma_mask != DMA_BIT_MASK(64)) |
21 | gfp |= GFP_DMA; | 22 | gfp |= GFP_DMA; |
22 | return swiotlb_alloc_coherent(dev, size, dma_handle, gfp); | 23 | return swiotlb_alloc_coherent(dev, size, dma_handle, gfp); |
23 | } | 24 | } |
24 | 25 | ||
26 | static void ia64_swiotlb_free_coherent(struct device *dev, size_t size, | ||
27 | void *vaddr, dma_addr_t dma_addr, | ||
28 | struct dma_attrs *attrs) | ||
29 | { | ||
30 | swiotlb_free_coherent(dev, size, vaddr, dma_addr); | ||
31 | } | ||
32 | |||
25 | struct dma_map_ops swiotlb_dma_ops = { | 33 | struct dma_map_ops swiotlb_dma_ops = { |
26 | .alloc_coherent = ia64_swiotlb_alloc_coherent, | 34 | .alloc = ia64_swiotlb_alloc_coherent, |
27 | .free_coherent = swiotlb_free_coherent, | 35 | .free = ia64_swiotlb_free_coherent, |
28 | .map_page = swiotlb_map_page, | 36 | .map_page = swiotlb_map_page, |
29 | .unmap_page = swiotlb_unmap_page, | 37 | .unmap_page = swiotlb_unmap_page, |
30 | .map_sg = swiotlb_map_sg_attrs, | 38 | .map_sg = swiotlb_map_sg_attrs, |
diff --git a/arch/ia64/sn/pci/pci_dma.c b/arch/ia64/sn/pci/pci_dma.c index a9d310de57da..3290d6e00c31 100644 --- a/arch/ia64/sn/pci/pci_dma.c +++ b/arch/ia64/sn/pci/pci_dma.c | |||
@@ -76,7 +76,8 @@ EXPORT_SYMBOL(sn_dma_set_mask); | |||
76 | * more information. | 76 | * more information. |
77 | */ | 77 | */ |
78 | static void *sn_dma_alloc_coherent(struct device *dev, size_t size, | 78 | static void *sn_dma_alloc_coherent(struct device *dev, size_t size, |
79 | dma_addr_t * dma_handle, gfp_t flags) | 79 | dma_addr_t * dma_handle, gfp_t flags, |
80 | struct dma_attrs *attrs) | ||
80 | { | 81 | { |
81 | void *cpuaddr; | 82 | void *cpuaddr; |
82 | unsigned long phys_addr; | 83 | unsigned long phys_addr; |
@@ -137,7 +138,7 @@ static void *sn_dma_alloc_coherent(struct device *dev, size_t size, | |||
137 | * any associated IOMMU mappings. | 138 | * any associated IOMMU mappings. |
138 | */ | 139 | */ |
139 | static void sn_dma_free_coherent(struct device *dev, size_t size, void *cpu_addr, | 140 | static void sn_dma_free_coherent(struct device *dev, size_t size, void *cpu_addr, |
140 | dma_addr_t dma_handle) | 141 | dma_addr_t dma_handle, struct dma_attrs *attrs) |
141 | { | 142 | { |
142 | struct pci_dev *pdev = to_pci_dev(dev); | 143 | struct pci_dev *pdev = to_pci_dev(dev); |
143 | struct sn_pcibus_provider *provider = SN_PCIDEV_BUSPROVIDER(pdev); | 144 | struct sn_pcibus_provider *provider = SN_PCIDEV_BUSPROVIDER(pdev); |
@@ -466,8 +467,8 @@ int sn_pci_legacy_write(struct pci_bus *bus, u16 port, u32 val, u8 size) | |||
466 | } | 467 | } |
467 | 468 | ||
468 | static struct dma_map_ops sn_dma_ops = { | 469 | static struct dma_map_ops sn_dma_ops = { |
469 | .alloc_coherent = sn_dma_alloc_coherent, | 470 | .alloc = sn_dma_alloc_coherent, |
470 | .free_coherent = sn_dma_free_coherent, | 471 | .free = sn_dma_free_coherent, |
471 | .map_page = sn_dma_map_page, | 472 | .map_page = sn_dma_map_page, |
472 | .unmap_page = sn_dma_unmap_page, | 473 | .unmap_page = sn_dma_unmap_page, |
473 | .map_sg = sn_dma_map_sg, | 474 | .map_sg = sn_dma_map_sg, |
diff --git a/arch/m68k/include/asm/atomic.h b/arch/m68k/include/asm/atomic.h index 336e6173794f..f4e32de263a7 100644 --- a/arch/m68k/include/asm/atomic.h +++ b/arch/m68k/include/asm/atomic.h | |||
@@ -3,6 +3,7 @@ | |||
3 | 3 | ||
4 | #include <linux/types.h> | 4 | #include <linux/types.h> |
5 | #include <linux/irqflags.h> | 5 | #include <linux/irqflags.h> |
6 | #include <asm/cmpxchg.h> | ||
6 | 7 | ||
7 | /* | 8 | /* |
8 | * Atomic operations that C can't guarantee us. Useful for | 9 | * Atomic operations that C can't guarantee us. Useful for |
diff --git a/arch/m68k/mac/config.c b/arch/m68k/mac/config.c index 96fa6ed7e799..d9f62e0f46c0 100644 --- a/arch/m68k/mac/config.c +++ b/arch/m68k/mac/config.c | |||
@@ -980,6 +980,9 @@ int __init mac_platform_init(void) | |||
980 | { | 980 | { |
981 | u8 *swim_base; | 981 | u8 *swim_base; |
982 | 982 | ||
983 | if (!MACH_IS_MAC) | ||
984 | return -ENODEV; | ||
985 | |||
983 | /* | 986 | /* |
984 | * Serial devices | 987 | * Serial devices |
985 | */ | 988 | */ |
diff --git a/arch/m68k/q40/config.c b/arch/m68k/q40/config.c index 512adb64f7dd..8a1ce327c963 100644 --- a/arch/m68k/q40/config.c +++ b/arch/m68k/q40/config.c | |||
@@ -334,6 +334,9 @@ static __init int q40_add_kbd_device(void) | |||
334 | { | 334 | { |
335 | struct platform_device *pdev; | 335 | struct platform_device *pdev; |
336 | 336 | ||
337 | if (!MACH_IS_Q40) | ||
338 | return -ENODEV; | ||
339 | |||
337 | pdev = platform_device_register_simple("q40kbd", -1, NULL, 0); | 340 | pdev = platform_device_register_simple("q40kbd", -1, NULL, 0); |
338 | if (IS_ERR(pdev)) | 341 | if (IS_ERR(pdev)) |
339 | return PTR_ERR(pdev); | 342 | return PTR_ERR(pdev); |
diff --git a/arch/microblaze/include/asm/cmpxchg.h b/arch/microblaze/include/asm/cmpxchg.h index 0094859abd9b..538afc0ab9f3 100644 --- a/arch/microblaze/include/asm/cmpxchg.h +++ b/arch/microblaze/include/asm/cmpxchg.h | |||
@@ -1,6 +1,8 @@ | |||
1 | #ifndef _ASM_MICROBLAZE_CMPXCHG_H | 1 | #ifndef _ASM_MICROBLAZE_CMPXCHG_H |
2 | #define _ASM_MICROBLAZE_CMPXCHG_H | 2 | #define _ASM_MICROBLAZE_CMPXCHG_H |
3 | 3 | ||
4 | #include <linux/irqflags.h> | ||
5 | |||
4 | void __bad_xchg(volatile void *ptr, int size); | 6 | void __bad_xchg(volatile void *ptr, int size); |
5 | 7 | ||
6 | static inline unsigned long __xchg(unsigned long x, volatile void *ptr, | 8 | static inline unsigned long __xchg(unsigned long x, volatile void *ptr, |
diff --git a/arch/microblaze/include/asm/dma-mapping.h b/arch/microblaze/include/asm/dma-mapping.h index 3a3e5b886854..01d228286cb0 100644 --- a/arch/microblaze/include/asm/dma-mapping.h +++ b/arch/microblaze/include/asm/dma-mapping.h | |||
@@ -123,28 +123,34 @@ static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr) | |||
123 | #define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f) | 123 | #define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f) |
124 | #define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h) | 124 | #define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h) |
125 | 125 | ||
126 | static inline void *dma_alloc_coherent(struct device *dev, size_t size, | 126 | #define dma_alloc_coherent(d, s, h, f) dma_alloc_attrs(d, s, h, f, NULL) |
127 | dma_addr_t *dma_handle, gfp_t flag) | 127 | |
128 | static inline void *dma_alloc_attrs(struct device *dev, size_t size, | ||
129 | dma_addr_t *dma_handle, gfp_t flag, | ||
130 | struct dma_attrs *attrs) | ||
128 | { | 131 | { |
129 | struct dma_map_ops *ops = get_dma_ops(dev); | 132 | struct dma_map_ops *ops = get_dma_ops(dev); |
130 | void *memory; | 133 | void *memory; |
131 | 134 | ||
132 | BUG_ON(!ops); | 135 | BUG_ON(!ops); |
133 | 136 | ||
134 | memory = ops->alloc_coherent(dev, size, dma_handle, flag); | 137 | memory = ops->alloc(dev, size, dma_handle, flag, attrs); |
135 | 138 | ||
136 | debug_dma_alloc_coherent(dev, size, *dma_handle, memory); | 139 | debug_dma_alloc_coherent(dev, size, *dma_handle, memory); |
137 | return memory; | 140 | return memory; |
138 | } | 141 | } |
139 | 142 | ||
140 | static inline void dma_free_coherent(struct device *dev, size_t size, | 143 | #define dma_free_coherent(d,s,c,h) dma_free_attrs(d, s, c, h, NULL) |
141 | void *cpu_addr, dma_addr_t dma_handle) | 144 | |
145 | static inline void dma_free_attrs(struct device *dev, size_t size, | ||
146 | void *cpu_addr, dma_addr_t dma_handle, | ||
147 | struct dma_attrs *attrs) | ||
142 | { | 148 | { |
143 | struct dma_map_ops *ops = get_dma_ops(dev); | 149 | struct dma_map_ops *ops = get_dma_ops(dev); |
144 | 150 | ||
145 | BUG_ON(!ops); | 151 | BUG_ON(!ops); |
146 | debug_dma_free_coherent(dev, size, cpu_addr, dma_handle); | 152 | debug_dma_free_coherent(dev, size, cpu_addr, dma_handle); |
147 | ops->free_coherent(dev, size, cpu_addr, dma_handle); | 153 | ops->free(dev, size, cpu_addr, dma_handle, attrs); |
148 | } | 154 | } |
149 | 155 | ||
150 | static inline void dma_cache_sync(struct device *dev, void *vaddr, size_t size, | 156 | static inline void dma_cache_sync(struct device *dev, void *vaddr, size_t size, |
diff --git a/arch/microblaze/include/asm/futex.h b/arch/microblaze/include/asm/futex.h index b0526d2716fa..ff8cde159d9a 100644 --- a/arch/microblaze/include/asm/futex.h +++ b/arch/microblaze/include/asm/futex.h | |||
@@ -24,7 +24,7 @@ | |||
24 | .word 1b,4b,2b,4b; \ | 24 | .word 1b,4b,2b,4b; \ |
25 | .previous;" \ | 25 | .previous;" \ |
26 | : "=&r" (oldval), "=&r" (ret) \ | 26 | : "=&r" (oldval), "=&r" (ret) \ |
27 | : "b" (uaddr), "i" (-EFAULT), "r" (oparg) \ | 27 | : "r" (uaddr), "i" (-EFAULT), "r" (oparg) \ |
28 | ); \ | 28 | ); \ |
29 | }) | 29 | }) |
30 | 30 | ||
diff --git a/arch/microblaze/include/asm/processor.h b/arch/microblaze/include/asm/processor.h index 510a8e1c16ba..bffb54527299 100644 --- a/arch/microblaze/include/asm/processor.h +++ b/arch/microblaze/include/asm/processor.h | |||
@@ -31,6 +31,8 @@ extern const struct seq_operations cpuinfo_op; | |||
31 | /* Do necessary setup to start up a newly executed thread. */ | 31 | /* Do necessary setup to start up a newly executed thread. */ |
32 | void start_thread(struct pt_regs *regs, unsigned long pc, unsigned long usp); | 32 | void start_thread(struct pt_regs *regs, unsigned long pc, unsigned long usp); |
33 | 33 | ||
34 | extern void ret_from_fork(void); | ||
35 | |||
34 | # endif /* __ASSEMBLY__ */ | 36 | # endif /* __ASSEMBLY__ */ |
35 | 37 | ||
36 | # ifndef CONFIG_MMU | 38 | # ifndef CONFIG_MMU |
@@ -143,8 +145,6 @@ static inline void exit_thread(void) | |||
143 | 145 | ||
144 | unsigned long get_wchan(struct task_struct *p); | 146 | unsigned long get_wchan(struct task_struct *p); |
145 | 147 | ||
146 | extern void ret_from_fork(void); | ||
147 | |||
148 | /* The size allocated for kernel stacks. This _must_ be a power of two! */ | 148 | /* The size allocated for kernel stacks. This _must_ be a power of two! */ |
149 | # define KERNEL_STACK_SIZE 0x2000 | 149 | # define KERNEL_STACK_SIZE 0x2000 |
150 | 150 | ||
diff --git a/arch/microblaze/kernel/dma.c b/arch/microblaze/kernel/dma.c index 65a4af4cbbbe..a2bfa2ca5730 100644 --- a/arch/microblaze/kernel/dma.c +++ b/arch/microblaze/kernel/dma.c | |||
@@ -33,7 +33,8 @@ static unsigned long get_dma_direct_offset(struct device *dev) | |||
33 | #define NOT_COHERENT_CACHE | 33 | #define NOT_COHERENT_CACHE |
34 | 34 | ||
35 | static void *dma_direct_alloc_coherent(struct device *dev, size_t size, | 35 | static void *dma_direct_alloc_coherent(struct device *dev, size_t size, |
36 | dma_addr_t *dma_handle, gfp_t flag) | 36 | dma_addr_t *dma_handle, gfp_t flag, |
37 | struct dma_attrs *attrs) | ||
37 | { | 38 | { |
38 | #ifdef NOT_COHERENT_CACHE | 39 | #ifdef NOT_COHERENT_CACHE |
39 | return consistent_alloc(flag, size, dma_handle); | 40 | return consistent_alloc(flag, size, dma_handle); |
@@ -57,7 +58,8 @@ static void *dma_direct_alloc_coherent(struct device *dev, size_t size, | |||
57 | } | 58 | } |
58 | 59 | ||
59 | static void dma_direct_free_coherent(struct device *dev, size_t size, | 60 | static void dma_direct_free_coherent(struct device *dev, size_t size, |
60 | void *vaddr, dma_addr_t dma_handle) | 61 | void *vaddr, dma_addr_t dma_handle, |
62 | struct dma_attrs *attrs) | ||
61 | { | 63 | { |
62 | #ifdef NOT_COHERENT_CACHE | 64 | #ifdef NOT_COHERENT_CACHE |
63 | consistent_free(size, vaddr); | 65 | consistent_free(size, vaddr); |
@@ -176,8 +178,8 @@ dma_direct_sync_sg_for_device(struct device *dev, | |||
176 | } | 178 | } |
177 | 179 | ||
178 | struct dma_map_ops dma_direct_ops = { | 180 | struct dma_map_ops dma_direct_ops = { |
179 | .alloc_coherent = dma_direct_alloc_coherent, | 181 | .alloc = dma_direct_alloc_coherent, |
180 | .free_coherent = dma_direct_free_coherent, | 182 | .free = dma_direct_free_coherent, |
181 | .map_sg = dma_direct_map_sg, | 183 | .map_sg = dma_direct_map_sg, |
182 | .unmap_sg = dma_direct_unmap_sg, | 184 | .unmap_sg = dma_direct_unmap_sg, |
183 | .dma_supported = dma_direct_dma_supported, | 185 | .dma_supported = dma_direct_dma_supported, |
diff --git a/arch/microblaze/kernel/early_printk.c b/arch/microblaze/kernel/early_printk.c index ec485876d0d0..aba1f9a97d5d 100644 --- a/arch/microblaze/kernel/early_printk.c +++ b/arch/microblaze/kernel/early_printk.c | |||
@@ -176,6 +176,7 @@ void __init remap_early_printk(void) | |||
176 | base_addr = (u32) ioremap(base_addr, PAGE_SIZE); | 176 | base_addr = (u32) ioremap(base_addr, PAGE_SIZE); |
177 | printk(KERN_CONT "0x%x\n", base_addr); | 177 | printk(KERN_CONT "0x%x\n", base_addr); |
178 | 178 | ||
179 | #ifdef CONFIG_MMU | ||
179 | /* | 180 | /* |
180 | * Early console is on the top of skipped TLB entries | 181 | * Early console is on the top of skipped TLB entries |
181 | * decrease tlb_skip size ensure that hardcoded TLB entry will be | 182 | * decrease tlb_skip size ensure that hardcoded TLB entry will be |
@@ -189,6 +190,7 @@ void __init remap_early_printk(void) | |||
189 | * cmp rX, orig_base_addr | 190 | * cmp rX, orig_base_addr |
190 | */ | 191 | */ |
191 | tlb_skip -= 1; | 192 | tlb_skip -= 1; |
193 | #endif | ||
192 | } | 194 | } |
193 | 195 | ||
194 | void __init disable_early_printk(void) | 196 | void __init disable_early_printk(void) |
diff --git a/arch/microblaze/kernel/setup.c b/arch/microblaze/kernel/setup.c index 71af974aa24a..16d8dfd9094b 100644 --- a/arch/microblaze/kernel/setup.c +++ b/arch/microblaze/kernel/setup.c | |||
@@ -206,6 +206,7 @@ static int microblaze_debugfs_init(void) | |||
206 | } | 206 | } |
207 | arch_initcall(microblaze_debugfs_init); | 207 | arch_initcall(microblaze_debugfs_init); |
208 | 208 | ||
209 | # ifdef CONFIG_MMU | ||
209 | static int __init debugfs_tlb(void) | 210 | static int __init debugfs_tlb(void) |
210 | { | 211 | { |
211 | struct dentry *d; | 212 | struct dentry *d; |
@@ -218,6 +219,7 @@ static int __init debugfs_tlb(void) | |||
218 | return -ENOMEM; | 219 | return -ENOMEM; |
219 | } | 220 | } |
220 | device_initcall(debugfs_tlb); | 221 | device_initcall(debugfs_tlb); |
222 | # endif | ||
221 | #endif | 223 | #endif |
222 | 224 | ||
223 | static int dflt_bus_notify(struct notifier_block *nb, | 225 | static int dflt_bus_notify(struct notifier_block *nb, |
diff --git a/arch/microblaze/kernel/unwind.c b/arch/microblaze/kernel/unwind.c index 9781a528cfc9..6be4ae3c3351 100644 --- a/arch/microblaze/kernel/unwind.c +++ b/arch/microblaze/kernel/unwind.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <asm/sections.h> | 24 | #include <asm/sections.h> |
25 | #include <asm/exceptions.h> | 25 | #include <asm/exceptions.h> |
26 | #include <asm/unwind.h> | 26 | #include <asm/unwind.h> |
27 | #include <asm/switch_to.h> | ||
27 | 28 | ||
28 | struct stack_trace; | 29 | struct stack_trace; |
29 | 30 | ||
diff --git a/arch/microblaze/lib/uaccess_old.S b/arch/microblaze/lib/uaccess_old.S index f037266cdaf3..f085995ee848 100644 --- a/arch/microblaze/lib/uaccess_old.S +++ b/arch/microblaze/lib/uaccess_old.S | |||
@@ -122,22 +122,22 @@ __strnlen_user: | |||
122 | 15: swi r24, r5, 0x0018 + offset; \ | 122 | 15: swi r24, r5, 0x0018 + offset; \ |
123 | 16: swi r25, r5, 0x001C + offset; \ | 123 | 16: swi r25, r5, 0x001C + offset; \ |
124 | .section __ex_table,"a"; \ | 124 | .section __ex_table,"a"; \ |
125 | .word 1b, 0f; \ | 125 | .word 1b, 33f; \ |
126 | .word 2b, 0f; \ | 126 | .word 2b, 33f; \ |
127 | .word 3b, 0f; \ | 127 | .word 3b, 33f; \ |
128 | .word 4b, 0f; \ | 128 | .word 4b, 33f; \ |
129 | .word 5b, 0f; \ | 129 | .word 5b, 33f; \ |
130 | .word 6b, 0f; \ | 130 | .word 6b, 33f; \ |
131 | .word 7b, 0f; \ | 131 | .word 7b, 33f; \ |
132 | .word 8b, 0f; \ | 132 | .word 8b, 33f; \ |
133 | .word 9b, 0f; \ | 133 | .word 9b, 33f; \ |
134 | .word 10b, 0f; \ | 134 | .word 10b, 33f; \ |
135 | .word 11b, 0f; \ | 135 | .word 11b, 33f; \ |
136 | .word 12b, 0f; \ | 136 | .word 12b, 33f; \ |
137 | .word 13b, 0f; \ | 137 | .word 13b, 33f; \ |
138 | .word 14b, 0f; \ | 138 | .word 14b, 33f; \ |
139 | .word 15b, 0f; \ | 139 | .word 15b, 33f; \ |
140 | .word 16b, 0f; \ | 140 | .word 16b, 33f; \ |
141 | .text | 141 | .text |
142 | 142 | ||
143 | #define COPY_80(offset) \ | 143 | #define COPY_80(offset) \ |
@@ -190,14 +190,17 @@ w2: sw r4, r5, r3 | |||
190 | 190 | ||
191 | .align 4 /* Alignment is important to keep icache happy */ | 191 | .align 4 /* Alignment is important to keep icache happy */ |
192 | page: /* Create room on stack and save registers for storign values */ | 192 | page: /* Create room on stack and save registers for storign values */ |
193 | addik r1, r1, -32 | 193 | addik r1, r1, -40 |
194 | swi r19, r1, 4 | 194 | swi r5, r1, 0 |
195 | swi r20, r1, 8 | 195 | swi r6, r1, 4 |
196 | swi r21, r1, 12 | 196 | swi r7, r1, 8 |
197 | swi r22, r1, 16 | 197 | swi r19, r1, 12 |
198 | swi r23, r1, 20 | 198 | swi r20, r1, 16 |
199 | swi r24, r1, 24 | 199 | swi r21, r1, 20 |
200 | swi r25, r1, 28 | 200 | swi r22, r1, 24 |
201 | swi r23, r1, 28 | ||
202 | swi r24, r1, 32 | ||
203 | swi r25, r1, 36 | ||
201 | loop: /* r4, r19, r20, r21, r22, r23, r24, r25 are used for storing values */ | 204 | loop: /* r4, r19, r20, r21, r22, r23, r24, r25 are used for storing values */ |
202 | /* Loop unrolling to get performance boost */ | 205 | /* Loop unrolling to get performance boost */ |
203 | COPY_80(0x000); | 206 | COPY_80(0x000); |
@@ -205,21 +208,44 @@ loop: /* r4, r19, r20, r21, r22, r23, r24, r25 are used for storing values */ | |||
205 | COPY_80(0x100); | 208 | COPY_80(0x100); |
206 | COPY_80(0x180); | 209 | COPY_80(0x180); |
207 | /* copy loop */ | 210 | /* copy loop */ |
208 | addik r6, r6, 0x200 | 211 | addik r6, r6, 0x200 |
209 | addik r7, r7, -0x200 | 212 | addik r7, r7, -0x200 |
210 | bneid r7, loop | 213 | bneid r7, loop |
211 | addik r5, r5, 0x200 | 214 | addik r5, r5, 0x200 |
215 | |||
212 | /* Restore register content */ | 216 | /* Restore register content */ |
213 | lwi r19, r1, 4 | 217 | lwi r5, r1, 0 |
214 | lwi r20, r1, 8 | 218 | lwi r6, r1, 4 |
215 | lwi r21, r1, 12 | 219 | lwi r7, r1, 8 |
216 | lwi r22, r1, 16 | 220 | lwi r19, r1, 12 |
217 | lwi r23, r1, 20 | 221 | lwi r20, r1, 16 |
218 | lwi r24, r1, 24 | 222 | lwi r21, r1, 20 |
219 | lwi r25, r1, 28 | 223 | lwi r22, r1, 24 |
220 | addik r1, r1, 32 | 224 | lwi r23, r1, 28 |
225 | lwi r24, r1, 32 | ||
226 | lwi r25, r1, 36 | ||
227 | addik r1, r1, 40 | ||
221 | /* return back */ | 228 | /* return back */ |
229 | addik r3, r0, 0 | ||
230 | rtsd r15, 8 | ||
231 | nop | ||
232 | |||
233 | /* Fault case - return temp count */ | ||
234 | 33: | ||
222 | addik r3, r7, 0 | 235 | addik r3, r7, 0 |
236 | /* Restore register content */ | ||
237 | lwi r5, r1, 0 | ||
238 | lwi r6, r1, 4 | ||
239 | lwi r7, r1, 8 | ||
240 | lwi r19, r1, 12 | ||
241 | lwi r20, r1, 16 | ||
242 | lwi r21, r1, 20 | ||
243 | lwi r22, r1, 24 | ||
244 | lwi r23, r1, 28 | ||
245 | lwi r24, r1, 32 | ||
246 | lwi r25, r1, 36 | ||
247 | addik r1, r1, 40 | ||
248 | /* return back */ | ||
223 | rtsd r15, 8 | 249 | rtsd r15, 8 |
224 | nop | 250 | nop |
225 | 251 | ||
diff --git a/arch/mips/cavium-octeon/dma-octeon.c b/arch/mips/cavium-octeon/dma-octeon.c index b6bb92c16a47..41dd00884975 100644 --- a/arch/mips/cavium-octeon/dma-octeon.c +++ b/arch/mips/cavium-octeon/dma-octeon.c | |||
@@ -157,7 +157,7 @@ static void octeon_dma_sync_sg_for_device(struct device *dev, | |||
157 | } | 157 | } |
158 | 158 | ||
159 | static void *octeon_dma_alloc_coherent(struct device *dev, size_t size, | 159 | static void *octeon_dma_alloc_coherent(struct device *dev, size_t size, |
160 | dma_addr_t *dma_handle, gfp_t gfp) | 160 | dma_addr_t *dma_handle, gfp_t gfp, struct dma_attrs *attrs) |
161 | { | 161 | { |
162 | void *ret; | 162 | void *ret; |
163 | 163 | ||
@@ -192,7 +192,7 @@ static void *octeon_dma_alloc_coherent(struct device *dev, size_t size, | |||
192 | } | 192 | } |
193 | 193 | ||
194 | static void octeon_dma_free_coherent(struct device *dev, size_t size, | 194 | static void octeon_dma_free_coherent(struct device *dev, size_t size, |
195 | void *vaddr, dma_addr_t dma_handle) | 195 | void *vaddr, dma_addr_t dma_handle, struct dma_attrs *attrs) |
196 | { | 196 | { |
197 | int order = get_order(size); | 197 | int order = get_order(size); |
198 | 198 | ||
@@ -240,8 +240,8 @@ EXPORT_SYMBOL(dma_to_phys); | |||
240 | 240 | ||
241 | static struct octeon_dma_map_ops octeon_linear_dma_map_ops = { | 241 | static struct octeon_dma_map_ops octeon_linear_dma_map_ops = { |
242 | .dma_map_ops = { | 242 | .dma_map_ops = { |
243 | .alloc_coherent = octeon_dma_alloc_coherent, | 243 | .alloc = octeon_dma_alloc_coherent, |
244 | .free_coherent = octeon_dma_free_coherent, | 244 | .free = octeon_dma_free_coherent, |
245 | .map_page = octeon_dma_map_page, | 245 | .map_page = octeon_dma_map_page, |
246 | .unmap_page = swiotlb_unmap_page, | 246 | .unmap_page = swiotlb_unmap_page, |
247 | .map_sg = octeon_dma_map_sg, | 247 | .map_sg = octeon_dma_map_sg, |
@@ -325,8 +325,8 @@ void __init plat_swiotlb_setup(void) | |||
325 | #ifdef CONFIG_PCI | 325 | #ifdef CONFIG_PCI |
326 | static struct octeon_dma_map_ops _octeon_pci_dma_map_ops = { | 326 | static struct octeon_dma_map_ops _octeon_pci_dma_map_ops = { |
327 | .dma_map_ops = { | 327 | .dma_map_ops = { |
328 | .alloc_coherent = octeon_dma_alloc_coherent, | 328 | .alloc = octeon_dma_alloc_coherent, |
329 | .free_coherent = octeon_dma_free_coherent, | 329 | .free = octeon_dma_free_coherent, |
330 | .map_page = octeon_dma_map_page, | 330 | .map_page = octeon_dma_map_page, |
331 | .unmap_page = swiotlb_unmap_page, | 331 | .unmap_page = swiotlb_unmap_page, |
332 | .map_sg = octeon_dma_map_sg, | 332 | .map_sg = octeon_dma_map_sg, |
diff --git a/arch/mips/cavium-octeon/smp.c b/arch/mips/cavium-octeon/smp.c index c3e2b85c3b02..97e7ce9b50ed 100644 --- a/arch/mips/cavium-octeon/smp.c +++ b/arch/mips/cavium-octeon/smp.c | |||
@@ -78,7 +78,7 @@ static inline void octeon_send_ipi_mask(const struct cpumask *mask, | |||
78 | } | 78 | } |
79 | 79 | ||
80 | /** | 80 | /** |
81 | * Detect available CPUs, populate cpu_possible_map | 81 | * Detect available CPUs, populate cpu_possible_mask |
82 | */ | 82 | */ |
83 | static void octeon_smp_hotplug_setup(void) | 83 | static void octeon_smp_hotplug_setup(void) |
84 | { | 84 | { |
@@ -268,7 +268,7 @@ static int octeon_cpu_disable(void) | |||
268 | 268 | ||
269 | spin_lock(&smp_reserve_lock); | 269 | spin_lock(&smp_reserve_lock); |
270 | 270 | ||
271 | cpu_clear(cpu, cpu_online_map); | 271 | set_cpu_online(cpu, false); |
272 | cpu_clear(cpu, cpu_callin_map); | 272 | cpu_clear(cpu, cpu_callin_map); |
273 | local_irq_disable(); | 273 | local_irq_disable(); |
274 | fixup_irqs(); | 274 | fixup_irqs(); |
diff --git a/arch/mips/include/asm/dma-mapping.h b/arch/mips/include/asm/dma-mapping.h index 7aa37ddfca4b..be39a12901c6 100644 --- a/arch/mips/include/asm/dma-mapping.h +++ b/arch/mips/include/asm/dma-mapping.h | |||
@@ -57,25 +57,31 @@ dma_set_mask(struct device *dev, u64 mask) | |||
57 | extern void dma_cache_sync(struct device *dev, void *vaddr, size_t size, | 57 | extern void dma_cache_sync(struct device *dev, void *vaddr, size_t size, |
58 | enum dma_data_direction direction); | 58 | enum dma_data_direction direction); |
59 | 59 | ||
60 | static inline void *dma_alloc_coherent(struct device *dev, size_t size, | 60 | #define dma_alloc_coherent(d,s,h,f) dma_alloc_attrs(d,s,h,f,NULL) |
61 | dma_addr_t *dma_handle, gfp_t gfp) | 61 | |
62 | static inline void *dma_alloc_attrs(struct device *dev, size_t size, | ||
63 | dma_addr_t *dma_handle, gfp_t gfp, | ||
64 | struct dma_attrs *attrs) | ||
62 | { | 65 | { |
63 | void *ret; | 66 | void *ret; |
64 | struct dma_map_ops *ops = get_dma_ops(dev); | 67 | struct dma_map_ops *ops = get_dma_ops(dev); |
65 | 68 | ||
66 | ret = ops->alloc_coherent(dev, size, dma_handle, gfp); | 69 | ret = ops->alloc(dev, size, dma_handle, gfp, attrs); |
67 | 70 | ||
68 | debug_dma_alloc_coherent(dev, size, *dma_handle, ret); | 71 | debug_dma_alloc_coherent(dev, size, *dma_handle, ret); |
69 | 72 | ||
70 | return ret; | 73 | return ret; |
71 | } | 74 | } |
72 | 75 | ||
73 | static inline void dma_free_coherent(struct device *dev, size_t size, | 76 | #define dma_free_coherent(d,s,c,h) dma_free_attrs(d,s,c,h,NULL) |
74 | void *vaddr, dma_addr_t dma_handle) | 77 | |
78 | static inline void dma_free_attrs(struct device *dev, size_t size, | ||
79 | void *vaddr, dma_addr_t dma_handle, | ||
80 | struct dma_attrs *attrs) | ||
75 | { | 81 | { |
76 | struct dma_map_ops *ops = get_dma_ops(dev); | 82 | struct dma_map_ops *ops = get_dma_ops(dev); |
77 | 83 | ||
78 | ops->free_coherent(dev, size, vaddr, dma_handle); | 84 | ops->free(dev, size, vaddr, dma_handle, attrs); |
79 | 85 | ||
80 | debug_dma_free_coherent(dev, size, vaddr, dma_handle); | 86 | debug_dma_free_coherent(dev, size, vaddr, dma_handle); |
81 | } | 87 | } |
diff --git a/arch/mips/kernel/mips-mt-fpaff.c b/arch/mips/kernel/mips-mt-fpaff.c index 802e6160f37e..33f63bab478a 100644 --- a/arch/mips/kernel/mips-mt-fpaff.c +++ b/arch/mips/kernel/mips-mt-fpaff.c | |||
@@ -173,7 +173,7 @@ asmlinkage long mipsmt_sys_sched_getaffinity(pid_t pid, unsigned int len, | |||
173 | if (retval) | 173 | if (retval) |
174 | goto out_unlock; | 174 | goto out_unlock; |
175 | 175 | ||
176 | cpus_and(mask, p->thread.user_cpus_allowed, cpu_possible_map); | 176 | cpumask_and(&mask, &p->thread.user_cpus_allowed, cpu_possible_mask); |
177 | 177 | ||
178 | out_unlock: | 178 | out_unlock: |
179 | read_unlock(&tasklist_lock); | 179 | read_unlock(&tasklist_lock); |
diff --git a/arch/mips/kernel/proc.c b/arch/mips/kernel/proc.c index e309665b6c81..f8b2c592514d 100644 --- a/arch/mips/kernel/proc.c +++ b/arch/mips/kernel/proc.c | |||
@@ -25,7 +25,7 @@ static int show_cpuinfo(struct seq_file *m, void *v) | |||
25 | int i; | 25 | int i; |
26 | 26 | ||
27 | #ifdef CONFIG_SMP | 27 | #ifdef CONFIG_SMP |
28 | if (!cpu_isset(n, cpu_online_map)) | 28 | if (!cpu_online(n)) |
29 | return 0; | 29 | return 0; |
30 | #endif | 30 | #endif |
31 | 31 | ||
diff --git a/arch/mips/kernel/smp-bmips.c b/arch/mips/kernel/smp-bmips.c index ca673569fd24..3046e2986006 100644 --- a/arch/mips/kernel/smp-bmips.c +++ b/arch/mips/kernel/smp-bmips.c | |||
@@ -317,7 +317,7 @@ static int bmips_cpu_disable(void) | |||
317 | 317 | ||
318 | pr_info("SMP: CPU%d is offline\n", cpu); | 318 | pr_info("SMP: CPU%d is offline\n", cpu); |
319 | 319 | ||
320 | cpu_clear(cpu, cpu_online_map); | 320 | set_cpu_online(cpu, false); |
321 | cpu_clear(cpu, cpu_callin_map); | 321 | cpu_clear(cpu, cpu_callin_map); |
322 | 322 | ||
323 | local_flush_tlb_all(); | 323 | local_flush_tlb_all(); |
diff --git a/arch/mips/kernel/smp.c b/arch/mips/kernel/smp.c index 9c1cce9de35f..ba9376bf52a1 100644 --- a/arch/mips/kernel/smp.c +++ b/arch/mips/kernel/smp.c | |||
@@ -148,7 +148,7 @@ static void stop_this_cpu(void *dummy) | |||
148 | /* | 148 | /* |
149 | * Remove this CPU: | 149 | * Remove this CPU: |
150 | */ | 150 | */ |
151 | cpu_clear(smp_processor_id(), cpu_online_map); | 151 | set_cpu_online(smp_processor_id(), false); |
152 | for (;;) { | 152 | for (;;) { |
153 | if (cpu_wait) | 153 | if (cpu_wait) |
154 | (*cpu_wait)(); /* Wait if available. */ | 154 | (*cpu_wait)(); /* Wait if available. */ |
@@ -174,7 +174,7 @@ void __init smp_prepare_cpus(unsigned int max_cpus) | |||
174 | mp_ops->prepare_cpus(max_cpus); | 174 | mp_ops->prepare_cpus(max_cpus); |
175 | set_cpu_sibling_map(0); | 175 | set_cpu_sibling_map(0); |
176 | #ifndef CONFIG_HOTPLUG_CPU | 176 | #ifndef CONFIG_HOTPLUG_CPU |
177 | init_cpu_present(&cpu_possible_map); | 177 | init_cpu_present(cpu_possible_mask); |
178 | #endif | 178 | #endif |
179 | } | 179 | } |
180 | 180 | ||
@@ -248,7 +248,7 @@ int __cpuinit __cpu_up(unsigned int cpu) | |||
248 | while (!cpu_isset(cpu, cpu_callin_map)) | 248 | while (!cpu_isset(cpu, cpu_callin_map)) |
249 | udelay(100); | 249 | udelay(100); |
250 | 250 | ||
251 | cpu_set(cpu, cpu_online_map); | 251 | set_cpu_online(cpu, true); |
252 | 252 | ||
253 | return 0; | 253 | return 0; |
254 | } | 254 | } |
@@ -320,13 +320,12 @@ void flush_tlb_mm(struct mm_struct *mm) | |||
320 | if ((atomic_read(&mm->mm_users) != 1) || (current->mm != mm)) { | 320 | if ((atomic_read(&mm->mm_users) != 1) || (current->mm != mm)) { |
321 | smp_on_other_tlbs(flush_tlb_mm_ipi, mm); | 321 | smp_on_other_tlbs(flush_tlb_mm_ipi, mm); |
322 | } else { | 322 | } else { |
323 | cpumask_t mask = cpu_online_map; | ||
324 | unsigned int cpu; | 323 | unsigned int cpu; |
325 | 324 | ||
326 | cpu_clear(smp_processor_id(), mask); | 325 | for_each_online_cpu(cpu) { |
327 | for_each_cpu_mask(cpu, mask) | 326 | if (cpu != smp_processor_id() && cpu_context(cpu, mm)) |
328 | if (cpu_context(cpu, mm)) | ||
329 | cpu_context(cpu, mm) = 0; | 327 | cpu_context(cpu, mm) = 0; |
328 | } | ||
330 | } | 329 | } |
331 | local_flush_tlb_mm(mm); | 330 | local_flush_tlb_mm(mm); |
332 | 331 | ||
@@ -360,13 +359,12 @@ void flush_tlb_range(struct vm_area_struct *vma, unsigned long start, unsigned l | |||
360 | 359 | ||
361 | smp_on_other_tlbs(flush_tlb_range_ipi, &fd); | 360 | smp_on_other_tlbs(flush_tlb_range_ipi, &fd); |
362 | } else { | 361 | } else { |
363 | cpumask_t mask = cpu_online_map; | ||
364 | unsigned int cpu; | 362 | unsigned int cpu; |
365 | 363 | ||
366 | cpu_clear(smp_processor_id(), mask); | 364 | for_each_online_cpu(cpu) { |
367 | for_each_cpu_mask(cpu, mask) | 365 | if (cpu != smp_processor_id() && cpu_context(cpu, mm)) |
368 | if (cpu_context(cpu, mm)) | ||
369 | cpu_context(cpu, mm) = 0; | 366 | cpu_context(cpu, mm) = 0; |
367 | } | ||
370 | } | 368 | } |
371 | local_flush_tlb_range(vma, start, end); | 369 | local_flush_tlb_range(vma, start, end); |
372 | preempt_enable(); | 370 | preempt_enable(); |
@@ -407,13 +405,12 @@ void flush_tlb_page(struct vm_area_struct *vma, unsigned long page) | |||
407 | 405 | ||
408 | smp_on_other_tlbs(flush_tlb_page_ipi, &fd); | 406 | smp_on_other_tlbs(flush_tlb_page_ipi, &fd); |
409 | } else { | 407 | } else { |
410 | cpumask_t mask = cpu_online_map; | ||
411 | unsigned int cpu; | 408 | unsigned int cpu; |
412 | 409 | ||
413 | cpu_clear(smp_processor_id(), mask); | 410 | for_each_online_cpu(cpu) { |
414 | for_each_cpu_mask(cpu, mask) | 411 | if (cpu != smp_processor_id() && cpu_context(cpu, vma->vm_mm)) |
415 | if (cpu_context(cpu, vma->vm_mm)) | ||
416 | cpu_context(cpu, vma->vm_mm) = 0; | 412 | cpu_context(cpu, vma->vm_mm) = 0; |
413 | } | ||
417 | } | 414 | } |
418 | local_flush_tlb_page(vma, page); | 415 | local_flush_tlb_page(vma, page); |
419 | preempt_enable(); | 416 | preempt_enable(); |
diff --git a/arch/mips/kernel/smtc.c b/arch/mips/kernel/smtc.c index c4f75bbc0bd6..f5dd38f1d015 100644 --- a/arch/mips/kernel/smtc.c +++ b/arch/mips/kernel/smtc.c | |||
@@ -291,7 +291,7 @@ static void smtc_configure_tlb(void) | |||
291 | * possibly leave some TCs/VPEs as "slave" processors. | 291 | * possibly leave some TCs/VPEs as "slave" processors. |
292 | * | 292 | * |
293 | * Use c0_MVPConf0 to find out how many TCs are available, setting up | 293 | * Use c0_MVPConf0 to find out how many TCs are available, setting up |
294 | * cpu_possible_map and the logical/physical mappings. | 294 | * cpu_possible_mask and the logical/physical mappings. |
295 | */ | 295 | */ |
296 | 296 | ||
297 | int __init smtc_build_cpu_map(int start_cpu_slot) | 297 | int __init smtc_build_cpu_map(int start_cpu_slot) |
diff --git a/arch/mips/mm/c-octeon.c b/arch/mips/mm/c-octeon.c index 1f9ca07f53c8..47037ec5589b 100644 --- a/arch/mips/mm/c-octeon.c +++ b/arch/mips/mm/c-octeon.c | |||
@@ -80,9 +80,9 @@ static void octeon_flush_icache_all_cores(struct vm_area_struct *vma) | |||
80 | if (vma) | 80 | if (vma) |
81 | mask = *mm_cpumask(vma->vm_mm); | 81 | mask = *mm_cpumask(vma->vm_mm); |
82 | else | 82 | else |
83 | mask = cpu_online_map; | 83 | mask = *cpu_online_mask; |
84 | cpu_clear(cpu, mask); | 84 | cpumask_clear_cpu(cpu, &mask); |
85 | for_each_cpu_mask(cpu, mask) | 85 | for_each_cpu(cpu, &mask) |
86 | octeon_send_ipi_single(cpu, SMP_ICACHE_FLUSH); | 86 | octeon_send_ipi_single(cpu, SMP_ICACHE_FLUSH); |
87 | 87 | ||
88 | preempt_enable(); | 88 | preempt_enable(); |
diff --git a/arch/mips/mm/dma-default.c b/arch/mips/mm/dma-default.c index 46084912e588..3fab2046c8a4 100644 --- a/arch/mips/mm/dma-default.c +++ b/arch/mips/mm/dma-default.c | |||
@@ -98,7 +98,7 @@ void *dma_alloc_noncoherent(struct device *dev, size_t size, | |||
98 | EXPORT_SYMBOL(dma_alloc_noncoherent); | 98 | EXPORT_SYMBOL(dma_alloc_noncoherent); |
99 | 99 | ||
100 | static void *mips_dma_alloc_coherent(struct device *dev, size_t size, | 100 | static void *mips_dma_alloc_coherent(struct device *dev, size_t size, |
101 | dma_addr_t * dma_handle, gfp_t gfp) | 101 | dma_addr_t * dma_handle, gfp_t gfp, struct dma_attrs *attrs) |
102 | { | 102 | { |
103 | void *ret; | 103 | void *ret; |
104 | 104 | ||
@@ -132,7 +132,7 @@ void dma_free_noncoherent(struct device *dev, size_t size, void *vaddr, | |||
132 | EXPORT_SYMBOL(dma_free_noncoherent); | 132 | EXPORT_SYMBOL(dma_free_noncoherent); |
133 | 133 | ||
134 | static void mips_dma_free_coherent(struct device *dev, size_t size, void *vaddr, | 134 | static void mips_dma_free_coherent(struct device *dev, size_t size, void *vaddr, |
135 | dma_addr_t dma_handle) | 135 | dma_addr_t dma_handle, struct dma_attrs *attrs) |
136 | { | 136 | { |
137 | unsigned long addr = (unsigned long) vaddr; | 137 | unsigned long addr = (unsigned long) vaddr; |
138 | int order = get_order(size); | 138 | int order = get_order(size); |
@@ -323,8 +323,8 @@ void dma_cache_sync(struct device *dev, void *vaddr, size_t size, | |||
323 | EXPORT_SYMBOL(dma_cache_sync); | 323 | EXPORT_SYMBOL(dma_cache_sync); |
324 | 324 | ||
325 | static struct dma_map_ops mips_default_dma_map_ops = { | 325 | static struct dma_map_ops mips_default_dma_map_ops = { |
326 | .alloc_coherent = mips_dma_alloc_coherent, | 326 | .alloc = mips_dma_alloc_coherent, |
327 | .free_coherent = mips_dma_free_coherent, | 327 | .free = mips_dma_free_coherent, |
328 | .map_page = mips_dma_map_page, | 328 | .map_page = mips_dma_map_page, |
329 | .unmap_page = mips_dma_unmap_page, | 329 | .unmap_page = mips_dma_unmap_page, |
330 | .map_sg = mips_dma_map_sg, | 330 | .map_sg = mips_dma_map_sg, |
diff --git a/arch/mips/netlogic/common/smp.c b/arch/mips/netlogic/common/smp.c index db17f49886c2..fab316de57e9 100644 --- a/arch/mips/netlogic/common/smp.c +++ b/arch/mips/netlogic/common/smp.c | |||
@@ -165,7 +165,7 @@ void __init nlm_smp_setup(void) | |||
165 | cpu_set(boot_cpu, phys_cpu_present_map); | 165 | cpu_set(boot_cpu, phys_cpu_present_map); |
166 | __cpu_number_map[boot_cpu] = 0; | 166 | __cpu_number_map[boot_cpu] = 0; |
167 | __cpu_logical_map[0] = boot_cpu; | 167 | __cpu_logical_map[0] = boot_cpu; |
168 | cpu_set(0, cpu_possible_map); | 168 | set_cpu_possible(0, true); |
169 | 169 | ||
170 | num_cpus = 1; | 170 | num_cpus = 1; |
171 | for (i = 0; i < NR_CPUS; i++) { | 171 | for (i = 0; i < NR_CPUS; i++) { |
@@ -177,14 +177,14 @@ void __init nlm_smp_setup(void) | |||
177 | cpu_set(i, phys_cpu_present_map); | 177 | cpu_set(i, phys_cpu_present_map); |
178 | __cpu_number_map[i] = num_cpus; | 178 | __cpu_number_map[i] = num_cpus; |
179 | __cpu_logical_map[num_cpus] = i; | 179 | __cpu_logical_map[num_cpus] = i; |
180 | cpu_set(num_cpus, cpu_possible_map); | 180 | set_cpu_possible(num_cpus, true); |
181 | ++num_cpus; | 181 | ++num_cpus; |
182 | } | 182 | } |
183 | } | 183 | } |
184 | 184 | ||
185 | pr_info("Phys CPU present map: %lx, possible map %lx\n", | 185 | pr_info("Phys CPU present map: %lx, possible map %lx\n", |
186 | (unsigned long)phys_cpu_present_map.bits[0], | 186 | (unsigned long)phys_cpu_present_map.bits[0], |
187 | (unsigned long)cpu_possible_map.bits[0]); | 187 | (unsigned long)cpumask_bits(cpu_possible_mask)[0]); |
188 | 188 | ||
189 | pr_info("Detected %i Slave CPU(s)\n", num_cpus); | 189 | pr_info("Detected %i Slave CPU(s)\n", num_cpus); |
190 | nlm_set_nmi_handler(nlm_boot_secondary_cpus); | 190 | nlm_set_nmi_handler(nlm_boot_secondary_cpus); |
diff --git a/arch/mips/pmc-sierra/yosemite/smp.c b/arch/mips/pmc-sierra/yosemite/smp.c index 2608752898c0..b71fae231049 100644 --- a/arch/mips/pmc-sierra/yosemite/smp.c +++ b/arch/mips/pmc-sierra/yosemite/smp.c | |||
@@ -146,7 +146,7 @@ static void __cpuinit yos_boot_secondary(int cpu, struct task_struct *idle) | |||
146 | } | 146 | } |
147 | 147 | ||
148 | /* | 148 | /* |
149 | * Detect available CPUs, populate cpu_possible_map before smp_init | 149 | * Detect available CPUs, populate cpu_possible_mask before smp_init |
150 | * | 150 | * |
151 | * We don't want to start the secondary CPU yet nor do we have a nice probing | 151 | * We don't want to start the secondary CPU yet nor do we have a nice probing |
152 | * feature in PMON so we just assume presence of the secondary core. | 152 | * feature in PMON so we just assume presence of the secondary core. |
@@ -155,10 +155,10 @@ static void __init yos_smp_setup(void) | |||
155 | { | 155 | { |
156 | int i; | 156 | int i; |
157 | 157 | ||
158 | cpus_clear(cpu_possible_map); | 158 | init_cpu_possible(cpu_none_mask); |
159 | 159 | ||
160 | for (i = 0; i < 2; i++) { | 160 | for (i = 0; i < 2; i++) { |
161 | cpu_set(i, cpu_possible_map); | 161 | set_cpu_possible(i, true); |
162 | __cpu_number_map[i] = i; | 162 | __cpu_number_map[i] = i; |
163 | __cpu_logical_map[i] = i; | 163 | __cpu_logical_map[i] = i; |
164 | } | 164 | } |
@@ -169,7 +169,7 @@ static void __init yos_prepare_cpus(unsigned int max_cpus) | |||
169 | /* | 169 | /* |
170 | * Be paranoid. Enable the IPI only if we're really about to go SMP. | 170 | * Be paranoid. Enable the IPI only if we're really about to go SMP. |
171 | */ | 171 | */ |
172 | if (cpus_weight(cpu_possible_map)) | 172 | if (num_possible_cpus()) |
173 | set_c0_status(STATUSF_IP5); | 173 | set_c0_status(STATUSF_IP5); |
174 | } | 174 | } |
175 | 175 | ||
diff --git a/arch/mips/sgi-ip27/ip27-smp.c b/arch/mips/sgi-ip27/ip27-smp.c index c6851df9ab74..735b43bf8f82 100644 --- a/arch/mips/sgi-ip27/ip27-smp.c +++ b/arch/mips/sgi-ip27/ip27-smp.c | |||
@@ -76,7 +76,7 @@ static int do_cpumask(cnodeid_t cnode, nasid_t nasid, int highest) | |||
76 | /* Only let it join in if it's marked enabled */ | 76 | /* Only let it join in if it's marked enabled */ |
77 | if ((acpu->cpu_info.flags & KLINFO_ENABLE) && | 77 | if ((acpu->cpu_info.flags & KLINFO_ENABLE) && |
78 | (tot_cpus_found != NR_CPUS)) { | 78 | (tot_cpus_found != NR_CPUS)) { |
79 | cpu_set(cpuid, cpu_possible_map); | 79 | set_cpu_possible(cpuid, true); |
80 | alloc_cpupda(cpuid, tot_cpus_found); | 80 | alloc_cpupda(cpuid, tot_cpus_found); |
81 | cpus_found++; | 81 | cpus_found++; |
82 | tot_cpus_found++; | 82 | tot_cpus_found++; |
diff --git a/arch/mips/sibyte/bcm1480/smp.c b/arch/mips/sibyte/bcm1480/smp.c index d667875be564..de88e22694a0 100644 --- a/arch/mips/sibyte/bcm1480/smp.c +++ b/arch/mips/sibyte/bcm1480/smp.c | |||
@@ -138,7 +138,7 @@ static void __cpuinit bcm1480_boot_secondary(int cpu, struct task_struct *idle) | |||
138 | 138 | ||
139 | /* | 139 | /* |
140 | * Use CFE to find out how many CPUs are available, setting up | 140 | * Use CFE to find out how many CPUs are available, setting up |
141 | * cpu_possible_map and the logical/physical mappings. | 141 | * cpu_possible_mask and the logical/physical mappings. |
142 | * XXXKW will the boot CPU ever not be physical 0? | 142 | * XXXKW will the boot CPU ever not be physical 0? |
143 | * | 143 | * |
144 | * Common setup before any secondaries are started | 144 | * Common setup before any secondaries are started |
@@ -147,14 +147,13 @@ static void __init bcm1480_smp_setup(void) | |||
147 | { | 147 | { |
148 | int i, num; | 148 | int i, num; |
149 | 149 | ||
150 | cpus_clear(cpu_possible_map); | 150 | init_cpu_possible(cpumask_of(0)); |
151 | cpu_set(0, cpu_possible_map); | ||
152 | __cpu_number_map[0] = 0; | 151 | __cpu_number_map[0] = 0; |
153 | __cpu_logical_map[0] = 0; | 152 | __cpu_logical_map[0] = 0; |
154 | 153 | ||
155 | for (i = 1, num = 0; i < NR_CPUS; i++) { | 154 | for (i = 1, num = 0; i < NR_CPUS; i++) { |
156 | if (cfe_cpu_stop(i) == 0) { | 155 | if (cfe_cpu_stop(i) == 0) { |
157 | cpu_set(i, cpu_possible_map); | 156 | set_cpu_possible(i, true); |
158 | __cpu_number_map[i] = ++num; | 157 | __cpu_number_map[i] = ++num; |
159 | __cpu_logical_map[num] = i; | 158 | __cpu_logical_map[num] = i; |
160 | } | 159 | } |
diff --git a/arch/mips/sibyte/sb1250/smp.c b/arch/mips/sibyte/sb1250/smp.c index 38e7f6bd7922..285cfef4ebc0 100644 --- a/arch/mips/sibyte/sb1250/smp.c +++ b/arch/mips/sibyte/sb1250/smp.c | |||
@@ -126,7 +126,7 @@ static void __cpuinit sb1250_boot_secondary(int cpu, struct task_struct *idle) | |||
126 | 126 | ||
127 | /* | 127 | /* |
128 | * Use CFE to find out how many CPUs are available, setting up | 128 | * Use CFE to find out how many CPUs are available, setting up |
129 | * cpu_possible_map and the logical/physical mappings. | 129 | * cpu_possible_mask and the logical/physical mappings. |
130 | * XXXKW will the boot CPU ever not be physical 0? | 130 | * XXXKW will the boot CPU ever not be physical 0? |
131 | * | 131 | * |
132 | * Common setup before any secondaries are started | 132 | * Common setup before any secondaries are started |
@@ -135,14 +135,13 @@ static void __init sb1250_smp_setup(void) | |||
135 | { | 135 | { |
136 | int i, num; | 136 | int i, num; |
137 | 137 | ||
138 | cpus_clear(cpu_possible_map); | 138 | init_cpu_possible(cpumask_of(0)); |
139 | cpu_set(0, cpu_possible_map); | ||
140 | __cpu_number_map[0] = 0; | 139 | __cpu_number_map[0] = 0; |
141 | __cpu_logical_map[0] = 0; | 140 | __cpu_logical_map[0] = 0; |
142 | 141 | ||
143 | for (i = 1, num = 0; i < NR_CPUS; i++) { | 142 | for (i = 1, num = 0; i < NR_CPUS; i++) { |
144 | if (cfe_cpu_stop(i) == 0) { | 143 | if (cfe_cpu_stop(i) == 0) { |
145 | cpu_set(i, cpu_possible_map); | 144 | set_cpu_possible(i, true); |
146 | __cpu_number_map[i] = ++num; | 145 | __cpu_number_map[i] = ++num; |
147 | __cpu_logical_map[num] = i; | 146 | __cpu_logical_map[num] = i; |
148 | } | 147 | } |
diff --git a/arch/parisc/include/asm/atomic.h b/arch/parisc/include/asm/atomic.h index 3ae56073cc3d..6c6defc24619 100644 --- a/arch/parisc/include/asm/atomic.h +++ b/arch/parisc/include/asm/atomic.h | |||
@@ -6,6 +6,7 @@ | |||
6 | #define _ASM_PARISC_ATOMIC_H_ | 6 | #define _ASM_PARISC_ATOMIC_H_ |
7 | 7 | ||
8 | #include <linux/types.h> | 8 | #include <linux/types.h> |
9 | #include <asm/cmpxchg.h> | ||
9 | 10 | ||
10 | /* | 11 | /* |
11 | * Atomic operations that C can't guarantee us. Useful for | 12 | * Atomic operations that C can't guarantee us. Useful for |
@@ -48,112 +49,6 @@ extern arch_spinlock_t __atomic_hash[ATOMIC_HASH_SIZE] __lock_aligned; | |||
48 | # define _atomic_spin_unlock_irqrestore(l,f) do { local_irq_restore(f); } while (0) | 49 | # define _atomic_spin_unlock_irqrestore(l,f) do { local_irq_restore(f); } while (0) |
49 | #endif | 50 | #endif |
50 | 51 | ||
51 | /* This should get optimized out since it's never called. | ||
52 | ** Or get a link error if xchg is used "wrong". | ||
53 | */ | ||
54 | extern void __xchg_called_with_bad_pointer(void); | ||
55 | |||
56 | |||
57 | /* __xchg32/64 defined in arch/parisc/lib/bitops.c */ | ||
58 | extern unsigned long __xchg8(char, char *); | ||
59 | extern unsigned long __xchg32(int, int *); | ||
60 | #ifdef CONFIG_64BIT | ||
61 | extern unsigned long __xchg64(unsigned long, unsigned long *); | ||
62 | #endif | ||
63 | |||
64 | /* optimizer better get rid of switch since size is a constant */ | ||
65 | static __inline__ unsigned long | ||
66 | __xchg(unsigned long x, __volatile__ void * ptr, int size) | ||
67 | { | ||
68 | switch(size) { | ||
69 | #ifdef CONFIG_64BIT | ||
70 | case 8: return __xchg64(x,(unsigned long *) ptr); | ||
71 | #endif | ||
72 | case 4: return __xchg32((int) x, (int *) ptr); | ||
73 | case 1: return __xchg8((char) x, (char *) ptr); | ||
74 | } | ||
75 | __xchg_called_with_bad_pointer(); | ||
76 | return x; | ||
77 | } | ||
78 | |||
79 | |||
80 | /* | ||
81 | ** REVISIT - Abandoned use of LDCW in xchg() for now: | ||
82 | ** o need to test sizeof(*ptr) to avoid clearing adjacent bytes | ||
83 | ** o and while we are at it, could CONFIG_64BIT code use LDCD too? | ||
84 | ** | ||
85 | ** if (__builtin_constant_p(x) && (x == NULL)) | ||
86 | ** if (((unsigned long)p & 0xf) == 0) | ||
87 | ** return __ldcw(p); | ||
88 | */ | ||
89 | #define xchg(ptr,x) \ | ||
90 | ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr)))) | ||
91 | |||
92 | |||
93 | #define __HAVE_ARCH_CMPXCHG 1 | ||
94 | |||
95 | /* bug catcher for when unsupported size is used - won't link */ | ||
96 | extern void __cmpxchg_called_with_bad_pointer(void); | ||
97 | |||
98 | /* __cmpxchg_u32/u64 defined in arch/parisc/lib/bitops.c */ | ||
99 | extern unsigned long __cmpxchg_u32(volatile unsigned int *m, unsigned int old, unsigned int new_); | ||
100 | extern unsigned long __cmpxchg_u64(volatile unsigned long *ptr, unsigned long old, unsigned long new_); | ||
101 | |||
102 | /* don't worry...optimizer will get rid of most of this */ | ||
103 | static __inline__ unsigned long | ||
104 | __cmpxchg(volatile void *ptr, unsigned long old, unsigned long new_, int size) | ||
105 | { | ||
106 | switch(size) { | ||
107 | #ifdef CONFIG_64BIT | ||
108 | case 8: return __cmpxchg_u64((unsigned long *)ptr, old, new_); | ||
109 | #endif | ||
110 | case 4: return __cmpxchg_u32((unsigned int *)ptr, (unsigned int) old, (unsigned int) new_); | ||
111 | } | ||
112 | __cmpxchg_called_with_bad_pointer(); | ||
113 | return old; | ||
114 | } | ||
115 | |||
116 | #define cmpxchg(ptr,o,n) \ | ||
117 | ({ \ | ||
118 | __typeof__(*(ptr)) _o_ = (o); \ | ||
119 | __typeof__(*(ptr)) _n_ = (n); \ | ||
120 | (__typeof__(*(ptr))) __cmpxchg((ptr), (unsigned long)_o_, \ | ||
121 | (unsigned long)_n_, sizeof(*(ptr))); \ | ||
122 | }) | ||
123 | |||
124 | #include <asm-generic/cmpxchg-local.h> | ||
125 | |||
126 | static inline unsigned long __cmpxchg_local(volatile void *ptr, | ||
127 | unsigned long old, | ||
128 | unsigned long new_, int size) | ||
129 | { | ||
130 | switch (size) { | ||
131 | #ifdef CONFIG_64BIT | ||
132 | case 8: return __cmpxchg_u64((unsigned long *)ptr, old, new_); | ||
133 | #endif | ||
134 | case 4: return __cmpxchg_u32(ptr, old, new_); | ||
135 | default: | ||
136 | return __cmpxchg_local_generic(ptr, old, new_, size); | ||
137 | } | ||
138 | } | ||
139 | |||
140 | /* | ||
141 | * cmpxchg_local and cmpxchg64_local are atomic wrt current CPU. Always make | ||
142 | * them available. | ||
143 | */ | ||
144 | #define cmpxchg_local(ptr, o, n) \ | ||
145 | ((__typeof__(*(ptr)))__cmpxchg_local((ptr), (unsigned long)(o), \ | ||
146 | (unsigned long)(n), sizeof(*(ptr)))) | ||
147 | #ifdef CONFIG_64BIT | ||
148 | #define cmpxchg64_local(ptr, o, n) \ | ||
149 | ({ \ | ||
150 | BUILD_BUG_ON(sizeof(*(ptr)) != 8); \ | ||
151 | cmpxchg_local((ptr), (o), (n)); \ | ||
152 | }) | ||
153 | #else | ||
154 | #define cmpxchg64_local(ptr, o, n) __cmpxchg64_local_generic((ptr), (o), (n)) | ||
155 | #endif | ||
156 | |||
157 | /* | 52 | /* |
158 | * Note that we need not lock read accesses - aligned word writes/reads | 53 | * Note that we need not lock read accesses - aligned word writes/reads |
159 | * are atomic, so a reader never sees inconsistent values. | 54 | * are atomic, so a reader never sees inconsistent values. |
diff --git a/arch/parisc/include/asm/cmpxchg.h b/arch/parisc/include/asm/cmpxchg.h new file mode 100644 index 000000000000..dbd13354ec41 --- /dev/null +++ b/arch/parisc/include/asm/cmpxchg.h | |||
@@ -0,0 +1,116 @@ | |||
1 | /* | ||
2 | * forked from parisc asm/atomic.h which was: | ||
3 | * Copyright (C) 2000 Philipp Rumpf <prumpf@tux.org> | ||
4 | * Copyright (C) 2006 Kyle McMartin <kyle@parisc-linux.org> | ||
5 | */ | ||
6 | |||
7 | #ifndef _ASM_PARISC_CMPXCHG_H_ | ||
8 | #define _ASM_PARISC_CMPXCHG_H_ | ||
9 | |||
10 | /* This should get optimized out since it's never called. | ||
11 | ** Or get a link error if xchg is used "wrong". | ||
12 | */ | ||
13 | extern void __xchg_called_with_bad_pointer(void); | ||
14 | |||
15 | /* __xchg32/64 defined in arch/parisc/lib/bitops.c */ | ||
16 | extern unsigned long __xchg8(char, char *); | ||
17 | extern unsigned long __xchg32(int, int *); | ||
18 | #ifdef CONFIG_64BIT | ||
19 | extern unsigned long __xchg64(unsigned long, unsigned long *); | ||
20 | #endif | ||
21 | |||
22 | /* optimizer better get rid of switch since size is a constant */ | ||
23 | static inline unsigned long | ||
24 | __xchg(unsigned long x, __volatile__ void *ptr, int size) | ||
25 | { | ||
26 | switch (size) { | ||
27 | #ifdef CONFIG_64BIT | ||
28 | case 8: return __xchg64(x, (unsigned long *) ptr); | ||
29 | #endif | ||
30 | case 4: return __xchg32((int) x, (int *) ptr); | ||
31 | case 1: return __xchg8((char) x, (char *) ptr); | ||
32 | } | ||
33 | __xchg_called_with_bad_pointer(); | ||
34 | return x; | ||
35 | } | ||
36 | |||
37 | /* | ||
38 | ** REVISIT - Abandoned use of LDCW in xchg() for now: | ||
39 | ** o need to test sizeof(*ptr) to avoid clearing adjacent bytes | ||
40 | ** o and while we are at it, could CONFIG_64BIT code use LDCD too? | ||
41 | ** | ||
42 | ** if (__builtin_constant_p(x) && (x == NULL)) | ||
43 | ** if (((unsigned long)p & 0xf) == 0) | ||
44 | ** return __ldcw(p); | ||
45 | */ | ||
46 | #define xchg(ptr, x) \ | ||
47 | ((__typeof__(*(ptr)))__xchg((unsigned long)(x), (ptr), sizeof(*(ptr)))) | ||
48 | |||
49 | #define __HAVE_ARCH_CMPXCHG 1 | ||
50 | |||
51 | /* bug catcher for when unsupported size is used - won't link */ | ||
52 | extern void __cmpxchg_called_with_bad_pointer(void); | ||
53 | |||
54 | /* __cmpxchg_u32/u64 defined in arch/parisc/lib/bitops.c */ | ||
55 | extern unsigned long __cmpxchg_u32(volatile unsigned int *m, unsigned int old, | ||
56 | unsigned int new_); | ||
57 | extern unsigned long __cmpxchg_u64(volatile unsigned long *ptr, | ||
58 | unsigned long old, unsigned long new_); | ||
59 | |||
60 | /* don't worry...optimizer will get rid of most of this */ | ||
61 | static inline unsigned long | ||
62 | __cmpxchg(volatile void *ptr, unsigned long old, unsigned long new_, int size) | ||
63 | { | ||
64 | switch (size) { | ||
65 | #ifdef CONFIG_64BIT | ||
66 | case 8: return __cmpxchg_u64((unsigned long *)ptr, old, new_); | ||
67 | #endif | ||
68 | case 4: return __cmpxchg_u32((unsigned int *)ptr, | ||
69 | (unsigned int)old, (unsigned int)new_); | ||
70 | } | ||
71 | __cmpxchg_called_with_bad_pointer(); | ||
72 | return old; | ||
73 | } | ||
74 | |||
75 | #define cmpxchg(ptr, o, n) \ | ||
76 | ({ \ | ||
77 | __typeof__(*(ptr)) _o_ = (o); \ | ||
78 | __typeof__(*(ptr)) _n_ = (n); \ | ||
79 | (__typeof__(*(ptr))) __cmpxchg((ptr), (unsigned long)_o_, \ | ||
80 | (unsigned long)_n_, sizeof(*(ptr))); \ | ||
81 | }) | ||
82 | |||
83 | #include <asm-generic/cmpxchg-local.h> | ||
84 | |||
85 | static inline unsigned long __cmpxchg_local(volatile void *ptr, | ||
86 | unsigned long old, | ||
87 | unsigned long new_, int size) | ||
88 | { | ||
89 | switch (size) { | ||
90 | #ifdef CONFIG_64BIT | ||
91 | case 8: return __cmpxchg_u64((unsigned long *)ptr, old, new_); | ||
92 | #endif | ||
93 | case 4: return __cmpxchg_u32(ptr, old, new_); | ||
94 | default: | ||
95 | return __cmpxchg_local_generic(ptr, old, new_, size); | ||
96 | } | ||
97 | } | ||
98 | |||
99 | /* | ||
100 | * cmpxchg_local and cmpxchg64_local are atomic wrt current CPU. Always make | ||
101 | * them available. | ||
102 | */ | ||
103 | #define cmpxchg_local(ptr, o, n) \ | ||
104 | ((__typeof__(*(ptr)))__cmpxchg_local((ptr), (unsigned long)(o), \ | ||
105 | (unsigned long)(n), sizeof(*(ptr)))) | ||
106 | #ifdef CONFIG_64BIT | ||
107 | #define cmpxchg64_local(ptr, o, n) \ | ||
108 | ({ \ | ||
109 | BUILD_BUG_ON(sizeof(*(ptr)) != 8); \ | ||
110 | cmpxchg_local((ptr), (o), (n)); \ | ||
111 | }) | ||
112 | #else | ||
113 | #define cmpxchg64_local(ptr, o, n) __cmpxchg64_local_generic((ptr), (o), (n)) | ||
114 | #endif | ||
115 | |||
116 | #endif /* _ASM_PARISC_CMPXCHG_H_ */ | ||
diff --git a/arch/powerpc/boot/dts/p1020mbg-pc.dtsi b/arch/powerpc/boot/dts/p1020mbg-pc.dtsi new file mode 100644 index 000000000000..a24699cfea9c --- /dev/null +++ b/arch/powerpc/boot/dts/p1020mbg-pc.dtsi | |||
@@ -0,0 +1,151 @@ | |||
1 | /* | ||
2 | * P1020 MBG-PC Device Tree Source stub (no addresses or top-level ranges) | ||
3 | * | ||
4 | * Copyright 2012 Freescale Semiconductor Inc. | ||
5 | * | ||
6 | * Redistribution and use in source and binary forms, with or without | ||
7 | * modification, are permitted provided that the following conditions are met: | ||
8 | * * Redistributions of source code must retain the above copyright | ||
9 | * notice, this list of conditions and the following disclaimer. | ||
10 | * * Redistributions in binary form must reproduce the above copyright | ||
11 | * notice, this list of conditions and the following disclaimer in the | ||
12 | * documentation and/or other materials provided with the distribution. | ||
13 | * * Neither the name of Freescale Semiconductor nor the | ||
14 | * names of its contributors may be used to endorse or promote products | ||
15 | * derived from this software without specific prior written permission. | ||
16 | * | ||
17 | * | ||
18 | * ALTERNATIVELY, this software may be distributed under the terms of the | ||
19 | * GNU General Public License ("GPL") as published by the Free Software | ||
20 | * Foundation, either version 2 of that License or (at your option) any | ||
21 | * later version. | ||
22 | * | ||
23 | * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY | ||
24 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
25 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
26 | * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY | ||
27 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
28 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
29 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
30 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
31 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
32 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
33 | */ | ||
34 | |||
35 | &lbc { | ||
36 | nor@0,0 { | ||
37 | #address-cells = <1>; | ||
38 | #size-cells = <1>; | ||
39 | compatible = "cfi-flash"; | ||
40 | reg = <0x0 0x0 0x4000000>; | ||
41 | bank-width = <2>; | ||
42 | device-width = <1>; | ||
43 | |||
44 | partition@0 { | ||
45 | /* 128KB for DTB Image */ | ||
46 | reg = <0x0 0x00020000>; | ||
47 | label = "NOR DTB Image"; | ||
48 | }; | ||
49 | |||
50 | partition@20000 { | ||
51 | /* 3.875 MB for Linux Kernel Image */ | ||
52 | reg = <0x00020000 0x003e0000>; | ||
53 | label = "NOR Linux Kernel Image"; | ||
54 | }; | ||
55 | |||
56 | partition@400000 { | ||
57 | /* 58MB for Root file System */ | ||
58 | reg = <0x00400000 0x03a00000>; | ||
59 | label = "NOR Root File System"; | ||
60 | }; | ||
61 | |||
62 | partition@3e00000 { | ||
63 | /* This location must not be altered */ | ||
64 | /* 1M for Vitesse 7385 Switch firmware */ | ||
65 | reg = <0x3e00000 0x00100000>; | ||
66 | label = "NOR Vitesse-7385 Firmware"; | ||
67 | read-only; | ||
68 | }; | ||
69 | |||
70 | partition@3f00000 { | ||
71 | /* This location must not be altered */ | ||
72 | /* 512KB for u-boot Bootloader Image */ | ||
73 | /* 512KB for u-boot Environment Variables */ | ||
74 | reg = <0x03f00000 0x00100000>; | ||
75 | label = "NOR U-Boot Image"; | ||
76 | read-only; | ||
77 | }; | ||
78 | }; | ||
79 | |||
80 | L2switch@2,0 { | ||
81 | #address-cells = <1>; | ||
82 | #size-cells = <1>; | ||
83 | compatible = "vitesse-7385"; | ||
84 | reg = <0x2 0x0 0x20000>; | ||
85 | }; | ||
86 | }; | ||
87 | |||
88 | &soc { | ||
89 | i2c@3000 { | ||
90 | rtc@68 { | ||
91 | compatible = "dallas,ds1339"; | ||
92 | reg = <0x68>; | ||
93 | }; | ||
94 | }; | ||
95 | |||
96 | mdio@24000 { | ||
97 | phy0: ethernet-phy@0 { | ||
98 | interrupts = <3 1 0 0>; | ||
99 | reg = <0x0>; | ||
100 | }; | ||
101 | phy1: ethernet-phy@1 { | ||
102 | interrupts = <2 1 0 0>; | ||
103 | reg = <0x1>; | ||
104 | }; | ||
105 | }; | ||
106 | |||
107 | mdio@25000 { | ||
108 | tbi1: tbi-phy@11 { | ||
109 | reg = <0x11>; | ||
110 | device_type = "tbi-phy"; | ||
111 | }; | ||
112 | }; | ||
113 | |||
114 | mdio@26000 { | ||
115 | tbi2: tbi-phy@11 { | ||
116 | reg = <0x11>; | ||
117 | device_type = "tbi-phy"; | ||
118 | }; | ||
119 | }; | ||
120 | |||
121 | enet0: ethernet@b0000 { | ||
122 | fixed-link = <1 1 1000 0 0>; | ||
123 | phy-connection-type = "rgmii-id"; | ||
124 | }; | ||
125 | |||
126 | enet1: ethernet@b1000 { | ||
127 | phy-handle = <&phy0>; | ||
128 | tbi-handle = <&tbi1>; | ||
129 | phy-connection-type = "sgmii"; | ||
130 | }; | ||
131 | |||
132 | enet2: ethernet@b2000 { | ||
133 | phy-handle = <&phy1>; | ||
134 | phy-connection-type = "rgmii-id"; | ||
135 | }; | ||
136 | |||
137 | usb@22000 { | ||
138 | phy_type = "ulpi"; | ||
139 | }; | ||
140 | |||
141 | /* USB2 is shared with localbus, so it must be disabled | ||
142 | by default. We can't put 'status = "disabled";' here | ||
143 | since U-Boot doesn't clear the status property when | ||
144 | it enables USB2. OTOH, U-Boot does create a new node | ||
145 | when there isn't any. So, just comment it out. | ||
146 | */ | ||
147 | usb@23000 { | ||
148 | status = "disabled"; | ||
149 | phy_type = "ulpi"; | ||
150 | }; | ||
151 | }; | ||
diff --git a/arch/powerpc/boot/dts/p1020mbg-pc_32b.dts b/arch/powerpc/boot/dts/p1020mbg-pc_32b.dts new file mode 100644 index 000000000000..ab8f076eae90 --- /dev/null +++ b/arch/powerpc/boot/dts/p1020mbg-pc_32b.dts | |||
@@ -0,0 +1,89 @@ | |||
1 | /* | ||
2 | * P1020 MBG-PC Device Tree Source (32-bit address map) | ||
3 | * | ||
4 | * Copyright 2012 Freescale Semiconductor Inc. | ||
5 | * | ||
6 | * Redistribution and use in source and binary forms, with or without | ||
7 | * modification, are permitted provided that the following conditions are met: | ||
8 | * * Redistributions of source code must retain the above copyright | ||
9 | * notice, this list of conditions and the following disclaimer. | ||
10 | * * Redistributions in binary form must reproduce the above copyright | ||
11 | * notice, this list of conditions and the following disclaimer in the | ||
12 | * documentation and/or other materials provided with the distribution. | ||
13 | * * Neither the name of Freescale Semiconductor nor the | ||
14 | * names of its contributors may be used to endorse or promote products | ||
15 | * derived from this software without specific prior written permission. | ||
16 | * | ||
17 | * | ||
18 | * ALTERNATIVELY, this software may be distributed under the terms of the | ||
19 | * GNU General Public License ("GPL") as published by the Free Software | ||
20 | * Foundation, either version 2 of that License or (at your option) any | ||
21 | * later version. | ||
22 | * | ||
23 | * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY | ||
24 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
25 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
26 | * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY | ||
27 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
28 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
29 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
30 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
31 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
32 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
33 | */ | ||
34 | |||
35 | /include/ "fsl/p1020si-pre.dtsi" | ||
36 | / { | ||
37 | model = "fsl,P1020MBG-PC"; | ||
38 | compatible = "fsl,P1020MBG-PC"; | ||
39 | |||
40 | memory { | ||
41 | device_type = "memory"; | ||
42 | }; | ||
43 | |||
44 | lbc: localbus@ffe05000 { | ||
45 | reg = <0x0 0xffe05000 0x0 0x1000>; | ||
46 | |||
47 | /* NOR and L2 switch */ | ||
48 | ranges = <0x0 0x0 0x0 0xec000000 0x04000000 | ||
49 | 0x1 0x0 0x0 0xffa00000 0x00040000 | ||
50 | 0x2 0x0 0x0 0xffb00000 0x00020000>; | ||
51 | }; | ||
52 | |||
53 | soc: soc@ffe00000 { | ||
54 | ranges = <0x0 0x0 0xffe00000 0x100000>; | ||
55 | }; | ||
56 | |||
57 | pci0: pcie@ffe09000 { | ||
58 | reg = <0x0 0xffe09000 0x0 0x1000>; | ||
59 | ranges = <0x2000000 0x0 0xe0000000 0x0 0xa0000000 0x0 0x20000000 | ||
60 | 0x1000000 0x0 0x00000000 0x0 0xffc10000 0x0 0x10000>; | ||
61 | pcie@0 { | ||
62 | ranges = <0x2000000 0x0 0xe0000000 | ||
63 | 0x2000000 0x0 0xe0000000 | ||
64 | 0x0 0x20000000 | ||
65 | |||
66 | 0x1000000 0x0 0x0 | ||
67 | 0x1000000 0x0 0x0 | ||
68 | 0x0 0x100000>; | ||
69 | }; | ||
70 | }; | ||
71 | |||
72 | pci1: pcie@ffe0a000 { | ||
73 | reg = <0x0 0xffe0a000 0x0 0x1000>; | ||
74 | ranges = <0x2000000 0x0 0xe0000000 0x0 0x80000000 0x0 0x20000000 | ||
75 | 0x1000000 0x0 0x00000000 0x0 0xffc00000 0x0 0x10000>; | ||
76 | pcie@0 { | ||
77 | ranges = <0x2000000 0x0 0xe0000000 | ||
78 | 0x2000000 0x0 0xe0000000 | ||
79 | 0x0 0x20000000 | ||
80 | |||
81 | 0x1000000 0x0 0x0 | ||
82 | 0x1000000 0x0 0x0 | ||
83 | 0x0 0x100000>; | ||
84 | }; | ||
85 | }; | ||
86 | }; | ||
87 | |||
88 | /include/ "p1020mbg-pc.dtsi" | ||
89 | /include/ "fsl/p1020si-post.dtsi" | ||
diff --git a/arch/powerpc/boot/dts/p1020mbg-pc_36b.dts b/arch/powerpc/boot/dts/p1020mbg-pc_36b.dts new file mode 100644 index 000000000000..9e9f401419b1 --- /dev/null +++ b/arch/powerpc/boot/dts/p1020mbg-pc_36b.dts | |||
@@ -0,0 +1,89 @@ | |||
1 | /* | ||
2 | * P1020 MBG-PC Device Tree Source (36-bit address map) | ||
3 | * | ||
4 | * Copyright 2012 Freescale Semiconductor Inc. | ||
5 | * | ||
6 | * Redistribution and use in source and binary forms, with or without | ||
7 | * modification, are permitted provided that the following conditions are met: | ||
8 | * * Redistributions of source code must retain the above copyright | ||
9 | * notice, this list of conditions and the following disclaimer. | ||
10 | * * Redistributions in binary form must reproduce the above copyright | ||
11 | * notice, this list of conditions and the following disclaimer in the | ||
12 | * documentation and/or other materials provided with the distribution. | ||
13 | * * Neither the name of Freescale Semiconductor nor the | ||
14 | * names of its contributors may be used to endorse or promote products | ||
15 | * derived from this software without specific prior written permission. | ||
16 | * | ||
17 | * | ||
18 | * ALTERNATIVELY, this software may be distributed under the terms of the | ||
19 | * GNU General Public License ("GPL") as published by the Free Software | ||
20 | * Foundation, either version 2 of that License or (at your option) any | ||
21 | * later version. | ||
22 | * | ||
23 | * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY | ||
24 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
25 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
26 | * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY | ||
27 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
28 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
29 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
30 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
31 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
32 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
33 | */ | ||
34 | |||
35 | /include/ "fsl/p1020si-pre.dtsi" | ||
36 | / { | ||
37 | model = "fsl,P1020MBG-PC"; | ||
38 | compatible = "fsl,P1020MBG-PC"; | ||
39 | |||
40 | memory { | ||
41 | device_type = "memory"; | ||
42 | }; | ||
43 | |||
44 | lbc: localbus@fffe05000 { | ||
45 | reg = <0xf 0xffe05000 0x0 0x1000>; | ||
46 | |||
47 | /* NOR and L2 switch */ | ||
48 | ranges = <0x0 0x0 0xf 0xec000000 0x04000000 | ||
49 | 0x1 0x0 0xf 0xffa00000 0x00040000 | ||
50 | 0x2 0x0 0xf 0xffb00000 0x00020000>; | ||
51 | }; | ||
52 | |||
53 | soc: soc@fffe00000 { | ||
54 | ranges = <0x0 0xf 0xffe00000 0x100000>; | ||
55 | }; | ||
56 | |||
57 | pci0: pcie@fffe09000 { | ||
58 | reg = <0xf 0xffe09000 0x0 0x1000>; | ||
59 | ranges = <0x2000000 0x0 0xe0000000 0xc 0x20000000 0x0 0x20000000 | ||
60 | 0x1000000 0x0 0x00000000 0xf 0xffc10000 0x0 0x10000>; | ||
61 | pcie@0 { | ||
62 | ranges = <0x2000000 0x0 0xe0000000 | ||
63 | 0x2000000 0x0 0xe0000000 | ||
64 | 0x0 0x20000000 | ||
65 | |||
66 | 0x1000000 0x0 0x0 | ||
67 | 0x1000000 0x0 0x0 | ||
68 | 0x0 0x100000>; | ||
69 | }; | ||
70 | }; | ||
71 | |||
72 | pci1: pcie@fffe0a000 { | ||
73 | reg = <0xf 0xffe0a000 0 0x1000>; | ||
74 | ranges = <0x2000000 0x0 0xe0000000 0xc 0x00000000 0x0 0x20000000 | ||
75 | 0x1000000 0x0 0x00000000 0xf 0xffc00000 0x0 0x10000>; | ||
76 | pcie@0 { | ||
77 | ranges = <0x2000000 0x0 0xe0000000 | ||
78 | 0x2000000 0x0 0xe0000000 | ||
79 | 0x0 0x20000000 | ||
80 | |||
81 | 0x1000000 0x0 0x0 | ||
82 | 0x1000000 0x0 0x0 | ||
83 | 0x0 0x100000>; | ||
84 | }; | ||
85 | }; | ||
86 | }; | ||
87 | |||
88 | /include/ "p1020mbg-pc.dtsi" | ||
89 | /include/ "fsl/p1020si-post.dtsi" | ||
diff --git a/arch/powerpc/boot/dts/p1020utm-pc.dtsi b/arch/powerpc/boot/dts/p1020utm-pc.dtsi new file mode 100644 index 000000000000..7ea85eabcc5c --- /dev/null +++ b/arch/powerpc/boot/dts/p1020utm-pc.dtsi | |||
@@ -0,0 +1,140 @@ | |||
1 | /* | ||
2 | * P1020 UTM-PC Device Tree Source stub (no addresses or top-level ranges) | ||
3 | * | ||
4 | * Copyright 2012 Freescale Semiconductor Inc. | ||
5 | * | ||
6 | * Redistribution and use in source and binary forms, with or without | ||
7 | * modification, are permitted provided that the following conditions are met: | ||
8 | * * Redistributions of source code must retain the above copyright | ||
9 | * notice, this list of conditions and the following disclaimer. | ||
10 | * * Redistributions in binary form must reproduce the above copyright | ||
11 | * notice, this list of conditions and the following disclaimer in the | ||
12 | * documentation and/or other materials provided with the distribution. | ||
13 | * * Neither the name of Freescale Semiconductor nor the | ||
14 | * names of its contributors may be used to endorse or promote products | ||
15 | * derived from this software without specific prior written permission. | ||
16 | * | ||
17 | * | ||
18 | * ALTERNATIVELY, this software may be distributed under the terms of the | ||
19 | * GNU General Public License ("GPL") as published by the Free Software | ||
20 | * Foundation, either version 2 of that License or (at your option) any | ||
21 | * later version. | ||
22 | * | ||
23 | * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY | ||
24 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
25 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
26 | * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY | ||
27 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
28 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
29 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
30 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
31 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
32 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
33 | */ | ||
34 | |||
35 | &lbc { | ||
36 | nor@0,0 { | ||
37 | #address-cells = <1>; | ||
38 | #size-cells = <1>; | ||
39 | compatible = "cfi-flash"; | ||
40 | reg = <0x0 0x0 0x2000000>; | ||
41 | bank-width = <2>; | ||
42 | device-width = <1>; | ||
43 | |||
44 | partition@0 { | ||
45 | /* 256KB for DTB Image */ | ||
46 | reg = <0x0 0x00040000>; | ||
47 | label = "NOR DTB Image"; | ||
48 | }; | ||
49 | |||
50 | partition@40000 { | ||
51 | /* 3.75 MB for Linux Kernel Image */ | ||
52 | reg = <0x00040000 0x003c0000>; | ||
53 | label = "NOR Linux Kernel Image"; | ||
54 | }; | ||
55 | |||
56 | partition@400000 { | ||
57 | /* 27MB for Root file System */ | ||
58 | reg = <0x00400000 0x01b00000>; | ||
59 | label = "NOR Root File System"; | ||
60 | }; | ||
61 | |||
62 | partition@1f00000 { | ||
63 | /* This location must not be altered */ | ||
64 | /* 512KB for u-boot Bootloader Image */ | ||
65 | /* 512KB for u-boot Environment Variables */ | ||
66 | reg = <0x01f00000 0x00100000>; | ||
67 | label = "NOR U-Boot Image"; | ||
68 | read-only; | ||
69 | }; | ||
70 | }; | ||
71 | }; | ||
72 | |||
73 | &soc { | ||
74 | i2c@3000 { | ||
75 | rtc@68 { | ||
76 | compatible = "dallas,ds1339"; | ||
77 | reg = <0x68>; | ||
78 | }; | ||
79 | }; | ||
80 | |||
81 | mdio@24000 { | ||
82 | phy0: ethernet-phy@0 { | ||
83 | interrupts = <3 1 0 0>; | ||
84 | reg = <0x0>; | ||
85 | }; | ||
86 | phy1: ethernet-phy@1 { | ||
87 | interrupts = <2 1 0 0>; | ||
88 | reg = <0x1>; | ||
89 | }; | ||
90 | phy2: ethernet-phy@2 { | ||
91 | interrupts = <1 1 0 0>; | ||
92 | reg = <0x2>; | ||
93 | }; | ||
94 | }; | ||
95 | |||
96 | mdio@25000 { | ||
97 | tbi1: tbi-phy@11 { | ||
98 | reg = <0x11>; | ||
99 | device_type = "tbi-phy"; | ||
100 | }; | ||
101 | }; | ||
102 | |||
103 | mdio@26000 { | ||
104 | tbi2: tbi-phy@11 { | ||
105 | reg = <0x11>; | ||
106 | device_type = "tbi-phy"; | ||
107 | }; | ||
108 | }; | ||
109 | |||
110 | enet0: ethernet@b0000 { | ||
111 | phy-handle = <&phy2>; | ||
112 | phy-connection-type = "rgmii-id"; | ||
113 | }; | ||
114 | |||
115 | enet1: ethernet@b1000 { | ||
116 | phy-handle = <&phy0>; | ||
117 | tbi-handle = <&tbi1>; | ||
118 | phy-connection-type = "sgmii"; | ||
119 | }; | ||
120 | |||
121 | enet2: ethernet@b2000 { | ||
122 | phy-handle = <&phy1>; | ||
123 | phy-connection-type = "rgmii-id"; | ||
124 | }; | ||
125 | |||
126 | usb@22000 { | ||
127 | phy_type = "ulpi"; | ||
128 | }; | ||
129 | |||
130 | /* USB2 is shared with localbus, so it must be disabled | ||
131 | by default. We can't put 'status = "disabled";' here | ||
132 | since U-Boot doesn't clear the status property when | ||
133 | it enables USB2. OTOH, U-Boot does create a new node | ||
134 | when there isn't any. So, just comment it out. | ||
135 | */ | ||
136 | usb@23000 { | ||
137 | status = "disabled"; | ||
138 | phy_type = "ulpi"; | ||
139 | }; | ||
140 | }; | ||
diff --git a/arch/powerpc/boot/dts/p1020utm-pc_32b.dts b/arch/powerpc/boot/dts/p1020utm-pc_32b.dts new file mode 100644 index 000000000000..4bfdd8971cdb --- /dev/null +++ b/arch/powerpc/boot/dts/p1020utm-pc_32b.dts | |||
@@ -0,0 +1,89 @@ | |||
1 | /* | ||
2 | * P1020 UTM-PC Device Tree Source (32-bit address map) | ||
3 | * | ||
4 | * Copyright 2012 Freescale Semiconductor Inc. | ||
5 | * | ||
6 | * Redistribution and use in source and binary forms, with or without | ||
7 | * modification, are permitted provided that the following conditions are met: | ||
8 | * * Redistributions of source code must retain the above copyright | ||
9 | * notice, this list of conditions and the following disclaimer. | ||
10 | * * Redistributions in binary form must reproduce the above copyright | ||
11 | * notice, this list of conditions and the following disclaimer in the | ||
12 | * documentation and/or other materials provided with the distribution. | ||
13 | * * Neither the name of Freescale Semiconductor nor the | ||
14 | * names of its contributors may be used to endorse or promote products | ||
15 | * derived from this software without specific prior written permission. | ||
16 | * | ||
17 | * | ||
18 | * ALTERNATIVELY, this software may be distributed under the terms of the | ||
19 | * GNU General Public License ("GPL") as published by the Free Software | ||
20 | * Foundation, either version 2 of that License or (at your option) any | ||
21 | * later version. | ||
22 | * | ||
23 | * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY | ||
24 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
25 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
26 | * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY | ||
27 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
28 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
29 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
30 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
31 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
32 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
33 | */ | ||
34 | |||
35 | /include/ "fsl/p1020si-pre.dtsi" | ||
36 | / { | ||
37 | model = "fsl,P1020UTM-PC"; | ||
38 | compatible = "fsl,P1020UTM-PC"; | ||
39 | |||
40 | memory { | ||
41 | device_type = "memory"; | ||
42 | }; | ||
43 | |||
44 | lbc: localbus@ffe05000 { | ||
45 | reg = <0x0 0xffe05000 0x0 0x1000>; | ||
46 | |||
47 | /* NOR */ | ||
48 | ranges = <0x0 0x0 0x0 0xec000000 0x02000000 | ||
49 | 0x1 0x0 0x0 0xffa00000 0x00040000 | ||
50 | 0x2 0x0 0x0 0xffb00000 0x00020000>; | ||
51 | }; | ||
52 | |||
53 | soc: soc@ffe00000 { | ||
54 | ranges = <0x0 0x0 0xffe00000 0x100000>; | ||
55 | }; | ||
56 | |||
57 | pci0: pcie@ffe09000 { | ||
58 | reg = <0x0 0xffe09000 0x0 0x1000>; | ||
59 | ranges = <0x2000000 0x0 0xe0000000 0x0 0xa0000000 0x0 0x20000000 | ||
60 | 0x1000000 0x0 0x00000000 0x0 0xffc10000 0x0 0x10000>; | ||
61 | pcie@0 { | ||
62 | ranges = <0x2000000 0x0 0xe0000000 | ||
63 | 0x2000000 0x0 0xe0000000 | ||
64 | 0x0 0x20000000 | ||
65 | |||
66 | 0x1000000 0x0 0x0 | ||
67 | 0x1000000 0x0 0x0 | ||
68 | 0x0 0x100000>; | ||
69 | }; | ||
70 | }; | ||
71 | |||
72 | pci1: pcie@ffe0a000 { | ||
73 | reg = <0x0 0xffe0a000 0x0 0x1000>; | ||
74 | ranges = <0x2000000 0x0 0xe0000000 0x0 0x80000000 0x0 0x20000000 | ||
75 | 0x1000000 0x0 0x00000000 0x0 0xffc00000 0x0 0x10000>; | ||
76 | pcie@0 { | ||
77 | ranges = <0x2000000 0x0 0xe0000000 | ||
78 | 0x2000000 0x0 0xe0000000 | ||
79 | 0x0 0x20000000 | ||
80 | |||
81 | 0x1000000 0x0 0x0 | ||
82 | 0x1000000 0x0 0x0 | ||
83 | 0x0 0x100000>; | ||
84 | }; | ||
85 | }; | ||
86 | }; | ||
87 | |||
88 | /include/ "p1020utm-pc.dtsi" | ||
89 | /include/ "fsl/p1020si-post.dtsi" | ||
diff --git a/arch/powerpc/boot/dts/p1020utm-pc_36b.dts b/arch/powerpc/boot/dts/p1020utm-pc_36b.dts new file mode 100644 index 000000000000..abec53557501 --- /dev/null +++ b/arch/powerpc/boot/dts/p1020utm-pc_36b.dts | |||
@@ -0,0 +1,89 @@ | |||
1 | /* | ||
2 | * P1020 UTM-PC Device Tree Source (36-bit address map) | ||
3 | * | ||
4 | * Copyright 2012 Freescale Semiconductor Inc. | ||
5 | * | ||
6 | * Redistribution and use in source and binary forms, with or without | ||
7 | * modification, are permitted provided that the following conditions are met: | ||
8 | * * Redistributions of source code must retain the above copyright | ||
9 | * notice, this list of conditions and the following disclaimer. | ||
10 | * * Redistributions in binary form must reproduce the above copyright | ||
11 | * notice, this list of conditions and the following disclaimer in the | ||
12 | * documentation and/or other materials provided with the distribution. | ||
13 | * * Neither the name of Freescale Semiconductor nor the | ||
14 | * names of its contributors may be used to endorse or promote products | ||
15 | * derived from this software without specific prior written permission. | ||
16 | * | ||
17 | * | ||
18 | * ALTERNATIVELY, this software may be distributed under the terms of the | ||
19 | * GNU General Public License ("GPL") as published by the Free Software | ||
20 | * Foundation, either version 2 of that License or (at your option) any | ||
21 | * later version. | ||
22 | * | ||
23 | * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY | ||
24 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
25 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
26 | * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY | ||
27 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
28 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
29 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
30 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
31 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
32 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
33 | */ | ||
34 | |||
35 | /include/ "fsl/p1020si-pre.dtsi" | ||
36 | / { | ||
37 | model = "fsl,P1020UTM-PC"; | ||
38 | compatible = "fsl,P1020UTM-PC"; | ||
39 | |||
40 | memory { | ||
41 | device_type = "memory"; | ||
42 | }; | ||
43 | |||
44 | lbc: localbus@fffe05000 { | ||
45 | reg = <0xf 0xffe05000 0x0 0x1000>; | ||
46 | |||
47 | /* NOR */ | ||
48 | ranges = <0x0 0x0 0xf 0xec000000 0x02000000 | ||
49 | 0x1 0x0 0xf 0xffa00000 0x00040000 | ||
50 | 0x2 0x0 0xf 0xffb00000 0x00020000>; | ||
51 | }; | ||
52 | |||
53 | soc: soc@fffe00000 { | ||
54 | ranges = <0x0 0xf 0xffe00000 0x100000>; | ||
55 | }; | ||
56 | |||
57 | pci0: pcie@fffe09000 { | ||
58 | reg = <0xf 0xffe09000 0x0 0x1000>; | ||
59 | ranges = <0x2000000 0x0 0xe0000000 0xc 0x20000000 0x0 0x20000000 | ||
60 | 0x1000000 0x0 0x00000000 0xf 0xffc10000 0x0 0x10000>; | ||
61 | pcie@0 { | ||
62 | ranges = <0x2000000 0x0 0xe0000000 | ||
63 | 0x2000000 0x0 0xe0000000 | ||
64 | 0x0 0x20000000 | ||
65 | |||
66 | 0x1000000 0x0 0x0 | ||
67 | 0x1000000 0x0 0x0 | ||
68 | 0x0 0x100000>; | ||
69 | }; | ||
70 | }; | ||
71 | |||
72 | pci1: pcie@fffe0a000 { | ||
73 | reg = <0xf 0xffe0a000 0 0x1000>; | ||
74 | ranges = <0x2000000 0x0 0xe0000000 0xc 0x00000000 0x0 0x20000000 | ||
75 | 0x1000000 0x0 0x00000000 0xf 0xffc00000 0x0 0x10000>; | ||
76 | pcie@0 { | ||
77 | ranges = <0x2000000 0x0 0xe0000000 | ||
78 | 0x2000000 0x0 0xe0000000 | ||
79 | 0x0 0x20000000 | ||
80 | |||
81 | 0x1000000 0x0 0x0 | ||
82 | 0x1000000 0x0 0x0 | ||
83 | 0x0 0x100000>; | ||
84 | }; | ||
85 | }; | ||
86 | }; | ||
87 | |||
88 | /include/ "p1020utm-pc.dtsi" | ||
89 | /include/ "fsl/p1020si-post.dtsi" | ||
diff --git a/arch/powerpc/boot/dts/p2041rdb.dts b/arch/powerpc/boot/dts/p2041rdb.dts index 4f957db01230..285213976a7f 100644 --- a/arch/powerpc/boot/dts/p2041rdb.dts +++ b/arch/powerpc/boot/dts/p2041rdb.dts | |||
@@ -135,7 +135,6 @@ | |||
135 | reg = <0xf 0xfe200000 0 0x1000>; | 135 | reg = <0xf 0xfe200000 0 0x1000>; |
136 | ranges = <0x02000000 0 0xe0000000 0xc 0x00000000 0x0 0x20000000 | 136 | ranges = <0x02000000 0 0xe0000000 0xc 0x00000000 0x0 0x20000000 |
137 | 0x01000000 0 0x00000000 0xf 0xf8000000 0x0 0x00010000>; | 137 | 0x01000000 0 0x00000000 0xf 0xf8000000 0x0 0x00010000>; |
138 | fsl,msi = <&msi0>; | ||
139 | pcie@0 { | 138 | pcie@0 { |
140 | ranges = <0x02000000 0 0xe0000000 | 139 | ranges = <0x02000000 0 0xe0000000 |
141 | 0x02000000 0 0xe0000000 | 140 | 0x02000000 0 0xe0000000 |
@@ -151,7 +150,6 @@ | |||
151 | reg = <0xf 0xfe201000 0 0x1000>; | 150 | reg = <0xf 0xfe201000 0 0x1000>; |
152 | ranges = <0x02000000 0x0 0xe0000000 0xc 0x20000000 0x0 0x20000000 | 151 | ranges = <0x02000000 0x0 0xe0000000 0xc 0x20000000 0x0 0x20000000 |
153 | 0x01000000 0x0 0x00000000 0xf 0xf8010000 0x0 0x00010000>; | 152 | 0x01000000 0x0 0x00000000 0xf 0xf8010000 0x0 0x00010000>; |
154 | fsl,msi = <&msi1>; | ||
155 | pcie@0 { | 153 | pcie@0 { |
156 | ranges = <0x02000000 0 0xe0000000 | 154 | ranges = <0x02000000 0 0xe0000000 |
157 | 0x02000000 0 0xe0000000 | 155 | 0x02000000 0 0xe0000000 |
@@ -167,7 +165,6 @@ | |||
167 | reg = <0xf 0xfe202000 0 0x1000>; | 165 | reg = <0xf 0xfe202000 0 0x1000>; |
168 | ranges = <0x02000000 0 0xe0000000 0xc 0x40000000 0 0x20000000 | 166 | ranges = <0x02000000 0 0xe0000000 0xc 0x40000000 0 0x20000000 |
169 | 0x01000000 0 0x00000000 0xf 0xf8020000 0 0x00010000>; | 167 | 0x01000000 0 0x00000000 0xf 0xf8020000 0 0x00010000>; |
170 | fsl,msi = <&msi2>; | ||
171 | pcie@0 { | 168 | pcie@0 { |
172 | ranges = <0x02000000 0 0xe0000000 | 169 | ranges = <0x02000000 0 0xe0000000 |
173 | 0x02000000 0 0xe0000000 | 170 | 0x02000000 0 0xe0000000 |
diff --git a/arch/powerpc/boot/dts/p3041ds.dts b/arch/powerpc/boot/dts/p3041ds.dts index f469145abaeb..22a215e94162 100644 --- a/arch/powerpc/boot/dts/p3041ds.dts +++ b/arch/powerpc/boot/dts/p3041ds.dts | |||
@@ -173,7 +173,6 @@ | |||
173 | reg = <0xf 0xfe200000 0 0x1000>; | 173 | reg = <0xf 0xfe200000 0 0x1000>; |
174 | ranges = <0x02000000 0 0xe0000000 0xc 0x00000000 0x0 0x20000000 | 174 | ranges = <0x02000000 0 0xe0000000 0xc 0x00000000 0x0 0x20000000 |
175 | 0x01000000 0 0x00000000 0xf 0xf8000000 0x0 0x00010000>; | 175 | 0x01000000 0 0x00000000 0xf 0xf8000000 0x0 0x00010000>; |
176 | fsl,msi = <&msi0>; | ||
177 | pcie@0 { | 176 | pcie@0 { |
178 | ranges = <0x02000000 0 0xe0000000 | 177 | ranges = <0x02000000 0 0xe0000000 |
179 | 0x02000000 0 0xe0000000 | 178 | 0x02000000 0 0xe0000000 |
@@ -189,7 +188,6 @@ | |||
189 | reg = <0xf 0xfe201000 0 0x1000>; | 188 | reg = <0xf 0xfe201000 0 0x1000>; |
190 | ranges = <0x02000000 0x0 0xe0000000 0xc 0x20000000 0x0 0x20000000 | 189 | ranges = <0x02000000 0x0 0xe0000000 0xc 0x20000000 0x0 0x20000000 |
191 | 0x01000000 0x0 0x00000000 0xf 0xf8010000 0x0 0x00010000>; | 190 | 0x01000000 0x0 0x00000000 0xf 0xf8010000 0x0 0x00010000>; |
192 | fsl,msi = <&msi1>; | ||
193 | pcie@0 { | 191 | pcie@0 { |
194 | ranges = <0x02000000 0 0xe0000000 | 192 | ranges = <0x02000000 0 0xe0000000 |
195 | 0x02000000 0 0xe0000000 | 193 | 0x02000000 0 0xe0000000 |
@@ -205,7 +203,6 @@ | |||
205 | reg = <0xf 0xfe202000 0 0x1000>; | 203 | reg = <0xf 0xfe202000 0 0x1000>; |
206 | ranges = <0x02000000 0 0xe0000000 0xc 0x40000000 0 0x20000000 | 204 | ranges = <0x02000000 0 0xe0000000 0xc 0x40000000 0 0x20000000 |
207 | 0x01000000 0 0x00000000 0xf 0xf8020000 0 0x00010000>; | 205 | 0x01000000 0 0x00000000 0xf 0xf8020000 0 0x00010000>; |
208 | fsl,msi = <&msi2>; | ||
209 | pcie@0 { | 206 | pcie@0 { |
210 | ranges = <0x02000000 0 0xe0000000 | 207 | ranges = <0x02000000 0 0xe0000000 |
211 | 0x02000000 0 0xe0000000 | 208 | 0x02000000 0 0xe0000000 |
@@ -221,7 +218,6 @@ | |||
221 | reg = <0xf 0xfe203000 0 0x1000>; | 218 | reg = <0xf 0xfe203000 0 0x1000>; |
222 | ranges = <0x02000000 0 0xe0000000 0xc 0x60000000 0 0x20000000 | 219 | ranges = <0x02000000 0 0xe0000000 0xc 0x60000000 0 0x20000000 |
223 | 0x01000000 0 0x00000000 0xf 0xf8030000 0 0x00010000>; | 220 | 0x01000000 0 0x00000000 0xf 0xf8030000 0 0x00010000>; |
224 | fsl,msi = <&msi2>; | ||
225 | pcie@0 { | 221 | pcie@0 { |
226 | ranges = <0x02000000 0 0xe0000000 | 222 | ranges = <0x02000000 0 0xe0000000 |
227 | 0x02000000 0 0xe0000000 | 223 | 0x02000000 0 0xe0000000 |
diff --git a/arch/powerpc/boot/dts/p3060qds.dts b/arch/powerpc/boot/dts/p3060qds.dts index 529042e4b9a2..9ae875c8a211 100644 --- a/arch/powerpc/boot/dts/p3060qds.dts +++ b/arch/powerpc/boot/dts/p3060qds.dts | |||
@@ -212,7 +212,6 @@ | |||
212 | reg = <0xf 0xfe200000 0 0x1000>; | 212 | reg = <0xf 0xfe200000 0 0x1000>; |
213 | ranges = <0x02000000 0 0xe0000000 0xc 0x00000000 0x0 0x20000000 | 213 | ranges = <0x02000000 0 0xe0000000 0xc 0x00000000 0x0 0x20000000 |
214 | 0x01000000 0 0x00000000 0xf 0xf8000000 0x0 0x00010000>; | 214 | 0x01000000 0 0x00000000 0xf 0xf8000000 0x0 0x00010000>; |
215 | fsl,msi = <&msi0>; | ||
216 | pcie@0 { | 215 | pcie@0 { |
217 | ranges = <0x02000000 0 0xe0000000 | 216 | ranges = <0x02000000 0 0xe0000000 |
218 | 0x02000000 0 0xe0000000 | 217 | 0x02000000 0 0xe0000000 |
@@ -228,7 +227,6 @@ | |||
228 | reg = <0xf 0xfe201000 0 0x1000>; | 227 | reg = <0xf 0xfe201000 0 0x1000>; |
229 | ranges = <0x02000000 0x0 0xe0000000 0xc 0x20000000 0x0 0x20000000 | 228 | ranges = <0x02000000 0x0 0xe0000000 0xc 0x20000000 0x0 0x20000000 |
230 | 0x01000000 0x0 0x00000000 0xf 0xf8010000 0x0 0x00010000>; | 229 | 0x01000000 0x0 0x00000000 0xf 0xf8010000 0x0 0x00010000>; |
231 | fsl,msi = <&msi1>; | ||
232 | pcie@0 { | 230 | pcie@0 { |
233 | ranges = <0x02000000 0 0xe0000000 | 231 | ranges = <0x02000000 0 0xe0000000 |
234 | 0x02000000 0 0xe0000000 | 232 | 0x02000000 0 0xe0000000 |
diff --git a/arch/powerpc/boot/dts/p4080ds.dts b/arch/powerpc/boot/dts/p4080ds.dts index 6d60e54e50a0..3e204609d02e 100644 --- a/arch/powerpc/boot/dts/p4080ds.dts +++ b/arch/powerpc/boot/dts/p4080ds.dts | |||
@@ -141,7 +141,6 @@ | |||
141 | reg = <0xf 0xfe200000 0 0x1000>; | 141 | reg = <0xf 0xfe200000 0 0x1000>; |
142 | ranges = <0x02000000 0 0xe0000000 0xc 0x00000000 0x0 0x20000000 | 142 | ranges = <0x02000000 0 0xe0000000 0xc 0x00000000 0x0 0x20000000 |
143 | 0x01000000 0 0x00000000 0xf 0xf8000000 0x0 0x00010000>; | 143 | 0x01000000 0 0x00000000 0xf 0xf8000000 0x0 0x00010000>; |
144 | fsl,msi = <&msi0>; | ||
145 | pcie@0 { | 144 | pcie@0 { |
146 | ranges = <0x02000000 0 0xe0000000 | 145 | ranges = <0x02000000 0 0xe0000000 |
147 | 0x02000000 0 0xe0000000 | 146 | 0x02000000 0 0xe0000000 |
@@ -157,7 +156,6 @@ | |||
157 | reg = <0xf 0xfe201000 0 0x1000>; | 156 | reg = <0xf 0xfe201000 0 0x1000>; |
158 | ranges = <0x02000000 0x0 0xe0000000 0xc 0x20000000 0x0 0x20000000 | 157 | ranges = <0x02000000 0x0 0xe0000000 0xc 0x20000000 0x0 0x20000000 |
159 | 0x01000000 0x0 0x00000000 0xf 0xf8010000 0x0 0x00010000>; | 158 | 0x01000000 0x0 0x00000000 0xf 0xf8010000 0x0 0x00010000>; |
160 | fsl,msi = <&msi1>; | ||
161 | pcie@0 { | 159 | pcie@0 { |
162 | ranges = <0x02000000 0 0xe0000000 | 160 | ranges = <0x02000000 0 0xe0000000 |
163 | 0x02000000 0 0xe0000000 | 161 | 0x02000000 0 0xe0000000 |
@@ -173,7 +171,6 @@ | |||
173 | reg = <0xf 0xfe202000 0 0x1000>; | 171 | reg = <0xf 0xfe202000 0 0x1000>; |
174 | ranges = <0x02000000 0 0xe0000000 0xc 0x40000000 0 0x20000000 | 172 | ranges = <0x02000000 0 0xe0000000 0xc 0x40000000 0 0x20000000 |
175 | 0x01000000 0 0x00000000 0xf 0xf8020000 0 0x00010000>; | 173 | 0x01000000 0 0x00000000 0xf 0xf8020000 0 0x00010000>; |
176 | fsl,msi = <&msi2>; | ||
177 | pcie@0 { | 174 | pcie@0 { |
178 | ranges = <0x02000000 0 0xe0000000 | 175 | ranges = <0x02000000 0 0xe0000000 |
179 | 0x02000000 0 0xe0000000 | 176 | 0x02000000 0 0xe0000000 |
diff --git a/arch/powerpc/boot/dts/p5020ds.dts b/arch/powerpc/boot/dts/p5020ds.dts index 1c250684c902..27c07ed6adc1 100644 --- a/arch/powerpc/boot/dts/p5020ds.dts +++ b/arch/powerpc/boot/dts/p5020ds.dts | |||
@@ -173,7 +173,6 @@ | |||
173 | reg = <0xf 0xfe200000 0 0x1000>; | 173 | reg = <0xf 0xfe200000 0 0x1000>; |
174 | ranges = <0x02000000 0 0xe0000000 0xc 0x00000000 0x0 0x20000000 | 174 | ranges = <0x02000000 0 0xe0000000 0xc 0x00000000 0x0 0x20000000 |
175 | 0x01000000 0 0x00000000 0xf 0xf8000000 0x0 0x00010000>; | 175 | 0x01000000 0 0x00000000 0xf 0xf8000000 0x0 0x00010000>; |
176 | fsl,msi = <&msi0>; | ||
177 | pcie@0 { | 176 | pcie@0 { |
178 | ranges = <0x02000000 0 0xe0000000 | 177 | ranges = <0x02000000 0 0xe0000000 |
179 | 0x02000000 0 0xe0000000 | 178 | 0x02000000 0 0xe0000000 |
@@ -189,7 +188,6 @@ | |||
189 | reg = <0xf 0xfe201000 0 0x1000>; | 188 | reg = <0xf 0xfe201000 0 0x1000>; |
190 | ranges = <0x02000000 0x0 0xe0000000 0xc 0x20000000 0x0 0x20000000 | 189 | ranges = <0x02000000 0x0 0xe0000000 0xc 0x20000000 0x0 0x20000000 |
191 | 0x01000000 0x0 0x00000000 0xf 0xf8010000 0x0 0x00010000>; | 190 | 0x01000000 0x0 0x00000000 0xf 0xf8010000 0x0 0x00010000>; |
192 | fsl,msi = <&msi1>; | ||
193 | pcie@0 { | 191 | pcie@0 { |
194 | ranges = <0x02000000 0 0xe0000000 | 192 | ranges = <0x02000000 0 0xe0000000 |
195 | 0x02000000 0 0xe0000000 | 193 | 0x02000000 0 0xe0000000 |
@@ -205,7 +203,6 @@ | |||
205 | reg = <0xf 0xfe202000 0 0x1000>; | 203 | reg = <0xf 0xfe202000 0 0x1000>; |
206 | ranges = <0x02000000 0 0xe0000000 0xc 0x40000000 0 0x20000000 | 204 | ranges = <0x02000000 0 0xe0000000 0xc 0x40000000 0 0x20000000 |
207 | 0x01000000 0 0x00000000 0xf 0xf8020000 0 0x00010000>; | 205 | 0x01000000 0 0x00000000 0xf 0xf8020000 0 0x00010000>; |
208 | fsl,msi = <&msi2>; | ||
209 | pcie@0 { | 206 | pcie@0 { |
210 | ranges = <0x02000000 0 0xe0000000 | 207 | ranges = <0x02000000 0 0xe0000000 |
211 | 0x02000000 0 0xe0000000 | 208 | 0x02000000 0 0xe0000000 |
@@ -221,7 +218,6 @@ | |||
221 | reg = <0xf 0xfe203000 0 0x1000>; | 218 | reg = <0xf 0xfe203000 0 0x1000>; |
222 | ranges = <0x02000000 0 0xe0000000 0xc 0x60000000 0 0x20000000 | 219 | ranges = <0x02000000 0 0xe0000000 0xc 0x60000000 0 0x20000000 |
223 | 0x01000000 0 0x00000000 0xf 0xf8030000 0 0x00010000>; | 220 | 0x01000000 0 0x00000000 0xf 0xf8030000 0 0x00010000>; |
224 | fsl,msi = <&msi2>; | ||
225 | pcie@0 { | 221 | pcie@0 { |
226 | ranges = <0x02000000 0 0xe0000000 | 222 | ranges = <0x02000000 0 0xe0000000 |
227 | 0x02000000 0 0xe0000000 | 223 | 0x02000000 0 0xe0000000 |
diff --git a/arch/powerpc/configs/corenet32_smp_defconfig b/arch/powerpc/configs/corenet32_smp_defconfig index f8aef205d222..91db656294e8 100644 --- a/arch/powerpc/configs/corenet32_smp_defconfig +++ b/arch/powerpc/configs/corenet32_smp_defconfig | |||
@@ -116,6 +116,7 @@ CONFIG_SERIAL_8250_RSA=y | |||
116 | CONFIG_HW_RANDOM=y | 116 | CONFIG_HW_RANDOM=y |
117 | CONFIG_NVRAM=y | 117 | CONFIG_NVRAM=y |
118 | CONFIG_I2C=y | 118 | CONFIG_I2C=y |
119 | CONFIG_I2C_CHARDEV=y | ||
119 | CONFIG_I2C_MPC=y | 120 | CONFIG_I2C_MPC=y |
120 | CONFIG_SPI=y | 121 | CONFIG_SPI=y |
121 | CONFIG_SPI_GPIO=y | 122 | CONFIG_SPI_GPIO=y |
diff --git a/arch/powerpc/configs/corenet64_smp_defconfig b/arch/powerpc/configs/corenet64_smp_defconfig index 82b13bfcf3c0..6798343580f0 100644 --- a/arch/powerpc/configs/corenet64_smp_defconfig +++ b/arch/powerpc/configs/corenet64_smp_defconfig | |||
@@ -71,6 +71,8 @@ CONFIG_SERIAL_8250_MANY_PORTS=y | |||
71 | CONFIG_SERIAL_8250_DETECT_IRQ=y | 71 | CONFIG_SERIAL_8250_DETECT_IRQ=y |
72 | CONFIG_SERIAL_8250_RSA=y | 72 | CONFIG_SERIAL_8250_RSA=y |
73 | CONFIG_I2C=y | 73 | CONFIG_I2C=y |
74 | CONFIG_I2C_CHARDEV=y | ||
75 | CONFIG_I2C_MPC=y | ||
74 | # CONFIG_HWMON is not set | 76 | # CONFIG_HWMON is not set |
75 | CONFIG_VIDEO_OUTPUT_CONTROL=y | 77 | CONFIG_VIDEO_OUTPUT_CONTROL=y |
76 | # CONFIG_HID_SUPPORT is not set | 78 | # CONFIG_HID_SUPPORT is not set |
diff --git a/arch/powerpc/configs/mpc85xx_defconfig b/arch/powerpc/configs/mpc85xx_defconfig index cc87a8441566..d6b6df5e8743 100644 --- a/arch/powerpc/configs/mpc85xx_defconfig +++ b/arch/powerpc/configs/mpc85xx_defconfig | |||
@@ -117,6 +117,7 @@ CONFIG_SERIAL_8250_RSA=y | |||
117 | CONFIG_SERIAL_QE=m | 117 | CONFIG_SERIAL_QE=m |
118 | CONFIG_NVRAM=y | 118 | CONFIG_NVRAM=y |
119 | CONFIG_I2C=y | 119 | CONFIG_I2C=y |
120 | CONFIG_I2C_CHARDEV=y | ||
120 | CONFIG_I2C_CPM=m | 121 | CONFIG_I2C_CPM=m |
121 | CONFIG_I2C_MPC=y | 122 | CONFIG_I2C_MPC=y |
122 | CONFIG_SPI=y | 123 | CONFIG_SPI=y |
diff --git a/arch/powerpc/configs/mpc85xx_smp_defconfig b/arch/powerpc/configs/mpc85xx_smp_defconfig index 48d6682f2434..5b0e2926becd 100644 --- a/arch/powerpc/configs/mpc85xx_smp_defconfig +++ b/arch/powerpc/configs/mpc85xx_smp_defconfig | |||
@@ -119,6 +119,7 @@ CONFIG_SERIAL_8250_RSA=y | |||
119 | CONFIG_SERIAL_QE=m | 119 | CONFIG_SERIAL_QE=m |
120 | CONFIG_NVRAM=y | 120 | CONFIG_NVRAM=y |
121 | CONFIG_I2C=y | 121 | CONFIG_I2C=y |
122 | CONFIG_I2C_CHARDEV=y | ||
122 | CONFIG_I2C_CPM=m | 123 | CONFIG_I2C_CPM=m |
123 | CONFIG_I2C_MPC=y | 124 | CONFIG_I2C_MPC=y |
124 | CONFIG_SPI=y | 125 | CONFIG_SPI=y |
diff --git a/arch/powerpc/include/asm/dma-mapping.h b/arch/powerpc/include/asm/dma-mapping.h index dd70fac57ec8..62678e365ca0 100644 --- a/arch/powerpc/include/asm/dma-mapping.h +++ b/arch/powerpc/include/asm/dma-mapping.h | |||
@@ -22,9 +22,11 @@ | |||
22 | 22 | ||
23 | /* Some dma direct funcs must be visible for use in other dma_ops */ | 23 | /* Some dma direct funcs must be visible for use in other dma_ops */ |
24 | extern void *dma_direct_alloc_coherent(struct device *dev, size_t size, | 24 | extern void *dma_direct_alloc_coherent(struct device *dev, size_t size, |
25 | dma_addr_t *dma_handle, gfp_t flag); | 25 | dma_addr_t *dma_handle, gfp_t flag, |
26 | struct dma_attrs *attrs); | ||
26 | extern void dma_direct_free_coherent(struct device *dev, size_t size, | 27 | extern void dma_direct_free_coherent(struct device *dev, size_t size, |
27 | void *vaddr, dma_addr_t dma_handle); | 28 | void *vaddr, dma_addr_t dma_handle, |
29 | struct dma_attrs *attrs); | ||
28 | 30 | ||
29 | 31 | ||
30 | #ifdef CONFIG_NOT_COHERENT_CACHE | 32 | #ifdef CONFIG_NOT_COHERENT_CACHE |
@@ -130,23 +132,29 @@ static inline int dma_supported(struct device *dev, u64 mask) | |||
130 | 132 | ||
131 | extern int dma_set_mask(struct device *dev, u64 dma_mask); | 133 | extern int dma_set_mask(struct device *dev, u64 dma_mask); |
132 | 134 | ||
133 | static inline void *dma_alloc_coherent(struct device *dev, size_t size, | 135 | #define dma_alloc_coherent(d,s,h,f) dma_alloc_attrs(d,s,h,f,NULL) |
134 | dma_addr_t *dma_handle, gfp_t flag) | 136 | |
137 | static inline void *dma_alloc_attrs(struct device *dev, size_t size, | ||
138 | dma_addr_t *dma_handle, gfp_t flag, | ||
139 | struct dma_attrs *attrs) | ||
135 | { | 140 | { |
136 | struct dma_map_ops *dma_ops = get_dma_ops(dev); | 141 | struct dma_map_ops *dma_ops = get_dma_ops(dev); |
137 | void *cpu_addr; | 142 | void *cpu_addr; |
138 | 143 | ||
139 | BUG_ON(!dma_ops); | 144 | BUG_ON(!dma_ops); |
140 | 145 | ||
141 | cpu_addr = dma_ops->alloc_coherent(dev, size, dma_handle, flag); | 146 | cpu_addr = dma_ops->alloc(dev, size, dma_handle, flag, attrs); |
142 | 147 | ||
143 | debug_dma_alloc_coherent(dev, size, *dma_handle, cpu_addr); | 148 | debug_dma_alloc_coherent(dev, size, *dma_handle, cpu_addr); |
144 | 149 | ||
145 | return cpu_addr; | 150 | return cpu_addr; |
146 | } | 151 | } |
147 | 152 | ||
148 | static inline void dma_free_coherent(struct device *dev, size_t size, | 153 | #define dma_free_coherent(d,s,c,h) dma_free_attrs(d,s,c,h,NULL) |
149 | void *cpu_addr, dma_addr_t dma_handle) | 154 | |
155 | static inline void dma_free_attrs(struct device *dev, size_t size, | ||
156 | void *cpu_addr, dma_addr_t dma_handle, | ||
157 | struct dma_attrs *attrs) | ||
150 | { | 158 | { |
151 | struct dma_map_ops *dma_ops = get_dma_ops(dev); | 159 | struct dma_map_ops *dma_ops = get_dma_ops(dev); |
152 | 160 | ||
@@ -154,7 +162,7 @@ static inline void dma_free_coherent(struct device *dev, size_t size, | |||
154 | 162 | ||
155 | debug_dma_free_coherent(dev, size, cpu_addr, dma_handle); | 163 | debug_dma_free_coherent(dev, size, cpu_addr, dma_handle); |
156 | 164 | ||
157 | dma_ops->free_coherent(dev, size, cpu_addr, dma_handle); | 165 | dma_ops->free(dev, size, cpu_addr, dma_handle, attrs); |
158 | } | 166 | } |
159 | 167 | ||
160 | static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr) | 168 | static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr) |
diff --git a/arch/powerpc/include/asm/epapr_hcalls.h b/arch/powerpc/include/asm/epapr_hcalls.h index f3b0c2cc9fea..976835d8f22e 100644 --- a/arch/powerpc/include/asm/epapr_hcalls.h +++ b/arch/powerpc/include/asm/epapr_hcalls.h | |||
@@ -134,10 +134,15 @@ | |||
134 | * whether they will be clobbered. | 134 | * whether they will be clobbered. |
135 | * | 135 | * |
136 | * Note that r11 can be used as an output parameter. | 136 | * Note that r11 can be used as an output parameter. |
137 | * | ||
138 | * The "memory" clobber is only necessary for hcalls where the Hypervisor | ||
139 | * will read or write guest memory. However, we add it to all hcalls because | ||
140 | * the impact is minimal, and we want to ensure that it's present for the | ||
141 | * hcalls that need it. | ||
137 | */ | 142 | */ |
138 | 143 | ||
139 | /* List of common clobbered registers. Do not use this macro. */ | 144 | /* List of common clobbered registers. Do not use this macro. */ |
140 | #define EV_HCALL_CLOBBERS "r0", "r12", "xer", "ctr", "lr", "cc" | 145 | #define EV_HCALL_CLOBBERS "r0", "r12", "xer", "ctr", "lr", "cc", "memory" |
141 | 146 | ||
142 | #define EV_HCALL_CLOBBERS8 EV_HCALL_CLOBBERS | 147 | #define EV_HCALL_CLOBBERS8 EV_HCALL_CLOBBERS |
143 | #define EV_HCALL_CLOBBERS7 EV_HCALL_CLOBBERS8, "r10" | 148 | #define EV_HCALL_CLOBBERS7 EV_HCALL_CLOBBERS8, "r10" |
diff --git a/arch/powerpc/include/asm/fsl_guts.h b/arch/powerpc/include/asm/fsl_guts.h index ce04530d2000..aa4c488589ce 100644 --- a/arch/powerpc/include/asm/fsl_guts.h +++ b/arch/powerpc/include/asm/fsl_guts.h | |||
@@ -16,15 +16,6 @@ | |||
16 | #define __ASM_POWERPC_FSL_GUTS_H__ | 16 | #define __ASM_POWERPC_FSL_GUTS_H__ |
17 | #ifdef __KERNEL__ | 17 | #ifdef __KERNEL__ |
18 | 18 | ||
19 | /* | ||
20 | * These #ifdefs are safe because it's not possible to build a kernel that | ||
21 | * runs on e500 and e600 cores. | ||
22 | */ | ||
23 | |||
24 | #if !defined(CONFIG_PPC_85xx) && !defined(CONFIG_PPC_86xx) | ||
25 | #error Only 85xx and 86xx SOCs are supported | ||
26 | #endif | ||
27 | |||
28 | /** | 19 | /** |
29 | * Global Utility Registers. | 20 | * Global Utility Registers. |
30 | * | 21 | * |
@@ -36,11 +27,7 @@ | |||
36 | * different names. In these cases, one name is chosen to avoid extraneous | 27 | * different names. In these cases, one name is chosen to avoid extraneous |
37 | * #ifdefs. | 28 | * #ifdefs. |
38 | */ | 29 | */ |
39 | #ifdef CONFIG_PPC_85xx | 30 | struct ccsr_guts { |
40 | struct ccsr_guts_85xx { | ||
41 | #else | ||
42 | struct ccsr_guts_86xx { | ||
43 | #endif | ||
44 | __be32 porpllsr; /* 0x.0000 - POR PLL Ratio Status Register */ | 31 | __be32 porpllsr; /* 0x.0000 - POR PLL Ratio Status Register */ |
45 | __be32 porbmsr; /* 0x.0004 - POR Boot Mode Status Register */ | 32 | __be32 porbmsr; /* 0x.0004 - POR Boot Mode Status Register */ |
46 | __be32 porimpscr; /* 0x.0008 - POR I/O Impedance Status and Control Register */ | 33 | __be32 porimpscr; /* 0x.0008 - POR I/O Impedance Status and Control Register */ |
@@ -77,11 +64,8 @@ struct ccsr_guts_86xx { | |||
77 | u8 res0a8[0xb0 - 0xa8]; | 64 | u8 res0a8[0xb0 - 0xa8]; |
78 | __be32 rstcr; /* 0x.00b0 - Reset Control Register */ | 65 | __be32 rstcr; /* 0x.00b0 - Reset Control Register */ |
79 | u8 res0b4[0xc0 - 0xb4]; | 66 | u8 res0b4[0xc0 - 0xb4]; |
80 | #ifdef CONFIG_PPC_85xx | 67 | __be32 iovselsr; /* 0x.00c0 - I/O voltage select status register |
81 | __be32 iovselsr; /* 0x.00c0 - I/O voltage select status register */ | 68 | Called 'elbcvselcr' on 86xx SOCs */ |
82 | #else | ||
83 | __be32 elbcvselcr; /* 0x.00c0 - eLBC Voltage Select Ctrl Reg */ | ||
84 | #endif | ||
85 | u8 res0c4[0x224 - 0xc4]; | 69 | u8 res0c4[0x224 - 0xc4]; |
86 | __be32 iodelay1; /* 0x.0224 - IO delay control register 1 */ | 70 | __be32 iodelay1; /* 0x.0224 - IO delay control register 1 */ |
87 | __be32 iodelay2; /* 0x.0228 - IO delay control register 2 */ | 71 | __be32 iodelay2; /* 0x.0228 - IO delay control register 2 */ |
@@ -136,7 +120,7 @@ struct ccsr_guts_86xx { | |||
136 | * ch: The channel on the DMA controller (0, 1, 2, or 3) | 120 | * ch: The channel on the DMA controller (0, 1, 2, or 3) |
137 | * device: The device to set as the source (CCSR_GUTS_DMACR_DEV_xx) | 121 | * device: The device to set as the source (CCSR_GUTS_DMACR_DEV_xx) |
138 | */ | 122 | */ |
139 | static inline void guts_set_dmacr(struct ccsr_guts_86xx __iomem *guts, | 123 | static inline void guts_set_dmacr(struct ccsr_guts __iomem *guts, |
140 | unsigned int co, unsigned int ch, unsigned int device) | 124 | unsigned int co, unsigned int ch, unsigned int device) |
141 | { | 125 | { |
142 | unsigned int shift = 16 + (8 * (1 - co) + 2 * (3 - ch)); | 126 | unsigned int shift = 16 + (8 * (1 - co) + 2 * (3 - ch)); |
@@ -172,7 +156,7 @@ static inline void guts_set_dmacr(struct ccsr_guts_86xx __iomem *guts, | |||
172 | * ch: The channel on the DMA controller (0, 1, 2, or 3) | 156 | * ch: The channel on the DMA controller (0, 1, 2, or 3) |
173 | * value: the new value for the bit (0 or 1) | 157 | * value: the new value for the bit (0 or 1) |
174 | */ | 158 | */ |
175 | static inline void guts_set_pmuxcr_dma(struct ccsr_guts_86xx __iomem *guts, | 159 | static inline void guts_set_pmuxcr_dma(struct ccsr_guts __iomem *guts, |
176 | unsigned int co, unsigned int ch, unsigned int value) | 160 | unsigned int co, unsigned int ch, unsigned int value) |
177 | { | 161 | { |
178 | if ((ch == 0) || (ch == 3)) { | 162 | if ((ch == 0) || (ch == 3)) { |
diff --git a/arch/powerpc/kernel/dma-iommu.c b/arch/powerpc/kernel/dma-iommu.c index 3f6464b4d970..bcfdcd22c766 100644 --- a/arch/powerpc/kernel/dma-iommu.c +++ b/arch/powerpc/kernel/dma-iommu.c | |||
@@ -17,7 +17,8 @@ | |||
17 | * to the dma address (mapping) of the first page. | 17 | * to the dma address (mapping) of the first page. |
18 | */ | 18 | */ |
19 | static void *dma_iommu_alloc_coherent(struct device *dev, size_t size, | 19 | static void *dma_iommu_alloc_coherent(struct device *dev, size_t size, |
20 | dma_addr_t *dma_handle, gfp_t flag) | 20 | dma_addr_t *dma_handle, gfp_t flag, |
21 | struct dma_attrs *attrs) | ||
21 | { | 22 | { |
22 | return iommu_alloc_coherent(dev, get_iommu_table_base(dev), size, | 23 | return iommu_alloc_coherent(dev, get_iommu_table_base(dev), size, |
23 | dma_handle, dev->coherent_dma_mask, flag, | 24 | dma_handle, dev->coherent_dma_mask, flag, |
@@ -25,7 +26,8 @@ static void *dma_iommu_alloc_coherent(struct device *dev, size_t size, | |||
25 | } | 26 | } |
26 | 27 | ||
27 | static void dma_iommu_free_coherent(struct device *dev, size_t size, | 28 | static void dma_iommu_free_coherent(struct device *dev, size_t size, |
28 | void *vaddr, dma_addr_t dma_handle) | 29 | void *vaddr, dma_addr_t dma_handle, |
30 | struct dma_attrs *attrs) | ||
29 | { | 31 | { |
30 | iommu_free_coherent(get_iommu_table_base(dev), size, vaddr, dma_handle); | 32 | iommu_free_coherent(get_iommu_table_base(dev), size, vaddr, dma_handle); |
31 | } | 33 | } |
@@ -105,8 +107,8 @@ static u64 dma_iommu_get_required_mask(struct device *dev) | |||
105 | } | 107 | } |
106 | 108 | ||
107 | struct dma_map_ops dma_iommu_ops = { | 109 | struct dma_map_ops dma_iommu_ops = { |
108 | .alloc_coherent = dma_iommu_alloc_coherent, | 110 | .alloc = dma_iommu_alloc_coherent, |
109 | .free_coherent = dma_iommu_free_coherent, | 111 | .free = dma_iommu_free_coherent, |
110 | .map_sg = dma_iommu_map_sg, | 112 | .map_sg = dma_iommu_map_sg, |
111 | .unmap_sg = dma_iommu_unmap_sg, | 113 | .unmap_sg = dma_iommu_unmap_sg, |
112 | .dma_supported = dma_iommu_dma_supported, | 114 | .dma_supported = dma_iommu_dma_supported, |
diff --git a/arch/powerpc/kernel/dma-swiotlb.c b/arch/powerpc/kernel/dma-swiotlb.c index 1ebc9189aada..4ab88dafb235 100644 --- a/arch/powerpc/kernel/dma-swiotlb.c +++ b/arch/powerpc/kernel/dma-swiotlb.c | |||
@@ -47,8 +47,8 @@ static u64 swiotlb_powerpc_get_required(struct device *dev) | |||
47 | * for everything else. | 47 | * for everything else. |
48 | */ | 48 | */ |
49 | struct dma_map_ops swiotlb_dma_ops = { | 49 | struct dma_map_ops swiotlb_dma_ops = { |
50 | .alloc_coherent = dma_direct_alloc_coherent, | 50 | .alloc = dma_direct_alloc_coherent, |
51 | .free_coherent = dma_direct_free_coherent, | 51 | .free = dma_direct_free_coherent, |
52 | .map_sg = swiotlb_map_sg_attrs, | 52 | .map_sg = swiotlb_map_sg_attrs, |
53 | .unmap_sg = swiotlb_unmap_sg_attrs, | 53 | .unmap_sg = swiotlb_unmap_sg_attrs, |
54 | .dma_supported = swiotlb_dma_supported, | 54 | .dma_supported = swiotlb_dma_supported, |
diff --git a/arch/powerpc/kernel/dma.c b/arch/powerpc/kernel/dma.c index 7d0233c12ee3..b1ec983dcec8 100644 --- a/arch/powerpc/kernel/dma.c +++ b/arch/powerpc/kernel/dma.c | |||
@@ -26,7 +26,8 @@ | |||
26 | 26 | ||
27 | 27 | ||
28 | void *dma_direct_alloc_coherent(struct device *dev, size_t size, | 28 | void *dma_direct_alloc_coherent(struct device *dev, size_t size, |
29 | dma_addr_t *dma_handle, gfp_t flag) | 29 | dma_addr_t *dma_handle, gfp_t flag, |
30 | struct dma_attrs *attrs) | ||
30 | { | 31 | { |
31 | void *ret; | 32 | void *ret; |
32 | #ifdef CONFIG_NOT_COHERENT_CACHE | 33 | #ifdef CONFIG_NOT_COHERENT_CACHE |
@@ -54,7 +55,8 @@ void *dma_direct_alloc_coherent(struct device *dev, size_t size, | |||
54 | } | 55 | } |
55 | 56 | ||
56 | void dma_direct_free_coherent(struct device *dev, size_t size, | 57 | void dma_direct_free_coherent(struct device *dev, size_t size, |
57 | void *vaddr, dma_addr_t dma_handle) | 58 | void *vaddr, dma_addr_t dma_handle, |
59 | struct dma_attrs *attrs) | ||
58 | { | 60 | { |
59 | #ifdef CONFIG_NOT_COHERENT_CACHE | 61 | #ifdef CONFIG_NOT_COHERENT_CACHE |
60 | __dma_free_coherent(size, vaddr); | 62 | __dma_free_coherent(size, vaddr); |
@@ -150,8 +152,8 @@ static inline void dma_direct_sync_single(struct device *dev, | |||
150 | #endif | 152 | #endif |
151 | 153 | ||
152 | struct dma_map_ops dma_direct_ops = { | 154 | struct dma_map_ops dma_direct_ops = { |
153 | .alloc_coherent = dma_direct_alloc_coherent, | 155 | .alloc = dma_direct_alloc_coherent, |
154 | .free_coherent = dma_direct_free_coherent, | 156 | .free = dma_direct_free_coherent, |
155 | .map_sg = dma_direct_map_sg, | 157 | .map_sg = dma_direct_map_sg, |
156 | .unmap_sg = dma_direct_unmap_sg, | 158 | .unmap_sg = dma_direct_unmap_sg, |
157 | .dma_supported = dma_direct_dma_supported, | 159 | .dma_supported = dma_direct_dma_supported, |
diff --git a/arch/powerpc/kernel/fadump.c b/arch/powerpc/kernel/fadump.c index cfe7a38708c3..18bdf74fa164 100644 --- a/arch/powerpc/kernel/fadump.c +++ b/arch/powerpc/kernel/fadump.c | |||
@@ -40,6 +40,8 @@ | |||
40 | #include <asm/prom.h> | 40 | #include <asm/prom.h> |
41 | #include <asm/rtas.h> | 41 | #include <asm/rtas.h> |
42 | #include <asm/fadump.h> | 42 | #include <asm/fadump.h> |
43 | #include <asm/debug.h> | ||
44 | #include <asm/setup.h> | ||
43 | 45 | ||
44 | static struct fw_dump fw_dump; | 46 | static struct fw_dump fw_dump; |
45 | static struct fadump_mem_struct fdm; | 47 | static struct fadump_mem_struct fdm; |
diff --git a/arch/powerpc/kernel/ibmebus.c b/arch/powerpc/kernel/ibmebus.c index 79bb282e6501..b01d14eeca8d 100644 --- a/arch/powerpc/kernel/ibmebus.c +++ b/arch/powerpc/kernel/ibmebus.c | |||
@@ -65,7 +65,8 @@ static struct of_device_id __initdata ibmebus_matches[] = { | |||
65 | static void *ibmebus_alloc_coherent(struct device *dev, | 65 | static void *ibmebus_alloc_coherent(struct device *dev, |
66 | size_t size, | 66 | size_t size, |
67 | dma_addr_t *dma_handle, | 67 | dma_addr_t *dma_handle, |
68 | gfp_t flag) | 68 | gfp_t flag, |
69 | struct dma_attrs *attrs) | ||
69 | { | 70 | { |
70 | void *mem; | 71 | void *mem; |
71 | 72 | ||
@@ -77,7 +78,8 @@ static void *ibmebus_alloc_coherent(struct device *dev, | |||
77 | 78 | ||
78 | static void ibmebus_free_coherent(struct device *dev, | 79 | static void ibmebus_free_coherent(struct device *dev, |
79 | size_t size, void *vaddr, | 80 | size_t size, void *vaddr, |
80 | dma_addr_t dma_handle) | 81 | dma_addr_t dma_handle, |
82 | struct dma_attrs *attrs) | ||
81 | { | 83 | { |
82 | kfree(vaddr); | 84 | kfree(vaddr); |
83 | } | 85 | } |
@@ -136,8 +138,8 @@ static u64 ibmebus_dma_get_required_mask(struct device *dev) | |||
136 | } | 138 | } |
137 | 139 | ||
138 | static struct dma_map_ops ibmebus_dma_ops = { | 140 | static struct dma_map_ops ibmebus_dma_ops = { |
139 | .alloc_coherent = ibmebus_alloc_coherent, | 141 | .alloc = ibmebus_alloc_coherent, |
140 | .free_coherent = ibmebus_free_coherent, | 142 | .free = ibmebus_free_coherent, |
141 | .map_sg = ibmebus_map_sg, | 143 | .map_sg = ibmebus_map_sg, |
142 | .unmap_sg = ibmebus_unmap_sg, | 144 | .unmap_sg = ibmebus_unmap_sg, |
143 | .dma_supported = ibmebus_dma_supported, | 145 | .dma_supported = ibmebus_dma_supported, |
diff --git a/arch/powerpc/kernel/kgdb.c b/arch/powerpc/kernel/kgdb.c index 76a6e40a6f7c..782bd0a3c2f0 100644 --- a/arch/powerpc/kernel/kgdb.c +++ b/arch/powerpc/kernel/kgdb.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <asm/current.h> | 24 | #include <asm/current.h> |
25 | #include <asm/processor.h> | 25 | #include <asm/processor.h> |
26 | #include <asm/machdep.h> | 26 | #include <asm/machdep.h> |
27 | #include <asm/debug.h> | ||
27 | 28 | ||
28 | /* | 29 | /* |
29 | * This table contains the mapping between PowerPC hardware trap types, and | 30 | * This table contains the mapping between PowerPC hardware trap types, and |
diff --git a/arch/powerpc/kernel/vio.c b/arch/powerpc/kernel/vio.c index b2f7c8480bf6..a3a99901c8ec 100644 --- a/arch/powerpc/kernel/vio.c +++ b/arch/powerpc/kernel/vio.c | |||
@@ -482,7 +482,8 @@ static void vio_cmo_balance(struct work_struct *work) | |||
482 | } | 482 | } |
483 | 483 | ||
484 | static void *vio_dma_iommu_alloc_coherent(struct device *dev, size_t size, | 484 | static void *vio_dma_iommu_alloc_coherent(struct device *dev, size_t size, |
485 | dma_addr_t *dma_handle, gfp_t flag) | 485 | dma_addr_t *dma_handle, gfp_t flag, |
486 | struct dma_attrs *attrs) | ||
486 | { | 487 | { |
487 | struct vio_dev *viodev = to_vio_dev(dev); | 488 | struct vio_dev *viodev = to_vio_dev(dev); |
488 | void *ret; | 489 | void *ret; |
@@ -492,7 +493,7 @@ static void *vio_dma_iommu_alloc_coherent(struct device *dev, size_t size, | |||
492 | return NULL; | 493 | return NULL; |
493 | } | 494 | } |
494 | 495 | ||
495 | ret = dma_iommu_ops.alloc_coherent(dev, size, dma_handle, flag); | 496 | ret = dma_iommu_ops.alloc(dev, size, dma_handle, flag, attrs); |
496 | if (unlikely(ret == NULL)) { | 497 | if (unlikely(ret == NULL)) { |
497 | vio_cmo_dealloc(viodev, roundup(size, PAGE_SIZE)); | 498 | vio_cmo_dealloc(viodev, roundup(size, PAGE_SIZE)); |
498 | atomic_inc(&viodev->cmo.allocs_failed); | 499 | atomic_inc(&viodev->cmo.allocs_failed); |
@@ -502,11 +503,12 @@ static void *vio_dma_iommu_alloc_coherent(struct device *dev, size_t size, | |||
502 | } | 503 | } |
503 | 504 | ||
504 | static void vio_dma_iommu_free_coherent(struct device *dev, size_t size, | 505 | static void vio_dma_iommu_free_coherent(struct device *dev, size_t size, |
505 | void *vaddr, dma_addr_t dma_handle) | 506 | void *vaddr, dma_addr_t dma_handle, |
507 | struct dma_attrs *attrs) | ||
506 | { | 508 | { |
507 | struct vio_dev *viodev = to_vio_dev(dev); | 509 | struct vio_dev *viodev = to_vio_dev(dev); |
508 | 510 | ||
509 | dma_iommu_ops.free_coherent(dev, size, vaddr, dma_handle); | 511 | dma_iommu_ops.free(dev, size, vaddr, dma_handle, attrs); |
510 | 512 | ||
511 | vio_cmo_dealloc(viodev, roundup(size, PAGE_SIZE)); | 513 | vio_cmo_dealloc(viodev, roundup(size, PAGE_SIZE)); |
512 | } | 514 | } |
@@ -607,8 +609,8 @@ static u64 vio_dma_get_required_mask(struct device *dev) | |||
607 | } | 609 | } |
608 | 610 | ||
609 | struct dma_map_ops vio_dma_mapping_ops = { | 611 | struct dma_map_ops vio_dma_mapping_ops = { |
610 | .alloc_coherent = vio_dma_iommu_alloc_coherent, | 612 | .alloc = vio_dma_iommu_alloc_coherent, |
611 | .free_coherent = vio_dma_iommu_free_coherent, | 613 | .free = vio_dma_iommu_free_coherent, |
612 | .map_sg = vio_dma_iommu_map_sg, | 614 | .map_sg = vio_dma_iommu_map_sg, |
613 | .unmap_sg = vio_dma_iommu_unmap_sg, | 615 | .unmap_sg = vio_dma_iommu_unmap_sg, |
614 | .map_page = vio_dma_iommu_map_page, | 616 | .map_page = vio_dma_iommu_map_page, |
diff --git a/arch/powerpc/kvm/book3s_emulate.c b/arch/powerpc/kvm/book3s_emulate.c index f1950d131827..135663a3e4fc 100644 --- a/arch/powerpc/kvm/book3s_emulate.c +++ b/arch/powerpc/kvm/book3s_emulate.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <asm/disassemble.h> | 21 | #include <asm/disassemble.h> |
22 | #include <asm/kvm_book3s.h> | 22 | #include <asm/kvm_book3s.h> |
23 | #include <asm/reg.h> | 23 | #include <asm/reg.h> |
24 | #include <asm/switch_to.h> | ||
24 | 25 | ||
25 | #define OP_19_XOP_RFID 18 | 26 | #define OP_19_XOP_RFID 18 |
26 | #define OP_19_XOP_RFI 50 | 27 | #define OP_19_XOP_RFI 50 |
diff --git a/arch/powerpc/kvm/book3s_paired_singles.c b/arch/powerpc/kvm/book3s_paired_singles.c index e70ef2d86431..a59a25a13218 100644 --- a/arch/powerpc/kvm/book3s_paired_singles.c +++ b/arch/powerpc/kvm/book3s_paired_singles.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <asm/kvm_fpu.h> | 24 | #include <asm/kvm_fpu.h> |
25 | #include <asm/reg.h> | 25 | #include <asm/reg.h> |
26 | #include <asm/cacheflush.h> | 26 | #include <asm/cacheflush.h> |
27 | #include <asm/switch_to.h> | ||
27 | #include <linux/vmalloc.h> | 28 | #include <linux/vmalloc.h> |
28 | 29 | ||
29 | /* #define DEBUG */ | 30 | /* #define DEBUG */ |
diff --git a/arch/powerpc/kvm/book3s_pr.c b/arch/powerpc/kvm/book3s_pr.c index 7340e1090b77..642d88574b07 100644 --- a/arch/powerpc/kvm/book3s_pr.c +++ b/arch/powerpc/kvm/book3s_pr.c | |||
@@ -33,6 +33,7 @@ | |||
33 | #include <asm/kvm_ppc.h> | 33 | #include <asm/kvm_ppc.h> |
34 | #include <asm/kvm_book3s.h> | 34 | #include <asm/kvm_book3s.h> |
35 | #include <asm/mmu_context.h> | 35 | #include <asm/mmu_context.h> |
36 | #include <asm/switch_to.h> | ||
36 | #include <linux/gfp.h> | 37 | #include <linux/gfp.h> |
37 | #include <linux/sched.h> | 38 | #include <linux/sched.h> |
38 | #include <linux/vmalloc.h> | 39 | #include <linux/vmalloc.h> |
diff --git a/arch/powerpc/platforms/52xx/mpc52xx_pci.c b/arch/powerpc/platforms/52xx/mpc52xx_pci.c index bfb11e01133e..e2d401ad8fbb 100644 --- a/arch/powerpc/platforms/52xx/mpc52xx_pci.c +++ b/arch/powerpc/platforms/52xx/mpc52xx_pci.c | |||
@@ -93,7 +93,7 @@ struct mpc52xx_pci { | |||
93 | }; | 93 | }; |
94 | 94 | ||
95 | /* MPC5200 device tree match tables */ | 95 | /* MPC5200 device tree match tables */ |
96 | const struct of_device_id mpc52xx_pci_ids[] __initdata = { | 96 | const struct of_device_id mpc52xx_pci_ids[] __initconst = { |
97 | { .type = "pci", .compatible = "fsl,mpc5200-pci", }, | 97 | { .type = "pci", .compatible = "fsl,mpc5200-pci", }, |
98 | { .type = "pci", .compatible = "mpc5200-pci", }, | 98 | { .type = "pci", .compatible = "mpc5200-pci", }, |
99 | {} | 99 | {} |
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_mds.c b/arch/powerpc/platforms/85xx/mpc85xx_mds.c index 3754ddc00af7..9a6f04406e0d 100644 --- a/arch/powerpc/platforms/85xx/mpc85xx_mds.c +++ b/arch/powerpc/platforms/85xx/mpc85xx_mds.c | |||
@@ -270,7 +270,7 @@ static void __init mpc85xx_mds_qe_init(void) | |||
270 | 270 | ||
271 | if (machine_is(p1021_mds)) { | 271 | if (machine_is(p1021_mds)) { |
272 | 272 | ||
273 | struct ccsr_guts_85xx __iomem *guts; | 273 | struct ccsr_guts __iomem *guts; |
274 | 274 | ||
275 | np = of_find_node_by_name(NULL, "global-utilities"); | 275 | np = of_find_node_by_name(NULL, "global-utilities"); |
276 | if (np) { | 276 | if (np) { |
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_rdb.c b/arch/powerpc/platforms/85xx/mpc85xx_rdb.c index 9848f9e39853..313fce4f5574 100644 --- a/arch/powerpc/platforms/85xx/mpc85xx_rdb.c +++ b/arch/powerpc/platforms/85xx/mpc85xx_rdb.c | |||
@@ -127,7 +127,7 @@ static void __init mpc85xx_rdb_setup_arch(void) | |||
127 | #if defined(CONFIG_UCC_GETH) || defined(CONFIG_SERIAL_QE) | 127 | #if defined(CONFIG_UCC_GETH) || defined(CONFIG_SERIAL_QE) |
128 | if (machine_is(p1025_rdb)) { | 128 | if (machine_is(p1025_rdb)) { |
129 | 129 | ||
130 | struct ccsr_guts_85xx __iomem *guts; | 130 | struct ccsr_guts __iomem *guts; |
131 | 131 | ||
132 | np = of_find_node_by_name(NULL, "global-utilities"); | 132 | np = of_find_node_by_name(NULL, "global-utilities"); |
133 | if (np) { | 133 | if (np) { |
diff --git a/arch/powerpc/platforms/85xx/p1022_ds.c b/arch/powerpc/platforms/85xx/p1022_ds.c index 0fe88e39945e..e74b7cde9aee 100644 --- a/arch/powerpc/platforms/85xx/p1022_ds.c +++ b/arch/powerpc/platforms/85xx/p1022_ds.c | |||
@@ -150,7 +150,7 @@ static void p1022ds_set_monitor_port(enum fsl_diu_monitor_port port) | |||
150 | { | 150 | { |
151 | struct device_node *guts_node; | 151 | struct device_node *guts_node; |
152 | struct device_node *indirect_node = NULL; | 152 | struct device_node *indirect_node = NULL; |
153 | struct ccsr_guts_85xx __iomem *guts; | 153 | struct ccsr_guts __iomem *guts; |
154 | u8 __iomem *lbc_lcs0_ba = NULL; | 154 | u8 __iomem *lbc_lcs0_ba = NULL; |
155 | u8 __iomem *lbc_lcs1_ba = NULL; | 155 | u8 __iomem *lbc_lcs1_ba = NULL; |
156 | u8 b; | 156 | u8 b; |
@@ -269,7 +269,7 @@ exit: | |||
269 | void p1022ds_set_pixel_clock(unsigned int pixclock) | 269 | void p1022ds_set_pixel_clock(unsigned int pixclock) |
270 | { | 270 | { |
271 | struct device_node *guts_np = NULL; | 271 | struct device_node *guts_np = NULL; |
272 | struct ccsr_guts_85xx __iomem *guts; | 272 | struct ccsr_guts __iomem *guts; |
273 | unsigned long freq; | 273 | unsigned long freq; |
274 | u64 temp; | 274 | u64 temp; |
275 | u32 pxclk; | 275 | u32 pxclk; |
diff --git a/arch/powerpc/platforms/86xx/mpc8610_hpcd.c b/arch/powerpc/platforms/86xx/mpc8610_hpcd.c index bbc615206c67..62cd3c555bfb 100644 --- a/arch/powerpc/platforms/86xx/mpc8610_hpcd.c +++ b/arch/powerpc/platforms/86xx/mpc8610_hpcd.c | |||
@@ -225,7 +225,7 @@ void mpc8610hpcd_set_monitor_port(enum fsl_diu_monitor_port port) | |||
225 | void mpc8610hpcd_set_pixel_clock(unsigned int pixclock) | 225 | void mpc8610hpcd_set_pixel_clock(unsigned int pixclock) |
226 | { | 226 | { |
227 | struct device_node *guts_np = NULL; | 227 | struct device_node *guts_np = NULL; |
228 | struct ccsr_guts_86xx __iomem *guts; | 228 | struct ccsr_guts __iomem *guts; |
229 | unsigned long freq; | 229 | unsigned long freq; |
230 | u64 temp; | 230 | u64 temp; |
231 | u32 pxclk; | 231 | u32 pxclk; |
diff --git a/arch/powerpc/platforms/cell/iommu.c b/arch/powerpc/platforms/cell/iommu.c index ae9fc7bc17d6..b9f509a34c01 100644 --- a/arch/powerpc/platforms/cell/iommu.c +++ b/arch/powerpc/platforms/cell/iommu.c | |||
@@ -564,7 +564,8 @@ static struct iommu_table *cell_get_iommu_table(struct device *dev) | |||
564 | /* A coherent allocation implies strong ordering */ | 564 | /* A coherent allocation implies strong ordering */ |
565 | 565 | ||
566 | static void *dma_fixed_alloc_coherent(struct device *dev, size_t size, | 566 | static void *dma_fixed_alloc_coherent(struct device *dev, size_t size, |
567 | dma_addr_t *dma_handle, gfp_t flag) | 567 | dma_addr_t *dma_handle, gfp_t flag, |
568 | struct dma_attrs *attrs) | ||
568 | { | 569 | { |
569 | if (iommu_fixed_is_weak) | 570 | if (iommu_fixed_is_weak) |
570 | return iommu_alloc_coherent(dev, cell_get_iommu_table(dev), | 571 | return iommu_alloc_coherent(dev, cell_get_iommu_table(dev), |
@@ -572,18 +573,19 @@ static void *dma_fixed_alloc_coherent(struct device *dev, size_t size, | |||
572 | device_to_mask(dev), flag, | 573 | device_to_mask(dev), flag, |
573 | dev_to_node(dev)); | 574 | dev_to_node(dev)); |
574 | else | 575 | else |
575 | return dma_direct_ops.alloc_coherent(dev, size, dma_handle, | 576 | return dma_direct_ops.alloc(dev, size, dma_handle, flag, |
576 | flag); | 577 | attrs); |
577 | } | 578 | } |
578 | 579 | ||
579 | static void dma_fixed_free_coherent(struct device *dev, size_t size, | 580 | static void dma_fixed_free_coherent(struct device *dev, size_t size, |
580 | void *vaddr, dma_addr_t dma_handle) | 581 | void *vaddr, dma_addr_t dma_handle, |
582 | struct dma_attrs *attrs) | ||
581 | { | 583 | { |
582 | if (iommu_fixed_is_weak) | 584 | if (iommu_fixed_is_weak) |
583 | iommu_free_coherent(cell_get_iommu_table(dev), size, vaddr, | 585 | iommu_free_coherent(cell_get_iommu_table(dev), size, vaddr, |
584 | dma_handle); | 586 | dma_handle); |
585 | else | 587 | else |
586 | dma_direct_ops.free_coherent(dev, size, vaddr, dma_handle); | 588 | dma_direct_ops.free(dev, size, vaddr, dma_handle, attrs); |
587 | } | 589 | } |
588 | 590 | ||
589 | static dma_addr_t dma_fixed_map_page(struct device *dev, struct page *page, | 591 | static dma_addr_t dma_fixed_map_page(struct device *dev, struct page *page, |
@@ -642,8 +644,8 @@ static int dma_fixed_dma_supported(struct device *dev, u64 mask) | |||
642 | static int dma_set_mask_and_switch(struct device *dev, u64 dma_mask); | 644 | static int dma_set_mask_and_switch(struct device *dev, u64 dma_mask); |
643 | 645 | ||
644 | struct dma_map_ops dma_iommu_fixed_ops = { | 646 | struct dma_map_ops dma_iommu_fixed_ops = { |
645 | .alloc_coherent = dma_fixed_alloc_coherent, | 647 | .alloc = dma_fixed_alloc_coherent, |
646 | .free_coherent = dma_fixed_free_coherent, | 648 | .free = dma_fixed_free_coherent, |
647 | .map_sg = dma_fixed_map_sg, | 649 | .map_sg = dma_fixed_map_sg, |
648 | .unmap_sg = dma_fixed_unmap_sg, | 650 | .unmap_sg = dma_fixed_unmap_sg, |
649 | .dma_supported = dma_fixed_dma_supported, | 651 | .dma_supported = dma_fixed_dma_supported, |
diff --git a/arch/powerpc/platforms/cell/qpace_setup.c b/arch/powerpc/platforms/cell/qpace_setup.c index 7f9b6742f8b6..6e3409d590ac 100644 --- a/arch/powerpc/platforms/cell/qpace_setup.c +++ b/arch/powerpc/platforms/cell/qpace_setup.c | |||
@@ -61,7 +61,7 @@ static void qpace_progress(char *s, unsigned short hex) | |||
61 | printk("*** %04x : %s\n", hex, s ? s : ""); | 61 | printk("*** %04x : %s\n", hex, s ? s : ""); |
62 | } | 62 | } |
63 | 63 | ||
64 | static const struct of_device_id qpace_bus_ids[] __initdata = { | 64 | static const struct of_device_id qpace_bus_ids[] __initconst = { |
65 | { .type = "soc", }, | 65 | { .type = "soc", }, |
66 | { .compatible = "soc", }, | 66 | { .compatible = "soc", }, |
67 | { .type = "spider", }, | 67 | { .type = "spider", }, |
diff --git a/arch/powerpc/platforms/cell/setup.c b/arch/powerpc/platforms/cell/setup.c index fa3e294fd343..4ab087671185 100644 --- a/arch/powerpc/platforms/cell/setup.c +++ b/arch/powerpc/platforms/cell/setup.c | |||
@@ -140,7 +140,7 @@ static int __devinit cell_setup_phb(struct pci_controller *phb) | |||
140 | return 0; | 140 | return 0; |
141 | } | 141 | } |
142 | 142 | ||
143 | static const struct of_device_id cell_bus_ids[] __initdata = { | 143 | static const struct of_device_id cell_bus_ids[] __initconst = { |
144 | { .type = "soc", }, | 144 | { .type = "soc", }, |
145 | { .compatible = "soc", }, | 145 | { .compatible = "soc", }, |
146 | { .type = "spider", }, | 146 | { .type = "spider", }, |
diff --git a/arch/powerpc/platforms/ps3/system-bus.c b/arch/powerpc/platforms/ps3/system-bus.c index 880eb9ce22c5..5606fe36faf2 100644 --- a/arch/powerpc/platforms/ps3/system-bus.c +++ b/arch/powerpc/platforms/ps3/system-bus.c | |||
@@ -515,7 +515,8 @@ core_initcall(ps3_system_bus_init); | |||
515 | * to the dma address (mapping) of the first page. | 515 | * to the dma address (mapping) of the first page. |
516 | */ | 516 | */ |
517 | static void * ps3_alloc_coherent(struct device *_dev, size_t size, | 517 | static void * ps3_alloc_coherent(struct device *_dev, size_t size, |
518 | dma_addr_t *dma_handle, gfp_t flag) | 518 | dma_addr_t *dma_handle, gfp_t flag, |
519 | struct dma_attrs *attrs) | ||
519 | { | 520 | { |
520 | int result; | 521 | int result; |
521 | struct ps3_system_bus_device *dev = ps3_dev_to_system_bus_dev(_dev); | 522 | struct ps3_system_bus_device *dev = ps3_dev_to_system_bus_dev(_dev); |
@@ -552,7 +553,7 @@ clean_none: | |||
552 | } | 553 | } |
553 | 554 | ||
554 | static void ps3_free_coherent(struct device *_dev, size_t size, void *vaddr, | 555 | static void ps3_free_coherent(struct device *_dev, size_t size, void *vaddr, |
555 | dma_addr_t dma_handle) | 556 | dma_addr_t dma_handle, struct dma_attrs *attrs) |
556 | { | 557 | { |
557 | struct ps3_system_bus_device *dev = ps3_dev_to_system_bus_dev(_dev); | 558 | struct ps3_system_bus_device *dev = ps3_dev_to_system_bus_dev(_dev); |
558 | 559 | ||
@@ -701,8 +702,8 @@ static u64 ps3_dma_get_required_mask(struct device *_dev) | |||
701 | } | 702 | } |
702 | 703 | ||
703 | static struct dma_map_ops ps3_sb_dma_ops = { | 704 | static struct dma_map_ops ps3_sb_dma_ops = { |
704 | .alloc_coherent = ps3_alloc_coherent, | 705 | .alloc = ps3_alloc_coherent, |
705 | .free_coherent = ps3_free_coherent, | 706 | .free = ps3_free_coherent, |
706 | .map_sg = ps3_sb_map_sg, | 707 | .map_sg = ps3_sb_map_sg, |
707 | .unmap_sg = ps3_sb_unmap_sg, | 708 | .unmap_sg = ps3_sb_unmap_sg, |
708 | .dma_supported = ps3_dma_supported, | 709 | .dma_supported = ps3_dma_supported, |
@@ -712,8 +713,8 @@ static struct dma_map_ops ps3_sb_dma_ops = { | |||
712 | }; | 713 | }; |
713 | 714 | ||
714 | static struct dma_map_ops ps3_ioc0_dma_ops = { | 715 | static struct dma_map_ops ps3_ioc0_dma_ops = { |
715 | .alloc_coherent = ps3_alloc_coherent, | 716 | .alloc = ps3_alloc_coherent, |
716 | .free_coherent = ps3_free_coherent, | 717 | .free = ps3_free_coherent, |
717 | .map_sg = ps3_ioc0_map_sg, | 718 | .map_sg = ps3_ioc0_map_sg, |
718 | .unmap_sg = ps3_ioc0_unmap_sg, | 719 | .unmap_sg = ps3_ioc0_unmap_sg, |
719 | .dma_supported = ps3_dma_supported, | 720 | .dma_supported = ps3_dma_supported, |
diff --git a/arch/powerpc/platforms/pseries/eeh_event.c b/arch/powerpc/platforms/pseries/eeh_event.c index 4a4752565856..4cb375c0f8d1 100644 --- a/arch/powerpc/platforms/pseries/eeh_event.c +++ b/arch/powerpc/platforms/pseries/eeh_event.c | |||
@@ -59,8 +59,7 @@ static int eeh_event_handler(void * dummy) | |||
59 | struct eeh_event *event; | 59 | struct eeh_event *event; |
60 | struct eeh_dev *edev; | 60 | struct eeh_dev *edev; |
61 | 61 | ||
62 | daemonize("eehd"); | 62 | set_task_comm(current, "eehd"); |
63 | set_current_state(TASK_INTERRUPTIBLE); | ||
64 | 63 | ||
65 | spin_lock_irqsave(&eeh_eventlist_lock, flags); | 64 | spin_lock_irqsave(&eeh_eventlist_lock, flags); |
66 | event = NULL; | 65 | event = NULL; |
@@ -83,6 +82,7 @@ static int eeh_event_handler(void * dummy) | |||
83 | printk(KERN_INFO "EEH: Detected PCI bus error on device %s\n", | 82 | printk(KERN_INFO "EEH: Detected PCI bus error on device %s\n", |
84 | eeh_pci_name(edev->pdev)); | 83 | eeh_pci_name(edev->pdev)); |
85 | 84 | ||
85 | set_current_state(TASK_INTERRUPTIBLE); /* Don't add to load average */ | ||
86 | edev = handle_eeh_events(event); | 86 | edev = handle_eeh_events(event); |
87 | 87 | ||
88 | eeh_clear_slot(eeh_dev_to_of_node(edev), EEH_MODE_RECOVERING); | 88 | eeh_clear_slot(eeh_dev_to_of_node(edev), EEH_MODE_RECOVERING); |
diff --git a/arch/powerpc/sysdev/qe_lib/qe.c b/arch/powerpc/sysdev/qe_lib/qe.c index ceb09cbd2329..818e763f8265 100644 --- a/arch/powerpc/sysdev/qe_lib/qe.c +++ b/arch/powerpc/sysdev/qe_lib/qe.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2006 Freescale Semicondutor, Inc. All rights reserved. | 2 | * Copyright (C) 2006-2010 Freescale Semicondutor, Inc. All rights reserved. |
3 | * | 3 | * |
4 | * Authors: Shlomi Gridish <gridish@freescale.com> | 4 | * Authors: Shlomi Gridish <gridish@freescale.com> |
5 | * Li Yang <leoli@freescale.com> | 5 | * Li Yang <leoli@freescale.com> |
@@ -266,7 +266,19 @@ EXPORT_SYMBOL(qe_clock_source); | |||
266 | static void qe_snums_init(void) | 266 | static void qe_snums_init(void) |
267 | { | 267 | { |
268 | int i; | 268 | int i; |
269 | static const u8 snum_init[] = { | 269 | static const u8 snum_init_76[] = { |
270 | 0x04, 0x05, 0x0C, 0x0D, 0x14, 0x15, 0x1C, 0x1D, | ||
271 | 0x24, 0x25, 0x2C, 0x2D, 0x34, 0x35, 0x88, 0x89, | ||
272 | 0x98, 0x99, 0xA8, 0xA9, 0xB8, 0xB9, 0xC8, 0xC9, | ||
273 | 0xD8, 0xD9, 0xE8, 0xE9, 0x44, 0x45, 0x4C, 0x4D, | ||
274 | 0x54, 0x55, 0x5C, 0x5D, 0x64, 0x65, 0x6C, 0x6D, | ||
275 | 0x74, 0x75, 0x7C, 0x7D, 0x84, 0x85, 0x8C, 0x8D, | ||
276 | 0x94, 0x95, 0x9C, 0x9D, 0xA4, 0xA5, 0xAC, 0xAD, | ||
277 | 0xB4, 0xB5, 0xBC, 0xBD, 0xC4, 0xC5, 0xCC, 0xCD, | ||
278 | 0xD4, 0xD5, 0xDC, 0xDD, 0xE4, 0xE5, 0xEC, 0xED, | ||
279 | 0xF4, 0xF5, 0xFC, 0xFD, | ||
280 | }; | ||
281 | static const u8 snum_init_46[] = { | ||
270 | 0x04, 0x05, 0x0C, 0x0D, 0x14, 0x15, 0x1C, 0x1D, | 282 | 0x04, 0x05, 0x0C, 0x0D, 0x14, 0x15, 0x1C, 0x1D, |
271 | 0x24, 0x25, 0x2C, 0x2D, 0x34, 0x35, 0x88, 0x89, | 283 | 0x24, 0x25, 0x2C, 0x2D, 0x34, 0x35, 0x88, 0x89, |
272 | 0x98, 0x99, 0xA8, 0xA9, 0xB8, 0xB9, 0xC8, 0xC9, | 284 | 0x98, 0x99, 0xA8, 0xA9, 0xB8, 0xB9, 0xC8, 0xC9, |
@@ -274,9 +286,15 @@ static void qe_snums_init(void) | |||
274 | 0x28, 0x29, 0x38, 0x39, 0x48, 0x49, 0x58, 0x59, | 286 | 0x28, 0x29, 0x38, 0x39, 0x48, 0x49, 0x58, 0x59, |
275 | 0x68, 0x69, 0x78, 0x79, 0x80, 0x81, | 287 | 0x68, 0x69, 0x78, 0x79, 0x80, 0x81, |
276 | }; | 288 | }; |
289 | static const u8 *snum_init; | ||
277 | 290 | ||
278 | qe_num_of_snum = qe_get_num_of_snums(); | 291 | qe_num_of_snum = qe_get_num_of_snums(); |
279 | 292 | ||
293 | if (qe_num_of_snum == 76) | ||
294 | snum_init = snum_init_76; | ||
295 | else | ||
296 | snum_init = snum_init_46; | ||
297 | |||
280 | for (i = 0; i < qe_num_of_snum; i++) { | 298 | for (i = 0; i < qe_num_of_snum; i++) { |
281 | snums[i].num = snum_init[i]; | 299 | snums[i].num = snum_init[i]; |
282 | snums[i].state = QE_SNUM_STATE_FREE; | 300 | snums[i].state = QE_SNUM_STATE_FREE; |
diff --git a/arch/sh/include/asm/dma-mapping.h b/arch/sh/include/asm/dma-mapping.h index 1a73c3e759a7..8bd965e00a15 100644 --- a/arch/sh/include/asm/dma-mapping.h +++ b/arch/sh/include/asm/dma-mapping.h | |||
@@ -52,25 +52,31 @@ static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr) | |||
52 | return dma_addr == 0; | 52 | return dma_addr == 0; |
53 | } | 53 | } |
54 | 54 | ||
55 | static inline void *dma_alloc_coherent(struct device *dev, size_t size, | 55 | #define dma_alloc_coherent(d,s,h,f) dma_alloc_attrs(d,s,h,f,NULL) |
56 | dma_addr_t *dma_handle, gfp_t gfp) | 56 | |
57 | static inline void *dma_alloc_attrs(struct device *dev, size_t size, | ||
58 | dma_addr_t *dma_handle, gfp_t gfp, | ||
59 | struct dma_attrs *attrs) | ||
57 | { | 60 | { |
58 | struct dma_map_ops *ops = get_dma_ops(dev); | 61 | struct dma_map_ops *ops = get_dma_ops(dev); |
59 | void *memory; | 62 | void *memory; |
60 | 63 | ||
61 | if (dma_alloc_from_coherent(dev, size, dma_handle, &memory)) | 64 | if (dma_alloc_from_coherent(dev, size, dma_handle, &memory)) |
62 | return memory; | 65 | return memory; |
63 | if (!ops->alloc_coherent) | 66 | if (!ops->alloc) |
64 | return NULL; | 67 | return NULL; |
65 | 68 | ||
66 | memory = ops->alloc_coherent(dev, size, dma_handle, gfp); | 69 | memory = ops->alloc(dev, size, dma_handle, gfp, attrs); |
67 | debug_dma_alloc_coherent(dev, size, *dma_handle, memory); | 70 | debug_dma_alloc_coherent(dev, size, *dma_handle, memory); |
68 | 71 | ||
69 | return memory; | 72 | return memory; |
70 | } | 73 | } |
71 | 74 | ||
72 | static inline void dma_free_coherent(struct device *dev, size_t size, | 75 | #define dma_free_coherent(d,s,c,h) dma_free_attrs(d,s,c,h,NULL) |
73 | void *vaddr, dma_addr_t dma_handle) | 76 | |
77 | static inline void dma_free_attrs(struct device *dev, size_t size, | ||
78 | void *vaddr, dma_addr_t dma_handle, | ||
79 | struct dma_attrs *attrs) | ||
74 | { | 80 | { |
75 | struct dma_map_ops *ops = get_dma_ops(dev); | 81 | struct dma_map_ops *ops = get_dma_ops(dev); |
76 | 82 | ||
@@ -78,14 +84,16 @@ static inline void dma_free_coherent(struct device *dev, size_t size, | |||
78 | return; | 84 | return; |
79 | 85 | ||
80 | debug_dma_free_coherent(dev, size, vaddr, dma_handle); | 86 | debug_dma_free_coherent(dev, size, vaddr, dma_handle); |
81 | if (ops->free_coherent) | 87 | if (ops->free) |
82 | ops->free_coherent(dev, size, vaddr, dma_handle); | 88 | ops->free(dev, size, vaddr, dma_handle, attrs); |
83 | } | 89 | } |
84 | 90 | ||
85 | /* arch/sh/mm/consistent.c */ | 91 | /* arch/sh/mm/consistent.c */ |
86 | extern void *dma_generic_alloc_coherent(struct device *dev, size_t size, | 92 | extern void *dma_generic_alloc_coherent(struct device *dev, size_t size, |
87 | dma_addr_t *dma_addr, gfp_t flag); | 93 | dma_addr_t *dma_addr, gfp_t flag, |
94 | struct dma_attrs *attrs); | ||
88 | extern void dma_generic_free_coherent(struct device *dev, size_t size, | 95 | extern void dma_generic_free_coherent(struct device *dev, size_t size, |
89 | void *vaddr, dma_addr_t dma_handle); | 96 | void *vaddr, dma_addr_t dma_handle, |
97 | struct dma_attrs *attrs); | ||
90 | 98 | ||
91 | #endif /* __ASM_SH_DMA_MAPPING_H */ | 99 | #endif /* __ASM_SH_DMA_MAPPING_H */ |
diff --git a/arch/sh/kernel/dma-nommu.c b/arch/sh/kernel/dma-nommu.c index 3c55b87f8b63..5b0bfcda6d0b 100644 --- a/arch/sh/kernel/dma-nommu.c +++ b/arch/sh/kernel/dma-nommu.c | |||
@@ -63,8 +63,8 @@ static void nommu_sync_sg(struct device *dev, struct scatterlist *sg, | |||
63 | #endif | 63 | #endif |
64 | 64 | ||
65 | struct dma_map_ops nommu_dma_ops = { | 65 | struct dma_map_ops nommu_dma_ops = { |
66 | .alloc_coherent = dma_generic_alloc_coherent, | 66 | .alloc = dma_generic_alloc_coherent, |
67 | .free_coherent = dma_generic_free_coherent, | 67 | .free = dma_generic_free_coherent, |
68 | .map_page = nommu_map_page, | 68 | .map_page = nommu_map_page, |
69 | .map_sg = nommu_map_sg, | 69 | .map_sg = nommu_map_sg, |
70 | #ifdef CONFIG_DMA_NONCOHERENT | 70 | #ifdef CONFIG_DMA_NONCOHERENT |
diff --git a/arch/sh/mm/consistent.c b/arch/sh/mm/consistent.c index f251b5f27652..b81d9dbf9fef 100644 --- a/arch/sh/mm/consistent.c +++ b/arch/sh/mm/consistent.c | |||
@@ -33,7 +33,8 @@ static int __init dma_init(void) | |||
33 | fs_initcall(dma_init); | 33 | fs_initcall(dma_init); |
34 | 34 | ||
35 | void *dma_generic_alloc_coherent(struct device *dev, size_t size, | 35 | void *dma_generic_alloc_coherent(struct device *dev, size_t size, |
36 | dma_addr_t *dma_handle, gfp_t gfp) | 36 | dma_addr_t *dma_handle, gfp_t gfp, |
37 | struct dma_attrs *attrs) | ||
37 | { | 38 | { |
38 | void *ret, *ret_nocache; | 39 | void *ret, *ret_nocache; |
39 | int order = get_order(size); | 40 | int order = get_order(size); |
@@ -64,7 +65,8 @@ void *dma_generic_alloc_coherent(struct device *dev, size_t size, | |||
64 | } | 65 | } |
65 | 66 | ||
66 | void dma_generic_free_coherent(struct device *dev, size_t size, | 67 | void dma_generic_free_coherent(struct device *dev, size_t size, |
67 | void *vaddr, dma_addr_t dma_handle) | 68 | void *vaddr, dma_addr_t dma_handle, |
69 | struct dma_attrs *attrs) | ||
68 | { | 70 | { |
69 | int order = get_order(size); | 71 | int order = get_order(size); |
70 | unsigned long pfn = dma_handle >> PAGE_SHIFT; | 72 | unsigned long pfn = dma_handle >> PAGE_SHIFT; |
diff --git a/arch/sparc/include/asm/dma-mapping.h b/arch/sparc/include/asm/dma-mapping.h index 8c0e4f7bb204..48a7c65731d2 100644 --- a/arch/sparc/include/asm/dma-mapping.h +++ b/arch/sparc/include/asm/dma-mapping.h | |||
@@ -26,24 +26,30 @@ static inline struct dma_map_ops *get_dma_ops(struct device *dev) | |||
26 | 26 | ||
27 | #include <asm-generic/dma-mapping-common.h> | 27 | #include <asm-generic/dma-mapping-common.h> |
28 | 28 | ||
29 | static inline void *dma_alloc_coherent(struct device *dev, size_t size, | 29 | #define dma_alloc_coherent(d,s,h,f) dma_alloc_attrs(d,s,h,f,NULL) |
30 | dma_addr_t *dma_handle, gfp_t flag) | 30 | |
31 | static inline void *dma_alloc_attrs(struct device *dev, size_t size, | ||
32 | dma_addr_t *dma_handle, gfp_t flag, | ||
33 | struct dma_attrs *attrs) | ||
31 | { | 34 | { |
32 | struct dma_map_ops *ops = get_dma_ops(dev); | 35 | struct dma_map_ops *ops = get_dma_ops(dev); |
33 | void *cpu_addr; | 36 | void *cpu_addr; |
34 | 37 | ||
35 | cpu_addr = ops->alloc_coherent(dev, size, dma_handle, flag); | 38 | cpu_addr = ops->alloc(dev, size, dma_handle, flag, attrs); |
36 | debug_dma_alloc_coherent(dev, size, *dma_handle, cpu_addr); | 39 | debug_dma_alloc_coherent(dev, size, *dma_handle, cpu_addr); |
37 | return cpu_addr; | 40 | return cpu_addr; |
38 | } | 41 | } |
39 | 42 | ||
40 | static inline void dma_free_coherent(struct device *dev, size_t size, | 43 | #define dma_free_coherent(d,s,c,h) dma_free_attrs(d,s,c,h,NULL) |
41 | void *cpu_addr, dma_addr_t dma_handle) | 44 | |
45 | static inline void dma_free_attrs(struct device *dev, size_t size, | ||
46 | void *cpu_addr, dma_addr_t dma_handle, | ||
47 | struct dma_attrs *attrs) | ||
42 | { | 48 | { |
43 | struct dma_map_ops *ops = get_dma_ops(dev); | 49 | struct dma_map_ops *ops = get_dma_ops(dev); |
44 | 50 | ||
45 | debug_dma_free_coherent(dev, size, cpu_addr, dma_handle); | 51 | debug_dma_free_coherent(dev, size, cpu_addr, dma_handle); |
46 | ops->free_coherent(dev, size, cpu_addr, dma_handle); | 52 | ops->free(dev, size, cpu_addr, dma_handle, attrs); |
47 | } | 53 | } |
48 | 54 | ||
49 | static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr) | 55 | static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr) |
diff --git a/arch/sparc/include/asm/pgtable_64.h b/arch/sparc/include/asm/pgtable_64.h index 6fa2f7980e6b..76e4a52aa85e 100644 --- a/arch/sparc/include/asm/pgtable_64.h +++ b/arch/sparc/include/asm/pgtable_64.h | |||
@@ -12,8 +12,6 @@ | |||
12 | * the SpitFire page tables. | 12 | * the SpitFire page tables. |
13 | */ | 13 | */ |
14 | 14 | ||
15 | #include <asm-generic/pgtable-nopud.h> | ||
16 | |||
17 | #include <linux/compiler.h> | 15 | #include <linux/compiler.h> |
18 | #include <linux/const.h> | 16 | #include <linux/const.h> |
19 | #include <asm/types.h> | 17 | #include <asm/types.h> |
@@ -22,6 +20,8 @@ | |||
22 | #include <asm/page.h> | 20 | #include <asm/page.h> |
23 | #include <asm/processor.h> | 21 | #include <asm/processor.h> |
24 | 22 | ||
23 | #include <asm-generic/pgtable-nopud.h> | ||
24 | |||
25 | /* The kernel image occupies 0x4000000 to 0x6000000 (4MB --> 96MB). | 25 | /* The kernel image occupies 0x4000000 to 0x6000000 (4MB --> 96MB). |
26 | * The page copy blockops can use 0x6000000 to 0x8000000. | 26 | * The page copy blockops can use 0x6000000 to 0x8000000. |
27 | * The TSB is mapped in the 0x8000000 to 0xa000000 range. | 27 | * The TSB is mapped in the 0x8000000 to 0xa000000 range. |
diff --git a/arch/sparc/kernel/iommu.c b/arch/sparc/kernel/iommu.c index 4643d68713fa..070ed141aac7 100644 --- a/arch/sparc/kernel/iommu.c +++ b/arch/sparc/kernel/iommu.c | |||
@@ -280,7 +280,8 @@ static inline void iommu_free_ctx(struct iommu *iommu, int ctx) | |||
280 | } | 280 | } |
281 | 281 | ||
282 | static void *dma_4u_alloc_coherent(struct device *dev, size_t size, | 282 | static void *dma_4u_alloc_coherent(struct device *dev, size_t size, |
283 | dma_addr_t *dma_addrp, gfp_t gfp) | 283 | dma_addr_t *dma_addrp, gfp_t gfp, |
284 | struct dma_attrs *attrs) | ||
284 | { | 285 | { |
285 | unsigned long flags, order, first_page; | 286 | unsigned long flags, order, first_page; |
286 | struct iommu *iommu; | 287 | struct iommu *iommu; |
@@ -330,7 +331,8 @@ static void *dma_4u_alloc_coherent(struct device *dev, size_t size, | |||
330 | } | 331 | } |
331 | 332 | ||
332 | static void dma_4u_free_coherent(struct device *dev, size_t size, | 333 | static void dma_4u_free_coherent(struct device *dev, size_t size, |
333 | void *cpu, dma_addr_t dvma) | 334 | void *cpu, dma_addr_t dvma, |
335 | struct dma_attrs *attrs) | ||
334 | { | 336 | { |
335 | struct iommu *iommu; | 337 | struct iommu *iommu; |
336 | unsigned long flags, order, npages; | 338 | unsigned long flags, order, npages; |
@@ -825,8 +827,8 @@ static void dma_4u_sync_sg_for_cpu(struct device *dev, | |||
825 | } | 827 | } |
826 | 828 | ||
827 | static struct dma_map_ops sun4u_dma_ops = { | 829 | static struct dma_map_ops sun4u_dma_ops = { |
828 | .alloc_coherent = dma_4u_alloc_coherent, | 830 | .alloc = dma_4u_alloc_coherent, |
829 | .free_coherent = dma_4u_free_coherent, | 831 | .free = dma_4u_free_coherent, |
830 | .map_page = dma_4u_map_page, | 832 | .map_page = dma_4u_map_page, |
831 | .unmap_page = dma_4u_unmap_page, | 833 | .unmap_page = dma_4u_unmap_page, |
832 | .map_sg = dma_4u_map_sg, | 834 | .map_sg = dma_4u_map_sg, |
diff --git a/arch/sparc/kernel/ioport.c b/arch/sparc/kernel/ioport.c index d0479e2163fa..21bd73943f7f 100644 --- a/arch/sparc/kernel/ioport.c +++ b/arch/sparc/kernel/ioport.c | |||
@@ -261,7 +261,8 @@ EXPORT_SYMBOL(sbus_set_sbus64); | |||
261 | * CPU may access them without any explicit flushing. | 261 | * CPU may access them without any explicit flushing. |
262 | */ | 262 | */ |
263 | static void *sbus_alloc_coherent(struct device *dev, size_t len, | 263 | static void *sbus_alloc_coherent(struct device *dev, size_t len, |
264 | dma_addr_t *dma_addrp, gfp_t gfp) | 264 | dma_addr_t *dma_addrp, gfp_t gfp, |
265 | struct dma_attrs *attrs) | ||
265 | { | 266 | { |
266 | struct platform_device *op = to_platform_device(dev); | 267 | struct platform_device *op = to_platform_device(dev); |
267 | unsigned long len_total = PAGE_ALIGN(len); | 268 | unsigned long len_total = PAGE_ALIGN(len); |
@@ -315,7 +316,7 @@ err_nopages: | |||
315 | } | 316 | } |
316 | 317 | ||
317 | static void sbus_free_coherent(struct device *dev, size_t n, void *p, | 318 | static void sbus_free_coherent(struct device *dev, size_t n, void *p, |
318 | dma_addr_t ba) | 319 | dma_addr_t ba, struct dma_attrs *attrs) |
319 | { | 320 | { |
320 | struct resource *res; | 321 | struct resource *res; |
321 | struct page *pgv; | 322 | struct page *pgv; |
@@ -407,8 +408,8 @@ static void sbus_sync_sg_for_device(struct device *dev, struct scatterlist *sg, | |||
407 | } | 408 | } |
408 | 409 | ||
409 | struct dma_map_ops sbus_dma_ops = { | 410 | struct dma_map_ops sbus_dma_ops = { |
410 | .alloc_coherent = sbus_alloc_coherent, | 411 | .alloc = sbus_alloc_coherent, |
411 | .free_coherent = sbus_free_coherent, | 412 | .free = sbus_free_coherent, |
412 | .map_page = sbus_map_page, | 413 | .map_page = sbus_map_page, |
413 | .unmap_page = sbus_unmap_page, | 414 | .unmap_page = sbus_unmap_page, |
414 | .map_sg = sbus_map_sg, | 415 | .map_sg = sbus_map_sg, |
@@ -436,7 +437,8 @@ arch_initcall(sparc_register_ioport); | |||
436 | * hwdev should be valid struct pci_dev pointer for PCI devices. | 437 | * hwdev should be valid struct pci_dev pointer for PCI devices. |
437 | */ | 438 | */ |
438 | static void *pci32_alloc_coherent(struct device *dev, size_t len, | 439 | static void *pci32_alloc_coherent(struct device *dev, size_t len, |
439 | dma_addr_t *pba, gfp_t gfp) | 440 | dma_addr_t *pba, gfp_t gfp, |
441 | struct dma_attrs *attrs) | ||
440 | { | 442 | { |
441 | unsigned long len_total = PAGE_ALIGN(len); | 443 | unsigned long len_total = PAGE_ALIGN(len); |
442 | void *va; | 444 | void *va; |
@@ -489,7 +491,7 @@ err_nopages: | |||
489 | * past this call are illegal. | 491 | * past this call are illegal. |
490 | */ | 492 | */ |
491 | static void pci32_free_coherent(struct device *dev, size_t n, void *p, | 493 | static void pci32_free_coherent(struct device *dev, size_t n, void *p, |
492 | dma_addr_t ba) | 494 | dma_addr_t ba, struct dma_attrs *attrs) |
493 | { | 495 | { |
494 | struct resource *res; | 496 | struct resource *res; |
495 | 497 | ||
@@ -645,8 +647,8 @@ static void pci32_sync_sg_for_device(struct device *device, struct scatterlist * | |||
645 | } | 647 | } |
646 | 648 | ||
647 | struct dma_map_ops pci32_dma_ops = { | 649 | struct dma_map_ops pci32_dma_ops = { |
648 | .alloc_coherent = pci32_alloc_coherent, | 650 | .alloc = pci32_alloc_coherent, |
649 | .free_coherent = pci32_free_coherent, | 651 | .free = pci32_free_coherent, |
650 | .map_page = pci32_map_page, | 652 | .map_page = pci32_map_page, |
651 | .unmap_page = pci32_unmap_page, | 653 | .unmap_page = pci32_unmap_page, |
652 | .map_sg = pci32_map_sg, | 654 | .map_sg = pci32_map_sg, |
diff --git a/arch/sparc/kernel/leon_kernel.c b/arch/sparc/kernel/leon_kernel.c index a19c8a063683..35e43673c453 100644 --- a/arch/sparc/kernel/leon_kernel.c +++ b/arch/sparc/kernel/leon_kernel.c | |||
@@ -104,11 +104,11 @@ static int irq_choose_cpu(const struct cpumask *affinity) | |||
104 | { | 104 | { |
105 | cpumask_t mask; | 105 | cpumask_t mask; |
106 | 106 | ||
107 | cpus_and(mask, cpu_online_map, *affinity); | 107 | cpumask_and(&mask, cpu_online_mask, affinity); |
108 | if (cpus_equal(mask, cpu_online_map) || cpus_empty(mask)) | 108 | if (cpumask_equal(&mask, cpu_online_mask) || cpumask_empty(&mask)) |
109 | return boot_cpu_id; | 109 | return boot_cpu_id; |
110 | else | 110 | else |
111 | return first_cpu(mask); | 111 | return cpumask_first(&mask); |
112 | } | 112 | } |
113 | #else | 113 | #else |
114 | #define irq_choose_cpu(affinity) boot_cpu_id | 114 | #define irq_choose_cpu(affinity) boot_cpu_id |
diff --git a/arch/sparc/kernel/pci_sun4v.c b/arch/sparc/kernel/pci_sun4v.c index af5755d20fbe..7661e84a05a0 100644 --- a/arch/sparc/kernel/pci_sun4v.c +++ b/arch/sparc/kernel/pci_sun4v.c | |||
@@ -128,7 +128,8 @@ static inline long iommu_batch_end(void) | |||
128 | } | 128 | } |
129 | 129 | ||
130 | static void *dma_4v_alloc_coherent(struct device *dev, size_t size, | 130 | static void *dma_4v_alloc_coherent(struct device *dev, size_t size, |
131 | dma_addr_t *dma_addrp, gfp_t gfp) | 131 | dma_addr_t *dma_addrp, gfp_t gfp, |
132 | struct dma_attrs *attrs) | ||
132 | { | 133 | { |
133 | unsigned long flags, order, first_page, npages, n; | 134 | unsigned long flags, order, first_page, npages, n; |
134 | struct iommu *iommu; | 135 | struct iommu *iommu; |
@@ -198,7 +199,7 @@ range_alloc_fail: | |||
198 | } | 199 | } |
199 | 200 | ||
200 | static void dma_4v_free_coherent(struct device *dev, size_t size, void *cpu, | 201 | static void dma_4v_free_coherent(struct device *dev, size_t size, void *cpu, |
201 | dma_addr_t dvma) | 202 | dma_addr_t dvma, struct dma_attrs *attrs) |
202 | { | 203 | { |
203 | struct pci_pbm_info *pbm; | 204 | struct pci_pbm_info *pbm; |
204 | struct iommu *iommu; | 205 | struct iommu *iommu; |
@@ -527,8 +528,8 @@ static void dma_4v_unmap_sg(struct device *dev, struct scatterlist *sglist, | |||
527 | } | 528 | } |
528 | 529 | ||
529 | static struct dma_map_ops sun4v_dma_ops = { | 530 | static struct dma_map_ops sun4v_dma_ops = { |
530 | .alloc_coherent = dma_4v_alloc_coherent, | 531 | .alloc = dma_4v_alloc_coherent, |
531 | .free_coherent = dma_4v_free_coherent, | 532 | .free = dma_4v_free_coherent, |
532 | .map_page = dma_4v_map_page, | 533 | .map_page = dma_4v_map_page, |
533 | .unmap_page = dma_4v_unmap_page, | 534 | .unmap_page = dma_4v_unmap_page, |
534 | .map_sg = dma_4v_map_sg, | 535 | .map_sg = dma_4v_map_sg, |
diff --git a/arch/tile/kernel/setup.c b/arch/tile/kernel/setup.c index 5f85d8b34dbb..92a94f4920ad 100644 --- a/arch/tile/kernel/setup.c +++ b/arch/tile/kernel/setup.c | |||
@@ -1100,7 +1100,7 @@ EXPORT_SYMBOL(hash_for_home_map); | |||
1100 | 1100 | ||
1101 | /* | 1101 | /* |
1102 | * cpu_cacheable_map lists all the cpus whose caches the hypervisor can | 1102 | * cpu_cacheable_map lists all the cpus whose caches the hypervisor can |
1103 | * flush on our behalf. It is set to cpu_possible_map OR'ed with | 1103 | * flush on our behalf. It is set to cpu_possible_mask OR'ed with |
1104 | * hash_for_home_map, and it is what should be passed to | 1104 | * hash_for_home_map, and it is what should be passed to |
1105 | * hv_flush_remote() to flush all caches. Note that if there are | 1105 | * hv_flush_remote() to flush all caches. Note that if there are |
1106 | * dedicated hypervisor driver tiles that have authorized use of their | 1106 | * dedicated hypervisor driver tiles that have authorized use of their |
@@ -1186,7 +1186,7 @@ static void __init setup_cpu_maps(void) | |||
1186 | sizeof(cpu_lotar_map)); | 1186 | sizeof(cpu_lotar_map)); |
1187 | if (rc < 0) { | 1187 | if (rc < 0) { |
1188 | pr_err("warning: no HV_INQ_TILES_LOTAR; using AVAIL\n"); | 1188 | pr_err("warning: no HV_INQ_TILES_LOTAR; using AVAIL\n"); |
1189 | cpu_lotar_map = cpu_possible_map; | 1189 | cpu_lotar_map = *cpu_possible_mask; |
1190 | } | 1190 | } |
1191 | 1191 | ||
1192 | #if CHIP_HAS_CBOX_HOME_MAP() | 1192 | #if CHIP_HAS_CBOX_HOME_MAP() |
@@ -1196,9 +1196,9 @@ static void __init setup_cpu_maps(void) | |||
1196 | sizeof(hash_for_home_map)); | 1196 | sizeof(hash_for_home_map)); |
1197 | if (rc < 0) | 1197 | if (rc < 0) |
1198 | early_panic("hv_inquire_tiles(HFH_CACHE) failed: rc %d\n", rc); | 1198 | early_panic("hv_inquire_tiles(HFH_CACHE) failed: rc %d\n", rc); |
1199 | cpumask_or(&cpu_cacheable_map, &cpu_possible_map, &hash_for_home_map); | 1199 | cpumask_or(&cpu_cacheable_map, cpu_possible_mask, &hash_for_home_map); |
1200 | #else | 1200 | #else |
1201 | cpu_cacheable_map = cpu_possible_map; | 1201 | cpu_cacheable_map = *cpu_possible_mask; |
1202 | #endif | 1202 | #endif |
1203 | } | 1203 | } |
1204 | 1204 | ||
diff --git a/arch/um/kernel/skas/process.c b/arch/um/kernel/skas/process.c index 2e9852c0d487..0a9e57e7446b 100644 --- a/arch/um/kernel/skas/process.c +++ b/arch/um/kernel/skas/process.c | |||
@@ -41,7 +41,7 @@ static int __init start_kernel_proc(void *unused) | |||
41 | cpu_tasks[0].pid = pid; | 41 | cpu_tasks[0].pid = pid; |
42 | cpu_tasks[0].task = current; | 42 | cpu_tasks[0].task = current; |
43 | #ifdef CONFIG_SMP | 43 | #ifdef CONFIG_SMP |
44 | cpu_online_map = cpumask_of_cpu(0); | 44 | init_cpu_online(get_cpu_mask(0)); |
45 | #endif | 45 | #endif |
46 | start_kernel(); | 46 | start_kernel(); |
47 | return 0; | 47 | return 0; |
diff --git a/arch/um/kernel/smp.c b/arch/um/kernel/smp.c index 155206a66908..6f588e160fb0 100644 --- a/arch/um/kernel/smp.c +++ b/arch/um/kernel/smp.c | |||
@@ -76,7 +76,7 @@ static int idle_proc(void *cpup) | |||
76 | cpu_relax(); | 76 | cpu_relax(); |
77 | 77 | ||
78 | notify_cpu_starting(cpu); | 78 | notify_cpu_starting(cpu); |
79 | cpu_set(cpu, cpu_online_map); | 79 | set_cpu_online(cpu, true); |
80 | default_idle(); | 80 | default_idle(); |
81 | return 0; | 81 | return 0; |
82 | } | 82 | } |
@@ -110,8 +110,7 @@ void smp_prepare_cpus(unsigned int maxcpus) | |||
110 | for (i = 0; i < ncpus; ++i) | 110 | for (i = 0; i < ncpus; ++i) |
111 | set_cpu_possible(i, true); | 111 | set_cpu_possible(i, true); |
112 | 112 | ||
113 | cpu_clear(me, cpu_online_map); | 113 | set_cpu_online(me, true); |
114 | cpu_set(me, cpu_online_map); | ||
115 | cpu_set(me, cpu_callin_map); | 114 | cpu_set(me, cpu_callin_map); |
116 | 115 | ||
117 | err = os_pipe(cpu_data[me].ipi_pipe, 1, 1); | 116 | err = os_pipe(cpu_data[me].ipi_pipe, 1, 1); |
@@ -138,13 +137,13 @@ void smp_prepare_cpus(unsigned int maxcpus) | |||
138 | 137 | ||
139 | void smp_prepare_boot_cpu(void) | 138 | void smp_prepare_boot_cpu(void) |
140 | { | 139 | { |
141 | cpu_set(smp_processor_id(), cpu_online_map); | 140 | set_cpu_online(smp_processor_id(), true); |
142 | } | 141 | } |
143 | 142 | ||
144 | int __cpu_up(unsigned int cpu) | 143 | int __cpu_up(unsigned int cpu) |
145 | { | 144 | { |
146 | cpu_set(cpu, smp_commenced_mask); | 145 | cpu_set(cpu, smp_commenced_mask); |
147 | while (!cpu_isset(cpu, cpu_online_map)) | 146 | while (!cpu_online(cpu)) |
148 | mb(); | 147 | mb(); |
149 | return 0; | 148 | return 0; |
150 | } | 149 | } |
diff --git a/arch/unicore32/include/asm/dma-mapping.h b/arch/unicore32/include/asm/dma-mapping.h index 9258e592f414..366460a81796 100644 --- a/arch/unicore32/include/asm/dma-mapping.h +++ b/arch/unicore32/include/asm/dma-mapping.h | |||
@@ -82,20 +82,26 @@ static inline int dma_set_mask(struct device *dev, u64 dma_mask) | |||
82 | return 0; | 82 | return 0; |
83 | } | 83 | } |
84 | 84 | ||
85 | static inline void *dma_alloc_coherent(struct device *dev, size_t size, | 85 | #define dma_alloc_coherent(d,s,h,f) dma_alloc_attrs(d,s,h,f,NULL) |
86 | dma_addr_t *dma_handle, gfp_t flag) | 86 | |
87 | static inline void *dma_alloc_attrs(struct device *dev, size_t size, | ||
88 | dma_addr_t *dma_handle, gfp_t flag, | ||
89 | struct dma_attrs *attrs) | ||
87 | { | 90 | { |
88 | struct dma_map_ops *dma_ops = get_dma_ops(dev); | 91 | struct dma_map_ops *dma_ops = get_dma_ops(dev); |
89 | 92 | ||
90 | return dma_ops->alloc_coherent(dev, size, dma_handle, flag); | 93 | return dma_ops->alloc(dev, size, dma_handle, flag, attrs); |
91 | } | 94 | } |
92 | 95 | ||
93 | static inline void dma_free_coherent(struct device *dev, size_t size, | 96 | #define dma_free_coherent(d,s,c,h) dma_free_attrs(d,s,c,h,NULL) |
94 | void *cpu_addr, dma_addr_t dma_handle) | 97 | |
98 | static inline void dma_free_attrs(struct device *dev, size_t size, | ||
99 | void *cpu_addr, dma_addr_t dma_handle, | ||
100 | struct dma_attrs *attrs) | ||
95 | { | 101 | { |
96 | struct dma_map_ops *dma_ops = get_dma_ops(dev); | 102 | struct dma_map_ops *dma_ops = get_dma_ops(dev); |
97 | 103 | ||
98 | dma_ops->free_coherent(dev, size, cpu_addr, dma_handle); | 104 | dma_ops->free(dev, size, cpu_addr, dma_handle, attrs); |
99 | } | 105 | } |
100 | 106 | ||
101 | #define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f) | 107 | #define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f) |
diff --git a/arch/unicore32/mm/dma-swiotlb.c b/arch/unicore32/mm/dma-swiotlb.c index bfa9fbb2bbb1..16c08b2143a7 100644 --- a/arch/unicore32/mm/dma-swiotlb.c +++ b/arch/unicore32/mm/dma-swiotlb.c | |||
@@ -17,9 +17,23 @@ | |||
17 | 17 | ||
18 | #include <asm/dma.h> | 18 | #include <asm/dma.h> |
19 | 19 | ||
20 | static void *unicore_swiotlb_alloc_coherent(struct device *dev, size_t size, | ||
21 | dma_addr_t *dma_handle, gfp_t flags, | ||
22 | struct dma_attrs *attrs) | ||
23 | { | ||
24 | return swiotlb_alloc_coherent(dev, size, dma_handle, flags); | ||
25 | } | ||
26 | |||
27 | static void unicore_swiotlb_free_coherent(struct device *dev, size_t size, | ||
28 | void *vaddr, dma_addr_t dma_addr, | ||
29 | struct dma_attrs *attrs) | ||
30 | { | ||
31 | swiotlb_free_coherent(dev, size, vaddr, dma_addr); | ||
32 | } | ||
33 | |||
20 | struct dma_map_ops swiotlb_dma_map_ops = { | 34 | struct dma_map_ops swiotlb_dma_map_ops = { |
21 | .alloc_coherent = swiotlb_alloc_coherent, | 35 | .alloc = unicore_swiotlb_alloc_coherent, |
22 | .free_coherent = swiotlb_free_coherent, | 36 | .free = unicore_swiotlb_free_coherent, |
23 | .map_sg = swiotlb_map_sg_attrs, | 37 | .map_sg = swiotlb_map_sg_attrs, |
24 | .unmap_sg = swiotlb_unmap_sg_attrs, | 38 | .unmap_sg = swiotlb_unmap_sg_attrs, |
25 | .dma_supported = swiotlb_dma_supported, | 39 | .dma_supported = swiotlb_dma_supported, |
diff --git a/arch/x86/Makefile b/arch/x86/Makefile index 968dbe24a255..41a7237606a3 100644 --- a/arch/x86/Makefile +++ b/arch/x86/Makefile | |||
@@ -129,6 +129,7 @@ KBUILD_CFLAGS += -Wno-sign-compare | |||
129 | KBUILD_CFLAGS += -fno-asynchronous-unwind-tables | 129 | KBUILD_CFLAGS += -fno-asynchronous-unwind-tables |
130 | # prevent gcc from generating any FP code by mistake | 130 | # prevent gcc from generating any FP code by mistake |
131 | KBUILD_CFLAGS += $(call cc-option,-mno-sse -mno-mmx -mno-sse2 -mno-3dnow,) | 131 | KBUILD_CFLAGS += $(call cc-option,-mno-sse -mno-mmx -mno-sse2 -mno-3dnow,) |
132 | KBUILD_CFLAGS += $(call cc-option,-mno-avx,) | ||
132 | 133 | ||
133 | KBUILD_CFLAGS += $(mflags-y) | 134 | KBUILD_CFLAGS += $(mflags-y) |
134 | KBUILD_AFLAGS += $(mflags-y) | 135 | KBUILD_AFLAGS += $(mflags-y) |
diff --git a/arch/x86/include/asm/dma-mapping.h b/arch/x86/include/asm/dma-mapping.h index ed3065fd6314..4b4331d71935 100644 --- a/arch/x86/include/asm/dma-mapping.h +++ b/arch/x86/include/asm/dma-mapping.h | |||
@@ -59,7 +59,8 @@ extern int dma_supported(struct device *hwdev, u64 mask); | |||
59 | extern int dma_set_mask(struct device *dev, u64 mask); | 59 | extern int dma_set_mask(struct device *dev, u64 mask); |
60 | 60 | ||
61 | extern void *dma_generic_alloc_coherent(struct device *dev, size_t size, | 61 | extern void *dma_generic_alloc_coherent(struct device *dev, size_t size, |
62 | dma_addr_t *dma_addr, gfp_t flag); | 62 | dma_addr_t *dma_addr, gfp_t flag, |
63 | struct dma_attrs *attrs); | ||
63 | 64 | ||
64 | static inline bool dma_capable(struct device *dev, dma_addr_t addr, size_t size) | 65 | static inline bool dma_capable(struct device *dev, dma_addr_t addr, size_t size) |
65 | { | 66 | { |
@@ -111,9 +112,11 @@ static inline gfp_t dma_alloc_coherent_gfp_flags(struct device *dev, gfp_t gfp) | |||
111 | return gfp; | 112 | return gfp; |
112 | } | 113 | } |
113 | 114 | ||
115 | #define dma_alloc_coherent(d,s,h,f) dma_alloc_attrs(d,s,h,f,NULL) | ||
116 | |||
114 | static inline void * | 117 | static inline void * |
115 | dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle, | 118 | dma_alloc_attrs(struct device *dev, size_t size, dma_addr_t *dma_handle, |
116 | gfp_t gfp) | 119 | gfp_t gfp, struct dma_attrs *attrs) |
117 | { | 120 | { |
118 | struct dma_map_ops *ops = get_dma_ops(dev); | 121 | struct dma_map_ops *ops = get_dma_ops(dev); |
119 | void *memory; | 122 | void *memory; |
@@ -129,18 +132,21 @@ dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle, | |||
129 | if (!is_device_dma_capable(dev)) | 132 | if (!is_device_dma_capable(dev)) |
130 | return NULL; | 133 | return NULL; |
131 | 134 | ||
132 | if (!ops->alloc_coherent) | 135 | if (!ops->alloc) |
133 | return NULL; | 136 | return NULL; |
134 | 137 | ||
135 | memory = ops->alloc_coherent(dev, size, dma_handle, | 138 | memory = ops->alloc(dev, size, dma_handle, |
136 | dma_alloc_coherent_gfp_flags(dev, gfp)); | 139 | dma_alloc_coherent_gfp_flags(dev, gfp), attrs); |
137 | debug_dma_alloc_coherent(dev, size, *dma_handle, memory); | 140 | debug_dma_alloc_coherent(dev, size, *dma_handle, memory); |
138 | 141 | ||
139 | return memory; | 142 | return memory; |
140 | } | 143 | } |
141 | 144 | ||
142 | static inline void dma_free_coherent(struct device *dev, size_t size, | 145 | #define dma_free_coherent(d,s,c,h) dma_free_attrs(d,s,c,h,NULL) |
143 | void *vaddr, dma_addr_t bus) | 146 | |
147 | static inline void dma_free_attrs(struct device *dev, size_t size, | ||
148 | void *vaddr, dma_addr_t bus, | ||
149 | struct dma_attrs *attrs) | ||
144 | { | 150 | { |
145 | struct dma_map_ops *ops = get_dma_ops(dev); | 151 | struct dma_map_ops *ops = get_dma_ops(dev); |
146 | 152 | ||
@@ -150,8 +156,8 @@ static inline void dma_free_coherent(struct device *dev, size_t size, | |||
150 | return; | 156 | return; |
151 | 157 | ||
152 | debug_dma_free_coherent(dev, size, vaddr, bus); | 158 | debug_dma_free_coherent(dev, size, vaddr, bus); |
153 | if (ops->free_coherent) | 159 | if (ops->free) |
154 | ops->free_coherent(dev, size, vaddr, bus); | 160 | ops->free(dev, size, vaddr, bus, attrs); |
155 | } | 161 | } |
156 | 162 | ||
157 | #endif | 163 | #endif |
diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h index 7284c9a6a0b5..4fa7dcceb6c0 100644 --- a/arch/x86/include/asm/processor.h +++ b/arch/x86/include/asm/processor.h | |||
@@ -974,16 +974,6 @@ extern bool cpu_has_amd_erratum(const int *); | |||
974 | #define cpu_has_amd_erratum(x) (false) | 974 | #define cpu_has_amd_erratum(x) (false) |
975 | #endif /* CONFIG_CPU_SUP_AMD */ | 975 | #endif /* CONFIG_CPU_SUP_AMD */ |
976 | 976 | ||
977 | #ifdef CONFIG_X86_32 | ||
978 | /* | ||
979 | * disable hlt during certain critical i/o operations | ||
980 | */ | ||
981 | #define HAVE_DISABLE_HLT | ||
982 | #endif | ||
983 | |||
984 | void disable_hlt(void); | ||
985 | void enable_hlt(void); | ||
986 | |||
987 | void cpu_idle_wait(void); | 977 | void cpu_idle_wait(void); |
988 | 978 | ||
989 | extern unsigned long arch_align_stack(unsigned long sp); | 979 | extern unsigned long arch_align_stack(unsigned long sp); |
diff --git a/arch/x86/include/asm/word-at-a-time.h b/arch/x86/include/asm/word-at-a-time.h new file mode 100644 index 000000000000..6fe6767b7124 --- /dev/null +++ b/arch/x86/include/asm/word-at-a-time.h | |||
@@ -0,0 +1,46 @@ | |||
1 | #ifndef _ASM_WORD_AT_A_TIME_H | ||
2 | #define _ASM_WORD_AT_A_TIME_H | ||
3 | |||
4 | /* | ||
5 | * This is largely generic for little-endian machines, but the | ||
6 | * optimal byte mask counting is probably going to be something | ||
7 | * that is architecture-specific. If you have a reliably fast | ||
8 | * bit count instruction, that might be better than the multiply | ||
9 | * and shift, for example. | ||
10 | */ | ||
11 | |||
12 | #ifdef CONFIG_64BIT | ||
13 | |||
14 | /* | ||
15 | * Jan Achrenius on G+: microoptimized version of | ||
16 | * the simpler "(mask & ONEBYTES) * ONEBYTES >> 56" | ||
17 | * that works for the bytemasks without having to | ||
18 | * mask them first. | ||
19 | */ | ||
20 | static inline long count_masked_bytes(unsigned long mask) | ||
21 | { | ||
22 | return mask*0x0001020304050608ul >> 56; | ||
23 | } | ||
24 | |||
25 | #else /* 32-bit case */ | ||
26 | |||
27 | /* Carl Chatfield / Jan Achrenius G+ version for 32-bit */ | ||
28 | static inline long count_masked_bytes(long mask) | ||
29 | { | ||
30 | /* (000000 0000ff 00ffff ffffff) -> ( 1 1 2 3 ) */ | ||
31 | long a = (0x0ff0001+mask) >> 23; | ||
32 | /* Fix the 1 for 00 case */ | ||
33 | return a & mask; | ||
34 | } | ||
35 | |||
36 | #endif | ||
37 | |||
38 | #define REPEAT_BYTE(x) ((~0ul / 0xff) * (x)) | ||
39 | |||
40 | /* Return the high bit set in the first byte that is a zero */ | ||
41 | static inline unsigned long has_zero(unsigned long a) | ||
42 | { | ||
43 | return ((a - REPEAT_BYTE(0x01)) & ~a) & REPEAT_BYTE(0x80); | ||
44 | } | ||
45 | |||
46 | #endif /* _ASM_WORD_AT_A_TIME_H */ | ||
diff --git a/arch/x86/kernel/amd_gart_64.c b/arch/x86/kernel/amd_gart_64.c index b1e7c7f7a0af..e66311200cbd 100644 --- a/arch/x86/kernel/amd_gart_64.c +++ b/arch/x86/kernel/amd_gart_64.c | |||
@@ -477,7 +477,7 @@ error: | |||
477 | /* allocate and map a coherent mapping */ | 477 | /* allocate and map a coherent mapping */ |
478 | static void * | 478 | static void * |
479 | gart_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_addr, | 479 | gart_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_addr, |
480 | gfp_t flag) | 480 | gfp_t flag, struct dma_attrs *attrs) |
481 | { | 481 | { |
482 | dma_addr_t paddr; | 482 | dma_addr_t paddr; |
483 | unsigned long align_mask; | 483 | unsigned long align_mask; |
@@ -500,7 +500,8 @@ gart_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_addr, | |||
500 | } | 500 | } |
501 | __free_pages(page, get_order(size)); | 501 | __free_pages(page, get_order(size)); |
502 | } else | 502 | } else |
503 | return dma_generic_alloc_coherent(dev, size, dma_addr, flag); | 503 | return dma_generic_alloc_coherent(dev, size, dma_addr, flag, |
504 | attrs); | ||
504 | 505 | ||
505 | return NULL; | 506 | return NULL; |
506 | } | 507 | } |
@@ -508,7 +509,7 @@ gart_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_addr, | |||
508 | /* free a coherent mapping */ | 509 | /* free a coherent mapping */ |
509 | static void | 510 | static void |
510 | gart_free_coherent(struct device *dev, size_t size, void *vaddr, | 511 | gart_free_coherent(struct device *dev, size_t size, void *vaddr, |
511 | dma_addr_t dma_addr) | 512 | dma_addr_t dma_addr, struct dma_attrs *attrs) |
512 | { | 513 | { |
513 | gart_unmap_page(dev, dma_addr, size, DMA_BIDIRECTIONAL, NULL); | 514 | gart_unmap_page(dev, dma_addr, size, DMA_BIDIRECTIONAL, NULL); |
514 | free_pages((unsigned long)vaddr, get_order(size)); | 515 | free_pages((unsigned long)vaddr, get_order(size)); |
@@ -700,8 +701,8 @@ static struct dma_map_ops gart_dma_ops = { | |||
700 | .unmap_sg = gart_unmap_sg, | 701 | .unmap_sg = gart_unmap_sg, |
701 | .map_page = gart_map_page, | 702 | .map_page = gart_map_page, |
702 | .unmap_page = gart_unmap_page, | 703 | .unmap_page = gart_unmap_page, |
703 | .alloc_coherent = gart_alloc_coherent, | 704 | .alloc = gart_alloc_coherent, |
704 | .free_coherent = gart_free_coherent, | 705 | .free = gart_free_coherent, |
705 | .mapping_error = gart_mapping_error, | 706 | .mapping_error = gart_mapping_error, |
706 | }; | 707 | }; |
707 | 708 | ||
diff --git a/arch/x86/kernel/cpu/perf_event_p4.c b/arch/x86/kernel/cpu/perf_event_p4.c index ef484d9d0a25..a2dfacfd7103 100644 --- a/arch/x86/kernel/cpu/perf_event_p4.c +++ b/arch/x86/kernel/cpu/perf_event_p4.c | |||
@@ -1271,6 +1271,17 @@ done: | |||
1271 | return num ? -EINVAL : 0; | 1271 | return num ? -EINVAL : 0; |
1272 | } | 1272 | } |
1273 | 1273 | ||
1274 | PMU_FORMAT_ATTR(cccr, "config:0-31" ); | ||
1275 | PMU_FORMAT_ATTR(escr, "config:32-62"); | ||
1276 | PMU_FORMAT_ATTR(ht, "config:63" ); | ||
1277 | |||
1278 | static struct attribute *intel_p4_formats_attr[] = { | ||
1279 | &format_attr_cccr.attr, | ||
1280 | &format_attr_escr.attr, | ||
1281 | &format_attr_ht.attr, | ||
1282 | NULL, | ||
1283 | }; | ||
1284 | |||
1274 | static __initconst const struct x86_pmu p4_pmu = { | 1285 | static __initconst const struct x86_pmu p4_pmu = { |
1275 | .name = "Netburst P4/Xeon", | 1286 | .name = "Netburst P4/Xeon", |
1276 | .handle_irq = p4_pmu_handle_irq, | 1287 | .handle_irq = p4_pmu_handle_irq, |
@@ -1305,6 +1316,8 @@ static __initconst const struct x86_pmu p4_pmu = { | |||
1305 | * the former idea is taken from OProfile code | 1316 | * the former idea is taken from OProfile code |
1306 | */ | 1317 | */ |
1307 | .perfctr_second_write = 1, | 1318 | .perfctr_second_write = 1, |
1319 | |||
1320 | .format_attrs = intel_p4_formats_attr, | ||
1308 | }; | 1321 | }; |
1309 | 1322 | ||
1310 | __init int p4_pmu_init(void) | 1323 | __init int p4_pmu_init(void) |
diff --git a/arch/x86/kernel/irq.c b/arch/x86/kernel/irq.c index 7943e0c21bde..3dafc6003b7c 100644 --- a/arch/x86/kernel/irq.c +++ b/arch/x86/kernel/irq.c | |||
@@ -282,8 +282,13 @@ void fixup_irqs(void) | |||
282 | else if (!(warned++)) | 282 | else if (!(warned++)) |
283 | set_affinity = 0; | 283 | set_affinity = 0; |
284 | 284 | ||
285 | /* | ||
286 | * We unmask if the irq was not marked masked by the | ||
287 | * core code. That respects the lazy irq disable | ||
288 | * behaviour. | ||
289 | */ | ||
285 | if (!irqd_can_move_in_process_context(data) && | 290 | if (!irqd_can_move_in_process_context(data) && |
286 | !irqd_irq_disabled(data) && chip->irq_unmask) | 291 | !irqd_irq_masked(data) && chip->irq_unmask) |
287 | chip->irq_unmask(data); | 292 | chip->irq_unmask(data); |
288 | 293 | ||
289 | raw_spin_unlock(&desc->lock); | 294 | raw_spin_unlock(&desc->lock); |
diff --git a/arch/x86/kernel/kdebugfs.c b/arch/x86/kernel/kdebugfs.c index 90fcf62854bb..1d5d31ea686b 100644 --- a/arch/x86/kernel/kdebugfs.c +++ b/arch/x86/kernel/kdebugfs.c | |||
@@ -68,16 +68,9 @@ static ssize_t setup_data_read(struct file *file, char __user *user_buf, | |||
68 | return count; | 68 | return count; |
69 | } | 69 | } |
70 | 70 | ||
71 | static int setup_data_open(struct inode *inode, struct file *file) | ||
72 | { | ||
73 | file->private_data = inode->i_private; | ||
74 | |||
75 | return 0; | ||
76 | } | ||
77 | |||
78 | static const struct file_operations fops_setup_data = { | 71 | static const struct file_operations fops_setup_data = { |
79 | .read = setup_data_read, | 72 | .read = setup_data_read, |
80 | .open = setup_data_open, | 73 | .open = simple_open, |
81 | .llseek = default_llseek, | 74 | .llseek = default_llseek, |
82 | }; | 75 | }; |
83 | 76 | ||
diff --git a/arch/x86/kernel/kgdb.c b/arch/x86/kernel/kgdb.c index db6720edfdd0..8bfb6146f753 100644 --- a/arch/x86/kernel/kgdb.c +++ b/arch/x86/kernel/kgdb.c | |||
@@ -43,6 +43,8 @@ | |||
43 | #include <linux/smp.h> | 43 | #include <linux/smp.h> |
44 | #include <linux/nmi.h> | 44 | #include <linux/nmi.h> |
45 | #include <linux/hw_breakpoint.h> | 45 | #include <linux/hw_breakpoint.h> |
46 | #include <linux/uaccess.h> | ||
47 | #include <linux/memory.h> | ||
46 | 48 | ||
47 | #include <asm/debugreg.h> | 49 | #include <asm/debugreg.h> |
48 | #include <asm/apicdef.h> | 50 | #include <asm/apicdef.h> |
@@ -741,6 +743,64 @@ void kgdb_arch_set_pc(struct pt_regs *regs, unsigned long ip) | |||
741 | regs->ip = ip; | 743 | regs->ip = ip; |
742 | } | 744 | } |
743 | 745 | ||
746 | int kgdb_arch_set_breakpoint(struct kgdb_bkpt *bpt) | ||
747 | { | ||
748 | int err; | ||
749 | char opc[BREAK_INSTR_SIZE]; | ||
750 | |||
751 | bpt->type = BP_BREAKPOINT; | ||
752 | err = probe_kernel_read(bpt->saved_instr, (char *)bpt->bpt_addr, | ||
753 | BREAK_INSTR_SIZE); | ||
754 | if (err) | ||
755 | return err; | ||
756 | err = probe_kernel_write((char *)bpt->bpt_addr, | ||
757 | arch_kgdb_ops.gdb_bpt_instr, BREAK_INSTR_SIZE); | ||
758 | #ifdef CONFIG_DEBUG_RODATA | ||
759 | if (!err) | ||
760 | return err; | ||
761 | /* | ||
762 | * It is safe to call text_poke() because normal kernel execution | ||
763 | * is stopped on all cores, so long as the text_mutex is not locked. | ||
764 | */ | ||
765 | if (mutex_is_locked(&text_mutex)) | ||
766 | return -EBUSY; | ||
767 | text_poke((void *)bpt->bpt_addr, arch_kgdb_ops.gdb_bpt_instr, | ||
768 | BREAK_INSTR_SIZE); | ||
769 | err = probe_kernel_read(opc, (char *)bpt->bpt_addr, BREAK_INSTR_SIZE); | ||
770 | if (err) | ||
771 | return err; | ||
772 | if (memcmp(opc, arch_kgdb_ops.gdb_bpt_instr, BREAK_INSTR_SIZE)) | ||
773 | return -EINVAL; | ||
774 | bpt->type = BP_POKE_BREAKPOINT; | ||
775 | #endif /* CONFIG_DEBUG_RODATA */ | ||
776 | return err; | ||
777 | } | ||
778 | |||
779 | int kgdb_arch_remove_breakpoint(struct kgdb_bkpt *bpt) | ||
780 | { | ||
781 | #ifdef CONFIG_DEBUG_RODATA | ||
782 | int err; | ||
783 | char opc[BREAK_INSTR_SIZE]; | ||
784 | |||
785 | if (bpt->type != BP_POKE_BREAKPOINT) | ||
786 | goto knl_write; | ||
787 | /* | ||
788 | * It is safe to call text_poke() because normal kernel execution | ||
789 | * is stopped on all cores, so long as the text_mutex is not locked. | ||
790 | */ | ||
791 | if (mutex_is_locked(&text_mutex)) | ||
792 | goto knl_write; | ||
793 | text_poke((void *)bpt->bpt_addr, bpt->saved_instr, BREAK_INSTR_SIZE); | ||
794 | err = probe_kernel_read(opc, (char *)bpt->bpt_addr, BREAK_INSTR_SIZE); | ||
795 | if (err || memcmp(opc, bpt->saved_instr, BREAK_INSTR_SIZE)) | ||
796 | goto knl_write; | ||
797 | return err; | ||
798 | knl_write: | ||
799 | #endif /* CONFIG_DEBUG_RODATA */ | ||
800 | return probe_kernel_write((char *)bpt->bpt_addr, | ||
801 | (char *)bpt->saved_instr, BREAK_INSTR_SIZE); | ||
802 | } | ||
803 | |||
744 | struct kgdb_arch arch_kgdb_ops = { | 804 | struct kgdb_arch arch_kgdb_ops = { |
745 | /* Breakpoint instruction: */ | 805 | /* Breakpoint instruction: */ |
746 | .gdb_bpt_instr = { 0xcc }, | 806 | .gdb_bpt_instr = { 0xcc }, |
diff --git a/arch/x86/kernel/pci-calgary_64.c b/arch/x86/kernel/pci-calgary_64.c index 6ac5782f4d6b..d0b2fb9ccbb1 100644 --- a/arch/x86/kernel/pci-calgary_64.c +++ b/arch/x86/kernel/pci-calgary_64.c | |||
@@ -430,7 +430,7 @@ static void calgary_unmap_page(struct device *dev, dma_addr_t dma_addr, | |||
430 | } | 430 | } |
431 | 431 | ||
432 | static void* calgary_alloc_coherent(struct device *dev, size_t size, | 432 | static void* calgary_alloc_coherent(struct device *dev, size_t size, |
433 | dma_addr_t *dma_handle, gfp_t flag) | 433 | dma_addr_t *dma_handle, gfp_t flag, struct dma_attrs *attrs) |
434 | { | 434 | { |
435 | void *ret = NULL; | 435 | void *ret = NULL; |
436 | dma_addr_t mapping; | 436 | dma_addr_t mapping; |
@@ -463,7 +463,8 @@ error: | |||
463 | } | 463 | } |
464 | 464 | ||
465 | static void calgary_free_coherent(struct device *dev, size_t size, | 465 | static void calgary_free_coherent(struct device *dev, size_t size, |
466 | void *vaddr, dma_addr_t dma_handle) | 466 | void *vaddr, dma_addr_t dma_handle, |
467 | struct dma_attrs *attrs) | ||
467 | { | 468 | { |
468 | unsigned int npages; | 469 | unsigned int npages; |
469 | struct iommu_table *tbl = find_iommu_table(dev); | 470 | struct iommu_table *tbl = find_iommu_table(dev); |
@@ -476,8 +477,8 @@ static void calgary_free_coherent(struct device *dev, size_t size, | |||
476 | } | 477 | } |
477 | 478 | ||
478 | static struct dma_map_ops calgary_dma_ops = { | 479 | static struct dma_map_ops calgary_dma_ops = { |
479 | .alloc_coherent = calgary_alloc_coherent, | 480 | .alloc = calgary_alloc_coherent, |
480 | .free_coherent = calgary_free_coherent, | 481 | .free = calgary_free_coherent, |
481 | .map_sg = calgary_map_sg, | 482 | .map_sg = calgary_map_sg, |
482 | .unmap_sg = calgary_unmap_sg, | 483 | .unmap_sg = calgary_unmap_sg, |
483 | .map_page = calgary_map_page, | 484 | .map_page = calgary_map_page, |
diff --git a/arch/x86/kernel/pci-dma.c b/arch/x86/kernel/pci-dma.c index 28e5e06fcba4..3003250ac51d 100644 --- a/arch/x86/kernel/pci-dma.c +++ b/arch/x86/kernel/pci-dma.c | |||
@@ -96,7 +96,8 @@ void __init pci_iommu_alloc(void) | |||
96 | } | 96 | } |
97 | } | 97 | } |
98 | void *dma_generic_alloc_coherent(struct device *dev, size_t size, | 98 | void *dma_generic_alloc_coherent(struct device *dev, size_t size, |
99 | dma_addr_t *dma_addr, gfp_t flag) | 99 | dma_addr_t *dma_addr, gfp_t flag, |
100 | struct dma_attrs *attrs) | ||
100 | { | 101 | { |
101 | unsigned long dma_mask; | 102 | unsigned long dma_mask; |
102 | struct page *page; | 103 | struct page *page; |
diff --git a/arch/x86/kernel/pci-nommu.c b/arch/x86/kernel/pci-nommu.c index 3af4af810c07..f96050685b46 100644 --- a/arch/x86/kernel/pci-nommu.c +++ b/arch/x86/kernel/pci-nommu.c | |||
@@ -75,7 +75,7 @@ static int nommu_map_sg(struct device *hwdev, struct scatterlist *sg, | |||
75 | } | 75 | } |
76 | 76 | ||
77 | static void nommu_free_coherent(struct device *dev, size_t size, void *vaddr, | 77 | static void nommu_free_coherent(struct device *dev, size_t size, void *vaddr, |
78 | dma_addr_t dma_addr) | 78 | dma_addr_t dma_addr, struct dma_attrs *attrs) |
79 | { | 79 | { |
80 | free_pages((unsigned long)vaddr, get_order(size)); | 80 | free_pages((unsigned long)vaddr, get_order(size)); |
81 | } | 81 | } |
@@ -96,8 +96,8 @@ static void nommu_sync_sg_for_device(struct device *dev, | |||
96 | } | 96 | } |
97 | 97 | ||
98 | struct dma_map_ops nommu_dma_ops = { | 98 | struct dma_map_ops nommu_dma_ops = { |
99 | .alloc_coherent = dma_generic_alloc_coherent, | 99 | .alloc = dma_generic_alloc_coherent, |
100 | .free_coherent = nommu_free_coherent, | 100 | .free = nommu_free_coherent, |
101 | .map_sg = nommu_map_sg, | 101 | .map_sg = nommu_map_sg, |
102 | .map_page = nommu_map_page, | 102 | .map_page = nommu_map_page, |
103 | .sync_single_for_device = nommu_sync_single_for_device, | 103 | .sync_single_for_device = nommu_sync_single_for_device, |
diff --git a/arch/x86/kernel/pci-swiotlb.c b/arch/x86/kernel/pci-swiotlb.c index 8f972cbddef0..6c483ba98b9c 100644 --- a/arch/x86/kernel/pci-swiotlb.c +++ b/arch/x86/kernel/pci-swiotlb.c | |||
@@ -15,21 +15,30 @@ | |||
15 | int swiotlb __read_mostly; | 15 | int swiotlb __read_mostly; |
16 | 16 | ||
17 | static void *x86_swiotlb_alloc_coherent(struct device *hwdev, size_t size, | 17 | static void *x86_swiotlb_alloc_coherent(struct device *hwdev, size_t size, |
18 | dma_addr_t *dma_handle, gfp_t flags) | 18 | dma_addr_t *dma_handle, gfp_t flags, |
19 | struct dma_attrs *attrs) | ||
19 | { | 20 | { |
20 | void *vaddr; | 21 | void *vaddr; |
21 | 22 | ||
22 | vaddr = dma_generic_alloc_coherent(hwdev, size, dma_handle, flags); | 23 | vaddr = dma_generic_alloc_coherent(hwdev, size, dma_handle, flags, |
24 | attrs); | ||
23 | if (vaddr) | 25 | if (vaddr) |
24 | return vaddr; | 26 | return vaddr; |
25 | 27 | ||
26 | return swiotlb_alloc_coherent(hwdev, size, dma_handle, flags); | 28 | return swiotlb_alloc_coherent(hwdev, size, dma_handle, flags); |
27 | } | 29 | } |
28 | 30 | ||
31 | static void x86_swiotlb_free_coherent(struct device *dev, size_t size, | ||
32 | void *vaddr, dma_addr_t dma_addr, | ||
33 | struct dma_attrs *attrs) | ||
34 | { | ||
35 | swiotlb_free_coherent(dev, size, vaddr, dma_addr); | ||
36 | } | ||
37 | |||
29 | static struct dma_map_ops swiotlb_dma_ops = { | 38 | static struct dma_map_ops swiotlb_dma_ops = { |
30 | .mapping_error = swiotlb_dma_mapping_error, | 39 | .mapping_error = swiotlb_dma_mapping_error, |
31 | .alloc_coherent = x86_swiotlb_alloc_coherent, | 40 | .alloc = x86_swiotlb_alloc_coherent, |
32 | .free_coherent = swiotlb_free_coherent, | 41 | .free = x86_swiotlb_free_coherent, |
33 | .sync_single_for_cpu = swiotlb_sync_single_for_cpu, | 42 | .sync_single_for_cpu = swiotlb_sync_single_for_cpu, |
34 | .sync_single_for_device = swiotlb_sync_single_for_device, | 43 | .sync_single_for_device = swiotlb_sync_single_for_device, |
35 | .sync_sg_for_cpu = swiotlb_sync_sg_for_cpu, | 44 | .sync_sg_for_cpu = swiotlb_sync_sg_for_cpu, |
diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c index a33afaa5ddb7..1d92a5ab6e8b 100644 --- a/arch/x86/kernel/process.c +++ b/arch/x86/kernel/process.c | |||
@@ -362,34 +362,10 @@ void (*pm_idle)(void); | |||
362 | EXPORT_SYMBOL(pm_idle); | 362 | EXPORT_SYMBOL(pm_idle); |
363 | #endif | 363 | #endif |
364 | 364 | ||
365 | #ifdef CONFIG_X86_32 | ||
366 | /* | ||
367 | * This halt magic was a workaround for ancient floppy DMA | ||
368 | * wreckage. It should be safe to remove. | ||
369 | */ | ||
370 | static int hlt_counter; | ||
371 | void disable_hlt(void) | ||
372 | { | ||
373 | hlt_counter++; | ||
374 | } | ||
375 | EXPORT_SYMBOL(disable_hlt); | ||
376 | |||
377 | void enable_hlt(void) | ||
378 | { | ||
379 | hlt_counter--; | ||
380 | } | ||
381 | EXPORT_SYMBOL(enable_hlt); | ||
382 | |||
383 | static inline int hlt_use_halt(void) | ||
384 | { | ||
385 | return (!hlt_counter && boot_cpu_data.hlt_works_ok); | ||
386 | } | ||
387 | #else | ||
388 | static inline int hlt_use_halt(void) | 365 | static inline int hlt_use_halt(void) |
389 | { | 366 | { |
390 | return 1; | 367 | return 1; |
391 | } | 368 | } |
392 | #endif | ||
393 | 369 | ||
394 | #ifndef CONFIG_SMP | 370 | #ifndef CONFIG_SMP |
395 | static inline void play_dead(void) | 371 | static inline void play_dead(void) |
diff --git a/arch/x86/net/bpf_jit.S b/arch/x86/net/bpf_jit.S index 66870223f8c5..877b9a1b2152 100644 --- a/arch/x86/net/bpf_jit.S +++ b/arch/x86/net/bpf_jit.S | |||
@@ -18,17 +18,17 @@ | |||
18 | * r9d : hlen = skb->len - skb->data_len | 18 | * r9d : hlen = skb->len - skb->data_len |
19 | */ | 19 | */ |
20 | #define SKBDATA %r8 | 20 | #define SKBDATA %r8 |
21 | 21 | #define SKF_MAX_NEG_OFF $(-0x200000) /* SKF_LL_OFF from filter.h */ | |
22 | sk_load_word_ind: | ||
23 | .globl sk_load_word_ind | ||
24 | |||
25 | add %ebx,%esi /* offset += X */ | ||
26 | # test %esi,%esi /* if (offset < 0) goto bpf_error; */ | ||
27 | js bpf_error | ||
28 | 22 | ||
29 | sk_load_word: | 23 | sk_load_word: |
30 | .globl sk_load_word | 24 | .globl sk_load_word |
31 | 25 | ||
26 | test %esi,%esi | ||
27 | js bpf_slow_path_word_neg | ||
28 | |||
29 | sk_load_word_positive_offset: | ||
30 | .globl sk_load_word_positive_offset | ||
31 | |||
32 | mov %r9d,%eax # hlen | 32 | mov %r9d,%eax # hlen |
33 | sub %esi,%eax # hlen - offset | 33 | sub %esi,%eax # hlen - offset |
34 | cmp $3,%eax | 34 | cmp $3,%eax |
@@ -37,16 +37,15 @@ sk_load_word: | |||
37 | bswap %eax /* ntohl() */ | 37 | bswap %eax /* ntohl() */ |
38 | ret | 38 | ret |
39 | 39 | ||
40 | |||
41 | sk_load_half_ind: | ||
42 | .globl sk_load_half_ind | ||
43 | |||
44 | add %ebx,%esi /* offset += X */ | ||
45 | js bpf_error | ||
46 | |||
47 | sk_load_half: | 40 | sk_load_half: |
48 | .globl sk_load_half | 41 | .globl sk_load_half |
49 | 42 | ||
43 | test %esi,%esi | ||
44 | js bpf_slow_path_half_neg | ||
45 | |||
46 | sk_load_half_positive_offset: | ||
47 | .globl sk_load_half_positive_offset | ||
48 | |||
50 | mov %r9d,%eax | 49 | mov %r9d,%eax |
51 | sub %esi,%eax # hlen - offset | 50 | sub %esi,%eax # hlen - offset |
52 | cmp $1,%eax | 51 | cmp $1,%eax |
@@ -55,14 +54,15 @@ sk_load_half: | |||
55 | rol $8,%ax # ntohs() | 54 | rol $8,%ax # ntohs() |
56 | ret | 55 | ret |
57 | 56 | ||
58 | sk_load_byte_ind: | ||
59 | .globl sk_load_byte_ind | ||
60 | add %ebx,%esi /* offset += X */ | ||
61 | js bpf_error | ||
62 | |||
63 | sk_load_byte: | 57 | sk_load_byte: |
64 | .globl sk_load_byte | 58 | .globl sk_load_byte |
65 | 59 | ||
60 | test %esi,%esi | ||
61 | js bpf_slow_path_byte_neg | ||
62 | |||
63 | sk_load_byte_positive_offset: | ||
64 | .globl sk_load_byte_positive_offset | ||
65 | |||
66 | cmp %esi,%r9d /* if (offset >= hlen) goto bpf_slow_path_byte */ | 66 | cmp %esi,%r9d /* if (offset >= hlen) goto bpf_slow_path_byte */ |
67 | jle bpf_slow_path_byte | 67 | jle bpf_slow_path_byte |
68 | movzbl (SKBDATA,%rsi),%eax | 68 | movzbl (SKBDATA,%rsi),%eax |
@@ -73,25 +73,21 @@ sk_load_byte: | |||
73 | * | 73 | * |
74 | * Implements BPF_S_LDX_B_MSH : ldxb 4*([offset]&0xf) | 74 | * Implements BPF_S_LDX_B_MSH : ldxb 4*([offset]&0xf) |
75 | * Must preserve A accumulator (%eax) | 75 | * Must preserve A accumulator (%eax) |
76 | * Inputs : %esi is the offset value, already known positive | 76 | * Inputs : %esi is the offset value |
77 | */ | 77 | */ |
78 | ENTRY(sk_load_byte_msh) | 78 | sk_load_byte_msh: |
79 | CFI_STARTPROC | 79 | .globl sk_load_byte_msh |
80 | test %esi,%esi | ||
81 | js bpf_slow_path_byte_msh_neg | ||
82 | |||
83 | sk_load_byte_msh_positive_offset: | ||
84 | .globl sk_load_byte_msh_positive_offset | ||
80 | cmp %esi,%r9d /* if (offset >= hlen) goto bpf_slow_path_byte_msh */ | 85 | cmp %esi,%r9d /* if (offset >= hlen) goto bpf_slow_path_byte_msh */ |
81 | jle bpf_slow_path_byte_msh | 86 | jle bpf_slow_path_byte_msh |
82 | movzbl (SKBDATA,%rsi),%ebx | 87 | movzbl (SKBDATA,%rsi),%ebx |
83 | and $15,%bl | 88 | and $15,%bl |
84 | shl $2,%bl | 89 | shl $2,%bl |
85 | ret | 90 | ret |
86 | CFI_ENDPROC | ||
87 | ENDPROC(sk_load_byte_msh) | ||
88 | |||
89 | bpf_error: | ||
90 | # force a return 0 from jit handler | ||
91 | xor %eax,%eax | ||
92 | mov -8(%rbp),%rbx | ||
93 | leaveq | ||
94 | ret | ||
95 | 91 | ||
96 | /* rsi contains offset and can be scratched */ | 92 | /* rsi contains offset and can be scratched */ |
97 | #define bpf_slow_path_common(LEN) \ | 93 | #define bpf_slow_path_common(LEN) \ |
@@ -138,3 +134,67 @@ bpf_slow_path_byte_msh: | |||
138 | shl $2,%al | 134 | shl $2,%al |
139 | xchg %eax,%ebx | 135 | xchg %eax,%ebx |
140 | ret | 136 | ret |
137 | |||
138 | #define sk_negative_common(SIZE) \ | ||
139 | push %rdi; /* save skb */ \ | ||
140 | push %r9; \ | ||
141 | push SKBDATA; \ | ||
142 | /* rsi already has offset */ \ | ||
143 | mov $SIZE,%ecx; /* size */ \ | ||
144 | call bpf_internal_load_pointer_neg_helper; \ | ||
145 | test %rax,%rax; \ | ||
146 | pop SKBDATA; \ | ||
147 | pop %r9; \ | ||
148 | pop %rdi; \ | ||
149 | jz bpf_error | ||
150 | |||
151 | |||
152 | bpf_slow_path_word_neg: | ||
153 | cmp SKF_MAX_NEG_OFF, %esi /* test range */ | ||
154 | jl bpf_error /* offset lower -> error */ | ||
155 | sk_load_word_negative_offset: | ||
156 | .globl sk_load_word_negative_offset | ||
157 | sk_negative_common(4) | ||
158 | mov (%rax), %eax | ||
159 | bswap %eax | ||
160 | ret | ||
161 | |||
162 | bpf_slow_path_half_neg: | ||
163 | cmp SKF_MAX_NEG_OFF, %esi | ||
164 | jl bpf_error | ||
165 | sk_load_half_negative_offset: | ||
166 | .globl sk_load_half_negative_offset | ||
167 | sk_negative_common(2) | ||
168 | mov (%rax),%ax | ||
169 | rol $8,%ax | ||
170 | movzwl %ax,%eax | ||
171 | ret | ||
172 | |||
173 | bpf_slow_path_byte_neg: | ||
174 | cmp SKF_MAX_NEG_OFF, %esi | ||
175 | jl bpf_error | ||
176 | sk_load_byte_negative_offset: | ||
177 | .globl sk_load_byte_negative_offset | ||
178 | sk_negative_common(1) | ||
179 | movzbl (%rax), %eax | ||
180 | ret | ||
181 | |||
182 | bpf_slow_path_byte_msh_neg: | ||
183 | cmp SKF_MAX_NEG_OFF, %esi | ||
184 | jl bpf_error | ||
185 | sk_load_byte_msh_negative_offset: | ||
186 | .globl sk_load_byte_msh_negative_offset | ||
187 | xchg %eax,%ebx /* dont lose A , X is about to be scratched */ | ||
188 | sk_negative_common(1) | ||
189 | movzbl (%rax),%eax | ||
190 | and $15,%al | ||
191 | shl $2,%al | ||
192 | xchg %eax,%ebx | ||
193 | ret | ||
194 | |||
195 | bpf_error: | ||
196 | # force a return 0 from jit handler | ||
197 | xor %eax,%eax | ||
198 | mov -8(%rbp),%rbx | ||
199 | leaveq | ||
200 | ret | ||
diff --git a/arch/x86/net/bpf_jit_comp.c b/arch/x86/net/bpf_jit_comp.c index 5671752f8d9c..0597f95b6da6 100644 --- a/arch/x86/net/bpf_jit_comp.c +++ b/arch/x86/net/bpf_jit_comp.c | |||
@@ -30,7 +30,10 @@ int bpf_jit_enable __read_mostly; | |||
30 | * assembly code in arch/x86/net/bpf_jit.S | 30 | * assembly code in arch/x86/net/bpf_jit.S |
31 | */ | 31 | */ |
32 | extern u8 sk_load_word[], sk_load_half[], sk_load_byte[], sk_load_byte_msh[]; | 32 | extern u8 sk_load_word[], sk_load_half[], sk_load_byte[], sk_load_byte_msh[]; |
33 | extern u8 sk_load_word_ind[], sk_load_half_ind[], sk_load_byte_ind[]; | 33 | extern u8 sk_load_word_positive_offset[], sk_load_half_positive_offset[]; |
34 | extern u8 sk_load_byte_positive_offset[], sk_load_byte_msh_positive_offset[]; | ||
35 | extern u8 sk_load_word_negative_offset[], sk_load_half_negative_offset[]; | ||
36 | extern u8 sk_load_byte_negative_offset[], sk_load_byte_msh_negative_offset[]; | ||
34 | 37 | ||
35 | static inline u8 *emit_code(u8 *ptr, u32 bytes, unsigned int len) | 38 | static inline u8 *emit_code(u8 *ptr, u32 bytes, unsigned int len) |
36 | { | 39 | { |
@@ -117,6 +120,8 @@ static inline void bpf_flush_icache(void *start, void *end) | |||
117 | set_fs(old_fs); | 120 | set_fs(old_fs); |
118 | } | 121 | } |
119 | 122 | ||
123 | #define CHOOSE_LOAD_FUNC(K, func) \ | ||
124 | ((int)K < 0 ? ((int)K >= SKF_LL_OFF ? func##_negative_offset : func) : func##_positive_offset) | ||
120 | 125 | ||
121 | void bpf_jit_compile(struct sk_filter *fp) | 126 | void bpf_jit_compile(struct sk_filter *fp) |
122 | { | 127 | { |
@@ -289,7 +294,7 @@ void bpf_jit_compile(struct sk_filter *fp) | |||
289 | EMIT2(0x24, K & 0xFF); /* and imm8,%al */ | 294 | EMIT2(0x24, K & 0xFF); /* and imm8,%al */ |
290 | } else if (K >= 0xFFFF0000) { | 295 | } else if (K >= 0xFFFF0000) { |
291 | EMIT2(0x66, 0x25); /* and imm16,%ax */ | 296 | EMIT2(0x66, 0x25); /* and imm16,%ax */ |
292 | EMIT2(K, 2); | 297 | EMIT(K, 2); |
293 | } else { | 298 | } else { |
294 | EMIT1_off32(0x25, K); /* and imm32,%eax */ | 299 | EMIT1_off32(0x25, K); /* and imm32,%eax */ |
295 | } | 300 | } |
@@ -473,44 +478,46 @@ void bpf_jit_compile(struct sk_filter *fp) | |||
473 | #endif | 478 | #endif |
474 | break; | 479 | break; |
475 | case BPF_S_LD_W_ABS: | 480 | case BPF_S_LD_W_ABS: |
476 | func = sk_load_word; | 481 | func = CHOOSE_LOAD_FUNC(K, sk_load_word); |
477 | common_load: seen |= SEEN_DATAREF; | 482 | common_load: seen |= SEEN_DATAREF; |
478 | if ((int)K < 0) { | ||
479 | /* Abort the JIT because __load_pointer() is needed. */ | ||
480 | goto out; | ||
481 | } | ||
482 | t_offset = func - (image + addrs[i]); | 483 | t_offset = func - (image + addrs[i]); |
483 | EMIT1_off32(0xbe, K); /* mov imm32,%esi */ | 484 | EMIT1_off32(0xbe, K); /* mov imm32,%esi */ |
484 | EMIT1_off32(0xe8, t_offset); /* call */ | 485 | EMIT1_off32(0xe8, t_offset); /* call */ |
485 | break; | 486 | break; |
486 | case BPF_S_LD_H_ABS: | 487 | case BPF_S_LD_H_ABS: |
487 | func = sk_load_half; | 488 | func = CHOOSE_LOAD_FUNC(K, sk_load_half); |
488 | goto common_load; | 489 | goto common_load; |
489 | case BPF_S_LD_B_ABS: | 490 | case BPF_S_LD_B_ABS: |
490 | func = sk_load_byte; | 491 | func = CHOOSE_LOAD_FUNC(K, sk_load_byte); |
491 | goto common_load; | 492 | goto common_load; |
492 | case BPF_S_LDX_B_MSH: | 493 | case BPF_S_LDX_B_MSH: |
493 | if ((int)K < 0) { | 494 | func = CHOOSE_LOAD_FUNC(K, sk_load_byte_msh); |
494 | /* Abort the JIT because __load_pointer() is needed. */ | ||
495 | goto out; | ||
496 | } | ||
497 | seen |= SEEN_DATAREF | SEEN_XREG; | 495 | seen |= SEEN_DATAREF | SEEN_XREG; |
498 | t_offset = sk_load_byte_msh - (image + addrs[i]); | 496 | t_offset = func - (image + addrs[i]); |
499 | EMIT1_off32(0xbe, K); /* mov imm32,%esi */ | 497 | EMIT1_off32(0xbe, K); /* mov imm32,%esi */ |
500 | EMIT1_off32(0xe8, t_offset); /* call sk_load_byte_msh */ | 498 | EMIT1_off32(0xe8, t_offset); /* call sk_load_byte_msh */ |
501 | break; | 499 | break; |
502 | case BPF_S_LD_W_IND: | 500 | case BPF_S_LD_W_IND: |
503 | func = sk_load_word_ind; | 501 | func = sk_load_word; |
504 | common_load_ind: seen |= SEEN_DATAREF | SEEN_XREG; | 502 | common_load_ind: seen |= SEEN_DATAREF | SEEN_XREG; |
505 | t_offset = func - (image + addrs[i]); | 503 | t_offset = func - (image + addrs[i]); |
506 | EMIT1_off32(0xbe, K); /* mov imm32,%esi */ | 504 | if (K) { |
505 | if (is_imm8(K)) { | ||
506 | EMIT3(0x8d, 0x73, K); /* lea imm8(%rbx), %esi */ | ||
507 | } else { | ||
508 | EMIT2(0x8d, 0xb3); /* lea imm32(%rbx),%esi */ | ||
509 | EMIT(K, 4); | ||
510 | } | ||
511 | } else { | ||
512 | EMIT2(0x89,0xde); /* mov %ebx,%esi */ | ||
513 | } | ||
507 | EMIT1_off32(0xe8, t_offset); /* call sk_load_xxx_ind */ | 514 | EMIT1_off32(0xe8, t_offset); /* call sk_load_xxx_ind */ |
508 | break; | 515 | break; |
509 | case BPF_S_LD_H_IND: | 516 | case BPF_S_LD_H_IND: |
510 | func = sk_load_half_ind; | 517 | func = sk_load_half; |
511 | goto common_load_ind; | 518 | goto common_load_ind; |
512 | case BPF_S_LD_B_IND: | 519 | case BPF_S_LD_B_IND: |
513 | func = sk_load_byte_ind; | 520 | func = sk_load_byte; |
514 | goto common_load_ind; | 521 | goto common_load_ind; |
515 | case BPF_S_JMP_JA: | 522 | case BPF_S_JMP_JA: |
516 | t_offset = addrs[i + K] - addrs[i]; | 523 | t_offset = addrs[i + K] - addrs[i]; |
diff --git a/arch/x86/power/cpu.c b/arch/x86/power/cpu.c index 47936830968c..218cdb16163c 100644 --- a/arch/x86/power/cpu.c +++ b/arch/x86/power/cpu.c | |||
@@ -225,13 +225,13 @@ static void __restore_processor_state(struct saved_context *ctxt) | |||
225 | fix_processor_context(); | 225 | fix_processor_context(); |
226 | 226 | ||
227 | do_fpu_end(); | 227 | do_fpu_end(); |
228 | x86_platform.restore_sched_clock_state(); | ||
228 | mtrr_bp_restore(); | 229 | mtrr_bp_restore(); |
229 | } | 230 | } |
230 | 231 | ||
231 | /* Needed by apm.c */ | 232 | /* Needed by apm.c */ |
232 | void restore_processor_state(void) | 233 | void restore_processor_state(void) |
233 | { | 234 | { |
234 | x86_platform.restore_sched_clock_state(); | ||
235 | __restore_processor_state(&saved_context); | 235 | __restore_processor_state(&saved_context); |
236 | } | 236 | } |
237 | #ifdef CONFIG_X86_32 | 237 | #ifdef CONFIG_X86_32 |
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c index b132ade26f77..4f51bebac02c 100644 --- a/arch/x86/xen/enlighten.c +++ b/arch/x86/xen/enlighten.c | |||
@@ -967,7 +967,7 @@ void xen_setup_shared_info(void) | |||
967 | xen_setup_mfn_list_list(); | 967 | xen_setup_mfn_list_list(); |
968 | } | 968 | } |
969 | 969 | ||
970 | /* This is called once we have the cpu_possible_map */ | 970 | /* This is called once we have the cpu_possible_mask */ |
971 | void xen_setup_vcpu_info_placement(void) | 971 | void xen_setup_vcpu_info_placement(void) |
972 | { | 972 | { |
973 | int cpu; | 973 | int cpu; |
diff --git a/arch/x86/xen/pci-swiotlb-xen.c b/arch/x86/xen/pci-swiotlb-xen.c index b480d4207a4c..967633ad98c4 100644 --- a/arch/x86/xen/pci-swiotlb-xen.c +++ b/arch/x86/xen/pci-swiotlb-xen.c | |||
@@ -12,8 +12,8 @@ int xen_swiotlb __read_mostly; | |||
12 | 12 | ||
13 | static struct dma_map_ops xen_swiotlb_dma_ops = { | 13 | static struct dma_map_ops xen_swiotlb_dma_ops = { |
14 | .mapping_error = xen_swiotlb_dma_mapping_error, | 14 | .mapping_error = xen_swiotlb_dma_mapping_error, |
15 | .alloc_coherent = xen_swiotlb_alloc_coherent, | 15 | .alloc = xen_swiotlb_alloc_coherent, |
16 | .free_coherent = xen_swiotlb_free_coherent, | 16 | .free = xen_swiotlb_free_coherent, |
17 | .sync_single_for_cpu = xen_swiotlb_sync_single_for_cpu, | 17 | .sync_single_for_cpu = xen_swiotlb_sync_single_for_cpu, |
18 | .sync_single_for_device = xen_swiotlb_sync_single_for_device, | 18 | .sync_single_for_device = xen_swiotlb_sync_single_for_device, |
19 | .sync_sg_for_cpu = xen_swiotlb_sync_sg_for_cpu, | 19 | .sync_sg_for_cpu = xen_swiotlb_sync_sg_for_cpu, |
diff --git a/crypto/ablkcipher.c b/crypto/ablkcipher.c index a0f768c1d9aa..8d3a056ebeea 100644 --- a/crypto/ablkcipher.c +++ b/crypto/ablkcipher.c | |||
@@ -613,8 +613,7 @@ out: | |||
613 | return err; | 613 | return err; |
614 | } | 614 | } |
615 | 615 | ||
616 | static struct crypto_alg *crypto_lookup_skcipher(const char *name, u32 type, | 616 | struct crypto_alg *crypto_lookup_skcipher(const char *name, u32 type, u32 mask) |
617 | u32 mask) | ||
618 | { | 617 | { |
619 | struct crypto_alg *alg; | 618 | struct crypto_alg *alg; |
620 | 619 | ||
@@ -652,6 +651,7 @@ static struct crypto_alg *crypto_lookup_skcipher(const char *name, u32 type, | |||
652 | 651 | ||
653 | return ERR_PTR(crypto_givcipher_default(alg, type, mask)); | 652 | return ERR_PTR(crypto_givcipher_default(alg, type, mask)); |
654 | } | 653 | } |
654 | EXPORT_SYMBOL_GPL(crypto_lookup_skcipher); | ||
655 | 655 | ||
656 | int crypto_grab_skcipher(struct crypto_skcipher_spawn *spawn, const char *name, | 656 | int crypto_grab_skcipher(struct crypto_skcipher_spawn *spawn, const char *name, |
657 | u32 type, u32 mask) | 657 | u32 type, u32 mask) |
diff --git a/crypto/aead.c b/crypto/aead.c index 04add3dca6fe..e4cb35159be4 100644 --- a/crypto/aead.c +++ b/crypto/aead.c | |||
@@ -470,8 +470,7 @@ out: | |||
470 | return err; | 470 | return err; |
471 | } | 471 | } |
472 | 472 | ||
473 | static struct crypto_alg *crypto_lookup_aead(const char *name, u32 type, | 473 | struct crypto_alg *crypto_lookup_aead(const char *name, u32 type, u32 mask) |
474 | u32 mask) | ||
475 | { | 474 | { |
476 | struct crypto_alg *alg; | 475 | struct crypto_alg *alg; |
477 | 476 | ||
@@ -503,6 +502,7 @@ static struct crypto_alg *crypto_lookup_aead(const char *name, u32 type, | |||
503 | 502 | ||
504 | return ERR_PTR(crypto_nivaead_default(alg, type, mask)); | 503 | return ERR_PTR(crypto_nivaead_default(alg, type, mask)); |
505 | } | 504 | } |
505 | EXPORT_SYMBOL_GPL(crypto_lookup_aead); | ||
506 | 506 | ||
507 | int crypto_grab_aead(struct crypto_aead_spawn *spawn, const char *name, | 507 | int crypto_grab_aead(struct crypto_aead_spawn *spawn, const char *name, |
508 | u32 type, u32 mask) | 508 | u32 type, u32 mask) |
diff --git a/crypto/crypto_user.c b/crypto/crypto_user.c index f76e42bcc6e7..f1ea0a064135 100644 --- a/crypto/crypto_user.c +++ b/crypto/crypto_user.c | |||
@@ -21,9 +21,13 @@ | |||
21 | #include <linux/module.h> | 21 | #include <linux/module.h> |
22 | #include <linux/crypto.h> | 22 | #include <linux/crypto.h> |
23 | #include <linux/cryptouser.h> | 23 | #include <linux/cryptouser.h> |
24 | #include <linux/sched.h> | ||
24 | #include <net/netlink.h> | 25 | #include <net/netlink.h> |
25 | #include <linux/security.h> | 26 | #include <linux/security.h> |
26 | #include <net/net_namespace.h> | 27 | #include <net/net_namespace.h> |
28 | #include <crypto/internal/aead.h> | ||
29 | #include <crypto/internal/skcipher.h> | ||
30 | |||
27 | #include "internal.h" | 31 | #include "internal.h" |
28 | 32 | ||
29 | DEFINE_MUTEX(crypto_cfg_mutex); | 33 | DEFINE_MUTEX(crypto_cfg_mutex); |
@@ -301,6 +305,60 @@ static int crypto_del_alg(struct sk_buff *skb, struct nlmsghdr *nlh, | |||
301 | return crypto_unregister_instance(alg); | 305 | return crypto_unregister_instance(alg); |
302 | } | 306 | } |
303 | 307 | ||
308 | static struct crypto_alg *crypto_user_skcipher_alg(const char *name, u32 type, | ||
309 | u32 mask) | ||
310 | { | ||
311 | int err; | ||
312 | struct crypto_alg *alg; | ||
313 | |||
314 | type = crypto_skcipher_type(type); | ||
315 | mask = crypto_skcipher_mask(mask); | ||
316 | |||
317 | for (;;) { | ||
318 | alg = crypto_lookup_skcipher(name, type, mask); | ||
319 | if (!IS_ERR(alg)) | ||
320 | return alg; | ||
321 | |||
322 | err = PTR_ERR(alg); | ||
323 | if (err != -EAGAIN) | ||
324 | break; | ||
325 | if (signal_pending(current)) { | ||
326 | err = -EINTR; | ||
327 | break; | ||
328 | } | ||
329 | } | ||
330 | |||
331 | return ERR_PTR(err); | ||
332 | } | ||
333 | |||
334 | static struct crypto_alg *crypto_user_aead_alg(const char *name, u32 type, | ||
335 | u32 mask) | ||
336 | { | ||
337 | int err; | ||
338 | struct crypto_alg *alg; | ||
339 | |||
340 | type &= ~(CRYPTO_ALG_TYPE_MASK | CRYPTO_ALG_GENIV); | ||
341 | type |= CRYPTO_ALG_TYPE_AEAD; | ||
342 | mask &= ~(CRYPTO_ALG_TYPE_MASK | CRYPTO_ALG_GENIV); | ||
343 | mask |= CRYPTO_ALG_TYPE_MASK; | ||
344 | |||
345 | for (;;) { | ||
346 | alg = crypto_lookup_aead(name, type, mask); | ||
347 | if (!IS_ERR(alg)) | ||
348 | return alg; | ||
349 | |||
350 | err = PTR_ERR(alg); | ||
351 | if (err != -EAGAIN) | ||
352 | break; | ||
353 | if (signal_pending(current)) { | ||
354 | err = -EINTR; | ||
355 | break; | ||
356 | } | ||
357 | } | ||
358 | |||
359 | return ERR_PTR(err); | ||
360 | } | ||
361 | |||
304 | static int crypto_add_alg(struct sk_buff *skb, struct nlmsghdr *nlh, | 362 | static int crypto_add_alg(struct sk_buff *skb, struct nlmsghdr *nlh, |
305 | struct nlattr **attrs) | 363 | struct nlattr **attrs) |
306 | { | 364 | { |
@@ -325,7 +383,19 @@ static int crypto_add_alg(struct sk_buff *skb, struct nlmsghdr *nlh, | |||
325 | else | 383 | else |
326 | name = p->cru_name; | 384 | name = p->cru_name; |
327 | 385 | ||
328 | alg = crypto_alg_mod_lookup(name, p->cru_type, p->cru_mask); | 386 | switch (p->cru_type & p->cru_mask & CRYPTO_ALG_TYPE_MASK) { |
387 | case CRYPTO_ALG_TYPE_AEAD: | ||
388 | alg = crypto_user_aead_alg(name, p->cru_type, p->cru_mask); | ||
389 | break; | ||
390 | case CRYPTO_ALG_TYPE_GIVCIPHER: | ||
391 | case CRYPTO_ALG_TYPE_BLKCIPHER: | ||
392 | case CRYPTO_ALG_TYPE_ABLKCIPHER: | ||
393 | alg = crypto_user_skcipher_alg(name, p->cru_type, p->cru_mask); | ||
394 | break; | ||
395 | default: | ||
396 | alg = crypto_alg_mod_lookup(name, p->cru_type, p->cru_mask); | ||
397 | } | ||
398 | |||
329 | if (IS_ERR(alg)) | 399 | if (IS_ERR(alg)) |
330 | return PTR_ERR(alg); | 400 | return PTR_ERR(alg); |
331 | 401 | ||
@@ -387,12 +457,20 @@ static int crypto_user_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh) | |||
387 | 457 | ||
388 | if ((type == (CRYPTO_MSG_GETALG - CRYPTO_MSG_BASE) && | 458 | if ((type == (CRYPTO_MSG_GETALG - CRYPTO_MSG_BASE) && |
389 | (nlh->nlmsg_flags & NLM_F_DUMP))) { | 459 | (nlh->nlmsg_flags & NLM_F_DUMP))) { |
460 | struct crypto_alg *alg; | ||
461 | u16 dump_alloc = 0; | ||
462 | |||
390 | if (link->dump == NULL) | 463 | if (link->dump == NULL) |
391 | return -EINVAL; | 464 | return -EINVAL; |
465 | |||
466 | list_for_each_entry(alg, &crypto_alg_list, cra_list) | ||
467 | dump_alloc += CRYPTO_REPORT_MAXSIZE; | ||
468 | |||
392 | { | 469 | { |
393 | struct netlink_dump_control c = { | 470 | struct netlink_dump_control c = { |
394 | .dump = link->dump, | 471 | .dump = link->dump, |
395 | .done = link->done, | 472 | .done = link->done, |
473 | .min_dump_alloc = dump_alloc, | ||
396 | }; | 474 | }; |
397 | return netlink_dump_start(crypto_nlsk, skb, nlh, &c); | 475 | return netlink_dump_start(crypto_nlsk, skb, nlh, &c); |
398 | } | 476 | } |
diff --git a/crypto/pcrypt.c b/crypto/pcrypt.c index 29a89dad68b6..b2c99dc1c5e2 100644 --- a/crypto/pcrypt.c +++ b/crypto/pcrypt.c | |||
@@ -280,11 +280,11 @@ static int pcrypt_aead_init_tfm(struct crypto_tfm *tfm) | |||
280 | 280 | ||
281 | ictx->tfm_count++; | 281 | ictx->tfm_count++; |
282 | 282 | ||
283 | cpu_index = ictx->tfm_count % cpumask_weight(cpu_active_mask); | 283 | cpu_index = ictx->tfm_count % cpumask_weight(cpu_online_mask); |
284 | 284 | ||
285 | ctx->cb_cpu = cpumask_first(cpu_active_mask); | 285 | ctx->cb_cpu = cpumask_first(cpu_online_mask); |
286 | for (cpu = 0; cpu < cpu_index; cpu++) | 286 | for (cpu = 0; cpu < cpu_index; cpu++) |
287 | ctx->cb_cpu = cpumask_next(ctx->cb_cpu, cpu_active_mask); | 287 | ctx->cb_cpu = cpumask_next(ctx->cb_cpu, cpu_online_mask); |
288 | 288 | ||
289 | cipher = crypto_spawn_aead(crypto_instance_ctx(inst)); | 289 | cipher = crypto_spawn_aead(crypto_instance_ctx(inst)); |
290 | 290 | ||
@@ -472,7 +472,7 @@ static int pcrypt_init_padata(struct padata_pcrypt *pcrypt, | |||
472 | goto err_free_padata; | 472 | goto err_free_padata; |
473 | } | 473 | } |
474 | 474 | ||
475 | cpumask_and(mask->mask, cpu_possible_mask, cpu_active_mask); | 475 | cpumask_and(mask->mask, cpu_possible_mask, cpu_online_mask); |
476 | rcu_assign_pointer(pcrypt->cb_cpumask, mask); | 476 | rcu_assign_pointer(pcrypt->cb_cpumask, mask); |
477 | 477 | ||
478 | pcrypt->nblock.notifier_call = pcrypt_cpumask_change_notify; | 478 | pcrypt->nblock.notifier_call = pcrypt_cpumask_change_notify; |
diff --git a/drivers/Kconfig b/drivers/Kconfig index 6f0459cb745b..d236aef7e59f 100644 --- a/drivers/Kconfig +++ b/drivers/Kconfig | |||
@@ -50,6 +50,8 @@ source "drivers/i2c/Kconfig" | |||
50 | 50 | ||
51 | source "drivers/spi/Kconfig" | 51 | source "drivers/spi/Kconfig" |
52 | 52 | ||
53 | source "drivers/hsi/Kconfig" | ||
54 | |||
53 | source "drivers/pps/Kconfig" | 55 | source "drivers/pps/Kconfig" |
54 | 56 | ||
55 | source "drivers/ptp/Kconfig" | 57 | source "drivers/ptp/Kconfig" |
diff --git a/drivers/Makefile b/drivers/Makefile index 262b19d6b627..95952c82bf16 100644 --- a/drivers/Makefile +++ b/drivers/Makefile | |||
@@ -53,6 +53,7 @@ obj-$(CONFIG_ATA) += ata/ | |||
53 | obj-$(CONFIG_TARGET_CORE) += target/ | 53 | obj-$(CONFIG_TARGET_CORE) += target/ |
54 | obj-$(CONFIG_MTD) += mtd/ | 54 | obj-$(CONFIG_MTD) += mtd/ |
55 | obj-$(CONFIG_SPI) += spi/ | 55 | obj-$(CONFIG_SPI) += spi/ |
56 | obj-y += hsi/ | ||
56 | obj-y += net/ | 57 | obj-y += net/ |
57 | obj-$(CONFIG_ATM) += atm/ | 58 | obj-$(CONFIG_ATM) += atm/ |
58 | obj-$(CONFIG_FUSION) += message/ | 59 | obj-$(CONFIG_FUSION) += message/ |
diff --git a/drivers/acpi/ec_sys.c b/drivers/acpi/ec_sys.c index b258cab9061c..7586544fddb4 100644 --- a/drivers/acpi/ec_sys.c +++ b/drivers/acpi/ec_sys.c | |||
@@ -27,12 +27,6 @@ MODULE_PARM_DESC(write_support, "Dangerous, reboot and removal of battery may " | |||
27 | 27 | ||
28 | static struct dentry *acpi_ec_debugfs_dir; | 28 | static struct dentry *acpi_ec_debugfs_dir; |
29 | 29 | ||
30 | static int acpi_ec_open_io(struct inode *i, struct file *f) | ||
31 | { | ||
32 | f->private_data = i->i_private; | ||
33 | return 0; | ||
34 | } | ||
35 | |||
36 | static ssize_t acpi_ec_read_io(struct file *f, char __user *buf, | 30 | static ssize_t acpi_ec_read_io(struct file *f, char __user *buf, |
37 | size_t count, loff_t *off) | 31 | size_t count, loff_t *off) |
38 | { | 32 | { |
@@ -95,7 +89,7 @@ static ssize_t acpi_ec_write_io(struct file *f, const char __user *buf, | |||
95 | 89 | ||
96 | static const struct file_operations acpi_ec_io_ops = { | 90 | static const struct file_operations acpi_ec_io_ops = { |
97 | .owner = THIS_MODULE, | 91 | .owner = THIS_MODULE, |
98 | .open = acpi_ec_open_io, | 92 | .open = simple_open, |
99 | .read = acpi_ec_read_io, | 93 | .read = acpi_ec_read_io, |
100 | .write = acpi_ec_write_io, | 94 | .write = acpi_ec_write_io, |
101 | .llseek = default_llseek, | 95 | .llseek = default_llseek, |
diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c index 6c9387d646ec..5401814c874d 100644 --- a/drivers/base/firmware_class.c +++ b/drivers/base/firmware_class.c | |||
@@ -16,10 +16,11 @@ | |||
16 | #include <linux/interrupt.h> | 16 | #include <linux/interrupt.h> |
17 | #include <linux/bitops.h> | 17 | #include <linux/bitops.h> |
18 | #include <linux/mutex.h> | 18 | #include <linux/mutex.h> |
19 | #include <linux/kthread.h> | 19 | #include <linux/workqueue.h> |
20 | #include <linux/highmem.h> | 20 | #include <linux/highmem.h> |
21 | #include <linux/firmware.h> | 21 | #include <linux/firmware.h> |
22 | #include <linux/slab.h> | 22 | #include <linux/slab.h> |
23 | #include <linux/sched.h> | ||
23 | 24 | ||
24 | #define to_dev(obj) container_of(obj, struct device, kobj) | 25 | #define to_dev(obj) container_of(obj, struct device, kobj) |
25 | 26 | ||
@@ -81,6 +82,11 @@ enum { | |||
81 | 82 | ||
82 | static int loading_timeout = 60; /* In seconds */ | 83 | static int loading_timeout = 60; /* In seconds */ |
83 | 84 | ||
85 | static inline long firmware_loading_timeout(void) | ||
86 | { | ||
87 | return loading_timeout > 0 ? loading_timeout * HZ : MAX_SCHEDULE_TIMEOUT; | ||
88 | } | ||
89 | |||
84 | /* fw_lock could be moved to 'struct firmware_priv' but since it is just | 90 | /* fw_lock could be moved to 'struct firmware_priv' but since it is just |
85 | * guarding for corner cases a global lock should be OK */ | 91 | * guarding for corner cases a global lock should be OK */ |
86 | static DEFINE_MUTEX(fw_lock); | 92 | static DEFINE_MUTEX(fw_lock); |
@@ -440,13 +446,11 @@ fw_create_instance(struct firmware *firmware, const char *fw_name, | |||
440 | { | 446 | { |
441 | struct firmware_priv *fw_priv; | 447 | struct firmware_priv *fw_priv; |
442 | struct device *f_dev; | 448 | struct device *f_dev; |
443 | int error; | ||
444 | 449 | ||
445 | fw_priv = kzalloc(sizeof(*fw_priv) + strlen(fw_name) + 1 , GFP_KERNEL); | 450 | fw_priv = kzalloc(sizeof(*fw_priv) + strlen(fw_name) + 1 , GFP_KERNEL); |
446 | if (!fw_priv) { | 451 | if (!fw_priv) { |
447 | dev_err(device, "%s: kmalloc failed\n", __func__); | 452 | dev_err(device, "%s: kmalloc failed\n", __func__); |
448 | error = -ENOMEM; | 453 | return ERR_PTR(-ENOMEM); |
449 | goto err_out; | ||
450 | } | 454 | } |
451 | 455 | ||
452 | fw_priv->fw = firmware; | 456 | fw_priv->fw = firmware; |
@@ -463,98 +467,80 @@ fw_create_instance(struct firmware *firmware, const char *fw_name, | |||
463 | f_dev->parent = device; | 467 | f_dev->parent = device; |
464 | f_dev->class = &firmware_class; | 468 | f_dev->class = &firmware_class; |
465 | 469 | ||
466 | dev_set_uevent_suppress(f_dev, true); | ||
467 | |||
468 | /* Need to pin this module until class device is destroyed */ | ||
469 | __module_get(THIS_MODULE); | ||
470 | |||
471 | error = device_add(f_dev); | ||
472 | if (error) { | ||
473 | dev_err(device, "%s: device_register failed\n", __func__); | ||
474 | goto err_put_dev; | ||
475 | } | ||
476 | |||
477 | error = device_create_bin_file(f_dev, &firmware_attr_data); | ||
478 | if (error) { | ||
479 | dev_err(device, "%s: sysfs_create_bin_file failed\n", __func__); | ||
480 | goto err_del_dev; | ||
481 | } | ||
482 | |||
483 | error = device_create_file(f_dev, &dev_attr_loading); | ||
484 | if (error) { | ||
485 | dev_err(device, "%s: device_create_file failed\n", __func__); | ||
486 | goto err_del_bin_attr; | ||
487 | } | ||
488 | |||
489 | if (uevent) | ||
490 | dev_set_uevent_suppress(f_dev, false); | ||
491 | |||
492 | return fw_priv; | 470 | return fw_priv; |
493 | |||
494 | err_del_bin_attr: | ||
495 | device_remove_bin_file(f_dev, &firmware_attr_data); | ||
496 | err_del_dev: | ||
497 | device_del(f_dev); | ||
498 | err_put_dev: | ||
499 | put_device(f_dev); | ||
500 | err_out: | ||
501 | return ERR_PTR(error); | ||
502 | } | 471 | } |
503 | 472 | ||
504 | static void fw_destroy_instance(struct firmware_priv *fw_priv) | 473 | static struct firmware_priv * |
505 | { | 474 | _request_firmware_prepare(const struct firmware **firmware_p, const char *name, |
506 | struct device *f_dev = &fw_priv->dev; | 475 | struct device *device, bool uevent, bool nowait) |
507 | |||
508 | device_remove_file(f_dev, &dev_attr_loading); | ||
509 | device_remove_bin_file(f_dev, &firmware_attr_data); | ||
510 | device_unregister(f_dev); | ||
511 | } | ||
512 | |||
513 | static int _request_firmware(const struct firmware **firmware_p, | ||
514 | const char *name, struct device *device, | ||
515 | bool uevent, bool nowait) | ||
516 | { | 476 | { |
517 | struct firmware_priv *fw_priv; | ||
518 | struct firmware *firmware; | 477 | struct firmware *firmware; |
519 | int retval = 0; | 478 | struct firmware_priv *fw_priv; |
520 | 479 | ||
521 | if (!firmware_p) | 480 | if (!firmware_p) |
522 | return -EINVAL; | 481 | return ERR_PTR(-EINVAL); |
523 | 482 | ||
524 | *firmware_p = firmware = kzalloc(sizeof(*firmware), GFP_KERNEL); | 483 | *firmware_p = firmware = kzalloc(sizeof(*firmware), GFP_KERNEL); |
525 | if (!firmware) { | 484 | if (!firmware) { |
526 | dev_err(device, "%s: kmalloc(struct firmware) failed\n", | 485 | dev_err(device, "%s: kmalloc(struct firmware) failed\n", |
527 | __func__); | 486 | __func__); |
528 | return -ENOMEM; | 487 | return ERR_PTR(-ENOMEM); |
529 | } | 488 | } |
530 | 489 | ||
531 | if (fw_get_builtin_firmware(firmware, name)) { | 490 | if (fw_get_builtin_firmware(firmware, name)) { |
532 | dev_dbg(device, "firmware: using built-in firmware %s\n", name); | 491 | dev_dbg(device, "firmware: using built-in firmware %s\n", name); |
533 | return 0; | 492 | return NULL; |
493 | } | ||
494 | |||
495 | fw_priv = fw_create_instance(firmware, name, device, uevent, nowait); | ||
496 | if (IS_ERR(fw_priv)) { | ||
497 | release_firmware(firmware); | ||
498 | *firmware_p = NULL; | ||
534 | } | 499 | } |
500 | return fw_priv; | ||
501 | } | ||
535 | 502 | ||
536 | read_lock_usermodehelper(); | 503 | static void _request_firmware_cleanup(const struct firmware **firmware_p) |
504 | { | ||
505 | release_firmware(*firmware_p); | ||
506 | *firmware_p = NULL; | ||
507 | } | ||
537 | 508 | ||
538 | if (WARN_ON(usermodehelper_is_disabled())) { | 509 | static int _request_firmware_load(struct firmware_priv *fw_priv, bool uevent, |
539 | dev_err(device, "firmware: %s will not be loaded\n", name); | 510 | long timeout) |
540 | retval = -EBUSY; | 511 | { |
541 | goto out; | 512 | int retval = 0; |
513 | struct device *f_dev = &fw_priv->dev; | ||
514 | |||
515 | dev_set_uevent_suppress(f_dev, true); | ||
516 | |||
517 | /* Need to pin this module until class device is destroyed */ | ||
518 | __module_get(THIS_MODULE); | ||
519 | |||
520 | retval = device_add(f_dev); | ||
521 | if (retval) { | ||
522 | dev_err(f_dev, "%s: device_register failed\n", __func__); | ||
523 | goto err_put_dev; | ||
542 | } | 524 | } |
543 | 525 | ||
544 | if (uevent) | 526 | retval = device_create_bin_file(f_dev, &firmware_attr_data); |
545 | dev_dbg(device, "firmware: requesting %s\n", name); | 527 | if (retval) { |
528 | dev_err(f_dev, "%s: sysfs_create_bin_file failed\n", __func__); | ||
529 | goto err_del_dev; | ||
530 | } | ||
546 | 531 | ||
547 | fw_priv = fw_create_instance(firmware, name, device, uevent, nowait); | 532 | retval = device_create_file(f_dev, &dev_attr_loading); |
548 | if (IS_ERR(fw_priv)) { | 533 | if (retval) { |
549 | retval = PTR_ERR(fw_priv); | 534 | dev_err(f_dev, "%s: device_create_file failed\n", __func__); |
550 | goto out; | 535 | goto err_del_bin_attr; |
551 | } | 536 | } |
552 | 537 | ||
553 | if (uevent) { | 538 | if (uevent) { |
554 | if (loading_timeout > 0) | 539 | dev_set_uevent_suppress(f_dev, false); |
540 | dev_dbg(f_dev, "firmware: requesting %s\n", fw_priv->fw_id); | ||
541 | if (timeout != MAX_SCHEDULE_TIMEOUT) | ||
555 | mod_timer(&fw_priv->timeout, | 542 | mod_timer(&fw_priv->timeout, |
556 | round_jiffies_up(jiffies + | 543 | round_jiffies_up(jiffies + timeout)); |
557 | loading_timeout * HZ)); | ||
558 | 544 | ||
559 | kobject_uevent(&fw_priv->dev.kobj, KOBJ_ADD); | 545 | kobject_uevent(&fw_priv->dev.kobj, KOBJ_ADD); |
560 | } | 546 | } |
@@ -570,16 +556,13 @@ static int _request_firmware(const struct firmware **firmware_p, | |||
570 | fw_priv->fw = NULL; | 556 | fw_priv->fw = NULL; |
571 | mutex_unlock(&fw_lock); | 557 | mutex_unlock(&fw_lock); |
572 | 558 | ||
573 | fw_destroy_instance(fw_priv); | 559 | device_remove_file(f_dev, &dev_attr_loading); |
574 | 560 | err_del_bin_attr: | |
575 | out: | 561 | device_remove_bin_file(f_dev, &firmware_attr_data); |
576 | read_unlock_usermodehelper(); | 562 | err_del_dev: |
577 | 563 | device_del(f_dev); | |
578 | if (retval) { | 564 | err_put_dev: |
579 | release_firmware(firmware); | 565 | put_device(f_dev); |
580 | *firmware_p = NULL; | ||
581 | } | ||
582 | |||
583 | return retval; | 566 | return retval; |
584 | } | 567 | } |
585 | 568 | ||
@@ -602,7 +585,26 @@ int | |||
602 | request_firmware(const struct firmware **firmware_p, const char *name, | 585 | request_firmware(const struct firmware **firmware_p, const char *name, |
603 | struct device *device) | 586 | struct device *device) |
604 | { | 587 | { |
605 | return _request_firmware(firmware_p, name, device, true, false); | 588 | struct firmware_priv *fw_priv; |
589 | int ret; | ||
590 | |||
591 | fw_priv = _request_firmware_prepare(firmware_p, name, device, true, | ||
592 | false); | ||
593 | if (IS_ERR_OR_NULL(fw_priv)) | ||
594 | return PTR_RET(fw_priv); | ||
595 | |||
596 | ret = usermodehelper_read_trylock(); | ||
597 | if (WARN_ON(ret)) { | ||
598 | dev_err(device, "firmware: %s will not be loaded\n", name); | ||
599 | } else { | ||
600 | ret = _request_firmware_load(fw_priv, true, | ||
601 | firmware_loading_timeout()); | ||
602 | usermodehelper_read_unlock(); | ||
603 | } | ||
604 | if (ret) | ||
605 | _request_firmware_cleanup(firmware_p); | ||
606 | |||
607 | return ret; | ||
606 | } | 608 | } |
607 | 609 | ||
608 | /** | 610 | /** |
@@ -629,25 +631,39 @@ struct firmware_work { | |||
629 | bool uevent; | 631 | bool uevent; |
630 | }; | 632 | }; |
631 | 633 | ||
632 | static int request_firmware_work_func(void *arg) | 634 | static void request_firmware_work_func(struct work_struct *work) |
633 | { | 635 | { |
634 | struct firmware_work *fw_work = arg; | 636 | struct firmware_work *fw_work; |
635 | const struct firmware *fw; | 637 | const struct firmware *fw; |
638 | struct firmware_priv *fw_priv; | ||
639 | long timeout; | ||
636 | int ret; | 640 | int ret; |
637 | 641 | ||
638 | if (!arg) { | 642 | fw_work = container_of(work, struct firmware_work, work); |
639 | WARN_ON(1); | 643 | fw_priv = _request_firmware_prepare(&fw, fw_work->name, fw_work->device, |
640 | return 0; | 644 | fw_work->uevent, true); |
645 | if (IS_ERR_OR_NULL(fw_priv)) { | ||
646 | ret = PTR_RET(fw_priv); | ||
647 | goto out; | ||
648 | } | ||
649 | |||
650 | timeout = usermodehelper_read_lock_wait(firmware_loading_timeout()); | ||
651 | if (timeout) { | ||
652 | ret = _request_firmware_load(fw_priv, fw_work->uevent, timeout); | ||
653 | usermodehelper_read_unlock(); | ||
654 | } else { | ||
655 | dev_dbg(fw_work->device, "firmware: %s loading timed out\n", | ||
656 | fw_work->name); | ||
657 | ret = -EAGAIN; | ||
641 | } | 658 | } |
659 | if (ret) | ||
660 | _request_firmware_cleanup(&fw); | ||
642 | 661 | ||
643 | ret = _request_firmware(&fw, fw_work->name, fw_work->device, | 662 | out: |
644 | fw_work->uevent, true); | ||
645 | fw_work->cont(fw, fw_work->context); | 663 | fw_work->cont(fw, fw_work->context); |
646 | 664 | ||
647 | module_put(fw_work->module); | 665 | module_put(fw_work->module); |
648 | kfree(fw_work); | 666 | kfree(fw_work); |
649 | |||
650 | return ret; | ||
651 | } | 667 | } |
652 | 668 | ||
653 | /** | 669 | /** |
@@ -673,7 +689,6 @@ request_firmware_nowait( | |||
673 | const char *name, struct device *device, gfp_t gfp, void *context, | 689 | const char *name, struct device *device, gfp_t gfp, void *context, |
674 | void (*cont)(const struct firmware *fw, void *context)) | 690 | void (*cont)(const struct firmware *fw, void *context)) |
675 | { | 691 | { |
676 | struct task_struct *task; | ||
677 | struct firmware_work *fw_work; | 692 | struct firmware_work *fw_work; |
678 | 693 | ||
679 | fw_work = kzalloc(sizeof (struct firmware_work), gfp); | 694 | fw_work = kzalloc(sizeof (struct firmware_work), gfp); |
@@ -692,15 +707,8 @@ request_firmware_nowait( | |||
692 | return -EFAULT; | 707 | return -EFAULT; |
693 | } | 708 | } |
694 | 709 | ||
695 | task = kthread_run(request_firmware_work_func, fw_work, | 710 | INIT_WORK(&fw_work->work, request_firmware_work_func); |
696 | "firmware/%s", name); | 711 | schedule_work(&fw_work->work); |
697 | if (IS_ERR(task)) { | ||
698 | fw_work->cont(NULL, fw_work->context); | ||
699 | module_put(fw_work->module); | ||
700 | kfree(fw_work); | ||
701 | return PTR_ERR(task); | ||
702 | } | ||
703 | |||
704 | return 0; | 712 | return 0; |
705 | } | 713 | } |
706 | 714 | ||
diff --git a/drivers/base/power/runtime.c b/drivers/base/power/runtime.c index 541f821d4ea6..bd0f3949bcf9 100644 --- a/drivers/base/power/runtime.c +++ b/drivers/base/power/runtime.c | |||
@@ -532,6 +532,8 @@ static int rpm_suspend(struct device *dev, int rpmflags) | |||
532 | dev->power.suspend_time = ktime_set(0, 0); | 532 | dev->power.suspend_time = ktime_set(0, 0); |
533 | dev->power.max_time_suspended_ns = -1; | 533 | dev->power.max_time_suspended_ns = -1; |
534 | dev->power.deferred_resume = false; | 534 | dev->power.deferred_resume = false; |
535 | wake_up_all(&dev->power.wait_queue); | ||
536 | |||
535 | if (retval == -EAGAIN || retval == -EBUSY) { | 537 | if (retval == -EAGAIN || retval == -EBUSY) { |
536 | dev->power.runtime_error = 0; | 538 | dev->power.runtime_error = 0; |
537 | 539 | ||
@@ -547,7 +549,6 @@ static int rpm_suspend(struct device *dev, int rpmflags) | |||
547 | } else { | 549 | } else { |
548 | pm_runtime_cancel_pending(dev); | 550 | pm_runtime_cancel_pending(dev); |
549 | } | 551 | } |
550 | wake_up_all(&dev->power.wait_queue); | ||
551 | goto out; | 552 | goto out; |
552 | } | 553 | } |
553 | 554 | ||
diff --git a/drivers/base/regmap/regcache-rbtree.c b/drivers/base/regmap/regcache-rbtree.c index 5157fa04c2f0..fb14a6343d4f 100644 --- a/drivers/base/regmap/regcache-rbtree.c +++ b/drivers/base/regmap/regcache-rbtree.c | |||
@@ -396,7 +396,7 @@ static int regcache_rbtree_sync(struct regmap *map, unsigned int min, | |||
396 | map->cache_word_size); | 396 | map->cache_word_size); |
397 | 397 | ||
398 | /* Is this the hardware default? If so skip. */ | 398 | /* Is this the hardware default? If so skip. */ |
399 | ret = regcache_lookup_reg(map, i); | 399 | ret = regcache_lookup_reg(map, regtmp); |
400 | if (ret >= 0 && val == map->reg_defaults[ret].def) | 400 | if (ret >= 0 && val == map->reg_defaults[ret].def) |
401 | continue; | 401 | continue; |
402 | 402 | ||
diff --git a/drivers/base/regmap/regmap-debugfs.c b/drivers/base/regmap/regmap-debugfs.c index 58517a5dac13..251eb70f83e7 100644 --- a/drivers/base/regmap/regmap-debugfs.c +++ b/drivers/base/regmap/regmap-debugfs.c | |||
@@ -27,12 +27,6 @@ static size_t regmap_calc_reg_len(int max_val, char *buf, size_t buf_size) | |||
27 | return strlen(buf); | 27 | return strlen(buf); |
28 | } | 28 | } |
29 | 29 | ||
30 | static int regmap_open_file(struct inode *inode, struct file *file) | ||
31 | { | ||
32 | file->private_data = inode->i_private; | ||
33 | return 0; | ||
34 | } | ||
35 | |||
36 | static ssize_t regmap_name_read_file(struct file *file, | 30 | static ssize_t regmap_name_read_file(struct file *file, |
37 | char __user *user_buf, size_t count, | 31 | char __user *user_buf, size_t count, |
38 | loff_t *ppos) | 32 | loff_t *ppos) |
@@ -57,7 +51,7 @@ static ssize_t regmap_name_read_file(struct file *file, | |||
57 | } | 51 | } |
58 | 52 | ||
59 | static const struct file_operations regmap_name_fops = { | 53 | static const struct file_operations regmap_name_fops = { |
60 | .open = regmap_open_file, | 54 | .open = simple_open, |
61 | .read = regmap_name_read_file, | 55 | .read = regmap_name_read_file, |
62 | .llseek = default_llseek, | 56 | .llseek = default_llseek, |
63 | }; | 57 | }; |
@@ -174,7 +168,7 @@ static ssize_t regmap_map_write_file(struct file *file, | |||
174 | #endif | 168 | #endif |
175 | 169 | ||
176 | static const struct file_operations regmap_map_fops = { | 170 | static const struct file_operations regmap_map_fops = { |
177 | .open = regmap_open_file, | 171 | .open = simple_open, |
178 | .read = regmap_map_read_file, | 172 | .read = regmap_map_read_file, |
179 | .write = regmap_map_write_file, | 173 | .write = regmap_map_write_file, |
180 | .llseek = default_llseek, | 174 | .llseek = default_llseek, |
@@ -243,7 +237,7 @@ out: | |||
243 | } | 237 | } |
244 | 238 | ||
245 | static const struct file_operations regmap_access_fops = { | 239 | static const struct file_operations regmap_access_fops = { |
246 | .open = regmap_open_file, | 240 | .open = simple_open, |
247 | .read = regmap_access_read_file, | 241 | .read = regmap_access_read_file, |
248 | .llseek = default_llseek, | 242 | .llseek = default_llseek, |
249 | }; | 243 | }; |
diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c index 76a08236430a..b0b00d70c166 100644 --- a/drivers/block/floppy.c +++ b/drivers/block/floppy.c | |||
@@ -1030,37 +1030,6 @@ static int fd_wait_for_completion(unsigned long delay, timeout_fn function) | |||
1030 | return 0; | 1030 | return 0; |
1031 | } | 1031 | } |
1032 | 1032 | ||
1033 | static DEFINE_SPINLOCK(floppy_hlt_lock); | ||
1034 | static int hlt_disabled; | ||
1035 | static void floppy_disable_hlt(void) | ||
1036 | { | ||
1037 | unsigned long flags; | ||
1038 | |||
1039 | WARN_ONCE(1, "floppy_disable_hlt() scheduled for removal in 2012"); | ||
1040 | spin_lock_irqsave(&floppy_hlt_lock, flags); | ||
1041 | if (!hlt_disabled) { | ||
1042 | hlt_disabled = 1; | ||
1043 | #ifdef HAVE_DISABLE_HLT | ||
1044 | disable_hlt(); | ||
1045 | #endif | ||
1046 | } | ||
1047 | spin_unlock_irqrestore(&floppy_hlt_lock, flags); | ||
1048 | } | ||
1049 | |||
1050 | static void floppy_enable_hlt(void) | ||
1051 | { | ||
1052 | unsigned long flags; | ||
1053 | |||
1054 | spin_lock_irqsave(&floppy_hlt_lock, flags); | ||
1055 | if (hlt_disabled) { | ||
1056 | hlt_disabled = 0; | ||
1057 | #ifdef HAVE_DISABLE_HLT | ||
1058 | enable_hlt(); | ||
1059 | #endif | ||
1060 | } | ||
1061 | spin_unlock_irqrestore(&floppy_hlt_lock, flags); | ||
1062 | } | ||
1063 | |||
1064 | static void setup_DMA(void) | 1033 | static void setup_DMA(void) |
1065 | { | 1034 | { |
1066 | unsigned long f; | 1035 | unsigned long f; |
@@ -1105,7 +1074,6 @@ static void setup_DMA(void) | |||
1105 | fd_enable_dma(); | 1074 | fd_enable_dma(); |
1106 | release_dma_lock(f); | 1075 | release_dma_lock(f); |
1107 | #endif | 1076 | #endif |
1108 | floppy_disable_hlt(); | ||
1109 | } | 1077 | } |
1110 | 1078 | ||
1111 | static void show_floppy(void); | 1079 | static void show_floppy(void); |
@@ -1707,7 +1675,6 @@ irqreturn_t floppy_interrupt(int irq, void *dev_id) | |||
1707 | fd_disable_dma(); | 1675 | fd_disable_dma(); |
1708 | release_dma_lock(f); | 1676 | release_dma_lock(f); |
1709 | 1677 | ||
1710 | floppy_enable_hlt(); | ||
1711 | do_floppy = NULL; | 1678 | do_floppy = NULL; |
1712 | if (fdc >= N_FDC || FDCS->address == -1) { | 1679 | if (fdc >= N_FDC || FDCS->address == -1) { |
1713 | /* we don't even know which FDC is the culprit */ | 1680 | /* we don't even know which FDC is the culprit */ |
@@ -1856,8 +1823,6 @@ static void floppy_shutdown(unsigned long data) | |||
1856 | show_floppy(); | 1823 | show_floppy(); |
1857 | cancel_activity(); | 1824 | cancel_activity(); |
1858 | 1825 | ||
1859 | floppy_enable_hlt(); | ||
1860 | |||
1861 | flags = claim_dma_lock(); | 1826 | flags = claim_dma_lock(); |
1862 | fd_disable_dma(); | 1827 | fd_disable_dma(); |
1863 | release_dma_lock(flags); | 1828 | release_dma_lock(flags); |
@@ -4508,7 +4473,6 @@ static void floppy_release_irq_and_dma(void) | |||
4508 | #if N_FDC > 1 | 4473 | #if N_FDC > 1 |
4509 | set_dor(1, ~8, 0); | 4474 | set_dor(1, ~8, 0); |
4510 | #endif | 4475 | #endif |
4511 | floppy_enable_hlt(); | ||
4512 | 4476 | ||
4513 | if (floppy_track_buffer && max_buffer_sectors) { | 4477 | if (floppy_track_buffer && max_buffer_sectors) { |
4514 | tmpsize = max_buffer_sectors * 1024; | 4478 | tmpsize = max_buffer_sectors * 1024; |
diff --git a/drivers/bluetooth/btmrvl_debugfs.c b/drivers/bluetooth/btmrvl_debugfs.c index 6c20bbb54b71..428dbb7574bd 100644 --- a/drivers/bluetooth/btmrvl_debugfs.c +++ b/drivers/bluetooth/btmrvl_debugfs.c | |||
@@ -45,12 +45,6 @@ struct btmrvl_debugfs_data { | |||
45 | struct dentry *txdnldready; | 45 | struct dentry *txdnldready; |
46 | }; | 46 | }; |
47 | 47 | ||
48 | static int btmrvl_open_generic(struct inode *inode, struct file *file) | ||
49 | { | ||
50 | file->private_data = inode->i_private; | ||
51 | return 0; | ||
52 | } | ||
53 | |||
54 | static ssize_t btmrvl_hscfgcmd_write(struct file *file, | 48 | static ssize_t btmrvl_hscfgcmd_write(struct file *file, |
55 | const char __user *ubuf, size_t count, loff_t *ppos) | 49 | const char __user *ubuf, size_t count, loff_t *ppos) |
56 | { | 50 | { |
@@ -93,7 +87,7 @@ static ssize_t btmrvl_hscfgcmd_read(struct file *file, char __user *userbuf, | |||
93 | static const struct file_operations btmrvl_hscfgcmd_fops = { | 87 | static const struct file_operations btmrvl_hscfgcmd_fops = { |
94 | .read = btmrvl_hscfgcmd_read, | 88 | .read = btmrvl_hscfgcmd_read, |
95 | .write = btmrvl_hscfgcmd_write, | 89 | .write = btmrvl_hscfgcmd_write, |
96 | .open = btmrvl_open_generic, | 90 | .open = simple_open, |
97 | .llseek = default_llseek, | 91 | .llseek = default_llseek, |
98 | }; | 92 | }; |
99 | 93 | ||
@@ -134,7 +128,7 @@ static ssize_t btmrvl_psmode_read(struct file *file, char __user *userbuf, | |||
134 | static const struct file_operations btmrvl_psmode_fops = { | 128 | static const struct file_operations btmrvl_psmode_fops = { |
135 | .read = btmrvl_psmode_read, | 129 | .read = btmrvl_psmode_read, |
136 | .write = btmrvl_psmode_write, | 130 | .write = btmrvl_psmode_write, |
137 | .open = btmrvl_open_generic, | 131 | .open = simple_open, |
138 | .llseek = default_llseek, | 132 | .llseek = default_llseek, |
139 | }; | 133 | }; |
140 | 134 | ||
@@ -180,7 +174,7 @@ static ssize_t btmrvl_pscmd_read(struct file *file, char __user *userbuf, | |||
180 | static const struct file_operations btmrvl_pscmd_fops = { | 174 | static const struct file_operations btmrvl_pscmd_fops = { |
181 | .read = btmrvl_pscmd_read, | 175 | .read = btmrvl_pscmd_read, |
182 | .write = btmrvl_pscmd_write, | 176 | .write = btmrvl_pscmd_write, |
183 | .open = btmrvl_open_generic, | 177 | .open = simple_open, |
184 | .llseek = default_llseek, | 178 | .llseek = default_llseek, |
185 | }; | 179 | }; |
186 | 180 | ||
@@ -221,7 +215,7 @@ static ssize_t btmrvl_gpiogap_read(struct file *file, char __user *userbuf, | |||
221 | static const struct file_operations btmrvl_gpiogap_fops = { | 215 | static const struct file_operations btmrvl_gpiogap_fops = { |
222 | .read = btmrvl_gpiogap_read, | 216 | .read = btmrvl_gpiogap_read, |
223 | .write = btmrvl_gpiogap_write, | 217 | .write = btmrvl_gpiogap_write, |
224 | .open = btmrvl_open_generic, | 218 | .open = simple_open, |
225 | .llseek = default_llseek, | 219 | .llseek = default_llseek, |
226 | }; | 220 | }; |
227 | 221 | ||
@@ -265,7 +259,7 @@ static ssize_t btmrvl_hscmd_read(struct file *file, char __user *userbuf, | |||
265 | static const struct file_operations btmrvl_hscmd_fops = { | 259 | static const struct file_operations btmrvl_hscmd_fops = { |
266 | .read = btmrvl_hscmd_read, | 260 | .read = btmrvl_hscmd_read, |
267 | .write = btmrvl_hscmd_write, | 261 | .write = btmrvl_hscmd_write, |
268 | .open = btmrvl_open_generic, | 262 | .open = simple_open, |
269 | .llseek = default_llseek, | 263 | .llseek = default_llseek, |
270 | }; | 264 | }; |
271 | 265 | ||
@@ -305,7 +299,7 @@ static ssize_t btmrvl_hsmode_read(struct file *file, char __user * userbuf, | |||
305 | static const struct file_operations btmrvl_hsmode_fops = { | 299 | static const struct file_operations btmrvl_hsmode_fops = { |
306 | .read = btmrvl_hsmode_read, | 300 | .read = btmrvl_hsmode_read, |
307 | .write = btmrvl_hsmode_write, | 301 | .write = btmrvl_hsmode_write, |
308 | .open = btmrvl_open_generic, | 302 | .open = simple_open, |
309 | .llseek = default_llseek, | 303 | .llseek = default_llseek, |
310 | }; | 304 | }; |
311 | 305 | ||
@@ -323,7 +317,7 @@ static ssize_t btmrvl_curpsmode_read(struct file *file, char __user *userbuf, | |||
323 | 317 | ||
324 | static const struct file_operations btmrvl_curpsmode_fops = { | 318 | static const struct file_operations btmrvl_curpsmode_fops = { |
325 | .read = btmrvl_curpsmode_read, | 319 | .read = btmrvl_curpsmode_read, |
326 | .open = btmrvl_open_generic, | 320 | .open = simple_open, |
327 | .llseek = default_llseek, | 321 | .llseek = default_llseek, |
328 | }; | 322 | }; |
329 | 323 | ||
@@ -341,7 +335,7 @@ static ssize_t btmrvl_psstate_read(struct file *file, char __user * userbuf, | |||
341 | 335 | ||
342 | static const struct file_operations btmrvl_psstate_fops = { | 336 | static const struct file_operations btmrvl_psstate_fops = { |
343 | .read = btmrvl_psstate_read, | 337 | .read = btmrvl_psstate_read, |
344 | .open = btmrvl_open_generic, | 338 | .open = simple_open, |
345 | .llseek = default_llseek, | 339 | .llseek = default_llseek, |
346 | }; | 340 | }; |
347 | 341 | ||
@@ -359,7 +353,7 @@ static ssize_t btmrvl_hsstate_read(struct file *file, char __user *userbuf, | |||
359 | 353 | ||
360 | static const struct file_operations btmrvl_hsstate_fops = { | 354 | static const struct file_operations btmrvl_hsstate_fops = { |
361 | .read = btmrvl_hsstate_read, | 355 | .read = btmrvl_hsstate_read, |
362 | .open = btmrvl_open_generic, | 356 | .open = simple_open, |
363 | .llseek = default_llseek, | 357 | .llseek = default_llseek, |
364 | }; | 358 | }; |
365 | 359 | ||
@@ -378,7 +372,7 @@ static ssize_t btmrvl_txdnldready_read(struct file *file, char __user *userbuf, | |||
378 | 372 | ||
379 | static const struct file_operations btmrvl_txdnldready_fops = { | 373 | static const struct file_operations btmrvl_txdnldready_fops = { |
380 | .read = btmrvl_txdnldready_read, | 374 | .read = btmrvl_txdnldready_read, |
381 | .open = btmrvl_open_generic, | 375 | .open = simple_open, |
382 | .llseek = default_llseek, | 376 | .llseek = default_llseek, |
383 | }; | 377 | }; |
384 | 378 | ||
diff --git a/drivers/char/agp/intel-agp.h b/drivers/char/agp/intel-agp.h index 5da67f165afa..7ea18a5fe71c 100644 --- a/drivers/char/agp/intel-agp.h +++ b/drivers/char/agp/intel-agp.h | |||
@@ -234,6 +234,7 @@ | |||
234 | #define PCI_DEVICE_ID_INTEL_IVYBRIDGE_M_GT2_IG 0x0166 | 234 | #define PCI_DEVICE_ID_INTEL_IVYBRIDGE_M_GT2_IG 0x0166 |
235 | #define PCI_DEVICE_ID_INTEL_IVYBRIDGE_S_HB 0x0158 /* Server */ | 235 | #define PCI_DEVICE_ID_INTEL_IVYBRIDGE_S_HB 0x0158 /* Server */ |
236 | #define PCI_DEVICE_ID_INTEL_IVYBRIDGE_S_GT1_IG 0x015A | 236 | #define PCI_DEVICE_ID_INTEL_IVYBRIDGE_S_GT1_IG 0x015A |
237 | #define PCI_DEVICE_ID_INTEL_IVYBRIDGE_S_GT2_IG 0x016A | ||
237 | 238 | ||
238 | int intel_gmch_probe(struct pci_dev *pdev, | 239 | int intel_gmch_probe(struct pci_dev *pdev, |
239 | struct agp_bridge_data *bridge); | 240 | struct agp_bridge_data *bridge); |
diff --git a/drivers/char/agp/intel-gtt.c b/drivers/char/agp/intel-gtt.c index 5cf47ac2d401..7f025fb620de 100644 --- a/drivers/char/agp/intel-gtt.c +++ b/drivers/char/agp/intel-gtt.c | |||
@@ -1190,7 +1190,6 @@ static inline int needs_idle_maps(void) | |||
1190 | { | 1190 | { |
1191 | #ifdef CONFIG_INTEL_IOMMU | 1191 | #ifdef CONFIG_INTEL_IOMMU |
1192 | const unsigned short gpu_devid = intel_private.pcidev->device; | 1192 | const unsigned short gpu_devid = intel_private.pcidev->device; |
1193 | extern int intel_iommu_gfx_mapped; | ||
1194 | 1193 | ||
1195 | /* Query intel_iommu to see if we need the workaround. Presumably that | 1194 | /* Query intel_iommu to see if we need the workaround. Presumably that |
1196 | * was loaded first. | 1195 | * was loaded first. |
@@ -1459,6 +1458,8 @@ static const struct intel_gtt_driver_description { | |||
1459 | "Ivybridge", &sandybridge_gtt_driver }, | 1458 | "Ivybridge", &sandybridge_gtt_driver }, |
1460 | { PCI_DEVICE_ID_INTEL_IVYBRIDGE_S_GT1_IG, | 1459 | { PCI_DEVICE_ID_INTEL_IVYBRIDGE_S_GT1_IG, |
1461 | "Ivybridge", &sandybridge_gtt_driver }, | 1460 | "Ivybridge", &sandybridge_gtt_driver }, |
1461 | { PCI_DEVICE_ID_INTEL_IVYBRIDGE_S_GT2_IG, | ||
1462 | "Ivybridge", &sandybridge_gtt_driver }, | ||
1462 | { 0, NULL, NULL } | 1463 | { 0, NULL, NULL } |
1463 | }; | 1464 | }; |
1464 | 1465 | ||
diff --git a/drivers/char/apm-emulation.c b/drivers/char/apm-emulation.c index 57501ca9204b..46118f845948 100644 --- a/drivers/char/apm-emulation.c +++ b/drivers/char/apm-emulation.c | |||
@@ -301,7 +301,7 @@ apm_ioctl(struct file *filp, u_int cmd, u_long arg) | |||
301 | * anything critical, chill a bit on each iteration. | 301 | * anything critical, chill a bit on each iteration. |
302 | */ | 302 | */ |
303 | while (wait_event_freezable(apm_suspend_waitqueue, | 303 | while (wait_event_freezable(apm_suspend_waitqueue, |
304 | as->suspend_state == SUSPEND_DONE)) | 304 | as->suspend_state != SUSPEND_ACKED)) |
305 | msleep(10); | 305 | msleep(10); |
306 | break; | 306 | break; |
307 | case SUSPEND_ACKTO: | 307 | case SUSPEND_ACKTO: |
diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c index b58b56187065..ddf86b6500b7 100644 --- a/drivers/char/virtio_console.c +++ b/drivers/char/virtio_console.c | |||
@@ -1038,12 +1038,6 @@ static struct attribute_group port_attribute_group = { | |||
1038 | .attrs = port_sysfs_entries, | 1038 | .attrs = port_sysfs_entries, |
1039 | }; | 1039 | }; |
1040 | 1040 | ||
1041 | static int debugfs_open(struct inode *inode, struct file *filp) | ||
1042 | { | ||
1043 | filp->private_data = inode->i_private; | ||
1044 | return 0; | ||
1045 | } | ||
1046 | |||
1047 | static ssize_t debugfs_read(struct file *filp, char __user *ubuf, | 1041 | static ssize_t debugfs_read(struct file *filp, char __user *ubuf, |
1048 | size_t count, loff_t *offp) | 1042 | size_t count, loff_t *offp) |
1049 | { | 1043 | { |
@@ -1087,7 +1081,7 @@ static ssize_t debugfs_read(struct file *filp, char __user *ubuf, | |||
1087 | 1081 | ||
1088 | static const struct file_operations port_debugfs_ops = { | 1082 | static const struct file_operations port_debugfs_ops = { |
1089 | .owner = THIS_MODULE, | 1083 | .owner = THIS_MODULE, |
1090 | .open = debugfs_open, | 1084 | .open = simple_open, |
1091 | .read = debugfs_read, | 1085 | .read = debugfs_read, |
1092 | }; | 1086 | }; |
1093 | 1087 | ||
diff --git a/drivers/cpufreq/Kconfig.arm b/drivers/cpufreq/Kconfig.arm index 32d790dd8180..ffbb44685915 100644 --- a/drivers/cpufreq/Kconfig.arm +++ b/drivers/cpufreq/Kconfig.arm | |||
@@ -51,9 +51,6 @@ config ARM_S5PV210_CPUFREQ | |||
51 | config ARM_EXYNOS_CPUFREQ | 51 | config ARM_EXYNOS_CPUFREQ |
52 | bool "SAMSUNG EXYNOS SoCs" | 52 | bool "SAMSUNG EXYNOS SoCs" |
53 | depends on ARCH_EXYNOS | 53 | depends on ARCH_EXYNOS |
54 | select ARM_EXYNOS4210_CPUFREQ if CPU_EXYNOS4210 | ||
55 | select ARM_EXYNOS4X12_CPUFREQ if (SOC_EXYNOS4212 || SOC_EXYNOS4412) | ||
56 | select ARM_EXYNOS5250_CPUFREQ if SOC_EXYNOS5250 | ||
57 | default y | 54 | default y |
58 | help | 55 | help |
59 | This adds the CPUFreq driver common part for Samsung | 56 | This adds the CPUFreq driver common part for Samsung |
@@ -62,20 +59,19 @@ config ARM_EXYNOS_CPUFREQ | |||
62 | If in doubt, say N. | 59 | If in doubt, say N. |
63 | 60 | ||
64 | config ARM_EXYNOS4210_CPUFREQ | 61 | config ARM_EXYNOS4210_CPUFREQ |
65 | bool "Samsung EXYNOS4210" | 62 | def_bool CPU_EXYNOS4210 |
66 | depends on ARCH_EXYNOS | ||
67 | help | 63 | help |
68 | This adds the CPUFreq driver for Samsung EXYNOS4210 | 64 | This adds the CPUFreq driver for Samsung EXYNOS4210 |
69 | SoC (S5PV310 or S5PC210). | 65 | SoC (S5PV310 or S5PC210). |
70 | 66 | ||
71 | config ARM_EXYNOS4X12_CPUFREQ | 67 | config ARM_EXYNOS4X12_CPUFREQ |
72 | bool "Samsung EXYNOS4X12" | 68 | def_bool (SOC_EXYNOS4212 || SOC_EXYNOS4412) |
73 | help | 69 | help |
74 | This adds the CPUFreq driver for Samsung EXYNOS4X12 | 70 | This adds the CPUFreq driver for Samsung EXYNOS4X12 |
75 | SoC (EXYNOS4212 or EXYNOS4412). | 71 | SoC (EXYNOS4212 or EXYNOS4412). |
76 | 72 | ||
77 | config ARM_EXYNOS5250_CPUFREQ | 73 | config ARM_EXYNOS5250_CPUFREQ |
78 | bool "Samsung EXYNOS5250" | 74 | def_bool SOC_EXYNOS5250 |
79 | help | 75 | help |
80 | This adds the CPUFreq driver for Samsung EXYNOS5250 | 76 | This adds the CPUFreq driver for Samsung EXYNOS5250 |
81 | SoC. | 77 | SoC. |
diff --git a/drivers/cpufreq/db8500-cpufreq.c b/drivers/cpufreq/db8500-cpufreq.c index a22ffa5bff9f..0bf1b8910eeb 100644 --- a/drivers/cpufreq/db8500-cpufreq.c +++ b/drivers/cpufreq/db8500-cpufreq.c | |||
@@ -142,7 +142,7 @@ static int __cpuinit db8500_cpufreq_init(struct cpufreq_policy *policy) | |||
142 | policy->cpuinfo.transition_latency = 20 * 1000; /* in ns */ | 142 | policy->cpuinfo.transition_latency = 20 * 1000; /* in ns */ |
143 | 143 | ||
144 | /* policy sharing between dual CPUs */ | 144 | /* policy sharing between dual CPUs */ |
145 | cpumask_copy(policy->cpus, &cpu_present_map); | 145 | cpumask_copy(policy->cpus, cpu_present_mask); |
146 | 146 | ||
147 | policy->shared_type = CPUFREQ_SHARED_TYPE_ALL; | 147 | policy->shared_type = CPUFREQ_SHARED_TYPE_ALL; |
148 | 148 | ||
diff --git a/drivers/dma/coh901318.c b/drivers/dma/coh901318.c index dc89455f5550..750925f9638b 100644 --- a/drivers/dma/coh901318.c +++ b/drivers/dma/coh901318.c | |||
@@ -104,13 +104,6 @@ static void coh901318_list_print(struct coh901318_chan *cohc, | |||
104 | static struct coh901318_base *debugfs_dma_base; | 104 | static struct coh901318_base *debugfs_dma_base; |
105 | static struct dentry *dma_dentry; | 105 | static struct dentry *dma_dentry; |
106 | 106 | ||
107 | static int coh901318_debugfs_open(struct inode *inode, struct file *file) | ||
108 | { | ||
109 | |||
110 | file->private_data = inode->i_private; | ||
111 | return 0; | ||
112 | } | ||
113 | |||
114 | static int coh901318_debugfs_read(struct file *file, char __user *buf, | 107 | static int coh901318_debugfs_read(struct file *file, char __user *buf, |
115 | size_t count, loff_t *f_pos) | 108 | size_t count, loff_t *f_pos) |
116 | { | 109 | { |
@@ -158,7 +151,7 @@ static int coh901318_debugfs_read(struct file *file, char __user *buf, | |||
158 | 151 | ||
159 | static const struct file_operations coh901318_debugfs_status_operations = { | 152 | static const struct file_operations coh901318_debugfs_status_operations = { |
160 | .owner = THIS_MODULE, | 153 | .owner = THIS_MODULE, |
161 | .open = coh901318_debugfs_open, | 154 | .open = simple_open, |
162 | .read = coh901318_debugfs_read, | 155 | .read = coh901318_debugfs_read, |
163 | .llseek = default_llseek, | 156 | .llseek = default_llseek, |
164 | }; | 157 | }; |
diff --git a/drivers/dma/sa11x0-dma.c b/drivers/dma/sa11x0-dma.c index 16a6b48883cf..ec78ccef9132 100644 --- a/drivers/dma/sa11x0-dma.c +++ b/drivers/dma/sa11x0-dma.c | |||
@@ -585,7 +585,7 @@ static dma_cookie_t sa11x0_dma_tx_submit(struct dma_async_tx_descriptor *tx) | |||
585 | 585 | ||
586 | static struct dma_async_tx_descriptor *sa11x0_dma_prep_slave_sg( | 586 | static struct dma_async_tx_descriptor *sa11x0_dma_prep_slave_sg( |
587 | struct dma_chan *chan, struct scatterlist *sg, unsigned int sglen, | 587 | struct dma_chan *chan, struct scatterlist *sg, unsigned int sglen, |
588 | enum dma_transfer_direction dir, unsigned long flags) | 588 | enum dma_transfer_direction dir, unsigned long flags, void *context) |
589 | { | 589 | { |
590 | struct sa11x0_dma_chan *c = to_sa11x0_dma_chan(chan); | 590 | struct sa11x0_dma_chan *c = to_sa11x0_dma_chan(chan); |
591 | struct sa11x0_dma_desc *txd; | 591 | struct sa11x0_dma_desc *txd; |
diff --git a/drivers/edac/mce_amd.c b/drivers/edac/mce_amd.c index 36e1486eb9aa..d0c372e30de4 100644 --- a/drivers/edac/mce_amd.c +++ b/drivers/edac/mce_amd.c | |||
@@ -754,9 +754,7 @@ static int __init mce_amd_init(void) | |||
754 | if (c->x86_vendor != X86_VENDOR_AMD) | 754 | if (c->x86_vendor != X86_VENDOR_AMD) |
755 | return 0; | 755 | return 0; |
756 | 756 | ||
757 | if ((c->x86 < 0xf || c->x86 > 0x12) && | 757 | if (c->x86 < 0xf || c->x86 > 0x15) |
758 | (c->x86 != 0x14 || c->x86_model > 0xf) && | ||
759 | (c->x86 != 0x15 || c->x86_model > 0xf)) | ||
760 | return 0; | 758 | return 0; |
761 | 759 | ||
762 | fam_ops = kzalloc(sizeof(struct amd_decoder_ops), GFP_KERNEL); | 760 | fam_ops = kzalloc(sizeof(struct amd_decoder_ops), GFP_KERNEL); |
@@ -797,7 +795,7 @@ static int __init mce_amd_init(void) | |||
797 | break; | 795 | break; |
798 | 796 | ||
799 | default: | 797 | default: |
800 | printk(KERN_WARNING "Huh? What family is that: %d?!\n", c->x86); | 798 | printk(KERN_WARNING "Huh? What family is it: 0x%x?!\n", c->x86); |
801 | kfree(fam_ops); | 799 | kfree(fam_ops); |
802 | return -EINVAL; | 800 | return -EINVAL; |
803 | } | 801 | } |
diff --git a/drivers/gpio/gpio-tegra.c b/drivers/gpio/gpio-tegra.c index 32de6707e3c4..12f349b3830d 100644 --- a/drivers/gpio/gpio-tegra.c +++ b/drivers/gpio/gpio-tegra.c | |||
@@ -22,7 +22,7 @@ | |||
22 | #include <linux/interrupt.h> | 22 | #include <linux/interrupt.h> |
23 | #include <linux/io.h> | 23 | #include <linux/io.h> |
24 | #include <linux/gpio.h> | 24 | #include <linux/gpio.h> |
25 | #include <linux/of.h> | 25 | #include <linux/of_device.h> |
26 | #include <linux/platform_device.h> | 26 | #include <linux/platform_device.h> |
27 | #include <linux/module.h> | 27 | #include <linux/module.h> |
28 | #include <linux/irqdomain.h> | 28 | #include <linux/irqdomain.h> |
@@ -37,7 +37,8 @@ | |||
37 | #define GPIO_PORT(x) (((x) >> 3) & 0x3) | 37 | #define GPIO_PORT(x) (((x) >> 3) & 0x3) |
38 | #define GPIO_BIT(x) ((x) & 0x7) | 38 | #define GPIO_BIT(x) ((x) & 0x7) |
39 | 39 | ||
40 | #define GPIO_REG(x) (GPIO_BANK(x) * 0x80 + GPIO_PORT(x) * 4) | 40 | #define GPIO_REG(x) (GPIO_BANK(x) * tegra_gpio_bank_stride + \ |
41 | GPIO_PORT(x) * 4) | ||
41 | 42 | ||
42 | #define GPIO_CNF(x) (GPIO_REG(x) + 0x00) | 43 | #define GPIO_CNF(x) (GPIO_REG(x) + 0x00) |
43 | #define GPIO_OE(x) (GPIO_REG(x) + 0x10) | 44 | #define GPIO_OE(x) (GPIO_REG(x) + 0x10) |
@@ -48,12 +49,12 @@ | |||
48 | #define GPIO_INT_LVL(x) (GPIO_REG(x) + 0x60) | 49 | #define GPIO_INT_LVL(x) (GPIO_REG(x) + 0x60) |
49 | #define GPIO_INT_CLR(x) (GPIO_REG(x) + 0x70) | 50 | #define GPIO_INT_CLR(x) (GPIO_REG(x) + 0x70) |
50 | 51 | ||
51 | #define GPIO_MSK_CNF(x) (GPIO_REG(x) + 0x800) | 52 | #define GPIO_MSK_CNF(x) (GPIO_REG(x) + tegra_gpio_upper_offset + 0x00) |
52 | #define GPIO_MSK_OE(x) (GPIO_REG(x) + 0x810) | 53 | #define GPIO_MSK_OE(x) (GPIO_REG(x) + tegra_gpio_upper_offset + 0x10) |
53 | #define GPIO_MSK_OUT(x) (GPIO_REG(x) + 0X820) | 54 | #define GPIO_MSK_OUT(x) (GPIO_REG(x) + tegra_gpio_upper_offset + 0X20) |
54 | #define GPIO_MSK_INT_STA(x) (GPIO_REG(x) + 0x840) | 55 | #define GPIO_MSK_INT_STA(x) (GPIO_REG(x) + tegra_gpio_upper_offset + 0x40) |
55 | #define GPIO_MSK_INT_ENB(x) (GPIO_REG(x) + 0x850) | 56 | #define GPIO_MSK_INT_ENB(x) (GPIO_REG(x) + tegra_gpio_upper_offset + 0x50) |
56 | #define GPIO_MSK_INT_LVL(x) (GPIO_REG(x) + 0x860) | 57 | #define GPIO_MSK_INT_LVL(x) (GPIO_REG(x) + tegra_gpio_upper_offset + 0x60) |
57 | 58 | ||
58 | #define GPIO_INT_LVL_MASK 0x010101 | 59 | #define GPIO_INT_LVL_MASK 0x010101 |
59 | #define GPIO_INT_LVL_EDGE_RISING 0x000101 | 60 | #define GPIO_INT_LVL_EDGE_RISING 0x000101 |
@@ -78,6 +79,8 @@ struct tegra_gpio_bank { | |||
78 | static struct irq_domain *irq_domain; | 79 | static struct irq_domain *irq_domain; |
79 | static void __iomem *regs; | 80 | static void __iomem *regs; |
80 | static u32 tegra_gpio_bank_count; | 81 | static u32 tegra_gpio_bank_count; |
82 | static u32 tegra_gpio_bank_stride; | ||
83 | static u32 tegra_gpio_upper_offset; | ||
81 | static struct tegra_gpio_bank *tegra_gpio_banks; | 84 | static struct tegra_gpio_bank *tegra_gpio_banks; |
82 | 85 | ||
83 | static inline void tegra_gpio_writel(u32 val, u32 reg) | 86 | static inline void tegra_gpio_writel(u32 val, u32 reg) |
@@ -333,6 +336,26 @@ static struct irq_chip tegra_gpio_irq_chip = { | |||
333 | #endif | 336 | #endif |
334 | }; | 337 | }; |
335 | 338 | ||
339 | struct tegra_gpio_soc_config { | ||
340 | u32 bank_stride; | ||
341 | u32 upper_offset; | ||
342 | }; | ||
343 | |||
344 | static struct tegra_gpio_soc_config tegra20_gpio_config = { | ||
345 | .bank_stride = 0x80, | ||
346 | .upper_offset = 0x800, | ||
347 | }; | ||
348 | |||
349 | static struct tegra_gpio_soc_config tegra30_gpio_config = { | ||
350 | .bank_stride = 0x100, | ||
351 | .upper_offset = 0x80, | ||
352 | }; | ||
353 | |||
354 | static struct of_device_id tegra_gpio_of_match[] __devinitdata = { | ||
355 | { .compatible = "nvidia,tegra30-gpio", .data = &tegra30_gpio_config }, | ||
356 | { .compatible = "nvidia,tegra20-gpio", .data = &tegra20_gpio_config }, | ||
357 | { }, | ||
358 | }; | ||
336 | 359 | ||
337 | /* This lock class tells lockdep that GPIO irqs are in a different | 360 | /* This lock class tells lockdep that GPIO irqs are in a different |
338 | * category than their parents, so it won't report false recursion. | 361 | * category than their parents, so it won't report false recursion. |
@@ -341,6 +364,8 @@ static struct lock_class_key gpio_lock_class; | |||
341 | 364 | ||
342 | static int __devinit tegra_gpio_probe(struct platform_device *pdev) | 365 | static int __devinit tegra_gpio_probe(struct platform_device *pdev) |
343 | { | 366 | { |
367 | const struct of_device_id *match; | ||
368 | struct tegra_gpio_soc_config *config; | ||
344 | int irq_base; | 369 | int irq_base; |
345 | struct resource *res; | 370 | struct resource *res; |
346 | struct tegra_gpio_bank *bank; | 371 | struct tegra_gpio_bank *bank; |
@@ -348,6 +373,15 @@ static int __devinit tegra_gpio_probe(struct platform_device *pdev) | |||
348 | int i; | 373 | int i; |
349 | int j; | 374 | int j; |
350 | 375 | ||
376 | match = of_match_device(tegra_gpio_of_match, &pdev->dev); | ||
377 | if (match) | ||
378 | config = (struct tegra_gpio_soc_config *)match->data; | ||
379 | else | ||
380 | config = &tegra20_gpio_config; | ||
381 | |||
382 | tegra_gpio_bank_stride = config->bank_stride; | ||
383 | tegra_gpio_upper_offset = config->upper_offset; | ||
384 | |||
351 | for (;;) { | 385 | for (;;) { |
352 | res = platform_get_resource(pdev, IORESOURCE_IRQ, tegra_gpio_bank_count); | 386 | res = platform_get_resource(pdev, IORESOURCE_IRQ, tegra_gpio_bank_count); |
353 | if (!res) | 387 | if (!res) |
@@ -402,7 +436,7 @@ static int __devinit tegra_gpio_probe(struct platform_device *pdev) | |||
402 | return -ENODEV; | 436 | return -ENODEV; |
403 | } | 437 | } |
404 | 438 | ||
405 | for (i = 0; i < 7; i++) { | 439 | for (i = 0; i < tegra_gpio_bank_count; i++) { |
406 | for (j = 0; j < 4; j++) { | 440 | for (j = 0; j < 4; j++) { |
407 | int gpio = tegra_gpio_compose(i, j, 0); | 441 | int gpio = tegra_gpio_compose(i, j, 0); |
408 | tegra_gpio_writel(0x00, GPIO_INT_ENB(gpio)); | 442 | tegra_gpio_writel(0x00, GPIO_INT_ENB(gpio)); |
@@ -441,11 +475,6 @@ static int __devinit tegra_gpio_probe(struct platform_device *pdev) | |||
441 | return 0; | 475 | return 0; |
442 | } | 476 | } |
443 | 477 | ||
444 | static struct of_device_id tegra_gpio_of_match[] __devinitdata = { | ||
445 | { .compatible = "nvidia,tegra20-gpio", }, | ||
446 | { }, | ||
447 | }; | ||
448 | |||
449 | static struct platform_driver tegra_gpio_driver = { | 478 | static struct platform_driver tegra_gpio_driver = { |
450 | .driver = { | 479 | .driver = { |
451 | .name = "tegra-gpio", | 480 | .name = "tegra-gpio", |
@@ -485,7 +514,7 @@ static int dbg_gpio_show(struct seq_file *s, void *unused) | |||
485 | int i; | 514 | int i; |
486 | int j; | 515 | int j; |
487 | 516 | ||
488 | for (i = 0; i < 7; i++) { | 517 | for (i = 0; i < tegra_gpio_bank_count; i++) { |
489 | for (j = 0; j < 4; j++) { | 518 | for (j = 0; j < 4; j++) { |
490 | int gpio = tegra_gpio_compose(i, j, 0); | 519 | int gpio = tegra_gpio_compose(i, j, 0); |
491 | seq_printf(s, | 520 | seq_printf(s, |
diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig index cc1148837e24..e354bc0b052a 100644 --- a/drivers/gpu/drm/Kconfig +++ b/drivers/gpu/drm/Kconfig | |||
@@ -9,6 +9,7 @@ menuconfig DRM | |||
9 | depends on (AGP || AGP=n) && !EMULATED_CMPXCHG && MMU | 9 | depends on (AGP || AGP=n) && !EMULATED_CMPXCHG && MMU |
10 | select I2C | 10 | select I2C |
11 | select I2C_ALGOBIT | 11 | select I2C_ALGOBIT |
12 | select DMA_SHARED_BUFFER | ||
12 | help | 13 | help |
13 | Kernel-level support for the Direct Rendering Infrastructure (DRI) | 14 | Kernel-level support for the Direct Rendering Infrastructure (DRI) |
14 | introduced in XFree86 4.0. If you say Y here, you need to select | 15 | introduced in XFree86 4.0. If you say Y here, you need to select |
diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile index a858532806ae..c20da5bda355 100644 --- a/drivers/gpu/drm/Makefile +++ b/drivers/gpu/drm/Makefile | |||
@@ -12,7 +12,7 @@ drm-y := drm_auth.o drm_buffer.o drm_bufs.o drm_cache.o \ | |||
12 | drm_platform.o drm_sysfs.o drm_hashtab.o drm_mm.o \ | 12 | drm_platform.o drm_sysfs.o drm_hashtab.o drm_mm.o \ |
13 | drm_crtc.o drm_modes.o drm_edid.o \ | 13 | drm_crtc.o drm_modes.o drm_edid.o \ |
14 | drm_info.o drm_debugfs.o drm_encoder_slave.o \ | 14 | drm_info.o drm_debugfs.o drm_encoder_slave.o \ |
15 | drm_trace_points.o drm_global.o | 15 | drm_trace_points.o drm_global.o drm_prime.o |
16 | 16 | ||
17 | drm-$(CONFIG_COMPAT) += drm_ioc32.o | 17 | drm-$(CONFIG_COMPAT) += drm_ioc32.o |
18 | 18 | ||
diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c index 0b65fbc8a630..6116e3b75393 100644 --- a/drivers/gpu/drm/drm_drv.c +++ b/drivers/gpu/drm/drm_drv.c | |||
@@ -136,6 +136,10 @@ static struct drm_ioctl_desc drm_ioctls[] = { | |||
136 | DRM_IOCTL_DEF(DRM_IOCTL_GEM_OPEN, drm_gem_open_ioctl, DRM_AUTH|DRM_UNLOCKED), | 136 | DRM_IOCTL_DEF(DRM_IOCTL_GEM_OPEN, drm_gem_open_ioctl, DRM_AUTH|DRM_UNLOCKED), |
137 | 137 | ||
138 | DRM_IOCTL_DEF(DRM_IOCTL_MODE_GETRESOURCES, drm_mode_getresources, DRM_CONTROL_ALLOW|DRM_UNLOCKED), | 138 | DRM_IOCTL_DEF(DRM_IOCTL_MODE_GETRESOURCES, drm_mode_getresources, DRM_CONTROL_ALLOW|DRM_UNLOCKED), |
139 | |||
140 | DRM_IOCTL_DEF(DRM_IOCTL_PRIME_HANDLE_TO_FD, drm_prime_handle_to_fd_ioctl, DRM_AUTH|DRM_UNLOCKED), | ||
141 | DRM_IOCTL_DEF(DRM_IOCTL_PRIME_FD_TO_HANDLE, drm_prime_fd_to_handle_ioctl, DRM_AUTH|DRM_UNLOCKED), | ||
142 | |||
139 | DRM_IOCTL_DEF(DRM_IOCTL_MODE_GETPLANERESOURCES, drm_mode_getplane_res, DRM_MASTER|DRM_CONTROL_ALLOW|DRM_UNLOCKED), | 143 | DRM_IOCTL_DEF(DRM_IOCTL_MODE_GETPLANERESOURCES, drm_mode_getplane_res, DRM_MASTER|DRM_CONTROL_ALLOW|DRM_UNLOCKED), |
140 | DRM_IOCTL_DEF(DRM_IOCTL_MODE_GETCRTC, drm_mode_getcrtc, DRM_CONTROL_ALLOW|DRM_UNLOCKED), | 144 | DRM_IOCTL_DEF(DRM_IOCTL_MODE_GETCRTC, drm_mode_getcrtc, DRM_CONTROL_ALLOW|DRM_UNLOCKED), |
141 | DRM_IOCTL_DEF(DRM_IOCTL_MODE_SETCRTC, drm_mode_setcrtc, DRM_MASTER|DRM_CONTROL_ALLOW|DRM_UNLOCKED), | 145 | DRM_IOCTL_DEF(DRM_IOCTL_MODE_SETCRTC, drm_mode_setcrtc, DRM_MASTER|DRM_CONTROL_ALLOW|DRM_UNLOCKED), |
diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c index 7740dd26f007..a0d6e894d97c 100644 --- a/drivers/gpu/drm/drm_fb_helper.c +++ b/drivers/gpu/drm/drm_fb_helper.c | |||
@@ -559,9 +559,13 @@ int drm_fb_helper_check_var(struct fb_var_screeninfo *var, | |||
559 | return -EINVAL; | 559 | return -EINVAL; |
560 | 560 | ||
561 | /* Need to resize the fb object !!! */ | 561 | /* Need to resize the fb object !!! */ |
562 | if (var->bits_per_pixel > fb->bits_per_pixel || var->xres > fb->width || var->yres > fb->height) { | 562 | if (var->bits_per_pixel > fb->bits_per_pixel || |
563 | var->xres > fb->width || var->yres > fb->height || | ||
564 | var->xres_virtual > fb->width || var->yres_virtual > fb->height) { | ||
563 | DRM_DEBUG("fb userspace requested width/height/bpp is greater than current fb " | 565 | DRM_DEBUG("fb userspace requested width/height/bpp is greater than current fb " |
564 | "object %dx%d-%d > %dx%d-%d\n", var->xres, var->yres, var->bits_per_pixel, | 566 | "request %dx%d-%d (virtual %dx%d) > %dx%d-%d\n", |
567 | var->xres, var->yres, var->bits_per_pixel, | ||
568 | var->xres_virtual, var->yres_virtual, | ||
565 | fb->width, fb->height, fb->bits_per_pixel); | 569 | fb->width, fb->height, fb->bits_per_pixel); |
566 | return -EINVAL; | 570 | return -EINVAL; |
567 | } | 571 | } |
diff --git a/drivers/gpu/drm/drm_fops.c b/drivers/gpu/drm/drm_fops.c index 7348a3dab250..cdfbf27b2b3c 100644 --- a/drivers/gpu/drm/drm_fops.c +++ b/drivers/gpu/drm/drm_fops.c | |||
@@ -271,6 +271,9 @@ static int drm_open_helper(struct inode *inode, struct file *filp, | |||
271 | if (dev->driver->driver_features & DRIVER_GEM) | 271 | if (dev->driver->driver_features & DRIVER_GEM) |
272 | drm_gem_open(dev, priv); | 272 | drm_gem_open(dev, priv); |
273 | 273 | ||
274 | if (drm_core_check_feature(dev, DRIVER_PRIME)) | ||
275 | drm_prime_init_file_private(&priv->prime); | ||
276 | |||
274 | if (dev->driver->open) { | 277 | if (dev->driver->open) { |
275 | ret = dev->driver->open(dev, priv); | 278 | ret = dev->driver->open(dev, priv); |
276 | if (ret < 0) | 279 | if (ret < 0) |
@@ -571,6 +574,10 @@ int drm_release(struct inode *inode, struct file *filp) | |||
571 | 574 | ||
572 | if (dev->driver->postclose) | 575 | if (dev->driver->postclose) |
573 | dev->driver->postclose(dev, file_priv); | 576 | dev->driver->postclose(dev, file_priv); |
577 | |||
578 | if (drm_core_check_feature(dev, DRIVER_PRIME)) | ||
579 | drm_prime_destroy_file_private(&file_priv->prime); | ||
580 | |||
574 | kfree(file_priv); | 581 | kfree(file_priv); |
575 | 582 | ||
576 | /* ======================================================== | 583 | /* ======================================================== |
diff --git a/drivers/gpu/drm/drm_gem.c b/drivers/gpu/drm/drm_gem.c index 0ef358e53245..83114b5e3cee 100644 --- a/drivers/gpu/drm/drm_gem.c +++ b/drivers/gpu/drm/drm_gem.c | |||
@@ -35,6 +35,7 @@ | |||
35 | #include <linux/mman.h> | 35 | #include <linux/mman.h> |
36 | #include <linux/pagemap.h> | 36 | #include <linux/pagemap.h> |
37 | #include <linux/shmem_fs.h> | 37 | #include <linux/shmem_fs.h> |
38 | #include <linux/dma-buf.h> | ||
38 | #include "drmP.h" | 39 | #include "drmP.h" |
39 | 40 | ||
40 | /** @file drm_gem.c | 41 | /** @file drm_gem.c |
@@ -232,6 +233,10 @@ drm_gem_handle_delete(struct drm_file *filp, u32 handle) | |||
232 | idr_remove(&filp->object_idr, handle); | 233 | idr_remove(&filp->object_idr, handle); |
233 | spin_unlock(&filp->table_lock); | 234 | spin_unlock(&filp->table_lock); |
234 | 235 | ||
236 | if (obj->import_attach) | ||
237 | drm_prime_remove_imported_buf_handle(&filp->prime, | ||
238 | obj->import_attach->dmabuf); | ||
239 | |||
235 | if (dev->driver->gem_close_object) | 240 | if (dev->driver->gem_close_object) |
236 | dev->driver->gem_close_object(obj, filp); | 241 | dev->driver->gem_close_object(obj, filp); |
237 | drm_gem_object_handle_unreference_unlocked(obj); | 242 | drm_gem_object_handle_unreference_unlocked(obj); |
@@ -527,6 +532,10 @@ drm_gem_object_release_handle(int id, void *ptr, void *data) | |||
527 | struct drm_gem_object *obj = ptr; | 532 | struct drm_gem_object *obj = ptr; |
528 | struct drm_device *dev = obj->dev; | 533 | struct drm_device *dev = obj->dev; |
529 | 534 | ||
535 | if (obj->import_attach) | ||
536 | drm_prime_remove_imported_buf_handle(&file_priv->prime, | ||
537 | obj->import_attach->dmabuf); | ||
538 | |||
530 | if (dev->driver->gem_close_object) | 539 | if (dev->driver->gem_close_object) |
531 | dev->driver->gem_close_object(obj, file_priv); | 540 | dev->driver->gem_close_object(obj, file_priv); |
532 | 541 | ||
diff --git a/drivers/gpu/drm/drm_prime.c b/drivers/gpu/drm/drm_prime.c new file mode 100644 index 000000000000..1bdf2b54eaf6 --- /dev/null +++ b/drivers/gpu/drm/drm_prime.c | |||
@@ -0,0 +1,304 @@ | |||
1 | /* | ||
2 | * Copyright © 2012 Red Hat | ||
3 | * | ||
4 | * Permission is hereby granted, free of charge, to any person obtaining a | ||
5 | * copy of this software and associated documentation files (the "Software"), | ||
6 | * to deal in the Software without restriction, including without limitation | ||
7 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
8 | * and/or sell copies of the Software, and to permit persons to whom the | ||
9 | * Software is furnished to do so, subject to the following conditions: | ||
10 | * | ||
11 | * The above copyright notice and this permission notice (including the next | ||
12 | * paragraph) shall be included in all copies or substantial portions of the | ||
13 | * Software. | ||
14 | * | ||
15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
18 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
20 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS | ||
21 | * IN THE SOFTWARE. | ||
22 | * | ||
23 | * Authors: | ||
24 | * Dave Airlie <airlied@redhat.com> | ||
25 | * Rob Clark <rob.clark@linaro.org> | ||
26 | * | ||
27 | */ | ||
28 | |||
29 | #include <linux/export.h> | ||
30 | #include <linux/dma-buf.h> | ||
31 | #include "drmP.h" | ||
32 | |||
33 | /* | ||
34 | * DMA-BUF/GEM Object references and lifetime overview: | ||
35 | * | ||
36 | * On the export the dma_buf holds a reference to the exporting GEM | ||
37 | * object. It takes this reference in handle_to_fd_ioctl, when it | ||
38 | * first calls .prime_export and stores the exporting GEM object in | ||
39 | * the dma_buf priv. This reference is released when the dma_buf | ||
40 | * object goes away in the driver .release function. | ||
41 | * | ||
42 | * On the import the importing GEM object holds a reference to the | ||
43 | * dma_buf (which in turn holds a ref to the exporting GEM object). | ||
44 | * It takes that reference in the fd_to_handle ioctl. | ||
45 | * It calls dma_buf_get, creates an attachment to it and stores the | ||
46 | * attachment in the GEM object. When this attachment is destroyed | ||
47 | * when the imported object is destroyed, we remove the attachment | ||
48 | * and drop the reference to the dma_buf. | ||
49 | * | ||
50 | * Thus the chain of references always flows in one direction | ||
51 | * (avoiding loops): importing_gem -> dmabuf -> exporting_gem | ||
52 | * | ||
53 | * Self-importing: if userspace is using PRIME as a replacement for flink | ||
54 | * then it will get a fd->handle request for a GEM object that it created. | ||
55 | * Drivers should detect this situation and return back the gem object | ||
56 | * from the dma-buf private. | ||
57 | */ | ||
58 | |||
59 | struct drm_prime_member { | ||
60 | struct list_head entry; | ||
61 | struct dma_buf *dma_buf; | ||
62 | uint32_t handle; | ||
63 | }; | ||
64 | |||
65 | int drm_gem_prime_handle_to_fd(struct drm_device *dev, | ||
66 | struct drm_file *file_priv, uint32_t handle, uint32_t flags, | ||
67 | int *prime_fd) | ||
68 | { | ||
69 | struct drm_gem_object *obj; | ||
70 | void *buf; | ||
71 | |||
72 | obj = drm_gem_object_lookup(dev, file_priv, handle); | ||
73 | if (!obj) | ||
74 | return -ENOENT; | ||
75 | |||
76 | mutex_lock(&file_priv->prime.lock); | ||
77 | /* re-export the original imported object */ | ||
78 | if (obj->import_attach) { | ||
79 | get_dma_buf(obj->import_attach->dmabuf); | ||
80 | *prime_fd = dma_buf_fd(obj->import_attach->dmabuf, flags); | ||
81 | drm_gem_object_unreference_unlocked(obj); | ||
82 | mutex_unlock(&file_priv->prime.lock); | ||
83 | return 0; | ||
84 | } | ||
85 | |||
86 | if (obj->export_dma_buf) { | ||
87 | get_dma_buf(obj->export_dma_buf); | ||
88 | *prime_fd = dma_buf_fd(obj->export_dma_buf, flags); | ||
89 | drm_gem_object_unreference_unlocked(obj); | ||
90 | } else { | ||
91 | buf = dev->driver->gem_prime_export(dev, obj, flags); | ||
92 | if (IS_ERR(buf)) { | ||
93 | /* normally the created dma-buf takes ownership of the ref, | ||
94 | * but if that fails then drop the ref | ||
95 | */ | ||
96 | drm_gem_object_unreference_unlocked(obj); | ||
97 | mutex_unlock(&file_priv->prime.lock); | ||
98 | return PTR_ERR(buf); | ||
99 | } | ||
100 | obj->export_dma_buf = buf; | ||
101 | *prime_fd = dma_buf_fd(buf, flags); | ||
102 | } | ||
103 | mutex_unlock(&file_priv->prime.lock); | ||
104 | return 0; | ||
105 | } | ||
106 | EXPORT_SYMBOL(drm_gem_prime_handle_to_fd); | ||
107 | |||
108 | int drm_gem_prime_fd_to_handle(struct drm_device *dev, | ||
109 | struct drm_file *file_priv, int prime_fd, uint32_t *handle) | ||
110 | { | ||
111 | struct dma_buf *dma_buf; | ||
112 | struct drm_gem_object *obj; | ||
113 | int ret; | ||
114 | |||
115 | dma_buf = dma_buf_get(prime_fd); | ||
116 | if (IS_ERR(dma_buf)) | ||
117 | return PTR_ERR(dma_buf); | ||
118 | |||
119 | mutex_lock(&file_priv->prime.lock); | ||
120 | |||
121 | ret = drm_prime_lookup_imported_buf_handle(&file_priv->prime, | ||
122 | dma_buf, handle); | ||
123 | if (!ret) { | ||
124 | ret = 0; | ||
125 | goto out_put; | ||
126 | } | ||
127 | |||
128 | /* never seen this one, need to import */ | ||
129 | obj = dev->driver->gem_prime_import(dev, dma_buf); | ||
130 | if (IS_ERR(obj)) { | ||
131 | ret = PTR_ERR(obj); | ||
132 | goto out_put; | ||
133 | } | ||
134 | |||
135 | ret = drm_gem_handle_create(file_priv, obj, handle); | ||
136 | drm_gem_object_unreference_unlocked(obj); | ||
137 | if (ret) | ||
138 | goto out_put; | ||
139 | |||
140 | ret = drm_prime_add_imported_buf_handle(&file_priv->prime, | ||
141 | dma_buf, *handle); | ||
142 | if (ret) | ||
143 | goto fail; | ||
144 | |||
145 | mutex_unlock(&file_priv->prime.lock); | ||
146 | return 0; | ||
147 | |||
148 | fail: | ||
149 | /* hmm, if driver attached, we are relying on the free-object path | ||
150 | * to detach.. which seems ok.. | ||
151 | */ | ||
152 | drm_gem_object_handle_unreference_unlocked(obj); | ||
153 | out_put: | ||
154 | dma_buf_put(dma_buf); | ||
155 | mutex_unlock(&file_priv->prime.lock); | ||
156 | return ret; | ||
157 | } | ||
158 | EXPORT_SYMBOL(drm_gem_prime_fd_to_handle); | ||
159 | |||
160 | int drm_prime_handle_to_fd_ioctl(struct drm_device *dev, void *data, | ||
161 | struct drm_file *file_priv) | ||
162 | { | ||
163 | struct drm_prime_handle *args = data; | ||
164 | uint32_t flags; | ||
165 | |||
166 | if (!drm_core_check_feature(dev, DRIVER_PRIME)) | ||
167 | return -EINVAL; | ||
168 | |||
169 | if (!dev->driver->prime_handle_to_fd) | ||
170 | return -ENOSYS; | ||
171 | |||
172 | /* check flags are valid */ | ||
173 | if (args->flags & ~DRM_CLOEXEC) | ||
174 | return -EINVAL; | ||
175 | |||
176 | /* we only want to pass DRM_CLOEXEC which is == O_CLOEXEC */ | ||
177 | flags = args->flags & DRM_CLOEXEC; | ||
178 | |||
179 | return dev->driver->prime_handle_to_fd(dev, file_priv, | ||
180 | args->handle, flags, &args->fd); | ||
181 | } | ||
182 | |||
183 | int drm_prime_fd_to_handle_ioctl(struct drm_device *dev, void *data, | ||
184 | struct drm_file *file_priv) | ||
185 | { | ||
186 | struct drm_prime_handle *args = data; | ||
187 | |||
188 | if (!drm_core_check_feature(dev, DRIVER_PRIME)) | ||
189 | return -EINVAL; | ||
190 | |||
191 | if (!dev->driver->prime_fd_to_handle) | ||
192 | return -ENOSYS; | ||
193 | |||
194 | return dev->driver->prime_fd_to_handle(dev, file_priv, | ||
195 | args->fd, &args->handle); | ||
196 | } | ||
197 | |||
198 | /* | ||
199 | * drm_prime_pages_to_sg | ||
200 | * | ||
201 | * this helper creates an sg table object from a set of pages | ||
202 | * the driver is responsible for mapping the pages into the | ||
203 | * importers address space | ||
204 | */ | ||
205 | struct sg_table *drm_prime_pages_to_sg(struct page **pages, int nr_pages) | ||
206 | { | ||
207 | struct sg_table *sg = NULL; | ||
208 | struct scatterlist *iter; | ||
209 | int i; | ||
210 | int ret; | ||
211 | |||
212 | sg = kmalloc(sizeof(struct sg_table), GFP_KERNEL); | ||
213 | if (!sg) | ||
214 | goto out; | ||
215 | |||
216 | ret = sg_alloc_table(sg, nr_pages, GFP_KERNEL); | ||
217 | if (ret) | ||
218 | goto out; | ||
219 | |||
220 | for_each_sg(sg->sgl, iter, nr_pages, i) | ||
221 | sg_set_page(iter, pages[i], PAGE_SIZE, 0); | ||
222 | |||
223 | return sg; | ||
224 | out: | ||
225 | kfree(sg); | ||
226 | return NULL; | ||
227 | } | ||
228 | EXPORT_SYMBOL(drm_prime_pages_to_sg); | ||
229 | |||
230 | /* helper function to cleanup a GEM/prime object */ | ||
231 | void drm_prime_gem_destroy(struct drm_gem_object *obj, struct sg_table *sg) | ||
232 | { | ||
233 | struct dma_buf_attachment *attach; | ||
234 | struct dma_buf *dma_buf; | ||
235 | attach = obj->import_attach; | ||
236 | if (sg) | ||
237 | dma_buf_unmap_attachment(attach, sg, DMA_BIDIRECTIONAL); | ||
238 | dma_buf = attach->dmabuf; | ||
239 | dma_buf_detach(attach->dmabuf, attach); | ||
240 | /* remove the reference */ | ||
241 | dma_buf_put(dma_buf); | ||
242 | } | ||
243 | EXPORT_SYMBOL(drm_prime_gem_destroy); | ||
244 | |||
245 | void drm_prime_init_file_private(struct drm_prime_file_private *prime_fpriv) | ||
246 | { | ||
247 | INIT_LIST_HEAD(&prime_fpriv->head); | ||
248 | mutex_init(&prime_fpriv->lock); | ||
249 | } | ||
250 | EXPORT_SYMBOL(drm_prime_init_file_private); | ||
251 | |||
252 | void drm_prime_destroy_file_private(struct drm_prime_file_private *prime_fpriv) | ||
253 | { | ||
254 | struct drm_prime_member *member, *safe; | ||
255 | list_for_each_entry_safe(member, safe, &prime_fpriv->head, entry) { | ||
256 | list_del(&member->entry); | ||
257 | kfree(member); | ||
258 | } | ||
259 | } | ||
260 | EXPORT_SYMBOL(drm_prime_destroy_file_private); | ||
261 | |||
262 | int drm_prime_add_imported_buf_handle(struct drm_prime_file_private *prime_fpriv, struct dma_buf *dma_buf, uint32_t handle) | ||
263 | { | ||
264 | struct drm_prime_member *member; | ||
265 | |||
266 | member = kmalloc(sizeof(*member), GFP_KERNEL); | ||
267 | if (!member) | ||
268 | return -ENOMEM; | ||
269 | |||
270 | member->dma_buf = dma_buf; | ||
271 | member->handle = handle; | ||
272 | list_add(&member->entry, &prime_fpriv->head); | ||
273 | return 0; | ||
274 | } | ||
275 | EXPORT_SYMBOL(drm_prime_add_imported_buf_handle); | ||
276 | |||
277 | int drm_prime_lookup_imported_buf_handle(struct drm_prime_file_private *prime_fpriv, struct dma_buf *dma_buf, uint32_t *handle) | ||
278 | { | ||
279 | struct drm_prime_member *member; | ||
280 | |||
281 | list_for_each_entry(member, &prime_fpriv->head, entry) { | ||
282 | if (member->dma_buf == dma_buf) { | ||
283 | *handle = member->handle; | ||
284 | return 0; | ||
285 | } | ||
286 | } | ||
287 | return -ENOENT; | ||
288 | } | ||
289 | EXPORT_SYMBOL(drm_prime_lookup_imported_buf_handle); | ||
290 | |||
291 | void drm_prime_remove_imported_buf_handle(struct drm_prime_file_private *prime_fpriv, struct dma_buf *dma_buf) | ||
292 | { | ||
293 | struct drm_prime_member *member, *safe; | ||
294 | |||
295 | mutex_lock(&prime_fpriv->lock); | ||
296 | list_for_each_entry_safe(member, safe, &prime_fpriv->head, entry) { | ||
297 | if (member->dma_buf == dma_buf) { | ||
298 | list_del(&member->entry); | ||
299 | kfree(member); | ||
300 | } | ||
301 | } | ||
302 | mutex_unlock(&prime_fpriv->lock); | ||
303 | } | ||
304 | EXPORT_SYMBOL(drm_prime_remove_imported_buf_handle); | ||
diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c index fdb7ccefffbd..b505b70dba05 100644 --- a/drivers/gpu/drm/i915/i915_debugfs.c +++ b/drivers/gpu/drm/i915/i915_debugfs.c | |||
@@ -1502,14 +1502,6 @@ static int i915_ppgtt_info(struct seq_file *m, void *data) | |||
1502 | return 0; | 1502 | return 0; |
1503 | } | 1503 | } |
1504 | 1504 | ||
1505 | static int | ||
1506 | i915_debugfs_common_open(struct inode *inode, | ||
1507 | struct file *filp) | ||
1508 | { | ||
1509 | filp->private_data = inode->i_private; | ||
1510 | return 0; | ||
1511 | } | ||
1512 | |||
1513 | static ssize_t | 1505 | static ssize_t |
1514 | i915_wedged_read(struct file *filp, | 1506 | i915_wedged_read(struct file *filp, |
1515 | char __user *ubuf, | 1507 | char __user *ubuf, |
@@ -1560,7 +1552,7 @@ i915_wedged_write(struct file *filp, | |||
1560 | 1552 | ||
1561 | static const struct file_operations i915_wedged_fops = { | 1553 | static const struct file_operations i915_wedged_fops = { |
1562 | .owner = THIS_MODULE, | 1554 | .owner = THIS_MODULE, |
1563 | .open = i915_debugfs_common_open, | 1555 | .open = simple_open, |
1564 | .read = i915_wedged_read, | 1556 | .read = i915_wedged_read, |
1565 | .write = i915_wedged_write, | 1557 | .write = i915_wedged_write, |
1566 | .llseek = default_llseek, | 1558 | .llseek = default_llseek, |
@@ -1622,7 +1614,7 @@ i915_max_freq_write(struct file *filp, | |||
1622 | 1614 | ||
1623 | static const struct file_operations i915_max_freq_fops = { | 1615 | static const struct file_operations i915_max_freq_fops = { |
1624 | .owner = THIS_MODULE, | 1616 | .owner = THIS_MODULE, |
1625 | .open = i915_debugfs_common_open, | 1617 | .open = simple_open, |
1626 | .read = i915_max_freq_read, | 1618 | .read = i915_max_freq_read, |
1627 | .write = i915_max_freq_write, | 1619 | .write = i915_max_freq_write, |
1628 | .llseek = default_llseek, | 1620 | .llseek = default_llseek, |
@@ -1693,7 +1685,7 @@ i915_cache_sharing_write(struct file *filp, | |||
1693 | 1685 | ||
1694 | static const struct file_operations i915_cache_sharing_fops = { | 1686 | static const struct file_operations i915_cache_sharing_fops = { |
1695 | .owner = THIS_MODULE, | 1687 | .owner = THIS_MODULE, |
1696 | .open = i915_debugfs_common_open, | 1688 | .open = simple_open, |
1697 | .read = i915_cache_sharing_read, | 1689 | .read = i915_cache_sharing_read, |
1698 | .write = i915_cache_sharing_write, | 1690 | .write = i915_cache_sharing_write, |
1699 | .llseek = default_llseek, | 1691 | .llseek = default_llseek, |
diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c index 9341eb8ce93b..785f67f963ef 100644 --- a/drivers/gpu/drm/i915/i915_dma.c +++ b/drivers/gpu/drm/i915/i915_dma.c | |||
@@ -1183,6 +1183,21 @@ static bool i915_switcheroo_can_switch(struct pci_dev *pdev) | |||
1183 | return can_switch; | 1183 | return can_switch; |
1184 | } | 1184 | } |
1185 | 1185 | ||
1186 | static bool | ||
1187 | intel_enable_ppgtt(struct drm_device *dev) | ||
1188 | { | ||
1189 | if (i915_enable_ppgtt >= 0) | ||
1190 | return i915_enable_ppgtt; | ||
1191 | |||
1192 | #ifdef CONFIG_INTEL_IOMMU | ||
1193 | /* Disable ppgtt on SNB if VT-d is on. */ | ||
1194 | if (INTEL_INFO(dev)->gen == 6 && intel_iommu_gfx_mapped) | ||
1195 | return false; | ||
1196 | #endif | ||
1197 | |||
1198 | return true; | ||
1199 | } | ||
1200 | |||
1186 | static int i915_load_gem_init(struct drm_device *dev) | 1201 | static int i915_load_gem_init(struct drm_device *dev) |
1187 | { | 1202 | { |
1188 | struct drm_i915_private *dev_priv = dev->dev_private; | 1203 | struct drm_i915_private *dev_priv = dev->dev_private; |
@@ -1197,7 +1212,7 @@ static int i915_load_gem_init(struct drm_device *dev) | |||
1197 | drm_mm_init(&dev_priv->mm.stolen, 0, prealloc_size); | 1212 | drm_mm_init(&dev_priv->mm.stolen, 0, prealloc_size); |
1198 | 1213 | ||
1199 | mutex_lock(&dev->struct_mutex); | 1214 | mutex_lock(&dev->struct_mutex); |
1200 | if (i915_enable_ppgtt && HAS_ALIASING_PPGTT(dev)) { | 1215 | if (intel_enable_ppgtt(dev) && HAS_ALIASING_PPGTT(dev)) { |
1201 | /* PPGTT pdes are stolen from global gtt ptes, so shrink the | 1216 | /* PPGTT pdes are stolen from global gtt ptes, so shrink the |
1202 | * aperture accordingly when using aliasing ppgtt. */ | 1217 | * aperture accordingly when using aliasing ppgtt. */ |
1203 | gtt_size -= I915_PPGTT_PD_ENTRIES*PAGE_SIZE; | 1218 | gtt_size -= I915_PPGTT_PD_ENTRIES*PAGE_SIZE; |
@@ -1207,8 +1222,10 @@ static int i915_load_gem_init(struct drm_device *dev) | |||
1207 | i915_gem_do_init(dev, 0, mappable_size, gtt_size); | 1222 | i915_gem_do_init(dev, 0, mappable_size, gtt_size); |
1208 | 1223 | ||
1209 | ret = i915_gem_init_aliasing_ppgtt(dev); | 1224 | ret = i915_gem_init_aliasing_ppgtt(dev); |
1210 | if (ret) | 1225 | if (ret) { |
1226 | mutex_unlock(&dev->struct_mutex); | ||
1211 | return ret; | 1227 | return ret; |
1228 | } | ||
1212 | } else { | 1229 | } else { |
1213 | /* Let GEM Manage all of the aperture. | 1230 | /* Let GEM Manage all of the aperture. |
1214 | * | 1231 | * |
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c index 1a7559b59997..dfa55e7478fb 100644 --- a/drivers/gpu/drm/i915/i915_drv.c +++ b/drivers/gpu/drm/i915/i915_drv.c | |||
@@ -66,7 +66,11 @@ MODULE_PARM_DESC(semaphores, | |||
66 | int i915_enable_rc6 __read_mostly = -1; | 66 | int i915_enable_rc6 __read_mostly = -1; |
67 | module_param_named(i915_enable_rc6, i915_enable_rc6, int, 0600); | 67 | module_param_named(i915_enable_rc6, i915_enable_rc6, int, 0600); |
68 | MODULE_PARM_DESC(i915_enable_rc6, | 68 | MODULE_PARM_DESC(i915_enable_rc6, |
69 | "Enable power-saving render C-state 6 (default: -1 (use per-chip default)"); | 69 | "Enable power-saving render C-state 6. " |
70 | "Different stages can be selected via bitmask values " | ||
71 | "(0 = disable; 1 = enable rc6; 2 = enable deep rc6; 4 = enable deepest rc6). " | ||
72 | "For example, 3 would enable rc6 and deep rc6, and 7 would enable everything. " | ||
73 | "default: -1 (use per-chip default)"); | ||
70 | 74 | ||
71 | int i915_enable_fbc __read_mostly = -1; | 75 | int i915_enable_fbc __read_mostly = -1; |
72 | module_param_named(i915_enable_fbc, i915_enable_fbc, int, 0600); | 76 | module_param_named(i915_enable_fbc, i915_enable_fbc, int, 0600); |
@@ -103,8 +107,8 @@ MODULE_PARM_DESC(enable_hangcheck, | |||
103 | "WARNING: Disabling this can cause system wide hangs. " | 107 | "WARNING: Disabling this can cause system wide hangs. " |
104 | "(default: true)"); | 108 | "(default: true)"); |
105 | 109 | ||
106 | bool i915_enable_ppgtt __read_mostly = 1; | 110 | int i915_enable_ppgtt __read_mostly = -1; |
107 | module_param_named(i915_enable_ppgtt, i915_enable_ppgtt, bool, 0600); | 111 | module_param_named(i915_enable_ppgtt, i915_enable_ppgtt, int, 0600); |
108 | MODULE_PARM_DESC(i915_enable_ppgtt, | 112 | MODULE_PARM_DESC(i915_enable_ppgtt, |
109 | "Enable PPGTT (default: true)"); | 113 | "Enable PPGTT (default: true)"); |
110 | 114 | ||
@@ -292,6 +296,7 @@ static const struct pci_device_id pciidlist[] = { /* aka */ | |||
292 | INTEL_VGA_DEVICE(0x0152, &intel_ivybridge_d_info), /* GT1 desktop */ | 296 | INTEL_VGA_DEVICE(0x0152, &intel_ivybridge_d_info), /* GT1 desktop */ |
293 | INTEL_VGA_DEVICE(0x0162, &intel_ivybridge_d_info), /* GT2 desktop */ | 297 | INTEL_VGA_DEVICE(0x0162, &intel_ivybridge_d_info), /* GT2 desktop */ |
294 | INTEL_VGA_DEVICE(0x015a, &intel_ivybridge_d_info), /* GT1 server */ | 298 | INTEL_VGA_DEVICE(0x015a, &intel_ivybridge_d_info), /* GT1 server */ |
299 | INTEL_VGA_DEVICE(0x016a, &intel_ivybridge_d_info), /* GT2 server */ | ||
295 | {0, 0, 0} | 300 | {0, 0, 0} |
296 | }; | 301 | }; |
297 | 302 | ||
@@ -533,7 +538,9 @@ static int i915_drm_thaw(struct drm_device *dev) | |||
533 | drm_irq_install(dev); | 538 | drm_irq_install(dev); |
534 | 539 | ||
535 | /* Resume the modeset for every activated CRTC */ | 540 | /* Resume the modeset for every activated CRTC */ |
541 | mutex_lock(&dev->mode_config.mutex); | ||
536 | drm_helper_resume_force_mode(dev); | 542 | drm_helper_resume_force_mode(dev); |
543 | mutex_unlock(&dev->mode_config.mutex); | ||
537 | 544 | ||
538 | if (IS_IRONLAKE_M(dev)) | 545 | if (IS_IRONLAKE_M(dev)) |
539 | ironlake_enable_rc6(dev); | 546 | ironlake_enable_rc6(dev); |
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index c0f19f572004..5fabc6c31fec 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h | |||
@@ -1053,6 +1053,27 @@ struct drm_i915_file_private { | |||
1053 | 1053 | ||
1054 | #include "i915_trace.h" | 1054 | #include "i915_trace.h" |
1055 | 1055 | ||
1056 | /** | ||
1057 | * RC6 is a special power stage which allows the GPU to enter an very | ||
1058 | * low-voltage mode when idle, using down to 0V while at this stage. This | ||
1059 | * stage is entered automatically when the GPU is idle when RC6 support is | ||
1060 | * enabled, and as soon as new workload arises GPU wakes up automatically as well. | ||
1061 | * | ||
1062 | * There are different RC6 modes available in Intel GPU, which differentiate | ||
1063 | * among each other with the latency required to enter and leave RC6 and | ||
1064 | * voltage consumed by the GPU in different states. | ||
1065 | * | ||
1066 | * The combination of the following flags define which states GPU is allowed | ||
1067 | * to enter, while RC6 is the normal RC6 state, RC6p is the deep RC6, and | ||
1068 | * RC6pp is deepest RC6. Their support by hardware varies according to the | ||
1069 | * GPU, BIOS, chipset and platform. RC6 is usually the safest one and the one | ||
1070 | * which brings the most power savings; deeper states save more power, but | ||
1071 | * require higher latency to switch to and wake up. | ||
1072 | */ | ||
1073 | #define INTEL_RC6_ENABLE (1<<0) | ||
1074 | #define INTEL_RC6p_ENABLE (1<<1) | ||
1075 | #define INTEL_RC6pp_ENABLE (1<<2) | ||
1076 | |||
1056 | extern struct drm_ioctl_desc i915_ioctls[]; | 1077 | extern struct drm_ioctl_desc i915_ioctls[]; |
1057 | extern int i915_max_ioctl; | 1078 | extern int i915_max_ioctl; |
1058 | extern unsigned int i915_fbpercrtc __always_unused; | 1079 | extern unsigned int i915_fbpercrtc __always_unused; |
@@ -1065,7 +1086,7 @@ extern int i915_vbt_sdvo_panel_type __read_mostly; | |||
1065 | extern int i915_enable_rc6 __read_mostly; | 1086 | extern int i915_enable_rc6 __read_mostly; |
1066 | extern int i915_enable_fbc __read_mostly; | 1087 | extern int i915_enable_fbc __read_mostly; |
1067 | extern bool i915_enable_hangcheck __read_mostly; | 1088 | extern bool i915_enable_hangcheck __read_mostly; |
1068 | extern bool i915_enable_ppgtt __read_mostly; | 1089 | extern int i915_enable_ppgtt __read_mostly; |
1069 | 1090 | ||
1070 | extern int i915_suspend(struct drm_device *dev, pm_message_t state); | 1091 | extern int i915_suspend(struct drm_device *dev, pm_message_t state); |
1071 | extern int i915_resume(struct drm_device *dev); | 1092 | 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 1f441f5c2405..4c65c639f772 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c | |||
@@ -1472,16 +1472,19 @@ i915_gem_object_move_to_active(struct drm_i915_gem_object *obj, | |||
1472 | list_move_tail(&obj->ring_list, &ring->active_list); | 1472 | list_move_tail(&obj->ring_list, &ring->active_list); |
1473 | 1473 | ||
1474 | obj->last_rendering_seqno = seqno; | 1474 | obj->last_rendering_seqno = seqno; |
1475 | if (obj->fenced_gpu_access) { | ||
1476 | struct drm_i915_fence_reg *reg; | ||
1477 | |||
1478 | BUG_ON(obj->fence_reg == I915_FENCE_REG_NONE); | ||
1479 | 1475 | ||
1476 | if (obj->fenced_gpu_access) { | ||
1480 | obj->last_fenced_seqno = seqno; | 1477 | obj->last_fenced_seqno = seqno; |
1481 | obj->last_fenced_ring = ring; | 1478 | obj->last_fenced_ring = ring; |
1482 | 1479 | ||
1483 | reg = &dev_priv->fence_regs[obj->fence_reg]; | 1480 | /* Bump MRU to take account of the delayed flush */ |
1484 | list_move_tail(®->lru_list, &dev_priv->mm.fence_list); | 1481 | if (obj->fence_reg != I915_FENCE_REG_NONE) { |
1482 | struct drm_i915_fence_reg *reg; | ||
1483 | |||
1484 | reg = &dev_priv->fence_regs[obj->fence_reg]; | ||
1485 | list_move_tail(®->lru_list, | ||
1486 | &dev_priv->mm.fence_list); | ||
1487 | } | ||
1485 | } | 1488 | } |
1486 | } | 1489 | } |
1487 | 1490 | ||
@@ -3754,12 +3757,32 @@ void i915_gem_init_ppgtt(struct drm_device *dev) | |||
3754 | drm_i915_private_t *dev_priv = dev->dev_private; | 3757 | drm_i915_private_t *dev_priv = dev->dev_private; |
3755 | uint32_t pd_offset; | 3758 | uint32_t pd_offset; |
3756 | struct intel_ring_buffer *ring; | 3759 | struct intel_ring_buffer *ring; |
3760 | struct i915_hw_ppgtt *ppgtt = dev_priv->mm.aliasing_ppgtt; | ||
3761 | uint32_t __iomem *pd_addr; | ||
3762 | uint32_t pd_entry; | ||
3757 | int i; | 3763 | int i; |
3758 | 3764 | ||
3759 | if (!dev_priv->mm.aliasing_ppgtt) | 3765 | if (!dev_priv->mm.aliasing_ppgtt) |
3760 | return; | 3766 | return; |
3761 | 3767 | ||
3762 | pd_offset = dev_priv->mm.aliasing_ppgtt->pd_offset; | 3768 | |
3769 | pd_addr = dev_priv->mm.gtt->gtt + ppgtt->pd_offset/sizeof(uint32_t); | ||
3770 | for (i = 0; i < ppgtt->num_pd_entries; i++) { | ||
3771 | dma_addr_t pt_addr; | ||
3772 | |||
3773 | if (dev_priv->mm.gtt->needs_dmar) | ||
3774 | pt_addr = ppgtt->pt_dma_addr[i]; | ||
3775 | else | ||
3776 | pt_addr = page_to_phys(ppgtt->pt_pages[i]); | ||
3777 | |||
3778 | pd_entry = GEN6_PDE_ADDR_ENCODE(pt_addr); | ||
3779 | pd_entry |= GEN6_PDE_VALID; | ||
3780 | |||
3781 | writel(pd_entry, pd_addr + i); | ||
3782 | } | ||
3783 | readl(pd_addr); | ||
3784 | |||
3785 | pd_offset = ppgtt->pd_offset; | ||
3763 | pd_offset /= 64; /* in cachelines, */ | 3786 | pd_offset /= 64; /* in cachelines, */ |
3764 | pd_offset <<= 16; | 3787 | pd_offset <<= 16; |
3765 | 3788 | ||
diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c index 81687af00893..f51a696486cb 100644 --- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c +++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c | |||
@@ -498,8 +498,8 @@ pin_and_fence_object(struct drm_i915_gem_object *obj, | |||
498 | if (ret) | 498 | if (ret) |
499 | goto err_unpin; | 499 | goto err_unpin; |
500 | } | 500 | } |
501 | obj->pending_fenced_gpu_access = true; | ||
501 | } | 502 | } |
502 | obj->pending_fenced_gpu_access = need_fence; | ||
503 | } | 503 | } |
504 | 504 | ||
505 | entry->offset = obj->gtt_offset; | 505 | entry->offset = obj->gtt_offset; |
diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c index 2eacd78bb93b..a135c61f4119 100644 --- a/drivers/gpu/drm/i915/i915_gem_gtt.c +++ b/drivers/gpu/drm/i915/i915_gem_gtt.c | |||
@@ -65,9 +65,7 @@ int i915_gem_init_aliasing_ppgtt(struct drm_device *dev) | |||
65 | { | 65 | { |
66 | struct drm_i915_private *dev_priv = dev->dev_private; | 66 | struct drm_i915_private *dev_priv = dev->dev_private; |
67 | struct i915_hw_ppgtt *ppgtt; | 67 | struct i915_hw_ppgtt *ppgtt; |
68 | uint32_t pd_entry; | ||
69 | unsigned first_pd_entry_in_global_pt; | 68 | unsigned first_pd_entry_in_global_pt; |
70 | uint32_t __iomem *pd_addr; | ||
71 | int i; | 69 | int i; |
72 | int ret = -ENOMEM; | 70 | int ret = -ENOMEM; |
73 | 71 | ||
@@ -100,7 +98,6 @@ int i915_gem_init_aliasing_ppgtt(struct drm_device *dev) | |||
100 | goto err_pt_alloc; | 98 | goto err_pt_alloc; |
101 | } | 99 | } |
102 | 100 | ||
103 | pd_addr = dev_priv->mm.gtt->gtt + first_pd_entry_in_global_pt; | ||
104 | for (i = 0; i < ppgtt->num_pd_entries; i++) { | 101 | for (i = 0; i < ppgtt->num_pd_entries; i++) { |
105 | dma_addr_t pt_addr; | 102 | dma_addr_t pt_addr; |
106 | if (dev_priv->mm.gtt->needs_dmar) { | 103 | if (dev_priv->mm.gtt->needs_dmar) { |
@@ -117,13 +114,7 @@ int i915_gem_init_aliasing_ppgtt(struct drm_device *dev) | |||
117 | ppgtt->pt_dma_addr[i] = pt_addr; | 114 | ppgtt->pt_dma_addr[i] = pt_addr; |
118 | } else | 115 | } else |
119 | pt_addr = page_to_phys(ppgtt->pt_pages[i]); | 116 | pt_addr = page_to_phys(ppgtt->pt_pages[i]); |
120 | |||
121 | pd_entry = GEN6_PDE_ADDR_ENCODE(pt_addr); | ||
122 | pd_entry |= GEN6_PDE_VALID; | ||
123 | |||
124 | writel(pd_entry, pd_addr + i); | ||
125 | } | 117 | } |
126 | readl(pd_addr); | ||
127 | 118 | ||
128 | ppgtt->scratch_page_dma_addr = dev_priv->mm.gtt->scratch_page_dma; | 119 | ppgtt->scratch_page_dma_addr = dev_priv->mm.gtt->scratch_page_dma; |
129 | 120 | ||
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h index 3886cf051bac..2abf4eb94039 100644 --- a/drivers/gpu/drm/i915/i915_reg.h +++ b/drivers/gpu/drm/i915/i915_reg.h | |||
@@ -2385,6 +2385,7 @@ | |||
2385 | #define PIPECONF_DISABLE 0 | 2385 | #define PIPECONF_DISABLE 0 |
2386 | #define PIPECONF_DOUBLE_WIDE (1<<30) | 2386 | #define PIPECONF_DOUBLE_WIDE (1<<30) |
2387 | #define I965_PIPECONF_ACTIVE (1<<30) | 2387 | #define I965_PIPECONF_ACTIVE (1<<30) |
2388 | #define PIPECONF_FRAME_START_DELAY_MASK (3<<27) | ||
2388 | #define PIPECONF_SINGLE_WIDE 0 | 2389 | #define PIPECONF_SINGLE_WIDE 0 |
2389 | #define PIPECONF_PIPE_UNLOCKED 0 | 2390 | #define PIPECONF_PIPE_UNLOCKED 0 |
2390 | #define PIPECONF_PIPE_LOCKED (1<<25) | 2391 | #define PIPECONF_PIPE_LOCKED (1<<25) |
diff --git a/drivers/gpu/drm/i915/intel_bios.c b/drivers/gpu/drm/i915/intel_bios.c index 8168d8f8a634..b48fc2a8410c 100644 --- a/drivers/gpu/drm/i915/intel_bios.c +++ b/drivers/gpu/drm/i915/intel_bios.c | |||
@@ -24,6 +24,7 @@ | |||
24 | * Eric Anholt <eric@anholt.net> | 24 | * Eric Anholt <eric@anholt.net> |
25 | * | 25 | * |
26 | */ | 26 | */ |
27 | #include <linux/dmi.h> | ||
27 | #include <drm/drm_dp_helper.h> | 28 | #include <drm/drm_dp_helper.h> |
28 | #include "drmP.h" | 29 | #include "drmP.h" |
29 | #include "drm.h" | 30 | #include "drm.h" |
@@ -621,6 +622,26 @@ init_vbt_defaults(struct drm_i915_private *dev_priv) | |||
621 | dev_priv->edp.bpp = 18; | 622 | dev_priv->edp.bpp = 18; |
622 | } | 623 | } |
623 | 624 | ||
625 | static int __init intel_no_opregion_vbt_callback(const struct dmi_system_id *id) | ||
626 | { | ||
627 | DRM_DEBUG_KMS("Falling back to manually reading VBT from " | ||
628 | "VBIOS ROM for %s\n", | ||
629 | id->ident); | ||
630 | return 1; | ||
631 | } | ||
632 | |||
633 | static const struct dmi_system_id intel_no_opregion_vbt[] = { | ||
634 | { | ||
635 | .callback = intel_no_opregion_vbt_callback, | ||
636 | .ident = "ThinkCentre A57", | ||
637 | .matches = { | ||
638 | DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), | ||
639 | DMI_MATCH(DMI_PRODUCT_NAME, "97027RG"), | ||
640 | }, | ||
641 | }, | ||
642 | { } | ||
643 | }; | ||
644 | |||
624 | /** | 645 | /** |
625 | * intel_parse_bios - find VBT and initialize settings from the BIOS | 646 | * intel_parse_bios - find VBT and initialize settings from the BIOS |
626 | * @dev: DRM device | 647 | * @dev: DRM device |
@@ -641,7 +662,7 @@ intel_parse_bios(struct drm_device *dev) | |||
641 | init_vbt_defaults(dev_priv); | 662 | init_vbt_defaults(dev_priv); |
642 | 663 | ||
643 | /* XXX Should this validation be moved to intel_opregion.c? */ | 664 | /* XXX Should this validation be moved to intel_opregion.c? */ |
644 | if (dev_priv->opregion.vbt) { | 665 | if (!dmi_check_system(intel_no_opregion_vbt) && dev_priv->opregion.vbt) { |
645 | struct vbt_header *vbt = dev_priv->opregion.vbt; | 666 | struct vbt_header *vbt = dev_priv->opregion.vbt; |
646 | if (memcmp(vbt->signature, "$VBT", 4) == 0) { | 667 | if (memcmp(vbt->signature, "$VBT", 4) == 0) { |
647 | DRM_DEBUG_KMS("Using VBT from OpRegion: %20s\n", | 668 | DRM_DEBUG_KMS("Using VBT from OpRegion: %20s\n", |
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index d514719f65e2..91b35fd1db8c 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
@@ -5539,7 +5539,8 @@ void ironlake_init_pch_refclk(struct drm_device *dev) | |||
5539 | if (intel_panel_use_ssc(dev_priv) && can_ssc) { | 5539 | if (intel_panel_use_ssc(dev_priv) && can_ssc) { |
5540 | DRM_DEBUG_KMS("Using SSC on panel\n"); | 5540 | DRM_DEBUG_KMS("Using SSC on panel\n"); |
5541 | temp |= DREF_SSC1_ENABLE; | 5541 | temp |= DREF_SSC1_ENABLE; |
5542 | } | 5542 | } else |
5543 | temp &= ~DREF_SSC1_ENABLE; | ||
5543 | 5544 | ||
5544 | /* Get SSC going before enabling the outputs */ | 5545 | /* Get SSC going before enabling the outputs */ |
5545 | I915_WRITE(PCH_DREF_CONTROL, temp); | 5546 | I915_WRITE(PCH_DREF_CONTROL, temp); |
@@ -7580,6 +7581,12 @@ static void intel_sanitize_modesetting(struct drm_device *dev, | |||
7580 | struct drm_i915_private *dev_priv = dev->dev_private; | 7581 | struct drm_i915_private *dev_priv = dev->dev_private; |
7581 | u32 reg, val; | 7582 | u32 reg, val; |
7582 | 7583 | ||
7584 | /* Clear any frame start delays used for debugging left by the BIOS */ | ||
7585 | for_each_pipe(pipe) { | ||
7586 | reg = PIPECONF(pipe); | ||
7587 | I915_WRITE(reg, I915_READ(reg) & ~PIPECONF_FRAME_START_DELAY_MASK); | ||
7588 | } | ||
7589 | |||
7583 | if (HAS_PCH_SPLIT(dev)) | 7590 | if (HAS_PCH_SPLIT(dev)) |
7584 | return; | 7591 | return; |
7585 | 7592 | ||
@@ -8215,7 +8222,7 @@ void intel_init_emon(struct drm_device *dev) | |||
8215 | dev_priv->corr = (lcfuse & LCFUSE_HIV_MASK); | 8222 | dev_priv->corr = (lcfuse & LCFUSE_HIV_MASK); |
8216 | } | 8223 | } |
8217 | 8224 | ||
8218 | static bool intel_enable_rc6(struct drm_device *dev) | 8225 | static int intel_enable_rc6(struct drm_device *dev) |
8219 | { | 8226 | { |
8220 | /* | 8227 | /* |
8221 | * Respect the kernel parameter if it is set | 8228 | * Respect the kernel parameter if it is set |
@@ -8233,11 +8240,11 @@ static bool intel_enable_rc6(struct drm_device *dev) | |||
8233 | * Disable rc6 on Sandybridge | 8240 | * Disable rc6 on Sandybridge |
8234 | */ | 8241 | */ |
8235 | if (INTEL_INFO(dev)->gen == 6) { | 8242 | if (INTEL_INFO(dev)->gen == 6) { |
8236 | DRM_DEBUG_DRIVER("Sandybridge: RC6 disabled\n"); | 8243 | DRM_DEBUG_DRIVER("Sandybridge: deep RC6 disabled\n"); |
8237 | return 0; | 8244 | return INTEL_RC6_ENABLE; |
8238 | } | 8245 | } |
8239 | DRM_DEBUG_DRIVER("RC6 enabled\n"); | 8246 | DRM_DEBUG_DRIVER("RC6 and deep RC6 enabled\n"); |
8240 | return 1; | 8247 | return (INTEL_RC6_ENABLE | INTEL_RC6p_ENABLE); |
8241 | } | 8248 | } |
8242 | 8249 | ||
8243 | void gen6_enable_rps(struct drm_i915_private *dev_priv) | 8250 | void gen6_enable_rps(struct drm_i915_private *dev_priv) |
@@ -8247,6 +8254,7 @@ void gen6_enable_rps(struct drm_i915_private *dev_priv) | |||
8247 | u32 pcu_mbox, rc6_mask = 0; | 8254 | u32 pcu_mbox, rc6_mask = 0; |
8248 | u32 gtfifodbg; | 8255 | u32 gtfifodbg; |
8249 | int cur_freq, min_freq, max_freq; | 8256 | int cur_freq, min_freq, max_freq; |
8257 | int rc6_mode; | ||
8250 | int i; | 8258 | int i; |
8251 | 8259 | ||
8252 | /* Here begins a magic sequence of register writes to enable | 8260 | /* Here begins a magic sequence of register writes to enable |
@@ -8284,9 +8292,20 @@ void gen6_enable_rps(struct drm_i915_private *dev_priv) | |||
8284 | I915_WRITE(GEN6_RC6p_THRESHOLD, 100000); | 8292 | I915_WRITE(GEN6_RC6p_THRESHOLD, 100000); |
8285 | I915_WRITE(GEN6_RC6pp_THRESHOLD, 64000); /* unused */ | 8293 | I915_WRITE(GEN6_RC6pp_THRESHOLD, 64000); /* unused */ |
8286 | 8294 | ||
8287 | if (intel_enable_rc6(dev_priv->dev)) | 8295 | rc6_mode = intel_enable_rc6(dev_priv->dev); |
8288 | rc6_mask = GEN6_RC_CTL_RC6_ENABLE | | 8296 | if (rc6_mode & INTEL_RC6_ENABLE) |
8289 | ((IS_GEN7(dev_priv->dev)) ? GEN6_RC_CTL_RC6p_ENABLE : 0); | 8297 | rc6_mask |= GEN6_RC_CTL_RC6_ENABLE; |
8298 | |||
8299 | if (rc6_mode & INTEL_RC6p_ENABLE) | ||
8300 | rc6_mask |= GEN6_RC_CTL_RC6p_ENABLE; | ||
8301 | |||
8302 | if (rc6_mode & INTEL_RC6pp_ENABLE) | ||
8303 | rc6_mask |= GEN6_RC_CTL_RC6pp_ENABLE; | ||
8304 | |||
8305 | DRM_INFO("Enabling RC6 states: RC6 %s, RC6p %s, RC6pp %s\n", | ||
8306 | (rc6_mode & INTEL_RC6_ENABLE) ? "on" : "off", | ||
8307 | (rc6_mode & INTEL_RC6p_ENABLE) ? "on" : "off", | ||
8308 | (rc6_mode & INTEL_RC6pp_ENABLE) ? "on" : "off"); | ||
8290 | 8309 | ||
8291 | I915_WRITE(GEN6_RC_CONTROL, | 8310 | I915_WRITE(GEN6_RC_CONTROL, |
8292 | rc6_mask | | 8311 | rc6_mask | |
diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c index c5c0973af8a1..95db2e988227 100644 --- a/drivers/gpu/drm/i915/intel_lvds.c +++ b/drivers/gpu/drm/i915/intel_lvds.c | |||
@@ -755,6 +755,14 @@ static const struct dmi_system_id intel_no_lvds[] = { | |||
755 | DMI_MATCH(DMI_BOARD_NAME, "hp st5747"), | 755 | DMI_MATCH(DMI_BOARD_NAME, "hp st5747"), |
756 | }, | 756 | }, |
757 | }, | 757 | }, |
758 | { | ||
759 | .callback = intel_no_lvds_dmi_callback, | ||
760 | .ident = "MSI Wind Box DC500", | ||
761 | .matches = { | ||
762 | DMI_MATCH(DMI_BOARD_VENDOR, "MICRO-STAR INTERNATIONAL CO., LTD"), | ||
763 | DMI_MATCH(DMI_BOARD_NAME, "MS-7469"), | ||
764 | }, | ||
765 | }, | ||
758 | 766 | ||
759 | { } /* terminating entry */ | 767 | { } /* terminating entry */ |
760 | }; | 768 | }; |
diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c index fc66af6a9448..e25581a9f60f 100644 --- a/drivers/gpu/drm/i915/intel_ringbuffer.c +++ b/drivers/gpu/drm/i915/intel_ringbuffer.c | |||
@@ -626,7 +626,7 @@ gen6_ring_get_seqno(struct intel_ring_buffer *ring) | |||
626 | /* Workaround to force correct ordering between irq and seqno writes on | 626 | /* Workaround to force correct ordering between irq and seqno writes on |
627 | * ivb (and maybe also on snb) by reading from a CS register (like | 627 | * ivb (and maybe also on snb) by reading from a CS register (like |
628 | * ACTHD) before reading the status page. */ | 628 | * ACTHD) before reading the status page. */ |
629 | if (IS_GEN7(dev)) | 629 | if (IS_GEN6(dev) || IS_GEN7(dev)) |
630 | intel_ring_get_active_head(ring); | 630 | intel_ring_get_active_head(ring); |
631 | return intel_read_status_page(ring, I915_GEM_HWS_INDEX); | 631 | return intel_read_status_page(ring, I915_GEM_HWS_INDEX); |
632 | } | 632 | } |
diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c index 7aa0450399a1..a464771a7240 100644 --- a/drivers/gpu/drm/i915/intel_sprite.c +++ b/drivers/gpu/drm/i915/intel_sprite.c | |||
@@ -411,6 +411,9 @@ intel_update_plane(struct drm_plane *plane, struct drm_crtc *crtc, | |||
411 | 411 | ||
412 | old_obj = intel_plane->obj; | 412 | old_obj = intel_plane->obj; |
413 | 413 | ||
414 | src_w = src_w >> 16; | ||
415 | src_h = src_h >> 16; | ||
416 | |||
414 | /* Pipe must be running... */ | 417 | /* Pipe must be running... */ |
415 | if (!(I915_READ(PIPECONF(pipe)) & PIPECONF_ENABLE)) | 418 | if (!(I915_READ(PIPECONF(pipe)) & PIPECONF_ENABLE)) |
416 | return -EINVAL; | 419 | return -EINVAL; |
diff --git a/drivers/gpu/drm/nouveau/Kconfig b/drivers/gpu/drm/nouveau/Kconfig index ca1639918f57..97a81260485a 100644 --- a/drivers/gpu/drm/nouveau/Kconfig +++ b/drivers/gpu/drm/nouveau/Kconfig | |||
@@ -13,6 +13,7 @@ config DRM_NOUVEAU | |||
13 | select ACPI_VIDEO if ACPI && X86 && BACKLIGHT_CLASS_DEVICE && VIDEO_OUTPUT_CONTROL && INPUT | 13 | select ACPI_VIDEO if ACPI && X86 && BACKLIGHT_CLASS_DEVICE && VIDEO_OUTPUT_CONTROL && INPUT |
14 | select ACPI_WMI if ACPI | 14 | select ACPI_WMI if ACPI |
15 | select MXM_WMI if ACPI | 15 | select MXM_WMI if ACPI |
16 | select POWER_SUPPLY | ||
16 | help | 17 | help |
17 | Choose this option for open-source nVidia support. | 18 | Choose this option for open-source nVidia support. |
18 | 19 | ||
diff --git a/drivers/gpu/drm/nouveau/nouveau_bios.c b/drivers/gpu/drm/nouveau/nouveau_bios.c index 637afe71de56..80963d05b54a 100644 --- a/drivers/gpu/drm/nouveau/nouveau_bios.c +++ b/drivers/gpu/drm/nouveau/nouveau_bios.c | |||
@@ -177,14 +177,15 @@ bios_shadow_pci(struct nvbios *bios) | |||
177 | 177 | ||
178 | if (!pci_enable_rom(pdev)) { | 178 | if (!pci_enable_rom(pdev)) { |
179 | void __iomem *rom = pci_map_rom(pdev, &length); | 179 | void __iomem *rom = pci_map_rom(pdev, &length); |
180 | if (rom) { | 180 | if (rom && length) { |
181 | bios->data = kmalloc(length, GFP_KERNEL); | 181 | bios->data = kmalloc(length, GFP_KERNEL); |
182 | if (bios->data) { | 182 | if (bios->data) { |
183 | memcpy_fromio(bios->data, rom, length); | 183 | memcpy_fromio(bios->data, rom, length); |
184 | bios->length = length; | 184 | bios->length = length; |
185 | } | 185 | } |
186 | pci_unmap_rom(pdev, rom); | ||
187 | } | 186 | } |
187 | if (rom) | ||
188 | pci_unmap_rom(pdev, rom); | ||
188 | 189 | ||
189 | pci_disable_rom(pdev); | 190 | pci_disable_rom(pdev); |
190 | } | 191 | } |
diff --git a/drivers/gpu/drm/nouveau/nouveau_channel.c b/drivers/gpu/drm/nouveau/nouveau_channel.c index 44e6416d4a33..846afb0bfef4 100644 --- a/drivers/gpu/drm/nouveau/nouveau_channel.c +++ b/drivers/gpu/drm/nouveau/nouveau_channel.c | |||
@@ -436,11 +436,11 @@ nouveau_ioctl_fifo_alloc(struct drm_device *dev, void *data, | |||
436 | } | 436 | } |
437 | 437 | ||
438 | if (dev_priv->card_type < NV_C0) { | 438 | if (dev_priv->card_type < NV_C0) { |
439 | init->subchan[0].handle = NvSw; | 439 | init->subchan[0].handle = 0x00000000; |
440 | init->subchan[0].grclass = NV_SW; | 440 | init->subchan[0].grclass = 0x0000; |
441 | init->nr_subchan = 1; | 441 | init->subchan[1].handle = NvSw; |
442 | } else { | 442 | init->subchan[1].grclass = NV_SW; |
443 | init->nr_subchan = 0; | 443 | init->nr_subchan = 2; |
444 | } | 444 | } |
445 | 445 | ||
446 | /* Named memory object area */ | 446 | /* Named memory object area */ |
diff --git a/drivers/gpu/drm/nouveau/nouveau_dma.h b/drivers/gpu/drm/nouveau/nouveau_dma.h index bcf0fd9e313e..23d4edf992b7 100644 --- a/drivers/gpu/drm/nouveau/nouveau_dma.h +++ b/drivers/gpu/drm/nouveau/nouveau_dma.h | |||
@@ -48,8 +48,8 @@ void nv50_dma_push(struct nouveau_channel *, struct nouveau_bo *, | |||
48 | 48 | ||
49 | /* Hardcoded object assignments to subchannels (subchannel id). */ | 49 | /* Hardcoded object assignments to subchannels (subchannel id). */ |
50 | enum { | 50 | enum { |
51 | NvSubSw = 0, | 51 | NvSubM2MF = 0, |
52 | NvSubM2MF = 1, | 52 | NvSubSw = 1, |
53 | NvSub2D = 2, | 53 | NvSub2D = 2, |
54 | NvSubCtxSurf2D = 2, | 54 | NvSubCtxSurf2D = 2, |
55 | NvSubGdiRect = 3, | 55 | NvSubGdiRect = 3, |
diff --git a/drivers/gpu/drm/nouveau/nouveau_state.c b/drivers/gpu/drm/nouveau/nouveau_state.c index a4886b36d0fa..c2a8511e855a 100644 --- a/drivers/gpu/drm/nouveau/nouveau_state.c +++ b/drivers/gpu/drm/nouveau/nouveau_state.c | |||
@@ -642,7 +642,7 @@ nouveau_card_channel_init(struct drm_device *dev) | |||
642 | OUT_RING (chan, chan->vram_handle); | 642 | OUT_RING (chan, chan->vram_handle); |
643 | OUT_RING (chan, chan->gart_handle); | 643 | OUT_RING (chan, chan->gart_handle); |
644 | } else | 644 | } else |
645 | if (dev_priv->card_type <= NV_C0) { | 645 | if (dev_priv->card_type <= NV_D0) { |
646 | ret = nouveau_gpuobj_gr_new(chan, 0x9039, 0x9039); | 646 | ret = nouveau_gpuobj_gr_new(chan, 0x9039, 0x9039); |
647 | if (ret) | 647 | if (ret) |
648 | goto error; | 648 | goto error; |
diff --git a/drivers/gpu/drm/radeon/atom.c b/drivers/gpu/drm/radeon/atom.c index d1bd239cd9e9..5ce9bf51a8de 100644 --- a/drivers/gpu/drm/radeon/atom.c +++ b/drivers/gpu/drm/radeon/atom.c | |||
@@ -1306,8 +1306,11 @@ struct atom_context *atom_parse(struct card_info *card, void *bios) | |||
1306 | 1306 | ||
1307 | int atom_asic_init(struct atom_context *ctx) | 1307 | int atom_asic_init(struct atom_context *ctx) |
1308 | { | 1308 | { |
1309 | struct radeon_device *rdev = ctx->card->dev->dev_private; | ||
1309 | int hwi = CU16(ctx->data_table + ATOM_DATA_FWI_PTR); | 1310 | int hwi = CU16(ctx->data_table + ATOM_DATA_FWI_PTR); |
1310 | uint32_t ps[16]; | 1311 | uint32_t ps[16]; |
1312 | int ret; | ||
1313 | |||
1311 | memset(ps, 0, 64); | 1314 | memset(ps, 0, 64); |
1312 | 1315 | ||
1313 | ps[0] = cpu_to_le32(CU32(hwi + ATOM_FWI_DEFSCLK_PTR)); | 1316 | ps[0] = cpu_to_le32(CU32(hwi + ATOM_FWI_DEFSCLK_PTR)); |
@@ -1317,7 +1320,17 @@ int atom_asic_init(struct atom_context *ctx) | |||
1317 | 1320 | ||
1318 | if (!CU16(ctx->cmd_table + 4 + 2 * ATOM_CMD_INIT)) | 1321 | if (!CU16(ctx->cmd_table + 4 + 2 * ATOM_CMD_INIT)) |
1319 | return 1; | 1322 | return 1; |
1320 | return atom_execute_table(ctx, ATOM_CMD_INIT, ps); | 1323 | ret = atom_execute_table(ctx, ATOM_CMD_INIT, ps); |
1324 | if (ret) | ||
1325 | return ret; | ||
1326 | |||
1327 | memset(ps, 0, 64); | ||
1328 | |||
1329 | if (rdev->family < CHIP_R600) { | ||
1330 | if (CU16(ctx->cmd_table + 4 + 2 * ATOM_CMD_SPDFANCNTL)) | ||
1331 | atom_execute_table(ctx, ATOM_CMD_SPDFANCNTL, ps); | ||
1332 | } | ||
1333 | return ret; | ||
1321 | } | 1334 | } |
1322 | 1335 | ||
1323 | void atom_destroy(struct atom_context *ctx) | 1336 | void atom_destroy(struct atom_context *ctx) |
diff --git a/drivers/gpu/drm/radeon/atom.h b/drivers/gpu/drm/radeon/atom.h index 93cfe2086ba0..25fea631dad2 100644 --- a/drivers/gpu/drm/radeon/atom.h +++ b/drivers/gpu/drm/radeon/atom.h | |||
@@ -44,6 +44,7 @@ | |||
44 | #define ATOM_CMD_SETSCLK 0x0A | 44 | #define ATOM_CMD_SETSCLK 0x0A |
45 | #define ATOM_CMD_SETMCLK 0x0B | 45 | #define ATOM_CMD_SETMCLK 0x0B |
46 | #define ATOM_CMD_SETPCLK 0x0C | 46 | #define ATOM_CMD_SETPCLK 0x0C |
47 | #define ATOM_CMD_SPDFANCNTL 0x39 | ||
47 | 48 | ||
48 | #define ATOM_DATA_FWI_PTR 0xC | 49 | #define ATOM_DATA_FWI_PTR 0xC |
49 | #define ATOM_DATA_IIO_PTR 0x32 | 50 | #define ATOM_DATA_IIO_PTR 0x32 |
diff --git a/drivers/gpu/drm/radeon/radeon_object.c b/drivers/gpu/drm/radeon/radeon_object.c index 6f70158d34e4..df6a4dbd93f8 100644 --- a/drivers/gpu/drm/radeon/radeon_object.c +++ b/drivers/gpu/drm/radeon/radeon_object.c | |||
@@ -241,7 +241,8 @@ int radeon_bo_pin_restricted(struct radeon_bo *bo, u32 domain, u64 max_offset, | |||
241 | domain_start = bo->rdev->mc.vram_start; | 241 | domain_start = bo->rdev->mc.vram_start; |
242 | else | 242 | else |
243 | domain_start = bo->rdev->mc.gtt_start; | 243 | domain_start = bo->rdev->mc.gtt_start; |
244 | WARN_ON_ONCE((*gpu_addr - domain_start) > max_offset); | 244 | WARN_ON_ONCE(max_offset < |
245 | (radeon_bo_gpu_offset(bo) - domain_start)); | ||
245 | } | 246 | } |
246 | 247 | ||
247 | return 0; | 248 | return 0; |
diff --git a/drivers/gpu/drm/udl/udl_drv.c b/drivers/gpu/drm/udl/udl_drv.c index 5340c5f3987b..53673907a6a0 100644 --- a/drivers/gpu/drm/udl/udl_drv.c +++ b/drivers/gpu/drm/udl/udl_drv.c | |||
@@ -47,7 +47,7 @@ static struct vm_operations_struct udl_gem_vm_ops = { | |||
47 | static const struct file_operations udl_driver_fops = { | 47 | static const struct file_operations udl_driver_fops = { |
48 | .owner = THIS_MODULE, | 48 | .owner = THIS_MODULE, |
49 | .open = drm_open, | 49 | .open = drm_open, |
50 | .mmap = drm_gem_mmap, | 50 | .mmap = udl_drm_gem_mmap, |
51 | .poll = drm_poll, | 51 | .poll = drm_poll, |
52 | .read = drm_read, | 52 | .read = drm_read, |
53 | .unlocked_ioctl = drm_ioctl, | 53 | .unlocked_ioctl = drm_ioctl, |
diff --git a/drivers/gpu/drm/udl/udl_drv.h b/drivers/gpu/drm/udl/udl_drv.h index 1612954a5bc4..96820d03a303 100644 --- a/drivers/gpu/drm/udl/udl_drv.h +++ b/drivers/gpu/drm/udl/udl_drv.h | |||
@@ -121,6 +121,7 @@ struct udl_gem_object *udl_gem_alloc_object(struct drm_device *dev, | |||
121 | 121 | ||
122 | int udl_gem_vmap(struct udl_gem_object *obj); | 122 | int udl_gem_vmap(struct udl_gem_object *obj); |
123 | void udl_gem_vunmap(struct udl_gem_object *obj); | 123 | void udl_gem_vunmap(struct udl_gem_object *obj); |
124 | int udl_drm_gem_mmap(struct file *filp, struct vm_area_struct *vma); | ||
124 | int udl_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf); | 125 | int udl_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf); |
125 | 126 | ||
126 | int udl_handle_damage(struct udl_framebuffer *fb, int x, int y, | 127 | int udl_handle_damage(struct udl_framebuffer *fb, int x, int y, |
diff --git a/drivers/gpu/drm/udl/udl_gem.c b/drivers/gpu/drm/udl/udl_gem.c index 852642dc1187..92f19ef329b0 100644 --- a/drivers/gpu/drm/udl/udl_gem.c +++ b/drivers/gpu/drm/udl/udl_gem.c | |||
@@ -71,6 +71,20 @@ int udl_dumb_destroy(struct drm_file *file, struct drm_device *dev, | |||
71 | return drm_gem_handle_delete(file, handle); | 71 | return drm_gem_handle_delete(file, handle); |
72 | } | 72 | } |
73 | 73 | ||
74 | int udl_drm_gem_mmap(struct file *filp, struct vm_area_struct *vma) | ||
75 | { | ||
76 | int ret; | ||
77 | |||
78 | ret = drm_gem_mmap(filp, vma); | ||
79 | if (ret) | ||
80 | return ret; | ||
81 | |||
82 | vma->vm_flags &= ~VM_PFNMAP; | ||
83 | vma->vm_flags |= VM_MIXEDMAP; | ||
84 | |||
85 | return ret; | ||
86 | } | ||
87 | |||
74 | int udl_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf) | 88 | int udl_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf) |
75 | { | 89 | { |
76 | struct udl_gem_object *obj = to_udl_bo(vma->vm_private_data); | 90 | struct udl_gem_object *obj = to_udl_bo(vma->vm_private_data); |
diff --git a/drivers/hid/hid-picolcd.c b/drivers/hid/hid-picolcd.c index 12f9777c385d..45c3433f7986 100644 --- a/drivers/hid/hid-picolcd.c +++ b/drivers/hid/hid-picolcd.c | |||
@@ -1525,12 +1525,6 @@ static const struct file_operations picolcd_debug_reset_fops = { | |||
1525 | /* | 1525 | /* |
1526 | * The "eeprom" file | 1526 | * The "eeprom" file |
1527 | */ | 1527 | */ |
1528 | static int picolcd_debug_eeprom_open(struct inode *i, struct file *f) | ||
1529 | { | ||
1530 | f->private_data = i->i_private; | ||
1531 | return 0; | ||
1532 | } | ||
1533 | |||
1534 | static ssize_t picolcd_debug_eeprom_read(struct file *f, char __user *u, | 1528 | static ssize_t picolcd_debug_eeprom_read(struct file *f, char __user *u, |
1535 | size_t s, loff_t *off) | 1529 | size_t s, loff_t *off) |
1536 | { | 1530 | { |
@@ -1618,7 +1612,7 @@ static ssize_t picolcd_debug_eeprom_write(struct file *f, const char __user *u, | |||
1618 | */ | 1612 | */ |
1619 | static const struct file_operations picolcd_debug_eeprom_fops = { | 1613 | static const struct file_operations picolcd_debug_eeprom_fops = { |
1620 | .owner = THIS_MODULE, | 1614 | .owner = THIS_MODULE, |
1621 | .open = picolcd_debug_eeprom_open, | 1615 | .open = simple_open, |
1622 | .read = picolcd_debug_eeprom_read, | 1616 | .read = picolcd_debug_eeprom_read, |
1623 | .write = picolcd_debug_eeprom_write, | 1617 | .write = picolcd_debug_eeprom_write, |
1624 | .llseek = generic_file_llseek, | 1618 | .llseek = generic_file_llseek, |
@@ -1627,12 +1621,6 @@ static const struct file_operations picolcd_debug_eeprom_fops = { | |||
1627 | /* | 1621 | /* |
1628 | * The "flash" file | 1622 | * The "flash" file |
1629 | */ | 1623 | */ |
1630 | static int picolcd_debug_flash_open(struct inode *i, struct file *f) | ||
1631 | { | ||
1632 | f->private_data = i->i_private; | ||
1633 | return 0; | ||
1634 | } | ||
1635 | |||
1636 | /* record a flash address to buf (bounds check to be done by caller) */ | 1624 | /* record a flash address to buf (bounds check to be done by caller) */ |
1637 | static int _picolcd_flash_setaddr(struct picolcd_data *data, u8 *buf, long off) | 1625 | static int _picolcd_flash_setaddr(struct picolcd_data *data, u8 *buf, long off) |
1638 | { | 1626 | { |
@@ -1817,7 +1805,7 @@ static ssize_t picolcd_debug_flash_write(struct file *f, const char __user *u, | |||
1817 | */ | 1805 | */ |
1818 | static const struct file_operations picolcd_debug_flash_fops = { | 1806 | static const struct file_operations picolcd_debug_flash_fops = { |
1819 | .owner = THIS_MODULE, | 1807 | .owner = THIS_MODULE, |
1820 | .open = picolcd_debug_flash_open, | 1808 | .open = simple_open, |
1821 | .read = picolcd_debug_flash_read, | 1809 | .read = picolcd_debug_flash_read, |
1822 | .write = picolcd_debug_flash_write, | 1810 | .write = picolcd_debug_flash_write, |
1823 | .llseek = generic_file_llseek, | 1811 | .llseek = generic_file_llseek, |
diff --git a/drivers/hid/hid-wiimote-debug.c b/drivers/hid/hid-wiimote-debug.c index 17dabc1f339e..eec329197c16 100644 --- a/drivers/hid/hid-wiimote-debug.c +++ b/drivers/hid/hid-wiimote-debug.c | |||
@@ -23,12 +23,6 @@ struct wiimote_debug { | |||
23 | struct dentry *drm; | 23 | struct dentry *drm; |
24 | }; | 24 | }; |
25 | 25 | ||
26 | static int wiidebug_eeprom_open(struct inode *i, struct file *f) | ||
27 | { | ||
28 | f->private_data = i->i_private; | ||
29 | return 0; | ||
30 | } | ||
31 | |||
32 | static ssize_t wiidebug_eeprom_read(struct file *f, char __user *u, size_t s, | 26 | static ssize_t wiidebug_eeprom_read(struct file *f, char __user *u, size_t s, |
33 | loff_t *off) | 27 | loff_t *off) |
34 | { | 28 | { |
@@ -83,7 +77,7 @@ static ssize_t wiidebug_eeprom_read(struct file *f, char __user *u, size_t s, | |||
83 | 77 | ||
84 | static const struct file_operations wiidebug_eeprom_fops = { | 78 | static const struct file_operations wiidebug_eeprom_fops = { |
85 | .owner = THIS_MODULE, | 79 | .owner = THIS_MODULE, |
86 | .open = wiidebug_eeprom_open, | 80 | .open = simple_open, |
87 | .read = wiidebug_eeprom_read, | 81 | .read = wiidebug_eeprom_read, |
88 | .llseek = generic_file_llseek, | 82 | .llseek = generic_file_llseek, |
89 | }; | 83 | }; |
diff --git a/drivers/hsi/Kconfig b/drivers/hsi/Kconfig new file mode 100644 index 000000000000..d94e38dd80c7 --- /dev/null +++ b/drivers/hsi/Kconfig | |||
@@ -0,0 +1,19 @@ | |||
1 | # | ||
2 | # HSI driver configuration | ||
3 | # | ||
4 | menuconfig HSI | ||
5 | tristate "HSI support" | ||
6 | ---help--- | ||
7 | The "High speed synchronous Serial Interface" is | ||
8 | synchronous serial interface used mainly to connect | ||
9 | application engines and cellular modems. | ||
10 | |||
11 | if HSI | ||
12 | |||
13 | config HSI_BOARDINFO | ||
14 | bool | ||
15 | default y | ||
16 | |||
17 | source "drivers/hsi/clients/Kconfig" | ||
18 | |||
19 | endif # HSI | ||
diff --git a/drivers/hsi/Makefile b/drivers/hsi/Makefile new file mode 100644 index 000000000000..9d5d33f90de2 --- /dev/null +++ b/drivers/hsi/Makefile | |||
@@ -0,0 +1,6 @@ | |||
1 | # | ||
2 | # Makefile for HSI | ||
3 | # | ||
4 | obj-$(CONFIG_HSI_BOARDINFO) += hsi_boardinfo.o | ||
5 | obj-$(CONFIG_HSI) += hsi.o | ||
6 | obj-y += clients/ | ||
diff --git a/drivers/hsi/clients/Kconfig b/drivers/hsi/clients/Kconfig new file mode 100644 index 000000000000..3bacd275f479 --- /dev/null +++ b/drivers/hsi/clients/Kconfig | |||
@@ -0,0 +1,13 @@ | |||
1 | # | ||
2 | # HSI clients configuration | ||
3 | # | ||
4 | |||
5 | comment "HSI clients" | ||
6 | |||
7 | config HSI_CHAR | ||
8 | tristate "HSI/SSI character driver" | ||
9 | depends on HSI | ||
10 | ---help--- | ||
11 | If you say Y here, you will enable the HSI/SSI character driver. | ||
12 | This driver provides a simple character device interface for | ||
13 | serial communication with the cellular modem over HSI/SSI bus. | ||
diff --git a/drivers/hsi/clients/Makefile b/drivers/hsi/clients/Makefile new file mode 100644 index 000000000000..327c0e27c8b0 --- /dev/null +++ b/drivers/hsi/clients/Makefile | |||
@@ -0,0 +1,5 @@ | |||
1 | # | ||
2 | # Makefile for HSI clients | ||
3 | # | ||
4 | |||
5 | obj-$(CONFIG_HSI_CHAR) += hsi_char.o | ||
diff --git a/drivers/hsi/clients/hsi_char.c b/drivers/hsi/clients/hsi_char.c new file mode 100644 index 000000000000..88a050df2389 --- /dev/null +++ b/drivers/hsi/clients/hsi_char.c | |||
@@ -0,0 +1,802 @@ | |||
1 | /* | ||
2 | * HSI character device driver, implements the character device | ||
3 | * interface. | ||
4 | * | ||
5 | * Copyright (C) 2010 Nokia Corporation. All rights reserved. | ||
6 | * | ||
7 | * Contact: Andras Domokos <andras.domokos@nokia.com> | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or | ||
10 | * modify it under the terms of the GNU General Public License | ||
11 | * version 2 as published by the Free Software Foundation. | ||
12 | * | ||
13 | * This program is distributed in the hope that it will be useful, but | ||
14 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
16 | * General Public License for more details. | ||
17 | * | ||
18 | * You should have received a copy of the GNU General Public License | ||
19 | * along with this program; if not, write to the Free Software | ||
20 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | ||
21 | * 02110-1301 USA | ||
22 | */ | ||
23 | |||
24 | #include <linux/errno.h> | ||
25 | #include <linux/types.h> | ||
26 | #include <linux/atomic.h> | ||
27 | #include <linux/kernel.h> | ||
28 | #include <linux/init.h> | ||
29 | #include <linux/module.h> | ||
30 | #include <linux/mutex.h> | ||
31 | #include <linux/list.h> | ||
32 | #include <linux/slab.h> | ||
33 | #include <linux/kmemleak.h> | ||
34 | #include <linux/ioctl.h> | ||
35 | #include <linux/wait.h> | ||
36 | #include <linux/fs.h> | ||
37 | #include <linux/sched.h> | ||
38 | #include <linux/device.h> | ||
39 | #include <linux/cdev.h> | ||
40 | #include <linux/uaccess.h> | ||
41 | #include <linux/scatterlist.h> | ||
42 | #include <linux/stat.h> | ||
43 | #include <linux/hsi/hsi.h> | ||
44 | #include <linux/hsi/hsi_char.h> | ||
45 | |||
46 | #define HSC_DEVS 16 /* Num of channels */ | ||
47 | #define HSC_MSGS 4 | ||
48 | |||
49 | #define HSC_RXBREAK 0 | ||
50 | |||
51 | #define HSC_ID_BITS 6 | ||
52 | #define HSC_PORT_ID_BITS 4 | ||
53 | #define HSC_ID_MASK 3 | ||
54 | #define HSC_PORT_ID_MASK 3 | ||
55 | #define HSC_CH_MASK 0xf | ||
56 | |||
57 | /* | ||
58 | * We support up to 4 controllers that can have up to 4 | ||
59 | * ports, which should currently be more than enough. | ||
60 | */ | ||
61 | #define HSC_BASEMINOR(id, port_id) \ | ||
62 | ((((id) & HSC_ID_MASK) << HSC_ID_BITS) | \ | ||
63 | (((port_id) & HSC_PORT_ID_MASK) << HSC_PORT_ID_BITS)) | ||
64 | |||
65 | enum { | ||
66 | HSC_CH_OPEN, | ||
67 | HSC_CH_READ, | ||
68 | HSC_CH_WRITE, | ||
69 | HSC_CH_WLINE, | ||
70 | }; | ||
71 | |||
72 | enum { | ||
73 | HSC_RX, | ||
74 | HSC_TX, | ||
75 | }; | ||
76 | |||
77 | struct hsc_client_data; | ||
78 | /** | ||
79 | * struct hsc_channel - hsi_char internal channel data | ||
80 | * @ch: channel number | ||
81 | * @flags: Keeps state of the channel (open/close, reading, writing) | ||
82 | * @free_msgs_list: List of free HSI messages/requests | ||
83 | * @rx_msgs_queue: List of pending RX requests | ||
84 | * @tx_msgs_queue: List of pending TX requests | ||
85 | * @lock: Serialize access to the lists | ||
86 | * @cl: reference to the associated hsi_client | ||
87 | * @cl_data: reference to the client data that this channels belongs to | ||
88 | * @rx_wait: RX requests wait queue | ||
89 | * @tx_wait: TX requests wait queue | ||
90 | */ | ||
91 | struct hsc_channel { | ||
92 | unsigned int ch; | ||
93 | unsigned long flags; | ||
94 | struct list_head free_msgs_list; | ||
95 | struct list_head rx_msgs_queue; | ||
96 | struct list_head tx_msgs_queue; | ||
97 | spinlock_t lock; | ||
98 | struct hsi_client *cl; | ||
99 | struct hsc_client_data *cl_data; | ||
100 | wait_queue_head_t rx_wait; | ||
101 | wait_queue_head_t tx_wait; | ||
102 | }; | ||
103 | |||
104 | /** | ||
105 | * struct hsc_client_data - hsi_char internal client data | ||
106 | * @cdev: Characther device associated to the hsi_client | ||
107 | * @lock: Lock to serialize open/close access | ||
108 | * @flags: Keeps track of port state (rx hwbreak armed) | ||
109 | * @usecnt: Use count for claiming the HSI port (mutex protected) | ||
110 | * @cl: Referece to the HSI client | ||
111 | * @channels: Array of channels accessible by the client | ||
112 | */ | ||
113 | struct hsc_client_data { | ||
114 | struct cdev cdev; | ||
115 | struct mutex lock; | ||
116 | unsigned long flags; | ||
117 | unsigned int usecnt; | ||
118 | struct hsi_client *cl; | ||
119 | struct hsc_channel channels[HSC_DEVS]; | ||
120 | }; | ||
121 | |||
122 | /* Stores the major number dynamically allocated for hsi_char */ | ||
123 | static unsigned int hsc_major; | ||
124 | /* Maximum buffer size that hsi_char will accept from userspace */ | ||
125 | static unsigned int max_data_size = 0x1000; | ||
126 | module_param(max_data_size, uint, S_IRUSR | S_IWUSR); | ||
127 | MODULE_PARM_DESC(max_data_size, "max read/write data size [4,8..65536] (^2)"); | ||
128 | |||
129 | static void hsc_add_tail(struct hsc_channel *channel, struct hsi_msg *msg, | ||
130 | struct list_head *queue) | ||
131 | { | ||
132 | unsigned long flags; | ||
133 | |||
134 | spin_lock_irqsave(&channel->lock, flags); | ||
135 | list_add_tail(&msg->link, queue); | ||
136 | spin_unlock_irqrestore(&channel->lock, flags); | ||
137 | } | ||
138 | |||
139 | static struct hsi_msg *hsc_get_first_msg(struct hsc_channel *channel, | ||
140 | struct list_head *queue) | ||
141 | { | ||
142 | struct hsi_msg *msg = NULL; | ||
143 | unsigned long flags; | ||
144 | |||
145 | spin_lock_irqsave(&channel->lock, flags); | ||
146 | |||
147 | if (list_empty(queue)) | ||
148 | goto out; | ||
149 | |||
150 | msg = list_first_entry(queue, struct hsi_msg, link); | ||
151 | list_del(&msg->link); | ||
152 | out: | ||
153 | spin_unlock_irqrestore(&channel->lock, flags); | ||
154 | |||
155 | return msg; | ||
156 | } | ||
157 | |||
158 | static inline void hsc_msg_free(struct hsi_msg *msg) | ||
159 | { | ||
160 | kfree(sg_virt(msg->sgt.sgl)); | ||
161 | hsi_free_msg(msg); | ||
162 | } | ||
163 | |||
164 | static void hsc_free_list(struct list_head *list) | ||
165 | { | ||
166 | struct hsi_msg *msg, *tmp; | ||
167 | |||
168 | list_for_each_entry_safe(msg, tmp, list, link) { | ||
169 | list_del(&msg->link); | ||
170 | hsc_msg_free(msg); | ||
171 | } | ||
172 | } | ||
173 | |||
174 | static void hsc_reset_list(struct hsc_channel *channel, struct list_head *l) | ||
175 | { | ||
176 | unsigned long flags; | ||
177 | LIST_HEAD(list); | ||
178 | |||
179 | spin_lock_irqsave(&channel->lock, flags); | ||
180 | list_splice_init(l, &list); | ||
181 | spin_unlock_irqrestore(&channel->lock, flags); | ||
182 | |||
183 | hsc_free_list(&list); | ||
184 | } | ||
185 | |||
186 | static inline struct hsi_msg *hsc_msg_alloc(unsigned int alloc_size) | ||
187 | { | ||
188 | struct hsi_msg *msg; | ||
189 | void *buf; | ||
190 | |||
191 | msg = hsi_alloc_msg(1, GFP_KERNEL); | ||
192 | if (!msg) | ||
193 | goto out; | ||
194 | buf = kmalloc(alloc_size, GFP_KERNEL); | ||
195 | if (!buf) { | ||
196 | hsi_free_msg(msg); | ||
197 | goto out; | ||
198 | } | ||
199 | sg_init_one(msg->sgt.sgl, buf, alloc_size); | ||
200 | /* Ignore false positive, due to sg pointer handling */ | ||
201 | kmemleak_ignore(buf); | ||
202 | |||
203 | return msg; | ||
204 | out: | ||
205 | return NULL; | ||
206 | } | ||
207 | |||
208 | static inline int hsc_msgs_alloc(struct hsc_channel *channel) | ||
209 | { | ||
210 | struct hsi_msg *msg; | ||
211 | int i; | ||
212 | |||
213 | for (i = 0; i < HSC_MSGS; i++) { | ||
214 | msg = hsc_msg_alloc(max_data_size); | ||
215 | if (!msg) | ||
216 | goto out; | ||
217 | msg->channel = channel->ch; | ||
218 | list_add_tail(&msg->link, &channel->free_msgs_list); | ||
219 | } | ||
220 | |||
221 | return 0; | ||
222 | out: | ||
223 | hsc_free_list(&channel->free_msgs_list); | ||
224 | |||
225 | return -ENOMEM; | ||
226 | } | ||
227 | |||
228 | static inline unsigned int hsc_msg_len_get(struct hsi_msg *msg) | ||
229 | { | ||
230 | return msg->sgt.sgl->length; | ||
231 | } | ||
232 | |||
233 | static inline void hsc_msg_len_set(struct hsi_msg *msg, unsigned int len) | ||
234 | { | ||
235 | msg->sgt.sgl->length = len; | ||
236 | } | ||
237 | |||
238 | static void hsc_rx_completed(struct hsi_msg *msg) | ||
239 | { | ||
240 | struct hsc_client_data *cl_data = hsi_client_drvdata(msg->cl); | ||
241 | struct hsc_channel *channel = cl_data->channels + msg->channel; | ||
242 | |||
243 | if (test_bit(HSC_CH_READ, &channel->flags)) { | ||
244 | hsc_add_tail(channel, msg, &channel->rx_msgs_queue); | ||
245 | wake_up(&channel->rx_wait); | ||
246 | } else { | ||
247 | hsc_add_tail(channel, msg, &channel->free_msgs_list); | ||
248 | } | ||
249 | } | ||
250 | |||
251 | static void hsc_rx_msg_destructor(struct hsi_msg *msg) | ||
252 | { | ||
253 | msg->status = HSI_STATUS_ERROR; | ||
254 | hsc_msg_len_set(msg, 0); | ||
255 | hsc_rx_completed(msg); | ||
256 | } | ||
257 | |||
258 | static void hsc_tx_completed(struct hsi_msg *msg) | ||
259 | { | ||
260 | struct hsc_client_data *cl_data = hsi_client_drvdata(msg->cl); | ||
261 | struct hsc_channel *channel = cl_data->channels + msg->channel; | ||
262 | |||
263 | if (test_bit(HSC_CH_WRITE, &channel->flags)) { | ||
264 | hsc_add_tail(channel, msg, &channel->tx_msgs_queue); | ||
265 | wake_up(&channel->tx_wait); | ||
266 | } else { | ||
267 | hsc_add_tail(channel, msg, &channel->free_msgs_list); | ||
268 | } | ||
269 | } | ||
270 | |||
271 | static void hsc_tx_msg_destructor(struct hsi_msg *msg) | ||
272 | { | ||
273 | msg->status = HSI_STATUS_ERROR; | ||
274 | hsc_msg_len_set(msg, 0); | ||
275 | hsc_tx_completed(msg); | ||
276 | } | ||
277 | |||
278 | static void hsc_break_req_destructor(struct hsi_msg *msg) | ||
279 | { | ||
280 | struct hsc_client_data *cl_data = hsi_client_drvdata(msg->cl); | ||
281 | |||
282 | hsi_free_msg(msg); | ||
283 | clear_bit(HSC_RXBREAK, &cl_data->flags); | ||
284 | } | ||
285 | |||
286 | static void hsc_break_received(struct hsi_msg *msg) | ||
287 | { | ||
288 | struct hsc_client_data *cl_data = hsi_client_drvdata(msg->cl); | ||
289 | struct hsc_channel *channel = cl_data->channels; | ||
290 | int i, ret; | ||
291 | |||
292 | /* Broadcast HWBREAK on all channels */ | ||
293 | for (i = 0; i < HSC_DEVS; i++, channel++) { | ||
294 | struct hsi_msg *msg2; | ||
295 | |||
296 | if (!test_bit(HSC_CH_READ, &channel->flags)) | ||
297 | continue; | ||
298 | msg2 = hsc_get_first_msg(channel, &channel->free_msgs_list); | ||
299 | if (!msg2) | ||
300 | continue; | ||
301 | clear_bit(HSC_CH_READ, &channel->flags); | ||
302 | hsc_msg_len_set(msg2, 0); | ||
303 | msg2->status = HSI_STATUS_COMPLETED; | ||
304 | hsc_add_tail(channel, msg2, &channel->rx_msgs_queue); | ||
305 | wake_up(&channel->rx_wait); | ||
306 | } | ||
307 | hsi_flush(msg->cl); | ||
308 | ret = hsi_async_read(msg->cl, msg); | ||
309 | if (ret < 0) | ||
310 | hsc_break_req_destructor(msg); | ||
311 | } | ||
312 | |||
313 | static int hsc_break_request(struct hsi_client *cl) | ||
314 | { | ||
315 | struct hsc_client_data *cl_data = hsi_client_drvdata(cl); | ||
316 | struct hsi_msg *msg; | ||
317 | int ret; | ||
318 | |||
319 | if (test_and_set_bit(HSC_RXBREAK, &cl_data->flags)) | ||
320 | return -EBUSY; | ||
321 | |||
322 | msg = hsi_alloc_msg(0, GFP_KERNEL); | ||
323 | if (!msg) { | ||
324 | clear_bit(HSC_RXBREAK, &cl_data->flags); | ||
325 | return -ENOMEM; | ||
326 | } | ||
327 | msg->break_frame = 1; | ||
328 | msg->complete = hsc_break_received; | ||
329 | msg->destructor = hsc_break_req_destructor; | ||
330 | ret = hsi_async_read(cl, msg); | ||
331 | if (ret < 0) | ||
332 | hsc_break_req_destructor(msg); | ||
333 | |||
334 | return ret; | ||
335 | } | ||
336 | |||
337 | static int hsc_break_send(struct hsi_client *cl) | ||
338 | { | ||
339 | struct hsi_msg *msg; | ||
340 | int ret; | ||
341 | |||
342 | msg = hsi_alloc_msg(0, GFP_ATOMIC); | ||
343 | if (!msg) | ||
344 | return -ENOMEM; | ||
345 | msg->break_frame = 1; | ||
346 | msg->complete = hsi_free_msg; | ||
347 | msg->destructor = hsi_free_msg; | ||
348 | ret = hsi_async_write(cl, msg); | ||
349 | if (ret < 0) | ||
350 | hsi_free_msg(msg); | ||
351 | |||
352 | return ret; | ||
353 | } | ||
354 | |||
355 | static int hsc_rx_set(struct hsi_client *cl, struct hsc_rx_config *rxc) | ||
356 | { | ||
357 | struct hsi_config tmp; | ||
358 | int ret; | ||
359 | |||
360 | if ((rxc->mode != HSI_MODE_STREAM) && (rxc->mode != HSI_MODE_FRAME)) | ||
361 | return -EINVAL; | ||
362 | if ((rxc->channels == 0) || (rxc->channels > HSC_DEVS)) | ||
363 | return -EINVAL; | ||
364 | if (rxc->channels & (rxc->channels - 1)) | ||
365 | return -EINVAL; | ||
366 | if ((rxc->flow != HSI_FLOW_SYNC) && (rxc->flow != HSI_FLOW_PIPE)) | ||
367 | return -EINVAL; | ||
368 | tmp = cl->rx_cfg; | ||
369 | cl->rx_cfg.mode = rxc->mode; | ||
370 | cl->rx_cfg.channels = rxc->channels; | ||
371 | cl->rx_cfg.flow = rxc->flow; | ||
372 | ret = hsi_setup(cl); | ||
373 | if (ret < 0) { | ||
374 | cl->rx_cfg = tmp; | ||
375 | return ret; | ||
376 | } | ||
377 | if (rxc->mode == HSI_MODE_FRAME) | ||
378 | hsc_break_request(cl); | ||
379 | |||
380 | return ret; | ||
381 | } | ||
382 | |||
383 | static inline void hsc_rx_get(struct hsi_client *cl, struct hsc_rx_config *rxc) | ||
384 | { | ||
385 | rxc->mode = cl->rx_cfg.mode; | ||
386 | rxc->channels = cl->rx_cfg.channels; | ||
387 | rxc->flow = cl->rx_cfg.flow; | ||
388 | } | ||
389 | |||
390 | static int hsc_tx_set(struct hsi_client *cl, struct hsc_tx_config *txc) | ||
391 | { | ||
392 | struct hsi_config tmp; | ||
393 | int ret; | ||
394 | |||
395 | if ((txc->mode != HSI_MODE_STREAM) && (txc->mode != HSI_MODE_FRAME)) | ||
396 | return -EINVAL; | ||
397 | if ((txc->channels == 0) || (txc->channels > HSC_DEVS)) | ||
398 | return -EINVAL; | ||
399 | if (txc->channels & (txc->channels - 1)) | ||
400 | return -EINVAL; | ||
401 | if ((txc->arb_mode != HSI_ARB_RR) && (txc->arb_mode != HSI_ARB_PRIO)) | ||
402 | return -EINVAL; | ||
403 | tmp = cl->tx_cfg; | ||
404 | cl->tx_cfg.mode = txc->mode; | ||
405 | cl->tx_cfg.channels = txc->channels; | ||
406 | cl->tx_cfg.speed = txc->speed; | ||
407 | cl->tx_cfg.arb_mode = txc->arb_mode; | ||
408 | ret = hsi_setup(cl); | ||
409 | if (ret < 0) { | ||
410 | cl->tx_cfg = tmp; | ||
411 | return ret; | ||
412 | } | ||
413 | |||
414 | return ret; | ||
415 | } | ||
416 | |||
417 | static inline void hsc_tx_get(struct hsi_client *cl, struct hsc_tx_config *txc) | ||
418 | { | ||
419 | txc->mode = cl->tx_cfg.mode; | ||
420 | txc->channels = cl->tx_cfg.channels; | ||
421 | txc->speed = cl->tx_cfg.speed; | ||
422 | txc->arb_mode = cl->tx_cfg.arb_mode; | ||
423 | } | ||
424 | |||
425 | static ssize_t hsc_read(struct file *file, char __user *buf, size_t len, | ||
426 | loff_t *ppos __maybe_unused) | ||
427 | { | ||
428 | struct hsc_channel *channel = file->private_data; | ||
429 | struct hsi_msg *msg; | ||
430 | ssize_t ret; | ||
431 | |||
432 | if (len == 0) | ||
433 | return 0; | ||
434 | if (!IS_ALIGNED(len, sizeof(u32))) | ||
435 | return -EINVAL; | ||
436 | if (len > max_data_size) | ||
437 | len = max_data_size; | ||
438 | if (channel->ch >= channel->cl->rx_cfg.channels) | ||
439 | return -ECHRNG; | ||
440 | if (test_and_set_bit(HSC_CH_READ, &channel->flags)) | ||
441 | return -EBUSY; | ||
442 | msg = hsc_get_first_msg(channel, &channel->free_msgs_list); | ||
443 | if (!msg) { | ||
444 | ret = -ENOSPC; | ||
445 | goto out; | ||
446 | } | ||
447 | hsc_msg_len_set(msg, len); | ||
448 | msg->complete = hsc_rx_completed; | ||
449 | msg->destructor = hsc_rx_msg_destructor; | ||
450 | ret = hsi_async_read(channel->cl, msg); | ||
451 | if (ret < 0) { | ||
452 | hsc_add_tail(channel, msg, &channel->free_msgs_list); | ||
453 | goto out; | ||
454 | } | ||
455 | |||
456 | ret = wait_event_interruptible(channel->rx_wait, | ||
457 | !list_empty(&channel->rx_msgs_queue)); | ||
458 | if (ret < 0) { | ||
459 | clear_bit(HSC_CH_READ, &channel->flags); | ||
460 | hsi_flush(channel->cl); | ||
461 | return -EINTR; | ||
462 | } | ||
463 | |||
464 | msg = hsc_get_first_msg(channel, &channel->rx_msgs_queue); | ||
465 | if (msg) { | ||
466 | if (msg->status != HSI_STATUS_ERROR) { | ||
467 | ret = copy_to_user((void __user *)buf, | ||
468 | sg_virt(msg->sgt.sgl), hsc_msg_len_get(msg)); | ||
469 | if (ret) | ||
470 | ret = -EFAULT; | ||
471 | else | ||
472 | ret = hsc_msg_len_get(msg); | ||
473 | } else { | ||
474 | ret = -EIO; | ||
475 | } | ||
476 | hsc_add_tail(channel, msg, &channel->free_msgs_list); | ||
477 | } | ||
478 | out: | ||
479 | clear_bit(HSC_CH_READ, &channel->flags); | ||
480 | |||
481 | return ret; | ||
482 | } | ||
483 | |||
484 | static ssize_t hsc_write(struct file *file, const char __user *buf, size_t len, | ||
485 | loff_t *ppos __maybe_unused) | ||
486 | { | ||
487 | struct hsc_channel *channel = file->private_data; | ||
488 | struct hsi_msg *msg; | ||
489 | ssize_t ret; | ||
490 | |||
491 | if ((len == 0) || !IS_ALIGNED(len, sizeof(u32))) | ||
492 | return -EINVAL; | ||
493 | if (len > max_data_size) | ||
494 | len = max_data_size; | ||
495 | if (channel->ch >= channel->cl->tx_cfg.channels) | ||
496 | return -ECHRNG; | ||
497 | if (test_and_set_bit(HSC_CH_WRITE, &channel->flags)) | ||
498 | return -EBUSY; | ||
499 | msg = hsc_get_first_msg(channel, &channel->free_msgs_list); | ||
500 | if (!msg) { | ||
501 | clear_bit(HSC_CH_WRITE, &channel->flags); | ||
502 | return -ENOSPC; | ||
503 | } | ||
504 | if (copy_from_user(sg_virt(msg->sgt.sgl), (void __user *)buf, len)) { | ||
505 | ret = -EFAULT; | ||
506 | goto out; | ||
507 | } | ||
508 | hsc_msg_len_set(msg, len); | ||
509 | msg->complete = hsc_tx_completed; | ||
510 | msg->destructor = hsc_tx_msg_destructor; | ||
511 | ret = hsi_async_write(channel->cl, msg); | ||
512 | if (ret < 0) | ||
513 | goto out; | ||
514 | |||
515 | ret = wait_event_interruptible(channel->tx_wait, | ||
516 | !list_empty(&channel->tx_msgs_queue)); | ||
517 | if (ret < 0) { | ||
518 | clear_bit(HSC_CH_WRITE, &channel->flags); | ||
519 | hsi_flush(channel->cl); | ||
520 | return -EINTR; | ||
521 | } | ||
522 | |||
523 | msg = hsc_get_first_msg(channel, &channel->tx_msgs_queue); | ||
524 | if (msg) { | ||
525 | if (msg->status == HSI_STATUS_ERROR) | ||
526 | ret = -EIO; | ||
527 | else | ||
528 | ret = hsc_msg_len_get(msg); | ||
529 | |||
530 | hsc_add_tail(channel, msg, &channel->free_msgs_list); | ||
531 | } | ||
532 | out: | ||
533 | clear_bit(HSC_CH_WRITE, &channel->flags); | ||
534 | |||
535 | return ret; | ||
536 | } | ||
537 | |||
538 | static long hsc_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | ||
539 | { | ||
540 | struct hsc_channel *channel = file->private_data; | ||
541 | unsigned int state; | ||
542 | struct hsc_rx_config rxc; | ||
543 | struct hsc_tx_config txc; | ||
544 | long ret = 0; | ||
545 | |||
546 | switch (cmd) { | ||
547 | case HSC_RESET: | ||
548 | hsi_flush(channel->cl); | ||
549 | break; | ||
550 | case HSC_SET_PM: | ||
551 | if (copy_from_user(&state, (void __user *)arg, sizeof(state))) | ||
552 | return -EFAULT; | ||
553 | if (state == HSC_PM_DISABLE) { | ||
554 | if (test_and_set_bit(HSC_CH_WLINE, &channel->flags)) | ||
555 | return -EINVAL; | ||
556 | ret = hsi_start_tx(channel->cl); | ||
557 | } else if (state == HSC_PM_ENABLE) { | ||
558 | if (!test_and_clear_bit(HSC_CH_WLINE, &channel->flags)) | ||
559 | return -EINVAL; | ||
560 | ret = hsi_stop_tx(channel->cl); | ||
561 | } else { | ||
562 | ret = -EINVAL; | ||
563 | } | ||
564 | break; | ||
565 | case HSC_SEND_BREAK: | ||
566 | return hsc_break_send(channel->cl); | ||
567 | case HSC_SET_RX: | ||
568 | if (copy_from_user(&rxc, (void __user *)arg, sizeof(rxc))) | ||
569 | return -EFAULT; | ||
570 | return hsc_rx_set(channel->cl, &rxc); | ||
571 | case HSC_GET_RX: | ||
572 | hsc_rx_get(channel->cl, &rxc); | ||
573 | if (copy_to_user((void __user *)arg, &rxc, sizeof(rxc))) | ||
574 | return -EFAULT; | ||
575 | break; | ||
576 | case HSC_SET_TX: | ||
577 | if (copy_from_user(&txc, (void __user *)arg, sizeof(txc))) | ||
578 | return -EFAULT; | ||
579 | return hsc_tx_set(channel->cl, &txc); | ||
580 | case HSC_GET_TX: | ||
581 | hsc_tx_get(channel->cl, &txc); | ||
582 | if (copy_to_user((void __user *)arg, &txc, sizeof(txc))) | ||
583 | return -EFAULT; | ||
584 | break; | ||
585 | default: | ||
586 | return -ENOIOCTLCMD; | ||
587 | } | ||
588 | |||
589 | return ret; | ||
590 | } | ||
591 | |||
592 | static inline void __hsc_port_release(struct hsc_client_data *cl_data) | ||
593 | { | ||
594 | BUG_ON(cl_data->usecnt == 0); | ||
595 | |||
596 | if (--cl_data->usecnt == 0) { | ||
597 | hsi_flush(cl_data->cl); | ||
598 | hsi_release_port(cl_data->cl); | ||
599 | } | ||
600 | } | ||
601 | |||
602 | static int hsc_open(struct inode *inode, struct file *file) | ||
603 | { | ||
604 | struct hsc_client_data *cl_data; | ||
605 | struct hsc_channel *channel; | ||
606 | int ret = 0; | ||
607 | |||
608 | pr_debug("open, minor = %d\n", iminor(inode)); | ||
609 | |||
610 | cl_data = container_of(inode->i_cdev, struct hsc_client_data, cdev); | ||
611 | mutex_lock(&cl_data->lock); | ||
612 | channel = cl_data->channels + (iminor(inode) & HSC_CH_MASK); | ||
613 | |||
614 | if (test_and_set_bit(HSC_CH_OPEN, &channel->flags)) { | ||
615 | ret = -EBUSY; | ||
616 | goto out; | ||
617 | } | ||
618 | /* | ||
619 | * Check if we have already claimed the port associated to the HSI | ||
620 | * client. If not then try to claim it, else increase its refcount | ||
621 | */ | ||
622 | if (cl_data->usecnt == 0) { | ||
623 | ret = hsi_claim_port(cl_data->cl, 0); | ||
624 | if (ret < 0) | ||
625 | goto out; | ||
626 | hsi_setup(cl_data->cl); | ||
627 | } | ||
628 | cl_data->usecnt++; | ||
629 | |||
630 | ret = hsc_msgs_alloc(channel); | ||
631 | if (ret < 0) { | ||
632 | __hsc_port_release(cl_data); | ||
633 | goto out; | ||
634 | } | ||
635 | |||
636 | file->private_data = channel; | ||
637 | mutex_unlock(&cl_data->lock); | ||
638 | |||
639 | return ret; | ||
640 | out: | ||
641 | mutex_unlock(&cl_data->lock); | ||
642 | |||
643 | return ret; | ||
644 | } | ||
645 | |||
646 | static int hsc_release(struct inode *inode __maybe_unused, struct file *file) | ||
647 | { | ||
648 | struct hsc_channel *channel = file->private_data; | ||
649 | struct hsc_client_data *cl_data = channel->cl_data; | ||
650 | |||
651 | mutex_lock(&cl_data->lock); | ||
652 | file->private_data = NULL; | ||
653 | if (test_and_clear_bit(HSC_CH_WLINE, &channel->flags)) | ||
654 | hsi_stop_tx(channel->cl); | ||
655 | __hsc_port_release(cl_data); | ||
656 | hsc_reset_list(channel, &channel->rx_msgs_queue); | ||
657 | hsc_reset_list(channel, &channel->tx_msgs_queue); | ||
658 | hsc_reset_list(channel, &channel->free_msgs_list); | ||
659 | clear_bit(HSC_CH_READ, &channel->flags); | ||
660 | clear_bit(HSC_CH_WRITE, &channel->flags); | ||
661 | clear_bit(HSC_CH_OPEN, &channel->flags); | ||
662 | wake_up(&channel->rx_wait); | ||
663 | wake_up(&channel->tx_wait); | ||
664 | mutex_unlock(&cl_data->lock); | ||
665 | |||
666 | return 0; | ||
667 | } | ||
668 | |||
669 | static const struct file_operations hsc_fops = { | ||
670 | .owner = THIS_MODULE, | ||
671 | .read = hsc_read, | ||
672 | .write = hsc_write, | ||
673 | .unlocked_ioctl = hsc_ioctl, | ||
674 | .open = hsc_open, | ||
675 | .release = hsc_release, | ||
676 | }; | ||
677 | |||
678 | static void __devinit hsc_channel_init(struct hsc_channel *channel) | ||
679 | { | ||
680 | init_waitqueue_head(&channel->rx_wait); | ||
681 | init_waitqueue_head(&channel->tx_wait); | ||
682 | spin_lock_init(&channel->lock); | ||
683 | INIT_LIST_HEAD(&channel->free_msgs_list); | ||
684 | INIT_LIST_HEAD(&channel->rx_msgs_queue); | ||
685 | INIT_LIST_HEAD(&channel->tx_msgs_queue); | ||
686 | } | ||
687 | |||
688 | static int __devinit hsc_probe(struct device *dev) | ||
689 | { | ||
690 | const char devname[] = "hsi_char"; | ||
691 | struct hsc_client_data *cl_data; | ||
692 | struct hsc_channel *channel; | ||
693 | struct hsi_client *cl = to_hsi_client(dev); | ||
694 | unsigned int hsc_baseminor; | ||
695 | dev_t hsc_dev; | ||
696 | int ret; | ||
697 | int i; | ||
698 | |||
699 | cl_data = kzalloc(sizeof(*cl_data), GFP_KERNEL); | ||
700 | if (!cl_data) { | ||
701 | dev_err(dev, "Could not allocate hsc_client_data\n"); | ||
702 | return -ENOMEM; | ||
703 | } | ||
704 | hsc_baseminor = HSC_BASEMINOR(hsi_id(cl), hsi_port_id(cl)); | ||
705 | if (!hsc_major) { | ||
706 | ret = alloc_chrdev_region(&hsc_dev, hsc_baseminor, | ||
707 | HSC_DEVS, devname); | ||
708 | if (ret > 0) | ||
709 | hsc_major = MAJOR(hsc_dev); | ||
710 | } else { | ||
711 | hsc_dev = MKDEV(hsc_major, hsc_baseminor); | ||
712 | ret = register_chrdev_region(hsc_dev, HSC_DEVS, devname); | ||
713 | } | ||
714 | if (ret < 0) { | ||
715 | dev_err(dev, "Device %s allocation failed %d\n", | ||
716 | hsc_major ? "minor" : "major", ret); | ||
717 | goto out1; | ||
718 | } | ||
719 | mutex_init(&cl_data->lock); | ||
720 | hsi_client_set_drvdata(cl, cl_data); | ||
721 | cdev_init(&cl_data->cdev, &hsc_fops); | ||
722 | cl_data->cdev.owner = THIS_MODULE; | ||
723 | cl_data->cl = cl; | ||
724 | for (i = 0, channel = cl_data->channels; i < HSC_DEVS; i++, channel++) { | ||
725 | hsc_channel_init(channel); | ||
726 | channel->ch = i; | ||
727 | channel->cl = cl; | ||
728 | channel->cl_data = cl_data; | ||
729 | } | ||
730 | |||
731 | /* 1 hsi client -> N char devices (one for each channel) */ | ||
732 | ret = cdev_add(&cl_data->cdev, hsc_dev, HSC_DEVS); | ||
733 | if (ret) { | ||
734 | dev_err(dev, "Could not add char device %d\n", ret); | ||
735 | goto out2; | ||
736 | } | ||
737 | |||
738 | return 0; | ||
739 | out2: | ||
740 | unregister_chrdev_region(hsc_dev, HSC_DEVS); | ||
741 | out1: | ||
742 | kfree(cl_data); | ||
743 | |||
744 | return ret; | ||
745 | } | ||
746 | |||
747 | static int __devexit hsc_remove(struct device *dev) | ||
748 | { | ||
749 | struct hsi_client *cl = to_hsi_client(dev); | ||
750 | struct hsc_client_data *cl_data = hsi_client_drvdata(cl); | ||
751 | dev_t hsc_dev = cl_data->cdev.dev; | ||
752 | |||
753 | cdev_del(&cl_data->cdev); | ||
754 | unregister_chrdev_region(hsc_dev, HSC_DEVS); | ||
755 | hsi_client_set_drvdata(cl, NULL); | ||
756 | kfree(cl_data); | ||
757 | |||
758 | return 0; | ||
759 | } | ||
760 | |||
761 | static struct hsi_client_driver hsc_driver = { | ||
762 | .driver = { | ||
763 | .name = "hsi_char", | ||
764 | .owner = THIS_MODULE, | ||
765 | .probe = hsc_probe, | ||
766 | .remove = __devexit_p(hsc_remove), | ||
767 | }, | ||
768 | }; | ||
769 | |||
770 | static int __init hsc_init(void) | ||
771 | { | ||
772 | int ret; | ||
773 | |||
774 | if ((max_data_size < 4) || (max_data_size > 0x10000) || | ||
775 | (max_data_size & (max_data_size - 1))) { | ||
776 | pr_err("Invalid max read/write data size"); | ||
777 | return -EINVAL; | ||
778 | } | ||
779 | |||
780 | ret = hsi_register_client_driver(&hsc_driver); | ||
781 | if (ret) { | ||
782 | pr_err("Error while registering HSI/SSI driver %d", ret); | ||
783 | return ret; | ||
784 | } | ||
785 | |||
786 | pr_info("HSI/SSI char device loaded\n"); | ||
787 | |||
788 | return 0; | ||
789 | } | ||
790 | module_init(hsc_init); | ||
791 | |||
792 | static void __exit hsc_exit(void) | ||
793 | { | ||
794 | hsi_unregister_client_driver(&hsc_driver); | ||
795 | pr_info("HSI char device removed\n"); | ||
796 | } | ||
797 | module_exit(hsc_exit); | ||
798 | |||
799 | MODULE_AUTHOR("Andras Domokos <andras.domokos@nokia.com>"); | ||
800 | MODULE_ALIAS("hsi:hsi_char"); | ||
801 | MODULE_DESCRIPTION("HSI character device"); | ||
802 | MODULE_LICENSE("GPL v2"); | ||
diff --git a/drivers/hsi/hsi.c b/drivers/hsi/hsi.c new file mode 100644 index 000000000000..4e2d79b79334 --- /dev/null +++ b/drivers/hsi/hsi.c | |||
@@ -0,0 +1,494 @@ | |||
1 | /* | ||
2 | * HSI core. | ||
3 | * | ||
4 | * Copyright (C) 2010 Nokia Corporation. All rights reserved. | ||
5 | * | ||
6 | * Contact: Carlos Chinea <carlos.chinea@nokia.com> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or | ||
9 | * modify it under the terms of the GNU General Public License | ||
10 | * version 2 as published by the Free Software Foundation. | ||
11 | * | ||
12 | * This program is distributed in the hope that it will be useful, but | ||
13 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
15 | * General Public License for more details. | ||
16 | * | ||
17 | * You should have received a copy of the GNU General Public License | ||
18 | * along with this program; if not, write to the Free Software | ||
19 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | ||
20 | * 02110-1301 USA | ||
21 | */ | ||
22 | #include <linux/hsi/hsi.h> | ||
23 | #include <linux/compiler.h> | ||
24 | #include <linux/rwsem.h> | ||
25 | #include <linux/list.h> | ||
26 | #include <linux/spinlock.h> | ||
27 | #include <linux/kobject.h> | ||
28 | #include <linux/slab.h> | ||
29 | #include <linux/string.h> | ||
30 | #include "hsi_core.h" | ||
31 | |||
32 | static struct device_type hsi_ctrl = { | ||
33 | .name = "hsi_controller", | ||
34 | }; | ||
35 | |||
36 | static struct device_type hsi_cl = { | ||
37 | .name = "hsi_client", | ||
38 | }; | ||
39 | |||
40 | static struct device_type hsi_port = { | ||
41 | .name = "hsi_port", | ||
42 | }; | ||
43 | |||
44 | static ssize_t modalias_show(struct device *dev, | ||
45 | struct device_attribute *a __maybe_unused, char *buf) | ||
46 | { | ||
47 | return sprintf(buf, "hsi:%s\n", dev_name(dev)); | ||
48 | } | ||
49 | |||
50 | static struct device_attribute hsi_bus_dev_attrs[] = { | ||
51 | __ATTR_RO(modalias), | ||
52 | __ATTR_NULL, | ||
53 | }; | ||
54 | |||
55 | static int hsi_bus_uevent(struct device *dev, struct kobj_uevent_env *env) | ||
56 | { | ||
57 | if (dev->type == &hsi_cl) | ||
58 | add_uevent_var(env, "MODALIAS=hsi:%s", dev_name(dev)); | ||
59 | |||
60 | return 0; | ||
61 | } | ||
62 | |||
63 | static int hsi_bus_match(struct device *dev, struct device_driver *driver) | ||
64 | { | ||
65 | return strcmp(dev_name(dev), driver->name) == 0; | ||
66 | } | ||
67 | |||
68 | static struct bus_type hsi_bus_type = { | ||
69 | .name = "hsi", | ||
70 | .dev_attrs = hsi_bus_dev_attrs, | ||
71 | .match = hsi_bus_match, | ||
72 | .uevent = hsi_bus_uevent, | ||
73 | }; | ||
74 | |||
75 | static void hsi_client_release(struct device *dev) | ||
76 | { | ||
77 | kfree(to_hsi_client(dev)); | ||
78 | } | ||
79 | |||
80 | static void hsi_new_client(struct hsi_port *port, struct hsi_board_info *info) | ||
81 | { | ||
82 | struct hsi_client *cl; | ||
83 | unsigned long flags; | ||
84 | |||
85 | cl = kzalloc(sizeof(*cl), GFP_KERNEL); | ||
86 | if (!cl) | ||
87 | return; | ||
88 | cl->device.type = &hsi_cl; | ||
89 | cl->tx_cfg = info->tx_cfg; | ||
90 | cl->rx_cfg = info->rx_cfg; | ||
91 | cl->device.bus = &hsi_bus_type; | ||
92 | cl->device.parent = &port->device; | ||
93 | cl->device.release = hsi_client_release; | ||
94 | dev_set_name(&cl->device, info->name); | ||
95 | cl->device.platform_data = info->platform_data; | ||
96 | spin_lock_irqsave(&port->clock, flags); | ||
97 | list_add_tail(&cl->link, &port->clients); | ||
98 | spin_unlock_irqrestore(&port->clock, flags); | ||
99 | if (info->archdata) | ||
100 | cl->device.archdata = *info->archdata; | ||
101 | if (device_register(&cl->device) < 0) { | ||
102 | pr_err("hsi: failed to register client: %s\n", info->name); | ||
103 | kfree(cl); | ||
104 | } | ||
105 | } | ||
106 | |||
107 | static void hsi_scan_board_info(struct hsi_controller *hsi) | ||
108 | { | ||
109 | struct hsi_cl_info *cl_info; | ||
110 | struct hsi_port *p; | ||
111 | |||
112 | list_for_each_entry(cl_info, &hsi_board_list, list) | ||
113 | if (cl_info->info.hsi_id == hsi->id) { | ||
114 | p = hsi_find_port_num(hsi, cl_info->info.port); | ||
115 | if (!p) | ||
116 | continue; | ||
117 | hsi_new_client(p, &cl_info->info); | ||
118 | } | ||
119 | } | ||
120 | |||
121 | static int hsi_remove_client(struct device *dev, void *data __maybe_unused) | ||
122 | { | ||
123 | struct hsi_client *cl = to_hsi_client(dev); | ||
124 | struct hsi_port *port = to_hsi_port(dev->parent); | ||
125 | unsigned long flags; | ||
126 | |||
127 | spin_lock_irqsave(&port->clock, flags); | ||
128 | list_del(&cl->link); | ||
129 | spin_unlock_irqrestore(&port->clock, flags); | ||
130 | device_unregister(dev); | ||
131 | |||
132 | return 0; | ||
133 | } | ||
134 | |||
135 | static int hsi_remove_port(struct device *dev, void *data __maybe_unused) | ||
136 | { | ||
137 | device_for_each_child(dev, NULL, hsi_remove_client); | ||
138 | device_unregister(dev); | ||
139 | |||
140 | return 0; | ||
141 | } | ||
142 | |||
143 | static void hsi_controller_release(struct device *dev __maybe_unused) | ||
144 | { | ||
145 | } | ||
146 | |||
147 | static void hsi_port_release(struct device *dev __maybe_unused) | ||
148 | { | ||
149 | } | ||
150 | |||
151 | /** | ||
152 | * hsi_unregister_controller - Unregister an HSI controller | ||
153 | * @hsi: The HSI controller to register | ||
154 | */ | ||
155 | void hsi_unregister_controller(struct hsi_controller *hsi) | ||
156 | { | ||
157 | device_for_each_child(&hsi->device, NULL, hsi_remove_port); | ||
158 | device_unregister(&hsi->device); | ||
159 | } | ||
160 | EXPORT_SYMBOL_GPL(hsi_unregister_controller); | ||
161 | |||
162 | /** | ||
163 | * hsi_register_controller - Register an HSI controller and its ports | ||
164 | * @hsi: The HSI controller to register | ||
165 | * | ||
166 | * Returns -errno on failure, 0 on success. | ||
167 | */ | ||
168 | int hsi_register_controller(struct hsi_controller *hsi) | ||
169 | { | ||
170 | unsigned int i; | ||
171 | int err; | ||
172 | |||
173 | hsi->device.type = &hsi_ctrl; | ||
174 | hsi->device.bus = &hsi_bus_type; | ||
175 | hsi->device.release = hsi_controller_release; | ||
176 | err = device_register(&hsi->device); | ||
177 | if (err < 0) | ||
178 | return err; | ||
179 | for (i = 0; i < hsi->num_ports; i++) { | ||
180 | hsi->port[i].device.parent = &hsi->device; | ||
181 | hsi->port[i].device.bus = &hsi_bus_type; | ||
182 | hsi->port[i].device.release = hsi_port_release; | ||
183 | hsi->port[i].device.type = &hsi_port; | ||
184 | INIT_LIST_HEAD(&hsi->port[i].clients); | ||
185 | spin_lock_init(&hsi->port[i].clock); | ||
186 | err = device_register(&hsi->port[i].device); | ||
187 | if (err < 0) | ||
188 | goto out; | ||
189 | } | ||
190 | /* Populate HSI bus with HSI clients */ | ||
191 | hsi_scan_board_info(hsi); | ||
192 | |||
193 | return 0; | ||
194 | out: | ||
195 | hsi_unregister_controller(hsi); | ||
196 | |||
197 | return err; | ||
198 | } | ||
199 | EXPORT_SYMBOL_GPL(hsi_register_controller); | ||
200 | |||
201 | /** | ||
202 | * hsi_register_client_driver - Register an HSI client to the HSI bus | ||
203 | * @drv: HSI client driver to register | ||
204 | * | ||
205 | * Returns -errno on failure, 0 on success. | ||
206 | */ | ||
207 | int hsi_register_client_driver(struct hsi_client_driver *drv) | ||
208 | { | ||
209 | drv->driver.bus = &hsi_bus_type; | ||
210 | |||
211 | return driver_register(&drv->driver); | ||
212 | } | ||
213 | EXPORT_SYMBOL_GPL(hsi_register_client_driver); | ||
214 | |||
215 | static inline int hsi_dummy_msg(struct hsi_msg *msg __maybe_unused) | ||
216 | { | ||
217 | return 0; | ||
218 | } | ||
219 | |||
220 | static inline int hsi_dummy_cl(struct hsi_client *cl __maybe_unused) | ||
221 | { | ||
222 | return 0; | ||
223 | } | ||
224 | |||
225 | /** | ||
226 | * hsi_alloc_controller - Allocate an HSI controller and its ports | ||
227 | * @n_ports: Number of ports on the HSI controller | ||
228 | * @flags: Kernel allocation flags | ||
229 | * | ||
230 | * Return NULL on failure or a pointer to an hsi_controller on success. | ||
231 | */ | ||
232 | struct hsi_controller *hsi_alloc_controller(unsigned int n_ports, gfp_t flags) | ||
233 | { | ||
234 | struct hsi_controller *hsi; | ||
235 | struct hsi_port *port; | ||
236 | unsigned int i; | ||
237 | |||
238 | if (!n_ports) | ||
239 | return NULL; | ||
240 | |||
241 | port = kzalloc(sizeof(*port)*n_ports, flags); | ||
242 | if (!port) | ||
243 | return NULL; | ||
244 | hsi = kzalloc(sizeof(*hsi), flags); | ||
245 | if (!hsi) | ||
246 | goto out; | ||
247 | for (i = 0; i < n_ports; i++) { | ||
248 | dev_set_name(&port[i].device, "port%d", i); | ||
249 | port[i].num = i; | ||
250 | port[i].async = hsi_dummy_msg; | ||
251 | port[i].setup = hsi_dummy_cl; | ||
252 | port[i].flush = hsi_dummy_cl; | ||
253 | port[i].start_tx = hsi_dummy_cl; | ||
254 | port[i].stop_tx = hsi_dummy_cl; | ||
255 | port[i].release = hsi_dummy_cl; | ||
256 | mutex_init(&port[i].lock); | ||
257 | } | ||
258 | hsi->num_ports = n_ports; | ||
259 | hsi->port = port; | ||
260 | |||
261 | return hsi; | ||
262 | out: | ||
263 | kfree(port); | ||
264 | |||
265 | return NULL; | ||
266 | } | ||
267 | EXPORT_SYMBOL_GPL(hsi_alloc_controller); | ||
268 | |||
269 | /** | ||
270 | * hsi_free_controller - Free an HSI controller | ||
271 | * @hsi: Pointer to HSI controller | ||
272 | */ | ||
273 | void hsi_free_controller(struct hsi_controller *hsi) | ||
274 | { | ||
275 | if (!hsi) | ||
276 | return; | ||
277 | |||
278 | kfree(hsi->port); | ||
279 | kfree(hsi); | ||
280 | } | ||
281 | EXPORT_SYMBOL_GPL(hsi_free_controller); | ||
282 | |||
283 | /** | ||
284 | * hsi_free_msg - Free an HSI message | ||
285 | * @msg: Pointer to the HSI message | ||
286 | * | ||
287 | * Client is responsible to free the buffers pointed by the scatterlists. | ||
288 | */ | ||
289 | void hsi_free_msg(struct hsi_msg *msg) | ||
290 | { | ||
291 | if (!msg) | ||
292 | return; | ||
293 | sg_free_table(&msg->sgt); | ||
294 | kfree(msg); | ||
295 | } | ||
296 | EXPORT_SYMBOL_GPL(hsi_free_msg); | ||
297 | |||
298 | /** | ||
299 | * hsi_alloc_msg - Allocate an HSI message | ||
300 | * @nents: Number of memory entries | ||
301 | * @flags: Kernel allocation flags | ||
302 | * | ||
303 | * nents can be 0. This mainly makes sense for read transfer. | ||
304 | * In that case, HSI drivers will call the complete callback when | ||
305 | * there is data to be read without consuming it. | ||
306 | * | ||
307 | * Return NULL on failure or a pointer to an hsi_msg on success. | ||
308 | */ | ||
309 | struct hsi_msg *hsi_alloc_msg(unsigned int nents, gfp_t flags) | ||
310 | { | ||
311 | struct hsi_msg *msg; | ||
312 | int err; | ||
313 | |||
314 | msg = kzalloc(sizeof(*msg), flags); | ||
315 | if (!msg) | ||
316 | return NULL; | ||
317 | |||
318 | if (!nents) | ||
319 | return msg; | ||
320 | |||
321 | err = sg_alloc_table(&msg->sgt, nents, flags); | ||
322 | if (unlikely(err)) { | ||
323 | kfree(msg); | ||
324 | msg = NULL; | ||
325 | } | ||
326 | |||
327 | return msg; | ||
328 | } | ||
329 | EXPORT_SYMBOL_GPL(hsi_alloc_msg); | ||
330 | |||
331 | /** | ||
332 | * hsi_async - Submit an HSI transfer to the controller | ||
333 | * @cl: HSI client sending the transfer | ||
334 | * @msg: The HSI transfer passed to controller | ||
335 | * | ||
336 | * The HSI message must have the channel, ttype, complete and destructor | ||
337 | * fields set beforehand. If nents > 0 then the client has to initialize | ||
338 | * also the scatterlists to point to the buffers to write to or read from. | ||
339 | * | ||
340 | * HSI controllers relay on pre-allocated buffers from their clients and they | ||
341 | * do not allocate buffers on their own. | ||
342 | * | ||
343 | * Once the HSI message transfer finishes, the HSI controller calls the | ||
344 | * complete callback with the status and actual_len fields of the HSI message | ||
345 | * updated. The complete callback can be called before returning from | ||
346 | * hsi_async. | ||
347 | * | ||
348 | * Returns -errno on failure or 0 on success | ||
349 | */ | ||
350 | int hsi_async(struct hsi_client *cl, struct hsi_msg *msg) | ||
351 | { | ||
352 | struct hsi_port *port = hsi_get_port(cl); | ||
353 | |||
354 | if (!hsi_port_claimed(cl)) | ||
355 | return -EACCES; | ||
356 | |||
357 | WARN_ON_ONCE(!msg->destructor || !msg->complete); | ||
358 | msg->cl = cl; | ||
359 | |||
360 | return port->async(msg); | ||
361 | } | ||
362 | EXPORT_SYMBOL_GPL(hsi_async); | ||
363 | |||
364 | /** | ||
365 | * hsi_claim_port - Claim the HSI client's port | ||
366 | * @cl: HSI client that wants to claim its port | ||
367 | * @share: Flag to indicate if the client wants to share the port or not. | ||
368 | * | ||
369 | * Returns -errno on failure, 0 on success. | ||
370 | */ | ||
371 | int hsi_claim_port(struct hsi_client *cl, unsigned int share) | ||
372 | { | ||
373 | struct hsi_port *port = hsi_get_port(cl); | ||
374 | int err = 0; | ||
375 | |||
376 | mutex_lock(&port->lock); | ||
377 | if ((port->claimed) && (!port->shared || !share)) { | ||
378 | err = -EBUSY; | ||
379 | goto out; | ||
380 | } | ||
381 | if (!try_module_get(to_hsi_controller(port->device.parent)->owner)) { | ||
382 | err = -ENODEV; | ||
383 | goto out; | ||
384 | } | ||
385 | port->claimed++; | ||
386 | port->shared = !!share; | ||
387 | cl->pclaimed = 1; | ||
388 | out: | ||
389 | mutex_unlock(&port->lock); | ||
390 | |||
391 | return err; | ||
392 | } | ||
393 | EXPORT_SYMBOL_GPL(hsi_claim_port); | ||
394 | |||
395 | /** | ||
396 | * hsi_release_port - Release the HSI client's port | ||
397 | * @cl: HSI client which previously claimed its port | ||
398 | */ | ||
399 | void hsi_release_port(struct hsi_client *cl) | ||
400 | { | ||
401 | struct hsi_port *port = hsi_get_port(cl); | ||
402 | |||
403 | mutex_lock(&port->lock); | ||
404 | /* Allow HW driver to do some cleanup */ | ||
405 | port->release(cl); | ||
406 | if (cl->pclaimed) | ||
407 | port->claimed--; | ||
408 | BUG_ON(port->claimed < 0); | ||
409 | cl->pclaimed = 0; | ||
410 | if (!port->claimed) | ||
411 | port->shared = 0; | ||
412 | module_put(to_hsi_controller(port->device.parent)->owner); | ||
413 | mutex_unlock(&port->lock); | ||
414 | } | ||
415 | EXPORT_SYMBOL_GPL(hsi_release_port); | ||
416 | |||
417 | static int hsi_start_rx(struct hsi_client *cl, void *data __maybe_unused) | ||
418 | { | ||
419 | if (cl->hsi_start_rx) | ||
420 | (*cl->hsi_start_rx)(cl); | ||
421 | |||
422 | return 0; | ||
423 | } | ||
424 | |||
425 | static int hsi_stop_rx(struct hsi_client *cl, void *data __maybe_unused) | ||
426 | { | ||
427 | if (cl->hsi_stop_rx) | ||
428 | (*cl->hsi_stop_rx)(cl); | ||
429 | |||
430 | return 0; | ||
431 | } | ||
432 | |||
433 | static int hsi_port_for_each_client(struct hsi_port *port, void *data, | ||
434 | int (*fn)(struct hsi_client *cl, void *data)) | ||
435 | { | ||
436 | struct hsi_client *cl; | ||
437 | |||
438 | spin_lock(&port->clock); | ||
439 | list_for_each_entry(cl, &port->clients, link) { | ||
440 | spin_unlock(&port->clock); | ||
441 | (*fn)(cl, data); | ||
442 | spin_lock(&port->clock); | ||
443 | } | ||
444 | spin_unlock(&port->clock); | ||
445 | |||
446 | return 0; | ||
447 | } | ||
448 | |||
449 | /** | ||
450 | * hsi_event -Notifies clients about port events | ||
451 | * @port: Port where the event occurred | ||
452 | * @event: The event type | ||
453 | * | ||
454 | * Clients should not be concerned about wake line behavior. However, due | ||
455 | * to a race condition in HSI HW protocol, clients need to be notified | ||
456 | * about wake line changes, so they can implement a workaround for it. | ||
457 | * | ||
458 | * Events: | ||
459 | * HSI_EVENT_START_RX - Incoming wake line high | ||
460 | * HSI_EVENT_STOP_RX - Incoming wake line down | ||
461 | */ | ||
462 | void hsi_event(struct hsi_port *port, unsigned int event) | ||
463 | { | ||
464 | int (*fn)(struct hsi_client *cl, void *data); | ||
465 | |||
466 | switch (event) { | ||
467 | case HSI_EVENT_START_RX: | ||
468 | fn = hsi_start_rx; | ||
469 | break; | ||
470 | case HSI_EVENT_STOP_RX: | ||
471 | fn = hsi_stop_rx; | ||
472 | break; | ||
473 | default: | ||
474 | return; | ||
475 | } | ||
476 | hsi_port_for_each_client(port, NULL, fn); | ||
477 | } | ||
478 | EXPORT_SYMBOL_GPL(hsi_event); | ||
479 | |||
480 | static int __init hsi_init(void) | ||
481 | { | ||
482 | return bus_register(&hsi_bus_type); | ||
483 | } | ||
484 | postcore_initcall(hsi_init); | ||
485 | |||
486 | static void __exit hsi_exit(void) | ||
487 | { | ||
488 | bus_unregister(&hsi_bus_type); | ||
489 | } | ||
490 | module_exit(hsi_exit); | ||
491 | |||
492 | MODULE_AUTHOR("Carlos Chinea <carlos.chinea@nokia.com>"); | ||
493 | MODULE_DESCRIPTION("High-speed Synchronous Serial Interface (HSI) framework"); | ||
494 | MODULE_LICENSE("GPL v2"); | ||
diff --git a/drivers/hsi/hsi_boardinfo.c b/drivers/hsi/hsi_boardinfo.c new file mode 100644 index 000000000000..e56bc6da5f98 --- /dev/null +++ b/drivers/hsi/hsi_boardinfo.c | |||
@@ -0,0 +1,62 @@ | |||
1 | /* | ||
2 | * HSI clients registration interface | ||
3 | * | ||
4 | * Copyright (C) 2010 Nokia Corporation. All rights reserved. | ||
5 | * | ||
6 | * Contact: Carlos Chinea <carlos.chinea@nokia.com> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or | ||
9 | * modify it under the terms of the GNU General Public License | ||
10 | * version 2 as published by the Free Software Foundation. | ||
11 | * | ||
12 | * This program is distributed in the hope that it will be useful, but | ||
13 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
15 | * General Public License for more details. | ||
16 | * | ||
17 | * You should have received a copy of the GNU General Public License | ||
18 | * along with this program; if not, write to the Free Software | ||
19 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | ||
20 | * 02110-1301 USA | ||
21 | */ | ||
22 | #include <linux/hsi/hsi.h> | ||
23 | #include <linux/list.h> | ||
24 | #include <linux/slab.h> | ||
25 | #include "hsi_core.h" | ||
26 | |||
27 | /* | ||
28 | * hsi_board_list is only used internally by the HSI framework. | ||
29 | * No one else is allowed to make use of it. | ||
30 | */ | ||
31 | LIST_HEAD(hsi_board_list); | ||
32 | EXPORT_SYMBOL_GPL(hsi_board_list); | ||
33 | |||
34 | /** | ||
35 | * hsi_register_board_info - Register HSI clients information | ||
36 | * @info: Array of HSI clients on the board | ||
37 | * @len: Length of the array | ||
38 | * | ||
39 | * HSI clients are statically declared and registered on board files. | ||
40 | * | ||
41 | * HSI clients will be automatically registered to the HSI bus once the | ||
42 | * controller and the port where the clients wishes to attach are registered | ||
43 | * to it. | ||
44 | * | ||
45 | * Return -errno on failure, 0 on success. | ||
46 | */ | ||
47 | int __init hsi_register_board_info(struct hsi_board_info const *info, | ||
48 | unsigned int len) | ||
49 | { | ||
50 | struct hsi_cl_info *cl_info; | ||
51 | |||
52 | cl_info = kzalloc(sizeof(*cl_info) * len, GFP_KERNEL); | ||
53 | if (!cl_info) | ||
54 | return -ENOMEM; | ||
55 | |||
56 | for (; len; len--, info++, cl_info++) { | ||
57 | cl_info->info = *info; | ||
58 | list_add_tail(&cl_info->list, &hsi_board_list); | ||
59 | } | ||
60 | |||
61 | return 0; | ||
62 | } | ||
diff --git a/drivers/hsi/hsi_core.h b/drivers/hsi/hsi_core.h new file mode 100644 index 000000000000..ab5c2fb175fd --- /dev/null +++ b/drivers/hsi/hsi_core.h | |||
@@ -0,0 +1,35 @@ | |||
1 | /* | ||
2 | * HSI framework internal interfaces, | ||
3 | * | ||
4 | * Copyright (C) 2010 Nokia Corporation. All rights reserved. | ||
5 | * | ||
6 | * Contact: Carlos Chinea <carlos.chinea@nokia.com> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or | ||
9 | * modify it under the terms of the GNU General Public License | ||
10 | * version 2 as published by the Free Software Foundation. | ||
11 | * | ||
12 | * This program is distributed in the hope that it will be useful, but | ||
13 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
15 | * General Public License for more details. | ||
16 | * | ||
17 | * You should have received a copy of the GNU General Public License | ||
18 | * along with this program; if not, write to the Free Software | ||
19 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | ||
20 | * 02110-1301 USA | ||
21 | */ | ||
22 | |||
23 | #ifndef __LINUX_HSI_CORE_H__ | ||
24 | #define __LINUX_HSI_CORE_H__ | ||
25 | |||
26 | #include <linux/hsi/hsi.h> | ||
27 | |||
28 | struct hsi_cl_info { | ||
29 | struct list_head list; | ||
30 | struct hsi_board_info info; | ||
31 | }; | ||
32 | |||
33 | extern struct list_head hsi_board_list; | ||
34 | |||
35 | #endif /* __LINUX_HSI_CORE_H__ */ | ||
diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig index 5b32d56dbb4d..8deedc1b9840 100644 --- a/drivers/hwmon/Kconfig +++ b/drivers/hwmon/Kconfig | |||
@@ -253,7 +253,8 @@ config SENSORS_K10TEMP | |||
253 | If you say yes here you get support for the temperature | 253 | If you say yes here you get support for the temperature |
254 | sensor(s) inside your CPU. Supported are later revisions of | 254 | sensor(s) inside your CPU. Supported are later revisions of |
255 | the AMD Family 10h and all revisions of the AMD Family 11h, | 255 | the AMD Family 10h and all revisions of the AMD Family 11h, |
256 | 12h (Llano), 14h (Brazos) and 15h (Bulldozer) microarchitectures. | 256 | 12h (Llano), 14h (Brazos) and 15h (Bulldozer/Trinity) |
257 | microarchitectures. | ||
257 | 258 | ||
258 | This driver can also be built as a module. If so, the module | 259 | This driver can also be built as a module. If so, the module |
259 | will be called k10temp. | 260 | will be called k10temp. |
@@ -425,7 +426,7 @@ config SENSORS_GL520SM | |||
425 | 426 | ||
426 | config SENSORS_GPIO_FAN | 427 | config SENSORS_GPIO_FAN |
427 | tristate "GPIO fan" | 428 | tristate "GPIO fan" |
428 | depends on GENERIC_GPIO | 429 | depends on GPIOLIB |
429 | help | 430 | help |
430 | If you say yes here you get support for fans connected to GPIO lines. | 431 | If you say yes here you get support for fans connected to GPIO lines. |
431 | 432 | ||
@@ -883,7 +884,7 @@ source drivers/hwmon/pmbus/Kconfig | |||
883 | 884 | ||
884 | config SENSORS_SHT15 | 885 | config SENSORS_SHT15 |
885 | tristate "Sensiron humidity and temperature sensors. SHT15 and compat." | 886 | tristate "Sensiron humidity and temperature sensors. SHT15 and compat." |
886 | depends on GENERIC_GPIO | 887 | depends on GPIOLIB |
887 | help | 888 | help |
888 | If you say yes here you get support for the Sensiron SHT10, SHT11, | 889 | If you say yes here you get support for the Sensiron SHT10, SHT11, |
889 | SHT15, SHT71, SHT75 humidity and temperature sensors. | 890 | SHT15, SHT71, SHT75 humidity and temperature sensors. |
diff --git a/drivers/hwmon/acpi_power_meter.c b/drivers/hwmon/acpi_power_meter.c index 554f046bcf20..145f13580ff0 100644 --- a/drivers/hwmon/acpi_power_meter.c +++ b/drivers/hwmon/acpi_power_meter.c | |||
@@ -632,6 +632,7 @@ static int register_ro_attrs(struct acpi_power_meter_resource *resource, | |||
632 | sensors->dev_attr.show = ro->show; | 632 | sensors->dev_attr.show = ro->show; |
633 | sensors->index = ro->index; | 633 | sensors->index = ro->index; |
634 | 634 | ||
635 | sysfs_attr_init(&sensors->dev_attr.attr); | ||
635 | res = device_create_file(dev, &sensors->dev_attr); | 636 | res = device_create_file(dev, &sensors->dev_attr); |
636 | if (res) { | 637 | if (res) { |
637 | sensors->dev_attr.attr.name = NULL; | 638 | sensors->dev_attr.attr.name = NULL; |
@@ -661,6 +662,7 @@ static int register_rw_attrs(struct acpi_power_meter_resource *resource, | |||
661 | sensors->dev_attr.store = rw->set; | 662 | sensors->dev_attr.store = rw->set; |
662 | sensors->index = rw->index; | 663 | sensors->index = rw->index; |
663 | 664 | ||
665 | sysfs_attr_init(&sensors->dev_attr.attr); | ||
664 | res = device_create_file(dev, &sensors->dev_attr); | 666 | res = device_create_file(dev, &sensors->dev_attr); |
665 | if (res) { | 667 | if (res) { |
666 | sensors->dev_attr.attr.name = NULL; | 668 | sensors->dev_attr.attr.name = NULL; |
diff --git a/drivers/hwmon/ad7314.c b/drivers/hwmon/ad7314.c index 0e0cfcc36f8d..ce43642ef03e 100644 --- a/drivers/hwmon/ad7314.c +++ b/drivers/hwmon/ad7314.c | |||
@@ -128,6 +128,7 @@ static int __devinit ad7314_probe(struct spi_device *spi_dev) | |||
128 | ret = PTR_ERR(chip->hwmon_dev); | 128 | ret = PTR_ERR(chip->hwmon_dev); |
129 | goto error_remove_group; | 129 | goto error_remove_group; |
130 | } | 130 | } |
131 | chip->spi_dev = spi_dev; | ||
131 | 132 | ||
132 | return 0; | 133 | return 0; |
133 | error_remove_group: | 134 | error_remove_group: |
diff --git a/drivers/hwmon/adm1031.c b/drivers/hwmon/adm1031.c index ff37363ea5bc..44e1fd7f3d81 100644 --- a/drivers/hwmon/adm1031.c +++ b/drivers/hwmon/adm1031.c | |||
@@ -233,18 +233,15 @@ static const auto_chan_table_t auto_channel_select_table_adm1030 = { | |||
233 | * nearest match if no exact match where found. | 233 | * nearest match if no exact match where found. |
234 | */ | 234 | */ |
235 | static int | 235 | static int |
236 | get_fan_auto_nearest(struct adm1031_data *data, | 236 | get_fan_auto_nearest(struct adm1031_data *data, int chan, u8 val, u8 reg) |
237 | int chan, u8 val, u8 reg, u8 *new_reg) | ||
238 | { | 237 | { |
239 | int i; | 238 | int i; |
240 | int first_match = -1, exact_match = -1; | 239 | int first_match = -1, exact_match = -1; |
241 | u8 other_reg_val = | 240 | u8 other_reg_val = |
242 | (*data->chan_select_table)[FAN_CHAN_FROM_REG(reg)][chan ? 0 : 1]; | 241 | (*data->chan_select_table)[FAN_CHAN_FROM_REG(reg)][chan ? 0 : 1]; |
243 | 242 | ||
244 | if (val == 0) { | 243 | if (val == 0) |
245 | *new_reg = 0; | ||
246 | return 0; | 244 | return 0; |
247 | } | ||
248 | 245 | ||
249 | for (i = 0; i < 8; i++) { | 246 | for (i = 0; i < 8; i++) { |
250 | if ((val == (*data->chan_select_table)[i][chan]) && | 247 | if ((val == (*data->chan_select_table)[i][chan]) && |
@@ -264,13 +261,11 @@ get_fan_auto_nearest(struct adm1031_data *data, | |||
264 | } | 261 | } |
265 | 262 | ||
266 | if (exact_match >= 0) | 263 | if (exact_match >= 0) |
267 | *new_reg = exact_match; | 264 | return exact_match; |
268 | else if (first_match >= 0) | 265 | else if (first_match >= 0) |
269 | *new_reg = first_match; | 266 | return first_match; |
270 | else | ||
271 | return -EINVAL; | ||
272 | 267 | ||
273 | return 0; | 268 | return -EINVAL; |
274 | } | 269 | } |
275 | 270 | ||
276 | static ssize_t show_fan_auto_channel(struct device *dev, | 271 | static ssize_t show_fan_auto_channel(struct device *dev, |
@@ -301,11 +296,12 @@ set_fan_auto_channel(struct device *dev, struct device_attribute *attr, | |||
301 | 296 | ||
302 | mutex_lock(&data->update_lock); | 297 | mutex_lock(&data->update_lock); |
303 | 298 | ||
304 | ret = get_fan_auto_nearest(data, nr, val, data->conf1, ®); | 299 | ret = get_fan_auto_nearest(data, nr, val, data->conf1); |
305 | if (ret) { | 300 | if (ret < 0) { |
306 | mutex_unlock(&data->update_lock); | 301 | mutex_unlock(&data->update_lock); |
307 | return ret; | 302 | return ret; |
308 | } | 303 | } |
304 | reg = ret; | ||
309 | data->conf1 = FAN_CHAN_TO_REG(reg, data->conf1); | 305 | data->conf1 = FAN_CHAN_TO_REG(reg, data->conf1); |
310 | if ((data->conf1 & ADM1031_CONF1_AUTO_MODE) ^ | 306 | if ((data->conf1 & ADM1031_CONF1_AUTO_MODE) ^ |
311 | (old_fan_mode & ADM1031_CONF1_AUTO_MODE)) { | 307 | (old_fan_mode & ADM1031_CONF1_AUTO_MODE)) { |
diff --git a/drivers/hwmon/f75375s.c b/drivers/hwmon/f75375s.c index 729499e75210..ece4159bd453 100644 --- a/drivers/hwmon/f75375s.c +++ b/drivers/hwmon/f75375s.c | |||
@@ -276,6 +276,7 @@ static bool duty_mode_enabled(u8 pwm_enable) | |||
276 | return false; | 276 | return false; |
277 | default: | 277 | default: |
278 | BUG(); | 278 | BUG(); |
279 | return true; | ||
279 | } | 280 | } |
280 | } | 281 | } |
281 | 282 | ||
@@ -291,6 +292,7 @@ static bool auto_mode_enabled(u8 pwm_enable) | |||
291 | return true; | 292 | return true; |
292 | default: | 293 | default: |
293 | BUG(); | 294 | BUG(); |
295 | return false; | ||
294 | } | 296 | } |
295 | } | 297 | } |
296 | 298 | ||
diff --git a/drivers/hwmon/k10temp.c b/drivers/hwmon/k10temp.c index aba29d63f195..307bb325dde9 100644 --- a/drivers/hwmon/k10temp.c +++ b/drivers/hwmon/k10temp.c | |||
@@ -33,6 +33,9 @@ static bool force; | |||
33 | module_param(force, bool, 0444); | 33 | module_param(force, bool, 0444); |
34 | MODULE_PARM_DESC(force, "force loading on processors with erratum 319"); | 34 | MODULE_PARM_DESC(force, "force loading on processors with erratum 319"); |
35 | 35 | ||
36 | /* PCI-IDs for Northbridge devices not used anywhere else */ | ||
37 | #define PCI_DEVICE_ID_AMD_15H_M10H_NB_F3 0x1403 | ||
38 | |||
36 | /* CPUID function 0x80000001, ebx */ | 39 | /* CPUID function 0x80000001, ebx */ |
37 | #define CPUID_PKGTYPE_MASK 0xf0000000 | 40 | #define CPUID_PKGTYPE_MASK 0xf0000000 |
38 | #define CPUID_PKGTYPE_F 0x00000000 | 41 | #define CPUID_PKGTYPE_F 0x00000000 |
@@ -210,6 +213,7 @@ static DEFINE_PCI_DEVICE_TABLE(k10temp_id_table) = { | |||
210 | { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_11H_NB_MISC) }, | 213 | { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_11H_NB_MISC) }, |
211 | { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_CNB17H_F3) }, | 214 | { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_CNB17H_F3) }, |
212 | { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_15H_NB_F3) }, | 215 | { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_15H_NB_F3) }, |
216 | { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_15H_M10H_NB_F3) }, | ||
213 | {} | 217 | {} |
214 | }; | 218 | }; |
215 | MODULE_DEVICE_TABLE(pci, k10temp_id_table); | 219 | MODULE_DEVICE_TABLE(pci, k10temp_id_table); |
diff --git a/drivers/hwmon/max6639.c b/drivers/hwmon/max6639.c index 193067e27b6f..de8f7adaccbd 100644 --- a/drivers/hwmon/max6639.c +++ b/drivers/hwmon/max6639.c | |||
@@ -596,8 +596,10 @@ static int max6639_remove(struct i2c_client *client) | |||
596 | return 0; | 596 | return 0; |
597 | } | 597 | } |
598 | 598 | ||
599 | static int max6639_suspend(struct i2c_client *client, pm_message_t mesg) | 599 | #ifdef CONFIG_PM_SLEEP |
600 | static int max6639_suspend(struct device *dev) | ||
600 | { | 601 | { |
602 | struct i2c_client *client = to_i2c_client(dev); | ||
601 | int data = i2c_smbus_read_byte_data(client, MAX6639_REG_GCONFIG); | 603 | int data = i2c_smbus_read_byte_data(client, MAX6639_REG_GCONFIG); |
602 | if (data < 0) | 604 | if (data < 0) |
603 | return data; | 605 | return data; |
@@ -606,8 +608,9 @@ static int max6639_suspend(struct i2c_client *client, pm_message_t mesg) | |||
606 | MAX6639_REG_GCONFIG, data | MAX6639_GCONFIG_STANDBY); | 608 | MAX6639_REG_GCONFIG, data | MAX6639_GCONFIG_STANDBY); |
607 | } | 609 | } |
608 | 610 | ||
609 | static int max6639_resume(struct i2c_client *client) | 611 | static int max6639_resume(struct device *dev) |
610 | { | 612 | { |
613 | struct i2c_client *client = to_i2c_client(dev); | ||
611 | int data = i2c_smbus_read_byte_data(client, MAX6639_REG_GCONFIG); | 614 | int data = i2c_smbus_read_byte_data(client, MAX6639_REG_GCONFIG); |
612 | if (data < 0) | 615 | if (data < 0) |
613 | return data; | 616 | return data; |
@@ -615,6 +618,7 @@ static int max6639_resume(struct i2c_client *client) | |||
615 | return i2c_smbus_write_byte_data(client, | 618 | return i2c_smbus_write_byte_data(client, |
616 | MAX6639_REG_GCONFIG, data & ~MAX6639_GCONFIG_STANDBY); | 619 | MAX6639_REG_GCONFIG, data & ~MAX6639_GCONFIG_STANDBY); |
617 | } | 620 | } |
621 | #endif /* CONFIG_PM_SLEEP */ | ||
618 | 622 | ||
619 | static const struct i2c_device_id max6639_id[] = { | 623 | static const struct i2c_device_id max6639_id[] = { |
620 | {"max6639", 0}, | 624 | {"max6639", 0}, |
@@ -623,15 +627,18 @@ static const struct i2c_device_id max6639_id[] = { | |||
623 | 627 | ||
624 | MODULE_DEVICE_TABLE(i2c, max6639_id); | 628 | MODULE_DEVICE_TABLE(i2c, max6639_id); |
625 | 629 | ||
630 | static const struct dev_pm_ops max6639_pm_ops = { | ||
631 | SET_SYSTEM_SLEEP_PM_OPS(max6639_suspend, max6639_resume) | ||
632 | }; | ||
633 | |||
626 | static struct i2c_driver max6639_driver = { | 634 | static struct i2c_driver max6639_driver = { |
627 | .class = I2C_CLASS_HWMON, | 635 | .class = I2C_CLASS_HWMON, |
628 | .driver = { | 636 | .driver = { |
629 | .name = "max6639", | 637 | .name = "max6639", |
638 | .pm = &max6639_pm_ops, | ||
630 | }, | 639 | }, |
631 | .probe = max6639_probe, | 640 | .probe = max6639_probe, |
632 | .remove = max6639_remove, | 641 | .remove = max6639_remove, |
633 | .suspend = max6639_suspend, | ||
634 | .resume = max6639_resume, | ||
635 | .id_table = max6639_id, | 642 | .id_table = max6639_id, |
636 | .detect = max6639_detect, | 643 | .detect = max6639_detect, |
637 | .address_list = normal_i2c, | 644 | .address_list = normal_i2c, |
diff --git a/drivers/hwmon/w83627ehf.c b/drivers/hwmon/w83627ehf.c index a25350cf9554..54922ed12978 100644 --- a/drivers/hwmon/w83627ehf.c +++ b/drivers/hwmon/w83627ehf.c | |||
@@ -2619,15 +2619,15 @@ static struct platform_driver w83627ehf_driver = { | |||
2619 | static int __init w83627ehf_find(int sioaddr, unsigned short *addr, | 2619 | static int __init w83627ehf_find(int sioaddr, unsigned short *addr, |
2620 | struct w83627ehf_sio_data *sio_data) | 2620 | struct w83627ehf_sio_data *sio_data) |
2621 | { | 2621 | { |
2622 | static const char __initdata sio_name_W83627EHF[] = "W83627EHF"; | 2622 | static const char sio_name_W83627EHF[] __initconst = "W83627EHF"; |
2623 | static const char __initdata sio_name_W83627EHG[] = "W83627EHG"; | 2623 | static const char sio_name_W83627EHG[] __initconst = "W83627EHG"; |
2624 | static const char __initdata sio_name_W83627DHG[] = "W83627DHG"; | 2624 | static const char sio_name_W83627DHG[] __initconst = "W83627DHG"; |
2625 | static const char __initdata sio_name_W83627DHG_P[] = "W83627DHG-P"; | 2625 | static const char sio_name_W83627DHG_P[] __initconst = "W83627DHG-P"; |
2626 | static const char __initdata sio_name_W83627UHG[] = "W83627UHG"; | 2626 | static const char sio_name_W83627UHG[] __initconst = "W83627UHG"; |
2627 | static const char __initdata sio_name_W83667HG[] = "W83667HG"; | 2627 | static const char sio_name_W83667HG[] __initconst = "W83667HG"; |
2628 | static const char __initdata sio_name_W83667HG_B[] = "W83667HG-B"; | 2628 | static const char sio_name_W83667HG_B[] __initconst = "W83667HG-B"; |
2629 | static const char __initdata sio_name_NCT6775[] = "NCT6775F"; | 2629 | static const char sio_name_NCT6775[] __initconst = "NCT6775F"; |
2630 | static const char __initdata sio_name_NCT6776[] = "NCT6776F"; | 2630 | static const char sio_name_NCT6776[] __initconst = "NCT6776F"; |
2631 | 2631 | ||
2632 | u16 val; | 2632 | u16 val; |
2633 | const char *sio_name; | 2633 | const char *sio_name; |
diff --git a/drivers/idle/i7300_idle.c b/drivers/idle/i7300_idle.c index c976285d313e..fa080ebd568f 100644 --- a/drivers/idle/i7300_idle.c +++ b/drivers/idle/i7300_idle.c | |||
@@ -516,12 +516,6 @@ static struct notifier_block i7300_idle_nb = { | |||
516 | 516 | ||
517 | MODULE_DEVICE_TABLE(pci, pci_tbl); | 517 | MODULE_DEVICE_TABLE(pci, pci_tbl); |
518 | 518 | ||
519 | int stats_open_generic(struct inode *inode, struct file *fp) | ||
520 | { | ||
521 | fp->private_data = inode->i_private; | ||
522 | return 0; | ||
523 | } | ||
524 | |||
525 | static ssize_t stats_read_ul(struct file *fp, char __user *ubuf, size_t count, | 519 | static ssize_t stats_read_ul(struct file *fp, char __user *ubuf, size_t count, |
526 | loff_t *off) | 520 | loff_t *off) |
527 | { | 521 | { |
@@ -534,7 +528,7 @@ static ssize_t stats_read_ul(struct file *fp, char __user *ubuf, size_t count, | |||
534 | } | 528 | } |
535 | 529 | ||
536 | static const struct file_operations idle_fops = { | 530 | static const struct file_operations idle_fops = { |
537 | .open = stats_open_generic, | 531 | .open = simple_open, |
538 | .read = stats_read_ul, | 532 | .read = stats_read_ul, |
539 | .llseek = default_llseek, | 533 | .llseek = default_llseek, |
540 | }; | 534 | }; |
diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c index ae2ec929e52f..a5bee8e2dfce 100644 --- a/drivers/iommu/amd_iommu.c +++ b/drivers/iommu/amd_iommu.c | |||
@@ -2707,7 +2707,8 @@ static void unmap_sg(struct device *dev, struct scatterlist *sglist, | |||
2707 | * The exported alloc_coherent function for dma_ops. | 2707 | * The exported alloc_coherent function for dma_ops. |
2708 | */ | 2708 | */ |
2709 | static void *alloc_coherent(struct device *dev, size_t size, | 2709 | static void *alloc_coherent(struct device *dev, size_t size, |
2710 | dma_addr_t *dma_addr, gfp_t flag) | 2710 | dma_addr_t *dma_addr, gfp_t flag, |
2711 | struct dma_attrs *attrs) | ||
2711 | { | 2712 | { |
2712 | unsigned long flags; | 2713 | unsigned long flags; |
2713 | void *virt_addr; | 2714 | void *virt_addr; |
@@ -2765,7 +2766,8 @@ out_free: | |||
2765 | * The exported free_coherent function for dma_ops. | 2766 | * The exported free_coherent function for dma_ops. |
2766 | */ | 2767 | */ |
2767 | static void free_coherent(struct device *dev, size_t size, | 2768 | static void free_coherent(struct device *dev, size_t size, |
2768 | void *virt_addr, dma_addr_t dma_addr) | 2769 | void *virt_addr, dma_addr_t dma_addr, |
2770 | struct dma_attrs *attrs) | ||
2769 | { | 2771 | { |
2770 | unsigned long flags; | 2772 | unsigned long flags; |
2771 | struct protection_domain *domain; | 2773 | struct protection_domain *domain; |
@@ -2846,8 +2848,8 @@ static void __init prealloc_protection_domains(void) | |||
2846 | } | 2848 | } |
2847 | 2849 | ||
2848 | static struct dma_map_ops amd_iommu_dma_ops = { | 2850 | static struct dma_map_ops amd_iommu_dma_ops = { |
2849 | .alloc_coherent = alloc_coherent, | 2851 | .alloc = alloc_coherent, |
2850 | .free_coherent = free_coherent, | 2852 | .free = free_coherent, |
2851 | .map_page = map_page, | 2853 | .map_page = map_page, |
2852 | .unmap_page = unmap_page, | 2854 | .unmap_page = unmap_page, |
2853 | .map_sg = map_sg, | 2855 | .map_sg = map_sg, |
diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c index 132f93b05154..f93d5ac8f81c 100644 --- a/drivers/iommu/intel-iommu.c +++ b/drivers/iommu/intel-iommu.c | |||
@@ -2949,7 +2949,8 @@ static void intel_unmap_page(struct device *dev, dma_addr_t dev_addr, | |||
2949 | } | 2949 | } |
2950 | 2950 | ||
2951 | static void *intel_alloc_coherent(struct device *hwdev, size_t size, | 2951 | static void *intel_alloc_coherent(struct device *hwdev, size_t size, |
2952 | dma_addr_t *dma_handle, gfp_t flags) | 2952 | dma_addr_t *dma_handle, gfp_t flags, |
2953 | struct dma_attrs *attrs) | ||
2953 | { | 2954 | { |
2954 | void *vaddr; | 2955 | void *vaddr; |
2955 | int order; | 2956 | int order; |
@@ -2981,7 +2982,7 @@ static void *intel_alloc_coherent(struct device *hwdev, size_t size, | |||
2981 | } | 2982 | } |
2982 | 2983 | ||
2983 | static void intel_free_coherent(struct device *hwdev, size_t size, void *vaddr, | 2984 | static void intel_free_coherent(struct device *hwdev, size_t size, void *vaddr, |
2984 | dma_addr_t dma_handle) | 2985 | dma_addr_t dma_handle, struct dma_attrs *attrs) |
2985 | { | 2986 | { |
2986 | int order; | 2987 | int order; |
2987 | 2988 | ||
@@ -3126,8 +3127,8 @@ static int intel_mapping_error(struct device *dev, dma_addr_t dma_addr) | |||
3126 | } | 3127 | } |
3127 | 3128 | ||
3128 | struct dma_map_ops intel_dma_ops = { | 3129 | struct dma_map_ops intel_dma_ops = { |
3129 | .alloc_coherent = intel_alloc_coherent, | 3130 | .alloc = intel_alloc_coherent, |
3130 | .free_coherent = intel_free_coherent, | 3131 | .free = intel_free_coherent, |
3131 | .map_sg = intel_map_sg, | 3132 | .map_sg = intel_map_sg, |
3132 | .unmap_sg = intel_unmap_sg, | 3133 | .unmap_sg = intel_unmap_sg, |
3133 | .map_page = intel_map_page, | 3134 | .map_page = intel_map_page, |
diff --git a/drivers/iommu/omap-iommu-debug.c b/drivers/iommu/omap-iommu-debug.c index 103dbd92e256..f55fc5dfbadc 100644 --- a/drivers/iommu/omap-iommu-debug.c +++ b/drivers/iommu/omap-iommu-debug.c | |||
@@ -323,15 +323,9 @@ err_out: | |||
323 | return count; | 323 | return count; |
324 | } | 324 | } |
325 | 325 | ||
326 | static int debug_open_generic(struct inode *inode, struct file *file) | ||
327 | { | ||
328 | file->private_data = inode->i_private; | ||
329 | return 0; | ||
330 | } | ||
331 | |||
332 | #define DEBUG_FOPS(name) \ | 326 | #define DEBUG_FOPS(name) \ |
333 | static const struct file_operations debug_##name##_fops = { \ | 327 | static const struct file_operations debug_##name##_fops = { \ |
334 | .open = debug_open_generic, \ | 328 | .open = simple_open, \ |
335 | .read = debug_read_##name, \ | 329 | .read = debug_read_##name, \ |
336 | .write = debug_write_##name, \ | 330 | .write = debug_write_##name, \ |
337 | .llseek = generic_file_llseek, \ | 331 | .llseek = generic_file_llseek, \ |
@@ -339,7 +333,7 @@ static int debug_open_generic(struct inode *inode, struct file *file) | |||
339 | 333 | ||
340 | #define DEBUG_FOPS_RO(name) \ | 334 | #define DEBUG_FOPS_RO(name) \ |
341 | static const struct file_operations debug_##name##_fops = { \ | 335 | static const struct file_operations debug_##name##_fops = { \ |
342 | .open = debug_open_generic, \ | 336 | .open = simple_open, \ |
343 | .read = debug_read_##name, \ | 337 | .read = debug_read_##name, \ |
344 | .llseek = generic_file_llseek, \ | 338 | .llseek = generic_file_llseek, \ |
345 | }; | 339 | }; |
diff --git a/drivers/isdn/hardware/mISDN/avmfritz.c b/drivers/isdn/hardware/mISDN/avmfritz.c index 05ed4d0cb18b..c0b8c960ee3f 100644 --- a/drivers/isdn/hardware/mISDN/avmfritz.c +++ b/drivers/isdn/hardware/mISDN/avmfritz.c | |||
@@ -891,7 +891,7 @@ open_bchannel(struct fritzcard *fc, struct channel_req *rq) | |||
891 | { | 891 | { |
892 | struct bchannel *bch; | 892 | struct bchannel *bch; |
893 | 893 | ||
894 | if (rq->adr.channel > 2) | 894 | if (rq->adr.channel == 0 || rq->adr.channel > 2) |
895 | return -EINVAL; | 895 | return -EINVAL; |
896 | if (rq->protocol == ISDN_P_NONE) | 896 | if (rq->protocol == ISDN_P_NONE) |
897 | return -EINVAL; | 897 | return -EINVAL; |
diff --git a/drivers/isdn/hardware/mISDN/hfcpci.c b/drivers/isdn/hardware/mISDN/hfcpci.c index d055ae7fa040..e2c83a2d7691 100644 --- a/drivers/isdn/hardware/mISDN/hfcpci.c +++ b/drivers/isdn/hardware/mISDN/hfcpci.c | |||
@@ -1962,7 +1962,7 @@ open_bchannel(struct hfc_pci *hc, struct channel_req *rq) | |||
1962 | { | 1962 | { |
1963 | struct bchannel *bch; | 1963 | struct bchannel *bch; |
1964 | 1964 | ||
1965 | if (rq->adr.channel > 2) | 1965 | if (rq->adr.channel == 0 || rq->adr.channel > 2) |
1966 | return -EINVAL; | 1966 | return -EINVAL; |
1967 | if (rq->protocol == ISDN_P_NONE) | 1967 | if (rq->protocol == ISDN_P_NONE) |
1968 | return -EINVAL; | 1968 | return -EINVAL; |
diff --git a/drivers/isdn/hardware/mISDN/hfcsusb.c b/drivers/isdn/hardware/mISDN/hfcsusb.c index 602338734634..8cde2a0538ab 100644 --- a/drivers/isdn/hardware/mISDN/hfcsusb.c +++ b/drivers/isdn/hardware/mISDN/hfcsusb.c | |||
@@ -486,7 +486,7 @@ open_bchannel(struct hfcsusb *hw, struct channel_req *rq) | |||
486 | { | 486 | { |
487 | struct bchannel *bch; | 487 | struct bchannel *bch; |
488 | 488 | ||
489 | if (rq->adr.channel > 2) | 489 | if (rq->adr.channel == 0 || rq->adr.channel > 2) |
490 | return -EINVAL; | 490 | return -EINVAL; |
491 | if (rq->protocol == ISDN_P_NONE) | 491 | if (rq->protocol == ISDN_P_NONE) |
492 | return -EINVAL; | 492 | return -EINVAL; |
diff --git a/drivers/isdn/hardware/mISDN/mISDNipac.c b/drivers/isdn/hardware/mISDN/mISDNipac.c index b47e9bed2185..884369f09cad 100644 --- a/drivers/isdn/hardware/mISDN/mISDNipac.c +++ b/drivers/isdn/hardware/mISDN/mISDNipac.c | |||
@@ -1506,7 +1506,7 @@ open_bchannel(struct ipac_hw *ipac, struct channel_req *rq) | |||
1506 | { | 1506 | { |
1507 | struct bchannel *bch; | 1507 | struct bchannel *bch; |
1508 | 1508 | ||
1509 | if (rq->adr.channel > 2) | 1509 | if (rq->adr.channel == 0 || rq->adr.channel > 2) |
1510 | return -EINVAL; | 1510 | return -EINVAL; |
1511 | if (rq->protocol == ISDN_P_NONE) | 1511 | if (rq->protocol == ISDN_P_NONE) |
1512 | return -EINVAL; | 1512 | return -EINVAL; |
diff --git a/drivers/isdn/hardware/mISDN/mISDNisar.c b/drivers/isdn/hardware/mISDN/mISDNisar.c index 10446ab404b5..9a6da6edcfa8 100644 --- a/drivers/isdn/hardware/mISDN/mISDNisar.c +++ b/drivers/isdn/hardware/mISDN/mISDNisar.c | |||
@@ -1670,7 +1670,7 @@ isar_open(struct isar_hw *isar, struct channel_req *rq) | |||
1670 | { | 1670 | { |
1671 | struct bchannel *bch; | 1671 | struct bchannel *bch; |
1672 | 1672 | ||
1673 | if (rq->adr.channel > 2) | 1673 | if (rq->adr.channel == 0 || rq->adr.channel > 2) |
1674 | return -EINVAL; | 1674 | return -EINVAL; |
1675 | if (rq->protocol == ISDN_P_NONE) | 1675 | if (rq->protocol == ISDN_P_NONE) |
1676 | return -EINVAL; | 1676 | return -EINVAL; |
diff --git a/drivers/isdn/hardware/mISDN/netjet.c b/drivers/isdn/hardware/mISDN/netjet.c index dd6de9f7a8a3..c726e09d0981 100644 --- a/drivers/isdn/hardware/mISDN/netjet.c +++ b/drivers/isdn/hardware/mISDN/netjet.c | |||
@@ -860,7 +860,7 @@ open_bchannel(struct tiger_hw *card, struct channel_req *rq) | |||
860 | { | 860 | { |
861 | struct bchannel *bch; | 861 | struct bchannel *bch; |
862 | 862 | ||
863 | if (rq->adr.channel > 2) | 863 | if (rq->adr.channel == 0 || rq->adr.channel > 2) |
864 | return -EINVAL; | 864 | return -EINVAL; |
865 | if (rq->protocol == ISDN_P_NONE) | 865 | if (rq->protocol == ISDN_P_NONE) |
866 | return -EINVAL; | 866 | return -EINVAL; |
diff --git a/drivers/isdn/hardware/mISDN/w6692.c b/drivers/isdn/hardware/mISDN/w6692.c index 7f1e7ba75cd1..2183357f0799 100644 --- a/drivers/isdn/hardware/mISDN/w6692.c +++ b/drivers/isdn/hardware/mISDN/w6692.c | |||
@@ -1015,7 +1015,7 @@ open_bchannel(struct w6692_hw *card, struct channel_req *rq) | |||
1015 | { | 1015 | { |
1016 | struct bchannel *bch; | 1016 | struct bchannel *bch; |
1017 | 1017 | ||
1018 | if (rq->adr.channel > 2) | 1018 | if (rq->adr.channel == 0 || rq->adr.channel > 2) |
1019 | return -EINVAL; | 1019 | return -EINVAL; |
1020 | if (rq->protocol == ISDN_P_NONE) | 1020 | if (rq->protocol == ISDN_P_NONE) |
1021 | return -EINVAL; | 1021 | return -EINVAL; |
diff --git a/drivers/md/linear.c b/drivers/md/linear.c index b0fcc7d02adb..fa211d80fc0a 100644 --- a/drivers/md/linear.c +++ b/drivers/md/linear.c | |||
@@ -198,6 +198,7 @@ out: | |||
198 | static int linear_run (struct mddev *mddev) | 198 | static int linear_run (struct mddev *mddev) |
199 | { | 199 | { |
200 | struct linear_conf *conf; | 200 | struct linear_conf *conf; |
201 | int ret; | ||
201 | 202 | ||
202 | if (md_check_no_bitmap(mddev)) | 203 | if (md_check_no_bitmap(mddev)) |
203 | return -EINVAL; | 204 | return -EINVAL; |
@@ -211,7 +212,13 @@ static int linear_run (struct mddev *mddev) | |||
211 | blk_queue_merge_bvec(mddev->queue, linear_mergeable_bvec); | 212 | blk_queue_merge_bvec(mddev->queue, linear_mergeable_bvec); |
212 | mddev->queue->backing_dev_info.congested_fn = linear_congested; | 213 | mddev->queue->backing_dev_info.congested_fn = linear_congested; |
213 | mddev->queue->backing_dev_info.congested_data = mddev; | 214 | mddev->queue->backing_dev_info.congested_data = mddev; |
214 | return md_integrity_register(mddev); | 215 | |
216 | ret = md_integrity_register(mddev); | ||
217 | if (ret) { | ||
218 | kfree(conf); | ||
219 | mddev->private = NULL; | ||
220 | } | ||
221 | return ret; | ||
215 | } | 222 | } |
216 | 223 | ||
217 | static int linear_add(struct mddev *mddev, struct md_rdev *rdev) | 224 | static int linear_add(struct mddev *mddev, struct md_rdev *rdev) |
diff --git a/drivers/md/raid0.c b/drivers/md/raid0.c index 6f31f5596e01..de63a1fc3737 100644 --- a/drivers/md/raid0.c +++ b/drivers/md/raid0.c | |||
@@ -407,6 +407,8 @@ static sector_t raid0_size(struct mddev *mddev, sector_t sectors, int raid_disks | |||
407 | return array_sectors; | 407 | return array_sectors; |
408 | } | 408 | } |
409 | 409 | ||
410 | static int raid0_stop(struct mddev *mddev); | ||
411 | |||
410 | static int raid0_run(struct mddev *mddev) | 412 | static int raid0_run(struct mddev *mddev) |
411 | { | 413 | { |
412 | struct r0conf *conf; | 414 | struct r0conf *conf; |
@@ -454,7 +456,12 @@ static int raid0_run(struct mddev *mddev) | |||
454 | 456 | ||
455 | blk_queue_merge_bvec(mddev->queue, raid0_mergeable_bvec); | 457 | blk_queue_merge_bvec(mddev->queue, raid0_mergeable_bvec); |
456 | dump_zones(mddev); | 458 | dump_zones(mddev); |
457 | return md_integrity_register(mddev); | 459 | |
460 | ret = md_integrity_register(mddev); | ||
461 | if (ret) | ||
462 | raid0_stop(mddev); | ||
463 | |||
464 | return ret; | ||
458 | } | 465 | } |
459 | 466 | ||
460 | static int raid0_stop(struct mddev *mddev) | 467 | static int raid0_stop(struct mddev *mddev) |
@@ -625,6 +632,7 @@ static void *raid0_takeover_raid10(struct mddev *mddev) | |||
625 | static void *raid0_takeover_raid1(struct mddev *mddev) | 632 | static void *raid0_takeover_raid1(struct mddev *mddev) |
626 | { | 633 | { |
627 | struct r0conf *priv_conf; | 634 | struct r0conf *priv_conf; |
635 | int chunksect; | ||
628 | 636 | ||
629 | /* Check layout: | 637 | /* Check layout: |
630 | * - (N - 1) mirror drives must be already faulty | 638 | * - (N - 1) mirror drives must be already faulty |
@@ -635,10 +643,25 @@ static void *raid0_takeover_raid1(struct mddev *mddev) | |||
635 | return ERR_PTR(-EINVAL); | 643 | return ERR_PTR(-EINVAL); |
636 | } | 644 | } |
637 | 645 | ||
646 | /* | ||
647 | * a raid1 doesn't have the notion of chunk size, so | ||
648 | * figure out the largest suitable size we can use. | ||
649 | */ | ||
650 | chunksect = 64 * 2; /* 64K by default */ | ||
651 | |||
652 | /* The array must be an exact multiple of chunksize */ | ||
653 | while (chunksect && (mddev->array_sectors & (chunksect - 1))) | ||
654 | chunksect >>= 1; | ||
655 | |||
656 | if ((chunksect << 9) < PAGE_SIZE) | ||
657 | /* array size does not allow a suitable chunk size */ | ||
658 | return ERR_PTR(-EINVAL); | ||
659 | |||
638 | /* Set new parameters */ | 660 | /* Set new parameters */ |
639 | mddev->new_level = 0; | 661 | mddev->new_level = 0; |
640 | mddev->new_layout = 0; | 662 | mddev->new_layout = 0; |
641 | mddev->new_chunk_sectors = 128; /* by default set chunk size to 64k */ | 663 | mddev->new_chunk_sectors = chunksect; |
664 | mddev->chunk_sectors = chunksect; | ||
642 | mddev->delta_disks = 1 - mddev->raid_disks; | 665 | mddev->delta_disks = 1 - mddev->raid_disks; |
643 | mddev->raid_disks = 1; | 666 | mddev->raid_disks = 1; |
644 | /* make sure it will be not marked as dirty */ | 667 | /* make sure it will be not marked as dirty */ |
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index 4a40a200d769..d35e4c991e38 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c | |||
@@ -1738,7 +1738,7 @@ static int process_checks(struct r1bio *r1_bio) | |||
1738 | s = sbio->bi_io_vec[j].bv_page; | 1738 | s = sbio->bi_io_vec[j].bv_page; |
1739 | if (memcmp(page_address(p), | 1739 | if (memcmp(page_address(p), |
1740 | page_address(s), | 1740 | page_address(s), |
1741 | PAGE_SIZE)) | 1741 | sbio->bi_io_vec[j].bv_len)) |
1742 | break; | 1742 | break; |
1743 | } | 1743 | } |
1744 | } else | 1744 | } else |
@@ -2386,8 +2386,7 @@ static sector_t sync_request(struct mddev *mddev, sector_t sector_nr, int *skipp | |||
2386 | int ok = 1; | 2386 | int ok = 1; |
2387 | for (i = 0 ; i < conf->raid_disks * 2 ; i++) | 2387 | for (i = 0 ; i < conf->raid_disks * 2 ; i++) |
2388 | if (r1_bio->bios[i]->bi_end_io == end_sync_write) { | 2388 | if (r1_bio->bios[i]->bi_end_io == end_sync_write) { |
2389 | struct md_rdev *rdev = | 2389 | struct md_rdev *rdev = conf->mirrors[i].rdev; |
2390 | rcu_dereference(conf->mirrors[i].rdev); | ||
2391 | ok = rdev_set_badblocks(rdev, sector_nr, | 2390 | ok = rdev_set_badblocks(rdev, sector_nr, |
2392 | min_bad, 0 | 2391 | min_bad, 0 |
2393 | ) && ok; | 2392 | ) && ok; |
@@ -2636,11 +2635,13 @@ static struct r1conf *setup_conf(struct mddev *mddev) | |||
2636 | return ERR_PTR(err); | 2635 | return ERR_PTR(err); |
2637 | } | 2636 | } |
2638 | 2637 | ||
2638 | static int stop(struct mddev *mddev); | ||
2639 | static int run(struct mddev *mddev) | 2639 | static int run(struct mddev *mddev) |
2640 | { | 2640 | { |
2641 | struct r1conf *conf; | 2641 | struct r1conf *conf; |
2642 | int i; | 2642 | int i; |
2643 | struct md_rdev *rdev; | 2643 | struct md_rdev *rdev; |
2644 | int ret; | ||
2644 | 2645 | ||
2645 | if (mddev->level != 1) { | 2646 | if (mddev->level != 1) { |
2646 | printk(KERN_ERR "md/raid1:%s: raid level not set to mirroring (%d)\n", | 2647 | printk(KERN_ERR "md/raid1:%s: raid level not set to mirroring (%d)\n", |
@@ -2705,7 +2706,11 @@ static int run(struct mddev *mddev) | |||
2705 | mddev->queue->backing_dev_info.congested_data = mddev; | 2706 | mddev->queue->backing_dev_info.congested_data = mddev; |
2706 | blk_queue_merge_bvec(mddev->queue, raid1_mergeable_bvec); | 2707 | blk_queue_merge_bvec(mddev->queue, raid1_mergeable_bvec); |
2707 | } | 2708 | } |
2708 | return md_integrity_register(mddev); | 2709 | |
2710 | ret = md_integrity_register(mddev); | ||
2711 | if (ret) | ||
2712 | stop(mddev); | ||
2713 | return ret; | ||
2709 | } | 2714 | } |
2710 | 2715 | ||
2711 | static int stop(struct mddev *mddev) | 2716 | static int stop(struct mddev *mddev) |
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c index 3540316886f2..fff782189e48 100644 --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c | |||
@@ -1821,7 +1821,7 @@ static void sync_request_write(struct mddev *mddev, struct r10bio *r10_bio) | |||
1821 | for (j = 0; j < vcnt; j++) | 1821 | for (j = 0; j < vcnt; j++) |
1822 | if (memcmp(page_address(fbio->bi_io_vec[j].bv_page), | 1822 | if (memcmp(page_address(fbio->bi_io_vec[j].bv_page), |
1823 | page_address(tbio->bi_io_vec[j].bv_page), | 1823 | page_address(tbio->bi_io_vec[j].bv_page), |
1824 | PAGE_SIZE)) | 1824 | fbio->bi_io_vec[j].bv_len)) |
1825 | break; | 1825 | break; |
1826 | if (j == vcnt) | 1826 | if (j == vcnt) |
1827 | continue; | 1827 | continue; |
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index 23ac880bba9a..f351422938e0 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c | |||
@@ -2471,39 +2471,41 @@ handle_failed_sync(struct r5conf *conf, struct stripe_head *sh, | |||
2471 | int abort = 0; | 2471 | int abort = 0; |
2472 | int i; | 2472 | int i; |
2473 | 2473 | ||
2474 | md_done_sync(conf->mddev, STRIPE_SECTORS, 0); | ||
2475 | clear_bit(STRIPE_SYNCING, &sh->state); | 2474 | clear_bit(STRIPE_SYNCING, &sh->state); |
2476 | s->syncing = 0; | 2475 | s->syncing = 0; |
2477 | s->replacing = 0; | 2476 | s->replacing = 0; |
2478 | /* There is nothing more to do for sync/check/repair. | 2477 | /* There is nothing more to do for sync/check/repair. |
2478 | * Don't even need to abort as that is handled elsewhere | ||
2479 | * if needed, and not always wanted e.g. if there is a known | ||
2480 | * bad block here. | ||
2479 | * For recover/replace we need to record a bad block on all | 2481 | * For recover/replace we need to record a bad block on all |
2480 | * non-sync devices, or abort the recovery | 2482 | * non-sync devices, or abort the recovery |
2481 | */ | 2483 | */ |
2482 | if (!test_bit(MD_RECOVERY_RECOVER, &conf->mddev->recovery)) | 2484 | if (test_bit(MD_RECOVERY_RECOVER, &conf->mddev->recovery)) { |
2483 | return; | 2485 | /* During recovery devices cannot be removed, so |
2484 | /* During recovery devices cannot be removed, so locking and | 2486 | * locking and refcounting of rdevs is not needed |
2485 | * refcounting of rdevs is not needed | 2487 | */ |
2486 | */ | 2488 | for (i = 0; i < conf->raid_disks; i++) { |
2487 | for (i = 0; i < conf->raid_disks; i++) { | 2489 | struct md_rdev *rdev = conf->disks[i].rdev; |
2488 | struct md_rdev *rdev = conf->disks[i].rdev; | 2490 | if (rdev |
2489 | if (rdev | 2491 | && !test_bit(Faulty, &rdev->flags) |
2490 | && !test_bit(Faulty, &rdev->flags) | 2492 | && !test_bit(In_sync, &rdev->flags) |
2491 | && !test_bit(In_sync, &rdev->flags) | 2493 | && !rdev_set_badblocks(rdev, sh->sector, |
2492 | && !rdev_set_badblocks(rdev, sh->sector, | 2494 | STRIPE_SECTORS, 0)) |
2493 | STRIPE_SECTORS, 0)) | 2495 | abort = 1; |
2494 | abort = 1; | 2496 | rdev = conf->disks[i].replacement; |
2495 | rdev = conf->disks[i].replacement; | 2497 | if (rdev |
2496 | if (rdev | 2498 | && !test_bit(Faulty, &rdev->flags) |
2497 | && !test_bit(Faulty, &rdev->flags) | 2499 | && !test_bit(In_sync, &rdev->flags) |
2498 | && !test_bit(In_sync, &rdev->flags) | 2500 | && !rdev_set_badblocks(rdev, sh->sector, |
2499 | && !rdev_set_badblocks(rdev, sh->sector, | 2501 | STRIPE_SECTORS, 0)) |
2500 | STRIPE_SECTORS, 0)) | 2502 | abort = 1; |
2501 | abort = 1; | 2503 | } |
2502 | } | 2504 | if (abort) |
2503 | if (abort) { | 2505 | conf->recovery_disabled = |
2504 | conf->recovery_disabled = conf->mddev->recovery_disabled; | 2506 | conf->mddev->recovery_disabled; |
2505 | set_bit(MD_RECOVERY_INTR, &conf->mddev->recovery); | ||
2506 | } | 2507 | } |
2508 | md_done_sync(conf->mddev, STRIPE_SECTORS, !abort); | ||
2507 | } | 2509 | } |
2508 | 2510 | ||
2509 | static int want_replace(struct stripe_head *sh, int disk_idx) | 2511 | static int want_replace(struct stripe_head *sh, int disk_idx) |
@@ -3203,7 +3205,8 @@ static void analyse_stripe(struct stripe_head *sh, struct stripe_head_state *s) | |||
3203 | /* Not in-sync */; | 3205 | /* Not in-sync */; |
3204 | else if (is_bad) { | 3206 | else if (is_bad) { |
3205 | /* also not in-sync */ | 3207 | /* also not in-sync */ |
3206 | if (!test_bit(WriteErrorSeen, &rdev->flags)) { | 3208 | if (!test_bit(WriteErrorSeen, &rdev->flags) && |
3209 | test_bit(R5_UPTODATE, &dev->flags)) { | ||
3207 | /* treat as in-sync, but with a read error | 3210 | /* treat as in-sync, but with a read error |
3208 | * which we can now try to correct | 3211 | * which we can now try to correct |
3209 | */ | 3212 | */ |
@@ -3276,12 +3279,14 @@ static void analyse_stripe(struct stripe_head *sh, struct stripe_head_state *s) | |||
3276 | /* If there is a failed device being replaced, | 3279 | /* If there is a failed device being replaced, |
3277 | * we must be recovering. | 3280 | * we must be recovering. |
3278 | * else if we are after recovery_cp, we must be syncing | 3281 | * else if we are after recovery_cp, we must be syncing |
3282 | * else if MD_RECOVERY_REQUESTED is set, we also are syncing. | ||
3279 | * else we can only be replacing | 3283 | * else we can only be replacing |
3280 | * sync and recovery both need to read all devices, and so | 3284 | * sync and recovery both need to read all devices, and so |
3281 | * use the same flag. | 3285 | * use the same flag. |
3282 | */ | 3286 | */ |
3283 | if (do_recovery || | 3287 | if (do_recovery || |
3284 | sh->sector >= conf->mddev->recovery_cp) | 3288 | sh->sector >= conf->mddev->recovery_cp || |
3289 | test_bit(MD_RECOVERY_REQUESTED, &(conf->mddev->recovery))) | ||
3285 | s->syncing = 1; | 3290 | s->syncing = 1; |
3286 | else | 3291 | else |
3287 | s->replacing = 1; | 3292 | s->replacing = 1; |
diff --git a/drivers/mfd/aat2870-core.c b/drivers/mfd/aat2870-core.c index 3aa36eb5c79b..44a3fdbadef4 100644 --- a/drivers/mfd/aat2870-core.c +++ b/drivers/mfd/aat2870-core.c | |||
@@ -262,13 +262,6 @@ static ssize_t aat2870_dump_reg(struct aat2870_data *aat2870, char *buf) | |||
262 | return count; | 262 | return count; |
263 | } | 263 | } |
264 | 264 | ||
265 | static int aat2870_reg_open_file(struct inode *inode, struct file *file) | ||
266 | { | ||
267 | file->private_data = inode->i_private; | ||
268 | |||
269 | return 0; | ||
270 | } | ||
271 | |||
272 | static ssize_t aat2870_reg_read_file(struct file *file, char __user *user_buf, | 265 | static ssize_t aat2870_reg_read_file(struct file *file, char __user *user_buf, |
273 | size_t count, loff_t *ppos) | 266 | size_t count, loff_t *ppos) |
274 | { | 267 | { |
@@ -330,7 +323,7 @@ static ssize_t aat2870_reg_write_file(struct file *file, | |||
330 | } | 323 | } |
331 | 324 | ||
332 | static const struct file_operations aat2870_reg_fops = { | 325 | static const struct file_operations aat2870_reg_fops = { |
333 | .open = aat2870_reg_open_file, | 326 | .open = simple_open, |
334 | .read = aat2870_reg_read_file, | 327 | .read = aat2870_reg_read_file, |
335 | .write = aat2870_reg_write_file, | 328 | .write = aat2870_reg_write_file, |
336 | }; | 329 | }; |
diff --git a/drivers/mfd/ab3100-core.c b/drivers/mfd/ab3100-core.c index 60107ee166fc..1efad20fb175 100644 --- a/drivers/mfd/ab3100-core.c +++ b/drivers/mfd/ab3100-core.c | |||
@@ -483,12 +483,6 @@ struct ab3100_get_set_reg_priv { | |||
483 | bool mode; | 483 | bool mode; |
484 | }; | 484 | }; |
485 | 485 | ||
486 | static int ab3100_get_set_reg_open_file(struct inode *inode, struct file *file) | ||
487 | { | ||
488 | file->private_data = inode->i_private; | ||
489 | return 0; | ||
490 | } | ||
491 | |||
492 | static ssize_t ab3100_get_set_reg(struct file *file, | 486 | static ssize_t ab3100_get_set_reg(struct file *file, |
493 | const char __user *user_buf, | 487 | const char __user *user_buf, |
494 | size_t count, loff_t *ppos) | 488 | size_t count, loff_t *ppos) |
@@ -583,7 +577,7 @@ static ssize_t ab3100_get_set_reg(struct file *file, | |||
583 | } | 577 | } |
584 | 578 | ||
585 | static const struct file_operations ab3100_get_set_reg_fops = { | 579 | static const struct file_operations ab3100_get_set_reg_fops = { |
586 | .open = ab3100_get_set_reg_open_file, | 580 | .open = simple_open, |
587 | .write = ab3100_get_set_reg, | 581 | .write = ab3100_get_set_reg, |
588 | .llseek = noop_llseek, | 582 | .llseek = noop_llseek, |
589 | }; | 583 | }; |
diff --git a/drivers/misc/ibmasm/ibmasmfs.c b/drivers/misc/ibmasm/ibmasmfs.c index 1c034b80d408..6673e578b3e9 100644 --- a/drivers/misc/ibmasm/ibmasmfs.c +++ b/drivers/misc/ibmasm/ibmasmfs.c | |||
@@ -500,12 +500,6 @@ static ssize_t r_heartbeat_file_write(struct file *file, const char __user *buf, | |||
500 | return 1; | 500 | return 1; |
501 | } | 501 | } |
502 | 502 | ||
503 | static int remote_settings_file_open(struct inode *inode, struct file *file) | ||
504 | { | ||
505 | file->private_data = inode->i_private; | ||
506 | return 0; | ||
507 | } | ||
508 | |||
509 | static int remote_settings_file_close(struct inode *inode, struct file *file) | 503 | static int remote_settings_file_close(struct inode *inode, struct file *file) |
510 | { | 504 | { |
511 | return 0; | 505 | return 0; |
@@ -600,7 +594,7 @@ static const struct file_operations r_heartbeat_fops = { | |||
600 | }; | 594 | }; |
601 | 595 | ||
602 | static const struct file_operations remote_settings_fops = { | 596 | static const struct file_operations remote_settings_fops = { |
603 | .open = remote_settings_file_open, | 597 | .open = simple_open, |
604 | .release = remote_settings_file_close, | 598 | .release = remote_settings_file_close, |
605 | .read = remote_settings_file_read, | 599 | .read = remote_settings_file_read, |
606 | .write = remote_settings_file_write, | 600 | .write = remote_settings_file_write, |
diff --git a/drivers/misc/kgdbts.c b/drivers/misc/kgdbts.c index 3f7ad83ed740..3aa9a969b373 100644 --- a/drivers/misc/kgdbts.c +++ b/drivers/misc/kgdbts.c | |||
@@ -134,12 +134,17 @@ static int force_hwbrks; | |||
134 | static int hwbreaks_ok; | 134 | static int hwbreaks_ok; |
135 | static int hw_break_val; | 135 | static int hw_break_val; |
136 | static int hw_break_val2; | 136 | static int hw_break_val2; |
137 | static int cont_instead_of_sstep; | ||
138 | static unsigned long cont_thread_id; | ||
139 | static unsigned long sstep_thread_id; | ||
137 | #if defined(CONFIG_ARM) || defined(CONFIG_MIPS) || defined(CONFIG_SPARC) | 140 | #if defined(CONFIG_ARM) || defined(CONFIG_MIPS) || defined(CONFIG_SPARC) |
138 | static int arch_needs_sstep_emulation = 1; | 141 | static int arch_needs_sstep_emulation = 1; |
139 | #else | 142 | #else |
140 | static int arch_needs_sstep_emulation; | 143 | static int arch_needs_sstep_emulation; |
141 | #endif | 144 | #endif |
145 | static unsigned long cont_addr; | ||
142 | static unsigned long sstep_addr; | 146 | static unsigned long sstep_addr; |
147 | static int restart_from_top_after_write; | ||
143 | static int sstep_state; | 148 | static int sstep_state; |
144 | 149 | ||
145 | /* Storage for the registers, in GDB format. */ | 150 | /* Storage for the registers, in GDB format. */ |
@@ -187,7 +192,8 @@ static int kgdbts_unreg_thread(void *ptr) | |||
187 | */ | 192 | */ |
188 | while (!final_ack) | 193 | while (!final_ack) |
189 | msleep_interruptible(1500); | 194 | msleep_interruptible(1500); |
190 | 195 | /* Pause for any other threads to exit after final ack. */ | |
196 | msleep_interruptible(1000); | ||
191 | if (configured) | 197 | if (configured) |
192 | kgdb_unregister_io_module(&kgdbts_io_ops); | 198 | kgdb_unregister_io_module(&kgdbts_io_ops); |
193 | configured = 0; | 199 | configured = 0; |
@@ -211,7 +217,7 @@ static unsigned long lookup_addr(char *arg) | |||
211 | if (!strcmp(arg, "kgdbts_break_test")) | 217 | if (!strcmp(arg, "kgdbts_break_test")) |
212 | addr = (unsigned long)kgdbts_break_test; | 218 | addr = (unsigned long)kgdbts_break_test; |
213 | else if (!strcmp(arg, "sys_open")) | 219 | else if (!strcmp(arg, "sys_open")) |
214 | addr = (unsigned long)sys_open; | 220 | addr = (unsigned long)do_sys_open; |
215 | else if (!strcmp(arg, "do_fork")) | 221 | else if (!strcmp(arg, "do_fork")) |
216 | addr = (unsigned long)do_fork; | 222 | addr = (unsigned long)do_fork; |
217 | else if (!strcmp(arg, "hw_break_val")) | 223 | else if (!strcmp(arg, "hw_break_val")) |
@@ -283,6 +289,16 @@ static void hw_break_val_write(void) | |||
283 | hw_break_val++; | 289 | hw_break_val++; |
284 | } | 290 | } |
285 | 291 | ||
292 | static int get_thread_id_continue(char *put_str, char *arg) | ||
293 | { | ||
294 | char *ptr = &put_str[11]; | ||
295 | |||
296 | if (put_str[1] != 'T' || put_str[2] != '0') | ||
297 | return 1; | ||
298 | kgdb_hex2long(&ptr, &cont_thread_id); | ||
299 | return 0; | ||
300 | } | ||
301 | |||
286 | static int check_and_rewind_pc(char *put_str, char *arg) | 302 | static int check_and_rewind_pc(char *put_str, char *arg) |
287 | { | 303 | { |
288 | unsigned long addr = lookup_addr(arg); | 304 | unsigned long addr = lookup_addr(arg); |
@@ -299,13 +315,21 @@ static int check_and_rewind_pc(char *put_str, char *arg) | |||
299 | if (addr + BREAK_INSTR_SIZE == ip) | 315 | if (addr + BREAK_INSTR_SIZE == ip) |
300 | offset = -BREAK_INSTR_SIZE; | 316 | offset = -BREAK_INSTR_SIZE; |
301 | #endif | 317 | #endif |
302 | if (strcmp(arg, "silent") && ip + offset != addr) { | 318 | |
319 | if (arch_needs_sstep_emulation && sstep_addr && | ||
320 | ip + offset == sstep_addr && | ||
321 | ((!strcmp(arg, "sys_open") || !strcmp(arg, "do_fork")))) { | ||
322 | /* This is special case for emulated single step */ | ||
323 | v2printk("Emul: rewind hit single step bp\n"); | ||
324 | restart_from_top_after_write = 1; | ||
325 | } else if (strcmp(arg, "silent") && ip + offset != addr) { | ||
303 | eprintk("kgdbts: BP mismatch %lx expected %lx\n", | 326 | eprintk("kgdbts: BP mismatch %lx expected %lx\n", |
304 | ip + offset, addr); | 327 | ip + offset, addr); |
305 | return 1; | 328 | return 1; |
306 | } | 329 | } |
307 | /* Readjust the instruction pointer if needed */ | 330 | /* Readjust the instruction pointer if needed */ |
308 | ip += offset; | 331 | ip += offset; |
332 | cont_addr = ip; | ||
309 | #ifdef GDB_ADJUSTS_BREAK_OFFSET | 333 | #ifdef GDB_ADJUSTS_BREAK_OFFSET |
310 | instruction_pointer_set(&kgdbts_regs, ip); | 334 | instruction_pointer_set(&kgdbts_regs, ip); |
311 | #endif | 335 | #endif |
@@ -315,6 +339,8 @@ static int check_and_rewind_pc(char *put_str, char *arg) | |||
315 | static int check_single_step(char *put_str, char *arg) | 339 | static int check_single_step(char *put_str, char *arg) |
316 | { | 340 | { |
317 | unsigned long addr = lookup_addr(arg); | 341 | unsigned long addr = lookup_addr(arg); |
342 | static int matched_id; | ||
343 | |||
318 | /* | 344 | /* |
319 | * From an arch indepent point of view the instruction pointer | 345 | * From an arch indepent point of view the instruction pointer |
320 | * should be on a different instruction | 346 | * should be on a different instruction |
@@ -324,6 +350,29 @@ static int check_single_step(char *put_str, char *arg) | |||
324 | gdb_regs_to_pt_regs(kgdbts_gdb_regs, &kgdbts_regs); | 350 | gdb_regs_to_pt_regs(kgdbts_gdb_regs, &kgdbts_regs); |
325 | v2printk("Singlestep stopped at IP: %lx\n", | 351 | v2printk("Singlestep stopped at IP: %lx\n", |
326 | instruction_pointer(&kgdbts_regs)); | 352 | instruction_pointer(&kgdbts_regs)); |
353 | |||
354 | if (sstep_thread_id != cont_thread_id) { | ||
355 | /* | ||
356 | * Ensure we stopped in the same thread id as before, else the | ||
357 | * debugger should continue until the original thread that was | ||
358 | * single stepped is scheduled again, emulating gdb's behavior. | ||
359 | */ | ||
360 | v2printk("ThrID does not match: %lx\n", cont_thread_id); | ||
361 | if (arch_needs_sstep_emulation) { | ||
362 | if (matched_id && | ||
363 | instruction_pointer(&kgdbts_regs) != addr) | ||
364 | goto continue_test; | ||
365 | matched_id++; | ||
366 | ts.idx -= 2; | ||
367 | sstep_state = 0; | ||
368 | return 0; | ||
369 | } | ||
370 | cont_instead_of_sstep = 1; | ||
371 | ts.idx -= 4; | ||
372 | return 0; | ||
373 | } | ||
374 | continue_test: | ||
375 | matched_id = 0; | ||
327 | if (instruction_pointer(&kgdbts_regs) == addr) { | 376 | if (instruction_pointer(&kgdbts_regs) == addr) { |
328 | eprintk("kgdbts: SingleStep failed at %lx\n", | 377 | eprintk("kgdbts: SingleStep failed at %lx\n", |
329 | instruction_pointer(&kgdbts_regs)); | 378 | instruction_pointer(&kgdbts_regs)); |
@@ -365,10 +414,40 @@ static int got_break(char *put_str, char *arg) | |||
365 | return 1; | 414 | return 1; |
366 | } | 415 | } |
367 | 416 | ||
417 | static void get_cont_catch(char *arg) | ||
418 | { | ||
419 | /* Always send detach because the test is completed at this point */ | ||
420 | fill_get_buf("D"); | ||
421 | } | ||
422 | |||
423 | static int put_cont_catch(char *put_str, char *arg) | ||
424 | { | ||
425 | /* This is at the end of the test and we catch any and all input */ | ||
426 | v2printk("kgdbts: cleanup task: %lx\n", sstep_thread_id); | ||
427 | ts.idx--; | ||
428 | return 0; | ||
429 | } | ||
430 | |||
431 | static int emul_reset(char *put_str, char *arg) | ||
432 | { | ||
433 | if (strncmp(put_str, "$OK", 3)) | ||
434 | return 1; | ||
435 | if (restart_from_top_after_write) { | ||
436 | restart_from_top_after_write = 0; | ||
437 | ts.idx = -1; | ||
438 | } | ||
439 | return 0; | ||
440 | } | ||
441 | |||
368 | static void emul_sstep_get(char *arg) | 442 | static void emul_sstep_get(char *arg) |
369 | { | 443 | { |
370 | if (!arch_needs_sstep_emulation) { | 444 | if (!arch_needs_sstep_emulation) { |
371 | fill_get_buf(arg); | 445 | if (cont_instead_of_sstep) { |
446 | cont_instead_of_sstep = 0; | ||
447 | fill_get_buf("c"); | ||
448 | } else { | ||
449 | fill_get_buf(arg); | ||
450 | } | ||
372 | return; | 451 | return; |
373 | } | 452 | } |
374 | switch (sstep_state) { | 453 | switch (sstep_state) { |
@@ -398,9 +477,11 @@ static void emul_sstep_get(char *arg) | |||
398 | static int emul_sstep_put(char *put_str, char *arg) | 477 | static int emul_sstep_put(char *put_str, char *arg) |
399 | { | 478 | { |
400 | if (!arch_needs_sstep_emulation) { | 479 | if (!arch_needs_sstep_emulation) { |
401 | if (!strncmp(put_str+1, arg, 2)) | 480 | char *ptr = &put_str[11]; |
402 | return 0; | 481 | if (put_str[1] != 'T' || put_str[2] != '0') |
403 | return 1; | 482 | return 1; |
483 | kgdb_hex2long(&ptr, &sstep_thread_id); | ||
484 | return 0; | ||
404 | } | 485 | } |
405 | switch (sstep_state) { | 486 | switch (sstep_state) { |
406 | case 1: | 487 | case 1: |
@@ -411,8 +492,7 @@ static int emul_sstep_put(char *put_str, char *arg) | |||
411 | v2printk("Stopped at IP: %lx\n", | 492 | v2printk("Stopped at IP: %lx\n", |
412 | instruction_pointer(&kgdbts_regs)); | 493 | instruction_pointer(&kgdbts_regs)); |
413 | /* Want to stop at IP + break instruction size by default */ | 494 | /* Want to stop at IP + break instruction size by default */ |
414 | sstep_addr = instruction_pointer(&kgdbts_regs) + | 495 | sstep_addr = cont_addr + BREAK_INSTR_SIZE; |
415 | BREAK_INSTR_SIZE; | ||
416 | break; | 496 | break; |
417 | case 2: | 497 | case 2: |
418 | if (strncmp(put_str, "$OK", 3)) { | 498 | if (strncmp(put_str, "$OK", 3)) { |
@@ -424,6 +504,9 @@ static int emul_sstep_put(char *put_str, char *arg) | |||
424 | if (strncmp(put_str, "$T0", 3)) { | 504 | if (strncmp(put_str, "$T0", 3)) { |
425 | eprintk("kgdbts: failed continue sstep\n"); | 505 | eprintk("kgdbts: failed continue sstep\n"); |
426 | return 1; | 506 | return 1; |
507 | } else { | ||
508 | char *ptr = &put_str[11]; | ||
509 | kgdb_hex2long(&ptr, &sstep_thread_id); | ||
427 | } | 510 | } |
428 | break; | 511 | break; |
429 | case 4: | 512 | case 4: |
@@ -502,10 +585,10 @@ static struct test_struct bad_read_test[] = { | |||
502 | static struct test_struct singlestep_break_test[] = { | 585 | static struct test_struct singlestep_break_test[] = { |
503 | { "?", "S0*" }, /* Clear break points */ | 586 | { "?", "S0*" }, /* Clear break points */ |
504 | { "kgdbts_break_test", "OK", sw_break, }, /* set sw breakpoint */ | 587 | { "kgdbts_break_test", "OK", sw_break, }, /* set sw breakpoint */ |
505 | { "c", "T0*", }, /* Continue */ | 588 | { "c", "T0*", NULL, get_thread_id_continue }, /* Continue */ |
589 | { "kgdbts_break_test", "OK", sw_rem_break }, /*remove breakpoint */ | ||
506 | { "g", "kgdbts_break_test", NULL, check_and_rewind_pc }, | 590 | { "g", "kgdbts_break_test", NULL, check_and_rewind_pc }, |
507 | { "write", "OK", write_regs }, /* Write registers */ | 591 | { "write", "OK", write_regs }, /* Write registers */ |
508 | { "kgdbts_break_test", "OK", sw_rem_break }, /*remove breakpoint */ | ||
509 | { "s", "T0*", emul_sstep_get, emul_sstep_put }, /* Single step */ | 592 | { "s", "T0*", emul_sstep_get, emul_sstep_put }, /* Single step */ |
510 | { "g", "kgdbts_break_test", NULL, check_single_step }, | 593 | { "g", "kgdbts_break_test", NULL, check_single_step }, |
511 | { "kgdbts_break_test", "OK", sw_break, }, /* set sw breakpoint */ | 594 | { "kgdbts_break_test", "OK", sw_break, }, /* set sw breakpoint */ |
@@ -523,16 +606,16 @@ static struct test_struct singlestep_break_test[] = { | |||
523 | static struct test_struct do_fork_test[] = { | 606 | static struct test_struct do_fork_test[] = { |
524 | { "?", "S0*" }, /* Clear break points */ | 607 | { "?", "S0*" }, /* Clear break points */ |
525 | { "do_fork", "OK", sw_break, }, /* set sw breakpoint */ | 608 | { "do_fork", "OK", sw_break, }, /* set sw breakpoint */ |
526 | { "c", "T0*", }, /* Continue */ | 609 | { "c", "T0*", NULL, get_thread_id_continue }, /* Continue */ |
527 | { "g", "do_fork", NULL, check_and_rewind_pc }, /* check location */ | ||
528 | { "write", "OK", write_regs }, /* Write registers */ | ||
529 | { "do_fork", "OK", sw_rem_break }, /*remove breakpoint */ | 610 | { "do_fork", "OK", sw_rem_break }, /*remove breakpoint */ |
611 | { "g", "do_fork", NULL, check_and_rewind_pc }, /* check location */ | ||
612 | { "write", "OK", write_regs, emul_reset }, /* Write registers */ | ||
530 | { "s", "T0*", emul_sstep_get, emul_sstep_put }, /* Single step */ | 613 | { "s", "T0*", emul_sstep_get, emul_sstep_put }, /* Single step */ |
531 | { "g", "do_fork", NULL, check_single_step }, | 614 | { "g", "do_fork", NULL, check_single_step }, |
532 | { "do_fork", "OK", sw_break, }, /* set sw breakpoint */ | 615 | { "do_fork", "OK", sw_break, }, /* set sw breakpoint */ |
533 | { "7", "T0*", skip_back_repeat_test }, /* Loop based on repeat_test */ | 616 | { "7", "T0*", skip_back_repeat_test }, /* Loop based on repeat_test */ |
534 | { "D", "OK", NULL, final_ack_set }, /* detach and unregister I/O */ | 617 | { "D", "OK", NULL, final_ack_set }, /* detach and unregister I/O */ |
535 | { "", "" }, | 618 | { "", "", get_cont_catch, put_cont_catch }, |
536 | }; | 619 | }; |
537 | 620 | ||
538 | /* Test for hitting a breakpoint at sys_open for what ever the number | 621 | /* Test for hitting a breakpoint at sys_open for what ever the number |
@@ -541,16 +624,16 @@ static struct test_struct do_fork_test[] = { | |||
541 | static struct test_struct sys_open_test[] = { | 624 | static struct test_struct sys_open_test[] = { |
542 | { "?", "S0*" }, /* Clear break points */ | 625 | { "?", "S0*" }, /* Clear break points */ |
543 | { "sys_open", "OK", sw_break, }, /* set sw breakpoint */ | 626 | { "sys_open", "OK", sw_break, }, /* set sw breakpoint */ |
544 | { "c", "T0*", }, /* Continue */ | 627 | { "c", "T0*", NULL, get_thread_id_continue }, /* Continue */ |
545 | { "g", "sys_open", NULL, check_and_rewind_pc }, /* check location */ | ||
546 | { "write", "OK", write_regs }, /* Write registers */ | ||
547 | { "sys_open", "OK", sw_rem_break }, /*remove breakpoint */ | 628 | { "sys_open", "OK", sw_rem_break }, /*remove breakpoint */ |
629 | { "g", "sys_open", NULL, check_and_rewind_pc }, /* check location */ | ||
630 | { "write", "OK", write_regs, emul_reset }, /* Write registers */ | ||
548 | { "s", "T0*", emul_sstep_get, emul_sstep_put }, /* Single step */ | 631 | { "s", "T0*", emul_sstep_get, emul_sstep_put }, /* Single step */ |
549 | { "g", "sys_open", NULL, check_single_step }, | 632 | { "g", "sys_open", NULL, check_single_step }, |
550 | { "sys_open", "OK", sw_break, }, /* set sw breakpoint */ | 633 | { "sys_open", "OK", sw_break, }, /* set sw breakpoint */ |
551 | { "7", "T0*", skip_back_repeat_test }, /* Loop based on repeat_test */ | 634 | { "7", "T0*", skip_back_repeat_test }, /* Loop based on repeat_test */ |
552 | { "D", "OK", NULL, final_ack_set }, /* detach and unregister I/O */ | 635 | { "D", "OK", NULL, final_ack_set }, /* detach and unregister I/O */ |
553 | { "", "" }, | 636 | { "", "", get_cont_catch, put_cont_catch }, |
554 | }; | 637 | }; |
555 | 638 | ||
556 | /* | 639 | /* |
@@ -693,8 +776,8 @@ static int run_simple_test(int is_get_char, int chr) | |||
693 | /* This callback is a put char which is when kgdb sends data to | 776 | /* This callback is a put char which is when kgdb sends data to |
694 | * this I/O module. | 777 | * this I/O module. |
695 | */ | 778 | */ |
696 | if (ts.tst[ts.idx].get[0] == '\0' && | 779 | if (ts.tst[ts.idx].get[0] == '\0' && ts.tst[ts.idx].put[0] == '\0' && |
697 | ts.tst[ts.idx].put[0] == '\0') { | 780 | !ts.tst[ts.idx].get_handler) { |
698 | eprintk("kgdbts: ERROR: beyond end of test on" | 781 | eprintk("kgdbts: ERROR: beyond end of test on" |
699 | " '%s' line %i\n", ts.name, ts.idx); | 782 | " '%s' line %i\n", ts.name, ts.idx); |
700 | return 0; | 783 | return 0; |
@@ -907,6 +990,17 @@ static void kgdbts_run_tests(void) | |||
907 | if (ptr) | 990 | if (ptr) |
908 | sstep_test = simple_strtol(ptr+1, NULL, 10); | 991 | sstep_test = simple_strtol(ptr+1, NULL, 10); |
909 | 992 | ||
993 | /* All HW break point tests */ | ||
994 | if (arch_kgdb_ops.flags & KGDB_HW_BREAKPOINT) { | ||
995 | hwbreaks_ok = 1; | ||
996 | v1printk("kgdbts:RUN hw breakpoint test\n"); | ||
997 | run_breakpoint_test(1); | ||
998 | v1printk("kgdbts:RUN hw write breakpoint test\n"); | ||
999 | run_hw_break_test(1); | ||
1000 | v1printk("kgdbts:RUN access write breakpoint test\n"); | ||
1001 | run_hw_break_test(0); | ||
1002 | } | ||
1003 | |||
910 | /* required internal KGDB tests */ | 1004 | /* required internal KGDB tests */ |
911 | v1printk("kgdbts:RUN plant and detach test\n"); | 1005 | v1printk("kgdbts:RUN plant and detach test\n"); |
912 | run_plant_and_detach_test(0); | 1006 | run_plant_and_detach_test(0); |
@@ -924,35 +1018,11 @@ static void kgdbts_run_tests(void) | |||
924 | 1018 | ||
925 | /* ===Optional tests=== */ | 1019 | /* ===Optional tests=== */ |
926 | 1020 | ||
927 | /* All HW break point tests */ | ||
928 | if (arch_kgdb_ops.flags & KGDB_HW_BREAKPOINT) { | ||
929 | hwbreaks_ok = 1; | ||
930 | v1printk("kgdbts:RUN hw breakpoint test\n"); | ||
931 | run_breakpoint_test(1); | ||
932 | v1printk("kgdbts:RUN hw write breakpoint test\n"); | ||
933 | run_hw_break_test(1); | ||
934 | v1printk("kgdbts:RUN access write breakpoint test\n"); | ||
935 | run_hw_break_test(0); | ||
936 | } | ||
937 | |||
938 | if (nmi_sleep) { | 1021 | if (nmi_sleep) { |
939 | v1printk("kgdbts:RUN NMI sleep %i seconds test\n", nmi_sleep); | 1022 | v1printk("kgdbts:RUN NMI sleep %i seconds test\n", nmi_sleep); |
940 | run_nmi_sleep_test(nmi_sleep); | 1023 | run_nmi_sleep_test(nmi_sleep); |
941 | } | 1024 | } |
942 | 1025 | ||
943 | #ifdef CONFIG_DEBUG_RODATA | ||
944 | /* Until there is an api to write to read-only text segments, use | ||
945 | * HW breakpoints for the remainder of any tests, else print a | ||
946 | * failure message if hw breakpoints do not work. | ||
947 | */ | ||
948 | if (!(arch_kgdb_ops.flags & KGDB_HW_BREAKPOINT && hwbreaks_ok)) { | ||
949 | eprintk("kgdbts: HW breakpoints do not work," | ||
950 | "skipping remaining tests\n"); | ||
951 | return; | ||
952 | } | ||
953 | force_hwbrks = 1; | ||
954 | #endif /* CONFIG_DEBUG_RODATA */ | ||
955 | |||
956 | /* If the do_fork test is run it will be the last test that is | 1026 | /* If the do_fork test is run it will be the last test that is |
957 | * executed because a kernel thread will be spawned at the very | 1027 | * executed because a kernel thread will be spawned at the very |
958 | * end to unregister the debug hooks. | 1028 | * end to unregister the debug hooks. |
diff --git a/drivers/mtd/ubi/debug.c b/drivers/mtd/ubi/debug.c index e2cdebf40840..61af9bb560ab 100644 --- a/drivers/mtd/ubi/debug.c +++ b/drivers/mtd/ubi/debug.c | |||
@@ -386,19 +386,11 @@ out: | |||
386 | return count; | 386 | return count; |
387 | } | 387 | } |
388 | 388 | ||
389 | static int default_open(struct inode *inode, struct file *file) | ||
390 | { | ||
391 | if (inode->i_private) | ||
392 | file->private_data = inode->i_private; | ||
393 | |||
394 | return 0; | ||
395 | } | ||
396 | |||
397 | /* File operations for all UBI debugfs files */ | 389 | /* File operations for all UBI debugfs files */ |
398 | static const struct file_operations dfs_fops = { | 390 | static const struct file_operations dfs_fops = { |
399 | .read = dfs_file_read, | 391 | .read = dfs_file_read, |
400 | .write = dfs_file_write, | 392 | .write = dfs_file_write, |
401 | .open = default_open, | 393 | .open = simple_open, |
402 | .llseek = no_llseek, | 394 | .llseek = no_llseek, |
403 | .owner = THIS_MODULE, | 395 | .owner = THIS_MODULE, |
404 | }; | 396 | }; |
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index 0c76186bb9e7..62d2409bb293 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c | |||
@@ -891,9 +891,15 @@ static void bond_do_fail_over_mac(struct bonding *bond, | |||
891 | 891 | ||
892 | switch (bond->params.fail_over_mac) { | 892 | switch (bond->params.fail_over_mac) { |
893 | case BOND_FOM_ACTIVE: | 893 | case BOND_FOM_ACTIVE: |
894 | if (new_active) | 894 | if (new_active) { |
895 | memcpy(bond->dev->dev_addr, new_active->dev->dev_addr, | 895 | memcpy(bond->dev->dev_addr, new_active->dev->dev_addr, |
896 | new_active->dev->addr_len); | 896 | new_active->dev->addr_len); |
897 | write_unlock_bh(&bond->curr_slave_lock); | ||
898 | read_unlock(&bond->lock); | ||
899 | call_netdevice_notifiers(NETDEV_CHANGEADDR, bond->dev); | ||
900 | read_lock(&bond->lock); | ||
901 | write_lock_bh(&bond->curr_slave_lock); | ||
902 | } | ||
897 | break; | 903 | break; |
898 | case BOND_FOM_FOLLOW: | 904 | case BOND_FOM_FOLLOW: |
899 | /* | 905 | /* |
@@ -2028,6 +2034,9 @@ int bond_release(struct net_device *bond_dev, struct net_device *slave_dev) | |||
2028 | write_unlock_bh(&bond->lock); | 2034 | write_unlock_bh(&bond->lock); |
2029 | unblock_netpoll_tx(); | 2035 | unblock_netpoll_tx(); |
2030 | 2036 | ||
2037 | if (bond->slave_cnt == 0) | ||
2038 | call_netdevice_notifiers(NETDEV_CHANGEADDR, bond->dev); | ||
2039 | |||
2031 | bond_compute_features(bond); | 2040 | bond_compute_features(bond); |
2032 | if (!(bond_dev->features & NETIF_F_VLAN_CHALLENGED) && | 2041 | if (!(bond_dev->features & NETIF_F_VLAN_CHALLENGED) && |
2033 | (old_features & NETIF_F_VLAN_CHALLENGED)) | 2042 | (old_features & NETIF_F_VLAN_CHALLENGED)) |
@@ -3001,7 +3010,11 @@ static void bond_ab_arp_commit(struct bonding *bond, int delta_in_ticks) | |||
3001 | trans_start + delta_in_ticks)) || | 3010 | trans_start + delta_in_ticks)) || |
3002 | bond->curr_active_slave != slave) { | 3011 | bond->curr_active_slave != slave) { |
3003 | slave->link = BOND_LINK_UP; | 3012 | slave->link = BOND_LINK_UP; |
3004 | bond->current_arp_slave = NULL; | 3013 | if (bond->current_arp_slave) { |
3014 | bond_set_slave_inactive_flags( | ||
3015 | bond->current_arp_slave); | ||
3016 | bond->current_arp_slave = NULL; | ||
3017 | } | ||
3005 | 3018 | ||
3006 | pr_info("%s: link status definitely up for interface %s.\n", | 3019 | pr_info("%s: link status definitely up for interface %s.\n", |
3007 | bond->dev->name, slave->dev->name); | 3020 | bond->dev->name, slave->dev->name); |
@@ -3695,17 +3708,52 @@ static void bond_set_multicast_list(struct net_device *bond_dev) | |||
3695 | read_unlock(&bond->lock); | 3708 | read_unlock(&bond->lock); |
3696 | } | 3709 | } |
3697 | 3710 | ||
3698 | static int bond_neigh_setup(struct net_device *dev, struct neigh_parms *parms) | 3711 | static int bond_neigh_init(struct neighbour *n) |
3699 | { | 3712 | { |
3700 | struct bonding *bond = netdev_priv(dev); | 3713 | struct bonding *bond = netdev_priv(n->dev); |
3701 | struct slave *slave = bond->first_slave; | 3714 | struct slave *slave = bond->first_slave; |
3715 | const struct net_device_ops *slave_ops; | ||
3716 | struct neigh_parms parms; | ||
3717 | int ret; | ||
3718 | |||
3719 | if (!slave) | ||
3720 | return 0; | ||
3721 | |||
3722 | slave_ops = slave->dev->netdev_ops; | ||
3723 | |||
3724 | if (!slave_ops->ndo_neigh_setup) | ||
3725 | return 0; | ||
3726 | |||
3727 | parms.neigh_setup = NULL; | ||
3728 | parms.neigh_cleanup = NULL; | ||
3729 | ret = slave_ops->ndo_neigh_setup(slave->dev, &parms); | ||
3730 | if (ret) | ||
3731 | return ret; | ||
3732 | |||
3733 | /* | ||
3734 | * Assign slave's neigh_cleanup to neighbour in case cleanup is called | ||
3735 | * after the last slave has been detached. Assumes that all slaves | ||
3736 | * utilize the same neigh_cleanup (true at this writing as only user | ||
3737 | * is ipoib). | ||
3738 | */ | ||
3739 | n->parms->neigh_cleanup = parms.neigh_cleanup; | ||
3740 | |||
3741 | if (!parms.neigh_setup) | ||
3742 | return 0; | ||
3743 | |||
3744 | return parms.neigh_setup(n); | ||
3745 | } | ||
3746 | |||
3747 | /* | ||
3748 | * The bonding ndo_neigh_setup is called at init time beofre any | ||
3749 | * slave exists. So we must declare proxy setup function which will | ||
3750 | * be used at run time to resolve the actual slave neigh param setup. | ||
3751 | */ | ||
3752 | static int bond_neigh_setup(struct net_device *dev, | ||
3753 | struct neigh_parms *parms) | ||
3754 | { | ||
3755 | parms->neigh_setup = bond_neigh_init; | ||
3702 | 3756 | ||
3703 | if (slave) { | ||
3704 | const struct net_device_ops *slave_ops | ||
3705 | = slave->dev->netdev_ops; | ||
3706 | if (slave_ops->ndo_neigh_setup) | ||
3707 | return slave_ops->ndo_neigh_setup(slave->dev, parms); | ||
3708 | } | ||
3709 | return 0; | 3757 | return 0; |
3710 | } | 3758 | } |
3711 | 3759 | ||
diff --git a/drivers/net/caif/caif_spi.c b/drivers/net/caif/caif_spi.c index 96391c36fa74..b71ce9bf0afb 100644 --- a/drivers/net/caif/caif_spi.c +++ b/drivers/net/caif/caif_spi.c | |||
@@ -127,12 +127,6 @@ static inline void dev_debugfs_rem(struct cfspi *cfspi) | |||
127 | debugfs_remove(cfspi->dbgfs_dir); | 127 | debugfs_remove(cfspi->dbgfs_dir); |
128 | } | 128 | } |
129 | 129 | ||
130 | static int dbgfs_open(struct inode *inode, struct file *file) | ||
131 | { | ||
132 | file->private_data = inode->i_private; | ||
133 | return 0; | ||
134 | } | ||
135 | |||
136 | static ssize_t dbgfs_state(struct file *file, char __user *user_buf, | 130 | static ssize_t dbgfs_state(struct file *file, char __user *user_buf, |
137 | size_t count, loff_t *ppos) | 131 | size_t count, loff_t *ppos) |
138 | { | 132 | { |
@@ -243,13 +237,13 @@ static ssize_t dbgfs_frame(struct file *file, char __user *user_buf, | |||
243 | } | 237 | } |
244 | 238 | ||
245 | static const struct file_operations dbgfs_state_fops = { | 239 | static const struct file_operations dbgfs_state_fops = { |
246 | .open = dbgfs_open, | 240 | .open = simple_open, |
247 | .read = dbgfs_state, | 241 | .read = dbgfs_state, |
248 | .owner = THIS_MODULE | 242 | .owner = THIS_MODULE |
249 | }; | 243 | }; |
250 | 244 | ||
251 | static const struct file_operations dbgfs_frame_fops = { | 245 | static const struct file_operations dbgfs_frame_fops = { |
252 | .open = dbgfs_open, | 246 | .open = simple_open, |
253 | .read = dbgfs_frame, | 247 | .read = dbgfs_frame, |
254 | .owner = THIS_MODULE | 248 | .owner = THIS_MODULE |
255 | }; | 249 | }; |
diff --git a/drivers/net/eql.c b/drivers/net/eql.c index a59cf961a436..f219d38acf58 100644 --- a/drivers/net/eql.c +++ b/drivers/net/eql.c | |||
@@ -125,6 +125,7 @@ | |||
125 | #include <linux/if.h> | 125 | #include <linux/if.h> |
126 | #include <linux/if_arp.h> | 126 | #include <linux/if_arp.h> |
127 | #include <linux/if_eql.h> | 127 | #include <linux/if_eql.h> |
128 | #include <linux/pkt_sched.h> | ||
128 | 129 | ||
129 | #include <asm/uaccess.h> | 130 | #include <asm/uaccess.h> |
130 | 131 | ||
@@ -143,7 +144,7 @@ static void eql_timer(unsigned long param) | |||
143 | equalizer_t *eql = (equalizer_t *) param; | 144 | equalizer_t *eql = (equalizer_t *) param; |
144 | struct list_head *this, *tmp, *head; | 145 | struct list_head *this, *tmp, *head; |
145 | 146 | ||
146 | spin_lock_bh(&eql->queue.lock); | 147 | spin_lock(&eql->queue.lock); |
147 | head = &eql->queue.all_slaves; | 148 | head = &eql->queue.all_slaves; |
148 | list_for_each_safe(this, tmp, head) { | 149 | list_for_each_safe(this, tmp, head) { |
149 | slave_t *slave = list_entry(this, slave_t, list); | 150 | slave_t *slave = list_entry(this, slave_t, list); |
@@ -157,7 +158,7 @@ static void eql_timer(unsigned long param) | |||
157 | } | 158 | } |
158 | 159 | ||
159 | } | 160 | } |
160 | spin_unlock_bh(&eql->queue.lock); | 161 | spin_unlock(&eql->queue.lock); |
161 | 162 | ||
162 | eql->timer.expires = jiffies + EQL_DEFAULT_RESCHED_IVAL; | 163 | eql->timer.expires = jiffies + EQL_DEFAULT_RESCHED_IVAL; |
163 | add_timer(&eql->timer); | 164 | add_timer(&eql->timer); |
@@ -341,7 +342,7 @@ static netdev_tx_t eql_slave_xmit(struct sk_buff *skb, struct net_device *dev) | |||
341 | struct net_device *slave_dev = slave->dev; | 342 | struct net_device *slave_dev = slave->dev; |
342 | 343 | ||
343 | skb->dev = slave_dev; | 344 | skb->dev = slave_dev; |
344 | skb->priority = 1; | 345 | skb->priority = TC_PRIO_FILLER; |
345 | slave->bytes_queued += skb->len; | 346 | slave->bytes_queued += skb->len; |
346 | dev_queue_xmit(skb); | 347 | dev_queue_xmit(skb); |
347 | dev->stats.tx_packets++; | 348 | dev->stats.tx_packets++; |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h index e37161f19250..2c9ee552dffc 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h | |||
@@ -1173,6 +1173,13 @@ enum { | |||
1173 | }; | 1173 | }; |
1174 | 1174 | ||
1175 | 1175 | ||
1176 | struct bnx2x_prev_path_list { | ||
1177 | u8 bus; | ||
1178 | u8 slot; | ||
1179 | u8 path; | ||
1180 | struct list_head list; | ||
1181 | }; | ||
1182 | |||
1176 | struct bnx2x { | 1183 | struct bnx2x { |
1177 | /* Fields used in the tx and intr/napi performance paths | 1184 | /* Fields used in the tx and intr/napi performance paths |
1178 | * are grouped together in the beginning of the structure | 1185 | * are grouped together in the beginning of the structure |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c index f1f3ca65667a..4b054812713a 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c | |||
@@ -1721,6 +1721,29 @@ static void bnx2x_squeeze_objects(struct bnx2x *bp) | |||
1721 | } while (0) | 1721 | } while (0) |
1722 | #endif | 1722 | #endif |
1723 | 1723 | ||
1724 | bool bnx2x_test_firmware_version(struct bnx2x *bp, bool is_err) | ||
1725 | { | ||
1726 | /* build FW version dword */ | ||
1727 | u32 my_fw = (BCM_5710_FW_MAJOR_VERSION) + | ||
1728 | (BCM_5710_FW_MINOR_VERSION << 8) + | ||
1729 | (BCM_5710_FW_REVISION_VERSION << 16) + | ||
1730 | (BCM_5710_FW_ENGINEERING_VERSION << 24); | ||
1731 | |||
1732 | /* read loaded FW from chip */ | ||
1733 | u32 loaded_fw = REG_RD(bp, XSEM_REG_PRAM); | ||
1734 | |||
1735 | DP(NETIF_MSG_IFUP, "loaded fw %x, my fw %x\n", loaded_fw, my_fw); | ||
1736 | |||
1737 | if (loaded_fw != my_fw) { | ||
1738 | if (is_err) | ||
1739 | BNX2X_ERR("bnx2x with FW %x was already loaded, which mismatches my %x FW. aborting\n", | ||
1740 | loaded_fw, my_fw); | ||
1741 | return false; | ||
1742 | } | ||
1743 | |||
1744 | return true; | ||
1745 | } | ||
1746 | |||
1724 | /* must be called with rtnl_lock */ | 1747 | /* must be called with rtnl_lock */ |
1725 | int bnx2x_nic_load(struct bnx2x *bp, int load_mode) | 1748 | int bnx2x_nic_load(struct bnx2x *bp, int load_mode) |
1726 | { | 1749 | { |
@@ -1815,23 +1838,8 @@ int bnx2x_nic_load(struct bnx2x *bp, int load_mode) | |||
1815 | } | 1838 | } |
1816 | if (load_code != FW_MSG_CODE_DRV_LOAD_COMMON_CHIP && | 1839 | if (load_code != FW_MSG_CODE_DRV_LOAD_COMMON_CHIP && |
1817 | load_code != FW_MSG_CODE_DRV_LOAD_COMMON) { | 1840 | load_code != FW_MSG_CODE_DRV_LOAD_COMMON) { |
1818 | /* build FW version dword */ | ||
1819 | u32 my_fw = (BCM_5710_FW_MAJOR_VERSION) + | ||
1820 | (BCM_5710_FW_MINOR_VERSION << 8) + | ||
1821 | (BCM_5710_FW_REVISION_VERSION << 16) + | ||
1822 | (BCM_5710_FW_ENGINEERING_VERSION << 24); | ||
1823 | |||
1824 | /* read loaded FW from chip */ | ||
1825 | u32 loaded_fw = REG_RD(bp, XSEM_REG_PRAM); | ||
1826 | |||
1827 | DP(BNX2X_MSG_SP, "loaded fw %x, my fw %x", | ||
1828 | loaded_fw, my_fw); | ||
1829 | |||
1830 | /* abort nic load if version mismatch */ | 1841 | /* abort nic load if version mismatch */ |
1831 | if (my_fw != loaded_fw) { | 1842 | if (!bnx2x_test_firmware_version(bp, true)) { |
1832 | BNX2X_ERR("bnx2x with FW %x already loaded, " | ||
1833 | "which mismatches my %x FW. aborting", | ||
1834 | loaded_fw, my_fw); | ||
1835 | rc = -EBUSY; | 1843 | rc = -EBUSY; |
1836 | LOAD_ERROR_EXIT(bp, load_error2); | 1844 | LOAD_ERROR_EXIT(bp, load_error2); |
1837 | } | 1845 | } |
@@ -1866,7 +1874,6 @@ int bnx2x_nic_load(struct bnx2x *bp, int load_mode) | |||
1866 | * bnx2x_periodic_task(). | 1874 | * bnx2x_periodic_task(). |
1867 | */ | 1875 | */ |
1868 | smp_mb(); | 1876 | smp_mb(); |
1869 | queue_delayed_work(bnx2x_wq, &bp->period_task, 0); | ||
1870 | } else | 1877 | } else |
1871 | bp->port.pmf = 0; | 1878 | bp->port.pmf = 0; |
1872 | 1879 | ||
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h index 8b163388659a..5c27454d2ec2 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h | |||
@@ -431,6 +431,9 @@ void bnx2x_panic_dump(struct bnx2x *bp); | |||
431 | 431 | ||
432 | void bnx2x_fw_dump_lvl(struct bnx2x *bp, const char *lvl); | 432 | void bnx2x_fw_dump_lvl(struct bnx2x *bp, const char *lvl); |
433 | 433 | ||
434 | /* validate currect fw is loaded */ | ||
435 | bool bnx2x_test_firmware_version(struct bnx2x *bp, bool is_err); | ||
436 | |||
434 | /* dev_close main block */ | 437 | /* dev_close main block */ |
435 | int bnx2x_nic_unload(struct bnx2x *bp, int unload_mode); | 438 | int bnx2x_nic_unload(struct bnx2x *bp, int unload_mode); |
436 | 439 | ||
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_fw_defs.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_fw_defs.h index cd6dfa9eaa3a..b9b263323436 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_fw_defs.h +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_fw_defs.h | |||
@@ -25,31 +25,31 @@ | |||
25 | (IRO[149].base + ((funcId) * IRO[149].m1)) | 25 | (IRO[149].base + ((funcId) * IRO[149].m1)) |
26 | #define CSTORM_IGU_MODE_OFFSET (IRO[157].base) | 26 | #define CSTORM_IGU_MODE_OFFSET (IRO[157].base) |
27 | #define CSTORM_ISCSI_CQ_SIZE_OFFSET(pfId) \ | 27 | #define CSTORM_ISCSI_CQ_SIZE_OFFSET(pfId) \ |
28 | (IRO[315].base + ((pfId) * IRO[315].m1)) | ||
29 | #define CSTORM_ISCSI_CQ_SQN_SIZE_OFFSET(pfId) \ | ||
30 | (IRO[316].base + ((pfId) * IRO[316].m1)) | 28 | (IRO[316].base + ((pfId) * IRO[316].m1)) |
29 | #define CSTORM_ISCSI_CQ_SQN_SIZE_OFFSET(pfId) \ | ||
30 | (IRO[317].base + ((pfId) * IRO[317].m1)) | ||
31 | #define CSTORM_ISCSI_EQ_CONS_OFFSET(pfId, iscsiEqId) \ | 31 | #define CSTORM_ISCSI_EQ_CONS_OFFSET(pfId, iscsiEqId) \ |
32 | (IRO[308].base + ((pfId) * IRO[308].m1) + ((iscsiEqId) * IRO[308].m2)) | 32 | (IRO[309].base + ((pfId) * IRO[309].m1) + ((iscsiEqId) * IRO[309].m2)) |
33 | #define CSTORM_ISCSI_EQ_NEXT_EQE_ADDR_OFFSET(pfId, iscsiEqId) \ | 33 | #define CSTORM_ISCSI_EQ_NEXT_EQE_ADDR_OFFSET(pfId, iscsiEqId) \ |
34 | (IRO[310].base + ((pfId) * IRO[310].m1) + ((iscsiEqId) * IRO[310].m2)) | 34 | (IRO[311].base + ((pfId) * IRO[311].m1) + ((iscsiEqId) * IRO[311].m2)) |
35 | #define CSTORM_ISCSI_EQ_NEXT_PAGE_ADDR_OFFSET(pfId, iscsiEqId) \ | 35 | #define CSTORM_ISCSI_EQ_NEXT_PAGE_ADDR_OFFSET(pfId, iscsiEqId) \ |
36 | (IRO[309].base + ((pfId) * IRO[309].m1) + ((iscsiEqId) * IRO[309].m2)) | 36 | (IRO[310].base + ((pfId) * IRO[310].m1) + ((iscsiEqId) * IRO[310].m2)) |
37 | #define CSTORM_ISCSI_EQ_NEXT_PAGE_ADDR_VALID_OFFSET(pfId, iscsiEqId) \ | 37 | #define CSTORM_ISCSI_EQ_NEXT_PAGE_ADDR_VALID_OFFSET(pfId, iscsiEqId) \ |
38 | (IRO[311].base + ((pfId) * IRO[311].m1) + ((iscsiEqId) * IRO[311].m2)) | 38 | (IRO[312].base + ((pfId) * IRO[312].m1) + ((iscsiEqId) * IRO[312].m2)) |
39 | #define CSTORM_ISCSI_EQ_PROD_OFFSET(pfId, iscsiEqId) \ | 39 | #define CSTORM_ISCSI_EQ_PROD_OFFSET(pfId, iscsiEqId) \ |
40 | (IRO[307].base + ((pfId) * IRO[307].m1) + ((iscsiEqId) * IRO[307].m2)) | 40 | (IRO[308].base + ((pfId) * IRO[308].m1) + ((iscsiEqId) * IRO[308].m2)) |
41 | #define CSTORM_ISCSI_EQ_SB_INDEX_OFFSET(pfId, iscsiEqId) \ | 41 | #define CSTORM_ISCSI_EQ_SB_INDEX_OFFSET(pfId, iscsiEqId) \ |
42 | (IRO[313].base + ((pfId) * IRO[313].m1) + ((iscsiEqId) * IRO[313].m2)) | 42 | (IRO[314].base + ((pfId) * IRO[314].m1) + ((iscsiEqId) * IRO[314].m2)) |
43 | #define CSTORM_ISCSI_EQ_SB_NUM_OFFSET(pfId, iscsiEqId) \ | 43 | #define CSTORM_ISCSI_EQ_SB_NUM_OFFSET(pfId, iscsiEqId) \ |
44 | (IRO[312].base + ((pfId) * IRO[312].m1) + ((iscsiEqId) * IRO[312].m2)) | 44 | (IRO[313].base + ((pfId) * IRO[313].m1) + ((iscsiEqId) * IRO[313].m2)) |
45 | #define CSTORM_ISCSI_HQ_SIZE_OFFSET(pfId) \ | 45 | #define CSTORM_ISCSI_HQ_SIZE_OFFSET(pfId) \ |
46 | (IRO[314].base + ((pfId) * IRO[314].m1)) | 46 | (IRO[315].base + ((pfId) * IRO[315].m1)) |
47 | #define CSTORM_ISCSI_NUM_OF_TASKS_OFFSET(pfId) \ | 47 | #define CSTORM_ISCSI_NUM_OF_TASKS_OFFSET(pfId) \ |
48 | (IRO[306].base + ((pfId) * IRO[306].m1)) | 48 | (IRO[307].base + ((pfId) * IRO[307].m1)) |
49 | #define CSTORM_ISCSI_PAGE_SIZE_LOG_OFFSET(pfId) \ | 49 | #define CSTORM_ISCSI_PAGE_SIZE_LOG_OFFSET(pfId) \ |
50 | (IRO[305].base + ((pfId) * IRO[305].m1)) | 50 | (IRO[306].base + ((pfId) * IRO[306].m1)) |
51 | #define CSTORM_ISCSI_PAGE_SIZE_OFFSET(pfId) \ | 51 | #define CSTORM_ISCSI_PAGE_SIZE_OFFSET(pfId) \ |
52 | (IRO[304].base + ((pfId) * IRO[304].m1)) | 52 | (IRO[305].base + ((pfId) * IRO[305].m1)) |
53 | #define CSTORM_RECORD_SLOW_PATH_OFFSET(funcId) \ | 53 | #define CSTORM_RECORD_SLOW_PATH_OFFSET(funcId) \ |
54 | (IRO[151].base + ((funcId) * IRO[151].m1)) | 54 | (IRO[151].base + ((funcId) * IRO[151].m1)) |
55 | #define CSTORM_SP_STATUS_BLOCK_DATA_OFFSET(pfId) \ | 55 | #define CSTORM_SP_STATUS_BLOCK_DATA_OFFSET(pfId) \ |
@@ -96,37 +96,37 @@ | |||
96 | #define TSTORM_FUNC_EN_OFFSET(funcId) \ | 96 | #define TSTORM_FUNC_EN_OFFSET(funcId) \ |
97 | (IRO[103].base + ((funcId) * IRO[103].m1)) | 97 | (IRO[103].base + ((funcId) * IRO[103].m1)) |
98 | #define TSTORM_ISCSI_ERROR_BITMAP_OFFSET(pfId) \ | 98 | #define TSTORM_ISCSI_ERROR_BITMAP_OFFSET(pfId) \ |
99 | (IRO[271].base + ((pfId) * IRO[271].m1)) | ||
100 | #define TSTORM_ISCSI_L2_ISCSI_OOO_CID_TABLE_OFFSET(pfId) \ | ||
101 | (IRO[272].base + ((pfId) * IRO[272].m1)) | 99 | (IRO[272].base + ((pfId) * IRO[272].m1)) |
102 | #define TSTORM_ISCSI_L2_ISCSI_OOO_CLIENT_ID_TABLE_OFFSET(pfId) \ | 100 | #define TSTORM_ISCSI_L2_ISCSI_OOO_CID_TABLE_OFFSET(pfId) \ |
103 | (IRO[273].base + ((pfId) * IRO[273].m1)) | 101 | (IRO[273].base + ((pfId) * IRO[273].m1)) |
104 | #define TSTORM_ISCSI_L2_ISCSI_OOO_PROD_OFFSET(pfId) \ | 102 | #define TSTORM_ISCSI_L2_ISCSI_OOO_CLIENT_ID_TABLE_OFFSET(pfId) \ |
105 | (IRO[274].base + ((pfId) * IRO[274].m1)) | 103 | (IRO[274].base + ((pfId) * IRO[274].m1)) |
104 | #define TSTORM_ISCSI_L2_ISCSI_OOO_PROD_OFFSET(pfId) \ | ||
105 | (IRO[275].base + ((pfId) * IRO[275].m1)) | ||
106 | #define TSTORM_ISCSI_NUM_OF_TASKS_OFFSET(pfId) \ | 106 | #define TSTORM_ISCSI_NUM_OF_TASKS_OFFSET(pfId) \ |
107 | (IRO[270].base + ((pfId) * IRO[270].m1)) | 107 | (IRO[271].base + ((pfId) * IRO[271].m1)) |
108 | #define TSTORM_ISCSI_PAGE_SIZE_LOG_OFFSET(pfId) \ | 108 | #define TSTORM_ISCSI_PAGE_SIZE_LOG_OFFSET(pfId) \ |
109 | (IRO[269].base + ((pfId) * IRO[269].m1)) | 109 | (IRO[270].base + ((pfId) * IRO[270].m1)) |
110 | #define TSTORM_ISCSI_PAGE_SIZE_OFFSET(pfId) \ | 110 | #define TSTORM_ISCSI_PAGE_SIZE_OFFSET(pfId) \ |
111 | (IRO[268].base + ((pfId) * IRO[268].m1)) | 111 | (IRO[269].base + ((pfId) * IRO[269].m1)) |
112 | #define TSTORM_ISCSI_RQ_SIZE_OFFSET(pfId) \ | 112 | #define TSTORM_ISCSI_RQ_SIZE_OFFSET(pfId) \ |
113 | (IRO[267].base + ((pfId) * IRO[267].m1)) | 113 | (IRO[268].base + ((pfId) * IRO[268].m1)) |
114 | #define TSTORM_ISCSI_TCP_LOCAL_ADV_WND_OFFSET(pfId) \ | 114 | #define TSTORM_ISCSI_TCP_LOCAL_ADV_WND_OFFSET(pfId) \ |
115 | (IRO[276].base + ((pfId) * IRO[276].m1)) | 115 | (IRO[277].base + ((pfId) * IRO[277].m1)) |
116 | #define TSTORM_ISCSI_TCP_VARS_FLAGS_OFFSET(pfId) \ | 116 | #define TSTORM_ISCSI_TCP_VARS_FLAGS_OFFSET(pfId) \ |
117 | (IRO[263].base + ((pfId) * IRO[263].m1)) | ||
118 | #define TSTORM_ISCSI_TCP_VARS_LSB_LOCAL_MAC_ADDR_OFFSET(pfId) \ | ||
119 | (IRO[264].base + ((pfId) * IRO[264].m1)) | 117 | (IRO[264].base + ((pfId) * IRO[264].m1)) |
120 | #define TSTORM_ISCSI_TCP_VARS_MID_LOCAL_MAC_ADDR_OFFSET(pfId) \ | 118 | #define TSTORM_ISCSI_TCP_VARS_LSB_LOCAL_MAC_ADDR_OFFSET(pfId) \ |
121 | (IRO[265].base + ((pfId) * IRO[265].m1)) | 119 | (IRO[265].base + ((pfId) * IRO[265].m1)) |
122 | #define TSTORM_ISCSI_TCP_VARS_MSB_LOCAL_MAC_ADDR_OFFSET(pfId) \ | 120 | #define TSTORM_ISCSI_TCP_VARS_MID_LOCAL_MAC_ADDR_OFFSET(pfId) \ |
123 | (IRO[266].base + ((pfId) * IRO[266].m1)) | 121 | (IRO[266].base + ((pfId) * IRO[266].m1)) |
122 | #define TSTORM_ISCSI_TCP_VARS_MSB_LOCAL_MAC_ADDR_OFFSET(pfId) \ | ||
123 | (IRO[267].base + ((pfId) * IRO[267].m1)) | ||
124 | #define TSTORM_MAC_FILTER_CONFIG_OFFSET(pfId) \ | 124 | #define TSTORM_MAC_FILTER_CONFIG_OFFSET(pfId) \ |
125 | (IRO[202].base + ((pfId) * IRO[202].m1)) | 125 | (IRO[202].base + ((pfId) * IRO[202].m1)) |
126 | #define TSTORM_RECORD_SLOW_PATH_OFFSET(funcId) \ | 126 | #define TSTORM_RECORD_SLOW_PATH_OFFSET(funcId) \ |
127 | (IRO[105].base + ((funcId) * IRO[105].m1)) | 127 | (IRO[105].base + ((funcId) * IRO[105].m1)) |
128 | #define TSTORM_TCP_MAX_CWND_OFFSET(pfId) \ | 128 | #define TSTORM_TCP_MAX_CWND_OFFSET(pfId) \ |
129 | (IRO[216].base + ((pfId) * IRO[216].m1)) | 129 | (IRO[217].base + ((pfId) * IRO[217].m1)) |
130 | #define TSTORM_VF_TO_PF_OFFSET(funcId) \ | 130 | #define TSTORM_VF_TO_PF_OFFSET(funcId) \ |
131 | (IRO[104].base + ((funcId) * IRO[104].m1)) | 131 | (IRO[104].base + ((funcId) * IRO[104].m1)) |
132 | #define USTORM_AGG_DATA_OFFSET (IRO[206].base) | 132 | #define USTORM_AGG_DATA_OFFSET (IRO[206].base) |
@@ -140,29 +140,29 @@ | |||
140 | #define USTORM_ETH_PAUSE_ENABLED_OFFSET(portId) \ | 140 | #define USTORM_ETH_PAUSE_ENABLED_OFFSET(portId) \ |
141 | (IRO[183].base + ((portId) * IRO[183].m1)) | 141 | (IRO[183].base + ((portId) * IRO[183].m1)) |
142 | #define USTORM_FCOE_EQ_PROD_OFFSET(pfId) \ | 142 | #define USTORM_FCOE_EQ_PROD_OFFSET(pfId) \ |
143 | (IRO[317].base + ((pfId) * IRO[317].m1)) | 143 | (IRO[318].base + ((pfId) * IRO[318].m1)) |
144 | #define USTORM_FUNC_EN_OFFSET(funcId) \ | 144 | #define USTORM_FUNC_EN_OFFSET(funcId) \ |
145 | (IRO[178].base + ((funcId) * IRO[178].m1)) | 145 | (IRO[178].base + ((funcId) * IRO[178].m1)) |
146 | #define USTORM_ISCSI_CQ_SIZE_OFFSET(pfId) \ | 146 | #define USTORM_ISCSI_CQ_SIZE_OFFSET(pfId) \ |
147 | (IRO[281].base + ((pfId) * IRO[281].m1)) | ||
148 | #define USTORM_ISCSI_CQ_SQN_SIZE_OFFSET(pfId) \ | ||
149 | (IRO[282].base + ((pfId) * IRO[282].m1)) | 147 | (IRO[282].base + ((pfId) * IRO[282].m1)) |
148 | #define USTORM_ISCSI_CQ_SQN_SIZE_OFFSET(pfId) \ | ||
149 | (IRO[283].base + ((pfId) * IRO[283].m1)) | ||
150 | #define USTORM_ISCSI_ERROR_BITMAP_OFFSET(pfId) \ | 150 | #define USTORM_ISCSI_ERROR_BITMAP_OFFSET(pfId) \ |
151 | (IRO[286].base + ((pfId) * IRO[286].m1)) | 151 | (IRO[287].base + ((pfId) * IRO[287].m1)) |
152 | #define USTORM_ISCSI_GLOBAL_BUF_PHYS_ADDR_OFFSET(pfId) \ | 152 | #define USTORM_ISCSI_GLOBAL_BUF_PHYS_ADDR_OFFSET(pfId) \ |
153 | (IRO[283].base + ((pfId) * IRO[283].m1)) | 153 | (IRO[284].base + ((pfId) * IRO[284].m1)) |
154 | #define USTORM_ISCSI_NUM_OF_TASKS_OFFSET(pfId) \ | 154 | #define USTORM_ISCSI_NUM_OF_TASKS_OFFSET(pfId) \ |
155 | (IRO[279].base + ((pfId) * IRO[279].m1)) | 155 | (IRO[280].base + ((pfId) * IRO[280].m1)) |
156 | #define USTORM_ISCSI_PAGE_SIZE_LOG_OFFSET(pfId) \ | 156 | #define USTORM_ISCSI_PAGE_SIZE_LOG_OFFSET(pfId) \ |
157 | (IRO[278].base + ((pfId) * IRO[278].m1)) | 157 | (IRO[279].base + ((pfId) * IRO[279].m1)) |
158 | #define USTORM_ISCSI_PAGE_SIZE_OFFSET(pfId) \ | 158 | #define USTORM_ISCSI_PAGE_SIZE_OFFSET(pfId) \ |
159 | (IRO[277].base + ((pfId) * IRO[277].m1)) | 159 | (IRO[278].base + ((pfId) * IRO[278].m1)) |
160 | #define USTORM_ISCSI_R2TQ_SIZE_OFFSET(pfId) \ | 160 | #define USTORM_ISCSI_R2TQ_SIZE_OFFSET(pfId) \ |
161 | (IRO[280].base + ((pfId) * IRO[280].m1)) | 161 | (IRO[281].base + ((pfId) * IRO[281].m1)) |
162 | #define USTORM_ISCSI_RQ_BUFFER_SIZE_OFFSET(pfId) \ | 162 | #define USTORM_ISCSI_RQ_BUFFER_SIZE_OFFSET(pfId) \ |
163 | (IRO[284].base + ((pfId) * IRO[284].m1)) | ||
164 | #define USTORM_ISCSI_RQ_SIZE_OFFSET(pfId) \ | ||
165 | (IRO[285].base + ((pfId) * IRO[285].m1)) | 163 | (IRO[285].base + ((pfId) * IRO[285].m1)) |
164 | #define USTORM_ISCSI_RQ_SIZE_OFFSET(pfId) \ | ||
165 | (IRO[286].base + ((pfId) * IRO[286].m1)) | ||
166 | #define USTORM_MEM_WORKAROUND_ADDRESS_OFFSET(pfId) \ | 166 | #define USTORM_MEM_WORKAROUND_ADDRESS_OFFSET(pfId) \ |
167 | (IRO[182].base + ((pfId) * IRO[182].m1)) | 167 | (IRO[182].base + ((pfId) * IRO[182].m1)) |
168 | #define USTORM_RECORD_SLOW_PATH_OFFSET(funcId) \ | 168 | #define USTORM_RECORD_SLOW_PATH_OFFSET(funcId) \ |
@@ -188,39 +188,39 @@ | |||
188 | #define XSTORM_FUNC_EN_OFFSET(funcId) \ | 188 | #define XSTORM_FUNC_EN_OFFSET(funcId) \ |
189 | (IRO[47].base + ((funcId) * IRO[47].m1)) | 189 | (IRO[47].base + ((funcId) * IRO[47].m1)) |
190 | #define XSTORM_ISCSI_HQ_SIZE_OFFSET(pfId) \ | 190 | #define XSTORM_ISCSI_HQ_SIZE_OFFSET(pfId) \ |
191 | (IRO[294].base + ((pfId) * IRO[294].m1)) | 191 | (IRO[295].base + ((pfId) * IRO[295].m1)) |
192 | #define XSTORM_ISCSI_LOCAL_MAC_ADDR0_OFFSET(pfId) \ | 192 | #define XSTORM_ISCSI_LOCAL_MAC_ADDR0_OFFSET(pfId) \ |
193 | (IRO[297].base + ((pfId) * IRO[297].m1)) | ||
194 | #define XSTORM_ISCSI_LOCAL_MAC_ADDR1_OFFSET(pfId) \ | ||
195 | (IRO[298].base + ((pfId) * IRO[298].m1)) | 193 | (IRO[298].base + ((pfId) * IRO[298].m1)) |
196 | #define XSTORM_ISCSI_LOCAL_MAC_ADDR2_OFFSET(pfId) \ | 194 | #define XSTORM_ISCSI_LOCAL_MAC_ADDR1_OFFSET(pfId) \ |
197 | (IRO[299].base + ((pfId) * IRO[299].m1)) | 195 | (IRO[299].base + ((pfId) * IRO[299].m1)) |
198 | #define XSTORM_ISCSI_LOCAL_MAC_ADDR3_OFFSET(pfId) \ | 196 | #define XSTORM_ISCSI_LOCAL_MAC_ADDR2_OFFSET(pfId) \ |
199 | (IRO[300].base + ((pfId) * IRO[300].m1)) | 197 | (IRO[300].base + ((pfId) * IRO[300].m1)) |
200 | #define XSTORM_ISCSI_LOCAL_MAC_ADDR4_OFFSET(pfId) \ | 198 | #define XSTORM_ISCSI_LOCAL_MAC_ADDR3_OFFSET(pfId) \ |
201 | (IRO[301].base + ((pfId) * IRO[301].m1)) | 199 | (IRO[301].base + ((pfId) * IRO[301].m1)) |
202 | #define XSTORM_ISCSI_LOCAL_MAC_ADDR5_OFFSET(pfId) \ | 200 | #define XSTORM_ISCSI_LOCAL_MAC_ADDR4_OFFSET(pfId) \ |
203 | (IRO[302].base + ((pfId) * IRO[302].m1)) | 201 | (IRO[302].base + ((pfId) * IRO[302].m1)) |
204 | #define XSTORM_ISCSI_LOCAL_VLAN_OFFSET(pfId) \ | 202 | #define XSTORM_ISCSI_LOCAL_MAC_ADDR5_OFFSET(pfId) \ |
205 | (IRO[303].base + ((pfId) * IRO[303].m1)) | 203 | (IRO[303].base + ((pfId) * IRO[303].m1)) |
204 | #define XSTORM_ISCSI_LOCAL_VLAN_OFFSET(pfId) \ | ||
205 | (IRO[304].base + ((pfId) * IRO[304].m1)) | ||
206 | #define XSTORM_ISCSI_NUM_OF_TASKS_OFFSET(pfId) \ | 206 | #define XSTORM_ISCSI_NUM_OF_TASKS_OFFSET(pfId) \ |
207 | (IRO[293].base + ((pfId) * IRO[293].m1)) | 207 | (IRO[294].base + ((pfId) * IRO[294].m1)) |
208 | #define XSTORM_ISCSI_PAGE_SIZE_LOG_OFFSET(pfId) \ | 208 | #define XSTORM_ISCSI_PAGE_SIZE_LOG_OFFSET(pfId) \ |
209 | (IRO[292].base + ((pfId) * IRO[292].m1)) | 209 | (IRO[293].base + ((pfId) * IRO[293].m1)) |
210 | #define XSTORM_ISCSI_PAGE_SIZE_OFFSET(pfId) \ | 210 | #define XSTORM_ISCSI_PAGE_SIZE_OFFSET(pfId) \ |
211 | (IRO[291].base + ((pfId) * IRO[291].m1)) | 211 | (IRO[292].base + ((pfId) * IRO[292].m1)) |
212 | #define XSTORM_ISCSI_R2TQ_SIZE_OFFSET(pfId) \ | 212 | #define XSTORM_ISCSI_R2TQ_SIZE_OFFSET(pfId) \ |
213 | (IRO[296].base + ((pfId) * IRO[296].m1)) | 213 | (IRO[297].base + ((pfId) * IRO[297].m1)) |
214 | #define XSTORM_ISCSI_SQ_SIZE_OFFSET(pfId) \ | 214 | #define XSTORM_ISCSI_SQ_SIZE_OFFSET(pfId) \ |
215 | (IRO[295].base + ((pfId) * IRO[295].m1)) | 215 | (IRO[296].base + ((pfId) * IRO[296].m1)) |
216 | #define XSTORM_ISCSI_TCP_VARS_ADV_WND_SCL_OFFSET(pfId) \ | 216 | #define XSTORM_ISCSI_TCP_VARS_ADV_WND_SCL_OFFSET(pfId) \ |
217 | (IRO[290].base + ((pfId) * IRO[290].m1)) | 217 | (IRO[291].base + ((pfId) * IRO[291].m1)) |
218 | #define XSTORM_ISCSI_TCP_VARS_FLAGS_OFFSET(pfId) \ | 218 | #define XSTORM_ISCSI_TCP_VARS_FLAGS_OFFSET(pfId) \ |
219 | (IRO[289].base + ((pfId) * IRO[289].m1)) | 219 | (IRO[290].base + ((pfId) * IRO[290].m1)) |
220 | #define XSTORM_ISCSI_TCP_VARS_TOS_OFFSET(pfId) \ | 220 | #define XSTORM_ISCSI_TCP_VARS_TOS_OFFSET(pfId) \ |
221 | (IRO[288].base + ((pfId) * IRO[288].m1)) | 221 | (IRO[289].base + ((pfId) * IRO[289].m1)) |
222 | #define XSTORM_ISCSI_TCP_VARS_TTL_OFFSET(pfId) \ | 222 | #define XSTORM_ISCSI_TCP_VARS_TTL_OFFSET(pfId) \ |
223 | (IRO[287].base + ((pfId) * IRO[287].m1)) | 223 | (IRO[288].base + ((pfId) * IRO[288].m1)) |
224 | #define XSTORM_RATE_SHAPING_PER_VN_VARS_OFFSET(pfId) \ | 224 | #define XSTORM_RATE_SHAPING_PER_VN_VARS_OFFSET(pfId) \ |
225 | (IRO[44].base + ((pfId) * IRO[44].m1)) | 225 | (IRO[44].base + ((pfId) * IRO[44].m1)) |
226 | #define XSTORM_RECORD_SLOW_PATH_OFFSET(funcId) \ | 226 | #define XSTORM_RECORD_SLOW_PATH_OFFSET(funcId) \ |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_hsi.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_hsi.h index 5d71b7d43237..dbff5915b81a 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_hsi.h +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_hsi.h | |||
@@ -1251,6 +1251,9 @@ struct drv_func_mb { | |||
1251 | 1251 | ||
1252 | #define DRV_MSG_CODE_LINK_STATUS_CHANGED 0x01000000 | 1252 | #define DRV_MSG_CODE_LINK_STATUS_CHANGED 0x01000000 |
1253 | 1253 | ||
1254 | #define DRV_MSG_CODE_INITIATE_FLR 0x02000000 | ||
1255 | #define REQ_BC_VER_4_INITIATE_FLR 0x00070213 | ||
1256 | |||
1254 | #define BIOS_MSG_CODE_LIC_CHALLENGE 0xff010000 | 1257 | #define BIOS_MSG_CODE_LIC_CHALLENGE 0xff010000 |
1255 | #define BIOS_MSG_CODE_LIC_RESPONSE 0xff020000 | 1258 | #define BIOS_MSG_CODE_LIC_RESPONSE 0xff020000 |
1256 | #define BIOS_MSG_CODE_VIRT_MAC_PRIM 0xff030000 | 1259 | #define BIOS_MSG_CODE_VIRT_MAC_PRIM 0xff030000 |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c index beb4cdbdb6e1..ad95324dc042 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c | |||
@@ -35,7 +35,6 @@ | |||
35 | #define ETH_MAX_PACKET_SIZE 1500 | 35 | #define ETH_MAX_PACKET_SIZE 1500 |
36 | #define ETH_MAX_JUMBO_PACKET_SIZE 9600 | 36 | #define ETH_MAX_JUMBO_PACKET_SIZE 9600 |
37 | #define MDIO_ACCESS_TIMEOUT 1000 | 37 | #define MDIO_ACCESS_TIMEOUT 1000 |
38 | #define BMAC_CONTROL_RX_ENABLE 2 | ||
39 | #define WC_LANE_MAX 4 | 38 | #define WC_LANE_MAX 4 |
40 | #define I2C_SWITCH_WIDTH 2 | 39 | #define I2C_SWITCH_WIDTH 2 |
41 | #define I2C_BSC0 0 | 40 | #define I2C_BSC0 0 |
@@ -1372,7 +1371,14 @@ static void bnx2x_update_pfc_xmac(struct link_params *params, | |||
1372 | pfc1_val |= XMAC_PFC_CTRL_HI_REG_PFC_REFRESH_EN | | 1371 | pfc1_val |= XMAC_PFC_CTRL_HI_REG_PFC_REFRESH_EN | |
1373 | XMAC_PFC_CTRL_HI_REG_PFC_STATS_EN | | 1372 | XMAC_PFC_CTRL_HI_REG_PFC_STATS_EN | |
1374 | XMAC_PFC_CTRL_HI_REG_RX_PFC_EN | | 1373 | XMAC_PFC_CTRL_HI_REG_RX_PFC_EN | |
1375 | XMAC_PFC_CTRL_HI_REG_TX_PFC_EN; | 1374 | XMAC_PFC_CTRL_HI_REG_TX_PFC_EN | |
1375 | XMAC_PFC_CTRL_HI_REG_FORCE_PFC_XON; | ||
1376 | /* Write pause and PFC registers */ | ||
1377 | REG_WR(bp, xmac_base + XMAC_REG_PAUSE_CTRL, pause_val); | ||
1378 | REG_WR(bp, xmac_base + XMAC_REG_PFC_CTRL, pfc0_val); | ||
1379 | REG_WR(bp, xmac_base + XMAC_REG_PFC_CTRL_HI, pfc1_val); | ||
1380 | pfc1_val &= ~XMAC_PFC_CTRL_HI_REG_FORCE_PFC_XON; | ||
1381 | |||
1376 | } | 1382 | } |
1377 | 1383 | ||
1378 | /* Write pause and PFC registers */ | 1384 | /* Write pause and PFC registers */ |
@@ -3649,6 +3655,33 @@ static void bnx2x_ext_phy_update_adv_fc(struct bnx2x_phy *phy, | |||
3649 | if (phy->type == PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM54618SE) { | 3655 | if (phy->type == PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM54618SE) { |
3650 | bnx2x_cl22_read(bp, phy, 0x4, &ld_pause); | 3656 | bnx2x_cl22_read(bp, phy, 0x4, &ld_pause); |
3651 | bnx2x_cl22_read(bp, phy, 0x5, &lp_pause); | 3657 | bnx2x_cl22_read(bp, phy, 0x5, &lp_pause); |
3658 | } else if (CHIP_IS_E3(bp) && | ||
3659 | SINGLE_MEDIA_DIRECT(params)) { | ||
3660 | u8 lane = bnx2x_get_warpcore_lane(phy, params); | ||
3661 | u16 gp_status, gp_mask; | ||
3662 | bnx2x_cl45_read(bp, phy, | ||
3663 | MDIO_AN_DEVAD, MDIO_WC_REG_GP2_STATUS_GP_2_4, | ||
3664 | &gp_status); | ||
3665 | gp_mask = (MDIO_WC_REG_GP2_STATUS_GP_2_4_CL73_AN_CMPL | | ||
3666 | MDIO_WC_REG_GP2_STATUS_GP_2_4_CL37_LP_AN_CAP) << | ||
3667 | lane; | ||
3668 | if ((gp_status & gp_mask) == gp_mask) { | ||
3669 | bnx2x_cl45_read(bp, phy, MDIO_AN_DEVAD, | ||
3670 | MDIO_AN_REG_ADV_PAUSE, &ld_pause); | ||
3671 | bnx2x_cl45_read(bp, phy, MDIO_AN_DEVAD, | ||
3672 | MDIO_AN_REG_LP_AUTO_NEG, &lp_pause); | ||
3673 | } else { | ||
3674 | bnx2x_cl45_read(bp, phy, MDIO_AN_DEVAD, | ||
3675 | MDIO_AN_REG_CL37_FC_LD, &ld_pause); | ||
3676 | bnx2x_cl45_read(bp, phy, MDIO_AN_DEVAD, | ||
3677 | MDIO_AN_REG_CL37_FC_LP, &lp_pause); | ||
3678 | ld_pause = ((ld_pause & | ||
3679 | MDIO_COMBO_IEEE0_AUTO_NEG_ADV_PAUSE_BOTH) | ||
3680 | << 3); | ||
3681 | lp_pause = ((lp_pause & | ||
3682 | MDIO_COMBO_IEEE0_AUTO_NEG_ADV_PAUSE_BOTH) | ||
3683 | << 3); | ||
3684 | } | ||
3652 | } else { | 3685 | } else { |
3653 | bnx2x_cl45_read(bp, phy, | 3686 | bnx2x_cl45_read(bp, phy, |
3654 | MDIO_AN_DEVAD, | 3687 | MDIO_AN_DEVAD, |
@@ -3699,7 +3732,23 @@ static void bnx2x_warpcore_enable_AN_KR(struct bnx2x_phy *phy, | |||
3699 | u16 val16 = 0, lane, bam37 = 0; | 3732 | u16 val16 = 0, lane, bam37 = 0; |
3700 | struct bnx2x *bp = params->bp; | 3733 | struct bnx2x *bp = params->bp; |
3701 | DP(NETIF_MSG_LINK, "Enable Auto Negotiation for KR\n"); | 3734 | DP(NETIF_MSG_LINK, "Enable Auto Negotiation for KR\n"); |
3702 | 3735 | /* Set to default registers that may be overriden by 10G force */ | |
3736 | bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD, | ||
3737 | MDIO_WC_REG_SERDESDIGITAL_CONTROL1000X2, 0x7); | ||
3738 | bnx2x_cl45_write(bp, phy, MDIO_AN_DEVAD, | ||
3739 | MDIO_WC_REG_PAR_DET_10G_CTRL, 0); | ||
3740 | bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD, | ||
3741 | MDIO_WC_REG_CL72_USERB0_CL72_MISC1_CONTROL, 0); | ||
3742 | bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD, | ||
3743 | MDIO_WC_REG_XGXSBLK1_LANECTRL0, 0xff); | ||
3744 | bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD, | ||
3745 | MDIO_WC_REG_XGXSBLK1_LANECTRL1, 0x5555); | ||
3746 | bnx2x_cl45_write(bp, phy, MDIO_PMA_DEVAD, | ||
3747 | MDIO_WC_REG_IEEE0BLK_AUTONEGNP, 0x0); | ||
3748 | bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD, | ||
3749 | MDIO_WC_REG_RX66_CONTROL, 0x7415); | ||
3750 | bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD, | ||
3751 | MDIO_WC_REG_SERDESDIGITAL_MISC2, 0x6190); | ||
3703 | /* Disable Autoneg: re-enable it after adv is done. */ | 3752 | /* Disable Autoneg: re-enable it after adv is done. */ |
3704 | bnx2x_cl45_write(bp, phy, MDIO_AN_DEVAD, | 3753 | bnx2x_cl45_write(bp, phy, MDIO_AN_DEVAD, |
3705 | MDIO_WC_REG_IEEE0BLK_MIICNTL, 0); | 3754 | MDIO_WC_REG_IEEE0BLK_MIICNTL, 0); |
@@ -3945,13 +3994,13 @@ static void bnx2x_warpcore_set_10G_XFI(struct bnx2x_phy *phy, | |||
3945 | 3994 | ||
3946 | } else { | 3995 | } else { |
3947 | misc1_val |= 0x9; | 3996 | misc1_val |= 0x9; |
3948 | tap_val = ((0x12 << MDIO_WC_REG_TX_FIR_TAP_POST_TAP_OFFSET) | | 3997 | tap_val = ((0x0f << MDIO_WC_REG_TX_FIR_TAP_POST_TAP_OFFSET) | |
3949 | (0x2d << MDIO_WC_REG_TX_FIR_TAP_MAIN_TAP_OFFSET) | | 3998 | (0x2b << MDIO_WC_REG_TX_FIR_TAP_MAIN_TAP_OFFSET) | |
3950 | (0x00 << MDIO_WC_REG_TX_FIR_TAP_PRE_TAP_OFFSET)); | 3999 | (0x02 << MDIO_WC_REG_TX_FIR_TAP_PRE_TAP_OFFSET)); |
3951 | tx_driver_val = | 4000 | tx_driver_val = |
3952 | ((0x02 << MDIO_WC_REG_TX0_TX_DRIVER_POST2_COEFF_OFFSET) | | 4001 | ((0x03 << MDIO_WC_REG_TX0_TX_DRIVER_POST2_COEFF_OFFSET) | |
3953 | (0x02 << MDIO_WC_REG_TX0_TX_DRIVER_IDRIVER_OFFSET) | | 4002 | (0x02 << MDIO_WC_REG_TX0_TX_DRIVER_IDRIVER_OFFSET) | |
3954 | (0x02 << MDIO_WC_REG_TX0_TX_DRIVER_IPRE_DRIVER_OFFSET)); | 4003 | (0x06 << MDIO_WC_REG_TX0_TX_DRIVER_IPRE_DRIVER_OFFSET)); |
3955 | } | 4004 | } |
3956 | bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD, | 4005 | bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD, |
3957 | MDIO_WC_REG_SERDESDIGITAL_MISC1, misc1_val); | 4006 | MDIO_WC_REG_SERDESDIGITAL_MISC1, misc1_val); |
@@ -4369,7 +4418,7 @@ static void bnx2x_warpcore_config_init(struct bnx2x_phy *phy, | |||
4369 | switch (serdes_net_if) { | 4418 | switch (serdes_net_if) { |
4370 | case PORT_HW_CFG_NET_SERDES_IF_KR: | 4419 | case PORT_HW_CFG_NET_SERDES_IF_KR: |
4371 | /* Enable KR Auto Neg */ | 4420 | /* Enable KR Auto Neg */ |
4372 | if (params->loopback_mode == LOOPBACK_NONE) | 4421 | if (params->loopback_mode != LOOPBACK_EXT) |
4373 | bnx2x_warpcore_enable_AN_KR(phy, params, vars); | 4422 | bnx2x_warpcore_enable_AN_KR(phy, params, vars); |
4374 | else { | 4423 | else { |
4375 | DP(NETIF_MSG_LINK, "Setting KR 10G-Force\n"); | 4424 | DP(NETIF_MSG_LINK, "Setting KR 10G-Force\n"); |
@@ -6167,12 +6216,14 @@ int bnx2x_set_led(struct link_params *params, | |||
6167 | 6216 | ||
6168 | tmp = EMAC_RD(bp, EMAC_REG_EMAC_LED); | 6217 | tmp = EMAC_RD(bp, EMAC_REG_EMAC_LED); |
6169 | if (params->phy[EXT_PHY1].type == | 6218 | if (params->phy[EXT_PHY1].type == |
6170 | PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM54618SE) | 6219 | PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM54618SE) |
6171 | EMAC_WR(bp, EMAC_REG_EMAC_LED, tmp & 0xfff1); | 6220 | tmp &= ~(EMAC_LED_1000MB_OVERRIDE | |
6172 | else { | 6221 | EMAC_LED_100MB_OVERRIDE | |
6173 | EMAC_WR(bp, EMAC_REG_EMAC_LED, | 6222 | EMAC_LED_10MB_OVERRIDE); |
6174 | (tmp | EMAC_LED_OVERRIDE)); | 6223 | else |
6175 | } | 6224 | tmp |= EMAC_LED_OVERRIDE; |
6225 | |||
6226 | EMAC_WR(bp, EMAC_REG_EMAC_LED, tmp); | ||
6176 | break; | 6227 | break; |
6177 | 6228 | ||
6178 | case LED_MODE_OPER: | 6229 | case LED_MODE_OPER: |
@@ -6227,10 +6278,15 @@ int bnx2x_set_led(struct link_params *params, | |||
6227 | hw_led_mode); | 6278 | hw_led_mode); |
6228 | } else if ((params->phy[EXT_PHY1].type == | 6279 | } else if ((params->phy[EXT_PHY1].type == |
6229 | PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM54618SE) && | 6280 | PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM54618SE) && |
6230 | (mode != LED_MODE_OPER)) { | 6281 | (mode == LED_MODE_ON)) { |
6231 | REG_WR(bp, NIG_REG_LED_MODE_P0 + port*4, 0); | 6282 | REG_WR(bp, NIG_REG_LED_MODE_P0 + port*4, 0); |
6232 | tmp = EMAC_RD(bp, EMAC_REG_EMAC_LED); | 6283 | tmp = EMAC_RD(bp, EMAC_REG_EMAC_LED); |
6233 | EMAC_WR(bp, EMAC_REG_EMAC_LED, tmp | 0x3); | 6284 | EMAC_WR(bp, EMAC_REG_EMAC_LED, tmp | |
6285 | EMAC_LED_OVERRIDE | EMAC_LED_1000MB_OVERRIDE); | ||
6286 | /* Break here; otherwise, it'll disable the | ||
6287 | * intended override. | ||
6288 | */ | ||
6289 | break; | ||
6234 | } else | 6290 | } else |
6235 | REG_WR(bp, NIG_REG_LED_MODE_P0 + port*4, | 6291 | REG_WR(bp, NIG_REG_LED_MODE_P0 + port*4, |
6236 | hw_led_mode); | 6292 | hw_led_mode); |
@@ -6245,13 +6301,9 @@ int bnx2x_set_led(struct link_params *params, | |||
6245 | LED_BLINK_RATE_VAL_E1X_E2); | 6301 | LED_BLINK_RATE_VAL_E1X_E2); |
6246 | REG_WR(bp, NIG_REG_LED_CONTROL_BLINK_RATE_ENA_P0 + | 6302 | REG_WR(bp, NIG_REG_LED_CONTROL_BLINK_RATE_ENA_P0 + |
6247 | port*4, 1); | 6303 | port*4, 1); |
6248 | if ((params->phy[EXT_PHY1].type != | 6304 | tmp = EMAC_RD(bp, EMAC_REG_EMAC_LED); |
6249 | PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM54618SE) && | 6305 | EMAC_WR(bp, EMAC_REG_EMAC_LED, |
6250 | (mode != LED_MODE_OPER)) { | 6306 | (tmp & (~EMAC_LED_OVERRIDE))); |
6251 | tmp = EMAC_RD(bp, EMAC_REG_EMAC_LED); | ||
6252 | EMAC_WR(bp, EMAC_REG_EMAC_LED, | ||
6253 | (tmp & (~EMAC_LED_OVERRIDE))); | ||
6254 | } | ||
6255 | 6307 | ||
6256 | if (CHIP_IS_E1(bp) && | 6308 | if (CHIP_IS_E1(bp) && |
6257 | ((speed == SPEED_2500) || | 6309 | ((speed == SPEED_2500) || |
@@ -6844,6 +6896,12 @@ int bnx2x_link_update(struct link_params *params, struct link_vars *vars) | |||
6844 | SINGLE_MEDIA_DIRECT(params)) && | 6896 | SINGLE_MEDIA_DIRECT(params)) && |
6845 | (phy_vars[active_external_phy].fault_detected == 0)); | 6897 | (phy_vars[active_external_phy].fault_detected == 0)); |
6846 | 6898 | ||
6899 | /* Update the PFC configuration in case it was changed */ | ||
6900 | if (params->feature_config_flags & FEATURE_CONFIG_PFC_ENABLED) | ||
6901 | vars->link_status |= LINK_STATUS_PFC_ENABLED; | ||
6902 | else | ||
6903 | vars->link_status &= ~LINK_STATUS_PFC_ENABLED; | ||
6904 | |||
6847 | if (vars->link_up) | 6905 | if (vars->link_up) |
6848 | rc = bnx2x_update_link_up(params, vars, link_10g_plus); | 6906 | rc = bnx2x_update_link_up(params, vars, link_10g_plus); |
6849 | else | 6907 | else |
@@ -8031,7 +8089,9 @@ static int bnx2x_verify_sfp_module(struct bnx2x_phy *phy, | |||
8031 | netdev_err(bp->dev, "Warning: Unqualified SFP+ module detected," | 8089 | netdev_err(bp->dev, "Warning: Unqualified SFP+ module detected," |
8032 | " Port %d from %s part number %s\n", | 8090 | " Port %d from %s part number %s\n", |
8033 | params->port, vendor_name, vendor_pn); | 8091 | params->port, vendor_name, vendor_pn); |
8034 | phy->flags |= FLAGS_SFP_NOT_APPROVED; | 8092 | if ((val & PORT_FEAT_CFG_OPT_MDL_ENFRCMNT_MASK) != |
8093 | PORT_FEAT_CFG_OPT_MDL_ENFRCMNT_WARNING_MSG) | ||
8094 | phy->flags |= FLAGS_SFP_NOT_APPROVED; | ||
8035 | return -EINVAL; | 8095 | return -EINVAL; |
8036 | } | 8096 | } |
8037 | 8097 | ||
@@ -9091,6 +9151,12 @@ static int bnx2x_8727_config_init(struct bnx2x_phy *phy, | |||
9091 | tmp2 &= 0xFFEF; | 9151 | tmp2 &= 0xFFEF; |
9092 | bnx2x_cl45_write(bp, phy, | 9152 | bnx2x_cl45_write(bp, phy, |
9093 | MDIO_PMA_DEVAD, MDIO_PMA_REG_8727_OPT_CFG_REG, tmp2); | 9153 | MDIO_PMA_DEVAD, MDIO_PMA_REG_8727_OPT_CFG_REG, tmp2); |
9154 | bnx2x_cl45_read(bp, phy, | ||
9155 | MDIO_PMA_DEVAD, MDIO_PMA_REG_PHY_IDENTIFIER, | ||
9156 | &tmp2); | ||
9157 | bnx2x_cl45_write(bp, phy, | ||
9158 | MDIO_PMA_DEVAD, MDIO_PMA_REG_PHY_IDENTIFIER, | ||
9159 | (tmp2 & 0x7fff)); | ||
9094 | } | 9160 | } |
9095 | 9161 | ||
9096 | return 0; | 9162 | return 0; |
@@ -9271,12 +9337,11 @@ static u8 bnx2x_8727_read_status(struct bnx2x_phy *phy, | |||
9271 | MDIO_PMA_DEVAD, MDIO_PMA_LASI_RXCTRL, | 9337 | MDIO_PMA_DEVAD, MDIO_PMA_LASI_RXCTRL, |
9272 | ((1<<5) | (1<<2))); | 9338 | ((1<<5) | (1<<2))); |
9273 | } | 9339 | } |
9274 | DP(NETIF_MSG_LINK, "Enabling 8727 TX laser if SFP is approved\n"); | 9340 | |
9275 | bnx2x_8727_specific_func(phy, params, ENABLE_TX); | 9341 | if (!(phy->flags & FLAGS_SFP_NOT_APPROVED)) { |
9276 | /* If transmitter is disabled, ignore false link up indication */ | 9342 | DP(NETIF_MSG_LINK, "Enabling 8727 TX laser\n"); |
9277 | bnx2x_cl45_read(bp, phy, | 9343 | bnx2x_sfp_set_transmitter(params, phy, 1); |
9278 | MDIO_PMA_DEVAD, MDIO_PMA_REG_PHY_IDENTIFIER, &val1); | 9344 | } else { |
9279 | if (val1 & (1<<15)) { | ||
9280 | DP(NETIF_MSG_LINK, "Tx is disabled\n"); | 9345 | DP(NETIF_MSG_LINK, "Tx is disabled\n"); |
9281 | return 0; | 9346 | return 0; |
9282 | } | 9347 | } |
@@ -9370,8 +9435,7 @@ static void bnx2x_save_848xx_spirom_version(struct bnx2x_phy *phy, | |||
9370 | 9435 | ||
9371 | if (phy->type == PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM84833) { | 9436 | if (phy->type == PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM84833) { |
9372 | bnx2x_cl45_read(bp, phy, MDIO_CTL_DEVAD, 0x400f, &fw_ver1); | 9437 | bnx2x_cl45_read(bp, phy, MDIO_CTL_DEVAD, 0x400f, &fw_ver1); |
9373 | bnx2x_save_spirom_version(bp, port, | 9438 | bnx2x_save_spirom_version(bp, port, fw_ver1 & 0xfff, |
9374 | ((fw_ver1 & 0xf000)>>5) | (fw_ver1 & 0x7f), | ||
9375 | phy->ver_addr); | 9439 | phy->ver_addr); |
9376 | } else { | 9440 | } else { |
9377 | /* For 32-bit registers in 848xx, access via MDIO2ARM i/f. */ | 9441 | /* For 32-bit registers in 848xx, access via MDIO2ARM i/f. */ |
@@ -9794,6 +9858,15 @@ static int bnx2x_84833_hw_reset_phy(struct bnx2x_phy *phy, | |||
9794 | other_shmem_base_addr)); | 9858 | other_shmem_base_addr)); |
9795 | 9859 | ||
9796 | u32 shmem_base_path[2]; | 9860 | u32 shmem_base_path[2]; |
9861 | |||
9862 | /* Work around for 84833 LED failure inside RESET status */ | ||
9863 | bnx2x_cl45_write(bp, phy, MDIO_AN_DEVAD, | ||
9864 | MDIO_AN_REG_8481_LEGACY_MII_CTRL, | ||
9865 | MDIO_AN_REG_8481_MII_CTRL_FORCE_1G); | ||
9866 | bnx2x_cl45_write(bp, phy, MDIO_AN_DEVAD, | ||
9867 | MDIO_AN_REG_8481_1G_100T_EXT_CTRL, | ||
9868 | MIDO_AN_REG_8481_EXT_CTRL_FORCE_LEDS_OFF); | ||
9869 | |||
9797 | shmem_base_path[0] = params->shmem_base; | 9870 | shmem_base_path[0] = params->shmem_base; |
9798 | shmem_base_path[1] = other_shmem_base_addr; | 9871 | shmem_base_path[1] = other_shmem_base_addr; |
9799 | 9872 | ||
@@ -10104,7 +10177,7 @@ static void bnx2x_848x3_link_reset(struct bnx2x_phy *phy, | |||
10104 | u8 port; | 10177 | u8 port; |
10105 | u16 val16; | 10178 | u16 val16; |
10106 | 10179 | ||
10107 | if (!(CHIP_IS_E1(bp))) | 10180 | if (!(CHIP_IS_E1x(bp))) |
10108 | port = BP_PATH(bp); | 10181 | port = BP_PATH(bp); |
10109 | else | 10182 | else |
10110 | port = params->port; | 10183 | port = params->port; |
@@ -10131,7 +10204,7 @@ static void bnx2x_848xx_set_link_led(struct bnx2x_phy *phy, | |||
10131 | u16 val; | 10204 | u16 val; |
10132 | u8 port; | 10205 | u8 port; |
10133 | 10206 | ||
10134 | if (!(CHIP_IS_E1(bp))) | 10207 | if (!(CHIP_IS_E1x(bp))) |
10135 | port = BP_PATH(bp); | 10208 | port = BP_PATH(bp); |
10136 | else | 10209 | else |
10137 | port = params->port; | 10210 | port = params->port; |
@@ -12050,6 +12123,9 @@ int bnx2x_phy_init(struct link_params *params, struct link_vars *vars) | |||
12050 | 12123 | ||
12051 | bnx2x_emac_init(params, vars); | 12124 | bnx2x_emac_init(params, vars); |
12052 | 12125 | ||
12126 | if (params->feature_config_flags & FEATURE_CONFIG_PFC_ENABLED) | ||
12127 | vars->link_status |= LINK_STATUS_PFC_ENABLED; | ||
12128 | |||
12053 | if (params->num_phys == 0) { | 12129 | if (params->num_phys == 0) { |
12054 | DP(NETIF_MSG_LINK, "No phy found for initialization !!\n"); | 12130 | DP(NETIF_MSG_LINK, "No phy found for initialization !!\n"); |
12055 | return -EINVAL; | 12131 | return -EINVAL; |
@@ -12129,10 +12205,10 @@ int bnx2x_link_reset(struct link_params *params, struct link_vars *vars, | |||
12129 | * Hold it as vars low | 12205 | * Hold it as vars low |
12130 | */ | 12206 | */ |
12131 | /* clear link led */ | 12207 | /* clear link led */ |
12208 | bnx2x_set_mdio_clk(bp, params->chip_id, port); | ||
12132 | bnx2x_set_led(params, vars, LED_MODE_OFF, 0); | 12209 | bnx2x_set_led(params, vars, LED_MODE_OFF, 0); |
12133 | 12210 | ||
12134 | if (reset_ext_phy) { | 12211 | if (reset_ext_phy) { |
12135 | bnx2x_set_mdio_clk(bp, params->chip_id, port); | ||
12136 | for (phy_index = EXT_PHY1; phy_index < params->num_phys; | 12212 | for (phy_index = EXT_PHY1; phy_index < params->num_phys; |
12137 | phy_index++) { | 12213 | phy_index++) { |
12138 | if (params->phy[phy_index].link_reset) { | 12214 | if (params->phy[phy_index].link_reset) { |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.h index 7ba557a610da..763535ee4832 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.h +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.h | |||
@@ -89,6 +89,8 @@ | |||
89 | #define PFC_BRB_FULL_LB_XON_THRESHOLD 250 | 89 | #define PFC_BRB_FULL_LB_XON_THRESHOLD 250 |
90 | 90 | ||
91 | #define MAXVAL(a, b) (((a) > (b)) ? (a) : (b)) | 91 | #define MAXVAL(a, b) (((a) > (b)) ? (a) : (b)) |
92 | |||
93 | #define BMAC_CONTROL_RX_ENABLE 2 | ||
92 | /***********************************************************/ | 94 | /***********************************************************/ |
93 | /* Structs */ | 95 | /* Structs */ |
94 | /***********************************************************/ | 96 | /***********************************************************/ |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c index f7f9aa807264..e077d2508727 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | |||
@@ -52,6 +52,7 @@ | |||
52 | #include <linux/prefetch.h> | 52 | #include <linux/prefetch.h> |
53 | #include <linux/zlib.h> | 53 | #include <linux/zlib.h> |
54 | #include <linux/io.h> | 54 | #include <linux/io.h> |
55 | #include <linux/semaphore.h> | ||
55 | #include <linux/stringify.h> | 56 | #include <linux/stringify.h> |
56 | #include <linux/vmalloc.h> | 57 | #include <linux/vmalloc.h> |
57 | 58 | ||
@@ -211,6 +212,10 @@ static DEFINE_PCI_DEVICE_TABLE(bnx2x_pci_tbl) = { | |||
211 | 212 | ||
212 | MODULE_DEVICE_TABLE(pci, bnx2x_pci_tbl); | 213 | MODULE_DEVICE_TABLE(pci, bnx2x_pci_tbl); |
213 | 214 | ||
215 | /* Global resources for unloading a previously loaded device */ | ||
216 | #define BNX2X_PREV_WAIT_NEEDED 1 | ||
217 | static DEFINE_SEMAPHORE(bnx2x_prev_sem); | ||
218 | static LIST_HEAD(bnx2x_prev_list); | ||
214 | /**************************************************************************** | 219 | /**************************************************************************** |
215 | * General service functions | 220 | * General service functions |
216 | ****************************************************************************/ | 221 | ****************************************************************************/ |
@@ -8812,109 +8817,371 @@ static inline void bnx2x_undi_int_disable(struct bnx2x *bp) | |||
8812 | bnx2x_undi_int_disable_e1h(bp); | 8817 | bnx2x_undi_int_disable_e1h(bp); |
8813 | } | 8818 | } |
8814 | 8819 | ||
8815 | static void __devinit bnx2x_undi_unload(struct bnx2x *bp) | 8820 | static void __devinit bnx2x_prev_unload_close_mac(struct bnx2x *bp) |
8816 | { | 8821 | { |
8817 | u32 val; | 8822 | u32 val, base_addr, offset, mask, reset_reg; |
8823 | bool mac_stopped = false; | ||
8824 | u8 port = BP_PORT(bp); | ||
8818 | 8825 | ||
8819 | /* possibly another driver is trying to reset the chip */ | 8826 | reset_reg = REG_RD(bp, MISC_REG_RESET_REG_2); |
8820 | bnx2x_acquire_hw_lock(bp, HW_LOCK_RESOURCE_RESET); | ||
8821 | 8827 | ||
8822 | /* check if doorbell queue is reset */ | 8828 | if (!CHIP_IS_E3(bp)) { |
8823 | if (REG_RD(bp, GRCBASE_MISC + MISC_REGISTERS_RESET_REG_1_SET) | 8829 | val = REG_RD(bp, NIG_REG_BMAC0_REGS_OUT_EN + port * 4); |
8824 | & MISC_REGISTERS_RESET_REG_1_RST_DORQ) { | 8830 | mask = MISC_REGISTERS_RESET_REG_2_RST_BMAC0 << port; |
8831 | if ((mask & reset_reg) && val) { | ||
8832 | u32 wb_data[2]; | ||
8833 | BNX2X_DEV_INFO("Disable bmac Rx\n"); | ||
8834 | base_addr = BP_PORT(bp) ? NIG_REG_INGRESS_BMAC1_MEM | ||
8835 | : NIG_REG_INGRESS_BMAC0_MEM; | ||
8836 | offset = CHIP_IS_E2(bp) ? BIGMAC2_REGISTER_BMAC_CONTROL | ||
8837 | : BIGMAC_REGISTER_BMAC_CONTROL; | ||
8825 | 8838 | ||
8826 | /* | 8839 | /* |
8827 | * Check if it is the UNDI driver | 8840 | * use rd/wr since we cannot use dmae. This is safe |
8841 | * since MCP won't access the bus due to the request | ||
8842 | * to unload, and no function on the path can be | ||
8843 | * loaded at this time. | ||
8844 | */ | ||
8845 | wb_data[0] = REG_RD(bp, base_addr + offset); | ||
8846 | wb_data[1] = REG_RD(bp, base_addr + offset + 0x4); | ||
8847 | wb_data[0] &= ~BMAC_CONTROL_RX_ENABLE; | ||
8848 | REG_WR(bp, base_addr + offset, wb_data[0]); | ||
8849 | REG_WR(bp, base_addr + offset + 0x4, wb_data[1]); | ||
8850 | |||
8851 | } | ||
8852 | BNX2X_DEV_INFO("Disable emac Rx\n"); | ||
8853 | REG_WR(bp, NIG_REG_NIG_EMAC0_EN + BP_PORT(bp)*4, 0); | ||
8854 | |||
8855 | mac_stopped = true; | ||
8856 | } else { | ||
8857 | if (reset_reg & MISC_REGISTERS_RESET_REG_2_XMAC) { | ||
8858 | BNX2X_DEV_INFO("Disable xmac Rx\n"); | ||
8859 | base_addr = BP_PORT(bp) ? GRCBASE_XMAC1 : GRCBASE_XMAC0; | ||
8860 | val = REG_RD(bp, base_addr + XMAC_REG_PFC_CTRL_HI); | ||
8861 | REG_WR(bp, base_addr + XMAC_REG_PFC_CTRL_HI, | ||
8862 | val & ~(1 << 1)); | ||
8863 | REG_WR(bp, base_addr + XMAC_REG_PFC_CTRL_HI, | ||
8864 | val | (1 << 1)); | ||
8865 | REG_WR(bp, base_addr + XMAC_REG_CTRL, 0); | ||
8866 | mac_stopped = true; | ||
8867 | } | ||
8868 | mask = MISC_REGISTERS_RESET_REG_2_UMAC0 << port; | ||
8869 | if (mask & reset_reg) { | ||
8870 | BNX2X_DEV_INFO("Disable umac Rx\n"); | ||
8871 | base_addr = BP_PORT(bp) ? GRCBASE_UMAC1 : GRCBASE_UMAC0; | ||
8872 | REG_WR(bp, base_addr + UMAC_REG_COMMAND_CONFIG, 0); | ||
8873 | mac_stopped = true; | ||
8874 | } | ||
8875 | } | ||
8876 | |||
8877 | if (mac_stopped) | ||
8878 | msleep(20); | ||
8879 | |||
8880 | } | ||
8881 | |||
8882 | #define BNX2X_PREV_UNDI_PROD_ADDR(p) (BAR_TSTRORM_INTMEM + 0x1508 + ((p) << 4)) | ||
8883 | #define BNX2X_PREV_UNDI_RCQ(val) ((val) & 0xffff) | ||
8884 | #define BNX2X_PREV_UNDI_BD(val) ((val) >> 16 & 0xffff) | ||
8885 | #define BNX2X_PREV_UNDI_PROD(rcq, bd) ((bd) << 16 | (rcq)) | ||
8886 | |||
8887 | static void __devinit bnx2x_prev_unload_undi_inc(struct bnx2x *bp, u8 port, | ||
8888 | u8 inc) | ||
8889 | { | ||
8890 | u16 rcq, bd; | ||
8891 | u32 tmp_reg = REG_RD(bp, BNX2X_PREV_UNDI_PROD_ADDR(port)); | ||
8892 | |||
8893 | rcq = BNX2X_PREV_UNDI_RCQ(tmp_reg) + inc; | ||
8894 | bd = BNX2X_PREV_UNDI_BD(tmp_reg) + inc; | ||
8895 | |||
8896 | tmp_reg = BNX2X_PREV_UNDI_PROD(rcq, bd); | ||
8897 | REG_WR(bp, BNX2X_PREV_UNDI_PROD_ADDR(port), tmp_reg); | ||
8898 | |||
8899 | BNX2X_DEV_INFO("UNDI producer [%d] rings bd -> 0x%04x, rcq -> 0x%04x\n", | ||
8900 | port, bd, rcq); | ||
8901 | } | ||
8902 | |||
8903 | static int __devinit bnx2x_prev_mcp_done(struct bnx2x *bp) | ||
8904 | { | ||
8905 | u32 rc = bnx2x_fw_command(bp, DRV_MSG_CODE_UNLOAD_DONE, 0); | ||
8906 | if (!rc) { | ||
8907 | BNX2X_ERR("MCP response failure, aborting\n"); | ||
8908 | return -EBUSY; | ||
8909 | } | ||
8910 | |||
8911 | return 0; | ||
8912 | } | ||
8913 | |||
8914 | static bool __devinit bnx2x_prev_is_path_marked(struct bnx2x *bp) | ||
8915 | { | ||
8916 | struct bnx2x_prev_path_list *tmp_list; | ||
8917 | int rc = false; | ||
8918 | |||
8919 | if (down_trylock(&bnx2x_prev_sem)) | ||
8920 | return false; | ||
8921 | |||
8922 | list_for_each_entry(tmp_list, &bnx2x_prev_list, list) { | ||
8923 | if (PCI_SLOT(bp->pdev->devfn) == tmp_list->slot && | ||
8924 | bp->pdev->bus->number == tmp_list->bus && | ||
8925 | BP_PATH(bp) == tmp_list->path) { | ||
8926 | rc = true; | ||
8927 | BNX2X_DEV_INFO("Path %d was already cleaned from previous drivers\n", | ||
8928 | BP_PATH(bp)); | ||
8929 | break; | ||
8930 | } | ||
8931 | } | ||
8932 | |||
8933 | up(&bnx2x_prev_sem); | ||
8934 | |||
8935 | return rc; | ||
8936 | } | ||
8937 | |||
8938 | static int __devinit bnx2x_prev_mark_path(struct bnx2x *bp) | ||
8939 | { | ||
8940 | struct bnx2x_prev_path_list *tmp_list; | ||
8941 | int rc; | ||
8942 | |||
8943 | tmp_list = (struct bnx2x_prev_path_list *) | ||
8944 | kmalloc(sizeof(struct bnx2x_prev_path_list), GFP_KERNEL); | ||
8945 | if (!tmp_list) { | ||
8946 | BNX2X_ERR("Failed to allocate 'bnx2x_prev_path_list'\n"); | ||
8947 | return -ENOMEM; | ||
8948 | } | ||
8949 | |||
8950 | tmp_list->bus = bp->pdev->bus->number; | ||
8951 | tmp_list->slot = PCI_SLOT(bp->pdev->devfn); | ||
8952 | tmp_list->path = BP_PATH(bp); | ||
8953 | |||
8954 | rc = down_interruptible(&bnx2x_prev_sem); | ||
8955 | if (rc) { | ||
8956 | BNX2X_ERR("Received %d when tried to take lock\n", rc); | ||
8957 | kfree(tmp_list); | ||
8958 | } else { | ||
8959 | BNX2X_DEV_INFO("Marked path [%d] - finished previous unload\n", | ||
8960 | BP_PATH(bp)); | ||
8961 | list_add(&tmp_list->list, &bnx2x_prev_list); | ||
8962 | up(&bnx2x_prev_sem); | ||
8963 | } | ||
8964 | |||
8965 | return rc; | ||
8966 | } | ||
8967 | |||
8968 | static bool __devinit bnx2x_can_flr(struct bnx2x *bp) | ||
8969 | { | ||
8970 | int pos; | ||
8971 | u32 cap; | ||
8972 | struct pci_dev *dev = bp->pdev; | ||
8973 | |||
8974 | pos = pci_pcie_cap(dev); | ||
8975 | if (!pos) | ||
8976 | return false; | ||
8977 | |||
8978 | pci_read_config_dword(dev, pos + PCI_EXP_DEVCAP, &cap); | ||
8979 | if (!(cap & PCI_EXP_DEVCAP_FLR)) | ||
8980 | return false; | ||
8981 | |||
8982 | return true; | ||
8983 | } | ||
8984 | |||
8985 | static int __devinit bnx2x_do_flr(struct bnx2x *bp) | ||
8986 | { | ||
8987 | int i, pos; | ||
8988 | u16 status; | ||
8989 | struct pci_dev *dev = bp->pdev; | ||
8990 | |||
8991 | /* probe the capability first */ | ||
8992 | if (bnx2x_can_flr(bp)) | ||
8993 | return -ENOTTY; | ||
8994 | |||
8995 | pos = pci_pcie_cap(dev); | ||
8996 | if (!pos) | ||
8997 | return -ENOTTY; | ||
8998 | |||
8999 | /* Wait for Transaction Pending bit clean */ | ||
9000 | for (i = 0; i < 4; i++) { | ||
9001 | if (i) | ||
9002 | msleep((1 << (i - 1)) * 100); | ||
9003 | |||
9004 | pci_read_config_word(dev, pos + PCI_EXP_DEVSTA, &status); | ||
9005 | if (!(status & PCI_EXP_DEVSTA_TRPND)) | ||
9006 | goto clear; | ||
9007 | } | ||
9008 | |||
9009 | dev_err(&dev->dev, | ||
9010 | "transaction is not cleared; proceeding with reset anyway\n"); | ||
9011 | |||
9012 | clear: | ||
9013 | if (bp->common.bc_ver < REQ_BC_VER_4_INITIATE_FLR) { | ||
9014 | BNX2X_ERR("FLR not supported by BC_VER: 0x%x\n", | ||
9015 | bp->common.bc_ver); | ||
9016 | return -EINVAL; | ||
9017 | } | ||
9018 | |||
9019 | bnx2x_fw_command(bp, DRV_MSG_CODE_INITIATE_FLR, 0); | ||
9020 | |||
9021 | return 0; | ||
9022 | } | ||
9023 | |||
9024 | static int __devinit bnx2x_prev_unload_uncommon(struct bnx2x *bp) | ||
9025 | { | ||
9026 | int rc; | ||
9027 | |||
9028 | BNX2X_DEV_INFO("Uncommon unload Flow\n"); | ||
9029 | |||
9030 | /* Test if previous unload process was already finished for this path */ | ||
9031 | if (bnx2x_prev_is_path_marked(bp)) | ||
9032 | return bnx2x_prev_mcp_done(bp); | ||
9033 | |||
9034 | /* If function has FLR capabilities, and existing FW version matches | ||
9035 | * the one required, then FLR will be sufficient to clean any residue | ||
9036 | * left by previous driver | ||
9037 | */ | ||
9038 | if (bnx2x_test_firmware_version(bp, false) && bnx2x_can_flr(bp)) | ||
9039 | return bnx2x_do_flr(bp); | ||
9040 | |||
9041 | /* Close the MCP request, return failure*/ | ||
9042 | rc = bnx2x_prev_mcp_done(bp); | ||
9043 | if (!rc) | ||
9044 | rc = BNX2X_PREV_WAIT_NEEDED; | ||
9045 | |||
9046 | return rc; | ||
9047 | } | ||
9048 | |||
9049 | static int __devinit bnx2x_prev_unload_common(struct bnx2x *bp) | ||
9050 | { | ||
9051 | u32 reset_reg, tmp_reg = 0, rc; | ||
9052 | /* It is possible a previous function received 'common' answer, | ||
9053 | * but hasn't loaded yet, therefore creating a scenario of | ||
9054 | * multiple functions receiving 'common' on the same path. | ||
9055 | */ | ||
9056 | BNX2X_DEV_INFO("Common unload Flow\n"); | ||
9057 | |||
9058 | if (bnx2x_prev_is_path_marked(bp)) | ||
9059 | return bnx2x_prev_mcp_done(bp); | ||
9060 | |||
9061 | reset_reg = REG_RD(bp, MISC_REG_RESET_REG_1); | ||
9062 | |||
9063 | /* Reset should be performed after BRB is emptied */ | ||
9064 | if (reset_reg & MISC_REGISTERS_RESET_REG_1_RST_BRB1) { | ||
9065 | u32 timer_count = 1000; | ||
9066 | bool prev_undi = false; | ||
9067 | |||
9068 | /* Close the MAC Rx to prevent BRB from filling up */ | ||
9069 | bnx2x_prev_unload_close_mac(bp); | ||
9070 | |||
9071 | /* Check if the UNDI driver was previously loaded | ||
8828 | * UNDI driver initializes CID offset for normal bell to 0x7 | 9072 | * UNDI driver initializes CID offset for normal bell to 0x7 |
8829 | */ | 9073 | */ |
8830 | val = REG_RD(bp, DORQ_REG_NORM_CID_OFST); | 9074 | reset_reg = REG_RD(bp, MISC_REG_RESET_REG_1); |
8831 | if (val == 0x7) { | 9075 | if (reset_reg & MISC_REGISTERS_RESET_REG_1_RST_DORQ) { |
8832 | u32 reset_code = DRV_MSG_CODE_UNLOAD_REQ_WOL_DIS; | 9076 | tmp_reg = REG_RD(bp, DORQ_REG_NORM_CID_OFST); |
8833 | /* save our pf_num */ | 9077 | if (tmp_reg == 0x7) { |
8834 | int orig_pf_num = bp->pf_num; | 9078 | BNX2X_DEV_INFO("UNDI previously loaded\n"); |
8835 | int port; | 9079 | prev_undi = true; |
8836 | u32 swap_en, swap_val, value; | 9080 | /* clear the UNDI indication */ |
8837 | 9081 | REG_WR(bp, DORQ_REG_NORM_CID_OFST, 0); | |
8838 | /* clear the UNDI indication */ | ||
8839 | REG_WR(bp, DORQ_REG_NORM_CID_OFST, 0); | ||
8840 | |||
8841 | BNX2X_DEV_INFO("UNDI is active! reset device\n"); | ||
8842 | |||
8843 | /* try unload UNDI on port 0 */ | ||
8844 | bp->pf_num = 0; | ||
8845 | bp->fw_seq = | ||
8846 | (SHMEM_RD(bp, func_mb[bp->pf_num].drv_mb_header) & | ||
8847 | DRV_MSG_SEQ_NUMBER_MASK); | ||
8848 | reset_code = bnx2x_fw_command(bp, reset_code, 0); | ||
8849 | |||
8850 | /* if UNDI is loaded on the other port */ | ||
8851 | if (reset_code != FW_MSG_CODE_DRV_UNLOAD_COMMON) { | ||
8852 | |||
8853 | /* send "DONE" for previous unload */ | ||
8854 | bnx2x_fw_command(bp, | ||
8855 | DRV_MSG_CODE_UNLOAD_DONE, 0); | ||
8856 | |||
8857 | /* unload UNDI on port 1 */ | ||
8858 | bp->pf_num = 1; | ||
8859 | bp->fw_seq = | ||
8860 | (SHMEM_RD(bp, func_mb[bp->pf_num].drv_mb_header) & | ||
8861 | DRV_MSG_SEQ_NUMBER_MASK); | ||
8862 | reset_code = DRV_MSG_CODE_UNLOAD_REQ_WOL_DIS; | ||
8863 | |||
8864 | bnx2x_fw_command(bp, reset_code, 0); | ||
8865 | } | 9082 | } |
9083 | } | ||
9084 | /* wait until BRB is empty */ | ||
9085 | tmp_reg = REG_RD(bp, BRB1_REG_NUM_OF_FULL_BLOCKS); | ||
9086 | while (timer_count) { | ||
9087 | u32 prev_brb = tmp_reg; | ||
8866 | 9088 | ||
8867 | bnx2x_undi_int_disable(bp); | 9089 | tmp_reg = REG_RD(bp, BRB1_REG_NUM_OF_FULL_BLOCKS); |
8868 | port = BP_PORT(bp); | 9090 | if (!tmp_reg) |
8869 | 9091 | break; | |
8870 | /* close input traffic and wait for it */ | ||
8871 | /* Do not rcv packets to BRB */ | ||
8872 | REG_WR(bp, (port ? NIG_REG_LLH1_BRB1_DRV_MASK : | ||
8873 | NIG_REG_LLH0_BRB1_DRV_MASK), 0x0); | ||
8874 | /* Do not direct rcv packets that are not for MCP to | ||
8875 | * the BRB */ | ||
8876 | REG_WR(bp, (port ? NIG_REG_LLH1_BRB1_NOT_MCP : | ||
8877 | NIG_REG_LLH0_BRB1_NOT_MCP), 0x0); | ||
8878 | /* clear AEU */ | ||
8879 | REG_WR(bp, (port ? MISC_REG_AEU_MASK_ATTN_FUNC_1 : | ||
8880 | MISC_REG_AEU_MASK_ATTN_FUNC_0), 0); | ||
8881 | msleep(10); | ||
8882 | |||
8883 | /* save NIG port swap info */ | ||
8884 | swap_val = REG_RD(bp, NIG_REG_PORT_SWAP); | ||
8885 | swap_en = REG_RD(bp, NIG_REG_STRAP_OVERRIDE); | ||
8886 | /* reset device */ | ||
8887 | REG_WR(bp, | ||
8888 | GRCBASE_MISC + MISC_REGISTERS_RESET_REG_1_CLEAR, | ||
8889 | 0xd3ffffff); | ||
8890 | |||
8891 | value = 0x1400; | ||
8892 | if (CHIP_IS_E3(bp)) { | ||
8893 | value |= MISC_REGISTERS_RESET_REG_2_MSTAT0; | ||
8894 | value |= MISC_REGISTERS_RESET_REG_2_MSTAT1; | ||
8895 | } | ||
8896 | 9092 | ||
8897 | REG_WR(bp, | 9093 | BNX2X_DEV_INFO("BRB still has 0x%08x\n", tmp_reg); |
8898 | GRCBASE_MISC + MISC_REGISTERS_RESET_REG_2_CLEAR, | ||
8899 | value); | ||
8900 | 9094 | ||
8901 | /* take the NIG out of reset and restore swap values */ | 9095 | /* reset timer as long as BRB actually gets emptied */ |
8902 | REG_WR(bp, | 9096 | if (prev_brb > tmp_reg) |
8903 | GRCBASE_MISC + MISC_REGISTERS_RESET_REG_1_SET, | 9097 | timer_count = 1000; |
8904 | MISC_REGISTERS_RESET_REG_1_RST_NIG); | 9098 | else |
8905 | REG_WR(bp, NIG_REG_PORT_SWAP, swap_val); | 9099 | timer_count--; |
8906 | REG_WR(bp, NIG_REG_STRAP_OVERRIDE, swap_en); | ||
8907 | 9100 | ||
8908 | /* send unload done to the MCP */ | 9101 | /* If UNDI resides in memory, manually increment it */ |
8909 | bnx2x_fw_command(bp, DRV_MSG_CODE_UNLOAD_DONE, 0); | 9102 | if (prev_undi) |
9103 | bnx2x_prev_unload_undi_inc(bp, BP_PORT(bp), 1); | ||
8910 | 9104 | ||
8911 | /* restore our func and fw_seq */ | 9105 | udelay(10); |
8912 | bp->pf_num = orig_pf_num; | ||
8913 | } | 9106 | } |
9107 | |||
9108 | if (!timer_count) | ||
9109 | BNX2X_ERR("Failed to empty BRB, hope for the best\n"); | ||
9110 | |||
8914 | } | 9111 | } |
8915 | 9112 | ||
8916 | /* now it's safe to release the lock */ | 9113 | /* No packets are in the pipeline, path is ready for reset */ |
8917 | bnx2x_release_hw_lock(bp, HW_LOCK_RESOURCE_RESET); | 9114 | bnx2x_reset_common(bp); |
9115 | |||
9116 | rc = bnx2x_prev_mark_path(bp); | ||
9117 | if (rc) { | ||
9118 | bnx2x_prev_mcp_done(bp); | ||
9119 | return rc; | ||
9120 | } | ||
9121 | |||
9122 | return bnx2x_prev_mcp_done(bp); | ||
9123 | } | ||
9124 | |||
9125 | static int __devinit bnx2x_prev_unload(struct bnx2x *bp) | ||
9126 | { | ||
9127 | int time_counter = 10; | ||
9128 | u32 rc, fw, hw_lock_reg, hw_lock_val; | ||
9129 | BNX2X_DEV_INFO("Entering Previous Unload Flow\n"); | ||
9130 | |||
9131 | /* Release previously held locks */ | ||
9132 | hw_lock_reg = (BP_FUNC(bp) <= 5) ? | ||
9133 | (MISC_REG_DRIVER_CONTROL_1 + BP_FUNC(bp) * 8) : | ||
9134 | (MISC_REG_DRIVER_CONTROL_7 + (BP_FUNC(bp) - 6) * 8); | ||
9135 | |||
9136 | hw_lock_val = (REG_RD(bp, hw_lock_reg)); | ||
9137 | if (hw_lock_val) { | ||
9138 | if (hw_lock_val & HW_LOCK_RESOURCE_NVRAM) { | ||
9139 | BNX2X_DEV_INFO("Release Previously held NVRAM lock\n"); | ||
9140 | REG_WR(bp, MCP_REG_MCPR_NVM_SW_ARB, | ||
9141 | (MCPR_NVM_SW_ARB_ARB_REQ_CLR1 << BP_PORT(bp))); | ||
9142 | } | ||
9143 | |||
9144 | BNX2X_DEV_INFO("Release Previously held hw lock\n"); | ||
9145 | REG_WR(bp, hw_lock_reg, 0xffffffff); | ||
9146 | } else | ||
9147 | BNX2X_DEV_INFO("No need to release hw/nvram locks\n"); | ||
9148 | |||
9149 | if (MCPR_ACCESS_LOCK_LOCK & REG_RD(bp, MCP_REG_MCPR_ACCESS_LOCK)) { | ||
9150 | BNX2X_DEV_INFO("Release previously held alr\n"); | ||
9151 | REG_WR(bp, MCP_REG_MCPR_ACCESS_LOCK, 0); | ||
9152 | } | ||
9153 | |||
9154 | |||
9155 | do { | ||
9156 | /* Lock MCP using an unload request */ | ||
9157 | fw = bnx2x_fw_command(bp, DRV_MSG_CODE_UNLOAD_REQ_WOL_DIS, 0); | ||
9158 | if (!fw) { | ||
9159 | BNX2X_ERR("MCP response failure, aborting\n"); | ||
9160 | rc = -EBUSY; | ||
9161 | break; | ||
9162 | } | ||
9163 | |||
9164 | if (fw == FW_MSG_CODE_DRV_UNLOAD_COMMON) { | ||
9165 | rc = bnx2x_prev_unload_common(bp); | ||
9166 | break; | ||
9167 | } | ||
9168 | |||
9169 | /* non-common reply from MCP night require looping */ | ||
9170 | rc = bnx2x_prev_unload_uncommon(bp); | ||
9171 | if (rc != BNX2X_PREV_WAIT_NEEDED) | ||
9172 | break; | ||
9173 | |||
9174 | msleep(20); | ||
9175 | } while (--time_counter); | ||
9176 | |||
9177 | if (!time_counter || rc) { | ||
9178 | BNX2X_ERR("Failed unloading previous driver, aborting\n"); | ||
9179 | rc = -EBUSY; | ||
9180 | } | ||
9181 | |||
9182 | BNX2X_DEV_INFO("Finished Previous Unload Flow [%d]\n", rc); | ||
9183 | |||
9184 | return rc; | ||
8918 | } | 9185 | } |
8919 | 9186 | ||
8920 | static void __devinit bnx2x_get_common_hwinfo(struct bnx2x *bp) | 9187 | static void __devinit bnx2x_get_common_hwinfo(struct bnx2x *bp) |
@@ -10100,8 +10367,16 @@ static int __devinit bnx2x_init_bp(struct bnx2x *bp) | |||
10100 | func = BP_FUNC(bp); | 10367 | func = BP_FUNC(bp); |
10101 | 10368 | ||
10102 | /* need to reset chip if undi was active */ | 10369 | /* need to reset chip if undi was active */ |
10103 | if (!BP_NOMCP(bp)) | 10370 | if (!BP_NOMCP(bp)) { |
10104 | bnx2x_undi_unload(bp); | 10371 | /* init fw_seq */ |
10372 | bp->fw_seq = | ||
10373 | SHMEM_RD(bp, func_mb[BP_FW_MB_IDX(bp)].drv_mb_header) & | ||
10374 | DRV_MSG_SEQ_NUMBER_MASK; | ||
10375 | BNX2X_DEV_INFO("fw_seq 0x%08x\n", bp->fw_seq); | ||
10376 | |||
10377 | bnx2x_prev_unload(bp); | ||
10378 | } | ||
10379 | |||
10105 | 10380 | ||
10106 | if (CHIP_REV_IS_FPGA(bp)) | 10381 | if (CHIP_REV_IS_FPGA(bp)) |
10107 | dev_err(&bp->pdev->dev, "FPGA detected\n"); | 10382 | dev_err(&bp->pdev->dev, "FPGA detected\n"); |
@@ -11431,9 +11706,18 @@ static int __init bnx2x_init(void) | |||
11431 | 11706 | ||
11432 | static void __exit bnx2x_cleanup(void) | 11707 | static void __exit bnx2x_cleanup(void) |
11433 | { | 11708 | { |
11709 | struct list_head *pos, *q; | ||
11434 | pci_unregister_driver(&bnx2x_pci_driver); | 11710 | pci_unregister_driver(&bnx2x_pci_driver); |
11435 | 11711 | ||
11436 | destroy_workqueue(bnx2x_wq); | 11712 | destroy_workqueue(bnx2x_wq); |
11713 | |||
11714 | /* Free globablly allocated resources */ | ||
11715 | list_for_each_safe(pos, q, &bnx2x_prev_list) { | ||
11716 | struct bnx2x_prev_path_list *tmp = | ||
11717 | list_entry(pos, struct bnx2x_prev_path_list, list); | ||
11718 | list_del(pos); | ||
11719 | kfree(tmp); | ||
11720 | } | ||
11437 | } | 11721 | } |
11438 | 11722 | ||
11439 | void bnx2x_notify_link_changed(struct bnx2x *bp) | 11723 | void bnx2x_notify_link_changed(struct bnx2x *bp) |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_reg.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_reg.h index fd7fb4581849..c25803b9c0ca 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_reg.h +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_reg.h | |||
@@ -987,6 +987,7 @@ | |||
987 | * clear; 1 = set. Data valid only in addresses 0-4. all the rest are zero. */ | 987 | * clear; 1 = set. Data valid only in addresses 0-4. all the rest are zero. */ |
988 | #define IGU_REG_WRITE_DONE_PENDING 0x130480 | 988 | #define IGU_REG_WRITE_DONE_PENDING 0x130480 |
989 | #define MCP_A_REG_MCPR_SCRATCH 0x3a0000 | 989 | #define MCP_A_REG_MCPR_SCRATCH 0x3a0000 |
990 | #define MCP_REG_MCPR_ACCESS_LOCK 0x8009c | ||
990 | #define MCP_REG_MCPR_CPU_PROGRAM_COUNTER 0x8501c | 991 | #define MCP_REG_MCPR_CPU_PROGRAM_COUNTER 0x8501c |
991 | #define MCP_REG_MCPR_GP_INPUTS 0x800c0 | 992 | #define MCP_REG_MCPR_GP_INPUTS 0x800c0 |
992 | #define MCP_REG_MCPR_GP_OENABLE 0x800c8 | 993 | #define MCP_REG_MCPR_GP_OENABLE 0x800c8 |
@@ -1686,6 +1687,7 @@ | |||
1686 | [10] rst_dbg; [11] rst_misc_core; [12] rst_dbue (UART); [13] | 1687 | [10] rst_dbg; [11] rst_misc_core; [12] rst_dbue (UART); [13] |
1687 | Pci_resetmdio_n; [14] rst_emac0_hard_core; [15] rst_emac1_hard_core; 16] | 1688 | Pci_resetmdio_n; [14] rst_emac0_hard_core; [15] rst_emac1_hard_core; 16] |
1688 | rst_pxp_rq_rd_wr; 31:17] reserved */ | 1689 | rst_pxp_rq_rd_wr; 31:17] reserved */ |
1690 | #define MISC_REG_RESET_REG_1 0xa580 | ||
1689 | #define MISC_REG_RESET_REG_2 0xa590 | 1691 | #define MISC_REG_RESET_REG_2 0xa590 |
1690 | /* [RW 20] 20 bit GRC address where the scratch-pad of the MCP that is | 1692 | /* [RW 20] 20 bit GRC address where the scratch-pad of the MCP that is |
1691 | shared with the driver resides */ | 1693 | shared with the driver resides */ |
@@ -5352,6 +5354,7 @@ | |||
5352 | #define XMAC_CTRL_REG_TX_EN (0x1<<0) | 5354 | #define XMAC_CTRL_REG_TX_EN (0x1<<0) |
5353 | #define XMAC_PAUSE_CTRL_REG_RX_PAUSE_EN (0x1<<18) | 5355 | #define XMAC_PAUSE_CTRL_REG_RX_PAUSE_EN (0x1<<18) |
5354 | #define XMAC_PAUSE_CTRL_REG_TX_PAUSE_EN (0x1<<17) | 5356 | #define XMAC_PAUSE_CTRL_REG_TX_PAUSE_EN (0x1<<17) |
5357 | #define XMAC_PFC_CTRL_HI_REG_FORCE_PFC_XON (0x1<<1) | ||
5355 | #define XMAC_PFC_CTRL_HI_REG_PFC_REFRESH_EN (0x1<<0) | 5358 | #define XMAC_PFC_CTRL_HI_REG_PFC_REFRESH_EN (0x1<<0) |
5356 | #define XMAC_PFC_CTRL_HI_REG_PFC_STATS_EN (0x1<<3) | 5359 | #define XMAC_PFC_CTRL_HI_REG_PFC_STATS_EN (0x1<<3) |
5357 | #define XMAC_PFC_CTRL_HI_REG_RX_PFC_EN (0x1<<4) | 5360 | #define XMAC_PFC_CTRL_HI_REG_RX_PFC_EN (0x1<<4) |
@@ -5606,6 +5609,7 @@ | |||
5606 | /* [RC 32] Parity register #0 read clear */ | 5609 | /* [RC 32] Parity register #0 read clear */ |
5607 | #define XSEM_REG_XSEM_PRTY_STS_CLR_0 0x280128 | 5610 | #define XSEM_REG_XSEM_PRTY_STS_CLR_0 0x280128 |
5608 | #define XSEM_REG_XSEM_PRTY_STS_CLR_1 0x280138 | 5611 | #define XSEM_REG_XSEM_PRTY_STS_CLR_1 0x280138 |
5612 | #define MCPR_ACCESS_LOCK_LOCK (1L<<31) | ||
5609 | #define MCPR_NVM_ACCESS_ENABLE_EN (1L<<0) | 5613 | #define MCPR_NVM_ACCESS_ENABLE_EN (1L<<0) |
5610 | #define MCPR_NVM_ACCESS_ENABLE_WR_EN (1L<<1) | 5614 | #define MCPR_NVM_ACCESS_ENABLE_WR_EN (1L<<1) |
5611 | #define MCPR_NVM_ADDR_NVM_ADDR_VALUE (0xffffffL<<0) | 5615 | #define MCPR_NVM_ADDR_NVM_ADDR_VALUE (0xffffffL<<0) |
@@ -5732,6 +5736,7 @@ | |||
5732 | #define MISC_REGISTERS_GPIO_PORT_SHIFT 4 | 5736 | #define MISC_REGISTERS_GPIO_PORT_SHIFT 4 |
5733 | #define MISC_REGISTERS_GPIO_SET_POS 8 | 5737 | #define MISC_REGISTERS_GPIO_SET_POS 8 |
5734 | #define MISC_REGISTERS_RESET_REG_1_CLEAR 0x588 | 5738 | #define MISC_REGISTERS_RESET_REG_1_CLEAR 0x588 |
5739 | #define MISC_REGISTERS_RESET_REG_1_RST_BRB1 (0x1<<0) | ||
5735 | #define MISC_REGISTERS_RESET_REG_1_RST_DORQ (0x1<<19) | 5740 | #define MISC_REGISTERS_RESET_REG_1_RST_DORQ (0x1<<19) |
5736 | #define MISC_REGISTERS_RESET_REG_1_RST_HC (0x1<<29) | 5741 | #define MISC_REGISTERS_RESET_REG_1_RST_HC (0x1<<29) |
5737 | #define MISC_REGISTERS_RESET_REG_1_RST_NIG (0x1<<7) | 5742 | #define MISC_REGISTERS_RESET_REG_1_RST_NIG (0x1<<7) |
@@ -6816,10 +6821,13 @@ Theotherbitsarereservedandshouldbezero*/ | |||
6816 | 6821 | ||
6817 | #define MDIO_AN_REG_8481_10GBASE_T_AN_CTRL 0x0020 | 6822 | #define MDIO_AN_REG_8481_10GBASE_T_AN_CTRL 0x0020 |
6818 | #define MDIO_AN_REG_8481_LEGACY_MII_CTRL 0xffe0 | 6823 | #define MDIO_AN_REG_8481_LEGACY_MII_CTRL 0xffe0 |
6824 | #define MDIO_AN_REG_8481_MII_CTRL_FORCE_1G 0x40 | ||
6819 | #define MDIO_AN_REG_8481_LEGACY_MII_STATUS 0xffe1 | 6825 | #define MDIO_AN_REG_8481_LEGACY_MII_STATUS 0xffe1 |
6820 | #define MDIO_AN_REG_8481_LEGACY_AN_ADV 0xffe4 | 6826 | #define MDIO_AN_REG_8481_LEGACY_AN_ADV 0xffe4 |
6821 | #define MDIO_AN_REG_8481_LEGACY_AN_EXPANSION 0xffe6 | 6827 | #define MDIO_AN_REG_8481_LEGACY_AN_EXPANSION 0xffe6 |
6822 | #define MDIO_AN_REG_8481_1000T_CTRL 0xffe9 | 6828 | #define MDIO_AN_REG_8481_1000T_CTRL 0xffe9 |
6829 | #define MDIO_AN_REG_8481_1G_100T_EXT_CTRL 0xfff0 | ||
6830 | #define MIDO_AN_REG_8481_EXT_CTRL_FORCE_LEDS_OFF 0x0008 | ||
6823 | #define MDIO_AN_REG_8481_EXPANSION_REG_RD_RW 0xfff5 | 6831 | #define MDIO_AN_REG_8481_EXPANSION_REG_RD_RW 0xfff5 |
6824 | #define MDIO_AN_REG_8481_EXPANSION_REG_ACCESS 0xfff7 | 6832 | #define MDIO_AN_REG_8481_EXPANSION_REG_ACCESS 0xfff7 |
6825 | #define MDIO_AN_REG_8481_AUX_CTRL 0xfff8 | 6833 | #define MDIO_AN_REG_8481_AUX_CTRL 0xfff8 |
@@ -6939,6 +6947,10 @@ Theotherbitsarereservedandshouldbezero*/ | |||
6939 | #define MDIO_WC_REG_GP2_STATUS_GP_2_2 0x81d2 | 6947 | #define MDIO_WC_REG_GP2_STATUS_GP_2_2 0x81d2 |
6940 | #define MDIO_WC_REG_GP2_STATUS_GP_2_3 0x81d3 | 6948 | #define MDIO_WC_REG_GP2_STATUS_GP_2_3 0x81d3 |
6941 | #define MDIO_WC_REG_GP2_STATUS_GP_2_4 0x81d4 | 6949 | #define MDIO_WC_REG_GP2_STATUS_GP_2_4 0x81d4 |
6950 | #define MDIO_WC_REG_GP2_STATUS_GP_2_4_CL73_AN_CMPL 0x1000 | ||
6951 | #define MDIO_WC_REG_GP2_STATUS_GP_2_4_CL37_AN_CMPL 0x0100 | ||
6952 | #define MDIO_WC_REG_GP2_STATUS_GP_2_4_CL37_LP_AN_CAP 0x0010 | ||
6953 | #define MDIO_WC_REG_GP2_STATUS_GP_2_4_CL37_AN_CAP 0x1 | ||
6942 | #define MDIO_WC_REG_UC_INFO_B0_DEAD_TRAP 0x81EE | 6954 | #define MDIO_WC_REG_UC_INFO_B0_DEAD_TRAP 0x81EE |
6943 | #define MDIO_WC_REG_UC_INFO_B1_VERSION 0x81F0 | 6955 | #define MDIO_WC_REG_UC_INFO_B1_VERSION 0x81F0 |
6944 | #define MDIO_WC_REG_UC_INFO_B1_FIRMWARE_MODE 0x81F2 | 6956 | #define MDIO_WC_REG_UC_INFO_B1_FIRMWARE_MODE 0x81F2 |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c index 3f52fadee3ed..513573321625 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c | |||
@@ -3847,7 +3847,7 @@ static bool bnx2x_credit_pool_get_entry( | |||
3847 | continue; | 3847 | continue; |
3848 | 3848 | ||
3849 | /* If we've got here we are going to find a free entry */ | 3849 | /* If we've got here we are going to find a free entry */ |
3850 | for (idx = vec * BNX2X_POOL_VEC_SIZE, i = 0; | 3850 | for (idx = vec * BIT_VEC64_ELEM_SZ, i = 0; |
3851 | i < BIT_VEC64_ELEM_SZ; idx++, i++) | 3851 | i < BIT_VEC64_ELEM_SZ; idx++, i++) |
3852 | 3852 | ||
3853 | if (BIT_VEC64_TEST_BIT(o->pool_mirror, idx)) { | 3853 | if (BIT_VEC64_TEST_BIT(o->pool_mirror, idx)) { |
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c index 4e4bb3875868..062ac333fde6 100644 --- a/drivers/net/ethernet/broadcom/tg3.c +++ b/drivers/net/ethernet/broadcom/tg3.c | |||
@@ -2778,7 +2778,9 @@ static void tg3_power_down_phy(struct tg3 *tp, bool do_low_power) | |||
2778 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5700 || | 2778 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5700 || |
2779 | GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704 || | 2779 | GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704 || |
2780 | (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5780 && | 2780 | (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5780 && |
2781 | (tp->phy_flags & TG3_PHYFLG_MII_SERDES))) | 2781 | (tp->phy_flags & TG3_PHYFLG_MII_SERDES)) || |
2782 | (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5717 && | ||
2783 | !tp->pci_fn)) | ||
2782 | return; | 2784 | return; |
2783 | 2785 | ||
2784 | if (GET_CHIP_REV(tp->pci_chip_rev_id) == CHIPREV_5784_AX || | 2786 | if (GET_CHIP_REV(tp->pci_chip_rev_id) == CHIPREV_5784_AX || |
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c index 05ff076af06d..b126b98065a9 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c | |||
@@ -2000,13 +2000,6 @@ static const struct ethtool_ops cxgb_ethtool_ops = { | |||
2000 | /* | 2000 | /* |
2001 | * debugfs support | 2001 | * debugfs support |
2002 | */ | 2002 | */ |
2003 | |||
2004 | static int mem_open(struct inode *inode, struct file *file) | ||
2005 | { | ||
2006 | file->private_data = inode->i_private; | ||
2007 | return 0; | ||
2008 | } | ||
2009 | |||
2010 | static ssize_t mem_read(struct file *file, char __user *buf, size_t count, | 2003 | static ssize_t mem_read(struct file *file, char __user *buf, size_t count, |
2011 | loff_t *ppos) | 2004 | loff_t *ppos) |
2012 | { | 2005 | { |
@@ -2050,7 +2043,7 @@ static ssize_t mem_read(struct file *file, char __user *buf, size_t count, | |||
2050 | 2043 | ||
2051 | static const struct file_operations mem_debugfs_fops = { | 2044 | static const struct file_operations mem_debugfs_fops = { |
2052 | .owner = THIS_MODULE, | 2045 | .owner = THIS_MODULE, |
2053 | .open = mem_open, | 2046 | .open = simple_open, |
2054 | .read = mem_read, | 2047 | .read = mem_read, |
2055 | .llseek = default_llseek, | 2048 | .llseek = default_llseek, |
2056 | }; | 2049 | }; |
diff --git a/drivers/net/ethernet/freescale/fsl_pq_mdio.c b/drivers/net/ethernet/freescale/fsl_pq_mdio.c index 9eb815941df5..f7f0bf5d037b 100644 --- a/drivers/net/ethernet/freescale/fsl_pq_mdio.c +++ b/drivers/net/ethernet/freescale/fsl_pq_mdio.c | |||
@@ -356,13 +356,13 @@ static int fsl_pq_mdio_probe(struct platform_device *ofdev) | |||
356 | 356 | ||
357 | if (prop) | 357 | if (prop) |
358 | tbiaddr = *prop; | 358 | tbiaddr = *prop; |
359 | } | ||
360 | 359 | ||
361 | if (tbiaddr == -1) { | 360 | if (tbiaddr == -1) { |
362 | err = -EBUSY; | 361 | err = -EBUSY; |
363 | goto err_free_irqs; | 362 | goto err_free_irqs; |
364 | } else { | 363 | } else { |
365 | out_be32(tbipa, tbiaddr); | 364 | out_be32(tbipa, tbiaddr); |
365 | } | ||
366 | } | 366 | } |
367 | 367 | ||
368 | err = of_mdiobus_register(new_bus, np); | 368 | err = of_mdiobus_register(new_bus, np); |
diff --git a/drivers/net/ethernet/freescale/ucc_geth.c b/drivers/net/ethernet/freescale/ucc_geth.c index 4e3cd2f8debb..17a46e76123f 100644 --- a/drivers/net/ethernet/freescale/ucc_geth.c +++ b/drivers/net/ethernet/freescale/ucc_geth.c | |||
@@ -3945,6 +3945,8 @@ static int ucc_geth_probe(struct platform_device* ofdev) | |||
3945 | } | 3945 | } |
3946 | 3946 | ||
3947 | if (max_speed == SPEED_1000) { | 3947 | if (max_speed == SPEED_1000) { |
3948 | unsigned int snums = qe_get_num_of_snums(); | ||
3949 | |||
3948 | /* configure muram FIFOs for gigabit operation */ | 3950 | /* configure muram FIFOs for gigabit operation */ |
3949 | ug_info->uf_info.urfs = UCC_GETH_URFS_GIGA_INIT; | 3951 | ug_info->uf_info.urfs = UCC_GETH_URFS_GIGA_INIT; |
3950 | ug_info->uf_info.urfet = UCC_GETH_URFET_GIGA_INIT; | 3952 | ug_info->uf_info.urfet = UCC_GETH_URFET_GIGA_INIT; |
@@ -3954,11 +3956,11 @@ static int ucc_geth_probe(struct platform_device* ofdev) | |||
3954 | ug_info->uf_info.utftt = UCC_GETH_UTFTT_GIGA_INIT; | 3956 | ug_info->uf_info.utftt = UCC_GETH_UTFTT_GIGA_INIT; |
3955 | ug_info->numThreadsTx = UCC_GETH_NUM_OF_THREADS_4; | 3957 | ug_info->numThreadsTx = UCC_GETH_NUM_OF_THREADS_4; |
3956 | 3958 | ||
3957 | /* If QE's snum number is 46 which means we need to support | 3959 | /* If QE's snum number is 46/76 which means we need to support |
3958 | * 4 UECs at 1000Base-T simultaneously, we need to allocate | 3960 | * 4 UECs at 1000Base-T simultaneously, we need to allocate |
3959 | * more Threads to Rx. | 3961 | * more Threads to Rx. |
3960 | */ | 3962 | */ |
3961 | if (qe_get_num_of_snums() == 46) | 3963 | if ((snums == 76) || (snums == 46)) |
3962 | ug_info->numThreadsRx = UCC_GETH_NUM_OF_THREADS_6; | 3964 | ug_info->numThreadsRx = UCC_GETH_NUM_OF_THREADS_6; |
3963 | else | 3965 | else |
3964 | ug_info->numThreadsRx = UCC_GETH_NUM_OF_THREADS_4; | 3966 | ug_info->numThreadsRx = UCC_GETH_NUM_OF_THREADS_4; |
diff --git a/drivers/net/ethernet/intel/e1000/e1000_main.c b/drivers/net/ethernet/intel/e1000/e1000_main.c index 0e9aec8f6917..4348b6fd44fa 100644 --- a/drivers/net/ethernet/intel/e1000/e1000_main.c +++ b/drivers/net/ethernet/intel/e1000/e1000_main.c | |||
@@ -164,6 +164,8 @@ static int e1000_82547_fifo_workaround(struct e1000_adapter *adapter, | |||
164 | static bool e1000_vlan_used(struct e1000_adapter *adapter); | 164 | static bool e1000_vlan_used(struct e1000_adapter *adapter); |
165 | static void e1000_vlan_mode(struct net_device *netdev, | 165 | static void e1000_vlan_mode(struct net_device *netdev, |
166 | netdev_features_t features); | 166 | netdev_features_t features); |
167 | static void e1000_vlan_filter_on_off(struct e1000_adapter *adapter, | ||
168 | bool filter_on); | ||
167 | static int e1000_vlan_rx_add_vid(struct net_device *netdev, u16 vid); | 169 | static int e1000_vlan_rx_add_vid(struct net_device *netdev, u16 vid); |
168 | static int e1000_vlan_rx_kill_vid(struct net_device *netdev, u16 vid); | 170 | static int e1000_vlan_rx_kill_vid(struct net_device *netdev, u16 vid); |
169 | static void e1000_restore_vlan(struct e1000_adapter *adapter); | 171 | static void e1000_restore_vlan(struct e1000_adapter *adapter); |
@@ -215,7 +217,8 @@ MODULE_DESCRIPTION("Intel(R) PRO/1000 Network Driver"); | |||
215 | MODULE_LICENSE("GPL"); | 217 | MODULE_LICENSE("GPL"); |
216 | MODULE_VERSION(DRV_VERSION); | 218 | MODULE_VERSION(DRV_VERSION); |
217 | 219 | ||
218 | static int debug = NETIF_MSG_DRV | NETIF_MSG_PROBE; | 220 | #define DEFAULT_MSG_ENABLE (NETIF_MSG_DRV|NETIF_MSG_PROBE|NETIF_MSG_LINK) |
221 | static int debug = -1; | ||
219 | module_param(debug, int, 0); | 222 | module_param(debug, int, 0); |
220 | MODULE_PARM_DESC(debug, "Debug level (0=none,...,16=all)"); | 223 | MODULE_PARM_DESC(debug, "Debug level (0=none,...,16=all)"); |
221 | 224 | ||
@@ -979,7 +982,7 @@ static int __devinit e1000_probe(struct pci_dev *pdev, | |||
979 | adapter = netdev_priv(netdev); | 982 | adapter = netdev_priv(netdev); |
980 | adapter->netdev = netdev; | 983 | adapter->netdev = netdev; |
981 | adapter->pdev = pdev; | 984 | adapter->pdev = pdev; |
982 | adapter->msg_enable = (1 << debug) - 1; | 985 | adapter->msg_enable = netif_msg_init(debug, DEFAULT_MSG_ENABLE); |
983 | adapter->bars = bars; | 986 | adapter->bars = bars; |
984 | adapter->need_ioport = need_ioport; | 987 | adapter->need_ioport = need_ioport; |
985 | 988 | ||
@@ -1214,7 +1217,7 @@ static int __devinit e1000_probe(struct pci_dev *pdev, | |||
1214 | if (err) | 1217 | if (err) |
1215 | goto err_register; | 1218 | goto err_register; |
1216 | 1219 | ||
1217 | e1000_vlan_mode(netdev, netdev->features); | 1220 | e1000_vlan_filter_on_off(adapter, false); |
1218 | 1221 | ||
1219 | /* print bus type/speed/width info */ | 1222 | /* print bus type/speed/width info */ |
1220 | e_info(probe, "(PCI%s:%dMHz:%d-bit) %pM\n", | 1223 | e_info(probe, "(PCI%s:%dMHz:%d-bit) %pM\n", |
@@ -4770,6 +4773,22 @@ static bool e1000_vlan_used(struct e1000_adapter *adapter) | |||
4770 | return false; | 4773 | return false; |
4771 | } | 4774 | } |
4772 | 4775 | ||
4776 | static void __e1000_vlan_mode(struct e1000_adapter *adapter, | ||
4777 | netdev_features_t features) | ||
4778 | { | ||
4779 | struct e1000_hw *hw = &adapter->hw; | ||
4780 | u32 ctrl; | ||
4781 | |||
4782 | ctrl = er32(CTRL); | ||
4783 | if (features & NETIF_F_HW_VLAN_RX) { | ||
4784 | /* enable VLAN tag insert/strip */ | ||
4785 | ctrl |= E1000_CTRL_VME; | ||
4786 | } else { | ||
4787 | /* disable VLAN tag insert/strip */ | ||
4788 | ctrl &= ~E1000_CTRL_VME; | ||
4789 | } | ||
4790 | ew32(CTRL, ctrl); | ||
4791 | } | ||
4773 | static void e1000_vlan_filter_on_off(struct e1000_adapter *adapter, | 4792 | static void e1000_vlan_filter_on_off(struct e1000_adapter *adapter, |
4774 | bool filter_on) | 4793 | bool filter_on) |
4775 | { | 4794 | { |
@@ -4779,6 +4798,7 @@ static void e1000_vlan_filter_on_off(struct e1000_adapter *adapter, | |||
4779 | if (!test_bit(__E1000_DOWN, &adapter->flags)) | 4798 | if (!test_bit(__E1000_DOWN, &adapter->flags)) |
4780 | e1000_irq_disable(adapter); | 4799 | e1000_irq_disable(adapter); |
4781 | 4800 | ||
4801 | __e1000_vlan_mode(adapter, adapter->netdev->features); | ||
4782 | if (filter_on) { | 4802 | if (filter_on) { |
4783 | /* enable VLAN receive filtering */ | 4803 | /* enable VLAN receive filtering */ |
4784 | rctl = er32(RCTL); | 4804 | rctl = er32(RCTL); |
@@ -4799,24 +4819,14 @@ static void e1000_vlan_filter_on_off(struct e1000_adapter *adapter, | |||
4799 | } | 4819 | } |
4800 | 4820 | ||
4801 | static void e1000_vlan_mode(struct net_device *netdev, | 4821 | static void e1000_vlan_mode(struct net_device *netdev, |
4802 | netdev_features_t features) | 4822 | netdev_features_t features) |
4803 | { | 4823 | { |
4804 | struct e1000_adapter *adapter = netdev_priv(netdev); | 4824 | struct e1000_adapter *adapter = netdev_priv(netdev); |
4805 | struct e1000_hw *hw = &adapter->hw; | ||
4806 | u32 ctrl; | ||
4807 | 4825 | ||
4808 | if (!test_bit(__E1000_DOWN, &adapter->flags)) | 4826 | if (!test_bit(__E1000_DOWN, &adapter->flags)) |
4809 | e1000_irq_disable(adapter); | 4827 | e1000_irq_disable(adapter); |
4810 | 4828 | ||
4811 | ctrl = er32(CTRL); | 4829 | __e1000_vlan_mode(adapter, features); |
4812 | if (features & NETIF_F_HW_VLAN_RX) { | ||
4813 | /* enable VLAN tag insert/strip */ | ||
4814 | ctrl |= E1000_CTRL_VME; | ||
4815 | } else { | ||
4816 | /* disable VLAN tag insert/strip */ | ||
4817 | ctrl &= ~E1000_CTRL_VME; | ||
4818 | } | ||
4819 | ew32(CTRL, ctrl); | ||
4820 | 4830 | ||
4821 | if (!test_bit(__E1000_DOWN, &adapter->flags)) | 4831 | if (!test_bit(__E1000_DOWN, &adapter->flags)) |
4822 | e1000_irq_enable(adapter); | 4832 | e1000_irq_enable(adapter); |
diff --git a/drivers/net/ethernet/intel/e1000e/e1000.h b/drivers/net/ethernet/intel/e1000e/e1000.h index 86cdd4793992..b83897f76ee3 100644 --- a/drivers/net/ethernet/intel/e1000e/e1000.h +++ b/drivers/net/ethernet/intel/e1000e/e1000.h | |||
@@ -161,6 +161,12 @@ struct e1000_info; | |||
161 | /* Time to wait before putting the device into D3 if there's no link (in ms). */ | 161 | /* Time to wait before putting the device into D3 if there's no link (in ms). */ |
162 | #define LINK_TIMEOUT 100 | 162 | #define LINK_TIMEOUT 100 |
163 | 163 | ||
164 | /* | ||
165 | * Count for polling __E1000_RESET condition every 10-20msec. | ||
166 | * Experimentation has shown the reset can take approximately 210msec. | ||
167 | */ | ||
168 | #define E1000_CHECK_RESET_COUNT 25 | ||
169 | |||
164 | #define DEFAULT_RDTR 0 | 170 | #define DEFAULT_RDTR 0 |
165 | #define DEFAULT_RADV 8 | 171 | #define DEFAULT_RADV 8 |
166 | #define BURST_RDTR 0x20 | 172 | #define BURST_RDTR 0x20 |
diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c index 7152eb11b7b9..19ab2154802c 100644 --- a/drivers/net/ethernet/intel/e1000e/netdev.c +++ b/drivers/net/ethernet/intel/e1000e/netdev.c | |||
@@ -60,6 +60,11 @@ | |||
60 | char e1000e_driver_name[] = "e1000e"; | 60 | char e1000e_driver_name[] = "e1000e"; |
61 | const char e1000e_driver_version[] = DRV_VERSION; | 61 | const char e1000e_driver_version[] = DRV_VERSION; |
62 | 62 | ||
63 | #define DEFAULT_MSG_ENABLE (NETIF_MSG_DRV|NETIF_MSG_PROBE|NETIF_MSG_LINK) | ||
64 | static int debug = -1; | ||
65 | module_param(debug, int, 0); | ||
66 | MODULE_PARM_DESC(debug, "Debug level (0=none,...,16=all)"); | ||
67 | |||
63 | static void e1000e_disable_aspm(struct pci_dev *pdev, u16 state); | 68 | static void e1000e_disable_aspm(struct pci_dev *pdev, u16 state); |
64 | 69 | ||
65 | static const struct e1000_info *e1000_info_tbl[] = { | 70 | static const struct e1000_info *e1000_info_tbl[] = { |
@@ -1054,6 +1059,13 @@ static void e1000_print_hw_hang(struct work_struct *work) | |||
1054 | ew32(TIDV, adapter->tx_int_delay | E1000_TIDV_FPD); | 1059 | ew32(TIDV, adapter->tx_int_delay | E1000_TIDV_FPD); |
1055 | /* execute the writes immediately */ | 1060 | /* execute the writes immediately */ |
1056 | e1e_flush(); | 1061 | e1e_flush(); |
1062 | /* | ||
1063 | * Due to rare timing issues, write to TIDV again to ensure | ||
1064 | * the write is successful | ||
1065 | */ | ||
1066 | ew32(TIDV, adapter->tx_int_delay | E1000_TIDV_FPD); | ||
1067 | /* execute the writes immediately */ | ||
1068 | e1e_flush(); | ||
1057 | adapter->tx_hang_recheck = true; | 1069 | adapter->tx_hang_recheck = true; |
1058 | return; | 1070 | return; |
1059 | } | 1071 | } |
@@ -3611,6 +3623,16 @@ static void e1000e_flush_descriptors(struct e1000_adapter *adapter) | |||
3611 | 3623 | ||
3612 | /* execute the writes immediately */ | 3624 | /* execute the writes immediately */ |
3613 | e1e_flush(); | 3625 | e1e_flush(); |
3626 | |||
3627 | /* | ||
3628 | * due to rare timing issues, write to TIDV/RDTR again to ensure the | ||
3629 | * write is successful | ||
3630 | */ | ||
3631 | ew32(TIDV, adapter->tx_int_delay | E1000_TIDV_FPD); | ||
3632 | ew32(RDTR, adapter->rx_int_delay | E1000_RDTR_FPD); | ||
3633 | |||
3634 | /* execute the writes immediately */ | ||
3635 | e1e_flush(); | ||
3614 | } | 3636 | } |
3615 | 3637 | ||
3616 | static void e1000e_update_stats(struct e1000_adapter *adapter); | 3638 | static void e1000e_update_stats(struct e1000_adapter *adapter); |
@@ -3963,6 +3985,10 @@ static int e1000_close(struct net_device *netdev) | |||
3963 | { | 3985 | { |
3964 | struct e1000_adapter *adapter = netdev_priv(netdev); | 3986 | struct e1000_adapter *adapter = netdev_priv(netdev); |
3965 | struct pci_dev *pdev = adapter->pdev; | 3987 | struct pci_dev *pdev = adapter->pdev; |
3988 | int count = E1000_CHECK_RESET_COUNT; | ||
3989 | |||
3990 | while (test_bit(__E1000_RESETTING, &adapter->state) && count--) | ||
3991 | usleep_range(10000, 20000); | ||
3966 | 3992 | ||
3967 | WARN_ON(test_bit(__E1000_RESETTING, &adapter->state)); | 3993 | WARN_ON(test_bit(__E1000_RESETTING, &adapter->state)); |
3968 | 3994 | ||
@@ -5467,6 +5493,11 @@ static int __e1000_shutdown(struct pci_dev *pdev, bool *enable_wake, | |||
5467 | netif_device_detach(netdev); | 5493 | netif_device_detach(netdev); |
5468 | 5494 | ||
5469 | if (netif_running(netdev)) { | 5495 | if (netif_running(netdev)) { |
5496 | int count = E1000_CHECK_RESET_COUNT; | ||
5497 | |||
5498 | while (test_bit(__E1000_RESETTING, &adapter->state) && count--) | ||
5499 | usleep_range(10000, 20000); | ||
5500 | |||
5470 | WARN_ON(test_bit(__E1000_RESETTING, &adapter->state)); | 5501 | WARN_ON(test_bit(__E1000_RESETTING, &adapter->state)); |
5471 | e1000e_down(adapter); | 5502 | e1000e_down(adapter); |
5472 | e1000_free_irq(adapter); | 5503 | e1000_free_irq(adapter); |
@@ -6172,7 +6203,7 @@ static int __devinit e1000_probe(struct pci_dev *pdev, | |||
6172 | adapter->hw.adapter = adapter; | 6203 | adapter->hw.adapter = adapter; |
6173 | adapter->hw.mac.type = ei->mac; | 6204 | adapter->hw.mac.type = ei->mac; |
6174 | adapter->max_hw_frame_size = ei->max_hw_frame_size; | 6205 | adapter->max_hw_frame_size = ei->max_hw_frame_size; |
6175 | adapter->msg_enable = (1 << NETIF_MSG_DRV | NETIF_MSG_PROBE) - 1; | 6206 | adapter->msg_enable = netif_msg_init(debug, DEFAULT_MSG_ENABLE); |
6176 | 6207 | ||
6177 | mmio_start = pci_resource_start(pdev, 0); | 6208 | mmio_start = pci_resource_start(pdev, 0); |
6178 | mmio_len = pci_resource_len(pdev, 0); | 6209 | mmio_len = pci_resource_len(pdev, 0); |
diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c index c4902411d749..5ec31598ee47 100644 --- a/drivers/net/ethernet/intel/igb/igb_main.c +++ b/drivers/net/ethernet/intel/igb/igb_main.c | |||
@@ -238,6 +238,11 @@ MODULE_DESCRIPTION("Intel(R) Gigabit Ethernet Network Driver"); | |||
238 | MODULE_LICENSE("GPL"); | 238 | MODULE_LICENSE("GPL"); |
239 | MODULE_VERSION(DRV_VERSION); | 239 | MODULE_VERSION(DRV_VERSION); |
240 | 240 | ||
241 | #define DEFAULT_MSG_ENABLE (NETIF_MSG_DRV|NETIF_MSG_PROBE|NETIF_MSG_LINK) | ||
242 | static int debug = -1; | ||
243 | module_param(debug, int, 0); | ||
244 | MODULE_PARM_DESC(debug, "Debug level (0=none,...,16=all)"); | ||
245 | |||
241 | struct igb_reg_info { | 246 | struct igb_reg_info { |
242 | u32 ofs; | 247 | u32 ofs; |
243 | char *name; | 248 | char *name; |
@@ -1893,7 +1898,7 @@ static int __devinit igb_probe(struct pci_dev *pdev, | |||
1893 | adapter->pdev = pdev; | 1898 | adapter->pdev = pdev; |
1894 | hw = &adapter->hw; | 1899 | hw = &adapter->hw; |
1895 | hw->back = adapter; | 1900 | hw->back = adapter; |
1896 | adapter->msg_enable = NETIF_MSG_DRV | NETIF_MSG_PROBE; | 1901 | adapter->msg_enable = netif_msg_init(debug, DEFAULT_MSG_ENABLE); |
1897 | 1902 | ||
1898 | mmio_start = pci_resource_start(pdev, 0); | 1903 | mmio_start = pci_resource_start(pdev, 0); |
1899 | mmio_len = pci_resource_len(pdev, 0); | 1904 | mmio_len = pci_resource_len(pdev, 0); |
diff --git a/drivers/net/ethernet/intel/igbvf/netdev.c b/drivers/net/ethernet/intel/igbvf/netdev.c index 217c143686d2..d61ca2a732f0 100644 --- a/drivers/net/ethernet/intel/igbvf/netdev.c +++ b/drivers/net/ethernet/intel/igbvf/netdev.c | |||
@@ -55,6 +55,11 @@ static const char igbvf_driver_string[] = | |||
55 | static const char igbvf_copyright[] = | 55 | static const char igbvf_copyright[] = |
56 | "Copyright (c) 2009 - 2012 Intel Corporation."; | 56 | "Copyright (c) 2009 - 2012 Intel Corporation."; |
57 | 57 | ||
58 | #define DEFAULT_MSG_ENABLE (NETIF_MSG_DRV|NETIF_MSG_PROBE|NETIF_MSG_LINK) | ||
59 | static int debug = -1; | ||
60 | module_param(debug, int, 0); | ||
61 | MODULE_PARM_DESC(debug, "Debug level (0=none,...,16=all)"); | ||
62 | |||
58 | static int igbvf_poll(struct napi_struct *napi, int budget); | 63 | static int igbvf_poll(struct napi_struct *napi, int budget); |
59 | static void igbvf_reset(struct igbvf_adapter *); | 64 | static void igbvf_reset(struct igbvf_adapter *); |
60 | static void igbvf_set_interrupt_capability(struct igbvf_adapter *); | 65 | static void igbvf_set_interrupt_capability(struct igbvf_adapter *); |
@@ -2649,7 +2654,7 @@ static int __devinit igbvf_probe(struct pci_dev *pdev, | |||
2649 | adapter->flags = ei->flags; | 2654 | adapter->flags = ei->flags; |
2650 | adapter->hw.back = adapter; | 2655 | adapter->hw.back = adapter; |
2651 | adapter->hw.mac.type = ei->mac; | 2656 | adapter->hw.mac.type = ei->mac; |
2652 | adapter->msg_enable = (1 << NETIF_MSG_DRV | NETIF_MSG_PROBE) - 1; | 2657 | adapter->msg_enable = netif_msg_init(debug, DEFAULT_MSG_ENABLE); |
2653 | 2658 | ||
2654 | /* PCI config space info */ | 2659 | /* PCI config space info */ |
2655 | 2660 | ||
diff --git a/drivers/net/ethernet/intel/ixgb/ixgb_main.c b/drivers/net/ethernet/intel/ixgb/ixgb_main.c index 82aaa792cbf3..5fce363d810a 100644 --- a/drivers/net/ethernet/intel/ixgb/ixgb_main.c +++ b/drivers/net/ethernet/intel/ixgb/ixgb_main.c | |||
@@ -134,8 +134,8 @@ MODULE_DESCRIPTION("Intel(R) PRO/10GbE Network Driver"); | |||
134 | MODULE_LICENSE("GPL"); | 134 | MODULE_LICENSE("GPL"); |
135 | MODULE_VERSION(DRV_VERSION); | 135 | MODULE_VERSION(DRV_VERSION); |
136 | 136 | ||
137 | #define DEFAULT_DEBUG_LEVEL_SHIFT 3 | 137 | #define DEFAULT_MSG_ENABLE (NETIF_MSG_DRV|NETIF_MSG_PROBE|NETIF_MSG_LINK) |
138 | static int debug = DEFAULT_DEBUG_LEVEL_SHIFT; | 138 | static int debug = -1; |
139 | module_param(debug, int, 0); | 139 | module_param(debug, int, 0); |
140 | MODULE_PARM_DESC(debug, "Debug level (0=none,...,16=all)"); | 140 | MODULE_PARM_DESC(debug, "Debug level (0=none,...,16=all)"); |
141 | 141 | ||
@@ -442,7 +442,7 @@ ixgb_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
442 | adapter->netdev = netdev; | 442 | adapter->netdev = netdev; |
443 | adapter->pdev = pdev; | 443 | adapter->pdev = pdev; |
444 | adapter->hw.back = adapter; | 444 | adapter->hw.back = adapter; |
445 | adapter->msg_enable = netif_msg_init(debug, DEFAULT_DEBUG_LEVEL_SHIFT); | 445 | adapter->msg_enable = netif_msg_init(debug, DEFAULT_MSG_ENABLE); |
446 | 446 | ||
447 | adapter->hw.hw_addr = pci_ioremap_bar(pdev, BAR_0); | 447 | adapter->hw.hw_addr = pci_ioremap_bar(pdev, BAR_0); |
448 | if (!adapter->hw.hw_addr) { | 448 | if (!adapter->hw.hw_addr) { |
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe.h b/drivers/net/ethernet/intel/ixgbe/ixgbe.h index 80e26ff30ebf..74e192107f9a 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe.h +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe.h | |||
@@ -544,7 +544,7 @@ struct ixgbe_fdir_filter { | |||
544 | u16 action; | 544 | u16 action; |
545 | }; | 545 | }; |
546 | 546 | ||
547 | enum ixbge_state_t { | 547 | enum ixgbe_state_t { |
548 | __IXGBE_TESTING, | 548 | __IXGBE_TESTING, |
549 | __IXGBE_RESETTING, | 549 | __IXGBE_RESETTING, |
550 | __IXGBE_DOWN, | 550 | __IXGBE_DOWN, |
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_nl.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_nl.c index dde65f951400..652e4b09546d 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_nl.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_nl.c | |||
@@ -44,62 +44,94 @@ | |||
44 | #define DCB_NO_HW_CHG 1 /* DCB configuration did not change */ | 44 | #define DCB_NO_HW_CHG 1 /* DCB configuration did not change */ |
45 | #define DCB_HW_CHG 2 /* DCB configuration changed, no reset */ | 45 | #define DCB_HW_CHG 2 /* DCB configuration changed, no reset */ |
46 | 46 | ||
47 | int ixgbe_copy_dcb_cfg(struct ixgbe_dcb_config *src_dcb_cfg, | 47 | int ixgbe_copy_dcb_cfg(struct ixgbe_dcb_config *scfg, |
48 | struct ixgbe_dcb_config *dst_dcb_cfg, int tc_max) | 48 | struct ixgbe_dcb_config *dcfg, int tc_max) |
49 | { | 49 | { |
50 | struct tc_configuration *src_tc_cfg = NULL; | 50 | struct tc_configuration *src = NULL; |
51 | struct tc_configuration *dst_tc_cfg = NULL; | 51 | struct tc_configuration *dst = NULL; |
52 | int i; | 52 | int i, j; |
53 | int tx = DCB_TX_CONFIG; | ||
54 | int rx = DCB_RX_CONFIG; | ||
55 | int changes = 0; | ||
53 | 56 | ||
54 | if (!src_dcb_cfg || !dst_dcb_cfg) | 57 | if (!scfg || !dcfg) |
55 | return -EINVAL; | 58 | return changes; |
56 | 59 | ||
57 | for (i = DCB_PG_ATTR_TC_0; i < tc_max + DCB_PG_ATTR_TC_0; i++) { | 60 | for (i = DCB_PG_ATTR_TC_0; i < tc_max + DCB_PG_ATTR_TC_0; i++) { |
58 | src_tc_cfg = &src_dcb_cfg->tc_config[i - DCB_PG_ATTR_TC_0]; | 61 | src = &scfg->tc_config[i - DCB_PG_ATTR_TC_0]; |
59 | dst_tc_cfg = &dst_dcb_cfg->tc_config[i - DCB_PG_ATTR_TC_0]; | 62 | dst = &dcfg->tc_config[i - DCB_PG_ATTR_TC_0]; |
60 | 63 | ||
61 | dst_tc_cfg->path[DCB_TX_CONFIG].prio_type = | 64 | if (dst->path[tx].prio_type != src->path[tx].prio_type) { |
62 | src_tc_cfg->path[DCB_TX_CONFIG].prio_type; | 65 | dst->path[tx].prio_type = src->path[tx].prio_type; |
66 | changes |= BIT_PG_TX; | ||
67 | } | ||
63 | 68 | ||
64 | dst_tc_cfg->path[DCB_TX_CONFIG].bwg_id = | 69 | if (dst->path[tx].bwg_id != src->path[tx].bwg_id) { |
65 | src_tc_cfg->path[DCB_TX_CONFIG].bwg_id; | 70 | dst->path[tx].bwg_id = src->path[tx].bwg_id; |
71 | changes |= BIT_PG_TX; | ||
72 | } | ||
66 | 73 | ||
67 | dst_tc_cfg->path[DCB_TX_CONFIG].bwg_percent = | 74 | if (dst->path[tx].bwg_percent != src->path[tx].bwg_percent) { |
68 | src_tc_cfg->path[DCB_TX_CONFIG].bwg_percent; | 75 | dst->path[tx].bwg_percent = src->path[tx].bwg_percent; |
76 | changes |= BIT_PG_TX; | ||
77 | } | ||
69 | 78 | ||
70 | dst_tc_cfg->path[DCB_TX_CONFIG].up_to_tc_bitmap = | 79 | if (dst->path[tx].up_to_tc_bitmap != |
71 | src_tc_cfg->path[DCB_TX_CONFIG].up_to_tc_bitmap; | 80 | src->path[tx].up_to_tc_bitmap) { |
81 | dst->path[tx].up_to_tc_bitmap = | ||
82 | src->path[tx].up_to_tc_bitmap; | ||
83 | changes |= (BIT_PG_TX | BIT_PFC | BIT_APP_UPCHG); | ||
84 | } | ||
72 | 85 | ||
73 | dst_tc_cfg->path[DCB_RX_CONFIG].prio_type = | 86 | if (dst->path[rx].prio_type != src->path[rx].prio_type) { |
74 | src_tc_cfg->path[DCB_RX_CONFIG].prio_type; | 87 | dst->path[rx].prio_type = src->path[rx].prio_type; |
88 | changes |= BIT_PG_RX; | ||
89 | } | ||
75 | 90 | ||
76 | dst_tc_cfg->path[DCB_RX_CONFIG].bwg_id = | 91 | if (dst->path[rx].bwg_id != src->path[rx].bwg_id) { |
77 | src_tc_cfg->path[DCB_RX_CONFIG].bwg_id; | 92 | dst->path[rx].bwg_id = src->path[rx].bwg_id; |
93 | changes |= BIT_PG_RX; | ||
94 | } | ||
78 | 95 | ||
79 | dst_tc_cfg->path[DCB_RX_CONFIG].bwg_percent = | 96 | if (dst->path[rx].bwg_percent != src->path[rx].bwg_percent) { |
80 | src_tc_cfg->path[DCB_RX_CONFIG].bwg_percent; | 97 | dst->path[rx].bwg_percent = src->path[rx].bwg_percent; |
98 | changes |= BIT_PG_RX; | ||
99 | } | ||
81 | 100 | ||
82 | dst_tc_cfg->path[DCB_RX_CONFIG].up_to_tc_bitmap = | 101 | if (dst->path[rx].up_to_tc_bitmap != |
83 | src_tc_cfg->path[DCB_RX_CONFIG].up_to_tc_bitmap; | 102 | src->path[rx].up_to_tc_bitmap) { |
103 | dst->path[rx].up_to_tc_bitmap = | ||
104 | src->path[rx].up_to_tc_bitmap; | ||
105 | changes |= (BIT_PG_RX | BIT_PFC | BIT_APP_UPCHG); | ||
106 | } | ||
84 | } | 107 | } |
85 | 108 | ||
86 | for (i = DCB_PG_ATTR_BW_ID_0; i < DCB_PG_ATTR_BW_ID_MAX; i++) { | 109 | for (i = DCB_PG_ATTR_BW_ID_0; i < DCB_PG_ATTR_BW_ID_MAX; i++) { |
87 | dst_dcb_cfg->bw_percentage[DCB_TX_CONFIG] | 110 | j = i - DCB_PG_ATTR_BW_ID_0; |
88 | [i-DCB_PG_ATTR_BW_ID_0] = src_dcb_cfg->bw_percentage | 111 | if (dcfg->bw_percentage[tx][j] != scfg->bw_percentage[tx][j]) { |
89 | [DCB_TX_CONFIG][i-DCB_PG_ATTR_BW_ID_0]; | 112 | dcfg->bw_percentage[tx][j] = scfg->bw_percentage[tx][j]; |
90 | dst_dcb_cfg->bw_percentage[DCB_RX_CONFIG] | 113 | changes |= BIT_PG_TX; |
91 | [i-DCB_PG_ATTR_BW_ID_0] = src_dcb_cfg->bw_percentage | 114 | } |
92 | [DCB_RX_CONFIG][i-DCB_PG_ATTR_BW_ID_0]; | 115 | if (dcfg->bw_percentage[rx][j] != scfg->bw_percentage[rx][j]) { |
116 | dcfg->bw_percentage[rx][j] = scfg->bw_percentage[rx][j]; | ||
117 | changes |= BIT_PG_RX; | ||
118 | } | ||
93 | } | 119 | } |
94 | 120 | ||
95 | for (i = DCB_PFC_UP_ATTR_0; i < DCB_PFC_UP_ATTR_MAX; i++) { | 121 | for (i = DCB_PFC_UP_ATTR_0; i < DCB_PFC_UP_ATTR_MAX; i++) { |
96 | dst_dcb_cfg->tc_config[i - DCB_PFC_UP_ATTR_0].dcb_pfc = | 122 | j = i - DCB_PFC_UP_ATTR_0; |
97 | src_dcb_cfg->tc_config[i - DCB_PFC_UP_ATTR_0].dcb_pfc; | 123 | if (dcfg->tc_config[j].dcb_pfc != scfg->tc_config[j].dcb_pfc) { |
124 | dcfg->tc_config[j].dcb_pfc = scfg->tc_config[j].dcb_pfc; | ||
125 | changes |= BIT_PFC; | ||
126 | } | ||
98 | } | 127 | } |
99 | 128 | ||
100 | dst_dcb_cfg->pfc_mode_enable = src_dcb_cfg->pfc_mode_enable; | 129 | if (dcfg->pfc_mode_enable != scfg->pfc_mode_enable) { |
130 | dcfg->pfc_mode_enable = scfg->pfc_mode_enable; | ||
131 | changes |= BIT_PFC; | ||
132 | } | ||
101 | 133 | ||
102 | return 0; | 134 | return changes; |
103 | } | 135 | } |
104 | 136 | ||
105 | static u8 ixgbe_dcbnl_get_state(struct net_device *netdev) | 137 | static u8 ixgbe_dcbnl_get_state(struct net_device *netdev) |
@@ -179,20 +211,6 @@ static void ixgbe_dcbnl_set_pg_tc_cfg_tx(struct net_device *netdev, int tc, | |||
179 | if (up_map != DCB_ATTR_VALUE_UNDEFINED) | 211 | if (up_map != DCB_ATTR_VALUE_UNDEFINED) |
180 | adapter->temp_dcb_cfg.tc_config[tc].path[0].up_to_tc_bitmap = | 212 | adapter->temp_dcb_cfg.tc_config[tc].path[0].up_to_tc_bitmap = |
181 | up_map; | 213 | up_map; |
182 | |||
183 | if ((adapter->temp_dcb_cfg.tc_config[tc].path[0].prio_type != | ||
184 | adapter->dcb_cfg.tc_config[tc].path[0].prio_type) || | ||
185 | (adapter->temp_dcb_cfg.tc_config[tc].path[0].bwg_id != | ||
186 | adapter->dcb_cfg.tc_config[tc].path[0].bwg_id) || | ||
187 | (adapter->temp_dcb_cfg.tc_config[tc].path[0].bwg_percent != | ||
188 | adapter->dcb_cfg.tc_config[tc].path[0].bwg_percent) || | ||
189 | (adapter->temp_dcb_cfg.tc_config[tc].path[0].up_to_tc_bitmap != | ||
190 | adapter->dcb_cfg.tc_config[tc].path[0].up_to_tc_bitmap)) | ||
191 | adapter->dcb_set_bitmap |= BIT_PG_TX; | ||
192 | |||
193 | if (adapter->temp_dcb_cfg.tc_config[tc].path[0].up_to_tc_bitmap != | ||
194 | adapter->dcb_cfg.tc_config[tc].path[0].up_to_tc_bitmap) | ||
195 | adapter->dcb_set_bitmap |= BIT_PFC | BIT_APP_UPCHG; | ||
196 | } | 214 | } |
197 | 215 | ||
198 | static void ixgbe_dcbnl_set_pg_bwg_cfg_tx(struct net_device *netdev, int bwg_id, | 216 | static void ixgbe_dcbnl_set_pg_bwg_cfg_tx(struct net_device *netdev, int bwg_id, |
@@ -201,10 +219,6 @@ static void ixgbe_dcbnl_set_pg_bwg_cfg_tx(struct net_device *netdev, int bwg_id, | |||
201 | struct ixgbe_adapter *adapter = netdev_priv(netdev); | 219 | struct ixgbe_adapter *adapter = netdev_priv(netdev); |
202 | 220 | ||
203 | adapter->temp_dcb_cfg.bw_percentage[0][bwg_id] = bw_pct; | 221 | adapter->temp_dcb_cfg.bw_percentage[0][bwg_id] = bw_pct; |
204 | |||
205 | if (adapter->temp_dcb_cfg.bw_percentage[0][bwg_id] != | ||
206 | adapter->dcb_cfg.bw_percentage[0][bwg_id]) | ||
207 | adapter->dcb_set_bitmap |= BIT_PG_TX; | ||
208 | } | 222 | } |
209 | 223 | ||
210 | static void ixgbe_dcbnl_set_pg_tc_cfg_rx(struct net_device *netdev, int tc, | 224 | static void ixgbe_dcbnl_set_pg_tc_cfg_rx(struct net_device *netdev, int tc, |
@@ -223,20 +237,6 @@ static void ixgbe_dcbnl_set_pg_tc_cfg_rx(struct net_device *netdev, int tc, | |||
223 | if (up_map != DCB_ATTR_VALUE_UNDEFINED) | 237 | if (up_map != DCB_ATTR_VALUE_UNDEFINED) |
224 | adapter->temp_dcb_cfg.tc_config[tc].path[1].up_to_tc_bitmap = | 238 | adapter->temp_dcb_cfg.tc_config[tc].path[1].up_to_tc_bitmap = |
225 | up_map; | 239 | up_map; |
226 | |||
227 | if ((adapter->temp_dcb_cfg.tc_config[tc].path[1].prio_type != | ||
228 | adapter->dcb_cfg.tc_config[tc].path[1].prio_type) || | ||
229 | (adapter->temp_dcb_cfg.tc_config[tc].path[1].bwg_id != | ||
230 | adapter->dcb_cfg.tc_config[tc].path[1].bwg_id) || | ||
231 | (adapter->temp_dcb_cfg.tc_config[tc].path[1].bwg_percent != | ||
232 | adapter->dcb_cfg.tc_config[tc].path[1].bwg_percent) || | ||
233 | (adapter->temp_dcb_cfg.tc_config[tc].path[1].up_to_tc_bitmap != | ||
234 | adapter->dcb_cfg.tc_config[tc].path[1].up_to_tc_bitmap)) | ||
235 | adapter->dcb_set_bitmap |= BIT_PG_RX; | ||
236 | |||
237 | if (adapter->temp_dcb_cfg.tc_config[tc].path[1].up_to_tc_bitmap != | ||
238 | adapter->dcb_cfg.tc_config[tc].path[1].up_to_tc_bitmap) | ||
239 | adapter->dcb_set_bitmap |= BIT_PFC; | ||
240 | } | 240 | } |
241 | 241 | ||
242 | static void ixgbe_dcbnl_set_pg_bwg_cfg_rx(struct net_device *netdev, int bwg_id, | 242 | static void ixgbe_dcbnl_set_pg_bwg_cfg_rx(struct net_device *netdev, int bwg_id, |
@@ -245,10 +245,6 @@ static void ixgbe_dcbnl_set_pg_bwg_cfg_rx(struct net_device *netdev, int bwg_id, | |||
245 | struct ixgbe_adapter *adapter = netdev_priv(netdev); | 245 | struct ixgbe_adapter *adapter = netdev_priv(netdev); |
246 | 246 | ||
247 | adapter->temp_dcb_cfg.bw_percentage[1][bwg_id] = bw_pct; | 247 | adapter->temp_dcb_cfg.bw_percentage[1][bwg_id] = bw_pct; |
248 | |||
249 | if (adapter->temp_dcb_cfg.bw_percentage[1][bwg_id] != | ||
250 | adapter->dcb_cfg.bw_percentage[1][bwg_id]) | ||
251 | adapter->dcb_set_bitmap |= BIT_PG_RX; | ||
252 | } | 248 | } |
253 | 249 | ||
254 | static void ixgbe_dcbnl_get_pg_tc_cfg_tx(struct net_device *netdev, int tc, | 250 | static void ixgbe_dcbnl_get_pg_tc_cfg_tx(struct net_device *netdev, int tc, |
@@ -298,10 +294,8 @@ static void ixgbe_dcbnl_set_pfc_cfg(struct net_device *netdev, int priority, | |||
298 | 294 | ||
299 | adapter->temp_dcb_cfg.tc_config[priority].dcb_pfc = setting; | 295 | adapter->temp_dcb_cfg.tc_config[priority].dcb_pfc = setting; |
300 | if (adapter->temp_dcb_cfg.tc_config[priority].dcb_pfc != | 296 | if (adapter->temp_dcb_cfg.tc_config[priority].dcb_pfc != |
301 | adapter->dcb_cfg.tc_config[priority].dcb_pfc) { | 297 | adapter->dcb_cfg.tc_config[priority].dcb_pfc) |
302 | adapter->dcb_set_bitmap |= BIT_PFC; | ||
303 | adapter->temp_dcb_cfg.pfc_mode_enable = true; | 298 | adapter->temp_dcb_cfg.pfc_mode_enable = true; |
304 | } | ||
305 | } | 299 | } |
306 | 300 | ||
307 | static void ixgbe_dcbnl_get_pfc_cfg(struct net_device *netdev, int priority, | 301 | static void ixgbe_dcbnl_get_pfc_cfg(struct net_device *netdev, int priority, |
@@ -336,7 +330,8 @@ static void ixgbe_dcbnl_devreset(struct net_device *dev) | |||
336 | static u8 ixgbe_dcbnl_set_all(struct net_device *netdev) | 330 | static u8 ixgbe_dcbnl_set_all(struct net_device *netdev) |
337 | { | 331 | { |
338 | struct ixgbe_adapter *adapter = netdev_priv(netdev); | 332 | struct ixgbe_adapter *adapter = netdev_priv(netdev); |
339 | int ret, i; | 333 | int ret = DCB_NO_HW_CHG; |
334 | int i; | ||
340 | #ifdef IXGBE_FCOE | 335 | #ifdef IXGBE_FCOE |
341 | struct dcb_app app = { | 336 | struct dcb_app app = { |
342 | .selector = DCB_APP_IDTYPE_ETHTYPE, | 337 | .selector = DCB_APP_IDTYPE_ETHTYPE, |
@@ -355,12 +350,13 @@ static u8 ixgbe_dcbnl_set_all(struct net_device *netdev) | |||
355 | 350 | ||
356 | /* Fail command if not in CEE mode */ | 351 | /* Fail command if not in CEE mode */ |
357 | if (!(adapter->dcbx_cap & DCB_CAP_DCBX_VER_CEE)) | 352 | if (!(adapter->dcbx_cap & DCB_CAP_DCBX_VER_CEE)) |
358 | return 1; | 353 | return ret; |
359 | 354 | ||
360 | ret = ixgbe_copy_dcb_cfg(&adapter->temp_dcb_cfg, &adapter->dcb_cfg, | 355 | adapter->dcb_set_bitmap |= ixgbe_copy_dcb_cfg(&adapter->temp_dcb_cfg, |
361 | MAX_TRAFFIC_CLASS); | 356 | &adapter->dcb_cfg, |
362 | if (ret) | 357 | MAX_TRAFFIC_CLASS); |
363 | return DCB_NO_HW_CHG; | 358 | if (!adapter->dcb_set_bitmap) |
359 | return ret; | ||
364 | 360 | ||
365 | if (adapter->dcb_cfg.pfc_mode_enable) { | 361 | if (adapter->dcb_cfg.pfc_mode_enable) { |
366 | switch (adapter->hw.mac.type) { | 362 | switch (adapter->hw.mac.type) { |
@@ -420,6 +416,8 @@ static u8 ixgbe_dcbnl_set_all(struct net_device *netdev) | |||
420 | 416 | ||
421 | for (i = 0; i < IEEE_8021QAZ_MAX_TCS; i++) | 417 | for (i = 0; i < IEEE_8021QAZ_MAX_TCS; i++) |
422 | netdev_set_prio_tc_map(netdev, i, prio_tc[i]); | 418 | netdev_set_prio_tc_map(netdev, i, prio_tc[i]); |
419 | |||
420 | ret = DCB_HW_CHG_RST; | ||
423 | } | 421 | } |
424 | 422 | ||
425 | if (adapter->dcb_set_bitmap & BIT_PFC) { | 423 | if (adapter->dcb_set_bitmap & BIT_PFC) { |
@@ -430,7 +428,8 @@ static u8 ixgbe_dcbnl_set_all(struct net_device *netdev) | |||
430 | DCB_TX_CONFIG, prio_tc); | 428 | DCB_TX_CONFIG, prio_tc); |
431 | ixgbe_dcb_unpack_pfc(&adapter->dcb_cfg, &pfc_en); | 429 | ixgbe_dcb_unpack_pfc(&adapter->dcb_cfg, &pfc_en); |
432 | ixgbe_dcb_hw_pfc_config(&adapter->hw, pfc_en, prio_tc); | 430 | ixgbe_dcb_hw_pfc_config(&adapter->hw, pfc_en, prio_tc); |
433 | ret = DCB_HW_CHG; | 431 | if (ret != DCB_HW_CHG_RST) |
432 | ret = DCB_HW_CHG; | ||
434 | } | 433 | } |
435 | 434 | ||
436 | if (adapter->dcb_cfg.pfc_mode_enable) | 435 | if (adapter->dcb_cfg.pfc_mode_enable) |
@@ -531,9 +530,6 @@ static void ixgbe_dcbnl_setpfcstate(struct net_device *netdev, u8 state) | |||
531 | struct ixgbe_adapter *adapter = netdev_priv(netdev); | 530 | struct ixgbe_adapter *adapter = netdev_priv(netdev); |
532 | 531 | ||
533 | adapter->temp_dcb_cfg.pfc_mode_enable = state; | 532 | adapter->temp_dcb_cfg.pfc_mode_enable = state; |
534 | if (adapter->temp_dcb_cfg.pfc_mode_enable != | ||
535 | adapter->dcb_cfg.pfc_mode_enable) | ||
536 | adapter->dcb_set_bitmap |= BIT_PFC; | ||
537 | } | 533 | } |
538 | 534 | ||
539 | /** | 535 | /** |
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c index 398fc223cab9..3e26b1f9ac75 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | |||
@@ -63,8 +63,8 @@ static char ixgbe_default_device_descr[] = | |||
63 | "Intel(R) 10 Gigabit Network Connection"; | 63 | "Intel(R) 10 Gigabit Network Connection"; |
64 | #endif | 64 | #endif |
65 | #define MAJ 3 | 65 | #define MAJ 3 |
66 | #define MIN 6 | 66 | #define MIN 8 |
67 | #define BUILD 7 | 67 | #define BUILD 21 |
68 | #define DRV_VERSION __stringify(MAJ) "." __stringify(MIN) "." \ | 68 | #define DRV_VERSION __stringify(MAJ) "." __stringify(MIN) "." \ |
69 | __stringify(BUILD) "-k" | 69 | __stringify(BUILD) "-k" |
70 | const char ixgbe_driver_version[] = DRV_VERSION; | 70 | const char ixgbe_driver_version[] = DRV_VERSION; |
@@ -141,13 +141,16 @@ module_param(allow_unsupported_sfp, uint, 0); | |||
141 | MODULE_PARM_DESC(allow_unsupported_sfp, | 141 | MODULE_PARM_DESC(allow_unsupported_sfp, |
142 | "Allow unsupported and untested SFP+ modules on 82599-based adapters"); | 142 | "Allow unsupported and untested SFP+ modules on 82599-based adapters"); |
143 | 143 | ||
144 | #define DEFAULT_MSG_ENABLE (NETIF_MSG_DRV|NETIF_MSG_PROBE|NETIF_MSG_LINK) | ||
145 | static int debug = -1; | ||
146 | module_param(debug, int, 0); | ||
147 | MODULE_PARM_DESC(debug, "Debug level (0=none,...,16=all)"); | ||
148 | |||
144 | MODULE_AUTHOR("Intel Corporation, <linux.nics@intel.com>"); | 149 | MODULE_AUTHOR("Intel Corporation, <linux.nics@intel.com>"); |
145 | MODULE_DESCRIPTION("Intel(R) 10 Gigabit PCI Express Network Driver"); | 150 | MODULE_DESCRIPTION("Intel(R) 10 Gigabit PCI Express Network Driver"); |
146 | MODULE_LICENSE("GPL"); | 151 | MODULE_LICENSE("GPL"); |
147 | MODULE_VERSION(DRV_VERSION); | 152 | MODULE_VERSION(DRV_VERSION); |
148 | 153 | ||
149 | #define DEFAULT_DEBUG_LEVEL_SHIFT 3 | ||
150 | |||
151 | static void ixgbe_service_event_schedule(struct ixgbe_adapter *adapter) | 154 | static void ixgbe_service_event_schedule(struct ixgbe_adapter *adapter) |
152 | { | 155 | { |
153 | if (!test_bit(__IXGBE_DOWN, &adapter->state) && | 156 | if (!test_bit(__IXGBE_DOWN, &adapter->state) && |
@@ -6834,7 +6837,7 @@ static int __devinit ixgbe_probe(struct pci_dev *pdev, | |||
6834 | adapter->pdev = pdev; | 6837 | adapter->pdev = pdev; |
6835 | hw = &adapter->hw; | 6838 | hw = &adapter->hw; |
6836 | hw->back = adapter; | 6839 | hw->back = adapter; |
6837 | adapter->msg_enable = (1 << DEFAULT_DEBUG_LEVEL_SHIFT) - 1; | 6840 | adapter->msg_enable = netif_msg_init(debug, DEFAULT_MSG_ENABLE); |
6838 | 6841 | ||
6839 | hw->hw_addr = ioremap(pci_resource_start(pdev, 0), | 6842 | hw->hw_addr = ioremap(pci_resource_start(pdev, 0), |
6840 | pci_resource_len(pdev, 0)); | 6843 | pci_resource_len(pdev, 0)); |
diff --git a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c index 581c65976bb4..307611ae831d 100644 --- a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c +++ b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c | |||
@@ -91,7 +91,10 @@ MODULE_DESCRIPTION("Intel(R) 82599 Virtual Function Driver"); | |||
91 | MODULE_LICENSE("GPL"); | 91 | MODULE_LICENSE("GPL"); |
92 | MODULE_VERSION(DRV_VERSION); | 92 | MODULE_VERSION(DRV_VERSION); |
93 | 93 | ||
94 | #define DEFAULT_DEBUG_LEVEL_SHIFT 3 | 94 | #define DEFAULT_MSG_ENABLE (NETIF_MSG_DRV|NETIF_MSG_PROBE|NETIF_MSG_LINK) |
95 | static int debug = -1; | ||
96 | module_param(debug, int, 0); | ||
97 | MODULE_PARM_DESC(debug, "Debug level (0=none,...,16=all)"); | ||
95 | 98 | ||
96 | /* forward decls */ | 99 | /* forward decls */ |
97 | static void ixgbevf_set_itr_msix(struct ixgbevf_q_vector *q_vector); | 100 | static void ixgbevf_set_itr_msix(struct ixgbevf_q_vector *q_vector); |
@@ -3367,7 +3370,7 @@ static int __devinit ixgbevf_probe(struct pci_dev *pdev, | |||
3367 | adapter->pdev = pdev; | 3370 | adapter->pdev = pdev; |
3368 | hw = &adapter->hw; | 3371 | hw = &adapter->hw; |
3369 | hw->back = adapter; | 3372 | hw->back = adapter; |
3370 | adapter->msg_enable = (1 << DEFAULT_DEBUG_LEVEL_SHIFT) - 1; | 3373 | adapter->msg_enable = netif_msg_init(debug, DEFAULT_MSG_ENABLE); |
3371 | 3374 | ||
3372 | /* | 3375 | /* |
3373 | * call save state here in standalone driver because it relies on | 3376 | * call save state here in standalone driver because it relies on |
diff --git a/drivers/net/ethernet/marvell/sky2.c b/drivers/net/ethernet/marvell/sky2.c index 423a1a2a702e..c9b504e2dfc3 100644 --- a/drivers/net/ethernet/marvell/sky2.c +++ b/drivers/net/ethernet/marvell/sky2.c | |||
@@ -1767,13 +1767,14 @@ static int sky2_open(struct net_device *dev) | |||
1767 | 1767 | ||
1768 | sky2_hw_up(sky2); | 1768 | sky2_hw_up(sky2); |
1769 | 1769 | ||
1770 | /* Enable interrupts from phy/mac for port */ | ||
1771 | imask = sky2_read32(hw, B0_IMSK); | ||
1772 | |||
1770 | if (hw->chip_id == CHIP_ID_YUKON_OPT || | 1773 | if (hw->chip_id == CHIP_ID_YUKON_OPT || |
1771 | hw->chip_id == CHIP_ID_YUKON_PRM || | 1774 | hw->chip_id == CHIP_ID_YUKON_PRM || |
1772 | hw->chip_id == CHIP_ID_YUKON_OP_2) | 1775 | hw->chip_id == CHIP_ID_YUKON_OP_2) |
1773 | imask |= Y2_IS_PHY_QLNK; /* enable PHY Quick Link */ | 1776 | imask |= Y2_IS_PHY_QLNK; /* enable PHY Quick Link */ |
1774 | 1777 | ||
1775 | /* Enable interrupts from phy/mac for port */ | ||
1776 | imask = sky2_read32(hw, B0_IMSK); | ||
1777 | imask |= portirq_msk[port]; | 1778 | imask |= portirq_msk[port]; |
1778 | sky2_write32(hw, B0_IMSK, imask); | 1779 | sky2_write32(hw, B0_IMSK, imask); |
1779 | sky2_read32(hw, B0_IMSK); | 1780 | sky2_read32(hw, B0_IMSK); |
@@ -2468,6 +2469,17 @@ static int sky2_change_mtu(struct net_device *dev, int new_mtu) | |||
2468 | return err; | 2469 | return err; |
2469 | } | 2470 | } |
2470 | 2471 | ||
2472 | static inline bool needs_copy(const struct rx_ring_info *re, | ||
2473 | unsigned length) | ||
2474 | { | ||
2475 | #ifndef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS | ||
2476 | /* Some architectures need the IP header to be aligned */ | ||
2477 | if (!IS_ALIGNED(re->data_addr + ETH_HLEN, sizeof(u32))) | ||
2478 | return true; | ||
2479 | #endif | ||
2480 | return length < copybreak; | ||
2481 | } | ||
2482 | |||
2471 | /* For small just reuse existing skb for next receive */ | 2483 | /* For small just reuse existing skb for next receive */ |
2472 | static struct sk_buff *receive_copy(struct sky2_port *sky2, | 2484 | static struct sk_buff *receive_copy(struct sky2_port *sky2, |
2473 | const struct rx_ring_info *re, | 2485 | const struct rx_ring_info *re, |
@@ -2598,7 +2610,7 @@ static struct sk_buff *sky2_receive(struct net_device *dev, | |||
2598 | goto error; | 2610 | goto error; |
2599 | 2611 | ||
2600 | okay: | 2612 | okay: |
2601 | if (length < copybreak) | 2613 | if (needs_copy(re, length)) |
2602 | skb = receive_copy(sky2, re, length); | 2614 | skb = receive_copy(sky2, re, length); |
2603 | else | 2615 | else |
2604 | skb = receive_new(sky2, re, length); | 2616 | skb = receive_new(sky2, re, length); |
diff --git a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h index 9e2b911a1230..d69fee41f24a 100644 --- a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h +++ b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h | |||
@@ -83,8 +83,9 @@ | |||
83 | 83 | ||
84 | #define MLX4_EN_WATCHDOG_TIMEOUT (15 * HZ) | 84 | #define MLX4_EN_WATCHDOG_TIMEOUT (15 * HZ) |
85 | 85 | ||
86 | #define MLX4_EN_ALLOC_ORDER 2 | 86 | /* Use the maximum between 16384 and a single page */ |
87 | #define MLX4_EN_ALLOC_SIZE (PAGE_SIZE << MLX4_EN_ALLOC_ORDER) | 87 | #define MLX4_EN_ALLOC_SIZE PAGE_ALIGN(16384) |
88 | #define MLX4_EN_ALLOC_ORDER get_order(MLX4_EN_ALLOC_SIZE) | ||
88 | 89 | ||
89 | #define MLX4_EN_MAX_LRO_DESCRIPTORS 32 | 90 | #define MLX4_EN_MAX_LRO_DESCRIPTORS 32 |
90 | 91 | ||
diff --git a/drivers/net/ethernet/nxp/lpc_eth.c b/drivers/net/ethernet/nxp/lpc_eth.c index 69444247c20b..6dfc26d85e47 100644 --- a/drivers/net/ethernet/nxp/lpc_eth.c +++ b/drivers/net/ethernet/nxp/lpc_eth.c | |||
@@ -1441,7 +1441,7 @@ static int lpc_eth_drv_probe(struct platform_device *pdev) | |||
1441 | } | 1441 | } |
1442 | #endif | 1442 | #endif |
1443 | if (!is_valid_ether_addr(ndev->dev_addr)) | 1443 | if (!is_valid_ether_addr(ndev->dev_addr)) |
1444 | dev_hw_addr_random(ndev, ndev->dev_addr); | 1444 | eth_hw_addr_random(ndev); |
1445 | 1445 | ||
1446 | /* Reset the ethernet controller */ | 1446 | /* Reset the ethernet controller */ |
1447 | __lpc_eth_reset(pldat); | 1447 | __lpc_eth_reset(pldat); |
diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c index 7b23554f80b6..f54509377efa 100644 --- a/drivers/net/ethernet/realtek/r8169.c +++ b/drivers/net/ethernet/realtek/r8169.c | |||
@@ -5810,7 +5810,10 @@ static void __rtl8169_resume(struct net_device *dev) | |||
5810 | 5810 | ||
5811 | rtl_pll_power_up(tp); | 5811 | rtl_pll_power_up(tp); |
5812 | 5812 | ||
5813 | rtl_lock_work(tp); | ||
5814 | napi_enable(&tp->napi); | ||
5813 | set_bit(RTL_FLAG_TASK_ENABLED, tp->wk.flags); | 5815 | set_bit(RTL_FLAG_TASK_ENABLED, tp->wk.flags); |
5816 | rtl_unlock_work(tp); | ||
5814 | 5817 | ||
5815 | rtl_schedule_task(tp, RTL_FLAG_TASK_RESET_PENDING); | 5818 | rtl_schedule_task(tp, RTL_FLAG_TASK_RESET_PENDING); |
5816 | } | 5819 | } |
diff --git a/drivers/net/ethernet/renesas/Kconfig b/drivers/net/ethernet/renesas/Kconfig index 9755b49bbefb..3fb2355af37e 100644 --- a/drivers/net/ethernet/renesas/Kconfig +++ b/drivers/net/ethernet/renesas/Kconfig | |||
@@ -7,7 +7,8 @@ config SH_ETH | |||
7 | depends on SUPERH && \ | 7 | depends on SUPERH && \ |
8 | (CPU_SUBTYPE_SH7710 || CPU_SUBTYPE_SH7712 || \ | 8 | (CPU_SUBTYPE_SH7710 || CPU_SUBTYPE_SH7712 || \ |
9 | CPU_SUBTYPE_SH7763 || CPU_SUBTYPE_SH7619 || \ | 9 | CPU_SUBTYPE_SH7763 || CPU_SUBTYPE_SH7619 || \ |
10 | CPU_SUBTYPE_SH7724 || CPU_SUBTYPE_SH7757) | 10 | CPU_SUBTYPE_SH7724 || CPU_SUBTYPE_SH7734 || \ |
11 | CPU_SUBTYPE_SH7757) | ||
11 | select CRC32 | 12 | select CRC32 |
12 | select NET_CORE | 13 | select NET_CORE |
13 | select MII | 14 | select MII |
@@ -16,4 +17,4 @@ config SH_ETH | |||
16 | ---help--- | 17 | ---help--- |
17 | Renesas SuperH Ethernet device driver. | 18 | Renesas SuperH Ethernet device driver. |
18 | This driver supporting CPUs are: | 19 | This driver supporting CPUs are: |
19 | - SH7710, SH7712, SH7763, SH7619, SH7724, and SH7757. | 20 | - SH7619, SH7710, SH7712, SH7724, SH7734, SH7763 and SH7757. |
diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c index 8615961c1287..d63e09b29a96 100644 --- a/drivers/net/ethernet/renesas/sh_eth.c +++ b/drivers/net/ethernet/renesas/sh_eth.c | |||
@@ -1,8 +1,8 @@ | |||
1 | /* | 1 | /* |
2 | * SuperH Ethernet device driver | 2 | * SuperH Ethernet device driver |
3 | * | 3 | * |
4 | * Copyright (C) 2006-2008 Nobuhiro Iwamatsu | 4 | * Copyright (C) 2006-2012 Nobuhiro Iwamatsu |
5 | * Copyright (C) 2008-2009 Renesas Solutions Corp. | 5 | * Copyright (C) 2008-2012 Renesas Solutions Corp. |
6 | * | 6 | * |
7 | * This program is free software; you can redistribute it and/or modify it | 7 | * This program is free software; you can redistribute it and/or modify it |
8 | * under the terms and conditions of the GNU General Public License, | 8 | * under the terms and conditions of the GNU General Public License, |
@@ -38,6 +38,7 @@ | |||
38 | #include <linux/slab.h> | 38 | #include <linux/slab.h> |
39 | #include <linux/ethtool.h> | 39 | #include <linux/ethtool.h> |
40 | #include <linux/if_vlan.h> | 40 | #include <linux/if_vlan.h> |
41 | #include <linux/clk.h> | ||
41 | #include <linux/sh_eth.h> | 42 | #include <linux/sh_eth.h> |
42 | 43 | ||
43 | #include "sh_eth.h" | 44 | #include "sh_eth.h" |
@@ -279,8 +280,9 @@ static struct sh_eth_cpu_data *sh_eth_get_cpu_data(struct sh_eth_private *mdp) | |||
279 | return &sh_eth_my_cpu_data; | 280 | return &sh_eth_my_cpu_data; |
280 | } | 281 | } |
281 | 282 | ||
282 | #elif defined(CONFIG_CPU_SUBTYPE_SH7763) | 283 | #elif defined(CONFIG_CPU_SUBTYPE_SH7734) || defined(CONFIG_CPU_SUBTYPE_SH7763) |
283 | #define SH_ETH_HAS_TSU 1 | 284 | #define SH_ETH_HAS_TSU 1 |
285 | static void sh_eth_reset_hw_crc(struct net_device *ndev); | ||
284 | static void sh_eth_chip_reset(struct net_device *ndev) | 286 | static void sh_eth_chip_reset(struct net_device *ndev) |
285 | { | 287 | { |
286 | struct sh_eth_private *mdp = netdev_priv(ndev); | 288 | struct sh_eth_private *mdp = netdev_priv(ndev); |
@@ -314,6 +316,9 @@ static void sh_eth_reset(struct net_device *ndev) | |||
314 | sh_eth_write(ndev, 0x0, RDFAR); | 316 | sh_eth_write(ndev, 0x0, RDFAR); |
315 | sh_eth_write(ndev, 0x0, RDFXR); | 317 | sh_eth_write(ndev, 0x0, RDFXR); |
316 | sh_eth_write(ndev, 0x0, RDFFR); | 318 | sh_eth_write(ndev, 0x0, RDFFR); |
319 | |||
320 | /* Reset HW CRC register */ | ||
321 | sh_eth_reset_hw_crc(ndev); | ||
317 | } | 322 | } |
318 | 323 | ||
319 | static void sh_eth_set_duplex(struct net_device *ndev) | 324 | static void sh_eth_set_duplex(struct net_device *ndev) |
@@ -370,8 +375,17 @@ static struct sh_eth_cpu_data sh_eth_my_cpu_data = { | |||
370 | .no_trimd = 1, | 375 | .no_trimd = 1, |
371 | .no_ade = 1, | 376 | .no_ade = 1, |
372 | .tsu = 1, | 377 | .tsu = 1, |
378 | #if defined(CONFIG_CPU_SUBTYPE_SH7734) | ||
379 | .hw_crc = 1, | ||
380 | #endif | ||
373 | }; | 381 | }; |
374 | 382 | ||
383 | static void sh_eth_reset_hw_crc(struct net_device *ndev) | ||
384 | { | ||
385 | if (sh_eth_my_cpu_data.hw_crc) | ||
386 | sh_eth_write(ndev, 0x0, CSMR); | ||
387 | } | ||
388 | |||
375 | #elif defined(CONFIG_CPU_SUBTYPE_SH7619) | 389 | #elif defined(CONFIG_CPU_SUBTYPE_SH7619) |
376 | #define SH_ETH_RESET_DEFAULT 1 | 390 | #define SH_ETH_RESET_DEFAULT 1 |
377 | static struct sh_eth_cpu_data sh_eth_my_cpu_data = { | 391 | static struct sh_eth_cpu_data sh_eth_my_cpu_data = { |
@@ -790,7 +804,7 @@ static int sh_eth_dev_init(struct net_device *ndev) | |||
790 | /* all sh_eth int mask */ | 804 | /* all sh_eth int mask */ |
791 | sh_eth_write(ndev, 0, EESIPR); | 805 | sh_eth_write(ndev, 0, EESIPR); |
792 | 806 | ||
793 | #if defined(__LITTLE_ENDIAN__) | 807 | #if defined(__LITTLE_ENDIAN) |
794 | if (mdp->cd->hw_swap) | 808 | if (mdp->cd->hw_swap) |
795 | sh_eth_write(ndev, EDMR_EL, EDMR); | 809 | sh_eth_write(ndev, EDMR_EL, EDMR); |
796 | else | 810 | else |
diff --git a/drivers/net/ethernet/renesas/sh_eth.h b/drivers/net/ethernet/renesas/sh_eth.h index 57dc26261116..0fa14afce23d 100644 --- a/drivers/net/ethernet/renesas/sh_eth.h +++ b/drivers/net/ethernet/renesas/sh_eth.h | |||
@@ -1,8 +1,8 @@ | |||
1 | /* | 1 | /* |
2 | * SuperH Ethernet device driver | 2 | * SuperH Ethernet device driver |
3 | * | 3 | * |
4 | * Copyright (C) 2006-2008 Nobuhiro Iwamatsu | 4 | * Copyright (C) 2006-2012 Nobuhiro Iwamatsu |
5 | * Copyright (C) 2008-2011 Renesas Solutions Corp. | 5 | * Copyright (C) 2008-2012 Renesas Solutions Corp. |
6 | * | 6 | * |
7 | * This program is free software; you can redistribute it and/or modify it | 7 | * This program is free software; you can redistribute it and/or modify it |
8 | * under the terms and conditions of the GNU General Public License, | 8 | * under the terms and conditions of the GNU General Public License, |
@@ -98,6 +98,8 @@ enum { | |||
98 | CEECR, | 98 | CEECR, |
99 | MAFCR, | 99 | MAFCR, |
100 | RTRATE, | 100 | RTRATE, |
101 | CSMR, | ||
102 | RMII_MII, | ||
101 | 103 | ||
102 | /* TSU Absolute address */ | 104 | /* TSU Absolute address */ |
103 | ARSTR, | 105 | ARSTR, |
@@ -172,6 +174,7 @@ static const u16 sh_eth_offset_gigabit[SH_ETH_MAX_REGISTER_OFFSET] = { | |||
172 | [RMCR] = 0x0458, | 174 | [RMCR] = 0x0458, |
173 | [RPADIR] = 0x0460, | 175 | [RPADIR] = 0x0460, |
174 | [FCFTR] = 0x0468, | 176 | [FCFTR] = 0x0468, |
177 | [CSMR] = 0x04E4, | ||
175 | 178 | ||
176 | [ECMR] = 0x0500, | 179 | [ECMR] = 0x0500, |
177 | [ECSR] = 0x0510, | 180 | [ECSR] = 0x0510, |
@@ -200,6 +203,7 @@ static const u16 sh_eth_offset_gigabit[SH_ETH_MAX_REGISTER_OFFSET] = { | |||
200 | [CERCR] = 0x0768, | 203 | [CERCR] = 0x0768, |
201 | [CEECR] = 0x0770, | 204 | [CEECR] = 0x0770, |
202 | [MAFCR] = 0x0778, | 205 | [MAFCR] = 0x0778, |
206 | [RMII_MII] = 0x0790, | ||
203 | 207 | ||
204 | [ARSTR] = 0x0000, | 208 | [ARSTR] = 0x0000, |
205 | [TSU_CTRST] = 0x0004, | 209 | [TSU_CTRST] = 0x0004, |
@@ -377,7 +381,7 @@ static const u16 sh_eth_offset_fast_sh3_sh2[SH_ETH_MAX_REGISTER_OFFSET] = { | |||
377 | /* | 381 | /* |
378 | * Register's bits | 382 | * Register's bits |
379 | */ | 383 | */ |
380 | #ifdef CONFIG_CPU_SUBTYPE_SH7763 | 384 | #if defined(CONFIG_CPU_SUBTYPE_SH7734) || defined(CONFIG_CPU_SUBTYPE_SH7763) |
381 | /* EDSR */ | 385 | /* EDSR */ |
382 | enum EDSR_BIT { | 386 | enum EDSR_BIT { |
383 | EDSR_ENT = 0x01, EDSR_ENR = 0x02, | 387 | EDSR_ENT = 0x01, EDSR_ENR = 0x02, |
@@ -689,7 +693,7 @@ enum TSU_FWSLC_BIT { | |||
689 | */ | 693 | */ |
690 | struct sh_eth_txdesc { | 694 | struct sh_eth_txdesc { |
691 | u32 status; /* TD0 */ | 695 | u32 status; /* TD0 */ |
692 | #if defined(CONFIG_CPU_LITTLE_ENDIAN) | 696 | #if defined(__LITTLE_ENDIAN) |
693 | u16 pad0; /* TD1 */ | 697 | u16 pad0; /* TD1 */ |
694 | u16 buffer_length; /* TD1 */ | 698 | u16 buffer_length; /* TD1 */ |
695 | #else | 699 | #else |
@@ -706,7 +710,7 @@ struct sh_eth_txdesc { | |||
706 | */ | 710 | */ |
707 | struct sh_eth_rxdesc { | 711 | struct sh_eth_rxdesc { |
708 | u32 status; /* RD0 */ | 712 | u32 status; /* RD0 */ |
709 | #if defined(CONFIG_CPU_LITTLE_ENDIAN) | 713 | #if defined(__LITTLE_ENDIAN) |
710 | u16 frame_length; /* RD1 */ | 714 | u16 frame_length; /* RD1 */ |
711 | u16 buffer_length; /* RD1 */ | 715 | u16 buffer_length; /* RD1 */ |
712 | #else | 716 | #else |
@@ -751,6 +755,7 @@ struct sh_eth_cpu_data { | |||
751 | unsigned rpadir:1; /* E-DMAC have RPADIR */ | 755 | unsigned rpadir:1; /* E-DMAC have RPADIR */ |
752 | unsigned no_trimd:1; /* E-DMAC DO NOT have TRIMD */ | 756 | unsigned no_trimd:1; /* E-DMAC DO NOT have TRIMD */ |
753 | unsigned no_ade:1; /* E-DMAC DO NOT have ADE bit in EESR */ | 757 | unsigned no_ade:1; /* E-DMAC DO NOT have ADE bit in EESR */ |
758 | unsigned hw_crc:1; /* E-DMAC have CSMR */ | ||
754 | }; | 759 | }; |
755 | 760 | ||
756 | struct sh_eth_private { | 761 | struct sh_eth_private { |
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index e85ffbd54830..48d56da62f08 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | |||
@@ -1737,10 +1737,12 @@ static int stmmac_hw_init(struct stmmac_priv *priv) | |||
1737 | struct mac_device_info *mac; | 1737 | struct mac_device_info *mac; |
1738 | 1738 | ||
1739 | /* Identify the MAC HW device */ | 1739 | /* Identify the MAC HW device */ |
1740 | if (priv->plat->has_gmac) | 1740 | if (priv->plat->has_gmac) { |
1741 | priv->dev->priv_flags |= IFF_UNICAST_FLT; | ||
1741 | mac = dwmac1000_setup(priv->ioaddr); | 1742 | mac = dwmac1000_setup(priv->ioaddr); |
1742 | else | 1743 | } else { |
1743 | mac = dwmac100_setup(priv->ioaddr); | 1744 | mac = dwmac100_setup(priv->ioaddr); |
1745 | } | ||
1744 | if (!mac) | 1746 | if (!mac) |
1745 | return -ENOMEM; | 1747 | return -ENOMEM; |
1746 | 1748 | ||
diff --git a/drivers/net/ethernet/via/via-rhine.c b/drivers/net/ethernet/via/via-rhine.c index 39b8cf3dafcd..fcfa01f7ceb6 100644 --- a/drivers/net/ethernet/via/via-rhine.c +++ b/drivers/net/ethernet/via/via-rhine.c | |||
@@ -503,30 +503,32 @@ static int rhine_vlan_rx_add_vid(struct net_device *dev, unsigned short vid); | |||
503 | static int rhine_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid); | 503 | static int rhine_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid); |
504 | static void rhine_restart_tx(struct net_device *dev); | 504 | static void rhine_restart_tx(struct net_device *dev); |
505 | 505 | ||
506 | static void rhine_wait_bit(struct rhine_private *rp, u8 reg, u8 mask, bool high) | 506 | static void rhine_wait_bit(struct rhine_private *rp, u8 reg, u8 mask, bool low) |
507 | { | 507 | { |
508 | void __iomem *ioaddr = rp->base; | 508 | void __iomem *ioaddr = rp->base; |
509 | int i; | 509 | int i; |
510 | 510 | ||
511 | for (i = 0; i < 1024; i++) { | 511 | for (i = 0; i < 1024; i++) { |
512 | if (high ^ !!(ioread8(ioaddr + reg) & mask)) | 512 | bool has_mask_bits = !!(ioread8(ioaddr + reg) & mask); |
513 | |||
514 | if (low ^ has_mask_bits) | ||
513 | break; | 515 | break; |
514 | udelay(10); | 516 | udelay(10); |
515 | } | 517 | } |
516 | if (i > 64) { | 518 | if (i > 64) { |
517 | netif_dbg(rp, hw, rp->dev, "%s bit wait (%02x/%02x) cycle " | 519 | netif_dbg(rp, hw, rp->dev, "%s bit wait (%02x/%02x) cycle " |
518 | "count: %04d\n", high ? "high" : "low", reg, mask, i); | 520 | "count: %04d\n", low ? "low" : "high", reg, mask, i); |
519 | } | 521 | } |
520 | } | 522 | } |
521 | 523 | ||
522 | static void rhine_wait_bit_high(struct rhine_private *rp, u8 reg, u8 mask) | 524 | static void rhine_wait_bit_high(struct rhine_private *rp, u8 reg, u8 mask) |
523 | { | 525 | { |
524 | rhine_wait_bit(rp, reg, mask, true); | 526 | rhine_wait_bit(rp, reg, mask, false); |
525 | } | 527 | } |
526 | 528 | ||
527 | static void rhine_wait_bit_low(struct rhine_private *rp, u8 reg, u8 mask) | 529 | static void rhine_wait_bit_low(struct rhine_private *rp, u8 reg, u8 mask) |
528 | { | 530 | { |
529 | rhine_wait_bit(rp, reg, mask, false); | 531 | rhine_wait_bit(rp, reg, mask, true); |
530 | } | 532 | } |
531 | 533 | ||
532 | static u32 rhine_get_events(struct rhine_private *rp) | 534 | static u32 rhine_get_events(struct rhine_private *rp) |
diff --git a/drivers/net/irda/sa1100_ir.c b/drivers/net/irda/sa1100_ir.c index a0d1913a58d3..e25067552b20 100644 --- a/drivers/net/irda/sa1100_ir.c +++ b/drivers/net/irda/sa1100_ir.c | |||
@@ -147,7 +147,7 @@ static void sa1100_irda_dma_start(struct sa1100_buf *buf, | |||
147 | struct dma_async_tx_descriptor *desc; | 147 | struct dma_async_tx_descriptor *desc; |
148 | struct dma_chan *chan = buf->chan; | 148 | struct dma_chan *chan = buf->chan; |
149 | 149 | ||
150 | desc = chan->device->device_prep_slave_sg(chan, &buf->sg, 1, dir, | 150 | desc = dmaengine_prep_slave_sg(chan, &buf->sg, 1, dir, |
151 | DMA_PREP_INTERRUPT | DMA_CTRL_ACK); | 151 | DMA_PREP_INTERRUPT | DMA_CTRL_ACK); |
152 | if (desc) { | 152 | if (desc) { |
153 | desc->callback = cb; | 153 | desc->callback = cb; |
diff --git a/drivers/net/phy/icplus.c b/drivers/net/phy/icplus.c index 0856e1b7a849..f08c85acf761 100644 --- a/drivers/net/phy/icplus.c +++ b/drivers/net/phy/icplus.c | |||
@@ -162,7 +162,8 @@ static int ip101a_g_config_init(struct phy_device *phydev) | |||
162 | /* Enable Auto Power Saving mode */ | 162 | /* Enable Auto Power Saving mode */ |
163 | c = phy_read(phydev, IP10XX_SPEC_CTRL_STATUS); | 163 | c = phy_read(phydev, IP10XX_SPEC_CTRL_STATUS); |
164 | c |= IP101A_G_APS_ON; | 164 | c |= IP101A_G_APS_ON; |
165 | return c; | 165 | |
166 | return phy_write(phydev, IP10XX_SPEC_CTRL_STATUS, c); | ||
166 | } | 167 | } |
167 | 168 | ||
168 | static int ip175c_read_status(struct phy_device *phydev) | 169 | static int ip175c_read_status(struct phy_device *phydev) |
diff --git a/drivers/net/ppp/ppp_generic.c b/drivers/net/ppp/ppp_generic.c index 159da2905fe9..33f8c51968b6 100644 --- a/drivers/net/ppp/ppp_generic.c +++ b/drivers/net/ppp/ppp_generic.c | |||
@@ -235,7 +235,7 @@ struct ppp_net { | |||
235 | /* Prototypes. */ | 235 | /* Prototypes. */ |
236 | static int ppp_unattached_ioctl(struct net *net, struct ppp_file *pf, | 236 | static int ppp_unattached_ioctl(struct net *net, struct ppp_file *pf, |
237 | struct file *file, unsigned int cmd, unsigned long arg); | 237 | struct file *file, unsigned int cmd, unsigned long arg); |
238 | static void ppp_xmit_process(struct ppp *ppp); | 238 | static int ppp_xmit_process(struct ppp *ppp); |
239 | static void ppp_send_frame(struct ppp *ppp, struct sk_buff *skb); | 239 | static void ppp_send_frame(struct ppp *ppp, struct sk_buff *skb); |
240 | static void ppp_push(struct ppp *ppp); | 240 | static void ppp_push(struct ppp *ppp); |
241 | static void ppp_channel_push(struct channel *pch); | 241 | static void ppp_channel_push(struct channel *pch); |
@@ -968,9 +968,9 @@ ppp_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
968 | proto = npindex_to_proto[npi]; | 968 | proto = npindex_to_proto[npi]; |
969 | put_unaligned_be16(proto, pp); | 969 | put_unaligned_be16(proto, pp); |
970 | 970 | ||
971 | netif_stop_queue(dev); | ||
972 | skb_queue_tail(&ppp->file.xq, skb); | 971 | skb_queue_tail(&ppp->file.xq, skb); |
973 | ppp_xmit_process(ppp); | 972 | if (!ppp_xmit_process(ppp)) |
973 | netif_stop_queue(dev); | ||
974 | return NETDEV_TX_OK; | 974 | return NETDEV_TX_OK; |
975 | 975 | ||
976 | outf: | 976 | outf: |
@@ -1048,10 +1048,11 @@ static void ppp_setup(struct net_device *dev) | |||
1048 | * Called to do any work queued up on the transmit side | 1048 | * Called to do any work queued up on the transmit side |
1049 | * that can now be done. | 1049 | * that can now be done. |
1050 | */ | 1050 | */ |
1051 | static void | 1051 | static int |
1052 | ppp_xmit_process(struct ppp *ppp) | 1052 | ppp_xmit_process(struct ppp *ppp) |
1053 | { | 1053 | { |
1054 | struct sk_buff *skb; | 1054 | struct sk_buff *skb; |
1055 | int ret = 0; | ||
1055 | 1056 | ||
1056 | ppp_xmit_lock(ppp); | 1057 | ppp_xmit_lock(ppp); |
1057 | if (!ppp->closing) { | 1058 | if (!ppp->closing) { |
@@ -1061,10 +1062,13 @@ ppp_xmit_process(struct ppp *ppp) | |||
1061 | ppp_send_frame(ppp, skb); | 1062 | ppp_send_frame(ppp, skb); |
1062 | /* If there's no work left to do, tell the core net | 1063 | /* If there's no work left to do, tell the core net |
1063 | code that we can accept some more. */ | 1064 | code that we can accept some more. */ |
1064 | if (!ppp->xmit_pending && !skb_peek(&ppp->file.xq)) | 1065 | if (!ppp->xmit_pending && !skb_peek(&ppp->file.xq)) { |
1065 | netif_wake_queue(ppp->dev); | 1066 | netif_wake_queue(ppp->dev); |
1067 | ret = 1; | ||
1068 | } | ||
1066 | } | 1069 | } |
1067 | ppp_xmit_unlock(ppp); | 1070 | ppp_xmit_unlock(ppp); |
1071 | return ret; | ||
1068 | } | 1072 | } |
1069 | 1073 | ||
1070 | static inline struct sk_buff * | 1074 | static inline struct sk_buff * |
diff --git a/drivers/net/rionet.c b/drivers/net/rionet.c index a57f05726b57..91d25888a1b9 100644 --- a/drivers/net/rionet.c +++ b/drivers/net/rionet.c | |||
@@ -375,8 +375,8 @@ static void rionet_remove(struct rio_dev *rdev) | |||
375 | struct net_device *ndev = rio_get_drvdata(rdev); | 375 | struct net_device *ndev = rio_get_drvdata(rdev); |
376 | struct rionet_peer *peer, *tmp; | 376 | struct rionet_peer *peer, *tmp; |
377 | 377 | ||
378 | free_pages((unsigned long)rionet_active, rdev->net->hport->sys_size ? | 378 | free_pages((unsigned long)rionet_active, get_order(sizeof(void *) * |
379 | __fls(sizeof(void *)) + 4 : 0); | 379 | RIO_MAX_ROUTE_ENTRIES(rdev->net->hport->sys_size))); |
380 | unregister_netdev(ndev); | 380 | unregister_netdev(ndev); |
381 | free_netdev(ndev); | 381 | free_netdev(ndev); |
382 | 382 | ||
@@ -432,15 +432,16 @@ static int rionet_setup_netdev(struct rio_mport *mport, struct net_device *ndev) | |||
432 | int rc = 0; | 432 | int rc = 0; |
433 | struct rionet_private *rnet; | 433 | struct rionet_private *rnet; |
434 | u16 device_id; | 434 | u16 device_id; |
435 | const size_t rionet_active_bytes = sizeof(void *) * | ||
436 | RIO_MAX_ROUTE_ENTRIES(mport->sys_size); | ||
435 | 437 | ||
436 | rionet_active = (struct rio_dev **)__get_free_pages(GFP_KERNEL, | 438 | rionet_active = (struct rio_dev **)__get_free_pages(GFP_KERNEL, |
437 | mport->sys_size ? __fls(sizeof(void *)) + 4 : 0); | 439 | get_order(rionet_active_bytes)); |
438 | if (!rionet_active) { | 440 | if (!rionet_active) { |
439 | rc = -ENOMEM; | 441 | rc = -ENOMEM; |
440 | goto out; | 442 | goto out; |
441 | } | 443 | } |
442 | memset((void *)rionet_active, 0, sizeof(void *) * | 444 | memset((void *)rionet_active, 0, rionet_active_bytes); |
443 | RIO_MAX_ROUTE_ENTRIES(mport->sys_size)); | ||
444 | 445 | ||
445 | /* Set up private area */ | 446 | /* Set up private area */ |
446 | rnet = netdev_priv(ndev); | 447 | rnet = netdev_priv(ndev); |
diff --git a/drivers/net/usb/cdc-phonet.c b/drivers/net/usb/cdc-phonet.c index 3886b30ed373..3e41b00c6806 100644 --- a/drivers/net/usb/cdc-phonet.c +++ b/drivers/net/usb/cdc-phonet.c | |||
@@ -165,13 +165,13 @@ static void rx_complete(struct urb *req) | |||
165 | memcpy(skb_put(skb, 1), page_address(page), 1); | 165 | memcpy(skb_put(skb, 1), page_address(page), 1); |
166 | skb_add_rx_frag(skb, skb_shinfo(skb)->nr_frags, | 166 | skb_add_rx_frag(skb, skb_shinfo(skb)->nr_frags, |
167 | page, 1, req->actual_length, | 167 | page, 1, req->actual_length, |
168 | req->actual_length); | 168 | PAGE_SIZE); |
169 | page = NULL; | 169 | page = NULL; |
170 | } | 170 | } |
171 | } else { | 171 | } else { |
172 | skb_add_rx_frag(skb, skb_shinfo(skb)->nr_frags, | 172 | skb_add_rx_frag(skb, skb_shinfo(skb)->nr_frags, |
173 | page, 0, req->actual_length, | 173 | page, 0, req->actual_length, |
174 | req->actual_length); | 174 | PAGE_SIZE); |
175 | page = NULL; | 175 | page = NULL; |
176 | } | 176 | } |
177 | if (req->actual_length < PAGE_SIZE) | 177 | if (req->actual_length < PAGE_SIZE) |
diff --git a/drivers/net/usb/cdc_eem.c b/drivers/net/usb/cdc_eem.c index 439690be519f..685a4e22c768 100644 --- a/drivers/net/usb/cdc_eem.c +++ b/drivers/net/usb/cdc_eem.c | |||
@@ -93,6 +93,7 @@ static int eem_bind(struct usbnet *dev, struct usb_interface *intf) | |||
93 | /* no jumbogram (16K) support for now */ | 93 | /* no jumbogram (16K) support for now */ |
94 | 94 | ||
95 | dev->net->hard_header_len += EEM_HEAD + ETH_FCS_LEN; | 95 | dev->net->hard_header_len += EEM_HEAD + ETH_FCS_LEN; |
96 | dev->hard_mtu = dev->net->mtu + dev->net->hard_header_len; | ||
96 | 97 | ||
97 | return 0; | 98 | return 0; |
98 | } | 99 | } |
diff --git a/drivers/net/usb/rtl8150.c b/drivers/net/usb/rtl8150.c index 6dda2fe5b15b..d363b31053da 100644 --- a/drivers/net/usb/rtl8150.c +++ b/drivers/net/usb/rtl8150.c | |||
@@ -85,32 +85,6 @@ | |||
85 | #define INT_CRERR_CNT 0x06 | 85 | #define INT_CRERR_CNT 0x06 |
86 | #define INT_COL_CNT 0x07 | 86 | #define INT_COL_CNT 0x07 |
87 | 87 | ||
88 | /* Transmit status register errors */ | ||
89 | #define TSR_ECOL (1<<5) | ||
90 | #define TSR_LCOL (1<<4) | ||
91 | #define TSR_LOSS_CRS (1<<3) | ||
92 | #define TSR_JBR (1<<2) | ||
93 | #define TSR_ERRORS (TSR_ECOL | TSR_LCOL | TSR_LOSS_CRS | TSR_JBR) | ||
94 | /* Receive status register errors */ | ||
95 | #define RSR_CRC (1<<2) | ||
96 | #define RSR_FAE (1<<1) | ||
97 | #define RSR_ERRORS (RSR_CRC | RSR_FAE) | ||
98 | |||
99 | /* Media status register definitions */ | ||
100 | #define MSR_DUPLEX (1<<4) | ||
101 | #define MSR_SPEED (1<<3) | ||
102 | #define MSR_LINK (1<<2) | ||
103 | |||
104 | /* Interrupt pipe data */ | ||
105 | #define INT_TSR 0x00 | ||
106 | #define INT_RSR 0x01 | ||
107 | #define INT_MSR 0x02 | ||
108 | #define INT_WAKSR 0x03 | ||
109 | #define INT_TXOK_CNT 0x04 | ||
110 | #define INT_RXLOST_CNT 0x05 | ||
111 | #define INT_CRERR_CNT 0x06 | ||
112 | #define INT_COL_CNT 0x07 | ||
113 | |||
114 | 88 | ||
115 | #define RTL8150_MTU 1540 | 89 | #define RTL8150_MTU 1540 |
116 | #define RTL8150_TX_TIMEOUT (HZ) | 90 | #define RTL8150_TX_TIMEOUT (HZ) |
diff --git a/drivers/net/usb/zaurus.c b/drivers/net/usb/zaurus.c index c3197ce0e2ad..34db195fb8b0 100644 --- a/drivers/net/usb/zaurus.c +++ b/drivers/net/usb/zaurus.c | |||
@@ -337,6 +337,11 @@ static const struct usb_device_id products [] = { | |||
337 | .driver_info = ZAURUS_PXA_INFO, | 337 | .driver_info = ZAURUS_PXA_INFO, |
338 | }, | 338 | }, |
339 | { | 339 | { |
340 | /* Motorola Rokr E6 */ | ||
341 | USB_DEVICE_AND_INTERFACE_INFO(0x22b8, 0x6027, USB_CLASS_COMM, | ||
342 | USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE), | ||
343 | .driver_info = (unsigned long) &bogus_mdlm_info, | ||
344 | }, { | ||
340 | /* Motorola MOTOMAGX phones */ | 345 | /* Motorola MOTOMAGX phones */ |
341 | USB_DEVICE_AND_INTERFACE_INFO(0x22b8, 0x6425, USB_CLASS_COMM, | 346 | USB_DEVICE_AND_INTERFACE_INFO(0x22b8, 0x6425, USB_CLASS_COMM, |
342 | USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE), | 347 | USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE), |
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index 019da012669f..4de2760c5937 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c | |||
@@ -625,12 +625,13 @@ static netdev_tx_t start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
625 | 625 | ||
626 | /* This can happen with OOM and indirect buffers. */ | 626 | /* This can happen with OOM and indirect buffers. */ |
627 | if (unlikely(capacity < 0)) { | 627 | if (unlikely(capacity < 0)) { |
628 | if (net_ratelimit()) { | 628 | if (likely(capacity == -ENOMEM)) { |
629 | if (likely(capacity == -ENOMEM)) { | 629 | if (net_ratelimit()) { |
630 | dev_warn(&dev->dev, | 630 | dev_warn(&dev->dev, |
631 | "TX queue failure: out of memory\n"); | 631 | "TX queue failure: out of memory\n"); |
632 | } else { | 632 | } else { |
633 | dev->stats.tx_fifo_errors++; | 633 | dev->stats.tx_fifo_errors++; |
634 | if (net_ratelimit()) | ||
634 | dev_warn(&dev->dev, | 635 | dev_warn(&dev->dev, |
635 | "Unexpected TX queue failure: %d\n", | 636 | "Unexpected TX queue failure: %d\n", |
636 | capacity); | 637 | capacity); |
diff --git a/drivers/net/wimax/i2400m/debugfs.c b/drivers/net/wimax/i2400m/debugfs.c index 129ba36bd04d..4b66ab1d0e5c 100644 --- a/drivers/net/wimax/i2400m/debugfs.c +++ b/drivers/net/wimax/i2400m/debugfs.c | |||
@@ -53,17 +53,6 @@ struct dentry *debugfs_create_netdev_queue_stopped( | |||
53 | &fops_netdev_queue_stopped); | 53 | &fops_netdev_queue_stopped); |
54 | } | 54 | } |
55 | 55 | ||
56 | |||
57 | /* | ||
58 | * inode->i_private has the @data argument to debugfs_create_file() | ||
59 | */ | ||
60 | static | ||
61 | int i2400m_stats_open(struct inode *inode, struct file *filp) | ||
62 | { | ||
63 | filp->private_data = inode->i_private; | ||
64 | return 0; | ||
65 | } | ||
66 | |||
67 | /* | 56 | /* |
68 | * We don't allow partial reads of this file, as then the reader would | 57 | * We don't allow partial reads of this file, as then the reader would |
69 | * get weirdly confused data as it is updated. | 58 | * get weirdly confused data as it is updated. |
@@ -117,7 +106,7 @@ ssize_t i2400m_rx_stats_write(struct file *filp, const char __user *buffer, | |||
117 | static | 106 | static |
118 | const struct file_operations i2400m_rx_stats_fops = { | 107 | const struct file_operations i2400m_rx_stats_fops = { |
119 | .owner = THIS_MODULE, | 108 | .owner = THIS_MODULE, |
120 | .open = i2400m_stats_open, | 109 | .open = simple_open, |
121 | .read = i2400m_rx_stats_read, | 110 | .read = i2400m_rx_stats_read, |
122 | .write = i2400m_rx_stats_write, | 111 | .write = i2400m_rx_stats_write, |
123 | .llseek = default_llseek, | 112 | .llseek = default_llseek, |
@@ -170,7 +159,7 @@ ssize_t i2400m_tx_stats_write(struct file *filp, const char __user *buffer, | |||
170 | static | 159 | static |
171 | const struct file_operations i2400m_tx_stats_fops = { | 160 | const struct file_operations i2400m_tx_stats_fops = { |
172 | .owner = THIS_MODULE, | 161 | .owner = THIS_MODULE, |
173 | .open = i2400m_stats_open, | 162 | .open = simple_open, |
174 | .read = i2400m_tx_stats_read, | 163 | .read = i2400m_tx_stats_read, |
175 | .write = i2400m_tx_stats_write, | 164 | .write = i2400m_tx_stats_write, |
176 | .llseek = default_llseek, | 165 | .llseek = default_llseek, |
diff --git a/drivers/net/wimax/i2400m/netdev.c b/drivers/net/wimax/i2400m/netdev.c index 63e4b709efa9..1d76ae855f07 100644 --- a/drivers/net/wimax/i2400m/netdev.c +++ b/drivers/net/wimax/i2400m/netdev.c | |||
@@ -597,7 +597,8 @@ static void i2400m_get_drvinfo(struct net_device *net_dev, | |||
597 | struct i2400m *i2400m = net_dev_to_i2400m(net_dev); | 597 | struct i2400m *i2400m = net_dev_to_i2400m(net_dev); |
598 | 598 | ||
599 | strncpy(info->driver, KBUILD_MODNAME, sizeof(info->driver) - 1); | 599 | strncpy(info->driver, KBUILD_MODNAME, sizeof(info->driver) - 1); |
600 | strncpy(info->fw_version, i2400m->fw_name, sizeof(info->fw_version) - 1); | 600 | strncpy(info->fw_version, |
601 | i2400m->fw_name ? : "", sizeof(info->fw_version) - 1); | ||
601 | if (net_dev->dev.parent) | 602 | if (net_dev->dev.parent) |
602 | strncpy(info->bus_info, dev_name(net_dev->dev.parent), | 603 | strncpy(info->bus_info, dev_name(net_dev->dev.parent), |
603 | sizeof(info->bus_info) - 1); | 604 | sizeof(info->bus_info) - 1); |
diff --git a/drivers/net/wimax/i2400m/usb.c b/drivers/net/wimax/i2400m/usb.c index 2c1b8b687646..29b1e033a10b 100644 --- a/drivers/net/wimax/i2400m/usb.c +++ b/drivers/net/wimax/i2400m/usb.c | |||
@@ -339,6 +339,23 @@ int i2400mu_bus_reset(struct i2400m *i2400m, enum i2400m_reset_type rt) | |||
339 | return result; | 339 | return result; |
340 | } | 340 | } |
341 | 341 | ||
342 | static void i2400mu_get_drvinfo(struct net_device *net_dev, | ||
343 | struct ethtool_drvinfo *info) | ||
344 | { | ||
345 | struct i2400m *i2400m = net_dev_to_i2400m(net_dev); | ||
346 | struct i2400mu *i2400mu = container_of(i2400m, struct i2400mu, i2400m); | ||
347 | struct usb_device *udev = i2400mu->usb_dev; | ||
348 | |||
349 | strncpy(info->driver, KBUILD_MODNAME, sizeof(info->driver) - 1); | ||
350 | strncpy(info->fw_version, | ||
351 | i2400m->fw_name ? : "", sizeof(info->fw_version) - 1); | ||
352 | usb_make_path(udev, info->bus_info, sizeof(info->bus_info)); | ||
353 | } | ||
354 | |||
355 | static const struct ethtool_ops i2400mu_ethtool_ops = { | ||
356 | .get_drvinfo = i2400mu_get_drvinfo, | ||
357 | .get_link = ethtool_op_get_link, | ||
358 | }; | ||
342 | 359 | ||
343 | static | 360 | static |
344 | void i2400mu_netdev_setup(struct net_device *net_dev) | 361 | void i2400mu_netdev_setup(struct net_device *net_dev) |
@@ -347,6 +364,7 @@ void i2400mu_netdev_setup(struct net_device *net_dev) | |||
347 | struct i2400mu *i2400mu = container_of(i2400m, struct i2400mu, i2400m); | 364 | struct i2400mu *i2400mu = container_of(i2400m, struct i2400mu, i2400m); |
348 | i2400mu_init(i2400mu); | 365 | i2400mu_init(i2400mu); |
349 | i2400m_netdev_setup(net_dev); | 366 | i2400m_netdev_setup(net_dev); |
367 | net_dev->ethtool_ops = &i2400mu_ethtool_ops; | ||
350 | } | 368 | } |
351 | 369 | ||
352 | 370 | ||
diff --git a/drivers/net/wireless/ath/ath5k/debug.c b/drivers/net/wireless/ath/ath5k/debug.c index 8c5ce8b0c734..e5e8f45d86ac 100644 --- a/drivers/net/wireless/ath/ath5k/debug.c +++ b/drivers/net/wireless/ath/ath5k/debug.c | |||
@@ -71,13 +71,6 @@ static unsigned int ath5k_debug; | |||
71 | module_param_named(debug, ath5k_debug, uint, 0); | 71 | module_param_named(debug, ath5k_debug, uint, 0); |
72 | 72 | ||
73 | 73 | ||
74 | static int ath5k_debugfs_open(struct inode *inode, struct file *file) | ||
75 | { | ||
76 | file->private_data = inode->i_private; | ||
77 | return 0; | ||
78 | } | ||
79 | |||
80 | |||
81 | /* debugfs: registers */ | 74 | /* debugfs: registers */ |
82 | 75 | ||
83 | struct reg { | 76 | struct reg { |
@@ -265,7 +258,7 @@ static ssize_t write_file_beacon(struct file *file, | |||
265 | static const struct file_operations fops_beacon = { | 258 | static const struct file_operations fops_beacon = { |
266 | .read = read_file_beacon, | 259 | .read = read_file_beacon, |
267 | .write = write_file_beacon, | 260 | .write = write_file_beacon, |
268 | .open = ath5k_debugfs_open, | 261 | .open = simple_open, |
269 | .owner = THIS_MODULE, | 262 | .owner = THIS_MODULE, |
270 | .llseek = default_llseek, | 263 | .llseek = default_llseek, |
271 | }; | 264 | }; |
@@ -285,7 +278,7 @@ static ssize_t write_file_reset(struct file *file, | |||
285 | 278 | ||
286 | static const struct file_operations fops_reset = { | 279 | static const struct file_operations fops_reset = { |
287 | .write = write_file_reset, | 280 | .write = write_file_reset, |
288 | .open = ath5k_debugfs_open, | 281 | .open = simple_open, |
289 | .owner = THIS_MODULE, | 282 | .owner = THIS_MODULE, |
290 | .llseek = noop_llseek, | 283 | .llseek = noop_llseek, |
291 | }; | 284 | }; |
@@ -365,7 +358,7 @@ static ssize_t write_file_debug(struct file *file, | |||
365 | static const struct file_operations fops_debug = { | 358 | static const struct file_operations fops_debug = { |
366 | .read = read_file_debug, | 359 | .read = read_file_debug, |
367 | .write = write_file_debug, | 360 | .write = write_file_debug, |
368 | .open = ath5k_debugfs_open, | 361 | .open = simple_open, |
369 | .owner = THIS_MODULE, | 362 | .owner = THIS_MODULE, |
370 | .llseek = default_llseek, | 363 | .llseek = default_llseek, |
371 | }; | 364 | }; |
@@ -477,7 +470,7 @@ static ssize_t write_file_antenna(struct file *file, | |||
477 | static const struct file_operations fops_antenna = { | 470 | static const struct file_operations fops_antenna = { |
478 | .read = read_file_antenna, | 471 | .read = read_file_antenna, |
479 | .write = write_file_antenna, | 472 | .write = write_file_antenna, |
480 | .open = ath5k_debugfs_open, | 473 | .open = simple_open, |
481 | .owner = THIS_MODULE, | 474 | .owner = THIS_MODULE, |
482 | .llseek = default_llseek, | 475 | .llseek = default_llseek, |
483 | }; | 476 | }; |
@@ -532,7 +525,7 @@ static ssize_t read_file_misc(struct file *file, char __user *user_buf, | |||
532 | 525 | ||
533 | static const struct file_operations fops_misc = { | 526 | static const struct file_operations fops_misc = { |
534 | .read = read_file_misc, | 527 | .read = read_file_misc, |
535 | .open = ath5k_debugfs_open, | 528 | .open = simple_open, |
536 | .owner = THIS_MODULE, | 529 | .owner = THIS_MODULE, |
537 | }; | 530 | }; |
538 | 531 | ||
@@ -647,7 +640,7 @@ static ssize_t write_file_frameerrors(struct file *file, | |||
647 | static const struct file_operations fops_frameerrors = { | 640 | static const struct file_operations fops_frameerrors = { |
648 | .read = read_file_frameerrors, | 641 | .read = read_file_frameerrors, |
649 | .write = write_file_frameerrors, | 642 | .write = write_file_frameerrors, |
650 | .open = ath5k_debugfs_open, | 643 | .open = simple_open, |
651 | .owner = THIS_MODULE, | 644 | .owner = THIS_MODULE, |
652 | .llseek = default_llseek, | 645 | .llseek = default_llseek, |
653 | }; | 646 | }; |
@@ -810,7 +803,7 @@ static ssize_t write_file_ani(struct file *file, | |||
810 | static const struct file_operations fops_ani = { | 803 | static const struct file_operations fops_ani = { |
811 | .read = read_file_ani, | 804 | .read = read_file_ani, |
812 | .write = write_file_ani, | 805 | .write = write_file_ani, |
813 | .open = ath5k_debugfs_open, | 806 | .open = simple_open, |
814 | .owner = THIS_MODULE, | 807 | .owner = THIS_MODULE, |
815 | .llseek = default_llseek, | 808 | .llseek = default_llseek, |
816 | }; | 809 | }; |
@@ -881,7 +874,7 @@ static ssize_t write_file_queue(struct file *file, | |||
881 | static const struct file_operations fops_queue = { | 874 | static const struct file_operations fops_queue = { |
882 | .read = read_file_queue, | 875 | .read = read_file_queue, |
883 | .write = write_file_queue, | 876 | .write = write_file_queue, |
884 | .open = ath5k_debugfs_open, | 877 | .open = simple_open, |
885 | .owner = THIS_MODULE, | 878 | .owner = THIS_MODULE, |
886 | .llseek = default_llseek, | 879 | .llseek = default_llseek, |
887 | }; | 880 | }; |
diff --git a/drivers/net/wireless/ath/ath6kl/debug.c b/drivers/net/wireless/ath/ath6kl/debug.c index 552adb3f80d0..d01403a263ff 100644 --- a/drivers/net/wireless/ath/ath6kl/debug.c +++ b/drivers/net/wireless/ath/ath6kl/debug.c | |||
@@ -217,12 +217,6 @@ void dump_cred_dist_stats(struct htc_target *target) | |||
217 | target->credit_info->cur_free_credits); | 217 | target->credit_info->cur_free_credits); |
218 | } | 218 | } |
219 | 219 | ||
220 | static int ath6kl_debugfs_open(struct inode *inode, struct file *file) | ||
221 | { | ||
222 | file->private_data = inode->i_private; | ||
223 | return 0; | ||
224 | } | ||
225 | |||
226 | void ath6kl_debug_war(struct ath6kl *ar, enum ath6kl_war war) | 220 | void ath6kl_debug_war(struct ath6kl *ar, enum ath6kl_war war) |
227 | { | 221 | { |
228 | switch (war) { | 222 | switch (war) { |
@@ -263,7 +257,7 @@ static ssize_t read_file_war_stats(struct file *file, char __user *user_buf, | |||
263 | 257 | ||
264 | static const struct file_operations fops_war_stats = { | 258 | static const struct file_operations fops_war_stats = { |
265 | .read = read_file_war_stats, | 259 | .read = read_file_war_stats, |
266 | .open = ath6kl_debugfs_open, | 260 | .open = simple_open, |
267 | .owner = THIS_MODULE, | 261 | .owner = THIS_MODULE, |
268 | .llseek = default_llseek, | 262 | .llseek = default_llseek, |
269 | }; | 263 | }; |
@@ -488,7 +482,7 @@ static ssize_t ath6kl_fwlog_mask_write(struct file *file, | |||
488 | } | 482 | } |
489 | 483 | ||
490 | static const struct file_operations fops_fwlog_mask = { | 484 | static const struct file_operations fops_fwlog_mask = { |
491 | .open = ath6kl_debugfs_open, | 485 | .open = simple_open, |
492 | .read = ath6kl_fwlog_mask_read, | 486 | .read = ath6kl_fwlog_mask_read, |
493 | .write = ath6kl_fwlog_mask_write, | 487 | .write = ath6kl_fwlog_mask_write, |
494 | .owner = THIS_MODULE, | 488 | .owner = THIS_MODULE, |
@@ -634,7 +628,7 @@ static ssize_t read_file_tgt_stats(struct file *file, char __user *user_buf, | |||
634 | 628 | ||
635 | static const struct file_operations fops_tgt_stats = { | 629 | static const struct file_operations fops_tgt_stats = { |
636 | .read = read_file_tgt_stats, | 630 | .read = read_file_tgt_stats, |
637 | .open = ath6kl_debugfs_open, | 631 | .open = simple_open, |
638 | .owner = THIS_MODULE, | 632 | .owner = THIS_MODULE, |
639 | .llseek = default_llseek, | 633 | .llseek = default_llseek, |
640 | }; | 634 | }; |
@@ -699,7 +693,7 @@ static ssize_t read_file_credit_dist_stats(struct file *file, | |||
699 | 693 | ||
700 | static const struct file_operations fops_credit_dist_stats = { | 694 | static const struct file_operations fops_credit_dist_stats = { |
701 | .read = read_file_credit_dist_stats, | 695 | .read = read_file_credit_dist_stats, |
702 | .open = ath6kl_debugfs_open, | 696 | .open = simple_open, |
703 | .owner = THIS_MODULE, | 697 | .owner = THIS_MODULE, |
704 | .llseek = default_llseek, | 698 | .llseek = default_llseek, |
705 | }; | 699 | }; |
@@ -802,7 +796,7 @@ static ssize_t ath6kl_endpoint_stats_write(struct file *file, | |||
802 | } | 796 | } |
803 | 797 | ||
804 | static const struct file_operations fops_endpoint_stats = { | 798 | static const struct file_operations fops_endpoint_stats = { |
805 | .open = ath6kl_debugfs_open, | 799 | .open = simple_open, |
806 | .read = ath6kl_endpoint_stats_read, | 800 | .read = ath6kl_endpoint_stats_read, |
807 | .write = ath6kl_endpoint_stats_write, | 801 | .write = ath6kl_endpoint_stats_write, |
808 | .owner = THIS_MODULE, | 802 | .owner = THIS_MODULE, |
@@ -875,7 +869,7 @@ static ssize_t ath6kl_regread_write(struct file *file, | |||
875 | static const struct file_operations fops_diag_reg_read = { | 869 | static const struct file_operations fops_diag_reg_read = { |
876 | .read = ath6kl_regread_read, | 870 | .read = ath6kl_regread_read, |
877 | .write = ath6kl_regread_write, | 871 | .write = ath6kl_regread_write, |
878 | .open = ath6kl_debugfs_open, | 872 | .open = simple_open, |
879 | .owner = THIS_MODULE, | 873 | .owner = THIS_MODULE, |
880 | .llseek = default_llseek, | 874 | .llseek = default_llseek, |
881 | }; | 875 | }; |
@@ -999,7 +993,7 @@ static ssize_t ath6kl_lrssi_roam_read(struct file *file, | |||
999 | static const struct file_operations fops_lrssi_roam_threshold = { | 993 | static const struct file_operations fops_lrssi_roam_threshold = { |
1000 | .read = ath6kl_lrssi_roam_read, | 994 | .read = ath6kl_lrssi_roam_read, |
1001 | .write = ath6kl_lrssi_roam_write, | 995 | .write = ath6kl_lrssi_roam_write, |
1002 | .open = ath6kl_debugfs_open, | 996 | .open = simple_open, |
1003 | .owner = THIS_MODULE, | 997 | .owner = THIS_MODULE, |
1004 | .llseek = default_llseek, | 998 | .llseek = default_llseek, |
1005 | }; | 999 | }; |
@@ -1061,7 +1055,7 @@ static ssize_t ath6kl_regwrite_write(struct file *file, | |||
1061 | static const struct file_operations fops_diag_reg_write = { | 1055 | static const struct file_operations fops_diag_reg_write = { |
1062 | .read = ath6kl_regwrite_read, | 1056 | .read = ath6kl_regwrite_read, |
1063 | .write = ath6kl_regwrite_write, | 1057 | .write = ath6kl_regwrite_write, |
1064 | .open = ath6kl_debugfs_open, | 1058 | .open = simple_open, |
1065 | .owner = THIS_MODULE, | 1059 | .owner = THIS_MODULE, |
1066 | .llseek = default_llseek, | 1060 | .llseek = default_llseek, |
1067 | }; | 1061 | }; |
@@ -1166,7 +1160,7 @@ static ssize_t ath6kl_roam_table_read(struct file *file, char __user *user_buf, | |||
1166 | 1160 | ||
1167 | static const struct file_operations fops_roam_table = { | 1161 | static const struct file_operations fops_roam_table = { |
1168 | .read = ath6kl_roam_table_read, | 1162 | .read = ath6kl_roam_table_read, |
1169 | .open = ath6kl_debugfs_open, | 1163 | .open = simple_open, |
1170 | .owner = THIS_MODULE, | 1164 | .owner = THIS_MODULE, |
1171 | .llseek = default_llseek, | 1165 | .llseek = default_llseek, |
1172 | }; | 1166 | }; |
@@ -1204,7 +1198,7 @@ static ssize_t ath6kl_force_roam_write(struct file *file, | |||
1204 | 1198 | ||
1205 | static const struct file_operations fops_force_roam = { | 1199 | static const struct file_operations fops_force_roam = { |
1206 | .write = ath6kl_force_roam_write, | 1200 | .write = ath6kl_force_roam_write, |
1207 | .open = ath6kl_debugfs_open, | 1201 | .open = simple_open, |
1208 | .owner = THIS_MODULE, | 1202 | .owner = THIS_MODULE, |
1209 | .llseek = default_llseek, | 1203 | .llseek = default_llseek, |
1210 | }; | 1204 | }; |
@@ -1244,7 +1238,7 @@ static ssize_t ath6kl_roam_mode_write(struct file *file, | |||
1244 | 1238 | ||
1245 | static const struct file_operations fops_roam_mode = { | 1239 | static const struct file_operations fops_roam_mode = { |
1246 | .write = ath6kl_roam_mode_write, | 1240 | .write = ath6kl_roam_mode_write, |
1247 | .open = ath6kl_debugfs_open, | 1241 | .open = simple_open, |
1248 | .owner = THIS_MODULE, | 1242 | .owner = THIS_MODULE, |
1249 | .llseek = default_llseek, | 1243 | .llseek = default_llseek, |
1250 | }; | 1244 | }; |
@@ -1286,7 +1280,7 @@ static ssize_t ath6kl_keepalive_write(struct file *file, | |||
1286 | } | 1280 | } |
1287 | 1281 | ||
1288 | static const struct file_operations fops_keepalive = { | 1282 | static const struct file_operations fops_keepalive = { |
1289 | .open = ath6kl_debugfs_open, | 1283 | .open = simple_open, |
1290 | .read = ath6kl_keepalive_read, | 1284 | .read = ath6kl_keepalive_read, |
1291 | .write = ath6kl_keepalive_write, | 1285 | .write = ath6kl_keepalive_write, |
1292 | .owner = THIS_MODULE, | 1286 | .owner = THIS_MODULE, |
@@ -1331,7 +1325,7 @@ static ssize_t ath6kl_disconnect_timeout_write(struct file *file, | |||
1331 | } | 1325 | } |
1332 | 1326 | ||
1333 | static const struct file_operations fops_disconnect_timeout = { | 1327 | static const struct file_operations fops_disconnect_timeout = { |
1334 | .open = ath6kl_debugfs_open, | 1328 | .open = simple_open, |
1335 | .read = ath6kl_disconnect_timeout_read, | 1329 | .read = ath6kl_disconnect_timeout_read, |
1336 | .write = ath6kl_disconnect_timeout_write, | 1330 | .write = ath6kl_disconnect_timeout_write, |
1337 | .owner = THIS_MODULE, | 1331 | .owner = THIS_MODULE, |
@@ -1512,7 +1506,7 @@ static ssize_t ath6kl_create_qos_write(struct file *file, | |||
1512 | 1506 | ||
1513 | static const struct file_operations fops_create_qos = { | 1507 | static const struct file_operations fops_create_qos = { |
1514 | .write = ath6kl_create_qos_write, | 1508 | .write = ath6kl_create_qos_write, |
1515 | .open = ath6kl_debugfs_open, | 1509 | .open = simple_open, |
1516 | .owner = THIS_MODULE, | 1510 | .owner = THIS_MODULE, |
1517 | .llseek = default_llseek, | 1511 | .llseek = default_llseek, |
1518 | }; | 1512 | }; |
@@ -1560,7 +1554,7 @@ static ssize_t ath6kl_delete_qos_write(struct file *file, | |||
1560 | 1554 | ||
1561 | static const struct file_operations fops_delete_qos = { | 1555 | static const struct file_operations fops_delete_qos = { |
1562 | .write = ath6kl_delete_qos_write, | 1556 | .write = ath6kl_delete_qos_write, |
1563 | .open = ath6kl_debugfs_open, | 1557 | .open = simple_open, |
1564 | .owner = THIS_MODULE, | 1558 | .owner = THIS_MODULE, |
1565 | .llseek = default_llseek, | 1559 | .llseek = default_llseek, |
1566 | }; | 1560 | }; |
@@ -1593,7 +1587,7 @@ static ssize_t ath6kl_bgscan_int_write(struct file *file, | |||
1593 | 1587 | ||
1594 | static const struct file_operations fops_bgscan_int = { | 1588 | static const struct file_operations fops_bgscan_int = { |
1595 | .write = ath6kl_bgscan_int_write, | 1589 | .write = ath6kl_bgscan_int_write, |
1596 | .open = ath6kl_debugfs_open, | 1590 | .open = simple_open, |
1597 | .owner = THIS_MODULE, | 1591 | .owner = THIS_MODULE, |
1598 | .llseek = default_llseek, | 1592 | .llseek = default_llseek, |
1599 | }; | 1593 | }; |
@@ -1651,7 +1645,7 @@ static ssize_t ath6kl_listen_int_read(struct file *file, | |||
1651 | static const struct file_operations fops_listen_int = { | 1645 | static const struct file_operations fops_listen_int = { |
1652 | .read = ath6kl_listen_int_read, | 1646 | .read = ath6kl_listen_int_read, |
1653 | .write = ath6kl_listen_int_write, | 1647 | .write = ath6kl_listen_int_write, |
1654 | .open = ath6kl_debugfs_open, | 1648 | .open = simple_open, |
1655 | .owner = THIS_MODULE, | 1649 | .owner = THIS_MODULE, |
1656 | .llseek = default_llseek, | 1650 | .llseek = default_llseek, |
1657 | }; | 1651 | }; |
@@ -1711,7 +1705,7 @@ static ssize_t ath6kl_power_params_write(struct file *file, | |||
1711 | 1705 | ||
1712 | static const struct file_operations fops_power_params = { | 1706 | static const struct file_operations fops_power_params = { |
1713 | .write = ath6kl_power_params_write, | 1707 | .write = ath6kl_power_params_write, |
1714 | .open = ath6kl_debugfs_open, | 1708 | .open = simple_open, |
1715 | .owner = THIS_MODULE, | 1709 | .owner = THIS_MODULE, |
1716 | .llseek = default_llseek, | 1710 | .llseek = default_llseek, |
1717 | }; | 1711 | }; |
diff --git a/drivers/net/wireless/ath/ath9k/calib.c b/drivers/net/wireless/ath/ath9k/calib.c index 2f4b48e6fb03..e5cceb077574 100644 --- a/drivers/net/wireless/ath/ath9k/calib.c +++ b/drivers/net/wireless/ath/ath9k/calib.c | |||
@@ -20,7 +20,6 @@ | |||
20 | 20 | ||
21 | /* Common calibration code */ | 21 | /* Common calibration code */ |
22 | 22 | ||
23 | #define ATH9K_NF_TOO_HIGH -60 | ||
24 | 23 | ||
25 | static int16_t ath9k_hw_get_nf_hist_mid(int16_t *nfCalBuffer) | 24 | static int16_t ath9k_hw_get_nf_hist_mid(int16_t *nfCalBuffer) |
26 | { | 25 | { |
@@ -346,10 +345,10 @@ static void ath9k_hw_nf_sanitize(struct ath_hw *ah, s16 *nf) | |||
346 | "NF calibrated [%s] [chain %d] is %d\n", | 345 | "NF calibrated [%s] [chain %d] is %d\n", |
347 | (i >= 3 ? "ext" : "ctl"), i % 3, nf[i]); | 346 | (i >= 3 ? "ext" : "ctl"), i % 3, nf[i]); |
348 | 347 | ||
349 | if (nf[i] > ATH9K_NF_TOO_HIGH) { | 348 | if (nf[i] > limit->max) { |
350 | ath_dbg(common, CALIBRATE, | 349 | ath_dbg(common, CALIBRATE, |
351 | "NF[%d] (%d) > MAX (%d), correcting to MAX\n", | 350 | "NF[%d] (%d) > MAX (%d), correcting to MAX\n", |
352 | i, nf[i], ATH9K_NF_TOO_HIGH); | 351 | i, nf[i], limit->max); |
353 | nf[i] = limit->max; | 352 | nf[i] = limit->max; |
354 | } else if (nf[i] < limit->min) { | 353 | } else if (nf[i] < limit->min) { |
355 | ath_dbg(common, CALIBRATE, | 354 | ath_dbg(common, CALIBRATE, |
diff --git a/drivers/net/wireless/ath/ath9k/debug.c b/drivers/net/wireless/ath/ath9k/debug.c index 35d1c8e91d1c..ff47b32ecaf4 100644 --- a/drivers/net/wireless/ath/ath9k/debug.c +++ b/drivers/net/wireless/ath/ath9k/debug.c | |||
@@ -26,11 +26,6 @@ | |||
26 | #define REG_READ_D(_ah, _reg) \ | 26 | #define REG_READ_D(_ah, _reg) \ |
27 | ath9k_hw_common(_ah)->ops->read((_ah), (_reg)) | 27 | ath9k_hw_common(_ah)->ops->read((_ah), (_reg)) |
28 | 28 | ||
29 | static int ath9k_debugfs_open(struct inode *inode, struct file *file) | ||
30 | { | ||
31 | file->private_data = inode->i_private; | ||
32 | return 0; | ||
33 | } | ||
34 | 29 | ||
35 | static ssize_t ath9k_debugfs_read_buf(struct file *file, char __user *user_buf, | 30 | static ssize_t ath9k_debugfs_read_buf(struct file *file, char __user *user_buf, |
36 | size_t count, loff_t *ppos) | 31 | size_t count, loff_t *ppos) |
@@ -83,7 +78,7 @@ static ssize_t write_file_debug(struct file *file, const char __user *user_buf, | |||
83 | static const struct file_operations fops_debug = { | 78 | static const struct file_operations fops_debug = { |
84 | .read = read_file_debug, | 79 | .read = read_file_debug, |
85 | .write = write_file_debug, | 80 | .write = write_file_debug, |
86 | .open = ath9k_debugfs_open, | 81 | .open = simple_open, |
87 | .owner = THIS_MODULE, | 82 | .owner = THIS_MODULE, |
88 | .llseek = default_llseek, | 83 | .llseek = default_llseek, |
89 | }; | 84 | }; |
@@ -129,7 +124,7 @@ static ssize_t write_file_tx_chainmask(struct file *file, const char __user *use | |||
129 | static const struct file_operations fops_tx_chainmask = { | 124 | static const struct file_operations fops_tx_chainmask = { |
130 | .read = read_file_tx_chainmask, | 125 | .read = read_file_tx_chainmask, |
131 | .write = write_file_tx_chainmask, | 126 | .write = write_file_tx_chainmask, |
132 | .open = ath9k_debugfs_open, | 127 | .open = simple_open, |
133 | .owner = THIS_MODULE, | 128 | .owner = THIS_MODULE, |
134 | .llseek = default_llseek, | 129 | .llseek = default_llseek, |
135 | }; | 130 | }; |
@@ -172,7 +167,7 @@ static ssize_t write_file_rx_chainmask(struct file *file, const char __user *use | |||
172 | static const struct file_operations fops_rx_chainmask = { | 167 | static const struct file_operations fops_rx_chainmask = { |
173 | .read = read_file_rx_chainmask, | 168 | .read = read_file_rx_chainmask, |
174 | .write = write_file_rx_chainmask, | 169 | .write = write_file_rx_chainmask, |
175 | .open = ath9k_debugfs_open, | 170 | .open = simple_open, |
176 | .owner = THIS_MODULE, | 171 | .owner = THIS_MODULE, |
177 | .llseek = default_llseek, | 172 | .llseek = default_llseek, |
178 | }; | 173 | }; |
@@ -223,7 +218,7 @@ static ssize_t write_file_disable_ani(struct file *file, | |||
223 | static const struct file_operations fops_disable_ani = { | 218 | static const struct file_operations fops_disable_ani = { |
224 | .read = read_file_disable_ani, | 219 | .read = read_file_disable_ani, |
225 | .write = write_file_disable_ani, | 220 | .write = write_file_disable_ani, |
226 | .open = ath9k_debugfs_open, | 221 | .open = simple_open, |
227 | .owner = THIS_MODULE, | 222 | .owner = THIS_MODULE, |
228 | .llseek = default_llseek, | 223 | .llseek = default_llseek, |
229 | }; | 224 | }; |
@@ -324,7 +319,7 @@ static ssize_t read_file_dma(struct file *file, char __user *user_buf, | |||
324 | 319 | ||
325 | static const struct file_operations fops_dma = { | 320 | static const struct file_operations fops_dma = { |
326 | .read = read_file_dma, | 321 | .read = read_file_dma, |
327 | .open = ath9k_debugfs_open, | 322 | .open = simple_open, |
328 | .owner = THIS_MODULE, | 323 | .owner = THIS_MODULE, |
329 | .llseek = default_llseek, | 324 | .llseek = default_llseek, |
330 | }; | 325 | }; |
@@ -446,7 +441,7 @@ static ssize_t read_file_interrupt(struct file *file, char __user *user_buf, | |||
446 | 441 | ||
447 | static const struct file_operations fops_interrupt = { | 442 | static const struct file_operations fops_interrupt = { |
448 | .read = read_file_interrupt, | 443 | .read = read_file_interrupt, |
449 | .open = ath9k_debugfs_open, | 444 | .open = simple_open, |
450 | .owner = THIS_MODULE, | 445 | .owner = THIS_MODULE, |
451 | .llseek = default_llseek, | 446 | .llseek = default_llseek, |
452 | }; | 447 | }; |
@@ -852,28 +847,28 @@ void ath_debug_stat_tx(struct ath_softc *sc, struct ath_buf *bf, | |||
852 | 847 | ||
853 | static const struct file_operations fops_xmit = { | 848 | static const struct file_operations fops_xmit = { |
854 | .read = read_file_xmit, | 849 | .read = read_file_xmit, |
855 | .open = ath9k_debugfs_open, | 850 | .open = simple_open, |
856 | .owner = THIS_MODULE, | 851 | .owner = THIS_MODULE, |
857 | .llseek = default_llseek, | 852 | .llseek = default_llseek, |
858 | }; | 853 | }; |
859 | 854 | ||
860 | static const struct file_operations fops_stations = { | 855 | static const struct file_operations fops_stations = { |
861 | .read = read_file_stations, | 856 | .read = read_file_stations, |
862 | .open = ath9k_debugfs_open, | 857 | .open = simple_open, |
863 | .owner = THIS_MODULE, | 858 | .owner = THIS_MODULE, |
864 | .llseek = default_llseek, | 859 | .llseek = default_llseek, |
865 | }; | 860 | }; |
866 | 861 | ||
867 | static const struct file_operations fops_misc = { | 862 | static const struct file_operations fops_misc = { |
868 | .read = read_file_misc, | 863 | .read = read_file_misc, |
869 | .open = ath9k_debugfs_open, | 864 | .open = simple_open, |
870 | .owner = THIS_MODULE, | 865 | .owner = THIS_MODULE, |
871 | .llseek = default_llseek, | 866 | .llseek = default_llseek, |
872 | }; | 867 | }; |
873 | 868 | ||
874 | static const struct file_operations fops_reset = { | 869 | static const struct file_operations fops_reset = { |
875 | .read = read_file_reset, | 870 | .read = read_file_reset, |
876 | .open = ath9k_debugfs_open, | 871 | .open = simple_open, |
877 | .owner = THIS_MODULE, | 872 | .owner = THIS_MODULE, |
878 | .llseek = default_llseek, | 873 | .llseek = default_llseek, |
879 | }; | 874 | }; |
@@ -1016,7 +1011,7 @@ void ath_debug_stat_rx(struct ath_softc *sc, struct ath_rx_status *rs) | |||
1016 | 1011 | ||
1017 | static const struct file_operations fops_recv = { | 1012 | static const struct file_operations fops_recv = { |
1018 | .read = read_file_recv, | 1013 | .read = read_file_recv, |
1019 | .open = ath9k_debugfs_open, | 1014 | .open = simple_open, |
1020 | .owner = THIS_MODULE, | 1015 | .owner = THIS_MODULE, |
1021 | .llseek = default_llseek, | 1016 | .llseek = default_llseek, |
1022 | }; | 1017 | }; |
@@ -1055,7 +1050,7 @@ static ssize_t write_file_regidx(struct file *file, const char __user *user_buf, | |||
1055 | static const struct file_operations fops_regidx = { | 1050 | static const struct file_operations fops_regidx = { |
1056 | .read = read_file_regidx, | 1051 | .read = read_file_regidx, |
1057 | .write = write_file_regidx, | 1052 | .write = write_file_regidx, |
1058 | .open = ath9k_debugfs_open, | 1053 | .open = simple_open, |
1059 | .owner = THIS_MODULE, | 1054 | .owner = THIS_MODULE, |
1060 | .llseek = default_llseek, | 1055 | .llseek = default_llseek, |
1061 | }; | 1056 | }; |
@@ -1102,7 +1097,7 @@ static ssize_t write_file_regval(struct file *file, const char __user *user_buf, | |||
1102 | static const struct file_operations fops_regval = { | 1097 | static const struct file_operations fops_regval = { |
1103 | .read = read_file_regval, | 1098 | .read = read_file_regval, |
1104 | .write = write_file_regval, | 1099 | .write = write_file_regval, |
1105 | .open = ath9k_debugfs_open, | 1100 | .open = simple_open, |
1106 | .owner = THIS_MODULE, | 1101 | .owner = THIS_MODULE, |
1107 | .llseek = default_llseek, | 1102 | .llseek = default_llseek, |
1108 | }; | 1103 | }; |
@@ -1191,7 +1186,7 @@ static ssize_t read_file_dump_nfcal(struct file *file, char __user *user_buf, | |||
1191 | 1186 | ||
1192 | static const struct file_operations fops_dump_nfcal = { | 1187 | static const struct file_operations fops_dump_nfcal = { |
1193 | .read = read_file_dump_nfcal, | 1188 | .read = read_file_dump_nfcal, |
1194 | .open = ath9k_debugfs_open, | 1189 | .open = simple_open, |
1195 | .owner = THIS_MODULE, | 1190 | .owner = THIS_MODULE, |
1196 | .llseek = default_llseek, | 1191 | .llseek = default_llseek, |
1197 | }; | 1192 | }; |
@@ -1219,7 +1214,7 @@ static ssize_t read_file_base_eeprom(struct file *file, char __user *user_buf, | |||
1219 | 1214 | ||
1220 | static const struct file_operations fops_base_eeprom = { | 1215 | static const struct file_operations fops_base_eeprom = { |
1221 | .read = read_file_base_eeprom, | 1216 | .read = read_file_base_eeprom, |
1222 | .open = ath9k_debugfs_open, | 1217 | .open = simple_open, |
1223 | .owner = THIS_MODULE, | 1218 | .owner = THIS_MODULE, |
1224 | .llseek = default_llseek, | 1219 | .llseek = default_llseek, |
1225 | }; | 1220 | }; |
@@ -1247,7 +1242,7 @@ static ssize_t read_file_modal_eeprom(struct file *file, char __user *user_buf, | |||
1247 | 1242 | ||
1248 | static const struct file_operations fops_modal_eeprom = { | 1243 | static const struct file_operations fops_modal_eeprom = { |
1249 | .read = read_file_modal_eeprom, | 1244 | .read = read_file_modal_eeprom, |
1250 | .open = ath9k_debugfs_open, | 1245 | .open = simple_open, |
1251 | .owner = THIS_MODULE, | 1246 | .owner = THIS_MODULE, |
1252 | .llseek = default_llseek, | 1247 | .llseek = default_llseek, |
1253 | }; | 1248 | }; |
diff --git a/drivers/net/wireless/ath/ath9k/dfs_debug.c b/drivers/net/wireless/ath/ath9k/dfs_debug.c index 106d031d834a..4364c103ed33 100644 --- a/drivers/net/wireless/ath/ath9k/dfs_debug.c +++ b/drivers/net/wireless/ath/ath9k/dfs_debug.c | |||
@@ -60,16 +60,9 @@ static ssize_t read_file_dfs(struct file *file, char __user *user_buf, | |||
60 | return retval; | 60 | return retval; |
61 | } | 61 | } |
62 | 62 | ||
63 | static int ath9k_dfs_debugfs_open(struct inode *inode, struct file *file) | ||
64 | { | ||
65 | file->private_data = inode->i_private; | ||
66 | |||
67 | return 0; | ||
68 | } | ||
69 | |||
70 | static const struct file_operations fops_dfs_stats = { | 63 | static const struct file_operations fops_dfs_stats = { |
71 | .read = read_file_dfs, | 64 | .read = read_file_dfs, |
72 | .open = ath9k_dfs_debugfs_open, | 65 | .open = simple_open, |
73 | .owner = THIS_MODULE, | 66 | .owner = THIS_MODULE, |
74 | .llseek = default_llseek, | 67 | .llseek = default_llseek, |
75 | }; | 68 | }; |
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_debug.c b/drivers/net/wireless/ath/ath9k/htc_drv_debug.c index d3ff33c71aa5..3035deb7a0cd 100644 --- a/drivers/net/wireless/ath/ath9k/htc_drv_debug.c +++ b/drivers/net/wireless/ath/ath9k/htc_drv_debug.c | |||
@@ -16,12 +16,6 @@ | |||
16 | 16 | ||
17 | #include "htc.h" | 17 | #include "htc.h" |
18 | 18 | ||
19 | static int ath9k_debugfs_open(struct inode *inode, struct file *file) | ||
20 | { | ||
21 | file->private_data = inode->i_private; | ||
22 | return 0; | ||
23 | } | ||
24 | |||
25 | static ssize_t read_file_tgt_int_stats(struct file *file, char __user *user_buf, | 19 | static ssize_t read_file_tgt_int_stats(struct file *file, char __user *user_buf, |
26 | size_t count, loff_t *ppos) | 20 | size_t count, loff_t *ppos) |
27 | { | 21 | { |
@@ -75,7 +69,7 @@ static ssize_t read_file_tgt_int_stats(struct file *file, char __user *user_buf, | |||
75 | 69 | ||
76 | static const struct file_operations fops_tgt_int_stats = { | 70 | static const struct file_operations fops_tgt_int_stats = { |
77 | .read = read_file_tgt_int_stats, | 71 | .read = read_file_tgt_int_stats, |
78 | .open = ath9k_debugfs_open, | 72 | .open = simple_open, |
79 | .owner = THIS_MODULE, | 73 | .owner = THIS_MODULE, |
80 | .llseek = default_llseek, | 74 | .llseek = default_llseek, |
81 | }; | 75 | }; |
@@ -145,7 +139,7 @@ static ssize_t read_file_tgt_tx_stats(struct file *file, char __user *user_buf, | |||
145 | 139 | ||
146 | static const struct file_operations fops_tgt_tx_stats = { | 140 | static const struct file_operations fops_tgt_tx_stats = { |
147 | .read = read_file_tgt_tx_stats, | 141 | .read = read_file_tgt_tx_stats, |
148 | .open = ath9k_debugfs_open, | 142 | .open = simple_open, |
149 | .owner = THIS_MODULE, | 143 | .owner = THIS_MODULE, |
150 | .llseek = default_llseek, | 144 | .llseek = default_llseek, |
151 | }; | 145 | }; |
@@ -191,7 +185,7 @@ static ssize_t read_file_tgt_rx_stats(struct file *file, char __user *user_buf, | |||
191 | 185 | ||
192 | static const struct file_operations fops_tgt_rx_stats = { | 186 | static const struct file_operations fops_tgt_rx_stats = { |
193 | .read = read_file_tgt_rx_stats, | 187 | .read = read_file_tgt_rx_stats, |
194 | .open = ath9k_debugfs_open, | 188 | .open = simple_open, |
195 | .owner = THIS_MODULE, | 189 | .owner = THIS_MODULE, |
196 | .llseek = default_llseek, | 190 | .llseek = default_llseek, |
197 | }; | 191 | }; |
@@ -243,7 +237,7 @@ static ssize_t read_file_xmit(struct file *file, char __user *user_buf, | |||
243 | 237 | ||
244 | static const struct file_operations fops_xmit = { | 238 | static const struct file_operations fops_xmit = { |
245 | .read = read_file_xmit, | 239 | .read = read_file_xmit, |
246 | .open = ath9k_debugfs_open, | 240 | .open = simple_open, |
247 | .owner = THIS_MODULE, | 241 | .owner = THIS_MODULE, |
248 | .llseek = default_llseek, | 242 | .llseek = default_llseek, |
249 | }; | 243 | }; |
@@ -364,7 +358,7 @@ static ssize_t read_file_recv(struct file *file, char __user *user_buf, | |||
364 | 358 | ||
365 | static const struct file_operations fops_recv = { | 359 | static const struct file_operations fops_recv = { |
366 | .read = read_file_recv, | 360 | .read = read_file_recv, |
367 | .open = ath9k_debugfs_open, | 361 | .open = simple_open, |
368 | .owner = THIS_MODULE, | 362 | .owner = THIS_MODULE, |
369 | .llseek = default_llseek, | 363 | .llseek = default_llseek, |
370 | }; | 364 | }; |
@@ -399,7 +393,7 @@ static ssize_t read_file_slot(struct file *file, char __user *user_buf, | |||
399 | 393 | ||
400 | static const struct file_operations fops_slot = { | 394 | static const struct file_operations fops_slot = { |
401 | .read = read_file_slot, | 395 | .read = read_file_slot, |
402 | .open = ath9k_debugfs_open, | 396 | .open = simple_open, |
403 | .owner = THIS_MODULE, | 397 | .owner = THIS_MODULE, |
404 | .llseek = default_llseek, | 398 | .llseek = default_llseek, |
405 | }; | 399 | }; |
@@ -446,7 +440,7 @@ static ssize_t read_file_queue(struct file *file, char __user *user_buf, | |||
446 | 440 | ||
447 | static const struct file_operations fops_queue = { | 441 | static const struct file_operations fops_queue = { |
448 | .read = read_file_queue, | 442 | .read = read_file_queue, |
449 | .open = ath9k_debugfs_open, | 443 | .open = simple_open, |
450 | .owner = THIS_MODULE, | 444 | .owner = THIS_MODULE, |
451 | .llseek = default_llseek, | 445 | .llseek = default_llseek, |
452 | }; | 446 | }; |
@@ -487,7 +481,7 @@ static ssize_t write_file_debug(struct file *file, const char __user *user_buf, | |||
487 | static const struct file_operations fops_debug = { | 481 | static const struct file_operations fops_debug = { |
488 | .read = read_file_debug, | 482 | .read = read_file_debug, |
489 | .write = write_file_debug, | 483 | .write = write_file_debug, |
490 | .open = ath9k_debugfs_open, | 484 | .open = simple_open, |
491 | .owner = THIS_MODULE, | 485 | .owner = THIS_MODULE, |
492 | .llseek = default_llseek, | 486 | .llseek = default_llseek, |
493 | }; | 487 | }; |
@@ -636,7 +630,7 @@ static ssize_t read_file_base_eeprom(struct file *file, char __user *user_buf, | |||
636 | 630 | ||
637 | static const struct file_operations fops_base_eeprom = { | 631 | static const struct file_operations fops_base_eeprom = { |
638 | .read = read_file_base_eeprom, | 632 | .read = read_file_base_eeprom, |
639 | .open = ath9k_debugfs_open, | 633 | .open = simple_open, |
640 | .owner = THIS_MODULE, | 634 | .owner = THIS_MODULE, |
641 | .llseek = default_llseek, | 635 | .llseek = default_llseek, |
642 | }; | 636 | }; |
@@ -917,7 +911,7 @@ static ssize_t read_file_modal_eeprom(struct file *file, char __user *user_buf, | |||
917 | 911 | ||
918 | static const struct file_operations fops_modal_eeprom = { | 912 | static const struct file_operations fops_modal_eeprom = { |
919 | .read = read_file_modal_eeprom, | 913 | .read = read_file_modal_eeprom, |
920 | .open = ath9k_debugfs_open, | 914 | .open = simple_open, |
921 | .owner = THIS_MODULE, | 915 | .owner = THIS_MODULE, |
922 | .llseek = default_llseek, | 916 | .llseek = default_llseek, |
923 | }; | 917 | }; |
diff --git a/drivers/net/wireless/ath/ath9k/init.c b/drivers/net/wireless/ath/ath9k/init.c index 60159f4ee532..cb006458fc4b 100644 --- a/drivers/net/wireless/ath/ath9k/init.c +++ b/drivers/net/wireless/ath/ath9k/init.c | |||
@@ -680,7 +680,7 @@ void ath9k_set_hw_capab(struct ath_softc *sc, struct ieee80211_hw *hw) | |||
680 | hw->queues = 4; | 680 | hw->queues = 4; |
681 | hw->max_rates = 4; | 681 | hw->max_rates = 4; |
682 | hw->channel_change_time = 5000; | 682 | hw->channel_change_time = 5000; |
683 | hw->max_listen_interval = 10; | 683 | hw->max_listen_interval = 1; |
684 | hw->max_rate_tries = 10; | 684 | hw->max_rate_tries = 10; |
685 | hw->sta_data_size = sizeof(struct ath_node); | 685 | hw->sta_data_size = sizeof(struct ath_node); |
686 | hw->vif_data_size = sizeof(struct ath_vif); | 686 | hw->vif_data_size = sizeof(struct ath_vif); |
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c index 38794850f005..215eb2536b1e 100644 --- a/drivers/net/wireless/ath/ath9k/main.c +++ b/drivers/net/wireless/ath/ath9k/main.c | |||
@@ -640,7 +640,7 @@ static void ath_node_attach(struct ath_softc *sc, struct ieee80211_sta *sta, | |||
640 | an->sta = sta; | 640 | an->sta = sta; |
641 | an->vif = vif; | 641 | an->vif = vif; |
642 | 642 | ||
643 | if (sta->ht_cap.ht_supported) { | 643 | if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_HT) { |
644 | ath_tx_node_init(sc, an); | 644 | ath_tx_node_init(sc, an); |
645 | an->maxampdu = 1 << (IEEE80211_HT_MAX_AMPDU_FACTOR + | 645 | an->maxampdu = 1 << (IEEE80211_HT_MAX_AMPDU_FACTOR + |
646 | sta->ht_cap.ampdu_factor); | 646 | sta->ht_cap.ampdu_factor); |
@@ -659,7 +659,7 @@ static void ath_node_detach(struct ath_softc *sc, struct ieee80211_sta *sta) | |||
659 | an->sta = NULL; | 659 | an->sta = NULL; |
660 | #endif | 660 | #endif |
661 | 661 | ||
662 | if (sta->ht_cap.ht_supported) | 662 | if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_HT) |
663 | ath_tx_node_cleanup(sc, an); | 663 | ath_tx_node_cleanup(sc, an); |
664 | } | 664 | } |
665 | 665 | ||
diff --git a/drivers/net/wireless/ath/ath9k/rc.c b/drivers/net/wireless/ath/ath9k/rc.c index 4f848493fece..08bb45532701 100644 --- a/drivers/net/wireless/ath/ath9k/rc.c +++ b/drivers/net/wireless/ath/ath9k/rc.c | |||
@@ -1480,12 +1480,6 @@ static void ath_rate_update(void *priv, struct ieee80211_supported_band *sband, | |||
1480 | 1480 | ||
1481 | #ifdef CONFIG_ATH9K_DEBUGFS | 1481 | #ifdef CONFIG_ATH9K_DEBUGFS |
1482 | 1482 | ||
1483 | static int ath9k_debugfs_open(struct inode *inode, struct file *file) | ||
1484 | { | ||
1485 | file->private_data = inode->i_private; | ||
1486 | return 0; | ||
1487 | } | ||
1488 | |||
1489 | static ssize_t read_file_rcstat(struct file *file, char __user *user_buf, | 1483 | static ssize_t read_file_rcstat(struct file *file, char __user *user_buf, |
1490 | size_t count, loff_t *ppos) | 1484 | size_t count, loff_t *ppos) |
1491 | { | 1485 | { |
@@ -1553,7 +1547,7 @@ static ssize_t read_file_rcstat(struct file *file, char __user *user_buf, | |||
1553 | 1547 | ||
1554 | static const struct file_operations fops_rcstat = { | 1548 | static const struct file_operations fops_rcstat = { |
1555 | .read = read_file_rcstat, | 1549 | .read = read_file_rcstat, |
1556 | .open = ath9k_debugfs_open, | 1550 | .open = simple_open, |
1557 | .owner = THIS_MODULE | 1551 | .owner = THIS_MODULE |
1558 | }; | 1552 | }; |
1559 | 1553 | ||
diff --git a/drivers/net/wireless/ath/ath9k/recv.c b/drivers/net/wireless/ath/ath9k/recv.c index f4ae3ba994a8..1c4583c7ff7c 100644 --- a/drivers/net/wireless/ath/ath9k/recv.c +++ b/drivers/net/wireless/ath/ath9k/recv.c | |||
@@ -1913,13 +1913,13 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush, bool hp) | |||
1913 | if (sc->rx.frag) { | 1913 | if (sc->rx.frag) { |
1914 | int space = skb->len - skb_tailroom(hdr_skb); | 1914 | int space = skb->len - skb_tailroom(hdr_skb); |
1915 | 1915 | ||
1916 | sc->rx.frag = NULL; | ||
1917 | |||
1918 | if (pskb_expand_head(hdr_skb, 0, space, GFP_ATOMIC) < 0) { | 1916 | if (pskb_expand_head(hdr_skb, 0, space, GFP_ATOMIC) < 0) { |
1919 | dev_kfree_skb(skb); | 1917 | dev_kfree_skb(skb); |
1920 | goto requeue_drop_frag; | 1918 | goto requeue_drop_frag; |
1921 | } | 1919 | } |
1922 | 1920 | ||
1921 | sc->rx.frag = NULL; | ||
1922 | |||
1923 | skb_copy_from_linear_data(skb, skb_put(hdr_skb, skb->len), | 1923 | skb_copy_from_linear_data(skb, skb_put(hdr_skb, skb->len), |
1924 | skb->len); | 1924 | skb->len); |
1925 | dev_kfree_skb_any(skb); | 1925 | dev_kfree_skb_any(skb); |
diff --git a/drivers/net/wireless/ath/carl9170/debug.c b/drivers/net/wireless/ath/carl9170/debug.c index 3c164226687f..93fe6003a493 100644 --- a/drivers/net/wireless/ath/carl9170/debug.c +++ b/drivers/net/wireless/ath/carl9170/debug.c | |||
@@ -48,11 +48,6 @@ | |||
48 | #define ADD(buf, off, max, fmt, args...) \ | 48 | #define ADD(buf, off, max, fmt, args...) \ |
49 | off += snprintf(&buf[off], max - off, fmt, ##args); | 49 | off += snprintf(&buf[off], max - off, fmt, ##args); |
50 | 50 | ||
51 | static int carl9170_debugfs_open(struct inode *inode, struct file *file) | ||
52 | { | ||
53 | file->private_data = inode->i_private; | ||
54 | return 0; | ||
55 | } | ||
56 | 51 | ||
57 | struct carl9170_debugfs_fops { | 52 | struct carl9170_debugfs_fops { |
58 | unsigned int read_bufsize; | 53 | unsigned int read_bufsize; |
@@ -178,7 +173,7 @@ static const struct carl9170_debugfs_fops carl_debugfs_##name ##_ops = {\ | |||
178 | .attr = _attr, \ | 173 | .attr = _attr, \ |
179 | .req_dev_state = _dstate, \ | 174 | .req_dev_state = _dstate, \ |
180 | .fops = { \ | 175 | .fops = { \ |
181 | .open = carl9170_debugfs_open, \ | 176 | .open = simple_open, \ |
182 | .read = carl9170_debugfs_read, \ | 177 | .read = carl9170_debugfs_read, \ |
183 | .write = carl9170_debugfs_write, \ | 178 | .write = carl9170_debugfs_write, \ |
184 | .owner = THIS_MODULE \ | 179 | .owner = THIS_MODULE \ |
diff --git a/drivers/net/wireless/b43/debugfs.c b/drivers/net/wireless/b43/debugfs.c index e751fdee89b2..e807bd930647 100644 --- a/drivers/net/wireless/b43/debugfs.c +++ b/drivers/net/wireless/b43/debugfs.c | |||
@@ -500,12 +500,6 @@ out: | |||
500 | 500 | ||
501 | #undef fappend | 501 | #undef fappend |
502 | 502 | ||
503 | static int b43_debugfs_open(struct inode *inode, struct file *file) | ||
504 | { | ||
505 | file->private_data = inode->i_private; | ||
506 | return 0; | ||
507 | } | ||
508 | |||
509 | static ssize_t b43_debugfs_read(struct file *file, char __user *userbuf, | 503 | static ssize_t b43_debugfs_read(struct file *file, char __user *userbuf, |
510 | size_t count, loff_t *ppos) | 504 | size_t count, loff_t *ppos) |
511 | { | 505 | { |
@@ -624,7 +618,7 @@ out_unlock: | |||
624 | .read = _read, \ | 618 | .read = _read, \ |
625 | .write = _write, \ | 619 | .write = _write, \ |
626 | .fops = { \ | 620 | .fops = { \ |
627 | .open = b43_debugfs_open, \ | 621 | .open = simple_open, \ |
628 | .read = b43_debugfs_read, \ | 622 | .read = b43_debugfs_read, \ |
629 | .write = b43_debugfs_write, \ | 623 | .write = b43_debugfs_write, \ |
630 | .llseek = generic_file_llseek, \ | 624 | .llseek = generic_file_llseek, \ |
diff --git a/drivers/net/wireless/b43legacy/debugfs.c b/drivers/net/wireless/b43legacy/debugfs.c index 5e28ad0d6d17..1965edb765a2 100644 --- a/drivers/net/wireless/b43legacy/debugfs.c +++ b/drivers/net/wireless/b43legacy/debugfs.c | |||
@@ -197,12 +197,6 @@ static int restart_write_file(struct b43legacy_wldev *dev, const char *buf, size | |||
197 | 197 | ||
198 | #undef fappend | 198 | #undef fappend |
199 | 199 | ||
200 | static int b43legacy_debugfs_open(struct inode *inode, struct file *file) | ||
201 | { | ||
202 | file->private_data = inode->i_private; | ||
203 | return 0; | ||
204 | } | ||
205 | |||
206 | static ssize_t b43legacy_debugfs_read(struct file *file, char __user *userbuf, | 200 | static ssize_t b43legacy_debugfs_read(struct file *file, char __user *userbuf, |
207 | size_t count, loff_t *ppos) | 201 | size_t count, loff_t *ppos) |
208 | { | 202 | { |
@@ -331,7 +325,7 @@ out_unlock: | |||
331 | .read = _read, \ | 325 | .read = _read, \ |
332 | .write = _write, \ | 326 | .write = _write, \ |
333 | .fops = { \ | 327 | .fops = { \ |
334 | .open = b43legacy_debugfs_open, \ | 328 | .open = simple_open, \ |
335 | .read = b43legacy_debugfs_read, \ | 329 | .read = b43legacy_debugfs_read, \ |
336 | .write = b43legacy_debugfs_write, \ | 330 | .write = b43legacy_debugfs_write, \ |
337 | .llseek = generic_file_llseek, \ | 331 | .llseek = generic_file_llseek, \ |
diff --git a/drivers/net/wireless/ipw2x00/ipw2200.c b/drivers/net/wireless/ipw2x00/ipw2200.c index 4fcdac63a300..2b022571a859 100644 --- a/drivers/net/wireless/ipw2x00/ipw2200.c +++ b/drivers/net/wireless/ipw2x00/ipw2200.c | |||
@@ -11507,9 +11507,9 @@ static int ipw_wdev_init(struct net_device *dev) | |||
11507 | rc = -ENOMEM; | 11507 | rc = -ENOMEM; |
11508 | goto out; | 11508 | goto out; |
11509 | } | 11509 | } |
11510 | /* translate geo->bg to a_band.channels */ | 11510 | /* translate geo->a to a_band.channels */ |
11511 | for (i = 0; i < geo->a_channels; i++) { | 11511 | for (i = 0; i < geo->a_channels; i++) { |
11512 | a_band->channels[i].band = IEEE80211_BAND_2GHZ; | 11512 | a_band->channels[i].band = IEEE80211_BAND_5GHZ; |
11513 | a_band->channels[i].center_freq = geo->a[i].freq; | 11513 | a_band->channels[i].center_freq = geo->a[i].freq; |
11514 | a_band->channels[i].hw_value = geo->a[i].channel; | 11514 | a_band->channels[i].hw_value = geo->a[i].channel; |
11515 | a_band->channels[i].max_power = geo->a[i].max_power; | 11515 | a_band->channels[i].max_power = geo->a[i].max_power; |
diff --git a/drivers/net/wireless/iwlegacy/3945-mac.c b/drivers/net/wireless/iwlegacy/3945-mac.c index 0c1209390169..faec40467208 100644 --- a/drivers/net/wireless/iwlegacy/3945-mac.c +++ b/drivers/net/wireless/iwlegacy/3945-mac.c | |||
@@ -2673,8 +2673,6 @@ il3945_bg_restart(struct work_struct *data) | |||
2673 | 2673 | ||
2674 | if (test_and_clear_bit(S_FW_ERROR, &il->status)) { | 2674 | if (test_and_clear_bit(S_FW_ERROR, &il->status)) { |
2675 | mutex_lock(&il->mutex); | 2675 | mutex_lock(&il->mutex); |
2676 | /* FIXME: vif can be dereferenced */ | ||
2677 | il->vif = NULL; | ||
2678 | il->is_open = 0; | 2676 | il->is_open = 0; |
2679 | mutex_unlock(&il->mutex); | 2677 | mutex_unlock(&il->mutex); |
2680 | il3945_down(il); | 2678 | il3945_down(il); |
diff --git a/drivers/net/wireless/iwlegacy/3945-rs.c b/drivers/net/wireless/iwlegacy/3945-rs.c index 70bee1a4d876..4b10157d8686 100644 --- a/drivers/net/wireless/iwlegacy/3945-rs.c +++ b/drivers/net/wireless/iwlegacy/3945-rs.c | |||
@@ -821,12 +821,6 @@ out: | |||
821 | } | 821 | } |
822 | 822 | ||
823 | #ifdef CONFIG_MAC80211_DEBUGFS | 823 | #ifdef CONFIG_MAC80211_DEBUGFS |
824 | static int | ||
825 | il3945_open_file_generic(struct inode *inode, struct file *file) | ||
826 | { | ||
827 | file->private_data = inode->i_private; | ||
828 | return 0; | ||
829 | } | ||
830 | 824 | ||
831 | static ssize_t | 825 | static ssize_t |
832 | il3945_sta_dbgfs_stats_table_read(struct file *file, char __user *user_buf, | 826 | il3945_sta_dbgfs_stats_table_read(struct file *file, char __user *user_buf, |
@@ -862,7 +856,7 @@ il3945_sta_dbgfs_stats_table_read(struct file *file, char __user *user_buf, | |||
862 | 856 | ||
863 | static const struct file_operations rs_sta_dbgfs_stats_table_ops = { | 857 | static const struct file_operations rs_sta_dbgfs_stats_table_ops = { |
864 | .read = il3945_sta_dbgfs_stats_table_read, | 858 | .read = il3945_sta_dbgfs_stats_table_read, |
865 | .open = il3945_open_file_generic, | 859 | .open = simple_open, |
866 | .llseek = default_llseek, | 860 | .llseek = default_llseek, |
867 | }; | 861 | }; |
868 | 862 | ||
diff --git a/drivers/net/wireless/iwlegacy/4965-mac.c b/drivers/net/wireless/iwlegacy/4965-mac.c index 17f1c6853182..c46275a92565 100644 --- a/drivers/net/wireless/iwlegacy/4965-mac.c +++ b/drivers/net/wireless/iwlegacy/4965-mac.c | |||
@@ -5652,8 +5652,6 @@ il4965_bg_restart(struct work_struct *data) | |||
5652 | 5652 | ||
5653 | if (test_and_clear_bit(S_FW_ERROR, &il->status)) { | 5653 | if (test_and_clear_bit(S_FW_ERROR, &il->status)) { |
5654 | mutex_lock(&il->mutex); | 5654 | mutex_lock(&il->mutex); |
5655 | /* FIXME: do we dereference vif without mutex locked ? */ | ||
5656 | il->vif = NULL; | ||
5657 | il->is_open = 0; | 5655 | il->is_open = 0; |
5658 | 5656 | ||
5659 | __il4965_down(il); | 5657 | __il4965_down(il); |
diff --git a/drivers/net/wireless/iwlegacy/4965-rs.c b/drivers/net/wireless/iwlegacy/4965-rs.c index d7e2856e41d3..11ab1247fae1 100644 --- a/drivers/net/wireless/iwlegacy/4965-rs.c +++ b/drivers/net/wireless/iwlegacy/4965-rs.c | |||
@@ -2518,12 +2518,6 @@ il4965_rs_free_sta(void *il_r, struct ieee80211_sta *sta, void *il_sta) | |||
2518 | } | 2518 | } |
2519 | 2519 | ||
2520 | #ifdef CONFIG_MAC80211_DEBUGFS | 2520 | #ifdef CONFIG_MAC80211_DEBUGFS |
2521 | static int | ||
2522 | il4965_open_file_generic(struct inode *inode, struct file *file) | ||
2523 | { | ||
2524 | file->private_data = inode->i_private; | ||
2525 | return 0; | ||
2526 | } | ||
2527 | 2521 | ||
2528 | static void | 2522 | static void |
2529 | il4965_rs_dbgfs_set_mcs(struct il_lq_sta *lq_sta, u32 * rate_n_flags, int idx) | 2523 | il4965_rs_dbgfs_set_mcs(struct il_lq_sta *lq_sta, u32 * rate_n_flags, int idx) |
@@ -2695,7 +2689,7 @@ il4965_rs_sta_dbgfs_scale_table_read(struct file *file, char __user *user_buf, | |||
2695 | static const struct file_operations rs_sta_dbgfs_scale_table_ops = { | 2689 | static const struct file_operations rs_sta_dbgfs_scale_table_ops = { |
2696 | .write = il4965_rs_sta_dbgfs_scale_table_write, | 2690 | .write = il4965_rs_sta_dbgfs_scale_table_write, |
2697 | .read = il4965_rs_sta_dbgfs_scale_table_read, | 2691 | .read = il4965_rs_sta_dbgfs_scale_table_read, |
2698 | .open = il4965_open_file_generic, | 2692 | .open = simple_open, |
2699 | .llseek = default_llseek, | 2693 | .llseek = default_llseek, |
2700 | }; | 2694 | }; |
2701 | 2695 | ||
@@ -2740,7 +2734,7 @@ il4965_rs_sta_dbgfs_stats_table_read(struct file *file, char __user *user_buf, | |||
2740 | 2734 | ||
2741 | static const struct file_operations rs_sta_dbgfs_stats_table_ops = { | 2735 | static const struct file_operations rs_sta_dbgfs_stats_table_ops = { |
2742 | .read = il4965_rs_sta_dbgfs_stats_table_read, | 2736 | .read = il4965_rs_sta_dbgfs_stats_table_read, |
2743 | .open = il4965_open_file_generic, | 2737 | .open = simple_open, |
2744 | .llseek = default_llseek, | 2738 | .llseek = default_llseek, |
2745 | }; | 2739 | }; |
2746 | 2740 | ||
@@ -2768,7 +2762,7 @@ il4965_rs_sta_dbgfs_rate_scale_data_read(struct file *file, | |||
2768 | 2762 | ||
2769 | static const struct file_operations rs_sta_dbgfs_rate_scale_data_ops = { | 2763 | static const struct file_operations rs_sta_dbgfs_rate_scale_data_ops = { |
2770 | .read = il4965_rs_sta_dbgfs_rate_scale_data_read, | 2764 | .read = il4965_rs_sta_dbgfs_rate_scale_data_read, |
2771 | .open = il4965_open_file_generic, | 2765 | .open = simple_open, |
2772 | .llseek = default_llseek, | 2766 | .llseek = default_llseek, |
2773 | }; | 2767 | }; |
2774 | 2768 | ||
diff --git a/drivers/net/wireless/iwlegacy/common.c b/drivers/net/wireless/iwlegacy/common.c index e5ac04739bcc..eaf249452e51 100644 --- a/drivers/net/wireless/iwlegacy/common.c +++ b/drivers/net/wireless/iwlegacy/common.c | |||
@@ -4508,6 +4508,7 @@ il_mac_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) | |||
4508 | { | 4508 | { |
4509 | struct il_priv *il = hw->priv; | 4509 | struct il_priv *il = hw->priv; |
4510 | int err; | 4510 | int err; |
4511 | bool reset; | ||
4511 | 4512 | ||
4512 | mutex_lock(&il->mutex); | 4513 | mutex_lock(&il->mutex); |
4513 | D_MAC80211("enter: type %d, addr %pM\n", vif->type, vif->addr); | 4514 | D_MAC80211("enter: type %d, addr %pM\n", vif->type, vif->addr); |
@@ -4518,7 +4519,12 @@ il_mac_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) | |||
4518 | goto out; | 4519 | goto out; |
4519 | } | 4520 | } |
4520 | 4521 | ||
4521 | if (il->vif) { | 4522 | /* |
4523 | * We do not support multiple virtual interfaces, but on hardware reset | ||
4524 | * we have to add the same interface again. | ||
4525 | */ | ||
4526 | reset = (il->vif == vif); | ||
4527 | if (il->vif && !reset) { | ||
4522 | err = -EOPNOTSUPP; | 4528 | err = -EOPNOTSUPP; |
4523 | goto out; | 4529 | goto out; |
4524 | } | 4530 | } |
@@ -4528,8 +4534,11 @@ il_mac_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) | |||
4528 | 4534 | ||
4529 | err = il_set_mode(il); | 4535 | err = il_set_mode(il); |
4530 | if (err) { | 4536 | if (err) { |
4531 | il->vif = NULL; | 4537 | IL_WARN("Fail to set mode %d\n", vif->type); |
4532 | il->iw_mode = NL80211_IFTYPE_STATION; | 4538 | if (!reset) { |
4539 | il->vif = NULL; | ||
4540 | il->iw_mode = NL80211_IFTYPE_STATION; | ||
4541 | } | ||
4533 | } | 4542 | } |
4534 | 4543 | ||
4535 | out: | 4544 | out: |
@@ -5279,9 +5288,9 @@ il_mac_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif, | |||
5279 | D_MAC80211("BSSID %pM\n", bss_conf->bssid); | 5288 | D_MAC80211("BSSID %pM\n", bss_conf->bssid); |
5280 | 5289 | ||
5281 | /* | 5290 | /* |
5282 | * If there is currently a HW scan going on in the | 5291 | * If there is currently a HW scan going on in the background, |
5283 | * background then we need to cancel it else the RXON | 5292 | * then we need to cancel it, otherwise sometimes we are not |
5284 | * below/in post_associate will fail. | 5293 | * able to authenticate (FIXME: why ?) |
5285 | */ | 5294 | */ |
5286 | if (il_scan_cancel_timeout(il, 100)) { | 5295 | if (il_scan_cancel_timeout(il, 100)) { |
5287 | D_MAC80211("leave - scan abort failed\n"); | 5296 | D_MAC80211("leave - scan abort failed\n"); |
@@ -5290,14 +5299,10 @@ il_mac_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif, | |||
5290 | } | 5299 | } |
5291 | 5300 | ||
5292 | /* mac80211 only sets assoc when in STATION mode */ | 5301 | /* mac80211 only sets assoc when in STATION mode */ |
5293 | if (vif->type == NL80211_IFTYPE_ADHOC || bss_conf->assoc) { | 5302 | memcpy(il->staging.bssid_addr, bss_conf->bssid, ETH_ALEN); |
5294 | memcpy(il->staging.bssid_addr, bss_conf->bssid, | ||
5295 | ETH_ALEN); | ||
5296 | 5303 | ||
5297 | /* currently needed in a few places */ | 5304 | /* FIXME: currently needed in a few places */ |
5298 | memcpy(il->bssid, bss_conf->bssid, ETH_ALEN); | 5305 | memcpy(il->bssid, bss_conf->bssid, ETH_ALEN); |
5299 | } else | ||
5300 | il->staging.filter_flags &= ~RXON_FILTER_ASSOC_MSK; | ||
5301 | } | 5306 | } |
5302 | 5307 | ||
5303 | /* | 5308 | /* |
diff --git a/drivers/net/wireless/iwlegacy/debug.c b/drivers/net/wireless/iwlegacy/debug.c index 229849150aac..eff26501d60a 100644 --- a/drivers/net/wireless/iwlegacy/debug.c +++ b/drivers/net/wireless/iwlegacy/debug.c | |||
@@ -160,18 +160,12 @@ static ssize_t il_dbgfs_##name##_write(struct file *file, \ | |||
160 | const char __user *user_buf, \ | 160 | const char __user *user_buf, \ |
161 | size_t count, loff_t *ppos); | 161 | size_t count, loff_t *ppos); |
162 | 162 | ||
163 | static int | ||
164 | il_dbgfs_open_file_generic(struct inode *inode, struct file *file) | ||
165 | { | ||
166 | file->private_data = inode->i_private; | ||
167 | return 0; | ||
168 | } | ||
169 | 163 | ||
170 | #define DEBUGFS_READ_FILE_OPS(name) \ | 164 | #define DEBUGFS_READ_FILE_OPS(name) \ |
171 | DEBUGFS_READ_FUNC(name); \ | 165 | DEBUGFS_READ_FUNC(name); \ |
172 | static const struct file_operations il_dbgfs_##name##_ops = { \ | 166 | static const struct file_operations il_dbgfs_##name##_ops = { \ |
173 | .read = il_dbgfs_##name##_read, \ | 167 | .read = il_dbgfs_##name##_read, \ |
174 | .open = il_dbgfs_open_file_generic, \ | 168 | .open = simple_open, \ |
175 | .llseek = generic_file_llseek, \ | 169 | .llseek = generic_file_llseek, \ |
176 | }; | 170 | }; |
177 | 171 | ||
@@ -179,7 +173,7 @@ static const struct file_operations il_dbgfs_##name##_ops = { \ | |||
179 | DEBUGFS_WRITE_FUNC(name); \ | 173 | DEBUGFS_WRITE_FUNC(name); \ |
180 | static const struct file_operations il_dbgfs_##name##_ops = { \ | 174 | static const struct file_operations il_dbgfs_##name##_ops = { \ |
181 | .write = il_dbgfs_##name##_write, \ | 175 | .write = il_dbgfs_##name##_write, \ |
182 | .open = il_dbgfs_open_file_generic, \ | 176 | .open = simple_open, \ |
183 | .llseek = generic_file_llseek, \ | 177 | .llseek = generic_file_llseek, \ |
184 | }; | 178 | }; |
185 | 179 | ||
@@ -189,7 +183,7 @@ static const struct file_operations il_dbgfs_##name##_ops = { \ | |||
189 | static const struct file_operations il_dbgfs_##name##_ops = { \ | 183 | static const struct file_operations il_dbgfs_##name##_ops = { \ |
190 | .write = il_dbgfs_##name##_write, \ | 184 | .write = il_dbgfs_##name##_write, \ |
191 | .read = il_dbgfs_##name##_read, \ | 185 | .read = il_dbgfs_##name##_read, \ |
192 | .open = il_dbgfs_open_file_generic, \ | 186 | .open = simple_open, \ |
193 | .llseek = generic_file_llseek, \ | 187 | .llseek = generic_file_llseek, \ |
194 | }; | 188 | }; |
195 | 189 | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c index 53f8c51cfcdb..7e590b349dd7 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c | |||
@@ -3083,11 +3083,6 @@ static void rs_free_sta(void *priv_r, struct ieee80211_sta *sta, | |||
3083 | } | 3083 | } |
3084 | 3084 | ||
3085 | #ifdef CONFIG_MAC80211_DEBUGFS | 3085 | #ifdef CONFIG_MAC80211_DEBUGFS |
3086 | static int open_file_generic(struct inode *inode, struct file *file) | ||
3087 | { | ||
3088 | file->private_data = inode->i_private; | ||
3089 | return 0; | ||
3090 | } | ||
3091 | static void rs_dbgfs_set_mcs(struct iwl_lq_sta *lq_sta, | 3086 | static void rs_dbgfs_set_mcs(struct iwl_lq_sta *lq_sta, |
3092 | u32 *rate_n_flags, int index) | 3087 | u32 *rate_n_flags, int index) |
3093 | { | 3088 | { |
@@ -3226,7 +3221,7 @@ static ssize_t rs_sta_dbgfs_scale_table_read(struct file *file, | |||
3226 | static const struct file_operations rs_sta_dbgfs_scale_table_ops = { | 3221 | static const struct file_operations rs_sta_dbgfs_scale_table_ops = { |
3227 | .write = rs_sta_dbgfs_scale_table_write, | 3222 | .write = rs_sta_dbgfs_scale_table_write, |
3228 | .read = rs_sta_dbgfs_scale_table_read, | 3223 | .read = rs_sta_dbgfs_scale_table_read, |
3229 | .open = open_file_generic, | 3224 | .open = simple_open, |
3230 | .llseek = default_llseek, | 3225 | .llseek = default_llseek, |
3231 | }; | 3226 | }; |
3232 | static ssize_t rs_sta_dbgfs_stats_table_read(struct file *file, | 3227 | static ssize_t rs_sta_dbgfs_stats_table_read(struct file *file, |
@@ -3269,7 +3264,7 @@ static ssize_t rs_sta_dbgfs_stats_table_read(struct file *file, | |||
3269 | 3264 | ||
3270 | static const struct file_operations rs_sta_dbgfs_stats_table_ops = { | 3265 | static const struct file_operations rs_sta_dbgfs_stats_table_ops = { |
3271 | .read = rs_sta_dbgfs_stats_table_read, | 3266 | .read = rs_sta_dbgfs_stats_table_read, |
3272 | .open = open_file_generic, | 3267 | .open = simple_open, |
3273 | .llseek = default_llseek, | 3268 | .llseek = default_llseek, |
3274 | }; | 3269 | }; |
3275 | 3270 | ||
@@ -3295,7 +3290,7 @@ static ssize_t rs_sta_dbgfs_rate_scale_data_read(struct file *file, | |||
3295 | 3290 | ||
3296 | static const struct file_operations rs_sta_dbgfs_rate_scale_data_ops = { | 3291 | static const struct file_operations rs_sta_dbgfs_rate_scale_data_ops = { |
3297 | .read = rs_sta_dbgfs_rate_scale_data_read, | 3292 | .read = rs_sta_dbgfs_rate_scale_data_read, |
3298 | .open = open_file_generic, | 3293 | .open = simple_open, |
3299 | .llseek = default_llseek, | 3294 | .llseek = default_llseek, |
3300 | }; | 3295 | }; |
3301 | 3296 | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-debugfs.c b/drivers/net/wireless/iwlwifi/iwl-debugfs.c index b7b1c04f2fba..2bbaebd99ad4 100644 --- a/drivers/net/wireless/iwlwifi/iwl-debugfs.c +++ b/drivers/net/wireless/iwlwifi/iwl-debugfs.c | |||
@@ -84,17 +84,11 @@ static ssize_t iwl_dbgfs_##name##_write(struct file *file, \ | |||
84 | size_t count, loff_t *ppos); | 84 | size_t count, loff_t *ppos); |
85 | 85 | ||
86 | 86 | ||
87 | static int iwl_dbgfs_open_file_generic(struct inode *inode, struct file *file) | ||
88 | { | ||
89 | file->private_data = inode->i_private; | ||
90 | return 0; | ||
91 | } | ||
92 | |||
93 | #define DEBUGFS_READ_FILE_OPS(name) \ | 87 | #define DEBUGFS_READ_FILE_OPS(name) \ |
94 | DEBUGFS_READ_FUNC(name); \ | 88 | DEBUGFS_READ_FUNC(name); \ |
95 | static const struct file_operations iwl_dbgfs_##name##_ops = { \ | 89 | static const struct file_operations iwl_dbgfs_##name##_ops = { \ |
96 | .read = iwl_dbgfs_##name##_read, \ | 90 | .read = iwl_dbgfs_##name##_read, \ |
97 | .open = iwl_dbgfs_open_file_generic, \ | 91 | .open = simple_open, \ |
98 | .llseek = generic_file_llseek, \ | 92 | .llseek = generic_file_llseek, \ |
99 | }; | 93 | }; |
100 | 94 | ||
@@ -102,7 +96,7 @@ static const struct file_operations iwl_dbgfs_##name##_ops = { \ | |||
102 | DEBUGFS_WRITE_FUNC(name); \ | 96 | DEBUGFS_WRITE_FUNC(name); \ |
103 | static const struct file_operations iwl_dbgfs_##name##_ops = { \ | 97 | static const struct file_operations iwl_dbgfs_##name##_ops = { \ |
104 | .write = iwl_dbgfs_##name##_write, \ | 98 | .write = iwl_dbgfs_##name##_write, \ |
105 | .open = iwl_dbgfs_open_file_generic, \ | 99 | .open = simple_open, \ |
106 | .llseek = generic_file_llseek, \ | 100 | .llseek = generic_file_llseek, \ |
107 | }; | 101 | }; |
108 | 102 | ||
@@ -113,7 +107,7 @@ static const struct file_operations iwl_dbgfs_##name##_ops = { \ | |||
113 | static const struct file_operations iwl_dbgfs_##name##_ops = { \ | 107 | static const struct file_operations iwl_dbgfs_##name##_ops = { \ |
114 | .write = iwl_dbgfs_##name##_write, \ | 108 | .write = iwl_dbgfs_##name##_write, \ |
115 | .read = iwl_dbgfs_##name##_read, \ | 109 | .read = iwl_dbgfs_##name##_read, \ |
116 | .open = iwl_dbgfs_open_file_generic, \ | 110 | .open = simple_open, \ |
117 | .llseek = generic_file_llseek, \ | 111 | .llseek = generic_file_llseek, \ |
118 | }; | 112 | }; |
119 | 113 | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c b/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c index b4f796c82e1e..4d7b30d3e648 100644 --- a/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c +++ b/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c | |||
@@ -1898,17 +1898,11 @@ static ssize_t iwl_dbgfs_##name##_write(struct file *file, \ | |||
1898 | size_t count, loff_t *ppos); | 1898 | size_t count, loff_t *ppos); |
1899 | 1899 | ||
1900 | 1900 | ||
1901 | static int iwl_dbgfs_open_file_generic(struct inode *inode, struct file *file) | ||
1902 | { | ||
1903 | file->private_data = inode->i_private; | ||
1904 | return 0; | ||
1905 | } | ||
1906 | |||
1907 | #define DEBUGFS_READ_FILE_OPS(name) \ | 1901 | #define DEBUGFS_READ_FILE_OPS(name) \ |
1908 | DEBUGFS_READ_FUNC(name); \ | 1902 | DEBUGFS_READ_FUNC(name); \ |
1909 | static const struct file_operations iwl_dbgfs_##name##_ops = { \ | 1903 | static const struct file_operations iwl_dbgfs_##name##_ops = { \ |
1910 | .read = iwl_dbgfs_##name##_read, \ | 1904 | .read = iwl_dbgfs_##name##_read, \ |
1911 | .open = iwl_dbgfs_open_file_generic, \ | 1905 | .open = simple_open, \ |
1912 | .llseek = generic_file_llseek, \ | 1906 | .llseek = generic_file_llseek, \ |
1913 | }; | 1907 | }; |
1914 | 1908 | ||
@@ -1916,7 +1910,7 @@ static const struct file_operations iwl_dbgfs_##name##_ops = { \ | |||
1916 | DEBUGFS_WRITE_FUNC(name); \ | 1910 | DEBUGFS_WRITE_FUNC(name); \ |
1917 | static const struct file_operations iwl_dbgfs_##name##_ops = { \ | 1911 | static const struct file_operations iwl_dbgfs_##name##_ops = { \ |
1918 | .write = iwl_dbgfs_##name##_write, \ | 1912 | .write = iwl_dbgfs_##name##_write, \ |
1919 | .open = iwl_dbgfs_open_file_generic, \ | 1913 | .open = simple_open, \ |
1920 | .llseek = generic_file_llseek, \ | 1914 | .llseek = generic_file_llseek, \ |
1921 | }; | 1915 | }; |
1922 | 1916 | ||
@@ -1926,7 +1920,7 @@ static const struct file_operations iwl_dbgfs_##name##_ops = { \ | |||
1926 | static const struct file_operations iwl_dbgfs_##name##_ops = { \ | 1920 | static const struct file_operations iwl_dbgfs_##name##_ops = { \ |
1927 | .write = iwl_dbgfs_##name##_write, \ | 1921 | .write = iwl_dbgfs_##name##_write, \ |
1928 | .read = iwl_dbgfs_##name##_read, \ | 1922 | .read = iwl_dbgfs_##name##_read, \ |
1929 | .open = iwl_dbgfs_open_file_generic, \ | 1923 | .open = simple_open, \ |
1930 | .llseek = generic_file_llseek, \ | 1924 | .llseek = generic_file_llseek, \ |
1931 | }; | 1925 | }; |
1932 | 1926 | ||
diff --git a/drivers/net/wireless/iwmc3200wifi/debugfs.c b/drivers/net/wireless/iwmc3200wifi/debugfs.c index 87eef5773a02..b6199d124bb9 100644 --- a/drivers/net/wireless/iwmc3200wifi/debugfs.c +++ b/drivers/net/wireless/iwmc3200wifi/debugfs.c | |||
@@ -99,12 +99,6 @@ DEFINE_SIMPLE_ATTRIBUTE(fops_iwm_dbg_modules, | |||
99 | iwm_debugfs_u32_read, iwm_debugfs_dbg_modules_write, | 99 | iwm_debugfs_u32_read, iwm_debugfs_dbg_modules_write, |
100 | "%llu\n"); | 100 | "%llu\n"); |
101 | 101 | ||
102 | static int iwm_generic_open(struct inode *inode, struct file *filp) | ||
103 | { | ||
104 | filp->private_data = inode->i_private; | ||
105 | return 0; | ||
106 | } | ||
107 | |||
108 | 102 | ||
109 | static ssize_t iwm_debugfs_txq_read(struct file *filp, char __user *buffer, | 103 | static ssize_t iwm_debugfs_txq_read(struct file *filp, char __user *buffer, |
110 | size_t count, loff_t *ppos) | 104 | size_t count, loff_t *ppos) |
@@ -401,28 +395,28 @@ out: | |||
401 | 395 | ||
402 | static const struct file_operations iwm_debugfs_txq_fops = { | 396 | static const struct file_operations iwm_debugfs_txq_fops = { |
403 | .owner = THIS_MODULE, | 397 | .owner = THIS_MODULE, |
404 | .open = iwm_generic_open, | 398 | .open = simple_open, |
405 | .read = iwm_debugfs_txq_read, | 399 | .read = iwm_debugfs_txq_read, |
406 | .llseek = default_llseek, | 400 | .llseek = default_llseek, |
407 | }; | 401 | }; |
408 | 402 | ||
409 | static const struct file_operations iwm_debugfs_tx_credit_fops = { | 403 | static const struct file_operations iwm_debugfs_tx_credit_fops = { |
410 | .owner = THIS_MODULE, | 404 | .owner = THIS_MODULE, |
411 | .open = iwm_generic_open, | 405 | .open = simple_open, |
412 | .read = iwm_debugfs_tx_credit_read, | 406 | .read = iwm_debugfs_tx_credit_read, |
413 | .llseek = default_llseek, | 407 | .llseek = default_llseek, |
414 | }; | 408 | }; |
415 | 409 | ||
416 | static const struct file_operations iwm_debugfs_rx_ticket_fops = { | 410 | static const struct file_operations iwm_debugfs_rx_ticket_fops = { |
417 | .owner = THIS_MODULE, | 411 | .owner = THIS_MODULE, |
418 | .open = iwm_generic_open, | 412 | .open = simple_open, |
419 | .read = iwm_debugfs_rx_ticket_read, | 413 | .read = iwm_debugfs_rx_ticket_read, |
420 | .llseek = default_llseek, | 414 | .llseek = default_llseek, |
421 | }; | 415 | }; |
422 | 416 | ||
423 | static const struct file_operations iwm_debugfs_fw_err_fops = { | 417 | static const struct file_operations iwm_debugfs_fw_err_fops = { |
424 | .owner = THIS_MODULE, | 418 | .owner = THIS_MODULE, |
425 | .open = iwm_generic_open, | 419 | .open = simple_open, |
426 | .read = iwm_debugfs_fw_err_read, | 420 | .read = iwm_debugfs_fw_err_read, |
427 | .llseek = default_llseek, | 421 | .llseek = default_llseek, |
428 | }; | 422 | }; |
diff --git a/drivers/net/wireless/iwmc3200wifi/sdio.c b/drivers/net/wireless/iwmc3200wifi/sdio.c index 764b40dd24ad..0042f204b07f 100644 --- a/drivers/net/wireless/iwmc3200wifi/sdio.c +++ b/drivers/net/wireless/iwmc3200wifi/sdio.c | |||
@@ -264,13 +264,6 @@ static int if_sdio_send_chunk(struct iwm_priv *iwm, u8 *buf, int count) | |||
264 | return ret; | 264 | return ret; |
265 | } | 265 | } |
266 | 266 | ||
267 | /* debugfs hooks */ | ||
268 | static int iwm_debugfs_sdio_open(struct inode *inode, struct file *filp) | ||
269 | { | ||
270 | filp->private_data = inode->i_private; | ||
271 | return 0; | ||
272 | } | ||
273 | |||
274 | static ssize_t iwm_debugfs_sdio_read(struct file *filp, char __user *buffer, | 267 | static ssize_t iwm_debugfs_sdio_read(struct file *filp, char __user *buffer, |
275 | size_t count, loff_t *ppos) | 268 | size_t count, loff_t *ppos) |
276 | { | 269 | { |
@@ -363,7 +356,7 @@ err: | |||
363 | 356 | ||
364 | static const struct file_operations iwm_debugfs_sdio_fops = { | 357 | static const struct file_operations iwm_debugfs_sdio_fops = { |
365 | .owner = THIS_MODULE, | 358 | .owner = THIS_MODULE, |
366 | .open = iwm_debugfs_sdio_open, | 359 | .open = simple_open, |
367 | .read = iwm_debugfs_sdio_read, | 360 | .read = iwm_debugfs_sdio_read, |
368 | .llseek = default_llseek, | 361 | .llseek = default_llseek, |
369 | }; | 362 | }; |
diff --git a/drivers/net/wireless/libertas/debugfs.c b/drivers/net/wireless/libertas/debugfs.c index c192671610fc..a06cc283e23d 100644 --- a/drivers/net/wireless/libertas/debugfs.c +++ b/drivers/net/wireless/libertas/debugfs.c | |||
@@ -21,12 +21,6 @@ static char *szStates[] = { | |||
21 | static void lbs_debug_init(struct lbs_private *priv); | 21 | static void lbs_debug_init(struct lbs_private *priv); |
22 | #endif | 22 | #endif |
23 | 23 | ||
24 | static int open_file_generic(struct inode *inode, struct file *file) | ||
25 | { | ||
26 | file->private_data = inode->i_private; | ||
27 | return 0; | ||
28 | } | ||
29 | |||
30 | static ssize_t write_file_dummy(struct file *file, const char __user *buf, | 24 | static ssize_t write_file_dummy(struct file *file, const char __user *buf, |
31 | size_t count, loff_t *ppos) | 25 | size_t count, loff_t *ppos) |
32 | { | 26 | { |
@@ -696,7 +690,7 @@ out_unlock: | |||
696 | 690 | ||
697 | #define FOPS(fread, fwrite) { \ | 691 | #define FOPS(fread, fwrite) { \ |
698 | .owner = THIS_MODULE, \ | 692 | .owner = THIS_MODULE, \ |
699 | .open = open_file_generic, \ | 693 | .open = simple_open, \ |
700 | .read = (fread), \ | 694 | .read = (fread), \ |
701 | .write = (fwrite), \ | 695 | .write = (fwrite), \ |
702 | .llseek = generic_file_llseek, \ | 696 | .llseek = generic_file_llseek, \ |
@@ -962,7 +956,7 @@ static ssize_t lbs_debugfs_write(struct file *f, const char __user *buf, | |||
962 | 956 | ||
963 | static const struct file_operations lbs_debug_fops = { | 957 | static const struct file_operations lbs_debug_fops = { |
964 | .owner = THIS_MODULE, | 958 | .owner = THIS_MODULE, |
965 | .open = open_file_generic, | 959 | .open = simple_open, |
966 | .write = lbs_debugfs_write, | 960 | .write = lbs_debugfs_write, |
967 | .read = lbs_debugfs_read, | 961 | .read = lbs_debugfs_read, |
968 | .llseek = default_llseek, | 962 | .llseek = default_llseek, |
diff --git a/drivers/net/wireless/mwifiex/debugfs.c b/drivers/net/wireless/mwifiex/debugfs.c index d26a78b6b3c4..1a845074c52a 100644 --- a/drivers/net/wireless/mwifiex/debugfs.c +++ b/drivers/net/wireless/mwifiex/debugfs.c | |||
@@ -140,18 +140,6 @@ static struct mwifiex_debug_data items[] = { | |||
140 | static int num_of_items = ARRAY_SIZE(items); | 140 | static int num_of_items = ARRAY_SIZE(items); |
141 | 141 | ||
142 | /* | 142 | /* |
143 | * Generic proc file open handler. | ||
144 | * | ||
145 | * This function is called every time a file is accessed for read or write. | ||
146 | */ | ||
147 | static int | ||
148 | mwifiex_open_generic(struct inode *inode, struct file *file) | ||
149 | { | ||
150 | file->private_data = inode->i_private; | ||
151 | return 0; | ||
152 | } | ||
153 | |||
154 | /* | ||
155 | * Proc info file read handler. | 143 | * Proc info file read handler. |
156 | * | 144 | * |
157 | * This function is called when the 'info' file is opened for reading. | 145 | * This function is called when the 'info' file is opened for reading. |
@@ -676,19 +664,19 @@ done: | |||
676 | static const struct file_operations mwifiex_dfs_##name##_fops = { \ | 664 | static const struct file_operations mwifiex_dfs_##name##_fops = { \ |
677 | .read = mwifiex_##name##_read, \ | 665 | .read = mwifiex_##name##_read, \ |
678 | .write = mwifiex_##name##_write, \ | 666 | .write = mwifiex_##name##_write, \ |
679 | .open = mwifiex_open_generic, \ | 667 | .open = simple_open, \ |
680 | }; | 668 | }; |
681 | 669 | ||
682 | #define MWIFIEX_DFS_FILE_READ_OPS(name) \ | 670 | #define MWIFIEX_DFS_FILE_READ_OPS(name) \ |
683 | static const struct file_operations mwifiex_dfs_##name##_fops = { \ | 671 | static const struct file_operations mwifiex_dfs_##name##_fops = { \ |
684 | .read = mwifiex_##name##_read, \ | 672 | .read = mwifiex_##name##_read, \ |
685 | .open = mwifiex_open_generic, \ | 673 | .open = simple_open, \ |
686 | }; | 674 | }; |
687 | 675 | ||
688 | #define MWIFIEX_DFS_FILE_WRITE_OPS(name) \ | 676 | #define MWIFIEX_DFS_FILE_WRITE_OPS(name) \ |
689 | static const struct file_operations mwifiex_dfs_##name##_fops = { \ | 677 | static const struct file_operations mwifiex_dfs_##name##_fops = { \ |
690 | .write = mwifiex_##name##_write, \ | 678 | .write = mwifiex_##name##_write, \ |
691 | .open = mwifiex_open_generic, \ | 679 | .open = simple_open, \ |
692 | }; | 680 | }; |
693 | 681 | ||
694 | 682 | ||
diff --git a/drivers/net/wireless/orinoco/main.c b/drivers/net/wireless/orinoco/main.c index dd6c64ac406e..88e3ad2d1db8 100644 --- a/drivers/net/wireless/orinoco/main.c +++ b/drivers/net/wireless/orinoco/main.c | |||
@@ -1336,6 +1336,10 @@ static void qbuf_scan(struct orinoco_private *priv, void *buf, | |||
1336 | unsigned long flags; | 1336 | unsigned long flags; |
1337 | 1337 | ||
1338 | sd = kmalloc(sizeof(*sd), GFP_ATOMIC); | 1338 | sd = kmalloc(sizeof(*sd), GFP_ATOMIC); |
1339 | if (!sd) { | ||
1340 | printk(KERN_ERR "%s: failed to alloc memory\n", __func__); | ||
1341 | return; | ||
1342 | } | ||
1339 | sd->buf = buf; | 1343 | sd->buf = buf; |
1340 | sd->len = len; | 1344 | sd->len = len; |
1341 | sd->type = type; | 1345 | sd->type = type; |
@@ -1353,6 +1357,10 @@ static void qabort_scan(struct orinoco_private *priv) | |||
1353 | unsigned long flags; | 1357 | unsigned long flags; |
1354 | 1358 | ||
1355 | sd = kmalloc(sizeof(*sd), GFP_ATOMIC); | 1359 | sd = kmalloc(sizeof(*sd), GFP_ATOMIC); |
1360 | if (!sd) { | ||
1361 | printk(KERN_ERR "%s: failed to alloc memory\n", __func__); | ||
1362 | return; | ||
1363 | } | ||
1356 | sd->len = -1; /* Abort */ | 1364 | sd->len = -1; /* Abort */ |
1357 | 1365 | ||
1358 | spin_lock_irqsave(&priv->scan_lock, flags); | 1366 | spin_lock_irqsave(&priv->scan_lock, flags); |
diff --git a/drivers/net/wireless/rt2x00/rt2800usb.c b/drivers/net/wireless/rt2x00/rt2800usb.c index cd490abced91..001735f7a661 100644 --- a/drivers/net/wireless/rt2x00/rt2800usb.c +++ b/drivers/net/wireless/rt2x00/rt2800usb.c | |||
@@ -163,7 +163,13 @@ static bool rt2800usb_tx_sta_fifo_read_completed(struct rt2x00_dev *rt2x00dev, | |||
163 | 163 | ||
164 | /* Reschedule urb to read TX status again instantly */ | 164 | /* Reschedule urb to read TX status again instantly */ |
165 | return true; | 165 | return true; |
166 | } else if (rt2800usb_txstatus_pending(rt2x00dev)) { | 166 | } |
167 | |||
168 | /* Check if there is any entry that timedout waiting on TX status */ | ||
169 | if (rt2800usb_txstatus_timeout(rt2x00dev)) | ||
170 | queue_work(rt2x00dev->workqueue, &rt2x00dev->txdone_work); | ||
171 | |||
172 | if (rt2800usb_txstatus_pending(rt2x00dev)) { | ||
167 | /* Read register after 250 us */ | 173 | /* Read register after 250 us */ |
168 | hrtimer_start(&rt2x00dev->txstatus_timer, ktime_set(0, 250000), | 174 | hrtimer_start(&rt2x00dev->txstatus_timer, ktime_set(0, 250000), |
169 | HRTIMER_MODE_REL); | 175 | HRTIMER_MODE_REL); |
@@ -178,7 +184,7 @@ stop_reading: | |||
178 | * here again if status reading is needed. | 184 | * here again if status reading is needed. |
179 | */ | 185 | */ |
180 | if (rt2800usb_txstatus_pending(rt2x00dev) && | 186 | if (rt2800usb_txstatus_pending(rt2x00dev) && |
181 | test_and_set_bit(TX_STATUS_READING, &rt2x00dev->flags)) | 187 | !test_and_set_bit(TX_STATUS_READING, &rt2x00dev->flags)) |
182 | return true; | 188 | return true; |
183 | else | 189 | else |
184 | return false; | 190 | return false; |
diff --git a/drivers/net/wireless/rtlwifi/rtl8192c/phy_common.c b/drivers/net/wireless/rtlwifi/rtl8192c/phy_common.c index 1eec3a06d1f3..4c016241f340 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192c/phy_common.c +++ b/drivers/net/wireless/rtlwifi/rtl8192c/phy_common.c | |||
@@ -1893,7 +1893,7 @@ void rtl92c_phy_set_io(struct ieee80211_hw *hw) | |||
1893 | break; | 1893 | break; |
1894 | case IO_CMD_PAUSE_DM_BY_SCAN: | 1894 | case IO_CMD_PAUSE_DM_BY_SCAN: |
1895 | rtlphy->initgain_backup.xaagccore1 = dm_digtable.cur_igvalue; | 1895 | rtlphy->initgain_backup.xaagccore1 = dm_digtable.cur_igvalue; |
1896 | dm_digtable.cur_igvalue = 0x17; | 1896 | dm_digtable.cur_igvalue = 0x37; |
1897 | rtl92c_dm_write_dig(hw); | 1897 | rtl92c_dm_write_dig(hw); |
1898 | break; | 1898 | break; |
1899 | default: | 1899 | default: |
diff --git a/drivers/net/wireless/rtlwifi/rtl8192de/phy.c b/drivers/net/wireless/rtlwifi/rtl8192de/phy.c index 34591eeb8376..28fc5fb8057b 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192de/phy.c +++ b/drivers/net/wireless/rtlwifi/rtl8192de/phy.c | |||
@@ -3077,7 +3077,7 @@ static void rtl92d_phy_set_io(struct ieee80211_hw *hw) | |||
3077 | break; | 3077 | break; |
3078 | case IO_CMD_PAUSE_DM_BY_SCAN: | 3078 | case IO_CMD_PAUSE_DM_BY_SCAN: |
3079 | rtlphy->initgain_backup.xaagccore1 = de_digtable.cur_igvalue; | 3079 | rtlphy->initgain_backup.xaagccore1 = de_digtable.cur_igvalue; |
3080 | de_digtable.cur_igvalue = 0x17; | 3080 | de_digtable.cur_igvalue = 0x37; |
3081 | rtl92d_dm_write_dig(hw); | 3081 | rtl92d_dm_write_dig(hw); |
3082 | break; | 3082 | break; |
3083 | default: | 3083 | default: |
diff --git a/drivers/net/wireless/wl1251/debugfs.c b/drivers/net/wireless/wl1251/debugfs.c index 6c274007d200..448da1f8c22f 100644 --- a/drivers/net/wireless/wl1251/debugfs.c +++ b/drivers/net/wireless/wl1251/debugfs.c | |||
@@ -47,7 +47,7 @@ static ssize_t name## _read(struct file *file, char __user *userbuf, \ | |||
47 | \ | 47 | \ |
48 | static const struct file_operations name## _ops = { \ | 48 | static const struct file_operations name## _ops = { \ |
49 | .read = name## _read, \ | 49 | .read = name## _read, \ |
50 | .open = wl1251_open_file_generic, \ | 50 | .open = simple_open, \ |
51 | .llseek = generic_file_llseek, \ | 51 | .llseek = generic_file_llseek, \ |
52 | }; | 52 | }; |
53 | 53 | ||
@@ -84,7 +84,7 @@ static ssize_t sub## _ ##name## _read(struct file *file, \ | |||
84 | \ | 84 | \ |
85 | static const struct file_operations sub## _ ##name## _ops = { \ | 85 | static const struct file_operations sub## _ ##name## _ops = { \ |
86 | .read = sub## _ ##name## _read, \ | 86 | .read = sub## _ ##name## _read, \ |
87 | .open = wl1251_open_file_generic, \ | 87 | .open = simple_open, \ |
88 | .llseek = generic_file_llseek, \ | 88 | .llseek = generic_file_llseek, \ |
89 | }; | 89 | }; |
90 | 90 | ||
@@ -117,12 +117,6 @@ out: | |||
117 | mutex_unlock(&wl->mutex); | 117 | mutex_unlock(&wl->mutex); |
118 | } | 118 | } |
119 | 119 | ||
120 | static int wl1251_open_file_generic(struct inode *inode, struct file *file) | ||
121 | { | ||
122 | file->private_data = inode->i_private; | ||
123 | return 0; | ||
124 | } | ||
125 | |||
126 | DEBUGFS_FWSTATS_FILE(tx, internal_desc_overflow, 20, "%u"); | 120 | DEBUGFS_FWSTATS_FILE(tx, internal_desc_overflow, 20, "%u"); |
127 | 121 | ||
128 | DEBUGFS_FWSTATS_FILE(rx, out_of_mem, 20, "%u"); | 122 | DEBUGFS_FWSTATS_FILE(rx, out_of_mem, 20, "%u"); |
@@ -235,7 +229,7 @@ static ssize_t tx_queue_len_read(struct file *file, char __user *userbuf, | |||
235 | 229 | ||
236 | static const struct file_operations tx_queue_len_ops = { | 230 | static const struct file_operations tx_queue_len_ops = { |
237 | .read = tx_queue_len_read, | 231 | .read = tx_queue_len_read, |
238 | .open = wl1251_open_file_generic, | 232 | .open = simple_open, |
239 | .llseek = generic_file_llseek, | 233 | .llseek = generic_file_llseek, |
240 | }; | 234 | }; |
241 | 235 | ||
@@ -257,7 +251,7 @@ static ssize_t tx_queue_status_read(struct file *file, char __user *userbuf, | |||
257 | 251 | ||
258 | static const struct file_operations tx_queue_status_ops = { | 252 | static const struct file_operations tx_queue_status_ops = { |
259 | .read = tx_queue_status_read, | 253 | .read = tx_queue_status_read, |
260 | .open = wl1251_open_file_generic, | 254 | .open = simple_open, |
261 | .llseek = generic_file_llseek, | 255 | .llseek = generic_file_llseek, |
262 | }; | 256 | }; |
263 | 257 | ||
diff --git a/drivers/net/wireless/wl12xx/debugfs.c b/drivers/net/wireless/wl12xx/debugfs.c index e1cf72765965..564d49575c94 100644 --- a/drivers/net/wireless/wl12xx/debugfs.c +++ b/drivers/net/wireless/wl12xx/debugfs.c | |||
@@ -63,7 +63,7 @@ static ssize_t name## _read(struct file *file, char __user *userbuf, \ | |||
63 | \ | 63 | \ |
64 | static const struct file_operations name## _ops = { \ | 64 | static const struct file_operations name## _ops = { \ |
65 | .read = name## _read, \ | 65 | .read = name## _read, \ |
66 | .open = wl1271_open_file_generic, \ | 66 | .open = simple_open, \ |
67 | .llseek = generic_file_llseek, \ | 67 | .llseek = generic_file_llseek, \ |
68 | }; | 68 | }; |
69 | 69 | ||
@@ -96,7 +96,7 @@ static ssize_t sub## _ ##name## _read(struct file *file, \ | |||
96 | \ | 96 | \ |
97 | static const struct file_operations sub## _ ##name## _ops = { \ | 97 | static const struct file_operations sub## _ ##name## _ops = { \ |
98 | .read = sub## _ ##name## _read, \ | 98 | .read = sub## _ ##name## _read, \ |
99 | .open = wl1271_open_file_generic, \ | 99 | .open = simple_open, \ |
100 | .llseek = generic_file_llseek, \ | 100 | .llseek = generic_file_llseek, \ |
101 | }; | 101 | }; |
102 | 102 | ||
@@ -126,12 +126,6 @@ out: | |||
126 | mutex_unlock(&wl->mutex); | 126 | mutex_unlock(&wl->mutex); |
127 | } | 127 | } |
128 | 128 | ||
129 | static int wl1271_open_file_generic(struct inode *inode, struct file *file) | ||
130 | { | ||
131 | file->private_data = inode->i_private; | ||
132 | return 0; | ||
133 | } | ||
134 | |||
135 | DEBUGFS_FWSTATS_FILE(tx, internal_desc_overflow, "%u"); | 129 | DEBUGFS_FWSTATS_FILE(tx, internal_desc_overflow, "%u"); |
136 | 130 | ||
137 | DEBUGFS_FWSTATS_FILE(rx, out_of_mem, "%u"); | 131 | DEBUGFS_FWSTATS_FILE(rx, out_of_mem, "%u"); |
@@ -243,7 +237,7 @@ static ssize_t tx_queue_len_read(struct file *file, char __user *userbuf, | |||
243 | 237 | ||
244 | static const struct file_operations tx_queue_len_ops = { | 238 | static const struct file_operations tx_queue_len_ops = { |
245 | .read = tx_queue_len_read, | 239 | .read = tx_queue_len_read, |
246 | .open = wl1271_open_file_generic, | 240 | .open = simple_open, |
247 | .llseek = default_llseek, | 241 | .llseek = default_llseek, |
248 | }; | 242 | }; |
249 | 243 | ||
@@ -289,7 +283,7 @@ static ssize_t gpio_power_write(struct file *file, | |||
289 | static const struct file_operations gpio_power_ops = { | 283 | static const struct file_operations gpio_power_ops = { |
290 | .read = gpio_power_read, | 284 | .read = gpio_power_read, |
291 | .write = gpio_power_write, | 285 | .write = gpio_power_write, |
292 | .open = wl1271_open_file_generic, | 286 | .open = simple_open, |
293 | .llseek = default_llseek, | 287 | .llseek = default_llseek, |
294 | }; | 288 | }; |
295 | 289 | ||
@@ -308,7 +302,7 @@ static ssize_t start_recovery_write(struct file *file, | |||
308 | 302 | ||
309 | static const struct file_operations start_recovery_ops = { | 303 | static const struct file_operations start_recovery_ops = { |
310 | .write = start_recovery_write, | 304 | .write = start_recovery_write, |
311 | .open = wl1271_open_file_generic, | 305 | .open = simple_open, |
312 | .llseek = default_llseek, | 306 | .llseek = default_llseek, |
313 | }; | 307 | }; |
314 | 308 | ||
@@ -372,7 +366,7 @@ out: | |||
372 | static const struct file_operations dynamic_ps_timeout_ops = { | 366 | static const struct file_operations dynamic_ps_timeout_ops = { |
373 | .read = dynamic_ps_timeout_read, | 367 | .read = dynamic_ps_timeout_read, |
374 | .write = dynamic_ps_timeout_write, | 368 | .write = dynamic_ps_timeout_write, |
375 | .open = wl1271_open_file_generic, | 369 | .open = simple_open, |
376 | .llseek = default_llseek, | 370 | .llseek = default_llseek, |
377 | }; | 371 | }; |
378 | 372 | ||
@@ -441,7 +435,7 @@ out: | |||
441 | static const struct file_operations forced_ps_ops = { | 435 | static const struct file_operations forced_ps_ops = { |
442 | .read = forced_ps_read, | 436 | .read = forced_ps_read, |
443 | .write = forced_ps_write, | 437 | .write = forced_ps_write, |
444 | .open = wl1271_open_file_generic, | 438 | .open = simple_open, |
445 | .llseek = default_llseek, | 439 | .llseek = default_llseek, |
446 | }; | 440 | }; |
447 | 441 | ||
@@ -483,7 +477,7 @@ static ssize_t split_scan_timeout_write(struct file *file, | |||
483 | static const struct file_operations split_scan_timeout_ops = { | 477 | static const struct file_operations split_scan_timeout_ops = { |
484 | .read = split_scan_timeout_read, | 478 | .read = split_scan_timeout_read, |
485 | .write = split_scan_timeout_write, | 479 | .write = split_scan_timeout_write, |
486 | .open = wl1271_open_file_generic, | 480 | .open = simple_open, |
487 | .llseek = default_llseek, | 481 | .llseek = default_llseek, |
488 | }; | 482 | }; |
489 | 483 | ||
@@ -566,7 +560,7 @@ static ssize_t driver_state_read(struct file *file, char __user *user_buf, | |||
566 | 560 | ||
567 | static const struct file_operations driver_state_ops = { | 561 | static const struct file_operations driver_state_ops = { |
568 | .read = driver_state_read, | 562 | .read = driver_state_read, |
569 | .open = wl1271_open_file_generic, | 563 | .open = simple_open, |
570 | .llseek = default_llseek, | 564 | .llseek = default_llseek, |
571 | }; | 565 | }; |
572 | 566 | ||
@@ -675,7 +669,7 @@ static ssize_t vifs_state_read(struct file *file, char __user *user_buf, | |||
675 | 669 | ||
676 | static const struct file_operations vifs_state_ops = { | 670 | static const struct file_operations vifs_state_ops = { |
677 | .read = vifs_state_read, | 671 | .read = vifs_state_read, |
678 | .open = wl1271_open_file_generic, | 672 | .open = simple_open, |
679 | .llseek = default_llseek, | 673 | .llseek = default_llseek, |
680 | }; | 674 | }; |
681 | 675 | ||
@@ -733,7 +727,7 @@ static ssize_t dtim_interval_write(struct file *file, | |||
733 | static const struct file_operations dtim_interval_ops = { | 727 | static const struct file_operations dtim_interval_ops = { |
734 | .read = dtim_interval_read, | 728 | .read = dtim_interval_read, |
735 | .write = dtim_interval_write, | 729 | .write = dtim_interval_write, |
736 | .open = wl1271_open_file_generic, | 730 | .open = simple_open, |
737 | .llseek = default_llseek, | 731 | .llseek = default_llseek, |
738 | }; | 732 | }; |
739 | 733 | ||
@@ -791,7 +785,7 @@ static ssize_t suspend_dtim_interval_write(struct file *file, | |||
791 | static const struct file_operations suspend_dtim_interval_ops = { | 785 | static const struct file_operations suspend_dtim_interval_ops = { |
792 | .read = suspend_dtim_interval_read, | 786 | .read = suspend_dtim_interval_read, |
793 | .write = suspend_dtim_interval_write, | 787 | .write = suspend_dtim_interval_write, |
794 | .open = wl1271_open_file_generic, | 788 | .open = simple_open, |
795 | .llseek = default_llseek, | 789 | .llseek = default_llseek, |
796 | }; | 790 | }; |
797 | 791 | ||
@@ -849,7 +843,7 @@ static ssize_t beacon_interval_write(struct file *file, | |||
849 | static const struct file_operations beacon_interval_ops = { | 843 | static const struct file_operations beacon_interval_ops = { |
850 | .read = beacon_interval_read, | 844 | .read = beacon_interval_read, |
851 | .write = beacon_interval_write, | 845 | .write = beacon_interval_write, |
852 | .open = wl1271_open_file_generic, | 846 | .open = simple_open, |
853 | .llseek = default_llseek, | 847 | .llseek = default_llseek, |
854 | }; | 848 | }; |
855 | 849 | ||
@@ -904,7 +898,7 @@ static ssize_t rx_streaming_interval_read(struct file *file, | |||
904 | static const struct file_operations rx_streaming_interval_ops = { | 898 | static const struct file_operations rx_streaming_interval_ops = { |
905 | .read = rx_streaming_interval_read, | 899 | .read = rx_streaming_interval_read, |
906 | .write = rx_streaming_interval_write, | 900 | .write = rx_streaming_interval_write, |
907 | .open = wl1271_open_file_generic, | 901 | .open = simple_open, |
908 | .llseek = default_llseek, | 902 | .llseek = default_llseek, |
909 | }; | 903 | }; |
910 | 904 | ||
@@ -959,7 +953,7 @@ static ssize_t rx_streaming_always_read(struct file *file, | |||
959 | static const struct file_operations rx_streaming_always_ops = { | 953 | static const struct file_operations rx_streaming_always_ops = { |
960 | .read = rx_streaming_always_read, | 954 | .read = rx_streaming_always_read, |
961 | .write = rx_streaming_always_write, | 955 | .write = rx_streaming_always_write, |
962 | .open = wl1271_open_file_generic, | 956 | .open = simple_open, |
963 | .llseek = default_llseek, | 957 | .llseek = default_llseek, |
964 | }; | 958 | }; |
965 | 959 | ||
@@ -1003,7 +997,7 @@ out: | |||
1003 | 997 | ||
1004 | static const struct file_operations beacon_filtering_ops = { | 998 | static const struct file_operations beacon_filtering_ops = { |
1005 | .write = beacon_filtering_write, | 999 | .write = beacon_filtering_write, |
1006 | .open = wl1271_open_file_generic, | 1000 | .open = simple_open, |
1007 | .llseek = default_llseek, | 1001 | .llseek = default_llseek, |
1008 | }; | 1002 | }; |
1009 | 1003 | ||
diff --git a/drivers/oprofile/oprofilefs.c b/drivers/oprofile/oprofilefs.c index ee8fd037bb53..849357c1045c 100644 --- a/drivers/oprofile/oprofilefs.c +++ b/drivers/oprofile/oprofilefs.c | |||
@@ -117,25 +117,17 @@ static ssize_t ulong_write_file(struct file *file, char const __user *buf, size_ | |||
117 | } | 117 | } |
118 | 118 | ||
119 | 119 | ||
120 | static int default_open(struct inode *inode, struct file *filp) | ||
121 | { | ||
122 | if (inode->i_private) | ||
123 | filp->private_data = inode->i_private; | ||
124 | return 0; | ||
125 | } | ||
126 | |||
127 | |||
128 | static const struct file_operations ulong_fops = { | 120 | static const struct file_operations ulong_fops = { |
129 | .read = ulong_read_file, | 121 | .read = ulong_read_file, |
130 | .write = ulong_write_file, | 122 | .write = ulong_write_file, |
131 | .open = default_open, | 123 | .open = simple_open, |
132 | .llseek = default_llseek, | 124 | .llseek = default_llseek, |
133 | }; | 125 | }; |
134 | 126 | ||
135 | 127 | ||
136 | static const struct file_operations ulong_ro_fops = { | 128 | static const struct file_operations ulong_ro_fops = { |
137 | .read = ulong_read_file, | 129 | .read = ulong_read_file, |
138 | .open = default_open, | 130 | .open = simple_open, |
139 | .llseek = default_llseek, | 131 | .llseek = default_llseek, |
140 | }; | 132 | }; |
141 | 133 | ||
@@ -187,7 +179,7 @@ static ssize_t atomic_read_file(struct file *file, char __user *buf, size_t coun | |||
187 | 179 | ||
188 | static const struct file_operations atomic_ro_fops = { | 180 | static const struct file_operations atomic_ro_fops = { |
189 | .read = atomic_read_file, | 181 | .read = atomic_read_file, |
190 | .open = default_open, | 182 | .open = simple_open, |
191 | .llseek = default_llseek, | 183 | .llseek = default_llseek, |
192 | }; | 184 | }; |
193 | 185 | ||
diff --git a/drivers/regulator/anatop-regulator.c b/drivers/regulator/anatop-regulator.c index 17499a55113d..53969af17558 100644 --- a/drivers/regulator/anatop-regulator.c +++ b/drivers/regulator/anatop-regulator.c | |||
@@ -138,9 +138,10 @@ static int __devinit anatop_regulator_probe(struct platform_device *pdev) | |||
138 | rdesc->type = REGULATOR_VOLTAGE; | 138 | rdesc->type = REGULATOR_VOLTAGE; |
139 | rdesc->owner = THIS_MODULE; | 139 | rdesc->owner = THIS_MODULE; |
140 | sreg->mfd = anatopmfd; | 140 | sreg->mfd = anatopmfd; |
141 | ret = of_property_read_u32(np, "reg", &sreg->control_reg); | 141 | ret = of_property_read_u32(np, "anatop-reg-offset", |
142 | &sreg->control_reg); | ||
142 | if (ret) { | 143 | if (ret) { |
143 | dev_err(dev, "no reg property set\n"); | 144 | dev_err(dev, "no anatop-reg-offset property set\n"); |
144 | goto anatop_probe_end; | 145 | goto anatop_probe_end; |
145 | } | 146 | } |
146 | ret = of_property_read_u32(np, "anatop-vol-bit-width", | 147 | ret = of_property_read_u32(np, "anatop-vol-bit-width", |
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index c056abd7562a..e70dd382a009 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c | |||
@@ -2992,14 +2992,14 @@ void regulator_unregister(struct regulator_dev *rdev) | |||
2992 | if (rdev == NULL) | 2992 | if (rdev == NULL) |
2993 | return; | 2993 | return; |
2994 | 2994 | ||
2995 | if (rdev->supply) | ||
2996 | regulator_put(rdev->supply); | ||
2995 | mutex_lock(®ulator_list_mutex); | 2997 | mutex_lock(®ulator_list_mutex); |
2996 | debugfs_remove_recursive(rdev->debugfs); | 2998 | debugfs_remove_recursive(rdev->debugfs); |
2997 | flush_work_sync(&rdev->disable_work.work); | 2999 | flush_work_sync(&rdev->disable_work.work); |
2998 | WARN_ON(rdev->open_count); | 3000 | WARN_ON(rdev->open_count); |
2999 | unset_regulator_supplies(rdev); | 3001 | unset_regulator_supplies(rdev); |
3000 | list_del(&rdev->list); | 3002 | list_del(&rdev->list); |
3001 | if (rdev->supply) | ||
3002 | regulator_put(rdev->supply); | ||
3003 | kfree(rdev->constraints); | 3003 | kfree(rdev->constraints); |
3004 | device_unregister(&rdev->dev); | 3004 | device_unregister(&rdev->dev); |
3005 | mutex_unlock(®ulator_list_mutex); | 3005 | mutex_unlock(®ulator_list_mutex); |
diff --git a/drivers/regulator/fixed-helper.c b/drivers/regulator/fixed-helper.c index 30d0a15b8949..cacd33c9d042 100644 --- a/drivers/regulator/fixed-helper.c +++ b/drivers/regulator/fixed-helper.c | |||
@@ -18,7 +18,6 @@ static void regulator_fixed_release(struct device *dev) | |||
18 | 18 | ||
19 | /** | 19 | /** |
20 | * regulator_register_fixed - register a no-op fixed regulator | 20 | * regulator_register_fixed - register a no-op fixed regulator |
21 | * @name: supply name | ||
22 | * @id: platform device id | 21 | * @id: platform device id |
23 | * @supplies: consumers for this regulator | 22 | * @supplies: consumers for this regulator |
24 | * @num_supplies: number of consumers | 23 | * @num_supplies: number of consumers |
@@ -32,7 +31,7 @@ struct platform_device *regulator_register_fixed(int id, | |||
32 | if (!data) | 31 | if (!data) |
33 | return NULL; | 32 | return NULL; |
34 | 33 | ||
35 | data->cfg.supply_name = "dummy"; | 34 | data->cfg.supply_name = "fixed-dummy"; |
36 | data->cfg.microvolts = 0; | 35 | data->cfg.microvolts = 0; |
37 | data->cfg.gpio = -EINVAL; | 36 | data->cfg.gpio = -EINVAL; |
38 | data->cfg.enabled_at_boot = 1; | 37 | data->cfg.enabled_at_boot = 1; |
diff --git a/drivers/regulator/mc13892-regulator.c b/drivers/regulator/mc13892-regulator.c index e8cfc99dd8f0..845aa2263b8a 100644 --- a/drivers/regulator/mc13892-regulator.c +++ b/drivers/regulator/mc13892-regulator.c | |||
@@ -552,7 +552,7 @@ static int __devinit mc13892_regulator_probe(struct platform_device *pdev) | |||
552 | mc13xxx_lock(mc13892); | 552 | mc13xxx_lock(mc13892); |
553 | ret = mc13xxx_reg_read(mc13892, MC13892_REVISION, &val); | 553 | ret = mc13xxx_reg_read(mc13892, MC13892_REVISION, &val); |
554 | if (ret) | 554 | if (ret) |
555 | goto err_free; | 555 | goto err_unlock; |
556 | 556 | ||
557 | /* enable switch auto mode */ | 557 | /* enable switch auto mode */ |
558 | if ((val & 0x0000FFFF) == 0x45d0) { | 558 | if ((val & 0x0000FFFF) == 0x45d0) { |
@@ -562,7 +562,7 @@ static int __devinit mc13892_regulator_probe(struct platform_device *pdev) | |||
562 | MC13892_SWITCHERS4_SW1MODE_AUTO | | 562 | MC13892_SWITCHERS4_SW1MODE_AUTO | |
563 | MC13892_SWITCHERS4_SW2MODE_AUTO); | 563 | MC13892_SWITCHERS4_SW2MODE_AUTO); |
564 | if (ret) | 564 | if (ret) |
565 | goto err_free; | 565 | goto err_unlock; |
566 | 566 | ||
567 | ret = mc13xxx_reg_rmw(mc13892, MC13892_SWITCHERS5, | 567 | ret = mc13xxx_reg_rmw(mc13892, MC13892_SWITCHERS5, |
568 | MC13892_SWITCHERS5_SW3MODE_M | | 568 | MC13892_SWITCHERS5_SW3MODE_M | |
@@ -570,7 +570,7 @@ static int __devinit mc13892_regulator_probe(struct platform_device *pdev) | |||
570 | MC13892_SWITCHERS5_SW3MODE_AUTO | | 570 | MC13892_SWITCHERS5_SW3MODE_AUTO | |
571 | MC13892_SWITCHERS5_SW4MODE_AUTO); | 571 | MC13892_SWITCHERS5_SW4MODE_AUTO); |
572 | if (ret) | 572 | if (ret) |
573 | goto err_free; | 573 | goto err_unlock; |
574 | } | 574 | } |
575 | mc13xxx_unlock(mc13892); | 575 | mc13xxx_unlock(mc13892); |
576 | 576 | ||
@@ -612,10 +612,10 @@ static int __devinit mc13892_regulator_probe(struct platform_device *pdev) | |||
612 | err: | 612 | err: |
613 | while (--i >= 0) | 613 | while (--i >= 0) |
614 | regulator_unregister(priv->regulators[i]); | 614 | regulator_unregister(priv->regulators[i]); |
615 | return ret; | ||
615 | 616 | ||
616 | err_free: | 617 | err_unlock: |
617 | mc13xxx_unlock(mc13892); | 618 | mc13xxx_unlock(mc13892); |
618 | |||
619 | return ret; | 619 | return ret; |
620 | } | 620 | } |
621 | 621 | ||
diff --git a/drivers/regulator/s5m8767.c b/drivers/regulator/s5m8767.c index 58447db15de1..4ca2db059004 100644 --- a/drivers/regulator/s5m8767.c +++ b/drivers/regulator/s5m8767.c | |||
@@ -311,8 +311,7 @@ static int s5m8767_set_voltage(struct regulator_dev *rdev, | |||
311 | struct s5m8767_info *s5m8767 = rdev_get_drvdata(rdev); | 311 | struct s5m8767_info *s5m8767 = rdev_get_drvdata(rdev); |
312 | const struct s5m_voltage_desc *desc; | 312 | const struct s5m_voltage_desc *desc; |
313 | int reg_id = rdev_get_id(rdev); | 313 | int reg_id = rdev_get_id(rdev); |
314 | int reg, mask, ret; | 314 | int sel, reg, mask, ret; |
315 | int i; | ||
316 | u8 val; | 315 | u8 val; |
317 | 316 | ||
318 | switch (reg_id) { | 317 | switch (reg_id) { |
@@ -333,19 +332,20 @@ static int s5m8767_set_voltage(struct regulator_dev *rdev, | |||
333 | 332 | ||
334 | desc = reg_voltage_map[reg_id]; | 333 | desc = reg_voltage_map[reg_id]; |
335 | 334 | ||
336 | i = s5m8767_convert_voltage_to_sel(desc, min_uV, max_uV); | 335 | sel = s5m8767_convert_voltage_to_sel(desc, min_uV, max_uV); |
337 | if (i < 0) | 336 | if (sel < 0) |
338 | return i; | 337 | return sel; |
339 | 338 | ||
340 | ret = s5m8767_get_voltage_register(rdev, ®); | 339 | ret = s5m8767_get_voltage_register(rdev, ®); |
341 | if (ret) | 340 | if (ret) |
342 | return ret; | 341 | return ret; |
343 | 342 | ||
344 | s5m_reg_read(s5m8767->iodev, reg, &val); | 343 | s5m_reg_read(s5m8767->iodev, reg, &val); |
345 | val = val & mask; | 344 | val &= ~mask; |
345 | val |= sel; | ||
346 | 346 | ||
347 | ret = s5m_reg_write(s5m8767->iodev, reg, val); | 347 | ret = s5m_reg_write(s5m8767->iodev, reg, val); |
348 | *selector = i; | 348 | *selector = sel; |
349 | 349 | ||
350 | return ret; | 350 | return ret; |
351 | } | 351 | } |
diff --git a/drivers/regulator/tps6586x-regulator.c b/drivers/regulator/tps6586x-regulator.c index 29b615ce3aff..cfc1f16f7771 100644 --- a/drivers/regulator/tps6586x-regulator.c +++ b/drivers/regulator/tps6586x-regulator.c | |||
@@ -79,6 +79,11 @@ static int tps6586x_ldo_list_voltage(struct regulator_dev *rdev, | |||
79 | unsigned selector) | 79 | unsigned selector) |
80 | { | 80 | { |
81 | struct tps6586x_regulator *info = rdev_get_drvdata(rdev); | 81 | struct tps6586x_regulator *info = rdev_get_drvdata(rdev); |
82 | int rid = rdev_get_id(rdev); | ||
83 | |||
84 | /* LDO0 has minimal voltage 1.2V rather than 1.25V */ | ||
85 | if ((rid == TPS6586X_ID_LDO_0) && (selector == 0)) | ||
86 | return (info->voltages[0] - 50) * 1000; | ||
82 | 87 | ||
83 | return info->voltages[selector] * 1000; | 88 | return info->voltages[selector] * 1000; |
84 | } | 89 | } |
diff --git a/drivers/regulator/wm831x-dcdc.c b/drivers/regulator/wm831x-dcdc.c index 4904a40b0d46..ff810e787eac 100644 --- a/drivers/regulator/wm831x-dcdc.c +++ b/drivers/regulator/wm831x-dcdc.c | |||
@@ -380,13 +380,15 @@ static int wm831x_buckv_set_current_limit(struct regulator_dev *rdev, | |||
380 | int i; | 380 | int i; |
381 | 381 | ||
382 | for (i = 0; i < ARRAY_SIZE(wm831x_dcdc_ilim); i++) { | 382 | for (i = 0; i < ARRAY_SIZE(wm831x_dcdc_ilim); i++) { |
383 | if (max_uA <= wm831x_dcdc_ilim[i]) | 383 | if ((min_uA <= wm831x_dcdc_ilim[i]) && |
384 | (wm831x_dcdc_ilim[i] <= max_uA)) | ||
384 | break; | 385 | break; |
385 | } | 386 | } |
386 | if (i == ARRAY_SIZE(wm831x_dcdc_ilim)) | 387 | if (i == ARRAY_SIZE(wm831x_dcdc_ilim)) |
387 | return -EINVAL; | 388 | return -EINVAL; |
388 | 389 | ||
389 | return wm831x_set_bits(wm831x, reg, WM831X_DC1_HC_THR_MASK, i); | 390 | return wm831x_set_bits(wm831x, reg, WM831X_DC1_HC_THR_MASK, |
391 | i << WM831X_DC1_HC_THR_SHIFT); | ||
390 | } | 392 | } |
391 | 393 | ||
392 | static int wm831x_buckv_get_current_limit(struct regulator_dev *rdev) | 394 | static int wm831x_buckv_get_current_limit(struct regulator_dev *rdev) |
@@ -400,7 +402,8 @@ static int wm831x_buckv_get_current_limit(struct regulator_dev *rdev) | |||
400 | if (val < 0) | 402 | if (val < 0) |
401 | return val; | 403 | return val; |
402 | 404 | ||
403 | return wm831x_dcdc_ilim[val & WM831X_DC1_HC_THR_MASK]; | 405 | val = (val & WM831X_DC1_HC_THR_MASK) >> WM831X_DC1_HC_THR_SHIFT; |
406 | return wm831x_dcdc_ilim[val]; | ||
404 | } | 407 | } |
405 | 408 | ||
406 | static struct regulator_ops wm831x_buckv_ops = { | 409 | static struct regulator_ops wm831x_buckv_ops = { |
diff --git a/drivers/regulator/wm831x-isink.c b/drivers/regulator/wm831x-isink.c index 634aac3f2d5f..b414e09c5620 100644 --- a/drivers/regulator/wm831x-isink.c +++ b/drivers/regulator/wm831x-isink.c | |||
@@ -101,7 +101,7 @@ static int wm831x_isink_set_current(struct regulator_dev *rdev, | |||
101 | 101 | ||
102 | for (i = 0; i < ARRAY_SIZE(wm831x_isinkv_values); i++) { | 102 | for (i = 0; i < ARRAY_SIZE(wm831x_isinkv_values); i++) { |
103 | int val = wm831x_isinkv_values[i]; | 103 | int val = wm831x_isinkv_values[i]; |
104 | if (min_uA >= val && val <= max_uA) { | 104 | if (min_uA <= val && val <= max_uA) { |
105 | ret = wm831x_set_bits(wm831x, isink->reg, | 105 | ret = wm831x_set_bits(wm831x, isink->reg, |
106 | WM831X_CS1_ISEL_MASK, i); | 106 | WM831X_CS1_ISEL_MASK, i); |
107 | return ret; | 107 | return ret; |
diff --git a/drivers/regulator/wm831x-ldo.c b/drivers/regulator/wm831x-ldo.c index f1e4ab0f9fda..641e9f6499d1 100644 --- a/drivers/regulator/wm831x-ldo.c +++ b/drivers/regulator/wm831x-ldo.c | |||
@@ -506,22 +506,19 @@ static int wm831x_aldo_set_mode(struct regulator_dev *rdev, | |||
506 | { | 506 | { |
507 | struct wm831x_ldo *ldo = rdev_get_drvdata(rdev); | 507 | struct wm831x_ldo *ldo = rdev_get_drvdata(rdev); |
508 | struct wm831x *wm831x = ldo->wm831x; | 508 | struct wm831x *wm831x = ldo->wm831x; |
509 | int ctrl_reg = ldo->base + WM831X_LDO_CONTROL; | ||
510 | int on_reg = ldo->base + WM831X_LDO_ON_CONTROL; | 509 | int on_reg = ldo->base + WM831X_LDO_ON_CONTROL; |
511 | int ret; | 510 | int ret; |
512 | 511 | ||
513 | 512 | ||
514 | switch (mode) { | 513 | switch (mode) { |
515 | case REGULATOR_MODE_NORMAL: | 514 | case REGULATOR_MODE_NORMAL: |
516 | ret = wm831x_set_bits(wm831x, on_reg, | 515 | ret = wm831x_set_bits(wm831x, on_reg, WM831X_LDO7_ON_MODE, 0); |
517 | WM831X_LDO7_ON_MODE, 0); | ||
518 | if (ret < 0) | 516 | if (ret < 0) |
519 | return ret; | 517 | return ret; |
520 | break; | 518 | break; |
521 | 519 | ||
522 | case REGULATOR_MODE_IDLE: | 520 | case REGULATOR_MODE_IDLE: |
523 | ret = wm831x_set_bits(wm831x, ctrl_reg, | 521 | ret = wm831x_set_bits(wm831x, on_reg, WM831X_LDO7_ON_MODE, |
524 | WM831X_LDO7_ON_MODE, | ||
525 | WM831X_LDO7_ON_MODE); | 522 | WM831X_LDO7_ON_MODE); |
526 | if (ret < 0) | 523 | if (ret < 0) |
527 | return ret; | 524 | return ret; |
diff --git a/drivers/regulator/wm8350-regulator.c b/drivers/regulator/wm8350-regulator.c index ab1e183a74b5..05ecfb872319 100644 --- a/drivers/regulator/wm8350-regulator.c +++ b/drivers/regulator/wm8350-regulator.c | |||
@@ -99,7 +99,7 @@ static int get_isink_val(int min_uA, int max_uA, u16 *setting) | |||
99 | { | 99 | { |
100 | int i; | 100 | int i; |
101 | 101 | ||
102 | for (i = ARRAY_SIZE(isink_cur) - 1; i >= 0; i--) { | 102 | for (i = 0; i < ARRAY_SIZE(isink_cur); i++) { |
103 | if (min_uA <= isink_cur[i] && max_uA >= isink_cur[i]) { | 103 | if (min_uA <= isink_cur[i] && max_uA >= isink_cur[i]) { |
104 | *setting = i; | 104 | *setting = i; |
105 | return 0; | 105 | return 0; |
@@ -186,7 +186,7 @@ static int wm8350_isink_get_current(struct regulator_dev *rdev) | |||
186 | return 0; | 186 | return 0; |
187 | } | 187 | } |
188 | 188 | ||
189 | return DIV_ROUND_CLOSEST(isink_cur[val], 100); | 189 | return isink_cur[val]; |
190 | } | 190 | } |
191 | 191 | ||
192 | /* turn on ISINK followed by DCDC */ | 192 | /* turn on ISINK followed by DCDC */ |
@@ -495,25 +495,25 @@ static int wm8350_dcdc_set_suspend_enable(struct regulator_dev *rdev) | |||
495 | val = wm8350_reg_read(wm8350, WM8350_DCDC1_LOW_POWER) | 495 | val = wm8350_reg_read(wm8350, WM8350_DCDC1_LOW_POWER) |
496 | & ~WM8350_DCDC_HIB_MODE_MASK; | 496 | & ~WM8350_DCDC_HIB_MODE_MASK; |
497 | wm8350_reg_write(wm8350, WM8350_DCDC1_LOW_POWER, | 497 | wm8350_reg_write(wm8350, WM8350_DCDC1_LOW_POWER, |
498 | wm8350->pmic.dcdc1_hib_mode); | 498 | val | wm8350->pmic.dcdc1_hib_mode); |
499 | break; | 499 | break; |
500 | case WM8350_DCDC_3: | 500 | case WM8350_DCDC_3: |
501 | val = wm8350_reg_read(wm8350, WM8350_DCDC3_LOW_POWER) | 501 | val = wm8350_reg_read(wm8350, WM8350_DCDC3_LOW_POWER) |
502 | & ~WM8350_DCDC_HIB_MODE_MASK; | 502 | & ~WM8350_DCDC_HIB_MODE_MASK; |
503 | wm8350_reg_write(wm8350, WM8350_DCDC3_LOW_POWER, | 503 | wm8350_reg_write(wm8350, WM8350_DCDC3_LOW_POWER, |
504 | wm8350->pmic.dcdc3_hib_mode); | 504 | val | wm8350->pmic.dcdc3_hib_mode); |
505 | break; | 505 | break; |
506 | case WM8350_DCDC_4: | 506 | case WM8350_DCDC_4: |
507 | val = wm8350_reg_read(wm8350, WM8350_DCDC4_LOW_POWER) | 507 | val = wm8350_reg_read(wm8350, WM8350_DCDC4_LOW_POWER) |
508 | & ~WM8350_DCDC_HIB_MODE_MASK; | 508 | & ~WM8350_DCDC_HIB_MODE_MASK; |
509 | wm8350_reg_write(wm8350, WM8350_DCDC4_LOW_POWER, | 509 | wm8350_reg_write(wm8350, WM8350_DCDC4_LOW_POWER, |
510 | wm8350->pmic.dcdc4_hib_mode); | 510 | val | wm8350->pmic.dcdc4_hib_mode); |
511 | break; | 511 | break; |
512 | case WM8350_DCDC_6: | 512 | case WM8350_DCDC_6: |
513 | val = wm8350_reg_read(wm8350, WM8350_DCDC6_LOW_POWER) | 513 | val = wm8350_reg_read(wm8350, WM8350_DCDC6_LOW_POWER) |
514 | & ~WM8350_DCDC_HIB_MODE_MASK; | 514 | & ~WM8350_DCDC_HIB_MODE_MASK; |
515 | wm8350_reg_write(wm8350, WM8350_DCDC6_LOW_POWER, | 515 | wm8350_reg_write(wm8350, WM8350_DCDC6_LOW_POWER, |
516 | wm8350->pmic.dcdc6_hib_mode); | 516 | val | wm8350->pmic.dcdc6_hib_mode); |
517 | break; | 517 | break; |
518 | case WM8350_DCDC_2: | 518 | case WM8350_DCDC_2: |
519 | case WM8350_DCDC_5: | 519 | case WM8350_DCDC_5: |
@@ -535,25 +535,25 @@ static int wm8350_dcdc_set_suspend_disable(struct regulator_dev *rdev) | |||
535 | val = wm8350_reg_read(wm8350, WM8350_DCDC1_LOW_POWER); | 535 | val = wm8350_reg_read(wm8350, WM8350_DCDC1_LOW_POWER); |
536 | wm8350->pmic.dcdc1_hib_mode = val & WM8350_DCDC_HIB_MODE_MASK; | 536 | wm8350->pmic.dcdc1_hib_mode = val & WM8350_DCDC_HIB_MODE_MASK; |
537 | wm8350_reg_write(wm8350, WM8350_DCDC1_LOW_POWER, | 537 | wm8350_reg_write(wm8350, WM8350_DCDC1_LOW_POWER, |
538 | WM8350_DCDC_HIB_MODE_DIS); | 538 | val | WM8350_DCDC_HIB_MODE_DIS); |
539 | break; | 539 | break; |
540 | case WM8350_DCDC_3: | 540 | case WM8350_DCDC_3: |
541 | val = wm8350_reg_read(wm8350, WM8350_DCDC3_LOW_POWER); | 541 | val = wm8350_reg_read(wm8350, WM8350_DCDC3_LOW_POWER); |
542 | wm8350->pmic.dcdc3_hib_mode = val & WM8350_DCDC_HIB_MODE_MASK; | 542 | wm8350->pmic.dcdc3_hib_mode = val & WM8350_DCDC_HIB_MODE_MASK; |
543 | wm8350_reg_write(wm8350, WM8350_DCDC3_LOW_POWER, | 543 | wm8350_reg_write(wm8350, WM8350_DCDC3_LOW_POWER, |
544 | WM8350_DCDC_HIB_MODE_DIS); | 544 | val | WM8350_DCDC_HIB_MODE_DIS); |
545 | break; | 545 | break; |
546 | case WM8350_DCDC_4: | 546 | case WM8350_DCDC_4: |
547 | val = wm8350_reg_read(wm8350, WM8350_DCDC4_LOW_POWER); | 547 | val = wm8350_reg_read(wm8350, WM8350_DCDC4_LOW_POWER); |
548 | wm8350->pmic.dcdc4_hib_mode = val & WM8350_DCDC_HIB_MODE_MASK; | 548 | wm8350->pmic.dcdc4_hib_mode = val & WM8350_DCDC_HIB_MODE_MASK; |
549 | wm8350_reg_write(wm8350, WM8350_DCDC4_LOW_POWER, | 549 | wm8350_reg_write(wm8350, WM8350_DCDC4_LOW_POWER, |
550 | WM8350_DCDC_HIB_MODE_DIS); | 550 | val | WM8350_DCDC_HIB_MODE_DIS); |
551 | break; | 551 | break; |
552 | case WM8350_DCDC_6: | 552 | case WM8350_DCDC_6: |
553 | val = wm8350_reg_read(wm8350, WM8350_DCDC6_LOW_POWER); | 553 | val = wm8350_reg_read(wm8350, WM8350_DCDC6_LOW_POWER); |
554 | wm8350->pmic.dcdc6_hib_mode = val & WM8350_DCDC_HIB_MODE_MASK; | 554 | wm8350->pmic.dcdc6_hib_mode = val & WM8350_DCDC_HIB_MODE_MASK; |
555 | wm8350_reg_write(wm8350, WM8350_DCDC6_LOW_POWER, | 555 | wm8350_reg_write(wm8350, WM8350_DCDC6_LOW_POWER, |
556 | WM8350_DCDC_HIB_MODE_DIS); | 556 | val | WM8350_DCDC_HIB_MODE_DIS); |
557 | break; | 557 | break; |
558 | case WM8350_DCDC_2: | 558 | case WM8350_DCDC_2: |
559 | case WM8350_DCDC_5: | 559 | case WM8350_DCDC_5: |
@@ -575,13 +575,13 @@ static int wm8350_dcdc25_set_suspend_enable(struct regulator_dev *rdev) | |||
575 | val = wm8350_reg_read(wm8350, WM8350_DCDC2_CONTROL) | 575 | val = wm8350_reg_read(wm8350, WM8350_DCDC2_CONTROL) |
576 | & ~WM8350_DC2_HIB_MODE_MASK; | 576 | & ~WM8350_DC2_HIB_MODE_MASK; |
577 | wm8350_reg_write(wm8350, WM8350_DCDC2_CONTROL, val | | 577 | wm8350_reg_write(wm8350, WM8350_DCDC2_CONTROL, val | |
578 | WM8350_DC2_HIB_MODE_ACTIVE); | 578 | (WM8350_DC2_HIB_MODE_ACTIVE << WM8350_DC2_HIB_MODE_SHIFT)); |
579 | break; | 579 | break; |
580 | case WM8350_DCDC_5: | 580 | case WM8350_DCDC_5: |
581 | val = wm8350_reg_read(wm8350, WM8350_DCDC5_CONTROL) | 581 | val = wm8350_reg_read(wm8350, WM8350_DCDC5_CONTROL) |
582 | & ~WM8350_DC2_HIB_MODE_MASK; | 582 | & ~WM8350_DC5_HIB_MODE_MASK; |
583 | wm8350_reg_write(wm8350, WM8350_DCDC5_CONTROL, val | | 583 | wm8350_reg_write(wm8350, WM8350_DCDC5_CONTROL, val | |
584 | WM8350_DC5_HIB_MODE_ACTIVE); | 584 | (WM8350_DC5_HIB_MODE_ACTIVE << WM8350_DC5_HIB_MODE_SHIFT)); |
585 | break; | 585 | break; |
586 | default: | 586 | default: |
587 | return -EINVAL; | 587 | return -EINVAL; |
@@ -600,13 +600,13 @@ static int wm8350_dcdc25_set_suspend_disable(struct regulator_dev *rdev) | |||
600 | val = wm8350_reg_read(wm8350, WM8350_DCDC2_CONTROL) | 600 | val = wm8350_reg_read(wm8350, WM8350_DCDC2_CONTROL) |
601 | & ~WM8350_DC2_HIB_MODE_MASK; | 601 | & ~WM8350_DC2_HIB_MODE_MASK; |
602 | wm8350_reg_write(wm8350, WM8350_DCDC2_CONTROL, val | | 602 | wm8350_reg_write(wm8350, WM8350_DCDC2_CONTROL, val | |
603 | WM8350_DC2_HIB_MODE_DISABLE); | 603 | (WM8350_DC2_HIB_MODE_DISABLE << WM8350_DC2_HIB_MODE_SHIFT)); |
604 | break; | 604 | break; |
605 | case WM8350_DCDC_5: | 605 | case WM8350_DCDC_5: |
606 | val = wm8350_reg_read(wm8350, WM8350_DCDC5_CONTROL) | 606 | val = wm8350_reg_read(wm8350, WM8350_DCDC5_CONTROL) |
607 | & ~WM8350_DC2_HIB_MODE_MASK; | 607 | & ~WM8350_DC5_HIB_MODE_MASK; |
608 | wm8350_reg_write(wm8350, WM8350_DCDC5_CONTROL, val | | 608 | wm8350_reg_write(wm8350, WM8350_DCDC5_CONTROL, val | |
609 | WM8350_DC2_HIB_MODE_DISABLE); | 609 | (WM8350_DC5_HIB_MODE_DISABLE << WM8350_DC5_HIB_MODE_SHIFT)); |
610 | break; | 610 | break; |
611 | default: | 611 | default: |
612 | return -EINVAL; | 612 | return -EINVAL; |
@@ -749,7 +749,7 @@ static int wm8350_ldo_set_suspend_disable(struct regulator_dev *rdev) | |||
749 | 749 | ||
750 | /* all LDOs have same mV bits */ | 750 | /* all LDOs have same mV bits */ |
751 | val = wm8350_reg_read(wm8350, volt_reg) & ~WM8350_LDO1_HIB_MODE_MASK; | 751 | val = wm8350_reg_read(wm8350, volt_reg) & ~WM8350_LDO1_HIB_MODE_MASK; |
752 | wm8350_reg_write(wm8350, volt_reg, WM8350_LDO1_HIB_MODE_DIS); | 752 | wm8350_reg_write(wm8350, volt_reg, val | WM8350_LDO1_HIB_MODE_DIS); |
753 | return 0; | 753 | return 0; |
754 | } | 754 | } |
755 | 755 | ||
diff --git a/drivers/remoteproc/remoteproc_debugfs.c b/drivers/remoteproc/remoteproc_debugfs.c index 70277a530133..85d31a69e117 100644 --- a/drivers/remoteproc/remoteproc_debugfs.c +++ b/drivers/remoteproc/remoteproc_debugfs.c | |||
@@ -50,16 +50,9 @@ static ssize_t rproc_trace_read(struct file *filp, char __user *userbuf, | |||
50 | return simple_read_from_buffer(userbuf, count, ppos, trace->va, len); | 50 | return simple_read_from_buffer(userbuf, count, ppos, trace->va, len); |
51 | } | 51 | } |
52 | 52 | ||
53 | static int rproc_open_generic(struct inode *inode, struct file *file) | ||
54 | { | ||
55 | file->private_data = inode->i_private; | ||
56 | |||
57 | return 0; | ||
58 | } | ||
59 | |||
60 | static const struct file_operations trace_rproc_ops = { | 53 | static const struct file_operations trace_rproc_ops = { |
61 | .read = rproc_trace_read, | 54 | .read = rproc_trace_read, |
62 | .open = rproc_open_generic, | 55 | .open = simple_open, |
63 | .llseek = generic_file_llseek, | 56 | .llseek = generic_file_llseek, |
64 | }; | 57 | }; |
65 | 58 | ||
@@ -94,7 +87,7 @@ static ssize_t rproc_state_read(struct file *filp, char __user *userbuf, | |||
94 | 87 | ||
95 | static const struct file_operations rproc_state_ops = { | 88 | static const struct file_operations rproc_state_ops = { |
96 | .read = rproc_state_read, | 89 | .read = rproc_state_read, |
97 | .open = rproc_open_generic, | 90 | .open = simple_open, |
98 | .llseek = generic_file_llseek, | 91 | .llseek = generic_file_llseek, |
99 | }; | 92 | }; |
100 | 93 | ||
@@ -114,7 +107,7 @@ static ssize_t rproc_name_read(struct file *filp, char __user *userbuf, | |||
114 | 107 | ||
115 | static const struct file_operations rproc_name_ops = { | 108 | static const struct file_operations rproc_name_ops = { |
116 | .read = rproc_name_read, | 109 | .read = rproc_name_read, |
117 | .open = rproc_open_generic, | 110 | .open = simple_open, |
118 | .llseek = generic_file_llseek, | 111 | .llseek = generic_file_llseek, |
119 | }; | 112 | }; |
120 | 113 | ||
diff --git a/drivers/rtc/rtc-88pm860x.c b/drivers/rtc/rtc-88pm860x.c index afee0e8ae714..feddefc42109 100644 --- a/drivers/rtc/rtc-88pm860x.c +++ b/drivers/rtc/rtc-88pm860x.c | |||
@@ -72,9 +72,9 @@ static int pm860x_rtc_alarm_irq_enable(struct device *dev, unsigned int enabled) | |||
72 | struct pm860x_rtc_info *info = dev_get_drvdata(dev); | 72 | struct pm860x_rtc_info *info = dev_get_drvdata(dev); |
73 | 73 | ||
74 | if (enabled) | 74 | if (enabled) |
75 | pm860x_set_bits(info->i2c, PM8607_RTC1, ALARM, ALARM); | 75 | pm860x_set_bits(info->i2c, PM8607_RTC1, ALARM_EN, ALARM_EN); |
76 | else | 76 | else |
77 | pm860x_set_bits(info->i2c, PM8607_RTC1, ALARM, 0); | 77 | pm860x_set_bits(info->i2c, PM8607_RTC1, ALARM_EN, 0); |
78 | return 0; | 78 | return 0; |
79 | } | 79 | } |
80 | 80 | ||
diff --git a/drivers/scsi/lpfc/lpfc_debugfs.c b/drivers/scsi/lpfc/lpfc_debugfs.c index 5bdf2eecb178..af04b0d6688d 100644 --- a/drivers/scsi/lpfc/lpfc_debugfs.c +++ b/drivers/scsi/lpfc/lpfc_debugfs.c | |||
@@ -997,13 +997,6 @@ lpfc_debugfs_dumpDataDif_write(struct file *file, const char __user *buf, | |||
997 | return nbytes; | 997 | return nbytes; |
998 | } | 998 | } |
999 | 999 | ||
1000 | static int | ||
1001 | lpfc_debugfs_dif_err_open(struct inode *inode, struct file *file) | ||
1002 | { | ||
1003 | file->private_data = inode->i_private; | ||
1004 | return 0; | ||
1005 | } | ||
1006 | |||
1007 | static ssize_t | 1000 | static ssize_t |
1008 | lpfc_debugfs_dif_err_read(struct file *file, char __user *buf, | 1001 | lpfc_debugfs_dif_err_read(struct file *file, char __user *buf, |
1009 | size_t nbytes, loff_t *ppos) | 1002 | size_t nbytes, loff_t *ppos) |
@@ -3541,7 +3534,7 @@ static const struct file_operations lpfc_debugfs_op_dumpDif = { | |||
3541 | #undef lpfc_debugfs_op_dif_err | 3534 | #undef lpfc_debugfs_op_dif_err |
3542 | static const struct file_operations lpfc_debugfs_op_dif_err = { | 3535 | static const struct file_operations lpfc_debugfs_op_dif_err = { |
3543 | .owner = THIS_MODULE, | 3536 | .owner = THIS_MODULE, |
3544 | .open = lpfc_debugfs_dif_err_open, | 3537 | .open = simple_open, |
3545 | .llseek = lpfc_debugfs_lseek, | 3538 | .llseek = lpfc_debugfs_lseek, |
3546 | .read = lpfc_debugfs_dif_err_read, | 3539 | .read = lpfc_debugfs_dif_err_read, |
3547 | .write = lpfc_debugfs_dif_err_write, | 3540 | .write = lpfc_debugfs_dif_err_write, |
diff --git a/drivers/spi/spi-dw.c b/drivers/spi/spi-dw.c index 082458d73ce9..d1a495f64e2d 100644 --- a/drivers/spi/spi-dw.c +++ b/drivers/spi/spi-dw.c | |||
@@ -63,12 +63,6 @@ struct chip_data { | |||
63 | }; | 63 | }; |
64 | 64 | ||
65 | #ifdef CONFIG_DEBUG_FS | 65 | #ifdef CONFIG_DEBUG_FS |
66 | static int spi_show_regs_open(struct inode *inode, struct file *file) | ||
67 | { | ||
68 | file->private_data = inode->i_private; | ||
69 | return 0; | ||
70 | } | ||
71 | |||
72 | #define SPI_REGS_BUFSIZE 1024 | 66 | #define SPI_REGS_BUFSIZE 1024 |
73 | static ssize_t spi_show_regs(struct file *file, char __user *user_buf, | 67 | static ssize_t spi_show_regs(struct file *file, char __user *user_buf, |
74 | size_t count, loff_t *ppos) | 68 | size_t count, loff_t *ppos) |
@@ -128,7 +122,7 @@ static ssize_t spi_show_regs(struct file *file, char __user *user_buf, | |||
128 | 122 | ||
129 | static const struct file_operations mrst_spi_regs_ops = { | 123 | static const struct file_operations mrst_spi_regs_ops = { |
130 | .owner = THIS_MODULE, | 124 | .owner = THIS_MODULE, |
131 | .open = spi_show_regs_open, | 125 | .open = simple_open, |
132 | .read = spi_show_regs, | 126 | .read = spi_show_regs, |
133 | .llseek = default_llseek, | 127 | .llseek = default_llseek, |
134 | }; | 128 | }; |
diff --git a/drivers/tty/serial/mfd.c b/drivers/tty/serial/mfd.c index a9234ba8f8d5..c4b50af46c44 100644 --- a/drivers/tty/serial/mfd.c +++ b/drivers/tty/serial/mfd.c | |||
@@ -127,11 +127,6 @@ static inline void serial_out(struct uart_hsu_port *up, int offset, int value) | |||
127 | 127 | ||
128 | #define HSU_REGS_BUFSIZE 1024 | 128 | #define HSU_REGS_BUFSIZE 1024 |
129 | 129 | ||
130 | static int hsu_show_regs_open(struct inode *inode, struct file *file) | ||
131 | { | ||
132 | file->private_data = inode->i_private; | ||
133 | return 0; | ||
134 | } | ||
135 | 130 | ||
136 | static ssize_t port_show_regs(struct file *file, char __user *user_buf, | 131 | static ssize_t port_show_regs(struct file *file, char __user *user_buf, |
137 | size_t count, loff_t *ppos) | 132 | size_t count, loff_t *ppos) |
@@ -231,14 +226,14 @@ static ssize_t dma_show_regs(struct file *file, char __user *user_buf, | |||
231 | 226 | ||
232 | static const struct file_operations port_regs_ops = { | 227 | static const struct file_operations port_regs_ops = { |
233 | .owner = THIS_MODULE, | 228 | .owner = THIS_MODULE, |
234 | .open = hsu_show_regs_open, | 229 | .open = simple_open, |
235 | .read = port_show_regs, | 230 | .read = port_show_regs, |
236 | .llseek = default_llseek, | 231 | .llseek = default_llseek, |
237 | }; | 232 | }; |
238 | 233 | ||
239 | static const struct file_operations dma_regs_ops = { | 234 | static const struct file_operations dma_regs_ops = { |
240 | .owner = THIS_MODULE, | 235 | .owner = THIS_MODULE, |
241 | .open = hsu_show_regs_open, | 236 | .open = simple_open, |
242 | .read = dma_show_regs, | 237 | .read = dma_show_regs, |
243 | .llseek = default_llseek, | 238 | .llseek = default_llseek, |
244 | }; | 239 | }; |
diff --git a/drivers/tty/serial/pch_uart.c b/drivers/tty/serial/pch_uart.c index e825460478be..08b9962b8fda 100644 --- a/drivers/tty/serial/pch_uart.c +++ b/drivers/tty/serial/pch_uart.c | |||
@@ -304,11 +304,7 @@ static const int trigger_level_1[4] = { 1, 1, 1, 1 }; | |||
304 | #ifdef CONFIG_DEBUG_FS | 304 | #ifdef CONFIG_DEBUG_FS |
305 | 305 | ||
306 | #define PCH_REGS_BUFSIZE 1024 | 306 | #define PCH_REGS_BUFSIZE 1024 |
307 | static int pch_show_regs_open(struct inode *inode, struct file *file) | 307 | |
308 | { | ||
309 | file->private_data = inode->i_private; | ||
310 | return 0; | ||
311 | } | ||
312 | 308 | ||
313 | static ssize_t port_show_regs(struct file *file, char __user *user_buf, | 309 | static ssize_t port_show_regs(struct file *file, char __user *user_buf, |
314 | size_t count, loff_t *ppos) | 310 | size_t count, loff_t *ppos) |
@@ -362,7 +358,7 @@ static ssize_t port_show_regs(struct file *file, char __user *user_buf, | |||
362 | 358 | ||
363 | static const struct file_operations port_regs_ops = { | 359 | static const struct file_operations port_regs_ops = { |
364 | .owner = THIS_MODULE, | 360 | .owner = THIS_MODULE, |
365 | .open = pch_show_regs_open, | 361 | .open = simple_open, |
366 | .read = port_show_regs, | 362 | .read = port_show_regs, |
367 | .llseek = default_llseek, | 363 | .llseek = default_llseek, |
368 | }; | 364 | }; |
diff --git a/drivers/tty/serial/sunzilog.c b/drivers/tty/serial/sunzilog.c index b3b70b0bf85b..babd9470982b 100644 --- a/drivers/tty/serial/sunzilog.c +++ b/drivers/tty/serial/sunzilog.c | |||
@@ -1581,7 +1581,7 @@ static int __init sunzilog_init(void) | |||
1581 | if (err) | 1581 | if (err) |
1582 | goto out_unregister_uart; | 1582 | goto out_unregister_uart; |
1583 | 1583 | ||
1584 | if (!zilog_irq) { | 1584 | if (zilog_irq) { |
1585 | struct uart_sunzilog_port *up = sunzilog_irq_chain; | 1585 | struct uart_sunzilog_port *up = sunzilog_irq_chain; |
1586 | err = request_irq(zilog_irq, sunzilog_interrupt, IRQF_SHARED, | 1586 | err = request_irq(zilog_irq, sunzilog_interrupt, IRQF_SHARED, |
1587 | "zs", sunzilog_irq_chain); | 1587 | "zs", sunzilog_irq_chain); |
@@ -1622,7 +1622,7 @@ static void __exit sunzilog_exit(void) | |||
1622 | { | 1622 | { |
1623 | platform_driver_unregister(&zs_driver); | 1623 | platform_driver_unregister(&zs_driver); |
1624 | 1624 | ||
1625 | if (!zilog_irq) { | 1625 | if (zilog_irq) { |
1626 | struct uart_sunzilog_port *up = sunzilog_irq_chain; | 1626 | struct uart_sunzilog_port *up = sunzilog_irq_chain; |
1627 | 1627 | ||
1628 | /* Disable Interrupts */ | 1628 | /* Disable Interrupts */ |
diff --git a/drivers/tty/sysrq.c b/drivers/tty/sysrq.c index 136e86faa1e1..05728894a88c 100644 --- a/drivers/tty/sysrq.c +++ b/drivers/tty/sysrq.c | |||
@@ -327,7 +327,7 @@ static void send_sig_all(int sig) | |||
327 | if (is_global_init(p)) | 327 | if (is_global_init(p)) |
328 | continue; | 328 | continue; |
329 | 329 | ||
330 | force_sig(sig, p); | 330 | do_send_sig_info(sig, SEND_SIG_FORCED, p, true); |
331 | } | 331 | } |
332 | read_unlock(&tasklist_lock); | 332 | read_unlock(&tasklist_lock); |
333 | } | 333 | } |
diff --git a/drivers/usb/core/inode.c b/drivers/usb/core/inode.c index cefa0c8b5b6a..d2b9af59cba9 100644 --- a/drivers/usb/core/inode.c +++ b/drivers/usb/core/inode.c | |||
@@ -428,18 +428,10 @@ static loff_t default_file_lseek (struct file *file, loff_t offset, int orig) | |||
428 | return retval; | 428 | return retval; |
429 | } | 429 | } |
430 | 430 | ||
431 | static int default_open (struct inode *inode, struct file *file) | ||
432 | { | ||
433 | if (inode->i_private) | ||
434 | file->private_data = inode->i_private; | ||
435 | |||
436 | return 0; | ||
437 | } | ||
438 | |||
439 | static const struct file_operations default_file_operations = { | 431 | static const struct file_operations default_file_operations = { |
440 | .read = default_read_file, | 432 | .read = default_read_file, |
441 | .write = default_write_file, | 433 | .write = default_write_file, |
442 | .open = default_open, | 434 | .open = simple_open, |
443 | .llseek = default_file_lseek, | 435 | .llseek = default_file_lseek, |
444 | }; | 436 | }; |
445 | 437 | ||
diff --git a/drivers/usb/gadget/f_phonet.c b/drivers/usb/gadget/f_phonet.c index 85a5cebe96b3..965a6293206a 100644 --- a/drivers/usb/gadget/f_phonet.c +++ b/drivers/usb/gadget/f_phonet.c | |||
@@ -345,7 +345,7 @@ static void pn_rx_complete(struct usb_ep *ep, struct usb_request *req) | |||
345 | } | 345 | } |
346 | 346 | ||
347 | skb_add_rx_frag(skb, skb_shinfo(skb)->nr_frags, page, | 347 | skb_add_rx_frag(skb, skb_shinfo(skb)->nr_frags, page, |
348 | skb->len <= 1, req->actual, req->actual); | 348 | skb->len <= 1, req->actual, PAGE_SIZE); |
349 | page = NULL; | 349 | page = NULL; |
350 | 350 | ||
351 | if (req->actual < req->length) { /* Last fragment */ | 351 | if (req->actual < req->length) { /* Last fragment */ |
diff --git a/drivers/usb/host/ehci-atmel.c b/drivers/usb/host/ehci-atmel.c index 19f318ababa2..cf14c95a6700 100644 --- a/drivers/usb/host/ehci-atmel.c +++ b/drivers/usb/host/ehci-atmel.c | |||
@@ -13,6 +13,7 @@ | |||
13 | 13 | ||
14 | #include <linux/clk.h> | 14 | #include <linux/clk.h> |
15 | #include <linux/platform_device.h> | 15 | #include <linux/platform_device.h> |
16 | #include <linux/of.h> | ||
16 | #include <linux/of_platform.h> | 17 | #include <linux/of_platform.h> |
17 | 18 | ||
18 | /* interface and function clocks */ | 19 | /* interface and function clocks */ |
diff --git a/drivers/usb/host/ehci-dbg.c b/drivers/usb/host/ehci-dbg.c index fd9109d7eb0e..680e1a31fb87 100644 --- a/drivers/usb/host/ehci-dbg.c +++ b/drivers/usb/host/ehci-dbg.c | |||
@@ -352,7 +352,6 @@ static int debug_async_open(struct inode *, struct file *); | |||
352 | static int debug_periodic_open(struct inode *, struct file *); | 352 | static int debug_periodic_open(struct inode *, struct file *); |
353 | static int debug_registers_open(struct inode *, struct file *); | 353 | static int debug_registers_open(struct inode *, struct file *); |
354 | static int debug_async_open(struct inode *, struct file *); | 354 | static int debug_async_open(struct inode *, struct file *); |
355 | static int debug_lpm_open(struct inode *, struct file *); | ||
356 | static ssize_t debug_lpm_read(struct file *file, char __user *user_buf, | 355 | static ssize_t debug_lpm_read(struct file *file, char __user *user_buf, |
357 | size_t count, loff_t *ppos); | 356 | size_t count, loff_t *ppos); |
358 | static ssize_t debug_lpm_write(struct file *file, const char __user *buffer, | 357 | static ssize_t debug_lpm_write(struct file *file, const char __user *buffer, |
@@ -385,7 +384,7 @@ static const struct file_operations debug_registers_fops = { | |||
385 | }; | 384 | }; |
386 | static const struct file_operations debug_lpm_fops = { | 385 | static const struct file_operations debug_lpm_fops = { |
387 | .owner = THIS_MODULE, | 386 | .owner = THIS_MODULE, |
388 | .open = debug_lpm_open, | 387 | .open = simple_open, |
389 | .read = debug_lpm_read, | 388 | .read = debug_lpm_read, |
390 | .write = debug_lpm_write, | 389 | .write = debug_lpm_write, |
391 | .release = debug_lpm_close, | 390 | .release = debug_lpm_close, |
@@ -970,12 +969,6 @@ static int debug_registers_open(struct inode *inode, struct file *file) | |||
970 | return file->private_data ? 0 : -ENOMEM; | 969 | return file->private_data ? 0 : -ENOMEM; |
971 | } | 970 | } |
972 | 971 | ||
973 | static int debug_lpm_open(struct inode *inode, struct file *file) | ||
974 | { | ||
975 | file->private_data = inode->i_private; | ||
976 | return 0; | ||
977 | } | ||
978 | |||
979 | static int debug_lpm_close(struct inode *inode, struct file *file) | 972 | static int debug_lpm_close(struct inode *inode, struct file *file) |
980 | { | 973 | { |
981 | return 0; | 974 | return 0; |
diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c index db8963f5fbce..09f597ad6e00 100644 --- a/drivers/usb/host/ohci-at91.c +++ b/drivers/usb/host/ohci-at91.c | |||
@@ -27,6 +27,10 @@ | |||
27 | #error "CONFIG_ARCH_AT91 must be defined." | 27 | #error "CONFIG_ARCH_AT91 must be defined." |
28 | #endif | 28 | #endif |
29 | 29 | ||
30 | #define valid_port(index) ((index) >= 0 && (index) < AT91_MAX_USBH_PORTS) | ||
31 | #define at91_for_each_port(index) \ | ||
32 | for ((index) = 0; (index) < AT91_MAX_USBH_PORTS; (index)++) | ||
33 | |||
30 | /* interface and function clocks; sometimes also an AHB clock */ | 34 | /* interface and function clocks; sometimes also an AHB clock */ |
31 | static struct clk *iclk, *fclk, *hclk; | 35 | static struct clk *iclk, *fclk, *hclk; |
32 | static int clocked; | 36 | static int clocked; |
@@ -240,26 +244,26 @@ ohci_at91_start (struct usb_hcd *hcd) | |||
240 | 244 | ||
241 | static void ohci_at91_usb_set_power(struct at91_usbh_data *pdata, int port, int enable) | 245 | static void ohci_at91_usb_set_power(struct at91_usbh_data *pdata, int port, int enable) |
242 | { | 246 | { |
243 | if (port < 0 || port >= 2) | 247 | if (!valid_port(port)) |
244 | return; | 248 | return; |
245 | 249 | ||
246 | if (!gpio_is_valid(pdata->vbus_pin[port])) | 250 | if (!gpio_is_valid(pdata->vbus_pin[port])) |
247 | return; | 251 | return; |
248 | 252 | ||
249 | gpio_set_value(pdata->vbus_pin[port], | 253 | gpio_set_value(pdata->vbus_pin[port], |
250 | !pdata->vbus_pin_active_low[port] ^ enable); | 254 | pdata->vbus_pin_active_low[port] ^ enable); |
251 | } | 255 | } |
252 | 256 | ||
253 | static int ohci_at91_usb_get_power(struct at91_usbh_data *pdata, int port) | 257 | static int ohci_at91_usb_get_power(struct at91_usbh_data *pdata, int port) |
254 | { | 258 | { |
255 | if (port < 0 || port >= 2) | 259 | if (!valid_port(port)) |
256 | return -EINVAL; | 260 | return -EINVAL; |
257 | 261 | ||
258 | if (!gpio_is_valid(pdata->vbus_pin[port])) | 262 | if (!gpio_is_valid(pdata->vbus_pin[port])) |
259 | return -EINVAL; | 263 | return -EINVAL; |
260 | 264 | ||
261 | return gpio_get_value(pdata->vbus_pin[port]) ^ | 265 | return gpio_get_value(pdata->vbus_pin[port]) ^ |
262 | !pdata->vbus_pin_active_low[port]; | 266 | pdata->vbus_pin_active_low[port]; |
263 | } | 267 | } |
264 | 268 | ||
265 | /* | 269 | /* |
@@ -271,9 +275,9 @@ static int ohci_at91_hub_status_data(struct usb_hcd *hcd, char *buf) | |||
271 | int length = ohci_hub_status_data(hcd, buf); | 275 | int length = ohci_hub_status_data(hcd, buf); |
272 | int port; | 276 | int port; |
273 | 277 | ||
274 | for (port = 0; port < ARRAY_SIZE(pdata->overcurrent_pin); port++) { | 278 | at91_for_each_port(port) { |
275 | if (pdata->overcurrent_changed[port]) { | 279 | if (pdata->overcurrent_changed[port]) { |
276 | if (! length) | 280 | if (!length) |
277 | length = 1; | 281 | length = 1; |
278 | buf[0] |= 1 << (port + 1); | 282 | buf[0] |= 1 << (port + 1); |
279 | } | 283 | } |
@@ -297,11 +301,17 @@ static int ohci_at91_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, | |||
297 | "ohci_at91_hub_control(%p,0x%04x,0x%04x,0x%04x,%p,%04x)\n", | 301 | "ohci_at91_hub_control(%p,0x%04x,0x%04x,0x%04x,%p,%04x)\n", |
298 | hcd, typeReq, wValue, wIndex, buf, wLength); | 302 | hcd, typeReq, wValue, wIndex, buf, wLength); |
299 | 303 | ||
304 | wIndex--; | ||
305 | |||
300 | switch (typeReq) { | 306 | switch (typeReq) { |
301 | case SetPortFeature: | 307 | case SetPortFeature: |
302 | if (wValue == USB_PORT_FEAT_POWER) { | 308 | if (wValue == USB_PORT_FEAT_POWER) { |
303 | dev_dbg(hcd->self.controller, "SetPortFeat: POWER\n"); | 309 | dev_dbg(hcd->self.controller, "SetPortFeat: POWER\n"); |
304 | ohci_at91_usb_set_power(pdata, wIndex - 1, 1); | 310 | if (valid_port(wIndex)) { |
311 | ohci_at91_usb_set_power(pdata, wIndex, 1); | ||
312 | ret = 0; | ||
313 | } | ||
314 | |||
305 | goto out; | 315 | goto out; |
306 | } | 316 | } |
307 | break; | 317 | break; |
@@ -312,9 +322,9 @@ static int ohci_at91_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, | |||
312 | dev_dbg(hcd->self.controller, | 322 | dev_dbg(hcd->self.controller, |
313 | "ClearPortFeature: C_OVER_CURRENT\n"); | 323 | "ClearPortFeature: C_OVER_CURRENT\n"); |
314 | 324 | ||
315 | if (wIndex == 1 || wIndex == 2) { | 325 | if (valid_port(wIndex)) { |
316 | pdata->overcurrent_changed[wIndex-1] = 0; | 326 | pdata->overcurrent_changed[wIndex] = 0; |
317 | pdata->overcurrent_status[wIndex-1] = 0; | 327 | pdata->overcurrent_status[wIndex] = 0; |
318 | } | 328 | } |
319 | 329 | ||
320 | goto out; | 330 | goto out; |
@@ -323,9 +333,8 @@ static int ohci_at91_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, | |||
323 | dev_dbg(hcd->self.controller, | 333 | dev_dbg(hcd->self.controller, |
324 | "ClearPortFeature: OVER_CURRENT\n"); | 334 | "ClearPortFeature: OVER_CURRENT\n"); |
325 | 335 | ||
326 | if (wIndex == 1 || wIndex == 2) { | 336 | if (valid_port(wIndex)) |
327 | pdata->overcurrent_status[wIndex-1] = 0; | 337 | pdata->overcurrent_status[wIndex] = 0; |
328 | } | ||
329 | 338 | ||
330 | goto out; | 339 | goto out; |
331 | 340 | ||
@@ -333,15 +342,15 @@ static int ohci_at91_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, | |||
333 | dev_dbg(hcd->self.controller, | 342 | dev_dbg(hcd->self.controller, |
334 | "ClearPortFeature: POWER\n"); | 343 | "ClearPortFeature: POWER\n"); |
335 | 344 | ||
336 | if (wIndex == 1 || wIndex == 2) { | 345 | if (valid_port(wIndex)) { |
337 | ohci_at91_usb_set_power(pdata, wIndex - 1, 0); | 346 | ohci_at91_usb_set_power(pdata, wIndex, 0); |
338 | return 0; | 347 | return 0; |
339 | } | 348 | } |
340 | } | 349 | } |
341 | break; | 350 | break; |
342 | } | 351 | } |
343 | 352 | ||
344 | ret = ohci_hub_control(hcd, typeReq, wValue, wIndex, buf, wLength); | 353 | ret = ohci_hub_control(hcd, typeReq, wValue, wIndex + 1, buf, wLength); |
345 | if (ret) | 354 | if (ret) |
346 | goto out; | 355 | goto out; |
347 | 356 | ||
@@ -377,18 +386,15 @@ static int ohci_at91_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, | |||
377 | 386 | ||
378 | dev_dbg(hcd->self.controller, "GetPortStatus(%d)\n", wIndex); | 387 | dev_dbg(hcd->self.controller, "GetPortStatus(%d)\n", wIndex); |
379 | 388 | ||
380 | if (wIndex == 1 || wIndex == 2) { | 389 | if (valid_port(wIndex)) { |
381 | if (! ohci_at91_usb_get_power(pdata, wIndex-1)) { | 390 | if (!ohci_at91_usb_get_power(pdata, wIndex)) |
382 | *data &= ~cpu_to_le32(RH_PS_PPS); | 391 | *data &= ~cpu_to_le32(RH_PS_PPS); |
383 | } | ||
384 | 392 | ||
385 | if (pdata->overcurrent_changed[wIndex-1]) { | 393 | if (pdata->overcurrent_changed[wIndex]) |
386 | *data |= cpu_to_le32(RH_PS_OCIC); | 394 | *data |= cpu_to_le32(RH_PS_OCIC); |
387 | } | ||
388 | 395 | ||
389 | if (pdata->overcurrent_status[wIndex-1]) { | 396 | if (pdata->overcurrent_status[wIndex]) |
390 | *data |= cpu_to_le32(RH_PS_POCI); | 397 | *data |= cpu_to_le32(RH_PS_POCI); |
391 | } | ||
392 | } | 398 | } |
393 | } | 399 | } |
394 | 400 | ||
@@ -450,14 +456,14 @@ static irqreturn_t ohci_hcd_at91_overcurrent_irq(int irq, void *data) | |||
450 | 456 | ||
451 | /* From the GPIO notifying the over-current situation, find | 457 | /* From the GPIO notifying the over-current situation, find |
452 | * out the corresponding port */ | 458 | * out the corresponding port */ |
453 | for (port = 0; port < ARRAY_SIZE(pdata->overcurrent_pin); port++) { | 459 | at91_for_each_port(port) { |
454 | if (gpio_to_irq(pdata->overcurrent_pin[port]) == irq) { | 460 | if (gpio_to_irq(pdata->overcurrent_pin[port]) == irq) { |
455 | gpio = pdata->overcurrent_pin[port]; | 461 | gpio = pdata->overcurrent_pin[port]; |
456 | break; | 462 | break; |
457 | } | 463 | } |
458 | } | 464 | } |
459 | 465 | ||
460 | if (port == ARRAY_SIZE(pdata->overcurrent_pin)) { | 466 | if (port == AT91_MAX_USBH_PORTS) { |
461 | dev_err(& pdev->dev, "overcurrent interrupt from unknown GPIO\n"); | 467 | dev_err(& pdev->dev, "overcurrent interrupt from unknown GPIO\n"); |
462 | return IRQ_HANDLED; | 468 | return IRQ_HANDLED; |
463 | } | 469 | } |
@@ -467,7 +473,7 @@ static irqreturn_t ohci_hcd_at91_overcurrent_irq(int irq, void *data) | |||
467 | /* When notified of an over-current situation, disable power | 473 | /* When notified of an over-current situation, disable power |
468 | on the corresponding port, and mark this port in | 474 | on the corresponding port, and mark this port in |
469 | over-current. */ | 475 | over-current. */ |
470 | if (! val) { | 476 | if (!val) { |
471 | ohci_at91_usb_set_power(pdata, port, 0); | 477 | ohci_at91_usb_set_power(pdata, port, 0); |
472 | pdata->overcurrent_status[port] = 1; | 478 | pdata->overcurrent_status[port] = 1; |
473 | pdata->overcurrent_changed[port] = 1; | 479 | pdata->overcurrent_changed[port] = 1; |
@@ -492,7 +498,7 @@ static u64 at91_ohci_dma_mask = DMA_BIT_MASK(32); | |||
492 | static int __devinit ohci_at91_of_init(struct platform_device *pdev) | 498 | static int __devinit ohci_at91_of_init(struct platform_device *pdev) |
493 | { | 499 | { |
494 | struct device_node *np = pdev->dev.of_node; | 500 | struct device_node *np = pdev->dev.of_node; |
495 | int i, ret, gpio; | 501 | int i, gpio; |
496 | enum of_gpio_flags flags; | 502 | enum of_gpio_flags flags; |
497 | struct at91_usbh_data *pdata; | 503 | struct at91_usbh_data *pdata; |
498 | u32 ports; | 504 | u32 ports; |
@@ -514,48 +520,17 @@ static int __devinit ohci_at91_of_init(struct platform_device *pdev) | |||
514 | if (!of_property_read_u32(np, "num-ports", &ports)) | 520 | if (!of_property_read_u32(np, "num-ports", &ports)) |
515 | pdata->ports = ports; | 521 | pdata->ports = ports; |
516 | 522 | ||
517 | for (i = 0; i < 2; i++) { | 523 | at91_for_each_port(i) { |
518 | gpio = of_get_named_gpio_flags(np, "atmel,vbus-gpio", i, &flags); | 524 | gpio = of_get_named_gpio_flags(np, "atmel,vbus-gpio", i, &flags); |
519 | pdata->vbus_pin[i] = gpio; | 525 | pdata->vbus_pin[i] = gpio; |
520 | if (!gpio_is_valid(gpio)) | 526 | if (!gpio_is_valid(gpio)) |
521 | continue; | 527 | continue; |
522 | pdata->vbus_pin_active_low[i] = flags & OF_GPIO_ACTIVE_LOW; | 528 | pdata->vbus_pin_active_low[i] = flags & OF_GPIO_ACTIVE_LOW; |
523 | ret = gpio_request(gpio, "ohci_vbus"); | ||
524 | if (ret) { | ||
525 | dev_warn(&pdev->dev, "can't request vbus gpio %d", gpio); | ||
526 | continue; | ||
527 | } | ||
528 | ret = gpio_direction_output(gpio, !(flags & OF_GPIO_ACTIVE_LOW) ^ 1); | ||
529 | if (ret) | ||
530 | dev_warn(&pdev->dev, "can't put vbus gpio %d as output %d", | ||
531 | !(flags & OF_GPIO_ACTIVE_LOW) ^ 1, gpio); | ||
532 | } | 529 | } |
533 | 530 | ||
534 | for (i = 0; i < 2; i++) { | 531 | at91_for_each_port(i) |
535 | gpio = of_get_named_gpio_flags(np, "atmel,oc-gpio", i, &flags); | 532 | pdata->overcurrent_pin[i] = |
536 | pdata->overcurrent_pin[i] = gpio; | 533 | of_get_named_gpio_flags(np, "atmel,oc-gpio", i, &flags); |
537 | if (!gpio_is_valid(gpio)) | ||
538 | continue; | ||
539 | ret = gpio_request(gpio, "ohci_overcurrent"); | ||
540 | if (ret) { | ||
541 | dev_err(&pdev->dev, "can't request overcurrent gpio %d", gpio); | ||
542 | continue; | ||
543 | } | ||
544 | |||
545 | ret = gpio_direction_input(gpio); | ||
546 | if (ret) { | ||
547 | dev_err(&pdev->dev, "can't configure overcurrent gpio %d as input", gpio); | ||
548 | continue; | ||
549 | } | ||
550 | |||
551 | ret = request_irq(gpio_to_irq(gpio), | ||
552 | ohci_hcd_at91_overcurrent_irq, | ||
553 | IRQF_SHARED, "ohci_overcurrent", pdev); | ||
554 | if (ret) { | ||
555 | gpio_free(gpio); | ||
556 | dev_warn(& pdev->dev, "cannot get GPIO IRQ for overcurrent\n"); | ||
557 | } | ||
558 | } | ||
559 | 534 | ||
560 | pdev->dev.platform_data = pdata; | 535 | pdev->dev.platform_data = pdata; |
561 | 536 | ||
@@ -574,35 +549,69 @@ static int ohci_hcd_at91_drv_probe(struct platform_device *pdev) | |||
574 | { | 549 | { |
575 | struct at91_usbh_data *pdata; | 550 | struct at91_usbh_data *pdata; |
576 | int i; | 551 | int i; |
552 | int gpio; | ||
553 | int ret; | ||
577 | 554 | ||
578 | i = ohci_at91_of_init(pdev); | 555 | ret = ohci_at91_of_init(pdev); |
579 | 556 | if (ret) | |
580 | if (i) | 557 | return ret; |
581 | return i; | ||
582 | 558 | ||
583 | pdata = pdev->dev.platform_data; | 559 | pdata = pdev->dev.platform_data; |
584 | 560 | ||
585 | if (pdata) { | 561 | if (pdata) { |
586 | for (i = 0; i < ARRAY_SIZE(pdata->vbus_pin); i++) { | 562 | at91_for_each_port(i) { |
587 | if (!gpio_is_valid(pdata->vbus_pin[i])) | 563 | if (!gpio_is_valid(pdata->vbus_pin[i])) |
588 | continue; | 564 | continue; |
589 | gpio_request(pdata->vbus_pin[i], "ohci_vbus"); | 565 | gpio = pdata->vbus_pin[i]; |
566 | |||
567 | ret = gpio_request(gpio, "ohci_vbus"); | ||
568 | if (ret) { | ||
569 | dev_err(&pdev->dev, | ||
570 | "can't request vbus gpio %d\n", gpio); | ||
571 | continue; | ||
572 | } | ||
573 | ret = gpio_direction_output(gpio, | ||
574 | !pdata->vbus_pin_active_low[i]); | ||
575 | if (ret) { | ||
576 | dev_err(&pdev->dev, | ||
577 | "can't put vbus gpio %d as output %d\n", | ||
578 | gpio, !pdata->vbus_pin_active_low[i]); | ||
579 | gpio_free(gpio); | ||
580 | continue; | ||
581 | } | ||
582 | |||
590 | ohci_at91_usb_set_power(pdata, i, 1); | 583 | ohci_at91_usb_set_power(pdata, i, 1); |
591 | } | 584 | } |
592 | 585 | ||
593 | for (i = 0; i < ARRAY_SIZE(pdata->overcurrent_pin); i++) { | 586 | at91_for_each_port(i) { |
594 | int ret; | ||
595 | |||
596 | if (!gpio_is_valid(pdata->overcurrent_pin[i])) | 587 | if (!gpio_is_valid(pdata->overcurrent_pin[i])) |
597 | continue; | 588 | continue; |
598 | gpio_request(pdata->overcurrent_pin[i], "ohci_overcurrent"); | 589 | gpio = pdata->overcurrent_pin[i]; |
590 | |||
591 | ret = gpio_request(gpio, "ohci_overcurrent"); | ||
592 | if (ret) { | ||
593 | dev_err(&pdev->dev, | ||
594 | "can't request overcurrent gpio %d\n", | ||
595 | gpio); | ||
596 | continue; | ||
597 | } | ||
598 | |||
599 | ret = gpio_direction_input(gpio); | ||
600 | if (ret) { | ||
601 | dev_err(&pdev->dev, | ||
602 | "can't configure overcurrent gpio %d as input\n", | ||
603 | gpio); | ||
604 | gpio_free(gpio); | ||
605 | continue; | ||
606 | } | ||
599 | 607 | ||
600 | ret = request_irq(gpio_to_irq(pdata->overcurrent_pin[i]), | 608 | ret = request_irq(gpio_to_irq(gpio), |
601 | ohci_hcd_at91_overcurrent_irq, | 609 | ohci_hcd_at91_overcurrent_irq, |
602 | IRQF_SHARED, "ohci_overcurrent", pdev); | 610 | IRQF_SHARED, "ohci_overcurrent", pdev); |
603 | if (ret) { | 611 | if (ret) { |
604 | gpio_free(pdata->overcurrent_pin[i]); | 612 | gpio_free(gpio); |
605 | dev_warn(& pdev->dev, "cannot get GPIO IRQ for overcurrent\n"); | 613 | dev_err(&pdev->dev, |
614 | "can't get gpio IRQ for overcurrent\n"); | ||
606 | } | 615 | } |
607 | } | 616 | } |
608 | } | 617 | } |
@@ -617,14 +626,14 @@ static int ohci_hcd_at91_drv_remove(struct platform_device *pdev) | |||
617 | int i; | 626 | int i; |
618 | 627 | ||
619 | if (pdata) { | 628 | if (pdata) { |
620 | for (i = 0; i < ARRAY_SIZE(pdata->vbus_pin); i++) { | 629 | at91_for_each_port(i) { |
621 | if (!gpio_is_valid(pdata->vbus_pin[i])) | 630 | if (!gpio_is_valid(pdata->vbus_pin[i])) |
622 | continue; | 631 | continue; |
623 | ohci_at91_usb_set_power(pdata, i, 0); | 632 | ohci_at91_usb_set_power(pdata, i, 0); |
624 | gpio_free(pdata->vbus_pin[i]); | 633 | gpio_free(pdata->vbus_pin[i]); |
625 | } | 634 | } |
626 | 635 | ||
627 | for (i = 0; i < ARRAY_SIZE(pdata->overcurrent_pin); i++) { | 636 | at91_for_each_port(i) { |
628 | if (!gpio_is_valid(pdata->overcurrent_pin[i])) | 637 | if (!gpio_is_valid(pdata->overcurrent_pin[i])) |
629 | continue; | 638 | continue; |
630 | free_irq(gpio_to_irq(pdata->overcurrent_pin[i]), pdev); | 639 | free_irq(gpio_to_irq(pdata->overcurrent_pin[i]), pdev); |
diff --git a/drivers/uwb/uwb-debug.c b/drivers/uwb/uwb-debug.c index 2eecec0c13c9..6ec45beb7af5 100644 --- a/drivers/uwb/uwb-debug.c +++ b/drivers/uwb/uwb-debug.c | |||
@@ -159,13 +159,6 @@ static int cmd_ie_rm(struct uwb_rc *rc, struct uwb_dbg_cmd_ie *ie_to_rm) | |||
159 | return uwb_rc_ie_rm(rc, ie_to_rm->data[0]); | 159 | return uwb_rc_ie_rm(rc, ie_to_rm->data[0]); |
160 | } | 160 | } |
161 | 161 | ||
162 | static int command_open(struct inode *inode, struct file *file) | ||
163 | { | ||
164 | file->private_data = inode->i_private; | ||
165 | |||
166 | return 0; | ||
167 | } | ||
168 | |||
169 | static ssize_t command_write(struct file *file, const char __user *buf, | 162 | static ssize_t command_write(struct file *file, const char __user *buf, |
170 | size_t len, loff_t *off) | 163 | size_t len, loff_t *off) |
171 | { | 164 | { |
@@ -206,7 +199,7 @@ static ssize_t command_write(struct file *file, const char __user *buf, | |||
206 | } | 199 | } |
207 | 200 | ||
208 | static const struct file_operations command_fops = { | 201 | static const struct file_operations command_fops = { |
209 | .open = command_open, | 202 | .open = simple_open, |
210 | .write = command_write, | 203 | .write = command_write, |
211 | .read = NULL, | 204 | .read = NULL, |
212 | .llseek = no_llseek, | 205 | .llseek = no_llseek, |
diff --git a/drivers/video/backlight/Kconfig b/drivers/video/backlight/Kconfig index 7ed9991fa747..af16884491ed 100644 --- a/drivers/video/backlight/Kconfig +++ b/drivers/video/backlight/Kconfig | |||
@@ -245,6 +245,12 @@ config BACKLIGHT_DA903X | |||
245 | If you have a LCD backlight connected to the WLED output of DA9030 | 245 | If you have a LCD backlight connected to the WLED output of DA9030 |
246 | or DA9034 WLED output, say Y here to enable this driver. | 246 | or DA9034 WLED output, say Y here to enable this driver. |
247 | 247 | ||
248 | config BACKLIGHT_DA9052 | ||
249 | tristate "Dialog DA9052/DA9053 WLED" | ||
250 | depends on PMIC_DA9052 | ||
251 | help | ||
252 | Enable the Backlight Driver for DA9052-BC and DA9053-AA/Bx PMICs. | ||
253 | |||
248 | config BACKLIGHT_MAX8925 | 254 | config BACKLIGHT_MAX8925 |
249 | tristate "Backlight driver for MAX8925" | 255 | tristate "Backlight driver for MAX8925" |
250 | depends on MFD_MAX8925 | 256 | depends on MFD_MAX8925 |
diff --git a/drivers/video/backlight/Makefile b/drivers/video/backlight/Makefile index 8071eb656147..36855ae887d6 100644 --- a/drivers/video/backlight/Makefile +++ b/drivers/video/backlight/Makefile | |||
@@ -29,6 +29,7 @@ obj-$(CONFIG_BACKLIGHT_PROGEAR) += progear_bl.o | |||
29 | obj-$(CONFIG_BACKLIGHT_CARILLO_RANCH) += cr_bllcd.o | 29 | obj-$(CONFIG_BACKLIGHT_CARILLO_RANCH) += cr_bllcd.o |
30 | obj-$(CONFIG_BACKLIGHT_PWM) += pwm_bl.o | 30 | obj-$(CONFIG_BACKLIGHT_PWM) += pwm_bl.o |
31 | obj-$(CONFIG_BACKLIGHT_DA903X) += da903x_bl.o | 31 | obj-$(CONFIG_BACKLIGHT_DA903X) += da903x_bl.o |
32 | obj-$(CONFIG_BACKLIGHT_DA9052) += da9052_bl.o | ||
32 | obj-$(CONFIG_BACKLIGHT_MAX8925) += max8925_bl.o | 33 | obj-$(CONFIG_BACKLIGHT_MAX8925) += max8925_bl.o |
33 | obj-$(CONFIG_BACKLIGHT_APPLE) += apple_bl.o | 34 | obj-$(CONFIG_BACKLIGHT_APPLE) += apple_bl.o |
34 | obj-$(CONFIG_BACKLIGHT_TOSA) += tosa_bl.o | 35 | obj-$(CONFIG_BACKLIGHT_TOSA) += tosa_bl.o |
diff --git a/drivers/video/backlight/da9052_bl.c b/drivers/video/backlight/da9052_bl.c new file mode 100644 index 000000000000..b628d68f5162 --- /dev/null +++ b/drivers/video/backlight/da9052_bl.c | |||
@@ -0,0 +1,187 @@ | |||
1 | /* | ||
2 | * Backlight Driver for Dialog DA9052 PMICs | ||
3 | * | ||
4 | * Copyright(c) 2012 Dialog Semiconductor Ltd. | ||
5 | * | ||
6 | * Author: David Dajun Chen <dchen@diasemi.com> | ||
7 | * | ||
8 | * 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 | ||
10 | * the Free Software Foundation; either version 2 of the License, or | ||
11 | * (at your option) any later version. | ||
12 | * | ||
13 | */ | ||
14 | |||
15 | #include <linux/backlight.h> | ||
16 | #include <linux/delay.h> | ||
17 | #include <linux/fb.h> | ||
18 | #include <linux/module.h> | ||
19 | #include <linux/platform_device.h> | ||
20 | |||
21 | #include <linux/mfd/da9052/da9052.h> | ||
22 | #include <linux/mfd/da9052/reg.h> | ||
23 | |||
24 | #define DA9052_MAX_BRIGHTNESS 0xFF | ||
25 | |||
26 | enum { | ||
27 | DA9052_WLEDS_OFF, | ||
28 | DA9052_WLEDS_ON, | ||
29 | }; | ||
30 | |||
31 | enum { | ||
32 | DA9052_TYPE_WLED1, | ||
33 | DA9052_TYPE_WLED2, | ||
34 | DA9052_TYPE_WLED3, | ||
35 | }; | ||
36 | |||
37 | static unsigned char wled_bank[] = { | ||
38 | DA9052_LED1_CONF_REG, | ||
39 | DA9052_LED2_CONF_REG, | ||
40 | DA9052_LED3_CONF_REG, | ||
41 | }; | ||
42 | |||
43 | struct da9052_bl { | ||
44 | struct da9052 *da9052; | ||
45 | uint brightness; | ||
46 | uint state; | ||
47 | uint led_reg; | ||
48 | }; | ||
49 | |||
50 | static int da9052_adjust_wled_brightness(struct da9052_bl *wleds) | ||
51 | { | ||
52 | unsigned char boost_en; | ||
53 | unsigned char i_sink; | ||
54 | int ret; | ||
55 | |||
56 | boost_en = 0x3F; | ||
57 | i_sink = 0xFF; | ||
58 | if (wleds->state == DA9052_WLEDS_OFF) { | ||
59 | boost_en = 0x00; | ||
60 | i_sink = 0x00; | ||
61 | } | ||
62 | |||
63 | ret = da9052_reg_write(wleds->da9052, DA9052_BOOST_REG, boost_en); | ||
64 | if (ret < 0) | ||
65 | return ret; | ||
66 | |||
67 | ret = da9052_reg_write(wleds->da9052, DA9052_LED_CONT_REG, i_sink); | ||
68 | if (ret < 0) | ||
69 | return ret; | ||
70 | |||
71 | ret = da9052_reg_write(wleds->da9052, wled_bank[wleds->led_reg], 0x0); | ||
72 | if (ret < 0) | ||
73 | return ret; | ||
74 | |||
75 | msleep(10); | ||
76 | |||
77 | if (wleds->brightness) { | ||
78 | ret = da9052_reg_write(wleds->da9052, wled_bank[wleds->led_reg], | ||
79 | wleds->brightness); | ||
80 | if (ret < 0) | ||
81 | return ret; | ||
82 | } | ||
83 | |||
84 | return 0; | ||
85 | } | ||
86 | |||
87 | static int da9052_backlight_update_status(struct backlight_device *bl) | ||
88 | { | ||
89 | int brightness = bl->props.brightness; | ||
90 | struct da9052_bl *wleds = bl_get_data(bl); | ||
91 | |||
92 | wleds->brightness = brightness; | ||
93 | wleds->state = DA9052_WLEDS_ON; | ||
94 | |||
95 | return da9052_adjust_wled_brightness(wleds); | ||
96 | } | ||
97 | |||
98 | static int da9052_backlight_get_brightness(struct backlight_device *bl) | ||
99 | { | ||
100 | struct da9052_bl *wleds = bl_get_data(bl); | ||
101 | |||
102 | return wleds->brightness; | ||
103 | } | ||
104 | |||
105 | static const struct backlight_ops da9052_backlight_ops = { | ||
106 | .update_status = da9052_backlight_update_status, | ||
107 | .get_brightness = da9052_backlight_get_brightness, | ||
108 | }; | ||
109 | |||
110 | static int da9052_backlight_probe(struct platform_device *pdev) | ||
111 | { | ||
112 | struct backlight_device *bl; | ||
113 | struct backlight_properties props; | ||
114 | struct da9052_bl *wleds; | ||
115 | |||
116 | wleds = devm_kzalloc(&pdev->dev, sizeof(struct da9052_bl), GFP_KERNEL); | ||
117 | if (!wleds) | ||
118 | return -ENOMEM; | ||
119 | |||
120 | wleds->da9052 = dev_get_drvdata(pdev->dev.parent); | ||
121 | wleds->brightness = 0; | ||
122 | wleds->led_reg = platform_get_device_id(pdev)->driver_data; | ||
123 | wleds->state = DA9052_WLEDS_OFF; | ||
124 | |||
125 | props.type = BACKLIGHT_RAW; | ||
126 | props.max_brightness = DA9052_MAX_BRIGHTNESS; | ||
127 | |||
128 | bl = backlight_device_register(pdev->name, wleds->da9052->dev, wleds, | ||
129 | &da9052_backlight_ops, &props); | ||
130 | if (IS_ERR(bl)) { | ||
131 | dev_err(&pdev->dev, "Failed to register backlight\n"); | ||
132 | devm_kfree(&pdev->dev, wleds); | ||
133 | return PTR_ERR(bl); | ||
134 | } | ||
135 | |||
136 | bl->props.max_brightness = DA9052_MAX_BRIGHTNESS; | ||
137 | bl->props.brightness = 0; | ||
138 | platform_set_drvdata(pdev, bl); | ||
139 | |||
140 | return da9052_adjust_wled_brightness(wleds); | ||
141 | } | ||
142 | |||
143 | static int da9052_backlight_remove(struct platform_device *pdev) | ||
144 | { | ||
145 | struct backlight_device *bl = platform_get_drvdata(pdev); | ||
146 | struct da9052_bl *wleds = bl_get_data(bl); | ||
147 | |||
148 | wleds->brightness = 0; | ||
149 | wleds->state = DA9052_WLEDS_OFF; | ||
150 | da9052_adjust_wled_brightness(wleds); | ||
151 | backlight_device_unregister(bl); | ||
152 | devm_kfree(&pdev->dev, wleds); | ||
153 | |||
154 | return 0; | ||
155 | } | ||
156 | |||
157 | static struct platform_device_id da9052_wled_ids[] = { | ||
158 | { | ||
159 | .name = "da9052-wled1", | ||
160 | .driver_data = DA9052_TYPE_WLED1, | ||
161 | }, | ||
162 | { | ||
163 | .name = "da9052-wled2", | ||
164 | .driver_data = DA9052_TYPE_WLED2, | ||
165 | }, | ||
166 | { | ||
167 | .name = "da9052-wled3", | ||
168 | .driver_data = DA9052_TYPE_WLED3, | ||
169 | }, | ||
170 | }; | ||
171 | |||
172 | static struct platform_driver da9052_wled_driver = { | ||
173 | .probe = da9052_backlight_probe, | ||
174 | .remove = da9052_backlight_remove, | ||
175 | .id_table = da9052_wled_ids, | ||
176 | .driver = { | ||
177 | .name = "da9052-wled", | ||
178 | .owner = THIS_MODULE, | ||
179 | }, | ||
180 | }; | ||
181 | |||
182 | module_platform_driver(da9052_wled_driver); | ||
183 | |||
184 | MODULE_AUTHOR("David Dajun Chen <dchen@diasemi.com>"); | ||
185 | MODULE_DESCRIPTION("Backlight driver for DA9052 PMIC"); | ||
186 | MODULE_LICENSE("GPL"); | ||
187 | MODULE_ALIAS("platform:da9052-backlight"); | ||
diff --git a/drivers/video/backlight/locomolcd.c b/drivers/video/backlight/locomolcd.c index be20b5cbe26c..3a6d5419e3e3 100644 --- a/drivers/video/backlight/locomolcd.c +++ b/drivers/video/backlight/locomolcd.c | |||
@@ -229,14 +229,7 @@ static struct locomo_driver poodle_lcd_driver = { | |||
229 | 229 | ||
230 | static int __init locomolcd_init(void) | 230 | static int __init locomolcd_init(void) |
231 | { | 231 | { |
232 | int ret = locomo_driver_register(&poodle_lcd_driver); | 232 | return locomo_driver_register(&poodle_lcd_driver); |
233 | if (ret) | ||
234 | return ret; | ||
235 | |||
236 | #ifdef CONFIG_SA1100_COLLIE | ||
237 | sa1100fb_lcd_power = locomolcd_power; | ||
238 | #endif | ||
239 | return 0; | ||
240 | } | 233 | } |
241 | 234 | ||
242 | static void __exit locomolcd_exit(void) | 235 | static void __exit locomolcd_exit(void) |
diff --git a/drivers/xen/swiotlb-xen.c b/drivers/xen/swiotlb-xen.c index 19e6a2041371..1afb4fba11b4 100644 --- a/drivers/xen/swiotlb-xen.c +++ b/drivers/xen/swiotlb-xen.c | |||
@@ -204,7 +204,8 @@ error: | |||
204 | 204 | ||
205 | void * | 205 | void * |
206 | xen_swiotlb_alloc_coherent(struct device *hwdev, size_t size, | 206 | xen_swiotlb_alloc_coherent(struct device *hwdev, size_t size, |
207 | dma_addr_t *dma_handle, gfp_t flags) | 207 | dma_addr_t *dma_handle, gfp_t flags, |
208 | struct dma_attrs *attrs) | ||
208 | { | 209 | { |
209 | void *ret; | 210 | void *ret; |
210 | int order = get_order(size); | 211 | int order = get_order(size); |
@@ -253,7 +254,7 @@ EXPORT_SYMBOL_GPL(xen_swiotlb_alloc_coherent); | |||
253 | 254 | ||
254 | void | 255 | void |
255 | xen_swiotlb_free_coherent(struct device *hwdev, size_t size, void *vaddr, | 256 | xen_swiotlb_free_coherent(struct device *hwdev, size_t size, void *vaddr, |
256 | dma_addr_t dev_addr) | 257 | dma_addr_t dev_addr, struct dma_attrs *attrs) |
257 | { | 258 | { |
258 | int order = get_order(size); | 259 | int order = get_order(size); |
259 | phys_addr_t phys; | 260 | phys_addr_t phys; |
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c index 8fecc99be344..f52c5ab78f9d 100644 --- a/fs/cifs/cifssmb.c +++ b/fs/cifs/cifssmb.c | |||
@@ -3892,13 +3892,12 @@ CIFSSMBSetCIFSACL(const int xid, struct cifs_tcon *tcon, __u16 fid, | |||
3892 | int rc = 0; | 3892 | int rc = 0; |
3893 | int bytes_returned = 0; | 3893 | int bytes_returned = 0; |
3894 | SET_SEC_DESC_REQ *pSMB = NULL; | 3894 | SET_SEC_DESC_REQ *pSMB = NULL; |
3895 | NTRANSACT_RSP *pSMBr = NULL; | 3895 | void *pSMBr; |
3896 | 3896 | ||
3897 | setCifsAclRetry: | 3897 | setCifsAclRetry: |
3898 | rc = smb_init(SMB_COM_NT_TRANSACT, 19, tcon, (void **) &pSMB, | 3898 | rc = smb_init(SMB_COM_NT_TRANSACT, 19, tcon, (void **) &pSMB, &pSMBr); |
3899 | (void **) &pSMBr); | ||
3900 | if (rc) | 3899 | if (rc) |
3901 | return (rc); | 3900 | return rc; |
3902 | 3901 | ||
3903 | pSMB->MaxSetupCount = 0; | 3902 | pSMB->MaxSetupCount = 0; |
3904 | pSMB->Reserved = 0; | 3903 | pSMB->Reserved = 0; |
@@ -3926,9 +3925,8 @@ setCifsAclRetry: | |||
3926 | pSMB->AclFlags = cpu_to_le32(aclflag); | 3925 | pSMB->AclFlags = cpu_to_le32(aclflag); |
3927 | 3926 | ||
3928 | if (pntsd && acllen) { | 3927 | if (pntsd && acllen) { |
3929 | memcpy((char *) &pSMBr->hdr.Protocol + data_offset, | 3928 | memcpy((char *)pSMBr + offsetof(struct smb_hdr, Protocol) + |
3930 | (char *) pntsd, | 3929 | data_offset, pntsd, acllen); |
3931 | acllen); | ||
3932 | inc_rfc1001_len(pSMB, byte_count + data_count); | 3930 | inc_rfc1001_len(pSMB, byte_count + data_count); |
3933 | } else | 3931 | } else |
3934 | inc_rfc1001_len(pSMB, byte_count); | 3932 | inc_rfc1001_len(pSMB, byte_count); |
@@ -5708,7 +5706,8 @@ CIFSSMBSetFileInfo(const int xid, struct cifs_tcon *tcon, | |||
5708 | param_offset = offsetof(struct smb_com_transaction2_sfi_req, Fid) - 4; | 5706 | param_offset = offsetof(struct smb_com_transaction2_sfi_req, Fid) - 4; |
5709 | offset = param_offset + params; | 5707 | offset = param_offset + params; |
5710 | 5708 | ||
5711 | data_offset = (char *) (&pSMB->hdr.Protocol) + offset; | 5709 | data_offset = (char *)pSMB + |
5710 | offsetof(struct smb_hdr, Protocol) + offset; | ||
5712 | 5711 | ||
5713 | count = sizeof(FILE_BASIC_INFO); | 5712 | count = sizeof(FILE_BASIC_INFO); |
5714 | pSMB->MaxParameterCount = cpu_to_le16(2); | 5713 | pSMB->MaxParameterCount = cpu_to_le16(2); |
@@ -5977,7 +5976,7 @@ CIFSSMBUnixSetFileInfo(const int xid, struct cifs_tcon *tcon, | |||
5977 | u16 fid, u32 pid_of_opener) | 5976 | u16 fid, u32 pid_of_opener) |
5978 | { | 5977 | { |
5979 | struct smb_com_transaction2_sfi_req *pSMB = NULL; | 5978 | struct smb_com_transaction2_sfi_req *pSMB = NULL; |
5980 | FILE_UNIX_BASIC_INFO *data_offset; | 5979 | char *data_offset; |
5981 | int rc = 0; | 5980 | int rc = 0; |
5982 | u16 params, param_offset, offset, byte_count, count; | 5981 | u16 params, param_offset, offset, byte_count, count; |
5983 | 5982 | ||
@@ -5999,8 +5998,9 @@ CIFSSMBUnixSetFileInfo(const int xid, struct cifs_tcon *tcon, | |||
5999 | param_offset = offsetof(struct smb_com_transaction2_sfi_req, Fid) - 4; | 5998 | param_offset = offsetof(struct smb_com_transaction2_sfi_req, Fid) - 4; |
6000 | offset = param_offset + params; | 5999 | offset = param_offset + params; |
6001 | 6000 | ||
6002 | data_offset = (FILE_UNIX_BASIC_INFO *) | 6001 | data_offset = (char *)pSMB + |
6003 | ((char *)(&pSMB->hdr.Protocol) + offset); | 6002 | offsetof(struct smb_hdr, Protocol) + offset; |
6003 | |||
6004 | count = sizeof(FILE_UNIX_BASIC_INFO); | 6004 | count = sizeof(FILE_UNIX_BASIC_INFO); |
6005 | 6005 | ||
6006 | pSMB->MaxParameterCount = cpu_to_le16(2); | 6006 | pSMB->MaxParameterCount = cpu_to_le16(2); |
@@ -6022,7 +6022,7 @@ CIFSSMBUnixSetFileInfo(const int xid, struct cifs_tcon *tcon, | |||
6022 | inc_rfc1001_len(pSMB, byte_count); | 6022 | inc_rfc1001_len(pSMB, byte_count); |
6023 | pSMB->ByteCount = cpu_to_le16(byte_count); | 6023 | pSMB->ByteCount = cpu_to_le16(byte_count); |
6024 | 6024 | ||
6025 | cifs_fill_unix_set_info(data_offset, args); | 6025 | cifs_fill_unix_set_info((FILE_UNIX_BASIC_INFO *)data_offset, args); |
6026 | 6026 | ||
6027 | rc = SendReceiveNoRsp(xid, tcon->ses, (char *) pSMB, 0); | 6027 | rc = SendReceiveNoRsp(xid, tcon->ses, (char *) pSMB, 0); |
6028 | if (rc) | 6028 | if (rc) |
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index 302a15c505a9..d81e933a796b 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c | |||
@@ -1565,8 +1565,7 @@ cifs_parse_mount_options(const char *mountdata, const char *devname, | |||
1565 | 1565 | ||
1566 | /* Obtain the value string */ | 1566 | /* Obtain the value string */ |
1567 | value = strchr(data, '='); | 1567 | value = strchr(data, '='); |
1568 | if (value != NULL) | 1568 | value++; |
1569 | *value++ = '\0'; | ||
1570 | 1569 | ||
1571 | /* Set tmp_end to end of the string */ | 1570 | /* Set tmp_end to end of the string */ |
1572 | tmp_end = (char *) value + strlen(value); | 1571 | tmp_end = (char *) value + strlen(value); |
@@ -1649,6 +1648,13 @@ cifs_parse_mount_options(const char *mountdata, const char *devname, | |||
1649 | goto cifs_parse_mount_err; | 1648 | goto cifs_parse_mount_err; |
1650 | } | 1649 | } |
1651 | 1650 | ||
1651 | vol->UNC = kmalloc(temp_len+1, GFP_KERNEL); | ||
1652 | if (vol->UNC == NULL) { | ||
1653 | printk(KERN_WARNING "CIFS: no memory for UNC\n"); | ||
1654 | goto cifs_parse_mount_err; | ||
1655 | } | ||
1656 | strcpy(vol->UNC, string); | ||
1657 | |||
1652 | if (strncmp(string, "//", 2) == 0) { | 1658 | if (strncmp(string, "//", 2) == 0) { |
1653 | vol->UNC[0] = '\\'; | 1659 | vol->UNC[0] = '\\'; |
1654 | vol->UNC[1] = '\\'; | 1660 | vol->UNC[1] = '\\'; |
@@ -1658,13 +1664,6 @@ cifs_parse_mount_options(const char *mountdata, const char *devname, | |||
1658 | goto cifs_parse_mount_err; | 1664 | goto cifs_parse_mount_err; |
1659 | } | 1665 | } |
1660 | 1666 | ||
1661 | vol->UNC = kmalloc(temp_len+1, GFP_KERNEL); | ||
1662 | if (vol->UNC == NULL) { | ||
1663 | printk(KERN_WARNING "CIFS: no memory " | ||
1664 | "for UNC\n"); | ||
1665 | goto cifs_parse_mount_err; | ||
1666 | } | ||
1667 | strcpy(vol->UNC, string); | ||
1668 | break; | 1667 | break; |
1669 | case Opt_domain: | 1668 | case Opt_domain: |
1670 | string = match_strdup(args); | 1669 | string = match_strdup(args); |
diff --git a/fs/cifs/file.c b/fs/cifs/file.c index 460d87b7cda0..fae765dac934 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c | |||
@@ -835,13 +835,21 @@ cifs_posix_lock_set(struct file *file, struct file_lock *flock) | |||
835 | if ((flock->fl_flags & FL_POSIX) == 0) | 835 | if ((flock->fl_flags & FL_POSIX) == 0) |
836 | return rc; | 836 | return rc; |
837 | 837 | ||
838 | try_again: | ||
838 | mutex_lock(&cinode->lock_mutex); | 839 | mutex_lock(&cinode->lock_mutex); |
839 | if (!cinode->can_cache_brlcks) { | 840 | if (!cinode->can_cache_brlcks) { |
840 | mutex_unlock(&cinode->lock_mutex); | 841 | mutex_unlock(&cinode->lock_mutex); |
841 | return rc; | 842 | return rc; |
842 | } | 843 | } |
843 | rc = posix_lock_file_wait(file, flock); | 844 | |
845 | rc = posix_lock_file(file, flock, NULL); | ||
844 | mutex_unlock(&cinode->lock_mutex); | 846 | mutex_unlock(&cinode->lock_mutex); |
847 | if (rc == FILE_LOCK_DEFERRED) { | ||
848 | rc = wait_event_interruptible(flock->fl_wait, !flock->fl_next); | ||
849 | if (!rc) | ||
850 | goto try_again; | ||
851 | locks_delete_block(flock); | ||
852 | } | ||
845 | return rc; | 853 | return rc; |
846 | } | 854 | } |
847 | 855 | ||
diff --git a/fs/cifs/netmisc.c b/fs/cifs/netmisc.c index dd23a321bdda..581c225f7f50 100644 --- a/fs/cifs/netmisc.c +++ b/fs/cifs/netmisc.c | |||
@@ -197,8 +197,7 @@ cifs_convert_address(struct sockaddr *dst, const char *src, int len) | |||
197 | memcpy(scope_id, pct + 1, slen); | 197 | memcpy(scope_id, pct + 1, slen); |
198 | scope_id[slen] = '\0'; | 198 | scope_id[slen] = '\0'; |
199 | 199 | ||
200 | rc = strict_strtoul(scope_id, 0, | 200 | rc = kstrtouint(scope_id, 0, &s6->sin6_scope_id); |
201 | (unsigned long *)&s6->sin6_scope_id); | ||
202 | rc = (rc == 0) ? 1 : 0; | 201 | rc = (rc == 0) ? 1 : 0; |
203 | } | 202 | } |
204 | 203 | ||
diff --git a/fs/debugfs/file.c b/fs/debugfs/file.c index 21e93605161c..5dfafdd1dbd3 100644 --- a/fs/debugfs/file.c +++ b/fs/debugfs/file.c | |||
@@ -33,18 +33,10 @@ static ssize_t default_write_file(struct file *file, const char __user *buf, | |||
33 | return count; | 33 | return count; |
34 | } | 34 | } |
35 | 35 | ||
36 | static int default_open(struct inode *inode, struct file *file) | ||
37 | { | ||
38 | if (inode->i_private) | ||
39 | file->private_data = inode->i_private; | ||
40 | |||
41 | return 0; | ||
42 | } | ||
43 | |||
44 | const struct file_operations debugfs_file_operations = { | 36 | const struct file_operations debugfs_file_operations = { |
45 | .read = default_read_file, | 37 | .read = default_read_file, |
46 | .write = default_write_file, | 38 | .write = default_write_file, |
47 | .open = default_open, | 39 | .open = simple_open, |
48 | .llseek = noop_llseek, | 40 | .llseek = noop_llseek, |
49 | }; | 41 | }; |
50 | 42 | ||
@@ -447,7 +439,7 @@ static ssize_t write_file_bool(struct file *file, const char __user *user_buf, | |||
447 | static const struct file_operations fops_bool = { | 439 | static const struct file_operations fops_bool = { |
448 | .read = read_file_bool, | 440 | .read = read_file_bool, |
449 | .write = write_file_bool, | 441 | .write = write_file_bool, |
450 | .open = default_open, | 442 | .open = simple_open, |
451 | .llseek = default_llseek, | 443 | .llseek = default_llseek, |
452 | }; | 444 | }; |
453 | 445 | ||
@@ -492,7 +484,7 @@ static ssize_t read_file_blob(struct file *file, char __user *user_buf, | |||
492 | 484 | ||
493 | static const struct file_operations fops_blob = { | 485 | static const struct file_operations fops_blob = { |
494 | .read = read_file_blob, | 486 | .read = read_file_blob, |
495 | .open = default_open, | 487 | .open = simple_open, |
496 | .llseek = default_llseek, | 488 | .llseek = default_llseek, |
497 | }; | 489 | }; |
498 | 490 | ||
diff --git a/fs/dlm/debug_fs.c b/fs/dlm/debug_fs.c index 3dca2b39e83f..1c9b08095f98 100644 --- a/fs/dlm/debug_fs.c +++ b/fs/dlm/debug_fs.c | |||
@@ -609,13 +609,6 @@ static const struct file_operations format3_fops = { | |||
609 | /* | 609 | /* |
610 | * dump lkb's on the ls_waiters list | 610 | * dump lkb's on the ls_waiters list |
611 | */ | 611 | */ |
612 | |||
613 | static int waiters_open(struct inode *inode, struct file *file) | ||
614 | { | ||
615 | file->private_data = inode->i_private; | ||
616 | return 0; | ||
617 | } | ||
618 | |||
619 | static ssize_t waiters_read(struct file *file, char __user *userbuf, | 612 | static ssize_t waiters_read(struct file *file, char __user *userbuf, |
620 | size_t count, loff_t *ppos) | 613 | size_t count, loff_t *ppos) |
621 | { | 614 | { |
@@ -644,7 +637,7 @@ static ssize_t waiters_read(struct file *file, char __user *userbuf, | |||
644 | 637 | ||
645 | static const struct file_operations waiters_fops = { | 638 | static const struct file_operations waiters_fops = { |
646 | .owner = THIS_MODULE, | 639 | .owner = THIS_MODULE, |
647 | .open = waiters_open, | 640 | .open = simple_open, |
648 | .read = waiters_read, | 641 | .read = waiters_read, |
649 | .llseek = default_llseek, | 642 | .llseek = default_llseek, |
650 | }; | 643 | }; |
@@ -1371,7 +1371,7 @@ int search_binary_handler(struct linux_binprm *bprm,struct pt_regs *regs) | |||
1371 | unsigned int depth = bprm->recursion_depth; | 1371 | unsigned int depth = bprm->recursion_depth; |
1372 | int try,retval; | 1372 | int try,retval; |
1373 | struct linux_binfmt *fmt; | 1373 | struct linux_binfmt *fmt; |
1374 | pid_t old_pid; | 1374 | pid_t old_pid, old_vpid; |
1375 | 1375 | ||
1376 | retval = security_bprm_check(bprm); | 1376 | retval = security_bprm_check(bprm); |
1377 | if (retval) | 1377 | if (retval) |
@@ -1382,8 +1382,9 @@ int search_binary_handler(struct linux_binprm *bprm,struct pt_regs *regs) | |||
1382 | return retval; | 1382 | return retval; |
1383 | 1383 | ||
1384 | /* Need to fetch pid before load_binary changes it */ | 1384 | /* Need to fetch pid before load_binary changes it */ |
1385 | old_pid = current->pid; | ||
1385 | rcu_read_lock(); | 1386 | rcu_read_lock(); |
1386 | old_pid = task_pid_nr_ns(current, task_active_pid_ns(current->parent)); | 1387 | old_vpid = task_pid_nr_ns(current, task_active_pid_ns(current->parent)); |
1387 | rcu_read_unlock(); | 1388 | rcu_read_unlock(); |
1388 | 1389 | ||
1389 | retval = -ENOENT; | 1390 | retval = -ENOENT; |
@@ -1406,7 +1407,7 @@ int search_binary_handler(struct linux_binprm *bprm,struct pt_regs *regs) | |||
1406 | if (retval >= 0) { | 1407 | if (retval >= 0) { |
1407 | if (depth == 0) { | 1408 | if (depth == 0) { |
1408 | trace_sched_process_exec(current, old_pid, bprm); | 1409 | trace_sched_process_exec(current, old_pid, bprm); |
1409 | ptrace_event(PTRACE_EVENT_EXEC, old_pid); | 1410 | ptrace_event(PTRACE_EVENT_EXEC, old_vpid); |
1410 | } | 1411 | } |
1411 | put_binfmt(fmt); | 1412 | put_binfmt(fmt); |
1412 | allow_write_access(bprm->file); | 1413 | allow_write_access(bprm->file); |
diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c index ea251749d9d5..28cf06e4ec84 100644 --- a/fs/hugetlbfs/inode.c +++ b/fs/hugetlbfs/inode.c | |||
@@ -1031,7 +1031,6 @@ static int __init init_hugetlbfs_fs(void) | |||
1031 | } | 1031 | } |
1032 | 1032 | ||
1033 | error = PTR_ERR(vfsmount); | 1033 | error = PTR_ERR(vfsmount); |
1034 | unregister_filesystem(&hugetlbfs_fs_type); | ||
1035 | 1034 | ||
1036 | out: | 1035 | out: |
1037 | kmem_cache_destroy(hugetlbfs_inode_cachep); | 1036 | kmem_cache_destroy(hugetlbfs_inode_cachep); |
diff --git a/fs/libfs.c b/fs/libfs.c index 4a0d1f06da57..358094f0433d 100644 --- a/fs/libfs.c +++ b/fs/libfs.c | |||
@@ -264,6 +264,13 @@ Enomem: | |||
264 | return ERR_PTR(-ENOMEM); | 264 | return ERR_PTR(-ENOMEM); |
265 | } | 265 | } |
266 | 266 | ||
267 | int simple_open(struct inode *inode, struct file *file) | ||
268 | { | ||
269 | if (inode->i_private) | ||
270 | file->private_data = inode->i_private; | ||
271 | return 0; | ||
272 | } | ||
273 | |||
267 | int simple_link(struct dentry *old_dentry, struct inode *dir, struct dentry *dentry) | 274 | int simple_link(struct dentry *old_dentry, struct inode *dir, struct dentry *dentry) |
268 | { | 275 | { |
269 | struct inode *inode = old_dentry->d_inode; | 276 | struct inode *inode = old_dentry->d_inode; |
@@ -984,6 +991,7 @@ EXPORT_SYMBOL(simple_dir_operations); | |||
984 | EXPORT_SYMBOL(simple_empty); | 991 | EXPORT_SYMBOL(simple_empty); |
985 | EXPORT_SYMBOL(simple_fill_super); | 992 | EXPORT_SYMBOL(simple_fill_super); |
986 | EXPORT_SYMBOL(simple_getattr); | 993 | EXPORT_SYMBOL(simple_getattr); |
994 | EXPORT_SYMBOL(simple_open); | ||
987 | EXPORT_SYMBOL(simple_link); | 995 | EXPORT_SYMBOL(simple_link); |
988 | EXPORT_SYMBOL(simple_lookup); | 996 | EXPORT_SYMBOL(simple_lookup); |
989 | EXPORT_SYMBOL(simple_pin_fs); | 997 | EXPORT_SYMBOL(simple_pin_fs); |
diff --git a/fs/locks.c b/fs/locks.c index 637694bf3a03..0d68f1f81799 100644 --- a/fs/locks.c +++ b/fs/locks.c | |||
@@ -510,12 +510,13 @@ static void __locks_delete_block(struct file_lock *waiter) | |||
510 | 510 | ||
511 | /* | 511 | /* |
512 | */ | 512 | */ |
513 | static void locks_delete_block(struct file_lock *waiter) | 513 | void locks_delete_block(struct file_lock *waiter) |
514 | { | 514 | { |
515 | lock_flocks(); | 515 | lock_flocks(); |
516 | __locks_delete_block(waiter); | 516 | __locks_delete_block(waiter); |
517 | unlock_flocks(); | 517 | unlock_flocks(); |
518 | } | 518 | } |
519 | EXPORT_SYMBOL(locks_delete_block); | ||
519 | 520 | ||
520 | /* Insert waiter into blocker's block list. | 521 | /* Insert waiter into blocker's block list. |
521 | * We use a circular list so that processes can be easily woken up in | 522 | * We use a circular list so that processes can be easily woken up in |
diff --git a/fs/namei.c b/fs/namei.c index 1898198abc3d..0062dd17eb55 100644 --- a/fs/namei.c +++ b/fs/namei.c | |||
@@ -1407,18 +1407,9 @@ static inline int can_lookup(struct inode *inode) | |||
1407 | */ | 1407 | */ |
1408 | #ifdef CONFIG_DCACHE_WORD_ACCESS | 1408 | #ifdef CONFIG_DCACHE_WORD_ACCESS |
1409 | 1409 | ||
1410 | #ifdef CONFIG_64BIT | 1410 | #include <asm/word-at-a-time.h> |
1411 | 1411 | ||
1412 | /* | 1412 | #ifdef CONFIG_64BIT |
1413 | * Jan Achrenius on G+: microoptimized version of | ||
1414 | * the simpler "(mask & ONEBYTES) * ONEBYTES >> 56" | ||
1415 | * that works for the bytemasks without having to | ||
1416 | * mask them first. | ||
1417 | */ | ||
1418 | static inline long count_masked_bytes(unsigned long mask) | ||
1419 | { | ||
1420 | return mask*0x0001020304050608ul >> 56; | ||
1421 | } | ||
1422 | 1413 | ||
1423 | static inline unsigned int fold_hash(unsigned long hash) | 1414 | static inline unsigned int fold_hash(unsigned long hash) |
1424 | { | 1415 | { |
@@ -1428,15 +1419,6 @@ static inline unsigned int fold_hash(unsigned long hash) | |||
1428 | 1419 | ||
1429 | #else /* 32-bit case */ | 1420 | #else /* 32-bit case */ |
1430 | 1421 | ||
1431 | /* Carl Chatfield / Jan Achrenius G+ version for 32-bit */ | ||
1432 | static inline long count_masked_bytes(long mask) | ||
1433 | { | ||
1434 | /* (000000 0000ff 00ffff ffffff) -> ( 1 1 2 3 ) */ | ||
1435 | long a = (0x0ff0001+mask) >> 23; | ||
1436 | /* Fix the 1 for 00 case */ | ||
1437 | return a & mask; | ||
1438 | } | ||
1439 | |||
1440 | #define fold_hash(x) (x) | 1422 | #define fold_hash(x) (x) |
1441 | 1423 | ||
1442 | #endif | 1424 | #endif |
@@ -1464,17 +1446,6 @@ done: | |||
1464 | } | 1446 | } |
1465 | EXPORT_SYMBOL(full_name_hash); | 1447 | EXPORT_SYMBOL(full_name_hash); |
1466 | 1448 | ||
1467 | #define REPEAT_BYTE(x) ((~0ul / 0xff) * (x)) | ||
1468 | #define ONEBYTES REPEAT_BYTE(0x01) | ||
1469 | #define SLASHBYTES REPEAT_BYTE('/') | ||
1470 | #define HIGHBITS REPEAT_BYTE(0x80) | ||
1471 | |||
1472 | /* Return the high bit set in the first byte that is a zero */ | ||
1473 | static inline unsigned long has_zero(unsigned long a) | ||
1474 | { | ||
1475 | return ((a - ONEBYTES) & ~a) & HIGHBITS; | ||
1476 | } | ||
1477 | |||
1478 | /* | 1449 | /* |
1479 | * Calculate the length and hash of the path component, and | 1450 | * Calculate the length and hash of the path component, and |
1480 | * return the length of the component; | 1451 | * return the length of the component; |
@@ -1490,7 +1461,7 @@ static inline unsigned long hash_name(const char *name, unsigned int *hashp) | |||
1490 | len += sizeof(unsigned long); | 1461 | len += sizeof(unsigned long); |
1491 | a = *(unsigned long *)(name+len); | 1462 | a = *(unsigned long *)(name+len); |
1492 | /* Do we have any NUL or '/' bytes in this word? */ | 1463 | /* Do we have any NUL or '/' bytes in this word? */ |
1493 | mask = has_zero(a) | has_zero(a ^ SLASHBYTES); | 1464 | mask = has_zero(a) | has_zero(a ^ REPEAT_BYTE('/')); |
1494 | } while (!mask); | 1465 | } while (!mask); |
1495 | 1466 | ||
1496 | /* The mask *below* the first high bit set */ | 1467 | /* The mask *below* the first high bit set */ |
diff --git a/fs/proc/root.c b/fs/proc/root.c index 46a15d8a29ca..eed44bfc85db 100644 --- a/fs/proc/root.c +++ b/fs/proc/root.c | |||
@@ -115,12 +115,13 @@ static struct dentry *proc_mount(struct file_system_type *fs_type, | |||
115 | if (IS_ERR(sb)) | 115 | if (IS_ERR(sb)) |
116 | return ERR_CAST(sb); | 116 | return ERR_CAST(sb); |
117 | 117 | ||
118 | if (!proc_parse_options(options, ns)) { | ||
119 | deactivate_locked_super(sb); | ||
120 | return ERR_PTR(-EINVAL); | ||
121 | } | ||
122 | |||
118 | if (!sb->s_root) { | 123 | if (!sb->s_root) { |
119 | sb->s_flags = flags; | 124 | sb->s_flags = flags; |
120 | if (!proc_parse_options(options, ns)) { | ||
121 | deactivate_locked_super(sb); | ||
122 | return ERR_PTR(-EINVAL); | ||
123 | } | ||
124 | err = proc_fill_super(sb); | 125 | err = proc_fill_super(sb); |
125 | if (err) { | 126 | if (err) { |
126 | deactivate_locked_super(sb); | 127 | deactivate_locked_super(sb); |
diff --git a/fs/pstore/inode.c b/fs/pstore/inode.c index 50952c9bd06c..19507889bb7f 100644 --- a/fs/pstore/inode.c +++ b/fs/pstore/inode.c | |||
@@ -52,12 +52,6 @@ struct pstore_private { | |||
52 | char data[]; | 52 | char data[]; |
53 | }; | 53 | }; |
54 | 54 | ||
55 | static int pstore_file_open(struct inode *inode, struct file *file) | ||
56 | { | ||
57 | file->private_data = inode->i_private; | ||
58 | return 0; | ||
59 | } | ||
60 | |||
61 | static ssize_t pstore_file_read(struct file *file, char __user *userbuf, | 55 | static ssize_t pstore_file_read(struct file *file, char __user *userbuf, |
62 | size_t count, loff_t *ppos) | 56 | size_t count, loff_t *ppos) |
63 | { | 57 | { |
@@ -67,7 +61,7 @@ static ssize_t pstore_file_read(struct file *file, char __user *userbuf, | |||
67 | } | 61 | } |
68 | 62 | ||
69 | static const struct file_operations pstore_file_operations = { | 63 | static const struct file_operations pstore_file_operations = { |
70 | .open = pstore_file_open, | 64 | .open = simple_open, |
71 | .read = pstore_file_read, | 65 | .read = pstore_file_read, |
72 | .llseek = default_llseek, | 66 | .llseek = default_llseek, |
73 | }; | 67 | }; |
diff --git a/fs/splice.c b/fs/splice.c index 5f883de7ef3a..f8476841eb04 100644 --- a/fs/splice.c +++ b/fs/splice.c | |||
@@ -30,6 +30,7 @@ | |||
30 | #include <linux/uio.h> | 30 | #include <linux/uio.h> |
31 | #include <linux/security.h> | 31 | #include <linux/security.h> |
32 | #include <linux/gfp.h> | 32 | #include <linux/gfp.h> |
33 | #include <linux/socket.h> | ||
33 | 34 | ||
34 | /* | 35 | /* |
35 | * Attempt to steal a page from a pipe buffer. This should perhaps go into | 36 | * Attempt to steal a page from a pipe buffer. This should perhaps go into |
@@ -690,7 +691,9 @@ static int pipe_to_sendpage(struct pipe_inode_info *pipe, | |||
690 | if (!likely(file->f_op && file->f_op->sendpage)) | 691 | if (!likely(file->f_op && file->f_op->sendpage)) |
691 | return -EINVAL; | 692 | return -EINVAL; |
692 | 693 | ||
693 | more = (sd->flags & SPLICE_F_MORE) || sd->len < sd->total_len; | 694 | more = (sd->flags & SPLICE_F_MORE) ? MSG_MORE : 0; |
695 | if (sd->len < sd->total_len) | ||
696 | more |= MSG_SENDPAGE_NOTLAST; | ||
694 | return file->f_op->sendpage(file, buf->page, buf->offset, | 697 | return file->f_op->sendpage(file, buf->page, buf->offset, |
695 | sd->len, &pos, more); | 698 | sd->len, &pos, more); |
696 | } | 699 | } |
diff --git a/fs/xattr.c b/fs/xattr.c index d6dfd247bb2f..3c8c1cc333c7 100644 --- a/fs/xattr.c +++ b/fs/xattr.c | |||
@@ -19,8 +19,9 @@ | |||
19 | #include <linux/export.h> | 19 | #include <linux/export.h> |
20 | #include <linux/fsnotify.h> | 20 | #include <linux/fsnotify.h> |
21 | #include <linux/audit.h> | 21 | #include <linux/audit.h> |
22 | #include <asm/uaccess.h> | 22 | #include <linux/vmalloc.h> |
23 | 23 | ||
24 | #include <asm/uaccess.h> | ||
24 | 25 | ||
25 | /* | 26 | /* |
26 | * Check permissions for extended attribute access. This is a bit complicated | 27 | * Check permissions for extended attribute access. This is a bit complicated |
@@ -320,6 +321,7 @@ setxattr(struct dentry *d, const char __user *name, const void __user *value, | |||
320 | { | 321 | { |
321 | int error; | 322 | int error; |
322 | void *kvalue = NULL; | 323 | void *kvalue = NULL; |
324 | void *vvalue = NULL; /* If non-NULL, we used vmalloc() */ | ||
323 | char kname[XATTR_NAME_MAX + 1]; | 325 | char kname[XATTR_NAME_MAX + 1]; |
324 | 326 | ||
325 | if (flags & ~(XATTR_CREATE|XATTR_REPLACE)) | 327 | if (flags & ~(XATTR_CREATE|XATTR_REPLACE)) |
@@ -334,13 +336,25 @@ setxattr(struct dentry *d, const char __user *name, const void __user *value, | |||
334 | if (size) { | 336 | if (size) { |
335 | if (size > XATTR_SIZE_MAX) | 337 | if (size > XATTR_SIZE_MAX) |
336 | return -E2BIG; | 338 | return -E2BIG; |
337 | kvalue = memdup_user(value, size); | 339 | kvalue = kmalloc(size, GFP_KERNEL | __GFP_NOWARN); |
338 | if (IS_ERR(kvalue)) | 340 | if (!kvalue) { |
339 | return PTR_ERR(kvalue); | 341 | vvalue = vmalloc(size); |
342 | if (!vvalue) | ||
343 | return -ENOMEM; | ||
344 | kvalue = vvalue; | ||
345 | } | ||
346 | if (copy_from_user(kvalue, value, size)) { | ||
347 | error = -EFAULT; | ||
348 | goto out; | ||
349 | } | ||
340 | } | 350 | } |
341 | 351 | ||
342 | error = vfs_setxattr(d, kname, kvalue, size, flags); | 352 | error = vfs_setxattr(d, kname, kvalue, size, flags); |
343 | kfree(kvalue); | 353 | out: |
354 | if (vvalue) | ||
355 | vfree(vvalue); | ||
356 | else | ||
357 | kfree(kvalue); | ||
344 | return error; | 358 | return error; |
345 | } | 359 | } |
346 | 360 | ||
@@ -492,13 +506,18 @@ listxattr(struct dentry *d, char __user *list, size_t size) | |||
492 | { | 506 | { |
493 | ssize_t error; | 507 | ssize_t error; |
494 | char *klist = NULL; | 508 | char *klist = NULL; |
509 | char *vlist = NULL; /* If non-NULL, we used vmalloc() */ | ||
495 | 510 | ||
496 | if (size) { | 511 | if (size) { |
497 | if (size > XATTR_LIST_MAX) | 512 | if (size > XATTR_LIST_MAX) |
498 | size = XATTR_LIST_MAX; | 513 | size = XATTR_LIST_MAX; |
499 | klist = kmalloc(size, GFP_KERNEL); | 514 | klist = kmalloc(size, __GFP_NOWARN | GFP_KERNEL); |
500 | if (!klist) | 515 | if (!klist) { |
501 | return -ENOMEM; | 516 | vlist = vmalloc(size); |
517 | if (!vlist) | ||
518 | return -ENOMEM; | ||
519 | klist = vlist; | ||
520 | } | ||
502 | } | 521 | } |
503 | 522 | ||
504 | error = vfs_listxattr(d, klist, size); | 523 | error = vfs_listxattr(d, klist, size); |
@@ -510,7 +529,10 @@ listxattr(struct dentry *d, char __user *list, size_t size) | |||
510 | than XATTR_LIST_MAX bytes. Not possible. */ | 529 | than XATTR_LIST_MAX bytes. Not possible. */ |
511 | error = -E2BIG; | 530 | error = -E2BIG; |
512 | } | 531 | } |
513 | kfree(klist); | 532 | if (vlist) |
533 | vfree(vlist); | ||
534 | else | ||
535 | kfree(klist); | ||
514 | return error; | 536 | return error; |
515 | } | 537 | } |
516 | 538 | ||
diff --git a/include/asm-generic/cmpxchg.h b/include/asm-generic/cmpxchg.h index 8a361834dc25..14883026015d 100644 --- a/include/asm-generic/cmpxchg.h +++ b/include/asm-generic/cmpxchg.h | |||
@@ -10,6 +10,7 @@ | |||
10 | #error "Cannot use generic cmpxchg on SMP" | 10 | #error "Cannot use generic cmpxchg on SMP" |
11 | #endif | 11 | #endif |
12 | 12 | ||
13 | #include <linux/types.h> | ||
13 | #include <linux/irqflags.h> | 14 | #include <linux/irqflags.h> |
14 | 15 | ||
15 | #ifndef xchg | 16 | #ifndef xchg |
diff --git a/include/crypto/internal/aead.h b/include/crypto/internal/aead.h index d838c945575a..2eba340230a7 100644 --- a/include/crypto/internal/aead.h +++ b/include/crypto/internal/aead.h | |||
@@ -31,6 +31,8 @@ static inline void crypto_set_aead_spawn( | |||
31 | crypto_set_spawn(&spawn->base, inst); | 31 | crypto_set_spawn(&spawn->base, inst); |
32 | } | 32 | } |
33 | 33 | ||
34 | struct crypto_alg *crypto_lookup_aead(const char *name, u32 type, u32 mask); | ||
35 | |||
34 | int crypto_grab_aead(struct crypto_aead_spawn *spawn, const char *name, | 36 | int crypto_grab_aead(struct crypto_aead_spawn *spawn, const char *name, |
35 | u32 type, u32 mask); | 37 | u32 type, u32 mask); |
36 | 38 | ||
diff --git a/include/crypto/internal/skcipher.h b/include/crypto/internal/skcipher.h index 3a748a6bf772..06e8b32d541c 100644 --- a/include/crypto/internal/skcipher.h +++ b/include/crypto/internal/skcipher.h | |||
@@ -34,6 +34,8 @@ static inline void crypto_set_skcipher_spawn( | |||
34 | int crypto_grab_skcipher(struct crypto_skcipher_spawn *spawn, const char *name, | 34 | int crypto_grab_skcipher(struct crypto_skcipher_spawn *spawn, const char *name, |
35 | u32 type, u32 mask); | 35 | u32 type, u32 mask); |
36 | 36 | ||
37 | struct crypto_alg *crypto_lookup_skcipher(const char *name, u32 type, u32 mask); | ||
38 | |||
37 | static inline void crypto_drop_skcipher(struct crypto_skcipher_spawn *spawn) | 39 | static inline void crypto_drop_skcipher(struct crypto_skcipher_spawn *spawn) |
38 | { | 40 | { |
39 | crypto_drop_spawn(&spawn->base); | 41 | crypto_drop_spawn(&spawn->base); |
diff --git a/include/drm/drm.h b/include/drm/drm.h index 34a7b89fd006..64ff02d5b730 100644 --- a/include/drm/drm.h +++ b/include/drm/drm.h | |||
@@ -617,6 +617,17 @@ struct drm_get_cap { | |||
617 | __u64 value; | 617 | __u64 value; |
618 | }; | 618 | }; |
619 | 619 | ||
620 | #define DRM_CLOEXEC O_CLOEXEC | ||
621 | struct drm_prime_handle { | ||
622 | __u32 handle; | ||
623 | |||
624 | /** Flags.. only applicable for handle->fd */ | ||
625 | __u32 flags; | ||
626 | |||
627 | /** Returned dmabuf file descriptor */ | ||
628 | __s32 fd; | ||
629 | }; | ||
630 | |||
620 | #include "drm_mode.h" | 631 | #include "drm_mode.h" |
621 | 632 | ||
622 | #define DRM_IOCTL_BASE 'd' | 633 | #define DRM_IOCTL_BASE 'd' |
@@ -673,7 +684,8 @@ struct drm_get_cap { | |||
673 | #define DRM_IOCTL_UNLOCK DRM_IOW( 0x2b, struct drm_lock) | 684 | #define DRM_IOCTL_UNLOCK DRM_IOW( 0x2b, struct drm_lock) |
674 | #define DRM_IOCTL_FINISH DRM_IOW( 0x2c, struct drm_lock) | 685 | #define DRM_IOCTL_FINISH DRM_IOW( 0x2c, struct drm_lock) |
675 | 686 | ||
676 | #define DRM_IOCTL_GEM_PRIME_OPEN DRM_IOWR(0x2e, struct drm_gem_open) | 687 | #define DRM_IOCTL_PRIME_HANDLE_TO_FD DRM_IOWR(0x2d, struct drm_prime_handle) |
688 | #define DRM_IOCTL_PRIME_FD_TO_HANDLE DRM_IOWR(0x2e, struct drm_prime_handle) | ||
677 | 689 | ||
678 | #define DRM_IOCTL_AGP_ACQUIRE DRM_IO( 0x30) | 690 | #define DRM_IOCTL_AGP_ACQUIRE DRM_IO( 0x30) |
679 | #define DRM_IOCTL_AGP_RELEASE DRM_IO( 0x31) | 691 | #define DRM_IOCTL_AGP_RELEASE DRM_IO( 0x31) |
diff --git a/include/drm/drmP.h b/include/drm/drmP.h index 574bd1c81ebd..dd731043fecd 100644 --- a/include/drm/drmP.h +++ b/include/drm/drmP.h | |||
@@ -91,6 +91,7 @@ struct drm_device; | |||
91 | #define DRM_UT_CORE 0x01 | 91 | #define DRM_UT_CORE 0x01 |
92 | #define DRM_UT_DRIVER 0x02 | 92 | #define DRM_UT_DRIVER 0x02 |
93 | #define DRM_UT_KMS 0x04 | 93 | #define DRM_UT_KMS 0x04 |
94 | #define DRM_UT_PRIME 0x08 | ||
94 | /* | 95 | /* |
95 | * Three debug levels are defined. | 96 | * Three debug levels are defined. |
96 | * drm_core, drm_driver, drm_kms | 97 | * drm_core, drm_driver, drm_kms |
@@ -150,6 +151,7 @@ int drm_err(const char *func, const char *format, ...); | |||
150 | #define DRIVER_IRQ_VBL2 0x800 | 151 | #define DRIVER_IRQ_VBL2 0x800 |
151 | #define DRIVER_GEM 0x1000 | 152 | #define DRIVER_GEM 0x1000 |
152 | #define DRIVER_MODESET 0x2000 | 153 | #define DRIVER_MODESET 0x2000 |
154 | #define DRIVER_PRIME 0x4000 | ||
153 | 155 | ||
154 | #define DRIVER_BUS_PCI 0x1 | 156 | #define DRIVER_BUS_PCI 0x1 |
155 | #define DRIVER_BUS_PLATFORM 0x2 | 157 | #define DRIVER_BUS_PLATFORM 0x2 |
@@ -215,6 +217,11 @@ int drm_err(const char *func, const char *format, ...); | |||
215 | drm_ut_debug_printk(DRM_UT_KMS, DRM_NAME, \ | 217 | drm_ut_debug_printk(DRM_UT_KMS, DRM_NAME, \ |
216 | __func__, fmt, ##args); \ | 218 | __func__, fmt, ##args); \ |
217 | } while (0) | 219 | } while (0) |
220 | #define DRM_DEBUG_PRIME(fmt, args...) \ | ||
221 | do { \ | ||
222 | drm_ut_debug_printk(DRM_UT_PRIME, DRM_NAME, \ | ||
223 | __func__, fmt, ##args); \ | ||
224 | } while (0) | ||
218 | #define DRM_LOG(fmt, args...) \ | 225 | #define DRM_LOG(fmt, args...) \ |
219 | do { \ | 226 | do { \ |
220 | drm_ut_debug_printk(DRM_UT_CORE, NULL, \ | 227 | drm_ut_debug_printk(DRM_UT_CORE, NULL, \ |
@@ -238,6 +245,7 @@ int drm_err(const char *func, const char *format, ...); | |||
238 | #else | 245 | #else |
239 | #define DRM_DEBUG_DRIVER(fmt, args...) do { } while (0) | 246 | #define DRM_DEBUG_DRIVER(fmt, args...) do { } while (0) |
240 | #define DRM_DEBUG_KMS(fmt, args...) do { } while (0) | 247 | #define DRM_DEBUG_KMS(fmt, args...) do { } while (0) |
248 | #define DRM_DEBUG_PRIME(fmt, args...) do { } while (0) | ||
241 | #define DRM_DEBUG(fmt, arg...) do { } while (0) | 249 | #define DRM_DEBUG(fmt, arg...) do { } while (0) |
242 | #define DRM_LOG(fmt, arg...) do { } while (0) | 250 | #define DRM_LOG(fmt, arg...) do { } while (0) |
243 | #define DRM_LOG_KMS(fmt, args...) do { } while (0) | 251 | #define DRM_LOG_KMS(fmt, args...) do { } while (0) |
@@ -410,6 +418,12 @@ struct drm_pending_event { | |||
410 | void (*destroy)(struct drm_pending_event *event); | 418 | void (*destroy)(struct drm_pending_event *event); |
411 | }; | 419 | }; |
412 | 420 | ||
421 | /* initial implementaton using a linked list - todo hashtab */ | ||
422 | struct drm_prime_file_private { | ||
423 | struct list_head head; | ||
424 | struct mutex lock; | ||
425 | }; | ||
426 | |||
413 | /** File private data */ | 427 | /** File private data */ |
414 | struct drm_file { | 428 | struct drm_file { |
415 | int authenticated; | 429 | int authenticated; |
@@ -437,6 +451,8 @@ struct drm_file { | |||
437 | wait_queue_head_t event_wait; | 451 | wait_queue_head_t event_wait; |
438 | struct list_head event_list; | 452 | struct list_head event_list; |
439 | int event_space; | 453 | int event_space; |
454 | |||
455 | struct drm_prime_file_private prime; | ||
440 | }; | 456 | }; |
441 | 457 | ||
442 | /** Wait queue */ | 458 | /** Wait queue */ |
@@ -652,6 +668,12 @@ struct drm_gem_object { | |||
652 | uint32_t pending_write_domain; | 668 | uint32_t pending_write_domain; |
653 | 669 | ||
654 | void *driver_private; | 670 | void *driver_private; |
671 | |||
672 | /* dma buf exported from this GEM object */ | ||
673 | struct dma_buf *export_dma_buf; | ||
674 | |||
675 | /* dma buf attachment backing this object */ | ||
676 | struct dma_buf_attachment *import_attach; | ||
655 | }; | 677 | }; |
656 | 678 | ||
657 | #include "drm_crtc.h" | 679 | #include "drm_crtc.h" |
@@ -890,6 +912,20 @@ struct drm_driver { | |||
890 | int (*gem_open_object) (struct drm_gem_object *, struct drm_file *); | 912 | int (*gem_open_object) (struct drm_gem_object *, struct drm_file *); |
891 | void (*gem_close_object) (struct drm_gem_object *, struct drm_file *); | 913 | void (*gem_close_object) (struct drm_gem_object *, struct drm_file *); |
892 | 914 | ||
915 | /* prime: */ | ||
916 | /* export handle -> fd (see drm_gem_prime_handle_to_fd() helper) */ | ||
917 | int (*prime_handle_to_fd)(struct drm_device *dev, struct drm_file *file_priv, | ||
918 | uint32_t handle, uint32_t flags, int *prime_fd); | ||
919 | /* import fd -> handle (see drm_gem_prime_fd_to_handle() helper) */ | ||
920 | int (*prime_fd_to_handle)(struct drm_device *dev, struct drm_file *file_priv, | ||
921 | int prime_fd, uint32_t *handle); | ||
922 | /* export GEM -> dmabuf */ | ||
923 | struct dma_buf * (*gem_prime_export)(struct drm_device *dev, | ||
924 | struct drm_gem_object *obj, int flags); | ||
925 | /* import dmabuf -> GEM */ | ||
926 | struct drm_gem_object * (*gem_prime_import)(struct drm_device *dev, | ||
927 | struct dma_buf *dma_buf); | ||
928 | |||
893 | /* vga arb irq handler */ | 929 | /* vga arb irq handler */ |
894 | void (*vgaarb_irq)(struct drm_device *dev, bool state); | 930 | void (*vgaarb_irq)(struct drm_device *dev, bool state); |
895 | 931 | ||
@@ -1509,6 +1545,32 @@ extern int drm_vblank_info(struct seq_file *m, void *data); | |||
1509 | extern int drm_clients_info(struct seq_file *m, void* data); | 1545 | extern int drm_clients_info(struct seq_file *m, void* data); |
1510 | extern int drm_gem_name_info(struct seq_file *m, void *data); | 1546 | extern int drm_gem_name_info(struct seq_file *m, void *data); |
1511 | 1547 | ||
1548 | |||
1549 | extern int drm_gem_prime_handle_to_fd(struct drm_device *dev, | ||
1550 | struct drm_file *file_priv, uint32_t handle, uint32_t flags, | ||
1551 | int *prime_fd); | ||
1552 | extern int drm_gem_prime_fd_to_handle(struct drm_device *dev, | ||
1553 | struct drm_file *file_priv, int prime_fd, uint32_t *handle); | ||
1554 | |||
1555 | extern int drm_prime_handle_to_fd_ioctl(struct drm_device *dev, void *data, | ||
1556 | struct drm_file *file_priv); | ||
1557 | extern int drm_prime_fd_to_handle_ioctl(struct drm_device *dev, void *data, | ||
1558 | struct drm_file *file_priv); | ||
1559 | |||
1560 | extern struct sg_table *drm_prime_pages_to_sg(struct page **pages, int nr_pages); | ||
1561 | extern void drm_prime_gem_destroy(struct drm_gem_object *obj, struct sg_table *sg); | ||
1562 | |||
1563 | |||
1564 | void drm_prime_init_file_private(struct drm_prime_file_private *prime_fpriv); | ||
1565 | void drm_prime_destroy_file_private(struct drm_prime_file_private *prime_fpriv); | ||
1566 | int drm_prime_add_imported_buf_handle(struct drm_prime_file_private *prime_fpriv, struct dma_buf *dma_buf, uint32_t handle); | ||
1567 | int drm_prime_lookup_imported_buf_handle(struct drm_prime_file_private *prime_fpriv, struct dma_buf *dma_buf, uint32_t *handle); | ||
1568 | void drm_prime_remove_imported_buf_handle(struct drm_prime_file_private *prime_fpriv, struct dma_buf *dma_buf); | ||
1569 | |||
1570 | int drm_prime_add_dma_buf(struct drm_device *dev, struct drm_gem_object *obj); | ||
1571 | int drm_prime_lookup_obj(struct drm_device *dev, struct dma_buf *buf, | ||
1572 | struct drm_gem_object **obj); | ||
1573 | |||
1512 | #if DRM_DEBUG_CODE | 1574 | #if DRM_DEBUG_CODE |
1513 | extern int drm_vma_info(struct seq_file *m, void *data); | 1575 | extern int drm_vma_info(struct seq_file *m, void *data); |
1514 | #endif | 1576 | #endif |
diff --git a/include/drm/intel-gtt.h b/include/drm/intel-gtt.h index 0a0001b9dc78..923afb5dcf0c 100644 --- a/include/drm/intel-gtt.h +++ b/include/drm/intel-gtt.h | |||
@@ -44,4 +44,8 @@ void intel_gtt_insert_pages(unsigned int first_entry, unsigned int num_entries, | |||
44 | /* flag for GFDT type */ | 44 | /* flag for GFDT type */ |
45 | #define AGP_USER_CACHED_MEMORY_GFDT (1 << 3) | 45 | #define AGP_USER_CACHED_MEMORY_GFDT (1 << 3) |
46 | 46 | ||
47 | #ifdef CONFIG_INTEL_IOMMU | ||
48 | extern int intel_iommu_gfx_mapped; | ||
49 | #endif | ||
50 | |||
47 | #endif | 51 | #endif |
diff --git a/include/linux/Kbuild b/include/linux/Kbuild index d05df2810354..3c9b616c834a 100644 --- a/include/linux/Kbuild +++ b/include/linux/Kbuild | |||
@@ -3,6 +3,7 @@ header-y += can/ | |||
3 | header-y += caif/ | 3 | header-y += caif/ |
4 | header-y += dvb/ | 4 | header-y += dvb/ |
5 | header-y += hdlc/ | 5 | header-y += hdlc/ |
6 | header-y += hsi/ | ||
6 | header-y += isdn/ | 7 | header-y += isdn/ |
7 | header-y += mmc/ | 8 | header-y += mmc/ |
8 | header-y += nfsd/ | 9 | header-y += nfsd/ |
diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h index 1ffdb9856bb9..a2c819d3c96e 100644 --- a/include/linux/cpumask.h +++ b/include/linux/cpumask.h | |||
@@ -764,12 +764,6 @@ static inline const struct cpumask *get_cpu_mask(unsigned int cpu) | |||
764 | * | 764 | * |
765 | */ | 765 | */ |
766 | #ifndef CONFIG_DISABLE_OBSOLETE_CPUMASK_FUNCTIONS | 766 | #ifndef CONFIG_DISABLE_OBSOLETE_CPUMASK_FUNCTIONS |
767 | /* These strip const, as traditionally they weren't const. */ | ||
768 | #define cpu_possible_map (*(cpumask_t *)cpu_possible_mask) | ||
769 | #define cpu_online_map (*(cpumask_t *)cpu_online_mask) | ||
770 | #define cpu_present_map (*(cpumask_t *)cpu_present_mask) | ||
771 | #define cpu_active_map (*(cpumask_t *)cpu_active_mask) | ||
772 | |||
773 | #define cpumask_of_cpu(cpu) (*get_cpu_mask(cpu)) | 767 | #define cpumask_of_cpu(cpu) (*get_cpu_mask(cpu)) |
774 | 768 | ||
775 | #define CPU_MASK_LAST_WORD BITMAP_LAST_WORD_MASK(NR_CPUS) | 769 | #define CPU_MASK_LAST_WORD BITMAP_LAST_WORD_MASK(NR_CPUS) |
diff --git a/include/linux/cryptouser.h b/include/linux/cryptouser.h index 532fb58f16bf..4abf2ea6a887 100644 --- a/include/linux/cryptouser.h +++ b/include/linux/cryptouser.h | |||
@@ -100,3 +100,6 @@ struct crypto_report_rng { | |||
100 | char type[CRYPTO_MAX_NAME]; | 100 | char type[CRYPTO_MAX_NAME]; |
101 | unsigned int seedsize; | 101 | unsigned int seedsize; |
102 | }; | 102 | }; |
103 | |||
104 | #define CRYPTO_REPORT_MAXSIZE (sizeof(struct crypto_user_alg) + \ | ||
105 | sizeof(struct crypto_report_blkcipher)) | ||
diff --git a/include/linux/dma-attrs.h b/include/linux/dma-attrs.h index 71ad34eca6e3..547ab568d3ae 100644 --- a/include/linux/dma-attrs.h +++ b/include/linux/dma-attrs.h | |||
@@ -13,6 +13,8 @@ | |||
13 | enum dma_attr { | 13 | enum dma_attr { |
14 | DMA_ATTR_WRITE_BARRIER, | 14 | DMA_ATTR_WRITE_BARRIER, |
15 | DMA_ATTR_WEAK_ORDERING, | 15 | DMA_ATTR_WEAK_ORDERING, |
16 | DMA_ATTR_WRITE_COMBINE, | ||
17 | DMA_ATTR_NON_CONSISTENT, | ||
16 | DMA_ATTR_MAX, | 18 | DMA_ATTR_MAX, |
17 | }; | 19 | }; |
18 | 20 | ||
diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h index 5a736af3cc7a..dfc099e56a66 100644 --- a/include/linux/dma-mapping.h +++ b/include/linux/dma-mapping.h | |||
@@ -9,10 +9,15 @@ | |||
9 | #include <linux/scatterlist.h> | 9 | #include <linux/scatterlist.h> |
10 | 10 | ||
11 | struct dma_map_ops { | 11 | struct dma_map_ops { |
12 | void* (*alloc_coherent)(struct device *dev, size_t size, | 12 | void* (*alloc)(struct device *dev, size_t size, |
13 | dma_addr_t *dma_handle, gfp_t gfp); | 13 | dma_addr_t *dma_handle, gfp_t gfp, |
14 | void (*free_coherent)(struct device *dev, size_t size, | 14 | struct dma_attrs *attrs); |
15 | void *vaddr, dma_addr_t dma_handle); | 15 | void (*free)(struct device *dev, size_t size, |
16 | void *vaddr, dma_addr_t dma_handle, | ||
17 | struct dma_attrs *attrs); | ||
18 | int (*mmap)(struct device *, struct vm_area_struct *, | ||
19 | void *, dma_addr_t, size_t, struct dma_attrs *attrs); | ||
20 | |||
16 | dma_addr_t (*map_page)(struct device *dev, struct page *page, | 21 | dma_addr_t (*map_page)(struct device *dev, struct page *page, |
17 | unsigned long offset, size_t size, | 22 | unsigned long offset, size_t size, |
18 | enum dma_data_direction dir, | 23 | enum dma_data_direction dir, |
diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h index e1d9e0ede309..f5647b59a90e 100644 --- a/include/linux/ethtool.h +++ b/include/linux/ethtool.h | |||
@@ -896,8 +896,7 @@ static inline u32 ethtool_rxfh_indir_default(u32 index, u32 n_rx_rings) | |||
896 | * | 896 | * |
897 | * All operations are optional (i.e. the function pointer may be set | 897 | * All operations are optional (i.e. the function pointer may be set |
898 | * to %NULL) and callers must take this into account. Callers must | 898 | * to %NULL) and callers must take this into account. Callers must |
899 | * hold the RTNL, except that for @get_drvinfo the caller may or may | 899 | * hold the RTNL lock. |
900 | * not hold the RTNL. | ||
901 | * | 900 | * |
902 | * See the structures used by these operations for further documentation. | 901 | * See the structures used by these operations for further documentation. |
903 | * | 902 | * |
diff --git a/include/linux/firewire.h b/include/linux/firewire.h index 4db7b68f0582..cdc9b719e9c7 100644 --- a/include/linux/firewire.h +++ b/include/linux/firewire.h | |||
@@ -2,6 +2,7 @@ | |||
2 | #define _LINUX_FIREWIRE_H | 2 | #define _LINUX_FIREWIRE_H |
3 | 3 | ||
4 | #include <linux/completion.h> | 4 | #include <linux/completion.h> |
5 | #include <linux/device.h> | ||
5 | #include <linux/dma-mapping.h> | 6 | #include <linux/dma-mapping.h> |
6 | #include <linux/kernel.h> | 7 | #include <linux/kernel.h> |
7 | #include <linux/kref.h> | 8 | #include <linux/kref.h> |
@@ -64,8 +65,6 @@ | |||
64 | #define CSR_MODEL 0x17 | 65 | #define CSR_MODEL 0x17 |
65 | #define CSR_DIRECTORY_ID 0x20 | 66 | #define CSR_DIRECTORY_ID 0x20 |
66 | 67 | ||
67 | struct device; | ||
68 | |||
69 | struct fw_csr_iterator { | 68 | struct fw_csr_iterator { |
70 | const u32 *p; | 69 | const u32 *p; |
71 | const u32 *end; | 70 | const u32 *end; |
diff --git a/include/linux/fs.h b/include/linux/fs.h index 135693e79f2b..8de675523e46 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
@@ -1215,6 +1215,7 @@ extern int vfs_setlease(struct file *, long, struct file_lock **); | |||
1215 | extern int lease_modify(struct file_lock **, int); | 1215 | extern int lease_modify(struct file_lock **, int); |
1216 | extern int lock_may_read(struct inode *, loff_t start, unsigned long count); | 1216 | extern int lock_may_read(struct inode *, loff_t start, unsigned long count); |
1217 | extern int lock_may_write(struct inode *, loff_t start, unsigned long count); | 1217 | extern int lock_may_write(struct inode *, loff_t start, unsigned long count); |
1218 | extern void locks_delete_block(struct file_lock *waiter); | ||
1218 | extern void lock_flocks(void); | 1219 | extern void lock_flocks(void); |
1219 | extern void unlock_flocks(void); | 1220 | extern void unlock_flocks(void); |
1220 | #else /* !CONFIG_FILE_LOCKING */ | 1221 | #else /* !CONFIG_FILE_LOCKING */ |
@@ -1359,6 +1360,10 @@ static inline int lock_may_write(struct inode *inode, loff_t start, | |||
1359 | return 1; | 1360 | return 1; |
1360 | } | 1361 | } |
1361 | 1362 | ||
1363 | static inline void locks_delete_block(struct file_lock *waiter) | ||
1364 | { | ||
1365 | } | ||
1366 | |||
1362 | static inline void lock_flocks(void) | 1367 | static inline void lock_flocks(void) |
1363 | { | 1368 | { |
1364 | } | 1369 | } |
@@ -2506,6 +2511,7 @@ extern int dcache_readdir(struct file *, void *, filldir_t); | |||
2506 | extern int simple_setattr(struct dentry *, struct iattr *); | 2511 | extern int simple_setattr(struct dentry *, struct iattr *); |
2507 | extern int simple_getattr(struct vfsmount *, struct dentry *, struct kstat *); | 2512 | extern int simple_getattr(struct vfsmount *, struct dentry *, struct kstat *); |
2508 | extern int simple_statfs(struct dentry *, struct kstatfs *); | 2513 | extern int simple_statfs(struct dentry *, struct kstatfs *); |
2514 | extern int simple_open(struct inode *inode, struct file *file); | ||
2509 | extern int simple_link(struct dentry *, struct inode *, struct dentry *); | 2515 | extern int simple_link(struct dentry *, struct inode *, struct dentry *); |
2510 | extern int simple_unlink(struct inode *, struct dentry *); | 2516 | extern int simple_unlink(struct inode *, struct dentry *); |
2511 | extern int simple_rmdir(struct inode *, struct dentry *); | 2517 | extern int simple_rmdir(struct inode *, struct dentry *); |
diff --git a/include/linux/hsi/Kbuild b/include/linux/hsi/Kbuild new file mode 100644 index 000000000000..271a770b4784 --- /dev/null +++ b/include/linux/hsi/Kbuild | |||
@@ -0,0 +1 @@ | |||
header-y += hsi_char.h | |||
diff --git a/include/linux/hsi/hsi.h b/include/linux/hsi/hsi.h new file mode 100644 index 000000000000..4b178067f405 --- /dev/null +++ b/include/linux/hsi/hsi.h | |||
@@ -0,0 +1,410 @@ | |||
1 | /* | ||
2 | * HSI core header file. | ||
3 | * | ||
4 | * Copyright (C) 2010 Nokia Corporation. All rights reserved. | ||
5 | * | ||
6 | * Contact: Carlos Chinea <carlos.chinea@nokia.com> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or | ||
9 | * modify it under the terms of the GNU General Public License | ||
10 | * version 2 as published by the Free Software Foundation. | ||
11 | * | ||
12 | * This program is distributed in the hope that it will be useful, but | ||
13 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
15 | * General Public License for more details. | ||
16 | * | ||
17 | * You should have received a copy of the GNU General Public License | ||
18 | * along with this program; if not, write to the Free Software | ||
19 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | ||
20 | * 02110-1301 USA | ||
21 | */ | ||
22 | |||
23 | #ifndef __LINUX_HSI_H__ | ||
24 | #define __LINUX_HSI_H__ | ||
25 | |||
26 | #include <linux/device.h> | ||
27 | #include <linux/mutex.h> | ||
28 | #include <linux/scatterlist.h> | ||
29 | #include <linux/spinlock.h> | ||
30 | #include <linux/list.h> | ||
31 | #include <linux/module.h> | ||
32 | |||
33 | /* HSI message ttype */ | ||
34 | #define HSI_MSG_READ 0 | ||
35 | #define HSI_MSG_WRITE 1 | ||
36 | |||
37 | /* HSI configuration values */ | ||
38 | enum { | ||
39 | HSI_MODE_STREAM = 1, | ||
40 | HSI_MODE_FRAME, | ||
41 | }; | ||
42 | |||
43 | enum { | ||
44 | HSI_FLOW_SYNC, /* Synchronized flow */ | ||
45 | HSI_FLOW_PIPE, /* Pipelined flow */ | ||
46 | }; | ||
47 | |||
48 | enum { | ||
49 | HSI_ARB_RR, /* Round-robin arbitration */ | ||
50 | HSI_ARB_PRIO, /* Channel priority arbitration */ | ||
51 | }; | ||
52 | |||
53 | #define HSI_MAX_CHANNELS 16 | ||
54 | |||
55 | /* HSI message status codes */ | ||
56 | enum { | ||
57 | HSI_STATUS_COMPLETED, /* Message transfer is completed */ | ||
58 | HSI_STATUS_PENDING, /* Message pending to be read/write (POLL) */ | ||
59 | HSI_STATUS_PROCEEDING, /* Message transfer is ongoing */ | ||
60 | HSI_STATUS_QUEUED, /* Message waiting to be served */ | ||
61 | HSI_STATUS_ERROR, /* Error when message transfer was ongoing */ | ||
62 | }; | ||
63 | |||
64 | /* HSI port event codes */ | ||
65 | enum { | ||
66 | HSI_EVENT_START_RX, | ||
67 | HSI_EVENT_STOP_RX, | ||
68 | }; | ||
69 | |||
70 | /** | ||
71 | * struct hsi_config - Configuration for RX/TX HSI modules | ||
72 | * @mode: Bit transmission mode (STREAM or FRAME) | ||
73 | * @channels: Number of channels to use [1..16] | ||
74 | * @speed: Max bit transmission speed (Kbit/s) | ||
75 | * @flow: RX flow type (SYNCHRONIZED or PIPELINE) | ||
76 | * @arb_mode: Arbitration mode for TX frame (Round robin, priority) | ||
77 | */ | ||
78 | struct hsi_config { | ||
79 | unsigned int mode; | ||
80 | unsigned int channels; | ||
81 | unsigned int speed; | ||
82 | union { | ||
83 | unsigned int flow; /* RX only */ | ||
84 | unsigned int arb_mode; /* TX only */ | ||
85 | }; | ||
86 | }; | ||
87 | |||
88 | /** | ||
89 | * struct hsi_board_info - HSI client board info | ||
90 | * @name: Name for the HSI device | ||
91 | * @hsi_id: HSI controller id where the client sits | ||
92 | * @port: Port number in the controller where the client sits | ||
93 | * @tx_cfg: HSI TX configuration | ||
94 | * @rx_cfg: HSI RX configuration | ||
95 | * @platform_data: Platform related data | ||
96 | * @archdata: Architecture-dependent device data | ||
97 | */ | ||
98 | struct hsi_board_info { | ||
99 | const char *name; | ||
100 | unsigned int hsi_id; | ||
101 | unsigned int port; | ||
102 | struct hsi_config tx_cfg; | ||
103 | struct hsi_config rx_cfg; | ||
104 | void *platform_data; | ||
105 | struct dev_archdata *archdata; | ||
106 | }; | ||
107 | |||
108 | #ifdef CONFIG_HSI_BOARDINFO | ||
109 | extern int hsi_register_board_info(struct hsi_board_info const *info, | ||
110 | unsigned int len); | ||
111 | #else | ||
112 | static inline int hsi_register_board_info(struct hsi_board_info const *info, | ||
113 | unsigned int len) | ||
114 | { | ||
115 | return 0; | ||
116 | } | ||
117 | #endif /* CONFIG_HSI_BOARDINFO */ | ||
118 | |||
119 | /** | ||
120 | * struct hsi_client - HSI client attached to an HSI port | ||
121 | * @device: Driver model representation of the device | ||
122 | * @tx_cfg: HSI TX configuration | ||
123 | * @rx_cfg: HSI RX configuration | ||
124 | * @hsi_start_rx: Called after incoming wake line goes high | ||
125 | * @hsi_stop_rx: Called after incoming wake line goes low | ||
126 | */ | ||
127 | struct hsi_client { | ||
128 | struct device device; | ||
129 | struct hsi_config tx_cfg; | ||
130 | struct hsi_config rx_cfg; | ||
131 | void (*hsi_start_rx)(struct hsi_client *cl); | ||
132 | void (*hsi_stop_rx)(struct hsi_client *cl); | ||
133 | /* private: */ | ||
134 | unsigned int pclaimed:1; | ||
135 | struct list_head link; | ||
136 | }; | ||
137 | |||
138 | #define to_hsi_client(dev) container_of(dev, struct hsi_client, device) | ||
139 | |||
140 | static inline void hsi_client_set_drvdata(struct hsi_client *cl, void *data) | ||
141 | { | ||
142 | dev_set_drvdata(&cl->device, data); | ||
143 | } | ||
144 | |||
145 | static inline void *hsi_client_drvdata(struct hsi_client *cl) | ||
146 | { | ||
147 | return dev_get_drvdata(&cl->device); | ||
148 | } | ||
149 | |||
150 | /** | ||
151 | * struct hsi_client_driver - Driver associated to an HSI client | ||
152 | * @driver: Driver model representation of the driver | ||
153 | */ | ||
154 | struct hsi_client_driver { | ||
155 | struct device_driver driver; | ||
156 | }; | ||
157 | |||
158 | #define to_hsi_client_driver(drv) container_of(drv, struct hsi_client_driver,\ | ||
159 | driver) | ||
160 | |||
161 | int hsi_register_client_driver(struct hsi_client_driver *drv); | ||
162 | |||
163 | static inline void hsi_unregister_client_driver(struct hsi_client_driver *drv) | ||
164 | { | ||
165 | driver_unregister(&drv->driver); | ||
166 | } | ||
167 | |||
168 | /** | ||
169 | * struct hsi_msg - HSI message descriptor | ||
170 | * @link: Free to use by the current descriptor owner | ||
171 | * @cl: HSI device client that issues the transfer | ||
172 | * @sgt: Head of the scatterlist array | ||
173 | * @context: Client context data associated to the transfer | ||
174 | * @complete: Transfer completion callback | ||
175 | * @destructor: Destructor to free resources when flushing | ||
176 | * @status: Status of the transfer when completed | ||
177 | * @actual_len: Actual length of data transfered on completion | ||
178 | * @channel: Channel were to TX/RX the message | ||
179 | * @ttype: Transfer type (TX if set, RX otherwise) | ||
180 | * @break_frame: if true HSI will send/receive a break frame. Data buffers are | ||
181 | * ignored in the request. | ||
182 | */ | ||
183 | struct hsi_msg { | ||
184 | struct list_head link; | ||
185 | struct hsi_client *cl; | ||
186 | struct sg_table sgt; | ||
187 | void *context; | ||
188 | |||
189 | void (*complete)(struct hsi_msg *msg); | ||
190 | void (*destructor)(struct hsi_msg *msg); | ||
191 | |||
192 | int status; | ||
193 | unsigned int actual_len; | ||
194 | unsigned int channel; | ||
195 | unsigned int ttype:1; | ||
196 | unsigned int break_frame:1; | ||
197 | }; | ||
198 | |||
199 | struct hsi_msg *hsi_alloc_msg(unsigned int n_frag, gfp_t flags); | ||
200 | void hsi_free_msg(struct hsi_msg *msg); | ||
201 | |||
202 | /** | ||
203 | * struct hsi_port - HSI port device | ||
204 | * @device: Driver model representation of the device | ||
205 | * @tx_cfg: Current TX path configuration | ||
206 | * @rx_cfg: Current RX path configuration | ||
207 | * @num: Port number | ||
208 | * @shared: Set when port can be shared by different clients | ||
209 | * @claimed: Reference count of clients which claimed the port | ||
210 | * @lock: Serialize port claim | ||
211 | * @async: Asynchronous transfer callback | ||
212 | * @setup: Callback to set the HSI client configuration | ||
213 | * @flush: Callback to clean the HW state and destroy all pending transfers | ||
214 | * @start_tx: Callback to inform that a client wants to TX data | ||
215 | * @stop_tx: Callback to inform that a client no longer wishes to TX data | ||
216 | * @release: Callback to inform that a client no longer uses the port | ||
217 | * @clients: List of hsi_clients using the port. | ||
218 | * @clock: Lock to serialize access to the clients list. | ||
219 | */ | ||
220 | struct hsi_port { | ||
221 | struct device device; | ||
222 | struct hsi_config tx_cfg; | ||
223 | struct hsi_config rx_cfg; | ||
224 | unsigned int num; | ||
225 | unsigned int shared:1; | ||
226 | int claimed; | ||
227 | struct mutex lock; | ||
228 | int (*async)(struct hsi_msg *msg); | ||
229 | int (*setup)(struct hsi_client *cl); | ||
230 | int (*flush)(struct hsi_client *cl); | ||
231 | int (*start_tx)(struct hsi_client *cl); | ||
232 | int (*stop_tx)(struct hsi_client *cl); | ||
233 | int (*release)(struct hsi_client *cl); | ||
234 | struct list_head clients; | ||
235 | spinlock_t clock; | ||
236 | }; | ||
237 | |||
238 | #define to_hsi_port(dev) container_of(dev, struct hsi_port, device) | ||
239 | #define hsi_get_port(cl) to_hsi_port((cl)->device.parent) | ||
240 | |||
241 | void hsi_event(struct hsi_port *port, unsigned int event); | ||
242 | int hsi_claim_port(struct hsi_client *cl, unsigned int share); | ||
243 | void hsi_release_port(struct hsi_client *cl); | ||
244 | |||
245 | static inline int hsi_port_claimed(struct hsi_client *cl) | ||
246 | { | ||
247 | return cl->pclaimed; | ||
248 | } | ||
249 | |||
250 | static inline void hsi_port_set_drvdata(struct hsi_port *port, void *data) | ||
251 | { | ||
252 | dev_set_drvdata(&port->device, data); | ||
253 | } | ||
254 | |||
255 | static inline void *hsi_port_drvdata(struct hsi_port *port) | ||
256 | { | ||
257 | return dev_get_drvdata(&port->device); | ||
258 | } | ||
259 | |||
260 | /** | ||
261 | * struct hsi_controller - HSI controller device | ||
262 | * @device: Driver model representation of the device | ||
263 | * @owner: Pointer to the module owning the controller | ||
264 | * @id: HSI controller ID | ||
265 | * @num_ports: Number of ports in the HSI controller | ||
266 | * @port: Array of HSI ports | ||
267 | */ | ||
268 | struct hsi_controller { | ||
269 | struct device device; | ||
270 | struct module *owner; | ||
271 | unsigned int id; | ||
272 | unsigned int num_ports; | ||
273 | struct hsi_port *port; | ||
274 | }; | ||
275 | |||
276 | #define to_hsi_controller(dev) container_of(dev, struct hsi_controller, device) | ||
277 | |||
278 | struct hsi_controller *hsi_alloc_controller(unsigned int n_ports, gfp_t flags); | ||
279 | void hsi_free_controller(struct hsi_controller *hsi); | ||
280 | int hsi_register_controller(struct hsi_controller *hsi); | ||
281 | void hsi_unregister_controller(struct hsi_controller *hsi); | ||
282 | |||
283 | static inline void hsi_controller_set_drvdata(struct hsi_controller *hsi, | ||
284 | void *data) | ||
285 | { | ||
286 | dev_set_drvdata(&hsi->device, data); | ||
287 | } | ||
288 | |||
289 | static inline void *hsi_controller_drvdata(struct hsi_controller *hsi) | ||
290 | { | ||
291 | return dev_get_drvdata(&hsi->device); | ||
292 | } | ||
293 | |||
294 | static inline struct hsi_port *hsi_find_port_num(struct hsi_controller *hsi, | ||
295 | unsigned int num) | ||
296 | { | ||
297 | return (num < hsi->num_ports) ? &hsi->port[num] : NULL; | ||
298 | } | ||
299 | |||
300 | /* | ||
301 | * API for HSI clients | ||
302 | */ | ||
303 | int hsi_async(struct hsi_client *cl, struct hsi_msg *msg); | ||
304 | |||
305 | /** | ||
306 | * hsi_id - Get HSI controller ID associated to a client | ||
307 | * @cl: Pointer to a HSI client | ||
308 | * | ||
309 | * Return the controller id where the client is attached to | ||
310 | */ | ||
311 | static inline unsigned int hsi_id(struct hsi_client *cl) | ||
312 | { | ||
313 | return to_hsi_controller(cl->device.parent->parent)->id; | ||
314 | } | ||
315 | |||
316 | /** | ||
317 | * hsi_port_id - Gets the port number a client is attached to | ||
318 | * @cl: Pointer to HSI client | ||
319 | * | ||
320 | * Return the port number associated to the client | ||
321 | */ | ||
322 | static inline unsigned int hsi_port_id(struct hsi_client *cl) | ||
323 | { | ||
324 | return to_hsi_port(cl->device.parent)->num; | ||
325 | } | ||
326 | |||
327 | /** | ||
328 | * hsi_setup - Configure the client's port | ||
329 | * @cl: Pointer to the HSI client | ||
330 | * | ||
331 | * When sharing ports, clients should either relay on a single | ||
332 | * client setup or have the same setup for all of them. | ||
333 | * | ||
334 | * Return -errno on failure, 0 on success | ||
335 | */ | ||
336 | static inline int hsi_setup(struct hsi_client *cl) | ||
337 | { | ||
338 | if (!hsi_port_claimed(cl)) | ||
339 | return -EACCES; | ||
340 | return hsi_get_port(cl)->setup(cl); | ||
341 | } | ||
342 | |||
343 | /** | ||
344 | * hsi_flush - Flush all pending transactions on the client's port | ||
345 | * @cl: Pointer to the HSI client | ||
346 | * | ||
347 | * This function will destroy all pending hsi_msg in the port and reset | ||
348 | * the HW port so it is ready to receive and transmit from a clean state. | ||
349 | * | ||
350 | * Return -errno on failure, 0 on success | ||
351 | */ | ||
352 | static inline int hsi_flush(struct hsi_client *cl) | ||
353 | { | ||
354 | if (!hsi_port_claimed(cl)) | ||
355 | return -EACCES; | ||
356 | return hsi_get_port(cl)->flush(cl); | ||
357 | } | ||
358 | |||
359 | /** | ||
360 | * hsi_async_read - Submit a read transfer | ||
361 | * @cl: Pointer to the HSI client | ||
362 | * @msg: HSI message descriptor of the transfer | ||
363 | * | ||
364 | * Return -errno on failure, 0 on success | ||
365 | */ | ||
366 | static inline int hsi_async_read(struct hsi_client *cl, struct hsi_msg *msg) | ||
367 | { | ||
368 | msg->ttype = HSI_MSG_READ; | ||
369 | return hsi_async(cl, msg); | ||
370 | } | ||
371 | |||
372 | /** | ||
373 | * hsi_async_write - Submit a write transfer | ||
374 | * @cl: Pointer to the HSI client | ||
375 | * @msg: HSI message descriptor of the transfer | ||
376 | * | ||
377 | * Return -errno on failure, 0 on success | ||
378 | */ | ||
379 | static inline int hsi_async_write(struct hsi_client *cl, struct hsi_msg *msg) | ||
380 | { | ||
381 | msg->ttype = HSI_MSG_WRITE; | ||
382 | return hsi_async(cl, msg); | ||
383 | } | ||
384 | |||
385 | /** | ||
386 | * hsi_start_tx - Signal the port that the client wants to start a TX | ||
387 | * @cl: Pointer to the HSI client | ||
388 | * | ||
389 | * Return -errno on failure, 0 on success | ||
390 | */ | ||
391 | static inline int hsi_start_tx(struct hsi_client *cl) | ||
392 | { | ||
393 | if (!hsi_port_claimed(cl)) | ||
394 | return -EACCES; | ||
395 | return hsi_get_port(cl)->start_tx(cl); | ||
396 | } | ||
397 | |||
398 | /** | ||
399 | * hsi_stop_tx - Signal the port that the client no longer wants to transmit | ||
400 | * @cl: Pointer to the HSI client | ||
401 | * | ||
402 | * Return -errno on failure, 0 on success | ||
403 | */ | ||
404 | static inline int hsi_stop_tx(struct hsi_client *cl) | ||
405 | { | ||
406 | if (!hsi_port_claimed(cl)) | ||
407 | return -EACCES; | ||
408 | return hsi_get_port(cl)->stop_tx(cl); | ||
409 | } | ||
410 | #endif /* __LINUX_HSI_H__ */ | ||
diff --git a/include/linux/hsi/hsi_char.h b/include/linux/hsi/hsi_char.h new file mode 100644 index 000000000000..76160b4f455d --- /dev/null +++ b/include/linux/hsi/hsi_char.h | |||
@@ -0,0 +1,63 @@ | |||
1 | /* | ||
2 | * Part of the HSI character device driver. | ||
3 | * | ||
4 | * Copyright (C) 2010 Nokia Corporation. All rights reserved. | ||
5 | * | ||
6 | * Contact: Andras Domokos <andras.domokos at nokia.com> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or | ||
9 | * modify it under the terms of the GNU General Public License | ||
10 | * version 2 as published by the Free Software Foundation. | ||
11 | * | ||
12 | * This program is distributed in the hope that it will be useful, but | ||
13 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
15 | * General Public License for more details. | ||
16 | * | ||
17 | * You should have received a copy of the GNU General Public License | ||
18 | * along with this program; if not, write to the Free Software | ||
19 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | ||
20 | * 02110-1301 USA | ||
21 | */ | ||
22 | |||
23 | |||
24 | #ifndef __HSI_CHAR_H | ||
25 | #define __HSI_CHAR_H | ||
26 | |||
27 | #define HSI_CHAR_MAGIC 'k' | ||
28 | #define HSC_IOW(num, dtype) _IOW(HSI_CHAR_MAGIC, num, dtype) | ||
29 | #define HSC_IOR(num, dtype) _IOR(HSI_CHAR_MAGIC, num, dtype) | ||
30 | #define HSC_IOWR(num, dtype) _IOWR(HSI_CHAR_MAGIC, num, dtype) | ||
31 | #define HSC_IO(num) _IO(HSI_CHAR_MAGIC, num) | ||
32 | |||
33 | #define HSC_RESET HSC_IO(16) | ||
34 | #define HSC_SET_PM HSC_IO(17) | ||
35 | #define HSC_SEND_BREAK HSC_IO(18) | ||
36 | #define HSC_SET_RX HSC_IOW(19, struct hsc_rx_config) | ||
37 | #define HSC_GET_RX HSC_IOW(20, struct hsc_rx_config) | ||
38 | #define HSC_SET_TX HSC_IOW(21, struct hsc_tx_config) | ||
39 | #define HSC_GET_TX HSC_IOW(22, struct hsc_tx_config) | ||
40 | |||
41 | #define HSC_PM_DISABLE 0 | ||
42 | #define HSC_PM_ENABLE 1 | ||
43 | |||
44 | #define HSC_MODE_STREAM 1 | ||
45 | #define HSC_MODE_FRAME 2 | ||
46 | #define HSC_FLOW_SYNC 0 | ||
47 | #define HSC_ARB_RR 0 | ||
48 | #define HSC_ARB_PRIO 1 | ||
49 | |||
50 | struct hsc_rx_config { | ||
51 | uint32_t mode; | ||
52 | uint32_t flow; | ||
53 | uint32_t channels; | ||
54 | }; | ||
55 | |||
56 | struct hsc_tx_config { | ||
57 | uint32_t mode; | ||
58 | uint32_t channels; | ||
59 | uint32_t speed; | ||
60 | uint32_t arb_mode; | ||
61 | }; | ||
62 | |||
63 | #endif /* __HSI_CHAR_H */ | ||
diff --git a/include/linux/if_eql.h b/include/linux/if_eql.h index 79c4f268410d..18a5d02a8644 100644 --- a/include/linux/if_eql.h +++ b/include/linux/if_eql.h | |||
@@ -22,7 +22,7 @@ | |||
22 | #define EQL_DEFAULT_SLAVE_PRIORITY 28800 | 22 | #define EQL_DEFAULT_SLAVE_PRIORITY 28800 |
23 | #define EQL_DEFAULT_MAX_SLAVES 4 | 23 | #define EQL_DEFAULT_MAX_SLAVES 4 |
24 | #define EQL_DEFAULT_MTU 576 | 24 | #define EQL_DEFAULT_MTU 576 |
25 | #define EQL_DEFAULT_RESCHED_IVAL 100 | 25 | #define EQL_DEFAULT_RESCHED_IVAL HZ |
26 | 26 | ||
27 | #define EQL_ENSLAVE (SIOCDEVPRIVATE) | 27 | #define EQL_ENSLAVE (SIOCDEVPRIVATE) |
28 | #define EQL_EMANCIPATE (SIOCDEVPRIVATE + 1) | 28 | #define EQL_EMANCIPATE (SIOCDEVPRIVATE + 1) |
diff --git a/include/linux/kgdb.h b/include/linux/kgdb.h index fa391835508d..c4d2fc194ede 100644 --- a/include/linux/kgdb.h +++ b/include/linux/kgdb.h | |||
@@ -63,7 +63,8 @@ enum kgdb_bptype { | |||
63 | BP_HARDWARE_BREAKPOINT, | 63 | BP_HARDWARE_BREAKPOINT, |
64 | BP_WRITE_WATCHPOINT, | 64 | BP_WRITE_WATCHPOINT, |
65 | BP_READ_WATCHPOINT, | 65 | BP_READ_WATCHPOINT, |
66 | BP_ACCESS_WATCHPOINT | 66 | BP_ACCESS_WATCHPOINT, |
67 | BP_POKE_BREAKPOINT, | ||
67 | }; | 68 | }; |
68 | 69 | ||
69 | enum kgdb_bpstate { | 70 | enum kgdb_bpstate { |
@@ -207,8 +208,8 @@ extern void kgdb_arch_set_pc(struct pt_regs *regs, unsigned long pc); | |||
207 | 208 | ||
208 | /* Optional functions. */ | 209 | /* Optional functions. */ |
209 | extern int kgdb_validate_break_address(unsigned long addr); | 210 | extern int kgdb_validate_break_address(unsigned long addr); |
210 | extern int kgdb_arch_set_breakpoint(unsigned long addr, char *saved_instr); | 211 | extern int kgdb_arch_set_breakpoint(struct kgdb_bkpt *bpt); |
211 | extern int kgdb_arch_remove_breakpoint(unsigned long addr, char *bundle); | 212 | extern int kgdb_arch_remove_breakpoint(struct kgdb_bkpt *bpt); |
212 | 213 | ||
213 | /** | 214 | /** |
214 | * kgdb_arch_late - Perform any architecture specific initalization. | 215 | * kgdb_arch_late - Perform any architecture specific initalization. |
diff --git a/include/linux/kmod.h b/include/linux/kmod.h index 9efeae679106..dd99c329e161 100644 --- a/include/linux/kmod.h +++ b/include/linux/kmod.h | |||
@@ -110,12 +110,29 @@ call_usermodehelper(char *path, char **argv, char **envp, int wait) | |||
110 | 110 | ||
111 | extern struct ctl_table usermodehelper_table[]; | 111 | extern struct ctl_table usermodehelper_table[]; |
112 | 112 | ||
113 | enum umh_disable_depth { | ||
114 | UMH_ENABLED = 0, | ||
115 | UMH_FREEZING, | ||
116 | UMH_DISABLED, | ||
117 | }; | ||
118 | |||
113 | extern void usermodehelper_init(void); | 119 | extern void usermodehelper_init(void); |
114 | 120 | ||
115 | extern int usermodehelper_disable(void); | 121 | extern int __usermodehelper_disable(enum umh_disable_depth depth); |
116 | extern void usermodehelper_enable(void); | 122 | extern void __usermodehelper_set_disable_depth(enum umh_disable_depth depth); |
117 | extern bool usermodehelper_is_disabled(void); | 123 | |
118 | extern void read_lock_usermodehelper(void); | 124 | static inline int usermodehelper_disable(void) |
119 | extern void read_unlock_usermodehelper(void); | 125 | { |
126 | return __usermodehelper_disable(UMH_DISABLED); | ||
127 | } | ||
128 | |||
129 | static inline void usermodehelper_enable(void) | ||
130 | { | ||
131 | __usermodehelper_set_disable_depth(UMH_ENABLED); | ||
132 | } | ||
133 | |||
134 | extern int usermodehelper_read_trylock(void); | ||
135 | extern long usermodehelper_read_lock_wait(long timeout); | ||
136 | extern void usermodehelper_read_unlock(void); | ||
120 | 137 | ||
121 | #endif /* __LINUX_KMOD_H__ */ | 138 | #endif /* __LINUX_KMOD_H__ */ |
diff --git a/include/linux/lsm_audit.h b/include/linux/lsm_audit.h index eab507f2b1cb..fad48aab893b 100644 --- a/include/linux/lsm_audit.h +++ b/include/linux/lsm_audit.h | |||
@@ -22,6 +22,23 @@ | |||
22 | #include <linux/key.h> | 22 | #include <linux/key.h> |
23 | #include <linux/skbuff.h> | 23 | #include <linux/skbuff.h> |
24 | 24 | ||
25 | struct lsm_network_audit { | ||
26 | int netif; | ||
27 | struct sock *sk; | ||
28 | u16 family; | ||
29 | __be16 dport; | ||
30 | __be16 sport; | ||
31 | union { | ||
32 | struct { | ||
33 | __be32 daddr; | ||
34 | __be32 saddr; | ||
35 | } v4; | ||
36 | struct { | ||
37 | struct in6_addr daddr; | ||
38 | struct in6_addr saddr; | ||
39 | } v6; | ||
40 | } fam; | ||
41 | }; | ||
25 | 42 | ||
26 | /* Auxiliary data to use in generating the audit record. */ | 43 | /* Auxiliary data to use in generating the audit record. */ |
27 | struct common_audit_data { | 44 | struct common_audit_data { |
@@ -41,23 +58,7 @@ struct common_audit_data { | |||
41 | struct path path; | 58 | struct path path; |
42 | struct dentry *dentry; | 59 | struct dentry *dentry; |
43 | struct inode *inode; | 60 | struct inode *inode; |
44 | struct { | 61 | struct lsm_network_audit *net; |
45 | int netif; | ||
46 | struct sock *sk; | ||
47 | u16 family; | ||
48 | __be16 dport; | ||
49 | __be16 sport; | ||
50 | union { | ||
51 | struct { | ||
52 | __be32 daddr; | ||
53 | __be32 saddr; | ||
54 | } v4; | ||
55 | struct { | ||
56 | struct in6_addr daddr; | ||
57 | struct in6_addr saddr; | ||
58 | } v6; | ||
59 | } fam; | ||
60 | } net; | ||
61 | int cap; | 62 | int cap; |
62 | int ipc_id; | 63 | int ipc_id; |
63 | struct task_struct *tsk; | 64 | struct task_struct *tsk; |
@@ -72,64 +73,15 @@ struct common_audit_data { | |||
72 | /* this union contains LSM specific data */ | 73 | /* this union contains LSM specific data */ |
73 | union { | 74 | union { |
74 | #ifdef CONFIG_SECURITY_SMACK | 75 | #ifdef CONFIG_SECURITY_SMACK |
75 | /* SMACK data */ | 76 | struct smack_audit_data *smack_audit_data; |
76 | struct smack_audit_data { | ||
77 | const char *function; | ||
78 | char *subject; | ||
79 | char *object; | ||
80 | char *request; | ||
81 | int result; | ||
82 | } smack_audit_data; | ||
83 | #endif | 77 | #endif |
84 | #ifdef CONFIG_SECURITY_SELINUX | 78 | #ifdef CONFIG_SECURITY_SELINUX |
85 | /* SELinux data */ | 79 | struct selinux_audit_data *selinux_audit_data; |
86 | struct { | ||
87 | u32 ssid; | ||
88 | u32 tsid; | ||
89 | u16 tclass; | ||
90 | u32 requested; | ||
91 | u32 audited; | ||
92 | u32 denied; | ||
93 | /* | ||
94 | * auditdeny is a bit tricky and unintuitive. See the | ||
95 | * comments in avc.c for it's meaning and usage. | ||
96 | */ | ||
97 | u32 auditdeny; | ||
98 | struct av_decision *avd; | ||
99 | int result; | ||
100 | } selinux_audit_data; | ||
101 | #endif | 80 | #endif |
102 | #ifdef CONFIG_SECURITY_APPARMOR | 81 | #ifdef CONFIG_SECURITY_APPARMOR |
103 | struct { | 82 | struct apparmor_audit_data *apparmor_audit_data; |
104 | int error; | ||
105 | int op; | ||
106 | int type; | ||
107 | void *profile; | ||
108 | const char *name; | ||
109 | const char *info; | ||
110 | union { | ||
111 | void *target; | ||
112 | struct { | ||
113 | long pos; | ||
114 | void *target; | ||
115 | } iface; | ||
116 | struct { | ||
117 | int rlim; | ||
118 | unsigned long max; | ||
119 | } rlim; | ||
120 | struct { | ||
121 | const char *target; | ||
122 | u32 request; | ||
123 | u32 denied; | ||
124 | uid_t ouid; | ||
125 | } fs; | ||
126 | }; | ||
127 | } apparmor_audit_data; | ||
128 | #endif | 83 | #endif |
129 | }; | 84 | }; /* per LSM data pointer union */ |
130 | /* these callback will be implemented by a specific LSM */ | ||
131 | void (*lsm_pre_audit)(struct audit_buffer *, void *); | ||
132 | void (*lsm_post_audit)(struct audit_buffer *, void *); | ||
133 | }; | 85 | }; |
134 | 86 | ||
135 | #define v4info fam.v4 | 87 | #define v4info fam.v4 |
@@ -146,6 +98,8 @@ int ipv6_skb_to_auditdata(struct sk_buff *skb, | |||
146 | { memset((_d), 0, sizeof(struct common_audit_data)); \ | 98 | { memset((_d), 0, sizeof(struct common_audit_data)); \ |
147 | (_d)->type = LSM_AUDIT_DATA_##_t; } | 99 | (_d)->type = LSM_AUDIT_DATA_##_t; } |
148 | 100 | ||
149 | void common_lsm_audit(struct common_audit_data *a); | 101 | void common_lsm_audit(struct common_audit_data *a, |
102 | void (*pre_audit)(struct audit_buffer *, void *), | ||
103 | void (*post_audit)(struct audit_buffer *, void *)); | ||
150 | 104 | ||
151 | #endif | 105 | #endif |
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 1f77540bdc95..5cbaa20f1659 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h | |||
@@ -2604,8 +2604,6 @@ extern void net_disable_timestamp(void); | |||
2604 | extern void *dev_seq_start(struct seq_file *seq, loff_t *pos); | 2604 | extern void *dev_seq_start(struct seq_file *seq, loff_t *pos); |
2605 | extern void *dev_seq_next(struct seq_file *seq, void *v, loff_t *pos); | 2605 | extern void *dev_seq_next(struct seq_file *seq, void *v, loff_t *pos); |
2606 | extern void dev_seq_stop(struct seq_file *seq, void *v); | 2606 | extern void dev_seq_stop(struct seq_file *seq, void *v); |
2607 | extern int dev_seq_open_ops(struct inode *inode, struct file *file, | ||
2608 | const struct seq_operations *ops); | ||
2609 | #endif | 2607 | #endif |
2610 | 2608 | ||
2611 | extern int netdev_class_create_file(struct class_attribute *class_attr); | 2609 | extern int netdev_class_create_file(struct class_attribute *class_attr); |
diff --git a/include/linux/netfilter/xt_set.h b/include/linux/netfilter/xt_set.h index c0405ac92870..e3a9978f259f 100644 --- a/include/linux/netfilter/xt_set.h +++ b/include/linux/netfilter/xt_set.h | |||
@@ -58,8 +58,8 @@ struct xt_set_info_target_v1 { | |||
58 | struct xt_set_info_target_v2 { | 58 | struct xt_set_info_target_v2 { |
59 | struct xt_set_info add_set; | 59 | struct xt_set_info add_set; |
60 | struct xt_set_info del_set; | 60 | struct xt_set_info del_set; |
61 | u32 flags; | 61 | __u32 flags; |
62 | u32 timeout; | 62 | __u32 timeout; |
63 | }; | 63 | }; |
64 | 64 | ||
65 | #endif /*_XT_SET_H*/ | 65 | #endif /*_XT_SET_H*/ |
diff --git a/include/linux/platform_data/atmel.h b/include/linux/platform_data/atmel.h index d056263545b1..b0f2c56a8ea2 100644 --- a/include/linux/platform_data/atmel.h +++ b/include/linux/platform_data/atmel.h | |||
@@ -4,8 +4,8 @@ | |||
4 | * GPL v2 Only | 4 | * GPL v2 Only |
5 | */ | 5 | */ |
6 | 6 | ||
7 | #ifndef __ATMEL_NAND_H__ | 7 | #ifndef __ATMEL_H__ |
8 | #define __ATMEL_NAND_H__ | 8 | #define __ATMEL_H__ |
9 | 9 | ||
10 | #include <linux/mtd/nand.h> | 10 | #include <linux/mtd/nand.h> |
11 | 11 | ||
@@ -24,4 +24,4 @@ struct atmel_nand_data { | |||
24 | unsigned int num_parts; | 24 | unsigned int num_parts; |
25 | }; | 25 | }; |
26 | 26 | ||
27 | #endif /* __ATMEL_NAND_H__ */ | 27 | #endif /* __ATMEL_H__ */ |
diff --git a/include/linux/pm_qos.h b/include/linux/pm_qos.h index 2e9191a712f3..233149cb19f4 100644 --- a/include/linux/pm_qos.h +++ b/include/linux/pm_qos.h | |||
@@ -8,6 +8,7 @@ | |||
8 | #include <linux/notifier.h> | 8 | #include <linux/notifier.h> |
9 | #include <linux/miscdevice.h> | 9 | #include <linux/miscdevice.h> |
10 | #include <linux/device.h> | 10 | #include <linux/device.h> |
11 | #include <linux/workqueue.h> | ||
11 | 12 | ||
12 | enum { | 13 | enum { |
13 | PM_QOS_RESERVED = 0, | 14 | PM_QOS_RESERVED = 0, |
@@ -29,6 +30,7 @@ enum { | |||
29 | struct pm_qos_request { | 30 | struct pm_qos_request { |
30 | struct plist_node node; | 31 | struct plist_node node; |
31 | int pm_qos_class; | 32 | int pm_qos_class; |
33 | struct delayed_work work; /* for pm_qos_update_request_timeout */ | ||
32 | }; | 34 | }; |
33 | 35 | ||
34 | struct dev_pm_qos_request { | 36 | struct dev_pm_qos_request { |
@@ -73,6 +75,8 @@ void pm_qos_add_request(struct pm_qos_request *req, int pm_qos_class, | |||
73 | s32 value); | 75 | s32 value); |
74 | void pm_qos_update_request(struct pm_qos_request *req, | 76 | void pm_qos_update_request(struct pm_qos_request *req, |
75 | s32 new_value); | 77 | s32 new_value); |
78 | void pm_qos_update_request_timeout(struct pm_qos_request *req, | ||
79 | s32 new_value, unsigned long timeout_us); | ||
76 | void pm_qos_remove_request(struct pm_qos_request *req); | 80 | void pm_qos_remove_request(struct pm_qos_request *req); |
77 | 81 | ||
78 | int pm_qos_request(int pm_qos_class); | 82 | int pm_qos_request(int pm_qos_class); |
diff --git a/include/linux/regulator/machine.h b/include/linux/regulator/machine.h index 7abb16093312..b02108446be7 100644 --- a/include/linux/regulator/machine.h +++ b/include/linux/regulator/machine.h | |||
@@ -71,7 +71,7 @@ struct regulator_state { | |||
71 | * @uV_offset: Offset applied to voltages from consumer to compensate for | 71 | * @uV_offset: Offset applied to voltages from consumer to compensate for |
72 | * voltage drops. | 72 | * voltage drops. |
73 | * | 73 | * |
74 | * @min_uA: Smallest consumers consumers may set. | 74 | * @min_uA: Smallest current consumers may set. |
75 | * @max_uA: Largest current consumers may set. | 75 | * @max_uA: Largest current consumers may set. |
76 | * | 76 | * |
77 | * @valid_modes_mask: Mask of modes which may be configured by consumers. | 77 | * @valid_modes_mask: Mask of modes which may be configured by consumers. |
@@ -134,10 +134,8 @@ struct regulation_constraints { | |||
134 | /** | 134 | /** |
135 | * struct regulator_consumer_supply - supply -> device mapping | 135 | * struct regulator_consumer_supply - supply -> device mapping |
136 | * | 136 | * |
137 | * This maps a supply name to a device. Only one of dev or dev_name | 137 | * This maps a supply name to a device. Use of dev_name allows support for |
138 | * can be specified. Use of dev_name allows support for buses which | 138 | * buses which make struct device available late such as I2C. |
139 | * make struct device available late such as I2C and is the preferred | ||
140 | * form. | ||
141 | * | 139 | * |
142 | * @dev_name: Result of dev_name() for the consumer. | 140 | * @dev_name: Result of dev_name() for the consumer. |
143 | * @supply: Name for the supply. | 141 | * @supply: Name for the supply. |
diff --git a/include/linux/socket.h b/include/linux/socket.h index da2d3e2543f3..b84bbd48b874 100644 --- a/include/linux/socket.h +++ b/include/linux/socket.h | |||
@@ -265,7 +265,7 @@ struct ucred { | |||
265 | #define MSG_NOSIGNAL 0x4000 /* Do not generate SIGPIPE */ | 265 | #define MSG_NOSIGNAL 0x4000 /* Do not generate SIGPIPE */ |
266 | #define MSG_MORE 0x8000 /* Sender will send more */ | 266 | #define MSG_MORE 0x8000 /* Sender will send more */ |
267 | #define MSG_WAITFORONE 0x10000 /* recvmmsg(): block until 1+ packets avail */ | 267 | #define MSG_WAITFORONE 0x10000 /* recvmmsg(): block until 1+ packets avail */ |
268 | 268 | #define MSG_SENDPAGE_NOTLAST 0x20000 /* sendpage() internal : not the last page */ | |
269 | #define MSG_EOF MSG_FIN | 269 | #define MSG_EOF MSG_FIN |
270 | 270 | ||
271 | #define MSG_CMSG_CLOEXEC 0x40000000 /* Set close_on_exit for file | 271 | #define MSG_CMSG_CLOEXEC 0x40000000 /* Set close_on_exit for file |
diff --git a/include/linux/swap.h b/include/linux/swap.h index 8dc0ea7caf02..b1fd5c7925fe 100644 --- a/include/linux/swap.h +++ b/include/linux/swap.h | |||
@@ -305,6 +305,13 @@ static inline int mem_cgroup_swappiness(struct mem_cgroup *mem) | |||
305 | return vm_swappiness; | 305 | return vm_swappiness; |
306 | } | 306 | } |
307 | #endif | 307 | #endif |
308 | #ifdef CONFIG_CGROUP_MEM_RES_CTLR_SWAP | ||
309 | extern void mem_cgroup_uncharge_swap(swp_entry_t ent); | ||
310 | #else | ||
311 | static inline void mem_cgroup_uncharge_swap(swp_entry_t ent) | ||
312 | { | ||
313 | } | ||
314 | #endif | ||
308 | #ifdef CONFIG_SWAP | 315 | #ifdef CONFIG_SWAP |
309 | /* linux/mm/page_io.c */ | 316 | /* linux/mm/page_io.c */ |
310 | extern int swap_readpage(struct page *); | 317 | extern int swap_readpage(struct page *); |
@@ -375,13 +382,6 @@ mem_cgroup_uncharge_swapcache(struct page *page, swp_entry_t ent, bool swapout) | |||
375 | { | 382 | { |
376 | } | 383 | } |
377 | #endif | 384 | #endif |
378 | #ifdef CONFIG_CGROUP_MEM_RES_CTLR_SWAP | ||
379 | extern void mem_cgroup_uncharge_swap(swp_entry_t ent); | ||
380 | #else | ||
381 | static inline void mem_cgroup_uncharge_swap(swp_entry_t ent) | ||
382 | { | ||
383 | } | ||
384 | #endif | ||
385 | 385 | ||
386 | #else /* CONFIG_SWAP */ | 386 | #else /* CONFIG_SWAP */ |
387 | 387 | ||
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index 248fb05feb63..83d800c31e3c 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h | |||
@@ -620,8 +620,10 @@ struct sta_bss_parameters { | |||
620 | * @llid: mesh local link id | 620 | * @llid: mesh local link id |
621 | * @plid: mesh peer link id | 621 | * @plid: mesh peer link id |
622 | * @plink_state: mesh peer link state | 622 | * @plink_state: mesh peer link state |
623 | * @signal: signal strength of last received packet in dBm | 623 | * @signal: the signal strength, type depends on the wiphy's signal_type |
624 | * @signal_avg: signal strength average in dBm | 624 | NOTE: For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_. |
625 | * @signal_avg: avg signal strength, type depends on the wiphy's signal_type | ||
626 | NOTE: For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_. | ||
625 | * @txrate: current unicast bitrate from this station | 627 | * @txrate: current unicast bitrate from this station |
626 | * @rxrate: current unicast bitrate to this station | 628 | * @rxrate: current unicast bitrate to this station |
627 | * @rx_packets: packets received from this station | 629 | * @rx_packets: packets received from this station |
diff --git a/include/net/netfilter/xt_log.h b/include/net/netfilter/xt_log.h index 7e1544e8f70d..9d9756cca013 100644 --- a/include/net/netfilter/xt_log.h +++ b/include/net/netfilter/xt_log.h | |||
@@ -47,7 +47,7 @@ static void sb_close(struct sbuff *m) | |||
47 | if (likely(m != &emergency)) | 47 | if (likely(m != &emergency)) |
48 | kfree(m); | 48 | kfree(m); |
49 | else { | 49 | else { |
50 | xchg(&emergency_ptr, m); | 50 | emergency_ptr = m; |
51 | local_bh_enable(); | 51 | local_bh_enable(); |
52 | } | 52 | } |
53 | } | 53 | } |
diff --git a/include/trace/events/sched.h b/include/trace/events/sched.h index fbc7b1ad929b..ea7a2035456d 100644 --- a/include/trace/events/sched.h +++ b/include/trace/events/sched.h | |||
@@ -295,7 +295,7 @@ TRACE_EVENT(sched_process_exec, | |||
295 | TP_fast_assign( | 295 | TP_fast_assign( |
296 | __assign_str(filename, bprm->filename); | 296 | __assign_str(filename, bprm->filename); |
297 | __entry->pid = p->pid; | 297 | __entry->pid = p->pid; |
298 | __entry->old_pid = p->pid; | 298 | __entry->old_pid = old_pid; |
299 | ), | 299 | ), |
300 | 300 | ||
301 | TP_printk("filename=%s pid=%d old_pid=%d", __get_str(filename), | 301 | TP_printk("filename=%s pid=%d old_pid=%d", __get_str(filename), |
diff --git a/include/xen/swiotlb-xen.h b/include/xen/swiotlb-xen.h index 2ea2fdc79c16..4f4d449f00f6 100644 --- a/include/xen/swiotlb-xen.h +++ b/include/xen/swiotlb-xen.h | |||
@@ -7,11 +7,13 @@ extern void xen_swiotlb_init(int verbose); | |||
7 | 7 | ||
8 | extern void | 8 | extern void |
9 | *xen_swiotlb_alloc_coherent(struct device *hwdev, size_t size, | 9 | *xen_swiotlb_alloc_coherent(struct device *hwdev, size_t size, |
10 | dma_addr_t *dma_handle, gfp_t flags); | 10 | dma_addr_t *dma_handle, gfp_t flags, |
11 | struct dma_attrs *attrs); | ||
11 | 12 | ||
12 | extern void | 13 | extern void |
13 | xen_swiotlb_free_coherent(struct device *hwdev, size_t size, | 14 | xen_swiotlb_free_coherent(struct device *hwdev, size_t size, |
14 | void *vaddr, dma_addr_t dma_handle); | 15 | void *vaddr, dma_addr_t dma_handle, |
16 | struct dma_attrs *attrs); | ||
15 | 17 | ||
16 | extern dma_addr_t xen_swiotlb_map_page(struct device *dev, struct page *page, | 18 | extern dma_addr_t xen_swiotlb_map_page(struct device *dev, struct page *page, |
17 | unsigned long offset, size_t size, | 19 | unsigned long offset, size_t size, |
diff --git a/init/Kconfig b/init/Kconfig index 72f33faca44f..6cfd71d06463 100644 --- a/init/Kconfig +++ b/init/Kconfig | |||
@@ -1414,8 +1414,8 @@ endif # MODULES | |||
1414 | config INIT_ALL_POSSIBLE | 1414 | config INIT_ALL_POSSIBLE |
1415 | bool | 1415 | bool |
1416 | help | 1416 | help |
1417 | Back when each arch used to define their own cpu_online_map and | 1417 | Back when each arch used to define their own cpu_online_mask and |
1418 | cpu_possible_map, some of them chose to initialize cpu_possible_map | 1418 | cpu_possible_mask, some of them chose to initialize cpu_possible_mask |
1419 | with all 1s, and others with all 0s. When they were centralised, | 1419 | with all 1s, and others with all 0s. When they were centralised, |
1420 | it was better to provide this option than to break all the archs | 1420 | it was better to provide this option than to break all the archs |
1421 | and have several arch maintainers pursuing me down dark alleys. | 1421 | and have several arch maintainers pursuing me down dark alleys. |
diff --git a/kernel/cpuset.c b/kernel/cpuset.c index b96ad75b7e64..14f7070b4ba2 100644 --- a/kernel/cpuset.c +++ b/kernel/cpuset.c | |||
@@ -270,11 +270,11 @@ static struct file_system_type cpuset_fs_type = { | |||
270 | * are online. If none are online, walk up the cpuset hierarchy | 270 | * are online. If none are online, walk up the cpuset hierarchy |
271 | * until we find one that does have some online cpus. If we get | 271 | * until we find one that does have some online cpus. If we get |
272 | * all the way to the top and still haven't found any online cpus, | 272 | * all the way to the top and still haven't found any online cpus, |
273 | * return cpu_online_map. Or if passed a NULL cs from an exit'ing | 273 | * return cpu_online_mask. Or if passed a NULL cs from an exit'ing |
274 | * task, return cpu_online_map. | 274 | * task, return cpu_online_mask. |
275 | * | 275 | * |
276 | * One way or another, we guarantee to return some non-empty subset | 276 | * One way or another, we guarantee to return some non-empty subset |
277 | * of cpu_online_map. | 277 | * of cpu_online_mask. |
278 | * | 278 | * |
279 | * Call with callback_mutex held. | 279 | * Call with callback_mutex held. |
280 | */ | 280 | */ |
@@ -867,7 +867,7 @@ static int update_cpumask(struct cpuset *cs, struct cpuset *trialcs, | |||
867 | int retval; | 867 | int retval; |
868 | int is_load_balanced; | 868 | int is_load_balanced; |
869 | 869 | ||
870 | /* top_cpuset.cpus_allowed tracks cpu_online_map; it's read-only */ | 870 | /* top_cpuset.cpus_allowed tracks cpu_online_mask; it's read-only */ |
871 | if (cs == &top_cpuset) | 871 | if (cs == &top_cpuset) |
872 | return -EACCES; | 872 | return -EACCES; |
873 | 873 | ||
@@ -2149,7 +2149,7 @@ void __init cpuset_init_smp(void) | |||
2149 | * | 2149 | * |
2150 | * Description: Returns the cpumask_var_t cpus_allowed of the cpuset | 2150 | * Description: Returns the cpumask_var_t cpus_allowed of the cpuset |
2151 | * attached to the specified @tsk. Guaranteed to return some non-empty | 2151 | * attached to the specified @tsk. Guaranteed to return some non-empty |
2152 | * subset of cpu_online_map, even if this means going outside the | 2152 | * subset of cpu_online_mask, even if this means going outside the |
2153 | * tasks cpuset. | 2153 | * tasks cpuset. |
2154 | **/ | 2154 | **/ |
2155 | 2155 | ||
diff --git a/kernel/debug/debug_core.c b/kernel/debug/debug_core.c index 1dc53bae56e1..0557f24c6bca 100644 --- a/kernel/debug/debug_core.c +++ b/kernel/debug/debug_core.c | |||
@@ -160,37 +160,39 @@ early_param("nokgdbroundup", opt_nokgdbroundup); | |||
160 | * Weak aliases for breakpoint management, | 160 | * Weak aliases for breakpoint management, |
161 | * can be overriden by architectures when needed: | 161 | * can be overriden by architectures when needed: |
162 | */ | 162 | */ |
163 | int __weak kgdb_arch_set_breakpoint(unsigned long addr, char *saved_instr) | 163 | int __weak kgdb_arch_set_breakpoint(struct kgdb_bkpt *bpt) |
164 | { | 164 | { |
165 | int err; | 165 | int err; |
166 | 166 | ||
167 | err = probe_kernel_read(saved_instr, (char *)addr, BREAK_INSTR_SIZE); | 167 | err = probe_kernel_read(bpt->saved_instr, (char *)bpt->bpt_addr, |
168 | BREAK_INSTR_SIZE); | ||
168 | if (err) | 169 | if (err) |
169 | return err; | 170 | return err; |
170 | 171 | err = probe_kernel_write((char *)bpt->bpt_addr, | |
171 | return probe_kernel_write((char *)addr, arch_kgdb_ops.gdb_bpt_instr, | 172 | arch_kgdb_ops.gdb_bpt_instr, BREAK_INSTR_SIZE); |
172 | BREAK_INSTR_SIZE); | 173 | return err; |
173 | } | 174 | } |
174 | 175 | ||
175 | int __weak kgdb_arch_remove_breakpoint(unsigned long addr, char *bundle) | 176 | int __weak kgdb_arch_remove_breakpoint(struct kgdb_bkpt *bpt) |
176 | { | 177 | { |
177 | return probe_kernel_write((char *)addr, | 178 | return probe_kernel_write((char *)bpt->bpt_addr, |
178 | (char *)bundle, BREAK_INSTR_SIZE); | 179 | (char *)bpt->saved_instr, BREAK_INSTR_SIZE); |
179 | } | 180 | } |
180 | 181 | ||
181 | int __weak kgdb_validate_break_address(unsigned long addr) | 182 | int __weak kgdb_validate_break_address(unsigned long addr) |
182 | { | 183 | { |
183 | char tmp_variable[BREAK_INSTR_SIZE]; | 184 | struct kgdb_bkpt tmp; |
184 | int err; | 185 | int err; |
185 | /* Validate setting the breakpoint and then removing it. In the | 186 | /* Validate setting the breakpoint and then removing it. If the |
186 | * remove fails, the kernel needs to emit a bad message because we | 187 | * remove fails, the kernel needs to emit a bad message because we |
187 | * are deep trouble not being able to put things back the way we | 188 | * are deep trouble not being able to put things back the way we |
188 | * found them. | 189 | * found them. |
189 | */ | 190 | */ |
190 | err = kgdb_arch_set_breakpoint(addr, tmp_variable); | 191 | tmp.bpt_addr = addr; |
192 | err = kgdb_arch_set_breakpoint(&tmp); | ||
191 | if (err) | 193 | if (err) |
192 | return err; | 194 | return err; |
193 | err = kgdb_arch_remove_breakpoint(addr, tmp_variable); | 195 | err = kgdb_arch_remove_breakpoint(&tmp); |
194 | if (err) | 196 | if (err) |
195 | printk(KERN_ERR "KGDB: Critical breakpoint error, kernel " | 197 | printk(KERN_ERR "KGDB: Critical breakpoint error, kernel " |
196 | "memory destroyed at: %lx", addr); | 198 | "memory destroyed at: %lx", addr); |
@@ -234,7 +236,6 @@ static void kgdb_flush_swbreak_addr(unsigned long addr) | |||
234 | */ | 236 | */ |
235 | int dbg_activate_sw_breakpoints(void) | 237 | int dbg_activate_sw_breakpoints(void) |
236 | { | 238 | { |
237 | unsigned long addr; | ||
238 | int error; | 239 | int error; |
239 | int ret = 0; | 240 | int ret = 0; |
240 | int i; | 241 | int i; |
@@ -243,16 +244,15 @@ int dbg_activate_sw_breakpoints(void) | |||
243 | if (kgdb_break[i].state != BP_SET) | 244 | if (kgdb_break[i].state != BP_SET) |
244 | continue; | 245 | continue; |
245 | 246 | ||
246 | addr = kgdb_break[i].bpt_addr; | 247 | error = kgdb_arch_set_breakpoint(&kgdb_break[i]); |
247 | error = kgdb_arch_set_breakpoint(addr, | ||
248 | kgdb_break[i].saved_instr); | ||
249 | if (error) { | 248 | if (error) { |
250 | ret = error; | 249 | ret = error; |
251 | printk(KERN_INFO "KGDB: BP install failed: %lx", addr); | 250 | printk(KERN_INFO "KGDB: BP install failed: %lx", |
251 | kgdb_break[i].bpt_addr); | ||
252 | continue; | 252 | continue; |
253 | } | 253 | } |
254 | 254 | ||
255 | kgdb_flush_swbreak_addr(addr); | 255 | kgdb_flush_swbreak_addr(kgdb_break[i].bpt_addr); |
256 | kgdb_break[i].state = BP_ACTIVE; | 256 | kgdb_break[i].state = BP_ACTIVE; |
257 | } | 257 | } |
258 | return ret; | 258 | return ret; |
@@ -301,7 +301,6 @@ int dbg_set_sw_break(unsigned long addr) | |||
301 | 301 | ||
302 | int dbg_deactivate_sw_breakpoints(void) | 302 | int dbg_deactivate_sw_breakpoints(void) |
303 | { | 303 | { |
304 | unsigned long addr; | ||
305 | int error; | 304 | int error; |
306 | int ret = 0; | 305 | int ret = 0; |
307 | int i; | 306 | int i; |
@@ -309,15 +308,14 @@ int dbg_deactivate_sw_breakpoints(void) | |||
309 | for (i = 0; i < KGDB_MAX_BREAKPOINTS; i++) { | 308 | for (i = 0; i < KGDB_MAX_BREAKPOINTS; i++) { |
310 | if (kgdb_break[i].state != BP_ACTIVE) | 309 | if (kgdb_break[i].state != BP_ACTIVE) |
311 | continue; | 310 | continue; |
312 | addr = kgdb_break[i].bpt_addr; | 311 | error = kgdb_arch_remove_breakpoint(&kgdb_break[i]); |
313 | error = kgdb_arch_remove_breakpoint(addr, | ||
314 | kgdb_break[i].saved_instr); | ||
315 | if (error) { | 312 | if (error) { |
316 | printk(KERN_INFO "KGDB: BP remove failed: %lx\n", addr); | 313 | printk(KERN_INFO "KGDB: BP remove failed: %lx\n", |
314 | kgdb_break[i].bpt_addr); | ||
317 | ret = error; | 315 | ret = error; |
318 | } | 316 | } |
319 | 317 | ||
320 | kgdb_flush_swbreak_addr(addr); | 318 | kgdb_flush_swbreak_addr(kgdb_break[i].bpt_addr); |
321 | kgdb_break[i].state = BP_SET; | 319 | kgdb_break[i].state = BP_SET; |
322 | } | 320 | } |
323 | return ret; | 321 | return ret; |
@@ -351,7 +349,6 @@ int kgdb_isremovedbreak(unsigned long addr) | |||
351 | 349 | ||
352 | int dbg_remove_all_break(void) | 350 | int dbg_remove_all_break(void) |
353 | { | 351 | { |
354 | unsigned long addr; | ||
355 | int error; | 352 | int error; |
356 | int i; | 353 | int i; |
357 | 354 | ||
@@ -359,12 +356,10 @@ int dbg_remove_all_break(void) | |||
359 | for (i = 0; i < KGDB_MAX_BREAKPOINTS; i++) { | 356 | for (i = 0; i < KGDB_MAX_BREAKPOINTS; i++) { |
360 | if (kgdb_break[i].state != BP_ACTIVE) | 357 | if (kgdb_break[i].state != BP_ACTIVE) |
361 | goto setundefined; | 358 | goto setundefined; |
362 | addr = kgdb_break[i].bpt_addr; | 359 | error = kgdb_arch_remove_breakpoint(&kgdb_break[i]); |
363 | error = kgdb_arch_remove_breakpoint(addr, | ||
364 | kgdb_break[i].saved_instr); | ||
365 | if (error) | 360 | if (error) |
366 | printk(KERN_ERR "KGDB: breakpoint remove failed: %lx\n", | 361 | printk(KERN_ERR "KGDB: breakpoint remove failed: %lx\n", |
367 | addr); | 362 | kgdb_break[i].bpt_addr); |
368 | setundefined: | 363 | setundefined: |
369 | kgdb_break[i].state = BP_UNDEFINED; | 364 | kgdb_break[i].state = BP_UNDEFINED; |
370 | } | 365 | } |
diff --git a/kernel/debug/kdb/kdb_io.c b/kernel/debug/kdb/kdb_io.c index 9b5f17da1c56..bb9520f0f6ff 100644 --- a/kernel/debug/kdb/kdb_io.c +++ b/kernel/debug/kdb/kdb_io.c | |||
@@ -743,7 +743,7 @@ kdb_printit: | |||
743 | kdb_input_flush(); | 743 | kdb_input_flush(); |
744 | c = console_drivers; | 744 | c = console_drivers; |
745 | 745 | ||
746 | if (!dbg_io_ops->is_console) { | 746 | if (dbg_io_ops && !dbg_io_ops->is_console) { |
747 | len = strlen(moreprompt); | 747 | len = strlen(moreprompt); |
748 | cp = moreprompt; | 748 | cp = moreprompt; |
749 | while (len--) { | 749 | while (len--) { |
diff --git a/kernel/irq_work.c b/kernel/irq_work.c index c3c46c72046e..0c56d44b9fd5 100644 --- a/kernel/irq_work.c +++ b/kernel/irq_work.c | |||
@@ -5,6 +5,7 @@ | |||
5 | * context. The enqueueing is NMI-safe. | 5 | * context. The enqueueing is NMI-safe. |
6 | */ | 6 | */ |
7 | 7 | ||
8 | #include <linux/bug.h> | ||
8 | #include <linux/kernel.h> | 9 | #include <linux/kernel.h> |
9 | #include <linux/export.h> | 10 | #include <linux/export.h> |
10 | #include <linux/irq_work.h> | 11 | #include <linux/irq_work.h> |
diff --git a/kernel/kmod.c b/kernel/kmod.c index 957a7aab8ebc..05698a7415fe 100644 --- a/kernel/kmod.c +++ b/kernel/kmod.c | |||
@@ -322,7 +322,7 @@ static void __call_usermodehelper(struct work_struct *work) | |||
322 | * land has been frozen during a system-wide hibernation or suspend operation). | 322 | * land has been frozen during a system-wide hibernation or suspend operation). |
323 | * Should always be manipulated under umhelper_sem acquired for write. | 323 | * Should always be manipulated under umhelper_sem acquired for write. |
324 | */ | 324 | */ |
325 | static int usermodehelper_disabled = 1; | 325 | static enum umh_disable_depth usermodehelper_disabled = UMH_DISABLED; |
326 | 326 | ||
327 | /* Number of helpers running */ | 327 | /* Number of helpers running */ |
328 | static atomic_t running_helpers = ATOMIC_INIT(0); | 328 | static atomic_t running_helpers = ATOMIC_INIT(0); |
@@ -334,32 +334,110 @@ static atomic_t running_helpers = ATOMIC_INIT(0); | |||
334 | static DECLARE_WAIT_QUEUE_HEAD(running_helpers_waitq); | 334 | static DECLARE_WAIT_QUEUE_HEAD(running_helpers_waitq); |
335 | 335 | ||
336 | /* | 336 | /* |
337 | * Used by usermodehelper_read_lock_wait() to wait for usermodehelper_disabled | ||
338 | * to become 'false'. | ||
339 | */ | ||
340 | static DECLARE_WAIT_QUEUE_HEAD(usermodehelper_disabled_waitq); | ||
341 | |||
342 | /* | ||
337 | * Time to wait for running_helpers to become zero before the setting of | 343 | * Time to wait for running_helpers to become zero before the setting of |
338 | * usermodehelper_disabled in usermodehelper_disable() fails | 344 | * usermodehelper_disabled in usermodehelper_disable() fails |
339 | */ | 345 | */ |
340 | #define RUNNING_HELPERS_TIMEOUT (5 * HZ) | 346 | #define RUNNING_HELPERS_TIMEOUT (5 * HZ) |
341 | 347 | ||
342 | void read_lock_usermodehelper(void) | 348 | int usermodehelper_read_trylock(void) |
343 | { | 349 | { |
350 | DEFINE_WAIT(wait); | ||
351 | int ret = 0; | ||
352 | |||
344 | down_read(&umhelper_sem); | 353 | down_read(&umhelper_sem); |
354 | for (;;) { | ||
355 | prepare_to_wait(&usermodehelper_disabled_waitq, &wait, | ||
356 | TASK_INTERRUPTIBLE); | ||
357 | if (!usermodehelper_disabled) | ||
358 | break; | ||
359 | |||
360 | if (usermodehelper_disabled == UMH_DISABLED) | ||
361 | ret = -EAGAIN; | ||
362 | |||
363 | up_read(&umhelper_sem); | ||
364 | |||
365 | if (ret) | ||
366 | break; | ||
367 | |||
368 | schedule(); | ||
369 | try_to_freeze(); | ||
370 | |||
371 | down_read(&umhelper_sem); | ||
372 | } | ||
373 | finish_wait(&usermodehelper_disabled_waitq, &wait); | ||
374 | return ret; | ||
375 | } | ||
376 | EXPORT_SYMBOL_GPL(usermodehelper_read_trylock); | ||
377 | |||
378 | long usermodehelper_read_lock_wait(long timeout) | ||
379 | { | ||
380 | DEFINE_WAIT(wait); | ||
381 | |||
382 | if (timeout < 0) | ||
383 | return -EINVAL; | ||
384 | |||
385 | down_read(&umhelper_sem); | ||
386 | for (;;) { | ||
387 | prepare_to_wait(&usermodehelper_disabled_waitq, &wait, | ||
388 | TASK_UNINTERRUPTIBLE); | ||
389 | if (!usermodehelper_disabled) | ||
390 | break; | ||
391 | |||
392 | up_read(&umhelper_sem); | ||
393 | |||
394 | timeout = schedule_timeout(timeout); | ||
395 | if (!timeout) | ||
396 | break; | ||
397 | |||
398 | down_read(&umhelper_sem); | ||
399 | } | ||
400 | finish_wait(&usermodehelper_disabled_waitq, &wait); | ||
401 | return timeout; | ||
345 | } | 402 | } |
346 | EXPORT_SYMBOL_GPL(read_lock_usermodehelper); | 403 | EXPORT_SYMBOL_GPL(usermodehelper_read_lock_wait); |
347 | 404 | ||
348 | void read_unlock_usermodehelper(void) | 405 | void usermodehelper_read_unlock(void) |
349 | { | 406 | { |
350 | up_read(&umhelper_sem); | 407 | up_read(&umhelper_sem); |
351 | } | 408 | } |
352 | EXPORT_SYMBOL_GPL(read_unlock_usermodehelper); | 409 | EXPORT_SYMBOL_GPL(usermodehelper_read_unlock); |
353 | 410 | ||
354 | /** | 411 | /** |
355 | * usermodehelper_disable - prevent new helpers from being started | 412 | * __usermodehelper_set_disable_depth - Modify usermodehelper_disabled. |
413 | * depth: New value to assign to usermodehelper_disabled. | ||
414 | * | ||
415 | * Change the value of usermodehelper_disabled (under umhelper_sem locked for | ||
416 | * writing) and wakeup tasks waiting for it to change. | ||
356 | */ | 417 | */ |
357 | int usermodehelper_disable(void) | 418 | void __usermodehelper_set_disable_depth(enum umh_disable_depth depth) |
419 | { | ||
420 | down_write(&umhelper_sem); | ||
421 | usermodehelper_disabled = depth; | ||
422 | wake_up(&usermodehelper_disabled_waitq); | ||
423 | up_write(&umhelper_sem); | ||
424 | } | ||
425 | |||
426 | /** | ||
427 | * __usermodehelper_disable - Prevent new helpers from being started. | ||
428 | * @depth: New value to assign to usermodehelper_disabled. | ||
429 | * | ||
430 | * Set usermodehelper_disabled to @depth and wait for running helpers to exit. | ||
431 | */ | ||
432 | int __usermodehelper_disable(enum umh_disable_depth depth) | ||
358 | { | 433 | { |
359 | long retval; | 434 | long retval; |
360 | 435 | ||
436 | if (!depth) | ||
437 | return -EINVAL; | ||
438 | |||
361 | down_write(&umhelper_sem); | 439 | down_write(&umhelper_sem); |
362 | usermodehelper_disabled = 1; | 440 | usermodehelper_disabled = depth; |
363 | up_write(&umhelper_sem); | 441 | up_write(&umhelper_sem); |
364 | 442 | ||
365 | /* | 443 | /* |
@@ -374,31 +452,10 @@ int usermodehelper_disable(void) | |||
374 | if (retval) | 452 | if (retval) |
375 | return 0; | 453 | return 0; |
376 | 454 | ||
377 | down_write(&umhelper_sem); | 455 | __usermodehelper_set_disable_depth(UMH_ENABLED); |
378 | usermodehelper_disabled = 0; | ||
379 | up_write(&umhelper_sem); | ||
380 | return -EAGAIN; | 456 | return -EAGAIN; |
381 | } | 457 | } |
382 | 458 | ||
383 | /** | ||
384 | * usermodehelper_enable - allow new helpers to be started again | ||
385 | */ | ||
386 | void usermodehelper_enable(void) | ||
387 | { | ||
388 | down_write(&umhelper_sem); | ||
389 | usermodehelper_disabled = 0; | ||
390 | up_write(&umhelper_sem); | ||
391 | } | ||
392 | |||
393 | /** | ||
394 | * usermodehelper_is_disabled - check if new helpers are allowed to be started | ||
395 | */ | ||
396 | bool usermodehelper_is_disabled(void) | ||
397 | { | ||
398 | return usermodehelper_disabled; | ||
399 | } | ||
400 | EXPORT_SYMBOL_GPL(usermodehelper_is_disabled); | ||
401 | |||
402 | static void helper_lock(void) | 459 | static void helper_lock(void) |
403 | { | 460 | { |
404 | atomic_inc(&running_helpers); | 461 | atomic_inc(&running_helpers); |
diff --git a/kernel/padata.c b/kernel/padata.c index 6f10eb285ece..89fe3d1b9efb 100644 --- a/kernel/padata.c +++ b/kernel/padata.c | |||
@@ -1,6 +1,8 @@ | |||
1 | /* | 1 | /* |
2 | * padata.c - generic interface to process data streams in parallel | 2 | * padata.c - generic interface to process data streams in parallel |
3 | * | 3 | * |
4 | * See Documentation/padata.txt for an api documentation. | ||
5 | * | ||
4 | * Copyright (C) 2008, 2009 secunet Security Networks AG | 6 | * Copyright (C) 2008, 2009 secunet Security Networks AG |
5 | * Copyright (C) 2008, 2009 Steffen Klassert <steffen.klassert@secunet.com> | 7 | * Copyright (C) 2008, 2009 Steffen Klassert <steffen.klassert@secunet.com> |
6 | * | 8 | * |
@@ -354,13 +356,13 @@ static int padata_setup_cpumasks(struct parallel_data *pd, | |||
354 | if (!alloc_cpumask_var(&pd->cpumask.pcpu, GFP_KERNEL)) | 356 | if (!alloc_cpumask_var(&pd->cpumask.pcpu, GFP_KERNEL)) |
355 | return -ENOMEM; | 357 | return -ENOMEM; |
356 | 358 | ||
357 | cpumask_and(pd->cpumask.pcpu, pcpumask, cpu_active_mask); | 359 | cpumask_and(pd->cpumask.pcpu, pcpumask, cpu_online_mask); |
358 | if (!alloc_cpumask_var(&pd->cpumask.cbcpu, GFP_KERNEL)) { | 360 | if (!alloc_cpumask_var(&pd->cpumask.cbcpu, GFP_KERNEL)) { |
359 | free_cpumask_var(pd->cpumask.cbcpu); | 361 | free_cpumask_var(pd->cpumask.cbcpu); |
360 | return -ENOMEM; | 362 | return -ENOMEM; |
361 | } | 363 | } |
362 | 364 | ||
363 | cpumask_and(pd->cpumask.cbcpu, cbcpumask, cpu_active_mask); | 365 | cpumask_and(pd->cpumask.cbcpu, cbcpumask, cpu_online_mask); |
364 | return 0; | 366 | return 0; |
365 | } | 367 | } |
366 | 368 | ||
@@ -564,7 +566,7 @@ EXPORT_SYMBOL(padata_unregister_cpumask_notifier); | |||
564 | static bool padata_validate_cpumask(struct padata_instance *pinst, | 566 | static bool padata_validate_cpumask(struct padata_instance *pinst, |
565 | const struct cpumask *cpumask) | 567 | const struct cpumask *cpumask) |
566 | { | 568 | { |
567 | if (!cpumask_intersects(cpumask, cpu_active_mask)) { | 569 | if (!cpumask_intersects(cpumask, cpu_online_mask)) { |
568 | pinst->flags |= PADATA_INVALID; | 570 | pinst->flags |= PADATA_INVALID; |
569 | return false; | 571 | return false; |
570 | } | 572 | } |
@@ -678,7 +680,7 @@ static int __padata_add_cpu(struct padata_instance *pinst, int cpu) | |||
678 | { | 680 | { |
679 | struct parallel_data *pd; | 681 | struct parallel_data *pd; |
680 | 682 | ||
681 | if (cpumask_test_cpu(cpu, cpu_active_mask)) { | 683 | if (cpumask_test_cpu(cpu, cpu_online_mask)) { |
682 | pd = padata_alloc_pd(pinst, pinst->cpumask.pcpu, | 684 | pd = padata_alloc_pd(pinst, pinst->cpumask.pcpu, |
683 | pinst->cpumask.cbcpu); | 685 | pinst->cpumask.cbcpu); |
684 | if (!pd) | 686 | if (!pd) |
@@ -746,6 +748,9 @@ static int __padata_remove_cpu(struct padata_instance *pinst, int cpu) | |||
746 | return -ENOMEM; | 748 | return -ENOMEM; |
747 | 749 | ||
748 | padata_replace(pinst, pd); | 750 | padata_replace(pinst, pd); |
751 | |||
752 | cpumask_clear_cpu(cpu, pd->cpumask.cbcpu); | ||
753 | cpumask_clear_cpu(cpu, pd->cpumask.pcpu); | ||
749 | } | 754 | } |
750 | 755 | ||
751 | return 0; | 756 | return 0; |
diff --git a/kernel/power/hibernate.c b/kernel/power/hibernate.c index 0a186cfde788..e09dfbfeecee 100644 --- a/kernel/power/hibernate.c +++ b/kernel/power/hibernate.c | |||
@@ -16,7 +16,6 @@ | |||
16 | #include <linux/string.h> | 16 | #include <linux/string.h> |
17 | #include <linux/device.h> | 17 | #include <linux/device.h> |
18 | #include <linux/async.h> | 18 | #include <linux/async.h> |
19 | #include <linux/kmod.h> | ||
20 | #include <linux/delay.h> | 19 | #include <linux/delay.h> |
21 | #include <linux/fs.h> | 20 | #include <linux/fs.h> |
22 | #include <linux/mount.h> | 21 | #include <linux/mount.h> |
@@ -611,14 +610,10 @@ int hibernate(void) | |||
611 | if (error) | 610 | if (error) |
612 | goto Exit; | 611 | goto Exit; |
613 | 612 | ||
614 | error = usermodehelper_disable(); | ||
615 | if (error) | ||
616 | goto Exit; | ||
617 | |||
618 | /* Allocate memory management structures */ | 613 | /* Allocate memory management structures */ |
619 | error = create_basic_memory_bitmaps(); | 614 | error = create_basic_memory_bitmaps(); |
620 | if (error) | 615 | if (error) |
621 | goto Enable_umh; | 616 | goto Exit; |
622 | 617 | ||
623 | printk(KERN_INFO "PM: Syncing filesystems ... "); | 618 | printk(KERN_INFO "PM: Syncing filesystems ... "); |
624 | sys_sync(); | 619 | sys_sync(); |
@@ -661,8 +656,6 @@ int hibernate(void) | |||
661 | 656 | ||
662 | Free_bitmaps: | 657 | Free_bitmaps: |
663 | free_basic_memory_bitmaps(); | 658 | free_basic_memory_bitmaps(); |
664 | Enable_umh: | ||
665 | usermodehelper_enable(); | ||
666 | Exit: | 659 | Exit: |
667 | pm_notifier_call_chain(PM_POST_HIBERNATION); | 660 | pm_notifier_call_chain(PM_POST_HIBERNATION); |
668 | pm_restore_console(); | 661 | pm_restore_console(); |
@@ -777,15 +770,9 @@ static int software_resume(void) | |||
777 | if (error) | 770 | if (error) |
778 | goto close_finish; | 771 | goto close_finish; |
779 | 772 | ||
780 | error = usermodehelper_disable(); | ||
781 | if (error) | ||
782 | goto close_finish; | ||
783 | |||
784 | error = create_basic_memory_bitmaps(); | 773 | error = create_basic_memory_bitmaps(); |
785 | if (error) { | 774 | if (error) |
786 | usermodehelper_enable(); | ||
787 | goto close_finish; | 775 | goto close_finish; |
788 | } | ||
789 | 776 | ||
790 | pr_debug("PM: Preparing processes for restore.\n"); | 777 | pr_debug("PM: Preparing processes for restore.\n"); |
791 | error = freeze_processes(); | 778 | error = freeze_processes(); |
@@ -806,7 +793,6 @@ static int software_resume(void) | |||
806 | thaw_processes(); | 793 | thaw_processes(); |
807 | Done: | 794 | Done: |
808 | free_basic_memory_bitmaps(); | 795 | free_basic_memory_bitmaps(); |
809 | usermodehelper_enable(); | ||
810 | Finish: | 796 | Finish: |
811 | pm_notifier_call_chain(PM_POST_RESTORE); | 797 | pm_notifier_call_chain(PM_POST_RESTORE); |
812 | pm_restore_console(); | 798 | pm_restore_console(); |
diff --git a/kernel/power/process.c b/kernel/power/process.c index 0d2aeb226108..19db29f67558 100644 --- a/kernel/power/process.c +++ b/kernel/power/process.c | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <linux/freezer.h> | 16 | #include <linux/freezer.h> |
17 | #include <linux/delay.h> | 17 | #include <linux/delay.h> |
18 | #include <linux/workqueue.h> | 18 | #include <linux/workqueue.h> |
19 | #include <linux/kmod.h> | ||
19 | 20 | ||
20 | /* | 21 | /* |
21 | * Timeout for stopping processes | 22 | * Timeout for stopping processes |
@@ -122,6 +123,10 @@ int freeze_processes(void) | |||
122 | { | 123 | { |
123 | int error; | 124 | int error; |
124 | 125 | ||
126 | error = __usermodehelper_disable(UMH_FREEZING); | ||
127 | if (error) | ||
128 | return error; | ||
129 | |||
125 | if (!pm_freezing) | 130 | if (!pm_freezing) |
126 | atomic_inc(&system_freezing_cnt); | 131 | atomic_inc(&system_freezing_cnt); |
127 | 132 | ||
@@ -130,6 +135,7 @@ int freeze_processes(void) | |||
130 | error = try_to_freeze_tasks(true); | 135 | error = try_to_freeze_tasks(true); |
131 | if (!error) { | 136 | if (!error) { |
132 | printk("done."); | 137 | printk("done."); |
138 | __usermodehelper_set_disable_depth(UMH_DISABLED); | ||
133 | oom_killer_disable(); | 139 | oom_killer_disable(); |
134 | } | 140 | } |
135 | printk("\n"); | 141 | printk("\n"); |
@@ -187,6 +193,8 @@ void thaw_processes(void) | |||
187 | } while_each_thread(g, p); | 193 | } while_each_thread(g, p); |
188 | read_unlock(&tasklist_lock); | 194 | read_unlock(&tasklist_lock); |
189 | 195 | ||
196 | usermodehelper_enable(); | ||
197 | |||
190 | schedule(); | 198 | schedule(); |
191 | printk("done.\n"); | 199 | printk("done.\n"); |
192 | } | 200 | } |
diff --git a/kernel/power/qos.c b/kernel/power/qos.c index d6d6dbd1ecc0..6a031e684026 100644 --- a/kernel/power/qos.c +++ b/kernel/power/qos.c | |||
@@ -230,6 +230,21 @@ int pm_qos_request_active(struct pm_qos_request *req) | |||
230 | EXPORT_SYMBOL_GPL(pm_qos_request_active); | 230 | EXPORT_SYMBOL_GPL(pm_qos_request_active); |
231 | 231 | ||
232 | /** | 232 | /** |
233 | * pm_qos_work_fn - the timeout handler of pm_qos_update_request_timeout | ||
234 | * @work: work struct for the delayed work (timeout) | ||
235 | * | ||
236 | * This cancels the timeout request by falling back to the default at timeout. | ||
237 | */ | ||
238 | static void pm_qos_work_fn(struct work_struct *work) | ||
239 | { | ||
240 | struct pm_qos_request *req = container_of(to_delayed_work(work), | ||
241 | struct pm_qos_request, | ||
242 | work); | ||
243 | |||
244 | pm_qos_update_request(req, PM_QOS_DEFAULT_VALUE); | ||
245 | } | ||
246 | |||
247 | /** | ||
233 | * pm_qos_add_request - inserts new qos request into the list | 248 | * pm_qos_add_request - inserts new qos request into the list |
234 | * @req: pointer to a preallocated handle | 249 | * @req: pointer to a preallocated handle |
235 | * @pm_qos_class: identifies which list of qos request to use | 250 | * @pm_qos_class: identifies which list of qos request to use |
@@ -253,6 +268,7 @@ void pm_qos_add_request(struct pm_qos_request *req, | |||
253 | return; | 268 | return; |
254 | } | 269 | } |
255 | req->pm_qos_class = pm_qos_class; | 270 | req->pm_qos_class = pm_qos_class; |
271 | INIT_DELAYED_WORK(&req->work, pm_qos_work_fn); | ||
256 | pm_qos_update_target(pm_qos_array[pm_qos_class]->constraints, | 272 | pm_qos_update_target(pm_qos_array[pm_qos_class]->constraints, |
257 | &req->node, PM_QOS_ADD_REQ, value); | 273 | &req->node, PM_QOS_ADD_REQ, value); |
258 | } | 274 | } |
@@ -279,6 +295,9 @@ void pm_qos_update_request(struct pm_qos_request *req, | |||
279 | return; | 295 | return; |
280 | } | 296 | } |
281 | 297 | ||
298 | if (delayed_work_pending(&req->work)) | ||
299 | cancel_delayed_work_sync(&req->work); | ||
300 | |||
282 | if (new_value != req->node.prio) | 301 | if (new_value != req->node.prio) |
283 | pm_qos_update_target( | 302 | pm_qos_update_target( |
284 | pm_qos_array[req->pm_qos_class]->constraints, | 303 | pm_qos_array[req->pm_qos_class]->constraints, |
@@ -287,6 +306,34 @@ void pm_qos_update_request(struct pm_qos_request *req, | |||
287 | EXPORT_SYMBOL_GPL(pm_qos_update_request); | 306 | EXPORT_SYMBOL_GPL(pm_qos_update_request); |
288 | 307 | ||
289 | /** | 308 | /** |
309 | * pm_qos_update_request_timeout - modifies an existing qos request temporarily. | ||
310 | * @req : handle to list element holding a pm_qos request to use | ||
311 | * @new_value: defines the temporal qos request | ||
312 | * @timeout_us: the effective duration of this qos request in usecs. | ||
313 | * | ||
314 | * After timeout_us, this qos request is cancelled automatically. | ||
315 | */ | ||
316 | void pm_qos_update_request_timeout(struct pm_qos_request *req, s32 new_value, | ||
317 | unsigned long timeout_us) | ||
318 | { | ||
319 | if (!req) | ||
320 | return; | ||
321 | if (WARN(!pm_qos_request_active(req), | ||
322 | "%s called for unknown object.", __func__)) | ||
323 | return; | ||
324 | |||
325 | if (delayed_work_pending(&req->work)) | ||
326 | cancel_delayed_work_sync(&req->work); | ||
327 | |||
328 | if (new_value != req->node.prio) | ||
329 | pm_qos_update_target( | ||
330 | pm_qos_array[req->pm_qos_class]->constraints, | ||
331 | &req->node, PM_QOS_UPDATE_REQ, new_value); | ||
332 | |||
333 | schedule_delayed_work(&req->work, usecs_to_jiffies(timeout_us)); | ||
334 | } | ||
335 | |||
336 | /** | ||
290 | * pm_qos_remove_request - modifies an existing qos request | 337 | * pm_qos_remove_request - modifies an existing qos request |
291 | * @req: handle to request list element | 338 | * @req: handle to request list element |
292 | * | 339 | * |
@@ -305,6 +352,9 @@ void pm_qos_remove_request(struct pm_qos_request *req) | |||
305 | return; | 352 | return; |
306 | } | 353 | } |
307 | 354 | ||
355 | if (delayed_work_pending(&req->work)) | ||
356 | cancel_delayed_work_sync(&req->work); | ||
357 | |||
308 | pm_qos_update_target(pm_qos_array[req->pm_qos_class]->constraints, | 358 | pm_qos_update_target(pm_qos_array[req->pm_qos_class]->constraints, |
309 | &req->node, PM_QOS_REMOVE_REQ, | 359 | &req->node, PM_QOS_REMOVE_REQ, |
310 | PM_QOS_DEFAULT_VALUE); | 360 | PM_QOS_DEFAULT_VALUE); |
diff --git a/kernel/power/suspend.c b/kernel/power/suspend.c index 88e5c967370d..396d262b8fd0 100644 --- a/kernel/power/suspend.c +++ b/kernel/power/suspend.c | |||
@@ -12,7 +12,6 @@ | |||
12 | #include <linux/delay.h> | 12 | #include <linux/delay.h> |
13 | #include <linux/errno.h> | 13 | #include <linux/errno.h> |
14 | #include <linux/init.h> | 14 | #include <linux/init.h> |
15 | #include <linux/kmod.h> | ||
16 | #include <linux/console.h> | 15 | #include <linux/console.h> |
17 | #include <linux/cpu.h> | 16 | #include <linux/cpu.h> |
18 | #include <linux/syscalls.h> | 17 | #include <linux/syscalls.h> |
@@ -102,17 +101,12 @@ static int suspend_prepare(void) | |||
102 | if (error) | 101 | if (error) |
103 | goto Finish; | 102 | goto Finish; |
104 | 103 | ||
105 | error = usermodehelper_disable(); | ||
106 | if (error) | ||
107 | goto Finish; | ||
108 | |||
109 | error = suspend_freeze_processes(); | 104 | error = suspend_freeze_processes(); |
110 | if (!error) | 105 | if (!error) |
111 | return 0; | 106 | return 0; |
112 | 107 | ||
113 | suspend_stats.failed_freeze++; | 108 | suspend_stats.failed_freeze++; |
114 | dpm_save_failed_step(SUSPEND_FREEZE); | 109 | dpm_save_failed_step(SUSPEND_FREEZE); |
115 | usermodehelper_enable(); | ||
116 | Finish: | 110 | Finish: |
117 | pm_notifier_call_chain(PM_POST_SUSPEND); | 111 | pm_notifier_call_chain(PM_POST_SUSPEND); |
118 | pm_restore_console(); | 112 | pm_restore_console(); |
@@ -259,7 +253,6 @@ int suspend_devices_and_enter(suspend_state_t state) | |||
259 | static void suspend_finish(void) | 253 | static void suspend_finish(void) |
260 | { | 254 | { |
261 | suspend_thaw_processes(); | 255 | suspend_thaw_processes(); |
262 | usermodehelper_enable(); | ||
263 | pm_notifier_call_chain(PM_POST_SUSPEND); | 256 | pm_notifier_call_chain(PM_POST_SUSPEND); |
264 | pm_restore_console(); | 257 | pm_restore_console(); |
265 | } | 258 | } |
diff --git a/kernel/power/user.c b/kernel/power/user.c index 33c4329205af..91b0fd021a95 100644 --- a/kernel/power/user.c +++ b/kernel/power/user.c | |||
@@ -12,7 +12,6 @@ | |||
12 | #include <linux/suspend.h> | 12 | #include <linux/suspend.h> |
13 | #include <linux/syscalls.h> | 13 | #include <linux/syscalls.h> |
14 | #include <linux/reboot.h> | 14 | #include <linux/reboot.h> |
15 | #include <linux/kmod.h> | ||
16 | #include <linux/string.h> | 15 | #include <linux/string.h> |
17 | #include <linux/device.h> | 16 | #include <linux/device.h> |
18 | #include <linux/miscdevice.h> | 17 | #include <linux/miscdevice.h> |
@@ -222,14 +221,8 @@ static long snapshot_ioctl(struct file *filp, unsigned int cmd, | |||
222 | sys_sync(); | 221 | sys_sync(); |
223 | printk("done.\n"); | 222 | printk("done.\n"); |
224 | 223 | ||
225 | error = usermodehelper_disable(); | ||
226 | if (error) | ||
227 | break; | ||
228 | |||
229 | error = freeze_processes(); | 224 | error = freeze_processes(); |
230 | if (error) | 225 | if (!error) |
231 | usermodehelper_enable(); | ||
232 | else | ||
233 | data->frozen = 1; | 226 | data->frozen = 1; |
234 | break; | 227 | break; |
235 | 228 | ||
@@ -238,7 +231,6 @@ static long snapshot_ioctl(struct file *filp, unsigned int cmd, | |||
238 | break; | 231 | break; |
239 | pm_restore_gfp_mask(); | 232 | pm_restore_gfp_mask(); |
240 | thaw_processes(); | 233 | thaw_processes(); |
241 | usermodehelper_enable(); | ||
242 | data->frozen = 0; | 234 | data->frozen = 0; |
243 | break; | 235 | break; |
244 | 236 | ||
diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c index cdea7b56b0c9..c0bd0308741c 100644 --- a/kernel/trace/blktrace.c +++ b/kernel/trace/blktrace.c | |||
@@ -311,13 +311,6 @@ int blk_trace_remove(struct request_queue *q) | |||
311 | } | 311 | } |
312 | EXPORT_SYMBOL_GPL(blk_trace_remove); | 312 | EXPORT_SYMBOL_GPL(blk_trace_remove); |
313 | 313 | ||
314 | static int blk_dropped_open(struct inode *inode, struct file *filp) | ||
315 | { | ||
316 | filp->private_data = inode->i_private; | ||
317 | |||
318 | return 0; | ||
319 | } | ||
320 | |||
321 | static ssize_t blk_dropped_read(struct file *filp, char __user *buffer, | 314 | static ssize_t blk_dropped_read(struct file *filp, char __user *buffer, |
322 | size_t count, loff_t *ppos) | 315 | size_t count, loff_t *ppos) |
323 | { | 316 | { |
@@ -331,18 +324,11 @@ static ssize_t blk_dropped_read(struct file *filp, char __user *buffer, | |||
331 | 324 | ||
332 | static const struct file_operations blk_dropped_fops = { | 325 | static const struct file_operations blk_dropped_fops = { |
333 | .owner = THIS_MODULE, | 326 | .owner = THIS_MODULE, |
334 | .open = blk_dropped_open, | 327 | .open = simple_open, |
335 | .read = blk_dropped_read, | 328 | .read = blk_dropped_read, |
336 | .llseek = default_llseek, | 329 | .llseek = default_llseek, |
337 | }; | 330 | }; |
338 | 331 | ||
339 | static int blk_msg_open(struct inode *inode, struct file *filp) | ||
340 | { | ||
341 | filp->private_data = inode->i_private; | ||
342 | |||
343 | return 0; | ||
344 | } | ||
345 | |||
346 | static ssize_t blk_msg_write(struct file *filp, const char __user *buffer, | 332 | static ssize_t blk_msg_write(struct file *filp, const char __user *buffer, |
347 | size_t count, loff_t *ppos) | 333 | size_t count, loff_t *ppos) |
348 | { | 334 | { |
@@ -371,7 +357,7 @@ static ssize_t blk_msg_write(struct file *filp, const char __user *buffer, | |||
371 | 357 | ||
372 | static const struct file_operations blk_msg_fops = { | 358 | static const struct file_operations blk_msg_fops = { |
373 | .owner = THIS_MODULE, | 359 | .owner = THIS_MODULE, |
374 | .open = blk_msg_open, | 360 | .open = simple_open, |
375 | .write = blk_msg_write, | 361 | .write = blk_msg_write, |
376 | .llseek = noop_llseek, | 362 | .llseek = noop_llseek, |
377 | }; | 363 | }; |
diff --git a/net/802/garp.c b/net/802/garp.c index 8e21b6db3981..a5c224830439 100644 --- a/net/802/garp.c +++ b/net/802/garp.c | |||
@@ -167,7 +167,8 @@ static struct garp_attr *garp_attr_lookup(const struct garp_applicant *app, | |||
167 | return NULL; | 167 | return NULL; |
168 | } | 168 | } |
169 | 169 | ||
170 | static void garp_attr_insert(struct garp_applicant *app, struct garp_attr *new) | 170 | static struct garp_attr *garp_attr_create(struct garp_applicant *app, |
171 | const void *data, u8 len, u8 type) | ||
171 | { | 172 | { |
172 | struct rb_node *parent = NULL, **p = &app->gid.rb_node; | 173 | struct rb_node *parent = NULL, **p = &app->gid.rb_node; |
173 | struct garp_attr *attr; | 174 | struct garp_attr *attr; |
@@ -176,21 +177,16 @@ static void garp_attr_insert(struct garp_applicant *app, struct garp_attr *new) | |||
176 | while (*p) { | 177 | while (*p) { |
177 | parent = *p; | 178 | parent = *p; |
178 | attr = rb_entry(parent, struct garp_attr, node); | 179 | attr = rb_entry(parent, struct garp_attr, node); |
179 | d = garp_attr_cmp(attr, new->data, new->dlen, new->type); | 180 | d = garp_attr_cmp(attr, data, len, type); |
180 | if (d < 0) | 181 | if (d < 0) |
181 | p = &parent->rb_left; | 182 | p = &parent->rb_left; |
182 | else if (d > 0) | 183 | else if (d > 0) |
183 | p = &parent->rb_right; | 184 | p = &parent->rb_right; |
185 | else { | ||
186 | /* The attribute already exists; re-use it. */ | ||
187 | return attr; | ||
188 | } | ||
184 | } | 189 | } |
185 | rb_link_node(&new->node, parent, p); | ||
186 | rb_insert_color(&new->node, &app->gid); | ||
187 | } | ||
188 | |||
189 | static struct garp_attr *garp_attr_create(struct garp_applicant *app, | ||
190 | const void *data, u8 len, u8 type) | ||
191 | { | ||
192 | struct garp_attr *attr; | ||
193 | |||
194 | attr = kmalloc(sizeof(*attr) + len, GFP_ATOMIC); | 190 | attr = kmalloc(sizeof(*attr) + len, GFP_ATOMIC); |
195 | if (!attr) | 191 | if (!attr) |
196 | return attr; | 192 | return attr; |
@@ -198,7 +194,9 @@ static struct garp_attr *garp_attr_create(struct garp_applicant *app, | |||
198 | attr->type = type; | 194 | attr->type = type; |
199 | attr->dlen = len; | 195 | attr->dlen = len; |
200 | memcpy(attr->data, data, len); | 196 | memcpy(attr->data, data, len); |
201 | garp_attr_insert(app, attr); | 197 | |
198 | rb_link_node(&attr->node, parent, p); | ||
199 | rb_insert_color(&attr->node, &app->gid); | ||
202 | return attr; | 200 | return attr; |
203 | } | 201 | } |
204 | 202 | ||
diff --git a/net/core/dev.c b/net/core/dev.c index 5d59155adf2a..c25d453b2803 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -1596,6 +1596,7 @@ int dev_forward_skb(struct net_device *dev, struct sk_buff *skb) | |||
1596 | kfree_skb(skb); | 1596 | kfree_skb(skb); |
1597 | return NET_RX_DROP; | 1597 | return NET_RX_DROP; |
1598 | } | 1598 | } |
1599 | skb->skb_iif = 0; | ||
1599 | skb_set_dev(skb, dev); | 1600 | skb_set_dev(skb, dev); |
1600 | skb->tstamp.tv64 = 0; | 1601 | skb->tstamp.tv64 = 0; |
1601 | skb->pkt_type = PACKET_HOST; | 1602 | skb->pkt_type = PACKET_HOST; |
@@ -4027,54 +4028,41 @@ static int dev_ifconf(struct net *net, char __user *arg) | |||
4027 | 4028 | ||
4028 | #ifdef CONFIG_PROC_FS | 4029 | #ifdef CONFIG_PROC_FS |
4029 | 4030 | ||
4030 | #define BUCKET_SPACE (32 - NETDEV_HASHBITS) | 4031 | #define BUCKET_SPACE (32 - NETDEV_HASHBITS - 1) |
4031 | |||
4032 | struct dev_iter_state { | ||
4033 | struct seq_net_private p; | ||
4034 | unsigned int pos; /* bucket << BUCKET_SPACE + offset */ | ||
4035 | }; | ||
4036 | 4032 | ||
4037 | #define get_bucket(x) ((x) >> BUCKET_SPACE) | 4033 | #define get_bucket(x) ((x) >> BUCKET_SPACE) |
4038 | #define get_offset(x) ((x) & ((1 << BUCKET_SPACE) - 1)) | 4034 | #define get_offset(x) ((x) & ((1 << BUCKET_SPACE) - 1)) |
4039 | #define set_bucket_offset(b, o) ((b) << BUCKET_SPACE | (o)) | 4035 | #define set_bucket_offset(b, o) ((b) << BUCKET_SPACE | (o)) |
4040 | 4036 | ||
4041 | static inline struct net_device *dev_from_same_bucket(struct seq_file *seq) | 4037 | static inline struct net_device *dev_from_same_bucket(struct seq_file *seq, loff_t *pos) |
4042 | { | 4038 | { |
4043 | struct dev_iter_state *state = seq->private; | ||
4044 | struct net *net = seq_file_net(seq); | 4039 | struct net *net = seq_file_net(seq); |
4045 | struct net_device *dev; | 4040 | struct net_device *dev; |
4046 | struct hlist_node *p; | 4041 | struct hlist_node *p; |
4047 | struct hlist_head *h; | 4042 | struct hlist_head *h; |
4048 | unsigned int count, bucket, offset; | 4043 | unsigned int count = 0, offset = get_offset(*pos); |
4049 | 4044 | ||
4050 | bucket = get_bucket(state->pos); | 4045 | h = &net->dev_name_head[get_bucket(*pos)]; |
4051 | offset = get_offset(state->pos); | ||
4052 | h = &net->dev_name_head[bucket]; | ||
4053 | count = 0; | ||
4054 | hlist_for_each_entry_rcu(dev, p, h, name_hlist) { | 4046 | hlist_for_each_entry_rcu(dev, p, h, name_hlist) { |
4055 | if (count++ == offset) { | 4047 | if (++count == offset) |
4056 | state->pos = set_bucket_offset(bucket, count); | ||
4057 | return dev; | 4048 | return dev; |
4058 | } | ||
4059 | } | 4049 | } |
4060 | 4050 | ||
4061 | return NULL; | 4051 | return NULL; |
4062 | } | 4052 | } |
4063 | 4053 | ||
4064 | static inline struct net_device *dev_from_new_bucket(struct seq_file *seq) | 4054 | static inline struct net_device *dev_from_bucket(struct seq_file *seq, loff_t *pos) |
4065 | { | 4055 | { |
4066 | struct dev_iter_state *state = seq->private; | ||
4067 | struct net_device *dev; | 4056 | struct net_device *dev; |
4068 | unsigned int bucket; | 4057 | unsigned int bucket; |
4069 | 4058 | ||
4070 | bucket = get_bucket(state->pos); | ||
4071 | do { | 4059 | do { |
4072 | dev = dev_from_same_bucket(seq); | 4060 | dev = dev_from_same_bucket(seq, pos); |
4073 | if (dev) | 4061 | if (dev) |
4074 | return dev; | 4062 | return dev; |
4075 | 4063 | ||
4076 | bucket++; | 4064 | bucket = get_bucket(*pos) + 1; |
4077 | state->pos = set_bucket_offset(bucket, 0); | 4065 | *pos = set_bucket_offset(bucket, 1); |
4078 | } while (bucket < NETDEV_HASHENTRIES); | 4066 | } while (bucket < NETDEV_HASHENTRIES); |
4079 | 4067 | ||
4080 | return NULL; | 4068 | return NULL; |
@@ -4087,33 +4075,20 @@ static inline struct net_device *dev_from_new_bucket(struct seq_file *seq) | |||
4087 | void *dev_seq_start(struct seq_file *seq, loff_t *pos) | 4075 | void *dev_seq_start(struct seq_file *seq, loff_t *pos) |
4088 | __acquires(RCU) | 4076 | __acquires(RCU) |
4089 | { | 4077 | { |
4090 | struct dev_iter_state *state = seq->private; | ||
4091 | |||
4092 | rcu_read_lock(); | 4078 | rcu_read_lock(); |
4093 | if (!*pos) | 4079 | if (!*pos) |
4094 | return SEQ_START_TOKEN; | 4080 | return SEQ_START_TOKEN; |
4095 | 4081 | ||
4096 | /* check for end of the hash */ | 4082 | if (get_bucket(*pos) >= NETDEV_HASHENTRIES) |
4097 | if (state->pos == 0 && *pos > 1) | ||
4098 | return NULL; | 4083 | return NULL; |
4099 | 4084 | ||
4100 | return dev_from_new_bucket(seq); | 4085 | return dev_from_bucket(seq, pos); |
4101 | } | 4086 | } |
4102 | 4087 | ||
4103 | void *dev_seq_next(struct seq_file *seq, void *v, loff_t *pos) | 4088 | void *dev_seq_next(struct seq_file *seq, void *v, loff_t *pos) |
4104 | { | 4089 | { |
4105 | struct net_device *dev; | ||
4106 | |||
4107 | ++*pos; | 4090 | ++*pos; |
4108 | 4091 | return dev_from_bucket(seq, pos); | |
4109 | if (v == SEQ_START_TOKEN) | ||
4110 | return dev_from_new_bucket(seq); | ||
4111 | |||
4112 | dev = dev_from_same_bucket(seq); | ||
4113 | if (dev) | ||
4114 | return dev; | ||
4115 | |||
4116 | return dev_from_new_bucket(seq); | ||
4117 | } | 4092 | } |
4118 | 4093 | ||
4119 | void dev_seq_stop(struct seq_file *seq, void *v) | 4094 | void dev_seq_stop(struct seq_file *seq, void *v) |
@@ -4212,13 +4187,7 @@ static const struct seq_operations dev_seq_ops = { | |||
4212 | static int dev_seq_open(struct inode *inode, struct file *file) | 4187 | static int dev_seq_open(struct inode *inode, struct file *file) |
4213 | { | 4188 | { |
4214 | return seq_open_net(inode, file, &dev_seq_ops, | 4189 | return seq_open_net(inode, file, &dev_seq_ops, |
4215 | sizeof(struct dev_iter_state)); | 4190 | sizeof(struct seq_net_private)); |
4216 | } | ||
4217 | |||
4218 | int dev_seq_open_ops(struct inode *inode, struct file *file, | ||
4219 | const struct seq_operations *ops) | ||
4220 | { | ||
4221 | return seq_open_net(inode, file, ops, sizeof(struct dev_iter_state)); | ||
4222 | } | 4191 | } |
4223 | 4192 | ||
4224 | static const struct file_operations dev_seq_fops = { | 4193 | static const struct file_operations dev_seq_fops = { |
diff --git a/net/core/dev_addr_lists.c b/net/core/dev_addr_lists.c index 29c07fef9228..626698f0db8b 100644 --- a/net/core/dev_addr_lists.c +++ b/net/core/dev_addr_lists.c | |||
@@ -696,7 +696,8 @@ static const struct seq_operations dev_mc_seq_ops = { | |||
696 | 696 | ||
697 | static int dev_mc_seq_open(struct inode *inode, struct file *file) | 697 | static int dev_mc_seq_open(struct inode *inode, struct file *file) |
698 | { | 698 | { |
699 | return dev_seq_open_ops(inode, file, &dev_mc_seq_ops); | 699 | return seq_open_net(inode, file, &dev_mc_seq_ops, |
700 | sizeof(struct seq_net_private)); | ||
700 | } | 701 | } |
701 | 702 | ||
702 | static const struct file_operations dev_mc_seq_fops = { | 703 | static const struct file_operations dev_mc_seq_fops = { |
diff --git a/net/core/filter.c b/net/core/filter.c index cf4989ac503b..6f755cca4520 100644 --- a/net/core/filter.c +++ b/net/core/filter.c | |||
@@ -39,8 +39,11 @@ | |||
39 | #include <linux/reciprocal_div.h> | 39 | #include <linux/reciprocal_div.h> |
40 | #include <linux/ratelimit.h> | 40 | #include <linux/ratelimit.h> |
41 | 41 | ||
42 | /* No hurry in this branch */ | 42 | /* No hurry in this branch |
43 | static void *__load_pointer(const struct sk_buff *skb, int k, unsigned int size) | 43 | * |
44 | * Exported for the bpf jit load helper. | ||
45 | */ | ||
46 | void *bpf_internal_load_pointer_neg_helper(const struct sk_buff *skb, int k, unsigned int size) | ||
44 | { | 47 | { |
45 | u8 *ptr = NULL; | 48 | u8 *ptr = NULL; |
46 | 49 | ||
@@ -59,7 +62,7 @@ static inline void *load_pointer(const struct sk_buff *skb, int k, | |||
59 | { | 62 | { |
60 | if (k >= 0) | 63 | if (k >= 0) |
61 | return skb_header_pointer(skb, k, size, buffer); | 64 | return skb_header_pointer(skb, k, size, buffer); |
62 | return __load_pointer(skb, k, size); | 65 | return bpf_internal_load_pointer_neg_helper(skb, k, size); |
63 | } | 66 | } |
64 | 67 | ||
65 | /** | 68 | /** |
diff --git a/net/core/skbuff.c b/net/core/skbuff.c index f223cdc75da6..baf8d281152c 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c | |||
@@ -3161,6 +3161,8 @@ static void sock_rmem_free(struct sk_buff *skb) | |||
3161 | */ | 3161 | */ |
3162 | int sock_queue_err_skb(struct sock *sk, struct sk_buff *skb) | 3162 | int sock_queue_err_skb(struct sock *sk, struct sk_buff *skb) |
3163 | { | 3163 | { |
3164 | int len = skb->len; | ||
3165 | |||
3164 | if (atomic_read(&sk->sk_rmem_alloc) + skb->truesize >= | 3166 | if (atomic_read(&sk->sk_rmem_alloc) + skb->truesize >= |
3165 | (unsigned)sk->sk_rcvbuf) | 3167 | (unsigned)sk->sk_rcvbuf) |
3166 | return -ENOMEM; | 3168 | return -ENOMEM; |
@@ -3175,7 +3177,7 @@ int sock_queue_err_skb(struct sock *sk, struct sk_buff *skb) | |||
3175 | 3177 | ||
3176 | skb_queue_tail(&sk->sk_error_queue, skb); | 3178 | skb_queue_tail(&sk->sk_error_queue, skb); |
3177 | if (!sock_flag(sk, SOCK_DEAD)) | 3179 | if (!sock_flag(sk, SOCK_DEAD)) |
3178 | sk->sk_data_ready(sk, skb->len); | 3180 | sk->sk_data_ready(sk, len); |
3179 | return 0; | 3181 | return 0; |
3180 | } | 3182 | } |
3181 | EXPORT_SYMBOL(sock_queue_err_skb); | 3183 | EXPORT_SYMBOL(sock_queue_err_skb); |
diff --git a/net/ipv4/route.c b/net/ipv4/route.c index 4dc1c104c942..167ea10b521a 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c | |||
@@ -2041,7 +2041,7 @@ static int ip_route_input_mc(struct sk_buff *skb, __be32 daddr, __be32 saddr, | |||
2041 | if (err < 0) | 2041 | if (err < 0) |
2042 | goto e_err; | 2042 | goto e_err; |
2043 | } | 2043 | } |
2044 | rth = rt_dst_alloc(init_net.loopback_dev, | 2044 | rth = rt_dst_alloc(dev_net(dev)->loopback_dev, |
2045 | IN_DEV_CONF_GET(in_dev, NOPOLICY), false); | 2045 | IN_DEV_CONF_GET(in_dev, NOPOLICY), false); |
2046 | if (!rth) | 2046 | if (!rth) |
2047 | goto e_nobufs; | 2047 | goto e_nobufs; |
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index cfd7edda0a8e..5d54ed30e821 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c | |||
@@ -860,7 +860,7 @@ wait_for_memory: | |||
860 | } | 860 | } |
861 | 861 | ||
862 | out: | 862 | out: |
863 | if (copied) | 863 | if (copied && !(flags & MSG_SENDPAGE_NOTLAST)) |
864 | tcp_push(sk, flags, mss_now, tp->nonagle); | 864 | tcp_push(sk, flags, mss_now, tp->nonagle); |
865 | return copied; | 865 | return copied; |
866 | 866 | ||
diff --git a/net/ipv6/mcast.c b/net/ipv6/mcast.c index 16c33e308121..b2869cab2092 100644 --- a/net/ipv6/mcast.c +++ b/net/ipv6/mcast.c | |||
@@ -2044,7 +2044,7 @@ static int ip6_mc_add_src(struct inet6_dev *idev, const struct in6_addr *pmca, | |||
2044 | if (!delta) | 2044 | if (!delta) |
2045 | pmc->mca_sfcount[sfmode]--; | 2045 | pmc->mca_sfcount[sfmode]--; |
2046 | for (j=0; j<i; j++) | 2046 | for (j=0; j<i; j++) |
2047 | (void) ip6_mc_del1_src(pmc, sfmode, &psfsrc[i]); | 2047 | ip6_mc_del1_src(pmc, sfmode, &psfsrc[j]); |
2048 | } else if (isexclude != (pmc->mca_sfcount[MCAST_EXCLUDE] != 0)) { | 2048 | } else if (isexclude != (pmc->mca_sfcount[MCAST_EXCLUDE] != 0)) { |
2049 | struct ip6_sf_list *psf; | 2049 | struct ip6_sf_list *psf; |
2050 | 2050 | ||
diff --git a/net/ipv6/route.c b/net/ipv6/route.c index 496b62712fe8..3992e26a6039 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c | |||
@@ -881,6 +881,16 @@ static struct rt6_info *ip6_pol_route_input(struct net *net, struct fib6_table * | |||
881 | return ip6_pol_route(net, table, fl6->flowi6_iif, fl6, flags); | 881 | return ip6_pol_route(net, table, fl6->flowi6_iif, fl6, flags); |
882 | } | 882 | } |
883 | 883 | ||
884 | static struct dst_entry *ip6_route_input_lookup(struct net *net, | ||
885 | struct net_device *dev, | ||
886 | struct flowi6 *fl6, int flags) | ||
887 | { | ||
888 | if (rt6_need_strict(&fl6->daddr) && dev->type != ARPHRD_PIMREG) | ||
889 | flags |= RT6_LOOKUP_F_IFACE; | ||
890 | |||
891 | return fib6_rule_lookup(net, fl6, flags, ip6_pol_route_input); | ||
892 | } | ||
893 | |||
884 | void ip6_route_input(struct sk_buff *skb) | 894 | void ip6_route_input(struct sk_buff *skb) |
885 | { | 895 | { |
886 | const struct ipv6hdr *iph = ipv6_hdr(skb); | 896 | const struct ipv6hdr *iph = ipv6_hdr(skb); |
@@ -895,10 +905,7 @@ void ip6_route_input(struct sk_buff *skb) | |||
895 | .flowi6_proto = iph->nexthdr, | 905 | .flowi6_proto = iph->nexthdr, |
896 | }; | 906 | }; |
897 | 907 | ||
898 | if (rt6_need_strict(&iph->daddr) && skb->dev->type != ARPHRD_PIMREG) | 908 | skb_dst_set(skb, ip6_route_input_lookup(net, skb->dev, &fl6, flags)); |
899 | flags |= RT6_LOOKUP_F_IFACE; | ||
900 | |||
901 | skb_dst_set(skb, fib6_rule_lookup(net, &fl6, flags, ip6_pol_route_input)); | ||
902 | } | 909 | } |
903 | 910 | ||
904 | static struct rt6_info *ip6_pol_route_output(struct net *net, struct fib6_table *table, | 911 | static struct rt6_info *ip6_pol_route_output(struct net *net, struct fib6_table *table, |
@@ -2537,7 +2544,7 @@ static int inet6_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr* nlh, void | |||
2537 | struct sk_buff *skb; | 2544 | struct sk_buff *skb; |
2538 | struct rtmsg *rtm; | 2545 | struct rtmsg *rtm; |
2539 | struct flowi6 fl6; | 2546 | struct flowi6 fl6; |
2540 | int err, iif = 0; | 2547 | int err, iif = 0, oif = 0; |
2541 | 2548 | ||
2542 | err = nlmsg_parse(nlh, sizeof(*rtm), tb, RTA_MAX, rtm_ipv6_policy); | 2549 | err = nlmsg_parse(nlh, sizeof(*rtm), tb, RTA_MAX, rtm_ipv6_policy); |
2543 | if (err < 0) | 2550 | if (err < 0) |
@@ -2564,15 +2571,29 @@ static int inet6_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr* nlh, void | |||
2564 | iif = nla_get_u32(tb[RTA_IIF]); | 2571 | iif = nla_get_u32(tb[RTA_IIF]); |
2565 | 2572 | ||
2566 | if (tb[RTA_OIF]) | 2573 | if (tb[RTA_OIF]) |
2567 | fl6.flowi6_oif = nla_get_u32(tb[RTA_OIF]); | 2574 | oif = nla_get_u32(tb[RTA_OIF]); |
2568 | 2575 | ||
2569 | if (iif) { | 2576 | if (iif) { |
2570 | struct net_device *dev; | 2577 | struct net_device *dev; |
2578 | int flags = 0; | ||
2579 | |||
2571 | dev = __dev_get_by_index(net, iif); | 2580 | dev = __dev_get_by_index(net, iif); |
2572 | if (!dev) { | 2581 | if (!dev) { |
2573 | err = -ENODEV; | 2582 | err = -ENODEV; |
2574 | goto errout; | 2583 | goto errout; |
2575 | } | 2584 | } |
2585 | |||
2586 | fl6.flowi6_iif = iif; | ||
2587 | |||
2588 | if (!ipv6_addr_any(&fl6.saddr)) | ||
2589 | flags |= RT6_LOOKUP_F_HAS_SADDR; | ||
2590 | |||
2591 | rt = (struct rt6_info *)ip6_route_input_lookup(net, dev, &fl6, | ||
2592 | flags); | ||
2593 | } else { | ||
2594 | fl6.flowi6_oif = oif; | ||
2595 | |||
2596 | rt = (struct rt6_info *)ip6_route_output(net, NULL, &fl6); | ||
2576 | } | 2597 | } |
2577 | 2598 | ||
2578 | skb = alloc_skb(NLMSG_GOODSIZE, GFP_KERNEL); | 2599 | skb = alloc_skb(NLMSG_GOODSIZE, GFP_KERNEL); |
@@ -2587,7 +2608,6 @@ static int inet6_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr* nlh, void | |||
2587 | skb_reset_mac_header(skb); | 2608 | skb_reset_mac_header(skb); |
2588 | skb_reserve(skb, MAX_HEADER + sizeof(struct ipv6hdr)); | 2609 | skb_reserve(skb, MAX_HEADER + sizeof(struct ipv6hdr)); |
2589 | 2610 | ||
2590 | rt = (struct rt6_info*) ip6_route_output(net, NULL, &fl6); | ||
2591 | skb_dst_set(skb, &rt->dst); | 2611 | skb_dst_set(skb, &rt->dst); |
2592 | 2612 | ||
2593 | err = rt6_fill_node(net, skb, rt, &fl6.daddr, &fl6.saddr, iif, | 2613 | err = rt6_fill_node(net, skb, rt, &fl6.daddr, &fl6.saddr, iif, |
diff --git a/net/mac80211/agg-rx.c b/net/mac80211/agg-rx.c index 1068f668ac4e..64d3ce5ea1a0 100644 --- a/net/mac80211/agg-rx.c +++ b/net/mac80211/agg-rx.c | |||
@@ -49,6 +49,8 @@ static void ieee80211_free_tid_rx(struct rcu_head *h) | |||
49 | container_of(h, struct tid_ampdu_rx, rcu_head); | 49 | container_of(h, struct tid_ampdu_rx, rcu_head); |
50 | int i; | 50 | int i; |
51 | 51 | ||
52 | del_timer_sync(&tid_rx->reorder_timer); | ||
53 | |||
52 | for (i = 0; i < tid_rx->buf_size; i++) | 54 | for (i = 0; i < tid_rx->buf_size; i++) |
53 | dev_kfree_skb(tid_rx->reorder_buf[i]); | 55 | dev_kfree_skb(tid_rx->reorder_buf[i]); |
54 | kfree(tid_rx->reorder_buf); | 56 | kfree(tid_rx->reorder_buf); |
@@ -91,7 +93,6 @@ void ___ieee80211_stop_rx_ba_session(struct sta_info *sta, u16 tid, | |||
91 | tid, WLAN_BACK_RECIPIENT, reason); | 93 | tid, WLAN_BACK_RECIPIENT, reason); |
92 | 94 | ||
93 | del_timer_sync(&tid_rx->session_timer); | 95 | del_timer_sync(&tid_rx->session_timer); |
94 | del_timer_sync(&tid_rx->reorder_timer); | ||
95 | 96 | ||
96 | call_rcu(&tid_rx->rcu_head, ieee80211_free_tid_rx); | 97 | call_rcu(&tid_rx->rcu_head, ieee80211_free_tid_rx); |
97 | } | 98 | } |
diff --git a/net/mac80211/debugfs.c b/net/mac80211/debugfs.c index cc5b7a6e7e0b..778e5916d7c3 100644 --- a/net/mac80211/debugfs.c +++ b/net/mac80211/debugfs.c | |||
@@ -15,12 +15,6 @@ | |||
15 | #include "rate.h" | 15 | #include "rate.h" |
16 | #include "debugfs.h" | 16 | #include "debugfs.h" |
17 | 17 | ||
18 | int mac80211_open_file_generic(struct inode *inode, struct file *file) | ||
19 | { | ||
20 | file->private_data = inode->i_private; | ||
21 | return 0; | ||
22 | } | ||
23 | |||
24 | #define DEBUGFS_FORMAT_BUFFER_SIZE 100 | 18 | #define DEBUGFS_FORMAT_BUFFER_SIZE 100 |
25 | 19 | ||
26 | int mac80211_format_buffer(char __user *userbuf, size_t count, | 20 | int mac80211_format_buffer(char __user *userbuf, size_t count, |
@@ -50,7 +44,7 @@ static ssize_t name## _read(struct file *file, char __user *userbuf, \ | |||
50 | #define DEBUGFS_READONLY_FILE_OPS(name) \ | 44 | #define DEBUGFS_READONLY_FILE_OPS(name) \ |
51 | static const struct file_operations name## _ops = { \ | 45 | static const struct file_operations name## _ops = { \ |
52 | .read = name## _read, \ | 46 | .read = name## _read, \ |
53 | .open = mac80211_open_file_generic, \ | 47 | .open = simple_open, \ |
54 | .llseek = generic_file_llseek, \ | 48 | .llseek = generic_file_llseek, \ |
55 | }; | 49 | }; |
56 | 50 | ||
@@ -93,7 +87,7 @@ static ssize_t reset_write(struct file *file, const char __user *user_buf, | |||
93 | 87 | ||
94 | static const struct file_operations reset_ops = { | 88 | static const struct file_operations reset_ops = { |
95 | .write = reset_write, | 89 | .write = reset_write, |
96 | .open = mac80211_open_file_generic, | 90 | .open = simple_open, |
97 | .llseek = noop_llseek, | 91 | .llseek = noop_llseek, |
98 | }; | 92 | }; |
99 | 93 | ||
@@ -254,7 +248,7 @@ static ssize_t stats_ ##name## _read(struct file *file, \ | |||
254 | \ | 248 | \ |
255 | static const struct file_operations stats_ ##name## _ops = { \ | 249 | static const struct file_operations stats_ ##name## _ops = { \ |
256 | .read = stats_ ##name## _read, \ | 250 | .read = stats_ ##name## _read, \ |
257 | .open = mac80211_open_file_generic, \ | 251 | .open = simple_open, \ |
258 | .llseek = generic_file_llseek, \ | 252 | .llseek = generic_file_llseek, \ |
259 | }; | 253 | }; |
260 | 254 | ||
diff --git a/net/mac80211/debugfs.h b/net/mac80211/debugfs.h index 7c87529630f5..9be4e6d71d00 100644 --- a/net/mac80211/debugfs.h +++ b/net/mac80211/debugfs.h | |||
@@ -3,7 +3,6 @@ | |||
3 | 3 | ||
4 | #ifdef CONFIG_MAC80211_DEBUGFS | 4 | #ifdef CONFIG_MAC80211_DEBUGFS |
5 | extern void debugfs_hw_add(struct ieee80211_local *local); | 5 | extern void debugfs_hw_add(struct ieee80211_local *local); |
6 | extern int mac80211_open_file_generic(struct inode *inode, struct file *file); | ||
7 | extern int mac80211_format_buffer(char __user *userbuf, size_t count, | 6 | extern int mac80211_format_buffer(char __user *userbuf, size_t count, |
8 | loff_t *ppos, char *fmt, ...); | 7 | loff_t *ppos, char *fmt, ...); |
9 | #else | 8 | #else |
diff --git a/net/mac80211/debugfs_key.c b/net/mac80211/debugfs_key.c index 59edcd95a58d..7932767bb482 100644 --- a/net/mac80211/debugfs_key.c +++ b/net/mac80211/debugfs_key.c | |||
@@ -30,7 +30,7 @@ static ssize_t key_##name##_read(struct file *file, \ | |||
30 | #define KEY_OPS(name) \ | 30 | #define KEY_OPS(name) \ |
31 | static const struct file_operations key_ ##name## _ops = { \ | 31 | static const struct file_operations key_ ##name## _ops = { \ |
32 | .read = key_##name##_read, \ | 32 | .read = key_##name##_read, \ |
33 | .open = mac80211_open_file_generic, \ | 33 | .open = simple_open, \ |
34 | .llseek = generic_file_llseek, \ | 34 | .llseek = generic_file_llseek, \ |
35 | } | 35 | } |
36 | 36 | ||
@@ -45,7 +45,7 @@ static const struct file_operations key_ ##name## _ops = { \ | |||
45 | #define KEY_CONF_OPS(name) \ | 45 | #define KEY_CONF_OPS(name) \ |
46 | static const struct file_operations key_ ##name## _ops = { \ | 46 | static const struct file_operations key_ ##name## _ops = { \ |
47 | .read = key_conf_##name##_read, \ | 47 | .read = key_conf_##name##_read, \ |
48 | .open = mac80211_open_file_generic, \ | 48 | .open = simple_open, \ |
49 | .llseek = generic_file_llseek, \ | 49 | .llseek = generic_file_llseek, \ |
50 | } | 50 | } |
51 | 51 | ||
diff --git a/net/mac80211/debugfs_netdev.c b/net/mac80211/debugfs_netdev.c index a32eeda04aa3..30f99c344847 100644 --- a/net/mac80211/debugfs_netdev.c +++ b/net/mac80211/debugfs_netdev.c | |||
@@ -135,7 +135,7 @@ static ssize_t ieee80211_if_read_##name(struct file *file, \ | |||
135 | static const struct file_operations name##_ops = { \ | 135 | static const struct file_operations name##_ops = { \ |
136 | .read = ieee80211_if_read_##name, \ | 136 | .read = ieee80211_if_read_##name, \ |
137 | .write = (_write), \ | 137 | .write = (_write), \ |
138 | .open = mac80211_open_file_generic, \ | 138 | .open = simple_open, \ |
139 | .llseek = generic_file_llseek, \ | 139 | .llseek = generic_file_llseek, \ |
140 | } | 140 | } |
141 | 141 | ||
diff --git a/net/mac80211/debugfs_sta.c b/net/mac80211/debugfs_sta.c index 6d45804d09bc..832b2da5e4cd 100644 --- a/net/mac80211/debugfs_sta.c +++ b/net/mac80211/debugfs_sta.c | |||
@@ -33,7 +33,7 @@ static ssize_t sta_ ##name## _read(struct file *file, \ | |||
33 | #define STA_OPS(name) \ | 33 | #define STA_OPS(name) \ |
34 | static const struct file_operations sta_ ##name## _ops = { \ | 34 | static const struct file_operations sta_ ##name## _ops = { \ |
35 | .read = sta_##name##_read, \ | 35 | .read = sta_##name##_read, \ |
36 | .open = mac80211_open_file_generic, \ | 36 | .open = simple_open, \ |
37 | .llseek = generic_file_llseek, \ | 37 | .llseek = generic_file_llseek, \ |
38 | } | 38 | } |
39 | 39 | ||
@@ -41,7 +41,7 @@ static const struct file_operations sta_ ##name## _ops = { \ | |||
41 | static const struct file_operations sta_ ##name## _ops = { \ | 41 | static const struct file_operations sta_ ##name## _ops = { \ |
42 | .read = sta_##name##_read, \ | 42 | .read = sta_##name##_read, \ |
43 | .write = sta_##name##_write, \ | 43 | .write = sta_##name##_write, \ |
44 | .open = mac80211_open_file_generic, \ | 44 | .open = simple_open, \ |
45 | .llseek = generic_file_llseek, \ | 45 | .llseek = generic_file_llseek, \ |
46 | } | 46 | } |
47 | 47 | ||
diff --git a/net/mac80211/main.c b/net/mac80211/main.c index b581a24fa15c..16336480c631 100644 --- a/net/mac80211/main.c +++ b/net/mac80211/main.c | |||
@@ -102,9 +102,6 @@ int ieee80211_hw_config(struct ieee80211_local *local, u32 changed) | |||
102 | 102 | ||
103 | might_sleep(); | 103 | might_sleep(); |
104 | 104 | ||
105 | /* If this off-channel logic ever changes, ieee80211_on_oper_channel | ||
106 | * may need to change as well. | ||
107 | */ | ||
108 | offchannel_flag = local->hw.conf.flags & IEEE80211_CONF_OFFCHANNEL; | 105 | offchannel_flag = local->hw.conf.flags & IEEE80211_CONF_OFFCHANNEL; |
109 | if (local->scan_channel) { | 106 | if (local->scan_channel) { |
110 | chan = local->scan_channel; | 107 | chan = local->scan_channel; |
diff --git a/net/mac80211/rate.c b/net/mac80211/rate.c index b4f7600a3e36..3313c117b322 100644 --- a/net/mac80211/rate.c +++ b/net/mac80211/rate.c | |||
@@ -145,7 +145,7 @@ static ssize_t rcname_read(struct file *file, char __user *userbuf, | |||
145 | 145 | ||
146 | static const struct file_operations rcname_ops = { | 146 | static const struct file_operations rcname_ops = { |
147 | .read = rcname_read, | 147 | .read = rcname_read, |
148 | .open = mac80211_open_file_generic, | 148 | .open = simple_open, |
149 | .llseek = default_llseek, | 149 | .llseek = default_llseek, |
150 | }; | 150 | }; |
151 | #endif | 151 | #endif |
diff --git a/net/mac80211/scan.c b/net/mac80211/scan.c index 33cd16901378..c70e17677135 100644 --- a/net/mac80211/scan.c +++ b/net/mac80211/scan.c | |||
@@ -370,7 +370,7 @@ static int ieee80211_start_sw_scan(struct ieee80211_local *local) | |||
370 | */ | 370 | */ |
371 | drv_sw_scan_start(local); | 371 | drv_sw_scan_start(local); |
372 | 372 | ||
373 | local->leave_oper_channel_time = 0; | 373 | local->leave_oper_channel_time = jiffies; |
374 | local->next_scan_state = SCAN_DECISION; | 374 | local->next_scan_state = SCAN_DECISION; |
375 | local->scan_channel_idx = 0; | 375 | local->scan_channel_idx = 0; |
376 | 376 | ||
diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c index cbdb754dbb10..3cc4487ac349 100644 --- a/net/netfilter/nf_conntrack_core.c +++ b/net/netfilter/nf_conntrack_core.c | |||
@@ -735,6 +735,7 @@ __nf_conntrack_alloc(struct net *net, u16 zone, | |||
735 | 735 | ||
736 | #ifdef CONFIG_NF_CONNTRACK_ZONES | 736 | #ifdef CONFIG_NF_CONNTRACK_ZONES |
737 | out_free: | 737 | out_free: |
738 | atomic_dec(&net->ct.count); | ||
738 | kmem_cache_free(net->ct.nf_conntrack_cachep, ct); | 739 | kmem_cache_free(net->ct.nf_conntrack_cachep, ct); |
739 | return ERR_PTR(-ENOMEM); | 740 | return ERR_PTR(-ENOMEM); |
740 | #endif | 741 | #endif |
diff --git a/net/netfilter/nfnetlink_acct.c b/net/netfilter/nfnetlink_acct.c index 3eb348bfc4fb..d98c868c148b 100644 --- a/net/netfilter/nfnetlink_acct.c +++ b/net/netfilter/nfnetlink_acct.c | |||
@@ -10,6 +10,7 @@ | |||
10 | #include <linux/module.h> | 10 | #include <linux/module.h> |
11 | #include <linux/kernel.h> | 11 | #include <linux/kernel.h> |
12 | #include <linux/skbuff.h> | 12 | #include <linux/skbuff.h> |
13 | #include <linux/atomic.h> | ||
13 | #include <linux/netlink.h> | 14 | #include <linux/netlink.h> |
14 | #include <linux/rculist.h> | 15 | #include <linux/rculist.h> |
15 | #include <linux/slab.h> | 16 | #include <linux/slab.h> |
@@ -17,7 +18,6 @@ | |||
17 | #include <linux/errno.h> | 18 | #include <linux/errno.h> |
18 | #include <net/netlink.h> | 19 | #include <net/netlink.h> |
19 | #include <net/sock.h> | 20 | #include <net/sock.h> |
20 | #include <asm/atomic.h> | ||
21 | 21 | ||
22 | #include <linux/netfilter.h> | 22 | #include <linux/netfilter.h> |
23 | #include <linux/netfilter/nfnetlink.h> | 23 | #include <linux/netfilter/nfnetlink.h> |
diff --git a/net/netfilter/xt_CT.c b/net/netfilter/xt_CT.c index 0c8e43810ce3..59530e93fa58 100644 --- a/net/netfilter/xt_CT.c +++ b/net/netfilter/xt_CT.c | |||
@@ -150,6 +150,17 @@ err1: | |||
150 | return ret; | 150 | return ret; |
151 | } | 151 | } |
152 | 152 | ||
153 | #ifdef CONFIG_NF_CONNTRACK_TIMEOUT | ||
154 | static void __xt_ct_tg_timeout_put(struct ctnl_timeout *timeout) | ||
155 | { | ||
156 | typeof(nf_ct_timeout_put_hook) timeout_put; | ||
157 | |||
158 | timeout_put = rcu_dereference(nf_ct_timeout_put_hook); | ||
159 | if (timeout_put) | ||
160 | timeout_put(timeout); | ||
161 | } | ||
162 | #endif | ||
163 | |||
153 | static int xt_ct_tg_check_v1(const struct xt_tgchk_param *par) | 164 | static int xt_ct_tg_check_v1(const struct xt_tgchk_param *par) |
154 | { | 165 | { |
155 | struct xt_ct_target_info_v1 *info = par->targinfo; | 166 | struct xt_ct_target_info_v1 *info = par->targinfo; |
@@ -158,7 +169,9 @@ static int xt_ct_tg_check_v1(const struct xt_tgchk_param *par) | |||
158 | struct nf_conn *ct; | 169 | struct nf_conn *ct; |
159 | int ret = 0; | 170 | int ret = 0; |
160 | u8 proto; | 171 | u8 proto; |
161 | 172 | #ifdef CONFIG_NF_CONNTRACK_TIMEOUT | |
173 | struct ctnl_timeout *timeout; | ||
174 | #endif | ||
162 | if (info->flags & ~XT_CT_NOTRACK) | 175 | if (info->flags & ~XT_CT_NOTRACK) |
163 | return -EINVAL; | 176 | return -EINVAL; |
164 | 177 | ||
@@ -216,7 +229,6 @@ static int xt_ct_tg_check_v1(const struct xt_tgchk_param *par) | |||
216 | #ifdef CONFIG_NF_CONNTRACK_TIMEOUT | 229 | #ifdef CONFIG_NF_CONNTRACK_TIMEOUT |
217 | if (info->timeout) { | 230 | if (info->timeout) { |
218 | typeof(nf_ct_timeout_find_get_hook) timeout_find_get; | 231 | typeof(nf_ct_timeout_find_get_hook) timeout_find_get; |
219 | struct ctnl_timeout *timeout; | ||
220 | struct nf_conn_timeout *timeout_ext; | 232 | struct nf_conn_timeout *timeout_ext; |
221 | 233 | ||
222 | rcu_read_lock(); | 234 | rcu_read_lock(); |
@@ -245,7 +257,7 @@ static int xt_ct_tg_check_v1(const struct xt_tgchk_param *par) | |||
245 | pr_info("Timeout policy `%s' can only be " | 257 | pr_info("Timeout policy `%s' can only be " |
246 | "used by L3 protocol number %d\n", | 258 | "used by L3 protocol number %d\n", |
247 | info->timeout, timeout->l3num); | 259 | info->timeout, timeout->l3num); |
248 | goto err4; | 260 | goto err5; |
249 | } | 261 | } |
250 | /* Make sure the timeout policy matches any existing | 262 | /* Make sure the timeout policy matches any existing |
251 | * protocol tracker, otherwise default to generic. | 263 | * protocol tracker, otherwise default to generic. |
@@ -258,13 +270,13 @@ static int xt_ct_tg_check_v1(const struct xt_tgchk_param *par) | |||
258 | "used by L4 protocol number %d\n", | 270 | "used by L4 protocol number %d\n", |
259 | info->timeout, | 271 | info->timeout, |
260 | timeout->l4proto->l4proto); | 272 | timeout->l4proto->l4proto); |
261 | goto err4; | 273 | goto err5; |
262 | } | 274 | } |
263 | timeout_ext = nf_ct_timeout_ext_add(ct, timeout, | 275 | timeout_ext = nf_ct_timeout_ext_add(ct, timeout, |
264 | GFP_KERNEL); | 276 | GFP_ATOMIC); |
265 | if (timeout_ext == NULL) { | 277 | if (timeout_ext == NULL) { |
266 | ret = -ENOMEM; | 278 | ret = -ENOMEM; |
267 | goto err4; | 279 | goto err5; |
268 | } | 280 | } |
269 | } else { | 281 | } else { |
270 | ret = -ENOENT; | 282 | ret = -ENOENT; |
@@ -281,8 +293,12 @@ out: | |||
281 | info->ct = ct; | 293 | info->ct = ct; |
282 | return 0; | 294 | return 0; |
283 | 295 | ||
296 | #ifdef CONFIG_NF_CONNTRACK_TIMEOUT | ||
297 | err5: | ||
298 | __xt_ct_tg_timeout_put(timeout); | ||
284 | err4: | 299 | err4: |
285 | rcu_read_unlock(); | 300 | rcu_read_unlock(); |
301 | #endif | ||
286 | err3: | 302 | err3: |
287 | nf_conntrack_free(ct); | 303 | nf_conntrack_free(ct); |
288 | err2: | 304 | err2: |
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c index 32bb75324e76..faa48f70b7c9 100644 --- a/net/netlink/af_netlink.c +++ b/net/netlink/af_netlink.c | |||
@@ -829,12 +829,19 @@ int netlink_attachskb(struct sock *sk, struct sk_buff *skb, | |||
829 | return 0; | 829 | return 0; |
830 | } | 830 | } |
831 | 831 | ||
832 | int netlink_sendskb(struct sock *sk, struct sk_buff *skb) | 832 | static int __netlink_sendskb(struct sock *sk, struct sk_buff *skb) |
833 | { | 833 | { |
834 | int len = skb->len; | 834 | int len = skb->len; |
835 | 835 | ||
836 | skb_queue_tail(&sk->sk_receive_queue, skb); | 836 | skb_queue_tail(&sk->sk_receive_queue, skb); |
837 | sk->sk_data_ready(sk, len); | 837 | sk->sk_data_ready(sk, len); |
838 | return len; | ||
839 | } | ||
840 | |||
841 | int netlink_sendskb(struct sock *sk, struct sk_buff *skb) | ||
842 | { | ||
843 | int len = __netlink_sendskb(sk, skb); | ||
844 | |||
838 | sock_put(sk); | 845 | sock_put(sk); |
839 | return len; | 846 | return len; |
840 | } | 847 | } |
@@ -957,8 +964,7 @@ static int netlink_broadcast_deliver(struct sock *sk, struct sk_buff *skb) | |||
957 | if (atomic_read(&sk->sk_rmem_alloc) <= sk->sk_rcvbuf && | 964 | if (atomic_read(&sk->sk_rmem_alloc) <= sk->sk_rcvbuf && |
958 | !test_bit(0, &nlk->state)) { | 965 | !test_bit(0, &nlk->state)) { |
959 | skb_set_owner_r(skb, sk); | 966 | skb_set_owner_r(skb, sk); |
960 | skb_queue_tail(&sk->sk_receive_queue, skb); | 967 | __netlink_sendskb(sk, skb); |
961 | sk->sk_data_ready(sk, skb->len); | ||
962 | return atomic_read(&sk->sk_rmem_alloc) > (sk->sk_rcvbuf >> 1); | 968 | return atomic_read(&sk->sk_rmem_alloc) > (sk->sk_rcvbuf >> 1); |
963 | } | 969 | } |
964 | return -1; | 970 | return -1; |
@@ -1698,10 +1704,8 @@ static int netlink_dump(struct sock *sk) | |||
1698 | 1704 | ||
1699 | if (sk_filter(sk, skb)) | 1705 | if (sk_filter(sk, skb)) |
1700 | kfree_skb(skb); | 1706 | kfree_skb(skb); |
1701 | else { | 1707 | else |
1702 | skb_queue_tail(&sk->sk_receive_queue, skb); | 1708 | __netlink_sendskb(sk, skb); |
1703 | sk->sk_data_ready(sk, skb->len); | ||
1704 | } | ||
1705 | return 0; | 1709 | return 0; |
1706 | } | 1710 | } |
1707 | 1711 | ||
@@ -1715,10 +1719,8 @@ static int netlink_dump(struct sock *sk) | |||
1715 | 1719 | ||
1716 | if (sk_filter(sk, skb)) | 1720 | if (sk_filter(sk, skb)) |
1717 | kfree_skb(skb); | 1721 | kfree_skb(skb); |
1718 | else { | 1722 | else |
1719 | skb_queue_tail(&sk->sk_receive_queue, skb); | 1723 | __netlink_sendskb(sk, skb); |
1720 | sk->sk_data_ready(sk, skb->len); | ||
1721 | } | ||
1722 | 1724 | ||
1723 | if (cb->done) | 1725 | if (cb->done) |
1724 | cb->done(cb); | 1726 | cb->done(cb); |
diff --git a/net/phonet/pep.c b/net/phonet/pep.c index 9f60008740e3..9726fe684ab8 100644 --- a/net/phonet/pep.c +++ b/net/phonet/pep.c | |||
@@ -1130,6 +1130,9 @@ static int pep_sendmsg(struct kiocb *iocb, struct sock *sk, | |||
1130 | int flags = msg->msg_flags; | 1130 | int flags = msg->msg_flags; |
1131 | int err, done; | 1131 | int err, done; |
1132 | 1132 | ||
1133 | if (len > USHRT_MAX) | ||
1134 | return -EMSGSIZE; | ||
1135 | |||
1133 | if ((msg->msg_flags & ~(MSG_DONTWAIT|MSG_EOR|MSG_NOSIGNAL| | 1136 | if ((msg->msg_flags & ~(MSG_DONTWAIT|MSG_EOR|MSG_NOSIGNAL| |
1134 | MSG_CMSG_COMPAT)) || | 1137 | MSG_CMSG_COMPAT)) || |
1135 | !(msg->msg_flags & MSG_EOR)) | 1138 | !(msg->msg_flags & MSG_EOR)) |
diff --git a/net/rose/rose_dev.c b/net/rose/rose_dev.c index 1ab8689726ec..906cc05bba63 100644 --- a/net/rose/rose_dev.c +++ b/net/rose/rose_dev.c | |||
@@ -95,11 +95,11 @@ static int rose_set_mac_address(struct net_device *dev, void *addr) | |||
95 | struct sockaddr *sa = addr; | 95 | struct sockaddr *sa = addr; |
96 | int err; | 96 | int err; |
97 | 97 | ||
98 | if (!memcpy(dev->dev_addr, sa->sa_data, dev->addr_len)) | 98 | if (!memcmp(dev->dev_addr, sa->sa_data, dev->addr_len)) |
99 | return 0; | 99 | return 0; |
100 | 100 | ||
101 | if (dev->flags & IFF_UP) { | 101 | if (dev->flags & IFF_UP) { |
102 | err = rose_add_loopback_node((rose_address *)dev->dev_addr); | 102 | err = rose_add_loopback_node((rose_address *)sa->sa_data); |
103 | if (err) | 103 | if (err) |
104 | return err; | 104 | return err; |
105 | 105 | ||
diff --git a/net/sctp/socket.c b/net/sctp/socket.c index 06b42b7f5a02..92ba71dfe080 100644 --- a/net/sctp/socket.c +++ b/net/sctp/socket.c | |||
@@ -4133,9 +4133,10 @@ static int sctp_getsockopt_disable_fragments(struct sock *sk, int len, | |||
4133 | static int sctp_getsockopt_events(struct sock *sk, int len, char __user *optval, | 4133 | static int sctp_getsockopt_events(struct sock *sk, int len, char __user *optval, |
4134 | int __user *optlen) | 4134 | int __user *optlen) |
4135 | { | 4135 | { |
4136 | if (len < sizeof(struct sctp_event_subscribe)) | 4136 | if (len <= 0) |
4137 | return -EINVAL; | 4137 | return -EINVAL; |
4138 | len = sizeof(struct sctp_event_subscribe); | 4138 | if (len > sizeof(struct sctp_event_subscribe)) |
4139 | len = sizeof(struct sctp_event_subscribe); | ||
4139 | if (put_user(len, optlen)) | 4140 | if (put_user(len, optlen)) |
4140 | return -EFAULT; | 4141 | return -EFAULT; |
4141 | if (copy_to_user(optval, &sctp_sk(sk)->subscribe, len)) | 4142 | if (copy_to_user(optval, &sctp_sk(sk)->subscribe, len)) |
diff --git a/net/socket.c b/net/socket.c index 484cc6953fc6..851edcd6b098 100644 --- a/net/socket.c +++ b/net/socket.c | |||
@@ -811,9 +811,9 @@ static ssize_t sock_sendpage(struct file *file, struct page *page, | |||
811 | 811 | ||
812 | sock = file->private_data; | 812 | sock = file->private_data; |
813 | 813 | ||
814 | flags = !(file->f_flags & O_NONBLOCK) ? 0 : MSG_DONTWAIT; | 814 | flags = (file->f_flags & O_NONBLOCK) ? MSG_DONTWAIT : 0; |
815 | if (more) | 815 | /* more is a combination of MSG_MORE and MSG_SENDPAGE_NOTLAST */ |
816 | flags |= MSG_MORE; | 816 | flags |= more; |
817 | 817 | ||
818 | return kernel_sendpage(sock, page, offset, size, flags); | 818 | return kernel_sendpage(sock, page, offset, size, flags); |
819 | } | 819 | } |
diff --git a/net/wireless/debugfs.c b/net/wireless/debugfs.c index 39765bcfb472..920cabe0461b 100644 --- a/net/wireless/debugfs.c +++ b/net/wireless/debugfs.c | |||
@@ -13,12 +13,6 @@ | |||
13 | #include "core.h" | 13 | #include "core.h" |
14 | #include "debugfs.h" | 14 | #include "debugfs.h" |
15 | 15 | ||
16 | static int cfg80211_open_file_generic(struct inode *inode, struct file *file) | ||
17 | { | ||
18 | file->private_data = inode->i_private; | ||
19 | return 0; | ||
20 | } | ||
21 | |||
22 | #define DEBUGFS_READONLY_FILE(name, buflen, fmt, value...) \ | 16 | #define DEBUGFS_READONLY_FILE(name, buflen, fmt, value...) \ |
23 | static ssize_t name## _read(struct file *file, char __user *userbuf, \ | 17 | static ssize_t name## _read(struct file *file, char __user *userbuf, \ |
24 | size_t count, loff_t *ppos) \ | 18 | size_t count, loff_t *ppos) \ |
@@ -33,7 +27,7 @@ static ssize_t name## _read(struct file *file, char __user *userbuf, \ | |||
33 | \ | 27 | \ |
34 | static const struct file_operations name## _ops = { \ | 28 | static const struct file_operations name## _ops = { \ |
35 | .read = name## _read, \ | 29 | .read = name## _read, \ |
36 | .open = cfg80211_open_file_generic, \ | 30 | .open = simple_open, \ |
37 | .llseek = generic_file_llseek, \ | 31 | .llseek = generic_file_llseek, \ |
38 | }; | 32 | }; |
39 | 33 | ||
@@ -102,7 +96,7 @@ static ssize_t ht40allow_map_read(struct file *file, | |||
102 | 96 | ||
103 | static const struct file_operations ht40allow_map_ops = { | 97 | static const struct file_operations ht40allow_map_ops = { |
104 | .read = ht40allow_map_read, | 98 | .read = ht40allow_map_read, |
105 | .open = cfg80211_open_file_generic, | 99 | .open = simple_open, |
106 | .llseek = default_llseek, | 100 | .llseek = default_llseek, |
107 | }; | 101 | }; |
108 | 102 | ||
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 4c1eb9472ddb..e49da2797022 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c | |||
@@ -2386,7 +2386,9 @@ nla_put_failure: | |||
2386 | } | 2386 | } |
2387 | 2387 | ||
2388 | static int nl80211_send_station(struct sk_buff *msg, u32 pid, u32 seq, | 2388 | static int nl80211_send_station(struct sk_buff *msg, u32 pid, u32 seq, |
2389 | int flags, struct net_device *dev, | 2389 | int flags, |
2390 | struct cfg80211_registered_device *rdev, | ||
2391 | struct net_device *dev, | ||
2390 | const u8 *mac_addr, struct station_info *sinfo) | 2392 | const u8 *mac_addr, struct station_info *sinfo) |
2391 | { | 2393 | { |
2392 | void *hdr; | 2394 | void *hdr; |
@@ -2425,12 +2427,18 @@ static int nl80211_send_station(struct sk_buff *msg, u32 pid, u32 seq, | |||
2425 | if (sinfo->filled & STATION_INFO_PLINK_STATE) | 2427 | if (sinfo->filled & STATION_INFO_PLINK_STATE) |
2426 | NLA_PUT_U8(msg, NL80211_STA_INFO_PLINK_STATE, | 2428 | NLA_PUT_U8(msg, NL80211_STA_INFO_PLINK_STATE, |
2427 | sinfo->plink_state); | 2429 | sinfo->plink_state); |
2428 | if (sinfo->filled & STATION_INFO_SIGNAL) | 2430 | switch (rdev->wiphy.signal_type) { |
2429 | NLA_PUT_U8(msg, NL80211_STA_INFO_SIGNAL, | 2431 | case CFG80211_SIGNAL_TYPE_MBM: |
2430 | sinfo->signal); | 2432 | if (sinfo->filled & STATION_INFO_SIGNAL) |
2431 | if (sinfo->filled & STATION_INFO_SIGNAL_AVG) | 2433 | NLA_PUT_U8(msg, NL80211_STA_INFO_SIGNAL, |
2432 | NLA_PUT_U8(msg, NL80211_STA_INFO_SIGNAL_AVG, | 2434 | sinfo->signal); |
2433 | sinfo->signal_avg); | 2435 | if (sinfo->filled & STATION_INFO_SIGNAL_AVG) |
2436 | NLA_PUT_U8(msg, NL80211_STA_INFO_SIGNAL_AVG, | ||
2437 | sinfo->signal_avg); | ||
2438 | break; | ||
2439 | default: | ||
2440 | break; | ||
2441 | } | ||
2434 | if (sinfo->filled & STATION_INFO_TX_BITRATE) { | 2442 | if (sinfo->filled & STATION_INFO_TX_BITRATE) { |
2435 | if (!nl80211_put_sta_rate(msg, &sinfo->txrate, | 2443 | if (!nl80211_put_sta_rate(msg, &sinfo->txrate, |
2436 | NL80211_STA_INFO_TX_BITRATE)) | 2444 | NL80211_STA_INFO_TX_BITRATE)) |
@@ -2523,7 +2531,7 @@ static int nl80211_dump_station(struct sk_buff *skb, | |||
2523 | if (nl80211_send_station(skb, | 2531 | if (nl80211_send_station(skb, |
2524 | NETLINK_CB(cb->skb).pid, | 2532 | NETLINK_CB(cb->skb).pid, |
2525 | cb->nlh->nlmsg_seq, NLM_F_MULTI, | 2533 | cb->nlh->nlmsg_seq, NLM_F_MULTI, |
2526 | netdev, mac_addr, | 2534 | dev, netdev, mac_addr, |
2527 | &sinfo) < 0) | 2535 | &sinfo) < 0) |
2528 | goto out; | 2536 | goto out; |
2529 | 2537 | ||
@@ -2568,7 +2576,7 @@ static int nl80211_get_station(struct sk_buff *skb, struct genl_info *info) | |||
2568 | return -ENOMEM; | 2576 | return -ENOMEM; |
2569 | 2577 | ||
2570 | if (nl80211_send_station(msg, info->snd_pid, info->snd_seq, 0, | 2578 | if (nl80211_send_station(msg, info->snd_pid, info->snd_seq, 0, |
2571 | dev, mac_addr, &sinfo) < 0) { | 2579 | rdev, dev, mac_addr, &sinfo) < 0) { |
2572 | nlmsg_free(msg); | 2580 | nlmsg_free(msg); |
2573 | return -ENOBUFS; | 2581 | return -ENOBUFS; |
2574 | } | 2582 | } |
@@ -7596,7 +7604,8 @@ void nl80211_send_sta_event(struct cfg80211_registered_device *rdev, | |||
7596 | if (!msg) | 7604 | if (!msg) |
7597 | return; | 7605 | return; |
7598 | 7606 | ||
7599 | if (nl80211_send_station(msg, 0, 0, 0, dev, mac_addr, sinfo) < 0) { | 7607 | if (nl80211_send_station(msg, 0, 0, 0, |
7608 | rdev, dev, mac_addr, sinfo) < 0) { | ||
7600 | nlmsg_free(msg); | 7609 | nlmsg_free(msg); |
7601 | return; | 7610 | return; |
7602 | } | 7611 | } |
diff --git a/scripts/coccinelle/api/simple_open.cocci b/scripts/coccinelle/api/simple_open.cocci new file mode 100644 index 000000000000..05962f7be155 --- /dev/null +++ b/scripts/coccinelle/api/simple_open.cocci | |||
@@ -0,0 +1,70 @@ | |||
1 | /// This removes an open coded simple_open() function | ||
2 | /// and replaces file operations references to the function | ||
3 | /// with simple_open() instead. | ||
4 | /// | ||
5 | // Confidence: High | ||
6 | // Comments: | ||
7 | // Options: -no_includes -include_headers | ||
8 | |||
9 | virtual patch | ||
10 | virtual report | ||
11 | |||
12 | @ open depends on patch @ | ||
13 | identifier open_f != simple_open; | ||
14 | identifier i, f; | ||
15 | @@ | ||
16 | -int open_f(struct inode *i, struct file *f) | ||
17 | -{ | ||
18 | ( | ||
19 | -if (i->i_private) | ||
20 | -f->private_data = i->i_private; | ||
21 | | | ||
22 | -f->private_data = i->i_private; | ||
23 | ) | ||
24 | -return 0; | ||
25 | -} | ||
26 | |||
27 | @ has_open depends on open @ | ||
28 | identifier fops; | ||
29 | identifier open.open_f; | ||
30 | @@ | ||
31 | struct file_operations fops = { | ||
32 | ..., | ||
33 | -.open = open_f, | ||
34 | +.open = simple_open, | ||
35 | ... | ||
36 | }; | ||
37 | |||
38 | @ openr depends on report @ | ||
39 | identifier open_f != simple_open; | ||
40 | identifier i, f; | ||
41 | position p; | ||
42 | @@ | ||
43 | int open_f@p(struct inode *i, struct file *f) | ||
44 | { | ||
45 | ( | ||
46 | if (i->i_private) | ||
47 | f->private_data = i->i_private; | ||
48 | | | ||
49 | f->private_data = i->i_private; | ||
50 | ) | ||
51 | return 0; | ||
52 | } | ||
53 | |||
54 | @ has_openr depends on openr @ | ||
55 | identifier fops; | ||
56 | identifier openr.open_f; | ||
57 | position p; | ||
58 | @@ | ||
59 | struct file_operations fops = { | ||
60 | ..., | ||
61 | .open = open_f@p, | ||
62 | ... | ||
63 | }; | ||
64 | |||
65 | @script:python@ | ||
66 | pf << openr.p; | ||
67 | ps << has_openr.p; | ||
68 | @@ | ||
69 | |||
70 | coccilib.report.print_report(pf[0],"WARNING opportunity for simple_open, see also structure on line %s"%(ps[0].line)) | ||
diff --git a/scripts/tags.sh b/scripts/tags.sh index 0d6004e20658..cf7b12fee573 100755 --- a/scripts/tags.sh +++ b/scripts/tags.sh | |||
@@ -254,6 +254,6 @@ case "$1" in | |||
254 | esac | 254 | esac |
255 | 255 | ||
256 | # Remove structure forward declarations. | 256 | # Remove structure forward declarations. |
257 | if [ -n $remove_structs ]; then | 257 | if [ -n "$remove_structs" ]; then |
258 | LANG=C sed -i -e '/^\([a-zA-Z_][a-zA-Z0-9_]*\)\t.*\t\/\^struct \1;.*\$\/;"\tx$/d' $1 | 258 | LANG=C sed -i -e '/^\([a-zA-Z_][a-zA-Z0-9_]*\)\t.*\t\/\^struct \1;.*\$\/;"\tx$/d' $1 |
259 | fi | 259 | fi |
diff --git a/security/apparmor/audit.c b/security/apparmor/audit.c index 5ff67776a5ad..cc3520d39a78 100644 --- a/security/apparmor/audit.c +++ b/security/apparmor/audit.c | |||
@@ -115,23 +115,23 @@ static void audit_pre(struct audit_buffer *ab, void *ca) | |||
115 | 115 | ||
116 | if (aa_g_audit_header) { | 116 | if (aa_g_audit_header) { |
117 | audit_log_format(ab, "apparmor="); | 117 | audit_log_format(ab, "apparmor="); |
118 | audit_log_string(ab, aa_audit_type[sa->aad.type]); | 118 | audit_log_string(ab, aa_audit_type[sa->aad->type]); |
119 | } | 119 | } |
120 | 120 | ||
121 | if (sa->aad.op) { | 121 | if (sa->aad->op) { |
122 | audit_log_format(ab, " operation="); | 122 | audit_log_format(ab, " operation="); |
123 | audit_log_string(ab, op_table[sa->aad.op]); | 123 | audit_log_string(ab, op_table[sa->aad->op]); |
124 | } | 124 | } |
125 | 125 | ||
126 | if (sa->aad.info) { | 126 | if (sa->aad->info) { |
127 | audit_log_format(ab, " info="); | 127 | audit_log_format(ab, " info="); |
128 | audit_log_string(ab, sa->aad.info); | 128 | audit_log_string(ab, sa->aad->info); |
129 | if (sa->aad.error) | 129 | if (sa->aad->error) |
130 | audit_log_format(ab, " error=%d", sa->aad.error); | 130 | audit_log_format(ab, " error=%d", sa->aad->error); |
131 | } | 131 | } |
132 | 132 | ||
133 | if (sa->aad.profile) { | 133 | if (sa->aad->profile) { |
134 | struct aa_profile *profile = sa->aad.profile; | 134 | struct aa_profile *profile = sa->aad->profile; |
135 | pid_t pid; | 135 | pid_t pid; |
136 | rcu_read_lock(); | 136 | rcu_read_lock(); |
137 | pid = rcu_dereference(tsk->real_parent)->pid; | 137 | pid = rcu_dereference(tsk->real_parent)->pid; |
@@ -145,9 +145,9 @@ static void audit_pre(struct audit_buffer *ab, void *ca) | |||
145 | audit_log_untrustedstring(ab, profile->base.hname); | 145 | audit_log_untrustedstring(ab, profile->base.hname); |
146 | } | 146 | } |
147 | 147 | ||
148 | if (sa->aad.name) { | 148 | if (sa->aad->name) { |
149 | audit_log_format(ab, " name="); | 149 | audit_log_format(ab, " name="); |
150 | audit_log_untrustedstring(ab, sa->aad.name); | 150 | audit_log_untrustedstring(ab, sa->aad->name); |
151 | } | 151 | } |
152 | } | 152 | } |
153 | 153 | ||
@@ -159,10 +159,8 @@ static void audit_pre(struct audit_buffer *ab, void *ca) | |||
159 | void aa_audit_msg(int type, struct common_audit_data *sa, | 159 | void aa_audit_msg(int type, struct common_audit_data *sa, |
160 | void (*cb) (struct audit_buffer *, void *)) | 160 | void (*cb) (struct audit_buffer *, void *)) |
161 | { | 161 | { |
162 | sa->aad.type = type; | 162 | sa->aad->type = type; |
163 | sa->lsm_pre_audit = audit_pre; | 163 | common_lsm_audit(sa, audit_pre, cb); |
164 | sa->lsm_post_audit = cb; | ||
165 | common_lsm_audit(sa); | ||
166 | } | 164 | } |
167 | 165 | ||
168 | /** | 166 | /** |
@@ -184,7 +182,7 @@ int aa_audit(int type, struct aa_profile *profile, gfp_t gfp, | |||
184 | BUG_ON(!profile); | 182 | BUG_ON(!profile); |
185 | 183 | ||
186 | if (type == AUDIT_APPARMOR_AUTO) { | 184 | if (type == AUDIT_APPARMOR_AUTO) { |
187 | if (likely(!sa->aad.error)) { | 185 | if (likely(!sa->aad->error)) { |
188 | if (AUDIT_MODE(profile) != AUDIT_ALL) | 186 | if (AUDIT_MODE(profile) != AUDIT_ALL) |
189 | return 0; | 187 | return 0; |
190 | type = AUDIT_APPARMOR_AUDIT; | 188 | type = AUDIT_APPARMOR_AUDIT; |
@@ -196,21 +194,21 @@ int aa_audit(int type, struct aa_profile *profile, gfp_t gfp, | |||
196 | if (AUDIT_MODE(profile) == AUDIT_QUIET || | 194 | if (AUDIT_MODE(profile) == AUDIT_QUIET || |
197 | (type == AUDIT_APPARMOR_DENIED && | 195 | (type == AUDIT_APPARMOR_DENIED && |
198 | AUDIT_MODE(profile) == AUDIT_QUIET)) | 196 | AUDIT_MODE(profile) == AUDIT_QUIET)) |
199 | return sa->aad.error; | 197 | return sa->aad->error; |
200 | 198 | ||
201 | if (KILL_MODE(profile) && type == AUDIT_APPARMOR_DENIED) | 199 | if (KILL_MODE(profile) && type == AUDIT_APPARMOR_DENIED) |
202 | type = AUDIT_APPARMOR_KILL; | 200 | type = AUDIT_APPARMOR_KILL; |
203 | 201 | ||
204 | if (!unconfined(profile)) | 202 | if (!unconfined(profile)) |
205 | sa->aad.profile = profile; | 203 | sa->aad->profile = profile; |
206 | 204 | ||
207 | aa_audit_msg(type, sa, cb); | 205 | aa_audit_msg(type, sa, cb); |
208 | 206 | ||
209 | if (sa->aad.type == AUDIT_APPARMOR_KILL) | 207 | if (sa->aad->type == AUDIT_APPARMOR_KILL) |
210 | (void)send_sig_info(SIGKILL, NULL, sa->tsk ? sa->tsk : current); | 208 | (void)send_sig_info(SIGKILL, NULL, sa->tsk ? sa->tsk : current); |
211 | 209 | ||
212 | if (sa->aad.type == AUDIT_APPARMOR_ALLOWED) | 210 | if (sa->aad->type == AUDIT_APPARMOR_ALLOWED) |
213 | return complain_error(sa->aad.error); | 211 | return complain_error(sa->aad->error); |
214 | 212 | ||
215 | return sa->aad.error; | 213 | return sa->aad->error; |
216 | } | 214 | } |
diff --git a/security/apparmor/capability.c b/security/apparmor/capability.c index 9982c48def4e..088dba3bf7dc 100644 --- a/security/apparmor/capability.c +++ b/security/apparmor/capability.c | |||
@@ -64,11 +64,13 @@ static int audit_caps(struct aa_profile *profile, struct task_struct *task, | |||
64 | struct audit_cache *ent; | 64 | struct audit_cache *ent; |
65 | int type = AUDIT_APPARMOR_AUTO; | 65 | int type = AUDIT_APPARMOR_AUTO; |
66 | struct common_audit_data sa; | 66 | struct common_audit_data sa; |
67 | struct apparmor_audit_data aad = {0,}; | ||
67 | COMMON_AUDIT_DATA_INIT(&sa, CAP); | 68 | COMMON_AUDIT_DATA_INIT(&sa, CAP); |
69 | sa.aad = &aad; | ||
68 | sa.tsk = task; | 70 | sa.tsk = task; |
69 | sa.u.cap = cap; | 71 | sa.u.cap = cap; |
70 | sa.aad.op = OP_CAPABLE; | 72 | sa.aad->op = OP_CAPABLE; |
71 | sa.aad.error = error; | 73 | sa.aad->error = error; |
72 | 74 | ||
73 | if (likely(!error)) { | 75 | if (likely(!error)) { |
74 | /* test if auditing is being forced */ | 76 | /* test if auditing is being forced */ |
diff --git a/security/apparmor/file.c b/security/apparmor/file.c index 5d176f2530c9..2f8fcba9ce4b 100644 --- a/security/apparmor/file.c +++ b/security/apparmor/file.c | |||
@@ -67,22 +67,22 @@ static void file_audit_cb(struct audit_buffer *ab, void *va) | |||
67 | struct common_audit_data *sa = va; | 67 | struct common_audit_data *sa = va; |
68 | uid_t fsuid = current_fsuid(); | 68 | uid_t fsuid = current_fsuid(); |
69 | 69 | ||
70 | if (sa->aad.fs.request & AA_AUDIT_FILE_MASK) { | 70 | if (sa->aad->fs.request & AA_AUDIT_FILE_MASK) { |
71 | audit_log_format(ab, " requested_mask="); | 71 | audit_log_format(ab, " requested_mask="); |
72 | audit_file_mask(ab, sa->aad.fs.request); | 72 | audit_file_mask(ab, sa->aad->fs.request); |
73 | } | 73 | } |
74 | if (sa->aad.fs.denied & AA_AUDIT_FILE_MASK) { | 74 | if (sa->aad->fs.denied & AA_AUDIT_FILE_MASK) { |
75 | audit_log_format(ab, " denied_mask="); | 75 | audit_log_format(ab, " denied_mask="); |
76 | audit_file_mask(ab, sa->aad.fs.denied); | 76 | audit_file_mask(ab, sa->aad->fs.denied); |
77 | } | 77 | } |
78 | if (sa->aad.fs.request & AA_AUDIT_FILE_MASK) { | 78 | if (sa->aad->fs.request & AA_AUDIT_FILE_MASK) { |
79 | audit_log_format(ab, " fsuid=%d", fsuid); | 79 | audit_log_format(ab, " fsuid=%d", fsuid); |
80 | audit_log_format(ab, " ouid=%d", sa->aad.fs.ouid); | 80 | audit_log_format(ab, " ouid=%d", sa->aad->fs.ouid); |
81 | } | 81 | } |
82 | 82 | ||
83 | if (sa->aad.fs.target) { | 83 | if (sa->aad->fs.target) { |
84 | audit_log_format(ab, " target="); | 84 | audit_log_format(ab, " target="); |
85 | audit_log_untrustedstring(ab, sa->aad.fs.target); | 85 | audit_log_untrustedstring(ab, sa->aad->fs.target); |
86 | } | 86 | } |
87 | } | 87 | } |
88 | 88 | ||
@@ -107,45 +107,47 @@ int aa_audit_file(struct aa_profile *profile, struct file_perms *perms, | |||
107 | { | 107 | { |
108 | int type = AUDIT_APPARMOR_AUTO; | 108 | int type = AUDIT_APPARMOR_AUTO; |
109 | struct common_audit_data sa; | 109 | struct common_audit_data sa; |
110 | struct apparmor_audit_data aad = {0,}; | ||
110 | COMMON_AUDIT_DATA_INIT(&sa, NONE); | 111 | COMMON_AUDIT_DATA_INIT(&sa, NONE); |
111 | sa.aad.op = op, | 112 | sa.aad = &aad; |
112 | sa.aad.fs.request = request; | 113 | aad.op = op, |
113 | sa.aad.name = name; | 114 | aad.fs.request = request; |
114 | sa.aad.fs.target = target; | 115 | aad.name = name; |
115 | sa.aad.fs.ouid = ouid; | 116 | aad.fs.target = target; |
116 | sa.aad.info = info; | 117 | aad.fs.ouid = ouid; |
117 | sa.aad.error = error; | 118 | aad.info = info; |
118 | 119 | aad.error = error; | |
119 | if (likely(!sa.aad.error)) { | 120 | |
121 | if (likely(!sa.aad->error)) { | ||
120 | u32 mask = perms->audit; | 122 | u32 mask = perms->audit; |
121 | 123 | ||
122 | if (unlikely(AUDIT_MODE(profile) == AUDIT_ALL)) | 124 | if (unlikely(AUDIT_MODE(profile) == AUDIT_ALL)) |
123 | mask = 0xffff; | 125 | mask = 0xffff; |
124 | 126 | ||
125 | /* mask off perms that are not being force audited */ | 127 | /* mask off perms that are not being force audited */ |
126 | sa.aad.fs.request &= mask; | 128 | sa.aad->fs.request &= mask; |
127 | 129 | ||
128 | if (likely(!sa.aad.fs.request)) | 130 | if (likely(!sa.aad->fs.request)) |
129 | return 0; | 131 | return 0; |
130 | type = AUDIT_APPARMOR_AUDIT; | 132 | type = AUDIT_APPARMOR_AUDIT; |
131 | } else { | 133 | } else { |
132 | /* only report permissions that were denied */ | 134 | /* only report permissions that were denied */ |
133 | sa.aad.fs.request = sa.aad.fs.request & ~perms->allow; | 135 | sa.aad->fs.request = sa.aad->fs.request & ~perms->allow; |
134 | 136 | ||
135 | if (sa.aad.fs.request & perms->kill) | 137 | if (sa.aad->fs.request & perms->kill) |
136 | type = AUDIT_APPARMOR_KILL; | 138 | type = AUDIT_APPARMOR_KILL; |
137 | 139 | ||
138 | /* quiet known rejects, assumes quiet and kill do not overlap */ | 140 | /* quiet known rejects, assumes quiet and kill do not overlap */ |
139 | if ((sa.aad.fs.request & perms->quiet) && | 141 | if ((sa.aad->fs.request & perms->quiet) && |
140 | AUDIT_MODE(profile) != AUDIT_NOQUIET && | 142 | AUDIT_MODE(profile) != AUDIT_NOQUIET && |
141 | AUDIT_MODE(profile) != AUDIT_ALL) | 143 | AUDIT_MODE(profile) != AUDIT_ALL) |
142 | sa.aad.fs.request &= ~perms->quiet; | 144 | sa.aad->fs.request &= ~perms->quiet; |
143 | 145 | ||
144 | if (!sa.aad.fs.request) | 146 | if (!sa.aad->fs.request) |
145 | return COMPLAIN_MODE(profile) ? 0 : sa.aad.error; | 147 | return COMPLAIN_MODE(profile) ? 0 : sa.aad->error; |
146 | } | 148 | } |
147 | 149 | ||
148 | sa.aad.fs.denied = sa.aad.fs.request & ~perms->allow; | 150 | sa.aad->fs.denied = sa.aad->fs.request & ~perms->allow; |
149 | return aa_audit(type, profile, gfp, &sa, file_audit_cb); | 151 | return aa_audit(type, profile, gfp, &sa, file_audit_cb); |
150 | } | 152 | } |
151 | 153 | ||
diff --git a/security/apparmor/include/audit.h b/security/apparmor/include/audit.h index 4ba78c203af1..3868b1e5d5ba 100644 --- a/security/apparmor/include/audit.h +++ b/security/apparmor/include/audit.h | |||
@@ -103,7 +103,33 @@ enum aa_ops { | |||
103 | }; | 103 | }; |
104 | 104 | ||
105 | 105 | ||
106 | /* define a short hand for apparmor_audit_data portion of common_audit_data */ | 106 | struct apparmor_audit_data { |
107 | int error; | ||
108 | int op; | ||
109 | int type; | ||
110 | void *profile; | ||
111 | const char *name; | ||
112 | const char *info; | ||
113 | union { | ||
114 | void *target; | ||
115 | struct { | ||
116 | long pos; | ||
117 | void *target; | ||
118 | } iface; | ||
119 | struct { | ||
120 | int rlim; | ||
121 | unsigned long max; | ||
122 | } rlim; | ||
123 | struct { | ||
124 | const char *target; | ||
125 | u32 request; | ||
126 | u32 denied; | ||
127 | uid_t ouid; | ||
128 | } fs; | ||
129 | }; | ||
130 | }; | ||
131 | |||
132 | /* define a short hand for apparmor_audit_data structure */ | ||
107 | #define aad apparmor_audit_data | 133 | #define aad apparmor_audit_data |
108 | 134 | ||
109 | void aa_audit_msg(int type, struct common_audit_data *sa, | 135 | void aa_audit_msg(int type, struct common_audit_data *sa, |
diff --git a/security/apparmor/ipc.c b/security/apparmor/ipc.c index 7ee05c6f3c64..c3da93a5150d 100644 --- a/security/apparmor/ipc.c +++ b/security/apparmor/ipc.c | |||
@@ -26,7 +26,7 @@ static void audit_cb(struct audit_buffer *ab, void *va) | |||
26 | { | 26 | { |
27 | struct common_audit_data *sa = va; | 27 | struct common_audit_data *sa = va; |
28 | audit_log_format(ab, " target="); | 28 | audit_log_format(ab, " target="); |
29 | audit_log_untrustedstring(ab, sa->aad.target); | 29 | audit_log_untrustedstring(ab, sa->aad->target); |
30 | } | 30 | } |
31 | 31 | ||
32 | /** | 32 | /** |
@@ -41,10 +41,12 @@ static int aa_audit_ptrace(struct aa_profile *profile, | |||
41 | struct aa_profile *target, int error) | 41 | struct aa_profile *target, int error) |
42 | { | 42 | { |
43 | struct common_audit_data sa; | 43 | struct common_audit_data sa; |
44 | struct apparmor_audit_data aad = {0,}; | ||
44 | COMMON_AUDIT_DATA_INIT(&sa, NONE); | 45 | COMMON_AUDIT_DATA_INIT(&sa, NONE); |
45 | sa.aad.op = OP_PTRACE; | 46 | sa.aad = &aad; |
46 | sa.aad.target = target; | 47 | aad.op = OP_PTRACE; |
47 | sa.aad.error = error; | 48 | aad.target = target; |
49 | aad.error = error; | ||
48 | 50 | ||
49 | return aa_audit(AUDIT_APPARMOR_AUTO, profile, GFP_ATOMIC, &sa, | 51 | return aa_audit(AUDIT_APPARMOR_AUTO, profile, GFP_ATOMIC, &sa, |
50 | audit_cb); | 52 | audit_cb); |
diff --git a/security/apparmor/lib.c b/security/apparmor/lib.c index 9516948041ad..e75829ba0ff9 100644 --- a/security/apparmor/lib.c +++ b/security/apparmor/lib.c | |||
@@ -65,8 +65,10 @@ void aa_info_message(const char *str) | |||
65 | { | 65 | { |
66 | if (audit_enabled) { | 66 | if (audit_enabled) { |
67 | struct common_audit_data sa; | 67 | struct common_audit_data sa; |
68 | struct apparmor_audit_data aad = {0,}; | ||
68 | COMMON_AUDIT_DATA_INIT(&sa, NONE); | 69 | COMMON_AUDIT_DATA_INIT(&sa, NONE); |
69 | sa.aad.info = str; | 70 | sa.aad = &aad; |
71 | aad.info = str; | ||
70 | aa_audit_msg(AUDIT_APPARMOR_STATUS, &sa, NULL); | 72 | aa_audit_msg(AUDIT_APPARMOR_STATUS, &sa, NULL); |
71 | } | 73 | } |
72 | printk(KERN_INFO "AppArmor: %s\n", str); | 74 | printk(KERN_INFO "AppArmor: %s\n", str); |
diff --git a/security/apparmor/lsm.c b/security/apparmor/lsm.c index 97ce8fae49b3..ad05d391974d 100644 --- a/security/apparmor/lsm.c +++ b/security/apparmor/lsm.c | |||
@@ -588,10 +588,12 @@ static int apparmor_setprocattr(struct task_struct *task, char *name, | |||
588 | error = aa_setprocattr_permipc(args); | 588 | error = aa_setprocattr_permipc(args); |
589 | } else { | 589 | } else { |
590 | struct common_audit_data sa; | 590 | struct common_audit_data sa; |
591 | struct apparmor_audit_data aad = {0,}; | ||
591 | COMMON_AUDIT_DATA_INIT(&sa, NONE); | 592 | COMMON_AUDIT_DATA_INIT(&sa, NONE); |
592 | sa.aad.op = OP_SETPROCATTR; | 593 | sa.aad = &aad; |
593 | sa.aad.info = name; | 594 | aad.op = OP_SETPROCATTR; |
594 | sa.aad.error = -EINVAL; | 595 | aad.info = name; |
596 | aad.error = -EINVAL; | ||
595 | return aa_audit(AUDIT_APPARMOR_DENIED, | 597 | return aa_audit(AUDIT_APPARMOR_DENIED, |
596 | __aa_current_profile(), GFP_KERNEL, | 598 | __aa_current_profile(), GFP_KERNEL, |
597 | &sa, NULL); | 599 | &sa, NULL); |
diff --git a/security/apparmor/policy.c b/security/apparmor/policy.c index 906414383022..f1f7506a464d 100644 --- a/security/apparmor/policy.c +++ b/security/apparmor/policy.c | |||
@@ -964,11 +964,13 @@ static int audit_policy(int op, gfp_t gfp, const char *name, const char *info, | |||
964 | int error) | 964 | int error) |
965 | { | 965 | { |
966 | struct common_audit_data sa; | 966 | struct common_audit_data sa; |
967 | struct apparmor_audit_data aad = {0,}; | ||
967 | COMMON_AUDIT_DATA_INIT(&sa, NONE); | 968 | COMMON_AUDIT_DATA_INIT(&sa, NONE); |
968 | sa.aad.op = op; | 969 | sa.aad = &aad; |
969 | sa.aad.name = name; | 970 | aad.op = op; |
970 | sa.aad.info = info; | 971 | aad.name = name; |
971 | sa.aad.error = error; | 972 | aad.info = info; |
973 | aad.error = error; | ||
972 | 974 | ||
973 | return aa_audit(AUDIT_APPARMOR_STATUS, __aa_current_profile(), gfp, | 975 | return aa_audit(AUDIT_APPARMOR_STATUS, __aa_current_profile(), gfp, |
974 | &sa, NULL); | 976 | &sa, NULL); |
diff --git a/security/apparmor/policy_unpack.c b/security/apparmor/policy_unpack.c index 25fd51edc8da..deab7c7e8dc0 100644 --- a/security/apparmor/policy_unpack.c +++ b/security/apparmor/policy_unpack.c | |||
@@ -70,13 +70,13 @@ struct aa_ext { | |||
70 | static void audit_cb(struct audit_buffer *ab, void *va) | 70 | static void audit_cb(struct audit_buffer *ab, void *va) |
71 | { | 71 | { |
72 | struct common_audit_data *sa = va; | 72 | struct common_audit_data *sa = va; |
73 | if (sa->aad.iface.target) { | 73 | if (sa->aad->iface.target) { |
74 | struct aa_profile *name = sa->aad.iface.target; | 74 | struct aa_profile *name = sa->aad->iface.target; |
75 | audit_log_format(ab, " name="); | 75 | audit_log_format(ab, " name="); |
76 | audit_log_untrustedstring(ab, name->base.hname); | 76 | audit_log_untrustedstring(ab, name->base.hname); |
77 | } | 77 | } |
78 | if (sa->aad.iface.pos) | 78 | if (sa->aad->iface.pos) |
79 | audit_log_format(ab, " offset=%ld", sa->aad.iface.pos); | 79 | audit_log_format(ab, " offset=%ld", sa->aad->iface.pos); |
80 | } | 80 | } |
81 | 81 | ||
82 | /** | 82 | /** |
@@ -94,13 +94,15 @@ static int audit_iface(struct aa_profile *new, const char *name, | |||
94 | { | 94 | { |
95 | struct aa_profile *profile = __aa_current_profile(); | 95 | struct aa_profile *profile = __aa_current_profile(); |
96 | struct common_audit_data sa; | 96 | struct common_audit_data sa; |
97 | struct apparmor_audit_data aad = {0,}; | ||
97 | COMMON_AUDIT_DATA_INIT(&sa, NONE); | 98 | COMMON_AUDIT_DATA_INIT(&sa, NONE); |
99 | sa.aad = &aad; | ||
98 | if (e) | 100 | if (e) |
99 | sa.aad.iface.pos = e->pos - e->start; | 101 | aad.iface.pos = e->pos - e->start; |
100 | sa.aad.iface.target = new; | 102 | aad.iface.target = new; |
101 | sa.aad.name = name; | 103 | aad.name = name; |
102 | sa.aad.info = info; | 104 | aad.info = info; |
103 | sa.aad.error = error; | 105 | aad.error = error; |
104 | 106 | ||
105 | return aa_audit(AUDIT_APPARMOR_STATUS, profile, GFP_KERNEL, &sa, | 107 | return aa_audit(AUDIT_APPARMOR_STATUS, profile, GFP_KERNEL, &sa, |
106 | audit_cb); | 108 | audit_cb); |
diff --git a/security/apparmor/resource.c b/security/apparmor/resource.c index 72c25a4f2cfd..2fe8613efe33 100644 --- a/security/apparmor/resource.c +++ b/security/apparmor/resource.c | |||
@@ -34,7 +34,7 @@ static void audit_cb(struct audit_buffer *ab, void *va) | |||
34 | struct common_audit_data *sa = va; | 34 | struct common_audit_data *sa = va; |
35 | 35 | ||
36 | audit_log_format(ab, " rlimit=%s value=%lu", | 36 | audit_log_format(ab, " rlimit=%s value=%lu", |
37 | rlim_names[sa->aad.rlim.rlim], sa->aad.rlim.max); | 37 | rlim_names[sa->aad->rlim.rlim], sa->aad->rlim.max); |
38 | } | 38 | } |
39 | 39 | ||
40 | /** | 40 | /** |
@@ -50,12 +50,14 @@ static int audit_resource(struct aa_profile *profile, unsigned int resource, | |||
50 | unsigned long value, int error) | 50 | unsigned long value, int error) |
51 | { | 51 | { |
52 | struct common_audit_data sa; | 52 | struct common_audit_data sa; |
53 | struct apparmor_audit_data aad = {0,}; | ||
53 | 54 | ||
54 | COMMON_AUDIT_DATA_INIT(&sa, NONE); | 55 | COMMON_AUDIT_DATA_INIT(&sa, NONE); |
55 | sa.aad.op = OP_SETRLIMIT, | 56 | sa.aad = &aad; |
56 | sa.aad.rlim.rlim = resource; | 57 | aad.op = OP_SETRLIMIT, |
57 | sa.aad.rlim.max = value; | 58 | aad.rlim.rlim = resource; |
58 | sa.aad.error = error; | 59 | aad.rlim.max = value; |
60 | aad.error = error; | ||
59 | return aa_audit(AUDIT_APPARMOR_AUTO, profile, GFP_KERNEL, &sa, | 61 | return aa_audit(AUDIT_APPARMOR_AUTO, profile, GFP_KERNEL, &sa, |
60 | audit_cb); | 62 | audit_cb); |
61 | } | 63 | } |
diff --git a/security/lsm_audit.c b/security/lsm_audit.c index 8b8f0902f6e5..90c129b0102f 100644 --- a/security/lsm_audit.c +++ b/security/lsm_audit.c | |||
@@ -49,8 +49,8 @@ int ipv4_skb_to_auditdata(struct sk_buff *skb, | |||
49 | if (ih == NULL) | 49 | if (ih == NULL) |
50 | return -EINVAL; | 50 | return -EINVAL; |
51 | 51 | ||
52 | ad->u.net.v4info.saddr = ih->saddr; | 52 | ad->u.net->v4info.saddr = ih->saddr; |
53 | ad->u.net.v4info.daddr = ih->daddr; | 53 | ad->u.net->v4info.daddr = ih->daddr; |
54 | 54 | ||
55 | if (proto) | 55 | if (proto) |
56 | *proto = ih->protocol; | 56 | *proto = ih->protocol; |
@@ -64,8 +64,8 @@ int ipv4_skb_to_auditdata(struct sk_buff *skb, | |||
64 | if (th == NULL) | 64 | if (th == NULL) |
65 | break; | 65 | break; |
66 | 66 | ||
67 | ad->u.net.sport = th->source; | 67 | ad->u.net->sport = th->source; |
68 | ad->u.net.dport = th->dest; | 68 | ad->u.net->dport = th->dest; |
69 | break; | 69 | break; |
70 | } | 70 | } |
71 | case IPPROTO_UDP: { | 71 | case IPPROTO_UDP: { |
@@ -73,8 +73,8 @@ int ipv4_skb_to_auditdata(struct sk_buff *skb, | |||
73 | if (uh == NULL) | 73 | if (uh == NULL) |
74 | break; | 74 | break; |
75 | 75 | ||
76 | ad->u.net.sport = uh->source; | 76 | ad->u.net->sport = uh->source; |
77 | ad->u.net.dport = uh->dest; | 77 | ad->u.net->dport = uh->dest; |
78 | break; | 78 | break; |
79 | } | 79 | } |
80 | case IPPROTO_DCCP: { | 80 | case IPPROTO_DCCP: { |
@@ -82,16 +82,16 @@ int ipv4_skb_to_auditdata(struct sk_buff *skb, | |||
82 | if (dh == NULL) | 82 | if (dh == NULL) |
83 | break; | 83 | break; |
84 | 84 | ||
85 | ad->u.net.sport = dh->dccph_sport; | 85 | ad->u.net->sport = dh->dccph_sport; |
86 | ad->u.net.dport = dh->dccph_dport; | 86 | ad->u.net->dport = dh->dccph_dport; |
87 | break; | 87 | break; |
88 | } | 88 | } |
89 | case IPPROTO_SCTP: { | 89 | case IPPROTO_SCTP: { |
90 | struct sctphdr *sh = sctp_hdr(skb); | 90 | struct sctphdr *sh = sctp_hdr(skb); |
91 | if (sh == NULL) | 91 | if (sh == NULL) |
92 | break; | 92 | break; |
93 | ad->u.net.sport = sh->source; | 93 | ad->u.net->sport = sh->source; |
94 | ad->u.net.dport = sh->dest; | 94 | ad->u.net->dport = sh->dest; |
95 | break; | 95 | break; |
96 | } | 96 | } |
97 | default: | 97 | default: |
@@ -119,8 +119,8 @@ int ipv6_skb_to_auditdata(struct sk_buff *skb, | |||
119 | ip6 = ipv6_hdr(skb); | 119 | ip6 = ipv6_hdr(skb); |
120 | if (ip6 == NULL) | 120 | if (ip6 == NULL) |
121 | return -EINVAL; | 121 | return -EINVAL; |
122 | ad->u.net.v6info.saddr = ip6->saddr; | 122 | ad->u.net->v6info.saddr = ip6->saddr; |
123 | ad->u.net.v6info.daddr = ip6->daddr; | 123 | ad->u.net->v6info.daddr = ip6->daddr; |
124 | ret = 0; | 124 | ret = 0; |
125 | /* IPv6 can have several extension header before the Transport header | 125 | /* IPv6 can have several extension header before the Transport header |
126 | * skip them */ | 126 | * skip them */ |
@@ -140,8 +140,8 @@ int ipv6_skb_to_auditdata(struct sk_buff *skb, | |||
140 | if (th == NULL) | 140 | if (th == NULL) |
141 | break; | 141 | break; |
142 | 142 | ||
143 | ad->u.net.sport = th->source; | 143 | ad->u.net->sport = th->source; |
144 | ad->u.net.dport = th->dest; | 144 | ad->u.net->dport = th->dest; |
145 | break; | 145 | break; |
146 | } | 146 | } |
147 | case IPPROTO_UDP: { | 147 | case IPPROTO_UDP: { |
@@ -151,8 +151,8 @@ int ipv6_skb_to_auditdata(struct sk_buff *skb, | |||
151 | if (uh == NULL) | 151 | if (uh == NULL) |
152 | break; | 152 | break; |
153 | 153 | ||
154 | ad->u.net.sport = uh->source; | 154 | ad->u.net->sport = uh->source; |
155 | ad->u.net.dport = uh->dest; | 155 | ad->u.net->dport = uh->dest; |
156 | break; | 156 | break; |
157 | } | 157 | } |
158 | case IPPROTO_DCCP: { | 158 | case IPPROTO_DCCP: { |
@@ -162,8 +162,8 @@ int ipv6_skb_to_auditdata(struct sk_buff *skb, | |||
162 | if (dh == NULL) | 162 | if (dh == NULL) |
163 | break; | 163 | break; |
164 | 164 | ||
165 | ad->u.net.sport = dh->dccph_sport; | 165 | ad->u.net->sport = dh->dccph_sport; |
166 | ad->u.net.dport = dh->dccph_dport; | 166 | ad->u.net->dport = dh->dccph_dport; |
167 | break; | 167 | break; |
168 | } | 168 | } |
169 | case IPPROTO_SCTP: { | 169 | case IPPROTO_SCTP: { |
@@ -172,8 +172,8 @@ int ipv6_skb_to_auditdata(struct sk_buff *skb, | |||
172 | sh = skb_header_pointer(skb, offset, sizeof(_sctph), &_sctph); | 172 | sh = skb_header_pointer(skb, offset, sizeof(_sctph), &_sctph); |
173 | if (sh == NULL) | 173 | if (sh == NULL) |
174 | break; | 174 | break; |
175 | ad->u.net.sport = sh->source; | 175 | ad->u.net->sport = sh->source; |
176 | ad->u.net.dport = sh->dest; | 176 | ad->u.net->dport = sh->dest; |
177 | break; | 177 | break; |
178 | } | 178 | } |
179 | default: | 179 | default: |
@@ -281,8 +281,8 @@ static void dump_common_audit_data(struct audit_buffer *ab, | |||
281 | } | 281 | } |
282 | break; | 282 | break; |
283 | case LSM_AUDIT_DATA_NET: | 283 | case LSM_AUDIT_DATA_NET: |
284 | if (a->u.net.sk) { | 284 | if (a->u.net->sk) { |
285 | struct sock *sk = a->u.net.sk; | 285 | struct sock *sk = a->u.net->sk; |
286 | struct unix_sock *u; | 286 | struct unix_sock *u; |
287 | int len = 0; | 287 | int len = 0; |
288 | char *p = NULL; | 288 | char *p = NULL; |
@@ -330,29 +330,29 @@ static void dump_common_audit_data(struct audit_buffer *ab, | |||
330 | } | 330 | } |
331 | } | 331 | } |
332 | 332 | ||
333 | switch (a->u.net.family) { | 333 | switch (a->u.net->family) { |
334 | case AF_INET: | 334 | case AF_INET: |
335 | print_ipv4_addr(ab, a->u.net.v4info.saddr, | 335 | print_ipv4_addr(ab, a->u.net->v4info.saddr, |
336 | a->u.net.sport, | 336 | a->u.net->sport, |
337 | "saddr", "src"); | 337 | "saddr", "src"); |
338 | print_ipv4_addr(ab, a->u.net.v4info.daddr, | 338 | print_ipv4_addr(ab, a->u.net->v4info.daddr, |
339 | a->u.net.dport, | 339 | a->u.net->dport, |
340 | "daddr", "dest"); | 340 | "daddr", "dest"); |
341 | break; | 341 | break; |
342 | case AF_INET6: | 342 | case AF_INET6: |
343 | print_ipv6_addr(ab, &a->u.net.v6info.saddr, | 343 | print_ipv6_addr(ab, &a->u.net->v6info.saddr, |
344 | a->u.net.sport, | 344 | a->u.net->sport, |
345 | "saddr", "src"); | 345 | "saddr", "src"); |
346 | print_ipv6_addr(ab, &a->u.net.v6info.daddr, | 346 | print_ipv6_addr(ab, &a->u.net->v6info.daddr, |
347 | a->u.net.dport, | 347 | a->u.net->dport, |
348 | "daddr", "dest"); | 348 | "daddr", "dest"); |
349 | break; | 349 | break; |
350 | } | 350 | } |
351 | if (a->u.net.netif > 0) { | 351 | if (a->u.net->netif > 0) { |
352 | struct net_device *dev; | 352 | struct net_device *dev; |
353 | 353 | ||
354 | /* NOTE: we always use init's namespace */ | 354 | /* NOTE: we always use init's namespace */ |
355 | dev = dev_get_by_index(&init_net, a->u.net.netif); | 355 | dev = dev_get_by_index(&init_net, a->u.net->netif); |
356 | if (dev) { | 356 | if (dev) { |
357 | audit_log_format(ab, " netif=%s", dev->name); | 357 | audit_log_format(ab, " netif=%s", dev->name); |
358 | dev_put(dev); | 358 | dev_put(dev); |
@@ -378,11 +378,15 @@ static void dump_common_audit_data(struct audit_buffer *ab, | |||
378 | /** | 378 | /** |
379 | * common_lsm_audit - generic LSM auditing function | 379 | * common_lsm_audit - generic LSM auditing function |
380 | * @a: auxiliary audit data | 380 | * @a: auxiliary audit data |
381 | * @pre_audit: lsm-specific pre-audit callback | ||
382 | * @post_audit: lsm-specific post-audit callback | ||
381 | * | 383 | * |
382 | * setup the audit buffer for common security information | 384 | * setup the audit buffer for common security information |
383 | * uses callback to print LSM specific information | 385 | * uses callback to print LSM specific information |
384 | */ | 386 | */ |
385 | void common_lsm_audit(struct common_audit_data *a) | 387 | void common_lsm_audit(struct common_audit_data *a, |
388 | void (*pre_audit)(struct audit_buffer *, void *), | ||
389 | void (*post_audit)(struct audit_buffer *, void *)) | ||
386 | { | 390 | { |
387 | struct audit_buffer *ab; | 391 | struct audit_buffer *ab; |
388 | 392 | ||
@@ -394,13 +398,13 @@ void common_lsm_audit(struct common_audit_data *a) | |||
394 | if (ab == NULL) | 398 | if (ab == NULL) |
395 | return; | 399 | return; |
396 | 400 | ||
397 | if (a->lsm_pre_audit) | 401 | if (pre_audit) |
398 | a->lsm_pre_audit(ab, a); | 402 | pre_audit(ab, a); |
399 | 403 | ||
400 | dump_common_audit_data(ab, a); | 404 | dump_common_audit_data(ab, a); |
401 | 405 | ||
402 | if (a->lsm_post_audit) | 406 | if (post_audit) |
403 | a->lsm_post_audit(ab, a); | 407 | post_audit(ab, a); |
404 | 408 | ||
405 | audit_log_end(ab); | 409 | audit_log_end(ab); |
406 | } | 410 | } |
diff --git a/security/selinux/avc.c b/security/selinux/avc.c index 1a70fa26da72..8ee42b2a5f19 100644 --- a/security/selinux/avc.c +++ b/security/selinux/avc.c | |||
@@ -436,9 +436,9 @@ static void avc_audit_pre_callback(struct audit_buffer *ab, void *a) | |||
436 | { | 436 | { |
437 | struct common_audit_data *ad = a; | 437 | struct common_audit_data *ad = a; |
438 | audit_log_format(ab, "avc: %s ", | 438 | audit_log_format(ab, "avc: %s ", |
439 | ad->selinux_audit_data.denied ? "denied" : "granted"); | 439 | ad->selinux_audit_data->slad->denied ? "denied" : "granted"); |
440 | avc_dump_av(ab, ad->selinux_audit_data.tclass, | 440 | avc_dump_av(ab, ad->selinux_audit_data->slad->tclass, |
441 | ad->selinux_audit_data.audited); | 441 | ad->selinux_audit_data->slad->audited); |
442 | audit_log_format(ab, " for "); | 442 | audit_log_format(ab, " for "); |
443 | } | 443 | } |
444 | 444 | ||
@@ -452,22 +452,25 @@ static void avc_audit_post_callback(struct audit_buffer *ab, void *a) | |||
452 | { | 452 | { |
453 | struct common_audit_data *ad = a; | 453 | struct common_audit_data *ad = a; |
454 | audit_log_format(ab, " "); | 454 | audit_log_format(ab, " "); |
455 | avc_dump_query(ab, ad->selinux_audit_data.ssid, | 455 | avc_dump_query(ab, ad->selinux_audit_data->slad->ssid, |
456 | ad->selinux_audit_data.tsid, | 456 | ad->selinux_audit_data->slad->tsid, |
457 | ad->selinux_audit_data.tclass); | 457 | ad->selinux_audit_data->slad->tclass); |
458 | } | 458 | } |
459 | 459 | ||
460 | /* This is the slow part of avc audit with big stack footprint */ | 460 | /* This is the slow part of avc audit with big stack footprint */ |
461 | static noinline int slow_avc_audit(u32 ssid, u32 tsid, u16 tclass, | 461 | static noinline int slow_avc_audit(u32 ssid, u32 tsid, u16 tclass, |
462 | u32 requested, u32 audited, u32 denied, | 462 | u32 requested, u32 audited, u32 denied, |
463 | struct av_decision *avd, struct common_audit_data *a, | 463 | struct common_audit_data *a, |
464 | unsigned flags) | 464 | unsigned flags) |
465 | { | 465 | { |
466 | struct common_audit_data stack_data; | 466 | struct common_audit_data stack_data; |
467 | struct selinux_audit_data sad = {0,}; | ||
468 | struct selinux_late_audit_data slad; | ||
467 | 469 | ||
468 | if (!a) { | 470 | if (!a) { |
469 | a = &stack_data; | 471 | a = &stack_data; |
470 | COMMON_AUDIT_DATA_INIT(a, NONE); | 472 | COMMON_AUDIT_DATA_INIT(a, NONE); |
473 | a->selinux_audit_data = &sad; | ||
471 | } | 474 | } |
472 | 475 | ||
473 | /* | 476 | /* |
@@ -481,15 +484,15 @@ static noinline int slow_avc_audit(u32 ssid, u32 tsid, u16 tclass, | |||
481 | (flags & MAY_NOT_BLOCK)) | 484 | (flags & MAY_NOT_BLOCK)) |
482 | return -ECHILD; | 485 | return -ECHILD; |
483 | 486 | ||
484 | a->selinux_audit_data.tclass = tclass; | 487 | slad.tclass = tclass; |
485 | a->selinux_audit_data.requested = requested; | 488 | slad.requested = requested; |
486 | a->selinux_audit_data.ssid = ssid; | 489 | slad.ssid = ssid; |
487 | a->selinux_audit_data.tsid = tsid; | 490 | slad.tsid = tsid; |
488 | a->selinux_audit_data.audited = audited; | 491 | slad.audited = audited; |
489 | a->selinux_audit_data.denied = denied; | 492 | slad.denied = denied; |
490 | a->lsm_pre_audit = avc_audit_pre_callback; | 493 | |
491 | a->lsm_post_audit = avc_audit_post_callback; | 494 | a->selinux_audit_data->slad = &slad; |
492 | common_lsm_audit(a); | 495 | common_lsm_audit(a, avc_audit_pre_callback, avc_audit_post_callback); |
493 | return 0; | 496 | return 0; |
494 | } | 497 | } |
495 | 498 | ||
@@ -523,7 +526,7 @@ inline int avc_audit(u32 ssid, u32 tsid, | |||
523 | if (unlikely(denied)) { | 526 | if (unlikely(denied)) { |
524 | audited = denied & avd->auditdeny; | 527 | audited = denied & avd->auditdeny; |
525 | /* | 528 | /* |
526 | * a->selinux_audit_data.auditdeny is TRICKY! Setting a bit in | 529 | * a->selinux_audit_data->auditdeny is TRICKY! Setting a bit in |
527 | * this field means that ANY denials should NOT be audited if | 530 | * this field means that ANY denials should NOT be audited if |
528 | * the policy contains an explicit dontaudit rule for that | 531 | * the policy contains an explicit dontaudit rule for that |
529 | * permission. Take notice that this is unrelated to the | 532 | * permission. Take notice that this is unrelated to the |
@@ -532,15 +535,15 @@ inline int avc_audit(u32 ssid, u32 tsid, | |||
532 | * | 535 | * |
533 | * denied == READ | 536 | * denied == READ |
534 | * avd.auditdeny & ACCESS == 0 (not set means explicit rule) | 537 | * avd.auditdeny & ACCESS == 0 (not set means explicit rule) |
535 | * selinux_audit_data.auditdeny & ACCESS == 1 | 538 | * selinux_audit_data->auditdeny & ACCESS == 1 |
536 | * | 539 | * |
537 | * We will NOT audit the denial even though the denied | 540 | * We will NOT audit the denial even though the denied |
538 | * permission was READ and the auditdeny checks were for | 541 | * permission was READ and the auditdeny checks were for |
539 | * ACCESS | 542 | * ACCESS |
540 | */ | 543 | */ |
541 | if (a && | 544 | if (a && |
542 | a->selinux_audit_data.auditdeny && | 545 | a->selinux_audit_data->auditdeny && |
543 | !(a->selinux_audit_data.auditdeny & avd->auditdeny)) | 546 | !(a->selinux_audit_data->auditdeny & avd->auditdeny)) |
544 | audited = 0; | 547 | audited = 0; |
545 | } else if (result) | 548 | } else if (result) |
546 | audited = denied = requested; | 549 | audited = denied = requested; |
@@ -551,7 +554,7 @@ inline int avc_audit(u32 ssid, u32 tsid, | |||
551 | 554 | ||
552 | return slow_avc_audit(ssid, tsid, tclass, | 555 | return slow_avc_audit(ssid, tsid, tclass, |
553 | requested, audited, denied, | 556 | requested, audited, denied, |
554 | avd, a, flags); | 557 | a, flags); |
555 | } | 558 | } |
556 | 559 | ||
557 | /** | 560 | /** |
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c index 28482f9e15b8..d85b793c9321 100644 --- a/security/selinux/hooks.c +++ b/security/selinux/hooks.c | |||
@@ -1420,6 +1420,7 @@ static int cred_has_capability(const struct cred *cred, | |||
1420 | int cap, int audit) | 1420 | int cap, int audit) |
1421 | { | 1421 | { |
1422 | struct common_audit_data ad; | 1422 | struct common_audit_data ad; |
1423 | struct selinux_audit_data sad = {0,}; | ||
1423 | struct av_decision avd; | 1424 | struct av_decision avd; |
1424 | u16 sclass; | 1425 | u16 sclass; |
1425 | u32 sid = cred_sid(cred); | 1426 | u32 sid = cred_sid(cred); |
@@ -1427,6 +1428,7 @@ static int cred_has_capability(const struct cred *cred, | |||
1427 | int rc; | 1428 | int rc; |
1428 | 1429 | ||
1429 | COMMON_AUDIT_DATA_INIT(&ad, CAP); | 1430 | COMMON_AUDIT_DATA_INIT(&ad, CAP); |
1431 | ad.selinux_audit_data = &sad; | ||
1430 | ad.tsk = current; | 1432 | ad.tsk = current; |
1431 | ad.u.cap = cap; | 1433 | ad.u.cap = cap; |
1432 | 1434 | ||
@@ -1492,9 +1494,11 @@ static int inode_has_perm_noadp(const struct cred *cred, | |||
1492 | unsigned flags) | 1494 | unsigned flags) |
1493 | { | 1495 | { |
1494 | struct common_audit_data ad; | 1496 | struct common_audit_data ad; |
1497 | struct selinux_audit_data sad = {0,}; | ||
1495 | 1498 | ||
1496 | COMMON_AUDIT_DATA_INIT(&ad, INODE); | 1499 | COMMON_AUDIT_DATA_INIT(&ad, INODE); |
1497 | ad.u.inode = inode; | 1500 | ad.u.inode = inode; |
1501 | ad.selinux_audit_data = &sad; | ||
1498 | return inode_has_perm(cred, inode, perms, &ad, flags); | 1502 | return inode_has_perm(cred, inode, perms, &ad, flags); |
1499 | } | 1503 | } |
1500 | 1504 | ||
@@ -1507,9 +1511,11 @@ static inline int dentry_has_perm(const struct cred *cred, | |||
1507 | { | 1511 | { |
1508 | struct inode *inode = dentry->d_inode; | 1512 | struct inode *inode = dentry->d_inode; |
1509 | struct common_audit_data ad; | 1513 | struct common_audit_data ad; |
1514 | struct selinux_audit_data sad = {0,}; | ||
1510 | 1515 | ||
1511 | COMMON_AUDIT_DATA_INIT(&ad, DENTRY); | 1516 | COMMON_AUDIT_DATA_INIT(&ad, DENTRY); |
1512 | ad.u.dentry = dentry; | 1517 | ad.u.dentry = dentry; |
1518 | ad.selinux_audit_data = &sad; | ||
1513 | return inode_has_perm(cred, inode, av, &ad, 0); | 1519 | return inode_has_perm(cred, inode, av, &ad, 0); |
1514 | } | 1520 | } |
1515 | 1521 | ||
@@ -1522,9 +1528,11 @@ static inline int path_has_perm(const struct cred *cred, | |||
1522 | { | 1528 | { |
1523 | struct inode *inode = path->dentry->d_inode; | 1529 | struct inode *inode = path->dentry->d_inode; |
1524 | struct common_audit_data ad; | 1530 | struct common_audit_data ad; |
1531 | struct selinux_audit_data sad = {0,}; | ||
1525 | 1532 | ||
1526 | COMMON_AUDIT_DATA_INIT(&ad, PATH); | 1533 | COMMON_AUDIT_DATA_INIT(&ad, PATH); |
1527 | ad.u.path = *path; | 1534 | ad.u.path = *path; |
1535 | ad.selinux_audit_data = &sad; | ||
1528 | return inode_has_perm(cred, inode, av, &ad, 0); | 1536 | return inode_has_perm(cred, inode, av, &ad, 0); |
1529 | } | 1537 | } |
1530 | 1538 | ||
@@ -1543,11 +1551,13 @@ static int file_has_perm(const struct cred *cred, | |||
1543 | struct file_security_struct *fsec = file->f_security; | 1551 | struct file_security_struct *fsec = file->f_security; |
1544 | struct inode *inode = file->f_path.dentry->d_inode; | 1552 | struct inode *inode = file->f_path.dentry->d_inode; |
1545 | struct common_audit_data ad; | 1553 | struct common_audit_data ad; |
1554 | struct selinux_audit_data sad = {0,}; | ||
1546 | u32 sid = cred_sid(cred); | 1555 | u32 sid = cred_sid(cred); |
1547 | int rc; | 1556 | int rc; |
1548 | 1557 | ||
1549 | COMMON_AUDIT_DATA_INIT(&ad, PATH); | 1558 | COMMON_AUDIT_DATA_INIT(&ad, PATH); |
1550 | ad.u.path = file->f_path; | 1559 | ad.u.path = file->f_path; |
1560 | ad.selinux_audit_data = &sad; | ||
1551 | 1561 | ||
1552 | if (sid != fsec->sid) { | 1562 | if (sid != fsec->sid) { |
1553 | rc = avc_has_perm(sid, fsec->sid, | 1563 | rc = avc_has_perm(sid, fsec->sid, |
@@ -1577,6 +1587,7 @@ static int may_create(struct inode *dir, | |||
1577 | struct superblock_security_struct *sbsec; | 1587 | struct superblock_security_struct *sbsec; |
1578 | u32 sid, newsid; | 1588 | u32 sid, newsid; |
1579 | struct common_audit_data ad; | 1589 | struct common_audit_data ad; |
1590 | struct selinux_audit_data sad = {0,}; | ||
1580 | int rc; | 1591 | int rc; |
1581 | 1592 | ||
1582 | dsec = dir->i_security; | 1593 | dsec = dir->i_security; |
@@ -1587,6 +1598,7 @@ static int may_create(struct inode *dir, | |||
1587 | 1598 | ||
1588 | COMMON_AUDIT_DATA_INIT(&ad, DENTRY); | 1599 | COMMON_AUDIT_DATA_INIT(&ad, DENTRY); |
1589 | ad.u.dentry = dentry; | 1600 | ad.u.dentry = dentry; |
1601 | ad.selinux_audit_data = &sad; | ||
1590 | 1602 | ||
1591 | rc = avc_has_perm(sid, dsec->sid, SECCLASS_DIR, | 1603 | rc = avc_has_perm(sid, dsec->sid, SECCLASS_DIR, |
1592 | DIR__ADD_NAME | DIR__SEARCH, | 1604 | DIR__ADD_NAME | DIR__SEARCH, |
@@ -1631,6 +1643,7 @@ static int may_link(struct inode *dir, | |||
1631 | { | 1643 | { |
1632 | struct inode_security_struct *dsec, *isec; | 1644 | struct inode_security_struct *dsec, *isec; |
1633 | struct common_audit_data ad; | 1645 | struct common_audit_data ad; |
1646 | struct selinux_audit_data sad = {0,}; | ||
1634 | u32 sid = current_sid(); | 1647 | u32 sid = current_sid(); |
1635 | u32 av; | 1648 | u32 av; |
1636 | int rc; | 1649 | int rc; |
@@ -1640,6 +1653,7 @@ static int may_link(struct inode *dir, | |||
1640 | 1653 | ||
1641 | COMMON_AUDIT_DATA_INIT(&ad, DENTRY); | 1654 | COMMON_AUDIT_DATA_INIT(&ad, DENTRY); |
1642 | ad.u.dentry = dentry; | 1655 | ad.u.dentry = dentry; |
1656 | ad.selinux_audit_data = &sad; | ||
1643 | 1657 | ||
1644 | av = DIR__SEARCH; | 1658 | av = DIR__SEARCH; |
1645 | av |= (kind ? DIR__REMOVE_NAME : DIR__ADD_NAME); | 1659 | av |= (kind ? DIR__REMOVE_NAME : DIR__ADD_NAME); |
@@ -1674,6 +1688,7 @@ static inline int may_rename(struct inode *old_dir, | |||
1674 | { | 1688 | { |
1675 | struct inode_security_struct *old_dsec, *new_dsec, *old_isec, *new_isec; | 1689 | struct inode_security_struct *old_dsec, *new_dsec, *old_isec, *new_isec; |
1676 | struct common_audit_data ad; | 1690 | struct common_audit_data ad; |
1691 | struct selinux_audit_data sad = {0,}; | ||
1677 | u32 sid = current_sid(); | 1692 | u32 sid = current_sid(); |
1678 | u32 av; | 1693 | u32 av; |
1679 | int old_is_dir, new_is_dir; | 1694 | int old_is_dir, new_is_dir; |
@@ -1685,6 +1700,7 @@ static inline int may_rename(struct inode *old_dir, | |||
1685 | new_dsec = new_dir->i_security; | 1700 | new_dsec = new_dir->i_security; |
1686 | 1701 | ||
1687 | COMMON_AUDIT_DATA_INIT(&ad, DENTRY); | 1702 | COMMON_AUDIT_DATA_INIT(&ad, DENTRY); |
1703 | ad.selinux_audit_data = &sad; | ||
1688 | 1704 | ||
1689 | ad.u.dentry = old_dentry; | 1705 | ad.u.dentry = old_dentry; |
1690 | rc = avc_has_perm(sid, old_dsec->sid, SECCLASS_DIR, | 1706 | rc = avc_has_perm(sid, old_dsec->sid, SECCLASS_DIR, |
@@ -1970,6 +1986,7 @@ static int selinux_bprm_set_creds(struct linux_binprm *bprm) | |||
1970 | struct task_security_struct *new_tsec; | 1986 | struct task_security_struct *new_tsec; |
1971 | struct inode_security_struct *isec; | 1987 | struct inode_security_struct *isec; |
1972 | struct common_audit_data ad; | 1988 | struct common_audit_data ad; |
1989 | struct selinux_audit_data sad = {0,}; | ||
1973 | struct inode *inode = bprm->file->f_path.dentry->d_inode; | 1990 | struct inode *inode = bprm->file->f_path.dentry->d_inode; |
1974 | int rc; | 1991 | int rc; |
1975 | 1992 | ||
@@ -2009,6 +2026,7 @@ static int selinux_bprm_set_creds(struct linux_binprm *bprm) | |||
2009 | } | 2026 | } |
2010 | 2027 | ||
2011 | COMMON_AUDIT_DATA_INIT(&ad, PATH); | 2028 | COMMON_AUDIT_DATA_INIT(&ad, PATH); |
2029 | ad.selinux_audit_data = &sad; | ||
2012 | ad.u.path = bprm->file->f_path; | 2030 | ad.u.path = bprm->file->f_path; |
2013 | 2031 | ||
2014 | if (bprm->file->f_path.mnt->mnt_flags & MNT_NOSUID) | 2032 | if (bprm->file->f_path.mnt->mnt_flags & MNT_NOSUID) |
@@ -2098,6 +2116,7 @@ static inline void flush_unauthorized_files(const struct cred *cred, | |||
2098 | struct files_struct *files) | 2116 | struct files_struct *files) |
2099 | { | 2117 | { |
2100 | struct common_audit_data ad; | 2118 | struct common_audit_data ad; |
2119 | struct selinux_audit_data sad = {0,}; | ||
2101 | struct file *file, *devnull = NULL; | 2120 | struct file *file, *devnull = NULL; |
2102 | struct tty_struct *tty; | 2121 | struct tty_struct *tty; |
2103 | struct fdtable *fdt; | 2122 | struct fdtable *fdt; |
@@ -2135,6 +2154,7 @@ static inline void flush_unauthorized_files(const struct cred *cred, | |||
2135 | /* Revalidate access to inherited open files. */ | 2154 | /* Revalidate access to inherited open files. */ |
2136 | 2155 | ||
2137 | COMMON_AUDIT_DATA_INIT(&ad, INODE); | 2156 | COMMON_AUDIT_DATA_INIT(&ad, INODE); |
2157 | ad.selinux_audit_data = &sad; | ||
2138 | 2158 | ||
2139 | spin_lock(&files->file_lock); | 2159 | spin_lock(&files->file_lock); |
2140 | for (;;) { | 2160 | for (;;) { |
@@ -2472,6 +2492,7 @@ static int selinux_sb_kern_mount(struct super_block *sb, int flags, void *data) | |||
2472 | { | 2492 | { |
2473 | const struct cred *cred = current_cred(); | 2493 | const struct cred *cred = current_cred(); |
2474 | struct common_audit_data ad; | 2494 | struct common_audit_data ad; |
2495 | struct selinux_audit_data sad = {0,}; | ||
2475 | int rc; | 2496 | int rc; |
2476 | 2497 | ||
2477 | rc = superblock_doinit(sb, data); | 2498 | rc = superblock_doinit(sb, data); |
@@ -2483,6 +2504,7 @@ static int selinux_sb_kern_mount(struct super_block *sb, int flags, void *data) | |||
2483 | return 0; | 2504 | return 0; |
2484 | 2505 | ||
2485 | COMMON_AUDIT_DATA_INIT(&ad, DENTRY); | 2506 | COMMON_AUDIT_DATA_INIT(&ad, DENTRY); |
2507 | ad.selinux_audit_data = &sad; | ||
2486 | ad.u.dentry = sb->s_root; | 2508 | ad.u.dentry = sb->s_root; |
2487 | return superblock_has_perm(cred, sb, FILESYSTEM__MOUNT, &ad); | 2509 | return superblock_has_perm(cred, sb, FILESYSTEM__MOUNT, &ad); |
2488 | } | 2510 | } |
@@ -2491,8 +2513,10 @@ static int selinux_sb_statfs(struct dentry *dentry) | |||
2491 | { | 2513 | { |
2492 | const struct cred *cred = current_cred(); | 2514 | const struct cred *cred = current_cred(); |
2493 | struct common_audit_data ad; | 2515 | struct common_audit_data ad; |
2516 | struct selinux_audit_data sad = {0,}; | ||
2494 | 2517 | ||
2495 | COMMON_AUDIT_DATA_INIT(&ad, DENTRY); | 2518 | COMMON_AUDIT_DATA_INIT(&ad, DENTRY); |
2519 | ad.selinux_audit_data = &sad; | ||
2496 | ad.u.dentry = dentry->d_sb->s_root; | 2520 | ad.u.dentry = dentry->d_sb->s_root; |
2497 | return superblock_has_perm(cred, dentry->d_sb, FILESYSTEM__GETATTR, &ad); | 2521 | return superblock_has_perm(cred, dentry->d_sb, FILESYSTEM__GETATTR, &ad); |
2498 | } | 2522 | } |
@@ -2656,6 +2680,7 @@ static int selinux_inode_permission(struct inode *inode, int mask) | |||
2656 | { | 2680 | { |
2657 | const struct cred *cred = current_cred(); | 2681 | const struct cred *cred = current_cred(); |
2658 | struct common_audit_data ad; | 2682 | struct common_audit_data ad; |
2683 | struct selinux_audit_data sad = {0,}; | ||
2659 | u32 perms; | 2684 | u32 perms; |
2660 | bool from_access; | 2685 | bool from_access; |
2661 | unsigned flags = mask & MAY_NOT_BLOCK; | 2686 | unsigned flags = mask & MAY_NOT_BLOCK; |
@@ -2668,10 +2693,11 @@ static int selinux_inode_permission(struct inode *inode, int mask) | |||
2668 | return 0; | 2693 | return 0; |
2669 | 2694 | ||
2670 | COMMON_AUDIT_DATA_INIT(&ad, INODE); | 2695 | COMMON_AUDIT_DATA_INIT(&ad, INODE); |
2696 | ad.selinux_audit_data = &sad; | ||
2671 | ad.u.inode = inode; | 2697 | ad.u.inode = inode; |
2672 | 2698 | ||
2673 | if (from_access) | 2699 | if (from_access) |
2674 | ad.selinux_audit_data.auditdeny |= FILE__AUDIT_ACCESS; | 2700 | ad.selinux_audit_data->auditdeny |= FILE__AUDIT_ACCESS; |
2675 | 2701 | ||
2676 | perms = file_mask_to_av(inode->i_mode, mask); | 2702 | perms = file_mask_to_av(inode->i_mode, mask); |
2677 | 2703 | ||
@@ -2737,6 +2763,7 @@ static int selinux_inode_setxattr(struct dentry *dentry, const char *name, | |||
2737 | struct inode_security_struct *isec = inode->i_security; | 2763 | struct inode_security_struct *isec = inode->i_security; |
2738 | struct superblock_security_struct *sbsec; | 2764 | struct superblock_security_struct *sbsec; |
2739 | struct common_audit_data ad; | 2765 | struct common_audit_data ad; |
2766 | struct selinux_audit_data sad = {0,}; | ||
2740 | u32 newsid, sid = current_sid(); | 2767 | u32 newsid, sid = current_sid(); |
2741 | int rc = 0; | 2768 | int rc = 0; |
2742 | 2769 | ||
@@ -2751,6 +2778,7 @@ static int selinux_inode_setxattr(struct dentry *dentry, const char *name, | |||
2751 | return -EPERM; | 2778 | return -EPERM; |
2752 | 2779 | ||
2753 | COMMON_AUDIT_DATA_INIT(&ad, DENTRY); | 2780 | COMMON_AUDIT_DATA_INIT(&ad, DENTRY); |
2781 | ad.selinux_audit_data = &sad; | ||
2754 | ad.u.dentry = dentry; | 2782 | ad.u.dentry = dentry; |
2755 | 2783 | ||
2756 | rc = avc_has_perm(sid, isec->sid, isec->sclass, | 2784 | rc = avc_has_perm(sid, isec->sid, isec->sclass, |
@@ -3345,10 +3373,12 @@ static int selinux_kernel_module_request(char *kmod_name) | |||
3345 | { | 3373 | { |
3346 | u32 sid; | 3374 | u32 sid; |
3347 | struct common_audit_data ad; | 3375 | struct common_audit_data ad; |
3376 | struct selinux_audit_data sad = {0,}; | ||
3348 | 3377 | ||
3349 | sid = task_sid(current); | 3378 | sid = task_sid(current); |
3350 | 3379 | ||
3351 | COMMON_AUDIT_DATA_INIT(&ad, KMOD); | 3380 | COMMON_AUDIT_DATA_INIT(&ad, KMOD); |
3381 | ad.selinux_audit_data = &sad; | ||
3352 | ad.u.kmod_name = kmod_name; | 3382 | ad.u.kmod_name = kmod_name; |
3353 | 3383 | ||
3354 | return avc_has_perm(sid, SECINITSID_KERNEL, SECCLASS_SYSTEM, | 3384 | return avc_has_perm(sid, SECINITSID_KERNEL, SECCLASS_SYSTEM, |
@@ -3487,8 +3517,8 @@ static int selinux_parse_skb_ipv4(struct sk_buff *skb, | |||
3487 | if (ihlen < sizeof(_iph)) | 3517 | if (ihlen < sizeof(_iph)) |
3488 | goto out; | 3518 | goto out; |
3489 | 3519 | ||
3490 | ad->u.net.v4info.saddr = ih->saddr; | 3520 | ad->u.net->v4info.saddr = ih->saddr; |
3491 | ad->u.net.v4info.daddr = ih->daddr; | 3521 | ad->u.net->v4info.daddr = ih->daddr; |
3492 | ret = 0; | 3522 | ret = 0; |
3493 | 3523 | ||
3494 | if (proto) | 3524 | if (proto) |
@@ -3506,8 +3536,8 @@ static int selinux_parse_skb_ipv4(struct sk_buff *skb, | |||
3506 | if (th == NULL) | 3536 | if (th == NULL) |
3507 | break; | 3537 | break; |
3508 | 3538 | ||
3509 | ad->u.net.sport = th->source; | 3539 | ad->u.net->sport = th->source; |
3510 | ad->u.net.dport = th->dest; | 3540 | ad->u.net->dport = th->dest; |
3511 | break; | 3541 | break; |
3512 | } | 3542 | } |
3513 | 3543 | ||
@@ -3522,8 +3552,8 @@ static int selinux_parse_skb_ipv4(struct sk_buff *skb, | |||
3522 | if (uh == NULL) | 3552 | if (uh == NULL) |
3523 | break; | 3553 | break; |
3524 | 3554 | ||
3525 | ad->u.net.sport = uh->source; | 3555 | ad->u.net->sport = uh->source; |
3526 | ad->u.net.dport = uh->dest; | 3556 | ad->u.net->dport = uh->dest; |
3527 | break; | 3557 | break; |
3528 | } | 3558 | } |
3529 | 3559 | ||
@@ -3538,8 +3568,8 @@ static int selinux_parse_skb_ipv4(struct sk_buff *skb, | |||
3538 | if (dh == NULL) | 3568 | if (dh == NULL) |
3539 | break; | 3569 | break; |
3540 | 3570 | ||
3541 | ad->u.net.sport = dh->dccph_sport; | 3571 | ad->u.net->sport = dh->dccph_sport; |
3542 | ad->u.net.dport = dh->dccph_dport; | 3572 | ad->u.net->dport = dh->dccph_dport; |
3543 | break; | 3573 | break; |
3544 | } | 3574 | } |
3545 | 3575 | ||
@@ -3566,8 +3596,8 @@ static int selinux_parse_skb_ipv6(struct sk_buff *skb, | |||
3566 | if (ip6 == NULL) | 3596 | if (ip6 == NULL) |
3567 | goto out; | 3597 | goto out; |
3568 | 3598 | ||
3569 | ad->u.net.v6info.saddr = ip6->saddr; | 3599 | ad->u.net->v6info.saddr = ip6->saddr; |
3570 | ad->u.net.v6info.daddr = ip6->daddr; | 3600 | ad->u.net->v6info.daddr = ip6->daddr; |
3571 | ret = 0; | 3601 | ret = 0; |
3572 | 3602 | ||
3573 | nexthdr = ip6->nexthdr; | 3603 | nexthdr = ip6->nexthdr; |
@@ -3587,8 +3617,8 @@ static int selinux_parse_skb_ipv6(struct sk_buff *skb, | |||
3587 | if (th == NULL) | 3617 | if (th == NULL) |
3588 | break; | 3618 | break; |
3589 | 3619 | ||
3590 | ad->u.net.sport = th->source; | 3620 | ad->u.net->sport = th->source; |
3591 | ad->u.net.dport = th->dest; | 3621 | ad->u.net->dport = th->dest; |
3592 | break; | 3622 | break; |
3593 | } | 3623 | } |
3594 | 3624 | ||
@@ -3599,8 +3629,8 @@ static int selinux_parse_skb_ipv6(struct sk_buff *skb, | |||
3599 | if (uh == NULL) | 3629 | if (uh == NULL) |
3600 | break; | 3630 | break; |
3601 | 3631 | ||
3602 | ad->u.net.sport = uh->source; | 3632 | ad->u.net->sport = uh->source; |
3603 | ad->u.net.dport = uh->dest; | 3633 | ad->u.net->dport = uh->dest; |
3604 | break; | 3634 | break; |
3605 | } | 3635 | } |
3606 | 3636 | ||
@@ -3611,8 +3641,8 @@ static int selinux_parse_skb_ipv6(struct sk_buff *skb, | |||
3611 | if (dh == NULL) | 3641 | if (dh == NULL) |
3612 | break; | 3642 | break; |
3613 | 3643 | ||
3614 | ad->u.net.sport = dh->dccph_sport; | 3644 | ad->u.net->sport = dh->dccph_sport; |
3615 | ad->u.net.dport = dh->dccph_dport; | 3645 | ad->u.net->dport = dh->dccph_dport; |
3616 | break; | 3646 | break; |
3617 | } | 3647 | } |
3618 | 3648 | ||
@@ -3632,13 +3662,13 @@ static int selinux_parse_skb(struct sk_buff *skb, struct common_audit_data *ad, | |||
3632 | char *addrp; | 3662 | char *addrp; |
3633 | int ret; | 3663 | int ret; |
3634 | 3664 | ||
3635 | switch (ad->u.net.family) { | 3665 | switch (ad->u.net->family) { |
3636 | case PF_INET: | 3666 | case PF_INET: |
3637 | ret = selinux_parse_skb_ipv4(skb, ad, proto); | 3667 | ret = selinux_parse_skb_ipv4(skb, ad, proto); |
3638 | if (ret) | 3668 | if (ret) |
3639 | goto parse_error; | 3669 | goto parse_error; |
3640 | addrp = (char *)(src ? &ad->u.net.v4info.saddr : | 3670 | addrp = (char *)(src ? &ad->u.net->v4info.saddr : |
3641 | &ad->u.net.v4info.daddr); | 3671 | &ad->u.net->v4info.daddr); |
3642 | goto okay; | 3672 | goto okay; |
3643 | 3673 | ||
3644 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) | 3674 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) |
@@ -3646,8 +3676,8 @@ static int selinux_parse_skb(struct sk_buff *skb, struct common_audit_data *ad, | |||
3646 | ret = selinux_parse_skb_ipv6(skb, ad, proto); | 3676 | ret = selinux_parse_skb_ipv6(skb, ad, proto); |
3647 | if (ret) | 3677 | if (ret) |
3648 | goto parse_error; | 3678 | goto parse_error; |
3649 | addrp = (char *)(src ? &ad->u.net.v6info.saddr : | 3679 | addrp = (char *)(src ? &ad->u.net->v6info.saddr : |
3650 | &ad->u.net.v6info.daddr); | 3680 | &ad->u.net->v6info.daddr); |
3651 | goto okay; | 3681 | goto okay; |
3652 | #endif /* IPV6 */ | 3682 | #endif /* IPV6 */ |
3653 | default: | 3683 | default: |
@@ -3721,13 +3751,17 @@ static int sock_has_perm(struct task_struct *task, struct sock *sk, u32 perms) | |||
3721 | { | 3751 | { |
3722 | struct sk_security_struct *sksec = sk->sk_security; | 3752 | struct sk_security_struct *sksec = sk->sk_security; |
3723 | struct common_audit_data ad; | 3753 | struct common_audit_data ad; |
3754 | struct selinux_audit_data sad = {0,}; | ||
3755 | struct lsm_network_audit net = {0,}; | ||
3724 | u32 tsid = task_sid(task); | 3756 | u32 tsid = task_sid(task); |
3725 | 3757 | ||
3726 | if (sksec->sid == SECINITSID_KERNEL) | 3758 | if (sksec->sid == SECINITSID_KERNEL) |
3727 | return 0; | 3759 | return 0; |
3728 | 3760 | ||
3729 | COMMON_AUDIT_DATA_INIT(&ad, NET); | 3761 | COMMON_AUDIT_DATA_INIT(&ad, NET); |
3730 | ad.u.net.sk = sk; | 3762 | ad.selinux_audit_data = &sad; |
3763 | ad.u.net = &net; | ||
3764 | ad.u.net->sk = sk; | ||
3731 | 3765 | ||
3732 | return avc_has_perm(tsid, sksec->sid, sksec->sclass, perms, &ad); | 3766 | return avc_has_perm(tsid, sksec->sid, sksec->sclass, perms, &ad); |
3733 | } | 3767 | } |
@@ -3805,6 +3839,8 @@ static int selinux_socket_bind(struct socket *sock, struct sockaddr *address, in | |||
3805 | char *addrp; | 3839 | char *addrp; |
3806 | struct sk_security_struct *sksec = sk->sk_security; | 3840 | struct sk_security_struct *sksec = sk->sk_security; |
3807 | struct common_audit_data ad; | 3841 | struct common_audit_data ad; |
3842 | struct selinux_audit_data sad = {0,}; | ||
3843 | struct lsm_network_audit net = {0,}; | ||
3808 | struct sockaddr_in *addr4 = NULL; | 3844 | struct sockaddr_in *addr4 = NULL; |
3809 | struct sockaddr_in6 *addr6 = NULL; | 3845 | struct sockaddr_in6 *addr6 = NULL; |
3810 | unsigned short snum; | 3846 | unsigned short snum; |
@@ -3831,8 +3867,10 @@ static int selinux_socket_bind(struct socket *sock, struct sockaddr *address, in | |||
3831 | if (err) | 3867 | if (err) |
3832 | goto out; | 3868 | goto out; |
3833 | COMMON_AUDIT_DATA_INIT(&ad, NET); | 3869 | COMMON_AUDIT_DATA_INIT(&ad, NET); |
3834 | ad.u.net.sport = htons(snum); | 3870 | ad.selinux_audit_data = &sad; |
3835 | ad.u.net.family = family; | 3871 | ad.u.net = &net; |
3872 | ad.u.net->sport = htons(snum); | ||
3873 | ad.u.net->family = family; | ||
3836 | err = avc_has_perm(sksec->sid, sid, | 3874 | err = avc_has_perm(sksec->sid, sid, |
3837 | sksec->sclass, | 3875 | sksec->sclass, |
3838 | SOCKET__NAME_BIND, &ad); | 3876 | SOCKET__NAME_BIND, &ad); |
@@ -3864,13 +3902,15 @@ static int selinux_socket_bind(struct socket *sock, struct sockaddr *address, in | |||
3864 | goto out; | 3902 | goto out; |
3865 | 3903 | ||
3866 | COMMON_AUDIT_DATA_INIT(&ad, NET); | 3904 | COMMON_AUDIT_DATA_INIT(&ad, NET); |
3867 | ad.u.net.sport = htons(snum); | 3905 | ad.selinux_audit_data = &sad; |
3868 | ad.u.net.family = family; | 3906 | ad.u.net = &net; |
3907 | ad.u.net->sport = htons(snum); | ||
3908 | ad.u.net->family = family; | ||
3869 | 3909 | ||
3870 | if (family == PF_INET) | 3910 | if (family == PF_INET) |
3871 | ad.u.net.v4info.saddr = addr4->sin_addr.s_addr; | 3911 | ad.u.net->v4info.saddr = addr4->sin_addr.s_addr; |
3872 | else | 3912 | else |
3873 | ad.u.net.v6info.saddr = addr6->sin6_addr; | 3913 | ad.u.net->v6info.saddr = addr6->sin6_addr; |
3874 | 3914 | ||
3875 | err = avc_has_perm(sksec->sid, sid, | 3915 | err = avc_has_perm(sksec->sid, sid, |
3876 | sksec->sclass, node_perm, &ad); | 3916 | sksec->sclass, node_perm, &ad); |
@@ -3897,6 +3937,8 @@ static int selinux_socket_connect(struct socket *sock, struct sockaddr *address, | |||
3897 | if (sksec->sclass == SECCLASS_TCP_SOCKET || | 3937 | if (sksec->sclass == SECCLASS_TCP_SOCKET || |
3898 | sksec->sclass == SECCLASS_DCCP_SOCKET) { | 3938 | sksec->sclass == SECCLASS_DCCP_SOCKET) { |
3899 | struct common_audit_data ad; | 3939 | struct common_audit_data ad; |
3940 | struct selinux_audit_data sad = {0,}; | ||
3941 | struct lsm_network_audit net = {0,}; | ||
3900 | struct sockaddr_in *addr4 = NULL; | 3942 | struct sockaddr_in *addr4 = NULL; |
3901 | struct sockaddr_in6 *addr6 = NULL; | 3943 | struct sockaddr_in6 *addr6 = NULL; |
3902 | unsigned short snum; | 3944 | unsigned short snum; |
@@ -3922,8 +3964,10 @@ static int selinux_socket_connect(struct socket *sock, struct sockaddr *address, | |||
3922 | TCP_SOCKET__NAME_CONNECT : DCCP_SOCKET__NAME_CONNECT; | 3964 | TCP_SOCKET__NAME_CONNECT : DCCP_SOCKET__NAME_CONNECT; |
3923 | 3965 | ||
3924 | COMMON_AUDIT_DATA_INIT(&ad, NET); | 3966 | COMMON_AUDIT_DATA_INIT(&ad, NET); |
3925 | ad.u.net.dport = htons(snum); | 3967 | ad.selinux_audit_data = &sad; |
3926 | ad.u.net.family = sk->sk_family; | 3968 | ad.u.net = &net; |
3969 | ad.u.net->dport = htons(snum); | ||
3970 | ad.u.net->family = sk->sk_family; | ||
3927 | err = avc_has_perm(sksec->sid, sid, sksec->sclass, perm, &ad); | 3971 | err = avc_has_perm(sksec->sid, sid, sksec->sclass, perm, &ad); |
3928 | if (err) | 3972 | if (err) |
3929 | goto out; | 3973 | goto out; |
@@ -4012,10 +4056,14 @@ static int selinux_socket_unix_stream_connect(struct sock *sock, | |||
4012 | struct sk_security_struct *sksec_other = other->sk_security; | 4056 | struct sk_security_struct *sksec_other = other->sk_security; |
4013 | struct sk_security_struct *sksec_new = newsk->sk_security; | 4057 | struct sk_security_struct *sksec_new = newsk->sk_security; |
4014 | struct common_audit_data ad; | 4058 | struct common_audit_data ad; |
4059 | struct selinux_audit_data sad = {0,}; | ||
4060 | struct lsm_network_audit net = {0,}; | ||
4015 | int err; | 4061 | int err; |
4016 | 4062 | ||
4017 | COMMON_AUDIT_DATA_INIT(&ad, NET); | 4063 | COMMON_AUDIT_DATA_INIT(&ad, NET); |
4018 | ad.u.net.sk = other; | 4064 | ad.selinux_audit_data = &sad; |
4065 | ad.u.net = &net; | ||
4066 | ad.u.net->sk = other; | ||
4019 | 4067 | ||
4020 | err = avc_has_perm(sksec_sock->sid, sksec_other->sid, | 4068 | err = avc_has_perm(sksec_sock->sid, sksec_other->sid, |
4021 | sksec_other->sclass, | 4069 | sksec_other->sclass, |
@@ -4042,9 +4090,13 @@ static int selinux_socket_unix_may_send(struct socket *sock, | |||
4042 | struct sk_security_struct *ssec = sock->sk->sk_security; | 4090 | struct sk_security_struct *ssec = sock->sk->sk_security; |
4043 | struct sk_security_struct *osec = other->sk->sk_security; | 4091 | struct sk_security_struct *osec = other->sk->sk_security; |
4044 | struct common_audit_data ad; | 4092 | struct common_audit_data ad; |
4093 | struct selinux_audit_data sad = {0,}; | ||
4094 | struct lsm_network_audit net = {0,}; | ||
4045 | 4095 | ||
4046 | COMMON_AUDIT_DATA_INIT(&ad, NET); | 4096 | COMMON_AUDIT_DATA_INIT(&ad, NET); |
4047 | ad.u.net.sk = other->sk; | 4097 | ad.selinux_audit_data = &sad; |
4098 | ad.u.net = &net; | ||
4099 | ad.u.net->sk = other->sk; | ||
4048 | 4100 | ||
4049 | return avc_has_perm(ssec->sid, osec->sid, osec->sclass, SOCKET__SENDTO, | 4101 | return avc_has_perm(ssec->sid, osec->sid, osec->sclass, SOCKET__SENDTO, |
4050 | &ad); | 4102 | &ad); |
@@ -4080,11 +4132,15 @@ static int selinux_sock_rcv_skb_compat(struct sock *sk, struct sk_buff *skb, | |||
4080 | struct sk_security_struct *sksec = sk->sk_security; | 4132 | struct sk_security_struct *sksec = sk->sk_security; |
4081 | u32 sk_sid = sksec->sid; | 4133 | u32 sk_sid = sksec->sid; |
4082 | struct common_audit_data ad; | 4134 | struct common_audit_data ad; |
4135 | struct selinux_audit_data sad = {0,}; | ||
4136 | struct lsm_network_audit net = {0,}; | ||
4083 | char *addrp; | 4137 | char *addrp; |
4084 | 4138 | ||
4085 | COMMON_AUDIT_DATA_INIT(&ad, NET); | 4139 | COMMON_AUDIT_DATA_INIT(&ad, NET); |
4086 | ad.u.net.netif = skb->skb_iif; | 4140 | ad.selinux_audit_data = &sad; |
4087 | ad.u.net.family = family; | 4141 | ad.u.net = &net; |
4142 | ad.u.net->netif = skb->skb_iif; | ||
4143 | ad.u.net->family = family; | ||
4088 | err = selinux_parse_skb(skb, &ad, &addrp, 1, NULL); | 4144 | err = selinux_parse_skb(skb, &ad, &addrp, 1, NULL); |
4089 | if (err) | 4145 | if (err) |
4090 | return err; | 4146 | return err; |
@@ -4111,6 +4167,8 @@ static int selinux_socket_sock_rcv_skb(struct sock *sk, struct sk_buff *skb) | |||
4111 | u16 family = sk->sk_family; | 4167 | u16 family = sk->sk_family; |
4112 | u32 sk_sid = sksec->sid; | 4168 | u32 sk_sid = sksec->sid; |
4113 | struct common_audit_data ad; | 4169 | struct common_audit_data ad; |
4170 | struct selinux_audit_data sad = {0,}; | ||
4171 | struct lsm_network_audit net = {0,}; | ||
4114 | char *addrp; | 4172 | char *addrp; |
4115 | u8 secmark_active; | 4173 | u8 secmark_active; |
4116 | u8 peerlbl_active; | 4174 | u8 peerlbl_active; |
@@ -4135,8 +4193,10 @@ static int selinux_socket_sock_rcv_skb(struct sock *sk, struct sk_buff *skb) | |||
4135 | return 0; | 4193 | return 0; |
4136 | 4194 | ||
4137 | COMMON_AUDIT_DATA_INIT(&ad, NET); | 4195 | COMMON_AUDIT_DATA_INIT(&ad, NET); |
4138 | ad.u.net.netif = skb->skb_iif; | 4196 | ad.selinux_audit_data = &sad; |
4139 | ad.u.net.family = family; | 4197 | ad.u.net = &net; |
4198 | ad.u.net->netif = skb->skb_iif; | ||
4199 | ad.u.net->family = family; | ||
4140 | err = selinux_parse_skb(skb, &ad, &addrp, 1, NULL); | 4200 | err = selinux_parse_skb(skb, &ad, &addrp, 1, NULL); |
4141 | if (err) | 4201 | if (err) |
4142 | return err; | 4202 | return err; |
@@ -4471,6 +4531,8 @@ static unsigned int selinux_ip_forward(struct sk_buff *skb, int ifindex, | |||
4471 | char *addrp; | 4531 | char *addrp; |
4472 | u32 peer_sid; | 4532 | u32 peer_sid; |
4473 | struct common_audit_data ad; | 4533 | struct common_audit_data ad; |
4534 | struct selinux_audit_data sad = {0,}; | ||
4535 | struct lsm_network_audit net = {0,}; | ||
4474 | u8 secmark_active; | 4536 | u8 secmark_active; |
4475 | u8 netlbl_active; | 4537 | u8 netlbl_active; |
4476 | u8 peerlbl_active; | 4538 | u8 peerlbl_active; |
@@ -4488,8 +4550,10 @@ static unsigned int selinux_ip_forward(struct sk_buff *skb, int ifindex, | |||
4488 | return NF_DROP; | 4550 | return NF_DROP; |
4489 | 4551 | ||
4490 | COMMON_AUDIT_DATA_INIT(&ad, NET); | 4552 | COMMON_AUDIT_DATA_INIT(&ad, NET); |
4491 | ad.u.net.netif = ifindex; | 4553 | ad.selinux_audit_data = &sad; |
4492 | ad.u.net.family = family; | 4554 | ad.u.net = &net; |
4555 | ad.u.net->netif = ifindex; | ||
4556 | ad.u.net->family = family; | ||
4493 | if (selinux_parse_skb(skb, &ad, &addrp, 1, NULL) != 0) | 4557 | if (selinux_parse_skb(skb, &ad, &addrp, 1, NULL) != 0) |
4494 | return NF_DROP; | 4558 | return NF_DROP; |
4495 | 4559 | ||
@@ -4576,6 +4640,8 @@ static unsigned int selinux_ip_postroute_compat(struct sk_buff *skb, | |||
4576 | struct sock *sk = skb->sk; | 4640 | struct sock *sk = skb->sk; |
4577 | struct sk_security_struct *sksec; | 4641 | struct sk_security_struct *sksec; |
4578 | struct common_audit_data ad; | 4642 | struct common_audit_data ad; |
4643 | struct selinux_audit_data sad = {0,}; | ||
4644 | struct lsm_network_audit net = {0,}; | ||
4579 | char *addrp; | 4645 | char *addrp; |
4580 | u8 proto; | 4646 | u8 proto; |
4581 | 4647 | ||
@@ -4584,8 +4650,10 @@ static unsigned int selinux_ip_postroute_compat(struct sk_buff *skb, | |||
4584 | sksec = sk->sk_security; | 4650 | sksec = sk->sk_security; |
4585 | 4651 | ||
4586 | COMMON_AUDIT_DATA_INIT(&ad, NET); | 4652 | COMMON_AUDIT_DATA_INIT(&ad, NET); |
4587 | ad.u.net.netif = ifindex; | 4653 | ad.selinux_audit_data = &sad; |
4588 | ad.u.net.family = family; | 4654 | ad.u.net = &net; |
4655 | ad.u.net->netif = ifindex; | ||
4656 | ad.u.net->family = family; | ||
4589 | if (selinux_parse_skb(skb, &ad, &addrp, 0, &proto)) | 4657 | if (selinux_parse_skb(skb, &ad, &addrp, 0, &proto)) |
4590 | return NF_DROP; | 4658 | return NF_DROP; |
4591 | 4659 | ||
@@ -4607,6 +4675,8 @@ static unsigned int selinux_ip_postroute(struct sk_buff *skb, int ifindex, | |||
4607 | u32 peer_sid; | 4675 | u32 peer_sid; |
4608 | struct sock *sk; | 4676 | struct sock *sk; |
4609 | struct common_audit_data ad; | 4677 | struct common_audit_data ad; |
4678 | struct selinux_audit_data sad = {0,}; | ||
4679 | struct lsm_network_audit net = {0,}; | ||
4610 | char *addrp; | 4680 | char *addrp; |
4611 | u8 secmark_active; | 4681 | u8 secmark_active; |
4612 | u8 peerlbl_active; | 4682 | u8 peerlbl_active; |
@@ -4653,8 +4723,10 @@ static unsigned int selinux_ip_postroute(struct sk_buff *skb, int ifindex, | |||
4653 | } | 4723 | } |
4654 | 4724 | ||
4655 | COMMON_AUDIT_DATA_INIT(&ad, NET); | 4725 | COMMON_AUDIT_DATA_INIT(&ad, NET); |
4656 | ad.u.net.netif = ifindex; | 4726 | ad.selinux_audit_data = &sad; |
4657 | ad.u.net.family = family; | 4727 | ad.u.net = &net; |
4728 | ad.u.net->netif = ifindex; | ||
4729 | ad.u.net->family = family; | ||
4658 | if (selinux_parse_skb(skb, &ad, &addrp, 0, NULL)) | 4730 | if (selinux_parse_skb(skb, &ad, &addrp, 0, NULL)) |
4659 | return NF_DROP; | 4731 | return NF_DROP; |
4660 | 4732 | ||
@@ -4769,11 +4841,13 @@ static int ipc_has_perm(struct kern_ipc_perm *ipc_perms, | |||
4769 | { | 4841 | { |
4770 | struct ipc_security_struct *isec; | 4842 | struct ipc_security_struct *isec; |
4771 | struct common_audit_data ad; | 4843 | struct common_audit_data ad; |
4844 | struct selinux_audit_data sad = {0,}; | ||
4772 | u32 sid = current_sid(); | 4845 | u32 sid = current_sid(); |
4773 | 4846 | ||
4774 | isec = ipc_perms->security; | 4847 | isec = ipc_perms->security; |
4775 | 4848 | ||
4776 | COMMON_AUDIT_DATA_INIT(&ad, IPC); | 4849 | COMMON_AUDIT_DATA_INIT(&ad, IPC); |
4850 | ad.selinux_audit_data = &sad; | ||
4777 | ad.u.ipc_id = ipc_perms->key; | 4851 | ad.u.ipc_id = ipc_perms->key; |
4778 | 4852 | ||
4779 | return avc_has_perm(sid, isec->sid, isec->sclass, perms, &ad); | 4853 | return avc_has_perm(sid, isec->sid, isec->sclass, perms, &ad); |
@@ -4794,6 +4868,7 @@ static int selinux_msg_queue_alloc_security(struct msg_queue *msq) | |||
4794 | { | 4868 | { |
4795 | struct ipc_security_struct *isec; | 4869 | struct ipc_security_struct *isec; |
4796 | struct common_audit_data ad; | 4870 | struct common_audit_data ad; |
4871 | struct selinux_audit_data sad = {0,}; | ||
4797 | u32 sid = current_sid(); | 4872 | u32 sid = current_sid(); |
4798 | int rc; | 4873 | int rc; |
4799 | 4874 | ||
@@ -4804,6 +4879,7 @@ static int selinux_msg_queue_alloc_security(struct msg_queue *msq) | |||
4804 | isec = msq->q_perm.security; | 4879 | isec = msq->q_perm.security; |
4805 | 4880 | ||
4806 | COMMON_AUDIT_DATA_INIT(&ad, IPC); | 4881 | COMMON_AUDIT_DATA_INIT(&ad, IPC); |
4882 | ad.selinux_audit_data = &sad; | ||
4807 | ad.u.ipc_id = msq->q_perm.key; | 4883 | ad.u.ipc_id = msq->q_perm.key; |
4808 | 4884 | ||
4809 | rc = avc_has_perm(sid, isec->sid, SECCLASS_MSGQ, | 4885 | rc = avc_has_perm(sid, isec->sid, SECCLASS_MSGQ, |
@@ -4824,11 +4900,13 @@ static int selinux_msg_queue_associate(struct msg_queue *msq, int msqflg) | |||
4824 | { | 4900 | { |
4825 | struct ipc_security_struct *isec; | 4901 | struct ipc_security_struct *isec; |
4826 | struct common_audit_data ad; | 4902 | struct common_audit_data ad; |
4903 | struct selinux_audit_data sad = {0,}; | ||
4827 | u32 sid = current_sid(); | 4904 | u32 sid = current_sid(); |
4828 | 4905 | ||
4829 | isec = msq->q_perm.security; | 4906 | isec = msq->q_perm.security; |
4830 | 4907 | ||
4831 | COMMON_AUDIT_DATA_INIT(&ad, IPC); | 4908 | COMMON_AUDIT_DATA_INIT(&ad, IPC); |
4909 | ad.selinux_audit_data = &sad; | ||
4832 | ad.u.ipc_id = msq->q_perm.key; | 4910 | ad.u.ipc_id = msq->q_perm.key; |
4833 | 4911 | ||
4834 | return avc_has_perm(sid, isec->sid, SECCLASS_MSGQ, | 4912 | return avc_has_perm(sid, isec->sid, SECCLASS_MSGQ, |
@@ -4868,6 +4946,7 @@ static int selinux_msg_queue_msgsnd(struct msg_queue *msq, struct msg_msg *msg, | |||
4868 | struct ipc_security_struct *isec; | 4946 | struct ipc_security_struct *isec; |
4869 | struct msg_security_struct *msec; | 4947 | struct msg_security_struct *msec; |
4870 | struct common_audit_data ad; | 4948 | struct common_audit_data ad; |
4949 | struct selinux_audit_data sad = {0,}; | ||
4871 | u32 sid = current_sid(); | 4950 | u32 sid = current_sid(); |
4872 | int rc; | 4951 | int rc; |
4873 | 4952 | ||
@@ -4889,6 +4968,7 @@ static int selinux_msg_queue_msgsnd(struct msg_queue *msq, struct msg_msg *msg, | |||
4889 | } | 4968 | } |
4890 | 4969 | ||
4891 | COMMON_AUDIT_DATA_INIT(&ad, IPC); | 4970 | COMMON_AUDIT_DATA_INIT(&ad, IPC); |
4971 | ad.selinux_audit_data = &sad; | ||
4892 | ad.u.ipc_id = msq->q_perm.key; | 4972 | ad.u.ipc_id = msq->q_perm.key; |
4893 | 4973 | ||
4894 | /* Can this process write to the queue? */ | 4974 | /* Can this process write to the queue? */ |
@@ -4913,6 +4993,7 @@ static int selinux_msg_queue_msgrcv(struct msg_queue *msq, struct msg_msg *msg, | |||
4913 | struct ipc_security_struct *isec; | 4993 | struct ipc_security_struct *isec; |
4914 | struct msg_security_struct *msec; | 4994 | struct msg_security_struct *msec; |
4915 | struct common_audit_data ad; | 4995 | struct common_audit_data ad; |
4996 | struct selinux_audit_data sad = {0,}; | ||
4916 | u32 sid = task_sid(target); | 4997 | u32 sid = task_sid(target); |
4917 | int rc; | 4998 | int rc; |
4918 | 4999 | ||
@@ -4920,6 +5001,7 @@ static int selinux_msg_queue_msgrcv(struct msg_queue *msq, struct msg_msg *msg, | |||
4920 | msec = msg->security; | 5001 | msec = msg->security; |
4921 | 5002 | ||
4922 | COMMON_AUDIT_DATA_INIT(&ad, IPC); | 5003 | COMMON_AUDIT_DATA_INIT(&ad, IPC); |
5004 | ad.selinux_audit_data = &sad; | ||
4923 | ad.u.ipc_id = msq->q_perm.key; | 5005 | ad.u.ipc_id = msq->q_perm.key; |
4924 | 5006 | ||
4925 | rc = avc_has_perm(sid, isec->sid, | 5007 | rc = avc_has_perm(sid, isec->sid, |
@@ -4935,6 +5017,7 @@ static int selinux_shm_alloc_security(struct shmid_kernel *shp) | |||
4935 | { | 5017 | { |
4936 | struct ipc_security_struct *isec; | 5018 | struct ipc_security_struct *isec; |
4937 | struct common_audit_data ad; | 5019 | struct common_audit_data ad; |
5020 | struct selinux_audit_data sad = {0,}; | ||
4938 | u32 sid = current_sid(); | 5021 | u32 sid = current_sid(); |
4939 | int rc; | 5022 | int rc; |
4940 | 5023 | ||
@@ -4945,6 +5028,7 @@ static int selinux_shm_alloc_security(struct shmid_kernel *shp) | |||
4945 | isec = shp->shm_perm.security; | 5028 | isec = shp->shm_perm.security; |
4946 | 5029 | ||
4947 | COMMON_AUDIT_DATA_INIT(&ad, IPC); | 5030 | COMMON_AUDIT_DATA_INIT(&ad, IPC); |
5031 | ad.selinux_audit_data = &sad; | ||
4948 | ad.u.ipc_id = shp->shm_perm.key; | 5032 | ad.u.ipc_id = shp->shm_perm.key; |
4949 | 5033 | ||
4950 | rc = avc_has_perm(sid, isec->sid, SECCLASS_SHM, | 5034 | rc = avc_has_perm(sid, isec->sid, SECCLASS_SHM, |
@@ -4965,11 +5049,13 @@ static int selinux_shm_associate(struct shmid_kernel *shp, int shmflg) | |||
4965 | { | 5049 | { |
4966 | struct ipc_security_struct *isec; | 5050 | struct ipc_security_struct *isec; |
4967 | struct common_audit_data ad; | 5051 | struct common_audit_data ad; |
5052 | struct selinux_audit_data sad = {0,}; | ||
4968 | u32 sid = current_sid(); | 5053 | u32 sid = current_sid(); |
4969 | 5054 | ||
4970 | isec = shp->shm_perm.security; | 5055 | isec = shp->shm_perm.security; |
4971 | 5056 | ||
4972 | COMMON_AUDIT_DATA_INIT(&ad, IPC); | 5057 | COMMON_AUDIT_DATA_INIT(&ad, IPC); |
5058 | ad.selinux_audit_data = &sad; | ||
4973 | ad.u.ipc_id = shp->shm_perm.key; | 5059 | ad.u.ipc_id = shp->shm_perm.key; |
4974 | 5060 | ||
4975 | return avc_has_perm(sid, isec->sid, SECCLASS_SHM, | 5061 | return avc_has_perm(sid, isec->sid, SECCLASS_SHM, |
@@ -5027,6 +5113,7 @@ static int selinux_sem_alloc_security(struct sem_array *sma) | |||
5027 | { | 5113 | { |
5028 | struct ipc_security_struct *isec; | 5114 | struct ipc_security_struct *isec; |
5029 | struct common_audit_data ad; | 5115 | struct common_audit_data ad; |
5116 | struct selinux_audit_data sad = {0,}; | ||
5030 | u32 sid = current_sid(); | 5117 | u32 sid = current_sid(); |
5031 | int rc; | 5118 | int rc; |
5032 | 5119 | ||
@@ -5037,6 +5124,7 @@ static int selinux_sem_alloc_security(struct sem_array *sma) | |||
5037 | isec = sma->sem_perm.security; | 5124 | isec = sma->sem_perm.security; |
5038 | 5125 | ||
5039 | COMMON_AUDIT_DATA_INIT(&ad, IPC); | 5126 | COMMON_AUDIT_DATA_INIT(&ad, IPC); |
5127 | ad.selinux_audit_data = &sad; | ||
5040 | ad.u.ipc_id = sma->sem_perm.key; | 5128 | ad.u.ipc_id = sma->sem_perm.key; |
5041 | 5129 | ||
5042 | rc = avc_has_perm(sid, isec->sid, SECCLASS_SEM, | 5130 | rc = avc_has_perm(sid, isec->sid, SECCLASS_SEM, |
@@ -5057,11 +5145,13 @@ static int selinux_sem_associate(struct sem_array *sma, int semflg) | |||
5057 | { | 5145 | { |
5058 | struct ipc_security_struct *isec; | 5146 | struct ipc_security_struct *isec; |
5059 | struct common_audit_data ad; | 5147 | struct common_audit_data ad; |
5148 | struct selinux_audit_data sad = {0,}; | ||
5060 | u32 sid = current_sid(); | 5149 | u32 sid = current_sid(); |
5061 | 5150 | ||
5062 | isec = sma->sem_perm.security; | 5151 | isec = sma->sem_perm.security; |
5063 | 5152 | ||
5064 | COMMON_AUDIT_DATA_INIT(&ad, IPC); | 5153 | COMMON_AUDIT_DATA_INIT(&ad, IPC); |
5154 | ad.selinux_audit_data = &sad; | ||
5065 | ad.u.ipc_id = sma->sem_perm.key; | 5155 | ad.u.ipc_id = sma->sem_perm.key; |
5066 | 5156 | ||
5067 | return avc_has_perm(sid, isec->sid, SECCLASS_SEM, | 5157 | return avc_has_perm(sid, isec->sid, SECCLASS_SEM, |
diff --git a/security/selinux/include/avc.h b/security/selinux/include/avc.h index 005a91bcb200..1931370233d7 100644 --- a/security/selinux/include/avc.h +++ b/security/selinux/include/avc.h | |||
@@ -47,6 +47,31 @@ struct avc_cache_stats { | |||
47 | }; | 47 | }; |
48 | 48 | ||
49 | /* | 49 | /* |
50 | * We only need this data after we have decided to send an audit message. | ||
51 | */ | ||
52 | struct selinux_late_audit_data { | ||
53 | u32 ssid; | ||
54 | u32 tsid; | ||
55 | u16 tclass; | ||
56 | u32 requested; | ||
57 | u32 audited; | ||
58 | u32 denied; | ||
59 | int result; | ||
60 | }; | ||
61 | |||
62 | /* | ||
63 | * We collect this at the beginning or during an selinux security operation | ||
64 | */ | ||
65 | struct selinux_audit_data { | ||
66 | /* | ||
67 | * auditdeny is a bit tricky and unintuitive. See the | ||
68 | * comments in avc.c for it's meaning and usage. | ||
69 | */ | ||
70 | u32 auditdeny; | ||
71 | struct selinux_late_audit_data *slad; | ||
72 | }; | ||
73 | |||
74 | /* | ||
50 | * AVC operations | 75 | * AVC operations |
51 | */ | 76 | */ |
52 | 77 | ||
diff --git a/security/smack/smack.h b/security/smack/smack.h index 2ad00657b801..4ede719922ed 100644 --- a/security/smack/smack.h +++ b/security/smack/smack.h | |||
@@ -185,6 +185,15 @@ struct smack_known { | |||
185 | */ | 185 | */ |
186 | #define SMK_NUM_ACCESS_TYPE 5 | 186 | #define SMK_NUM_ACCESS_TYPE 5 |
187 | 187 | ||
188 | /* SMACK data */ | ||
189 | struct smack_audit_data { | ||
190 | const char *function; | ||
191 | char *subject; | ||
192 | char *object; | ||
193 | char *request; | ||
194 | int result; | ||
195 | }; | ||
196 | |||
188 | /* | 197 | /* |
189 | * Smack audit data; is empty if CONFIG_AUDIT not set | 198 | * Smack audit data; is empty if CONFIG_AUDIT not set |
190 | * to save some stack | 199 | * to save some stack |
@@ -192,6 +201,7 @@ struct smack_known { | |||
192 | struct smk_audit_info { | 201 | struct smk_audit_info { |
193 | #ifdef CONFIG_AUDIT | 202 | #ifdef CONFIG_AUDIT |
194 | struct common_audit_data a; | 203 | struct common_audit_data a; |
204 | struct smack_audit_data sad; | ||
195 | #endif | 205 | #endif |
196 | }; | 206 | }; |
197 | /* | 207 | /* |
@@ -311,7 +321,16 @@ static inline void smk_ad_init(struct smk_audit_info *a, const char *func, | |||
311 | { | 321 | { |
312 | memset(a, 0, sizeof(*a)); | 322 | memset(a, 0, sizeof(*a)); |
313 | a->a.type = type; | 323 | a->a.type = type; |
314 | a->a.smack_audit_data.function = func; | 324 | a->a.smack_audit_data = &a->sad; |
325 | a->a.smack_audit_data->function = func; | ||
326 | } | ||
327 | |||
328 | static inline void smk_ad_init_net(struct smk_audit_info *a, const char *func, | ||
329 | char type, struct lsm_network_audit *net) | ||
330 | { | ||
331 | smk_ad_init(a, func, type); | ||
332 | memset(net, 0, sizeof(*net)); | ||
333 | a->a.u.net = net; | ||
315 | } | 334 | } |
316 | 335 | ||
317 | static inline void smk_ad_setfield_u_tsk(struct smk_audit_info *a, | 336 | static inline void smk_ad_setfield_u_tsk(struct smk_audit_info *a, |
@@ -337,7 +356,7 @@ static inline void smk_ad_setfield_u_fs_path(struct smk_audit_info *a, | |||
337 | static inline void smk_ad_setfield_u_net_sk(struct smk_audit_info *a, | 356 | static inline void smk_ad_setfield_u_net_sk(struct smk_audit_info *a, |
338 | struct sock *sk) | 357 | struct sock *sk) |
339 | { | 358 | { |
340 | a->a.u.net.sk = sk; | 359 | a->a.u.net->sk = sk; |
341 | } | 360 | } |
342 | 361 | ||
343 | #else /* no AUDIT */ | 362 | #else /* no AUDIT */ |
diff --git a/security/smack/smack_access.c b/security/smack/smack_access.c index cc7cb6edba08..c8115f7308f8 100644 --- a/security/smack/smack_access.c +++ b/security/smack/smack_access.c | |||
@@ -275,9 +275,9 @@ static inline void smack_str_from_perm(char *string, int access) | |||
275 | static void smack_log_callback(struct audit_buffer *ab, void *a) | 275 | static void smack_log_callback(struct audit_buffer *ab, void *a) |
276 | { | 276 | { |
277 | struct common_audit_data *ad = a; | 277 | struct common_audit_data *ad = a; |
278 | struct smack_audit_data *sad = &ad->smack_audit_data; | 278 | struct smack_audit_data *sad = ad->smack_audit_data; |
279 | audit_log_format(ab, "lsm=SMACK fn=%s action=%s", | 279 | audit_log_format(ab, "lsm=SMACK fn=%s action=%s", |
280 | ad->smack_audit_data.function, | 280 | ad->smack_audit_data->function, |
281 | sad->result ? "denied" : "granted"); | 281 | sad->result ? "denied" : "granted"); |
282 | audit_log_format(ab, " subject="); | 282 | audit_log_format(ab, " subject="); |
283 | audit_log_untrustedstring(ab, sad->subject); | 283 | audit_log_untrustedstring(ab, sad->subject); |
@@ -310,19 +310,19 @@ void smack_log(char *subject_label, char *object_label, int request, | |||
310 | if (result == 0 && (log_policy & SMACK_AUDIT_ACCEPT) == 0) | 310 | if (result == 0 && (log_policy & SMACK_AUDIT_ACCEPT) == 0) |
311 | return; | 311 | return; |
312 | 312 | ||
313 | if (a->smack_audit_data.function == NULL) | 313 | sad = a->smack_audit_data; |
314 | a->smack_audit_data.function = "unknown"; | 314 | |
315 | if (sad->function == NULL) | ||
316 | sad->function = "unknown"; | ||
315 | 317 | ||
316 | /* end preparing the audit data */ | 318 | /* end preparing the audit data */ |
317 | sad = &a->smack_audit_data; | ||
318 | smack_str_from_perm(request_buffer, request); | 319 | smack_str_from_perm(request_buffer, request); |
319 | sad->subject = subject_label; | 320 | sad->subject = subject_label; |
320 | sad->object = object_label; | 321 | sad->object = object_label; |
321 | sad->request = request_buffer; | 322 | sad->request = request_buffer; |
322 | sad->result = result; | 323 | sad->result = result; |
323 | a->lsm_pre_audit = smack_log_callback; | ||
324 | 324 | ||
325 | common_lsm_audit(a); | 325 | common_lsm_audit(a, smack_log_callback, NULL); |
326 | } | 326 | } |
327 | #else /* #ifdef CONFIG_AUDIT */ | 327 | #else /* #ifdef CONFIG_AUDIT */ |
328 | void smack_log(char *subject_label, char *object_label, int request, | 328 | void smack_log(char *subject_label, char *object_label, int request, |
diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c index cd667b4089a5..81c03a597112 100644 --- a/security/smack/smack_lsm.c +++ b/security/smack/smack_lsm.c | |||
@@ -1939,16 +1939,17 @@ static int smack_netlabel_send(struct sock *sk, struct sockaddr_in *sap) | |||
1939 | char *hostsp; | 1939 | char *hostsp; |
1940 | struct socket_smack *ssp = sk->sk_security; | 1940 | struct socket_smack *ssp = sk->sk_security; |
1941 | struct smk_audit_info ad; | 1941 | struct smk_audit_info ad; |
1942 | struct lsm_network_audit net; | ||
1942 | 1943 | ||
1943 | rcu_read_lock(); | 1944 | rcu_read_lock(); |
1944 | hostsp = smack_host_label(sap); | 1945 | hostsp = smack_host_label(sap); |
1945 | if (hostsp != NULL) { | 1946 | if (hostsp != NULL) { |
1946 | sk_lbl = SMACK_UNLABELED_SOCKET; | 1947 | sk_lbl = SMACK_UNLABELED_SOCKET; |
1947 | #ifdef CONFIG_AUDIT | 1948 | #ifdef CONFIG_AUDIT |
1948 | smk_ad_init(&ad, __func__, LSM_AUDIT_DATA_NET); | 1949 | smk_ad_init_net(&ad, __func__, LSM_AUDIT_DATA_NET, &net); |
1949 | ad.a.u.net.family = sap->sin_family; | 1950 | ad.a.u.net->family = sap->sin_family; |
1950 | ad.a.u.net.dport = sap->sin_port; | 1951 | ad.a.u.net->dport = sap->sin_port; |
1951 | ad.a.u.net.v4info.daddr = sap->sin_addr.s_addr; | 1952 | ad.a.u.net->v4info.daddr = sap->sin_addr.s_addr; |
1952 | #endif | 1953 | #endif |
1953 | rc = smk_access(ssp->smk_out, hostsp, MAY_WRITE, &ad); | 1954 | rc = smk_access(ssp->smk_out, hostsp, MAY_WRITE, &ad); |
1954 | } else { | 1955 | } else { |
@@ -2808,9 +2809,10 @@ static int smack_unix_stream_connect(struct sock *sock, | |||
2808 | struct socket_smack *osp = other->sk_security; | 2809 | struct socket_smack *osp = other->sk_security; |
2809 | struct socket_smack *nsp = newsk->sk_security; | 2810 | struct socket_smack *nsp = newsk->sk_security; |
2810 | struct smk_audit_info ad; | 2811 | struct smk_audit_info ad; |
2812 | struct lsm_network_audit net; | ||
2811 | int rc = 0; | 2813 | int rc = 0; |
2812 | 2814 | ||
2813 | smk_ad_init(&ad, __func__, LSM_AUDIT_DATA_NET); | 2815 | smk_ad_init_net(&ad, __func__, LSM_AUDIT_DATA_NET, &net); |
2814 | smk_ad_setfield_u_net_sk(&ad, other); | 2816 | smk_ad_setfield_u_net_sk(&ad, other); |
2815 | 2817 | ||
2816 | if (!capable(CAP_MAC_OVERRIDE)) | 2818 | if (!capable(CAP_MAC_OVERRIDE)) |
@@ -2840,9 +2842,10 @@ static int smack_unix_may_send(struct socket *sock, struct socket *other) | |||
2840 | struct socket_smack *ssp = sock->sk->sk_security; | 2842 | struct socket_smack *ssp = sock->sk->sk_security; |
2841 | struct socket_smack *osp = other->sk->sk_security; | 2843 | struct socket_smack *osp = other->sk->sk_security; |
2842 | struct smk_audit_info ad; | 2844 | struct smk_audit_info ad; |
2845 | struct lsm_network_audit net; | ||
2843 | int rc = 0; | 2846 | int rc = 0; |
2844 | 2847 | ||
2845 | smk_ad_init(&ad, __func__, LSM_AUDIT_DATA_NET); | 2848 | smk_ad_init_net(&ad, __func__, LSM_AUDIT_DATA_NET, &net); |
2846 | smk_ad_setfield_u_net_sk(&ad, other->sk); | 2849 | smk_ad_setfield_u_net_sk(&ad, other->sk); |
2847 | 2850 | ||
2848 | if (!capable(CAP_MAC_OVERRIDE)) | 2851 | if (!capable(CAP_MAC_OVERRIDE)) |
@@ -2990,6 +2993,7 @@ static int smack_socket_sock_rcv_skb(struct sock *sk, struct sk_buff *skb) | |||
2990 | char *csp; | 2993 | char *csp; |
2991 | int rc; | 2994 | int rc; |
2992 | struct smk_audit_info ad; | 2995 | struct smk_audit_info ad; |
2996 | struct lsm_network_audit net; | ||
2993 | if (sk->sk_family != PF_INET && sk->sk_family != PF_INET6) | 2997 | if (sk->sk_family != PF_INET && sk->sk_family != PF_INET6) |
2994 | return 0; | 2998 | return 0; |
2995 | 2999 | ||
@@ -3007,9 +3011,9 @@ static int smack_socket_sock_rcv_skb(struct sock *sk, struct sk_buff *skb) | |||
3007 | netlbl_secattr_destroy(&secattr); | 3011 | netlbl_secattr_destroy(&secattr); |
3008 | 3012 | ||
3009 | #ifdef CONFIG_AUDIT | 3013 | #ifdef CONFIG_AUDIT |
3010 | smk_ad_init(&ad, __func__, LSM_AUDIT_DATA_NET); | 3014 | smk_ad_init_net(&ad, __func__, LSM_AUDIT_DATA_NET, &net); |
3011 | ad.a.u.net.family = sk->sk_family; | 3015 | ad.a.u.net->family = sk->sk_family; |
3012 | ad.a.u.net.netif = skb->skb_iif; | 3016 | ad.a.u.net->netif = skb->skb_iif; |
3013 | ipv4_skb_to_auditdata(skb, &ad.a, NULL); | 3017 | ipv4_skb_to_auditdata(skb, &ad.a, NULL); |
3014 | #endif | 3018 | #endif |
3015 | /* | 3019 | /* |
@@ -3152,6 +3156,7 @@ static int smack_inet_conn_request(struct sock *sk, struct sk_buff *skb, | |||
3152 | char *sp; | 3156 | char *sp; |
3153 | int rc; | 3157 | int rc; |
3154 | struct smk_audit_info ad; | 3158 | struct smk_audit_info ad; |
3159 | struct lsm_network_audit net; | ||
3155 | 3160 | ||
3156 | /* handle mapped IPv4 packets arriving via IPv6 sockets */ | 3161 | /* handle mapped IPv4 packets arriving via IPv6 sockets */ |
3157 | if (family == PF_INET6 && skb->protocol == htons(ETH_P_IP)) | 3162 | if (family == PF_INET6 && skb->protocol == htons(ETH_P_IP)) |
@@ -3166,9 +3171,9 @@ static int smack_inet_conn_request(struct sock *sk, struct sk_buff *skb, | |||
3166 | netlbl_secattr_destroy(&secattr); | 3171 | netlbl_secattr_destroy(&secattr); |
3167 | 3172 | ||
3168 | #ifdef CONFIG_AUDIT | 3173 | #ifdef CONFIG_AUDIT |
3169 | smk_ad_init(&ad, __func__, LSM_AUDIT_DATA_NET); | 3174 | smk_ad_init_net(&ad, __func__, LSM_AUDIT_DATA_NET, &net); |
3170 | ad.a.u.net.family = family; | 3175 | ad.a.u.net->family = family; |
3171 | ad.a.u.net.netif = skb->skb_iif; | 3176 | ad.a.u.net->netif = skb->skb_iif; |
3172 | ipv4_skb_to_auditdata(skb, &ad.a, NULL); | 3177 | ipv4_skb_to_auditdata(skb, &ad.a, NULL); |
3173 | #endif | 3178 | #endif |
3174 | /* | 3179 | /* |
diff --git a/sound/soc/fsl/mpc8610_hpcd.c b/sound/soc/fsl/mpc8610_hpcd.c index afbabf427f27..3fea5a15ffe8 100644 --- a/sound/soc/fsl/mpc8610_hpcd.c +++ b/sound/soc/fsl/mpc8610_hpcd.c | |||
@@ -58,9 +58,9 @@ static int mpc8610_hpcd_machine_probe(struct snd_soc_card *card) | |||
58 | { | 58 | { |
59 | struct mpc8610_hpcd_data *machine_data = | 59 | struct mpc8610_hpcd_data *machine_data = |
60 | container_of(card, struct mpc8610_hpcd_data, card); | 60 | container_of(card, struct mpc8610_hpcd_data, card); |
61 | struct ccsr_guts_86xx __iomem *guts; | 61 | struct ccsr_guts __iomem *guts; |
62 | 62 | ||
63 | guts = ioremap(guts_phys, sizeof(struct ccsr_guts_86xx)); | 63 | guts = ioremap(guts_phys, sizeof(struct ccsr_guts)); |
64 | if (!guts) { | 64 | if (!guts) { |
65 | dev_err(card->dev, "could not map global utilities\n"); | 65 | dev_err(card->dev, "could not map global utilities\n"); |
66 | return -ENOMEM; | 66 | return -ENOMEM; |
@@ -142,9 +142,9 @@ static int mpc8610_hpcd_machine_remove(struct snd_soc_card *card) | |||
142 | { | 142 | { |
143 | struct mpc8610_hpcd_data *machine_data = | 143 | struct mpc8610_hpcd_data *machine_data = |
144 | container_of(card, struct mpc8610_hpcd_data, card); | 144 | container_of(card, struct mpc8610_hpcd_data, card); |
145 | struct ccsr_guts_86xx __iomem *guts; | 145 | struct ccsr_guts __iomem *guts; |
146 | 146 | ||
147 | guts = ioremap(guts_phys, sizeof(struct ccsr_guts_86xx)); | 147 | guts = ioremap(guts_phys, sizeof(struct ccsr_guts)); |
148 | if (!guts) { | 148 | if (!guts) { |
149 | dev_err(card->dev, "could not map global utilities\n"); | 149 | dev_err(card->dev, "could not map global utilities\n"); |
150 | return -ENOMEM; | 150 | return -ENOMEM; |
diff --git a/sound/soc/fsl/p1022_ds.c b/sound/soc/fsl/p1022_ds.c index 46623405a2ce..982a1c944983 100644 --- a/sound/soc/fsl/p1022_ds.c +++ b/sound/soc/fsl/p1022_ds.c | |||
@@ -46,7 +46,7 @@ | |||
46 | * ch: The channel on the DMA controller (0, 1, 2, or 3) | 46 | * ch: The channel on the DMA controller (0, 1, 2, or 3) |
47 | * device: The device to set as the target (CCSR_GUTS_DMUXCR_xxx) | 47 | * device: The device to set as the target (CCSR_GUTS_DMUXCR_xxx) |
48 | */ | 48 | */ |
49 | static inline void guts_set_dmuxcr(struct ccsr_guts_85xx __iomem *guts, | 49 | static inline void guts_set_dmuxcr(struct ccsr_guts __iomem *guts, |
50 | unsigned int co, unsigned int ch, unsigned int device) | 50 | unsigned int co, unsigned int ch, unsigned int device) |
51 | { | 51 | { |
52 | unsigned int shift = 16 + (8 * (1 - co) + 2 * (3 - ch)); | 52 | unsigned int shift = 16 + (8 * (1 - co) + 2 * (3 - ch)); |
@@ -90,9 +90,9 @@ static int p1022_ds_machine_probe(struct snd_soc_card *card) | |||
90 | { | 90 | { |
91 | struct machine_data *mdata = | 91 | struct machine_data *mdata = |
92 | container_of(card, struct machine_data, card); | 92 | container_of(card, struct machine_data, card); |
93 | struct ccsr_guts_85xx __iomem *guts; | 93 | struct ccsr_guts __iomem *guts; |
94 | 94 | ||
95 | guts = ioremap(guts_phys, sizeof(struct ccsr_guts_85xx)); | 95 | guts = ioremap(guts_phys, sizeof(struct ccsr_guts)); |
96 | if (!guts) { | 96 | if (!guts) { |
97 | dev_err(card->dev, "could not map global utilities\n"); | 97 | dev_err(card->dev, "could not map global utilities\n"); |
98 | return -ENOMEM; | 98 | return -ENOMEM; |
@@ -164,9 +164,9 @@ static int p1022_ds_machine_remove(struct snd_soc_card *card) | |||
164 | { | 164 | { |
165 | struct machine_data *mdata = | 165 | struct machine_data *mdata = |
166 | container_of(card, struct machine_data, card); | 166 | container_of(card, struct machine_data, card); |
167 | struct ccsr_guts_85xx __iomem *guts; | 167 | struct ccsr_guts __iomem *guts; |
168 | 168 | ||
169 | guts = ioremap(guts_phys, sizeof(struct ccsr_guts_85xx)); | 169 | guts = ioremap(guts_phys, sizeof(struct ccsr_guts)); |
170 | if (!guts) { | 170 | if (!guts) { |
171 | dev_err(card->dev, "could not map global utilities\n"); | 171 | dev_err(card->dev, "could not map global utilities\n"); |
172 | return -ENOMEM; | 172 | return -ENOMEM; |
diff --git a/sound/soc/imx/imx-audmux.c b/sound/soc/imx/imx-audmux.c index 601df809a26a..1765a197acb0 100644 --- a/sound/soc/imx/imx-audmux.c +++ b/sound/soc/imx/imx-audmux.c | |||
@@ -40,12 +40,6 @@ static void __iomem *audmux_base; | |||
40 | #ifdef CONFIG_DEBUG_FS | 40 | #ifdef CONFIG_DEBUG_FS |
41 | static struct dentry *audmux_debugfs_root; | 41 | static struct dentry *audmux_debugfs_root; |
42 | 42 | ||
43 | static int audmux_open_file(struct inode *inode, struct file *file) | ||
44 | { | ||
45 | file->private_data = inode->i_private; | ||
46 | return 0; | ||
47 | } | ||
48 | |||
49 | /* There is an annoying discontinuity in the SSI numbering with regard | 43 | /* There is an annoying discontinuity in the SSI numbering with regard |
50 | * to the Linux number of the devices */ | 44 | * to the Linux number of the devices */ |
51 | static const char *audmux_port_string(int port) | 45 | static const char *audmux_port_string(int port) |
@@ -142,7 +136,7 @@ static ssize_t audmux_read_file(struct file *file, char __user *user_buf, | |||
142 | } | 136 | } |
143 | 137 | ||
144 | static const struct file_operations audmux_debugfs_fops = { | 138 | static const struct file_operations audmux_debugfs_fops = { |
145 | .open = audmux_open_file, | 139 | .open = simple_open, |
146 | .read = audmux_read_file, | 140 | .read = audmux_read_file, |
147 | .llseek = default_llseek, | 141 | .llseek = default_llseek, |
148 | }; | 142 | }; |
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index a4deebc0801a..e19c24ade414 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c | |||
@@ -201,12 +201,6 @@ static ssize_t pmdown_time_set(struct device *dev, | |||
201 | static DEVICE_ATTR(pmdown_time, 0644, pmdown_time_show, pmdown_time_set); | 201 | static DEVICE_ATTR(pmdown_time, 0644, pmdown_time_show, pmdown_time_set); |
202 | 202 | ||
203 | #ifdef CONFIG_DEBUG_FS | 203 | #ifdef CONFIG_DEBUG_FS |
204 | static int codec_reg_open_file(struct inode *inode, struct file *file) | ||
205 | { | ||
206 | file->private_data = inode->i_private; | ||
207 | return 0; | ||
208 | } | ||
209 | |||
210 | static ssize_t codec_reg_read_file(struct file *file, char __user *user_buf, | 204 | static ssize_t codec_reg_read_file(struct file *file, char __user *user_buf, |
211 | size_t count, loff_t *ppos) | 205 | size_t count, loff_t *ppos) |
212 | { | 206 | { |
@@ -264,7 +258,7 @@ static ssize_t codec_reg_write_file(struct file *file, | |||
264 | } | 258 | } |
265 | 259 | ||
266 | static const struct file_operations codec_reg_fops = { | 260 | static const struct file_operations codec_reg_fops = { |
267 | .open = codec_reg_open_file, | 261 | .open = simple_open, |
268 | .read = codec_reg_read_file, | 262 | .read = codec_reg_read_file, |
269 | .write = codec_reg_write_file, | 263 | .write = codec_reg_write_file, |
270 | .llseek = default_llseek, | 264 | .llseek = default_llseek, |
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index 6241490fff30..5cbd2d7623b8 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c | |||
@@ -1544,12 +1544,6 @@ static int dapm_power_widgets(struct snd_soc_dapm_context *dapm, int event) | |||
1544 | } | 1544 | } |
1545 | 1545 | ||
1546 | #ifdef CONFIG_DEBUG_FS | 1546 | #ifdef CONFIG_DEBUG_FS |
1547 | static int dapm_widget_power_open_file(struct inode *inode, struct file *file) | ||
1548 | { | ||
1549 | file->private_data = inode->i_private; | ||
1550 | return 0; | ||
1551 | } | ||
1552 | |||
1553 | static ssize_t dapm_widget_power_read_file(struct file *file, | 1547 | static ssize_t dapm_widget_power_read_file(struct file *file, |
1554 | char __user *user_buf, | 1548 | char __user *user_buf, |
1555 | size_t count, loff_t *ppos) | 1549 | size_t count, loff_t *ppos) |
@@ -1613,17 +1607,11 @@ static ssize_t dapm_widget_power_read_file(struct file *file, | |||
1613 | } | 1607 | } |
1614 | 1608 | ||
1615 | static const struct file_operations dapm_widget_power_fops = { | 1609 | static const struct file_operations dapm_widget_power_fops = { |
1616 | .open = dapm_widget_power_open_file, | 1610 | .open = simple_open, |
1617 | .read = dapm_widget_power_read_file, | 1611 | .read = dapm_widget_power_read_file, |
1618 | .llseek = default_llseek, | 1612 | .llseek = default_llseek, |
1619 | }; | 1613 | }; |
1620 | 1614 | ||
1621 | static int dapm_bias_open_file(struct inode *inode, struct file *file) | ||
1622 | { | ||
1623 | file->private_data = inode->i_private; | ||
1624 | return 0; | ||
1625 | } | ||
1626 | |||
1627 | static ssize_t dapm_bias_read_file(struct file *file, char __user *user_buf, | 1615 | static ssize_t dapm_bias_read_file(struct file *file, char __user *user_buf, |
1628 | size_t count, loff_t *ppos) | 1616 | size_t count, loff_t *ppos) |
1629 | { | 1617 | { |
@@ -1654,7 +1642,7 @@ static ssize_t dapm_bias_read_file(struct file *file, char __user *user_buf, | |||
1654 | } | 1642 | } |
1655 | 1643 | ||
1656 | static const struct file_operations dapm_bias_fops = { | 1644 | static const struct file_operations dapm_bias_fops = { |
1657 | .open = dapm_bias_open_file, | 1645 | .open = simple_open, |
1658 | .read = dapm_bias_read_file, | 1646 | .read = dapm_bias_read_file, |
1659 | .llseek = default_llseek, | 1647 | .llseek = default_llseek, |
1660 | }; | 1648 | }; |