diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-04-30 20:37:43 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-04-30 20:37:43 -0400 |
commit | 5f56886521d6ddd3648777fae44d82382dd8c87f (patch) | |
tree | aa0db6331cdb01c23f1884439840aadd31bbcca4 /drivers | |
parent | f1e9a236e5ddab6c349611ee86f54291916f226c (diff) | |
parent | e2a8b0a779787314eca1061308a8182e6c5bfabd (diff) |
Merge branch 'akpm' (incoming from Andrew)
Merge third batch of fixes from Andrew Morton:
"Most of the rest. I still have two large patchsets against AIO and
IPC, but they're a bit stuck behind other trees and I'm about to
vanish for six days.
- random fixlets
- inotify
- more of the MM queue
- show_stack() cleanups
- DMI update
- kthread/workqueue things
- compat cleanups
- epoll udpates
- binfmt updates
- nilfs2
- hfs
- hfsplus
- ptrace
- kmod
- coredump
- kexec
- rbtree
- pids
- pidns
- pps
- semaphore tweaks
- some w1 patches
- relay updates
- core Kconfig changes
- sysrq tweaks"
* emailed patches from Andrew Morton <akpm@linux-foundation.org>: (109 commits)
Documentation/sysrq: fix inconstistent help message of sysrq key
ethernet/emac/sysrq: fix inconstistent help message of sysrq key
sparc/sysrq: fix inconstistent help message of sysrq key
powerpc/xmon/sysrq: fix inconstistent help message of sysrq key
ARM/etm/sysrq: fix inconstistent help message of sysrq key
power/sysrq: fix inconstistent help message of sysrq key
kgdb/sysrq: fix inconstistent help message of sysrq key
lib/decompress.c: fix initconst
notifier-error-inject: fix module names in Kconfig
kernel/sys.c: make prctl(PR_SET_MM) generally available
UAPI: remove empty Kbuild files
menuconfig: print more info for symbol without prompts
init/Kconfig: re-order CONFIG_EXPERT options to fix menuconfig display
kconfig menu: move Virtualization drivers near other virtualization options
Kconfig: consolidate CONFIG_DEBUG_STRICT_USER_COPY_CHECKS
relay: use macro PAGE_ALIGN instead of FIX_SIZE
kernel/relay.c: move FIX_SIZE macro into relay.c
kernel/relay.c: remove unused function argument actor
drivers/w1/slaves/w1_ds2760.c: fix the error handling in w1_ds2760_add_slave()
drivers/w1/slaves/w1_ds2781.c: fix the error handling in w1_ds2781_add_slave()
...
Diffstat (limited to 'drivers')
32 files changed, 269 insertions, 189 deletions
diff --git a/drivers/Kconfig b/drivers/Kconfig index 78a956e286e6..8d96238549fa 100644 --- a/drivers/Kconfig +++ b/drivers/Kconfig | |||
@@ -120,6 +120,8 @@ source "drivers/vfio/Kconfig" | |||
120 | 120 | ||
121 | source "drivers/vlynq/Kconfig" | 121 | source "drivers/vlynq/Kconfig" |
122 | 122 | ||
123 | source "drivers/virt/Kconfig" | ||
124 | |||
123 | source "drivers/virtio/Kconfig" | 125 | source "drivers/virtio/Kconfig" |
124 | 126 | ||
125 | source "drivers/hv/Kconfig" | 127 | source "drivers/hv/Kconfig" |
@@ -144,8 +146,6 @@ source "drivers/remoteproc/Kconfig" | |||
144 | 146 | ||
145 | source "drivers/rpmsg/Kconfig" | 147 | source "drivers/rpmsg/Kconfig" |
146 | 148 | ||
147 | source "drivers/virt/Kconfig" | ||
148 | |||
149 | source "drivers/devfreq/Kconfig" | 149 | source "drivers/devfreq/Kconfig" |
150 | 150 | ||
151 | source "drivers/extcon/Kconfig" | 151 | source "drivers/extcon/Kconfig" |
diff --git a/drivers/block/aoe/aoechr.c b/drivers/block/aoe/aoechr.c index 42e67ad6bd20..ab41be625a53 100644 --- a/drivers/block/aoe/aoechr.c +++ b/drivers/block/aoe/aoechr.c | |||
@@ -139,13 +139,12 @@ bail: spin_unlock_irqrestore(&emsgs_lock, flags); | |||
139 | return; | 139 | return; |
140 | } | 140 | } |
141 | 141 | ||
142 | mp = kmalloc(n, GFP_ATOMIC); | 142 | mp = kmemdup(msg, n, GFP_ATOMIC); |
143 | if (mp == NULL) { | 143 | if (mp == NULL) { |
144 | printk(KERN_ERR "aoe: allocation failure, len=%ld\n", n); | 144 | printk(KERN_ERR "aoe: allocation failure, len=%ld\n", n); |
145 | goto bail; | 145 | goto bail; |
146 | } | 146 | } |
147 | 147 | ||
148 | memcpy(mp, msg, n); | ||
149 | em->msg = mp; | 148 | em->msg = mp; |
150 | em->flags |= EMFL_VALID; | 149 | em->flags |= EMFL_VALID; |
151 | em->len = n; | 150 | em->len = n; |
diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c index 7fecc784be01..037288e7874d 100644 --- a/drivers/block/nbd.c +++ b/drivers/block/nbd.c | |||
@@ -856,6 +856,8 @@ static int __init nbd_init(void) | |||
856 | disk->queue->limits.discard_granularity = 512; | 856 | disk->queue->limits.discard_granularity = 512; |
857 | disk->queue->limits.max_discard_sectors = UINT_MAX; | 857 | disk->queue->limits.max_discard_sectors = UINT_MAX; |
858 | disk->queue->limits.discard_zeroes_data = 0; | 858 | disk->queue->limits.discard_zeroes_data = 0; |
859 | blk_queue_max_hw_sectors(disk->queue, 65536); | ||
860 | disk->queue->limits.max_sectors = 256; | ||
859 | } | 861 | } |
860 | 862 | ||
861 | if (register_blkdev(NBD_MAJOR, "nbd")) { | 863 | if (register_blkdev(NBD_MAJOR, "nbd")) { |
diff --git a/drivers/char/random.c b/drivers/char/random.c index 32a6c5764950..cd9a6211dcad 100644 --- a/drivers/char/random.c +++ b/drivers/char/random.c | |||
@@ -1485,6 +1485,7 @@ unsigned int get_random_int(void) | |||
1485 | 1485 | ||
1486 | return ret; | 1486 | return ret; |
1487 | } | 1487 | } |
1488 | EXPORT_SYMBOL(get_random_int); | ||
1488 | 1489 | ||
1489 | /* | 1490 | /* |
1490 | * randomize_range() returns a start address such that | 1491 | * randomize_range() returns a start address such that |
diff --git a/drivers/firmware/dmi_scan.c b/drivers/firmware/dmi_scan.c index 4cd392dbf115..b95159b33c39 100644 --- a/drivers/firmware/dmi_scan.c +++ b/drivers/firmware/dmi_scan.c | |||
@@ -22,6 +22,9 @@ static u16 __initdata dmi_ver; | |||
22 | */ | 22 | */ |
23 | static int dmi_initialized; | 23 | static int dmi_initialized; |
24 | 24 | ||
25 | /* DMI system identification string used during boot */ | ||
26 | static char dmi_ids_string[128] __initdata; | ||
27 | |||
25 | static const char * __init dmi_string_nosave(const struct dmi_header *dm, u8 s) | 28 | static const char * __init dmi_string_nosave(const struct dmi_header *dm, u8 s) |
26 | { | 29 | { |
27 | const u8 *bp = ((u8 *) dm) + dm->length; | 30 | const u8 *bp = ((u8 *) dm) + dm->length; |
@@ -376,99 +379,103 @@ static void __init dmi_decode(const struct dmi_header *dm, void *dummy) | |||
376 | } | 379 | } |
377 | } | 380 | } |
378 | 381 | ||
379 | static void __init print_filtered(const char *info) | 382 | static int __init print_filtered(char *buf, size_t len, const char *info) |
380 | { | 383 | { |
384 | int c = 0; | ||
381 | const char *p; | 385 | const char *p; |
382 | 386 | ||
383 | if (!info) | 387 | if (!info) |
384 | return; | 388 | return c; |
385 | 389 | ||
386 | for (p = info; *p; p++) | 390 | for (p = info; *p; p++) |
387 | if (isprint(*p)) | 391 | if (isprint(*p)) |
388 | printk(KERN_CONT "%c", *p); | 392 | c += scnprintf(buf + c, len - c, "%c", *p); |
389 | else | 393 | else |
390 | printk(KERN_CONT "\\x%02x", *p & 0xff); | 394 | c += scnprintf(buf + c, len - c, "\\x%02x", *p & 0xff); |
395 | return c; | ||
391 | } | 396 | } |
392 | 397 | ||
393 | static void __init dmi_dump_ids(void) | 398 | static void __init dmi_format_ids(char *buf, size_t len) |
394 | { | 399 | { |
400 | int c = 0; | ||
395 | const char *board; /* Board Name is optional */ | 401 | const char *board; /* Board Name is optional */ |
396 | 402 | ||
397 | printk(KERN_DEBUG "DMI: "); | 403 | c += print_filtered(buf + c, len - c, |
398 | print_filtered(dmi_get_system_info(DMI_SYS_VENDOR)); | 404 | dmi_get_system_info(DMI_SYS_VENDOR)); |
399 | printk(KERN_CONT " "); | 405 | c += scnprintf(buf + c, len - c, " "); |
400 | print_filtered(dmi_get_system_info(DMI_PRODUCT_NAME)); | 406 | c += print_filtered(buf + c, len - c, |
407 | dmi_get_system_info(DMI_PRODUCT_NAME)); | ||
408 | |||
401 | board = dmi_get_system_info(DMI_BOARD_NAME); | 409 | board = dmi_get_system_info(DMI_BOARD_NAME); |
402 | if (board) { | 410 | if (board) { |
403 | printk(KERN_CONT "/"); | 411 | c += scnprintf(buf + c, len - c, "/"); |
404 | print_filtered(board); | 412 | c += print_filtered(buf + c, len - c, board); |
405 | } | 413 | } |
406 | printk(KERN_CONT ", BIOS "); | 414 | c += scnprintf(buf + c, len - c, ", BIOS "); |
407 | print_filtered(dmi_get_system_info(DMI_BIOS_VERSION)); | 415 | c += print_filtered(buf + c, len - c, |
408 | printk(KERN_CONT " "); | 416 | dmi_get_system_info(DMI_BIOS_VERSION)); |
409 | print_filtered(dmi_get_system_info(DMI_BIOS_DATE)); | 417 | c += scnprintf(buf + c, len - c, " "); |
410 | printk(KERN_CONT "\n"); | 418 | c += print_filtered(buf + c, len - c, |
419 | dmi_get_system_info(DMI_BIOS_DATE)); | ||
411 | } | 420 | } |
412 | 421 | ||
413 | static int __init dmi_present(const char __iomem *p) | 422 | static int __init dmi_present(const u8 *buf) |
414 | { | 423 | { |
415 | u8 buf[15]; | 424 | int smbios_ver; |
425 | |||
426 | if (memcmp(buf, "_SM_", 4) == 0 && | ||
427 | buf[5] < 32 && dmi_checksum(buf, buf[5])) { | ||
428 | smbios_ver = (buf[6] << 8) + buf[7]; | ||
429 | |||
430 | /* Some BIOS report weird SMBIOS version, fix that up */ | ||
431 | switch (smbios_ver) { | ||
432 | case 0x021F: | ||
433 | case 0x0221: | ||
434 | pr_debug("SMBIOS version fixup(2.%d->2.%d)\n", | ||
435 | smbios_ver & 0xFF, 3); | ||
436 | smbios_ver = 0x0203; | ||
437 | break; | ||
438 | case 0x0233: | ||
439 | pr_debug("SMBIOS version fixup(2.%d->2.%d)\n", 51, 6); | ||
440 | smbios_ver = 0x0206; | ||
441 | break; | ||
442 | } | ||
443 | } else { | ||
444 | smbios_ver = 0; | ||
445 | } | ||
416 | 446 | ||
417 | memcpy_fromio(buf, p, 15); | 447 | buf += 16; |
418 | if (dmi_checksum(buf, 15)) { | 448 | |
449 | if (memcmp(buf, "_DMI_", 5) == 0 && dmi_checksum(buf, 15)) { | ||
419 | dmi_num = (buf[13] << 8) | buf[12]; | 450 | dmi_num = (buf[13] << 8) | buf[12]; |
420 | dmi_len = (buf[7] << 8) | buf[6]; | 451 | dmi_len = (buf[7] << 8) | buf[6]; |
421 | dmi_base = (buf[11] << 24) | (buf[10] << 16) | | 452 | dmi_base = (buf[11] << 24) | (buf[10] << 16) | |
422 | (buf[9] << 8) | buf[8]; | 453 | (buf[9] << 8) | buf[8]; |
423 | 454 | ||
424 | if (dmi_walk_early(dmi_decode) == 0) { | 455 | if (dmi_walk_early(dmi_decode) == 0) { |
425 | if (dmi_ver) | 456 | if (smbios_ver) { |
457 | dmi_ver = smbios_ver; | ||
426 | pr_info("SMBIOS %d.%d present.\n", | 458 | pr_info("SMBIOS %d.%d present.\n", |
427 | dmi_ver >> 8, dmi_ver & 0xFF); | 459 | dmi_ver >> 8, dmi_ver & 0xFF); |
428 | else { | 460 | } else { |
429 | dmi_ver = (buf[14] & 0xF0) << 4 | | 461 | dmi_ver = (buf[14] & 0xF0) << 4 | |
430 | (buf[14] & 0x0F); | 462 | (buf[14] & 0x0F); |
431 | pr_info("Legacy DMI %d.%d present.\n", | 463 | pr_info("Legacy DMI %d.%d present.\n", |
432 | dmi_ver >> 8, dmi_ver & 0xFF); | 464 | dmi_ver >> 8, dmi_ver & 0xFF); |
433 | } | 465 | } |
434 | dmi_dump_ids(); | 466 | dmi_format_ids(dmi_ids_string, sizeof(dmi_ids_string)); |
467 | printk(KERN_DEBUG "DMI: %s\n", dmi_ids_string); | ||
435 | return 0; | 468 | return 0; |
436 | } | 469 | } |
437 | } | 470 | } |
438 | dmi_ver = 0; | ||
439 | return 1; | ||
440 | } | ||
441 | |||
442 | static int __init smbios_present(const char __iomem *p) | ||
443 | { | ||
444 | u8 buf[32]; | ||
445 | 471 | ||
446 | memcpy_fromio(buf, p, 32); | ||
447 | if ((buf[5] < 32) && dmi_checksum(buf, buf[5])) { | ||
448 | dmi_ver = (buf[6] << 8) + buf[7]; | ||
449 | |||
450 | /* Some BIOS report weird SMBIOS version, fix that up */ | ||
451 | switch (dmi_ver) { | ||
452 | case 0x021F: | ||
453 | case 0x0221: | ||
454 | pr_debug("SMBIOS version fixup(2.%d->2.%d)\n", | ||
455 | dmi_ver & 0xFF, 3); | ||
456 | dmi_ver = 0x0203; | ||
457 | break; | ||
458 | case 0x0233: | ||
459 | pr_debug("SMBIOS version fixup(2.%d->2.%d)\n", 51, 6); | ||
460 | dmi_ver = 0x0206; | ||
461 | break; | ||
462 | } | ||
463 | return memcmp(p + 16, "_DMI_", 5) || dmi_present(p + 16); | ||
464 | } | ||
465 | return 1; | 472 | return 1; |
466 | } | 473 | } |
467 | 474 | ||
468 | void __init dmi_scan_machine(void) | 475 | void __init dmi_scan_machine(void) |
469 | { | 476 | { |
470 | char __iomem *p, *q; | 477 | char __iomem *p, *q; |
471 | int rc; | 478 | char buf[32]; |
472 | 479 | ||
473 | if (efi_enabled(EFI_CONFIG_TABLES)) { | 480 | if (efi_enabled(EFI_CONFIG_TABLES)) { |
474 | if (efi.smbios == EFI_INVALID_TABLE_ADDR) | 481 | if (efi.smbios == EFI_INVALID_TABLE_ADDR) |
@@ -481,10 +488,10 @@ void __init dmi_scan_machine(void) | |||
481 | p = dmi_ioremap(efi.smbios, 32); | 488 | p = dmi_ioremap(efi.smbios, 32); |
482 | if (p == NULL) | 489 | if (p == NULL) |
483 | goto error; | 490 | goto error; |
484 | 491 | memcpy_fromio(buf, p, 32); | |
485 | rc = smbios_present(p); | ||
486 | dmi_iounmap(p, 32); | 492 | dmi_iounmap(p, 32); |
487 | if (!rc) { | 493 | |
494 | if (!dmi_present(buf)) { | ||
488 | dmi_available = 1; | 495 | dmi_available = 1; |
489 | goto out; | 496 | goto out; |
490 | } | 497 | } |
@@ -499,18 +506,15 @@ void __init dmi_scan_machine(void) | |||
499 | if (p == NULL) | 506 | if (p == NULL) |
500 | goto error; | 507 | goto error; |
501 | 508 | ||
509 | memset(buf, 0, 16); | ||
502 | for (q = p; q < p + 0x10000; q += 16) { | 510 | for (q = p; q < p + 0x10000; q += 16) { |
503 | if (memcmp(q, "_SM_", 4) == 0 && q - p <= 0xFFE0) | 511 | memcpy_fromio(buf + 16, q, 16); |
504 | rc = smbios_present(q); | 512 | if (!dmi_present(buf)) { |
505 | else if (memcmp(q, "_DMI_", 5) == 0) | ||
506 | rc = dmi_present(q); | ||
507 | else | ||
508 | continue; | ||
509 | if (!rc) { | ||
510 | dmi_available = 1; | 513 | dmi_available = 1; |
511 | dmi_iounmap(p, 0x10000); | 514 | dmi_iounmap(p, 0x10000); |
512 | goto out; | 515 | goto out; |
513 | } | 516 | } |
517 | memcpy(buf, buf + 16, 16); | ||
514 | } | 518 | } |
515 | dmi_iounmap(p, 0x10000); | 519 | dmi_iounmap(p, 0x10000); |
516 | } | 520 | } |
@@ -521,6 +525,19 @@ void __init dmi_scan_machine(void) | |||
521 | } | 525 | } |
522 | 526 | ||
523 | /** | 527 | /** |
528 | * dmi_set_dump_stack_arch_desc - set arch description for dump_stack() | ||
529 | * | ||
530 | * Invoke dump_stack_set_arch_desc() with DMI system information so that | ||
531 | * DMI identifiers are printed out on task dumps. Arch boot code should | ||
532 | * call this function after dmi_scan_machine() if it wants to print out DMI | ||
533 | * identifiers on task dumps. | ||
534 | */ | ||
535 | void __init dmi_set_dump_stack_arch_desc(void) | ||
536 | { | ||
537 | dump_stack_set_arch_desc("%s", dmi_ids_string); | ||
538 | } | ||
539 | |||
540 | /** | ||
524 | * dmi_matches - check if dmi_system_id structure matches system DMI data | 541 | * dmi_matches - check if dmi_system_id structure matches system DMI data |
525 | * @dmi: pointer to the dmi_system_id structure to check | 542 | * @dmi: pointer to the dmi_system_id structure to check |
526 | */ | 543 | */ |
diff --git a/drivers/memstick/host/r592.c b/drivers/memstick/host/r592.c index a7c5b31c0d50..9718661c1fb6 100644 --- a/drivers/memstick/host/r592.c +++ b/drivers/memstick/host/r592.c | |||
@@ -847,7 +847,7 @@ static void r592_remove(struct pci_dev *pdev) | |||
847 | dev->dummy_dma_page_physical_address); | 847 | dev->dummy_dma_page_physical_address); |
848 | } | 848 | } |
849 | 849 | ||
850 | #ifdef CONFIG_PM | 850 | #ifdef CONFIG_PM_SLEEP |
851 | static int r592_suspend(struct device *core_dev) | 851 | static int r592_suspend(struct device *core_dev) |
852 | { | 852 | { |
853 | struct pci_dev *pdev = to_pci_dev(core_dev); | 853 | struct pci_dev *pdev = to_pci_dev(core_dev); |
@@ -870,10 +870,10 @@ static int r592_resume(struct device *core_dev) | |||
870 | r592_update_card_detect(dev); | 870 | r592_update_card_detect(dev); |
871 | return 0; | 871 | return 0; |
872 | } | 872 | } |
873 | |||
874 | SIMPLE_DEV_PM_OPS(r592_pm_ops, r592_suspend, r592_resume); | ||
875 | #endif | 873 | #endif |
876 | 874 | ||
875 | static SIMPLE_DEV_PM_OPS(r592_pm_ops, r592_suspend, r592_resume); | ||
876 | |||
877 | MODULE_DEVICE_TABLE(pci, r592_pci_id_tbl); | 877 | MODULE_DEVICE_TABLE(pci, r592_pci_id_tbl); |
878 | 878 | ||
879 | static struct pci_driver r852_pci_driver = { | 879 | static struct pci_driver r852_pci_driver = { |
@@ -881,9 +881,7 @@ static struct pci_driver r852_pci_driver = { | |||
881 | .id_table = r592_pci_id_tbl, | 881 | .id_table = r592_pci_id_tbl, |
882 | .probe = r592_probe, | 882 | .probe = r592_probe, |
883 | .remove = r592_remove, | 883 | .remove = r592_remove, |
884 | #ifdef CONFIG_PM | ||
885 | .driver.pm = &r592_pm_ops, | 884 | .driver.pm = &r592_pm_ops, |
886 | #endif | ||
887 | }; | 885 | }; |
888 | 886 | ||
889 | static __init int r592_module_init(void) | 887 | static __init int r592_module_init(void) |
diff --git a/drivers/message/i2o/i2o_config.c b/drivers/message/i2o/i2o_config.c index 5451beff183f..a60c188c2bd9 100644 --- a/drivers/message/i2o/i2o_config.c +++ b/drivers/message/i2o/i2o_config.c | |||
@@ -687,6 +687,11 @@ static int i2o_cfg_passthru32(struct file *file, unsigned cmnd, | |||
687 | } | 687 | } |
688 | size = size >> 16; | 688 | size = size >> 16; |
689 | size *= 4; | 689 | size *= 4; |
690 | if (size > sizeof(rmsg)) { | ||
691 | rcode = -EINVAL; | ||
692 | goto sg_list_cleanup; | ||
693 | } | ||
694 | |||
690 | /* Copy in the user's I2O command */ | 695 | /* Copy in the user's I2O command */ |
691 | if (copy_from_user(rmsg, user_msg, size)) { | 696 | if (copy_from_user(rmsg, user_msg, size)) { |
692 | rcode = -EFAULT; | 697 | rcode = -EFAULT; |
@@ -922,6 +927,11 @@ static int i2o_cfg_passthru(unsigned long arg) | |||
922 | } | 927 | } |
923 | size = size >> 16; | 928 | size = size >> 16; |
924 | size *= 4; | 929 | size *= 4; |
930 | if (size > sizeof(rmsg)) { | ||
931 | rcode = -EFAULT; | ||
932 | goto sg_list_cleanup; | ||
933 | } | ||
934 | |||
925 | /* Copy in the user's I2O command */ | 935 | /* Copy in the user's I2O command */ |
926 | if (copy_from_user(rmsg, user_msg, size)) { | 936 | if (copy_from_user(rmsg, user_msg, size)) { |
927 | rcode = -EFAULT; | 937 | rcode = -EFAULT; |
diff --git a/drivers/net/ethernet/ibm/emac/debug.c b/drivers/net/ethernet/ibm/emac/debug.c index b16b4828b64d..a559f326bf63 100644 --- a/drivers/net/ethernet/ibm/emac/debug.c +++ b/drivers/net/ethernet/ibm/emac/debug.c | |||
@@ -245,7 +245,7 @@ static void emac_sysrq_handler(int key) | |||
245 | 245 | ||
246 | static struct sysrq_key_op emac_sysrq_op = { | 246 | static struct sysrq_key_op emac_sysrq_op = { |
247 | .handler = emac_sysrq_handler, | 247 | .handler = emac_sysrq_handler, |
248 | .help_msg = "emaC", | 248 | .help_msg = "emac(c)", |
249 | .action_msg = "Show EMAC(s) status", | 249 | .action_msg = "Show EMAC(s) status", |
250 | }; | 250 | }; |
251 | 251 | ||
diff --git a/drivers/pps/Kconfig b/drivers/pps/Kconfig index 982d16b5a846..7512e98e9311 100644 --- a/drivers/pps/Kconfig +++ b/drivers/pps/Kconfig | |||
@@ -20,10 +20,10 @@ config PPS | |||
20 | 20 | ||
21 | To compile this driver as a module, choose M here: the module | 21 | To compile this driver as a module, choose M here: the module |
22 | will be called pps_core.ko. | 22 | will be called pps_core.ko. |
23 | if PPS | ||
23 | 24 | ||
24 | config PPS_DEBUG | 25 | config PPS_DEBUG |
25 | bool "PPS debugging messages" | 26 | bool "PPS debugging messages" |
26 | depends on PPS | ||
27 | help | 27 | help |
28 | Say Y here if you want the PPS support to produce a bunch of debug | 28 | Say Y here if you want the PPS support to produce a bunch of debug |
29 | messages to the system log. Select this if you are having a | 29 | messages to the system log. Select this if you are having a |
@@ -31,13 +31,15 @@ config PPS_DEBUG | |||
31 | 31 | ||
32 | config NTP_PPS | 32 | config NTP_PPS |
33 | bool "PPS kernel consumer support" | 33 | bool "PPS kernel consumer support" |
34 | depends on PPS && !NO_HZ | 34 | depends on !NO_HZ |
35 | help | 35 | help |
36 | This option adds support for direct in-kernel time | 36 | This option adds support for direct in-kernel time |
37 | synchronization using an external PPS signal. | 37 | synchronization using an external PPS signal. |
38 | 38 | ||
39 | It doesn't work on tickless systems at the moment. | 39 | It doesn't work on tickless systems at the moment. |
40 | 40 | ||
41 | endif | ||
42 | |||
41 | source drivers/pps/clients/Kconfig | 43 | source drivers/pps/clients/Kconfig |
42 | 44 | ||
43 | source drivers/pps/generators/Kconfig | 45 | source drivers/pps/generators/Kconfig |
diff --git a/drivers/pps/kc.c b/drivers/pps/kc.c index 079e930b1938..e219db1f1c84 100644 --- a/drivers/pps/kc.c +++ b/drivers/pps/kc.c | |||
@@ -34,10 +34,10 @@ | |||
34 | */ | 34 | */ |
35 | 35 | ||
36 | /* state variables to bind kernel consumer */ | 36 | /* state variables to bind kernel consumer */ |
37 | DEFINE_SPINLOCK(pps_kc_hardpps_lock); | 37 | static DEFINE_SPINLOCK(pps_kc_hardpps_lock); |
38 | /* PPS API (RFC 2783): current source and mode for kernel consumer */ | 38 | /* PPS API (RFC 2783): current source and mode for kernel consumer */ |
39 | struct pps_device *pps_kc_hardpps_dev; /* unique pointer to device */ | 39 | static struct pps_device *pps_kc_hardpps_dev; /* unique pointer to device */ |
40 | int pps_kc_hardpps_mode; /* mode bits for kernel consumer */ | 40 | static int pps_kc_hardpps_mode; /* mode bits for kernel consumer */ |
41 | 41 | ||
42 | /* pps_kc_bind - control PPS kernel consumer binding | 42 | /* pps_kc_bind - control PPS kernel consumer binding |
43 | * @pps: the PPS source | 43 | * @pps: the PPS source |
diff --git a/drivers/staging/speakup/kobjects.c b/drivers/staging/speakup/kobjects.c index d6d9264e4ca7..943b6c134a22 100644 --- a/drivers/staging/speakup/kobjects.c +++ b/drivers/staging/speakup/kobjects.c | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/kernel.h> | 15 | #include <linux/kernel.h> |
16 | #include <linux/kobject.h> | 16 | #include <linux/kobject.h> |
17 | #include <linux/string.h> | 17 | #include <linux/string.h> |
18 | #include <linux/string_helpers.h> | ||
18 | #include <linux/sysfs.h> | 19 | #include <linux/sysfs.h> |
19 | #include <linux/ctype.h> | 20 | #include <linux/ctype.h> |
20 | 21 | ||
@@ -417,7 +418,7 @@ static ssize_t synth_direct_store(struct kobject *kobj, | |||
417 | bytes = min_t(size_t, len, 250); | 418 | bytes = min_t(size_t, len, 250); |
418 | strncpy(tmp, ptr, bytes); | 419 | strncpy(tmp, ptr, bytes); |
419 | tmp[bytes] = '\0'; | 420 | tmp[bytes] = '\0'; |
420 | spk_xlate(tmp); | 421 | string_unescape_any_inplace(tmp); |
421 | synth_printf("%s", tmp); | 422 | synth_printf("%s", tmp); |
422 | ptr += bytes; | 423 | ptr += bytes; |
423 | len -= bytes; | 424 | len -= bytes; |
@@ -605,7 +606,8 @@ ssize_t spk_var_store(struct kobject *kobj, struct kobj_attribute *attr, | |||
605 | if (param->data == NULL) | 606 | if (param->data == NULL) |
606 | return 0; | 607 | return 0; |
607 | ret = 0; | 608 | ret = 0; |
608 | cp = spk_xlate((char *) buf); | 609 | cp = (char *)buf; |
610 | string_unescape_any_inplace(cp); | ||
609 | 611 | ||
610 | spk_lock(flags); | 612 | spk_lock(flags); |
611 | switch (param->var_type) { | 613 | switch (param->var_type) { |
diff --git a/drivers/staging/speakup/speakup.h b/drivers/staging/speakup/speakup.h index c387a02fc1c2..0126f714821a 100644 --- a/drivers/staging/speakup/speakup.h +++ b/drivers/staging/speakup/speakup.h | |||
@@ -54,7 +54,6 @@ void spk_get_index_count(int *linecount, int *sentcount); | |||
54 | extern int spk_set_key_info(const u_char *key_info, u_char *k_buffer); | 54 | extern int spk_set_key_info(const u_char *key_info, u_char *k_buffer); |
55 | extern char *spk_strlwr(char *s); | 55 | extern char *spk_strlwr(char *s); |
56 | extern char *spk_s2uchar(char *start, char *dest); | 56 | extern char *spk_s2uchar(char *start, char *dest); |
57 | extern char *spk_xlate(char *s); | ||
58 | extern int speakup_kobj_init(void); | 57 | extern int speakup_kobj_init(void); |
59 | extern void speakup_kobj_exit(void); | 58 | extern void speakup_kobj_exit(void); |
60 | extern int spk_chartab_get_value(char *keyword); | 59 | extern int spk_chartab_get_value(char *keyword); |
diff --git a/drivers/staging/speakup/varhandlers.c b/drivers/staging/speakup/varhandlers.c index 0099cb12e560..7f6288fc2299 100644 --- a/drivers/staging/speakup/varhandlers.c +++ b/drivers/staging/speakup/varhandlers.c | |||
@@ -328,49 +328,3 @@ char *spk_s2uchar(char *start, char *dest) | |||
328 | *dest = (u_char)val; | 328 | *dest = (u_char)val; |
329 | return start; | 329 | return start; |
330 | } | 330 | } |
331 | |||
332 | char *spk_xlate(char *s) | ||
333 | { | ||
334 | static const char finds[] = "nrtvafe"; | ||
335 | static const char subs[] = "\n\r\t\013\001\014\033"; | ||
336 | static const char hx[] = "0123456789abcdefABCDEF"; | ||
337 | char *p = s, *p1, *p2, c; | ||
338 | int num; | ||
339 | while ((p = strchr(p, '\\'))) { | ||
340 | p1 = p+1; | ||
341 | p2 = strchr(finds, *p1); | ||
342 | if (p2) { | ||
343 | *p++ = subs[p2-finds]; | ||
344 | p1++; | ||
345 | } else if (*p1 >= '0' && *p1 <= '7') { | ||
346 | num = (*p1++)&7; | ||
347 | while (num < 32 && *p1 >= '0' && *p1 <= '7') { | ||
348 | num <<= 3; | ||
349 | num += (*p1++)&7; | ||
350 | } | ||
351 | *p++ = num; | ||
352 | } else if (*p1 == 'x' && | ||
353 | strchr(hx, p1[1]) && strchr(hx, p1[2])) { | ||
354 | p1++; | ||
355 | c = *p1++; | ||
356 | if (c > '9') | ||
357 | c = (c - '7') & 0x0f; | ||
358 | else | ||
359 | c -= '0'; | ||
360 | num = c << 4; | ||
361 | c = *p1++; | ||
362 | if (c > '9') | ||
363 | c = (c-'7')&0x0f; | ||
364 | else | ||
365 | c -= '0'; | ||
366 | num += c; | ||
367 | *p++ = num; | ||
368 | } else | ||
369 | *p++ = *p1++; | ||
370 | p2 = p; | ||
371 | while (*p1) | ||
372 | *p2++ = *p1++; | ||
373 | *p2 = '\0'; | ||
374 | } | ||
375 | return s; | ||
376 | } | ||
diff --git a/drivers/staging/zcache/Kconfig b/drivers/staging/zcache/Kconfig index 05e87a1e5d93..2d7b2da3b9e0 100644 --- a/drivers/staging/zcache/Kconfig +++ b/drivers/staging/zcache/Kconfig | |||
@@ -1,5 +1,5 @@ | |||
1 | config ZCACHE | 1 | config ZCACHE |
2 | bool "Dynamic compression of swap pages and clean pagecache pages" | 2 | tristate "Dynamic compression of swap pages and clean pagecache pages" |
3 | depends on CRYPTO=y && SWAP=y && CLEANCACHE && FRONTSWAP | 3 | depends on CRYPTO=y && SWAP=y && CLEANCACHE && FRONTSWAP |
4 | select CRYPTO_LZO | 4 | select CRYPTO_LZO |
5 | default n | 5 | default n |
@@ -19,8 +19,8 @@ config ZCACHE_DEBUG | |||
19 | how zcache is doing. You probably want to set this to 'N'. | 19 | how zcache is doing. You probably want to set this to 'N'. |
20 | 20 | ||
21 | config RAMSTER | 21 | config RAMSTER |
22 | bool "Cross-machine RAM capacity sharing, aka peer-to-peer tmem" | 22 | tristate "Cross-machine RAM capacity sharing, aka peer-to-peer tmem" |
23 | depends on CONFIGFS_FS=y && SYSFS=y && !HIGHMEM && ZCACHE=y | 23 | depends on CONFIGFS_FS=y && SYSFS=y && !HIGHMEM && ZCACHE |
24 | depends on NET | 24 | depends on NET |
25 | # must ensure struct page is 8-byte aligned | 25 | # must ensure struct page is 8-byte aligned |
26 | select HAVE_ALIGNED_STRUCT_PAGE if !64BIT | 26 | select HAVE_ALIGNED_STRUCT_PAGE if !64BIT |
diff --git a/drivers/staging/zcache/ramster.h b/drivers/staging/zcache/ramster.h index 1b71aea2ff62..e1f91d5a0f6a 100644 --- a/drivers/staging/zcache/ramster.h +++ b/drivers/staging/zcache/ramster.h | |||
@@ -11,10 +11,14 @@ | |||
11 | #ifndef _ZCACHE_RAMSTER_H_ | 11 | #ifndef _ZCACHE_RAMSTER_H_ |
12 | #define _ZCACHE_RAMSTER_H_ | 12 | #define _ZCACHE_RAMSTER_H_ |
13 | 13 | ||
14 | #ifdef CONFIG_RAMSTER_MODULE | ||
15 | #define CONFIG_RAMSTER | ||
16 | #endif | ||
17 | |||
14 | #ifdef CONFIG_RAMSTER | 18 | #ifdef CONFIG_RAMSTER |
15 | #include "ramster/ramster.h" | 19 | #include "ramster/ramster.h" |
16 | #else | 20 | #else |
17 | static inline void ramster_init(bool x, bool y, bool z) | 21 | static inline void ramster_init(bool x, bool y, bool z, bool w) |
18 | { | 22 | { |
19 | } | 23 | } |
20 | 24 | ||
diff --git a/drivers/staging/zcache/ramster/debug.c b/drivers/staging/zcache/ramster/debug.c index bf34133cc631..327e4f0d98e1 100644 --- a/drivers/staging/zcache/ramster/debug.c +++ b/drivers/staging/zcache/ramster/debug.c | |||
@@ -43,7 +43,7 @@ static struct debug_entry { | |||
43 | }; | 43 | }; |
44 | #undef ATTR | 44 | #undef ATTR |
45 | 45 | ||
46 | int __init ramster_debugfs_init(void) | 46 | int ramster_debugfs_init(void) |
47 | { | 47 | { |
48 | int i; | 48 | int i; |
49 | struct dentry *root = debugfs_create_dir("ramster", NULL); | 49 | struct dentry *root = debugfs_create_dir("ramster", NULL); |
diff --git a/drivers/staging/zcache/ramster/nodemanager.c b/drivers/staging/zcache/ramster/nodemanager.c index c0f48158735d..2cfe93342c0d 100644 --- a/drivers/staging/zcache/ramster/nodemanager.c +++ b/drivers/staging/zcache/ramster/nodemanager.c | |||
@@ -949,7 +949,7 @@ static void __exit exit_r2nm(void) | |||
949 | r2hb_exit(); | 949 | r2hb_exit(); |
950 | } | 950 | } |
951 | 951 | ||
952 | static int __init init_r2nm(void) | 952 | int r2nm_init(void) |
953 | { | 953 | { |
954 | int ret = -1; | 954 | int ret = -1; |
955 | 955 | ||
@@ -986,10 +986,11 @@ out_r2hb: | |||
986 | out: | 986 | out: |
987 | return ret; | 987 | return ret; |
988 | } | 988 | } |
989 | EXPORT_SYMBOL_GPL(r2nm_init); | ||
989 | 990 | ||
990 | MODULE_AUTHOR("Oracle"); | 991 | MODULE_AUTHOR("Oracle"); |
991 | MODULE_LICENSE("GPL"); | 992 | MODULE_LICENSE("GPL"); |
992 | 993 | ||
993 | /* module_init(init_r2nm) */ | 994 | #ifndef CONFIG_RAMSTER_MODULE |
994 | late_initcall(init_r2nm); | 995 | late_initcall(r2nm_init); |
995 | /* module_exit(exit_r2nm) */ | 996 | #endif |
diff --git a/drivers/staging/zcache/ramster/ramster.c b/drivers/staging/zcache/ramster/ramster.c index 87816279ce3c..b18b887db79f 100644 --- a/drivers/staging/zcache/ramster/ramster.c +++ b/drivers/staging/zcache/ramster/ramster.c | |||
@@ -121,6 +121,7 @@ int ramster_do_preload_flnode(struct tmem_pool *pool) | |||
121 | kmem_cache_free(ramster_flnode_cache, flnode); | 121 | kmem_cache_free(ramster_flnode_cache, flnode); |
122 | return ret; | 122 | return ret; |
123 | } | 123 | } |
124 | EXPORT_SYMBOL_GPL(ramster_do_preload_flnode); | ||
124 | 125 | ||
125 | /* | 126 | /* |
126 | * Called by the message handler after a (still compressed) page has been | 127 | * Called by the message handler after a (still compressed) page has been |
@@ -388,6 +389,7 @@ void *ramster_pampd_free(void *pampd, struct tmem_pool *pool, | |||
388 | } | 389 | } |
389 | return local_pampd; | 390 | return local_pampd; |
390 | } | 391 | } |
392 | EXPORT_SYMBOL_GPL(ramster_pampd_free); | ||
391 | 393 | ||
392 | void ramster_count_foreign_pages(bool eph, int count) | 394 | void ramster_count_foreign_pages(bool eph, int count) |
393 | { | 395 | { |
@@ -408,6 +410,7 @@ void ramster_count_foreign_pages(bool eph, int count) | |||
408 | } | 410 | } |
409 | } | 411 | } |
410 | } | 412 | } |
413 | EXPORT_SYMBOL_GPL(ramster_count_foreign_pages); | ||
411 | 414 | ||
412 | /* | 415 | /* |
413 | * For now, just push over a few pages every few seconds to | 416 | * For now, just push over a few pages every few seconds to |
@@ -593,7 +596,7 @@ requeue: | |||
593 | ramster_remotify_queue_delayed_work(HZ); | 596 | ramster_remotify_queue_delayed_work(HZ); |
594 | } | 597 | } |
595 | 598 | ||
596 | void __init ramster_remotify_init(void) | 599 | void ramster_remotify_init(void) |
597 | { | 600 | { |
598 | unsigned long n = 60UL; | 601 | unsigned long n = 60UL; |
599 | ramster_remotify_workqueue = | 602 | ramster_remotify_workqueue = |
@@ -768,8 +771,10 @@ static bool frontswap_selfshrinking __read_mostly; | |||
768 | static void selfshrink_process(struct work_struct *work); | 771 | static void selfshrink_process(struct work_struct *work); |
769 | static DECLARE_DELAYED_WORK(selfshrink_worker, selfshrink_process); | 772 | static DECLARE_DELAYED_WORK(selfshrink_worker, selfshrink_process); |
770 | 773 | ||
774 | #ifndef CONFIG_RAMSTER_MODULE | ||
771 | /* Enable/disable with kernel boot option. */ | 775 | /* Enable/disable with kernel boot option. */ |
772 | static bool use_frontswap_selfshrink __initdata = true; | 776 | static bool use_frontswap_selfshrink = true; |
777 | #endif | ||
773 | 778 | ||
774 | /* | 779 | /* |
775 | * The default values for the following parameters were deemed reasonable | 780 | * The default values for the following parameters were deemed reasonable |
@@ -824,6 +829,7 @@ static void frontswap_selfshrink(void) | |||
824 | frontswap_shrink(tgt_frontswap_pages); | 829 | frontswap_shrink(tgt_frontswap_pages); |
825 | } | 830 | } |
826 | 831 | ||
832 | #ifndef CONFIG_RAMSTER_MODULE | ||
827 | static int __init ramster_nofrontswap_selfshrink_setup(char *s) | 833 | static int __init ramster_nofrontswap_selfshrink_setup(char *s) |
828 | { | 834 | { |
829 | use_frontswap_selfshrink = false; | 835 | use_frontswap_selfshrink = false; |
@@ -831,6 +837,7 @@ static int __init ramster_nofrontswap_selfshrink_setup(char *s) | |||
831 | } | 837 | } |
832 | 838 | ||
833 | __setup("noselfshrink", ramster_nofrontswap_selfshrink_setup); | 839 | __setup("noselfshrink", ramster_nofrontswap_selfshrink_setup); |
840 | #endif | ||
834 | 841 | ||
835 | static void selfshrink_process(struct work_struct *work) | 842 | static void selfshrink_process(struct work_struct *work) |
836 | { | 843 | { |
@@ -849,6 +856,7 @@ void ramster_cpu_up(int cpu) | |||
849 | per_cpu(ramster_remoteputmem1, cpu) = p1; | 856 | per_cpu(ramster_remoteputmem1, cpu) = p1; |
850 | per_cpu(ramster_remoteputmem2, cpu) = p2; | 857 | per_cpu(ramster_remoteputmem2, cpu) = p2; |
851 | } | 858 | } |
859 | EXPORT_SYMBOL_GPL(ramster_cpu_up); | ||
852 | 860 | ||
853 | void ramster_cpu_down(int cpu) | 861 | void ramster_cpu_down(int cpu) |
854 | { | 862 | { |
@@ -864,6 +872,7 @@ void ramster_cpu_down(int cpu) | |||
864 | kp->flnode = NULL; | 872 | kp->flnode = NULL; |
865 | } | 873 | } |
866 | } | 874 | } |
875 | EXPORT_SYMBOL_GPL(ramster_cpu_down); | ||
867 | 876 | ||
868 | void ramster_register_pamops(struct tmem_pamops *pamops) | 877 | void ramster_register_pamops(struct tmem_pamops *pamops) |
869 | { | 878 | { |
@@ -874,9 +883,11 @@ void ramster_register_pamops(struct tmem_pamops *pamops) | |||
874 | pamops->repatriate = ramster_pampd_repatriate; | 883 | pamops->repatriate = ramster_pampd_repatriate; |
875 | pamops->repatriate_preload = ramster_pampd_repatriate_preload; | 884 | pamops->repatriate_preload = ramster_pampd_repatriate_preload; |
876 | } | 885 | } |
886 | EXPORT_SYMBOL_GPL(ramster_register_pamops); | ||
877 | 887 | ||
878 | void __init ramster_init(bool cleancache, bool frontswap, | 888 | void ramster_init(bool cleancache, bool frontswap, |
879 | bool frontswap_exclusive_gets) | 889 | bool frontswap_exclusive_gets, |
890 | bool frontswap_selfshrink) | ||
880 | { | 891 | { |
881 | int ret = 0; | 892 | int ret = 0; |
882 | 893 | ||
@@ -891,10 +902,17 @@ void __init ramster_init(bool cleancache, bool frontswap, | |||
891 | if (ret) | 902 | if (ret) |
892 | pr_err("ramster: can't create sysfs for ramster\n"); | 903 | pr_err("ramster: can't create sysfs for ramster\n"); |
893 | (void)r2net_register_handlers(); | 904 | (void)r2net_register_handlers(); |
905 | #ifdef CONFIG_RAMSTER_MODULE | ||
906 | ret = r2nm_init(); | ||
907 | if (ret) | ||
908 | pr_err("ramster: can't init r2net\n"); | ||
909 | frontswap_selfshrinking = frontswap_selfshrink; | ||
910 | #else | ||
911 | frontswap_selfshrinking = use_frontswap_selfshrink; | ||
912 | #endif | ||
894 | INIT_LIST_HEAD(&ramster_rem_op_list); | 913 | INIT_LIST_HEAD(&ramster_rem_op_list); |
895 | ramster_flnode_cache = kmem_cache_create("ramster_flnode", | 914 | ramster_flnode_cache = kmem_cache_create("ramster_flnode", |
896 | sizeof(struct flushlist_node), 0, 0, NULL); | 915 | sizeof(struct flushlist_node), 0, 0, NULL); |
897 | frontswap_selfshrinking = use_frontswap_selfshrink; | ||
898 | if (frontswap_selfshrinking) { | 916 | if (frontswap_selfshrinking) { |
899 | pr_info("ramster: Initializing frontswap selfshrink driver.\n"); | 917 | pr_info("ramster: Initializing frontswap selfshrink driver.\n"); |
900 | schedule_delayed_work(&selfshrink_worker, | 918 | schedule_delayed_work(&selfshrink_worker, |
@@ -902,3 +920,4 @@ void __init ramster_init(bool cleancache, bool frontswap, | |||
902 | } | 920 | } |
903 | ramster_remotify_init(); | 921 | ramster_remotify_init(); |
904 | } | 922 | } |
923 | EXPORT_SYMBOL_GPL(ramster_init); | ||
diff --git a/drivers/staging/zcache/ramster/ramster.h b/drivers/staging/zcache/ramster/ramster.h index 12ae56f09ca4..6d41a7a772e3 100644 --- a/drivers/staging/zcache/ramster/ramster.h +++ b/drivers/staging/zcache/ramster/ramster.h | |||
@@ -147,7 +147,7 @@ extern int r2net_register_handlers(void); | |||
147 | extern int r2net_remote_target_node_set(int); | 147 | extern int r2net_remote_target_node_set(int); |
148 | 148 | ||
149 | extern int ramster_remotify_pageframe(bool); | 149 | extern int ramster_remotify_pageframe(bool); |
150 | extern void ramster_init(bool, bool, bool); | 150 | extern void ramster_init(bool, bool, bool, bool); |
151 | extern void ramster_register_pamops(struct tmem_pamops *); | 151 | extern void ramster_register_pamops(struct tmem_pamops *); |
152 | extern int ramster_localify(int, struct tmem_oid *oidp, uint32_t, char *, | 152 | extern int ramster_localify(int, struct tmem_oid *oidp, uint32_t, char *, |
153 | unsigned int, void *); | 153 | unsigned int, void *); |
diff --git a/drivers/staging/zcache/ramster/ramster_nodemanager.h b/drivers/staging/zcache/ramster/ramster_nodemanager.h index 49f879d943ab..dbaae34ea613 100644 --- a/drivers/staging/zcache/ramster/ramster_nodemanager.h +++ b/drivers/staging/zcache/ramster/ramster_nodemanager.h | |||
@@ -36,4 +36,6 @@ | |||
36 | /* host name, group name, cluster name all 64 bytes */ | 36 | /* host name, group name, cluster name all 64 bytes */ |
37 | #define R2NM_MAX_NAME_LEN 64 /* __NEW_UTS_LEN */ | 37 | #define R2NM_MAX_NAME_LEN 64 /* __NEW_UTS_LEN */ |
38 | 38 | ||
39 | extern int r2nm_init(void); | ||
40 | |||
39 | #endif /* _RAMSTER_NODEMANAGER_H */ | 41 | #endif /* _RAMSTER_NODEMANAGER_H */ |
diff --git a/drivers/staging/zcache/tmem.c b/drivers/staging/zcache/tmem.c index a2b7e03b6062..d7e51e4152eb 100644 --- a/drivers/staging/zcache/tmem.c +++ b/drivers/staging/zcache/tmem.c | |||
@@ -35,7 +35,8 @@ | |||
35 | #include <linux/list.h> | 35 | #include <linux/list.h> |
36 | #include <linux/spinlock.h> | 36 | #include <linux/spinlock.h> |
37 | #include <linux/atomic.h> | 37 | #include <linux/atomic.h> |
38 | #ifdef CONFIG_RAMSTER | 38 | #include <linux/export.h> |
39 | #if defined(CONFIG_RAMSTER) || defined(CONFIG_RAMSTER_MODULE) | ||
39 | #include <linux/delay.h> | 40 | #include <linux/delay.h> |
40 | #endif | 41 | #endif |
41 | 42 | ||
@@ -641,6 +642,7 @@ void *tmem_localify_get_pampd(struct tmem_pool *pool, struct tmem_oid *oidp, | |||
641 | /* note, hashbucket remains locked */ | 642 | /* note, hashbucket remains locked */ |
642 | return pampd; | 643 | return pampd; |
643 | } | 644 | } |
645 | EXPORT_SYMBOL_GPL(tmem_localify_get_pampd); | ||
644 | 646 | ||
645 | void tmem_localify_finish(struct tmem_obj *obj, uint32_t index, | 647 | void tmem_localify_finish(struct tmem_obj *obj, uint32_t index, |
646 | void *pampd, void *saved_hb, bool delete) | 648 | void *pampd, void *saved_hb, bool delete) |
@@ -658,6 +660,7 @@ void tmem_localify_finish(struct tmem_obj *obj, uint32_t index, | |||
658 | } | 660 | } |
659 | spin_unlock(&hb->lock); | 661 | spin_unlock(&hb->lock); |
660 | } | 662 | } |
663 | EXPORT_SYMBOL_GPL(tmem_localify_finish); | ||
661 | 664 | ||
662 | /* | 665 | /* |
663 | * For ramster only. Helper function to support asynchronous tmem_get. | 666 | * For ramster only. Helper function to support asynchronous tmem_get. |
@@ -719,6 +722,7 @@ out: | |||
719 | spin_unlock(&hb->lock); | 722 | spin_unlock(&hb->lock); |
720 | return ret; | 723 | return ret; |
721 | } | 724 | } |
725 | EXPORT_SYMBOL_GPL(tmem_replace); | ||
722 | #endif | 726 | #endif |
723 | 727 | ||
724 | /* | 728 | /* |
diff --git a/drivers/staging/zcache/tmem.h b/drivers/staging/zcache/tmem.h index adbe5a8f28aa..d128ce290f1f 100644 --- a/drivers/staging/zcache/tmem.h +++ b/drivers/staging/zcache/tmem.h | |||
@@ -126,7 +126,7 @@ static inline unsigned tmem_oid_hash(struct tmem_oid *oidp) | |||
126 | TMEM_HASH_BUCKET_BITS); | 126 | TMEM_HASH_BUCKET_BITS); |
127 | } | 127 | } |
128 | 128 | ||
129 | #ifdef CONFIG_RAMSTER | 129 | #if defined(CONFIG_RAMSTER) || defined(CONFIG_RAMSTER_MODULE) |
130 | struct tmem_xhandle { | 130 | struct tmem_xhandle { |
131 | uint8_t client_id; | 131 | uint8_t client_id; |
132 | uint8_t xh_data_cksum; | 132 | uint8_t xh_data_cksum; |
@@ -171,7 +171,7 @@ struct tmem_obj { | |||
171 | unsigned int objnode_tree_height; | 171 | unsigned int objnode_tree_height; |
172 | unsigned long objnode_count; | 172 | unsigned long objnode_count; |
173 | long pampd_count; | 173 | long pampd_count; |
174 | #ifdef CONFIG_RAMSTER | 174 | #if defined(CONFIG_RAMSTER) || defined(CONFIG_RAMSTER_MODULE) |
175 | /* | 175 | /* |
176 | * for current design of ramster, all pages belonging to | 176 | * for current design of ramster, all pages belonging to |
177 | * an object reside on the same remotenode and extra is | 177 | * an object reside on the same remotenode and extra is |
@@ -215,7 +215,7 @@ struct tmem_pamops { | |||
215 | uint32_t); | 215 | uint32_t); |
216 | void (*free)(void *, struct tmem_pool *, | 216 | void (*free)(void *, struct tmem_pool *, |
217 | struct tmem_oid *, uint32_t, bool); | 217 | struct tmem_oid *, uint32_t, bool); |
218 | #ifdef CONFIG_RAMSTER | 218 | #if defined(CONFIG_RAMSTER) || defined(CONFIG_RAMSTER_MODULE) |
219 | void (*new_obj)(struct tmem_obj *); | 219 | void (*new_obj)(struct tmem_obj *); |
220 | void (*free_obj)(struct tmem_pool *, struct tmem_obj *, bool); | 220 | void (*free_obj)(struct tmem_pool *, struct tmem_obj *, bool); |
221 | void *(*repatriate_preload)(void *, struct tmem_pool *, | 221 | void *(*repatriate_preload)(void *, struct tmem_pool *, |
@@ -247,7 +247,7 @@ extern int tmem_flush_page(struct tmem_pool *, struct tmem_oid *, | |||
247 | extern int tmem_flush_object(struct tmem_pool *, struct tmem_oid *); | 247 | extern int tmem_flush_object(struct tmem_pool *, struct tmem_oid *); |
248 | extern int tmem_destroy_pool(struct tmem_pool *); | 248 | extern int tmem_destroy_pool(struct tmem_pool *); |
249 | extern void tmem_new_pool(struct tmem_pool *, uint32_t); | 249 | extern void tmem_new_pool(struct tmem_pool *, uint32_t); |
250 | #ifdef CONFIG_RAMSTER | 250 | #if defined(CONFIG_RAMSTER) || defined(CONFIG_RAMSTER_MODULE) |
251 | extern int tmem_replace(struct tmem_pool *, struct tmem_oid *, uint32_t index, | 251 | extern int tmem_replace(struct tmem_pool *, struct tmem_oid *, uint32_t index, |
252 | void *); | 252 | void *); |
253 | extern void *tmem_localify_get_pampd(struct tmem_pool *, struct tmem_oid *, | 253 | extern void *tmem_localify_get_pampd(struct tmem_pool *, struct tmem_oid *, |
diff --git a/drivers/staging/zcache/zcache-main.c b/drivers/staging/zcache/zcache-main.c index e23d814b5392..522cb8e55142 100644 --- a/drivers/staging/zcache/zcache-main.c +++ b/drivers/staging/zcache/zcache-main.c | |||
@@ -37,8 +37,10 @@ | |||
37 | #include "debug.h" | 37 | #include "debug.h" |
38 | #ifdef CONFIG_RAMSTER | 38 | #ifdef CONFIG_RAMSTER |
39 | static bool ramster_enabled __read_mostly; | 39 | static bool ramster_enabled __read_mostly; |
40 | static int disable_frontswap_selfshrink; | ||
40 | #else | 41 | #else |
41 | #define ramster_enabled false | 42 | #define ramster_enabled false |
43 | #define disable_frontswap_selfshrink 0 | ||
42 | #endif | 44 | #endif |
43 | 45 | ||
44 | #ifndef __PG_WAS_ACTIVE | 46 | #ifndef __PG_WAS_ACTIVE |
@@ -81,8 +83,12 @@ static char *namestr __read_mostly = "zcache"; | |||
81 | (__GFP_FS | __GFP_NORETRY | __GFP_NOWARN | __GFP_NOMEMALLOC) | 83 | (__GFP_FS | __GFP_NORETRY | __GFP_NOWARN | __GFP_NOMEMALLOC) |
82 | 84 | ||
83 | /* crypto API for zcache */ | 85 | /* crypto API for zcache */ |
86 | #ifdef CONFIG_ZCACHE_MODULE | ||
87 | static char *zcache_comp_name = "lzo"; | ||
88 | #else | ||
84 | #define ZCACHE_COMP_NAME_SZ CRYPTO_MAX_ALG_NAME | 89 | #define ZCACHE_COMP_NAME_SZ CRYPTO_MAX_ALG_NAME |
85 | static char zcache_comp_name[ZCACHE_COMP_NAME_SZ] __read_mostly; | 90 | static char zcache_comp_name[ZCACHE_COMP_NAME_SZ] __read_mostly; |
91 | #endif | ||
86 | static struct crypto_comp * __percpu *zcache_comp_pcpu_tfms __read_mostly; | 92 | static struct crypto_comp * __percpu *zcache_comp_pcpu_tfms __read_mostly; |
87 | 93 | ||
88 | enum comp_op { | 94 | enum comp_op { |
@@ -1576,9 +1582,9 @@ static struct cleancache_ops zcache_cleancache_ops = { | |||
1576 | .init_fs = zcache_cleancache_init_fs | 1582 | .init_fs = zcache_cleancache_init_fs |
1577 | }; | 1583 | }; |
1578 | 1584 | ||
1579 | struct cleancache_ops zcache_cleancache_register_ops(void) | 1585 | struct cleancache_ops *zcache_cleancache_register_ops(void) |
1580 | { | 1586 | { |
1581 | struct cleancache_ops old_ops = | 1587 | struct cleancache_ops *old_ops = |
1582 | cleancache_register_ops(&zcache_cleancache_ops); | 1588 | cleancache_register_ops(&zcache_cleancache_ops); |
1583 | 1589 | ||
1584 | return old_ops; | 1590 | return old_ops; |
@@ -1707,9 +1713,9 @@ static struct frontswap_ops zcache_frontswap_ops = { | |||
1707 | .init = zcache_frontswap_init | 1713 | .init = zcache_frontswap_init |
1708 | }; | 1714 | }; |
1709 | 1715 | ||
1710 | struct frontswap_ops zcache_frontswap_register_ops(void) | 1716 | struct frontswap_ops *zcache_frontswap_register_ops(void) |
1711 | { | 1717 | { |
1712 | struct frontswap_ops old_ops = | 1718 | struct frontswap_ops *old_ops = |
1713 | frontswap_register_ops(&zcache_frontswap_ops); | 1719 | frontswap_register_ops(&zcache_frontswap_ops); |
1714 | 1720 | ||
1715 | return old_ops; | 1721 | return old_ops; |
@@ -1721,6 +1727,7 @@ struct frontswap_ops zcache_frontswap_register_ops(void) | |||
1721 | * OR NOTHING HAPPENS! | 1727 | * OR NOTHING HAPPENS! |
1722 | */ | 1728 | */ |
1723 | 1729 | ||
1730 | #ifndef CONFIG_ZCACHE_MODULE | ||
1724 | static int __init enable_zcache(char *s) | 1731 | static int __init enable_zcache(char *s) |
1725 | { | 1732 | { |
1726 | zcache_enabled = true; | 1733 | zcache_enabled = true; |
@@ -1787,18 +1794,27 @@ static int __init enable_zcache_compressor(char *s) | |||
1787 | return 1; | 1794 | return 1; |
1788 | } | 1795 | } |
1789 | __setup("zcache=", enable_zcache_compressor); | 1796 | __setup("zcache=", enable_zcache_compressor); |
1797 | #endif | ||
1790 | 1798 | ||
1791 | 1799 | ||
1792 | static int __init zcache_comp_init(void) | 1800 | static int zcache_comp_init(void) |
1793 | { | 1801 | { |
1794 | int ret = 0; | 1802 | int ret = 0; |
1795 | 1803 | ||
1796 | /* check crypto algorithm */ | 1804 | /* check crypto algorithm */ |
1805 | #ifdef CONFIG_ZCACHE_MODULE | ||
1806 | ret = crypto_has_comp(zcache_comp_name, 0, 0); | ||
1807 | if (!ret) { | ||
1808 | ret = -1; | ||
1809 | goto out; | ||
1810 | } | ||
1811 | #else | ||
1797 | if (*zcache_comp_name != '\0') { | 1812 | if (*zcache_comp_name != '\0') { |
1798 | ret = crypto_has_comp(zcache_comp_name, 0, 0); | 1813 | ret = crypto_has_comp(zcache_comp_name, 0, 0); |
1799 | if (!ret) | 1814 | if (!ret) |
1800 | pr_info("zcache: %s not supported\n", | 1815 | pr_info("zcache: %s not supported\n", |
1801 | zcache_comp_name); | 1816 | zcache_comp_name); |
1817 | goto out; | ||
1802 | } | 1818 | } |
1803 | if (!ret) | 1819 | if (!ret) |
1804 | strcpy(zcache_comp_name, "lzo"); | 1820 | strcpy(zcache_comp_name, "lzo"); |
@@ -1807,6 +1823,7 @@ static int __init zcache_comp_init(void) | |||
1807 | ret = 1; | 1823 | ret = 1; |
1808 | goto out; | 1824 | goto out; |
1809 | } | 1825 | } |
1826 | #endif | ||
1810 | pr_info("zcache: using %s compressor\n", zcache_comp_name); | 1827 | pr_info("zcache: using %s compressor\n", zcache_comp_name); |
1811 | 1828 | ||
1812 | /* alloc percpu transforms */ | 1829 | /* alloc percpu transforms */ |
@@ -1818,10 +1835,13 @@ out: | |||
1818 | return ret; | 1835 | return ret; |
1819 | } | 1836 | } |
1820 | 1837 | ||
1821 | static int __init zcache_init(void) | 1838 | static int zcache_init(void) |
1822 | { | 1839 | { |
1823 | int ret = 0; | 1840 | int ret = 0; |
1824 | 1841 | ||
1842 | #ifdef CONFIG_ZCACHE_MODULE | ||
1843 | zcache_enabled = 1; | ||
1844 | #endif | ||
1825 | if (ramster_enabled) { | 1845 | if (ramster_enabled) { |
1826 | namestr = "ramster"; | 1846 | namestr = "ramster"; |
1827 | ramster_register_pamops(&zcache_pamops); | 1847 | ramster_register_pamops(&zcache_pamops); |
@@ -1860,7 +1880,7 @@ static int __init zcache_init(void) | |||
1860 | } | 1880 | } |
1861 | zbud_init(); | 1881 | zbud_init(); |
1862 | if (zcache_enabled && !disable_cleancache) { | 1882 | if (zcache_enabled && !disable_cleancache) { |
1863 | struct cleancache_ops old_ops; | 1883 | struct cleancache_ops *old_ops; |
1864 | 1884 | ||
1865 | register_shrinker(&zcache_shrinker); | 1885 | register_shrinker(&zcache_shrinker); |
1866 | old_ops = zcache_cleancache_register_ops(); | 1886 | old_ops = zcache_cleancache_register_ops(); |
@@ -1870,11 +1890,11 @@ static int __init zcache_init(void) | |||
1870 | pr_info("%s: cleancache: ignorenonactive = %d\n", | 1890 | pr_info("%s: cleancache: ignorenonactive = %d\n", |
1871 | namestr, !disable_cleancache_ignore_nonactive); | 1891 | namestr, !disable_cleancache_ignore_nonactive); |
1872 | #endif | 1892 | #endif |
1873 | if (old_ops.init_fs != NULL) | 1893 | if (old_ops != NULL) |
1874 | pr_warn("%s: cleancache_ops overridden\n", namestr); | 1894 | pr_warn("%s: cleancache_ops overridden\n", namestr); |
1875 | } | 1895 | } |
1876 | if (zcache_enabled && !disable_frontswap) { | 1896 | if (zcache_enabled && !disable_frontswap) { |
1877 | struct frontswap_ops old_ops; | 1897 | struct frontswap_ops *old_ops; |
1878 | 1898 | ||
1879 | old_ops = zcache_frontswap_register_ops(); | 1899 | old_ops = zcache_frontswap_register_ops(); |
1880 | if (frontswap_has_exclusive_gets) | 1900 | if (frontswap_has_exclusive_gets) |
@@ -1886,14 +1906,36 @@ static int __init zcache_init(void) | |||
1886 | namestr, frontswap_has_exclusive_gets, | 1906 | namestr, frontswap_has_exclusive_gets, |
1887 | !disable_frontswap_ignore_nonactive); | 1907 | !disable_frontswap_ignore_nonactive); |
1888 | #endif | 1908 | #endif |
1889 | if (old_ops.init != NULL) | 1909 | if (IS_ERR(old_ops) || old_ops) { |
1910 | if (IS_ERR(old_ops)) | ||
1911 | return PTR_RET(old_ops); | ||
1890 | pr_warn("%s: frontswap_ops overridden\n", namestr); | 1912 | pr_warn("%s: frontswap_ops overridden\n", namestr); |
1913 | } | ||
1891 | } | 1914 | } |
1892 | if (ramster_enabled) | 1915 | if (ramster_enabled) |
1893 | ramster_init(!disable_cleancache, !disable_frontswap, | 1916 | ramster_init(!disable_cleancache, !disable_frontswap, |
1894 | frontswap_has_exclusive_gets); | 1917 | frontswap_has_exclusive_gets, |
1918 | !disable_frontswap_selfshrink); | ||
1895 | out: | 1919 | out: |
1896 | return ret; | 1920 | return ret; |
1897 | } | 1921 | } |
1898 | 1922 | ||
1923 | #ifdef CONFIG_ZCACHE_MODULE | ||
1924 | #ifdef CONFIG_RAMSTER | ||
1925 | module_param(ramster_enabled, int, S_IRUGO); | ||
1926 | module_param(disable_frontswap_selfshrink, int, S_IRUGO); | ||
1927 | #endif | ||
1928 | module_param(disable_cleancache, int, S_IRUGO); | ||
1929 | module_param(disable_frontswap, int, S_IRUGO); | ||
1930 | #ifdef FRONTSWAP_HAS_EXCLUSIVE_GETS | ||
1931 | module_param(frontswap_has_exclusive_gets, bool, S_IRUGO); | ||
1932 | #endif | ||
1933 | module_param(disable_frontswap_ignore_nonactive, int, S_IRUGO); | ||
1934 | module_param(zcache_comp_name, charp, S_IRUGO); | ||
1935 | module_init(zcache_init); | ||
1936 | MODULE_LICENSE("GPL"); | ||
1937 | MODULE_AUTHOR("Dan Magenheimer <dan.magenheimer@oracle.com>"); | ||
1938 | MODULE_DESCRIPTION("In-kernel compression of cleancache/frontswap pages"); | ||
1939 | #else | ||
1899 | late_initcall(zcache_init); | 1940 | late_initcall(zcache_init); |
1941 | #endif | ||
diff --git a/drivers/staging/zcache/zcache.h b/drivers/staging/zcache/zcache.h index 81722b33b087..849120095e79 100644 --- a/drivers/staging/zcache/zcache.h +++ b/drivers/staging/zcache/zcache.h | |||
@@ -39,7 +39,7 @@ extern int zcache_flush_page(int, int, struct tmem_oid *, uint32_t); | |||
39 | extern int zcache_flush_object(int, int, struct tmem_oid *); | 39 | extern int zcache_flush_object(int, int, struct tmem_oid *); |
40 | extern void zcache_decompress_to_page(char *, unsigned int, struct page *); | 40 | extern void zcache_decompress_to_page(char *, unsigned int, struct page *); |
41 | 41 | ||
42 | #ifdef CONFIG_RAMSTER | 42 | #if defined(CONFIG_RAMSTER) || defined(CONFIG_RAMSTER_MODULE) |
43 | extern void *zcache_pampd_create(char *, unsigned int, bool, int, | 43 | extern void *zcache_pampd_create(char *, unsigned int, bool, int, |
44 | struct tmem_handle *); | 44 | struct tmem_handle *); |
45 | int zcache_autocreate_pool(unsigned int cli_id, unsigned int pool_id, bool eph); | 45 | int zcache_autocreate_pool(unsigned int cli_id, unsigned int pool_id, bool eph); |
diff --git a/drivers/usb/storage/realtek_cr.c b/drivers/usb/storage/realtek_cr.c index 4797228747fb..8623577bbbe7 100644 --- a/drivers/usb/storage/realtek_cr.c +++ b/drivers/usb/storage/realtek_cr.c | |||
@@ -933,14 +933,11 @@ static int realtek_cr_autosuspend_setup(struct us_data *us) | |||
933 | 933 | ||
934 | static void realtek_cr_destructor(void *extra) | 934 | static void realtek_cr_destructor(void *extra) |
935 | { | 935 | { |
936 | struct rts51x_chip *chip = (struct rts51x_chip *)extra; | 936 | struct rts51x_chip *chip = extra; |
937 | struct us_data *us; | ||
938 | 937 | ||
939 | if (!chip) | 938 | if (!chip) |
940 | return; | 939 | return; |
941 | 940 | ||
942 | us = chip->us; | ||
943 | |||
944 | #ifdef CONFIG_REALTEK_AUTOPM | 941 | #ifdef CONFIG_REALTEK_AUTOPM |
945 | if (ss_en) { | 942 | if (ss_en) { |
946 | del_timer(&chip->rts51x_suspend_timer); | 943 | del_timer(&chip->rts51x_suspend_timer); |
diff --git a/drivers/w1/slaves/w1_bq27000.c b/drivers/w1/slaves/w1_bq27000.c index 773dca5beafe..afbefed5f2c9 100644 --- a/drivers/w1/slaves/w1_bq27000.c +++ b/drivers/w1/slaves/w1_bq27000.c | |||
@@ -57,6 +57,8 @@ static int w1_bq27000_add_slave(struct w1_slave *sl) | |||
57 | ret = platform_device_add_data(pdev, | 57 | ret = platform_device_add_data(pdev, |
58 | &bq27000_battery_info, | 58 | &bq27000_battery_info, |
59 | sizeof(bq27000_battery_info)); | 59 | sizeof(bq27000_battery_info)); |
60 | if (ret) | ||
61 | goto pdev_add_failed; | ||
60 | pdev->dev.parent = &sl->dev; | 62 | pdev->dev.parent = &sl->dev; |
61 | 63 | ||
62 | ret = platform_device_add(pdev); | 64 | ret = platform_device_add(pdev); |
@@ -68,7 +70,7 @@ static int w1_bq27000_add_slave(struct w1_slave *sl) | |||
68 | goto success; | 70 | goto success; |
69 | 71 | ||
70 | pdev_add_failed: | 72 | pdev_add_failed: |
71 | platform_device_unregister(pdev); | 73 | platform_device_put(pdev); |
72 | success: | 74 | success: |
73 | return ret; | 75 | return ret; |
74 | } | 76 | } |
diff --git a/drivers/w1/slaves/w1_ds2760.c b/drivers/w1/slaves/w1_ds2760.c index aa7bd5fa2fa8..e86a69dc411e 100644 --- a/drivers/w1/slaves/w1_ds2760.c +++ b/drivers/w1/slaves/w1_ds2760.c | |||
@@ -148,8 +148,9 @@ static int w1_ds2760_add_slave(struct w1_slave *sl) | |||
148 | goto success; | 148 | goto success; |
149 | 149 | ||
150 | bin_attr_failed: | 150 | bin_attr_failed: |
151 | platform_device_del(pdev); | ||
151 | pdev_add_failed: | 152 | pdev_add_failed: |
152 | platform_device_unregister(pdev); | 153 | platform_device_put(pdev); |
153 | pdev_alloc_failed: | 154 | pdev_alloc_failed: |
154 | ida_simple_remove(&bat_ida, id); | 155 | ida_simple_remove(&bat_ida, id); |
155 | noid: | 156 | noid: |
diff --git a/drivers/w1/slaves/w1_ds2780.c b/drivers/w1/slaves/w1_ds2780.c index 7b09307de0ef..98ed9c49cf50 100644 --- a/drivers/w1/slaves/w1_ds2780.c +++ b/drivers/w1/slaves/w1_ds2780.c | |||
@@ -141,8 +141,9 @@ static int w1_ds2780_add_slave(struct w1_slave *sl) | |||
141 | return 0; | 141 | return 0; |
142 | 142 | ||
143 | bin_attr_failed: | 143 | bin_attr_failed: |
144 | platform_device_del(pdev); | ||
144 | pdev_add_failed: | 145 | pdev_add_failed: |
145 | platform_device_unregister(pdev); | 146 | platform_device_put(pdev); |
146 | pdev_alloc_failed: | 147 | pdev_alloc_failed: |
147 | ida_simple_remove(&bat_ida, id); | 148 | ida_simple_remove(&bat_ida, id); |
148 | noid: | 149 | noid: |
diff --git a/drivers/w1/slaves/w1_ds2781.c b/drivers/w1/slaves/w1_ds2781.c index 877daf74159c..5140d7be67ab 100644 --- a/drivers/w1/slaves/w1_ds2781.c +++ b/drivers/w1/slaves/w1_ds2781.c | |||
@@ -139,8 +139,9 @@ static int w1_ds2781_add_slave(struct w1_slave *sl) | |||
139 | return 0; | 139 | return 0; |
140 | 140 | ||
141 | bin_attr_failed: | 141 | bin_attr_failed: |
142 | platform_device_del(pdev); | ||
142 | pdev_add_failed: | 143 | pdev_add_failed: |
143 | platform_device_unregister(pdev); | 144 | platform_device_put(pdev); |
144 | pdev_alloc_failed: | 145 | pdev_alloc_failed: |
145 | ida_simple_remove(&bat_ida, id); | 146 | ida_simple_remove(&bat_ida, id); |
146 | noid: | 147 | noid: |
diff --git a/drivers/xen/Kconfig b/drivers/xen/Kconfig index 67af155cf602..dd4d9cb86243 100644 --- a/drivers/xen/Kconfig +++ b/drivers/xen/Kconfig | |||
@@ -145,9 +145,9 @@ config SWIOTLB_XEN | |||
145 | select SWIOTLB | 145 | select SWIOTLB |
146 | 146 | ||
147 | config XEN_TMEM | 147 | config XEN_TMEM |
148 | bool | 148 | tristate |
149 | depends on !ARM | 149 | depends on !ARM |
150 | default y if (CLEANCACHE || FRONTSWAP) | 150 | default m if (CLEANCACHE || FRONTSWAP) |
151 | help | 151 | help |
152 | Shim to interface in-kernel Transcendent Memory hooks | 152 | Shim to interface in-kernel Transcendent Memory hooks |
153 | (e.g. cleancache and frontswap) to Xen tmem hypercalls. | 153 | (e.g. cleancache and frontswap) to Xen tmem hypercalls. |
diff --git a/drivers/xen/tmem.c b/drivers/xen/tmem.c index 3ee836d42581..e3600be4e7fa 100644 --- a/drivers/xen/tmem.c +++ b/drivers/xen/tmem.c | |||
@@ -5,6 +5,7 @@ | |||
5 | * Author: Dan Magenheimer | 5 | * Author: Dan Magenheimer |
6 | */ | 6 | */ |
7 | 7 | ||
8 | #include <linux/module.h> | ||
8 | #include <linux/kernel.h> | 9 | #include <linux/kernel.h> |
9 | #include <linux/types.h> | 10 | #include <linux/types.h> |
10 | #include <linux/init.h> | 11 | #include <linux/init.h> |
@@ -128,6 +129,7 @@ static int xen_tmem_flush_object(u32 pool_id, struct tmem_oid oid) | |||
128 | return xen_tmem_op(TMEM_FLUSH_OBJECT, pool_id, oid, 0, 0, 0, 0, 0); | 129 | return xen_tmem_op(TMEM_FLUSH_OBJECT, pool_id, oid, 0, 0, 0, 0, 0); |
129 | } | 130 | } |
130 | 131 | ||
132 | #ifndef CONFIG_XEN_TMEM_MODULE | ||
131 | bool __read_mostly tmem_enabled = false; | 133 | bool __read_mostly tmem_enabled = false; |
132 | 134 | ||
133 | static int __init enable_tmem(char *s) | 135 | static int __init enable_tmem(char *s) |
@@ -136,6 +138,7 @@ static int __init enable_tmem(char *s) | |||
136 | return 1; | 138 | return 1; |
137 | } | 139 | } |
138 | __setup("tmem", enable_tmem); | 140 | __setup("tmem", enable_tmem); |
141 | #endif | ||
139 | 142 | ||
140 | #ifdef CONFIG_CLEANCACHE | 143 | #ifdef CONFIG_CLEANCACHE |
141 | static int xen_tmem_destroy_pool(u32 pool_id) | 144 | static int xen_tmem_destroy_pool(u32 pool_id) |
@@ -227,16 +230,21 @@ static int tmem_cleancache_init_shared_fs(char *uuid, size_t pagesize) | |||
227 | return xen_tmem_new_pool(shared_uuid, TMEM_POOL_SHARED, pagesize); | 230 | return xen_tmem_new_pool(shared_uuid, TMEM_POOL_SHARED, pagesize); |
228 | } | 231 | } |
229 | 232 | ||
230 | static bool __initdata use_cleancache = true; | 233 | static bool disable_cleancache __read_mostly; |
231 | 234 | static bool disable_selfballooning __read_mostly; | |
235 | #ifdef CONFIG_XEN_TMEM_MODULE | ||
236 | module_param(disable_cleancache, bool, S_IRUGO); | ||
237 | module_param(disable_selfballooning, bool, S_IRUGO); | ||
238 | #else | ||
232 | static int __init no_cleancache(char *s) | 239 | static int __init no_cleancache(char *s) |
233 | { | 240 | { |
234 | use_cleancache = false; | 241 | disable_cleancache = true; |
235 | return 1; | 242 | return 1; |
236 | } | 243 | } |
237 | __setup("nocleancache", no_cleancache); | 244 | __setup("nocleancache", no_cleancache); |
245 | #endif | ||
238 | 246 | ||
239 | static struct cleancache_ops __initdata tmem_cleancache_ops = { | 247 | static struct cleancache_ops tmem_cleancache_ops = { |
240 | .put_page = tmem_cleancache_put_page, | 248 | .put_page = tmem_cleancache_put_page, |
241 | .get_page = tmem_cleancache_get_page, | 249 | .get_page = tmem_cleancache_get_page, |
242 | .invalidate_page = tmem_cleancache_flush_page, | 250 | .invalidate_page = tmem_cleancache_flush_page, |
@@ -353,54 +361,71 @@ static void tmem_frontswap_init(unsigned ignored) | |||
353 | xen_tmem_new_pool(private, TMEM_POOL_PERSIST, PAGE_SIZE); | 361 | xen_tmem_new_pool(private, TMEM_POOL_PERSIST, PAGE_SIZE); |
354 | } | 362 | } |
355 | 363 | ||
356 | static bool __initdata use_frontswap = true; | 364 | static bool disable_frontswap __read_mostly; |
357 | 365 | static bool disable_frontswap_selfshrinking __read_mostly; | |
366 | #ifdef CONFIG_XEN_TMEM_MODULE | ||
367 | module_param(disable_frontswap, bool, S_IRUGO); | ||
368 | module_param(disable_frontswap_selfshrinking, bool, S_IRUGO); | ||
369 | #else | ||
358 | static int __init no_frontswap(char *s) | 370 | static int __init no_frontswap(char *s) |
359 | { | 371 | { |
360 | use_frontswap = false; | 372 | disable_frontswap = true; |
361 | return 1; | 373 | return 1; |
362 | } | 374 | } |
363 | __setup("nofrontswap", no_frontswap); | 375 | __setup("nofrontswap", no_frontswap); |
376 | #endif | ||
364 | 377 | ||
365 | static struct frontswap_ops __initdata tmem_frontswap_ops = { | 378 | static struct frontswap_ops tmem_frontswap_ops = { |
366 | .store = tmem_frontswap_store, | 379 | .store = tmem_frontswap_store, |
367 | .load = tmem_frontswap_load, | 380 | .load = tmem_frontswap_load, |
368 | .invalidate_page = tmem_frontswap_flush_page, | 381 | .invalidate_page = tmem_frontswap_flush_page, |
369 | .invalidate_area = tmem_frontswap_flush_area, | 382 | .invalidate_area = tmem_frontswap_flush_area, |
370 | .init = tmem_frontswap_init | 383 | .init = tmem_frontswap_init |
371 | }; | 384 | }; |
385 | #else /* CONFIG_FRONTSWAP */ | ||
386 | #define disable_frontswap_selfshrinking 1 | ||
372 | #endif | 387 | #endif |
373 | 388 | ||
374 | static int __init xen_tmem_init(void) | 389 | static int xen_tmem_init(void) |
375 | { | 390 | { |
376 | if (!xen_domain()) | 391 | if (!xen_domain()) |
377 | return 0; | 392 | return 0; |
378 | #ifdef CONFIG_FRONTSWAP | 393 | #ifdef CONFIG_FRONTSWAP |
379 | if (tmem_enabled && use_frontswap) { | 394 | if (tmem_enabled && !disable_frontswap) { |
380 | char *s = ""; | 395 | char *s = ""; |
381 | struct frontswap_ops old_ops = | 396 | struct frontswap_ops *old_ops = |
382 | frontswap_register_ops(&tmem_frontswap_ops); | 397 | frontswap_register_ops(&tmem_frontswap_ops); |
383 | 398 | ||
384 | tmem_frontswap_poolid = -1; | 399 | tmem_frontswap_poolid = -1; |
385 | if (old_ops.init != NULL) | 400 | if (IS_ERR(old_ops) || old_ops) { |
401 | if (IS_ERR(old_ops)) | ||
402 | return PTR_ERR(old_ops); | ||
386 | s = " (WARNING: frontswap_ops overridden)"; | 403 | s = " (WARNING: frontswap_ops overridden)"; |
404 | } | ||
387 | printk(KERN_INFO "frontswap enabled, RAM provided by " | 405 | printk(KERN_INFO "frontswap enabled, RAM provided by " |
388 | "Xen Transcendent Memory%s\n", s); | 406 | "Xen Transcendent Memory%s\n", s); |
389 | } | 407 | } |
390 | #endif | 408 | #endif |
391 | #ifdef CONFIG_CLEANCACHE | 409 | #ifdef CONFIG_CLEANCACHE |
392 | BUG_ON(sizeof(struct cleancache_filekey) != sizeof(struct tmem_oid)); | 410 | BUG_ON(sizeof(struct cleancache_filekey) != sizeof(struct tmem_oid)); |
393 | if (tmem_enabled && use_cleancache) { | 411 | if (tmem_enabled && !disable_cleancache) { |
394 | char *s = ""; | 412 | char *s = ""; |
395 | struct cleancache_ops old_ops = | 413 | struct cleancache_ops *old_ops = |
396 | cleancache_register_ops(&tmem_cleancache_ops); | 414 | cleancache_register_ops(&tmem_cleancache_ops); |
397 | if (old_ops.init_fs != NULL) | 415 | if (old_ops) |
398 | s = " (WARNING: cleancache_ops overridden)"; | 416 | s = " (WARNING: cleancache_ops overridden)"; |
399 | printk(KERN_INFO "cleancache enabled, RAM provided by " | 417 | printk(KERN_INFO "cleancache enabled, RAM provided by " |
400 | "Xen Transcendent Memory%s\n", s); | 418 | "Xen Transcendent Memory%s\n", s); |
401 | } | 419 | } |
402 | #endif | 420 | #endif |
421 | #ifdef CONFIG_XEN_SELFBALLOONING | ||
422 | xen_selfballoon_init(!disable_selfballooning, | ||
423 | !disable_frontswap_selfshrinking); | ||
424 | #endif | ||
403 | return 0; | 425 | return 0; |
404 | } | 426 | } |
405 | 427 | ||
406 | module_init(xen_tmem_init) | 428 | module_init(xen_tmem_init) |
429 | MODULE_LICENSE("GPL"); | ||
430 | MODULE_AUTHOR("Dan Magenheimer <dan.magenheimer@oracle.com>"); | ||
431 | MODULE_DESCRIPTION("Shim to Xen transcendent memory"); | ||
diff --git a/drivers/xen/xen-selfballoon.c b/drivers/xen/xen-selfballoon.c index 2552d3e0a70f..f2ef569c7cc1 100644 --- a/drivers/xen/xen-selfballoon.c +++ b/drivers/xen/xen-selfballoon.c | |||
@@ -121,7 +121,7 @@ static DECLARE_DELAYED_WORK(selfballoon_worker, selfballoon_process); | |||
121 | static bool frontswap_selfshrinking __read_mostly; | 121 | static bool frontswap_selfshrinking __read_mostly; |
122 | 122 | ||
123 | /* Enable/disable with kernel boot option. */ | 123 | /* Enable/disable with kernel boot option. */ |
124 | static bool use_frontswap_selfshrink __initdata = true; | 124 | static bool use_frontswap_selfshrink = true; |
125 | 125 | ||
126 | /* | 126 | /* |
127 | * The default values for the following parameters were deemed reasonable | 127 | * The default values for the following parameters were deemed reasonable |
@@ -185,7 +185,7 @@ static int __init xen_nofrontswap_selfshrink_setup(char *s) | |||
185 | __setup("noselfshrink", xen_nofrontswap_selfshrink_setup); | 185 | __setup("noselfshrink", xen_nofrontswap_selfshrink_setup); |
186 | 186 | ||
187 | /* Disable with kernel boot option. */ | 187 | /* Disable with kernel boot option. */ |
188 | static bool use_selfballooning __initdata = true; | 188 | static bool use_selfballooning = true; |
189 | 189 | ||
190 | static int __init xen_noselfballooning_setup(char *s) | 190 | static int __init xen_noselfballooning_setup(char *s) |
191 | { | 191 | { |
@@ -196,7 +196,7 @@ static int __init xen_noselfballooning_setup(char *s) | |||
196 | __setup("noselfballooning", xen_noselfballooning_setup); | 196 | __setup("noselfballooning", xen_noselfballooning_setup); |
197 | #else /* !CONFIG_FRONTSWAP */ | 197 | #else /* !CONFIG_FRONTSWAP */ |
198 | /* Enable with kernel boot option. */ | 198 | /* Enable with kernel boot option. */ |
199 | static bool use_selfballooning __initdata = false; | 199 | static bool use_selfballooning; |
200 | 200 | ||
201 | static int __init xen_selfballooning_setup(char *s) | 201 | static int __init xen_selfballooning_setup(char *s) |
202 | { | 202 | { |
@@ -537,7 +537,7 @@ int register_xen_selfballooning(struct device *dev) | |||
537 | } | 537 | } |
538 | EXPORT_SYMBOL(register_xen_selfballooning); | 538 | EXPORT_SYMBOL(register_xen_selfballooning); |
539 | 539 | ||
540 | static int __init xen_selfballoon_init(void) | 540 | int xen_selfballoon_init(bool use_selfballooning, bool use_frontswap_selfshrink) |
541 | { | 541 | { |
542 | bool enable = false; | 542 | bool enable = false; |
543 | 543 | ||
@@ -571,7 +571,4 @@ static int __init xen_selfballoon_init(void) | |||
571 | 571 | ||
572 | return 0; | 572 | return 0; |
573 | } | 573 | } |
574 | 574 | EXPORT_SYMBOL(xen_selfballoon_init); | |
575 | subsys_initcall(xen_selfballoon_init); | ||
576 | |||
577 | MODULE_LICENSE("GPL"); | ||