/[linux-patches]/genpatches-2.6/tags/2.6.27-7/1006_linux-2.6.27.7.patch
Gentoo

Contents of /genpatches-2.6/tags/2.6.27-7/1006_linux-2.6.27.7.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1422 - (show annotations) (download)
Fri Dec 5 23:04:14 2008 UTC (9 years, 4 months ago) by dsd
File size: 64847 byte(s)
2.6.27-7 release
1 diff --git a/arch/arm/mm/cache-feroceon-l2.c b/arch/arm/mm/cache-feroceon-l2.c
2 index 7b5a25d..4f6cf46 100644
3 --- a/arch/arm/mm/cache-feroceon-l2.c
4 +++ b/arch/arm/mm/cache-feroceon-l2.c
5 @@ -148,7 +148,7 @@ static void feroceon_l2_inv_range(unsigned long start, unsigned long end)
6 /*
7 * Clean and invalidate partial last cache line.
8 */
9 - if (end & (CACHE_LINE_SIZE - 1)) {
10 + if (start < end && end & (CACHE_LINE_SIZE - 1)) {
11 l2_clean_inv_pa(end & ~(CACHE_LINE_SIZE - 1));
12 end &= ~(CACHE_LINE_SIZE - 1);
13 }
14 @@ -156,7 +156,7 @@ static void feroceon_l2_inv_range(unsigned long start, unsigned long end)
15 /*
16 * Invalidate all full cache lines between 'start' and 'end'.
17 */
18 - while (start != end) {
19 + while (start < end) {
20 unsigned long range_end = calc_range_end(start, end);
21 l2_inv_pa_range(start, range_end - CACHE_LINE_SIZE);
22 start = range_end;
23 diff --git a/arch/m68k/kernel/ints.c b/arch/m68k/kernel/ints.c
24 index ded7dd2..c4460bf 100644
25 --- a/arch/m68k/kernel/ints.c
26 +++ b/arch/m68k/kernel/ints.c
27 @@ -133,7 +133,7 @@ void __init m68k_setup_user_interrupt(unsigned int vec, unsigned int cnt,
28 {
29 int i;
30
31 - BUG_ON(IRQ_USER + cnt >= NR_IRQS);
32 + BUG_ON(IRQ_USER + cnt > NR_IRQS);
33 m68k_first_user_vec = vec;
34 for (i = 0; i < cnt; i++)
35 irq_controller[IRQ_USER + i] = &user_irq_controller;
36 diff --git a/arch/powerpc/include/asm/mpic.h b/arch/powerpc/include/asm/mpic.h
37 index fe566a3..eb685ed 100644
38 --- a/arch/powerpc/include/asm/mpic.h
39 +++ b/arch/powerpc/include/asm/mpic.h
40 @@ -355,6 +355,8 @@ struct mpic
41 #define MPIC_NO_BIAS 0x00000400
42 /* Ignore NIRQS as reported by FRR */
43 #define MPIC_BROKEN_FRR_NIRQS 0x00000800
44 +/* Destination only supports a single CPU at a time */
45 +#define MPIC_SINGLE_DEST_CPU 0x00001000
46
47 /* MPIC HW modification ID */
48 #define MPIC_REGSET_MASK 0xf0000000
49 diff --git a/arch/powerpc/platforms/85xx/mpc85xx_ds.c b/arch/powerpc/platforms/85xx/mpc85xx_ds.c
50 index 483b65c..613bf8c 100644
51 --- a/arch/powerpc/platforms/85xx/mpc85xx_ds.c
52 +++ b/arch/powerpc/platforms/85xx/mpc85xx_ds.c
53 @@ -78,7 +78,8 @@ void __init mpc85xx_ds_pic_init(void)
54
55 mpic = mpic_alloc(np, r.start,
56 MPIC_PRIMARY | MPIC_WANTS_RESET |
57 - MPIC_BIG_ENDIAN | MPIC_BROKEN_FRR_NIRQS,
58 + MPIC_BIG_ENDIAN | MPIC_BROKEN_FRR_NIRQS |
59 + MPIC_SINGLE_DEST_CPU,
60 0, 256, " OpenPIC ");
61 BUG_ON(mpic == NULL);
62 of_node_put(np);
63 diff --git a/arch/powerpc/platforms/86xx/pic.c b/arch/powerpc/platforms/86xx/pic.c
64 index 8881c5d..668275d 100644
65 --- a/arch/powerpc/platforms/86xx/pic.c
66 +++ b/arch/powerpc/platforms/86xx/pic.c
67 @@ -44,7 +44,8 @@ void __init mpc86xx_init_irq(void)
68
69 mpic = mpic_alloc(np, res.start,
70 MPIC_PRIMARY | MPIC_WANTS_RESET |
71 - MPIC_BIG_ENDIAN | MPIC_BROKEN_FRR_NIRQS,
72 + MPIC_BIG_ENDIAN | MPIC_BROKEN_FRR_NIRQS |
73 + MPIC_SINGLE_DEST_CPU,
74 0, 256, " MPIC ");
75 of_node_put(np);
76 BUG_ON(mpic == NULL);
77 diff --git a/arch/powerpc/sysdev/mpic.c b/arch/powerpc/sysdev/mpic.c
78 index 8e3478c..f6299cc 100644
79 --- a/arch/powerpc/sysdev/mpic.c
80 +++ b/arch/powerpc/sysdev/mpic.c
81 @@ -563,6 +563,51 @@ static void __init mpic_scan_ht_pics(struct mpic *mpic)
82
83 #endif /* CONFIG_MPIC_U3_HT_IRQS */
84
85 +#ifdef CONFIG_SMP
86 +static int irq_choose_cpu(unsigned int virt_irq)
87 +{
88 + cpumask_t mask = irq_desc[virt_irq].affinity;
89 + int cpuid;
90 +
91 + if (cpus_equal(mask, CPU_MASK_ALL)) {
92 + static int irq_rover;
93 + static DEFINE_SPINLOCK(irq_rover_lock);
94 + unsigned long flags;
95 +
96 + /* Round-robin distribution... */
97 + do_round_robin:
98 + spin_lock_irqsave(&irq_rover_lock, flags);
99 +
100 + while (!cpu_online(irq_rover)) {
101 + if (++irq_rover >= NR_CPUS)
102 + irq_rover = 0;
103 + }
104 + cpuid = irq_rover;
105 + do {
106 + if (++irq_rover >= NR_CPUS)
107 + irq_rover = 0;
108 + } while (!cpu_online(irq_rover));
109 +
110 + spin_unlock_irqrestore(&irq_rover_lock, flags);
111 + } else {
112 + cpumask_t tmp;
113 +
114 + cpus_and(tmp, cpu_online_map, mask);
115 +
116 + if (cpus_empty(tmp))
117 + goto do_round_robin;
118 +
119 + cpuid = first_cpu(tmp);
120 + }
121 +
122 + return cpuid;
123 +}
124 +#else
125 +static int irq_choose_cpu(unsigned int virt_irq)
126 +{
127 + return hard_smp_processor_id();
128 +}
129 +#endif
130
131 #define mpic_irq_to_hw(virq) ((unsigned int)irq_map[virq].hwirq)
132
133 @@ -777,12 +822,18 @@ void mpic_set_affinity(unsigned int irq, cpumask_t cpumask)
134 struct mpic *mpic = mpic_from_irq(irq);
135 unsigned int src = mpic_irq_to_hw(irq);
136
137 - cpumask_t tmp;
138 + if (mpic->flags & MPIC_SINGLE_DEST_CPU) {
139 + int cpuid = irq_choose_cpu(irq);
140
141 - cpus_and(tmp, cpumask, cpu_online_map);
142 + mpic_irq_write(src, MPIC_INFO(IRQ_DESTINATION), 1 << cpuid);
143 + } else {
144 + cpumask_t tmp;
145
146 - mpic_irq_write(src, MPIC_INFO(IRQ_DESTINATION),
147 - mpic_physmask(cpus_addr(tmp)[0]));
148 + cpus_and(tmp, cpumask, cpu_online_map);
149 +
150 + mpic_irq_write(src, MPIC_INFO(IRQ_DESTINATION),
151 + mpic_physmask(cpus_addr(tmp)[0]));
152 + }
153 }
154
155 static unsigned int mpic_type_to_vecpri(struct mpic *mpic, unsigned int type)
156 diff --git a/arch/s390/kernel/topology.c b/arch/s390/kernel/topology.c
157 index 632b13e..a947899 100644
158 --- a/arch/s390/kernel/topology.c
159 +++ b/arch/s390/kernel/topology.c
160 @@ -65,18 +65,21 @@ static int machine_has_topology_irq;
161 static struct timer_list topology_timer;
162 static void set_topology_timer(void);
163 static DECLARE_WORK(topology_work, topology_work_fn);
164 +/* topology_lock protects the core linked list */
165 +static DEFINE_SPINLOCK(topology_lock);
166
167 cpumask_t cpu_core_map[NR_CPUS];
168
169 cpumask_t cpu_coregroup_map(unsigned int cpu)
170 {
171 struct core_info *core = &core_info;
172 + unsigned long flags;
173 cpumask_t mask;
174
175 cpus_clear(mask);
176 if (!machine_has_topology)
177 return cpu_present_map;
178 - mutex_lock(&smp_cpu_state_mutex);
179 + spin_lock_irqsave(&topology_lock, flags);
180 while (core) {
181 if (cpu_isset(cpu, core->mask)) {
182 mask = core->mask;
183 @@ -84,7 +87,7 @@ cpumask_t cpu_coregroup_map(unsigned int cpu)
184 }
185 core = core->next;
186 }
187 - mutex_unlock(&smp_cpu_state_mutex);
188 + spin_unlock_irqrestore(&topology_lock, flags);
189 if (cpus_empty(mask))
190 mask = cpumask_of_cpu(cpu);
191 return mask;
192 @@ -133,7 +136,7 @@ static void tl_to_cores(struct tl_info *info)
193 union tl_entry *tle, *end;
194 struct core_info *core = &core_info;
195
196 - mutex_lock(&smp_cpu_state_mutex);
197 + spin_lock_irq(&topology_lock);
198 clear_cores();
199 tle = info->tle;
200 end = (union tl_entry *)((unsigned long)info + info->length);
201 @@ -157,7 +160,7 @@ static void tl_to_cores(struct tl_info *info)
202 }
203 tle = next_tle(tle);
204 }
205 - mutex_unlock(&smp_cpu_state_mutex);
206 + spin_unlock_irq(&topology_lock);
207 }
208
209 static void topology_update_polarization_simple(void)
210 diff --git a/block/blk-merge.c b/block/blk-merge.c
211 index 5efc9e7..857dce7 100644
212 --- a/block/blk-merge.c
213 +++ b/block/blk-merge.c
214 @@ -95,6 +95,9 @@ new_hw_segment:
215 nr_hw_segs++;
216 }
217
218 + if (nr_phys_segs == 1 && seg_size > rq->bio->bi_seg_front_size)
219 + rq->bio->bi_seg_front_size = seg_size;
220 +
221 nr_phys_segs++;
222 bvprv = bv;
223 seg_size = bv->bv_len;
224 @@ -106,6 +109,10 @@ new_hw_segment:
225 rq->bio->bi_hw_front_size = hw_seg_size;
226 if (hw_seg_size > rq->biotail->bi_hw_back_size)
227 rq->biotail->bi_hw_back_size = hw_seg_size;
228 + if (nr_phys_segs == 1 && seg_size > rq->bio->bi_seg_front_size)
229 + rq->bio->bi_seg_front_size = seg_size;
230 + if (seg_size > rq->biotail->bi_seg_back_size)
231 + rq->biotail->bi_seg_back_size = seg_size;
232 rq->nr_phys_segments = nr_phys_segs;
233 rq->nr_hw_segments = nr_hw_segs;
234 }
235 @@ -133,7 +140,8 @@ static int blk_phys_contig_segment(struct request_queue *q, struct bio *bio,
236
237 if (!BIOVEC_PHYS_MERGEABLE(__BVEC_END(bio), __BVEC_START(nxt)))
238 return 0;
239 - if (bio->bi_size + nxt->bi_size > q->max_segment_size)
240 + if (bio->bi_seg_back_size + nxt->bi_seg_front_size >
241 + q->max_segment_size)
242 return 0;
243
244 /*
245 @@ -377,6 +385,8 @@ static int ll_merge_requests_fn(struct request_queue *q, struct request *req,
246 {
247 int total_phys_segments;
248 int total_hw_segments;
249 + unsigned int seg_size =
250 + req->biotail->bi_seg_back_size + next->bio->bi_seg_front_size;
251
252 /*
253 * First check if the either of the requests are re-queued
254 @@ -392,8 +402,13 @@ static int ll_merge_requests_fn(struct request_queue *q, struct request *req,
255 return 0;
256
257 total_phys_segments = req->nr_phys_segments + next->nr_phys_segments;
258 - if (blk_phys_contig_segment(q, req->biotail, next->bio))
259 + if (blk_phys_contig_segment(q, req->biotail, next->bio)) {
260 + if (req->nr_phys_segments == 1)
261 + req->bio->bi_seg_front_size = seg_size;
262 + if (next->nr_phys_segments == 1)
263 + next->biotail->bi_seg_back_size = seg_size;
264 total_phys_segments--;
265 + }
266
267 if (total_phys_segments > q->max_phys_segments)
268 return 0;
269 diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c
270 index ccae305..c54f38e 100644
271 --- a/drivers/acpi/bus.c
272 +++ b/drivers/acpi/bus.c
273 @@ -95,21 +95,21 @@ int acpi_bus_get_status(struct acpi_device *device)
274 }
275
276 /*
277 - * Otherwise we assume the status of our parent (unless we don't
278 - * have one, in which case status is implied).
279 + * According to ACPI spec some device can be present and functional
280 + * even if the parent is not present but functional.
281 + * In such conditions the child device should not inherit the status
282 + * from the parent.
283 */
284 - else if (device->parent)
285 - device->status = device->parent->status;
286 else
287 STRUCT_TO_INT(device->status) =
288 ACPI_STA_DEVICE_PRESENT | ACPI_STA_DEVICE_ENABLED |
289 ACPI_STA_DEVICE_UI | ACPI_STA_DEVICE_FUNCTIONING;
290
291 if (device->status.functional && !device->status.present) {
292 - printk(KERN_WARNING PREFIX "Device [%s] status [%08x]: "
293 - "functional but not present; setting present\n",
294 - device->pnp.bus_id, (u32) STRUCT_TO_INT(device->status));
295 - device->status.present = 1;
296 + ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device [%s] status [%08x]: "
297 + "functional but not present;\n",
298 + device->pnp.bus_id,
299 + (u32) STRUCT_TO_INT(device->status)));
300 }
301
302 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device [%s] status [%08x]\n",
303 diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
304 index 444cd9e..41b8e7c 100644
305 --- a/drivers/acpi/ec.c
306 +++ b/drivers/acpi/ec.c
307 @@ -70,7 +70,7 @@ enum ec_command {
308 #define ACPI_EC_UDELAY_GLK 1000 /* Wait 1ms max. to get global lock */
309 #define ACPI_EC_UDELAY 100 /* Wait 100us before polling EC again */
310
311 -#define ACPI_EC_STORM_THRESHOLD 20 /* number of false interrupts
312 +#define ACPI_EC_STORM_THRESHOLD 8 /* number of false interrupts
313 per one transaction */
314
315 enum {
316 @@ -100,8 +100,11 @@ struct transaction {
317 u8 *rdata;
318 unsigned short irq_count;
319 u8 command;
320 + u8 wi;
321 + u8 ri;
322 u8 wlen;
323 u8 rlen;
324 + bool done;
325 };
326
327 static struct acpi_ec {
328 @@ -178,34 +181,45 @@ static int ec_transaction_done(struct acpi_ec *ec)
329 unsigned long flags;
330 int ret = 0;
331 spin_lock_irqsave(&ec->curr_lock, flags);
332 - if (!ec->curr || (!ec->curr->wlen && !ec->curr->rlen))
333 + if (!ec->curr || ec->curr->done)
334 ret = 1;
335 spin_unlock_irqrestore(&ec->curr_lock, flags);
336 return ret;
337 }
338
339 +static void start_transaction(struct acpi_ec *ec)
340 +{
341 + ec->curr->irq_count = ec->curr->wi = ec->curr->ri = 0;
342 + ec->curr->done = false;
343 + acpi_ec_write_cmd(ec, ec->curr->command);
344 +}
345 +
346 static void gpe_transaction(struct acpi_ec *ec, u8 status)
347 {
348 unsigned long flags;
349 spin_lock_irqsave(&ec->curr_lock, flags);
350 if (!ec->curr)
351 goto unlock;
352 - if (ec->curr->wlen > 0) {
353 - if ((status & ACPI_EC_FLAG_IBF) == 0) {
354 - acpi_ec_write_data(ec, *(ec->curr->wdata++));
355 - --ec->curr->wlen;
356 - } else
357 - /* false interrupt, state didn't change */
358 - ++ec->curr->irq_count;
359 -
360 - } else if (ec->curr->rlen > 0) {
361 + if (ec->curr->wlen > ec->curr->wi) {
362 + if ((status & ACPI_EC_FLAG_IBF) == 0)
363 + acpi_ec_write_data(ec,
364 + ec->curr->wdata[ec->curr->wi++]);
365 + else
366 + goto err;
367 + } else if (ec->curr->rlen > ec->curr->ri) {
368 if ((status & ACPI_EC_FLAG_OBF) == 1) {
369 - *(ec->curr->rdata++) = acpi_ec_read_data(ec);
370 - --ec->curr->rlen;
371 + ec->curr->rdata[ec->curr->ri++] = acpi_ec_read_data(ec);
372 + if (ec->curr->rlen == ec->curr->ri)
373 + ec->curr->done = true;
374 } else
375 - /* false interrupt, state didn't change */
376 - ++ec->curr->irq_count;
377 - }
378 + goto err;
379 + } else if (ec->curr->wlen == ec->curr->wi &&
380 + (status & ACPI_EC_FLAG_IBF) == 0)
381 + ec->curr->done = true;
382 + goto unlock;
383 +err:
384 + /* false interrupt, state didn't change */
385 + ++ec->curr->irq_count;
386 unlock:
387 spin_unlock_irqrestore(&ec->curr_lock, flags);
388 }
389 @@ -215,6 +229,15 @@ static int acpi_ec_wait(struct acpi_ec *ec)
390 if (wait_event_timeout(ec->wait, ec_transaction_done(ec),
391 msecs_to_jiffies(ACPI_EC_DELAY)))
392 return 0;
393 + /* try restart command if we get any false interrupts */
394 + if (ec->curr->irq_count &&
395 + (acpi_ec_read_status(ec) & ACPI_EC_FLAG_IBF) == 0) {
396 + pr_debug(PREFIX "controller reset, restart transaction\n");
397 + start_transaction(ec);
398 + if (wait_event_timeout(ec->wait, ec_transaction_done(ec),
399 + msecs_to_jiffies(ACPI_EC_DELAY)))
400 + return 0;
401 + }
402 /* missing GPEs, switch back to poll mode */
403 if (printk_ratelimit())
404 pr_info(PREFIX "missing confirmations, "
405 @@ -239,10 +262,10 @@ static int ec_check_sci(struct acpi_ec *ec, u8 state)
406 static int ec_poll(struct acpi_ec *ec)
407 {
408 unsigned long delay = jiffies + msecs_to_jiffies(ACPI_EC_DELAY);
409 - msleep(1);
410 + udelay(ACPI_EC_UDELAY);
411 while (time_before(jiffies, delay)) {
412 gpe_transaction(ec, acpi_ec_read_status(ec));
413 - msleep(1);
414 + udelay(ACPI_EC_UDELAY);
415 if (ec_transaction_done(ec))
416 return 0;
417 }
418 @@ -264,9 +287,8 @@ static int acpi_ec_transaction_unlocked(struct acpi_ec *ec,
419 /* start transaction */
420 spin_lock_irqsave(&ec->curr_lock, tmp);
421 /* following two actions should be kept atomic */
422 - t->irq_count = 0;
423 ec->curr = t;
424 - acpi_ec_write_cmd(ec, ec->curr->command);
425 + start_transaction(ec);
426 if (ec->curr->command == ACPI_EC_COMMAND_QUERY)
427 clear_bit(EC_FLAGS_QUERY_PENDING, &ec->flags);
428 spin_unlock_irqrestore(&ec->curr_lock, tmp);
429 @@ -286,7 +308,8 @@ static int acpi_ec_transaction_unlocked(struct acpi_ec *ec,
430 acpi_enable_gpe(NULL, ec->gpe, ACPI_NOT_ISR);
431 } else if (test_bit(EC_FLAGS_GPE_MODE, &ec->flags) &&
432 t->irq_count > ACPI_EC_STORM_THRESHOLD) {
433 - pr_debug(PREFIX "GPE storm detected\n");
434 + pr_info(PREFIX "GPE storm detected, "
435 + "transactions will use polling mode\n");
436 set_bit(EC_FLAGS_GPE_STORM, &ec->flags);
437 }
438 return ret;
439 @@ -558,17 +581,26 @@ static u32 acpi_ec_gpe_handler(void *data)
440 pr_debug(PREFIX "~~~> interrupt\n");
441 status = acpi_ec_read_status(ec);
442
443 - gpe_transaction(ec, status);
444 - if (ec_transaction_done(ec) && (status & ACPI_EC_FLAG_IBF) == 0)
445 - wake_up(&ec->wait);
446 + if (test_bit(EC_FLAGS_GPE_MODE, &ec->flags)) {
447 + gpe_transaction(ec, status);
448 + if (ec_transaction_done(ec) &&
449 + (status & ACPI_EC_FLAG_IBF) == 0)
450 + wake_up(&ec->wait);
451 + }
452
453 ec_check_sci(ec, status);
454 if (!test_bit(EC_FLAGS_GPE_MODE, &ec->flags) &&
455 !test_bit(EC_FLAGS_NO_GPE, &ec->flags)) {
456 /* this is non-query, must be confirmation */
457 - if (printk_ratelimit())
458 - pr_info(PREFIX "non-query interrupt received,"
459 + if (!test_bit(EC_FLAGS_GPE_STORM, &ec->flags)) {
460 + if (printk_ratelimit())
461 + pr_info(PREFIX "non-query interrupt received,"
462 + " switching to interrupt mode\n");
463 + } else {
464 + /* hush, STORM switches the mode every transaction */
465 + pr_debug(PREFIX "non-query interrupt received,"
466 " switching to interrupt mode\n");
467 + }
468 set_bit(EC_FLAGS_GPE_MODE, &ec->flags);
469 }
470 return ACPI_INTERRUPT_HANDLED;
471 diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
472 index f6f52c1..0450761 100644
473 --- a/drivers/acpi/scan.c
474 +++ b/drivers/acpi/scan.c
475 @@ -276,6 +276,13 @@ int acpi_match_device_ids(struct acpi_device *device,
476 {
477 const struct acpi_device_id *id;
478
479 + /*
480 + * If the device is not present, it is unnecessary to load device
481 + * driver for it.
482 + */
483 + if (!device->status.present)
484 + return -ENODEV;
485 +
486 if (device->flags.hardware_id) {
487 for (id = ids; id->id[0]; id++) {
488 if (!strcmp((char*)id->id, device->pnp.hardware_id))
489 @@ -1221,15 +1228,18 @@ acpi_add_single_object(struct acpi_device **child,
490 result = -ENODEV;
491 goto end;
492 }
493 - if (!device->status.present) {
494 - /* Bay and dock should be handled even if absent */
495 - if (!ACPI_SUCCESS(
496 - acpi_is_child_device(device, acpi_bay_match)) &&
497 - !ACPI_SUCCESS(
498 - acpi_is_child_device(device, acpi_dock_match))) {
499 - result = -ENODEV;
500 - goto end;
501 - }
502 + /*
503 + * When the device is neither present nor functional, the
504 + * device should not be added to Linux ACPI device tree.
505 + * When the status of the device is not present but functinal,
506 + * it should be added to Linux ACPI tree. For example : bay
507 + * device , dock device.
508 + * In such conditions it is unncessary to check whether it is
509 + * bay device or dock device.
510 + */
511 + if (!device->status.present && !device->status.functional) {
512 + result = -ENODEV;
513 + goto end;
514 }
515 break;
516 default:
517 @@ -1402,7 +1412,12 @@ static int acpi_bus_scan(struct acpi_device *start, struct acpi_bus_ops *ops)
518 * TBD: Need notifications and other detection mechanisms
519 * in place before we can fully implement this.
520 */
521 - if (child->status.present) {
522 + /*
523 + * When the device is not present but functional, it is also
524 + * necessary to scan the children of this device.
525 + */
526 + if (child->status.present || (!child->status.present &&
527 + child->status.functional)) {
528 status = acpi_get_next_object(ACPI_TYPE_ANY, chandle,
529 NULL, NULL);
530 if (ACPI_SUCCESS(status)) {
531 diff --git a/drivers/acpi/system.c b/drivers/acpi/system.c
532 index 91dec44..4745792 100644
533 --- a/drivers/acpi/system.c
534 +++ b/drivers/acpi/system.c
535 @@ -78,9 +78,15 @@ static ssize_t acpi_table_show(struct kobject *kobj,
536 container_of(bin_attr, struct acpi_table_attr, attr);
537 struct acpi_table_header *table_header = NULL;
538 acpi_status status;
539 + char name[ACPI_NAME_SIZE];
540 +
541 + if (strncmp(table_attr->name, "NULL", 4))
542 + memcpy(name, table_attr->name, ACPI_NAME_SIZE);
543 + else
544 + memcpy(name, "\0\0\0\0", 4);
545
546 status =
547 - acpi_get_table(table_attr->name, table_attr->instance,
548 + acpi_get_table(name, table_attr->instance,
549 &table_header);
550 if (ACPI_FAILURE(status))
551 return -ENODEV;
552 @@ -95,21 +101,24 @@ static void acpi_table_attr_init(struct acpi_table_attr *table_attr,
553 struct acpi_table_header *header = NULL;
554 struct acpi_table_attr *attr = NULL;
555
556 - memcpy(table_attr->name, table_header->signature, ACPI_NAME_SIZE);
557 + if (table_header->signature[0] != '\0')
558 + memcpy(table_attr->name, table_header->signature,
559 + ACPI_NAME_SIZE);
560 + else
561 + memcpy(table_attr->name, "NULL", 4);
562
563 list_for_each_entry(attr, &acpi_table_attr_list, node) {
564 - if (!memcmp(table_header->signature, attr->name,
565 - ACPI_NAME_SIZE))
566 + if (!memcmp(table_attr->name, attr->name, ACPI_NAME_SIZE))
567 if (table_attr->instance < attr->instance)
568 table_attr->instance = attr->instance;
569 }
570 table_attr->instance++;
571
572 if (table_attr->instance > 1 || (table_attr->instance == 1 &&
573 - !acpi_get_table(table_header->
574 - signature, 2,
575 - &header)))
576 - sprintf(table_attr->name + 4, "%d", table_attr->instance);
577 + !acpi_get_table
578 + (table_header->signature, 2, &header)))
579 + sprintf(table_attr->name + ACPI_NAME_SIZE, "%d",
580 + table_attr->instance);
581
582 table_attr->attr.size = 0;
583 table_attr->attr.read = acpi_table_show;
584 diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c
585 index 8a59aaa..7a88dfd 100644
586 --- a/drivers/char/ipmi/ipmi_msghandler.c
587 +++ b/drivers/char/ipmi/ipmi_msghandler.c
588 @@ -422,9 +422,11 @@ struct ipmi_smi {
589 /**
590 * The driver model view of the IPMI messaging driver.
591 */
592 -static struct device_driver ipmidriver = {
593 - .name = "ipmi",
594 - .bus = &platform_bus_type
595 +static struct platform_driver ipmidriver = {
596 + .driver = {
597 + .name = "ipmi",
598 + .bus = &platform_bus_type
599 + }
600 };
601 static DEFINE_MUTEX(ipmidriver_mutex);
602
603 @@ -2384,9 +2386,9 @@ static int ipmi_bmc_register(ipmi_smi_t intf, int ifnum,
604 * representing the interfaced BMC already
605 */
606 if (bmc->guid_set)
607 - old_bmc = ipmi_find_bmc_guid(&ipmidriver, bmc->guid);
608 + old_bmc = ipmi_find_bmc_guid(&ipmidriver.driver, bmc->guid);
609 else
610 - old_bmc = ipmi_find_bmc_prod_dev_id(&ipmidriver,
611 + old_bmc = ipmi_find_bmc_prod_dev_id(&ipmidriver.driver,
612 bmc->id.product_id,
613 bmc->id.device_id);
614
615 @@ -2416,7 +2418,7 @@ static int ipmi_bmc_register(ipmi_smi_t intf, int ifnum,
616 snprintf(name, sizeof(name),
617 "ipmi_bmc.%4.4x", bmc->id.product_id);
618
619 - while (ipmi_find_bmc_prod_dev_id(&ipmidriver,
620 + while (ipmi_find_bmc_prod_dev_id(&ipmidriver.driver,
621 bmc->id.product_id,
622 bmc->id.device_id)) {
623 if (!warn_printed) {
624 @@ -2446,7 +2448,7 @@ static int ipmi_bmc_register(ipmi_smi_t intf, int ifnum,
625 " Unable to allocate platform device\n");
626 return -ENOMEM;
627 }
628 - bmc->dev->dev.driver = &ipmidriver;
629 + bmc->dev->dev.driver = &ipmidriver.driver;
630 dev_set_drvdata(&bmc->dev->dev, bmc);
631 kref_init(&bmc->refcount);
632
633 @@ -4247,7 +4249,7 @@ static int ipmi_init_msghandler(void)
634 if (initialized)
635 return 0;
636
637 - rv = driver_register(&ipmidriver);
638 + rv = driver_register(&ipmidriver.driver);
639 if (rv) {
640 printk(KERN_ERR PFX "Could not register IPMI driver\n");
641 return rv;
642 @@ -4308,7 +4310,7 @@ static __exit void cleanup_ipmi(void)
643 remove_proc_entry(proc_ipmi_root->name, NULL);
644 #endif /* CONFIG_PROC_FS */
645
646 - driver_unregister(&ipmidriver);
647 + driver_unregister(&ipmidriver.driver);
648
649 initialized = 0;
650
651 diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c
652 index 8e8afb6..7e860da 100644
653 --- a/drivers/char/ipmi/ipmi_si_intf.c
654 +++ b/drivers/char/ipmi/ipmi_si_intf.c
655 @@ -114,9 +114,11 @@ static char *si_to_str[] = { "kcs", "smic", "bt" };
656
657 #define DEVICE_NAME "ipmi_si"
658
659 -static struct device_driver ipmi_driver = {
660 - .name = DEVICE_NAME,
661 - .bus = &platform_bus_type
662 +static struct platform_driver ipmi_driver = {
663 + .driver = {
664 + .name = DEVICE_NAME,
665 + .bus = &platform_bus_type
666 + }
667 };
668
669
670 @@ -2868,7 +2870,7 @@ static int try_smi_init(struct smi_info *new_smi)
671 goto out_err;
672 }
673 new_smi->dev = &new_smi->pdev->dev;
674 - new_smi->dev->driver = &ipmi_driver;
675 + new_smi->dev->driver = &ipmi_driver.driver;
676
677 rv = platform_device_add(new_smi->pdev);
678 if (rv) {
679 @@ -2983,7 +2985,7 @@ static __devinit int init_ipmi_si(void)
680 initialized = 1;
681
682 /* Register the device drivers. */
683 - rv = driver_register(&ipmi_driver);
684 + rv = driver_register(&ipmi_driver.driver);
685 if (rv) {
686 printk(KERN_ERR
687 "init_ipmi_si: Unable to register driver: %d\n",
688 @@ -3052,7 +3054,7 @@ static __devinit int init_ipmi_si(void)
689 #ifdef CONFIG_PPC_OF
690 of_unregister_platform_driver(&ipmi_of_platform_driver);
691 #endif
692 - driver_unregister(&ipmi_driver);
693 + driver_unregister(&ipmi_driver.driver);
694 printk(KERN_WARNING
695 "ipmi_si: Unable to find any System Interface(s)\n");
696 return -ENODEV;
697 @@ -3151,7 +3153,7 @@ static __exit void cleanup_ipmi_si(void)
698 cleanup_one_si(e);
699 mutex_unlock(&smi_infos_lock);
700
701 - driver_unregister(&ipmi_driver);
702 + driver_unregister(&ipmi_driver.driver);
703 }
704 module_exit(cleanup_ipmi_si);
705
706 diff --git a/drivers/hwmon/ibmaem.c b/drivers/hwmon/ibmaem.c
707 index 0f70dc2..7e909e8 100644
708 --- a/drivers/hwmon/ibmaem.c
709 +++ b/drivers/hwmon/ibmaem.c
710 @@ -88,9 +88,11 @@
711 static DEFINE_IDR(aem_idr);
712 static DEFINE_SPINLOCK(aem_idr_lock);
713
714 -static struct device_driver aem_driver = {
715 - .name = DRVNAME,
716 - .bus = &platform_bus_type,
717 +static struct platform_driver aem_driver = {
718 + .driver = {
719 + .name = DRVNAME,
720 + .bus = &platform_bus_type,
721 + }
722 };
723
724 struct aem_ipmi_data {
725 @@ -583,7 +585,7 @@ static int aem_init_aem1_inst(struct aem_ipmi_data *probe, u8 module_handle)
726 data->pdev = platform_device_alloc(DRVNAME, data->id);
727 if (!data->pdev)
728 goto dev_err;
729 - data->pdev->dev.driver = &aem_driver;
730 + data->pdev->dev.driver = &aem_driver.driver;
731
732 res = platform_device_add(data->pdev);
733 if (res)
734 @@ -716,7 +718,7 @@ static int aem_init_aem2_inst(struct aem_ipmi_data *probe,
735 data->pdev = platform_device_alloc(DRVNAME, data->id);
736 if (!data->pdev)
737 goto dev_err;
738 - data->pdev->dev.driver = &aem_driver;
739 + data->pdev->dev.driver = &aem_driver.driver;
740
741 res = platform_device_add(data->pdev);
742 if (res)
743 @@ -1085,7 +1087,7 @@ static int __init aem_init(void)
744 {
745 int res;
746
747 - res = driver_register(&aem_driver);
748 + res = driver_register(&aem_driver.driver);
749 if (res) {
750 printk(KERN_ERR "Can't register aem driver\n");
751 return res;
752 @@ -1097,7 +1099,7 @@ static int __init aem_init(void)
753 return 0;
754
755 ipmi_reg_err:
756 - driver_unregister(&aem_driver);
757 + driver_unregister(&aem_driver.driver);
758 return res;
759
760 }
761 @@ -1107,7 +1109,7 @@ static void __exit aem_exit(void)
762 struct aem_data *p1, *next1;
763
764 ipmi_smi_watcher_unregister(&driver_data.bmc_events);
765 - driver_unregister(&aem_driver);
766 + driver_unregister(&aem_driver.driver);
767 list_for_each_entry_safe(p1, next1, &driver_data.aem_devices, list)
768 aem_delete(p1);
769 }
770 diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c
771 index 385e32b..cbedf95 100644
772 --- a/drivers/input/mouse/alps.c
773 +++ b/drivers/input/mouse/alps.c
774 @@ -54,6 +54,7 @@ static const struct alps_model_info alps_model_data[] = {
775 { { 0x20, 0x02, 0x0e }, 0xf8, 0xf8, ALPS_PASS | ALPS_DUALPOINT }, /* XXX */
776 { { 0x22, 0x02, 0x0a }, 0xf8, 0xf8, ALPS_PASS | ALPS_DUALPOINT },
777 { { 0x22, 0x02, 0x14 }, 0xff, 0xff, ALPS_PASS | ALPS_DUALPOINT }, /* Dell Latitude D600 */
778 + { { 0x62, 0x02, 0x14 }, 0xcf, 0xcf, ALPS_PASS | ALPS_DUALPOINT }, /* Dell Latitude E6500 */
779 { { 0x73, 0x02, 0x50 }, 0xcf, 0xcf, ALPS_FW_BK_1 } /* Dell Vostro 1400 */
780 };
781
782 diff --git a/drivers/md/dm-raid1.c b/drivers/md/dm-raid1.c
783 index ff05fe8..97ef945 100644
784 --- a/drivers/md/dm-raid1.c
785 +++ b/drivers/md/dm-raid1.c
786 @@ -1598,6 +1598,7 @@ static void mirror_dtr(struct dm_target *ti)
787
788 del_timer_sync(&ms->timer);
789 flush_workqueue(ms->kmirrord_wq);
790 + flush_scheduled_work();
791 dm_kcopyd_client_destroy(ms->kcopyd_client);
792 destroy_workqueue(ms->kmirrord_wq);
793 free_context(ms, ti, ms->nr_mirrors);
794 diff --git a/drivers/media/video/tvaudio.c b/drivers/media/video/tvaudio.c
795 index b59e472..d74df58 100644
796 --- a/drivers/media/video/tvaudio.c
797 +++ b/drivers/media/video/tvaudio.c
798 @@ -1576,13 +1576,13 @@ static int tvaudio_get_ctrl(struct CHIPSTATE *chip,
799 return 0;
800 }
801 case V4L2_CID_AUDIO_BASS:
802 - if (desc->flags & CHIP_HAS_BASSTREBLE)
803 + if (!(desc->flags & CHIP_HAS_BASSTREBLE))
804 break;
805 ctrl->value = chip->bass;
806 return 0;
807 case V4L2_CID_AUDIO_TREBLE:
808 - if (desc->flags & CHIP_HAS_BASSTREBLE)
809 - return -EINVAL;
810 + if (!(desc->flags & CHIP_HAS_BASSTREBLE))
811 + break;
812 ctrl->value = chip->treble;
813 return 0;
814 }
815 @@ -1642,16 +1642,15 @@ static int tvaudio_set_ctrl(struct CHIPSTATE *chip,
816 return 0;
817 }
818 case V4L2_CID_AUDIO_BASS:
819 - if (desc->flags & CHIP_HAS_BASSTREBLE)
820 + if (!(desc->flags & CHIP_HAS_BASSTREBLE))
821 break;
822 chip->bass = ctrl->value;
823 chip_write(chip,desc->bassreg,desc->bassfunc(chip->bass));
824
825 return 0;
826 case V4L2_CID_AUDIO_TREBLE:
827 - if (desc->flags & CHIP_HAS_BASSTREBLE)
828 - return -EINVAL;
829 -
830 + if (!(desc->flags & CHIP_HAS_BASSTREBLE))
831 + break;
832 chip->treble = ctrl->value;
833 chip_write(chip,desc->treblereg,desc->treblefunc(chip->treble));
834
835 @@ -1695,7 +1694,7 @@ static int chip_command(struct i2c_client *client,
836 break;
837 case V4L2_CID_AUDIO_BASS:
838 case V4L2_CID_AUDIO_TREBLE:
839 - if (desc->flags & CHIP_HAS_BASSTREBLE)
840 + if (!(desc->flags & CHIP_HAS_BASSTREBLE))
841 return -EINVAL;
842 break;
843 default:
844 diff --git a/drivers/misc/sony-laptop.c b/drivers/misc/sony-laptop.c
845 index 60775be..b35eb92 100644
846 --- a/drivers/misc/sony-laptop.c
847 +++ b/drivers/misc/sony-laptop.c
848 @@ -2315,8 +2315,10 @@ end:
849 */
850 static int sony_pic_disable(struct acpi_device *device)
851 {
852 - if (ACPI_FAILURE(acpi_evaluate_object(device->handle,
853 - "_DIS", NULL, NULL)))
854 + acpi_status ret = acpi_evaluate_object(device->handle, "_DIS", NULL,
855 + NULL);
856 +
857 + if (ACPI_FAILURE(ret) && ret != AE_NOT_FOUND)
858 return -ENXIO;
859
860 dprintk("Device disabled\n");
861 diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
862 index 4a11296..60a0453 100644
863 --- a/drivers/net/Kconfig
864 +++ b/drivers/net/Kconfig
865 @@ -2046,6 +2046,7 @@ config R8169
866 tristate "Realtek 8169 gigabit ethernet support"
867 depends on PCI
868 select CRC32
869 + select MII
870 ---help---
871 Say Y here if you have a Realtek 8169 PCI Gigabit Ethernet adapter.
872
873 diff --git a/drivers/net/bnx2x_init.h b/drivers/net/bnx2x_init.h
874 index 130927c..a6c0b3a 100644
875 --- a/drivers/net/bnx2x_init.h
876 +++ b/drivers/net/bnx2x_init.h
877 @@ -564,14 +564,15 @@ static const struct arb_line write_arb_addr[NUM_WR_Q-1] = {
878
879 static void bnx2x_init_pxp(struct bnx2x *bp)
880 {
881 + u16 devctl;
882 int r_order, w_order;
883 u32 val, i;
884
885 pci_read_config_word(bp->pdev,
886 - bp->pcie_cap + PCI_EXP_DEVCTL, (u16 *)&val);
887 - DP(NETIF_MSG_HW, "read 0x%x from devctl\n", (u16)val);
888 - w_order = ((val & PCI_EXP_DEVCTL_PAYLOAD) >> 5);
889 - r_order = ((val & PCI_EXP_DEVCTL_READRQ) >> 12);
890 + bp->pcie_cap + PCI_EXP_DEVCTL, &devctl);
891 + DP(NETIF_MSG_HW, "read 0x%x from devctl\n", devctl);
892 + w_order = ((devctl & PCI_EXP_DEVCTL_PAYLOAD) >> 5);
893 + r_order = ((devctl & PCI_EXP_DEVCTL_READRQ) >> 12);
894
895 if (r_order > MAX_RD_ORD) {
896 DP(NETIF_MSG_HW, "read order of %d order adjusted to %d\n",
897 diff --git a/drivers/net/bnx2x_main.c b/drivers/net/bnx2x_main.c
898 index a8eb3c4..53459db 100644
899 --- a/drivers/net/bnx2x_main.c
900 +++ b/drivers/net/bnx2x_main.c
901 @@ -6480,6 +6480,7 @@ load_int_disable:
902 bnx2x_free_irq(bp);
903 load_error:
904 bnx2x_free_mem(bp);
905 + bp->port.pmf = 0;
906
907 /* TBD we really need to reset the chip
908 if we want to recover from this */
909 @@ -6790,6 +6791,7 @@ unload_error:
910 /* Report UNLOAD_DONE to MCP */
911 if (!BP_NOMCP(bp))
912 bnx2x_fw_command(bp, DRV_MSG_CODE_UNLOAD_DONE);
913 + bp->port.pmf = 0;
914
915 /* Free SKBs, SGEs, TPA pool and driver internals */
916 bnx2x_free_skbs(bp);
917 @@ -10203,8 +10205,6 @@ static int __devinit bnx2x_init_one(struct pci_dev *pdev,
918 return -ENOMEM;
919 }
920
921 - netif_carrier_off(dev);
922 -
923 bp = netdev_priv(dev);
924 bp->msglevel = debug;
925
926 @@ -10228,6 +10228,8 @@ static int __devinit bnx2x_init_one(struct pci_dev *pdev,
927 goto init_one_exit;
928 }
929
930 + netif_carrier_off(dev);
931 +
932 bp->common.name = board_info[ent->driver_data].name;
933 printk(KERN_INFO "%s: %s (%c%d) PCI-E x%d %s found at mem %lx,"
934 " IRQ %d, ", dev->name, bp->common.name,
935 diff --git a/drivers/net/wireless/ath5k/base.c b/drivers/net/wireless/ath5k/base.c
936 index 0676c6d..a225827 100644
937 --- a/drivers/net/wireless/ath5k/base.c
938 +++ b/drivers/net/wireless/ath5k/base.c
939 @@ -294,9 +294,9 @@ static inline u64 ath5k_extend_tsf(struct ath5k_hw *ah, u32 rstamp)
940 }
941
942 /* Interrupt handling */
943 -static int ath5k_init(struct ath5k_softc *sc);
944 +static int ath5k_init(struct ath5k_softc *sc, bool is_resume);
945 static int ath5k_stop_locked(struct ath5k_softc *sc);
946 -static int ath5k_stop_hw(struct ath5k_softc *sc);
947 +static int ath5k_stop_hw(struct ath5k_softc *sc, bool is_suspend);
948 static irqreturn_t ath5k_intr(int irq, void *dev_id);
949 static void ath5k_tasklet_reset(unsigned long data);
950
951 @@ -584,7 +584,7 @@ ath5k_pci_suspend(struct pci_dev *pdev, pm_message_t state)
952
953 ath5k_led_off(sc);
954
955 - ath5k_stop_hw(sc);
956 + ath5k_stop_hw(sc, true);
957
958 free_irq(pdev->irq, sc);
959 pci_save_state(pdev);
960 @@ -599,8 +599,7 @@ ath5k_pci_resume(struct pci_dev *pdev)
961 {
962 struct ieee80211_hw *hw = pci_get_drvdata(pdev);
963 struct ath5k_softc *sc = hw->priv;
964 - struct ath5k_hw *ah = sc->ah;
965 - int i, err;
966 + int err;
967
968 pci_restore_state(pdev);
969
970 @@ -621,21 +620,11 @@ ath5k_pci_resume(struct pci_dev *pdev)
971 goto err_no_irq;
972 }
973
974 - err = ath5k_init(sc);
975 + err = ath5k_init(sc, true);
976 if (err)
977 goto err_irq;
978 ath5k_led_enable(sc);
979
980 - /*
981 - * Reset the key cache since some parts do not
982 - * reset the contents on initial power up or resume.
983 - *
984 - * FIXME: This may need to be revisited when mac80211 becomes
985 - * aware of suspend/resume.
986 - */
987 - for (i = 0; i < AR5K_KEYTABLE_SIZE; i++)
988 - ath5k_hw_reset_key(ah, i);
989 -
990 return 0;
991 err_irq:
992 free_irq(pdev->irq, sc);
993 @@ -657,7 +646,6 @@ ath5k_attach(struct pci_dev *pdev, struct ieee80211_hw *hw)
994 struct ath5k_softc *sc = hw->priv;
995 struct ath5k_hw *ah = sc->ah;
996 u8 mac[ETH_ALEN];
997 - unsigned int i;
998 int ret;
999
1000 ATH5K_DBG(sc, ATH5K_DEBUG_ANY, "devid 0x%x\n", pdev->device);
1001 @@ -676,13 +664,6 @@ ath5k_attach(struct pci_dev *pdev, struct ieee80211_hw *hw)
1002 __set_bit(ATH_STAT_MRRETRY, sc->status);
1003
1004 /*
1005 - * Reset the key cache since some parts do not
1006 - * reset the contents on initial power up.
1007 - */
1008 - for (i = 0; i < AR5K_KEYTABLE_SIZE; i++)
1009 - ath5k_hw_reset_key(ah, i);
1010 -
1011 - /*
1012 * Collect the channel list. The 802.11 layer
1013 * is resposible for filtering this list based
1014 * on settings like the phy mode and regulatory
1015 @@ -2197,12 +2178,18 @@ ath5k_beacon_config(struct ath5k_softc *sc)
1016 \********************/
1017
1018 static int
1019 -ath5k_init(struct ath5k_softc *sc)
1020 +ath5k_init(struct ath5k_softc *sc, bool is_resume)
1021 {
1022 - int ret;
1023 + struct ath5k_hw *ah = sc->ah;
1024 + int ret, i;
1025
1026 mutex_lock(&sc->lock);
1027
1028 + if (is_resume && !test_bit(ATH_STAT_STARTED, sc->status))
1029 + goto out_ok;
1030 +
1031 + __clear_bit(ATH_STAT_STARTED, sc->status);
1032 +
1033 ATH5K_DBG(sc, ATH5K_DEBUG_RESET, "mode %d\n", sc->opmode);
1034
1035 /*
1036 @@ -2220,7 +2207,7 @@ ath5k_init(struct ath5k_softc *sc)
1037 */
1038 sc->curchan = sc->hw->conf.channel;
1039 sc->curband = &sc->sbands[sc->curchan->band];
1040 - ret = ath5k_hw_reset(sc->ah, sc->opmode, sc->curchan, false);
1041 + ret = ath5k_hw_reset(ah, sc->opmode, sc->curchan, false);
1042 if (ret) {
1043 ATH5K_ERR(sc, "unable to reset hardware: %d\n", ret);
1044 goto done;
1045 @@ -2229,7 +2216,14 @@ ath5k_init(struct ath5k_softc *sc)
1046 * This is needed only to setup initial state
1047 * but it's best done after a reset.
1048 */
1049 - ath5k_hw_set_txpower_limit(sc->ah, 0);
1050 + ath5k_hw_set_txpower_limit(ah, 0);
1051 +
1052 + /*
1053 + * Reset the key cache since some parts do not reset the
1054 + * contents on initial power up or resume from suspend.
1055 + */
1056 + for (i = 0; i < AR5K_KEYTABLE_SIZE; i++)
1057 + ath5k_hw_reset_key(ah, i);
1058
1059 /*
1060 * Setup the hardware after reset: the key cache
1061 @@ -2249,13 +2243,17 @@ ath5k_init(struct ath5k_softc *sc)
1062 AR5K_INT_RXORN | AR5K_INT_FATAL | AR5K_INT_GLOBAL |
1063 AR5K_INT_MIB;
1064
1065 - ath5k_hw_set_intr(sc->ah, sc->imask);
1066 + ath5k_hw_set_intr(ah, sc->imask);
1067 +
1068 + __set_bit(ATH_STAT_STARTED, sc->status);
1069 +
1070 /* Set ack to be sent at low bit-rates */
1071 - ath5k_hw_set_ack_bitrate_high(sc->ah, false);
1072 + ath5k_hw_set_ack_bitrate_high(ah, false);
1073
1074 mod_timer(&sc->calib_tim, round_jiffies(jiffies +
1075 msecs_to_jiffies(ath5k_calinterval * 1000)));
1076
1077 +out_ok:
1078 ret = 0;
1079 done:
1080 mmiowb();
1081 @@ -2310,7 +2308,7 @@ ath5k_stop_locked(struct ath5k_softc *sc)
1082 * stop is preempted).
1083 */
1084 static int
1085 -ath5k_stop_hw(struct ath5k_softc *sc)
1086 +ath5k_stop_hw(struct ath5k_softc *sc, bool is_suspend)
1087 {
1088 int ret;
1089
1090 @@ -2341,6 +2339,9 @@ ath5k_stop_hw(struct ath5k_softc *sc)
1091 }
1092 }
1093 ath5k_txbuf_free(sc, sc->bbuf);
1094 + if (!is_suspend)
1095 + __clear_bit(ATH_STAT_STARTED, sc->status);
1096 +
1097 mmiowb();
1098 mutex_unlock(&sc->lock);
1099
1100 @@ -2719,12 +2720,12 @@ err:
1101
1102 static int ath5k_start(struct ieee80211_hw *hw)
1103 {
1104 - return ath5k_init(hw->priv);
1105 + return ath5k_init(hw->priv, false);
1106 }
1107
1108 static void ath5k_stop(struct ieee80211_hw *hw)
1109 {
1110 - ath5k_stop_hw(hw->priv);
1111 + ath5k_stop_hw(hw->priv, false);
1112 }
1113
1114 static int ath5k_add_interface(struct ieee80211_hw *hw,
1115 diff --git a/drivers/net/wireless/ath5k/base.h b/drivers/net/wireless/ath5k/base.h
1116 index 7ec2f37..214a565 100644
1117 --- a/drivers/net/wireless/ath5k/base.h
1118 +++ b/drivers/net/wireless/ath5k/base.h
1119 @@ -132,11 +132,12 @@ struct ath5k_softc {
1120 size_t desc_len; /* size of TX/RX descriptors */
1121 u16 cachelsz; /* cache line size */
1122
1123 - DECLARE_BITMAP(status, 4);
1124 + DECLARE_BITMAP(status, 5);
1125 #define ATH_STAT_INVALID 0 /* disable hardware accesses */
1126 #define ATH_STAT_MRRETRY 1 /* multi-rate retry support */
1127 #define ATH_STAT_PROMISC 2
1128 #define ATH_STAT_LEDSOFT 3 /* enable LED gpio status */
1129 +#define ATH_STAT_STARTED 4 /* opened & irqs enabled */
1130
1131 unsigned int filter_flags; /* HW flags, AR5K_RX_FILTER_* */
1132 unsigned int curmode; /* current phy mode */
1133 diff --git a/drivers/net/wireless/ath5k/hw.c b/drivers/net/wireless/ath5k/hw.c
1134 index ad1a5b4..9b40cbe 100644
1135 --- a/drivers/net/wireless/ath5k/hw.c
1136 +++ b/drivers/net/wireless/ath5k/hw.c
1137 @@ -826,9 +826,10 @@ int ath5k_hw_reset(struct ath5k_hw *ah, enum ieee80211_if_types op_mode,
1138 mdelay(1);
1139
1140 /*
1141 - * Write some more initial register settings
1142 + * Write some more initial register settings for revised chips
1143 */
1144 - if (ah->ah_version == AR5K_AR5212) {
1145 + if (ah->ah_version == AR5K_AR5212 &&
1146 + ah->ah_phy_revision > 0x41) {
1147 ath5k_hw_reg_write(ah, 0x0002a002, 0x982c);
1148
1149 if (channel->hw_value == CHANNEL_G)
1150 @@ -847,19 +848,10 @@ int ath5k_hw_reset(struct ath5k_hw *ah, enum ieee80211_if_types op_mode,
1151 else
1152 ath5k_hw_reg_write(ah, 0x00000000, 0x994c);
1153
1154 - /* Some bits are disabled here, we know nothing about
1155 - * register 0xa228 yet, most of the times this ends up
1156 - * with a value 0x9b5 -haven't seen any dump with
1157 - * a different value- */
1158 - /* Got this from decompiling binary HAL */
1159 - data = ath5k_hw_reg_read(ah, 0xa228);
1160 - data &= 0xfffffdff;
1161 - ath5k_hw_reg_write(ah, data, 0xa228);
1162 -
1163 - data = ath5k_hw_reg_read(ah, 0xa228);
1164 - data &= 0xfffe03ff;
1165 - ath5k_hw_reg_write(ah, data, 0xa228);
1166 - data = 0;
1167 + /* Got this from legacy-hal */
1168 + AR5K_REG_DISABLE_BITS(ah, 0xa228, 0x200);
1169 +
1170 + AR5K_REG_MASKED_BITS(ah, 0xa228, 2 << 10, ~0x1fc00);
1171
1172 /* Just write 0x9b5 ? */
1173 /* ath5k_hw_reg_write(ah, 0x000009b5, 0xa228); */
1174 diff --git a/drivers/net/wireless/ath5k/initvals.c b/drivers/net/wireless/ath5k/initvals.c
1175 index 2806b21..cf7ebd1 100644
1176 --- a/drivers/net/wireless/ath5k/initvals.c
1177 +++ b/drivers/net/wireless/ath5k/initvals.c
1178 @@ -810,6 +810,8 @@ static const struct ath5k_ini_mode ar5212_rf5111_ini_mode_end[] = {
1179 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
1180 { AR5K_PHY(642),
1181 { 0xd03e6788, 0xd03e6788, 0xd03e6788, 0xd03e6788, 0xd03e6788 } },
1182 + { 0xa228,
1183 + { 0x000001b5, 0x000001b5, 0x000001b5, 0x000001b5, 0x000001b5 } },
1184 { 0xa23c,
1185 { 0x13c889af, 0x13c889af, 0x13c889af, 0x13c889af, 0x13c889af } },
1186 };
1187 diff --git a/drivers/net/wireless/hostap/hostap_wlan.h b/drivers/net/wireless/hostap/hostap_wlan.h
1188 index ffdf487..a68f97c 100644
1189 --- a/drivers/net/wireless/hostap/hostap_wlan.h
1190 +++ b/drivers/net/wireless/hostap/hostap_wlan.h
1191 @@ -918,9 +918,12 @@ struct hostap_interface {
1192
1193 /*
1194 * TX meta data - stored in skb->cb buffer, so this must not be increased over
1195 - * the 40-byte limit
1196 + * the 48-byte limit.
1197 + * THE PADDING THIS STARTS WITH IS A HORRIBLE HACK THAT SHOULD NOT LIVE
1198 + * TO SEE THE DAY.
1199 */
1200 struct hostap_skb_tx_data {
1201 + unsigned int __padding_for_default_qdiscs;
1202 u32 magic; /* HOSTAP_SKB_TX_DATA_MAGIC */
1203 u8 rate; /* transmit rate */
1204 #define HOSTAP_TX_FLAGS_WDS BIT(0)
1205 diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
1206 index 72a6743..cf7056e 100644
1207 --- a/drivers/net/wireless/iwlwifi/iwl-agn.c
1208 +++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
1209 @@ -3275,7 +3275,11 @@ static void iwl4965_mac_update_tkip_key(struct ieee80211_hw *hw,
1210 return;
1211 }
1212
1213 - iwl_scan_cancel_timeout(priv, 100);
1214 + if (iwl_scan_cancel(priv)) {
1215 + /* cancel scan failed, just live w/ bad key and rely
1216 + briefly on SW decryption */
1217 + return;
1218 + }
1219
1220 key_flags |= (STA_KEY_FLG_TKIP | STA_KEY_FLG_MAP_KEY_MSK);
1221 key_flags |= cpu_to_le16(keyconf->keyidx << STA_KEY_FLG_KEYID_POS);
1222 diff --git a/drivers/net/wireless/rtl8187_dev.c b/drivers/net/wireless/rtl8187_dev.c
1223 index ca5deb6..0cebbc4 100644
1224 --- a/drivers/net/wireless/rtl8187_dev.c
1225 +++ b/drivers/net/wireless/rtl8187_dev.c
1226 @@ -45,6 +45,9 @@ static struct usb_device_id rtl8187_table[] __devinitdata = {
1227 {USB_DEVICE(0x03f0, 0xca02), .driver_info = DEVICE_RTL8187},
1228 /* Sitecom */
1229 {USB_DEVICE(0x0df6, 0x000d), .driver_info = DEVICE_RTL8187},
1230 + {USB_DEVICE(0x0df6, 0x0028), .driver_info = DEVICE_RTL8187B},
1231 + /* Abocom */
1232 + {USB_DEVICE(0x13d1, 0xabe6), .driver_info = DEVICE_RTL8187},
1233 {}
1234 };
1235
1236 diff --git a/drivers/pnp/pnpacpi/core.c b/drivers/pnp/pnpacpi/core.c
1237 index c1b9ea3..98b9df7 100644
1238 --- a/drivers/pnp/pnpacpi/core.c
1239 +++ b/drivers/pnp/pnpacpi/core.c
1240 @@ -148,9 +148,13 @@ static int __init pnpacpi_add_device(struct acpi_device *device)
1241 acpi_status status;
1242 struct pnp_dev *dev;
1243
1244 + /*
1245 + * If a PnPacpi device is not present , the device
1246 + * driver should not be loaded.
1247 + */
1248 status = acpi_get_handle(device->handle, "_CRS", &temp);
1249 if (ACPI_FAILURE(status) || !ispnpidacpi(acpi_device_hid(device)) ||
1250 - is_exclusive_device(device))
1251 + is_exclusive_device(device) || (!device->status.present))
1252 return 0;
1253
1254 dev = pnp_alloc_dev(&pnpacpi_protocol, num, acpi_device_hid(device));
1255 diff --git a/drivers/scsi/dpt_i2o.c b/drivers/scsi/dpt_i2o.c
1256 index 1fe0901..7716145 100644
1257 --- a/drivers/scsi/dpt_i2o.c
1258 +++ b/drivers/scsi/dpt_i2o.c
1259 @@ -2445,7 +2445,7 @@ static s32 adpt_i2o_to_scsi(void __iomem *reply, struct scsi_cmnd* cmd)
1260 hba_status = detailed_status >> 8;
1261
1262 // calculate resid for sg
1263 - scsi_set_resid(cmd, scsi_bufflen(cmd) - readl(reply+5));
1264 + scsi_set_resid(cmd, scsi_bufflen(cmd) - readl(reply+20));
1265
1266 pHba = (adpt_hba*) cmd->device->host->hostdata[0];
1267
1268 @@ -2456,7 +2456,7 @@ static s32 adpt_i2o_to_scsi(void __iomem *reply, struct scsi_cmnd* cmd)
1269 case I2O_SCSI_DSC_SUCCESS:
1270 cmd->result = (DID_OK << 16);
1271 // handle underflow
1272 - if(readl(reply+5) < cmd->underflow ) {
1273 + if (readl(reply+20) < cmd->underflow) {
1274 cmd->result = (DID_ERROR <<16);
1275 printk(KERN_WARNING"%s: SCSI CMD underflow\n",pHba->name);
1276 }
1277 diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h
1278 index 94a720e..00f6780 100644
1279 --- a/drivers/scsi/qla2xxx/qla_def.h
1280 +++ b/drivers/scsi/qla2xxx/qla_def.h
1281 @@ -2546,7 +2546,6 @@ typedef struct scsi_qla_host {
1282 uint8_t fcode_revision[16];
1283 uint32_t fw_revision[4];
1284
1285 - uint16_t fdt_odd_index;
1286 uint32_t fdt_wrt_disable;
1287 uint32_t fdt_erase_cmd;
1288 uint32_t fdt_block_size;
1289 diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
1290 index ee89ddd..3a0a178 100644
1291 --- a/drivers/scsi/qla2xxx/qla_init.c
1292 +++ b/drivers/scsi/qla2xxx/qla_init.c
1293 @@ -974,7 +974,6 @@ qla2x00_setup_chip(scsi_qla_host_t *ha)
1294 &ha->fw_minor_version,
1295 &ha->fw_subminor_version,
1296 &ha->fw_attributes, &ha->fw_memory_size);
1297 - qla2x00_resize_request_q(ha);
1298 ha->flags.npiv_supported = 0;
1299 if ((IS_QLA24XX(ha) || IS_QLA25XX(ha) ||
1300 IS_QLA84XX(ha)) &&
1301 @@ -986,6 +985,7 @@ qla2x00_setup_chip(scsi_qla_host_t *ha)
1302 ha->max_npiv_vports =
1303 MIN_MULTI_ID_FABRIC - 1;
1304 }
1305 + qla2x00_resize_request_q(ha);
1306
1307 if (ql2xallocfwdump)
1308 qla2x00_alloc_fw_dump(ha);
1309 diff --git a/drivers/scsi/qla2xxx/qla_mbx.c b/drivers/scsi/qla2xxx/qla_mbx.c
1310 index 813bc77..c07e879 100644
1311 --- a/drivers/scsi/qla2xxx/qla_mbx.c
1312 +++ b/drivers/scsi/qla2xxx/qla_mbx.c
1313 @@ -1964,7 +1964,7 @@ qla2x00_get_resource_cnts(scsi_qla_host_t *ha, uint16_t *cur_xchg_cnt,
1314 *cur_iocb_cnt = mcp->mb[7];
1315 if (orig_iocb_cnt)
1316 *orig_iocb_cnt = mcp->mb[10];
1317 - if (max_npiv_vports)
1318 + if (ha->flags.npiv_supported && max_npiv_vports)
1319 *max_npiv_vports = mcp->mb[11];
1320 }
1321
1322 diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
1323 index 6d0f0e5..86e143c 100644
1324 --- a/drivers/scsi/qla2xxx/qla_os.c
1325 +++ b/drivers/scsi/qla2xxx/qla_os.c
1326 @@ -730,6 +730,7 @@ qla2xxx_eh_abort(struct scsi_cmnd *cmd)
1327 if (ha->isp_ops->abort_command(ha, sp)) {
1328 DEBUG2(printk("%s(%ld): abort_command "
1329 "mbx failed.\n", __func__, ha->host_no));
1330 + ret = FAILED;
1331 } else {
1332 DEBUG3(printk("%s(%ld): abort_command "
1333 "mbx success.\n", __func__, ha->host_no));
1334 diff --git a/drivers/scsi/qla2xxx/qla_sup.c b/drivers/scsi/qla2xxx/qla_sup.c
1335 index 1bca744..910c3b3 100644
1336 --- a/drivers/scsi/qla2xxx/qla_sup.c
1337 +++ b/drivers/scsi/qla2xxx/qla_sup.c
1338 @@ -546,6 +546,7 @@ qla24xx_get_flash_manufacturer(scsi_qla_host_t *ha, uint8_t *man_id,
1339 void
1340 qla2xxx_get_flash_info(scsi_qla_host_t *ha)
1341 {
1342 +#define FLASH_BLK_SIZE_4K 0x1000
1343 #define FLASH_BLK_SIZE_32K 0x8000
1344 #define FLASH_BLK_SIZE_64K 0x10000
1345 uint16_t cnt, chksum;
1346 @@ -577,7 +578,6 @@ qla2xxx_get_flash_info(scsi_qla_host_t *ha)
1347 goto no_flash_data;
1348 }
1349
1350 - ha->fdt_odd_index = le16_to_cpu(fdt->man_id) == 0x1f;
1351 ha->fdt_wrt_disable = fdt->wrt_disable_bits;
1352 ha->fdt_erase_cmd = flash_conf_to_access_addr(0x0300 | fdt->erase_cmd);
1353 ha->fdt_block_size = le32_to_cpu(fdt->block_size);
1354 @@ -590,10 +590,10 @@ qla2xxx_get_flash_info(scsi_qla_host_t *ha)
1355 }
1356
1357 DEBUG2(qla_printk(KERN_DEBUG, ha, "Flash[FDT]: (0x%x/0x%x) erase=0x%x "
1358 - "pro=%x upro=%x idx=%d wrtd=0x%x blk=0x%x.\n",
1359 + "pro=%x upro=%x wrtd=0x%x blk=0x%x.\n",
1360 le16_to_cpu(fdt->man_id), le16_to_cpu(fdt->id), ha->fdt_erase_cmd,
1361 ha->fdt_protect_sec_cmd, ha->fdt_unprotect_sec_cmd,
1362 - ha->fdt_odd_index, ha->fdt_wrt_disable, ha->fdt_block_size));
1363 + ha->fdt_wrt_disable, ha->fdt_block_size));
1364 return;
1365
1366 no_flash_data:
1367 @@ -614,8 +614,7 @@ no_flash_data:
1368 ha->fdt_block_size = FLASH_BLK_SIZE_64K;
1369 break;
1370 case 0x1f: /* Atmel 26DF081A. */
1371 - ha->fdt_odd_index = 1;
1372 - ha->fdt_block_size = FLASH_BLK_SIZE_64K;
1373 + ha->fdt_block_size = FLASH_BLK_SIZE_4K;
1374 ha->fdt_erase_cmd = flash_conf_to_access_addr(0x0320);
1375 ha->fdt_unprotect_sec_cmd = flash_conf_to_access_addr(0x0339);
1376 ha->fdt_protect_sec_cmd = flash_conf_to_access_addr(0x0336);
1377 @@ -627,9 +626,9 @@ no_flash_data:
1378 }
1379
1380 DEBUG2(qla_printk(KERN_DEBUG, ha, "Flash[MID]: (0x%x/0x%x) erase=0x%x "
1381 - "pro=%x upro=%x idx=%d wrtd=0x%x blk=0x%x.\n", man_id, flash_id,
1382 + "pro=%x upro=%x wrtd=0x%x blk=0x%x.\n", man_id, flash_id,
1383 ha->fdt_erase_cmd, ha->fdt_protect_sec_cmd,
1384 - ha->fdt_unprotect_sec_cmd, ha->fdt_odd_index, ha->fdt_wrt_disable,
1385 + ha->fdt_unprotect_sec_cmd, ha->fdt_wrt_disable,
1386 ha->fdt_block_size));
1387 }
1388
1389 @@ -710,13 +709,9 @@ qla24xx_write_flash_data(scsi_qla_host_t *ha, uint32_t *dwptr, uint32_t faddr,
1390 qla24xx_unprotect_flash(ha);
1391
1392 for (liter = 0; liter < dwords; liter++, faddr++, dwptr++) {
1393 - if (ha->fdt_odd_index) {
1394 - findex = faddr << 2;
1395 - fdata = findex & sec_mask;
1396 - } else {
1397 - findex = faddr;
1398 - fdata = (findex & sec_mask) << 2;
1399 - }
1400 +
1401 + findex = faddr;
1402 + fdata = (findex & sec_mask) << 2;
1403
1404 /* Are we at the beginning of a sector? */
1405 if ((findex & rest_addr) == 0) {
1406 diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
1407 index d996a61..61524fc 100644
1408 --- a/drivers/usb/class/cdc-acm.c
1409 +++ b/drivers/usb/class/cdc-acm.c
1410 @@ -158,16 +158,12 @@ static int acm_wb_is_avail(struct acm *acm)
1411 }
1412
1413 /*
1414 - * Finish write.
1415 + * Finish write. Caller must hold acm->write_lock
1416 */
1417 static void acm_write_done(struct acm *acm, struct acm_wb *wb)
1418 {
1419 - unsigned long flags;
1420 -
1421 - spin_lock_irqsave(&acm->write_lock, flags);
1422 wb->use = 0;
1423 acm->transmitting--;
1424 - spin_unlock_irqrestore(&acm->write_lock, flags);
1425 }
1426
1427 /*
1428 @@ -482,6 +478,7 @@ static void acm_write_bulk(struct urb *urb)
1429 {
1430 struct acm_wb *wb = urb->context;
1431 struct acm *acm = wb->instance;
1432 + unsigned long flags;
1433
1434 if (verbose || urb->status
1435 || (urb->actual_length != urb->transfer_buffer_length))
1436 @@ -490,7 +487,9 @@ static void acm_write_bulk(struct urb *urb)
1437 urb->transfer_buffer_length,
1438 urb->status);
1439
1440 + spin_lock_irqsave(&acm->write_lock, flags);
1441 acm_write_done(acm, wb);
1442 + spin_unlock_irqrestore(&acm->write_lock, flags);
1443 if (ACM_READY(acm))
1444 schedule_work(&acm->work);
1445 else
1446 diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c
1447 index 286b443..9cfa366 100644
1448 --- a/drivers/usb/core/message.c
1449 +++ b/drivers/usb/core/message.c
1450 @@ -1091,6 +1091,7 @@ void usb_disable_device(struct usb_device *dev, int skip_ep0)
1451 continue;
1452 dev_dbg(&dev->dev, "unregistering interface %s\n",
1453 dev_name(&interface->dev));
1454 + interface->unregistering = 1;
1455 usb_remove_sysfs_intf_files(interface);
1456 device_del(&interface->dev);
1457 }
1458 diff --git a/drivers/usb/core/sysfs.c b/drivers/usb/core/sysfs.c
1459 index 5e1f5d5..668a6d6 100644
1460 --- a/drivers/usb/core/sysfs.c
1461 +++ b/drivers/usb/core/sysfs.c
1462 @@ -816,7 +816,7 @@ int usb_create_sysfs_intf_files(struct usb_interface *intf)
1463 struct usb_host_interface *alt = intf->cur_altsetting;
1464 int retval;
1465
1466 - if (intf->sysfs_files_created)
1467 + if (intf->sysfs_files_created || intf->unregistering)
1468 return 0;
1469
1470 /* The interface string may be present in some altsettings
1471 diff --git a/drivers/usb/gadget/f_acm.c b/drivers/usb/gadget/f_acm.c
1472 index 5ee1590..c1d34df 100644
1473 --- a/drivers/usb/gadget/f_acm.c
1474 +++ b/drivers/usb/gadget/f_acm.c
1475 @@ -463,7 +463,11 @@ static int acm_cdc_notify(struct f_acm *acm, u8 type, u16 value,
1476 notify->wLength = cpu_to_le16(length);
1477 memcpy(buf, data, length);
1478
1479 + /* ep_queue() can complete immediately if it fills the fifo... */
1480 + spin_unlock(&acm->lock);
1481 status = usb_ep_queue(ep, req, GFP_ATOMIC);
1482 + spin_lock(&acm->lock);
1483 +
1484 if (status < 0) {
1485 ERROR(acm->port.func.config->cdev,
1486 "acm ttyGS%d can't notify serial state, %d\n",
1487 diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
1488 index 228797e..a657c94 100644
1489 --- a/drivers/usb/host/Kconfig
1490 +++ b/drivers/usb/host/Kconfig
1491 @@ -110,29 +110,18 @@ config USB_ISP116X_HCD
1492
1493 config USB_ISP1760_HCD
1494 tristate "ISP 1760 HCD support"
1495 - depends on USB && EXPERIMENTAL
1496 + depends on USB && EXPERIMENTAL && (PCI || PPC_OF)
1497 ---help---
1498 The ISP1760 chip is a USB 2.0 host controller.
1499
1500 This driver does not support isochronous transfers or OTG.
1501 + This USB controller is usually attached to a non-DMA-Master
1502 + capable bus. NXP's eval kit brings this chip on PCI card
1503 + where the chip itself is behind a PLB to simulate such
1504 + a bus.
1505
1506 To compile this driver as a module, choose M here: the
1507 - module will be called isp1760-hcd.
1508 -
1509 -config USB_ISP1760_PCI
1510 - bool "Support for the PCI bus"
1511 - depends on USB_ISP1760_HCD && PCI
1512 - ---help---
1513 - Enables support for the device present on the PCI bus.
1514 - This should only be required if you happen to have the eval kit from
1515 - NXP and you are going to test it.
1516 -
1517 -config USB_ISP1760_OF
1518 - bool "Support for the OF platform bus"
1519 - depends on USB_ISP1760_HCD && PPC_OF
1520 - ---help---
1521 - Enables support for the device present on the PowerPC
1522 - OpenFirmware platform bus.
1523 + module will be called isp1760.
1524
1525 config USB_OHCI_HCD
1526 tristate "OHCI HCD support"
1527 diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
1528 index 86e38b0..dc21ade 100644
1529 --- a/drivers/usb/host/ehci-hcd.c
1530 +++ b/drivers/usb/host/ehci-hcd.c
1531 @@ -643,7 +643,7 @@ static int ehci_run (struct usb_hcd *hcd)
1532 static irqreturn_t ehci_irq (struct usb_hcd *hcd)
1533 {
1534 struct ehci_hcd *ehci = hcd_to_ehci (hcd);
1535 - u32 status, pcd_status = 0, cmd;
1536 + u32 status, masked_status, pcd_status = 0, cmd;
1537 int bh;
1538
1539 spin_lock (&ehci->lock);
1540 @@ -656,14 +656,14 @@ static irqreturn_t ehci_irq (struct usb_hcd *hcd)
1541 goto dead;
1542 }
1543
1544 - status &= INTR_MASK;
1545 - if (!status) { /* irq sharing? */
1546 + masked_status = status & INTR_MASK;
1547 + if (!masked_status) { /* irq sharing? */
1548 spin_unlock(&ehci->lock);
1549 return IRQ_NONE;
1550 }
1551
1552 /* clear (just) interrupts */
1553 - ehci_writel(ehci, status, &ehci->regs->status);
1554 + ehci_writel(ehci, masked_status, &ehci->regs->status);
1555 cmd = ehci_readl(ehci, &ehci->regs->command);
1556 bh = 0;
1557
1558 @@ -731,19 +731,18 @@ static irqreturn_t ehci_irq (struct usb_hcd *hcd)
1559
1560 /* PCI errors [4.15.2.4] */
1561 if (unlikely ((status & STS_FATAL) != 0)) {
1562 + ehci_err(ehci, "fatal error\n");
1563 dbg_cmd (ehci, "fatal", ehci_readl(ehci,
1564 &ehci->regs->command));
1565 dbg_status (ehci, "fatal", status);
1566 - if (status & STS_HALT) {
1567 - ehci_err (ehci, "fatal error\n");
1568 + ehci_halt(ehci);
1569 dead:
1570 - ehci_reset (ehci);
1571 - ehci_writel(ehci, 0, &ehci->regs->configured_flag);
1572 - /* generic layer kills/unlinks all urbs, then
1573 - * uses ehci_stop to clean up the rest
1574 - */
1575 - bh = 1;
1576 - }
1577 + ehci_reset(ehci);
1578 + ehci_writel(ehci, 0, &ehci->regs->configured_flag);
1579 + /* generic layer kills/unlinks all urbs, then
1580 + * uses ehci_stop to clean up the rest
1581 + */
1582 + bh = 1;
1583 }
1584
1585 if (bh)
1586 diff --git a/drivers/usb/host/ehci-ps3.c b/drivers/usb/host/ehci-ps3.c
1587 index 0eba894..9c9da35 100644
1588 --- a/drivers/usb/host/ehci-ps3.c
1589 +++ b/drivers/usb/host/ehci-ps3.c
1590 @@ -205,6 +205,7 @@ static int ps3_ehci_remove(struct ps3_system_bus_device *dev)
1591
1592 tmp = hcd->irq;
1593
1594 + ehci_shutdown(hcd);
1595 usb_remove_hcd(hcd);
1596
1597 ps3_system_bus_set_driver_data(dev, NULL);
1598 diff --git a/drivers/usb/host/ehci-sched.c b/drivers/usb/host/ehci-sched.c
1599 index 4a0c5a7..a081ee6 100644
1600 --- a/drivers/usb/host/ehci-sched.c
1601 +++ b/drivers/usb/host/ehci-sched.c
1602 @@ -918,7 +918,7 @@ iso_stream_init (
1603 */
1604 stream->usecs = HS_USECS_ISO (maxp);
1605 bandwidth = stream->usecs * 8;
1606 - bandwidth /= 1 << (interval - 1);
1607 + bandwidth /= interval;
1608
1609 } else {
1610 u32 addr;
1611 @@ -951,7 +951,7 @@ iso_stream_init (
1612 } else
1613 stream->raw_mask = smask_out [hs_transfers - 1];
1614 bandwidth = stream->usecs + stream->c_usecs;
1615 - bandwidth /= 1 << (interval + 2);
1616 + bandwidth /= interval << 3;
1617
1618 /* stream->splits gets created from raw_mask later */
1619 stream->address = cpu_to_hc32(ehci, addr);
1620 diff --git a/drivers/usb/host/isp1760-if.c b/drivers/usb/host/isp1760-if.c
1621 index 051ef7b..78b8aaa 100644
1622 --- a/drivers/usb/host/isp1760-if.c
1623 +++ b/drivers/usb/host/isp1760-if.c
1624 @@ -14,16 +14,16 @@
1625 #include "../core/hcd.h"
1626 #include "isp1760-hcd.h"
1627
1628 -#ifdef CONFIG_USB_ISP1760_OF
1629 +#ifdef CONFIG_PPC_OF
1630 #include <linux/of.h>
1631 #include <linux/of_platform.h>
1632 #endif
1633
1634 -#ifdef CONFIG_USB_ISP1760_PCI
1635 +#ifdef CONFIG_PCI
1636 #include <linux/pci.h>
1637 #endif
1638
1639 -#ifdef CONFIG_USB_ISP1760_OF
1640 +#ifdef CONFIG_PPC_OF
1641 static int of_isp1760_probe(struct of_device *dev,
1642 const struct of_device_id *match)
1643 {
1644 @@ -128,7 +128,7 @@ static struct of_platform_driver isp1760_of_driver = {
1645 };
1646 #endif
1647
1648 -#ifdef CONFIG_USB_ISP1760_PCI
1649 +#ifdef CONFIG_PCI
1650 static u32 nxp_pci_io_base;
1651 static u32 iolength;
1652 static u32 pci_mem_phy0;
1653 @@ -287,28 +287,28 @@ static struct pci_driver isp1761_pci_driver = {
1654
1655 static int __init isp1760_init(void)
1656 {
1657 - int ret = -ENODEV;
1658 + int ret;
1659
1660 init_kmem_once();
1661
1662 -#ifdef CONFIG_USB_ISP1760_OF
1663 +#ifdef CONFIG_PPC_OF
1664 ret = of_register_platform_driver(&isp1760_of_driver);
1665 if (ret) {
1666 deinit_kmem_cache();
1667 return ret;
1668 }
1669 #endif
1670 -#ifdef CONFIG_USB_ISP1760_PCI
1671 +#ifdef CONFIG_PCI
1672 ret = pci_register_driver(&isp1761_pci_driver);
1673 if (ret)
1674 goto unreg_of;
1675 #endif
1676 return ret;
1677
1678 -#ifdef CONFIG_USB_ISP1760_PCI
1679 +#ifdef CONFIG_PCI
1680 unreg_of:
1681 #endif
1682 -#ifdef CONFIG_USB_ISP1760_OF
1683 +#ifdef CONFIG_PPC_OF
1684 of_unregister_platform_driver(&isp1760_of_driver);
1685 #endif
1686 deinit_kmem_cache();
1687 @@ -318,10 +318,10 @@ module_init(isp1760_init);
1688
1689 static void __exit isp1760_exit(void)
1690 {
1691 -#ifdef CONFIG_USB_ISP1760_OF
1692 +#ifdef CONFIG_PPC_OF
1693 of_unregister_platform_driver(&isp1760_of_driver);
1694 #endif
1695 -#ifdef CONFIG_USB_ISP1760_PCI
1696 +#ifdef CONFIG_PCI
1697 pci_unregister_driver(&isp1761_pci_driver);
1698 #endif
1699 deinit_kmem_cache();
1700 diff --git a/drivers/usb/host/ohci-ps3.c b/drivers/usb/host/ohci-ps3.c
1701 index 2089d8a..3c1a3b5 100644
1702 --- a/drivers/usb/host/ohci-ps3.c
1703 +++ b/drivers/usb/host/ohci-ps3.c
1704 @@ -192,7 +192,7 @@ fail_start:
1705 return result;
1706 }
1707
1708 -static int ps3_ohci_remove (struct ps3_system_bus_device *dev)
1709 +static int ps3_ohci_remove(struct ps3_system_bus_device *dev)
1710 {
1711 unsigned int tmp;
1712 struct usb_hcd *hcd =
1713 @@ -205,6 +205,7 @@ static int ps3_ohci_remove (struct ps3_system_bus_device *dev)
1714
1715 tmp = hcd->irq;
1716
1717 + ohci_shutdown(hcd);
1718 usb_remove_hcd(hcd);
1719
1720 ps3_system_bus_set_driver_data(dev, NULL);
1721 diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h
1722 index 061df9b..ccebf89 100644
1723 --- a/drivers/usb/storage/unusual_devs.h
1724 +++ b/drivers/usb/storage/unusual_devs.h
1725 @@ -1251,6 +1251,13 @@ UNUSUAL_DEV( 0x0839, 0x000a, 0x0001, 0x0001,
1726 US_SC_DEVICE, US_PR_DEVICE, NULL,
1727 US_FL_FIX_INQUIRY),
1728
1729 +/* Reported by Luciano Rocha <luciano@eurotux.com> */
1730 +UNUSUAL_DEV( 0x0840, 0x0082, 0x0001, 0x0001,
1731 + "Argosy",
1732 + "Storage",
1733 + US_SC_DEVICE, US_PR_DEVICE, NULL,
1734 + US_FL_FIX_CAPACITY),
1735 +
1736 /* Entry and supporting patch by Theodore Kilgore <kilgota@auburn.edu>.
1737 * Flag will support Bulk devices which use a standards-violating 32-byte
1738 * Command Block Wrapper. Here, the "DC2MEGA" cameras (several brands) with
1739 diff --git a/fs/namespace.c b/fs/namespace.c
1740 index 6e283c9..1bd5ba2 100644
1741 --- a/fs/namespace.c
1742 +++ b/fs/namespace.c
1743 @@ -1553,8 +1553,13 @@ static noinline int do_remount(struct nameidata *nd, int flags, int mnt_flags,
1744 if (!err)
1745 nd->path.mnt->mnt_flags = mnt_flags;
1746 up_write(&sb->s_umount);
1747 - if (!err)
1748 + if (!err) {
1749 security_sb_post_remount(nd->path.mnt, flags, data);
1750 +
1751 + spin_lock(&vfsmount_lock);
1752 + touch_mnt_namespace(nd->path.mnt->mnt_ns);
1753 + spin_unlock(&vfsmount_lock);
1754 + }
1755 return err;
1756 }
1757
1758 diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c
1759 index f9a8b89..7a510a6 100644
1760 --- a/fs/proc/proc_sysctl.c
1761 +++ b/fs/proc/proc_sysctl.c
1762 @@ -31,6 +31,7 @@ static struct inode *proc_sys_make_inode(struct super_block *sb,
1763 inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME;
1764 inode->i_flags |= S_PRIVATE; /* tell selinux to ignore this inode */
1765 inode->i_mode = table->mode;
1766 + inode->i_uid = inode->i_gid = 0;
1767 if (!table->child) {
1768 inode->i_mode |= S_IFREG;
1769 inode->i_op = &proc_sys_inode_operations;
1770 diff --git a/include/linux/bio.h b/include/linux/bio.h
1771 index 0933a14..3d83947 100644
1772 --- a/include/linux/bio.h
1773 +++ b/include/linux/bio.h
1774 @@ -98,6 +98,13 @@ struct bio {
1775 unsigned int bi_size; /* residual I/O count */
1776
1777 /*
1778 + * To keep track of the max segment size, we account for the
1779 + * sizes of the first and last mergeable segments in this bio.
1780 + */
1781 + unsigned int bi_seg_front_size;
1782 + unsigned int bi_seg_back_size;
1783 +
1784 + /*
1785 * To keep track of the max hw size, we account for the
1786 * sizes of the first and last virtually mergeable segments
1787 * in this bio
1788 diff --git a/include/linux/usb.h b/include/linux/usb.h
1789 index 94ac74a..2e434dc 100644
1790 --- a/include/linux/usb.h
1791 +++ b/include/linux/usb.h
1792 @@ -108,6 +108,7 @@ enum usb_interface_condition {
1793 * (in probe()), bound to a driver, or unbinding (in disconnect())
1794 * @is_active: flag set when the interface is bound and not suspended.
1795 * @sysfs_files_created: sysfs attributes exist
1796 + * @unregistering: flag set when the interface is being unregistered
1797 * @needs_remote_wakeup: flag set when the driver requires remote-wakeup
1798 * capability during autosuspend.
1799 * @needs_altsetting0: flag set when a set-interface request for altsetting 0
1800 @@ -163,6 +164,7 @@ struct usb_interface {
1801 enum usb_interface_condition condition; /* state of binding */
1802 unsigned is_active:1; /* the interface is not suspended */
1803 unsigned sysfs_files_created:1; /* the sysfs attributes exist */
1804 + unsigned unregistering:1; /* unregistration is in progress */
1805 unsigned needs_remote_wakeup:1; /* driver requires remote wakeup */
1806 unsigned needs_altsetting0:1; /* switch to altsetting 0 is pending */
1807 unsigned needs_binding:1; /* needs delayed unbind/rebind */
1808 diff --git a/mm/hugetlb.c b/mm/hugetlb.c
1809 index 77427c8..81e9a82 100644
1810 --- a/mm/hugetlb.c
1811 +++ b/mm/hugetlb.c
1812 @@ -1797,6 +1797,7 @@ int unmap_ref_private(struct mm_struct *mm,
1813 struct page *page,
1814 unsigned long address)
1815 {
1816 + struct hstate *h = hstate_vma(vma);
1817 struct vm_area_struct *iter_vma;
1818 struct address_space *mapping;
1819 struct prio_tree_iter iter;
1820 @@ -1806,7 +1807,7 @@ int unmap_ref_private(struct mm_struct *mm,
1821 * vm_pgoff is in PAGE_SIZE units, hence the different calculation
1822 * from page cache lookup which is in HPAGE_SIZE units.
1823 */
1824 - address = address & huge_page_mask(hstate_vma(vma));
1825 + address = address & huge_page_mask(h);
1826 pgoff = ((address - vma->vm_start) >> PAGE_SHIFT)
1827 + (vma->vm_pgoff >> PAGE_SHIFT);
1828 mapping = (struct address_space *)page_private(page);
1829 @@ -1825,7 +1826,7 @@ int unmap_ref_private(struct mm_struct *mm,
1830 */
1831 if (!is_vma_resv_set(iter_vma, HPAGE_RESV_OWNER))
1832 unmap_hugepage_range(iter_vma,
1833 - address, address + HPAGE_SIZE,
1834 + address, address + huge_page_size(h),
1835 page);
1836 }
1837
1838 diff --git a/mm/page_isolation.c b/mm/page_isolation.c
1839 index b70a7fe..5e0ffd9 100644
1840 --- a/mm/page_isolation.c
1841 +++ b/mm/page_isolation.c
1842 @@ -130,10 +130,11 @@ int test_pages_isolated(unsigned long start_pfn, unsigned long end_pfn)
1843 if (page && get_pageblock_migratetype(page) != MIGRATE_ISOLATE)
1844 break;
1845 }
1846 - if (pfn < end_pfn)
1847 + page = __first_valid_page(start_pfn, end_pfn - start_pfn);
1848 + if ((pfn < end_pfn) || !page)
1849 return -EBUSY;
1850 /* Check all pages are free or Marked as ISOLATED */
1851 - zone = page_zone(pfn_to_page(pfn));
1852 + zone = page_zone(page);
1853 spin_lock_irqsave(&zone->lock, flags);
1854 ret = __test_page_isolated_in_pageblock(start_pfn, end_pfn);
1855 spin_unlock_irqrestore(&zone->lock, flags);
1856 diff --git a/net/ipv4/proc.c b/net/ipv4/proc.c
1857 index 8f5a403..a631a1f 100644
1858 --- a/net/ipv4/proc.c
1859 +++ b/net/ipv4/proc.c
1860 @@ -237,43 +237,45 @@ static const struct snmp_mib snmp4_net_list[] = {
1861 SNMP_MIB_SENTINEL
1862 };
1863
1864 +static void icmpmsg_put_line(struct seq_file *seq, unsigned long *vals,
1865 + unsigned short *type, int count)
1866 +{
1867 + int j;
1868 +
1869 + if (count) {
1870 + seq_printf(seq, "\nIcmpMsg:");
1871 + for (j = 0; j < count; ++j)
1872 + seq_printf(seq, " %sType%u",
1873 + type[j] & 0x100 ? "Out" : "In",
1874 + type[j] & 0xff);
1875 + seq_printf(seq, "\nIcmpMsg:");
1876 + for (j = 0; j < count; ++j)
1877 + seq_printf(seq, " %lu", vals[j]);
1878 + }
1879 +}
1880 +
1881 static void icmpmsg_put(struct seq_file *seq)
1882 {
1883 #define PERLINE 16
1884
1885 - int j, i, count;
1886 - static int out[PERLINE];
1887 + int i, count;
1888 + unsigned short type[PERLINE];
1889 + unsigned long vals[PERLINE], val;
1890 struct net *net = seq->private;
1891
1892 count = 0;
1893 for (i = 0; i < ICMPMSG_MIB_MAX; i++) {
1894 -
1895 - if (snmp_fold_field((void **) net->mib.icmpmsg_statistics, i))
1896 - out[count++] = i;
1897 - if (count < PERLINE)
1898 - continue;
1899 -
1900 - seq_printf(seq, "\nIcmpMsg:");
1901 - for (j = 0; j < PERLINE; ++j)
1902 - seq_printf(seq, " %sType%u", i & 0x100 ? "Out" : "In",
1903 - i & 0xff);
1904 - seq_printf(seq, "\nIcmpMsg: ");
1905 - for (j = 0; j < PERLINE; ++j)
1906 - seq_printf(seq, " %lu",
1907 - snmp_fold_field((void **) net->mib.icmpmsg_statistics,
1908 - out[j]));
1909 - seq_putc(seq, '\n');
1910 - }
1911 - if (count) {
1912 - seq_printf(seq, "\nIcmpMsg:");
1913 - for (j = 0; j < count; ++j)
1914 - seq_printf(seq, " %sType%u", out[j] & 0x100 ? "Out" :
1915 - "In", out[j] & 0xff);
1916 - seq_printf(seq, "\nIcmpMsg:");
1917 - for (j = 0; j < count; ++j)
1918 - seq_printf(seq, " %lu", snmp_fold_field((void **)
1919 - net->mib.icmpmsg_statistics, out[j]));
1920 + val = snmp_fold_field((void **) net->mib.icmpmsg_statistics, i);
1921 + if (val) {
1922 + type[count] = i;
1923 + vals[count++] = val;
1924 + }
1925 + if (count == PERLINE) {
1926 + icmpmsg_put_line(seq, vals, type, count);
1927 + count = 0;
1928 + }
1929 }
1930 + icmpmsg_put_line(seq, vals, type, count);
1931
1932 #undef PERLINE
1933 }
1934 diff --git a/scripts/package/builddeb b/scripts/package/builddeb
1935 index ba6bf5d..1264b8e 100644
1936 --- a/scripts/package/builddeb
1937 +++ b/scripts/package/builddeb
1938 @@ -15,15 +15,18 @@ set -e
1939 version=$KERNELRELEASE
1940 revision=`cat .version`
1941 tmpdir="$objtree/debian/tmp"
1942 +fwdir="$objtree/debian/fwtmp"
1943 packagename=linux-$version
1944 +fwpackagename=linux-firmware-image
1945
1946 if [ "$ARCH" == "um" ] ; then
1947 packagename=user-mode-linux-$version
1948 fi
1949
1950 # Setup the directory structure
1951 -rm -rf "$tmpdir"
1952 +rm -rf "$tmpdir" "$fwdir"
1953 mkdir -p "$tmpdir/DEBIAN" "$tmpdir/lib" "$tmpdir/boot"
1954 +mkdir -p "$fwdir/DEBIAN" "$fwdir/lib"
1955 if [ "$ARCH" == "um" ] ; then
1956 mkdir -p "$tmpdir/usr/lib/uml/modules/$version" "$tmpdir/usr/share/doc/$packagename" "$tmpdir/usr/bin"
1957 fi
1958 @@ -107,6 +110,7 @@ Standards-Version: 3.6.1
1959
1960 Package: $packagename
1961 Provides: kernel-image-$version, linux-image-$version
1962 +Suggests: $fwpackagename
1963 Architecture: any
1964 Description: Linux kernel, version $version
1965 This package contains the Linux kernel, modules and corresponding other
1966 @@ -118,8 +122,24 @@ fi
1967 chown -R root:root "$tmpdir"
1968 chmod -R go-w "$tmpdir"
1969
1970 +# Do we have firmware? Move it out of the way and build it into a package.
1971 +if [ -e "$tmpdir/lib/firmware" ]; then
1972 + mv "$tmpdir/lib/firmware" "$fwdir/lib/"
1973 +
1974 + cat <<EOF >> debian/control
1975 +
1976 +Package: $fwpackagename
1977 +Architecture: all
1978 +Description: Linux kernel firmware, version $version
1979 + This package contains firmware from the Linux kernel, version $version
1980 +EOF
1981 +
1982 + dpkg-gencontrol -isp -p$fwpackagename -P"$fwdir"
1983 + dpkg --build "$fwdir" ..
1984 +fi
1985 +
1986 # Perform the final magic
1987 -dpkg-gencontrol -isp
1988 +dpkg-gencontrol -isp -p$packagename
1989 dpkg --build "$tmpdir" ..
1990
1991 exit 0

  ViewVC Help
Powered by ViewVC 1.1.20