All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] tc3589x OF only enforcement
@ 2015-03-19 14:52 ` Linus Walleij
  0 siblings, 0 replies; 34+ messages in thread
From: Linus Walleij @ 2015-03-19 14:52 UTC (permalink / raw)
  To: Samuel Ortiz, Lee Jones, Dmitry Torokhov
  Cc: linux-kernel, linux-arm-kernel, linux-input, Linus Walleij

These two patches removes the non-DT probe/config path from the
TC3589x driver. I suggest merging both through the MFD tree if
Dmitry can ACK the input patch.

Linus Walleij (2):
  input: keypad: tc3589x: localize platform data
  mfd: tc3589x: enforce device-tree only mode

 drivers/gpio/Kconfig                    |  1 +
 drivers/gpio/gpio-tc3589x.c             |  3 --
 drivers/input/keyboard/tc3589x-keypad.c | 58 +++++++++++++++++++--------------
 drivers/mfd/Kconfig                     |  1 +
 drivers/mfd/tc3589x.c                   |  9 -----
 include/linux/mfd/tc3589x.h             | 23 -------------
 6 files changed, 35 insertions(+), 60 deletions(-)

-- 
1.9.3


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

* [PATCH 0/2] tc3589x OF only enforcement
@ 2015-03-19 14:52 ` Linus Walleij
  0 siblings, 0 replies; 34+ messages in thread
From: Linus Walleij @ 2015-03-19 14:52 UTC (permalink / raw)
  To: linux-arm-kernel

These two patches removes the non-DT probe/config path from the
TC3589x driver. I suggest merging both through the MFD tree if
Dmitry can ACK the input patch.

Linus Walleij (2):
  input: keypad: tc3589x: localize platform data
  mfd: tc3589x: enforce device-tree only mode

 drivers/gpio/Kconfig                    |  1 +
 drivers/gpio/gpio-tc3589x.c             |  3 --
 drivers/input/keyboard/tc3589x-keypad.c | 58 +++++++++++++++++++--------------
 drivers/mfd/Kconfig                     |  1 +
 drivers/mfd/tc3589x.c                   |  9 -----
 include/linux/mfd/tc3589x.h             | 23 -------------
 6 files changed, 35 insertions(+), 60 deletions(-)

-- 
1.9.3

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

* [PATCH 1/2] input: keypad: tc3589x: localize platform data
  2015-03-19 14:52 ` Linus Walleij
@ 2015-03-19 14:52   ` Linus Walleij
  -1 siblings, 0 replies; 34+ messages in thread
From: Linus Walleij @ 2015-03-19 14:52 UTC (permalink / raw)
  To: Samuel Ortiz, Lee Jones, Dmitry Torokhov
  Cc: linux-kernel, linux-arm-kernel, linux-input, Linus Walleij

This driver can only get its platform data from the device tree,
and all platforms using it does that. Localize the platform data
for the keypad. A later patch will enforce the device tree / OF
dependence.

Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
Dmitry it would be great if you could ACK this patch so Lee can
take it with the other patch through MFD.
---
 drivers/input/keyboard/tc3589x-keypad.c | 49 ++++++++++++++++++++++-----------
 include/linux/mfd/tc3589x.h             | 23 ----------------
 2 files changed, 33 insertions(+), 39 deletions(-)

diff --git a/drivers/input/keyboard/tc3589x-keypad.c b/drivers/input/keyboard/tc3589x-keypad.c
index 563932500ff1..0ccc7de9b59d 100644
--- a/drivers/input/keyboard/tc3589x-keypad.c
+++ b/drivers/input/keyboard/tc3589x-keypad.c
@@ -70,6 +70,28 @@
 #define TC3589x_KBD_INT_CLR	0x1
 
 /**
+ * struct tc35893_keypad_platform_data - platform specific keypad data
+ * @keymap_data:        matrix scan code table for keycodes
+ * @krow:               mask for available rows, value is 0xFF
+ * @kcol:               mask for available columns, value is 0xFF
+ * @debounce_period:    platform specific debounce time
+ * @settle_time:        platform specific settle down time
+ * @irqtype:            type of interrupt, falling or rising edge
+ * @enable_wakeup:      specifies if keypad event can wake up system from sleep
+ * @no_autorepeat:      flag for auto repetition
+ */
+struct tc3589x_keypad_platform_data {
+	const struct matrix_keymap_data *keymap_data;
+	u8                      krow;
+	u8                      kcol;
+	u8                      debounce_period;
+	u8                      settle_time;
+	unsigned long           irqtype;
+	bool                    enable_wakeup;
+	bool                    no_autorepeat;
+};
+
+/**
  * struct tc_keypad - data structure used by keypad driver
  * @tc3589x:    pointer to tc35893
  * @input:      pointer to input device object
@@ -360,23 +382,19 @@ static int tc3589x_keypad_probe(struct platform_device *pdev)
 	struct tc3589x *tc3589x = dev_get_drvdata(pdev->dev.parent);
 	struct tc_keypad *keypad;
 	struct input_dev *input;
-	const struct tc3589x_keypad_platform_data *plat;
 	int error, irq;
 
-	plat = tc3589x->pdata->keypad;
-	if (!plat) {
-		plat = tc3589x_keypad_of_probe(&pdev->dev);
-		if (IS_ERR(plat)) {
-			dev_err(&pdev->dev, "invalid keypad platform data\n");
-			return PTR_ERR(plat);
-		}
-	}
-
 	irq = platform_get_irq(pdev, 0);
 	if (irq < 0)
 		return irq;
 
 	keypad = kzalloc(sizeof(struct tc_keypad), GFP_KERNEL);
+	keypad->board = tc3589x_keypad_of_probe(&pdev->dev);
+	if (IS_ERR(keypad->board)) {
+		dev_err(&pdev->dev, "invalid keypad platform data\n");
+		return PTR_ERR(keypad->board);
+	}
+
 	input = input_allocate_device();
 	if (!keypad || !input) {
 		dev_err(&pdev->dev, "failed to allocate keypad memory\n");
@@ -384,7 +402,6 @@ static int tc3589x_keypad_probe(struct platform_device *pdev)
 		goto err_free_mem;
 	}
 
-	keypad->board = plat;
 	keypad->input = input;
 	keypad->tc3589x = tc3589x;
 
@@ -395,7 +412,7 @@ static int tc3589x_keypad_probe(struct platform_device *pdev)
 	input->open = tc3589x_keypad_open;
 	input->close = tc3589x_keypad_close;
 
-	error = matrix_keypad_build_keymap(plat->keymap_data, NULL,
+	error = matrix_keypad_build_keymap(keypad->board->keymap_data, NULL,
 					   TC3589x_MAX_KPROW, TC3589x_MAX_KPCOL,
 					   NULL, input);
 	if (error) {
@@ -406,13 +423,13 @@ static int tc3589x_keypad_probe(struct platform_device *pdev)
 	keypad->keymap = input->keycode;
 
 	input_set_capability(input, EV_MSC, MSC_SCAN);
-	if (!plat->no_autorepeat)
+	if (!keypad->board->no_autorepeat)
 		__set_bit(EV_REP, input->evbit);
 
 	input_set_drvdata(input, keypad);
 
 	error = request_threaded_irq(irq, NULL, tc3589x_keypad_irq,
-				     plat->irqtype | IRQF_ONESHOT,
+				     keypad->board->irqtype | IRQF_ONESHOT,
 				     "tc3589x-keypad", keypad);
 	if (error < 0) {
 		dev_err(&pdev->dev,
@@ -428,8 +445,8 @@ static int tc3589x_keypad_probe(struct platform_device *pdev)
 	}
 
 	/* let platform decide if keypad is a wakeup source or not */
-	device_init_wakeup(&pdev->dev, plat->enable_wakeup);
-	device_set_wakeup_capable(&pdev->dev, plat->enable_wakeup);
+	device_init_wakeup(&pdev->dev, keypad->board->enable_wakeup);
+	device_set_wakeup_capable(&pdev->dev, keypad->board->enable_wakeup);
 
 	platform_set_drvdata(pdev, keypad);
 
diff --git a/include/linux/mfd/tc3589x.h b/include/linux/mfd/tc3589x.h
index c203c9c56776..468c31a27fcf 100644
--- a/include/linux/mfd/tc3589x.h
+++ b/include/linux/mfd/tc3589x.h
@@ -140,36 +140,13 @@ extern int tc3589x_set_bits(struct tc3589x *tc3589x, u8 reg, u8 mask, u8 val);
 #define TC_KPD_DEBOUNCE_PERIOD  0xA3
 #define TC_KPD_SETTLE_TIME      0xA3
 
-/**
- * struct tc35893_platform_data - data structure for platform specific data
- * @keymap_data:        matrix scan code table for keycodes
- * @krow:               mask for available rows, value is 0xFF
- * @kcol:               mask for available columns, value is 0xFF
- * @debounce_period:    platform specific debounce time
- * @settle_time:        platform specific settle down time
- * @irqtype:            type of interrupt, falling or rising edge
- * @enable_wakeup:      specifies if keypad event can wake up system from sleep
- * @no_autorepeat:      flag for auto repetition
- */
-struct tc3589x_keypad_platform_data {
-	const struct matrix_keymap_data *keymap_data;
-	u8                      krow;
-	u8                      kcol;
-	u8                      debounce_period;
-	u8                      settle_time;
-	unsigned long           irqtype;
-	bool                    enable_wakeup;
-	bool                    no_autorepeat;
-};
 
 /**
  * struct tc3589x_platform_data - TC3589x platform data
  * @block: bitmask of blocks to enable (use TC3589x_BLOCK_*)
- * @keypad: keypad-specific platform data
  */
 struct tc3589x_platform_data {
 	unsigned int block;
-	const struct tc3589x_keypad_platform_data *keypad;
 };
 
 #endif
-- 
1.9.3


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

* [PATCH 1/2] input: keypad: tc3589x: localize platform data
@ 2015-03-19 14:52   ` Linus Walleij
  0 siblings, 0 replies; 34+ messages in thread
From: Linus Walleij @ 2015-03-19 14:52 UTC (permalink / raw)
  To: linux-arm-kernel

This driver can only get its platform data from the device tree,
and all platforms using it does that. Localize the platform data
for the keypad. A later patch will enforce the device tree / OF
dependence.

Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
Dmitry it would be great if you could ACK this patch so Lee can
take it with the other patch through MFD.
---
 drivers/input/keyboard/tc3589x-keypad.c | 49 ++++++++++++++++++++++-----------
 include/linux/mfd/tc3589x.h             | 23 ----------------
 2 files changed, 33 insertions(+), 39 deletions(-)

diff --git a/drivers/input/keyboard/tc3589x-keypad.c b/drivers/input/keyboard/tc3589x-keypad.c
index 563932500ff1..0ccc7de9b59d 100644
--- a/drivers/input/keyboard/tc3589x-keypad.c
+++ b/drivers/input/keyboard/tc3589x-keypad.c
@@ -70,6 +70,28 @@
 #define TC3589x_KBD_INT_CLR	0x1
 
 /**
+ * struct tc35893_keypad_platform_data - platform specific keypad data
+ * @keymap_data:        matrix scan code table for keycodes
+ * @krow:               mask for available rows, value is 0xFF
+ * @kcol:               mask for available columns, value is 0xFF
+ * @debounce_period:    platform specific debounce time
+ * @settle_time:        platform specific settle down time
+ * @irqtype:            type of interrupt, falling or rising edge
+ * @enable_wakeup:      specifies if keypad event can wake up system from sleep
+ * @no_autorepeat:      flag for auto repetition
+ */
+struct tc3589x_keypad_platform_data {
+	const struct matrix_keymap_data *keymap_data;
+	u8                      krow;
+	u8                      kcol;
+	u8                      debounce_period;
+	u8                      settle_time;
+	unsigned long           irqtype;
+	bool                    enable_wakeup;
+	bool                    no_autorepeat;
+};
+
+/**
  * struct tc_keypad - data structure used by keypad driver
  * @tc3589x:    pointer to tc35893
  * @input:      pointer to input device object
@@ -360,23 +382,19 @@ static int tc3589x_keypad_probe(struct platform_device *pdev)
 	struct tc3589x *tc3589x = dev_get_drvdata(pdev->dev.parent);
 	struct tc_keypad *keypad;
 	struct input_dev *input;
-	const struct tc3589x_keypad_platform_data *plat;
 	int error, irq;
 
-	plat = tc3589x->pdata->keypad;
-	if (!plat) {
-		plat = tc3589x_keypad_of_probe(&pdev->dev);
-		if (IS_ERR(plat)) {
-			dev_err(&pdev->dev, "invalid keypad platform data\n");
-			return PTR_ERR(plat);
-		}
-	}
-
 	irq = platform_get_irq(pdev, 0);
 	if (irq < 0)
 		return irq;
 
 	keypad = kzalloc(sizeof(struct tc_keypad), GFP_KERNEL);
+	keypad->board = tc3589x_keypad_of_probe(&pdev->dev);
+	if (IS_ERR(keypad->board)) {
+		dev_err(&pdev->dev, "invalid keypad platform data\n");
+		return PTR_ERR(keypad->board);
+	}
+
 	input = input_allocate_device();
 	if (!keypad || !input) {
 		dev_err(&pdev->dev, "failed to allocate keypad memory\n");
@@ -384,7 +402,6 @@ static int tc3589x_keypad_probe(struct platform_device *pdev)
 		goto err_free_mem;
 	}
 
-	keypad->board = plat;
 	keypad->input = input;
 	keypad->tc3589x = tc3589x;
 
@@ -395,7 +412,7 @@ static int tc3589x_keypad_probe(struct platform_device *pdev)
 	input->open = tc3589x_keypad_open;
 	input->close = tc3589x_keypad_close;
 
-	error = matrix_keypad_build_keymap(plat->keymap_data, NULL,
+	error = matrix_keypad_build_keymap(keypad->board->keymap_data, NULL,
 					   TC3589x_MAX_KPROW, TC3589x_MAX_KPCOL,
 					   NULL, input);
 	if (error) {
@@ -406,13 +423,13 @@ static int tc3589x_keypad_probe(struct platform_device *pdev)
 	keypad->keymap = input->keycode;
 
 	input_set_capability(input, EV_MSC, MSC_SCAN);
-	if (!plat->no_autorepeat)
+	if (!keypad->board->no_autorepeat)
 		__set_bit(EV_REP, input->evbit);
 
 	input_set_drvdata(input, keypad);
 
 	error = request_threaded_irq(irq, NULL, tc3589x_keypad_irq,
-				     plat->irqtype | IRQF_ONESHOT,
+				     keypad->board->irqtype | IRQF_ONESHOT,
 				     "tc3589x-keypad", keypad);
 	if (error < 0) {
 		dev_err(&pdev->dev,
@@ -428,8 +445,8 @@ static int tc3589x_keypad_probe(struct platform_device *pdev)
 	}
 
 	/* let platform decide if keypad is a wakeup source or not */
-	device_init_wakeup(&pdev->dev, plat->enable_wakeup);
-	device_set_wakeup_capable(&pdev->dev, plat->enable_wakeup);
+	device_init_wakeup(&pdev->dev, keypad->board->enable_wakeup);
+	device_set_wakeup_capable(&pdev->dev, keypad->board->enable_wakeup);
 
 	platform_set_drvdata(pdev, keypad);
 
diff --git a/include/linux/mfd/tc3589x.h b/include/linux/mfd/tc3589x.h
index c203c9c56776..468c31a27fcf 100644
--- a/include/linux/mfd/tc3589x.h
+++ b/include/linux/mfd/tc3589x.h
@@ -140,36 +140,13 @@ extern int tc3589x_set_bits(struct tc3589x *tc3589x, u8 reg, u8 mask, u8 val);
 #define TC_KPD_DEBOUNCE_PERIOD  0xA3
 #define TC_KPD_SETTLE_TIME      0xA3
 
-/**
- * struct tc35893_platform_data - data structure for platform specific data
- * @keymap_data:        matrix scan code table for keycodes
- * @krow:               mask for available rows, value is 0xFF
- * @kcol:               mask for available columns, value is 0xFF
- * @debounce_period:    platform specific debounce time
- * @settle_time:        platform specific settle down time
- * @irqtype:            type of interrupt, falling or rising edge
- * @enable_wakeup:      specifies if keypad event can wake up system from sleep
- * @no_autorepeat:      flag for auto repetition
- */
-struct tc3589x_keypad_platform_data {
-	const struct matrix_keymap_data *keymap_data;
-	u8                      krow;
-	u8                      kcol;
-	u8                      debounce_period;
-	u8                      settle_time;
-	unsigned long           irqtype;
-	bool                    enable_wakeup;
-	bool                    no_autorepeat;
-};
 
 /**
  * struct tc3589x_platform_data - TC3589x platform data
  * @block: bitmask of blocks to enable (use TC3589x_BLOCK_*)
- * @keypad: keypad-specific platform data
  */
 struct tc3589x_platform_data {
 	unsigned int block;
-	const struct tc3589x_keypad_platform_data *keypad;
 };
 
 #endif
-- 
1.9.3

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

* [PATCH 2/2] mfd: tc3589x: enforce device-tree only mode
  2015-03-19 14:52 ` Linus Walleij
@ 2015-03-19 14:52   ` Linus Walleij
  -1 siblings, 0 replies; 34+ messages in thread
From: Linus Walleij @ 2015-03-19 14:52 UTC (permalink / raw)
  To: Samuel Ortiz, Lee Jones, Dmitry Torokhov
  Cc: linux-kernel, linux-arm-kernel, linux-input, Linus Walleij

All systems using the TC3589x multifunction expander uses
devicetree, so don't clutter the place with a lot of
and assume it is there.

Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
 drivers/gpio/Kconfig                    | 1 +
 drivers/gpio/gpio-tc3589x.c             | 3 ---
 drivers/input/keyboard/tc3589x-keypad.c | 9 ---------
 drivers/mfd/Kconfig                     | 1 +
 drivers/mfd/tc3589x.c                   | 9 ---------
 5 files changed, 2 insertions(+), 21 deletions(-)

diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
index c1e2ca3d9a51..dc1aaa83a347 100644
--- a/drivers/gpio/Kconfig
+++ b/drivers/gpio/Kconfig
@@ -669,6 +669,7 @@ config GPIO_STP_XWAY
 config GPIO_TC3589X
 	bool "TC3589X GPIOs"
 	depends on MFD_TC3589X
+	depends on OF_GPIO
 	select GPIOLIB_IRQCHIP
 	help
 	  This enables support for the GPIOs found on the TC3589X
diff --git a/drivers/gpio/gpio-tc3589x.c b/drivers/gpio/gpio-tc3589x.c
index 11aed2671065..31b244cffabb 100644
--- a/drivers/gpio/gpio-tc3589x.c
+++ b/drivers/gpio/gpio-tc3589x.c
@@ -260,10 +260,7 @@ static int tc3589x_gpio_probe(struct platform_device *pdev)
 	tc3589x_gpio->chip.ngpio = tc3589x->num_gpio;
 	tc3589x_gpio->chip.dev = &pdev->dev;
 	tc3589x_gpio->chip.base = -1;
-
-#ifdef CONFIG_OF_GPIO
 	tc3589x_gpio->chip.of_node = np;
-#endif
 
 	/* Bring the GPIO module out of reset */
 	ret = tc3589x_set_bits(tc3589x, TC3589x_RSTCTRL,
diff --git a/drivers/input/keyboard/tc3589x-keypad.c b/drivers/input/keyboard/tc3589x-keypad.c
index 0ccc7de9b59d..08e62e6aeb1b 100644
--- a/drivers/input/keyboard/tc3589x-keypad.c
+++ b/drivers/input/keyboard/tc3589x-keypad.c
@@ -318,7 +318,6 @@ static void tc3589x_keypad_close(struct input_dev *input)
 	tc3589x_keypad_disable(keypad);
 }
 
-#ifdef CONFIG_OF
 static const struct tc3589x_keypad_platform_data *
 tc3589x_keypad_of_probe(struct device *dev)
 {
@@ -368,14 +367,6 @@ tc3589x_keypad_of_probe(struct device *dev)
 
 	return plat;
 }
-#else
-static inline const struct tc3589x_keypad_platform_data *
-tc3589x_keypad_of_probe(struct device *dev)
-{
-	return ERR_PTR(-ENODEV);
-}
-#endif
-
 
 static int tc3589x_keypad_probe(struct platform_device *pdev)
 {
diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index 38356e39adba..476e63745742 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -1210,6 +1210,7 @@ config MFD_TIMBERDALE
 config MFD_TC3589X
 	bool "Toshiba TC35892 and variants"
 	depends on I2C=y
+	depends on OF
 	select MFD_CORE
 	help
 	  Support for the Toshiba TC35892 and variants I/O Expander.
diff --git a/drivers/mfd/tc3589x.c b/drivers/mfd/tc3589x.c
index aacb3720065c..cf356395c9e9 100644
--- a/drivers/mfd/tc3589x.c
+++ b/drivers/mfd/tc3589x.c
@@ -318,7 +318,6 @@ static int tc3589x_device_init(struct tc3589x *tc3589x)
 	return ret;
 }
 
-#ifdef CONFIG_OF
 static const struct of_device_id tc3589x_match[] = {
 	/* Legacy compatible string */
 	{ .compatible = "tc3589x", .data = (void *) TC3589X_UNKNOWN },
@@ -359,14 +358,6 @@ tc3589x_of_probe(struct device *dev, enum tc3589x_version *version)
 
 	return pdata;
 }
-#else
-static inline struct tc3589x_platform_data *
-tc3589x_of_probe(struct device *dev, enum tc3589x_version *version)
-{
-	dev_err(dev, "no device tree support\n");
-	return ERR_PTR(-ENODEV);
-}
-#endif
 
 static int tc3589x_probe(struct i2c_client *i2c,
 				   const struct i2c_device_id *id)
-- 
1.9.3


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

* [PATCH 2/2] mfd: tc3589x: enforce device-tree only mode
@ 2015-03-19 14:52   ` Linus Walleij
  0 siblings, 0 replies; 34+ messages in thread
From: Linus Walleij @ 2015-03-19 14:52 UTC (permalink / raw)
  To: linux-arm-kernel

All systems using the TC3589x multifunction expander uses
devicetree, so don't clutter the place with a lot of
and assume it is there.

Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
 drivers/gpio/Kconfig                    | 1 +
 drivers/gpio/gpio-tc3589x.c             | 3 ---
 drivers/input/keyboard/tc3589x-keypad.c | 9 ---------
 drivers/mfd/Kconfig                     | 1 +
 drivers/mfd/tc3589x.c                   | 9 ---------
 5 files changed, 2 insertions(+), 21 deletions(-)

diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
index c1e2ca3d9a51..dc1aaa83a347 100644
--- a/drivers/gpio/Kconfig
+++ b/drivers/gpio/Kconfig
@@ -669,6 +669,7 @@ config GPIO_STP_XWAY
 config GPIO_TC3589X
 	bool "TC3589X GPIOs"
 	depends on MFD_TC3589X
+	depends on OF_GPIO
 	select GPIOLIB_IRQCHIP
 	help
 	  This enables support for the GPIOs found on the TC3589X
diff --git a/drivers/gpio/gpio-tc3589x.c b/drivers/gpio/gpio-tc3589x.c
index 11aed2671065..31b244cffabb 100644
--- a/drivers/gpio/gpio-tc3589x.c
+++ b/drivers/gpio/gpio-tc3589x.c
@@ -260,10 +260,7 @@ static int tc3589x_gpio_probe(struct platform_device *pdev)
 	tc3589x_gpio->chip.ngpio = tc3589x->num_gpio;
 	tc3589x_gpio->chip.dev = &pdev->dev;
 	tc3589x_gpio->chip.base = -1;
-
-#ifdef CONFIG_OF_GPIO
 	tc3589x_gpio->chip.of_node = np;
-#endif
 
 	/* Bring the GPIO module out of reset */
 	ret = tc3589x_set_bits(tc3589x, TC3589x_RSTCTRL,
diff --git a/drivers/input/keyboard/tc3589x-keypad.c b/drivers/input/keyboard/tc3589x-keypad.c
index 0ccc7de9b59d..08e62e6aeb1b 100644
--- a/drivers/input/keyboard/tc3589x-keypad.c
+++ b/drivers/input/keyboard/tc3589x-keypad.c
@@ -318,7 +318,6 @@ static void tc3589x_keypad_close(struct input_dev *input)
 	tc3589x_keypad_disable(keypad);
 }
 
-#ifdef CONFIG_OF
 static const struct tc3589x_keypad_platform_data *
 tc3589x_keypad_of_probe(struct device *dev)
 {
@@ -368,14 +367,6 @@ tc3589x_keypad_of_probe(struct device *dev)
 
 	return plat;
 }
-#else
-static inline const struct tc3589x_keypad_platform_data *
-tc3589x_keypad_of_probe(struct device *dev)
-{
-	return ERR_PTR(-ENODEV);
-}
-#endif
-
 
 static int tc3589x_keypad_probe(struct platform_device *pdev)
 {
diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index 38356e39adba..476e63745742 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -1210,6 +1210,7 @@ config MFD_TIMBERDALE
 config MFD_TC3589X
 	bool "Toshiba TC35892 and variants"
 	depends on I2C=y
+	depends on OF
 	select MFD_CORE
 	help
 	  Support for the Toshiba TC35892 and variants I/O Expander.
diff --git a/drivers/mfd/tc3589x.c b/drivers/mfd/tc3589x.c
index aacb3720065c..cf356395c9e9 100644
--- a/drivers/mfd/tc3589x.c
+++ b/drivers/mfd/tc3589x.c
@@ -318,7 +318,6 @@ static int tc3589x_device_init(struct tc3589x *tc3589x)
 	return ret;
 }
 
-#ifdef CONFIG_OF
 static const struct of_device_id tc3589x_match[] = {
 	/* Legacy compatible string */
 	{ .compatible = "tc3589x", .data = (void *) TC3589X_UNKNOWN },
@@ -359,14 +358,6 @@ tc3589x_of_probe(struct device *dev, enum tc3589x_version *version)
 
 	return pdata;
 }
-#else
-static inline struct tc3589x_platform_data *
-tc3589x_of_probe(struct device *dev, enum tc3589x_version *version)
-{
-	dev_err(dev, "no device tree support\n");
-	return ERR_PTR(-ENODEV);
-}
-#endif
 
 static int tc3589x_probe(struct i2c_client *i2c,
 				   const struct i2c_device_id *id)
-- 
1.9.3

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

* Re: [PATCH 1/2] input: keypad: tc3589x: localize platform data
  2015-03-19 14:52   ` Linus Walleij
@ 2015-03-19 16:38     ` Dmitry Torokhov
  -1 siblings, 0 replies; 34+ messages in thread
From: Dmitry Torokhov @ 2015-03-19 16:38 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Samuel Ortiz, Lee Jones, linux-kernel, linux-arm-kernel, linux-input

Hi Linus,

On Thu, Mar 19, 2015 at 03:52:44PM +0100, Linus Walleij wrote:
> This driver can only get its platform data from the device tree,
> and all platforms using it does that. Localize the platform data
> for the keypad. A later patch will enforce the device tree / OF
> dependence.
> 
> Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> Cc: Lee Jones <lee.jones@linaro.org>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
> Dmitry it would be great if you could ACK this patch so Lee can
> take it with the other patch through MFD.

It looks like if you are making this OF-only you can get rid of pdata
altogether and parse the OF data directly into the keypad. But that can
be done later.

Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

Thanks.

> ---
>  drivers/input/keyboard/tc3589x-keypad.c | 49 ++++++++++++++++++++++-----------
>  include/linux/mfd/tc3589x.h             | 23 ----------------
>  2 files changed, 33 insertions(+), 39 deletions(-)
> 
> diff --git a/drivers/input/keyboard/tc3589x-keypad.c b/drivers/input/keyboard/tc3589x-keypad.c
> index 563932500ff1..0ccc7de9b59d 100644
> --- a/drivers/input/keyboard/tc3589x-keypad.c
> +++ b/drivers/input/keyboard/tc3589x-keypad.c
> @@ -70,6 +70,28 @@
>  #define TC3589x_KBD_INT_CLR	0x1
>  
>  /**
> + * struct tc35893_keypad_platform_data - platform specific keypad data
> + * @keymap_data:        matrix scan code table for keycodes
> + * @krow:               mask for available rows, value is 0xFF
> + * @kcol:               mask for available columns, value is 0xFF
> + * @debounce_period:    platform specific debounce time
> + * @settle_time:        platform specific settle down time
> + * @irqtype:            type of interrupt, falling or rising edge
> + * @enable_wakeup:      specifies if keypad event can wake up system from sleep
> + * @no_autorepeat:      flag for auto repetition
> + */
> +struct tc3589x_keypad_platform_data {
> +	const struct matrix_keymap_data *keymap_data;
> +	u8                      krow;
> +	u8                      kcol;
> +	u8                      debounce_period;
> +	u8                      settle_time;
> +	unsigned long           irqtype;
> +	bool                    enable_wakeup;
> +	bool                    no_autorepeat;
> +};
> +
> +/**
>   * struct tc_keypad - data structure used by keypad driver
>   * @tc3589x:    pointer to tc35893
>   * @input:      pointer to input device object
> @@ -360,23 +382,19 @@ static int tc3589x_keypad_probe(struct platform_device *pdev)
>  	struct tc3589x *tc3589x = dev_get_drvdata(pdev->dev.parent);
>  	struct tc_keypad *keypad;
>  	struct input_dev *input;
> -	const struct tc3589x_keypad_platform_data *plat;
>  	int error, irq;
>  
> -	plat = tc3589x->pdata->keypad;
> -	if (!plat) {
> -		plat = tc3589x_keypad_of_probe(&pdev->dev);
> -		if (IS_ERR(plat)) {
> -			dev_err(&pdev->dev, "invalid keypad platform data\n");
> -			return PTR_ERR(plat);
> -		}
> -	}
> -
>  	irq = platform_get_irq(pdev, 0);
>  	if (irq < 0)
>  		return irq;
>  
>  	keypad = kzalloc(sizeof(struct tc_keypad), GFP_KERNEL);
> +	keypad->board = tc3589x_keypad_of_probe(&pdev->dev);
> +	if (IS_ERR(keypad->board)) {
> +		dev_err(&pdev->dev, "invalid keypad platform data\n");
> +		return PTR_ERR(keypad->board);
> +	}
> +
>  	input = input_allocate_device();
>  	if (!keypad || !input) {
>  		dev_err(&pdev->dev, "failed to allocate keypad memory\n");
> @@ -384,7 +402,6 @@ static int tc3589x_keypad_probe(struct platform_device *pdev)
>  		goto err_free_mem;
>  	}
>  
> -	keypad->board = plat;
>  	keypad->input = input;
>  	keypad->tc3589x = tc3589x;
>  
> @@ -395,7 +412,7 @@ static int tc3589x_keypad_probe(struct platform_device *pdev)
>  	input->open = tc3589x_keypad_open;
>  	input->close = tc3589x_keypad_close;
>  
> -	error = matrix_keypad_build_keymap(plat->keymap_data, NULL,
> +	error = matrix_keypad_build_keymap(keypad->board->keymap_data, NULL,
>  					   TC3589x_MAX_KPROW, TC3589x_MAX_KPCOL,
>  					   NULL, input);
>  	if (error) {
> @@ -406,13 +423,13 @@ static int tc3589x_keypad_probe(struct platform_device *pdev)
>  	keypad->keymap = input->keycode;
>  
>  	input_set_capability(input, EV_MSC, MSC_SCAN);
> -	if (!plat->no_autorepeat)
> +	if (!keypad->board->no_autorepeat)
>  		__set_bit(EV_REP, input->evbit);
>  
>  	input_set_drvdata(input, keypad);
>  
>  	error = request_threaded_irq(irq, NULL, tc3589x_keypad_irq,
> -				     plat->irqtype | IRQF_ONESHOT,
> +				     keypad->board->irqtype | IRQF_ONESHOT,
>  				     "tc3589x-keypad", keypad);
>  	if (error < 0) {
>  		dev_err(&pdev->dev,
> @@ -428,8 +445,8 @@ static int tc3589x_keypad_probe(struct platform_device *pdev)
>  	}
>  
>  	/* let platform decide if keypad is a wakeup source or not */
> -	device_init_wakeup(&pdev->dev, plat->enable_wakeup);
> -	device_set_wakeup_capable(&pdev->dev, plat->enable_wakeup);
> +	device_init_wakeup(&pdev->dev, keypad->board->enable_wakeup);
> +	device_set_wakeup_capable(&pdev->dev, keypad->board->enable_wakeup);
>  
>  	platform_set_drvdata(pdev, keypad);
>  
> diff --git a/include/linux/mfd/tc3589x.h b/include/linux/mfd/tc3589x.h
> index c203c9c56776..468c31a27fcf 100644
> --- a/include/linux/mfd/tc3589x.h
> +++ b/include/linux/mfd/tc3589x.h
> @@ -140,36 +140,13 @@ extern int tc3589x_set_bits(struct tc3589x *tc3589x, u8 reg, u8 mask, u8 val);
>  #define TC_KPD_DEBOUNCE_PERIOD  0xA3
>  #define TC_KPD_SETTLE_TIME      0xA3
>  
> -/**
> - * struct tc35893_platform_data - data structure for platform specific data
> - * @keymap_data:        matrix scan code table for keycodes
> - * @krow:               mask for available rows, value is 0xFF
> - * @kcol:               mask for available columns, value is 0xFF
> - * @debounce_period:    platform specific debounce time
> - * @settle_time:        platform specific settle down time
> - * @irqtype:            type of interrupt, falling or rising edge
> - * @enable_wakeup:      specifies if keypad event can wake up system from sleep
> - * @no_autorepeat:      flag for auto repetition
> - */
> -struct tc3589x_keypad_platform_data {
> -	const struct matrix_keymap_data *keymap_data;
> -	u8                      krow;
> -	u8                      kcol;
> -	u8                      debounce_period;
> -	u8                      settle_time;
> -	unsigned long           irqtype;
> -	bool                    enable_wakeup;
> -	bool                    no_autorepeat;
> -};
>  
>  /**
>   * struct tc3589x_platform_data - TC3589x platform data
>   * @block: bitmask of blocks to enable (use TC3589x_BLOCK_*)
> - * @keypad: keypad-specific platform data
>   */
>  struct tc3589x_platform_data {
>  	unsigned int block;
> -	const struct tc3589x_keypad_platform_data *keypad;
>  };
>  
>  #endif
> -- 
> 1.9.3
> 

-- 
Dmitry

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

* [PATCH 1/2] input: keypad: tc3589x: localize platform data
@ 2015-03-19 16:38     ` Dmitry Torokhov
  0 siblings, 0 replies; 34+ messages in thread
From: Dmitry Torokhov @ 2015-03-19 16:38 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Linus,

On Thu, Mar 19, 2015 at 03:52:44PM +0100, Linus Walleij wrote:
> This driver can only get its platform data from the device tree,
> and all platforms using it does that. Localize the platform data
> for the keypad. A later patch will enforce the device tree / OF
> dependence.
> 
> Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> Cc: Lee Jones <lee.jones@linaro.org>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
> Dmitry it would be great if you could ACK this patch so Lee can
> take it with the other patch through MFD.

It looks like if you are making this OF-only you can get rid of pdata
altogether and parse the OF data directly into the keypad. But that can
be done later.

Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

Thanks.

> ---
>  drivers/input/keyboard/tc3589x-keypad.c | 49 ++++++++++++++++++++++-----------
>  include/linux/mfd/tc3589x.h             | 23 ----------------
>  2 files changed, 33 insertions(+), 39 deletions(-)
> 
> diff --git a/drivers/input/keyboard/tc3589x-keypad.c b/drivers/input/keyboard/tc3589x-keypad.c
> index 563932500ff1..0ccc7de9b59d 100644
> --- a/drivers/input/keyboard/tc3589x-keypad.c
> +++ b/drivers/input/keyboard/tc3589x-keypad.c
> @@ -70,6 +70,28 @@
>  #define TC3589x_KBD_INT_CLR	0x1
>  
>  /**
> + * struct tc35893_keypad_platform_data - platform specific keypad data
> + * @keymap_data:        matrix scan code table for keycodes
> + * @krow:               mask for available rows, value is 0xFF
> + * @kcol:               mask for available columns, value is 0xFF
> + * @debounce_period:    platform specific debounce time
> + * @settle_time:        platform specific settle down time
> + * @irqtype:            type of interrupt, falling or rising edge
> + * @enable_wakeup:      specifies if keypad event can wake up system from sleep
> + * @no_autorepeat:      flag for auto repetition
> + */
> +struct tc3589x_keypad_platform_data {
> +	const struct matrix_keymap_data *keymap_data;
> +	u8                      krow;
> +	u8                      kcol;
> +	u8                      debounce_period;
> +	u8                      settle_time;
> +	unsigned long           irqtype;
> +	bool                    enable_wakeup;
> +	bool                    no_autorepeat;
> +};
> +
> +/**
>   * struct tc_keypad - data structure used by keypad driver
>   * @tc3589x:    pointer to tc35893
>   * @input:      pointer to input device object
> @@ -360,23 +382,19 @@ static int tc3589x_keypad_probe(struct platform_device *pdev)
>  	struct tc3589x *tc3589x = dev_get_drvdata(pdev->dev.parent);
>  	struct tc_keypad *keypad;
>  	struct input_dev *input;
> -	const struct tc3589x_keypad_platform_data *plat;
>  	int error, irq;
>  
> -	plat = tc3589x->pdata->keypad;
> -	if (!plat) {
> -		plat = tc3589x_keypad_of_probe(&pdev->dev);
> -		if (IS_ERR(plat)) {
> -			dev_err(&pdev->dev, "invalid keypad platform data\n");
> -			return PTR_ERR(plat);
> -		}
> -	}
> -
>  	irq = platform_get_irq(pdev, 0);
>  	if (irq < 0)
>  		return irq;
>  
>  	keypad = kzalloc(sizeof(struct tc_keypad), GFP_KERNEL);
> +	keypad->board = tc3589x_keypad_of_probe(&pdev->dev);
> +	if (IS_ERR(keypad->board)) {
> +		dev_err(&pdev->dev, "invalid keypad platform data\n");
> +		return PTR_ERR(keypad->board);
> +	}
> +
>  	input = input_allocate_device();
>  	if (!keypad || !input) {
>  		dev_err(&pdev->dev, "failed to allocate keypad memory\n");
> @@ -384,7 +402,6 @@ static int tc3589x_keypad_probe(struct platform_device *pdev)
>  		goto err_free_mem;
>  	}
>  
> -	keypad->board = plat;
>  	keypad->input = input;
>  	keypad->tc3589x = tc3589x;
>  
> @@ -395,7 +412,7 @@ static int tc3589x_keypad_probe(struct platform_device *pdev)
>  	input->open = tc3589x_keypad_open;
>  	input->close = tc3589x_keypad_close;
>  
> -	error = matrix_keypad_build_keymap(plat->keymap_data, NULL,
> +	error = matrix_keypad_build_keymap(keypad->board->keymap_data, NULL,
>  					   TC3589x_MAX_KPROW, TC3589x_MAX_KPCOL,
>  					   NULL, input);
>  	if (error) {
> @@ -406,13 +423,13 @@ static int tc3589x_keypad_probe(struct platform_device *pdev)
>  	keypad->keymap = input->keycode;
>  
>  	input_set_capability(input, EV_MSC, MSC_SCAN);
> -	if (!plat->no_autorepeat)
> +	if (!keypad->board->no_autorepeat)
>  		__set_bit(EV_REP, input->evbit);
>  
>  	input_set_drvdata(input, keypad);
>  
>  	error = request_threaded_irq(irq, NULL, tc3589x_keypad_irq,
> -				     plat->irqtype | IRQF_ONESHOT,
> +				     keypad->board->irqtype | IRQF_ONESHOT,
>  				     "tc3589x-keypad", keypad);
>  	if (error < 0) {
>  		dev_err(&pdev->dev,
> @@ -428,8 +445,8 @@ static int tc3589x_keypad_probe(struct platform_device *pdev)
>  	}
>  
>  	/* let platform decide if keypad is a wakeup source or not */
> -	device_init_wakeup(&pdev->dev, plat->enable_wakeup);
> -	device_set_wakeup_capable(&pdev->dev, plat->enable_wakeup);
> +	device_init_wakeup(&pdev->dev, keypad->board->enable_wakeup);
> +	device_set_wakeup_capable(&pdev->dev, keypad->board->enable_wakeup);
>  
>  	platform_set_drvdata(pdev, keypad);
>  
> diff --git a/include/linux/mfd/tc3589x.h b/include/linux/mfd/tc3589x.h
> index c203c9c56776..468c31a27fcf 100644
> --- a/include/linux/mfd/tc3589x.h
> +++ b/include/linux/mfd/tc3589x.h
> @@ -140,36 +140,13 @@ extern int tc3589x_set_bits(struct tc3589x *tc3589x, u8 reg, u8 mask, u8 val);
>  #define TC_KPD_DEBOUNCE_PERIOD  0xA3
>  #define TC_KPD_SETTLE_TIME      0xA3
>  
> -/**
> - * struct tc35893_platform_data - data structure for platform specific data
> - * @keymap_data:        matrix scan code table for keycodes
> - * @krow:               mask for available rows, value is 0xFF
> - * @kcol:               mask for available columns, value is 0xFF
> - * @debounce_period:    platform specific debounce time
> - * @settle_time:        platform specific settle down time
> - * @irqtype:            type of interrupt, falling or rising edge
> - * @enable_wakeup:      specifies if keypad event can wake up system from sleep
> - * @no_autorepeat:      flag for auto repetition
> - */
> -struct tc3589x_keypad_platform_data {
> -	const struct matrix_keymap_data *keymap_data;
> -	u8                      krow;
> -	u8                      kcol;
> -	u8                      debounce_period;
> -	u8                      settle_time;
> -	unsigned long           irqtype;
> -	bool                    enable_wakeup;
> -	bool                    no_autorepeat;
> -};
>  
>  /**
>   * struct tc3589x_platform_data - TC3589x platform data
>   * @block: bitmask of blocks to enable (use TC3589x_BLOCK_*)
> - * @keypad: keypad-specific platform data
>   */
>  struct tc3589x_platform_data {
>  	unsigned int block;
> -	const struct tc3589x_keypad_platform_data *keypad;
>  };
>  
>  #endif
> -- 
> 1.9.3
> 

-- 
Dmitry

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

* Re: [PATCH 2/2] mfd: tc3589x: enforce device-tree only mode
  2015-03-19 14:52   ` Linus Walleij
@ 2015-03-19 17:00     ` Dmitry Torokhov
  -1 siblings, 0 replies; 34+ messages in thread
From: Dmitry Torokhov @ 2015-03-19 17:00 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Samuel Ortiz, Lee Jones, linux-kernel, linux-arm-kernel, linux-input

On Thu, Mar 19, 2015 at 03:52:45PM +0100, Linus Walleij wrote:
> All systems using the TC3589x multifunction expander uses
> devicetree, so don't clutter the place with a lot of
> and assume it is there.
> 
> Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> Cc: Lee Jones <lee.jones@linaro.org>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
>  drivers/gpio/Kconfig                    | 1 +
>  drivers/gpio/gpio-tc3589x.c             | 3 ---
>  drivers/input/keyboard/tc3589x-keypad.c | 9 ---------

Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

>  drivers/mfd/Kconfig                     | 1 +
>  drivers/mfd/tc3589x.c                   | 9 ---------
>  5 files changed, 2 insertions(+), 21 deletions(-)
> 
> diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
> index c1e2ca3d9a51..dc1aaa83a347 100644
> --- a/drivers/gpio/Kconfig
> +++ b/drivers/gpio/Kconfig
> @@ -669,6 +669,7 @@ config GPIO_STP_XWAY
>  config GPIO_TC3589X
>  	bool "TC3589X GPIOs"
>  	depends on MFD_TC3589X
> +	depends on OF_GPIO
>  	select GPIOLIB_IRQCHIP
>  	help
>  	  This enables support for the GPIOs found on the TC3589X
> diff --git a/drivers/gpio/gpio-tc3589x.c b/drivers/gpio/gpio-tc3589x.c
> index 11aed2671065..31b244cffabb 100644
> --- a/drivers/gpio/gpio-tc3589x.c
> +++ b/drivers/gpio/gpio-tc3589x.c
> @@ -260,10 +260,7 @@ static int tc3589x_gpio_probe(struct platform_device *pdev)
>  	tc3589x_gpio->chip.ngpio = tc3589x->num_gpio;
>  	tc3589x_gpio->chip.dev = &pdev->dev;
>  	tc3589x_gpio->chip.base = -1;
> -
> -#ifdef CONFIG_OF_GPIO
>  	tc3589x_gpio->chip.of_node = np;
> -#endif
>  
>  	/* Bring the GPIO module out of reset */
>  	ret = tc3589x_set_bits(tc3589x, TC3589x_RSTCTRL,
> diff --git a/drivers/input/keyboard/tc3589x-keypad.c b/drivers/input/keyboard/tc3589x-keypad.c
> index 0ccc7de9b59d..08e62e6aeb1b 100644
> --- a/drivers/input/keyboard/tc3589x-keypad.c
> +++ b/drivers/input/keyboard/tc3589x-keypad.c
> @@ -318,7 +318,6 @@ static void tc3589x_keypad_close(struct input_dev *input)
>  	tc3589x_keypad_disable(keypad);
>  }
>  
> -#ifdef CONFIG_OF
>  static const struct tc3589x_keypad_platform_data *
>  tc3589x_keypad_of_probe(struct device *dev)
>  {
> @@ -368,14 +367,6 @@ tc3589x_keypad_of_probe(struct device *dev)
>  
>  	return plat;
>  }
> -#else
> -static inline const struct tc3589x_keypad_platform_data *
> -tc3589x_keypad_of_probe(struct device *dev)
> -{
> -	return ERR_PTR(-ENODEV);
> -}
> -#endif
> -
>  
>  static int tc3589x_keypad_probe(struct platform_device *pdev)
>  {
> diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
> index 38356e39adba..476e63745742 100644
> --- a/drivers/mfd/Kconfig
> +++ b/drivers/mfd/Kconfig
> @@ -1210,6 +1210,7 @@ config MFD_TIMBERDALE
>  config MFD_TC3589X
>  	bool "Toshiba TC35892 and variants"
>  	depends on I2C=y
> +	depends on OF
>  	select MFD_CORE
>  	help
>  	  Support for the Toshiba TC35892 and variants I/O Expander.
> diff --git a/drivers/mfd/tc3589x.c b/drivers/mfd/tc3589x.c
> index aacb3720065c..cf356395c9e9 100644
> --- a/drivers/mfd/tc3589x.c
> +++ b/drivers/mfd/tc3589x.c
> @@ -318,7 +318,6 @@ static int tc3589x_device_init(struct tc3589x *tc3589x)
>  	return ret;
>  }
>  
> -#ifdef CONFIG_OF
>  static const struct of_device_id tc3589x_match[] = {
>  	/* Legacy compatible string */
>  	{ .compatible = "tc3589x", .data = (void *) TC3589X_UNKNOWN },
> @@ -359,14 +358,6 @@ tc3589x_of_probe(struct device *dev, enum tc3589x_version *version)
>  
>  	return pdata;
>  }
> -#else
> -static inline struct tc3589x_platform_data *
> -tc3589x_of_probe(struct device *dev, enum tc3589x_version *version)
> -{
> -	dev_err(dev, "no device tree support\n");
> -	return ERR_PTR(-ENODEV);
> -}
> -#endif
>  
>  static int tc3589x_probe(struct i2c_client *i2c,
>  				   const struct i2c_device_id *id)
> -- 
> 1.9.3
> 

-- 
Dmitry

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

* [PATCH 2/2] mfd: tc3589x: enforce device-tree only mode
@ 2015-03-19 17:00     ` Dmitry Torokhov
  0 siblings, 0 replies; 34+ messages in thread
From: Dmitry Torokhov @ 2015-03-19 17:00 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Mar 19, 2015 at 03:52:45PM +0100, Linus Walleij wrote:
> All systems using the TC3589x multifunction expander uses
> devicetree, so don't clutter the place with a lot of
> and assume it is there.
> 
> Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> Cc: Lee Jones <lee.jones@linaro.org>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
>  drivers/gpio/Kconfig                    | 1 +
>  drivers/gpio/gpio-tc3589x.c             | 3 ---
>  drivers/input/keyboard/tc3589x-keypad.c | 9 ---------

Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

>  drivers/mfd/Kconfig                     | 1 +
>  drivers/mfd/tc3589x.c                   | 9 ---------
>  5 files changed, 2 insertions(+), 21 deletions(-)
> 
> diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
> index c1e2ca3d9a51..dc1aaa83a347 100644
> --- a/drivers/gpio/Kconfig
> +++ b/drivers/gpio/Kconfig
> @@ -669,6 +669,7 @@ config GPIO_STP_XWAY
>  config GPIO_TC3589X
>  	bool "TC3589X GPIOs"
>  	depends on MFD_TC3589X
> +	depends on OF_GPIO
>  	select GPIOLIB_IRQCHIP
>  	help
>  	  This enables support for the GPIOs found on the TC3589X
> diff --git a/drivers/gpio/gpio-tc3589x.c b/drivers/gpio/gpio-tc3589x.c
> index 11aed2671065..31b244cffabb 100644
> --- a/drivers/gpio/gpio-tc3589x.c
> +++ b/drivers/gpio/gpio-tc3589x.c
> @@ -260,10 +260,7 @@ static int tc3589x_gpio_probe(struct platform_device *pdev)
>  	tc3589x_gpio->chip.ngpio = tc3589x->num_gpio;
>  	tc3589x_gpio->chip.dev = &pdev->dev;
>  	tc3589x_gpio->chip.base = -1;
> -
> -#ifdef CONFIG_OF_GPIO
>  	tc3589x_gpio->chip.of_node = np;
> -#endif
>  
>  	/* Bring the GPIO module out of reset */
>  	ret = tc3589x_set_bits(tc3589x, TC3589x_RSTCTRL,
> diff --git a/drivers/input/keyboard/tc3589x-keypad.c b/drivers/input/keyboard/tc3589x-keypad.c
> index 0ccc7de9b59d..08e62e6aeb1b 100644
> --- a/drivers/input/keyboard/tc3589x-keypad.c
> +++ b/drivers/input/keyboard/tc3589x-keypad.c
> @@ -318,7 +318,6 @@ static void tc3589x_keypad_close(struct input_dev *input)
>  	tc3589x_keypad_disable(keypad);
>  }
>  
> -#ifdef CONFIG_OF
>  static const struct tc3589x_keypad_platform_data *
>  tc3589x_keypad_of_probe(struct device *dev)
>  {
> @@ -368,14 +367,6 @@ tc3589x_keypad_of_probe(struct device *dev)
>  
>  	return plat;
>  }
> -#else
> -static inline const struct tc3589x_keypad_platform_data *
> -tc3589x_keypad_of_probe(struct device *dev)
> -{
> -	return ERR_PTR(-ENODEV);
> -}
> -#endif
> -
>  
>  static int tc3589x_keypad_probe(struct platform_device *pdev)
>  {
> diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
> index 38356e39adba..476e63745742 100644
> --- a/drivers/mfd/Kconfig
> +++ b/drivers/mfd/Kconfig
> @@ -1210,6 +1210,7 @@ config MFD_TIMBERDALE
>  config MFD_TC3589X
>  	bool "Toshiba TC35892 and variants"
>  	depends on I2C=y
> +	depends on OF
>  	select MFD_CORE
>  	help
>  	  Support for the Toshiba TC35892 and variants I/O Expander.
> diff --git a/drivers/mfd/tc3589x.c b/drivers/mfd/tc3589x.c
> index aacb3720065c..cf356395c9e9 100644
> --- a/drivers/mfd/tc3589x.c
> +++ b/drivers/mfd/tc3589x.c
> @@ -318,7 +318,6 @@ static int tc3589x_device_init(struct tc3589x *tc3589x)
>  	return ret;
>  }
>  
> -#ifdef CONFIG_OF
>  static const struct of_device_id tc3589x_match[] = {
>  	/* Legacy compatible string */
>  	{ .compatible = "tc3589x", .data = (void *) TC3589X_UNKNOWN },
> @@ -359,14 +358,6 @@ tc3589x_of_probe(struct device *dev, enum tc3589x_version *version)
>  
>  	return pdata;
>  }
> -#else
> -static inline struct tc3589x_platform_data *
> -tc3589x_of_probe(struct device *dev, enum tc3589x_version *version)
> -{
> -	dev_err(dev, "no device tree support\n");
> -	return ERR_PTR(-ENODEV);
> -}
> -#endif
>  
>  static int tc3589x_probe(struct i2c_client *i2c,
>  				   const struct i2c_device_id *id)
> -- 
> 1.9.3
> 

-- 
Dmitry

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

* Re: [PATCH 2/2] mfd: tc3589x: enforce device-tree only mode
  2015-03-19 14:52   ` Linus Walleij
@ 2015-03-20  8:21     ` Lee Jones
  -1 siblings, 0 replies; 34+ messages in thread
From: Lee Jones @ 2015-03-20  8:21 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Samuel Ortiz, Dmitry Torokhov, linux-kernel, linux-arm-kernel,
	linux-input

On Thu, 19 Mar 2015, Linus Walleij wrote:

> All systems using the TC3589x multifunction expander uses
> devicetree, so don't clutter the place with a lot of
> and assume it is there.
> 
> Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> Cc: Lee Jones <lee.jones@linaro.org>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

Acked-by: Lee Jones <lee.jones@linaro.org>

> ---
>  drivers/gpio/Kconfig                    | 1 +
>  drivers/gpio/gpio-tc3589x.c             | 3 ---
>  drivers/input/keyboard/tc3589x-keypad.c | 9 ---------
>  drivers/mfd/Kconfig                     | 1 +
>  drivers/mfd/tc3589x.c                   | 9 ---------
>  5 files changed, 2 insertions(+), 21 deletions(-)
> 
> diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
> index c1e2ca3d9a51..dc1aaa83a347 100644
> --- a/drivers/gpio/Kconfig
> +++ b/drivers/gpio/Kconfig
> @@ -669,6 +669,7 @@ config GPIO_STP_XWAY
>  config GPIO_TC3589X
>  	bool "TC3589X GPIOs"
>  	depends on MFD_TC3589X
> +	depends on OF_GPIO
>  	select GPIOLIB_IRQCHIP
>  	help
>  	  This enables support for the GPIOs found on the TC3589X
> diff --git a/drivers/gpio/gpio-tc3589x.c b/drivers/gpio/gpio-tc3589x.c
> index 11aed2671065..31b244cffabb 100644
> --- a/drivers/gpio/gpio-tc3589x.c
> +++ b/drivers/gpio/gpio-tc3589x.c
> @@ -260,10 +260,7 @@ static int tc3589x_gpio_probe(struct platform_device *pdev)
>  	tc3589x_gpio->chip.ngpio = tc3589x->num_gpio;
>  	tc3589x_gpio->chip.dev = &pdev->dev;
>  	tc3589x_gpio->chip.base = -1;
> -
> -#ifdef CONFIG_OF_GPIO
>  	tc3589x_gpio->chip.of_node = np;
> -#endif
>  
>  	/* Bring the GPIO module out of reset */
>  	ret = tc3589x_set_bits(tc3589x, TC3589x_RSTCTRL,
> diff --git a/drivers/input/keyboard/tc3589x-keypad.c b/drivers/input/keyboard/tc3589x-keypad.c
> index 0ccc7de9b59d..08e62e6aeb1b 100644
> --- a/drivers/input/keyboard/tc3589x-keypad.c
> +++ b/drivers/input/keyboard/tc3589x-keypad.c
> @@ -318,7 +318,6 @@ static void tc3589x_keypad_close(struct input_dev *input)
>  	tc3589x_keypad_disable(keypad);
>  }
>  
> -#ifdef CONFIG_OF
>  static const struct tc3589x_keypad_platform_data *
>  tc3589x_keypad_of_probe(struct device *dev)
>  {
> @@ -368,14 +367,6 @@ tc3589x_keypad_of_probe(struct device *dev)
>  
>  	return plat;
>  }
> -#else
> -static inline const struct tc3589x_keypad_platform_data *
> -tc3589x_keypad_of_probe(struct device *dev)
> -{
> -	return ERR_PTR(-ENODEV);
> -}
> -#endif
> -
>  
>  static int tc3589x_keypad_probe(struct platform_device *pdev)
>  {
> diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
> index 38356e39adba..476e63745742 100644
> --- a/drivers/mfd/Kconfig
> +++ b/drivers/mfd/Kconfig
> @@ -1210,6 +1210,7 @@ config MFD_TIMBERDALE
>  config MFD_TC3589X
>  	bool "Toshiba TC35892 and variants"
>  	depends on I2C=y
> +	depends on OF
>  	select MFD_CORE
>  	help
>  	  Support for the Toshiba TC35892 and variants I/O Expander.
> diff --git a/drivers/mfd/tc3589x.c b/drivers/mfd/tc3589x.c
> index aacb3720065c..cf356395c9e9 100644
> --- a/drivers/mfd/tc3589x.c
> +++ b/drivers/mfd/tc3589x.c
> @@ -318,7 +318,6 @@ static int tc3589x_device_init(struct tc3589x *tc3589x)
>  	return ret;
>  }
>  
> -#ifdef CONFIG_OF
>  static const struct of_device_id tc3589x_match[] = {
>  	/* Legacy compatible string */
>  	{ .compatible = "tc3589x", .data = (void *) TC3589X_UNKNOWN },
> @@ -359,14 +358,6 @@ tc3589x_of_probe(struct device *dev, enum tc3589x_version *version)
>  
>  	return pdata;
>  }
> -#else
> -static inline struct tc3589x_platform_data *
> -tc3589x_of_probe(struct device *dev, enum tc3589x_version *version)
> -{
> -	dev_err(dev, "no device tree support\n");
> -	return ERR_PTR(-ENODEV);
> -}
> -#endif
>  
>  static int tc3589x_probe(struct i2c_client *i2c,
>  				   const struct i2c_device_id *id)

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

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

* [PATCH 2/2] mfd: tc3589x: enforce device-tree only mode
@ 2015-03-20  8:21     ` Lee Jones
  0 siblings, 0 replies; 34+ messages in thread
From: Lee Jones @ 2015-03-20  8:21 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, 19 Mar 2015, Linus Walleij wrote:

> All systems using the TC3589x multifunction expander uses
> devicetree, so don't clutter the place with a lot of
> and assume it is there.
> 
> Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> Cc: Lee Jones <lee.jones@linaro.org>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

Acked-by: Lee Jones <lee.jones@linaro.org>

> ---
>  drivers/gpio/Kconfig                    | 1 +
>  drivers/gpio/gpio-tc3589x.c             | 3 ---
>  drivers/input/keyboard/tc3589x-keypad.c | 9 ---------
>  drivers/mfd/Kconfig                     | 1 +
>  drivers/mfd/tc3589x.c                   | 9 ---------
>  5 files changed, 2 insertions(+), 21 deletions(-)
> 
> diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
> index c1e2ca3d9a51..dc1aaa83a347 100644
> --- a/drivers/gpio/Kconfig
> +++ b/drivers/gpio/Kconfig
> @@ -669,6 +669,7 @@ config GPIO_STP_XWAY
>  config GPIO_TC3589X
>  	bool "TC3589X GPIOs"
>  	depends on MFD_TC3589X
> +	depends on OF_GPIO
>  	select GPIOLIB_IRQCHIP
>  	help
>  	  This enables support for the GPIOs found on the TC3589X
> diff --git a/drivers/gpio/gpio-tc3589x.c b/drivers/gpio/gpio-tc3589x.c
> index 11aed2671065..31b244cffabb 100644
> --- a/drivers/gpio/gpio-tc3589x.c
> +++ b/drivers/gpio/gpio-tc3589x.c
> @@ -260,10 +260,7 @@ static int tc3589x_gpio_probe(struct platform_device *pdev)
>  	tc3589x_gpio->chip.ngpio = tc3589x->num_gpio;
>  	tc3589x_gpio->chip.dev = &pdev->dev;
>  	tc3589x_gpio->chip.base = -1;
> -
> -#ifdef CONFIG_OF_GPIO
>  	tc3589x_gpio->chip.of_node = np;
> -#endif
>  
>  	/* Bring the GPIO module out of reset */
>  	ret = tc3589x_set_bits(tc3589x, TC3589x_RSTCTRL,
> diff --git a/drivers/input/keyboard/tc3589x-keypad.c b/drivers/input/keyboard/tc3589x-keypad.c
> index 0ccc7de9b59d..08e62e6aeb1b 100644
> --- a/drivers/input/keyboard/tc3589x-keypad.c
> +++ b/drivers/input/keyboard/tc3589x-keypad.c
> @@ -318,7 +318,6 @@ static void tc3589x_keypad_close(struct input_dev *input)
>  	tc3589x_keypad_disable(keypad);
>  }
>  
> -#ifdef CONFIG_OF
>  static const struct tc3589x_keypad_platform_data *
>  tc3589x_keypad_of_probe(struct device *dev)
>  {
> @@ -368,14 +367,6 @@ tc3589x_keypad_of_probe(struct device *dev)
>  
>  	return plat;
>  }
> -#else
> -static inline const struct tc3589x_keypad_platform_data *
> -tc3589x_keypad_of_probe(struct device *dev)
> -{
> -	return ERR_PTR(-ENODEV);
> -}
> -#endif
> -
>  
>  static int tc3589x_keypad_probe(struct platform_device *pdev)
>  {
> diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
> index 38356e39adba..476e63745742 100644
> --- a/drivers/mfd/Kconfig
> +++ b/drivers/mfd/Kconfig
> @@ -1210,6 +1210,7 @@ config MFD_TIMBERDALE
>  config MFD_TC3589X
>  	bool "Toshiba TC35892 and variants"
>  	depends on I2C=y
> +	depends on OF
>  	select MFD_CORE
>  	help
>  	  Support for the Toshiba TC35892 and variants I/O Expander.
> diff --git a/drivers/mfd/tc3589x.c b/drivers/mfd/tc3589x.c
> index aacb3720065c..cf356395c9e9 100644
> --- a/drivers/mfd/tc3589x.c
> +++ b/drivers/mfd/tc3589x.c
> @@ -318,7 +318,6 @@ static int tc3589x_device_init(struct tc3589x *tc3589x)
>  	return ret;
>  }
>  
> -#ifdef CONFIG_OF
>  static const struct of_device_id tc3589x_match[] = {
>  	/* Legacy compatible string */
>  	{ .compatible = "tc3589x", .data = (void *) TC3589X_UNKNOWN },
> @@ -359,14 +358,6 @@ tc3589x_of_probe(struct device *dev, enum tc3589x_version *version)
>  
>  	return pdata;
>  }
> -#else
> -static inline struct tc3589x_platform_data *
> -tc3589x_of_probe(struct device *dev, enum tc3589x_version *version)
> -{
> -	dev_err(dev, "no device tree support\n");
> -	return ERR_PTR(-ENODEV);
> -}
> -#endif
>  
>  static int tc3589x_probe(struct i2c_client *i2c,
>  				   const struct i2c_device_id *id)

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org ? Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

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

* Re: [PATCH 0/2] tc3589x OF only enforcement
  2015-03-19 14:52 ` Linus Walleij
  (?)
@ 2015-03-27  9:04   ` Linus Walleij
  -1 siblings, 0 replies; 34+ messages in thread
From: Linus Walleij @ 2015-03-27  9:04 UTC (permalink / raw)
  To: Samuel Ortiz, Lee Jones, Dmitry Torokhov
  Cc: linux-kernel, linux-arm-kernel, Linux Input, Linus Walleij

On Thu, Mar 19, 2015 at 3:52 PM, Linus Walleij <linus.walleij@linaro.org> wrote:

> These two patches removes the non-DT probe/config path from the
> TC3589x driver. I suggest merging both through the MFD tree if
> Dmitry can ACK the input patch.

Lee it seems Dmitry ACKed these patches, can you merge those
two patches into MFD? I don't think there will be any cross-tree deps
so you can just carry them  in MFD without any immutable branch business.

Yours,
Linus Walleij

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

* Re: [PATCH 0/2] tc3589x OF only enforcement
@ 2015-03-27  9:04   ` Linus Walleij
  0 siblings, 0 replies; 34+ messages in thread
From: Linus Walleij @ 2015-03-27  9:04 UTC (permalink / raw)
  To: Samuel Ortiz, Lee Jones, Dmitry Torokhov
  Cc: linux-kernel, linux-arm-kernel, Linux Input, Linus Walleij

On Thu, Mar 19, 2015 at 3:52 PM, Linus Walleij <linus.walleij@linaro.org> wrote:

> These two patches removes the non-DT probe/config path from the
> TC3589x driver. I suggest merging both through the MFD tree if
> Dmitry can ACK the input patch.

Lee it seems Dmitry ACKed these patches, can you merge those
two patches into MFD? I don't think there will be any cross-tree deps
so you can just carry them  in MFD without any immutable branch business.

Yours,
Linus Walleij

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

* [PATCH 0/2] tc3589x OF only enforcement
@ 2015-03-27  9:04   ` Linus Walleij
  0 siblings, 0 replies; 34+ messages in thread
From: Linus Walleij @ 2015-03-27  9:04 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Mar 19, 2015 at 3:52 PM, Linus Walleij <linus.walleij@linaro.org> wrote:

> These two patches removes the non-DT probe/config path from the
> TC3589x driver. I suggest merging both through the MFD tree if
> Dmitry can ACK the input patch.

Lee it seems Dmitry ACKed these patches, can you merge those
two patches into MFD? I don't think there will be any cross-tree deps
so you can just carry them  in MFD without any immutable branch business.

Yours,
Linus Walleij

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

* Re: [PATCH 1/2] input: keypad: tc3589x: localize platform data
  2015-03-19 14:52   ` Linus Walleij
  (?)
@ 2015-03-27 11:52     ` Lee Jones
  -1 siblings, 0 replies; 34+ messages in thread
From: Lee Jones @ 2015-03-27 11:52 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Samuel Ortiz, Dmitry Torokhov, linux-kernel, linux-arm-kernel,
	linux-input

On Thu, 19 Mar 2015, Linus Walleij wrote:

> This driver can only get its platform data from the device tree,
> and all platforms using it does that. Localize the platform data
> for the keypad. A later patch will enforce the device tree / OF
> dependence.
> 
> Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> Cc: Lee Jones <lee.jones@linaro.org>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
> Dmitry it would be great if you could ACK this patch so Lee can
> take it with the other patch through MFD.
> ---
>  drivers/input/keyboard/tc3589x-keypad.c | 49 ++++++++++++++++++++++-----------
>  include/linux/mfd/tc3589x.h             | 23 ----------------
>  2 files changed, 33 insertions(+), 39 deletions(-)

Applied, thanks.

> diff --git a/drivers/input/keyboard/tc3589x-keypad.c b/drivers/input/keyboard/tc3589x-keypad.c
> index 563932500ff1..0ccc7de9b59d 100644
> --- a/drivers/input/keyboard/tc3589x-keypad.c
> +++ b/drivers/input/keyboard/tc3589x-keypad.c
> @@ -70,6 +70,28 @@
>  #define TC3589x_KBD_INT_CLR	0x1
>  
>  /**
> + * struct tc35893_keypad_platform_data - platform specific keypad data
> + * @keymap_data:        matrix scan code table for keycodes
> + * @krow:               mask for available rows, value is 0xFF
> + * @kcol:               mask for available columns, value is 0xFF
> + * @debounce_period:    platform specific debounce time
> + * @settle_time:        platform specific settle down time
> + * @irqtype:            type of interrupt, falling or rising edge
> + * @enable_wakeup:      specifies if keypad event can wake up system from sleep
> + * @no_autorepeat:      flag for auto repetition
> + */
> +struct tc3589x_keypad_platform_data {
> +	const struct matrix_keymap_data *keymap_data;
> +	u8                      krow;
> +	u8                      kcol;
> +	u8                      debounce_period;
> +	u8                      settle_time;
> +	unsigned long           irqtype;
> +	bool                    enable_wakeup;
> +	bool                    no_autorepeat;
> +};
> +
> +/**
>   * struct tc_keypad - data structure used by keypad driver
>   * @tc3589x:    pointer to tc35893
>   * @input:      pointer to input device object
> @@ -360,23 +382,19 @@ static int tc3589x_keypad_probe(struct platform_device *pdev)
>  	struct tc3589x *tc3589x = dev_get_drvdata(pdev->dev.parent);
>  	struct tc_keypad *keypad;
>  	struct input_dev *input;
> -	const struct tc3589x_keypad_platform_data *plat;
>  	int error, irq;
>  
> -	plat = tc3589x->pdata->keypad;
> -	if (!plat) {
> -		plat = tc3589x_keypad_of_probe(&pdev->dev);
> -		if (IS_ERR(plat)) {
> -			dev_err(&pdev->dev, "invalid keypad platform data\n");
> -			return PTR_ERR(plat);
> -		}
> -	}
> -
>  	irq = platform_get_irq(pdev, 0);
>  	if (irq < 0)
>  		return irq;
>  
>  	keypad = kzalloc(sizeof(struct tc_keypad), GFP_KERNEL);
> +	keypad->board = tc3589x_keypad_of_probe(&pdev->dev);
> +	if (IS_ERR(keypad->board)) {
> +		dev_err(&pdev->dev, "invalid keypad platform data\n");
> +		return PTR_ERR(keypad->board);
> +	}
> +
>  	input = input_allocate_device();
>  	if (!keypad || !input) {
>  		dev_err(&pdev->dev, "failed to allocate keypad memory\n");
> @@ -384,7 +402,6 @@ static int tc3589x_keypad_probe(struct platform_device *pdev)
>  		goto err_free_mem;
>  	}
>  
> -	keypad->board = plat;
>  	keypad->input = input;
>  	keypad->tc3589x = tc3589x;
>  
> @@ -395,7 +412,7 @@ static int tc3589x_keypad_probe(struct platform_device *pdev)
>  	input->open = tc3589x_keypad_open;
>  	input->close = tc3589x_keypad_close;
>  
> -	error = matrix_keypad_build_keymap(plat->keymap_data, NULL,
> +	error = matrix_keypad_build_keymap(keypad->board->keymap_data, NULL,
>  					   TC3589x_MAX_KPROW, TC3589x_MAX_KPCOL,
>  					   NULL, input);
>  	if (error) {
> @@ -406,13 +423,13 @@ static int tc3589x_keypad_probe(struct platform_device *pdev)
>  	keypad->keymap = input->keycode;
>  
>  	input_set_capability(input, EV_MSC, MSC_SCAN);
> -	if (!plat->no_autorepeat)
> +	if (!keypad->board->no_autorepeat)
>  		__set_bit(EV_REP, input->evbit);
>  
>  	input_set_drvdata(input, keypad);
>  
>  	error = request_threaded_irq(irq, NULL, tc3589x_keypad_irq,
> -				     plat->irqtype | IRQF_ONESHOT,
> +				     keypad->board->irqtype | IRQF_ONESHOT,
>  				     "tc3589x-keypad", keypad);
>  	if (error < 0) {
>  		dev_err(&pdev->dev,
> @@ -428,8 +445,8 @@ static int tc3589x_keypad_probe(struct platform_device *pdev)
>  	}
>  
>  	/* let platform decide if keypad is a wakeup source or not */
> -	device_init_wakeup(&pdev->dev, plat->enable_wakeup);
> -	device_set_wakeup_capable(&pdev->dev, plat->enable_wakeup);
> +	device_init_wakeup(&pdev->dev, keypad->board->enable_wakeup);
> +	device_set_wakeup_capable(&pdev->dev, keypad->board->enable_wakeup);
>  
>  	platform_set_drvdata(pdev, keypad);
>  
> diff --git a/include/linux/mfd/tc3589x.h b/include/linux/mfd/tc3589x.h
> index c203c9c56776..468c31a27fcf 100644
> --- a/include/linux/mfd/tc3589x.h
> +++ b/include/linux/mfd/tc3589x.h
> @@ -140,36 +140,13 @@ extern int tc3589x_set_bits(struct tc3589x *tc3589x, u8 reg, u8 mask, u8 val);
>  #define TC_KPD_DEBOUNCE_PERIOD  0xA3
>  #define TC_KPD_SETTLE_TIME      0xA3
>  
> -/**
> - * struct tc35893_platform_data - data structure for platform specific data
> - * @keymap_data:        matrix scan code table for keycodes
> - * @krow:               mask for available rows, value is 0xFF
> - * @kcol:               mask for available columns, value is 0xFF
> - * @debounce_period:    platform specific debounce time
> - * @settle_time:        platform specific settle down time
> - * @irqtype:            type of interrupt, falling or rising edge
> - * @enable_wakeup:      specifies if keypad event can wake up system from sleep
> - * @no_autorepeat:      flag for auto repetition
> - */
> -struct tc3589x_keypad_platform_data {
> -	const struct matrix_keymap_data *keymap_data;
> -	u8                      krow;
> -	u8                      kcol;
> -	u8                      debounce_period;
> -	u8                      settle_time;
> -	unsigned long           irqtype;
> -	bool                    enable_wakeup;
> -	bool                    no_autorepeat;
> -};
>  
>  /**
>   * struct tc3589x_platform_data - TC3589x platform data
>   * @block: bitmask of blocks to enable (use TC3589x_BLOCK_*)
> - * @keypad: keypad-specific platform data
>   */
>  struct tc3589x_platform_data {
>  	unsigned int block;
> -	const struct tc3589x_keypad_platform_data *keypad;
>  };
>  
>  #endif

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

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

* Re: [PATCH 1/2] input: keypad: tc3589x: localize platform data
@ 2015-03-27 11:52     ` Lee Jones
  0 siblings, 0 replies; 34+ messages in thread
From: Lee Jones @ 2015-03-27 11:52 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Samuel Ortiz, Dmitry Torokhov, linux-kernel, linux-arm-kernel,
	linux-input

On Thu, 19 Mar 2015, Linus Walleij wrote:

> This driver can only get its platform data from the device tree,
> and all platforms using it does that. Localize the platform data
> for the keypad. A later patch will enforce the device tree / OF
> dependence.
> 
> Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> Cc: Lee Jones <lee.jones@linaro.org>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
> Dmitry it would be great if you could ACK this patch so Lee can
> take it with the other patch through MFD.
> ---
>  drivers/input/keyboard/tc3589x-keypad.c | 49 ++++++++++++++++++++++-----------
>  include/linux/mfd/tc3589x.h             | 23 ----------------
>  2 files changed, 33 insertions(+), 39 deletions(-)

Applied, thanks.

> diff --git a/drivers/input/keyboard/tc3589x-keypad.c b/drivers/input/keyboard/tc3589x-keypad.c
> index 563932500ff1..0ccc7de9b59d 100644
> --- a/drivers/input/keyboard/tc3589x-keypad.c
> +++ b/drivers/input/keyboard/tc3589x-keypad.c
> @@ -70,6 +70,28 @@
>  #define TC3589x_KBD_INT_CLR	0x1
>  
>  /**
> + * struct tc35893_keypad_platform_data - platform specific keypad data
> + * @keymap_data:        matrix scan code table for keycodes
> + * @krow:               mask for available rows, value is 0xFF
> + * @kcol:               mask for available columns, value is 0xFF
> + * @debounce_period:    platform specific debounce time
> + * @settle_time:        platform specific settle down time
> + * @irqtype:            type of interrupt, falling or rising edge
> + * @enable_wakeup:      specifies if keypad event can wake up system from sleep
> + * @no_autorepeat:      flag for auto repetition
> + */
> +struct tc3589x_keypad_platform_data {
> +	const struct matrix_keymap_data *keymap_data;
> +	u8                      krow;
> +	u8                      kcol;
> +	u8                      debounce_period;
> +	u8                      settle_time;
> +	unsigned long           irqtype;
> +	bool                    enable_wakeup;
> +	bool                    no_autorepeat;
> +};
> +
> +/**
>   * struct tc_keypad - data structure used by keypad driver
>   * @tc3589x:    pointer to tc35893
>   * @input:      pointer to input device object
> @@ -360,23 +382,19 @@ static int tc3589x_keypad_probe(struct platform_device *pdev)
>  	struct tc3589x *tc3589x = dev_get_drvdata(pdev->dev.parent);
>  	struct tc_keypad *keypad;
>  	struct input_dev *input;
> -	const struct tc3589x_keypad_platform_data *plat;
>  	int error, irq;
>  
> -	plat = tc3589x->pdata->keypad;
> -	if (!plat) {
> -		plat = tc3589x_keypad_of_probe(&pdev->dev);
> -		if (IS_ERR(plat)) {
> -			dev_err(&pdev->dev, "invalid keypad platform data\n");
> -			return PTR_ERR(plat);
> -		}
> -	}
> -
>  	irq = platform_get_irq(pdev, 0);
>  	if (irq < 0)
>  		return irq;
>  
>  	keypad = kzalloc(sizeof(struct tc_keypad), GFP_KERNEL);
> +	keypad->board = tc3589x_keypad_of_probe(&pdev->dev);
> +	if (IS_ERR(keypad->board)) {
> +		dev_err(&pdev->dev, "invalid keypad platform data\n");
> +		return PTR_ERR(keypad->board);
> +	}
> +
>  	input = input_allocate_device();
>  	if (!keypad || !input) {
>  		dev_err(&pdev->dev, "failed to allocate keypad memory\n");
> @@ -384,7 +402,6 @@ static int tc3589x_keypad_probe(struct platform_device *pdev)
>  		goto err_free_mem;
>  	}
>  
> -	keypad->board = plat;
>  	keypad->input = input;
>  	keypad->tc3589x = tc3589x;
>  
> @@ -395,7 +412,7 @@ static int tc3589x_keypad_probe(struct platform_device *pdev)
>  	input->open = tc3589x_keypad_open;
>  	input->close = tc3589x_keypad_close;
>  
> -	error = matrix_keypad_build_keymap(plat->keymap_data, NULL,
> +	error = matrix_keypad_build_keymap(keypad->board->keymap_data, NULL,
>  					   TC3589x_MAX_KPROW, TC3589x_MAX_KPCOL,
>  					   NULL, input);
>  	if (error) {
> @@ -406,13 +423,13 @@ static int tc3589x_keypad_probe(struct platform_device *pdev)
>  	keypad->keymap = input->keycode;
>  
>  	input_set_capability(input, EV_MSC, MSC_SCAN);
> -	if (!plat->no_autorepeat)
> +	if (!keypad->board->no_autorepeat)
>  		__set_bit(EV_REP, input->evbit);
>  
>  	input_set_drvdata(input, keypad);
>  
>  	error = request_threaded_irq(irq, NULL, tc3589x_keypad_irq,
> -				     plat->irqtype | IRQF_ONESHOT,
> +				     keypad->board->irqtype | IRQF_ONESHOT,
>  				     "tc3589x-keypad", keypad);
>  	if (error < 0) {
>  		dev_err(&pdev->dev,
> @@ -428,8 +445,8 @@ static int tc3589x_keypad_probe(struct platform_device *pdev)
>  	}
>  
>  	/* let platform decide if keypad is a wakeup source or not */
> -	device_init_wakeup(&pdev->dev, plat->enable_wakeup);
> -	device_set_wakeup_capable(&pdev->dev, plat->enable_wakeup);
> +	device_init_wakeup(&pdev->dev, keypad->board->enable_wakeup);
> +	device_set_wakeup_capable(&pdev->dev, keypad->board->enable_wakeup);
>  
>  	platform_set_drvdata(pdev, keypad);
>  
> diff --git a/include/linux/mfd/tc3589x.h b/include/linux/mfd/tc3589x.h
> index c203c9c56776..468c31a27fcf 100644
> --- a/include/linux/mfd/tc3589x.h
> +++ b/include/linux/mfd/tc3589x.h
> @@ -140,36 +140,13 @@ extern int tc3589x_set_bits(struct tc3589x *tc3589x, u8 reg, u8 mask, u8 val);
>  #define TC_KPD_DEBOUNCE_PERIOD  0xA3
>  #define TC_KPD_SETTLE_TIME      0xA3
>  
> -/**
> - * struct tc35893_platform_data - data structure for platform specific data
> - * @keymap_data:        matrix scan code table for keycodes
> - * @krow:               mask for available rows, value is 0xFF
> - * @kcol:               mask for available columns, value is 0xFF
> - * @debounce_period:    platform specific debounce time
> - * @settle_time:        platform specific settle down time
> - * @irqtype:            type of interrupt, falling or rising edge
> - * @enable_wakeup:      specifies if keypad event can wake up system from sleep
> - * @no_autorepeat:      flag for auto repetition
> - */
> -struct tc3589x_keypad_platform_data {
> -	const struct matrix_keymap_data *keymap_data;
> -	u8                      krow;
> -	u8                      kcol;
> -	u8                      debounce_period;
> -	u8                      settle_time;
> -	unsigned long           irqtype;
> -	bool                    enable_wakeup;
> -	bool                    no_autorepeat;
> -};
>  
>  /**
>   * struct tc3589x_platform_data - TC3589x platform data
>   * @block: bitmask of blocks to enable (use TC3589x_BLOCK_*)
> - * @keypad: keypad-specific platform data
>   */
>  struct tc3589x_platform_data {
>  	unsigned int block;
> -	const struct tc3589x_keypad_platform_data *keypad;
>  };
>  
>  #endif

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH 1/2] input: keypad: tc3589x: localize platform data
@ 2015-03-27 11:52     ` Lee Jones
  0 siblings, 0 replies; 34+ messages in thread
From: Lee Jones @ 2015-03-27 11:52 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, 19 Mar 2015, Linus Walleij wrote:

> This driver can only get its platform data from the device tree,
> and all platforms using it does that. Localize the platform data
> for the keypad. A later patch will enforce the device tree / OF
> dependence.
> 
> Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> Cc: Lee Jones <lee.jones@linaro.org>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
> Dmitry it would be great if you could ACK this patch so Lee can
> take it with the other patch through MFD.
> ---
>  drivers/input/keyboard/tc3589x-keypad.c | 49 ++++++++++++++++++++++-----------
>  include/linux/mfd/tc3589x.h             | 23 ----------------
>  2 files changed, 33 insertions(+), 39 deletions(-)

Applied, thanks.

> diff --git a/drivers/input/keyboard/tc3589x-keypad.c b/drivers/input/keyboard/tc3589x-keypad.c
> index 563932500ff1..0ccc7de9b59d 100644
> --- a/drivers/input/keyboard/tc3589x-keypad.c
> +++ b/drivers/input/keyboard/tc3589x-keypad.c
> @@ -70,6 +70,28 @@
>  #define TC3589x_KBD_INT_CLR	0x1
>  
>  /**
> + * struct tc35893_keypad_platform_data - platform specific keypad data
> + * @keymap_data:        matrix scan code table for keycodes
> + * @krow:               mask for available rows, value is 0xFF
> + * @kcol:               mask for available columns, value is 0xFF
> + * @debounce_period:    platform specific debounce time
> + * @settle_time:        platform specific settle down time
> + * @irqtype:            type of interrupt, falling or rising edge
> + * @enable_wakeup:      specifies if keypad event can wake up system from sleep
> + * @no_autorepeat:      flag for auto repetition
> + */
> +struct tc3589x_keypad_platform_data {
> +	const struct matrix_keymap_data *keymap_data;
> +	u8                      krow;
> +	u8                      kcol;
> +	u8                      debounce_period;
> +	u8                      settle_time;
> +	unsigned long           irqtype;
> +	bool                    enable_wakeup;
> +	bool                    no_autorepeat;
> +};
> +
> +/**
>   * struct tc_keypad - data structure used by keypad driver
>   * @tc3589x:    pointer to tc35893
>   * @input:      pointer to input device object
> @@ -360,23 +382,19 @@ static int tc3589x_keypad_probe(struct platform_device *pdev)
>  	struct tc3589x *tc3589x = dev_get_drvdata(pdev->dev.parent);
>  	struct tc_keypad *keypad;
>  	struct input_dev *input;
> -	const struct tc3589x_keypad_platform_data *plat;
>  	int error, irq;
>  
> -	plat = tc3589x->pdata->keypad;
> -	if (!plat) {
> -		plat = tc3589x_keypad_of_probe(&pdev->dev);
> -		if (IS_ERR(plat)) {
> -			dev_err(&pdev->dev, "invalid keypad platform data\n");
> -			return PTR_ERR(plat);
> -		}
> -	}
> -
>  	irq = platform_get_irq(pdev, 0);
>  	if (irq < 0)
>  		return irq;
>  
>  	keypad = kzalloc(sizeof(struct tc_keypad), GFP_KERNEL);
> +	keypad->board = tc3589x_keypad_of_probe(&pdev->dev);
> +	if (IS_ERR(keypad->board)) {
> +		dev_err(&pdev->dev, "invalid keypad platform data\n");
> +		return PTR_ERR(keypad->board);
> +	}
> +
>  	input = input_allocate_device();
>  	if (!keypad || !input) {
>  		dev_err(&pdev->dev, "failed to allocate keypad memory\n");
> @@ -384,7 +402,6 @@ static int tc3589x_keypad_probe(struct platform_device *pdev)
>  		goto err_free_mem;
>  	}
>  
> -	keypad->board = plat;
>  	keypad->input = input;
>  	keypad->tc3589x = tc3589x;
>  
> @@ -395,7 +412,7 @@ static int tc3589x_keypad_probe(struct platform_device *pdev)
>  	input->open = tc3589x_keypad_open;
>  	input->close = tc3589x_keypad_close;
>  
> -	error = matrix_keypad_build_keymap(plat->keymap_data, NULL,
> +	error = matrix_keypad_build_keymap(keypad->board->keymap_data, NULL,
>  					   TC3589x_MAX_KPROW, TC3589x_MAX_KPCOL,
>  					   NULL, input);
>  	if (error) {
> @@ -406,13 +423,13 @@ static int tc3589x_keypad_probe(struct platform_device *pdev)
>  	keypad->keymap = input->keycode;
>  
>  	input_set_capability(input, EV_MSC, MSC_SCAN);
> -	if (!plat->no_autorepeat)
> +	if (!keypad->board->no_autorepeat)
>  		__set_bit(EV_REP, input->evbit);
>  
>  	input_set_drvdata(input, keypad);
>  
>  	error = request_threaded_irq(irq, NULL, tc3589x_keypad_irq,
> -				     plat->irqtype | IRQF_ONESHOT,
> +				     keypad->board->irqtype | IRQF_ONESHOT,
>  				     "tc3589x-keypad", keypad);
>  	if (error < 0) {
>  		dev_err(&pdev->dev,
> @@ -428,8 +445,8 @@ static int tc3589x_keypad_probe(struct platform_device *pdev)
>  	}
>  
>  	/* let platform decide if keypad is a wakeup source or not */
> -	device_init_wakeup(&pdev->dev, plat->enable_wakeup);
> -	device_set_wakeup_capable(&pdev->dev, plat->enable_wakeup);
> +	device_init_wakeup(&pdev->dev, keypad->board->enable_wakeup);
> +	device_set_wakeup_capable(&pdev->dev, keypad->board->enable_wakeup);
>  
>  	platform_set_drvdata(pdev, keypad);
>  
> diff --git a/include/linux/mfd/tc3589x.h b/include/linux/mfd/tc3589x.h
> index c203c9c56776..468c31a27fcf 100644
> --- a/include/linux/mfd/tc3589x.h
> +++ b/include/linux/mfd/tc3589x.h
> @@ -140,36 +140,13 @@ extern int tc3589x_set_bits(struct tc3589x *tc3589x, u8 reg, u8 mask, u8 val);
>  #define TC_KPD_DEBOUNCE_PERIOD  0xA3
>  #define TC_KPD_SETTLE_TIME      0xA3
>  
> -/**
> - * struct tc35893_platform_data - data structure for platform specific data
> - * @keymap_data:        matrix scan code table for keycodes
> - * @krow:               mask for available rows, value is 0xFF
> - * @kcol:               mask for available columns, value is 0xFF
> - * @debounce_period:    platform specific debounce time
> - * @settle_time:        platform specific settle down time
> - * @irqtype:            type of interrupt, falling or rising edge
> - * @enable_wakeup:      specifies if keypad event can wake up system from sleep
> - * @no_autorepeat:      flag for auto repetition
> - */
> -struct tc3589x_keypad_platform_data {
> -	const struct matrix_keymap_data *keymap_data;
> -	u8                      krow;
> -	u8                      kcol;
> -	u8                      debounce_period;
> -	u8                      settle_time;
> -	unsigned long           irqtype;
> -	bool                    enable_wakeup;
> -	bool                    no_autorepeat;
> -};
>  
>  /**
>   * struct tc3589x_platform_data - TC3589x platform data
>   * @block: bitmask of blocks to enable (use TC3589x_BLOCK_*)
> - * @keypad: keypad-specific platform data
>   */
>  struct tc3589x_platform_data {
>  	unsigned int block;
> -	const struct tc3589x_keypad_platform_data *keypad;
>  };
>  
>  #endif

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org ? Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

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

* Re: [PATCH 2/2] mfd: tc3589x: enforce device-tree only mode
  2015-03-19 14:52   ` Linus Walleij
  (?)
@ 2015-03-27 11:53     ` Lee Jones
  -1 siblings, 0 replies; 34+ messages in thread
From: Lee Jones @ 2015-03-27 11:53 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Samuel Ortiz, Dmitry Torokhov, linux-kernel, linux-arm-kernel,
	linux-input

On Thu, 19 Mar 2015, Linus Walleij wrote:

> All systems using the TC3589x multifunction expander uses
> devicetree, so don't clutter the place with a lot of
> and assume it is there.
> 
> Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> Cc: Lee Jones <lee.jones@linaro.org>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
>  drivers/gpio/Kconfig                    | 1 +
>  drivers/gpio/gpio-tc3589x.c             | 3 ---
>  drivers/input/keyboard/tc3589x-keypad.c | 9 ---------
>  drivers/mfd/Kconfig                     | 1 +
>  drivers/mfd/tc3589x.c                   | 9 ---------
>  5 files changed, 2 insertions(+), 21 deletions(-)

Applied, thanks.

> diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
> index c1e2ca3d9a51..dc1aaa83a347 100644
> --- a/drivers/gpio/Kconfig
> +++ b/drivers/gpio/Kconfig
> @@ -669,6 +669,7 @@ config GPIO_STP_XWAY
>  config GPIO_TC3589X
>  	bool "TC3589X GPIOs"
>  	depends on MFD_TC3589X
> +	depends on OF_GPIO
>  	select GPIOLIB_IRQCHIP
>  	help
>  	  This enables support for the GPIOs found on the TC3589X
> diff --git a/drivers/gpio/gpio-tc3589x.c b/drivers/gpio/gpio-tc3589x.c
> index 11aed2671065..31b244cffabb 100644
> --- a/drivers/gpio/gpio-tc3589x.c
> +++ b/drivers/gpio/gpio-tc3589x.c
> @@ -260,10 +260,7 @@ static int tc3589x_gpio_probe(struct platform_device *pdev)
>  	tc3589x_gpio->chip.ngpio = tc3589x->num_gpio;
>  	tc3589x_gpio->chip.dev = &pdev->dev;
>  	tc3589x_gpio->chip.base = -1;
> -
> -#ifdef CONFIG_OF_GPIO
>  	tc3589x_gpio->chip.of_node = np;
> -#endif
>  
>  	/* Bring the GPIO module out of reset */
>  	ret = tc3589x_set_bits(tc3589x, TC3589x_RSTCTRL,
> diff --git a/drivers/input/keyboard/tc3589x-keypad.c b/drivers/input/keyboard/tc3589x-keypad.c
> index 0ccc7de9b59d..08e62e6aeb1b 100644
> --- a/drivers/input/keyboard/tc3589x-keypad.c
> +++ b/drivers/input/keyboard/tc3589x-keypad.c
> @@ -318,7 +318,6 @@ static void tc3589x_keypad_close(struct input_dev *input)
>  	tc3589x_keypad_disable(keypad);
>  }
>  
> -#ifdef CONFIG_OF
>  static const struct tc3589x_keypad_platform_data *
>  tc3589x_keypad_of_probe(struct device *dev)
>  {
> @@ -368,14 +367,6 @@ tc3589x_keypad_of_probe(struct device *dev)
>  
>  	return plat;
>  }
> -#else
> -static inline const struct tc3589x_keypad_platform_data *
> -tc3589x_keypad_of_probe(struct device *dev)
> -{
> -	return ERR_PTR(-ENODEV);
> -}
> -#endif
> -
>  
>  static int tc3589x_keypad_probe(struct platform_device *pdev)
>  {
> diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
> index 38356e39adba..476e63745742 100644
> --- a/drivers/mfd/Kconfig
> +++ b/drivers/mfd/Kconfig
> @@ -1210,6 +1210,7 @@ config MFD_TIMBERDALE
>  config MFD_TC3589X
>  	bool "Toshiba TC35892 and variants"
>  	depends on I2C=y
> +	depends on OF
>  	select MFD_CORE
>  	help
>  	  Support for the Toshiba TC35892 and variants I/O Expander.
> diff --git a/drivers/mfd/tc3589x.c b/drivers/mfd/tc3589x.c
> index aacb3720065c..cf356395c9e9 100644
> --- a/drivers/mfd/tc3589x.c
> +++ b/drivers/mfd/tc3589x.c
> @@ -318,7 +318,6 @@ static int tc3589x_device_init(struct tc3589x *tc3589x)
>  	return ret;
>  }
>  
> -#ifdef CONFIG_OF
>  static const struct of_device_id tc3589x_match[] = {
>  	/* Legacy compatible string */
>  	{ .compatible = "tc3589x", .data = (void *) TC3589X_UNKNOWN },
> @@ -359,14 +358,6 @@ tc3589x_of_probe(struct device *dev, enum tc3589x_version *version)
>  
>  	return pdata;
>  }
> -#else
> -static inline struct tc3589x_platform_data *
> -tc3589x_of_probe(struct device *dev, enum tc3589x_version *version)
> -{
> -	dev_err(dev, "no device tree support\n");
> -	return ERR_PTR(-ENODEV);
> -}
> -#endif
>  
>  static int tc3589x_probe(struct i2c_client *i2c,
>  				   const struct i2c_device_id *id)

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

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

* Re: [PATCH 2/2] mfd: tc3589x: enforce device-tree only mode
@ 2015-03-27 11:53     ` Lee Jones
  0 siblings, 0 replies; 34+ messages in thread
From: Lee Jones @ 2015-03-27 11:53 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Samuel Ortiz, Dmitry Torokhov, linux-kernel, linux-arm-kernel,
	linux-input

On Thu, 19 Mar 2015, Linus Walleij wrote:

> All systems using the TC3589x multifunction expander uses
> devicetree, so don't clutter the place with a lot of
> and assume it is there.
> 
> Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> Cc: Lee Jones <lee.jones@linaro.org>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
>  drivers/gpio/Kconfig                    | 1 +
>  drivers/gpio/gpio-tc3589x.c             | 3 ---
>  drivers/input/keyboard/tc3589x-keypad.c | 9 ---------
>  drivers/mfd/Kconfig                     | 1 +
>  drivers/mfd/tc3589x.c                   | 9 ---------
>  5 files changed, 2 insertions(+), 21 deletions(-)

Applied, thanks.

> diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
> index c1e2ca3d9a51..dc1aaa83a347 100644
> --- a/drivers/gpio/Kconfig
> +++ b/drivers/gpio/Kconfig
> @@ -669,6 +669,7 @@ config GPIO_STP_XWAY
>  config GPIO_TC3589X
>  	bool "TC3589X GPIOs"
>  	depends on MFD_TC3589X
> +	depends on OF_GPIO
>  	select GPIOLIB_IRQCHIP
>  	help
>  	  This enables support for the GPIOs found on the TC3589X
> diff --git a/drivers/gpio/gpio-tc3589x.c b/drivers/gpio/gpio-tc3589x.c
> index 11aed2671065..31b244cffabb 100644
> --- a/drivers/gpio/gpio-tc3589x.c
> +++ b/drivers/gpio/gpio-tc3589x.c
> @@ -260,10 +260,7 @@ static int tc3589x_gpio_probe(struct platform_device *pdev)
>  	tc3589x_gpio->chip.ngpio = tc3589x->num_gpio;
>  	tc3589x_gpio->chip.dev = &pdev->dev;
>  	tc3589x_gpio->chip.base = -1;
> -
> -#ifdef CONFIG_OF_GPIO
>  	tc3589x_gpio->chip.of_node = np;
> -#endif
>  
>  	/* Bring the GPIO module out of reset */
>  	ret = tc3589x_set_bits(tc3589x, TC3589x_RSTCTRL,
> diff --git a/drivers/input/keyboard/tc3589x-keypad.c b/drivers/input/keyboard/tc3589x-keypad.c
> index 0ccc7de9b59d..08e62e6aeb1b 100644
> --- a/drivers/input/keyboard/tc3589x-keypad.c
> +++ b/drivers/input/keyboard/tc3589x-keypad.c
> @@ -318,7 +318,6 @@ static void tc3589x_keypad_close(struct input_dev *input)
>  	tc3589x_keypad_disable(keypad);
>  }
>  
> -#ifdef CONFIG_OF
>  static const struct tc3589x_keypad_platform_data *
>  tc3589x_keypad_of_probe(struct device *dev)
>  {
> @@ -368,14 +367,6 @@ tc3589x_keypad_of_probe(struct device *dev)
>  
>  	return plat;
>  }
> -#else
> -static inline const struct tc3589x_keypad_platform_data *
> -tc3589x_keypad_of_probe(struct device *dev)
> -{
> -	return ERR_PTR(-ENODEV);
> -}
> -#endif
> -
>  
>  static int tc3589x_keypad_probe(struct platform_device *pdev)
>  {
> diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
> index 38356e39adba..476e63745742 100644
> --- a/drivers/mfd/Kconfig
> +++ b/drivers/mfd/Kconfig
> @@ -1210,6 +1210,7 @@ config MFD_TIMBERDALE
>  config MFD_TC3589X
>  	bool "Toshiba TC35892 and variants"
>  	depends on I2C=y
> +	depends on OF
>  	select MFD_CORE
>  	help
>  	  Support for the Toshiba TC35892 and variants I/O Expander.
> diff --git a/drivers/mfd/tc3589x.c b/drivers/mfd/tc3589x.c
> index aacb3720065c..cf356395c9e9 100644
> --- a/drivers/mfd/tc3589x.c
> +++ b/drivers/mfd/tc3589x.c
> @@ -318,7 +318,6 @@ static int tc3589x_device_init(struct tc3589x *tc3589x)
>  	return ret;
>  }
>  
> -#ifdef CONFIG_OF
>  static const struct of_device_id tc3589x_match[] = {
>  	/* Legacy compatible string */
>  	{ .compatible = "tc3589x", .data = (void *) TC3589X_UNKNOWN },
> @@ -359,14 +358,6 @@ tc3589x_of_probe(struct device *dev, enum tc3589x_version *version)
>  
>  	return pdata;
>  }
> -#else
> -static inline struct tc3589x_platform_data *
> -tc3589x_of_probe(struct device *dev, enum tc3589x_version *version)
> -{
> -	dev_err(dev, "no device tree support\n");
> -	return ERR_PTR(-ENODEV);
> -}
> -#endif
>  
>  static int tc3589x_probe(struct i2c_client *i2c,
>  				   const struct i2c_device_id *id)

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH 2/2] mfd: tc3589x: enforce device-tree only mode
@ 2015-03-27 11:53     ` Lee Jones
  0 siblings, 0 replies; 34+ messages in thread
From: Lee Jones @ 2015-03-27 11:53 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, 19 Mar 2015, Linus Walleij wrote:

> All systems using the TC3589x multifunction expander uses
> devicetree, so don't clutter the place with a lot of
> and assume it is there.
> 
> Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> Cc: Lee Jones <lee.jones@linaro.org>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
>  drivers/gpio/Kconfig                    | 1 +
>  drivers/gpio/gpio-tc3589x.c             | 3 ---
>  drivers/input/keyboard/tc3589x-keypad.c | 9 ---------
>  drivers/mfd/Kconfig                     | 1 +
>  drivers/mfd/tc3589x.c                   | 9 ---------
>  5 files changed, 2 insertions(+), 21 deletions(-)

Applied, thanks.

> diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
> index c1e2ca3d9a51..dc1aaa83a347 100644
> --- a/drivers/gpio/Kconfig
> +++ b/drivers/gpio/Kconfig
> @@ -669,6 +669,7 @@ config GPIO_STP_XWAY
>  config GPIO_TC3589X
>  	bool "TC3589X GPIOs"
>  	depends on MFD_TC3589X
> +	depends on OF_GPIO
>  	select GPIOLIB_IRQCHIP
>  	help
>  	  This enables support for the GPIOs found on the TC3589X
> diff --git a/drivers/gpio/gpio-tc3589x.c b/drivers/gpio/gpio-tc3589x.c
> index 11aed2671065..31b244cffabb 100644
> --- a/drivers/gpio/gpio-tc3589x.c
> +++ b/drivers/gpio/gpio-tc3589x.c
> @@ -260,10 +260,7 @@ static int tc3589x_gpio_probe(struct platform_device *pdev)
>  	tc3589x_gpio->chip.ngpio = tc3589x->num_gpio;
>  	tc3589x_gpio->chip.dev = &pdev->dev;
>  	tc3589x_gpio->chip.base = -1;
> -
> -#ifdef CONFIG_OF_GPIO
>  	tc3589x_gpio->chip.of_node = np;
> -#endif
>  
>  	/* Bring the GPIO module out of reset */
>  	ret = tc3589x_set_bits(tc3589x, TC3589x_RSTCTRL,
> diff --git a/drivers/input/keyboard/tc3589x-keypad.c b/drivers/input/keyboard/tc3589x-keypad.c
> index 0ccc7de9b59d..08e62e6aeb1b 100644
> --- a/drivers/input/keyboard/tc3589x-keypad.c
> +++ b/drivers/input/keyboard/tc3589x-keypad.c
> @@ -318,7 +318,6 @@ static void tc3589x_keypad_close(struct input_dev *input)
>  	tc3589x_keypad_disable(keypad);
>  }
>  
> -#ifdef CONFIG_OF
>  static const struct tc3589x_keypad_platform_data *
>  tc3589x_keypad_of_probe(struct device *dev)
>  {
> @@ -368,14 +367,6 @@ tc3589x_keypad_of_probe(struct device *dev)
>  
>  	return plat;
>  }
> -#else
> -static inline const struct tc3589x_keypad_platform_data *
> -tc3589x_keypad_of_probe(struct device *dev)
> -{
> -	return ERR_PTR(-ENODEV);
> -}
> -#endif
> -
>  
>  static int tc3589x_keypad_probe(struct platform_device *pdev)
>  {
> diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
> index 38356e39adba..476e63745742 100644
> --- a/drivers/mfd/Kconfig
> +++ b/drivers/mfd/Kconfig
> @@ -1210,6 +1210,7 @@ config MFD_TIMBERDALE
>  config MFD_TC3589X
>  	bool "Toshiba TC35892 and variants"
>  	depends on I2C=y
> +	depends on OF
>  	select MFD_CORE
>  	help
>  	  Support for the Toshiba TC35892 and variants I/O Expander.
> diff --git a/drivers/mfd/tc3589x.c b/drivers/mfd/tc3589x.c
> index aacb3720065c..cf356395c9e9 100644
> --- a/drivers/mfd/tc3589x.c
> +++ b/drivers/mfd/tc3589x.c
> @@ -318,7 +318,6 @@ static int tc3589x_device_init(struct tc3589x *tc3589x)
>  	return ret;
>  }
>  
> -#ifdef CONFIG_OF
>  static const struct of_device_id tc3589x_match[] = {
>  	/* Legacy compatible string */
>  	{ .compatible = "tc3589x", .data = (void *) TC3589X_UNKNOWN },
> @@ -359,14 +358,6 @@ tc3589x_of_probe(struct device *dev, enum tc3589x_version *version)
>  
>  	return pdata;
>  }
> -#else
> -static inline struct tc3589x_platform_data *
> -tc3589x_of_probe(struct device *dev, enum tc3589x_version *version)
> -{
> -	dev_err(dev, "no device tree support\n");
> -	return ERR_PTR(-ENODEV);
> -}
> -#endif
>  
>  static int tc3589x_probe(struct i2c_client *i2c,
>  				   const struct i2c_device_id *id)

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org ? Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

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

* Re: [PATCH 0/2] tc3589x OF only enforcement
  2015-03-27  9:04   ` Linus Walleij
  (?)
@ 2015-03-27 12:00     ` Lee Jones
  -1 siblings, 0 replies; 34+ messages in thread
From: Lee Jones @ 2015-03-27 12:00 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Samuel Ortiz, Dmitry Torokhov, linux-kernel, linux-arm-kernel,
	Linux Input

On Fri, 27 Mar 2015, Linus Walleij wrote:

> On Thu, Mar 19, 2015 at 3:52 PM, Linus Walleij <linus.walleij@linaro.org> wrote:
> 
> > These two patches removes the non-DT probe/config path from the
> > TC3589x driver. I suggest merging both through the MFD tree if
> > Dmitry can ACK the input patch.
> 
> Lee it seems Dmitry ACKed these patches, can you merge those
> two patches into MFD? I don't think there will be any cross-tree deps
> so you can just carry them  in MFD without any immutable branch business.

Change of plan.  20f02d6 scuppers you plans unfortunately.  Probably
best if this goes in via the Input tree.

Both patches unapplied.

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

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

* Re: [PATCH 0/2] tc3589x OF only enforcement
@ 2015-03-27 12:00     ` Lee Jones
  0 siblings, 0 replies; 34+ messages in thread
From: Lee Jones @ 2015-03-27 12:00 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Samuel Ortiz, Dmitry Torokhov, linux-kernel, linux-arm-kernel,
	Linux Input

On Fri, 27 Mar 2015, Linus Walleij wrote:

> On Thu, Mar 19, 2015 at 3:52 PM, Linus Walleij <linus.walleij@linaro.org> wrote:
> 
> > These two patches removes the non-DT probe/config path from the
> > TC3589x driver. I suggest merging both through the MFD tree if
> > Dmitry can ACK the input patch.
> 
> Lee it seems Dmitry ACKed these patches, can you merge those
> two patches into MFD? I don't think there will be any cross-tree deps
> so you can just carry them  in MFD without any immutable branch business.

Change of plan.  20f02d6 scuppers you plans unfortunately.  Probably
best if this goes in via the Input tree.

Both patches unapplied.

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH 0/2] tc3589x OF only enforcement
@ 2015-03-27 12:00     ` Lee Jones
  0 siblings, 0 replies; 34+ messages in thread
From: Lee Jones @ 2015-03-27 12:00 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, 27 Mar 2015, Linus Walleij wrote:

> On Thu, Mar 19, 2015 at 3:52 PM, Linus Walleij <linus.walleij@linaro.org> wrote:
> 
> > These two patches removes the non-DT probe/config path from the
> > TC3589x driver. I suggest merging both through the MFD tree if
> > Dmitry can ACK the input patch.
> 
> Lee it seems Dmitry ACKed these patches, can you merge those
> two patches into MFD? I don't think there will be any cross-tree deps
> so you can just carry them  in MFD without any immutable branch business.

Change of plan.  20f02d6 scuppers you plans unfortunately.  Probably
best if this goes in via the Input tree.

Both patches unapplied.

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org ? Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

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

* Re: [PATCH 1/2] input: keypad: tc3589x: localize platform data
  2015-03-19 16:38     ` Dmitry Torokhov
@ 2015-03-27 16:47       ` Dmitry Torokhov
  -1 siblings, 0 replies; 34+ messages in thread
From: Dmitry Torokhov @ 2015-03-27 16:47 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Samuel Ortiz, Lee Jones, linux-kernel, linux-arm-kernel, linux-input

On Thu, Mar 19, 2015 at 09:38:56AM -0700, Dmitry Torokhov wrote:
> Hi Linus,
> 
> On Thu, Mar 19, 2015 at 03:52:44PM +0100, Linus Walleij wrote:
> > This driver can only get its platform data from the device tree,
> > and all platforms using it does that. Localize the platform data
> > for the keypad. A later patch will enforce the device tree / OF
> > dependence.
> > 
> > Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> > Cc: Lee Jones <lee.jones@linaro.org>
> > Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> > ---
> > Dmitry it would be great if you could ACK this patch so Lee can
> > take it with the other patch through MFD.
> 
> It looks like if you are making this OF-only you can get rid of pdata
> altogether and parse the OF data directly into the keypad. But that can
> be done later.
> 
> Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

Hmm, just noticed an issue:

> >  
> >  	keypad = kzalloc(sizeof(struct tc_keypad), GFP_KERNEL);
> > +	keypad->board = tc3589x_keypad_of_probe(&pdev->dev);
> > +	if (IS_ERR(keypad->board)) {
> > +		dev_err(&pdev->dev, "invalid keypad platform data\n");
> > +		return PTR_ERR(keypad->board);
> > +	}
> > +
> >  	input = input_allocate_device();
> >  	if (!keypad || !input) {
> >  		dev_err(&pdev->dev, "failed to allocate keypad memory\n");

You slid of prasing right in between memory allocation and checking if
it succeeded, so there is a potential oops and memory leak now.

I want to commit the version of the patch below, holler if you disagree.
Note that I reverted much of plat -> board renames to keep the patch
small.

Thanks.

-- 
Dmitry


Input: tc3589x - localize platform data

From: Linus Walleij <linus.walleij@linaro.org>

This driver can only get its platform data from the device tree, and all
platforms using it do that. Localize the platform data for the keypad. A
later patch will enforce the device tree / OF dependence.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
 drivers/input/keyboard/tc3589x-keypad.c |   33 ++++++++++++++++++++++++-------
 include/linux/mfd/tc3589x.h             |   23 ----------------------
 2 files changed, 26 insertions(+), 30 deletions(-)

diff --git a/drivers/input/keyboard/tc3589x-keypad.c b/drivers/input/keyboard/tc3589x-keypad.c
index 5639325..ae90df3 100644
--- a/drivers/input/keyboard/tc3589x-keypad.c
+++ b/drivers/input/keyboard/tc3589x-keypad.c
@@ -70,6 +70,28 @@
 #define TC3589x_KBD_INT_CLR	0x1
 
 /**
+ * struct tc35893_keypad_platform_data - platform specific keypad data
+ * @keymap_data:        matrix scan code table for keycodes
+ * @krow:               mask for available rows, value is 0xFF
+ * @kcol:               mask for available columns, value is 0xFF
+ * @debounce_period:    platform specific debounce time
+ * @settle_time:        platform specific settle down time
+ * @irqtype:            type of interrupt, falling or rising edge
+ * @enable_wakeup:      specifies if keypad event can wake up system from sleep
+ * @no_autorepeat:      flag for auto repetition
+ */
+struct tc3589x_keypad_platform_data {
+	const struct matrix_keymap_data *keymap_data;
+	u8                      krow;
+	u8                      kcol;
+	u8                      debounce_period;
+	u8                      settle_time;
+	unsigned long           irqtype;
+	bool                    enable_wakeup;
+	bool                    no_autorepeat;
+};
+
+/**
  * struct tc_keypad - data structure used by keypad driver
  * @tc3589x:    pointer to tc35893
  * @input:      pointer to input device object
@@ -363,13 +385,10 @@ static int tc3589x_keypad_probe(struct platform_device *pdev)
 	const struct tc3589x_keypad_platform_data *plat;
 	int error, irq;
 
-	plat = tc3589x->pdata->keypad;
-	if (!plat) {
-		plat = tc3589x_keypad_of_probe(&pdev->dev);
-		if (IS_ERR(plat)) {
-			dev_err(&pdev->dev, "invalid keypad platform data\n");
-			return PTR_ERR(plat);
-		}
+	plat = tc3589x_keypad_of_probe(&pdev->dev);
+	if (IS_ERR(plat)) {
+		dev_err(&pdev->dev, "invalid keypad platform data\n");
+		return PTR_ERR(plat);
 	}
 
 	irq = platform_get_irq(pdev, 0);
diff --git a/include/linux/mfd/tc3589x.h b/include/linux/mfd/tc3589x.h
index c203c9c..468c31a 100644
--- a/include/linux/mfd/tc3589x.h
+++ b/include/linux/mfd/tc3589x.h
@@ -140,36 +140,13 @@ extern int tc3589x_set_bits(struct tc3589x *tc3589x, u8 reg, u8 mask, u8 val);
 #define TC_KPD_DEBOUNCE_PERIOD  0xA3
 #define TC_KPD_SETTLE_TIME      0xA3
 
-/**
- * struct tc35893_platform_data - data structure for platform specific data
- * @keymap_data:        matrix scan code table for keycodes
- * @krow:               mask for available rows, value is 0xFF
- * @kcol:               mask for available columns, value is 0xFF
- * @debounce_period:    platform specific debounce time
- * @settle_time:        platform specific settle down time
- * @irqtype:            type of interrupt, falling or rising edge
- * @enable_wakeup:      specifies if keypad event can wake up system from sleep
- * @no_autorepeat:      flag for auto repetition
- */
-struct tc3589x_keypad_platform_data {
-	const struct matrix_keymap_data *keymap_data;
-	u8                      krow;
-	u8                      kcol;
-	u8                      debounce_period;
-	u8                      settle_time;
-	unsigned long           irqtype;
-	bool                    enable_wakeup;
-	bool                    no_autorepeat;
-};
 
 /**
  * struct tc3589x_platform_data - TC3589x platform data
  * @block: bitmask of blocks to enable (use TC3589x_BLOCK_*)
- * @keypad: keypad-specific platform data
  */
 struct tc3589x_platform_data {
 	unsigned int block;
-	const struct tc3589x_keypad_platform_data *keypad;
 };
 
 #endif

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

* [PATCH 1/2] input: keypad: tc3589x: localize platform data
@ 2015-03-27 16:47       ` Dmitry Torokhov
  0 siblings, 0 replies; 34+ messages in thread
From: Dmitry Torokhov @ 2015-03-27 16:47 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Mar 19, 2015 at 09:38:56AM -0700, Dmitry Torokhov wrote:
> Hi Linus,
> 
> On Thu, Mar 19, 2015 at 03:52:44PM +0100, Linus Walleij wrote:
> > This driver can only get its platform data from the device tree,
> > and all platforms using it does that. Localize the platform data
> > for the keypad. A later patch will enforce the device tree / OF
> > dependence.
> > 
> > Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> > Cc: Lee Jones <lee.jones@linaro.org>
> > Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> > ---
> > Dmitry it would be great if you could ACK this patch so Lee can
> > take it with the other patch through MFD.
> 
> It looks like if you are making this OF-only you can get rid of pdata
> altogether and parse the OF data directly into the keypad. But that can
> be done later.
> 
> Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

Hmm, just noticed an issue:

> >  
> >  	keypad = kzalloc(sizeof(struct tc_keypad), GFP_KERNEL);
> > +	keypad->board = tc3589x_keypad_of_probe(&pdev->dev);
> > +	if (IS_ERR(keypad->board)) {
> > +		dev_err(&pdev->dev, "invalid keypad platform data\n");
> > +		return PTR_ERR(keypad->board);
> > +	}
> > +
> >  	input = input_allocate_device();
> >  	if (!keypad || !input) {
> >  		dev_err(&pdev->dev, "failed to allocate keypad memory\n");

You slid of prasing right in between memory allocation and checking if
it succeeded, so there is a potential oops and memory leak now.

I want to commit the version of the patch below, holler if you disagree.
Note that I reverted much of plat -> board renames to keep the patch
small.

Thanks.

-- 
Dmitry


Input: tc3589x - localize platform data

From: Linus Walleij <linus.walleij@linaro.org>

This driver can only get its platform data from the device tree, and all
platforms using it do that. Localize the platform data for the keypad. A
later patch will enforce the device tree / OF dependence.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
 drivers/input/keyboard/tc3589x-keypad.c |   33 ++++++++++++++++++++++++-------
 include/linux/mfd/tc3589x.h             |   23 ----------------------
 2 files changed, 26 insertions(+), 30 deletions(-)

diff --git a/drivers/input/keyboard/tc3589x-keypad.c b/drivers/input/keyboard/tc3589x-keypad.c
index 5639325..ae90df3 100644
--- a/drivers/input/keyboard/tc3589x-keypad.c
+++ b/drivers/input/keyboard/tc3589x-keypad.c
@@ -70,6 +70,28 @@
 #define TC3589x_KBD_INT_CLR	0x1
 
 /**
+ * struct tc35893_keypad_platform_data - platform specific keypad data
+ * @keymap_data:        matrix scan code table for keycodes
+ * @krow:               mask for available rows, value is 0xFF
+ * @kcol:               mask for available columns, value is 0xFF
+ * @debounce_period:    platform specific debounce time
+ * @settle_time:        platform specific settle down time
+ * @irqtype:            type of interrupt, falling or rising edge
+ * @enable_wakeup:      specifies if keypad event can wake up system from sleep
+ * @no_autorepeat:      flag for auto repetition
+ */
+struct tc3589x_keypad_platform_data {
+	const struct matrix_keymap_data *keymap_data;
+	u8                      krow;
+	u8                      kcol;
+	u8                      debounce_period;
+	u8                      settle_time;
+	unsigned long           irqtype;
+	bool                    enable_wakeup;
+	bool                    no_autorepeat;
+};
+
+/**
  * struct tc_keypad - data structure used by keypad driver
  * @tc3589x:    pointer to tc35893
  * @input:      pointer to input device object
@@ -363,13 +385,10 @@ static int tc3589x_keypad_probe(struct platform_device *pdev)
 	const struct tc3589x_keypad_platform_data *plat;
 	int error, irq;
 
-	plat = tc3589x->pdata->keypad;
-	if (!plat) {
-		plat = tc3589x_keypad_of_probe(&pdev->dev);
-		if (IS_ERR(plat)) {
-			dev_err(&pdev->dev, "invalid keypad platform data\n");
-			return PTR_ERR(plat);
-		}
+	plat = tc3589x_keypad_of_probe(&pdev->dev);
+	if (IS_ERR(plat)) {
+		dev_err(&pdev->dev, "invalid keypad platform data\n");
+		return PTR_ERR(plat);
 	}
 
 	irq = platform_get_irq(pdev, 0);
diff --git a/include/linux/mfd/tc3589x.h b/include/linux/mfd/tc3589x.h
index c203c9c..468c31a 100644
--- a/include/linux/mfd/tc3589x.h
+++ b/include/linux/mfd/tc3589x.h
@@ -140,36 +140,13 @@ extern int tc3589x_set_bits(struct tc3589x *tc3589x, u8 reg, u8 mask, u8 val);
 #define TC_KPD_DEBOUNCE_PERIOD  0xA3
 #define TC_KPD_SETTLE_TIME      0xA3
 
-/**
- * struct tc35893_platform_data - data structure for platform specific data
- * @keymap_data:        matrix scan code table for keycodes
- * @krow:               mask for available rows, value is 0xFF
- * @kcol:               mask for available columns, value is 0xFF
- * @debounce_period:    platform specific debounce time
- * @settle_time:        platform specific settle down time
- * @irqtype:            type of interrupt, falling or rising edge
- * @enable_wakeup:      specifies if keypad event can wake up system from sleep
- * @no_autorepeat:      flag for auto repetition
- */
-struct tc3589x_keypad_platform_data {
-	const struct matrix_keymap_data *keymap_data;
-	u8                      krow;
-	u8                      kcol;
-	u8                      debounce_period;
-	u8                      settle_time;
-	unsigned long           irqtype;
-	bool                    enable_wakeup;
-	bool                    no_autorepeat;
-};
 
 /**
  * struct tc3589x_platform_data - TC3589x platform data
  * @block: bitmask of blocks to enable (use TC3589x_BLOCK_*)
- * @keypad: keypad-specific platform data
  */
 struct tc3589x_platform_data {
 	unsigned int block;
-	const struct tc3589x_keypad_platform_data *keypad;
 };
 
 #endif

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

* Re: [PATCH 0/2] tc3589x OF only enforcement
  2015-03-27 12:00     ` Lee Jones
  (?)
@ 2015-03-27 16:48       ` Dmitry Torokhov
  -1 siblings, 0 replies; 34+ messages in thread
From: Dmitry Torokhov @ 2015-03-27 16:48 UTC (permalink / raw)
  To: Lee Jones
  Cc: Linus Walleij, Samuel Ortiz, linux-kernel, linux-arm-kernel, Linux Input

On Fri, Mar 27, 2015 at 12:00:33PM +0000, Lee Jones wrote:
> On Fri, 27 Mar 2015, Linus Walleij wrote:
> 
> > On Thu, Mar 19, 2015 at 3:52 PM, Linus Walleij <linus.walleij@linaro.org> wrote:
> > 
> > > These two patches removes the non-DT probe/config path from the
> > > TC3589x driver. I suggest merging both through the MFD tree if
> > > Dmitry can ACK the input patch.
> > 
> > Lee it seems Dmitry ACKed these patches, can you merge those
> > two patches into MFD? I don't think there will be any cross-tree deps
> > so you can just carry them  in MFD without any immutable branch business.
> 
> Change of plan.  20f02d6 scuppers you plans unfortunately.  Probably
> best if this goes in via the Input tree.

OK, I'm taking them then...

Thanks.

-- 
Dmitry

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

* Re: [PATCH 0/2] tc3589x OF only enforcement
@ 2015-03-27 16:48       ` Dmitry Torokhov
  0 siblings, 0 replies; 34+ messages in thread
From: Dmitry Torokhov @ 2015-03-27 16:48 UTC (permalink / raw)
  To: Lee Jones
  Cc: Linus Walleij, Samuel Ortiz, linux-kernel, linux-arm-kernel, Linux Input

On Fri, Mar 27, 2015 at 12:00:33PM +0000, Lee Jones wrote:
> On Fri, 27 Mar 2015, Linus Walleij wrote:
> 
> > On Thu, Mar 19, 2015 at 3:52 PM, Linus Walleij <linus.walleij@linaro.org> wrote:
> > 
> > > These two patches removes the non-DT probe/config path from the
> > > TC3589x driver. I suggest merging both through the MFD tree if
> > > Dmitry can ACK the input patch.
> > 
> > Lee it seems Dmitry ACKed these patches, can you merge those
> > two patches into MFD? I don't think there will be any cross-tree deps
> > so you can just carry them  in MFD without any immutable branch business.
> 
> Change of plan.  20f02d6 scuppers you plans unfortunately.  Probably
> best if this goes in via the Input tree.

OK, I'm taking them then...

Thanks.

-- 
Dmitry

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

* [PATCH 0/2] tc3589x OF only enforcement
@ 2015-03-27 16:48       ` Dmitry Torokhov
  0 siblings, 0 replies; 34+ messages in thread
From: Dmitry Torokhov @ 2015-03-27 16:48 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Mar 27, 2015 at 12:00:33PM +0000, Lee Jones wrote:
> On Fri, 27 Mar 2015, Linus Walleij wrote:
> 
> > On Thu, Mar 19, 2015 at 3:52 PM, Linus Walleij <linus.walleij@linaro.org> wrote:
> > 
> > > These two patches removes the non-DT probe/config path from the
> > > TC3589x driver. I suggest merging both through the MFD tree if
> > > Dmitry can ACK the input patch.
> > 
> > Lee it seems Dmitry ACKed these patches, can you merge those
> > two patches into MFD? I don't think there will be any cross-tree deps
> > so you can just carry them  in MFD without any immutable branch business.
> 
> Change of plan.  20f02d6 scuppers you plans unfortunately.  Probably
> best if this goes in via the Input tree.

OK, I'm taking them then...

Thanks.

-- 
Dmitry

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

* Re: [PATCH 1/2] input: keypad: tc3589x: localize platform data
  2015-03-27 16:47       ` Dmitry Torokhov
@ 2015-03-30  7:08         ` Lee Jones
  -1 siblings, 0 replies; 34+ messages in thread
From: Lee Jones @ 2015-03-30  7:08 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: Linus Walleij, Samuel Ortiz, linux-kernel, linux-arm-kernel, linux-input

On Fri, 27 Mar 2015, Dmitry Torokhov wrote:

> On Thu, Mar 19, 2015 at 09:38:56AM -0700, Dmitry Torokhov wrote:
> > Hi Linus,
> > 
> > On Thu, Mar 19, 2015 at 03:52:44PM +0100, Linus Walleij wrote:
> > > This driver can only get its platform data from the device tree,
> > > and all platforms using it does that. Localize the platform data
> > > for the keypad. A later patch will enforce the device tree / OF
> > > dependence.
> > > 
> > > Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> > > Cc: Lee Jones <lee.jones@linaro.org>
> > > Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> > > ---
> > > Dmitry it would be great if you could ACK this patch so Lee can
> > > take it with the other patch through MFD.
> > 
> > It looks like if you are making this OF-only you can get rid of pdata
> > altogether and parse the OF data directly into the keypad. But that can
> > be done later.
> > 
> > Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> 
> Hmm, just noticed an issue:
> 
> > >  
> > >  	keypad = kzalloc(sizeof(struct tc_keypad), GFP_KERNEL);
> > > +	keypad->board = tc3589x_keypad_of_probe(&pdev->dev);
> > > +	if (IS_ERR(keypad->board)) {
> > > +		dev_err(&pdev->dev, "invalid keypad platform data\n");
> > > +		return PTR_ERR(keypad->board);
> > > +	}
> > > +
> > >  	input = input_allocate_device();
> > >  	if (!keypad || !input) {
> > >  		dev_err(&pdev->dev, "failed to allocate keypad memory\n");
> 
> You slid of prasing right in between memory allocation and checking if
> it succeeded, so there is a potential oops and memory leak now.
> 
> I want to commit the version of the patch below, holler if you disagree.
> Note that I reverted much of plat -> board renames to keep the patch
> small.

Acked-by: Lee Jones <lee.jones@linaro.org>

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

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

* [PATCH 1/2] input: keypad: tc3589x: localize platform data
@ 2015-03-30  7:08         ` Lee Jones
  0 siblings, 0 replies; 34+ messages in thread
From: Lee Jones @ 2015-03-30  7:08 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, 27 Mar 2015, Dmitry Torokhov wrote:

> On Thu, Mar 19, 2015 at 09:38:56AM -0700, Dmitry Torokhov wrote:
> > Hi Linus,
> > 
> > On Thu, Mar 19, 2015 at 03:52:44PM +0100, Linus Walleij wrote:
> > > This driver can only get its platform data from the device tree,
> > > and all platforms using it does that. Localize the platform data
> > > for the keypad. A later patch will enforce the device tree / OF
> > > dependence.
> > > 
> > > Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> > > Cc: Lee Jones <lee.jones@linaro.org>
> > > Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> > > ---
> > > Dmitry it would be great if you could ACK this patch so Lee can
> > > take it with the other patch through MFD.
> > 
> > It looks like if you are making this OF-only you can get rid of pdata
> > altogether and parse the OF data directly into the keypad. But that can
> > be done later.
> > 
> > Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> 
> Hmm, just noticed an issue:
> 
> > >  
> > >  	keypad = kzalloc(sizeof(struct tc_keypad), GFP_KERNEL);
> > > +	keypad->board = tc3589x_keypad_of_probe(&pdev->dev);
> > > +	if (IS_ERR(keypad->board)) {
> > > +		dev_err(&pdev->dev, "invalid keypad platform data\n");
> > > +		return PTR_ERR(keypad->board);
> > > +	}
> > > +
> > >  	input = input_allocate_device();
> > >  	if (!keypad || !input) {
> > >  		dev_err(&pdev->dev, "failed to allocate keypad memory\n");
> 
> You slid of prasing right in between memory allocation and checking if
> it succeeded, so there is a potential oops and memory leak now.
> 
> I want to commit the version of the patch below, holler if you disagree.
> Note that I reverted much of plat -> board renames to keep the patch
> small.

Acked-by: Lee Jones <lee.jones@linaro.org>

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org ? Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

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

* Re: [PATCH 1/2] input: keypad: tc3589x: localize platform data
  2015-03-27 16:47       ` Dmitry Torokhov
  (?)
@ 2015-04-07 13:07         ` Linus Walleij
  -1 siblings, 0 replies; 34+ messages in thread
From: Linus Walleij @ 2015-04-07 13:07 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: Samuel Ortiz, Lee Jones, linux-kernel, linux-arm-kernel, Linux Input

On Fri, Mar 27, 2015 at 5:47 PM, Dmitry Torokhov
<dmitry.torokhov@gmail.com> wrote:

> Hmm, just noticed an issue:
>
>> >
>> >     keypad = kzalloc(sizeof(struct tc_keypad), GFP_KERNEL);
>> > +   keypad->board = tc3589x_keypad_of_probe(&pdev->dev);
>> > +   if (IS_ERR(keypad->board)) {
>> > +           dev_err(&pdev->dev, "invalid keypad platform data\n");
>> > +           return PTR_ERR(keypad->board);
>> > +   }
>> > +
>> >     input = input_allocate_device();
>> >     if (!keypad || !input) {
>> >             dev_err(&pdev->dev, "failed to allocate keypad memory\n");
>
> You slid of prasing right in between memory allocation and checking if
> it succeeded, so there is a potential oops and memory leak now.
>
> I want to commit the version of the patch below, holler if you disagree.
> Note that I reverted much of plat -> board renames to keep the patch
> small.

Sorry. The new version looks fine. Reviewed-by.

Yours,
Linus Walleij

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

* Re: [PATCH 1/2] input: keypad: tc3589x: localize platform data
@ 2015-04-07 13:07         ` Linus Walleij
  0 siblings, 0 replies; 34+ messages in thread
From: Linus Walleij @ 2015-04-07 13:07 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: Samuel Ortiz, Lee Jones, linux-kernel, linux-arm-kernel, Linux Input

On Fri, Mar 27, 2015 at 5:47 PM, Dmitry Torokhov
<dmitry.torokhov@gmail.com> wrote:

> Hmm, just noticed an issue:
>
>> >
>> >     keypad = kzalloc(sizeof(struct tc_keypad), GFP_KERNEL);
>> > +   keypad->board = tc3589x_keypad_of_probe(&pdev->dev);
>> > +   if (IS_ERR(keypad->board)) {
>> > +           dev_err(&pdev->dev, "invalid keypad platform data\n");
>> > +           return PTR_ERR(keypad->board);
>> > +   }
>> > +
>> >     input = input_allocate_device();
>> >     if (!keypad || !input) {
>> >             dev_err(&pdev->dev, "failed to allocate keypad memory\n");
>
> You slid of prasing right in between memory allocation and checking if
> it succeeded, so there is a potential oops and memory leak now.
>
> I want to commit the version of the patch below, holler if you disagree.
> Note that I reverted much of plat -> board renames to keep the patch
> small.

Sorry. The new version looks fine. Reviewed-by.

Yours,
Linus Walleij

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

* [PATCH 1/2] input: keypad: tc3589x: localize platform data
@ 2015-04-07 13:07         ` Linus Walleij
  0 siblings, 0 replies; 34+ messages in thread
From: Linus Walleij @ 2015-04-07 13:07 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Mar 27, 2015 at 5:47 PM, Dmitry Torokhov
<dmitry.torokhov@gmail.com> wrote:

> Hmm, just noticed an issue:
>
>> >
>> >     keypad = kzalloc(sizeof(struct tc_keypad), GFP_KERNEL);
>> > +   keypad->board = tc3589x_keypad_of_probe(&pdev->dev);
>> > +   if (IS_ERR(keypad->board)) {
>> > +           dev_err(&pdev->dev, "invalid keypad platform data\n");
>> > +           return PTR_ERR(keypad->board);
>> > +   }
>> > +
>> >     input = input_allocate_device();
>> >     if (!keypad || !input) {
>> >             dev_err(&pdev->dev, "failed to allocate keypad memory\n");
>
> You slid of prasing right in between memory allocation and checking if
> it succeeded, so there is a potential oops and memory leak now.
>
> I want to commit the version of the patch below, holler if you disagree.
> Note that I reverted much of plat -> board renames to keep the patch
> small.

Sorry. The new version looks fine. Reviewed-by.

Yours,
Linus Walleij

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

end of thread, other threads:[~2015-04-07 13:07 UTC | newest]

Thread overview: 34+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-19 14:52 [PATCH 0/2] tc3589x OF only enforcement Linus Walleij
2015-03-19 14:52 ` Linus Walleij
2015-03-19 14:52 ` [PATCH 1/2] input: keypad: tc3589x: localize platform data Linus Walleij
2015-03-19 14:52   ` Linus Walleij
2015-03-19 16:38   ` Dmitry Torokhov
2015-03-19 16:38     ` Dmitry Torokhov
2015-03-27 16:47     ` Dmitry Torokhov
2015-03-27 16:47       ` Dmitry Torokhov
2015-03-30  7:08       ` Lee Jones
2015-03-30  7:08         ` Lee Jones
2015-04-07 13:07       ` Linus Walleij
2015-04-07 13:07         ` Linus Walleij
2015-04-07 13:07         ` Linus Walleij
2015-03-27 11:52   ` Lee Jones
2015-03-27 11:52     ` Lee Jones
2015-03-27 11:52     ` Lee Jones
2015-03-19 14:52 ` [PATCH 2/2] mfd: tc3589x: enforce device-tree only mode Linus Walleij
2015-03-19 14:52   ` Linus Walleij
2015-03-19 17:00   ` Dmitry Torokhov
2015-03-19 17:00     ` Dmitry Torokhov
2015-03-20  8:21   ` Lee Jones
2015-03-20  8:21     ` Lee Jones
2015-03-27 11:53   ` Lee Jones
2015-03-27 11:53     ` Lee Jones
2015-03-27 11:53     ` Lee Jones
2015-03-27  9:04 ` [PATCH 0/2] tc3589x OF only enforcement Linus Walleij
2015-03-27  9:04   ` Linus Walleij
2015-03-27  9:04   ` Linus Walleij
2015-03-27 12:00   ` Lee Jones
2015-03-27 12:00     ` Lee Jones
2015-03-27 12:00     ` Lee Jones
2015-03-27 16:48     ` Dmitry Torokhov
2015-03-27 16:48       ` Dmitry Torokhov
2015-03-27 16:48       ` Dmitry Torokhov

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.