Commit 8d276377 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'akpm' (fixes from Andrew)

Merge patches from Andrew Morton:
  "13 fixes"

* emailed patches from Andrew Morton <akpm@linux-foundation.org>:
  mm: memcg: do not allow task about to OOM kill to bypass the limit
  mm: memcg: fix race condition between memcg teardown and swapin
  thp: move preallocated PTE page table on move_huge_pmd()
  mfd/rtc: s5m: fix register updating by adding regmap for RTC
  rtc: s5m: enable IRQ wake during suspend
  rtc: s5m: limit endless loop waiting for register update
  rtc: s5m: fix unsuccesful IRQ request during probe
  drivers/rtc/rtc-s5m.c: fix info->rtc assignment
  include/linux/kernel.h: make might_fault() a nop for !MMU
  drivers/rtc/rtc-at91rm9200.c: correct alarm over day/month wrap
  procfs: also fix proc_reg_get_unmapped_area() for !MMU case
  mm: memcg: do not declare OOM from __GFP_NOFAIL allocations
  include/linux/hugetlb.h: make isolate_huge_page() an inline
parents 54fb723c 1f14c1ac
...@@ -81,31 +81,31 @@ static struct of_device_id sec_dt_match[] = { ...@@ -81,31 +81,31 @@ static struct of_device_id sec_dt_match[] = {
int sec_reg_read(struct sec_pmic_dev *sec_pmic, u8 reg, void *dest) int sec_reg_read(struct sec_pmic_dev *sec_pmic, u8 reg, void *dest)
{ {
return regmap_read(sec_pmic->regmap, reg, dest); return regmap_read(sec_pmic->regmap_pmic, reg, dest);
} }
EXPORT_SYMBOL_GPL(sec_reg_read); EXPORT_SYMBOL_GPL(sec_reg_read);
int sec_bulk_read(struct sec_pmic_dev *sec_pmic, u8 reg, int count, u8 *buf) int sec_bulk_read(struct sec_pmic_dev *sec_pmic, u8 reg, int count, u8 *buf)
{ {
return regmap_bulk_read(sec_pmic->regmap, reg, buf, count); return regmap_bulk_read(sec_pmic->regmap_pmic, reg, buf, count);
} }
EXPORT_SYMBOL_GPL(sec_bulk_read); EXPORT_SYMBOL_GPL(sec_bulk_read);
int sec_reg_write(struct sec_pmic_dev *sec_pmic, u8 reg, u8 value) int sec_reg_write(struct sec_pmic_dev *sec_pmic, u8 reg, u8 value)
{ {
return regmap_write(sec_pmic->regmap, reg, value); return regmap_write(sec_pmic->regmap_pmic, reg, value);
} }
EXPORT_SYMBOL_GPL(sec_reg_write); EXPORT_SYMBOL_GPL(sec_reg_write);
int sec_bulk_write(struct sec_pmic_dev *sec_pmic, u8 reg, int count, u8 *buf) int sec_bulk_write(struct sec_pmic_dev *sec_pmic, u8 reg, int count, u8 *buf)
{ {
return regmap_raw_write(sec_pmic->regmap, reg, buf, count); return regmap_raw_write(sec_pmic->regmap_pmic, reg, buf, count);
} }
EXPORT_SYMBOL_GPL(sec_bulk_write); EXPORT_SYMBOL_GPL(sec_bulk_write);
int sec_reg_update(struct sec_pmic_dev *sec_pmic, u8 reg, u8 val, u8 mask) int sec_reg_update(struct sec_pmic_dev *sec_pmic, u8 reg, u8 val, u8 mask)
{ {
return regmap_update_bits(sec_pmic->regmap, reg, mask, val); return regmap_update_bits(sec_pmic->regmap_pmic, reg, mask, val);
} }
EXPORT_SYMBOL_GPL(sec_reg_update); EXPORT_SYMBOL_GPL(sec_reg_update);
...@@ -166,6 +166,11 @@ static struct regmap_config s5m8767_regmap_config = { ...@@ -166,6 +166,11 @@ static struct regmap_config s5m8767_regmap_config = {
.cache_type = REGCACHE_FLAT, .cache_type = REGCACHE_FLAT,
}; };
static const struct regmap_config sec_rtc_regmap_config = {
.reg_bits = 8,
.val_bits = 8,
};
#ifdef CONFIG_OF #ifdef CONFIG_OF
/* /*
* Only the common platform data elements for s5m8767 are parsed here from the * 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,9 +271,9 @@ static int sec_pmic_probe(struct i2c_client *i2c,
break; break;
} }
sec_pmic->regmap = devm_regmap_init_i2c(i2c, regmap); sec_pmic->regmap_pmic = devm_regmap_init_i2c(i2c, regmap);
if (IS_ERR(sec_pmic->regmap)) { if (IS_ERR(sec_pmic->regmap_pmic)) {
ret = PTR_ERR(sec_pmic->regmap); ret = PTR_ERR(sec_pmic->regmap_pmic);
dev_err(&i2c->dev, "Failed to allocate register map: %d\n", dev_err(&i2c->dev, "Failed to allocate register map: %d\n",
ret); ret);
return ret; return ret;
...@@ -277,6 +282,15 @@ static int sec_pmic_probe(struct i2c_client *i2c, ...@@ -277,6 +282,15 @@ static int sec_pmic_probe(struct i2c_client *i2c,
sec_pmic->rtc = i2c_new_dummy(i2c->adapter, RTC_I2C_ADDR); sec_pmic->rtc = i2c_new_dummy(i2c->adapter, RTC_I2C_ADDR);
i2c_set_clientdata(sec_pmic->rtc, sec_pmic); i2c_set_clientdata(sec_pmic->rtc, sec_pmic);
sec_pmic->regmap_rtc = devm_regmap_init_i2c(sec_pmic->rtc,
&sec_rtc_regmap_config);
if (IS_ERR(sec_pmic->regmap_rtc)) {
ret = PTR_ERR(sec_pmic->regmap_rtc);
dev_err(&i2c->dev, "Failed to allocate RTC register map: %d\n",
ret);
return ret;
}
if (pdata && pdata->cfg_pmic_irq) if (pdata && pdata->cfg_pmic_irq)
pdata->cfg_pmic_irq(); pdata->cfg_pmic_irq();
......
...@@ -280,19 +280,19 @@ int sec_irq_init(struct sec_pmic_dev *sec_pmic) ...@@ -280,19 +280,19 @@ int sec_irq_init(struct sec_pmic_dev *sec_pmic)
switch (type) { switch (type) {
case S5M8763X: case S5M8763X:
ret = regmap_add_irq_chip(sec_pmic->regmap, sec_pmic->irq, ret = regmap_add_irq_chip(sec_pmic->regmap_pmic, sec_pmic->irq,
IRQF_TRIGGER_FALLING | IRQF_ONESHOT, IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
sec_pmic->irq_base, &s5m8763_irq_chip, sec_pmic->irq_base, &s5m8763_irq_chip,
&sec_pmic->irq_data); &sec_pmic->irq_data);
break; break;
case S5M8767X: case S5M8767X:
ret = regmap_add_irq_chip(sec_pmic->regmap, sec_pmic->irq, ret = regmap_add_irq_chip(sec_pmic->regmap_pmic, sec_pmic->irq,
IRQF_TRIGGER_FALLING | IRQF_ONESHOT, IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
sec_pmic->irq_base, &s5m8767_irq_chip, sec_pmic->irq_base, &s5m8767_irq_chip,
&sec_pmic->irq_data); &sec_pmic->irq_data);
break; break;
case S2MPS11X: case S2MPS11X:
ret = regmap_add_irq_chip(sec_pmic->regmap, sec_pmic->irq, ret = regmap_add_irq_chip(sec_pmic->regmap_pmic, sec_pmic->irq,
IRQF_TRIGGER_FALLING | IRQF_ONESHOT, IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
sec_pmic->irq_base, &s2mps11_irq_chip, sec_pmic->irq_base, &s2mps11_irq_chip,
&sec_pmic->irq_data); &sec_pmic->irq_data);
......
...@@ -925,7 +925,7 @@ static int s5m8767_pmic_probe(struct platform_device *pdev) ...@@ -925,7 +925,7 @@ static int s5m8767_pmic_probe(struct platform_device *pdev)
config.dev = s5m8767->dev; config.dev = s5m8767->dev;
config.init_data = pdata->regulators[i].initdata; config.init_data = pdata->regulators[i].initdata;
config.driver_data = s5m8767; config.driver_data = s5m8767;
config.regmap = iodev->regmap; config.regmap = iodev->regmap_pmic;
config.of_node = pdata->regulators[i].reg_node; config.of_node = pdata->regulators[i].reg_node;
rdev[i] = devm_regulator_register(&pdev->dev, &regulators[id], rdev[i] = devm_regulator_register(&pdev->dev, &regulators[id],
......
...@@ -220,6 +220,8 @@ static int at91_rtc_setalarm(struct device *dev, struct rtc_wkalrm *alrm) ...@@ -220,6 +220,8 @@ static int at91_rtc_setalarm(struct device *dev, struct rtc_wkalrm *alrm)
at91_alarm_year = tm.tm_year; at91_alarm_year = tm.tm_year;
tm.tm_mon = alrm->time.tm_mon;
tm.tm_mday = alrm->time.tm_mday;
tm.tm_hour = alrm->time.tm_hour; tm.tm_hour = alrm->time.tm_hour;
tm.tm_min = alrm->time.tm_min; tm.tm_min = alrm->time.tm_min;
tm.tm_sec = alrm->time.tm_sec; tm.tm_sec = alrm->time.tm_sec;
......
...@@ -28,10 +28,20 @@ ...@@ -28,10 +28,20 @@
#include <linux/mfd/samsung/irq.h> #include <linux/mfd/samsung/irq.h>
#include <linux/mfd/samsung/rtc.h> #include <linux/mfd/samsung/rtc.h>
/*
* Maximum number of retries for checking changes in UDR field
* of SEC_RTC_UDR_CON register (to limit possible endless loop).
*
* After writing to RTC registers (setting time or alarm) read the UDR field
* in SEC_RTC_UDR_CON register. UDR is auto-cleared when data have
* been transferred.
*/
#define UDR_READ_RETRY_CNT 5
struct s5m_rtc_info { struct s5m_rtc_info {
struct device *dev; struct device *dev;
struct sec_pmic_dev *s5m87xx; struct sec_pmic_dev *s5m87xx;
struct regmap *rtc; struct regmap *regmap;
struct rtc_device *rtc_dev; struct rtc_device *rtc_dev;
int irq; int irq;
int device_type; int device_type;
...@@ -84,12 +94,31 @@ static int s5m8767_tm_to_data(struct rtc_time *tm, u8 *data) ...@@ -84,12 +94,31 @@ static int s5m8767_tm_to_data(struct rtc_time *tm, u8 *data)
} }
} }
/*
* Read RTC_UDR_CON register and wait till UDR field is cleared.
* This indicates that time/alarm update ended.
*/
static inline int s5m8767_wait_for_udr_update(struct s5m_rtc_info *info)
{
int ret, retry = UDR_READ_RETRY_CNT;
unsigned int data;
do {
ret = regmap_read(info->regmap, SEC_RTC_UDR_CON, &data);
} while (--retry && (data & RTC_UDR_MASK) && !ret);
if (!retry)
dev_err(info->dev, "waiting for UDR update, reached max number of retries\n");
return ret;
}
static inline int s5m8767_rtc_set_time_reg(struct s5m_rtc_info *info) static inline int s5m8767_rtc_set_time_reg(struct s5m_rtc_info *info)
{ {
int ret; int ret;
unsigned int data; unsigned int data;
ret = regmap_read(info->rtc, SEC_RTC_UDR_CON, &data); ret = regmap_read(info->regmap, SEC_RTC_UDR_CON, &data);
if (ret < 0) { if (ret < 0) {
dev_err(info->dev, "failed to read update reg(%d)\n", ret); dev_err(info->dev, "failed to read update reg(%d)\n", ret);
return ret; return ret;
...@@ -98,15 +127,13 @@ static inline int s5m8767_rtc_set_time_reg(struct s5m_rtc_info *info) ...@@ -98,15 +127,13 @@ static inline int s5m8767_rtc_set_time_reg(struct s5m_rtc_info *info)
data |= RTC_TIME_EN_MASK; data |= RTC_TIME_EN_MASK;
data |= RTC_UDR_MASK; data |= RTC_UDR_MASK;
ret = regmap_write(info->rtc, SEC_RTC_UDR_CON, data); ret = regmap_write(info->regmap, SEC_RTC_UDR_CON, data);
if (ret < 0) { if (ret < 0) {
dev_err(info->dev, "failed to write update reg(%d)\n", ret); dev_err(info->dev, "failed to write update reg(%d)\n", ret);
return ret; return ret;
} }
do { ret = s5m8767_wait_for_udr_update(info);
ret = regmap_read(info->rtc, SEC_RTC_UDR_CON, &data);
} while ((data & RTC_UDR_MASK) && !ret);
return ret; return ret;
} }
...@@ -116,7 +143,7 @@ static inline int s5m8767_rtc_set_alarm_reg(struct s5m_rtc_info *info) ...@@ -116,7 +143,7 @@ static inline int s5m8767_rtc_set_alarm_reg(struct s5m_rtc_info *info)
int ret; int ret;
unsigned int data; unsigned int data;
ret = regmap_read(info->rtc, SEC_RTC_UDR_CON, &data); ret = regmap_read(info->regmap, SEC_RTC_UDR_CON, &data);
if (ret < 0) { if (ret < 0) {
dev_err(info->dev, "%s: fail to read update reg(%d)\n", dev_err(info->dev, "%s: fail to read update reg(%d)\n",
__func__, ret); __func__, ret);
...@@ -126,16 +153,14 @@ static inline int s5m8767_rtc_set_alarm_reg(struct s5m_rtc_info *info) ...@@ -126,16 +153,14 @@ static inline int s5m8767_rtc_set_alarm_reg(struct s5m_rtc_info *info)
data &= ~RTC_TIME_EN_MASK; data &= ~RTC_TIME_EN_MASK;
data |= RTC_UDR_MASK; data |= RTC_UDR_MASK;
ret = regmap_write(info->rtc, SEC_RTC_UDR_CON, data); ret = regmap_write(info->regmap, SEC_RTC_UDR_CON, data);
if (ret < 0) { if (ret < 0) {
dev_err(info->dev, "%s: fail to write update reg(%d)\n", dev_err(info->dev, "%s: fail to write update reg(%d)\n",
__func__, ret); __func__, ret);
return ret; return ret;
} }
do { ret = s5m8767_wait_for_udr_update(info);
ret = regmap_read(info->rtc, SEC_RTC_UDR_CON, &data);
} while ((data & RTC_UDR_MASK) && !ret);
return ret; return ret;
} }
...@@ -178,7 +203,7 @@ static int s5m_rtc_read_time(struct device *dev, struct rtc_time *tm) ...@@ -178,7 +203,7 @@ static int s5m_rtc_read_time(struct device *dev, struct rtc_time *tm)
u8 data[8]; u8 data[8];
int ret; int ret;
ret = regmap_bulk_read(info->rtc, SEC_RTC_SEC, data, 8); ret = regmap_bulk_read(info->regmap, SEC_RTC_SEC, data, 8);
if (ret < 0) if (ret < 0)
return ret; return ret;
...@@ -226,7 +251,7 @@ static int s5m_rtc_set_time(struct device *dev, struct rtc_time *tm) ...@@ -226,7 +251,7 @@ static int s5m_rtc_set_time(struct device *dev, struct rtc_time *tm)
1900 + tm->tm_year, 1 + tm->tm_mon, tm->tm_mday, 1900 + tm->tm_year, 1 + tm->tm_mon, tm->tm_mday,
tm->tm_hour, tm->tm_min, tm->tm_sec, tm->tm_wday); tm->tm_hour, tm->tm_min, tm->tm_sec, tm->tm_wday);
ret = regmap_raw_write(info->rtc, SEC_RTC_SEC, data, 8); ret = regmap_raw_write(info->regmap, SEC_RTC_SEC, data, 8);
if (ret < 0) if (ret < 0)
return ret; return ret;
...@@ -242,20 +267,20 @@ static int s5m_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm) ...@@ -242,20 +267,20 @@ static int s5m_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm)
unsigned int val; unsigned int val;
int ret, i; int ret, i;
ret = regmap_bulk_read(info->rtc, SEC_ALARM0_SEC, data, 8); ret = regmap_bulk_read(info->regmap, SEC_ALARM0_SEC, data, 8);
if (ret < 0) if (ret < 0)
return ret; return ret;
switch (info->device_type) { switch (info->device_type) {
case S5M8763X: case S5M8763X:
s5m8763_data_to_tm(data, &alrm->time); s5m8763_data_to_tm(data, &alrm->time);
ret = regmap_read(info->rtc, SEC_ALARM0_CONF, &val); ret = regmap_read(info->regmap, SEC_ALARM0_CONF, &val);
if (ret < 0) if (ret < 0)
return ret; return ret;
alrm->enabled = !!val; alrm->enabled = !!val;
ret = regmap_read(info->rtc, SEC_RTC_STATUS, &val); ret = regmap_read(info->regmap, SEC_RTC_STATUS, &val);
if (ret < 0) if (ret < 0)
return ret; return ret;
...@@ -278,7 +303,7 @@ static int s5m_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm) ...@@ -278,7 +303,7 @@ static int s5m_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm)
} }
alrm->pending = 0; alrm->pending = 0;
ret = regmap_read(info->rtc, SEC_RTC_STATUS, &val); ret = regmap_read(info->regmap, SEC_RTC_STATUS, &val);
if (ret < 0) if (ret < 0)
return ret; return ret;
break; break;
...@@ -301,7 +326,7 @@ static int s5m_rtc_stop_alarm(struct s5m_rtc_info *info) ...@@ -301,7 +326,7 @@ static int s5m_rtc_stop_alarm(struct s5m_rtc_info *info)
int ret, i; int ret, i;
struct rtc_time tm; struct rtc_time tm;
ret = regmap_bulk_read(info->rtc, SEC_ALARM0_SEC, data, 8); ret = regmap_bulk_read(info->regmap, SEC_ALARM0_SEC, data, 8);
if (ret < 0) if (ret < 0)
return ret; return ret;
...@@ -312,14 +337,14 @@ static int s5m_rtc_stop_alarm(struct s5m_rtc_info *info) ...@@ -312,14 +337,14 @@ static int s5m_rtc_stop_alarm(struct s5m_rtc_info *info)
switch (info->device_type) { switch (info->device_type) {
case S5M8763X: case S5M8763X:
ret = regmap_write(info->rtc, SEC_ALARM0_CONF, 0); ret = regmap_write(info->regmap, SEC_ALARM0_CONF, 0);
break; break;
case S5M8767X: case S5M8767X:
for (i = 0; i < 7; i++) for (i = 0; i < 7; i++)
data[i] &= ~ALARM_ENABLE_MASK; data[i] &= ~ALARM_ENABLE_MASK;
ret = regmap_raw_write(info->rtc, SEC_ALARM0_SEC, data, 8); ret = regmap_raw_write(info->regmap, SEC_ALARM0_SEC, data, 8);
if (ret < 0) if (ret < 0)
return ret; return ret;
...@@ -341,7 +366,7 @@ static int s5m_rtc_start_alarm(struct s5m_rtc_info *info) ...@@ -341,7 +366,7 @@ static int s5m_rtc_start_alarm(struct s5m_rtc_info *info)
u8 alarm0_conf; u8 alarm0_conf;
struct rtc_time tm; struct rtc_time tm;
ret = regmap_bulk_read(info->rtc, SEC_ALARM0_SEC, data, 8); ret = regmap_bulk_read(info->regmap, SEC_ALARM0_SEC, data, 8);
if (ret < 0) if (ret < 0)
return ret; return ret;
...@@ -353,7 +378,7 @@ static int s5m_rtc_start_alarm(struct s5m_rtc_info *info) ...@@ -353,7 +378,7 @@ static int s5m_rtc_start_alarm(struct s5m_rtc_info *info)
switch (info->device_type) { switch (info->device_type) {
case S5M8763X: case S5M8763X:
alarm0_conf = 0x77; alarm0_conf = 0x77;
ret = regmap_write(info->rtc, SEC_ALARM0_CONF, alarm0_conf); ret = regmap_write(info->regmap, SEC_ALARM0_CONF, alarm0_conf);
break; break;
case S5M8767X: case S5M8767X:
...@@ -368,7 +393,7 @@ static int s5m_rtc_start_alarm(struct s5m_rtc_info *info) ...@@ -368,7 +393,7 @@ static int s5m_rtc_start_alarm(struct s5m_rtc_info *info)
if (data[RTC_YEAR1] & 0x7f) if (data[RTC_YEAR1] & 0x7f)
data[RTC_YEAR1] |= ALARM_ENABLE_MASK; data[RTC_YEAR1] |= ALARM_ENABLE_MASK;
ret = regmap_raw_write(info->rtc, SEC_ALARM0_SEC, data, 8); ret = regmap_raw_write(info->regmap, SEC_ALARM0_SEC, data, 8);
if (ret < 0) if (ret < 0)
return ret; return ret;
ret = s5m8767_rtc_set_alarm_reg(info); 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,7 +435,7 @@ static int s5m_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm)
if (ret < 0) if (ret < 0)
return ret; return ret;
ret = regmap_raw_write(info->rtc, SEC_ALARM0_SEC, data, 8); ret = regmap_raw_write(info->regmap, SEC_ALARM0_SEC, data, 8);
if (ret < 0) if (ret < 0)
return ret; return ret;
...@@ -455,7 +480,7 @@ static const struct rtc_class_ops s5m_rtc_ops = { ...@@ -455,7 +480,7 @@ static const struct rtc_class_ops s5m_rtc_ops = {
static void s5m_rtc_enable_wtsr(struct s5m_rtc_info *info, bool enable) static void s5m_rtc_enable_wtsr(struct s5m_rtc_info *info, bool enable)
{ {
int ret; int ret;
ret = regmap_update_bits(info->rtc, SEC_WTSR_SMPL_CNTL, ret = regmap_update_bits(info->regmap, SEC_WTSR_SMPL_CNTL,
WTSR_ENABLE_MASK, WTSR_ENABLE_MASK,
enable ? WTSR_ENABLE_MASK : 0); enable ? WTSR_ENABLE_MASK : 0);
if (ret < 0) if (ret < 0)
...@@ -466,7 +491,7 @@ static void s5m_rtc_enable_wtsr(struct s5m_rtc_info *info, bool enable) ...@@ -466,7 +491,7 @@ static void s5m_rtc_enable_wtsr(struct s5m_rtc_info *info, bool enable)
static void s5m_rtc_enable_smpl(struct s5m_rtc_info *info, bool enable) static void s5m_rtc_enable_smpl(struct s5m_rtc_info *info, bool enable)
{ {
int ret; int ret;
ret = regmap_update_bits(info->rtc, SEC_WTSR_SMPL_CNTL, ret = regmap_update_bits(info->regmap, SEC_WTSR_SMPL_CNTL,
SMPL_ENABLE_MASK, SMPL_ENABLE_MASK,
enable ? SMPL_ENABLE_MASK : 0); enable ? SMPL_ENABLE_MASK : 0);
if (ret < 0) if (ret < 0)
...@@ -481,7 +506,7 @@ static int s5m8767_rtc_init_reg(struct s5m_rtc_info *info) ...@@ -481,7 +506,7 @@ static int s5m8767_rtc_init_reg(struct s5m_rtc_info *info)
int ret; int ret;
struct rtc_time tm; struct rtc_time tm;
ret = regmap_read(info->rtc, SEC_RTC_UDR_CON, &tp_read); ret = regmap_read(info->regmap, SEC_RTC_UDR_CON, &tp_read);
if (ret < 0) { if (ret < 0) {
dev_err(info->dev, "%s: fail to read control reg(%d)\n", dev_err(info->dev, "%s: fail to read control reg(%d)\n",
__func__, ret); __func__, ret);
...@@ -493,7 +518,7 @@ static int s5m8767_rtc_init_reg(struct s5m_rtc_info *info) ...@@ -493,7 +518,7 @@ static int s5m8767_rtc_init_reg(struct s5m_rtc_info *info)
data[1] = (0 << BCD_EN_SHIFT) | (1 << MODEL24_SHIFT); data[1] = (0 << BCD_EN_SHIFT) | (1 << MODEL24_SHIFT);
info->rtc_24hr_mode = 1; info->rtc_24hr_mode = 1;
ret = regmap_raw_write(info->rtc, SEC_ALARM0_CONF, data, 2); ret = regmap_raw_write(info->regmap, SEC_ALARM0_CONF, data, 2);
if (ret < 0) { if (ret < 0) {
dev_err(info->dev, "%s: fail to write controlm reg(%d)\n", dev_err(info->dev, "%s: fail to write controlm reg(%d)\n",
__func__, ret); __func__, ret);
...@@ -515,7 +540,7 @@ static int s5m8767_rtc_init_reg(struct s5m_rtc_info *info) ...@@ -515,7 +540,7 @@ static int s5m8767_rtc_init_reg(struct s5m_rtc_info *info)
ret = s5m_rtc_set_time(info->dev, &tm); ret = s5m_rtc_set_time(info->dev, &tm);
} }
ret = regmap_update_bits(info->rtc, SEC_RTC_UDR_CON, ret = regmap_update_bits(info->regmap, SEC_RTC_UDR_CON,
RTC_TCON_MASK, tp_read | RTC_TCON_MASK); RTC_TCON_MASK, tp_read | RTC_TCON_MASK);
if (ret < 0) if (ret < 0)
dev_err(info->dev, "%s: fail to update TCON reg(%d)\n", 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,17 +567,19 @@ static int s5m_rtc_probe(struct platform_device *pdev)
info->dev = &pdev->dev; info->dev = &pdev->dev;
info->s5m87xx = s5m87xx; info->s5m87xx = s5m87xx;
info->rtc = s5m87xx->rtc; info->regmap = s5m87xx->regmap_rtc;
info->device_type = s5m87xx->device_type; info->device_type = s5m87xx->device_type;
info->wtsr_smpl = s5m87xx->wtsr_smpl; info->wtsr_smpl = s5m87xx->wtsr_smpl;
switch (pdata->device_type) { switch (pdata->device_type) {
case S5M8763X: case S5M8763X:
info->irq = s5m87xx->irq_base + S5M8763_IRQ_ALARM0; info->irq = regmap_irq_get_virq(s5m87xx->irq_data,
S5M8763_IRQ_ALARM0);
break; break;
case S5M8767X: case S5M8767X:
info->irq = s5m87xx->irq_base + S5M8767_IRQ_RTCA1; info->irq = regmap_irq_get_virq(s5m87xx->irq_data,
S5M8767_IRQ_RTCA1);
break; break;
default: default:
...@@ -596,7 +623,7 @@ static void s5m_rtc_shutdown(struct platform_device *pdev) ...@@ -596,7 +623,7 @@ static void s5m_rtc_shutdown(struct platform_device *pdev)
if (info->wtsr_smpl) { if (info->wtsr_smpl) {
for (i = 0; i < 3; i++) { for (i = 0; i < 3; i++) {
s5m_rtc_enable_wtsr(info, false); s5m_rtc_enable_wtsr(info, false);
regmap_read(info->rtc, SEC_WTSR_SMPL_CNTL, &val); regmap_read(info->regmap, SEC_WTSR_SMPL_CNTL, &val);
pr_debug("%s: WTSR_SMPL reg(0x%02x)\n", __func__, val); pr_debug("%s: WTSR_SMPL reg(0x%02x)\n", __func__, val);
if (val & WTSR_ENABLE_MASK) if (val & WTSR_ENABLE_MASK)
pr_emerg("%s: fail to disable WTSR\n", pr_emerg("%s: fail to disable WTSR\n",
...@@ -612,6 +639,30 @@ static void s5m_rtc_shutdown(struct platform_device *pdev) ...@@ -612,6 +639,30 @@ static void s5m_rtc_shutdown(struct platform_device *pdev)
s5m_rtc_enable_smpl(info, false); s5m_rtc_enable_smpl(info, false);
} }
static int s5m_rtc_resume(struct device *dev)
{
struct s5m_rtc_info *info = dev_get_drvdata(dev);
int ret = 0;
if (device_may_wakeup(dev))
ret = disable_irq_wake(info->irq);
return ret;
}
static int s5m_rtc_suspend(struct device *dev)
{
struct s5m_rtc_info *info = dev_get_drvdata(dev);
int ret = 0;
if (device_may_wakeup(dev))
ret = enable_irq_wake(info->irq);
return ret;
}
static SIMPLE_DEV_PM_OPS(s5m_rtc_pm_ops, s5m_rtc_suspend, s5m_rtc_resume);
static const struct platform_device_id s5m_rtc_id[] = { static const struct platform_device_id s5m_rtc_id[] = {
{ "s5m-rtc", 0 }, { "s5m-rtc", 0 },
}; };
...@@ -620,6 +671,7 @@ static struct platform_driver s5m_rtc_driver = { ...@@ -620,6 +671,7 @@ static struct platform_driver s5m_rtc_driver = {
.driver = { .driver = {
.name = "s5m-rtc", .name = "s5m-rtc",
.owner = THIS_MODULE, .owner = THIS_MODULE,
.pm = &s5m_rtc_pm_ops,
}, },
.probe = s5m_rtc_probe, .probe = s5m_rtc_probe,
.shutdown = s5m_rtc_shutdown, .shutdown = s5m_rtc_shutdown,
......
...@@ -292,16 +292,20 @@ proc_reg_get_unmapped_area(struct file *file, unsigned long orig_addr, ...@@ -292,16 +292,20 @@ proc_reg_get_unmapped_area(struct file *file, unsigned long orig_addr,
{ {
struct proc_dir_entry *pde = PDE(file_inode(file)); struct proc_dir_entry *pde = PDE(file_inode(file));
unsigned long rv = -EIO; unsigned long rv = -EIO;
unsigned long (*get_area)(struct file *, unsigned long, unsigned long,
unsigned long, unsigned long) = NULL;
if (use_pde(pde)) { if (use_pde(pde)) {
typeof(proc_reg_get_unmapped_area) *get_area;
get_area = pde->proc_fops->get_unmapped_area;
#ifdef CONFIG_MMU #ifdef CONFIG_MMU
get_area = current->mm->get_unmapped_area; if (!get_area)
get_area = current->mm->get_unmapped_area;
#endif #endif
if (pde->proc_fops->get_unmapped_area)
get_area = pde->proc_fops->get_unmapped_area;
if (get_area) if (get_area)
rv = get_area(file, orig_addr, len, pgoff, flags); rv = get_area(file, orig_addr, len, pgoff, flags);
else
rv = orig_addr;
unuse_pde(pde); unuse_pde(pde);
} }
return rv; return rv;
......
...@@ -142,7 +142,10 @@ static inline int dequeue_hwpoisoned_huge_page(struct page *page) ...@@ -142,7 +142,10 @@ static inline int dequeue_hwpoisoned_huge_page(struct page *page)
return 0; return 0;
} }
#define isolate_huge_page(p, l) false static inline bool isolate_huge_page(struct page *page, struct list_head *list)
{
return false;
}
#define putback_active_hugepage(p) do {} while (0) #define putback_active_hugepage(p) do {} while (0)
#define is_hugepage_active(x) false #define is_hugepage_active(x) false
......
...@@ -193,7 +193,8 @@ extern int _cond_resched(void); ...@@ -193,7 +193,8 @@ extern int _cond_resched(void);
(__x < 0) ? -__x : __x; \ (__x < 0) ? -__x : __x; \
}) })
#if defined(CONFIG_PROVE_LOCKING) || defined(CONFIG_DEBUG_ATOMIC_SLEEP) #if defined(CONFIG_MMU) && \
(defined(CONFIG_PROVE_LOCKING) || defined(CONFIG_DEBUG_ATOMIC_SLEEP))
void might_fault(void); void might_fault(void);
#else #else
static inline void might_fault(void) { } static inline void might_fault(void) { }
......
...@@ -39,7 +39,8 @@ enum sec_device_type { ...@@ -39,7 +39,8 @@ enum sec_device_type {
struct sec_pmic_dev { struct sec_pmic_dev {
struct device *dev; struct device *dev;
struct sec_platform_data *pdata; struct sec_platform_data *pdata;
struct regmap *regmap; struct regmap *regmap_pmic;
struct regmap *regmap_rtc;
struct i2c_client *i2c; struct i2c_client *i2c;
struct i2c_client *rtc; struct i2c_client *rtc;
......
...@@ -1481,8 +1481,18 @@ int move_huge_pmd(struct vm_area_struct *vma, struct vm_area_struct *new_vma, ...@@ -1481,8 +1481,18 @@ int move_huge_pmd(struct vm_area_struct *vma, struct vm_area_struct *new_vma,
pmd = pmdp_get_and_clear(mm, old_addr, old_pmd); pmd = pmdp_get_and_clear(mm, old_addr, old_pmd);
VM_BUG_ON(!pmd_none(*new_pmd)); VM_BUG_ON(!pmd_none(*new_pmd));
set_pmd_at(mm, new_addr, new_pmd, pmd_mksoft_dirty(pmd)); set_pmd_at(mm, new_addr, new_pmd, pmd_mksoft_dirty(pmd));
if (new_ptl != old_ptl) if (new_ptl != old_ptl) {
pgtable_t pgtable;
/*
* Move preallocated PTE page table if new_pmd is on
* different PMD page table.
*/
pgtable = pgtable_trans_huge_withdraw(mm, old_pmd);
pgtable_trans_huge_deposit(mm, new_pmd, pgtable);
spin_unlock(new_ptl); spin_unlock(new_ptl);
}
spin_unlock(old_ptl); spin_unlock(old_ptl);
} }
out: out:
......
...@@ -2694,7 +2694,10 @@ static int __mem_cgroup_try_charge(struct mm_struct *mm, ...@@ -2694,7 +2694,10 @@ static int __mem_cgroup_try_charge(struct mm_struct *mm,
goto bypass; goto bypass;
if (unlikely(task_in_memcg_oom(current))) if (unlikely(task_in_memcg_oom(current)))
goto bypass; goto nomem;
if (gfp_mask & __GFP_NOFAIL)
oom = false;
/* /*
* We always charge the cgroup the mm_struct belongs to. * 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,6 +6355,42 @@ static void mem_cgroup_css_offline(struct cgroup_subsys_state *css)
static void mem_cgroup_css_free(struct cgroup_subsys_state *css) static void mem_cgroup_css_free(struct cgroup_subsys_state *css)
{ {
struct mem_cgroup *memcg = mem_cgroup_from_css(css); struct mem_cgroup *memcg = mem_cgroup_from_css(css);
/*
* XXX: css_offline() would be where we should reparent all
* memory to prepare the cgroup for destruction. However,
* memcg does not do css_tryget() and res_counter charging
* under the same RCU lock region, which means that charging
* could race with offlining. Offlining only happens to
* cgroups with no tasks in them but charges can show up
* without any tasks from the swapin path when the target
* memcg is looked up from the swapout record and not from the
* current task as it usually is. A race like this can leak
* charges and put pages with stale cgroup pointers into
* circulation:
*
* #0 #1
* lookup_swap_cgroup_id()
* rcu_read_lock()
* mem_cgroup_lookup()
* css_tryget()
* rcu_read_unlock()
* disable css_tryget()
* call_rcu()
* offline_css()
* reparent_charges()
* res_counter_charge()
* css_put()
* css_free()
* pc->mem_cgroup = dead memcg
* add page to lru
*
* The bulk of the charges are still moved in offline_css() to
* avoid pinning a lot of pages in case a long-term reference
* like a swapout record is deferring the css_free() to long
* after offlining. But this makes sure we catch any charges
* made after offlining:
*/
mem_cgroup_reparent_charges(memcg);
memcg_destroy_kmem(memcg); memcg_destroy_kmem(memcg);
__mem_cgroup_free(memcg); __mem_cgroup_free(memcg);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment