diff options
author | Rafael J. Wysocki <rjw@sisk.pl> | 2009-08-16 05:50:10 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rjw@sisk.pl> | 2009-08-16 05:50:10 -0400 |
commit | 3e2bcad89814030ad6a369a97ad1481fd35938d3 (patch) | |
tree | 8d6b9b163dc9ed44ec377ca5b57be1a1fb80f923 | |
parent | dcbf77cac640af0ab944d5cbb07934bf6708b4d9 (diff) | |
parent | b2add73dbf93fd50f00564d7abc3e2b9aa9dd20c (diff) |
Merge branch 'master' into for-linus
167 files changed, 1643 insertions, 851 deletions
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt index dd1a6d4bb747..7936b801fe6a 100644 --- a/Documentation/kernel-parameters.txt +++ b/Documentation/kernel-parameters.txt | |||
@@ -1115,6 +1115,10 @@ and is between 256 and 4096 characters. It is defined in the file | |||
1115 | libata.dma=4 Compact Flash DMA only | 1115 | libata.dma=4 Compact Flash DMA only |
1116 | Combinations also work, so libata.dma=3 enables DMA | 1116 | Combinations also work, so libata.dma=3 enables DMA |
1117 | for disks and CDROMs, but not CFs. | 1117 | for disks and CDROMs, but not CFs. |
1118 | |||
1119 | libata.ignore_hpa= [LIBATA] Ignore HPA limit | ||
1120 | libata.ignore_hpa=0 keep BIOS limits (default) | ||
1121 | libata.ignore_hpa=1 ignore limits, using full disk | ||
1118 | 1122 | ||
1119 | libata.noacpi [LIBATA] Disables use of ACPI in libata suspend/resume | 1123 | libata.noacpi [LIBATA] Disables use of ACPI in libata suspend/resume |
1120 | when set. | 1124 | when set. |
diff --git a/Documentation/video4linux/CARDLIST.em28xx b/Documentation/video4linux/CARDLIST.em28xx index 68c236c01846..e352d754875c 100644 --- a/Documentation/video4linux/CARDLIST.em28xx +++ b/Documentation/video4linux/CARDLIST.em28xx | |||
@@ -1,5 +1,5 @@ | |||
1 | 0 -> Unknown EM2800 video grabber (em2800) [eb1a:2800] | 1 | 0 -> Unknown EM2800 video grabber (em2800) [eb1a:2800] |
2 | 1 -> Unknown EM2750/28xx video grabber (em2820/em2840) [eb1a:2820,eb1a:2821,eb1a:2860,eb1a:2861,eb1a:2870,eb1a:2881,eb1a:2883] | 2 | 1 -> Unknown EM2750/28xx video grabber (em2820/em2840) [eb1a:2710,eb1a:2820,eb1a:2821,eb1a:2860,eb1a:2861,eb1a:2870,eb1a:2881,eb1a:2883] |
3 | 2 -> Terratec Cinergy 250 USB (em2820/em2840) [0ccd:0036] | 3 | 2 -> Terratec Cinergy 250 USB (em2820/em2840) [0ccd:0036] |
4 | 3 -> Pinnacle PCTV USB 2 (em2820/em2840) [2304:0208] | 4 | 3 -> Pinnacle PCTV USB 2 (em2820/em2840) [2304:0208] |
5 | 4 -> Hauppauge WinTV USB 2 (em2820/em2840) [2040:4200,2040:4201] | 5 | 4 -> Hauppauge WinTV USB 2 (em2820/em2840) [2040:4200,2040:4201] |
diff --git a/Documentation/video4linux/CARDLIST.saa7134 b/Documentation/video4linux/CARDLIST.saa7134 index 15562427e8a9..c913e5614195 100644 --- a/Documentation/video4linux/CARDLIST.saa7134 +++ b/Documentation/video4linux/CARDLIST.saa7134 | |||
@@ -153,8 +153,8 @@ | |||
153 | 152 -> Asus Tiger Rev:1.00 [1043:4857] | 153 | 152 -> Asus Tiger Rev:1.00 [1043:4857] |
154 | 153 -> Kworld Plus TV Analog Lite PCI [17de:7128] | 154 | 153 -> Kworld Plus TV Analog Lite PCI [17de:7128] |
155 | 154 -> Avermedia AVerTV GO 007 FM Plus [1461:f31d] | 155 | 154 -> Avermedia AVerTV GO 007 FM Plus [1461:f31d] |
156 | 155 -> Hauppauge WinTV-HVR1120 ATSC/QAM-Hybrid [0070:6706,0070:6708] | 156 | 155 -> Hauppauge WinTV-HVR1150 ATSC/QAM-Hybrid [0070:6706,0070:6708] |
157 | 156 -> Hauppauge WinTV-HVR1110r3 DVB-T/Hybrid [0070:6707,0070:6709,0070:670a] | 157 | 156 -> Hauppauge WinTV-HVR1120 DVB-T/Hybrid [0070:6707,0070:6709,0070:670a] |
158 | 157 -> Avermedia AVerTV Studio 507UA [1461:a11b] | 158 | 157 -> Avermedia AVerTV Studio 507UA [1461:a11b] |
159 | 158 -> AVerMedia Cardbus TV/Radio (E501R) [1461:b7e9] | 159 | 158 -> AVerMedia Cardbus TV/Radio (E501R) [1461:b7e9] |
160 | 159 -> Beholder BeholdTV 505 RDS [0000:505B] | 160 | 159 -> Beholder BeholdTV 505 RDS [0000:505B] |
diff --git a/MAINTAINERS b/MAINTAINERS index b1114cfac6bf..2c4326c0de9a 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
@@ -2238,6 +2238,14 @@ T: git git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6.git | |||
2238 | S: Maintained | 2238 | S: Maintained |
2239 | F: drivers/media/video/gspca/pac207.c | 2239 | F: drivers/media/video/gspca/pac207.c |
2240 | 2240 | ||
2241 | GSPCA SN9C20X SUBDRIVER | ||
2242 | P: Brian Johnson | ||
2243 | M: brijohn@gmail.com | ||
2244 | L: linux-media@vger.kernel.org | ||
2245 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6.git | ||
2246 | S: Maintained | ||
2247 | F: drivers/media/video/gspca/sn9c20x.c | ||
2248 | |||
2241 | GSPCA T613 SUBDRIVER | 2249 | GSPCA T613 SUBDRIVER |
2242 | M: Leandro Costantino <lcostantino@gmail.com> | 2250 | M: Leandro Costantino <lcostantino@gmail.com> |
2243 | L: linux-media@vger.kernel.org | 2251 | L: linux-media@vger.kernel.org |
@@ -1,7 +1,7 @@ | |||
1 | VERSION = 2 | 1 | VERSION = 2 |
2 | PATCHLEVEL = 6 | 2 | PATCHLEVEL = 6 |
3 | SUBLEVEL = 31 | 3 | SUBLEVEL = 31 |
4 | EXTRAVERSION = -rc5 | 4 | EXTRAVERSION = -rc6 |
5 | NAME = Man-Eating Seals of Antiquity | 5 | NAME = Man-Eating Seals of Antiquity |
6 | 6 | ||
7 | # *DOCUMENTATION* | 7 | # *DOCUMENTATION* |
diff --git a/arch/ia64/Makefile b/arch/ia64/Makefile index 58a7e46affda..e7cbaa02cd0b 100644 --- a/arch/ia64/Makefile +++ b/arch/ia64/Makefile | |||
@@ -41,11 +41,6 @@ $(error Sorry, you need a newer version of the assember, one that is built from | |||
41 | ftp://ftp.hpl.hp.com/pub/linux-ia64/gas-030124.tar.gz) | 41 | ftp://ftp.hpl.hp.com/pub/linux-ia64/gas-030124.tar.gz) |
42 | endif | 42 | endif |
43 | 43 | ||
44 | ifeq ($(call cc-version),0304) | ||
45 | cflags-$(CONFIG_ITANIUM) += -mtune=merced | ||
46 | cflags-$(CONFIG_MCKINLEY) += -mtune=mckinley | ||
47 | endif | ||
48 | |||
49 | KBUILD_CFLAGS += $(cflags-y) | 44 | KBUILD_CFLAGS += $(cflags-y) |
50 | head-y := arch/ia64/kernel/head.o arch/ia64/kernel/init_task.o | 45 | head-y := arch/ia64/kernel/head.o arch/ia64/kernel/init_task.o |
51 | 46 | ||
diff --git a/arch/ia64/include/asm/bitops.h b/arch/ia64/include/asm/bitops.h index e2ca80037335..57a2787bc9fb 100644 --- a/arch/ia64/include/asm/bitops.h +++ b/arch/ia64/include/asm/bitops.h | |||
@@ -286,7 +286,7 @@ __test_and_clear_bit(int nr, volatile void * addr) | |||
286 | { | 286 | { |
287 | __u32 *p = (__u32 *) addr + (nr >> 5); | 287 | __u32 *p = (__u32 *) addr + (nr >> 5); |
288 | __u32 m = 1 << (nr & 31); | 288 | __u32 m = 1 << (nr & 31); |
289 | int oldbitset = *p & m; | 289 | int oldbitset = (*p & m) != 0; |
290 | 290 | ||
291 | *p &= ~m; | 291 | *p &= ~m; |
292 | return oldbitset; | 292 | return oldbitset; |
diff --git a/arch/ia64/include/asm/pgtable.h b/arch/ia64/include/asm/pgtable.h index 0a9cc73d35c7..8840a690d1e7 100644 --- a/arch/ia64/include/asm/pgtable.h +++ b/arch/ia64/include/asm/pgtable.h | |||
@@ -155,7 +155,6 @@ | |||
155 | #include <linux/bitops.h> | 155 | #include <linux/bitops.h> |
156 | #include <asm/cacheflush.h> | 156 | #include <asm/cacheflush.h> |
157 | #include <asm/mmu_context.h> | 157 | #include <asm/mmu_context.h> |
158 | #include <asm/processor.h> | ||
159 | 158 | ||
160 | /* | 159 | /* |
161 | * Next come the mappings that determine how mmap() protection bits | 160 | * Next come the mappings that determine how mmap() protection bits |
diff --git a/arch/ia64/kernel/ia64_ksyms.c b/arch/ia64/kernel/ia64_ksyms.c index 2d311864e359..8ebccb589e1c 100644 --- a/arch/ia64/kernel/ia64_ksyms.c +++ b/arch/ia64/kernel/ia64_ksyms.c | |||
@@ -21,6 +21,7 @@ EXPORT_SYMBOL(csum_ipv6_magic); | |||
21 | 21 | ||
22 | #include <asm/page.h> | 22 | #include <asm/page.h> |
23 | EXPORT_SYMBOL(clear_page); | 23 | EXPORT_SYMBOL(clear_page); |
24 | EXPORT_SYMBOL(copy_page); | ||
24 | 25 | ||
25 | #ifdef CONFIG_VIRTUAL_MEM_MAP | 26 | #ifdef CONFIG_VIRTUAL_MEM_MAP |
26 | #include <linux/bootmem.h> | 27 | #include <linux/bootmem.h> |
@@ -60,9 +61,6 @@ EXPORT_SYMBOL(__udivdi3); | |||
60 | EXPORT_SYMBOL(__moddi3); | 61 | EXPORT_SYMBOL(__moddi3); |
61 | EXPORT_SYMBOL(__umoddi3); | 62 | EXPORT_SYMBOL(__umoddi3); |
62 | 63 | ||
63 | #include <asm/page.h> | ||
64 | EXPORT_SYMBOL(copy_page); | ||
65 | |||
66 | #if defined(CONFIG_MD_RAID456) || defined(CONFIG_MD_RAID456_MODULE) | 64 | #if defined(CONFIG_MD_RAID456) || defined(CONFIG_MD_RAID456_MODULE) |
67 | extern void xor_ia64_2(void); | 65 | extern void xor_ia64_2(void); |
68 | extern void xor_ia64_3(void); | 66 | extern void xor_ia64_3(void); |
diff --git a/arch/ia64/kernel/iosapic.c b/arch/ia64/kernel/iosapic.c index c48b03f2b61d..dab4d393908c 100644 --- a/arch/ia64/kernel/iosapic.c +++ b/arch/ia64/kernel/iosapic.c | |||
@@ -1072,6 +1072,10 @@ iosapic_init (unsigned long phys_addr, unsigned int gsi_base) | |||
1072 | } | 1072 | } |
1073 | 1073 | ||
1074 | addr = ioremap(phys_addr, 0); | 1074 | addr = ioremap(phys_addr, 0); |
1075 | if (addr == NULL) { | ||
1076 | spin_unlock_irqrestore(&iosapic_lock, flags); | ||
1077 | return -ENOMEM; | ||
1078 | } | ||
1075 | ver = iosapic_version(addr); | 1079 | ver = iosapic_version(addr); |
1076 | if ((err = iosapic_check_gsi_range(gsi_base, ver))) { | 1080 | if ((err = iosapic_check_gsi_range(gsi_base, ver))) { |
1077 | iounmap(addr); | 1081 | iounmap(addr); |
diff --git a/arch/ia64/kernel/pci-dma.c b/arch/ia64/kernel/pci-dma.c index 05695962fe44..f6b1ff0aea76 100644 --- a/arch/ia64/kernel/pci-dma.c +++ b/arch/ia64/kernel/pci-dma.c | |||
@@ -69,11 +69,6 @@ iommu_dma_init(void) | |||
69 | 69 | ||
70 | int iommu_dma_supported(struct device *dev, u64 mask) | 70 | int iommu_dma_supported(struct device *dev, u64 mask) |
71 | { | 71 | { |
72 | struct dma_map_ops *ops = platform_dma_get_ops(dev); | ||
73 | |||
74 | if (ops->dma_supported) | ||
75 | return ops->dma_supported(dev, mask); | ||
76 | |||
77 | /* Copied from i386. Doesn't make much sense, because it will | 72 | /* Copied from i386. Doesn't make much sense, because it will |
78 | only work for pci_alloc_coherent. | 73 | only work for pci_alloc_coherent. |
79 | The caller just has to use GFP_DMA in this case. */ | 74 | The caller just has to use GFP_DMA in this case. */ |
diff --git a/arch/ia64/kernel/topology.c b/arch/ia64/kernel/topology.c index bc80dff1df7a..8f060352e129 100644 --- a/arch/ia64/kernel/topology.c +++ b/arch/ia64/kernel/topology.c | |||
@@ -372,6 +372,10 @@ static int __cpuinit cache_add_dev(struct sys_device * sys_dev) | |||
372 | retval = kobject_init_and_add(&all_cpu_cache_info[cpu].kobj, | 372 | retval = kobject_init_and_add(&all_cpu_cache_info[cpu].kobj, |
373 | &cache_ktype_percpu_entry, &sys_dev->kobj, | 373 | &cache_ktype_percpu_entry, &sys_dev->kobj, |
374 | "%s", "cache"); | 374 | "%s", "cache"); |
375 | if (unlikely(retval < 0)) { | ||
376 | cpu_cache_sysfs_exit(cpu); | ||
377 | return retval; | ||
378 | } | ||
375 | 379 | ||
376 | for (i = 0; i < all_cpu_cache_info[cpu].num_cache_leaves; i++) { | 380 | for (i = 0; i < all_cpu_cache_info[cpu].num_cache_leaves; i++) { |
377 | this_object = LEAF_KOBJECT_PTR(cpu,i); | 381 | this_object = LEAF_KOBJECT_PTR(cpu,i); |
@@ -385,7 +389,7 @@ static int __cpuinit cache_add_dev(struct sys_device * sys_dev) | |||
385 | } | 389 | } |
386 | kobject_put(&all_cpu_cache_info[cpu].kobj); | 390 | kobject_put(&all_cpu_cache_info[cpu].kobj); |
387 | cpu_cache_sysfs_exit(cpu); | 391 | cpu_cache_sysfs_exit(cpu); |
388 | break; | 392 | return retval; |
389 | } | 393 | } |
390 | kobject_uevent(&(this_object->kobj), KOBJ_ADD); | 394 | kobject_uevent(&(this_object->kobj), KOBJ_ADD); |
391 | } | 395 | } |
diff --git a/arch/sh/boards/board-ap325rxa.c b/arch/sh/boards/board-ap325rxa.c index 7ffd1b4315bd..b9c88cc519e2 100644 --- a/arch/sh/boards/board-ap325rxa.c +++ b/arch/sh/boards/board-ap325rxa.c | |||
@@ -547,7 +547,7 @@ static int __init ap325rxa_devices_setup(void) | |||
547 | return platform_add_devices(ap325rxa_devices, | 547 | return platform_add_devices(ap325rxa_devices, |
548 | ARRAY_SIZE(ap325rxa_devices)); | 548 | ARRAY_SIZE(ap325rxa_devices)); |
549 | } | 549 | } |
550 | device_initcall(ap325rxa_devices_setup); | 550 | arch_initcall(ap325rxa_devices_setup); |
551 | 551 | ||
552 | /* Return the board specific boot mode pin configuration */ | 552 | /* Return the board specific boot mode pin configuration */ |
553 | static int ap325rxa_mode_pins(void) | 553 | static int ap325rxa_mode_pins(void) |
diff --git a/arch/sh/boards/mach-migor/setup.c b/arch/sh/boards/mach-migor/setup.c index f70f4644deb4..f9b2e4df35b9 100644 --- a/arch/sh/boards/mach-migor/setup.c +++ b/arch/sh/boards/mach-migor/setup.c | |||
@@ -608,7 +608,7 @@ static int __init migor_devices_setup(void) | |||
608 | 608 | ||
609 | return platform_add_devices(migor_devices, ARRAY_SIZE(migor_devices)); | 609 | return platform_add_devices(migor_devices, ARRAY_SIZE(migor_devices)); |
610 | } | 610 | } |
611 | __initcall(migor_devices_setup); | 611 | arch_initcall(migor_devices_setup); |
612 | 612 | ||
613 | /* Return the board specific boot mode pin configuration */ | 613 | /* Return the board specific boot mode pin configuration */ |
614 | static int migor_mode_pins(void) | 614 | static int migor_mode_pins(void) |
diff --git a/arch/sh/kernel/cpu/sh2/setup-sh7619.c b/arch/sh/kernel/cpu/sh2/setup-sh7619.c index 13798733f2db..8555c05e8667 100644 --- a/arch/sh/kernel/cpu/sh2/setup-sh7619.c +++ b/arch/sh/kernel/cpu/sh2/setup-sh7619.c | |||
@@ -187,7 +187,7 @@ static int __init sh7619_devices_setup(void) | |||
187 | return platform_add_devices(sh7619_devices, | 187 | return platform_add_devices(sh7619_devices, |
188 | ARRAY_SIZE(sh7619_devices)); | 188 | ARRAY_SIZE(sh7619_devices)); |
189 | } | 189 | } |
190 | __initcall(sh7619_devices_setup); | 190 | arch_initcall(sh7619_devices_setup); |
191 | 191 | ||
192 | void __init plat_irq_setup(void) | 192 | void __init plat_irq_setup(void) |
193 | { | 193 | { |
diff --git a/arch/sh/kernel/cpu/sh2a/setup-mxg.c b/arch/sh/kernel/cpu/sh2a/setup-mxg.c index 869c2da4820b..b67376445315 100644 --- a/arch/sh/kernel/cpu/sh2a/setup-mxg.c +++ b/arch/sh/kernel/cpu/sh2a/setup-mxg.c | |||
@@ -238,7 +238,7 @@ static int __init mxg_devices_setup(void) | |||
238 | return platform_add_devices(mxg_devices, | 238 | return platform_add_devices(mxg_devices, |
239 | ARRAY_SIZE(mxg_devices)); | 239 | ARRAY_SIZE(mxg_devices)); |
240 | } | 240 | } |
241 | __initcall(mxg_devices_setup); | 241 | arch_initcall(mxg_devices_setup); |
242 | 242 | ||
243 | void __init plat_irq_setup(void) | 243 | void __init plat_irq_setup(void) |
244 | { | 244 | { |
diff --git a/arch/sh/kernel/cpu/sh2a/setup-sh7201.c b/arch/sh/kernel/cpu/sh2a/setup-sh7201.c index d8febe128066..fbde5b75deb9 100644 --- a/arch/sh/kernel/cpu/sh2a/setup-sh7201.c +++ b/arch/sh/kernel/cpu/sh2a/setup-sh7201.c | |||
@@ -357,7 +357,7 @@ static int __init sh7201_devices_setup(void) | |||
357 | return platform_add_devices(sh7201_devices, | 357 | return platform_add_devices(sh7201_devices, |
358 | ARRAY_SIZE(sh7201_devices)); | 358 | ARRAY_SIZE(sh7201_devices)); |
359 | } | 359 | } |
360 | __initcall(sh7201_devices_setup); | 360 | arch_initcall(sh7201_devices_setup); |
361 | 361 | ||
362 | void __init plat_irq_setup(void) | 362 | void __init plat_irq_setup(void) |
363 | { | 363 | { |
diff --git a/arch/sh/kernel/cpu/sh2a/setup-sh7203.c b/arch/sh/kernel/cpu/sh2a/setup-sh7203.c index 62e3039d2398..d3fd536c9a84 100644 --- a/arch/sh/kernel/cpu/sh2a/setup-sh7203.c +++ b/arch/sh/kernel/cpu/sh2a/setup-sh7203.c | |||
@@ -367,7 +367,7 @@ static int __init sh7203_devices_setup(void) | |||
367 | return platform_add_devices(sh7203_devices, | 367 | return platform_add_devices(sh7203_devices, |
368 | ARRAY_SIZE(sh7203_devices)); | 368 | ARRAY_SIZE(sh7203_devices)); |
369 | } | 369 | } |
370 | __initcall(sh7203_devices_setup); | 370 | arch_initcall(sh7203_devices_setup); |
371 | 371 | ||
372 | void __init plat_irq_setup(void) | 372 | void __init plat_irq_setup(void) |
373 | { | 373 | { |
diff --git a/arch/sh/kernel/cpu/sh2a/setup-sh7206.c b/arch/sh/kernel/cpu/sh2a/setup-sh7206.c index 3e6f3d7a58be..a9ccc5e8d9e9 100644 --- a/arch/sh/kernel/cpu/sh2a/setup-sh7206.c +++ b/arch/sh/kernel/cpu/sh2a/setup-sh7206.c | |||
@@ -338,7 +338,7 @@ static int __init sh7206_devices_setup(void) | |||
338 | return platform_add_devices(sh7206_devices, | 338 | return platform_add_devices(sh7206_devices, |
339 | ARRAY_SIZE(sh7206_devices)); | 339 | ARRAY_SIZE(sh7206_devices)); |
340 | } | 340 | } |
341 | __initcall(sh7206_devices_setup); | 341 | arch_initcall(sh7206_devices_setup); |
342 | 342 | ||
343 | void __init plat_irq_setup(void) | 343 | void __init plat_irq_setup(void) |
344 | { | 344 | { |
diff --git a/arch/sh/kernel/cpu/sh3/setup-sh7705.c b/arch/sh/kernel/cpu/sh3/setup-sh7705.c index 88f742fed9ed..c23105983878 100644 --- a/arch/sh/kernel/cpu/sh3/setup-sh7705.c +++ b/arch/sh/kernel/cpu/sh3/setup-sh7705.c | |||
@@ -222,7 +222,7 @@ static int __init sh7705_devices_setup(void) | |||
222 | return platform_add_devices(sh7705_devices, | 222 | return platform_add_devices(sh7705_devices, |
223 | ARRAY_SIZE(sh7705_devices)); | 223 | ARRAY_SIZE(sh7705_devices)); |
224 | } | 224 | } |
225 | __initcall(sh7705_devices_setup); | 225 | arch_initcall(sh7705_devices_setup); |
226 | 226 | ||
227 | static struct platform_device *sh7705_early_devices[] __initdata = { | 227 | static struct platform_device *sh7705_early_devices[] __initdata = { |
228 | &tmu0_device, | 228 | &tmu0_device, |
diff --git a/arch/sh/kernel/cpu/sh3/setup-sh770x.c b/arch/sh/kernel/cpu/sh3/setup-sh770x.c index c56306798584..347ab35d0697 100644 --- a/arch/sh/kernel/cpu/sh3/setup-sh770x.c +++ b/arch/sh/kernel/cpu/sh3/setup-sh770x.c | |||
@@ -250,7 +250,7 @@ static int __init sh770x_devices_setup(void) | |||
250 | return platform_add_devices(sh770x_devices, | 250 | return platform_add_devices(sh770x_devices, |
251 | ARRAY_SIZE(sh770x_devices)); | 251 | ARRAY_SIZE(sh770x_devices)); |
252 | } | 252 | } |
253 | __initcall(sh770x_devices_setup); | 253 | arch_initcall(sh770x_devices_setup); |
254 | 254 | ||
255 | static struct platform_device *sh770x_early_devices[] __initdata = { | 255 | static struct platform_device *sh770x_early_devices[] __initdata = { |
256 | &tmu0_device, | 256 | &tmu0_device, |
diff --git a/arch/sh/kernel/cpu/sh3/setup-sh7710.c b/arch/sh/kernel/cpu/sh3/setup-sh7710.c index efa76c8148f4..717e90ae1097 100644 --- a/arch/sh/kernel/cpu/sh3/setup-sh7710.c +++ b/arch/sh/kernel/cpu/sh3/setup-sh7710.c | |||
@@ -226,7 +226,7 @@ static int __init sh7710_devices_setup(void) | |||
226 | return platform_add_devices(sh7710_devices, | 226 | return platform_add_devices(sh7710_devices, |
227 | ARRAY_SIZE(sh7710_devices)); | 227 | ARRAY_SIZE(sh7710_devices)); |
228 | } | 228 | } |
229 | __initcall(sh7710_devices_setup); | 229 | arch_initcall(sh7710_devices_setup); |
230 | 230 | ||
231 | static struct platform_device *sh7710_early_devices[] __initdata = { | 231 | static struct platform_device *sh7710_early_devices[] __initdata = { |
232 | &tmu0_device, | 232 | &tmu0_device, |
diff --git a/arch/sh/kernel/cpu/sh3/setup-sh7720.c b/arch/sh/kernel/cpu/sh3/setup-sh7720.c index 5b2107798edb..74d8baaf8e96 100644 --- a/arch/sh/kernel/cpu/sh3/setup-sh7720.c +++ b/arch/sh/kernel/cpu/sh3/setup-sh7720.c | |||
@@ -388,7 +388,7 @@ static int __init sh7720_devices_setup(void) | |||
388 | return platform_add_devices(sh7720_devices, | 388 | return platform_add_devices(sh7720_devices, |
389 | ARRAY_SIZE(sh7720_devices)); | 389 | ARRAY_SIZE(sh7720_devices)); |
390 | } | 390 | } |
391 | __initcall(sh7720_devices_setup); | 391 | arch_initcall(sh7720_devices_setup); |
392 | 392 | ||
393 | static struct platform_device *sh7720_early_devices[] __initdata = { | 393 | static struct platform_device *sh7720_early_devices[] __initdata = { |
394 | &cmt0_device, | 394 | &cmt0_device, |
diff --git a/arch/sh/kernel/cpu/sh4/setup-sh4-202.c b/arch/sh/kernel/cpu/sh4/setup-sh4-202.c index 6d088d123591..de4827df19aa 100644 --- a/arch/sh/kernel/cpu/sh4/setup-sh4-202.c +++ b/arch/sh/kernel/cpu/sh4/setup-sh4-202.c | |||
@@ -138,7 +138,7 @@ static int __init sh4202_devices_setup(void) | |||
138 | return platform_add_devices(sh4202_devices, | 138 | return platform_add_devices(sh4202_devices, |
139 | ARRAY_SIZE(sh4202_devices)); | 139 | ARRAY_SIZE(sh4202_devices)); |
140 | } | 140 | } |
141 | __initcall(sh4202_devices_setup); | 141 | arch_initcall(sh4202_devices_setup); |
142 | 142 | ||
143 | static struct platform_device *sh4202_early_devices[] __initdata = { | 143 | static struct platform_device *sh4202_early_devices[] __initdata = { |
144 | &tmu0_device, | 144 | &tmu0_device, |
diff --git a/arch/sh/kernel/cpu/sh4/setup-sh7750.c b/arch/sh/kernel/cpu/sh4/setup-sh7750.c index 851672d15cf4..1b8b122e8f3d 100644 --- a/arch/sh/kernel/cpu/sh4/setup-sh7750.c +++ b/arch/sh/kernel/cpu/sh4/setup-sh7750.c | |||
@@ -239,7 +239,7 @@ static int __init sh7750_devices_setup(void) | |||
239 | return platform_add_devices(sh7750_devices, | 239 | return platform_add_devices(sh7750_devices, |
240 | ARRAY_SIZE(sh7750_devices)); | 240 | ARRAY_SIZE(sh7750_devices)); |
241 | } | 241 | } |
242 | __initcall(sh7750_devices_setup); | 242 | arch_initcall(sh7750_devices_setup); |
243 | 243 | ||
244 | static struct platform_device *sh7750_early_devices[] __initdata = { | 244 | static struct platform_device *sh7750_early_devices[] __initdata = { |
245 | &tmu0_device, | 245 | &tmu0_device, |
diff --git a/arch/sh/kernel/cpu/sh4/setup-sh7760.c b/arch/sh/kernel/cpu/sh4/setup-sh7760.c index 5b822519bd90..7fbb7be9284c 100644 --- a/arch/sh/kernel/cpu/sh4/setup-sh7760.c +++ b/arch/sh/kernel/cpu/sh4/setup-sh7760.c | |||
@@ -265,7 +265,7 @@ static int __init sh7760_devices_setup(void) | |||
265 | return platform_add_devices(sh7760_devices, | 265 | return platform_add_devices(sh7760_devices, |
266 | ARRAY_SIZE(sh7760_devices)); | 266 | ARRAY_SIZE(sh7760_devices)); |
267 | } | 267 | } |
268 | __initcall(sh7760_devices_setup); | 268 | arch_initcall(sh7760_devices_setup); |
269 | 269 | ||
270 | static struct platform_device *sh7760_early_devices[] __initdata = { | 270 | static struct platform_device *sh7760_early_devices[] __initdata = { |
271 | &tmu0_device, | 271 | &tmu0_device, |
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7343.c b/arch/sh/kernel/cpu/sh4a/setup-sh7343.c index 6307e087c864..ac4d5672ec1a 100644 --- a/arch/sh/kernel/cpu/sh4a/setup-sh7343.c +++ b/arch/sh/kernel/cpu/sh4a/setup-sh7343.c | |||
@@ -325,7 +325,7 @@ static int __init sh7343_devices_setup(void) | |||
325 | return platform_add_devices(sh7343_devices, | 325 | return platform_add_devices(sh7343_devices, |
326 | ARRAY_SIZE(sh7343_devices)); | 326 | ARRAY_SIZE(sh7343_devices)); |
327 | } | 327 | } |
328 | __initcall(sh7343_devices_setup); | 328 | arch_initcall(sh7343_devices_setup); |
329 | 329 | ||
330 | static struct platform_device *sh7343_early_devices[] __initdata = { | 330 | static struct platform_device *sh7343_early_devices[] __initdata = { |
331 | &cmt_device, | 331 | &cmt_device, |
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7366.c b/arch/sh/kernel/cpu/sh4a/setup-sh7366.c index c18f7d09281b..1a956b1beccc 100644 --- a/arch/sh/kernel/cpu/sh4a/setup-sh7366.c +++ b/arch/sh/kernel/cpu/sh4a/setup-sh7366.c | |||
@@ -318,7 +318,7 @@ static int __init sh7366_devices_setup(void) | |||
318 | return platform_add_devices(sh7366_devices, | 318 | return platform_add_devices(sh7366_devices, |
319 | ARRAY_SIZE(sh7366_devices)); | 319 | ARRAY_SIZE(sh7366_devices)); |
320 | } | 320 | } |
321 | __initcall(sh7366_devices_setup); | 321 | arch_initcall(sh7366_devices_setup); |
322 | 322 | ||
323 | static struct platform_device *sh7366_early_devices[] __initdata = { | 323 | static struct platform_device *sh7366_early_devices[] __initdata = { |
324 | &cmt_device, | 324 | &cmt_device, |
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7722.c b/arch/sh/kernel/cpu/sh4a/setup-sh7722.c index ea524a2da3e4..cda76ebf87c3 100644 --- a/arch/sh/kernel/cpu/sh4a/setup-sh7722.c +++ b/arch/sh/kernel/cpu/sh4a/setup-sh7722.c | |||
@@ -359,7 +359,7 @@ static int __init sh7722_devices_setup(void) | |||
359 | return platform_add_devices(sh7722_devices, | 359 | return platform_add_devices(sh7722_devices, |
360 | ARRAY_SIZE(sh7722_devices)); | 360 | ARRAY_SIZE(sh7722_devices)); |
361 | } | 361 | } |
362 | __initcall(sh7722_devices_setup); | 362 | arch_initcall(sh7722_devices_setup); |
363 | 363 | ||
364 | static struct platform_device *sh7722_early_devices[] __initdata = { | 364 | static struct platform_device *sh7722_early_devices[] __initdata = { |
365 | &cmt_device, | 365 | &cmt_device, |
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7723.c b/arch/sh/kernel/cpu/sh4a/setup-sh7723.c index e1bb80b2a27b..b45dace9539f 100644 --- a/arch/sh/kernel/cpu/sh4a/setup-sh7723.c +++ b/arch/sh/kernel/cpu/sh4a/setup-sh7723.c | |||
@@ -473,7 +473,7 @@ static int __init sh7723_devices_setup(void) | |||
473 | return platform_add_devices(sh7723_devices, | 473 | return platform_add_devices(sh7723_devices, |
474 | ARRAY_SIZE(sh7723_devices)); | 474 | ARRAY_SIZE(sh7723_devices)); |
475 | } | 475 | } |
476 | __initcall(sh7723_devices_setup); | 476 | arch_initcall(sh7723_devices_setup); |
477 | 477 | ||
478 | static struct platform_device *sh7723_early_devices[] __initdata = { | 478 | static struct platform_device *sh7723_early_devices[] __initdata = { |
479 | &cmt_device, | 479 | &cmt_device, |
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7724.c b/arch/sh/kernel/cpu/sh4a/setup-sh7724.c index e5ac9eb11c63..a04edaab9a29 100644 --- a/arch/sh/kernel/cpu/sh4a/setup-sh7724.c +++ b/arch/sh/kernel/cpu/sh4a/setup-sh7724.c | |||
@@ -508,7 +508,7 @@ static int __init sh7724_devices_setup(void) | |||
508 | return platform_add_devices(sh7724_devices, | 508 | return platform_add_devices(sh7724_devices, |
509 | ARRAY_SIZE(sh7724_devices)); | 509 | ARRAY_SIZE(sh7724_devices)); |
510 | } | 510 | } |
511 | device_initcall(sh7724_devices_setup); | 511 | arch_initcall(sh7724_devices_setup); |
512 | 512 | ||
513 | static struct platform_device *sh7724_early_devices[] __initdata = { | 513 | static struct platform_device *sh7724_early_devices[] __initdata = { |
514 | &cmt_device, | 514 | &cmt_device, |
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7763.c b/arch/sh/kernel/cpu/sh4a/setup-sh7763.c index f1e0c0d36da7..4659fff6b842 100644 --- a/arch/sh/kernel/cpu/sh4a/setup-sh7763.c +++ b/arch/sh/kernel/cpu/sh4a/setup-sh7763.c | |||
@@ -314,7 +314,7 @@ static int __init sh7763_devices_setup(void) | |||
314 | return platform_add_devices(sh7763_devices, | 314 | return platform_add_devices(sh7763_devices, |
315 | ARRAY_SIZE(sh7763_devices)); | 315 | ARRAY_SIZE(sh7763_devices)); |
316 | } | 316 | } |
317 | __initcall(sh7763_devices_setup); | 317 | arch_initcall(sh7763_devices_setup); |
318 | 318 | ||
319 | static struct platform_device *sh7763_early_devices[] __initdata = { | 319 | static struct platform_device *sh7763_early_devices[] __initdata = { |
320 | &tmu0_device, | 320 | &tmu0_device, |
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7770.c b/arch/sh/kernel/cpu/sh4a/setup-sh7770.c index 1e86209db284..eead08d89d32 100644 --- a/arch/sh/kernel/cpu/sh4a/setup-sh7770.c +++ b/arch/sh/kernel/cpu/sh4a/setup-sh7770.c | |||
@@ -368,7 +368,7 @@ static int __init sh7770_devices_setup(void) | |||
368 | return platform_add_devices(sh7770_devices, | 368 | return platform_add_devices(sh7770_devices, |
369 | ARRAY_SIZE(sh7770_devices)); | 369 | ARRAY_SIZE(sh7770_devices)); |
370 | } | 370 | } |
371 | __initcall(sh7770_devices_setup); | 371 | arch_initcall(sh7770_devices_setup); |
372 | 372 | ||
373 | static struct platform_device *sh7770_early_devices[] __initdata = { | 373 | static struct platform_device *sh7770_early_devices[] __initdata = { |
374 | &tmu0_device, | 374 | &tmu0_device, |
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7780.c b/arch/sh/kernel/cpu/sh4a/setup-sh7780.c index 715e05b431e5..2c901f446959 100644 --- a/arch/sh/kernel/cpu/sh4a/setup-sh7780.c +++ b/arch/sh/kernel/cpu/sh4a/setup-sh7780.c | |||
@@ -256,7 +256,7 @@ static int __init sh7780_devices_setup(void) | |||
256 | return platform_add_devices(sh7780_devices, | 256 | return platform_add_devices(sh7780_devices, |
257 | ARRAY_SIZE(sh7780_devices)); | 257 | ARRAY_SIZE(sh7780_devices)); |
258 | } | 258 | } |
259 | __initcall(sh7780_devices_setup); | 259 | arch_initcall(sh7780_devices_setup); |
260 | 260 | ||
261 | static struct platform_device *sh7780_early_devices[] __initdata = { | 261 | static struct platform_device *sh7780_early_devices[] __initdata = { |
262 | &tmu0_device, | 262 | &tmu0_device, |
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7785.c b/arch/sh/kernel/cpu/sh4a/setup-sh7785.c index af561402570b..7f6c718b6c36 100644 --- a/arch/sh/kernel/cpu/sh4a/setup-sh7785.c +++ b/arch/sh/kernel/cpu/sh4a/setup-sh7785.c | |||
@@ -263,7 +263,7 @@ static int __init sh7785_devices_setup(void) | |||
263 | return platform_add_devices(sh7785_devices, | 263 | return platform_add_devices(sh7785_devices, |
264 | ARRAY_SIZE(sh7785_devices)); | 264 | ARRAY_SIZE(sh7785_devices)); |
265 | } | 265 | } |
266 | __initcall(sh7785_devices_setup); | 266 | arch_initcall(sh7785_devices_setup); |
267 | 267 | ||
268 | static struct platform_device *sh7785_early_devices[] __initdata = { | 268 | static struct platform_device *sh7785_early_devices[] __initdata = { |
269 | &tmu0_device, | 269 | &tmu0_device, |
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7786.c b/arch/sh/kernel/cpu/sh4a/setup-sh7786.c index b70049470a0b..0104a8ec5369 100644 --- a/arch/sh/kernel/cpu/sh4a/setup-sh7786.c +++ b/arch/sh/kernel/cpu/sh4a/setup-sh7786.c | |||
@@ -547,7 +547,7 @@ static int __init sh7786_devices_setup(void) | |||
547 | return platform_add_devices(sh7786_devices, | 547 | return platform_add_devices(sh7786_devices, |
548 | ARRAY_SIZE(sh7786_devices)); | 548 | ARRAY_SIZE(sh7786_devices)); |
549 | } | 549 | } |
550 | device_initcall(sh7786_devices_setup); | 550 | arch_initcall(sh7786_devices_setup); |
551 | 551 | ||
552 | void __init plat_early_device_setup(void) | 552 | void __init plat_early_device_setup(void) |
553 | { | 553 | { |
diff --git a/arch/sh/kernel/cpu/sh4a/setup-shx3.c b/arch/sh/kernel/cpu/sh4a/setup-shx3.c index 53c65fd9ccef..07f078961c71 100644 --- a/arch/sh/kernel/cpu/sh4a/setup-shx3.c +++ b/arch/sh/kernel/cpu/sh4a/setup-shx3.c | |||
@@ -256,7 +256,7 @@ static int __init shx3_devices_setup(void) | |||
256 | return platform_add_devices(shx3_devices, | 256 | return platform_add_devices(shx3_devices, |
257 | ARRAY_SIZE(shx3_devices)); | 257 | ARRAY_SIZE(shx3_devices)); |
258 | } | 258 | } |
259 | __initcall(shx3_devices_setup); | 259 | arch_initcall(shx3_devices_setup); |
260 | 260 | ||
261 | void __init plat_early_device_setup(void) | 261 | void __init plat_early_device_setup(void) |
262 | { | 262 | { |
diff --git a/arch/sh/kernel/cpu/sh5/setup-sh5.c b/arch/sh/kernel/cpu/sh5/setup-sh5.c index f5ff1ac57fc2..6a0f82f70032 100644 --- a/arch/sh/kernel/cpu/sh5/setup-sh5.c +++ b/arch/sh/kernel/cpu/sh5/setup-sh5.c | |||
@@ -186,7 +186,7 @@ static int __init sh5_devices_setup(void) | |||
186 | return platform_add_devices(sh5_devices, | 186 | return platform_add_devices(sh5_devices, |
187 | ARRAY_SIZE(sh5_devices)); | 187 | ARRAY_SIZE(sh5_devices)); |
188 | } | 188 | } |
189 | __initcall(sh5_devices_setup); | 189 | arch_initcall(sh5_devices_setup); |
190 | 190 | ||
191 | void __init plat_early_device_setup(void) | 191 | void __init plat_early_device_setup(void) |
192 | { | 192 | { |
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 738bdc6b0f8b..13ffa5df37d7 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig | |||
@@ -24,6 +24,7 @@ config X86 | |||
24 | select HAVE_UNSTABLE_SCHED_CLOCK | 24 | select HAVE_UNSTABLE_SCHED_CLOCK |
25 | select HAVE_IDE | 25 | select HAVE_IDE |
26 | select HAVE_OPROFILE | 26 | select HAVE_OPROFILE |
27 | select HAVE_PERF_COUNTERS if (!M386 && !M486) | ||
27 | select HAVE_IOREMAP_PROT | 28 | select HAVE_IOREMAP_PROT |
28 | select HAVE_KPROBES | 29 | select HAVE_KPROBES |
29 | select ARCH_WANT_OPTIONAL_GPIOLIB | 30 | select ARCH_WANT_OPTIONAL_GPIOLIB |
@@ -742,7 +743,6 @@ config X86_UP_IOAPIC | |||
742 | config X86_LOCAL_APIC | 743 | config X86_LOCAL_APIC |
743 | def_bool y | 744 | def_bool y |
744 | depends on X86_64 || SMP || X86_32_NON_STANDARD || X86_UP_APIC | 745 | depends on X86_64 || SMP || X86_32_NON_STANDARD || X86_UP_APIC |
745 | select HAVE_PERF_COUNTERS if (!M386 && !M486) | ||
746 | 746 | ||
747 | config X86_IO_APIC | 747 | config X86_IO_APIC |
748 | def_bool y | 748 | def_bool y |
diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c index e2485b03f1cf..63fddcd082cd 100644 --- a/arch/x86/kernel/cpu/amd.c +++ b/arch/x86/kernel/cpu/amd.c | |||
@@ -400,6 +400,13 @@ static void __cpuinit init_amd(struct cpuinfo_x86 *c) | |||
400 | level = cpuid_eax(1); | 400 | level = cpuid_eax(1); |
401 | if((level >= 0x0f48 && level < 0x0f50) || level >= 0x0f58) | 401 | if((level >= 0x0f48 && level < 0x0f50) || level >= 0x0f58) |
402 | set_cpu_cap(c, X86_FEATURE_REP_GOOD); | 402 | set_cpu_cap(c, X86_FEATURE_REP_GOOD); |
403 | |||
404 | /* | ||
405 | * Some BIOSes incorrectly force this feature, but only K8 | ||
406 | * revision D (model = 0x14) and later actually support it. | ||
407 | */ | ||
408 | if (c->x86_model < 0x14) | ||
409 | clear_cpu_cap(c, X86_FEATURE_LAHF_LM); | ||
403 | } | 410 | } |
404 | if (c->x86 == 0x10 || c->x86 == 0x11) | 411 | if (c->x86 == 0x10 || c->x86 == 0x11) |
405 | set_cpu_cap(c, X86_FEATURE_REP_GOOD); | 412 | set_cpu_cap(c, X86_FEATURE_REP_GOOD); |
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c index f1961c07af9a..5ce60a88027b 100644 --- a/arch/x86/kernel/cpu/common.c +++ b/arch/x86/kernel/cpu/common.c | |||
@@ -59,7 +59,30 @@ void __init setup_cpu_local_masks(void) | |||
59 | alloc_bootmem_cpumask_var(&cpu_sibling_setup_mask); | 59 | alloc_bootmem_cpumask_var(&cpu_sibling_setup_mask); |
60 | } | 60 | } |
61 | 61 | ||
62 | static const struct cpu_dev *this_cpu __cpuinitdata; | 62 | static void __cpuinit default_init(struct cpuinfo_x86 *c) |
63 | { | ||
64 | #ifdef CONFIG_X86_64 | ||
65 | display_cacheinfo(c); | ||
66 | #else | ||
67 | /* Not much we can do here... */ | ||
68 | /* Check if at least it has cpuid */ | ||
69 | if (c->cpuid_level == -1) { | ||
70 | /* No cpuid. It must be an ancient CPU */ | ||
71 | if (c->x86 == 4) | ||
72 | strcpy(c->x86_model_id, "486"); | ||
73 | else if (c->x86 == 3) | ||
74 | strcpy(c->x86_model_id, "386"); | ||
75 | } | ||
76 | #endif | ||
77 | } | ||
78 | |||
79 | static const struct cpu_dev __cpuinitconst default_cpu = { | ||
80 | .c_init = default_init, | ||
81 | .c_vendor = "Unknown", | ||
82 | .c_x86_vendor = X86_VENDOR_UNKNOWN, | ||
83 | }; | ||
84 | |||
85 | static const struct cpu_dev *this_cpu __cpuinitdata = &default_cpu; | ||
63 | 86 | ||
64 | DEFINE_PER_CPU_PAGE_ALIGNED(struct gdt_page, gdt_page) = { .gdt = { | 87 | DEFINE_PER_CPU_PAGE_ALIGNED(struct gdt_page, gdt_page) = { .gdt = { |
65 | #ifdef CONFIG_X86_64 | 88 | #ifdef CONFIG_X86_64 |
@@ -332,29 +355,6 @@ void switch_to_new_gdt(int cpu) | |||
332 | 355 | ||
333 | static const struct cpu_dev *__cpuinitdata cpu_devs[X86_VENDOR_NUM] = {}; | 356 | static const struct cpu_dev *__cpuinitdata cpu_devs[X86_VENDOR_NUM] = {}; |
334 | 357 | ||
335 | static void __cpuinit default_init(struct cpuinfo_x86 *c) | ||
336 | { | ||
337 | #ifdef CONFIG_X86_64 | ||
338 | display_cacheinfo(c); | ||
339 | #else | ||
340 | /* Not much we can do here... */ | ||
341 | /* Check if at least it has cpuid */ | ||
342 | if (c->cpuid_level == -1) { | ||
343 | /* No cpuid. It must be an ancient CPU */ | ||
344 | if (c->x86 == 4) | ||
345 | strcpy(c->x86_model_id, "486"); | ||
346 | else if (c->x86 == 3) | ||
347 | strcpy(c->x86_model_id, "386"); | ||
348 | } | ||
349 | #endif | ||
350 | } | ||
351 | |||
352 | static const struct cpu_dev __cpuinitconst default_cpu = { | ||
353 | .c_init = default_init, | ||
354 | .c_vendor = "Unknown", | ||
355 | .c_x86_vendor = X86_VENDOR_UNKNOWN, | ||
356 | }; | ||
357 | |||
358 | static void __cpuinit get_model_name(struct cpuinfo_x86 *c) | 358 | static void __cpuinit get_model_name(struct cpuinfo_x86 *c) |
359 | { | 359 | { |
360 | unsigned int *v; | 360 | unsigned int *v; |
diff --git a/arch/x86/kernel/cpu/mcheck/therm_throt.c b/arch/x86/kernel/cpu/mcheck/therm_throt.c index bff8dd191dd5..8bc64cfbe936 100644 --- a/arch/x86/kernel/cpu/mcheck/therm_throt.c +++ b/arch/x86/kernel/cpu/mcheck/therm_throt.c | |||
@@ -36,6 +36,7 @@ | |||
36 | 36 | ||
37 | static DEFINE_PER_CPU(__u64, next_check) = INITIAL_JIFFIES; | 37 | static DEFINE_PER_CPU(__u64, next_check) = INITIAL_JIFFIES; |
38 | static DEFINE_PER_CPU(unsigned long, thermal_throttle_count); | 38 | static DEFINE_PER_CPU(unsigned long, thermal_throttle_count); |
39 | static DEFINE_PER_CPU(bool, thermal_throttle_active); | ||
39 | 40 | ||
40 | static atomic_t therm_throt_en = ATOMIC_INIT(0); | 41 | static atomic_t therm_throt_en = ATOMIC_INIT(0); |
41 | 42 | ||
@@ -96,24 +97,27 @@ static int therm_throt_process(int curr) | |||
96 | { | 97 | { |
97 | unsigned int cpu = smp_processor_id(); | 98 | unsigned int cpu = smp_processor_id(); |
98 | __u64 tmp_jiffs = get_jiffies_64(); | 99 | __u64 tmp_jiffs = get_jiffies_64(); |
100 | bool was_throttled = __get_cpu_var(thermal_throttle_active); | ||
101 | bool is_throttled = __get_cpu_var(thermal_throttle_active) = curr; | ||
99 | 102 | ||
100 | if (curr) | 103 | if (is_throttled) |
101 | __get_cpu_var(thermal_throttle_count)++; | 104 | __get_cpu_var(thermal_throttle_count)++; |
102 | 105 | ||
103 | if (time_before64(tmp_jiffs, __get_cpu_var(next_check))) | 106 | if (!(was_throttled ^ is_throttled) && |
107 | time_before64(tmp_jiffs, __get_cpu_var(next_check))) | ||
104 | return 0; | 108 | return 0; |
105 | 109 | ||
106 | __get_cpu_var(next_check) = tmp_jiffs + CHECK_INTERVAL; | 110 | __get_cpu_var(next_check) = tmp_jiffs + CHECK_INTERVAL; |
107 | 111 | ||
108 | /* if we just entered the thermal event */ | 112 | /* if we just entered the thermal event */ |
109 | if (curr) { | 113 | if (is_throttled) { |
110 | printk(KERN_CRIT "CPU%d: Temperature above threshold, " | 114 | printk(KERN_CRIT "CPU%d: Temperature above threshold, " |
111 | "cpu clock throttled (total events = %lu)\n", cpu, | 115 | "cpu clock throttled (total events = %lu)\n", |
112 | __get_cpu_var(thermal_throttle_count)); | 116 | cpu, __get_cpu_var(thermal_throttle_count)); |
113 | 117 | ||
114 | add_taint(TAINT_MACHINE_CHECK); | 118 | add_taint(TAINT_MACHINE_CHECK); |
115 | } else { | 119 | } else if (was_throttled) { |
116 | printk(KERN_CRIT "CPU%d: Temperature/speed normal\n", cpu); | 120 | printk(KERN_INFO "CPU%d: Temperature/speed normal\n", cpu); |
117 | } | 121 | } |
118 | 122 | ||
119 | return 1; | 123 | return 1; |
diff --git a/arch/x86/kernel/cpu/perf_counter.c b/arch/x86/kernel/cpu/perf_counter.c index a7aa8f900954..900332b800f8 100644 --- a/arch/x86/kernel/cpu/perf_counter.c +++ b/arch/x86/kernel/cpu/perf_counter.c | |||
@@ -55,6 +55,7 @@ struct x86_pmu { | |||
55 | int num_counters_fixed; | 55 | int num_counters_fixed; |
56 | int counter_bits; | 56 | int counter_bits; |
57 | u64 counter_mask; | 57 | u64 counter_mask; |
58 | int apic; | ||
58 | u64 max_period; | 59 | u64 max_period; |
59 | u64 intel_ctrl; | 60 | u64 intel_ctrl; |
60 | }; | 61 | }; |
@@ -72,8 +73,8 @@ static const u64 p6_perfmon_event_map[] = | |||
72 | { | 73 | { |
73 | [PERF_COUNT_HW_CPU_CYCLES] = 0x0079, | 74 | [PERF_COUNT_HW_CPU_CYCLES] = 0x0079, |
74 | [PERF_COUNT_HW_INSTRUCTIONS] = 0x00c0, | 75 | [PERF_COUNT_HW_INSTRUCTIONS] = 0x00c0, |
75 | [PERF_COUNT_HW_CACHE_REFERENCES] = 0x0000, | 76 | [PERF_COUNT_HW_CACHE_REFERENCES] = 0x0f2e, |
76 | [PERF_COUNT_HW_CACHE_MISSES] = 0x0000, | 77 | [PERF_COUNT_HW_CACHE_MISSES] = 0x012e, |
77 | [PERF_COUNT_HW_BRANCH_INSTRUCTIONS] = 0x00c4, | 78 | [PERF_COUNT_HW_BRANCH_INSTRUCTIONS] = 0x00c4, |
78 | [PERF_COUNT_HW_BRANCH_MISSES] = 0x00c5, | 79 | [PERF_COUNT_HW_BRANCH_MISSES] = 0x00c5, |
79 | [PERF_COUNT_HW_BUS_CYCLES] = 0x0062, | 80 | [PERF_COUNT_HW_BUS_CYCLES] = 0x0062, |
@@ -613,6 +614,7 @@ static DEFINE_MUTEX(pmc_reserve_mutex); | |||
613 | 614 | ||
614 | static bool reserve_pmc_hardware(void) | 615 | static bool reserve_pmc_hardware(void) |
615 | { | 616 | { |
617 | #ifdef CONFIG_X86_LOCAL_APIC | ||
616 | int i; | 618 | int i; |
617 | 619 | ||
618 | if (nmi_watchdog == NMI_LOCAL_APIC) | 620 | if (nmi_watchdog == NMI_LOCAL_APIC) |
@@ -627,9 +629,11 @@ static bool reserve_pmc_hardware(void) | |||
627 | if (!reserve_evntsel_nmi(x86_pmu.eventsel + i)) | 629 | if (!reserve_evntsel_nmi(x86_pmu.eventsel + i)) |
628 | goto eventsel_fail; | 630 | goto eventsel_fail; |
629 | } | 631 | } |
632 | #endif | ||
630 | 633 | ||
631 | return true; | 634 | return true; |
632 | 635 | ||
636 | #ifdef CONFIG_X86_LOCAL_APIC | ||
633 | eventsel_fail: | 637 | eventsel_fail: |
634 | for (i--; i >= 0; i--) | 638 | for (i--; i >= 0; i--) |
635 | release_evntsel_nmi(x86_pmu.eventsel + i); | 639 | release_evntsel_nmi(x86_pmu.eventsel + i); |
@@ -644,10 +648,12 @@ perfctr_fail: | |||
644 | enable_lapic_nmi_watchdog(); | 648 | enable_lapic_nmi_watchdog(); |
645 | 649 | ||
646 | return false; | 650 | return false; |
651 | #endif | ||
647 | } | 652 | } |
648 | 653 | ||
649 | static void release_pmc_hardware(void) | 654 | static void release_pmc_hardware(void) |
650 | { | 655 | { |
656 | #ifdef CONFIG_X86_LOCAL_APIC | ||
651 | int i; | 657 | int i; |
652 | 658 | ||
653 | for (i = 0; i < x86_pmu.num_counters; i++) { | 659 | for (i = 0; i < x86_pmu.num_counters; i++) { |
@@ -657,6 +663,7 @@ static void release_pmc_hardware(void) | |||
657 | 663 | ||
658 | if (nmi_watchdog == NMI_LOCAL_APIC) | 664 | if (nmi_watchdog == NMI_LOCAL_APIC) |
659 | enable_lapic_nmi_watchdog(); | 665 | enable_lapic_nmi_watchdog(); |
666 | #endif | ||
660 | } | 667 | } |
661 | 668 | ||
662 | static void hw_perf_counter_destroy(struct perf_counter *counter) | 669 | static void hw_perf_counter_destroy(struct perf_counter *counter) |
@@ -748,6 +755,15 @@ static int __hw_perf_counter_init(struct perf_counter *counter) | |||
748 | hwc->sample_period = x86_pmu.max_period; | 755 | hwc->sample_period = x86_pmu.max_period; |
749 | hwc->last_period = hwc->sample_period; | 756 | hwc->last_period = hwc->sample_period; |
750 | atomic64_set(&hwc->period_left, hwc->sample_period); | 757 | atomic64_set(&hwc->period_left, hwc->sample_period); |
758 | } else { | ||
759 | /* | ||
760 | * If we have a PMU initialized but no APIC | ||
761 | * interrupts, we cannot sample hardware | ||
762 | * counters (user-space has to fall back and | ||
763 | * sample via a hrtimer based software counter): | ||
764 | */ | ||
765 | if (!x86_pmu.apic) | ||
766 | return -EOPNOTSUPP; | ||
751 | } | 767 | } |
752 | 768 | ||
753 | counter->destroy = hw_perf_counter_destroy; | 769 | counter->destroy = hw_perf_counter_destroy; |
@@ -1449,18 +1465,22 @@ void smp_perf_pending_interrupt(struct pt_regs *regs) | |||
1449 | 1465 | ||
1450 | void set_perf_counter_pending(void) | 1466 | void set_perf_counter_pending(void) |
1451 | { | 1467 | { |
1468 | #ifdef CONFIG_X86_LOCAL_APIC | ||
1452 | apic->send_IPI_self(LOCAL_PENDING_VECTOR); | 1469 | apic->send_IPI_self(LOCAL_PENDING_VECTOR); |
1470 | #endif | ||
1453 | } | 1471 | } |
1454 | 1472 | ||
1455 | void perf_counters_lapic_init(void) | 1473 | void perf_counters_lapic_init(void) |
1456 | { | 1474 | { |
1457 | if (!x86_pmu_initialized()) | 1475 | #ifdef CONFIG_X86_LOCAL_APIC |
1476 | if (!x86_pmu.apic || !x86_pmu_initialized()) | ||
1458 | return; | 1477 | return; |
1459 | 1478 | ||
1460 | /* | 1479 | /* |
1461 | * Always use NMI for PMU | 1480 | * Always use NMI for PMU |
1462 | */ | 1481 | */ |
1463 | apic_write(APIC_LVTPC, APIC_DM_NMI); | 1482 | apic_write(APIC_LVTPC, APIC_DM_NMI); |
1483 | #endif | ||
1464 | } | 1484 | } |
1465 | 1485 | ||
1466 | static int __kprobes | 1486 | static int __kprobes |
@@ -1484,7 +1504,9 @@ perf_counter_nmi_handler(struct notifier_block *self, | |||
1484 | 1504 | ||
1485 | regs = args->regs; | 1505 | regs = args->regs; |
1486 | 1506 | ||
1507 | #ifdef CONFIG_X86_LOCAL_APIC | ||
1487 | apic_write(APIC_LVTPC, APIC_DM_NMI); | 1508 | apic_write(APIC_LVTPC, APIC_DM_NMI); |
1509 | #endif | ||
1488 | /* | 1510 | /* |
1489 | * Can't rely on the handled return value to say it was our NMI, two | 1511 | * Can't rely on the handled return value to say it was our NMI, two |
1490 | * counters could trigger 'simultaneously' raising two back-to-back NMIs. | 1512 | * counters could trigger 'simultaneously' raising two back-to-back NMIs. |
@@ -1515,6 +1537,7 @@ static struct x86_pmu p6_pmu = { | |||
1515 | .event_map = p6_pmu_event_map, | 1537 | .event_map = p6_pmu_event_map, |
1516 | .raw_event = p6_pmu_raw_event, | 1538 | .raw_event = p6_pmu_raw_event, |
1517 | .max_events = ARRAY_SIZE(p6_perfmon_event_map), | 1539 | .max_events = ARRAY_SIZE(p6_perfmon_event_map), |
1540 | .apic = 1, | ||
1518 | .max_period = (1ULL << 31) - 1, | 1541 | .max_period = (1ULL << 31) - 1, |
1519 | .version = 0, | 1542 | .version = 0, |
1520 | .num_counters = 2, | 1543 | .num_counters = 2, |
@@ -1541,6 +1564,7 @@ static struct x86_pmu intel_pmu = { | |||
1541 | .event_map = intel_pmu_event_map, | 1564 | .event_map = intel_pmu_event_map, |
1542 | .raw_event = intel_pmu_raw_event, | 1565 | .raw_event = intel_pmu_raw_event, |
1543 | .max_events = ARRAY_SIZE(intel_perfmon_event_map), | 1566 | .max_events = ARRAY_SIZE(intel_perfmon_event_map), |
1567 | .apic = 1, | ||
1544 | /* | 1568 | /* |
1545 | * Intel PMCs cannot be accessed sanely above 32 bit width, | 1569 | * Intel PMCs cannot be accessed sanely above 32 bit width, |
1546 | * so we install an artificial 1<<31 period regardless of | 1570 | * so we install an artificial 1<<31 period regardless of |
@@ -1564,6 +1588,7 @@ static struct x86_pmu amd_pmu = { | |||
1564 | .num_counters = 4, | 1588 | .num_counters = 4, |
1565 | .counter_bits = 48, | 1589 | .counter_bits = 48, |
1566 | .counter_mask = (1ULL << 48) - 1, | 1590 | .counter_mask = (1ULL << 48) - 1, |
1591 | .apic = 1, | ||
1567 | /* use highest bit to detect overflow */ | 1592 | /* use highest bit to detect overflow */ |
1568 | .max_period = (1ULL << 47) - 1, | 1593 | .max_period = (1ULL << 47) - 1, |
1569 | }; | 1594 | }; |
@@ -1589,13 +1614,14 @@ static int p6_pmu_init(void) | |||
1589 | return -ENODEV; | 1614 | return -ENODEV; |
1590 | } | 1615 | } |
1591 | 1616 | ||
1617 | x86_pmu = p6_pmu; | ||
1618 | |||
1592 | if (!cpu_has_apic) { | 1619 | if (!cpu_has_apic) { |
1593 | pr_info("no Local APIC, try rebooting with lapic"); | 1620 | pr_info("no APIC, boot with the \"lapic\" boot parameter to force-enable it.\n"); |
1594 | return -ENODEV; | 1621 | pr_info("no hardware sampling interrupt available.\n"); |
1622 | x86_pmu.apic = 0; | ||
1595 | } | 1623 | } |
1596 | 1624 | ||
1597 | x86_pmu = p6_pmu; | ||
1598 | |||
1599 | return 0; | 1625 | return 0; |
1600 | } | 1626 | } |
1601 | 1627 | ||
diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c index 9eb897603705..a06e8d101844 100644 --- a/arch/x86/kernel/reboot.c +++ b/arch/x86/kernel/reboot.c | |||
@@ -418,20 +418,20 @@ static int __init set_pci_reboot(const struct dmi_system_id *d) | |||
418 | } | 418 | } |
419 | 419 | ||
420 | static struct dmi_system_id __initdata pci_reboot_dmi_table[] = { | 420 | static struct dmi_system_id __initdata pci_reboot_dmi_table[] = { |
421 | { /* Handle problems with rebooting on Apple MacBook5,2 */ | 421 | { /* Handle problems with rebooting on Apple MacBook5 */ |
422 | .callback = set_pci_reboot, | 422 | .callback = set_pci_reboot, |
423 | .ident = "Apple MacBook", | 423 | .ident = "Apple MacBook5", |
424 | .matches = { | 424 | .matches = { |
425 | DMI_MATCH(DMI_SYS_VENDOR, "Apple Inc."), | 425 | DMI_MATCH(DMI_SYS_VENDOR, "Apple Inc."), |
426 | DMI_MATCH(DMI_PRODUCT_NAME, "MacBook5,2"), | 426 | DMI_MATCH(DMI_PRODUCT_NAME, "MacBook5"), |
427 | }, | 427 | }, |
428 | }, | 428 | }, |
429 | { /* Handle problems with rebooting on Apple MacBookPro5,1 */ | 429 | { /* Handle problems with rebooting on Apple MacBookPro5 */ |
430 | .callback = set_pci_reboot, | 430 | .callback = set_pci_reboot, |
431 | .ident = "Apple MacBookPro5,1", | 431 | .ident = "Apple MacBookPro5", |
432 | .matches = { | 432 | .matches = { |
433 | DMI_MATCH(DMI_SYS_VENDOR, "Apple Inc."), | 433 | DMI_MATCH(DMI_SYS_VENDOR, "Apple Inc."), |
434 | DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro5,1"), | 434 | DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro5"), |
435 | }, | 435 | }, |
436 | }, | 436 | }, |
437 | { } | 437 | { } |
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c index 958c1fa41900..fe3eba5d6b3e 100644 --- a/drivers/ata/ahci.c +++ b/drivers/ata/ahci.c | |||
@@ -219,6 +219,8 @@ enum { | |||
219 | AHCI_HFLAG_SECT255 = (1 << 8), /* max 255 sectors */ | 219 | AHCI_HFLAG_SECT255 = (1 << 8), /* max 255 sectors */ |
220 | AHCI_HFLAG_YES_NCQ = (1 << 9), /* force NCQ cap on */ | 220 | AHCI_HFLAG_YES_NCQ = (1 << 9), /* force NCQ cap on */ |
221 | AHCI_HFLAG_NO_SUSPEND = (1 << 10), /* don't suspend */ | 221 | AHCI_HFLAG_NO_SUSPEND = (1 << 10), /* don't suspend */ |
222 | AHCI_HFLAG_SRST_TOUT_IS_OFFLINE = (1 << 11), /* treat SRST timeout as | ||
223 | link offline */ | ||
222 | 224 | ||
223 | /* ap->flags bits */ | 225 | /* ap->flags bits */ |
224 | 226 | ||
@@ -1663,6 +1665,7 @@ static int ahci_do_softreset(struct ata_link *link, unsigned int *class, | |||
1663 | int (*check_ready)(struct ata_link *link)) | 1665 | int (*check_ready)(struct ata_link *link)) |
1664 | { | 1666 | { |
1665 | struct ata_port *ap = link->ap; | 1667 | struct ata_port *ap = link->ap; |
1668 | struct ahci_host_priv *hpriv = ap->host->private_data; | ||
1666 | const char *reason = NULL; | 1669 | const char *reason = NULL; |
1667 | unsigned long now, msecs; | 1670 | unsigned long now, msecs; |
1668 | struct ata_taskfile tf; | 1671 | struct ata_taskfile tf; |
@@ -1701,12 +1704,21 @@ static int ahci_do_softreset(struct ata_link *link, unsigned int *class, | |||
1701 | 1704 | ||
1702 | /* wait for link to become ready */ | 1705 | /* wait for link to become ready */ |
1703 | rc = ata_wait_after_reset(link, deadline, check_ready); | 1706 | rc = ata_wait_after_reset(link, deadline, check_ready); |
1704 | /* link occupied, -ENODEV too is an error */ | 1707 | if (rc == -EBUSY && hpriv->flags & AHCI_HFLAG_SRST_TOUT_IS_OFFLINE) { |
1705 | if (rc) { | 1708 | /* |
1709 | * Workaround for cases where link online status can't | ||
1710 | * be trusted. Treat device readiness timeout as link | ||
1711 | * offline. | ||
1712 | */ | ||
1713 | ata_link_printk(link, KERN_INFO, | ||
1714 | "device not ready, treating as offline\n"); | ||
1715 | *class = ATA_DEV_NONE; | ||
1716 | } else if (rc) { | ||
1717 | /* link occupied, -ENODEV too is an error */ | ||
1706 | reason = "device not ready"; | 1718 | reason = "device not ready"; |
1707 | goto fail; | 1719 | goto fail; |
1708 | } | 1720 | } else |
1709 | *class = ahci_dev_classify(ap); | 1721 | *class = ahci_dev_classify(ap); |
1710 | 1722 | ||
1711 | DPRINTK("EXIT, class=%u\n", *class); | 1723 | DPRINTK("EXIT, class=%u\n", *class); |
1712 | return 0; | 1724 | return 0; |
@@ -1773,7 +1785,8 @@ static int ahci_sb600_softreset(struct ata_link *link, unsigned int *class, | |||
1773 | irq_sts = readl(port_mmio + PORT_IRQ_STAT); | 1785 | irq_sts = readl(port_mmio + PORT_IRQ_STAT); |
1774 | if (irq_sts & PORT_IRQ_BAD_PMP) { | 1786 | if (irq_sts & PORT_IRQ_BAD_PMP) { |
1775 | ata_link_printk(link, KERN_WARNING, | 1787 | ata_link_printk(link, KERN_WARNING, |
1776 | "failed due to HW bug, retry pmp=0\n"); | 1788 | "applying SB600 PMP SRST workaround " |
1789 | "and retrying\n"); | ||
1777 | rc = ahci_do_softreset(link, class, 0, deadline, | 1790 | rc = ahci_do_softreset(link, class, 0, deadline, |
1778 | ahci_check_ready); | 1791 | ahci_check_ready); |
1779 | } | 1792 | } |
@@ -2726,6 +2739,56 @@ static bool ahci_broken_suspend(struct pci_dev *pdev) | |||
2726 | return !ver || strcmp(ver, dmi->driver_data) < 0; | 2739 | return !ver || strcmp(ver, dmi->driver_data) < 0; |
2727 | } | 2740 | } |
2728 | 2741 | ||
2742 | static bool ahci_broken_online(struct pci_dev *pdev) | ||
2743 | { | ||
2744 | #define ENCODE_BUSDEVFN(bus, slot, func) \ | ||
2745 | (void *)(unsigned long)(((bus) << 8) | PCI_DEVFN((slot), (func))) | ||
2746 | static const struct dmi_system_id sysids[] = { | ||
2747 | /* | ||
2748 | * There are several gigabyte boards which use | ||
2749 | * SIMG5723s configured as hardware RAID. Certain | ||
2750 | * 5723 firmware revisions shipped there keep the link | ||
2751 | * online but fail to answer properly to SRST or | ||
2752 | * IDENTIFY when no device is attached downstream | ||
2753 | * causing libata to retry quite a few times leading | ||
2754 | * to excessive detection delay. | ||
2755 | * | ||
2756 | * As these firmwares respond to the second reset try | ||
2757 | * with invalid device signature, considering unknown | ||
2758 | * sig as offline works around the problem acceptably. | ||
2759 | */ | ||
2760 | { | ||
2761 | .ident = "EP45-DQ6", | ||
2762 | .matches = { | ||
2763 | DMI_MATCH(DMI_BOARD_VENDOR, | ||
2764 | "Gigabyte Technology Co., Ltd."), | ||
2765 | DMI_MATCH(DMI_BOARD_NAME, "EP45-DQ6"), | ||
2766 | }, | ||
2767 | .driver_data = ENCODE_BUSDEVFN(0x0a, 0x00, 0), | ||
2768 | }, | ||
2769 | { | ||
2770 | .ident = "EP45-DS5", | ||
2771 | .matches = { | ||
2772 | DMI_MATCH(DMI_BOARD_VENDOR, | ||
2773 | "Gigabyte Technology Co., Ltd."), | ||
2774 | DMI_MATCH(DMI_BOARD_NAME, "EP45-DS5"), | ||
2775 | }, | ||
2776 | .driver_data = ENCODE_BUSDEVFN(0x03, 0x00, 0), | ||
2777 | }, | ||
2778 | { } /* terminate list */ | ||
2779 | }; | ||
2780 | #undef ENCODE_BUSDEVFN | ||
2781 | const struct dmi_system_id *dmi = dmi_first_match(sysids); | ||
2782 | unsigned int val; | ||
2783 | |||
2784 | if (!dmi) | ||
2785 | return false; | ||
2786 | |||
2787 | val = (unsigned long)dmi->driver_data; | ||
2788 | |||
2789 | return pdev->bus->number == (val >> 8) && pdev->devfn == (val & 0xff); | ||
2790 | } | ||
2791 | |||
2729 | static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | 2792 | static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) |
2730 | { | 2793 | { |
2731 | static int printed_version; | 2794 | static int printed_version; |
@@ -2841,6 +2904,12 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
2841 | "BIOS update required for suspend/resume\n"); | 2904 | "BIOS update required for suspend/resume\n"); |
2842 | } | 2905 | } |
2843 | 2906 | ||
2907 | if (ahci_broken_online(pdev)) { | ||
2908 | hpriv->flags |= AHCI_HFLAG_SRST_TOUT_IS_OFFLINE; | ||
2909 | dev_info(&pdev->dev, | ||
2910 | "online status unreliable, applying workaround\n"); | ||
2911 | } | ||
2912 | |||
2844 | /* CAP.NP sometimes indicate the index of the last enabled | 2913 | /* CAP.NP sometimes indicate the index of the last enabled |
2845 | * port, at other times, that of the last possible port, so | 2914 | * port, at other times, that of the last possible port, so |
2846 | * determining the maximum port number requires looking at | 2915 | * determining the maximum port number requires looking at |
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index 8ac98ff16d7d..072ba5ea138f 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c | |||
@@ -4302,6 +4302,9 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = { | |||
4302 | { "WDC WD2500JD-00HBB0", "WD-WMAL71490727", ATA_HORKAGE_BROKEN_HPA }, | 4302 | { "WDC WD2500JD-00HBB0", "WD-WMAL71490727", ATA_HORKAGE_BROKEN_HPA }, |
4303 | { "MAXTOR 6L080L4", "A93.0500", ATA_HORKAGE_BROKEN_HPA }, | 4303 | { "MAXTOR 6L080L4", "A93.0500", ATA_HORKAGE_BROKEN_HPA }, |
4304 | 4304 | ||
4305 | /* this one allows HPA unlocking but fails IOs on the area */ | ||
4306 | { "OCZ-VERTEX", "1.30", ATA_HORKAGE_BROKEN_HPA }, | ||
4307 | |||
4305 | /* Devices which report 1 sector over size HPA */ | 4308 | /* Devices which report 1 sector over size HPA */ |
4306 | { "ST340823A", NULL, ATA_HORKAGE_HPA_SIZE, }, | 4309 | { "ST340823A", NULL, ATA_HORKAGE_HPA_SIZE, }, |
4307 | { "ST320413A", NULL, ATA_HORKAGE_HPA_SIZE, }, | 4310 | { "ST320413A", NULL, ATA_HORKAGE_HPA_SIZE, }, |
diff --git a/drivers/ata/pata_at91.c b/drivers/ata/pata_at91.c index 5702affcb325..41c94b1ae493 100644 --- a/drivers/ata/pata_at91.c +++ b/drivers/ata/pata_at91.c | |||
@@ -250,7 +250,7 @@ static int __devinit pata_at91_probe(struct platform_device *pdev) | |||
250 | ata_port_desc(ap, "no IRQ, using PIO polling"); | 250 | ata_port_desc(ap, "no IRQ, using PIO polling"); |
251 | } | 251 | } |
252 | 252 | ||
253 | info = kzalloc(sizeof(*info), GFP_KERNEL); | 253 | info = devm_kzalloc(dev, sizeof(*info), GFP_KERNEL); |
254 | 254 | ||
255 | if (!info) { | 255 | if (!info) { |
256 | dev_err(dev, "failed to allocate memory for private data\n"); | 256 | dev_err(dev, "failed to allocate memory for private data\n"); |
@@ -275,7 +275,7 @@ static int __devinit pata_at91_probe(struct platform_device *pdev) | |||
275 | if (!info->ide_addr) { | 275 | if (!info->ide_addr) { |
276 | dev_err(dev, "failed to map IO base\n"); | 276 | dev_err(dev, "failed to map IO base\n"); |
277 | ret = -ENOMEM; | 277 | ret = -ENOMEM; |
278 | goto err_ide_ioremap; | 278 | goto err_put; |
279 | } | 279 | } |
280 | 280 | ||
281 | info->alt_addr = devm_ioremap(dev, | 281 | info->alt_addr = devm_ioremap(dev, |
@@ -284,7 +284,7 @@ static int __devinit pata_at91_probe(struct platform_device *pdev) | |||
284 | if (!info->alt_addr) { | 284 | if (!info->alt_addr) { |
285 | dev_err(dev, "failed to map CTL base\n"); | 285 | dev_err(dev, "failed to map CTL base\n"); |
286 | ret = -ENOMEM; | 286 | ret = -ENOMEM; |
287 | goto err_alt_ioremap; | 287 | goto err_put; |
288 | } | 288 | } |
289 | 289 | ||
290 | ap->ioaddr.cmd_addr = info->ide_addr; | 290 | ap->ioaddr.cmd_addr = info->ide_addr; |
@@ -303,13 +303,8 @@ static int __devinit pata_at91_probe(struct platform_device *pdev) | |||
303 | irq ? ata_sff_interrupt : NULL, | 303 | irq ? ata_sff_interrupt : NULL, |
304 | irq_flags, &pata_at91_sht); | 304 | irq_flags, &pata_at91_sht); |
305 | 305 | ||
306 | err_alt_ioremap: | 306 | err_put: |
307 | devm_iounmap(dev, info->ide_addr); | ||
308 | |||
309 | err_ide_ioremap: | ||
310 | clk_put(info->mck); | 307 | clk_put(info->mck); |
311 | kfree(info); | ||
312 | |||
313 | return ret; | 308 | return ret; |
314 | } | 309 | } |
315 | 310 | ||
@@ -317,7 +312,6 @@ static int __devexit pata_at91_remove(struct platform_device *pdev) | |||
317 | { | 312 | { |
318 | struct ata_host *host = dev_get_drvdata(&pdev->dev); | 313 | struct ata_host *host = dev_get_drvdata(&pdev->dev); |
319 | struct at91_ide_info *info; | 314 | struct at91_ide_info *info; |
320 | struct device *dev = &pdev->dev; | ||
321 | 315 | ||
322 | if (!host) | 316 | if (!host) |
323 | return 0; | 317 | return 0; |
@@ -328,11 +322,8 @@ static int __devexit pata_at91_remove(struct platform_device *pdev) | |||
328 | if (!info) | 322 | if (!info) |
329 | return 0; | 323 | return 0; |
330 | 324 | ||
331 | devm_iounmap(dev, info->ide_addr); | ||
332 | devm_iounmap(dev, info->alt_addr); | ||
333 | clk_put(info->mck); | 325 | clk_put(info->mck); |
334 | 326 | ||
335 | kfree(info); | ||
336 | return 0; | 327 | return 0; |
337 | } | 328 | } |
338 | 329 | ||
diff --git a/drivers/ata/pata_atiixp.c b/drivers/ata/pata_atiixp.c index bec0b8ade66d..45915566e4e9 100644 --- a/drivers/ata/pata_atiixp.c +++ b/drivers/ata/pata_atiixp.c | |||
@@ -1,6 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * pata_atiixp.c - ATI PATA for new ATA layer | 2 | * pata_atiixp.c - ATI PATA for new ATA layer |
3 | * (C) 2005 Red Hat Inc | 3 | * (C) 2005 Red Hat Inc |
4 | * (C) 2009 Bartlomiej Zolnierkiewicz | ||
4 | * | 5 | * |
5 | * Based on | 6 | * Based on |
6 | * | 7 | * |
@@ -61,20 +62,19 @@ static void atiixp_set_pio_timing(struct ata_port *ap, struct ata_device *adev, | |||
61 | 62 | ||
62 | struct pci_dev *pdev = to_pci_dev(ap->host->dev); | 63 | struct pci_dev *pdev = to_pci_dev(ap->host->dev); |
63 | int dn = 2 * ap->port_no + adev->devno; | 64 | int dn = 2 * ap->port_no + adev->devno; |
64 | |||
65 | /* Check this is correct - the order is odd in both drivers */ | ||
66 | int timing_shift = (16 * ap->port_no) + 8 * (adev->devno ^ 1); | 65 | int timing_shift = (16 * ap->port_no) + 8 * (adev->devno ^ 1); |
67 | u16 pio_mode_data, pio_timing_data; | 66 | u32 pio_timing_data; |
67 | u16 pio_mode_data; | ||
68 | 68 | ||
69 | pci_read_config_word(pdev, ATIIXP_IDE_PIO_MODE, &pio_mode_data); | 69 | pci_read_config_word(pdev, ATIIXP_IDE_PIO_MODE, &pio_mode_data); |
70 | pio_mode_data &= ~(0x7 << (4 * dn)); | 70 | pio_mode_data &= ~(0x7 << (4 * dn)); |
71 | pio_mode_data |= pio << (4 * dn); | 71 | pio_mode_data |= pio << (4 * dn); |
72 | pci_write_config_word(pdev, ATIIXP_IDE_PIO_MODE, pio_mode_data); | 72 | pci_write_config_word(pdev, ATIIXP_IDE_PIO_MODE, pio_mode_data); |
73 | 73 | ||
74 | pci_read_config_word(pdev, ATIIXP_IDE_PIO_TIMING, &pio_timing_data); | 74 | pci_read_config_dword(pdev, ATIIXP_IDE_PIO_TIMING, &pio_timing_data); |
75 | pio_timing_data &= ~(0xFF << timing_shift); | 75 | pio_timing_data &= ~(0xFF << timing_shift); |
76 | pio_timing_data |= (pio_timings[pio] << timing_shift); | 76 | pio_timing_data |= (pio_timings[pio] << timing_shift); |
77 | pci_write_config_word(pdev, ATIIXP_IDE_PIO_TIMING, pio_timing_data); | 77 | pci_write_config_dword(pdev, ATIIXP_IDE_PIO_TIMING, pio_timing_data); |
78 | } | 78 | } |
79 | 79 | ||
80 | /** | 80 | /** |
@@ -119,16 +119,17 @@ static void atiixp_set_dmamode(struct ata_port *ap, struct ata_device *adev) | |||
119 | udma_mode_data |= dma << (4 * dn); | 119 | udma_mode_data |= dma << (4 * dn); |
120 | pci_write_config_word(pdev, ATIIXP_IDE_UDMA_MODE, udma_mode_data); | 120 | pci_write_config_word(pdev, ATIIXP_IDE_UDMA_MODE, udma_mode_data); |
121 | } else { | 121 | } else { |
122 | u16 mwdma_timing_data; | ||
123 | /* Check this is correct - the order is odd in both drivers */ | ||
124 | int timing_shift = (16 * ap->port_no) + 8 * (adev->devno ^ 1); | 122 | int timing_shift = (16 * ap->port_no) + 8 * (adev->devno ^ 1); |
123 | u32 mwdma_timing_data; | ||
125 | 124 | ||
126 | dma -= XFER_MW_DMA_0; | 125 | dma -= XFER_MW_DMA_0; |
127 | 126 | ||
128 | pci_read_config_word(pdev, ATIIXP_IDE_MWDMA_TIMING, &mwdma_timing_data); | 127 | pci_read_config_dword(pdev, ATIIXP_IDE_MWDMA_TIMING, |
128 | &mwdma_timing_data); | ||
129 | mwdma_timing_data &= ~(0xFF << timing_shift); | 129 | mwdma_timing_data &= ~(0xFF << timing_shift); |
130 | mwdma_timing_data |= (mwdma_timings[dma] << timing_shift); | 130 | mwdma_timing_data |= (mwdma_timings[dma] << timing_shift); |
131 | pci_write_config_word(pdev, ATIIXP_IDE_MWDMA_TIMING, mwdma_timing_data); | 131 | pci_write_config_dword(pdev, ATIIXP_IDE_MWDMA_TIMING, |
132 | mwdma_timing_data); | ||
132 | } | 133 | } |
133 | /* | 134 | /* |
134 | * We must now look at the PIO mode situation. We may need to | 135 | * We must now look at the PIO mode situation. We may need to |
diff --git a/drivers/ata/sata_nv.c b/drivers/ata/sata_nv.c index b2d11f300c39..86a40582999c 100644 --- a/drivers/ata/sata_nv.c +++ b/drivers/ata/sata_nv.c | |||
@@ -602,6 +602,7 @@ MODULE_VERSION(DRV_VERSION); | |||
602 | 602 | ||
603 | static int adma_enabled; | 603 | static int adma_enabled; |
604 | static int swncq_enabled = 1; | 604 | static int swncq_enabled = 1; |
605 | static int msi_enabled; | ||
605 | 606 | ||
606 | static void nv_adma_register_mode(struct ata_port *ap) | 607 | static void nv_adma_register_mode(struct ata_port *ap) |
607 | { | 608 | { |
@@ -2459,6 +2460,11 @@ static int nv_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
2459 | } else if (type == SWNCQ) | 2460 | } else if (type == SWNCQ) |
2460 | nv_swncq_host_init(host); | 2461 | nv_swncq_host_init(host); |
2461 | 2462 | ||
2463 | if (msi_enabled) { | ||
2464 | dev_printk(KERN_NOTICE, &pdev->dev, "Using MSI\n"); | ||
2465 | pci_enable_msi(pdev); | ||
2466 | } | ||
2467 | |||
2462 | pci_set_master(pdev); | 2468 | pci_set_master(pdev); |
2463 | return ata_host_activate(host, pdev->irq, ipriv->irq_handler, | 2469 | return ata_host_activate(host, pdev->irq, ipriv->irq_handler, |
2464 | IRQF_SHARED, ipriv->sht); | 2470 | IRQF_SHARED, ipriv->sht); |
@@ -2558,4 +2564,6 @@ module_param_named(adma, adma_enabled, bool, 0444); | |||
2558 | MODULE_PARM_DESC(adma, "Enable use of ADMA (Default: false)"); | 2564 | MODULE_PARM_DESC(adma, "Enable use of ADMA (Default: false)"); |
2559 | module_param_named(swncq, swncq_enabled, bool, 0444); | 2565 | module_param_named(swncq, swncq_enabled, bool, 0444); |
2560 | MODULE_PARM_DESC(swncq, "Enable use of SWNCQ (Default: true)"); | 2566 | MODULE_PARM_DESC(swncq, "Enable use of SWNCQ (Default: true)"); |
2567 | module_param_named(msi, msi_enabled, bool, 0444); | ||
2568 | MODULE_PARM_DESC(msi, "Enable use of MSI (Default: false)"); | ||
2561 | 2569 | ||
diff --git a/drivers/base/platform.c b/drivers/base/platform.c index ae5c4aa6d269..d28c289e4a3f 100644 --- a/drivers/base/platform.c +++ b/drivers/base/platform.c | |||
@@ -483,9 +483,6 @@ int platform_driver_register(struct platform_driver *drv) | |||
483 | drv->driver.remove = platform_drv_remove; | 483 | drv->driver.remove = platform_drv_remove; |
484 | if (drv->shutdown) | 484 | if (drv->shutdown) |
485 | drv->driver.shutdown = platform_drv_shutdown; | 485 | drv->driver.shutdown = platform_drv_shutdown; |
486 | if (drv->suspend || drv->resume) | ||
487 | pr_warning("Platform driver '%s' needs updating - please use " | ||
488 | "dev_pm_ops\n", drv->driver.name); | ||
489 | 486 | ||
490 | return driver_register(&drv->driver); | 487 | return driver_register(&drv->driver); |
491 | } | 488 | } |
diff --git a/drivers/md/md.c b/drivers/md/md.c index 5b98bea4ff9b..103f2d33fa89 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
@@ -359,6 +359,7 @@ static mddev_t * mddev_find(dev_t unit) | |||
359 | else | 359 | else |
360 | new->md_minor = MINOR(unit) >> MdpMinorShift; | 360 | new->md_minor = MINOR(unit) >> MdpMinorShift; |
361 | 361 | ||
362 | mutex_init(&new->open_mutex); | ||
362 | mutex_init(&new->reconfig_mutex); | 363 | mutex_init(&new->reconfig_mutex); |
363 | INIT_LIST_HEAD(&new->disks); | 364 | INIT_LIST_HEAD(&new->disks); |
364 | INIT_LIST_HEAD(&new->all_mddevs); | 365 | INIT_LIST_HEAD(&new->all_mddevs); |
@@ -1974,17 +1975,14 @@ repeat: | |||
1974 | /* otherwise we have to go forward and ... */ | 1975 | /* otherwise we have to go forward and ... */ |
1975 | mddev->events ++; | 1976 | mddev->events ++; |
1976 | if (!mddev->in_sync || mddev->recovery_cp != MaxSector) { /* not clean */ | 1977 | if (!mddev->in_sync || mddev->recovery_cp != MaxSector) { /* not clean */ |
1977 | /* .. if the array isn't clean, insist on an odd 'events' */ | 1978 | /* .. if the array isn't clean, an 'even' event must also go |
1978 | if ((mddev->events&1)==0) { | 1979 | * to spares. */ |
1979 | mddev->events++; | 1980 | if ((mddev->events&1)==0) |
1980 | nospares = 0; | 1981 | nospares = 0; |
1981 | } | ||
1982 | } else { | 1982 | } else { |
1983 | /* otherwise insist on an even 'events' (for clean states) */ | 1983 | /* otherwise an 'odd' event must go to spares */ |
1984 | if ((mddev->events&1)) { | 1984 | if ((mddev->events&1)) |
1985 | mddev->events++; | ||
1986 | nospares = 0; | 1985 | nospares = 0; |
1987 | } | ||
1988 | } | 1986 | } |
1989 | } | 1987 | } |
1990 | 1988 | ||
@@ -3601,6 +3599,7 @@ max_sync_store(mddev_t *mddev, const char *buf, size_t len) | |||
3601 | if (max < mddev->resync_min) | 3599 | if (max < mddev->resync_min) |
3602 | return -EINVAL; | 3600 | return -EINVAL; |
3603 | if (max < mddev->resync_max && | 3601 | if (max < mddev->resync_max && |
3602 | mddev->ro == 0 && | ||
3604 | test_bit(MD_RECOVERY_RUNNING, &mddev->recovery)) | 3603 | test_bit(MD_RECOVERY_RUNNING, &mddev->recovery)) |
3605 | return -EBUSY; | 3604 | return -EBUSY; |
3606 | 3605 | ||
@@ -4304,12 +4303,11 @@ static int do_md_stop(mddev_t * mddev, int mode, int is_open) | |||
4304 | struct gendisk *disk = mddev->gendisk; | 4303 | struct gendisk *disk = mddev->gendisk; |
4305 | mdk_rdev_t *rdev; | 4304 | mdk_rdev_t *rdev; |
4306 | 4305 | ||
4306 | mutex_lock(&mddev->open_mutex); | ||
4307 | if (atomic_read(&mddev->openers) > is_open) { | 4307 | if (atomic_read(&mddev->openers) > is_open) { |
4308 | printk("md: %s still in use.\n",mdname(mddev)); | 4308 | printk("md: %s still in use.\n",mdname(mddev)); |
4309 | return -EBUSY; | 4309 | err = -EBUSY; |
4310 | } | 4310 | } else if (mddev->pers) { |
4311 | |||
4312 | if (mddev->pers) { | ||
4313 | 4311 | ||
4314 | if (mddev->sync_thread) { | 4312 | if (mddev->sync_thread) { |
4315 | set_bit(MD_RECOVERY_FROZEN, &mddev->recovery); | 4313 | set_bit(MD_RECOVERY_FROZEN, &mddev->recovery); |
@@ -4367,7 +4365,10 @@ static int do_md_stop(mddev_t * mddev, int mode, int is_open) | |||
4367 | set_disk_ro(disk, 1); | 4365 | set_disk_ro(disk, 1); |
4368 | clear_bit(MD_RECOVERY_FROZEN, &mddev->recovery); | 4366 | clear_bit(MD_RECOVERY_FROZEN, &mddev->recovery); |
4369 | } | 4367 | } |
4370 | 4368 | out: | |
4369 | mutex_unlock(&mddev->open_mutex); | ||
4370 | if (err) | ||
4371 | return err; | ||
4371 | /* | 4372 | /* |
4372 | * Free resources if final stop | 4373 | * Free resources if final stop |
4373 | */ | 4374 | */ |
@@ -4433,7 +4434,6 @@ static int do_md_stop(mddev_t * mddev, int mode, int is_open) | |||
4433 | blk_integrity_unregister(disk); | 4434 | blk_integrity_unregister(disk); |
4434 | md_new_event(mddev); | 4435 | md_new_event(mddev); |
4435 | sysfs_notify_dirent(mddev->sysfs_state); | 4436 | sysfs_notify_dirent(mddev->sysfs_state); |
4436 | out: | ||
4437 | return err; | 4437 | return err; |
4438 | } | 4438 | } |
4439 | 4439 | ||
@@ -5518,12 +5518,12 @@ static int md_open(struct block_device *bdev, fmode_t mode) | |||
5518 | } | 5518 | } |
5519 | BUG_ON(mddev != bdev->bd_disk->private_data); | 5519 | BUG_ON(mddev != bdev->bd_disk->private_data); |
5520 | 5520 | ||
5521 | if ((err = mutex_lock_interruptible_nested(&mddev->reconfig_mutex, 1))) | 5521 | if ((err = mutex_lock_interruptible(&mddev->open_mutex))) |
5522 | goto out; | 5522 | goto out; |
5523 | 5523 | ||
5524 | err = 0; | 5524 | err = 0; |
5525 | atomic_inc(&mddev->openers); | 5525 | atomic_inc(&mddev->openers); |
5526 | mddev_unlock(mddev); | 5526 | mutex_unlock(&mddev->open_mutex); |
5527 | 5527 | ||
5528 | check_disk_change(bdev); | 5528 | check_disk_change(bdev); |
5529 | out: | 5529 | out: |
diff --git a/drivers/md/md.h b/drivers/md/md.h index 78f03168baf9..f8fc188bc762 100644 --- a/drivers/md/md.h +++ b/drivers/md/md.h | |||
@@ -223,6 +223,16 @@ struct mddev_s | |||
223 | * so we don't loop trying */ | 223 | * so we don't loop trying */ |
224 | 224 | ||
225 | int in_sync; /* know to not need resync */ | 225 | int in_sync; /* know to not need resync */ |
226 | /* 'open_mutex' avoids races between 'md_open' and 'do_md_stop', so | ||
227 | * that we are never stopping an array while it is open. | ||
228 | * 'reconfig_mutex' protects all other reconfiguration. | ||
229 | * These locks are separate due to conflicting interactions | ||
230 | * with bdev->bd_mutex. | ||
231 | * Lock ordering is: | ||
232 | * reconfig_mutex -> bd_mutex : e.g. do_md_run -> revalidate_disk | ||
233 | * bd_mutex -> open_mutex: e.g. __blkdev_get -> md_open | ||
234 | */ | ||
235 | struct mutex open_mutex; | ||
226 | struct mutex reconfig_mutex; | 236 | struct mutex reconfig_mutex; |
227 | atomic_t active; /* general refcount */ | 237 | atomic_t active; /* general refcount */ |
228 | atomic_t openers; /* number of active opens */ | 238 | atomic_t openers; /* number of active opens */ |
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index 2b521ee67dfa..b8a2c5dc67ba 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c | |||
@@ -3785,7 +3785,7 @@ static sector_t reshape_request(mddev_t *mddev, sector_t sector_nr, int *skipped | |||
3785 | conf->reshape_progress < raid5_size(mddev, 0, 0)) { | 3785 | conf->reshape_progress < raid5_size(mddev, 0, 0)) { |
3786 | sector_nr = raid5_size(mddev, 0, 0) | 3786 | sector_nr = raid5_size(mddev, 0, 0) |
3787 | - conf->reshape_progress; | 3787 | - conf->reshape_progress; |
3788 | } else if (mddev->delta_disks > 0 && | 3788 | } else if (mddev->delta_disks >= 0 && |
3789 | conf->reshape_progress > 0) | 3789 | conf->reshape_progress > 0) |
3790 | sector_nr = conf->reshape_progress; | 3790 | sector_nr = conf->reshape_progress; |
3791 | sector_div(sector_nr, new_data_disks); | 3791 | sector_div(sector_nr, new_data_disks); |
@@ -4509,7 +4509,26 @@ static int run(mddev_t *mddev) | |||
4509 | (old_disks-max_degraded)); | 4509 | (old_disks-max_degraded)); |
4510 | /* here_old is the first stripe that we might need to read | 4510 | /* here_old is the first stripe that we might need to read |
4511 | * from */ | 4511 | * from */ |
4512 | if (here_new >= here_old) { | 4512 | if (mddev->delta_disks == 0) { |
4513 | /* We cannot be sure it is safe to start an in-place | ||
4514 | * reshape. It is only safe if user-space if monitoring | ||
4515 | * and taking constant backups. | ||
4516 | * mdadm always starts a situation like this in | ||
4517 | * readonly mode so it can take control before | ||
4518 | * allowing any writes. So just check for that. | ||
4519 | */ | ||
4520 | if ((here_new * mddev->new_chunk_sectors != | ||
4521 | here_old * mddev->chunk_sectors) || | ||
4522 | mddev->ro == 0) { | ||
4523 | printk(KERN_ERR "raid5: in-place reshape must be started" | ||
4524 | " in read-only mode - aborting\n"); | ||
4525 | return -EINVAL; | ||
4526 | } | ||
4527 | } else if (mddev->delta_disks < 0 | ||
4528 | ? (here_new * mddev->new_chunk_sectors <= | ||
4529 | here_old * mddev->chunk_sectors) | ||
4530 | : (here_new * mddev->new_chunk_sectors >= | ||
4531 | here_old * mddev->chunk_sectors)) { | ||
4513 | /* Reading from the same stripe as writing to - bad */ | 4532 | /* Reading from the same stripe as writing to - bad */ |
4514 | printk(KERN_ERR "raid5: reshape_position too early for " | 4533 | printk(KERN_ERR "raid5: reshape_position too early for " |
4515 | "auto-recovery - aborting.\n"); | 4534 | "auto-recovery - aborting.\n"); |
@@ -5078,8 +5097,15 @@ static void raid5_finish_reshape(mddev_t *mddev) | |||
5078 | mddev->degraded--; | 5097 | mddev->degraded--; |
5079 | for (d = conf->raid_disks ; | 5098 | for (d = conf->raid_disks ; |
5080 | d < conf->raid_disks - mddev->delta_disks; | 5099 | d < conf->raid_disks - mddev->delta_disks; |
5081 | d++) | 5100 | d++) { |
5082 | raid5_remove_disk(mddev, d); | 5101 | mdk_rdev_t *rdev = conf->disks[d].rdev; |
5102 | if (rdev && raid5_remove_disk(mddev, d) == 0) { | ||
5103 | char nm[20]; | ||
5104 | sprintf(nm, "rd%d", rdev->raid_disk); | ||
5105 | sysfs_remove_link(&mddev->kobj, nm); | ||
5106 | rdev->raid_disk = -1; | ||
5107 | } | ||
5108 | } | ||
5083 | } | 5109 | } |
5084 | mddev->layout = conf->algorithm; | 5110 | mddev->layout = conf->algorithm; |
5085 | mddev->chunk_sectors = conf->chunk_sectors; | 5111 | mddev->chunk_sectors = conf->chunk_sectors; |
diff --git a/drivers/media/common/tuners/qt1010.c b/drivers/media/common/tuners/qt1010.c index 825aa1412e6f..9f5dba244cb8 100644 --- a/drivers/media/common/tuners/qt1010.c +++ b/drivers/media/common/tuners/qt1010.c | |||
@@ -64,24 +64,22 @@ static int qt1010_writereg(struct qt1010_priv *priv, u8 reg, u8 val) | |||
64 | /* dump all registers */ | 64 | /* dump all registers */ |
65 | static void qt1010_dump_regs(struct qt1010_priv *priv) | 65 | static void qt1010_dump_regs(struct qt1010_priv *priv) |
66 | { | 66 | { |
67 | char buf[52], buf2[4]; | ||
68 | u8 reg, val; | 67 | u8 reg, val; |
69 | 68 | ||
70 | for (reg = 0; ; reg++) { | 69 | for (reg = 0; ; reg++) { |
71 | if (reg % 16 == 0) { | 70 | if (reg % 16 == 0) { |
72 | if (reg) | 71 | if (reg) |
73 | printk("%s\n", buf); | 72 | printk(KERN_CONT "\n"); |
74 | sprintf(buf, "%02x: ", reg); | 73 | printk(KERN_DEBUG "%02x:", reg); |
75 | } | 74 | } |
76 | if (qt1010_readreg(priv, reg, &val) == 0) | 75 | if (qt1010_readreg(priv, reg, &val) == 0) |
77 | sprintf(buf2, "%02x ", val); | 76 | printk(KERN_CONT " %02x", val); |
78 | else | 77 | else |
79 | strcpy(buf2, "-- "); | 78 | printk(KERN_CONT " --"); |
80 | strcat(buf, buf2); | ||
81 | if (reg == 0x2f) | 79 | if (reg == 0x2f) |
82 | break; | 80 | break; |
83 | } | 81 | } |
84 | printk("%s\n", buf); | 82 | printk(KERN_CONT "\n"); |
85 | } | 83 | } |
86 | 84 | ||
87 | static int qt1010_set_params(struct dvb_frontend *fe, | 85 | static int qt1010_set_params(struct dvb_frontend *fe, |
diff --git a/drivers/media/common/tuners/tuner-xc2028.c b/drivers/media/common/tuners/tuner-xc2028.c index aa20ce8cc668..f270e605da83 100644 --- a/drivers/media/common/tuners/tuner-xc2028.c +++ b/drivers/media/common/tuners/tuner-xc2028.c | |||
@@ -1119,8 +1119,8 @@ static int xc2028_sleep(struct dvb_frontend *fe) | |||
1119 | struct xc2028_data *priv = fe->tuner_priv; | 1119 | struct xc2028_data *priv = fe->tuner_priv; |
1120 | int rc = 0; | 1120 | int rc = 0; |
1121 | 1121 | ||
1122 | /* Avoid firmware reload on slow devices */ | 1122 | /* Avoid firmware reload on slow devices or if PM disabled */ |
1123 | if (no_poweroff) | 1123 | if (no_poweroff || priv->ctrl.disable_power_mgmt) |
1124 | return 0; | 1124 | return 0; |
1125 | 1125 | ||
1126 | tuner_dbg("Putting xc2028/3028 into poweroff mode.\n"); | 1126 | tuner_dbg("Putting xc2028/3028 into poweroff mode.\n"); |
diff --git a/drivers/media/common/tuners/tuner-xc2028.h b/drivers/media/common/tuners/tuner-xc2028.h index 19de7928a74e..a90c35d50add 100644 --- a/drivers/media/common/tuners/tuner-xc2028.h +++ b/drivers/media/common/tuners/tuner-xc2028.h | |||
@@ -38,6 +38,7 @@ struct xc2028_ctrl { | |||
38 | unsigned int input1:1; | 38 | unsigned int input1:1; |
39 | unsigned int vhfbw7:1; | 39 | unsigned int vhfbw7:1; |
40 | unsigned int uhfbw8:1; | 40 | unsigned int uhfbw8:1; |
41 | unsigned int disable_power_mgmt:1; | ||
41 | unsigned int demod; | 42 | unsigned int demod; |
42 | enum firmware_type type:2; | 43 | enum firmware_type type:2; |
43 | }; | 44 | }; |
diff --git a/drivers/media/dvb/dvb-usb/af9015.c b/drivers/media/dvb/dvb-usb/af9015.c index 4cb31e7c13c2..26690dfb3260 100644 --- a/drivers/media/dvb/dvb-usb/af9015.c +++ b/drivers/media/dvb/dvb-usb/af9015.c | |||
@@ -81,7 +81,6 @@ static int af9015_rw_udev(struct usb_device *udev, struct req_t *req) | |||
81 | 81 | ||
82 | switch (req->cmd) { | 82 | switch (req->cmd) { |
83 | case GET_CONFIG: | 83 | case GET_CONFIG: |
84 | case BOOT: | ||
85 | case READ_MEMORY: | 84 | case READ_MEMORY: |
86 | case RECONNECT_USB: | 85 | case RECONNECT_USB: |
87 | case GET_IR_CODE: | 86 | case GET_IR_CODE: |
@@ -100,6 +99,7 @@ static int af9015_rw_udev(struct usb_device *udev, struct req_t *req) | |||
100 | case WRITE_VIRTUAL_MEMORY: | 99 | case WRITE_VIRTUAL_MEMORY: |
101 | case COPY_FIRMWARE: | 100 | case COPY_FIRMWARE: |
102 | case DOWNLOAD_FIRMWARE: | 101 | case DOWNLOAD_FIRMWARE: |
102 | case BOOT: | ||
103 | break; | 103 | break; |
104 | default: | 104 | default: |
105 | err("unknown command:%d", req->cmd); | 105 | err("unknown command:%d", req->cmd); |
diff --git a/drivers/media/dvb/frontends/cx22700.c b/drivers/media/dvb/frontends/cx22700.c index ace5cb17165d..fbd838eca268 100644 --- a/drivers/media/dvb/frontends/cx22700.c +++ b/drivers/media/dvb/frontends/cx22700.c | |||
@@ -380,7 +380,7 @@ struct dvb_frontend* cx22700_attach(const struct cx22700_config* config, | |||
380 | struct cx22700_state* state = NULL; | 380 | struct cx22700_state* state = NULL; |
381 | 381 | ||
382 | /* allocate memory for the internal state */ | 382 | /* allocate memory for the internal state */ |
383 | state = kmalloc(sizeof(struct cx22700_state), GFP_KERNEL); | 383 | state = kzalloc(sizeof(struct cx22700_state), GFP_KERNEL); |
384 | if (state == NULL) goto error; | 384 | if (state == NULL) goto error; |
385 | 385 | ||
386 | /* setup the state */ | 386 | /* setup the state */ |
diff --git a/drivers/media/dvb/frontends/cx22702.c b/drivers/media/dvb/frontends/cx22702.c index 5d1abe34bddb..00b5c7e91d5d 100644 --- a/drivers/media/dvb/frontends/cx22702.c +++ b/drivers/media/dvb/frontends/cx22702.c | |||
@@ -580,7 +580,7 @@ struct dvb_frontend *cx22702_attach(const struct cx22702_config *config, | |||
580 | struct cx22702_state *state = NULL; | 580 | struct cx22702_state *state = NULL; |
581 | 581 | ||
582 | /* allocate memory for the internal state */ | 582 | /* allocate memory for the internal state */ |
583 | state = kmalloc(sizeof(struct cx22702_state), GFP_KERNEL); | 583 | state = kzalloc(sizeof(struct cx22702_state), GFP_KERNEL); |
584 | if (state == NULL) | 584 | if (state == NULL) |
585 | goto error; | 585 | goto error; |
586 | 586 | ||
diff --git a/drivers/media/dvb/frontends/cx24110.c b/drivers/media/dvb/frontends/cx24110.c index 87ae29db024f..ffbcfabd83f0 100644 --- a/drivers/media/dvb/frontends/cx24110.c +++ b/drivers/media/dvb/frontends/cx24110.c | |||
@@ -598,7 +598,7 @@ struct dvb_frontend* cx24110_attach(const struct cx24110_config* config, | |||
598 | int ret; | 598 | int ret; |
599 | 599 | ||
600 | /* allocate memory for the internal state */ | 600 | /* allocate memory for the internal state */ |
601 | state = kmalloc(sizeof(struct cx24110_state), GFP_KERNEL); | 601 | state = kzalloc(sizeof(struct cx24110_state), GFP_KERNEL); |
602 | if (state == NULL) goto error; | 602 | if (state == NULL) goto error; |
603 | 603 | ||
604 | /* setup the state */ | 604 | /* setup the state */ |
diff --git a/drivers/media/dvb/frontends/dvb_dummy_fe.c b/drivers/media/dvb/frontends/dvb_dummy_fe.c index db8a937cc630..a7fc7e53a551 100644 --- a/drivers/media/dvb/frontends/dvb_dummy_fe.c +++ b/drivers/media/dvb/frontends/dvb_dummy_fe.c | |||
@@ -117,7 +117,7 @@ struct dvb_frontend* dvb_dummy_fe_ofdm_attach(void) | |||
117 | struct dvb_dummy_fe_state* state = NULL; | 117 | struct dvb_dummy_fe_state* state = NULL; |
118 | 118 | ||
119 | /* allocate memory for the internal state */ | 119 | /* allocate memory for the internal state */ |
120 | state = kmalloc(sizeof(struct dvb_dummy_fe_state), GFP_KERNEL); | 120 | state = kzalloc(sizeof(struct dvb_dummy_fe_state), GFP_KERNEL); |
121 | if (state == NULL) goto error; | 121 | if (state == NULL) goto error; |
122 | 122 | ||
123 | /* create dvb_frontend */ | 123 | /* create dvb_frontend */ |
@@ -137,7 +137,7 @@ struct dvb_frontend *dvb_dummy_fe_qpsk_attach(void) | |||
137 | struct dvb_dummy_fe_state* state = NULL; | 137 | struct dvb_dummy_fe_state* state = NULL; |
138 | 138 | ||
139 | /* allocate memory for the internal state */ | 139 | /* allocate memory for the internal state */ |
140 | state = kmalloc(sizeof(struct dvb_dummy_fe_state), GFP_KERNEL); | 140 | state = kzalloc(sizeof(struct dvb_dummy_fe_state), GFP_KERNEL); |
141 | if (state == NULL) goto error; | 141 | if (state == NULL) goto error; |
142 | 142 | ||
143 | /* create dvb_frontend */ | 143 | /* create dvb_frontend */ |
@@ -157,7 +157,7 @@ struct dvb_frontend *dvb_dummy_fe_qam_attach(void) | |||
157 | struct dvb_dummy_fe_state* state = NULL; | 157 | struct dvb_dummy_fe_state* state = NULL; |
158 | 158 | ||
159 | /* allocate memory for the internal state */ | 159 | /* allocate memory for the internal state */ |
160 | state = kmalloc(sizeof(struct dvb_dummy_fe_state), GFP_KERNEL); | 160 | state = kzalloc(sizeof(struct dvb_dummy_fe_state), GFP_KERNEL); |
161 | if (state == NULL) goto error; | 161 | if (state == NULL) goto error; |
162 | 162 | ||
163 | /* create dvb_frontend */ | 163 | /* create dvb_frontend */ |
diff --git a/drivers/media/dvb/frontends/l64781.c b/drivers/media/dvb/frontends/l64781.c index e1e70e9e0cb9..3051b64aa17c 100644 --- a/drivers/media/dvb/frontends/l64781.c +++ b/drivers/media/dvb/frontends/l64781.c | |||
@@ -501,7 +501,7 @@ struct dvb_frontend* l64781_attach(const struct l64781_config* config, | |||
501 | { .addr = config->demod_address, .flags = I2C_M_RD, .buf = b1, .len = 1 } }; | 501 | { .addr = config->demod_address, .flags = I2C_M_RD, .buf = b1, .len = 1 } }; |
502 | 502 | ||
503 | /* allocate memory for the internal state */ | 503 | /* allocate memory for the internal state */ |
504 | state = kmalloc(sizeof(struct l64781_state), GFP_KERNEL); | 504 | state = kzalloc(sizeof(struct l64781_state), GFP_KERNEL); |
505 | if (state == NULL) goto error; | 505 | if (state == NULL) goto error; |
506 | 506 | ||
507 | /* setup the state */ | 507 | /* setup the state */ |
diff --git a/drivers/media/dvb/frontends/lgs8gl5.c b/drivers/media/dvb/frontends/lgs8gl5.c index 855852fddf22..bb37ed289a05 100644 --- a/drivers/media/dvb/frontends/lgs8gl5.c +++ b/drivers/media/dvb/frontends/lgs8gl5.c | |||
@@ -387,7 +387,7 @@ lgs8gl5_attach(const struct lgs8gl5_config *config, struct i2c_adapter *i2c) | |||
387 | dprintk("%s\n", __func__); | 387 | dprintk("%s\n", __func__); |
388 | 388 | ||
389 | /* Allocate memory for the internal state */ | 389 | /* Allocate memory for the internal state */ |
390 | state = kmalloc(sizeof(struct lgs8gl5_state), GFP_KERNEL); | 390 | state = kzalloc(sizeof(struct lgs8gl5_state), GFP_KERNEL); |
391 | if (state == NULL) | 391 | if (state == NULL) |
392 | goto error; | 392 | goto error; |
393 | 393 | ||
diff --git a/drivers/media/dvb/frontends/mt312.c b/drivers/media/dvb/frontends/mt312.c index a621f727935f..f69daaac78c9 100644 --- a/drivers/media/dvb/frontends/mt312.c +++ b/drivers/media/dvb/frontends/mt312.c | |||
@@ -782,7 +782,7 @@ struct dvb_frontend *mt312_attach(const struct mt312_config *config, | |||
782 | struct mt312_state *state = NULL; | 782 | struct mt312_state *state = NULL; |
783 | 783 | ||
784 | /* allocate memory for the internal state */ | 784 | /* allocate memory for the internal state */ |
785 | state = kmalloc(sizeof(struct mt312_state), GFP_KERNEL); | 785 | state = kzalloc(sizeof(struct mt312_state), GFP_KERNEL); |
786 | if (state == NULL) | 786 | if (state == NULL) |
787 | goto error; | 787 | goto error; |
788 | 788 | ||
diff --git a/drivers/media/dvb/frontends/nxt6000.c b/drivers/media/dvb/frontends/nxt6000.c index 0eef22dbf8a0..a763ec756f7f 100644 --- a/drivers/media/dvb/frontends/nxt6000.c +++ b/drivers/media/dvb/frontends/nxt6000.c | |||
@@ -545,7 +545,7 @@ struct dvb_frontend* nxt6000_attach(const struct nxt6000_config* config, | |||
545 | struct nxt6000_state* state = NULL; | 545 | struct nxt6000_state* state = NULL; |
546 | 546 | ||
547 | /* allocate memory for the internal state */ | 547 | /* allocate memory for the internal state */ |
548 | state = kmalloc(sizeof(struct nxt6000_state), GFP_KERNEL); | 548 | state = kzalloc(sizeof(struct nxt6000_state), GFP_KERNEL); |
549 | if (state == NULL) goto error; | 549 | if (state == NULL) goto error; |
550 | 550 | ||
551 | /* setup the state */ | 551 | /* setup the state */ |
diff --git a/drivers/media/dvb/frontends/or51132.c b/drivers/media/dvb/frontends/or51132.c index 8133ea3cddd7..38e67accb8c3 100644 --- a/drivers/media/dvb/frontends/or51132.c +++ b/drivers/media/dvb/frontends/or51132.c | |||
@@ -562,7 +562,7 @@ struct dvb_frontend* or51132_attach(const struct or51132_config* config, | |||
562 | struct or51132_state* state = NULL; | 562 | struct or51132_state* state = NULL; |
563 | 563 | ||
564 | /* Allocate memory for the internal state */ | 564 | /* Allocate memory for the internal state */ |
565 | state = kmalloc(sizeof(struct or51132_state), GFP_KERNEL); | 565 | state = kzalloc(sizeof(struct or51132_state), GFP_KERNEL); |
566 | if (state == NULL) | 566 | if (state == NULL) |
567 | return NULL; | 567 | return NULL; |
568 | 568 | ||
diff --git a/drivers/media/dvb/frontends/or51211.c b/drivers/media/dvb/frontends/or51211.c index 16cf2fdd5d7d..c709ce6771c8 100644 --- a/drivers/media/dvb/frontends/or51211.c +++ b/drivers/media/dvb/frontends/or51211.c | |||
@@ -527,7 +527,7 @@ struct dvb_frontend* or51211_attach(const struct or51211_config* config, | |||
527 | struct or51211_state* state = NULL; | 527 | struct or51211_state* state = NULL; |
528 | 528 | ||
529 | /* Allocate memory for the internal state */ | 529 | /* Allocate memory for the internal state */ |
530 | state = kmalloc(sizeof(struct or51211_state), GFP_KERNEL); | 530 | state = kzalloc(sizeof(struct or51211_state), GFP_KERNEL); |
531 | if (state == NULL) | 531 | if (state == NULL) |
532 | return NULL; | 532 | return NULL; |
533 | 533 | ||
diff --git a/drivers/media/dvb/frontends/s5h1409.c b/drivers/media/dvb/frontends/s5h1409.c index 3e08d985d6e5..fb3011518427 100644 --- a/drivers/media/dvb/frontends/s5h1409.c +++ b/drivers/media/dvb/frontends/s5h1409.c | |||
@@ -796,7 +796,7 @@ struct dvb_frontend *s5h1409_attach(const struct s5h1409_config *config, | |||
796 | u16 reg; | 796 | u16 reg; |
797 | 797 | ||
798 | /* allocate memory for the internal state */ | 798 | /* allocate memory for the internal state */ |
799 | state = kmalloc(sizeof(struct s5h1409_state), GFP_KERNEL); | 799 | state = kzalloc(sizeof(struct s5h1409_state), GFP_KERNEL); |
800 | if (state == NULL) | 800 | if (state == NULL) |
801 | goto error; | 801 | goto error; |
802 | 802 | ||
diff --git a/drivers/media/dvb/frontends/s5h1411.c b/drivers/media/dvb/frontends/s5h1411.c index 66e2dd6d6fe4..d8adf1e32019 100644 --- a/drivers/media/dvb/frontends/s5h1411.c +++ b/drivers/media/dvb/frontends/s5h1411.c | |||
@@ -844,7 +844,7 @@ struct dvb_frontend *s5h1411_attach(const struct s5h1411_config *config, | |||
844 | u16 reg; | 844 | u16 reg; |
845 | 845 | ||
846 | /* allocate memory for the internal state */ | 846 | /* allocate memory for the internal state */ |
847 | state = kmalloc(sizeof(struct s5h1411_state), GFP_KERNEL); | 847 | state = kzalloc(sizeof(struct s5h1411_state), GFP_KERNEL); |
848 | if (state == NULL) | 848 | if (state == NULL) |
849 | goto error; | 849 | goto error; |
850 | 850 | ||
diff --git a/drivers/media/dvb/frontends/si21xx.c b/drivers/media/dvb/frontends/si21xx.c index 0bd16af8a6cd..9552a22ccffb 100644 --- a/drivers/media/dvb/frontends/si21xx.c +++ b/drivers/media/dvb/frontends/si21xx.c | |||
@@ -928,7 +928,7 @@ struct dvb_frontend *si21xx_attach(const struct si21xx_config *config, | |||
928 | dprintk("%s\n", __func__); | 928 | dprintk("%s\n", __func__); |
929 | 929 | ||
930 | /* allocate memory for the internal state */ | 930 | /* allocate memory for the internal state */ |
931 | state = kmalloc(sizeof(struct si21xx_state), GFP_KERNEL); | 931 | state = kzalloc(sizeof(struct si21xx_state), GFP_KERNEL); |
932 | if (state == NULL) | 932 | if (state == NULL) |
933 | goto error; | 933 | goto error; |
934 | 934 | ||
diff --git a/drivers/media/dvb/frontends/sp8870.c b/drivers/media/dvb/frontends/sp8870.c index 1c9a9b4051b9..b85eb60a893e 100644 --- a/drivers/media/dvb/frontends/sp8870.c +++ b/drivers/media/dvb/frontends/sp8870.c | |||
@@ -557,7 +557,7 @@ struct dvb_frontend* sp8870_attach(const struct sp8870_config* config, | |||
557 | struct sp8870_state* state = NULL; | 557 | struct sp8870_state* state = NULL; |
558 | 558 | ||
559 | /* allocate memory for the internal state */ | 559 | /* allocate memory for the internal state */ |
560 | state = kmalloc(sizeof(struct sp8870_state), GFP_KERNEL); | 560 | state = kzalloc(sizeof(struct sp8870_state), GFP_KERNEL); |
561 | if (state == NULL) goto error; | 561 | if (state == NULL) goto error; |
562 | 562 | ||
563 | /* setup the state */ | 563 | /* setup the state */ |
diff --git a/drivers/media/dvb/frontends/sp887x.c b/drivers/media/dvb/frontends/sp887x.c index 559509ab4dab..4a7c3d842608 100644 --- a/drivers/media/dvb/frontends/sp887x.c +++ b/drivers/media/dvb/frontends/sp887x.c | |||
@@ -557,7 +557,7 @@ struct dvb_frontend* sp887x_attach(const struct sp887x_config* config, | |||
557 | struct sp887x_state* state = NULL; | 557 | struct sp887x_state* state = NULL; |
558 | 558 | ||
559 | /* allocate memory for the internal state */ | 559 | /* allocate memory for the internal state */ |
560 | state = kmalloc(sizeof(struct sp887x_state), GFP_KERNEL); | 560 | state = kzalloc(sizeof(struct sp887x_state), GFP_KERNEL); |
561 | if (state == NULL) goto error; | 561 | if (state == NULL) goto error; |
562 | 562 | ||
563 | /* setup the state */ | 563 | /* setup the state */ |
diff --git a/drivers/media/dvb/frontends/stv0288.c b/drivers/media/dvb/frontends/stv0288.c index ff1194de34c0..2930a5d6768a 100644 --- a/drivers/media/dvb/frontends/stv0288.c +++ b/drivers/media/dvb/frontends/stv0288.c | |||
@@ -570,7 +570,7 @@ struct dvb_frontend *stv0288_attach(const struct stv0288_config *config, | |||
570 | int id; | 570 | int id; |
571 | 571 | ||
572 | /* allocate memory for the internal state */ | 572 | /* allocate memory for the internal state */ |
573 | state = kmalloc(sizeof(struct stv0288_state), GFP_KERNEL); | 573 | state = kzalloc(sizeof(struct stv0288_state), GFP_KERNEL); |
574 | if (state == NULL) | 574 | if (state == NULL) |
575 | goto error; | 575 | goto error; |
576 | 576 | ||
diff --git a/drivers/media/dvb/frontends/stv0297.c b/drivers/media/dvb/frontends/stv0297.c index 62caf802ed99..4fd7479bb62b 100644 --- a/drivers/media/dvb/frontends/stv0297.c +++ b/drivers/media/dvb/frontends/stv0297.c | |||
@@ -663,7 +663,7 @@ struct dvb_frontend *stv0297_attach(const struct stv0297_config *config, | |||
663 | struct stv0297_state *state = NULL; | 663 | struct stv0297_state *state = NULL; |
664 | 664 | ||
665 | /* allocate memory for the internal state */ | 665 | /* allocate memory for the internal state */ |
666 | state = kmalloc(sizeof(struct stv0297_state), GFP_KERNEL); | 666 | state = kzalloc(sizeof(struct stv0297_state), GFP_KERNEL); |
667 | if (state == NULL) | 667 | if (state == NULL) |
668 | goto error; | 668 | goto error; |
669 | 669 | ||
diff --git a/drivers/media/dvb/frontends/stv0299.c b/drivers/media/dvb/frontends/stv0299.c index 6c1cb1973c6e..968874469726 100644 --- a/drivers/media/dvb/frontends/stv0299.c +++ b/drivers/media/dvb/frontends/stv0299.c | |||
@@ -667,7 +667,7 @@ struct dvb_frontend* stv0299_attach(const struct stv0299_config* config, | |||
667 | int id; | 667 | int id; |
668 | 668 | ||
669 | /* allocate memory for the internal state */ | 669 | /* allocate memory for the internal state */ |
670 | state = kmalloc(sizeof(struct stv0299_state), GFP_KERNEL); | 670 | state = kzalloc(sizeof(struct stv0299_state), GFP_KERNEL); |
671 | if (state == NULL) goto error; | 671 | if (state == NULL) goto error; |
672 | 672 | ||
673 | /* setup the state */ | 673 | /* setup the state */ |
diff --git a/drivers/media/dvb/frontends/tda10021.c b/drivers/media/dvb/frontends/tda10021.c index f648fdb64bb7..f5d7b3277a2f 100644 --- a/drivers/media/dvb/frontends/tda10021.c +++ b/drivers/media/dvb/frontends/tda10021.c | |||
@@ -413,7 +413,7 @@ struct dvb_frontend* tda10021_attach(const struct tda1002x_config* config, | |||
413 | u8 id; | 413 | u8 id; |
414 | 414 | ||
415 | /* allocate memory for the internal state */ | 415 | /* allocate memory for the internal state */ |
416 | state = kmalloc(sizeof(struct tda10021_state), GFP_KERNEL); | 416 | state = kzalloc(sizeof(struct tda10021_state), GFP_KERNEL); |
417 | if (state == NULL) goto error; | 417 | if (state == NULL) goto error; |
418 | 418 | ||
419 | /* setup the state */ | 419 | /* setup the state */ |
diff --git a/drivers/media/dvb/frontends/tda10048.c b/drivers/media/dvb/frontends/tda10048.c index cc8862ce4aae..4e2a7c8b2f62 100644 --- a/drivers/media/dvb/frontends/tda10048.c +++ b/drivers/media/dvb/frontends/tda10048.c | |||
@@ -1095,7 +1095,7 @@ struct dvb_frontend *tda10048_attach(const struct tda10048_config *config, | |||
1095 | dprintk(1, "%s()\n", __func__); | 1095 | dprintk(1, "%s()\n", __func__); |
1096 | 1096 | ||
1097 | /* allocate memory for the internal state */ | 1097 | /* allocate memory for the internal state */ |
1098 | state = kmalloc(sizeof(struct tda10048_state), GFP_KERNEL); | 1098 | state = kzalloc(sizeof(struct tda10048_state), GFP_KERNEL); |
1099 | if (state == NULL) | 1099 | if (state == NULL) |
1100 | goto error; | 1100 | goto error; |
1101 | 1101 | ||
diff --git a/drivers/media/dvb/frontends/tda1004x.c b/drivers/media/dvb/frontends/tda1004x.c index 4981cef8b444..f2a8abe0a243 100644 --- a/drivers/media/dvb/frontends/tda1004x.c +++ b/drivers/media/dvb/frontends/tda1004x.c | |||
@@ -1269,7 +1269,7 @@ struct dvb_frontend* tda10045_attach(const struct tda1004x_config* config, | |||
1269 | int id; | 1269 | int id; |
1270 | 1270 | ||
1271 | /* allocate memory for the internal state */ | 1271 | /* allocate memory for the internal state */ |
1272 | state = kmalloc(sizeof(struct tda1004x_state), GFP_KERNEL); | 1272 | state = kzalloc(sizeof(struct tda1004x_state), GFP_KERNEL); |
1273 | if (!state) { | 1273 | if (!state) { |
1274 | printk(KERN_ERR "Can't alocate memory for tda10045 state\n"); | 1274 | printk(KERN_ERR "Can't alocate memory for tda10045 state\n"); |
1275 | return NULL; | 1275 | return NULL; |
@@ -1339,7 +1339,7 @@ struct dvb_frontend* tda10046_attach(const struct tda1004x_config* config, | |||
1339 | int id; | 1339 | int id; |
1340 | 1340 | ||
1341 | /* allocate memory for the internal state */ | 1341 | /* allocate memory for the internal state */ |
1342 | state = kmalloc(sizeof(struct tda1004x_state), GFP_KERNEL); | 1342 | state = kzalloc(sizeof(struct tda1004x_state), GFP_KERNEL); |
1343 | if (!state) { | 1343 | if (!state) { |
1344 | printk(KERN_ERR "Can't alocate memory for tda10046 state\n"); | 1344 | printk(KERN_ERR "Can't alocate memory for tda10046 state\n"); |
1345 | return NULL; | 1345 | return NULL; |
diff --git a/drivers/media/dvb/frontends/tda10086.c b/drivers/media/dvb/frontends/tda10086.c index a17ce3c4ad86..f2c8faac6f36 100644 --- a/drivers/media/dvb/frontends/tda10086.c +++ b/drivers/media/dvb/frontends/tda10086.c | |||
@@ -745,7 +745,7 @@ struct dvb_frontend* tda10086_attach(const struct tda10086_config* config, | |||
745 | dprintk ("%s\n", __func__); | 745 | dprintk ("%s\n", __func__); |
746 | 746 | ||
747 | /* allocate memory for the internal state */ | 747 | /* allocate memory for the internal state */ |
748 | state = kmalloc(sizeof(struct tda10086_state), GFP_KERNEL); | 748 | state = kzalloc(sizeof(struct tda10086_state), GFP_KERNEL); |
749 | if (!state) | 749 | if (!state) |
750 | return NULL; | 750 | return NULL; |
751 | 751 | ||
diff --git a/drivers/media/dvb/frontends/tda8083.c b/drivers/media/dvb/frontends/tda8083.c index 5b843b2e67e8..9369f7442f27 100644 --- a/drivers/media/dvb/frontends/tda8083.c +++ b/drivers/media/dvb/frontends/tda8083.c | |||
@@ -417,7 +417,7 @@ struct dvb_frontend* tda8083_attach(const struct tda8083_config* config, | |||
417 | struct tda8083_state* state = NULL; | 417 | struct tda8083_state* state = NULL; |
418 | 418 | ||
419 | /* allocate memory for the internal state */ | 419 | /* allocate memory for the internal state */ |
420 | state = kmalloc(sizeof(struct tda8083_state), GFP_KERNEL); | 420 | state = kzalloc(sizeof(struct tda8083_state), GFP_KERNEL); |
421 | if (state == NULL) goto error; | 421 | if (state == NULL) goto error; |
422 | 422 | ||
423 | /* setup the state */ | 423 | /* setup the state */ |
diff --git a/drivers/media/dvb/frontends/ves1820.c b/drivers/media/dvb/frontends/ves1820.c index a184597f1d9b..6e78e4865515 100644 --- a/drivers/media/dvb/frontends/ves1820.c +++ b/drivers/media/dvb/frontends/ves1820.c | |||
@@ -374,7 +374,7 @@ struct dvb_frontend* ves1820_attach(const struct ves1820_config* config, | |||
374 | struct ves1820_state* state = NULL; | 374 | struct ves1820_state* state = NULL; |
375 | 375 | ||
376 | /* allocate memory for the internal state */ | 376 | /* allocate memory for the internal state */ |
377 | state = kmalloc(sizeof(struct ves1820_state), GFP_KERNEL); | 377 | state = kzalloc(sizeof(struct ves1820_state), GFP_KERNEL); |
378 | if (state == NULL) | 378 | if (state == NULL) |
379 | goto error; | 379 | goto error; |
380 | 380 | ||
diff --git a/drivers/media/dvb/frontends/ves1x93.c b/drivers/media/dvb/frontends/ves1x93.c index bd558960bd87..8d7854c2fb0c 100644 --- a/drivers/media/dvb/frontends/ves1x93.c +++ b/drivers/media/dvb/frontends/ves1x93.c | |||
@@ -456,7 +456,7 @@ struct dvb_frontend* ves1x93_attach(const struct ves1x93_config* config, | |||
456 | u8 identity; | 456 | u8 identity; |
457 | 457 | ||
458 | /* allocate memory for the internal state */ | 458 | /* allocate memory for the internal state */ |
459 | state = kmalloc(sizeof(struct ves1x93_state), GFP_KERNEL); | 459 | state = kzalloc(sizeof(struct ves1x93_state), GFP_KERNEL); |
460 | if (state == NULL) goto error; | 460 | if (state == NULL) goto error; |
461 | 461 | ||
462 | /* setup the state */ | 462 | /* setup the state */ |
diff --git a/drivers/media/dvb/frontends/zl10353.c b/drivers/media/dvb/frontends/zl10353.c index 148b6f7f6cb2..66f5c1fb3074 100644 --- a/drivers/media/dvb/frontends/zl10353.c +++ b/drivers/media/dvb/frontends/zl10353.c | |||
@@ -98,7 +98,6 @@ static int zl10353_read_register(struct zl10353_state *state, u8 reg) | |||
98 | static void zl10353_dump_regs(struct dvb_frontend *fe) | 98 | static void zl10353_dump_regs(struct dvb_frontend *fe) |
99 | { | 99 | { |
100 | struct zl10353_state *state = fe->demodulator_priv; | 100 | struct zl10353_state *state = fe->demodulator_priv; |
101 | char buf[52], buf2[4]; | ||
102 | int ret; | 101 | int ret; |
103 | u8 reg; | 102 | u8 reg; |
104 | 103 | ||
@@ -106,19 +105,18 @@ static void zl10353_dump_regs(struct dvb_frontend *fe) | |||
106 | for (reg = 0; ; reg++) { | 105 | for (reg = 0; ; reg++) { |
107 | if (reg % 16 == 0) { | 106 | if (reg % 16 == 0) { |
108 | if (reg) | 107 | if (reg) |
109 | printk(KERN_DEBUG "%s\n", buf); | 108 | printk(KERN_CONT "\n"); |
110 | sprintf(buf, "%02x: ", reg); | 109 | printk(KERN_DEBUG "%02x:", reg); |
111 | } | 110 | } |
112 | ret = zl10353_read_register(state, reg); | 111 | ret = zl10353_read_register(state, reg); |
113 | if (ret >= 0) | 112 | if (ret >= 0) |
114 | sprintf(buf2, "%02x ", (u8)ret); | 113 | printk(KERN_CONT " %02x", (u8)ret); |
115 | else | 114 | else |
116 | strcpy(buf2, "-- "); | 115 | printk(KERN_CONT " --"); |
117 | strcat(buf, buf2); | ||
118 | if (reg == 0xff) | 116 | if (reg == 0xff) |
119 | break; | 117 | break; |
120 | } | 118 | } |
121 | printk(KERN_DEBUG "%s\n", buf); | 119 | printk(KERN_CONT "\n"); |
122 | } | 120 | } |
123 | 121 | ||
124 | static void zl10353_calc_nominal_rate(struct dvb_frontend *fe, | 122 | static void zl10353_calc_nominal_rate(struct dvb_frontend *fe, |
diff --git a/drivers/media/dvb/siano/Kconfig b/drivers/media/dvb/siano/Kconfig index dd863f261672..88847d1dcbb5 100644 --- a/drivers/media/dvb/siano/Kconfig +++ b/drivers/media/dvb/siano/Kconfig | |||
@@ -4,7 +4,7 @@ | |||
4 | 4 | ||
5 | config DVB_SIANO_SMS1XXX | 5 | config DVB_SIANO_SMS1XXX |
6 | tristate "Siano SMS1XXX USB dongle support" | 6 | tristate "Siano SMS1XXX USB dongle support" |
7 | depends on DVB_CORE && USB | 7 | depends on DVB_CORE && USB && INPUT |
8 | ---help--- | 8 | ---help--- |
9 | Choose Y here if you have a USB dongle with a SMS1XXX chipset. | 9 | Choose Y here if you have a USB dongle with a SMS1XXX chipset. |
10 | 10 | ||
diff --git a/drivers/media/dvb/siano/sms-cards.c b/drivers/media/dvb/siano/sms-cards.c index d8b15d583bde..0420e2885e75 100644 --- a/drivers/media/dvb/siano/sms-cards.c +++ b/drivers/media/dvb/siano/sms-cards.c | |||
@@ -116,99 +116,21 @@ static inline void sms_gpio_assign_11xx_default_led_config( | |||
116 | 116 | ||
117 | int sms_board_event(struct smscore_device_t *coredev, | 117 | int sms_board_event(struct smscore_device_t *coredev, |
118 | enum SMS_BOARD_EVENTS gevent) { | 118 | enum SMS_BOARD_EVENTS gevent) { |
119 | int board_id = smscore_get_board_id(coredev); | ||
120 | struct sms_board *board = sms_get_board(board_id); | ||
121 | struct smscore_gpio_config MyGpioConfig; | 119 | struct smscore_gpio_config MyGpioConfig; |
122 | 120 | ||
123 | sms_gpio_assign_11xx_default_led_config(&MyGpioConfig); | 121 | sms_gpio_assign_11xx_default_led_config(&MyGpioConfig); |
124 | 122 | ||
125 | switch (gevent) { | 123 | switch (gevent) { |
126 | case BOARD_EVENT_POWER_INIT: /* including hotplug */ | 124 | case BOARD_EVENT_POWER_INIT: /* including hotplug */ |
127 | switch (board_id) { | ||
128 | case SMS1XXX_BOARD_HAUPPAUGE_WINDHAM: | ||
129 | /* set I/O and turn off all LEDs */ | ||
130 | smscore_gpio_configure(coredev, | ||
131 | board->board_cfg.leds_power, | ||
132 | &MyGpioConfig); | ||
133 | smscore_gpio_set_level(coredev, | ||
134 | board->board_cfg.leds_power, 0); | ||
135 | smscore_gpio_configure(coredev, board->board_cfg.led0, | ||
136 | &MyGpioConfig); | ||
137 | smscore_gpio_set_level(coredev, | ||
138 | board->board_cfg.led0, 0); | ||
139 | smscore_gpio_configure(coredev, board->board_cfg.led1, | ||
140 | &MyGpioConfig); | ||
141 | smscore_gpio_set_level(coredev, | ||
142 | board->board_cfg.led1, 0); | ||
143 | break; | ||
144 | case SMS1XXX_BOARD_HAUPPAUGE_TIGER_MINICARD_R2: | ||
145 | case SMS1XXX_BOARD_HAUPPAUGE_TIGER_MINICARD: | ||
146 | /* set I/O and turn off LNA */ | ||
147 | smscore_gpio_configure(coredev, | ||
148 | board->board_cfg.foreign_lna0_ctrl, | ||
149 | &MyGpioConfig); | ||
150 | smscore_gpio_set_level(coredev, | ||
151 | board->board_cfg.foreign_lna0_ctrl, | ||
152 | 0); | ||
153 | break; | ||
154 | } | ||
155 | break; /* BOARD_EVENT_BIND */ | 125 | break; /* BOARD_EVENT_BIND */ |
156 | 126 | ||
157 | case BOARD_EVENT_POWER_SUSPEND: | 127 | case BOARD_EVENT_POWER_SUSPEND: |
158 | switch (board_id) { | ||
159 | case SMS1XXX_BOARD_HAUPPAUGE_WINDHAM: | ||
160 | smscore_gpio_set_level(coredev, | ||
161 | board->board_cfg.leds_power, 0); | ||
162 | smscore_gpio_set_level(coredev, | ||
163 | board->board_cfg.led0, 0); | ||
164 | smscore_gpio_set_level(coredev, | ||
165 | board->board_cfg.led1, 0); | ||
166 | break; | ||
167 | case SMS1XXX_BOARD_HAUPPAUGE_TIGER_MINICARD_R2: | ||
168 | case SMS1XXX_BOARD_HAUPPAUGE_TIGER_MINICARD: | ||
169 | smscore_gpio_set_level(coredev, | ||
170 | board->board_cfg.foreign_lna0_ctrl, | ||
171 | 0); | ||
172 | break; | ||
173 | } | ||
174 | break; /* BOARD_EVENT_POWER_SUSPEND */ | 128 | break; /* BOARD_EVENT_POWER_SUSPEND */ |
175 | 129 | ||
176 | case BOARD_EVENT_POWER_RESUME: | 130 | case BOARD_EVENT_POWER_RESUME: |
177 | switch (board_id) { | ||
178 | case SMS1XXX_BOARD_HAUPPAUGE_WINDHAM: | ||
179 | smscore_gpio_set_level(coredev, | ||
180 | board->board_cfg.leds_power, 1); | ||
181 | smscore_gpio_set_level(coredev, | ||
182 | board->board_cfg.led0, 1); | ||
183 | smscore_gpio_set_level(coredev, | ||
184 | board->board_cfg.led1, 0); | ||
185 | break; | ||
186 | case SMS1XXX_BOARD_HAUPPAUGE_TIGER_MINICARD_R2: | ||
187 | case SMS1XXX_BOARD_HAUPPAUGE_TIGER_MINICARD: | ||
188 | smscore_gpio_set_level(coredev, | ||
189 | board->board_cfg.foreign_lna0_ctrl, | ||
190 | 1); | ||
191 | break; | ||
192 | } | ||
193 | break; /* BOARD_EVENT_POWER_RESUME */ | 131 | break; /* BOARD_EVENT_POWER_RESUME */ |
194 | 132 | ||
195 | case BOARD_EVENT_BIND: | 133 | case BOARD_EVENT_BIND: |
196 | switch (board_id) { | ||
197 | case SMS1XXX_BOARD_HAUPPAUGE_WINDHAM: | ||
198 | smscore_gpio_set_level(coredev, | ||
199 | board->board_cfg.leds_power, 1); | ||
200 | smscore_gpio_set_level(coredev, | ||
201 | board->board_cfg.led0, 1); | ||
202 | smscore_gpio_set_level(coredev, | ||
203 | board->board_cfg.led1, 0); | ||
204 | break; | ||
205 | case SMS1XXX_BOARD_HAUPPAUGE_TIGER_MINICARD_R2: | ||
206 | case SMS1XXX_BOARD_HAUPPAUGE_TIGER_MINICARD: | ||
207 | smscore_gpio_set_level(coredev, | ||
208 | board->board_cfg.foreign_lna0_ctrl, | ||
209 | 1); | ||
210 | break; | ||
211 | } | ||
212 | break; /* BOARD_EVENT_BIND */ | 134 | break; /* BOARD_EVENT_BIND */ |
213 | 135 | ||
214 | case BOARD_EVENT_SCAN_PROG: | 136 | case BOARD_EVENT_SCAN_PROG: |
@@ -218,20 +140,8 @@ int sms_board_event(struct smscore_device_t *coredev, | |||
218 | case BOARD_EVENT_EMERGENCY_WARNING_SIGNAL: | 140 | case BOARD_EVENT_EMERGENCY_WARNING_SIGNAL: |
219 | break; /* BOARD_EVENT_EMERGENCY_WARNING_SIGNAL */ | 141 | break; /* BOARD_EVENT_EMERGENCY_WARNING_SIGNAL */ |
220 | case BOARD_EVENT_FE_LOCK: | 142 | case BOARD_EVENT_FE_LOCK: |
221 | switch (board_id) { | ||
222 | case SMS1XXX_BOARD_HAUPPAUGE_WINDHAM: | ||
223 | smscore_gpio_set_level(coredev, | ||
224 | board->board_cfg.led1, 1); | ||
225 | break; | ||
226 | } | ||
227 | break; /* BOARD_EVENT_FE_LOCK */ | 143 | break; /* BOARD_EVENT_FE_LOCK */ |
228 | case BOARD_EVENT_FE_UNLOCK: | 144 | case BOARD_EVENT_FE_UNLOCK: |
229 | switch (board_id) { | ||
230 | case SMS1XXX_BOARD_HAUPPAUGE_WINDHAM: | ||
231 | smscore_gpio_set_level(coredev, | ||
232 | board->board_cfg.led1, 0); | ||
233 | break; | ||
234 | } | ||
235 | break; /* BOARD_EVENT_FE_UNLOCK */ | 145 | break; /* BOARD_EVENT_FE_UNLOCK */ |
236 | case BOARD_EVENT_DEMOD_LOCK: | 146 | case BOARD_EVENT_DEMOD_LOCK: |
237 | break; /* BOARD_EVENT_DEMOD_LOCK */ | 147 | break; /* BOARD_EVENT_DEMOD_LOCK */ |
@@ -248,20 +158,8 @@ int sms_board_event(struct smscore_device_t *coredev, | |||
248 | case BOARD_EVENT_RECEPTION_LOST_0: | 158 | case BOARD_EVENT_RECEPTION_LOST_0: |
249 | break; /* BOARD_EVENT_RECEPTION_LOST_0 */ | 159 | break; /* BOARD_EVENT_RECEPTION_LOST_0 */ |
250 | case BOARD_EVENT_MULTIPLEX_OK: | 160 | case BOARD_EVENT_MULTIPLEX_OK: |
251 | switch (board_id) { | ||
252 | case SMS1XXX_BOARD_HAUPPAUGE_WINDHAM: | ||
253 | smscore_gpio_set_level(coredev, | ||
254 | board->board_cfg.led1, 1); | ||
255 | break; | ||
256 | } | ||
257 | break; /* BOARD_EVENT_MULTIPLEX_OK */ | 161 | break; /* BOARD_EVENT_MULTIPLEX_OK */ |
258 | case BOARD_EVENT_MULTIPLEX_ERRORS: | 162 | case BOARD_EVENT_MULTIPLEX_ERRORS: |
259 | switch (board_id) { | ||
260 | case SMS1XXX_BOARD_HAUPPAUGE_WINDHAM: | ||
261 | smscore_gpio_set_level(coredev, | ||
262 | board->board_cfg.led1, 0); | ||
263 | break; | ||
264 | } | ||
265 | break; /* BOARD_EVENT_MULTIPLEX_ERRORS */ | 163 | break; /* BOARD_EVENT_MULTIPLEX_ERRORS */ |
266 | 164 | ||
267 | default: | 165 | default: |
diff --git a/drivers/media/dvb/siano/smscoreapi.c b/drivers/media/dvb/siano/smscoreapi.c index a246903c3341..bd9ab9d0d12a 100644 --- a/drivers/media/dvb/siano/smscoreapi.c +++ b/drivers/media/dvb/siano/smscoreapi.c | |||
@@ -816,7 +816,7 @@ int smscore_set_device_mode(struct smscore_device_t *coredev, int mode) | |||
816 | 816 | ||
817 | sms_debug("set device mode to %d", mode); | 817 | sms_debug("set device mode to %d", mode); |
818 | if (coredev->device_flags & SMS_DEVICE_FAMILY2) { | 818 | if (coredev->device_flags & SMS_DEVICE_FAMILY2) { |
819 | if (mode < DEVICE_MODE_DVBT || mode > DEVICE_MODE_RAW_TUNER) { | 819 | if (mode < DEVICE_MODE_DVBT || mode >= DEVICE_MODE_RAW_TUNER) { |
820 | sms_err("invalid mode specified %d", mode); | 820 | sms_err("invalid mode specified %d", mode); |
821 | return -EINVAL; | 821 | return -EINVAL; |
822 | } | 822 | } |
diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig index 84b6fc15519d..dcf9fa9264bb 100644 --- a/drivers/media/video/Kconfig +++ b/drivers/media/video/Kconfig | |||
@@ -920,6 +920,8 @@ source "drivers/media/video/pwc/Kconfig" | |||
920 | config USB_ZR364XX | 920 | config USB_ZR364XX |
921 | tristate "USB ZR364XX Camera support" | 921 | tristate "USB ZR364XX Camera support" |
922 | depends on VIDEO_V4L2 | 922 | depends on VIDEO_V4L2 |
923 | select VIDEOBUF_GEN | ||
924 | select VIDEOBUF_VMALLOC | ||
923 | ---help--- | 925 | ---help--- |
924 | Say Y here if you want to connect this type of camera to your | 926 | Say Y here if you want to connect this type of camera to your |
925 | computer's USB port. | 927 | computer's USB port. |
diff --git a/drivers/media/video/bw-qcam.c b/drivers/media/video/bw-qcam.c index 10dbd4a11b30..9e39bc5f7b00 100644 --- a/drivers/media/video/bw-qcam.c +++ b/drivers/media/video/bw-qcam.c | |||
@@ -992,7 +992,7 @@ static int accept_bwqcam(struct parport *port) | |||
992 | 992 | ||
993 | if (parport[0] && strncmp(parport[0], "auto", 4) != 0) { | 993 | if (parport[0] && strncmp(parport[0], "auto", 4) != 0) { |
994 | /* user gave parport parameters */ | 994 | /* user gave parport parameters */ |
995 | for(n=0; parport[n] && n<MAX_CAMS; n++){ | 995 | for (n = 0; n < MAX_CAMS && parport[n]; n++) { |
996 | char *ep; | 996 | char *ep; |
997 | unsigned long r; | 997 | unsigned long r; |
998 | r = simple_strtoul(parport[n], &ep, 0); | 998 | r = simple_strtoul(parport[n], &ep, 0); |
diff --git a/drivers/media/video/cx18/cx18-controls.c b/drivers/media/video/cx18/cx18-controls.c index 5136df198338..93f0dae01350 100644 --- a/drivers/media/video/cx18/cx18-controls.c +++ b/drivers/media/video/cx18/cx18-controls.c | |||
@@ -20,6 +20,7 @@ | |||
20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA | 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA |
21 | * 02111-1307 USA | 21 | * 02111-1307 USA |
22 | */ | 22 | */ |
23 | #include <linux/kernel.h> | ||
23 | 24 | ||
24 | #include "cx18-driver.h" | 25 | #include "cx18-driver.h" |
25 | #include "cx18-cards.h" | 26 | #include "cx18-cards.h" |
@@ -317,7 +318,7 @@ int cx18_s_ext_ctrls(struct file *file, void *fh, struct v4l2_ext_controls *c) | |||
317 | idx = p.audio_properties & 0x03; | 318 | idx = p.audio_properties & 0x03; |
318 | /* The audio clock of the digitizer must match the codec sample | 319 | /* The audio clock of the digitizer must match the codec sample |
319 | rate otherwise you get some very strange effects. */ | 320 | rate otherwise you get some very strange effects. */ |
320 | if (idx < sizeof(freqs)) | 321 | if (idx < ARRAY_SIZE(freqs)) |
321 | cx18_call_all(cx, audio, s_clock_freq, freqs[idx]); | 322 | cx18_call_all(cx, audio, s_clock_freq, freqs[idx]); |
322 | return err; | 323 | return err; |
323 | } | 324 | } |
diff --git a/drivers/media/video/cx23885/cx23885-417.c b/drivers/media/video/cx23885/cx23885-417.c index e0cf21e0b1bf..1a1048b18f70 100644 --- a/drivers/media/video/cx23885/cx23885-417.c +++ b/drivers/media/video/cx23885/cx23885-417.c | |||
@@ -1715,6 +1715,8 @@ static struct video_device cx23885_mpeg_template = { | |||
1715 | .fops = &mpeg_fops, | 1715 | .fops = &mpeg_fops, |
1716 | .ioctl_ops = &mpeg_ioctl_ops, | 1716 | .ioctl_ops = &mpeg_ioctl_ops, |
1717 | .minor = -1, | 1717 | .minor = -1, |
1718 | .tvnorms = CX23885_NORMS, | ||
1719 | .current_norm = V4L2_STD_NTSC_M, | ||
1718 | }; | 1720 | }; |
1719 | 1721 | ||
1720 | void cx23885_417_unregister(struct cx23885_dev *dev) | 1722 | void cx23885_417_unregister(struct cx23885_dev *dev) |
diff --git a/drivers/media/video/cx88/cx88-cards.c b/drivers/media/video/cx88/cx88-cards.c index a5cc1c1fc2d6..39465301ec94 100644 --- a/drivers/media/video/cx88/cx88-cards.c +++ b/drivers/media/video/cx88/cx88-cards.c | |||
@@ -3003,6 +3003,14 @@ void cx88_setup_xc3028(struct cx88_core *core, struct xc2028_ctrl *ctl) | |||
3003 | case CX88_BOARD_DVICO_FUSIONHDTV_5_PCI_NANO: | 3003 | case CX88_BOARD_DVICO_FUSIONHDTV_5_PCI_NANO: |
3004 | ctl->demod = XC3028_FE_OREN538; | 3004 | ctl->demod = XC3028_FE_OREN538; |
3005 | break; | 3005 | break; |
3006 | case CX88_BOARD_GENIATECH_X8000_MT: | ||
3007 | /* FIXME: For this board, the xc3028 never recovers after being | ||
3008 | powered down (the reset GPIO probably is not set properly). | ||
3009 | We don't have access to the hardware so we cannot determine | ||
3010 | which GPIO is used for xc3028, so just disable power xc3028 | ||
3011 | power management for now */ | ||
3012 | ctl->disable_power_mgmt = 1; | ||
3013 | break; | ||
3006 | case CX88_BOARD_WINFAST_TV2000_XP_GLOBAL: | 3014 | case CX88_BOARD_WINFAST_TV2000_XP_GLOBAL: |
3007 | case CX88_BOARD_PROLINK_PV_GLOBAL_XTREME: | 3015 | case CX88_BOARD_PROLINK_PV_GLOBAL_XTREME: |
3008 | case CX88_BOARD_PROLINK_PV_8000GT: | 3016 | case CX88_BOARD_PROLINK_PV_8000GT: |
diff --git a/drivers/media/video/cx88/cx88-dvb.c b/drivers/media/video/cx88/cx88-dvb.c index c44e87600219..e237b507659b 100644 --- a/drivers/media/video/cx88/cx88-dvb.c +++ b/drivers/media/video/cx88/cx88-dvb.c | |||
@@ -501,6 +501,7 @@ static struct zl10353_config cx88_pinnacle_hybrid_pctv = { | |||
501 | static struct zl10353_config cx88_geniatech_x8000_mt = { | 501 | static struct zl10353_config cx88_geniatech_x8000_mt = { |
502 | .demod_address = (0x1e >> 1), | 502 | .demod_address = (0x1e >> 1), |
503 | .no_tuner = 1, | 503 | .no_tuner = 1, |
504 | .disable_i2c_gate_ctrl = 1, | ||
504 | }; | 505 | }; |
505 | 506 | ||
506 | static struct s5h1411_config dvico_fusionhdtv7_config = { | 507 | static struct s5h1411_config dvico_fusionhdtv7_config = { |
diff --git a/drivers/media/video/cx88/cx88-mpeg.c b/drivers/media/video/cx88/cx88-mpeg.c index da4e3912cd37..7172dcf2a4fa 100644 --- a/drivers/media/video/cx88/cx88-mpeg.c +++ b/drivers/media/video/cx88/cx88-mpeg.c | |||
@@ -116,6 +116,10 @@ static int cx8802_start_dma(struct cx8802_dev *dev, | |||
116 | udelay(100); | 116 | udelay(100); |
117 | break; | 117 | break; |
118 | case CX88_BOARD_HAUPPAUGE_HVR1300: | 118 | case CX88_BOARD_HAUPPAUGE_HVR1300: |
119 | /* Enable MPEG parallel IO and video signal pins */ | ||
120 | cx_write(MO_PINMUX_IO, 0x88); | ||
121 | cx_write(TS_SOP_STAT, 0); | ||
122 | cx_write(TS_VALERR_CNTRL, 0); | ||
119 | break; | 123 | break; |
120 | case CX88_BOARD_PINNACLE_PCTV_HD_800i: | 124 | case CX88_BOARD_PINNACLE_PCTV_HD_800i: |
121 | /* Enable MPEG parallel IO and video signal pins */ | 125 | /* Enable MPEG parallel IO and video signal pins */ |
diff --git a/drivers/media/video/em28xx/em28xx-cards.c b/drivers/media/video/em28xx/em28xx-cards.c index 320f1f60276e..ed281f565945 100644 --- a/drivers/media/video/em28xx/em28xx-cards.c +++ b/drivers/media/video/em28xx/em28xx-cards.c | |||
@@ -218,7 +218,7 @@ static struct em28xx_reg_seq silvercrest_reg_seq[] = { | |||
218 | struct em28xx_board em28xx_boards[] = { | 218 | struct em28xx_board em28xx_boards[] = { |
219 | [EM2750_BOARD_UNKNOWN] = { | 219 | [EM2750_BOARD_UNKNOWN] = { |
220 | .name = "EM2710/EM2750/EM2751 webcam grabber", | 220 | .name = "EM2710/EM2750/EM2751 webcam grabber", |
221 | .xclk = EM28XX_XCLK_FREQUENCY_48MHZ, | 221 | .xclk = EM28XX_XCLK_FREQUENCY_20MHZ, |
222 | .tuner_type = TUNER_ABSENT, | 222 | .tuner_type = TUNER_ABSENT, |
223 | .is_webcam = 1, | 223 | .is_webcam = 1, |
224 | .input = { { | 224 | .input = { { |
@@ -622,22 +622,27 @@ struct em28xx_board em28xx_boards[] = { | |||
622 | }, | 622 | }, |
623 | [EM2861_BOARD_PLEXTOR_PX_TV100U] = { | 623 | [EM2861_BOARD_PLEXTOR_PX_TV100U] = { |
624 | .name = "Plextor ConvertX PX-TV100U", | 624 | .name = "Plextor ConvertX PX-TV100U", |
625 | .valid = EM28XX_BOARD_NOT_VALIDATED, | ||
626 | .tuner_type = TUNER_TNF_5335MF, | 625 | .tuner_type = TUNER_TNF_5335MF, |
626 | .xclk = EM28XX_XCLK_I2S_MSB_TIMING | | ||
627 | EM28XX_XCLK_FREQUENCY_12MHZ, | ||
627 | .tda9887_conf = TDA9887_PRESENT, | 628 | .tda9887_conf = TDA9887_PRESENT, |
628 | .decoder = EM28XX_TVP5150, | 629 | .decoder = EM28XX_TVP5150, |
630 | .has_msp34xx = 1, | ||
629 | .input = { { | 631 | .input = { { |
630 | .type = EM28XX_VMUX_TELEVISION, | 632 | .type = EM28XX_VMUX_TELEVISION, |
631 | .vmux = TVP5150_COMPOSITE0, | 633 | .vmux = TVP5150_COMPOSITE0, |
632 | .amux = EM28XX_AMUX_LINE_IN, | 634 | .amux = EM28XX_AMUX_LINE_IN, |
635 | .gpio = pinnacle_hybrid_pro_analog, | ||
633 | }, { | 636 | }, { |
634 | .type = EM28XX_VMUX_COMPOSITE1, | 637 | .type = EM28XX_VMUX_COMPOSITE1, |
635 | .vmux = TVP5150_COMPOSITE1, | 638 | .vmux = TVP5150_COMPOSITE1, |
636 | .amux = EM28XX_AMUX_LINE_IN, | 639 | .amux = EM28XX_AMUX_LINE_IN, |
640 | .gpio = pinnacle_hybrid_pro_analog, | ||
637 | }, { | 641 | }, { |
638 | .type = EM28XX_VMUX_SVIDEO, | 642 | .type = EM28XX_VMUX_SVIDEO, |
639 | .vmux = TVP5150_SVIDEO, | 643 | .vmux = TVP5150_SVIDEO, |
640 | .amux = EM28XX_AMUX_LINE_IN, | 644 | .amux = EM28XX_AMUX_LINE_IN, |
645 | .gpio = pinnacle_hybrid_pro_analog, | ||
641 | } }, | 646 | } }, |
642 | }, | 647 | }, |
643 | 648 | ||
@@ -1544,6 +1549,8 @@ struct usb_device_id em28xx_id_table[] = { | |||
1544 | .driver_info = EM2750_BOARD_UNKNOWN }, | 1549 | .driver_info = EM2750_BOARD_UNKNOWN }, |
1545 | { USB_DEVICE(0xeb1a, 0x2800), | 1550 | { USB_DEVICE(0xeb1a, 0x2800), |
1546 | .driver_info = EM2800_BOARD_UNKNOWN }, | 1551 | .driver_info = EM2800_BOARD_UNKNOWN }, |
1552 | { USB_DEVICE(0xeb1a, 0x2710), | ||
1553 | .driver_info = EM2820_BOARD_UNKNOWN }, | ||
1547 | { USB_DEVICE(0xeb1a, 0x2820), | 1554 | { USB_DEVICE(0xeb1a, 0x2820), |
1548 | .driver_info = EM2820_BOARD_UNKNOWN }, | 1555 | .driver_info = EM2820_BOARD_UNKNOWN }, |
1549 | { USB_DEVICE(0xeb1a, 0x2821), | 1556 | { USB_DEVICE(0xeb1a, 0x2821), |
@@ -1761,6 +1768,7 @@ static int em28xx_hint_sensor(struct em28xx *dev) | |||
1761 | __be16 version_be; | 1768 | __be16 version_be; |
1762 | u16 version; | 1769 | u16 version; |
1763 | 1770 | ||
1771 | /* Micron sensor detection */ | ||
1764 | dev->i2c_client.addr = 0xba >> 1; | 1772 | dev->i2c_client.addr = 0xba >> 1; |
1765 | cmd = 0; | 1773 | cmd = 0; |
1766 | i2c_master_send(&dev->i2c_client, &cmd, 1); | 1774 | i2c_master_send(&dev->i2c_client, &cmd, 1); |
@@ -1769,15 +1777,27 @@ static int em28xx_hint_sensor(struct em28xx *dev) | |||
1769 | return -EINVAL; | 1777 | return -EINVAL; |
1770 | 1778 | ||
1771 | version = be16_to_cpu(version_be); | 1779 | version = be16_to_cpu(version_be); |
1772 | |||
1773 | switch (version) { | 1780 | switch (version) { |
1774 | case 0x8243: /* mt9v011 640x480 1.3 Mpix sensor */ | 1781 | case 0x8232: /* mt9v011 640x480 1.3 Mpix sensor */ |
1782 | case 0x8243: /* mt9v011 rev B 640x480 1.3 Mpix sensor */ | ||
1775 | dev->model = EM2820_BOARD_SILVERCREST_WEBCAM; | 1783 | dev->model = EM2820_BOARD_SILVERCREST_WEBCAM; |
1784 | em28xx_set_model(dev); | ||
1785 | |||
1776 | sensor_name = "mt9v011"; | 1786 | sensor_name = "mt9v011"; |
1777 | dev->em28xx_sensor = EM28XX_MT9V011; | 1787 | dev->em28xx_sensor = EM28XX_MT9V011; |
1778 | dev->sensor_xres = 640; | 1788 | dev->sensor_xres = 640; |
1779 | dev->sensor_yres = 480; | 1789 | dev->sensor_yres = 480; |
1780 | dev->sensor_xtal = 6300000; | 1790 | /* |
1791 | * FIXME: mt9v011 uses I2S speed as xtal clk - at least with | ||
1792 | * the Silvercrest cam I have here for testing - for higher | ||
1793 | * resolutions, a high clock cause horizontal artifacts, so we | ||
1794 | * need to use a lower xclk frequency. | ||
1795 | * Yet, it would be possible to adjust xclk depending on the | ||
1796 | * desired resolution, since this affects directly the | ||
1797 | * frame rate. | ||
1798 | */ | ||
1799 | dev->board.xclk = EM28XX_XCLK_FREQUENCY_4_3MHZ; | ||
1800 | dev->sensor_xtal = 4300000; | ||
1781 | 1801 | ||
1782 | /* probably means GRGB 16 bit bayer */ | 1802 | /* probably means GRGB 16 bit bayer */ |
1783 | dev->vinmode = 0x0d; | 1803 | dev->vinmode = 0x0d; |
@@ -1786,6 +1806,8 @@ static int em28xx_hint_sensor(struct em28xx *dev) | |||
1786 | break; | 1806 | break; |
1787 | case 0x8431: | 1807 | case 0x8431: |
1788 | dev->model = EM2750_BOARD_UNKNOWN; | 1808 | dev->model = EM2750_BOARD_UNKNOWN; |
1809 | em28xx_set_model(dev); | ||
1810 | |||
1789 | sensor_name = "mt9m001"; | 1811 | sensor_name = "mt9m001"; |
1790 | dev->em28xx_sensor = EM28XX_MT9M001; | 1812 | dev->em28xx_sensor = EM28XX_MT9M001; |
1791 | em28xx_initialize_mt9m001(dev); | 1813 | em28xx_initialize_mt9m001(dev); |
@@ -1802,6 +1824,9 @@ static int em28xx_hint_sensor(struct em28xx *dev) | |||
1802 | return -EINVAL; | 1824 | return -EINVAL; |
1803 | } | 1825 | } |
1804 | 1826 | ||
1827 | /* Setup webcam defaults */ | ||
1828 | em28xx_pre_card_setup(dev); | ||
1829 | |||
1805 | em28xx_errdev("Sensor is %s, using model %s entry.\n", | 1830 | em28xx_errdev("Sensor is %s, using model %s entry.\n", |
1806 | sensor_name, em28xx_boards[dev->model].name); | 1831 | sensor_name, em28xx_boards[dev->model].name); |
1807 | 1832 | ||
@@ -1813,60 +1838,6 @@ static int em28xx_hint_sensor(struct em28xx *dev) | |||
1813 | */ | 1838 | */ |
1814 | void em28xx_pre_card_setup(struct em28xx *dev) | 1839 | void em28xx_pre_card_setup(struct em28xx *dev) |
1815 | { | 1840 | { |
1816 | int rc; | ||
1817 | |||
1818 | em28xx_set_model(dev); | ||
1819 | |||
1820 | em28xx_info("Identified as %s (card=%d)\n", | ||
1821 | dev->board.name, dev->model); | ||
1822 | |||
1823 | /* Set the default GPO/GPIO for legacy devices */ | ||
1824 | dev->reg_gpo_num = EM2880_R04_GPO; | ||
1825 | dev->reg_gpio_num = EM28XX_R08_GPIO; | ||
1826 | |||
1827 | dev->wait_after_write = 5; | ||
1828 | |||
1829 | /* Based on the Chip ID, set the device configuration */ | ||
1830 | rc = em28xx_read_reg(dev, EM28XX_R0A_CHIPID); | ||
1831 | if (rc > 0) { | ||
1832 | dev->chip_id = rc; | ||
1833 | |||
1834 | switch (dev->chip_id) { | ||
1835 | case CHIP_ID_EM2750: | ||
1836 | em28xx_info("chip ID is em2750\n"); | ||
1837 | break; | ||
1838 | case CHIP_ID_EM2820: | ||
1839 | em28xx_info("chip ID is em2710 or em2820\n"); | ||
1840 | break; | ||
1841 | case CHIP_ID_EM2840: | ||
1842 | em28xx_info("chip ID is em2840\n"); | ||
1843 | break; | ||
1844 | case CHIP_ID_EM2860: | ||
1845 | em28xx_info("chip ID is em2860\n"); | ||
1846 | break; | ||
1847 | case CHIP_ID_EM2870: | ||
1848 | em28xx_info("chip ID is em2870\n"); | ||
1849 | dev->wait_after_write = 0; | ||
1850 | break; | ||
1851 | case CHIP_ID_EM2874: | ||
1852 | em28xx_info("chip ID is em2874\n"); | ||
1853 | dev->reg_gpio_num = EM2874_R80_GPIO; | ||
1854 | dev->wait_after_write = 0; | ||
1855 | break; | ||
1856 | case CHIP_ID_EM2883: | ||
1857 | em28xx_info("chip ID is em2882/em2883\n"); | ||
1858 | dev->wait_after_write = 0; | ||
1859 | break; | ||
1860 | default: | ||
1861 | em28xx_info("em28xx chip ID = %d\n", dev->chip_id); | ||
1862 | } | ||
1863 | } | ||
1864 | |||
1865 | /* Prepopulate cached GPO register content */ | ||
1866 | rc = em28xx_read_reg(dev, dev->reg_gpo_num); | ||
1867 | if (rc >= 0) | ||
1868 | dev->reg_gpo = rc; | ||
1869 | |||
1870 | /* Set the initial XCLK and I2C clock values based on the board | 1841 | /* Set the initial XCLK and I2C clock values based on the board |
1871 | definition */ | 1842 | definition */ |
1872 | em28xx_write_reg(dev, EM28XX_R0F_XCLK, dev->board.xclk & 0x7f); | 1843 | em28xx_write_reg(dev, EM28XX_R0F_XCLK, dev->board.xclk & 0x7f); |
@@ -1876,9 +1847,8 @@ void em28xx_pre_card_setup(struct em28xx *dev) | |||
1876 | /* request some modules */ | 1847 | /* request some modules */ |
1877 | switch (dev->model) { | 1848 | switch (dev->model) { |
1878 | case EM2861_BOARD_PLEXTOR_PX_TV100U: | 1849 | case EM2861_BOARD_PLEXTOR_PX_TV100U: |
1879 | /* FIXME guess */ | 1850 | /* Sets the msp34xx I2S speed */ |
1880 | /* Turn on analog audio output */ | 1851 | dev->i2s_speed = 2048000; |
1881 | em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xfd); | ||
1882 | break; | 1852 | break; |
1883 | case EM2861_BOARD_KWORLD_PVRTV_300U: | 1853 | case EM2861_BOARD_KWORLD_PVRTV_300U: |
1884 | case EM2880_BOARD_KWORLD_DVB_305U: | 1854 | case EM2880_BOARD_KWORLD_DVB_305U: |
@@ -2216,7 +2186,20 @@ void em28xx_register_i2c_ir(struct em28xx *dev) | |||
2216 | 2186 | ||
2217 | void em28xx_card_setup(struct em28xx *dev) | 2187 | void em28xx_card_setup(struct em28xx *dev) |
2218 | { | 2188 | { |
2219 | em28xx_set_model(dev); | 2189 | /* |
2190 | * If the device can be a webcam, seek for a sensor. | ||
2191 | * If sensor is not found, then it isn't a webcam. | ||
2192 | */ | ||
2193 | if (dev->board.is_webcam) { | ||
2194 | if (em28xx_hint_sensor(dev) < 0) | ||
2195 | dev->board.is_webcam = 0; | ||
2196 | else | ||
2197 | dev->progressive = 1; | ||
2198 | } else | ||
2199 | em28xx_set_model(dev); | ||
2200 | |||
2201 | em28xx_info("Identified as %s (card=%d)\n", | ||
2202 | dev->board.name, dev->model); | ||
2220 | 2203 | ||
2221 | dev->tuner_type = em28xx_boards[dev->model].tuner_type; | 2204 | dev->tuner_type = em28xx_boards[dev->model].tuner_type; |
2222 | if (em28xx_boards[dev->model].tuner_addr) | 2205 | if (em28xx_boards[dev->model].tuner_addr) |
@@ -2290,10 +2273,6 @@ void em28xx_card_setup(struct em28xx *dev) | |||
2290 | em28xx_gpio_set(dev, dev->board.tuner_gpio); | 2273 | em28xx_gpio_set(dev, dev->board.tuner_gpio); |
2291 | em28xx_set_mode(dev, EM28XX_ANALOG_MODE); | 2274 | em28xx_set_mode(dev, EM28XX_ANALOG_MODE); |
2292 | break; | 2275 | break; |
2293 | case EM2820_BOARD_SILVERCREST_WEBCAM: | ||
2294 | /* FIXME: need to document the registers bellow */ | ||
2295 | em28xx_write_reg(dev, 0x0d, 0x42); | ||
2296 | em28xx_write_reg(dev, 0x13, 0x08); | ||
2297 | } | 2276 | } |
2298 | 2277 | ||
2299 | if (dev->board.has_snapshot_button) | 2278 | if (dev->board.has_snapshot_button) |
@@ -2433,7 +2412,7 @@ static int em28xx_init_dev(struct em28xx **devhandle, struct usb_device *udev, | |||
2433 | int minor) | 2412 | int minor) |
2434 | { | 2413 | { |
2435 | struct em28xx *dev = *devhandle; | 2414 | struct em28xx *dev = *devhandle; |
2436 | int retval = -ENOMEM; | 2415 | int retval; |
2437 | int errCode; | 2416 | int errCode; |
2438 | 2417 | ||
2439 | dev->udev = udev; | 2418 | dev->udev = udev; |
@@ -2450,6 +2429,58 @@ static int em28xx_init_dev(struct em28xx **devhandle, struct usb_device *udev, | |||
2450 | dev->em28xx_read_reg_req = em28xx_read_reg_req; | 2429 | dev->em28xx_read_reg_req = em28xx_read_reg_req; |
2451 | dev->board.is_em2800 = em28xx_boards[dev->model].is_em2800; | 2430 | dev->board.is_em2800 = em28xx_boards[dev->model].is_em2800; |
2452 | 2431 | ||
2432 | em28xx_set_model(dev); | ||
2433 | |||
2434 | /* Set the default GPO/GPIO for legacy devices */ | ||
2435 | dev->reg_gpo_num = EM2880_R04_GPO; | ||
2436 | dev->reg_gpio_num = EM28XX_R08_GPIO; | ||
2437 | |||
2438 | dev->wait_after_write = 5; | ||
2439 | |||
2440 | /* Based on the Chip ID, set the device configuration */ | ||
2441 | retval = em28xx_read_reg(dev, EM28XX_R0A_CHIPID); | ||
2442 | if (retval > 0) { | ||
2443 | dev->chip_id = retval; | ||
2444 | |||
2445 | switch (dev->chip_id) { | ||
2446 | case CHIP_ID_EM2710: | ||
2447 | em28xx_info("chip ID is em2710\n"); | ||
2448 | break; | ||
2449 | case CHIP_ID_EM2750: | ||
2450 | em28xx_info("chip ID is em2750\n"); | ||
2451 | break; | ||
2452 | case CHIP_ID_EM2820: | ||
2453 | em28xx_info("chip ID is em2820 (or em2710)\n"); | ||
2454 | break; | ||
2455 | case CHIP_ID_EM2840: | ||
2456 | em28xx_info("chip ID is em2840\n"); | ||
2457 | break; | ||
2458 | case CHIP_ID_EM2860: | ||
2459 | em28xx_info("chip ID is em2860\n"); | ||
2460 | break; | ||
2461 | case CHIP_ID_EM2870: | ||
2462 | em28xx_info("chip ID is em2870\n"); | ||
2463 | dev->wait_after_write = 0; | ||
2464 | break; | ||
2465 | case CHIP_ID_EM2874: | ||
2466 | em28xx_info("chip ID is em2874\n"); | ||
2467 | dev->reg_gpio_num = EM2874_R80_GPIO; | ||
2468 | dev->wait_after_write = 0; | ||
2469 | break; | ||
2470 | case CHIP_ID_EM2883: | ||
2471 | em28xx_info("chip ID is em2882/em2883\n"); | ||
2472 | dev->wait_after_write = 0; | ||
2473 | break; | ||
2474 | default: | ||
2475 | em28xx_info("em28xx chip ID = %d\n", dev->chip_id); | ||
2476 | } | ||
2477 | } | ||
2478 | |||
2479 | /* Prepopulate cached GPO register content */ | ||
2480 | retval = em28xx_read_reg(dev, dev->reg_gpo_num); | ||
2481 | if (retval >= 0) | ||
2482 | dev->reg_gpo = retval; | ||
2483 | |||
2453 | em28xx_pre_card_setup(dev); | 2484 | em28xx_pre_card_setup(dev); |
2454 | 2485 | ||
2455 | if (!dev->board.is_em2800) { | 2486 | if (!dev->board.is_em2800) { |
@@ -2484,14 +2515,6 @@ static int em28xx_init_dev(struct em28xx **devhandle, struct usb_device *udev, | |||
2484 | dev->vinmode = 0x10; | 2515 | dev->vinmode = 0x10; |
2485 | dev->vinctl = 0x11; | 2516 | dev->vinctl = 0x11; |
2486 | 2517 | ||
2487 | /* | ||
2488 | * If the device can be a webcam, seek for a sensor. | ||
2489 | * If sensor is not found, then it isn't a webcam. | ||
2490 | */ | ||
2491 | if (dev->board.is_webcam) | ||
2492 | if (em28xx_hint_sensor(dev) < 0) | ||
2493 | dev->board.is_webcam = 0; | ||
2494 | |||
2495 | /* Do board specific init and eeprom reading */ | 2518 | /* Do board specific init and eeprom reading */ |
2496 | em28xx_card_setup(dev); | 2519 | em28xx_card_setup(dev); |
2497 | 2520 | ||
diff --git a/drivers/media/video/em28xx/em28xx-core.c b/drivers/media/video/em28xx/em28xx-core.c index 5b78e199abd1..98e140b5d95e 100644 --- a/drivers/media/video/em28xx/em28xx-core.c +++ b/drivers/media/video/em28xx/em28xx-core.c | |||
@@ -632,6 +632,9 @@ int em28xx_capture_start(struct em28xx *dev, int start) | |||
632 | return rc; | 632 | return rc; |
633 | } | 633 | } |
634 | 634 | ||
635 | if (dev->board.is_webcam) | ||
636 | rc = em28xx_write_reg(dev, 0x13, 0x0c); | ||
637 | |||
635 | /* enable video capture */ | 638 | /* enable video capture */ |
636 | rc = em28xx_write_reg(dev, 0x48, 0x00); | 639 | rc = em28xx_write_reg(dev, 0x48, 0x00); |
637 | 640 | ||
@@ -720,7 +723,10 @@ int em28xx_resolution_set(struct em28xx *dev) | |||
720 | { | 723 | { |
721 | int width, height; | 724 | int width, height; |
722 | width = norm_maxw(dev); | 725 | width = norm_maxw(dev); |
723 | height = norm_maxh(dev) >> 1; | 726 | height = norm_maxh(dev); |
727 | |||
728 | if (!dev->progressive) | ||
729 | height >>= norm_maxh(dev); | ||
724 | 730 | ||
725 | em28xx_set_outfmt(dev); | 731 | em28xx_set_outfmt(dev); |
726 | 732 | ||
diff --git a/drivers/media/video/em28xx/em28xx-dvb.c b/drivers/media/video/em28xx/em28xx-dvb.c index cf0ac7f2a30d..d603575431b4 100644 --- a/drivers/media/video/em28xx/em28xx-dvb.c +++ b/drivers/media/video/em28xx/em28xx-dvb.c | |||
@@ -478,7 +478,6 @@ static int dvb_init(struct em28xx *dev) | |||
478 | } | 478 | } |
479 | break; | 479 | break; |
480 | case EM2880_BOARD_KWORLD_DVB_310U: | 480 | case EM2880_BOARD_KWORLD_DVB_310U: |
481 | case EM2880_BOARD_EMPIRE_DUAL_TV: | ||
482 | dvb->frontend = dvb_attach(zl10353_attach, | 481 | dvb->frontend = dvb_attach(zl10353_attach, |
483 | &em28xx_zl10353_with_xc3028, | 482 | &em28xx_zl10353_with_xc3028, |
484 | &dev->i2c_adap); | 483 | &dev->i2c_adap); |
@@ -488,6 +487,7 @@ static int dvb_init(struct em28xx *dev) | |||
488 | } | 487 | } |
489 | break; | 488 | break; |
490 | case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900: | 489 | case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900: |
490 | case EM2880_BOARD_EMPIRE_DUAL_TV: | ||
491 | dvb->frontend = dvb_attach(zl10353_attach, | 491 | dvb->frontend = dvb_attach(zl10353_attach, |
492 | &em28xx_zl10353_xc3028_no_i2c_gate, | 492 | &em28xx_zl10353_xc3028_no_i2c_gate, |
493 | &dev->i2c_adap); | 493 | &dev->i2c_adap); |
diff --git a/drivers/media/video/em28xx/em28xx-reg.h b/drivers/media/video/em28xx/em28xx-reg.h index a2676d63cfd0..6bf84bd787df 100644 --- a/drivers/media/video/em28xx/em28xx-reg.h +++ b/drivers/media/video/em28xx/em28xx-reg.h | |||
@@ -176,7 +176,8 @@ | |||
176 | 176 | ||
177 | /* FIXME: Need to be populated with the other chip ID's */ | 177 | /* FIXME: Need to be populated with the other chip ID's */ |
178 | enum em28xx_chip_id { | 178 | enum em28xx_chip_id { |
179 | CHIP_ID_EM2820 = 18, /* Also used by em2710 */ | 179 | CHIP_ID_EM2710 = 17, |
180 | CHIP_ID_EM2820 = 18, /* Also used by some em2710 */ | ||
180 | CHIP_ID_EM2840 = 20, | 181 | CHIP_ID_EM2840 = 20, |
181 | CHIP_ID_EM2750 = 33, | 182 | CHIP_ID_EM2750 = 33, |
182 | CHIP_ID_EM2860 = 34, | 183 | CHIP_ID_EM2860 = 34, |
diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c index ff37b4c15f44..ab079d9256c4 100644 --- a/drivers/media/video/em28xx/em28xx-video.c +++ b/drivers/media/video/em28xx/em28xx-video.c | |||
@@ -194,15 +194,24 @@ static void em28xx_copy_video(struct em28xx *dev, | |||
194 | startread = p; | 194 | startread = p; |
195 | remain = len; | 195 | remain = len; |
196 | 196 | ||
197 | /* Interlaces frame */ | 197 | if (dev->progressive) |
198 | if (buf->top_field) | ||
199 | fieldstart = outp; | 198 | fieldstart = outp; |
200 | else | 199 | else { |
201 | fieldstart = outp + bytesperline; | 200 | /* Interlaces two half frames */ |
201 | if (buf->top_field) | ||
202 | fieldstart = outp; | ||
203 | else | ||
204 | fieldstart = outp + bytesperline; | ||
205 | } | ||
202 | 206 | ||
203 | linesdone = dma_q->pos / bytesperline; | 207 | linesdone = dma_q->pos / bytesperline; |
204 | currlinedone = dma_q->pos % bytesperline; | 208 | currlinedone = dma_q->pos % bytesperline; |
205 | offset = linesdone * bytesperline * 2 + currlinedone; | 209 | |
210 | if (dev->progressive) | ||
211 | offset = linesdone * bytesperline + currlinedone; | ||
212 | else | ||
213 | offset = linesdone * bytesperline * 2 + currlinedone; | ||
214 | |||
206 | startwrite = fieldstart + offset; | 215 | startwrite = fieldstart + offset; |
207 | lencopy = bytesperline - currlinedone; | 216 | lencopy = bytesperline - currlinedone; |
208 | lencopy = lencopy > remain ? remain : lencopy; | 217 | lencopy = lencopy > remain ? remain : lencopy; |
@@ -376,7 +385,7 @@ static inline int em28xx_isoc_copy(struct em28xx *dev, struct urb *urb) | |||
376 | em28xx_isocdbg("Video frame %d, length=%i, %s\n", p[2], | 385 | em28xx_isocdbg("Video frame %d, length=%i, %s\n", p[2], |
377 | len, (p[2] & 1) ? "odd" : "even"); | 386 | len, (p[2] & 1) ? "odd" : "even"); |
378 | 387 | ||
379 | if (!(p[2] & 1)) { | 388 | if (dev->progressive || !(p[2] & 1)) { |
380 | if (buf != NULL) | 389 | if (buf != NULL) |
381 | buffer_filled(dev, dma_q, buf); | 390 | buffer_filled(dev, dma_q, buf); |
382 | get_next_buf(dma_q, &buf); | 391 | get_next_buf(dma_q, &buf); |
@@ -689,7 +698,10 @@ static int vidioc_g_fmt_vid_cap(struct file *file, void *priv, | |||
689 | f->fmt.pix.colorspace = V4L2_COLORSPACE_SMPTE170M; | 698 | f->fmt.pix.colorspace = V4L2_COLORSPACE_SMPTE170M; |
690 | 699 | ||
691 | /* FIXME: TOP? NONE? BOTTOM? ALTENATE? */ | 700 | /* FIXME: TOP? NONE? BOTTOM? ALTENATE? */ |
692 | f->fmt.pix.field = dev->interlaced ? | 701 | if (dev->progressive) |
702 | f->fmt.pix.field = V4L2_FIELD_NONE; | ||
703 | else | ||
704 | f->fmt.pix.field = dev->interlaced ? | ||
693 | V4L2_FIELD_INTERLACED : V4L2_FIELD_TOP; | 705 | V4L2_FIELD_INTERLACED : V4L2_FIELD_TOP; |
694 | 706 | ||
695 | mutex_unlock(&dev->lock); | 707 | mutex_unlock(&dev->lock); |
@@ -753,7 +765,11 @@ static int vidioc_try_fmt_vid_cap(struct file *file, void *priv, | |||
753 | f->fmt.pix.bytesperline = (dev->width * fmt->depth + 7) >> 3; | 765 | f->fmt.pix.bytesperline = (dev->width * fmt->depth + 7) >> 3; |
754 | f->fmt.pix.sizeimage = f->fmt.pix.bytesperline * height; | 766 | f->fmt.pix.sizeimage = f->fmt.pix.bytesperline * height; |
755 | f->fmt.pix.colorspace = V4L2_COLORSPACE_SMPTE170M; | 767 | f->fmt.pix.colorspace = V4L2_COLORSPACE_SMPTE170M; |
756 | f->fmt.pix.field = V4L2_FIELD_INTERLACED; | 768 | if (dev->progressive) |
769 | f->fmt.pix.field = V4L2_FIELD_NONE; | ||
770 | else | ||
771 | f->fmt.pix.field = dev->interlaced ? | ||
772 | V4L2_FIELD_INTERLACED : V4L2_FIELD_TOP; | ||
757 | 773 | ||
758 | return 0; | 774 | return 0; |
759 | } | 775 | } |
@@ -846,6 +862,41 @@ static int vidioc_s_std(struct file *file, void *priv, v4l2_std_id *norm) | |||
846 | return 0; | 862 | return 0; |
847 | } | 863 | } |
848 | 864 | ||
865 | static int vidioc_g_parm(struct file *file, void *priv, | ||
866 | struct v4l2_streamparm *p) | ||
867 | { | ||
868 | struct em28xx_fh *fh = priv; | ||
869 | struct em28xx *dev = fh->dev; | ||
870 | int rc = 0; | ||
871 | |||
872 | if (p->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) | ||
873 | return -EINVAL; | ||
874 | |||
875 | if (dev->board.is_webcam) | ||
876 | rc = v4l2_device_call_until_err(&dev->v4l2_dev, 0, | ||
877 | video, g_parm, p); | ||
878 | else | ||
879 | v4l2_video_std_frame_period(dev->norm, | ||
880 | &p->parm.capture.timeperframe); | ||
881 | |||
882 | return rc; | ||
883 | } | ||
884 | |||
885 | static int vidioc_s_parm(struct file *file, void *priv, | ||
886 | struct v4l2_streamparm *p) | ||
887 | { | ||
888 | struct em28xx_fh *fh = priv; | ||
889 | struct em28xx *dev = fh->dev; | ||
890 | |||
891 | if (!dev->board.is_webcam) | ||
892 | return -EINVAL; | ||
893 | |||
894 | if (p->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) | ||
895 | return -EINVAL; | ||
896 | |||
897 | return v4l2_device_call_until_err(&dev->v4l2_dev, 0, video, s_parm, p); | ||
898 | } | ||
899 | |||
849 | static const char *iname[] = { | 900 | static const char *iname[] = { |
850 | [EM28XX_VMUX_COMPOSITE1] = "Composite1", | 901 | [EM28XX_VMUX_COMPOSITE1] = "Composite1", |
851 | [EM28XX_VMUX_COMPOSITE2] = "Composite2", | 902 | [EM28XX_VMUX_COMPOSITE2] = "Composite2", |
@@ -1624,6 +1675,7 @@ static int em28xx_v4l2_open(struct file *filp) | |||
1624 | struct em28xx *dev; | 1675 | struct em28xx *dev; |
1625 | enum v4l2_buf_type fh_type; | 1676 | enum v4l2_buf_type fh_type; |
1626 | struct em28xx_fh *fh; | 1677 | struct em28xx_fh *fh; |
1678 | enum v4l2_field field; | ||
1627 | 1679 | ||
1628 | dev = em28xx_get_device(minor, &fh_type, &radio); | 1680 | dev = em28xx_get_device(minor, &fh_type, &radio); |
1629 | 1681 | ||
@@ -1665,8 +1717,13 @@ static int em28xx_v4l2_open(struct file *filp) | |||
1665 | 1717 | ||
1666 | dev->users++; | 1718 | dev->users++; |
1667 | 1719 | ||
1720 | if (dev->progressive) | ||
1721 | field = V4L2_FIELD_NONE; | ||
1722 | else | ||
1723 | field = V4L2_FIELD_INTERLACED; | ||
1724 | |||
1668 | videobuf_queue_vmalloc_init(&fh->vb_vidq, &em28xx_video_qops, | 1725 | videobuf_queue_vmalloc_init(&fh->vb_vidq, &em28xx_video_qops, |
1669 | NULL, &dev->slock, fh->type, V4L2_FIELD_INTERLACED, | 1726 | NULL, &dev->slock, fh->type, field, |
1670 | sizeof(struct em28xx_buffer), fh); | 1727 | sizeof(struct em28xx_buffer), fh); |
1671 | 1728 | ||
1672 | mutex_unlock(&dev->lock); | 1729 | mutex_unlock(&dev->lock); |
@@ -1885,6 +1942,8 @@ static const struct v4l2_ioctl_ops video_ioctl_ops = { | |||
1885 | .vidioc_qbuf = vidioc_qbuf, | 1942 | .vidioc_qbuf = vidioc_qbuf, |
1886 | .vidioc_dqbuf = vidioc_dqbuf, | 1943 | .vidioc_dqbuf = vidioc_dqbuf, |
1887 | .vidioc_s_std = vidioc_s_std, | 1944 | .vidioc_s_std = vidioc_s_std, |
1945 | .vidioc_g_parm = vidioc_g_parm, | ||
1946 | .vidioc_s_parm = vidioc_s_parm, | ||
1888 | .vidioc_enum_input = vidioc_enum_input, | 1947 | .vidioc_enum_input = vidioc_enum_input, |
1889 | .vidioc_g_input = vidioc_g_input, | 1948 | .vidioc_g_input = vidioc_g_input, |
1890 | .vidioc_s_input = vidioc_s_input, | 1949 | .vidioc_s_input = vidioc_s_input, |
diff --git a/drivers/media/video/em28xx/em28xx.h b/drivers/media/video/em28xx/em28xx.h index 45bd513f62dc..8c2dc38bca9f 100644 --- a/drivers/media/video/em28xx/em28xx.h +++ b/drivers/media/video/em28xx/em28xx.h | |||
@@ -484,6 +484,9 @@ struct em28xx { | |||
484 | int sensor_xres, sensor_yres; | 484 | int sensor_xres, sensor_yres; |
485 | int sensor_xtal; | 485 | int sensor_xtal; |
486 | 486 | ||
487 | /* Allows progressive (e. g. non-interlaced) mode */ | ||
488 | int progressive; | ||
489 | |||
487 | /* Vinmode/Vinctl used at the driver */ | 490 | /* Vinmode/Vinctl used at the driver */ |
488 | int vinmode, vinctl; | 491 | int vinmode, vinctl; |
489 | 492 | ||
diff --git a/drivers/media/video/hdpvr/hdpvr-video.c b/drivers/media/video/hdpvr/hdpvr-video.c index ccd47f57f42c..d678765cbba2 100644 --- a/drivers/media/video/hdpvr/hdpvr-video.c +++ b/drivers/media/video/hdpvr/hdpvr-video.c | |||
@@ -1220,6 +1220,8 @@ static const struct video_device hdpvr_video_template = { | |||
1220 | V4L2_STD_PAL_G | V4L2_STD_PAL_H | V4L2_STD_PAL_I | | 1220 | V4L2_STD_PAL_G | V4L2_STD_PAL_H | V4L2_STD_PAL_I | |
1221 | V4L2_STD_PAL_D | V4L2_STD_PAL_M | V4L2_STD_PAL_N | | 1221 | V4L2_STD_PAL_D | V4L2_STD_PAL_M | V4L2_STD_PAL_N | |
1222 | V4L2_STD_PAL_60, | 1222 | V4L2_STD_PAL_60, |
1223 | .current_norm = V4L2_STD_NTSC | V4L2_STD_PAL_M | | ||
1224 | V4L2_STD_PAL_60, | ||
1223 | }; | 1225 | }; |
1224 | 1226 | ||
1225 | int hdpvr_register_videodev(struct hdpvr_device *dev, struct device *parent, | 1227 | int hdpvr_register_videodev(struct hdpvr_device *dev, struct device *parent, |
diff --git a/drivers/media/video/ivtv/ivtv-controls.c b/drivers/media/video/ivtv/ivtv-controls.c index a3b77ed3f089..4a9c8ce0ecb3 100644 --- a/drivers/media/video/ivtv/ivtv-controls.c +++ b/drivers/media/video/ivtv/ivtv-controls.c | |||
@@ -17,6 +17,7 @@ | |||
17 | along with this program; if not, write to the Free Software | 17 | along with this program; if not, write to the Free Software |
18 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 18 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
19 | */ | 19 | */ |
20 | #include <linux/kernel.h> | ||
20 | 21 | ||
21 | #include "ivtv-driver.h" | 22 | #include "ivtv-driver.h" |
22 | #include "ivtv-cards.h" | 23 | #include "ivtv-cards.h" |
@@ -281,7 +282,7 @@ int ivtv_s_ext_ctrls(struct file *file, void *fh, struct v4l2_ext_controls *c) | |||
281 | idx = p.audio_properties & 0x03; | 282 | idx = p.audio_properties & 0x03; |
282 | /* The audio clock of the digitizer must match the codec sample | 283 | /* The audio clock of the digitizer must match the codec sample |
283 | rate otherwise you get some very strange effects. */ | 284 | rate otherwise you get some very strange effects. */ |
284 | if (idx < sizeof(freqs)) | 285 | if (idx < ARRAY_SIZE(freqs)) |
285 | ivtv_call_all(itv, audio, s_clock_freq, freqs[idx]); | 286 | ivtv_call_all(itv, audio, s_clock_freq, freqs[idx]); |
286 | return err; | 287 | return err; |
287 | } | 288 | } |
diff --git a/drivers/media/video/mt9v011.c b/drivers/media/video/mt9v011.c index b2260de645f0..cc85f77a5706 100644 --- a/drivers/media/video/mt9v011.c +++ b/drivers/media/video/mt9v011.c | |||
@@ -52,13 +52,34 @@ static struct v4l2_queryctrl mt9v011_qctrl[] = { | |||
52 | .step = 1, | 52 | .step = 1, |
53 | .default_value = 0, | 53 | .default_value = 0, |
54 | .flags = 0, | 54 | .flags = 0, |
55 | }, | 55 | }, { |
56 | .id = V4L2_CID_HFLIP, | ||
57 | .type = V4L2_CTRL_TYPE_BOOLEAN, | ||
58 | .name = "Mirror", | ||
59 | .minimum = 0, | ||
60 | .maximum = 1, | ||
61 | .step = 1, | ||
62 | .default_value = 0, | ||
63 | .flags = 0, | ||
64 | }, { | ||
65 | .id = V4L2_CID_VFLIP, | ||
66 | .type = V4L2_CTRL_TYPE_BOOLEAN, | ||
67 | .name = "Vflip", | ||
68 | .minimum = 0, | ||
69 | .maximum = 1, | ||
70 | .step = 1, | ||
71 | .default_value = 0, | ||
72 | .flags = 0, | ||
73 | }, { | ||
74 | } | ||
56 | }; | 75 | }; |
57 | 76 | ||
58 | struct mt9v011 { | 77 | struct mt9v011 { |
59 | struct v4l2_subdev sd; | 78 | struct v4l2_subdev sd; |
60 | unsigned width, height; | 79 | unsigned width, height; |
61 | unsigned xtal; | 80 | unsigned xtal; |
81 | unsigned hflip:1; | ||
82 | unsigned vflip:1; | ||
62 | 83 | ||
63 | u16 global_gain, red_bal, blue_bal; | 84 | u16 global_gain, red_bal, blue_bal; |
64 | }; | 85 | }; |
@@ -131,7 +152,6 @@ static const struct i2c_reg_value mt9v011_init_default[] = { | |||
131 | 152 | ||
132 | { R0A_MT9V011_CLK_SPEED, 0x0000 }, | 153 | { R0A_MT9V011_CLK_SPEED, 0x0000 }, |
133 | { R1E_MT9V011_DIGITAL_ZOOM, 0x0000 }, | 154 | { R1E_MT9V011_DIGITAL_ZOOM, 0x0000 }, |
134 | { R20_MT9V011_READ_MODE, 0x1000 }, | ||
135 | 155 | ||
136 | { R07_MT9V011_OUT_CTRL, 0x0002 }, /* chip enable */ | 156 | { R07_MT9V011_OUT_CTRL, 0x0002 }, /* chip enable */ |
137 | }; | 157 | }; |
@@ -156,7 +176,7 @@ static void set_balance(struct v4l2_subdev *sd) | |||
156 | mt9v011_write(sd, R2D_MT9V011_RED_GAIN, red_gain); | 176 | mt9v011_write(sd, R2D_MT9V011_RED_GAIN, red_gain); |
157 | } | 177 | } |
158 | 178 | ||
159 | static void calc_fps(struct v4l2_subdev *sd) | 179 | static void calc_fps(struct v4l2_subdev *sd, u32 *numerator, u32 *denominator) |
160 | { | 180 | { |
161 | struct mt9v011 *core = to_mt9v011(sd); | 181 | struct mt9v011 *core = to_mt9v011(sd); |
162 | unsigned height, width, hblank, vblank, speed; | 182 | unsigned height, width, hblank, vblank, speed; |
@@ -179,6 +199,51 @@ static void calc_fps(struct v4l2_subdev *sd) | |||
179 | 199 | ||
180 | v4l2_dbg(1, debug, sd, "Programmed to %u.%03u fps (%d pixel clcks)\n", | 200 | v4l2_dbg(1, debug, sd, "Programmed to %u.%03u fps (%d pixel clcks)\n", |
181 | tmp / 1000, tmp % 1000, t_time); | 201 | tmp / 1000, tmp % 1000, t_time); |
202 | |||
203 | if (numerator && denominator) { | ||
204 | *numerator = 1000; | ||
205 | *denominator = (u32)frames_per_ms; | ||
206 | } | ||
207 | } | ||
208 | |||
209 | static u16 calc_speed(struct v4l2_subdev *sd, u32 numerator, u32 denominator) | ||
210 | { | ||
211 | struct mt9v011 *core = to_mt9v011(sd); | ||
212 | unsigned height, width, hblank, vblank; | ||
213 | unsigned row_time, line_time; | ||
214 | u64 t_time, speed; | ||
215 | |||
216 | /* Avoid bogus calculus */ | ||
217 | if (!numerator || !denominator) | ||
218 | return 0; | ||
219 | |||
220 | height = mt9v011_read(sd, R03_MT9V011_HEIGHT); | ||
221 | width = mt9v011_read(sd, R04_MT9V011_WIDTH); | ||
222 | hblank = mt9v011_read(sd, R05_MT9V011_HBLANK); | ||
223 | vblank = mt9v011_read(sd, R06_MT9V011_VBLANK); | ||
224 | |||
225 | row_time = width + 113 + hblank; | ||
226 | line_time = height + vblank + 1; | ||
227 | |||
228 | t_time = core->xtal * ((u64)numerator); | ||
229 | /* round to the closest value */ | ||
230 | t_time += denominator / 2; | ||
231 | do_div(t_time, denominator); | ||
232 | |||
233 | speed = t_time; | ||
234 | do_div(speed, row_time * line_time); | ||
235 | |||
236 | /* Avoid having a negative value for speed */ | ||
237 | if (speed < 2) | ||
238 | speed = 0; | ||
239 | else | ||
240 | speed -= 2; | ||
241 | |||
242 | /* Avoid speed overflow */ | ||
243 | if (speed > 15) | ||
244 | return 15; | ||
245 | |||
246 | return (u16)speed; | ||
182 | } | 247 | } |
183 | 248 | ||
184 | static void set_res(struct v4l2_subdev *sd) | 249 | static void set_res(struct v4l2_subdev *sd) |
@@ -207,9 +272,23 @@ static void set_res(struct v4l2_subdev *sd) | |||
207 | mt9v011_write(sd, R03_MT9V011_HEIGHT, core->height); | 272 | mt9v011_write(sd, R03_MT9V011_HEIGHT, core->height); |
208 | mt9v011_write(sd, R06_MT9V011_VBLANK, 508 - core->height); | 273 | mt9v011_write(sd, R06_MT9V011_VBLANK, 508 - core->height); |
209 | 274 | ||
210 | calc_fps(sd); | 275 | calc_fps(sd, NULL, NULL); |
211 | }; | 276 | }; |
212 | 277 | ||
278 | static void set_read_mode(struct v4l2_subdev *sd) | ||
279 | { | ||
280 | struct mt9v011 *core = to_mt9v011(sd); | ||
281 | unsigned mode = 0x1000; | ||
282 | |||
283 | if (core->hflip) | ||
284 | mode |= 0x4000; | ||
285 | |||
286 | if (core->vflip) | ||
287 | mode |= 0x8000; | ||
288 | |||
289 | mt9v011_write(sd, R20_MT9V011_READ_MODE, mode); | ||
290 | } | ||
291 | |||
213 | static int mt9v011_reset(struct v4l2_subdev *sd, u32 val) | 292 | static int mt9v011_reset(struct v4l2_subdev *sd, u32 val) |
214 | { | 293 | { |
215 | int i; | 294 | int i; |
@@ -220,6 +299,7 @@ static int mt9v011_reset(struct v4l2_subdev *sd, u32 val) | |||
220 | 299 | ||
221 | set_balance(sd); | 300 | set_balance(sd); |
222 | set_res(sd); | 301 | set_res(sd); |
302 | set_read_mode(sd); | ||
223 | 303 | ||
224 | return 0; | 304 | return 0; |
225 | }; | 305 | }; |
@@ -240,6 +320,12 @@ static int mt9v011_g_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl) | |||
240 | case V4L2_CID_BLUE_BALANCE: | 320 | case V4L2_CID_BLUE_BALANCE: |
241 | ctrl->value = core->blue_bal; | 321 | ctrl->value = core->blue_bal; |
242 | return 0; | 322 | return 0; |
323 | case V4L2_CID_HFLIP: | ||
324 | ctrl->value = core->hflip ? 1 : 0; | ||
325 | return 0; | ||
326 | case V4L2_CID_VFLIP: | ||
327 | ctrl->value = core->vflip ? 1 : 0; | ||
328 | return 0; | ||
243 | } | 329 | } |
244 | return -EINVAL; | 330 | return -EINVAL; |
245 | } | 331 | } |
@@ -288,6 +374,14 @@ static int mt9v011_s_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl) | |||
288 | case V4L2_CID_BLUE_BALANCE: | 374 | case V4L2_CID_BLUE_BALANCE: |
289 | core->blue_bal = ctrl->value; | 375 | core->blue_bal = ctrl->value; |
290 | break; | 376 | break; |
377 | case V4L2_CID_HFLIP: | ||
378 | core->hflip = ctrl->value; | ||
379 | set_read_mode(sd); | ||
380 | return 0; | ||
381 | case V4L2_CID_VFLIP: | ||
382 | core->vflip = ctrl->value; | ||
383 | set_read_mode(sd); | ||
384 | return 0; | ||
291 | default: | 385 | default: |
292 | return -EINVAL; | 386 | return -EINVAL; |
293 | } | 387 | } |
@@ -322,6 +416,44 @@ static int mt9v011_try_fmt(struct v4l2_subdev *sd, struct v4l2_format *fmt) | |||
322 | return 0; | 416 | return 0; |
323 | } | 417 | } |
324 | 418 | ||
419 | static int mt9v011_g_parm(struct v4l2_subdev *sd, struct v4l2_streamparm *parms) | ||
420 | { | ||
421 | struct v4l2_captureparm *cp = &parms->parm.capture; | ||
422 | |||
423 | if (parms->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) | ||
424 | return -EINVAL; | ||
425 | |||
426 | memset(cp, 0, sizeof(struct v4l2_captureparm)); | ||
427 | cp->capability = V4L2_CAP_TIMEPERFRAME; | ||
428 | calc_fps(sd, | ||
429 | &cp->timeperframe.numerator, | ||
430 | &cp->timeperframe.denominator); | ||
431 | |||
432 | return 0; | ||
433 | } | ||
434 | |||
435 | static int mt9v011_s_parm(struct v4l2_subdev *sd, struct v4l2_streamparm *parms) | ||
436 | { | ||
437 | struct v4l2_captureparm *cp = &parms->parm.capture; | ||
438 | struct v4l2_fract *tpf = &cp->timeperframe; | ||
439 | u16 speed; | ||
440 | |||
441 | if (parms->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) | ||
442 | return -EINVAL; | ||
443 | if (cp->extendedmode != 0) | ||
444 | return -EINVAL; | ||
445 | |||
446 | speed = calc_speed(sd, tpf->numerator, tpf->denominator); | ||
447 | |||
448 | mt9v011_write(sd, R0A_MT9V011_CLK_SPEED, speed); | ||
449 | v4l2_dbg(1, debug, sd, "Setting speed to %d\n", speed); | ||
450 | |||
451 | /* Recalculate and update fps info */ | ||
452 | calc_fps(sd, &tpf->numerator, &tpf->denominator); | ||
453 | |||
454 | return 0; | ||
455 | } | ||
456 | |||
325 | static int mt9v011_s_fmt(struct v4l2_subdev *sd, struct v4l2_format *fmt) | 457 | static int mt9v011_s_fmt(struct v4l2_subdev *sd, struct v4l2_format *fmt) |
326 | { | 458 | { |
327 | struct v4l2_pix_format *pix = &fmt->fmt.pix; | 459 | struct v4l2_pix_format *pix = &fmt->fmt.pix; |
@@ -393,10 +525,13 @@ static int mt9v011_s_register(struct v4l2_subdev *sd, | |||
393 | static int mt9v011_g_chip_ident(struct v4l2_subdev *sd, | 525 | static int mt9v011_g_chip_ident(struct v4l2_subdev *sd, |
394 | struct v4l2_dbg_chip_ident *chip) | 526 | struct v4l2_dbg_chip_ident *chip) |
395 | { | 527 | { |
528 | u16 version; | ||
396 | struct i2c_client *client = v4l2_get_subdevdata(sd); | 529 | struct i2c_client *client = v4l2_get_subdevdata(sd); |
397 | 530 | ||
531 | version = mt9v011_read(sd, R00_MT9V011_CHIP_VERSION); | ||
532 | |||
398 | return v4l2_chip_ident_i2c_client(client, chip, V4L2_IDENT_MT9V011, | 533 | return v4l2_chip_ident_i2c_client(client, chip, V4L2_IDENT_MT9V011, |
399 | MT9V011_VERSION); | 534 | version); |
400 | } | 535 | } |
401 | 536 | ||
402 | static const struct v4l2_subdev_core_ops mt9v011_core_ops = { | 537 | static const struct v4l2_subdev_core_ops mt9v011_core_ops = { |
@@ -416,6 +551,8 @@ static const struct v4l2_subdev_video_ops mt9v011_video_ops = { | |||
416 | .enum_fmt = mt9v011_enum_fmt, | 551 | .enum_fmt = mt9v011_enum_fmt, |
417 | .try_fmt = mt9v011_try_fmt, | 552 | .try_fmt = mt9v011_try_fmt, |
418 | .s_fmt = mt9v011_s_fmt, | 553 | .s_fmt = mt9v011_s_fmt, |
554 | .g_parm = mt9v011_g_parm, | ||
555 | .s_parm = mt9v011_s_parm, | ||
419 | }; | 556 | }; |
420 | 557 | ||
421 | static const struct v4l2_subdev_ops mt9v011_ops = { | 558 | static const struct v4l2_subdev_ops mt9v011_ops = { |
@@ -449,8 +586,9 @@ static int mt9v011_probe(struct i2c_client *c, | |||
449 | 586 | ||
450 | /* Check if the sensor is really a MT9V011 */ | 587 | /* Check if the sensor is really a MT9V011 */ |
451 | version = mt9v011_read(sd, R00_MT9V011_CHIP_VERSION); | 588 | version = mt9v011_read(sd, R00_MT9V011_CHIP_VERSION); |
452 | if (version != MT9V011_VERSION) { | 589 | if ((version != MT9V011_VERSION) && |
453 | v4l2_info(sd, "*** unknown micron chip detected (0x%04x.\n", | 590 | (version != MT9V011_REV_B_VERSION)) { |
591 | v4l2_info(sd, "*** unknown micron chip detected (0x%04x).\n", | ||
454 | version); | 592 | version); |
455 | kfree(core); | 593 | kfree(core); |
456 | return -EINVAL; | 594 | return -EINVAL; |
@@ -461,8 +599,8 @@ static int mt9v011_probe(struct i2c_client *c, | |||
461 | core->height = 480; | 599 | core->height = 480; |
462 | core->xtal = 27000000; /* Hz */ | 600 | core->xtal = 27000000; /* Hz */ |
463 | 601 | ||
464 | v4l_info(c, "chip found @ 0x%02x (%s)\n", | 602 | v4l_info(c, "chip found @ 0x%02x (%s - chip version 0x%04x)\n", |
465 | c->addr << 1, c->adapter->name); | 603 | c->addr << 1, c->adapter->name, version); |
466 | 604 | ||
467 | return 0; | 605 | return 0; |
468 | } | 606 | } |
diff --git a/drivers/media/video/mt9v011.h b/drivers/media/video/mt9v011.h index 9e443ee30558..3350fd6083c3 100644 --- a/drivers/media/video/mt9v011.h +++ b/drivers/media/video/mt9v011.h | |||
@@ -30,6 +30,7 @@ | |||
30 | #define R35_MT9V011_GLOBAL_GAIN 0x35 | 30 | #define R35_MT9V011_GLOBAL_GAIN 0x35 |
31 | #define RF1_MT9V011_CHIP_ENABLE 0xf1 | 31 | #define RF1_MT9V011_CHIP_ENABLE 0xf1 |
32 | 32 | ||
33 | #define MT9V011_VERSION 0x8243 | 33 | #define MT9V011_VERSION 0x8232 |
34 | #define MT9V011_REV_B_VERSION 0x8243 | ||
34 | 35 | ||
35 | #endif | 36 | #endif |
diff --git a/drivers/media/video/mx1_camera.c b/drivers/media/video/mx1_camera.c index 2d075205bdfe..736c31d23194 100644 --- a/drivers/media/video/mx1_camera.c +++ b/drivers/media/video/mx1_camera.c | |||
@@ -234,6 +234,7 @@ static int mx1_camera_setup_dma(struct mx1_camera_dev *pcdev) | |||
234 | return ret; | 234 | return ret; |
235 | } | 235 | } |
236 | 236 | ||
237 | /* Called under spinlock_irqsave(&pcdev->lock, ...) */ | ||
237 | static void mx1_videobuf_queue(struct videobuf_queue *vq, | 238 | static void mx1_videobuf_queue(struct videobuf_queue *vq, |
238 | struct videobuf_buffer *vb) | 239 | struct videobuf_buffer *vb) |
239 | { | 240 | { |
@@ -241,13 +242,10 @@ static void mx1_videobuf_queue(struct videobuf_queue *vq, | |||
241 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); | 242 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); |
242 | struct mx1_camera_dev *pcdev = ici->priv; | 243 | struct mx1_camera_dev *pcdev = ici->priv; |
243 | struct mx1_buffer *buf = container_of(vb, struct mx1_buffer, vb); | 244 | struct mx1_buffer *buf = container_of(vb, struct mx1_buffer, vb); |
244 | unsigned long flags; | ||
245 | 245 | ||
246 | dev_dbg(&icd->dev, "%s (vb=0x%p) 0x%08lx %d\n", __func__, | 246 | dev_dbg(&icd->dev, "%s (vb=0x%p) 0x%08lx %d\n", __func__, |
247 | vb, vb->baddr, vb->bsize); | 247 | vb, vb->baddr, vb->bsize); |
248 | 248 | ||
249 | spin_lock_irqsave(&pcdev->lock, flags); | ||
250 | |||
251 | list_add_tail(&vb->queue, &pcdev->capture); | 249 | list_add_tail(&vb->queue, &pcdev->capture); |
252 | 250 | ||
253 | vb->state = VIDEOBUF_ACTIVE; | 251 | vb->state = VIDEOBUF_ACTIVE; |
@@ -264,8 +262,6 @@ static void mx1_videobuf_queue(struct videobuf_queue *vq, | |||
264 | __raw_writel(temp, pcdev->base + CSICR1); | 262 | __raw_writel(temp, pcdev->base + CSICR1); |
265 | } | 263 | } |
266 | } | 264 | } |
267 | |||
268 | spin_unlock_irqrestore(&pcdev->lock, flags); | ||
269 | } | 265 | } |
270 | 266 | ||
271 | static void mx1_videobuf_release(struct videobuf_queue *vq, | 267 | static void mx1_videobuf_release(struct videobuf_queue *vq, |
diff --git a/drivers/media/video/mx3_camera.c b/drivers/media/video/mx3_camera.c index e605c076ed89..9770cb7932ca 100644 --- a/drivers/media/video/mx3_camera.c +++ b/drivers/media/video/mx3_camera.c | |||
@@ -332,7 +332,10 @@ static enum pixel_fmt fourcc_to_ipu_pix(__u32 fourcc) | |||
332 | } | 332 | } |
333 | } | 333 | } |
334 | 334 | ||
335 | /* Called with .vb_lock held */ | 335 | /* |
336 | * Called with .vb_lock mutex held and | ||
337 | * under spinlock_irqsave(&mx3_cam->lock, ...) | ||
338 | */ | ||
336 | static void mx3_videobuf_queue(struct videobuf_queue *vq, | 339 | static void mx3_videobuf_queue(struct videobuf_queue *vq, |
337 | struct videobuf_buffer *vb) | 340 | struct videobuf_buffer *vb) |
338 | { | 341 | { |
@@ -346,7 +349,8 @@ static void mx3_videobuf_queue(struct videobuf_queue *vq, | |||
346 | struct idmac_video_param *video = &ichan->params.video; | 349 | struct idmac_video_param *video = &ichan->params.video; |
347 | const struct soc_camera_data_format *data_fmt = icd->current_fmt; | 350 | const struct soc_camera_data_format *data_fmt = icd->current_fmt; |
348 | dma_cookie_t cookie; | 351 | dma_cookie_t cookie; |
349 | unsigned long flags; | 352 | |
353 | BUG_ON(!irqs_disabled()); | ||
350 | 354 | ||
351 | /* This is the configuration of one sg-element */ | 355 | /* This is the configuration of one sg-element */ |
352 | video->out_pixel_fmt = fourcc_to_ipu_pix(data_fmt->fourcc); | 356 | video->out_pixel_fmt = fourcc_to_ipu_pix(data_fmt->fourcc); |
@@ -359,8 +363,6 @@ static void mx3_videobuf_queue(struct videobuf_queue *vq, | |||
359 | memset((void *)vb->baddr, 0xaa, vb->bsize); | 363 | memset((void *)vb->baddr, 0xaa, vb->bsize); |
360 | #endif | 364 | #endif |
361 | 365 | ||
362 | spin_lock_irqsave(&mx3_cam->lock, flags); | ||
363 | |||
364 | list_add_tail(&vb->queue, &mx3_cam->capture); | 366 | list_add_tail(&vb->queue, &mx3_cam->capture); |
365 | 367 | ||
366 | if (!mx3_cam->active) { | 368 | if (!mx3_cam->active) { |
@@ -370,24 +372,23 @@ static void mx3_videobuf_queue(struct videobuf_queue *vq, | |||
370 | vb->state = VIDEOBUF_QUEUED; | 372 | vb->state = VIDEOBUF_QUEUED; |
371 | } | 373 | } |
372 | 374 | ||
373 | spin_unlock_irqrestore(&mx3_cam->lock, flags); | 375 | spin_unlock_irq(&mx3_cam->lock); |
374 | 376 | ||
375 | cookie = txd->tx_submit(txd); | 377 | cookie = txd->tx_submit(txd); |
376 | dev_dbg(&icd->dev, "Submitted cookie %d DMA 0x%08x\n", cookie, sg_dma_address(&buf->sg)); | 378 | dev_dbg(&icd->dev, "Submitted cookie %d DMA 0x%08x\n", cookie, sg_dma_address(&buf->sg)); |
379 | |||
380 | spin_lock_irq(&mx3_cam->lock); | ||
381 | |||
377 | if (cookie >= 0) | 382 | if (cookie >= 0) |
378 | return; | 383 | return; |
379 | 384 | ||
380 | /* Submit error */ | 385 | /* Submit error */ |
381 | vb->state = VIDEOBUF_PREPARED; | 386 | vb->state = VIDEOBUF_PREPARED; |
382 | 387 | ||
383 | spin_lock_irqsave(&mx3_cam->lock, flags); | ||
384 | |||
385 | list_del_init(&vb->queue); | 388 | list_del_init(&vb->queue); |
386 | 389 | ||
387 | if (mx3_cam->active == buf) | 390 | if (mx3_cam->active == buf) |
388 | mx3_cam->active = NULL; | 391 | mx3_cam->active = NULL; |
389 | |||
390 | spin_unlock_irqrestore(&mx3_cam->lock, flags); | ||
391 | } | 392 | } |
392 | 393 | ||
393 | /* Called with .vb_lock held */ | 394 | /* Called with .vb_lock held */ |
diff --git a/drivers/media/video/pxa_camera.c b/drivers/media/video/pxa_camera.c index 46e0d8ad880f..016bb45ba0c3 100644 --- a/drivers/media/video/pxa_camera.c +++ b/drivers/media/video/pxa_camera.c | |||
@@ -612,6 +612,7 @@ static void pxa_camera_stop_capture(struct pxa_camera_dev *pcdev) | |||
612 | dev_dbg(pcdev->soc_host.dev, "%s\n", __func__); | 612 | dev_dbg(pcdev->soc_host.dev, "%s\n", __func__); |
613 | } | 613 | } |
614 | 614 | ||
615 | /* Called under spinlock_irqsave(&pcdev->lock, ...) */ | ||
615 | static void pxa_videobuf_queue(struct videobuf_queue *vq, | 616 | static void pxa_videobuf_queue(struct videobuf_queue *vq, |
616 | struct videobuf_buffer *vb) | 617 | struct videobuf_buffer *vb) |
617 | { | 618 | { |
@@ -619,13 +620,10 @@ static void pxa_videobuf_queue(struct videobuf_queue *vq, | |||
619 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); | 620 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); |
620 | struct pxa_camera_dev *pcdev = ici->priv; | 621 | struct pxa_camera_dev *pcdev = ici->priv; |
621 | struct pxa_buffer *buf = container_of(vb, struct pxa_buffer, vb); | 622 | struct pxa_buffer *buf = container_of(vb, struct pxa_buffer, vb); |
622 | unsigned long flags; | ||
623 | 623 | ||
624 | dev_dbg(&icd->dev, "%s (vb=0x%p) 0x%08lx %d active=%p\n", __func__, | 624 | dev_dbg(&icd->dev, "%s (vb=0x%p) 0x%08lx %d active=%p\n", __func__, |
625 | vb, vb->baddr, vb->bsize, pcdev->active); | 625 | vb, vb->baddr, vb->bsize, pcdev->active); |
626 | 626 | ||
627 | spin_lock_irqsave(&pcdev->lock, flags); | ||
628 | |||
629 | list_add_tail(&vb->queue, &pcdev->capture); | 627 | list_add_tail(&vb->queue, &pcdev->capture); |
630 | 628 | ||
631 | vb->state = VIDEOBUF_ACTIVE; | 629 | vb->state = VIDEOBUF_ACTIVE; |
@@ -633,8 +631,6 @@ static void pxa_videobuf_queue(struct videobuf_queue *vq, | |||
633 | 631 | ||
634 | if (!pcdev->active) | 632 | if (!pcdev->active) |
635 | pxa_camera_start_capture(pcdev); | 633 | pxa_camera_start_capture(pcdev); |
636 | |||
637 | spin_unlock_irqrestore(&pcdev->lock, flags); | ||
638 | } | 634 | } |
639 | 635 | ||
640 | static void pxa_videobuf_release(struct videobuf_queue *vq, | 636 | static void pxa_videobuf_release(struct videobuf_queue *vq, |
@@ -1579,6 +1575,7 @@ static int __devinit pxa_camera_probe(struct platform_device *pdev) | |||
1579 | pcdev->mclk = 20000000; | 1575 | pcdev->mclk = 20000000; |
1580 | } | 1576 | } |
1581 | 1577 | ||
1578 | pcdev->soc_host.dev = &pdev->dev; | ||
1582 | pcdev->mclk_divisor = mclk_get_divisor(pcdev); | 1579 | pcdev->mclk_divisor = mclk_get_divisor(pcdev); |
1583 | 1580 | ||
1584 | INIT_LIST_HEAD(&pcdev->capture); | 1581 | INIT_LIST_HEAD(&pcdev->capture); |
@@ -1644,7 +1641,6 @@ static int __devinit pxa_camera_probe(struct platform_device *pdev) | |||
1644 | pcdev->soc_host.drv_name = PXA_CAM_DRV_NAME; | 1641 | pcdev->soc_host.drv_name = PXA_CAM_DRV_NAME; |
1645 | pcdev->soc_host.ops = &pxa_soc_camera_host_ops; | 1642 | pcdev->soc_host.ops = &pxa_soc_camera_host_ops; |
1646 | pcdev->soc_host.priv = pcdev; | 1643 | pcdev->soc_host.priv = pcdev; |
1647 | pcdev->soc_host.dev = &pdev->dev; | ||
1648 | pcdev->soc_host.nr = pdev->id; | 1644 | pcdev->soc_host.nr = pdev->id; |
1649 | 1645 | ||
1650 | err = soc_camera_host_register(&pcdev->soc_host); | 1646 | err = soc_camera_host_register(&pcdev->soc_host); |
diff --git a/drivers/media/video/saa7134/saa7134-cards.c b/drivers/media/video/saa7134/saa7134-cards.c index 06861b782b95..6eebe3ef97d3 100644 --- a/drivers/media/video/saa7134/saa7134-cards.c +++ b/drivers/media/video/saa7134/saa7134-cards.c | |||
@@ -3331,8 +3331,8 @@ struct saa7134_board saa7134_boards[] = { | |||
3331 | .gpio = 0x0200100, | 3331 | .gpio = 0x0200100, |
3332 | }, | 3332 | }, |
3333 | }, | 3333 | }, |
3334 | [SAA7134_BOARD_HAUPPAUGE_HVR1120] = { | 3334 | [SAA7134_BOARD_HAUPPAUGE_HVR1150] = { |
3335 | .name = "Hauppauge WinTV-HVR1120 ATSC/QAM-Hybrid", | 3335 | .name = "Hauppauge WinTV-HVR1150 ATSC/QAM-Hybrid", |
3336 | .audio_clock = 0x00187de7, | 3336 | .audio_clock = 0x00187de7, |
3337 | .tuner_type = TUNER_PHILIPS_TDA8290, | 3337 | .tuner_type = TUNER_PHILIPS_TDA8290, |
3338 | .radio_type = UNSET, | 3338 | .radio_type = UNSET, |
@@ -3363,8 +3363,8 @@ struct saa7134_board saa7134_boards[] = { | |||
3363 | .gpio = 0x0800100, /* GPIO 23 HI for FM */ | 3363 | .gpio = 0x0800100, /* GPIO 23 HI for FM */ |
3364 | }, | 3364 | }, |
3365 | }, | 3365 | }, |
3366 | [SAA7134_BOARD_HAUPPAUGE_HVR1110R3] = { | 3366 | [SAA7134_BOARD_HAUPPAUGE_HVR1120] = { |
3367 | .name = "Hauppauge WinTV-HVR1110r3 DVB-T/Hybrid", | 3367 | .name = "Hauppauge WinTV-HVR1120 DVB-T/Hybrid", |
3368 | .audio_clock = 0x00187de7, | 3368 | .audio_clock = 0x00187de7, |
3369 | .tuner_type = TUNER_PHILIPS_TDA8290, | 3369 | .tuner_type = TUNER_PHILIPS_TDA8290, |
3370 | .radio_type = UNSET, | 3370 | .radio_type = UNSET, |
@@ -5862,31 +5862,31 @@ struct pci_device_id saa7134_pci_tbl[] = { | |||
5862 | .device = PCI_DEVICE_ID_PHILIPS_SAA7133, | 5862 | .device = PCI_DEVICE_ID_PHILIPS_SAA7133, |
5863 | .subvendor = 0x0070, | 5863 | .subvendor = 0x0070, |
5864 | .subdevice = 0x6706, | 5864 | .subdevice = 0x6706, |
5865 | .driver_data = SAA7134_BOARD_HAUPPAUGE_HVR1120, | 5865 | .driver_data = SAA7134_BOARD_HAUPPAUGE_HVR1150, |
5866 | },{ | 5866 | },{ |
5867 | .vendor = PCI_VENDOR_ID_PHILIPS, | 5867 | .vendor = PCI_VENDOR_ID_PHILIPS, |
5868 | .device = PCI_DEVICE_ID_PHILIPS_SAA7133, | 5868 | .device = PCI_DEVICE_ID_PHILIPS_SAA7133, |
5869 | .subvendor = 0x0070, | 5869 | .subvendor = 0x0070, |
5870 | .subdevice = 0x6707, | 5870 | .subdevice = 0x6707, |
5871 | .driver_data = SAA7134_BOARD_HAUPPAUGE_HVR1110R3, | 5871 | .driver_data = SAA7134_BOARD_HAUPPAUGE_HVR1120, |
5872 | },{ | 5872 | },{ |
5873 | .vendor = PCI_VENDOR_ID_PHILIPS, | 5873 | .vendor = PCI_VENDOR_ID_PHILIPS, |
5874 | .device = PCI_DEVICE_ID_PHILIPS_SAA7133, | 5874 | .device = PCI_DEVICE_ID_PHILIPS_SAA7133, |
5875 | .subvendor = 0x0070, | 5875 | .subvendor = 0x0070, |
5876 | .subdevice = 0x6708, | 5876 | .subdevice = 0x6708, |
5877 | .driver_data = SAA7134_BOARD_HAUPPAUGE_HVR1120, | 5877 | .driver_data = SAA7134_BOARD_HAUPPAUGE_HVR1150, |
5878 | },{ | 5878 | },{ |
5879 | .vendor = PCI_VENDOR_ID_PHILIPS, | 5879 | .vendor = PCI_VENDOR_ID_PHILIPS, |
5880 | .device = PCI_DEVICE_ID_PHILIPS_SAA7133, | 5880 | .device = PCI_DEVICE_ID_PHILIPS_SAA7133, |
5881 | .subvendor = 0x0070, | 5881 | .subvendor = 0x0070, |
5882 | .subdevice = 0x6709, | 5882 | .subdevice = 0x6709, |
5883 | .driver_data = SAA7134_BOARD_HAUPPAUGE_HVR1110R3, | 5883 | .driver_data = SAA7134_BOARD_HAUPPAUGE_HVR1120, |
5884 | },{ | 5884 | },{ |
5885 | .vendor = PCI_VENDOR_ID_PHILIPS, | 5885 | .vendor = PCI_VENDOR_ID_PHILIPS, |
5886 | .device = PCI_DEVICE_ID_PHILIPS_SAA7133, | 5886 | .device = PCI_DEVICE_ID_PHILIPS_SAA7133, |
5887 | .subvendor = 0x0070, | 5887 | .subvendor = 0x0070, |
5888 | .subdevice = 0x670a, | 5888 | .subdevice = 0x670a, |
5889 | .driver_data = SAA7134_BOARD_HAUPPAUGE_HVR1110R3, | 5889 | .driver_data = SAA7134_BOARD_HAUPPAUGE_HVR1120, |
5890 | },{ | 5890 | },{ |
5891 | .vendor = PCI_VENDOR_ID_PHILIPS, | 5891 | .vendor = PCI_VENDOR_ID_PHILIPS, |
5892 | .device = PCI_DEVICE_ID_PHILIPS_SAA7133, | 5892 | .device = PCI_DEVICE_ID_PHILIPS_SAA7133, |
@@ -6363,8 +6363,8 @@ static int saa7134_tda8290_18271_callback(struct saa7134_dev *dev, | |||
6363 | switch (command) { | 6363 | switch (command) { |
6364 | case TDA18271_CALLBACK_CMD_AGC_ENABLE: /* 0 */ | 6364 | case TDA18271_CALLBACK_CMD_AGC_ENABLE: /* 0 */ |
6365 | switch (dev->board) { | 6365 | switch (dev->board) { |
6366 | case SAA7134_BOARD_HAUPPAUGE_HVR1150: | ||
6366 | case SAA7134_BOARD_HAUPPAUGE_HVR1120: | 6367 | case SAA7134_BOARD_HAUPPAUGE_HVR1120: |
6367 | case SAA7134_BOARD_HAUPPAUGE_HVR1110R3: | ||
6368 | ret = saa7134_tda18271_hvr11x0_toggle_agc(dev, arg); | 6368 | ret = saa7134_tda18271_hvr11x0_toggle_agc(dev, arg); |
6369 | break; | 6369 | break; |
6370 | default: | 6370 | default: |
@@ -6384,8 +6384,8 @@ static int saa7134_tda8290_callback(struct saa7134_dev *dev, | |||
6384 | int ret; | 6384 | int ret; |
6385 | 6385 | ||
6386 | switch (dev->board) { | 6386 | switch (dev->board) { |
6387 | case SAA7134_BOARD_HAUPPAUGE_HVR1150: | ||
6387 | case SAA7134_BOARD_HAUPPAUGE_HVR1120: | 6388 | case SAA7134_BOARD_HAUPPAUGE_HVR1120: |
6388 | case SAA7134_BOARD_HAUPPAUGE_HVR1110R3: | ||
6389 | /* tda8290 + tda18271 */ | 6389 | /* tda8290 + tda18271 */ |
6390 | ret = saa7134_tda8290_18271_callback(dev, command, arg); | 6390 | ret = saa7134_tda8290_18271_callback(dev, command, arg); |
6391 | break; | 6391 | break; |
@@ -6427,7 +6427,7 @@ static void hauppauge_eeprom(struct saa7134_dev *dev, u8 *eeprom_data) | |||
6427 | switch (tv.model) { | 6427 | switch (tv.model) { |
6428 | case 67019: /* WinTV-HVR1110 (Retail, IR Blaster, hybrid, FM, SVid/Comp, 3.5mm audio in) */ | 6428 | case 67019: /* WinTV-HVR1110 (Retail, IR Blaster, hybrid, FM, SVid/Comp, 3.5mm audio in) */ |
6429 | case 67109: /* WinTV-HVR1000 (Retail, IR Receive, analog, no FM, SVid/Comp, 3.5mm audio in) */ | 6429 | case 67109: /* WinTV-HVR1000 (Retail, IR Receive, analog, no FM, SVid/Comp, 3.5mm audio in) */ |
6430 | case 67201: /* WinTV-HVR1120 (Retail, IR Receive, hybrid, FM, SVid/Comp, 3.5mm audio in) */ | 6430 | case 67201: /* WinTV-HVR1150 (Retail, IR Receive, hybrid, FM, SVid/Comp, 3.5mm audio in) */ |
6431 | case 67301: /* WinTV-HVR1000 (Retail, IR Receive, analog, no FM, SVid/Comp, 3.5mm audio in) */ | 6431 | case 67301: /* WinTV-HVR1000 (Retail, IR Receive, analog, no FM, SVid/Comp, 3.5mm audio in) */ |
6432 | case 67209: /* WinTV-HVR1110 (Retail, IR Receive, hybrid, FM, SVid/Comp, 3.5mm audio in) */ | 6432 | case 67209: /* WinTV-HVR1110 (Retail, IR Receive, hybrid, FM, SVid/Comp, 3.5mm audio in) */ |
6433 | case 67559: /* WinTV-HVR1110 (OEM, no IR, hybrid, FM, SVid/Comp, RCA aud) */ | 6433 | case 67559: /* WinTV-HVR1110 (OEM, no IR, hybrid, FM, SVid/Comp, RCA aud) */ |
@@ -6435,7 +6435,7 @@ static void hauppauge_eeprom(struct saa7134_dev *dev, u8 *eeprom_data) | |||
6435 | case 67579: /* WinTV-HVR1110 (OEM, no IR, hybrid, no FM) */ | 6435 | case 67579: /* WinTV-HVR1110 (OEM, no IR, hybrid, no FM) */ |
6436 | case 67589: /* WinTV-HVR1110 (OEM, no IR, hybrid, no FM, SVid/Comp, RCA aud) */ | 6436 | case 67589: /* WinTV-HVR1110 (OEM, no IR, hybrid, no FM, SVid/Comp, RCA aud) */ |
6437 | case 67599: /* WinTV-HVR1110 (OEM, no IR, hybrid, no FM, SVid/Comp, RCA aud) */ | 6437 | case 67599: /* WinTV-HVR1110 (OEM, no IR, hybrid, no FM, SVid/Comp, RCA aud) */ |
6438 | case 67651: /* WinTV-HVR1120 (OEM, no IR, hybrid, FM, SVid/Comp, RCA aud) */ | 6438 | case 67651: /* WinTV-HVR1150 (OEM, no IR, hybrid, FM, SVid/Comp, RCA aud) */ |
6439 | case 67659: /* WinTV-HVR1110 (OEM, no IR, hybrid, FM, SVid/Comp, RCA aud) */ | 6439 | case 67659: /* WinTV-HVR1110 (OEM, no IR, hybrid, FM, SVid/Comp, RCA aud) */ |
6440 | break; | 6440 | break; |
6441 | default: | 6441 | default: |
@@ -6625,8 +6625,8 @@ int saa7134_board_init1(struct saa7134_dev *dev) | |||
6625 | 6625 | ||
6626 | saa_writeb (SAA7134_PRODUCTION_TEST_MODE, 0x00); | 6626 | saa_writeb (SAA7134_PRODUCTION_TEST_MODE, 0x00); |
6627 | break; | 6627 | break; |
6628 | case SAA7134_BOARD_HAUPPAUGE_HVR1150: | ||
6628 | case SAA7134_BOARD_HAUPPAUGE_HVR1120: | 6629 | case SAA7134_BOARD_HAUPPAUGE_HVR1120: |
6629 | case SAA7134_BOARD_HAUPPAUGE_HVR1110R3: | ||
6630 | /* GPIO 26 high for digital, low for analog */ | 6630 | /* GPIO 26 high for digital, low for analog */ |
6631 | saa7134_set_gpio(dev, 26, 0); | 6631 | saa7134_set_gpio(dev, 26, 0); |
6632 | msleep(1); | 6632 | msleep(1); |
@@ -6891,8 +6891,8 @@ int saa7134_board_init2(struct saa7134_dev *dev) | |||
6891 | dev->name, saa7134_boards[dev->board].name); | 6891 | dev->name, saa7134_boards[dev->board].name); |
6892 | } | 6892 | } |
6893 | break; | 6893 | break; |
6894 | case SAA7134_BOARD_HAUPPAUGE_HVR1150: | ||
6894 | case SAA7134_BOARD_HAUPPAUGE_HVR1120: | 6895 | case SAA7134_BOARD_HAUPPAUGE_HVR1120: |
6895 | case SAA7134_BOARD_HAUPPAUGE_HVR1110R3: | ||
6896 | hauppauge_eeprom(dev, dev->eedata+0x80); | 6896 | hauppauge_eeprom(dev, dev->eedata+0x80); |
6897 | break; | 6897 | break; |
6898 | case SAA7134_BOARD_HAUPPAUGE_HVR1110: | 6898 | case SAA7134_BOARD_HAUPPAUGE_HVR1110: |
diff --git a/drivers/media/video/saa7134/saa7134-dvb.c b/drivers/media/video/saa7134/saa7134-dvb.c index 31930f26ffc7..98f3efd1e944 100644 --- a/drivers/media/video/saa7134/saa7134-dvb.c +++ b/drivers/media/video/saa7134/saa7134-dvb.c | |||
@@ -1119,7 +1119,7 @@ static int dvb_init(struct saa7134_dev *dev) | |||
1119 | &tda827x_cfg_2) < 0) | 1119 | &tda827x_cfg_2) < 0) |
1120 | goto dettach_frontend; | 1120 | goto dettach_frontend; |
1121 | break; | 1121 | break; |
1122 | case SAA7134_BOARD_HAUPPAUGE_HVR1110R3: | 1122 | case SAA7134_BOARD_HAUPPAUGE_HVR1120: |
1123 | fe0->dvb.frontend = dvb_attach(tda10048_attach, | 1123 | fe0->dvb.frontend = dvb_attach(tda10048_attach, |
1124 | &hcw_tda10048_config, | 1124 | &hcw_tda10048_config, |
1125 | &dev->i2c_adap); | 1125 | &dev->i2c_adap); |
@@ -1147,7 +1147,7 @@ static int dvb_init(struct saa7134_dev *dev) | |||
1147 | &tda827x_cfg_1) < 0) | 1147 | &tda827x_cfg_1) < 0) |
1148 | goto dettach_frontend; | 1148 | goto dettach_frontend; |
1149 | break; | 1149 | break; |
1150 | case SAA7134_BOARD_HAUPPAUGE_HVR1120: | 1150 | case SAA7134_BOARD_HAUPPAUGE_HVR1150: |
1151 | fe0->dvb.frontend = dvb_attach(lgdt3305_attach, | 1151 | fe0->dvb.frontend = dvb_attach(lgdt3305_attach, |
1152 | &hcw_lgdt3305_config, | 1152 | &hcw_lgdt3305_config, |
1153 | &dev->i2c_adap); | 1153 | &dev->i2c_adap); |
diff --git a/drivers/media/video/saa7134/saa7134.h b/drivers/media/video/saa7134/saa7134.h index 82268848f26a..fb564f14887c 100644 --- a/drivers/media/video/saa7134/saa7134.h +++ b/drivers/media/video/saa7134/saa7134.h | |||
@@ -278,8 +278,8 @@ struct saa7134_format { | |||
278 | #define SAA7134_BOARD_ASUSTeK_TIGER 152 | 278 | #define SAA7134_BOARD_ASUSTeK_TIGER 152 |
279 | #define SAA7134_BOARD_KWORLD_PLUS_TV_ANALOG 153 | 279 | #define SAA7134_BOARD_KWORLD_PLUS_TV_ANALOG 153 |
280 | #define SAA7134_BOARD_AVERMEDIA_GO_007_FM_PLUS 154 | 280 | #define SAA7134_BOARD_AVERMEDIA_GO_007_FM_PLUS 154 |
281 | #define SAA7134_BOARD_HAUPPAUGE_HVR1120 155 | 281 | #define SAA7134_BOARD_HAUPPAUGE_HVR1150 155 |
282 | #define SAA7134_BOARD_HAUPPAUGE_HVR1110R3 156 | 282 | #define SAA7134_BOARD_HAUPPAUGE_HVR1120 156 |
283 | #define SAA7134_BOARD_AVERMEDIA_STUDIO_507UA 157 | 283 | #define SAA7134_BOARD_AVERMEDIA_STUDIO_507UA 157 |
284 | #define SAA7134_BOARD_AVERMEDIA_CARDBUS_501 158 | 284 | #define SAA7134_BOARD_AVERMEDIA_CARDBUS_501 158 |
285 | #define SAA7134_BOARD_BEHOLD_505RDS 159 | 285 | #define SAA7134_BOARD_BEHOLD_505RDS 159 |
diff --git a/drivers/media/video/sh_mobile_ceu_camera.c b/drivers/media/video/sh_mobile_ceu_camera.c index 0db88a53d92c..e86878deea71 100644 --- a/drivers/media/video/sh_mobile_ceu_camera.c +++ b/drivers/media/video/sh_mobile_ceu_camera.c | |||
@@ -282,27 +282,24 @@ out: | |||
282 | return ret; | 282 | return ret; |
283 | } | 283 | } |
284 | 284 | ||
285 | /* Called under spinlock_irqsave(&pcdev->lock, ...) */ | ||
285 | static void sh_mobile_ceu_videobuf_queue(struct videobuf_queue *vq, | 286 | static void sh_mobile_ceu_videobuf_queue(struct videobuf_queue *vq, |
286 | struct videobuf_buffer *vb) | 287 | struct videobuf_buffer *vb) |
287 | { | 288 | { |
288 | struct soc_camera_device *icd = vq->priv_data; | 289 | struct soc_camera_device *icd = vq->priv_data; |
289 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); | 290 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); |
290 | struct sh_mobile_ceu_dev *pcdev = ici->priv; | 291 | struct sh_mobile_ceu_dev *pcdev = ici->priv; |
291 | unsigned long flags; | ||
292 | 292 | ||
293 | dev_dbg(&icd->dev, "%s (vb=0x%p) 0x%08lx %zd\n", __func__, | 293 | dev_dbg(&icd->dev, "%s (vb=0x%p) 0x%08lx %zd\n", __func__, |
294 | vb, vb->baddr, vb->bsize); | 294 | vb, vb->baddr, vb->bsize); |
295 | 295 | ||
296 | vb->state = VIDEOBUF_QUEUED; | 296 | vb->state = VIDEOBUF_QUEUED; |
297 | spin_lock_irqsave(&pcdev->lock, flags); | ||
298 | list_add_tail(&vb->queue, &pcdev->capture); | 297 | list_add_tail(&vb->queue, &pcdev->capture); |
299 | 298 | ||
300 | if (!pcdev->active) { | 299 | if (!pcdev->active) { |
301 | pcdev->active = vb; | 300 | pcdev->active = vb; |
302 | sh_mobile_ceu_capture(pcdev); | 301 | sh_mobile_ceu_capture(pcdev); |
303 | } | 302 | } |
304 | |||
305 | spin_unlock_irqrestore(&pcdev->lock, flags); | ||
306 | } | 303 | } |
307 | 304 | ||
308 | static void sh_mobile_ceu_videobuf_release(struct videobuf_queue *vq, | 305 | static void sh_mobile_ceu_videobuf_release(struct videobuf_queue *vq, |
diff --git a/drivers/media/video/stk-webcam.c b/drivers/media/video/stk-webcam.c index 4d6785e63455..b154bd961e3b 100644 --- a/drivers/media/video/stk-webcam.c +++ b/drivers/media/video/stk-webcam.c | |||
@@ -1050,8 +1050,8 @@ static int stk_setup_format(struct stk_camera *dev) | |||
1050 | depth = 1; | 1050 | depth = 1; |
1051 | else | 1051 | else |
1052 | depth = 2; | 1052 | depth = 2; |
1053 | while (stk_sizes[i].m != dev->vsettings.mode | 1053 | while (i < ARRAY_SIZE(stk_sizes) && |
1054 | && i < ARRAY_SIZE(stk_sizes)) | 1054 | stk_sizes[i].m != dev->vsettings.mode) |
1055 | i++; | 1055 | i++; |
1056 | if (i == ARRAY_SIZE(stk_sizes)) { | 1056 | if (i == ARRAY_SIZE(stk_sizes)) { |
1057 | STK_ERROR("Something is broken in %s\n", __func__); | 1057 | STK_ERROR("Something is broken in %s\n", __func__); |
diff --git a/drivers/media/video/uvc/uvc_driver.c b/drivers/media/video/uvc/uvc_driver.c index 89927b7aec28..04b47832fa0a 100644 --- a/drivers/media/video/uvc/uvc_driver.c +++ b/drivers/media/video/uvc/uvc_driver.c | |||
@@ -1845,11 +1845,29 @@ static struct usb_device_id uvc_ids[] = { | |||
1845 | .bInterfaceSubClass = 1, | 1845 | .bInterfaceSubClass = 1, |
1846 | .bInterfaceProtocol = 0, | 1846 | .bInterfaceProtocol = 0, |
1847 | .driver_info = UVC_QUIRK_STREAM_NO_FID }, | 1847 | .driver_info = UVC_QUIRK_STREAM_NO_FID }, |
1848 | /* ViMicro */ | 1848 | /* ViMicro Vega */ |
1849 | { .match_flags = USB_DEVICE_ID_MATCH_VENDOR | 1849 | { .match_flags = USB_DEVICE_ID_MATCH_DEVICE |
1850 | | USB_DEVICE_ID_MATCH_INT_INFO, | ||
1851 | .idVendor = 0x0ac8, | ||
1852 | .idProduct = 0x332d, | ||
1853 | .bInterfaceClass = USB_CLASS_VIDEO, | ||
1854 | .bInterfaceSubClass = 1, | ||
1855 | .bInterfaceProtocol = 0, | ||
1856 | .driver_info = UVC_QUIRK_FIX_BANDWIDTH }, | ||
1857 | /* ViMicro - Minoru3D */ | ||
1858 | { .match_flags = USB_DEVICE_ID_MATCH_DEVICE | ||
1859 | | USB_DEVICE_ID_MATCH_INT_INFO, | ||
1860 | .idVendor = 0x0ac8, | ||
1861 | .idProduct = 0x3410, | ||
1862 | .bInterfaceClass = USB_CLASS_VIDEO, | ||
1863 | .bInterfaceSubClass = 1, | ||
1864 | .bInterfaceProtocol = 0, | ||
1865 | .driver_info = UVC_QUIRK_FIX_BANDWIDTH }, | ||
1866 | /* ViMicro Venus - Minoru3D */ | ||
1867 | { .match_flags = USB_DEVICE_ID_MATCH_DEVICE | ||
1850 | | USB_DEVICE_ID_MATCH_INT_INFO, | 1868 | | USB_DEVICE_ID_MATCH_INT_INFO, |
1851 | .idVendor = 0x0ac8, | 1869 | .idVendor = 0x0ac8, |
1852 | .idProduct = 0x0000, | 1870 | .idProduct = 0x3420, |
1853 | .bInterfaceClass = USB_CLASS_VIDEO, | 1871 | .bInterfaceClass = USB_CLASS_VIDEO, |
1854 | .bInterfaceSubClass = 1, | 1872 | .bInterfaceSubClass = 1, |
1855 | .bInterfaceProtocol = 0, | 1873 | .bInterfaceProtocol = 0, |
diff --git a/drivers/media/video/uvc/uvc_status.c b/drivers/media/video/uvc/uvc_status.c index f152a9903862..1ca6dff73612 100644 --- a/drivers/media/video/uvc/uvc_status.c +++ b/drivers/media/video/uvc/uvc_status.c | |||
@@ -145,8 +145,8 @@ static void uvc_status_complete(struct urb *urb) | |||
145 | break; | 145 | break; |
146 | 146 | ||
147 | default: | 147 | default: |
148 | uvc_printk(KERN_INFO, "unknown event type %u.\n", | 148 | uvc_trace(UVC_TRACE_STATUS, "Unknown status event " |
149 | dev->status[0]); | 149 | "type %u.\n", dev->status[0]); |
150 | break; | 150 | break; |
151 | } | 151 | } |
152 | } | 152 | } |
diff --git a/drivers/media/video/v4l2-ioctl.c b/drivers/media/video/v4l2-ioctl.c index be64a502ea27..f2afc4e08379 100644 --- a/drivers/media/video/v4l2-ioctl.c +++ b/drivers/media/video/v4l2-ioctl.c | |||
@@ -1081,8 +1081,10 @@ static long __video_do_ioctl(struct file *file, | |||
1081 | /* Calls the specific handler */ | 1081 | /* Calls the specific handler */ |
1082 | if (ops->vidioc_g_std) | 1082 | if (ops->vidioc_g_std) |
1083 | ret = ops->vidioc_g_std(file, fh, id); | 1083 | ret = ops->vidioc_g_std(file, fh, id); |
1084 | else | 1084 | else if (vfd->current_norm) |
1085 | *id = vfd->current_norm; | 1085 | *id = vfd->current_norm; |
1086 | else | ||
1087 | ret = -EINVAL; | ||
1086 | 1088 | ||
1087 | if (!ret) | 1089 | if (!ret) |
1088 | dbgarg(cmd, "std=0x%08Lx\n", (long long unsigned)*id); | 1090 | dbgarg(cmd, "std=0x%08Lx\n", (long long unsigned)*id); |
@@ -1553,12 +1555,19 @@ static long __video_do_ioctl(struct file *file, | |||
1553 | break; | 1555 | break; |
1554 | ret = ops->vidioc_g_parm(file, fh, p); | 1556 | ret = ops->vidioc_g_parm(file, fh, p); |
1555 | } else { | 1557 | } else { |
1558 | v4l2_std_id std = vfd->current_norm; | ||
1559 | |||
1556 | if (p->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) | 1560 | if (p->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) |
1557 | return -EINVAL; | 1561 | return -EINVAL; |
1558 | 1562 | ||
1559 | v4l2_video_std_frame_period(vfd->current_norm, | ||
1560 | &p->parm.capture.timeperframe); | ||
1561 | ret = 0; | 1563 | ret = 0; |
1564 | if (ops->vidioc_g_std) | ||
1565 | ret = ops->vidioc_g_std(file, fh, &std); | ||
1566 | else if (std == 0) | ||
1567 | ret = -EINVAL; | ||
1568 | if (ret == 0) | ||
1569 | v4l2_video_std_frame_period(std, | ||
1570 | &p->parm.capture.timeperframe); | ||
1562 | } | 1571 | } |
1563 | 1572 | ||
1564 | dbgarg(cmd, "type=%d\n", p->type); | 1573 | dbgarg(cmd, "type=%d\n", p->type); |
diff --git a/drivers/mtd/maps/sbc8240.c b/drivers/mtd/maps/sbc8240.c deleted file mode 100644 index e69de29bb2d1..000000000000 --- a/drivers/mtd/maps/sbc8240.c +++ /dev/null | |||
diff --git a/fs/gfs2/sys.c b/fs/gfs2/sys.c index 23419dc3027b..a7cbfbd340c7 100644 --- a/fs/gfs2/sys.c +++ b/fs/gfs2/sys.c | |||
@@ -386,16 +386,16 @@ static ssize_t jid_show(struct gfs2_sbd *sdp, char *buf) | |||
386 | #define GDLM_ATTR(_name,_mode,_show,_store) \ | 386 | #define GDLM_ATTR(_name,_mode,_show,_store) \ |
387 | static struct gfs2_attr gdlm_attr_##_name = __ATTR(_name,_mode,_show,_store) | 387 | static struct gfs2_attr gdlm_attr_##_name = __ATTR(_name,_mode,_show,_store) |
388 | 388 | ||
389 | GDLM_ATTR(proto_name, 0444, proto_name_show, NULL); | 389 | GDLM_ATTR(proto_name, 0444, proto_name_show, NULL); |
390 | GDLM_ATTR(block, 0644, block_show, block_store); | 390 | GDLM_ATTR(block, 0644, block_show, block_store); |
391 | GDLM_ATTR(withdraw, 0644, withdraw_show, withdraw_store); | 391 | GDLM_ATTR(withdraw, 0644, withdraw_show, withdraw_store); |
392 | GDLM_ATTR(id, 0444, lkid_show, NULL); | 392 | GDLM_ATTR(id, 0444, lkid_show, NULL); |
393 | GDLM_ATTR(jid, 0444, jid_show, NULL); | 393 | GDLM_ATTR(jid, 0444, jid_show, NULL); |
394 | GDLM_ATTR(first, 0444, lkfirst_show, NULL); | 394 | GDLM_ATTR(first, 0444, lkfirst_show, NULL); |
395 | GDLM_ATTR(first_done, 0444, first_done_show, NULL); | 395 | GDLM_ATTR(first_done, 0444, first_done_show, NULL); |
396 | GDLM_ATTR(recover, 0200, NULL, recover_store); | 396 | GDLM_ATTR(recover, 0600, NULL, recover_store); |
397 | GDLM_ATTR(recover_done, 0444, recover_done_show, NULL); | 397 | GDLM_ATTR(recover_done, 0444, recover_done_show, NULL); |
398 | GDLM_ATTR(recover_status, 0444, recover_status_show, NULL); | 398 | GDLM_ATTR(recover_status, 0444, recover_status_show, NULL); |
399 | 399 | ||
400 | static struct attribute *lock_module_attrs[] = { | 400 | static struct attribute *lock_module_attrs[] = { |
401 | &gdlm_attr_proto_name.attr, | 401 | &gdlm_attr_proto_name.attr, |
diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c index 489fc01a3204..e4e089a8f294 100644 --- a/fs/nfs/direct.c +++ b/fs/nfs/direct.c | |||
@@ -255,7 +255,7 @@ static void nfs_direct_read_release(void *calldata) | |||
255 | 255 | ||
256 | if (put_dreq(dreq)) | 256 | if (put_dreq(dreq)) |
257 | nfs_direct_complete(dreq); | 257 | nfs_direct_complete(dreq); |
258 | nfs_readdata_release(calldata); | 258 | nfs_readdata_free(data); |
259 | } | 259 | } |
260 | 260 | ||
261 | static const struct rpc_call_ops nfs_read_direct_ops = { | 261 | static const struct rpc_call_ops nfs_read_direct_ops = { |
@@ -314,14 +314,14 @@ static ssize_t nfs_direct_read_schedule_segment(struct nfs_direct_req *dreq, | |||
314 | data->npages, 1, 0, data->pagevec, NULL); | 314 | data->npages, 1, 0, data->pagevec, NULL); |
315 | up_read(¤t->mm->mmap_sem); | 315 | up_read(¤t->mm->mmap_sem); |
316 | if (result < 0) { | 316 | if (result < 0) { |
317 | nfs_readdata_release(data); | 317 | nfs_readdata_free(data); |
318 | break; | 318 | break; |
319 | } | 319 | } |
320 | if ((unsigned)result < data->npages) { | 320 | if ((unsigned)result < data->npages) { |
321 | bytes = result * PAGE_SIZE; | 321 | bytes = result * PAGE_SIZE; |
322 | if (bytes <= pgbase) { | 322 | if (bytes <= pgbase) { |
323 | nfs_direct_release_pages(data->pagevec, result); | 323 | nfs_direct_release_pages(data->pagevec, result); |
324 | nfs_readdata_release(data); | 324 | nfs_readdata_free(data); |
325 | break; | 325 | break; |
326 | } | 326 | } |
327 | bytes -= pgbase; | 327 | bytes -= pgbase; |
@@ -334,7 +334,7 @@ static ssize_t nfs_direct_read_schedule_segment(struct nfs_direct_req *dreq, | |||
334 | data->inode = inode; | 334 | data->inode = inode; |
335 | data->cred = msg.rpc_cred; | 335 | data->cred = msg.rpc_cred; |
336 | data->args.fh = NFS_FH(inode); | 336 | data->args.fh = NFS_FH(inode); |
337 | data->args.context = get_nfs_open_context(ctx); | 337 | data->args.context = ctx; |
338 | data->args.offset = pos; | 338 | data->args.offset = pos; |
339 | data->args.pgbase = pgbase; | 339 | data->args.pgbase = pgbase; |
340 | data->args.pages = data->pagevec; | 340 | data->args.pages = data->pagevec; |
@@ -441,7 +441,7 @@ static void nfs_direct_free_writedata(struct nfs_direct_req *dreq) | |||
441 | struct nfs_write_data *data = list_entry(dreq->rewrite_list.next, struct nfs_write_data, pages); | 441 | struct nfs_write_data *data = list_entry(dreq->rewrite_list.next, struct nfs_write_data, pages); |
442 | list_del(&data->pages); | 442 | list_del(&data->pages); |
443 | nfs_direct_release_pages(data->pagevec, data->npages); | 443 | nfs_direct_release_pages(data->pagevec, data->npages); |
444 | nfs_writedata_release(data); | 444 | nfs_writedata_free(data); |
445 | } | 445 | } |
446 | } | 446 | } |
447 | 447 | ||
@@ -534,7 +534,7 @@ static void nfs_direct_commit_release(void *calldata) | |||
534 | 534 | ||
535 | dprintk("NFS: %5u commit returned %d\n", data->task.tk_pid, status); | 535 | dprintk("NFS: %5u commit returned %d\n", data->task.tk_pid, status); |
536 | nfs_direct_write_complete(dreq, data->inode); | 536 | nfs_direct_write_complete(dreq, data->inode); |
537 | nfs_commitdata_release(calldata); | 537 | nfs_commit_free(data); |
538 | } | 538 | } |
539 | 539 | ||
540 | static const struct rpc_call_ops nfs_commit_direct_ops = { | 540 | static const struct rpc_call_ops nfs_commit_direct_ops = { |
@@ -570,7 +570,7 @@ static void nfs_direct_commit_schedule(struct nfs_direct_req *dreq) | |||
570 | data->args.fh = NFS_FH(data->inode); | 570 | data->args.fh = NFS_FH(data->inode); |
571 | data->args.offset = 0; | 571 | data->args.offset = 0; |
572 | data->args.count = 0; | 572 | data->args.count = 0; |
573 | data->args.context = get_nfs_open_context(dreq->ctx); | 573 | data->args.context = dreq->ctx; |
574 | data->res.count = 0; | 574 | data->res.count = 0; |
575 | data->res.fattr = &data->fattr; | 575 | data->res.fattr = &data->fattr; |
576 | data->res.verf = &data->verf; | 576 | data->res.verf = &data->verf; |
@@ -734,14 +734,14 @@ static ssize_t nfs_direct_write_schedule_segment(struct nfs_direct_req *dreq, | |||
734 | data->npages, 0, 0, data->pagevec, NULL); | 734 | data->npages, 0, 0, data->pagevec, NULL); |
735 | up_read(¤t->mm->mmap_sem); | 735 | up_read(¤t->mm->mmap_sem); |
736 | if (result < 0) { | 736 | if (result < 0) { |
737 | nfs_writedata_release(data); | 737 | nfs_writedata_free(data); |
738 | break; | 738 | break; |
739 | } | 739 | } |
740 | if ((unsigned)result < data->npages) { | 740 | if ((unsigned)result < data->npages) { |
741 | bytes = result * PAGE_SIZE; | 741 | bytes = result * PAGE_SIZE; |
742 | if (bytes <= pgbase) { | 742 | if (bytes <= pgbase) { |
743 | nfs_direct_release_pages(data->pagevec, result); | 743 | nfs_direct_release_pages(data->pagevec, result); |
744 | nfs_writedata_release(data); | 744 | nfs_writedata_free(data); |
745 | break; | 745 | break; |
746 | } | 746 | } |
747 | bytes -= pgbase; | 747 | bytes -= pgbase; |
@@ -756,7 +756,7 @@ static ssize_t nfs_direct_write_schedule_segment(struct nfs_direct_req *dreq, | |||
756 | data->inode = inode; | 756 | data->inode = inode; |
757 | data->cred = msg.rpc_cred; | 757 | data->cred = msg.rpc_cred; |
758 | data->args.fh = NFS_FH(inode); | 758 | data->args.fh = NFS_FH(inode); |
759 | data->args.context = get_nfs_open_context(ctx); | 759 | data->args.context = ctx; |
760 | data->args.offset = pos; | 760 | data->args.offset = pos; |
761 | data->args.pgbase = pgbase; | 761 | data->args.pgbase = pgbase; |
762 | data->args.pages = data->pagevec; | 762 | data->args.pages = data->pagevec; |
diff --git a/fs/nfs/read.c b/fs/nfs/read.c index 73ea5e8d66ce..12c9e66d3f1d 100644 --- a/fs/nfs/read.c +++ b/fs/nfs/read.c | |||
@@ -60,17 +60,15 @@ struct nfs_read_data *nfs_readdata_alloc(unsigned int pagecount) | |||
60 | return p; | 60 | return p; |
61 | } | 61 | } |
62 | 62 | ||
63 | static void nfs_readdata_free(struct nfs_read_data *p) | 63 | void nfs_readdata_free(struct nfs_read_data *p) |
64 | { | 64 | { |
65 | if (p && (p->pagevec != &p->page_array[0])) | 65 | if (p && (p->pagevec != &p->page_array[0])) |
66 | kfree(p->pagevec); | 66 | kfree(p->pagevec); |
67 | mempool_free(p, nfs_rdata_mempool); | 67 | mempool_free(p, nfs_rdata_mempool); |
68 | } | 68 | } |
69 | 69 | ||
70 | void nfs_readdata_release(void *data) | 70 | static void nfs_readdata_release(struct nfs_read_data *rdata) |
71 | { | 71 | { |
72 | struct nfs_read_data *rdata = data; | ||
73 | |||
74 | put_nfs_open_context(rdata->args.context); | 72 | put_nfs_open_context(rdata->args.context); |
75 | nfs_readdata_free(rdata); | 73 | nfs_readdata_free(rdata); |
76 | } | 74 | } |
diff --git a/fs/nfs/write.c b/fs/nfs/write.c index 0a0a2ff767c3..a34fae21fe10 100644 --- a/fs/nfs/write.c +++ b/fs/nfs/write.c | |||
@@ -87,17 +87,15 @@ struct nfs_write_data *nfs_writedata_alloc(unsigned int pagecount) | |||
87 | return p; | 87 | return p; |
88 | } | 88 | } |
89 | 89 | ||
90 | static void nfs_writedata_free(struct nfs_write_data *p) | 90 | void nfs_writedata_free(struct nfs_write_data *p) |
91 | { | 91 | { |
92 | if (p && (p->pagevec != &p->page_array[0])) | 92 | if (p && (p->pagevec != &p->page_array[0])) |
93 | kfree(p->pagevec); | 93 | kfree(p->pagevec); |
94 | mempool_free(p, nfs_wdata_mempool); | 94 | mempool_free(p, nfs_wdata_mempool); |
95 | } | 95 | } |
96 | 96 | ||
97 | void nfs_writedata_release(void *data) | 97 | static void nfs_writedata_release(struct nfs_write_data *wdata) |
98 | { | 98 | { |
99 | struct nfs_write_data *wdata = data; | ||
100 | |||
101 | put_nfs_open_context(wdata->args.context); | 99 | put_nfs_open_context(wdata->args.context); |
102 | nfs_writedata_free(wdata); | 100 | nfs_writedata_free(wdata); |
103 | } | 101 | } |
diff --git a/fs/ocfs2/alloc.c b/fs/ocfs2/alloc.c index 9edcde4974aa..f9a3e8942669 100644 --- a/fs/ocfs2/alloc.c +++ b/fs/ocfs2/alloc.c | |||
@@ -1914,7 +1914,8 @@ static void ocfs2_adjust_adjacent_records(struct ocfs2_extent_rec *left_rec, | |||
1914 | * immediately to their right. | 1914 | * immediately to their right. |
1915 | */ | 1915 | */ |
1916 | left_clusters = le32_to_cpu(right_child_el->l_recs[0].e_cpos); | 1916 | left_clusters = le32_to_cpu(right_child_el->l_recs[0].e_cpos); |
1917 | if (ocfs2_is_empty_extent(&right_child_el->l_recs[0])) { | 1917 | if (!ocfs2_rec_clusters(right_child_el, &right_child_el->l_recs[0])) { |
1918 | BUG_ON(right_child_el->l_tree_depth); | ||
1918 | BUG_ON(le16_to_cpu(right_child_el->l_next_free_rec) <= 1); | 1919 | BUG_ON(le16_to_cpu(right_child_el->l_next_free_rec) <= 1); |
1919 | left_clusters = le32_to_cpu(right_child_el->l_recs[1].e_cpos); | 1920 | left_clusters = le32_to_cpu(right_child_el->l_recs[1].e_cpos); |
1920 | } | 1921 | } |
@@ -2476,15 +2477,37 @@ out_ret_path: | |||
2476 | return ret; | 2477 | return ret; |
2477 | } | 2478 | } |
2478 | 2479 | ||
2479 | static void ocfs2_update_edge_lengths(struct inode *inode, handle_t *handle, | 2480 | static int ocfs2_update_edge_lengths(struct inode *inode, handle_t *handle, |
2480 | struct ocfs2_path *path) | 2481 | int subtree_index, struct ocfs2_path *path) |
2481 | { | 2482 | { |
2482 | int i, idx; | 2483 | int i, idx, ret; |
2483 | struct ocfs2_extent_rec *rec; | 2484 | struct ocfs2_extent_rec *rec; |
2484 | struct ocfs2_extent_list *el; | 2485 | struct ocfs2_extent_list *el; |
2485 | struct ocfs2_extent_block *eb; | 2486 | struct ocfs2_extent_block *eb; |
2486 | u32 range; | 2487 | u32 range; |
2487 | 2488 | ||
2489 | /* | ||
2490 | * In normal tree rotation process, we will never touch the | ||
2491 | * tree branch above subtree_index and ocfs2_extend_rotate_transaction | ||
2492 | * doesn't reserve the credits for them either. | ||
2493 | * | ||
2494 | * But we do have a special case here which will update the rightmost | ||
2495 | * records for all the bh in the path. | ||
2496 | * So we have to allocate extra credits and access them. | ||
2497 | */ | ||
2498 | ret = ocfs2_extend_trans(handle, | ||
2499 | handle->h_buffer_credits + subtree_index); | ||
2500 | if (ret) { | ||
2501 | mlog_errno(ret); | ||
2502 | goto out; | ||
2503 | } | ||
2504 | |||
2505 | ret = ocfs2_journal_access_path(inode, handle, path); | ||
2506 | if (ret) { | ||
2507 | mlog_errno(ret); | ||
2508 | goto out; | ||
2509 | } | ||
2510 | |||
2488 | /* Path should always be rightmost. */ | 2511 | /* Path should always be rightmost. */ |
2489 | eb = (struct ocfs2_extent_block *)path_leaf_bh(path)->b_data; | 2512 | eb = (struct ocfs2_extent_block *)path_leaf_bh(path)->b_data; |
2490 | BUG_ON(eb->h_next_leaf_blk != 0ULL); | 2513 | BUG_ON(eb->h_next_leaf_blk != 0ULL); |
@@ -2505,6 +2528,8 @@ static void ocfs2_update_edge_lengths(struct inode *inode, handle_t *handle, | |||
2505 | 2528 | ||
2506 | ocfs2_journal_dirty(handle, path->p_node[i].bh); | 2529 | ocfs2_journal_dirty(handle, path->p_node[i].bh); |
2507 | } | 2530 | } |
2531 | out: | ||
2532 | return ret; | ||
2508 | } | 2533 | } |
2509 | 2534 | ||
2510 | static void ocfs2_unlink_path(struct inode *inode, handle_t *handle, | 2535 | static void ocfs2_unlink_path(struct inode *inode, handle_t *handle, |
@@ -2717,7 +2742,12 @@ static int ocfs2_rotate_subtree_left(struct inode *inode, handle_t *handle, | |||
2717 | if (del_right_subtree) { | 2742 | if (del_right_subtree) { |
2718 | ocfs2_unlink_subtree(inode, handle, left_path, right_path, | 2743 | ocfs2_unlink_subtree(inode, handle, left_path, right_path, |
2719 | subtree_index, dealloc); | 2744 | subtree_index, dealloc); |
2720 | ocfs2_update_edge_lengths(inode, handle, left_path); | 2745 | ret = ocfs2_update_edge_lengths(inode, handle, subtree_index, |
2746 | left_path); | ||
2747 | if (ret) { | ||
2748 | mlog_errno(ret); | ||
2749 | goto out; | ||
2750 | } | ||
2721 | 2751 | ||
2722 | eb = (struct ocfs2_extent_block *)path_leaf_bh(left_path)->b_data; | 2752 | eb = (struct ocfs2_extent_block *)path_leaf_bh(left_path)->b_data; |
2723 | ocfs2_et_set_last_eb_blk(et, le64_to_cpu(eb->h_blkno)); | 2753 | ocfs2_et_set_last_eb_blk(et, le64_to_cpu(eb->h_blkno)); |
@@ -3034,7 +3064,12 @@ static int ocfs2_remove_rightmost_path(struct inode *inode, handle_t *handle, | |||
3034 | 3064 | ||
3035 | ocfs2_unlink_subtree(inode, handle, left_path, path, | 3065 | ocfs2_unlink_subtree(inode, handle, left_path, path, |
3036 | subtree_index, dealloc); | 3066 | subtree_index, dealloc); |
3037 | ocfs2_update_edge_lengths(inode, handle, left_path); | 3067 | ret = ocfs2_update_edge_lengths(inode, handle, subtree_index, |
3068 | left_path); | ||
3069 | if (ret) { | ||
3070 | mlog_errno(ret); | ||
3071 | goto out; | ||
3072 | } | ||
3038 | 3073 | ||
3039 | eb = (struct ocfs2_extent_block *)path_leaf_bh(left_path)->b_data; | 3074 | eb = (struct ocfs2_extent_block *)path_leaf_bh(left_path)->b_data; |
3040 | ocfs2_et_set_last_eb_blk(et, le64_to_cpu(eb->h_blkno)); | 3075 | ocfs2_et_set_last_eb_blk(et, le64_to_cpu(eb->h_blkno)); |
diff --git a/fs/ocfs2/aops.c b/fs/ocfs2/aops.c index b2c52b3a1484..b401654011a2 100644 --- a/fs/ocfs2/aops.c +++ b/fs/ocfs2/aops.c | |||
@@ -193,6 +193,7 @@ static int ocfs2_get_block(struct inode *inode, sector_t iblock, | |||
193 | (unsigned long long)OCFS2_I(inode)->ip_blkno); | 193 | (unsigned long long)OCFS2_I(inode)->ip_blkno); |
194 | mlog(ML_ERROR, "Size %llu, clusters %u\n", (unsigned long long)i_size_read(inode), OCFS2_I(inode)->ip_clusters); | 194 | mlog(ML_ERROR, "Size %llu, clusters %u\n", (unsigned long long)i_size_read(inode), OCFS2_I(inode)->ip_clusters); |
195 | dump_stack(); | 195 | dump_stack(); |
196 | goto bail; | ||
196 | } | 197 | } |
197 | 198 | ||
198 | past_eof = ocfs2_blocks_for_bytes(inode->i_sb, i_size_read(inode)); | 199 | past_eof = ocfs2_blocks_for_bytes(inode->i_sb, i_size_read(inode)); |
@@ -894,18 +895,17 @@ struct ocfs2_write_cluster_desc { | |||
894 | */ | 895 | */ |
895 | unsigned c_new; | 896 | unsigned c_new; |
896 | unsigned c_unwritten; | 897 | unsigned c_unwritten; |
898 | unsigned c_needs_zero; | ||
897 | }; | 899 | }; |
898 | 900 | ||
899 | static inline int ocfs2_should_zero_cluster(struct ocfs2_write_cluster_desc *d) | ||
900 | { | ||
901 | return d->c_new || d->c_unwritten; | ||
902 | } | ||
903 | |||
904 | struct ocfs2_write_ctxt { | 901 | struct ocfs2_write_ctxt { |
905 | /* Logical cluster position / len of write */ | 902 | /* Logical cluster position / len of write */ |
906 | u32 w_cpos; | 903 | u32 w_cpos; |
907 | u32 w_clen; | 904 | u32 w_clen; |
908 | 905 | ||
906 | /* First cluster allocated in a nonsparse extend */ | ||
907 | u32 w_first_new_cpos; | ||
908 | |||
909 | struct ocfs2_write_cluster_desc w_desc[OCFS2_MAX_CLUSTERS_PER_PAGE]; | 909 | struct ocfs2_write_cluster_desc w_desc[OCFS2_MAX_CLUSTERS_PER_PAGE]; |
910 | 910 | ||
911 | /* | 911 | /* |
@@ -983,6 +983,7 @@ static int ocfs2_alloc_write_ctxt(struct ocfs2_write_ctxt **wcp, | |||
983 | return -ENOMEM; | 983 | return -ENOMEM; |
984 | 984 | ||
985 | wc->w_cpos = pos >> osb->s_clustersize_bits; | 985 | wc->w_cpos = pos >> osb->s_clustersize_bits; |
986 | wc->w_first_new_cpos = UINT_MAX; | ||
986 | cend = (pos + len - 1) >> osb->s_clustersize_bits; | 987 | cend = (pos + len - 1) >> osb->s_clustersize_bits; |
987 | wc->w_clen = cend - wc->w_cpos + 1; | 988 | wc->w_clen = cend - wc->w_cpos + 1; |
988 | get_bh(di_bh); | 989 | get_bh(di_bh); |
@@ -1217,20 +1218,18 @@ out: | |||
1217 | */ | 1218 | */ |
1218 | static int ocfs2_write_cluster(struct address_space *mapping, | 1219 | static int ocfs2_write_cluster(struct address_space *mapping, |
1219 | u32 phys, unsigned int unwritten, | 1220 | u32 phys, unsigned int unwritten, |
1221 | unsigned int should_zero, | ||
1220 | struct ocfs2_alloc_context *data_ac, | 1222 | struct ocfs2_alloc_context *data_ac, |
1221 | struct ocfs2_alloc_context *meta_ac, | 1223 | struct ocfs2_alloc_context *meta_ac, |
1222 | struct ocfs2_write_ctxt *wc, u32 cpos, | 1224 | struct ocfs2_write_ctxt *wc, u32 cpos, |
1223 | loff_t user_pos, unsigned user_len) | 1225 | loff_t user_pos, unsigned user_len) |
1224 | { | 1226 | { |
1225 | int ret, i, new, should_zero = 0; | 1227 | int ret, i, new; |
1226 | u64 v_blkno, p_blkno; | 1228 | u64 v_blkno, p_blkno; |
1227 | struct inode *inode = mapping->host; | 1229 | struct inode *inode = mapping->host; |
1228 | struct ocfs2_extent_tree et; | 1230 | struct ocfs2_extent_tree et; |
1229 | 1231 | ||
1230 | new = phys == 0 ? 1 : 0; | 1232 | new = phys == 0 ? 1 : 0; |
1231 | if (new || unwritten) | ||
1232 | should_zero = 1; | ||
1233 | |||
1234 | if (new) { | 1233 | if (new) { |
1235 | u32 tmp_pos; | 1234 | u32 tmp_pos; |
1236 | 1235 | ||
@@ -1301,7 +1300,7 @@ static int ocfs2_write_cluster(struct address_space *mapping, | |||
1301 | if (tmpret) { | 1300 | if (tmpret) { |
1302 | mlog_errno(tmpret); | 1301 | mlog_errno(tmpret); |
1303 | if (ret == 0) | 1302 | if (ret == 0) |
1304 | tmpret = ret; | 1303 | ret = tmpret; |
1305 | } | 1304 | } |
1306 | } | 1305 | } |
1307 | 1306 | ||
@@ -1341,7 +1340,9 @@ static int ocfs2_write_cluster_by_desc(struct address_space *mapping, | |||
1341 | local_len = osb->s_clustersize - cluster_off; | 1340 | local_len = osb->s_clustersize - cluster_off; |
1342 | 1341 | ||
1343 | ret = ocfs2_write_cluster(mapping, desc->c_phys, | 1342 | ret = ocfs2_write_cluster(mapping, desc->c_phys, |
1344 | desc->c_unwritten, data_ac, meta_ac, | 1343 | desc->c_unwritten, |
1344 | desc->c_needs_zero, | ||
1345 | data_ac, meta_ac, | ||
1345 | wc, desc->c_cpos, pos, local_len); | 1346 | wc, desc->c_cpos, pos, local_len); |
1346 | if (ret) { | 1347 | if (ret) { |
1347 | mlog_errno(ret); | 1348 | mlog_errno(ret); |
@@ -1391,14 +1392,14 @@ static void ocfs2_set_target_boundaries(struct ocfs2_super *osb, | |||
1391 | * newly allocated cluster. | 1392 | * newly allocated cluster. |
1392 | */ | 1393 | */ |
1393 | desc = &wc->w_desc[0]; | 1394 | desc = &wc->w_desc[0]; |
1394 | if (ocfs2_should_zero_cluster(desc)) | 1395 | if (desc->c_needs_zero) |
1395 | ocfs2_figure_cluster_boundaries(osb, | 1396 | ocfs2_figure_cluster_boundaries(osb, |
1396 | desc->c_cpos, | 1397 | desc->c_cpos, |
1397 | &wc->w_target_from, | 1398 | &wc->w_target_from, |
1398 | NULL); | 1399 | NULL); |
1399 | 1400 | ||
1400 | desc = &wc->w_desc[wc->w_clen - 1]; | 1401 | desc = &wc->w_desc[wc->w_clen - 1]; |
1401 | if (ocfs2_should_zero_cluster(desc)) | 1402 | if (desc->c_needs_zero) |
1402 | ocfs2_figure_cluster_boundaries(osb, | 1403 | ocfs2_figure_cluster_boundaries(osb, |
1403 | desc->c_cpos, | 1404 | desc->c_cpos, |
1404 | NULL, | 1405 | NULL, |
@@ -1466,13 +1467,28 @@ static int ocfs2_populate_write_desc(struct inode *inode, | |||
1466 | phys++; | 1467 | phys++; |
1467 | } | 1468 | } |
1468 | 1469 | ||
1470 | /* | ||
1471 | * If w_first_new_cpos is < UINT_MAX, we have a non-sparse | ||
1472 | * file that got extended. w_first_new_cpos tells us | ||
1473 | * where the newly allocated clusters are so we can | ||
1474 | * zero them. | ||
1475 | */ | ||
1476 | if (desc->c_cpos >= wc->w_first_new_cpos) { | ||
1477 | BUG_ON(phys == 0); | ||
1478 | desc->c_needs_zero = 1; | ||
1479 | } | ||
1480 | |||
1469 | desc->c_phys = phys; | 1481 | desc->c_phys = phys; |
1470 | if (phys == 0) { | 1482 | if (phys == 0) { |
1471 | desc->c_new = 1; | 1483 | desc->c_new = 1; |
1484 | desc->c_needs_zero = 1; | ||
1472 | *clusters_to_alloc = *clusters_to_alloc + 1; | 1485 | *clusters_to_alloc = *clusters_to_alloc + 1; |
1473 | } | 1486 | } |
1474 | if (ext_flags & OCFS2_EXT_UNWRITTEN) | 1487 | |
1488 | if (ext_flags & OCFS2_EXT_UNWRITTEN) { | ||
1475 | desc->c_unwritten = 1; | 1489 | desc->c_unwritten = 1; |
1490 | desc->c_needs_zero = 1; | ||
1491 | } | ||
1476 | 1492 | ||
1477 | num_clusters--; | 1493 | num_clusters--; |
1478 | } | 1494 | } |
@@ -1632,10 +1648,13 @@ static int ocfs2_expand_nonsparse_inode(struct inode *inode, loff_t pos, | |||
1632 | if (newsize <= i_size_read(inode)) | 1648 | if (newsize <= i_size_read(inode)) |
1633 | return 0; | 1649 | return 0; |
1634 | 1650 | ||
1635 | ret = ocfs2_extend_no_holes(inode, newsize, newsize - len); | 1651 | ret = ocfs2_extend_no_holes(inode, newsize, pos); |
1636 | if (ret) | 1652 | if (ret) |
1637 | mlog_errno(ret); | 1653 | mlog_errno(ret); |
1638 | 1654 | ||
1655 | wc->w_first_new_cpos = | ||
1656 | ocfs2_clusters_for_bytes(inode->i_sb, i_size_read(inode)); | ||
1657 | |||
1639 | return ret; | 1658 | return ret; |
1640 | } | 1659 | } |
1641 | 1660 | ||
@@ -1644,7 +1663,7 @@ int ocfs2_write_begin_nolock(struct address_space *mapping, | |||
1644 | struct page **pagep, void **fsdata, | 1663 | struct page **pagep, void **fsdata, |
1645 | struct buffer_head *di_bh, struct page *mmap_page) | 1664 | struct buffer_head *di_bh, struct page *mmap_page) |
1646 | { | 1665 | { |
1647 | int ret, credits = OCFS2_INODE_UPDATE_CREDITS; | 1666 | int ret, cluster_of_pages, credits = OCFS2_INODE_UPDATE_CREDITS; |
1648 | unsigned int clusters_to_alloc, extents_to_split; | 1667 | unsigned int clusters_to_alloc, extents_to_split; |
1649 | struct ocfs2_write_ctxt *wc; | 1668 | struct ocfs2_write_ctxt *wc; |
1650 | struct inode *inode = mapping->host; | 1669 | struct inode *inode = mapping->host; |
@@ -1722,8 +1741,19 @@ int ocfs2_write_begin_nolock(struct address_space *mapping, | |||
1722 | 1741 | ||
1723 | } | 1742 | } |
1724 | 1743 | ||
1725 | ocfs2_set_target_boundaries(osb, wc, pos, len, | 1744 | /* |
1726 | clusters_to_alloc + extents_to_split); | 1745 | * We have to zero sparse allocated clusters, unwritten extent clusters, |
1746 | * and non-sparse clusters we just extended. For non-sparse writes, | ||
1747 | * we know zeros will only be needed in the first and/or last cluster. | ||
1748 | */ | ||
1749 | if (clusters_to_alloc || extents_to_split || | ||
1750 | wc->w_desc[0].c_needs_zero || | ||
1751 | wc->w_desc[wc->w_clen - 1].c_needs_zero) | ||
1752 | cluster_of_pages = 1; | ||
1753 | else | ||
1754 | cluster_of_pages = 0; | ||
1755 | |||
1756 | ocfs2_set_target_boundaries(osb, wc, pos, len, cluster_of_pages); | ||
1727 | 1757 | ||
1728 | handle = ocfs2_start_trans(osb, credits); | 1758 | handle = ocfs2_start_trans(osb, credits); |
1729 | if (IS_ERR(handle)) { | 1759 | if (IS_ERR(handle)) { |
@@ -1756,8 +1786,7 @@ int ocfs2_write_begin_nolock(struct address_space *mapping, | |||
1756 | * extent. | 1786 | * extent. |
1757 | */ | 1787 | */ |
1758 | ret = ocfs2_grab_pages_for_write(mapping, wc, wc->w_cpos, pos, | 1788 | ret = ocfs2_grab_pages_for_write(mapping, wc, wc->w_cpos, pos, |
1759 | clusters_to_alloc + extents_to_split, | 1789 | cluster_of_pages, mmap_page); |
1760 | mmap_page); | ||
1761 | if (ret) { | 1790 | if (ret) { |
1762 | mlog_errno(ret); | 1791 | mlog_errno(ret); |
1763 | goto out_quota; | 1792 | goto out_quota; |
diff --git a/fs/ocfs2/dcache.c b/fs/ocfs2/dcache.c index b574431a031d..2f28b7de2c8d 100644 --- a/fs/ocfs2/dcache.c +++ b/fs/ocfs2/dcache.c | |||
@@ -310,22 +310,19 @@ out_attach: | |||
310 | return ret; | 310 | return ret; |
311 | } | 311 | } |
312 | 312 | ||
313 | static DEFINE_SPINLOCK(dentry_list_lock); | 313 | DEFINE_SPINLOCK(dentry_list_lock); |
314 | 314 | ||
315 | /* We limit the number of dentry locks to drop in one go. We have | 315 | /* We limit the number of dentry locks to drop in one go. We have |
316 | * this limit so that we don't starve other users of ocfs2_wq. */ | 316 | * this limit so that we don't starve other users of ocfs2_wq. */ |
317 | #define DL_INODE_DROP_COUNT 64 | 317 | #define DL_INODE_DROP_COUNT 64 |
318 | 318 | ||
319 | /* Drop inode references from dentry locks */ | 319 | /* Drop inode references from dentry locks */ |
320 | void ocfs2_drop_dl_inodes(struct work_struct *work) | 320 | static void __ocfs2_drop_dl_inodes(struct ocfs2_super *osb, int drop_count) |
321 | { | 321 | { |
322 | struct ocfs2_super *osb = container_of(work, struct ocfs2_super, | ||
323 | dentry_lock_work); | ||
324 | struct ocfs2_dentry_lock *dl; | 322 | struct ocfs2_dentry_lock *dl; |
325 | int drop_count = DL_INODE_DROP_COUNT; | ||
326 | 323 | ||
327 | spin_lock(&dentry_list_lock); | 324 | spin_lock(&dentry_list_lock); |
328 | while (osb->dentry_lock_list && drop_count--) { | 325 | while (osb->dentry_lock_list && (drop_count < 0 || drop_count--)) { |
329 | dl = osb->dentry_lock_list; | 326 | dl = osb->dentry_lock_list; |
330 | osb->dentry_lock_list = dl->dl_next; | 327 | osb->dentry_lock_list = dl->dl_next; |
331 | spin_unlock(&dentry_list_lock); | 328 | spin_unlock(&dentry_list_lock); |
@@ -333,11 +330,32 @@ void ocfs2_drop_dl_inodes(struct work_struct *work) | |||
333 | kfree(dl); | 330 | kfree(dl); |
334 | spin_lock(&dentry_list_lock); | 331 | spin_lock(&dentry_list_lock); |
335 | } | 332 | } |
336 | if (osb->dentry_lock_list) | 333 | spin_unlock(&dentry_list_lock); |
334 | } | ||
335 | |||
336 | void ocfs2_drop_dl_inodes(struct work_struct *work) | ||
337 | { | ||
338 | struct ocfs2_super *osb = container_of(work, struct ocfs2_super, | ||
339 | dentry_lock_work); | ||
340 | |||
341 | __ocfs2_drop_dl_inodes(osb, DL_INODE_DROP_COUNT); | ||
342 | /* | ||
343 | * Don't queue dropping if umount is in progress. We flush the | ||
344 | * list in ocfs2_dismount_volume | ||
345 | */ | ||
346 | spin_lock(&dentry_list_lock); | ||
347 | if (osb->dentry_lock_list && | ||
348 | !ocfs2_test_osb_flag(osb, OCFS2_OSB_DROP_DENTRY_LOCK_IMMED)) | ||
337 | queue_work(ocfs2_wq, &osb->dentry_lock_work); | 349 | queue_work(ocfs2_wq, &osb->dentry_lock_work); |
338 | spin_unlock(&dentry_list_lock); | 350 | spin_unlock(&dentry_list_lock); |
339 | } | 351 | } |
340 | 352 | ||
353 | /* Flush the whole work queue */ | ||
354 | void ocfs2_drop_all_dl_inodes(struct ocfs2_super *osb) | ||
355 | { | ||
356 | __ocfs2_drop_dl_inodes(osb, -1); | ||
357 | } | ||
358 | |||
341 | /* | 359 | /* |
342 | * ocfs2_dentry_iput() and friends. | 360 | * ocfs2_dentry_iput() and friends. |
343 | * | 361 | * |
@@ -368,7 +386,8 @@ static void ocfs2_drop_dentry_lock(struct ocfs2_super *osb, | |||
368 | /* We leave dropping of inode reference to ocfs2_wq as that can | 386 | /* We leave dropping of inode reference to ocfs2_wq as that can |
369 | * possibly lead to inode deletion which gets tricky */ | 387 | * possibly lead to inode deletion which gets tricky */ |
370 | spin_lock(&dentry_list_lock); | 388 | spin_lock(&dentry_list_lock); |
371 | if (!osb->dentry_lock_list) | 389 | if (!osb->dentry_lock_list && |
390 | !ocfs2_test_osb_flag(osb, OCFS2_OSB_DROP_DENTRY_LOCK_IMMED)) | ||
372 | queue_work(ocfs2_wq, &osb->dentry_lock_work); | 391 | queue_work(ocfs2_wq, &osb->dentry_lock_work); |
373 | dl->dl_next = osb->dentry_lock_list; | 392 | dl->dl_next = osb->dentry_lock_list; |
374 | osb->dentry_lock_list = dl; | 393 | osb->dentry_lock_list = dl; |
diff --git a/fs/ocfs2/dcache.h b/fs/ocfs2/dcache.h index faa12e75f98d..f5dd1789acf1 100644 --- a/fs/ocfs2/dcache.h +++ b/fs/ocfs2/dcache.h | |||
@@ -49,10 +49,13 @@ struct ocfs2_dentry_lock { | |||
49 | int ocfs2_dentry_attach_lock(struct dentry *dentry, struct inode *inode, | 49 | int ocfs2_dentry_attach_lock(struct dentry *dentry, struct inode *inode, |
50 | u64 parent_blkno); | 50 | u64 parent_blkno); |
51 | 51 | ||
52 | extern spinlock_t dentry_list_lock; | ||
53 | |||
52 | void ocfs2_dentry_lock_put(struct ocfs2_super *osb, | 54 | void ocfs2_dentry_lock_put(struct ocfs2_super *osb, |
53 | struct ocfs2_dentry_lock *dl); | 55 | struct ocfs2_dentry_lock *dl); |
54 | 56 | ||
55 | void ocfs2_drop_dl_inodes(struct work_struct *work); | 57 | void ocfs2_drop_dl_inodes(struct work_struct *work); |
58 | void ocfs2_drop_all_dl_inodes(struct ocfs2_super *osb); | ||
56 | 59 | ||
57 | struct dentry *ocfs2_find_local_alias(struct inode *inode, u64 parent_blkno, | 60 | struct dentry *ocfs2_find_local_alias(struct inode *inode, u64 parent_blkno, |
58 | int skip_unhashed); | 61 | int skip_unhashed); |
diff --git a/fs/ocfs2/dlm/dlmast.c b/fs/ocfs2/dlm/dlmast.c index d07ddbe4b283..81eff8e58322 100644 --- a/fs/ocfs2/dlm/dlmast.c +++ b/fs/ocfs2/dlm/dlmast.c | |||
@@ -103,7 +103,6 @@ static void __dlm_queue_ast(struct dlm_ctxt *dlm, struct dlm_lock *lock) | |||
103 | lock->ast_pending, lock->ml.type); | 103 | lock->ast_pending, lock->ml.type); |
104 | BUG(); | 104 | BUG(); |
105 | } | 105 | } |
106 | BUG_ON(!list_empty(&lock->ast_list)); | ||
107 | if (lock->ast_pending) | 106 | if (lock->ast_pending) |
108 | mlog(0, "lock has an ast getting flushed right now\n"); | 107 | mlog(0, "lock has an ast getting flushed right now\n"); |
109 | 108 | ||
diff --git a/fs/ocfs2/dlm/dlmrecovery.c b/fs/ocfs2/dlm/dlmrecovery.c index bcb9260c3735..43e6e3280569 100644 --- a/fs/ocfs2/dlm/dlmrecovery.c +++ b/fs/ocfs2/dlm/dlmrecovery.c | |||
@@ -1118,7 +1118,7 @@ static int dlm_send_mig_lockres_msg(struct dlm_ctxt *dlm, | |||
1118 | 1118 | ||
1119 | mlog(0, "%s:%.*s: sending mig lockres (%s) to %u\n", | 1119 | mlog(0, "%s:%.*s: sending mig lockres (%s) to %u\n", |
1120 | dlm->name, res->lockname.len, res->lockname.name, | 1120 | dlm->name, res->lockname.len, res->lockname.name, |
1121 | orig_flags & DLM_MRES_MIGRATION ? "migrate" : "recovery", | 1121 | orig_flags & DLM_MRES_MIGRATION ? "migration" : "recovery", |
1122 | send_to); | 1122 | send_to); |
1123 | 1123 | ||
1124 | /* send it */ | 1124 | /* send it */ |
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c index 62442e413a00..aa501d3f93f1 100644 --- a/fs/ocfs2/file.c +++ b/fs/ocfs2/file.c | |||
@@ -1851,6 +1851,7 @@ relock: | |||
1851 | if (ret) | 1851 | if (ret) |
1852 | goto out_dio; | 1852 | goto out_dio; |
1853 | 1853 | ||
1854 | count = ocount; | ||
1854 | ret = generic_write_checks(file, ppos, &count, | 1855 | ret = generic_write_checks(file, ppos, &count, |
1855 | S_ISBLK(inode->i_mode)); | 1856 | S_ISBLK(inode->i_mode)); |
1856 | if (ret) | 1857 | if (ret) |
@@ -1918,8 +1919,10 @@ out_sems: | |||
1918 | 1919 | ||
1919 | mutex_unlock(&inode->i_mutex); | 1920 | mutex_unlock(&inode->i_mutex); |
1920 | 1921 | ||
1922 | if (written) | ||
1923 | ret = written; | ||
1921 | mlog_exit(ret); | 1924 | mlog_exit(ret); |
1922 | return written ? written : ret; | 1925 | return ret; |
1923 | } | 1926 | } |
1924 | 1927 | ||
1925 | static int ocfs2_splice_to_file(struct pipe_inode_info *pipe, | 1928 | static int ocfs2_splice_to_file(struct pipe_inode_info *pipe, |
diff --git a/fs/ocfs2/journal.c b/fs/ocfs2/journal.c index f033760ecbea..c48b93ac6b65 100644 --- a/fs/ocfs2/journal.c +++ b/fs/ocfs2/journal.c | |||
@@ -1954,10 +1954,16 @@ void ocfs2_orphan_scan_init(struct ocfs2_super *osb) | |||
1954 | os->os_osb = osb; | 1954 | os->os_osb = osb; |
1955 | os->os_count = 0; | 1955 | os->os_count = 0; |
1956 | os->os_seqno = 0; | 1956 | os->os_seqno = 0; |
1957 | os->os_scantime = CURRENT_TIME; | ||
1958 | mutex_init(&os->os_lock); | 1957 | mutex_init(&os->os_lock); |
1959 | INIT_DELAYED_WORK(&os->os_orphan_scan_work, ocfs2_orphan_scan_work); | 1958 | INIT_DELAYED_WORK(&os->os_orphan_scan_work, ocfs2_orphan_scan_work); |
1959 | } | ||
1960 | 1960 | ||
1961 | void ocfs2_orphan_scan_start(struct ocfs2_super *osb) | ||
1962 | { | ||
1963 | struct ocfs2_orphan_scan *os; | ||
1964 | |||
1965 | os = &osb->osb_orphan_scan; | ||
1966 | os->os_scantime = CURRENT_TIME; | ||
1961 | if (ocfs2_is_hard_readonly(osb) || ocfs2_mount_local(osb)) | 1967 | if (ocfs2_is_hard_readonly(osb) || ocfs2_mount_local(osb)) |
1962 | atomic_set(&os->os_state, ORPHAN_SCAN_INACTIVE); | 1968 | atomic_set(&os->os_state, ORPHAN_SCAN_INACTIVE); |
1963 | else { | 1969 | else { |
diff --git a/fs/ocfs2/journal.h b/fs/ocfs2/journal.h index 5432c7f79cc6..2c3222aec622 100644 --- a/fs/ocfs2/journal.h +++ b/fs/ocfs2/journal.h | |||
@@ -145,6 +145,7 @@ static inline void ocfs2_inode_set_new(struct ocfs2_super *osb, | |||
145 | 145 | ||
146 | /* Exported only for the journal struct init code in super.c. Do not call. */ | 146 | /* Exported only for the journal struct init code in super.c. Do not call. */ |
147 | void ocfs2_orphan_scan_init(struct ocfs2_super *osb); | 147 | void ocfs2_orphan_scan_init(struct ocfs2_super *osb); |
148 | void ocfs2_orphan_scan_start(struct ocfs2_super *osb); | ||
148 | void ocfs2_orphan_scan_stop(struct ocfs2_super *osb); | 149 | void ocfs2_orphan_scan_stop(struct ocfs2_super *osb); |
149 | void ocfs2_orphan_scan_exit(struct ocfs2_super *osb); | 150 | void ocfs2_orphan_scan_exit(struct ocfs2_super *osb); |
150 | 151 | ||
@@ -329,20 +330,27 @@ int ocfs2_journal_dirty(handle_t *handle, | |||
329 | /* extended attribute block update */ | 330 | /* extended attribute block update */ |
330 | #define OCFS2_XATTR_BLOCK_UPDATE_CREDITS 1 | 331 | #define OCFS2_XATTR_BLOCK_UPDATE_CREDITS 1 |
331 | 332 | ||
333 | /* Update of a single quota block */ | ||
334 | #define OCFS2_QUOTA_BLOCK_UPDATE_CREDITS 1 | ||
335 | |||
332 | /* global quotafile inode update, data block */ | 336 | /* global quotafile inode update, data block */ |
333 | #define OCFS2_QINFO_WRITE_CREDITS (OCFS2_INODE_UPDATE_CREDITS + 1) | 337 | #define OCFS2_QINFO_WRITE_CREDITS (OCFS2_INODE_UPDATE_CREDITS + \ |
338 | OCFS2_QUOTA_BLOCK_UPDATE_CREDITS) | ||
334 | 339 | ||
340 | #define OCFS2_LOCAL_QINFO_WRITE_CREDITS OCFS2_QUOTA_BLOCK_UPDATE_CREDITS | ||
335 | /* | 341 | /* |
336 | * The two writes below can accidentally see global info dirty due | 342 | * The two writes below can accidentally see global info dirty due |
337 | * to set_info() quotactl so make them prepared for the writes. | 343 | * to set_info() quotactl so make them prepared for the writes. |
338 | */ | 344 | */ |
339 | /* quota data block, global info */ | 345 | /* quota data block, global info */ |
340 | /* Write to local quota file */ | 346 | /* Write to local quota file */ |
341 | #define OCFS2_QWRITE_CREDITS (OCFS2_QINFO_WRITE_CREDITS + 1) | 347 | #define OCFS2_QWRITE_CREDITS (OCFS2_QINFO_WRITE_CREDITS + \ |
348 | OCFS2_QUOTA_BLOCK_UPDATE_CREDITS) | ||
342 | 349 | ||
343 | /* global quota data block, local quota data block, global quota inode, | 350 | /* global quota data block, local quota data block, global quota inode, |
344 | * global quota info */ | 351 | * global quota info */ |
345 | #define OCFS2_QSYNC_CREDITS (OCFS2_INODE_UPDATE_CREDITS + 3) | 352 | #define OCFS2_QSYNC_CREDITS (OCFS2_QINFO_WRITE_CREDITS + \ |
353 | 2 * OCFS2_QUOTA_BLOCK_UPDATE_CREDITS) | ||
346 | 354 | ||
347 | static inline int ocfs2_quota_trans_credits(struct super_block *sb) | 355 | static inline int ocfs2_quota_trans_credits(struct super_block *sb) |
348 | { | 356 | { |
@@ -355,11 +363,6 @@ static inline int ocfs2_quota_trans_credits(struct super_block *sb) | |||
355 | return credits; | 363 | return credits; |
356 | } | 364 | } |
357 | 365 | ||
358 | /* Number of credits needed for removing quota structure from file */ | ||
359 | int ocfs2_calc_qdel_credits(struct super_block *sb, int type); | ||
360 | /* Number of credits needed for initialization of new quota structure */ | ||
361 | int ocfs2_calc_qinit_credits(struct super_block *sb, int type); | ||
362 | |||
363 | /* group extend. inode update and last group update. */ | 366 | /* group extend. inode update and last group update. */ |
364 | #define OCFS2_GROUP_EXTEND_CREDITS (OCFS2_INODE_UPDATE_CREDITS + 1) | 367 | #define OCFS2_GROUP_EXTEND_CREDITS (OCFS2_INODE_UPDATE_CREDITS + 1) |
365 | 368 | ||
diff --git a/fs/ocfs2/ocfs2.h b/fs/ocfs2/ocfs2.h index c9345ebb8493..39e1d5a39505 100644 --- a/fs/ocfs2/ocfs2.h +++ b/fs/ocfs2/ocfs2.h | |||
@@ -224,10 +224,12 @@ enum ocfs2_mount_options | |||
224 | OCFS2_MOUNT_GRPQUOTA = 1 << 10, /* We support group quotas */ | 224 | OCFS2_MOUNT_GRPQUOTA = 1 << 10, /* We support group quotas */ |
225 | }; | 225 | }; |
226 | 226 | ||
227 | #define OCFS2_OSB_SOFT_RO 0x0001 | 227 | #define OCFS2_OSB_SOFT_RO 0x0001 |
228 | #define OCFS2_OSB_HARD_RO 0x0002 | 228 | #define OCFS2_OSB_HARD_RO 0x0002 |
229 | #define OCFS2_OSB_ERROR_FS 0x0004 | 229 | #define OCFS2_OSB_ERROR_FS 0x0004 |
230 | #define OCFS2_DEFAULT_ATIME_QUANTUM 60 | 230 | #define OCFS2_OSB_DROP_DENTRY_LOCK_IMMED 0x0008 |
231 | |||
232 | #define OCFS2_DEFAULT_ATIME_QUANTUM 60 | ||
231 | 233 | ||
232 | struct ocfs2_journal; | 234 | struct ocfs2_journal; |
233 | struct ocfs2_slot_info; | 235 | struct ocfs2_slot_info; |
@@ -490,6 +492,18 @@ static inline void ocfs2_set_osb_flag(struct ocfs2_super *osb, | |||
490 | spin_unlock(&osb->osb_lock); | 492 | spin_unlock(&osb->osb_lock); |
491 | } | 493 | } |
492 | 494 | ||
495 | |||
496 | static inline unsigned long ocfs2_test_osb_flag(struct ocfs2_super *osb, | ||
497 | unsigned long flag) | ||
498 | { | ||
499 | unsigned long ret; | ||
500 | |||
501 | spin_lock(&osb->osb_lock); | ||
502 | ret = osb->osb_flags & flag; | ||
503 | spin_unlock(&osb->osb_lock); | ||
504 | return ret; | ||
505 | } | ||
506 | |||
493 | static inline void ocfs2_set_ro_flag(struct ocfs2_super *osb, | 507 | static inline void ocfs2_set_ro_flag(struct ocfs2_super *osb, |
494 | int hard) | 508 | int hard) |
495 | { | 509 | { |
diff --git a/fs/ocfs2/quota.h b/fs/ocfs2/quota.h index 7365e2e08706..3fb96fcd4c81 100644 --- a/fs/ocfs2/quota.h +++ b/fs/ocfs2/quota.h | |||
@@ -50,7 +50,6 @@ struct ocfs2_mem_dqinfo { | |||
50 | unsigned int dqi_chunks; /* Number of chunks in local quota file */ | 50 | unsigned int dqi_chunks; /* Number of chunks in local quota file */ |
51 | unsigned int dqi_blocks; /* Number of blocks allocated for local quota file */ | 51 | unsigned int dqi_blocks; /* Number of blocks allocated for local quota file */ |
52 | unsigned int dqi_syncms; /* How often should we sync with other nodes */ | 52 | unsigned int dqi_syncms; /* How often should we sync with other nodes */ |
53 | unsigned int dqi_syncjiff; /* Precomputed dqi_syncms in jiffies */ | ||
54 | struct list_head dqi_chunk; /* List of chunks */ | 53 | struct list_head dqi_chunk; /* List of chunks */ |
55 | struct inode *dqi_gqinode; /* Global quota file inode */ | 54 | struct inode *dqi_gqinode; /* Global quota file inode */ |
56 | struct ocfs2_lock_res dqi_gqlock; /* Lock protecting quota information structure */ | 55 | struct ocfs2_lock_res dqi_gqlock; /* Lock protecting quota information structure */ |
diff --git a/fs/ocfs2/quota_global.c b/fs/ocfs2/quota_global.c index edfa60cd155c..bf7742d0ee3b 100644 --- a/fs/ocfs2/quota_global.c +++ b/fs/ocfs2/quota_global.c | |||
@@ -69,6 +69,7 @@ static void ocfs2_global_mem2diskdqb(void *dp, struct dquot *dquot) | |||
69 | d->dqb_curspace = cpu_to_le64(m->dqb_curspace); | 69 | d->dqb_curspace = cpu_to_le64(m->dqb_curspace); |
70 | d->dqb_btime = cpu_to_le64(m->dqb_btime); | 70 | d->dqb_btime = cpu_to_le64(m->dqb_btime); |
71 | d->dqb_itime = cpu_to_le64(m->dqb_itime); | 71 | d->dqb_itime = cpu_to_le64(m->dqb_itime); |
72 | d->dqb_pad1 = d->dqb_pad2 = 0; | ||
72 | } | 73 | } |
73 | 74 | ||
74 | static int ocfs2_global_is_id(void *dp, struct dquot *dquot) | 75 | static int ocfs2_global_is_id(void *dp, struct dquot *dquot) |
@@ -211,14 +212,13 @@ ssize_t ocfs2_quota_write(struct super_block *sb, int type, | |||
211 | 212 | ||
212 | mutex_lock_nested(&gqinode->i_mutex, I_MUTEX_QUOTA); | 213 | mutex_lock_nested(&gqinode->i_mutex, I_MUTEX_QUOTA); |
213 | if (gqinode->i_size < off + len) { | 214 | if (gqinode->i_size < off + len) { |
214 | down_write(&OCFS2_I(gqinode)->ip_alloc_sem); | 215 | loff_t rounded_end = |
215 | err = ocfs2_extend_no_holes(gqinode, off + len, off); | 216 | ocfs2_align_bytes_to_blocks(sb, off + len); |
216 | up_write(&OCFS2_I(gqinode)->ip_alloc_sem); | 217 | |
217 | if (err < 0) | 218 | /* Space is already allocated in ocfs2_global_read_dquot() */ |
218 | goto out; | ||
219 | err = ocfs2_simple_size_update(gqinode, | 219 | err = ocfs2_simple_size_update(gqinode, |
220 | oinfo->dqi_gqi_bh, | 220 | oinfo->dqi_gqi_bh, |
221 | off + len); | 221 | rounded_end); |
222 | if (err < 0) | 222 | if (err < 0) |
223 | goto out; | 223 | goto out; |
224 | new = 1; | 224 | new = 1; |
@@ -234,7 +234,7 @@ ssize_t ocfs2_quota_write(struct super_block *sb, int type, | |||
234 | } | 234 | } |
235 | if (err) { | 235 | if (err) { |
236 | mlog_errno(err); | 236 | mlog_errno(err); |
237 | return err; | 237 | goto out; |
238 | } | 238 | } |
239 | lock_buffer(bh); | 239 | lock_buffer(bh); |
240 | if (new) | 240 | if (new) |
@@ -342,7 +342,6 @@ int ocfs2_global_read_info(struct super_block *sb, int type) | |||
342 | info->dqi_bgrace = le32_to_cpu(dinfo.dqi_bgrace); | 342 | info->dqi_bgrace = le32_to_cpu(dinfo.dqi_bgrace); |
343 | info->dqi_igrace = le32_to_cpu(dinfo.dqi_igrace); | 343 | info->dqi_igrace = le32_to_cpu(dinfo.dqi_igrace); |
344 | oinfo->dqi_syncms = le32_to_cpu(dinfo.dqi_syncms); | 344 | oinfo->dqi_syncms = le32_to_cpu(dinfo.dqi_syncms); |
345 | oinfo->dqi_syncjiff = msecs_to_jiffies(oinfo->dqi_syncms); | ||
346 | oinfo->dqi_gi.dqi_blocks = le32_to_cpu(dinfo.dqi_blocks); | 345 | oinfo->dqi_gi.dqi_blocks = le32_to_cpu(dinfo.dqi_blocks); |
347 | oinfo->dqi_gi.dqi_free_blk = le32_to_cpu(dinfo.dqi_free_blk); | 346 | oinfo->dqi_gi.dqi_free_blk = le32_to_cpu(dinfo.dqi_free_blk); |
348 | oinfo->dqi_gi.dqi_free_entry = le32_to_cpu(dinfo.dqi_free_entry); | 347 | oinfo->dqi_gi.dqi_free_entry = le32_to_cpu(dinfo.dqi_free_entry); |
@@ -352,7 +351,7 @@ int ocfs2_global_read_info(struct super_block *sb, int type) | |||
352 | oinfo->dqi_gi.dqi_qtree_depth = qtree_depth(&oinfo->dqi_gi); | 351 | oinfo->dqi_gi.dqi_qtree_depth = qtree_depth(&oinfo->dqi_gi); |
353 | INIT_DELAYED_WORK(&oinfo->dqi_sync_work, qsync_work_fn); | 352 | INIT_DELAYED_WORK(&oinfo->dqi_sync_work, qsync_work_fn); |
354 | queue_delayed_work(ocfs2_quota_wq, &oinfo->dqi_sync_work, | 353 | queue_delayed_work(ocfs2_quota_wq, &oinfo->dqi_sync_work, |
355 | oinfo->dqi_syncjiff); | 354 | msecs_to_jiffies(oinfo->dqi_syncms)); |
356 | 355 | ||
357 | out_err: | 356 | out_err: |
358 | mlog_exit(status); | 357 | mlog_exit(status); |
@@ -402,13 +401,36 @@ int ocfs2_global_write_info(struct super_block *sb, int type) | |||
402 | return err; | 401 | return err; |
403 | } | 402 | } |
404 | 403 | ||
404 | static int ocfs2_global_qinit_alloc(struct super_block *sb, int type) | ||
405 | { | ||
406 | struct ocfs2_mem_dqinfo *oinfo = sb_dqinfo(sb, type)->dqi_priv; | ||
407 | |||
408 | /* | ||
409 | * We may need to allocate tree blocks and a leaf block but not the | ||
410 | * root block | ||
411 | */ | ||
412 | return oinfo->dqi_gi.dqi_qtree_depth; | ||
413 | } | ||
414 | |||
415 | static int ocfs2_calc_global_qinit_credits(struct super_block *sb, int type) | ||
416 | { | ||
417 | /* We modify all the allocated blocks, tree root, and info block */ | ||
418 | return (ocfs2_global_qinit_alloc(sb, type) + 2) * | ||
419 | OCFS2_QUOTA_BLOCK_UPDATE_CREDITS; | ||
420 | } | ||
421 | |||
405 | /* Read in information from global quota file and acquire a reference to it. | 422 | /* Read in information from global quota file and acquire a reference to it. |
406 | * dquot_acquire() has already started the transaction and locked quota file */ | 423 | * dquot_acquire() has already started the transaction and locked quota file */ |
407 | int ocfs2_global_read_dquot(struct dquot *dquot) | 424 | int ocfs2_global_read_dquot(struct dquot *dquot) |
408 | { | 425 | { |
409 | int err, err2, ex = 0; | 426 | int err, err2, ex = 0; |
410 | struct ocfs2_mem_dqinfo *info = | 427 | struct super_block *sb = dquot->dq_sb; |
411 | sb_dqinfo(dquot->dq_sb, dquot->dq_type)->dqi_priv; | 428 | int type = dquot->dq_type; |
429 | struct ocfs2_mem_dqinfo *info = sb_dqinfo(sb, type)->dqi_priv; | ||
430 | struct ocfs2_super *osb = OCFS2_SB(sb); | ||
431 | struct inode *gqinode = info->dqi_gqinode; | ||
432 | int need_alloc = ocfs2_global_qinit_alloc(sb, type); | ||
433 | handle_t *handle = NULL; | ||
412 | 434 | ||
413 | err = ocfs2_qinfo_lock(info, 0); | 435 | err = ocfs2_qinfo_lock(info, 0); |
414 | if (err < 0) | 436 | if (err < 0) |
@@ -419,14 +441,33 @@ int ocfs2_global_read_dquot(struct dquot *dquot) | |||
419 | OCFS2_DQUOT(dquot)->dq_use_count++; | 441 | OCFS2_DQUOT(dquot)->dq_use_count++; |
420 | OCFS2_DQUOT(dquot)->dq_origspace = dquot->dq_dqb.dqb_curspace; | 442 | OCFS2_DQUOT(dquot)->dq_origspace = dquot->dq_dqb.dqb_curspace; |
421 | OCFS2_DQUOT(dquot)->dq_originodes = dquot->dq_dqb.dqb_curinodes; | 443 | OCFS2_DQUOT(dquot)->dq_originodes = dquot->dq_dqb.dqb_curinodes; |
444 | ocfs2_qinfo_unlock(info, 0); | ||
445 | |||
422 | if (!dquot->dq_off) { /* No real quota entry? */ | 446 | if (!dquot->dq_off) { /* No real quota entry? */ |
423 | /* Upgrade to exclusive lock for allocation */ | ||
424 | ocfs2_qinfo_unlock(info, 0); | ||
425 | err = ocfs2_qinfo_lock(info, 1); | ||
426 | if (err < 0) | ||
427 | goto out_qlock; | ||
428 | ex = 1; | 447 | ex = 1; |
448 | /* | ||
449 | * Add blocks to quota file before we start a transaction since | ||
450 | * locking allocators ranks above a transaction start | ||
451 | */ | ||
452 | WARN_ON(journal_current_handle()); | ||
453 | down_write(&OCFS2_I(gqinode)->ip_alloc_sem); | ||
454 | err = ocfs2_extend_no_holes(gqinode, | ||
455 | gqinode->i_size + (need_alloc << sb->s_blocksize_bits), | ||
456 | gqinode->i_size); | ||
457 | up_write(&OCFS2_I(gqinode)->ip_alloc_sem); | ||
458 | if (err < 0) | ||
459 | goto out; | ||
429 | } | 460 | } |
461 | |||
462 | handle = ocfs2_start_trans(osb, | ||
463 | ocfs2_calc_global_qinit_credits(sb, type)); | ||
464 | if (IS_ERR(handle)) { | ||
465 | err = PTR_ERR(handle); | ||
466 | goto out; | ||
467 | } | ||
468 | err = ocfs2_qinfo_lock(info, ex); | ||
469 | if (err < 0) | ||
470 | goto out_trans; | ||
430 | err = qtree_write_dquot(&info->dqi_gi, dquot); | 471 | err = qtree_write_dquot(&info->dqi_gi, dquot); |
431 | if (ex && info_dirty(sb_dqinfo(dquot->dq_sb, dquot->dq_type))) { | 472 | if (ex && info_dirty(sb_dqinfo(dquot->dq_sb, dquot->dq_type))) { |
432 | err2 = __ocfs2_global_write_info(dquot->dq_sb, dquot->dq_type); | 473 | err2 = __ocfs2_global_write_info(dquot->dq_sb, dquot->dq_type); |
@@ -438,6 +479,9 @@ out_qlock: | |||
438 | ocfs2_qinfo_unlock(info, 1); | 479 | ocfs2_qinfo_unlock(info, 1); |
439 | else | 480 | else |
440 | ocfs2_qinfo_unlock(info, 0); | 481 | ocfs2_qinfo_unlock(info, 0); |
482 | out_trans: | ||
483 | if (handle) | ||
484 | ocfs2_commit_trans(osb, handle); | ||
441 | out: | 485 | out: |
442 | if (err < 0) | 486 | if (err < 0) |
443 | mlog_errno(err); | 487 | mlog_errno(err); |
@@ -607,7 +651,7 @@ static void qsync_work_fn(struct work_struct *work) | |||
607 | 651 | ||
608 | dquot_scan_active(sb, ocfs2_sync_dquot_helper, oinfo->dqi_type); | 652 | dquot_scan_active(sb, ocfs2_sync_dquot_helper, oinfo->dqi_type); |
609 | queue_delayed_work(ocfs2_quota_wq, &oinfo->dqi_sync_work, | 653 | queue_delayed_work(ocfs2_quota_wq, &oinfo->dqi_sync_work, |
610 | oinfo->dqi_syncjiff); | 654 | msecs_to_jiffies(oinfo->dqi_syncms)); |
611 | } | 655 | } |
612 | 656 | ||
613 | /* | 657 | /* |
@@ -635,20 +679,18 @@ out: | |||
635 | return status; | 679 | return status; |
636 | } | 680 | } |
637 | 681 | ||
638 | int ocfs2_calc_qdel_credits(struct super_block *sb, int type) | 682 | static int ocfs2_calc_qdel_credits(struct super_block *sb, int type) |
639 | { | 683 | { |
640 | struct ocfs2_mem_dqinfo *oinfo; | 684 | struct ocfs2_mem_dqinfo *oinfo = sb_dqinfo(sb, type)->dqi_priv; |
641 | int features[MAXQUOTAS] = { OCFS2_FEATURE_RO_COMPAT_USRQUOTA, | 685 | /* |
642 | OCFS2_FEATURE_RO_COMPAT_GRPQUOTA }; | 686 | * We modify tree, leaf block, global info, local chunk header, |
643 | 687 | * global and local inode; OCFS2_QINFO_WRITE_CREDITS already | |
644 | if (!OCFS2_HAS_RO_COMPAT_FEATURE(sb, features[type])) | 688 | * accounts for inode update |
645 | return 0; | 689 | */ |
646 | 690 | return (oinfo->dqi_gi.dqi_qtree_depth + 2) * | |
647 | oinfo = sb_dqinfo(sb, type)->dqi_priv; | 691 | OCFS2_QUOTA_BLOCK_UPDATE_CREDITS + |
648 | /* We modify tree, leaf block, global info, local chunk header, | 692 | OCFS2_QINFO_WRITE_CREDITS + |
649 | * global and local inode */ | 693 | OCFS2_INODE_UPDATE_CREDITS; |
650 | return oinfo->dqi_gi.dqi_qtree_depth + 2 + 1 + | ||
651 | 2 * OCFS2_INODE_UPDATE_CREDITS; | ||
652 | } | 694 | } |
653 | 695 | ||
654 | static int ocfs2_release_dquot(struct dquot *dquot) | 696 | static int ocfs2_release_dquot(struct dquot *dquot) |
@@ -680,33 +722,10 @@ out: | |||
680 | return status; | 722 | return status; |
681 | } | 723 | } |
682 | 724 | ||
683 | int ocfs2_calc_qinit_credits(struct super_block *sb, int type) | ||
684 | { | ||
685 | struct ocfs2_mem_dqinfo *oinfo; | ||
686 | int features[MAXQUOTAS] = { OCFS2_FEATURE_RO_COMPAT_USRQUOTA, | ||
687 | OCFS2_FEATURE_RO_COMPAT_GRPQUOTA }; | ||
688 | struct ocfs2_dinode *lfe, *gfe; | ||
689 | |||
690 | if (!OCFS2_HAS_RO_COMPAT_FEATURE(sb, features[type])) | ||
691 | return 0; | ||
692 | |||
693 | oinfo = sb_dqinfo(sb, type)->dqi_priv; | ||
694 | gfe = (struct ocfs2_dinode *)oinfo->dqi_gqi_bh->b_data; | ||
695 | lfe = (struct ocfs2_dinode *)oinfo->dqi_lqi_bh->b_data; | ||
696 | /* We can extend local file + global file. In local file we | ||
697 | * can modify info, chunk header block and dquot block. In | ||
698 | * global file we can modify info, tree and leaf block */ | ||
699 | return ocfs2_calc_extend_credits(sb, &lfe->id2.i_list, 0) + | ||
700 | ocfs2_calc_extend_credits(sb, &gfe->id2.i_list, 0) + | ||
701 | 3 + oinfo->dqi_gi.dqi_qtree_depth + 2; | ||
702 | } | ||
703 | |||
704 | static int ocfs2_acquire_dquot(struct dquot *dquot) | 725 | static int ocfs2_acquire_dquot(struct dquot *dquot) |
705 | { | 726 | { |
706 | handle_t *handle; | ||
707 | struct ocfs2_mem_dqinfo *oinfo = | 727 | struct ocfs2_mem_dqinfo *oinfo = |
708 | sb_dqinfo(dquot->dq_sb, dquot->dq_type)->dqi_priv; | 728 | sb_dqinfo(dquot->dq_sb, dquot->dq_type)->dqi_priv; |
709 | struct ocfs2_super *osb = OCFS2_SB(dquot->dq_sb); | ||
710 | int status = 0; | 729 | int status = 0; |
711 | 730 | ||
712 | mlog_entry("id=%u, type=%d", dquot->dq_id, dquot->dq_type); | 731 | mlog_entry("id=%u, type=%d", dquot->dq_id, dquot->dq_type); |
@@ -715,16 +734,7 @@ static int ocfs2_acquire_dquot(struct dquot *dquot) | |||
715 | status = ocfs2_lock_global_qf(oinfo, 1); | 734 | status = ocfs2_lock_global_qf(oinfo, 1); |
716 | if (status < 0) | 735 | if (status < 0) |
717 | goto out; | 736 | goto out; |
718 | handle = ocfs2_start_trans(osb, | ||
719 | ocfs2_calc_qinit_credits(dquot->dq_sb, dquot->dq_type)); | ||
720 | if (IS_ERR(handle)) { | ||
721 | status = PTR_ERR(handle); | ||
722 | mlog_errno(status); | ||
723 | goto out_ilock; | ||
724 | } | ||
725 | status = dquot_acquire(dquot); | 737 | status = dquot_acquire(dquot); |
726 | ocfs2_commit_trans(osb, handle); | ||
727 | out_ilock: | ||
728 | ocfs2_unlock_global_qf(oinfo, 1); | 738 | ocfs2_unlock_global_qf(oinfo, 1); |
729 | out: | 739 | out: |
730 | mlog_exit(status); | 740 | mlog_exit(status); |
diff --git a/fs/ocfs2/quota_local.c b/fs/ocfs2/quota_local.c index 5a460fa82553..bdb09cb6e1fe 100644 --- a/fs/ocfs2/quota_local.c +++ b/fs/ocfs2/quota_local.c | |||
@@ -20,6 +20,7 @@ | |||
20 | #include "sysfile.h" | 20 | #include "sysfile.h" |
21 | #include "dlmglue.h" | 21 | #include "dlmglue.h" |
22 | #include "quota.h" | 22 | #include "quota.h" |
23 | #include "uptodate.h" | ||
23 | 24 | ||
24 | /* Number of local quota structures per block */ | 25 | /* Number of local quota structures per block */ |
25 | static inline unsigned int ol_quota_entries_per_block(struct super_block *sb) | 26 | static inline unsigned int ol_quota_entries_per_block(struct super_block *sb) |
@@ -100,7 +101,8 @@ static int ocfs2_modify_bh(struct inode *inode, struct buffer_head *bh, | |||
100 | handle_t *handle; | 101 | handle_t *handle; |
101 | int status; | 102 | int status; |
102 | 103 | ||
103 | handle = ocfs2_start_trans(OCFS2_SB(sb), 1); | 104 | handle = ocfs2_start_trans(OCFS2_SB(sb), |
105 | OCFS2_QUOTA_BLOCK_UPDATE_CREDITS); | ||
104 | if (IS_ERR(handle)) { | 106 | if (IS_ERR(handle)) { |
105 | status = PTR_ERR(handle); | 107 | status = PTR_ERR(handle); |
106 | mlog_errno(status); | 108 | mlog_errno(status); |
@@ -610,7 +612,8 @@ int ocfs2_finish_quota_recovery(struct ocfs2_super *osb, | |||
610 | goto out_bh; | 612 | goto out_bh; |
611 | /* Mark quota file as clean if we are recovering quota file of | 613 | /* Mark quota file as clean if we are recovering quota file of |
612 | * some other node. */ | 614 | * some other node. */ |
613 | handle = ocfs2_start_trans(osb, 1); | 615 | handle = ocfs2_start_trans(osb, |
616 | OCFS2_LOCAL_QINFO_WRITE_CREDITS); | ||
614 | if (IS_ERR(handle)) { | 617 | if (IS_ERR(handle)) { |
615 | status = PTR_ERR(handle); | 618 | status = PTR_ERR(handle); |
616 | mlog_errno(status); | 619 | mlog_errno(status); |
@@ -940,7 +943,7 @@ static struct ocfs2_quota_chunk *ocfs2_local_quota_add_chunk( | |||
940 | struct ocfs2_local_disk_chunk *dchunk; | 943 | struct ocfs2_local_disk_chunk *dchunk; |
941 | int status; | 944 | int status; |
942 | handle_t *handle; | 945 | handle_t *handle; |
943 | struct buffer_head *bh = NULL; | 946 | struct buffer_head *bh = NULL, *dbh = NULL; |
944 | u64 p_blkno; | 947 | u64 p_blkno; |
945 | 948 | ||
946 | /* We are protected by dqio_sem so no locking needed */ | 949 | /* We are protected by dqio_sem so no locking needed */ |
@@ -964,32 +967,35 @@ static struct ocfs2_quota_chunk *ocfs2_local_quota_add_chunk( | |||
964 | mlog_errno(status); | 967 | mlog_errno(status); |
965 | goto out; | 968 | goto out; |
966 | } | 969 | } |
970 | /* Local quota info and two new blocks we initialize */ | ||
971 | handle = ocfs2_start_trans(OCFS2_SB(sb), | ||
972 | OCFS2_LOCAL_QINFO_WRITE_CREDITS + | ||
973 | 2 * OCFS2_QUOTA_BLOCK_UPDATE_CREDITS); | ||
974 | if (IS_ERR(handle)) { | ||
975 | status = PTR_ERR(handle); | ||
976 | mlog_errno(status); | ||
977 | goto out; | ||
978 | } | ||
967 | 979 | ||
980 | /* Initialize chunk header */ | ||
968 | down_read(&OCFS2_I(lqinode)->ip_alloc_sem); | 981 | down_read(&OCFS2_I(lqinode)->ip_alloc_sem); |
969 | status = ocfs2_extent_map_get_blocks(lqinode, oinfo->dqi_blocks, | 982 | status = ocfs2_extent_map_get_blocks(lqinode, oinfo->dqi_blocks, |
970 | &p_blkno, NULL, NULL); | 983 | &p_blkno, NULL, NULL); |
971 | up_read(&OCFS2_I(lqinode)->ip_alloc_sem); | 984 | up_read(&OCFS2_I(lqinode)->ip_alloc_sem); |
972 | if (status < 0) { | 985 | if (status < 0) { |
973 | mlog_errno(status); | 986 | mlog_errno(status); |
974 | goto out; | 987 | goto out_trans; |
975 | } | 988 | } |
976 | bh = sb_getblk(sb, p_blkno); | 989 | bh = sb_getblk(sb, p_blkno); |
977 | if (!bh) { | 990 | if (!bh) { |
978 | status = -ENOMEM; | 991 | status = -ENOMEM; |
979 | mlog_errno(status); | 992 | mlog_errno(status); |
980 | goto out; | 993 | goto out_trans; |
981 | } | 994 | } |
982 | dchunk = (struct ocfs2_local_disk_chunk *)bh->b_data; | 995 | dchunk = (struct ocfs2_local_disk_chunk *)bh->b_data; |
983 | 996 | ocfs2_set_new_buffer_uptodate(lqinode, bh); | |
984 | handle = ocfs2_start_trans(OCFS2_SB(sb), 2); | ||
985 | if (IS_ERR(handle)) { | ||
986 | status = PTR_ERR(handle); | ||
987 | mlog_errno(status); | ||
988 | goto out; | ||
989 | } | ||
990 | |||
991 | status = ocfs2_journal_access_dq(handle, lqinode, bh, | 997 | status = ocfs2_journal_access_dq(handle, lqinode, bh, |
992 | OCFS2_JOURNAL_ACCESS_WRITE); | 998 | OCFS2_JOURNAL_ACCESS_CREATE); |
993 | if (status < 0) { | 999 | if (status < 0) { |
994 | mlog_errno(status); | 1000 | mlog_errno(status); |
995 | goto out_trans; | 1001 | goto out_trans; |
@@ -999,7 +1005,6 @@ static struct ocfs2_quota_chunk *ocfs2_local_quota_add_chunk( | |||
999 | memset(dchunk->dqc_bitmap, 0, | 1005 | memset(dchunk->dqc_bitmap, 0, |
1000 | sb->s_blocksize - sizeof(struct ocfs2_local_disk_chunk) - | 1006 | sb->s_blocksize - sizeof(struct ocfs2_local_disk_chunk) - |
1001 | OCFS2_QBLK_RESERVED_SPACE); | 1007 | OCFS2_QBLK_RESERVED_SPACE); |
1002 | set_buffer_uptodate(bh); | ||
1003 | unlock_buffer(bh); | 1008 | unlock_buffer(bh); |
1004 | status = ocfs2_journal_dirty(handle, bh); | 1009 | status = ocfs2_journal_dirty(handle, bh); |
1005 | if (status < 0) { | 1010 | if (status < 0) { |
@@ -1007,6 +1012,38 @@ static struct ocfs2_quota_chunk *ocfs2_local_quota_add_chunk( | |||
1007 | goto out_trans; | 1012 | goto out_trans; |
1008 | } | 1013 | } |
1009 | 1014 | ||
1015 | /* Initialize new block with structures */ | ||
1016 | down_read(&OCFS2_I(lqinode)->ip_alloc_sem); | ||
1017 | status = ocfs2_extent_map_get_blocks(lqinode, oinfo->dqi_blocks + 1, | ||
1018 | &p_blkno, NULL, NULL); | ||
1019 | up_read(&OCFS2_I(lqinode)->ip_alloc_sem); | ||
1020 | if (status < 0) { | ||
1021 | mlog_errno(status); | ||
1022 | goto out_trans; | ||
1023 | } | ||
1024 | dbh = sb_getblk(sb, p_blkno); | ||
1025 | if (!dbh) { | ||
1026 | status = -ENOMEM; | ||
1027 | mlog_errno(status); | ||
1028 | goto out_trans; | ||
1029 | } | ||
1030 | ocfs2_set_new_buffer_uptodate(lqinode, dbh); | ||
1031 | status = ocfs2_journal_access_dq(handle, lqinode, dbh, | ||
1032 | OCFS2_JOURNAL_ACCESS_CREATE); | ||
1033 | if (status < 0) { | ||
1034 | mlog_errno(status); | ||
1035 | goto out_trans; | ||
1036 | } | ||
1037 | lock_buffer(dbh); | ||
1038 | memset(dbh->b_data, 0, sb->s_blocksize - OCFS2_QBLK_RESERVED_SPACE); | ||
1039 | unlock_buffer(dbh); | ||
1040 | status = ocfs2_journal_dirty(handle, dbh); | ||
1041 | if (status < 0) { | ||
1042 | mlog_errno(status); | ||
1043 | goto out_trans; | ||
1044 | } | ||
1045 | |||
1046 | /* Update local quotafile info */ | ||
1010 | oinfo->dqi_blocks += 2; | 1047 | oinfo->dqi_blocks += 2; |
1011 | oinfo->dqi_chunks++; | 1048 | oinfo->dqi_chunks++; |
1012 | status = ocfs2_local_write_info(sb, type); | 1049 | status = ocfs2_local_write_info(sb, type); |
@@ -1031,6 +1068,7 @@ out_trans: | |||
1031 | ocfs2_commit_trans(OCFS2_SB(sb), handle); | 1068 | ocfs2_commit_trans(OCFS2_SB(sb), handle); |
1032 | out: | 1069 | out: |
1033 | brelse(bh); | 1070 | brelse(bh); |
1071 | brelse(dbh); | ||
1034 | kmem_cache_free(ocfs2_qf_chunk_cachep, chunk); | 1072 | kmem_cache_free(ocfs2_qf_chunk_cachep, chunk); |
1035 | return ERR_PTR(status); | 1073 | return ERR_PTR(status); |
1036 | } | 1074 | } |
@@ -1048,6 +1086,8 @@ static struct ocfs2_quota_chunk *ocfs2_extend_local_quota_file( | |||
1048 | struct ocfs2_local_disk_chunk *dchunk; | 1086 | struct ocfs2_local_disk_chunk *dchunk; |
1049 | int epb = ol_quota_entries_per_block(sb); | 1087 | int epb = ol_quota_entries_per_block(sb); |
1050 | unsigned int chunk_blocks; | 1088 | unsigned int chunk_blocks; |
1089 | struct buffer_head *bh; | ||
1090 | u64 p_blkno; | ||
1051 | int status; | 1091 | int status; |
1052 | handle_t *handle; | 1092 | handle_t *handle; |
1053 | 1093 | ||
@@ -1075,12 +1115,49 @@ static struct ocfs2_quota_chunk *ocfs2_extend_local_quota_file( | |||
1075 | mlog_errno(status); | 1115 | mlog_errno(status); |
1076 | goto out; | 1116 | goto out; |
1077 | } | 1117 | } |
1078 | handle = ocfs2_start_trans(OCFS2_SB(sb), 2); | 1118 | |
1119 | /* Get buffer from the just added block */ | ||
1120 | down_read(&OCFS2_I(lqinode)->ip_alloc_sem); | ||
1121 | status = ocfs2_extent_map_get_blocks(lqinode, oinfo->dqi_blocks, | ||
1122 | &p_blkno, NULL, NULL); | ||
1123 | up_read(&OCFS2_I(lqinode)->ip_alloc_sem); | ||
1124 | if (status < 0) { | ||
1125 | mlog_errno(status); | ||
1126 | goto out; | ||
1127 | } | ||
1128 | bh = sb_getblk(sb, p_blkno); | ||
1129 | if (!bh) { | ||
1130 | status = -ENOMEM; | ||
1131 | mlog_errno(status); | ||
1132 | goto out; | ||
1133 | } | ||
1134 | ocfs2_set_new_buffer_uptodate(lqinode, bh); | ||
1135 | |||
1136 | /* Local quota info, chunk header and the new block we initialize */ | ||
1137 | handle = ocfs2_start_trans(OCFS2_SB(sb), | ||
1138 | OCFS2_LOCAL_QINFO_WRITE_CREDITS + | ||
1139 | 2 * OCFS2_QUOTA_BLOCK_UPDATE_CREDITS); | ||
1079 | if (IS_ERR(handle)) { | 1140 | if (IS_ERR(handle)) { |
1080 | status = PTR_ERR(handle); | 1141 | status = PTR_ERR(handle); |
1081 | mlog_errno(status); | 1142 | mlog_errno(status); |
1082 | goto out; | 1143 | goto out; |
1083 | } | 1144 | } |
1145 | /* Zero created block */ | ||
1146 | status = ocfs2_journal_access_dq(handle, lqinode, bh, | ||
1147 | OCFS2_JOURNAL_ACCESS_CREATE); | ||
1148 | if (status < 0) { | ||
1149 | mlog_errno(status); | ||
1150 | goto out_trans; | ||
1151 | } | ||
1152 | lock_buffer(bh); | ||
1153 | memset(bh->b_data, 0, sb->s_blocksize); | ||
1154 | unlock_buffer(bh); | ||
1155 | status = ocfs2_journal_dirty(handle, bh); | ||
1156 | if (status < 0) { | ||
1157 | mlog_errno(status); | ||
1158 | goto out_trans; | ||
1159 | } | ||
1160 | /* Update chunk header */ | ||
1084 | status = ocfs2_journal_access_dq(handle, lqinode, chunk->qc_headerbh, | 1161 | status = ocfs2_journal_access_dq(handle, lqinode, chunk->qc_headerbh, |
1085 | OCFS2_JOURNAL_ACCESS_WRITE); | 1162 | OCFS2_JOURNAL_ACCESS_WRITE); |
1086 | if (status < 0) { | 1163 | if (status < 0) { |
@@ -1097,6 +1174,7 @@ static struct ocfs2_quota_chunk *ocfs2_extend_local_quota_file( | |||
1097 | mlog_errno(status); | 1174 | mlog_errno(status); |
1098 | goto out_trans; | 1175 | goto out_trans; |
1099 | } | 1176 | } |
1177 | /* Update file header */ | ||
1100 | oinfo->dqi_blocks++; | 1178 | oinfo->dqi_blocks++; |
1101 | status = ocfs2_local_write_info(sb, type); | 1179 | status = ocfs2_local_write_info(sb, type); |
1102 | if (status < 0) { | 1180 | if (status < 0) { |
diff --git a/fs/ocfs2/stack_o2cb.c b/fs/ocfs2/stack_o2cb.c index 3f661376a2de..e49c41050264 100644 --- a/fs/ocfs2/stack_o2cb.c +++ b/fs/ocfs2/stack_o2cb.c | |||
@@ -17,6 +17,7 @@ | |||
17 | * General Public License for more details. | 17 | * General Public License for more details. |
18 | */ | 18 | */ |
19 | 19 | ||
20 | #include <linux/kernel.h> | ||
20 | #include <linux/crc32.h> | 21 | #include <linux/crc32.h> |
21 | #include <linux/module.h> | 22 | #include <linux/module.h> |
22 | 23 | ||
@@ -153,7 +154,7 @@ static int status_map[] = { | |||
153 | 154 | ||
154 | static int dlm_status_to_errno(enum dlm_status status) | 155 | static int dlm_status_to_errno(enum dlm_status status) |
155 | { | 156 | { |
156 | BUG_ON(status > (sizeof(status_map) / sizeof(status_map[0]))); | 157 | BUG_ON(status < 0 || status >= ARRAY_SIZE(status_map)); |
157 | 158 | ||
158 | return status_map[status]; | 159 | return status_map[status]; |
159 | } | 160 | } |
diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c index 7efb349fb9bd..b0ee0fdf799a 100644 --- a/fs/ocfs2/super.c +++ b/fs/ocfs2/super.c | |||
@@ -777,6 +777,7 @@ static int ocfs2_sb_probe(struct super_block *sb, | |||
777 | } | 777 | } |
778 | di = (struct ocfs2_dinode *) (*bh)->b_data; | 778 | di = (struct ocfs2_dinode *) (*bh)->b_data; |
779 | memset(stats, 0, sizeof(struct ocfs2_blockcheck_stats)); | 779 | memset(stats, 0, sizeof(struct ocfs2_blockcheck_stats)); |
780 | spin_lock_init(&stats->b_lock); | ||
780 | status = ocfs2_verify_volume(di, *bh, blksize, stats); | 781 | status = ocfs2_verify_volume(di, *bh, blksize, stats); |
781 | if (status >= 0) | 782 | if (status >= 0) |
782 | goto bail; | 783 | goto bail; |
@@ -1182,7 +1183,7 @@ static int ocfs2_fill_super(struct super_block *sb, void *data, int silent) | |||
1182 | wake_up(&osb->osb_mount_event); | 1183 | wake_up(&osb->osb_mount_event); |
1183 | 1184 | ||
1184 | /* Start this when the mount is almost sure of being successful */ | 1185 | /* Start this when the mount is almost sure of being successful */ |
1185 | ocfs2_orphan_scan_init(osb); | 1186 | ocfs2_orphan_scan_start(osb); |
1186 | 1187 | ||
1187 | mlog_exit(status); | 1188 | mlog_exit(status); |
1188 | return status; | 1189 | return status; |
@@ -1213,14 +1214,27 @@ static int ocfs2_get_sb(struct file_system_type *fs_type, | |||
1213 | mnt); | 1214 | mnt); |
1214 | } | 1215 | } |
1215 | 1216 | ||
1217 | static void ocfs2_kill_sb(struct super_block *sb) | ||
1218 | { | ||
1219 | struct ocfs2_super *osb = OCFS2_SB(sb); | ||
1220 | |||
1221 | /* Prevent further queueing of inode drop events */ | ||
1222 | spin_lock(&dentry_list_lock); | ||
1223 | ocfs2_set_osb_flag(osb, OCFS2_OSB_DROP_DENTRY_LOCK_IMMED); | ||
1224 | spin_unlock(&dentry_list_lock); | ||
1225 | /* Wait for work to finish and/or remove it */ | ||
1226 | cancel_work_sync(&osb->dentry_lock_work); | ||
1227 | |||
1228 | kill_block_super(sb); | ||
1229 | } | ||
1230 | |||
1216 | static struct file_system_type ocfs2_fs_type = { | 1231 | static struct file_system_type ocfs2_fs_type = { |
1217 | .owner = THIS_MODULE, | 1232 | .owner = THIS_MODULE, |
1218 | .name = "ocfs2", | 1233 | .name = "ocfs2", |
1219 | .get_sb = ocfs2_get_sb, /* is this called when we mount | 1234 | .get_sb = ocfs2_get_sb, /* is this called when we mount |
1220 | * the fs? */ | 1235 | * the fs? */ |
1221 | .kill_sb = kill_block_super, /* set to the generic one | 1236 | .kill_sb = ocfs2_kill_sb, |
1222 | * right now, but do we | 1237 | |
1223 | * need to change that? */ | ||
1224 | .fs_flags = FS_REQUIRES_DEV|FS_RENAME_DOES_D_MOVE, | 1238 | .fs_flags = FS_REQUIRES_DEV|FS_RENAME_DOES_D_MOVE, |
1225 | .next = NULL | 1239 | .next = NULL |
1226 | }; | 1240 | }; |
@@ -1819,6 +1833,12 @@ static void ocfs2_dismount_volume(struct super_block *sb, int mnt_err) | |||
1819 | 1833 | ||
1820 | debugfs_remove(osb->osb_ctxt); | 1834 | debugfs_remove(osb->osb_ctxt); |
1821 | 1835 | ||
1836 | /* | ||
1837 | * Flush inode dropping work queue so that deletes are | ||
1838 | * performed while the filesystem is still working | ||
1839 | */ | ||
1840 | ocfs2_drop_all_dl_inodes(osb); | ||
1841 | |||
1822 | /* Orphan scan should be stopped as early as possible */ | 1842 | /* Orphan scan should be stopped as early as possible */ |
1823 | ocfs2_orphan_scan_stop(osb); | 1843 | ocfs2_orphan_scan_stop(osb); |
1824 | 1844 | ||
@@ -1981,6 +2001,8 @@ static int ocfs2_initialize_super(struct super_block *sb, | |||
1981 | snprintf(osb->dev_str, sizeof(osb->dev_str), "%u,%u", | 2001 | snprintf(osb->dev_str, sizeof(osb->dev_str), "%u,%u", |
1982 | MAJOR(osb->sb->s_dev), MINOR(osb->sb->s_dev)); | 2002 | MAJOR(osb->sb->s_dev), MINOR(osb->sb->s_dev)); |
1983 | 2003 | ||
2004 | ocfs2_orphan_scan_init(osb); | ||
2005 | |||
1984 | status = ocfs2_recovery_init(osb); | 2006 | status = ocfs2_recovery_init(osb); |
1985 | if (status) { | 2007 | if (status) { |
1986 | mlog(ML_ERROR, "Unable to initialize recovery state\n"); | 2008 | mlog(ML_ERROR, "Unable to initialize recovery state\n"); |
diff --git a/fs/ocfs2/xattr.c b/fs/ocfs2/xattr.c index ba320e250747..d1a27cda984f 100644 --- a/fs/ocfs2/xattr.c +++ b/fs/ocfs2/xattr.c | |||
@@ -1052,7 +1052,8 @@ static int ocfs2_xattr_block_get(struct inode *inode, | |||
1052 | struct ocfs2_xattr_block *xb; | 1052 | struct ocfs2_xattr_block *xb; |
1053 | struct ocfs2_xattr_value_root *xv; | 1053 | struct ocfs2_xattr_value_root *xv; |
1054 | size_t size; | 1054 | size_t size; |
1055 | int ret = -ENODATA, name_offset, name_len, block_off, i; | 1055 | int ret = -ENODATA, name_offset, name_len, i; |
1056 | int uninitialized_var(block_off); | ||
1056 | 1057 | ||
1057 | xs->bucket = ocfs2_xattr_bucket_new(inode); | 1058 | xs->bucket = ocfs2_xattr_bucket_new(inode); |
1058 | if (!xs->bucket) { | 1059 | if (!xs->bucket) { |
diff --git a/fs/select.c b/fs/select.c index d870237e42c7..8084834e123e 100644 --- a/fs/select.c +++ b/fs/select.c | |||
@@ -110,6 +110,7 @@ void poll_initwait(struct poll_wqueues *pwq) | |||
110 | { | 110 | { |
111 | init_poll_funcptr(&pwq->pt, __pollwait); | 111 | init_poll_funcptr(&pwq->pt, __pollwait); |
112 | pwq->polling_task = current; | 112 | pwq->polling_task = current; |
113 | pwq->triggered = 0; | ||
113 | pwq->error = 0; | 114 | pwq->error = 0; |
114 | pwq->table = NULL; | 115 | pwq->table = NULL; |
115 | pwq->inline_index = 0; | 116 | pwq->inline_index = 0; |
diff --git a/fs/xfs/linux-2.6/xfs_buf.c b/fs/xfs/linux-2.6/xfs_buf.c index 0c93c7ef3d18..965df1227d64 100644 --- a/fs/xfs/linux-2.6/xfs_buf.c +++ b/fs/xfs/linux-2.6/xfs_buf.c | |||
@@ -770,7 +770,7 @@ xfs_buf_associate_memory( | |||
770 | bp->b_pages = NULL; | 770 | bp->b_pages = NULL; |
771 | bp->b_addr = mem; | 771 | bp->b_addr = mem; |
772 | 772 | ||
773 | rval = _xfs_buf_get_pages(bp, page_count, 0); | 773 | rval = _xfs_buf_get_pages(bp, page_count, XBF_DONT_BLOCK); |
774 | if (rval) | 774 | if (rval) |
775 | return rval; | 775 | return rval; |
776 | 776 | ||
diff --git a/fs/xfs/xfs_attr.c b/fs/xfs/xfs_attr.c index db15feb906ff..4ece1906bd41 100644 --- a/fs/xfs/xfs_attr.c +++ b/fs/xfs/xfs_attr.c | |||
@@ -2010,7 +2010,9 @@ xfs_attr_rmtval_get(xfs_da_args_t *args) | |||
2010 | dblkno = XFS_FSB_TO_DADDR(mp, map[i].br_startblock); | 2010 | dblkno = XFS_FSB_TO_DADDR(mp, map[i].br_startblock); |
2011 | blkcnt = XFS_FSB_TO_BB(mp, map[i].br_blockcount); | 2011 | blkcnt = XFS_FSB_TO_BB(mp, map[i].br_blockcount); |
2012 | error = xfs_read_buf(mp, mp->m_ddev_targp, dblkno, | 2012 | error = xfs_read_buf(mp, mp->m_ddev_targp, dblkno, |
2013 | blkcnt, XFS_BUF_LOCK, &bp); | 2013 | blkcnt, |
2014 | XFS_BUF_LOCK | XBF_DONT_BLOCK, | ||
2015 | &bp); | ||
2014 | if (error) | 2016 | if (error) |
2015 | return(error); | 2017 | return(error); |
2016 | 2018 | ||
@@ -2141,8 +2143,8 @@ xfs_attr_rmtval_set(xfs_da_args_t *args) | |||
2141 | dblkno = XFS_FSB_TO_DADDR(mp, map.br_startblock), | 2143 | dblkno = XFS_FSB_TO_DADDR(mp, map.br_startblock), |
2142 | blkcnt = XFS_FSB_TO_BB(mp, map.br_blockcount); | 2144 | blkcnt = XFS_FSB_TO_BB(mp, map.br_blockcount); |
2143 | 2145 | ||
2144 | bp = xfs_buf_get_flags(mp->m_ddev_targp, dblkno, | 2146 | bp = xfs_buf_get_flags(mp->m_ddev_targp, dblkno, blkcnt, |
2145 | blkcnt, XFS_BUF_LOCK); | 2147 | XFS_BUF_LOCK | XBF_DONT_BLOCK); |
2146 | ASSERT(bp); | 2148 | ASSERT(bp); |
2147 | ASSERT(!XFS_BUF_GETERROR(bp)); | 2149 | ASSERT(!XFS_BUF_GETERROR(bp)); |
2148 | 2150 | ||
diff --git a/fs/xfs/xfs_bmap.c b/fs/xfs/xfs_bmap.c index 7928b9983c1d..8ee5b5a76a2a 100644 --- a/fs/xfs/xfs_bmap.c +++ b/fs/xfs/xfs_bmap.c | |||
@@ -6009,7 +6009,7 @@ xfs_getbmap( | |||
6009 | */ | 6009 | */ |
6010 | error = ENOMEM; | 6010 | error = ENOMEM; |
6011 | subnex = 16; | 6011 | subnex = 16; |
6012 | map = kmem_alloc(subnex * sizeof(*map), KM_MAYFAIL); | 6012 | map = kmem_alloc(subnex * sizeof(*map), KM_MAYFAIL | KM_NOFS); |
6013 | if (!map) | 6013 | if (!map) |
6014 | goto out_unlock_ilock; | 6014 | goto out_unlock_ilock; |
6015 | 6015 | ||
diff --git a/fs/xfs/xfs_btree.c b/fs/xfs/xfs_btree.c index e9df99574829..26717388acf5 100644 --- a/fs/xfs/xfs_btree.c +++ b/fs/xfs/xfs_btree.c | |||
@@ -120,8 +120,8 @@ xfs_btree_check_sblock( | |||
120 | XFS_RANDOM_BTREE_CHECK_SBLOCK))) { | 120 | XFS_RANDOM_BTREE_CHECK_SBLOCK))) { |
121 | if (bp) | 121 | if (bp) |
122 | xfs_buftrace("SBTREE ERROR", bp); | 122 | xfs_buftrace("SBTREE ERROR", bp); |
123 | XFS_ERROR_REPORT("xfs_btree_check_sblock", XFS_ERRLEVEL_LOW, | 123 | XFS_CORRUPTION_ERROR("xfs_btree_check_sblock", |
124 | cur->bc_mp); | 124 | XFS_ERRLEVEL_LOW, cur->bc_mp, block); |
125 | return XFS_ERROR(EFSCORRUPTED); | 125 | return XFS_ERROR(EFSCORRUPTED); |
126 | } | 126 | } |
127 | return 0; | 127 | return 0; |
diff --git a/fs/xfs/xfs_da_btree.c b/fs/xfs/xfs_da_btree.c index 9ff6e57a5075..2847bbc1c534 100644 --- a/fs/xfs/xfs_da_btree.c +++ b/fs/xfs/xfs_da_btree.c | |||
@@ -2201,7 +2201,7 @@ kmem_zone_t *xfs_dabuf_zone; /* dabuf zone */ | |||
2201 | xfs_da_state_t * | 2201 | xfs_da_state_t * |
2202 | xfs_da_state_alloc(void) | 2202 | xfs_da_state_alloc(void) |
2203 | { | 2203 | { |
2204 | return kmem_zone_zalloc(xfs_da_state_zone, KM_SLEEP); | 2204 | return kmem_zone_zalloc(xfs_da_state_zone, KM_NOFS); |
2205 | } | 2205 | } |
2206 | 2206 | ||
2207 | /* | 2207 | /* |
@@ -2261,9 +2261,9 @@ xfs_da_buf_make(int nbuf, xfs_buf_t **bps, inst_t *ra) | |||
2261 | int off; | 2261 | int off; |
2262 | 2262 | ||
2263 | if (nbuf == 1) | 2263 | if (nbuf == 1) |
2264 | dabuf = kmem_zone_alloc(xfs_dabuf_zone, KM_SLEEP); | 2264 | dabuf = kmem_zone_alloc(xfs_dabuf_zone, KM_NOFS); |
2265 | else | 2265 | else |
2266 | dabuf = kmem_alloc(XFS_DA_BUF_SIZE(nbuf), KM_SLEEP); | 2266 | dabuf = kmem_alloc(XFS_DA_BUF_SIZE(nbuf), KM_NOFS); |
2267 | dabuf->dirty = 0; | 2267 | dabuf->dirty = 0; |
2268 | #ifdef XFS_DABUF_DEBUG | 2268 | #ifdef XFS_DABUF_DEBUG |
2269 | dabuf->ra = ra; | 2269 | dabuf->ra = ra; |
diff --git a/fs/xfs/xfs_dir2.c b/fs/xfs/xfs_dir2.c index c657bec6d951..bb1d58eb3982 100644 --- a/fs/xfs/xfs_dir2.c +++ b/fs/xfs/xfs_dir2.c | |||
@@ -256,7 +256,7 @@ xfs_dir_cilookup_result( | |||
256 | !(args->op_flags & XFS_DA_OP_CILOOKUP)) | 256 | !(args->op_flags & XFS_DA_OP_CILOOKUP)) |
257 | return EEXIST; | 257 | return EEXIST; |
258 | 258 | ||
259 | args->value = kmem_alloc(len, KM_MAYFAIL); | 259 | args->value = kmem_alloc(len, KM_NOFS | KM_MAYFAIL); |
260 | if (!args->value) | 260 | if (!args->value) |
261 | return ENOMEM; | 261 | return ENOMEM; |
262 | 262 | ||
diff --git a/fs/xfs/xfs_fsops.c b/fs/xfs/xfs_fsops.c index cbd451bb4848..2d0b3e1da9e6 100644 --- a/fs/xfs/xfs_fsops.c +++ b/fs/xfs/xfs_fsops.c | |||
@@ -167,17 +167,25 @@ xfs_growfs_data_private( | |||
167 | new = nb - mp->m_sb.sb_dblocks; | 167 | new = nb - mp->m_sb.sb_dblocks; |
168 | oagcount = mp->m_sb.sb_agcount; | 168 | oagcount = mp->m_sb.sb_agcount; |
169 | if (nagcount > oagcount) { | 169 | if (nagcount > oagcount) { |
170 | void *new_perag, *old_perag; | ||
171 | |||
170 | xfs_filestream_flush(mp); | 172 | xfs_filestream_flush(mp); |
173 | |||
174 | new_perag = kmem_zalloc(sizeof(xfs_perag_t) * nagcount, | ||
175 | KM_MAYFAIL); | ||
176 | if (!new_perag) | ||
177 | return XFS_ERROR(ENOMEM); | ||
178 | |||
171 | down_write(&mp->m_peraglock); | 179 | down_write(&mp->m_peraglock); |
172 | mp->m_perag = kmem_realloc(mp->m_perag, | 180 | memcpy(new_perag, mp->m_perag, sizeof(xfs_perag_t) * oagcount); |
173 | sizeof(xfs_perag_t) * nagcount, | 181 | old_perag = mp->m_perag; |
174 | sizeof(xfs_perag_t) * oagcount, | 182 | mp->m_perag = new_perag; |
175 | KM_SLEEP); | 183 | |
176 | memset(&mp->m_perag[oagcount], 0, | ||
177 | (nagcount - oagcount) * sizeof(xfs_perag_t)); | ||
178 | mp->m_flags |= XFS_MOUNT_32BITINODES; | 184 | mp->m_flags |= XFS_MOUNT_32BITINODES; |
179 | nagimax = xfs_initialize_perag(mp, nagcount); | 185 | nagimax = xfs_initialize_perag(mp, nagcount); |
180 | up_write(&mp->m_peraglock); | 186 | up_write(&mp->m_peraglock); |
187 | |||
188 | kmem_free(old_perag); | ||
181 | } | 189 | } |
182 | tp = xfs_trans_alloc(mp, XFS_TRANS_GROWFS); | 190 | tp = xfs_trans_alloc(mp, XFS_TRANS_GROWFS); |
183 | tp->t_flags |= XFS_TRANS_RESERVE; | 191 | tp->t_flags |= XFS_TRANS_RESERVE; |
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c index 1f22d65fed0a..da428b3fe0f5 100644 --- a/fs/xfs/xfs_inode.c +++ b/fs/xfs/xfs_inode.c | |||
@@ -343,6 +343,16 @@ xfs_iformat( | |||
343 | return XFS_ERROR(EFSCORRUPTED); | 343 | return XFS_ERROR(EFSCORRUPTED); |
344 | } | 344 | } |
345 | 345 | ||
346 | if (unlikely((ip->i_d.di_flags & XFS_DIFLAG_REALTIME) && | ||
347 | !ip->i_mount->m_rtdev_targp)) { | ||
348 | xfs_fs_repair_cmn_err(CE_WARN, ip->i_mount, | ||
349 | "corrupt dinode %Lu, has realtime flag set.", | ||
350 | ip->i_ino); | ||
351 | XFS_CORRUPTION_ERROR("xfs_iformat(realtime)", | ||
352 | XFS_ERRLEVEL_LOW, ip->i_mount, dip); | ||
353 | return XFS_ERROR(EFSCORRUPTED); | ||
354 | } | ||
355 | |||
346 | switch (ip->i_d.di_mode & S_IFMT) { | 356 | switch (ip->i_d.di_mode & S_IFMT) { |
347 | case S_IFIFO: | 357 | case S_IFIFO: |
348 | case S_IFCHR: | 358 | case S_IFCHR: |
diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c index 3750f04ede0b..9dbdff3ea484 100644 --- a/fs/xfs/xfs_log.c +++ b/fs/xfs/xfs_log.c | |||
@@ -3180,7 +3180,7 @@ try_again: | |||
3180 | STATIC void | 3180 | STATIC void |
3181 | xlog_state_want_sync(xlog_t *log, xlog_in_core_t *iclog) | 3181 | xlog_state_want_sync(xlog_t *log, xlog_in_core_t *iclog) |
3182 | { | 3182 | { |
3183 | ASSERT(spin_is_locked(&log->l_icloglock)); | 3183 | assert_spin_locked(&log->l_icloglock); |
3184 | 3184 | ||
3185 | if (iclog->ic_state == XLOG_STATE_ACTIVE) { | 3185 | if (iclog->ic_state == XLOG_STATE_ACTIVE) { |
3186 | xlog_state_switch_iclogs(log, iclog, 0); | 3186 | xlog_state_switch_iclogs(log, iclog, 0); |
diff --git a/fs/xfs/xfs_vnodeops.c b/fs/xfs/xfs_vnodeops.c index c4eca5ed5dab..492d75bae2bf 100644 --- a/fs/xfs/xfs_vnodeops.c +++ b/fs/xfs/xfs_vnodeops.c | |||
@@ -538,7 +538,9 @@ xfs_readlink_bmap( | |||
538 | d = XFS_FSB_TO_DADDR(mp, mval[n].br_startblock); | 538 | d = XFS_FSB_TO_DADDR(mp, mval[n].br_startblock); |
539 | byte_cnt = XFS_FSB_TO_B(mp, mval[n].br_blockcount); | 539 | byte_cnt = XFS_FSB_TO_B(mp, mval[n].br_blockcount); |
540 | 540 | ||
541 | bp = xfs_buf_read(mp->m_ddev_targp, d, BTOBB(byte_cnt), 0); | 541 | bp = xfs_buf_read_flags(mp->m_ddev_targp, d, BTOBB(byte_cnt), |
542 | XBF_LOCK | XBF_MAPPED | | ||
543 | XBF_DONT_BLOCK); | ||
542 | error = XFS_BUF_GETERROR(bp); | 544 | error = XFS_BUF_GETERROR(bp); |
543 | if (error) { | 545 | if (error) { |
544 | xfs_ioerror_alert("xfs_readlink", | 546 | xfs_ioerror_alert("xfs_readlink", |
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h index fdffb413b192..f6b90240dd41 100644 --- a/include/linux/nfs_fs.h +++ b/include/linux/nfs_fs.h | |||
@@ -473,7 +473,6 @@ extern int nfs_writepages(struct address_space *, struct writeback_control *); | |||
473 | extern int nfs_flush_incompatible(struct file *file, struct page *page); | 473 | extern int nfs_flush_incompatible(struct file *file, struct page *page); |
474 | extern int nfs_updatepage(struct file *, struct page *, unsigned int, unsigned int); | 474 | extern int nfs_updatepage(struct file *, struct page *, unsigned int, unsigned int); |
475 | extern int nfs_writeback_done(struct rpc_task *, struct nfs_write_data *); | 475 | extern int nfs_writeback_done(struct rpc_task *, struct nfs_write_data *); |
476 | extern void nfs_writedata_release(void *); | ||
477 | 476 | ||
478 | /* | 477 | /* |
479 | * Try to write back everything synchronously (but check the | 478 | * Try to write back everything synchronously (but check the |
@@ -488,7 +487,6 @@ extern int nfs_wb_page_cancel(struct inode *inode, struct page* page); | |||
488 | extern int nfs_commit_inode(struct inode *, int); | 487 | extern int nfs_commit_inode(struct inode *, int); |
489 | extern struct nfs_write_data *nfs_commitdata_alloc(void); | 488 | extern struct nfs_write_data *nfs_commitdata_alloc(void); |
490 | extern void nfs_commit_free(struct nfs_write_data *wdata); | 489 | extern void nfs_commit_free(struct nfs_write_data *wdata); |
491 | extern void nfs_commitdata_release(void *wdata); | ||
492 | #else | 490 | #else |
493 | static inline int | 491 | static inline int |
494 | nfs_commit_inode(struct inode *inode, int how) | 492 | nfs_commit_inode(struct inode *inode, int how) |
@@ -507,6 +505,7 @@ nfs_have_writebacks(struct inode *inode) | |||
507 | * Allocate nfs_write_data structures | 505 | * Allocate nfs_write_data structures |
508 | */ | 506 | */ |
509 | extern struct nfs_write_data *nfs_writedata_alloc(unsigned int npages); | 507 | extern struct nfs_write_data *nfs_writedata_alloc(unsigned int npages); |
508 | extern void nfs_writedata_free(struct nfs_write_data *); | ||
510 | 509 | ||
511 | /* | 510 | /* |
512 | * linux/fs/nfs/read.c | 511 | * linux/fs/nfs/read.c |
@@ -515,7 +514,6 @@ extern int nfs_readpage(struct file *, struct page *); | |||
515 | extern int nfs_readpages(struct file *, struct address_space *, | 514 | extern int nfs_readpages(struct file *, struct address_space *, |
516 | struct list_head *, unsigned); | 515 | struct list_head *, unsigned); |
517 | extern int nfs_readpage_result(struct rpc_task *, struct nfs_read_data *); | 516 | extern int nfs_readpage_result(struct rpc_task *, struct nfs_read_data *); |
518 | extern void nfs_readdata_release(void *data); | ||
519 | extern int nfs_readpage_async(struct nfs_open_context *, struct inode *, | 517 | extern int nfs_readpage_async(struct nfs_open_context *, struct inode *, |
520 | struct page *); | 518 | struct page *); |
521 | 519 | ||
@@ -523,6 +521,7 @@ extern int nfs_readpage_async(struct nfs_open_context *, struct inode *, | |||
523 | * Allocate nfs_read_data structures | 521 | * Allocate nfs_read_data structures |
524 | */ | 522 | */ |
525 | extern struct nfs_read_data *nfs_readdata_alloc(unsigned int npages); | 523 | extern struct nfs_read_data *nfs_readdata_alloc(unsigned int npages); |
524 | extern void nfs_readdata_free(struct nfs_read_data *); | ||
526 | 525 | ||
527 | /* | 526 | /* |
528 | * linux/fs/nfs3proc.c | 527 | * linux/fs/nfs3proc.c |
diff --git a/include/linux/perf_counter.h b/include/linux/perf_counter.h index a9d823a93fe8..b53f7006cc4e 100644 --- a/include/linux/perf_counter.h +++ b/include/linux/perf_counter.h | |||
@@ -115,7 +115,7 @@ enum perf_counter_sample_format { | |||
115 | PERF_SAMPLE_TID = 1U << 1, | 115 | PERF_SAMPLE_TID = 1U << 1, |
116 | PERF_SAMPLE_TIME = 1U << 2, | 116 | PERF_SAMPLE_TIME = 1U << 2, |
117 | PERF_SAMPLE_ADDR = 1U << 3, | 117 | PERF_SAMPLE_ADDR = 1U << 3, |
118 | PERF_SAMPLE_GROUP = 1U << 4, | 118 | PERF_SAMPLE_READ = 1U << 4, |
119 | PERF_SAMPLE_CALLCHAIN = 1U << 5, | 119 | PERF_SAMPLE_CALLCHAIN = 1U << 5, |
120 | PERF_SAMPLE_ID = 1U << 6, | 120 | PERF_SAMPLE_ID = 1U << 6, |
121 | PERF_SAMPLE_CPU = 1U << 7, | 121 | PERF_SAMPLE_CPU = 1U << 7, |
@@ -127,16 +127,32 @@ enum perf_counter_sample_format { | |||
127 | }; | 127 | }; |
128 | 128 | ||
129 | /* | 129 | /* |
130 | * Bits that can be set in attr.read_format to request that | 130 | * The format of the data returned by read() on a perf counter fd, |
131 | * reads on the counter should return the indicated quantities, | 131 | * as specified by attr.read_format: |
132 | * in increasing order of bit value, after the counter value. | 132 | * |
133 | * struct read_format { | ||
134 | * { u64 value; | ||
135 | * { u64 time_enabled; } && PERF_FORMAT_ENABLED | ||
136 | * { u64 time_running; } && PERF_FORMAT_RUNNING | ||
137 | * { u64 id; } && PERF_FORMAT_ID | ||
138 | * } && !PERF_FORMAT_GROUP | ||
139 | * | ||
140 | * { u64 nr; | ||
141 | * { u64 time_enabled; } && PERF_FORMAT_ENABLED | ||
142 | * { u64 time_running; } && PERF_FORMAT_RUNNING | ||
143 | * { u64 value; | ||
144 | * { u64 id; } && PERF_FORMAT_ID | ||
145 | * } cntr[nr]; | ||
146 | * } && PERF_FORMAT_GROUP | ||
147 | * }; | ||
133 | */ | 148 | */ |
134 | enum perf_counter_read_format { | 149 | enum perf_counter_read_format { |
135 | PERF_FORMAT_TOTAL_TIME_ENABLED = 1U << 0, | 150 | PERF_FORMAT_TOTAL_TIME_ENABLED = 1U << 0, |
136 | PERF_FORMAT_TOTAL_TIME_RUNNING = 1U << 1, | 151 | PERF_FORMAT_TOTAL_TIME_RUNNING = 1U << 1, |
137 | PERF_FORMAT_ID = 1U << 2, | 152 | PERF_FORMAT_ID = 1U << 2, |
153 | PERF_FORMAT_GROUP = 1U << 3, | ||
138 | 154 | ||
139 | PERF_FORMAT_MAX = 1U << 3, /* non-ABI */ | 155 | PERF_FORMAT_MAX = 1U << 4, /* non-ABI */ |
140 | }; | 156 | }; |
141 | 157 | ||
142 | #define PERF_ATTR_SIZE_VER0 64 /* sizeof first published struct */ | 158 | #define PERF_ATTR_SIZE_VER0 64 /* sizeof first published struct */ |
@@ -343,10 +359,8 @@ enum perf_event_type { | |||
343 | * struct { | 359 | * struct { |
344 | * struct perf_event_header header; | 360 | * struct perf_event_header header; |
345 | * u32 pid, tid; | 361 | * u32 pid, tid; |
346 | * u64 value; | 362 | * |
347 | * { u64 time_enabled; } && PERF_FORMAT_ENABLED | 363 | * struct read_format values; |
348 | * { u64 time_running; } && PERF_FORMAT_RUNNING | ||
349 | * { u64 parent_id; } && PERF_FORMAT_ID | ||
350 | * }; | 364 | * }; |
351 | */ | 365 | */ |
352 | PERF_EVENT_READ = 8, | 366 | PERF_EVENT_READ = 8, |
@@ -364,11 +378,22 @@ enum perf_event_type { | |||
364 | * { u32 cpu, res; } && PERF_SAMPLE_CPU | 378 | * { u32 cpu, res; } && PERF_SAMPLE_CPU |
365 | * { u64 period; } && PERF_SAMPLE_PERIOD | 379 | * { u64 period; } && PERF_SAMPLE_PERIOD |
366 | * | 380 | * |
367 | * { u64 nr; | 381 | * { struct read_format values; } && PERF_SAMPLE_READ |
368 | * { u64 id, val; } cnt[nr]; } && PERF_SAMPLE_GROUP | ||
369 | * | 382 | * |
370 | * { u64 nr, | 383 | * { u64 nr, |
371 | * u64 ips[nr]; } && PERF_SAMPLE_CALLCHAIN | 384 | * u64 ips[nr]; } && PERF_SAMPLE_CALLCHAIN |
385 | * | ||
386 | * # | ||
387 | * # The RAW record below is opaque data wrt the ABI | ||
388 | * # | ||
389 | * # That is, the ABI doesn't make any promises wrt to | ||
390 | * # the stability of its content, it may vary depending | ||
391 | * # on event, hardware, kernel version and phase of | ||
392 | * # the moon. | ||
393 | * # | ||
394 | * # In other words, PERF_SAMPLE_RAW contents are not an ABI. | ||
395 | * # | ||
396 | * | ||
372 | * { u32 size; | 397 | * { u32 size; |
373 | * char data[size];}&& PERF_SAMPLE_RAW | 398 | * char data[size];}&& PERF_SAMPLE_RAW |
374 | * }; | 399 | * }; |
@@ -694,6 +719,8 @@ struct perf_sample_data { | |||
694 | 719 | ||
695 | extern int perf_counter_overflow(struct perf_counter *counter, int nmi, | 720 | extern int perf_counter_overflow(struct perf_counter *counter, int nmi, |
696 | struct perf_sample_data *data); | 721 | struct perf_sample_data *data); |
722 | extern void perf_counter_output(struct perf_counter *counter, int nmi, | ||
723 | struct perf_sample_data *data); | ||
697 | 724 | ||
698 | /* | 725 | /* |
699 | * Return 1 for a software counter, 0 for a hardware counter | 726 | * Return 1 for a software counter, 0 for a hardware counter |
diff --git a/include/linux/wait.h b/include/linux/wait.h index 6788e1a4d4ca..cf3c2f5dba51 100644 --- a/include/linux/wait.h +++ b/include/linux/wait.h | |||
@@ -77,7 +77,14 @@ struct task_struct; | |||
77 | #define __WAIT_BIT_KEY_INITIALIZER(word, bit) \ | 77 | #define __WAIT_BIT_KEY_INITIALIZER(word, bit) \ |
78 | { .flags = word, .bit_nr = bit, } | 78 | { .flags = word, .bit_nr = bit, } |
79 | 79 | ||
80 | extern void init_waitqueue_head(wait_queue_head_t *q); | 80 | extern void __init_waitqueue_head(wait_queue_head_t *q, struct lock_class_key *); |
81 | |||
82 | #define init_waitqueue_head(q) \ | ||
83 | do { \ | ||
84 | static struct lock_class_key __key; \ | ||
85 | \ | ||
86 | __init_waitqueue_head((q), &__key); \ | ||
87 | } while (0) | ||
81 | 88 | ||
82 | #ifdef CONFIG_LOCKDEP | 89 | #ifdef CONFIG_LOCKDEP |
83 | # define __WAIT_QUEUE_HEAD_INIT_ONSTACK(name) \ | 90 | # define __WAIT_QUEUE_HEAD_INIT_ONSTACK(name) \ |
diff --git a/kernel/futex.c b/kernel/futex.c index 0672ff88f159..e18cfbdc7190 100644 --- a/kernel/futex.c +++ b/kernel/futex.c | |||
@@ -1010,15 +1010,19 @@ void requeue_futex(struct futex_q *q, struct futex_hash_bucket *hb1, | |||
1010 | * requeue_pi_wake_futex() - Wake a task that acquired the lock during requeue | 1010 | * requeue_pi_wake_futex() - Wake a task that acquired the lock during requeue |
1011 | * q: the futex_q | 1011 | * q: the futex_q |
1012 | * key: the key of the requeue target futex | 1012 | * key: the key of the requeue target futex |
1013 | * hb: the hash_bucket of the requeue target futex | ||
1013 | * | 1014 | * |
1014 | * During futex_requeue, with requeue_pi=1, it is possible to acquire the | 1015 | * During futex_requeue, with requeue_pi=1, it is possible to acquire the |
1015 | * target futex if it is uncontended or via a lock steal. Set the futex_q key | 1016 | * target futex if it is uncontended or via a lock steal. Set the futex_q key |
1016 | * to the requeue target futex so the waiter can detect the wakeup on the right | 1017 | * to the requeue target futex so the waiter can detect the wakeup on the right |
1017 | * futex, but remove it from the hb and NULL the rt_waiter so it can detect | 1018 | * futex, but remove it from the hb and NULL the rt_waiter so it can detect |
1018 | * atomic lock acquisition. Must be called with the q->lock_ptr held. | 1019 | * atomic lock acquisition. Set the q->lock_ptr to the requeue target hb->lock |
1020 | * to protect access to the pi_state to fixup the owner later. Must be called | ||
1021 | * with both q->lock_ptr and hb->lock held. | ||
1019 | */ | 1022 | */ |
1020 | static inline | 1023 | static inline |
1021 | void requeue_pi_wake_futex(struct futex_q *q, union futex_key *key) | 1024 | void requeue_pi_wake_futex(struct futex_q *q, union futex_key *key, |
1025 | struct futex_hash_bucket *hb) | ||
1022 | { | 1026 | { |
1023 | drop_futex_key_refs(&q->key); | 1027 | drop_futex_key_refs(&q->key); |
1024 | get_futex_key_refs(key); | 1028 | get_futex_key_refs(key); |
@@ -1030,6 +1034,11 @@ void requeue_pi_wake_futex(struct futex_q *q, union futex_key *key) | |||
1030 | WARN_ON(!q->rt_waiter); | 1034 | WARN_ON(!q->rt_waiter); |
1031 | q->rt_waiter = NULL; | 1035 | q->rt_waiter = NULL; |
1032 | 1036 | ||
1037 | q->lock_ptr = &hb->lock; | ||
1038 | #ifdef CONFIG_DEBUG_PI_LIST | ||
1039 | q->list.plist.lock = &hb->lock; | ||
1040 | #endif | ||
1041 | |||
1033 | wake_up_state(q->task, TASK_NORMAL); | 1042 | wake_up_state(q->task, TASK_NORMAL); |
1034 | } | 1043 | } |
1035 | 1044 | ||
@@ -1088,7 +1097,7 @@ static int futex_proxy_trylock_atomic(u32 __user *pifutex, | |||
1088 | ret = futex_lock_pi_atomic(pifutex, hb2, key2, ps, top_waiter->task, | 1097 | ret = futex_lock_pi_atomic(pifutex, hb2, key2, ps, top_waiter->task, |
1089 | set_waiters); | 1098 | set_waiters); |
1090 | if (ret == 1) | 1099 | if (ret == 1) |
1091 | requeue_pi_wake_futex(top_waiter, key2); | 1100 | requeue_pi_wake_futex(top_waiter, key2, hb2); |
1092 | 1101 | ||
1093 | return ret; | 1102 | return ret; |
1094 | } | 1103 | } |
@@ -1247,8 +1256,15 @@ retry_private: | |||
1247 | if (!match_futex(&this->key, &key1)) | 1256 | if (!match_futex(&this->key, &key1)) |
1248 | continue; | 1257 | continue; |
1249 | 1258 | ||
1250 | WARN_ON(!requeue_pi && this->rt_waiter); | 1259 | /* |
1251 | WARN_ON(requeue_pi && !this->rt_waiter); | 1260 | * FUTEX_WAIT_REQEUE_PI and FUTEX_CMP_REQUEUE_PI should always |
1261 | * be paired with each other and no other futex ops. | ||
1262 | */ | ||
1263 | if ((requeue_pi && !this->rt_waiter) || | ||
1264 | (!requeue_pi && this->rt_waiter)) { | ||
1265 | ret = -EINVAL; | ||
1266 | break; | ||
1267 | } | ||
1252 | 1268 | ||
1253 | /* | 1269 | /* |
1254 | * Wake nr_wake waiters. For requeue_pi, if we acquired the | 1270 | * Wake nr_wake waiters. For requeue_pi, if we acquired the |
@@ -1273,7 +1289,7 @@ retry_private: | |||
1273 | this->task, 1); | 1289 | this->task, 1); |
1274 | if (ret == 1) { | 1290 | if (ret == 1) { |
1275 | /* We got the lock. */ | 1291 | /* We got the lock. */ |
1276 | requeue_pi_wake_futex(this, &key2); | 1292 | requeue_pi_wake_futex(this, &key2, hb2); |
1277 | continue; | 1293 | continue; |
1278 | } else if (ret) { | 1294 | } else if (ret) { |
1279 | /* -EDEADLK */ | 1295 | /* -EDEADLK */ |
diff --git a/kernel/futex_compat.c b/kernel/futex_compat.c index d607a5b9ee29..235716556bf1 100644 --- a/kernel/futex_compat.c +++ b/kernel/futex_compat.c | |||
@@ -180,7 +180,8 @@ asmlinkage long compat_sys_futex(u32 __user *uaddr, int op, u32 val, | |||
180 | int cmd = op & FUTEX_CMD_MASK; | 180 | int cmd = op & FUTEX_CMD_MASK; |
181 | 181 | ||
182 | if (utime && (cmd == FUTEX_WAIT || cmd == FUTEX_LOCK_PI || | 182 | if (utime && (cmd == FUTEX_WAIT || cmd == FUTEX_LOCK_PI || |
183 | cmd == FUTEX_WAIT_BITSET)) { | 183 | cmd == FUTEX_WAIT_BITSET || |
184 | cmd == FUTEX_WAIT_REQUEUE_PI)) { | ||
184 | if (get_compat_timespec(&ts, utime)) | 185 | if (get_compat_timespec(&ts, utime)) |
185 | return -EFAULT; | 186 | return -EFAULT; |
186 | if (!timespec_valid(&ts)) | 187 | if (!timespec_valid(&ts)) |
@@ -191,7 +192,8 @@ asmlinkage long compat_sys_futex(u32 __user *uaddr, int op, u32 val, | |||
191 | t = ktime_add_safe(ktime_get(), t); | 192 | t = ktime_add_safe(ktime_get(), t); |
192 | tp = &t; | 193 | tp = &t; |
193 | } | 194 | } |
194 | if (cmd == FUTEX_REQUEUE || cmd == FUTEX_CMP_REQUEUE) | 195 | if (cmd == FUTEX_REQUEUE || cmd == FUTEX_CMP_REQUEUE || |
196 | cmd == FUTEX_CMP_REQUEUE_PI || cmd == FUTEX_WAKE_OP) | ||
195 | val2 = (int) (unsigned long) utime; | 197 | val2 = (int) (unsigned long) utime; |
196 | 198 | ||
197 | return do_futex(uaddr, op, val, tp, uaddr2, val2, val3); | 199 | return do_futex(uaddr, op, val, tp, uaddr2, val2, val3); |
diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c index 61c679db4687..d222515a5a06 100644 --- a/kernel/irq/manage.c +++ b/kernel/irq/manage.c | |||
@@ -761,7 +761,6 @@ static struct irqaction *__free_irq(unsigned int irq, void *dev_id) | |||
761 | { | 761 | { |
762 | struct irq_desc *desc = irq_to_desc(irq); | 762 | struct irq_desc *desc = irq_to_desc(irq); |
763 | struct irqaction *action, **action_ptr; | 763 | struct irqaction *action, **action_ptr; |
764 | struct task_struct *irqthread; | ||
765 | unsigned long flags; | 764 | unsigned long flags; |
766 | 765 | ||
767 | WARN(in_interrupt(), "Trying to free IRQ %d from IRQ context!\n", irq); | 766 | WARN(in_interrupt(), "Trying to free IRQ %d from IRQ context!\n", irq); |
@@ -809,9 +808,6 @@ static struct irqaction *__free_irq(unsigned int irq, void *dev_id) | |||
809 | desc->chip->disable(irq); | 808 | desc->chip->disable(irq); |
810 | } | 809 | } |
811 | 810 | ||
812 | irqthread = action->thread; | ||
813 | action->thread = NULL; | ||
814 | |||
815 | spin_unlock_irqrestore(&desc->lock, flags); | 811 | spin_unlock_irqrestore(&desc->lock, flags); |
816 | 812 | ||
817 | unregister_handler_proc(irq, action); | 813 | unregister_handler_proc(irq, action); |
@@ -819,12 +815,6 @@ static struct irqaction *__free_irq(unsigned int irq, void *dev_id) | |||
819 | /* Make sure it's not being used on another CPU: */ | 815 | /* Make sure it's not being used on another CPU: */ |
820 | synchronize_irq(irq); | 816 | synchronize_irq(irq); |
821 | 817 | ||
822 | if (irqthread) { | ||
823 | if (!test_bit(IRQTF_DIED, &action->thread_flags)) | ||
824 | kthread_stop(irqthread); | ||
825 | put_task_struct(irqthread); | ||
826 | } | ||
827 | |||
828 | #ifdef CONFIG_DEBUG_SHIRQ | 818 | #ifdef CONFIG_DEBUG_SHIRQ |
829 | /* | 819 | /* |
830 | * It's a shared IRQ -- the driver ought to be prepared for an IRQ | 820 | * It's a shared IRQ -- the driver ought to be prepared for an IRQ |
@@ -840,6 +830,13 @@ static struct irqaction *__free_irq(unsigned int irq, void *dev_id) | |||
840 | local_irq_restore(flags); | 830 | local_irq_restore(flags); |
841 | } | 831 | } |
842 | #endif | 832 | #endif |
833 | |||
834 | if (action->thread) { | ||
835 | if (!test_bit(IRQTF_DIED, &action->thread_flags)) | ||
836 | kthread_stop(action->thread); | ||
837 | put_task_struct(action->thread); | ||
838 | } | ||
839 | |||
843 | return action; | 840 | return action; |
844 | } | 841 | } |
845 | 842 | ||
diff --git a/kernel/perf_counter.c b/kernel/perf_counter.c index b0b20a07f394..534e20d14d63 100644 --- a/kernel/perf_counter.c +++ b/kernel/perf_counter.c | |||
@@ -88,6 +88,7 @@ void __weak hw_perf_disable(void) { barrier(); } | |||
88 | void __weak hw_perf_enable(void) { barrier(); } | 88 | void __weak hw_perf_enable(void) { barrier(); } |
89 | 89 | ||
90 | void __weak hw_perf_counter_setup(int cpu) { barrier(); } | 90 | void __weak hw_perf_counter_setup(int cpu) { barrier(); } |
91 | void __weak hw_perf_counter_setup_online(int cpu) { barrier(); } | ||
91 | 92 | ||
92 | int __weak | 93 | int __weak |
93 | hw_perf_group_sched_in(struct perf_counter *group_leader, | 94 | hw_perf_group_sched_in(struct perf_counter *group_leader, |
@@ -306,6 +307,10 @@ counter_sched_out(struct perf_counter *counter, | |||
306 | return; | 307 | return; |
307 | 308 | ||
308 | counter->state = PERF_COUNTER_STATE_INACTIVE; | 309 | counter->state = PERF_COUNTER_STATE_INACTIVE; |
310 | if (counter->pending_disable) { | ||
311 | counter->pending_disable = 0; | ||
312 | counter->state = PERF_COUNTER_STATE_OFF; | ||
313 | } | ||
309 | counter->tstamp_stopped = ctx->time; | 314 | counter->tstamp_stopped = ctx->time; |
310 | counter->pmu->disable(counter); | 315 | counter->pmu->disable(counter); |
311 | counter->oncpu = -1; | 316 | counter->oncpu = -1; |
@@ -1691,7 +1696,32 @@ static int perf_release(struct inode *inode, struct file *file) | |||
1691 | return 0; | 1696 | return 0; |
1692 | } | 1697 | } |
1693 | 1698 | ||
1694 | static u64 perf_counter_read_tree(struct perf_counter *counter) | 1699 | static int perf_counter_read_size(struct perf_counter *counter) |
1700 | { | ||
1701 | int entry = sizeof(u64); /* value */ | ||
1702 | int size = 0; | ||
1703 | int nr = 1; | ||
1704 | |||
1705 | if (counter->attr.read_format & PERF_FORMAT_TOTAL_TIME_ENABLED) | ||
1706 | size += sizeof(u64); | ||
1707 | |||
1708 | if (counter->attr.read_format & PERF_FORMAT_TOTAL_TIME_RUNNING) | ||
1709 | size += sizeof(u64); | ||
1710 | |||
1711 | if (counter->attr.read_format & PERF_FORMAT_ID) | ||
1712 | entry += sizeof(u64); | ||
1713 | |||
1714 | if (counter->attr.read_format & PERF_FORMAT_GROUP) { | ||
1715 | nr += counter->group_leader->nr_siblings; | ||
1716 | size += sizeof(u64); | ||
1717 | } | ||
1718 | |||
1719 | size += entry * nr; | ||
1720 | |||
1721 | return size; | ||
1722 | } | ||
1723 | |||
1724 | static u64 perf_counter_read_value(struct perf_counter *counter) | ||
1695 | { | 1725 | { |
1696 | struct perf_counter *child; | 1726 | struct perf_counter *child; |
1697 | u64 total = 0; | 1727 | u64 total = 0; |
@@ -1703,14 +1733,96 @@ static u64 perf_counter_read_tree(struct perf_counter *counter) | |||
1703 | return total; | 1733 | return total; |
1704 | } | 1734 | } |
1705 | 1735 | ||
1736 | static int perf_counter_read_entry(struct perf_counter *counter, | ||
1737 | u64 read_format, char __user *buf) | ||
1738 | { | ||
1739 | int n = 0, count = 0; | ||
1740 | u64 values[2]; | ||
1741 | |||
1742 | values[n++] = perf_counter_read_value(counter); | ||
1743 | if (read_format & PERF_FORMAT_ID) | ||
1744 | values[n++] = primary_counter_id(counter); | ||
1745 | |||
1746 | count = n * sizeof(u64); | ||
1747 | |||
1748 | if (copy_to_user(buf, values, count)) | ||
1749 | return -EFAULT; | ||
1750 | |||
1751 | return count; | ||
1752 | } | ||
1753 | |||
1754 | static int perf_counter_read_group(struct perf_counter *counter, | ||
1755 | u64 read_format, char __user *buf) | ||
1756 | { | ||
1757 | struct perf_counter *leader = counter->group_leader, *sub; | ||
1758 | int n = 0, size = 0, err = -EFAULT; | ||
1759 | u64 values[3]; | ||
1760 | |||
1761 | values[n++] = 1 + leader->nr_siblings; | ||
1762 | if (read_format & PERF_FORMAT_TOTAL_TIME_ENABLED) { | ||
1763 | values[n++] = leader->total_time_enabled + | ||
1764 | atomic64_read(&leader->child_total_time_enabled); | ||
1765 | } | ||
1766 | if (read_format & PERF_FORMAT_TOTAL_TIME_RUNNING) { | ||
1767 | values[n++] = leader->total_time_running + | ||
1768 | atomic64_read(&leader->child_total_time_running); | ||
1769 | } | ||
1770 | |||
1771 | size = n * sizeof(u64); | ||
1772 | |||
1773 | if (copy_to_user(buf, values, size)) | ||
1774 | return -EFAULT; | ||
1775 | |||
1776 | err = perf_counter_read_entry(leader, read_format, buf + size); | ||
1777 | if (err < 0) | ||
1778 | return err; | ||
1779 | |||
1780 | size += err; | ||
1781 | |||
1782 | list_for_each_entry(sub, &leader->sibling_list, list_entry) { | ||
1783 | err = perf_counter_read_entry(counter, read_format, | ||
1784 | buf + size); | ||
1785 | if (err < 0) | ||
1786 | return err; | ||
1787 | |||
1788 | size += err; | ||
1789 | } | ||
1790 | |||
1791 | return size; | ||
1792 | } | ||
1793 | |||
1794 | static int perf_counter_read_one(struct perf_counter *counter, | ||
1795 | u64 read_format, char __user *buf) | ||
1796 | { | ||
1797 | u64 values[4]; | ||
1798 | int n = 0; | ||
1799 | |||
1800 | values[n++] = perf_counter_read_value(counter); | ||
1801 | if (read_format & PERF_FORMAT_TOTAL_TIME_ENABLED) { | ||
1802 | values[n++] = counter->total_time_enabled + | ||
1803 | atomic64_read(&counter->child_total_time_enabled); | ||
1804 | } | ||
1805 | if (read_format & PERF_FORMAT_TOTAL_TIME_RUNNING) { | ||
1806 | values[n++] = counter->total_time_running + | ||
1807 | atomic64_read(&counter->child_total_time_running); | ||
1808 | } | ||
1809 | if (read_format & PERF_FORMAT_ID) | ||
1810 | values[n++] = primary_counter_id(counter); | ||
1811 | |||
1812 | if (copy_to_user(buf, values, n * sizeof(u64))) | ||
1813 | return -EFAULT; | ||
1814 | |||
1815 | return n * sizeof(u64); | ||
1816 | } | ||
1817 | |||
1706 | /* | 1818 | /* |
1707 | * Read the performance counter - simple non blocking version for now | 1819 | * Read the performance counter - simple non blocking version for now |
1708 | */ | 1820 | */ |
1709 | static ssize_t | 1821 | static ssize_t |
1710 | perf_read_hw(struct perf_counter *counter, char __user *buf, size_t count) | 1822 | perf_read_hw(struct perf_counter *counter, char __user *buf, size_t count) |
1711 | { | 1823 | { |
1712 | u64 values[4]; | 1824 | u64 read_format = counter->attr.read_format; |
1713 | int n; | 1825 | int ret; |
1714 | 1826 | ||
1715 | /* | 1827 | /* |
1716 | * Return end-of-file for a read on a counter that is in | 1828 | * Return end-of-file for a read on a counter that is in |
@@ -1720,28 +1832,18 @@ perf_read_hw(struct perf_counter *counter, char __user *buf, size_t count) | |||
1720 | if (counter->state == PERF_COUNTER_STATE_ERROR) | 1832 | if (counter->state == PERF_COUNTER_STATE_ERROR) |
1721 | return 0; | 1833 | return 0; |
1722 | 1834 | ||
1835 | if (count < perf_counter_read_size(counter)) | ||
1836 | return -ENOSPC; | ||
1837 | |||
1723 | WARN_ON_ONCE(counter->ctx->parent_ctx); | 1838 | WARN_ON_ONCE(counter->ctx->parent_ctx); |
1724 | mutex_lock(&counter->child_mutex); | 1839 | mutex_lock(&counter->child_mutex); |
1725 | values[0] = perf_counter_read_tree(counter); | 1840 | if (read_format & PERF_FORMAT_GROUP) |
1726 | n = 1; | 1841 | ret = perf_counter_read_group(counter, read_format, buf); |
1727 | if (counter->attr.read_format & PERF_FORMAT_TOTAL_TIME_ENABLED) | 1842 | else |
1728 | values[n++] = counter->total_time_enabled + | 1843 | ret = perf_counter_read_one(counter, read_format, buf); |
1729 | atomic64_read(&counter->child_total_time_enabled); | ||
1730 | if (counter->attr.read_format & PERF_FORMAT_TOTAL_TIME_RUNNING) | ||
1731 | values[n++] = counter->total_time_running + | ||
1732 | atomic64_read(&counter->child_total_time_running); | ||
1733 | if (counter->attr.read_format & PERF_FORMAT_ID) | ||
1734 | values[n++] = primary_counter_id(counter); | ||
1735 | mutex_unlock(&counter->child_mutex); | 1844 | mutex_unlock(&counter->child_mutex); |
1736 | 1845 | ||
1737 | if (count < n * sizeof(u64)) | 1846 | return ret; |
1738 | return -EINVAL; | ||
1739 | count = n * sizeof(u64); | ||
1740 | |||
1741 | if (copy_to_user(buf, values, count)) | ||
1742 | return -EFAULT; | ||
1743 | |||
1744 | return count; | ||
1745 | } | 1847 | } |
1746 | 1848 | ||
1747 | static ssize_t | 1849 | static ssize_t |
@@ -2245,7 +2347,7 @@ static void perf_pending_counter(struct perf_pending_entry *entry) | |||
2245 | 2347 | ||
2246 | if (counter->pending_disable) { | 2348 | if (counter->pending_disable) { |
2247 | counter->pending_disable = 0; | 2349 | counter->pending_disable = 0; |
2248 | perf_counter_disable(counter); | 2350 | __perf_counter_disable(counter); |
2249 | } | 2351 | } |
2250 | 2352 | ||
2251 | if (counter->pending_wakeup) { | 2353 | if (counter->pending_wakeup) { |
@@ -2630,7 +2732,80 @@ static u32 perf_counter_tid(struct perf_counter *counter, struct task_struct *p) | |||
2630 | return task_pid_nr_ns(p, counter->ns); | 2732 | return task_pid_nr_ns(p, counter->ns); |
2631 | } | 2733 | } |
2632 | 2734 | ||
2633 | static void perf_counter_output(struct perf_counter *counter, int nmi, | 2735 | static void perf_output_read_one(struct perf_output_handle *handle, |
2736 | struct perf_counter *counter) | ||
2737 | { | ||
2738 | u64 read_format = counter->attr.read_format; | ||
2739 | u64 values[4]; | ||
2740 | int n = 0; | ||
2741 | |||
2742 | values[n++] = atomic64_read(&counter->count); | ||
2743 | if (read_format & PERF_FORMAT_TOTAL_TIME_ENABLED) { | ||
2744 | values[n++] = counter->total_time_enabled + | ||
2745 | atomic64_read(&counter->child_total_time_enabled); | ||
2746 | } | ||
2747 | if (read_format & PERF_FORMAT_TOTAL_TIME_RUNNING) { | ||
2748 | values[n++] = counter->total_time_running + | ||
2749 | atomic64_read(&counter->child_total_time_running); | ||
2750 | } | ||
2751 | if (read_format & PERF_FORMAT_ID) | ||
2752 | values[n++] = primary_counter_id(counter); | ||
2753 | |||
2754 | perf_output_copy(handle, values, n * sizeof(u64)); | ||
2755 | } | ||
2756 | |||
2757 | /* | ||
2758 | * XXX PERF_FORMAT_GROUP vs inherited counters seems difficult. | ||
2759 | */ | ||
2760 | static void perf_output_read_group(struct perf_output_handle *handle, | ||
2761 | struct perf_counter *counter) | ||
2762 | { | ||
2763 | struct perf_counter *leader = counter->group_leader, *sub; | ||
2764 | u64 read_format = counter->attr.read_format; | ||
2765 | u64 values[5]; | ||
2766 | int n = 0; | ||
2767 | |||
2768 | values[n++] = 1 + leader->nr_siblings; | ||
2769 | |||
2770 | if (read_format & PERF_FORMAT_TOTAL_TIME_ENABLED) | ||
2771 | values[n++] = leader->total_time_enabled; | ||
2772 | |||
2773 | if (read_format & PERF_FORMAT_TOTAL_TIME_RUNNING) | ||
2774 | values[n++] = leader->total_time_running; | ||
2775 | |||
2776 | if (leader != counter) | ||
2777 | leader->pmu->read(leader); | ||
2778 | |||
2779 | values[n++] = atomic64_read(&leader->count); | ||
2780 | if (read_format & PERF_FORMAT_ID) | ||
2781 | values[n++] = primary_counter_id(leader); | ||
2782 | |||
2783 | perf_output_copy(handle, values, n * sizeof(u64)); | ||
2784 | |||
2785 | list_for_each_entry(sub, &leader->sibling_list, list_entry) { | ||
2786 | n = 0; | ||
2787 | |||
2788 | if (sub != counter) | ||
2789 | sub->pmu->read(sub); | ||
2790 | |||
2791 | values[n++] = atomic64_read(&sub->count); | ||
2792 | if (read_format & PERF_FORMAT_ID) | ||
2793 | values[n++] = primary_counter_id(sub); | ||
2794 | |||
2795 | perf_output_copy(handle, values, n * sizeof(u64)); | ||
2796 | } | ||
2797 | } | ||
2798 | |||
2799 | static void perf_output_read(struct perf_output_handle *handle, | ||
2800 | struct perf_counter *counter) | ||
2801 | { | ||
2802 | if (counter->attr.read_format & PERF_FORMAT_GROUP) | ||
2803 | perf_output_read_group(handle, counter); | ||
2804 | else | ||
2805 | perf_output_read_one(handle, counter); | ||
2806 | } | ||
2807 | |||
2808 | void perf_counter_output(struct perf_counter *counter, int nmi, | ||
2634 | struct perf_sample_data *data) | 2809 | struct perf_sample_data *data) |
2635 | { | 2810 | { |
2636 | int ret; | 2811 | int ret; |
@@ -2641,10 +2816,6 @@ static void perf_counter_output(struct perf_counter *counter, int nmi, | |||
2641 | struct { | 2816 | struct { |
2642 | u32 pid, tid; | 2817 | u32 pid, tid; |
2643 | } tid_entry; | 2818 | } tid_entry; |
2644 | struct { | ||
2645 | u64 id; | ||
2646 | u64 counter; | ||
2647 | } group_entry; | ||
2648 | struct perf_callchain_entry *callchain = NULL; | 2819 | struct perf_callchain_entry *callchain = NULL; |
2649 | int callchain_size = 0; | 2820 | int callchain_size = 0; |
2650 | u64 time; | 2821 | u64 time; |
@@ -2699,10 +2870,8 @@ static void perf_counter_output(struct perf_counter *counter, int nmi, | |||
2699 | if (sample_type & PERF_SAMPLE_PERIOD) | 2870 | if (sample_type & PERF_SAMPLE_PERIOD) |
2700 | header.size += sizeof(u64); | 2871 | header.size += sizeof(u64); |
2701 | 2872 | ||
2702 | if (sample_type & PERF_SAMPLE_GROUP) { | 2873 | if (sample_type & PERF_SAMPLE_READ) |
2703 | header.size += sizeof(u64) + | 2874 | header.size += perf_counter_read_size(counter); |
2704 | counter->nr_siblings * sizeof(group_entry); | ||
2705 | } | ||
2706 | 2875 | ||
2707 | if (sample_type & PERF_SAMPLE_CALLCHAIN) { | 2876 | if (sample_type & PERF_SAMPLE_CALLCHAIN) { |
2708 | callchain = perf_callchain(data->regs); | 2877 | callchain = perf_callchain(data->regs); |
@@ -2759,26 +2928,8 @@ static void perf_counter_output(struct perf_counter *counter, int nmi, | |||
2759 | if (sample_type & PERF_SAMPLE_PERIOD) | 2928 | if (sample_type & PERF_SAMPLE_PERIOD) |
2760 | perf_output_put(&handle, data->period); | 2929 | perf_output_put(&handle, data->period); |
2761 | 2930 | ||
2762 | /* | 2931 | if (sample_type & PERF_SAMPLE_READ) |
2763 | * XXX PERF_SAMPLE_GROUP vs inherited counters seems difficult. | 2932 | perf_output_read(&handle, counter); |
2764 | */ | ||
2765 | if (sample_type & PERF_SAMPLE_GROUP) { | ||
2766 | struct perf_counter *leader, *sub; | ||
2767 | u64 nr = counter->nr_siblings; | ||
2768 | |||
2769 | perf_output_put(&handle, nr); | ||
2770 | |||
2771 | leader = counter->group_leader; | ||
2772 | list_for_each_entry(sub, &leader->sibling_list, list_entry) { | ||
2773 | if (sub != counter) | ||
2774 | sub->pmu->read(sub); | ||
2775 | |||
2776 | group_entry.id = primary_counter_id(sub); | ||
2777 | group_entry.counter = atomic64_read(&sub->count); | ||
2778 | |||
2779 | perf_output_put(&handle, group_entry); | ||
2780 | } | ||
2781 | } | ||
2782 | 2933 | ||
2783 | if (sample_type & PERF_SAMPLE_CALLCHAIN) { | 2934 | if (sample_type & PERF_SAMPLE_CALLCHAIN) { |
2784 | if (callchain) | 2935 | if (callchain) |
@@ -2817,8 +2968,6 @@ struct perf_read_event { | |||
2817 | 2968 | ||
2818 | u32 pid; | 2969 | u32 pid; |
2819 | u32 tid; | 2970 | u32 tid; |
2820 | u64 value; | ||
2821 | u64 format[3]; | ||
2822 | }; | 2971 | }; |
2823 | 2972 | ||
2824 | static void | 2973 | static void |
@@ -2830,34 +2979,20 @@ perf_counter_read_event(struct perf_counter *counter, | |||
2830 | .header = { | 2979 | .header = { |
2831 | .type = PERF_EVENT_READ, | 2980 | .type = PERF_EVENT_READ, |
2832 | .misc = 0, | 2981 | .misc = 0, |
2833 | .size = sizeof(event) - sizeof(event.format), | 2982 | .size = sizeof(event) + perf_counter_read_size(counter), |
2834 | }, | 2983 | }, |
2835 | .pid = perf_counter_pid(counter, task), | 2984 | .pid = perf_counter_pid(counter, task), |
2836 | .tid = perf_counter_tid(counter, task), | 2985 | .tid = perf_counter_tid(counter, task), |
2837 | .value = atomic64_read(&counter->count), | ||
2838 | }; | 2986 | }; |
2839 | int ret, i = 0; | 2987 | int ret; |
2840 | |||
2841 | if (counter->attr.read_format & PERF_FORMAT_TOTAL_TIME_ENABLED) { | ||
2842 | event.header.size += sizeof(u64); | ||
2843 | event.format[i++] = counter->total_time_enabled; | ||
2844 | } | ||
2845 | |||
2846 | if (counter->attr.read_format & PERF_FORMAT_TOTAL_TIME_RUNNING) { | ||
2847 | event.header.size += sizeof(u64); | ||
2848 | event.format[i++] = counter->total_time_running; | ||
2849 | } | ||
2850 | |||
2851 | if (counter->attr.read_format & PERF_FORMAT_ID) { | ||
2852 | event.header.size += sizeof(u64); | ||
2853 | event.format[i++] = primary_counter_id(counter); | ||
2854 | } | ||
2855 | 2988 | ||
2856 | ret = perf_output_begin(&handle, counter, event.header.size, 0, 0); | 2989 | ret = perf_output_begin(&handle, counter, event.header.size, 0, 0); |
2857 | if (ret) | 2990 | if (ret) |
2858 | return; | 2991 | return; |
2859 | 2992 | ||
2860 | perf_output_copy(&handle, &event, event.header.size); | 2993 | perf_output_put(&handle, event); |
2994 | perf_output_read(&handle, counter); | ||
2995 | |||
2861 | perf_output_end(&handle); | 2996 | perf_output_end(&handle); |
2862 | } | 2997 | } |
2863 | 2998 | ||
@@ -2893,10 +3028,10 @@ static void perf_counter_task_output(struct perf_counter *counter, | |||
2893 | return; | 3028 | return; |
2894 | 3029 | ||
2895 | task_event->event.pid = perf_counter_pid(counter, task); | 3030 | task_event->event.pid = perf_counter_pid(counter, task); |
2896 | task_event->event.ppid = perf_counter_pid(counter, task->real_parent); | 3031 | task_event->event.ppid = perf_counter_pid(counter, current); |
2897 | 3032 | ||
2898 | task_event->event.tid = perf_counter_tid(counter, task); | 3033 | task_event->event.tid = perf_counter_tid(counter, task); |
2899 | task_event->event.ptid = perf_counter_tid(counter, task->real_parent); | 3034 | task_event->event.ptid = perf_counter_tid(counter, current); |
2900 | 3035 | ||
2901 | perf_output_put(&handle, task_event->event); | 3036 | perf_output_put(&handle, task_event->event); |
2902 | perf_output_end(&handle); | 3037 | perf_output_end(&handle); |
@@ -3443,40 +3578,32 @@ static void perf_swcounter_add(struct perf_counter *counter, u64 nr, | |||
3443 | 3578 | ||
3444 | static int perf_swcounter_is_counting(struct perf_counter *counter) | 3579 | static int perf_swcounter_is_counting(struct perf_counter *counter) |
3445 | { | 3580 | { |
3446 | struct perf_counter_context *ctx; | 3581 | /* |
3447 | unsigned long flags; | 3582 | * The counter is active, we're good! |
3448 | int count; | 3583 | */ |
3449 | |||
3450 | if (counter->state == PERF_COUNTER_STATE_ACTIVE) | 3584 | if (counter->state == PERF_COUNTER_STATE_ACTIVE) |
3451 | return 1; | 3585 | return 1; |
3452 | 3586 | ||
3587 | /* | ||
3588 | * The counter is off/error, not counting. | ||
3589 | */ | ||
3453 | if (counter->state != PERF_COUNTER_STATE_INACTIVE) | 3590 | if (counter->state != PERF_COUNTER_STATE_INACTIVE) |
3454 | return 0; | 3591 | return 0; |
3455 | 3592 | ||
3456 | /* | 3593 | /* |
3457 | * If the counter is inactive, it could be just because | 3594 | * The counter is inactive, if the context is active |
3458 | * its task is scheduled out, or because it's in a group | 3595 | * we're part of a group that didn't make it on the 'pmu', |
3459 | * which could not go on the PMU. We want to count in | 3596 | * not counting. |
3460 | * the first case but not the second. If the context is | ||
3461 | * currently active then an inactive software counter must | ||
3462 | * be the second case. If it's not currently active then | ||
3463 | * we need to know whether the counter was active when the | ||
3464 | * context was last active, which we can determine by | ||
3465 | * comparing counter->tstamp_stopped with ctx->time. | ||
3466 | * | ||
3467 | * We are within an RCU read-side critical section, | ||
3468 | * which protects the existence of *ctx. | ||
3469 | */ | 3597 | */ |
3470 | ctx = counter->ctx; | 3598 | if (counter->ctx->is_active) |
3471 | spin_lock_irqsave(&ctx->lock, flags); | 3599 | return 0; |
3472 | count = 1; | 3600 | |
3473 | /* Re-check state now we have the lock */ | 3601 | /* |
3474 | if (counter->state < PERF_COUNTER_STATE_INACTIVE || | 3602 | * We're inactive and the context is too, this means the |
3475 | counter->ctx->is_active || | 3603 | * task is scheduled out, we're counting events that happen |
3476 | counter->tstamp_stopped < ctx->time) | 3604 | * to us, like migration events. |
3477 | count = 0; | 3605 | */ |
3478 | spin_unlock_irqrestore(&ctx->lock, flags); | 3606 | return 1; |
3479 | return count; | ||
3480 | } | 3607 | } |
3481 | 3608 | ||
3482 | static int perf_swcounter_match(struct perf_counter *counter, | 3609 | static int perf_swcounter_match(struct perf_counter *counter, |
@@ -3928,9 +4055,9 @@ perf_counter_alloc(struct perf_counter_attr *attr, | |||
3928 | atomic64_set(&hwc->period_left, hwc->sample_period); | 4055 | atomic64_set(&hwc->period_left, hwc->sample_period); |
3929 | 4056 | ||
3930 | /* | 4057 | /* |
3931 | * we currently do not support PERF_SAMPLE_GROUP on inherited counters | 4058 | * we currently do not support PERF_FORMAT_GROUP on inherited counters |
3932 | */ | 4059 | */ |
3933 | if (attr->inherit && (attr->sample_type & PERF_SAMPLE_GROUP)) | 4060 | if (attr->inherit && (attr->read_format & PERF_FORMAT_GROUP)) |
3934 | goto done; | 4061 | goto done; |
3935 | 4062 | ||
3936 | switch (attr->type) { | 4063 | switch (attr->type) { |
@@ -4592,6 +4719,11 @@ perf_cpu_notify(struct notifier_block *self, unsigned long action, void *hcpu) | |||
4592 | perf_counter_init_cpu(cpu); | 4719 | perf_counter_init_cpu(cpu); |
4593 | break; | 4720 | break; |
4594 | 4721 | ||
4722 | case CPU_ONLINE: | ||
4723 | case CPU_ONLINE_FROZEN: | ||
4724 | hw_perf_counter_setup_online(cpu); | ||
4725 | break; | ||
4726 | |||
4595 | case CPU_DOWN_PREPARE: | 4727 | case CPU_DOWN_PREPARE: |
4596 | case CPU_DOWN_PREPARE_FROZEN: | 4728 | case CPU_DOWN_PREPARE_FROZEN: |
4597 | perf_counter_exit_cpu(cpu); | 4729 | perf_counter_exit_cpu(cpu); |
@@ -4616,6 +4748,8 @@ void __init perf_counter_init(void) | |||
4616 | { | 4748 | { |
4617 | perf_cpu_notify(&perf_cpu_nb, (unsigned long)CPU_UP_PREPARE, | 4749 | perf_cpu_notify(&perf_cpu_nb, (unsigned long)CPU_UP_PREPARE, |
4618 | (void *)(long)smp_processor_id()); | 4750 | (void *)(long)smp_processor_id()); |
4751 | perf_cpu_notify(&perf_cpu_nb, (unsigned long)CPU_ONLINE, | ||
4752 | (void *)(long)smp_processor_id()); | ||
4619 | register_cpu_notifier(&perf_cpu_nb); | 4753 | register_cpu_notifier(&perf_cpu_nb); |
4620 | } | 4754 | } |
4621 | 4755 | ||
diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c index 1090b0aed9ba..7a34cb563fec 100644 --- a/kernel/trace/blktrace.c +++ b/kernel/trace/blktrace.c | |||
@@ -267,8 +267,8 @@ static void blk_trace_free(struct blk_trace *bt) | |||
267 | { | 267 | { |
268 | debugfs_remove(bt->msg_file); | 268 | debugfs_remove(bt->msg_file); |
269 | debugfs_remove(bt->dropped_file); | 269 | debugfs_remove(bt->dropped_file); |
270 | debugfs_remove(bt->dir); | ||
271 | relay_close(bt->rchan); | 270 | relay_close(bt->rchan); |
271 | debugfs_remove(bt->dir); | ||
272 | free_percpu(bt->sequence); | 272 | free_percpu(bt->sequence); |
273 | free_percpu(bt->msg_data); | 273 | free_percpu(bt->msg_data); |
274 | kfree(bt); | 274 | kfree(bt); |
@@ -378,18 +378,8 @@ static int blk_subbuf_start_callback(struct rchan_buf *buf, void *subbuf, | |||
378 | 378 | ||
379 | static int blk_remove_buf_file_callback(struct dentry *dentry) | 379 | static int blk_remove_buf_file_callback(struct dentry *dentry) |
380 | { | 380 | { |
381 | struct dentry *parent = dentry->d_parent; | ||
382 | debugfs_remove(dentry); | 381 | debugfs_remove(dentry); |
383 | 382 | ||
384 | /* | ||
385 | * this will fail for all but the last file, but that is ok. what we | ||
386 | * care about is the top level buts->name directory going away, when | ||
387 | * the last trace file is gone. Then we don't have to rmdir() that | ||
388 | * manually on trace stop, so it nicely solves the issue with | ||
389 | * force killing of running traces. | ||
390 | */ | ||
391 | |||
392 | debugfs_remove(parent); | ||
393 | return 0; | 383 | return 0; |
394 | } | 384 | } |
395 | 385 | ||
diff --git a/kernel/wait.c b/kernel/wait.c index ea7c3b4275cf..c4bd3d825f35 100644 --- a/kernel/wait.c +++ b/kernel/wait.c | |||
@@ -10,13 +10,14 @@ | |||
10 | #include <linux/wait.h> | 10 | #include <linux/wait.h> |
11 | #include <linux/hash.h> | 11 | #include <linux/hash.h> |
12 | 12 | ||
13 | void init_waitqueue_head(wait_queue_head_t *q) | 13 | void __init_waitqueue_head(wait_queue_head_t *q, struct lock_class_key *key) |
14 | { | 14 | { |
15 | spin_lock_init(&q->lock); | 15 | spin_lock_init(&q->lock); |
16 | lockdep_set_class(&q->lock, key); | ||
16 | INIT_LIST_HEAD(&q->task_list); | 17 | INIT_LIST_HEAD(&q->task_list); |
17 | } | 18 | } |
18 | 19 | ||
19 | EXPORT_SYMBOL(init_waitqueue_head); | 20 | EXPORT_SYMBOL(__init_waitqueue_head); |
20 | 21 | ||
21 | void add_wait_queue(wait_queue_head_t *q, wait_queue_t *wait) | 22 | void add_wait_queue(wait_queue_head_t *q, wait_queue_t *wait) |
22 | { | 23 | { |
diff --git a/net/socket.c b/net/socket.c index 791d71a36a93..6d4716559047 100644 --- a/net/socket.c +++ b/net/socket.c | |||
@@ -736,7 +736,7 @@ static ssize_t sock_sendpage(struct file *file, struct page *page, | |||
736 | if (more) | 736 | if (more) |
737 | flags |= MSG_MORE; | 737 | flags |= MSG_MORE; |
738 | 738 | ||
739 | return sock->ops->sendpage(sock, page, offset, size, flags); | 739 | return kernel_sendpage(sock, page, offset, size, flags); |
740 | } | 740 | } |
741 | 741 | ||
742 | static ssize_t sock_splice_read(struct file *file, loff_t *ppos, | 742 | static ssize_t sock_splice_read(struct file *file, loff_t *ppos, |
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c index 15c2a08a66f1..1e8cfc4c2ed6 100644 --- a/security/selinux/hooks.c +++ b/security/selinux/hooks.c | |||
@@ -1285,6 +1285,8 @@ static int inode_doinit_with_dentry(struct inode *inode, struct dentry *opt_dent | |||
1285 | rc = inode->i_op->getxattr(dentry, XATTR_NAME_SELINUX, | 1285 | rc = inode->i_op->getxattr(dentry, XATTR_NAME_SELINUX, |
1286 | context, len); | 1286 | context, len); |
1287 | if (rc == -ERANGE) { | 1287 | if (rc == -ERANGE) { |
1288 | kfree(context); | ||
1289 | |||
1288 | /* Need a larger buffer. Query for the right size. */ | 1290 | /* Need a larger buffer. Query for the right size. */ |
1289 | rc = inode->i_op->getxattr(dentry, XATTR_NAME_SELINUX, | 1291 | rc = inode->i_op->getxattr(dentry, XATTR_NAME_SELINUX, |
1290 | NULL, 0); | 1292 | NULL, 0); |
@@ -1292,7 +1294,6 @@ static int inode_doinit_with_dentry(struct inode *inode, struct dentry *opt_dent | |||
1292 | dput(dentry); | 1294 | dput(dentry); |
1293 | goto out_unlock; | 1295 | goto out_unlock; |
1294 | } | 1296 | } |
1295 | kfree(context); | ||
1296 | len = rc; | 1297 | len = rc; |
1297 | context = kmalloc(len+1, GFP_NOFS); | 1298 | context = kmalloc(len+1, GFP_NOFS); |
1298 | if (!context) { | 1299 | if (!context) { |
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 51c44fdbc0f0..fea976793ae5 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
@@ -13563,6 +13563,8 @@ static int patch_alc269(struct hda_codec *codec) | |||
13563 | set_capture_mixer(spec); | 13563 | set_capture_mixer(spec); |
13564 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); | 13564 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); |
13565 | 13565 | ||
13566 | spec->vmaster_nid = 0x02; | ||
13567 | |||
13566 | codec->patch_ops = alc_patch_ops; | 13568 | codec->patch_ops = alc_patch_ops; |
13567 | if (board_config == ALC269_AUTO) | 13569 | if (board_config == ALC269_AUTO) |
13568 | spec->init_hook = alc269_auto_init; | 13570 | spec->init_hook = alc269_auto_init; |
@@ -15577,9 +15579,12 @@ static int patch_alc861vd(struct hda_codec *codec) | |||
15577 | spec->stream_digital_playback = &alc861vd_pcm_digital_playback; | 15579 | spec->stream_digital_playback = &alc861vd_pcm_digital_playback; |
15578 | spec->stream_digital_capture = &alc861vd_pcm_digital_capture; | 15580 | spec->stream_digital_capture = &alc861vd_pcm_digital_capture; |
15579 | 15581 | ||
15580 | spec->adc_nids = alc861vd_adc_nids; | 15582 | if (!spec->adc_nids) { |
15581 | spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids); | 15583 | spec->adc_nids = alc861vd_adc_nids; |
15582 | spec->capsrc_nids = alc861vd_capsrc_nids; | 15584 | spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids); |
15585 | } | ||
15586 | if (!spec->capsrc_nids) | ||
15587 | spec->capsrc_nids = alc861vd_capsrc_nids; | ||
15583 | 15588 | ||
15584 | set_capture_mixer(spec); | 15589 | set_capture_mixer(spec); |
15585 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); | 15590 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
@@ -17496,9 +17501,12 @@ static int patch_alc662(struct hda_codec *codec) | |||
17496 | spec->stream_digital_playback = &alc662_pcm_digital_playback; | 17501 | spec->stream_digital_playback = &alc662_pcm_digital_playback; |
17497 | spec->stream_digital_capture = &alc662_pcm_digital_capture; | 17502 | spec->stream_digital_capture = &alc662_pcm_digital_capture; |
17498 | 17503 | ||
17499 | spec->adc_nids = alc662_adc_nids; | 17504 | if (!spec->adc_nids) { |
17500 | spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids); | 17505 | spec->adc_nids = alc662_adc_nids; |
17501 | spec->capsrc_nids = alc662_capsrc_nids; | 17506 | spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids); |
17507 | } | ||
17508 | if (!spec->capsrc_nids) | ||
17509 | spec->capsrc_nids = alc662_capsrc_nids; | ||
17502 | 17510 | ||
17503 | if (!spec->cap_mixer) | 17511 | if (!spec->cap_mixer) |
17504 | set_capture_mixer(spec); | 17512 | set_capture_mixer(spec); |
diff --git a/sound/soc/fsl/efika-audio-fabric.c b/sound/soc/fsl/efika-audio-fabric.c index 85b0e7569504..3326e2a1e863 100644 --- a/sound/soc/fsl/efika-audio-fabric.c +++ b/sound/soc/fsl/efika-audio-fabric.c | |||
@@ -30,6 +30,8 @@ | |||
30 | #include "mpc5200_psc_ac97.h" | 30 | #include "mpc5200_psc_ac97.h" |
31 | #include "../codecs/stac9766.h" | 31 | #include "../codecs/stac9766.h" |
32 | 32 | ||
33 | #define DRV_NAME "efika-audio-fabric" | ||
34 | |||
33 | static struct snd_soc_device device; | 35 | static struct snd_soc_device device; |
34 | static struct snd_soc_card card; | 36 | static struct snd_soc_card card; |
35 | 37 | ||
diff --git a/sound/soc/fsl/pcm030-audio-fabric.c b/sound/soc/fsl/pcm030-audio-fabric.c index 8766f7a3893d..b928ef7d28eb 100644 --- a/sound/soc/fsl/pcm030-audio-fabric.c +++ b/sound/soc/fsl/pcm030-audio-fabric.c | |||
@@ -30,6 +30,8 @@ | |||
30 | #include "mpc5200_psc_ac97.h" | 30 | #include "mpc5200_psc_ac97.h" |
31 | #include "../codecs/wm9712.h" | 31 | #include "../codecs/wm9712.h" |
32 | 32 | ||
33 | #define DRV_NAME "pcm030-audio-fabric" | ||
34 | |||
33 | static struct snd_soc_device device; | 35 | static struct snd_soc_device device; |
34 | static struct snd_soc_card card; | 36 | static struct snd_soc_card card; |
35 | 37 | ||
diff --git a/tools/perf/Makefile b/tools/perf/Makefile index 60411e94113b..c045b4271e57 100644 --- a/tools/perf/Makefile +++ b/tools/perf/Makefile | |||
@@ -382,22 +382,29 @@ endif | |||
382 | ifdef NO_DEMANGLE | 382 | ifdef NO_DEMANGLE |
383 | BASIC_CFLAGS += -DNO_DEMANGLE | 383 | BASIC_CFLAGS += -DNO_DEMANGLE |
384 | else | 384 | else |
385 | |||
386 | has_bfd := $(shell sh -c "(echo '\#include <bfd.h>'; echo 'int main(void) { bfd_demangle(0, 0, 0); return 0; }') | $(CC) -x c - $(ALL_CFLAGS) -o /dev/null $(ALL_LDFLAGS) -lbfd > /dev/null 2>&1 && echo y") | 385 | has_bfd := $(shell sh -c "(echo '\#include <bfd.h>'; echo 'int main(void) { bfd_demangle(0, 0, 0); return 0; }') | $(CC) -x c - $(ALL_CFLAGS) -o /dev/null $(ALL_LDFLAGS) -lbfd > /dev/null 2>&1 && echo y") |
387 | 386 | ||
388 | has_bfd_iberty := $(shell sh -c "(echo '\#include <bfd.h>'; echo 'int main(void) { bfd_demangle(0, 0, 0); return 0; }') | $(CC) -x c - $(ALL_CFLAGS) -o /dev/null $(ALL_LDFLAGS) -lbfd -liberty > /dev/null 2>&1 && echo y") | ||
389 | |||
390 | has_bfd_iberty_z := $(shell sh -c "(echo '\#include <bfd.h>'; echo 'int main(void) { bfd_demangle(0, 0, 0); return 0; }') | $(CC) -x c - $(ALL_CFLAGS) -o /dev/null $(ALL_LDFLAGS) -lbfd -liberty -lz > /dev/null 2>&1 && echo y") | ||
391 | |||
392 | ifeq ($(has_bfd),y) | 387 | ifeq ($(has_bfd),y) |
393 | EXTLIBS += -lbfd | 388 | EXTLIBS += -lbfd |
394 | else ifeq ($(has_bfd_iberty),y) | ||
395 | EXTLIBS += -lbfd -liberty | ||
396 | else ifeq ($(has_bfd_iberty_z),y) | ||
397 | EXTLIBS += -lbfd -liberty -lz | ||
398 | else | 389 | else |
399 | msg := $(warning No bfd.h/libbfd found, install binutils-dev[el] to gain symbol demangling) | 390 | has_bfd_iberty := $(shell sh -c "(echo '\#include <bfd.h>'; echo 'int main(void) { bfd_demangle(0, 0, 0); return 0; }') | $(CC) -x c - $(ALL_CFLAGS) -o /dev/null $(ALL_LDFLAGS) -lbfd -liberty > /dev/null 2>&1 && echo y") |
400 | BASIC_CFLAGS += -DNO_DEMANGLE | 391 | ifeq ($(has_bfd_iberty),y) |
392 | EXTLIBS += -lbfd -liberty | ||
393 | else | ||
394 | has_bfd_iberty_z := $(shell sh -c "(echo '\#include <bfd.h>'; echo 'int main(void) { bfd_demangle(0, 0, 0); return 0; }') | $(CC) -x c - $(ALL_CFLAGS) -o /dev/null $(ALL_LDFLAGS) -lbfd -liberty -lz > /dev/null 2>&1 && echo y") | ||
395 | ifeq ($(has_bfd_iberty_z),y) | ||
396 | EXTLIBS += -lbfd -liberty -lz | ||
397 | else | ||
398 | has_cplus_demangle := $(shell sh -c "(echo 'extern char *cplus_demangle(const char *, int);'; echo 'int main(void) { cplus_demangle(0, 0); return 0; }') | $(CC) -x c - $(ALL_CFLAGS) -o /dev/null $(ALL_LDFLAGS) -liberty > /dev/null 2>&1 && echo y") | ||
399 | ifeq ($(has_cplus_demangle),y) | ||
400 | EXTLIBS += -liberty | ||
401 | BASIC_CFLAGS += -DHAVE_CPLUS_DEMANGLE | ||
402 | else | ||
403 | msg := $(warning No bfd.h/libbfd found, install binutils-dev[el] to gain symbol demangling) | ||
404 | BASIC_CFLAGS += -DNO_DEMANGLE | ||
405 | endif | ||
406 | endif | ||
407 | endif | ||
401 | endif | 408 | endif |
402 | endif | 409 | endif |
403 | 410 | ||
diff --git a/tools/perf/builtin-list.c b/tools/perf/builtin-list.c index f990fa8a35c9..d88c6961274c 100644 --- a/tools/perf/builtin-list.c +++ b/tools/perf/builtin-list.c | |||
@@ -10,11 +10,12 @@ | |||
10 | 10 | ||
11 | #include "perf.h" | 11 | #include "perf.h" |
12 | 12 | ||
13 | #include "util/parse-options.h" | ||
14 | #include "util/parse-events.h" | 13 | #include "util/parse-events.h" |
14 | #include "util/cache.h" | ||
15 | 15 | ||
16 | int cmd_list(int argc __used, const char **argv __used, const char *prefix __used) | 16 | int cmd_list(int argc __used, const char **argv __used, const char *prefix __used) |
17 | { | 17 | { |
18 | setup_pager(); | ||
18 | print_events(); | 19 | print_events(); |
19 | return 0; | 20 | return 0; |
20 | } | 21 | } |
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c index 0345aad8eba5..3d051b9cf25f 100644 --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c | |||
@@ -34,7 +34,9 @@ static int output; | |||
34 | static const char *output_name = "perf.data"; | 34 | static const char *output_name = "perf.data"; |
35 | static int group = 0; | 35 | static int group = 0; |
36 | static unsigned int realtime_prio = 0; | 36 | static unsigned int realtime_prio = 0; |
37 | static int raw_samples = 0; | ||
37 | static int system_wide = 0; | 38 | static int system_wide = 0; |
39 | static int profile_cpu = -1; | ||
38 | static pid_t target_pid = -1; | 40 | static pid_t target_pid = -1; |
39 | static int inherit = 1; | 41 | static int inherit = 1; |
40 | static int force = 0; | 42 | static int force = 0; |
@@ -203,46 +205,48 @@ static void sig_atexit(void) | |||
203 | kill(getpid(), signr); | 205 | kill(getpid(), signr); |
204 | } | 206 | } |
205 | 207 | ||
206 | static void pid_synthesize_comm_event(pid_t pid, int full) | 208 | static pid_t pid_synthesize_comm_event(pid_t pid, int full) |
207 | { | 209 | { |
208 | struct comm_event comm_ev; | 210 | struct comm_event comm_ev; |
209 | char filename[PATH_MAX]; | 211 | char filename[PATH_MAX]; |
210 | char bf[BUFSIZ]; | 212 | char bf[BUFSIZ]; |
211 | int fd; | 213 | FILE *fp; |
212 | size_t size; | 214 | size_t size = 0; |
213 | char *field, *sep; | ||
214 | DIR *tasks; | 215 | DIR *tasks; |
215 | struct dirent dirent, *next; | 216 | struct dirent dirent, *next; |
217 | pid_t tgid = 0; | ||
216 | 218 | ||
217 | snprintf(filename, sizeof(filename), "/proc/%d/stat", pid); | 219 | snprintf(filename, sizeof(filename), "/proc/%d/status", pid); |
218 | 220 | ||
219 | fd = open(filename, O_RDONLY); | 221 | fp = fopen(filename, "r"); |
220 | if (fd < 0) { | 222 | if (fd == NULL) { |
221 | /* | 223 | /* |
222 | * We raced with a task exiting - just return: | 224 | * We raced with a task exiting - just return: |
223 | */ | 225 | */ |
224 | if (verbose) | 226 | if (verbose) |
225 | fprintf(stderr, "couldn't open %s\n", filename); | 227 | fprintf(stderr, "couldn't open %s\n", filename); |
226 | return; | 228 | return 0; |
227 | } | ||
228 | if (read(fd, bf, sizeof(bf)) < 0) { | ||
229 | fprintf(stderr, "couldn't read %s\n", filename); | ||
230 | exit(EXIT_FAILURE); | ||
231 | } | 229 | } |
232 | close(fd); | ||
233 | 230 | ||
234 | /* 9027 (cat) R 6747 9027 6747 34816 9027 ... */ | ||
235 | memset(&comm_ev, 0, sizeof(comm_ev)); | 231 | memset(&comm_ev, 0, sizeof(comm_ev)); |
236 | field = strchr(bf, '('); | 232 | while (!comm_ev.comm[0] || !comm_ev.pid) { |
237 | if (field == NULL) | 233 | if (fgets(bf, sizeof(bf), fp) == NULL) |
238 | goto out_failure; | 234 | goto out_failure; |
239 | sep = strchr(++field, ')'); | 235 | |
240 | if (sep == NULL) | 236 | if (memcmp(bf, "Name:", 5) == 0) { |
241 | goto out_failure; | 237 | char *name = bf + 5; |
242 | size = sep - field; | 238 | while (*name && isspace(*name)) |
243 | memcpy(comm_ev.comm, field, size++); | 239 | ++name; |
244 | 240 | size = strlen(name) - 1; | |
245 | comm_ev.pid = pid; | 241 | memcpy(comm_ev.comm, name, size++); |
242 | } else if (memcmp(bf, "Tgid:", 5) == 0) { | ||
243 | char *tgids = bf + 5; | ||
244 | while (*tgids && isspace(*tgids)) | ||
245 | ++tgids; | ||
246 | tgid = comm_ev.pid = atoi(tgids); | ||
247 | } | ||
248 | } | ||
249 | |||
246 | comm_ev.header.type = PERF_EVENT_COMM; | 250 | comm_ev.header.type = PERF_EVENT_COMM; |
247 | size = ALIGN(size, sizeof(u64)); | 251 | size = ALIGN(size, sizeof(u64)); |
248 | comm_ev.header.size = sizeof(comm_ev) - (sizeof(comm_ev.comm) - size); | 252 | comm_ev.header.size = sizeof(comm_ev) - (sizeof(comm_ev.comm) - size); |
@@ -251,7 +255,7 @@ static void pid_synthesize_comm_event(pid_t pid, int full) | |||
251 | comm_ev.tid = pid; | 255 | comm_ev.tid = pid; |
252 | 256 | ||
253 | write_output(&comm_ev, comm_ev.header.size); | 257 | write_output(&comm_ev, comm_ev.header.size); |
254 | return; | 258 | goto out_fclose; |
255 | } | 259 | } |
256 | 260 | ||
257 | snprintf(filename, sizeof(filename), "/proc/%d/task", pid); | 261 | snprintf(filename, sizeof(filename), "/proc/%d/task", pid); |
@@ -268,7 +272,10 @@ static void pid_synthesize_comm_event(pid_t pid, int full) | |||
268 | write_output(&comm_ev, comm_ev.header.size); | 272 | write_output(&comm_ev, comm_ev.header.size); |
269 | } | 273 | } |
270 | closedir(tasks); | 274 | closedir(tasks); |
271 | return; | 275 | |
276 | out_fclose: | ||
277 | fclose(fp); | ||
278 | return tgid; | ||
272 | 279 | ||
273 | out_failure: | 280 | out_failure: |
274 | fprintf(stderr, "couldn't get COMM and pgid, malformed %s\n", | 281 | fprintf(stderr, "couldn't get COMM and pgid, malformed %s\n", |
@@ -276,7 +283,7 @@ out_failure: | |||
276 | exit(EXIT_FAILURE); | 283 | exit(EXIT_FAILURE); |
277 | } | 284 | } |
278 | 285 | ||
279 | static void pid_synthesize_mmap_samples(pid_t pid) | 286 | static void pid_synthesize_mmap_samples(pid_t pid, pid_t tgid) |
280 | { | 287 | { |
281 | char filename[PATH_MAX]; | 288 | char filename[PATH_MAX]; |
282 | FILE *fp; | 289 | FILE *fp; |
@@ -328,7 +335,7 @@ static void pid_synthesize_mmap_samples(pid_t pid) | |||
328 | mmap_ev.len -= mmap_ev.start; | 335 | mmap_ev.len -= mmap_ev.start; |
329 | mmap_ev.header.size = (sizeof(mmap_ev) - | 336 | mmap_ev.header.size = (sizeof(mmap_ev) - |
330 | (sizeof(mmap_ev.filename) - size)); | 337 | (sizeof(mmap_ev.filename) - size)); |
331 | mmap_ev.pid = pid; | 338 | mmap_ev.pid = tgid; |
332 | mmap_ev.tid = pid; | 339 | mmap_ev.tid = pid; |
333 | 340 | ||
334 | write_output(&mmap_ev, mmap_ev.header.size); | 341 | write_output(&mmap_ev, mmap_ev.header.size); |
@@ -347,14 +354,14 @@ static void synthesize_all(void) | |||
347 | 354 | ||
348 | while (!readdir_r(proc, &dirent, &next) && next) { | 355 | while (!readdir_r(proc, &dirent, &next) && next) { |
349 | char *end; | 356 | char *end; |
350 | pid_t pid; | 357 | pid_t pid, tgid; |
351 | 358 | ||
352 | pid = strtol(dirent.d_name, &end, 10); | 359 | pid = strtol(dirent.d_name, &end, 10); |
353 | if (*end) /* only interested in proper numerical dirents */ | 360 | if (*end) /* only interested in proper numerical dirents */ |
354 | continue; | 361 | continue; |
355 | 362 | ||
356 | pid_synthesize_comm_event(pid, 1); | 363 | tgid = pid_synthesize_comm_event(pid, 1); |
357 | pid_synthesize_mmap_samples(pid); | 364 | pid_synthesize_mmap_samples(pid, tgid); |
358 | } | 365 | } |
359 | 366 | ||
360 | closedir(proc); | 367 | closedir(proc); |
@@ -392,7 +399,7 @@ static void create_counter(int counter, int cpu, pid_t pid) | |||
392 | PERF_FORMAT_TOTAL_TIME_RUNNING | | 399 | PERF_FORMAT_TOTAL_TIME_RUNNING | |
393 | PERF_FORMAT_ID; | 400 | PERF_FORMAT_ID; |
394 | 401 | ||
395 | attr->sample_type = PERF_SAMPLE_IP | PERF_SAMPLE_TID; | 402 | attr->sample_type |= PERF_SAMPLE_IP | PERF_SAMPLE_TID; |
396 | 403 | ||
397 | if (freq) { | 404 | if (freq) { |
398 | attr->sample_type |= PERF_SAMPLE_PERIOD; | 405 | attr->sample_type |= PERF_SAMPLE_PERIOD; |
@@ -412,6 +419,8 @@ static void create_counter(int counter, int cpu, pid_t pid) | |||
412 | if (call_graph) | 419 | if (call_graph) |
413 | attr->sample_type |= PERF_SAMPLE_CALLCHAIN; | 420 | attr->sample_type |= PERF_SAMPLE_CALLCHAIN; |
414 | 421 | ||
422 | if (raw_samples) | ||
423 | attr->sample_type |= PERF_SAMPLE_RAW; | ||
415 | 424 | ||
416 | attr->mmap = track; | 425 | attr->mmap = track; |
417 | attr->comm = track; | 426 | attr->comm = track; |
@@ -426,6 +435,8 @@ try_again: | |||
426 | 435 | ||
427 | if (err == EPERM) | 436 | if (err == EPERM) |
428 | die("Permission error - are you root?\n"); | 437 | die("Permission error - are you root?\n"); |
438 | else if (err == ENODEV && profile_cpu != -1) | ||
439 | die("No such device - did you specify an out-of-range profile CPU?\n"); | ||
429 | 440 | ||
430 | /* | 441 | /* |
431 | * If it's cycles then fall back to hrtimer | 442 | * If it's cycles then fall back to hrtimer |
@@ -559,16 +570,22 @@ static int __cmd_record(int argc, const char **argv) | |||
559 | if (pid == -1) | 570 | if (pid == -1) |
560 | pid = getpid(); | 571 | pid = getpid(); |
561 | 572 | ||
562 | open_counters(-1, pid); | 573 | open_counters(profile_cpu, pid); |
563 | } else for (i = 0; i < nr_cpus; i++) | 574 | } else { |
564 | open_counters(i, target_pid); | 575 | if (profile_cpu != -1) { |
576 | open_counters(profile_cpu, target_pid); | ||
577 | } else { | ||
578 | for (i = 0; i < nr_cpus; i++) | ||
579 | open_counters(i, target_pid); | ||
580 | } | ||
581 | } | ||
565 | 582 | ||
566 | if (file_new) | 583 | if (file_new) |
567 | perf_header__write(header, output); | 584 | perf_header__write(header, output); |
568 | 585 | ||
569 | if (!system_wide) { | 586 | if (!system_wide) { |
570 | pid_synthesize_comm_event(pid, 0); | 587 | pid_t tgid = pid_synthesize_comm_event(pid, 0); |
571 | pid_synthesize_mmap_samples(pid); | 588 | pid_synthesize_mmap_samples(pid, tgid); |
572 | } else | 589 | } else |
573 | synthesize_all(); | 590 | synthesize_all(); |
574 | 591 | ||
@@ -636,10 +653,14 @@ static const struct option options[] = { | |||
636 | "record events on existing pid"), | 653 | "record events on existing pid"), |
637 | OPT_INTEGER('r', "realtime", &realtime_prio, | 654 | OPT_INTEGER('r', "realtime", &realtime_prio, |
638 | "collect data with this RT SCHED_FIFO priority"), | 655 | "collect data with this RT SCHED_FIFO priority"), |
656 | OPT_BOOLEAN('R', "raw-samples", &raw_samples, | ||
657 | "collect raw sample records from all opened counters"), | ||
639 | OPT_BOOLEAN('a', "all-cpus", &system_wide, | 658 | OPT_BOOLEAN('a', "all-cpus", &system_wide, |
640 | "system-wide collection from all CPUs"), | 659 | "system-wide collection from all CPUs"), |
641 | OPT_BOOLEAN('A', "append", &append_file, | 660 | OPT_BOOLEAN('A', "append", &append_file, |
642 | "append to the output file to do incremental profiling"), | 661 | "append to the output file to do incremental profiling"), |
662 | OPT_INTEGER('C', "profile_cpu", &profile_cpu, | ||
663 | "CPU to profile on"), | ||
643 | OPT_BOOLEAN('f', "force", &force, | 664 | OPT_BOOLEAN('f', "force", &force, |
644 | "overwrite existing data file"), | 665 | "overwrite existing data file"), |
645 | OPT_LONG('c', "count", &default_interval, | 666 | OPT_LONG('c', "count", &default_interval, |
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c index 99274cec0adb..b53a60fc12de 100644 --- a/tools/perf/builtin-report.c +++ b/tools/perf/builtin-report.c | |||
@@ -1526,11 +1526,11 @@ process_sample_event(event_t *event, unsigned long offset, unsigned long head) | |||
1526 | more_data += sizeof(u64); | 1526 | more_data += sizeof(u64); |
1527 | } | 1527 | } |
1528 | 1528 | ||
1529 | dprintf("%p [%p]: PERF_EVENT_SAMPLE (IP, %d): %d: %p period: %Ld\n", | 1529 | dprintf("%p [%p]: PERF_EVENT_SAMPLE (IP, %d): %d/%d: %p period: %Ld\n", |
1530 | (void *)(offset + head), | 1530 | (void *)(offset + head), |
1531 | (void *)(long)(event->header.size), | 1531 | (void *)(long)(event->header.size), |
1532 | event->header.misc, | 1532 | event->header.misc, |
1533 | event->ip.pid, | 1533 | event->ip.pid, event->ip.tid, |
1534 | (void *)(long)ip, | 1534 | (void *)(long)ip, |
1535 | (long long)period); | 1535 | (long long)period); |
1536 | 1536 | ||
@@ -1590,10 +1590,11 @@ process_sample_event(event_t *event, unsigned long offset, unsigned long head) | |||
1590 | if (show & show_mask) { | 1590 | if (show & show_mask) { |
1591 | struct symbol *sym = resolve_symbol(thread, &map, &dso, &ip); | 1591 | struct symbol *sym = resolve_symbol(thread, &map, &dso, &ip); |
1592 | 1592 | ||
1593 | if (dso_list && dso && dso->name && !strlist__has_entry(dso_list, dso->name)) | 1593 | if (dso_list && (!dso || !dso->name || |
1594 | !strlist__has_entry(dso_list, dso->name))) | ||
1594 | return 0; | 1595 | return 0; |
1595 | 1596 | ||
1596 | if (sym_list && sym && !strlist__has_entry(sym_list, sym->name)) | 1597 | if (sym_list && (!sym || !strlist__has_entry(sym_list, sym->name))) |
1597 | return 0; | 1598 | return 0; |
1598 | 1599 | ||
1599 | if (hist_entry__add(thread, map, dso, sym, ip, chain, level, period)) { | 1600 | if (hist_entry__add(thread, map, dso, sym, ip, chain, level, period)) { |
@@ -1612,10 +1613,11 @@ process_mmap_event(event_t *event, unsigned long offset, unsigned long head) | |||
1612 | struct thread *thread = threads__findnew(event->mmap.pid); | 1613 | struct thread *thread = threads__findnew(event->mmap.pid); |
1613 | struct map *map = map__new(&event->mmap); | 1614 | struct map *map = map__new(&event->mmap); |
1614 | 1615 | ||
1615 | dprintf("%p [%p]: PERF_EVENT_MMAP %d: [%p(%p) @ %p]: %s\n", | 1616 | dprintf("%p [%p]: PERF_EVENT_MMAP %d/%d: [%p(%p) @ %p]: %s\n", |
1616 | (void *)(offset + head), | 1617 | (void *)(offset + head), |
1617 | (void *)(long)(event->header.size), | 1618 | (void *)(long)(event->header.size), |
1618 | event->mmap.pid, | 1619 | event->mmap.pid, |
1620 | event->mmap.tid, | ||
1619 | (void *)(long)event->mmap.start, | 1621 | (void *)(long)event->mmap.start, |
1620 | (void *)(long)event->mmap.len, | 1622 | (void *)(long)event->mmap.len, |
1621 | (void *)(long)event->mmap.pgoff, | 1623 | (void *)(long)event->mmap.pgoff, |
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c index 4858d83b3b67..044178408783 100644 --- a/tools/perf/util/parse-events.c +++ b/tools/perf/util/parse-events.c | |||
@@ -379,6 +379,7 @@ static int parse_tracepoint_event(const char **strp, | |||
379 | struct perf_counter_attr *attr) | 379 | struct perf_counter_attr *attr) |
380 | { | 380 | { |
381 | const char *evt_name; | 381 | const char *evt_name; |
382 | char *flags; | ||
382 | char sys_name[MAX_EVENT_LENGTH]; | 383 | char sys_name[MAX_EVENT_LENGTH]; |
383 | char id_buf[4]; | 384 | char id_buf[4]; |
384 | int fd; | 385 | int fd; |
@@ -400,6 +401,15 @@ static int parse_tracepoint_event(const char **strp, | |||
400 | strncpy(sys_name, *strp, sys_length); | 401 | strncpy(sys_name, *strp, sys_length); |
401 | sys_name[sys_length] = '\0'; | 402 | sys_name[sys_length] = '\0'; |
402 | evt_name = evt_name + 1; | 403 | evt_name = evt_name + 1; |
404 | |||
405 | flags = strchr(evt_name, ':'); | ||
406 | if (flags) { | ||
407 | *flags = '\0'; | ||
408 | flags++; | ||
409 | if (!strncmp(flags, "record", strlen(flags))) | ||
410 | attr->sample_type |= PERF_SAMPLE_RAW; | ||
411 | } | ||
412 | |||
403 | evt_length = strlen(evt_name); | 413 | evt_length = strlen(evt_name); |
404 | if (evt_length >= MAX_EVENT_LENGTH) | 414 | if (evt_length >= MAX_EVENT_LENGTH) |
405 | return 0; | 415 | return 0; |
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c index f1dcede14307..5c0f42e6b33b 100644 --- a/tools/perf/util/symbol.c +++ b/tools/perf/util/symbol.c | |||
@@ -7,23 +7,8 @@ | |||
7 | #include <gelf.h> | 7 | #include <gelf.h> |
8 | #include <elf.h> | 8 | #include <elf.h> |
9 | 9 | ||
10 | #ifndef NO_DEMANGLE | ||
11 | #include <bfd.h> | ||
12 | #else | ||
13 | static inline | ||
14 | char *bfd_demangle(void __used *v, const char __used *c, int __used i) | ||
15 | { | ||
16 | return NULL; | ||
17 | } | ||
18 | #endif | ||
19 | |||
20 | const char *sym_hist_filter; | 10 | const char *sym_hist_filter; |
21 | 11 | ||
22 | #ifndef DMGL_PARAMS | ||
23 | #define DMGL_PARAMS (1 << 0) /* Include function args */ | ||
24 | #define DMGL_ANSI (1 << 1) /* Include const, volatile, etc */ | ||
25 | #endif | ||
26 | |||
27 | enum dso_origin { | 12 | enum dso_origin { |
28 | DSO__ORIG_KERNEL = 0, | 13 | DSO__ORIG_KERNEL = 0, |
29 | DSO__ORIG_JAVA_JIT, | 14 | DSO__ORIG_JAVA_JIT, |
@@ -816,6 +801,8 @@ more: | |||
816 | } | 801 | } |
817 | out: | 802 | out: |
818 | free(name); | 803 | free(name); |
804 | if (ret < 0 && strstr(self->name, " (deleted)") != NULL) | ||
805 | return 0; | ||
819 | return ret; | 806 | return ret; |
820 | } | 807 | } |
821 | 808 | ||
diff --git a/tools/perf/util/symbol.h b/tools/perf/util/symbol.h index 1e003ec2f4b1..b53bf0125c1b 100644 --- a/tools/perf/util/symbol.h +++ b/tools/perf/util/symbol.h | |||
@@ -7,6 +7,30 @@ | |||
7 | #include <linux/rbtree.h> | 7 | #include <linux/rbtree.h> |
8 | #include "module.h" | 8 | #include "module.h" |
9 | 9 | ||
10 | #ifdef HAVE_CPLUS_DEMANGLE | ||
11 | extern char *cplus_demangle(const char *, int); | ||
12 | |||
13 | static inline char *bfd_demangle(void __used *v, const char *c, int i) | ||
14 | { | ||
15 | return cplus_demangle(c, i); | ||
16 | } | ||
17 | #else | ||
18 | #ifdef NO_DEMANGLE | ||
19 | static inline char *bfd_demangle(void __used *v, const char __used *c, | ||
20 | int __used i) | ||
21 | { | ||
22 | return NULL; | ||
23 | } | ||
24 | #else | ||
25 | #include <bfd.h> | ||
26 | #endif | ||
27 | #endif | ||
28 | |||
29 | #ifndef DMGL_PARAMS | ||
30 | #define DMGL_PARAMS (1 << 0) /* Include function args */ | ||
31 | #define DMGL_ANSI (1 << 1) /* Include const, volatile, etc */ | ||
32 | #endif | ||
33 | |||
10 | struct symbol { | 34 | struct symbol { |
11 | struct rb_node rb_node; | 35 | struct rb_node rb_node; |
12 | u64 start; | 36 | u64 start; |