Contents of /trunk/kernel-alx/patches-3.4/0125-3.4.26-all-fixes.patch
Parent Directory | Revision Log
Revision 2110 -
(show annotations)
(download)
Tue Mar 12 12:15:23 2013 UTC (11 years, 6 months ago) by niro
File size: 228079 byte(s)
Tue Mar 12 12:15:23 2013 UTC (11 years, 6 months ago) by niro
File size: 228079 byte(s)
-sync with upstream
1 | diff --git a/Documentation/ABI/testing/sysfs-bus-rbd b/Documentation/ABI/testing/sysfs-bus-rbd |
2 | index dbedafb..eb781c6 100644 |
3 | --- a/Documentation/ABI/testing/sysfs-bus-rbd |
4 | +++ b/Documentation/ABI/testing/sysfs-bus-rbd |
5 | @@ -51,12 +51,6 @@ current_snap |
6 | |
7 | The current snapshot for which the device is mapped. |
8 | |
9 | -create_snap |
10 | - |
11 | - Create a snapshot: |
12 | - |
13 | - $ echo <snap-name> > /sys/bus/rbd/devices/<dev-id>/snap_create |
14 | - |
15 | snap_* |
16 | |
17 | A directory per each snapshot |
18 | diff --git a/arch/arm/mach-pxa/include/mach/mfp-pxa27x.h b/arch/arm/mach-pxa/include/mach/mfp-pxa27x.h |
19 | index a658672..b4eb3da 100644 |
20 | --- a/arch/arm/mach-pxa/include/mach/mfp-pxa27x.h |
21 | +++ b/arch/arm/mach-pxa/include/mach/mfp-pxa27x.h |
22 | @@ -462,6 +462,9 @@ |
23 | GPIO76_LCD_PCLK, \ |
24 | GPIO77_LCD_BIAS |
25 | |
26 | +/* these enable a work-around for a hw bug in pxa27x during ac97 warm reset */ |
27 | +#define GPIO113_AC97_nRESET_GPIO_HIGH MFP_CFG_OUT(GPIO113, AF0, DEFAULT) |
28 | +#define GPIO95_AC97_nRESET_GPIO_HIGH MFP_CFG_OUT(GPIO95, AF0, DEFAULT) |
29 | |
30 | extern int keypad_set_wake(unsigned int on); |
31 | #endif /* __ASM_ARCH_MFP_PXA27X_H */ |
32 | diff --git a/arch/arm/mach-pxa/pxa27x.c b/arch/arm/mach-pxa/pxa27x.c |
33 | index 4726c24..a2fe795 100644 |
34 | --- a/arch/arm/mach-pxa/pxa27x.c |
35 | +++ b/arch/arm/mach-pxa/pxa27x.c |
36 | @@ -47,9 +47,9 @@ void pxa27x_clear_otgph(void) |
37 | EXPORT_SYMBOL(pxa27x_clear_otgph); |
38 | |
39 | static unsigned long ac97_reset_config[] = { |
40 | - GPIO113_GPIO, |
41 | + GPIO113_AC97_nRESET_GPIO_HIGH, |
42 | GPIO113_AC97_nRESET, |
43 | - GPIO95_GPIO, |
44 | + GPIO95_AC97_nRESET_GPIO_HIGH, |
45 | GPIO95_AC97_nRESET, |
46 | }; |
47 | |
48 | diff --git a/arch/mips/kernel/process.c b/arch/mips/kernel/process.c |
49 | index e9a5fd7..69b17a9 100644 |
50 | --- a/arch/mips/kernel/process.c |
51 | +++ b/arch/mips/kernel/process.c |
52 | @@ -72,9 +72,7 @@ void __noreturn cpu_idle(void) |
53 | } |
54 | } |
55 | #ifdef CONFIG_HOTPLUG_CPU |
56 | - if (!cpu_online(cpu) && !cpu_isset(cpu, cpu_callin_map) && |
57 | - (system_state == SYSTEM_RUNNING || |
58 | - system_state == SYSTEM_BOOTING)) |
59 | + if (!cpu_online(cpu) && !cpu_isset(cpu, cpu_callin_map)) |
60 | play_dead(); |
61 | #endif |
62 | rcu_idle_exit(); |
63 | diff --git a/arch/powerpc/kernel/head_64.S b/arch/powerpc/kernel/head_64.S |
64 | index 58bddee..9e07bd0 100644 |
65 | --- a/arch/powerpc/kernel/head_64.S |
66 | +++ b/arch/powerpc/kernel/head_64.S |
67 | @@ -422,7 +422,7 @@ _STATIC(__after_prom_start) |
68 | tovirt(r6,r6) /* on booke, we already run at PAGE_OFFSET */ |
69 | #endif |
70 | |
71 | -#ifdef CONFIG_CRASH_DUMP |
72 | +#ifdef CONFIG_RELOCATABLE |
73 | /* |
74 | * Check if the kernel has to be running as relocatable kernel based on the |
75 | * variable __run_at_load, if it is set the kernel is treated as relocatable |
76 | diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c |
77 | index 730e69c..e7dba0b 100644 |
78 | --- a/arch/powerpc/kernel/time.c |
79 | +++ b/arch/powerpc/kernel/time.c |
80 | @@ -749,13 +749,8 @@ void update_vsyscall(struct timespec *wall_time, struct timespec *wtm, |
81 | |
82 | void update_vsyscall_tz(void) |
83 | { |
84 | - /* Make userspace gettimeofday spin until we're done. */ |
85 | - ++vdso_data->tb_update_count; |
86 | - smp_mb(); |
87 | vdso_data->tz_minuteswest = sys_tz.tz_minuteswest; |
88 | vdso_data->tz_dsttime = sys_tz.tz_dsttime; |
89 | - smp_mb(); |
90 | - ++vdso_data->tb_update_count; |
91 | } |
92 | |
93 | static void __init clocksource_init(void) |
94 | diff --git a/arch/powerpc/kvm/44x_emulate.c b/arch/powerpc/kvm/44x_emulate.c |
95 | index 549bb2c..ded8a1a 100644 |
96 | --- a/arch/powerpc/kvm/44x_emulate.c |
97 | +++ b/arch/powerpc/kvm/44x_emulate.c |
98 | @@ -79,6 +79,7 @@ int kvmppc_core_emulate_op(struct kvm_run *run, struct kvm_vcpu *vcpu, |
99 | run->dcr.dcrn = dcrn; |
100 | run->dcr.data = 0; |
101 | run->dcr.is_write = 0; |
102 | + vcpu->arch.dcr_is_write = 0; |
103 | vcpu->arch.io_gpr = rt; |
104 | vcpu->arch.dcr_needed = 1; |
105 | kvmppc_account_exit(vcpu, DCR_EXITS); |
106 | @@ -100,6 +101,7 @@ int kvmppc_core_emulate_op(struct kvm_run *run, struct kvm_vcpu *vcpu, |
107 | run->dcr.dcrn = dcrn; |
108 | run->dcr.data = kvmppc_get_gpr(vcpu, rs); |
109 | run->dcr.is_write = 1; |
110 | + vcpu->arch.dcr_is_write = 1; |
111 | vcpu->arch.dcr_needed = 1; |
112 | kvmppc_account_exit(vcpu, DCR_EXITS); |
113 | emulated = EMULATE_DO_DCR; |
114 | diff --git a/arch/powerpc/platforms/40x/ppc40x_simple.c b/arch/powerpc/platforms/40x/ppc40x_simple.c |
115 | index 9761206..f0eee75 100644 |
116 | --- a/arch/powerpc/platforms/40x/ppc40x_simple.c |
117 | +++ b/arch/powerpc/platforms/40x/ppc40x_simple.c |
118 | @@ -57,7 +57,8 @@ static const char *board[] __initdata = { |
119 | "amcc,makalu", |
120 | "apm,klondike", |
121 | "est,hotfoot", |
122 | - "plathome,obs600" |
123 | + "plathome,obs600", |
124 | + NULL |
125 | }; |
126 | |
127 | static int __init ppc40x_probe(void) |
128 | diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c |
129 | index 6b4976b..a9c8a46 100644 |
130 | --- a/arch/x86/kernel/cpu/amd.c |
131 | +++ b/arch/x86/kernel/cpu/amd.c |
132 | @@ -612,6 +612,20 @@ static void __cpuinit init_amd(struct cpuinfo_x86 *c) |
133 | } |
134 | } |
135 | |
136 | + /* |
137 | + * The way access filter has a performance penalty on some workloads. |
138 | + * Disable it on the affected CPUs. |
139 | + */ |
140 | + if ((c->x86 == 0x15) && |
141 | + (c->x86_model >= 0x02) && (c->x86_model < 0x20)) { |
142 | + u64 val; |
143 | + |
144 | + if (!rdmsrl_safe(0xc0011021, &val) && !(val & 0x1E)) { |
145 | + val |= 0x1E; |
146 | + checking_wrmsrl(0xc0011021, val); |
147 | + } |
148 | + } |
149 | + |
150 | cpu_detect_cache_sizes(c); |
151 | |
152 | /* Multi core CPU? */ |
153 | diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c |
154 | index bd3199c..619a2e4 100644 |
155 | --- a/drivers/acpi/scan.c |
156 | +++ b/drivers/acpi/scan.c |
157 | @@ -789,8 +789,8 @@ acpi_bus_extract_wakeup_device_power_package(acpi_handle handle, |
158 | static void acpi_bus_set_run_wake_flags(struct acpi_device *device) |
159 | { |
160 | struct acpi_device_id button_device_ids[] = { |
161 | - {"PNP0C0D", 0}, |
162 | {"PNP0C0C", 0}, |
163 | + {"PNP0C0D", 0}, |
164 | {"PNP0C0E", 0}, |
165 | {"", 0}, |
166 | }; |
167 | @@ -802,6 +802,11 @@ static void acpi_bus_set_run_wake_flags(struct acpi_device *device) |
168 | /* Power button, Lid switch always enable wakeup */ |
169 | if (!acpi_match_device_ids(device, button_device_ids)) { |
170 | device->wakeup.flags.run_wake = 1; |
171 | + if (!acpi_match_device_ids(device, &button_device_ids[1])) { |
172 | + /* Do not use Lid/sleep button for S5 wakeup */ |
173 | + if (device->wakeup.sleep_state == ACPI_STATE_S5) |
174 | + device->wakeup.sleep_state = ACPI_STATE_S4; |
175 | + } |
176 | device_set_wakeup_capable(&device->dev, true); |
177 | return; |
178 | } |
179 | diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c |
180 | index cf4837f..4b4caa3 100644 |
181 | --- a/drivers/ata/libata-core.c |
182 | +++ b/drivers/ata/libata-core.c |
183 | @@ -2536,6 +2536,7 @@ int ata_bus_probe(struct ata_port *ap) |
184 | * bus as we may be talking too fast. |
185 | */ |
186 | dev->pio_mode = XFER_PIO_0; |
187 | + dev->dma_mode = 0xff; |
188 | |
189 | /* If the controller has a pio mode setup function |
190 | * then use it to set the chipset to rights. Don't |
191 | diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c |
192 | index d1fbd59..e47c224 100644 |
193 | --- a/drivers/ata/libata-eh.c |
194 | +++ b/drivers/ata/libata-eh.c |
195 | @@ -2600,6 +2600,7 @@ int ata_eh_reset(struct ata_link *link, int classify, |
196 | * bus as we may be talking too fast. |
197 | */ |
198 | dev->pio_mode = XFER_PIO_0; |
199 | + dev->dma_mode = 0xff; |
200 | |
201 | /* If the controller has a pio mode setup function |
202 | * then use it to set the chipset to rights. Don't |
203 | diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c |
204 | index 2222635..15863a4 100644 |
205 | --- a/drivers/ata/libata-scsi.c |
206 | +++ b/drivers/ata/libata-scsi.c |
207 | @@ -309,7 +309,8 @@ ata_scsi_activity_show(struct device *dev, struct device_attribute *attr, |
208 | struct ata_port *ap = ata_shost_to_port(sdev->host); |
209 | struct ata_device *atadev = ata_scsi_find_dev(ap, sdev); |
210 | |
211 | - if (ap->ops->sw_activity_show && (ap->flags & ATA_FLAG_SW_ACTIVITY)) |
212 | + if (atadev && ap->ops->sw_activity_show && |
213 | + (ap->flags & ATA_FLAG_SW_ACTIVITY)) |
214 | return ap->ops->sw_activity_show(atadev, buf); |
215 | return -EINVAL; |
216 | } |
217 | @@ -324,7 +325,8 @@ ata_scsi_activity_store(struct device *dev, struct device_attribute *attr, |
218 | enum sw_activity val; |
219 | int rc; |
220 | |
221 | - if (ap->ops->sw_activity_store && (ap->flags & ATA_FLAG_SW_ACTIVITY)) { |
222 | + if (atadev && ap->ops->sw_activity_store && |
223 | + (ap->flags & ATA_FLAG_SW_ACTIVITY)) { |
224 | val = simple_strtoul(buf, NULL, 0); |
225 | switch (val) { |
226 | case OFF: case BLINK_ON: case BLINK_OFF: |
227 | diff --git a/drivers/ata/sata_promise.c b/drivers/ata/sata_promise.c |
228 | index 000fcc9..ef6e328 100644 |
229 | --- a/drivers/ata/sata_promise.c |
230 | +++ b/drivers/ata/sata_promise.c |
231 | @@ -147,6 +147,10 @@ struct pdc_port_priv { |
232 | dma_addr_t pkt_dma; |
233 | }; |
234 | |
235 | +struct pdc_host_priv { |
236 | + spinlock_t hard_reset_lock; |
237 | +}; |
238 | + |
239 | static int pdc_sata_scr_read(struct ata_link *link, unsigned int sc_reg, u32 *val); |
240 | static int pdc_sata_scr_write(struct ata_link *link, unsigned int sc_reg, u32 val); |
241 | static int pdc_ata_init_one(struct pci_dev *pdev, const struct pci_device_id *ent); |
242 | @@ -801,9 +805,10 @@ static void pdc_hard_reset_port(struct ata_port *ap) |
243 | void __iomem *host_mmio = ap->host->iomap[PDC_MMIO_BAR]; |
244 | void __iomem *pcictl_b1_mmio = host_mmio + PDC_PCI_CTL + 1; |
245 | unsigned int ata_no = pdc_ata_port_to_ata_no(ap); |
246 | + struct pdc_host_priv *hpriv = ap->host->private_data; |
247 | u8 tmp; |
248 | |
249 | - spin_lock(&ap->host->lock); |
250 | + spin_lock(&hpriv->hard_reset_lock); |
251 | |
252 | tmp = readb(pcictl_b1_mmio); |
253 | tmp &= ~(0x10 << ata_no); |
254 | @@ -814,7 +819,7 @@ static void pdc_hard_reset_port(struct ata_port *ap) |
255 | writeb(tmp, pcictl_b1_mmio); |
256 | readb(pcictl_b1_mmio); /* flush */ |
257 | |
258 | - spin_unlock(&ap->host->lock); |
259 | + spin_unlock(&hpriv->hard_reset_lock); |
260 | } |
261 | |
262 | static int pdc_sata_hardreset(struct ata_link *link, unsigned int *class, |
263 | @@ -1182,6 +1187,7 @@ static int pdc_ata_init_one(struct pci_dev *pdev, |
264 | const struct ata_port_info *pi = &pdc_port_info[ent->driver_data]; |
265 | const struct ata_port_info *ppi[PDC_MAX_PORTS]; |
266 | struct ata_host *host; |
267 | + struct pdc_host_priv *hpriv; |
268 | void __iomem *host_mmio; |
269 | int n_ports, i, rc; |
270 | int is_sataii_tx4; |
271 | @@ -1218,6 +1224,11 @@ static int pdc_ata_init_one(struct pci_dev *pdev, |
272 | dev_err(&pdev->dev, "failed to allocate host\n"); |
273 | return -ENOMEM; |
274 | } |
275 | + hpriv = devm_kzalloc(&pdev->dev, sizeof *hpriv, GFP_KERNEL); |
276 | + if (!hpriv) |
277 | + return -ENOMEM; |
278 | + spin_lock_init(&hpriv->hard_reset_lock); |
279 | + host->private_data = hpriv; |
280 | host->iomap = pcim_iomap_table(pdev); |
281 | |
282 | is_sataii_tx4 = pdc_is_sataii_tx4(pi->flags); |
283 | diff --git a/drivers/base/regmap/regmap-debugfs.c b/drivers/base/regmap/regmap-debugfs.c |
284 | index 251eb70..8ab1eab 100644 |
285 | --- a/drivers/base/regmap/regmap-debugfs.c |
286 | +++ b/drivers/base/regmap/regmap-debugfs.c |
287 | @@ -90,7 +90,7 @@ static ssize_t regmap_map_read_file(struct file *file, char __user *user_buf, |
288 | /* If we're in the region the user is trying to read */ |
289 | if (p >= *ppos) { |
290 | /* ...but not beyond it */ |
291 | - if (buf_pos >= count - 1 - tot_len) |
292 | + if (buf_pos + 1 + tot_len >= count) |
293 | break; |
294 | |
295 | /* Format the register */ |
296 | diff --git a/drivers/bcma/driver_mips.c b/drivers/bcma/driver_mips.c |
297 | index c3e9dff..041fddf 100644 |
298 | --- a/drivers/bcma/driver_mips.c |
299 | +++ b/drivers/bcma/driver_mips.c |
300 | @@ -115,7 +115,7 @@ static void bcma_core_mips_set_irq(struct bcma_device *dev, unsigned int irq) |
301 | bcma_read32(mdev, BCMA_MIPS_MIPS74K_INTMASK(0)) & |
302 | ~(1 << irqflag)); |
303 | else |
304 | - bcma_write32(mdev, BCMA_MIPS_MIPS74K_INTMASK(irq), 0); |
305 | + bcma_write32(mdev, BCMA_MIPS_MIPS74K_INTMASK(oldirq), 0); |
306 | |
307 | /* assign the new one */ |
308 | if (irq == 0) { |
309 | diff --git a/drivers/block/aoe/aoe.h b/drivers/block/aoe/aoe.h |
310 | index db195ab..e49ddd0 100644 |
311 | --- a/drivers/block/aoe/aoe.h |
312 | +++ b/drivers/block/aoe/aoe.h |
313 | @@ -1,5 +1,5 @@ |
314 | /* Copyright (c) 2007 Coraid, Inc. See COPYING for GPL terms. */ |
315 | -#define VERSION "47" |
316 | +#define VERSION "47q" |
317 | #define AOE_MAJOR 152 |
318 | #define DEVICE_NAME "aoe" |
319 | |
320 | diff --git a/drivers/block/aoe/aoeblk.c b/drivers/block/aoe/aoeblk.c |
321 | index 321de7b..7eca463 100644 |
322 | --- a/drivers/block/aoe/aoeblk.c |
323 | +++ b/drivers/block/aoe/aoeblk.c |
324 | @@ -276,8 +276,6 @@ aoeblk_gdalloc(void *vp) |
325 | goto err_mempool; |
326 | blk_queue_make_request(d->blkq, aoeblk_make_request); |
327 | d->blkq->backing_dev_info.name = "aoe"; |
328 | - if (bdi_init(&d->blkq->backing_dev_info)) |
329 | - goto err_blkq; |
330 | spin_lock_irqsave(&d->lock, flags); |
331 | gd->major = AOE_MAJOR; |
332 | gd->first_minor = d->sysminor * AOE_PARTITIONS; |
333 | @@ -298,9 +296,6 @@ aoeblk_gdalloc(void *vp) |
334 | aoedisk_add_sysfs(d); |
335 | return; |
336 | |
337 | -err_blkq: |
338 | - blk_cleanup_queue(d->blkq); |
339 | - d->blkq = NULL; |
340 | err_mempool: |
341 | mempool_destroy(d->bufpool); |
342 | err_disk: |
343 | diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c |
344 | index 7b33136..cba3d02 100644 |
345 | --- a/drivers/block/rbd.c |
346 | +++ b/drivers/block/rbd.c |
347 | @@ -71,7 +71,7 @@ |
348 | #define DEV_NAME_LEN 32 |
349 | #define MAX_INT_FORMAT_WIDTH ((5 * sizeof (int)) / 2 + 1) |
350 | |
351 | -#define RBD_NOTIFY_TIMEOUT_DEFAULT 10 |
352 | +#define RBD_READ_ONLY_DEFAULT false |
353 | |
354 | /* |
355 | * block device image metadata (in-memory version) |
356 | @@ -94,7 +94,7 @@ struct rbd_image_header { |
357 | }; |
358 | |
359 | struct rbd_options { |
360 | - int notify_timeout; |
361 | + bool read_only; |
362 | }; |
363 | |
364 | /* |
365 | @@ -174,9 +174,13 @@ struct rbd_device { |
366 | |
367 | /* protects updating the header */ |
368 | struct rw_semaphore header_rwsem; |
369 | + /* name of the snapshot this device reads from */ |
370 | char snap_name[RBD_MAX_SNAP_NAME_LEN]; |
371 | + /* id of the snapshot this device reads from */ |
372 | u64 snap_id; /* current snapshot id */ |
373 | - int read_only; |
374 | + /* whether the snap_id this device reads from still exists */ |
375 | + bool snap_exists; |
376 | + bool read_only; |
377 | |
378 | struct list_head node; |
379 | |
380 | @@ -185,6 +189,7 @@ struct rbd_device { |
381 | |
382 | /* sysfs related */ |
383 | struct device dev; |
384 | + unsigned long open_count; |
385 | }; |
386 | |
387 | static DEFINE_MUTEX(ctl_mutex); /* Serialize open/close/setup/teardown */ |
388 | @@ -197,10 +202,6 @@ static DEFINE_SPINLOCK(rbd_client_list_lock); |
389 | |
390 | static int __rbd_init_snaps_header(struct rbd_device *rbd_dev); |
391 | static void rbd_dev_release(struct device *dev); |
392 | -static ssize_t rbd_snap_add(struct device *dev, |
393 | - struct device_attribute *attr, |
394 | - const char *buf, |
395 | - size_t count); |
396 | static void __rbd_remove_snap_dev(struct rbd_device *rbd_dev, |
397 | struct rbd_snap *snap); |
398 | |
399 | @@ -246,13 +247,15 @@ static int rbd_open(struct block_device *bdev, fmode_t mode) |
400 | { |
401 | struct rbd_device *rbd_dev = bdev->bd_disk->private_data; |
402 | |
403 | - rbd_get_dev(rbd_dev); |
404 | - |
405 | - set_device_ro(bdev, rbd_dev->read_only); |
406 | - |
407 | if ((mode & FMODE_WRITE) && rbd_dev->read_only) |
408 | return -EROFS; |
409 | |
410 | + mutex_lock_nested(&ctl_mutex, SINGLE_DEPTH_NESTING); |
411 | + rbd_get_dev(rbd_dev); |
412 | + set_device_ro(bdev, rbd_dev->read_only); |
413 | + rbd_dev->open_count++; |
414 | + mutex_unlock(&ctl_mutex); |
415 | + |
416 | return 0; |
417 | } |
418 | |
419 | @@ -260,7 +263,11 @@ static int rbd_release(struct gendisk *disk, fmode_t mode) |
420 | { |
421 | struct rbd_device *rbd_dev = disk->private_data; |
422 | |
423 | + mutex_lock_nested(&ctl_mutex, SINGLE_DEPTH_NESTING); |
424 | + BUG_ON(!rbd_dev->open_count); |
425 | + rbd_dev->open_count--; |
426 | rbd_put_dev(rbd_dev); |
427 | + mutex_unlock(&ctl_mutex); |
428 | |
429 | return 0; |
430 | } |
431 | @@ -342,17 +349,24 @@ static struct rbd_client *__rbd_client_find(struct ceph_options *opt) |
432 | * mount options |
433 | */ |
434 | enum { |
435 | - Opt_notify_timeout, |
436 | Opt_last_int, |
437 | /* int args above */ |
438 | Opt_last_string, |
439 | /* string args above */ |
440 | + Opt_read_only, |
441 | + Opt_read_write, |
442 | + /* Boolean args above */ |
443 | + Opt_last_bool, |
444 | }; |
445 | |
446 | static match_table_t rbdopt_tokens = { |
447 | - {Opt_notify_timeout, "notify_timeout=%d"}, |
448 | /* int args above */ |
449 | /* string args above */ |
450 | + {Opt_read_only, "read_only"}, |
451 | + {Opt_read_only, "ro"}, /* Alternate spelling */ |
452 | + {Opt_read_write, "read_write"}, |
453 | + {Opt_read_write, "rw"}, /* Alternate spelling */ |
454 | + /* Boolean args above */ |
455 | {-1, NULL} |
456 | }; |
457 | |
458 | @@ -377,13 +391,18 @@ static int parse_rbd_opts_token(char *c, void *private) |
459 | } else if (token > Opt_last_int && token < Opt_last_string) { |
460 | dout("got string token %d val %s\n", token, |
461 | argstr[0].from); |
462 | + } else if (token > Opt_last_string && token < Opt_last_bool) { |
463 | + dout("got Boolean token %d\n", token); |
464 | } else { |
465 | dout("got token %d\n", token); |
466 | } |
467 | |
468 | switch (token) { |
469 | - case Opt_notify_timeout: |
470 | - rbdopt->notify_timeout = intval; |
471 | + case Opt_read_only: |
472 | + rbdopt->read_only = true; |
473 | + break; |
474 | + case Opt_read_write: |
475 | + rbdopt->read_only = false; |
476 | break; |
477 | default: |
478 | BUG_ON(token); |
479 | @@ -407,7 +426,7 @@ static struct rbd_client *rbd_get_client(const char *mon_addr, |
480 | if (!rbd_opts) |
481 | return ERR_PTR(-ENOMEM); |
482 | |
483 | - rbd_opts->notify_timeout = RBD_NOTIFY_TIMEOUT_DEFAULT; |
484 | + rbd_opts->read_only = RBD_READ_ONLY_DEFAULT; |
485 | |
486 | opt = ceph_parse_options(options, mon_addr, |
487 | mon_addr + mon_addr_len, |
488 | @@ -590,7 +609,8 @@ static int rbd_header_set_snap(struct rbd_device *dev, u64 *size) |
489 | else |
490 | snapc->seq = 0; |
491 | dev->snap_id = CEPH_NOSNAP; |
492 | - dev->read_only = 0; |
493 | + dev->snap_exists = false; |
494 | + dev->read_only = dev->rbd_client->rbd_opts->read_only; |
495 | if (size) |
496 | *size = header->image_size; |
497 | } else { |
498 | @@ -598,7 +618,8 @@ static int rbd_header_set_snap(struct rbd_device *dev, u64 *size) |
499 | if (ret < 0) |
500 | goto done; |
501 | dev->snap_id = snapc->seq; |
502 | - dev->read_only = 1; |
503 | + dev->snap_exists = true; |
504 | + dev->read_only = true; /* No choice for snapshots */ |
505 | } |
506 | |
507 | ret = 0; |
508 | @@ -609,7 +630,7 @@ done: |
509 | |
510 | static void rbd_header_free(struct rbd_image_header *header) |
511 | { |
512 | - kfree(header->snapc); |
513 | + ceph_put_snap_context(header->snapc); |
514 | kfree(header->snap_names); |
515 | kfree(header->snap_sizes); |
516 | } |
517 | @@ -887,13 +908,10 @@ static int rbd_do_request(struct request *rq, |
518 | |
519 | dout("rbd_do_request obj=%s ofs=%lld len=%lld\n", obj, len, ofs); |
520 | |
521 | - down_read(&dev->header_rwsem); |
522 | - |
523 | osdc = &dev->rbd_client->client->osdc; |
524 | req = ceph_osdc_alloc_request(osdc, flags, snapc, ops, |
525 | false, GFP_NOIO, pages, bio); |
526 | if (!req) { |
527 | - up_read(&dev->header_rwsem); |
528 | ret = -ENOMEM; |
529 | goto done_pages; |
530 | } |
531 | @@ -920,15 +938,15 @@ static int rbd_do_request(struct request *rq, |
532 | layout->fl_object_size = cpu_to_le32(1 << RBD_MAX_OBJ_ORDER); |
533 | layout->fl_pg_preferred = cpu_to_le32(-1); |
534 | layout->fl_pg_pool = cpu_to_le32(dev->poolid); |
535 | - ceph_calc_raw_layout(osdc, layout, snapid, ofs, &len, &bno, |
536 | - req, ops); |
537 | + ret = ceph_calc_raw_layout(osdc, layout, snapid, ofs, &len, &bno, |
538 | + req, ops); |
539 | + BUG_ON(ret != 0); |
540 | |
541 | ceph_osdc_build_request(req, ofs, &len, |
542 | ops, |
543 | snapc, |
544 | &mtime, |
545 | req->r_oid, req->r_oid_len); |
546 | - up_read(&dev->header_rwsem); |
547 | |
548 | if (linger_req) { |
549 | ceph_osdc_set_request_linger(osdc, req); |
550 | @@ -1193,7 +1211,7 @@ static int rbd_req_sync_notify_ack(struct rbd_device *dev, |
551 | if (ret < 0) |
552 | return ret; |
553 | |
554 | - ops[0].watch.ver = cpu_to_le64(dev->header.obj_version); |
555 | + ops[0].watch.ver = cpu_to_le64(ver); |
556 | ops[0].watch.cookie = notify_id; |
557 | ops[0].watch.flag = 0; |
558 | |
559 | @@ -1213,6 +1231,7 @@ static int rbd_req_sync_notify_ack(struct rbd_device *dev, |
560 | static void rbd_watch_cb(u64 ver, u64 notify_id, u8 opcode, void *data) |
561 | { |
562 | struct rbd_device *dev = (struct rbd_device *)data; |
563 | + u64 hver; |
564 | int rc; |
565 | |
566 | if (!dev) |
567 | @@ -1222,12 +1241,13 @@ static void rbd_watch_cb(u64 ver, u64 notify_id, u8 opcode, void *data) |
568 | notify_id, (int)opcode); |
569 | mutex_lock_nested(&ctl_mutex, SINGLE_DEPTH_NESTING); |
570 | rc = __rbd_update_snaps(dev); |
571 | + hver = dev->header.obj_version; |
572 | mutex_unlock(&ctl_mutex); |
573 | if (rc) |
574 | pr_warning(RBD_DRV_NAME "%d got notification but failed to " |
575 | " update snaps: %d\n", dev->major, rc); |
576 | |
577 | - rbd_req_sync_notify_ack(dev, ver, notify_id, dev->obj_md_name); |
578 | + rbd_req_sync_notify_ack(dev, hver, notify_id, dev->obj_md_name); |
579 | } |
580 | |
581 | /* |
582 | @@ -1304,71 +1324,7 @@ static int rbd_req_sync_unwatch(struct rbd_device *dev, |
583 | return ret; |
584 | } |
585 | |
586 | -struct rbd_notify_info { |
587 | - struct rbd_device *dev; |
588 | -}; |
589 | - |
590 | -static void rbd_notify_cb(u64 ver, u64 notify_id, u8 opcode, void *data) |
591 | -{ |
592 | - struct rbd_device *dev = (struct rbd_device *)data; |
593 | - if (!dev) |
594 | - return; |
595 | - |
596 | - dout("rbd_notify_cb %s notify_id=%lld opcode=%d\n", dev->obj_md_name, |
597 | - notify_id, (int)opcode); |
598 | -} |
599 | - |
600 | -/* |
601 | - * Request sync osd notify |
602 | - */ |
603 | -static int rbd_req_sync_notify(struct rbd_device *dev, |
604 | - const char *obj) |
605 | -{ |
606 | - struct ceph_osd_req_op *ops; |
607 | - struct ceph_osd_client *osdc = &dev->rbd_client->client->osdc; |
608 | - struct ceph_osd_event *event; |
609 | - struct rbd_notify_info info; |
610 | - int payload_len = sizeof(u32) + sizeof(u32); |
611 | - int ret; |
612 | - |
613 | - ret = rbd_create_rw_ops(&ops, 1, CEPH_OSD_OP_NOTIFY, payload_len); |
614 | - if (ret < 0) |
615 | - return ret; |
616 | - |
617 | - info.dev = dev; |
618 | - |
619 | - ret = ceph_osdc_create_event(osdc, rbd_notify_cb, 1, |
620 | - (void *)&info, &event); |
621 | - if (ret < 0) |
622 | - goto fail; |
623 | - |
624 | - ops[0].watch.ver = 1; |
625 | - ops[0].watch.flag = 1; |
626 | - ops[0].watch.cookie = event->cookie; |
627 | - ops[0].watch.prot_ver = RADOS_NOTIFY_VER; |
628 | - ops[0].watch.timeout = 12; |
629 | - |
630 | - ret = rbd_req_sync_op(dev, NULL, |
631 | - CEPH_NOSNAP, |
632 | - 0, |
633 | - CEPH_OSD_FLAG_WRITE | CEPH_OSD_FLAG_ONDISK, |
634 | - ops, |
635 | - 1, obj, 0, 0, NULL, NULL, NULL); |
636 | - if (ret < 0) |
637 | - goto fail_event; |
638 | - |
639 | - ret = ceph_osdc_wait_event(event, CEPH_OSD_TIMEOUT_DEFAULT); |
640 | - dout("ceph_osdc_wait_event returned %d\n", ret); |
641 | - rbd_destroy_ops(ops); |
642 | - return 0; |
643 | - |
644 | -fail_event: |
645 | - ceph_osdc_cancel_event(event); |
646 | -fail: |
647 | - rbd_destroy_ops(ops); |
648 | - return ret; |
649 | -} |
650 | - |
651 | +#if 0 |
652 | /* |
653 | * Request sync osd read |
654 | */ |
655 | @@ -1408,6 +1364,7 @@ static int rbd_req_sync_exec(struct rbd_device *dev, |
656 | dout("cls_exec returned %d\n", ret); |
657 | return ret; |
658 | } |
659 | +#endif |
660 | |
661 | static struct rbd_req_coll *rbd_alloc_coll(int num_reqs) |
662 | { |
663 | @@ -1440,6 +1397,7 @@ static void rbd_rq_fn(struct request_queue *q) |
664 | u64 ofs; |
665 | int num_segs, cur_seg = 0; |
666 | struct rbd_req_coll *coll; |
667 | + struct ceph_snap_context *snapc; |
668 | |
669 | /* peek at request from block layer */ |
670 | if (!rq) |
671 | @@ -1466,6 +1424,20 @@ static void rbd_rq_fn(struct request_queue *q) |
672 | |
673 | spin_unlock_irq(q->queue_lock); |
674 | |
675 | + down_read(&rbd_dev->header_rwsem); |
676 | + |
677 | + if (rbd_dev->snap_id != CEPH_NOSNAP && !rbd_dev->snap_exists) { |
678 | + up_read(&rbd_dev->header_rwsem); |
679 | + dout("request for non-existent snapshot"); |
680 | + spin_lock_irq(q->queue_lock); |
681 | + __blk_end_request_all(rq, -ENXIO); |
682 | + continue; |
683 | + } |
684 | + |
685 | + snapc = ceph_get_snap_context(rbd_dev->header.snapc); |
686 | + |
687 | + up_read(&rbd_dev->header_rwsem); |
688 | + |
689 | dout("%s 0x%x bytes at 0x%llx\n", |
690 | do_write ? "write" : "read", |
691 | size, blk_rq_pos(rq) * SECTOR_SIZE); |
692 | @@ -1475,6 +1447,7 @@ static void rbd_rq_fn(struct request_queue *q) |
693 | if (!coll) { |
694 | spin_lock_irq(q->queue_lock); |
695 | __blk_end_request_all(rq, -ENOMEM); |
696 | + ceph_put_snap_context(snapc); |
697 | continue; |
698 | } |
699 | |
700 | @@ -1498,7 +1471,7 @@ static void rbd_rq_fn(struct request_queue *q) |
701 | /* init OSD command: write or read */ |
702 | if (do_write) |
703 | rbd_req_write(rq, rbd_dev, |
704 | - rbd_dev->header.snapc, |
705 | + snapc, |
706 | ofs, |
707 | op_size, bio, |
708 | coll, cur_seg); |
709 | @@ -1521,6 +1494,8 @@ next_seg: |
710 | if (bp) |
711 | bio_pair_release(bp); |
712 | spin_lock_irq(q->queue_lock); |
713 | + |
714 | + ceph_put_snap_context(snapc); |
715 | } |
716 | } |
717 | |
718 | @@ -1624,57 +1599,6 @@ out_dh: |
719 | return rc; |
720 | } |
721 | |
722 | -/* |
723 | - * create a snapshot |
724 | - */ |
725 | -static int rbd_header_add_snap(struct rbd_device *dev, |
726 | - const char *snap_name, |
727 | - gfp_t gfp_flags) |
728 | -{ |
729 | - int name_len = strlen(snap_name); |
730 | - u64 new_snapid; |
731 | - int ret; |
732 | - void *data, *p, *e; |
733 | - u64 ver; |
734 | - struct ceph_mon_client *monc; |
735 | - |
736 | - /* we should create a snapshot only if we're pointing at the head */ |
737 | - if (dev->snap_id != CEPH_NOSNAP) |
738 | - return -EINVAL; |
739 | - |
740 | - monc = &dev->rbd_client->client->monc; |
741 | - ret = ceph_monc_create_snapid(monc, dev->poolid, &new_snapid); |
742 | - dout("created snapid=%lld\n", new_snapid); |
743 | - if (ret < 0) |
744 | - return ret; |
745 | - |
746 | - data = kmalloc(name_len + 16, gfp_flags); |
747 | - if (!data) |
748 | - return -ENOMEM; |
749 | - |
750 | - p = data; |
751 | - e = data + name_len + 16; |
752 | - |
753 | - ceph_encode_string_safe(&p, e, snap_name, name_len, bad); |
754 | - ceph_encode_64_safe(&p, e, new_snapid, bad); |
755 | - |
756 | - ret = rbd_req_sync_exec(dev, dev->obj_md_name, "rbd", "snap_add", |
757 | - data, p - data, &ver); |
758 | - |
759 | - kfree(data); |
760 | - |
761 | - if (ret < 0) |
762 | - return ret; |
763 | - |
764 | - down_write(&dev->header_rwsem); |
765 | - dev->header.snapc->seq = new_snapid; |
766 | - up_write(&dev->header_rwsem); |
767 | - |
768 | - return 0; |
769 | -bad: |
770 | - return -ERANGE; |
771 | -} |
772 | - |
773 | static void __rbd_remove_all_snaps(struct rbd_device *rbd_dev) |
774 | { |
775 | struct rbd_snap *snap; |
776 | @@ -1699,10 +1623,15 @@ static int __rbd_update_snaps(struct rbd_device *rbd_dev) |
777 | if (ret < 0) |
778 | return ret; |
779 | |
780 | + down_write(&rbd_dev->header_rwsem); |
781 | + |
782 | /* resized? */ |
783 | - set_capacity(rbd_dev->disk, h.image_size / SECTOR_SIZE); |
784 | + if (rbd_dev->snap_id == CEPH_NOSNAP) { |
785 | + sector_t size = (sector_t) h.image_size / SECTOR_SIZE; |
786 | |
787 | - down_write(&rbd_dev->header_rwsem); |
788 | + dout("setting size to %llu sectors", (unsigned long long) size); |
789 | + set_capacity(rbd_dev->disk, size); |
790 | + } |
791 | |
792 | snap_seq = rbd_dev->header.snapc->seq; |
793 | if (rbd_dev->header.total_snaps && |
794 | @@ -1711,10 +1640,12 @@ static int __rbd_update_snaps(struct rbd_device *rbd_dev) |
795 | if head moves */ |
796 | follow_seq = 1; |
797 | |
798 | - kfree(rbd_dev->header.snapc); |
799 | + ceph_put_snap_context(rbd_dev->header.snapc); |
800 | kfree(rbd_dev->header.snap_names); |
801 | kfree(rbd_dev->header.snap_sizes); |
802 | |
803 | + rbd_dev->header.obj_version = h.obj_version; |
804 | + rbd_dev->header.image_size = h.image_size; |
805 | rbd_dev->header.total_snaps = h.total_snaps; |
806 | rbd_dev->header.snapc = h.snapc; |
807 | rbd_dev->header.snap_names = h.snap_names; |
808 | @@ -1818,8 +1749,13 @@ static ssize_t rbd_size_show(struct device *dev, |
809 | struct device_attribute *attr, char *buf) |
810 | { |
811 | struct rbd_device *rbd_dev = dev_to_rbd_dev(dev); |
812 | + sector_t size; |
813 | + |
814 | + down_read(&rbd_dev->header_rwsem); |
815 | + size = get_capacity(rbd_dev->disk); |
816 | + up_read(&rbd_dev->header_rwsem); |
817 | |
818 | - return sprintf(buf, "%llu\n", (unsigned long long)rbd_dev->header.image_size); |
819 | + return sprintf(buf, "%llu\n", (unsigned long long) size * SECTOR_SIZE); |
820 | } |
821 | |
822 | static ssize_t rbd_major_show(struct device *dev, |
823 | @@ -1890,7 +1826,6 @@ static DEVICE_ATTR(pool, S_IRUGO, rbd_pool_show, NULL); |
824 | static DEVICE_ATTR(name, S_IRUGO, rbd_name_show, NULL); |
825 | static DEVICE_ATTR(refresh, S_IWUSR, NULL, rbd_image_refresh); |
826 | static DEVICE_ATTR(current_snap, S_IRUGO, rbd_snap_show, NULL); |
827 | -static DEVICE_ATTR(create_snap, S_IWUSR, NULL, rbd_snap_add); |
828 | |
829 | static struct attribute *rbd_attrs[] = { |
830 | &dev_attr_size.attr, |
831 | @@ -1900,7 +1835,6 @@ static struct attribute *rbd_attrs[] = { |
832 | &dev_attr_name.attr, |
833 | &dev_attr_current_snap.attr, |
834 | &dev_attr_refresh.attr, |
835 | - &dev_attr_create_snap.attr, |
836 | NULL |
837 | }; |
838 | |
839 | @@ -2069,7 +2003,14 @@ static int __rbd_init_snaps_header(struct rbd_device *rbd_dev) |
840 | cur_id = rbd_dev->header.snapc->snaps[i - 1]; |
841 | |
842 | if (!i || old_snap->id < cur_id) { |
843 | - /* old_snap->id was skipped, thus was removed */ |
844 | + /* |
845 | + * old_snap->id was skipped, thus was |
846 | + * removed. If this rbd_dev is mapped to |
847 | + * the removed snapshot, record that it no |
848 | + * longer exists, to prevent further I/O. |
849 | + */ |
850 | + if (rbd_dev->snap_id == old_snap->id) |
851 | + rbd_dev->snap_exists = false; |
852 | __rbd_remove_snap_dev(rbd_dev, old_snap); |
853 | continue; |
854 | } |
855 | @@ -2217,8 +2158,8 @@ static void rbd_id_put(struct rbd_device *rbd_dev) |
856 | struct rbd_device *rbd_dev; |
857 | |
858 | rbd_dev = list_entry(tmp, struct rbd_device, node); |
859 | - if (rbd_id > max_id) |
860 | - max_id = rbd_id; |
861 | + if (rbd_dev->id > max_id) |
862 | + max_id = rbd_dev->id; |
863 | } |
864 | spin_unlock(&rbd_dev_list_lock); |
865 | |
866 | @@ -2515,6 +2456,11 @@ static ssize_t rbd_remove(struct bus_type *bus, |
867 | goto done; |
868 | } |
869 | |
870 | + if (rbd_dev->open_count) { |
871 | + ret = -EBUSY; |
872 | + goto done; |
873 | + } |
874 | + |
875 | __rbd_remove_all_snaps(rbd_dev); |
876 | rbd_bus_del_dev(rbd_dev); |
877 | |
878 | @@ -2523,47 +2469,6 @@ done: |
879 | return ret; |
880 | } |
881 | |
882 | -static ssize_t rbd_snap_add(struct device *dev, |
883 | - struct device_attribute *attr, |
884 | - const char *buf, |
885 | - size_t count) |
886 | -{ |
887 | - struct rbd_device *rbd_dev = dev_to_rbd_dev(dev); |
888 | - int ret; |
889 | - char *name = kmalloc(count + 1, GFP_KERNEL); |
890 | - if (!name) |
891 | - return -ENOMEM; |
892 | - |
893 | - snprintf(name, count, "%s", buf); |
894 | - |
895 | - mutex_lock_nested(&ctl_mutex, SINGLE_DEPTH_NESTING); |
896 | - |
897 | - ret = rbd_header_add_snap(rbd_dev, |
898 | - name, GFP_KERNEL); |
899 | - if (ret < 0) |
900 | - goto err_unlock; |
901 | - |
902 | - ret = __rbd_update_snaps(rbd_dev); |
903 | - if (ret < 0) |
904 | - goto err_unlock; |
905 | - |
906 | - /* shouldn't hold ctl_mutex when notifying.. notify might |
907 | - trigger a watch callback that would need to get that mutex */ |
908 | - mutex_unlock(&ctl_mutex); |
909 | - |
910 | - /* make a best effort, don't error if failed */ |
911 | - rbd_req_sync_notify(rbd_dev, rbd_dev->obj_md_name); |
912 | - |
913 | - ret = count; |
914 | - kfree(name); |
915 | - return ret; |
916 | - |
917 | -err_unlock: |
918 | - mutex_unlock(&ctl_mutex); |
919 | - kfree(name); |
920 | - return ret; |
921 | -} |
922 | - |
923 | /* |
924 | * create control files in sysfs |
925 | * /sys/bus/rbd/... |
926 | diff --git a/drivers/firewire/net.c b/drivers/firewire/net.c |
927 | index 08c6749..638e1f7 100644 |
928 | --- a/drivers/firewire/net.c |
929 | +++ b/drivers/firewire/net.c |
930 | @@ -861,8 +861,8 @@ static void fwnet_receive_broadcast(struct fw_iso_context *context, |
931 | if (specifier_id == IANA_SPECIFIER_ID && ver == RFC2734_SW_VERSION) { |
932 | buf_ptr += 2; |
933 | length -= IEEE1394_GASP_HDR_SIZE; |
934 | - fwnet_incoming_packet(dev, buf_ptr, length, |
935 | - source_node_id, -1, true); |
936 | + fwnet_incoming_packet(dev, buf_ptr, length, source_node_id, |
937 | + context->card->generation, true); |
938 | } |
939 | |
940 | packet.payload_length = dev->rcv_buffer_size; |
941 | @@ -958,7 +958,12 @@ static void fwnet_transmit_packet_done(struct fwnet_packet_task *ptask) |
942 | break; |
943 | } |
944 | |
945 | - skb_pull(skb, ptask->max_payload); |
946 | + if (ptask->dest_node == IEEE1394_ALL_NODES) { |
947 | + skb_pull(skb, |
948 | + ptask->max_payload + IEEE1394_GASP_HDR_SIZE); |
949 | + } else { |
950 | + skb_pull(skb, ptask->max_payload); |
951 | + } |
952 | if (ptask->outstanding_pkts > 1) { |
953 | fwnet_make_sf_hdr(&ptask->hdr, RFC2374_HDR_INTFRAG, |
954 | dg_size, fg_off, datagram_label); |
955 | @@ -1062,7 +1067,7 @@ static int fwnet_send_packet(struct fwnet_packet_task *ptask) |
956 | smp_rmb(); |
957 | node_id = dev->card->node_id; |
958 | |
959 | - p = skb_push(ptask->skb, 8); |
960 | + p = skb_push(ptask->skb, IEEE1394_GASP_HDR_SIZE); |
961 | put_unaligned_be32(node_id << 16 | IANA_SPECIFIER_ID >> 8, p); |
962 | put_unaligned_be32((IANA_SPECIFIER_ID & 0xff) << 24 |
963 | | RFC2734_SW_VERSION, &p[4]); |
964 | diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c |
965 | index 6e38325..9d9835a 100644 |
966 | --- a/drivers/gpu/drm/drm_edid.c |
967 | +++ b/drivers/gpu/drm/drm_edid.c |
968 | @@ -66,6 +66,8 @@ |
969 | #define EDID_QUIRK_FIRST_DETAILED_PREFERRED (1 << 5) |
970 | /* use +hsync +vsync for detailed mode */ |
971 | #define EDID_QUIRK_DETAILED_SYNC_PP (1 << 6) |
972 | +/* Force reduced-blanking timings for detailed modes */ |
973 | +#define EDID_QUIRK_FORCE_REDUCED_BLANKING (1 << 7) |
974 | |
975 | struct detailed_mode_closure { |
976 | struct drm_connector *connector; |
977 | @@ -120,6 +122,9 @@ static struct edid_quirk { |
978 | /* Samsung SyncMaster 22[5-6]BW */ |
979 | { "SAM", 596, EDID_QUIRK_PREFER_LARGE_60 }, |
980 | { "SAM", 638, EDID_QUIRK_PREFER_LARGE_60 }, |
981 | + |
982 | + /* ViewSonic VA2026w */ |
983 | + { "VSC", 5020, EDID_QUIRK_FORCE_REDUCED_BLANKING }, |
984 | }; |
985 | |
986 | /*** DDC fetch and block validation ***/ |
987 | @@ -852,12 +857,19 @@ static struct drm_display_mode *drm_mode_detailed(struct drm_device *dev, |
988 | "Wrong Hsync/Vsync pulse width\n"); |
989 | return NULL; |
990 | } |
991 | + |
992 | + if (quirks & EDID_QUIRK_FORCE_REDUCED_BLANKING) { |
993 | + mode = drm_cvt_mode(dev, hactive, vactive, 60, true, false, false); |
994 | + if (!mode) |
995 | + return NULL; |
996 | + |
997 | + goto set_size; |
998 | + } |
999 | + |
1000 | mode = drm_mode_create(dev); |
1001 | if (!mode) |
1002 | return NULL; |
1003 | |
1004 | - mode->type = DRM_MODE_TYPE_DRIVER; |
1005 | - |
1006 | if (quirks & EDID_QUIRK_135_CLOCK_TOO_HIGH) |
1007 | timing->pixel_clock = cpu_to_le16(1088); |
1008 | |
1009 | @@ -881,8 +893,6 @@ static struct drm_display_mode *drm_mode_detailed(struct drm_device *dev, |
1010 | |
1011 | drm_mode_do_interlace_quirk(mode, pt); |
1012 | |
1013 | - drm_mode_set_name(mode); |
1014 | - |
1015 | if (quirks & EDID_QUIRK_DETAILED_SYNC_PP) { |
1016 | pt->misc |= DRM_EDID_PT_HSYNC_POSITIVE | DRM_EDID_PT_VSYNC_POSITIVE; |
1017 | } |
1018 | @@ -892,6 +902,7 @@ static struct drm_display_mode *drm_mode_detailed(struct drm_device *dev, |
1019 | mode->flags |= (pt->misc & DRM_EDID_PT_VSYNC_POSITIVE) ? |
1020 | DRM_MODE_FLAG_PVSYNC : DRM_MODE_FLAG_NVSYNC; |
1021 | |
1022 | +set_size: |
1023 | mode->width_mm = pt->width_mm_lo | (pt->width_height_mm_hi & 0xf0) << 4; |
1024 | mode->height_mm = pt->height_mm_lo | (pt->width_height_mm_hi & 0xf) << 8; |
1025 | |
1026 | @@ -905,6 +916,9 @@ static struct drm_display_mode *drm_mode_detailed(struct drm_device *dev, |
1027 | mode->height_mm = edid->height_cm * 10; |
1028 | } |
1029 | |
1030 | + mode->type = DRM_MODE_TYPE_DRIVER; |
1031 | + drm_mode_set_name(mode); |
1032 | + |
1033 | return mode; |
1034 | } |
1035 | |
1036 | diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c |
1037 | index ae8a64f..89f3d4a 100644 |
1038 | --- a/drivers/gpu/drm/i915/i915_drv.c |
1039 | +++ b/drivers/gpu/drm/i915/i915_drv.c |
1040 | @@ -224,6 +224,7 @@ static const struct intel_device_info intel_sandybridge_d_info = { |
1041 | .has_bsd_ring = 1, |
1042 | .has_blt_ring = 1, |
1043 | .has_llc = 1, |
1044 | + .has_force_wake = 1, |
1045 | }; |
1046 | |
1047 | static const struct intel_device_info intel_sandybridge_m_info = { |
1048 | @@ -233,6 +234,7 @@ static const struct intel_device_info intel_sandybridge_m_info = { |
1049 | .has_bsd_ring = 1, |
1050 | .has_blt_ring = 1, |
1051 | .has_llc = 1, |
1052 | + .has_force_wake = 1, |
1053 | }; |
1054 | |
1055 | static const struct intel_device_info intel_ivybridge_d_info = { |
1056 | @@ -241,6 +243,7 @@ static const struct intel_device_info intel_ivybridge_d_info = { |
1057 | .has_bsd_ring = 1, |
1058 | .has_blt_ring = 1, |
1059 | .has_llc = 1, |
1060 | + .has_force_wake = 1, |
1061 | }; |
1062 | |
1063 | static const struct intel_device_info intel_ivybridge_m_info = { |
1064 | @@ -250,6 +253,7 @@ static const struct intel_device_info intel_ivybridge_m_info = { |
1065 | .has_bsd_ring = 1, |
1066 | .has_blt_ring = 1, |
1067 | .has_llc = 1, |
1068 | + .has_force_wake = 1, |
1069 | }; |
1070 | |
1071 | static const struct pci_device_id pciidlist[] = { /* aka */ |
1072 | @@ -993,6 +997,12 @@ MODULE_AUTHOR(DRIVER_AUTHOR); |
1073 | MODULE_DESCRIPTION(DRIVER_DESC); |
1074 | MODULE_LICENSE("GPL and additional rights"); |
1075 | |
1076 | +/* We give fast paths for the really cool registers */ |
1077 | +#define NEEDS_FORCE_WAKE(dev_priv, reg) \ |
1078 | + ((HAS_FORCE_WAKE((dev_priv)->dev)) && \ |
1079 | + ((reg) < 0x40000) && \ |
1080 | + ((reg) != FORCEWAKE)) |
1081 | + |
1082 | #define __i915_read(x, y) \ |
1083 | u##x i915_read##x(struct drm_i915_private *dev_priv, u32 reg) { \ |
1084 | u##x val = 0; \ |
1085 | diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h |
1086 | index 5fabc6c..45c5cf8 100644 |
1087 | --- a/drivers/gpu/drm/i915/i915_drv.h |
1088 | +++ b/drivers/gpu/drm/i915/i915_drv.h |
1089 | @@ -255,6 +255,7 @@ struct intel_device_info { |
1090 | u8 is_broadwater:1; |
1091 | u8 is_crestline:1; |
1092 | u8 is_ivybridge:1; |
1093 | + u8 has_force_wake:1; |
1094 | u8 has_fbc:1; |
1095 | u8 has_pipe_cxsr:1; |
1096 | u8 has_hotplug:1; |
1097 | @@ -405,6 +406,8 @@ typedef struct drm_i915_private { |
1098 | unsigned int lvds_use_ssc:1; |
1099 | unsigned int display_clock_mode:1; |
1100 | int lvds_ssc_freq; |
1101 | + unsigned int bios_lvds_val; /* initial [PCH_]LVDS reg val in VBIOS */ |
1102 | + unsigned int lvds_val; /* used for checking LVDS channel mode */ |
1103 | struct { |
1104 | int rate; |
1105 | int lanes; |
1106 | @@ -1051,6 +1054,8 @@ struct drm_i915_file_private { |
1107 | #define HAS_PCH_CPT(dev) (INTEL_PCH_TYPE(dev) == PCH_CPT) |
1108 | #define HAS_PCH_IBX(dev) (INTEL_PCH_TYPE(dev) == PCH_IBX) |
1109 | |
1110 | +#define HAS_FORCE_WAKE(dev) (INTEL_INFO(dev)->has_force_wake) |
1111 | + |
1112 | #include "i915_trace.h" |
1113 | |
1114 | /** |
1115 | @@ -1450,12 +1455,6 @@ void gen6_gt_force_wake_get(struct drm_i915_private *dev_priv); |
1116 | void gen6_gt_force_wake_put(struct drm_i915_private *dev_priv); |
1117 | int __gen6_gt_wait_for_fifo(struct drm_i915_private *dev_priv); |
1118 | |
1119 | -/* We give fast paths for the really cool registers */ |
1120 | -#define NEEDS_FORCE_WAKE(dev_priv, reg) \ |
1121 | - (((dev_priv)->info->gen >= 6) && \ |
1122 | - ((reg) < 0x40000) && \ |
1123 | - ((reg) != FORCEWAKE)) |
1124 | - |
1125 | #define __i915_read(x, y) \ |
1126 | u##x i915_read##x(struct drm_i915_private *dev_priv, u32 reg); |
1127 | |
1128 | diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c |
1129 | index 0d1e4b7..a230a93 100644 |
1130 | --- a/drivers/gpu/drm/i915/i915_gem.c |
1131 | +++ b/drivers/gpu/drm/i915/i915_gem.c |
1132 | @@ -928,6 +928,7 @@ i915_gem_pwrite_ioctl(struct drm_device *dev, void *data, |
1133 | } |
1134 | |
1135 | if (obj->gtt_space && |
1136 | + obj->tiling_mode == I915_TILING_NONE && |
1137 | obj->base.write_domain != I915_GEM_DOMAIN_CPU) { |
1138 | ret = i915_gem_object_pin(obj, 0, true); |
1139 | if (ret) |
1140 | @@ -3317,7 +3318,8 @@ i915_gem_object_pin(struct drm_i915_gem_object *obj, |
1141 | struct drm_i915_private *dev_priv = dev->dev_private; |
1142 | int ret; |
1143 | |
1144 | - BUG_ON(obj->pin_count == DRM_I915_GEM_OBJECT_MAX_PIN_COUNT); |
1145 | + if (WARN_ON(obj->pin_count == DRM_I915_GEM_OBJECT_MAX_PIN_COUNT)) |
1146 | + return -EBUSY; |
1147 | WARN_ON(i915_verify_lists(dev)); |
1148 | |
1149 | if (obj->gtt_space != NULL) { |
1150 | diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c |
1151 | index 26c67a7..8bca2d2 100644 |
1152 | --- a/drivers/gpu/drm/i915/i915_irq.c |
1153 | +++ b/drivers/gpu/drm/i915/i915_irq.c |
1154 | @@ -530,6 +530,12 @@ static irqreturn_t ivybridge_irq_handler(DRM_IRQ_ARGS) |
1155 | if (de_iir & DE_GSE_IVB) |
1156 | intel_opregion_gse_intr(dev); |
1157 | |
1158 | + if (de_iir & DE_PIPEA_VBLANK_IVB) |
1159 | + drm_handle_vblank(dev, 0); |
1160 | + |
1161 | + if (de_iir & DE_PIPEB_VBLANK_IVB) |
1162 | + drm_handle_vblank(dev, 1); |
1163 | + |
1164 | if (de_iir & DE_PLANEA_FLIP_DONE_IVB) { |
1165 | intel_prepare_page_flip(dev, 0); |
1166 | intel_finish_page_flip_plane(dev, 0); |
1167 | @@ -540,12 +546,6 @@ static irqreturn_t ivybridge_irq_handler(DRM_IRQ_ARGS) |
1168 | intel_finish_page_flip_plane(dev, 1); |
1169 | } |
1170 | |
1171 | - if (de_iir & DE_PIPEA_VBLANK_IVB) |
1172 | - drm_handle_vblank(dev, 0); |
1173 | - |
1174 | - if (de_iir & DE_PIPEB_VBLANK_IVB) |
1175 | - drm_handle_vblank(dev, 1); |
1176 | - |
1177 | /* check event from PCH */ |
1178 | if (de_iir & DE_PCH_EVENT_IVB) { |
1179 | if (pch_iir & SDE_HOTPLUG_MASK_CPT) |
1180 | @@ -622,6 +622,12 @@ static irqreturn_t ironlake_irq_handler(DRM_IRQ_ARGS) |
1181 | if (de_iir & DE_GSE) |
1182 | intel_opregion_gse_intr(dev); |
1183 | |
1184 | + if (de_iir & DE_PIPEA_VBLANK) |
1185 | + drm_handle_vblank(dev, 0); |
1186 | + |
1187 | + if (de_iir & DE_PIPEB_VBLANK) |
1188 | + drm_handle_vblank(dev, 1); |
1189 | + |
1190 | if (de_iir & DE_PLANEA_FLIP_DONE) { |
1191 | intel_prepare_page_flip(dev, 0); |
1192 | intel_finish_page_flip_plane(dev, 0); |
1193 | @@ -632,12 +638,6 @@ static irqreturn_t ironlake_irq_handler(DRM_IRQ_ARGS) |
1194 | intel_finish_page_flip_plane(dev, 1); |
1195 | } |
1196 | |
1197 | - if (de_iir & DE_PIPEA_VBLANK) |
1198 | - drm_handle_vblank(dev, 0); |
1199 | - |
1200 | - if (de_iir & DE_PIPEB_VBLANK) |
1201 | - drm_handle_vblank(dev, 1); |
1202 | - |
1203 | /* check event from PCH */ |
1204 | if (de_iir & DE_PCH_EVENT) { |
1205 | if (pch_iir & hotplug_mask) |
1206 | @@ -2051,10 +2051,22 @@ static int i915_driver_irq_postinstall(struct drm_device *dev) |
1207 | hotplug_en |= HDMIC_HOTPLUG_INT_EN; |
1208 | if (dev_priv->hotplug_supported_mask & HDMID_HOTPLUG_INT_STATUS) |
1209 | hotplug_en |= HDMID_HOTPLUG_INT_EN; |
1210 | - if (dev_priv->hotplug_supported_mask & SDVOC_HOTPLUG_INT_STATUS) |
1211 | - hotplug_en |= SDVOC_HOTPLUG_INT_EN; |
1212 | - if (dev_priv->hotplug_supported_mask & SDVOB_HOTPLUG_INT_STATUS) |
1213 | - hotplug_en |= SDVOB_HOTPLUG_INT_EN; |
1214 | + if (IS_G4X(dev)) { |
1215 | + if (dev_priv->hotplug_supported_mask & SDVOC_HOTPLUG_INT_STATUS_G4X) |
1216 | + hotplug_en |= SDVOC_HOTPLUG_INT_EN; |
1217 | + if (dev_priv->hotplug_supported_mask & SDVOB_HOTPLUG_INT_STATUS_G4X) |
1218 | + hotplug_en |= SDVOB_HOTPLUG_INT_EN; |
1219 | + } else if (IS_GEN4(dev)) { |
1220 | + if (dev_priv->hotplug_supported_mask & SDVOC_HOTPLUG_INT_STATUS_I965) |
1221 | + hotplug_en |= SDVOC_HOTPLUG_INT_EN; |
1222 | + if (dev_priv->hotplug_supported_mask & SDVOB_HOTPLUG_INT_STATUS_I965) |
1223 | + hotplug_en |= SDVOB_HOTPLUG_INT_EN; |
1224 | + } else { |
1225 | + if (dev_priv->hotplug_supported_mask & SDVOC_HOTPLUG_INT_STATUS_I915) |
1226 | + hotplug_en |= SDVOC_HOTPLUG_INT_EN; |
1227 | + if (dev_priv->hotplug_supported_mask & SDVOB_HOTPLUG_INT_STATUS_I915) |
1228 | + hotplug_en |= SDVOB_HOTPLUG_INT_EN; |
1229 | + } |
1230 | if (dev_priv->hotplug_supported_mask & CRT_HOTPLUG_INT_STATUS) { |
1231 | hotplug_en |= CRT_HOTPLUG_INT_EN; |
1232 | |
1233 | diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h |
1234 | index 29bfd89..27a296a 100644 |
1235 | --- a/drivers/gpu/drm/i915/i915_reg.h |
1236 | +++ b/drivers/gpu/drm/i915/i915_reg.h |
1237 | @@ -197,6 +197,14 @@ |
1238 | #define MI_DISPLAY_FLIP MI_INSTR(0x14, 2) |
1239 | #define MI_DISPLAY_FLIP_I915 MI_INSTR(0x14, 1) |
1240 | #define MI_DISPLAY_FLIP_PLANE(n) ((n) << 20) |
1241 | +/* IVB has funny definitions for which plane to flip. */ |
1242 | +#define MI_DISPLAY_FLIP_IVB_PLANE_A (0 << 19) |
1243 | +#define MI_DISPLAY_FLIP_IVB_PLANE_B (1 << 19) |
1244 | +#define MI_DISPLAY_FLIP_IVB_SPRITE_A (2 << 19) |
1245 | +#define MI_DISPLAY_FLIP_IVB_SPRITE_B (3 << 19) |
1246 | +#define MI_DISPLAY_FLIP_IVB_PLANE_C (4 << 19) |
1247 | +#define MI_DISPLAY_FLIP_IVB_SPRITE_C (5 << 19) |
1248 | + |
1249 | #define MI_SET_CONTEXT MI_INSTR(0x18, 0) |
1250 | #define MI_MM_SPACE_GTT (1<<8) |
1251 | #define MI_MM_SPACE_PHYSICAL (0<<8) |
1252 | @@ -437,6 +445,9 @@ |
1253 | # define VS_TIMER_DISPATCH (1 << 6) |
1254 | # define MI_FLUSH_ENABLE (1 << 12) |
1255 | |
1256 | +#define GEN6_GT_MODE 0x20d0 |
1257 | +#define GEN6_GT_MODE_HI (1 << 9) |
1258 | + |
1259 | #define GFX_MODE 0x02520 |
1260 | #define GFX_MODE_GEN7 0x0229c |
1261 | #define RING_MODE_GEN7(ring) ((ring)->mmio_base+0x29c) |
1262 | @@ -1483,14 +1494,20 @@ |
1263 | #define DPC_HOTPLUG_INT_STATUS (1 << 28) |
1264 | #define HDMID_HOTPLUG_INT_STATUS (1 << 27) |
1265 | #define DPD_HOTPLUG_INT_STATUS (1 << 27) |
1266 | +/* CRT/TV common between gen3+ */ |
1267 | #define CRT_HOTPLUG_INT_STATUS (1 << 11) |
1268 | #define TV_HOTPLUG_INT_STATUS (1 << 10) |
1269 | #define CRT_HOTPLUG_MONITOR_MASK (3 << 8) |
1270 | #define CRT_HOTPLUG_MONITOR_COLOR (3 << 8) |
1271 | #define CRT_HOTPLUG_MONITOR_MONO (2 << 8) |
1272 | #define CRT_HOTPLUG_MONITOR_NONE (0 << 8) |
1273 | -#define SDVOC_HOTPLUG_INT_STATUS (1 << 7) |
1274 | -#define SDVOB_HOTPLUG_INT_STATUS (1 << 6) |
1275 | +/* SDVO is different across gen3/4 */ |
1276 | +#define SDVOC_HOTPLUG_INT_STATUS_G4X (1 << 3) |
1277 | +#define SDVOB_HOTPLUG_INT_STATUS_G4X (1 << 2) |
1278 | +#define SDVOC_HOTPLUG_INT_STATUS_I965 (3 << 4) |
1279 | +#define SDVOB_HOTPLUG_INT_STATUS_I965 (3 << 2) |
1280 | +#define SDVOC_HOTPLUG_INT_STATUS_I915 (1 << 7) |
1281 | +#define SDVOB_HOTPLUG_INT_STATUS_I915 (1 << 6) |
1282 | |
1283 | /* SDVO port control */ |
1284 | #define SDVOB 0x61140 |
1285 | @@ -3015,6 +3032,8 @@ |
1286 | #define _PFA_CTL_1 0x68080 |
1287 | #define _PFB_CTL_1 0x68880 |
1288 | #define PF_ENABLE (1<<31) |
1289 | +#define PF_PIPE_SEL_MASK_IVB (3<<29) |
1290 | +#define PF_PIPE_SEL_IVB(pipe) ((pipe)<<29) |
1291 | #define PF_FILTER_MASK (3<<23) |
1292 | #define PF_FILTER_PROGRAMMED (0<<23) |
1293 | #define PF_FILTER_MED_3x3 (1<<23) |
1294 | diff --git a/drivers/gpu/drm/i915/intel_bios.c b/drivers/gpu/drm/i915/intel_bios.c |
1295 | index 3fe0524..a2c9e56 100644 |
1296 | --- a/drivers/gpu/drm/i915/intel_bios.c |
1297 | +++ b/drivers/gpu/drm/i915/intel_bios.c |
1298 | @@ -174,6 +174,28 @@ get_lvds_dvo_timing(const struct bdb_lvds_lfp_data *lvds_lfp_data, |
1299 | return (struct lvds_dvo_timing *)(entry + dvo_timing_offset); |
1300 | } |
1301 | |
1302 | +/* get lvds_fp_timing entry |
1303 | + * this function may return NULL if the corresponding entry is invalid |
1304 | + */ |
1305 | +static const struct lvds_fp_timing * |
1306 | +get_lvds_fp_timing(const struct bdb_header *bdb, |
1307 | + const struct bdb_lvds_lfp_data *data, |
1308 | + const struct bdb_lvds_lfp_data_ptrs *ptrs, |
1309 | + int index) |
1310 | +{ |
1311 | + size_t data_ofs = (const u8 *)data - (const u8 *)bdb; |
1312 | + u16 data_size = ((const u16 *)data)[-1]; /* stored in header */ |
1313 | + size_t ofs; |
1314 | + |
1315 | + if (index >= ARRAY_SIZE(ptrs->ptr)) |
1316 | + return NULL; |
1317 | + ofs = ptrs->ptr[index].fp_timing_offset; |
1318 | + if (ofs < data_ofs || |
1319 | + ofs + sizeof(struct lvds_fp_timing) > data_ofs + data_size) |
1320 | + return NULL; |
1321 | + return (const struct lvds_fp_timing *)((const u8 *)bdb + ofs); |
1322 | +} |
1323 | + |
1324 | /* Try to find integrated panel data */ |
1325 | static void |
1326 | parse_lfp_panel_data(struct drm_i915_private *dev_priv, |
1327 | @@ -183,6 +205,7 @@ parse_lfp_panel_data(struct drm_i915_private *dev_priv, |
1328 | const struct bdb_lvds_lfp_data *lvds_lfp_data; |
1329 | const struct bdb_lvds_lfp_data_ptrs *lvds_lfp_data_ptrs; |
1330 | const struct lvds_dvo_timing *panel_dvo_timing; |
1331 | + const struct lvds_fp_timing *fp_timing; |
1332 | struct drm_display_mode *panel_fixed_mode; |
1333 | int i, downclock; |
1334 | |
1335 | @@ -244,6 +267,19 @@ parse_lfp_panel_data(struct drm_i915_private *dev_priv, |
1336 | "Normal Clock %dKHz, downclock %dKHz\n", |
1337 | panel_fixed_mode->clock, 10*downclock); |
1338 | } |
1339 | + |
1340 | + fp_timing = get_lvds_fp_timing(bdb, lvds_lfp_data, |
1341 | + lvds_lfp_data_ptrs, |
1342 | + lvds_options->panel_type); |
1343 | + if (fp_timing) { |
1344 | + /* check the resolution, just to be sure */ |
1345 | + if (fp_timing->x_res == panel_fixed_mode->hdisplay && |
1346 | + fp_timing->y_res == panel_fixed_mode->vdisplay) { |
1347 | + dev_priv->bios_lvds_val = fp_timing->lvds_reg_val; |
1348 | + DRM_DEBUG_KMS("VBT initial LVDS value %x\n", |
1349 | + dev_priv->bios_lvds_val); |
1350 | + } |
1351 | + } |
1352 | } |
1353 | |
1354 | /* Try to find sdvo panel data */ |
1355 | diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c |
1356 | index dd3e7e4..8e95c94 100644 |
1357 | --- a/drivers/gpu/drm/i915/intel_display.c |
1358 | +++ b/drivers/gpu/drm/i915/intel_display.c |
1359 | @@ -360,6 +360,27 @@ static const intel_limit_t intel_limits_ironlake_display_port = { |
1360 | .find_pll = intel_find_pll_ironlake_dp, |
1361 | }; |
1362 | |
1363 | +static bool is_dual_link_lvds(struct drm_i915_private *dev_priv, |
1364 | + unsigned int reg) |
1365 | +{ |
1366 | + unsigned int val; |
1367 | + |
1368 | + if (dev_priv->lvds_val) |
1369 | + val = dev_priv->lvds_val; |
1370 | + else { |
1371 | + /* BIOS should set the proper LVDS register value at boot, but |
1372 | + * in reality, it doesn't set the value when the lid is closed; |
1373 | + * we need to check "the value to be set" in VBT when LVDS |
1374 | + * register is uninitialized. |
1375 | + */ |
1376 | + val = I915_READ(reg); |
1377 | + if (!(val & ~LVDS_DETECTED)) |
1378 | + val = dev_priv->bios_lvds_val; |
1379 | + dev_priv->lvds_val = val; |
1380 | + } |
1381 | + return (val & LVDS_CLKB_POWER_MASK) == LVDS_CLKB_POWER_UP; |
1382 | +} |
1383 | + |
1384 | static const intel_limit_t *intel_ironlake_limit(struct drm_crtc *crtc, |
1385 | int refclk) |
1386 | { |
1387 | @@ -368,8 +389,7 @@ static const intel_limit_t *intel_ironlake_limit(struct drm_crtc *crtc, |
1388 | const intel_limit_t *limit; |
1389 | |
1390 | if (intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS)) { |
1391 | - if ((I915_READ(PCH_LVDS) & LVDS_CLKB_POWER_MASK) == |
1392 | - LVDS_CLKB_POWER_UP) { |
1393 | + if (is_dual_link_lvds(dev_priv, PCH_LVDS)) { |
1394 | /* LVDS dual channel */ |
1395 | if (refclk == 100000) |
1396 | limit = &intel_limits_ironlake_dual_lvds_100m; |
1397 | @@ -397,8 +417,7 @@ static const intel_limit_t *intel_g4x_limit(struct drm_crtc *crtc) |
1398 | const intel_limit_t *limit; |
1399 | |
1400 | if (intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS)) { |
1401 | - if ((I915_READ(LVDS) & LVDS_CLKB_POWER_MASK) == |
1402 | - LVDS_CLKB_POWER_UP) |
1403 | + if (is_dual_link_lvds(dev_priv, LVDS)) |
1404 | /* LVDS with dual channel */ |
1405 | limit = &intel_limits_g4x_dual_channel_lvds; |
1406 | else |
1407 | @@ -536,8 +555,7 @@ intel_find_best_PLL(const intel_limit_t *limit, struct drm_crtc *crtc, |
1408 | * reliably set up different single/dual channel state, if we |
1409 | * even can. |
1410 | */ |
1411 | - if ((I915_READ(LVDS) & LVDS_CLKB_POWER_MASK) == |
1412 | - LVDS_CLKB_POWER_UP) |
1413 | + if (is_dual_link_lvds(dev_priv, LVDS)) |
1414 | clock.p2 = limit->p2.p2_fast; |
1415 | else |
1416 | clock.p2 = limit->p2.p2_slow; |
1417 | @@ -2424,18 +2442,6 @@ static void intel_fdi_normal_train(struct drm_crtc *crtc) |
1418 | FDI_FE_ERRC_ENABLE); |
1419 | } |
1420 | |
1421 | -static void cpt_phase_pointer_enable(struct drm_device *dev, int pipe) |
1422 | -{ |
1423 | - struct drm_i915_private *dev_priv = dev->dev_private; |
1424 | - u32 flags = I915_READ(SOUTH_CHICKEN1); |
1425 | - |
1426 | - flags |= FDI_PHASE_SYNC_OVR(pipe); |
1427 | - I915_WRITE(SOUTH_CHICKEN1, flags); /* once to unlock... */ |
1428 | - flags |= FDI_PHASE_SYNC_EN(pipe); |
1429 | - I915_WRITE(SOUTH_CHICKEN1, flags); /* then again to enable */ |
1430 | - POSTING_READ(SOUTH_CHICKEN1); |
1431 | -} |
1432 | - |
1433 | /* The FDI link training functions for ILK/Ibexpeak. */ |
1434 | static void ironlake_fdi_link_train(struct drm_crtc *crtc) |
1435 | { |
1436 | @@ -2586,9 +2592,6 @@ static void gen6_fdi_link_train(struct drm_crtc *crtc) |
1437 | POSTING_READ(reg); |
1438 | udelay(150); |
1439 | |
1440 | - if (HAS_PCH_CPT(dev)) |
1441 | - cpt_phase_pointer_enable(dev, pipe); |
1442 | - |
1443 | for (i = 0; i < 4; i++) { |
1444 | reg = FDI_TX_CTL(pipe); |
1445 | temp = I915_READ(reg); |
1446 | @@ -2707,9 +2710,6 @@ static void ivb_manual_fdi_link_train(struct drm_crtc *crtc) |
1447 | POSTING_READ(reg); |
1448 | udelay(150); |
1449 | |
1450 | - if (HAS_PCH_CPT(dev)) |
1451 | - cpt_phase_pointer_enable(dev, pipe); |
1452 | - |
1453 | for (i = 0; i < 4; i++) { |
1454 | reg = FDI_TX_CTL(pipe); |
1455 | temp = I915_READ(reg); |
1456 | @@ -2819,17 +2819,6 @@ static void ironlake_fdi_pll_enable(struct drm_crtc *crtc) |
1457 | } |
1458 | } |
1459 | |
1460 | -static void cpt_phase_pointer_disable(struct drm_device *dev, int pipe) |
1461 | -{ |
1462 | - struct drm_i915_private *dev_priv = dev->dev_private; |
1463 | - u32 flags = I915_READ(SOUTH_CHICKEN1); |
1464 | - |
1465 | - flags &= ~(FDI_PHASE_SYNC_EN(pipe)); |
1466 | - I915_WRITE(SOUTH_CHICKEN1, flags); /* once to disable... */ |
1467 | - flags &= ~(FDI_PHASE_SYNC_OVR(pipe)); |
1468 | - I915_WRITE(SOUTH_CHICKEN1, flags); /* then again to lock */ |
1469 | - POSTING_READ(SOUTH_CHICKEN1); |
1470 | -} |
1471 | static void ironlake_fdi_disable(struct drm_crtc *crtc) |
1472 | { |
1473 | struct drm_device *dev = crtc->dev; |
1474 | @@ -2859,8 +2848,6 @@ static void ironlake_fdi_disable(struct drm_crtc *crtc) |
1475 | I915_WRITE(FDI_RX_CHICKEN(pipe), |
1476 | I915_READ(FDI_RX_CHICKEN(pipe) & |
1477 | ~FDI_RX_PHASE_SYNC_POINTER_EN)); |
1478 | - } else if (HAS_PCH_CPT(dev)) { |
1479 | - cpt_phase_pointer_disable(dev, pipe); |
1480 | } |
1481 | |
1482 | /* still set train pattern 1 */ |
1483 | @@ -2908,18 +2895,37 @@ static void intel_clear_scanline_wait(struct drm_device *dev) |
1484 | I915_WRITE_CTL(ring, tmp); |
1485 | } |
1486 | |
1487 | +static bool intel_crtc_has_pending_flip(struct drm_crtc *crtc) |
1488 | +{ |
1489 | + struct drm_device *dev = crtc->dev; |
1490 | + struct drm_i915_private *dev_priv = dev->dev_private; |
1491 | + unsigned long flags; |
1492 | + bool pending; |
1493 | + |
1494 | + if (atomic_read(&dev_priv->mm.wedged)) |
1495 | + return false; |
1496 | + |
1497 | + spin_lock_irqsave(&dev->event_lock, flags); |
1498 | + pending = to_intel_crtc(crtc)->unpin_work != NULL; |
1499 | + spin_unlock_irqrestore(&dev->event_lock, flags); |
1500 | + |
1501 | + return pending; |
1502 | +} |
1503 | + |
1504 | static void intel_crtc_wait_for_pending_flips(struct drm_crtc *crtc) |
1505 | { |
1506 | - struct drm_i915_gem_object *obj; |
1507 | - struct drm_i915_private *dev_priv; |
1508 | + struct drm_device *dev = crtc->dev; |
1509 | + struct drm_i915_private *dev_priv = dev->dev_private; |
1510 | |
1511 | if (crtc->fb == NULL) |
1512 | return; |
1513 | |
1514 | - obj = to_intel_framebuffer(crtc->fb)->obj; |
1515 | - dev_priv = crtc->dev->dev_private; |
1516 | wait_event(dev_priv->pending_flip_queue, |
1517 | - atomic_read(&obj->pending_flip) == 0); |
1518 | + !intel_crtc_has_pending_flip(crtc)); |
1519 | + |
1520 | + mutex_lock(&dev->struct_mutex); |
1521 | + intel_finish_fb(crtc->fb); |
1522 | + mutex_unlock(&dev->struct_mutex); |
1523 | } |
1524 | |
1525 | static bool intel_crtc_driving_pch(struct drm_crtc *crtc) |
1526 | @@ -3095,7 +3101,11 @@ static void ironlake_crtc_enable(struct drm_crtc *crtc) |
1527 | * as some pre-programmed values are broken, |
1528 | * e.g. x201. |
1529 | */ |
1530 | - I915_WRITE(PF_CTL(pipe), PF_ENABLE | PF_FILTER_MED_3x3); |
1531 | + if (IS_IVYBRIDGE(dev)) |
1532 | + I915_WRITE(PF_CTL(pipe), PF_ENABLE | PF_FILTER_MED_3x3 | |
1533 | + PF_PIPE_SEL_IVB(pipe)); |
1534 | + else |
1535 | + I915_WRITE(PF_CTL(pipe), PF_ENABLE | PF_FILTER_MED_3x3); |
1536 | I915_WRITE(PF_WIN_POS(pipe), dev_priv->pch_pf_pos); |
1537 | I915_WRITE(PF_WIN_SZ(pipe), dev_priv->pch_pf_size); |
1538 | } |
1539 | @@ -3381,23 +3391,6 @@ static void intel_crtc_disable(struct drm_crtc *crtc) |
1540 | struct drm_crtc_helper_funcs *crtc_funcs = crtc->helper_private; |
1541 | struct drm_device *dev = crtc->dev; |
1542 | |
1543 | - /* Flush any pending WAITs before we disable the pipe. Note that |
1544 | - * we need to drop the struct_mutex in order to acquire it again |
1545 | - * during the lowlevel dpms routines around a couple of the |
1546 | - * operations. It does not look trivial nor desirable to move |
1547 | - * that locking higher. So instead we leave a window for the |
1548 | - * submission of further commands on the fb before we can actually |
1549 | - * disable it. This race with userspace exists anyway, and we can |
1550 | - * only rely on the pipe being disabled by userspace after it |
1551 | - * receives the hotplug notification and has flushed any pending |
1552 | - * batches. |
1553 | - */ |
1554 | - if (crtc->fb) { |
1555 | - mutex_lock(&dev->struct_mutex); |
1556 | - intel_finish_fb(crtc->fb); |
1557 | - mutex_unlock(&dev->struct_mutex); |
1558 | - } |
1559 | - |
1560 | crtc_funcs->dpms(crtc, DRM_MODE_DPMS_OFF); |
1561 | assert_plane_disabled(dev->dev_private, to_intel_crtc(crtc)->plane); |
1562 | assert_pipe_disabled(dev->dev_private, to_intel_crtc(crtc)->pipe); |
1563 | @@ -7286,9 +7279,8 @@ static void do_intel_finish_page_flip(struct drm_device *dev, |
1564 | |
1565 | atomic_clear_mask(1 << intel_crtc->plane, |
1566 | &obj->pending_flip.counter); |
1567 | - if (atomic_read(&obj->pending_flip) == 0) |
1568 | - wake_up(&dev_priv->pending_flip_queue); |
1569 | |
1570 | + wake_up(&dev_priv->pending_flip_queue); |
1571 | schedule_work(&work->work); |
1572 | |
1573 | trace_i915_flip_complete(intel_crtc->plane, work->pending_flip_obj); |
1574 | @@ -7340,14 +7332,14 @@ static int intel_gen2_queue_flip(struct drm_device *dev, |
1575 | |
1576 | ret = intel_pin_and_fence_fb_obj(dev, obj, LP_RING(dev_priv)); |
1577 | if (ret) |
1578 | - goto out; |
1579 | + goto err; |
1580 | |
1581 | /* Offset into the new buffer for cases of shared fbs between CRTCs */ |
1582 | offset = crtc->y * fb->pitches[0] + crtc->x * fb->bits_per_pixel/8; |
1583 | |
1584 | ret = BEGIN_LP_RING(6); |
1585 | if (ret) |
1586 | - goto out; |
1587 | + goto err_unpin; |
1588 | |
1589 | /* Can't queue multiple flips, so wait for the previous |
1590 | * one to finish before executing the next. |
1591 | @@ -7364,7 +7356,11 @@ static int intel_gen2_queue_flip(struct drm_device *dev, |
1592 | OUT_RING(obj->gtt_offset + offset); |
1593 | OUT_RING(0); /* aux display base address, unused */ |
1594 | ADVANCE_LP_RING(); |
1595 | -out: |
1596 | + return 0; |
1597 | + |
1598 | +err_unpin: |
1599 | + intel_unpin_fb_obj(obj); |
1600 | +err: |
1601 | return ret; |
1602 | } |
1603 | |
1604 | @@ -7381,14 +7377,14 @@ static int intel_gen3_queue_flip(struct drm_device *dev, |
1605 | |
1606 | ret = intel_pin_and_fence_fb_obj(dev, obj, LP_RING(dev_priv)); |
1607 | if (ret) |
1608 | - goto out; |
1609 | + goto err; |
1610 | |
1611 | /* Offset into the new buffer for cases of shared fbs between CRTCs */ |
1612 | offset = crtc->y * fb->pitches[0] + crtc->x * fb->bits_per_pixel/8; |
1613 | |
1614 | ret = BEGIN_LP_RING(6); |
1615 | if (ret) |
1616 | - goto out; |
1617 | + goto err_unpin; |
1618 | |
1619 | if (intel_crtc->plane) |
1620 | flip_mask = MI_WAIT_FOR_PLANE_B_FLIP; |
1621 | @@ -7403,7 +7399,11 @@ static int intel_gen3_queue_flip(struct drm_device *dev, |
1622 | OUT_RING(MI_NOOP); |
1623 | |
1624 | ADVANCE_LP_RING(); |
1625 | -out: |
1626 | + return 0; |
1627 | + |
1628 | +err_unpin: |
1629 | + intel_unpin_fb_obj(obj); |
1630 | +err: |
1631 | return ret; |
1632 | } |
1633 | |
1634 | @@ -7419,11 +7419,11 @@ static int intel_gen4_queue_flip(struct drm_device *dev, |
1635 | |
1636 | ret = intel_pin_and_fence_fb_obj(dev, obj, LP_RING(dev_priv)); |
1637 | if (ret) |
1638 | - goto out; |
1639 | + goto err; |
1640 | |
1641 | ret = BEGIN_LP_RING(4); |
1642 | if (ret) |
1643 | - goto out; |
1644 | + goto err_unpin; |
1645 | |
1646 | /* i965+ uses the linear or tiled offsets from the |
1647 | * Display Registers (which do not change across a page-flip) |
1648 | @@ -7442,7 +7442,11 @@ static int intel_gen4_queue_flip(struct drm_device *dev, |
1649 | pipesrc = I915_READ(PIPESRC(intel_crtc->pipe)) & 0x0fff0fff; |
1650 | OUT_RING(pf | pipesrc); |
1651 | ADVANCE_LP_RING(); |
1652 | -out: |
1653 | + return 0; |
1654 | + |
1655 | +err_unpin: |
1656 | + intel_unpin_fb_obj(obj); |
1657 | +err: |
1658 | return ret; |
1659 | } |
1660 | |
1661 | @@ -7458,11 +7462,11 @@ static int intel_gen6_queue_flip(struct drm_device *dev, |
1662 | |
1663 | ret = intel_pin_and_fence_fb_obj(dev, obj, LP_RING(dev_priv)); |
1664 | if (ret) |
1665 | - goto out; |
1666 | + goto err; |
1667 | |
1668 | ret = BEGIN_LP_RING(4); |
1669 | if (ret) |
1670 | - goto out; |
1671 | + goto err_unpin; |
1672 | |
1673 | OUT_RING(MI_DISPLAY_FLIP | |
1674 | MI_DISPLAY_FLIP_PLANE(intel_crtc->plane)); |
1675 | @@ -7479,7 +7483,11 @@ static int intel_gen6_queue_flip(struct drm_device *dev, |
1676 | pipesrc = I915_READ(PIPESRC(intel_crtc->pipe)) & 0x0fff0fff; |
1677 | OUT_RING(pf | pipesrc); |
1678 | ADVANCE_LP_RING(); |
1679 | -out: |
1680 | + return 0; |
1681 | + |
1682 | +err_unpin: |
1683 | + intel_unpin_fb_obj(obj); |
1684 | +err: |
1685 | return ret; |
1686 | } |
1687 | |
1688 | @@ -7497,22 +7505,43 @@ static int intel_gen7_queue_flip(struct drm_device *dev, |
1689 | struct drm_i915_private *dev_priv = dev->dev_private; |
1690 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); |
1691 | struct intel_ring_buffer *ring = &dev_priv->ring[BCS]; |
1692 | + uint32_t plane_bit = 0; |
1693 | int ret; |
1694 | |
1695 | ret = intel_pin_and_fence_fb_obj(dev, obj, ring); |
1696 | if (ret) |
1697 | - goto out; |
1698 | + goto err; |
1699 | + |
1700 | + switch(intel_crtc->plane) { |
1701 | + case PLANE_A: |
1702 | + plane_bit = MI_DISPLAY_FLIP_IVB_PLANE_A; |
1703 | + break; |
1704 | + case PLANE_B: |
1705 | + plane_bit = MI_DISPLAY_FLIP_IVB_PLANE_B; |
1706 | + break; |
1707 | + case PLANE_C: |
1708 | + plane_bit = MI_DISPLAY_FLIP_IVB_PLANE_C; |
1709 | + break; |
1710 | + default: |
1711 | + WARN_ONCE(1, "unknown plane in flip command\n"); |
1712 | + ret = -ENODEV; |
1713 | + goto err_unpin; |
1714 | + } |
1715 | |
1716 | ret = intel_ring_begin(ring, 4); |
1717 | if (ret) |
1718 | - goto out; |
1719 | + goto err_unpin; |
1720 | |
1721 | - intel_ring_emit(ring, MI_DISPLAY_FLIP_I915 | (intel_crtc->plane << 19)); |
1722 | + intel_ring_emit(ring, MI_DISPLAY_FLIP_I915 | plane_bit); |
1723 | intel_ring_emit(ring, (fb->pitches[0] | obj->tiling_mode)); |
1724 | intel_ring_emit(ring, (obj->gtt_offset)); |
1725 | intel_ring_emit(ring, (MI_NOOP)); |
1726 | intel_ring_advance(ring); |
1727 | -out: |
1728 | + return 0; |
1729 | + |
1730 | +err_unpin: |
1731 | + intel_unpin_fb_obj(obj); |
1732 | +err: |
1733 | return ret; |
1734 | } |
1735 | |
1736 | @@ -8611,6 +8640,11 @@ static void gen6_init_clock_gating(struct drm_device *dev) |
1737 | DISPPLANE_TRICKLE_FEED_DISABLE); |
1738 | intel_flush_display_plane(dev_priv, pipe); |
1739 | } |
1740 | + |
1741 | + /* The default value should be 0x200 according to docs, but the two |
1742 | + * platforms I checked have a 0 for this. (Maybe BIOS overrides?) */ |
1743 | + I915_WRITE(GEN6_GT_MODE, 0xffff << 16); |
1744 | + I915_WRITE(GEN6_GT_MODE, GEN6_GT_MODE_HI << 16 | GEN6_GT_MODE_HI); |
1745 | } |
1746 | |
1747 | static void gen7_setup_fixed_func_scheduler(struct drm_i915_private *dev_priv) |
1748 | diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c |
1749 | index fb44e9d..c60100d 100644 |
1750 | --- a/drivers/gpu/drm/i915/intel_hdmi.c |
1751 | +++ b/drivers/gpu/drm/i915/intel_hdmi.c |
1752 | @@ -138,14 +138,17 @@ static void i9xx_write_infoframe(struct drm_encoder *encoder, |
1753 | |
1754 | I915_WRITE(VIDEO_DIP_CTL, VIDEO_DIP_ENABLE | val | port | flags); |
1755 | |
1756 | + mmiowb(); |
1757 | for (i = 0; i < len; i += 4) { |
1758 | I915_WRITE(VIDEO_DIP_DATA, *data); |
1759 | data++; |
1760 | } |
1761 | + mmiowb(); |
1762 | |
1763 | flags |= intel_infoframe_flags(frame); |
1764 | |
1765 | I915_WRITE(VIDEO_DIP_CTL, VIDEO_DIP_ENABLE | val | port | flags); |
1766 | + POSTING_READ(VIDEO_DIP_CTL); |
1767 | } |
1768 | |
1769 | static void ironlake_write_infoframe(struct drm_encoder *encoder, |
1770 | @@ -168,14 +171,17 @@ static void ironlake_write_infoframe(struct drm_encoder *encoder, |
1771 | |
1772 | I915_WRITE(reg, VIDEO_DIP_ENABLE | val | flags); |
1773 | |
1774 | + mmiowb(); |
1775 | for (i = 0; i < len; i += 4) { |
1776 | I915_WRITE(TVIDEO_DIP_DATA(intel_crtc->pipe), *data); |
1777 | data++; |
1778 | } |
1779 | + mmiowb(); |
1780 | |
1781 | flags |= intel_infoframe_flags(frame); |
1782 | |
1783 | I915_WRITE(reg, VIDEO_DIP_ENABLE | val | flags); |
1784 | + POSTING_READ(reg); |
1785 | } |
1786 | static void intel_set_infoframe(struct drm_encoder *encoder, |
1787 | struct dip_infoframe *frame) |
1788 | @@ -549,10 +555,13 @@ void intel_hdmi_init(struct drm_device *dev, int sdvox_reg) |
1789 | if (!HAS_PCH_SPLIT(dev)) { |
1790 | intel_hdmi->write_infoframe = i9xx_write_infoframe; |
1791 | I915_WRITE(VIDEO_DIP_CTL, 0); |
1792 | + POSTING_READ(VIDEO_DIP_CTL); |
1793 | } else { |
1794 | intel_hdmi->write_infoframe = ironlake_write_infoframe; |
1795 | - for_each_pipe(i) |
1796 | + for_each_pipe(i) { |
1797 | I915_WRITE(TVIDEO_DIP_CTL(i), 0); |
1798 | + POSTING_READ(TVIDEO_DIP_CTL(i)); |
1799 | + } |
1800 | } |
1801 | |
1802 | drm_encoder_helper_add(&intel_encoder->base, &intel_hdmi_helper_funcs); |
1803 | diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c |
1804 | index 802fec2..a8b28c4 100644 |
1805 | --- a/drivers/gpu/drm/i915/intel_lvds.c |
1806 | +++ b/drivers/gpu/drm/i915/intel_lvds.c |
1807 | @@ -779,14 +779,6 @@ static const struct dmi_system_id intel_no_lvds[] = { |
1808 | }, |
1809 | { |
1810 | .callback = intel_no_lvds_dmi_callback, |
1811 | - .ident = "ZOTAC ZBOXSD-ID12/ID13", |
1812 | - .matches = { |
1813 | - DMI_MATCH(DMI_BOARD_VENDOR, "ZOTAC"), |
1814 | - DMI_MATCH(DMI_BOARD_NAME, "ZBOXSD-ID12/ID13"), |
1815 | - }, |
1816 | - }, |
1817 | - { |
1818 | - .callback = intel_no_lvds_dmi_callback, |
1819 | .ident = "Gigabyte GA-D525TUD", |
1820 | .matches = { |
1821 | DMI_MATCH(DMI_BOARD_VENDOR, "Gigabyte Technology Co., Ltd."), |
1822 | diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c |
1823 | index 302d3d5..c17325c 100644 |
1824 | --- a/drivers/gpu/drm/i915/intel_ringbuffer.c |
1825 | +++ b/drivers/gpu/drm/i915/intel_ringbuffer.c |
1826 | @@ -249,10 +249,15 @@ u32 intel_ring_get_active_head(struct intel_ring_buffer *ring) |
1827 | |
1828 | static int init_ring_common(struct intel_ring_buffer *ring) |
1829 | { |
1830 | - drm_i915_private_t *dev_priv = ring->dev->dev_private; |
1831 | + struct drm_device *dev = ring->dev; |
1832 | + drm_i915_private_t *dev_priv = dev->dev_private; |
1833 | struct drm_i915_gem_object *obj = ring->obj; |
1834 | + int ret = 0; |
1835 | u32 head; |
1836 | |
1837 | + if (HAS_FORCE_WAKE(dev)) |
1838 | + gen6_gt_force_wake_get(dev_priv); |
1839 | + |
1840 | /* Stop the ring if it's running. */ |
1841 | I915_WRITE_CTL(ring, 0); |
1842 | I915_WRITE_HEAD(ring, 0); |
1843 | @@ -290,9 +295,9 @@ static int init_ring_common(struct intel_ring_buffer *ring) |
1844 | | RING_VALID); |
1845 | |
1846 | /* If the head is still not zero, the ring is dead */ |
1847 | - if ((I915_READ_CTL(ring) & RING_VALID) == 0 || |
1848 | - I915_READ_START(ring) != obj->gtt_offset || |
1849 | - (I915_READ_HEAD(ring) & HEAD_ADDR) != 0) { |
1850 | + if (wait_for((I915_READ_CTL(ring) & RING_VALID) != 0 && |
1851 | + I915_READ_START(ring) == obj->gtt_offset && |
1852 | + (I915_READ_HEAD(ring) & HEAD_ADDR) == 0, 50)) { |
1853 | DRM_ERROR("%s initialization failed " |
1854 | "ctl %08x head %08x tail %08x start %08x\n", |
1855 | ring->name, |
1856 | @@ -300,7 +305,8 @@ static int init_ring_common(struct intel_ring_buffer *ring) |
1857 | I915_READ_HEAD(ring), |
1858 | I915_READ_TAIL(ring), |
1859 | I915_READ_START(ring)); |
1860 | - return -EIO; |
1861 | + ret = -EIO; |
1862 | + goto out; |
1863 | } |
1864 | |
1865 | if (!drm_core_check_feature(ring->dev, DRIVER_MODESET)) |
1866 | @@ -312,7 +318,11 @@ static int init_ring_common(struct intel_ring_buffer *ring) |
1867 | ring->last_retired_head = -1; |
1868 | } |
1869 | |
1870 | - return 0; |
1871 | +out: |
1872 | + if (HAS_FORCE_WAKE(dev)) |
1873 | + gen6_gt_force_wake_put(dev_priv); |
1874 | + |
1875 | + return ret; |
1876 | } |
1877 | |
1878 | static int |
1879 | diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c |
1880 | index b96e8c8..1b6b157 100644 |
1881 | --- a/drivers/gpu/drm/i915/intel_sdvo.c |
1882 | +++ b/drivers/gpu/drm/i915/intel_sdvo.c |
1883 | @@ -2528,6 +2528,7 @@ bool intel_sdvo_init(struct drm_device *dev, int sdvo_reg) |
1884 | struct drm_i915_private *dev_priv = dev->dev_private; |
1885 | struct intel_encoder *intel_encoder; |
1886 | struct intel_sdvo *intel_sdvo; |
1887 | + u32 hotplug_mask; |
1888 | int i; |
1889 | |
1890 | intel_sdvo = kzalloc(sizeof(struct intel_sdvo), GFP_KERNEL); |
1891 | @@ -2558,10 +2559,17 @@ bool intel_sdvo_init(struct drm_device *dev, int sdvo_reg) |
1892 | } |
1893 | } |
1894 | |
1895 | - if (IS_SDVOB(sdvo_reg)) |
1896 | - dev_priv->hotplug_supported_mask |= SDVOB_HOTPLUG_INT_STATUS; |
1897 | - else |
1898 | - dev_priv->hotplug_supported_mask |= SDVOC_HOTPLUG_INT_STATUS; |
1899 | + hotplug_mask = 0; |
1900 | + if (IS_G4X(dev)) { |
1901 | + hotplug_mask = IS_SDVOB(sdvo_reg) ? |
1902 | + SDVOB_HOTPLUG_INT_STATUS_G4X : SDVOC_HOTPLUG_INT_STATUS_G4X; |
1903 | + } else if (IS_GEN4(dev)) { |
1904 | + hotplug_mask = IS_SDVOB(sdvo_reg) ? |
1905 | + SDVOB_HOTPLUG_INT_STATUS_I965 : SDVOC_HOTPLUG_INT_STATUS_I965; |
1906 | + } else { |
1907 | + hotplug_mask = IS_SDVOB(sdvo_reg) ? |
1908 | + SDVOB_HOTPLUG_INT_STATUS_I915 : SDVOC_HOTPLUG_INT_STATUS_I915; |
1909 | + } |
1910 | |
1911 | drm_encoder_helper_add(&intel_encoder->base, &intel_sdvo_helper_funcs); |
1912 | |
1913 | @@ -2569,14 +2577,6 @@ bool intel_sdvo_init(struct drm_device *dev, int sdvo_reg) |
1914 | if (!intel_sdvo_get_capabilities(intel_sdvo, &intel_sdvo->caps)) |
1915 | goto err; |
1916 | |
1917 | - /* Set up hotplug command - note paranoia about contents of reply. |
1918 | - * We assume that the hardware is in a sane state, and only touch |
1919 | - * the bits we think we understand. |
1920 | - */ |
1921 | - intel_sdvo_get_value(intel_sdvo, SDVO_CMD_GET_ACTIVE_HOT_PLUG, |
1922 | - &intel_sdvo->hotplug_active, 2); |
1923 | - intel_sdvo->hotplug_active[0] &= ~0x3; |
1924 | - |
1925 | if (intel_sdvo_output_setup(intel_sdvo, |
1926 | intel_sdvo->caps.output_flags) != true) { |
1927 | DRM_DEBUG_KMS("SDVO output failed to setup on SDVO%c\n", |
1928 | @@ -2584,6 +2584,12 @@ bool intel_sdvo_init(struct drm_device *dev, int sdvo_reg) |
1929 | goto err; |
1930 | } |
1931 | |
1932 | + /* Only enable the hotplug irq if we need it, to work around noisy |
1933 | + * hotplug lines. |
1934 | + */ |
1935 | + if (intel_sdvo->hotplug_active[0]) |
1936 | + dev_priv->hotplug_supported_mask |= hotplug_mask; |
1937 | + |
1938 | intel_sdvo_select_ddc_bus(dev_priv, intel_sdvo, sdvo_reg); |
1939 | |
1940 | /* Set the input timing to the screen. Assume always input 0. */ |
1941 | diff --git a/drivers/gpu/drm/nouveau/nv04_dfp.c b/drivers/gpu/drm/nouveau/nv04_dfp.c |
1942 | index 473f30a..71b6235 100644 |
1943 | --- a/drivers/gpu/drm/nouveau/nv04_dfp.c |
1944 | +++ b/drivers/gpu/drm/nouveau/nv04_dfp.c |
1945 | @@ -504,7 +504,7 @@ static void nv04_dfp_update_backlight(struct drm_encoder *encoder, int mode) |
1946 | |
1947 | static inline bool is_powersaving_dpms(int mode) |
1948 | { |
1949 | - return (mode != DRM_MODE_DPMS_ON); |
1950 | + return mode != DRM_MODE_DPMS_ON && mode != NV_DPMS_CLEARED; |
1951 | } |
1952 | |
1953 | static void nv04_lvds_dpms(struct drm_encoder *encoder, int mode) |
1954 | diff --git a/drivers/gpu/drm/radeon/atombios_crtc.c b/drivers/gpu/drm/radeon/atombios_crtc.c |
1955 | index 19f4082..15594a3 100644 |
1956 | --- a/drivers/gpu/drm/radeon/atombios_crtc.c |
1957 | +++ b/drivers/gpu/drm/radeon/atombios_crtc.c |
1958 | @@ -1533,8 +1533,12 @@ static int radeon_atom_pick_pll(struct drm_crtc *crtc) |
1959 | * crtc virtual pixel clock. |
1960 | */ |
1961 | if (ENCODER_MODE_IS_DP(atombios_get_encoder_mode(test_encoder))) { |
1962 | - if (ASIC_IS_DCE5(rdev) || rdev->clock.dp_extclk) |
1963 | + if (rdev->clock.dp_extclk) |
1964 | return ATOM_PPLL_INVALID; |
1965 | + else if (ASIC_IS_DCE6(rdev)) |
1966 | + return ATOM_PPLL0; |
1967 | + else if (ASIC_IS_DCE5(rdev)) |
1968 | + return ATOM_DCPLL; |
1969 | } |
1970 | } |
1971 | } |
1972 | diff --git a/drivers/gpu/drm/radeon/atombios_encoders.c b/drivers/gpu/drm/radeon/atombios_encoders.c |
1973 | index f6176bc..23e3ea6 100644 |
1974 | --- a/drivers/gpu/drm/radeon/atombios_encoders.c |
1975 | +++ b/drivers/gpu/drm/radeon/atombios_encoders.c |
1976 | @@ -95,7 +95,7 @@ static bool radeon_atom_mode_fixup(struct drm_encoder *encoder, |
1977 | ((radeon_encoder->active_device & (ATOM_DEVICE_DFP_SUPPORT | ATOM_DEVICE_LCD_SUPPORT)) || |
1978 | (radeon_encoder_get_dp_bridge_encoder_id(encoder) != ENCODER_OBJECT_ID_NONE))) { |
1979 | struct drm_connector *connector = radeon_get_connector_for_encoder(encoder); |
1980 | - radeon_dp_set_link_config(connector, mode); |
1981 | + radeon_dp_set_link_config(connector, adjusted_mode); |
1982 | } |
1983 | |
1984 | return true; |
1985 | diff --git a/drivers/gpu/drm/radeon/evergreen_cs.c b/drivers/gpu/drm/radeon/evergreen_cs.c |
1986 | index 22c84bc..2cbd369 100644 |
1987 | --- a/drivers/gpu/drm/radeon/evergreen_cs.c |
1988 | +++ b/drivers/gpu/drm/radeon/evergreen_cs.c |
1989 | @@ -2670,6 +2670,7 @@ static bool evergreen_vm_reg_valid(u32 reg) |
1990 | |
1991 | /* check config regs */ |
1992 | switch (reg) { |
1993 | + case WAIT_UNTIL: |
1994 | case GRBM_GFX_INDEX: |
1995 | case CP_STRMOUT_CNTL: |
1996 | case CP_COHER_CNTL: |
1997 | diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c b/drivers/gpu/drm/radeon/radeon_connectors.c |
1998 | index 3fb7ca9..ab63bcd 100644 |
1999 | --- a/drivers/gpu/drm/radeon/radeon_connectors.c |
2000 | +++ b/drivers/gpu/drm/radeon/radeon_connectors.c |
2001 | @@ -689,7 +689,7 @@ radeon_vga_detect(struct drm_connector *connector, bool force) |
2002 | ret = connector_status_disconnected; |
2003 | |
2004 | if (radeon_connector->ddc_bus) |
2005 | - dret = radeon_ddc_probe(radeon_connector); |
2006 | + dret = radeon_ddc_probe(radeon_connector, false); |
2007 | if (dret) { |
2008 | radeon_connector->detected_by_load = false; |
2009 | if (radeon_connector->edid) { |
2010 | @@ -895,7 +895,7 @@ radeon_dvi_detect(struct drm_connector *connector, bool force) |
2011 | return connector->status; |
2012 | |
2013 | if (radeon_connector->ddc_bus) |
2014 | - dret = radeon_ddc_probe(radeon_connector); |
2015 | + dret = radeon_ddc_probe(radeon_connector, false); |
2016 | if (dret) { |
2017 | radeon_connector->detected_by_load = false; |
2018 | if (radeon_connector->edid) { |
2019 | @@ -1335,7 +1335,8 @@ radeon_dp_detect(struct drm_connector *connector, bool force) |
2020 | if (encoder) { |
2021 | /* setup ddc on the bridge */ |
2022 | radeon_atom_ext_encoder_setup_ddc(encoder); |
2023 | - if (radeon_ddc_probe(radeon_connector)) /* try DDC */ |
2024 | + /* bridge chips are always aux */ |
2025 | + if (radeon_ddc_probe(radeon_connector, true)) /* try DDC */ |
2026 | ret = connector_status_connected; |
2027 | else if (radeon_connector->dac_load_detect) { /* try load detection */ |
2028 | struct drm_encoder_helper_funcs *encoder_funcs = encoder->helper_private; |
2029 | @@ -1353,7 +1354,8 @@ radeon_dp_detect(struct drm_connector *connector, bool force) |
2030 | if (radeon_dp_getdpcd(radeon_connector)) |
2031 | ret = connector_status_connected; |
2032 | } else { |
2033 | - if (radeon_ddc_probe(radeon_connector)) |
2034 | + /* try non-aux ddc (DP to DVI/HMDI/etc. adapter) */ |
2035 | + if (radeon_ddc_probe(radeon_connector, false)) |
2036 | ret = connector_status_connected; |
2037 | } |
2038 | } |
2039 | diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c |
2040 | index 0a1d4bd..173b97b 100644 |
2041 | --- a/drivers/gpu/drm/radeon/radeon_display.c |
2042 | +++ b/drivers/gpu/drm/radeon/radeon_display.c |
2043 | @@ -713,10 +713,15 @@ int radeon_ddc_get_modes(struct radeon_connector *radeon_connector) |
2044 | if (radeon_connector->router.ddc_valid) |
2045 | radeon_router_select_ddc_port(radeon_connector); |
2046 | |
2047 | - if ((radeon_connector->base.connector_type == DRM_MODE_CONNECTOR_DisplayPort) || |
2048 | - (radeon_connector->base.connector_type == DRM_MODE_CONNECTOR_eDP) || |
2049 | - (radeon_connector_encoder_get_dp_bridge_encoder_id(&radeon_connector->base) != |
2050 | - ENCODER_OBJECT_ID_NONE)) { |
2051 | + if (radeon_connector_encoder_get_dp_bridge_encoder_id(&radeon_connector->base) != |
2052 | + ENCODER_OBJECT_ID_NONE) { |
2053 | + struct radeon_connector_atom_dig *dig = radeon_connector->con_priv; |
2054 | + |
2055 | + if (dig->dp_i2c_bus) |
2056 | + radeon_connector->edid = drm_get_edid(&radeon_connector->base, |
2057 | + &dig->dp_i2c_bus->adapter); |
2058 | + } else if ((radeon_connector->base.connector_type == DRM_MODE_CONNECTOR_DisplayPort) || |
2059 | + (radeon_connector->base.connector_type == DRM_MODE_CONNECTOR_eDP)) { |
2060 | struct radeon_connector_atom_dig *dig = radeon_connector->con_priv; |
2061 | |
2062 | if ((dig->dp_sink_type == CONNECTOR_OBJECT_ID_DISPLAYPORT || |
2063 | diff --git a/drivers/gpu/drm/radeon/radeon_i2c.c b/drivers/gpu/drm/radeon/radeon_i2c.c |
2064 | index 3edec1c..6076e85 100644 |
2065 | --- a/drivers/gpu/drm/radeon/radeon_i2c.c |
2066 | +++ b/drivers/gpu/drm/radeon/radeon_i2c.c |
2067 | @@ -39,7 +39,7 @@ extern u32 radeon_atom_hw_i2c_func(struct i2c_adapter *adap); |
2068 | * radeon_ddc_probe |
2069 | * |
2070 | */ |
2071 | -bool radeon_ddc_probe(struct radeon_connector *radeon_connector) |
2072 | +bool radeon_ddc_probe(struct radeon_connector *radeon_connector, bool use_aux) |
2073 | { |
2074 | u8 out = 0x0; |
2075 | u8 buf[8]; |
2076 | @@ -63,7 +63,13 @@ bool radeon_ddc_probe(struct radeon_connector *radeon_connector) |
2077 | if (radeon_connector->router.ddc_valid) |
2078 | radeon_router_select_ddc_port(radeon_connector); |
2079 | |
2080 | - ret = i2c_transfer(&radeon_connector->ddc_bus->adapter, msgs, 2); |
2081 | + if (use_aux) { |
2082 | + struct radeon_connector_atom_dig *dig = radeon_connector->con_priv; |
2083 | + ret = i2c_transfer(&dig->dp_i2c_bus->adapter, msgs, 2); |
2084 | + } else { |
2085 | + ret = i2c_transfer(&radeon_connector->ddc_bus->adapter, msgs, 2); |
2086 | + } |
2087 | + |
2088 | if (ret != 2) |
2089 | /* Couldn't find an accessible DDC on this connector */ |
2090 | return false; |
2091 | diff --git a/drivers/gpu/drm/radeon/radeon_legacy_encoders.c b/drivers/gpu/drm/radeon/radeon_legacy_encoders.c |
2092 | index d92f483..53b07a3 100644 |
2093 | --- a/drivers/gpu/drm/radeon/radeon_legacy_encoders.c |
2094 | +++ b/drivers/gpu/drm/radeon/radeon_legacy_encoders.c |
2095 | @@ -617,6 +617,14 @@ static enum drm_connector_status radeon_legacy_primary_dac_detect(struct drm_enc |
2096 | enum drm_connector_status found = connector_status_disconnected; |
2097 | bool color = true; |
2098 | |
2099 | + /* just don't bother on RN50 those chip are often connected to remoting |
2100 | + * console hw and often we get failure to load detect those. So to make |
2101 | + * everyone happy report the encoder as always connected. |
2102 | + */ |
2103 | + if (ASIC_IS_RN50(rdev)) { |
2104 | + return connector_status_connected; |
2105 | + } |
2106 | + |
2107 | /* save the regs we need */ |
2108 | vclk_ecp_cntl = RREG32_PLL(RADEON_VCLK_ECP_CNTL); |
2109 | crtc_ext_cntl = RREG32(RADEON_CRTC_EXT_CNTL); |
2110 | diff --git a/drivers/gpu/drm/radeon/radeon_mode.h b/drivers/gpu/drm/radeon/radeon_mode.h |
2111 | index 778c1f0..dabfefd 100644 |
2112 | --- a/drivers/gpu/drm/radeon/radeon_mode.h |
2113 | +++ b/drivers/gpu/drm/radeon/radeon_mode.h |
2114 | @@ -527,7 +527,7 @@ extern void radeon_i2c_put_byte(struct radeon_i2c_chan *i2c, |
2115 | u8 val); |
2116 | extern void radeon_router_select_ddc_port(struct radeon_connector *radeon_connector); |
2117 | extern void radeon_router_select_cd_port(struct radeon_connector *radeon_connector); |
2118 | -extern bool radeon_ddc_probe(struct radeon_connector *radeon_connector); |
2119 | +extern bool radeon_ddc_probe(struct radeon_connector *radeon_connector, bool use_aux); |
2120 | extern int radeon_ddc_get_modes(struct radeon_connector *radeon_connector); |
2121 | |
2122 | extern struct drm_encoder *radeon_best_encoder(struct drm_connector *connector); |
2123 | diff --git a/drivers/gpu/drm/udl/udl_connector.c b/drivers/gpu/drm/udl/udl_connector.c |
2124 | index 8d9dc44..3234224 100644 |
2125 | --- a/drivers/gpu/drm/udl/udl_connector.c |
2126 | +++ b/drivers/gpu/drm/udl/udl_connector.c |
2127 | @@ -22,13 +22,17 @@ |
2128 | static u8 *udl_get_edid(struct udl_device *udl) |
2129 | { |
2130 | u8 *block; |
2131 | - char rbuf[3]; |
2132 | + char *rbuf; |
2133 | int ret, i; |
2134 | |
2135 | block = kmalloc(EDID_LENGTH, GFP_KERNEL); |
2136 | if (block == NULL) |
2137 | return NULL; |
2138 | |
2139 | + rbuf = kmalloc(2, GFP_KERNEL); |
2140 | + if (rbuf == NULL) |
2141 | + goto error; |
2142 | + |
2143 | for (i = 0; i < EDID_LENGTH; i++) { |
2144 | ret = usb_control_msg(udl->ddev->usbdev, |
2145 | usb_rcvctrlpipe(udl->ddev->usbdev, 0), (0x02), |
2146 | @@ -36,16 +40,17 @@ static u8 *udl_get_edid(struct udl_device *udl) |
2147 | HZ); |
2148 | if (ret < 1) { |
2149 | DRM_ERROR("Read EDID byte %d failed err %x\n", i, ret); |
2150 | - i--; |
2151 | goto error; |
2152 | } |
2153 | block[i] = rbuf[1]; |
2154 | } |
2155 | |
2156 | + kfree(rbuf); |
2157 | return block; |
2158 | |
2159 | error: |
2160 | kfree(block); |
2161 | + kfree(rbuf); |
2162 | return NULL; |
2163 | } |
2164 | |
2165 | @@ -59,6 +64,14 @@ static int udl_get_modes(struct drm_connector *connector) |
2166 | |
2167 | connector->display_info.raw_edid = (char *)edid; |
2168 | |
2169 | + /* |
2170 | + * We only read the main block, but if the monitor reports extension |
2171 | + * blocks then the drm edid code expects them to be present, so patch |
2172 | + * the extension count to 0. |
2173 | + */ |
2174 | + edid->checksum += edid->extensions; |
2175 | + edid->extensions = 0; |
2176 | + |
2177 | drm_mode_connector_update_edid_property(connector, edid); |
2178 | ret = drm_add_edid_modes(connector, edid); |
2179 | connector->display_info.raw_edid = NULL; |
2180 | diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h |
2181 | index 41ad6ff..5583899 100644 |
2182 | --- a/drivers/hid/hid-ids.h |
2183 | +++ b/drivers/hid/hid-ids.h |
2184 | @@ -664,6 +664,9 @@ |
2185 | #define USB_VENDOR_ID_SIGMA_MICRO 0x1c4f |
2186 | #define USB_DEVICE_ID_SIGMA_MICRO_KEYBOARD 0x0002 |
2187 | |
2188 | +#define USB_VENDOR_ID_SIGMATEL 0x066F |
2189 | +#define USB_DEVICE_ID_SIGMATEL_STMP3780 0x3780 |
2190 | + |
2191 | #define USB_VENDOR_ID_SKYCABLE 0x1223 |
2192 | #define USB_DEVICE_ID_SKYCABLE_WIRELESS_PRESENTER 0x3F07 |
2193 | |
2194 | diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c |
2195 | index dc9697c..9fea98f 100644 |
2196 | --- a/drivers/hid/usbhid/hid-quirks.c |
2197 | +++ b/drivers/hid/usbhid/hid-quirks.c |
2198 | @@ -78,6 +78,7 @@ static const struct hid_blacklist { |
2199 | { USB_VENDOR_ID_QUANTA, USB_DEVICE_ID_PIXART_IMAGING_INC_OPTICAL_TOUCH_SCREEN, HID_QUIRK_NOGET }, |
2200 | { USB_VENDOR_ID_QUANTA, USB_DEVICE_ID_QUANTA_OPTICAL_TOUCH_3008, HID_QUIRK_NOGET }, |
2201 | { USB_VENDOR_ID_SENNHEISER, USB_DEVICE_ID_SENNHEISER_BTD500USB, HID_QUIRK_NOGET }, |
2202 | + { USB_VENDOR_ID_SIGMATEL, USB_DEVICE_ID_SIGMATEL_STMP3780, HID_QUIRK_NOGET }, |
2203 | { USB_VENDOR_ID_SUN, USB_DEVICE_ID_RARITAN_KVM_DONGLE, HID_QUIRK_NOGET }, |
2204 | { USB_VENDOR_ID_SYMBOL, USB_DEVICE_ID_SYMBOL_SCANNER_1, HID_QUIRK_NOGET }, |
2205 | { USB_VENDOR_ID_SYMBOL, USB_DEVICE_ID_SYMBOL_SCANNER_2, HID_QUIRK_NOGET }, |
2206 | diff --git a/drivers/hwmon/lm73.c b/drivers/hwmon/lm73.c |
2207 | index 8fa2632..7272176 100644 |
2208 | --- a/drivers/hwmon/lm73.c |
2209 | +++ b/drivers/hwmon/lm73.c |
2210 | @@ -49,6 +49,7 @@ static ssize_t set_temp(struct device *dev, struct device_attribute *da, |
2211 | struct i2c_client *client = to_i2c_client(dev); |
2212 | long temp; |
2213 | short value; |
2214 | + s32 err; |
2215 | |
2216 | int status = kstrtol(buf, 10, &temp); |
2217 | if (status < 0) |
2218 | @@ -57,8 +58,8 @@ static ssize_t set_temp(struct device *dev, struct device_attribute *da, |
2219 | /* Write value */ |
2220 | value = (short) SENSORS_LIMIT(temp/250, (LM73_TEMP_MIN*4), |
2221 | (LM73_TEMP_MAX*4)) << 5; |
2222 | - i2c_smbus_write_word_swapped(client, attr->index, value); |
2223 | - return count; |
2224 | + err = i2c_smbus_write_word_swapped(client, attr->index, value); |
2225 | + return (err < 0) ? err : count; |
2226 | } |
2227 | |
2228 | static ssize_t show_temp(struct device *dev, struct device_attribute *da, |
2229 | @@ -66,11 +67,16 @@ static ssize_t show_temp(struct device *dev, struct device_attribute *da, |
2230 | { |
2231 | struct sensor_device_attribute *attr = to_sensor_dev_attr(da); |
2232 | struct i2c_client *client = to_i2c_client(dev); |
2233 | + int temp; |
2234 | + |
2235 | + s32 err = i2c_smbus_read_word_swapped(client, attr->index); |
2236 | + if (err < 0) |
2237 | + return err; |
2238 | + |
2239 | /* use integer division instead of equivalent right shift to |
2240 | guarantee arithmetic shift and preserve the sign */ |
2241 | - int temp = ((s16) (i2c_smbus_read_word_swapped(client, |
2242 | - attr->index))*250) / 32; |
2243 | - return sprintf(buf, "%d\n", temp); |
2244 | + temp = (((s16) err) * 250) / 32; |
2245 | + return scnprintf(buf, PAGE_SIZE, "%d\n", temp); |
2246 | } |
2247 | |
2248 | |
2249 | diff --git a/drivers/infiniband/hw/nes/nes.h b/drivers/infiniband/hw/nes/nes.h |
2250 | index c438e46..3f41d9f 100644 |
2251 | --- a/drivers/infiniband/hw/nes/nes.h |
2252 | +++ b/drivers/infiniband/hw/nes/nes.h |
2253 | @@ -524,6 +524,7 @@ void nes_iwarp_ce_handler(struct nes_device *, struct nes_hw_cq *); |
2254 | int nes_destroy_cqp(struct nes_device *); |
2255 | int nes_nic_cm_xmit(struct sk_buff *, struct net_device *); |
2256 | void nes_recheck_link_status(struct work_struct *work); |
2257 | +void nes_terminate_timeout(unsigned long context); |
2258 | |
2259 | /* nes_nic.c */ |
2260 | struct net_device *nes_netdev_init(struct nes_device *, void __iomem *); |
2261 | diff --git a/drivers/infiniband/hw/nes/nes_hw.c b/drivers/infiniband/hw/nes/nes_hw.c |
2262 | index d42c9f4..96801c3 100644 |
2263 | --- a/drivers/infiniband/hw/nes/nes_hw.c |
2264 | +++ b/drivers/infiniband/hw/nes/nes_hw.c |
2265 | @@ -75,7 +75,6 @@ static void nes_process_iwarp_aeqe(struct nes_device *nesdev, |
2266 | static void process_critical_error(struct nes_device *nesdev); |
2267 | static void nes_process_mac_intr(struct nes_device *nesdev, u32 mac_number); |
2268 | static unsigned int nes_reset_adapter_ne020(struct nes_device *nesdev, u8 *OneG_Mode); |
2269 | -static void nes_terminate_timeout(unsigned long context); |
2270 | static void nes_terminate_start_timer(struct nes_qp *nesqp); |
2271 | |
2272 | #ifdef CONFIG_INFINIBAND_NES_DEBUG |
2273 | @@ -3522,7 +3521,7 @@ static void nes_terminate_received(struct nes_device *nesdev, |
2274 | } |
2275 | |
2276 | /* Timeout routine in case terminate fails to complete */ |
2277 | -static void nes_terminate_timeout(unsigned long context) |
2278 | +void nes_terminate_timeout(unsigned long context) |
2279 | { |
2280 | struct nes_qp *nesqp = (struct nes_qp *)(unsigned long)context; |
2281 | |
2282 | @@ -3532,11 +3531,7 @@ static void nes_terminate_timeout(unsigned long context) |
2283 | /* Set a timer in case hw cannot complete the terminate sequence */ |
2284 | static void nes_terminate_start_timer(struct nes_qp *nesqp) |
2285 | { |
2286 | - init_timer(&nesqp->terminate_timer); |
2287 | - nesqp->terminate_timer.function = nes_terminate_timeout; |
2288 | - nesqp->terminate_timer.expires = jiffies + HZ; |
2289 | - nesqp->terminate_timer.data = (unsigned long)nesqp; |
2290 | - add_timer(&nesqp->terminate_timer); |
2291 | + mod_timer(&nesqp->terminate_timer, (jiffies + HZ)); |
2292 | } |
2293 | |
2294 | /** |
2295 | diff --git a/drivers/infiniband/hw/nes/nes_verbs.c b/drivers/infiniband/hw/nes/nes_verbs.c |
2296 | index 8b8812d..da84ea3 100644 |
2297 | --- a/drivers/infiniband/hw/nes/nes_verbs.c |
2298 | +++ b/drivers/infiniband/hw/nes/nes_verbs.c |
2299 | @@ -1404,6 +1404,9 @@ static struct ib_qp *nes_create_qp(struct ib_pd *ibpd, |
2300 | } |
2301 | |
2302 | nesqp->sig_all = (init_attr->sq_sig_type == IB_SIGNAL_ALL_WR); |
2303 | + init_timer(&nesqp->terminate_timer); |
2304 | + nesqp->terminate_timer.function = nes_terminate_timeout; |
2305 | + nesqp->terminate_timer.data = (unsigned long)nesqp; |
2306 | |
2307 | /* update the QP table */ |
2308 | nesdev->nesadapter->qp_table[nesqp->hwqp.qp_id-NES_FIRST_QPN] = nesqp; |
2309 | @@ -1413,7 +1416,6 @@ static struct ib_qp *nes_create_qp(struct ib_pd *ibpd, |
2310 | return &nesqp->ibqp; |
2311 | } |
2312 | |
2313 | - |
2314 | /** |
2315 | * nes_clean_cq |
2316 | */ |
2317 | @@ -2559,6 +2561,11 @@ static struct ib_mr *nes_reg_user_mr(struct ib_pd *pd, u64 start, u64 length, |
2318 | return ibmr; |
2319 | case IWNES_MEMREG_TYPE_QP: |
2320 | case IWNES_MEMREG_TYPE_CQ: |
2321 | + if (!region->length) { |
2322 | + nes_debug(NES_DBG_MR, "Unable to register zero length region for CQ\n"); |
2323 | + ib_umem_release(region); |
2324 | + return ERR_PTR(-EINVAL); |
2325 | + } |
2326 | nespbl = kzalloc(sizeof(*nespbl), GFP_KERNEL); |
2327 | if (!nespbl) { |
2328 | nes_debug(NES_DBG_MR, "Unable to allocate PBL\n"); |
2329 | diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c |
2330 | index 0d251d3..9c34db8 100644 |
2331 | --- a/drivers/iommu/intel-iommu.c |
2332 | +++ b/drivers/iommu/intel-iommu.c |
2333 | @@ -1826,10 +1826,17 @@ static int __domain_mapping(struct dmar_domain *domain, unsigned long iov_pfn, |
2334 | if (!pte) |
2335 | return -ENOMEM; |
2336 | /* It is large page*/ |
2337 | - if (largepage_lvl > 1) |
2338 | + if (largepage_lvl > 1) { |
2339 | pteval |= DMA_PTE_LARGE_PAGE; |
2340 | - else |
2341 | + /* Ensure that old small page tables are removed to make room |
2342 | + for superpage, if they exist. */ |
2343 | + dma_pte_clear_range(domain, iov_pfn, |
2344 | + iov_pfn + lvl_to_nr_pages(largepage_lvl) - 1); |
2345 | + dma_pte_free_pagetable(domain, iov_pfn, |
2346 | + iov_pfn + lvl_to_nr_pages(largepage_lvl) - 1); |
2347 | + } else { |
2348 | pteval &= ~(uint64_t)DMA_PTE_LARGE_PAGE; |
2349 | + } |
2350 | |
2351 | } |
2352 | /* We don't need lock here, nobody else |
2353 | diff --git a/drivers/md/dm-ioctl.c b/drivers/md/dm-ioctl.c |
2354 | index a1a3e6d..f011d4b 100644 |
2355 | --- a/drivers/md/dm-ioctl.c |
2356 | +++ b/drivers/md/dm-ioctl.c |
2357 | @@ -1563,6 +1563,14 @@ static int copy_params(struct dm_ioctl __user *user, struct dm_ioctl **param) |
2358 | if (copy_from_user(dmi, user, tmp.data_size)) |
2359 | goto bad; |
2360 | |
2361 | + /* |
2362 | + * Abort if something changed the ioctl data while it was being copied. |
2363 | + */ |
2364 | + if (dmi->data_size != tmp.data_size) { |
2365 | + DMERR("rejecting ioctl: data size modified while processing parameters"); |
2366 | + goto bad; |
2367 | + } |
2368 | + |
2369 | /* Wipe the user buffer so we do not return it to userspace */ |
2370 | if (secure_data && clear_user(user, tmp.data_size)) |
2371 | goto bad; |
2372 | diff --git a/drivers/md/persistent-data/dm-btree-internal.h b/drivers/md/persistent-data/dm-btree-internal.h |
2373 | index 5709bfe..accbb05 100644 |
2374 | --- a/drivers/md/persistent-data/dm-btree-internal.h |
2375 | +++ b/drivers/md/persistent-data/dm-btree-internal.h |
2376 | @@ -36,13 +36,13 @@ struct node_header { |
2377 | __le32 padding; |
2378 | } __packed; |
2379 | |
2380 | -struct node { |
2381 | +struct btree_node { |
2382 | struct node_header header; |
2383 | __le64 keys[0]; |
2384 | } __packed; |
2385 | |
2386 | |
2387 | -void inc_children(struct dm_transaction_manager *tm, struct node *n, |
2388 | +void inc_children(struct dm_transaction_manager *tm, struct btree_node *n, |
2389 | struct dm_btree_value_type *vt); |
2390 | |
2391 | int new_block(struct dm_btree_info *info, struct dm_block **result); |
2392 | @@ -64,7 +64,7 @@ struct ro_spine { |
2393 | void init_ro_spine(struct ro_spine *s, struct dm_btree_info *info); |
2394 | int exit_ro_spine(struct ro_spine *s); |
2395 | int ro_step(struct ro_spine *s, dm_block_t new_child); |
2396 | -struct node *ro_node(struct ro_spine *s); |
2397 | +struct btree_node *ro_node(struct ro_spine *s); |
2398 | |
2399 | struct shadow_spine { |
2400 | struct dm_btree_info *info; |
2401 | @@ -98,17 +98,17 @@ int shadow_root(struct shadow_spine *s); |
2402 | /* |
2403 | * Some inlines. |
2404 | */ |
2405 | -static inline __le64 *key_ptr(struct node *n, uint32_t index) |
2406 | +static inline __le64 *key_ptr(struct btree_node *n, uint32_t index) |
2407 | { |
2408 | return n->keys + index; |
2409 | } |
2410 | |
2411 | -static inline void *value_base(struct node *n) |
2412 | +static inline void *value_base(struct btree_node *n) |
2413 | { |
2414 | return &n->keys[le32_to_cpu(n->header.max_entries)]; |
2415 | } |
2416 | |
2417 | -static inline void *value_ptr(struct node *n, uint32_t index) |
2418 | +static inline void *value_ptr(struct btree_node *n, uint32_t index) |
2419 | { |
2420 | uint32_t value_size = le32_to_cpu(n->header.value_size); |
2421 | return value_base(n) + (value_size * index); |
2422 | @@ -117,7 +117,7 @@ static inline void *value_ptr(struct node *n, uint32_t index) |
2423 | /* |
2424 | * Assumes the values are suitably-aligned and converts to core format. |
2425 | */ |
2426 | -static inline uint64_t value64(struct node *n, uint32_t index) |
2427 | +static inline uint64_t value64(struct btree_node *n, uint32_t index) |
2428 | { |
2429 | __le64 *values_le = value_base(n); |
2430 | |
2431 | @@ -127,7 +127,7 @@ static inline uint64_t value64(struct node *n, uint32_t index) |
2432 | /* |
2433 | * Searching for a key within a single node. |
2434 | */ |
2435 | -int lower_bound(struct node *n, uint64_t key); |
2436 | +int lower_bound(struct btree_node *n, uint64_t key); |
2437 | |
2438 | extern struct dm_block_validator btree_node_validator; |
2439 | |
2440 | diff --git a/drivers/md/persistent-data/dm-btree-remove.c b/drivers/md/persistent-data/dm-btree-remove.c |
2441 | index aa71e23..c4f2813 100644 |
2442 | --- a/drivers/md/persistent-data/dm-btree-remove.c |
2443 | +++ b/drivers/md/persistent-data/dm-btree-remove.c |
2444 | @@ -53,7 +53,7 @@ |
2445 | /* |
2446 | * Some little utilities for moving node data around. |
2447 | */ |
2448 | -static void node_shift(struct node *n, int shift) |
2449 | +static void node_shift(struct btree_node *n, int shift) |
2450 | { |
2451 | uint32_t nr_entries = le32_to_cpu(n->header.nr_entries); |
2452 | uint32_t value_size = le32_to_cpu(n->header.value_size); |
2453 | @@ -79,7 +79,7 @@ static void node_shift(struct node *n, int shift) |
2454 | } |
2455 | } |
2456 | |
2457 | -static void node_copy(struct node *left, struct node *right, int shift) |
2458 | +static void node_copy(struct btree_node *left, struct btree_node *right, int shift) |
2459 | { |
2460 | uint32_t nr_left = le32_to_cpu(left->header.nr_entries); |
2461 | uint32_t value_size = le32_to_cpu(left->header.value_size); |
2462 | @@ -108,7 +108,7 @@ static void node_copy(struct node *left, struct node *right, int shift) |
2463 | /* |
2464 | * Delete a specific entry from a leaf node. |
2465 | */ |
2466 | -static void delete_at(struct node *n, unsigned index) |
2467 | +static void delete_at(struct btree_node *n, unsigned index) |
2468 | { |
2469 | unsigned nr_entries = le32_to_cpu(n->header.nr_entries); |
2470 | unsigned nr_to_copy = nr_entries - (index + 1); |
2471 | @@ -128,7 +128,7 @@ static void delete_at(struct node *n, unsigned index) |
2472 | n->header.nr_entries = cpu_to_le32(nr_entries - 1); |
2473 | } |
2474 | |
2475 | -static unsigned merge_threshold(struct node *n) |
2476 | +static unsigned merge_threshold(struct btree_node *n) |
2477 | { |
2478 | return le32_to_cpu(n->header.max_entries) / 3; |
2479 | } |
2480 | @@ -136,7 +136,7 @@ static unsigned merge_threshold(struct node *n) |
2481 | struct child { |
2482 | unsigned index; |
2483 | struct dm_block *block; |
2484 | - struct node *n; |
2485 | + struct btree_node *n; |
2486 | }; |
2487 | |
2488 | static struct dm_btree_value_type le64_type = { |
2489 | @@ -147,7 +147,7 @@ static struct dm_btree_value_type le64_type = { |
2490 | .equal = NULL |
2491 | }; |
2492 | |
2493 | -static int init_child(struct dm_btree_info *info, struct node *parent, |
2494 | +static int init_child(struct dm_btree_info *info, struct btree_node *parent, |
2495 | unsigned index, struct child *result) |
2496 | { |
2497 | int r, inc; |
2498 | @@ -177,7 +177,7 @@ static int exit_child(struct dm_btree_info *info, struct child *c) |
2499 | return dm_tm_unlock(info->tm, c->block); |
2500 | } |
2501 | |
2502 | -static void shift(struct node *left, struct node *right, int count) |
2503 | +static void shift(struct btree_node *left, struct btree_node *right, int count) |
2504 | { |
2505 | uint32_t nr_left = le32_to_cpu(left->header.nr_entries); |
2506 | uint32_t nr_right = le32_to_cpu(right->header.nr_entries); |
2507 | @@ -203,11 +203,11 @@ static void shift(struct node *left, struct node *right, int count) |
2508 | right->header.nr_entries = cpu_to_le32(nr_right + count); |
2509 | } |
2510 | |
2511 | -static void __rebalance2(struct dm_btree_info *info, struct node *parent, |
2512 | +static void __rebalance2(struct dm_btree_info *info, struct btree_node *parent, |
2513 | struct child *l, struct child *r) |
2514 | { |
2515 | - struct node *left = l->n; |
2516 | - struct node *right = r->n; |
2517 | + struct btree_node *left = l->n; |
2518 | + struct btree_node *right = r->n; |
2519 | uint32_t nr_left = le32_to_cpu(left->header.nr_entries); |
2520 | uint32_t nr_right = le32_to_cpu(right->header.nr_entries); |
2521 | unsigned threshold = 2 * merge_threshold(left) + 1; |
2522 | @@ -239,7 +239,7 @@ static int rebalance2(struct shadow_spine *s, struct dm_btree_info *info, |
2523 | unsigned left_index) |
2524 | { |
2525 | int r; |
2526 | - struct node *parent; |
2527 | + struct btree_node *parent; |
2528 | struct child left, right; |
2529 | |
2530 | parent = dm_block_data(shadow_current(s)); |
2531 | @@ -270,9 +270,9 @@ static int rebalance2(struct shadow_spine *s, struct dm_btree_info *info, |
2532 | * in right, then rebalance2. This wastes some cpu, but I want something |
2533 | * simple atm. |
2534 | */ |
2535 | -static void delete_center_node(struct dm_btree_info *info, struct node *parent, |
2536 | +static void delete_center_node(struct dm_btree_info *info, struct btree_node *parent, |
2537 | struct child *l, struct child *c, struct child *r, |
2538 | - struct node *left, struct node *center, struct node *right, |
2539 | + struct btree_node *left, struct btree_node *center, struct btree_node *right, |
2540 | uint32_t nr_left, uint32_t nr_center, uint32_t nr_right) |
2541 | { |
2542 | uint32_t max_entries = le32_to_cpu(left->header.max_entries); |
2543 | @@ -301,9 +301,9 @@ static void delete_center_node(struct dm_btree_info *info, struct node *parent, |
2544 | /* |
2545 | * Redistributes entries among 3 sibling nodes. |
2546 | */ |
2547 | -static void redistribute3(struct dm_btree_info *info, struct node *parent, |
2548 | +static void redistribute3(struct dm_btree_info *info, struct btree_node *parent, |
2549 | struct child *l, struct child *c, struct child *r, |
2550 | - struct node *left, struct node *center, struct node *right, |
2551 | + struct btree_node *left, struct btree_node *center, struct btree_node *right, |
2552 | uint32_t nr_left, uint32_t nr_center, uint32_t nr_right) |
2553 | { |
2554 | int s; |
2555 | @@ -343,12 +343,12 @@ static void redistribute3(struct dm_btree_info *info, struct node *parent, |
2556 | *key_ptr(parent, r->index) = right->keys[0]; |
2557 | } |
2558 | |
2559 | -static void __rebalance3(struct dm_btree_info *info, struct node *parent, |
2560 | +static void __rebalance3(struct dm_btree_info *info, struct btree_node *parent, |
2561 | struct child *l, struct child *c, struct child *r) |
2562 | { |
2563 | - struct node *left = l->n; |
2564 | - struct node *center = c->n; |
2565 | - struct node *right = r->n; |
2566 | + struct btree_node *left = l->n; |
2567 | + struct btree_node *center = c->n; |
2568 | + struct btree_node *right = r->n; |
2569 | |
2570 | uint32_t nr_left = le32_to_cpu(left->header.nr_entries); |
2571 | uint32_t nr_center = le32_to_cpu(center->header.nr_entries); |
2572 | @@ -371,7 +371,7 @@ static int rebalance3(struct shadow_spine *s, struct dm_btree_info *info, |
2573 | unsigned left_index) |
2574 | { |
2575 | int r; |
2576 | - struct node *parent = dm_block_data(shadow_current(s)); |
2577 | + struct btree_node *parent = dm_block_data(shadow_current(s)); |
2578 | struct child left, center, right; |
2579 | |
2580 | /* |
2581 | @@ -421,7 +421,7 @@ static int get_nr_entries(struct dm_transaction_manager *tm, |
2582 | { |
2583 | int r; |
2584 | struct dm_block *block; |
2585 | - struct node *n; |
2586 | + struct btree_node *n; |
2587 | |
2588 | r = dm_tm_read_lock(tm, b, &btree_node_validator, &block); |
2589 | if (r) |
2590 | @@ -438,7 +438,7 @@ static int rebalance_children(struct shadow_spine *s, |
2591 | { |
2592 | int i, r, has_left_sibling, has_right_sibling; |
2593 | uint32_t child_entries; |
2594 | - struct node *n; |
2595 | + struct btree_node *n; |
2596 | |
2597 | n = dm_block_data(shadow_current(s)); |
2598 | |
2599 | @@ -483,7 +483,7 @@ static int rebalance_children(struct shadow_spine *s, |
2600 | return r; |
2601 | } |
2602 | |
2603 | -static int do_leaf(struct node *n, uint64_t key, unsigned *index) |
2604 | +static int do_leaf(struct btree_node *n, uint64_t key, unsigned *index) |
2605 | { |
2606 | int i = lower_bound(n, key); |
2607 | |
2608 | @@ -506,7 +506,7 @@ static int remove_raw(struct shadow_spine *s, struct dm_btree_info *info, |
2609 | uint64_t key, unsigned *index) |
2610 | { |
2611 | int i = *index, r; |
2612 | - struct node *n; |
2613 | + struct btree_node *n; |
2614 | |
2615 | for (;;) { |
2616 | r = shadow_step(s, root, vt); |
2617 | @@ -556,7 +556,7 @@ int dm_btree_remove(struct dm_btree_info *info, dm_block_t root, |
2618 | unsigned level, last_level = info->levels - 1; |
2619 | int index = 0, r = 0; |
2620 | struct shadow_spine spine; |
2621 | - struct node *n; |
2622 | + struct btree_node *n; |
2623 | |
2624 | init_shadow_spine(&spine, info); |
2625 | for (level = 0; level < info->levels; level++) { |
2626 | diff --git a/drivers/md/persistent-data/dm-btree-spine.c b/drivers/md/persistent-data/dm-btree-spine.c |
2627 | index d9a7912..2f0805c 100644 |
2628 | --- a/drivers/md/persistent-data/dm-btree-spine.c |
2629 | +++ b/drivers/md/persistent-data/dm-btree-spine.c |
2630 | @@ -23,7 +23,7 @@ static void node_prepare_for_write(struct dm_block_validator *v, |
2631 | struct dm_block *b, |
2632 | size_t block_size) |
2633 | { |
2634 | - struct node *n = dm_block_data(b); |
2635 | + struct btree_node *n = dm_block_data(b); |
2636 | struct node_header *h = &n->header; |
2637 | |
2638 | h->blocknr = cpu_to_le64(dm_block_location(b)); |
2639 | @@ -38,7 +38,7 @@ static int node_check(struct dm_block_validator *v, |
2640 | struct dm_block *b, |
2641 | size_t block_size) |
2642 | { |
2643 | - struct node *n = dm_block_data(b); |
2644 | + struct btree_node *n = dm_block_data(b); |
2645 | struct node_header *h = &n->header; |
2646 | size_t value_size; |
2647 | __le32 csum_disk; |
2648 | @@ -164,7 +164,7 @@ int ro_step(struct ro_spine *s, dm_block_t new_child) |
2649 | return r; |
2650 | } |
2651 | |
2652 | -struct node *ro_node(struct ro_spine *s) |
2653 | +struct btree_node *ro_node(struct ro_spine *s) |
2654 | { |
2655 | struct dm_block *block; |
2656 | |
2657 | diff --git a/drivers/md/persistent-data/dm-btree.c b/drivers/md/persistent-data/dm-btree.c |
2658 | index d12b2cc..371f3d4 100644 |
2659 | --- a/drivers/md/persistent-data/dm-btree.c |
2660 | +++ b/drivers/md/persistent-data/dm-btree.c |
2661 | @@ -38,7 +38,7 @@ static void array_insert(void *base, size_t elt_size, unsigned nr_elts, |
2662 | /*----------------------------------------------------------------*/ |
2663 | |
2664 | /* makes the assumption that no two keys are the same. */ |
2665 | -static int bsearch(struct node *n, uint64_t key, int want_hi) |
2666 | +static int bsearch(struct btree_node *n, uint64_t key, int want_hi) |
2667 | { |
2668 | int lo = -1, hi = le32_to_cpu(n->header.nr_entries); |
2669 | |
2670 | @@ -58,12 +58,12 @@ static int bsearch(struct node *n, uint64_t key, int want_hi) |
2671 | return want_hi ? hi : lo; |
2672 | } |
2673 | |
2674 | -int lower_bound(struct node *n, uint64_t key) |
2675 | +int lower_bound(struct btree_node *n, uint64_t key) |
2676 | { |
2677 | return bsearch(n, key, 0); |
2678 | } |
2679 | |
2680 | -void inc_children(struct dm_transaction_manager *tm, struct node *n, |
2681 | +void inc_children(struct dm_transaction_manager *tm, struct btree_node *n, |
2682 | struct dm_btree_value_type *vt) |
2683 | { |
2684 | unsigned i; |
2685 | @@ -77,7 +77,7 @@ void inc_children(struct dm_transaction_manager *tm, struct node *n, |
2686 | vt->inc(vt->context, value_ptr(n, i)); |
2687 | } |
2688 | |
2689 | -static int insert_at(size_t value_size, struct node *node, unsigned index, |
2690 | +static int insert_at(size_t value_size, struct btree_node *node, unsigned index, |
2691 | uint64_t key, void *value) |
2692 | __dm_written_to_disk(value) |
2693 | { |
2694 | @@ -122,7 +122,7 @@ int dm_btree_empty(struct dm_btree_info *info, dm_block_t *root) |
2695 | { |
2696 | int r; |
2697 | struct dm_block *b; |
2698 | - struct node *n; |
2699 | + struct btree_node *n; |
2700 | size_t block_size; |
2701 | uint32_t max_entries; |
2702 | |
2703 | @@ -154,7 +154,7 @@ EXPORT_SYMBOL_GPL(dm_btree_empty); |
2704 | #define MAX_SPINE_DEPTH 64 |
2705 | struct frame { |
2706 | struct dm_block *b; |
2707 | - struct node *n; |
2708 | + struct btree_node *n; |
2709 | unsigned level; |
2710 | unsigned nr_children; |
2711 | unsigned current_child; |
2712 | @@ -295,7 +295,7 @@ EXPORT_SYMBOL_GPL(dm_btree_del); |
2713 | /*----------------------------------------------------------------*/ |
2714 | |
2715 | static int btree_lookup_raw(struct ro_spine *s, dm_block_t block, uint64_t key, |
2716 | - int (*search_fn)(struct node *, uint64_t), |
2717 | + int (*search_fn)(struct btree_node *, uint64_t), |
2718 | uint64_t *result_key, void *v, size_t value_size) |
2719 | { |
2720 | int i, r; |
2721 | @@ -406,7 +406,7 @@ static int btree_split_sibling(struct shadow_spine *s, dm_block_t root, |
2722 | size_t size; |
2723 | unsigned nr_left, nr_right; |
2724 | struct dm_block *left, *right, *parent; |
2725 | - struct node *ln, *rn, *pn; |
2726 | + struct btree_node *ln, *rn, *pn; |
2727 | __le64 location; |
2728 | |
2729 | left = shadow_current(s); |
2730 | @@ -491,7 +491,7 @@ static int btree_split_beneath(struct shadow_spine *s, uint64_t key) |
2731 | size_t size; |
2732 | unsigned nr_left, nr_right; |
2733 | struct dm_block *left, *right, *new_parent; |
2734 | - struct node *pn, *ln, *rn; |
2735 | + struct btree_node *pn, *ln, *rn; |
2736 | __le64 val; |
2737 | |
2738 | new_parent = shadow_current(s); |
2739 | @@ -576,7 +576,7 @@ static int btree_insert_raw(struct shadow_spine *s, dm_block_t root, |
2740 | uint64_t key, unsigned *index) |
2741 | { |
2742 | int r, i = *index, top = 1; |
2743 | - struct node *node; |
2744 | + struct btree_node *node; |
2745 | |
2746 | for (;;) { |
2747 | r = shadow_step(s, root, vt); |
2748 | @@ -643,7 +643,7 @@ static int insert(struct dm_btree_info *info, dm_block_t root, |
2749 | unsigned level, index = -1, last_level = info->levels - 1; |
2750 | dm_block_t block = root; |
2751 | struct shadow_spine spine; |
2752 | - struct node *n; |
2753 | + struct btree_node *n; |
2754 | struct dm_btree_value_type le64_type; |
2755 | |
2756 | le64_type.context = NULL; |
2757 | diff --git a/drivers/mfd/mfd-core.c b/drivers/mfd/mfd-core.c |
2758 | index ffc3d48..ef80da6 100644 |
2759 | --- a/drivers/mfd/mfd-core.c |
2760 | +++ b/drivers/mfd/mfd-core.c |
2761 | @@ -19,6 +19,10 @@ |
2762 | #include <linux/slab.h> |
2763 | #include <linux/module.h> |
2764 | |
2765 | +static struct device_type mfd_dev_type = { |
2766 | + .name = "mfd_device", |
2767 | +}; |
2768 | + |
2769 | int mfd_cell_enable(struct platform_device *pdev) |
2770 | { |
2771 | const struct mfd_cell *cell = mfd_get_cell(pdev); |
2772 | @@ -88,6 +92,7 @@ static int mfd_add_device(struct device *parent, int id, |
2773 | goto fail_device; |
2774 | |
2775 | pdev->dev.parent = parent; |
2776 | + pdev->dev.type = &mfd_dev_type; |
2777 | |
2778 | if (cell->pdata_size) { |
2779 | ret = platform_device_add_data(pdev, |
2780 | @@ -183,10 +188,16 @@ EXPORT_SYMBOL(mfd_add_devices); |
2781 | |
2782 | static int mfd_remove_devices_fn(struct device *dev, void *c) |
2783 | { |
2784 | - struct platform_device *pdev = to_platform_device(dev); |
2785 | - const struct mfd_cell *cell = mfd_get_cell(pdev); |
2786 | + struct platform_device *pdev; |
2787 | + const struct mfd_cell *cell; |
2788 | atomic_t **usage_count = c; |
2789 | |
2790 | + if (dev->type != &mfd_dev_type) |
2791 | + return 0; |
2792 | + |
2793 | + pdev = to_platform_device(dev); |
2794 | + cell = mfd_get_cell(pdev); |
2795 | + |
2796 | /* find the base address of usage_count pointers (for freeing) */ |
2797 | if (!*usage_count || (cell->usage_count < *usage_count)) |
2798 | *usage_count = cell->usage_count; |
2799 | diff --git a/drivers/mfd/wm8994-core.c b/drivers/mfd/wm8994-core.c |
2800 | index 9d7ca1e..8d46e68 100644 |
2801 | --- a/drivers/mfd/wm8994-core.c |
2802 | +++ b/drivers/mfd/wm8994-core.c |
2803 | @@ -541,6 +541,7 @@ static __devinit int wm8994_device_init(struct wm8994 *wm8994, int irq) |
2804 | case 1: |
2805 | case 2: |
2806 | case 3: |
2807 | + case 4: |
2808 | regmap_patch = wm1811_reva_patch; |
2809 | patch_regs = ARRAY_SIZE(wm1811_reva_patch); |
2810 | break; |
2811 | diff --git a/drivers/mtd/nand/cs553x_nand.c b/drivers/mtd/nand/cs553x_nand.c |
2812 | index 821c34c..0b9b472 100644 |
2813 | --- a/drivers/mtd/nand/cs553x_nand.c |
2814 | +++ b/drivers/mtd/nand/cs553x_nand.c |
2815 | @@ -237,6 +237,7 @@ static int __init cs553x_init_one(int cs, int mmio, unsigned long adr) |
2816 | this->ecc.hwctl = cs_enable_hwecc; |
2817 | this->ecc.calculate = cs_calculate_ecc; |
2818 | this->ecc.correct = nand_correct_data; |
2819 | + this->ecc.strength = 1; |
2820 | |
2821 | /* Enable the following for a flash based bad block table */ |
2822 | this->bbt_options = NAND_BBT_USE_FLASH; |
2823 | @@ -248,8 +249,6 @@ static int __init cs553x_init_one(int cs, int mmio, unsigned long adr) |
2824 | goto out_ior; |
2825 | } |
2826 | |
2827 | - this->ecc.strength = 1; |
2828 | - |
2829 | new_mtd->name = kasprintf(GFP_KERNEL, "cs553x_nand_cs%d", cs); |
2830 | |
2831 | cs553x_mtd[cs] = new_mtd; |
2832 | diff --git a/drivers/mtd/nand/gpmi-nand/gpmi-lib.c b/drivers/mtd/nand/gpmi-nand/gpmi-lib.c |
2833 | index e8ea710..022feb4 100644 |
2834 | --- a/drivers/mtd/nand/gpmi-nand/gpmi-lib.c |
2835 | +++ b/drivers/mtd/nand/gpmi-nand/gpmi-lib.c |
2836 | @@ -135,6 +135,15 @@ int gpmi_init(struct gpmi_nand_data *this) |
2837 | if (ret) |
2838 | goto err_out; |
2839 | |
2840 | + /* |
2841 | + * Reset BCH here, too. We got failures otherwise :( |
2842 | + * See later BCH reset for explanation of MX23 handling |
2843 | + */ |
2844 | + ret = gpmi_reset_block(r->bch_regs, GPMI_IS_MX23(this)); |
2845 | + if (ret) |
2846 | + goto err_out; |
2847 | + |
2848 | + |
2849 | /* Choose NAND mode. */ |
2850 | writel(BM_GPMI_CTRL1_GPMI_MODE, r->gpmi_regs + HW_GPMI_CTRL1_CLR); |
2851 | |
2852 | diff --git a/drivers/net/wimax/i2400m/i2400m-usb.h b/drivers/net/wimax/i2400m/i2400m-usb.h |
2853 | index 6650fde..9f1e947 100644 |
2854 | --- a/drivers/net/wimax/i2400m/i2400m-usb.h |
2855 | +++ b/drivers/net/wimax/i2400m/i2400m-usb.h |
2856 | @@ -152,6 +152,9 @@ enum { |
2857 | /* Device IDs */ |
2858 | USB_DEVICE_ID_I6050 = 0x0186, |
2859 | USB_DEVICE_ID_I6050_2 = 0x0188, |
2860 | + USB_DEVICE_ID_I6150 = 0x07d6, |
2861 | + USB_DEVICE_ID_I6150_2 = 0x07d7, |
2862 | + USB_DEVICE_ID_I6150_3 = 0x07d9, |
2863 | USB_DEVICE_ID_I6250 = 0x0187, |
2864 | }; |
2865 | |
2866 | diff --git a/drivers/net/wimax/i2400m/usb.c b/drivers/net/wimax/i2400m/usb.c |
2867 | index 29b1e03..f0f16e0 100644 |
2868 | --- a/drivers/net/wimax/i2400m/usb.c |
2869 | +++ b/drivers/net/wimax/i2400m/usb.c |
2870 | @@ -510,6 +510,9 @@ int i2400mu_probe(struct usb_interface *iface, |
2871 | switch (id->idProduct) { |
2872 | case USB_DEVICE_ID_I6050: |
2873 | case USB_DEVICE_ID_I6050_2: |
2874 | + case USB_DEVICE_ID_I6150: |
2875 | + case USB_DEVICE_ID_I6150_2: |
2876 | + case USB_DEVICE_ID_I6150_3: |
2877 | case USB_DEVICE_ID_I6250: |
2878 | i2400mu->i6050 = 1; |
2879 | break; |
2880 | @@ -759,6 +762,9 @@ static |
2881 | struct usb_device_id i2400mu_id_table[] = { |
2882 | { USB_DEVICE(0x8086, USB_DEVICE_ID_I6050) }, |
2883 | { USB_DEVICE(0x8086, USB_DEVICE_ID_I6050_2) }, |
2884 | + { USB_DEVICE(0x8087, USB_DEVICE_ID_I6150) }, |
2885 | + { USB_DEVICE(0x8087, USB_DEVICE_ID_I6150_2) }, |
2886 | + { USB_DEVICE(0x8087, USB_DEVICE_ID_I6150_3) }, |
2887 | { USB_DEVICE(0x8086, USB_DEVICE_ID_I6250) }, |
2888 | { USB_DEVICE(0x8086, 0x0181) }, |
2889 | { USB_DEVICE(0x8086, 0x1403) }, |
2890 | diff --git a/drivers/net/wireless/ath/ath5k/base.c b/drivers/net/wireless/ath/ath5k/base.c |
2891 | index 0e643b0..c7d1437 100644 |
2892 | --- a/drivers/net/wireless/ath/ath5k/base.c |
2893 | +++ b/drivers/net/wireless/ath/ath5k/base.c |
2894 | @@ -843,7 +843,7 @@ ath5k_txbuf_free_skb(struct ath5k_hw *ah, struct ath5k_buf *bf) |
2895 | return; |
2896 | dma_unmap_single(ah->dev, bf->skbaddr, bf->skb->len, |
2897 | DMA_TO_DEVICE); |
2898 | - dev_kfree_skb_any(bf->skb); |
2899 | + ieee80211_free_txskb(ah->hw, bf->skb); |
2900 | bf->skb = NULL; |
2901 | bf->skbaddr = 0; |
2902 | bf->desc->ds_data = 0; |
2903 | @@ -1570,7 +1570,7 @@ ath5k_tx_queue(struct ieee80211_hw *hw, struct sk_buff *skb, |
2904 | return; |
2905 | |
2906 | drop_packet: |
2907 | - dev_kfree_skb_any(skb); |
2908 | + ieee80211_free_txskb(hw, skb); |
2909 | } |
2910 | |
2911 | static void |
2912 | diff --git a/drivers/net/wireless/ath/ath5k/mac80211-ops.c b/drivers/net/wireless/ath/ath5k/mac80211-ops.c |
2913 | index 5c53299..5d1be4d 100644 |
2914 | --- a/drivers/net/wireless/ath/ath5k/mac80211-ops.c |
2915 | +++ b/drivers/net/wireless/ath/ath5k/mac80211-ops.c |
2916 | @@ -59,7 +59,7 @@ ath5k_tx(struct ieee80211_hw *hw, struct sk_buff *skb) |
2917 | u16 qnum = skb_get_queue_mapping(skb); |
2918 | |
2919 | if (WARN_ON(qnum >= ah->ah_capabilities.cap_queues.q_tx_num)) { |
2920 | - dev_kfree_skb_any(skb); |
2921 | + ieee80211_free_txskb(hw, skb); |
2922 | return; |
2923 | } |
2924 | |
2925 | diff --git a/drivers/net/wireless/ath/ath9k/ar9003_2p2_initvals.h b/drivers/net/wireless/ath/ath9k/ar9003_2p2_initvals.h |
2926 | index 2b4b633..4e2a52c 100644 |
2927 | --- a/drivers/net/wireless/ath/ath9k/ar9003_2p2_initvals.h |
2928 | +++ b/drivers/net/wireless/ath/ath9k/ar9003_2p2_initvals.h |
2929 | @@ -533,98 +533,98 @@ static const u32 ar9300_2p2_baseband_core[][2] = { |
2930 | |
2931 | static const u32 ar9300Modes_high_power_tx_gain_table_2p2[][5] = { |
2932 | /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ |
2933 | - {0x0000a2dc, 0x00033800, 0x00033800, 0x03aaa352, 0x03aaa352}, |
2934 | - {0x0000a2e0, 0x0003c000, 0x0003c000, 0x03ccc584, 0x03ccc584}, |
2935 | - {0x0000a2e4, 0x03fc0000, 0x03fc0000, 0x03f0f800, 0x03f0f800}, |
2936 | + {0x0000a2dc, 0x0380c7fc, 0x0380c7fc, 0x03aaa352, 0x03aaa352}, |
2937 | + {0x0000a2e0, 0x0000f800, 0x0000f800, 0x03ccc584, 0x03ccc584}, |
2938 | + {0x0000a2e4, 0x03ff0000, 0x03ff0000, 0x03f0f800, 0x03f0f800}, |
2939 | {0x0000a2e8, 0x00000000, 0x00000000, 0x03ff0000, 0x03ff0000}, |
2940 | - {0x0000a410, 0x000050d9, 0x000050d9, 0x000050d9, 0x000050d9}, |
2941 | - {0x0000a500, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, |
2942 | - {0x0000a504, 0x06000003, 0x06000003, 0x04000002, 0x04000002}, |
2943 | - {0x0000a508, 0x0a000020, 0x0a000020, 0x08000004, 0x08000004}, |
2944 | - {0x0000a50c, 0x10000023, 0x10000023, 0x0b000200, 0x0b000200}, |
2945 | - {0x0000a510, 0x16000220, 0x16000220, 0x0f000202, 0x0f000202}, |
2946 | - {0x0000a514, 0x1c000223, 0x1c000223, 0x12000400, 0x12000400}, |
2947 | - {0x0000a518, 0x21002220, 0x21002220, 0x16000402, 0x16000402}, |
2948 | - {0x0000a51c, 0x27002223, 0x27002223, 0x19000404, 0x19000404}, |
2949 | - {0x0000a520, 0x2b022220, 0x2b022220, 0x1c000603, 0x1c000603}, |
2950 | - {0x0000a524, 0x2f022222, 0x2f022222, 0x21000a02, 0x21000a02}, |
2951 | - {0x0000a528, 0x34022225, 0x34022225, 0x25000a04, 0x25000a04}, |
2952 | - {0x0000a52c, 0x3a02222a, 0x3a02222a, 0x28000a20, 0x28000a20}, |
2953 | - {0x0000a530, 0x3e02222c, 0x3e02222c, 0x2c000e20, 0x2c000e20}, |
2954 | - {0x0000a534, 0x4202242a, 0x4202242a, 0x30000e22, 0x30000e22}, |
2955 | - {0x0000a538, 0x4702244a, 0x4702244a, 0x34000e24, 0x34000e24}, |
2956 | - {0x0000a53c, 0x4b02244c, 0x4b02244c, 0x38001640, 0x38001640}, |
2957 | - {0x0000a540, 0x4e02246c, 0x4e02246c, 0x3c001660, 0x3c001660}, |
2958 | - {0x0000a544, 0x52022470, 0x52022470, 0x3f001861, 0x3f001861}, |
2959 | - {0x0000a548, 0x55022490, 0x55022490, 0x43001a81, 0x43001a81}, |
2960 | - {0x0000a54c, 0x59022492, 0x59022492, 0x47001a83, 0x47001a83}, |
2961 | - {0x0000a550, 0x5d022692, 0x5d022692, 0x4a001c84, 0x4a001c84}, |
2962 | - {0x0000a554, 0x61022892, 0x61022892, 0x4e001ce3, 0x4e001ce3}, |
2963 | - {0x0000a558, 0x65024890, 0x65024890, 0x52001ce5, 0x52001ce5}, |
2964 | - {0x0000a55c, 0x69024892, 0x69024892, 0x56001ce9, 0x56001ce9}, |
2965 | - {0x0000a560, 0x6e024c92, 0x6e024c92, 0x5a001ceb, 0x5a001ceb}, |
2966 | - {0x0000a564, 0x74026e92, 0x74026e92, 0x5d001eec, 0x5d001eec}, |
2967 | - {0x0000a568, 0x74026e92, 0x74026e92, 0x5d001eec, 0x5d001eec}, |
2968 | - {0x0000a56c, 0x74026e92, 0x74026e92, 0x5d001eec, 0x5d001eec}, |
2969 | - {0x0000a570, 0x74026e92, 0x74026e92, 0x5d001eec, 0x5d001eec}, |
2970 | - {0x0000a574, 0x74026e92, 0x74026e92, 0x5d001eec, 0x5d001eec}, |
2971 | - {0x0000a578, 0x74026e92, 0x74026e92, 0x5d001eec, 0x5d001eec}, |
2972 | - {0x0000a57c, 0x74026e92, 0x74026e92, 0x5d001eec, 0x5d001eec}, |
2973 | - {0x0000a580, 0x00800000, 0x00800000, 0x00800000, 0x00800000}, |
2974 | - {0x0000a584, 0x06800003, 0x06800003, 0x04800002, 0x04800002}, |
2975 | - {0x0000a588, 0x0a800020, 0x0a800020, 0x08800004, 0x08800004}, |
2976 | - {0x0000a58c, 0x10800023, 0x10800023, 0x0b800200, 0x0b800200}, |
2977 | - {0x0000a590, 0x16800220, 0x16800220, 0x0f800202, 0x0f800202}, |
2978 | - {0x0000a594, 0x1c800223, 0x1c800223, 0x12800400, 0x12800400}, |
2979 | - {0x0000a598, 0x21802220, 0x21802220, 0x16800402, 0x16800402}, |
2980 | - {0x0000a59c, 0x27802223, 0x27802223, 0x19800404, 0x19800404}, |
2981 | - {0x0000a5a0, 0x2b822220, 0x2b822220, 0x1c800603, 0x1c800603}, |
2982 | - {0x0000a5a4, 0x2f822222, 0x2f822222, 0x21800a02, 0x21800a02}, |
2983 | - {0x0000a5a8, 0x34822225, 0x34822225, 0x25800a04, 0x25800a04}, |
2984 | - {0x0000a5ac, 0x3a82222a, 0x3a82222a, 0x28800a20, 0x28800a20}, |
2985 | - {0x0000a5b0, 0x3e82222c, 0x3e82222c, 0x2c800e20, 0x2c800e20}, |
2986 | - {0x0000a5b4, 0x4282242a, 0x4282242a, 0x30800e22, 0x30800e22}, |
2987 | - {0x0000a5b8, 0x4782244a, 0x4782244a, 0x34800e24, 0x34800e24}, |
2988 | - {0x0000a5bc, 0x4b82244c, 0x4b82244c, 0x38801640, 0x38801640}, |
2989 | - {0x0000a5c0, 0x4e82246c, 0x4e82246c, 0x3c801660, 0x3c801660}, |
2990 | - {0x0000a5c4, 0x52822470, 0x52822470, 0x3f801861, 0x3f801861}, |
2991 | - {0x0000a5c8, 0x55822490, 0x55822490, 0x43801a81, 0x43801a81}, |
2992 | - {0x0000a5cc, 0x59822492, 0x59822492, 0x47801a83, 0x47801a83}, |
2993 | - {0x0000a5d0, 0x5d822692, 0x5d822692, 0x4a801c84, 0x4a801c84}, |
2994 | - {0x0000a5d4, 0x61822892, 0x61822892, 0x4e801ce3, 0x4e801ce3}, |
2995 | - {0x0000a5d8, 0x65824890, 0x65824890, 0x52801ce5, 0x52801ce5}, |
2996 | - {0x0000a5dc, 0x69824892, 0x69824892, 0x56801ce9, 0x56801ce9}, |
2997 | - {0x0000a5e0, 0x6e824c92, 0x6e824c92, 0x5a801ceb, 0x5a801ceb}, |
2998 | - {0x0000a5e4, 0x74826e92, 0x74826e92, 0x5d801eec, 0x5d801eec}, |
2999 | - {0x0000a5e8, 0x74826e92, 0x74826e92, 0x5d801eec, 0x5d801eec}, |
3000 | - {0x0000a5ec, 0x74826e92, 0x74826e92, 0x5d801eec, 0x5d801eec}, |
3001 | - {0x0000a5f0, 0x74826e92, 0x74826e92, 0x5d801eec, 0x5d801eec}, |
3002 | - {0x0000a5f4, 0x74826e92, 0x74826e92, 0x5d801eec, 0x5d801eec}, |
3003 | - {0x0000a5f8, 0x74826e92, 0x74826e92, 0x5d801eec, 0x5d801eec}, |
3004 | - {0x0000a5fc, 0x74826e92, 0x74826e92, 0x5d801eec, 0x5d801eec}, |
3005 | + {0x0000a410, 0x000050d8, 0x000050d8, 0x000050d9, 0x000050d9}, |
3006 | + {0x0000a500, 0x00002220, 0x00002220, 0x00000000, 0x00000000}, |
3007 | + {0x0000a504, 0x04002222, 0x04002222, 0x04000002, 0x04000002}, |
3008 | + {0x0000a508, 0x09002421, 0x09002421, 0x08000004, 0x08000004}, |
3009 | + {0x0000a50c, 0x0d002621, 0x0d002621, 0x0b000200, 0x0b000200}, |
3010 | + {0x0000a510, 0x13004620, 0x13004620, 0x0f000202, 0x0f000202}, |
3011 | + {0x0000a514, 0x19004a20, 0x19004a20, 0x11000400, 0x11000400}, |
3012 | + {0x0000a518, 0x1d004e20, 0x1d004e20, 0x15000402, 0x15000402}, |
3013 | + {0x0000a51c, 0x21005420, 0x21005420, 0x19000404, 0x19000404}, |
3014 | + {0x0000a520, 0x26005e20, 0x26005e20, 0x1b000603, 0x1b000603}, |
3015 | + {0x0000a524, 0x2b005e40, 0x2b005e40, 0x1f000a02, 0x1f000a02}, |
3016 | + {0x0000a528, 0x2f005e42, 0x2f005e42, 0x23000a04, 0x23000a04}, |
3017 | + {0x0000a52c, 0x33005e44, 0x33005e44, 0x26000a20, 0x26000a20}, |
3018 | + {0x0000a530, 0x38005e65, 0x38005e65, 0x2a000e20, 0x2a000e20}, |
3019 | + {0x0000a534, 0x3c005e69, 0x3c005e69, 0x2e000e22, 0x2e000e22}, |
3020 | + {0x0000a538, 0x40005e6b, 0x40005e6b, 0x31000e24, 0x31000e24}, |
3021 | + {0x0000a53c, 0x44005e6d, 0x44005e6d, 0x34001640, 0x34001640}, |
3022 | + {0x0000a540, 0x49005e72, 0x49005e72, 0x38001660, 0x38001660}, |
3023 | + {0x0000a544, 0x4e005eb2, 0x4e005eb2, 0x3b001861, 0x3b001861}, |
3024 | + {0x0000a548, 0x53005f12, 0x53005f12, 0x3e001a81, 0x3e001a81}, |
3025 | + {0x0000a54c, 0x59025eb2, 0x59025eb2, 0x42001a83, 0x42001a83}, |
3026 | + {0x0000a550, 0x5e025f12, 0x5e025f12, 0x44001c84, 0x44001c84}, |
3027 | + {0x0000a554, 0x61027f12, 0x61027f12, 0x48001ce3, 0x48001ce3}, |
3028 | + {0x0000a558, 0x6702bf12, 0x6702bf12, 0x4c001ce5, 0x4c001ce5}, |
3029 | + {0x0000a55c, 0x6b02bf14, 0x6b02bf14, 0x50001ce9, 0x50001ce9}, |
3030 | + {0x0000a560, 0x6f02bf16, 0x6f02bf16, 0x54001ceb, 0x54001ceb}, |
3031 | + {0x0000a564, 0x6f02bf16, 0x6f02bf16, 0x56001eec, 0x56001eec}, |
3032 | + {0x0000a568, 0x6f02bf16, 0x6f02bf16, 0x56001eec, 0x56001eec}, |
3033 | + {0x0000a56c, 0x6f02bf16, 0x6f02bf16, 0x56001eec, 0x56001eec}, |
3034 | + {0x0000a570, 0x6f02bf16, 0x6f02bf16, 0x56001eec, 0x56001eec}, |
3035 | + {0x0000a574, 0x6f02bf16, 0x6f02bf16, 0x56001eec, 0x56001eec}, |
3036 | + {0x0000a578, 0x6f02bf16, 0x6f02bf16, 0x56001eec, 0x56001eec}, |
3037 | + {0x0000a57c, 0x6f02bf16, 0x6f02bf16, 0x56001eec, 0x56001eec}, |
3038 | + {0x0000a580, 0x00802220, 0x00802220, 0x00800000, 0x00800000}, |
3039 | + {0x0000a584, 0x04802222, 0x04802222, 0x04800002, 0x04800002}, |
3040 | + {0x0000a588, 0x09802421, 0x09802421, 0x08800004, 0x08800004}, |
3041 | + {0x0000a58c, 0x0d802621, 0x0d802621, 0x0b800200, 0x0b800200}, |
3042 | + {0x0000a590, 0x13804620, 0x13804620, 0x0f800202, 0x0f800202}, |
3043 | + {0x0000a594, 0x19804a20, 0x19804a20, 0x11800400, 0x11800400}, |
3044 | + {0x0000a598, 0x1d804e20, 0x1d804e20, 0x15800402, 0x15800402}, |
3045 | + {0x0000a59c, 0x21805420, 0x21805420, 0x19800404, 0x19800404}, |
3046 | + {0x0000a5a0, 0x26805e20, 0x26805e20, 0x1b800603, 0x1b800603}, |
3047 | + {0x0000a5a4, 0x2b805e40, 0x2b805e40, 0x1f800a02, 0x1f800a02}, |
3048 | + {0x0000a5a8, 0x2f805e42, 0x2f805e42, 0x23800a04, 0x23800a04}, |
3049 | + {0x0000a5ac, 0x33805e44, 0x33805e44, 0x26800a20, 0x26800a20}, |
3050 | + {0x0000a5b0, 0x38805e65, 0x38805e65, 0x2a800e20, 0x2a800e20}, |
3051 | + {0x0000a5b4, 0x3c805e69, 0x3c805e69, 0x2e800e22, 0x2e800e22}, |
3052 | + {0x0000a5b8, 0x40805e6b, 0x40805e6b, 0x31800e24, 0x31800e24}, |
3053 | + {0x0000a5bc, 0x44805e6d, 0x44805e6d, 0x34801640, 0x34801640}, |
3054 | + {0x0000a5c0, 0x49805e72, 0x49805e72, 0x38801660, 0x38801660}, |
3055 | + {0x0000a5c4, 0x4e805eb2, 0x4e805eb2, 0x3b801861, 0x3b801861}, |
3056 | + {0x0000a5c8, 0x53805f12, 0x53805f12, 0x3e801a81, 0x3e801a81}, |
3057 | + {0x0000a5cc, 0x59825eb2, 0x59825eb2, 0x42801a83, 0x42801a83}, |
3058 | + {0x0000a5d0, 0x5e825f12, 0x5e825f12, 0x44801c84, 0x44801c84}, |
3059 | + {0x0000a5d4, 0x61827f12, 0x61827f12, 0x48801ce3, 0x48801ce3}, |
3060 | + {0x0000a5d8, 0x6782bf12, 0x6782bf12, 0x4c801ce5, 0x4c801ce5}, |
3061 | + {0x0000a5dc, 0x6b82bf14, 0x6b82bf14, 0x50801ce9, 0x50801ce9}, |
3062 | + {0x0000a5e0, 0x6f82bf16, 0x6f82bf16, 0x54801ceb, 0x54801ceb}, |
3063 | + {0x0000a5e4, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec}, |
3064 | + {0x0000a5e8, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec}, |
3065 | + {0x0000a5ec, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec}, |
3066 | + {0x0000a5f0, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec}, |
3067 | + {0x0000a5f4, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec}, |
3068 | + {0x0000a5f8, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec}, |
3069 | + {0x0000a5fc, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec}, |
3070 | {0x0000a600, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, |
3071 | {0x0000a604, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, |
3072 | {0x0000a608, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, |
3073 | {0x0000a60c, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, |
3074 | - {0x0000a610, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, |
3075 | - {0x0000a614, 0x02004000, 0x02004000, 0x01404000, 0x01404000}, |
3076 | - {0x0000a618, 0x02004801, 0x02004801, 0x01404501, 0x01404501}, |
3077 | - {0x0000a61c, 0x02808a02, 0x02808a02, 0x02008501, 0x02008501}, |
3078 | - {0x0000a620, 0x0380ce03, 0x0380ce03, 0x0280ca03, 0x0280ca03}, |
3079 | - {0x0000a624, 0x04411104, 0x04411104, 0x03010c04, 0x03010c04}, |
3080 | - {0x0000a628, 0x04411104, 0x04411104, 0x04014c04, 0x04014c04}, |
3081 | - {0x0000a62c, 0x04411104, 0x04411104, 0x04015005, 0x04015005}, |
3082 | - {0x0000a630, 0x04411104, 0x04411104, 0x04015005, 0x04015005}, |
3083 | - {0x0000a634, 0x04411104, 0x04411104, 0x04015005, 0x04015005}, |
3084 | - {0x0000a638, 0x04411104, 0x04411104, 0x04015005, 0x04015005}, |
3085 | - {0x0000a63c, 0x04411104, 0x04411104, 0x04015005, 0x04015005}, |
3086 | - {0x0000b2dc, 0x00033800, 0x00033800, 0x03aaa352, 0x03aaa352}, |
3087 | - {0x0000b2e0, 0x0003c000, 0x0003c000, 0x03ccc584, 0x03ccc584}, |
3088 | - {0x0000b2e4, 0x03fc0000, 0x03fc0000, 0x03f0f800, 0x03f0f800}, |
3089 | + {0x0000a610, 0x00804000, 0x00804000, 0x00000000, 0x00000000}, |
3090 | + {0x0000a614, 0x00804201, 0x00804201, 0x01404000, 0x01404000}, |
3091 | + {0x0000a618, 0x0280c802, 0x0280c802, 0x01404501, 0x01404501}, |
3092 | + {0x0000a61c, 0x0280ca03, 0x0280ca03, 0x02008501, 0x02008501}, |
3093 | + {0x0000a620, 0x04c15104, 0x04c15104, 0x0280ca03, 0x0280ca03}, |
3094 | + {0x0000a624, 0x04c15305, 0x04c15305, 0x03010c04, 0x03010c04}, |
3095 | + {0x0000a628, 0x04c15305, 0x04c15305, 0x04014c04, 0x04014c04}, |
3096 | + {0x0000a62c, 0x04c15305, 0x04c15305, 0x04015005, 0x04015005}, |
3097 | + {0x0000a630, 0x04c15305, 0x04c15305, 0x04015005, 0x04015005}, |
3098 | + {0x0000a634, 0x04c15305, 0x04c15305, 0x04015005, 0x04015005}, |
3099 | + {0x0000a638, 0x04c15305, 0x04c15305, 0x04015005, 0x04015005}, |
3100 | + {0x0000a63c, 0x04c15305, 0x04c15305, 0x04015005, 0x04015005}, |
3101 | + {0x0000b2dc, 0x0380c7fc, 0x0380c7fc, 0x03aaa352, 0x03aaa352}, |
3102 | + {0x0000b2e0, 0x0000f800, 0x0000f800, 0x03ccc584, 0x03ccc584}, |
3103 | + {0x0000b2e4, 0x03ff0000, 0x03ff0000, 0x03f0f800, 0x03f0f800}, |
3104 | {0x0000b2e8, 0x00000000, 0x00000000, 0x03ff0000, 0x03ff0000}, |
3105 | - {0x0000c2dc, 0x00033800, 0x00033800, 0x03aaa352, 0x03aaa352}, |
3106 | - {0x0000c2e0, 0x0003c000, 0x0003c000, 0x03ccc584, 0x03ccc584}, |
3107 | - {0x0000c2e4, 0x03fc0000, 0x03fc0000, 0x03f0f800, 0x03f0f800}, |
3108 | + {0x0000c2dc, 0x0380c7fc, 0x0380c7fc, 0x03aaa352, 0x03aaa352}, |
3109 | + {0x0000c2e0, 0x0000f800, 0x0000f800, 0x03ccc584, 0x03ccc584}, |
3110 | + {0x0000c2e4, 0x03ff0000, 0x03ff0000, 0x03f0f800, 0x03f0f800}, |
3111 | {0x0000c2e8, 0x00000000, 0x00000000, 0x03ff0000, 0x03ff0000}, |
3112 | {0x00016044, 0x012492d4, 0x012492d4, 0x012492d4, 0x012492d4}, |
3113 | {0x00016048, 0x66480001, 0x66480001, 0x66480001, 0x66480001}, |
3114 | diff --git a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.h b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.h |
3115 | index bb223fe..582ebc4 100644 |
3116 | --- a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.h |
3117 | +++ b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.h |
3118 | @@ -69,13 +69,13 @@ |
3119 | #define AR9300_BASE_ADDR 0x3ff |
3120 | #define AR9300_BASE_ADDR_512 0x1ff |
3121 | |
3122 | -#define AR9300_OTP_BASE 0x14000 |
3123 | -#define AR9300_OTP_STATUS 0x15f18 |
3124 | +#define AR9300_OTP_BASE (AR_SREV_9340(ah) ? 0x30000 : 0x14000) |
3125 | +#define AR9300_OTP_STATUS (AR_SREV_9340(ah) ? 0x30018 : 0x15f18) |
3126 | #define AR9300_OTP_STATUS_TYPE 0x7 |
3127 | #define AR9300_OTP_STATUS_VALID 0x4 |
3128 | #define AR9300_OTP_STATUS_ACCESS_BUSY 0x2 |
3129 | #define AR9300_OTP_STATUS_SM_BUSY 0x1 |
3130 | -#define AR9300_OTP_READ_DATA 0x15f1c |
3131 | +#define AR9300_OTP_READ_DATA (AR_SREV_9340(ah) ? 0x3001c : 0x15f1c) |
3132 | |
3133 | enum targetPowerHTRates { |
3134 | HT_TARGET_RATE_0_8_16, |
3135 | diff --git a/drivers/net/wireless/ath/ath9k/calib.c b/drivers/net/wireless/ath/ath9k/calib.c |
3136 | index e5cceb0..bbd249d 100644 |
3137 | --- a/drivers/net/wireless/ath/ath9k/calib.c |
3138 | +++ b/drivers/net/wireless/ath/ath9k/calib.c |
3139 | @@ -69,6 +69,7 @@ s16 ath9k_hw_getchan_noise(struct ath_hw *ah, struct ath9k_channel *chan) |
3140 | |
3141 | if (chan && chan->noisefloor) { |
3142 | s8 delta = chan->noisefloor - |
3143 | + ATH9K_NF_CAL_NOISE_THRESH - |
3144 | ath9k_hw_get_default_nf(ah, chan); |
3145 | if (delta > 0) |
3146 | noise += delta; |
3147 | diff --git a/drivers/net/wireless/ath/ath9k/calib.h b/drivers/net/wireless/ath/ath9k/calib.h |
3148 | index 3b33996d..1f2e01a 100644 |
3149 | --- a/drivers/net/wireless/ath/ath9k/calib.h |
3150 | +++ b/drivers/net/wireless/ath/ath9k/calib.h |
3151 | @@ -21,6 +21,9 @@ |
3152 | |
3153 | #define AR_PHY_CCA_FILTERWINDOW_LENGTH 5 |
3154 | |
3155 | +/* Internal noise floor can vary by about 6db depending on the frequency */ |
3156 | +#define ATH9K_NF_CAL_NOISE_THRESH 6 |
3157 | + |
3158 | #define NUM_NF_READINGS 6 |
3159 | #define ATH9K_NF_CAL_HIST_MAX 5 |
3160 | |
3161 | diff --git a/drivers/net/wireless/b43/b43.h b/drivers/net/wireless/b43/b43.h |
3162 | index 67c13af..05cb5f6 100644 |
3163 | --- a/drivers/net/wireless/b43/b43.h |
3164 | +++ b/drivers/net/wireless/b43/b43.h |
3165 | @@ -7,6 +7,7 @@ |
3166 | #include <linux/hw_random.h> |
3167 | #include <linux/bcma/bcma.h> |
3168 | #include <linux/ssb/ssb.h> |
3169 | +#include <linux/completion.h> |
3170 | #include <net/mac80211.h> |
3171 | |
3172 | #include "debugfs.h" |
3173 | @@ -718,6 +719,10 @@ enum b43_firmware_file_type { |
3174 | struct b43_request_fw_context { |
3175 | /* The device we are requesting the fw for. */ |
3176 | struct b43_wldev *dev; |
3177 | + /* a completion event structure needed if this call is asynchronous */ |
3178 | + struct completion fw_load_complete; |
3179 | + /* a pointer to the firmware object */ |
3180 | + const struct firmware *blob; |
3181 | /* The type of firmware to request. */ |
3182 | enum b43_firmware_file_type req_type; |
3183 | /* Error messages for each firmware type. */ |
3184 | diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c |
3185 | index 4e465c5..14fd2ca 100644 |
3186 | --- a/drivers/net/wireless/b43/main.c |
3187 | +++ b/drivers/net/wireless/b43/main.c |
3188 | @@ -2088,11 +2088,18 @@ static void b43_print_fw_helptext(struct b43_wl *wl, bool error) |
3189 | b43warn(wl, text); |
3190 | } |
3191 | |
3192 | +static void b43_fw_cb(const struct firmware *firmware, void *context) |
3193 | +{ |
3194 | + struct b43_request_fw_context *ctx = context; |
3195 | + |
3196 | + ctx->blob = firmware; |
3197 | + complete(&ctx->fw_load_complete); |
3198 | +} |
3199 | + |
3200 | int b43_do_request_fw(struct b43_request_fw_context *ctx, |
3201 | const char *name, |
3202 | - struct b43_firmware_file *fw) |
3203 | + struct b43_firmware_file *fw, bool async) |
3204 | { |
3205 | - const struct firmware *blob; |
3206 | struct b43_fw_header *hdr; |
3207 | u32 size; |
3208 | int err; |
3209 | @@ -2131,11 +2138,31 @@ int b43_do_request_fw(struct b43_request_fw_context *ctx, |
3210 | B43_WARN_ON(1); |
3211 | return -ENOSYS; |
3212 | } |
3213 | - err = request_firmware(&blob, ctx->fwname, ctx->dev->dev->dev); |
3214 | + if (async) { |
3215 | + /* do this part asynchronously */ |
3216 | + init_completion(&ctx->fw_load_complete); |
3217 | + err = request_firmware_nowait(THIS_MODULE, 1, ctx->fwname, |
3218 | + ctx->dev->dev->dev, GFP_KERNEL, |
3219 | + ctx, b43_fw_cb); |
3220 | + if (err < 0) { |
3221 | + pr_err("Unable to load firmware\n"); |
3222 | + return err; |
3223 | + } |
3224 | + /* stall here until fw ready */ |
3225 | + wait_for_completion(&ctx->fw_load_complete); |
3226 | + if (ctx->blob) |
3227 | + goto fw_ready; |
3228 | + /* On some ARM systems, the async request will fail, but the next sync |
3229 | + * request works. For this reason, we dall through here |
3230 | + */ |
3231 | + } |
3232 | + err = request_firmware(&ctx->blob, ctx->fwname, |
3233 | + ctx->dev->dev->dev); |
3234 | if (err == -ENOENT) { |
3235 | snprintf(ctx->errors[ctx->req_type], |
3236 | sizeof(ctx->errors[ctx->req_type]), |
3237 | - "Firmware file \"%s\" not found\n", ctx->fwname); |
3238 | + "Firmware file \"%s\" not found\n", |
3239 | + ctx->fwname); |
3240 | return err; |
3241 | } else if (err) { |
3242 | snprintf(ctx->errors[ctx->req_type], |
3243 | @@ -2144,14 +2171,15 @@ int b43_do_request_fw(struct b43_request_fw_context *ctx, |
3244 | ctx->fwname, err); |
3245 | return err; |
3246 | } |
3247 | - if (blob->size < sizeof(struct b43_fw_header)) |
3248 | +fw_ready: |
3249 | + if (ctx->blob->size < sizeof(struct b43_fw_header)) |
3250 | goto err_format; |
3251 | - hdr = (struct b43_fw_header *)(blob->data); |
3252 | + hdr = (struct b43_fw_header *)(ctx->blob->data); |
3253 | switch (hdr->type) { |
3254 | case B43_FW_TYPE_UCODE: |
3255 | case B43_FW_TYPE_PCM: |
3256 | size = be32_to_cpu(hdr->size); |
3257 | - if (size != blob->size - sizeof(struct b43_fw_header)) |
3258 | + if (size != ctx->blob->size - sizeof(struct b43_fw_header)) |
3259 | goto err_format; |
3260 | /* fallthrough */ |
3261 | case B43_FW_TYPE_IV: |
3262 | @@ -2162,7 +2190,7 @@ int b43_do_request_fw(struct b43_request_fw_context *ctx, |
3263 | goto err_format; |
3264 | } |
3265 | |
3266 | - fw->data = blob; |
3267 | + fw->data = ctx->blob; |
3268 | fw->filename = name; |
3269 | fw->type = ctx->req_type; |
3270 | |
3271 | @@ -2172,7 +2200,7 @@ err_format: |
3272 | snprintf(ctx->errors[ctx->req_type], |
3273 | sizeof(ctx->errors[ctx->req_type]), |
3274 | "Firmware file \"%s\" format error.\n", ctx->fwname); |
3275 | - release_firmware(blob); |
3276 | + release_firmware(ctx->blob); |
3277 | |
3278 | return -EPROTO; |
3279 | } |
3280 | @@ -2223,7 +2251,7 @@ static int b43_try_request_fw(struct b43_request_fw_context *ctx) |
3281 | goto err_no_ucode; |
3282 | } |
3283 | } |
3284 | - err = b43_do_request_fw(ctx, filename, &fw->ucode); |
3285 | + err = b43_do_request_fw(ctx, filename, &fw->ucode, true); |
3286 | if (err) |
3287 | goto err_load; |
3288 | |
3289 | @@ -2235,7 +2263,7 @@ static int b43_try_request_fw(struct b43_request_fw_context *ctx) |
3290 | else |
3291 | goto err_no_pcm; |
3292 | fw->pcm_request_failed = false; |
3293 | - err = b43_do_request_fw(ctx, filename, &fw->pcm); |
3294 | + err = b43_do_request_fw(ctx, filename, &fw->pcm, false); |
3295 | if (err == -ENOENT) { |
3296 | /* We did not find a PCM file? Not fatal, but |
3297 | * core rev <= 10 must do without hwcrypto then. */ |
3298 | @@ -2296,7 +2324,7 @@ static int b43_try_request_fw(struct b43_request_fw_context *ctx) |
3299 | default: |
3300 | goto err_no_initvals; |
3301 | } |
3302 | - err = b43_do_request_fw(ctx, filename, &fw->initvals); |
3303 | + err = b43_do_request_fw(ctx, filename, &fw->initvals, false); |
3304 | if (err) |
3305 | goto err_load; |
3306 | |
3307 | @@ -2355,7 +2383,7 @@ static int b43_try_request_fw(struct b43_request_fw_context *ctx) |
3308 | default: |
3309 | goto err_no_initvals; |
3310 | } |
3311 | - err = b43_do_request_fw(ctx, filename, &fw->initvals_band); |
3312 | + err = b43_do_request_fw(ctx, filename, &fw->initvals_band, false); |
3313 | if (err) |
3314 | goto err_load; |
3315 | |
3316 | diff --git a/drivers/net/wireless/b43/main.h b/drivers/net/wireless/b43/main.h |
3317 | index 8c684cd..abac25e 100644 |
3318 | --- a/drivers/net/wireless/b43/main.h |
3319 | +++ b/drivers/net/wireless/b43/main.h |
3320 | @@ -137,9 +137,8 @@ void b43_mac_phy_clock_set(struct b43_wldev *dev, bool on); |
3321 | |
3322 | |
3323 | struct b43_request_fw_context; |
3324 | -int b43_do_request_fw(struct b43_request_fw_context *ctx, |
3325 | - const char *name, |
3326 | - struct b43_firmware_file *fw); |
3327 | +int b43_do_request_fw(struct b43_request_fw_context *ctx, const char *name, |
3328 | + struct b43_firmware_file *fw, bool async); |
3329 | void b43_do_release_fw(struct b43_firmware_file *fw); |
3330 | |
3331 | #endif /* B43_MAIN_H_ */ |
3332 | diff --git a/drivers/net/wireless/mwifiex/sta_ioctl.c b/drivers/net/wireless/mwifiex/sta_ioctl.c |
3333 | index d7b11de..4fb146a 100644 |
3334 | --- a/drivers/net/wireless/mwifiex/sta_ioctl.c |
3335 | +++ b/drivers/net/wireless/mwifiex/sta_ioctl.c |
3336 | @@ -53,7 +53,6 @@ int mwifiex_copy_mcast_addr(struct mwifiex_multicast_list *mlist, |
3337 | */ |
3338 | int mwifiex_wait_queue_complete(struct mwifiex_adapter *adapter) |
3339 | { |
3340 | - bool cancel_flag = false; |
3341 | int status; |
3342 | struct cmd_ctrl_node *cmd_queued; |
3343 | |
3344 | @@ -70,14 +69,11 @@ int mwifiex_wait_queue_complete(struct mwifiex_adapter *adapter) |
3345 | queue_work(adapter->workqueue, &adapter->main_work); |
3346 | |
3347 | /* Wait for completion */ |
3348 | - wait_event_interruptible(adapter->cmd_wait_q.wait, |
3349 | - *(cmd_queued->condition)); |
3350 | - if (!*(cmd_queued->condition)) |
3351 | - cancel_flag = true; |
3352 | - |
3353 | - if (cancel_flag) { |
3354 | - mwifiex_cancel_pending_ioctl(adapter); |
3355 | - dev_dbg(adapter->dev, "cmd cancel\n"); |
3356 | + status = wait_event_interruptible(adapter->cmd_wait_q.wait, |
3357 | + *(cmd_queued->condition)); |
3358 | + if (status) { |
3359 | + dev_err(adapter->dev, "cmd_wait_q terminated: %d\n", status); |
3360 | + return status; |
3361 | } |
3362 | |
3363 | status = adapter->cmd_wait_q.status; |
3364 | @@ -436,8 +432,11 @@ int mwifiex_enable_hs(struct mwifiex_adapter *adapter) |
3365 | return false; |
3366 | } |
3367 | |
3368 | - wait_event_interruptible(adapter->hs_activate_wait_q, |
3369 | - adapter->hs_activate_wait_q_woken); |
3370 | + if (wait_event_interruptible(adapter->hs_activate_wait_q, |
3371 | + adapter->hs_activate_wait_q_woken)) { |
3372 | + dev_err(adapter->dev, "hs_activate_wait_q terminated\n"); |
3373 | + return false; |
3374 | + } |
3375 | |
3376 | return true; |
3377 | } |
3378 | diff --git a/drivers/platform/x86/samsung-laptop.c b/drivers/platform/x86/samsung-laptop.c |
3379 | index e2a34b4..1afbe5e 100644 |
3380 | --- a/drivers/platform/x86/samsung-laptop.c |
3381 | +++ b/drivers/platform/x86/samsung-laptop.c |
3382 | @@ -1506,6 +1506,16 @@ static struct dmi_system_id __initdata samsung_dmi_table[] = { |
3383 | }, |
3384 | .driver_data = &samsung_broken_acpi_video, |
3385 | }, |
3386 | + { |
3387 | + .callback = samsung_dmi_matched, |
3388 | + .ident = "N250P", |
3389 | + .matches = { |
3390 | + DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."), |
3391 | + DMI_MATCH(DMI_PRODUCT_NAME, "N250P"), |
3392 | + DMI_MATCH(DMI_BOARD_NAME, "N250P"), |
3393 | + }, |
3394 | + .driver_data = &samsung_broken_acpi_video, |
3395 | + }, |
3396 | { }, |
3397 | }; |
3398 | MODULE_DEVICE_TABLE(dmi, samsung_dmi_table); |
3399 | diff --git a/drivers/regulator/wm831x-dcdc.c b/drivers/regulator/wm831x-dcdc.c |
3400 | index ff810e7..97bb31d 100644 |
3401 | --- a/drivers/regulator/wm831x-dcdc.c |
3402 | +++ b/drivers/regulator/wm831x-dcdc.c |
3403 | @@ -330,7 +330,7 @@ static int wm831x_buckv_set_voltage(struct regulator_dev *rdev, |
3404 | if (vsel > dcdc->dvs_vsel) { |
3405 | ret = wm831x_set_bits(wm831x, dvs_reg, |
3406 | WM831X_DC1_DVS_VSEL_MASK, |
3407 | - dcdc->dvs_vsel); |
3408 | + vsel); |
3409 | if (ret == 0) |
3410 | dcdc->dvs_vsel = vsel; |
3411 | else |
3412 | diff --git a/drivers/s390/cio/device_pgid.c b/drivers/s390/cio/device_pgid.c |
3413 | index 07a4fd2..daa6b90 100644 |
3414 | --- a/drivers/s390/cio/device_pgid.c |
3415 | +++ b/drivers/s390/cio/device_pgid.c |
3416 | @@ -234,7 +234,7 @@ static int pgid_cmp(struct pgid *p1, struct pgid *p2) |
3417 | * Determine pathgroup state from PGID data. |
3418 | */ |
3419 | static void pgid_analyze(struct ccw_device *cdev, struct pgid **p, |
3420 | - int *mismatch, int *reserved, u8 *reset) |
3421 | + int *mismatch, u8 *reserved, u8 *reset) |
3422 | { |
3423 | struct pgid *pgid = &cdev->private->pgid[0]; |
3424 | struct pgid *first = NULL; |
3425 | @@ -248,7 +248,7 @@ static void pgid_analyze(struct ccw_device *cdev, struct pgid **p, |
3426 | if ((cdev->private->pgid_valid_mask & lpm) == 0) |
3427 | continue; |
3428 | if (pgid->inf.ps.state2 == SNID_STATE2_RESVD_ELSE) |
3429 | - *reserved = 1; |
3430 | + *reserved |= lpm; |
3431 | if (pgid_is_reset(pgid)) { |
3432 | *reset |= lpm; |
3433 | continue; |
3434 | @@ -316,14 +316,14 @@ static void snid_done(struct ccw_device *cdev, int rc) |
3435 | struct subchannel *sch = to_subchannel(cdev->dev.parent); |
3436 | struct pgid *pgid; |
3437 | int mismatch = 0; |
3438 | - int reserved = 0; |
3439 | + u8 reserved = 0; |
3440 | u8 reset = 0; |
3441 | u8 donepm; |
3442 | |
3443 | if (rc) |
3444 | goto out; |
3445 | pgid_analyze(cdev, &pgid, &mismatch, &reserved, &reset); |
3446 | - if (reserved) |
3447 | + if (reserved == cdev->private->pgid_valid_mask) |
3448 | rc = -EUSERS; |
3449 | else if (mismatch) |
3450 | rc = -EOPNOTSUPP; |
3451 | @@ -336,7 +336,7 @@ static void snid_done(struct ccw_device *cdev, int rc) |
3452 | } |
3453 | out: |
3454 | CIO_MSG_EVENT(2, "snid: device 0.%x.%04x: rc=%d pvm=%02x vpm=%02x " |
3455 | - "todo=%02x mism=%d rsvd=%d reset=%02x\n", id->ssid, |
3456 | + "todo=%02x mism=%d rsvd=%02x reset=%02x\n", id->ssid, |
3457 | id->devno, rc, cdev->private->pgid_valid_mask, sch->vpm, |
3458 | cdev->private->pgid_todo_mask, mismatch, reserved, reset); |
3459 | switch (rc) { |
3460 | diff --git a/drivers/scsi/mvsas/mv_94xx.h b/drivers/scsi/mvsas/mv_94xx.h |
3461 | index 8f7eb4f..487aa6f 100644 |
3462 | --- a/drivers/scsi/mvsas/mv_94xx.h |
3463 | +++ b/drivers/scsi/mvsas/mv_94xx.h |
3464 | @@ -258,21 +258,11 @@ enum sas_sata_phy_regs { |
3465 | #define SPI_ADDR_VLD_94XX (1U << 1) |
3466 | #define SPI_CTRL_SpiStart_94XX (1U << 0) |
3467 | |
3468 | -#define mv_ffc(x) ffz(x) |
3469 | - |
3470 | static inline int |
3471 | mv_ffc64(u64 v) |
3472 | { |
3473 | - int i; |
3474 | - i = mv_ffc((u32)v); |
3475 | - if (i >= 0) |
3476 | - return i; |
3477 | - i = mv_ffc((u32)(v>>32)); |
3478 | - |
3479 | - if (i != 0) |
3480 | - return 32 + i; |
3481 | - |
3482 | - return -1; |
3483 | + u64 x = ~v; |
3484 | + return x ? __ffs64(x) : -1; |
3485 | } |
3486 | |
3487 | #define r_reg_set_enable(i) \ |
3488 | diff --git a/drivers/scsi/mvsas/mv_sas.c b/drivers/scsi/mvsas/mv_sas.c |
3489 | index 3006ec9..dbb8edf 100644 |
3490 | --- a/drivers/scsi/mvsas/mv_sas.c |
3491 | +++ b/drivers/scsi/mvsas/mv_sas.c |
3492 | @@ -1629,7 +1629,7 @@ int mvs_abort_task(struct sas_task *task) |
3493 | mv_dprintk("mvs_abort_task() mvi=%p task=%p " |
3494 | "slot=%p slot_idx=x%x\n", |
3495 | mvi, task, slot, slot_idx); |
3496 | - mvs_tmf_timedout((unsigned long)task); |
3497 | + task->task_state_flags |= SAS_TASK_STATE_ABORTED; |
3498 | mvs_slot_task_free(mvi, task, slot, slot_idx); |
3499 | rc = TMF_RESP_FUNC_COMPLETE; |
3500 | goto out; |
3501 | diff --git a/drivers/scsi/mvsas/mv_sas.h b/drivers/scsi/mvsas/mv_sas.h |
3502 | index c04a4f5..da24955 100644 |
3503 | --- a/drivers/scsi/mvsas/mv_sas.h |
3504 | +++ b/drivers/scsi/mvsas/mv_sas.h |
3505 | @@ -69,7 +69,7 @@ extern struct kmem_cache *mvs_task_list_cache; |
3506 | #define DEV_IS_EXPANDER(type) \ |
3507 | ((type == EDGE_DEV) || (type == FANOUT_DEV)) |
3508 | |
3509 | -#define bit(n) ((u32)1 << n) |
3510 | +#define bit(n) ((u64)1 << n) |
3511 | |
3512 | #define for_each_phy(__lseq_mask, __mc, __lseq) \ |
3513 | for ((__mc) = (__lseq_mask), (__lseq) = 0; \ |
3514 | diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c |
3515 | index 7db8033..da1315e 100644 |
3516 | --- a/drivers/scsi/qla2xxx/qla_os.c |
3517 | +++ b/drivers/scsi/qla2xxx/qla_os.c |
3518 | @@ -3735,9 +3735,9 @@ qla2x00_do_dpc(void *data) |
3519 | "ISP abort end.\n"); |
3520 | } |
3521 | |
3522 | - if (test_bit(FCPORT_UPDATE_NEEDED, &base_vha->dpc_flags)) { |
3523 | + if (test_and_clear_bit(FCPORT_UPDATE_NEEDED, |
3524 | + &base_vha->dpc_flags)) { |
3525 | qla2x00_update_fcports(base_vha); |
3526 | - clear_bit(FCPORT_UPDATE_NEEDED, &base_vha->dpc_flags); |
3527 | } |
3528 | |
3529 | if (test_bit(ISP_QUIESCE_NEEDED, &base_vha->dpc_flags)) { |
3530 | diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c |
3531 | index 08d48a3..72ca515 100644 |
3532 | --- a/drivers/scsi/scsi_sysfs.c |
3533 | +++ b/drivers/scsi/scsi_sysfs.c |
3534 | @@ -246,11 +246,11 @@ show_shost_active_mode(struct device *dev, |
3535 | |
3536 | static DEVICE_ATTR(active_mode, S_IRUGO | S_IWUSR, show_shost_active_mode, NULL); |
3537 | |
3538 | -static int check_reset_type(char *str) |
3539 | +static int check_reset_type(const char *str) |
3540 | { |
3541 | - if (strncmp(str, "adapter", 10) == 0) |
3542 | + if (sysfs_streq(str, "adapter")) |
3543 | return SCSI_ADAPTER_RESET; |
3544 | - else if (strncmp(str, "firmware", 10) == 0) |
3545 | + else if (sysfs_streq(str, "firmware")) |
3546 | return SCSI_FIRMWARE_RESET; |
3547 | else |
3548 | return 0; |
3549 | @@ -263,12 +263,9 @@ store_host_reset(struct device *dev, struct device_attribute *attr, |
3550 | struct Scsi_Host *shost = class_to_shost(dev); |
3551 | struct scsi_host_template *sht = shost->hostt; |
3552 | int ret = -EINVAL; |
3553 | - char str[10]; |
3554 | int type; |
3555 | |
3556 | - sscanf(buf, "%s", str); |
3557 | - type = check_reset_type(str); |
3558 | - |
3559 | + type = check_reset_type(buf); |
3560 | if (!type) |
3561 | goto exit_store_host_reset; |
3562 | |
3563 | diff --git a/drivers/staging/comedi/Kconfig b/drivers/staging/comedi/Kconfig |
3564 | index 12c691d..f11cfc8 100644 |
3565 | --- a/drivers/staging/comedi/Kconfig |
3566 | +++ b/drivers/staging/comedi/Kconfig |
3567 | @@ -424,6 +424,7 @@ config COMEDI_ADQ12B |
3568 | |
3569 | config COMEDI_NI_AT_A2150 |
3570 | tristate "NI AT-A2150 ISA card support" |
3571 | + select COMEDI_FC |
3572 | depends on COMEDI_NI_COMMON |
3573 | depends on VIRT_TO_BUS |
3574 | default N |
3575 | diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c |
3576 | index b719460..b67c107 100644 |
3577 | --- a/drivers/staging/comedi/comedi_fops.c |
3578 | +++ b/drivers/staging/comedi/comedi_fops.c |
3579 | @@ -138,6 +138,9 @@ static long comedi_unlocked_ioctl(struct file *file, unsigned int cmd, |
3580 | if (cmd == COMEDI_DEVCONFIG) { |
3581 | rc = do_devconfig_ioctl(dev, |
3582 | (struct comedi_devconfig __user *)arg); |
3583 | + if (rc == 0) |
3584 | + /* Evade comedi_auto_unconfig(). */ |
3585 | + dev_file_info->hardware_device = NULL; |
3586 | goto done; |
3587 | } |
3588 | |
3589 | @@ -2207,6 +2210,7 @@ int comedi_alloc_board_minor(struct device *hardware_device) |
3590 | kfree(info); |
3591 | return -ENOMEM; |
3592 | } |
3593 | + info->hardware_device = hardware_device; |
3594 | comedi_device_init(info->device); |
3595 | spin_lock_irqsave(&comedi_file_info_table_lock, flags); |
3596 | for (i = 0; i < COMEDI_NUM_BOARD_MINORS; ++i) { |
3597 | @@ -2295,6 +2299,23 @@ void comedi_free_board_minor(unsigned minor) |
3598 | } |
3599 | } |
3600 | |
3601 | +int comedi_find_board_minor(struct device *hardware_device) |
3602 | +{ |
3603 | + int minor; |
3604 | + struct comedi_device_file_info *info; |
3605 | + |
3606 | + for (minor = 0; minor < COMEDI_NUM_BOARD_MINORS; minor++) { |
3607 | + spin_lock(&comedi_file_info_table_lock); |
3608 | + info = comedi_file_info_table[minor]; |
3609 | + if (info && info->hardware_device == hardware_device) { |
3610 | + spin_unlock(&comedi_file_info_table_lock); |
3611 | + return minor; |
3612 | + } |
3613 | + spin_unlock(&comedi_file_info_table_lock); |
3614 | + } |
3615 | + return -ENODEV; |
3616 | +} |
3617 | + |
3618 | int comedi_alloc_subdevice_minor(struct comedi_device *dev, |
3619 | struct comedi_subdevice *s) |
3620 | { |
3621 | diff --git a/drivers/staging/comedi/comedidev.h b/drivers/staging/comedi/comedidev.h |
3622 | index 7a0d4bc..00d3c65 100644 |
3623 | --- a/drivers/staging/comedi/comedidev.h |
3624 | +++ b/drivers/staging/comedi/comedidev.h |
3625 | @@ -234,6 +234,7 @@ struct comedi_device_file_info { |
3626 | struct comedi_device *device; |
3627 | struct comedi_subdevice *read_subdevice; |
3628 | struct comedi_subdevice *write_subdevice; |
3629 | + struct device *hardware_device; |
3630 | }; |
3631 | |
3632 | #ifdef CONFIG_COMEDI_DEBUG |
3633 | diff --git a/drivers/staging/comedi/drivers.c b/drivers/staging/comedi/drivers.c |
3634 | index bf185e2..0fc1b99 100644 |
3635 | --- a/drivers/staging/comedi/drivers.c |
3636 | +++ b/drivers/staging/comedi/drivers.c |
3637 | @@ -822,25 +822,14 @@ static int comedi_auto_config(struct device *hardware_device, |
3638 | int minor; |
3639 | struct comedi_device_file_info *dev_file_info; |
3640 | int retval; |
3641 | - unsigned *private_data = NULL; |
3642 | |
3643 | - if (!comedi_autoconfig) { |
3644 | - dev_set_drvdata(hardware_device, NULL); |
3645 | + if (!comedi_autoconfig) |
3646 | return 0; |
3647 | - } |
3648 | |
3649 | minor = comedi_alloc_board_minor(hardware_device); |
3650 | if (minor < 0) |
3651 | return minor; |
3652 | |
3653 | - private_data = kmalloc(sizeof(unsigned), GFP_KERNEL); |
3654 | - if (private_data == NULL) { |
3655 | - retval = -ENOMEM; |
3656 | - goto cleanup; |
3657 | - } |
3658 | - *private_data = minor; |
3659 | - dev_set_drvdata(hardware_device, private_data); |
3660 | - |
3661 | dev_file_info = comedi_get_device_file_info(minor); |
3662 | |
3663 | memset(&it, 0, sizeof(it)); |
3664 | @@ -853,25 +842,22 @@ static int comedi_auto_config(struct device *hardware_device, |
3665 | retval = comedi_device_attach(dev_file_info->device, &it); |
3666 | mutex_unlock(&dev_file_info->device->mutex); |
3667 | |
3668 | -cleanup: |
3669 | - if (retval < 0) { |
3670 | - kfree(private_data); |
3671 | + if (retval < 0) |
3672 | comedi_free_board_minor(minor); |
3673 | - } |
3674 | return retval; |
3675 | } |
3676 | |
3677 | static void comedi_auto_unconfig(struct device *hardware_device) |
3678 | { |
3679 | - unsigned *minor = (unsigned *)dev_get_drvdata(hardware_device); |
3680 | - if (minor == NULL) |
3681 | - return; |
3682 | - |
3683 | - BUG_ON(*minor >= COMEDI_NUM_BOARD_MINORS); |
3684 | + int minor; |
3685 | |
3686 | - comedi_free_board_minor(*minor); |
3687 | - dev_set_drvdata(hardware_device, NULL); |
3688 | - kfree(minor); |
3689 | + if (hardware_device == NULL) |
3690 | + return; |
3691 | + minor = comedi_find_board_minor(hardware_device); |
3692 | + if (minor < 0) |
3693 | + return; |
3694 | + BUG_ON(minor >= COMEDI_NUM_BOARD_MINORS); |
3695 | + comedi_free_board_minor(minor); |
3696 | } |
3697 | |
3698 | int comedi_pci_auto_config(struct pci_dev *pcidev, const char *board_name) |
3699 | diff --git a/drivers/staging/comedi/drivers/comedi_test.c b/drivers/staging/comedi/drivers/comedi_test.c |
3700 | index a804742..2567f9a 100644 |
3701 | --- a/drivers/staging/comedi/drivers/comedi_test.c |
3702 | +++ b/drivers/staging/comedi/drivers/comedi_test.c |
3703 | @@ -461,7 +461,7 @@ static int waveform_ai_cancel(struct comedi_device *dev, |
3704 | struct comedi_subdevice *s) |
3705 | { |
3706 | devpriv->timer_running = 0; |
3707 | - del_timer(&devpriv->timer); |
3708 | + del_timer_sync(&devpriv->timer); |
3709 | return 0; |
3710 | } |
3711 | |
3712 | diff --git a/drivers/staging/comedi/drivers/ni_pcimio.c b/drivers/staging/comedi/drivers/ni_pcimio.c |
3713 | index 27baefa..59c1f88 100644 |
3714 | --- a/drivers/staging/comedi/drivers/ni_pcimio.c |
3715 | +++ b/drivers/staging/comedi/drivers/ni_pcimio.c |
3716 | @@ -1023,7 +1023,7 @@ static const struct ni_board_struct ni_boards[] = { |
3717 | .ao_range_table = &range_ni_M_625x_ao, |
3718 | .reg_type = ni_reg_625x, |
3719 | .ao_unipolar = 0, |
3720 | - .ao_speed = 357, |
3721 | + .ao_speed = 350, |
3722 | .num_p0_dio_channels = 8, |
3723 | .caldac = {caldac_none}, |
3724 | .has_8255 = 0, |
3725 | @@ -1042,7 +1042,7 @@ static const struct ni_board_struct ni_boards[] = { |
3726 | .ao_range_table = &range_ni_M_625x_ao, |
3727 | .reg_type = ni_reg_625x, |
3728 | .ao_unipolar = 0, |
3729 | - .ao_speed = 357, |
3730 | + .ao_speed = 350, |
3731 | .num_p0_dio_channels = 8, |
3732 | .caldac = {caldac_none}, |
3733 | .has_8255 = 0, |
3734 | @@ -1061,7 +1061,7 @@ static const struct ni_board_struct ni_boards[] = { |
3735 | .ao_range_table = &range_ni_M_625x_ao, |
3736 | .reg_type = ni_reg_625x, |
3737 | .ao_unipolar = 0, |
3738 | - .ao_speed = 357, |
3739 | + .ao_speed = 350, |
3740 | .num_p0_dio_channels = 8, |
3741 | .caldac = {caldac_none}, |
3742 | .has_8255 = 0, |
3743 | @@ -1097,7 +1097,7 @@ static const struct ni_board_struct ni_boards[] = { |
3744 | .ao_range_table = &range_ni_M_625x_ao, |
3745 | .reg_type = ni_reg_625x, |
3746 | .ao_unipolar = 0, |
3747 | - .ao_speed = 357, |
3748 | + .ao_speed = 350, |
3749 | .num_p0_dio_channels = 32, |
3750 | .caldac = {caldac_none}, |
3751 | .has_8255 = 0, |
3752 | @@ -1116,7 +1116,7 @@ static const struct ni_board_struct ni_boards[] = { |
3753 | .ao_range_table = &range_ni_M_625x_ao, |
3754 | .reg_type = ni_reg_625x, |
3755 | .ao_unipolar = 0, |
3756 | - .ao_speed = 357, |
3757 | + .ao_speed = 350, |
3758 | .num_p0_dio_channels = 32, |
3759 | .caldac = {caldac_none}, |
3760 | .has_8255 = 0, |
3761 | @@ -1152,7 +1152,7 @@ static const struct ni_board_struct ni_boards[] = { |
3762 | .ao_range_table = &range_ni_M_628x_ao, |
3763 | .reg_type = ni_reg_628x, |
3764 | .ao_unipolar = 1, |
3765 | - .ao_speed = 357, |
3766 | + .ao_speed = 350, |
3767 | .num_p0_dio_channels = 8, |
3768 | .caldac = {caldac_none}, |
3769 | .has_8255 = 0, |
3770 | @@ -1171,7 +1171,7 @@ static const struct ni_board_struct ni_boards[] = { |
3771 | .ao_range_table = &range_ni_M_628x_ao, |
3772 | .reg_type = ni_reg_628x, |
3773 | .ao_unipolar = 1, |
3774 | - .ao_speed = 357, |
3775 | + .ao_speed = 350, |
3776 | .num_p0_dio_channels = 8, |
3777 | .caldac = {caldac_none}, |
3778 | .has_8255 = 0, |
3779 | @@ -1207,7 +1207,7 @@ static const struct ni_board_struct ni_boards[] = { |
3780 | .ao_range_table = &range_ni_M_628x_ao, |
3781 | .reg_type = ni_reg_628x, |
3782 | .ao_unipolar = 1, |
3783 | - .ao_speed = 357, |
3784 | + .ao_speed = 350, |
3785 | .num_p0_dio_channels = 32, |
3786 | .caldac = {caldac_none}, |
3787 | .has_8255 = 0, |
3788 | diff --git a/drivers/staging/comedi/internal.h b/drivers/staging/comedi/internal.h |
3789 | index 434ce34..4208fb4 100644 |
3790 | --- a/drivers/staging/comedi/internal.h |
3791 | +++ b/drivers/staging/comedi/internal.h |
3792 | @@ -7,6 +7,7 @@ int insn_inval(struct comedi_device *dev, struct comedi_subdevice *s, |
3793 | struct comedi_insn *insn, unsigned int *data); |
3794 | int comedi_alloc_board_minor(struct device *hardware_device); |
3795 | void comedi_free_board_minor(unsigned minor); |
3796 | +int comedi_find_board_minor(struct device *hardware_device); |
3797 | void comedi_reset_async_buf(struct comedi_async *async); |
3798 | int comedi_buf_alloc(struct comedi_device *dev, struct comedi_subdevice *s, |
3799 | unsigned long new_size); |
3800 | diff --git a/drivers/staging/rtl8712/usb_intf.c b/drivers/staging/rtl8712/usb_intf.c |
3801 | index 2c80745..7b3ae00 100644 |
3802 | --- a/drivers/staging/rtl8712/usb_intf.c |
3803 | +++ b/drivers/staging/rtl8712/usb_intf.c |
3804 | @@ -66,6 +66,8 @@ static struct usb_device_id rtl871x_usb_id_tbl[] = { |
3805 | {USB_DEVICE(0x0B05, 0x1791)}, /* 11n mode disable */ |
3806 | /* Belkin */ |
3807 | {USB_DEVICE(0x050D, 0x945A)}, |
3808 | + /* ISY IWL - Belkin clone */ |
3809 | + {USB_DEVICE(0x050D, 0x11F1)}, |
3810 | /* Corega */ |
3811 | {USB_DEVICE(0x07AA, 0x0047)}, |
3812 | /* D-Link */ |
3813 | diff --git a/drivers/staging/speakup/synth.c b/drivers/staging/speakup/synth.c |
3814 | index 331eae7..5710fc5 100644 |
3815 | --- a/drivers/staging/speakup/synth.c |
3816 | +++ b/drivers/staging/speakup/synth.c |
3817 | @@ -342,7 +342,7 @@ int synth_init(char *synth_name) |
3818 | |
3819 | mutex_lock(&spk_mutex); |
3820 | /* First, check if we already have it loaded. */ |
3821 | - for (i = 0; synths[i] != NULL && i < MAXSYNTHS; i++) |
3822 | + for (i = 0; i < MAXSYNTHS && synths[i] != NULL; i++) |
3823 | if (strcmp(synths[i]->name, synth_name) == 0) |
3824 | synth = synths[i]; |
3825 | |
3826 | @@ -423,7 +423,7 @@ int synth_add(struct spk_synth *in_synth) |
3827 | int i; |
3828 | int status = 0; |
3829 | mutex_lock(&spk_mutex); |
3830 | - for (i = 0; synths[i] != NULL && i < MAXSYNTHS; i++) |
3831 | + for (i = 0; i < MAXSYNTHS && synths[i] != NULL; i++) |
3832 | /* synth_remove() is responsible for rotating the array down */ |
3833 | if (in_synth == synths[i]) { |
3834 | mutex_unlock(&spk_mutex); |
3835 | diff --git a/drivers/staging/vt6656/dpc.c b/drivers/staging/vt6656/dpc.c |
3836 | index 08021f4..4664e9d 100644 |
3837 | --- a/drivers/staging/vt6656/dpc.c |
3838 | +++ b/drivers/staging/vt6656/dpc.c |
3839 | @@ -1238,7 +1238,7 @@ static BOOL s_bHandleRxEncryption ( |
3840 | |
3841 | PayloadLen -= (WLAN_HDR_ADDR3_LEN + 8 + 4); // 24 is 802.11 header, 8 is IV&ExtIV, 4 is crc |
3842 | *pdwRxTSC47_16 = cpu_to_le32(*(PDWORD)(pbyIV + 4)); |
3843 | - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"ExtIV: %lx\n",*pdwRxTSC47_16); |
3844 | + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"ExtIV: %x\n", *pdwRxTSC47_16); |
3845 | if (byDecMode == KEY_CTL_TKIP) { |
3846 | *pwRxTSC15_0 = cpu_to_le16(MAKEWORD(*(pbyIV+2), *pbyIV)); |
3847 | } else { |
3848 | @@ -1349,7 +1349,7 @@ static BOOL s_bHostWepRxEncryption ( |
3849 | |
3850 | PayloadLen -= (WLAN_HDR_ADDR3_LEN + 8 + 4); // 24 is 802.11 header, 8 is IV&ExtIV, 4 is crc |
3851 | *pdwRxTSC47_16 = cpu_to_le32(*(PDWORD)(pbyIV + 4)); |
3852 | - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"ExtIV: %lx\n",*pdwRxTSC47_16); |
3853 | + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"ExtIV: %x\n", *pdwRxTSC47_16); |
3854 | |
3855 | if (byDecMode == KEY_CTL_TKIP) { |
3856 | *pwRxTSC15_0 = cpu_to_le16(MAKEWORD(*(pbyIV+2), *pbyIV)); |
3857 | diff --git a/drivers/staging/vt6656/key.c b/drivers/staging/vt6656/key.c |
3858 | index ee62a06..ba3a561 100644 |
3859 | --- a/drivers/staging/vt6656/key.c |
3860 | +++ b/drivers/staging/vt6656/key.c |
3861 | @@ -223,7 +223,7 @@ BOOL KeybSetKey( |
3862 | PSKeyManagement pTable, |
3863 | PBYTE pbyBSSID, |
3864 | DWORD dwKeyIndex, |
3865 | - unsigned long uKeyLength, |
3866 | + u32 uKeyLength, |
3867 | PQWORD pKeyRSC, |
3868 | PBYTE pbyKey, |
3869 | BYTE byKeyDecMode |
3870 | @@ -235,7 +235,8 @@ BOOL KeybSetKey( |
3871 | PSKeyItem pKey; |
3872 | unsigned int uKeyIdx; |
3873 | |
3874 | - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Enter KeybSetKey: %lX\n", dwKeyIndex); |
3875 | + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO |
3876 | + "Enter KeybSetKey: %X\n", dwKeyIndex); |
3877 | |
3878 | j = (MAX_KEY_TABLE-1); |
3879 | for (i=0;i<(MAX_KEY_TABLE-1);i++) { |
3880 | @@ -261,7 +262,9 @@ BOOL KeybSetKey( |
3881 | if ((dwKeyIndex & TRANSMIT_KEY) != 0) { |
3882 | // Group transmit key |
3883 | pTable->KeyTable[i].dwGTKeyIndex = dwKeyIndex; |
3884 | - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Group transmit key(R)[%lX]: %d\n", pTable->KeyTable[i].dwGTKeyIndex, i); |
3885 | + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO |
3886 | + "Group transmit key(R)[%X]: %d\n", |
3887 | + pTable->KeyTable[i].dwGTKeyIndex, i); |
3888 | } |
3889 | pTable->KeyTable[i].wKeyCtl &= 0xFF0F; // clear group key control filed |
3890 | pTable->KeyTable[i].wKeyCtl |= (byKeyDecMode << 4); |
3891 | @@ -302,9 +305,12 @@ BOOL KeybSetKey( |
3892 | } |
3893 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"\n"); |
3894 | |
3895 | - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey->dwTSC47_16: %lx\n ", pKey->dwTSC47_16); |
3896 | - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey->wTSC15_0: %x\n ", pKey->wTSC15_0); |
3897 | - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey->dwKeyIndex: %lx\n ", pKey->dwKeyIndex); |
3898 | + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey->dwTSC47_16: %x\n ", |
3899 | + pKey->dwTSC47_16); |
3900 | + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey->wTSC15_0: %x\n ", |
3901 | + pKey->wTSC15_0); |
3902 | + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey->dwKeyIndex: %x\n ", |
3903 | + pKey->dwKeyIndex); |
3904 | |
3905 | return (TRUE); |
3906 | } |
3907 | @@ -326,7 +332,9 @@ BOOL KeybSetKey( |
3908 | if ((dwKeyIndex & TRANSMIT_KEY) != 0) { |
3909 | // Group transmit key |
3910 | pTable->KeyTable[j].dwGTKeyIndex = dwKeyIndex; |
3911 | - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Group transmit key(N)[%lX]: %d\n", pTable->KeyTable[j].dwGTKeyIndex, j); |
3912 | + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO |
3913 | + "Group transmit key(N)[%X]: %d\n", |
3914 | + pTable->KeyTable[j].dwGTKeyIndex, j); |
3915 | } |
3916 | pTable->KeyTable[j].wKeyCtl &= 0xFF0F; // clear group key control filed |
3917 | pTable->KeyTable[j].wKeyCtl |= (byKeyDecMode << 4); |
3918 | @@ -367,9 +375,11 @@ BOOL KeybSetKey( |
3919 | } |
3920 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"\n"); |
3921 | |
3922 | - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey->dwTSC47_16: %lx\n ", pKey->dwTSC47_16); |
3923 | + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey->dwTSC47_16: %x\n ", |
3924 | + pKey->dwTSC47_16); |
3925 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey->wTSC15_0: %x\n ", pKey->wTSC15_0); |
3926 | - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey->dwKeyIndex: %lx\n ", pKey->dwKeyIndex); |
3927 | + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey->dwKeyIndex: %x\n ", |
3928 | + pKey->dwKeyIndex); |
3929 | |
3930 | return (TRUE); |
3931 | } |
3932 | @@ -597,7 +607,8 @@ BOOL KeybGetTransmitKey(PSKeyManagement pTable, PBYTE pbyBSSID, DWORD dwKeyType, |
3933 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"%x ", pTable->KeyTable[i].abyBSSID[ii]); |
3934 | } |
3935 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"\n"); |
3936 | - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"dwGTKeyIndex: %lX\n", pTable->KeyTable[i].dwGTKeyIndex); |
3937 | + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"dwGTKeyIndex: %X\n", |
3938 | + pTable->KeyTable[i].dwGTKeyIndex); |
3939 | |
3940 | return (TRUE); |
3941 | } |
3942 | @@ -664,7 +675,7 @@ BOOL KeybSetDefaultKey( |
3943 | void *pDeviceHandler, |
3944 | PSKeyManagement pTable, |
3945 | DWORD dwKeyIndex, |
3946 | - unsigned long uKeyLength, |
3947 | + u32 uKeyLength, |
3948 | PQWORD pKeyRSC, |
3949 | PBYTE pbyKey, |
3950 | BYTE byKeyDecMode |
3951 | @@ -696,7 +707,10 @@ BOOL KeybSetDefaultKey( |
3952 | if ((dwKeyIndex & TRANSMIT_KEY) != 0) { |
3953 | // Group transmit key |
3954 | pTable->KeyTable[MAX_KEY_TABLE-1].dwGTKeyIndex = dwKeyIndex; |
3955 | - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Group transmit key(R)[%lX]: %d\n", pTable->KeyTable[MAX_KEY_TABLE-1].dwGTKeyIndex, MAX_KEY_TABLE-1); |
3956 | + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO |
3957 | + "Group transmit key(R)[%X]: %d\n", |
3958 | + pTable->KeyTable[MAX_KEY_TABLE-1].dwGTKeyIndex, |
3959 | + MAX_KEY_TABLE-1); |
3960 | |
3961 | } |
3962 | pTable->KeyTable[MAX_KEY_TABLE-1].wKeyCtl &= 0x7F00; // clear all key control filed |
3963 | @@ -747,9 +761,11 @@ BOOL KeybSetDefaultKey( |
3964 | } |
3965 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"\n"); |
3966 | |
3967 | - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey->dwTSC47_16: %lx\n", pKey->dwTSC47_16); |
3968 | + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey->dwTSC47_16: %x\n", |
3969 | + pKey->dwTSC47_16); |
3970 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey->wTSC15_0: %x\n", pKey->wTSC15_0); |
3971 | - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey->dwKeyIndex: %lx\n", pKey->dwKeyIndex); |
3972 | + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey->dwKeyIndex: %x\n", |
3973 | + pKey->dwKeyIndex); |
3974 | |
3975 | return (TRUE); |
3976 | } |
3977 | @@ -775,7 +791,7 @@ BOOL KeybSetAllGroupKey( |
3978 | void *pDeviceHandler, |
3979 | PSKeyManagement pTable, |
3980 | DWORD dwKeyIndex, |
3981 | - unsigned long uKeyLength, |
3982 | + u32 uKeyLength, |
3983 | PQWORD pKeyRSC, |
3984 | PBYTE pbyKey, |
3985 | BYTE byKeyDecMode |
3986 | @@ -787,7 +803,8 @@ BOOL KeybSetAllGroupKey( |
3987 | PSKeyItem pKey; |
3988 | unsigned int uKeyIdx; |
3989 | |
3990 | - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Enter KeybSetAllGroupKey: %lX\n", dwKeyIndex); |
3991 | + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Enter KeybSetAllGroupKey: %X\n", |
3992 | + dwKeyIndex); |
3993 | |
3994 | |
3995 | if ((dwKeyIndex & PAIRWISE_KEY) != 0) { // Pairwise key |
3996 | @@ -804,7 +821,9 @@ BOOL KeybSetAllGroupKey( |
3997 | if ((dwKeyIndex & TRANSMIT_KEY) != 0) { |
3998 | // Group transmit key |
3999 | pTable->KeyTable[i].dwGTKeyIndex = dwKeyIndex; |
4000 | - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Group transmit key(R)[%lX]: %d\n", pTable->KeyTable[i].dwGTKeyIndex, i); |
4001 | + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO |
4002 | + "Group transmit key(R)[%X]: %d\n", |
4003 | + pTable->KeyTable[i].dwGTKeyIndex, i); |
4004 | |
4005 | } |
4006 | pTable->KeyTable[i].wKeyCtl &= 0xFF0F; // clear group key control filed |
4007 | diff --git a/drivers/staging/vt6656/key.h b/drivers/staging/vt6656/key.h |
4008 | index f749c7a..bd35d39 100644 |
4009 | --- a/drivers/staging/vt6656/key.h |
4010 | +++ b/drivers/staging/vt6656/key.h |
4011 | @@ -58,7 +58,7 @@ |
4012 | typedef struct tagSKeyItem |
4013 | { |
4014 | BOOL bKeyValid; |
4015 | - unsigned long uKeyLength; |
4016 | + u32 uKeyLength; |
4017 | BYTE abyKey[MAX_KEY_LEN]; |
4018 | QWORD KeyRSC; |
4019 | DWORD dwTSC47_16; |
4020 | @@ -107,7 +107,7 @@ BOOL KeybSetKey( |
4021 | PSKeyManagement pTable, |
4022 | PBYTE pbyBSSID, |
4023 | DWORD dwKeyIndex, |
4024 | - unsigned long uKeyLength, |
4025 | + u32 uKeyLength, |
4026 | PQWORD pKeyRSC, |
4027 | PBYTE pbyKey, |
4028 | BYTE byKeyDecMode |
4029 | @@ -146,7 +146,7 @@ BOOL KeybSetDefaultKey( |
4030 | void *pDeviceHandler, |
4031 | PSKeyManagement pTable, |
4032 | DWORD dwKeyIndex, |
4033 | - unsigned long uKeyLength, |
4034 | + u32 uKeyLength, |
4035 | PQWORD pKeyRSC, |
4036 | PBYTE pbyKey, |
4037 | BYTE byKeyDecMode |
4038 | @@ -156,7 +156,7 @@ BOOL KeybSetAllGroupKey( |
4039 | void *pDeviceHandler, |
4040 | PSKeyManagement pTable, |
4041 | DWORD dwKeyIndex, |
4042 | - unsigned long uKeyLength, |
4043 | + u32 uKeyLength, |
4044 | PQWORD pKeyRSC, |
4045 | PBYTE pbyKey, |
4046 | BYTE byKeyDecMode |
4047 | diff --git a/drivers/staging/vt6656/mac.c b/drivers/staging/vt6656/mac.c |
4048 | index af4a29d..8fddc7b 100644 |
4049 | --- a/drivers/staging/vt6656/mac.c |
4050 | +++ b/drivers/staging/vt6656/mac.c |
4051 | @@ -260,7 +260,8 @@ BYTE pbyData[24]; |
4052 | dwData1 <<= 16; |
4053 | dwData1 |= MAKEWORD(*(pbyAddr+4), *(pbyAddr+5)); |
4054 | |
4055 | - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"1. wOffset: %d, Data: %lX, KeyCtl:%X\n", wOffset, dwData1, wKeyCtl); |
4056 | + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"1. wOffset: %d, Data: %X,"\ |
4057 | + " KeyCtl:%X\n", wOffset, dwData1, wKeyCtl); |
4058 | |
4059 | //VNSvOutPortW(dwIoBase + MAC_REG_MISCFFNDEX, wOffset); |
4060 | //VNSvOutPortD(dwIoBase + MAC_REG_MISCFFDATA, dwData); |
4061 | @@ -277,7 +278,8 @@ BYTE pbyData[24]; |
4062 | dwData2 <<= 8; |
4063 | dwData2 |= *(pbyAddr+0); |
4064 | |
4065 | - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"2. wOffset: %d, Data: %lX\n", wOffset, dwData2); |
4066 | + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"2. wOffset: %d, Data: %X\n", |
4067 | + wOffset, dwData2); |
4068 | |
4069 | //VNSvOutPortW(dwIoBase + MAC_REG_MISCFFNDEX, wOffset); |
4070 | //VNSvOutPortD(dwIoBase + MAC_REG_MISCFFDATA, dwData); |
4071 | diff --git a/drivers/staging/vt6656/rf.c b/drivers/staging/vt6656/rf.c |
4072 | index 3fd0478..8cf0881 100644 |
4073 | --- a/drivers/staging/vt6656/rf.c |
4074 | +++ b/drivers/staging/vt6656/rf.c |
4075 | @@ -769,6 +769,9 @@ BYTE byPwr = pDevice->byCCKPwr; |
4076 | return TRUE; |
4077 | } |
4078 | |
4079 | + if (uCH == 0) |
4080 | + return -EINVAL; |
4081 | + |
4082 | switch (uRATE) { |
4083 | case RATE_1M: |
4084 | case RATE_2M: |
4085 | diff --git a/drivers/staging/vt6656/rxtx.c b/drivers/staging/vt6656/rxtx.c |
4086 | index fe21868..3beb126 100644 |
4087 | --- a/drivers/staging/vt6656/rxtx.c |
4088 | +++ b/drivers/staging/vt6656/rxtx.c |
4089 | @@ -377,7 +377,8 @@ s_vFillTxKey ( |
4090 | *(pbyIVHead+3) = (BYTE)(((pDevice->byKeyIndex << 6) & 0xc0) | 0x20); // 0x20 is ExtIV |
4091 | // Append IV&ExtIV after Mac Header |
4092 | *pdwExtIV = cpu_to_le32(pTransmitKey->dwTSC47_16); |
4093 | - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"vFillTxKey()---- pdwExtIV: %lx\n", *pdwExtIV); |
4094 | + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"vFillTxKey()---- pdwExtIV: %x\n", |
4095 | + *pdwExtIV); |
4096 | |
4097 | } else if (pTransmitKey->byCipherSuite == KEY_CTL_CCMP) { |
4098 | pTransmitKey->wTSC15_0++; |
4099 | @@ -1753,7 +1754,8 @@ s_bPacketToWirelessUsb( |
4100 | MIC_vAppend((PBYTE)&(psEthHeader->abyDstAddr[0]), 12); |
4101 | dwMIC_Priority = 0; |
4102 | MIC_vAppend((PBYTE)&dwMIC_Priority, 4); |
4103 | - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"MIC KEY: %lX, %lX\n", dwMICKey0, dwMICKey1); |
4104 | + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"MIC KEY: %X, %X\n", |
4105 | + dwMICKey0, dwMICKey1); |
4106 | |
4107 | /////////////////////////////////////////////////////////////////// |
4108 | |
4109 | @@ -2635,7 +2637,8 @@ vDMA0_tx_80211(PSDevice pDevice, struct sk_buff *skb) { |
4110 | MIC_vAppend((PBYTE)&(sEthHeader.abyDstAddr[0]), 12); |
4111 | dwMIC_Priority = 0; |
4112 | MIC_vAppend((PBYTE)&dwMIC_Priority, 4); |
4113 | - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"DMA0_tx_8021:MIC KEY: %lX, %lX\n", dwMICKey0, dwMICKey1); |
4114 | + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"DMA0_tx_8021:MIC KEY:"\ |
4115 | + " %X, %X\n", dwMICKey0, dwMICKey1); |
4116 | |
4117 | uLength = cbHeaderSize + cbMacHdLen + uPadding + cbIVlen; |
4118 | |
4119 | @@ -2655,7 +2658,8 @@ vDMA0_tx_80211(PSDevice pDevice, struct sk_buff *skb) { |
4120 | |
4121 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"uLength: %d, %d\n", uLength, cbFrameBodySize); |
4122 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"cbReqCount:%d, %d, %d, %d\n", cbReqCount, cbHeaderSize, uPadding, cbIVlen); |
4123 | - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"MIC:%lx, %lx\n", *pdwMIC_L, *pdwMIC_R); |
4124 | + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"MIC:%x, %x\n", |
4125 | + *pdwMIC_L, *pdwMIC_R); |
4126 | |
4127 | } |
4128 | |
4129 | @@ -3029,7 +3033,8 @@ int nsDMA_tx_packet(PSDevice pDevice, unsigned int uDMAIdx, struct sk_buff *skb) |
4130 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"error: KEY is GTK!!~~\n"); |
4131 | } |
4132 | else { |
4133 | - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Find PTK [%lX]\n", pTransmitKey->dwKeyIndex); |
4134 | + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Find PTK [%X]\n", |
4135 | + pTransmitKey->dwKeyIndex); |
4136 | bNeedEncryption = TRUE; |
4137 | } |
4138 | } |
4139 | @@ -3043,7 +3048,8 @@ int nsDMA_tx_packet(PSDevice pDevice, unsigned int uDMAIdx, struct sk_buff *skb) |
4140 | if (pDevice->bEnableHostWEP) { |
4141 | if ((uNodeIndex != 0) && |
4142 | (pMgmt->sNodeDBTable[uNodeIndex].dwKeyIndex & PAIRWISE_KEY)) { |
4143 | - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Find PTK [%lX]\n", pTransmitKey->dwKeyIndex); |
4144 | + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Find PTK [%X]\n", |
4145 | + pTransmitKey->dwKeyIndex); |
4146 | bNeedEncryption = TRUE; |
4147 | } |
4148 | } |
4149 | diff --git a/drivers/staging/vt6656/ttype.h b/drivers/staging/vt6656/ttype.h |
4150 | index 8e9450e..dfbf747 100644 |
4151 | --- a/drivers/staging/vt6656/ttype.h |
4152 | +++ b/drivers/staging/vt6656/ttype.h |
4153 | @@ -29,6 +29,8 @@ |
4154 | #ifndef __TTYPE_H__ |
4155 | #define __TTYPE_H__ |
4156 | |
4157 | +#include <linux/types.h> |
4158 | + |
4159 | /******* Common definitions and typedefs ***********************************/ |
4160 | |
4161 | typedef int BOOL; |
4162 | @@ -42,17 +44,17 @@ typedef int BOOL; |
4163 | |
4164 | /****** Simple typedefs ***************************************************/ |
4165 | |
4166 | -typedef unsigned char BYTE; // 8-bit |
4167 | -typedef unsigned short WORD; // 16-bit |
4168 | -typedef unsigned long DWORD; // 32-bit |
4169 | +typedef u8 BYTE; |
4170 | +typedef u16 WORD; |
4171 | +typedef u32 DWORD; |
4172 | |
4173 | // QWORD is for those situation that we want |
4174 | // an 8-byte-aligned 8 byte long structure |
4175 | // which is NOT really a floating point number. |
4176 | typedef union tagUQuadWord { |
4177 | struct { |
4178 | - DWORD dwLowDword; |
4179 | - DWORD dwHighDword; |
4180 | + u32 dwLowDword; |
4181 | + u32 dwHighDword; |
4182 | } u; |
4183 | double DoNotUseThisField; |
4184 | } UQuadWord; |
4185 | @@ -60,8 +62,8 @@ typedef UQuadWord QWORD; // 64-bit |
4186 | |
4187 | /****** Common pointer types ***********************************************/ |
4188 | |
4189 | -typedef unsigned long ULONG_PTR; // 32-bit |
4190 | -typedef unsigned long DWORD_PTR; // 32-bit |
4191 | +typedef u32 ULONG_PTR; |
4192 | +typedef u32 DWORD_PTR; |
4193 | |
4194 | // boolean pointer |
4195 | |
4196 | diff --git a/drivers/staging/vt6656/wcmd.c b/drivers/staging/vt6656/wcmd.c |
4197 | index 78ea121..31fb96a 100644 |
4198 | --- a/drivers/staging/vt6656/wcmd.c |
4199 | +++ b/drivers/staging/vt6656/wcmd.c |
4200 | @@ -316,17 +316,19 @@ s_MgrMakeProbeRequest( |
4201 | return pTxPacket; |
4202 | } |
4203 | |
4204 | -void vCommandTimerWait(void *hDeviceContext, unsigned int MSecond) |
4205 | +void vCommandTimerWait(void *hDeviceContext, unsigned long MSecond) |
4206 | { |
4207 | - PSDevice pDevice = (PSDevice)hDeviceContext; |
4208 | + PSDevice pDevice = (PSDevice)hDeviceContext; |
4209 | |
4210 | - init_timer(&pDevice->sTimerCommand); |
4211 | - pDevice->sTimerCommand.data = (unsigned long)pDevice; |
4212 | - pDevice->sTimerCommand.function = (TimerFunction)vRunCommand; |
4213 | - // RUN_AT :1 msec ~= (HZ/1024) |
4214 | - pDevice->sTimerCommand.expires = (unsigned int)RUN_AT((MSecond * HZ) >> 10); |
4215 | - add_timer(&pDevice->sTimerCommand); |
4216 | - return; |
4217 | + init_timer(&pDevice->sTimerCommand); |
4218 | + |
4219 | + pDevice->sTimerCommand.data = (unsigned long)pDevice; |
4220 | + pDevice->sTimerCommand.function = (TimerFunction)vRunCommand; |
4221 | + pDevice->sTimerCommand.expires = RUN_AT((MSecond * HZ) / 1000); |
4222 | + |
4223 | + add_timer(&pDevice->sTimerCommand); |
4224 | + |
4225 | + return; |
4226 | } |
4227 | |
4228 | void vRunCommand(void *hDeviceContext) |
4229 | diff --git a/drivers/staging/vt6656/wpa2.h b/drivers/staging/vt6656/wpa2.h |
4230 | index 46c2959..c359252 100644 |
4231 | --- a/drivers/staging/vt6656/wpa2.h |
4232 | +++ b/drivers/staging/vt6656/wpa2.h |
4233 | @@ -45,8 +45,8 @@ typedef struct tagsPMKIDInfo { |
4234 | } PMKIDInfo, *PPMKIDInfo; |
4235 | |
4236 | typedef struct tagSPMKIDCache { |
4237 | - unsigned long BSSIDInfoCount; |
4238 | - PMKIDInfo BSSIDInfo[MAX_PMKID_CACHE]; |
4239 | + u32 BSSIDInfoCount; |
4240 | + PMKIDInfo BSSIDInfo[MAX_PMKID_CACHE]; |
4241 | } SPMKIDCache, *PSPMKIDCache; |
4242 | |
4243 | |
4244 | diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c |
4245 | index ad202b3..486c5dd 100644 |
4246 | --- a/drivers/target/iscsi/iscsi_target.c |
4247 | +++ b/drivers/target/iscsi/iscsi_target.c |
4248 | @@ -2359,7 +2359,7 @@ static void iscsit_build_conn_drop_async_message(struct iscsi_conn *conn) |
4249 | if (!conn_p) |
4250 | return; |
4251 | |
4252 | - cmd = iscsit_allocate_cmd(conn_p, GFP_KERNEL); |
4253 | + cmd = iscsit_allocate_cmd(conn_p, GFP_ATOMIC); |
4254 | if (!cmd) { |
4255 | iscsit_dec_conn_usage_count(conn_p); |
4256 | return; |
4257 | diff --git a/drivers/target/tcm_fc/tfc_sess.c b/drivers/target/tcm_fc/tfc_sess.c |
4258 | index 87901fa..a426c40 100644 |
4259 | --- a/drivers/target/tcm_fc/tfc_sess.c |
4260 | +++ b/drivers/target/tcm_fc/tfc_sess.c |
4261 | @@ -431,7 +431,6 @@ static void ft_sess_rcu_free(struct rcu_head *rcu) |
4262 | { |
4263 | struct ft_sess *sess = container_of(rcu, struct ft_sess, rcu); |
4264 | |
4265 | - transport_deregister_session(sess->se_sess); |
4266 | kfree(sess); |
4267 | } |
4268 | |
4269 | @@ -439,6 +438,7 @@ static void ft_sess_free(struct kref *kref) |
4270 | { |
4271 | struct ft_sess *sess = container_of(kref, struct ft_sess, kref); |
4272 | |
4273 | + transport_deregister_session(sess->se_sess); |
4274 | call_rcu(&sess->rcu, ft_sess_rcu_free); |
4275 | } |
4276 | |
4277 | diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c |
4278 | index b4e87cf..3a7a950 100644 |
4279 | --- a/drivers/usb/class/cdc-acm.c |
4280 | +++ b/drivers/usb/class/cdc-acm.c |
4281 | @@ -1602,6 +1602,9 @@ static const struct usb_device_id acm_ids[] = { |
4282 | { USB_DEVICE(0x0572, 0x1340), /* Conexant CX93010-2x UCMxx */ |
4283 | .driver_info = NO_UNION_NORMAL, |
4284 | }, |
4285 | + { USB_DEVICE(0x05f9, 0x4002), /* PSC Scanning, Magellan 800i */ |
4286 | + .driver_info = NO_UNION_NORMAL, |
4287 | + }, |
4288 | { USB_DEVICE(0x1bbb, 0x0003), /* Alcatel OT-I650 */ |
4289 | .driver_info = NO_UNION_NORMAL, /* reports zero length descriptor */ |
4290 | }, |
4291 | diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c |
4292 | index 11344bc..ef8f790 100644 |
4293 | --- a/drivers/usb/core/hub.c |
4294 | +++ b/drivers/usb/core/hub.c |
4295 | @@ -644,6 +644,60 @@ static int hub_hub_status(struct usb_hub *hub, |
4296 | return ret; |
4297 | } |
4298 | |
4299 | +static int hub_set_port_link_state(struct usb_hub *hub, int port1, |
4300 | + unsigned int link_status) |
4301 | +{ |
4302 | + return set_port_feature(hub->hdev, |
4303 | + port1 | (link_status << 3), |
4304 | + USB_PORT_FEAT_LINK_STATE); |
4305 | +} |
4306 | + |
4307 | +/* |
4308 | + * If USB 3.0 ports are placed into the Disabled state, they will no longer |
4309 | + * detect any device connects or disconnects. This is generally not what the |
4310 | + * USB core wants, since it expects a disabled port to produce a port status |
4311 | + * change event when a new device connects. |
4312 | + * |
4313 | + * Instead, set the link state to Disabled, wait for the link to settle into |
4314 | + * that state, clear any change bits, and then put the port into the RxDetect |
4315 | + * state. |
4316 | + */ |
4317 | +static int hub_usb3_port_disable(struct usb_hub *hub, int port1) |
4318 | +{ |
4319 | + int ret; |
4320 | + int total_time; |
4321 | + u16 portchange, portstatus; |
4322 | + |
4323 | + if (!hub_is_superspeed(hub->hdev)) |
4324 | + return -EINVAL; |
4325 | + |
4326 | + ret = hub_set_port_link_state(hub, port1, USB_SS_PORT_LS_SS_DISABLED); |
4327 | + if (ret) { |
4328 | + dev_err(hub->intfdev, "cannot disable port %d (err = %d)\n", |
4329 | + port1, ret); |
4330 | + return ret; |
4331 | + } |
4332 | + |
4333 | + /* Wait for the link to enter the disabled state. */ |
4334 | + for (total_time = 0; ; total_time += HUB_DEBOUNCE_STEP) { |
4335 | + ret = hub_port_status(hub, port1, &portstatus, &portchange); |
4336 | + if (ret < 0) |
4337 | + return ret; |
4338 | + |
4339 | + if ((portstatus & USB_PORT_STAT_LINK_STATE) == |
4340 | + USB_SS_PORT_LS_SS_DISABLED) |
4341 | + break; |
4342 | + if (total_time >= HUB_DEBOUNCE_TIMEOUT) |
4343 | + break; |
4344 | + msleep(HUB_DEBOUNCE_STEP); |
4345 | + } |
4346 | + if (total_time >= HUB_DEBOUNCE_TIMEOUT) |
4347 | + dev_warn(hub->intfdev, "Could not disable port %d after %d ms\n", |
4348 | + port1, total_time); |
4349 | + |
4350 | + return hub_set_port_link_state(hub, port1, USB_SS_PORT_LS_RX_DETECT); |
4351 | +} |
4352 | + |
4353 | static int hub_port_disable(struct usb_hub *hub, int port1, int set_state) |
4354 | { |
4355 | struct usb_device *hdev = hub->hdev; |
4356 | @@ -652,8 +706,13 @@ static int hub_port_disable(struct usb_hub *hub, int port1, int set_state) |
4357 | if (hdev->children[port1-1] && set_state) |
4358 | usb_set_device_state(hdev->children[port1-1], |
4359 | USB_STATE_NOTATTACHED); |
4360 | - if (!hub->error && !hub_is_superspeed(hub->hdev)) |
4361 | - ret = clear_port_feature(hdev, port1, USB_PORT_FEAT_ENABLE); |
4362 | + if (!hub->error) { |
4363 | + if (hub_is_superspeed(hub->hdev)) |
4364 | + ret = hub_usb3_port_disable(hub, port1); |
4365 | + else |
4366 | + ret = clear_port_feature(hdev, port1, |
4367 | + USB_PORT_FEAT_ENABLE); |
4368 | + } |
4369 | if (ret) |
4370 | dev_err(hub->intfdev, "cannot disable port %d (err = %d)\n", |
4371 | port1, ret); |
4372 | @@ -2109,7 +2168,7 @@ static unsigned hub_is_wusb(struct usb_hub *hub) |
4373 | #define HUB_SHORT_RESET_TIME 10 |
4374 | #define HUB_BH_RESET_TIME 50 |
4375 | #define HUB_LONG_RESET_TIME 200 |
4376 | -#define HUB_RESET_TIMEOUT 500 |
4377 | +#define HUB_RESET_TIMEOUT 800 |
4378 | |
4379 | static int hub_port_reset(struct usb_hub *hub, int port1, |
4380 | struct usb_device *udev, unsigned int delay, bool warm); |
4381 | @@ -2144,6 +2203,10 @@ static int hub_port_wait_reset(struct usb_hub *hub, int port1, |
4382 | if (ret < 0) |
4383 | return ret; |
4384 | |
4385 | + /* The port state is unknown until the reset completes. */ |
4386 | + if ((portstatus & USB_PORT_STAT_RESET)) |
4387 | + goto delay; |
4388 | + |
4389 | /* |
4390 | * Some buggy devices require a warm reset to be issued even |
4391 | * when the port appears not to be connected. |
4392 | @@ -2189,11 +2252,7 @@ static int hub_port_wait_reset(struct usb_hub *hub, int port1, |
4393 | if ((portchange & USB_PORT_STAT_C_CONNECTION)) |
4394 | return -ENOTCONN; |
4395 | |
4396 | - /* if we`ve finished resetting, then break out of |
4397 | - * the loop |
4398 | - */ |
4399 | - if (!(portstatus & USB_PORT_STAT_RESET) && |
4400 | - (portstatus & USB_PORT_STAT_ENABLE)) { |
4401 | + if ((portstatus & USB_PORT_STAT_ENABLE)) { |
4402 | if (hub_is_wusb(hub)) |
4403 | udev->speed = USB_SPEED_WIRELESS; |
4404 | else if (hub_is_superspeed(hub->hdev)) |
4405 | @@ -2207,10 +2266,15 @@ static int hub_port_wait_reset(struct usb_hub *hub, int port1, |
4406 | return 0; |
4407 | } |
4408 | } else { |
4409 | - if (portchange & USB_PORT_STAT_C_BH_RESET) |
4410 | - return 0; |
4411 | + if (!(portstatus & USB_PORT_STAT_CONNECTION) || |
4412 | + hub_port_warm_reset_required(hub, |
4413 | + portstatus)) |
4414 | + return -ENOTCONN; |
4415 | + |
4416 | + return 0; |
4417 | } |
4418 | |
4419 | +delay: |
4420 | /* switch to the long delay after two short delay failures */ |
4421 | if (delay_time >= 2 * HUB_SHORT_RESET_TIME) |
4422 | delay = HUB_LONG_RESET_TIME; |
4423 | @@ -2234,14 +2298,11 @@ static void hub_port_finish_reset(struct usb_hub *hub, int port1, |
4424 | msleep(10 + 40); |
4425 | update_devnum(udev, 0); |
4426 | hcd = bus_to_hcd(udev->bus); |
4427 | - if (hcd->driver->reset_device) { |
4428 | - *status = hcd->driver->reset_device(hcd, udev); |
4429 | - if (*status < 0) { |
4430 | - dev_err(&udev->dev, "Cannot reset " |
4431 | - "HCD device state\n"); |
4432 | - break; |
4433 | - } |
4434 | - } |
4435 | + /* The xHC may think the device is already reset, |
4436 | + * so ignore the status. |
4437 | + */ |
4438 | + if (hcd->driver->reset_device) |
4439 | + hcd->driver->reset_device(hcd, udev); |
4440 | } |
4441 | /* FALL THROUGH */ |
4442 | case -ENOTCONN: |
4443 | @@ -2249,16 +2310,16 @@ static void hub_port_finish_reset(struct usb_hub *hub, int port1, |
4444 | clear_port_feature(hub->hdev, |
4445 | port1, USB_PORT_FEAT_C_RESET); |
4446 | /* FIXME need disconnect() for NOTATTACHED device */ |
4447 | - if (warm) { |
4448 | + if (hub_is_superspeed(hub->hdev)) { |
4449 | clear_port_feature(hub->hdev, port1, |
4450 | USB_PORT_FEAT_C_BH_PORT_RESET); |
4451 | clear_port_feature(hub->hdev, port1, |
4452 | USB_PORT_FEAT_C_PORT_LINK_STATE); |
4453 | - } else { |
4454 | + } |
4455 | + if (!warm) |
4456 | usb_set_device_state(udev, *status |
4457 | ? USB_STATE_NOTATTACHED |
4458 | : USB_STATE_DEFAULT); |
4459 | - } |
4460 | break; |
4461 | } |
4462 | } |
4463 | @@ -2548,7 +2609,7 @@ int usb_port_suspend(struct usb_device *udev, pm_message_t msg) |
4464 | static int finish_port_resume(struct usb_device *udev) |
4465 | { |
4466 | int status = 0; |
4467 | - u16 devstatus; |
4468 | + u16 devstatus = 0; |
4469 | |
4470 | /* caller owns the udev device lock */ |
4471 | dev_dbg(&udev->dev, "%s\n", |
4472 | @@ -2593,7 +2654,13 @@ static int finish_port_resume(struct usb_device *udev) |
4473 | if (status) { |
4474 | dev_dbg(&udev->dev, "gone after usb resume? status %d\n", |
4475 | status); |
4476 | - } else if (udev->actconfig) { |
4477 | + /* |
4478 | + * There are a few quirky devices which violate the standard |
4479 | + * by claiming to have remote wakeup enabled after a reset, |
4480 | + * which crash if the feature is cleared, hence check for |
4481 | + * udev->reset_resume |
4482 | + */ |
4483 | + } else if (udev->actconfig && !udev->reset_resume) { |
4484 | le16_to_cpus(&devstatus); |
4485 | if (devstatus & (1 << USB_DEVICE_REMOTE_WAKEUP)) { |
4486 | status = usb_control_msg(udev, |
4487 | @@ -3774,9 +3841,14 @@ static void hub_events(void) |
4488 | * SS.Inactive state. |
4489 | */ |
4490 | if (hub_port_warm_reset_required(hub, portstatus)) { |
4491 | + int status; |
4492 | + |
4493 | dev_dbg(hub_dev, "warm reset port %d\n", i); |
4494 | - hub_port_reset(hub, i, NULL, |
4495 | + status = hub_port_reset(hub, i, NULL, |
4496 | HUB_BH_RESET_TIME, true); |
4497 | + if (status < 0) |
4498 | + hub_port_disable(hub, i, 1); |
4499 | + connect_change = 0; |
4500 | } |
4501 | |
4502 | if (connect_change) |
4503 | diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c |
4504 | index ef116a5..ab11ca3c 100644 |
4505 | --- a/drivers/usb/core/message.c |
4506 | +++ b/drivers/usb/core/message.c |
4507 | @@ -1770,28 +1770,8 @@ free_interfaces: |
4508 | goto free_interfaces; |
4509 | } |
4510 | |
4511 | - ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), |
4512 | - USB_REQ_SET_CONFIGURATION, 0, configuration, 0, |
4513 | - NULL, 0, USB_CTRL_SET_TIMEOUT); |
4514 | - if (ret < 0) { |
4515 | - /* All the old state is gone, so what else can we do? |
4516 | - * The device is probably useless now anyway. |
4517 | - */ |
4518 | - cp = NULL; |
4519 | - } |
4520 | - |
4521 | - dev->actconfig = cp; |
4522 | - if (!cp) { |
4523 | - usb_set_device_state(dev, USB_STATE_ADDRESS); |
4524 | - usb_hcd_alloc_bandwidth(dev, NULL, NULL, NULL); |
4525 | - mutex_unlock(hcd->bandwidth_mutex); |
4526 | - usb_autosuspend_device(dev); |
4527 | - goto free_interfaces; |
4528 | - } |
4529 | - mutex_unlock(hcd->bandwidth_mutex); |
4530 | - usb_set_device_state(dev, USB_STATE_CONFIGURED); |
4531 | - |
4532 | - /* Initialize the new interface structures and the |
4533 | + /* |
4534 | + * Initialize the new interface structures and the |
4535 | * hc/hcd/usbcore interface/endpoint state. |
4536 | */ |
4537 | for (i = 0; i < nintf; ++i) { |
4538 | @@ -1835,6 +1815,35 @@ free_interfaces: |
4539 | } |
4540 | kfree(new_interfaces); |
4541 | |
4542 | + ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), |
4543 | + USB_REQ_SET_CONFIGURATION, 0, configuration, 0, |
4544 | + NULL, 0, USB_CTRL_SET_TIMEOUT); |
4545 | + if (ret < 0 && cp) { |
4546 | + /* |
4547 | + * All the old state is gone, so what else can we do? |
4548 | + * The device is probably useless now anyway. |
4549 | + */ |
4550 | + usb_hcd_alloc_bandwidth(dev, NULL, NULL, NULL); |
4551 | + for (i = 0; i < nintf; ++i) { |
4552 | + usb_disable_interface(dev, cp->interface[i], true); |
4553 | + put_device(&cp->interface[i]->dev); |
4554 | + cp->interface[i] = NULL; |
4555 | + } |
4556 | + cp = NULL; |
4557 | + } |
4558 | + |
4559 | + dev->actconfig = cp; |
4560 | + mutex_unlock(hcd->bandwidth_mutex); |
4561 | + |
4562 | + if (!cp) { |
4563 | + usb_set_device_state(dev, USB_STATE_ADDRESS); |
4564 | + |
4565 | + /* Leave LPM disabled while the device is unconfigured. */ |
4566 | + usb_autosuspend_device(dev); |
4567 | + return ret; |
4568 | + } |
4569 | + usb_set_device_state(dev, USB_STATE_CONFIGURED); |
4570 | + |
4571 | if (cp->string == NULL && |
4572 | !(dev->quirks & USB_QUIRK_CONFIG_INTF_STRINGS)) |
4573 | cp->string = usb_cache_string(dev, cp->desc.iConfiguration); |
4574 | diff --git a/drivers/usb/gadget/dummy_hcd.c b/drivers/usb/gadget/dummy_hcd.c |
4575 | index 2d277a2..9a7b436 100644 |
4576 | --- a/drivers/usb/gadget/dummy_hcd.c |
4577 | +++ b/drivers/usb/gadget/dummy_hcd.c |
4578 | @@ -126,10 +126,7 @@ static const char ep0name[] = "ep0"; |
4579 | static const char *const ep_name[] = { |
4580 | ep0name, /* everyone has ep0 */ |
4581 | |
4582 | - /* act like a net2280: high speed, six configurable endpoints */ |
4583 | - "ep-a", "ep-b", "ep-c", "ep-d", "ep-e", "ep-f", |
4584 | - |
4585 | - /* or like pxa250: fifteen fixed function endpoints */ |
4586 | + /* act like a pxa250: fifteen fixed function endpoints */ |
4587 | "ep1in-bulk", "ep2out-bulk", "ep3in-iso", "ep4out-iso", "ep5in-int", |
4588 | "ep6in-bulk", "ep7out-bulk", "ep8in-iso", "ep9out-iso", "ep10in-int", |
4589 | "ep11in-bulk", "ep12out-bulk", "ep13in-iso", "ep14out-iso", |
4590 | @@ -137,6 +134,10 @@ static const char *const ep_name[] = { |
4591 | |
4592 | /* or like sa1100: two fixed function endpoints */ |
4593 | "ep1out-bulk", "ep2in-bulk", |
4594 | + |
4595 | + /* and now some generic EPs so we have enough in multi config */ |
4596 | + "ep3out", "ep4in", "ep5out", "ep6out", "ep7in", "ep8out", "ep9in", |
4597 | + "ep10out", "ep11out", "ep12in", "ep13out", "ep14in", "ep15out", |
4598 | }; |
4599 | #define DUMMY_ENDPOINTS ARRAY_SIZE(ep_name) |
4600 | |
4601 | diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c |
4602 | index de07b75..8331893 100644 |
4603 | --- a/drivers/usb/host/xhci-hub.c |
4604 | +++ b/drivers/usb/host/xhci-hub.c |
4605 | @@ -753,12 +753,39 @@ int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, |
4606 | break; |
4607 | case USB_PORT_FEAT_LINK_STATE: |
4608 | temp = xhci_readl(xhci, port_array[wIndex]); |
4609 | + |
4610 | + /* Disable port */ |
4611 | + if (link_state == USB_SS_PORT_LS_SS_DISABLED) { |
4612 | + xhci_dbg(xhci, "Disable port %d\n", wIndex); |
4613 | + temp = xhci_port_state_to_neutral(temp); |
4614 | + /* |
4615 | + * Clear all change bits, so that we get a new |
4616 | + * connection event. |
4617 | + */ |
4618 | + temp |= PORT_CSC | PORT_PEC | PORT_WRC | |
4619 | + PORT_OCC | PORT_RC | PORT_PLC | |
4620 | + PORT_CEC; |
4621 | + xhci_writel(xhci, temp | PORT_PE, |
4622 | + port_array[wIndex]); |
4623 | + temp = xhci_readl(xhci, port_array[wIndex]); |
4624 | + break; |
4625 | + } |
4626 | + |
4627 | + /* Put link in RxDetect (enable port) */ |
4628 | + if (link_state == USB_SS_PORT_LS_RX_DETECT) { |
4629 | + xhci_dbg(xhci, "Enable port %d\n", wIndex); |
4630 | + xhci_set_link_state(xhci, port_array, wIndex, |
4631 | + link_state); |
4632 | + temp = xhci_readl(xhci, port_array[wIndex]); |
4633 | + break; |
4634 | + } |
4635 | + |
4636 | /* Software should not attempt to set |
4637 | - * port link state above '5' (Rx.Detect) and the port |
4638 | + * port link state above '3' (U3) and the port |
4639 | * must be enabled. |
4640 | */ |
4641 | if ((temp & PORT_PE) == 0 || |
4642 | - (link_state > USB_SS_PORT_LS_RX_DETECT)) { |
4643 | + (link_state > USB_SS_PORT_LS_U3)) { |
4644 | xhci_warn(xhci, "Cannot set link state.\n"); |
4645 | goto error; |
4646 | } |
4647 | @@ -913,6 +940,7 @@ int xhci_hub_status_data(struct usb_hcd *hcd, char *buf) |
4648 | int max_ports; |
4649 | __le32 __iomem **port_array; |
4650 | struct xhci_bus_state *bus_state; |
4651 | + bool reset_change = false; |
4652 | |
4653 | max_ports = xhci_get_ports(hcd, &port_array); |
4654 | bus_state = &xhci->bus_state[hcd_index(hcd)]; |
4655 | @@ -944,6 +972,12 @@ int xhci_hub_status_data(struct usb_hcd *hcd, char *buf) |
4656 | buf[(i + 1) / 8] |= 1 << (i + 1) % 8; |
4657 | status = 1; |
4658 | } |
4659 | + if ((temp & PORT_RC)) |
4660 | + reset_change = true; |
4661 | + } |
4662 | + if (!status && !reset_change) { |
4663 | + xhci_dbg(xhci, "%s: stopping port polling.\n", __func__); |
4664 | + clear_bit(HCD_FLAG_POLL_RH, &hcd->flags); |
4665 | } |
4666 | spin_unlock_irqrestore(&xhci->lock, flags); |
4667 | return status ? retval : 0; |
4668 | diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c |
4669 | index 3e16f1c..b42a6fb 100644 |
4670 | --- a/drivers/usb/host/xhci-mem.c |
4671 | +++ b/drivers/usb/host/xhci-mem.c |
4672 | @@ -1250,6 +1250,8 @@ static unsigned int xhci_microframes_to_exponent(struct usb_device *udev, |
4673 | static unsigned int xhci_parse_microframe_interval(struct usb_device *udev, |
4674 | struct usb_host_endpoint *ep) |
4675 | { |
4676 | + if (ep->desc.bInterval == 0) |
4677 | + return 0; |
4678 | return xhci_microframes_to_exponent(udev, ep, |
4679 | ep->desc.bInterval, 0, 15); |
4680 | } |
4681 | diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c |
4682 | index bf8bcc4..01361f9 100644 |
4683 | --- a/drivers/usb/host/xhci-ring.c |
4684 | +++ b/drivers/usb/host/xhci-ring.c |
4685 | @@ -1725,6 +1725,15 @@ cleanup: |
4686 | if (bogus_port_status) |
4687 | return; |
4688 | |
4689 | + /* |
4690 | + * xHCI port-status-change events occur when the "or" of all the |
4691 | + * status-change bits in the portsc register changes from 0 to 1. |
4692 | + * New status changes won't cause an event if any other change |
4693 | + * bits are still set. When an event occurs, switch over to |
4694 | + * polling to avoid losing status changes. |
4695 | + */ |
4696 | + xhci_dbg(xhci, "%s: starting port polling.\n", __func__); |
4697 | + set_bit(HCD_FLAG_POLL_RH, &hcd->flags); |
4698 | spin_unlock(&xhci->lock); |
4699 | /* Pass this up to the core */ |
4700 | usb_hcd_poll_rh_status(hcd); |
4701 | diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c |
4702 | index b4063fc..b04134a 100644 |
4703 | --- a/drivers/usb/host/xhci.c |
4704 | +++ b/drivers/usb/host/xhci.c |
4705 | @@ -880,6 +880,11 @@ int xhci_suspend(struct xhci_hcd *xhci) |
4706 | struct usb_hcd *hcd = xhci_to_hcd(xhci); |
4707 | u32 command; |
4708 | |
4709 | + /* Don't poll the roothubs on bus suspend. */ |
4710 | + xhci_dbg(xhci, "%s: stopping port polling.\n", __func__); |
4711 | + clear_bit(HCD_FLAG_POLL_RH, &hcd->flags); |
4712 | + del_timer_sync(&hcd->rh_timer); |
4713 | + |
4714 | spin_lock_irq(&xhci->lock); |
4715 | clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags); |
4716 | clear_bit(HCD_FLAG_HW_ACCESSIBLE, &xhci->shared_hcd->flags); |
4717 | @@ -1064,6 +1069,11 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated) |
4718 | if (xhci->quirks & XHCI_COMP_MODE_QUIRK) |
4719 | compliance_mode_recovery_timer_init(xhci); |
4720 | |
4721 | + /* Re-enable port polling. */ |
4722 | + xhci_dbg(xhci, "%s: starting port polling.\n", __func__); |
4723 | + set_bit(HCD_FLAG_POLL_RH, &hcd->flags); |
4724 | + usb_hcd_poll_rh_status(hcd); |
4725 | + |
4726 | return retval; |
4727 | } |
4728 | #endif /* CONFIG_PM */ |
4729 | diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c |
4730 | index 66aaccf..a2b4008 100644 |
4731 | --- a/drivers/usb/musb/musb_core.c |
4732 | +++ b/drivers/usb/musb/musb_core.c |
4733 | @@ -2400,10 +2400,7 @@ static int __init musb_init(void) |
4734 | if (usb_disabled()) |
4735 | return 0; |
4736 | |
4737 | - pr_info("%s: version " MUSB_VERSION ", " |
4738 | - "?dma?" |
4739 | - ", " |
4740 | - "otg (peripheral+host)", |
4741 | + pr_info("%s: version " MUSB_VERSION ", ?dma?, otg (peripheral+host)\n", |
4742 | musb_driver_name); |
4743 | return platform_driver_register(&musb_driver); |
4744 | } |
4745 | diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c |
4746 | index 25903f5..3fbf39d 100644 |
4747 | --- a/drivers/usb/serial/ftdi_sio.c |
4748 | +++ b/drivers/usb/serial/ftdi_sio.c |
4749 | @@ -881,6 +881,8 @@ static struct usb_device_id id_table_combined [] = { |
4750 | { USB_DEVICE(FTDI_VID, FTDI_DISTORTEC_JTAG_LOCK_PICK_PID), |
4751 | .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, |
4752 | { USB_DEVICE(FTDI_VID, FTDI_LUMEL_PD12_PID) }, |
4753 | + /* Crucible Devices */ |
4754 | + { USB_DEVICE(FTDI_VID, FTDI_CT_COMET_PID) }, |
4755 | { }, /* Optional parameter entry */ |
4756 | { } /* Terminating entry */ |
4757 | }; |
4758 | diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h |
4759 | index 049b6e7..fa5d560 100644 |
4760 | --- a/drivers/usb/serial/ftdi_sio_ids.h |
4761 | +++ b/drivers/usb/serial/ftdi_sio_ids.h |
4762 | @@ -1259,3 +1259,9 @@ |
4763 | * ATI command output: Cinterion MC55i |
4764 | */ |
4765 | #define FTDI_CINTERION_MC55I_PID 0xA951 |
4766 | + |
4767 | +/* |
4768 | + * Product: Comet Caller ID decoder |
4769 | + * Manufacturer: Crucible Technologies |
4770 | + */ |
4771 | +#define FTDI_CT_COMET_PID 0x8e08 |
4772 | diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c |
4773 | index 0c3d290..ba23ad5 100644 |
4774 | --- a/drivers/usb/serial/option.c |
4775 | +++ b/drivers/usb/serial/option.c |
4776 | @@ -288,6 +288,7 @@ static void option_instat_callback(struct urb *urb); |
4777 | #define ALCATEL_VENDOR_ID 0x1bbb |
4778 | #define ALCATEL_PRODUCT_X060S_X200 0x0000 |
4779 | #define ALCATEL_PRODUCT_X220_X500D 0x0017 |
4780 | +#define ALCATEL_PRODUCT_L100V 0x011e |
4781 | |
4782 | #define PIRELLI_VENDOR_ID 0x1266 |
4783 | #define PIRELLI_PRODUCT_C100_1 0x1002 |
4784 | @@ -429,9 +430,12 @@ static void option_instat_callback(struct urb *urb); |
4785 | #define MEDIATEK_VENDOR_ID 0x0e8d |
4786 | #define MEDIATEK_PRODUCT_DC_1COM 0x00a0 |
4787 | #define MEDIATEK_PRODUCT_DC_4COM 0x00a5 |
4788 | +#define MEDIATEK_PRODUCT_DC_4COM2 0x00a7 |
4789 | #define MEDIATEK_PRODUCT_DC_5COM 0x00a4 |
4790 | #define MEDIATEK_PRODUCT_7208_1COM 0x7101 |
4791 | #define MEDIATEK_PRODUCT_7208_2COM 0x7102 |
4792 | +#define MEDIATEK_PRODUCT_7103_2COM 0x7103 |
4793 | +#define MEDIATEK_PRODUCT_7106_2COM 0x7106 |
4794 | #define MEDIATEK_PRODUCT_FP_1COM 0x0003 |
4795 | #define MEDIATEK_PRODUCT_FP_2COM 0x0023 |
4796 | #define MEDIATEK_PRODUCT_FPDC_1COM 0x0043 |
4797 | @@ -441,6 +445,10 @@ static void option_instat_callback(struct urb *urb); |
4798 | #define CELLIENT_VENDOR_ID 0x2692 |
4799 | #define CELLIENT_PRODUCT_MEN200 0x9005 |
4800 | |
4801 | +/* Hyundai Petatel Inc. products */ |
4802 | +#define PETATEL_VENDOR_ID 0x1ff4 |
4803 | +#define PETATEL_PRODUCT_NP10T 0x600e |
4804 | + |
4805 | /* some devices interfaces need special handling due to a number of reasons */ |
4806 | enum option_blacklist_reason { |
4807 | OPTION_BLACKLIST_NONE = 0, |
4808 | @@ -923,7 +931,8 @@ static const struct usb_device_id option_ids[] = { |
4809 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0257, 0xff, 0xff, 0xff), /* ZTE MF821 */ |
4810 | .driver_info = (kernel_ulong_t)&net_intf3_blacklist }, |
4811 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0265, 0xff, 0xff, 0xff) }, |
4812 | - { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0284, 0xff, 0xff, 0xff) }, |
4813 | + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0284, 0xff, 0xff, 0xff), /* ZTE MF880 */ |
4814 | + .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, |
4815 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0317, 0xff, 0xff, 0xff) }, |
4816 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0326, 0xff, 0xff, 0xff), |
4817 | .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, |
4818 | @@ -1190,6 +1199,8 @@ static const struct usb_device_id option_ids[] = { |
4819 | .driver_info = (kernel_ulong_t)&alcatel_x200_blacklist |
4820 | }, |
4821 | { USB_DEVICE(ALCATEL_VENDOR_ID, ALCATEL_PRODUCT_X220_X500D) }, |
4822 | + { USB_DEVICE(ALCATEL_VENDOR_ID, ALCATEL_PRODUCT_L100V), |
4823 | + .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, |
4824 | { USB_DEVICE(AIRPLUS_VENDOR_ID, AIRPLUS_PRODUCT_MCD650) }, |
4825 | { USB_DEVICE(TLAYTECH_VENDOR_ID, TLAYTECH_PRODUCT_TEU800) }, |
4826 | { USB_DEVICE(LONGCHEER_VENDOR_ID, FOUR_G_SYSTEMS_PRODUCT_W14), |
4827 | @@ -1294,7 +1305,12 @@ static const struct usb_device_id option_ids[] = { |
4828 | { USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, MEDIATEK_PRODUCT_FP_2COM, 0x0a, 0x00, 0x00) }, |
4829 | { USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, MEDIATEK_PRODUCT_FPDC_1COM, 0x0a, 0x00, 0x00) }, |
4830 | { USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, MEDIATEK_PRODUCT_FPDC_2COM, 0x0a, 0x00, 0x00) }, |
4831 | + { USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, MEDIATEK_PRODUCT_7103_2COM, 0xff, 0x00, 0x00) }, |
4832 | + { USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, MEDIATEK_PRODUCT_7106_2COM, 0x02, 0x02, 0x01) }, |
4833 | + { USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, MEDIATEK_PRODUCT_DC_4COM2, 0xff, 0x02, 0x01) }, |
4834 | + { USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, MEDIATEK_PRODUCT_DC_4COM2, 0xff, 0x00, 0x00) }, |
4835 | { USB_DEVICE(CELLIENT_VENDOR_ID, CELLIENT_PRODUCT_MEN200) }, |
4836 | + { USB_DEVICE(PETATEL_VENDOR_ID, PETATEL_PRODUCT_NP10T) }, |
4837 | { } /* Terminating entry */ |
4838 | }; |
4839 | MODULE_DEVICE_TABLE(usb, option_ids); |
4840 | diff --git a/drivers/video/mxsfb.c b/drivers/video/mxsfb.c |
4841 | index 4a89f88..9f89992 100644 |
4842 | --- a/drivers/video/mxsfb.c |
4843 | +++ b/drivers/video/mxsfb.c |
4844 | @@ -366,7 +366,8 @@ static void mxsfb_disable_controller(struct fb_info *fb_info) |
4845 | loop--; |
4846 | } |
4847 | |
4848 | - writel(VDCTRL4_SYNC_SIGNALS_ON, host->base + LCDC_VDCTRL4 + REG_CLR); |
4849 | + reg = readl(host->base + LCDC_VDCTRL4); |
4850 | + writel(reg & ~VDCTRL4_SYNC_SIGNALS_ON, host->base + LCDC_VDCTRL4); |
4851 | |
4852 | clk_disable_unprepare(host->clk); |
4853 | |
4854 | diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c |
4855 | index 32ee086..bb01881 100644 |
4856 | --- a/fs/ceph/addr.c |
4857 | +++ b/fs/ceph/addr.c |
4858 | @@ -267,6 +267,14 @@ static void finish_read(struct ceph_osd_request *req, struct ceph_msg *msg) |
4859 | kfree(req->r_pages); |
4860 | } |
4861 | |
4862 | +static void ceph_unlock_page_vector(struct page **pages, int num_pages) |
4863 | +{ |
4864 | + int i; |
4865 | + |
4866 | + for (i = 0; i < num_pages; i++) |
4867 | + unlock_page(pages[i]); |
4868 | +} |
4869 | + |
4870 | /* |
4871 | * start an async read(ahead) operation. return nr_pages we submitted |
4872 | * a read for on success, or negative error code. |
4873 | @@ -308,8 +316,8 @@ static int start_read(struct inode *inode, struct list_head *page_list, int max) |
4874 | NULL, 0, |
4875 | ci->i_truncate_seq, ci->i_truncate_size, |
4876 | NULL, false, 1, 0); |
4877 | - if (!req) |
4878 | - return -ENOMEM; |
4879 | + if (IS_ERR(req)) |
4880 | + return PTR_ERR(req); |
4881 | |
4882 | /* build page vector */ |
4883 | nr_pages = len >> PAGE_CACHE_SHIFT; |
4884 | @@ -347,6 +355,7 @@ static int start_read(struct inode *inode, struct list_head *page_list, int max) |
4885 | return nr_pages; |
4886 | |
4887 | out_pages: |
4888 | + ceph_unlock_page_vector(pages, nr_pages); |
4889 | ceph_release_page_vector(pages, nr_pages); |
4890 | out: |
4891 | ceph_osdc_put_request(req); |
4892 | @@ -831,8 +840,8 @@ get_more_pages: |
4893 | ci->i_truncate_size, |
4894 | &inode->i_mtime, true, 1, 0); |
4895 | |
4896 | - if (!req) { |
4897 | - rc = -ENOMEM; |
4898 | + if (IS_ERR(req)) { |
4899 | + rc = PTR_ERR(req); |
4900 | unlock_page(page); |
4901 | break; |
4902 | } |
4903 | diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c |
4904 | index 620daad..e7d4077 100644 |
4905 | --- a/fs/ceph/caps.c |
4906 | +++ b/fs/ceph/caps.c |
4907 | @@ -1349,11 +1349,15 @@ int __ceph_mark_dirty_caps(struct ceph_inode_info *ci, int mask) |
4908 | if (!ci->i_head_snapc) |
4909 | ci->i_head_snapc = ceph_get_snap_context( |
4910 | ci->i_snap_realm->cached_context); |
4911 | - dout(" inode %p now dirty snapc %p\n", &ci->vfs_inode, |
4912 | - ci->i_head_snapc); |
4913 | + dout(" inode %p now dirty snapc %p auth cap %p\n", |
4914 | + &ci->vfs_inode, ci->i_head_snapc, ci->i_auth_cap); |
4915 | BUG_ON(!list_empty(&ci->i_dirty_item)); |
4916 | spin_lock(&mdsc->cap_dirty_lock); |
4917 | - list_add(&ci->i_dirty_item, &mdsc->cap_dirty); |
4918 | + if (ci->i_auth_cap) |
4919 | + list_add(&ci->i_dirty_item, &mdsc->cap_dirty); |
4920 | + else |
4921 | + list_add(&ci->i_dirty_item, |
4922 | + &mdsc->cap_dirty_migrating); |
4923 | spin_unlock(&mdsc->cap_dirty_lock); |
4924 | if (ci->i_flushing_caps == 0) { |
4925 | ihold(inode); |
4926 | @@ -2388,7 +2392,7 @@ static void handle_cap_grant(struct inode *inode, struct ceph_mds_caps *grant, |
4927 | &atime); |
4928 | |
4929 | /* max size increase? */ |
4930 | - if (max_size != ci->i_max_size) { |
4931 | + if (ci->i_auth_cap == cap && max_size != ci->i_max_size) { |
4932 | dout("max_size %lld -> %llu\n", ci->i_max_size, max_size); |
4933 | ci->i_max_size = max_size; |
4934 | if (max_size >= ci->i_wanted_max_size) { |
4935 | @@ -2745,6 +2749,7 @@ static void handle_cap_import(struct ceph_mds_client *mdsc, |
4936 | |
4937 | /* make sure we re-request max_size, if necessary */ |
4938 | spin_lock(&ci->i_ceph_lock); |
4939 | + ci->i_wanted_max_size = 0; /* reset */ |
4940 | ci->i_requested_max_size = 0; |
4941 | spin_unlock(&ci->i_ceph_lock); |
4942 | } |
4943 | @@ -2840,8 +2845,6 @@ void ceph_handle_caps(struct ceph_mds_session *session, |
4944 | case CEPH_CAP_OP_IMPORT: |
4945 | handle_cap_import(mdsc, inode, h, session, |
4946 | snaptrace, snaptrace_len); |
4947 | - ceph_check_caps(ceph_inode(inode), 0, session); |
4948 | - goto done_unlocked; |
4949 | } |
4950 | |
4951 | /* the rest require a cap */ |
4952 | @@ -2858,6 +2861,7 @@ void ceph_handle_caps(struct ceph_mds_session *session, |
4953 | switch (op) { |
4954 | case CEPH_CAP_OP_REVOKE: |
4955 | case CEPH_CAP_OP_GRANT: |
4956 | + case CEPH_CAP_OP_IMPORT: |
4957 | handle_cap_grant(inode, h, session, cap, msg->middle); |
4958 | goto done_unlocked; |
4959 | |
4960 | diff --git a/fs/ceph/file.c b/fs/ceph/file.c |
4961 | index ed72428..9ce3a4b 100644 |
4962 | --- a/fs/ceph/file.c |
4963 | +++ b/fs/ceph/file.c |
4964 | @@ -529,8 +529,8 @@ more: |
4965 | do_sync, |
4966 | ci->i_truncate_seq, ci->i_truncate_size, |
4967 | &mtime, false, 2, page_align); |
4968 | - if (!req) |
4969 | - return -ENOMEM; |
4970 | + if (IS_ERR(req)) |
4971 | + return PTR_ERR(req); |
4972 | |
4973 | if (file->f_flags & O_DIRECT) { |
4974 | pages = ceph_get_direct_page_vector(data, num_pages, false); |
4975 | diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c |
4976 | index 9fff9f3..81613bc 100644 |
4977 | --- a/fs/ceph/inode.c |
4978 | +++ b/fs/ceph/inode.c |
4979 | @@ -992,11 +992,15 @@ int ceph_fill_trace(struct super_block *sb, struct ceph_mds_request *req, |
4980 | if (rinfo->head->is_dentry) { |
4981 | struct inode *dir = req->r_locked_dir; |
4982 | |
4983 | - err = fill_inode(dir, &rinfo->diri, rinfo->dirfrag, |
4984 | - session, req->r_request_started, -1, |
4985 | - &req->r_caps_reservation); |
4986 | - if (err < 0) |
4987 | - return err; |
4988 | + if (dir) { |
4989 | + err = fill_inode(dir, &rinfo->diri, rinfo->dirfrag, |
4990 | + session, req->r_request_started, -1, |
4991 | + &req->r_caps_reservation); |
4992 | + if (err < 0) |
4993 | + return err; |
4994 | + } else { |
4995 | + WARN_ON_ONCE(1); |
4996 | + } |
4997 | } |
4998 | |
4999 | /* |
5000 | @@ -1004,6 +1008,7 @@ int ceph_fill_trace(struct super_block *sb, struct ceph_mds_request *req, |
5001 | * will have trouble splicing in the virtual snapdir later |
5002 | */ |
5003 | if (rinfo->head->is_dentry && !req->r_aborted && |
5004 | + req->r_locked_dir && |
5005 | (rinfo->head->is_target || strncmp(req->r_dentry->d_name.name, |
5006 | fsc->mount_options->snapdir_name, |
5007 | req->r_dentry->d_name.len))) { |
5008 | @@ -1461,7 +1466,7 @@ void __ceph_do_pending_vmtruncate(struct inode *inode) |
5009 | { |
5010 | struct ceph_inode_info *ci = ceph_inode(inode); |
5011 | u64 to; |
5012 | - int wrbuffer_refs, wake = 0; |
5013 | + int wrbuffer_refs, finish = 0; |
5014 | |
5015 | retry: |
5016 | spin_lock(&ci->i_ceph_lock); |
5017 | @@ -1493,15 +1498,18 @@ retry: |
5018 | truncate_inode_pages(inode->i_mapping, to); |
5019 | |
5020 | spin_lock(&ci->i_ceph_lock); |
5021 | - ci->i_truncate_pending--; |
5022 | - if (ci->i_truncate_pending == 0) |
5023 | - wake = 1; |
5024 | + if (to == ci->i_truncate_size) { |
5025 | + ci->i_truncate_pending = 0; |
5026 | + finish = 1; |
5027 | + } |
5028 | spin_unlock(&ci->i_ceph_lock); |
5029 | + if (!finish) |
5030 | + goto retry; |
5031 | |
5032 | if (wrbuffer_refs == 0) |
5033 | ceph_check_caps(ci, CHECK_CAPS_AUTHONLY, NULL); |
5034 | - if (wake) |
5035 | - wake_up_all(&ci->i_cap_wq); |
5036 | + |
5037 | + wake_up_all(&ci->i_cap_wq); |
5038 | } |
5039 | |
5040 | |
5041 | diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c |
5042 | index 7f1682d..3fd08ad 100644 |
5043 | --- a/fs/ceph/mds_client.c |
5044 | +++ b/fs/ceph/mds_client.c |
5045 | @@ -1886,9 +1886,14 @@ finish: |
5046 | static void __wake_requests(struct ceph_mds_client *mdsc, |
5047 | struct list_head *head) |
5048 | { |
5049 | - struct ceph_mds_request *req, *nreq; |
5050 | + struct ceph_mds_request *req; |
5051 | + LIST_HEAD(tmp_list); |
5052 | + |
5053 | + list_splice_init(head, &tmp_list); |
5054 | |
5055 | - list_for_each_entry_safe(req, nreq, head, r_wait) { |
5056 | + while (!list_empty(&tmp_list)) { |
5057 | + req = list_entry(tmp_list.next, |
5058 | + struct ceph_mds_request, r_wait); |
5059 | list_del_init(&req->r_wait); |
5060 | __do_request(mdsc, req); |
5061 | } |
5062 | @@ -2528,6 +2533,7 @@ static void send_mds_reconnect(struct ceph_mds_client *mdsc, |
5063 | session->s_state = CEPH_MDS_SESSION_RECONNECTING; |
5064 | session->s_seq = 0; |
5065 | |
5066 | + ceph_con_close(&session->s_con); |
5067 | ceph_con_open(&session->s_con, |
5068 | CEPH_ENTITY_TYPE_MDS, mds, |
5069 | ceph_mdsmap_get_addr(mdsc->mdsmap, mds)); |
5070 | diff --git a/fs/ceph/super.c b/fs/ceph/super.c |
5071 | index 1e67dd7..f363918 100644 |
5072 | --- a/fs/ceph/super.c |
5073 | +++ b/fs/ceph/super.c |
5074 | @@ -387,8 +387,6 @@ static int ceph_show_options(struct seq_file *m, struct dentry *root) |
5075 | seq_printf(m, ",mount_timeout=%d", opt->mount_timeout); |
5076 | if (opt->osd_idle_ttl != CEPH_OSD_IDLE_TTL_DEFAULT) |
5077 | seq_printf(m, ",osd_idle_ttl=%d", opt->osd_idle_ttl); |
5078 | - if (opt->osd_timeout != CEPH_OSD_TIMEOUT_DEFAULT) |
5079 | - seq_printf(m, ",osdtimeout=%d", opt->osd_timeout); |
5080 | if (opt->osd_keepalive_timeout != CEPH_OSD_KEEPALIVE_DEFAULT) |
5081 | seq_printf(m, ",osdkeepalivetimeout=%d", |
5082 | opt->osd_keepalive_timeout); |
5083 | diff --git a/fs/eventpoll.c b/fs/eventpoll.c |
5084 | index c0b3c70..33c9599 100644 |
5085 | --- a/fs/eventpoll.c |
5086 | +++ b/fs/eventpoll.c |
5087 | @@ -1226,11 +1226,31 @@ static int ep_modify(struct eventpoll *ep, struct epitem *epi, struct epoll_even |
5088 | * otherwise we might miss an event that happens between the |
5089 | * f_op->poll() call and the new event set registering. |
5090 | */ |
5091 | - epi->event.events = event->events; |
5092 | + epi->event.events = event->events; /* need barrier below */ |
5093 | pt._key = event->events; |
5094 | epi->event.data = event->data; /* protected by mtx */ |
5095 | |
5096 | /* |
5097 | + * The following barrier has two effects: |
5098 | + * |
5099 | + * 1) Flush epi changes above to other CPUs. This ensures |
5100 | + * we do not miss events from ep_poll_callback if an |
5101 | + * event occurs immediately after we call f_op->poll(). |
5102 | + * We need this because we did not take ep->lock while |
5103 | + * changing epi above (but ep_poll_callback does take |
5104 | + * ep->lock). |
5105 | + * |
5106 | + * 2) We also need to ensure we do not miss _past_ events |
5107 | + * when calling f_op->poll(). This barrier also |
5108 | + * pairs with the barrier in wq_has_sleeper (see |
5109 | + * comments for wq_has_sleeper). |
5110 | + * |
5111 | + * This barrier will now guarantee ep_poll_callback or f_op->poll |
5112 | + * (or both) will notice the readiness of an item. |
5113 | + */ |
5114 | + smp_mb(); |
5115 | + |
5116 | + /* |
5117 | * Get current event bits. We can safely use the file* here because |
5118 | * its usage count has been increased by the caller of this function. |
5119 | */ |
5120 | diff --git a/fs/ext4/acl.c b/fs/ext4/acl.c |
5121 | index a5c29bb..8535c45 100644 |
5122 | --- a/fs/ext4/acl.c |
5123 | +++ b/fs/ext4/acl.c |
5124 | @@ -410,8 +410,10 @@ ext4_xattr_set_acl(struct dentry *dentry, const char *name, const void *value, |
5125 | |
5126 | retry: |
5127 | handle = ext4_journal_start(inode, EXT4_DATA_TRANS_BLOCKS(inode->i_sb)); |
5128 | - if (IS_ERR(handle)) |
5129 | - return PTR_ERR(handle); |
5130 | + if (IS_ERR(handle)) { |
5131 | + error = PTR_ERR(handle); |
5132 | + goto release_and_out; |
5133 | + } |
5134 | error = ext4_set_acl(handle, inode, type, acl); |
5135 | ext4_journal_stop(handle); |
5136 | if (error == -ENOSPC && ext4_should_retry_alloc(inode->i_sb, &retries)) |
5137 | diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c |
5138 | index c215985..852d4c2 100644 |
5139 | --- a/fs/ext4/extents.c |
5140 | +++ b/fs/ext4/extents.c |
5141 | @@ -2110,13 +2110,14 @@ ext4_ext_in_cache(struct inode *inode, ext4_lblk_t block, |
5142 | * removes index from the index block. |
5143 | */ |
5144 | static int ext4_ext_rm_idx(handle_t *handle, struct inode *inode, |
5145 | - struct ext4_ext_path *path) |
5146 | + struct ext4_ext_path *path, int depth) |
5147 | { |
5148 | int err; |
5149 | ext4_fsblk_t leaf; |
5150 | |
5151 | /* free index block */ |
5152 | - path--; |
5153 | + depth--; |
5154 | + path = path + depth; |
5155 | leaf = ext4_idx_pblock(path->p_idx); |
5156 | if (unlikely(path->p_hdr->eh_entries == 0)) { |
5157 | EXT4_ERROR_INODE(inode, "path->p_hdr->eh_entries == 0"); |
5158 | @@ -2141,6 +2142,19 @@ static int ext4_ext_rm_idx(handle_t *handle, struct inode *inode, |
5159 | |
5160 | ext4_free_blocks(handle, inode, NULL, leaf, 1, |
5161 | EXT4_FREE_BLOCKS_METADATA | EXT4_FREE_BLOCKS_FORGET); |
5162 | + |
5163 | + while (--depth >= 0) { |
5164 | + if (path->p_idx != EXT_FIRST_INDEX(path->p_hdr)) |
5165 | + break; |
5166 | + path--; |
5167 | + err = ext4_ext_get_access(handle, inode, path); |
5168 | + if (err) |
5169 | + break; |
5170 | + path->p_idx->ei_block = (path+1)->p_idx->ei_block; |
5171 | + err = ext4_ext_dirty(handle, inode, path); |
5172 | + if (err) |
5173 | + break; |
5174 | + } |
5175 | return err; |
5176 | } |
5177 | |
5178 | @@ -2474,7 +2488,7 @@ ext4_ext_rm_leaf(handle_t *handle, struct inode *inode, |
5179 | /* if this leaf is free, then we should |
5180 | * remove it from index block above */ |
5181 | if (err == 0 && eh->eh_entries == 0 && path[depth].p_bh != NULL) |
5182 | - err = ext4_ext_rm_idx(handle, inode, path + depth); |
5183 | + err = ext4_ext_rm_idx(handle, inode, path, depth); |
5184 | |
5185 | out: |
5186 | return err; |
5187 | @@ -2675,7 +2689,7 @@ cont: |
5188 | /* index is empty, remove it; |
5189 | * handle must be already prepared by the |
5190 | * truncatei_leaf() */ |
5191 | - err = ext4_ext_rm_idx(handle, inode, path + i); |
5192 | + err = ext4_ext_rm_idx(handle, inode, path, i); |
5193 | } |
5194 | /* root level has p_bh == NULL, brelse() eats this */ |
5195 | brelse(path[i].p_bh); |
5196 | diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c |
5197 | index 556cc82..902544e 100644 |
5198 | --- a/fs/ext4/ialloc.c |
5199 | +++ b/fs/ext4/ialloc.c |
5200 | @@ -734,7 +734,6 @@ got: |
5201 | |
5202 | BUFFER_TRACE(block_bitmap_bh, "dirty block bitmap"); |
5203 | err = ext4_handle_dirty_metadata(handle, NULL, block_bitmap_bh); |
5204 | - brelse(block_bitmap_bh); |
5205 | |
5206 | /* recheck and clear flag under lock if we still need to */ |
5207 | ext4_lock_group(sb, group); |
5208 | @@ -746,6 +745,7 @@ got: |
5209 | gdp); |
5210 | } |
5211 | ext4_unlock_group(sb, group); |
5212 | + brelse(block_bitmap_bh); |
5213 | |
5214 | if (err) |
5215 | goto fail; |
5216 | diff --git a/fs/ext4/super.c b/fs/ext4/super.c |
5217 | index b1c28f1..288f4c6 100644 |
5218 | --- a/fs/ext4/super.c |
5219 | +++ b/fs/ext4/super.c |
5220 | @@ -1599,9 +1599,7 @@ static int parse_options(char *options, struct super_block *sb, |
5221 | unsigned int *journal_ioprio, |
5222 | int is_remount) |
5223 | { |
5224 | -#ifdef CONFIG_QUOTA |
5225 | struct ext4_sb_info *sbi = EXT4_SB(sb); |
5226 | -#endif |
5227 | char *p; |
5228 | substring_t args[MAX_OPT_ARGS]; |
5229 | int token; |
5230 | @@ -1650,6 +1648,16 @@ static int parse_options(char *options, struct super_block *sb, |
5231 | } |
5232 | } |
5233 | #endif |
5234 | + if (test_opt(sb, DIOREAD_NOLOCK)) { |
5235 | + int blocksize = |
5236 | + BLOCK_SIZE << le32_to_cpu(sbi->s_es->s_log_block_size); |
5237 | + |
5238 | + if (blocksize < PAGE_CACHE_SIZE) { |
5239 | + ext4_msg(sb, KERN_ERR, "can't mount with " |
5240 | + "dioread_nolock if block size != PAGE_SIZE"); |
5241 | + return 0; |
5242 | + } |
5243 | + } |
5244 | return 1; |
5245 | } |
5246 | |
5247 | @@ -2112,7 +2120,9 @@ static void ext4_orphan_cleanup(struct super_block *sb, |
5248 | __func__, inode->i_ino, inode->i_size); |
5249 | jbd_debug(2, "truncating inode %lu to %lld bytes\n", |
5250 | inode->i_ino, inode->i_size); |
5251 | + mutex_lock(&inode->i_mutex); |
5252 | ext4_truncate(inode); |
5253 | + mutex_unlock(&inode->i_mutex); |
5254 | nr_truncates++; |
5255 | } else { |
5256 | ext4_msg(sb, KERN_DEBUG, |
5257 | @@ -3226,15 +3236,6 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) |
5258 | clear_opt(sb, DELALLOC); |
5259 | } |
5260 | |
5261 | - blocksize = BLOCK_SIZE << le32_to_cpu(es->s_log_block_size); |
5262 | - if (test_opt(sb, DIOREAD_NOLOCK)) { |
5263 | - if (blocksize < PAGE_SIZE) { |
5264 | - ext4_msg(sb, KERN_ERR, "can't mount with " |
5265 | - "dioread_nolock if block size != PAGE_SIZE"); |
5266 | - goto failed_mount; |
5267 | - } |
5268 | - } |
5269 | - |
5270 | sb->s_flags = (sb->s_flags & ~MS_POSIXACL) | |
5271 | (test_opt(sb, POSIX_ACL) ? MS_POSIXACL : 0); |
5272 | |
5273 | @@ -3276,6 +3277,7 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) |
5274 | if (!ext4_feature_set_ok(sb, (sb->s_flags & MS_RDONLY))) |
5275 | goto failed_mount; |
5276 | |
5277 | + blocksize = BLOCK_SIZE << le32_to_cpu(es->s_log_block_size); |
5278 | if (blocksize < EXT4_MIN_BLOCK_SIZE || |
5279 | blocksize > EXT4_MAX_BLOCK_SIZE) { |
5280 | ext4_msg(sb, KERN_ERR, |
5281 | @@ -4506,7 +4508,7 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data) |
5282 | } |
5283 | |
5284 | ext4_setup_system_zone(sb); |
5285 | - if (sbi->s_journal == NULL) |
5286 | + if (sbi->s_journal == NULL && !(old_sb_flags & MS_RDONLY)) |
5287 | ext4_commit_super(sb, 1); |
5288 | |
5289 | #ifdef CONFIG_QUOTA |
5290 | diff --git a/fs/gfs2/lops.c b/fs/gfs2/lops.c |
5291 | index 6b1efb5..a392e32 100644 |
5292 | --- a/fs/gfs2/lops.c |
5293 | +++ b/fs/gfs2/lops.c |
5294 | @@ -258,16 +258,14 @@ static void buf_lo_add(struct gfs2_sbd *sdp, struct gfs2_log_element *le) |
5295 | struct gfs2_meta_header *mh; |
5296 | struct gfs2_trans *tr; |
5297 | |
5298 | - lock_buffer(bd->bd_bh); |
5299 | - gfs2_log_lock(sdp); |
5300 | if (!list_empty(&bd->bd_list_tr)) |
5301 | - goto out; |
5302 | + return; |
5303 | tr = current->journal_info; |
5304 | tr->tr_touched = 1; |
5305 | tr->tr_num_buf++; |
5306 | list_add(&bd->bd_list_tr, &tr->tr_list_buf); |
5307 | if (!list_empty(&le->le_list)) |
5308 | - goto out; |
5309 | + return; |
5310 | set_bit(GLF_LFLUSH, &bd->bd_gl->gl_flags); |
5311 | set_bit(GLF_DIRTY, &bd->bd_gl->gl_flags); |
5312 | gfs2_meta_check(sdp, bd->bd_bh); |
5313 | @@ -278,9 +276,6 @@ static void buf_lo_add(struct gfs2_sbd *sdp, struct gfs2_log_element *le) |
5314 | sdp->sd_log_num_buf++; |
5315 | list_add(&le->le_list, &sdp->sd_log_le_buf); |
5316 | tr->tr_num_buf_new++; |
5317 | -out: |
5318 | - gfs2_log_unlock(sdp); |
5319 | - unlock_buffer(bd->bd_bh); |
5320 | } |
5321 | |
5322 | static void buf_lo_before_commit(struct gfs2_sbd *sdp) |
5323 | @@ -611,11 +606,9 @@ static void databuf_lo_add(struct gfs2_sbd *sdp, struct gfs2_log_element *le) |
5324 | struct address_space *mapping = bd->bd_bh->b_page->mapping; |
5325 | struct gfs2_inode *ip = GFS2_I(mapping->host); |
5326 | |
5327 | - lock_buffer(bd->bd_bh); |
5328 | - gfs2_log_lock(sdp); |
5329 | if (tr) { |
5330 | if (!list_empty(&bd->bd_list_tr)) |
5331 | - goto out; |
5332 | + return; |
5333 | tr->tr_touched = 1; |
5334 | if (gfs2_is_jdata(ip)) { |
5335 | tr->tr_num_buf++; |
5336 | @@ -623,7 +616,7 @@ static void databuf_lo_add(struct gfs2_sbd *sdp, struct gfs2_log_element *le) |
5337 | } |
5338 | } |
5339 | if (!list_empty(&le->le_list)) |
5340 | - goto out; |
5341 | + return; |
5342 | |
5343 | set_bit(GLF_LFLUSH, &bd->bd_gl->gl_flags); |
5344 | set_bit(GLF_DIRTY, &bd->bd_gl->gl_flags); |
5345 | @@ -635,9 +628,6 @@ static void databuf_lo_add(struct gfs2_sbd *sdp, struct gfs2_log_element *le) |
5346 | } else { |
5347 | list_add_tail(&le->le_list, &sdp->sd_log_le_ordered); |
5348 | } |
5349 | -out: |
5350 | - gfs2_log_unlock(sdp); |
5351 | - unlock_buffer(bd->bd_bh); |
5352 | } |
5353 | |
5354 | static void gfs2_check_magic(struct buffer_head *bh) |
5355 | diff --git a/fs/gfs2/trans.c b/fs/gfs2/trans.c |
5356 | index 86ac75d..6ab2a77 100644 |
5357 | --- a/fs/gfs2/trans.c |
5358 | +++ b/fs/gfs2/trans.c |
5359 | @@ -145,14 +145,22 @@ void gfs2_trans_add_bh(struct gfs2_glock *gl, struct buffer_head *bh, int meta) |
5360 | struct gfs2_sbd *sdp = gl->gl_sbd; |
5361 | struct gfs2_bufdata *bd; |
5362 | |
5363 | + lock_buffer(bh); |
5364 | + gfs2_log_lock(sdp); |
5365 | bd = bh->b_private; |
5366 | if (bd) |
5367 | gfs2_assert(sdp, bd->bd_gl == gl); |
5368 | else { |
5369 | + gfs2_log_unlock(sdp); |
5370 | + unlock_buffer(bh); |
5371 | gfs2_attach_bufdata(gl, bh, meta); |
5372 | bd = bh->b_private; |
5373 | + lock_buffer(bh); |
5374 | + gfs2_log_lock(sdp); |
5375 | } |
5376 | lops_add(sdp, &bd->bd_le); |
5377 | + gfs2_log_unlock(sdp); |
5378 | + unlock_buffer(bh); |
5379 | } |
5380 | |
5381 | void gfs2_trans_add_revoke(struct gfs2_sbd *sdp, struct gfs2_bufdata *bd) |
5382 | diff --git a/fs/jbd2/transaction.c b/fs/jbd2/transaction.c |
5383 | index ddcd354..de8b4cb 100644 |
5384 | --- a/fs/jbd2/transaction.c |
5385 | +++ b/fs/jbd2/transaction.c |
5386 | @@ -209,7 +209,8 @@ repeat: |
5387 | if (!new_transaction) |
5388 | goto alloc_transaction; |
5389 | write_lock(&journal->j_state_lock); |
5390 | - if (!journal->j_running_transaction) { |
5391 | + if (!journal->j_running_transaction && |
5392 | + !journal->j_barrier_count) { |
5393 | jbd2_get_transaction(journal, new_transaction); |
5394 | new_transaction = NULL; |
5395 | } |
5396 | diff --git a/fs/jffs2/nodemgmt.c b/fs/jffs2/nodemgmt.c |
5397 | index 6784d1e..ffa8f12 100644 |
5398 | --- a/fs/jffs2/nodemgmt.c |
5399 | +++ b/fs/jffs2/nodemgmt.c |
5400 | @@ -375,14 +375,16 @@ static int jffs2_do_reserve_space(struct jffs2_sb_info *c, uint32_t minsize, |
5401 | spin_unlock(&c->erase_completion_lock); |
5402 | |
5403 | ret = jffs2_prealloc_raw_node_refs(c, jeb, 1); |
5404 | - if (ret) |
5405 | - return ret; |
5406 | + |
5407 | /* Just lock it again and continue. Nothing much can change because |
5408 | we hold c->alloc_sem anyway. In fact, it's not entirely clear why |
5409 | we hold c->erase_completion_lock in the majority of this function... |
5410 | but that's a question for another (more caffeine-rich) day. */ |
5411 | spin_lock(&c->erase_completion_lock); |
5412 | |
5413 | + if (ret) |
5414 | + return ret; |
5415 | + |
5416 | waste = jeb->free_size; |
5417 | jffs2_link_node_ref(c, jeb, |
5418 | (jeb->offset + c->sector_size - waste) | REF_OBSOLETE, |
5419 | diff --git a/fs/udf/inode.c b/fs/udf/inode.c |
5420 | index 7d75280..aa70035 100644 |
5421 | --- a/fs/udf/inode.c |
5422 | +++ b/fs/udf/inode.c |
5423 | @@ -574,6 +574,7 @@ static sector_t inode_getblk(struct inode *inode, sector_t block, |
5424 | struct udf_inode_info *iinfo = UDF_I(inode); |
5425 | int goal = 0, pgoal = iinfo->i_location.logicalBlockNum; |
5426 | int lastblock = 0; |
5427 | + bool isBeyondEOF; |
5428 | |
5429 | *err = 0; |
5430 | *new = 0; |
5431 | @@ -653,7 +654,7 @@ static sector_t inode_getblk(struct inode *inode, sector_t block, |
5432 | /* Are we beyond EOF? */ |
5433 | if (etype == -1) { |
5434 | int ret; |
5435 | - |
5436 | + isBeyondEOF = 1; |
5437 | if (count) { |
5438 | if (c) |
5439 | laarr[0] = laarr[1]; |
5440 | @@ -696,6 +697,7 @@ static sector_t inode_getblk(struct inode *inode, sector_t block, |
5441 | endnum = c + 1; |
5442 | lastblock = 1; |
5443 | } else { |
5444 | + isBeyondEOF = 0; |
5445 | endnum = startnum = ((count > 2) ? 2 : count); |
5446 | |
5447 | /* if the current extent is in position 0, |
5448 | @@ -738,10 +740,13 @@ static sector_t inode_getblk(struct inode *inode, sector_t block, |
5449 | goal, err); |
5450 | if (!newblocknum) { |
5451 | brelse(prev_epos.bh); |
5452 | + brelse(cur_epos.bh); |
5453 | + brelse(next_epos.bh); |
5454 | *err = -ENOSPC; |
5455 | return 0; |
5456 | } |
5457 | - iinfo->i_lenExtents += inode->i_sb->s_blocksize; |
5458 | + if (isBeyondEOF) |
5459 | + iinfo->i_lenExtents += inode->i_sb->s_blocksize; |
5460 | } |
5461 | |
5462 | /* if the extent the requsted block is located in contains multiple |
5463 | @@ -768,6 +773,8 @@ static sector_t inode_getblk(struct inode *inode, sector_t block, |
5464 | udf_update_extents(inode, laarr, startnum, endnum, &prev_epos); |
5465 | |
5466 | brelse(prev_epos.bh); |
5467 | + brelse(cur_epos.bh); |
5468 | + brelse(next_epos.bh); |
5469 | |
5470 | newblock = udf_get_pblock(inode->i_sb, newblocknum, |
5471 | iinfo->i_location.partitionReferenceNum, 0); |
5472 | diff --git a/include/linux/ceph/libceph.h b/include/linux/ceph/libceph.h |
5473 | index 98ec36a..893420b 100644 |
5474 | --- a/include/linux/ceph/libceph.h |
5475 | +++ b/include/linux/ceph/libceph.h |
5476 | @@ -49,7 +49,6 @@ struct ceph_options { |
5477 | struct ceph_entity_addr my_addr; |
5478 | int mount_timeout; |
5479 | int osd_idle_ttl; |
5480 | - int osd_timeout; |
5481 | int osd_keepalive_timeout; |
5482 | |
5483 | /* |
5484 | @@ -69,7 +68,6 @@ struct ceph_options { |
5485 | * defaults |
5486 | */ |
5487 | #define CEPH_MOUNT_TIMEOUT_DEFAULT 60 |
5488 | -#define CEPH_OSD_TIMEOUT_DEFAULT 60 /* seconds */ |
5489 | #define CEPH_OSD_KEEPALIVE_DEFAULT 5 |
5490 | #define CEPH_OSD_IDLE_TTL_DEFAULT 60 |
5491 | |
5492 | diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c |
5493 | index cf8d11e..2866783 100644 |
5494 | --- a/kernel/trace/ring_buffer.c |
5495 | +++ b/kernel/trace/ring_buffer.c |
5496 | @@ -2708,7 +2708,7 @@ unsigned long ring_buffer_oldest_event_ts(struct ring_buffer *buffer, int cpu) |
5497 | unsigned long flags; |
5498 | struct ring_buffer_per_cpu *cpu_buffer; |
5499 | struct buffer_page *bpage; |
5500 | - unsigned long ret; |
5501 | + unsigned long ret = 0; |
5502 | |
5503 | if (!cpumask_test_cpu(cpu, buffer->cpumask)) |
5504 | return 0; |
5505 | @@ -2723,7 +2723,8 @@ unsigned long ring_buffer_oldest_event_ts(struct ring_buffer *buffer, int cpu) |
5506 | bpage = cpu_buffer->reader_page; |
5507 | else |
5508 | bpage = rb_set_head_page(cpu_buffer); |
5509 | - ret = bpage->page->time_stamp; |
5510 | + if (bpage) |
5511 | + ret = bpage->page->time_stamp; |
5512 | raw_spin_unlock_irqrestore(&cpu_buffer->reader_lock, flags); |
5513 | |
5514 | return ret; |
5515 | @@ -3030,6 +3031,8 @@ rb_get_reader_page(struct ring_buffer_per_cpu *cpu_buffer) |
5516 | * Splice the empty reader page into the list around the head. |
5517 | */ |
5518 | reader = rb_set_head_page(cpu_buffer); |
5519 | + if (!reader) |
5520 | + goto out; |
5521 | cpu_buffer->reader_page->list.next = rb_list_head(reader->list.next); |
5522 | cpu_buffer->reader_page->list.prev = reader->list.prev; |
5523 | |
5524 | diff --git a/mm/compaction.c b/mm/compaction.c |
5525 | index 459b0ab..3c8d7fe 100644 |
5526 | --- a/mm/compaction.c |
5527 | +++ b/mm/compaction.c |
5528 | @@ -736,7 +736,7 @@ static int compact_node(int nid) |
5529 | } |
5530 | |
5531 | /* Compact all nodes in the system */ |
5532 | -static int compact_nodes(void) |
5533 | +static void compact_nodes(void) |
5534 | { |
5535 | int nid; |
5536 | |
5537 | @@ -745,8 +745,6 @@ static int compact_nodes(void) |
5538 | |
5539 | for_each_online_node(nid) |
5540 | compact_node(nid); |
5541 | - |
5542 | - return COMPACT_COMPLETE; |
5543 | } |
5544 | |
5545 | /* The written value is actually unused, all memory is compacted */ |
5546 | @@ -757,7 +755,7 @@ int sysctl_compaction_handler(struct ctl_table *table, int write, |
5547 | void __user *buffer, size_t *length, loff_t *ppos) |
5548 | { |
5549 | if (write) |
5550 | - return compact_nodes(); |
5551 | + compact_nodes(); |
5552 | |
5553 | return 0; |
5554 | } |
5555 | diff --git a/mm/huge_memory.c b/mm/huge_memory.c |
5556 | index f0e5306..caf15b6 100644 |
5557 | --- a/mm/huge_memory.c |
5558 | +++ b/mm/huge_memory.c |
5559 | @@ -950,6 +950,8 @@ int do_huge_pmd_wp_page(struct mm_struct *mm, struct vm_area_struct *vma, |
5560 | count_vm_event(THP_FAULT_FALLBACK); |
5561 | ret = do_huge_pmd_wp_page_fallback(mm, vma, address, |
5562 | pmd, orig_pmd, page, haddr); |
5563 | + if (ret & VM_FAULT_OOM) |
5564 | + split_huge_page(page); |
5565 | put_page(page); |
5566 | goto out; |
5567 | } |
5568 | @@ -957,6 +959,7 @@ int do_huge_pmd_wp_page(struct mm_struct *mm, struct vm_area_struct *vma, |
5569 | |
5570 | if (unlikely(mem_cgroup_newpage_charge(new_page, mm, GFP_KERNEL))) { |
5571 | put_page(new_page); |
5572 | + split_huge_page(page); |
5573 | put_page(page); |
5574 | ret |= VM_FAULT_OOM; |
5575 | goto out; |
5576 | diff --git a/mm/memory.c b/mm/memory.c |
5577 | index 024b4af..2f42aab 100644 |
5578 | --- a/mm/memory.c |
5579 | +++ b/mm/memory.c |
5580 | @@ -3494,6 +3494,7 @@ int handle_mm_fault(struct mm_struct *mm, struct vm_area_struct *vma, |
5581 | if (unlikely(is_vm_hugetlb_page(vma))) |
5582 | return hugetlb_fault(mm, vma, address, flags); |
5583 | |
5584 | +retry: |
5585 | pgd = pgd_offset(mm, address); |
5586 | pud = pud_alloc(mm, pgd, address); |
5587 | if (!pud) |
5588 | @@ -3507,13 +3508,24 @@ int handle_mm_fault(struct mm_struct *mm, struct vm_area_struct *vma, |
5589 | pmd, flags); |
5590 | } else { |
5591 | pmd_t orig_pmd = *pmd; |
5592 | + int ret; |
5593 | + |
5594 | barrier(); |
5595 | if (pmd_trans_huge(orig_pmd)) { |
5596 | if (flags & FAULT_FLAG_WRITE && |
5597 | !pmd_write(orig_pmd) && |
5598 | - !pmd_trans_splitting(orig_pmd)) |
5599 | - return do_huge_pmd_wp_page(mm, vma, address, |
5600 | - pmd, orig_pmd); |
5601 | + !pmd_trans_splitting(orig_pmd)) { |
5602 | + ret = do_huge_pmd_wp_page(mm, vma, address, pmd, |
5603 | + orig_pmd); |
5604 | + /* |
5605 | + * If COW results in an oom, the huge pmd will |
5606 | + * have been split, so retry the fault on the |
5607 | + * pte for a smaller charge. |
5608 | + */ |
5609 | + if (unlikely(ret & VM_FAULT_OOM)) |
5610 | + goto retry; |
5611 | + return ret; |
5612 | + } |
5613 | return 0; |
5614 | } |
5615 | } |
5616 | diff --git a/mm/page_alloc.c b/mm/page_alloc.c |
5617 | index 88a6d87..691b8ec 100644 |
5618 | --- a/mm/page_alloc.c |
5619 | +++ b/mm/page_alloc.c |
5620 | @@ -5340,7 +5340,7 @@ static inline int pfn_to_bitidx(struct zone *zone, unsigned long pfn) |
5621 | pfn &= (PAGES_PER_SECTION-1); |
5622 | return (pfn >> pageblock_order) * NR_PAGEBLOCK_BITS; |
5623 | #else |
5624 | - pfn = pfn - zone->zone_start_pfn; |
5625 | + pfn = pfn - round_down(zone->zone_start_pfn, pageblock_nr_pages); |
5626 | return (pfn >> pageblock_order) * NR_PAGEBLOCK_BITS; |
5627 | #endif /* CONFIG_SPARSEMEM */ |
5628 | } |
5629 | diff --git a/net/ceph/ceph_common.c b/net/ceph/ceph_common.c |
5630 | index 8e74e8c..b11448f 100644 |
5631 | --- a/net/ceph/ceph_common.c |
5632 | +++ b/net/ceph/ceph_common.c |
5633 | @@ -304,7 +304,6 @@ ceph_parse_options(char *options, const char *dev_name, |
5634 | |
5635 | /* start with defaults */ |
5636 | opt->flags = CEPH_OPT_DEFAULT; |
5637 | - opt->osd_timeout = CEPH_OSD_TIMEOUT_DEFAULT; |
5638 | opt->osd_keepalive_timeout = CEPH_OSD_KEEPALIVE_DEFAULT; |
5639 | opt->mount_timeout = CEPH_MOUNT_TIMEOUT_DEFAULT; /* seconds */ |
5640 | opt->osd_idle_ttl = CEPH_OSD_IDLE_TTL_DEFAULT; /* seconds */ |
5641 | @@ -390,7 +389,7 @@ ceph_parse_options(char *options, const char *dev_name, |
5642 | |
5643 | /* misc */ |
5644 | case Opt_osdtimeout: |
5645 | - opt->osd_timeout = intval; |
5646 | + pr_warning("ignoring deprecated osdtimeout option\n"); |
5647 | break; |
5648 | case Opt_osdkeepalivetimeout: |
5649 | opt->osd_keepalive_timeout = intval; |
5650 | diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c |
5651 | index aa71a67..ba1037c 100644 |
5652 | --- a/net/ceph/messenger.c |
5653 | +++ b/net/ceph/messenger.c |
5654 | @@ -506,6 +506,7 @@ static void reset_connection(struct ceph_connection *con) |
5655 | { |
5656 | /* reset connection, out_queue, msg_ and connect_seq */ |
5657 | /* discard existing out_queue and msg_seq */ |
5658 | + dout("reset_connection %p\n", con); |
5659 | ceph_msg_remove_list(&con->out_queue); |
5660 | ceph_msg_remove_list(&con->out_sent); |
5661 | |
5662 | @@ -561,7 +562,7 @@ void ceph_con_open(struct ceph_connection *con, |
5663 | mutex_lock(&con->mutex); |
5664 | dout("con_open %p %s\n", con, ceph_pr_addr(&addr->in_addr)); |
5665 | |
5666 | - BUG_ON(con->state != CON_STATE_CLOSED); |
5667 | + WARN_ON(con->state != CON_STATE_CLOSED); |
5668 | con->state = CON_STATE_PREOPEN; |
5669 | |
5670 | con->peer_name.type = (__u8) entity_type; |
5671 | @@ -1502,13 +1503,6 @@ static int process_banner(struct ceph_connection *con) |
5672 | return 0; |
5673 | } |
5674 | |
5675 | -static void fail_protocol(struct ceph_connection *con) |
5676 | -{ |
5677 | - reset_connection(con); |
5678 | - BUG_ON(con->state != CON_STATE_NEGOTIATING); |
5679 | - con->state = CON_STATE_CLOSED; |
5680 | -} |
5681 | - |
5682 | static int process_connect(struct ceph_connection *con) |
5683 | { |
5684 | u64 sup_feat = con->msgr->supported_features; |
5685 | @@ -1526,7 +1520,7 @@ static int process_connect(struct ceph_connection *con) |
5686 | ceph_pr_addr(&con->peer_addr.in_addr), |
5687 | sup_feat, server_feat, server_feat & ~sup_feat); |
5688 | con->error_msg = "missing required protocol features"; |
5689 | - fail_protocol(con); |
5690 | + reset_connection(con); |
5691 | return -1; |
5692 | |
5693 | case CEPH_MSGR_TAG_BADPROTOVER: |
5694 | @@ -1537,7 +1531,7 @@ static int process_connect(struct ceph_connection *con) |
5695 | le32_to_cpu(con->out_connect.protocol_version), |
5696 | le32_to_cpu(con->in_reply.protocol_version)); |
5697 | con->error_msg = "protocol version mismatch"; |
5698 | - fail_protocol(con); |
5699 | + reset_connection(con); |
5700 | return -1; |
5701 | |
5702 | case CEPH_MSGR_TAG_BADAUTHORIZER: |
5703 | @@ -1627,11 +1621,11 @@ static int process_connect(struct ceph_connection *con) |
5704 | ceph_pr_addr(&con->peer_addr.in_addr), |
5705 | req_feat, server_feat, req_feat & ~server_feat); |
5706 | con->error_msg = "missing required protocol features"; |
5707 | - fail_protocol(con); |
5708 | + reset_connection(con); |
5709 | return -1; |
5710 | } |
5711 | |
5712 | - BUG_ON(con->state != CON_STATE_NEGOTIATING); |
5713 | + WARN_ON(con->state != CON_STATE_NEGOTIATING); |
5714 | con->state = CON_STATE_OPEN; |
5715 | |
5716 | con->peer_global_seq = le32_to_cpu(con->in_reply.global_seq); |
5717 | @@ -2128,7 +2122,6 @@ more: |
5718 | if (ret < 0) |
5719 | goto out; |
5720 | |
5721 | - BUG_ON(con->state != CON_STATE_CONNECTING); |
5722 | con->state = CON_STATE_NEGOTIATING; |
5723 | |
5724 | /* |
5725 | @@ -2156,7 +2149,7 @@ more: |
5726 | goto more; |
5727 | } |
5728 | |
5729 | - BUG_ON(con->state != CON_STATE_OPEN); |
5730 | + WARN_ON(con->state != CON_STATE_OPEN); |
5731 | |
5732 | if (con->in_base_pos < 0) { |
5733 | /* |
5734 | @@ -2258,6 +2251,35 @@ static void queue_con(struct ceph_connection *con) |
5735 | } |
5736 | } |
5737 | |
5738 | +static bool con_sock_closed(struct ceph_connection *con) |
5739 | +{ |
5740 | + if (!test_and_clear_bit(CON_FLAG_SOCK_CLOSED, &con->flags)) |
5741 | + return false; |
5742 | + |
5743 | +#define CASE(x) \ |
5744 | + case CON_STATE_ ## x: \ |
5745 | + con->error_msg = "socket closed (con state " #x ")"; \ |
5746 | + break; |
5747 | + |
5748 | + switch (con->state) { |
5749 | + CASE(CLOSED); |
5750 | + CASE(PREOPEN); |
5751 | + CASE(CONNECTING); |
5752 | + CASE(NEGOTIATING); |
5753 | + CASE(OPEN); |
5754 | + CASE(STANDBY); |
5755 | + default: |
5756 | + pr_warning("%s con %p unrecognized state %lu\n", |
5757 | + __func__, con, con->state); |
5758 | + con->error_msg = "unrecognized con state"; |
5759 | + BUG(); |
5760 | + break; |
5761 | + } |
5762 | +#undef CASE |
5763 | + |
5764 | + return true; |
5765 | +} |
5766 | + |
5767 | /* |
5768 | * Do some work on a connection. Drop a connection ref when we're done. |
5769 | */ |
5770 | @@ -2269,24 +2291,8 @@ static void con_work(struct work_struct *work) |
5771 | |
5772 | mutex_lock(&con->mutex); |
5773 | restart: |
5774 | - if (test_and_clear_bit(CON_FLAG_SOCK_CLOSED, &con->flags)) { |
5775 | - switch (con->state) { |
5776 | - case CON_STATE_CONNECTING: |
5777 | - con->error_msg = "connection failed"; |
5778 | - break; |
5779 | - case CON_STATE_NEGOTIATING: |
5780 | - con->error_msg = "negotiation failed"; |
5781 | - break; |
5782 | - case CON_STATE_OPEN: |
5783 | - con->error_msg = "socket closed"; |
5784 | - break; |
5785 | - default: |
5786 | - dout("unrecognized con state %d\n", (int)con->state); |
5787 | - con->error_msg = "unrecognized con state"; |
5788 | - BUG(); |
5789 | - } |
5790 | + if (con_sock_closed(con)) |
5791 | goto fault; |
5792 | - } |
5793 | |
5794 | if (test_and_clear_bit(CON_FLAG_BACKOFF, &con->flags)) { |
5795 | dout("con_work %p backing off\n", con); |
5796 | @@ -2352,12 +2358,12 @@ fault: |
5797 | static void ceph_fault(struct ceph_connection *con) |
5798 | __releases(con->mutex) |
5799 | { |
5800 | - pr_err("%s%lld %s %s\n", ENTITY_NAME(con->peer_name), |
5801 | + pr_warning("%s%lld %s %s\n", ENTITY_NAME(con->peer_name), |
5802 | ceph_pr_addr(&con->peer_addr.in_addr), con->error_msg); |
5803 | dout("fault %p state %lu to peer %s\n", |
5804 | con, con->state, ceph_pr_addr(&con->peer_addr.in_addr)); |
5805 | |
5806 | - BUG_ON(con->state != CON_STATE_CONNECTING && |
5807 | + WARN_ON(con->state != CON_STATE_CONNECTING && |
5808 | con->state != CON_STATE_NEGOTIATING && |
5809 | con->state != CON_STATE_OPEN); |
5810 | |
5811 | diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c |
5812 | index a79dbae..b16dfa2 100644 |
5813 | --- a/net/ceph/osd_client.c |
5814 | +++ b/net/ceph/osd_client.c |
5815 | @@ -221,6 +221,7 @@ struct ceph_osd_request *ceph_osdc_alloc_request(struct ceph_osd_client *osdc, |
5816 | kref_init(&req->r_kref); |
5817 | init_completion(&req->r_completion); |
5818 | init_completion(&req->r_safe_completion); |
5819 | + RB_CLEAR_NODE(&req->r_node); |
5820 | INIT_LIST_HEAD(&req->r_unsafe_item); |
5821 | INIT_LIST_HEAD(&req->r_linger_item); |
5822 | INIT_LIST_HEAD(&req->r_linger_osd); |
5823 | @@ -461,6 +462,7 @@ struct ceph_osd_request *ceph_osdc_new_request(struct ceph_osd_client *osdc, |
5824 | { |
5825 | struct ceph_osd_req_op ops[3]; |
5826 | struct ceph_osd_request *req; |
5827 | + int r; |
5828 | |
5829 | ops[0].op = opcode; |
5830 | ops[0].extent.truncate_seq = truncate_seq; |
5831 | @@ -479,10 +481,12 @@ struct ceph_osd_request *ceph_osdc_new_request(struct ceph_osd_client *osdc, |
5832 | use_mempool, |
5833 | GFP_NOFS, NULL, NULL); |
5834 | if (!req) |
5835 | - return NULL; |
5836 | + return ERR_PTR(-ENOMEM); |
5837 | |
5838 | /* calculate max write size */ |
5839 | - calc_layout(osdc, vino, layout, off, plen, req, ops); |
5840 | + r = calc_layout(osdc, vino, layout, off, plen, req, ops); |
5841 | + if (r < 0) |
5842 | + return ERR_PTR(r); |
5843 | req->r_file_layout = *layout; /* keep a copy */ |
5844 | |
5845 | /* in case it differs from natural (file) alignment that |
5846 | @@ -575,7 +579,7 @@ static void __kick_osd_requests(struct ceph_osd_client *osdc, |
5847 | |
5848 | dout("__kick_osd_requests osd%d\n", osd->o_osd); |
5849 | err = __reset_osd(osdc, osd); |
5850 | - if (err == -EAGAIN) |
5851 | + if (err) |
5852 | return; |
5853 | |
5854 | list_for_each_entry(req, &osd->o_requests, r_osd_item) { |
5855 | @@ -602,14 +606,6 @@ static void __kick_osd_requests(struct ceph_osd_client *osdc, |
5856 | } |
5857 | } |
5858 | |
5859 | -static void kick_osd_requests(struct ceph_osd_client *osdc, |
5860 | - struct ceph_osd *kickosd) |
5861 | -{ |
5862 | - mutex_lock(&osdc->request_mutex); |
5863 | - __kick_osd_requests(osdc, kickosd); |
5864 | - mutex_unlock(&osdc->request_mutex); |
5865 | -} |
5866 | - |
5867 | /* |
5868 | * If the osd connection drops, we need to resubmit all requests. |
5869 | */ |
5870 | @@ -623,7 +619,9 @@ static void osd_reset(struct ceph_connection *con) |
5871 | dout("osd_reset osd%d\n", osd->o_osd); |
5872 | osdc = osd->o_osdc; |
5873 | down_read(&osdc->map_sem); |
5874 | - kick_osd_requests(osdc, osd); |
5875 | + mutex_lock(&osdc->request_mutex); |
5876 | + __kick_osd_requests(osdc, osd); |
5877 | + mutex_unlock(&osdc->request_mutex); |
5878 | send_queued(osdc); |
5879 | up_read(&osdc->map_sem); |
5880 | } |
5881 | @@ -642,6 +640,7 @@ static struct ceph_osd *create_osd(struct ceph_osd_client *osdc, int onum) |
5882 | atomic_set(&osd->o_ref, 1); |
5883 | osd->o_osdc = osdc; |
5884 | osd->o_osd = onum; |
5885 | + RB_CLEAR_NODE(&osd->o_node); |
5886 | INIT_LIST_HEAD(&osd->o_requests); |
5887 | INIT_LIST_HEAD(&osd->o_linger_requests); |
5888 | INIT_LIST_HEAD(&osd->o_osd_lru); |
5889 | @@ -745,6 +744,7 @@ static int __reset_osd(struct ceph_osd_client *osdc, struct ceph_osd *osd) |
5890 | if (list_empty(&osd->o_requests) && |
5891 | list_empty(&osd->o_linger_requests)) { |
5892 | __remove_osd(osdc, osd); |
5893 | + ret = -ENODEV; |
5894 | } else if (memcmp(&osdc->osdmap->osd_addr[osd->o_osd], |
5895 | &osd->o_con.peer_addr, |
5896 | sizeof(osd->o_con.peer_addr)) == 0 && |
5897 | @@ -871,9 +871,9 @@ static void __unregister_request(struct ceph_osd_client *osdc, |
5898 | req->r_osd = NULL; |
5899 | } |
5900 | |
5901 | + list_del_init(&req->r_req_lru_item); |
5902 | ceph_osdc_put_request(req); |
5903 | |
5904 | - list_del_init(&req->r_req_lru_item); |
5905 | if (osdc->num_requests == 0) { |
5906 | dout(" no requests, canceling timeout\n"); |
5907 | __cancel_osd_timeout(osdc); |
5908 | @@ -905,8 +905,8 @@ static void __unregister_linger_request(struct ceph_osd_client *osdc, |
5909 | struct ceph_osd_request *req) |
5910 | { |
5911 | dout("__unregister_linger_request %p\n", req); |
5912 | + list_del_init(&req->r_linger_item); |
5913 | if (req->r_osd) { |
5914 | - list_del_init(&req->r_linger_item); |
5915 | list_del_init(&req->r_linger_osd); |
5916 | |
5917 | if (list_empty(&req->r_osd->o_requests) && |
5918 | @@ -1085,12 +1085,10 @@ static void handle_timeout(struct work_struct *work) |
5919 | { |
5920 | struct ceph_osd_client *osdc = |
5921 | container_of(work, struct ceph_osd_client, timeout_work.work); |
5922 | - struct ceph_osd_request *req, *last_req = NULL; |
5923 | + struct ceph_osd_request *req; |
5924 | struct ceph_osd *osd; |
5925 | - unsigned long timeout = osdc->client->options->osd_timeout * HZ; |
5926 | unsigned long keepalive = |
5927 | osdc->client->options->osd_keepalive_timeout * HZ; |
5928 | - unsigned long last_stamp = 0; |
5929 | struct list_head slow_osds; |
5930 | dout("timeout\n"); |
5931 | down_read(&osdc->map_sem); |
5932 | @@ -1100,37 +1098,6 @@ static void handle_timeout(struct work_struct *work) |
5933 | mutex_lock(&osdc->request_mutex); |
5934 | |
5935 | /* |
5936 | - * reset osds that appear to be _really_ unresponsive. this |
5937 | - * is a failsafe measure.. we really shouldn't be getting to |
5938 | - * this point if the system is working properly. the monitors |
5939 | - * should mark the osd as failed and we should find out about |
5940 | - * it from an updated osd map. |
5941 | - */ |
5942 | - while (timeout && !list_empty(&osdc->req_lru)) { |
5943 | - req = list_entry(osdc->req_lru.next, struct ceph_osd_request, |
5944 | - r_req_lru_item); |
5945 | - |
5946 | - /* hasn't been long enough since we sent it? */ |
5947 | - if (time_before(jiffies, req->r_stamp + timeout)) |
5948 | - break; |
5949 | - |
5950 | - /* hasn't been long enough since it was acked? */ |
5951 | - if (req->r_request->ack_stamp == 0 || |
5952 | - time_before(jiffies, req->r_request->ack_stamp + timeout)) |
5953 | - break; |
5954 | - |
5955 | - BUG_ON(req == last_req && req->r_stamp == last_stamp); |
5956 | - last_req = req; |
5957 | - last_stamp = req->r_stamp; |
5958 | - |
5959 | - osd = req->r_osd; |
5960 | - BUG_ON(!osd); |
5961 | - pr_warning(" tid %llu timed out on osd%d, will reset osd\n", |
5962 | - req->r_tid, osd->o_osd); |
5963 | - __kick_osd_requests(osdc, osd); |
5964 | - } |
5965 | - |
5966 | - /* |
5967 | * ping osds that are a bit slow. this ensures that if there |
5968 | * is a break in the TCP connection we will notice, and reopen |
5969 | * a connection with that osd (from the fault callback). |
5970 | @@ -1301,7 +1268,7 @@ static void reset_changed_osds(struct ceph_osd_client *osdc) |
5971 | * Requeue requests whose mapping to an OSD has changed. If requests map to |
5972 | * no osd, request a new map. |
5973 | * |
5974 | - * Caller should hold map_sem for read and request_mutex. |
5975 | + * Caller should hold map_sem for read. |
5976 | */ |
5977 | static void kick_requests(struct ceph_osd_client *osdc, int force_resend) |
5978 | { |
5979 | @@ -1315,6 +1282,24 @@ static void kick_requests(struct ceph_osd_client *osdc, int force_resend) |
5980 | for (p = rb_first(&osdc->requests); p; ) { |
5981 | req = rb_entry(p, struct ceph_osd_request, r_node); |
5982 | p = rb_next(p); |
5983 | + |
5984 | + /* |
5985 | + * For linger requests that have not yet been |
5986 | + * registered, move them to the linger list; they'll |
5987 | + * be sent to the osd in the loop below. Unregister |
5988 | + * the request before re-registering it as a linger |
5989 | + * request to ensure the __map_request() below |
5990 | + * will decide it needs to be sent. |
5991 | + */ |
5992 | + if (req->r_linger && list_empty(&req->r_linger_item)) { |
5993 | + dout("%p tid %llu restart on osd%d\n", |
5994 | + req, req->r_tid, |
5995 | + req->r_osd ? req->r_osd->o_osd : -1); |
5996 | + __unregister_request(osdc, req); |
5997 | + __register_linger_request(osdc, req); |
5998 | + continue; |
5999 | + } |
6000 | + |
6001 | err = __map_request(osdc, req, force_resend); |
6002 | if (err < 0) |
6003 | continue; /* error */ |
6004 | @@ -1329,17 +1314,6 @@ static void kick_requests(struct ceph_osd_client *osdc, int force_resend) |
6005 | req->r_flags |= CEPH_OSD_FLAG_RETRY; |
6006 | } |
6007 | } |
6008 | - if (req->r_linger && list_empty(&req->r_linger_item)) { |
6009 | - /* |
6010 | - * register as a linger so that we will |
6011 | - * re-submit below and get a new tid |
6012 | - */ |
6013 | - dout("%p tid %llu restart on osd%d\n", |
6014 | - req, req->r_tid, |
6015 | - req->r_osd ? req->r_osd->o_osd : -1); |
6016 | - __register_linger_request(osdc, req); |
6017 | - __unregister_request(osdc, req); |
6018 | - } |
6019 | } |
6020 | |
6021 | list_for_each_entry_safe(req, nreq, &osdc->req_linger, |
6022 | @@ -1347,6 +1321,7 @@ static void kick_requests(struct ceph_osd_client *osdc, int force_resend) |
6023 | dout("linger req=%p req->r_osd=%p\n", req, req->r_osd); |
6024 | |
6025 | err = __map_request(osdc, req, force_resend); |
6026 | + dout("__map_request returned %d\n", err); |
6027 | if (err == 0) |
6028 | continue; /* no change and no osd was specified */ |
6029 | if (err < 0) |
6030 | @@ -1359,8 +1334,8 @@ static void kick_requests(struct ceph_osd_client *osdc, int force_resend) |
6031 | |
6032 | dout("kicking lingering %p tid %llu osd%d\n", req, req->r_tid, |
6033 | req->r_osd ? req->r_osd->o_osd : -1); |
6034 | - __unregister_linger_request(osdc, req); |
6035 | __register_request(osdc, req); |
6036 | + __unregister_linger_request(osdc, req); |
6037 | } |
6038 | mutex_unlock(&osdc->request_mutex); |
6039 | |
6040 | @@ -1368,6 +1343,7 @@ static void kick_requests(struct ceph_osd_client *osdc, int force_resend) |
6041 | dout("%d requests for down osds, need new map\n", needmap); |
6042 | ceph_monc_request_next_osdmap(&osdc->client->monc); |
6043 | } |
6044 | + reset_changed_osds(osdc); |
6045 | } |
6046 | |
6047 | |
6048 | @@ -1424,7 +1400,6 @@ void ceph_osdc_handle_map(struct ceph_osd_client *osdc, struct ceph_msg *msg) |
6049 | osdc->osdmap = newmap; |
6050 | } |
6051 | kick_requests(osdc, 0); |
6052 | - reset_changed_osds(osdc); |
6053 | } else { |
6054 | dout("ignoring incremental map %u len %d\n", |
6055 | epoch, maplen); |
6056 | @@ -1594,6 +1569,7 @@ int ceph_osdc_create_event(struct ceph_osd_client *osdc, |
6057 | event->data = data; |
6058 | event->osdc = osdc; |
6059 | INIT_LIST_HEAD(&event->osd_node); |
6060 | + RB_CLEAR_NODE(&event->node); |
6061 | kref_init(&event->kref); /* one ref for us */ |
6062 | kref_get(&event->kref); /* one ref for the caller */ |
6063 | init_completion(&event->completion); |
6064 | @@ -1925,8 +1901,8 @@ int ceph_osdc_readpages(struct ceph_osd_client *osdc, |
6065 | CEPH_OSD_OP_READ, CEPH_OSD_FLAG_READ, |
6066 | NULL, 0, truncate_seq, truncate_size, NULL, |
6067 | false, 1, page_align); |
6068 | - if (!req) |
6069 | - return -ENOMEM; |
6070 | + if (IS_ERR(req)) |
6071 | + return PTR_ERR(req); |
6072 | |
6073 | /* it may be a short read due to an object boundary */ |
6074 | req->r_pages = pages; |
6075 | @@ -1968,8 +1944,8 @@ int ceph_osdc_writepages(struct ceph_osd_client *osdc, struct ceph_vino vino, |
6076 | snapc, do_sync, |
6077 | truncate_seq, truncate_size, mtime, |
6078 | nofail, 1, page_align); |
6079 | - if (!req) |
6080 | - return -ENOMEM; |
6081 | + if (IS_ERR(req)) |
6082 | + return PTR_ERR(req); |
6083 | |
6084 | /* it may be a short write due to an object boundary */ |
6085 | req->r_pages = pages; |
6086 | diff --git a/net/ceph/osdmap.c b/net/ceph/osdmap.c |
6087 | index 430076e..7fbe210 100644 |
6088 | --- a/net/ceph/osdmap.c |
6089 | +++ b/net/ceph/osdmap.c |
6090 | @@ -613,10 +613,12 @@ struct ceph_osdmap *osdmap_decode(void **p, void *end) |
6091 | ceph_decode_32_safe(p, end, max, bad); |
6092 | while (max--) { |
6093 | ceph_decode_need(p, end, 4 + 1 + sizeof(pi->v), bad); |
6094 | + err = -ENOMEM; |
6095 | pi = kzalloc(sizeof(*pi), GFP_NOFS); |
6096 | if (!pi) |
6097 | goto bad; |
6098 | pi->id = ceph_decode_32(p); |
6099 | + err = -EINVAL; |
6100 | ev = ceph_decode_8(p); /* encoding version */ |
6101 | if (ev > CEPH_PG_POOL_VERSION) { |
6102 | pr_warning("got unknown v %d > %d of ceph_pg_pool\n", |
6103 | @@ -632,8 +634,13 @@ struct ceph_osdmap *osdmap_decode(void **p, void *end) |
6104 | __insert_pg_pool(&map->pg_pools, pi); |
6105 | } |
6106 | |
6107 | - if (version >= 5 && __decode_pool_names(p, end, map) < 0) |
6108 | - goto bad; |
6109 | + if (version >= 5) { |
6110 | + err = __decode_pool_names(p, end, map); |
6111 | + if (err < 0) { |
6112 | + dout("fail to decode pool names"); |
6113 | + goto bad; |
6114 | + } |
6115 | + } |
6116 | |
6117 | ceph_decode_32_safe(p, end, map->pool_max, bad); |
6118 | |
6119 | @@ -713,7 +720,7 @@ struct ceph_osdmap *osdmap_decode(void **p, void *end) |
6120 | return map; |
6121 | |
6122 | bad: |
6123 | - dout("osdmap_decode fail\n"); |
6124 | + dout("osdmap_decode fail err %d\n", err); |
6125 | ceph_osdmap_destroy(map); |
6126 | return ERR_PTR(err); |
6127 | } |
6128 | @@ -807,6 +814,7 @@ struct ceph_osdmap *osdmap_apply_incremental(void **p, void *end, |
6129 | if (ev > CEPH_PG_POOL_VERSION) { |
6130 | pr_warning("got unknown v %d > %d of ceph_pg_pool\n", |
6131 | ev, CEPH_PG_POOL_VERSION); |
6132 | + err = -EINVAL; |
6133 | goto bad; |
6134 | } |
6135 | pi = __lookup_pg_pool(&map->pg_pools, pool); |
6136 | @@ -823,8 +831,11 @@ struct ceph_osdmap *osdmap_apply_incremental(void **p, void *end, |
6137 | if (err < 0) |
6138 | goto bad; |
6139 | } |
6140 | - if (version >= 5 && __decode_pool_names(p, end, map) < 0) |
6141 | - goto bad; |
6142 | + if (version >= 5) { |
6143 | + err = __decode_pool_names(p, end, map); |
6144 | + if (err < 0) |
6145 | + goto bad; |
6146 | + } |
6147 | |
6148 | /* old_pool */ |
6149 | ceph_decode_32_safe(p, end, len, bad); |
6150 | @@ -900,15 +911,13 @@ struct ceph_osdmap *osdmap_apply_incremental(void **p, void *end, |
6151 | (void) __remove_pg_mapping(&map->pg_temp, pgid); |
6152 | |
6153 | /* insert */ |
6154 | - if (pglen > (UINT_MAX - sizeof(*pg)) / sizeof(u32)) { |
6155 | - err = -EINVAL; |
6156 | + err = -EINVAL; |
6157 | + if (pglen > (UINT_MAX - sizeof(*pg)) / sizeof(u32)) |
6158 | goto bad; |
6159 | - } |
6160 | + err = -ENOMEM; |
6161 | pg = kmalloc(sizeof(*pg) + sizeof(u32)*pglen, GFP_NOFS); |
6162 | - if (!pg) { |
6163 | - err = -ENOMEM; |
6164 | + if (!pg) |
6165 | goto bad; |
6166 | - } |
6167 | pg->pgid = pgid; |
6168 | pg->len = pglen; |
6169 | for (j = 0; j < pglen; j++) |
6170 | diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c |
6171 | index 7c51bae..50191a3 100644 |
6172 | --- a/net/mac80211/ibss.c |
6173 | +++ b/net/mac80211/ibss.c |
6174 | @@ -664,8 +664,8 @@ static void ieee80211_sta_merge_ibss(struct ieee80211_sub_if_data *sdata) |
6175 | printk(KERN_DEBUG "%s: No active IBSS STAs - trying to scan for other " |
6176 | "IBSS networks with same SSID (merge)\n", sdata->name); |
6177 | |
6178 | - ieee80211_request_internal_scan(sdata, |
6179 | - ifibss->ssid, ifibss->ssid_len, NULL); |
6180 | + ieee80211_request_ibss_scan(sdata, ifibss->ssid, ifibss->ssid_len, |
6181 | + NULL); |
6182 | } |
6183 | |
6184 | static void ieee80211_sta_create_ibss(struct ieee80211_sub_if_data *sdata) |
6185 | @@ -772,9 +772,8 @@ static void ieee80211_sta_find_ibss(struct ieee80211_sub_if_data *sdata) |
6186 | printk(KERN_DEBUG "%s: Trigger new scan to find an IBSS to " |
6187 | "join\n", sdata->name); |
6188 | |
6189 | - ieee80211_request_internal_scan(sdata, |
6190 | - ifibss->ssid, ifibss->ssid_len, |
6191 | - ifibss->fixed_channel ? ifibss->channel : NULL); |
6192 | + ieee80211_request_ibss_scan(sdata, ifibss->ssid, |
6193 | + ifibss->ssid_len, chan); |
6194 | } else { |
6195 | int interval = IEEE80211_SCAN_INTERVAL; |
6196 | |
6197 | diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h |
6198 | index 498e87b..f8b5e75 100644 |
6199 | --- a/net/mac80211/ieee80211_i.h |
6200 | +++ b/net/mac80211/ieee80211_i.h |
6201 | @@ -1233,9 +1233,9 @@ void ieee80211_mesh_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata, |
6202 | |
6203 | /* scan/BSS handling */ |
6204 | void ieee80211_scan_work(struct work_struct *work); |
6205 | -int ieee80211_request_internal_scan(struct ieee80211_sub_if_data *sdata, |
6206 | - const u8 *ssid, u8 ssid_len, |
6207 | - struct ieee80211_channel *chan); |
6208 | +int ieee80211_request_ibss_scan(struct ieee80211_sub_if_data *sdata, |
6209 | + const u8 *ssid, u8 ssid_len, |
6210 | + struct ieee80211_channel *chan); |
6211 | int ieee80211_request_scan(struct ieee80211_sub_if_data *sdata, |
6212 | struct cfg80211_scan_request *req); |
6213 | void ieee80211_scan_cancel(struct ieee80211_local *local); |
6214 | diff --git a/net/mac80211/scan.c b/net/mac80211/scan.c |
6215 | index c70e176..e95d494 100644 |
6216 | --- a/net/mac80211/scan.c |
6217 | +++ b/net/mac80211/scan.c |
6218 | @@ -761,9 +761,9 @@ int ieee80211_request_scan(struct ieee80211_sub_if_data *sdata, |
6219 | return res; |
6220 | } |
6221 | |
6222 | -int ieee80211_request_internal_scan(struct ieee80211_sub_if_data *sdata, |
6223 | - const u8 *ssid, u8 ssid_len, |
6224 | - struct ieee80211_channel *chan) |
6225 | +int ieee80211_request_ibss_scan(struct ieee80211_sub_if_data *sdata, |
6226 | + const u8 *ssid, u8 ssid_len, |
6227 | + struct ieee80211_channel *chan) |
6228 | { |
6229 | struct ieee80211_local *local = sdata->local; |
6230 | int ret = -EBUSY; |
6231 | @@ -777,22 +777,36 @@ int ieee80211_request_internal_scan(struct ieee80211_sub_if_data *sdata, |
6232 | |
6233 | /* fill internal scan request */ |
6234 | if (!chan) { |
6235 | - int i, nchan = 0; |
6236 | + int i, max_n; |
6237 | + int n_ch = 0; |
6238 | |
6239 | for (band = 0; band < IEEE80211_NUM_BANDS; band++) { |
6240 | if (!local->hw.wiphy->bands[band]) |
6241 | continue; |
6242 | - for (i = 0; |
6243 | - i < local->hw.wiphy->bands[band]->n_channels; |
6244 | - i++) { |
6245 | - local->int_scan_req->channels[nchan] = |
6246 | + |
6247 | + max_n = local->hw.wiphy->bands[band]->n_channels; |
6248 | + for (i = 0; i < max_n; i++) { |
6249 | + struct ieee80211_channel *tmp_ch = |
6250 | &local->hw.wiphy->bands[band]->channels[i]; |
6251 | - nchan++; |
6252 | + |
6253 | + if (tmp_ch->flags & (IEEE80211_CHAN_NO_IBSS | |
6254 | + IEEE80211_CHAN_DISABLED)) |
6255 | + continue; |
6256 | + |
6257 | + local->int_scan_req->channels[n_ch] = tmp_ch; |
6258 | + n_ch++; |
6259 | } |
6260 | } |
6261 | |
6262 | - local->int_scan_req->n_channels = nchan; |
6263 | + if (WARN_ON_ONCE(n_ch == 0)) |
6264 | + goto unlock; |
6265 | + |
6266 | + local->int_scan_req->n_channels = n_ch; |
6267 | } else { |
6268 | + if (WARN_ON_ONCE(chan->flags & (IEEE80211_CHAN_NO_IBSS | |
6269 | + IEEE80211_CHAN_DISABLED))) |
6270 | + goto unlock; |
6271 | + |
6272 | local->int_scan_req->channels[0] = chan; |
6273 | local->int_scan_req->n_channels = 1; |
6274 | } |
6275 | diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c |
6276 | index 6d25d77..e2e0e0b 100644 |
6277 | --- a/net/mac80211/sta_info.c |
6278 | +++ b/net/mac80211/sta_info.c |
6279 | @@ -844,7 +844,7 @@ void sta_info_init(struct ieee80211_local *local) |
6280 | |
6281 | void sta_info_stop(struct ieee80211_local *local) |
6282 | { |
6283 | - del_timer(&local->sta_cleanup); |
6284 | + del_timer_sync(&local->sta_cleanup); |
6285 | sta_info_flush(local, NULL); |
6286 | } |
6287 | |
6288 | diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c |
6289 | index 57f2731..a28a211 100644 |
6290 | --- a/net/sunrpc/clnt.c |
6291 | +++ b/net/sunrpc/clnt.c |
6292 | @@ -236,7 +236,7 @@ static struct rpc_clnt *rpc_get_client_for_event(struct net *net, int event) |
6293 | spin_lock(&sn->rpc_client_lock); |
6294 | list_for_each_entry(clnt, &sn->all_clients, cl_clients) { |
6295 | if (clnt->cl_program->pipe_dir_name == NULL) |
6296 | - break; |
6297 | + continue; |
6298 | if (rpc_clnt_skip_event(clnt, event)) |
6299 | continue; |
6300 | if (atomic_inc_not_zero(&clnt->cl_count) == 0) |
6301 | diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c |
6302 | index faa078f..b8bda44 100644 |
6303 | --- a/net/sunrpc/rpc_pipe.c |
6304 | +++ b/net/sunrpc/rpc_pipe.c |
6305 | @@ -1157,14 +1157,19 @@ static void rpc_kill_sb(struct super_block *sb) |
6306 | struct sunrpc_net *sn = net_generic(net, sunrpc_net_id); |
6307 | |
6308 | mutex_lock(&sn->pipefs_sb_lock); |
6309 | + if (sn->pipefs_sb != sb) { |
6310 | + mutex_unlock(&sn->pipefs_sb_lock); |
6311 | + goto out; |
6312 | + } |
6313 | sn->pipefs_sb = NULL; |
6314 | mutex_unlock(&sn->pipefs_sb_lock); |
6315 | - put_net(net); |
6316 | dprintk("RPC: sending pipefs UMOUNT notification for net %p%s\n", net, |
6317 | NET_NAME(net)); |
6318 | blocking_notifier_call_chain(&rpc_pipefs_notifier_list, |
6319 | RPC_PIPEFS_UMOUNT, |
6320 | sb); |
6321 | + put_net(net); |
6322 | +out: |
6323 | kill_litter_super(sb); |
6324 | } |
6325 | |
6326 | diff --git a/net/sunrpc/sched.c b/net/sunrpc/sched.c |
6327 | index eda32ae..85b9235 100644 |
6328 | --- a/net/sunrpc/sched.c |
6329 | +++ b/net/sunrpc/sched.c |
6330 | @@ -915,16 +915,35 @@ struct rpc_task *rpc_new_task(const struct rpc_task_setup *setup_data) |
6331 | return task; |
6332 | } |
6333 | |
6334 | +/* |
6335 | + * rpc_free_task - release rpc task and perform cleanups |
6336 | + * |
6337 | + * Note that we free up the rpc_task _after_ rpc_release_calldata() |
6338 | + * in order to work around a workqueue dependency issue. |
6339 | + * |
6340 | + * Tejun Heo states: |
6341 | + * "Workqueue currently considers two work items to be the same if they're |
6342 | + * on the same address and won't execute them concurrently - ie. it |
6343 | + * makes a work item which is queued again while being executed wait |
6344 | + * for the previous execution to complete. |
6345 | + * |
6346 | + * If a work function frees the work item, and then waits for an event |
6347 | + * which should be performed by another work item and *that* work item |
6348 | + * recycles the freed work item, it can create a false dependency loop. |
6349 | + * There really is no reliable way to detect this short of verifying |
6350 | + * every memory free." |
6351 | + * |
6352 | + */ |
6353 | static void rpc_free_task(struct rpc_task *task) |
6354 | { |
6355 | - const struct rpc_call_ops *tk_ops = task->tk_ops; |
6356 | - void *calldata = task->tk_calldata; |
6357 | + unsigned short tk_flags = task->tk_flags; |
6358 | + |
6359 | + rpc_release_calldata(task->tk_ops, task->tk_calldata); |
6360 | |
6361 | - if (task->tk_flags & RPC_TASK_DYNAMIC) { |
6362 | + if (tk_flags & RPC_TASK_DYNAMIC) { |
6363 | dprintk("RPC: %5u freeing task\n", task->tk_pid); |
6364 | mempool_free(task, rpc_task_mempool); |
6365 | } |
6366 | - rpc_release_calldata(tk_ops, calldata); |
6367 | } |
6368 | |
6369 | static void rpc_async_release(struct work_struct *work) |
6370 | @@ -934,8 +953,7 @@ static void rpc_async_release(struct work_struct *work) |
6371 | |
6372 | static void rpc_release_resources_task(struct rpc_task *task) |
6373 | { |
6374 | - if (task->tk_rqstp) |
6375 | - xprt_release(task); |
6376 | + xprt_release(task); |
6377 | if (task->tk_msg.rpc_cred) { |
6378 | put_rpccred(task->tk_msg.rpc_cred); |
6379 | task->tk_msg.rpc_cred = NULL; |
6380 | diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c |
6381 | index 176a24f..feea474 100644 |
6382 | --- a/net/sunrpc/xprt.c |
6383 | +++ b/net/sunrpc/xprt.c |
6384 | @@ -1139,10 +1139,18 @@ static void xprt_request_init(struct rpc_task *task, struct rpc_xprt *xprt) |
6385 | void xprt_release(struct rpc_task *task) |
6386 | { |
6387 | struct rpc_xprt *xprt; |
6388 | - struct rpc_rqst *req; |
6389 | + struct rpc_rqst *req = task->tk_rqstp; |
6390 | |
6391 | - if (!(req = task->tk_rqstp)) |
6392 | + if (req == NULL) { |
6393 | + if (task->tk_client) { |
6394 | + rcu_read_lock(); |
6395 | + xprt = rcu_dereference(task->tk_client->cl_xprt); |
6396 | + if (xprt->snd_task == task) |
6397 | + xprt_release_write(xprt, task); |
6398 | + rcu_read_unlock(); |
6399 | + } |
6400 | return; |
6401 | + } |
6402 | |
6403 | xprt = req->rq_xprt; |
6404 | if (task->tk_ops->rpc_count_stats != NULL) |
6405 | diff --git a/sound/arm/pxa2xx-ac97-lib.c b/sound/arm/pxa2xx-ac97-lib.c |
6406 | index 48d7c0a..bd3ba88 100644 |
6407 | --- a/sound/arm/pxa2xx-ac97-lib.c |
6408 | +++ b/sound/arm/pxa2xx-ac97-lib.c |
6409 | @@ -18,6 +18,7 @@ |
6410 | #include <linux/delay.h> |
6411 | #include <linux/module.h> |
6412 | #include <linux/io.h> |
6413 | +#include <linux/gpio.h> |
6414 | |
6415 | #include <sound/ac97_codec.h> |
6416 | #include <sound/pxa2xx-lib.h> |
6417 | @@ -148,6 +149,8 @@ static inline void pxa_ac97_warm_pxa27x(void) |
6418 | |
6419 | static inline void pxa_ac97_cold_pxa27x(void) |
6420 | { |
6421 | + unsigned int timeout; |
6422 | + |
6423 | GCR &= GCR_COLD_RST; /* clear everything but nCRST */ |
6424 | GCR &= ~GCR_COLD_RST; /* then assert nCRST */ |
6425 | |
6426 | @@ -157,8 +160,10 @@ static inline void pxa_ac97_cold_pxa27x(void) |
6427 | clk_enable(ac97conf_clk); |
6428 | udelay(5); |
6429 | clk_disable(ac97conf_clk); |
6430 | - GCR = GCR_COLD_RST; |
6431 | - udelay(50); |
6432 | + GCR = GCR_COLD_RST | GCR_WARM_RST; |
6433 | + timeout = 100; /* wait for the codec-ready bit to be set */ |
6434 | + while (!((GSR | gsr_bits) & (GSR_PCR | GSR_SCR)) && timeout--) |
6435 | + mdelay(1); |
6436 | } |
6437 | #endif |
6438 | |
6439 | @@ -340,8 +345,21 @@ int __devinit pxa2xx_ac97_hw_probe(struct platform_device *dev) |
6440 | } |
6441 | |
6442 | if (cpu_is_pxa27x()) { |
6443 | - /* Use GPIO 113 as AC97 Reset on Bulverde */ |
6444 | + /* |
6445 | + * This gpio is needed for a work-around to a bug in the ac97 |
6446 | + * controller during warm reset. The direction and level is set |
6447 | + * here so that it is an output driven high when switching from |
6448 | + * AC97_nRESET alt function to generic gpio. |
6449 | + */ |
6450 | + ret = gpio_request_one(reset_gpio, GPIOF_OUT_INIT_HIGH, |
6451 | + "pxa27x ac97 reset"); |
6452 | + if (ret < 0) { |
6453 | + pr_err("%s: gpio_request_one() failed: %d\n", |
6454 | + __func__, ret); |
6455 | + goto err_conf; |
6456 | + } |
6457 | pxa27x_assert_ac97reset(reset_gpio, 0); |
6458 | + |
6459 | ac97conf_clk = clk_get(&dev->dev, "AC97CONFCLK"); |
6460 | if (IS_ERR(ac97conf_clk)) { |
6461 | ret = PTR_ERR(ac97conf_clk); |
6462 | @@ -384,6 +402,8 @@ EXPORT_SYMBOL_GPL(pxa2xx_ac97_hw_probe); |
6463 | |
6464 | void pxa2xx_ac97_hw_remove(struct platform_device *dev) |
6465 | { |
6466 | + if (cpu_is_pxa27x()) |
6467 | + gpio_free(reset_gpio); |
6468 | GCR |= GCR_ACLINK_OFF; |
6469 | free_irq(IRQ_AC97, NULL); |
6470 | if (ac97conf_clk) { |
6471 | diff --git a/sound/soc/codecs/sigmadsp.c b/sound/soc/codecs/sigmadsp.c |
6472 | index 5be42bf..4068f24 100644 |
6473 | --- a/sound/soc/codecs/sigmadsp.c |
6474 | +++ b/sound/soc/codecs/sigmadsp.c |
6475 | @@ -225,7 +225,7 @@ EXPORT_SYMBOL(process_sigma_firmware); |
6476 | static int sigma_action_write_regmap(void *control_data, |
6477 | const struct sigma_action *sa, size_t len) |
6478 | { |
6479 | - return regmap_raw_write(control_data, le16_to_cpu(sa->addr), |
6480 | + return regmap_raw_write(control_data, be16_to_cpu(sa->addr), |
6481 | sa->payload, len - 2); |
6482 | } |
6483 | |
6484 | diff --git a/sound/soc/codecs/wm2000.c b/sound/soc/codecs/wm2000.c |
6485 | index ae6f26f..bb9f070 100644 |
6486 | --- a/sound/soc/codecs/wm2000.c |
6487 | +++ b/sound/soc/codecs/wm2000.c |
6488 | @@ -190,9 +190,9 @@ static int wm2000_power_up(struct i2c_client *i2c, int analogue) |
6489 | |
6490 | ret = wm2000_read(i2c, WM2000_REG_SPEECH_CLARITY); |
6491 | if (wm2000->speech_clarity) |
6492 | - ret &= ~WM2000_SPEECH_CLARITY; |
6493 | - else |
6494 | ret |= WM2000_SPEECH_CLARITY; |
6495 | + else |
6496 | + ret &= ~WM2000_SPEECH_CLARITY; |
6497 | wm2000_write(i2c, WM2000_REG_SPEECH_CLARITY, ret); |
6498 | |
6499 | wm2000_write(i2c, WM2000_REG_SYS_START0, 0x33); |
6500 | diff --git a/sound/soc/codecs/wm2200.c b/sound/soc/codecs/wm2200.c |
6501 | index c8bff6d..86b84a1 100644 |
6502 | --- a/sound/soc/codecs/wm2200.c |
6503 | +++ b/sound/soc/codecs/wm2200.c |
6504 | @@ -1380,15 +1380,9 @@ static int wm2200_set_fmt(struct snd_soc_dai *dai, unsigned int fmt) |
6505 | case SND_SOC_DAIFMT_DSP_A: |
6506 | fmt_val = 0; |
6507 | break; |
6508 | - case SND_SOC_DAIFMT_DSP_B: |
6509 | - fmt_val = 1; |
6510 | - break; |
6511 | case SND_SOC_DAIFMT_I2S: |
6512 | fmt_val = 2; |
6513 | break; |
6514 | - case SND_SOC_DAIFMT_LEFT_J: |
6515 | - fmt_val = 3; |
6516 | - break; |
6517 | default: |
6518 | dev_err(codec->dev, "Unsupported DAI format %d\n", |
6519 | fmt & SND_SOC_DAIFMT_FORMAT_MASK); |
6520 | @@ -1440,7 +1434,7 @@ static int wm2200_set_fmt(struct snd_soc_dai *dai, unsigned int fmt) |
6521 | WM2200_AIF1TX_LRCLK_MSTR | WM2200_AIF1TX_LRCLK_INV, |
6522 | lrclk); |
6523 | snd_soc_update_bits(codec, WM2200_AUDIO_IF_1_5, |
6524 | - WM2200_AIF1_FMT_MASK << 1, fmt_val << 1); |
6525 | + WM2200_AIF1_FMT_MASK, fmt_val); |
6526 | |
6527 | return 0; |
6528 | } |
6529 | diff --git a/sound/soc/codecs/wm5100.c b/sound/soc/codecs/wm5100.c |
6530 | index b9c185c..a8d03ab 100644 |
6531 | --- a/sound/soc/codecs/wm5100.c |
6532 | +++ b/sound/soc/codecs/wm5100.c |
6533 | @@ -1296,15 +1296,9 @@ static int wm5100_set_fmt(struct snd_soc_dai *dai, unsigned int fmt) |
6534 | case SND_SOC_DAIFMT_DSP_A: |
6535 | mask = 0; |
6536 | break; |
6537 | - case SND_SOC_DAIFMT_DSP_B: |
6538 | - mask = 1; |
6539 | - break; |
6540 | case SND_SOC_DAIFMT_I2S: |
6541 | mask = 2; |
6542 | break; |
6543 | - case SND_SOC_DAIFMT_LEFT_J: |
6544 | - mask = 3; |
6545 | - break; |
6546 | default: |
6547 | dev_err(codec->dev, "Unsupported DAI format %d\n", |
6548 | fmt & SND_SOC_DAIFMT_FORMAT_MASK); |
6549 | diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c |
6550 | index 9739b53..71b9036 100644 |
6551 | --- a/virt/kvm/kvm_main.c |
6552 | +++ b/virt/kvm/kvm_main.c |
6553 | @@ -693,8 +693,7 @@ int __kvm_set_memory_region(struct kvm *kvm, |
6554 | int r; |
6555 | gfn_t base_gfn; |
6556 | unsigned long npages; |
6557 | - unsigned long i; |
6558 | - struct kvm_memory_slot *memslot; |
6559 | + struct kvm_memory_slot *memslot, *slot; |
6560 | struct kvm_memory_slot old, new; |
6561 | struct kvm_memslots *slots, *old_memslots; |
6562 | |
6563 | @@ -741,13 +740,11 @@ int __kvm_set_memory_region(struct kvm *kvm, |
6564 | |
6565 | /* Check for overlaps */ |
6566 | r = -EEXIST; |
6567 | - for (i = 0; i < KVM_MEMORY_SLOTS; ++i) { |
6568 | - struct kvm_memory_slot *s = &kvm->memslots->memslots[i]; |
6569 | - |
6570 | - if (s == memslot || !s->npages) |
6571 | + kvm_for_each_memslot(slot, kvm->memslots) { |
6572 | + if (slot->id >= KVM_MEMORY_SLOTS || slot == memslot) |
6573 | continue; |
6574 | - if (!((base_gfn + npages <= s->base_gfn) || |
6575 | - (base_gfn >= s->base_gfn + s->npages))) |
6576 | + if (!((base_gfn + npages <= slot->base_gfn) || |
6577 | + (base_gfn >= slot->base_gfn + slot->npages))) |
6578 | goto out_free; |
6579 | } |
6580 |