Inter-revision diff: patch 1

Comparing v7 (message) to v2 (message)

--- v7
+++ v2
@@ -1,88 +1,66 @@
-Use devres functionality to simplify resource freeing, dev.parent will
-be set by devm_input_allocate_device().
+The mfd mc13xxx interrupt handling was migrated to regmap with commit
+10f9edaeaa30 ("mfd: mc13xxx: Use regmap irq framework for interrupts").
+As a consequence, button_irq() will get called with virtual irq instead
+of chip-internal irq now. Add wrappers for the three supported interrupts.
 
 Signed-off-by: Alexander Kurz <akurz@blala.de>
 ---
- drivers/input/misc/mc13783-pwrbutton.c | 28 ++++++++------------------
- 1 file changed, 8 insertions(+), 20 deletions(-)
+ drivers/input/misc/mc13783-pwrbutton.c | 21 ++++++++++++++++++---
+ 1 file changed, 18 insertions(+), 3 deletions(-)
 
 diff --git a/drivers/input/misc/mc13783-pwrbutton.c b/drivers/input/misc/mc13783-pwrbutton.c
-index b83d762ae2e9..82434ea9cca5 100644
+index 1c7faa9b7afe..4765b25bc9f6 100644
 --- a/drivers/input/misc/mc13783-pwrbutton.c
 +++ b/drivers/input/misc/mc13783-pwrbutton.c
-@@ -21,6 +21,7 @@
+@@ -88,6 +88,21 @@ static irqreturn_t button_irq(int irq, void *_priv)
+ 	return IRQ_HANDLED;
+ }
  
- #include <linux/module.h>
- #include <linux/kernel.h>
-+#include <linux/device.h>
- #include <linux/errno.h>
- #include <linux/input.h>
- #include <linux/interrupt.h>
-@@ -102,18 +103,13 @@ static int mc13783_pwrbutton_probe(struct platform_device *pdev)
- 		return -ENODEV;
- 	}
++static irqreturn_t button1_irq(int irq, void *_priv)
++{
++	return button_irq(MC13783_IRQ_ONOFD1, _priv);
++}
++
++static irqreturn_t button2_irq(int irq, void *_priv)
++{
++	return button_irq(MC13783_IRQ_ONOFD2, _priv);
++}
++
++static irqreturn_t button3_irq(int irq, void *_priv)
++{
++	return button_irq(MC13783_IRQ_ONOFD3, _priv);
++}
++
+ static int mc13783_pwrbutton_probe(struct platform_device *pdev)
+ {
+ 	const struct mc13xxx_buttons_platform_data *pdata;
+@@ -137,7 +152,7 @@ static int mc13783_pwrbutton_probe(struct platform_device *pdev)
+ 			reg |= MC13783_POWER_CONTROL_2_ON1BRSTEN;
  
--	pwr = input_allocate_device();
--	if (!pwr) {
--		dev_dbg(&pdev->dev, "Can't allocate power button\n");
-+	pwr = devm_input_allocate_device(&pdev->dev);
-+	if (!pwr)
- 		return -ENOMEM;
--	}
- 
--	priv = kzalloc(sizeof(*priv), GFP_KERNEL);
--	if (!priv) {
--		err = -ENOMEM;
--		dev_dbg(&pdev->dev, "Can't allocate power button\n");
--		goto free_input_dev;
--	}
-+	priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
-+	if (!priv)
-+		return -ENOMEM;
- 
- 	reg |= (pdata->b1on_flags & 0x3) << MC13783_POWER_CONTROL_2_ON1BDBNC;
- 	reg |= (pdata->b2on_flags & 0x3) << MC13783_POWER_CONTROL_2_ON2BDBNC;
-@@ -139,7 +135,7 @@ static int mc13783_pwrbutton_probe(struct platform_device *pdev)
- 					  button_irq, "b1on", priv);
+ 		err = mc13xxx_irq_request(mc13783, MC13783_IRQ_ONOFD1,
+-					  button_irq, "b1on", priv);
++					  button1_irq, "b1on", priv);
  		if (err) {
  			dev_dbg(&pdev->dev, "Can't request irq\n");
--			goto free_priv;
-+			goto free_mc13xxx_lock;
- 		}
- 	}
+ 			goto free_priv;
+@@ -156,7 +171,7 @@ static int mc13783_pwrbutton_probe(struct platform_device *pdev)
+ 			reg |= MC13783_POWER_CONTROL_2_ON2BRSTEN;
  
-@@ -187,7 +183,6 @@ static int mc13783_pwrbutton_probe(struct platform_device *pdev)
+ 		err = mc13xxx_irq_request(mc13783, MC13783_IRQ_ONOFD2,
+-					  button_irq, "b2on", priv);
++					  button2_irq, "b2on", priv);
+ 		if (err) {
+ 			dev_dbg(&pdev->dev, "Can't request irq\n");
+ 			goto free_irq_b1;
+@@ -175,7 +190,7 @@ static int mc13783_pwrbutton_probe(struct platform_device *pdev)
+ 			reg |= MC13783_POWER_CONTROL_2_ON3BRSTEN;
  
- 	pwr->name = "mc13783_pwrbutton";
- 	pwr->phys = "mc13783_pwrbutton/input0";
--	pwr->dev.parent = &pdev->dev;
- 
- 	pwr->keycode = priv->keymap;
- 	pwr->keycodemax = ARRAY_SIZE(priv->keymap);
-@@ -218,12 +213,8 @@ static int mc13783_pwrbutton_probe(struct platform_device *pdev)
- 	if (pdata->b1on_flags & MC13783_BUTTON_ENABLE)
- 		mc13xxx_irq_free(mc13783, MC13783_IRQ_ONOFD1, priv);
- 
--free_priv:
-+free_mc13xxx_lock:
- 	mc13xxx_unlock(mc13783);
--	kfree(priv);
--
--free_input_dev:
--	input_free_device(pwr);
- 
- 	return err;
- }
-@@ -245,9 +236,6 @@ static void mc13783_pwrbutton_remove(struct platform_device *pdev)
- 		mc13xxx_irq_free(priv->mc13783, MC13783_IRQ_ONOFD1, priv);
- 
- 	mc13xxx_unlock(priv->mc13783);
--
--	input_unregister_device(priv->pwr);
--	kfree(priv);
- }
- 
- static struct platform_driver mc13783_pwrbutton_driver = {
+ 		err = mc13xxx_irq_request(mc13783, MC13783_IRQ_ONOFD3,
+-					  button_irq, "b3on", priv);
++					  button3_irq, "b3on", priv);
+ 		if (err) {
+ 			dev_dbg(&pdev->dev, "Can't request irq: %d\n", err);
+ 			goto free_irq_b2;
 -- 
 2.39.5
 
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help