All of lore.kernel.org
 help / color / mirror / Atom feed
* [rtc-linux] [PATCH 0/3] rtc: rtc-twl: cleanup
@ 2016-11-12 10:07 ` Nicolae Rosia
  0 siblings, 0 replies; 30+ messages in thread
From: Nicolae Rosia @ 2016-11-12 10:07 UTC (permalink / raw)
  To: Alessandro Zummo, Alexandre Belloni
  Cc: rtc-linux, linux-omap, Tony Lindgren, Nicolae Rosia

This is a cleanup and preparation of rtc-twl to reduce the usage of
twl-core exported functions.
The next patch series will further reduce the usage of exported functions
but first it requires some changes in mfd/twl-core.c

Nicolae Rosia (3):
  rtc: rtc-twl: kill static variables
  rtc: rtc-twl: make driver DT only
  rtc: rtc-twl: use irq_of_parse_and_map helper

 drivers/rtc/Kconfig   |   1 +
 drivers/rtc/rtc-twl.c | 191 +++++++++++++++++++++++++++++---------------------
 2 files changed, 114 insertions(+), 78 deletions(-)

-- 
2.5.5

-- 
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
--- 
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [PATCH 0/3] rtc: rtc-twl: cleanup
@ 2016-11-12 10:07 ` Nicolae Rosia
  0 siblings, 0 replies; 30+ messages in thread
From: Nicolae Rosia @ 2016-11-12 10:07 UTC (permalink / raw)
  To: Alessandro Zummo, Alexandre Belloni
  Cc: rtc-linux-/JYPxA39Uh5TLH3MbocFFw,
	linux-omap-u79uwXL29TY76Z2rM5mHXA, Tony Lindgren, Nicolae Rosia

This is a cleanup and preparation of rtc-twl to reduce the usage of
twl-core exported functions.
The next patch series will further reduce the usage of exported functions
but first it requires some changes in mfd/twl-core.c

Nicolae Rosia (3):
  rtc: rtc-twl: kill static variables
  rtc: rtc-twl: make driver DT only
  rtc: rtc-twl: use irq_of_parse_and_map helper

 drivers/rtc/Kconfig   |   1 +
 drivers/rtc/rtc-twl.c | 191 +++++++++++++++++++++++++++++---------------------
 2 files changed, 114 insertions(+), 78 deletions(-)

-- 
2.5.5

-- 
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
--- 
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit https://groups.google.com/d/optout.

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [rtc-linux] [PATCH 1/3] rtc: rtc-twl: kill static variables
@ 2016-11-12 10:07   ` Nicolae Rosia
  0 siblings, 0 replies; 30+ messages in thread
From: Nicolae Rosia @ 2016-11-12 10:07 UTC (permalink / raw)
  To: Alessandro Zummo, Alexandre Belloni
  Cc: rtc-linux, linux-omap, Tony Lindgren, Nicolae Rosia

The current code uses static variables which prevent
the use of multiple rtc twl instances

Signed-off-by: Nicolae Rosia <Nicolae_Rosia@mentor.com>
---
 drivers/rtc/rtc-twl.c | 177 +++++++++++++++++++++++++++++---------------------
 1 file changed, 104 insertions(+), 73 deletions(-)

diff --git a/drivers/rtc/rtc-twl.c b/drivers/rtc/rtc-twl.c
index 176720b..0a1700a0 100644
--- a/drivers/rtc/rtc-twl.c
+++ b/drivers/rtc/rtc-twl.c
@@ -136,16 +136,30 @@ static const u8 twl6030_rtc_reg_map[] = {
 #define ALL_TIME_REGS		6
 
 /*----------------------------------------------------------------------*/
-static u8  *rtc_reg_map;
+struct twl_rtc {
+	struct device *dev;
+	struct rtc_device *rtc;
+	u8 *reg_map;
+	/*
+	 * Cache the value for timer/alarm interrupts register; this is
+	 * only changed by callers holding rtc ops lock (or resume).
+	 */
+	unsigned char rtc_irq_bits;
+	bool wake_enabled;
+#ifdef CONFIG_PM_SLEEP
+	unsigned char irqstat;
+#endif
+	bool is_4030;
+};
 
 /*
  * Supports 1 byte read from TWL RTC register.
  */
-static int twl_rtc_read_u8(u8 *data, u8 reg)
+static int twl_rtc_read_u8(struct twl_rtc *twl_rtc, u8 *data, u8 reg)
 {
 	int ret;
 
-	ret = twl_i2c_read_u8(TWL_MODULE_RTC, data, (rtc_reg_map[reg]));
+	ret = twl_i2c_read_u8(TWL_MODULE_RTC, data, (twl_rtc->reg_map[reg]));
 	if (ret < 0)
 		pr_err("Could not read TWL register %X - error %d\n", reg, ret);
 	return ret;
@@ -154,11 +168,11 @@ static int twl_rtc_read_u8(u8 *data, u8 reg)
 /*
  * Supports 1 byte write to TWL RTC registers.
  */
-static int twl_rtc_write_u8(u8 data, u8 reg)
+static int twl_rtc_write_u8(struct twl_rtc *twl_rtc, u8 data, u8 reg)
 {
 	int ret;
 
-	ret = twl_i2c_write_u8(TWL_MODULE_RTC, data, (rtc_reg_map[reg]));
+	ret = twl_i2c_write_u8(TWL_MODULE_RTC, data, (twl_rtc->reg_map[reg]));
 	if (ret < 0)
 		pr_err("Could not write TWL register %X - error %d\n",
 		       reg, ret);
@@ -166,28 +180,22 @@ static int twl_rtc_write_u8(u8 data, u8 reg)
 }
 
 /*
- * Cache the value for timer/alarm interrupts register; this is
- * only changed by callers holding rtc ops lock (or resume).
- */
-static unsigned char rtc_irq_bits;
-
-/*
  * Enable 1/second update and/or alarm interrupts.
  */
-static int set_rtc_irq_bit(unsigned char bit)
+static int set_rtc_irq_bit(struct twl_rtc *twl_rtc, unsigned char bit)
 {
 	unsigned char val;
 	int ret;
 
 	/* if the bit is set, return from here */
-	if (rtc_irq_bits & bit)
+	if (twl_rtc->rtc_irq_bits & bit)
 		return 0;
 
-	val = rtc_irq_bits | bit;
+	val = twl_rtc->rtc_irq_bits | bit;
 	val &= ~BIT_RTC_INTERRUPTS_REG_EVERY_M;
-	ret = twl_rtc_write_u8(val, REG_RTC_INTERRUPTS_REG);
+	ret = twl_rtc_write_u8(twl_rtc, val, REG_RTC_INTERRUPTS_REG);
 	if (ret == 0)
-		rtc_irq_bits = val;
+		twl_rtc->rtc_irq_bits = val;
 
 	return ret;
 }
@@ -195,19 +203,19 @@ static int set_rtc_irq_bit(unsigned char bit)
 /*
  * Disable update and/or alarm interrupts.
  */
-static int mask_rtc_irq_bit(unsigned char bit)
+static int mask_rtc_irq_bit(struct twl_rtc *twl_rtc, unsigned char bit)
 {
 	unsigned char val;
 	int ret;
 
 	/* if the bit is clear, return from here */
-	if (!(rtc_irq_bits & bit))
+	if (!(twl_rtc->rtc_irq_bits & bit))
 		return 0;
 
-	val = rtc_irq_bits & ~bit;
-	ret = twl_rtc_write_u8(val, REG_RTC_INTERRUPTS_REG);
+	val = twl_rtc->rtc_irq_bits & ~bit;
+	ret = twl_rtc_write_u8(twl_rtc, val, REG_RTC_INTERRUPTS_REG);
 	if (ret == 0)
-		rtc_irq_bits = val;
+		twl_rtc->rtc_irq_bits = val;
 
 	return ret;
 }
@@ -215,21 +223,23 @@ static int mask_rtc_irq_bit(unsigned char bit)
 static int twl_rtc_alarm_irq_enable(struct device *dev, unsigned enabled)
 {
 	struct platform_device *pdev = to_platform_device(dev);
+	struct twl_rtc *twl_rtc = dev_get_drvdata(dev);
 	int irq = platform_get_irq(pdev, 0);
-	static bool twl_rtc_wake_enabled;
 	int ret;
 
 	if (enabled) {
-		ret = set_rtc_irq_bit(BIT_RTC_INTERRUPTS_REG_IT_ALARM_M);
-		if (device_can_wakeup(dev) && !twl_rtc_wake_enabled) {
+		ret = set_rtc_irq_bit(twl_rtc,
+					BIT_RTC_INTERRUPTS_REG_IT_ALARM_M);
+		if (device_can_wakeup(dev) && !twl_rtc->wake_enabled) {
 			enable_irq_wake(irq);
-			twl_rtc_wake_enabled = true;
+			twl_rtc->wake_enabled = true;
 		}
 	} else {
-		ret = mask_rtc_irq_bit(BIT_RTC_INTERRUPTS_REG_IT_ALARM_M);
-		if (twl_rtc_wake_enabled) {
+		ret = mask_rtc_irq_bit(twl_rtc,
+					BIT_RTC_INTERRUPTS_REG_IT_ALARM_M);
+		if (twl_rtc->wake_enabled) {
 			disable_irq_wake(irq);
-			twl_rtc_wake_enabled = false;
+			twl_rtc->wake_enabled = false;
 		}
 	}
 
@@ -247,21 +257,23 @@ static int twl_rtc_alarm_irq_enable(struct device *dev, unsigned enabled)
  */
 static int twl_rtc_read_time(struct device *dev, struct rtc_time *tm)
 {
+	struct twl_rtc *twl_rtc = dev_get_drvdata(dev);
 	unsigned char rtc_data[ALL_TIME_REGS];
 	int ret;
 	u8 save_control;
 	u8 rtc_control;
 
-	ret = twl_rtc_read_u8(&save_control, REG_RTC_CTRL_REG);
+	ret = twl_rtc_read_u8(twl_rtc, &save_control, REG_RTC_CTRL_REG);
 	if (ret < 0) {
 		dev_err(dev, "%s: reading CTRL_REG, error %d\n", __func__, ret);
 		return ret;
 	}
 	/* for twl6030/32 make sure BIT_RTC_CTRL_REG_GET_TIME_M is clear */
-	if (twl_class_is_6030()) {
+	if (!twl_rtc->is_4030) {
 		if (save_control & BIT_RTC_CTRL_REG_GET_TIME_M) {
 			save_control &= ~BIT_RTC_CTRL_REG_GET_TIME_M;
-			ret = twl_rtc_write_u8(save_control, REG_RTC_CTRL_REG);
+			ret = twl_rtc_write_u8(twl_rtc, save_control,
+						REG_RTC_CTRL_REG);
 			if (ret < 0) {
 				dev_err(dev, "%s clr GET_TIME, error %d\n",
 					__func__, ret);
@@ -274,17 +286,17 @@ static int twl_rtc_read_time(struct device *dev, struct rtc_time *tm)
 	rtc_control = save_control | BIT_RTC_CTRL_REG_GET_TIME_M;
 
 	/* for twl6030/32 enable read access to static shadowed registers */
-	if (twl_class_is_6030())
+	if (!twl_rtc->is_4030)
 		rtc_control |= BIT_RTC_CTRL_REG_RTC_V_OPT;
 
-	ret = twl_rtc_write_u8(rtc_control, REG_RTC_CTRL_REG);
+	ret = twl_rtc_write_u8(twl_rtc, rtc_control, REG_RTC_CTRL_REG);
 	if (ret < 0) {
 		dev_err(dev, "%s: writing CTRL_REG, error %d\n", __func__, ret);
 		return ret;
 	}
 
 	ret = twl_i2c_read(TWL_MODULE_RTC, rtc_data,
-			(rtc_reg_map[REG_SECONDS_REG]), ALL_TIME_REGS);
+			(twl_rtc->reg_map[REG_SECONDS_REG]), ALL_TIME_REGS);
 
 	if (ret < 0) {
 		dev_err(dev, "%s: reading data, error %d\n", __func__, ret);
@@ -292,8 +304,8 @@ static int twl_rtc_read_time(struct device *dev, struct rtc_time *tm)
 	}
 
 	/* for twl6030 restore original state of rtc control register */
-	if (twl_class_is_6030()) {
-		ret = twl_rtc_write_u8(save_control, REG_RTC_CTRL_REG);
+	if (!twl_rtc->is_4030) {
+		ret = twl_rtc_write_u8(twl_rtc, save_control, REG_RTC_CTRL_REG);
 		if (ret < 0) {
 			dev_err(dev, "%s: restore CTRL_REG, error %d\n",
 				__func__, ret);
@@ -313,6 +325,7 @@ static int twl_rtc_read_time(struct device *dev, struct rtc_time *tm)
 
 static int twl_rtc_set_time(struct device *dev, struct rtc_time *tm)
 {
+	struct twl_rtc *twl_rtc = dev_get_drvdata(dev);
 	unsigned char save_control;
 	unsigned char rtc_data[ALL_TIME_REGS];
 	int ret;
@@ -325,18 +338,18 @@ static int twl_rtc_set_time(struct device *dev, struct rtc_time *tm)
 	rtc_data[5] = bin2bcd(tm->tm_year - 100);
 
 	/* Stop RTC while updating the TC registers */
-	ret = twl_rtc_read_u8(&save_control, REG_RTC_CTRL_REG);
+	ret = twl_rtc_read_u8(twl_rtc, &save_control, REG_RTC_CTRL_REG);
 	if (ret < 0)
 		goto out;
 
 	save_control &= ~BIT_RTC_CTRL_REG_STOP_RTC_M;
-	ret = twl_rtc_write_u8(save_control, REG_RTC_CTRL_REG);
+	ret = twl_rtc_write_u8(twl_rtc, save_control, REG_RTC_CTRL_REG);
 	if (ret < 0)
 		goto out;
 
 	/* update all the time registers in one shot */
 	ret = twl_i2c_write(TWL_MODULE_RTC, rtc_data,
-		(rtc_reg_map[REG_SECONDS_REG]), ALL_TIME_REGS);
+		(twl_rtc->reg_map[REG_SECONDS_REG]), ALL_TIME_REGS);
 	if (ret < 0) {
 		dev_err(dev, "rtc_set_time error %d\n", ret);
 		goto out;
@@ -344,7 +357,7 @@ static int twl_rtc_set_time(struct device *dev, struct rtc_time *tm)
 
 	/* Start back RTC */
 	save_control |= BIT_RTC_CTRL_REG_STOP_RTC_M;
-	ret = twl_rtc_write_u8(save_control, REG_RTC_CTRL_REG);
+	ret = twl_rtc_write_u8(twl_rtc, save_control, REG_RTC_CTRL_REG);
 
 out:
 	return ret;
@@ -355,11 +368,12 @@ static int twl_rtc_set_time(struct device *dev, struct rtc_time *tm)
  */
 static int twl_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alm)
 {
+	struct twl_rtc *twl_rtc = dev_get_drvdata(dev);
 	unsigned char rtc_data[ALL_TIME_REGS];
 	int ret;
 
 	ret = twl_i2c_read(TWL_MODULE_RTC, rtc_data,
-			(rtc_reg_map[REG_ALARM_SECONDS_REG]), ALL_TIME_REGS);
+			twl_rtc->reg_map[REG_ALARM_SECONDS_REG], ALL_TIME_REGS);
 	if (ret < 0) {
 		dev_err(dev, "rtc_read_alarm error %d\n", ret);
 		return ret;
@@ -374,7 +388,7 @@ static int twl_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alm)
 	alm->time.tm_year = bcd2bin(rtc_data[5]) + 100;
 
 	/* report cached alarm enable state */
-	if (rtc_irq_bits & BIT_RTC_INTERRUPTS_REG_IT_ALARM_M)
+	if (twl_rtc->rtc_irq_bits & BIT_RTC_INTERRUPTS_REG_IT_ALARM_M)
 		alm->enabled = 1;
 
 	return ret;
@@ -382,6 +396,8 @@ static int twl_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alm)
 
 static int twl_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alm)
 {
+	struct twl_rtc *twl_rtc = dev_get_drvdata(dev);
+
 	unsigned char alarm_data[ALL_TIME_REGS];
 	int ret;
 
@@ -398,7 +414,7 @@ static int twl_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alm)
 
 	/* update all the alarm registers in one shot */
 	ret = twl_i2c_write(TWL_MODULE_RTC, alarm_data,
-		(rtc_reg_map[REG_ALARM_SECONDS_REG]), ALL_TIME_REGS);
+			twl_rtc->reg_map[REG_ALARM_SECONDS_REG], ALL_TIME_REGS);
 	if (ret) {
 		dev_err(dev, "rtc_set_alarm error %d\n", ret);
 		goto out;
@@ -410,14 +426,15 @@ static int twl_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alm)
 	return ret;
 }
 
-static irqreturn_t twl_rtc_interrupt(int irq, void *rtc)
+static irqreturn_t twl_rtc_interrupt(int irq, void *data)
 {
+	struct twl_rtc *twl_rtc = data;
 	unsigned long events;
 	int ret = IRQ_NONE;
 	int res;
 	u8 rd_reg;
 
-	res = twl_rtc_read_u8(&rd_reg, REG_RTC_STATUS_REG);
+	res = twl_rtc_read_u8(twl_rtc, &rd_reg, REG_RTC_STATUS_REG);
 	if (res)
 		goto out;
 	/*
@@ -431,12 +448,12 @@ static irqreturn_t twl_rtc_interrupt(int irq, void *rtc)
 	else
 		events = RTC_IRQF | RTC_PF;
 
-	res = twl_rtc_write_u8(BIT_RTC_STATUS_REG_ALARM_M,
+	res = twl_rtc_write_u8(twl_rtc, BIT_RTC_STATUS_REG_ALARM_M,
 				   REG_RTC_STATUS_REG);
 	if (res)
 		goto out;
 
-	if (twl_class_is_4030()) {
+	if (twl_rtc->is_4030) {
 		/* Clear on Read enabled. RTC_IT bit of TWL4030_INT_PWR_ISR1
 		 * needs 2 reads to clear the interrupt. One read is done in
 		 * do_twl_pwrirq(). Doing the second read, to clear
@@ -455,7 +472,7 @@ static irqreturn_t twl_rtc_interrupt(int irq, void *rtc)
 	}
 
 	/* Notify RTC core on event */
-	rtc_update_irq(rtc, 1, events);
+	rtc_update_irq(twl_rtc->rtc, 1, events);
 
 	ret = IRQ_HANDLED;
 out:
@@ -474,7 +491,7 @@ static const struct rtc_class_ops twl_rtc_ops = {
 
 static int twl_rtc_probe(struct platform_device *pdev)
 {
-	struct rtc_device *rtc;
+	struct twl_rtc *twl_rtc;
 	int ret = -EINVAL;
 	int irq = platform_get_irq(pdev, 0);
 	u8 rd_reg;
@@ -482,13 +499,19 @@ static int twl_rtc_probe(struct platform_device *pdev)
 	if (irq <= 0)
 		return ret;
 
+	twl_rtc = devm_kzalloc(&pdev->dev, sizeof(*twl_rtc), GFP_KERNEL);
+	if (!twl_rtc)
+		return -ENOMEM;
+
+	twl_rtc->is_4030 = twl_class_is_4030();
+
 	/* Initialize the register map */
-	if (twl_class_is_4030())
-		rtc_reg_map = (u8 *)twl4030_rtc_reg_map;
+	if (twl_rtc->is_4030)
+		twl_rtc->reg_map = (u8 *)twl4030_rtc_reg_map;
 	else
-		rtc_reg_map = (u8 *)twl6030_rtc_reg_map;
+		twl_rtc->reg_map = (u8 *)twl6030_rtc_reg_map;
 
-	ret = twl_rtc_read_u8(&rd_reg, REG_RTC_STATUS_REG);
+	ret = twl_rtc_read_u8(twl_rtc, &rd_reg, REG_RTC_STATUS_REG);
 	if (ret < 0)
 		return ret;
 
@@ -499,11 +522,11 @@ static int twl_rtc_probe(struct platform_device *pdev)
 		dev_warn(&pdev->dev, "Pending Alarm interrupt detected.\n");
 
 	/* Clear RTC Power up reset and pending alarm interrupts */
-	ret = twl_rtc_write_u8(rd_reg, REG_RTC_STATUS_REG);
+	ret = twl_rtc_write_u8(twl_rtc, rd_reg, REG_RTC_STATUS_REG);
 	if (ret < 0)
 		return ret;
 
-	if (twl_class_is_6030()) {
+	if (!twl_rtc->is_4030) {
 		twl6030_interrupt_unmask(TWL6030_RTC_INT_MASK,
 			REG_INT_MSK_LINE_A);
 		twl6030_interrupt_unmask(TWL6030_RTC_INT_MASK,
@@ -511,40 +534,42 @@ static int twl_rtc_probe(struct platform_device *pdev)
 	}
 
 	dev_info(&pdev->dev, "Enabling TWL-RTC\n");
-	ret = twl_rtc_write_u8(BIT_RTC_CTRL_REG_STOP_RTC_M, REG_RTC_CTRL_REG);
+	ret = twl_rtc_write_u8(twl_rtc, BIT_RTC_CTRL_REG_STOP_RTC_M,
+				REG_RTC_CTRL_REG);
 	if (ret < 0)
 		return ret;
 
 	/* ensure interrupts are disabled, bootloaders can be strange */
-	ret = twl_rtc_write_u8(0, REG_RTC_INTERRUPTS_REG);
+	ret = twl_rtc_write_u8(twl_rtc, 0, REG_RTC_INTERRUPTS_REG);
 	if (ret < 0)
 		dev_warn(&pdev->dev, "unable to disable interrupt\n");
 
 	/* init cached IRQ enable bits */
-	ret = twl_rtc_read_u8(&rtc_irq_bits, REG_RTC_INTERRUPTS_REG);
+	ret = twl_rtc_read_u8(twl_rtc, &twl_rtc->rtc_irq_bits,
+				REG_RTC_INTERRUPTS_REG);
 	if (ret < 0)
 		return ret;
 
+	platform_set_drvdata(pdev, twl_rtc);
 	device_init_wakeup(&pdev->dev, 1);
 
-	rtc = devm_rtc_device_register(&pdev->dev, pdev->name,
+	twl_rtc->rtc = devm_rtc_device_register(&pdev->dev, pdev->name,
 					&twl_rtc_ops, THIS_MODULE);
-	if (IS_ERR(rtc)) {
+	if (IS_ERR(twl_rtc->rtc)) {
 		dev_err(&pdev->dev, "can't register RTC device, err %ld\n",
-			PTR_ERR(rtc));
-		return PTR_ERR(rtc);
+			PTR_ERR(twl_rtc->rtc));
+		return PTR_ERR(twl_rtc->rtc);
 	}
 
 	ret = devm_request_threaded_irq(&pdev->dev, irq, NULL,
 					twl_rtc_interrupt,
 					IRQF_TRIGGER_RISING | IRQF_ONESHOT,
-					dev_name(&rtc->dev), rtc);
+					dev_name(&twl_rtc->rtc->dev), twl_rtc);
 	if (ret < 0) {
 		dev_err(&pdev->dev, "IRQ is not free.\n");
 		return ret;
 	}
 
-	platform_set_drvdata(pdev, rtc);
 	return 0;
 }
 
@@ -554,10 +579,12 @@ static int twl_rtc_probe(struct platform_device *pdev)
  */
 static int twl_rtc_remove(struct platform_device *pdev)
 {
+	struct twl_rtc *twl_rtc = platform_get_drvdata(pdev);
+
 	/* leave rtc running, but disable irqs */
-	mask_rtc_irq_bit(BIT_RTC_INTERRUPTS_REG_IT_ALARM_M);
-	mask_rtc_irq_bit(BIT_RTC_INTERRUPTS_REG_IT_TIMER_M);
-	if (twl_class_is_6030()) {
+	mask_rtc_irq_bit(twl_rtc, BIT_RTC_INTERRUPTS_REG_IT_ALARM_M);
+	mask_rtc_irq_bit(twl_rtc, BIT_RTC_INTERRUPTS_REG_IT_TIMER_M);
+	if (!twl_rtc->is_4030) {
 		twl6030_interrupt_mask(TWL6030_RTC_INT_MASK,
 			REG_INT_MSK_LINE_A);
 		twl6030_interrupt_mask(TWL6030_RTC_INT_MASK,
@@ -569,25 +596,29 @@ static int twl_rtc_remove(struct platform_device *pdev)
 
 static void twl_rtc_shutdown(struct platform_device *pdev)
 {
+	struct twl_rtc *twl_rtc = platform_get_drvdata(pdev);
+
 	/* mask timer interrupts, but leave alarm interrupts on to enable
 	   power-on when alarm is triggered */
-	mask_rtc_irq_bit(BIT_RTC_INTERRUPTS_REG_IT_TIMER_M);
+	mask_rtc_irq_bit(twl_rtc, BIT_RTC_INTERRUPTS_REG_IT_TIMER_M);
 }
 
 #ifdef CONFIG_PM_SLEEP
-static unsigned char irqstat;
-
 static int twl_rtc_suspend(struct device *dev)
 {
-	irqstat = rtc_irq_bits;
+	struct twl_rtc *twl_rtc = dev_get_drvdata(dev);
 
-	mask_rtc_irq_bit(BIT_RTC_INTERRUPTS_REG_IT_TIMER_M);
+	twl_rtc->irqstat = twl_rtc->rtc_irq_bits;
+
+	mask_rtc_irq_bit(twl_rtc, BIT_RTC_INTERRUPTS_REG_IT_TIMER_M);
 	return 0;
 }
 
 static int twl_rtc_resume(struct device *dev)
 {
-	set_rtc_irq_bit(irqstat);
+	struct twl_rtc *twl_rtc = dev_get_drvdata(dev);
+
+	set_rtc_irq_bit(twl_rtc, twl_rtc->irqstat);
 	return 0;
 }
 #endif
-- 
2.5.5

-- 
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
--- 
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 1/3] rtc: rtc-twl: kill static variables
@ 2016-11-12 10:07   ` Nicolae Rosia
  0 siblings, 0 replies; 30+ messages in thread
From: Nicolae Rosia @ 2016-11-12 10:07 UTC (permalink / raw)
  To: Alessandro Zummo, Alexandre Belloni
  Cc: rtc-linux-/JYPxA39Uh5TLH3MbocFFw,
	linux-omap-u79uwXL29TY76Z2rM5mHXA, Tony Lindgren, Nicolae Rosia

The current code uses static variables which prevent
the use of multiple rtc twl instances

Signed-off-by: Nicolae Rosia <Nicolae_Rosia-nmGgyN9QBj3QT0dZR+AlfA@public.gmane.org>
---
 drivers/rtc/rtc-twl.c | 177 +++++++++++++++++++++++++++++---------------------
 1 file changed, 104 insertions(+), 73 deletions(-)

diff --git a/drivers/rtc/rtc-twl.c b/drivers/rtc/rtc-twl.c
index 176720b..0a1700a0 100644
--- a/drivers/rtc/rtc-twl.c
+++ b/drivers/rtc/rtc-twl.c
@@ -136,16 +136,30 @@ static const u8 twl6030_rtc_reg_map[] = {
 #define ALL_TIME_REGS		6
 
 /*----------------------------------------------------------------------*/
-static u8  *rtc_reg_map;
+struct twl_rtc {
+	struct device *dev;
+	struct rtc_device *rtc;
+	u8 *reg_map;
+	/*
+	 * Cache the value for timer/alarm interrupts register; this is
+	 * only changed by callers holding rtc ops lock (or resume).
+	 */
+	unsigned char rtc_irq_bits;
+	bool wake_enabled;
+#ifdef CONFIG_PM_SLEEP
+	unsigned char irqstat;
+#endif
+	bool is_4030;
+};
 
 /*
  * Supports 1 byte read from TWL RTC register.
  */
-static int twl_rtc_read_u8(u8 *data, u8 reg)
+static int twl_rtc_read_u8(struct twl_rtc *twl_rtc, u8 *data, u8 reg)
 {
 	int ret;
 
-	ret = twl_i2c_read_u8(TWL_MODULE_RTC, data, (rtc_reg_map[reg]));
+	ret = twl_i2c_read_u8(TWL_MODULE_RTC, data, (twl_rtc->reg_map[reg]));
 	if (ret < 0)
 		pr_err("Could not read TWL register %X - error %d\n", reg, ret);
 	return ret;
@@ -154,11 +168,11 @@ static int twl_rtc_read_u8(u8 *data, u8 reg)
 /*
  * Supports 1 byte write to TWL RTC registers.
  */
-static int twl_rtc_write_u8(u8 data, u8 reg)
+static int twl_rtc_write_u8(struct twl_rtc *twl_rtc, u8 data, u8 reg)
 {
 	int ret;
 
-	ret = twl_i2c_write_u8(TWL_MODULE_RTC, data, (rtc_reg_map[reg]));
+	ret = twl_i2c_write_u8(TWL_MODULE_RTC, data, (twl_rtc->reg_map[reg]));
 	if (ret < 0)
 		pr_err("Could not write TWL register %X - error %d\n",
 		       reg, ret);
@@ -166,28 +180,22 @@ static int twl_rtc_write_u8(u8 data, u8 reg)
 }
 
 /*
- * Cache the value for timer/alarm interrupts register; this is
- * only changed by callers holding rtc ops lock (or resume).
- */
-static unsigned char rtc_irq_bits;
-
-/*
  * Enable 1/second update and/or alarm interrupts.
  */
-static int set_rtc_irq_bit(unsigned char bit)
+static int set_rtc_irq_bit(struct twl_rtc *twl_rtc, unsigned char bit)
 {
 	unsigned char val;
 	int ret;
 
 	/* if the bit is set, return from here */
-	if (rtc_irq_bits & bit)
+	if (twl_rtc->rtc_irq_bits & bit)
 		return 0;
 
-	val = rtc_irq_bits | bit;
+	val = twl_rtc->rtc_irq_bits | bit;
 	val &= ~BIT_RTC_INTERRUPTS_REG_EVERY_M;
-	ret = twl_rtc_write_u8(val, REG_RTC_INTERRUPTS_REG);
+	ret = twl_rtc_write_u8(twl_rtc, val, REG_RTC_INTERRUPTS_REG);
 	if (ret == 0)
-		rtc_irq_bits = val;
+		twl_rtc->rtc_irq_bits = val;
 
 	return ret;
 }
@@ -195,19 +203,19 @@ static int set_rtc_irq_bit(unsigned char bit)
 /*
  * Disable update and/or alarm interrupts.
  */
-static int mask_rtc_irq_bit(unsigned char bit)
+static int mask_rtc_irq_bit(struct twl_rtc *twl_rtc, unsigned char bit)
 {
 	unsigned char val;
 	int ret;
 
 	/* if the bit is clear, return from here */
-	if (!(rtc_irq_bits & bit))
+	if (!(twl_rtc->rtc_irq_bits & bit))
 		return 0;
 
-	val = rtc_irq_bits & ~bit;
-	ret = twl_rtc_write_u8(val, REG_RTC_INTERRUPTS_REG);
+	val = twl_rtc->rtc_irq_bits & ~bit;
+	ret = twl_rtc_write_u8(twl_rtc, val, REG_RTC_INTERRUPTS_REG);
 	if (ret == 0)
-		rtc_irq_bits = val;
+		twl_rtc->rtc_irq_bits = val;
 
 	return ret;
 }
@@ -215,21 +223,23 @@ static int mask_rtc_irq_bit(unsigned char bit)
 static int twl_rtc_alarm_irq_enable(struct device *dev, unsigned enabled)
 {
 	struct platform_device *pdev = to_platform_device(dev);
+	struct twl_rtc *twl_rtc = dev_get_drvdata(dev);
 	int irq = platform_get_irq(pdev, 0);
-	static bool twl_rtc_wake_enabled;
 	int ret;
 
 	if (enabled) {
-		ret = set_rtc_irq_bit(BIT_RTC_INTERRUPTS_REG_IT_ALARM_M);
-		if (device_can_wakeup(dev) && !twl_rtc_wake_enabled) {
+		ret = set_rtc_irq_bit(twl_rtc,
+					BIT_RTC_INTERRUPTS_REG_IT_ALARM_M);
+		if (device_can_wakeup(dev) && !twl_rtc->wake_enabled) {
 			enable_irq_wake(irq);
-			twl_rtc_wake_enabled = true;
+			twl_rtc->wake_enabled = true;
 		}
 	} else {
-		ret = mask_rtc_irq_bit(BIT_RTC_INTERRUPTS_REG_IT_ALARM_M);
-		if (twl_rtc_wake_enabled) {
+		ret = mask_rtc_irq_bit(twl_rtc,
+					BIT_RTC_INTERRUPTS_REG_IT_ALARM_M);
+		if (twl_rtc->wake_enabled) {
 			disable_irq_wake(irq);
-			twl_rtc_wake_enabled = false;
+			twl_rtc->wake_enabled = false;
 		}
 	}
 
@@ -247,21 +257,23 @@ static int twl_rtc_alarm_irq_enable(struct device *dev, unsigned enabled)
  */
 static int twl_rtc_read_time(struct device *dev, struct rtc_time *tm)
 {
+	struct twl_rtc *twl_rtc = dev_get_drvdata(dev);
 	unsigned char rtc_data[ALL_TIME_REGS];
 	int ret;
 	u8 save_control;
 	u8 rtc_control;
 
-	ret = twl_rtc_read_u8(&save_control, REG_RTC_CTRL_REG);
+	ret = twl_rtc_read_u8(twl_rtc, &save_control, REG_RTC_CTRL_REG);
 	if (ret < 0) {
 		dev_err(dev, "%s: reading CTRL_REG, error %d\n", __func__, ret);
 		return ret;
 	}
 	/* for twl6030/32 make sure BIT_RTC_CTRL_REG_GET_TIME_M is clear */
-	if (twl_class_is_6030()) {
+	if (!twl_rtc->is_4030) {
 		if (save_control & BIT_RTC_CTRL_REG_GET_TIME_M) {
 			save_control &= ~BIT_RTC_CTRL_REG_GET_TIME_M;
-			ret = twl_rtc_write_u8(save_control, REG_RTC_CTRL_REG);
+			ret = twl_rtc_write_u8(twl_rtc, save_control,
+						REG_RTC_CTRL_REG);
 			if (ret < 0) {
 				dev_err(dev, "%s clr GET_TIME, error %d\n",
 					__func__, ret);
@@ -274,17 +286,17 @@ static int twl_rtc_read_time(struct device *dev, struct rtc_time *tm)
 	rtc_control = save_control | BIT_RTC_CTRL_REG_GET_TIME_M;
 
 	/* for twl6030/32 enable read access to static shadowed registers */
-	if (twl_class_is_6030())
+	if (!twl_rtc->is_4030)
 		rtc_control |= BIT_RTC_CTRL_REG_RTC_V_OPT;
 
-	ret = twl_rtc_write_u8(rtc_control, REG_RTC_CTRL_REG);
+	ret = twl_rtc_write_u8(twl_rtc, rtc_control, REG_RTC_CTRL_REG);
 	if (ret < 0) {
 		dev_err(dev, "%s: writing CTRL_REG, error %d\n", __func__, ret);
 		return ret;
 	}
 
 	ret = twl_i2c_read(TWL_MODULE_RTC, rtc_data,
-			(rtc_reg_map[REG_SECONDS_REG]), ALL_TIME_REGS);
+			(twl_rtc->reg_map[REG_SECONDS_REG]), ALL_TIME_REGS);
 
 	if (ret < 0) {
 		dev_err(dev, "%s: reading data, error %d\n", __func__, ret);
@@ -292,8 +304,8 @@ static int twl_rtc_read_time(struct device *dev, struct rtc_time *tm)
 	}
 
 	/* for twl6030 restore original state of rtc control register */
-	if (twl_class_is_6030()) {
-		ret = twl_rtc_write_u8(save_control, REG_RTC_CTRL_REG);
+	if (!twl_rtc->is_4030) {
+		ret = twl_rtc_write_u8(twl_rtc, save_control, REG_RTC_CTRL_REG);
 		if (ret < 0) {
 			dev_err(dev, "%s: restore CTRL_REG, error %d\n",
 				__func__, ret);
@@ -313,6 +325,7 @@ static int twl_rtc_read_time(struct device *dev, struct rtc_time *tm)
 
 static int twl_rtc_set_time(struct device *dev, struct rtc_time *tm)
 {
+	struct twl_rtc *twl_rtc = dev_get_drvdata(dev);
 	unsigned char save_control;
 	unsigned char rtc_data[ALL_TIME_REGS];
 	int ret;
@@ -325,18 +338,18 @@ static int twl_rtc_set_time(struct device *dev, struct rtc_time *tm)
 	rtc_data[5] = bin2bcd(tm->tm_year - 100);
 
 	/* Stop RTC while updating the TC registers */
-	ret = twl_rtc_read_u8(&save_control, REG_RTC_CTRL_REG);
+	ret = twl_rtc_read_u8(twl_rtc, &save_control, REG_RTC_CTRL_REG);
 	if (ret < 0)
 		goto out;
 
 	save_control &= ~BIT_RTC_CTRL_REG_STOP_RTC_M;
-	ret = twl_rtc_write_u8(save_control, REG_RTC_CTRL_REG);
+	ret = twl_rtc_write_u8(twl_rtc, save_control, REG_RTC_CTRL_REG);
 	if (ret < 0)
 		goto out;
 
 	/* update all the time registers in one shot */
 	ret = twl_i2c_write(TWL_MODULE_RTC, rtc_data,
-		(rtc_reg_map[REG_SECONDS_REG]), ALL_TIME_REGS);
+		(twl_rtc->reg_map[REG_SECONDS_REG]), ALL_TIME_REGS);
 	if (ret < 0) {
 		dev_err(dev, "rtc_set_time error %d\n", ret);
 		goto out;
@@ -344,7 +357,7 @@ static int twl_rtc_set_time(struct device *dev, struct rtc_time *tm)
 
 	/* Start back RTC */
 	save_control |= BIT_RTC_CTRL_REG_STOP_RTC_M;
-	ret = twl_rtc_write_u8(save_control, REG_RTC_CTRL_REG);
+	ret = twl_rtc_write_u8(twl_rtc, save_control, REG_RTC_CTRL_REG);
 
 out:
 	return ret;
@@ -355,11 +368,12 @@ static int twl_rtc_set_time(struct device *dev, struct rtc_time *tm)
  */
 static int twl_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alm)
 {
+	struct twl_rtc *twl_rtc = dev_get_drvdata(dev);
 	unsigned char rtc_data[ALL_TIME_REGS];
 	int ret;
 
 	ret = twl_i2c_read(TWL_MODULE_RTC, rtc_data,
-			(rtc_reg_map[REG_ALARM_SECONDS_REG]), ALL_TIME_REGS);
+			twl_rtc->reg_map[REG_ALARM_SECONDS_REG], ALL_TIME_REGS);
 	if (ret < 0) {
 		dev_err(dev, "rtc_read_alarm error %d\n", ret);
 		return ret;
@@ -374,7 +388,7 @@ static int twl_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alm)
 	alm->time.tm_year = bcd2bin(rtc_data[5]) + 100;
 
 	/* report cached alarm enable state */
-	if (rtc_irq_bits & BIT_RTC_INTERRUPTS_REG_IT_ALARM_M)
+	if (twl_rtc->rtc_irq_bits & BIT_RTC_INTERRUPTS_REG_IT_ALARM_M)
 		alm->enabled = 1;
 
 	return ret;
@@ -382,6 +396,8 @@ static int twl_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alm)
 
 static int twl_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alm)
 {
+	struct twl_rtc *twl_rtc = dev_get_drvdata(dev);
+
 	unsigned char alarm_data[ALL_TIME_REGS];
 	int ret;
 
@@ -398,7 +414,7 @@ static int twl_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alm)
 
 	/* update all the alarm registers in one shot */
 	ret = twl_i2c_write(TWL_MODULE_RTC, alarm_data,
-		(rtc_reg_map[REG_ALARM_SECONDS_REG]), ALL_TIME_REGS);
+			twl_rtc->reg_map[REG_ALARM_SECONDS_REG], ALL_TIME_REGS);
 	if (ret) {
 		dev_err(dev, "rtc_set_alarm error %d\n", ret);
 		goto out;
@@ -410,14 +426,15 @@ static int twl_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alm)
 	return ret;
 }
 
-static irqreturn_t twl_rtc_interrupt(int irq, void *rtc)
+static irqreturn_t twl_rtc_interrupt(int irq, void *data)
 {
+	struct twl_rtc *twl_rtc = data;
 	unsigned long events;
 	int ret = IRQ_NONE;
 	int res;
 	u8 rd_reg;
 
-	res = twl_rtc_read_u8(&rd_reg, REG_RTC_STATUS_REG);
+	res = twl_rtc_read_u8(twl_rtc, &rd_reg, REG_RTC_STATUS_REG);
 	if (res)
 		goto out;
 	/*
@@ -431,12 +448,12 @@ static irqreturn_t twl_rtc_interrupt(int irq, void *rtc)
 	else
 		events = RTC_IRQF | RTC_PF;
 
-	res = twl_rtc_write_u8(BIT_RTC_STATUS_REG_ALARM_M,
+	res = twl_rtc_write_u8(twl_rtc, BIT_RTC_STATUS_REG_ALARM_M,
 				   REG_RTC_STATUS_REG);
 	if (res)
 		goto out;
 
-	if (twl_class_is_4030()) {
+	if (twl_rtc->is_4030) {
 		/* Clear on Read enabled. RTC_IT bit of TWL4030_INT_PWR_ISR1
 		 * needs 2 reads to clear the interrupt. One read is done in
 		 * do_twl_pwrirq(). Doing the second read, to clear
@@ -455,7 +472,7 @@ static irqreturn_t twl_rtc_interrupt(int irq, void *rtc)
 	}
 
 	/* Notify RTC core on event */
-	rtc_update_irq(rtc, 1, events);
+	rtc_update_irq(twl_rtc->rtc, 1, events);
 
 	ret = IRQ_HANDLED;
 out:
@@ -474,7 +491,7 @@ static const struct rtc_class_ops twl_rtc_ops = {
 
 static int twl_rtc_probe(struct platform_device *pdev)
 {
-	struct rtc_device *rtc;
+	struct twl_rtc *twl_rtc;
 	int ret = -EINVAL;
 	int irq = platform_get_irq(pdev, 0);
 	u8 rd_reg;
@@ -482,13 +499,19 @@ static int twl_rtc_probe(struct platform_device *pdev)
 	if (irq <= 0)
 		return ret;
 
+	twl_rtc = devm_kzalloc(&pdev->dev, sizeof(*twl_rtc), GFP_KERNEL);
+	if (!twl_rtc)
+		return -ENOMEM;
+
+	twl_rtc->is_4030 = twl_class_is_4030();
+
 	/* Initialize the register map */
-	if (twl_class_is_4030())
-		rtc_reg_map = (u8 *)twl4030_rtc_reg_map;
+	if (twl_rtc->is_4030)
+		twl_rtc->reg_map = (u8 *)twl4030_rtc_reg_map;
 	else
-		rtc_reg_map = (u8 *)twl6030_rtc_reg_map;
+		twl_rtc->reg_map = (u8 *)twl6030_rtc_reg_map;
 
-	ret = twl_rtc_read_u8(&rd_reg, REG_RTC_STATUS_REG);
+	ret = twl_rtc_read_u8(twl_rtc, &rd_reg, REG_RTC_STATUS_REG);
 	if (ret < 0)
 		return ret;
 
@@ -499,11 +522,11 @@ static int twl_rtc_probe(struct platform_device *pdev)
 		dev_warn(&pdev->dev, "Pending Alarm interrupt detected.\n");
 
 	/* Clear RTC Power up reset and pending alarm interrupts */
-	ret = twl_rtc_write_u8(rd_reg, REG_RTC_STATUS_REG);
+	ret = twl_rtc_write_u8(twl_rtc, rd_reg, REG_RTC_STATUS_REG);
 	if (ret < 0)
 		return ret;
 
-	if (twl_class_is_6030()) {
+	if (!twl_rtc->is_4030) {
 		twl6030_interrupt_unmask(TWL6030_RTC_INT_MASK,
 			REG_INT_MSK_LINE_A);
 		twl6030_interrupt_unmask(TWL6030_RTC_INT_MASK,
@@ -511,40 +534,42 @@ static int twl_rtc_probe(struct platform_device *pdev)
 	}
 
 	dev_info(&pdev->dev, "Enabling TWL-RTC\n");
-	ret = twl_rtc_write_u8(BIT_RTC_CTRL_REG_STOP_RTC_M, REG_RTC_CTRL_REG);
+	ret = twl_rtc_write_u8(twl_rtc, BIT_RTC_CTRL_REG_STOP_RTC_M,
+				REG_RTC_CTRL_REG);
 	if (ret < 0)
 		return ret;
 
 	/* ensure interrupts are disabled, bootloaders can be strange */
-	ret = twl_rtc_write_u8(0, REG_RTC_INTERRUPTS_REG);
+	ret = twl_rtc_write_u8(twl_rtc, 0, REG_RTC_INTERRUPTS_REG);
 	if (ret < 0)
 		dev_warn(&pdev->dev, "unable to disable interrupt\n");
 
 	/* init cached IRQ enable bits */
-	ret = twl_rtc_read_u8(&rtc_irq_bits, REG_RTC_INTERRUPTS_REG);
+	ret = twl_rtc_read_u8(twl_rtc, &twl_rtc->rtc_irq_bits,
+				REG_RTC_INTERRUPTS_REG);
 	if (ret < 0)
 		return ret;
 
+	platform_set_drvdata(pdev, twl_rtc);
 	device_init_wakeup(&pdev->dev, 1);
 
-	rtc = devm_rtc_device_register(&pdev->dev, pdev->name,
+	twl_rtc->rtc = devm_rtc_device_register(&pdev->dev, pdev->name,
 					&twl_rtc_ops, THIS_MODULE);
-	if (IS_ERR(rtc)) {
+	if (IS_ERR(twl_rtc->rtc)) {
 		dev_err(&pdev->dev, "can't register RTC device, err %ld\n",
-			PTR_ERR(rtc));
-		return PTR_ERR(rtc);
+			PTR_ERR(twl_rtc->rtc));
+		return PTR_ERR(twl_rtc->rtc);
 	}
 
 	ret = devm_request_threaded_irq(&pdev->dev, irq, NULL,
 					twl_rtc_interrupt,
 					IRQF_TRIGGER_RISING | IRQF_ONESHOT,
-					dev_name(&rtc->dev), rtc);
+					dev_name(&twl_rtc->rtc->dev), twl_rtc);
 	if (ret < 0) {
 		dev_err(&pdev->dev, "IRQ is not free.\n");
 		return ret;
 	}
 
-	platform_set_drvdata(pdev, rtc);
 	return 0;
 }
 
@@ -554,10 +579,12 @@ static int twl_rtc_probe(struct platform_device *pdev)
  */
 static int twl_rtc_remove(struct platform_device *pdev)
 {
+	struct twl_rtc *twl_rtc = platform_get_drvdata(pdev);
+
 	/* leave rtc running, but disable irqs */
-	mask_rtc_irq_bit(BIT_RTC_INTERRUPTS_REG_IT_ALARM_M);
-	mask_rtc_irq_bit(BIT_RTC_INTERRUPTS_REG_IT_TIMER_M);
-	if (twl_class_is_6030()) {
+	mask_rtc_irq_bit(twl_rtc, BIT_RTC_INTERRUPTS_REG_IT_ALARM_M);
+	mask_rtc_irq_bit(twl_rtc, BIT_RTC_INTERRUPTS_REG_IT_TIMER_M);
+	if (!twl_rtc->is_4030) {
 		twl6030_interrupt_mask(TWL6030_RTC_INT_MASK,
 			REG_INT_MSK_LINE_A);
 		twl6030_interrupt_mask(TWL6030_RTC_INT_MASK,
@@ -569,25 +596,29 @@ static int twl_rtc_remove(struct platform_device *pdev)
 
 static void twl_rtc_shutdown(struct platform_device *pdev)
 {
+	struct twl_rtc *twl_rtc = platform_get_drvdata(pdev);
+
 	/* mask timer interrupts, but leave alarm interrupts on to enable
 	   power-on when alarm is triggered */
-	mask_rtc_irq_bit(BIT_RTC_INTERRUPTS_REG_IT_TIMER_M);
+	mask_rtc_irq_bit(twl_rtc, BIT_RTC_INTERRUPTS_REG_IT_TIMER_M);
 }
 
 #ifdef CONFIG_PM_SLEEP
-static unsigned char irqstat;
-
 static int twl_rtc_suspend(struct device *dev)
 {
-	irqstat = rtc_irq_bits;
+	struct twl_rtc *twl_rtc = dev_get_drvdata(dev);
 
-	mask_rtc_irq_bit(BIT_RTC_INTERRUPTS_REG_IT_TIMER_M);
+	twl_rtc->irqstat = twl_rtc->rtc_irq_bits;
+
+	mask_rtc_irq_bit(twl_rtc, BIT_RTC_INTERRUPTS_REG_IT_TIMER_M);
 	return 0;
 }
 
 static int twl_rtc_resume(struct device *dev)
 {
-	set_rtc_irq_bit(irqstat);
+	struct twl_rtc *twl_rtc = dev_get_drvdata(dev);
+
+	set_rtc_irq_bit(twl_rtc, twl_rtc->irqstat);
 	return 0;
 }
 #endif
-- 
2.5.5

-- 
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
--- 
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit https://groups.google.com/d/optout.

^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [rtc-linux] [PATCH 2/3] rtc: rtc-twl: make driver DT only
@ 2016-11-12 10:07   ` Nicolae Rosia
  0 siblings, 0 replies; 30+ messages in thread
From: Nicolae Rosia @ 2016-11-12 10:07 UTC (permalink / raw)
  To: Alessandro Zummo, Alexandre Belloni
  Cc: rtc-linux, linux-omap, Tony Lindgren, Nicolae Rosia

Since there are no platform based users and all users
of this code are TI OMAP-based which is DT only, it makes
sense to remove unused code.

Signed-off-by: Nicolae Rosia <Nicolae_Rosia@mentor.com>
---
 drivers/rtc/Kconfig   |  1 +
 drivers/rtc/rtc-twl.c | 10 ++++++----
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig
index e859d14..2189216 100644
--- a/drivers/rtc/Kconfig
+++ b/drivers/rtc/Kconfig
@@ -481,6 +481,7 @@ config RTC_DRV_TWL92330
 config RTC_DRV_TWL4030
 	tristate "TI TWL4030/TWL5030/TWL6030/TPS659x0"
 	depends on TWL4030_CORE
+	depends on OF
 	help
 	  If you say yes here you get support for the RTC on the
 	  TWL4030/TWL5030/TWL6030 family chips, used mostly with OMAP3 platforms.
diff --git a/drivers/rtc/rtc-twl.c b/drivers/rtc/rtc-twl.c
index 0a1700a0..3d76322 100644
--- a/drivers/rtc/rtc-twl.c
+++ b/drivers/rtc/rtc-twl.c
@@ -492,10 +492,16 @@ static const struct rtc_class_ops twl_rtc_ops = {
 static int twl_rtc_probe(struct platform_device *pdev)
 {
 	struct twl_rtc *twl_rtc;
+	struct device_node *np = pdev->dev.of_node;
 	int ret = -EINVAL;
 	int irq = platform_get_irq(pdev, 0);
 	u8 rd_reg;
 
+	if (!np) {
+		dev_err(&pdev->dev, "no DT info\n");
+		return -EINVAL;
+	}
+
 	if (irq <= 0)
 		return ret;
 
@@ -625,15 +631,11 @@ static int twl_rtc_resume(struct device *dev)
 
 static SIMPLE_DEV_PM_OPS(twl_rtc_pm_ops, twl_rtc_suspend, twl_rtc_resume);
 
-#ifdef CONFIG_OF
 static const struct of_device_id twl_rtc_of_match[] = {
 	{.compatible = "ti,twl4030-rtc", },
 	{ },
 };
 MODULE_DEVICE_TABLE(of, twl_rtc_of_match);
-#endif
-
-MODULE_ALIAS("platform:twl_rtc");
 
 static struct platform_driver twl4030rtc_driver = {
 	.probe		= twl_rtc_probe,
-- 
2.5.5

-- 
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
--- 
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 2/3] rtc: rtc-twl: make driver DT only
@ 2016-11-12 10:07   ` Nicolae Rosia
  0 siblings, 0 replies; 30+ messages in thread
From: Nicolae Rosia @ 2016-11-12 10:07 UTC (permalink / raw)
  To: Alessandro Zummo, Alexandre Belloni
  Cc: rtc-linux-/JYPxA39Uh5TLH3MbocFFw,
	linux-omap-u79uwXL29TY76Z2rM5mHXA, Tony Lindgren, Nicolae Rosia

Since there are no platform based users and all users
of this code are TI OMAP-based which is DT only, it makes
sense to remove unused code.

Signed-off-by: Nicolae Rosia <Nicolae_Rosia-nmGgyN9QBj3QT0dZR+AlfA@public.gmane.org>
---
 drivers/rtc/Kconfig   |  1 +
 drivers/rtc/rtc-twl.c | 10 ++++++----
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig
index e859d14..2189216 100644
--- a/drivers/rtc/Kconfig
+++ b/drivers/rtc/Kconfig
@@ -481,6 +481,7 @@ config RTC_DRV_TWL92330
 config RTC_DRV_TWL4030
 	tristate "TI TWL4030/TWL5030/TWL6030/TPS659x0"
 	depends on TWL4030_CORE
+	depends on OF
 	help
 	  If you say yes here you get support for the RTC on the
 	  TWL4030/TWL5030/TWL6030 family chips, used mostly with OMAP3 platforms.
diff --git a/drivers/rtc/rtc-twl.c b/drivers/rtc/rtc-twl.c
index 0a1700a0..3d76322 100644
--- a/drivers/rtc/rtc-twl.c
+++ b/drivers/rtc/rtc-twl.c
@@ -492,10 +492,16 @@ static const struct rtc_class_ops twl_rtc_ops = {
 static int twl_rtc_probe(struct platform_device *pdev)
 {
 	struct twl_rtc *twl_rtc;
+	struct device_node *np = pdev->dev.of_node;
 	int ret = -EINVAL;
 	int irq = platform_get_irq(pdev, 0);
 	u8 rd_reg;
 
+	if (!np) {
+		dev_err(&pdev->dev, "no DT info\n");
+		return -EINVAL;
+	}
+
 	if (irq <= 0)
 		return ret;
 
@@ -625,15 +631,11 @@ static int twl_rtc_resume(struct device *dev)
 
 static SIMPLE_DEV_PM_OPS(twl_rtc_pm_ops, twl_rtc_suspend, twl_rtc_resume);
 
-#ifdef CONFIG_OF
 static const struct of_device_id twl_rtc_of_match[] = {
 	{.compatible = "ti,twl4030-rtc", },
 	{ },
 };
 MODULE_DEVICE_TABLE(of, twl_rtc_of_match);
-#endif
-
-MODULE_ALIAS("platform:twl_rtc");
 
 static struct platform_driver twl4030rtc_driver = {
 	.probe		= twl_rtc_probe,
-- 
2.5.5

-- 
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
--- 
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit https://groups.google.com/d/optout.

^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [rtc-linux] [PATCH 3/3] rtc: rtc-twl: use irq_of_parse_and_map helper
@ 2016-11-12 10:07   ` Nicolae Rosia
  0 siblings, 0 replies; 30+ messages in thread
From: Nicolae Rosia @ 2016-11-12 10:07 UTC (permalink / raw)
  To: Alessandro Zummo, Alexandre Belloni
  Cc: rtc-linux, linux-omap, Tony Lindgren, Nicolae Rosia

Signed-off-by: Nicolae Rosia <Nicolae_Rosia@mentor.com>
---
 drivers/rtc/Kconfig   | 2 +-
 drivers/rtc/rtc-twl.c | 4 +++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig
index 2189216..7ac7579 100644
--- a/drivers/rtc/Kconfig
+++ b/drivers/rtc/Kconfig
@@ -481,7 +481,7 @@ config RTC_DRV_TWL92330
 config RTC_DRV_TWL4030
 	tristate "TI TWL4030/TWL5030/TWL6030/TPS659x0"
 	depends on TWL4030_CORE
-	depends on OF
+	depends on OF && OF_IRQ
 	help
 	  If you say yes here you get support for the RTC on the
 	  TWL4030/TWL5030/TWL6030 family chips, used mostly with OMAP3 platforms.
diff --git a/drivers/rtc/rtc-twl.c b/drivers/rtc/rtc-twl.c
index 3d76322..7994baf 100644
--- a/drivers/rtc/rtc-twl.c
+++ b/drivers/rtc/rtc-twl.c
@@ -30,6 +30,7 @@
 #include <linux/platform_device.h>
 #include <linux/interrupt.h>
 #include <linux/of.h>
+#include <linux/of_irq.h>
 
 #include <linux/i2c/twl.h>
 
@@ -494,7 +495,7 @@ static int twl_rtc_probe(struct platform_device *pdev)
 	struct twl_rtc *twl_rtc;
 	struct device_node *np = pdev->dev.of_node;
 	int ret = -EINVAL;
-	int irq = platform_get_irq(pdev, 0);
+	int irq;
 	u8 rd_reg;
 
 	if (!np) {
@@ -502,6 +503,7 @@ static int twl_rtc_probe(struct platform_device *pdev)
 		return -EINVAL;
 	}
 
+	irq = irq_of_parse_and_map(np, 0);
 	if (irq <= 0)
 		return ret;
 
-- 
2.5.5

-- 
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
--- 
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 3/3] rtc: rtc-twl: use irq_of_parse_and_map helper
@ 2016-11-12 10:07   ` Nicolae Rosia
  0 siblings, 0 replies; 30+ messages in thread
From: Nicolae Rosia @ 2016-11-12 10:07 UTC (permalink / raw)
  To: Alessandro Zummo, Alexandre Belloni
  Cc: rtc-linux-/JYPxA39Uh5TLH3MbocFFw,
	linux-omap-u79uwXL29TY76Z2rM5mHXA, Tony Lindgren, Nicolae Rosia

Signed-off-by: Nicolae Rosia <Nicolae_Rosia-nmGgyN9QBj3QT0dZR+AlfA@public.gmane.org>
---
 drivers/rtc/Kconfig   | 2 +-
 drivers/rtc/rtc-twl.c | 4 +++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig
index 2189216..7ac7579 100644
--- a/drivers/rtc/Kconfig
+++ b/drivers/rtc/Kconfig
@@ -481,7 +481,7 @@ config RTC_DRV_TWL92330
 config RTC_DRV_TWL4030
 	tristate "TI TWL4030/TWL5030/TWL6030/TPS659x0"
 	depends on TWL4030_CORE
-	depends on OF
+	depends on OF && OF_IRQ
 	help
 	  If you say yes here you get support for the RTC on the
 	  TWL4030/TWL5030/TWL6030 family chips, used mostly with OMAP3 platforms.
diff --git a/drivers/rtc/rtc-twl.c b/drivers/rtc/rtc-twl.c
index 3d76322..7994baf 100644
--- a/drivers/rtc/rtc-twl.c
+++ b/drivers/rtc/rtc-twl.c
@@ -30,6 +30,7 @@
 #include <linux/platform_device.h>
 #include <linux/interrupt.h>
 #include <linux/of.h>
+#include <linux/of_irq.h>
 
 #include <linux/i2c/twl.h>
 
@@ -494,7 +495,7 @@ static int twl_rtc_probe(struct platform_device *pdev)
 	struct twl_rtc *twl_rtc;
 	struct device_node *np = pdev->dev.of_node;
 	int ret = -EINVAL;
-	int irq = platform_get_irq(pdev, 0);
+	int irq;
 	u8 rd_reg;
 
 	if (!np) {
@@ -502,6 +503,7 @@ static int twl_rtc_probe(struct platform_device *pdev)
 		return -EINVAL;
 	}
 
+	irq = irq_of_parse_and_map(np, 0);
 	if (irq <= 0)
 		return ret;
 
-- 
2.5.5

-- 
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
--- 
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit https://groups.google.com/d/optout.

^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [rtc-linux] Re: [PATCH 0/3] rtc: rtc-twl: cleanup
@ 2016-11-12 10:23   ` Nicolae Rosia
  0 siblings, 0 replies; 30+ messages in thread
From: Nicolae Rosia @ 2016-11-12 10:23 UTC (permalink / raw)
  To: Tony Lindgren
  Cc: Alessandro Zummo, Alexandre Belloni, rtc-linux, linux-omap,
	Nicolae Rosia

On Sat, Nov 12, 2016 at 12:07 PM, Nicolae Rosia
<Nicolae_Rosia@mentor.com> wrote:
> This is a cleanup and preparation of rtc-twl to reduce the usage of
> twl-core exported functions.
> The next patch series will further reduce the usage of exported functions
> but first it requires some changes in mfd/twl-core.c
Tony, could you please test this series again and add your Tested-By ?

Thanks a lot,
Nicolae

-- 
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
--- 
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 0/3] rtc: rtc-twl: cleanup
@ 2016-11-12 10:23   ` Nicolae Rosia
  0 siblings, 0 replies; 30+ messages in thread
From: Nicolae Rosia @ 2016-11-12 10:23 UTC (permalink / raw)
  To: Tony Lindgren
  Cc: Alessandro Zummo, Alexandre Belloni,
	rtc-linux-/JYPxA39Uh5TLH3MbocFFw,
	linux-omap-u79uwXL29TY76Z2rM5mHXA, Nicolae Rosia

On Sat, Nov 12, 2016 at 12:07 PM, Nicolae Rosia
<Nicolae_Rosia-nmGgyN9QBj3QT0dZR+AlfA@public.gmane.org> wrote:
> This is a cleanup and preparation of rtc-twl to reduce the usage of
> twl-core exported functions.
> The next patch series will further reduce the usage of exported functions
> but first it requires some changes in mfd/twl-core.c
Tony, could you please test this series again and add your Tested-By ?

Thanks a lot,
Nicolae

-- 
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
--- 
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit https://groups.google.com/d/optout.

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [rtc-linux] Re: [PATCH 3/3] rtc: rtc-twl: use irq_of_parse_and_map helper
@ 2016-11-12 11:20     ` Sebastian Reichel
  0 siblings, 0 replies; 30+ messages in thread
From: Sebastian Reichel @ 2016-11-12 11:20 UTC (permalink / raw)
  To: Nicolae Rosia
  Cc: Alessandro Zummo, Alexandre Belloni, rtc-linux, linux-omap,
	Tony Lindgren

[-- Attachment #1: Type: text/plain, Size: 892 bytes --]

Hi,

> Signed-off-by: Nicolae Rosia <Nicolae_Rosia@mentor.com>
> ---
>  drivers/rtc/Kconfig   | 2 +-
>  drivers/rtc/rtc-twl.c | 4 +++-
>  2 files changed, 4 insertions(+), 2 deletions(-)


This patch is missing long description. I would have patched it the
other way around. There is no reason to use irq_of_parse_and_map if
generic platform_get_irq can be used.

-- Sebastian

-- 
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
--- 
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 3/3] rtc: rtc-twl: use irq_of_parse_and_map helper
@ 2016-11-12 11:20     ` Sebastian Reichel
  0 siblings, 0 replies; 30+ messages in thread
From: Sebastian Reichel @ 2016-11-12 11:20 UTC (permalink / raw)
  To: Nicolae Rosia
  Cc: Alessandro Zummo, Alexandre Belloni,
	rtc-linux-/JYPxA39Uh5TLH3MbocFFw,
	linux-omap-u79uwXL29TY76Z2rM5mHXA, Tony Lindgren

[-- Attachment #1: Type: text/plain, Size: 953 bytes --]

Hi,

> Signed-off-by: Nicolae Rosia <Nicolae_Rosia-nmGgyN9QBj3QT0dZR+AlfA@public.gmane.org>
> ---
>  drivers/rtc/Kconfig   | 2 +-
>  drivers/rtc/rtc-twl.c | 4 +++-
>  2 files changed, 4 insertions(+), 2 deletions(-)


This patch is missing long description. I would have patched it the
other way around. There is no reason to use irq_of_parse_and_map if
generic platform_get_irq can be used.

-- Sebastian

-- 
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
--- 
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit https://groups.google.com/d/optout.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [rtc-linux] Re: [PATCH 3/3] rtc: rtc-twl: use irq_of_parse_and_map helper
  2016-11-12 11:20     ` Sebastian Reichel
@ 2016-11-12 11:37       ` Nicolae Rosia
  -1 siblings, 0 replies; 30+ messages in thread
From: Nicolae Rosia @ 2016-11-12 11:37 UTC (permalink / raw)
  To: Sebastian Reichel
  Cc: Nicolae Rosia, Alessandro Zummo, Alexandre Belloni, rtc-linux,
	linux-omap, Tony Lindgren

Hi,


On Sat, Nov 12, 2016 at 1:20 PM, Sebastian Reichel <sre@kernel.org> wrote:
> This patch is missing long description. I would have patched it the
> other way around. There is no reason to use irq_of_parse_and_map if
> generic platform_get_irq can be used.
Since this patch series removes platform support and makes the driver DT only,
I thought it would be a good idea to make it explicit that it depends on OF_IRQ.

Regards,
Nicolae

-- 
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
--- 
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 3/3] rtc: rtc-twl: use irq_of_parse_and_map helper
@ 2016-11-12 11:37       ` Nicolae Rosia
  0 siblings, 0 replies; 30+ messages in thread
From: Nicolae Rosia @ 2016-11-12 11:37 UTC (permalink / raw)
  To: Sebastian Reichel
  Cc: Nicolae Rosia, Alessandro Zummo, Alexandre Belloni,
	rtc-linux-/JYPxA39Uh5TLH3MbocFFw,
	linux-omap-u79uwXL29TY76Z2rM5mHXA, Tony Lindgren

Hi,


On Sat, Nov 12, 2016 at 1:20 PM, Sebastian Reichel <sre-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> wrote:
> This patch is missing long description. I would have patched it the
> other way around. There is no reason to use irq_of_parse_and_map if
> generic platform_get_irq can be used.
Since this patch series removes platform support and makes the driver DT only,
I thought it would be a good idea to make it explicit that it depends on OF_IRQ.

Regards,
Nicolae

-- 
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
--- 
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit https://groups.google.com/d/optout.

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [rtc-linux] Re: [PATCH 3/3] rtc: rtc-twl: use irq_of_parse_and_map helper
@ 2016-11-12 17:58         ` Tony Lindgren
  0 siblings, 0 replies; 30+ messages in thread
From: Tony Lindgren @ 2016-11-12 17:58 UTC (permalink / raw)
  To: Nicolae Rosia
  Cc: Sebastian Reichel, Nicolae Rosia, Alessandro Zummo,
	Alexandre Belloni, rtc-linux, linux-omap

* Nicolae Rosia <nicolae.rosia.oss@gmail.com> [161112 03:37]:
> Hi,
> 
> 
> On Sat, Nov 12, 2016 at 1:20 PM, Sebastian Reichel <sre@kernel.org> wrote:
> > This patch is missing long description. I would have patched it the
> > other way around. There is no reason to use irq_of_parse_and_map if
> > generic platform_get_irq can be used.
> Since this patch series removes platform support and makes the driver DT only,
> I thought it would be a good idea to make it explicit that it depends on OF_IRQ.

You can still use platform_get_irq(), eventually that will be just some
generic call. Don't we already have the "generic" names defined somewhere
in kernel?

Regards,

Tony

-- 
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
--- 
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 3/3] rtc: rtc-twl: use irq_of_parse_and_map helper
@ 2016-11-12 17:58         ` Tony Lindgren
  0 siblings, 0 replies; 30+ messages in thread
From: Tony Lindgren @ 2016-11-12 17:58 UTC (permalink / raw)
  To: Nicolae Rosia
  Cc: Sebastian Reichel, Nicolae Rosia, Alessandro Zummo,
	Alexandre Belloni, rtc-linux-/JYPxA39Uh5TLH3MbocFFw,
	linux-omap-u79uwXL29TY76Z2rM5mHXA

* Nicolae Rosia <nicolae.rosia.oss-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> [161112 03:37]:
> Hi,
> 
> 
> On Sat, Nov 12, 2016 at 1:20 PM, Sebastian Reichel <sre-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> wrote:
> > This patch is missing long description. I would have patched it the
> > other way around. There is no reason to use irq_of_parse_and_map if
> > generic platform_get_irq can be used.
> Since this patch series removes platform support and makes the driver DT only,
> I thought it would be a good idea to make it explicit that it depends on OF_IRQ.

You can still use platform_get_irq(), eventually that will be just some
generic call. Don't we already have the "generic" names defined somewhere
in kernel?

Regards,

Tony

-- 
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
--- 
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit https://groups.google.com/d/optout.

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [rtc-linux] Re: [PATCH 0/3] rtc: rtc-twl: cleanup
@ 2016-11-15  0:42     ` Tony Lindgren
  0 siblings, 0 replies; 30+ messages in thread
From: Tony Lindgren @ 2016-11-15  0:42 UTC (permalink / raw)
  To: Nicolae Rosia
  Cc: Alessandro Zummo, Alexandre Belloni, rtc-linux, linux-omap,
	Nicolae Rosia

* Nicolae Rosia <nicolae.rosia.oss@gmail.com> [161112 02:23]:
> On Sat, Nov 12, 2016 at 12:07 PM, Nicolae Rosia
> <Nicolae_Rosia@mentor.com> wrote:
> > This is a cleanup and preparation of rtc-twl to reduce the usage of
> > twl-core exported functions.
> > The next patch series will further reduce the usage of exported functions
> > but first it requires some changes in mfd/twl-core.c
> Tony, could you please test this series again and add your Tested-By ?

Yes still works for me as tested with rtcwake on omap3 and omap4:

Tested-by: Tony Lindgren <tony@atomide.com>

-- 
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
--- 
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 0/3] rtc: rtc-twl: cleanup
@ 2016-11-15  0:42     ` Tony Lindgren
  0 siblings, 0 replies; 30+ messages in thread
From: Tony Lindgren @ 2016-11-15  0:42 UTC (permalink / raw)
  To: Nicolae Rosia
  Cc: Alessandro Zummo, Alexandre Belloni,
	rtc-linux-/JYPxA39Uh5TLH3MbocFFw,
	linux-omap-u79uwXL29TY76Z2rM5mHXA, Nicolae Rosia

* Nicolae Rosia <nicolae.rosia.oss-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> [161112 02:23]:
> On Sat, Nov 12, 2016 at 12:07 PM, Nicolae Rosia
> <Nicolae_Rosia-nmGgyN9QBj3QT0dZR+AlfA@public.gmane.org> wrote:
> > This is a cleanup and preparation of rtc-twl to reduce the usage of
> > twl-core exported functions.
> > The next patch series will further reduce the usage of exported functions
> > but first it requires some changes in mfd/twl-core.c
> Tony, could you please test this series again and add your Tested-By ?

Yes still works for me as tested with rtcwake on omap3 and omap4:

Tested-by: Tony Lindgren <tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>

-- 
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
--- 
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit https://groups.google.com/d/optout.

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [rtc-linux] Re: [PATCH 1/3] rtc: rtc-twl: kill static variables
@ 2016-11-22 22:31     ` Alexandre Belloni
  0 siblings, 0 replies; 30+ messages in thread
From: Alexandre Belloni @ 2016-11-22 22:31 UTC (permalink / raw)
  To: Nicolae Rosia; +Cc: Alessandro Zummo, rtc-linux, linux-omap, Tony Lindgren

Hi,

A few alignments are off but I can fix that provided you answer the
question below:

On 12/11/2016 at 12:07:24 +0200, Nicolae Rosia wrote :
>  	/* for twl6030/32 make sure BIT_RTC_CTRL_REG_GET_TIME_M is clear */
> -	if (twl_class_is_6030()) {
> +	if (!twl_rtc->is_4030) {

This changes the meaning of it. What if at some point there is a new
part that is neither a 4030 nor an 6030?
That will probably mean going over ths part of code again but maybe the
odds are low and nobody cares.


-- 
Alexandre Belloni, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

-- 
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
--- 
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 1/3] rtc: rtc-twl: kill static variables
@ 2016-11-22 22:31     ` Alexandre Belloni
  0 siblings, 0 replies; 30+ messages in thread
From: Alexandre Belloni @ 2016-11-22 22:31 UTC (permalink / raw)
  To: Nicolae Rosia
  Cc: Alessandro Zummo, rtc-linux-/JYPxA39Uh5TLH3MbocFFw,
	linux-omap-u79uwXL29TY76Z2rM5mHXA, Tony Lindgren

Hi,

A few alignments are off but I can fix that provided you answer the
question below:

On 12/11/2016 at 12:07:24 +0200, Nicolae Rosia wrote :
>  	/* for twl6030/32 make sure BIT_RTC_CTRL_REG_GET_TIME_M is clear */
> -	if (twl_class_is_6030()) {
> +	if (!twl_rtc->is_4030) {

This changes the meaning of it. What if at some point there is a new
part that is neither a 4030 nor an 6030?
That will probably mean going over ths part of code again but maybe the
odds are low and nobody cares.


-- 
Alexandre Belloni, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

-- 
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
--- 
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit https://groups.google.com/d/optout.

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [rtc-linux] Re: [PATCH 2/3] rtc: rtc-twl: make driver DT only
@ 2016-11-22 22:33     ` Alexandre Belloni
  0 siblings, 0 replies; 30+ messages in thread
From: Alexandre Belloni @ 2016-11-22 22:33 UTC (permalink / raw)
  To: Nicolae Rosia; +Cc: Alessandro Zummo, rtc-linux, linux-omap, Tony Lindgren

On 12/11/2016 at 12:07:25 +0200, Nicolae Rosia wrote :
> @@ -625,15 +631,11 @@ static int twl_rtc_resume(struct device *dev)
>  
>  static SIMPLE_DEV_PM_OPS(twl_rtc_pm_ops, twl_rtc_suspend, twl_rtc_resume);
>  
> -#ifdef CONFIG_OF
>  static const struct of_device_id twl_rtc_of_match[] = {
>  	{.compatible = "ti,twl4030-rtc", },
>  	{ },
>  };
>  MODULE_DEVICE_TABLE(of, twl_rtc_of_match);
> -#endif
> -
> -MODULE_ALIAS("platform:twl_rtc");
>  
>  static struct platform_driver twl4030rtc_driver = {
>  	.probe		= twl_rtc_probe,


You can then get rid of of_match_ptr()


-- 
Alexandre Belloni, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

-- 
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
--- 
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 2/3] rtc: rtc-twl: make driver DT only
@ 2016-11-22 22:33     ` Alexandre Belloni
  0 siblings, 0 replies; 30+ messages in thread
From: Alexandre Belloni @ 2016-11-22 22:33 UTC (permalink / raw)
  To: Nicolae Rosia
  Cc: Alessandro Zummo, rtc-linux-/JYPxA39Uh5TLH3MbocFFw,
	linux-omap-u79uwXL29TY76Z2rM5mHXA, Tony Lindgren

On 12/11/2016 at 12:07:25 +0200, Nicolae Rosia wrote :
> @@ -625,15 +631,11 @@ static int twl_rtc_resume(struct device *dev)
>  
>  static SIMPLE_DEV_PM_OPS(twl_rtc_pm_ops, twl_rtc_suspend, twl_rtc_resume);
>  
> -#ifdef CONFIG_OF
>  static const struct of_device_id twl_rtc_of_match[] = {
>  	{.compatible = "ti,twl4030-rtc", },
>  	{ },
>  };
>  MODULE_DEVICE_TABLE(of, twl_rtc_of_match);
> -#endif
> -
> -MODULE_ALIAS("platform:twl_rtc");
>  
>  static struct platform_driver twl4030rtc_driver = {
>  	.probe		= twl_rtc_probe,


You can then get rid of of_match_ptr()


-- 
Alexandre Belloni, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

-- 
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
--- 
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit https://groups.google.com/d/optout.

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [rtc-linux] Re: [PATCH 1/3] rtc: rtc-twl: kill static variables
@ 2016-11-23  8:39       ` Nicolae Rosia
  0 siblings, 0 replies; 30+ messages in thread
From: Nicolae Rosia @ 2016-11-23  8:39 UTC (permalink / raw)
  To: Alexandre Belloni
  Cc: Nicolae Rosia, Alessandro Zummo, rtc-linux, linux-omap, Tony Lindgren

Hi,
Thanks for the review.

On Wed, Nov 23, 2016 at 12:31 AM, Alexandre Belloni
<alexandre.belloni@free-electrons.com> wrote:
> Hi,
>
> A few alignments are off but I can fix that provided you answer the
> question below:
>
Ok, could you please indicate which lines so I can fix them instead of
wasting your time?

> On 12/11/2016 at 12:07:24 +0200, Nicolae Rosia wrote :
>>       /* for twl6030/32 make sure BIT_RTC_CTRL_REG_GET_TIME_M is clear */
>> -     if (twl_class_is_6030()) {
>> +     if (!twl_rtc->is_4030) {
>
> This changes the meaning of it. What if at some point there is a new
> part that is neither a 4030 nor an 6030?
> That will probably mean going over ths part of code again but maybe the
> odds are low and nobody cares.
Since there are only two classes, 4030 and 6030, it will work.
But you're right, it's better to retain the old logic so the changes
are minimal.

Will send V2 in a bit.

Thanks,
Nicolae

-- 
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
--- 
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 1/3] rtc: rtc-twl: kill static variables
@ 2016-11-23  8:39       ` Nicolae Rosia
  0 siblings, 0 replies; 30+ messages in thread
From: Nicolae Rosia @ 2016-11-23  8:39 UTC (permalink / raw)
  To: Alexandre Belloni
  Cc: Nicolae Rosia, Alessandro Zummo,
	rtc-linux-/JYPxA39Uh5TLH3MbocFFw,
	linux-omap-u79uwXL29TY76Z2rM5mHXA, Tony Lindgren

Hi,
Thanks for the review.

On Wed, Nov 23, 2016 at 12:31 AM, Alexandre Belloni
<alexandre.belloni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org> wrote:
> Hi,
>
> A few alignments are off but I can fix that provided you answer the
> question below:
>
Ok, could you please indicate which lines so I can fix them instead of
wasting your time?

> On 12/11/2016 at 12:07:24 +0200, Nicolae Rosia wrote :
>>       /* for twl6030/32 make sure BIT_RTC_CTRL_REG_GET_TIME_M is clear */
>> -     if (twl_class_is_6030()) {
>> +     if (!twl_rtc->is_4030) {
>
> This changes the meaning of it. What if at some point there is a new
> part that is neither a 4030 nor an 6030?
> That will probably mean going over ths part of code again but maybe the
> odds are low and nobody cares.
Since there are only two classes, 4030 and 6030, it will work.
But you're right, it's better to retain the old logic so the changes
are minimal.

Will send V2 in a bit.

Thanks,
Nicolae

-- 
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
--- 
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit https://groups.google.com/d/optout.

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [rtc-linux] Re: [PATCH 2/3] rtc: rtc-twl: make driver DT only
@ 2016-11-23  8:40       ` Nicolae Rosia
  0 siblings, 0 replies; 30+ messages in thread
From: Nicolae Rosia @ 2016-11-23  8:40 UTC (permalink / raw)
  To: Alexandre Belloni
  Cc: Nicolae Rosia, Alessandro Zummo, rtc-linux, linux-omap, Tony Lindgren

Hi,

On Wed, Nov 23, 2016 at 12:33 AM, Alexandre Belloni
<alexandre.belloni@free-electrons.com> wrote:
>>  static struct platform_driver twl4030rtc_driver = {
>>       .probe          = twl_rtc_probe,
>
>
> You can then get rid of of_match_ptr()
>
Sure, doing it in v2.

-- 
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
--- 
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 2/3] rtc: rtc-twl: make driver DT only
@ 2016-11-23  8:40       ` Nicolae Rosia
  0 siblings, 0 replies; 30+ messages in thread
From: Nicolae Rosia @ 2016-11-23  8:40 UTC (permalink / raw)
  To: Alexandre Belloni
  Cc: Nicolae Rosia, Alessandro Zummo,
	rtc-linux-/JYPxA39Uh5TLH3MbocFFw,
	linux-omap-u79uwXL29TY76Z2rM5mHXA, Tony Lindgren

Hi,

On Wed, Nov 23, 2016 at 12:33 AM, Alexandre Belloni
<alexandre.belloni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org> wrote:
>>  static struct platform_driver twl4030rtc_driver = {
>>       .probe          = twl_rtc_probe,
>
>
> You can then get rid of of_match_ptr()
>
Sure, doing it in v2.

-- 
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
--- 
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit https://groups.google.com/d/optout.

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [rtc-linux] Re: [PATCH 1/3] rtc: rtc-twl: kill static variables
@ 2016-11-23  8:46         ` Alexandre Belloni
  0 siblings, 0 replies; 30+ messages in thread
From: Alexandre Belloni @ 2016-11-23  8:46 UTC (permalink / raw)
  To: Nicolae Rosia
  Cc: Nicolae Rosia, Alessandro Zummo, rtc-linux, linux-omap, Tony Lindgren

On 23/11/2016 at 10:39:12 +0200, Nicolae Rosia wrote :
> Hi,
> Thanks for the review.
> 
> On Wed, Nov 23, 2016 at 12:31 AM, Alexandre Belloni
> <alexandre.belloni@free-electrons.com> wrote:
> > Hi,
> >
> > A few alignments are off but I can fix that provided you answer the
> > question below:
> >
> Ok, could you please indicate which lines so I can fix them instead of
> wasting your time?
> 

checkpatch.pl --strict will find them for you

> > On 12/11/2016 at 12:07:24 +0200, Nicolae Rosia wrote :
> >>       /* for twl6030/32 make sure BIT_RTC_CTRL_REG_GET_TIME_M is clear */
> >> -     if (twl_class_is_6030()) {
> >> +     if (!twl_rtc->is_4030) {
> >
> > This changes the meaning of it. What if at some point there is a new
> > part that is neither a 4030 nor an 6030?
> > That will probably mean going over ths part of code again but maybe the
> > odds are low and nobody cares.
> Since there are only two classes, 4030 and 6030, it will work.
> But you're right, it's better to retain the old logic so the changes
> are minimal.
> 
> Will send V2 in a bit.

Thanks

> 
> Thanks,
> Nicolae

-- 
Alexandre Belloni, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

-- 
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
--- 
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 1/3] rtc: rtc-twl: kill static variables
@ 2016-11-23  8:46         ` Alexandre Belloni
  0 siblings, 0 replies; 30+ messages in thread
From: Alexandre Belloni @ 2016-11-23  8:46 UTC (permalink / raw)
  To: Nicolae Rosia
  Cc: Nicolae Rosia, Alessandro Zummo,
	rtc-linux-/JYPxA39Uh5TLH3MbocFFw,
	linux-omap-u79uwXL29TY76Z2rM5mHXA, Tony Lindgren

On 23/11/2016 at 10:39:12 +0200, Nicolae Rosia wrote :
> Hi,
> Thanks for the review.
> 
> On Wed, Nov 23, 2016 at 12:31 AM, Alexandre Belloni
> <alexandre.belloni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org> wrote:
> > Hi,
> >
> > A few alignments are off but I can fix that provided you answer the
> > question below:
> >
> Ok, could you please indicate which lines so I can fix them instead of
> wasting your time?
> 

checkpatch.pl --strict will find them for you

> > On 12/11/2016 at 12:07:24 +0200, Nicolae Rosia wrote :
> >>       /* for twl6030/32 make sure BIT_RTC_CTRL_REG_GET_TIME_M is clear */
> >> -     if (twl_class_is_6030()) {
> >> +     if (!twl_rtc->is_4030) {
> >
> > This changes the meaning of it. What if at some point there is a new
> > part that is neither a 4030 nor an 6030?
> > That will probably mean going over ths part of code again but maybe the
> > odds are low and nobody cares.
> Since there are only two classes, 4030 and 6030, it will work.
> But you're right, it's better to retain the old logic so the changes
> are minimal.
> 
> Will send V2 in a bit.

Thanks

> 
> Thanks,
> Nicolae

-- 
Alexandre Belloni, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

-- 
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
--- 
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit https://groups.google.com/d/optout.

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [rtc-linux] Re: [PATCH 1/3] rtc: rtc-twl: kill static variables
@ 2016-11-23  8:57           ` Nicolae Rosia
  0 siblings, 0 replies; 30+ messages in thread
From: Nicolae Rosia @ 2016-11-23  8:57 UTC (permalink / raw)
  To: Alexandre Belloni
  Cc: Nicolae Rosia, Alessandro Zummo, rtc-linux, linux-omap, Tony Lindgren

Hi,

On Wed, Nov 23, 2016 at 10:46 AM, Alexandre Belloni
<alexandre.belloni@free-electrons.com> wrote:
>> Ok, could you please indicate which lines so I can fix them instead of
>> wasting your time?
>>
>
> checkpatch.pl --strict will find them for you
Thanks, I had the wrong tab setting.

-- 
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
--- 
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 1/3] rtc: rtc-twl: kill static variables
@ 2016-11-23  8:57           ` Nicolae Rosia
  0 siblings, 0 replies; 30+ messages in thread
From: Nicolae Rosia @ 2016-11-23  8:57 UTC (permalink / raw)
  To: Alexandre Belloni
  Cc: Nicolae Rosia, Alessandro Zummo,
	rtc-linux-/JYPxA39Uh5TLH3MbocFFw,
	linux-omap-u79uwXL29TY76Z2rM5mHXA, Tony Lindgren

Hi,

On Wed, Nov 23, 2016 at 10:46 AM, Alexandre Belloni
<alexandre.belloni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org> wrote:
>> Ok, could you please indicate which lines so I can fix them instead of
>> wasting your time?
>>
>
> checkpatch.pl --strict will find them for you
Thanks, I had the wrong tab setting.

-- 
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
--- 
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit https://groups.google.com/d/optout.

^ permalink raw reply	[flat|nested] 30+ messages in thread

end of thread, other threads:[~2016-11-23  8:57 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-12 10:07 [rtc-linux] [PATCH 0/3] rtc: rtc-twl: cleanup Nicolae Rosia
2016-11-12 10:07 ` Nicolae Rosia
2016-11-12 10:07 ` [rtc-linux] [PATCH 1/3] rtc: rtc-twl: kill static variables Nicolae Rosia
2016-11-12 10:07   ` Nicolae Rosia
2016-11-22 22:31   ` [rtc-linux] " Alexandre Belloni
2016-11-22 22:31     ` Alexandre Belloni
2016-11-23  8:39     ` [rtc-linux] " Nicolae Rosia
2016-11-23  8:39       ` Nicolae Rosia
2016-11-23  8:46       ` [rtc-linux] " Alexandre Belloni
2016-11-23  8:46         ` Alexandre Belloni
2016-11-23  8:57         ` [rtc-linux] " Nicolae Rosia
2016-11-23  8:57           ` Nicolae Rosia
2016-11-12 10:07 ` [rtc-linux] [PATCH 2/3] rtc: rtc-twl: make driver DT only Nicolae Rosia
2016-11-12 10:07   ` Nicolae Rosia
2016-11-22 22:33   ` [rtc-linux] " Alexandre Belloni
2016-11-22 22:33     ` Alexandre Belloni
2016-11-23  8:40     ` [rtc-linux] " Nicolae Rosia
2016-11-23  8:40       ` Nicolae Rosia
2016-11-12 10:07 ` [rtc-linux] [PATCH 3/3] rtc: rtc-twl: use irq_of_parse_and_map helper Nicolae Rosia
2016-11-12 10:07   ` Nicolae Rosia
2016-11-12 11:20   ` [rtc-linux] " Sebastian Reichel
2016-11-12 11:20     ` Sebastian Reichel
2016-11-12 11:37     ` [rtc-linux] " Nicolae Rosia
2016-11-12 11:37       ` Nicolae Rosia
2016-11-12 17:58       ` [rtc-linux] " Tony Lindgren
2016-11-12 17:58         ` Tony Lindgren
2016-11-12 10:23 ` [rtc-linux] Re: [PATCH 0/3] rtc: rtc-twl: cleanup Nicolae Rosia
2016-11-12 10:23   ` Nicolae Rosia
2016-11-15  0:42   ` [rtc-linux] " Tony Lindgren
2016-11-15  0:42     ` Tony Lindgren

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.