diff options
-rw-r--r-- | drivers/mfd/sec-core.c | 30 | ||||
-rw-r--r-- | drivers/mfd/sec-irq.c | 6 | ||||
-rw-r--r-- | drivers/regulator/s5m8767.c | 2 | ||||
-rw-r--r-- | drivers/rtc/rtc-at91rm9200.c | 2 | ||||
-rw-r--r-- | drivers/rtc/rtc-s5m.c | 118 | ||||
-rw-r--r-- | fs/proc/inode.c | 14 | ||||
-rw-r--r-- | include/linux/hugetlb.h | 5 | ||||
-rw-r--r-- | include/linux/kernel.h | 3 | ||||
-rw-r--r-- | include/linux/mfd/samsung/core.h | 3 | ||||
-rw-r--r-- | mm/huge_memory.c | 12 | ||||
-rw-r--r-- | mm/memcontrol.c | 41 |
11 files changed, 181 insertions, 55 deletions
diff --git a/drivers/mfd/sec-core.c b/drivers/mfd/sec-core.c index 34c18fb8c089..54cc25546592 100644 --- a/drivers/mfd/sec-core.c +++ b/drivers/mfd/sec-core.c | |||
@@ -81,31 +81,31 @@ static struct of_device_id sec_dt_match[] = { | |||
81 | 81 | ||
82 | int sec_reg_read(struct sec_pmic_dev *sec_pmic, u8 reg, void *dest) | 82 | int sec_reg_read(struct sec_pmic_dev *sec_pmic, u8 reg, void *dest) |
83 | { | 83 | { |
84 | return regmap_read(sec_pmic->regmap, reg, dest); | 84 | return regmap_read(sec_pmic->regmap_pmic, reg, dest); |
85 | } | 85 | } |
86 | EXPORT_SYMBOL_GPL(sec_reg_read); | 86 | EXPORT_SYMBOL_GPL(sec_reg_read); |
87 | 87 | ||
88 | int sec_bulk_read(struct sec_pmic_dev *sec_pmic, u8 reg, int count, u8 *buf) | 88 | int sec_bulk_read(struct sec_pmic_dev *sec_pmic, u8 reg, int count, u8 *buf) |
89 | { | 89 | { |
90 | return regmap_bulk_read(sec_pmic->regmap, reg, buf, count); | 90 | return regmap_bulk_read(sec_pmic->regmap_pmic, reg, buf, count); |
91 | } | 91 | } |
92 | EXPORT_SYMBOL_GPL(sec_bulk_read); | 92 | EXPORT_SYMBOL_GPL(sec_bulk_read); |
93 | 93 | ||
94 | int sec_reg_write(struct sec_pmic_dev *sec_pmic, u8 reg, u8 value) | 94 | int sec_reg_write(struct sec_pmic_dev *sec_pmic, u8 reg, u8 value) |
95 | { | 95 | { |
96 | return regmap_write(sec_pmic->regmap, reg, value); | 96 | return regmap_write(sec_pmic->regmap_pmic, reg, value); |
97 | } | 97 | } |
98 | EXPORT_SYMBOL_GPL(sec_reg_write); | 98 | EXPORT_SYMBOL_GPL(sec_reg_write); |
99 | 99 | ||
100 | int sec_bulk_write(struct sec_pmic_dev *sec_pmic, u8 reg, int count, u8 *buf) | 100 | int sec_bulk_write(struct sec_pmic_dev *sec_pmic, u8 reg, int count, u8 *buf) |
101 | { | 101 | { |
102 | return regmap_raw_write(sec_pmic->regmap, reg, buf, count); | 102 | return regmap_raw_write(sec_pmic->regmap_pmic, reg, buf, count); |
103 | } | 103 | } |
104 | EXPORT_SYMBOL_GPL(sec_bulk_write); | 104 | EXPORT_SYMBOL_GPL(sec_bulk_write); |
105 | 105 | ||
106 | int sec_reg_update(struct sec_pmic_dev *sec_pmic, u8 reg, u8 val, u8 mask) | 106 | int sec_reg_update(struct sec_pmic_dev *sec_pmic, u8 reg, u8 val, u8 mask) |
107 | { | 107 | { |
108 | return regmap_update_bits(sec_pmic->regmap, reg, mask, val); | 108 | return regmap_update_bits(sec_pmic->regmap_pmic, reg, mask, val); |
109 | } | 109 | } |
110 | EXPORT_SYMBOL_GPL(sec_reg_update); | 110 | EXPORT_SYMBOL_GPL(sec_reg_update); |
111 | 111 | ||
@@ -166,6 +166,11 @@ static struct regmap_config s5m8767_regmap_config = { | |||
166 | .cache_type = REGCACHE_FLAT, | 166 | .cache_type = REGCACHE_FLAT, |
167 | }; | 167 | }; |
168 | 168 | ||
169 | static const struct regmap_config sec_rtc_regmap_config = { | ||
170 | .reg_bits = 8, | ||
171 | .val_bits = 8, | ||
172 | }; | ||
173 | |||
169 | #ifdef CONFIG_OF | 174 | #ifdef CONFIG_OF |
170 | /* | 175 | /* |
171 | * Only the common platform data elements for s5m8767 are parsed here from the | 176 | * Only the common platform data elements for s5m8767 are parsed here from the |
@@ -266,9 +271,9 @@ static int sec_pmic_probe(struct i2c_client *i2c, | |||
266 | break; | 271 | break; |
267 | } | 272 | } |
268 | 273 | ||
269 | sec_pmic->regmap = devm_regmap_init_i2c(i2c, regmap); | 274 | sec_pmic->regmap_pmic = devm_regmap_init_i2c(i2c, regmap); |
270 | if (IS_ERR(sec_pmic->regmap)) { | 275 | if (IS_ERR(sec_pmic->regmap_pmic)) { |
271 | ret = PTR_ERR(sec_pmic->regmap); | 276 | ret = PTR_ERR(sec_pmic->regmap_pmic); |
272 | dev_err(&i2c->dev, "Failed to allocate register map: %d\n", | 277 | dev_err(&i2c->dev, "Failed to allocate register map: %d\n", |
273 | ret); | 278 | ret); |
274 | return ret; | 279 | return ret; |
@@ -277,6 +282,15 @@ static int sec_pmic_probe(struct i2c_client *i2c, | |||
277 | sec_pmic->rtc = i2c_new_dummy(i2c->adapter, RTC_I2C_ADDR); | 282 | sec_pmic->rtc = i2c_new_dummy(i2c->adapter, RTC_I2C_ADDR); |
278 | i2c_set_clientdata(sec_pmic->rtc, sec_pmic); | 283 | i2c_set_clientdata(sec_pmic->rtc, sec_pmic); |
279 | 284 | ||
285 | sec_pmic->regmap_rtc = devm_regmap_init_i2c(sec_pmic->rtc, | ||
286 | &sec_rtc_regmap_config); | ||
287 | if (IS_ERR(sec_pmic->regmap_rtc)) { | ||
288 | ret = PTR_ERR(sec_pmic->regmap_rtc); | ||
289 | dev_err(&i2c->dev, "Failed to allocate RTC register map: %d\n", | ||
290 | ret); | ||
291 | return ret; | ||
292 | } | ||
293 | |||
280 | if (pdata && pdata->cfg_pmic_irq) | 294 | if (pdata && pdata->cfg_pmic_irq) |
281 | pdata->cfg_pmic_irq(); | 295 | pdata->cfg_pmic_irq(); |
282 | 296 | ||
diff --git a/drivers/mfd/sec-irq.c b/drivers/mfd/sec-irq.c index 0dd84e99081e..b441b1be27cb 100644 --- a/drivers/mfd/sec-irq.c +++ b/drivers/mfd/sec-irq.c | |||
@@ -280,19 +280,19 @@ int sec_irq_init(struct sec_pmic_dev *sec_pmic) | |||
280 | 280 | ||
281 | switch (type) { | 281 | switch (type) { |
282 | case S5M8763X: | 282 | case S5M8763X: |
283 | ret = regmap_add_irq_chip(sec_pmic->regmap, sec_pmic->irq, | 283 | ret = regmap_add_irq_chip(sec_pmic->regmap_pmic, sec_pmic->irq, |
284 | IRQF_TRIGGER_FALLING | IRQF_ONESHOT, | 284 | IRQF_TRIGGER_FALLING | IRQF_ONESHOT, |
285 | sec_pmic->irq_base, &s5m8763_irq_chip, | 285 | sec_pmic->irq_base, &s5m8763_irq_chip, |
286 | &sec_pmic->irq_data); | 286 | &sec_pmic->irq_data); |
287 | break; | 287 | break; |
288 | case S5M8767X: | 288 | case S5M8767X: |
289 | ret = regmap_add_irq_chip(sec_pmic->regmap, sec_pmic->irq, | 289 | ret = regmap_add_irq_chip(sec_pmic->regmap_pmic, sec_pmic->irq, |
290 | IRQF_TRIGGER_FALLING | IRQF_ONESHOT, | 290 | IRQF_TRIGGER_FALLING | IRQF_ONESHOT, |
291 | sec_pmic->irq_base, &s5m8767_irq_chip, | 291 | sec_pmic->irq_base, &s5m8767_irq_chip, |
292 | &sec_pmic->irq_data); | 292 | &sec_pmic->irq_data); |
293 | break; | 293 | break; |
294 | case S2MPS11X: | 294 | case S2MPS11X: |
295 | ret = regmap_add_irq_chip(sec_pmic->regmap, sec_pmic->irq, | 295 | ret = regmap_add_irq_chip(sec_pmic->regmap_pmic, sec_pmic->irq, |
296 | IRQF_TRIGGER_FALLING | IRQF_ONESHOT, | 296 | IRQF_TRIGGER_FALLING | IRQF_ONESHOT, |
297 | sec_pmic->irq_base, &s2mps11_irq_chip, | 297 | sec_pmic->irq_base, &s2mps11_irq_chip, |
298 | &sec_pmic->irq_data); | 298 | &sec_pmic->irq_data); |
diff --git a/drivers/regulator/s5m8767.c b/drivers/regulator/s5m8767.c index cbf91e25cf7f..aeb40aad0ae7 100644 --- a/drivers/regulator/s5m8767.c +++ b/drivers/regulator/s5m8767.c | |||
@@ -925,7 +925,7 @@ static int s5m8767_pmic_probe(struct platform_device *pdev) | |||
925 | config.dev = s5m8767->dev; | 925 | config.dev = s5m8767->dev; |
926 | config.init_data = pdata->regulators[i].initdata; | 926 | config.init_data = pdata->regulators[i].initdata; |
927 | config.driver_data = s5m8767; | 927 | config.driver_data = s5m8767; |
928 | config.regmap = iodev->regmap; | 928 | config.regmap = iodev->regmap_pmic; |
929 | config.of_node = pdata->regulators[i].reg_node; | 929 | config.of_node = pdata->regulators[i].reg_node; |
930 | 930 | ||
931 | rdev[i] = devm_regulator_register(&pdev->dev, ®ulators[id], | 931 | rdev[i] = devm_regulator_register(&pdev->dev, ®ulators[id], |
diff --git a/drivers/rtc/rtc-at91rm9200.c b/drivers/rtc/rtc-at91rm9200.c index c0da95e95702..3281c90691c3 100644 --- a/drivers/rtc/rtc-at91rm9200.c +++ b/drivers/rtc/rtc-at91rm9200.c | |||
@@ -220,6 +220,8 @@ static int at91_rtc_setalarm(struct device *dev, struct rtc_wkalrm *alrm) | |||
220 | 220 | ||
221 | at91_alarm_year = tm.tm_year; | 221 | at91_alarm_year = tm.tm_year; |
222 | 222 | ||
223 | tm.tm_mon = alrm->time.tm_mon; | ||
224 | tm.tm_mday = alrm->time.tm_mday; | ||
223 | tm.tm_hour = alrm->time.tm_hour; | 225 | tm.tm_hour = alrm->time.tm_hour; |
224 | tm.tm_min = alrm->time.tm_min; | 226 | tm.tm_min = alrm->time.tm_min; |
225 | tm.tm_sec = alrm->time.tm_sec; | 227 | tm.tm_sec = alrm->time.tm_sec; |
diff --git a/drivers/rtc/rtc-s5m.c b/drivers/rtc/rtc-s5m.c index b7fd02bc0a14..ae8119dc2846 100644 --- a/drivers/rtc/rtc-s5m.c +++ b/drivers/rtc/rtc-s5m.c | |||
@@ -28,10 +28,20 @@ | |||
28 | #include <linux/mfd/samsung/irq.h> | 28 | #include <linux/mfd/samsung/irq.h> |
29 | #include <linux/mfd/samsung/rtc.h> | 29 | #include <linux/mfd/samsung/rtc.h> |
30 | 30 | ||
31 | /* | ||
32 | * Maximum number of retries for checking changes in UDR field | ||
33 | * of SEC_RTC_UDR_CON register (to limit possible endless loop). | ||
34 | * | ||
35 | * After writing to RTC registers (setting time or alarm) read the UDR field | ||
36 | * in SEC_RTC_UDR_CON register. UDR is auto-cleared when data have | ||
37 | * been transferred. | ||
38 | */ | ||
39 | #define UDR_READ_RETRY_CNT 5 | ||
40 | |||
31 | struct s5m_rtc_info { | 41 | struct s5m_rtc_info { |
32 | struct device *dev; | 42 | struct device *dev; |
33 | struct sec_pmic_dev *s5m87xx; | 43 | struct sec_pmic_dev *s5m87xx; |
34 | struct regmap *rtc; | 44 | struct regmap *regmap; |
35 | struct rtc_device *rtc_dev; | 45 | struct rtc_device *rtc_dev; |
36 | int irq; | 46 | int irq; |
37 | int device_type; | 47 | int device_type; |
@@ -84,12 +94,31 @@ static int s5m8767_tm_to_data(struct rtc_time *tm, u8 *data) | |||
84 | } | 94 | } |
85 | } | 95 | } |
86 | 96 | ||
97 | /* | ||
98 | * Read RTC_UDR_CON register and wait till UDR field is cleared. | ||
99 | * This indicates that time/alarm update ended. | ||
100 | */ | ||
101 | static inline int s5m8767_wait_for_udr_update(struct s5m_rtc_info *info) | ||
102 | { | ||
103 | int ret, retry = UDR_READ_RETRY_CNT; | ||
104 | unsigned int data; | ||
105 | |||
106 | do { | ||
107 | ret = regmap_read(info->regmap, SEC_RTC_UDR_CON, &data); | ||
108 | } while (--retry && (data & RTC_UDR_MASK) && !ret); | ||
109 | |||
110 | if (!retry) | ||
111 | dev_err(info->dev, "waiting for UDR update, reached max number of retries\n"); | ||
112 | |||
113 | return ret; | ||
114 | } | ||
115 | |||
87 | static inline int s5m8767_rtc_set_time_reg(struct s5m_rtc_info *info) | 116 | static inline int s5m8767_rtc_set_time_reg(struct s5m_rtc_info *info) |
88 | { | 117 | { |
89 | int ret; | 118 | int ret; |
90 | unsigned int data; | 119 | unsigned int data; |
91 | 120 | ||
92 | ret = regmap_read(info->rtc, SEC_RTC_UDR_CON, &data); | 121 | ret = regmap_read(info->regmap, SEC_RTC_UDR_CON, &data); |
93 | if (ret < 0) { | 122 | if (ret < 0) { |
94 | dev_err(info->dev, "failed to read update reg(%d)\n", ret); | 123 | dev_err(info->dev, "failed to read update reg(%d)\n", ret); |
95 | return ret; | 124 | return ret; |
@@ -98,15 +127,13 @@ static inline int s5m8767_rtc_set_time_reg(struct s5m_rtc_info *info) | |||
98 | data |= RTC_TIME_EN_MASK; | 127 | data |= RTC_TIME_EN_MASK; |
99 | data |= RTC_UDR_MASK; | 128 | data |= RTC_UDR_MASK; |
100 | 129 | ||
101 | ret = regmap_write(info->rtc, SEC_RTC_UDR_CON, data); | 130 | ret = regmap_write(info->regmap, SEC_RTC_UDR_CON, data); |
102 | if (ret < 0) { | 131 | if (ret < 0) { |
103 | dev_err(info->dev, "failed to write update reg(%d)\n", ret); | 132 | dev_err(info->dev, "failed to write update reg(%d)\n", ret); |
104 | return ret; | 133 | return ret; |
105 | } | 134 | } |
106 | 135 | ||
107 | do { | 136 | ret = s5m8767_wait_for_udr_update(info); |
108 | ret = regmap_read(info->rtc, SEC_RTC_UDR_CON, &data); | ||
109 | } while ((data & RTC_UDR_MASK) && !ret); | ||
110 | 137 | ||
111 | return ret; | 138 | return ret; |
112 | } | 139 | } |
@@ -116,7 +143,7 @@ static inline int s5m8767_rtc_set_alarm_reg(struct s5m_rtc_info *info) | |||
116 | int ret; | 143 | int ret; |
117 | unsigned int data; | 144 | unsigned int data; |
118 | 145 | ||
119 | ret = regmap_read(info->rtc, SEC_RTC_UDR_CON, &data); | 146 | ret = regmap_read(info->regmap, SEC_RTC_UDR_CON, &data); |
120 | if (ret < 0) { | 147 | if (ret < 0) { |
121 | dev_err(info->dev, "%s: fail to read update reg(%d)\n", | 148 | dev_err(info->dev, "%s: fail to read update reg(%d)\n", |
122 | __func__, ret); | 149 | __func__, ret); |
@@ -126,16 +153,14 @@ static inline int s5m8767_rtc_set_alarm_reg(struct s5m_rtc_info *info) | |||
126 | data &= ~RTC_TIME_EN_MASK; | 153 | data &= ~RTC_TIME_EN_MASK; |
127 | data |= RTC_UDR_MASK; | 154 | data |= RTC_UDR_MASK; |
128 | 155 | ||
129 | ret = regmap_write(info->rtc, SEC_RTC_UDR_CON, data); | 156 | ret = regmap_write(info->regmap, SEC_RTC_UDR_CON, data); |
130 | if (ret < 0) { | 157 | if (ret < 0) { |
131 | dev_err(info->dev, "%s: fail to write update reg(%d)\n", | 158 | dev_err(info->dev, "%s: fail to write update reg(%d)\n", |
132 | __func__, ret); | 159 | __func__, ret); |
133 | return ret; | 160 | return ret; |
134 | } | 161 | } |
135 | 162 | ||
136 | do { | 163 | ret = s5m8767_wait_for_udr_update(info); |
137 | ret = regmap_read(info->rtc, SEC_RTC_UDR_CON, &data); | ||
138 | } while ((data & RTC_UDR_MASK) && !ret); | ||
139 | 164 | ||
140 | return ret; | 165 | return ret; |
141 | } | 166 | } |
@@ -178,7 +203,7 @@ static int s5m_rtc_read_time(struct device *dev, struct rtc_time *tm) | |||
178 | u8 data[8]; | 203 | u8 data[8]; |
179 | int ret; | 204 | int ret; |
180 | 205 | ||
181 | ret = regmap_bulk_read(info->rtc, SEC_RTC_SEC, data, 8); | 206 | ret = regmap_bulk_read(info->regmap, SEC_RTC_SEC, data, 8); |
182 | if (ret < 0) | 207 | if (ret < 0) |
183 | return ret; | 208 | return ret; |
184 | 209 | ||
@@ -226,7 +251,7 @@ static int s5m_rtc_set_time(struct device *dev, struct rtc_time *tm) | |||
226 | 1900 + tm->tm_year, 1 + tm->tm_mon, tm->tm_mday, | 251 | 1900 + tm->tm_year, 1 + tm->tm_mon, tm->tm_mday, |
227 | tm->tm_hour, tm->tm_min, tm->tm_sec, tm->tm_wday); | 252 | tm->tm_hour, tm->tm_min, tm->tm_sec, tm->tm_wday); |
228 | 253 | ||
229 | ret = regmap_raw_write(info->rtc, SEC_RTC_SEC, data, 8); | 254 | ret = regmap_raw_write(info->regmap, SEC_RTC_SEC, data, 8); |
230 | if (ret < 0) | 255 | if (ret < 0) |
231 | return ret; | 256 | return ret; |
232 | 257 | ||
@@ -242,20 +267,20 @@ static int s5m_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm) | |||
242 | unsigned int val; | 267 | unsigned int val; |
243 | int ret, i; | 268 | int ret, i; |
244 | 269 | ||
245 | ret = regmap_bulk_read(info->rtc, SEC_ALARM0_SEC, data, 8); | 270 | ret = regmap_bulk_read(info->regmap, SEC_ALARM0_SEC, data, 8); |
246 | if (ret < 0) | 271 | if (ret < 0) |
247 | return ret; | 272 | return ret; |
248 | 273 | ||
249 | switch (info->device_type) { | 274 | switch (info->device_type) { |
250 | case S5M8763X: | 275 | case S5M8763X: |
251 | s5m8763_data_to_tm(data, &alrm->time); | 276 | s5m8763_data_to_tm(data, &alrm->time); |
252 | ret = regmap_read(info->rtc, SEC_ALARM0_CONF, &val); | 277 | ret = regmap_read(info->regmap, SEC_ALARM0_CONF, &val); |
253 | if (ret < 0) | 278 | if (ret < 0) |
254 | return ret; | 279 | return ret; |
255 | 280 | ||
256 | alrm->enabled = !!val; | 281 | alrm->enabled = !!val; |
257 | 282 | ||
258 | ret = regmap_read(info->rtc, SEC_RTC_STATUS, &val); | 283 | ret = regmap_read(info->regmap, SEC_RTC_STATUS, &val); |
259 | if (ret < 0) | 284 | if (ret < 0) |
260 | return ret; | 285 | return ret; |
261 | 286 | ||
@@ -278,7 +303,7 @@ static int s5m_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm) | |||
278 | } | 303 | } |
279 | 304 | ||
280 | alrm->pending = 0; | 305 | alrm->pending = 0; |
281 | ret = regmap_read(info->rtc, SEC_RTC_STATUS, &val); | 306 | ret = regmap_read(info->regmap, SEC_RTC_STATUS, &val); |
282 | if (ret < 0) | 307 | if (ret < 0) |
283 | return ret; | 308 | return ret; |
284 | break; | 309 | break; |
@@ -301,7 +326,7 @@ static int s5m_rtc_stop_alarm(struct s5m_rtc_info *info) | |||
301 | int ret, i; | 326 | int ret, i; |
302 | struct rtc_time tm; | 327 | struct rtc_time tm; |
303 | 328 | ||
304 | ret = regmap_bulk_read(info->rtc, SEC_ALARM0_SEC, data, 8); | 329 | ret = regmap_bulk_read(info->regmap, SEC_ALARM0_SEC, data, 8); |
305 | if (ret < 0) | 330 | if (ret < 0) |
306 | return ret; | 331 | return ret; |
307 | 332 | ||
@@ -312,14 +337,14 @@ static int s5m_rtc_stop_alarm(struct s5m_rtc_info *info) | |||
312 | 337 | ||
313 | switch (info->device_type) { | 338 | switch (info->device_type) { |
314 | case S5M8763X: | 339 | case S5M8763X: |
315 | ret = regmap_write(info->rtc, SEC_ALARM0_CONF, 0); | 340 | ret = regmap_write(info->regmap, SEC_ALARM0_CONF, 0); |
316 | break; | 341 | break; |
317 | 342 | ||
318 | case S5M8767X: | 343 | case S5M8767X: |
319 | for (i = 0; i < 7; i++) | 344 | for (i = 0; i < 7; i++) |
320 | data[i] &= ~ALARM_ENABLE_MASK; | 345 | data[i] &= ~ALARM_ENABLE_MASK; |
321 | 346 | ||
322 | ret = regmap_raw_write(info->rtc, SEC_ALARM0_SEC, data, 8); | 347 | ret = regmap_raw_write(info->regmap, SEC_ALARM0_SEC, data, 8); |
323 | if (ret < 0) | 348 | if (ret < 0) |
324 | return ret; | 349 | return ret; |
325 | 350 | ||
@@ -341,7 +366,7 @@ static int s5m_rtc_start_alarm(struct s5m_rtc_info *info) | |||
341 | u8 alarm0_conf; | 366 | u8 alarm0_conf; |
342 | struct rtc_time tm; | 367 | struct rtc_time tm; |
343 | 368 | ||
344 | ret = regmap_bulk_read(info->rtc, SEC_ALARM0_SEC, data, 8); | 369 | ret = regmap_bulk_read(info->regmap, SEC_ALARM0_SEC, data, 8); |
345 | if (ret < 0) | 370 | if (ret < 0) |
346 | return ret; | 371 | return ret; |
347 | 372 | ||
@@ -353,7 +378,7 @@ static int s5m_rtc_start_alarm(struct s5m_rtc_info *info) | |||
353 | switch (info->device_type) { | 378 | switch (info->device_type) { |
354 | case S5M8763X: | 379 | case S5M8763X: |
355 | alarm0_conf = 0x77; | 380 | alarm0_conf = 0x77; |
356 | ret = regmap_write(info->rtc, SEC_ALARM0_CONF, alarm0_conf); | 381 | ret = regmap_write(info->regmap, SEC_ALARM0_CONF, alarm0_conf); |
357 | break; | 382 | break; |
358 | 383 | ||
359 | case S5M8767X: | 384 | case S5M8767X: |
@@ -368,7 +393,7 @@ static int s5m_rtc_start_alarm(struct s5m_rtc_info *info) | |||
368 | if (data[RTC_YEAR1] & 0x7f) | 393 | if (data[RTC_YEAR1] & 0x7f) |
369 | data[RTC_YEAR1] |= ALARM_ENABLE_MASK; | 394 | data[RTC_YEAR1] |= ALARM_ENABLE_MASK; |
370 | 395 | ||
371 | ret = regmap_raw_write(info->rtc, SEC_ALARM0_SEC, data, 8); | 396 | ret = regmap_raw_write(info->regmap, SEC_ALARM0_SEC, data, 8); |
372 | if (ret < 0) | 397 | if (ret < 0) |
373 | return ret; | 398 | return ret; |
374 | ret = s5m8767_rtc_set_alarm_reg(info); | 399 | ret = s5m8767_rtc_set_alarm_reg(info); |
@@ -410,7 +435,7 @@ static int s5m_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm) | |||
410 | if (ret < 0) | 435 | if (ret < 0) |
411 | return ret; | 436 | return ret; |
412 | 437 | ||
413 | ret = regmap_raw_write(info->rtc, SEC_ALARM0_SEC, data, 8); | 438 | ret = regmap_raw_write(info->regmap, SEC_ALARM0_SEC, data, 8); |
414 | if (ret < 0) | 439 | if (ret < 0) |
415 | return ret; | 440 | return ret; |
416 | 441 | ||
@@ -455,7 +480,7 @@ static const struct rtc_class_ops s5m_rtc_ops = { | |||
455 | static void s5m_rtc_enable_wtsr(struct s5m_rtc_info *info, bool enable) | 480 | static void s5m_rtc_enable_wtsr(struct s5m_rtc_info *info, bool enable) |
456 | { | 481 | { |
457 | int ret; | 482 | int ret; |
458 | ret = regmap_update_bits(info->rtc, SEC_WTSR_SMPL_CNTL, | 483 | ret = regmap_update_bits(info->regmap, SEC_WTSR_SMPL_CNTL, |
459 | WTSR_ENABLE_MASK, | 484 | WTSR_ENABLE_MASK, |
460 | enable ? WTSR_ENABLE_MASK : 0); | 485 | enable ? WTSR_ENABLE_MASK : 0); |
461 | if (ret < 0) | 486 | if (ret < 0) |
@@ -466,7 +491,7 @@ static void s5m_rtc_enable_wtsr(struct s5m_rtc_info *info, bool enable) | |||
466 | static void s5m_rtc_enable_smpl(struct s5m_rtc_info *info, bool enable) | 491 | static void s5m_rtc_enable_smpl(struct s5m_rtc_info *info, bool enable) |
467 | { | 492 | { |
468 | int ret; | 493 | int ret; |
469 | ret = regmap_update_bits(info->rtc, SEC_WTSR_SMPL_CNTL, | 494 | ret = regmap_update_bits(info->regmap, SEC_WTSR_SMPL_CNTL, |
470 | SMPL_ENABLE_MASK, | 495 | SMPL_ENABLE_MASK, |
471 | enable ? SMPL_ENABLE_MASK : 0); | 496 | enable ? SMPL_ENABLE_MASK : 0); |
472 | if (ret < 0) | 497 | if (ret < 0) |
@@ -481,7 +506,7 @@ static int s5m8767_rtc_init_reg(struct s5m_rtc_info *info) | |||
481 | int ret; | 506 | int ret; |
482 | struct rtc_time tm; | 507 | struct rtc_time tm; |
483 | 508 | ||
484 | ret = regmap_read(info->rtc, SEC_RTC_UDR_CON, &tp_read); | 509 | ret = regmap_read(info->regmap, SEC_RTC_UDR_CON, &tp_read); |
485 | if (ret < 0) { | 510 | if (ret < 0) { |
486 | dev_err(info->dev, "%s: fail to read control reg(%d)\n", | 511 | dev_err(info->dev, "%s: fail to read control reg(%d)\n", |
487 | __func__, ret); | 512 | __func__, ret); |
@@ -493,7 +518,7 @@ static int s5m8767_rtc_init_reg(struct s5m_rtc_info *info) | |||
493 | data[1] = (0 << BCD_EN_SHIFT) | (1 << MODEL24_SHIFT); | 518 | data[1] = (0 << BCD_EN_SHIFT) | (1 << MODEL24_SHIFT); |
494 | 519 | ||
495 | info->rtc_24hr_mode = 1; | 520 | info->rtc_24hr_mode = 1; |
496 | ret = regmap_raw_write(info->rtc, SEC_ALARM0_CONF, data, 2); | 521 | ret = regmap_raw_write(info->regmap, SEC_ALARM0_CONF, data, 2); |
497 | if (ret < 0) { | 522 | if (ret < 0) { |
498 | dev_err(info->dev, "%s: fail to write controlm reg(%d)\n", | 523 | dev_err(info->dev, "%s: fail to write controlm reg(%d)\n", |
499 | __func__, ret); | 524 | __func__, ret); |
@@ -515,7 +540,7 @@ static int s5m8767_rtc_init_reg(struct s5m_rtc_info *info) | |||
515 | ret = s5m_rtc_set_time(info->dev, &tm); | 540 | ret = s5m_rtc_set_time(info->dev, &tm); |
516 | } | 541 | } |
517 | 542 | ||
518 | ret = regmap_update_bits(info->rtc, SEC_RTC_UDR_CON, | 543 | ret = regmap_update_bits(info->regmap, SEC_RTC_UDR_CON, |
519 | RTC_TCON_MASK, tp_read | RTC_TCON_MASK); | 544 | RTC_TCON_MASK, tp_read | RTC_TCON_MASK); |
520 | if (ret < 0) | 545 | if (ret < 0) |
521 | dev_err(info->dev, "%s: fail to update TCON reg(%d)\n", | 546 | dev_err(info->dev, "%s: fail to update TCON reg(%d)\n", |
@@ -542,17 +567,19 @@ static int s5m_rtc_probe(struct platform_device *pdev) | |||
542 | 567 | ||
543 | info->dev = &pdev->dev; | 568 | info->dev = &pdev->dev; |
544 | info->s5m87xx = s5m87xx; | 569 | info->s5m87xx = s5m87xx; |
545 | info->rtc = s5m87xx->rtc; | 570 | info->regmap = s5m87xx->regmap_rtc; |
546 | info->device_type = s5m87xx->device_type; | 571 | info->device_type = s5m87xx->device_type; |
547 | info->wtsr_smpl = s5m87xx->wtsr_smpl; | 572 | info->wtsr_smpl = s5m87xx->wtsr_smpl; |
548 | 573 | ||
549 | switch (pdata->device_type) { | 574 | switch (pdata->device_type) { |
550 | case S5M8763X: | 575 | case S5M8763X: |
551 | info->irq = s5m87xx->irq_base + S5M8763_IRQ_ALARM0; | 576 | info->irq = regmap_irq_get_virq(s5m87xx->irq_data, |
577 | S5M8763_IRQ_ALARM0); | ||
552 | break; | 578 | break; |
553 | 579 | ||
554 | case S5M8767X: | 580 | case S5M8767X: |
555 | info->irq = s5m87xx->irq_base + S5M8767_IRQ_RTCA1; | 581 | info->irq = regmap_irq_get_virq(s5m87xx->irq_data, |
582 | S5M8767_IRQ_RTCA1); | ||
556 | break; | 583 | break; |
557 | 584 | ||
558 | default: | 585 | default: |
@@ -596,7 +623,7 @@ static void s5m_rtc_shutdown(struct platform_device *pdev) | |||
596 | if (info->wtsr_smpl) { | 623 | if (info->wtsr_smpl) { |
597 | for (i = 0; i < 3; i++) { | 624 | for (i = 0; i < 3; i++) { |
598 | s5m_rtc_enable_wtsr(info, false); | 625 | s5m_rtc_enable_wtsr(info, false); |
599 | regmap_read(info->rtc, SEC_WTSR_SMPL_CNTL, &val); | 626 | regmap_read(info->regmap, SEC_WTSR_SMPL_CNTL, &val); |
600 | pr_debug("%s: WTSR_SMPL reg(0x%02x)\n", __func__, val); | 627 | pr_debug("%s: WTSR_SMPL reg(0x%02x)\n", __func__, val); |
601 | if (val & WTSR_ENABLE_MASK) | 628 | if (val & WTSR_ENABLE_MASK) |
602 | pr_emerg("%s: fail to disable WTSR\n", | 629 | pr_emerg("%s: fail to disable WTSR\n", |
@@ -612,6 +639,30 @@ static void s5m_rtc_shutdown(struct platform_device *pdev) | |||
612 | s5m_rtc_enable_smpl(info, false); | 639 | s5m_rtc_enable_smpl(info, false); |
613 | } | 640 | } |
614 | 641 | ||
642 | static int s5m_rtc_resume(struct device *dev) | ||
643 | { | ||
644 | struct s5m_rtc_info *info = dev_get_drvdata(dev); | ||
645 | int ret = 0; | ||
646 | |||
647 | if (device_may_wakeup(dev)) | ||
648 | ret = disable_irq_wake(info->irq); | ||
649 | |||
650 | return ret; | ||
651 | } | ||
652 | |||
653 | static int s5m_rtc_suspend(struct device *dev) | ||
654 | { | ||
655 | struct s5m_rtc_info *info = dev_get_drvdata(dev); | ||
656 | int ret = 0; | ||
657 | |||
658 | if (device_may_wakeup(dev)) | ||
659 | ret = enable_irq_wake(info->irq); | ||
660 | |||
661 | return ret; | ||
662 | } | ||
663 | |||
664 | static SIMPLE_DEV_PM_OPS(s5m_rtc_pm_ops, s5m_rtc_suspend, s5m_rtc_resume); | ||
665 | |||
615 | static const struct platform_device_id s5m_rtc_id[] = { | 666 | static const struct platform_device_id s5m_rtc_id[] = { |
616 | { "s5m-rtc", 0 }, | 667 | { "s5m-rtc", 0 }, |
617 | }; | 668 | }; |
@@ -620,6 +671,7 @@ static struct platform_driver s5m_rtc_driver = { | |||
620 | .driver = { | 671 | .driver = { |
621 | .name = "s5m-rtc", | 672 | .name = "s5m-rtc", |
622 | .owner = THIS_MODULE, | 673 | .owner = THIS_MODULE, |
674 | .pm = &s5m_rtc_pm_ops, | ||
623 | }, | 675 | }, |
624 | .probe = s5m_rtc_probe, | 676 | .probe = s5m_rtc_probe, |
625 | .shutdown = s5m_rtc_shutdown, | 677 | .shutdown = s5m_rtc_shutdown, |
diff --git a/fs/proc/inode.c b/fs/proc/inode.c index 28955d4b7218..124fc43c7090 100644 --- a/fs/proc/inode.c +++ b/fs/proc/inode.c | |||
@@ -292,16 +292,20 @@ proc_reg_get_unmapped_area(struct file *file, unsigned long orig_addr, | |||
292 | { | 292 | { |
293 | struct proc_dir_entry *pde = PDE(file_inode(file)); | 293 | struct proc_dir_entry *pde = PDE(file_inode(file)); |
294 | unsigned long rv = -EIO; | 294 | unsigned long rv = -EIO; |
295 | unsigned long (*get_area)(struct file *, unsigned long, unsigned long, | 295 | |
296 | unsigned long, unsigned long) = NULL; | ||
297 | if (use_pde(pde)) { | 296 | if (use_pde(pde)) { |
297 | typeof(proc_reg_get_unmapped_area) *get_area; | ||
298 | |||
299 | get_area = pde->proc_fops->get_unmapped_area; | ||
298 | #ifdef CONFIG_MMU | 300 | #ifdef CONFIG_MMU |
299 | get_area = current->mm->get_unmapped_area; | 301 | if (!get_area) |
302 | get_area = current->mm->get_unmapped_area; | ||
300 | #endif | 303 | #endif |
301 | if (pde->proc_fops->get_unmapped_area) | 304 | |
302 | get_area = pde->proc_fops->get_unmapped_area; | ||
303 | if (get_area) | 305 | if (get_area) |
304 | rv = get_area(file, orig_addr, len, pgoff, flags); | 306 | rv = get_area(file, orig_addr, len, pgoff, flags); |
307 | else | ||
308 | rv = orig_addr; | ||
305 | unuse_pde(pde); | 309 | unuse_pde(pde); |
306 | } | 310 | } |
307 | return rv; | 311 | return rv; |
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h index 9649ff0c63f8..bd7e98752222 100644 --- a/include/linux/hugetlb.h +++ b/include/linux/hugetlb.h | |||
@@ -142,7 +142,10 @@ static inline int dequeue_hwpoisoned_huge_page(struct page *page) | |||
142 | return 0; | 142 | return 0; |
143 | } | 143 | } |
144 | 144 | ||
145 | #define isolate_huge_page(p, l) false | 145 | static inline bool isolate_huge_page(struct page *page, struct list_head *list) |
146 | { | ||
147 | return false; | ||
148 | } | ||
146 | #define putback_active_hugepage(p) do {} while (0) | 149 | #define putback_active_hugepage(p) do {} while (0) |
147 | #define is_hugepage_active(x) false | 150 | #define is_hugepage_active(x) false |
148 | 151 | ||
diff --git a/include/linux/kernel.h b/include/linux/kernel.h index d4e98d13eff4..ecb87544cc5d 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h | |||
@@ -193,7 +193,8 @@ extern int _cond_resched(void); | |||
193 | (__x < 0) ? -__x : __x; \ | 193 | (__x < 0) ? -__x : __x; \ |
194 | }) | 194 | }) |
195 | 195 | ||
196 | #if defined(CONFIG_PROVE_LOCKING) || defined(CONFIG_DEBUG_ATOMIC_SLEEP) | 196 | #if defined(CONFIG_MMU) && \ |
197 | (defined(CONFIG_PROVE_LOCKING) || defined(CONFIG_DEBUG_ATOMIC_SLEEP)) | ||
197 | void might_fault(void); | 198 | void might_fault(void); |
198 | #else | 199 | #else |
199 | static inline void might_fault(void) { } | 200 | static inline void might_fault(void) { } |
diff --git a/include/linux/mfd/samsung/core.h b/include/linux/mfd/samsung/core.h index 2d0c9071bcfb..cab2dd279076 100644 --- a/include/linux/mfd/samsung/core.h +++ b/include/linux/mfd/samsung/core.h | |||
@@ -39,7 +39,8 @@ enum sec_device_type { | |||
39 | struct sec_pmic_dev { | 39 | struct sec_pmic_dev { |
40 | struct device *dev; | 40 | struct device *dev; |
41 | struct sec_platform_data *pdata; | 41 | struct sec_platform_data *pdata; |
42 | struct regmap *regmap; | 42 | struct regmap *regmap_pmic; |
43 | struct regmap *regmap_rtc; | ||
43 | struct i2c_client *i2c; | 44 | struct i2c_client *i2c; |
44 | struct i2c_client *rtc; | 45 | struct i2c_client *rtc; |
45 | 46 | ||
diff --git a/mm/huge_memory.c b/mm/huge_memory.c index bccd5a628ea6..33a5dc492810 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c | |||
@@ -1481,8 +1481,18 @@ int move_huge_pmd(struct vm_area_struct *vma, struct vm_area_struct *new_vma, | |||
1481 | pmd = pmdp_get_and_clear(mm, old_addr, old_pmd); | 1481 | pmd = pmdp_get_and_clear(mm, old_addr, old_pmd); |
1482 | VM_BUG_ON(!pmd_none(*new_pmd)); | 1482 | VM_BUG_ON(!pmd_none(*new_pmd)); |
1483 | set_pmd_at(mm, new_addr, new_pmd, pmd_mksoft_dirty(pmd)); | 1483 | set_pmd_at(mm, new_addr, new_pmd, pmd_mksoft_dirty(pmd)); |
1484 | if (new_ptl != old_ptl) | 1484 | if (new_ptl != old_ptl) { |
1485 | pgtable_t pgtable; | ||
1486 | |||
1487 | /* | ||
1488 | * Move preallocated PTE page table if new_pmd is on | ||
1489 | * different PMD page table. | ||
1490 | */ | ||
1491 | pgtable = pgtable_trans_huge_withdraw(mm, old_pmd); | ||
1492 | pgtable_trans_huge_deposit(mm, new_pmd, pgtable); | ||
1493 | |||
1485 | spin_unlock(new_ptl); | 1494 | spin_unlock(new_ptl); |
1495 | } | ||
1486 | spin_unlock(old_ptl); | 1496 | spin_unlock(old_ptl); |
1487 | } | 1497 | } |
1488 | out: | 1498 | out: |
diff --git a/mm/memcontrol.c b/mm/memcontrol.c index f1a0ae6e11b8..bf5e89457149 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c | |||
@@ -2694,7 +2694,10 @@ static int __mem_cgroup_try_charge(struct mm_struct *mm, | |||
2694 | goto bypass; | 2694 | goto bypass; |
2695 | 2695 | ||
2696 | if (unlikely(task_in_memcg_oom(current))) | 2696 | if (unlikely(task_in_memcg_oom(current))) |
2697 | goto bypass; | 2697 | goto nomem; |
2698 | |||
2699 | if (gfp_mask & __GFP_NOFAIL) | ||
2700 | oom = false; | ||
2698 | 2701 | ||
2699 | /* | 2702 | /* |
2700 | * We always charge the cgroup the mm_struct belongs to. | 2703 | * We always charge the cgroup the mm_struct belongs to. |
@@ -6352,6 +6355,42 @@ static void mem_cgroup_css_offline(struct cgroup_subsys_state *css) | |||
6352 | static void mem_cgroup_css_free(struct cgroup_subsys_state *css) | 6355 | static void mem_cgroup_css_free(struct cgroup_subsys_state *css) |
6353 | { | 6356 | { |
6354 | struct mem_cgroup *memcg = mem_cgroup_from_css(css); | 6357 | struct mem_cgroup *memcg = mem_cgroup_from_css(css); |
6358 | /* | ||
6359 | * XXX: css_offline() would be where we should reparent all | ||
6360 | * memory to prepare the cgroup for destruction. However, | ||
6361 | * memcg does not do css_tryget() and res_counter charging | ||
6362 | * under the same RCU lock region, which means that charging | ||
6363 | * could race with offlining. Offlining only happens to | ||
6364 | * cgroups with no tasks in them but charges can show up | ||
6365 | * without any tasks from the swapin path when the target | ||
6366 | * memcg is looked up from the swapout record and not from the | ||
6367 | * current task as it usually is. A race like this can leak | ||
6368 | * charges and put pages with stale cgroup pointers into | ||
6369 | * circulation: | ||
6370 | * | ||
6371 | * #0 #1 | ||
6372 | * lookup_swap_cgroup_id() | ||
6373 | * rcu_read_lock() | ||
6374 | * mem_cgroup_lookup() | ||
6375 | * css_tryget() | ||
6376 | * rcu_read_unlock() | ||
6377 | * disable css_tryget() | ||
6378 | * call_rcu() | ||
6379 | * offline_css() | ||
6380 | * reparent_charges() | ||
6381 | * res_counter_charge() | ||
6382 | * css_put() | ||
6383 | * css_free() | ||
6384 | * pc->mem_cgroup = dead memcg | ||
6385 | * add page to lru | ||
6386 | * | ||
6387 | * The bulk of the charges are still moved in offline_css() to | ||
6388 | * avoid pinning a lot of pages in case a long-term reference | ||
6389 | * like a swapout record is deferring the css_free() to long | ||
6390 | * after offlining. But this makes sure we catch any charges | ||
6391 | * made after offlining: | ||
6392 | */ | ||
6393 | mem_cgroup_reparent_charges(memcg); | ||
6355 | 6394 | ||
6356 | memcg_destroy_kmem(memcg); | 6395 | memcg_destroy_kmem(memcg); |
6357 | __mem_cgroup_free(memcg); | 6396 | __mem_cgroup_free(memcg); |