diff options
Diffstat (limited to 'drivers')
99 files changed, 1128 insertions, 686 deletions
diff --git a/drivers/acpi/acpi_pad.c b/drivers/acpi/acpi_pad.c index d269a8f3329c..446aced33aff 100644 --- a/drivers/acpi/acpi_pad.c +++ b/drivers/acpi/acpi_pad.c | |||
@@ -46,6 +46,8 @@ static unsigned long power_saving_mwait_eax; | |||
46 | 46 | ||
47 | static unsigned char tsc_detected_unstable; | 47 | static unsigned char tsc_detected_unstable; |
48 | static unsigned char tsc_marked_unstable; | 48 | static unsigned char tsc_marked_unstable; |
49 | static unsigned char lapic_detected_unstable; | ||
50 | static unsigned char lapic_marked_unstable; | ||
49 | 51 | ||
50 | static void power_saving_mwait_init(void) | 52 | static void power_saving_mwait_init(void) |
51 | { | 53 | { |
@@ -75,9 +77,6 @@ static void power_saving_mwait_init(void) | |||
75 | power_saving_mwait_eax = (highest_cstate << MWAIT_SUBSTATE_SIZE) | | 77 | power_saving_mwait_eax = (highest_cstate << MWAIT_SUBSTATE_SIZE) | |
76 | (highest_subcstate - 1); | 78 | (highest_subcstate - 1); |
77 | 79 | ||
78 | for_each_online_cpu(i) | ||
79 | clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_ON, &i); | ||
80 | |||
81 | #if defined(CONFIG_GENERIC_TIME) && defined(CONFIG_X86) | 80 | #if defined(CONFIG_GENERIC_TIME) && defined(CONFIG_X86) |
82 | switch (boot_cpu_data.x86_vendor) { | 81 | switch (boot_cpu_data.x86_vendor) { |
83 | case X86_VENDOR_AMD: | 82 | case X86_VENDOR_AMD: |
@@ -86,13 +85,15 @@ static void power_saving_mwait_init(void) | |||
86 | * AMD Fam10h TSC will tick in all | 85 | * AMD Fam10h TSC will tick in all |
87 | * C/P/S0/S1 states when this bit is set. | 86 | * C/P/S0/S1 states when this bit is set. |
88 | */ | 87 | */ |
89 | if (boot_cpu_has(X86_FEATURE_NONSTOP_TSC)) | 88 | if (!boot_cpu_has(X86_FEATURE_NONSTOP_TSC)) |
90 | return; | 89 | tsc_detected_unstable = 1; |
91 | 90 | if (!boot_cpu_has(X86_FEATURE_ARAT)) | |
92 | /*FALL THROUGH*/ | 91 | lapic_detected_unstable = 1; |
92 | break; | ||
93 | default: | 93 | default: |
94 | /* TSC could halt in idle */ | 94 | /* TSC & LAPIC could halt in idle */ |
95 | tsc_detected_unstable = 1; | 95 | tsc_detected_unstable = 1; |
96 | lapic_detected_unstable = 1; | ||
96 | } | 97 | } |
97 | #endif | 98 | #endif |
98 | } | 99 | } |
@@ -180,10 +181,20 @@ static int power_saving_thread(void *data) | |||
180 | mark_tsc_unstable("TSC halts in idle"); | 181 | mark_tsc_unstable("TSC halts in idle"); |
181 | tsc_marked_unstable = 1; | 182 | tsc_marked_unstable = 1; |
182 | } | 183 | } |
184 | if (lapic_detected_unstable && !lapic_marked_unstable) { | ||
185 | int i; | ||
186 | /* LAPIC could halt in idle, so notify users */ | ||
187 | for_each_online_cpu(i) | ||
188 | clockevents_notify( | ||
189 | CLOCK_EVT_NOTIFY_BROADCAST_ON, | ||
190 | &i); | ||
191 | lapic_marked_unstable = 1; | ||
192 | } | ||
183 | local_irq_disable(); | 193 | local_irq_disable(); |
184 | cpu = smp_processor_id(); | 194 | cpu = smp_processor_id(); |
185 | clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_ENTER, | 195 | if (lapic_marked_unstable) |
186 | &cpu); | 196 | clockevents_notify( |
197 | CLOCK_EVT_NOTIFY_BROADCAST_ENTER, &cpu); | ||
187 | stop_critical_timings(); | 198 | stop_critical_timings(); |
188 | 199 | ||
189 | __monitor((void *)¤t_thread_info()->flags, 0, 0); | 200 | __monitor((void *)¤t_thread_info()->flags, 0, 0); |
@@ -192,8 +203,9 @@ static int power_saving_thread(void *data) | |||
192 | __mwait(power_saving_mwait_eax, 1); | 203 | __mwait(power_saving_mwait_eax, 1); |
193 | 204 | ||
194 | start_critical_timings(); | 205 | start_critical_timings(); |
195 | clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_EXIT, | 206 | if (lapic_marked_unstable) |
196 | &cpu); | 207 | clockevents_notify( |
208 | CLOCK_EVT_NOTIFY_BROADCAST_EXIT, &cpu); | ||
197 | local_irq_enable(); | 209 | local_irq_enable(); |
198 | 210 | ||
199 | if (jiffies > expire_time) { | 211 | if (jiffies > expire_time) { |
diff --git a/drivers/acpi/acpica/acconfig.h b/drivers/acpi/acpica/acconfig.h index 33181ad350d5..b17d8de9f6ff 100644 --- a/drivers/acpi/acpica/acconfig.h +++ b/drivers/acpi/acpica/acconfig.h | |||
@@ -119,6 +119,10 @@ | |||
119 | 119 | ||
120 | #define ACPI_MAX_LOOP_ITERATIONS 0xFFFF | 120 | #define ACPI_MAX_LOOP_ITERATIONS 0xFFFF |
121 | 121 | ||
122 | /* Maximum sleep allowed via Sleep() operator */ | ||
123 | |||
124 | #define ACPI_MAX_SLEEP 20000 /* Two seconds */ | ||
125 | |||
122 | /****************************************************************************** | 126 | /****************************************************************************** |
123 | * | 127 | * |
124 | * ACPI Specification constants (Do not change unless the specification changes) | 128 | * ACPI Specification constants (Do not change unless the specification changes) |
diff --git a/drivers/acpi/acpica/acevents.h b/drivers/acpi/acpica/acevents.h index 64d1e5c2d4ae..c3f43daa8be3 100644 --- a/drivers/acpi/acpica/acevents.h +++ b/drivers/acpi/acpica/acevents.h | |||
@@ -80,10 +80,6 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info *gpe_xrupt_list); | |||
80 | acpi_status | 80 | acpi_status |
81 | acpi_ev_update_gpe_enable_masks(struct acpi_gpe_event_info *gpe_event_info); | 81 | acpi_ev_update_gpe_enable_masks(struct acpi_gpe_event_info *gpe_event_info); |
82 | 82 | ||
83 | acpi_status acpi_ev_enable_gpe(struct acpi_gpe_event_info *gpe_event_info); | ||
84 | |||
85 | acpi_status acpi_ev_disable_gpe(struct acpi_gpe_event_info *gpe_event_info); | ||
86 | |||
87 | struct acpi_gpe_event_info *acpi_ev_get_gpe_event_info(acpi_handle gpe_device, | 83 | struct acpi_gpe_event_info *acpi_ev_get_gpe_event_info(acpi_handle gpe_device, |
88 | u32 gpe_number); | 84 | u32 gpe_number); |
89 | 85 | ||
diff --git a/drivers/acpi/acpica/acglobal.h b/drivers/acpi/acpica/acglobal.h index 9070f1fe8f17..899d68afc3c5 100644 --- a/drivers/acpi/acpica/acglobal.h +++ b/drivers/acpi/acpica/acglobal.h | |||
@@ -125,6 +125,14 @@ u8 ACPI_INIT_GLOBAL(acpi_gbl_enable_aml_debug_object, FALSE); | |||
125 | */ | 125 | */ |
126 | u8 ACPI_INIT_GLOBAL(acpi_gbl_copy_dsdt_locally, FALSE); | 126 | u8 ACPI_INIT_GLOBAL(acpi_gbl_copy_dsdt_locally, FALSE); |
127 | 127 | ||
128 | /* | ||
129 | * Optionally truncate I/O addresses to 16 bits. Provides compatibility | ||
130 | * with other ACPI implementations. NOTE: During ACPICA initialization, | ||
131 | * this value is set to TRUE if any Windows OSI strings have been | ||
132 | * requested by the BIOS. | ||
133 | */ | ||
134 | u8 ACPI_INIT_GLOBAL(acpi_gbl_truncate_io_addresses, FALSE); | ||
135 | |||
128 | /* acpi_gbl_FADT is a local copy of the FADT, converted to a common format. */ | 136 | /* acpi_gbl_FADT is a local copy of the FADT, converted to a common format. */ |
129 | 137 | ||
130 | struct acpi_table_fadt acpi_gbl_FADT; | 138 | struct acpi_table_fadt acpi_gbl_FADT; |
diff --git a/drivers/acpi/acpica/achware.h b/drivers/acpi/acpica/achware.h index 5900f135dc6d..32391588e163 100644 --- a/drivers/acpi/acpica/achware.h +++ b/drivers/acpi/acpica/achware.h | |||
@@ -90,7 +90,11 @@ acpi_status acpi_hw_write_port(acpi_io_address address, u32 value, u32 width); | |||
90 | /* | 90 | /* |
91 | * hwgpe - GPE support | 91 | * hwgpe - GPE support |
92 | */ | 92 | */ |
93 | acpi_status acpi_hw_low_disable_gpe(struct acpi_gpe_event_info *gpe_event_info); | 93 | u32 acpi_hw_gpe_register_bit(struct acpi_gpe_event_info *gpe_event_info, |
94 | struct acpi_gpe_register_info *gpe_register_info); | ||
95 | |||
96 | acpi_status | ||
97 | acpi_hw_low_set_gpe(struct acpi_gpe_event_info *gpe_event_info, u8 action); | ||
94 | 98 | ||
95 | acpi_status | 99 | acpi_status |
96 | acpi_hw_write_gpe_enable_reg(struct acpi_gpe_event_info *gpe_event_info); | 100 | acpi_hw_write_gpe_enable_reg(struct acpi_gpe_event_info *gpe_event_info); |
diff --git a/drivers/acpi/acpica/evgpe.c b/drivers/acpi/acpica/evgpe.c index a221ad404167..7c2c336006a1 100644 --- a/drivers/acpi/acpica/evgpe.c +++ b/drivers/acpi/acpica/evgpe.c | |||
@@ -69,7 +69,7 @@ acpi_status | |||
69 | acpi_ev_update_gpe_enable_masks(struct acpi_gpe_event_info *gpe_event_info) | 69 | acpi_ev_update_gpe_enable_masks(struct acpi_gpe_event_info *gpe_event_info) |
70 | { | 70 | { |
71 | struct acpi_gpe_register_info *gpe_register_info; | 71 | struct acpi_gpe_register_info *gpe_register_info; |
72 | u8 register_bit; | 72 | u32 register_bit; |
73 | 73 | ||
74 | ACPI_FUNCTION_TRACE(ev_update_gpe_enable_masks); | 74 | ACPI_FUNCTION_TRACE(ev_update_gpe_enable_masks); |
75 | 75 | ||
@@ -78,9 +78,8 @@ acpi_ev_update_gpe_enable_masks(struct acpi_gpe_event_info *gpe_event_info) | |||
78 | return_ACPI_STATUS(AE_NOT_EXIST); | 78 | return_ACPI_STATUS(AE_NOT_EXIST); |
79 | } | 79 | } |
80 | 80 | ||
81 | register_bit = (u8) | 81 | register_bit = acpi_hw_gpe_register_bit(gpe_event_info, |
82 | (1 << | 82 | gpe_register_info); |
83 | (gpe_event_info->gpe_number - gpe_register_info->base_gpe_number)); | ||
84 | 83 | ||
85 | /* Clear the wake/run bits up front */ | 84 | /* Clear the wake/run bits up front */ |
86 | 85 | ||
@@ -100,106 +99,6 @@ acpi_ev_update_gpe_enable_masks(struct acpi_gpe_event_info *gpe_event_info) | |||
100 | return_ACPI_STATUS(AE_OK); | 99 | return_ACPI_STATUS(AE_OK); |
101 | } | 100 | } |
102 | 101 | ||
103 | /******************************************************************************* | ||
104 | * | ||
105 | * FUNCTION: acpi_ev_enable_gpe | ||
106 | * | ||
107 | * PARAMETERS: gpe_event_info - GPE to enable | ||
108 | * | ||
109 | * RETURN: Status | ||
110 | * | ||
111 | * DESCRIPTION: Hardware-enable a GPE. Always enables the GPE, regardless | ||
112 | * of type or number of references. | ||
113 | * | ||
114 | * Note: The GPE lock should be already acquired when this function is called. | ||
115 | * | ||
116 | ******************************************************************************/ | ||
117 | |||
118 | acpi_status acpi_ev_enable_gpe(struct acpi_gpe_event_info *gpe_event_info) | ||
119 | { | ||
120 | acpi_status status; | ||
121 | |||
122 | |||
123 | ACPI_FUNCTION_TRACE(ev_enable_gpe); | ||
124 | |||
125 | |||
126 | /* | ||
127 | * We will only allow a GPE to be enabled if it has either an | ||
128 | * associated method (_Lxx/_Exx) or a handler. Otherwise, the | ||
129 | * GPE will be immediately disabled by acpi_ev_gpe_dispatch the | ||
130 | * first time it fires. | ||
131 | */ | ||
132 | if (!(gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK)) { | ||
133 | return_ACPI_STATUS(AE_NO_HANDLER); | ||
134 | } | ||
135 | |||
136 | /* Ensure the HW enable masks are current */ | ||
137 | |||
138 | status = acpi_ev_update_gpe_enable_masks(gpe_event_info); | ||
139 | if (ACPI_FAILURE(status)) { | ||
140 | return_ACPI_STATUS(status); | ||
141 | } | ||
142 | |||
143 | /* Clear the GPE (of stale events) */ | ||
144 | |||
145 | status = acpi_hw_clear_gpe(gpe_event_info); | ||
146 | if (ACPI_FAILURE(status)) { | ||
147 | return_ACPI_STATUS(status); | ||
148 | } | ||
149 | |||
150 | /* Enable the requested GPE */ | ||
151 | |||
152 | status = acpi_hw_write_gpe_enable_reg(gpe_event_info); | ||
153 | return_ACPI_STATUS(status); | ||
154 | } | ||
155 | |||
156 | /******************************************************************************* | ||
157 | * | ||
158 | * FUNCTION: acpi_ev_disable_gpe | ||
159 | * | ||
160 | * PARAMETERS: gpe_event_info - GPE to disable | ||
161 | * | ||
162 | * RETURN: Status | ||
163 | * | ||
164 | * DESCRIPTION: Hardware-disable a GPE. Always disables the requested GPE, | ||
165 | * regardless of the type or number of references. | ||
166 | * | ||
167 | * Note: The GPE lock should be already acquired when this function is called. | ||
168 | * | ||
169 | ******************************************************************************/ | ||
170 | |||
171 | acpi_status acpi_ev_disable_gpe(struct acpi_gpe_event_info *gpe_event_info) | ||
172 | { | ||
173 | acpi_status status; | ||
174 | |||
175 | ACPI_FUNCTION_TRACE(ev_disable_gpe); | ||
176 | |||
177 | |||
178 | /* | ||
179 | * Note: Always disable the GPE, even if we think that that it is already | ||
180 | * disabled. It is possible that the AML or some other code has enabled | ||
181 | * the GPE behind our back. | ||
182 | */ | ||
183 | |||
184 | /* Ensure the HW enable masks are current */ | ||
185 | |||
186 | status = acpi_ev_update_gpe_enable_masks(gpe_event_info); | ||
187 | if (ACPI_FAILURE(status)) { | ||
188 | return_ACPI_STATUS(status); | ||
189 | } | ||
190 | |||
191 | /* | ||
192 | * Always H/W disable this GPE, even if we don't know the GPE type. | ||
193 | * Simply clear the enable bit for this particular GPE, but do not | ||
194 | * write out the current GPE enable mask since this may inadvertently | ||
195 | * enable GPEs too early. An example is a rogue GPE that has arrived | ||
196 | * during ACPICA initialization - possibly because AML or other code | ||
197 | * has enabled the GPE. | ||
198 | */ | ||
199 | status = acpi_hw_low_disable_gpe(gpe_event_info); | ||
200 | return_ACPI_STATUS(status); | ||
201 | } | ||
202 | |||
203 | 102 | ||
204 | /******************************************************************************* | 103 | /******************************************************************************* |
205 | * | 104 | * |
@@ -451,10 +350,6 @@ static void ACPI_SYSTEM_XFACE acpi_ev_asynch_execute_gpe_method(void *context) | |||
451 | return_VOID; | 350 | return_VOID; |
452 | } | 351 | } |
453 | 352 | ||
454 | /* Update the GPE register masks for return to enabled state */ | ||
455 | |||
456 | (void)acpi_ev_update_gpe_enable_masks(gpe_event_info); | ||
457 | |||
458 | /* | 353 | /* |
459 | * Take a snapshot of the GPE info for this level - we copy the info to | 354 | * Take a snapshot of the GPE info for this level - we copy the info to |
460 | * prevent a race condition with remove_handler/remove_block. | 355 | * prevent a race condition with remove_handler/remove_block. |
@@ -607,7 +502,7 @@ acpi_ev_gpe_dispatch(struct acpi_gpe_event_info *gpe_event_info, u32 gpe_number) | |||
607 | * Disable the GPE, so it doesn't keep firing before the method has a | 502 | * Disable the GPE, so it doesn't keep firing before the method has a |
608 | * chance to run (it runs asynchronously with interrupts enabled). | 503 | * chance to run (it runs asynchronously with interrupts enabled). |
609 | */ | 504 | */ |
610 | status = acpi_ev_disable_gpe(gpe_event_info); | 505 | status = acpi_hw_low_set_gpe(gpe_event_info, ACPI_GPE_DISABLE); |
611 | if (ACPI_FAILURE(status)) { | 506 | if (ACPI_FAILURE(status)) { |
612 | ACPI_EXCEPTION((AE_INFO, status, | 507 | ACPI_EXCEPTION((AE_INFO, status, |
613 | "Unable to disable GPE[0x%2X]", | 508 | "Unable to disable GPE[0x%2X]", |
@@ -644,7 +539,7 @@ acpi_ev_gpe_dispatch(struct acpi_gpe_event_info *gpe_event_info, u32 gpe_number) | |||
644 | * Disable the GPE. The GPE will remain disabled a handler | 539 | * Disable the GPE. The GPE will remain disabled a handler |
645 | * is installed or ACPICA is restarted. | 540 | * is installed or ACPICA is restarted. |
646 | */ | 541 | */ |
647 | status = acpi_ev_disable_gpe(gpe_event_info); | 542 | status = acpi_hw_low_set_gpe(gpe_event_info, ACPI_GPE_DISABLE); |
648 | if (ACPI_FAILURE(status)) { | 543 | if (ACPI_FAILURE(status)) { |
649 | ACPI_EXCEPTION((AE_INFO, status, | 544 | ACPI_EXCEPTION((AE_INFO, status, |
650 | "Unable to disable GPE[0x%2X]", | 545 | "Unable to disable GPE[0x%2X]", |
diff --git a/drivers/acpi/acpica/evgpeblk.c b/drivers/acpi/acpica/evgpeblk.c index 7c28f2d9fd35..341a38ce8aa6 100644 --- a/drivers/acpi/acpica/evgpeblk.c +++ b/drivers/acpi/acpica/evgpeblk.c | |||
@@ -500,6 +500,19 @@ acpi_ev_initialize_gpe_block(struct acpi_namespace_node *gpe_device, | |||
500 | 500 | ||
501 | gpe_index = (i * ACPI_GPE_REGISTER_WIDTH) + j; | 501 | gpe_index = (i * ACPI_GPE_REGISTER_WIDTH) + j; |
502 | gpe_event_info = &gpe_block->event_info[gpe_index]; | 502 | gpe_event_info = &gpe_block->event_info[gpe_index]; |
503 | gpe_number = gpe_index + gpe_block->block_base_number; | ||
504 | |||
505 | /* | ||
506 | * If the GPE has already been enabled for runtime | ||
507 | * signaling, make sure it remains enabled, but do not | ||
508 | * increment its reference counter. | ||
509 | */ | ||
510 | if (gpe_event_info->runtime_count) { | ||
511 | acpi_set_gpe(gpe_device, gpe_number, | ||
512 | ACPI_GPE_ENABLE); | ||
513 | gpe_enabled_count++; | ||
514 | continue; | ||
515 | } | ||
503 | 516 | ||
504 | if (gpe_event_info->flags & ACPI_GPE_CAN_WAKE) { | 517 | if (gpe_event_info->flags & ACPI_GPE_CAN_WAKE) { |
505 | wake_gpe_count++; | 518 | wake_gpe_count++; |
@@ -516,7 +529,6 @@ acpi_ev_initialize_gpe_block(struct acpi_namespace_node *gpe_device, | |||
516 | 529 | ||
517 | /* Enable this GPE */ | 530 | /* Enable this GPE */ |
518 | 531 | ||
519 | gpe_number = gpe_index + gpe_block->block_base_number; | ||
520 | status = acpi_enable_gpe(gpe_device, gpe_number, | 532 | status = acpi_enable_gpe(gpe_device, gpe_number, |
521 | ACPI_GPE_TYPE_RUNTIME); | 533 | ACPI_GPE_TYPE_RUNTIME); |
522 | if (ACPI_FAILURE(status)) { | 534 | if (ACPI_FAILURE(status)) { |
diff --git a/drivers/acpi/acpica/evxface.c b/drivers/acpi/acpica/evxface.c index cc825023012a..4a531cdf7942 100644 --- a/drivers/acpi/acpica/evxface.c +++ b/drivers/acpi/acpica/evxface.c | |||
@@ -719,13 +719,6 @@ acpi_install_gpe_handler(acpi_handle gpe_device, | |||
719 | handler->context = context; | 719 | handler->context = context; |
720 | handler->method_node = gpe_event_info->dispatch.method_node; | 720 | handler->method_node = gpe_event_info->dispatch.method_node; |
721 | 721 | ||
722 | /* Disable the GPE before installing the handler */ | ||
723 | |||
724 | status = acpi_ev_disable_gpe(gpe_event_info); | ||
725 | if (ACPI_FAILURE (status)) { | ||
726 | goto unlock_and_exit; | ||
727 | } | ||
728 | |||
729 | /* Install the handler */ | 722 | /* Install the handler */ |
730 | 723 | ||
731 | flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock); | 724 | flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock); |
diff --git a/drivers/acpi/acpica/evxfevnt.c b/drivers/acpi/acpica/evxfevnt.c index d5a5efc043bf..d97b8dce1668 100644 --- a/drivers/acpi/acpica/evxfevnt.c +++ b/drivers/acpi/acpica/evxfevnt.c | |||
@@ -210,6 +210,44 @@ ACPI_EXPORT_SYMBOL(acpi_enable_event) | |||
210 | 210 | ||
211 | /******************************************************************************* | 211 | /******************************************************************************* |
212 | * | 212 | * |
213 | * FUNCTION: acpi_clear_and_enable_gpe | ||
214 | * | ||
215 | * PARAMETERS: gpe_event_info - GPE to enable | ||
216 | * | ||
217 | * RETURN: Status | ||
218 | * | ||
219 | * DESCRIPTION: Clear the given GPE from stale events and enable it. | ||
220 | * | ||
221 | ******************************************************************************/ | ||
222 | static acpi_status | ||
223 | acpi_clear_and_enable_gpe(struct acpi_gpe_event_info *gpe_event_info) | ||
224 | { | ||
225 | acpi_status status; | ||
226 | |||
227 | /* | ||
228 | * We will only allow a GPE to be enabled if it has either an | ||
229 | * associated method (_Lxx/_Exx) or a handler. Otherwise, the | ||
230 | * GPE will be immediately disabled by acpi_ev_gpe_dispatch the | ||
231 | * first time it fires. | ||
232 | */ | ||
233 | if (!(gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK)) { | ||
234 | return_ACPI_STATUS(AE_NO_HANDLER); | ||
235 | } | ||
236 | |||
237 | /* Clear the GPE (of stale events) */ | ||
238 | status = acpi_hw_clear_gpe(gpe_event_info); | ||
239 | if (ACPI_FAILURE(status)) { | ||
240 | return_ACPI_STATUS(status); | ||
241 | } | ||
242 | |||
243 | /* Enable the requested GPE */ | ||
244 | status = acpi_hw_low_set_gpe(gpe_event_info, ACPI_GPE_ENABLE); | ||
245 | |||
246 | return_ACPI_STATUS(status); | ||
247 | } | ||
248 | |||
249 | /******************************************************************************* | ||
250 | * | ||
213 | * FUNCTION: acpi_set_gpe | 251 | * FUNCTION: acpi_set_gpe |
214 | * | 252 | * |
215 | * PARAMETERS: gpe_device - Parent GPE Device. NULL for GPE0/GPE1 | 253 | * PARAMETERS: gpe_device - Parent GPE Device. NULL for GPE0/GPE1 |
@@ -249,11 +287,11 @@ acpi_status acpi_set_gpe(acpi_handle gpe_device, u32 gpe_number, u8 action) | |||
249 | 287 | ||
250 | switch (action) { | 288 | switch (action) { |
251 | case ACPI_GPE_ENABLE: | 289 | case ACPI_GPE_ENABLE: |
252 | status = acpi_ev_enable_gpe(gpe_event_info); | 290 | status = acpi_clear_and_enable_gpe(gpe_event_info); |
253 | break; | 291 | break; |
254 | 292 | ||
255 | case ACPI_GPE_DISABLE: | 293 | case ACPI_GPE_DISABLE: |
256 | status = acpi_ev_disable_gpe(gpe_event_info); | 294 | status = acpi_hw_low_set_gpe(gpe_event_info, ACPI_GPE_DISABLE); |
257 | break; | 295 | break; |
258 | 296 | ||
259 | default: | 297 | default: |
@@ -316,7 +354,11 @@ acpi_status acpi_enable_gpe(acpi_handle gpe_device, u32 gpe_number, u8 gpe_type) | |||
316 | 354 | ||
317 | gpe_event_info->runtime_count++; | 355 | gpe_event_info->runtime_count++; |
318 | if (gpe_event_info->runtime_count == 1) { | 356 | if (gpe_event_info->runtime_count == 1) { |
319 | status = acpi_ev_enable_gpe(gpe_event_info); | 357 | status = acpi_ev_update_gpe_enable_masks(gpe_event_info); |
358 | if (ACPI_SUCCESS(status)) { | ||
359 | status = acpi_clear_and_enable_gpe(gpe_event_info); | ||
360 | } | ||
361 | |||
320 | if (ACPI_FAILURE(status)) { | 362 | if (ACPI_FAILURE(status)) { |
321 | gpe_event_info->runtime_count--; | 363 | gpe_event_info->runtime_count--; |
322 | goto unlock_and_exit; | 364 | goto unlock_and_exit; |
@@ -343,7 +385,7 @@ acpi_status acpi_enable_gpe(acpi_handle gpe_device, u32 gpe_number, u8 gpe_type) | |||
343 | */ | 385 | */ |
344 | gpe_event_info->wakeup_count++; | 386 | gpe_event_info->wakeup_count++; |
345 | if (gpe_event_info->wakeup_count == 1) { | 387 | if (gpe_event_info->wakeup_count == 1) { |
346 | (void)acpi_ev_update_gpe_enable_masks(gpe_event_info); | 388 | status = acpi_ev_update_gpe_enable_masks(gpe_event_info); |
347 | } | 389 | } |
348 | } | 390 | } |
349 | 391 | ||
@@ -403,7 +445,12 @@ acpi_status acpi_disable_gpe(acpi_handle gpe_device, u32 gpe_number, u8 gpe_type | |||
403 | 445 | ||
404 | gpe_event_info->runtime_count--; | 446 | gpe_event_info->runtime_count--; |
405 | if (!gpe_event_info->runtime_count) { | 447 | if (!gpe_event_info->runtime_count) { |
406 | status = acpi_ev_disable_gpe(gpe_event_info); | 448 | status = acpi_ev_update_gpe_enable_masks(gpe_event_info); |
449 | if (ACPI_SUCCESS(status)) { | ||
450 | status = acpi_hw_low_set_gpe(gpe_event_info, | ||
451 | ACPI_GPE_DISABLE); | ||
452 | } | ||
453 | |||
407 | if (ACPI_FAILURE(status)) { | 454 | if (ACPI_FAILURE(status)) { |
408 | gpe_event_info->runtime_count++; | 455 | gpe_event_info->runtime_count++; |
409 | goto unlock_and_exit; | 456 | goto unlock_and_exit; |
@@ -424,7 +471,7 @@ acpi_status acpi_disable_gpe(acpi_handle gpe_device, u32 gpe_number, u8 gpe_type | |||
424 | 471 | ||
425 | gpe_event_info->wakeup_count--; | 472 | gpe_event_info->wakeup_count--; |
426 | if (!gpe_event_info->wakeup_count) { | 473 | if (!gpe_event_info->wakeup_count) { |
427 | (void)acpi_ev_update_gpe_enable_masks(gpe_event_info); | 474 | status = acpi_ev_update_gpe_enable_masks(gpe_event_info); |
428 | } | 475 | } |
429 | } | 476 | } |
430 | 477 | ||
diff --git a/drivers/acpi/acpica/exsystem.c b/drivers/acpi/acpica/exsystem.c index 6d32e09327f1..675aaa91a770 100644 --- a/drivers/acpi/acpica/exsystem.c +++ b/drivers/acpi/acpica/exsystem.c | |||
@@ -201,6 +201,14 @@ acpi_status acpi_ex_system_do_sleep(u64 how_long) | |||
201 | 201 | ||
202 | acpi_ex_relinquish_interpreter(); | 202 | acpi_ex_relinquish_interpreter(); |
203 | 203 | ||
204 | /* | ||
205 | * For compatibility with other ACPI implementations and to prevent | ||
206 | * accidental deep sleeps, limit the sleep time to something reasonable. | ||
207 | */ | ||
208 | if (how_long > ACPI_MAX_SLEEP) { | ||
209 | how_long = ACPI_MAX_SLEEP; | ||
210 | } | ||
211 | |||
204 | acpi_os_sleep(how_long); | 212 | acpi_os_sleep(how_long); |
205 | 213 | ||
206 | /* And now we must get the interpreter again */ | 214 | /* And now we must get the interpreter again */ |
diff --git a/drivers/acpi/acpica/hwgpe.c b/drivers/acpi/acpica/hwgpe.c index bd72319a38f0..3450309c2786 100644 --- a/drivers/acpi/acpica/hwgpe.c +++ b/drivers/acpi/acpica/hwgpe.c | |||
@@ -57,21 +57,47 @@ acpi_hw_enable_wakeup_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info, | |||
57 | 57 | ||
58 | /****************************************************************************** | 58 | /****************************************************************************** |
59 | * | 59 | * |
60 | * FUNCTION: acpi_hw_low_disable_gpe | 60 | * FUNCTION: acpi_hw_gpe_register_bit |
61 | * | ||
62 | * PARAMETERS: gpe_event_info - Info block for the GPE | ||
63 | * gpe_register_info - Info block for the GPE register | ||
64 | * | ||
65 | * RETURN: Status | ||
66 | * | ||
67 | * DESCRIPTION: Compute GPE enable mask with one bit corresponding to the given | ||
68 | * GPE set. | ||
69 | * | ||
70 | ******************************************************************************/ | ||
71 | |||
72 | u32 acpi_hw_gpe_register_bit(struct acpi_gpe_event_info *gpe_event_info, | ||
73 | struct acpi_gpe_register_info *gpe_register_info) | ||
74 | { | ||
75 | return (u32)1 << (gpe_event_info->gpe_number - | ||
76 | gpe_register_info->base_gpe_number); | ||
77 | } | ||
78 | |||
79 | /****************************************************************************** | ||
80 | * | ||
81 | * FUNCTION: acpi_hw_low_set_gpe | ||
61 | * | 82 | * |
62 | * PARAMETERS: gpe_event_info - Info block for the GPE to be disabled | 83 | * PARAMETERS: gpe_event_info - Info block for the GPE to be disabled |
84 | * action - Enable or disable | ||
63 | * | 85 | * |
64 | * RETURN: Status | 86 | * RETURN: Status |
65 | * | 87 | * |
66 | * DESCRIPTION: Disable a single GPE in the enable register. | 88 | * DESCRIPTION: Enable or disable a single GPE in its enable register. |
67 | * | 89 | * |
68 | ******************************************************************************/ | 90 | ******************************************************************************/ |
69 | 91 | ||
70 | acpi_status acpi_hw_low_disable_gpe(struct acpi_gpe_event_info *gpe_event_info) | 92 | acpi_status |
93 | acpi_hw_low_set_gpe(struct acpi_gpe_event_info *gpe_event_info, u8 action) | ||
71 | { | 94 | { |
72 | struct acpi_gpe_register_info *gpe_register_info; | 95 | struct acpi_gpe_register_info *gpe_register_info; |
73 | acpi_status status; | 96 | acpi_status status; |
74 | u32 enable_mask; | 97 | u32 enable_mask; |
98 | u32 register_bit; | ||
99 | |||
100 | ACPI_FUNCTION_ENTRY(); | ||
75 | 101 | ||
76 | /* Get the info block for the entire GPE register */ | 102 | /* Get the info block for the entire GPE register */ |
77 | 103 | ||
@@ -87,11 +113,27 @@ acpi_status acpi_hw_low_disable_gpe(struct acpi_gpe_event_info *gpe_event_info) | |||
87 | return (status); | 113 | return (status); |
88 | } | 114 | } |
89 | 115 | ||
90 | /* Clear just the bit that corresponds to this GPE */ | 116 | /* Set ot clear just the bit that corresponds to this GPE */ |
91 | 117 | ||
92 | ACPI_CLEAR_BIT(enable_mask, ((u32)1 << | 118 | register_bit = acpi_hw_gpe_register_bit(gpe_event_info, |
93 | (gpe_event_info->gpe_number - | 119 | gpe_register_info); |
94 | gpe_register_info->base_gpe_number))); | 120 | switch (action) { |
121 | case ACPI_GPE_COND_ENABLE: | ||
122 | if (!(register_bit & gpe_register_info->enable_for_run)) | ||
123 | return (AE_BAD_PARAMETER); | ||
124 | |||
125 | case ACPI_GPE_ENABLE: | ||
126 | ACPI_SET_BIT(enable_mask, register_bit); | ||
127 | break; | ||
128 | |||
129 | case ACPI_GPE_DISABLE: | ||
130 | ACPI_CLEAR_BIT(enable_mask, register_bit); | ||
131 | break; | ||
132 | |||
133 | default: | ||
134 | ACPI_ERROR((AE_INFO, "Invalid action\n")); | ||
135 | return (AE_BAD_PARAMETER); | ||
136 | } | ||
95 | 137 | ||
96 | /* Write the updated enable mask */ | 138 | /* Write the updated enable mask */ |
97 | 139 | ||
@@ -116,23 +158,11 @@ acpi_status acpi_hw_low_disable_gpe(struct acpi_gpe_event_info *gpe_event_info) | |||
116 | acpi_status | 158 | acpi_status |
117 | acpi_hw_write_gpe_enable_reg(struct acpi_gpe_event_info * gpe_event_info) | 159 | acpi_hw_write_gpe_enable_reg(struct acpi_gpe_event_info * gpe_event_info) |
118 | { | 160 | { |
119 | struct acpi_gpe_register_info *gpe_register_info; | ||
120 | acpi_status status; | 161 | acpi_status status; |
121 | 162 | ||
122 | ACPI_FUNCTION_ENTRY(); | 163 | ACPI_FUNCTION_ENTRY(); |
123 | 164 | ||
124 | /* Get the info block for the entire GPE register */ | 165 | status = acpi_hw_low_set_gpe(gpe_event_info, ACPI_GPE_COND_ENABLE); |
125 | |||
126 | gpe_register_info = gpe_event_info->register_info; | ||
127 | if (!gpe_register_info) { | ||
128 | return (AE_NOT_EXIST); | ||
129 | } | ||
130 | |||
131 | /* Write the entire GPE (runtime) enable register */ | ||
132 | |||
133 | status = acpi_hw_write(gpe_register_info->enable_for_run, | ||
134 | &gpe_register_info->enable_address); | ||
135 | |||
136 | return (status); | 166 | return (status); |
137 | } | 167 | } |
138 | 168 | ||
@@ -150,21 +180,28 @@ acpi_hw_write_gpe_enable_reg(struct acpi_gpe_event_info * gpe_event_info) | |||
150 | 180 | ||
151 | acpi_status acpi_hw_clear_gpe(struct acpi_gpe_event_info * gpe_event_info) | 181 | acpi_status acpi_hw_clear_gpe(struct acpi_gpe_event_info * gpe_event_info) |
152 | { | 182 | { |
183 | struct acpi_gpe_register_info *gpe_register_info; | ||
153 | acpi_status status; | 184 | acpi_status status; |
154 | u8 register_bit; | 185 | u32 register_bit; |
155 | 186 | ||
156 | ACPI_FUNCTION_ENTRY(); | 187 | ACPI_FUNCTION_ENTRY(); |
157 | 188 | ||
158 | register_bit = (u8)(1 << | 189 | /* Get the info block for the entire GPE register */ |
159 | (gpe_event_info->gpe_number - | 190 | |
160 | gpe_event_info->register_info->base_gpe_number)); | 191 | gpe_register_info = gpe_event_info->register_info; |
192 | if (!gpe_register_info) { | ||
193 | return (AE_NOT_EXIST); | ||
194 | } | ||
195 | |||
196 | register_bit = acpi_hw_gpe_register_bit(gpe_event_info, | ||
197 | gpe_register_info); | ||
161 | 198 | ||
162 | /* | 199 | /* |
163 | * Write a one to the appropriate bit in the status register to | 200 | * Write a one to the appropriate bit in the status register to |
164 | * clear this GPE. | 201 | * clear this GPE. |
165 | */ | 202 | */ |
166 | status = acpi_hw_write(register_bit, | 203 | status = acpi_hw_write(register_bit, |
167 | &gpe_event_info->register_info->status_address); | 204 | &gpe_register_info->status_address); |
168 | 205 | ||
169 | return (status); | 206 | return (status); |
170 | } | 207 | } |
@@ -187,7 +224,7 @@ acpi_hw_get_gpe_status(struct acpi_gpe_event_info * gpe_event_info, | |||
187 | acpi_event_status * event_status) | 224 | acpi_event_status * event_status) |
188 | { | 225 | { |
189 | u32 in_byte; | 226 | u32 in_byte; |
190 | u8 register_bit; | 227 | u32 register_bit; |
191 | struct acpi_gpe_register_info *gpe_register_info; | 228 | struct acpi_gpe_register_info *gpe_register_info; |
192 | acpi_status status; | 229 | acpi_status status; |
193 | acpi_event_status local_event_status = 0; | 230 | acpi_event_status local_event_status = 0; |
@@ -204,9 +241,8 @@ acpi_hw_get_gpe_status(struct acpi_gpe_event_info * gpe_event_info, | |||
204 | 241 | ||
205 | /* Get the register bitmask for this GPE */ | 242 | /* Get the register bitmask for this GPE */ |
206 | 243 | ||
207 | register_bit = (u8)(1 << | 244 | register_bit = acpi_hw_gpe_register_bit(gpe_event_info, |
208 | (gpe_event_info->gpe_number - | 245 | gpe_register_info); |
209 | gpe_event_info->register_info->base_gpe_number)); | ||
210 | 246 | ||
211 | /* GPE currently enabled? (enabled for runtime?) */ | 247 | /* GPE currently enabled? (enabled for runtime?) */ |
212 | 248 | ||
diff --git a/drivers/acpi/acpica/hwvalid.c b/drivers/acpi/acpica/hwvalid.c index c10d587c1641..e1d9c777b213 100644 --- a/drivers/acpi/acpica/hwvalid.c +++ b/drivers/acpi/acpica/hwvalid.c | |||
@@ -222,6 +222,12 @@ acpi_status acpi_hw_read_port(acpi_io_address address, u32 *value, u32 width) | |||
222 | u32 one_byte; | 222 | u32 one_byte; |
223 | u32 i; | 223 | u32 i; |
224 | 224 | ||
225 | /* Truncate address to 16 bits if requested */ | ||
226 | |||
227 | if (acpi_gbl_truncate_io_addresses) { | ||
228 | address &= ACPI_UINT16_MAX; | ||
229 | } | ||
230 | |||
225 | /* Validate the entire request and perform the I/O */ | 231 | /* Validate the entire request and perform the I/O */ |
226 | 232 | ||
227 | status = acpi_hw_validate_io_request(address, width); | 233 | status = acpi_hw_validate_io_request(address, width); |
@@ -279,6 +285,12 @@ acpi_status acpi_hw_write_port(acpi_io_address address, u32 value, u32 width) | |||
279 | acpi_status status; | 285 | acpi_status status; |
280 | u32 i; | 286 | u32 i; |
281 | 287 | ||
288 | /* Truncate address to 16 bits if requested */ | ||
289 | |||
290 | if (acpi_gbl_truncate_io_addresses) { | ||
291 | address &= ACPI_UINT16_MAX; | ||
292 | } | ||
293 | |||
282 | /* Validate the entire request and perform the I/O */ | 294 | /* Validate the entire request and perform the I/O */ |
283 | 295 | ||
284 | status = acpi_hw_validate_io_request(address, width); | 296 | status = acpi_hw_validate_io_request(address, width); |
diff --git a/drivers/acpi/acpica/nsinit.c b/drivers/acpi/acpica/nsinit.c index 9bd6f050f299..4e5272c313e0 100644 --- a/drivers/acpi/acpica/nsinit.c +++ b/drivers/acpi/acpica/nsinit.c | |||
@@ -193,6 +193,15 @@ acpi_status acpi_ns_initialize_devices(void) | |||
193 | acpi_ns_init_one_device, NULL, &info, | 193 | acpi_ns_init_one_device, NULL, &info, |
194 | NULL); | 194 | NULL); |
195 | 195 | ||
196 | /* | ||
197 | * Any _OSI requests should be completed by now. If the BIOS has | ||
198 | * requested any Windows OSI strings, we will always truncate | ||
199 | * I/O addresses to 16 bits -- for Windows compatibility. | ||
200 | */ | ||
201 | if (acpi_gbl_osi_data >= ACPI_OSI_WIN_2000) { | ||
202 | acpi_gbl_truncate_io_addresses = TRUE; | ||
203 | } | ||
204 | |||
196 | ACPI_FREE(info.evaluate_info); | 205 | ACPI_FREE(info.evaluate_info); |
197 | if (ACPI_FAILURE(status)) { | 206 | if (ACPI_FAILURE(status)) { |
198 | goto error_exit; | 207 | goto error_exit; |
diff --git a/drivers/acpi/apei/apei-base.c b/drivers/acpi/apei/apei-base.c index db3946e9c66b..216e1e948ff6 100644 --- a/drivers/acpi/apei/apei-base.c +++ b/drivers/acpi/apei/apei-base.c | |||
@@ -34,6 +34,7 @@ | |||
34 | #include <linux/module.h> | 34 | #include <linux/module.h> |
35 | #include <linux/init.h> | 35 | #include <linux/init.h> |
36 | #include <linux/acpi.h> | 36 | #include <linux/acpi.h> |
37 | #include <linux/slab.h> | ||
37 | #include <linux/io.h> | 38 | #include <linux/io.h> |
38 | #include <linux/kref.h> | 39 | #include <linux/kref.h> |
39 | #include <linux/rculist.h> | 40 | #include <linux/rculist.h> |
diff --git a/drivers/acpi/atomicio.c b/drivers/acpi/atomicio.c index 814b19249616..8f8bd736d4ff 100644 --- a/drivers/acpi/atomicio.c +++ b/drivers/acpi/atomicio.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #include <linux/kref.h> | 31 | #include <linux/kref.h> |
32 | #include <linux/rculist.h> | 32 | #include <linux/rculist.h> |
33 | #include <linux/interrupt.h> | 33 | #include <linux/interrupt.h> |
34 | #include <linux/slab.h> | ||
34 | #include <acpi/atomicio.h> | 35 | #include <acpi/atomicio.h> |
35 | 36 | ||
36 | #define ACPI_PFX "ACPI: " | 37 | #define ACPI_PFX "ACPI: " |
diff --git a/drivers/acpi/blacklist.c b/drivers/acpi/blacklist.c index 2815df66f6f7..01381be05e96 100644 --- a/drivers/acpi/blacklist.c +++ b/drivers/acpi/blacklist.c | |||
@@ -218,6 +218,14 @@ static struct dmi_system_id acpi_osi_dmi_table[] __initdata = { | |||
218 | }, | 218 | }, |
219 | }, | 219 | }, |
220 | { | 220 | { |
221 | .callback = dmi_disable_osi_vista, | ||
222 | .ident = "VGN-NS50B_L", | ||
223 | .matches = { | ||
224 | DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"), | ||
225 | DMI_MATCH(DMI_PRODUCT_NAME, "VGN-NS50B_L"), | ||
226 | }, | ||
227 | }, | ||
228 | { | ||
221 | .callback = dmi_disable_osi_win7, | 229 | .callback = dmi_disable_osi_win7, |
222 | .ident = "ASUS K50IJ", | 230 | .ident = "ASUS K50IJ", |
223 | .matches = { | 231 | .matches = { |
diff --git a/drivers/acpi/button.c b/drivers/acpi/button.c index fd51c4ab4829..7d857dabdde4 100644 --- a/drivers/acpi/button.c +++ b/drivers/acpi/button.c | |||
@@ -425,7 +425,7 @@ static int acpi_button_add(struct acpi_device *device) | |||
425 | /* Button's GPE is run-wake GPE */ | 425 | /* Button's GPE is run-wake GPE */ |
426 | acpi_enable_gpe(device->wakeup.gpe_device, | 426 | acpi_enable_gpe(device->wakeup.gpe_device, |
427 | device->wakeup.gpe_number, | 427 | device->wakeup.gpe_number, |
428 | ACPI_GPE_TYPE_WAKE_RUN); | 428 | ACPI_GPE_TYPE_RUNTIME); |
429 | device->wakeup.run_wake_count++; | 429 | device->wakeup.run_wake_count++; |
430 | device->wakeup.state.enabled = 1; | 430 | device->wakeup.state.enabled = 1; |
431 | } | 431 | } |
@@ -449,7 +449,7 @@ static int acpi_button_remove(struct acpi_device *device, int type) | |||
449 | if (device->wakeup.flags.valid) { | 449 | if (device->wakeup.flags.valid) { |
450 | acpi_disable_gpe(device->wakeup.gpe_device, | 450 | acpi_disable_gpe(device->wakeup.gpe_device, |
451 | device->wakeup.gpe_number, | 451 | device->wakeup.gpe_number, |
452 | ACPI_GPE_TYPE_WAKE_RUN); | 452 | ACPI_GPE_TYPE_RUNTIME); |
453 | device->wakeup.run_wake_count--; | 453 | device->wakeup.run_wake_count--; |
454 | device->wakeup.state.enabled = 0; | 454 | device->wakeup.state.enabled = 0; |
455 | } | 455 | } |
diff --git a/drivers/acpi/fan.c b/drivers/acpi/fan.c index acf2ab249842..8a3b840c0bb2 100644 --- a/drivers/acpi/fan.c +++ b/drivers/acpi/fan.c | |||
@@ -347,7 +347,6 @@ static int __init acpi_fan_init(void) | |||
347 | { | 347 | { |
348 | int result = 0; | 348 | int result = 0; |
349 | 349 | ||
350 | |||
351 | #ifdef CONFIG_ACPI_PROCFS | 350 | #ifdef CONFIG_ACPI_PROCFS |
352 | acpi_fan_dir = proc_mkdir(ACPI_FAN_CLASS, acpi_root_dir); | 351 | acpi_fan_dir = proc_mkdir(ACPI_FAN_CLASS, acpi_root_dir); |
353 | if (!acpi_fan_dir) | 352 | if (!acpi_fan_dir) |
@@ -356,7 +355,9 @@ static int __init acpi_fan_init(void) | |||
356 | 355 | ||
357 | result = acpi_bus_register_driver(&acpi_fan_driver); | 356 | result = acpi_bus_register_driver(&acpi_fan_driver); |
358 | if (result < 0) { | 357 | if (result < 0) { |
358 | #ifdef CONFIG_ACPI_PROCFS | ||
359 | remove_proc_entry(ACPI_FAN_CLASS, acpi_root_dir); | 359 | remove_proc_entry(ACPI_FAN_CLASS, acpi_root_dir); |
360 | #endif | ||
360 | return -ENODEV; | 361 | return -ENODEV; |
361 | } | 362 | } |
362 | 363 | ||
diff --git a/drivers/acpi/processor_driver.c b/drivers/acpi/processor_driver.c index b1034a9ada4e..38ea0cc6dc49 100644 --- a/drivers/acpi/processor_driver.c +++ b/drivers/acpi/processor_driver.c | |||
@@ -581,6 +581,11 @@ static int __cpuinit acpi_processor_add(struct acpi_device *device) | |||
581 | return 0; | 581 | return 0; |
582 | } | 582 | } |
583 | 583 | ||
584 | #ifdef CONFIG_SMP | ||
585 | if (pr->id >= setup_max_cpus && pr->id != 0) | ||
586 | return 0; | ||
587 | #endif | ||
588 | |||
584 | BUG_ON((pr->id >= nr_cpu_ids) || (pr->id < 0)); | 589 | BUG_ON((pr->id >= nr_cpu_ids) || (pr->id < 0)); |
585 | 590 | ||
586 | /* | 591 | /* |
diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c index 3fb4bdea7e06..5b7c52e4a00f 100644 --- a/drivers/acpi/sleep.c +++ b/drivers/acpi/sleep.c | |||
@@ -114,6 +114,8 @@ static int __acpi_pm_prepare(void) | |||
114 | { | 114 | { |
115 | int error = acpi_sleep_prepare(acpi_target_sleep_state); | 115 | int error = acpi_sleep_prepare(acpi_target_sleep_state); |
116 | 116 | ||
117 | suspend_nvs_save(); | ||
118 | |||
117 | if (error) | 119 | if (error) |
118 | acpi_target_sleep_state = ACPI_STATE_S0; | 120 | acpi_target_sleep_state = ACPI_STATE_S0; |
119 | return error; | 121 | return error; |
@@ -143,6 +145,9 @@ static void acpi_pm_finish(void) | |||
143 | { | 145 | { |
144 | u32 acpi_state = acpi_target_sleep_state; | 146 | u32 acpi_state = acpi_target_sleep_state; |
145 | 147 | ||
148 | suspend_nvs_free(); | ||
149 | acpi_ec_unblock_transactions(); | ||
150 | |||
146 | if (acpi_state == ACPI_STATE_S0) | 151 | if (acpi_state == ACPI_STATE_S0) |
147 | return; | 152 | return; |
148 | 153 | ||
@@ -192,6 +197,11 @@ static int acpi_suspend_begin(suspend_state_t pm_state) | |||
192 | u32 acpi_state = acpi_suspend_states[pm_state]; | 197 | u32 acpi_state = acpi_suspend_states[pm_state]; |
193 | int error = 0; | 198 | int error = 0; |
194 | 199 | ||
200 | error = suspend_nvs_alloc(); | ||
201 | |||
202 | if (error) | ||
203 | return error; | ||
204 | |||
195 | if (sleep_states[acpi_state]) { | 205 | if (sleep_states[acpi_state]) { |
196 | acpi_target_sleep_state = acpi_state; | 206 | acpi_target_sleep_state = acpi_state; |
197 | acpi_sleep_tts_switch(acpi_target_sleep_state); | 207 | acpi_sleep_tts_switch(acpi_target_sleep_state); |
@@ -269,12 +279,13 @@ static int acpi_suspend_enter(suspend_state_t pm_state) | |||
269 | if (acpi_state == ACPI_STATE_S3) | 279 | if (acpi_state == ACPI_STATE_S3) |
270 | acpi_restore_state_mem(); | 280 | acpi_restore_state_mem(); |
271 | 281 | ||
282 | suspend_nvs_restore(); | ||
283 | |||
272 | return ACPI_SUCCESS(status) ? 0 : -EFAULT; | 284 | return ACPI_SUCCESS(status) ? 0 : -EFAULT; |
273 | } | 285 | } |
274 | 286 | ||
275 | static void acpi_suspend_finish(void) | 287 | static void acpi_suspend_finish(void) |
276 | { | 288 | { |
277 | acpi_ec_unblock_transactions(); | ||
278 | acpi_pm_finish(); | 289 | acpi_pm_finish(); |
279 | } | 290 | } |
280 | 291 | ||
@@ -404,7 +415,7 @@ static int acpi_hibernation_begin(void) | |||
404 | { | 415 | { |
405 | int error; | 416 | int error; |
406 | 417 | ||
407 | error = s4_no_nvs ? 0 : hibernate_nvs_alloc(); | 418 | error = s4_no_nvs ? 0 : suspend_nvs_alloc(); |
408 | if (!error) { | 419 | if (!error) { |
409 | acpi_target_sleep_state = ACPI_STATE_S4; | 420 | acpi_target_sleep_state = ACPI_STATE_S4; |
410 | acpi_sleep_tts_switch(acpi_target_sleep_state); | 421 | acpi_sleep_tts_switch(acpi_target_sleep_state); |
@@ -418,7 +429,7 @@ static int acpi_hibernation_pre_snapshot(void) | |||
418 | int error = acpi_pm_prepare(); | 429 | int error = acpi_pm_prepare(); |
419 | 430 | ||
420 | if (!error) | 431 | if (!error) |
421 | hibernate_nvs_save(); | 432 | suspend_nvs_save(); |
422 | 433 | ||
423 | return error; | 434 | return error; |
424 | } | 435 | } |
@@ -441,13 +452,6 @@ static int acpi_hibernation_enter(void) | |||
441 | return ACPI_SUCCESS(status) ? 0 : -EFAULT; | 452 | return ACPI_SUCCESS(status) ? 0 : -EFAULT; |
442 | } | 453 | } |
443 | 454 | ||
444 | static void acpi_hibernation_finish(void) | ||
445 | { | ||
446 | hibernate_nvs_free(); | ||
447 | acpi_ec_unblock_transactions(); | ||
448 | acpi_pm_finish(); | ||
449 | } | ||
450 | |||
451 | static void acpi_hibernation_leave(void) | 455 | static void acpi_hibernation_leave(void) |
452 | { | 456 | { |
453 | /* | 457 | /* |
@@ -464,7 +468,7 @@ static void acpi_hibernation_leave(void) | |||
464 | panic("ACPI S4 hardware signature mismatch"); | 468 | panic("ACPI S4 hardware signature mismatch"); |
465 | } | 469 | } |
466 | /* Restore the NVS memory area */ | 470 | /* Restore the NVS memory area */ |
467 | hibernate_nvs_restore(); | 471 | suspend_nvs_restore(); |
468 | /* Allow EC transactions to happen. */ | 472 | /* Allow EC transactions to happen. */ |
469 | acpi_ec_unblock_transactions_early(); | 473 | acpi_ec_unblock_transactions_early(); |
470 | } | 474 | } |
@@ -479,7 +483,7 @@ static struct platform_hibernation_ops acpi_hibernation_ops = { | |||
479 | .begin = acpi_hibernation_begin, | 483 | .begin = acpi_hibernation_begin, |
480 | .end = acpi_pm_end, | 484 | .end = acpi_pm_end, |
481 | .pre_snapshot = acpi_hibernation_pre_snapshot, | 485 | .pre_snapshot = acpi_hibernation_pre_snapshot, |
482 | .finish = acpi_hibernation_finish, | 486 | .finish = acpi_pm_finish, |
483 | .prepare = acpi_pm_prepare, | 487 | .prepare = acpi_pm_prepare, |
484 | .enter = acpi_hibernation_enter, | 488 | .enter = acpi_hibernation_enter, |
485 | .leave = acpi_hibernation_leave, | 489 | .leave = acpi_hibernation_leave, |
@@ -507,7 +511,7 @@ static int acpi_hibernation_begin_old(void) | |||
507 | 511 | ||
508 | if (!error) { | 512 | if (!error) { |
509 | if (!s4_no_nvs) | 513 | if (!s4_no_nvs) |
510 | error = hibernate_nvs_alloc(); | 514 | error = suspend_nvs_alloc(); |
511 | if (!error) | 515 | if (!error) |
512 | acpi_target_sleep_state = ACPI_STATE_S4; | 516 | acpi_target_sleep_state = ACPI_STATE_S4; |
513 | } | 517 | } |
@@ -517,7 +521,7 @@ static int acpi_hibernation_begin_old(void) | |||
517 | static int acpi_hibernation_pre_snapshot_old(void) | 521 | static int acpi_hibernation_pre_snapshot_old(void) |
518 | { | 522 | { |
519 | acpi_pm_freeze(); | 523 | acpi_pm_freeze(); |
520 | hibernate_nvs_save(); | 524 | suspend_nvs_save(); |
521 | return 0; | 525 | return 0; |
522 | } | 526 | } |
523 | 527 | ||
@@ -529,8 +533,8 @@ static struct platform_hibernation_ops acpi_hibernation_ops_old = { | |||
529 | .begin = acpi_hibernation_begin_old, | 533 | .begin = acpi_hibernation_begin_old, |
530 | .end = acpi_pm_end, | 534 | .end = acpi_pm_end, |
531 | .pre_snapshot = acpi_hibernation_pre_snapshot_old, | 535 | .pre_snapshot = acpi_hibernation_pre_snapshot_old, |
532 | .finish = acpi_hibernation_finish, | ||
533 | .prepare = acpi_pm_freeze, | 536 | .prepare = acpi_pm_freeze, |
537 | .finish = acpi_pm_finish, | ||
534 | .enter = acpi_hibernation_enter, | 538 | .enter = acpi_hibernation_enter, |
535 | .leave = acpi_hibernation_leave, | 539 | .leave = acpi_hibernation_leave, |
536 | .pre_restore = acpi_pm_freeze, | 540 | .pre_restore = acpi_pm_freeze, |
diff --git a/drivers/acpi/system.c b/drivers/acpi/system.c index c79e789ed03a..f8db50a0941c 100644 --- a/drivers/acpi/system.c +++ b/drivers/acpi/system.c | |||
@@ -388,10 +388,12 @@ static ssize_t counter_set(struct kobject *kobj, | |||
388 | if (index < num_gpes) { | 388 | if (index < num_gpes) { |
389 | if (!strcmp(buf, "disable\n") && | 389 | if (!strcmp(buf, "disable\n") && |
390 | (status & ACPI_EVENT_FLAG_ENABLED)) | 390 | (status & ACPI_EVENT_FLAG_ENABLED)) |
391 | result = acpi_set_gpe(handle, index, ACPI_GPE_DISABLE); | 391 | result = acpi_disable_gpe(handle, index, |
392 | ACPI_GPE_TYPE_RUNTIME); | ||
392 | else if (!strcmp(buf, "enable\n") && | 393 | else if (!strcmp(buf, "enable\n") && |
393 | !(status & ACPI_EVENT_FLAG_ENABLED)) | 394 | !(status & ACPI_EVENT_FLAG_ENABLED)) |
394 | result = acpi_set_gpe(handle, index, ACPI_GPE_ENABLE); | 395 | result = acpi_enable_gpe(handle, index, |
396 | ACPI_GPE_TYPE_RUNTIME); | ||
395 | else if (!strcmp(buf, "clear\n") && | 397 | else if (!strcmp(buf, "clear\n") && |
396 | (status & ACPI_EVENT_FLAG_SET)) | 398 | (status & ACPI_EVENT_FLAG_SET)) |
397 | result = acpi_clear_gpe(handle, index); | 399 | result = acpi_clear_gpe(handle, index); |
diff --git a/drivers/acpi/wakeup.c b/drivers/acpi/wakeup.c index 4b9d339a6e28..388747a7ef4f 100644 --- a/drivers/acpi/wakeup.c +++ b/drivers/acpi/wakeup.c | |||
@@ -64,16 +64,13 @@ void acpi_enable_wakeup_device(u8 sleep_state) | |||
64 | struct acpi_device *dev = | 64 | struct acpi_device *dev = |
65 | container_of(node, struct acpi_device, wakeup_list); | 65 | container_of(node, struct acpi_device, wakeup_list); |
66 | 66 | ||
67 | if (!dev->wakeup.flags.valid) | 67 | if (!dev->wakeup.flags.valid || !dev->wakeup.state.enabled |
68 | continue; | ||
69 | |||
70 | if ((!dev->wakeup.state.enabled && !dev->wakeup.prepare_count) | ||
71 | || sleep_state > (u32) dev->wakeup.sleep_state) | 68 | || sleep_state > (u32) dev->wakeup.sleep_state) |
72 | continue; | 69 | continue; |
73 | 70 | ||
74 | /* The wake-up power should have been enabled already. */ | 71 | /* The wake-up power should have been enabled already. */ |
75 | acpi_set_gpe(dev->wakeup.gpe_device, dev->wakeup.gpe_number, | 72 | acpi_enable_gpe(dev->wakeup.gpe_device, dev->wakeup.gpe_number, |
76 | ACPI_GPE_ENABLE); | 73 | ACPI_GPE_TYPE_WAKE); |
77 | } | 74 | } |
78 | } | 75 | } |
79 | 76 | ||
@@ -96,6 +93,8 @@ void acpi_disable_wakeup_device(u8 sleep_state) | |||
96 | || (sleep_state > (u32) dev->wakeup.sleep_state)) | 93 | || (sleep_state > (u32) dev->wakeup.sleep_state)) |
97 | continue; | 94 | continue; |
98 | 95 | ||
96 | acpi_disable_gpe(dev->wakeup.gpe_device, dev->wakeup.gpe_number, | ||
97 | ACPI_GPE_TYPE_WAKE); | ||
99 | acpi_disable_wakeup_device_power(dev); | 98 | acpi_disable_wakeup_device_power(dev); |
100 | } | 99 | } |
101 | } | 100 | } |
@@ -109,13 +108,8 @@ int __init acpi_wakeup_device_init(void) | |||
109 | struct acpi_device *dev = container_of(node, | 108 | struct acpi_device *dev = container_of(node, |
110 | struct acpi_device, | 109 | struct acpi_device, |
111 | wakeup_list); | 110 | wakeup_list); |
112 | /* In case user doesn't load button driver */ | 111 | if (dev->wakeup.flags.always_enabled) |
113 | if (!dev->wakeup.flags.always_enabled || | 112 | dev->wakeup.state.enabled = 1; |
114 | dev->wakeup.state.enabled) | ||
115 | continue; | ||
116 | acpi_enable_gpe(dev->wakeup.gpe_device, dev->wakeup.gpe_number, | ||
117 | ACPI_GPE_TYPE_WAKE); | ||
118 | dev->wakeup.state.enabled = 1; | ||
119 | } | 113 | } |
120 | mutex_unlock(&acpi_device_lock); | 114 | mutex_unlock(&acpi_device_lock); |
121 | return 0; | 115 | return 0; |
diff --git a/drivers/char/sysrq.c b/drivers/char/sysrq.c index 5d15630a5830..5d64e3acb000 100644 --- a/drivers/char/sysrq.c +++ b/drivers/char/sysrq.c | |||
@@ -580,8 +580,12 @@ static bool sysrq_filter(struct input_handle *handle, unsigned int type, | |||
580 | case KEY_RIGHTALT: | 580 | case KEY_RIGHTALT: |
581 | if (value) | 581 | if (value) |
582 | sysrq_alt = code; | 582 | sysrq_alt = code; |
583 | else if (sysrq_down && code == sysrq_alt_use) | 583 | else { |
584 | sysrq_down = false; | 584 | if (sysrq_down && code == sysrq_alt_use) |
585 | sysrq_down = false; | ||
586 | |||
587 | sysrq_alt = 0; | ||
588 | } | ||
585 | break; | 589 | break; |
586 | 590 | ||
587 | case KEY_SYSRQ: | 591 | case KEY_SYSRQ: |
diff --git a/drivers/char/tpm/tpm.h b/drivers/char/tpm/tpm.h index 8e00b4ddd083..792868d24f2a 100644 --- a/drivers/char/tpm/tpm.h +++ b/drivers/char/tpm/tpm.h | |||
@@ -224,6 +224,7 @@ struct tpm_readpubek_params_out { | |||
224 | u8 algorithm[4]; | 224 | u8 algorithm[4]; |
225 | u8 encscheme[2]; | 225 | u8 encscheme[2]; |
226 | u8 sigscheme[2]; | 226 | u8 sigscheme[2]; |
227 | __be32 paramsize; | ||
227 | u8 parameters[12]; /*assuming RSA*/ | 228 | u8 parameters[12]; /*assuming RSA*/ |
228 | __be32 keysize; | 229 | __be32 keysize; |
229 | u8 modulus[256]; | 230 | u8 modulus[256]; |
diff --git a/drivers/clocksource/sh_cmt.c b/drivers/clocksource/sh_cmt.c index f3d3898898ed..717305d30444 100644 --- a/drivers/clocksource/sh_cmt.c +++ b/drivers/clocksource/sh_cmt.c | |||
@@ -449,7 +449,7 @@ static int sh_cmt_register_clocksource(struct sh_cmt_priv *p, | |||
449 | clk_disable(p->clk); | 449 | clk_disable(p->clk); |
450 | 450 | ||
451 | /* TODO: calculate good shift from rate and counter bit width */ | 451 | /* TODO: calculate good shift from rate and counter bit width */ |
452 | cs->shift = 10; | 452 | cs->shift = 0; |
453 | cs->mult = clocksource_hz2mult(p->rate, cs->shift); | 453 | cs->mult = clocksource_hz2mult(p->rate, cs->shift); |
454 | 454 | ||
455 | dev_info(&p->pdev->dev, "used as clock source\n"); | 455 | dev_info(&p->pdev->dev, "used as clock source\n"); |
diff --git a/drivers/hwmon/i5k_amb.c b/drivers/hwmon/i5k_amb.c index e880e2c3871d..937983407e2a 100644 --- a/drivers/hwmon/i5k_amb.c +++ b/drivers/hwmon/i5k_amb.c | |||
@@ -289,6 +289,7 @@ static int __devinit i5k_amb_hwmon_init(struct platform_device *pdev) | |||
289 | iattr->s_attr.dev_attr.attr.mode = S_IRUGO; | 289 | iattr->s_attr.dev_attr.attr.mode = S_IRUGO; |
290 | iattr->s_attr.dev_attr.show = show_label; | 290 | iattr->s_attr.dev_attr.show = show_label; |
291 | iattr->s_attr.index = k; | 291 | iattr->s_attr.index = k; |
292 | sysfs_attr_init(&iattr->s_attr.dev_attr.attr); | ||
292 | res = device_create_file(&pdev->dev, | 293 | res = device_create_file(&pdev->dev, |
293 | &iattr->s_attr.dev_attr); | 294 | &iattr->s_attr.dev_attr); |
294 | if (res) | 295 | if (res) |
@@ -303,6 +304,7 @@ static int __devinit i5k_amb_hwmon_init(struct platform_device *pdev) | |||
303 | iattr->s_attr.dev_attr.attr.mode = S_IRUGO; | 304 | iattr->s_attr.dev_attr.attr.mode = S_IRUGO; |
304 | iattr->s_attr.dev_attr.show = show_amb_temp; | 305 | iattr->s_attr.dev_attr.show = show_amb_temp; |
305 | iattr->s_attr.index = k; | 306 | iattr->s_attr.index = k; |
307 | sysfs_attr_init(&iattr->s_attr.dev_attr.attr); | ||
306 | res = device_create_file(&pdev->dev, | 308 | res = device_create_file(&pdev->dev, |
307 | &iattr->s_attr.dev_attr); | 309 | &iattr->s_attr.dev_attr); |
308 | if (res) | 310 | if (res) |
@@ -318,6 +320,7 @@ static int __devinit i5k_amb_hwmon_init(struct platform_device *pdev) | |||
318 | iattr->s_attr.dev_attr.show = show_amb_min; | 320 | iattr->s_attr.dev_attr.show = show_amb_min; |
319 | iattr->s_attr.dev_attr.store = store_amb_min; | 321 | iattr->s_attr.dev_attr.store = store_amb_min; |
320 | iattr->s_attr.index = k; | 322 | iattr->s_attr.index = k; |
323 | sysfs_attr_init(&iattr->s_attr.dev_attr.attr); | ||
321 | res = device_create_file(&pdev->dev, | 324 | res = device_create_file(&pdev->dev, |
322 | &iattr->s_attr.dev_attr); | 325 | &iattr->s_attr.dev_attr); |
323 | if (res) | 326 | if (res) |
@@ -333,6 +336,7 @@ static int __devinit i5k_amb_hwmon_init(struct platform_device *pdev) | |||
333 | iattr->s_attr.dev_attr.show = show_amb_mid; | 336 | iattr->s_attr.dev_attr.show = show_amb_mid; |
334 | iattr->s_attr.dev_attr.store = store_amb_mid; | 337 | iattr->s_attr.dev_attr.store = store_amb_mid; |
335 | iattr->s_attr.index = k; | 338 | iattr->s_attr.index = k; |
339 | sysfs_attr_init(&iattr->s_attr.dev_attr.attr); | ||
336 | res = device_create_file(&pdev->dev, | 340 | res = device_create_file(&pdev->dev, |
337 | &iattr->s_attr.dev_attr); | 341 | &iattr->s_attr.dev_attr); |
338 | if (res) | 342 | if (res) |
@@ -348,6 +352,7 @@ static int __devinit i5k_amb_hwmon_init(struct platform_device *pdev) | |||
348 | iattr->s_attr.dev_attr.show = show_amb_max; | 352 | iattr->s_attr.dev_attr.show = show_amb_max; |
349 | iattr->s_attr.dev_attr.store = store_amb_max; | 353 | iattr->s_attr.dev_attr.store = store_amb_max; |
350 | iattr->s_attr.index = k; | 354 | iattr->s_attr.index = k; |
355 | sysfs_attr_init(&iattr->s_attr.dev_attr.attr); | ||
351 | res = device_create_file(&pdev->dev, | 356 | res = device_create_file(&pdev->dev, |
352 | &iattr->s_attr.dev_attr); | 357 | &iattr->s_attr.dev_attr); |
353 | if (res) | 358 | if (res) |
@@ -362,6 +367,7 @@ static int __devinit i5k_amb_hwmon_init(struct platform_device *pdev) | |||
362 | iattr->s_attr.dev_attr.attr.mode = S_IRUGO; | 367 | iattr->s_attr.dev_attr.attr.mode = S_IRUGO; |
363 | iattr->s_attr.dev_attr.show = show_amb_alarm; | 368 | iattr->s_attr.dev_attr.show = show_amb_alarm; |
364 | iattr->s_attr.index = k; | 369 | iattr->s_attr.index = k; |
370 | sysfs_attr_init(&iattr->s_attr.dev_attr.attr); | ||
365 | res = device_create_file(&pdev->dev, | 371 | res = device_create_file(&pdev->dev, |
366 | &iattr->s_attr.dev_attr); | 372 | &iattr->s_attr.dev_attr); |
367 | if (res) | 373 | if (res) |
diff --git a/drivers/hwmon/k10temp.c b/drivers/hwmon/k10temp.c index 099a2138cdf6..da5a2404cd3e 100644 --- a/drivers/hwmon/k10temp.c +++ b/drivers/hwmon/k10temp.c | |||
@@ -112,11 +112,21 @@ static bool __devinit has_erratum_319(struct pci_dev *pdev) | |||
112 | if (pkg_type != CPUID_PKGTYPE_AM2R2_AM3) | 112 | if (pkg_type != CPUID_PKGTYPE_AM2R2_AM3) |
113 | return false; | 113 | return false; |
114 | 114 | ||
115 | /* Differentiate between AM2+ (bad) and AM3 (good) */ | 115 | /* DDR3 memory implies socket AM3, which is good */ |
116 | pci_bus_read_config_dword(pdev->bus, | 116 | pci_bus_read_config_dword(pdev->bus, |
117 | PCI_DEVFN(PCI_SLOT(pdev->devfn), 2), | 117 | PCI_DEVFN(PCI_SLOT(pdev->devfn), 2), |
118 | REG_DCT0_CONFIG_HIGH, ®_dram_cfg); | 118 | REG_DCT0_CONFIG_HIGH, ®_dram_cfg); |
119 | return !(reg_dram_cfg & DDR3_MODE); | 119 | if (reg_dram_cfg & DDR3_MODE) |
120 | return false; | ||
121 | |||
122 | /* | ||
123 | * Unfortunately it is possible to run a socket AM3 CPU with DDR2 | ||
124 | * memory. We blacklist all the cores which do exist in socket AM2+ | ||
125 | * format. It still isn't perfect, as RB-C2 cores exist in both AM2+ | ||
126 | * and AM3 formats, but that's the best we can do. | ||
127 | */ | ||
128 | return boot_cpu_data.x86_model < 4 || | ||
129 | (boot_cpu_data.x86_model == 4 && boot_cpu_data.x86_mask <= 2); | ||
120 | } | 130 | } |
121 | 131 | ||
122 | static int __devinit k10temp_probe(struct pci_dev *pdev, | 132 | static int __devinit k10temp_probe(struct pci_dev *pdev, |
diff --git a/drivers/hwmon/k8temp.c b/drivers/hwmon/k8temp.c index 0ceb6d6200a3..f26acdb11681 100644 --- a/drivers/hwmon/k8temp.c +++ b/drivers/hwmon/k8temp.c | |||
@@ -120,7 +120,7 @@ static ssize_t show_temp(struct device *dev, | |||
120 | int temp; | 120 | int temp; |
121 | struct k8temp_data *data = k8temp_update_device(dev); | 121 | struct k8temp_data *data = k8temp_update_device(dev); |
122 | 122 | ||
123 | if (data->swap_core_select) | 123 | if (data->swap_core_select && (data->sensorsp & SEL_CORE)) |
124 | core = core ? 0 : 1; | 124 | core = core ? 0 : 1; |
125 | 125 | ||
126 | temp = TEMP_FROM_REG(data->temp[core][place]) + data->temp_offset; | 126 | temp = TEMP_FROM_REG(data->temp[core][place]) + data->temp_offset; |
diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig index d8fa5d724c57..0f9a4785d798 100644 --- a/drivers/input/keyboard/Kconfig +++ b/drivers/input/keyboard/Kconfig | |||
@@ -69,7 +69,7 @@ config KEYBOARD_ATARI | |||
69 | module will be called atakbd. | 69 | module will be called atakbd. |
70 | 70 | ||
71 | config KEYBOARD_ATKBD | 71 | config KEYBOARD_ATKBD |
72 | tristate "AT keyboard" if EMBEDDED || !X86 | 72 | tristate "AT keyboard" if EMBEDDED || !X86 || X86_MRST |
73 | default y | 73 | default y |
74 | select SERIO | 74 | select SERIO |
75 | select SERIO_LIBPS2 | 75 | select SERIO_LIBPS2 |
diff --git a/drivers/input/misc/pcf8574_keypad.c b/drivers/input/misc/pcf8574_keypad.c index 0ac47d2898ec..4b42ffc0532a 100644 --- a/drivers/input/misc/pcf8574_keypad.c +++ b/drivers/input/misc/pcf8574_keypad.c | |||
@@ -69,7 +69,7 @@ static irqreturn_t pcf8574_kp_irq_handler(int irq, void *dev_id) | |||
69 | unsigned char nextstate = read_state(lp); | 69 | unsigned char nextstate = read_state(lp); |
70 | 70 | ||
71 | if (lp->laststate != nextstate) { | 71 | if (lp->laststate != nextstate) { |
72 | int key_down = nextstate <= ARRAY_SIZE(lp->btncode); | 72 | int key_down = nextstate < ARRAY_SIZE(lp->btncode); |
73 | unsigned short keycode = key_down ? | 73 | unsigned short keycode = key_down ? |
74 | lp->btncode[nextstate] : lp->btncode[lp->laststate]; | 74 | lp->btncode[nextstate] : lp->btncode[lp->laststate]; |
75 | 75 | ||
diff --git a/drivers/input/serio/Kconfig b/drivers/input/serio/Kconfig index 3bfe8fafc6ad..256b9e9394dc 100644 --- a/drivers/input/serio/Kconfig +++ b/drivers/input/serio/Kconfig | |||
@@ -22,7 +22,7 @@ config SERIO_I8042 | |||
22 | tristate "i8042 PC Keyboard controller" if EMBEDDED || !X86 | 22 | tristate "i8042 PC Keyboard controller" if EMBEDDED || !X86 |
23 | default y | 23 | default y |
24 | depends on !PARISC && (!ARM || ARCH_SHARK || FOOTBRIDGE_HOST) && \ | 24 | depends on !PARISC && (!ARM || ARCH_SHARK || FOOTBRIDGE_HOST) && \ |
25 | (!SUPERH || SH_CAYMAN) && !M68K && !BLACKFIN | 25 | (!SUPERH || SH_CAYMAN) && !M68K && !BLACKFIN && !X86_MRST |
26 | help | 26 | help |
27 | i8042 is the chip over which the standard AT keyboard and PS/2 | 27 | i8042 is the chip over which the standard AT keyboard and PS/2 |
28 | mouse are connected to the computer. If you use these devices, | 28 | mouse are connected to the computer. If you use these devices, |
diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c index d564af58175c..415f6306105d 100644 --- a/drivers/input/tablet/wacom_wac.c +++ b/drivers/input/tablet/wacom_wac.c | |||
@@ -284,12 +284,13 @@ static int wacom_intuos_inout(struct wacom_wac *wacom) | |||
284 | (data[4] << 20) + (data[5] << 12) + | 284 | (data[4] << 20) + (data[5] << 12) + |
285 | (data[6] << 4) + (data[7] >> 4); | 285 | (data[6] << 4) + (data[7] >> 4); |
286 | 286 | ||
287 | wacom->id[idx] = (data[2] << 4) | (data[3] >> 4); | 287 | wacom->id[idx] = (data[2] << 4) | (data[3] >> 4) | |
288 | ((data[7] & 0x0f) << 20) | ((data[8] & 0xf0) << 12); | ||
288 | 289 | ||
289 | switch (wacom->id[idx]) { | 290 | switch (wacom->id[idx] & 0xfffff) { |
290 | case 0x812: /* Inking pen */ | 291 | case 0x812: /* Inking pen */ |
291 | case 0x801: /* Intuos3 Inking pen */ | 292 | case 0x801: /* Intuos3 Inking pen */ |
292 | case 0x20802: /* Intuos4 Classic Pen */ | 293 | case 0x20802: /* Intuos4 Inking Pen */ |
293 | case 0x012: | 294 | case 0x012: |
294 | wacom->tool[idx] = BTN_TOOL_PENCIL; | 295 | wacom->tool[idx] = BTN_TOOL_PENCIL; |
295 | break; | 296 | break; |
@@ -513,7 +514,7 @@ static int wacom_intuos_irq(struct wacom_wac *wacom) | |||
513 | input_report_abs(input, ABS_RX, ((data[1] & 0x1f) << 8) | data[2]); | 514 | input_report_abs(input, ABS_RX, ((data[1] & 0x1f) << 8) | data[2]); |
514 | input_report_abs(input, ABS_RY, ((data[3] & 0x1f) << 8) | data[4]); | 515 | input_report_abs(input, ABS_RY, ((data[3] & 0x1f) << 8) | data[4]); |
515 | 516 | ||
516 | if ((data[5] & 0x1f) | (data[6] & 0x1f) | (data[1] & 0x1f) | | 517 | if ((data[5] & 0x1f) | data[6] | (data[1] & 0x1f) | |
517 | data[2] | (data[3] & 0x1f) | data[4] | data[8] | | 518 | data[2] | (data[3] & 0x1f) | data[4] | data[8] | |
518 | (data[7] & 0x01)) { | 519 | (data[7] & 0x01)) { |
519 | input_report_key(input, wacom->tool[1], 1); | 520 | input_report_key(input, wacom->tool[1], 1); |
diff --git a/drivers/input/touchscreen/ad7877.c b/drivers/input/touchscreen/ad7877.c index 0d2d7e54b465..5f0221cffef9 100644 --- a/drivers/input/touchscreen/ad7877.c +++ b/drivers/input/touchscreen/ad7877.c | |||
@@ -679,6 +679,13 @@ static int __devinit ad7877_probe(struct spi_device *spi) | |||
679 | return -EINVAL; | 679 | return -EINVAL; |
680 | } | 680 | } |
681 | 681 | ||
682 | spi->bits_per_word = 16; | ||
683 | err = spi_setup(spi); | ||
684 | if (err) { | ||
685 | dev_dbg(&spi->dev, "spi master doesn't support 16 bits/word\n"); | ||
686 | return err; | ||
687 | } | ||
688 | |||
682 | ts = kzalloc(sizeof(struct ad7877), GFP_KERNEL); | 689 | ts = kzalloc(sizeof(struct ad7877), GFP_KERNEL); |
683 | input_dev = input_allocate_device(); | 690 | input_dev = input_allocate_device(); |
684 | if (!ts || !input_dev) { | 691 | if (!ts || !input_dev) { |
diff --git a/drivers/isdn/gigaset/asyncdata.c b/drivers/isdn/gigaset/asyncdata.c index c5016bd2d94f..c3b1dc3a13a0 100644 --- a/drivers/isdn/gigaset/asyncdata.c +++ b/drivers/isdn/gigaset/asyncdata.c | |||
@@ -126,26 +126,6 @@ static unsigned lock_loop(unsigned numbytes, struct inbuf_t *inbuf) | |||
126 | return numbytes; | 126 | return numbytes; |
127 | } | 127 | } |
128 | 128 | ||
129 | /* set up next receive skb for data mode | ||
130 | */ | ||
131 | static void new_rcv_skb(struct bc_state *bcs) | ||
132 | { | ||
133 | struct cardstate *cs = bcs->cs; | ||
134 | unsigned short hw_hdr_len = cs->hw_hdr_len; | ||
135 | |||
136 | if (bcs->ignore) { | ||
137 | bcs->skb = NULL; | ||
138 | return; | ||
139 | } | ||
140 | |||
141 | bcs->skb = dev_alloc_skb(SBUFSIZE + hw_hdr_len); | ||
142 | if (bcs->skb == NULL) { | ||
143 | dev_warn(cs->dev, "could not allocate new skb\n"); | ||
144 | return; | ||
145 | } | ||
146 | skb_reserve(bcs->skb, hw_hdr_len); | ||
147 | } | ||
148 | |||
149 | /* process a block of received bytes in HDLC data mode | 129 | /* process a block of received bytes in HDLC data mode |
150 | * (mstate != MS_LOCKED && !(inputstate & INS_command) && proto2 == L2_HDLC) | 130 | * (mstate != MS_LOCKED && !(inputstate & INS_command) && proto2 == L2_HDLC) |
151 | * Collect HDLC frames, undoing byte stuffing and watching for DLE escapes. | 131 | * Collect HDLC frames, undoing byte stuffing and watching for DLE escapes. |
@@ -159,8 +139,8 @@ static unsigned hdlc_loop(unsigned numbytes, struct inbuf_t *inbuf) | |||
159 | struct cardstate *cs = inbuf->cs; | 139 | struct cardstate *cs = inbuf->cs; |
160 | struct bc_state *bcs = cs->bcs; | 140 | struct bc_state *bcs = cs->bcs; |
161 | int inputstate = bcs->inputstate; | 141 | int inputstate = bcs->inputstate; |
162 | __u16 fcs = bcs->fcs; | 142 | __u16 fcs = bcs->rx_fcs; |
163 | struct sk_buff *skb = bcs->skb; | 143 | struct sk_buff *skb = bcs->rx_skb; |
164 | unsigned char *src = inbuf->data + inbuf->head; | 144 | unsigned char *src = inbuf->data + inbuf->head; |
165 | unsigned procbytes = 0; | 145 | unsigned procbytes = 0; |
166 | unsigned char c; | 146 | unsigned char c; |
@@ -245,8 +225,7 @@ byte_stuff: | |||
245 | 225 | ||
246 | /* prepare reception of next frame */ | 226 | /* prepare reception of next frame */ |
247 | inputstate &= ~INS_have_data; | 227 | inputstate &= ~INS_have_data; |
248 | new_rcv_skb(bcs); | 228 | skb = gigaset_new_rx_skb(bcs); |
249 | skb = bcs->skb; | ||
250 | } else { | 229 | } else { |
251 | /* empty frame (7E 7E) */ | 230 | /* empty frame (7E 7E) */ |
252 | #ifdef CONFIG_GIGASET_DEBUG | 231 | #ifdef CONFIG_GIGASET_DEBUG |
@@ -255,8 +234,7 @@ byte_stuff: | |||
255 | if (!skb) { | 234 | if (!skb) { |
256 | /* skipped (?) */ | 235 | /* skipped (?) */ |
257 | gigaset_isdn_rcv_err(bcs); | 236 | gigaset_isdn_rcv_err(bcs); |
258 | new_rcv_skb(bcs); | 237 | skb = gigaset_new_rx_skb(bcs); |
259 | skb = bcs->skb; | ||
260 | } | 238 | } |
261 | } | 239 | } |
262 | 240 | ||
@@ -279,11 +257,11 @@ byte_stuff: | |||
279 | #endif | 257 | #endif |
280 | inputstate |= INS_have_data; | 258 | inputstate |= INS_have_data; |
281 | if (skb) { | 259 | if (skb) { |
282 | if (skb->len == SBUFSIZE) { | 260 | if (skb->len >= bcs->rx_bufsize) { |
283 | dev_warn(cs->dev, "received packet too long\n"); | 261 | dev_warn(cs->dev, "received packet too long\n"); |
284 | dev_kfree_skb_any(skb); | 262 | dev_kfree_skb_any(skb); |
285 | /* skip remainder of packet */ | 263 | /* skip remainder of packet */ |
286 | bcs->skb = skb = NULL; | 264 | bcs->rx_skb = skb = NULL; |
287 | } else { | 265 | } else { |
288 | *__skb_put(skb, 1) = c; | 266 | *__skb_put(skb, 1) = c; |
289 | fcs = crc_ccitt_byte(fcs, c); | 267 | fcs = crc_ccitt_byte(fcs, c); |
@@ -292,7 +270,7 @@ byte_stuff: | |||
292 | } | 270 | } |
293 | 271 | ||
294 | bcs->inputstate = inputstate; | 272 | bcs->inputstate = inputstate; |
295 | bcs->fcs = fcs; | 273 | bcs->rx_fcs = fcs; |
296 | return procbytes; | 274 | return procbytes; |
297 | } | 275 | } |
298 | 276 | ||
@@ -308,18 +286,18 @@ static unsigned iraw_loop(unsigned numbytes, struct inbuf_t *inbuf) | |||
308 | struct cardstate *cs = inbuf->cs; | 286 | struct cardstate *cs = inbuf->cs; |
309 | struct bc_state *bcs = cs->bcs; | 287 | struct bc_state *bcs = cs->bcs; |
310 | int inputstate = bcs->inputstate; | 288 | int inputstate = bcs->inputstate; |
311 | struct sk_buff *skb = bcs->skb; | 289 | struct sk_buff *skb = bcs->rx_skb; |
312 | unsigned char *src = inbuf->data + inbuf->head; | 290 | unsigned char *src = inbuf->data + inbuf->head; |
313 | unsigned procbytes = 0; | 291 | unsigned procbytes = 0; |
314 | unsigned char c; | 292 | unsigned char c; |
315 | 293 | ||
316 | if (!skb) { | 294 | if (!skb) { |
317 | /* skip this block */ | 295 | /* skip this block */ |
318 | new_rcv_skb(bcs); | 296 | gigaset_new_rx_skb(bcs); |
319 | return numbytes; | 297 | return numbytes; |
320 | } | 298 | } |
321 | 299 | ||
322 | while (procbytes < numbytes && skb->len < SBUFSIZE) { | 300 | while (procbytes < numbytes && skb->len < bcs->rx_bufsize) { |
323 | c = *src++; | 301 | c = *src++; |
324 | procbytes++; | 302 | procbytes++; |
325 | 303 | ||
@@ -343,7 +321,7 @@ static unsigned iraw_loop(unsigned numbytes, struct inbuf_t *inbuf) | |||
343 | if (inputstate & INS_have_data) { | 321 | if (inputstate & INS_have_data) { |
344 | gigaset_skb_rcvd(bcs, skb); | 322 | gigaset_skb_rcvd(bcs, skb); |
345 | inputstate &= ~INS_have_data; | 323 | inputstate &= ~INS_have_data; |
346 | new_rcv_skb(bcs); | 324 | gigaset_new_rx_skb(bcs); |
347 | } | 325 | } |
348 | 326 | ||
349 | bcs->inputstate = inputstate; | 327 | bcs->inputstate = inputstate; |
diff --git a/drivers/isdn/gigaset/capi.c b/drivers/isdn/gigaset/capi.c index 8f78f15c8ef7..6fbe8999c419 100644 --- a/drivers/isdn/gigaset/capi.c +++ b/drivers/isdn/gigaset/capi.c | |||
@@ -70,7 +70,7 @@ | |||
70 | #define MAX_NUMBER_DIGITS 20 | 70 | #define MAX_NUMBER_DIGITS 20 |
71 | #define MAX_FMT_IE_LEN 20 | 71 | #define MAX_FMT_IE_LEN 20 |
72 | 72 | ||
73 | /* values for gigaset_capi_appl.connected */ | 73 | /* values for bcs->apconnstate */ |
74 | #define APCONN_NONE 0 /* inactive/listening */ | 74 | #define APCONN_NONE 0 /* inactive/listening */ |
75 | #define APCONN_SETUP 1 /* connecting */ | 75 | #define APCONN_SETUP 1 /* connecting */ |
76 | #define APCONN_ACTIVE 2 /* B channel up */ | 76 | #define APCONN_ACTIVE 2 /* B channel up */ |
@@ -80,10 +80,10 @@ struct gigaset_capi_appl { | |||
80 | struct list_head ctrlist; | 80 | struct list_head ctrlist; |
81 | struct gigaset_capi_appl *bcnext; | 81 | struct gigaset_capi_appl *bcnext; |
82 | u16 id; | 82 | u16 id; |
83 | struct capi_register_params rp; | ||
83 | u16 nextMessageNumber; | 84 | u16 nextMessageNumber; |
84 | u32 listenInfoMask; | 85 | u32 listenInfoMask; |
85 | u32 listenCIPmask; | 86 | u32 listenCIPmask; |
86 | int connected; | ||
87 | }; | 87 | }; |
88 | 88 | ||
89 | /* CAPI specific controller data structure */ | 89 | /* CAPI specific controller data structure */ |
@@ -319,6 +319,39 @@ static const char *format_ie(const char *ie) | |||
319 | return result; | 319 | return result; |
320 | } | 320 | } |
321 | 321 | ||
322 | /* | ||
323 | * emit DATA_B3_CONF message | ||
324 | */ | ||
325 | static void send_data_b3_conf(struct cardstate *cs, struct capi_ctr *ctr, | ||
326 | u16 appl, u16 msgid, int channel, | ||
327 | u16 handle, u16 info) | ||
328 | { | ||
329 | struct sk_buff *cskb; | ||
330 | u8 *msg; | ||
331 | |||
332 | cskb = alloc_skb(CAPI_DATA_B3_CONF_LEN, GFP_ATOMIC); | ||
333 | if (!cskb) { | ||
334 | dev_err(cs->dev, "%s: out of memory\n", __func__); | ||
335 | return; | ||
336 | } | ||
337 | /* frequent message, avoid _cmsg overhead */ | ||
338 | msg = __skb_put(cskb, CAPI_DATA_B3_CONF_LEN); | ||
339 | CAPIMSG_SETLEN(msg, CAPI_DATA_B3_CONF_LEN); | ||
340 | CAPIMSG_SETAPPID(msg, appl); | ||
341 | CAPIMSG_SETCOMMAND(msg, CAPI_DATA_B3); | ||
342 | CAPIMSG_SETSUBCOMMAND(msg, CAPI_CONF); | ||
343 | CAPIMSG_SETMSGID(msg, msgid); | ||
344 | CAPIMSG_SETCONTROLLER(msg, ctr->cnr); | ||
345 | CAPIMSG_SETPLCI_PART(msg, channel); | ||
346 | CAPIMSG_SETNCCI_PART(msg, 1); | ||
347 | CAPIMSG_SETHANDLE_CONF(msg, handle); | ||
348 | CAPIMSG_SETINFO_CONF(msg, info); | ||
349 | |||
350 | /* emit message */ | ||
351 | dump_rawmsg(DEBUG_MCMD, __func__, msg); | ||
352 | capi_ctr_handle_message(ctr, appl, cskb); | ||
353 | } | ||
354 | |||
322 | 355 | ||
323 | /* | 356 | /* |
324 | * driver interface functions | 357 | * driver interface functions |
@@ -339,7 +372,6 @@ void gigaset_skb_sent(struct bc_state *bcs, struct sk_buff *dskb) | |||
339 | struct gigaset_capi_ctr *iif = cs->iif; | 372 | struct gigaset_capi_ctr *iif = cs->iif; |
340 | struct gigaset_capi_appl *ap = bcs->ap; | 373 | struct gigaset_capi_appl *ap = bcs->ap; |
341 | unsigned char *req = skb_mac_header(dskb); | 374 | unsigned char *req = skb_mac_header(dskb); |
342 | struct sk_buff *cskb; | ||
343 | u16 flags; | 375 | u16 flags; |
344 | 376 | ||
345 | /* update statistics */ | 377 | /* update statistics */ |
@@ -351,39 +383,22 @@ void gigaset_skb_sent(struct bc_state *bcs, struct sk_buff *dskb) | |||
351 | } | 383 | } |
352 | 384 | ||
353 | /* don't send further B3 messages if disconnected */ | 385 | /* don't send further B3 messages if disconnected */ |
354 | if (ap->connected < APCONN_ACTIVE) { | 386 | if (bcs->apconnstate < APCONN_ACTIVE) { |
355 | gig_dbg(DEBUG_LLDATA, "disconnected, discarding ack"); | 387 | gig_dbg(DEBUG_LLDATA, "disconnected, discarding ack"); |
356 | return; | 388 | return; |
357 | } | 389 | } |
358 | 390 | ||
359 | /* ToDo: honor unset "delivery confirmation" bit */ | 391 | /* |
392 | * send DATA_B3_CONF if "delivery confirmation" bit was set in request; | ||
393 | * otherwise it has already been sent by do_data_b3_req() | ||
394 | */ | ||
360 | flags = CAPIMSG_FLAGS(req); | 395 | flags = CAPIMSG_FLAGS(req); |
361 | 396 | if (flags & CAPI_FLAGS_DELIVERY_CONFIRMATION) | |
362 | /* build DATA_B3_CONF message */ | 397 | send_data_b3_conf(cs, &iif->ctr, ap->id, CAPIMSG_MSGID(req), |
363 | cskb = alloc_skb(CAPI_DATA_B3_CONF_LEN, GFP_ATOMIC); | 398 | bcs->channel + 1, CAPIMSG_HANDLE_REQ(req), |
364 | if (!cskb) { | 399 | (flags & ~CAPI_FLAGS_DELIVERY_CONFIRMATION) ? |
365 | dev_err(cs->dev, "%s: out of memory\n", __func__); | 400 | CapiFlagsNotSupportedByProtocol : |
366 | return; | 401 | CAPI_NOERROR); |
367 | } | ||
368 | /* frequent message, avoid _cmsg overhead */ | ||
369 | CAPIMSG_SETLEN(cskb->data, CAPI_DATA_B3_CONF_LEN); | ||
370 | CAPIMSG_SETAPPID(cskb->data, ap->id); | ||
371 | CAPIMSG_SETCOMMAND(cskb->data, CAPI_DATA_B3); | ||
372 | CAPIMSG_SETSUBCOMMAND(cskb->data, CAPI_CONF); | ||
373 | CAPIMSG_SETMSGID(cskb->data, CAPIMSG_MSGID(req)); | ||
374 | CAPIMSG_SETCONTROLLER(cskb->data, iif->ctr.cnr); | ||
375 | CAPIMSG_SETPLCI_PART(cskb->data, bcs->channel + 1); | ||
376 | CAPIMSG_SETNCCI_PART(cskb->data, 1); | ||
377 | CAPIMSG_SETHANDLE_CONF(cskb->data, CAPIMSG_HANDLE_REQ(req)); | ||
378 | if (flags & ~CAPI_FLAGS_DELIVERY_CONFIRMATION) | ||
379 | CAPIMSG_SETINFO_CONF(cskb->data, | ||
380 | CapiFlagsNotSupportedByProtocol); | ||
381 | else | ||
382 | CAPIMSG_SETINFO_CONF(cskb->data, CAPI_NOERROR); | ||
383 | |||
384 | /* emit message */ | ||
385 | dump_rawmsg(DEBUG_LLDATA, "DATA_B3_CONF", cskb->data); | ||
386 | capi_ctr_handle_message(&iif->ctr, ap->id, cskb); | ||
387 | } | 402 | } |
388 | EXPORT_SYMBOL_GPL(gigaset_skb_sent); | 403 | EXPORT_SYMBOL_GPL(gigaset_skb_sent); |
389 | 404 | ||
@@ -412,7 +427,7 @@ void gigaset_skb_rcvd(struct bc_state *bcs, struct sk_buff *skb) | |||
412 | } | 427 | } |
413 | 428 | ||
414 | /* don't send further B3 messages if disconnected */ | 429 | /* don't send further B3 messages if disconnected */ |
415 | if (ap->connected < APCONN_ACTIVE) { | 430 | if (bcs->apconnstate < APCONN_ACTIVE) { |
416 | gig_dbg(DEBUG_LLDATA, "disconnected, discarding data"); | 431 | gig_dbg(DEBUG_LLDATA, "disconnected, discarding data"); |
417 | dev_kfree_skb_any(skb); | 432 | dev_kfree_skb_any(skb); |
418 | return; | 433 | return; |
@@ -484,6 +499,7 @@ int gigaset_isdn_icall(struct at_state_t *at_state) | |||
484 | u32 actCIPmask; | 499 | u32 actCIPmask; |
485 | struct sk_buff *skb; | 500 | struct sk_buff *skb; |
486 | unsigned int msgsize; | 501 | unsigned int msgsize; |
502 | unsigned long flags; | ||
487 | int i; | 503 | int i; |
488 | 504 | ||
489 | /* | 505 | /* |
@@ -608,7 +624,14 @@ int gigaset_isdn_icall(struct at_state_t *at_state) | |||
608 | format_ie(iif->hcmsg.CalledPartyNumber)); | 624 | format_ie(iif->hcmsg.CalledPartyNumber)); |
609 | 625 | ||
610 | /* scan application list for matching listeners */ | 626 | /* scan application list for matching listeners */ |
611 | bcs->ap = NULL; | 627 | spin_lock_irqsave(&bcs->aplock, flags); |
628 | if (bcs->ap != NULL || bcs->apconnstate != APCONN_NONE) { | ||
629 | dev_warn(cs->dev, "%s: channel not properly cleared (%p/%d)\n", | ||
630 | __func__, bcs->ap, bcs->apconnstate); | ||
631 | bcs->ap = NULL; | ||
632 | bcs->apconnstate = APCONN_NONE; | ||
633 | } | ||
634 | spin_unlock_irqrestore(&bcs->aplock, flags); | ||
612 | actCIPmask = 1 | (1 << iif->hcmsg.CIPValue); | 635 | actCIPmask = 1 | (1 << iif->hcmsg.CIPValue); |
613 | list_for_each_entry(ap, &iif->appls, ctrlist) | 636 | list_for_each_entry(ap, &iif->appls, ctrlist) |
614 | if (actCIPmask & ap->listenCIPmask) { | 637 | if (actCIPmask & ap->listenCIPmask) { |
@@ -626,10 +649,12 @@ int gigaset_isdn_icall(struct at_state_t *at_state) | |||
626 | dump_cmsg(DEBUG_CMD, __func__, &iif->hcmsg); | 649 | dump_cmsg(DEBUG_CMD, __func__, &iif->hcmsg); |
627 | 650 | ||
628 | /* add to listeners on this B channel, update state */ | 651 | /* add to listeners on this B channel, update state */ |
652 | spin_lock_irqsave(&bcs->aplock, flags); | ||
629 | ap->bcnext = bcs->ap; | 653 | ap->bcnext = bcs->ap; |
630 | bcs->ap = ap; | 654 | bcs->ap = ap; |
631 | bcs->chstate |= CHS_NOTIFY_LL; | 655 | bcs->chstate |= CHS_NOTIFY_LL; |
632 | ap->connected = APCONN_SETUP; | 656 | bcs->apconnstate = APCONN_SETUP; |
657 | spin_unlock_irqrestore(&bcs->aplock, flags); | ||
633 | 658 | ||
634 | /* emit message */ | 659 | /* emit message */ |
635 | capi_ctr_handle_message(&iif->ctr, ap->id, skb); | 660 | capi_ctr_handle_message(&iif->ctr, ap->id, skb); |
@@ -654,7 +679,7 @@ static void send_disconnect_ind(struct bc_state *bcs, | |||
654 | struct gigaset_capi_ctr *iif = cs->iif; | 679 | struct gigaset_capi_ctr *iif = cs->iif; |
655 | struct sk_buff *skb; | 680 | struct sk_buff *skb; |
656 | 681 | ||
657 | if (ap->connected == APCONN_NONE) | 682 | if (bcs->apconnstate == APCONN_NONE) |
658 | return; | 683 | return; |
659 | 684 | ||
660 | capi_cmsg_header(&iif->hcmsg, ap->id, CAPI_DISCONNECT, CAPI_IND, | 685 | capi_cmsg_header(&iif->hcmsg, ap->id, CAPI_DISCONNECT, CAPI_IND, |
@@ -668,7 +693,6 @@ static void send_disconnect_ind(struct bc_state *bcs, | |||
668 | } | 693 | } |
669 | capi_cmsg2message(&iif->hcmsg, __skb_put(skb, CAPI_DISCONNECT_IND_LEN)); | 694 | capi_cmsg2message(&iif->hcmsg, __skb_put(skb, CAPI_DISCONNECT_IND_LEN)); |
670 | dump_cmsg(DEBUG_CMD, __func__, &iif->hcmsg); | 695 | dump_cmsg(DEBUG_CMD, __func__, &iif->hcmsg); |
671 | ap->connected = APCONN_NONE; | ||
672 | capi_ctr_handle_message(&iif->ctr, ap->id, skb); | 696 | capi_ctr_handle_message(&iif->ctr, ap->id, skb); |
673 | } | 697 | } |
674 | 698 | ||
@@ -685,9 +709,9 @@ static void send_disconnect_b3_ind(struct bc_state *bcs, | |||
685 | struct sk_buff *skb; | 709 | struct sk_buff *skb; |
686 | 710 | ||
687 | /* nothing to do if no logical connection active */ | 711 | /* nothing to do if no logical connection active */ |
688 | if (ap->connected < APCONN_ACTIVE) | 712 | if (bcs->apconnstate < APCONN_ACTIVE) |
689 | return; | 713 | return; |
690 | ap->connected = APCONN_SETUP; | 714 | bcs->apconnstate = APCONN_SETUP; |
691 | 715 | ||
692 | capi_cmsg_header(&iif->hcmsg, ap->id, CAPI_DISCONNECT_B3, CAPI_IND, | 716 | capi_cmsg_header(&iif->hcmsg, ap->id, CAPI_DISCONNECT_B3, CAPI_IND, |
693 | ap->nextMessageNumber++, | 717 | ap->nextMessageNumber++, |
@@ -714,14 +738,25 @@ void gigaset_isdn_connD(struct bc_state *bcs) | |||
714 | { | 738 | { |
715 | struct cardstate *cs = bcs->cs; | 739 | struct cardstate *cs = bcs->cs; |
716 | struct gigaset_capi_ctr *iif = cs->iif; | 740 | struct gigaset_capi_ctr *iif = cs->iif; |
717 | struct gigaset_capi_appl *ap = bcs->ap; | 741 | struct gigaset_capi_appl *ap; |
718 | struct sk_buff *skb; | 742 | struct sk_buff *skb; |
719 | unsigned int msgsize; | 743 | unsigned int msgsize; |
744 | unsigned long flags; | ||
720 | 745 | ||
746 | spin_lock_irqsave(&bcs->aplock, flags); | ||
747 | ap = bcs->ap; | ||
721 | if (!ap) { | 748 | if (!ap) { |
749 | spin_unlock_irqrestore(&bcs->aplock, flags); | ||
722 | dev_err(cs->dev, "%s: no application\n", __func__); | 750 | dev_err(cs->dev, "%s: no application\n", __func__); |
723 | return; | 751 | return; |
724 | } | 752 | } |
753 | if (bcs->apconnstate == APCONN_NONE) { | ||
754 | spin_unlock_irqrestore(&bcs->aplock, flags); | ||
755 | dev_warn(cs->dev, "%s: application %u not connected\n", | ||
756 | __func__, ap->id); | ||
757 | return; | ||
758 | } | ||
759 | spin_unlock_irqrestore(&bcs->aplock, flags); | ||
725 | while (ap->bcnext) { | 760 | while (ap->bcnext) { |
726 | /* this should never happen */ | 761 | /* this should never happen */ |
727 | dev_warn(cs->dev, "%s: dropping extra application %u\n", | 762 | dev_warn(cs->dev, "%s: dropping extra application %u\n", |
@@ -730,11 +765,6 @@ void gigaset_isdn_connD(struct bc_state *bcs) | |||
730 | CapiCallGivenToOtherApplication); | 765 | CapiCallGivenToOtherApplication); |
731 | ap->bcnext = ap->bcnext->bcnext; | 766 | ap->bcnext = ap->bcnext->bcnext; |
732 | } | 767 | } |
733 | if (ap->connected == APCONN_NONE) { | ||
734 | dev_warn(cs->dev, "%s: application %u not connected\n", | ||
735 | __func__, ap->id); | ||
736 | return; | ||
737 | } | ||
738 | 768 | ||
739 | /* prepare CONNECT_ACTIVE_IND message | 769 | /* prepare CONNECT_ACTIVE_IND message |
740 | * Note: LLC not supported by device | 770 | * Note: LLC not supported by device |
@@ -772,17 +802,24 @@ void gigaset_isdn_connD(struct bc_state *bcs) | |||
772 | void gigaset_isdn_hupD(struct bc_state *bcs) | 802 | void gigaset_isdn_hupD(struct bc_state *bcs) |
773 | { | 803 | { |
774 | struct gigaset_capi_appl *ap; | 804 | struct gigaset_capi_appl *ap; |
805 | unsigned long flags; | ||
775 | 806 | ||
776 | /* | 807 | /* |
777 | * ToDo: pass on reason code reported by device | 808 | * ToDo: pass on reason code reported by device |
778 | * (requires ev-layer state machine extension to collect | 809 | * (requires ev-layer state machine extension to collect |
779 | * ZCAU device reply) | 810 | * ZCAU device reply) |
780 | */ | 811 | */ |
781 | for (ap = bcs->ap; ap != NULL; ap = ap->bcnext) { | 812 | spin_lock_irqsave(&bcs->aplock, flags); |
813 | while (bcs->ap != NULL) { | ||
814 | ap = bcs->ap; | ||
815 | bcs->ap = ap->bcnext; | ||
816 | spin_unlock_irqrestore(&bcs->aplock, flags); | ||
782 | send_disconnect_b3_ind(bcs, ap); | 817 | send_disconnect_b3_ind(bcs, ap); |
783 | send_disconnect_ind(bcs, ap, 0); | 818 | send_disconnect_ind(bcs, ap, 0); |
819 | spin_lock_irqsave(&bcs->aplock, flags); | ||
784 | } | 820 | } |
785 | bcs->ap = NULL; | 821 | bcs->apconnstate = APCONN_NONE; |
822 | spin_unlock_irqrestore(&bcs->aplock, flags); | ||
786 | } | 823 | } |
787 | 824 | ||
788 | /** | 825 | /** |
@@ -796,24 +833,21 @@ void gigaset_isdn_connB(struct bc_state *bcs) | |||
796 | { | 833 | { |
797 | struct cardstate *cs = bcs->cs; | 834 | struct cardstate *cs = bcs->cs; |
798 | struct gigaset_capi_ctr *iif = cs->iif; | 835 | struct gigaset_capi_ctr *iif = cs->iif; |
799 | struct gigaset_capi_appl *ap = bcs->ap; | 836 | struct gigaset_capi_appl *ap; |
800 | struct sk_buff *skb; | 837 | struct sk_buff *skb; |
838 | unsigned long flags; | ||
801 | unsigned int msgsize; | 839 | unsigned int msgsize; |
802 | u8 command; | 840 | u8 command; |
803 | 841 | ||
842 | spin_lock_irqsave(&bcs->aplock, flags); | ||
843 | ap = bcs->ap; | ||
804 | if (!ap) { | 844 | if (!ap) { |
845 | spin_unlock_irqrestore(&bcs->aplock, flags); | ||
805 | dev_err(cs->dev, "%s: no application\n", __func__); | 846 | dev_err(cs->dev, "%s: no application\n", __func__); |
806 | return; | 847 | return; |
807 | } | 848 | } |
808 | while (ap->bcnext) { | 849 | if (!bcs->apconnstate) { |
809 | /* this should never happen */ | 850 | spin_unlock_irqrestore(&bcs->aplock, flags); |
810 | dev_warn(cs->dev, "%s: dropping extra application %u\n", | ||
811 | __func__, ap->bcnext->id); | ||
812 | send_disconnect_ind(bcs, ap->bcnext, | ||
813 | CapiCallGivenToOtherApplication); | ||
814 | ap->bcnext = ap->bcnext->bcnext; | ||
815 | } | ||
816 | if (!ap->connected) { | ||
817 | dev_warn(cs->dev, "%s: application %u not connected\n", | 851 | dev_warn(cs->dev, "%s: application %u not connected\n", |
818 | __func__, ap->id); | 852 | __func__, ap->id); |
819 | return; | 853 | return; |
@@ -825,13 +859,26 @@ void gigaset_isdn_connB(struct bc_state *bcs) | |||
825 | * CONNECT_B3_ACTIVE_IND in reply to CONNECT_B3_RESP | 859 | * CONNECT_B3_ACTIVE_IND in reply to CONNECT_B3_RESP |
826 | * Parameters in both cases always: NCCI = 1, NCPI empty | 860 | * Parameters in both cases always: NCCI = 1, NCPI empty |
827 | */ | 861 | */ |
828 | if (ap->connected >= APCONN_ACTIVE) { | 862 | if (bcs->apconnstate >= APCONN_ACTIVE) { |
829 | command = CAPI_CONNECT_B3_ACTIVE; | 863 | command = CAPI_CONNECT_B3_ACTIVE; |
830 | msgsize = CAPI_CONNECT_B3_ACTIVE_IND_BASELEN; | 864 | msgsize = CAPI_CONNECT_B3_ACTIVE_IND_BASELEN; |
831 | } else { | 865 | } else { |
832 | command = CAPI_CONNECT_B3; | 866 | command = CAPI_CONNECT_B3; |
833 | msgsize = CAPI_CONNECT_B3_IND_BASELEN; | 867 | msgsize = CAPI_CONNECT_B3_IND_BASELEN; |
834 | } | 868 | } |
869 | bcs->apconnstate = APCONN_ACTIVE; | ||
870 | |||
871 | spin_unlock_irqrestore(&bcs->aplock, flags); | ||
872 | |||
873 | while (ap->bcnext) { | ||
874 | /* this should never happen */ | ||
875 | dev_warn(cs->dev, "%s: dropping extra application %u\n", | ||
876 | __func__, ap->bcnext->id); | ||
877 | send_disconnect_ind(bcs, ap->bcnext, | ||
878 | CapiCallGivenToOtherApplication); | ||
879 | ap->bcnext = ap->bcnext->bcnext; | ||
880 | } | ||
881 | |||
835 | capi_cmsg_header(&iif->hcmsg, ap->id, command, CAPI_IND, | 882 | capi_cmsg_header(&iif->hcmsg, ap->id, command, CAPI_IND, |
836 | ap->nextMessageNumber++, | 883 | ap->nextMessageNumber++, |
837 | iif->ctr.cnr | ((bcs->channel + 1) << 8) | (1 << 16)); | 884 | iif->ctr.cnr | ((bcs->channel + 1) << 8) | (1 << 16)); |
@@ -842,7 +889,6 @@ void gigaset_isdn_connB(struct bc_state *bcs) | |||
842 | } | 889 | } |
843 | capi_cmsg2message(&iif->hcmsg, __skb_put(skb, msgsize)); | 890 | capi_cmsg2message(&iif->hcmsg, __skb_put(skb, msgsize)); |
844 | dump_cmsg(DEBUG_CMD, __func__, &iif->hcmsg); | 891 | dump_cmsg(DEBUG_CMD, __func__, &iif->hcmsg); |
845 | ap->connected = APCONN_ACTIVE; | ||
846 | capi_ctr_handle_message(&iif->ctr, ap->id, skb); | 892 | capi_ctr_handle_message(&iif->ctr, ap->id, skb); |
847 | } | 893 | } |
848 | 894 | ||
@@ -945,8 +991,64 @@ static void gigaset_register_appl(struct capi_ctr *ctr, u16 appl, | |||
945 | return; | 991 | return; |
946 | } | 992 | } |
947 | ap->id = appl; | 993 | ap->id = appl; |
994 | ap->rp = *rp; | ||
948 | 995 | ||
949 | list_add(&ap->ctrlist, &iif->appls); | 996 | list_add(&ap->ctrlist, &iif->appls); |
997 | dev_info(cs->dev, "application %u registered\n", ap->id); | ||
998 | } | ||
999 | |||
1000 | /* | ||
1001 | * remove CAPI application from channel | ||
1002 | * helper function to keep indentation levels down and stay in 80 columns | ||
1003 | */ | ||
1004 | |||
1005 | static inline void remove_appl_from_channel(struct bc_state *bcs, | ||
1006 | struct gigaset_capi_appl *ap) | ||
1007 | { | ||
1008 | struct cardstate *cs = bcs->cs; | ||
1009 | struct gigaset_capi_appl *bcap; | ||
1010 | unsigned long flags; | ||
1011 | int prevconnstate; | ||
1012 | |||
1013 | spin_lock_irqsave(&bcs->aplock, flags); | ||
1014 | bcap = bcs->ap; | ||
1015 | if (bcap == NULL) { | ||
1016 | spin_unlock_irqrestore(&bcs->aplock, flags); | ||
1017 | return; | ||
1018 | } | ||
1019 | |||
1020 | /* check first application on channel */ | ||
1021 | if (bcap == ap) { | ||
1022 | bcs->ap = ap->bcnext; | ||
1023 | if (bcs->ap != NULL) { | ||
1024 | spin_unlock_irqrestore(&bcs->aplock, flags); | ||
1025 | return; | ||
1026 | } | ||
1027 | |||
1028 | /* none left, clear channel state */ | ||
1029 | prevconnstate = bcs->apconnstate; | ||
1030 | bcs->apconnstate = APCONN_NONE; | ||
1031 | spin_unlock_irqrestore(&bcs->aplock, flags); | ||
1032 | |||
1033 | if (prevconnstate == APCONN_ACTIVE) { | ||
1034 | dev_notice(cs->dev, "%s: hanging up channel %u\n", | ||
1035 | __func__, bcs->channel); | ||
1036 | gigaset_add_event(cs, &bcs->at_state, | ||
1037 | EV_HUP, NULL, 0, NULL); | ||
1038 | gigaset_schedule_event(cs); | ||
1039 | } | ||
1040 | return; | ||
1041 | } | ||
1042 | |||
1043 | /* check remaining list */ | ||
1044 | do { | ||
1045 | if (bcap->bcnext == ap) { | ||
1046 | bcap->bcnext = bcap->bcnext->bcnext; | ||
1047 | return; | ||
1048 | } | ||
1049 | bcap = bcap->bcnext; | ||
1050 | } while (bcap != NULL); | ||
1051 | spin_unlock_irqrestore(&bcs->aplock, flags); | ||
950 | } | 1052 | } |
951 | 1053 | ||
952 | /* | 1054 | /* |
@@ -958,19 +1060,19 @@ static void gigaset_release_appl(struct capi_ctr *ctr, u16 appl) | |||
958 | = container_of(ctr, struct gigaset_capi_ctr, ctr); | 1060 | = container_of(ctr, struct gigaset_capi_ctr, ctr); |
959 | struct cardstate *cs = iif->ctr.driverdata; | 1061 | struct cardstate *cs = iif->ctr.driverdata; |
960 | struct gigaset_capi_appl *ap, *tmp; | 1062 | struct gigaset_capi_appl *ap, *tmp; |
1063 | unsigned ch; | ||
961 | 1064 | ||
962 | list_for_each_entry_safe(ap, tmp, &iif->appls, ctrlist) | 1065 | list_for_each_entry_safe(ap, tmp, &iif->appls, ctrlist) |
963 | if (ap->id == appl) { | 1066 | if (ap->id == appl) { |
964 | if (ap->connected != APCONN_NONE) { | 1067 | /* remove from any channels */ |
965 | dev_err(cs->dev, | 1068 | for (ch = 0; ch < cs->channels; ch++) |
966 | "%s: application %u still connected\n", | 1069 | remove_appl_from_channel(&cs->bcs[ch], ap); |
967 | __func__, ap->id); | 1070 | |
968 | /* ToDo: clear active connection */ | 1071 | /* remove from registration list */ |
969 | } | ||
970 | list_del(&ap->ctrlist); | 1072 | list_del(&ap->ctrlist); |
971 | kfree(ap); | 1073 | kfree(ap); |
1074 | dev_info(cs->dev, "application %u released\n", appl); | ||
972 | } | 1075 | } |
973 | |||
974 | } | 1076 | } |
975 | 1077 | ||
976 | /* | 1078 | /* |
@@ -1149,7 +1251,8 @@ static void do_connect_req(struct gigaset_capi_ctr *iif, | |||
1149 | char **commands; | 1251 | char **commands; |
1150 | char *s; | 1252 | char *s; |
1151 | u8 *pp; | 1253 | u8 *pp; |
1152 | int i, l; | 1254 | unsigned long flags; |
1255 | int i, l, lbc, lhlc; | ||
1153 | u16 info; | 1256 | u16 info; |
1154 | 1257 | ||
1155 | /* decode message */ | 1258 | /* decode message */ |
@@ -1164,8 +1267,18 @@ static void do_connect_req(struct gigaset_capi_ctr *iif, | |||
1164 | send_conf(iif, ap, skb, CapiNoPlciAvailable); | 1267 | send_conf(iif, ap, skb, CapiNoPlciAvailable); |
1165 | return; | 1268 | return; |
1166 | } | 1269 | } |
1270 | spin_lock_irqsave(&bcs->aplock, flags); | ||
1271 | if (bcs->ap != NULL || bcs->apconnstate != APCONN_NONE) | ||
1272 | dev_warn(cs->dev, "%s: channel not properly cleared (%p/%d)\n", | ||
1273 | __func__, bcs->ap, bcs->apconnstate); | ||
1167 | ap->bcnext = NULL; | 1274 | ap->bcnext = NULL; |
1168 | bcs->ap = ap; | 1275 | bcs->ap = ap; |
1276 | bcs->apconnstate = APCONN_SETUP; | ||
1277 | spin_unlock_irqrestore(&bcs->aplock, flags); | ||
1278 | |||
1279 | bcs->rx_bufsize = ap->rp.datablklen; | ||
1280 | dev_kfree_skb(bcs->rx_skb); | ||
1281 | gigaset_new_rx_skb(bcs); | ||
1169 | cmsg->adr.adrPLCI |= (bcs->channel + 1) << 8; | 1282 | cmsg->adr.adrPLCI |= (bcs->channel + 1) << 8; |
1170 | 1283 | ||
1171 | /* build command table */ | 1284 | /* build command table */ |
@@ -1273,42 +1386,59 @@ static void do_connect_req(struct gigaset_capi_ctr *iif, | |||
1273 | goto error; | 1386 | goto error; |
1274 | } | 1387 | } |
1275 | 1388 | ||
1276 | /* check/encode parameter: BC */ | 1389 | /* |
1277 | if (cmsg->BC && cmsg->BC[0]) { | 1390 | * check/encode parameters: BC & HLC |
1278 | /* explicit BC overrides CIP */ | 1391 | * must be encoded together as device doesn't accept HLC separately |
1279 | l = 2*cmsg->BC[0] + 7; | 1392 | * explicit parameters override values derived from CIP |
1393 | */ | ||
1394 | |||
1395 | /* determine lengths */ | ||
1396 | if (cmsg->BC && cmsg->BC[0]) /* BC specified explicitly */ | ||
1397 | lbc = 2*cmsg->BC[0]; | ||
1398 | else if (cip2bchlc[cmsg->CIPValue].bc) /* BC derived from CIP */ | ||
1399 | lbc = strlen(cip2bchlc[cmsg->CIPValue].bc); | ||
1400 | else /* no BC */ | ||
1401 | lbc = 0; | ||
1402 | if (cmsg->HLC && cmsg->HLC[0]) /* HLC specified explicitly */ | ||
1403 | lhlc = 2*cmsg->HLC[0]; | ||
1404 | else if (cip2bchlc[cmsg->CIPValue].hlc) /* HLC derived from CIP */ | ||
1405 | lhlc = strlen(cip2bchlc[cmsg->CIPValue].hlc); | ||
1406 | else /* no HLC */ | ||
1407 | lhlc = 0; | ||
1408 | |||
1409 | if (lbc) { | ||
1410 | /* have BC: allocate and assemble command string */ | ||
1411 | l = lbc + 7; /* "^SBC=" + value + "\r" + null byte */ | ||
1412 | if (lhlc) | ||
1413 | l += lhlc + 7; /* ";^SHLC=" + value */ | ||
1280 | commands[AT_BC] = kmalloc(l, GFP_KERNEL); | 1414 | commands[AT_BC] = kmalloc(l, GFP_KERNEL); |
1281 | if (!commands[AT_BC]) | 1415 | if (!commands[AT_BC]) |
1282 | goto oom; | 1416 | goto oom; |
1283 | strcpy(commands[AT_BC], "^SBC="); | 1417 | strcpy(commands[AT_BC], "^SBC="); |
1284 | decode_ie(cmsg->BC, commands[AT_BC]+5); | 1418 | if (cmsg->BC && cmsg->BC[0]) /* BC specified explicitly */ |
1419 | decode_ie(cmsg->BC, commands[AT_BC] + 5); | ||
1420 | else /* BC derived from CIP */ | ||
1421 | strcpy(commands[AT_BC] + 5, | ||
1422 | cip2bchlc[cmsg->CIPValue].bc); | ||
1423 | if (lhlc) { | ||
1424 | strcpy(commands[AT_BC] + lbc + 5, ";^SHLC="); | ||
1425 | if (cmsg->HLC && cmsg->HLC[0]) | ||
1426 | /* HLC specified explicitly */ | ||
1427 | decode_ie(cmsg->HLC, | ||
1428 | commands[AT_BC] + lbc + 12); | ||
1429 | else /* HLC derived from CIP */ | ||
1430 | strcpy(commands[AT_BC] + lbc + 12, | ||
1431 | cip2bchlc[cmsg->CIPValue].hlc); | ||
1432 | } | ||
1285 | strcpy(commands[AT_BC] + l - 2, "\r"); | 1433 | strcpy(commands[AT_BC] + l - 2, "\r"); |
1286 | } else if (cip2bchlc[cmsg->CIPValue].bc) { | 1434 | } else { |
1287 | l = strlen(cip2bchlc[cmsg->CIPValue].bc) + 7; | 1435 | /* no BC */ |
1288 | commands[AT_BC] = kmalloc(l, GFP_KERNEL); | 1436 | if (lhlc) { |
1289 | if (!commands[AT_BC]) | 1437 | dev_notice(cs->dev, "%s: cannot set HLC without BC\n", |
1290 | goto oom; | 1438 | "CONNECT_REQ"); |
1291 | snprintf(commands[AT_BC], l, "^SBC=%s\r", | 1439 | info = CapiIllMessageParmCoding; /* ? */ |
1292 | cip2bchlc[cmsg->CIPValue].bc); | 1440 | goto error; |
1293 | } | 1441 | } |
1294 | |||
1295 | /* check/encode parameter: HLC */ | ||
1296 | if (cmsg->HLC && cmsg->HLC[0]) { | ||
1297 | /* explicit HLC overrides CIP */ | ||
1298 | l = 2*cmsg->HLC[0] + 7; | ||
1299 | commands[AT_HLC] = kmalloc(l, GFP_KERNEL); | ||
1300 | if (!commands[AT_HLC]) | ||
1301 | goto oom; | ||
1302 | strcpy(commands[AT_HLC], "^SHLC="); | ||
1303 | decode_ie(cmsg->HLC, commands[AT_HLC]+5); | ||
1304 | strcpy(commands[AT_HLC] + l - 2, "\r"); | ||
1305 | } else if (cip2bchlc[cmsg->CIPValue].hlc) { | ||
1306 | l = strlen(cip2bchlc[cmsg->CIPValue].hlc) + 7; | ||
1307 | commands[AT_HLC] = kmalloc(l, GFP_KERNEL); | ||
1308 | if (!commands[AT_HLC]) | ||
1309 | goto oom; | ||
1310 | snprintf(commands[AT_HLC], l, "^SHLC=%s\r", | ||
1311 | cip2bchlc[cmsg->CIPValue].hlc); | ||
1312 | } | 1442 | } |
1313 | 1443 | ||
1314 | /* check/encode parameter: B Protocol */ | 1444 | /* check/encode parameter: B Protocol */ |
@@ -1322,13 +1452,13 @@ static void do_connect_req(struct gigaset_capi_ctr *iif, | |||
1322 | bcs->proto2 = L2_HDLC; | 1452 | bcs->proto2 = L2_HDLC; |
1323 | break; | 1453 | break; |
1324 | case 1: | 1454 | case 1: |
1325 | bcs->proto2 = L2_BITSYNC; | 1455 | bcs->proto2 = L2_VOICE; |
1326 | break; | 1456 | break; |
1327 | default: | 1457 | default: |
1328 | dev_warn(cs->dev, | 1458 | dev_warn(cs->dev, |
1329 | "B1 Protocol %u unsupported, using Transparent\n", | 1459 | "B1 Protocol %u unsupported, using Transparent\n", |
1330 | cmsg->B1protocol); | 1460 | cmsg->B1protocol); |
1331 | bcs->proto2 = L2_BITSYNC; | 1461 | bcs->proto2 = L2_VOICE; |
1332 | } | 1462 | } |
1333 | if (cmsg->B2protocol != 1) | 1463 | if (cmsg->B2protocol != 1) |
1334 | dev_warn(cs->dev, | 1464 | dev_warn(cs->dev, |
@@ -1382,7 +1512,6 @@ static void do_connect_req(struct gigaset_capi_ctr *iif, | |||
1382 | goto error; | 1512 | goto error; |
1383 | } | 1513 | } |
1384 | gigaset_schedule_event(cs); | 1514 | gigaset_schedule_event(cs); |
1385 | ap->connected = APCONN_SETUP; | ||
1386 | send_conf(iif, ap, skb, CapiSuccess); | 1515 | send_conf(iif, ap, skb, CapiSuccess); |
1387 | return; | 1516 | return; |
1388 | 1517 | ||
@@ -1410,6 +1539,7 @@ static void do_connect_resp(struct gigaset_capi_ctr *iif, | |||
1410 | _cmsg *cmsg = &iif->acmsg; | 1539 | _cmsg *cmsg = &iif->acmsg; |
1411 | struct bc_state *bcs; | 1540 | struct bc_state *bcs; |
1412 | struct gigaset_capi_appl *oap; | 1541 | struct gigaset_capi_appl *oap; |
1542 | unsigned long flags; | ||
1413 | int channel; | 1543 | int channel; |
1414 | 1544 | ||
1415 | /* decode message */ | 1545 | /* decode message */ |
@@ -1429,12 +1559,24 @@ static void do_connect_resp(struct gigaset_capi_ctr *iif, | |||
1429 | switch (cmsg->Reject) { | 1559 | switch (cmsg->Reject) { |
1430 | case 0: /* Accept */ | 1560 | case 0: /* Accept */ |
1431 | /* drop all competing applications, keep only this one */ | 1561 | /* drop all competing applications, keep only this one */ |
1432 | for (oap = bcs->ap; oap != NULL; oap = oap->bcnext) | 1562 | spin_lock_irqsave(&bcs->aplock, flags); |
1433 | if (oap != ap) | 1563 | while (bcs->ap != NULL) { |
1564 | oap = bcs->ap; | ||
1565 | bcs->ap = oap->bcnext; | ||
1566 | if (oap != ap) { | ||
1567 | spin_unlock_irqrestore(&bcs->aplock, flags); | ||
1434 | send_disconnect_ind(bcs, oap, | 1568 | send_disconnect_ind(bcs, oap, |
1435 | CapiCallGivenToOtherApplication); | 1569 | CapiCallGivenToOtherApplication); |
1570 | spin_lock_irqsave(&bcs->aplock, flags); | ||
1571 | } | ||
1572 | } | ||
1436 | ap->bcnext = NULL; | 1573 | ap->bcnext = NULL; |
1437 | bcs->ap = ap; | 1574 | bcs->ap = ap; |
1575 | spin_unlock_irqrestore(&bcs->aplock, flags); | ||
1576 | |||
1577 | bcs->rx_bufsize = ap->rp.datablklen; | ||
1578 | dev_kfree_skb(bcs->rx_skb); | ||
1579 | gigaset_new_rx_skb(bcs); | ||
1438 | bcs->chstate |= CHS_NOTIFY_LL; | 1580 | bcs->chstate |= CHS_NOTIFY_LL; |
1439 | 1581 | ||
1440 | /* check/encode B channel protocol */ | 1582 | /* check/encode B channel protocol */ |
@@ -1448,13 +1590,13 @@ static void do_connect_resp(struct gigaset_capi_ctr *iif, | |||
1448 | bcs->proto2 = L2_HDLC; | 1590 | bcs->proto2 = L2_HDLC; |
1449 | break; | 1591 | break; |
1450 | case 1: | 1592 | case 1: |
1451 | bcs->proto2 = L2_BITSYNC; | 1593 | bcs->proto2 = L2_VOICE; |
1452 | break; | 1594 | break; |
1453 | default: | 1595 | default: |
1454 | dev_warn(cs->dev, | 1596 | dev_warn(cs->dev, |
1455 | "B1 Protocol %u unsupported, using Transparent\n", | 1597 | "B1 Protocol %u unsupported, using Transparent\n", |
1456 | cmsg->B1protocol); | 1598 | cmsg->B1protocol); |
1457 | bcs->proto2 = L2_BITSYNC; | 1599 | bcs->proto2 = L2_VOICE; |
1458 | } | 1600 | } |
1459 | if (cmsg->B2protocol != 1) | 1601 | if (cmsg->B2protocol != 1) |
1460 | dev_warn(cs->dev, | 1602 | dev_warn(cs->dev, |
@@ -1502,31 +1644,45 @@ static void do_connect_resp(struct gigaset_capi_ctr *iif, | |||
1502 | send_disconnect_ind(bcs, ap, 0); | 1644 | send_disconnect_ind(bcs, ap, 0); |
1503 | 1645 | ||
1504 | /* remove it from the list of listening apps */ | 1646 | /* remove it from the list of listening apps */ |
1647 | spin_lock_irqsave(&bcs->aplock, flags); | ||
1505 | if (bcs->ap == ap) { | 1648 | if (bcs->ap == ap) { |
1506 | bcs->ap = ap->bcnext; | 1649 | bcs->ap = ap->bcnext; |
1507 | if (bcs->ap == NULL) | 1650 | if (bcs->ap == NULL) { |
1508 | /* last one: stop ev-layer hupD notifications */ | 1651 | /* last one: stop ev-layer hupD notifications */ |
1652 | bcs->apconnstate = APCONN_NONE; | ||
1509 | bcs->chstate &= ~CHS_NOTIFY_LL; | 1653 | bcs->chstate &= ~CHS_NOTIFY_LL; |
1654 | } | ||
1655 | spin_unlock_irqrestore(&bcs->aplock, flags); | ||
1510 | return; | 1656 | return; |
1511 | } | 1657 | } |
1512 | for (oap = bcs->ap; oap != NULL; oap = oap->bcnext) { | 1658 | for (oap = bcs->ap; oap != NULL; oap = oap->bcnext) { |
1513 | if (oap->bcnext == ap) { | 1659 | if (oap->bcnext == ap) { |
1514 | oap->bcnext = oap->bcnext->bcnext; | 1660 | oap->bcnext = oap->bcnext->bcnext; |
1661 | spin_unlock_irqrestore(&bcs->aplock, flags); | ||
1515 | return; | 1662 | return; |
1516 | } | 1663 | } |
1517 | } | 1664 | } |
1665 | spin_unlock_irqrestore(&bcs->aplock, flags); | ||
1518 | dev_err(cs->dev, "%s: application %u not found\n", | 1666 | dev_err(cs->dev, "%s: application %u not found\n", |
1519 | __func__, ap->id); | 1667 | __func__, ap->id); |
1520 | return; | 1668 | return; |
1521 | 1669 | ||
1522 | default: /* Reject */ | 1670 | default: /* Reject */ |
1523 | /* drop all competing applications, keep only this one */ | 1671 | /* drop all competing applications, keep only this one */ |
1524 | for (oap = bcs->ap; oap != NULL; oap = oap->bcnext) | 1672 | spin_lock_irqsave(&bcs->aplock, flags); |
1525 | if (oap != ap) | 1673 | while (bcs->ap != NULL) { |
1674 | oap = bcs->ap; | ||
1675 | bcs->ap = oap->bcnext; | ||
1676 | if (oap != ap) { | ||
1677 | spin_unlock_irqrestore(&bcs->aplock, flags); | ||
1526 | send_disconnect_ind(bcs, oap, | 1678 | send_disconnect_ind(bcs, oap, |
1527 | CapiCallGivenToOtherApplication); | 1679 | CapiCallGivenToOtherApplication); |
1680 | spin_lock_irqsave(&bcs->aplock, flags); | ||
1681 | } | ||
1682 | } | ||
1528 | ap->bcnext = NULL; | 1683 | ap->bcnext = NULL; |
1529 | bcs->ap = ap; | 1684 | bcs->ap = ap; |
1685 | spin_unlock_irqrestore(&bcs->aplock, flags); | ||
1530 | 1686 | ||
1531 | /* reject call - will trigger DISCONNECT_IND for this app */ | 1687 | /* reject call - will trigger DISCONNECT_IND for this app */ |
1532 | dev_info(cs->dev, "%s: Reject=%x\n", | 1688 | dev_info(cs->dev, "%s: Reject=%x\n", |
@@ -1549,6 +1705,7 @@ static void do_connect_b3_req(struct gigaset_capi_ctr *iif, | |||
1549 | { | 1705 | { |
1550 | struct cardstate *cs = iif->ctr.driverdata; | 1706 | struct cardstate *cs = iif->ctr.driverdata; |
1551 | _cmsg *cmsg = &iif->acmsg; | 1707 | _cmsg *cmsg = &iif->acmsg; |
1708 | struct bc_state *bcs; | ||
1552 | int channel; | 1709 | int channel; |
1553 | 1710 | ||
1554 | /* decode message */ | 1711 | /* decode message */ |
@@ -1563,9 +1720,10 @@ static void do_connect_b3_req(struct gigaset_capi_ctr *iif, | |||
1563 | send_conf(iif, ap, skb, CapiIllContrPlciNcci); | 1720 | send_conf(iif, ap, skb, CapiIllContrPlciNcci); |
1564 | return; | 1721 | return; |
1565 | } | 1722 | } |
1723 | bcs = &cs->bcs[channel-1]; | ||
1566 | 1724 | ||
1567 | /* mark logical connection active */ | 1725 | /* mark logical connection active */ |
1568 | ap->connected = APCONN_ACTIVE; | 1726 | bcs->apconnstate = APCONN_ACTIVE; |
1569 | 1727 | ||
1570 | /* build NCCI: always 1 (one B3 connection only) */ | 1728 | /* build NCCI: always 1 (one B3 connection only) */ |
1571 | cmsg->adr.adrNCCI |= 1 << 16; | 1729 | cmsg->adr.adrNCCI |= 1 << 16; |
@@ -1611,7 +1769,7 @@ static void do_connect_b3_resp(struct gigaset_capi_ctr *iif, | |||
1611 | 1769 | ||
1612 | if (cmsg->Reject) { | 1770 | if (cmsg->Reject) { |
1613 | /* Reject: clear B3 connect received flag */ | 1771 | /* Reject: clear B3 connect received flag */ |
1614 | ap->connected = APCONN_SETUP; | 1772 | bcs->apconnstate = APCONN_SETUP; |
1615 | 1773 | ||
1616 | /* trigger hangup, causing eventual DISCONNECT_IND */ | 1774 | /* trigger hangup, causing eventual DISCONNECT_IND */ |
1617 | if (!gigaset_add_event(cs, &bcs->at_state, | 1775 | if (!gigaset_add_event(cs, &bcs->at_state, |
@@ -1683,11 +1841,11 @@ static void do_disconnect_req(struct gigaset_capi_ctr *iif, | |||
1683 | } | 1841 | } |
1684 | 1842 | ||
1685 | /* skip if DISCONNECT_IND already sent */ | 1843 | /* skip if DISCONNECT_IND already sent */ |
1686 | if (!ap->connected) | 1844 | if (!bcs->apconnstate) |
1687 | return; | 1845 | return; |
1688 | 1846 | ||
1689 | /* check for active logical connection */ | 1847 | /* check for active logical connection */ |
1690 | if (ap->connected >= APCONN_ACTIVE) { | 1848 | if (bcs->apconnstate >= APCONN_ACTIVE) { |
1691 | /* | 1849 | /* |
1692 | * emit DISCONNECT_B3_IND with cause 0x3301 | 1850 | * emit DISCONNECT_B3_IND with cause 0x3301 |
1693 | * use separate cmsg structure, as the content of iif->acmsg | 1851 | * use separate cmsg structure, as the content of iif->acmsg |
@@ -1736,6 +1894,7 @@ static void do_disconnect_b3_req(struct gigaset_capi_ctr *iif, | |||
1736 | { | 1894 | { |
1737 | struct cardstate *cs = iif->ctr.driverdata; | 1895 | struct cardstate *cs = iif->ctr.driverdata; |
1738 | _cmsg *cmsg = &iif->acmsg; | 1896 | _cmsg *cmsg = &iif->acmsg; |
1897 | struct bc_state *bcs; | ||
1739 | int channel; | 1898 | int channel; |
1740 | 1899 | ||
1741 | /* decode message */ | 1900 | /* decode message */ |
@@ -1751,17 +1910,17 @@ static void do_disconnect_b3_req(struct gigaset_capi_ctr *iif, | |||
1751 | send_conf(iif, ap, skb, CapiIllContrPlciNcci); | 1910 | send_conf(iif, ap, skb, CapiIllContrPlciNcci); |
1752 | return; | 1911 | return; |
1753 | } | 1912 | } |
1913 | bcs = &cs->bcs[channel-1]; | ||
1754 | 1914 | ||
1755 | /* reject if logical connection not active */ | 1915 | /* reject if logical connection not active */ |
1756 | if (ap->connected < APCONN_ACTIVE) { | 1916 | if (bcs->apconnstate < APCONN_ACTIVE) { |
1757 | send_conf(iif, ap, skb, | 1917 | send_conf(iif, ap, skb, |
1758 | CapiMessageNotSupportedInCurrentState); | 1918 | CapiMessageNotSupportedInCurrentState); |
1759 | return; | 1919 | return; |
1760 | } | 1920 | } |
1761 | 1921 | ||
1762 | /* trigger hangup, causing eventual DISCONNECT_B3_IND */ | 1922 | /* trigger hangup, causing eventual DISCONNECT_B3_IND */ |
1763 | if (!gigaset_add_event(cs, &cs->bcs[channel-1].at_state, | 1923 | if (!gigaset_add_event(cs, &bcs->at_state, EV_HUP, NULL, 0, NULL)) { |
1764 | EV_HUP, NULL, 0, NULL)) { | ||
1765 | send_conf(iif, ap, skb, CAPI_MSGOSRESOURCEERR); | 1924 | send_conf(iif, ap, skb, CAPI_MSGOSRESOURCEERR); |
1766 | return; | 1925 | return; |
1767 | } | 1926 | } |
@@ -1782,11 +1941,14 @@ static void do_data_b3_req(struct gigaset_capi_ctr *iif, | |||
1782 | struct sk_buff *skb) | 1941 | struct sk_buff *skb) |
1783 | { | 1942 | { |
1784 | struct cardstate *cs = iif->ctr.driverdata; | 1943 | struct cardstate *cs = iif->ctr.driverdata; |
1944 | struct bc_state *bcs; | ||
1785 | int channel = CAPIMSG_PLCI_PART(skb->data); | 1945 | int channel = CAPIMSG_PLCI_PART(skb->data); |
1786 | u16 ncci = CAPIMSG_NCCI_PART(skb->data); | 1946 | u16 ncci = CAPIMSG_NCCI_PART(skb->data); |
1787 | u16 msglen = CAPIMSG_LEN(skb->data); | 1947 | u16 msglen = CAPIMSG_LEN(skb->data); |
1788 | u16 datalen = CAPIMSG_DATALEN(skb->data); | 1948 | u16 datalen = CAPIMSG_DATALEN(skb->data); |
1789 | u16 flags = CAPIMSG_FLAGS(skb->data); | 1949 | u16 flags = CAPIMSG_FLAGS(skb->data); |
1950 | u16 msgid = CAPIMSG_MSGID(skb->data); | ||
1951 | u16 handle = CAPIMSG_HANDLE_REQ(skb->data); | ||
1790 | 1952 | ||
1791 | /* frequent message, avoid _cmsg overhead */ | 1953 | /* frequent message, avoid _cmsg overhead */ |
1792 | dump_rawmsg(DEBUG_LLDATA, "DATA_B3_REQ", skb->data); | 1954 | dump_rawmsg(DEBUG_LLDATA, "DATA_B3_REQ", skb->data); |
@@ -1802,6 +1964,7 @@ static void do_data_b3_req(struct gigaset_capi_ctr *iif, | |||
1802 | send_conf(iif, ap, skb, CapiIllContrPlciNcci); | 1964 | send_conf(iif, ap, skb, CapiIllContrPlciNcci); |
1803 | return; | 1965 | return; |
1804 | } | 1966 | } |
1967 | bcs = &cs->bcs[channel-1]; | ||
1805 | if (msglen != CAPI_DATA_B3_REQ_LEN && msglen != CAPI_DATA_B3_REQ_LEN64) | 1968 | if (msglen != CAPI_DATA_B3_REQ_LEN && msglen != CAPI_DATA_B3_REQ_LEN64) |
1806 | dev_notice(cs->dev, "%s: unexpected length %d\n", | 1969 | dev_notice(cs->dev, "%s: unexpected length %d\n", |
1807 | "DATA_B3_REQ", msglen); | 1970 | "DATA_B3_REQ", msglen); |
@@ -1821,7 +1984,7 @@ static void do_data_b3_req(struct gigaset_capi_ctr *iif, | |||
1821 | } | 1984 | } |
1822 | 1985 | ||
1823 | /* reject if logical connection not active */ | 1986 | /* reject if logical connection not active */ |
1824 | if (ap->connected < APCONN_ACTIVE) { | 1987 | if (bcs->apconnstate < APCONN_ACTIVE) { |
1825 | send_conf(iif, ap, skb, CapiMessageNotSupportedInCurrentState); | 1988 | send_conf(iif, ap, skb, CapiMessageNotSupportedInCurrentState); |
1826 | return; | 1989 | return; |
1827 | } | 1990 | } |
@@ -1832,17 +1995,19 @@ static void do_data_b3_req(struct gigaset_capi_ctr *iif, | |||
1832 | skb_pull(skb, msglen); | 1995 | skb_pull(skb, msglen); |
1833 | 1996 | ||
1834 | /* pass to device-specific module */ | 1997 | /* pass to device-specific module */ |
1835 | if (cs->ops->send_skb(&cs->bcs[channel-1], skb) < 0) { | 1998 | if (cs->ops->send_skb(bcs, skb) < 0) { |
1836 | send_conf(iif, ap, skb, CAPI_MSGOSRESOURCEERR); | 1999 | send_conf(iif, ap, skb, CAPI_MSGOSRESOURCEERR); |
1837 | return; | 2000 | return; |
1838 | } | 2001 | } |
1839 | 2002 | ||
1840 | /* DATA_B3_CONF reply will be sent by gigaset_skb_sent() */ | ||
1841 | |||
1842 | /* | 2003 | /* |
1843 | * ToDo: honor unset "delivery confirmation" bit | 2004 | * DATA_B3_CONF will be sent by gigaset_skb_sent() only if "delivery |
1844 | * (send DATA_B3_CONF immediately?) | 2005 | * confirmation" bit is set; otherwise we have to send it now |
1845 | */ | 2006 | */ |
2007 | if (!(flags & CAPI_FLAGS_DELIVERY_CONFIRMATION)) | ||
2008 | send_data_b3_conf(cs, &iif->ctr, ap->id, msgid, channel, handle, | ||
2009 | flags ? CapiFlagsNotSupportedByProtocol | ||
2010 | : CAPI_NOERROR); | ||
1846 | } | 2011 | } |
1847 | 2012 | ||
1848 | /* | 2013 | /* |
diff --git a/drivers/isdn/gigaset/common.c b/drivers/isdn/gigaset/common.c index f6f45f221920..5d4befb81057 100644 --- a/drivers/isdn/gigaset/common.c +++ b/drivers/isdn/gigaset/common.c | |||
@@ -399,8 +399,8 @@ static void gigaset_freebcs(struct bc_state *bcs) | |||
399 | gig_dbg(DEBUG_INIT, "clearing bcs[%d]->at_state", bcs->channel); | 399 | gig_dbg(DEBUG_INIT, "clearing bcs[%d]->at_state", bcs->channel); |
400 | clear_at_state(&bcs->at_state); | 400 | clear_at_state(&bcs->at_state); |
401 | gig_dbg(DEBUG_INIT, "freeing bcs[%d]->skb", bcs->channel); | 401 | gig_dbg(DEBUG_INIT, "freeing bcs[%d]->skb", bcs->channel); |
402 | dev_kfree_skb(bcs->skb); | 402 | dev_kfree_skb(bcs->rx_skb); |
403 | bcs->skb = NULL; | 403 | bcs->rx_skb = NULL; |
404 | 404 | ||
405 | for (i = 0; i < AT_NUM; ++i) { | 405 | for (i = 0; i < AT_NUM; ++i) { |
406 | kfree(bcs->commands[i]); | 406 | kfree(bcs->commands[i]); |
@@ -634,19 +634,10 @@ static struct bc_state *gigaset_initbcs(struct bc_state *bcs, | |||
634 | bcs->emptycount = 0; | 634 | bcs->emptycount = 0; |
635 | #endif | 635 | #endif |
636 | 636 | ||
637 | gig_dbg(DEBUG_INIT, "allocating bcs[%d]->skb", channel); | 637 | bcs->rx_bufsize = 0; |
638 | bcs->fcs = PPP_INITFCS; | 638 | bcs->rx_skb = NULL; |
639 | bcs->rx_fcs = PPP_INITFCS; | ||
639 | bcs->inputstate = 0; | 640 | bcs->inputstate = 0; |
640 | if (cs->ignoreframes) { | ||
641 | bcs->skb = NULL; | ||
642 | } else { | ||
643 | bcs->skb = dev_alloc_skb(SBUFSIZE + cs->hw_hdr_len); | ||
644 | if (bcs->skb != NULL) | ||
645 | skb_reserve(bcs->skb, cs->hw_hdr_len); | ||
646 | else | ||
647 | pr_err("out of memory\n"); | ||
648 | } | ||
649 | |||
650 | bcs->channel = channel; | 641 | bcs->channel = channel; |
651 | bcs->cs = cs; | 642 | bcs->cs = cs; |
652 | 643 | ||
@@ -658,16 +649,15 @@ static struct bc_state *gigaset_initbcs(struct bc_state *bcs, | |||
658 | for (i = 0; i < AT_NUM; ++i) | 649 | for (i = 0; i < AT_NUM; ++i) |
659 | bcs->commands[i] = NULL; | 650 | bcs->commands[i] = NULL; |
660 | 651 | ||
652 | spin_lock_init(&bcs->aplock); | ||
653 | bcs->ap = NULL; | ||
654 | bcs->apconnstate = 0; | ||
655 | |||
661 | gig_dbg(DEBUG_INIT, " setting up bcs[%d]->hw", channel); | 656 | gig_dbg(DEBUG_INIT, " setting up bcs[%d]->hw", channel); |
662 | if (cs->ops->initbcshw(bcs)) | 657 | if (cs->ops->initbcshw(bcs)) |
663 | return bcs; | 658 | return bcs; |
664 | 659 | ||
665 | gig_dbg(DEBUG_INIT, " failed"); | 660 | gig_dbg(DEBUG_INIT, " failed"); |
666 | |||
667 | gig_dbg(DEBUG_INIT, " freeing bcs[%d]->skb", channel); | ||
668 | dev_kfree_skb(bcs->skb); | ||
669 | bcs->skb = NULL; | ||
670 | |||
671 | return NULL; | 661 | return NULL; |
672 | } | 662 | } |
673 | 663 | ||
@@ -839,14 +829,12 @@ void gigaset_bcs_reinit(struct bc_state *bcs) | |||
839 | bcs->emptycount = 0; | 829 | bcs->emptycount = 0; |
840 | #endif | 830 | #endif |
841 | 831 | ||
842 | bcs->fcs = PPP_INITFCS; | 832 | bcs->rx_fcs = PPP_INITFCS; |
843 | bcs->chstate = 0; | 833 | bcs->chstate = 0; |
844 | 834 | ||
845 | bcs->ignore = cs->ignoreframes; | 835 | bcs->ignore = cs->ignoreframes; |
846 | if (bcs->ignore) { | 836 | dev_kfree_skb(bcs->rx_skb); |
847 | dev_kfree_skb(bcs->skb); | 837 | bcs->rx_skb = NULL; |
848 | bcs->skb = NULL; | ||
849 | } | ||
850 | 838 | ||
851 | cs->ops->reinitbcshw(bcs); | 839 | cs->ops->reinitbcshw(bcs); |
852 | } | 840 | } |
diff --git a/drivers/isdn/gigaset/ev-layer.c b/drivers/isdn/gigaset/ev-layer.c index 206c380c5235..ceaef9a04a42 100644 --- a/drivers/isdn/gigaset/ev-layer.c +++ b/drivers/isdn/gigaset/ev-layer.c | |||
@@ -282,9 +282,7 @@ struct reply_t gigaset_tab_cid[] = | |||
282 | /* dial */ | 282 | /* dial */ |
283 | {EV_DIAL, -1, -1, -1, -1, -1, {ACT_DIAL} }, | 283 | {EV_DIAL, -1, -1, -1, -1, -1, {ACT_DIAL} }, |
284 | {RSP_INIT, 0, 0, SEQ_DIAL, 601, 5, {ACT_CMD+AT_BC} }, | 284 | {RSP_INIT, 0, 0, SEQ_DIAL, 601, 5, {ACT_CMD+AT_BC} }, |
285 | {RSP_OK, 601, 601, -1, 602, 5, {ACT_CMD+AT_HLC} }, | 285 | {RSP_OK, 601, 601, -1, 603, 5, {ACT_CMD+AT_PROTO} }, |
286 | {RSP_NULL, 602, 602, -1, 603, 5, {ACT_CMD+AT_PROTO} }, | ||
287 | {RSP_OK, 602, 602, -1, 603, 5, {ACT_CMD+AT_PROTO} }, | ||
288 | {RSP_OK, 603, 603, -1, 604, 5, {ACT_CMD+AT_TYPE} }, | 286 | {RSP_OK, 603, 603, -1, 604, 5, {ACT_CMD+AT_TYPE} }, |
289 | {RSP_OK, 604, 604, -1, 605, 5, {ACT_CMD+AT_MSN} }, | 287 | {RSP_OK, 604, 604, -1, 605, 5, {ACT_CMD+AT_MSN} }, |
290 | {RSP_NULL, 605, 605, -1, 606, 5, {ACT_CMD+AT_CLIP} }, | 288 | {RSP_NULL, 605, 605, -1, 606, 5, {ACT_CMD+AT_CLIP} }, |
diff --git a/drivers/isdn/gigaset/gigaset.h b/drivers/isdn/gigaset/gigaset.h index 05947f9c1849..8738b0821fc9 100644 --- a/drivers/isdn/gigaset/gigaset.h +++ b/drivers/isdn/gigaset/gigaset.h | |||
@@ -45,10 +45,6 @@ | |||
45 | #define MAX_EVENTS 64 /* size of event queue */ | 45 | #define MAX_EVENTS 64 /* size of event queue */ |
46 | 46 | ||
47 | #define RBUFSIZE 8192 | 47 | #define RBUFSIZE 8192 |
48 | #define SBUFSIZE 4096 /* sk_buff payload size */ | ||
49 | |||
50 | #define TRANSBUFSIZE 768 /* bytes per skb for transparent receive */ | ||
51 | #define MAX_BUF_SIZE (SBUFSIZE - 2) /* Max. size of a data packet from LL */ | ||
52 | 48 | ||
53 | /* compile time options */ | 49 | /* compile time options */ |
54 | #define GIG_MAJOR 0 | 50 | #define GIG_MAJOR 0 |
@@ -190,10 +186,9 @@ void gigaset_dbg_buffer(enum debuglevel level, const unsigned char *msg, | |||
190 | #define AT_BC 3 | 186 | #define AT_BC 3 |
191 | #define AT_PROTO 4 | 187 | #define AT_PROTO 4 |
192 | #define AT_TYPE 5 | 188 | #define AT_TYPE 5 |
193 | #define AT_HLC 6 | 189 | #define AT_CLIP 6 |
194 | #define AT_CLIP 7 | ||
195 | /* total number */ | 190 | /* total number */ |
196 | #define AT_NUM 8 | 191 | #define AT_NUM 7 |
197 | 192 | ||
198 | /* variables in struct at_state_t */ | 193 | /* variables in struct at_state_t */ |
199 | #define VAR_ZSAU 0 | 194 | #define VAR_ZSAU 0 |
@@ -380,8 +375,10 @@ struct bc_state { | |||
380 | 375 | ||
381 | struct at_state_t at_state; | 376 | struct at_state_t at_state; |
382 | 377 | ||
383 | __u16 fcs; | 378 | /* receive buffer */ |
384 | struct sk_buff *skb; | 379 | unsigned rx_bufsize; /* max size accepted by application */ |
380 | struct sk_buff *rx_skb; | ||
381 | __u16 rx_fcs; | ||
385 | int inputstate; /* see INS_XXXX */ | 382 | int inputstate; /* see INS_XXXX */ |
386 | 383 | ||
387 | int channel; | 384 | int channel; |
@@ -406,7 +403,9 @@ struct bc_state { | |||
406 | struct bas_bc_state *bas; /* usb hardware driver (base) */ | 403 | struct bas_bc_state *bas; /* usb hardware driver (base) */ |
407 | } hw; | 404 | } hw; |
408 | 405 | ||
409 | void *ap; /* LL application structure */ | 406 | void *ap; /* associated LL application */ |
407 | int apconnstate; /* LL application connection state */ | ||
408 | spinlock_t aplock; | ||
410 | }; | 409 | }; |
411 | 410 | ||
412 | struct cardstate { | 411 | struct cardstate { |
@@ -801,8 +800,23 @@ static inline void gigaset_bchannel_up(struct bc_state *bcs) | |||
801 | gigaset_schedule_event(bcs->cs); | 800 | gigaset_schedule_event(bcs->cs); |
802 | } | 801 | } |
803 | 802 | ||
804 | /* handling routines for sk_buff */ | 803 | /* set up next receive skb for data mode */ |
805 | /* ============================= */ | 804 | static inline struct sk_buff *gigaset_new_rx_skb(struct bc_state *bcs) |
805 | { | ||
806 | struct cardstate *cs = bcs->cs; | ||
807 | unsigned short hw_hdr_len = cs->hw_hdr_len; | ||
808 | |||
809 | if (bcs->ignore) { | ||
810 | bcs->rx_skb = NULL; | ||
811 | } else { | ||
812 | bcs->rx_skb = dev_alloc_skb(bcs->rx_bufsize + hw_hdr_len); | ||
813 | if (bcs->rx_skb == NULL) | ||
814 | dev_warn(cs->dev, "could not allocate skb\n"); | ||
815 | else | ||
816 | skb_reserve(bcs->rx_skb, hw_hdr_len); | ||
817 | } | ||
818 | return bcs->rx_skb; | ||
819 | } | ||
806 | 820 | ||
807 | /* append received bytes to inbuf */ | 821 | /* append received bytes to inbuf */ |
808 | int gigaset_fill_inbuf(struct inbuf_t *inbuf, const unsigned char *src, | 822 | int gigaset_fill_inbuf(struct inbuf_t *inbuf, const unsigned char *src, |
diff --git a/drivers/isdn/gigaset/i4l.c b/drivers/isdn/gigaset/i4l.c index c22e5ace8276..f01c3c2e2e46 100644 --- a/drivers/isdn/gigaset/i4l.c +++ b/drivers/isdn/gigaset/i4l.c | |||
@@ -16,7 +16,10 @@ | |||
16 | #include "gigaset.h" | 16 | #include "gigaset.h" |
17 | #include <linux/isdnif.h> | 17 | #include <linux/isdnif.h> |
18 | 18 | ||
19 | #define SBUFSIZE 4096 /* sk_buff payload size */ | ||
20 | #define TRANSBUFSIZE 768 /* bytes per skb for transparent receive */ | ||
19 | #define HW_HDR_LEN 2 /* Header size used to store ack info */ | 21 | #define HW_HDR_LEN 2 /* Header size used to store ack info */ |
22 | #define MAX_BUF_SIZE (SBUFSIZE - HW_HDR_LEN) /* max data packet from LL */ | ||
20 | 23 | ||
21 | /* == Handling of I4L IO =====================================================*/ | 24 | /* == Handling of I4L IO =====================================================*/ |
22 | 25 | ||
@@ -231,6 +234,15 @@ static int command_from_LL(isdn_ctrl *cntrl) | |||
231 | dev_err(cs->dev, "ISDN_CMD_DIAL: channel not free\n"); | 234 | dev_err(cs->dev, "ISDN_CMD_DIAL: channel not free\n"); |
232 | return -EBUSY; | 235 | return -EBUSY; |
233 | } | 236 | } |
237 | switch (bcs->proto2) { | ||
238 | case L2_HDLC: | ||
239 | bcs->rx_bufsize = SBUFSIZE; | ||
240 | break; | ||
241 | default: /* assume transparent */ | ||
242 | bcs->rx_bufsize = TRANSBUFSIZE; | ||
243 | } | ||
244 | dev_kfree_skb(bcs->rx_skb); | ||
245 | gigaset_new_rx_skb(bcs); | ||
234 | 246 | ||
235 | commands = kzalloc(AT_NUM*(sizeof *commands), GFP_ATOMIC); | 247 | commands = kzalloc(AT_NUM*(sizeof *commands), GFP_ATOMIC); |
236 | if (!commands) { | 248 | if (!commands) { |
@@ -314,6 +326,15 @@ static int command_from_LL(isdn_ctrl *cntrl) | |||
314 | return -EINVAL; | 326 | return -EINVAL; |
315 | } | 327 | } |
316 | bcs = cs->bcs + ch; | 328 | bcs = cs->bcs + ch; |
329 | switch (bcs->proto2) { | ||
330 | case L2_HDLC: | ||
331 | bcs->rx_bufsize = SBUFSIZE; | ||
332 | break; | ||
333 | default: /* assume transparent */ | ||
334 | bcs->rx_bufsize = TRANSBUFSIZE; | ||
335 | } | ||
336 | dev_kfree_skb(bcs->rx_skb); | ||
337 | gigaset_new_rx_skb(bcs); | ||
317 | if (!gigaset_add_event(cs, &bcs->at_state, | 338 | if (!gigaset_add_event(cs, &bcs->at_state, |
318 | EV_ACCEPT, NULL, 0, NULL)) | 339 | EV_ACCEPT, NULL, 0, NULL)) |
319 | return -ENOMEM; | 340 | return -ENOMEM; |
diff --git a/drivers/isdn/gigaset/isocdata.c b/drivers/isdn/gigaset/isocdata.c index 16fd3bd48883..2dfd346fc889 100644 --- a/drivers/isdn/gigaset/isocdata.c +++ b/drivers/isdn/gigaset/isocdata.c | |||
@@ -500,19 +500,18 @@ int gigaset_isoc_buildframe(struct bc_state *bcs, unsigned char *in, int len) | |||
500 | */ | 500 | */ |
501 | static inline void hdlc_putbyte(unsigned char c, struct bc_state *bcs) | 501 | static inline void hdlc_putbyte(unsigned char c, struct bc_state *bcs) |
502 | { | 502 | { |
503 | bcs->fcs = crc_ccitt_byte(bcs->fcs, c); | 503 | bcs->rx_fcs = crc_ccitt_byte(bcs->rx_fcs, c); |
504 | if (unlikely(bcs->skb == NULL)) { | 504 | if (bcs->rx_skb == NULL) |
505 | /* skipping */ | 505 | /* skipping */ |
506 | return; | 506 | return; |
507 | } | 507 | if (bcs->rx_skb->len >= bcs->rx_bufsize) { |
508 | if (unlikely(bcs->skb->len == SBUFSIZE)) { | ||
509 | dev_warn(bcs->cs->dev, "received oversized packet discarded\n"); | 508 | dev_warn(bcs->cs->dev, "received oversized packet discarded\n"); |
510 | bcs->hw.bas->giants++; | 509 | bcs->hw.bas->giants++; |
511 | dev_kfree_skb_any(bcs->skb); | 510 | dev_kfree_skb_any(bcs->rx_skb); |
512 | bcs->skb = NULL; | 511 | bcs->rx_skb = NULL; |
513 | return; | 512 | return; |
514 | } | 513 | } |
515 | *__skb_put(bcs->skb, 1) = c; | 514 | *__skb_put(bcs->rx_skb, 1) = c; |
516 | } | 515 | } |
517 | 516 | ||
518 | /* hdlc_flush | 517 | /* hdlc_flush |
@@ -521,18 +520,13 @@ static inline void hdlc_putbyte(unsigned char c, struct bc_state *bcs) | |||
521 | static inline void hdlc_flush(struct bc_state *bcs) | 520 | static inline void hdlc_flush(struct bc_state *bcs) |
522 | { | 521 | { |
523 | /* clear skb or allocate new if not skipping */ | 522 | /* clear skb or allocate new if not skipping */ |
524 | if (likely(bcs->skb != NULL)) | 523 | if (bcs->rx_skb != NULL) |
525 | skb_trim(bcs->skb, 0); | 524 | skb_trim(bcs->rx_skb, 0); |
526 | else if (!bcs->ignore) { | 525 | else |
527 | bcs->skb = dev_alloc_skb(SBUFSIZE + bcs->cs->hw_hdr_len); | 526 | gigaset_new_rx_skb(bcs); |
528 | if (bcs->skb) | ||
529 | skb_reserve(bcs->skb, bcs->cs->hw_hdr_len); | ||
530 | else | ||
531 | dev_err(bcs->cs->dev, "could not allocate skb\n"); | ||
532 | } | ||
533 | 527 | ||
534 | /* reset packet state */ | 528 | /* reset packet state */ |
535 | bcs->fcs = PPP_INITFCS; | 529 | bcs->rx_fcs = PPP_INITFCS; |
536 | } | 530 | } |
537 | 531 | ||
538 | /* hdlc_done | 532 | /* hdlc_done |
@@ -549,7 +543,7 @@ static inline void hdlc_done(struct bc_state *bcs) | |||
549 | hdlc_flush(bcs); | 543 | hdlc_flush(bcs); |
550 | return; | 544 | return; |
551 | } | 545 | } |
552 | procskb = bcs->skb; | 546 | procskb = bcs->rx_skb; |
553 | if (procskb == NULL) { | 547 | if (procskb == NULL) { |
554 | /* previous error */ | 548 | /* previous error */ |
555 | gig_dbg(DEBUG_ISO, "%s: skb=NULL", __func__); | 549 | gig_dbg(DEBUG_ISO, "%s: skb=NULL", __func__); |
@@ -560,8 +554,8 @@ static inline void hdlc_done(struct bc_state *bcs) | |||
560 | bcs->hw.bas->runts++; | 554 | bcs->hw.bas->runts++; |
561 | dev_kfree_skb_any(procskb); | 555 | dev_kfree_skb_any(procskb); |
562 | gigaset_isdn_rcv_err(bcs); | 556 | gigaset_isdn_rcv_err(bcs); |
563 | } else if (bcs->fcs != PPP_GOODFCS) { | 557 | } else if (bcs->rx_fcs != PPP_GOODFCS) { |
564 | dev_notice(cs->dev, "frame check error (0x%04x)\n", bcs->fcs); | 558 | dev_notice(cs->dev, "frame check error\n"); |
565 | bcs->hw.bas->fcserrs++; | 559 | bcs->hw.bas->fcserrs++; |
566 | dev_kfree_skb_any(procskb); | 560 | dev_kfree_skb_any(procskb); |
567 | gigaset_isdn_rcv_err(bcs); | 561 | gigaset_isdn_rcv_err(bcs); |
@@ -574,13 +568,8 @@ static inline void hdlc_done(struct bc_state *bcs) | |||
574 | bcs->hw.bas->goodbytes += len; | 568 | bcs->hw.bas->goodbytes += len; |
575 | gigaset_skb_rcvd(bcs, procskb); | 569 | gigaset_skb_rcvd(bcs, procskb); |
576 | } | 570 | } |
577 | 571 | gigaset_new_rx_skb(bcs); | |
578 | bcs->skb = dev_alloc_skb(SBUFSIZE + cs->hw_hdr_len); | 572 | bcs->rx_fcs = PPP_INITFCS; |
579 | if (bcs->skb) | ||
580 | skb_reserve(bcs->skb, cs->hw_hdr_len); | ||
581 | else | ||
582 | dev_err(cs->dev, "could not allocate skb\n"); | ||
583 | bcs->fcs = PPP_INITFCS; | ||
584 | } | 573 | } |
585 | 574 | ||
586 | /* hdlc_frag | 575 | /* hdlc_frag |
@@ -597,8 +586,8 @@ static inline void hdlc_frag(struct bc_state *bcs, unsigned inbits) | |||
597 | dev_notice(bcs->cs->dev, "received partial byte (%d bits)\n", inbits); | 586 | dev_notice(bcs->cs->dev, "received partial byte (%d bits)\n", inbits); |
598 | bcs->hw.bas->alignerrs++; | 587 | bcs->hw.bas->alignerrs++; |
599 | gigaset_isdn_rcv_err(bcs); | 588 | gigaset_isdn_rcv_err(bcs); |
600 | __skb_trim(bcs->skb, 0); | 589 | __skb_trim(bcs->rx_skb, 0); |
601 | bcs->fcs = PPP_INITFCS; | 590 | bcs->rx_fcs = PPP_INITFCS; |
602 | } | 591 | } |
603 | 592 | ||
604 | /* bit counts lookup table for HDLC bit unstuffing | 593 | /* bit counts lookup table for HDLC bit unstuffing |
@@ -847,7 +836,6 @@ static inline void hdlc_unpack(unsigned char *src, unsigned count, | |||
847 | static inline void trans_receive(unsigned char *src, unsigned count, | 836 | static inline void trans_receive(unsigned char *src, unsigned count, |
848 | struct bc_state *bcs) | 837 | struct bc_state *bcs) |
849 | { | 838 | { |
850 | struct cardstate *cs = bcs->cs; | ||
851 | struct sk_buff *skb; | 839 | struct sk_buff *skb; |
852 | int dobytes; | 840 | int dobytes; |
853 | unsigned char *dst; | 841 | unsigned char *dst; |
@@ -857,17 +845,11 @@ static inline void trans_receive(unsigned char *src, unsigned count, | |||
857 | hdlc_flush(bcs); | 845 | hdlc_flush(bcs); |
858 | return; | 846 | return; |
859 | } | 847 | } |
860 | skb = bcs->skb; | 848 | skb = bcs->rx_skb; |
861 | if (unlikely(skb == NULL)) { | 849 | if (skb == NULL) |
862 | bcs->skb = skb = dev_alloc_skb(SBUFSIZE + cs->hw_hdr_len); | 850 | skb = gigaset_new_rx_skb(bcs); |
863 | if (!skb) { | ||
864 | dev_err(cs->dev, "could not allocate skb\n"); | ||
865 | return; | ||
866 | } | ||
867 | skb_reserve(skb, cs->hw_hdr_len); | ||
868 | } | ||
869 | bcs->hw.bas->goodbytes += skb->len; | 851 | bcs->hw.bas->goodbytes += skb->len; |
870 | dobytes = TRANSBUFSIZE - skb->len; | 852 | dobytes = bcs->rx_bufsize - skb->len; |
871 | while (count > 0) { | 853 | while (count > 0) { |
872 | dst = skb_put(skb, count < dobytes ? count : dobytes); | 854 | dst = skb_put(skb, count < dobytes ? count : dobytes); |
873 | while (count > 0 && dobytes > 0) { | 855 | while (count > 0 && dobytes > 0) { |
@@ -879,14 +861,10 @@ static inline void trans_receive(unsigned char *src, unsigned count, | |||
879 | dump_bytes(DEBUG_STREAM_DUMP, | 861 | dump_bytes(DEBUG_STREAM_DUMP, |
880 | "rcv data", skb->data, skb->len); | 862 | "rcv data", skb->data, skb->len); |
881 | gigaset_skb_rcvd(bcs, skb); | 863 | gigaset_skb_rcvd(bcs, skb); |
882 | bcs->skb = skb = | 864 | skb = gigaset_new_rx_skb(bcs); |
883 | dev_alloc_skb(SBUFSIZE + cs->hw_hdr_len); | 865 | if (skb == NULL) |
884 | if (!skb) { | ||
885 | dev_err(cs->dev, "could not allocate skb\n"); | ||
886 | return; | 866 | return; |
887 | } | 867 | dobytes = bcs->rx_bufsize; |
888 | skb_reserve(skb, cs->hw_hdr_len); | ||
889 | dobytes = TRANSBUFSIZE; | ||
890 | } | 868 | } |
891 | } | 869 | } |
892 | } | 870 | } |
diff --git a/drivers/isdn/hysdn/hysdn_net.c b/drivers/isdn/hysdn/hysdn_net.c index 72eb92647c1b..feec8d89d719 100644 --- a/drivers/isdn/hysdn/hysdn_net.c +++ b/drivers/isdn/hysdn/hysdn_net.c | |||
@@ -187,12 +187,13 @@ void | |||
187 | hysdn_rx_netpkt(hysdn_card * card, unsigned char *buf, unsigned short len) | 187 | hysdn_rx_netpkt(hysdn_card * card, unsigned char *buf, unsigned short len) |
188 | { | 188 | { |
189 | struct net_local *lp = card->netif; | 189 | struct net_local *lp = card->netif; |
190 | struct net_device *dev = lp->dev; | 190 | struct net_device *dev; |
191 | struct sk_buff *skb; | 191 | struct sk_buff *skb; |
192 | 192 | ||
193 | if (!lp) | 193 | if (!lp) |
194 | return; /* non existing device */ | 194 | return; /* non existing device */ |
195 | 195 | ||
196 | dev = lp->dev; | ||
196 | dev->stats.rx_bytes += len; | 197 | dev->stats.rx_bytes += len; |
197 | 198 | ||
198 | skb = dev_alloc_skb(len); | 199 | skb = dev_alloc_skb(len); |
diff --git a/drivers/md/md.c b/drivers/md/md.c index 46b3a044eadf..cb20d0b0555a 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
@@ -2087,6 +2087,7 @@ static void sync_sbs(mddev_t * mddev, int nospares) | |||
2087 | /* First make sure individual recovery_offsets are correct */ | 2087 | /* First make sure individual recovery_offsets are correct */ |
2088 | list_for_each_entry(rdev, &mddev->disks, same_set) { | 2088 | list_for_each_entry(rdev, &mddev->disks, same_set) { |
2089 | if (rdev->raid_disk >= 0 && | 2089 | if (rdev->raid_disk >= 0 && |
2090 | mddev->delta_disks >= 0 && | ||
2090 | !test_bit(In_sync, &rdev->flags) && | 2091 | !test_bit(In_sync, &rdev->flags) && |
2091 | mddev->curr_resync_completed > rdev->recovery_offset) | 2092 | mddev->curr_resync_completed > rdev->recovery_offset) |
2092 | rdev->recovery_offset = mddev->curr_resync_completed; | 2093 | rdev->recovery_offset = mddev->curr_resync_completed; |
@@ -3001,6 +3002,9 @@ level_store(mddev_t *mddev, const char *buf, size_t len) | |||
3001 | return -EINVAL; | 3002 | return -EINVAL; |
3002 | } | 3003 | } |
3003 | 3004 | ||
3005 | list_for_each_entry(rdev, &mddev->disks, same_set) | ||
3006 | rdev->new_raid_disk = rdev->raid_disk; | ||
3007 | |||
3004 | /* ->takeover must set new_* and/or delta_disks | 3008 | /* ->takeover must set new_* and/or delta_disks |
3005 | * if it succeeds, and may set them when it fails. | 3009 | * if it succeeds, and may set them when it fails. |
3006 | */ | 3010 | */ |
@@ -3051,13 +3055,35 @@ level_store(mddev_t *mddev, const char *buf, size_t len) | |||
3051 | mddev->safemode = 0; | 3055 | mddev->safemode = 0; |
3052 | } | 3056 | } |
3053 | 3057 | ||
3054 | module_put(mddev->pers->owner); | 3058 | list_for_each_entry(rdev, &mddev->disks, same_set) { |
3055 | /* Invalidate devices that are now superfluous */ | 3059 | char nm[20]; |
3056 | list_for_each_entry(rdev, &mddev->disks, same_set) | 3060 | if (rdev->raid_disk < 0) |
3057 | if (rdev->raid_disk >= mddev->raid_disks) { | 3061 | continue; |
3058 | rdev->raid_disk = -1; | 3062 | if (rdev->new_raid_disk > mddev->raid_disks) |
3063 | rdev->new_raid_disk = -1; | ||
3064 | if (rdev->new_raid_disk == rdev->raid_disk) | ||
3065 | continue; | ||
3066 | sprintf(nm, "rd%d", rdev->raid_disk); | ||
3067 | sysfs_remove_link(&mddev->kobj, nm); | ||
3068 | } | ||
3069 | list_for_each_entry(rdev, &mddev->disks, same_set) { | ||
3070 | if (rdev->raid_disk < 0) | ||
3071 | continue; | ||
3072 | if (rdev->new_raid_disk == rdev->raid_disk) | ||
3073 | continue; | ||
3074 | rdev->raid_disk = rdev->new_raid_disk; | ||
3075 | if (rdev->raid_disk < 0) | ||
3059 | clear_bit(In_sync, &rdev->flags); | 3076 | clear_bit(In_sync, &rdev->flags); |
3077 | else { | ||
3078 | char nm[20]; | ||
3079 | sprintf(nm, "rd%d", rdev->raid_disk); | ||
3080 | if(sysfs_create_link(&mddev->kobj, &rdev->kobj, nm)) | ||
3081 | printk("md: cannot register %s for %s after level change\n", | ||
3082 | nm, mdname(mddev)); | ||
3060 | } | 3083 | } |
3084 | } | ||
3085 | |||
3086 | module_put(mddev->pers->owner); | ||
3061 | mddev->pers = pers; | 3087 | mddev->pers = pers; |
3062 | mddev->private = priv; | 3088 | mddev->private = priv; |
3063 | strlcpy(mddev->clevel, pers->name, sizeof(mddev->clevel)); | 3089 | strlcpy(mddev->clevel, pers->name, sizeof(mddev->clevel)); |
@@ -5895,6 +5921,7 @@ static int md_open(struct block_device *bdev, fmode_t mode) | |||
5895 | atomic_inc(&mddev->openers); | 5921 | atomic_inc(&mddev->openers); |
5896 | mutex_unlock(&mddev->open_mutex); | 5922 | mutex_unlock(&mddev->open_mutex); |
5897 | 5923 | ||
5924 | check_disk_size_change(mddev->gendisk, bdev); | ||
5898 | out: | 5925 | out: |
5899 | return err; | 5926 | return err; |
5900 | } | 5927 | } |
@@ -6846,6 +6873,7 @@ void md_do_sync(mddev_t *mddev) | |||
6846 | rcu_read_lock(); | 6873 | rcu_read_lock(); |
6847 | list_for_each_entry_rcu(rdev, &mddev->disks, same_set) | 6874 | list_for_each_entry_rcu(rdev, &mddev->disks, same_set) |
6848 | if (rdev->raid_disk >= 0 && | 6875 | if (rdev->raid_disk >= 0 && |
6876 | mddev->delta_disks >= 0 && | ||
6849 | !test_bit(Faulty, &rdev->flags) && | 6877 | !test_bit(Faulty, &rdev->flags) && |
6850 | !test_bit(In_sync, &rdev->flags) && | 6878 | !test_bit(In_sync, &rdev->flags) && |
6851 | rdev->recovery_offset < mddev->curr_resync) | 6879 | rdev->recovery_offset < mddev->curr_resync) |
diff --git a/drivers/md/md.h b/drivers/md/md.h index 7ab5ea155452..10597bfec000 100644 --- a/drivers/md/md.h +++ b/drivers/md/md.h | |||
@@ -78,6 +78,9 @@ struct mdk_rdev_s | |||
78 | 78 | ||
79 | int desc_nr; /* descriptor index in the superblock */ | 79 | int desc_nr; /* descriptor index in the superblock */ |
80 | int raid_disk; /* role of device in array */ | 80 | int raid_disk; /* role of device in array */ |
81 | int new_raid_disk; /* role that the device will have in | ||
82 | * the array after a level-change completes. | ||
83 | */ | ||
81 | int saved_raid_disk; /* role that device used to have in the | 84 | int saved_raid_disk; /* role that device used to have in the |
82 | * array and could again if we did a partial | 85 | * array and could again if we did a partial |
83 | * resync from the bitmap | 86 | * resync from the bitmap |
diff --git a/drivers/md/raid0.c b/drivers/md/raid0.c index e70f004c99e8..563abed5a2cb 100644 --- a/drivers/md/raid0.c +++ b/drivers/md/raid0.c | |||
@@ -173,9 +173,11 @@ static int create_strip_zones(mddev_t *mddev, raid0_conf_t **private_conf) | |||
173 | list_for_each_entry(rdev1, &mddev->disks, same_set) { | 173 | list_for_each_entry(rdev1, &mddev->disks, same_set) { |
174 | int j = rdev1->raid_disk; | 174 | int j = rdev1->raid_disk; |
175 | 175 | ||
176 | if (mddev->level == 10) | 176 | if (mddev->level == 10) { |
177 | /* taking over a raid10-n2 array */ | 177 | /* taking over a raid10-n2 array */ |
178 | j /= 2; | 178 | j /= 2; |
179 | rdev1->new_raid_disk = j; | ||
180 | } | ||
179 | 181 | ||
180 | if (j < 0 || j >= mddev->raid_disks) { | 182 | if (j < 0 || j >= mddev->raid_disks) { |
181 | printk(KERN_ERR "md/raid0:%s: bad disk number %d - " | 183 | printk(KERN_ERR "md/raid0:%s: bad disk number %d - " |
@@ -361,12 +363,6 @@ static int raid0_run(mddev_t *mddev) | |||
361 | mddev->private = conf; | 363 | mddev->private = conf; |
362 | } | 364 | } |
363 | conf = mddev->private; | 365 | conf = mddev->private; |
364 | if (conf->scale_raid_disks) { | ||
365 | int i; | ||
366 | for (i=0; i < conf->strip_zone[0].nb_dev; i++) | ||
367 | conf->devlist[i]->raid_disk /= conf->scale_raid_disks; | ||
368 | /* FIXME update sysfs rd links */ | ||
369 | } | ||
370 | 366 | ||
371 | /* calculate array device size */ | 367 | /* calculate array device size */ |
372 | md_set_array_sectors(mddev, raid0_size(mddev, 0, 0)); | 368 | md_set_array_sectors(mddev, raid0_size(mddev, 0, 0)); |
@@ -573,7 +569,7 @@ static void raid0_status(struct seq_file *seq, mddev_t *mddev) | |||
573 | return; | 569 | return; |
574 | } | 570 | } |
575 | 571 | ||
576 | static void *raid0_takeover_raid5(mddev_t *mddev) | 572 | static void *raid0_takeover_raid45(mddev_t *mddev) |
577 | { | 573 | { |
578 | mdk_rdev_t *rdev; | 574 | mdk_rdev_t *rdev; |
579 | raid0_conf_t *priv_conf; | 575 | raid0_conf_t *priv_conf; |
@@ -596,6 +592,7 @@ static void *raid0_takeover_raid5(mddev_t *mddev) | |||
596 | 592 | ||
597 | /* Set new parameters */ | 593 | /* Set new parameters */ |
598 | mddev->new_level = 0; | 594 | mddev->new_level = 0; |
595 | mddev->new_layout = 0; | ||
599 | mddev->new_chunk_sectors = mddev->chunk_sectors; | 596 | mddev->new_chunk_sectors = mddev->chunk_sectors; |
600 | mddev->raid_disks--; | 597 | mddev->raid_disks--; |
601 | mddev->delta_disks = -1; | 598 | mddev->delta_disks = -1; |
@@ -635,6 +632,7 @@ static void *raid0_takeover_raid10(mddev_t *mddev) | |||
635 | 632 | ||
636 | /* Set new parameters */ | 633 | /* Set new parameters */ |
637 | mddev->new_level = 0; | 634 | mddev->new_level = 0; |
635 | mddev->new_layout = 0; | ||
638 | mddev->new_chunk_sectors = mddev->chunk_sectors; | 636 | mddev->new_chunk_sectors = mddev->chunk_sectors; |
639 | mddev->delta_disks = - mddev->raid_disks / 2; | 637 | mddev->delta_disks = - mddev->raid_disks / 2; |
640 | mddev->raid_disks += mddev->delta_disks; | 638 | mddev->raid_disks += mddev->delta_disks; |
@@ -643,19 +641,22 @@ static void *raid0_takeover_raid10(mddev_t *mddev) | |||
643 | mddev->recovery_cp = MaxSector; | 641 | mddev->recovery_cp = MaxSector; |
644 | 642 | ||
645 | create_strip_zones(mddev, &priv_conf); | 643 | create_strip_zones(mddev, &priv_conf); |
646 | priv_conf->scale_raid_disks = 2; | ||
647 | return priv_conf; | 644 | return priv_conf; |
648 | } | 645 | } |
649 | 646 | ||
650 | static void *raid0_takeover(mddev_t *mddev) | 647 | static void *raid0_takeover(mddev_t *mddev) |
651 | { | 648 | { |
652 | /* raid0 can take over: | 649 | /* raid0 can take over: |
650 | * raid4 - if all data disks are active. | ||
653 | * raid5 - providing it is Raid4 layout and one disk is faulty | 651 | * raid5 - providing it is Raid4 layout and one disk is faulty |
654 | * raid10 - assuming we have all necessary active disks | 652 | * raid10 - assuming we have all necessary active disks |
655 | */ | 653 | */ |
654 | if (mddev->level == 4) | ||
655 | return raid0_takeover_raid45(mddev); | ||
656 | |||
656 | if (mddev->level == 5) { | 657 | if (mddev->level == 5) { |
657 | if (mddev->layout == ALGORITHM_PARITY_N) | 658 | if (mddev->layout == ALGORITHM_PARITY_N) |
658 | return raid0_takeover_raid5(mddev); | 659 | return raid0_takeover_raid45(mddev); |
659 | 660 | ||
660 | printk(KERN_ERR "md/raid0:%s: Raid can only takeover Raid5 with layout: %d\n", | 661 | printk(KERN_ERR "md/raid0:%s: Raid can only takeover Raid5 with layout: %d\n", |
661 | mdname(mddev), ALGORITHM_PARITY_N); | 662 | mdname(mddev), ALGORITHM_PARITY_N); |
diff --git a/drivers/md/raid0.h b/drivers/md/raid0.h index d724e664ca4d..91f8e876ee64 100644 --- a/drivers/md/raid0.h +++ b/drivers/md/raid0.h | |||
@@ -13,9 +13,6 @@ struct raid0_private_data | |||
13 | struct strip_zone *strip_zone; | 13 | struct strip_zone *strip_zone; |
14 | mdk_rdev_t **devlist; /* lists of rdevs, pointed to by strip_zone->dev */ | 14 | mdk_rdev_t **devlist; /* lists of rdevs, pointed to by strip_zone->dev */ |
15 | int nr_strip_zones; | 15 | int nr_strip_zones; |
16 | int scale_raid_disks; /* divide rdev->raid_disks by this in run() | ||
17 | * to handle conversion from raid10 | ||
18 | */ | ||
19 | }; | 16 | }; |
20 | 17 | ||
21 | typedef struct raid0_private_data raid0_conf_t; | 18 | typedef struct raid0_private_data raid0_conf_t; |
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c index 03724992cdf2..42e64e4e5e25 100644 --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c | |||
@@ -1482,14 +1482,14 @@ static void fix_read_error(conf_t *conf, mddev_t *mddev, r10bio_t *r10_bio) | |||
1482 | int sectors = r10_bio->sectors; | 1482 | int sectors = r10_bio->sectors; |
1483 | mdk_rdev_t*rdev; | 1483 | mdk_rdev_t*rdev; |
1484 | int max_read_errors = atomic_read(&mddev->max_corr_read_errors); | 1484 | int max_read_errors = atomic_read(&mddev->max_corr_read_errors); |
1485 | int d = r10_bio->devs[r10_bio->read_slot].devnum; | ||
1485 | 1486 | ||
1486 | rcu_read_lock(); | 1487 | rcu_read_lock(); |
1487 | { | 1488 | rdev = rcu_dereference(conf->mirrors[d].rdev); |
1488 | int d = r10_bio->devs[r10_bio->read_slot].devnum; | 1489 | if (rdev) { /* If rdev is not NULL */ |
1489 | char b[BDEVNAME_SIZE]; | 1490 | char b[BDEVNAME_SIZE]; |
1490 | int cur_read_error_count = 0; | 1491 | int cur_read_error_count = 0; |
1491 | 1492 | ||
1492 | rdev = rcu_dereference(conf->mirrors[d].rdev); | ||
1493 | bdevname(rdev->bdev, b); | 1493 | bdevname(rdev->bdev, b); |
1494 | 1494 | ||
1495 | if (test_bit(Faulty, &rdev->flags)) { | 1495 | if (test_bit(Faulty, &rdev->flags)) { |
@@ -1530,7 +1530,7 @@ static void fix_read_error(conf_t *conf, mddev_t *mddev, r10bio_t *r10_bio) | |||
1530 | 1530 | ||
1531 | rcu_read_lock(); | 1531 | rcu_read_lock(); |
1532 | do { | 1532 | do { |
1533 | int d = r10_bio->devs[sl].devnum; | 1533 | d = r10_bio->devs[sl].devnum; |
1534 | rdev = rcu_dereference(conf->mirrors[d].rdev); | 1534 | rdev = rcu_dereference(conf->mirrors[d].rdev); |
1535 | if (rdev && | 1535 | if (rdev && |
1536 | test_bit(In_sync, &rdev->flags)) { | 1536 | test_bit(In_sync, &rdev->flags)) { |
@@ -1564,7 +1564,7 @@ static void fix_read_error(conf_t *conf, mddev_t *mddev, r10bio_t *r10_bio) | |||
1564 | rcu_read_lock(); | 1564 | rcu_read_lock(); |
1565 | while (sl != r10_bio->read_slot) { | 1565 | while (sl != r10_bio->read_slot) { |
1566 | char b[BDEVNAME_SIZE]; | 1566 | char b[BDEVNAME_SIZE]; |
1567 | int d; | 1567 | |
1568 | if (sl==0) | 1568 | if (sl==0) |
1569 | sl = conf->copies; | 1569 | sl = conf->copies; |
1570 | sl--; | 1570 | sl--; |
@@ -1601,7 +1601,7 @@ static void fix_read_error(conf_t *conf, mddev_t *mddev, r10bio_t *r10_bio) | |||
1601 | } | 1601 | } |
1602 | sl = start; | 1602 | sl = start; |
1603 | while (sl != r10_bio->read_slot) { | 1603 | while (sl != r10_bio->read_slot) { |
1604 | int d; | 1604 | |
1605 | if (sl==0) | 1605 | if (sl==0) |
1606 | sl = conf->copies; | 1606 | sl = conf->copies; |
1607 | sl--; | 1607 | sl--; |
@@ -2161,22 +2161,22 @@ static conf_t *setup_conf(mddev_t *mddev) | |||
2161 | sector_t stride, size; | 2161 | sector_t stride, size; |
2162 | int err = -EINVAL; | 2162 | int err = -EINVAL; |
2163 | 2163 | ||
2164 | if (mddev->chunk_sectors < (PAGE_SIZE >> 9) || | 2164 | if (mddev->new_chunk_sectors < (PAGE_SIZE >> 9) || |
2165 | !is_power_of_2(mddev->chunk_sectors)) { | 2165 | !is_power_of_2(mddev->new_chunk_sectors)) { |
2166 | printk(KERN_ERR "md/raid10:%s: chunk size must be " | 2166 | printk(KERN_ERR "md/raid10:%s: chunk size must be " |
2167 | "at least PAGE_SIZE(%ld) and be a power of 2.\n", | 2167 | "at least PAGE_SIZE(%ld) and be a power of 2.\n", |
2168 | mdname(mddev), PAGE_SIZE); | 2168 | mdname(mddev), PAGE_SIZE); |
2169 | goto out; | 2169 | goto out; |
2170 | } | 2170 | } |
2171 | 2171 | ||
2172 | nc = mddev->layout & 255; | 2172 | nc = mddev->new_layout & 255; |
2173 | fc = (mddev->layout >> 8) & 255; | 2173 | fc = (mddev->new_layout >> 8) & 255; |
2174 | fo = mddev->layout & (1<<16); | 2174 | fo = mddev->new_layout & (1<<16); |
2175 | 2175 | ||
2176 | if ((nc*fc) <2 || (nc*fc) > mddev->raid_disks || | 2176 | if ((nc*fc) <2 || (nc*fc) > mddev->raid_disks || |
2177 | (mddev->layout >> 17)) { | 2177 | (mddev->new_layout >> 17)) { |
2178 | printk(KERN_ERR "md/raid10:%s: unsupported raid10 layout: 0x%8x\n", | 2178 | printk(KERN_ERR "md/raid10:%s: unsupported raid10 layout: 0x%8x\n", |
2179 | mdname(mddev), mddev->layout); | 2179 | mdname(mddev), mddev->new_layout); |
2180 | goto out; | 2180 | goto out; |
2181 | } | 2181 | } |
2182 | 2182 | ||
@@ -2241,7 +2241,6 @@ static conf_t *setup_conf(mddev_t *mddev) | |||
2241 | if (!conf->thread) | 2241 | if (!conf->thread) |
2242 | goto out; | 2242 | goto out; |
2243 | 2243 | ||
2244 | conf->scale_disks = 0; | ||
2245 | conf->mddev = mddev; | 2244 | conf->mddev = mddev; |
2246 | return conf; | 2245 | return conf; |
2247 | 2246 | ||
@@ -2300,11 +2299,6 @@ static int run(mddev_t *mddev) | |||
2300 | if (disk_idx >= conf->raid_disks | 2299 | if (disk_idx >= conf->raid_disks |
2301 | || disk_idx < 0) | 2300 | || disk_idx < 0) |
2302 | continue; | 2301 | continue; |
2303 | if (conf->scale_disks) { | ||
2304 | disk_idx *= conf->scale_disks; | ||
2305 | rdev->raid_disk = disk_idx; | ||
2306 | /* MOVE 'rd%d' link !! */ | ||
2307 | } | ||
2308 | disk = conf->mirrors + disk_idx; | 2302 | disk = conf->mirrors + disk_idx; |
2309 | 2303 | ||
2310 | disk->rdev = rdev; | 2304 | disk->rdev = rdev; |
@@ -2435,26 +2429,22 @@ static void *raid10_takeover_raid0(mddev_t *mddev) | |||
2435 | return ERR_PTR(-EINVAL); | 2429 | return ERR_PTR(-EINVAL); |
2436 | } | 2430 | } |
2437 | 2431 | ||
2438 | /* Update slot numbers to obtain | ||
2439 | * degraded raid10 with missing mirrors | ||
2440 | */ | ||
2441 | list_for_each_entry(rdev, &mddev->disks, same_set) { | ||
2442 | rdev->raid_disk *= 2; | ||
2443 | } | ||
2444 | |||
2445 | /* Set new parameters */ | 2432 | /* Set new parameters */ |
2446 | mddev->new_level = 10; | 2433 | mddev->new_level = 10; |
2447 | /* new layout: far_copies = 1, near_copies = 2 */ | 2434 | /* new layout: far_copies = 1, near_copies = 2 */ |
2448 | mddev->new_layout = (1<<8) + 2; | 2435 | mddev->new_layout = (1<<8) + 2; |
2449 | mddev->new_chunk_sectors = mddev->chunk_sectors; | 2436 | mddev->new_chunk_sectors = mddev->chunk_sectors; |
2450 | mddev->delta_disks = mddev->raid_disks; | 2437 | mddev->delta_disks = mddev->raid_disks; |
2451 | mddev->degraded = mddev->raid_disks; | ||
2452 | mddev->raid_disks *= 2; | 2438 | mddev->raid_disks *= 2; |
2453 | /* make sure it will be not marked as dirty */ | 2439 | /* make sure it will be not marked as dirty */ |
2454 | mddev->recovery_cp = MaxSector; | 2440 | mddev->recovery_cp = MaxSector; |
2455 | 2441 | ||
2456 | conf = setup_conf(mddev); | 2442 | conf = setup_conf(mddev); |
2457 | conf->scale_disks = 2; | 2443 | if (!IS_ERR(conf)) |
2444 | list_for_each_entry(rdev, &mddev->disks, same_set) | ||
2445 | if (rdev->raid_disk >= 0) | ||
2446 | rdev->new_raid_disk = rdev->raid_disk * 2; | ||
2447 | |||
2458 | return conf; | 2448 | return conf; |
2459 | } | 2449 | } |
2460 | 2450 | ||
diff --git a/drivers/md/raid10.h b/drivers/md/raid10.h index 3824a087e17c..2316ac2e8e21 100644 --- a/drivers/md/raid10.h +++ b/drivers/md/raid10.h | |||
@@ -38,11 +38,6 @@ struct r10_private_data_s { | |||
38 | int chunk_shift; /* shift from chunks to sectors */ | 38 | int chunk_shift; /* shift from chunks to sectors */ |
39 | sector_t chunk_mask; | 39 | sector_t chunk_mask; |
40 | 40 | ||
41 | int scale_disks; /* When starting array, multiply | ||
42 | * each ->raid_disk by this. | ||
43 | * Need for raid0->raid10 migration | ||
44 | */ | ||
45 | |||
46 | struct list_head retry_list; | 41 | struct list_head retry_list; |
47 | /* queue pending writes and submit them on unplug */ | 42 | /* queue pending writes and submit them on unplug */ |
48 | struct bio_list pending_bio_list; | 43 | struct bio_list pending_bio_list; |
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index d2c0f94fa37d..96c690279fc6 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c | |||
@@ -277,12 +277,13 @@ out: | |||
277 | return sh; | 277 | return sh; |
278 | } | 278 | } |
279 | 279 | ||
280 | static void shrink_buffers(struct stripe_head *sh, int num) | 280 | static void shrink_buffers(struct stripe_head *sh) |
281 | { | 281 | { |
282 | struct page *p; | 282 | struct page *p; |
283 | int i; | 283 | int i; |
284 | int num = sh->raid_conf->pool_size; | ||
284 | 285 | ||
285 | for (i=0; i<num ; i++) { | 286 | for (i = 0; i < num ; i++) { |
286 | p = sh->dev[i].page; | 287 | p = sh->dev[i].page; |
287 | if (!p) | 288 | if (!p) |
288 | continue; | 289 | continue; |
@@ -291,11 +292,12 @@ static void shrink_buffers(struct stripe_head *sh, int num) | |||
291 | } | 292 | } |
292 | } | 293 | } |
293 | 294 | ||
294 | static int grow_buffers(struct stripe_head *sh, int num) | 295 | static int grow_buffers(struct stripe_head *sh) |
295 | { | 296 | { |
296 | int i; | 297 | int i; |
298 | int num = sh->raid_conf->pool_size; | ||
297 | 299 | ||
298 | for (i=0; i<num; i++) { | 300 | for (i = 0; i < num; i++) { |
299 | struct page *page; | 301 | struct page *page; |
300 | 302 | ||
301 | if (!(page = alloc_page(GFP_KERNEL))) { | 303 | if (!(page = alloc_page(GFP_KERNEL))) { |
@@ -364,6 +366,73 @@ static struct stripe_head *__find_stripe(raid5_conf_t *conf, sector_t sector, | |||
364 | return NULL; | 366 | return NULL; |
365 | } | 367 | } |
366 | 368 | ||
369 | /* | ||
370 | * Need to check if array has failed when deciding whether to: | ||
371 | * - start an array | ||
372 | * - remove non-faulty devices | ||
373 | * - add a spare | ||
374 | * - allow a reshape | ||
375 | * This determination is simple when no reshape is happening. | ||
376 | * However if there is a reshape, we need to carefully check | ||
377 | * both the before and after sections. | ||
378 | * This is because some failed devices may only affect one | ||
379 | * of the two sections, and some non-in_sync devices may | ||
380 | * be insync in the section most affected by failed devices. | ||
381 | */ | ||
382 | static int has_failed(raid5_conf_t *conf) | ||
383 | { | ||
384 | int degraded; | ||
385 | int i; | ||
386 | if (conf->mddev->reshape_position == MaxSector) | ||
387 | return conf->mddev->degraded > conf->max_degraded; | ||
388 | |||
389 | rcu_read_lock(); | ||
390 | degraded = 0; | ||
391 | for (i = 0; i < conf->previous_raid_disks; i++) { | ||
392 | mdk_rdev_t *rdev = rcu_dereference(conf->disks[i].rdev); | ||
393 | if (!rdev || test_bit(Faulty, &rdev->flags)) | ||
394 | degraded++; | ||
395 | else if (test_bit(In_sync, &rdev->flags)) | ||
396 | ; | ||
397 | else | ||
398 | /* not in-sync or faulty. | ||
399 | * If the reshape increases the number of devices, | ||
400 | * this is being recovered by the reshape, so | ||
401 | * this 'previous' section is not in_sync. | ||
402 | * If the number of devices is being reduced however, | ||
403 | * the device can only be part of the array if | ||
404 | * we are reverting a reshape, so this section will | ||
405 | * be in-sync. | ||
406 | */ | ||
407 | if (conf->raid_disks >= conf->previous_raid_disks) | ||
408 | degraded++; | ||
409 | } | ||
410 | rcu_read_unlock(); | ||
411 | if (degraded > conf->max_degraded) | ||
412 | return 1; | ||
413 | rcu_read_lock(); | ||
414 | degraded = 0; | ||
415 | for (i = 0; i < conf->raid_disks; i++) { | ||
416 | mdk_rdev_t *rdev = rcu_dereference(conf->disks[i].rdev); | ||
417 | if (!rdev || test_bit(Faulty, &rdev->flags)) | ||
418 | degraded++; | ||
419 | else if (test_bit(In_sync, &rdev->flags)) | ||
420 | ; | ||
421 | else | ||
422 | /* not in-sync or faulty. | ||
423 | * If reshape increases the number of devices, this | ||
424 | * section has already been recovered, else it | ||
425 | * almost certainly hasn't. | ||
426 | */ | ||
427 | if (conf->raid_disks <= conf->previous_raid_disks) | ||
428 | degraded++; | ||
429 | } | ||
430 | rcu_read_unlock(); | ||
431 | if (degraded > conf->max_degraded) | ||
432 | return 1; | ||
433 | return 0; | ||
434 | } | ||
435 | |||
367 | static void unplug_slaves(mddev_t *mddev); | 436 | static void unplug_slaves(mddev_t *mddev); |
368 | static void raid5_unplug_device(struct request_queue *q); | 437 | static void raid5_unplug_device(struct request_queue *q); |
369 | 438 | ||
@@ -1240,19 +1309,18 @@ static void raid_run_ops(struct stripe_head *sh, unsigned long ops_request) | |||
1240 | static int grow_one_stripe(raid5_conf_t *conf) | 1309 | static int grow_one_stripe(raid5_conf_t *conf) |
1241 | { | 1310 | { |
1242 | struct stripe_head *sh; | 1311 | struct stripe_head *sh; |
1243 | int disks = max(conf->raid_disks, conf->previous_raid_disks); | ||
1244 | sh = kmem_cache_alloc(conf->slab_cache, GFP_KERNEL); | 1312 | sh = kmem_cache_alloc(conf->slab_cache, GFP_KERNEL); |
1245 | if (!sh) | 1313 | if (!sh) |
1246 | return 0; | 1314 | return 0; |
1247 | memset(sh, 0, sizeof(*sh) + (disks-1)*sizeof(struct r5dev)); | 1315 | memset(sh, 0, sizeof(*sh) + (conf->pool_size-1)*sizeof(struct r5dev)); |
1248 | sh->raid_conf = conf; | 1316 | sh->raid_conf = conf; |
1249 | spin_lock_init(&sh->lock); | 1317 | spin_lock_init(&sh->lock); |
1250 | #ifdef CONFIG_MULTICORE_RAID456 | 1318 | #ifdef CONFIG_MULTICORE_RAID456 |
1251 | init_waitqueue_head(&sh->ops.wait_for_ops); | 1319 | init_waitqueue_head(&sh->ops.wait_for_ops); |
1252 | #endif | 1320 | #endif |
1253 | 1321 | ||
1254 | if (grow_buffers(sh, disks)) { | 1322 | if (grow_buffers(sh)) { |
1255 | shrink_buffers(sh, disks); | 1323 | shrink_buffers(sh); |
1256 | kmem_cache_free(conf->slab_cache, sh); | 1324 | kmem_cache_free(conf->slab_cache, sh); |
1257 | return 0; | 1325 | return 0; |
1258 | } | 1326 | } |
@@ -1468,7 +1536,7 @@ static int drop_one_stripe(raid5_conf_t *conf) | |||
1468 | if (!sh) | 1536 | if (!sh) |
1469 | return 0; | 1537 | return 0; |
1470 | BUG_ON(atomic_read(&sh->count)); | 1538 | BUG_ON(atomic_read(&sh->count)); |
1471 | shrink_buffers(sh, conf->pool_size); | 1539 | shrink_buffers(sh); |
1472 | kmem_cache_free(conf->slab_cache, sh); | 1540 | kmem_cache_free(conf->slab_cache, sh); |
1473 | atomic_dec(&conf->active_stripes); | 1541 | atomic_dec(&conf->active_stripes); |
1474 | return 1; | 1542 | return 1; |
@@ -2963,7 +3031,6 @@ static void handle_stripe5(struct stripe_head *sh) | |||
2963 | mdk_rdev_t *rdev; | 3031 | mdk_rdev_t *rdev; |
2964 | 3032 | ||
2965 | dev = &sh->dev[i]; | 3033 | dev = &sh->dev[i]; |
2966 | clear_bit(R5_Insync, &dev->flags); | ||
2967 | 3034 | ||
2968 | pr_debug("check %d: state 0x%lx toread %p read %p write %p " | 3035 | pr_debug("check %d: state 0x%lx toread %p read %p write %p " |
2969 | "written %p\n", i, dev->flags, dev->toread, dev->read, | 3036 | "written %p\n", i, dev->flags, dev->toread, dev->read, |
@@ -3000,17 +3067,27 @@ static void handle_stripe5(struct stripe_head *sh) | |||
3000 | blocked_rdev = rdev; | 3067 | blocked_rdev = rdev; |
3001 | atomic_inc(&rdev->nr_pending); | 3068 | atomic_inc(&rdev->nr_pending); |
3002 | } | 3069 | } |
3003 | if (!rdev || !test_bit(In_sync, &rdev->flags)) { | 3070 | clear_bit(R5_Insync, &dev->flags); |
3071 | if (!rdev) | ||
3072 | /* Not in-sync */; | ||
3073 | else if (test_bit(In_sync, &rdev->flags)) | ||
3074 | set_bit(R5_Insync, &dev->flags); | ||
3075 | else { | ||
3076 | /* could be in-sync depending on recovery/reshape status */ | ||
3077 | if (sh->sector + STRIPE_SECTORS <= rdev->recovery_offset) | ||
3078 | set_bit(R5_Insync, &dev->flags); | ||
3079 | } | ||
3080 | if (!test_bit(R5_Insync, &dev->flags)) { | ||
3004 | /* The ReadError flag will just be confusing now */ | 3081 | /* The ReadError flag will just be confusing now */ |
3005 | clear_bit(R5_ReadError, &dev->flags); | 3082 | clear_bit(R5_ReadError, &dev->flags); |
3006 | clear_bit(R5_ReWrite, &dev->flags); | 3083 | clear_bit(R5_ReWrite, &dev->flags); |
3007 | } | 3084 | } |
3008 | if (!rdev || !test_bit(In_sync, &rdev->flags) | 3085 | if (test_bit(R5_ReadError, &dev->flags)) |
3009 | || test_bit(R5_ReadError, &dev->flags)) { | 3086 | clear_bit(R5_Insync, &dev->flags); |
3087 | if (!test_bit(R5_Insync, &dev->flags)) { | ||
3010 | s.failed++; | 3088 | s.failed++; |
3011 | s.failed_num = i; | 3089 | s.failed_num = i; |
3012 | } else | 3090 | } |
3013 | set_bit(R5_Insync, &dev->flags); | ||
3014 | } | 3091 | } |
3015 | rcu_read_unlock(); | 3092 | rcu_read_unlock(); |
3016 | 3093 | ||
@@ -3244,7 +3321,6 @@ static void handle_stripe6(struct stripe_head *sh) | |||
3244 | for (i=disks; i--; ) { | 3321 | for (i=disks; i--; ) { |
3245 | mdk_rdev_t *rdev; | 3322 | mdk_rdev_t *rdev; |
3246 | dev = &sh->dev[i]; | 3323 | dev = &sh->dev[i]; |
3247 | clear_bit(R5_Insync, &dev->flags); | ||
3248 | 3324 | ||
3249 | pr_debug("check %d: state 0x%lx read %p write %p written %p\n", | 3325 | pr_debug("check %d: state 0x%lx read %p write %p written %p\n", |
3250 | i, dev->flags, dev->toread, dev->towrite, dev->written); | 3326 | i, dev->flags, dev->toread, dev->towrite, dev->written); |
@@ -3282,18 +3358,28 @@ static void handle_stripe6(struct stripe_head *sh) | |||
3282 | blocked_rdev = rdev; | 3358 | blocked_rdev = rdev; |
3283 | atomic_inc(&rdev->nr_pending); | 3359 | atomic_inc(&rdev->nr_pending); |
3284 | } | 3360 | } |
3285 | if (!rdev || !test_bit(In_sync, &rdev->flags)) { | 3361 | clear_bit(R5_Insync, &dev->flags); |
3362 | if (!rdev) | ||
3363 | /* Not in-sync */; | ||
3364 | else if (test_bit(In_sync, &rdev->flags)) | ||
3365 | set_bit(R5_Insync, &dev->flags); | ||
3366 | else { | ||
3367 | /* in sync if before recovery_offset */ | ||
3368 | if (sh->sector + STRIPE_SECTORS <= rdev->recovery_offset) | ||
3369 | set_bit(R5_Insync, &dev->flags); | ||
3370 | } | ||
3371 | if (!test_bit(R5_Insync, &dev->flags)) { | ||
3286 | /* The ReadError flag will just be confusing now */ | 3372 | /* The ReadError flag will just be confusing now */ |
3287 | clear_bit(R5_ReadError, &dev->flags); | 3373 | clear_bit(R5_ReadError, &dev->flags); |
3288 | clear_bit(R5_ReWrite, &dev->flags); | 3374 | clear_bit(R5_ReWrite, &dev->flags); |
3289 | } | 3375 | } |
3290 | if (!rdev || !test_bit(In_sync, &rdev->flags) | 3376 | if (test_bit(R5_ReadError, &dev->flags)) |
3291 | || test_bit(R5_ReadError, &dev->flags)) { | 3377 | clear_bit(R5_Insync, &dev->flags); |
3378 | if (!test_bit(R5_Insync, &dev->flags)) { | ||
3292 | if (s.failed < 2) | 3379 | if (s.failed < 2) |
3293 | r6s.failed_num[s.failed] = i; | 3380 | r6s.failed_num[s.failed] = i; |
3294 | s.failed++; | 3381 | s.failed++; |
3295 | } else | 3382 | } |
3296 | set_bit(R5_Insync, &dev->flags); | ||
3297 | } | 3383 | } |
3298 | rcu_read_unlock(); | 3384 | rcu_read_unlock(); |
3299 | 3385 | ||
@@ -4971,8 +5057,10 @@ static int run(mddev_t *mddev) | |||
4971 | list_for_each_entry(rdev, &mddev->disks, same_set) { | 5057 | list_for_each_entry(rdev, &mddev->disks, same_set) { |
4972 | if (rdev->raid_disk < 0) | 5058 | if (rdev->raid_disk < 0) |
4973 | continue; | 5059 | continue; |
4974 | if (test_bit(In_sync, &rdev->flags)) | 5060 | if (test_bit(In_sync, &rdev->flags)) { |
4975 | working_disks++; | 5061 | working_disks++; |
5062 | continue; | ||
5063 | } | ||
4976 | /* This disc is not fully in-sync. However if it | 5064 | /* This disc is not fully in-sync. However if it |
4977 | * just stored parity (beyond the recovery_offset), | 5065 | * just stored parity (beyond the recovery_offset), |
4978 | * when we don't need to be concerned about the | 5066 | * when we don't need to be concerned about the |
@@ -5005,7 +5093,7 @@ static int run(mddev_t *mddev) | |||
5005 | mddev->degraded = (max(conf->raid_disks, conf->previous_raid_disks) | 5093 | mddev->degraded = (max(conf->raid_disks, conf->previous_raid_disks) |
5006 | - working_disks); | 5094 | - working_disks); |
5007 | 5095 | ||
5008 | if (mddev->degraded > conf->max_degraded) { | 5096 | if (has_failed(conf)) { |
5009 | printk(KERN_ERR "md/raid:%s: not enough operational devices" | 5097 | printk(KERN_ERR "md/raid:%s: not enough operational devices" |
5010 | " (%d/%d failed)\n", | 5098 | " (%d/%d failed)\n", |
5011 | mdname(mddev), mddev->degraded, conf->raid_disks); | 5099 | mdname(mddev), mddev->degraded, conf->raid_disks); |
@@ -5207,6 +5295,7 @@ static int raid5_spare_active(mddev_t *mddev) | |||
5207 | for (i = 0; i < conf->raid_disks; i++) { | 5295 | for (i = 0; i < conf->raid_disks; i++) { |
5208 | tmp = conf->disks + i; | 5296 | tmp = conf->disks + i; |
5209 | if (tmp->rdev | 5297 | if (tmp->rdev |
5298 | && tmp->rdev->recovery_offset == MaxSector | ||
5210 | && !test_bit(Faulty, &tmp->rdev->flags) | 5299 | && !test_bit(Faulty, &tmp->rdev->flags) |
5211 | && !test_and_set_bit(In_sync, &tmp->rdev->flags)) { | 5300 | && !test_and_set_bit(In_sync, &tmp->rdev->flags)) { |
5212 | unsigned long flags; | 5301 | unsigned long flags; |
@@ -5242,7 +5331,7 @@ static int raid5_remove_disk(mddev_t *mddev, int number) | |||
5242 | * isn't possible. | 5331 | * isn't possible. |
5243 | */ | 5332 | */ |
5244 | if (!test_bit(Faulty, &rdev->flags) && | 5333 | if (!test_bit(Faulty, &rdev->flags) && |
5245 | mddev->degraded <= conf->max_degraded && | 5334 | !has_failed(conf) && |
5246 | number < conf->raid_disks) { | 5335 | number < conf->raid_disks) { |
5247 | err = -EBUSY; | 5336 | err = -EBUSY; |
5248 | goto abort; | 5337 | goto abort; |
@@ -5270,7 +5359,7 @@ static int raid5_add_disk(mddev_t *mddev, mdk_rdev_t *rdev) | |||
5270 | int first = 0; | 5359 | int first = 0; |
5271 | int last = conf->raid_disks - 1; | 5360 | int last = conf->raid_disks - 1; |
5272 | 5361 | ||
5273 | if (mddev->degraded > conf->max_degraded) | 5362 | if (has_failed(conf)) |
5274 | /* no point adding a device */ | 5363 | /* no point adding a device */ |
5275 | return -EINVAL; | 5364 | return -EINVAL; |
5276 | 5365 | ||
@@ -5362,7 +5451,7 @@ static int check_reshape(mddev_t *mddev) | |||
5362 | if (mddev->bitmap) | 5451 | if (mddev->bitmap) |
5363 | /* Cannot grow a bitmap yet */ | 5452 | /* Cannot grow a bitmap yet */ |
5364 | return -EBUSY; | 5453 | return -EBUSY; |
5365 | if (mddev->degraded > conf->max_degraded) | 5454 | if (has_failed(conf)) |
5366 | return -EINVAL; | 5455 | return -EINVAL; |
5367 | if (mddev->delta_disks < 0) { | 5456 | if (mddev->delta_disks < 0) { |
5368 | /* We might be able to shrink, but the devices must | 5457 | /* We might be able to shrink, but the devices must |
@@ -5437,8 +5526,13 @@ static int raid5_start_reshape(mddev_t *mddev) | |||
5437 | 5526 | ||
5438 | /* Add some new drives, as many as will fit. | 5527 | /* Add some new drives, as many as will fit. |
5439 | * We know there are enough to make the newly sized array work. | 5528 | * We know there are enough to make the newly sized array work. |
5529 | * Don't add devices if we are reducing the number of | ||
5530 | * devices in the array. This is because it is not possible | ||
5531 | * to correctly record the "partially reconstructed" state of | ||
5532 | * such devices during the reshape and confusion could result. | ||
5440 | */ | 5533 | */ |
5441 | list_for_each_entry(rdev, &mddev->disks, same_set) | 5534 | if (mddev->delta_disks >= 0) |
5535 | list_for_each_entry(rdev, &mddev->disks, same_set) | ||
5442 | if (rdev->raid_disk < 0 && | 5536 | if (rdev->raid_disk < 0 && |
5443 | !test_bit(Faulty, &rdev->flags)) { | 5537 | !test_bit(Faulty, &rdev->flags)) { |
5444 | if (raid5_add_disk(mddev, rdev) == 0) { | 5538 | if (raid5_add_disk(mddev, rdev) == 0) { |
@@ -5460,7 +5554,7 @@ static int raid5_start_reshape(mddev_t *mddev) | |||
5460 | } | 5554 | } |
5461 | 5555 | ||
5462 | /* When a reshape changes the number of devices, ->degraded | 5556 | /* When a reshape changes the number of devices, ->degraded |
5463 | * is measured against the large of the pre and post number of | 5557 | * is measured against the larger of the pre and post number of |
5464 | * devices.*/ | 5558 | * devices.*/ |
5465 | if (mddev->delta_disks > 0) { | 5559 | if (mddev->delta_disks > 0) { |
5466 | spin_lock_irqsave(&conf->device_lock, flags); | 5560 | spin_lock_irqsave(&conf->device_lock, flags); |
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index 2decc597bda7..ce2fcdd4ab90 100644 --- a/drivers/net/Kconfig +++ b/drivers/net/Kconfig | |||
@@ -2754,6 +2754,7 @@ config MYRI10GE_DCA | |||
2754 | config NETXEN_NIC | 2754 | config NETXEN_NIC |
2755 | tristate "NetXen Multi port (1/10) Gigabit Ethernet NIC" | 2755 | tristate "NetXen Multi port (1/10) Gigabit Ethernet NIC" |
2756 | depends on PCI | 2756 | depends on PCI |
2757 | select FW_LOADER | ||
2757 | help | 2758 | help |
2758 | This enables the support for NetXen's Gigabit Ethernet card. | 2759 | This enables the support for NetXen's Gigabit Ethernet card. |
2759 | 2760 | ||
@@ -2819,6 +2820,7 @@ config BNX2X | |||
2819 | config QLCNIC | 2820 | config QLCNIC |
2820 | tristate "QLOGIC QLCNIC 1/10Gb Converged Ethernet NIC Support" | 2821 | tristate "QLOGIC QLCNIC 1/10Gb Converged Ethernet NIC Support" |
2821 | depends on PCI | 2822 | depends on PCI |
2823 | select FW_LOADER | ||
2822 | help | 2824 | help |
2823 | This driver supports QLogic QLE8240 and QLE8242 Converged Ethernet | 2825 | This driver supports QLogic QLE8240 and QLE8242 Converged Ethernet |
2824 | devices. | 2826 | devices. |
diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c index 949d7a9dcf92..117432222a09 100644 --- a/drivers/net/bnx2.c +++ b/drivers/net/bnx2.c | |||
@@ -3073,7 +3073,6 @@ bnx2_rx_int(struct bnx2 *bp, struct bnx2_napi *bnapi, int budget) | |||
3073 | u16 hw_cons, sw_cons, sw_ring_cons, sw_prod, sw_ring_prod; | 3073 | u16 hw_cons, sw_cons, sw_ring_cons, sw_prod, sw_ring_prod; |
3074 | struct l2_fhdr *rx_hdr; | 3074 | struct l2_fhdr *rx_hdr; |
3075 | int rx_pkt = 0, pg_ring_used = 0; | 3075 | int rx_pkt = 0, pg_ring_used = 0; |
3076 | struct pci_dev *pdev = bp->pdev; | ||
3077 | 3076 | ||
3078 | hw_cons = bnx2_get_hw_rx_cons(bnapi); | 3077 | hw_cons = bnx2_get_hw_rx_cons(bnapi); |
3079 | sw_cons = rxr->rx_cons; | 3078 | sw_cons = rxr->rx_cons; |
@@ -3099,12 +3098,10 @@ bnx2_rx_int(struct bnx2 *bp, struct bnx2_napi *bnapi, int budget) | |||
3099 | skb = rx_buf->skb; | 3098 | skb = rx_buf->skb; |
3100 | prefetchw(skb); | 3099 | prefetchw(skb); |
3101 | 3100 | ||
3102 | if (!get_dma_ops(&pdev->dev)->sync_single_for_cpu) { | 3101 | next_rx_buf = |
3103 | next_rx_buf = | 3102 | &rxr->rx_buf_ring[RX_RING_IDX(NEXT_RX_BD(sw_cons))]; |
3104 | &rxr->rx_buf_ring[ | 3103 | prefetch(next_rx_buf->desc); |
3105 | RX_RING_IDX(NEXT_RX_BD(sw_cons))]; | 3104 | |
3106 | prefetch(next_rx_buf->desc); | ||
3107 | } | ||
3108 | rx_buf->skb = NULL; | 3105 | rx_buf->skb = NULL; |
3109 | 3106 | ||
3110 | dma_addr = dma_unmap_addr(rx_buf, mapping); | 3107 | dma_addr = dma_unmap_addr(rx_buf, mapping); |
diff --git a/drivers/net/cnic.c b/drivers/net/cnic.c index fe925663d39a..80471269977a 100644 --- a/drivers/net/cnic.c +++ b/drivers/net/cnic.c | |||
@@ -3919,8 +3919,9 @@ static void cnic_init_bnx2x_tx_ring(struct cnic_dev *dev) | |||
3919 | HC_INDEX_DEF_C_ETH_ISCSI_CQ_CONS; | 3919 | HC_INDEX_DEF_C_ETH_ISCSI_CQ_CONS; |
3920 | context->cstorm_st_context.status_block_id = BNX2X_DEF_SB_ID; | 3920 | context->cstorm_st_context.status_block_id = BNX2X_DEF_SB_ID; |
3921 | 3921 | ||
3922 | context->xstorm_st_context.statistics_data = (cli | | 3922 | if (cli < MAX_X_STAT_COUNTER_ID) |
3923 | XSTORM_ETH_ST_CONTEXT_STATISTICS_ENABLE); | 3923 | context->xstorm_st_context.statistics_data = cli | |
3924 | XSTORM_ETH_ST_CONTEXT_STATISTICS_ENABLE; | ||
3924 | 3925 | ||
3925 | context->xstorm_ag_context.cdu_reserved = | 3926 | context->xstorm_ag_context.cdu_reserved = |
3926 | CDU_RSRVD_VALUE_TYPE_A(BNX2X_HW_CID(BNX2X_ISCSI_L2_CID, func), | 3927 | CDU_RSRVD_VALUE_TYPE_A(BNX2X_HW_CID(BNX2X_ISCSI_L2_CID, func), |
@@ -3928,10 +3929,12 @@ static void cnic_init_bnx2x_tx_ring(struct cnic_dev *dev) | |||
3928 | ETH_CONNECTION_TYPE); | 3929 | ETH_CONNECTION_TYPE); |
3929 | 3930 | ||
3930 | /* reset xstorm per client statistics */ | 3931 | /* reset xstorm per client statistics */ |
3931 | val = BAR_XSTRORM_INTMEM + | 3932 | if (cli < MAX_X_STAT_COUNTER_ID) { |
3932 | XSTORM_PER_COUNTER_ID_STATS_OFFSET(port, cli); | 3933 | val = BAR_XSTRORM_INTMEM + |
3933 | for (i = 0; i < sizeof(struct xstorm_per_client_stats) / 4; i++) | 3934 | XSTORM_PER_COUNTER_ID_STATS_OFFSET(port, cli); |
3934 | CNIC_WR(dev, val + i * 4, 0); | 3935 | for (i = 0; i < sizeof(struct xstorm_per_client_stats) / 4; i++) |
3936 | CNIC_WR(dev, val + i * 4, 0); | ||
3937 | } | ||
3935 | 3938 | ||
3936 | cp->tx_cons_ptr = | 3939 | cp->tx_cons_ptr = |
3937 | &cp->bnx2x_def_status_blk->c_def_status_block.index_values[ | 3940 | &cp->bnx2x_def_status_blk->c_def_status_block.index_values[ |
@@ -3978,9 +3981,11 @@ static void cnic_init_bnx2x_rx_ring(struct cnic_dev *dev) | |||
3978 | BNX2X_ISCSI_RX_SB_INDEX_NUM; | 3981 | BNX2X_ISCSI_RX_SB_INDEX_NUM; |
3979 | context->ustorm_st_context.common.clientId = cli; | 3982 | context->ustorm_st_context.common.clientId = cli; |
3980 | context->ustorm_st_context.common.status_block_id = BNX2X_DEF_SB_ID; | 3983 | context->ustorm_st_context.common.status_block_id = BNX2X_DEF_SB_ID; |
3981 | context->ustorm_st_context.common.flags = | 3984 | if (cli < MAX_U_STAT_COUNTER_ID) { |
3982 | USTORM_ETH_ST_CONTEXT_CONFIG_ENABLE_STATISTICS; | 3985 | context->ustorm_st_context.common.flags = |
3983 | context->ustorm_st_context.common.statistics_counter_id = cli; | 3986 | USTORM_ETH_ST_CONTEXT_CONFIG_ENABLE_STATISTICS; |
3987 | context->ustorm_st_context.common.statistics_counter_id = cli; | ||
3988 | } | ||
3984 | context->ustorm_st_context.common.mc_alignment_log_size = 0; | 3989 | context->ustorm_st_context.common.mc_alignment_log_size = 0; |
3985 | context->ustorm_st_context.common.bd_buff_size = | 3990 | context->ustorm_st_context.common.bd_buff_size = |
3986 | cp->l2_single_buf_size; | 3991 | cp->l2_single_buf_size; |
@@ -4011,10 +4016,13 @@ static void cnic_init_bnx2x_rx_ring(struct cnic_dev *dev) | |||
4011 | 4016 | ||
4012 | /* client tstorm info */ | 4017 | /* client tstorm info */ |
4013 | tstorm_client.mtu = cp->l2_single_buf_size - 14; | 4018 | tstorm_client.mtu = cp->l2_single_buf_size - 14; |
4014 | tstorm_client.config_flags = | 4019 | tstorm_client.config_flags = TSTORM_ETH_CLIENT_CONFIG_E1HOV_REM_ENABLE; |
4015 | (TSTORM_ETH_CLIENT_CONFIG_E1HOV_REM_ENABLE | | 4020 | |
4016 | TSTORM_ETH_CLIENT_CONFIG_STATSITICS_ENABLE); | 4021 | if (cli < MAX_T_STAT_COUNTER_ID) { |
4017 | tstorm_client.statistics_counter_id = cli; | 4022 | tstorm_client.config_flags |= |
4023 | TSTORM_ETH_CLIENT_CONFIG_STATSITICS_ENABLE; | ||
4024 | tstorm_client.statistics_counter_id = cli; | ||
4025 | } | ||
4018 | 4026 | ||
4019 | CNIC_WR(dev, BAR_TSTRORM_INTMEM + | 4027 | CNIC_WR(dev, BAR_TSTRORM_INTMEM + |
4020 | TSTORM_CLIENT_CONFIG_OFFSET(port, cli), | 4028 | TSTORM_CLIENT_CONFIG_OFFSET(port, cli), |
@@ -4024,16 +4032,21 @@ static void cnic_init_bnx2x_rx_ring(struct cnic_dev *dev) | |||
4024 | ((u32 *)&tstorm_client)[1]); | 4032 | ((u32 *)&tstorm_client)[1]); |
4025 | 4033 | ||
4026 | /* reset tstorm per client statistics */ | 4034 | /* reset tstorm per client statistics */ |
4027 | val = BAR_TSTRORM_INTMEM + | 4035 | if (cli < MAX_T_STAT_COUNTER_ID) { |
4028 | TSTORM_PER_COUNTER_ID_STATS_OFFSET(port, cli); | 4036 | |
4029 | for (i = 0; i < sizeof(struct tstorm_per_client_stats) / 4; i++) | 4037 | val = BAR_TSTRORM_INTMEM + |
4030 | CNIC_WR(dev, val + i * 4, 0); | 4038 | TSTORM_PER_COUNTER_ID_STATS_OFFSET(port, cli); |
4039 | for (i = 0; i < sizeof(struct tstorm_per_client_stats) / 4; i++) | ||
4040 | CNIC_WR(dev, val + i * 4, 0); | ||
4041 | } | ||
4031 | 4042 | ||
4032 | /* reset ustorm per client statistics */ | 4043 | /* reset ustorm per client statistics */ |
4033 | val = BAR_USTRORM_INTMEM + | 4044 | if (cli < MAX_U_STAT_COUNTER_ID) { |
4034 | USTORM_PER_COUNTER_ID_STATS_OFFSET(port, cli); | 4045 | val = BAR_USTRORM_INTMEM + |
4035 | for (i = 0; i < sizeof(struct ustorm_per_client_stats) / 4; i++) | 4046 | USTORM_PER_COUNTER_ID_STATS_OFFSET(port, cli); |
4036 | CNIC_WR(dev, val + i * 4, 0); | 4047 | for (i = 0; i < sizeof(struct ustorm_per_client_stats) / 4; i++) |
4048 | CNIC_WR(dev, val + i * 4, 0); | ||
4049 | } | ||
4037 | 4050 | ||
4038 | cp->rx_cons_ptr = | 4051 | cp->rx_cons_ptr = |
4039 | &cp->bnx2x_def_status_blk->u_def_status_block.index_values[ | 4052 | &cp->bnx2x_def_status_blk->u_def_status_block.index_values[ |
diff --git a/drivers/net/cpmac.c b/drivers/net/cpmac.c index 3c58db595285..23786ee34bed 100644 --- a/drivers/net/cpmac.c +++ b/drivers/net/cpmac.c | |||
@@ -1181,7 +1181,8 @@ static int __devinit cpmac_probe(struct platform_device *pdev) | |||
1181 | if (netif_msg_drv(priv)) | 1181 | if (netif_msg_drv(priv)) |
1182 | printk(KERN_ERR "%s: Could not attach to PHY\n", | 1182 | printk(KERN_ERR "%s: Could not attach to PHY\n", |
1183 | dev->name); | 1183 | dev->name); |
1184 | return PTR_ERR(priv->phy); | 1184 | rc = PTR_ERR(priv->phy); |
1185 | goto fail; | ||
1185 | } | 1186 | } |
1186 | 1187 | ||
1187 | if ((rc = register_netdev(dev))) { | 1188 | if ((rc = register_netdev(dev))) { |
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c index ebdea0891665..68a80893dce1 100644 --- a/drivers/net/e1000/e1000_main.c +++ b/drivers/net/e1000/e1000_main.c | |||
@@ -1047,15 +1047,14 @@ static int __devinit e1000_probe(struct pci_dev *pdev, | |||
1047 | goto err_register; | 1047 | goto err_register; |
1048 | 1048 | ||
1049 | /* print bus type/speed/width info */ | 1049 | /* print bus type/speed/width info */ |
1050 | e_info("(PCI%s:%s:%s) ", | 1050 | e_info("(PCI%s:%dMHz:%d-bit) %pM\n", |
1051 | ((hw->bus_type == e1000_bus_type_pcix) ? "-X" : ""), | 1051 | ((hw->bus_type == e1000_bus_type_pcix) ? "-X" : ""), |
1052 | ((hw->bus_speed == e1000_bus_speed_133) ? "133MHz" : | 1052 | ((hw->bus_speed == e1000_bus_speed_133) ? 133 : |
1053 | (hw->bus_speed == e1000_bus_speed_120) ? "120MHz" : | 1053 | (hw->bus_speed == e1000_bus_speed_120) ? 120 : |
1054 | (hw->bus_speed == e1000_bus_speed_100) ? "100MHz" : | 1054 | (hw->bus_speed == e1000_bus_speed_100) ? 100 : |
1055 | (hw->bus_speed == e1000_bus_speed_66) ? "66MHz" : "33MHz"), | 1055 | (hw->bus_speed == e1000_bus_speed_66) ? 66 : 33), |
1056 | ((hw->bus_width == e1000_bus_width_64) ? "64-bit" : "32-bit")); | 1056 | ((hw->bus_width == e1000_bus_width_64) ? 64 : 32), |
1057 | 1057 | netdev->dev_addr); | |
1058 | e_info("%pM\n", netdev->dev_addr); | ||
1059 | 1058 | ||
1060 | /* carrier off reporting is important to ethtool even BEFORE open */ | 1059 | /* carrier off reporting is important to ethtool even BEFORE open */ |
1061 | netif_carrier_off(netdev); | 1060 | netif_carrier_off(netdev); |
diff --git a/drivers/net/ehea/ehea.h b/drivers/net/ehea/ehea.h index 0630980a2722..0060e422f171 100644 --- a/drivers/net/ehea/ehea.h +++ b/drivers/net/ehea/ehea.h | |||
@@ -40,7 +40,7 @@ | |||
40 | #include <asm/io.h> | 40 | #include <asm/io.h> |
41 | 41 | ||
42 | #define DRV_NAME "ehea" | 42 | #define DRV_NAME "ehea" |
43 | #define DRV_VERSION "EHEA_0103" | 43 | #define DRV_VERSION "EHEA_0105" |
44 | 44 | ||
45 | /* eHEA capability flags */ | 45 | /* eHEA capability flags */ |
46 | #define DLPAR_PORT_ADD_REM 1 | 46 | #define DLPAR_PORT_ADD_REM 1 |
diff --git a/drivers/net/ehea/ehea_main.c b/drivers/net/ehea/ehea_main.c index f547894ff48f..8b92acb448c2 100644 --- a/drivers/net/ehea/ehea_main.c +++ b/drivers/net/ehea/ehea_main.c | |||
@@ -867,6 +867,7 @@ static int ehea_poll(struct napi_struct *napi, int budget) | |||
867 | ehea_reset_cq_ep(pr->send_cq); | 867 | ehea_reset_cq_ep(pr->send_cq); |
868 | ehea_reset_cq_n1(pr->recv_cq); | 868 | ehea_reset_cq_n1(pr->recv_cq); |
869 | ehea_reset_cq_n1(pr->send_cq); | 869 | ehea_reset_cq_n1(pr->send_cq); |
870 | rmb(); | ||
870 | cqe = ehea_poll_rq1(pr->qp, &wqe_index); | 871 | cqe = ehea_poll_rq1(pr->qp, &wqe_index); |
871 | cqe_skb = ehea_poll_cq(pr->send_cq); | 872 | cqe_skb = ehea_poll_cq(pr->send_cq); |
872 | 873 | ||
@@ -2859,6 +2860,7 @@ static void ehea_reset_port(struct work_struct *work) | |||
2859 | container_of(work, struct ehea_port, reset_task); | 2860 | container_of(work, struct ehea_port, reset_task); |
2860 | struct net_device *dev = port->netdev; | 2861 | struct net_device *dev = port->netdev; |
2861 | 2862 | ||
2863 | mutex_lock(&dlpar_mem_lock); | ||
2862 | port->resets++; | 2864 | port->resets++; |
2863 | mutex_lock(&port->port_lock); | 2865 | mutex_lock(&port->port_lock); |
2864 | netif_stop_queue(dev); | 2866 | netif_stop_queue(dev); |
@@ -2881,6 +2883,7 @@ static void ehea_reset_port(struct work_struct *work) | |||
2881 | netif_wake_queue(dev); | 2883 | netif_wake_queue(dev); |
2882 | out: | 2884 | out: |
2883 | mutex_unlock(&port->port_lock); | 2885 | mutex_unlock(&port->port_lock); |
2886 | mutex_unlock(&dlpar_mem_lock); | ||
2884 | } | 2887 | } |
2885 | 2888 | ||
2886 | static void ehea_rereg_mrs(struct work_struct *work) | 2889 | static void ehea_rereg_mrs(struct work_struct *work) |
@@ -3542,10 +3545,7 @@ static int ehea_mem_notifier(struct notifier_block *nb, | |||
3542 | int ret = NOTIFY_BAD; | 3545 | int ret = NOTIFY_BAD; |
3543 | struct memory_notify *arg = data; | 3546 | struct memory_notify *arg = data; |
3544 | 3547 | ||
3545 | if (!mutex_trylock(&dlpar_mem_lock)) { | 3548 | mutex_lock(&dlpar_mem_lock); |
3546 | ehea_info("ehea_mem_notifier must not be called parallelized"); | ||
3547 | goto out; | ||
3548 | } | ||
3549 | 3549 | ||
3550 | switch (action) { | 3550 | switch (action) { |
3551 | case MEM_CANCEL_OFFLINE: | 3551 | case MEM_CANCEL_OFFLINE: |
@@ -3574,7 +3574,6 @@ static int ehea_mem_notifier(struct notifier_block *nb, | |||
3574 | 3574 | ||
3575 | out_unlock: | 3575 | out_unlock: |
3576 | mutex_unlock(&dlpar_mem_lock); | 3576 | mutex_unlock(&dlpar_mem_lock); |
3577 | out: | ||
3578 | return ret; | 3577 | return ret; |
3579 | } | 3578 | } |
3580 | 3579 | ||
diff --git a/drivers/net/enic/vnic_dev.c b/drivers/net/enic/vnic_dev.c index 2b3e16db5c82..e0d33281ec98 100644 --- a/drivers/net/enic/vnic_dev.c +++ b/drivers/net/enic/vnic_dev.c | |||
@@ -709,7 +709,7 @@ int vnic_dev_init_prov(struct vnic_dev *vdev, u8 *buf, u32 len) | |||
709 | { | 709 | { |
710 | u64 a0, a1 = len; | 710 | u64 a0, a1 = len; |
711 | int wait = 1000; | 711 | int wait = 1000; |
712 | u64 prov_pa; | 712 | dma_addr_t prov_pa; |
713 | void *prov_buf; | 713 | void *prov_buf; |
714 | int ret; | 714 | int ret; |
715 | 715 | ||
diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c index 46c69cd06553..28b53d1cd4f1 100644 --- a/drivers/net/gianfar.c +++ b/drivers/net/gianfar.c | |||
@@ -381,10 +381,14 @@ static void gfar_init_mac(struct net_device *ndev) | |||
381 | /* Insert receive time stamps into padding alignment bytes */ | 381 | /* Insert receive time stamps into padding alignment bytes */ |
382 | if (priv->device_flags & FSL_GIANFAR_DEV_HAS_TIMER) { | 382 | if (priv->device_flags & FSL_GIANFAR_DEV_HAS_TIMER) { |
383 | rctrl &= ~RCTRL_PAL_MASK; | 383 | rctrl &= ~RCTRL_PAL_MASK; |
384 | rctrl |= RCTRL_PRSDEP_INIT | RCTRL_TS_ENABLE | RCTRL_PADDING(8); | 384 | rctrl |= RCTRL_PADDING(8); |
385 | priv->padding = 8; | 385 | priv->padding = 8; |
386 | } | 386 | } |
387 | 387 | ||
388 | /* Enable HW time stamping if requested from user space */ | ||
389 | if (priv->hwts_rx_en) | ||
390 | rctrl |= RCTRL_PRSDEP_INIT | RCTRL_TS_ENABLE; | ||
391 | |||
388 | /* keep vlan related bits if it's enabled */ | 392 | /* keep vlan related bits if it's enabled */ |
389 | if (priv->vlgrp) { | 393 | if (priv->vlgrp) { |
390 | rctrl |= RCTRL_VLEX | RCTRL_PRSDEP_INIT; | 394 | rctrl |= RCTRL_VLEX | RCTRL_PRSDEP_INIT; |
@@ -747,7 +751,8 @@ static int gfar_of_init(struct of_device *ofdev, struct net_device **pdev) | |||
747 | FSL_GIANFAR_DEV_HAS_CSUM | | 751 | FSL_GIANFAR_DEV_HAS_CSUM | |
748 | FSL_GIANFAR_DEV_HAS_VLAN | | 752 | FSL_GIANFAR_DEV_HAS_VLAN | |
749 | FSL_GIANFAR_DEV_HAS_MAGIC_PACKET | | 753 | FSL_GIANFAR_DEV_HAS_MAGIC_PACKET | |
750 | FSL_GIANFAR_DEV_HAS_EXTENDED_HASH; | 754 | FSL_GIANFAR_DEV_HAS_EXTENDED_HASH | |
755 | FSL_GIANFAR_DEV_HAS_TIMER; | ||
751 | 756 | ||
752 | ctype = of_get_property(np, "phy-connection-type", NULL); | 757 | ctype = of_get_property(np, "phy-connection-type", NULL); |
753 | 758 | ||
@@ -805,12 +810,20 @@ static int gfar_hwtstamp_ioctl(struct net_device *netdev, | |||
805 | 810 | ||
806 | switch (config.rx_filter) { | 811 | switch (config.rx_filter) { |
807 | case HWTSTAMP_FILTER_NONE: | 812 | case HWTSTAMP_FILTER_NONE: |
808 | priv->hwts_rx_en = 0; | 813 | if (priv->hwts_rx_en) { |
814 | stop_gfar(netdev); | ||
815 | priv->hwts_rx_en = 0; | ||
816 | startup_gfar(netdev); | ||
817 | } | ||
809 | break; | 818 | break; |
810 | default: | 819 | default: |
811 | if (!(priv->device_flags & FSL_GIANFAR_DEV_HAS_TIMER)) | 820 | if (!(priv->device_flags & FSL_GIANFAR_DEV_HAS_TIMER)) |
812 | return -ERANGE; | 821 | return -ERANGE; |
813 | priv->hwts_rx_en = 1; | 822 | if (!priv->hwts_rx_en) { |
823 | stop_gfar(netdev); | ||
824 | priv->hwts_rx_en = 1; | ||
825 | startup_gfar(netdev); | ||
826 | } | ||
814 | config.rx_filter = HWTSTAMP_FILTER_ALL; | 827 | config.rx_filter = HWTSTAMP_FILTER_ALL; |
815 | break; | 828 | break; |
816 | } | 829 | } |
@@ -2642,6 +2655,10 @@ int gfar_clean_rx_ring(struct gfar_priv_rx_q *rx_queue, int rx_work_limit) | |||
2642 | dma_unmap_single(&priv->ofdev->dev, bdp->bufPtr, | 2655 | dma_unmap_single(&priv->ofdev->dev, bdp->bufPtr, |
2643 | priv->rx_buffer_size, DMA_FROM_DEVICE); | 2656 | priv->rx_buffer_size, DMA_FROM_DEVICE); |
2644 | 2657 | ||
2658 | if (unlikely(!(bdp->status & RXBD_ERR) && | ||
2659 | bdp->length > priv->rx_buffer_size)) | ||
2660 | bdp->status = RXBD_LARGE; | ||
2661 | |||
2645 | /* We drop the frame if we failed to allocate a new buffer */ | 2662 | /* We drop the frame if we failed to allocate a new buffer */ |
2646 | if (unlikely(!newskb || !(bdp->status & RXBD_LAST) || | 2663 | if (unlikely(!newskb || !(bdp->status & RXBD_LAST) || |
2647 | bdp->status & RXBD_ERR)) { | 2664 | bdp->status & RXBD_ERR)) { |
diff --git a/drivers/net/ixgbe/ixgbe_ethtool.c b/drivers/net/ixgbe/ixgbe_ethtool.c index c50a7541ffec..3a93a81872b8 100644 --- a/drivers/net/ixgbe/ixgbe_ethtool.c +++ b/drivers/net/ixgbe/ixgbe_ethtool.c | |||
@@ -2077,25 +2077,6 @@ static int ixgbe_get_coalesce(struct net_device *netdev, | |||
2077 | return 0; | 2077 | return 0; |
2078 | } | 2078 | } |
2079 | 2079 | ||
2080 | /* | ||
2081 | * this function must be called before setting the new value of | ||
2082 | * rx_itr_setting | ||
2083 | */ | ||
2084 | static bool ixgbe_reenable_rsc(struct ixgbe_adapter *adapter, | ||
2085 | struct ethtool_coalesce *ec) | ||
2086 | { | ||
2087 | /* check the old value and enable RSC if necessary */ | ||
2088 | if ((adapter->rx_itr_setting == 0) && | ||
2089 | (adapter->flags2 & IXGBE_FLAG2_RSC_CAPABLE)) { | ||
2090 | adapter->flags2 |= IXGBE_FLAG2_RSC_ENABLED; | ||
2091 | adapter->netdev->features |= NETIF_F_LRO; | ||
2092 | DPRINTK(PROBE, INFO, "rx-usecs set to %d, re-enabling RSC\n", | ||
2093 | ec->rx_coalesce_usecs); | ||
2094 | return true; | ||
2095 | } | ||
2096 | return false; | ||
2097 | } | ||
2098 | |||
2099 | static int ixgbe_set_coalesce(struct net_device *netdev, | 2080 | static int ixgbe_set_coalesce(struct net_device *netdev, |
2100 | struct ethtool_coalesce *ec) | 2081 | struct ethtool_coalesce *ec) |
2101 | { | 2082 | { |
@@ -2124,9 +2105,6 @@ static int ixgbe_set_coalesce(struct net_device *netdev, | |||
2124 | (1000000/ec->rx_coalesce_usecs < IXGBE_MIN_INT_RATE)) | 2105 | (1000000/ec->rx_coalesce_usecs < IXGBE_MIN_INT_RATE)) |
2125 | return -EINVAL; | 2106 | return -EINVAL; |
2126 | 2107 | ||
2127 | /* check the old value and enable RSC if necessary */ | ||
2128 | need_reset = ixgbe_reenable_rsc(adapter, ec); | ||
2129 | |||
2130 | /* store the value in ints/second */ | 2108 | /* store the value in ints/second */ |
2131 | adapter->rx_eitr_param = 1000000/ec->rx_coalesce_usecs; | 2109 | adapter->rx_eitr_param = 1000000/ec->rx_coalesce_usecs; |
2132 | 2110 | ||
@@ -2135,9 +2113,6 @@ static int ixgbe_set_coalesce(struct net_device *netdev, | |||
2135 | /* clear the lower bit as its used for dynamic state */ | 2113 | /* clear the lower bit as its used for dynamic state */ |
2136 | adapter->rx_itr_setting &= ~1; | 2114 | adapter->rx_itr_setting &= ~1; |
2137 | } else if (ec->rx_coalesce_usecs == 1) { | 2115 | } else if (ec->rx_coalesce_usecs == 1) { |
2138 | /* check the old value and enable RSC if necessary */ | ||
2139 | need_reset = ixgbe_reenable_rsc(adapter, ec); | ||
2140 | |||
2141 | /* 1 means dynamic mode */ | 2116 | /* 1 means dynamic mode */ |
2142 | adapter->rx_eitr_param = 20000; | 2117 | adapter->rx_eitr_param = 20000; |
2143 | adapter->rx_itr_setting = 1; | 2118 | adapter->rx_itr_setting = 1; |
@@ -2157,10 +2132,11 @@ static int ixgbe_set_coalesce(struct net_device *netdev, | |||
2157 | */ | 2132 | */ |
2158 | if (adapter->flags2 & IXGBE_FLAG2_RSC_ENABLED) { | 2133 | if (adapter->flags2 & IXGBE_FLAG2_RSC_ENABLED) { |
2159 | adapter->flags2 &= ~IXGBE_FLAG2_RSC_ENABLED; | 2134 | adapter->flags2 &= ~IXGBE_FLAG2_RSC_ENABLED; |
2160 | netdev->features &= ~NETIF_F_LRO; | 2135 | if (netdev->features & NETIF_F_LRO) { |
2161 | DPRINTK(PROBE, INFO, | 2136 | netdev->features &= ~NETIF_F_LRO; |
2162 | "rx-usecs set to 0, disabling RSC\n"); | 2137 | DPRINTK(PROBE, INFO, "rx-usecs set to 0, " |
2163 | 2138 | "disabling LRO/RSC\n"); | |
2139 | } | ||
2164 | need_reset = true; | 2140 | need_reset = true; |
2165 | } | 2141 | } |
2166 | } | 2142 | } |
@@ -2255,6 +2231,9 @@ static int ixgbe_set_flags(struct net_device *netdev, u32 data) | |||
2255 | } | 2231 | } |
2256 | } else if (!adapter->rx_itr_setting) { | 2232 | } else if (!adapter->rx_itr_setting) { |
2257 | netdev->features &= ~ETH_FLAG_LRO; | 2233 | netdev->features &= ~ETH_FLAG_LRO; |
2234 | if (data & ETH_FLAG_LRO) | ||
2235 | DPRINTK(PROBE, INFO, "rx-usecs set to 0, " | ||
2236 | "LRO/RSC cannot be enabled.\n"); | ||
2258 | } | 2237 | } |
2259 | } | 2238 | } |
2260 | 2239 | ||
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c index b2af2f67f604..ce30c62a97f7 100644 --- a/drivers/net/ixgbe/ixgbe_main.c +++ b/drivers/net/ixgbe/ixgbe_main.c | |||
@@ -5282,6 +5282,10 @@ void ixgbe_update_stats(struct ixgbe_adapter *adapter) | |||
5282 | u32 i, missed_rx = 0, mpc, bprc, lxon, lxoff, xon_off_tot; | 5282 | u32 i, missed_rx = 0, mpc, bprc, lxon, lxoff, xon_off_tot; |
5283 | u64 non_eop_descs = 0, restart_queue = 0; | 5283 | u64 non_eop_descs = 0, restart_queue = 0; |
5284 | 5284 | ||
5285 | if (test_bit(__IXGBE_DOWN, &adapter->state) || | ||
5286 | test_bit(__IXGBE_RESETTING, &adapter->state)) | ||
5287 | return; | ||
5288 | |||
5285 | if (adapter->flags2 & IXGBE_FLAG2_RSC_ENABLED) { | 5289 | if (adapter->flags2 & IXGBE_FLAG2_RSC_ENABLED) { |
5286 | u64 rsc_count = 0; | 5290 | u64 rsc_count = 0; |
5287 | u64 rsc_flush = 0; | 5291 | u64 rsc_flush = 0; |
diff --git a/drivers/net/ixgbe/ixgbe_phy.c b/drivers/net/ixgbe/ixgbe_phy.c index 09e1911ff510..48325a5beff2 100644 --- a/drivers/net/ixgbe/ixgbe_phy.c +++ b/drivers/net/ixgbe/ixgbe_phy.c | |||
@@ -575,6 +575,8 @@ s32 ixgbe_identify_sfp_module_generic(struct ixgbe_hw *hw) | |||
575 | * 4 SFP_DA_CORE1 - 82599-specific | 575 | * 4 SFP_DA_CORE1 - 82599-specific |
576 | * 5 SFP_SR/LR_CORE0 - 82599-specific | 576 | * 5 SFP_SR/LR_CORE0 - 82599-specific |
577 | * 6 SFP_SR/LR_CORE1 - 82599-specific | 577 | * 6 SFP_SR/LR_CORE1 - 82599-specific |
578 | * 7 SFP_act_lmt_DA_CORE0 - 82599-specific | ||
579 | * 8 SFP_act_lmt_DA_CORE1 - 82599-specific | ||
578 | */ | 580 | */ |
579 | if (hw->mac.type == ixgbe_mac_82598EB) { | 581 | if (hw->mac.type == ixgbe_mac_82598EB) { |
580 | if (cable_tech & IXGBE_SFF_DA_PASSIVE_CABLE) | 582 | if (cable_tech & IXGBE_SFF_DA_PASSIVE_CABLE) |
diff --git a/drivers/net/lib82596.c b/drivers/net/lib82596.c index ce5d6e909218..c27f4291b350 100644 --- a/drivers/net/lib82596.c +++ b/drivers/net/lib82596.c | |||
@@ -1343,7 +1343,7 @@ static void set_multicast_list(struct net_device *dev) | |||
1343 | DEB(DEB_MULTI, | 1343 | DEB(DEB_MULTI, |
1344 | printk(KERN_DEBUG | 1344 | printk(KERN_DEBUG |
1345 | "%s: set multicast list, %d entries, promisc %s, allmulti %s\n", | 1345 | "%s: set multicast list, %d entries, promisc %s, allmulti %s\n", |
1346 | dev->name, dev->mc_count, | 1346 | dev->name, netdev_mc_count(dev), |
1347 | dev->flags & IFF_PROMISC ? "ON" : "OFF", | 1347 | dev->flags & IFF_PROMISC ? "ON" : "OFF", |
1348 | dev->flags & IFF_ALLMULTI ? "ON" : "OFF")); | 1348 | dev->flags & IFF_ALLMULTI ? "ON" : "OFF")); |
1349 | 1349 | ||
diff --git a/drivers/net/mipsnet.c b/drivers/net/mipsnet.c index 8e9704f5c122..869f0ea43a5b 100644 --- a/drivers/net/mipsnet.c +++ b/drivers/net/mipsnet.c | |||
@@ -247,7 +247,7 @@ static const struct net_device_ops mipsnet_netdev_ops = { | |||
247 | .ndo_set_mac_address = eth_mac_addr, | 247 | .ndo_set_mac_address = eth_mac_addr, |
248 | }; | 248 | }; |
249 | 249 | ||
250 | static int __init mipsnet_probe(struct platform_device *dev) | 250 | static int __devinit mipsnet_probe(struct platform_device *dev) |
251 | { | 251 | { |
252 | struct net_device *netdev; | 252 | struct net_device *netdev; |
253 | int err; | 253 | int err; |
diff --git a/drivers/net/netxen/netxen_nic_ctx.c b/drivers/net/netxen/netxen_nic_ctx.c index f26e54716c88..3a41b6a84a68 100644 --- a/drivers/net/netxen/netxen_nic_ctx.c +++ b/drivers/net/netxen/netxen_nic_ctx.c | |||
@@ -629,7 +629,8 @@ int netxen_alloc_hw_resources(struct netxen_adapter *adapter) | |||
629 | if (addr == NULL) { | 629 | if (addr == NULL) { |
630 | dev_err(&pdev->dev, "%s: failed to allocate tx desc ring\n", | 630 | dev_err(&pdev->dev, "%s: failed to allocate tx desc ring\n", |
631 | netdev->name); | 631 | netdev->name); |
632 | return -ENOMEM; | 632 | err = -ENOMEM; |
633 | goto err_out_free; | ||
633 | } | 634 | } |
634 | 635 | ||
635 | tx_ring->desc_head = (struct cmd_desc_type0 *)addr; | 636 | tx_ring->desc_head = (struct cmd_desc_type0 *)addr; |
diff --git a/drivers/net/netxen/netxen_nic_hw.c b/drivers/net/netxen/netxen_nic_hw.c index 5c496f8d7c49..29d7b93d0493 100644 --- a/drivers/net/netxen/netxen_nic_hw.c +++ b/drivers/net/netxen/netxen_nic_hw.c | |||
@@ -1159,9 +1159,6 @@ netxen_nic_pci_set_crbwindow_2M(struct netxen_adapter *adapter, ulong off) | |||
1159 | 1159 | ||
1160 | window = CRB_HI(off); | 1160 | window = CRB_HI(off); |
1161 | 1161 | ||
1162 | if (adapter->ahw.crb_win == window) | ||
1163 | return; | ||
1164 | |||
1165 | writel(window, addr); | 1162 | writel(window, addr); |
1166 | if (readl(addr) != window) { | 1163 | if (readl(addr) != window) { |
1167 | if (printk_ratelimit()) | 1164 | if (printk_ratelimit()) |
@@ -1169,7 +1166,6 @@ netxen_nic_pci_set_crbwindow_2M(struct netxen_adapter *adapter, ulong off) | |||
1169 | "failed to set CRB window to %d off 0x%lx\n", | 1166 | "failed to set CRB window to %d off 0x%lx\n", |
1170 | window, off); | 1167 | window, off); |
1171 | } | 1168 | } |
1172 | adapter->ahw.crb_win = window; | ||
1173 | } | 1169 | } |
1174 | 1170 | ||
1175 | static void __iomem * | 1171 | static void __iomem * |
diff --git a/drivers/net/netxen/netxen_nic_init.c b/drivers/net/netxen/netxen_nic_init.c index 045a7c8f5bdf..c865dda2adf1 100644 --- a/drivers/net/netxen/netxen_nic_init.c +++ b/drivers/net/netxen/netxen_nic_init.c | |||
@@ -218,7 +218,7 @@ int netxen_alloc_sw_resources(struct netxen_adapter *adapter) | |||
218 | if (cmd_buf_arr == NULL) { | 218 | if (cmd_buf_arr == NULL) { |
219 | dev_err(&pdev->dev, "%s: failed to allocate cmd buffer ring\n", | 219 | dev_err(&pdev->dev, "%s: failed to allocate cmd buffer ring\n", |
220 | netdev->name); | 220 | netdev->name); |
221 | return -ENOMEM; | 221 | goto err_out; |
222 | } | 222 | } |
223 | memset(cmd_buf_arr, 0, TX_BUFF_RINGSIZE(tx_ring)); | 223 | memset(cmd_buf_arr, 0, TX_BUFF_RINGSIZE(tx_ring)); |
224 | tx_ring->cmd_buf_arr = cmd_buf_arr; | 224 | tx_ring->cmd_buf_arr = cmd_buf_arr; |
@@ -230,7 +230,7 @@ int netxen_alloc_sw_resources(struct netxen_adapter *adapter) | |||
230 | if (rds_ring == NULL) { | 230 | if (rds_ring == NULL) { |
231 | dev_err(&pdev->dev, "%s: failed to allocate rds ring struct\n", | 231 | dev_err(&pdev->dev, "%s: failed to allocate rds ring struct\n", |
232 | netdev->name); | 232 | netdev->name); |
233 | return -ENOMEM; | 233 | goto err_out; |
234 | } | 234 | } |
235 | recv_ctx->rds_rings = rds_ring; | 235 | recv_ctx->rds_rings = rds_ring; |
236 | 236 | ||
@@ -1805,9 +1805,10 @@ netxen_post_rx_buffers(struct netxen_adapter *adapter, u32 ringid, | |||
1805 | netxen_ctx_msg msg = 0; | 1805 | netxen_ctx_msg msg = 0; |
1806 | struct list_head *head; | 1806 | struct list_head *head; |
1807 | 1807 | ||
1808 | spin_lock(&rds_ring->lock); | ||
1809 | |||
1808 | producer = rds_ring->producer; | 1810 | producer = rds_ring->producer; |
1809 | 1811 | ||
1810 | spin_lock(&rds_ring->lock); | ||
1811 | head = &rds_ring->free_list; | 1812 | head = &rds_ring->free_list; |
1812 | while (!list_empty(head)) { | 1813 | while (!list_empty(head)) { |
1813 | 1814 | ||
@@ -1829,7 +1830,6 @@ netxen_post_rx_buffers(struct netxen_adapter *adapter, u32 ringid, | |||
1829 | 1830 | ||
1830 | producer = get_next_index(producer, rds_ring->num_desc); | 1831 | producer = get_next_index(producer, rds_ring->num_desc); |
1831 | } | 1832 | } |
1832 | spin_unlock(&rds_ring->lock); | ||
1833 | 1833 | ||
1834 | if (count) { | 1834 | if (count) { |
1835 | rds_ring->producer = producer; | 1835 | rds_ring->producer = producer; |
@@ -1853,6 +1853,8 @@ netxen_post_rx_buffers(struct netxen_adapter *adapter, u32 ringid, | |||
1853 | NETXEN_RCV_PRODUCER_OFFSET), msg); | 1853 | NETXEN_RCV_PRODUCER_OFFSET), msg); |
1854 | } | 1854 | } |
1855 | } | 1855 | } |
1856 | |||
1857 | spin_unlock(&rds_ring->lock); | ||
1856 | } | 1858 | } |
1857 | 1859 | ||
1858 | static void | 1860 | static void |
@@ -1864,10 +1866,11 @@ netxen_post_rx_buffers_nodb(struct netxen_adapter *adapter, | |||
1864 | int producer, count = 0; | 1866 | int producer, count = 0; |
1865 | struct list_head *head; | 1867 | struct list_head *head; |
1866 | 1868 | ||
1867 | producer = rds_ring->producer; | ||
1868 | if (!spin_trylock(&rds_ring->lock)) | 1869 | if (!spin_trylock(&rds_ring->lock)) |
1869 | return; | 1870 | return; |
1870 | 1871 | ||
1872 | producer = rds_ring->producer; | ||
1873 | |||
1871 | head = &rds_ring->free_list; | 1874 | head = &rds_ring->free_list; |
1872 | while (!list_empty(head)) { | 1875 | while (!list_empty(head)) { |
1873 | 1876 | ||
diff --git a/drivers/net/pcmcia/pcnet_cs.c b/drivers/net/pcmcia/pcnet_cs.c index 6f77a768ba88..bfdef72c5d5e 100644 --- a/drivers/net/pcmcia/pcnet_cs.c +++ b/drivers/net/pcmcia/pcnet_cs.c | |||
@@ -1727,6 +1727,7 @@ static struct pcmcia_device_id pcnet_ids[] = { | |||
1727 | PCMCIA_PFC_DEVICE_CIS_PROD_ID12(0, "Psion Dacom", "Gold Card V34 Ethernet", 0xf5f025c2, 0x338e8155, "cis/PCMLM28.cis"), | 1727 | PCMCIA_PFC_DEVICE_CIS_PROD_ID12(0, "Psion Dacom", "Gold Card V34 Ethernet", 0xf5f025c2, 0x338e8155, "cis/PCMLM28.cis"), |
1728 | PCMCIA_PFC_DEVICE_CIS_PROD_ID12(0, "Psion Dacom", "Gold Card V34 Ethernet GSM", 0xf5f025c2, 0x4ae85d35, "cis/PCMLM28.cis"), | 1728 | PCMCIA_PFC_DEVICE_CIS_PROD_ID12(0, "Psion Dacom", "Gold Card V34 Ethernet GSM", 0xf5f025c2, 0x4ae85d35, "cis/PCMLM28.cis"), |
1729 | PCMCIA_PFC_DEVICE_CIS_PROD_ID12(0, "LINKSYS", "PCMLM28", 0xf7cb0b07, 0x66881874, "cis/PCMLM28.cis"), | 1729 | PCMCIA_PFC_DEVICE_CIS_PROD_ID12(0, "LINKSYS", "PCMLM28", 0xf7cb0b07, 0x66881874, "cis/PCMLM28.cis"), |
1730 | PCMCIA_PFC_DEVICE_CIS_PROD_ID12(0, "TOSHIBA", "Modem/LAN Card", 0xb4585a1a, 0x53f922f8, "cis/PCMLM28.cis"), | ||
1730 | PCMCIA_MFC_DEVICE_CIS_PROD_ID12(0, "DAYNA COMMUNICATIONS", "LAN AND MODEM MULTIFUNCTION", 0x8fdf8f89, 0xdd5ed9e8, "cis/DP83903.cis"), | 1731 | PCMCIA_MFC_DEVICE_CIS_PROD_ID12(0, "DAYNA COMMUNICATIONS", "LAN AND MODEM MULTIFUNCTION", 0x8fdf8f89, 0xdd5ed9e8, "cis/DP83903.cis"), |
1731 | PCMCIA_MFC_DEVICE_CIS_PROD_ID4(0, "NSC MF LAN/Modem", 0x58fc6056, "cis/DP83903.cis"), | 1732 | PCMCIA_MFC_DEVICE_CIS_PROD_ID4(0, "NSC MF LAN/Modem", 0x58fc6056, "cis/DP83903.cis"), |
1732 | PCMCIA_MFC_DEVICE_CIS_MANF_CARD(0, 0x0175, 0x0000, "cis/DP83903.cis"), | 1733 | PCMCIA_MFC_DEVICE_CIS_MANF_CARD(0, 0x0175, 0x0000, "cis/DP83903.cis"), |
diff --git a/drivers/net/pcmcia/smc91c92_cs.c b/drivers/net/pcmcia/smc91c92_cs.c index 64e6a84bbbbe..307cd1721e91 100644 --- a/drivers/net/pcmcia/smc91c92_cs.c +++ b/drivers/net/pcmcia/smc91c92_cs.c | |||
@@ -1505,12 +1505,20 @@ irq_done: | |||
1505 | writeb(cor & ~COR_IREQ_ENA, smc->base + MOT_LAN + CISREG_COR); | 1505 | writeb(cor & ~COR_IREQ_ENA, smc->base + MOT_LAN + CISREG_COR); |
1506 | writeb(cor, smc->base + MOT_LAN + CISREG_COR); | 1506 | writeb(cor, smc->base + MOT_LAN + CISREG_COR); |
1507 | } | 1507 | } |
1508 | #ifdef DOES_NOT_WORK | 1508 | |
1509 | if (smc->base != NULL) { /* Megahertz MFC's */ | 1509 | if ((smc->base != NULL) && /* Megahertz MFC's */ |
1510 | readb(smc->base+MEGAHERTZ_ISR); | 1510 | (smc->manfid == MANFID_MEGAHERTZ) && |
1511 | readb(smc->base+MEGAHERTZ_ISR); | 1511 | (smc->cardid == PRODID_MEGAHERTZ_EM3288)) { |
1512 | |||
1513 | u_char tmp; | ||
1514 | tmp = readb(smc->base+MEGAHERTZ_ISR); | ||
1515 | tmp = readb(smc->base+MEGAHERTZ_ISR); | ||
1516 | |||
1517 | /* Retrigger interrupt if needed */ | ||
1518 | writeb(tmp, smc->base + MEGAHERTZ_ISR); | ||
1519 | writeb(tmp, smc->base + MEGAHERTZ_ISR); | ||
1512 | } | 1520 | } |
1513 | #endif | 1521 | |
1514 | spin_unlock(&smc->lock); | 1522 | spin_unlock(&smc->lock); |
1515 | return IRQ_RETVAL(handled); | 1523 | return IRQ_RETVAL(handled); |
1516 | } | 1524 | } |
diff --git a/drivers/net/phy/lxt.c b/drivers/net/phy/lxt.c index dbd003453737..29c39ff85de5 100644 --- a/drivers/net/phy/lxt.c +++ b/drivers/net/phy/lxt.c | |||
@@ -226,6 +226,7 @@ module_exit(lxt_exit); | |||
226 | static struct mdio_device_id lxt_tbl[] = { | 226 | static struct mdio_device_id lxt_tbl[] = { |
227 | { 0x78100000, 0xfffffff0 }, | 227 | { 0x78100000, 0xfffffff0 }, |
228 | { 0x001378e0, 0xfffffff0 }, | 228 | { 0x001378e0, 0xfffffff0 }, |
229 | { 0x00137a10, 0xfffffff0 }, | ||
229 | { } | 230 | { } |
230 | }; | 231 | }; |
231 | 232 | ||
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c index 2111c7bbf578..7985165e84fc 100644 --- a/drivers/net/sky2.c +++ b/drivers/net/sky2.c | |||
@@ -717,11 +717,24 @@ static void sky2_phy_power_down(struct sky2_hw *hw, unsigned port) | |||
717 | sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_OFF); | 717 | sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_OFF); |
718 | } | 718 | } |
719 | 719 | ||
720 | /* Enable Rx/Tx */ | ||
721 | static void sky2_enable_rx_tx(struct sky2_port *sky2) | ||
722 | { | ||
723 | struct sky2_hw *hw = sky2->hw; | ||
724 | unsigned port = sky2->port; | ||
725 | u16 reg; | ||
726 | |||
727 | reg = gma_read16(hw, port, GM_GP_CTRL); | ||
728 | reg |= GM_GPCR_RX_ENA | GM_GPCR_TX_ENA; | ||
729 | gma_write16(hw, port, GM_GP_CTRL, reg); | ||
730 | } | ||
731 | |||
720 | /* Force a renegotiation */ | 732 | /* Force a renegotiation */ |
721 | static void sky2_phy_reinit(struct sky2_port *sky2) | 733 | static void sky2_phy_reinit(struct sky2_port *sky2) |
722 | { | 734 | { |
723 | spin_lock_bh(&sky2->phy_lock); | 735 | spin_lock_bh(&sky2->phy_lock); |
724 | sky2_phy_init(sky2->hw, sky2->port); | 736 | sky2_phy_init(sky2->hw, sky2->port); |
737 | sky2_enable_rx_tx(sky2); | ||
725 | spin_unlock_bh(&sky2->phy_lock); | 738 | spin_unlock_bh(&sky2->phy_lock); |
726 | } | 739 | } |
727 | 740 | ||
@@ -2040,7 +2053,6 @@ static void sky2_link_up(struct sky2_port *sky2) | |||
2040 | { | 2053 | { |
2041 | struct sky2_hw *hw = sky2->hw; | 2054 | struct sky2_hw *hw = sky2->hw; |
2042 | unsigned port = sky2->port; | 2055 | unsigned port = sky2->port; |
2043 | u16 reg; | ||
2044 | static const char *fc_name[] = { | 2056 | static const char *fc_name[] = { |
2045 | [FC_NONE] = "none", | 2057 | [FC_NONE] = "none", |
2046 | [FC_TX] = "tx", | 2058 | [FC_TX] = "tx", |
@@ -2048,10 +2060,7 @@ static void sky2_link_up(struct sky2_port *sky2) | |||
2048 | [FC_BOTH] = "both", | 2060 | [FC_BOTH] = "both", |
2049 | }; | 2061 | }; |
2050 | 2062 | ||
2051 | /* enable Rx/Tx */ | 2063 | sky2_enable_rx_tx(sky2); |
2052 | reg = gma_read16(hw, port, GM_GP_CTRL); | ||
2053 | reg |= GM_GPCR_RX_ENA | GM_GPCR_TX_ENA; | ||
2054 | gma_write16(hw, port, GM_GP_CTRL, reg); | ||
2055 | 2064 | ||
2056 | gm_phy_write(hw, port, PHY_MARV_INT_MASK, PHY_M_DEF_MSK); | 2065 | gm_phy_write(hw, port, PHY_MARV_INT_MASK, PHY_M_DEF_MSK); |
2057 | 2066 | ||
diff --git a/drivers/net/tulip/de2104x.c b/drivers/net/tulip/de2104x.c index c0e70006374e..06b552fca63d 100644 --- a/drivers/net/tulip/de2104x.c +++ b/drivers/net/tulip/de2104x.c | |||
@@ -367,8 +367,8 @@ static u16 t21041_csr14[] = { 0xFFFF, 0xF7FD, 0xF7FD, 0x6F3F, 0x6F3D, }; | |||
367 | static u16 t21041_csr15[] = { 0x0008, 0x0006, 0x000E, 0x0008, 0x0008, }; | 367 | static u16 t21041_csr15[] = { 0x0008, 0x0006, 0x000E, 0x0008, 0x0008, }; |
368 | 368 | ||
369 | 369 | ||
370 | #define dr32(reg) readl(de->regs + (reg)) | 370 | #define dr32(reg) ioread32(de->regs + (reg)) |
371 | #define dw32(reg,val) writel((val), de->regs + (reg)) | 371 | #define dw32(reg, val) iowrite32((val), de->regs + (reg)) |
372 | 372 | ||
373 | 373 | ||
374 | static void de_rx_err_acct (struct de_private *de, unsigned rx_tail, | 374 | static void de_rx_err_acct (struct de_private *de, unsigned rx_tail, |
@@ -1706,6 +1706,7 @@ static void __devinit de21040_get_mac_address (struct de_private *de) | |||
1706 | int value, boguscnt = 100000; | 1706 | int value, boguscnt = 100000; |
1707 | do { | 1707 | do { |
1708 | value = dr32(ROMCmd); | 1708 | value = dr32(ROMCmd); |
1709 | rmb(); | ||
1709 | } while (value < 0 && --boguscnt > 0); | 1710 | } while (value < 0 && --boguscnt > 0); |
1710 | de->dev->dev_addr[i] = value; | 1711 | de->dev->dev_addr[i] = value; |
1711 | udelay(1); | 1712 | udelay(1); |
diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c index 4a34833b85dd..807470e156af 100644 --- a/drivers/net/ucc_geth.c +++ b/drivers/net/ucc_geth.c | |||
@@ -3215,6 +3215,8 @@ static int ucc_geth_rx(struct ucc_geth_private *ugeth, u8 rxQ, int rx_work_limit | |||
3215 | __func__, __LINE__, (u32) skb); | 3215 | __func__, __LINE__, (u32) skb); |
3216 | if (skb) { | 3216 | if (skb) { |
3217 | skb->data = skb->head + NET_SKB_PAD; | 3217 | skb->data = skb->head + NET_SKB_PAD; |
3218 | skb->len = 0; | ||
3219 | skb_reset_tail_pointer(skb); | ||
3218 | __skb_queue_head(&ugeth->rx_recycle, skb); | 3220 | __skb_queue_head(&ugeth->rx_recycle, skb); |
3219 | } | 3221 | } |
3220 | 3222 | ||
diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c index 0a3c41faea9c..4dd23513c5af 100644 --- a/drivers/net/usb/hso.c +++ b/drivers/net/usb/hso.c | |||
@@ -1334,7 +1334,6 @@ static int hso_serial_open(struct tty_struct *tty, struct file *filp) | |||
1334 | /* check for port already opened, if not set the termios */ | 1334 | /* check for port already opened, if not set the termios */ |
1335 | serial->open_count++; | 1335 | serial->open_count++; |
1336 | if (serial->open_count == 1) { | 1336 | if (serial->open_count == 1) { |
1337 | tty->low_latency = 1; | ||
1338 | serial->rx_state = RX_IDLE; | 1337 | serial->rx_state = RX_IDLE; |
1339 | /* Force default termio settings */ | 1338 | /* Force default termio settings */ |
1340 | _hso_serial_set_termios(tty, NULL); | 1339 | _hso_serial_set_termios(tty, NULL); |
diff --git a/drivers/net/vxge/vxge-main.c b/drivers/net/vxge/vxge-main.c index b504bd561362..d14e207de1df 100644 --- a/drivers/net/vxge/vxge-main.c +++ b/drivers/net/vxge/vxge-main.c | |||
@@ -2262,7 +2262,8 @@ start: | |||
2262 | vxge_debug_init(VXGE_ERR, | 2262 | vxge_debug_init(VXGE_ERR, |
2263 | "%s: memory allocation failed", | 2263 | "%s: memory allocation failed", |
2264 | VXGE_DRIVER_NAME); | 2264 | VXGE_DRIVER_NAME); |
2265 | return -ENOMEM; | 2265 | ret = -ENOMEM; |
2266 | goto alloc_entries_failed; | ||
2266 | } | 2267 | } |
2267 | 2268 | ||
2268 | vdev->vxge_entries = | 2269 | vdev->vxge_entries = |
@@ -2271,8 +2272,8 @@ start: | |||
2271 | if (!vdev->vxge_entries) { | 2272 | if (!vdev->vxge_entries) { |
2272 | vxge_debug_init(VXGE_ERR, "%s: memory allocation failed", | 2273 | vxge_debug_init(VXGE_ERR, "%s: memory allocation failed", |
2273 | VXGE_DRIVER_NAME); | 2274 | VXGE_DRIVER_NAME); |
2274 | kfree(vdev->entries); | 2275 | ret = -ENOMEM; |
2275 | return -ENOMEM; | 2276 | goto alloc_vxge_entries_failed; |
2276 | } | 2277 | } |
2277 | 2278 | ||
2278 | for (i = 0, j = 0; i < vdev->no_of_vpath; i++) { | 2279 | for (i = 0, j = 0; i < vdev->no_of_vpath; i++) { |
@@ -2303,22 +2304,32 @@ start: | |||
2303 | vxge_debug_init(VXGE_ERR, | 2304 | vxge_debug_init(VXGE_ERR, |
2304 | "%s: MSI-X enable failed for %d vectors, ret: %d", | 2305 | "%s: MSI-X enable failed for %d vectors, ret: %d", |
2305 | VXGE_DRIVER_NAME, vdev->intr_cnt, ret); | 2306 | VXGE_DRIVER_NAME, vdev->intr_cnt, ret); |
2307 | if ((max_config_vpath != VXGE_USE_DEFAULT) || (ret < 3)) { | ||
2308 | ret = -ENODEV; | ||
2309 | goto enable_msix_failed; | ||
2310 | } | ||
2311 | |||
2306 | kfree(vdev->entries); | 2312 | kfree(vdev->entries); |
2307 | kfree(vdev->vxge_entries); | 2313 | kfree(vdev->vxge_entries); |
2308 | vdev->entries = NULL; | 2314 | vdev->entries = NULL; |
2309 | vdev->vxge_entries = NULL; | 2315 | vdev->vxge_entries = NULL; |
2310 | |||
2311 | if ((max_config_vpath != VXGE_USE_DEFAULT) || (ret < 3)) | ||
2312 | return -ENODEV; | ||
2313 | /* Try with less no of vector by reducing no of vpaths count */ | 2316 | /* Try with less no of vector by reducing no of vpaths count */ |
2314 | temp = (ret - 1)/2; | 2317 | temp = (ret - 1)/2; |
2315 | vxge_close_vpaths(vdev, temp); | 2318 | vxge_close_vpaths(vdev, temp); |
2316 | vdev->no_of_vpath = temp; | 2319 | vdev->no_of_vpath = temp; |
2317 | goto start; | 2320 | goto start; |
2318 | } else if (ret < 0) | 2321 | } else if (ret < 0) { |
2319 | return -ENODEV; | 2322 | ret = -ENODEV; |
2320 | 2323 | goto enable_msix_failed; | |
2324 | } | ||
2321 | return 0; | 2325 | return 0; |
2326 | |||
2327 | enable_msix_failed: | ||
2328 | kfree(vdev->vxge_entries); | ||
2329 | alloc_vxge_entries_failed: | ||
2330 | kfree(vdev->entries); | ||
2331 | alloc_entries_failed: | ||
2332 | return ret; | ||
2322 | } | 2333 | } |
2323 | 2334 | ||
2324 | static int vxge_enable_msix(struct vxgedev *vdev) | 2335 | static int vxge_enable_msix(struct vxgedev *vdev) |
diff --git a/drivers/net/wireless/ath/ath5k/attach.c b/drivers/net/wireless/ath/ath5k/attach.c index e0c244b02f05..31c008042bfe 100644 --- a/drivers/net/wireless/ath/ath5k/attach.c +++ b/drivers/net/wireless/ath/ath5k/attach.c | |||
@@ -126,6 +126,7 @@ int ath5k_hw_attach(struct ath5k_softc *sc) | |||
126 | ah->ah_ant_mode = AR5K_ANTMODE_DEFAULT; | 126 | ah->ah_ant_mode = AR5K_ANTMODE_DEFAULT; |
127 | ah->ah_noise_floor = -95; /* until first NF calibration is run */ | 127 | ah->ah_noise_floor = -95; /* until first NF calibration is run */ |
128 | sc->ani_state.ani_mode = ATH5K_ANI_MODE_AUTO; | 128 | sc->ani_state.ani_mode = ATH5K_ANI_MODE_AUTO; |
129 | ah->ah_current_channel = &sc->channels[0]; | ||
129 | 130 | ||
130 | /* | 131 | /* |
131 | * Find the mac version | 132 | * Find the mac version |
diff --git a/drivers/net/wireless/hostap/hostap_cs.c b/drivers/net/wireless/hostap/hostap_cs.c index db72461c486b..29b31a694b59 100644 --- a/drivers/net/wireless/hostap/hostap_cs.c +++ b/drivers/net/wireless/hostap/hostap_cs.c | |||
@@ -594,6 +594,7 @@ static int prism2_config(struct pcmcia_device *link) | |||
594 | local_info_t *local; | 594 | local_info_t *local; |
595 | int ret = 1; | 595 | int ret = 1; |
596 | struct hostap_cs_priv *hw_priv; | 596 | struct hostap_cs_priv *hw_priv; |
597 | unsigned long flags; | ||
597 | 598 | ||
598 | PDEBUG(DEBUG_FLOW, "prism2_config()\n"); | 599 | PDEBUG(DEBUG_FLOW, "prism2_config()\n"); |
599 | 600 | ||
@@ -625,9 +626,15 @@ static int prism2_config(struct pcmcia_device *link) | |||
625 | local->hw_priv = hw_priv; | 626 | local->hw_priv = hw_priv; |
626 | hw_priv->link = link; | 627 | hw_priv->link = link; |
627 | 628 | ||
629 | /* | ||
630 | * Make sure the IRQ handler cannot proceed until at least | ||
631 | * dev->base_addr is initialized. | ||
632 | */ | ||
633 | spin_lock_irqsave(&local->irq_init_lock, flags); | ||
634 | |||
628 | ret = pcmcia_request_irq(link, prism2_interrupt); | 635 | ret = pcmcia_request_irq(link, prism2_interrupt); |
629 | if (ret) | 636 | if (ret) |
630 | goto failed; | 637 | goto failed_unlock; |
631 | 638 | ||
632 | /* | 639 | /* |
633 | * This actually configures the PCMCIA socket -- setting up | 640 | * This actually configures the PCMCIA socket -- setting up |
@@ -636,11 +643,13 @@ static int prism2_config(struct pcmcia_device *link) | |||
636 | */ | 643 | */ |
637 | ret = pcmcia_request_configuration(link, &link->conf); | 644 | ret = pcmcia_request_configuration(link, &link->conf); |
638 | if (ret) | 645 | if (ret) |
639 | goto failed; | 646 | goto failed_unlock; |
640 | 647 | ||
641 | dev->irq = link->irq; | 648 | dev->irq = link->irq; |
642 | dev->base_addr = link->io.BasePort1; | 649 | dev->base_addr = link->io.BasePort1; |
643 | 650 | ||
651 | spin_unlock_irqrestore(&local->irq_init_lock, flags); | ||
652 | |||
644 | /* Finally, report what we've done */ | 653 | /* Finally, report what we've done */ |
645 | printk(KERN_INFO "%s: index 0x%02x: ", | 654 | printk(KERN_INFO "%s: index 0x%02x: ", |
646 | dev_info, link->conf.ConfigIndex); | 655 | dev_info, link->conf.ConfigIndex); |
@@ -667,6 +676,8 @@ static int prism2_config(struct pcmcia_device *link) | |||
667 | 676 | ||
668 | return ret; | 677 | return ret; |
669 | 678 | ||
679 | failed_unlock: | ||
680 | spin_unlock_irqrestore(&local->irq_init_lock, flags); | ||
670 | failed: | 681 | failed: |
671 | kfree(hw_priv); | 682 | kfree(hw_priv); |
672 | prism2_release((u_long)link); | 683 | prism2_release((u_long)link); |
diff --git a/drivers/net/wireless/hostap/hostap_hw.c b/drivers/net/wireless/hostap/hostap_hw.c index ff9b5c882184..2f999fc94f60 100644 --- a/drivers/net/wireless/hostap/hostap_hw.c +++ b/drivers/net/wireless/hostap/hostap_hw.c | |||
@@ -2621,6 +2621,18 @@ static irqreturn_t prism2_interrupt(int irq, void *dev_id) | |||
2621 | iface = netdev_priv(dev); | 2621 | iface = netdev_priv(dev); |
2622 | local = iface->local; | 2622 | local = iface->local; |
2623 | 2623 | ||
2624 | /* Detect early interrupt before driver is fully configued */ | ||
2625 | spin_lock(&local->irq_init_lock); | ||
2626 | if (!dev->base_addr) { | ||
2627 | if (net_ratelimit()) { | ||
2628 | printk(KERN_DEBUG "%s: Interrupt, but dev not configured\n", | ||
2629 | dev->name); | ||
2630 | } | ||
2631 | spin_unlock(&local->irq_init_lock); | ||
2632 | return IRQ_HANDLED; | ||
2633 | } | ||
2634 | spin_unlock(&local->irq_init_lock); | ||
2635 | |||
2624 | prism2_io_debug_add(dev, PRISM2_IO_DEBUG_CMD_INTERRUPT, 0, 0); | 2636 | prism2_io_debug_add(dev, PRISM2_IO_DEBUG_CMD_INTERRUPT, 0, 0); |
2625 | 2637 | ||
2626 | if (local->func->card_present && !local->func->card_present(local)) { | 2638 | if (local->func->card_present && !local->func->card_present(local)) { |
@@ -3138,6 +3150,7 @@ prism2_init_local_data(struct prism2_helper_functions *funcs, int card_idx, | |||
3138 | spin_lock_init(&local->cmdlock); | 3150 | spin_lock_init(&local->cmdlock); |
3139 | spin_lock_init(&local->baplock); | 3151 | spin_lock_init(&local->baplock); |
3140 | spin_lock_init(&local->lock); | 3152 | spin_lock_init(&local->lock); |
3153 | spin_lock_init(&local->irq_init_lock); | ||
3141 | mutex_init(&local->rid_bap_mtx); | 3154 | mutex_init(&local->rid_bap_mtx); |
3142 | 3155 | ||
3143 | if (card_idx < 0 || card_idx >= MAX_PARM_DEVICES) | 3156 | if (card_idx < 0 || card_idx >= MAX_PARM_DEVICES) |
diff --git a/drivers/net/wireless/hostap/hostap_wlan.h b/drivers/net/wireless/hostap/hostap_wlan.h index 3d238917af07..1ba33be98b25 100644 --- a/drivers/net/wireless/hostap/hostap_wlan.h +++ b/drivers/net/wireless/hostap/hostap_wlan.h | |||
@@ -654,7 +654,7 @@ struct local_info { | |||
654 | rwlock_t iface_lock; /* hostap_interfaces read lock; use write lock | 654 | rwlock_t iface_lock; /* hostap_interfaces read lock; use write lock |
655 | * when removing entries from the list. | 655 | * when removing entries from the list. |
656 | * TX and RX paths can use read lock. */ | 656 | * TX and RX paths can use read lock. */ |
657 | spinlock_t cmdlock, baplock, lock; | 657 | spinlock_t cmdlock, baplock, lock, irq_init_lock; |
658 | struct mutex rid_bap_mtx; | 658 | struct mutex rid_bap_mtx; |
659 | u16 infofid; /* MAC buffer id for info frame */ | 659 | u16 infofid; /* MAC buffer id for info frame */ |
660 | /* txfid, intransmitfid, next_txtid, and next_alloc are protected by | 660 | /* txfid, intransmitfid, next_txtid, and next_alloc are protected by |
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-tx.c b/drivers/net/wireless/iwlwifi/iwl-agn-tx.c index a732f1094e5d..7d614c4d3c62 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn-tx.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn-tx.c | |||
@@ -1299,6 +1299,11 @@ void iwlagn_rx_reply_compressed_ba(struct iwl_priv *priv, | |||
1299 | sta_id = ba_resp->sta_id; | 1299 | sta_id = ba_resp->sta_id; |
1300 | tid = ba_resp->tid; | 1300 | tid = ba_resp->tid; |
1301 | agg = &priv->stations[sta_id].tid[tid].agg; | 1301 | agg = &priv->stations[sta_id].tid[tid].agg; |
1302 | if (unlikely(agg->txq_id != scd_flow)) { | ||
1303 | IWL_ERR(priv, "BA scd_flow %d does not match txq_id %d\n", | ||
1304 | scd_flow, agg->txq_id); | ||
1305 | return; | ||
1306 | } | ||
1302 | 1307 | ||
1303 | /* Find index just before block-ack window */ | 1308 | /* Find index just before block-ack window */ |
1304 | index = iwl_queue_dec_wrap(ba_resp_scd_ssn & 0xff, txq->q.n_bd); | 1309 | index = iwl_queue_dec_wrap(ba_resp_scd_ssn & 0xff, txq->q.n_bd); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c index 7726e67044c0..24aff654fa9c 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn.c | |||
@@ -3391,10 +3391,12 @@ static int iwlagn_mac_sta_add(struct ieee80211_hw *hw, | |||
3391 | int ret; | 3391 | int ret; |
3392 | u8 sta_id; | 3392 | u8 sta_id; |
3393 | 3393 | ||
3394 | sta_priv->common.sta_id = IWL_INVALID_STATION; | ||
3395 | |||
3396 | IWL_DEBUG_INFO(priv, "received request to add station %pM\n", | 3394 | IWL_DEBUG_INFO(priv, "received request to add station %pM\n", |
3397 | sta->addr); | 3395 | sta->addr); |
3396 | mutex_lock(&priv->mutex); | ||
3397 | IWL_DEBUG_INFO(priv, "proceeding to add station %pM\n", | ||
3398 | sta->addr); | ||
3399 | sta_priv->common.sta_id = IWL_INVALID_STATION; | ||
3398 | 3400 | ||
3399 | atomic_set(&sta_priv->pending_frames, 0); | 3401 | atomic_set(&sta_priv->pending_frames, 0); |
3400 | if (vif->type == NL80211_IFTYPE_AP) | 3402 | if (vif->type == NL80211_IFTYPE_AP) |
@@ -3406,6 +3408,7 @@ static int iwlagn_mac_sta_add(struct ieee80211_hw *hw, | |||
3406 | IWL_ERR(priv, "Unable to add station %pM (%d)\n", | 3408 | IWL_ERR(priv, "Unable to add station %pM (%d)\n", |
3407 | sta->addr, ret); | 3409 | sta->addr, ret); |
3408 | /* Should we return success if return code is EEXIST ? */ | 3410 | /* Should we return success if return code is EEXIST ? */ |
3411 | mutex_unlock(&priv->mutex); | ||
3409 | return ret; | 3412 | return ret; |
3410 | } | 3413 | } |
3411 | 3414 | ||
@@ -3415,6 +3418,7 @@ static int iwlagn_mac_sta_add(struct ieee80211_hw *hw, | |||
3415 | IWL_DEBUG_INFO(priv, "Initializing rate scaling for station %pM\n", | 3418 | IWL_DEBUG_INFO(priv, "Initializing rate scaling for station %pM\n", |
3416 | sta->addr); | 3419 | sta->addr); |
3417 | iwl_rs_rate_init(priv, sta, sta_id); | 3420 | iwl_rs_rate_init(priv, sta, sta_id); |
3421 | mutex_unlock(&priv->mutex); | ||
3418 | 3422 | ||
3419 | return 0; | 3423 | return 0; |
3420 | } | 3424 | } |
diff --git a/drivers/net/wireless/iwlwifi/iwl-scan.c b/drivers/net/wireless/iwlwifi/iwl-scan.c index 5d3f51ff2f0d..386c5f96eff8 100644 --- a/drivers/net/wireless/iwlwifi/iwl-scan.c +++ b/drivers/net/wireless/iwlwifi/iwl-scan.c | |||
@@ -491,6 +491,7 @@ void iwl_bg_abort_scan(struct work_struct *work) | |||
491 | 491 | ||
492 | mutex_lock(&priv->mutex); | 492 | mutex_lock(&priv->mutex); |
493 | 493 | ||
494 | cancel_delayed_work_sync(&priv->scan_check); | ||
494 | set_bit(STATUS_SCAN_ABORTING, &priv->status); | 495 | set_bit(STATUS_SCAN_ABORTING, &priv->status); |
495 | iwl_send_scan_abort(priv); | 496 | iwl_send_scan_abort(priv); |
496 | 497 | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-sta.c b/drivers/net/wireless/iwlwifi/iwl-sta.c index 83a26361a9b5..c27c13fbb1ae 100644 --- a/drivers/net/wireless/iwlwifi/iwl-sta.c +++ b/drivers/net/wireless/iwlwifi/iwl-sta.c | |||
@@ -1373,10 +1373,14 @@ int iwl_mac_sta_remove(struct ieee80211_hw *hw, | |||
1373 | 1373 | ||
1374 | IWL_DEBUG_INFO(priv, "received request to remove station %pM\n", | 1374 | IWL_DEBUG_INFO(priv, "received request to remove station %pM\n", |
1375 | sta->addr); | 1375 | sta->addr); |
1376 | mutex_lock(&priv->mutex); | ||
1377 | IWL_DEBUG_INFO(priv, "proceeding to remove station %pM\n", | ||
1378 | sta->addr); | ||
1376 | ret = iwl_remove_station(priv, sta_common->sta_id, sta->addr); | 1379 | ret = iwl_remove_station(priv, sta_common->sta_id, sta->addr); |
1377 | if (ret) | 1380 | if (ret) |
1378 | IWL_ERR(priv, "Error removing station %pM\n", | 1381 | IWL_ERR(priv, "Error removing station %pM\n", |
1379 | sta->addr); | 1382 | sta->addr); |
1383 | mutex_unlock(&priv->mutex); | ||
1380 | return ret; | 1384 | return ret; |
1381 | } | 1385 | } |
1382 | EXPORT_SYMBOL(iwl_mac_sta_remove); | 1386 | EXPORT_SYMBOL(iwl_mac_sta_remove); |
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c index 6c353cacc8d6..a27872de4106 100644 --- a/drivers/net/wireless/iwlwifi/iwl3945-base.c +++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c | |||
@@ -3437,10 +3437,13 @@ static int iwl3945_mac_sta_add(struct ieee80211_hw *hw, | |||
3437 | bool is_ap = vif->type == NL80211_IFTYPE_STATION; | 3437 | bool is_ap = vif->type == NL80211_IFTYPE_STATION; |
3438 | u8 sta_id; | 3438 | u8 sta_id; |
3439 | 3439 | ||
3440 | sta_priv->common.sta_id = IWL_INVALID_STATION; | ||
3441 | |||
3442 | IWL_DEBUG_INFO(priv, "received request to add station %pM\n", | 3440 | IWL_DEBUG_INFO(priv, "received request to add station %pM\n", |
3443 | sta->addr); | 3441 | sta->addr); |
3442 | mutex_lock(&priv->mutex); | ||
3443 | IWL_DEBUG_INFO(priv, "proceeding to add station %pM\n", | ||
3444 | sta->addr); | ||
3445 | sta_priv->common.sta_id = IWL_INVALID_STATION; | ||
3446 | |||
3444 | 3447 | ||
3445 | ret = iwl_add_station_common(priv, sta->addr, is_ap, &sta->ht_cap, | 3448 | ret = iwl_add_station_common(priv, sta->addr, is_ap, &sta->ht_cap, |
3446 | &sta_id); | 3449 | &sta_id); |
@@ -3448,6 +3451,7 @@ static int iwl3945_mac_sta_add(struct ieee80211_hw *hw, | |||
3448 | IWL_ERR(priv, "Unable to add station %pM (%d)\n", | 3451 | IWL_ERR(priv, "Unable to add station %pM (%d)\n", |
3449 | sta->addr, ret); | 3452 | sta->addr, ret); |
3450 | /* Should we return success if return code is EEXIST ? */ | 3453 | /* Should we return success if return code is EEXIST ? */ |
3454 | mutex_unlock(&priv->mutex); | ||
3451 | return ret; | 3455 | return ret; |
3452 | } | 3456 | } |
3453 | 3457 | ||
@@ -3457,6 +3461,7 @@ static int iwl3945_mac_sta_add(struct ieee80211_hw *hw, | |||
3457 | IWL_DEBUG_INFO(priv, "Initializing rate scaling for station %pM\n", | 3461 | IWL_DEBUG_INFO(priv, "Initializing rate scaling for station %pM\n", |
3458 | sta->addr); | 3462 | sta->addr); |
3459 | iwl3945_rs_rate_init(priv, sta, sta_id); | 3463 | iwl3945_rs_rate_init(priv, sta, sta_id); |
3464 | mutex_unlock(&priv->mutex); | ||
3460 | 3465 | ||
3461 | return 0; | 3466 | return 0; |
3462 | } | 3467 | } |
diff --git a/drivers/net/wireless/libertas_tf/main.c b/drivers/net/wireless/libertas_tf/main.c index 6a04c2157f73..817fffc0de4b 100644 --- a/drivers/net/wireless/libertas_tf/main.c +++ b/drivers/net/wireless/libertas_tf/main.c | |||
@@ -549,7 +549,7 @@ int lbtf_rx(struct lbtf_private *priv, struct sk_buff *skb) | |||
549 | 549 | ||
550 | prxpd = (struct rxpd *) skb->data; | 550 | prxpd = (struct rxpd *) skb->data; |
551 | 551 | ||
552 | stats.flag = 0; | 552 | memset(&stats, 0, sizeof(stats)); |
553 | if (!(prxpd->status & cpu_to_le16(MRVDRV_RXPD_STATUS_OK))) | 553 | if (!(prxpd->status & cpu_to_le16(MRVDRV_RXPD_STATUS_OK))) |
554 | stats.flag |= RX_FLAG_FAILED_FCS_CRC; | 554 | stats.flag |= RX_FLAG_FAILED_FCS_CRC; |
555 | stats.freq = priv->cur_freq; | 555 | stats.freq = priv->cur_freq; |
diff --git a/drivers/net/wireless/p54/p54pci.c b/drivers/net/wireless/p54/p54pci.c index 07c4528f6e6b..a5ea89cde8c4 100644 --- a/drivers/net/wireless/p54/p54pci.c +++ b/drivers/net/wireless/p54/p54pci.c | |||
@@ -41,6 +41,8 @@ static DEFINE_PCI_DEVICE_TABLE(p54p_table) = { | |||
41 | { PCI_DEVICE(0x1260, 0x3877) }, | 41 | { PCI_DEVICE(0x1260, 0x3877) }, |
42 | /* Intersil PRISM Javelin/Xbow Wireless LAN adapter */ | 42 | /* Intersil PRISM Javelin/Xbow Wireless LAN adapter */ |
43 | { PCI_DEVICE(0x1260, 0x3886) }, | 43 | { PCI_DEVICE(0x1260, 0x3886) }, |
44 | /* Intersil PRISM Xbow Wireless LAN adapter (Symbol AP-300) */ | ||
45 | { PCI_DEVICE(0x1260, 0xffff) }, | ||
44 | { }, | 46 | { }, |
45 | }; | 47 | }; |
46 | 48 | ||
diff --git a/drivers/pci/intel-iommu.c b/drivers/pci/intel-iommu.c index 796828fce34c..c9171be74564 100644 --- a/drivers/pci/intel-iommu.c +++ b/drivers/pci/intel-iommu.c | |||
@@ -340,7 +340,7 @@ int dmar_disabled = 0; | |||
340 | int dmar_disabled = 1; | 340 | int dmar_disabled = 1; |
341 | #endif /*CONFIG_DMAR_DEFAULT_ON*/ | 341 | #endif /*CONFIG_DMAR_DEFAULT_ON*/ |
342 | 342 | ||
343 | static int __initdata dmar_map_gfx = 1; | 343 | static int dmar_map_gfx = 1; |
344 | static int dmar_forcedac; | 344 | static int dmar_forcedac; |
345 | static int intel_iommu_strict; | 345 | static int intel_iommu_strict; |
346 | 346 | ||
@@ -1874,14 +1874,15 @@ static struct dmar_domain *get_domain_for_dev(struct pci_dev *pdev, int gaw) | |||
1874 | } | 1874 | } |
1875 | } | 1875 | } |
1876 | if (found) { | 1876 | if (found) { |
1877 | spin_unlock_irqrestore(&device_domain_lock, flags); | ||
1877 | free_devinfo_mem(info); | 1878 | free_devinfo_mem(info); |
1878 | domain_exit(domain); | 1879 | domain_exit(domain); |
1879 | domain = found; | 1880 | domain = found; |
1880 | } else { | 1881 | } else { |
1881 | list_add(&info->link, &domain->devices); | 1882 | list_add(&info->link, &domain->devices); |
1882 | list_add(&info->global, &device_domain_list); | 1883 | list_add(&info->global, &device_domain_list); |
1884 | spin_unlock_irqrestore(&device_domain_lock, flags); | ||
1883 | } | 1885 | } |
1884 | spin_unlock_irqrestore(&device_domain_lock, flags); | ||
1885 | } | 1886 | } |
1886 | 1887 | ||
1887 | found_domain: | 1888 | found_domain: |
@@ -3603,7 +3604,8 @@ static int intel_iommu_attach_device(struct iommu_domain *domain, | |||
3603 | pte = dmar_domain->pgd; | 3604 | pte = dmar_domain->pgd; |
3604 | if (dma_pte_present(pte)) { | 3605 | if (dma_pte_present(pte)) { |
3605 | free_pgtable_page(dmar_domain->pgd); | 3606 | free_pgtable_page(dmar_domain->pgd); |
3606 | dmar_domain->pgd = (struct dma_pte *)dma_pte_addr(pte); | 3607 | dmar_domain->pgd = (struct dma_pte *) |
3608 | phys_to_virt(dma_pte_addr(pte)); | ||
3607 | } | 3609 | } |
3608 | dmar_domain->agaw--; | 3610 | dmar_domain->agaw--; |
3609 | } | 3611 | } |
@@ -3719,6 +3721,12 @@ static void __devinit quirk_iommu_rwbf(struct pci_dev *dev) | |||
3719 | */ | 3721 | */ |
3720 | printk(KERN_INFO "DMAR: Forcing write-buffer flush capability\n"); | 3722 | printk(KERN_INFO "DMAR: Forcing write-buffer flush capability\n"); |
3721 | rwbf_quirk = 1; | 3723 | rwbf_quirk = 1; |
3724 | |||
3725 | /* https://bugzilla.redhat.com/show_bug.cgi?id=538163 */ | ||
3726 | if (dev->revision == 0x07) { | ||
3727 | printk(KERN_INFO "DMAR: Disabling IOMMU for graphics on this chipset\n"); | ||
3728 | dmar_map_gfx = 0; | ||
3729 | } | ||
3722 | } | 3730 | } |
3723 | 3731 | ||
3724 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x2a40, quirk_iommu_rwbf); | 3732 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x2a40, quirk_iommu_rwbf); |
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 60f30e7f1c8c..740fb4ea9669 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c | |||
@@ -2292,6 +2292,7 @@ void pci_msi_off(struct pci_dev *dev) | |||
2292 | pci_write_config_word(dev, pos + PCI_MSIX_FLAGS, control); | 2292 | pci_write_config_word(dev, pos + PCI_MSIX_FLAGS, control); |
2293 | } | 2293 | } |
2294 | } | 2294 | } |
2295 | EXPORT_SYMBOL_GPL(pci_msi_off); | ||
2295 | 2296 | ||
2296 | #ifndef HAVE_ARCH_PCI_SET_DMA_MAX_SEGMENT_SIZE | 2297 | #ifndef HAVE_ARCH_PCI_SET_DMA_MAX_SEGMENT_SIZE |
2297 | int pci_set_dma_max_seg_size(struct pci_dev *dev, unsigned int size) | 2298 | int pci_set_dma_max_seg_size(struct pci_dev *dev, unsigned int size) |
diff --git a/drivers/pci/pcie/pme/pcie_pme.c b/drivers/pci/pcie/pme/pcie_pme.c index aac285a16b62..d672a0a63816 100644 --- a/drivers/pci/pcie/pme/pcie_pme.c +++ b/drivers/pci/pcie/pme/pcie_pme.c | |||
@@ -34,7 +34,7 @@ | |||
34 | * being registered. Consequently, the interrupt-based PCIe PME signaling will | 34 | * being registered. Consequently, the interrupt-based PCIe PME signaling will |
35 | * not be used by any PCIe root ports in that case. | 35 | * not be used by any PCIe root ports in that case. |
36 | */ | 36 | */ |
37 | static bool pcie_pme_disabled; | 37 | static bool pcie_pme_disabled = true; |
38 | 38 | ||
39 | /* | 39 | /* |
40 | * The PCI Express Base Specification 2.0, Section 6.1.8, states the following: | 40 | * The PCI Express Base Specification 2.0, Section 6.1.8, states the following: |
@@ -64,12 +64,19 @@ bool pcie_pme_msi_disabled; | |||
64 | 64 | ||
65 | static int __init pcie_pme_setup(char *str) | 65 | static int __init pcie_pme_setup(char *str) |
66 | { | 66 | { |
67 | if (!strcmp(str, "off")) | 67 | if (!strncmp(str, "auto", 4)) |
68 | pcie_pme_disabled = true; | 68 | pcie_pme_disabled = false; |
69 | else if (!strcmp(str, "force")) | 69 | else if (!strncmp(str, "force", 5)) |
70 | pcie_pme_force_enable = true; | 70 | pcie_pme_force_enable = true; |
71 | else if (!strcmp(str, "nomsi")) | 71 | |
72 | pcie_pme_msi_disabled = true; | 72 | str = strchr(str, ','); |
73 | if (str) { | ||
74 | str++; | ||
75 | str += strspn(str, " \t"); | ||
76 | if (*str && !strcmp(str, "nomsi")) | ||
77 | pcie_pme_msi_disabled = true; | ||
78 | } | ||
79 | |||
73 | return 1; | 80 | return 1; |
74 | } | 81 | } |
75 | __setup("pcie_pme=", pcie_pme_setup); | 82 | __setup("pcie_pme=", pcie_pme_setup); |
diff --git a/drivers/rtc/rtc-davinci.c b/drivers/rtc/rtc-davinci.c index 92a8f6cacda9..34647fc1ee98 100644 --- a/drivers/rtc/rtc-davinci.c +++ b/drivers/rtc/rtc-davinci.c | |||
@@ -29,6 +29,7 @@ | |||
29 | #include <linux/bcd.h> | 29 | #include <linux/bcd.h> |
30 | #include <linux/platform_device.h> | 30 | #include <linux/platform_device.h> |
31 | #include <linux/io.h> | 31 | #include <linux/io.h> |
32 | #include <linux/slab.h> | ||
32 | 33 | ||
33 | /* | 34 | /* |
34 | * The DaVinci RTC is a simple RTC with the following | 35 | * The DaVinci RTC is a simple RTC with the following |
diff --git a/drivers/serial/serial_cs.c b/drivers/serial/serial_cs.c index 526307368f8b..ab17c08ddc03 100644 --- a/drivers/serial/serial_cs.c +++ b/drivers/serial/serial_cs.c | |||
@@ -821,6 +821,7 @@ static struct pcmcia_device_id serial_ids[] = { | |||
821 | PCMCIA_PFC_DEVICE_CIS_PROD_ID12(1, "Psion Dacom", "Gold Card V34 Ethernet", 0xf5f025c2, 0x338e8155, "cis/PCMLM28.cis"), | 821 | PCMCIA_PFC_DEVICE_CIS_PROD_ID12(1, "Psion Dacom", "Gold Card V34 Ethernet", 0xf5f025c2, 0x338e8155, "cis/PCMLM28.cis"), |
822 | PCMCIA_PFC_DEVICE_CIS_PROD_ID12(1, "Psion Dacom", "Gold Card V34 Ethernet GSM", 0xf5f025c2, 0x4ae85d35, "cis/PCMLM28.cis"), | 822 | PCMCIA_PFC_DEVICE_CIS_PROD_ID12(1, "Psion Dacom", "Gold Card V34 Ethernet GSM", 0xf5f025c2, 0x4ae85d35, "cis/PCMLM28.cis"), |
823 | PCMCIA_PFC_DEVICE_CIS_PROD_ID12(1, "LINKSYS", "PCMLM28", 0xf7cb0b07, 0x66881874, "cis/PCMLM28.cis"), | 823 | PCMCIA_PFC_DEVICE_CIS_PROD_ID12(1, "LINKSYS", "PCMLM28", 0xf7cb0b07, 0x66881874, "cis/PCMLM28.cis"), |
824 | PCMCIA_PFC_DEVICE_CIS_PROD_ID12(1, "TOSHIBA", "Modem/LAN Card", 0xb4585a1a, 0x53f922f8, "cis/PCMLM28.cis"), | ||
824 | PCMCIA_MFC_DEVICE_CIS_PROD_ID12(1, "DAYNA COMMUNICATIONS", "LAN AND MODEM MULTIFUNCTION", 0x8fdf8f89, 0xdd5ed9e8, "cis/DP83903.cis"), | 825 | PCMCIA_MFC_DEVICE_CIS_PROD_ID12(1, "DAYNA COMMUNICATIONS", "LAN AND MODEM MULTIFUNCTION", 0x8fdf8f89, 0xdd5ed9e8, "cis/DP83903.cis"), |
825 | PCMCIA_MFC_DEVICE_CIS_PROD_ID4(1, "NSC MF LAN/Modem", 0x58fc6056, "cis/DP83903.cis"), | 826 | PCMCIA_MFC_DEVICE_CIS_PROD_ID4(1, "NSC MF LAN/Modem", 0x58fc6056, "cis/DP83903.cis"), |
826 | PCMCIA_MFC_DEVICE_CIS_MANF_CARD(1, 0x0101, 0x0556, "cis/3CCFEM556.cis"), | 827 | PCMCIA_MFC_DEVICE_CIS_MANF_CARD(1, 0x0101, 0x0556, "cis/3CCFEM556.cis"), |
diff --git a/drivers/staging/tm6000/tm6000-alsa.c b/drivers/staging/tm6000/tm6000-alsa.c index ce081cd44ad4..273e26ede650 100644 --- a/drivers/staging/tm6000/tm6000-alsa.c +++ b/drivers/staging/tm6000/tm6000-alsa.c | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/device.h> | 15 | #include <linux/device.h> |
16 | #include <linux/interrupt.h> | 16 | #include <linux/interrupt.h> |
17 | #include <linux/usb.h> | 17 | #include <linux/usb.h> |
18 | #include <linux/slab.h> | ||
18 | 19 | ||
19 | #include <asm/delay.h> | 20 | #include <asm/delay.h> |
20 | #include <sound/core.h> | 21 | #include <sound/core.h> |
diff --git a/drivers/staging/tm6000/tm6000-cards.c b/drivers/staging/tm6000/tm6000-cards.c index cedd9044022f..6a9ae40c7c6d 100644 --- a/drivers/staging/tm6000/tm6000-cards.c +++ b/drivers/staging/tm6000/tm6000-cards.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/i2c.h> | 24 | #include <linux/i2c.h> |
25 | #include <linux/usb.h> | 25 | #include <linux/usb.h> |
26 | #include <linux/version.h> | 26 | #include <linux/version.h> |
27 | #include <linux/slab.h> | ||
27 | #include <media/v4l2-common.h> | 28 | #include <media/v4l2-common.h> |
28 | #include <media/tuner.h> | 29 | #include <media/tuner.h> |
29 | #include <media/tvaudio.h> | 30 | #include <media/tvaudio.h> |
diff --git a/drivers/staging/tm6000/tm6000-core.c b/drivers/staging/tm6000/tm6000-core.c index 27f3f551b545..c3690e3580da 100644 --- a/drivers/staging/tm6000/tm6000-core.c +++ b/drivers/staging/tm6000/tm6000-core.c | |||
@@ -22,6 +22,7 @@ | |||
22 | 22 | ||
23 | #include <linux/module.h> | 23 | #include <linux/module.h> |
24 | #include <linux/kernel.h> | 24 | #include <linux/kernel.h> |
25 | #include <linux/slab.h> | ||
25 | #include <linux/usb.h> | 26 | #include <linux/usb.h> |
26 | #include <linux/i2c.h> | 27 | #include <linux/i2c.h> |
27 | #include "tm6000.h" | 28 | #include "tm6000.h" |
diff --git a/drivers/staging/tm6000/tm6000-dvb.c b/drivers/staging/tm6000/tm6000-dvb.c index 261e66acbe46..86c1c8b5f25a 100644 --- a/drivers/staging/tm6000/tm6000-dvb.c +++ b/drivers/staging/tm6000/tm6000-dvb.c | |||
@@ -18,6 +18,7 @@ | |||
18 | */ | 18 | */ |
19 | 19 | ||
20 | #include <linux/kernel.h> | 20 | #include <linux/kernel.h> |
21 | #include <linux/slab.h> | ||
21 | #include <linux/usb.h> | 22 | #include <linux/usb.h> |
22 | 23 | ||
23 | #include "tm6000.h" | 24 | #include "tm6000.h" |
diff --git a/drivers/video/omap/lcdc.c b/drivers/video/omap/lcdc.c index 43ab7d8b66b2..7767338f8b14 100644 --- a/drivers/video/omap/lcdc.c +++ b/drivers/video/omap/lcdc.c | |||
@@ -572,22 +572,12 @@ static enum omapfb_update_mode omap_lcdc_get_update_mode(void) | |||
572 | /* PM code called only in internal controller mode */ | 572 | /* PM code called only in internal controller mode */ |
573 | static void omap_lcdc_suspend(void) | 573 | static void omap_lcdc_suspend(void) |
574 | { | 574 | { |
575 | if (lcdc.update_mode == OMAPFB_AUTO_UPDATE) { | 575 | omap_lcdc_set_update_mode(OMAPFB_UPDATE_DISABLED); |
576 | disable_controller(); | ||
577 | omap_stop_lcd_dma(); | ||
578 | } | ||
579 | } | 576 | } |
580 | 577 | ||
581 | static void omap_lcdc_resume(void) | 578 | static void omap_lcdc_resume(void) |
582 | { | 579 | { |
583 | if (lcdc.update_mode == OMAPFB_AUTO_UPDATE) { | 580 | omap_lcdc_set_update_mode(OMAPFB_AUTO_UPDATE); |
584 | setup_regs(); | ||
585 | load_palette(); | ||
586 | setup_lcd_dma(); | ||
587 | set_load_mode(OMAP_LCDC_LOAD_FRAME); | ||
588 | enable_irqs(OMAP_LCDC_IRQ_DONE); | ||
589 | enable_controller(); | ||
590 | } | ||
591 | } | 581 | } |
592 | 582 | ||
593 | static void omap_lcdc_get_caps(int plane, struct omapfb_caps *caps) | 583 | static void omap_lcdc_get_caps(int plane, struct omapfb_caps *caps) |
diff --git a/drivers/video/omap/rfbi.c b/drivers/video/omap/rfbi.c index 1162603c72e5..eada9f12efc7 100644 --- a/drivers/video/omap/rfbi.c +++ b/drivers/video/omap/rfbi.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <linux/interrupt.h> | 26 | #include <linux/interrupt.h> |
27 | #include <linux/clk.h> | 27 | #include <linux/clk.h> |
28 | #include <linux/io.h> | 28 | #include <linux/io.h> |
29 | #include <linux/platform_device.h> | ||
29 | 30 | ||
30 | #include "omapfb.h" | 31 | #include "omapfb.h" |
31 | #include "dispc.h" | 32 | #include "dispc.h" |
@@ -83,13 +84,13 @@ static inline u32 rfbi_read_reg(int idx) | |||
83 | 84 | ||
84 | static int rfbi_get_clocks(void) | 85 | static int rfbi_get_clocks(void) |
85 | { | 86 | { |
86 | rfbi.dss_ick = clk_get(&dispc.fbdev->dssdev->dev, "ick"); | 87 | rfbi.dss_ick = clk_get(&rfbi.fbdev->dssdev->dev, "ick"); |
87 | if (IS_ERR(rfbi.dss_ick)) { | 88 | if (IS_ERR(rfbi.dss_ick)) { |
88 | dev_err(rfbi.fbdev->dev, "can't get ick\n"); | 89 | dev_err(rfbi.fbdev->dev, "can't get ick\n"); |
89 | return PTR_ERR(rfbi.dss_ick); | 90 | return PTR_ERR(rfbi.dss_ick); |
90 | } | 91 | } |
91 | 92 | ||
92 | rfbi.dss1_fck = clk_get(&dispc.fbdev->dssdev->dev, "dss1_fck"); | 93 | rfbi.dss1_fck = clk_get(&rfbi.fbdev->dssdev->dev, "dss1_fck"); |
93 | if (IS_ERR(rfbi.dss1_fck)) { | 94 | if (IS_ERR(rfbi.dss1_fck)) { |
94 | dev_err(rfbi.fbdev->dev, "can't get dss1_fck\n"); | 95 | dev_err(rfbi.fbdev->dev, "can't get dss1_fck\n"); |
95 | clk_put(rfbi.dss_ick); | 96 | clk_put(rfbi.dss_ick); |
diff --git a/drivers/virtio/virtio_pci.c b/drivers/virtio/virtio_pci.c index 95896f387927..ef8d9d558fc7 100644 --- a/drivers/virtio/virtio_pci.c +++ b/drivers/virtio/virtio_pci.c | |||
@@ -636,6 +636,9 @@ static int __devinit virtio_pci_probe(struct pci_dev *pci_dev, | |||
636 | INIT_LIST_HEAD(&vp_dev->virtqueues); | 636 | INIT_LIST_HEAD(&vp_dev->virtqueues); |
637 | spin_lock_init(&vp_dev->lock); | 637 | spin_lock_init(&vp_dev->lock); |
638 | 638 | ||
639 | /* Disable MSI/MSIX to bring device to a known good state. */ | ||
640 | pci_msi_off(pci_dev); | ||
641 | |||
639 | /* enable the device */ | 642 | /* enable the device */ |
640 | err = pci_enable_device(pci_dev); | 643 | err = pci_enable_device(pci_dev); |
641 | if (err) | 644 | if (err) |
diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c index 1ca88908723b..afe7e21dd0ae 100644 --- a/drivers/virtio/virtio_ring.c +++ b/drivers/virtio/virtio_ring.c | |||
@@ -119,7 +119,7 @@ static int vring_add_indirect(struct vring_virtqueue *vq, | |||
119 | 119 | ||
120 | desc = kmalloc((out + in) * sizeof(struct vring_desc), gfp); | 120 | desc = kmalloc((out + in) * sizeof(struct vring_desc), gfp); |
121 | if (!desc) | 121 | if (!desc) |
122 | return vq->vring.num; | 122 | return -ENOMEM; |
123 | 123 | ||
124 | /* Transfer entries from the sg list into the indirect page */ | 124 | /* Transfer entries from the sg list into the indirect page */ |
125 | for (i = 0; i < out; i++) { | 125 | for (i = 0; i < out; i++) { |
diff --git a/drivers/watchdog/at32ap700x_wdt.c b/drivers/watchdog/at32ap700x_wdt.c index 1cddf92cb9a6..750bc5281d79 100644 --- a/drivers/watchdog/at32ap700x_wdt.c +++ b/drivers/watchdog/at32ap700x_wdt.c | |||
@@ -346,9 +346,13 @@ static int __init at32_wdt_probe(struct platform_device *pdev) | |||
346 | } else { | 346 | } else { |
347 | wdt->users = 0; | 347 | wdt->users = 0; |
348 | } | 348 | } |
349 | wdt->miscdev.minor = WATCHDOG_MINOR; | 349 | |
350 | wdt->miscdev.name = "watchdog"; | 350 | wdt->miscdev.minor = WATCHDOG_MINOR; |
351 | wdt->miscdev.fops = &at32_wdt_fops; | 351 | wdt->miscdev.name = "watchdog"; |
352 | wdt->miscdev.fops = &at32_wdt_fops; | ||
353 | wdt->miscdev.parent = &pdev->dev; | ||
354 | |||
355 | platform_set_drvdata(pdev, wdt); | ||
352 | 356 | ||
353 | if (at32_wdt_settimeout(timeout)) { | 357 | if (at32_wdt_settimeout(timeout)) { |
354 | at32_wdt_settimeout(TIMEOUT_DEFAULT); | 358 | at32_wdt_settimeout(TIMEOUT_DEFAULT); |
@@ -360,17 +364,17 @@ static int __init at32_wdt_probe(struct platform_device *pdev) | |||
360 | ret = misc_register(&wdt->miscdev); | 364 | ret = misc_register(&wdt->miscdev); |
361 | if (ret) { | 365 | if (ret) { |
362 | dev_dbg(&pdev->dev, "failed to register wdt miscdev\n"); | 366 | dev_dbg(&pdev->dev, "failed to register wdt miscdev\n"); |
363 | goto err_iounmap; | 367 | goto err_register; |
364 | } | 368 | } |
365 | 369 | ||
366 | platform_set_drvdata(pdev, wdt); | ||
367 | wdt->miscdev.parent = &pdev->dev; | ||
368 | dev_info(&pdev->dev, | 370 | dev_info(&pdev->dev, |
369 | "AT32AP700X WDT at 0x%p, timeout %d sec (nowayout=%d)\n", | 371 | "AT32AP700X WDT at 0x%p, timeout %d sec (nowayout=%d)\n", |
370 | wdt->regs, wdt->timeout, nowayout); | 372 | wdt->regs, wdt->timeout, nowayout); |
371 | 373 | ||
372 | return 0; | 374 | return 0; |
373 | 375 | ||
376 | err_register: | ||
377 | platform_set_drvdata(pdev, NULL); | ||
374 | err_iounmap: | 378 | err_iounmap: |
375 | iounmap(wdt->regs); | 379 | iounmap(wdt->regs); |
376 | err_free: | 380 | err_free: |
diff --git a/drivers/watchdog/imx2_wdt.c b/drivers/watchdog/imx2_wdt.c index ea25885781bb..2ee7dac55a3c 100644 --- a/drivers/watchdog/imx2_wdt.c +++ b/drivers/watchdog/imx2_wdt.c | |||
@@ -330,7 +330,6 @@ static void imx2_wdt_shutdown(struct platform_device *pdev) | |||
330 | } | 330 | } |
331 | 331 | ||
332 | static struct platform_driver imx2_wdt_driver = { | 332 | static struct platform_driver imx2_wdt_driver = { |
333 | .probe = imx2_wdt_probe, | ||
334 | .remove = __exit_p(imx2_wdt_remove), | 333 | .remove = __exit_p(imx2_wdt_remove), |
335 | .shutdown = imx2_wdt_shutdown, | 334 | .shutdown = imx2_wdt_shutdown, |
336 | .driver = { | 335 | .driver = { |