diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2015-05-05 21:52:13 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-05-05 21:52:13 -0400 |
| commit | 2a171aa21afcd43f6cee574154d8c8db905351e5 (patch) | |
| tree | 4dbf5b0927c3337dd706cdc9d3c050e072005f53 | |
| parent | 3ce05a4e740539a3e9d48456e2b046b7240df3ff (diff) | |
| parent | 489405fe5ed38e65f6f82f131a39c67f3bae6045 (diff) | |
Merge branch 'akpm' (patches from Andrew)
Merge misc fixes from Andrew Morton:
"16 patches
This includes a new rtc driver for the Abracon AB x80x and isn't very
appropriate for -rc2. It was still being fiddled with a bit during
the merge window and I fell asleep during -rc1"
[ So I took the new driver, it seems small and won't regress anything.
I'm a softy. - Linus ]
* emailed patches from Andrew Morton <akpm@linux-foundation.org>:
rtc: armada38x: fix concurrency access in armada38x_rtc_set_time
ocfs2: dlm: fix race between purge and get lock resource
nilfs2: fix sanity check of btree level in nilfs_btree_root_broken()
util_macros.h: have array pointer point to array of constants
configfs: init configfs module earlier at boot time
mm/hwpoison-inject: check PageLRU of hpage
mm/hwpoison-inject: fix refcounting in no-injection case
mm: soft-offline: fix num_poisoned_pages counting on concurrent events
rtc: add rtc-abx80x, a driver for the Abracon AB x80x i2c rtc
Documentation: bindings: add abracon,abx80x
kasan: show gcc version requirements in Kconfig and Documentation
mm/memory-failure: call shake_page() when error hits thp tail page
lib: delete lib/find_last_bit.c
MAINTAINERS: add co-maintainer for LED subsystem
zram: add Designated Reviewer for zram in MAINTAINERS
revert "zram: move compact_store() to sysfs functions area"
| -rw-r--r-- | Documentation/devicetree/bindings/rtc/abracon,abx80x.txt | 30 | ||||
| -rw-r--r-- | Documentation/kasan.txt | 8 | ||||
| -rw-r--r-- | MAINTAINERS | 2 | ||||
| -rw-r--r-- | drivers/block/zram/zram_drv.c | 23 | ||||
| -rw-r--r-- | drivers/rtc/Kconfig | 10 | ||||
| -rw-r--r-- | drivers/rtc/Makefile | 1 | ||||
| -rw-r--r-- | drivers/rtc/rtc-abx80x.c | 307 | ||||
| -rw-r--r-- | drivers/rtc/rtc-armada38x.c | 24 | ||||
| -rw-r--r-- | fs/configfs/mount.c | 2 | ||||
| -rw-r--r-- | fs/nilfs2/btree.c | 2 | ||||
| -rw-r--r-- | fs/ocfs2/dlm/dlmmaster.c | 13 | ||||
| -rw-r--r-- | include/linux/nilfs2_fs.h | 2 | ||||
| -rw-r--r-- | include/linux/util_macros.h | 2 | ||||
| -rw-r--r-- | lib/Kconfig.kasan | 8 | ||||
| -rw-r--r-- | lib/find_last_bit.c | 41 | ||||
| -rw-r--r-- | mm/hwpoison-inject.c | 13 | ||||
| -rw-r--r-- | mm/memory-failure.c | 16 |
17 files changed, 429 insertions, 75 deletions
diff --git a/Documentation/devicetree/bindings/rtc/abracon,abx80x.txt b/Documentation/devicetree/bindings/rtc/abracon,abx80x.txt new file mode 100644 index 000000000000..be789685a1c2 --- /dev/null +++ b/Documentation/devicetree/bindings/rtc/abracon,abx80x.txt | |||
| @@ -0,0 +1,30 @@ | |||
| 1 | Abracon ABX80X I2C ultra low power RTC/Alarm chip | ||
| 2 | |||
| 3 | The Abracon ABX80X family consist of the ab0801, ab0803, ab0804, ab0805, ab1801, | ||
| 4 | ab1803, ab1804 and ab1805. The ab0805 is the superset of ab080x and the ab1805 | ||
| 5 | is the superset of ab180x. | ||
| 6 | |||
| 7 | Required properties: | ||
| 8 | |||
| 9 | - "compatible": should one of: | ||
| 10 | "abracon,abx80x" | ||
| 11 | "abracon,ab0801" | ||
| 12 | "abracon,ab0803" | ||
| 13 | "abracon,ab0804" | ||
| 14 | "abracon,ab0805" | ||
| 15 | "abracon,ab1801" | ||
| 16 | "abracon,ab1803" | ||
| 17 | "abracon,ab1804" | ||
| 18 | "abracon,ab1805" | ||
| 19 | Using "abracon,abx80x" will enable chip autodetection. | ||
| 20 | - "reg": I2C bus address of the device | ||
| 21 | |||
| 22 | Optional properties: | ||
| 23 | |||
| 24 | The abx804 and abx805 have a trickle charger that is able to charge the | ||
| 25 | connected battery or supercap. Both the following properties have to be defined | ||
| 26 | and valid to enable charging: | ||
| 27 | |||
| 28 | - "abracon,tc-diode": should be "standard" (0.6V) or "schottky" (0.3V) | ||
| 29 | - "abracon,tc-resistor": should be <0>, <3>, <6> or <11>. 0 disables the output | ||
| 30 | resistor, the other values are in ohm. | ||
diff --git a/Documentation/kasan.txt b/Documentation/kasan.txt index 092fc10961fe..4692241789b1 100644 --- a/Documentation/kasan.txt +++ b/Documentation/kasan.txt | |||
| @@ -9,7 +9,9 @@ a fast and comprehensive solution for finding use-after-free and out-of-bounds | |||
| 9 | bugs. | 9 | bugs. |
| 10 | 10 | ||
| 11 | KASan uses compile-time instrumentation for checking every memory access, | 11 | KASan uses compile-time instrumentation for checking every memory access, |
| 12 | therefore you will need a certain version of GCC > 4.9.2 | 12 | therefore you will need a gcc version of 4.9.2 or later. KASan could detect out |
| 13 | of bounds accesses to stack or global variables, but only if gcc 5.0 or later was | ||
| 14 | used to built the kernel. | ||
| 13 | 15 | ||
| 14 | Currently KASan is supported only for x86_64 architecture and requires that the | 16 | Currently KASan is supported only for x86_64 architecture and requires that the |
| 15 | kernel be built with the SLUB allocator. | 17 | kernel be built with the SLUB allocator. |
| @@ -23,8 +25,8 @@ To enable KASAN configure kernel with: | |||
| 23 | 25 | ||
| 24 | and choose between CONFIG_KASAN_OUTLINE and CONFIG_KASAN_INLINE. Outline/inline | 26 | and choose between CONFIG_KASAN_OUTLINE and CONFIG_KASAN_INLINE. Outline/inline |
| 25 | is compiler instrumentation types. The former produces smaller binary the | 27 | is compiler instrumentation types. The former produces smaller binary the |
| 26 | latter is 1.1 - 2 times faster. Inline instrumentation requires GCC 5.0 or | 28 | latter is 1.1 - 2 times faster. Inline instrumentation requires a gcc version |
| 27 | latter. | 29 | of 5.0 or later. |
| 28 | 30 | ||
| 29 | Currently KASAN works only with the SLUB memory allocator. | 31 | Currently KASAN works only with the SLUB memory allocator. |
| 30 | For better bug detection and nicer report, enable CONFIG_STACKTRACE and put | 32 | For better bug detection and nicer report, enable CONFIG_STACKTRACE and put |
diff --git a/MAINTAINERS b/MAINTAINERS index 781e099495d3..b399b34a2496 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
| @@ -5805,6 +5805,7 @@ F: drivers/scsi/53c700* | |||
| 5805 | LED SUBSYSTEM | 5805 | LED SUBSYSTEM |
| 5806 | M: Bryan Wu <cooloney@gmail.com> | 5806 | M: Bryan Wu <cooloney@gmail.com> |
| 5807 | M: Richard Purdie <rpurdie@rpsys.net> | 5807 | M: Richard Purdie <rpurdie@rpsys.net> |
| 5808 | M: Jacek Anaszewski <j.anaszewski@samsung.com> | ||
| 5808 | L: linux-leds@vger.kernel.org | 5809 | L: linux-leds@vger.kernel.org |
| 5809 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/cooloney/linux-leds.git | 5810 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/cooloney/linux-leds.git |
| 5810 | S: Maintained | 5811 | S: Maintained |
| @@ -11037,6 +11038,7 @@ F: drivers/media/pci/zoran/ | |||
| 11037 | ZRAM COMPRESSED RAM BLOCK DEVICE DRVIER | 11038 | ZRAM COMPRESSED RAM BLOCK DEVICE DRVIER |
| 11038 | M: Minchan Kim <minchan@kernel.org> | 11039 | M: Minchan Kim <minchan@kernel.org> |
| 11039 | M: Nitin Gupta <ngupta@vflare.org> | 11040 | M: Nitin Gupta <ngupta@vflare.org> |
| 11041 | R: Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> | ||
| 11040 | L: linux-kernel@vger.kernel.org | 11042 | L: linux-kernel@vger.kernel.org |
| 11041 | S: Maintained | 11043 | S: Maintained |
| 11042 | F: drivers/block/zram/ | 11044 | F: drivers/block/zram/ |
diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c index c94386aa563d..8dcbced0eafd 100644 --- a/drivers/block/zram/zram_drv.c +++ b/drivers/block/zram/zram_drv.c | |||
| @@ -74,6 +74,27 @@ static inline struct zram *dev_to_zram(struct device *dev) | |||
| 74 | return (struct zram *)dev_to_disk(dev)->private_data; | 74 | return (struct zram *)dev_to_disk(dev)->private_data; |
| 75 | } | 75 | } |
| 76 | 76 | ||
| 77 | static ssize_t compact_store(struct device *dev, | ||
| 78 | struct device_attribute *attr, const char *buf, size_t len) | ||
| 79 | { | ||
| 80 | unsigned long nr_migrated; | ||
| 81 | struct zram *zram = dev_to_zram(dev); | ||
| 82 | struct zram_meta *meta; | ||
| 83 | |||
| 84 | down_read(&zram->init_lock); | ||
| 85 | if (!init_done(zram)) { | ||
| 86 | up_read(&zram->init_lock); | ||
| 87 | return -EINVAL; | ||
| 88 | } | ||
| 89 | |||
| 90 | meta = zram->meta; | ||
| 91 | nr_migrated = zs_compact(meta->mem_pool); | ||
| 92 | atomic64_add(nr_migrated, &zram->stats.num_migrated); | ||
| 93 | up_read(&zram->init_lock); | ||
| 94 | |||
| 95 | return len; | ||
| 96 | } | ||
| 97 | |||
| 77 | static ssize_t disksize_show(struct device *dev, | 98 | static ssize_t disksize_show(struct device *dev, |
| 78 | struct device_attribute *attr, char *buf) | 99 | struct device_attribute *attr, char *buf) |
| 79 | { | 100 | { |
| @@ -1038,6 +1059,7 @@ static const struct block_device_operations zram_devops = { | |||
| 1038 | .owner = THIS_MODULE | 1059 | .owner = THIS_MODULE |
| 1039 | }; | 1060 | }; |
| 1040 | 1061 | ||
| 1062 | static DEVICE_ATTR_WO(compact); | ||
| 1041 | static DEVICE_ATTR_RW(disksize); | 1063 | static DEVICE_ATTR_RW(disksize); |
| 1042 | static DEVICE_ATTR_RO(initstate); | 1064 | static DEVICE_ATTR_RO(initstate); |
| 1043 | static DEVICE_ATTR_WO(reset); | 1065 | static DEVICE_ATTR_WO(reset); |
| @@ -1114,6 +1136,7 @@ static struct attribute *zram_disk_attrs[] = { | |||
| 1114 | &dev_attr_num_writes.attr, | 1136 | &dev_attr_num_writes.attr, |
| 1115 | &dev_attr_failed_reads.attr, | 1137 | &dev_attr_failed_reads.attr, |
| 1116 | &dev_attr_failed_writes.attr, | 1138 | &dev_attr_failed_writes.attr, |
| 1139 | &dev_attr_compact.attr, | ||
| 1117 | &dev_attr_invalid_io.attr, | 1140 | &dev_attr_invalid_io.attr, |
| 1118 | &dev_attr_notify_free.attr, | 1141 | &dev_attr_notify_free.attr, |
| 1119 | &dev_attr_zero_pages.attr, | 1142 | &dev_attr_zero_pages.attr, |
diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig index 6149ae01e11f..0fe4ad8826b2 100644 --- a/drivers/rtc/Kconfig +++ b/drivers/rtc/Kconfig | |||
| @@ -164,6 +164,16 @@ config RTC_DRV_ABB5ZES3 | |||
| 164 | This driver can also be built as a module. If so, the module | 164 | This driver can also be built as a module. If so, the module |
| 165 | will be called rtc-ab-b5ze-s3. | 165 | will be called rtc-ab-b5ze-s3. |
| 166 | 166 | ||
| 167 | config RTC_DRV_ABX80X | ||
| 168 | tristate "Abracon ABx80x" | ||
| 169 | help | ||
| 170 | If you say yes here you get support for Abracon AB080X and AB180X | ||
| 171 | families of ultra-low-power battery- and capacitor-backed real-time | ||
| 172 | clock chips. | ||
| 173 | |||
| 174 | This driver can also be built as a module. If so, the module | ||
| 175 | will be called rtc-abx80x. | ||
| 176 | |||
| 167 | config RTC_DRV_AS3722 | 177 | config RTC_DRV_AS3722 |
| 168 | tristate "ams AS3722 RTC driver" | 178 | tristate "ams AS3722 RTC driver" |
| 169 | depends on MFD_AS3722 | 179 | depends on MFD_AS3722 |
diff --git a/drivers/rtc/Makefile b/drivers/rtc/Makefile index c31731c29762..2b82e2b0311b 100644 --- a/drivers/rtc/Makefile +++ b/drivers/rtc/Makefile | |||
| @@ -25,6 +25,7 @@ obj-$(CONFIG_RTC_DRV_88PM80X) += rtc-88pm80x.o | |||
| 25 | obj-$(CONFIG_RTC_DRV_AB3100) += rtc-ab3100.o | 25 | obj-$(CONFIG_RTC_DRV_AB3100) += rtc-ab3100.o |
| 26 | obj-$(CONFIG_RTC_DRV_AB8500) += rtc-ab8500.o | 26 | obj-$(CONFIG_RTC_DRV_AB8500) += rtc-ab8500.o |
| 27 | obj-$(CONFIG_RTC_DRV_ABB5ZES3) += rtc-ab-b5ze-s3.o | 27 | obj-$(CONFIG_RTC_DRV_ABB5ZES3) += rtc-ab-b5ze-s3.o |
| 28 | obj-$(CONFIG_RTC_DRV_ABX80X) += rtc-abx80x.o | ||
| 28 | obj-$(CONFIG_RTC_DRV_ARMADA38X) += rtc-armada38x.o | 29 | obj-$(CONFIG_RTC_DRV_ARMADA38X) += rtc-armada38x.o |
| 29 | obj-$(CONFIG_RTC_DRV_AS3722) += rtc-as3722.o | 30 | obj-$(CONFIG_RTC_DRV_AS3722) += rtc-as3722.o |
| 30 | obj-$(CONFIG_RTC_DRV_AT32AP700X)+= rtc-at32ap700x.o | 31 | obj-$(CONFIG_RTC_DRV_AT32AP700X)+= rtc-at32ap700x.o |
diff --git a/drivers/rtc/rtc-abx80x.c b/drivers/rtc/rtc-abx80x.c new file mode 100644 index 000000000000..4337c3bc6ace --- /dev/null +++ b/drivers/rtc/rtc-abx80x.c | |||
| @@ -0,0 +1,307 @@ | |||
| 1 | /* | ||
| 2 | * A driver for the I2C members of the Abracon AB x8xx RTC family, | ||
| 3 | * and compatible: AB 1805 and AB 0805 | ||
| 4 | * | ||
| 5 | * Copyright 2014-2015 Macq S.A. | ||
| 6 | * | ||
| 7 | * Author: Philippe De Muyter <phdm@macqel.be> | ||
| 8 | * Author: Alexandre Belloni <alexandre.belloni@free-electrons.com> | ||
| 9 | * | ||
| 10 | * This program is free software; you can redistribute it and/or modify | ||
| 11 | * it under the terms of the GNU General Public License version 2 as | ||
| 12 | * published by the Free Software Foundation. | ||
| 13 | * | ||
| 14 | */ | ||
| 15 | |||
| 16 | #include <linux/bcd.h> | ||
| 17 | #include <linux/i2c.h> | ||
| 18 | #include <linux/module.h> | ||
| 19 | #include <linux/rtc.h> | ||
| 20 | |||
| 21 | #define ABX8XX_REG_HTH 0x00 | ||
| 22 | #define ABX8XX_REG_SC 0x01 | ||
| 23 | #define ABX8XX_REG_MN 0x02 | ||
| 24 | #define ABX8XX_REG_HR 0x03 | ||
| 25 | #define ABX8XX_REG_DA 0x04 | ||
| 26 | #define ABX8XX_REG_MO 0x05 | ||
| 27 | #define ABX8XX_REG_YR 0x06 | ||
| 28 | #define ABX8XX_REG_WD 0x07 | ||
| 29 | |||
| 30 | #define ABX8XX_REG_CTRL1 0x10 | ||
| 31 | #define ABX8XX_CTRL_WRITE BIT(1) | ||
| 32 | #define ABX8XX_CTRL_12_24 BIT(6) | ||
| 33 | |||
| 34 | #define ABX8XX_REG_CFG_KEY 0x1f | ||
| 35 | #define ABX8XX_CFG_KEY_MISC 0x9d | ||
| 36 | |||
| 37 | #define ABX8XX_REG_ID0 0x28 | ||
| 38 | |||
| 39 | #define ABX8XX_REG_TRICKLE 0x20 | ||
| 40 | #define ABX8XX_TRICKLE_CHARGE_ENABLE 0xa0 | ||
| 41 | #define ABX8XX_TRICKLE_STANDARD_DIODE 0x8 | ||
| 42 | #define ABX8XX_TRICKLE_SCHOTTKY_DIODE 0x4 | ||
| 43 | |||
| 44 | static u8 trickle_resistors[] = {0, 3, 6, 11}; | ||
| 45 | |||
| 46 | enum abx80x_chip {AB0801, AB0803, AB0804, AB0805, | ||
| 47 | AB1801, AB1803, AB1804, AB1805, ABX80X}; | ||
| 48 | |||
| 49 | struct abx80x_cap { | ||
| 50 | u16 pn; | ||
| 51 | bool has_tc; | ||
| 52 | }; | ||
| 53 | |||
| 54 | static struct abx80x_cap abx80x_caps[] = { | ||
| 55 | [AB0801] = {.pn = 0x0801}, | ||
| 56 | [AB0803] = {.pn = 0x0803}, | ||
| 57 | [AB0804] = {.pn = 0x0804, .has_tc = true}, | ||
| 58 | [AB0805] = {.pn = 0x0805, .has_tc = true}, | ||
| 59 | [AB1801] = {.pn = 0x1801}, | ||
| 60 | [AB1803] = {.pn = 0x1803}, | ||
| 61 | [AB1804] = {.pn = 0x1804, .has_tc = true}, | ||
| 62 | [AB1805] = {.pn = 0x1805, .has_tc = true}, | ||
| 63 | [ABX80X] = {.pn = 0} | ||
| 64 | }; | ||
| 65 | |||
| 66 | static struct i2c_driver abx80x_driver; | ||
| 67 | |||
| 68 | static int abx80x_enable_trickle_charger(struct i2c_client *client, | ||
| 69 | u8 trickle_cfg) | ||
| 70 | { | ||
| 71 | int err; | ||
| 72 | |||
| 73 | /* | ||
| 74 | * Write the configuration key register to enable access to the Trickle | ||
| 75 | * register | ||
| 76 | */ | ||
| 77 | err = i2c_smbus_write_byte_data(client, ABX8XX_REG_CFG_KEY, | ||
| 78 | ABX8XX_CFG_KEY_MISC); | ||
| 79 | if (err < 0) { | ||
| 80 | dev_err(&client->dev, "Unable to write configuration key\n"); | ||
| 81 | return -EIO; | ||
| 82 | } | ||
| 83 | |||
| 84 | err = i2c_smbus_write_byte_data(client, ABX8XX_REG_TRICKLE, | ||
| 85 | ABX8XX_TRICKLE_CHARGE_ENABLE | | ||
| 86 | trickle_cfg); | ||
| 87 | if (err < 0) { | ||
| 88 | dev_err(&client->dev, "Unable to write trickle register\n"); | ||
| 89 | return -EIO; | ||
| 90 | } | ||
| 91 | |||
| 92 | return 0; | ||
| 93 | } | ||
| 94 | |||
| 95 | static int abx80x_rtc_read_time(struct device *dev, struct rtc_time *tm) | ||
| 96 | { | ||
| 97 | struct i2c_client *client = to_i2c_client(dev); | ||
| 98 | unsigned char buf[8]; | ||
| 99 | int err; | ||
| 100 | |||
| 101 | err = i2c_smbus_read_i2c_block_data(client, ABX8XX_REG_HTH, | ||
| 102 | sizeof(buf), buf); | ||
| 103 | if (err < 0) { | ||
| 104 | dev_err(&client->dev, "Unable to read date\n"); | ||
| 105 | return -EIO; | ||
| 106 | } | ||
| 107 | |||
| 108 | tm->tm_sec = bcd2bin(buf[ABX8XX_REG_SC] & 0x7F); | ||
| 109 | tm->tm_min = bcd2bin(buf[ABX8XX_REG_MN] & 0x7F); | ||
| 110 | tm->tm_hour = bcd2bin(buf[ABX8XX_REG_HR] & 0x3F); | ||
| 111 | tm->tm_wday = buf[ABX8XX_REG_WD] & 0x7; | ||
| 112 | tm->tm_mday = bcd2bin(buf[ABX8XX_REG_DA] & 0x3F); | ||
| 113 | tm->tm_mon = bcd2bin(buf[ABX8XX_REG_MO] & 0x1F) - 1; | ||
| 114 | tm->tm_year = bcd2bin(buf[ABX8XX_REG_YR]) + 100; | ||
| 115 | |||
| 116 | err = rtc_valid_tm(tm); | ||
| 117 | if (err < 0) | ||
| 118 | dev_err(&client->dev, "retrieved date/time is not valid.\n"); | ||
| 119 | |||
| 120 | return err; | ||
| 121 | } | ||
| 122 | |||
| 123 | static int abx80x_rtc_set_time(struct device *dev, struct rtc_time *tm) | ||
| 124 | { | ||
| 125 | struct i2c_client *client = to_i2c_client(dev); | ||
| 126 | unsigned char buf[8]; | ||
| 127 | int err; | ||
| 128 | |||
| 129 | if (tm->tm_year < 100) | ||
| 130 | return -EINVAL; | ||
| 131 | |||
| 132 | buf[ABX8XX_REG_HTH] = 0; | ||
| 133 | buf[ABX8XX_REG_SC] = bin2bcd(tm->tm_sec); | ||
| 134 | buf[ABX8XX_REG_MN] = bin2bcd(tm->tm_min); | ||
| 135 | buf[ABX8XX_REG_HR] = bin2bcd(tm->tm_hour); | ||
| 136 | buf[ABX8XX_REG_DA] = bin2bcd(tm->tm_mday); | ||
| 137 | buf[ABX8XX_REG_MO] = bin2bcd(tm->tm_mon + 1); | ||
| 138 | buf[ABX8XX_REG_YR] = bin2bcd(tm->tm_year - 100); | ||
| 139 | buf[ABX8XX_REG_WD] = tm->tm_wday; | ||
| 140 | |||
| 141 | err = i2c_smbus_write_i2c_block_data(client, ABX8XX_REG_HTH, | ||
| 142 | sizeof(buf), buf); | ||
| 143 | if (err < 0) { | ||
| 144 | dev_err(&client->dev, "Unable to write to date registers\n"); | ||
| 145 | return -EIO; | ||
| 146 | } | ||
| 147 | |||
| 148 | return 0; | ||
| 149 | } | ||
| 150 | |||
| 151 | static const struct rtc_class_ops abx80x_rtc_ops = { | ||
| 152 | .read_time = abx80x_rtc_read_time, | ||
| 153 | .set_time = abx80x_rtc_set_time, | ||
| 154 | }; | ||
| 155 | |||
| 156 | static int abx80x_dt_trickle_cfg(struct device_node *np) | ||
| 157 | { | ||
| 158 | const char *diode; | ||
| 159 | int trickle_cfg = 0; | ||
| 160 | int i, ret; | ||
| 161 | u32 tmp; | ||
| 162 | |||
| 163 | ret = of_property_read_string(np, "abracon,tc-diode", &diode); | ||
| 164 | if (ret) | ||
| 165 | return ret; | ||
| 166 | |||
| 167 | if (!strcmp(diode, "standard")) | ||
| 168 | trickle_cfg |= ABX8XX_TRICKLE_STANDARD_DIODE; | ||
| 169 | else if (!strcmp(diode, "schottky")) | ||
| 170 | trickle_cfg |= ABX8XX_TRICKLE_SCHOTTKY_DIODE; | ||
| 171 | else | ||
| 172 | return -EINVAL; | ||
| 173 | |||
| 174 | ret = of_property_read_u32(np, "abracon,tc-resistor", &tmp); | ||
| 175 | if (ret) | ||
| 176 | return ret; | ||
| 177 | |||
| 178 | for (i = 0; i < sizeof(trickle_resistors); i++) | ||
| 179 | if (trickle_resistors[i] == tmp) | ||
| 180 | break; | ||
| 181 | |||
| 182 | if (i == sizeof(trickle_resistors)) | ||
| 183 | return -EINVAL; | ||
| 184 | |||
| 185 | return (trickle_cfg | i); | ||
| 186 | } | ||
| 187 | |||
| 188 | static int abx80x_probe(struct i2c_client *client, | ||
| 189 | const struct i2c_device_id *id) | ||
| 190 | { | ||
| 191 | struct device_node *np = client->dev.of_node; | ||
| 192 | struct rtc_device *rtc; | ||
| 193 | int i, data, err, trickle_cfg = -EINVAL; | ||
| 194 | char buf[7]; | ||
| 195 | unsigned int part = id->driver_data; | ||
| 196 | unsigned int partnumber; | ||
| 197 | unsigned int majrev, minrev; | ||
| 198 | unsigned int lot; | ||
| 199 | unsigned int wafer; | ||
| 200 | unsigned int uid; | ||
| 201 | |||
| 202 | if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) | ||
| 203 | return -ENODEV; | ||
| 204 | |||
| 205 | err = i2c_smbus_read_i2c_block_data(client, ABX8XX_REG_ID0, | ||
| 206 | sizeof(buf), buf); | ||
| 207 | if (err < 0) { | ||
| 208 | dev_err(&client->dev, "Unable to read partnumber\n"); | ||
| 209 | return -EIO; | ||
| 210 | } | ||
| 211 | |||
| 212 | partnumber = (buf[0] << 8) | buf[1]; | ||
| 213 | majrev = buf[2] >> 3; | ||
| 214 | minrev = buf[2] & 0x7; | ||
| 215 | lot = ((buf[4] & 0x80) << 2) | ((buf[6] & 0x80) << 1) | buf[3]; | ||
| 216 | uid = ((buf[4] & 0x7f) << 8) | buf[5]; | ||
| 217 | wafer = (buf[6] & 0x7c) >> 2; | ||
| 218 | dev_info(&client->dev, "model %04x, revision %u.%u, lot %x, wafer %x, uid %x\n", | ||
| 219 | partnumber, majrev, minrev, lot, wafer, uid); | ||
| 220 | |||
| 221 | data = i2c_smbus_read_byte_data(client, ABX8XX_REG_CTRL1); | ||
| 222 | if (data < 0) { | ||
| 223 | dev_err(&client->dev, "Unable to read control register\n"); | ||
| 224 | return -EIO; | ||
| 225 | } | ||
| 226 | |||
| 227 | err = i2c_smbus_write_byte_data(client, ABX8XX_REG_CTRL1, | ||
| 228 | ((data & ~ABX8XX_CTRL_12_24) | | ||
| 229 | ABX8XX_CTRL_WRITE)); | ||
| 230 | if (err < 0) { | ||
| 231 | dev_err(&client->dev, "Unable to write control register\n"); | ||
| 232 | return -EIO; | ||
| 233 | } | ||
| 234 | |||
| 235 | /* part autodetection */ | ||
| 236 | if (part == ABX80X) { | ||
| 237 | for (i = 0; abx80x_caps[i].pn; i++) | ||
| 238 | if (partnumber == abx80x_caps[i].pn) | ||
| 239 | break; | ||
| 240 | if (abx80x_caps[i].pn == 0) { | ||
| 241 | dev_err(&client->dev, "Unknown part: %04x\n", | ||
| 242 | partnumber); | ||
| 243 | return -EINVAL; | ||
| 244 | } | ||
| 245 | part = i; | ||
| 246 | } | ||
| 247 | |||
| 248 | if (partnumber != abx80x_caps[part].pn) { | ||
| 249 | dev_err(&client->dev, "partnumber mismatch %04x != %04x\n", | ||
| 250 | partnumber, abx80x_caps[part].pn); | ||
| 251 | return -EINVAL; | ||
| 252 | } | ||
| 253 | |||
| 254 | if (np && abx80x_caps[part].has_tc) | ||
| 255 | trickle_cfg = abx80x_dt_trickle_cfg(np); | ||
| 256 | |||
| 257 | if (trickle_cfg > 0) { | ||
| 258 | dev_info(&client->dev, "Enabling trickle charger: %02x\n", | ||
| 259 | trickle_cfg); | ||
| 260 | abx80x_enable_trickle_charger(client, trickle_cfg); | ||
| 261 | } | ||
| 262 | |||
| 263 | rtc = devm_rtc_device_register(&client->dev, abx80x_driver.driver.name, | ||
| 264 | &abx80x_rtc_ops, THIS_MODULE); | ||
| 265 | |||
| 266 | if (IS_ERR(rtc)) | ||
| 267 | return PTR_ERR(rtc); | ||
| 268 | |||
| 269 | i2c_set_clientdata(client, rtc); | ||
| 270 | |||
| 271 | return 0; | ||
| 272 | } | ||
| 273 | |||
| 274 | static int abx80x_remove(struct i2c_client *client) | ||
| 275 | { | ||
| 276 | return 0; | ||
| 277 | } | ||
| 278 | |||
| 279 | static const struct i2c_device_id abx80x_id[] = { | ||
| 280 | { "abx80x", ABX80X }, | ||
| 281 | { "ab0801", AB0801 }, | ||
| 282 | { "ab0803", AB0803 }, | ||
| 283 | { "ab0804", AB0804 }, | ||
| 284 | { "ab0805", AB0805 }, | ||
| 285 | { "ab1801", AB1801 }, | ||
| 286 | { "ab1803", AB1803 }, | ||
| 287 | { "ab1804", AB1804 }, | ||
| 288 | { "ab1805", AB1805 }, | ||
| 289 | { } | ||
| 290 | }; | ||
| 291 | MODULE_DEVICE_TABLE(i2c, abx80x_id); | ||
| 292 | |||
| 293 | static struct i2c_driver abx80x_driver = { | ||
| 294 | .driver = { | ||
| 295 | .name = "rtc-abx80x", | ||
| 296 | }, | ||
| 297 | .probe = abx80x_probe, | ||
| 298 | .remove = abx80x_remove, | ||
| 299 | .id_table = abx80x_id, | ||
| 300 | }; | ||
| 301 | |||
| 302 | module_i2c_driver(abx80x_driver); | ||
| 303 | |||
| 304 | MODULE_AUTHOR("Philippe De Muyter <phdm@macqel.be>"); | ||
| 305 | MODULE_AUTHOR("Alexandre Belloni <alexandre.belloni@free-electrons.com>"); | ||
| 306 | MODULE_DESCRIPTION("Abracon ABX80X RTC driver"); | ||
| 307 | MODULE_LICENSE("GPL v2"); | ||
diff --git a/drivers/rtc/rtc-armada38x.c b/drivers/rtc/rtc-armada38x.c index 43e04af39e09..cb70ced7e0db 100644 --- a/drivers/rtc/rtc-armada38x.c +++ b/drivers/rtc/rtc-armada38x.c | |||
| @@ -40,6 +40,13 @@ struct armada38x_rtc { | |||
| 40 | void __iomem *regs; | 40 | void __iomem *regs; |
| 41 | void __iomem *regs_soc; | 41 | void __iomem *regs_soc; |
| 42 | spinlock_t lock; | 42 | spinlock_t lock; |
| 43 | /* | ||
| 44 | * While setting the time, the RTC TIME register should not be | ||
| 45 | * accessed. Setting the RTC time involves sleeping during | ||
| 46 | * 100ms, so a mutex instead of a spinlock is used to protect | ||
| 47 | * it | ||
| 48 | */ | ||
| 49 | struct mutex mutex_time; | ||
| 43 | int irq; | 50 | int irq; |
| 44 | }; | 51 | }; |
| 45 | 52 | ||
| @@ -59,8 +66,7 @@ static int armada38x_rtc_read_time(struct device *dev, struct rtc_time *tm) | |||
| 59 | struct armada38x_rtc *rtc = dev_get_drvdata(dev); | 66 | struct armada38x_rtc *rtc = dev_get_drvdata(dev); |
| 60 | unsigned long time, time_check, flags; | 67 | unsigned long time, time_check, flags; |
| 61 | 68 | ||
| 62 | spin_lock_irqsave(&rtc->lock, flags); | 69 | mutex_lock(&rtc->mutex_time); |
| 63 | |||
| 64 | time = readl(rtc->regs + RTC_TIME); | 70 | time = readl(rtc->regs + RTC_TIME); |
| 65 | /* | 71 | /* |
| 66 | * WA for failing time set attempts. As stated in HW ERRATA if | 72 | * WA for failing time set attempts. As stated in HW ERRATA if |
| @@ -71,7 +77,7 @@ static int armada38x_rtc_read_time(struct device *dev, struct rtc_time *tm) | |||
| 71 | if ((time_check - time) > 1) | 77 | if ((time_check - time) > 1) |
| 72 | time_check = readl(rtc->regs + RTC_TIME); | 78 | time_check = readl(rtc->regs + RTC_TIME); |
| 73 | 79 | ||
| 74 | spin_unlock_irqrestore(&rtc->lock, flags); | 80 | mutex_unlock(&rtc->mutex_time); |
| 75 | 81 | ||
| 76 | rtc_time_to_tm(time_check, tm); | 82 | rtc_time_to_tm(time_check, tm); |
| 77 | 83 | ||
| @@ -94,19 +100,12 @@ static int armada38x_rtc_set_time(struct device *dev, struct rtc_time *tm) | |||
| 94 | * then wait for 100ms before writing to the time register to be | 100 | * then wait for 100ms before writing to the time register to be |
| 95 | * sure that the data will be taken into account. | 101 | * sure that the data will be taken into account. |
| 96 | */ | 102 | */ |
| 97 | spin_lock_irqsave(&rtc->lock, flags); | 103 | mutex_lock(&rtc->mutex_time); |
| 98 | |||
| 99 | rtc_delayed_write(0, rtc, RTC_STATUS); | 104 | rtc_delayed_write(0, rtc, RTC_STATUS); |
| 100 | |||
| 101 | spin_unlock_irqrestore(&rtc->lock, flags); | ||
| 102 | |||
| 103 | msleep(100); | 105 | msleep(100); |
| 104 | |||
| 105 | spin_lock_irqsave(&rtc->lock, flags); | ||
| 106 | |||
| 107 | rtc_delayed_write(time, rtc, RTC_TIME); | 106 | rtc_delayed_write(time, rtc, RTC_TIME); |
| 107 | mutex_unlock(&rtc->mutex_time); | ||
| 108 | 108 | ||
| 109 | spin_unlock_irqrestore(&rtc->lock, flags); | ||
| 110 | out: | 109 | out: |
| 111 | return ret; | 110 | return ret; |
| 112 | } | 111 | } |
| @@ -230,6 +229,7 @@ static __init int armada38x_rtc_probe(struct platform_device *pdev) | |||
| 230 | return -ENOMEM; | 229 | return -ENOMEM; |
| 231 | 230 | ||
| 232 | spin_lock_init(&rtc->lock); | 231 | spin_lock_init(&rtc->lock); |
| 232 | mutex_init(&rtc->mutex_time); | ||
| 233 | 233 | ||
| 234 | res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "rtc"); | 234 | res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "rtc"); |
| 235 | rtc->regs = devm_ioremap_resource(&pdev->dev, res); | 235 | rtc->regs = devm_ioremap_resource(&pdev->dev, res); |
diff --git a/fs/configfs/mount.c b/fs/configfs/mount.c index da94e41bdbf6..537356742091 100644 --- a/fs/configfs/mount.c +++ b/fs/configfs/mount.c | |||
| @@ -173,5 +173,5 @@ MODULE_LICENSE("GPL"); | |||
| 173 | MODULE_VERSION("0.0.2"); | 173 | MODULE_VERSION("0.0.2"); |
| 174 | MODULE_DESCRIPTION("Simple RAM filesystem for user driven kernel subsystem configuration."); | 174 | MODULE_DESCRIPTION("Simple RAM filesystem for user driven kernel subsystem configuration."); |
| 175 | 175 | ||
| 176 | module_init(configfs_init); | 176 | core_initcall(configfs_init); |
| 177 | module_exit(configfs_exit); | 177 | module_exit(configfs_exit); |
diff --git a/fs/nilfs2/btree.c b/fs/nilfs2/btree.c index 059f37137f9a..919fd5bb14a8 100644 --- a/fs/nilfs2/btree.c +++ b/fs/nilfs2/btree.c | |||
| @@ -388,7 +388,7 @@ static int nilfs_btree_root_broken(const struct nilfs_btree_node *node, | |||
| 388 | nchildren = nilfs_btree_node_get_nchildren(node); | 388 | nchildren = nilfs_btree_node_get_nchildren(node); |
| 389 | 389 | ||
| 390 | if (unlikely(level < NILFS_BTREE_LEVEL_NODE_MIN || | 390 | if (unlikely(level < NILFS_BTREE_LEVEL_NODE_MIN || |
| 391 | level > NILFS_BTREE_LEVEL_MAX || | 391 | level >= NILFS_BTREE_LEVEL_MAX || |
| 392 | nchildren < 0 || | 392 | nchildren < 0 || |
| 393 | nchildren > NILFS_BTREE_ROOT_NCHILDREN_MAX)) { | 393 | nchildren > NILFS_BTREE_ROOT_NCHILDREN_MAX)) { |
| 394 | pr_crit("NILFS: bad btree root (inode number=%lu): level = %d, flags = 0x%x, nchildren = %d\n", | 394 | pr_crit("NILFS: bad btree root (inode number=%lu): level = %d, flags = 0x%x, nchildren = %d\n", |
diff --git a/fs/ocfs2/dlm/dlmmaster.c b/fs/ocfs2/dlm/dlmmaster.c index a6944b25fd5b..fdf4b41d0609 100644 --- a/fs/ocfs2/dlm/dlmmaster.c +++ b/fs/ocfs2/dlm/dlmmaster.c | |||
| @@ -757,6 +757,19 @@ lookup: | |||
| 757 | if (tmpres) { | 757 | if (tmpres) { |
| 758 | spin_unlock(&dlm->spinlock); | 758 | spin_unlock(&dlm->spinlock); |
| 759 | spin_lock(&tmpres->spinlock); | 759 | spin_lock(&tmpres->spinlock); |
| 760 | |||
| 761 | /* | ||
| 762 | * Right after dlm spinlock was released, dlm_thread could have | ||
| 763 | * purged the lockres. Check if lockres got unhashed. If so | ||
| 764 | * start over. | ||
| 765 | */ | ||
| 766 | if (hlist_unhashed(&tmpres->hash_node)) { | ||
| 767 | spin_unlock(&tmpres->spinlock); | ||
| 768 | dlm_lockres_put(tmpres); | ||
| 769 | tmpres = NULL; | ||
| 770 | goto lookup; | ||
| 771 | } | ||
| 772 | |||
| 760 | /* Wait on the thread that is mastering the resource */ | 773 | /* Wait on the thread that is mastering the resource */ |
| 761 | if (tmpres->owner == DLM_LOCK_RES_OWNER_UNKNOWN) { | 774 | if (tmpres->owner == DLM_LOCK_RES_OWNER_UNKNOWN) { |
| 762 | __dlm_wait_on_lockres(tmpres); | 775 | __dlm_wait_on_lockres(tmpres); |
diff --git a/include/linux/nilfs2_fs.h b/include/linux/nilfs2_fs.h index ff3fea3194c6..9abb763e4b86 100644 --- a/include/linux/nilfs2_fs.h +++ b/include/linux/nilfs2_fs.h | |||
| @@ -460,7 +460,7 @@ struct nilfs_btree_node { | |||
| 460 | /* level */ | 460 | /* level */ |
| 461 | #define NILFS_BTREE_LEVEL_DATA 0 | 461 | #define NILFS_BTREE_LEVEL_DATA 0 |
| 462 | #define NILFS_BTREE_LEVEL_NODE_MIN (NILFS_BTREE_LEVEL_DATA + 1) | 462 | #define NILFS_BTREE_LEVEL_NODE_MIN (NILFS_BTREE_LEVEL_DATA + 1) |
| 463 | #define NILFS_BTREE_LEVEL_MAX 14 | 463 | #define NILFS_BTREE_LEVEL_MAX 14 /* Max level (exclusive) */ |
| 464 | 464 | ||
| 465 | /** | 465 | /** |
| 466 | * struct nilfs_palloc_group_desc - block group descriptor | 466 | * struct nilfs_palloc_group_desc - block group descriptor |
diff --git a/include/linux/util_macros.h b/include/linux/util_macros.h index d5f4fb69dba3..f9b2ce58039b 100644 --- a/include/linux/util_macros.h +++ b/include/linux/util_macros.h | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | ({ \ | 5 | ({ \ |
| 6 | typeof(as) __fc_i, __fc_as = (as) - 1; \ | 6 | typeof(as) __fc_i, __fc_as = (as) - 1; \ |
| 7 | typeof(x) __fc_x = (x); \ | 7 | typeof(x) __fc_x = (x); \ |
| 8 | typeof(*a) *__fc_a = (a); \ | 8 | typeof(*a) const *__fc_a = (a); \ |
| 9 | for (__fc_i = 0; __fc_i < __fc_as; __fc_i++) { \ | 9 | for (__fc_i = 0; __fc_i < __fc_as; __fc_i++) { \ |
| 10 | if (__fc_x op DIV_ROUND_CLOSEST(__fc_a[__fc_i] + \ | 10 | if (__fc_x op DIV_ROUND_CLOSEST(__fc_a[__fc_i] + \ |
| 11 | __fc_a[__fc_i + 1], 2)) \ | 11 | __fc_a[__fc_i + 1], 2)) \ |
diff --git a/lib/Kconfig.kasan b/lib/Kconfig.kasan index 4fecaedc80a2..777eda7d1ab4 100644 --- a/lib/Kconfig.kasan +++ b/lib/Kconfig.kasan | |||
| @@ -10,8 +10,11 @@ config KASAN | |||
| 10 | help | 10 | help |
| 11 | Enables kernel address sanitizer - runtime memory debugger, | 11 | Enables kernel address sanitizer - runtime memory debugger, |
| 12 | designed to find out-of-bounds accesses and use-after-free bugs. | 12 | designed to find out-of-bounds accesses and use-after-free bugs. |
| 13 | This is strictly debugging feature. It consumes about 1/8 | 13 | This is strictly a debugging feature and it requires a gcc version |
| 14 | of available memory and brings about ~x3 performance slowdown. | 14 | of 4.9.2 or later. Detection of out of bounds accesses to stack or |
| 15 | global variables requires gcc 5.0 or later. | ||
| 16 | This feature consumes about 1/8 of available memory and brings about | ||
| 17 | ~x3 performance slowdown. | ||
| 15 | For better error detection enable CONFIG_STACKTRACE, | 18 | For better error detection enable CONFIG_STACKTRACE, |
| 16 | and add slub_debug=U to boot cmdline. | 19 | and add slub_debug=U to boot cmdline. |
| 17 | 20 | ||
| @@ -40,6 +43,7 @@ config KASAN_INLINE | |||
| 40 | memory accesses. This is faster than outline (in some workloads | 43 | memory accesses. This is faster than outline (in some workloads |
| 41 | it gives about x2 boost over outline instrumentation), but | 44 | it gives about x2 boost over outline instrumentation), but |
| 42 | make kernel's .text size much bigger. | 45 | make kernel's .text size much bigger. |
| 46 | This requires a gcc version of 5.0 or later. | ||
| 43 | 47 | ||
| 44 | endchoice | 48 | endchoice |
| 45 | 49 | ||
diff --git a/lib/find_last_bit.c b/lib/find_last_bit.c deleted file mode 100644 index 3e3be40c6a6e..000000000000 --- a/lib/find_last_bit.c +++ /dev/null | |||
| @@ -1,41 +0,0 @@ | |||
| 1 | /* find_last_bit.c: fallback find next bit implementation | ||
| 2 | * | ||
| 3 | * Copyright (C) 2008 IBM Corporation | ||
| 4 | * Written by Rusty Russell <rusty@rustcorp.com.au> | ||
| 5 | * (Inspired by David Howell's find_next_bit implementation) | ||
| 6 | * | ||
| 7 | * Rewritten by Yury Norov <yury.norov@gmail.com> to decrease | ||
| 8 | * size and improve performance, 2015. | ||
| 9 | * | ||
| 10 | * This program is free software; you can redistribute it and/or | ||
| 11 | * modify it under the terms of the GNU General Public License | ||
| 12 | * as published by the Free Software Foundation; either version | ||
| 13 | * 2 of the License, or (at your option) any later version. | ||
| 14 | */ | ||
| 15 | |||
| 16 | #include <linux/bitops.h> | ||
| 17 | #include <linux/bitmap.h> | ||
| 18 | #include <linux/export.h> | ||
| 19 | #include <linux/kernel.h> | ||
| 20 | |||
| 21 | #ifndef find_last_bit | ||
| 22 | |||
| 23 | unsigned long find_last_bit(const unsigned long *addr, unsigned long size) | ||
| 24 | { | ||
| 25 | if (size) { | ||
| 26 | unsigned long val = BITMAP_LAST_WORD_MASK(size); | ||
| 27 | unsigned long idx = (size-1) / BITS_PER_LONG; | ||
| 28 | |||
| 29 | do { | ||
| 30 | val &= addr[idx]; | ||
| 31 | if (val) | ||
| 32 | return idx * BITS_PER_LONG + __fls(val); | ||
| 33 | |||
| 34 | val = ~0ul; | ||
| 35 | } while (idx--); | ||
| 36 | } | ||
| 37 | return size; | ||
| 38 | } | ||
| 39 | EXPORT_SYMBOL(find_last_bit); | ||
| 40 | |||
| 41 | #endif | ||
diff --git a/mm/hwpoison-inject.c b/mm/hwpoison-inject.c index 329caf56df22..4ca5fe0042e1 100644 --- a/mm/hwpoison-inject.c +++ b/mm/hwpoison-inject.c | |||
| @@ -34,13 +34,13 @@ static int hwpoison_inject(void *data, u64 val) | |||
| 34 | if (!hwpoison_filter_enable) | 34 | if (!hwpoison_filter_enable) |
| 35 | goto inject; | 35 | goto inject; |
| 36 | 36 | ||
| 37 | if (!PageLRU(p) && !PageHuge(p)) | 37 | if (!PageLRU(hpage) && !PageHuge(p)) |
| 38 | shake_page(p, 0); | 38 | shake_page(hpage, 0); |
| 39 | /* | 39 | /* |
| 40 | * This implies unable to support non-LRU pages. | 40 | * This implies unable to support non-LRU pages. |
| 41 | */ | 41 | */ |
| 42 | if (!PageLRU(p) && !PageHuge(p)) | 42 | if (!PageLRU(hpage) && !PageHuge(p)) |
| 43 | return 0; | 43 | goto put_out; |
| 44 | 44 | ||
| 45 | /* | 45 | /* |
| 46 | * do a racy check with elevated page count, to make sure PG_hwpoison | 46 | * do a racy check with elevated page count, to make sure PG_hwpoison |
| @@ -52,11 +52,14 @@ static int hwpoison_inject(void *data, u64 val) | |||
| 52 | err = hwpoison_filter(hpage); | 52 | err = hwpoison_filter(hpage); |
| 53 | unlock_page(hpage); | 53 | unlock_page(hpage); |
| 54 | if (err) | 54 | if (err) |
| 55 | return 0; | 55 | goto put_out; |
| 56 | 56 | ||
| 57 | inject: | 57 | inject: |
| 58 | pr_info("Injecting memory failure at pfn %#lx\n", pfn); | 58 | pr_info("Injecting memory failure at pfn %#lx\n", pfn); |
| 59 | return memory_failure(pfn, 18, MF_COUNT_INCREASED); | 59 | return memory_failure(pfn, 18, MF_COUNT_INCREASED); |
| 60 | put_out: | ||
| 61 | put_page(hpage); | ||
| 62 | return 0; | ||
| 60 | } | 63 | } |
| 61 | 64 | ||
| 62 | static int hwpoison_unpoison(void *data, u64 val) | 65 | static int hwpoison_unpoison(void *data, u64 val) |
diff --git a/mm/memory-failure.c b/mm/memory-failure.c index d9359b770cd9..501820c815b3 100644 --- a/mm/memory-failure.c +++ b/mm/memory-failure.c | |||
| @@ -1187,10 +1187,10 @@ int memory_failure(unsigned long pfn, int trapno, int flags) | |||
| 1187 | * The check (unnecessarily) ignores LRU pages being isolated and | 1187 | * The check (unnecessarily) ignores LRU pages being isolated and |
| 1188 | * walked by the page reclaim code, however that's not a big loss. | 1188 | * walked by the page reclaim code, however that's not a big loss. |
| 1189 | */ | 1189 | */ |
| 1190 | if (!PageHuge(p) && !PageTransTail(p)) { | 1190 | if (!PageHuge(p)) { |
| 1191 | if (!PageLRU(p)) | 1191 | if (!PageLRU(hpage)) |
| 1192 | shake_page(p, 0); | 1192 | shake_page(hpage, 0); |
| 1193 | if (!PageLRU(p)) { | 1193 | if (!PageLRU(hpage)) { |
| 1194 | /* | 1194 | /* |
| 1195 | * shake_page could have turned it free. | 1195 | * shake_page could have turned it free. |
| 1196 | */ | 1196 | */ |
| @@ -1777,12 +1777,12 @@ int soft_offline_page(struct page *page, int flags) | |||
| 1777 | } else if (ret == 0) { /* for free pages */ | 1777 | } else if (ret == 0) { /* for free pages */ |
| 1778 | if (PageHuge(page)) { | 1778 | if (PageHuge(page)) { |
| 1779 | set_page_hwpoison_huge_page(hpage); | 1779 | set_page_hwpoison_huge_page(hpage); |
| 1780 | dequeue_hwpoisoned_huge_page(hpage); | 1780 | if (!dequeue_hwpoisoned_huge_page(hpage)) |
| 1781 | atomic_long_add(1 << compound_order(hpage), | 1781 | atomic_long_add(1 << compound_order(hpage), |
| 1782 | &num_poisoned_pages); | 1782 | &num_poisoned_pages); |
| 1783 | } else { | 1783 | } else { |
| 1784 | SetPageHWPoison(page); | 1784 | if (!TestSetPageHWPoison(page)) |
| 1785 | atomic_long_inc(&num_poisoned_pages); | 1785 | atomic_long_inc(&num_poisoned_pages); |
| 1786 | } | 1786 | } |
| 1787 | } | 1787 | } |
| 1788 | unset_migratetype_isolate(page, MIGRATE_MOVABLE); | 1788 | unset_migratetype_isolate(page, MIGRATE_MOVABLE); |
